diff --git a/AboutHuaGoDlg.cpp b/AboutHuaGoDlg.cpp deleted file mode 100644 index 04e81d1..0000000 --- a/AboutHuaGoDlg.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// AboutHuaGoDlg.cpp : 实现文件 -// - -#include "stdafx.h" -#include "hugaotwainds.h" -#include "AboutHuaGoDlg.h" -#include "afxdialogex.h" - - -// AboutHuaGoDlg 对话框 - -IMPLEMENT_DYNAMIC(AboutHuaGoDlg, CDialog) - -AboutHuaGoDlg::AboutHuaGoDlg(std::string scnrname,std::string serialNum,std::string hardVersion,CWnd* pParent /*=NULL*/) - : CDialog(IDD_DIALOGABOUT, pParent) -{ - this->scanHardVersion=hardVersion; - this->scanName=scnrname; - this->scanSerialNum=serialNum; -} - -AboutHuaGoDlg::~AboutHuaGoDlg() -{ -} - -void AboutHuaGoDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //DDX_Control(pDX,IDC_PICABOUTHUAGO,m_pic); -} - - -BEGIN_MESSAGE_MAP(AboutHuaGoDlg, CDialog) -END_MESSAGE_MAP() - - -// AboutHuaGoDlg 消息处理程序 - - -BOOL AboutHuaGoDlg::OnInitDialog() - { - CDialog::OnInitDialog(); - // TODO: 在此添加额外的初始化 - UpdateScannerInfo(); - return TRUE; // return TRUE unless you set the focus to a control - // 异常: OCX 属性页应返回 FALSE - } - -void AboutHuaGoDlg::UpdateScannerInfo() -{ - ((CStatic*)GetDlgItem(IDC_LBSCANNERNAMEVALUE))->SetWindowText(scanName.c_str()); - ((CStatic*)GetDlgItem(IDC_LBSERIALNUMVALUE))->SetWindowText(scanSerialNum.c_str()); - ((CStatic*)GetDlgItem(IDC_LBHARDWAREVALUE))->SetWindowText(scanHardVersion.c_str()); -} diff --git a/AboutHuaGoDlg.h b/AboutHuaGoDlg.h deleted file mode 100644 index 22b5214..0000000 --- a/AboutHuaGoDlg.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once -#include "resource.h" -#include -using namespace std; -// AboutHuaGoDlg 对话框 - -class AboutHuaGoDlg : public CDialog -{ - DECLARE_DYNAMIC(AboutHuaGoDlg) - -public: - AboutHuaGoDlg(std::string scnrname="",std::string serialNum="",std::string hardVersion="", CWnd* pParent = NULL); // 标准构造函数 - virtual ~AboutHuaGoDlg(); - -// 对话框数据 - #ifdef AFX_DESIGN_TIME - enum { IDD = IDD_DIALOGABOUT }; - #endif -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 - - DECLARE_MESSAGE_MAP() -public: - virtual BOOL OnInitDialog(); -private: - void UpdateScannerInfo(); - std::string scanName; - std::string scanSerialNum; - std::string scanHardVersion; - }; diff --git a/BasicSetting.cpp b/BasicSetting.cpp deleted file mode 100644 index 0577bb1..0000000 Binary files a/BasicSetting.cpp and /dev/null differ diff --git a/BasicSetting.h b/BasicSetting.h deleted file mode 100644 index 017078d..0000000 Binary files a/BasicSetting.h and /dev/null differ diff --git a/BlockingQueue.h b/BlockingQueue.h deleted file mode 100644 index 47ccdb0..0000000 --- a/BlockingQueue.h +++ /dev/null @@ -1,89 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include - - -template -class BlockingQueue -{ -private: - BlockingQueue(const BlockingQueue& rhs); - BlockingQueue& operator =(const BlockingQueue& rhs); - mutable std::mutex _mutex; - std::condition_variable _condvar; - std::deque _queue; - volatile bool isShutDown = false; - T tRet; - -public: - BlockingQueue() - : _mutex() - , _condvar() - , _queue() - { - } - - ~BlockingQueue() - { - ShutDown(); - std::cout << "blocking queue release" << std::endl; - } - - void Clear() - { - std::lock_guard lock(_mutex); - _condvar.notify_all(); - _queue.clear(); - } - - void ShutDown() - { - isShutDown = true; - _condvar.notify_all(); - _queue.clear(); - } - - bool IsShutDown() - { - return isShutDown; - } - - void Put(const T task) - { - std::lock_guard lock(_mutex); - if (!isShutDown) - { - { - _queue.push_back(task); - } - _condvar.notify_all(); - } - - } - - T Take() - { - std::unique_lock lock(_mutex); - if (_queue.size() <= 0) - _condvar.wait(lock); - - if (isShutDown || _queue.empty()) - { - return tRet; - } - - T front(_queue.front()); - _queue.pop_front(); - - return front; - } - - size_t Size() const - { - std::lock_guard lock(_mutex); - return _queue.size(); - } -}; \ No newline at end of file diff --git a/BrightSetting.cpp b/BrightSetting.cpp deleted file mode 100644 index 7dc547d..0000000 Binary files a/BrightSetting.cpp and /dev/null differ diff --git a/BrightSetting.h b/BrightSetting.h deleted file mode 100644 index 4fa9984..0000000 Binary files a/BrightSetting.h and /dev/null differ diff --git a/CJsonObject.cpp b/CJsonObject.cpp deleted file mode 100644 index 55b3a45..0000000 --- a/CJsonObject.cpp +++ /dev/null @@ -1,2914 +0,0 @@ -/******************************************************************************* - * Project: neb - * @file CJsonObject.cpp - * @brief - * @author bwarliao - * @date: 2014-7-16- - * @note - * Modify history: - ******************************************************************************/ -#include "stdafx.h" -#include "CJsonObject.hpp" -#include "cJSON.h" - - -namespace neb -{ - - CJsonObject::CJsonObject() - : m_pJsonData(NULL), m_pExternJsonDataRef(NULL) - { - // m_pJsonData = cJSON_CreateObject(); - } - - CJsonObject::CJsonObject(const std::string& strJson) - : m_pJsonData(NULL), m_pExternJsonDataRef(NULL) - { - Parse(strJson); - } - - CJsonObject::CJsonObject(const CJsonObject* pJsonObject) - : m_pJsonData(NULL), m_pExternJsonDataRef(NULL) - { - if (pJsonObject) - { - Parse(pJsonObject->ToString()); - } - } - - CJsonObject::CJsonObject(const CJsonObject& oJsonObject) - : m_pJsonData(NULL), m_pExternJsonDataRef(NULL) - { - Parse(oJsonObject.ToString()); - } - - CJsonObject::~CJsonObject() - { - Clear(); - } - - CJsonObject& CJsonObject::operator=(const CJsonObject& oJsonObject) - { - Parse(oJsonObject.ToString().c_str()); - return(*this); - } - - bool CJsonObject::operator==(const CJsonObject& oJsonObject) const - { - return(this->ToString() == oJsonObject.ToString()); - } - - bool CJsonObject::AddEmptySubObject(const std::string& strKey) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateObject(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateObject(); - if (pJsonStruct == NULL) - { - m_strErrMsg = std::string("create sub empty object error!"); - return(false); - } - cJSON_AddItemToObject(pFocusData, strKey.c_str(), pJsonStruct); - return(true); - } - - bool CJsonObject::AddEmptySubArray(const std::string& strKey) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateObject(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateArray(); - if (pJsonStruct == NULL) - { - m_strErrMsg = std::string("create sub empty array error!"); - return(false); - } - cJSON_AddItemToObject(pFocusData, strKey.c_str(), pJsonStruct); - return(true); - } - - CJsonObject& CJsonObject::operator[](const std::string& strKey) - { - std::map::iterator iter; - iter = m_mapJsonObjectRef.find(strKey); - if (iter == m_mapJsonObjectRef.end()) - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); - } - } - if (pJsonStruct == NULL) - { - CJsonObject* pJsonObject = new CJsonObject(); - m_mapJsonObjectRef.insert(std::pair(strKey, pJsonObject)); - return(*pJsonObject); - } - else - { - CJsonObject* pJsonObject = new CJsonObject(pJsonStruct); - m_mapJsonObjectRef.insert(std::pair(strKey, pJsonObject)); - return(*pJsonObject); - } - } - else - { - return(*(iter->second)); - } - } - - CJsonObject& CJsonObject::operator[](unsigned int uiWhich) - { - std::map::iterator iter; - iter = m_mapJsonArrayRef.find(uiWhich); - if (iter == m_mapJsonArrayRef.end()) - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pJsonData, uiWhich); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pExternJsonDataRef, uiWhich); - } - } - if (pJsonStruct == NULL) - { - CJsonObject* pJsonObject = new CJsonObject(); - m_mapJsonArrayRef.insert(std::pair(uiWhich, pJsonObject)); - return(*pJsonObject); - } - else - { - CJsonObject* pJsonObject = new CJsonObject(pJsonStruct); - m_mapJsonArrayRef.insert(std::pair(uiWhich, pJsonObject)); - return(*pJsonObject); - } - } - else - { - return(*(iter->second)); - } - } - - std::string CJsonObject::operator()(const std::string& strKey) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); - } - } - if (pJsonStruct == NULL) - { - return(std::string("")); - } - if (pJsonStruct->type == cJSON_String) - { - return(pJsonStruct->valuestring); - } - else if (pJsonStruct->type == cJSON_Int) - { - char szNumber[128] = { 0 }; - if (pJsonStruct->sign == -1) - { - if ((int64)pJsonStruct->valueint <= (int64)INT_MAX && (int64)pJsonStruct->valueint >= (int64)INT_MIN) - { - snprintf(szNumber, sizeof(szNumber), "%d", (int32)pJsonStruct->valueint); - } - else - { - snprintf(szNumber, sizeof(szNumber), "%lld", (int64)pJsonStruct->valueint); - } - } - else - { - if (pJsonStruct->valueint <= (uint64)UINT_MAX) - { - snprintf(szNumber, sizeof(szNumber), "%u", (uint32)pJsonStruct->valueint); - } - else - { - snprintf(szNumber, sizeof(szNumber), "%llu", pJsonStruct->valueint); - } - } - return(std::string(szNumber)); - } - else if (pJsonStruct->type == cJSON_Double) - { - char szNumber[128] = { 0 }; - if (fabs(pJsonStruct->valuedouble) < 1.0e-6 || fabs(pJsonStruct->valuedouble) > 1.0e9) - { - snprintf(szNumber, sizeof(szNumber), "%e", pJsonStruct->valuedouble); - } - else - { - snprintf(szNumber, sizeof(szNumber), "%f", pJsonStruct->valuedouble); - } - } - else if (pJsonStruct->type == cJSON_False) - { - return(std::string("false")); - } - else if (pJsonStruct->type == cJSON_True) - { - return(std::string("true")); - } - return(std::string("")); - } - - std::string CJsonObject::operator()(unsigned int uiWhich) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pJsonData, uiWhich); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pExternJsonDataRef, uiWhich); - } - } - if (pJsonStruct == NULL) - { - return(std::string("")); - } - if (pJsonStruct->type == cJSON_String) - { - return(pJsonStruct->valuestring); - } - else if (pJsonStruct->type == cJSON_Int) - { - char szNumber[128] = { 0 }; - if (pJsonStruct->sign == -1) - { - if ((int64)pJsonStruct->valueint <= (int64)INT_MAX && (int64)pJsonStruct->valueint >= (int64)INT_MIN) - { - snprintf(szNumber, sizeof(szNumber), "%d", (int32)pJsonStruct->valueint); - } - else - { - snprintf(szNumber, sizeof(szNumber), "%lld", (int64)pJsonStruct->valueint); - } - } - else - { - if (pJsonStruct->valueint <= (uint64)UINT_MAX) - { - snprintf(szNumber, sizeof(szNumber), "%u", (uint32)pJsonStruct->valueint); - } - else - { - snprintf(szNumber, sizeof(szNumber), "%llu", pJsonStruct->valueint); - } - } - return(std::string(szNumber)); - } - else if (pJsonStruct->type == cJSON_Double) - { - char szNumber[128] = { 0 }; - if (fabs(pJsonStruct->valuedouble) < 1.0e-6 || fabs(pJsonStruct->valuedouble) > 1.0e9) - { - snprintf(szNumber, sizeof(szNumber), "%e", pJsonStruct->valuedouble); - } - else - { - snprintf(szNumber, sizeof(szNumber), "%f", pJsonStruct->valuedouble); - } - } - else if (pJsonStruct->type == cJSON_False) - { - return(std::string("false")); - } - else if (pJsonStruct->type == cJSON_True) - { - return(std::string("true")); - } - return(std::string("")); - } - - bool CJsonObject::Parse(const std::string& strJson) - { - Clear(); - m_pJsonData = cJSON_Parse(strJson.c_str()); - if (m_pJsonData == NULL) - { - m_strErrMsg = std::string("prase json string error at ") + cJSON_GetErrorPtr(); - return(false); - } - return(true); - } - - void CJsonObject::Clear() - { - m_pExternJsonDataRef = NULL; - if (m_pJsonData != NULL) - { - cJSON_Delete(m_pJsonData); - m_pJsonData = NULL; - } - for (std::map::iterator iter = m_mapJsonArrayRef.begin(); - iter != m_mapJsonArrayRef.end(); ++iter) - { - if (iter->second != NULL) - { - delete (iter->second); - iter->second = NULL; - } - } - m_mapJsonArrayRef.clear(); - for (std::map::iterator iter = m_mapJsonObjectRef.begin(); - iter != m_mapJsonObjectRef.end(); ++iter) - { - if (iter->second != NULL) - { - delete (iter->second); - iter->second = NULL; - } - } - m_mapJsonObjectRef.clear(); - } - - bool CJsonObject::IsEmpty() const - { - if (m_pJsonData != NULL) - { - return(false); - } - else if (m_pExternJsonDataRef != NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::IsArray() const - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - - if (pFocusData == NULL) - { - return(false); - } - - if (pFocusData->type == cJSON_Array) - { - return(true); - } - else - { - return(false); - } - } - - std::string CJsonObject::ToString() const - { - char* pJsonString = NULL; - std::string strJsonData = ""; - if (m_pJsonData != NULL) - { - pJsonString = cJSON_PrintUnformatted(m_pJsonData); - } - else if (m_pExternJsonDataRef != NULL) - { - pJsonString = cJSON_PrintUnformatted(m_pExternJsonDataRef); - } - if (pJsonString != NULL) - { - strJsonData = pJsonString; - free(pJsonString); - } - return(strJsonData); - } - - std::string CJsonObject::ToFormattedString() const - { - char* pJsonString = NULL; - std::string strJsonData = ""; - if (m_pJsonData != NULL) - { - pJsonString = cJSON_Print(m_pJsonData); - } - else if (m_pExternJsonDataRef != NULL) - { - pJsonString = cJSON_Print(m_pExternJsonDataRef); - } - if (pJsonString != NULL) - { - strJsonData = pJsonString; - free(pJsonString); - } - return(strJsonData); - } - - - bool CJsonObject::Get(const std::string& strKey, CJsonObject& oJsonObject) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - char* pJsonString = cJSON_Print(pJsonStruct); - std::string strJsonData = pJsonString; - free(pJsonString); - if (oJsonObject.Parse(strJsonData)) - { - return(true); - } - else - { - return(false); - } - } - - bool CJsonObject::Get(const std::string& strKey, std::string& strValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_String) - { - return(false); - } - strValue = pJsonStruct->valuestring; - return(true); - } - - bool CJsonObject::Get(const std::string& strKey, int32& iValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_Int) - { - return(false); - } - iValue = (int32)(pJsonStruct->valueint); - return(true); - } - - bool CJsonObject::Get(const std::string& strKey, uint32& uiValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_Int) - { - return(false); - } - uiValue = (uint32)(pJsonStruct->valueint); - return(true); - } - - bool CJsonObject::Get(const std::string& strKey, int64& llValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_Int) - { - return(false); - } - llValue = (int64)pJsonStruct->valueint; - return(true); - } - - bool CJsonObject::Get(const std::string& strKey, uint64& ullValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_Int) - { - return(false); - } - ullValue = (uint64)pJsonStruct->valueint; - return(true); - } - - bool CJsonObject::Get(const std::string& strKey, bool& bValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type > cJSON_True) - { - return(false); - } - bValue = pJsonStruct->type; - return(true); - } - - bool CJsonObject::Get(const std::string& strKey, float& fValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_Double) - { - return(false); - } - fValue = (float)(pJsonStruct->valuedouble); - return(true); - } - - bool CJsonObject::Get(const std::string& strKey, double& dValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Object) - { - pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_Double) - { - return(false); - } - dValue = pJsonStruct->valuedouble; - return(true); - } - - bool CJsonObject::Add(const std::string& strKey, const CJsonObject& oJsonObject) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateObject(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_Parse(oJsonObject.ToString().c_str()); - if (pJsonStruct == NULL) - { - m_strErrMsg = std::string("prase json string error at ") + cJSON_GetErrorPtr(); - return(false); - } - cJSON_AddItemToObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - std::map::iterator iter = m_mapJsonObjectRef.find(strKey); - if (iter != m_mapJsonObjectRef.end()) - { - if (iter->second != NULL) - { - delete (iter->second); - iter->second = NULL; - } - m_mapJsonObjectRef.erase(iter); - } - return(true); - } - - bool CJsonObject::Add(const std::string& strKey, const std::string& strValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateObject(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateString(strValue.c_str()); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_AddItemToObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(const std::string& strKey, int32 iValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateObject(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)iValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_AddItemToObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(const std::string& strKey, uint32 uiValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateObject(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)uiValue, 1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_AddItemToObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(const std::string& strKey, int64 llValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateObject(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)llValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_AddItemToObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(const std::string& strKey, uint64 ullValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateObject(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt(ullValue, 1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_AddItemToObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(const std::string& strKey, bool bValue, bool bValueAgain) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateObject(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateBool(bValue); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_AddItemToObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(const std::string& strKey, float fValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateObject(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateDouble((double)fValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_AddItemToObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(const std::string& strKey, double dValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateObject(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateDouble((double)dValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_AddItemToObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Delete(const std::string& strKey) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON_DeleteItemFromObject(pFocusData, strKey.c_str()); - std::map::iterator iter = m_mapJsonObjectRef.find(strKey); - if (iter != m_mapJsonObjectRef.end()) - { - if (iter->second != NULL) - { - delete (iter->second); - iter->second = NULL; - } - m_mapJsonObjectRef.erase(iter); - } - return(true); - } - - bool CJsonObject::Replace(const std::string& strKey, const CJsonObject& oJsonObject) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_Parse(oJsonObject.ToString().c_str()); - if (pJsonStruct == NULL) - { - m_strErrMsg = std::string("prase json string error at ") + cJSON_GetErrorPtr(); - return(false); - } - cJSON_ReplaceItemInObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - std::map::iterator iter = m_mapJsonObjectRef.find(strKey); - if (iter != m_mapJsonObjectRef.end()) - { - if (iter->second != NULL) - { - delete (iter->second); - iter->second = NULL; - } - m_mapJsonObjectRef.erase(iter); - } - return(true); - } - - bool CJsonObject::Replace(const std::string& strKey, const std::string& strValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateString(strValue.c_str()); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(const std::string& strKey, int32 iValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)iValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(const std::string& strKey, uint32 uiValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)uiValue, 1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(const std::string& strKey, int64 llValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)llValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(const std::string& strKey, uint64 ullValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)ullValue, 1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(const std::string& strKey, bool bValue, bool bValueAgain) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateBool(bValue); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(const std::string& strKey, float fValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateDouble((double)fValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(const std::string& strKey, double dValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Object) - { - m_strErrMsg = "not a json object! json array?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateDouble((double)dValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInObject(pFocusData, strKey.c_str(), pJsonStruct); - if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL) - { - return(false); - } - return(true); - } - - int CJsonObject::GetArraySize() - { - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Array) - { - return(cJSON_GetArraySize(m_pJsonData)); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Array) - { - return(cJSON_GetArraySize(m_pExternJsonDataRef)); - } - } - return(0); - } - - bool CJsonObject::Get(int iWhich, CJsonObject& oJsonObject) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pJsonData, iWhich); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pExternJsonDataRef, iWhich); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - char* pJsonString = cJSON_Print(pJsonStruct); - std::string strJsonData = pJsonString; - free(pJsonString); - if (oJsonObject.Parse(strJsonData)) - { - return(true); - } - else - { - return(false); - } - } - - bool CJsonObject::Get(int iWhich, std::string& strValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pJsonData, iWhich); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pExternJsonDataRef, iWhich); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_String) - { - return(false); - } - strValue = pJsonStruct->valuestring; - return(true); - } - - bool CJsonObject::Get(int iWhich, int32& iValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pJsonData, iWhich); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pExternJsonDataRef, iWhich); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_Int) - { - return(false); - } - iValue = (int32)(pJsonStruct->valueint); - return(true); - } - - bool CJsonObject::Get(int iWhich, uint32& uiValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pJsonData, iWhich); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pExternJsonDataRef, iWhich); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_Int) - { - return(false); - } - uiValue = (uint32)(pJsonStruct->valueint); - return(true); - } - - bool CJsonObject::Get(int iWhich, int64& llValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pJsonData, iWhich); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pExternJsonDataRef, iWhich); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_Int) - { - return(false); - } - llValue = (int64)pJsonStruct->valueint; - return(true); - } - - bool CJsonObject::Get(int iWhich, uint64& ullValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pJsonData, iWhich); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pExternJsonDataRef, iWhich); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_Int) - { - return(false); - } - ullValue = (uint64)pJsonStruct->valueint; - return(true); - } - - bool CJsonObject::Get(int iWhich, bool& bValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pJsonData, iWhich); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pExternJsonDataRef, iWhich); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type > cJSON_True) - { - return(false); - } - bValue = pJsonStruct->type; - return(true); - } - - bool CJsonObject::Get(int iWhich, float& fValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pJsonData, iWhich); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pExternJsonDataRef, iWhich); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_Double) - { - return(false); - } - fValue = (float)(pJsonStruct->valuedouble); - return(true); - } - - bool CJsonObject::Get(int iWhich, double& dValue) const - { - cJSON* pJsonStruct = NULL; - if (m_pJsonData != NULL) - { - if (m_pJsonData->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pJsonData, iWhich); - } - } - else if (m_pExternJsonDataRef != NULL) - { - if (m_pExternJsonDataRef->type == cJSON_Array) - { - pJsonStruct = cJSON_GetArrayItem(m_pExternJsonDataRef, iWhich); - } - } - if (pJsonStruct == NULL) - { - return(false); - } - if (pJsonStruct->type != cJSON_Double) - { - return(false); - } - dValue = pJsonStruct->valuedouble; - return(true); - } - - bool CJsonObject::Add(const CJsonObject& oJsonObject) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_Parse(oJsonObject.ToString().c_str()); - if (pJsonStruct == NULL) - { - m_strErrMsg = std::string("prase json string error at ") + cJSON_GetErrorPtr(); - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArray(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - unsigned int uiLastIndex = (unsigned int)cJSON_GetArraySize(pFocusData) - 1; - for (std::map::iterator iter = m_mapJsonArrayRef.begin(); - iter != m_mapJsonArrayRef.end(); ) - { - if (iter->first >= uiLastIndex) - { - if (iter->second != NULL) - { - delete (iter->second); - iter->second = NULL; - } - m_mapJsonArrayRef.erase(iter++); - } - else - { - iter++; - } - } - return(true); - } - - bool CJsonObject::Add(const std::string& strValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateString(strValue.c_str()); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArray(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(int32 iValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)iValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArray(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(uint32 uiValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)uiValue, 1); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArray(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(int64 llValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)llValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArray(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(uint64 ullValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)ullValue, 1); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArray(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(int iAnywhere, bool bValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateBool(bValue); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArray(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(float fValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateDouble((double)fValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArray(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::Add(double dValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateDouble((double)dValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArray(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::AddAsFirst(const CJsonObject& oJsonObject) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_Parse(oJsonObject.ToString().c_str()); - if (pJsonStruct == NULL) - { - m_strErrMsg = std::string("prase json string error at ") + cJSON_GetErrorPtr(); - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArrayHead(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - for (std::map::iterator iter = m_mapJsonArrayRef.begin(); - iter != m_mapJsonArrayRef.end(); ) - { - if (iter->second != NULL) - { - delete (iter->second); - iter->second = NULL; - } - m_mapJsonArrayRef.erase(iter++); - } - return(true); - } - - bool CJsonObject::AddAsFirst(const std::string& strValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateString(strValue.c_str()); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArrayHead(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::AddAsFirst(int32 iValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)iValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArrayHead(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::AddAsFirst(uint32 uiValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)uiValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArrayHead(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::AddAsFirst(int64 llValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)llValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArrayHead(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::AddAsFirst(uint64 ullValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)ullValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArrayHead(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::AddAsFirst(int iAnywhere, bool bValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateBool(bValue); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArrayHead(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::AddAsFirst(float fValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateDouble((double)fValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArrayHead(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::AddAsFirst(double dValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData != NULL) - { - pFocusData = m_pJsonData; - } - else if (m_pExternJsonDataRef != NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - m_pJsonData = cJSON_CreateArray(); - pFocusData = m_pJsonData; - } - - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateDouble((double)dValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); - cJSON_AddItemToArrayHead(pFocusData, pJsonStruct); - int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); - if (iArraySizeAfterAdd == iArraySizeBeforeAdd) - { - return(false); - } - return(true); - } - - bool CJsonObject::Delete(int iWhich) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON_DeleteItemFromArray(pFocusData, iWhich); - for (std::map::iterator iter = m_mapJsonArrayRef.begin(); - iter != m_mapJsonArrayRef.end(); ) - { - if (iter->first >= (unsigned int)iWhich) - { - if (iter->second != NULL) - { - delete (iter->second); - iter->second = NULL; - } - m_mapJsonArrayRef.erase(iter++); - } - else - { - iter++; - } - } - return(true); - } - - bool CJsonObject::Replace(int iWhich, const CJsonObject& oJsonObject) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_Parse(oJsonObject.ToString().c_str()); - if (pJsonStruct == NULL) - { - m_strErrMsg = std::string("prase json string error at ") + cJSON_GetErrorPtr(); - return(false); - } - cJSON_ReplaceItemInArray(pFocusData, iWhich, pJsonStruct); - if (cJSON_GetArrayItem(pFocusData, iWhich) == NULL) - { - return(false); - } - std::map::iterator iter = m_mapJsonArrayRef.find(iWhich); - if (iter != m_mapJsonArrayRef.end()) - { - if (iter->second != NULL) - { - delete (iter->second); - iter->second = NULL; - } - m_mapJsonArrayRef.erase(iter); - } - return(true); - } - - bool CJsonObject::Replace(int iWhich, const std::string& strValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateString(strValue.c_str()); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInArray(pFocusData, iWhich, pJsonStruct); - if (cJSON_GetArrayItem(pFocusData, iWhich) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(int iWhich, int32 iValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)iValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInArray(pFocusData, iWhich, pJsonStruct); - if (cJSON_GetArrayItem(pFocusData, iWhich) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(int iWhich, uint32 uiValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)uiValue, 1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInArray(pFocusData, iWhich, pJsonStruct); - if (cJSON_GetArrayItem(pFocusData, iWhich) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(int iWhich, int64 llValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)((uint64)llValue), -1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInArray(pFocusData, iWhich, pJsonStruct); - if (cJSON_GetArrayItem(pFocusData, iWhich) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(int iWhich, uint64 ullValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateInt((uint64)ullValue, 1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInArray(pFocusData, iWhich, pJsonStruct); - if (cJSON_GetArrayItem(pFocusData, iWhich) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(int iWhich, bool bValue, bool bValueAgain) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateBool(bValue); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInArray(pFocusData, iWhich, pJsonStruct); - if (cJSON_GetArrayItem(pFocusData, iWhich) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(int iWhich, float fValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateDouble((double)fValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInArray(pFocusData, iWhich, pJsonStruct); - if (cJSON_GetArrayItem(pFocusData, iWhich) == NULL) - { - return(false); - } - return(true); - } - - bool CJsonObject::Replace(int iWhich, double dValue) - { - cJSON* pFocusData = NULL; - if (m_pJsonData == NULL) - { - pFocusData = m_pExternJsonDataRef; - } - else - { - pFocusData = m_pJsonData; - } - if (pFocusData == NULL) - { - m_strErrMsg = "json data is null!"; - return(false); - } - if (pFocusData->type != cJSON_Array) - { - m_strErrMsg = "not a json array! json object?"; - return(false); - } - cJSON* pJsonStruct = cJSON_CreateDouble((double)dValue, -1); - if (pJsonStruct == NULL) - { - return(false); - } - cJSON_ReplaceItemInArray(pFocusData, iWhich, pJsonStruct); - if (cJSON_GetArrayItem(pFocusData, iWhich) == NULL) - { - return(false); - } - return(true); - } - - CJsonObject::CJsonObject(cJSON* pJsonData) - : m_pJsonData(NULL), m_pExternJsonDataRef(pJsonData) - { - } - -} - - diff --git a/CJsonObject.hpp b/CJsonObject.hpp deleted file mode 100644 index 83d4def..0000000 --- a/CJsonObject.hpp +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Project: neb - * @file CJsonObject.hpp - * @brief Json - * @author bwarliao - * @date: 2014-7-16 - * @note - * Modify history: - ******************************************************************************/ - -#ifndef CJSONOBJECT_HPP_ -#define CJSONOBJECT_HPP_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" -{ -#endif -typedef struct cJSON cJSON; - -#ifdef __cplusplus -} -#endif - - -namespace neb -{ -typedef int int32; -typedef unsigned int uint32; -typedef long long int64; -typedef unsigned long long uint64; - -class CJsonObject -{ -public: // method of ordinary json object or json array - CJsonObject(); - CJsonObject(const std::string& strJson); - CJsonObject(const CJsonObject* pJsonObject); - CJsonObject(const CJsonObject& oJsonObject); - virtual ~CJsonObject(); - - CJsonObject& operator=(const CJsonObject& oJsonObject); - bool operator==(const CJsonObject& oJsonObject) const; - bool Parse(const std::string& strJson); - void Clear(); - bool IsEmpty() const; - bool IsArray() const; - std::string ToString() const; - std::string ToFormattedString() const; - const std::string& GetErrMsg() const - { - return(m_strErrMsg); - } - -public: // method of ordinary json object - bool AddEmptySubObject(const std::string& strKey); - bool AddEmptySubArray(const std::string& strKey); - CJsonObject& operator[](const std::string& strKey); - std::string operator()(const std::string& strKey) const; - bool Get(const std::string& strKey, CJsonObject& oJsonObject) const; - bool Get(const std::string& strKey, std::string& strValue) const; - bool Get(const std::string& strKey, int32& iValue) const; - bool Get(const std::string& strKey, uint32& uiValue) const; - bool Get(const std::string& strKey, int64& llValue) const; - bool Get(const std::string& strKey, uint64& ullValue) const; - bool Get(const std::string& strKey, bool& bValue) const; - bool Get(const std::string& strKey, float& fValue) const; - bool Get(const std::string& strKey, double& dValue) const; - bool Add(const std::string& strKey, const CJsonObject& oJsonObject); - bool Add(const std::string& strKey, const std::string& strValue); - bool Add(const std::string& strKey, int32 iValue); - bool Add(const std::string& strKey, uint32 uiValue); - bool Add(const std::string& strKey, int64 llValue); - bool Add(const std::string& strKey, uint64 ullValue); - bool Add(const std::string& strKey, bool bValue, bool bValueAgain); - bool Add(const std::string& strKey, float fValue); - bool Add(const std::string& strKey, double dValue); - bool Delete(const std::string& strKey); - bool Replace(const std::string& strKey, const CJsonObject& oJsonObject); - bool Replace(const std::string& strKey, const std::string& strValue); - bool Replace(const std::string& strKey, int32 iValue); - bool Replace(const std::string& strKey, uint32 uiValue); - bool Replace(const std::string& strKey, int64 llValue); - bool Replace(const std::string& strKey, uint64 ullValue); - bool Replace(const std::string& strKey, bool bValue, bool bValueAgain); - bool Replace(const std::string& strKey, float fValue); - bool Replace(const std::string& strKey, double dValue); - -public: // method of json array - int GetArraySize(); - CJsonObject& operator[](unsigned int uiWhich); - std::string operator()(unsigned int uiWhich) const; - bool Get(int iWhich, CJsonObject& oJsonObject) const; - bool Get(int iWhich, std::string& strValue) const; - bool Get(int iWhich, int32& iValue) const; - bool Get(int iWhich, uint32& uiValue) const; - bool Get(int iWhich, int64& llValue) const; - bool Get(int iWhich, uint64& ullValue) const; - bool Get(int iWhich, bool& bValue) const; - bool Get(int iWhich, float& fValue) const; - bool Get(int iWhich, double& dValue) const; - bool Add(const CJsonObject& oJsonObject); - bool Add(const std::string& strValue); - bool Add(int32 iValue); - bool Add(uint32 uiValue); - bool Add(int64 llValue); - bool Add(uint64 ullValue); - bool Add(int iAnywhere, bool bValue); - bool Add(float fValue); - bool Add(double dValue); - bool AddAsFirst(const CJsonObject& oJsonObject); - bool AddAsFirst(const std::string& strValue); - bool AddAsFirst(int32 iValue); - bool AddAsFirst(uint32 uiValue); - bool AddAsFirst(int64 llValue); - bool AddAsFirst(uint64 ullValue); - bool AddAsFirst(int iAnywhere, bool bValue); - bool AddAsFirst(float fValue); - bool AddAsFirst(double dValue); - bool Delete(int iWhich); - bool Replace(int iWhich, const CJsonObject& oJsonObject); - bool Replace(int iWhich, const std::string& strValue); - bool Replace(int iWhich, int32 iValue); - bool Replace(int iWhich, uint32 uiValue); - bool Replace(int iWhich, int64 llValue); - bool Replace(int iWhich, uint64 ullValue); - bool Replace(int iWhich, bool bValue, bool bValueAgain); - bool Replace(int iWhich, float fValue); - bool Replace(int iWhich, double dValue); - -private: - CJsonObject(cJSON* pJsonData); - -private: - cJSON* m_pJsonData; - cJSON* m_pExternJsonDataRef; - std::string m_strErrMsg; - std::map m_mapJsonArrayRef; - std::map m_mapJsonObjectRef; -}; - -} - -#endif /* CJSONHELPER_HPP_ */ diff --git a/CScanner_FreeImage.cpp b/CScanner_FreeImage.cpp deleted file mode 100644 index bf2a662..0000000 --- a/CScanner_FreeImage.cpp +++ /dev/null @@ -1,408 +0,0 @@ -/*************************************************************************** -* Copyright 锟 2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CScanner_FreeImage.cpp -* Defines a scanner. -* Create a virtual scanner. -* @author TWAIN Working Group -* @date April 2007 -*/ - -#include "stdafx.h" -#include "CScanner_FreeImage.h" - -#include -#include -#include -#include -#include -#include -#include "scn_config.h" -#include "PublicFunc.h" -#include "ImageProcess/ImageApplyHeaders.h" -#include "filetools.h" -#include "hugaotwainds.h" -#include "GScanO200.h" -#include "GScan200.h" - -extern ChugaotwaindsApp theApp; -#ifdef TWH_CMP_MSC -#include -#elif __APPLE__ -//#include -#else //#ifdef TWH_CMP_MSC -#include -#endif //#ifdef TWH_CMP_MSC - -#ifdef TWNDS_OS_LINUX -#define kTWAIN_DS_DIR "/usr/local/lib/twain/sample2" -#endif - -#include "DSMInterface.h" - -using namespace std; - -#ifdef TWNDS_OS_APPLE -#include "CoreFoundation/CoreFoundation.h" -#include "CoreFoundation/CFBundle.h" -#include "CoreFoundation/CFURL.h" -#include -#endif - -/** -* Environment vars to get the Xfer Count. Create this enviroment Varable on your system to simulate the -* number of pages sitting in the scanner waiting to be scanned. -*/ -#define kGETENV_XFERCOUNT "CAP_XFERCOUNT" - -#ifdef TWH_CMP_MSC -extern HINSTANCE g_hinstance; -#endif - -//GScn_Drv g_drv; -std::shared_ptr g_scan(new GScan200()); - -////////////////////////////////////////////////////////////////////////////// -CScanner_FreeImage::CScanner_FreeImage() : - m_nScanLine(0), - m_bReadOnly(false), - m_nDestBytesPerRow(0), - m_nRowOffset(0), - m_nSourceWidth(0), - m_nSourceHeight(0) -{ - memset(m_szSourceImagePath, 0, PATH_MAX); - resetScanner(); - InitMSGMap(); - g_scan->open(0x064B, 0x7823); -} - -////////////////////////////////////////////////////////////////////////////// -CScanner_FreeImage::~CScanner_FreeImage() -{ - g_scan.reset(); -} - -void CScanner_FreeImage::InitMSGMap() -{ - if (ntcMsg.size() > 0) { - ntcMsg.clear(); - } - ntcMsg[COUNT_MODE] = StringToUtf("璁℃暟妯″紡锛岃鍏堥鍑鸿鏁版ā寮!"); - ntcMsg[NO_FEED] = StringToUtf("鏃犵焊锛岃鏀剧疆绾稿紶!"); - ntcMsg[OPEN_COVER] = StringToUtf("鎵弿浠紑鐩!"); - ntcMsg[FEED_IN_ERROR] = StringToUtf("鎷剧焊閿欒!"); - ntcMsg[PAPER_JAM] = StringToUtf("鍗$焊!"); - ntcMsg[DETECT_DOUBLE_FEED] = StringToUtf("鍙屽紶!"); - ntcMsg[DETECT_STAPLE] = StringToUtf("璁功閽!"); - ntcMsg[PAPER_SKEW] = StringToUtf("绾稿紶姝枩!"); - ntcMsg[HARDWARE_ERROR] = StringToUtf("纭欢寮傚父!璇烽噸鍚壂鎻忎华!"); - ntcMsg[PC_SCAN_BUSY_or_ERROR] = StringToUtf("PC閿欒!"); -} - -////////////////////////////////////////////////////////////////////////////// -bool CScanner_FreeImage::resetScanner() -{ - bool bret = true; - - // Unlock the scanner - Unlock(); - - m_nScanLine = 0; - m_nDestBytesPerRow = 0; - m_nRowOffset = 0; - - //m_nDocCount = //getDocumentCount();// Reloaded the scanner with paper - m_nMaxDocCount = -1; - m_nPixelType = TWPT_RGB; - m_nPaperSource = SFI_PAPERSOURCE_ADF; - m_bDuplex = false; - m_fXResolution = 200.0; - m_fYResolution = 200.0; - - if (g_scan->Get_IsImageQueueEmpty() != 0) - { - g_scan->reset(); - } - return bret; -} - -////////////////////////////////////////////////////////////////////////////// -SFreeImage* CScanner_FreeImage::getSetting() const -{ - return (SFreeImage*)this; -} -//static bool isreported; -////////////////////////////////////////////////////////////////////////////// -bool CScanner_FreeImage::acquireImage(bool bscan) -{ - if (bscan) - { - if (getDeviceOnline()) - { - g_scan->config_params(*(getSetting())); - g_scan->setdecodepixtype(m_HardWareParams.PixType); - g_scan->Scanner_StartScan(m_wScanCount); - } - else - { - std::string cvt = StringToUtf("璇锋鏌ョ數婧愭槸鍚︽墦寮鎴朥SB绾跨紗鏄惁宸茶繛鎺ワ紒"); - std::string notify = StringToUtf("鎻愮ず"); - MessageBox(theApp.m_pMainWnd->GetSafeHwnd(), (TCHAR*)cvt.c_str(), (TCHAR*)notify.c_str(), MB_SYSTEMMODAL | MB_OK | MB_ICONINFORMATION); - return false; - } - } - -#ifdef HW_VER - m_matDib.release(); - UINT32 ret = g_scan->aquire_image(m_matDib); - if (ret != 0) - { - std::string notify = StringToUtf("鎻愮ず"); - MessageBox(theApp.m_pMainWnd->GetSafeHwnd(), (TCHAR*)ntcMsg[ret].c_str(), (TCHAR*)notify.c_str(), MB_SYSTEMMODAL | MB_ICONINFORMATION | MB_OK); - g_scan->Set_ErrorCode(0);//澶嶄綅寮傚父鐮 - return false; - } -#endif - - if (m_matDib.empty()) - { - return false; - } - if (m_bMultiOutput) - { - if (m_matDib.channels() == 3) - { - m_nPixelType = TWPT_RGB; - } - else - { - m_nPixelType = TWPT_GRAY; - } - } - //Document scanned, remove it from simulated intray - //m_nDocCount--; - - // do whatever tranforms to the scanned image that was requested by the app - // before the image is sent to the app. - if (false == preScanPrep()) - { - return false; - } - return true; -} - -////////////////////////////////////////////////////////////////////////////// -bool CScanner_FreeImage::preScanPrep() -{ - m_nRight = m_nSourceWidth = m_matDib.cols; - m_nBottom = m_nSourceHeight = m_matDib.rows; - m_nLeft = 0; - m_nTop = 0; - - switch (m_nPixelType) - { - case TWPT_BW: - m_nDestBytesPerRow = BYTES_PERLINE(m_nSourceWidth, 1); - m_nRowOffset = BYTES_PERLINE(0, 1); - m_imageTrans.reset(new ImageTranferBW(m_matDib)); - break; - - case TWPT_GRAY: - m_nDestBytesPerRow = BYTES_PERLINE(m_nSourceWidth, 8); - m_nRowOffset = BYTES_PERLINE(0, 8); - m_imageTrans.reset(new ImageTranferMat(m_matDib)); - break; - - case TWPT_RGB: - m_nDestBytesPerRow = BYTES_PERLINE(m_nSourceWidth, 24); - m_nRowOffset = BYTES_PERLINE(0, 24); - m_imageTrans.reset(new ImageTranferMat(m_matDib)); - break; - } - - // setup some convenience vars because they are used during - // every strip request - m_nScanLine = 0; - return true; -} - -////////////////////////////////////////////////////////////////////////////// -// We want to simulate getting a scan form a scanner. -// if a size larger than the paper is scanned then there will be black on the bottom -// and to the right of the image. We want to transfer the image top to bottom, -// the black will be transfered after the image if neccessary. -bool CScanner_FreeImage::getScanStrip(BYTE *pTransferBuffer, DWORD dwRead, DWORD &dwReceived) -{ - dwReceived = 0; - - if (NULL == pTransferBuffer || // Invalid paramiter - dwRead < m_nDestBytesPerRow) // Need enough memory to transfer at least an entire row - { - return false; - } - BYTE *pBits = NULL; - int nRow = 0; - int nMaxRows = dwRead / m_nDestBytesPerRow; //number of rows to be transfered during this call (function of buffer size and line size) - DWORD step = (DWORD)m_imageTrans->step(); - - m_nScanLine = 0; - if (m_nScanLine < m_nSourceHeight) - { - //fill the buffer line by line to take care of alignment differences - for (nRow = 0; nRow < nMaxRows; nRow++) - { - //get the next scan line position and copy it - pBits = m_imageTrans->getLineBits(m_nScanLine); - - memcpy(pTransferBuffer, pBits + m_nRowOffset, MIN(m_nDestBytesPerRow, step)); - - // Check to see if the result image width is wider than what we have. - // If it is wider fill it in with 0es - if (m_nDestBytesPerRow > step) - { - memset(pTransferBuffer + step, 0, m_nDestBytesPerRow - step); - } - - //increment the destination by the aligned line size - pTransferBuffer += m_nDestBytesPerRow; - - // increment the current scanline for next pass - m_nScanLine++; - - //update the number of bytes written - dwReceived += m_nDestBytesPerRow; - - // check for finished scan - if (m_nScanLine >= m_nSourceHeight) - { - //we are done early - break; - } - } - } - return true; -} - -////////////////////////////////////////////////////////////////////////////// -short CScanner_FreeImage::getDocumentCount() const -{ - // Simulate the number of pages sitting in the scanner. - int nCount = 1; - - // Read this value from the environment. This will allow the simulation - // of a sheet feeder. - // If the value is <= 0, then a random number of pages will be scanned, else - // the exact number will be used. - char szCount[10]; - memset(szCount, 0, sizeof(szCount)); - - if (0 != SGETENV(szCount, sizeof(szCount), kGETENV_XFERCOUNT)) - { - // something found, convert it to an int - nCount = atoi(szCount); - - if (nCount <= 0) - { - srand(int(time(0))); - nCount = rand(); - nCount = nCount % 15;// upto 15 pages - } - } - return nCount; -} - -////////////////////////////////////////////////////////////////////////////// -bool CScanner_FreeImage::isFeederLoaded() const -{ - bool rtn = g_scan->Get_Scanner_PaperOn(); - return rtn; -} - -////////////////////////////////////////////////////////////////////////////// -bool CScanner_FreeImage::getDeviceOnline() const -{ - return g_scan->IsConnected(); -} - -////////////////////////////////////////////////////////////////////////////// -std::string CScanner_FreeImage::getSerialNum() const -{ - return g_scan->GetSerialNum(); -} - -////////////////////////////////////////////////////////////////////////////// -std::string CScanner_FreeImage::getFWVersion() const -{ - return g_scan->GetFWVersion(); -} - -/////////////////////////////////////////////////////////////////////////////// -bool CScanner_FreeImage::StopScan() -{ - bool ret = true; - g_scan->Stop_scan(); - int retry_times = 0; - while (g_scan->is_scan()) - { - if (retry_times > 10)//瓒呰繃锛曪紣锛愶綅锝撹繕娌″仠姝㈠垯璺冲嚭銆涓嶈繘琛孌oCloseDSRequestEvent锛堬級 - { - ret = false; - break; - } - Sleep(50); - retry_times++; - } - return ret; -} - -////////////////////////////////////////////////////////////////////////////// -bool CScanner_FreeImage::isPaperOn() //const -{ - return g_scan->Get_Scanner_PaperOn(); -} - -bool CScanner_FreeImage::isImageQueueEmpty() -{ - bool ret; - if (!g_scan->is_scan() && g_scan->Get_IsImageQueueEmpty() && (g_scan->get_ErrorCode() == 0)) - ret = true; - else - ret = false; - return ret; -} - -bool CScanner_FreeImage::stillhaveImage() -{ - return g_scan->Get_IsImageQueueEmpty(); -} - diff --git a/CScanner_FreeImage.h b/CScanner_FreeImage.h deleted file mode 100644 index 333835d..0000000 --- a/CScanner_FreeImage.h +++ /dev/null @@ -1,253 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CScanner_FreeImage.h -* Defines a scanner. -* Create a virtual scanner. -* @author TWAIN Working Group -* @date April 2007 -*/ -#ifndef __CSCANNER_H__ -#define __CSCANNER_H__ - -#include "Common.h" -#include "twain.h" -#include -#include "gscn_drv.h" -#include -#include -#include -#include -#include -#include "ImageTransfer.h" -#include "ImageTranferBW.h" -#include "ImageTranferMat.h" - -using namespace std; -/** -* This is a virtual scanner. The virtual scanner is used by the data source -* to try and somewhat simulate some real hardware interaction. -* - It acquires the same image each time from an image file on the hard disk. -* - It uses the FreeImage library to apply transforms to the base image. -* -* For simulation purposes the virtual Scanner is set up with the -* following specifications: -* -* - Scanner Types -* - ADF(Automatic Document Feeder) -* - Flatbed -* -* - Image sensors -* - CCD x 3 ( Front / Back / Flatbed ) -* -* - Scanning area Minimum -* - ADF - A8 @ 127g/m2 paper -* - Flatbed - unlimited -* -* - Scanning area Maximum -* - ADF - Legal paper -* - Flatbed - A4 letter paper -* -* - Internal Optical Resolution -* - 600dpi -* -* - Output Resolution -* - Binary - 50, 100, 150, 200, 300, 400, 500, & 600 -* - Grayscale - 50, 100, 150, 200, 300, 400, 500, & 600 -* - Color - 50, 100, 150, 200, 300, 400, 500, & 600 -* -* - Internal Bit Depth -* - 8 bits per color -* -* - Output Bit Depth -* - Binary - 1 bits -* - Grayscale - 8 bits -* - Color - 8 bits per color -* -* - Halftone Patterns -* - Dither /error diffusion -* -* - compression: JPEG, and FAX4 (CCITT G4) -* -*/ - -// Defines used by Scanner FreeImage class to set and get attributes of the vurtual scanner. - -/** -* The FreeImage scanner define for PaperSource is ADF -*/ -#define SFI_PAPERSOURCE_ADF 0 -/** -* The FreeImage scanner define for PaperSource is Flatbed -*/ -#define SFI_PAPERSOURCE_FB 1 - -/** -* The FreeImage scanner data structure. This data is passed back and forth between the scanner class and driver. -* -*/ - - -/** -* The FreeImage scanner. The software scanner using FreeImage. -* -*/ -class CScanner_FreeImage : public SFreeImage -{ -public: - /** - * Constructor for CScanner_FreeImage. - */ - CScanner_FreeImage(); - - /** - * Deconstructor for CScanner_FreeImage. - */ - ~CScanner_FreeImage(); - - /** - * Resets the scanner to factory default settings. - * Sets the scanners caps back to defaults. - * @return true if successfully reset. - */ - bool resetScanner(); - - /** - * Get a scan line and put it into the _ImageXfer, fill values in _ImageXfer. - * @param[out] pTransferBuffer a pointer to an array of bytes to store the image data - * @param[in] dwRead the number of bytes to read from scanner - * @param[out] dwReceived the actual number of bytes transfered - * @return true if successful - */ - bool getScanStrip(BYTE *pTransferBuffer, DWORD dwRead, DWORD &dwReceived); - - /** - * Sets all the scanners capabilities to read only. - */ - void Lock(void) {m_bReadOnly = true;} - - /** - * Sets all the scanners capabilities to read and write. - */ - void Unlock(void) {m_bReadOnly = false;} - - /** - * Retrieves the image to scan from disk into memory. - * @return true if image was loaded into memory successfully. - */ - bool acquireImage(bool bscan = true); - - //////////////// - // Accessors - - /** - * get the current settings - * @return the current scanner settngs - */ - SFreeImage* getSetting() const; - - /** - * set the current settings - * @param[in] settings the new settings for the scanner - */ - //void setSetting(SFreeImage settings); - - /** - * Determine if there is paper sitting in the feeder. - * IF empty loads again for next time. - * @return true if paper in feeder else return false. - */ - bool isFeederLoaded() const; - - /** - * Return status of the device is online or not. - * @return true if online. - */ - bool getDeviceOnline() const; - - bool isPaperOn(); - /* get scannner hardware version*/ - std::string getSerialNum() const; - - std::string getFWVersion() const; - - bool isImageQueueEmpty(); - - bool stillhaveImage(); - short GetMaxPagesInADF(void){return m_nMaxDocCount;} - - void SetMaxPagesInADF(short nVal){m_nMaxDocCount = nVal;}; - - - bool StopScan(); - - WORD m_nSourceWidth; /**< Width of image in FreeImage */ - WORD m_nSourceHeight; /**< Height of image in FreeImage */ - -protected: - /** - * Return the number of documents sitting in the feeder. - * This number can be set with enviroment varible kGETENV_XFERCOUNT "CAP_XFERCOUNT" - * this is so we can tell when the feeder is empty - * - If CAP_XFERCOUNT is not set will return 1. - * - if < 0 will return random number. - * @return default number of documents. - */ - short getDocumentCount() const; - - - /** - * Transform the image according to the caps set by the application. - * @return true if successful - */ - bool preScanPrep(); - - - - -protected: - WORD m_nScanLine; /**< Current scan line of image in FreeImage */ - bool m_bReadOnly; /**< current mode */ - DWORD m_nDestBytesPerRow; /**< number of bytes needed for a row of data */ - DWORD m_nRowOffset; /**< offset of the first byte on every row*/ - //short m_nDocCount; /**< number of documents waiting to transfer */ - short m_nMaxDocCount; /**< Max number of documents waiting to transfer */ - char m_szSourceImagePath[PATH_MAX]; /**< image used with FreeImage */ - cv::Mat m_matDib; - -private: - void InitMSGMap(); - std::shared_ptr m_imageTrans; - std::map ntcMsg; -}; - -#endif // __CSCANNER_H__ diff --git a/CTWAINDS_Base.cpp b/CTWAINDS_Base.cpp deleted file mode 100644 index 900129a..0000000 --- a/CTWAINDS_Base.cpp +++ /dev/null @@ -1,2617 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CTWAINDS_Base.cpp -* Base class describing a TWAIN Data Source. -* @author TWAIN Working Group -* @date April 2007 -*/ -#include "stdafx.h" -#include "CTWAINDS_Base.h" -#include "filetools.h" -#include -#if (TWNDS_CMP == TWNDS_CMP_VISUALCPP) - #include -#endif - -#ifdef TWNDS_OS_APPLE - #import // for GraphicsImporter -#endif - -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -CTWAINDS_Base::CTWAINDS_Base() : - m_DSConditionCode(TWCC_SUCCESS) -{ - memset(&m_MyIdentity, 0, sizeof(m_MyIdentity)); - memset(&m_App, 0, sizeof(m_App)); - m_CurrentState = dsState_Loaded; - memset(&m_CurFileExferName, 0, sizeof(m_CurFileExferName)); - memset(&m_DefFileExferName, 0, sizeof(m_DefFileExferName)); - memset(&m_Xfers, 0, sizeof(m_Xfers)); - m_nDestScanLine = 0; - m_hImageData = 0; - m_DocumentNumber = 0; - m_PageNumber = 0; - return; -} - -////////////////////////////////////////////////////////////////////////////// -CTWAINDS_Base::~CTWAINDS_Base() -{ - memset(&m_MyIdentity, 0, sizeof(TW_IDENTITY)); - memset(&m_App, 0, sizeof(TW_IDENTITY)); - - // free all resources belonging to m_IndependantCapMap - TWAINCapabilitiesMap::iterator cur = m_IndependantCapMap.begin(); - - while(cur != m_IndependantCapMap.end()) - { - delete cur->second; - cur++; - } - - if(m_hImageData) - { - _DSM_Free(m_hImageData); - m_hImageData = 0; - } - //FileTools::write_log("1.txt", "~CTWAINDS_Base"); -} - -////////////////////////////////////////////////////////////////////////////// -void CTWAINDS_Base::fillIdentityStructure(TW_IDENTITY& _idStruct) -{ - // fill in the Identity structure - SSTRNCPY(_idStruct.Manufacturer, sizeof(_idStruct.Manufacturer), "Unknown", 32); - SSTRNCPY(_idStruct.ProductFamily, sizeof(_idStruct.ProductFamily), "Unknown", 32); - SSTRNCPY(_idStruct.ProductName, sizeof(_idStruct.ProductName), "Unknown", 32); -} - - -////////////////////////////////////////////////////////////////////////////// -TW_UINT16 CTWAINDS_Base::DS_Entry( pTW_IDENTITY _pOrigin, - TW_UINT32 _DG, - TW_UINT16 _DAT, - TW_UINT16 _MSG, - TW_MEMREF _pData) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - //string ss; - switch (_DG) - { - - case DG_CONTROL: - { - //ss="DG_CONTROL"; - switch (_DAT) - { - case DAT_EVENT: - { - //ss+=" DAT_EVENT"; - twrc = dat_event(_MSG, (pTW_EVENT) _pData); - } - break; - - case DAT_IDENTITY: - { - //ss+=" DAT_IDENTITY"; - twrc = dat_identity(_pOrigin, _MSG, (pTW_IDENTITY) _pData); - } - break; - - case DAT_CAPABILITY: - //ss+=" DAT_CAPABILITY"; - twrc = dat_capability(_MSG, (pTW_CAPABILITY) _pData); - break; - - case DAT_USERINTERFACE: - { - //ss+=" DAT_USERINTERFACE"; - twrc = dat_userinterface(_MSG, (pTW_USERINTERFACE) _pData); - } - break; - - case DAT_SETUPFILEXFER: - //ss+=" DAT_SETUPFILEXFER"; - twrc = dat_setupfilexfer(_MSG, (pTW_SETUPFILEXFER) _pData); - break; - - case DAT_SETUPMEMXFER: - { - //ss+=" DAT_SETUPMEMXFER"; - twrc = dat_setupmemxfer(_MSG, (pTW_SETUPMEMXFER) _pData); - } - break; - - case DAT_STATUS: - { - //ss+=" DAT_STATUS"; - twrc = dat_status(_MSG, (pTW_STATUS) _pData); - } - break; - - case DAT_PENDINGXFERS: - //ss+=" DAT_PENDINGXFERS"; - twrc = dat_pendingxfers(_MSG, (pTW_PENDINGXFERS)_pData); - break; - - case DAT_ENTRYPOINT: - //ss+=" DAT_ENTRYPOINT"; - twrc = dat_entrypoint(_MSG, (pTW_ENTRYPOINT)_pData); - break; - - case DAT_XFERGROUP: - //ss="DAT_XFERGROUP"; - twrc = dat_xfergroup(_MSG, (pTW_UINT32)_pData); - break; - - case DAT_CUSTOMDSDATA: - //ss+=" DAT_CUSTOMDSDATA"; - twrc = dat_customdsdata(_MSG, (pTW_CUSTOMDSDATA)_pData); - break; - - default: - //ss="setConditionCode(TWCC_BADPROTOCOL)"; - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - } - break; - - case DG_IMAGE: - { - // ss="DG_IMAGE "; - switch (_DAT) - { - case DAT_IMAGEINFO: - //ss+="DAT_IMAGEINFO"; - twrc = dat_imageinfo(_MSG, (pTW_IMAGEINFO)_pData); - break; - - case DAT_IMAGENATIVEXFER: - if(0 == _pData) - { - //ss+="DAT_IMAGENATIVEXFER Error"; - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - //ss+="DAT_IMAGENATIVEXFER"; - twrc = dat_imagenativexfer(_MSG, *((TW_HANDLE*)_pData)); - break; - - case DAT_IMAGEFILEXFER: - //ss+="DAT_IMAGEFILEXFER"; - twrc = dat_imagefilexfer(_MSG); - break; - - case DAT_IMAGEMEMXFER: - //ss+="DAT_IMAGEMEMXFER"; - twrc = dat_imagememxfer(_MSG, (pTW_IMAGEMEMXFER)_pData); - break; - - case DAT_IMAGELAYOUT: - //ss+="DAT_IMAGELAYOUT"; - twrc = dat_imagelayout(_MSG, (pTW_IMAGELAYOUT)_pData); - break; - - case DAT_EXTIMAGEINFO: - //ss+="DAT_EXTIMAGEINFO"; - twrc = dat_extimageinfo(_MSG, (pTW_EXTIMAGEINFO)_pData); - break; - - default: - //ss+="default setConditionCode(TWCC_CAPUNSUPPORTED)"; - setConditionCode(TWCC_CAPUNSUPPORTED); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - } - break; - - default: - //ss+="default setConditionCode(TWCC_CAPUNSUPPORTED)"; - setConditionCode(TWCC_CAPUNSUPPORTED); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - //ss+=twrc==TWRC_FAILURE?" TWRC_FAILURE":" TWRC_SUCCESS"; - //FileTools::write_log("D:/1.txt",ss); - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_event(TW_UINT16 _MSG, - pTW_EVENT _pEvent) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - if (_pEvent==0) - { - setConditionCode(TWCC_BADVALUE); - twrc = TWRC_FAILURE; - } - - else - { - switch(_MSG) - { - case MSG_PROCESSEVENT: - twrc = processEvent(_pEvent); - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_identity(pTW_IDENTITY _pOrigin, - TW_UINT16 _MSG, - pTW_IDENTITY _pData) -{ - TW_INT16 twrc = TWRC_SUCCESS; - //string ss="dat_identity "; - switch(_MSG) - { - case MSG_GET: - //ss+="MSG_GET"; - memcpy(_pData, &m_MyIdentity, sizeof(TW_IDENTITY)); - break; - - case MSG_OPENDS: - // store the id assigned to us by the DSM. - //ss+="MSG_OPENDS "; - m_MyIdentity.Id = _pData->Id; - twrc = openDS(_pOrigin); - break; - - case MSG_CLOSEDS: - //ss+="MSG_CLOSEDS "; - twrc = closeDS(); - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - //ss+=twrc==TWRC_SUCCESS?"TWRC_SUCCESS":"TWRC_FAILURE"; - //FileTools::write_log("D:/1.txt",ss); - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_capability(TW_UINT16 _MSG, - pTW_CAPABILITY _pCap) -{ - - TW_INT16 twrc = TWRC_FAILURE; - - if(MSG_RESETALL == _MSG) // special case - { - // Reject anything state 5 or higher... - if(m_CurrentState >= dsState_Enabled) - { - setConditionCode(TWCC_SEQERROR); - //FileTools::write_log("D:/1.txt","dat_capability m_CurrentState >= dsState_Enabled"); - return TWRC_FAILURE; - } - // Loop through all supported caps and reset them. - CTWAINContainer *pCap = NULL; - CTWAINContainerInt *pCapSC = dynamic_cast(findCapability(CAP_SUPPORTEDCAPS)); - if(!pCapSC) - { - //FileTools::write_log("D:/1.txt","dat_capability !pCapSC"); - setConditionCode(TWCC_BADCAP); - return TWRC_FAILURE; - } - const IntVector listInts = pCapSC->GetSupported(); - - twrc = TWRC_SUCCESS; - const int nSize = (int)(listInts.size()); - int x; - for(x = 0; x < nSize; ++x) - { - int Cap = listInts[x]; - if(NULL != (pCap = findCapability(Cap))) - { - if(pCap->isOperationAllowed(MSG_RESET)) - { - if(!pCap->Reset()) - { - //ostringstream os; - //os<GetCapID(); - //istringstream is(os.str()); - //string out; - //is>>out; - //FileTools::write_log("D:/1.txt","dat_capability !pCap->Reset())"+out); - setConditionCode(TWCC_CAPUNSUPPORTED); - twrc = TWRC_FAILURE; - } - } - } - } - } - else - { - // check for invalid args - if(0 == _pCap) - { - //FileTools::write_log("D:/1.txt","0 == _pCap"); - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - // first find the capability - CTWAINContainer* pCap = findCapability(_pCap->Cap); - - // Now handle the cap if one was found - if(0 != pCap) - { - twrc = handleCap(_MSG, pCap, _pCap); - if (twrc!=TWRC_SUCCESS) - { - //ostringstream os; - //os<GetCapID(); - //istringstream is(os.str()); - //string out; - //is>>out; - //ostringstream osc; - //osc<<_MSG; - //istringstream isc(osc.str()); - //string sc; - //isc>> sc; - - //ostringstream osrc; - //osrc<> src; - //FileTools::write_log("D:/1.txt","handleCap "+out+"MSG "+sc +"TWRC "+src ); - } - - // when some capabilities are successfully changed with Set or Reset - // it requires changing others - if( (twrc == TWRC_SUCCESS || twrc == TWRC_CHECKSTATUS) && - (MSG_SET == _MSG || MSG_RESET == _MSG) ) - { - TW_INT16 twrc2 = updatePostDependencies(_MSG, _pCap->Cap); - //if (twrc2!=TWRC_SUCCESS) - //{ - //ostringstream os; - //os<GetCapID(); - //istringstream is(os.str()); - //string out; - //is>>out; - //FileTools::write_log("D:/1.txt","handleCap 1 "+out); - //} - if(twrc == TWRC_SUCCESS && twrc2 != TWRC_SUCCESS) - { - twrc = twrc2; - } - } - } - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -CTWAINContainer* CTWAINDS_Base::findCapability(const TW_UINT16 _unCap) -{ - CTWAINContainer* pCap = 0; - - TWAINCapabilitiesMap::iterator itCap = m_IndependantCapMap.find(_unCap); - - if(itCap == m_IndependantCapMap.end()) - { - setConditionCode(TWCC_CAPUNSUPPORTED); - } - else - { - pCap = itCap->second; - } - - return pCap; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_userinterface(TW_UINT16 _MSG, - pTW_USERINTERFACE _pData) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - if (_pData==0) - { - setConditionCode(TWCC_BADVALUE); - //assert(0); - twrc = TWRC_FAILURE; - } - - else - { - switch(_MSG) - { - case MSG_ENABLEDS: - twrc = enableDS(_pData); - break; - - case MSG_ENABLEDSUIONLY: - twrc = enableDSOnly(_pData); - break; - - case MSG_DISABLEDS: - twrc = disableDS(_pData); - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_setupfilexfer( TW_UINT16 _MSG, - pTW_SETUPFILEXFER _pData) -{ - TW_INT16 twrc = TWRC_SUCCESS; - //FileTools::write_log("D:/1.txt","dat_setupfilexfer"); - switch(_MSG) - { - case MSG_GET: - twrc = getFileXfer(_pData); - break; - - case MSG_GETDEFAULT: - twrc = getDefaultFileXfer(_pData); - break; - - case MSG_RESET: - twrc = resetFileXfer(_pData); - break; - - case MSG_SET: - twrc = setFileXfer(_pData); - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_setupmemxfer(TW_UINT16 _MSG, - pTW_SETUPMEMXFER _pData) -{ - TW_INT16 twrc = TWRC_SUCCESS; - //FileTools::write_log("D:/1.txt","getMemoryXfer"); - switch(_MSG) - { - case MSG_GET: - twrc = getMemoryXfer(_pData); - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_imagenativexfer(TW_UINT16 _MSG, - TW_HANDLE& _hData) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - switch(_MSG) - { - case MSG_GET: - twrc = transferNativeImage(_hData); - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_imagefilexfer(TW_UINT16 _MSG) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - switch(_MSG) - { - case MSG_GET: - twrc = saveImageFile(); - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_customdsdata(TW_UINT16 _MSG, pTW_CUSTOMDSDATA _pDSData) -{ - TW_INT16 twrc = TWRC_SUCCESS; - if(m_CurrentState != dsState_Open) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - switch(_MSG) - { - case MSG_GET: - twrc = GetGustomDSData(_pDSData); - break; - - case MSG_SET: - twrc = SetGustomDSData(_pDSData); - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_imagememxfer(TW_UINT16 _MSG, - pTW_IMAGEMEMXFER _pData) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - switch(_MSG) - { - case MSG_GET: - twrc = transferMemoryBuffers(_pData); - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_imagelayout(TW_UINT16, - pTW_IMAGELAYOUT) -{ - // This should be implemented in the derived class. - setConditionCode(TWCC_CAPUNSUPPORTED); - return TWRC_FAILURE; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_extimageinfo(TW_UINT16, - pTW_EXTIMAGEINFO) -{ - //pTW_EXTIMAGEINFO->Info[0]. - // This should be implemented in the derived class. - setConditionCode(TWCC_CAPUNSUPPORTED); - return TWRC_FAILURE; - //return TWRC_SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::getConditionCode() const -{ - return m_DSConditionCode; -} - -////////////////////////////////////////////////////////////////////////////// -void CTWAINDS_Base::setConditionCode(TW_INT16 _cc) -{ - m_DSConditionCode = _cc; -} - -////////////////////////////////////////////////////////////////////////////// -pTW_IDENTITY CTWAINDS_Base::getIdentity() -{ - return &m_MyIdentity; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_imageinfo(TW_UINT16 _MSG, - pTW_IMAGEINFO _pImageInfo) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - switch(_MSG) - { - case MSG_GET: - twrc = getImageInfo(_pImageInfo); - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_status(TW_UINT16 _MSG, - pTW_STATUS _pStatus) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - if (_pStatus==0) - { - setConditionCode(TWCC_BADVALUE); - twrc = TWRC_FAILURE; - } - - else - { - switch(_MSG) - { - case MSG_GET: - _pStatus->ConditionCode = getConditionCode(); - setConditionCode(TWCC_SUCCESS); - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_pendingxfers(TW_UINT16 _MSG, - pTW_PENDINGXFERS _pXfers) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - switch(_MSG) - { - case MSG_ENDXFER: - //FileTools::write_log("D:/1.txt","dat_pendingxfers endxfer"); - twrc = endXfer(_pXfers); - break; - - case MSG_GET: - //FileTools::write_log("D:/1.txt","dat_pendingxfers getXfer"); - twrc = getXfer(_pXfers); - break; - - case MSG_RESET: - //FileTools::write_log("D:/1.txt","dat_pendingxfers resetXfer"); - twrc = resetXfer(_pXfers); - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_entrypoint(TW_UINT16 _MSG, - pTW_ENTRYPOINT _pEntryPoints) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - switch(_MSG) - { - case MSG_SET: - setEntryPoints(_pEntryPoints); - twrc = TWRC_SUCCESS; - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::dat_xfergroup(TW_UINT16 _MSG, - pTW_UINT32 _pXferGroup) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - if(!_pXferGroup) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - switch(_MSG) - { - case MSG_GET: - *_pXferGroup = DG_IMAGE; - twrc = TWRC_SUCCESS; - break; - - case MSG_SET: - if(*_pXferGroup != DG_IMAGE) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - twrc = TWRC_SUCCESS; - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - //assert(0); - twrc = TWRC_FAILURE; - break; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -bool CTWAINDS_Base::DoXferReadyEvent() -{ - bool bRC = false; - - if( dsState_Enabled != m_CurrentState ) - { - setConditionCode(TWCC_SEQERROR); - return bRC; - } - - /// @TODO check to see if we are simplex or duplex. - /// Document only updates with new sheet of paper. - m_DocumentNumber++; - m_PageNumber++; - m_CurrentState = dsState_XferReady; - getImageInfo(&m_ImageInfo); - -#ifdef TWNDS_OS_APPLE - TW_CALLBACK callback = {}; - callback.Message = MSG_XFERREADY; - - bRC = TWRC_SUCCESS==_DSM_Entry(getIdentity(), - (pTW_IDENTITY)NULL, - (TW_UINT32)DG_CONTROL, - (TW_UINT16)DAT_CALLBACK, - (TW_UINT16)MSG_INVOKE_CALLBACK, - (TW_MEMREF) &callback); -#else - // Tell the DSM that we are ready to send images - if(TWRC_SUCCESS==_DSM_Entry(getIdentity(), - getApp(), - DG_CONTROL, - DAT_NULL, - MSG_XFERREADY, - 0)) - { - bRC = true; - } -#endif - return bRC; -} - -////////////////////////////////////////////////////////////////////////////// -bool CTWAINDS_Base::DoCloseDSRequestEvent() -{ - bool bRC = false; - - if( dsState_Enabled != m_CurrentState ) - { - setConditionCode(TWCC_SEQERROR); - return bRC; - } -#ifdef TWNDS_OS_APPLE - TW_CALLBACK callback = {}; - callback.Message = MSG_CLOSEDSREQ; - - bRC = TWRC_SUCCESS==_DSM_Entry(getIdentity(), - (pTW_IDENTITY)NULL, - (TW_UINT32)DG_CONTROL, - (TW_UINT16)DAT_CALLBACK, - (TW_UINT16)MSG_INVOKE_CALLBACK, - (TW_MEMREF) &callback); -#else - // Tell the DSM that DS request to close or disable our user interface - // most likly user clicks on the 揅LOSE?button on GUI - if(TWRC_SUCCESS==_DSM_Entry(getIdentity(), - getApp(), - DG_CONTROL, - DAT_NULL, - MSG_CLOSEDSREQ, - 0)) - { - bRC = true; - } -#endif - return bRC; -} - -////////////////////////////////////////////////////////////////////////////// -bool CTWAINDS_Base::DoCloseDSOkEvent() -{ - bool bRC = false; - - if( dsState_Enabled != m_CurrentState ) - { - setConditionCode(TWCC_SEQERROR); - return bRC; - } - -#ifdef TWNDS_OS_APPLE - TW_CALLBACK callback = {}; - callback.Message = MSG_CLOSEDSOK; - - bRC = TWRC_SUCCESS==_DSM_Entry(getIdentity(), - (pTW_IDENTITY)NULL, - (TW_UINT32)DG_CONTROL, - (TW_UINT16)DAT_CALLBACK, - (TW_UINT16)MSG_INVOKE_CALLBACK, - (TW_MEMREF) &callback); -#else - // Tell the DSM that we are ready to send images - // most likly user clicks on the 揙K?button on GUI - if(TWRC_SUCCESS==_DSM_Entry(getIdentity(), - getApp(), - DG_CONTROL, - DAT_NULL, - MSG_CLOSEDSOK, - 0)) - { - bRC = true; - //FileTools::write_log("D:/1.txt"," DoCloseDSOkEvent"); - } -#endif - return bRC; -} - -////////////////////////////////////////////////////////////////////////////// -bool CTWAINDS_Base::DoDeviceEvent() -{ - //Report to the DSM that a device event has occurred - bool bRC = false; - return bRC; -} - -////////////////////////////////////////////////////////////////////////////// -pTW_IDENTITY CTWAINDS_Base::getApp() -{ - return &m_App; -} - -////////////////////////////////////////////////////////////////////////////// -template -TW_INT16 CTWAINDS_Base::handleCap(TW_UINT16 _MSG, TWAINContainerType* _pContainer, pTW_CAPABILITY _pCap) -{ - TW_INT16 twrc = TWRC_FAILURE; - - if(MSG_QUERYSUPPORT == _MSG) // special case - { - _pCap->ConType = TWON_ONEVALUE; - _pCap->hContainer = _DSM_Alloc(sizeof(TW_ONEVALUE)); - - if(0 != _pCap->hContainer) - { - pTW_ONEVALUE pCap = (pTW_ONEVALUE)_DSM_LockMemory(_pCap->hContainer); - - pCap->ItemType = TWTY_INT32; - pCap->Item = _pContainer->getMSG_QUERYSUPPORT(); - - _DSM_UnlockMemory(_pCap->hContainer); - twrc = TWRC_SUCCESS; - } - } - else - { - // first check if the operation is allowed on this container - if(!_pContainer->isOperationAllowed(_MSG)) - { - //FileTools::write_log("D:/1.txt","handleCap !_pContainer->isOperationAllowed(_MSG)"); - setConditionCode(TWCC_CAPBADOPERATION); - return TWRC_FAILURE; - } - - switch(_pContainer->GetItemType()) - { - case TWTY_INT8: - case TWTY_INT16: - case TWTY_INT32: - case TWTY_UINT8: - case TWTY_UINT16: - case TWTY_BOOL: - case TWTY_FIX32: - case TWTY_FRAME: - case TWTY_STR32: - case TWTY_STR64: - case TWTY_STR128: - case TWTY_STR255: - twrc = TWRC_SUCCESS; // so far so good - break; - - default: - setConditionCode(TWCC_CAPBADOPERATION); - return TWRC_FAILURE; - break; - - } // switch(_pContainer->GetGetType()) - - if(TWRC_SUCCESS == twrc) - { - // Now that the type is valid, do the actual operation - switch(_MSG) - { - case MSG_RESET: - //MSG_RESET is supposed to reset and then return the current value - if(m_CurrentState >= dsState_Enabled) - { - //FileTools::write_log("D:/1.txt"," handleCap m_CurrentState >= dsState_Enabled"); - setConditionCode(TWCC_SEQERROR); - twrc = TWRC_FAILURE; - break; - } - _pContainer->Reset(); - //change the behavior to a get current - _MSG = MSG_GETCURRENT; - case MSG_GETCURRENT: - case MSG_GETDEFAULT: - case MSG_GET: - _pCap->ConType = _pContainer->GetGetType(_MSG); - twrc = updatePreDependencies(_pContainer); - if(twrc != TWRC_SUCCESS) - { - //FileTools::write_log("D:/1.txt"," handleCap twrc != TWRC_SUCCESS"); - break; - } - - _pCap->hContainer = _pContainer->GetContainer(_MSG); - twrc = updatePostContainer(_pCap); - if (twrc!=TWRC_SUCCESS) - { - //FileTools::write_log("D:/1.txt"," handleCap twrc != TWRC_SUCCESS 2"); - } - break; - - case MSG_SET: - { - if(m_CurrentState >= dsState_Enabled) - { - //FileTools::write_log("D:/1.txt"," handleCap MSG_SET m_CurrentState >= dsState_Enabled"); - setConditionCode(TWCC_SEQERROR); - twrc = TWRC_FAILURE; - break; - } - twrc = updatePreDependencies(_pContainer); - if(twrc != TWRC_SUCCESS) - { - //FileTools::write_log("D:/1.txt"," handleCap MSG_SET twrc != TWRC_SUCCESS 3"); - break; - } - twrc = updatePreContainer(_pCap); - if(twrc!=TWRC_SUCCESS) - { - //FileTools::write_log("D:/1.txt"," handleCap MSG_SET twrc != TWRC_SUCCESS 4"); - break; - } - BYTE * pContainer = (BYTE*)_DSM_LockMemory(_pCap->hContainer); - if(pContainer==0) - { - setConditionCode(TWCC_LOWMEMORY); - //FileTools::write_log("D:/1.txt"," pContainer==0 512"); - twrc = TWRC_FAILURE; - break; - } - twrc = validateCapabilitySet(_pCap->Cap,_pCap->ConType, pContainer); - //if (twrc!=TWRC_SUCCESS) - //{ - // FileTools::write_log("D:/1.txt"," pContainer==0 1024"); - //} - _DSM_UnlockMemory(_pCap->hContainer); - if(twrc != TWRC_SUCCESS) - { - setConditionCode(TWCC_BADVALUE); - // if(twrc == TWRC_FAILURE) - // { - //FileTools::write_log("D:/1.txt"," handleCap MSG_SET twrc = validateCapabilitySet(_pCap->Cap,_pCap->ConType, pContainer);"); - // break; - // } - } - - TW_INT16 Condition; - TW_INT16 twrc2 = _pContainer->Set(_pCap, Condition); - if(twrc2 != TWRC_SUCCESS) - { - setConditionCode(Condition); - if(twrc == TWRC_SUCCESS && twrc2 != TWRC_SUCCESS) - { - //FileTools::write_log("D:/1.txt"," handleCap MSG_SET TW_INT16 twrc2 = _pContainer->Set(_pCap, Condition);"); - twrc = twrc2; - } - } - } - break; - - default: - setConditionCode(TWCC_CAPBADOPERATION); - break; - } - } // if(TWRC_SUCCESS == twrc) - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::validateCapabilitySet(TW_UINT16 _Cap, TW_UINT16 _ConType, BYTE* _pContainer) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - switch(_Cap) - { - case CAP_XFERCOUNT: - { - twrc = TWRC_FAILURE; - if(TWON_ONEVALUE == _ConType) - { - pTW_ONEVALUE pCap = (pTW_ONEVALUE)_pContainer; - - if(pCap) - { - if( (TW_INT16)pCap->Item == -1 || (TW_INT16)pCap->Item > 0 ) - { - twrc = TWRC_SUCCESS; - } - } - } - break; - } - case ICAP_GAMMA: - { - twrc = TWRC_FAILURE; - if(TWON_ONEVALUE == _ConType) - { - pTW_ONEVALUE_FIX32 pCap = (pTW_ONEVALUE_FIX32)_pContainer; - if(pCap) - { - float flVal = FIX32ToFloat(pCap->Item); - if( flVal>0 ) - { - twrc = TWRC_SUCCESS; - } - } - } - break; - } - case ICAP_FRAMES: - { - int unit = TWUN_PIXELS; - float Xres = 100; - float Yres = 100; - twrc = getCurrentUnits(unit, Xres, Yres); - - if(TWON_ONEVALUE == _ConType) - { - pTW_ONEVALUE_FRAME pCap = (pTW_ONEVALUE_FRAME)_pContainer; - - if(pCap && pCap->ItemType == TWTY_FRAME) - { - InternalFrame frame(pCap->Item, unit, Xres, Yres); - bool bConstrained; - if(!ConstrainFrameToScanner(frame,bConstrained)) - { - setConditionCode(TWCC_BADVALUE); - //FileTools::write_log("D:/1.txt","uvalidateCapabilitySet 6"); - twrc = TWRC_FAILURE; - } - else if(bConstrained) - { - pCap->Item = frame.AsTW_FRAME(unit, Xres, Yres); - twrc = TWRC_CHECKSTATUS; - } - } - } - else if(TWON_ENUMERATION == _ConType) - { - CTWAINContainerInt *pDepCapMax = dynamic_cast(findCapability(ICAP_MAXFRAMES)); - if(pDepCapMax==0) - { - setConditionCode(TWCC_BUMMER); - //FileTools::write_log("D:/1.txt","uvalidateCapabilitySet 7"); - twrc = TWRC_FAILURE; - } - else - { - pTW_ENUMERATION_FRAME pCap = (pTW_ENUMERATION_FRAME)_pContainer; - int nMax; - if(!pDepCapMax->GetCurrent(nMax) || pCap->NumItems>(TW_UINT32)nMax) - { - setConditionCode(TWCC_BADVALUE); - //FileTools::write_log("D:/1.txt","uvalidateCapabilitySet 8"); - twrc = TWRC_FAILURE; - } - else - { - if(pCap && pCap->ItemType == TWTY_FRAME) - { - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - InternalFrame frame(pCap->ItemList[x], unit, Xres, Yres); - bool bConstrained; - if(!ConstrainFrameToScanner(frame,bConstrained)) - { - setConditionCode(TWCC_BADVALUE); - //FileTools::write_log("D:/1.txt","uvalidateCapabilitySet 9"); - twrc = TWRC_FAILURE; - } - else if(bConstrained) - { - pCap->ItemList[x] = frame.AsTW_FRAME(unit, Xres, Yres); - //FileTools::write_log("D:/1.txt","uvalidateCapabilitySet 10"); - twrc = TWRC_CHECKSTATUS; - } - } - } - } - } - } - break; - } - case ICAP_MAXFRAMES: - if(TWON_ONEVALUE == _ConType) - { - TW_ONEVALUE *pCap = (TW_ONEVALUE*)_pContainer; - - if(!pCap || pCap->ItemType != TWTY_UINT16 || pCap->Item!=1) - { - //FileTools::write_log("D:/1.txt","uvalidateCapabilitySet 11"); - twrc = TWRC_FAILURE; - } - } - else - { - //FileTools::write_log("D:/1.txt","uvalidateCapabilitySet 12"); - setConditionCode(TWCC_CAPBADOPERATION); - twrc = TWRC_FAILURE; - } - break; - default: - break; - } - - return twrc; -} -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::updatePreContainer(pTW_CAPABILITY _pCap) -{ - TW_INT16 twrc = TWRC_SUCCESS; - BYTE * pContainer = (BYTE*)_DSM_LockMemory(_pCap->hContainer); - if(pContainer==0) - { - //FileTools::write_log("D:/1.txt","updatePreContainer(pTW_CAPABILITY _pCap) 12"); - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - switch(_pCap->Cap) - { - case ICAP_XRESOLUTION: - case ICAP_YRESOLUTION: - { - int nUnit = TWUN_INCHES; - CTWAINContainerInt *pnCap = 0; - if( 0 == (pnCap = dynamic_cast(findCapability(ICAP_UNITS))) - || false == pnCap->GetCurrent(nUnit)) - { - //FileTools::write_log("D:/1.txt","updatePreContainer(pTW_CAPABILITY _pCap) 6"); - setConditionCode(TWCC_OPERATIONERROR); - twrc = TWRC_FAILURE; - } - else - { - if(nUnit==TWUN_PIXELS) - { - //FileTools::write_log("D:/1.txt","updatePreContainer(pTW_CAPABILITY _pCap) 5"); - setConditionCode(TWCC_CAPSEQERROR); - twrc = TWRC_FAILURE; - } - else - { - if(TWON_ONEVALUE == _pCap->ConType) - { - pTW_ONEVALUE_FIX32 pCap = (pTW_ONEVALUE_FIX32)pContainer; - - if(pCap==0 || pCap->ItemType != TWTY_FIX32) - { - setConditionCode(TWCC_BADVALUE); - //FileTools::write_log("D:/1.txt","updatePreContainer(pTW_CAPABILITY _pCap) 7"); - twrc = TWRC_FAILURE; - } - else - { - pCap->Item = ConvertUnits(pCap->Item,TWUN_PIXELS,nUnit,1.0); - } - } - else if(TWON_ENUMERATION == _pCap->ConType) - { - pTW_ENUMERATION_FIX32 pCap = (pTW_ENUMERATION_FIX32)pContainer; - if(pCap==0 || pCap->ItemType != TWTY_FIX32) - { - //FileTools::write_log("D:/1.txt","updatePreContainer(pTW_CAPABILITY _pCap) 0"); - setConditionCode(TWCC_BADVALUE); - twrc = TWRC_FAILURE; - } - else - { - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - pCap->ItemList[x] = ConvertUnits(pCap->ItemList[x],TWUN_PIXELS,nUnit,1.0); - } - } - } - } - } - } - break; - } - _DSM_UnlockMemory(_pCap->hContainer); - - return twrc; -} -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::updatePostContainer(pTW_CAPABILITY _pCap) -{ - TW_INT16 twrc = TWRC_SUCCESS; - BYTE * pContainer = (BYTE*)_DSM_LockMemory(_pCap->hContainer); - if(pContainer==0) - { - setConditionCode(TWCC_LOWMEMORY); - //FileTools::write_log("D:/1.txt","updatePostContainer(pTW_CAPABILITY _pCap) 0"); - return TWRC_FAILURE; - } - - switch(_pCap->Cap) - { - case ICAP_XRESOLUTION: - case ICAP_YRESOLUTION: - { - int nUnit = TWUN_PIXELS; - float Xres = 100; - float Yres = 100; - twrc = getCurrentUnits(nUnit, Xres, Yres); - if(_pCap->Cap==ICAP_YRESOLUTION) - { - Xres = Yres; - } - if(twrc==TWRC_SUCCESS) - { - if(TWON_ONEVALUE == _pCap->ConType) - { - pTW_ONEVALUE_FIX32 pCap = (pTW_ONEVALUE_FIX32)pContainer; - - if(pCap==0 || pCap->ItemType != TWTY_FIX32) - { - //FileTools::write_log("D:/1.txt","updatePostContainer(pTW_CAPABILITY _pCap) 1"); - setConditionCode(TWCC_BADVALUE); - twrc = TWRC_FAILURE; - } - else - { - pCap->Item = ConvertUnits(pCap->Item,nUnit,TWUN_INCHES,Xres); - } - } - else if(TWON_ENUMERATION == _pCap->ConType) - { - pTW_ENUMERATION_FIX32 pCap = (pTW_ENUMERATION_FIX32)pContainer; - if(pCap==0 || pCap->ItemType != TWTY_FIX32) - { - //FileTools::write_log("D:/1.txt","updatePostContainer(pTW_CAPABILITY _pCap) 2"); - setConditionCode(TWCC_BADVALUE); - twrc = TWRC_FAILURE; - } - else - { - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - pCap->ItemList[x] = ConvertUnits(pCap->ItemList[x],nUnit, TWUN_PIXELS,Xres); - } - } - } - } - } - break; - case ICAP_PHYSICALHEIGHT: - case ICAP_PHYSICALWIDTH: - { - int nUnit = TWUN_PIXELS; - float Xres = 100; - float Yres = 100; - twrc = getCurrentUnits(nUnit, Xres, Yres); - if(_pCap->Cap==ICAP_PHYSICALHEIGHT) - { - Xres = Yres; - } - if(twrc==TWRC_SUCCESS) - { - if(TWON_ONEVALUE == _pCap->ConType) - { - pTW_ONEVALUE_FIX32 pCap = (pTW_ONEVALUE_FIX32)pContainer; - - if(pCap==0 || pCap->ItemType != TWTY_FIX32) - { - //FileTools::write_log("D:/1.txt","updatePostContainer(pTW_CAPABILITY _pCap) 3"); - setConditionCode(TWCC_BADVALUE); - twrc = TWRC_FAILURE; - } - else - { - pCap->Item = ConvertUnits(pCap->Item,TWUN_PIXELS,nUnit,Xres); - } - } - else - { - setConditionCode(TWCC_OPERATIONERROR); - //FileTools::write_log("D:/1.txt","updatePostContainer(pTW_CAPABILITY _pCap) 4"); - twrc = TWRC_FAILURE; - } - } - } - break; - } - _DSM_UnlockMemory(_pCap->hContainer); - - return twrc; -} -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::updatePreDependencies(CTWAINContainer* _pContainer) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - switch(_pContainer->GetCapID()) - { - case ICAP_FRAMES: - { - int unit = TWUN_PIXELS; - float Xres = 100; - float Yres = 100; - twrc = getCurrentUnits(unit, Xres, Yres); - CTWAINContainerFrame *pnCap = dynamic_cast(_pContainer); - if(pnCap) - { - pnCap->setCurrentUnits(unit, Xres, Yres); - } - else - { - //FileTools::write_log("D:/1.txt","(CTWAINContainer* _pContainer) 1"); - twrc = TWRC_FAILURE; - } - } - break; - - default: - break; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::updatePostDependencies(TW_UINT16 MSG, TW_UINT16 Cap) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - // Handle some special post dependancy cases - // This is where capabilities that depend on the one that just got changed - // must also get changed so they stay in sync. - - // Check to see what got changed - switch(Cap) - { - case ICAP_SUPPORTEDSIZES: - { - // if ICAP_SUPPORTEDSIZES was modified, ICAP_FRAME needs to be synced. - CTWAINContainerInt *pDepCapSS = dynamic_cast(findCapability(ICAP_SUPPORTEDSIZES)); - CTWAINContainerFrame *pDepCapFrames = dynamic_cast(findCapability(ICAP_FRAMES)); - - if(0 == pDepCapSS || 0 == pDepCapFrames) - { - setConditionCode(TWCC_CAPBADOPERATION); - //FileTools::write_log("D:/1.txt","updatePostDependencies 0"); - twrc = TWRC_FAILURE; - break; - } - - if( MSG == MSG_SET - || MSG == MSG_RESET ) - { - int ss; - pDepCapSS->GetCurrent(ss); - InternalFrame frame(ss); - bool bConstrained; - ConstrainFrameToScanner(frame,bConstrained); - pDepCapFrames->Set(frame); - } - } - break; - - case ICAP_FRAMES: - { - // if ICAP_FRAMES was modified, ICAP_SUPPORTEDSIZES needs to be synced. - CTWAINContainerInt *pDepCapSS = dynamic_cast(findCapability(ICAP_SUPPORTEDSIZES)); - CTWAINContainerFrame *pDepCapFrames = dynamic_cast(findCapability(ICAP_FRAMES)); - - if(0 == pDepCapSS || 0 == pDepCapFrames) - { - setConditionCode(TWCC_CAPBADOPERATION); - //FileTools::write_log("D:/1.txt","updatePostDependencies 1"); - twrc = TWRC_FAILURE; - break; - } - - if( MSG == MSG_SET - || MSG == MSG_RESET ) - { - // Figure out if the current frame is in our list of ICAP_SUPPORTEDSIZES - // if it is in the list, then we need to set the current SS to match - // loop through all of our Supported Sizes and make a frame from them - // then see if the frame matches the one we have. - - InternalFrame curFrame; - pDepCapFrames->GetCurrent(curFrame); - const IntVector listInts = pDepCapSS->GetSupported(); - - const int nSize = (int)(listInts.size()); - int x; - for(x = 0; x < nSize; ++x) - { - int ss = listInts[x]; - InternalFrame frame(ss); - if(curFrame == frame) - { - pDepCapSS->SetCurrent(ss); - break; - } - } - - // No match found - if(x >= nSize) - { - if(!pDepCapSS->SetCurrent(TWSS_NONE)) - { - pDepCapSS->Add(TWSS_NONE); - pDepCapSS->SetCurrent(TWSS_NONE); - } - } - } - } - break; - case ICAP_XRESOLUTION: - case ICAP_YRESOLUTION: - case ICAP_UNITS: - { - int unit; - float Xres, Yres; - CTWAINContainerFrame *pDepCapFrames = dynamic_cast(findCapability(ICAP_FRAMES)); - - if(pDepCapFrames ==0) - { - setConditionCode(TWCC_BUMMER); - //FileTools::write_log("D:/1.txt","updatePostDependencies 3"); - twrc = TWRC_FAILURE; - break; - } - - if(getCurrentUnits(unit, Xres, Yres)==TWRC_SUCCESS) - { - pDepCapFrames->setCurrentUnits(unit, Xres, Yres); - } - else - { - setConditionCode(TWCC_BUMMER); - //FileTools::write_log("D:/1.txt","updatePostDependencies 4"); - return TWRC_FAILURE; - } - } - break; - case CAP_FEEDERENABLED: - //TODO add routine here if CAP_DUPLEXENABLED supports TRUE - break; - default: - break; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -bool CTWAINDS_Base::ConstrainFrameToScanner(InternalFrame& _frame, bool &bConstrained) -{ - bConstrained = false; - int nMaxHValue = 0x7FFFFFFF; //max frame size fit in InternalFrame - int nMinHValue = 0; - int nMaxWValue = 0x7FFFFFFF; //max frame size fit in InternalFrame - int nMinWValue = 0; - float fTemp; - // ICAP_PHYSICALWIDTH and ICAP_PHYSICALHEIGHT are required Caps while - // ICAP_MINIMUMWIDTH and ICAP_MINIMUMHEIGHT are not required caps. - CTWAINContainerFix32* pPhysicalWidth = dynamic_cast(findCapability(ICAP_PHYSICALWIDTH)); - CTWAINContainerFix32* pPhysicalHeight = dynamic_cast(findCapability(ICAP_PHYSICALHEIGHT)); - CTWAINContainerFix32* pMinWidth = dynamic_cast(findCapability(ICAP_MINIMUMWIDTH)); - CTWAINContainerFix32* pMinHeight = dynamic_cast(findCapability(ICAP_MINIMUMHEIGHT)); - - if(pPhysicalWidth) - { - if(pPhysicalWidth->GetCurrent(fTemp)) - { - nMaxWValue = (int)(fTemp*1000.0); - } - } - if(pPhysicalHeight) - { - if(pPhysicalHeight->GetCurrent(fTemp)) - { - nMaxHValue = (int)(fTemp*1000.0); - } - } - if(pMinWidth) - { - if(pMinWidth->GetCurrent(fTemp)) - { - nMinWValue = (int)(fTemp*1000.0); - } - } - if(pMinHeight) - { - if(pMinHeight->GetCurrent(fTemp)) - { - nMinHValue = (int)(fTemp*1000.0); - } - } - - // Constrain the width - if(_frame.nLeft < 0) - { - /* - _frame.nLeft = 0; - bConstrained = true; - */ - return false; - } - if(_frame.nRight <= 0 || _frame.nRight > nMaxWValue) - { - /* - _frame.nRight = nMaxWValue; - bConstrained = true; - */ - return false; - } - if(_frame.nLeft >= _frame.nRight) - { - _frame.nLeft = 0; - _frame.nRight = nMaxWValue; - bConstrained = true; - } - - if((_frame.nRight-_frame.nLeft) < nMinWValue) - { - _frame.nLeft = max( 0, _frame.nLeft - (nMinWValue - (_frame.nRight-_frame.nLeft)) ); - _frame.nRight = _frame.nLeft + max(nMinWValue, _frame.nRight-_frame.nLeft); - bConstrained = true; - } - - // Constrain the height - if(_frame.nTop < 0) - { - /*_frame.nTop = 0; - bConstrained = true;*/ - return false; - } - if(_frame.nBottom <= 0 || _frame.nBottom>nMaxHValue) - { - /* - _frame.nBottom = nMaxHValue; - bConstrained = true; - */ - return false; - } - if(_frame.nTop >= _frame.nBottom) - { - _frame.nTop = 0; - _frame.nBottom = nMaxHValue; - bConstrained = true; - } - if(( _frame.nBottom-_frame.nTop)< nMinHValue) - { - _frame.nTop = max( 0, _frame.nTop - (nMinHValue - (_frame.nBottom-_frame.nTop)) ); - _frame.nBottom = _frame.nTop + max(nMinHValue, _frame.nBottom-_frame.nTop); - bConstrained = true; - } - - return true; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::getCurrentUnits(int &Unit, float &Xres, float &Yres) -{ - TW_INT16 twrc = TWRC_SUCCESS; - CTWAINContainerFix32 *pfCap = 0; - CTWAINContainerInt *pnCap = 0; - - // X resolution - if( 0 == (pfCap = dynamic_cast(findCapability(ICAP_XRESOLUTION))) - || false == pfCap->GetCurrent(Xres) ) - { - setConditionCode(TWCC_OPERATIONERROR); - twrc = TWRC_FAILURE; - } - - // Y resolution - if( 0 == (pfCap = dynamic_cast(findCapability(ICAP_YRESOLUTION))) - || false == pfCap->GetCurrent(Yres) ) - { - setConditionCode(TWCC_OPERATIONERROR); - twrc = TWRC_FAILURE; - } - - // Unit - if( 0 == (pnCap = dynamic_cast(findCapability(ICAP_UNITS))) - || false == pnCap->GetCurrent(Unit) ) - { - setConditionCode(TWCC_OPERATIONERROR); - twrc = TWRC_FAILURE; - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::getFileXfer(pTW_SETUPFILEXFER _pData) -{ - // valid to call for 4, 5, & 6 - if( !(dsState_Open == m_CurrentState || - dsState_Enabled == m_CurrentState || - dsState_XferReady == m_CurrentState )) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - if(0 == _pData) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - CTWAINContainerInt* pCap = dynamic_cast(findCapability(ICAP_IMAGEFILEFORMAT)); - if(0 == pCap) - { - setConditionCode(TWCC_BADPROTOCOL); - return TWRC_FAILURE; - } - - SSTRCPY(_pData->FileName, sizeof(m_CurFileExferName), m_CurFileExferName); - int nCurFF; - pCap->GetCurrent(nCurFF); - _pData->Format = nCurFF; - - return TWRC_SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::getDefaultFileXfer(pTW_SETUPFILEXFER _pData) -{ - // valid to call for 4, 5, & 6 - if( !(dsState_Open == m_CurrentState || - dsState_Enabled == m_CurrentState || - dsState_XferReady == m_CurrentState )) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - if(0 == _pData) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - CTWAINContainerInt* pCap = dynamic_cast(findCapability(ICAP_IMAGEFILEFORMAT)); - if(0 == pCap) - { - setConditionCode(TWCC_BADPROTOCOL); - return TWRC_FAILURE; - } - - SSTRCPY(_pData->FileName, sizeof(m_DefFileExferName), m_DefFileExferName); - int nDefFF; - pCap->GetDefault(nDefFF); - _pData->Format = nDefFF; - - return TWRC_SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::resetFileXfer(pTW_SETUPFILEXFER _pData) -{ - // valid to call for 4 only - if( !(dsState_Open == m_CurrentState)) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - if(0 == _pData) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - CTWAINContainerInt* pCap = dynamic_cast(findCapability(ICAP_IMAGEFILEFORMAT)); - if(0 == pCap) - { - setConditionCode(TWCC_BADPROTOCOL); - return TWRC_FAILURE; - } - SSTRCPY(m_CurFileExferName, sizeof(m_CurFileExferName), m_DefFileExferName); - SSTRCPY(_pData->FileName, sizeof(m_CurFileExferName), m_CurFileExferName); - pCap->Reset(); - int nCurFF = 0; - pCap->GetCurrent(nCurFF); - _pData->Format = nCurFF; - - return TWRC_SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::setFileXfer(pTW_SETUPFILEXFER _pData) -{ - // valid to call for 4, 5, & 6 - if( !(dsState_Open == m_CurrentState || - dsState_Enabled == m_CurrentState || - dsState_XferReady == m_CurrentState )) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - if(0 == _pData) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - CTWAINContainerInt* pCap = dynamic_cast(findCapability(ICAP_IMAGEFILEFORMAT)); - if(0 == pCap) - { - setConditionCode(TWCC_BADPROTOCOL); - return TWRC_FAILURE; - } - - if(!pCap->SetCurrent(_pData->Format)) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_CHECKSTATUS; - } - SSTRCPY(m_CurFileExferName, sizeof(m_CurFileExferName), _pData->FileName); - - return TWRC_SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::saveImageFile() -{ - TW_INT16 twrc = TWRC_FAILURE; - - if( dsState_XferReady != m_CurrentState ) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - // Get the image that should be waiting for us. - if(TWRC_SUCCESS != transfer()) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - int nCurFF = -1; - CTWAINContainerInt* pCap = dynamic_cast(findCapability(ICAP_IMAGEFILEFORMAT)); - if(0 == pCap || !pCap->GetCurrent(nCurFF)) - { - setConditionCode(TWCC_BADPROTOCOL); - return TWRC_FAILURE; - } - - // Do a quick test to see if we got a supported file type. - switch (nCurFF) - { - case TWFF_BMP: - twrc = saveImageFileAsBMP(); - break; - - case TWFF_TIFF: - twrc = saveImageFileAsTIFF(); - break; - - /* - Untill compression is implimented we support Jpeg - case TWFF_JFIF: - break; - */ - - default: - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - break; - } - - if(twrc == TWRC_XFERDONE) - { - m_CurrentState = dsState_Xferring; - } - - return twrc; -} -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::saveImageFileAsTIFF() -{ - TW_INT32 nWidth = m_ImageInfo.ImageWidth; - TW_INT32 nHeight = m_ImageInfo.ImageLength; - TW_INT16 nBPP = m_ImageInfo.BitsPerPixel; - TW_INT32 nBPL = BYTES_PERLINE(nWidth, nBPP); - CTiffWriter *pTifImg = new CTiffWriter(m_CurFileExferName, nWidth, nHeight, nBPP, nBPL); - if(!pTifImg) - { - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - pTifImg->setXResolution(m_ImageInfo.XResolution.Whole, 1); - pTifImg->setYResolution(m_ImageInfo.YResolution.Whole, 1); - pTifImg->writeImageHeader(); - - BYTE *pImage = (BYTE *)_DSM_LockMemory(m_hImageData); - if(pImage == NULL) - { - setConditionCode(TWCC_BADVALUE); - delete pTifImg; - return TWRC_FAILURE; - } - - bool bSwitch = true; - CTWAINContainerInt *pnCap = dynamic_cast(findCapability(ICAP_BITORDER)); - if(pnCap) - { - int nVal; - if(pnCap->GetCurrent(nVal)) - { - bSwitch = nVal==TWBO_LSBFIRST? true:false; - } - } - - // write the received image data to the image file - if( m_ImageInfo.BitsPerPixel < 24 // BW or Gray - || m_ImageInfo.BitsPerPixel > 24 && !bSwitch) //Color but have to switch between RGB and BGR - { - if(!pTifImg->WriteTIFFData(reinterpret_cast(pImage), nBPL*nHeight)) - { - setConditionCode(TWCC_FILEWRITEERROR); - _DSM_UnlockMemory(m_hImageData); - delete pTifImg; - return TWRC_FAILURE; - } - } - else // color - { - // we need to reverse the color from BRG to RGB - BYTE *pLineBuff = NULL; - TW_HANDLE hLineBuff = _DSM_Alloc(nBPL); - - if( NULL == hLineBuff ) - { - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - pLineBuff = (BYTE*)_DSM_LockMemory(hLineBuff); - if(NULL == pLineBuff) - { - _DSM_Free(hLineBuff); - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - BYTE *pSource = pImage; - BYTE *pDest = NULL; - - - for(TW_INT32 row=0; rowWriteTIFFData(reinterpret_cast(pLineBuff), nBPL)) - { - setConditionCode(TWCC_FILEWRITEERROR); - _DSM_UnlockMemory(m_hImageData); - delete pTifImg; - return TWRC_FAILURE; - } - } - - _DSM_UnlockMemory(hLineBuff); - _DSM_Free(hLineBuff); - - } - delete pTifImg; - _DSM_UnlockMemory(m_hImageData); - - return TWRC_XFERDONE; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::saveImageFileAsBMP() -{ - // Save the image to disk - FILE *pFile; - FOPEN(pFile, m_CurFileExferName, "wb"); - if(pFile == 0) - { - setConditionCode(TWCC_FILEWRITEERROR); - return TWRC_FAILURE; - } - - TW_HANDLE hDIB = 0; - if( TWRC_SUCCESS != getDIBImage(hDIB) ) - { - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - // -Here we get a handle to a DIB. Save it to disk as a bmp. - PBITMAPINFOHEADER pDIB = (PBITMAPINFOHEADER)_DSM_LockMemory(hDIB); - if( pDIB == 0 ) - { - setConditionCode(TWCC_LOWMEMORY); - _DSM_Free(hDIB); - return TWRC_FAILURE; - } - - int nOffSet = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + (sizeof(RGBQUAD)*pDIB->biClrUsed); - int nDIBSize = sizeof(BITMAPINFOHEADER) + (sizeof(RGBQUAD)*pDIB->biClrUsed) + pDIB->biSizeImage; - - BITMAPFILEHEADER bmpFIH; - memset(&bmpFIH, 0, sizeof(BITMAPFILEHEADER)); - bmpFIH.bfType = ( (WORD) ('M' << 8) | 'B'); - bmpFIH.bfOffBits = nOffSet; - bmpFIH.bfSize = sizeof(BITMAPFILEHEADER) + nDIBSize; - - fwrite(&bmpFIH, 1, sizeof(BITMAPFILEHEADER), pFile); - fwrite(pDIB, 1, nDIBSize, pFile); - fclose(pFile); - pFile = 0; - _DSM_UnlockMemory(hDIB); - _DSM_Free(hDIB); - - return TWRC_XFERDONE; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::getDIBImage(TW_HANDLE& _hImage) -{ - if( 0 == m_hImageData ) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - TW_INT16 twrc = TWRC_FAILURE; - _hImage = 0; - - TW_HANDLE hDIB = NULL; //create a handle to a bitmap, which we'll allocate - BYTE *pSourceBuff = NULL; - BYTE *pDestBuff = NULL; - BYTE *pSrc = NULL; - BYTE *pDst = NULL; - - PBITMAPINFOHEADER pDIBInfoHeader = NULL; - const WORD bpp = m_ImageInfo.BitsPerPixel; - const DWORD SrcWidth = m_ImageInfo.ImageWidth; - const DWORD SrcLength = m_ImageInfo.ImageLength; - const DWORD SrcBytesPerRow = BYTES_PERLINE(SrcWidth, bpp); - const DWORD DstBytesPerRowAlgn = BYTES_PERLINE_ALIGN4(SrcWidth, bpp); //get the number of bytes per line we'll need for this image, and make sure it's DWORD-aligned - const WORD numcolors = bpp==1?2:bpp==8?256:0;// B&W = 2, Grey = 256, Color = 0 - const WORD palettesize = sizeof(RGBQUAD)* numcolors; - const DWORD bitmapSize = sizeof(BITMAPINFOHEADER) + palettesize + DstBytesPerRowAlgn*SrcLength; //multiply the bytes-per-row by the number of scanlines, and add that to the size of the bitmap header to find the total size of the bitmap - - - try - { - pSourceBuff = (BYTE *)_DSM_LockMemory(m_hImageData); - if(pSourceBuff == NULL) - { - setConditionCode(TWCC_BADVALUE); - throw TWCC_BADVALUE; - } - - hDIB = _DSM_Alloc(bitmapSize); //create a buffer as large as the bitmap - if(hDIB==NULL) //if we couldn't allocate the memory - { - //show that we ran out of memory - setConditionCode(TWCC_LOWMEMORY); - throw TWCC_LOWMEMORY; - } - - pDIBInfoHeader=(PBITMAPINFOHEADER)_DSM_LockMemory(hDIB); //get a pointer to the bitmap info header - if(pDIBInfoHeader==NULL) - { - //show that we ran out of memory - setConditionCode(TWCC_LOWMEMORY); - throw TWCC_LOWMEMORY; - } - - pDIBInfoHeader->biSize = sizeof(BITMAPINFOHEADER); //show how big the header info is - pDIBInfoHeader->biWidth = SrcWidth; //show how wide the image is - pDIBInfoHeader->biHeight = SrcLength; //show how tall the image is //G***shouldn't this be a negative number? - pDIBInfoHeader->biPlanes = 1; //bitmaps only support one color plane - pDIBInfoHeader->biBitCount = bpp; //set the bit depth - pDIBInfoHeader->biCompression = 0; //we only support uncompressed bitmaps - pDIBInfoHeader->biSizeImage = DstBytesPerRowAlgn*SrcLength; //uncompressed bitmaps can just set the size to zero - pDIBInfoHeader->biXPelsPerMeter = static_cast(FIX32ToFloat(m_ImageInfo.XResolution) * 39.37F + 0.5); - pDIBInfoHeader->biYPelsPerMeter = static_cast(FIX32ToFloat(m_ImageInfo.YResolution) * 39.37F + 0.5); - pDIBInfoHeader->biClrUsed = numcolors; - pDIBInfoHeader->biClrImportant = numcolors; //all the colors are important - - _DSM_UnlockMemory(hDIB); //unlock our DIB memory - - // Add Pallette - pDestBuff =(BYTE*)_DSM_LockMemory(hDIB); //get a pointer to the destination data - if(pDestBuff==NULL) - { - //show that we ran out of memory - setConditionCode(TWCC_LOWMEMORY); - throw TWCC_LOWMEMORY; - } - - pDst = pDestBuff + sizeof(BITMAPINFOHEADER); - - //fill the bitmap palette - if(numcolors==2) - { - RGBQUAD *pPal = (RGBQUAD*)pDst; - pPal->rgbBlue = pPal->rgbGreen = pPal->rgbRed = 0x00; - pPal->rgbReserved = 0x00; - - pPal++; - pPal->rgbBlue = pPal->rgbGreen =pPal->rgbRed = 0xff; - pPal->rgbReserved = 0x00; - } - else if(numcolors==256) - { - RGBQUAD *pPal = (RGBQUAD*)pDst; - for(int iPal = 0; iPal <= 255; iPal++, pPal++) - { - pPal->rgbBlue = pPal->rgbGreen = pPal->rgbRed = iPal; - pPal->rgbReserved = 0x00; - } - } - pDst += palettesize; - - bool bSwitch = false; - CTWAINContainerInt *pnCap = dynamic_cast(findCapability(ICAP_BITORDER)); - if(pnCap) - { - int nVal; - if(pnCap->GetCurrent(nVal)) - { - bSwitch = nVal==TWBO_LSBFIRST? false:true; - // bSwitch=true; - } - } - - // flip the image top to bottom - // for color change from BGR to RGB - if(TWPT_RGB==m_ImageInfo.PixelType && bSwitch) - { - for(DWORD length=0; lengthsetXResolution(m_ImageInfo.XResolution.Whole, 1); - pTifImg->setYResolution(m_ImageInfo.YResolution.Whole, 1); - - stringstream Header; - pTifImg->GetImageHeader(Header); - Header.seekp(0, ios_base::end); - DWORD dwSize =(DWORD) Header.tellp(); - Header.seekg(0, ios_base::beg); - TW_HANDLE hTiff = _DSM_Alloc(dwSize+nBPL*nHeight); //create a buffer as large as the bitmap - if(hTiff==0) - { - setConditionCode(TWCC_LOWMEMORY); - delete pTifImg; - return TWRC_FAILURE; - } - char *pData = (char*)_DSM_LockMemory(hTiff); - if(pData==0) - { - _DSM_Free(hTiff); - setConditionCode(TWCC_LOWMEMORY); - delete pTifImg; - return TWRC_FAILURE; - } - - Header.read(pData,dwSize); - pData +=dwSize; - - bool bSwitch = true; - CTWAINContainerInt *pnCap = dynamic_cast(findCapability(ICAP_BITORDER)); - if(pnCap) - { - int nVal; - if(pnCap->GetCurrent(nVal)) - { - bSwitch = nVal==TWBO_LSBFIRST? true:false; - } - } - - // write the received image data to the image file - if( m_ImageInfo.BitsPerPixel < 24 // BW or Gray - || m_ImageInfo.BitsPerPixel > 24 && !bSwitch) //Color but have to switch between RGB and BGR - { - memcpy(pData,pImage,nBPL*nHeight); - } - else // color - { - BYTE *pSource = pImage; - BYTE *pDest = NULL; - - - for(TW_INT32 row=0; rowMemory.Length < nDestBytesPerRow) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - if(0 == m_nDestScanLine) - { - // Get the image that should be waiting for us. - transfer(); - } - - if(0 == m_hImageData) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - BYTE *pSourceBuff = (BYTE *)_DSM_LockMemory(m_hImageData); - if(pSourceBuff == NULL) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - BYTE *pDestBuff = 0; - if(TWMF_POINTER & _ImageXfer->Memory.Flags) - { - pDestBuff = (BYTE*)_ImageXfer->Memory.TheMem; - } - else if(TWMF_HANDLE & _ImageXfer->Memory.Flags) - { - pDestBuff = (BYTE*)_DSM_LockMemory((TW_HANDLE)(_ImageXfer->Memory.TheMem)); - } - if(pDestBuff == NULL) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - m_CurrentState = dsState_Xferring; - - DWORD nRows = MIN(_ImageXfer->Memory.Length / nDestBytesPerRow, m_ImageInfo.ImageLength-m_nDestScanLine); - - bool bSwitch = true; - CTWAINContainerInt *pnCap = dynamic_cast(findCapability(ICAP_BITORDER)); - if(pnCap) - { - int nVal; - if(pnCap->GetCurrent(nVal)) - { - bSwitch = nVal==TWBO_LSBFIRST? true:false; - } - } - - BYTE *pSrc = 0; - BYTE *pDst = pDestBuff; - // for color change from BGR to RGB - if(TWPT_RGB==m_ImageInfo.PixelType && bSwitch) - { - for(DWORD row=0; rowCompression = m_ImageInfo.Compression; - //bytes per row (DWORD aligned as per spec) - _ImageXfer->BytesPerRow = nDestBytesPerRow; - //width in pixels - _ImageXfer->Columns = m_ImageInfo.ImageWidth; - //X offset always 0, only used in tiled images - obsolete - _ImageXfer->XOffset = 0; - //position of this strip from the beginning of the image - _ImageXfer->YOffset = m_nDestScanLine; - //update the number of rows and bytes written - _ImageXfer->Rows= nRows; - _ImageXfer->BytesWritten = nDestBytesPerRow*nRows; - - // increment the current scanline for next pass - m_nDestScanLine+=nRows; - - // check for finished scan - if(m_nDestScanLine >= (DWORD)m_ImageInfo.ImageLength) - { - //we are done early - m_nDestScanLine = 0; - twrc = TWRC_XFERDONE; - } - - _DSM_UnlockMemory(m_hImageData); - - if(TWMF_HANDLE & _ImageXfer->Memory.Flags) - { - _DSM_UnlockMemory((TW_HANDLE)(_ImageXfer->Memory.TheMem)); - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::transferNativeImage(TW_HANDLE &_hData) -{ - TW_INT16 twrc = TWRC_FAILURE; - - if( dsState_XferReady != m_CurrentState ) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - // Get the image that should be waiting for us. - twrc = transfer(); - if(TWRC_SUCCESS == twrc) - { - // Native is basicaly an image file transfered by memory - // Windows is a Device independent BMP - // Mac has changed from a PICT to a TIFF - // Linux is a TIFF -#if defined(TWNDS_OS_LINUX) - twrc = getTIFFImage(_hData); -#elif defined(TWNDS_OS_APPLE) - twrc = getPICTImage(_hData); -#else - twrc = getDIBImage(_hData); -#endif - if( TWRC_SUCCESS == twrc ) - { -#if !defined(TWNDS_OS_APPLE) - twrc = TWRC_XFERDONE; -#endif - m_CurrentState = dsState_Xferring; - } - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::GetGustomDSData(pTW_CUSTOMDSDATA _pDSData) -{ - setConditionCode(TWCC_BADPROTOCOL); - return TWRC_FAILURE; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_Base::SetGustomDSData(pTW_CUSTOMDSDATA _pDSData) -{ - setConditionCode(TWCC_BADPROTOCOL); - return TWRC_FAILURE; -} \ No newline at end of file diff --git a/CTWAINDS_Base.h b/CTWAINDS_Base.h deleted file mode 100644 index ef9aca6..0000000 --- a/CTWAINDS_Base.h +++ /dev/null @@ -1,649 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CTWAINDS_Base.h -* Base class describing a TWAIN Data Source. -* @author TWAIN Working Group -* @date April 2007 -*/ - -#ifndef __CTWAINBASE_H__ -#define __CTWAINBASE_H__ - -#include "CommonDS.h" - -/** -* possible States of the DS. -* The five possible states of the Data Source Manager -*/ -typedef enum -{ - dsState_Loaded = 3, /**< Source is loaded, but not open. */ - dsState_Open, /**< Source is open, and ready to: List & Negotiate Capabilities, - * Request the Acquisition of data, and Close. */ - dsState_Enabled, /**< If UI is being used it is displayed. */ - dsState_XferReady, /**< Transfers are ready. */ - dsState_Xferring /**< Transfering data. */ -} DS_State; - -/** -* This is a TWAIN compliant base class. It contains all of the capabilities -* and functions that are required to be a TWAIN compliant source. Simply -* inherit this class and implement the pure virtual functions. -* This basic version of a Data Source only supports connection of one -* application at a time. -*/ -class CTWAINDS_Base -{ -public: - CTWAINDS_Base(); - virtual ~CTWAINDS_Base(); - - /** - * This is the same as the main DS_Entry function. Routes traffic - * to the proper location. - * @param[in] _pOrigin Identifies the source application of the message. - * @param[in] _DG The Data Group. - * @param[in] _DAT The Data Attribute Type. - * @param[in] _MSG The message with respect to the Data Group and the Data Attribute Type. - * @param[in,out] _pData A pointer to the data structure or variable identified - * by the Data Attribute Type. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_UINT16 DS_Entry( pTW_IDENTITY _pOrigin, - TW_UINT32 _DG, - TW_UINT16 _DAT, - TW_UINT16 _MSG, - TW_MEMREF _pData); - - /** - * Fills _pStatus with the current condition code then resets the condition code. - * @param[in] _MSG valid message for DAT_STATUS. - * @param[out] _pStatus current condition code as pointer to TW_STATUS. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_status(TW_UINT16 _MSG, - pTW_STATUS _pStatus); - - /** - * handles DAT_EVENT's - * @param[in] _MSG the message to handle. - * @param[in] _pEvent a pointer to a TW_EVENT structure of the data. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_event(TW_UINT16 _MSG, - pTW_EVENT _pEvent); - - /** - * handles DAT_IDENTITY requests. - * @param[in] _pOrigin a pointer to a TW_IDENTITY of the sender of the message. - * @param[in] _MSG the message to handle. - * @param[in,out] _pData pointer to a TW_IDENTITY structure to pass or retrieve data based on message. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_identity(pTW_IDENTITY _pOrigin, - TW_UINT16 _MSG, - pTW_IDENTITY _pData); - - /** - * handles DAT_PENDINGXFERS requests. - * @param[in] _MSG the message to handle. - * @param[out] _pXfers a pointer to a TW_PENDINGXFERS structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_pendingxfers(TW_UINT16 _MSG, - pTW_PENDINGXFERS _pXfers); - - /** - * handles DAT_CAPABILITY requests. - * @param[in] _MSG the message to handle. - * @param[in] _pCap pointer to TW_CAPABILITY structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_capability(TW_UINT16 _MSG, - pTW_CAPABILITY _pCap); - - /** - * handles DAT_USERINTERFACE requests. - * @param[in] _MSG the message to handle. - * @param[in,out] _pData a pointer to a TW_USERINTERFACE structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_userinterface(TW_UINT16 _MSG, - pTW_USERINTERFACE _pData); - - /** - * handles DAT_SETUPFILEXFER requests. - * @param[in] _MSG the message to handle. - * @param[in] _pData a pointer to a TW_SETUPFILEXFER structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_setupfilexfer(TW_UINT16 _MSG, - pTW_SETUPFILEXFER _pData); - - /** - * handles DAT_SETUPMEMXFER requests. - * @param[in] _MSG the message to handle. - * @param[in] _pData a pointer to a TW_SETUPMEMXFER structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_setupmemxfer(TW_UINT16 _MSG, - pTW_SETUPMEMXFER _pData); - - /** - * handles DAT_IMAGENATIVEXFER requests. - * @param[in] _MSG the message to handle. - * @param[in] _pData a handle to the memory. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_imagenativexfer(TW_UINT16 _MSG, - TW_HANDLE& _pData); - - /** - * handles DAT_IMAGEFILEXFER requests. - * @param[in] _MSG the message to handle. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_imagefilexfer(TW_UINT16 _MSG); - - /** - * handles DAT_IMAGEMEMXFER requests. - * @param[in] _MSG the message to handle. - * @param[in] _pData a pointer to a TW_IMAGEMEMXFER structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_imagememxfer(TW_UINT16 _MSG, - pTW_IMAGEMEMXFER _pData); - - /** - * handles DAT_IMAGELAYOUT requests. - * @param[in] _MSG the message to handle. - * @param[in] _pData a pointer to a TW_IMAGELAYOUT structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_imagelayout(TW_UINT16 _MSG, - pTW_IMAGELAYOUT _pData); - - /** - * Figures out what to do with the DAT_IMAGEINFO request. - * @param[in] _MSG the message to handle. - * @param[in] _pImageInfo a pointer to a TW_IMAGEINFO structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_imageinfo(TW_UINT16 _MSG, - pTW_IMAGEINFO _pImageInfo); - - /** - * Figures out what to do with the DAT_EXTIMAGEINFO request. - * @param[in] _MSG the message to handle. - * @param[in] _pData a pointer to a TW_EXTIMAGEINFO structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_extimageinfo(TW_UINT16 _MSG, - pTW_EXTIMAGEINFO _pData); - - - /** - * Figures out what to do with the DAT_ENTRYPOINT request. - * @param[in] _MSG the message to handle. - * @param[in] _pEntryPoints a pointer to a TW_ENTRYPOINT structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_entrypoint(TW_UINT16 _MSG, - pTW_ENTRYPOINT _pEntryPoints); - - /** - * Figures out what to do with the DAT_XFERGROUP request. - * @param[in] _MSG the message to handle. - * @param[in] _pXferGroup a pointer to a TW_UINT32 value. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_xfergroup(TW_UINT16 _MSG, - pTW_UINT32 _pXferGroup); - - /** - * Figures out what to do with the DAT_CUSTOMDSDATA request. - * @param[in] _MSG the message to handle. - * @param[in] _pDSData a pointer to a TW_CUSTOMDSDATA structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 dat_customdsdata(TW_UINT16 _MSG, - pTW_CUSTOMDSDATA _pDSData); - - - ////////////////////////////////////////////////////////////////////////////// - /** - * @name Pure Virtuals - * @{ - */ - - /** - * Fills the identity structure with our information. - * Overload this function in derived classes to uniquely identify them selves. - * @param[out] _idStruct our TW_IDENTITY information. - */ - virtual void fillIdentityStructure(TW_IDENTITY& _idStruct) = 0; - - /** - * Initialize the Datasource. Allocate memory for Capabilities. - * Sets condition code if had problem. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 Initialize() = 0; - - /** - * Enable the Data Source. - * Called when a DG_CONTROL / DAT_USERINTERFACE / MSG_ENABLEDS op is sent. - * @param[in] _pData a pointer to a TW_USERINTERFACE structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 enableDS(pTW_USERINTERFACE _pData) = 0; - - /** - * Enable the Data Source in setup mode. - * Called when a DG_CONTROL / DAT_USERINTERFACE / MSG_ENABLEDS op is sent. - * @param[in] _pData a pointer to a TW_USERINTERFACE structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 enableDSOnly(pTW_USERINTERFACE _pData) = 0; - - /** - * Disable the Data Source. - * Called when a DG_CONTROL / DAT_USERINTERFACE / MSG_DISABLEDS op is sent. - * @param[in] _pData a pointer to a TW_USERINTERFACE structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 disableDS(pTW_USERINTERFACE _pData) = 0; - - /** - * Get image information. - * Called when a DG_IMAGE / DAT_IMAGEINFO / MSG_GET op is sent. - * -If in state 6, general info is provided about the image about to be transferred. - * -If in state 7, specific info is provided about the current image just transferred. - * @param[out] _pImageInfo a pointer to TW_IMAGEINFO structure to return image information. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 getImageInfo(pTW_IMAGEINFO _pImageInfo) = 0; - - /** - * Open the Data Source. - * Called when a DG_CONTROL / DAT_IDENTITY / MSG_OPENDS op is sent. - * @param[in] _pOrigin a pointer to TW_IDENTITY structure of the Application identity. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 openDS(pTW_IDENTITY _pOrigin) = 0; - - /** - * Close the Data Source. - * Called when a DG_CONTROL / DAT_IDENTITY / MSG_CLOSEDS op is sent. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 closeDS() = 0; - - /** - * get data for memory transfer. - * Called when a DG_CONTROL / DAT_SETUPMEMXFER / MSG_GET op is sent. - * @param[in] _pData a pointer to TW_SETUPMEMXFER structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 getMemoryXfer(pTW_SETUPMEMXFER _pData) = 0; - - /** - * Process events. - * Called when a DG_CONTROL / DAT_EVENT / MSG_PROCESSEVENT op is sent. - * @param[in] _pEvent a pointer to TW_EVENT structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 processEvent(pTW_EVENT _pEvent) = 0; - - /** - * Stop currect transfer if not done. Single from application that application is - * done with all data with current image. - * Check to see if there is still documents or data remaining to transfer. - * Called when a DG_CONTROL / DAT_PENDINGXFERS / MSG_ENDXFER op is sent. - * @param[out] _pXfers a pointer to TW_PENDINGXFERS structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 endXfer(pTW_PENDINGXFERS _pXfers) = 0; - - /** - * Check to see if there is still documents or data remaining to transfer. - * Called when a DG_CONTROL / DAT_PENDINGXFERS / MSG_GET op is sent. - * @param[out] _pXfers a pointer to TW_PENDINGXFERS structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 getXfer(pTW_PENDINGXFERS _pXfers) = 0; - - /** - * Flush all pending transfers from the Source.. - * Called when a DG_CONTROL / DAT_PENDINGXFERS / MSG_RESET op is sent. - * @param[out] _pXfers a pointer to TW_PENDINGXFERS structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 resetXfer(pTW_PENDINGXFERS _pXfers) = 0; - - /** - * Transfer image data from scanner to memory. - * Called during one of the transfer methods. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 transfer() = 0; - - // END Pure Virtuals - /** - * @} - */ - - ////////////////////////////////////////////////////////////////////////////// - /** - * @name Capabilities - * @{ - */ - - /** - * Start the transfer of image data natively. - * Called when a DG_IMAGE / DAT_IMAGENATIVEXFER / MSG_GET op is sent. - * @param[out] _hData a handle to store the image locaton. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 transferNativeImage(TW_HANDLE &_hData); - - /** - * Return info about the file that the Source will write the acquired data into - * Called when a DG_CONTROL / DAT_SETUPFILEXFER / MSG_GET op is sent. - * @param[in] _pData a pointer to TW_SETUPFILEXFER structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 getFileXfer(pTW_SETUPFILEXFER _pData); - - /** - * Return the default file transfer information - * Called when a DG_CONTROL / DAT_SETUPFILEXFER / MSG_GETDEFAULT op is sent. - * @param[in] _pData a pointer to TW_SETUPFILEXFER structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 getDefaultFileXfer(pTW_SETUPFILEXFER _pData); - - /** - * Reset current file information to default values - * Called when a DG_CONTROL / DAT_SETUPFILEXFER / MSG_RESET op is sent. - * @param[in] _pData a pointer to TW_SETUPFILEXFER structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 resetFileXfer(pTW_SETUPFILEXFER _pData); - - /** - * Set file transfer information for next file transfer - * Called when a DG_CONTROL / DAT_SETUPFILEXFER / MSG_SET op is sent. - * @param[in] _pData a pointer to TW_SETUPFILEXFER structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 setFileXfer(pTW_SETUPFILEXFER _pData); - - /** - * Save image data to file. - * Called when a DG_IMAGE / DAT_IMAGEFILEXFER / MSG_GET op is sent. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 saveImageFile(); - - /** - * Transfer memory buffers. - * Called when a DG_IMAGE / DAT_IMAGEMEMXFER / MSG_GET op is sent. - * @param[out] _pData a pointer to TW_IMAGEMEMXFER structure. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 transferMemoryBuffers(pTW_IMAGEMEMXFER _pData); - - /** - * get the Internal Image format. - * Called when a DG_IMAGE / DAT_IMAGENATIVEXFER / MSG_GET op is sent. - * also used when creating a BMP for saving when DG_IMAGE / DAT_IMAGEFILEXFER / MSG_GET op is sent. - * @param[out] _hImage a handle to store the image locaton. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 getDIBImage(TW_HANDLE &_hImage); - #ifdef TWNDS_OS_APPLE - /** - * MAC only - * get the Internal Image format. - * Called when a DG_IMAGE / DAT_IMAGENATIVEXFER / MSG_GET op is sent. - * also used when creating a BMP for saving when DG_IMAGE / DAT_IMAGEFILEXFER / MSG_GET op is sent. - * @param[out] _hImage a handle to store the image locaton. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 getPICTImage(TW_HANDLE &_hPICTImage); -#endif - /** - * Save the current image data as a BMP file - * @return a valid TWRC_xxxx return code, TWRC_XFERDONE on success. - */ - TW_INT16 saveImageFileAsBMP(); - - /** - * Save the current image data as a TIFF file - * @return a valid TWRC_xxxx return code, TWRC_XFERDONE on success. - */ - TW_INT16 saveImageFileAsTIFF(); - - /** - * Request the DSM that we are ready to send images. - * @return true if successful. - */ - virtual bool DoXferReadyEvent(); - - /** - * Request the DSM the most likly user clicks on the 揙K?button on GUI. - * @return true if successful. - */ - virtual bool DoCloseDSOkEvent(); - - /** - * Request the DSM that the Source抯 user interface be disabled. - * @return true if successful. - */ - virtual bool DoCloseDSRequestEvent(); - - /** - * Report to the DSM that a device event has occurred. - * @return true if successful. - */ - virtual bool DoDeviceEvent(); - - /** - * get the Internal Image format. For Linux Only - * Called when a DG_IMAGE / DAT_IMAGENATIVEXFER / MSG_GET op is sent. - * also used when creating a BMP for saving when DG_IMAGE / DAT_IMAGEFILEXFER / MSG_GET op is sent. - * @param[out] _hImage a handle to store the image locaton. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 getTIFFImage(TW_HANDLE &_hImage); - - // END Capabilities - /** - * @} - */ - - ////////////////////////////////////////////////////////////////////////////// - /** - * @name Accessors - * @{ - */ - - /** - * Returns the current condition code. - * @return a valid TWCC_xxxxxx condition code. - */ - virtual TW_INT16 getConditionCode() const; - - /** - * Sets the current condition code. - * @param[in] _cc a valid TWCC_xxxxxx condition code. - */ - virtual void setConditionCode(TW_INT16 _cc); - - /** - * Returns a pointer to our identity structure. - * @return pointer to out TW_IDENTITY identity structure. - */ - pTW_IDENTITY getIdentity(); - - /** - * Returns a pointer to the source application controlling us. - * @return pointer to TW_IDENTITY identity structure. - */ - pTW_IDENTITY getApp(); - - /** - * Returns the current state of the Data Source. - * @return a DS_State of the current state. - */ - DS_State getState() { return m_CurrentState; } - - /** - * This is a template class that will actually operate on the capability. - * It supports all valid CTWAINContainer types which are currently INTS, FIX32 and FRAME's. - * @param[in] _MSG the message - * @param[in] _pContainer the container type - * @param[in] _pCap the capability - * @return a valid TWRC_xxxx return code. - */ - template - TW_INT16 handleCap(TW_UINT16 _MSG, TWAINContainerType* _pContainer, pTW_CAPABILITY _pCap); - - /** - * Return a CTWAINContainer class of the capability. - * @param[in] _unCap the capability looking for - * @return the capability if found - */ - virtual CTWAINContainer* findCapability(const TW_UINT16 _unCap); - - /** - * if the CTWAINContainer is dependend on another Capabiltiy or settings. - * This function is used to get the data it needs. - * @param[in] _pContainer the container - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 updatePreDependencies(CTWAINContainer* _pContainer); - - /** - * Validate the value being used to set a capability. Ranges and enums can be tested - * by the capability but OneValues might have only some values that are acceptable. - * Override this function in base class to support more capabilities - * @param[in] Cap the Capability ID - * @param[in] ConType the container type - * @param[in] _pCap a pointer to BYTE. Pointer to Cap container - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 validateCapabilitySet(TW_UINT16 _Cap, TW_UINT16 _ConType, BYTE* _pContainer); - - /** - * Update Capability Container after the operation - * Override this function in base class to support more capabilities - * @param[in] _pCap the capability - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 updatePostContainer(pTW_CAPABILITY _pCap); - /** - * Update Capability Container before the operation - * Override this function in base class to support more capabilities - * @param[in] _pCap the capability - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 updatePreContainer(pTW_CAPABILITY _pCap); - - /** - * if the CTWAINContainer is dependend on another Capabiltiy. - * This function is used to get the data it needs. - * @param[in] MSG the message that was sent - * @param[in] Cap the Capability that it was sent to - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 updatePostDependencies(TW_UINT16 MSG, TW_UINT16 Cap); - - /** - * Update the frame to bewithin the constrains of the scanners Phyisical - * dimentions and minimum allowed sizes. - * @param[in out] _frame the frame to update. - * @return true if the frame is not change, false if changed. - */ - virtual bool ConstrainFrameToScanner(InternalFrame& _frame,bool &bConstrained); - - /** - * get the current unit and resolution. A helper function used by Unit dependent cap - * @param[out] Unit the current unit value. - * @param[out] Xres the current X resolution value. - * @param[out] Yres the current Y resolution value. - * @return a CTWAINContainer for the capability. - */ - TW_INT16 getCurrentUnits(int &Unit, float &Xres, float &Yres); - - /** - * Get Gustom DS data - * @param[out] _pDSData a pointer to a TW_CUSTOMDSDATA structure. - * @return a valid TWRC_xxxx return code, TWRC_SUCCESS on success. - */ - virtual TW_INT16 GetGustomDSData(pTW_CUSTOMDSDATA _pDSData); - - /** - * Set Gustom DS data - * @param[in] _pDSData a pointer to a TW_CUSTOMDSDATA structure. - * @return a valid TWRC_xxxx return code, TWRC_SUCCESS on success. - */ - virtual TW_INT16 SetGustomDSData(pTW_CUSTOMDSDATA _pDSData); - -// END Accessors - /** - * @} - */ - static TW_IDENTITY m_TheIdentity; /**< default Identity */ - -protected: - TWAINCapabilitiesMap m_IndependantCapMap; /**< Stores a list of all capacitites that each instance support. */ - - TW_INT16 m_DSConditionCode; /**< Current global condition. */ - TW_IDENTITY m_MyIdentity; /**< Detail information of our information.*/ - TW_IDENTITY m_App; /**< Detail information of the application source. */ - DS_State m_CurrentState; /**< Current state of the Data Source. */ - TW_STR255 m_CurFileExferName; /**< Current File Transfer Name. */ - TW_STR255 m_DefFileExferName; /**< Default File Transfer Name. */ - TW_IMAGEINFO m_ImageInfo; /**< Current Image Info data. */ - TW_UINT32 m_DocumentNumber; /**< Current Document Number */ - TW_UINT32 m_PageNumber; /**< Current Page Number */ - TW_PENDINGXFERS m_Xfers; /**< Number of Transfers remianing in this batch */ - DWORD m_nDestScanLine; /**< Current Scanline used for memory transfer */ - TW_HANDLE m_hImageData; /**< Handle to Current Image Data */ - -}; - -#endif // __CTWAINBASE_H__ - diff --git a/CTWAINDS_FreeImage.cpp b/CTWAINDS_FreeImage.cpp deleted file mode 100644 index 9e46a19..0000000 --- a/CTWAINDS_FreeImage.cpp +++ /dev/null @@ -1,2805 +0,0 @@ -/*************************************************************************** -* Copyright 锟 2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CTWAINDS_FreeImage.cpp -* The main Data Source class. -* This class is derived from the Base class describing a TWAIN DS. -* @author TWAIN Working Group -* @date April 2007 -*/ -#include "stdafx.h" -#include "CTWAINDS_FreeImage.h" -#include "TWAIN_UI.h" -#include - -#include -#include -#include -#include -#include -#include "PublicFunc.h" -#include "filetools.h" -#ifdef TWH_CMP_MSC -#include -#endif - -//#include "UI_INI.h" - -// I found that compiling using the sunfreeware.com stuff on Solaris 9 -// required this typedef. This is related to the inclusion of signal.h -#if defined (__SVR4) && defined (__sun) -typedef union { - long double _q; - uint32_t _l[4]; -} upad128_t; -#endif - -using namespace std; - -//* Initialize global identiy for this DS. */ -TW_IDENTITY CTWAINDS_Base::m_TheIdentity = -{ - 0, // TW_UINT32 Id; Unique number. In Windows, application hWnd - { // TW_VERSION Version; Identifies the piece of code - 2, // TW_UINT16 MajorNum; Major revision number of the software - 1, // TW_UINT16 MinorNum; Incremental revision number of the software - TWLG_ENGLISH, // TW_UINT16 Language; e.g. TWLG_SWISSFRENCH - TWCY_USA, // TW_UINT16 Country; e.g. TWCY_SWITZERLAND -#ifdef __APPLE__ - "\p" -#endif - "2.1.4 " // TW_STR32 Info; e.g. "1.0b3 Beta release" -#ifdef _DEBUG - " debug" -#else - " release" -#endif -#ifdef TWH_32BIT - " 32bit" -#else - " 64bit" -#endif - }, - 2, // TW_UINT16 ProtocolMajor; Application and DS must set to TWON_PROTOCOLMAJOR - 1, // TW_UINT16 ProtocolMinor; Application and DS must set to TWON_PROTOCOLMINOR - DG_IMAGE | DG_CONTROL | DF_DS2, // TW_UINT32 SupportedGroups; Bit field OR combination of DG_ constants -#ifdef __APPLE__ - "\p" -#endif - "HUAGOSCAN", // TW_STR32 Manufacturer; Manufacturer name, e.g. "Hewlett-Packard" -#ifdef __APPLE__ - "\p" -#endif - "HuaGoScan Hi Series", // TW_STR32 ProductFamily; Product family name, e.g. "ScanJet" -#ifdef __APPLE__ - "\p" -#endif - "HUAGOSCAN Hi-5100 TWAIN" // TW_STR32 ProductName; Product name, e.g. "ScanJet Plus" -}; - -////////////////////////////////////////////////////////////////////////////// -CTWAINDS_FreeImage::CTWAINDS_FreeImage(TW_IDENTITY AppID) : - m_pICAP_FRAMES(0) -{ - b_created = g_CreateSysMutex(); - m_AppID = AppID; - // Setup our identity - fillIdentityStructure(*getIdentity()); - m_pGUI = CreateUI(this); -} - -bool CTWAINDS_FreeImage::StoreCapInStream(stringstream &_DsData, TW_UINT16 _unCapID, TW_UINT16 _unCapIdx, TW_UINT16 unContType) -{ - CUST_DS_DATA_ELEMENT *pCapCon = (CUST_DS_DATA_ELEMENT*) new BYTE[sizeof(CUST_DS_DATA_ELEMENT)]; - CTWAINContainer *pCap = findCapability(_unCapID); - TW_UINT16 unType = pCap->GetItemType(); - pCapCon->unItemType = unType; - pCapCon->unCapID = _unCapID; - pCapCon->unCapIdx = _unCapIdx; - pCapCon->unContType = unContType; - pCapCon->dwSize = sizeof(CUST_DS_DATA_ELEMENT); - - if (unContType != TWON_ONEVALUE)//currentlly storing a single value - { - delete[]pCapCon; - return false; - } - - if (typeid(*pCap) == typeid(CTWAINContainerBool)) - { - - CTWAINContainerBool *pfBoolCap = (CTWAINContainerBool*)pCap; - bool bVal; - if (!pfBoolCap->GetCurrent(bVal)) - { - delete[]pCapCon; - return false; - } - pCapCon->dwVal[0] = bVal ? 1 : 0; - } - else if (typeid(*pCap) == typeid(CTWAINContainerInt)) - { - CTWAINContainerInt *pfIntCap = (CTWAINContainerInt*)pCap; - int nVal; - if (!pfIntCap->GetCurrent(nVal)) - { - delete[]pCapCon; - return false; - } - pCapCon->dwVal[0] = nVal; - } - else if (typeid(*pCap) == typeid(CTWAINContainerFix32)) - { - CTWAINContainerFix32 *pfFix32Cap = (CTWAINContainerFix32*)pCap; - float fVal; - if (!pfFix32Cap->GetCurrent(fVal)) - { - delete[]pCapCon; - return false; - } - *((float*)pCapCon->dwVal) = fVal; - } - else if (typeid(*pCap) == typeid(CTWAINContainerFix32Range)) - { - CTWAINContainerFix32Range *pfFix32Cap = (CTWAINContainerFix32Range*)pCap; - float fVal; - if (!pfFix32Cap->GetCurrent(fVal)) - { - delete[]pCapCon; - return false; - } - *((float*)pCapCon->dwVal) = fVal; - } - else if (typeid(*pCap) == typeid(CTWAINContainerFrame)) - { - - CTWAINContainerFrame *pfFrameCap = (CTWAINContainerFrame*)pCap; - InternalFrame frmVal; - if (!pfFrameCap->GetCurrent(frmVal)) - { - delete[]pCapCon; - return false; - } - CUST_DS_DATA_ELEMENT *pCapCon1 = (CUST_DS_DATA_ELEMENT*) new BYTE[sizeof(CUST_DS_DATA_ELEMENT) + (4 * sizeof(int) - sizeof(DWORD))]; - *pCapCon1 = *pCapCon; - delete[]pCapCon; - pCapCon = pCapCon1; - pCapCon->dwSize += (4 * sizeof(int) - sizeof(DWORD)); - pCapCon->dwVal[0] = frmVal.nBottom; - pCapCon->dwVal[1] = frmVal.nLeft; - pCapCon->dwVal[2] = frmVal.nRight; - pCapCon->dwVal[3] = frmVal.nTop; - } - else - { - delete[]pCapCon; - return false; - } - - _DsData.write((char*)pCapCon, pCapCon->dwSize); - delete[]pCapCon; - return true; -} - -bool CTWAINDS_FreeImage::ReadCapFromStream(stringstream &_DsData, TW_UINT16 _unCapID, TW_UINT16 _unCapIdx) -{ - _DsData.seekg(0, ios_base::beg); - DWORD dwSize = sizeof(CUST_DS_DATA_ELEMENT); - CUST_DS_DATA_ELEMENT *pCapCon = (CUST_DS_DATA_ELEMENT*) new BYTE[dwSize]; - pCapCon->unCapID = -1; - pCapCon->unCapIdx = -1; - pCapCon->dwSize = 0; - while (!_DsData.eof() && (pCapCon->unCapID != _unCapID || pCapCon->unCapIdx != _unCapIdx)) - { - _DsData.read((char*)pCapCon, sizeof(CUST_DS_DATA_ELEMENT)); - if (!_DsData.eof() && pCapCon->dwSize > sizeof(CUST_DS_DATA_ELEMENT)) - { - if (pCapCon->dwSize > dwSize) - { - BYTE *pTemp = new BYTE[pCapCon->dwSize]; - memcpy(pTemp, pCapCon, sizeof(CUST_DS_DATA_ELEMENT)); - delete[]pCapCon; - pCapCon = (CUST_DS_DATA_ELEMENT*)pTemp; - dwSize = pCapCon->dwSize; - } - _DsData.read((char*)pCapCon + sizeof(CUST_DS_DATA_ELEMENT), pCapCon->dwSize - sizeof(CUST_DS_DATA_ELEMENT)); - } - } - - if (pCapCon->unCapID != _unCapID || pCapCon->unCapIdx != _unCapIdx) - { - delete[]pCapCon; - return false; - } - CTWAINContainer *pCap = findCapability(_unCapID); - TW_UINT16 unType = pCap->GetItemType(); - if (unType != pCapCon->unItemType) - { - delete[]pCapCon; - return false; - } - - if (pCapCon->unContType != TWON_ONEVALUE)//currentlly storing a single value - { - delete[]pCapCon; - return false; - } - - bool bRes = true; - TW_ONEVALUE conVal; - conVal.ItemType = pCapCon->unItemType; - conVal.Item = pCapCon->dwVal[0]; - if (typeid(*pCap) == typeid(CTWAINContainerBool)) - { - bRes = validateCapabilitySet(_unCapID, TWON_ONEVALUE, (BYTE*)&conVal) != TWRC_FAILURE; - if (bRes) - { - CTWAINContainerBool *pfBoolCap = (CTWAINContainerBool*)pCap; - bRes = pfBoolCap->SetCurrent(pCapCon->dwVal[0] != 0); - } - } - else if (typeid(*pCap) == typeid(CTWAINContainerInt)) - { - bRes = validateCapabilitySet(_unCapID, TWON_ONEVALUE, (BYTE*)&conVal) != TWRC_FAILURE; - if (bRes) - { - CTWAINContainerInt *pfIntCap = (CTWAINContainerInt*)pCap; - bRes = pfIntCap->SetCurrent(pCapCon->dwVal[0]); - } - } - else if (typeid(*pCap) == typeid(CTWAINContainerFix32)) - { - bRes = validateCapabilitySet(_unCapID, TWON_ONEVALUE, (BYTE*)&conVal) != TWRC_FAILURE; - if (bRes) - { - CTWAINContainerFix32 *pfFix32Cap = (CTWAINContainerFix32*)pCap; - bRes = pfFix32Cap->SetCurrent(*(float*)pCapCon->dwVal); - } - } - else if (typeid(*pCap) == typeid(CTWAINContainerFix32Range)) - { - bRes = validateCapabilitySet(_unCapID, TWON_ONEVALUE, (BYTE*)&conVal) != TWRC_FAILURE; - if (bRes) - { - CTWAINContainerFix32Range *pfFix32Cap = (CTWAINContainerFix32Range*)pCap; - bRes = pfFix32Cap->SetCurrent(*(float*)pCapCon->dwVal); - } - } - else if (typeid(*pCap) == typeid(CTWAINContainerFrame)) - { - InternalFrame frmVal; - frmVal.nBottom = pCapCon->dwVal[0]; - frmVal.nLeft = pCapCon->dwVal[1]; - frmVal.nRight = pCapCon->dwVal[2]; - frmVal.nTop = pCapCon->dwVal[3]; - bool bConstrained; - ConstrainFrameToScanner(frmVal, bConstrained); - CTWAINContainerFrame *pfFrameCap = (CTWAINContainerFrame*)pCap; - bRes = pfFrameCap->Set(frmVal); - } - else - { - bRes = false; - } - - delete[]pCapCon; - return bRes; -} - -bool CTWAINDS_FreeImage::StoreCustomDSdata(stringstream &DsData) -{ - bool bResult = true; - bResult = bResult && StoreCapInStream(DsData, CAP_FEEDERENABLED, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, CAP_DUPLEXENABLED, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, CAP_AUTOFEED, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_BITDEPTH, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_BITORDER, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_COMPRESSION, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_FRAMES, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_IMAGEFILEFORMAT, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_PIXELFLAVOR, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_PIXELTYPE, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_PLANARCHUNKY, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_SUPPORTEDSIZES, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_ORIENTATION, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_UNITS, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_XRESOLUTION, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_YRESOLUTION, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_THRESHOLD, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_CONTRAST, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_BRIGHTNESS, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, ICAP_GAMMA, 0, TWON_ONEVALUE); - bResult = bResult && StoreCapInStream(DsData, CUSTCAP_LONGDOCUMENT, 0, TWON_ONEVALUE); - return bResult; -} - -bool CTWAINDS_FreeImage::ReadCustomDSdata(stringstream &DsData) -{ - // When adding to Capabiltiy remember the order of operations - // Some capabilities are dependent on others. - // see: http://www.twain.org/docs/CapOrderForWeb.PDF - bool bResult = true; - bResult = bResult && ReadCapFromStream(DsData, CUSTCAP_LONGDOCUMENT, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_BITORDER, 0); - bResult = bResult && ReadCapFromStream(DsData, CAP_FEEDERENABLED, 0); - bResult = bResult && ReadCapFromStream(DsData, CAP_DUPLEXENABLED, 0); - bResult = bResult && ReadCapFromStream(DsData, CAP_AUTOFEED, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_UNITS, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_PIXELTYPE, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_BITDEPTH, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_XRESOLUTION, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_YRESOLUTION, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_PIXELFLAVOR, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_PLANARCHUNKY, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_THRESHOLD, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_IMAGEFILEFORMAT, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_COMPRESSION, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_CONTRAST, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_BRIGHTNESS, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_GAMMA, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_SUPPORTEDSIZES, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_ORIENTATION, 0); - bResult = bResult && ReadCapFromStream(DsData, ICAP_FRAMES, 0); - return bResult; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::Initialize() -{ - // When adding to Capabiltiy remember the order of operations - // Some capabilities are dependent on others. - // see: http://www.twain.org/docs/CapOrderForWeb.PDF - - // setup the supported independant caps - CTWAINContainerInt* pnCap = 0; - CTWAINContainerBool* pbCap = 0; - CTWAINContainerString* pstrCap = 0; - CTWAINContainerFix32* pfixCap = 0; - - m_IndependantCapMap[CAP_SUPPORTEDCAPS] = new CTWAINContainerInt(CAP_SUPPORTEDCAPS, TWTY_UINT16, TWON_ARRAY, TWQC_GETS, TWON_ARRAY, TWON_ARRAY); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[CAP_SUPPORTEDCAPS])) - || !pnCap->Add(CAP_DEVICEONLINE) - || !pnCap->Add(CAP_INDICATORS) - || !pnCap->Add(CAP_ENABLEDSUIONLY) - || !pnCap->Add(CAP_PAPERDETECTABLE) - || !pnCap->Add(CAP_FEEDERENABLED) - || !pnCap->Add(CAP_FEEDERLOADED) - || !pnCap->Add(CAP_DUPLEX) - || !pnCap->Add(CAP_DUPLEXENABLED) - || !pnCap->Add(CAP_AUTOFEED) - || !pnCap->Add(CAP_SUPPORTEDCAPS) - || !pnCap->Add(CAP_UICONTROLLABLE) - || !pnCap->Add(CAP_XFERCOUNT) - || !pnCap->Add(ICAP_BITDEPTH) - || !pnCap->Add(ICAP_BITORDER) - || !pnCap->Add(ICAP_COMPRESSION) - || !pnCap->Add(ICAP_FRAMES) - || !pnCap->Add(ICAP_MAXFRAMES) - || !pnCap->Add(ICAP_IMAGEFILEFORMAT) - || !pnCap->Add(ICAP_PHYSICALHEIGHT) - || !pnCap->Add(ICAP_PHYSICALWIDTH) - || !pnCap->Add(ICAP_PIXELFLAVOR) - || !pnCap->Add(ICAP_PIXELTYPE) - || !pnCap->Add(ICAP_PLANARCHUNKY) - || !pnCap->Add(ICAP_SUPPORTEDSIZES) - || !pnCap->Add(ICAP_ORIENTATION) - || !pnCap->Add(ICAP_UNITS) - || !pnCap->Add(ICAP_XFERMECH) - || !pnCap->Add(ICAP_XRESOLUTION) - || !pnCap->Add(ICAP_YRESOLUTION) - || !pnCap->Add(ICAP_THRESHOLD) - || !pnCap->Add(ICAP_CONTRAST) - || !pnCap->Add(ICAP_BRIGHTNESS) - || !pnCap->Add(ICAP_GAMMA) - || !pnCap->Add(CAP_CUSTOMINTERFACEGUID) - || !pnCap->Add(CUSTCAP_LONGDOCUMENT) - || !pnCap->Add(CUSTCAP_DOCS_IN_ADF) - || !pnCap->Add(CAP_CUSTOMDSDATA) - - //鍚庡姞 - || !pnCap->Add(CAP_SERIALNUMBER) - || !pnCap->Add(0x8025)//鍥轰欢鐗堟湰鍙 - || !pnCap->Add(ICAP_AUTOMATICCROPUSESFRAME)//鑷姩瑁佸垏 - || !pnCap->Add(ICAP_AUTODISCARDBLANKPAGES)//鑷姩涓㈠純绌虹櫧椤 - || !pnCap->Add(ICAP_AUTOMATICCOLORENABLED)//鑷姩棰滆壊璇嗗埆 - || !pnCap->Add(ICAP_AUTOBRIGHT)//鑷姩浜害 - || !pnCap->Add(ICAP_AUTOMATICDESKEW)//鑷姩绾犲亸 - || !pnCap->Add(ICAP_FILTER)//闄よ壊 - || !pnCap->Add(0x8005)//鑳岄潰鏃嬭浆180 - || !pnCap->Add(0x8004)//濉厖榛戞 - || !pnCap->Add(0x8018)//鍘婚櫎绌垮瓟 - || !pnCap->Add(0x8026)//澶氭祦闄ょ孩 - || !pnCap->Add(0x8092)//鍘婚櫎绌垮瓟鎵鍗犲箙闈㈠崰姣 - - //纭欢鍗忚 - || !pnCap->Add(0x8006)//姝枩妫娴 - || !pnCap->Add(0x8021)//姝枩绋嬪害 - || !pnCap->Add(CAP_DOUBLEFEEDDETECTION)//鍙屽紶妫娴 - || !pnCap->Add(0x8090)//瑁呰妫娴 - || !pnCap->Add(0x8091)//鑷姩涓㈠純绌虹櫧椤碉紙鍙戠エ锛 - - ) - { - cerr << "Could not create CAP_SUPPORTEDCAPS" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[ICAP_COMPRESSION] = new CTWAINContainerInt(ICAP_COMPRESSION, TWTY_UINT16, TWON_ENUMERATION); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[ICAP_COMPRESSION])) - || !pnCap->Add(TWCP_NONE, true)) - { - cerr << "Could not create ICAP_COMPRESSION" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[ICAP_PLANARCHUNKY] = new CTWAINContainerInt(ICAP_PLANARCHUNKY, TWTY_UINT16, TWON_ENUMERATION); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[ICAP_PLANARCHUNKY])) - || !pnCap->Add(TWPC_CHUNKY, true)) - /// @todo support TWPC_PLANAR - // || !pnCap->Add(TWPC_PLANAR) - { - cerr << "Could not create ICAP_PLANARCHUNKY" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[ICAP_UNITS] = new CTWAINContainerInt(ICAP_UNITS, TWTY_UINT16, TWON_ENUMERATION); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[ICAP_UNITS])) - || !pnCap->Add(TWUN_INCHES, true) - || !pnCap->Add(TWUN_PIXELS) - || !pnCap->Add(TWUN_CENTIMETERS) - || !pnCap->Add(TWUN_PICAS) - || !pnCap->Add(TWUN_POINTS) - || !pnCap->Add(TWUN_TWIPS)) - { - cerr << "Could not create ICAP_UNITS" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[ICAP_XFERMECH] = new CTWAINContainerInt(ICAP_XFERMECH, TWTY_UINT16, TWON_ONEVALUE); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[ICAP_XFERMECH])) - || !pnCap->Add(TWSX_FILE) - || !pnCap->Add(TWSX_MEMORY) - || !pnCap->Add(TWSX_NATIVE, true) - ) - { - cerr << "Could not create ICAP_XFERMECH" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[ICAP_PIXELTYPE] = new CTWAINContainerInt(ICAP_PIXELTYPE, TWTY_UINT16, TWON_ENUMERATION); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[ICAP_PIXELTYPE])) - || !pnCap->Add(TWPT_BW) - || !pnCap->Add(TWPT_GRAY) - || !pnCap->Add(TWPT_RGB, true)) - { - cerr << "Could not create ICAP_PIXELTYPE" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CAP_UICONTROLLABLE] = new CTWAINContainerBool(CAP_UICONTROLLABLE, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_GETS); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[CAP_UICONTROLLABLE])) - || !pbCap->Add(TRUE, true)) - { - cerr << "Could not create CAP_UICONTROLLABLE" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CAP_ENABLEDSUIONLY] = new CTWAINContainerBool(CAP_ENABLEDSUIONLY, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_GETS); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[CAP_ENABLEDSUIONLY])) - || !pbCap->Add(TRUE, true)) - { - cerr << "Could not create CAP_ENABLEDSUIONLY" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CAP_XFERCOUNT] = new CTWAINContainerInt(CAP_XFERCOUNT, TWTY_INT16, TWON_ONEVALUE); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[CAP_XFERCOUNT])) - || !pnCap->Add(TWON_DONTCARE32, true)) - { - cerr << "Could not create CAP_XFERCOUNT" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[ICAP_BITORDER] = new CTWAINContainerInt(ICAP_BITORDER, TWTY_UINT16, TWON_ENUMERATION); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[ICAP_BITORDER])) - || !pnCap->Add(TWBO_LSBFIRST, true) - || !pnCap->Add(TWBO_MSBFIRST)) - { - cerr << "Could not create ICAP_BITORDER" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[ICAP_IMAGEFILEFORMAT] = new CTWAINContainerInt(ICAP_IMAGEFILEFORMAT, TWTY_UINT16, TWON_ENUMERATION); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[ICAP_IMAGEFILEFORMAT])) - || !pnCap->Add(TWFF_BMP, true) - || !pnCap->Add(TWFF_TIFF)) - { - cerr << "Could not create ICAP_IMAGEFILEFORMAT" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - SSTRCPY(m_CurFileExferName, sizeof(m_CurFileExferName), "sample.bmp"); - SSTRCPY(m_DefFileExferName, sizeof(m_DefFileExferName), "sample.bmp"); - - m_IndependantCapMap[ICAP_PIXELFLAVOR] = new CTWAINContainerInt(ICAP_PIXELFLAVOR, TWTY_UINT16, TWON_ENUMERATION); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[ICAP_PIXELFLAVOR])) - || !pnCap->Add(TWPF_CHOCOLATE, true)) - { - cerr << "Could not create ICAP_PIXELFLAVOR" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - //TWSS_B5 - //鏂囩ǹ绫诲瀷 - m_IndependantCapMap[ICAP_SUPPORTEDSIZES] = new CTWAINContainerInt(ICAP_SUPPORTEDSIZES, TWTY_UINT16, TWON_ENUMERATION); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[ICAP_SUPPORTEDSIZES])) - //|| !pnCap->Add(TWSS_NONE) - || !pnCap->Add(TWSS_A3) - || !pnCap->Add(TWSS_A4, true) - || !pnCap->Add(60)//A4R - || !pnCap->Add(TWSS_A5) - || !pnCap->Add(61)//A5R - || !pnCap->Add(TWSS_A6) - || !pnCap->Add(62)//A6R - || !pnCap->Add(TWSS_B4) - || !pnCap->Add(2)//B5 - || !pnCap->Add(70)//B5R - || !pnCap->Add(7)//B6 - || !pnCap->Add(71)//B6妯悜 - || !pnCap->Add(TWSS_USLETTER) - || !pnCap->Add(80)//LETTER妯悜 - || !pnCap->Add(81)//Double LetterR - || !pnCap->Add(TWSS_USLEGAL) - || !pnCap->Add(90)//鑷姩瑁佸垏 - || !pnCap->Add(91))//闀挎枃绋 - { - cerr << "Could not create ICAP_SUPPORTEDSIZES" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - //鍥惧儚鏃嬭浆 - m_IndependantCapMap[ICAP_ORIENTATION] = new CTWAINContainerInt(ICAP_ORIENTATION, TWTY_UINT16, TWON_ONEVALUE); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[ICAP_ORIENTATION])) - || !pnCap->Add(TWOR_PORTRAIT, true) - || !pnCap->Add(TWOR_ROT90) - || !pnCap->Add(TWOR_ROT180) - || !pnCap->Add(TWOR_ROT270) - || !pnCap->Add(TWOR_AUTOTEXT)) - { - cerr << "Could not create ICAP_ORIENTATION" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CAP_DEVICEONLINE] = new CTWAINContainerBool(CAP_DEVICEONLINE, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_GETS); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[CAP_DEVICEONLINE])) - || !pbCap->Add(TRUE, true) - || !pbCap->Add(FALSE)) - { - cerr << "Could not create CAP_DEVICEONLINE" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CAP_INDICATORS] = new CTWAINContainerBool(CAP_INDICATORS, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[CAP_INDICATORS])) - || !pbCap->Add(TRUE, true) - || !pbCap->Add(FALSE)) - { - cerr << "Could not create CAP_INDICATORS" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[ICAP_MAXFRAMES] = new CTWAINContainerInt(ICAP_MAXFRAMES, TWTY_UINT16, TWON_ONEVALUE, TWQC_ALL); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[ICAP_MAXFRAMES])) - || !pnCap->Add(1, true)) - { - cerr << "Could not create ICAP_MAXFRAMES" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CAP_FEEDERENABLED] = new CTWAINContainerBool(CAP_FEEDERENABLED, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[CAP_FEEDERENABLED])) - || !pbCap->Add(FALSE) - || !pbCap->Add(TRUE, true)) - { - cerr << "Could not create CAP_FEEDERENABLED" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CAP_DUPLEX] = new CTWAINContainerInt(CAP_DUPLEX, TWTY_UINT16, TWON_ONEVALUE, TWQC_GETS); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[CAP_DUPLEX])) - || !pnCap->Add(TWDX_1PASSDUPLEX, true)) - { - cerr << "Could not create CAP_DUPLEX" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CAP_DUPLEXENABLED] = new CTWAINContainerBool(CAP_DUPLEXENABLED, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[CAP_DUPLEXENABLED])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create CAP_DUPLEXENABLED" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - m_IndependantCapMap[CAP_FEEDERLOADED] = new CTWAINContainerBool(CAP_FEEDERLOADED, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_GETS); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[CAP_FEEDERLOADED])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create CAP_FEEDERLOADED" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CAP_AUTOFEED] = new CTWAINContainerBool(CAP_AUTOFEED, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[CAP_AUTOFEED])) - || !pbCap->Add(TRUE, true) - || !pbCap->Add(FALSE)) - { - cerr << "Could not create CAP_AUTOFEED" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CAP_PAPERDETECTABLE] = new CTWAINContainerBool(CAP_PAPERDETECTABLE, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_GETS); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[CAP_PAPERDETECTABLE])) - || !pbCap->Add(TRUE, true)) - { - cerr << "Could not create CAP_PAPERDETECTABLE" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CUSTCAP_LONGDOCUMENT] = new CTWAINContainerBool(CUSTCAP_LONGDOCUMENT, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[CUSTCAP_LONGDOCUMENT])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create CUSTCAP_LONGDOCUMENT" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CUSTCAP_DOCS_IN_ADF] = new CTWAINContainerInt(CUSTCAP_DOCS_IN_ADF, TWTY_UINT16, TWON_ONEVALUE, TWQC_ALL); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[CUSTCAP_DOCS_IN_ADF])) - || !pnCap->Add(m_Scanner.GetMaxPagesInADF())) - { - cerr << "Could not create CUSTCAP_DOCS_IN_ADF" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CAP_CUSTOMDSDATA] = new CTWAINContainerBool(CAP_CUSTOMDSDATA, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_GETS); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[CAP_CUSTOMDSDATA])) - || !pbCap->Add(TRUE, true)) - { - cerr << "Could not create CAP_CUSTOMDSDATA" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - // setup dependant caps - if (NULL == (m_BitDepthMap[TWPT_BW] = new CTWAINContainerInt(ICAP_BITDEPTH, TWTY_UINT16, TWON_ONEVALUE)) - || !m_BitDepthMap[TWPT_BW]->Add(1, true)) - { - cerr << "Could not create ICAP_BITDEPTH" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - if (NULL == (m_BitDepthMap[TWPT_GRAY] = new CTWAINContainerInt(ICAP_BITDEPTH, TWTY_UINT16, TWON_ONEVALUE)) - || !m_BitDepthMap[TWPT_GRAY]->Add(8, true)) - { - cerr << "Could not create ICAP_BITDEPTH" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - if (NULL == (m_BitDepthMap[TWPT_RGB] = new CTWAINContainerInt(ICAP_BITDEPTH, TWTY_UINT16, TWON_ONEVALUE)) - || !m_BitDepthMap[TWPT_RGB]->Add(24, true)) - { - cerr << "Could not create ICAP_BITDEPTH" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - m_IndependantCapMap[CAP_CUSTOMINTERFACEGUID] = new CTWAINContainerString(CAP_CUSTOMINTERFACEGUID, TWTY_STR255, TWON_ONEVALUE, TWQC_GETS); - if (NULL == (pstrCap = dynamic_cast(m_IndependantCapMap[CAP_CUSTOMINTERFACEGUID])) - || !pstrCap->Add(kCUSTOMDSGUI, true)) - { - cerr << "Could not create CAP_CUSTOMINTERFACEGUID" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - FLOAT_RANGE fRange; - fRange.fCurrentValue = 10.0f; - fRange.fMaxValue = 50.0f; - fRange.fMinValue = 0.0f; - fRange.fStepSize = 1.0f; - m_IndependantCapMap[ICAP_GAMMA] = new CTWAINContainerFix32Range(ICAP_GAMMA, fRange, TWQC_ALL); - if (NULL == dynamic_cast(m_IndependantCapMap[ICAP_GAMMA])) - { - cerr << "Could not create ICAP_GAMMA" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - fRange.fCurrentValue = 128.0f; - fRange.fMaxValue = 255.0f; - fRange.fMinValue = 0.0f; - fRange.fStepSize = 1.0f; - m_IndependantCapMap[ICAP_THRESHOLD] = new CTWAINContainerFix32Range(ICAP_THRESHOLD, fRange, TWQC_ALL); - if (NULL == dynamic_cast(m_IndependantCapMap[ICAP_THRESHOLD])) - { - cerr << "Could not create ICAP_THRESHOLD" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - fRange.fCurrentValue = 0.0f; - fRange.fMaxValue = 1000.0f; - fRange.fMinValue = -1000.0f; - fRange.fStepSize = 1.0f; - m_IndependantCapMap[ICAP_CONTRAST] = new CTWAINContainerFix32Range(ICAP_CONTRAST, fRange, TWQC_ALL); - if (NULL == dynamic_cast(m_IndependantCapMap[ICAP_CONTRAST])) - { - cerr << "Could not create ICAP_CONTRAST" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - fRange.fCurrentValue = 0.0f; - fRange.fMaxValue = 1000.0f; - fRange.fMinValue = -1000.0f; - fRange.fStepSize = 1.0f; - m_IndependantCapMap[ICAP_BRIGHTNESS] = new CTWAINContainerFix32Range(ICAP_BRIGHTNESS, fRange, TWQC_ALL); - if (NULL == dynamic_cast(m_IndependantCapMap[ICAP_BRIGHTNESS])) - { - cerr << "Could not create ICAP_BRIGHTNESS" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - // expressed internally as pixels per inch - m_IndependantCapMap[ICAP_XRESOLUTION] = new CTWAINContainerFix32(ICAP_XRESOLUTION, TWON_ONEVALUE, TWQC_ALL); - if (NULL == (pfixCap = dynamic_cast(m_IndependantCapMap[ICAP_XRESOLUTION])) - //|| !pfixCap->Add(50) - || !pfixCap->Add(100.0f) - || !pfixCap->Add(150.0f) - || !pfixCap->Add(200.0f, true) - || !pfixCap->Add(240.0f) - || !pfixCap->Add(300.0f)) - //|| !pfixCap->Add(500) - //|| !pfixCap->Add(600)) - { - cerr << "Could not create ICAP_XRESOLUTION" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - // expressed internally as pixels per inch - m_IndependantCapMap[ICAP_YRESOLUTION] = new CTWAINContainerFix32(ICAP_YRESOLUTION, TWON_ONEVALUE, TWQC_ALL); - if (NULL == (pfixCap = dynamic_cast(m_IndependantCapMap[ICAP_YRESOLUTION])) - //|| !pfixCap->Add(50) - || !pfixCap->Add(100.0f) - || !pfixCap->Add(150.0f) - || !pfixCap->Add(200.0f, true) - || !pfixCap->Add(240.0f) - || !pfixCap->Add(300.0f)) - //|| !pfixCap->Add(500) - //|| !pfixCap->Add(600)) - { - cerr << "Could not create ICAP_YRESOLUTION" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - // expressed internally as 1000 pixels per inch - /// @todo Get physical dimentions from scanner - /// @todo Add seperate dimentions for ADF and Flatbed - // Flatbed - A4 letter paper - // ConvertUnits(29.7f, TWUN_CENTIMETERS, TWUN_INCHES, 1000); - // ConvertUnits(21.0f, TWUN_CENTIMETERS, TWUN_INCHES, 1000); - if (NULL == (m_IndependantCapMap[ICAP_PHYSICALWIDTH] = new CTWAINContainerFix32(ICAP_PHYSICALWIDTH, TWON_ONEVALUE, TWQC_GETS)) - || !(dynamic_cast(m_IndependantCapMap[ICAP_PHYSICALWIDTH]))->Add(8.5, true)) - { - cerr << "Could not create ICAP_PHYSICALWIDTH" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - if (NULL == (m_IndependantCapMap[ICAP_PHYSICALHEIGHT] = new CTWAINContainerFix32(ICAP_PHYSICALHEIGHT, TWON_ONEVALUE, TWQC_GETS)) - || !(dynamic_cast(m_IndependantCapMap[ICAP_PHYSICALHEIGHT]))->Add(14.0, true)) - { - cerr << "Could not create ICAP_PHYSICALHEIGHT" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - // setup the ICAP_FRAMES - // expressed internally as 1000 pixels per inch - // Currently only supports one frame see: ICAP_MAXFRAMES - if (NULL == (m_pICAP_FRAMES = new CTWAINContainerFrame(ICAP_FRAMES, TWON_ENUMERATION, TWQC_ALL)) - || !m_pICAP_FRAMES->Add(0, 0, 2338, 3307, true) - //|| !m_pICAP_FRAMES->Add(0, 0, 1653, 2338) - //|| !m_pICAP_FRAMES->Add(0, 0, 2338, 1653) - //|| !m_pICAP_FRAMES->Add(0, 0, 1165, 1653) - //|| !m_pICAP_FRAMES->Add(0, 0, 1653, 1165) - //|| !m_pICAP_FRAMES->Add(0, 0, 826, 1165) - //|| !m_pICAP_FRAMES->Add(0, 0, 1165, 826) - //|| !m_pICAP_FRAMES->Add(0, 0, 2023, 2866) - //|| !m_pICAP_FRAMES->Add(0, 0, 1433, 2023) - //|| !m_pICAP_FRAMES->Add(0, 0, 2203, 1433) - //|| !m_pICAP_FRAMES->Add(0, 0, 1007, 1433) - //|| !m_pICAP_FRAMES->Add(0, 0, 1433, 1007) - //|| !m_pICAP_FRAMES->Add(0, 0, 1700, 2200) - //|| !m_pICAP_FRAMES->Add(0, 0, 2200, 1700) - //|| !m_pICAP_FRAMES->Add(0, 0, 2200, 3400) - //|| !m_pICAP_FRAMES->Add(0, 0, 1700, 2800) - //|| !m_pICAP_FRAMES->Add(0, 0, 2338, 3307) - //|| !m_pICAP_FRAMES->Add(0, 0, 2338, 6614) - ) - { - cerr << "Could not create ICAP_FRAMES" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - int unit; - float Xres, Yres; - if (getCurrentUnits(unit, Xres, Yres) == TWRC_SUCCESS) - { - m_pICAP_FRAMES->setCurrentUnits(unit, Xres, Yres); - } - else - { - cerr << "Could not getCurrentUnits" << endl; - setConditionCode(TWCC_BUMMER); - return TWRC_FAILURE; - } - - - /*涓涓嬩负鍚庡姞鍗忚 2018-11-15 ByPeng*/ - //鎵弿浠簭鍒楀彿 - m_IndependantCapMap[CAP_SERIALNUMBER] = new CTWAINContainerString(CAP_SERIALNUMBER, TWTY_STR255, TWON_ONEVALUE, TWQC_GETS); - if (NULL == (pstrCap = dynamic_cast(m_IndependantCapMap[CAP_SERIALNUMBER])) - || !pstrCap->Add("G20018000000", true))//m_Scanner.getSerialNum() - { - cerr << "Could not create CAP_SERIALNUMBER" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - - //鎵弿浠浐浠剁増鏈彿 - m_IndependantCapMap[0x8025] = new CTWAINContainerString(0x8025, TWTY_STR255, TWON_ONEVALUE, TWQC_GETS); - if (NULL == (pstrCap = dynamic_cast(m_IndependantCapMap[0x8025])) - || !pstrCap->Add("51000000", true)) - { - cerr << "Could not create Get FWVersion" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //鑷姩瑁佸垏 - m_IndependantCapMap[ICAP_AUTOMATICCROPUSESFRAME] = new CTWAINContainerBool(ICAP_AUTOMATICCROPUSESFRAME, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[ICAP_AUTOMATICCROPUSESFRAME])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create ICAP_AUTOMATICCROPUSESFRAME" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //鑷姩涓㈠純绌虹櫧椤碉紙閫氱敤锛 - m_IndependantCapMap[ICAP_AUTODISCARDBLANKPAGES] = new CTWAINContainerBool(ICAP_AUTODISCARDBLANKPAGES, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[ICAP_AUTODISCARDBLANKPAGES])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create ICAP_AUTODISCARDBLANKPAGES" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //鑷姩涓㈠純绌虹櫧椤碉紙鍙戠エ锛 - m_IndependantCapMap[0x8091] = new CTWAINContainerBool(0x8091, TWON_ONEVALUE, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[0x8091])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create 鍙戠エ" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //濉厖榛戞 - m_IndependantCapMap[0x8004] = new CTWAINContainerBool(0x8004, TWON_ONEVALUE, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[0x8004])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create ICAP_AUTODISCARDBLANKPAGES" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //鑷姩棰滆壊璇嗗埆 - m_IndependantCapMap[ICAP_AUTOMATICCOLORENABLED] = new CTWAINContainerBool(ICAP_AUTOMATICCOLORENABLED, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[ICAP_AUTOMATICCOLORENABLED])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create ICAP_AUTOMATICCOLORENABLED" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //鑷姩浜害 - m_IndependantCapMap[ICAP_AUTOBRIGHT] = new CTWAINContainerBool(ICAP_AUTOBRIGHT, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[ICAP_AUTOBRIGHT])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create ICAP_AUTOBRIGHT" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //鑷姩绾犲亸 - m_IndependantCapMap[ICAP_AUTOMATICDESKEW] = new CTWAINContainerBool(ICAP_AUTOMATICDESKEW, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[ICAP_AUTOMATICDESKEW])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create ICAP_AUTOMATICDESKEW" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //闄よ壊涓庨鑹插寮 - m_IndependantCapMap[ICAP_FILTER] = new CTWAINContainerInt(ICAP_FILTER, TWTY_UINT16, TWON_ONEVALUE); - if (NULL == (pnCap = dynamic_cast(m_IndependantCapMap[ICAP_FILTER])) - || !pnCap->Add(0, true)//涓嶉櫎鑹 - || !pnCap->Add(1)//闄ょ孩鑹 - || !pnCap->Add(2)//闄ょ豢鑹 - || !pnCap->Add(3)//闄よ摑鑹 - || !pnCap->Add(4)//绾㈣壊澧炲己 - || !pnCap->Add(5)//缁胯壊澧炲己 - || !pnCap->Add(6))//钃濊壊澧炲己 - //|| !pfixCap->Add(7))//鑷畾涔夐鑹插寮 - { - cerr << "Could not create ICAP_FILTER" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //鑳岄潰鏃嬭浆180 - m_IndependantCapMap[0x8005] = new CTWAINContainerBool(0x8005, TWON_ONEVALUE, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[0x8005])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create Bcak Flip 180 Dgr" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //鍘婚櫎绌垮瓟 - m_IndependantCapMap[0x8018] = new CTWAINContainerBool(0x8018, TWON_ONEVALUE, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[0x8018])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create OutHole" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //鍘婚櫎绌垮瓟鍗犲箙闈㈡瘮渚 - fRange.fCurrentValue = 10.0f; - fRange.fMaxValue = 50.0f; - fRange.fMinValue = 1.0f; - fRange.fStepSize = 1.0f; - m_IndependantCapMap[0x8092] = new CTWAINContainerFix32Range(0x8092, fRange, TWQC_ALL); - if (NULL == dynamic_cast(m_IndependantCapMap[0x8092])) - { - cerr << "Could not create Outhole ration" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //姝枩妫娴 - m_IndependantCapMap[0x8006] = new CTWAINContainerBool(0x8006, TWON_ONEVALUE, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[0x8006])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create Skew DETECT" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //姝枩妫娴嬭寖鍥 - fRange.fCurrentValue = 3.0f; - fRange.fMaxValue = 5.0f; - fRange.fMinValue = 1.0f; - fRange.fStepSize = 1.0f; - m_IndependantCapMap[0x8021] = new CTWAINContainerFix32Range(0x8021, fRange, TWQC_ALL); - if (NULL == dynamic_cast(m_IndependantCapMap[0x8021])) - { - cerr << "Could not create CAP Skew Range" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //鍙屽紶妫娴 - m_IndependantCapMap[CAP_DOUBLEFEEDDETECTION] = new CTWAINContainerBool(CAP_DOUBLEFEEDDETECTION, (m_AppID.SupportedGroups&DF_APP2) != 0, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[CAP_DOUBLEFEEDDETECTION])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create Double Feeded DETECT" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //瑁呰妫娴 - m_IndependantCapMap[0x8090] = new CTWAINContainerBool(0x8090, TWON_ONEVALUE, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[0x8090])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create Double Feeded DETECT" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - //澶氭祦闄ょ孩 - m_IndependantCapMap[0x8026] = new CTWAINContainerBool(0x8026, TWON_ONEVALUE, TWQC_ALL); - if (NULL == (pbCap = dynamic_cast(m_IndependantCapMap[0x8026])) - || !pbCap->Add(TRUE) - || !pbCap->Add(FALSE, true)) - { - cerr << "Could not create multi output" << endl; - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - return TWRC_SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////// -CTWAINDS_FreeImage::~CTWAINDS_FreeImage() -{ - DestroyUI(m_pGUI); - - // free all resources belonging to m_IndependantCapMap - TWAINCapabilitiesMap_int::iterator cur_int = m_BitDepthMap.begin(); - while (cur_int != m_BitDepthMap.end()) - { - delete cur_int->second; - cur_int++; - } - - if (m_pICAP_FRAMES) - { - delete m_pICAP_FRAMES; - } - m_pICAP_FRAMES = 0; - - g_CloseSysMutexRun();//鍏抽棴浜掓枼閿 - //FileTools::write_log("1.txt", "~CTWAINDS_FreeImage"); - return; -} - -////////////////////////////////////////////////////////////////////////////// -void CTWAINDS_FreeImage::fillIdentityStructure(TW_IDENTITY& _idStruct) -{ - _idStruct = m_TheIdentity; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::getImageInfo(pTW_IMAGEINFO _pImageInfo) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - memset(_pImageInfo, 0, sizeof(TW_IMAGEINFO)); - - // Only valid in state 6 and 7(State 7 only after receiving TWRC_XFERDONE) - if (dsState_XferReady > m_CurrentState) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - // Get the actual values used by the scanner. - SFreeImage* settings = m_Scanner.getSetting(); - - int nUnit = TWUN_INCHES; - CTWAINContainerInt *pnCap = 0; - if (0 == (pnCap = dynamic_cast(findCapability(ICAP_UNITS))) - || false == pnCap->GetCurrent(nUnit)) - { - setConditionCode(TWCC_OPERATIONERROR); - return TWRC_FAILURE; - } - - - _pImageInfo->XResolution = FloatToFIX32(ConvertUnits(float(settings->m_fXResolution), nUnit, TWUN_INCHES, settings->m_fXResolution)); - _pImageInfo->YResolution = FloatToFIX32(ConvertUnits(float(settings->m_fYResolution), nUnit, TWUN_INCHES, settings->m_fYResolution)); - _pImageInfo->ImageWidth = m_Scanner.m_nSourceWidth; - _pImageInfo->ImageLength = m_Scanner.m_nSourceHeight; - //XdPrint("_pImageInfo->ImageWidth = %d, aaa\n",_pImageInfo->ImageWidth); - - // Our sample scanner only does one combination for each PixelType. - switch (settings->m_nPixelType) - { - case TWPT_BW: - _pImageInfo->PixelType = TWPT_BW; - _pImageInfo->BitsPerPixel = 1; - _pImageInfo->SamplesPerPixel = 1; - _pImageInfo->BitsPerSample[0] = 1; - break; - - case TWPT_GRAY: - _pImageInfo->PixelType = TWPT_GRAY; - _pImageInfo->BitsPerPixel = 8; - _pImageInfo->SamplesPerPixel = 1; - _pImageInfo->BitsPerSample[0] = 8; - break; - - case TWPT_RGB: - _pImageInfo->PixelType = TWPT_RGB; - _pImageInfo->BitsPerPixel = 24; - _pImageInfo->SamplesPerPixel = 3; - _pImageInfo->BitsPerSample[0] = 8; - _pImageInfo->BitsPerSample[1] = 8; - _pImageInfo->BitsPerSample[2] = 8; - break; - } - - _pImageInfo->Planar = FALSE; - _pImageInfo->Compression = TWCP_NONE; - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::openDS(pTW_IDENTITY _pOrigin) -{ - if (b_created == FALSE) - { - return TWRC_FAILURE; - } - if (!m_Scanner.getDeviceOnline()) - { - std::string cvt=StringToUtf("璇锋鏌ョ數婧愭垨USB閫氫俊鏄惁姝e父!"); - std::string notify=StringToUtf("鎻愮ず"); - MyMessageBox((TCHAR*)cvt.c_str(), (TCHAR*)notify.c_str(), MB_SYSTEMMODAL|MB_OK| MB_ICONINFORMATION); - return TWRC_FAILURE; - } - TW_INT16 ret = TWRC_SUCCESS; - // this basic version of the DS only supports one connection from the DSM - if (m_App.Id != 0) - { - setConditionCode(TWCC_MAXCONNECTIONS); - return TWRC_FAILURE; - } - - if (dsState_Loaded != m_CurrentState) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - // store the pointer of the originating scan requestor. - m_App = *_pOrigin; - - m_DocumentNumber = 0; - m_PageNumber = 0; - - if (!m_Scanner.resetScanner()) - { - setConditionCode(TWCC_BUMMER); - assert(0); - ret = TWRC_FAILURE; - } - else - { - m_CurrentState = dsState_Open; - } - JsonConfig js; - CONFIGPARAMS configParams = js.ReadDefaultConfig(); - bool ss = UpdateCapsFromConfig(configParams); - return ret; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::closeDS() -{ - if (dsState_Open != m_CurrentState) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - - memset(&m_App, 0, sizeof(m_App)); - XdPrint(" CloseDS !\n"); - return TWRC_SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::enableDS(pTW_USERINTERFACE _pData) -{ - if (b_created == FALSE)//Twain琚叾浠栫▼搴忓崰鐢 - { - return TWRC_FAILURE; - } - - if (dsState_Open != m_CurrentState) - { - setConditionCode(TWCC_SEQERROR); - //FileTools::write_log("1.txt", "~CTWAINDS_FreeImage enableDS dsState_Open != m_CurrentState"); - return TWRC_FAILURE; - } - m_CurrentState = dsState_Enabled; - - m_bCanceled = false; - - //set pending xfers to whatever the user configured for XferCount - //int Count = TWON_DONTCARE32; - //CTWAINContainerInt *pnCap = dynamic_cast(findCapability(CAP_XFERCOUNT)); - //if (pnCap) - //{ - // pnCap->GetCurrent(Count); - //} - m_Xfers.Count = -1; - //stringstream ss; - //ss<(findCapability(CAP_INDICATORS)); - bIndicators = FALSE; - if (pbCap) - { - pbCap->GetCurrent(bIndicators); - } - if (m_pGUI->DisplayTWAINGUI(*_pData, false, bIndicators) != TWRC_SUCCESS) - { - //A user interface is not supported as of right now because we are - //in text mode. - m_CurrentState = dsState_Open; - setConditionCode(TWCC_SEQERROR); - //FileTools::write_log("D:/1.txt","enableDS m_pGUI->DisplayTWAINGUI(*_pData, false, bIndicators) != TWRC_SUCCESS"); - return TWRC_FAILURE; - } - - if (FALSE == _pData->ShowUI) - { - // Update the scanner with the latest negotiated caps - //if (!updateScannerFromCaps()) - //{ - // cerr << "ds: There was an error while prepping the image for scanning" << endl; - // setConditionCode(TWCC_BADVALUE); - // return TWRC_FAILURE; - //} - // The application will move to state 5 after this triplet which means that - // no more capabilities can be set until we are brought back to state 4. - m_Scanner.Lock(); - // Because there is no user interface, there isn't anything to show here. - // But, at this point, the application is not allowed to set any more - // capabilities. This means that we can do any initializations we - // need in order to prepare for the next few calls and the scan. - // get the scanner to load the image so that image info calls can be done - if (!StartScanning())//!m_Scanner.acquireImage() - { - cerr << "ds: There was an error while trying to get scanner to acquire image" << endl; - m_CurrentState = dsState_Open; - setConditionCode(TWCC_SEQERROR); - //FileTools::write_log("1.txt","enableDS !StartScanning()"); - return TWRC_FAILURE; - } - - if (!DoXferReadyEvent()) - { - m_CurrentState = dsState_Open; - setConditionCode(TWCC_SEQERROR); - //FileTools::write_log("1.txt", "~CTWAINDS_FreeImage DoXferReadyEvent dsState_Open != m_CurrentState"); - return TWRC_FAILURE; - } - } - //CTWAINContainerBool *pbCap = dynamic_cast(findCapability(CAP_INDICATORS)); - //bIndicators = FALSE; - //if (pbCap) - //{ - // pbCap->GetCurrent(bIndicators); - //} - //if (m_pGUI->DisplayTWAINGUI(*_pData, false, bIndicators) != TWRC_SUCCESS) - //{ - //// // A user interface is not supported as of right now because we are - //// // in text mode. - // m_CurrentState = dsState_Open; - // setConditionCode(TWCC_OPERATIONERROR); - // return TWRC_FAILURE; - //} - return TWRC_SUCCESS; -} -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::enableDSOnly(pTW_USERINTERFACE _pData) -{ - //if (b_created==FALSE)//Twain琚叾浠栫▼搴忓崰鐢 - //{ - // //FileTools::write_log("D:/1.txt","b_created==FALSE"); - // return TWRC_FAILURE; - //} - - if (dsState_Open != m_CurrentState) - { - setConditionCode(TWCC_SEQERROR); - //FileTools::write_log("D:/1.txt","dsState_Open != m_CurrentState"); - return TWRC_FAILURE; - } - m_CurrentState = dsState_Enabled; - - if (m_pGUI->DisplayTWAINGUI(*_pData, true, false) != TWRC_SUCCESS) - { - // A user interface is not supported as of right now because we are - // in text mode. - //FileTools::write_log("D:/1.txt","m_pGUI->DisplayTWAINGUI(*_pData, true, false) != TWRC_SUCCESS"); - m_CurrentState = dsState_Open; - setConditionCode(TWCC_OPERATIONERROR); - return TWRC_FAILURE; - } - - return TWRC_SUCCESS; -} - - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::disableDS(pTW_USERINTERFACE _pData) -{ - if (dsState_Enabled != m_CurrentState) - { - //FileTools::write_log("1.txt", "~CTWAINDS_FreeImage disableDS dsState_Open != m_CurrentState"); - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - m_pGUI->DestroyTWAINGUI(); - - - // allow the scanners caps to be writeable again because we are moving back - // to state 4. If this source had a UI, it would be lowered at this time. - m_Scanner.Unlock(); - - - - // There is no UI in this text interface so there is nothing - // to do here. - m_CurrentState = dsState_Open; - //FileTools::write_log("1.txt", "~CTWAINDS_FreeImage disableDS m_CurrentState = dsState_Open"); - return TWRC_SUCCESS; -} -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::getMemoryXfer(pTW_SETUPMEMXFER _pData) -{ - // valid to call for 4, 5, & 6 - if (!(dsState_Open == m_CurrentState || - dsState_Enabled == m_CurrentState || - dsState_XferReady == m_CurrentState)) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - // Validate the pointer... - if (_pData == 0) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - // Min is the physical width at highest res and hishest bits/pixel count - TW_UINT32 bytes = (TW_UINT32)BYTES_PERLINE_ALIGN4(8.5 * 600, 24); - _pData->MinBufSize = bytes; - - // chose 64k because this is a typical sweet spot for most real world scanners - // (max transfer size for SCSI read of typical SCSI devices) - _pData->MaxBufSize = MAX((TW_UINT32)64 * 1024, bytes);//bytes; - _pData->Preferred = MAX((TW_UINT32)64 * 1024, bytes);//bytes; - - // Update the min based on current settings. - if (m_CurrentState == dsState_XferReady) - { - // If we have an image ready then we can use that info to get the memory requirements - //get the number of bytes per line we'll need for this image, and make sure it's DWORD-aligned - _pData->MinBufSize = BYTES_PERLINE_ALIGN4(m_ImageInfo.ImageWidth, m_ImageInfo.BitsPerPixel); - } - else - { - // calculate the min based on the current settings - int nBitDepth = 24; - float fXResolution = 600.0f; - float fWidth = 8.5f * fXResolution; - CTWAINContainerInt *pnCap = 0; - CTWAINContainerFix32 *pfCap = 0; - InternalFrame frame; - - if (0 == (pnCap = dynamic_cast(findCapability(ICAP_BITDEPTH)))) - { - cerr << "Could not get ICAP_BITDEPTH" << endl; - setConditionCode(TWCC_BUMMER); - return TWRC_FAILURE; - } - else - { - pnCap->GetCurrent(nBitDepth); - } - - if (0 == (pfCap = dynamic_cast(findCapability(ICAP_XRESOLUTION)))) - { - cerr << "Could not get ICAP_XRESOLUTION" << endl; - setConditionCode(TWCC_BUMMER); - return TWRC_FAILURE; - } - else - { - pfCap->GetCurrent(fXResolution); - } - - if (!m_pICAP_FRAMES->GetCurrent(frame)) - { - cerr << "Could not get ICAP_FRAMES" << endl; - setConditionCode(TWCC_BUMMER); - return TWRC_FAILURE; - } - else - { - // Get the scanning window by converting from our internal units to pixels. - TW_FRAME TWframe = frame.AsTW_FRAME(TWUN_PIXELS, fXResolution, fXResolution); - fWidth = FIX32ToFloat(TWframe.Right) - FIX32ToFloat(TWframe.Left); - } - _pData->MinBufSize = (TW_UINT32)BYTES_PERLINE_ALIGN4(fWidth, nBitDepth); - } - - return TWRC_SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::processEvent(pTW_EVENT _pEvent) -{ - TW_UINT16 twRc = TWRC_SUCCESS; - - if (dsState_Enabled > m_CurrentState) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - if (0 == _pEvent) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - if (m_pGUI && m_pGUI->processEvent(_pEvent))//hImageDlg && IsDialogMessage(hImageDlg, (LPMSG)(((pTW_EVENT)pData)->pEvent))) - { - twRc = TWRC_DSEVENT; - // The source should, for proper form, return a MSG_NULL for - // all Windows messages processed by the Data Source - _pEvent->TWMessage = MSG_NULL; - } - else - { - // notify the application that the source did not - // consume this message - twRc = TWRC_NOTDSEVENT; - _pEvent->TWMessage = MSG_NULL; - } - return twRc; -} - - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::transfer() -{ - TW_INT16 twrc = TWRC_SUCCESS; - - getImageInfo(&m_ImageInfo); - //if (m_bCanceled) - //{ - // m_bCanceled = false; - // return TWRC_CANCEL; - //} - if (dsState_XferReady != m_CurrentState) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - m_nDestScanLine = 0; - //static int xfer = 0; - - //This is for know image size. - if (m_ImageInfo.ImageWidth > 0 && m_ImageInfo.ImageLength > 0) - { - //DWORD nDestBytesPerRow = BYTES_PERLINE(m_ImageInfo.ImageWidth, m_ImageInfo.BitsPerPixel); - //DWORD nImageSize = nDestBytesPerRow * m_ImageInfo.ImageLength; - - DWORD nDestBytesPerRow = BYTES_PERLINE(m_ImageInfo.ImageWidth, m_ImageInfo.BitsPerPixel); - - //XdPrint("nDestBytesPerRow = %d, BitsPerPixel= %d , m_ImageInfo.ImageWidth = %d\n", nDestBytesPerRow, m_ImageInfo.BitsPerPixel, m_ImageInfo.ImageWidth); - DWORD nImageSize = nDestBytesPerRow * m_ImageInfo.ImageLength; - //If we had a previous image then get rid of it. - if (m_hImageData) - { - _DSM_Free(m_hImageData); - } - m_hImageData = _DSM_Alloc(nImageSize); - if (!m_hImageData) - { - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - - TW_MEMREF pData = _DSM_LockMemory(m_hImageData); - BYTE *pImageData = (BYTE*)pData; - DWORD dwRead; - DWORD dwReceived; - //memcpy(pImageData, pImageData, nImageSize); - do - { - dwRead = nImageSize;//MIN(64000, nImageSize) / nDestBytesPerRow * //nDestBytesPerRow; - dwReceived = 0; - - if (!m_Scanner.getScanStrip(pImageData, dwRead, dwReceived))//|| - //dwReceived != dwReceived / nDestBytesPerRow * nDestBytesPerRow - { - //No more data to recieve fill the rest - break; - } - pImageData += dwReceived; - - nImageSize -= dwReceived; - } while (nImageSize > 0 && twrc == TWRC_SUCCESS); - - _DSM_UnlockMemory(m_hImageData); - } - else - { - /// @todo Unknow paper size - // for unknow paper size need to use reallocate and keep transfering and adding to image data. - setConditionCode(TWCC_CAPUNSUPPORTED); - return TWRC_FAILURE; - } - - if (twrc == TWRC_FAILURE) - { - setConditionCode(TWCC_BADVALUE); - } - - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::endXfer(pTW_PENDINGXFERS _pXfers) -{ - TW_INT16 twrc = TWRC_SUCCESS; - if (!(dsState_XferReady == m_CurrentState || - dsState_Xferring == m_CurrentState)) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - if (m_Xfers.Count != TW_UINT16(TWON_DONTCARE16)) - { - --m_Xfers.Count; - } - - bool rs = m_Scanner.isImageQueueEmpty(); - if (rs) - { - m_Xfers.Count = 0; - } - - //if (m_bCanceled) - //{ - // m_bCanceled = false; - // m_Xfers.Count = 0; - //} - if (0 != m_Xfers.Count) - { - // Check to see if autofeed is turned on if so automaticly go get next image. - CTWAINContainerBool *pbCap = dynamic_cast(findCapability(CAP_AUTOFEED)); - bool bAutoFeed = FALSE; - if (pbCap) - { - pbCap->GetCurrent(bAutoFeed); - } - if (bAutoFeed) - { - // More images are requested, go to scan and try to get the next - // image in pre-emption of the app asking for it - if (!m_Scanner.acquireImage(false)) - { - m_Xfers.Count = 0; - } - } - } - else - { - m_Scanner.Unlock(); - } - m_CurrentState = dsState_Enabled; - - if (_pXfers == 0) - { - - setConditionCode(TWCC_BADVALUE); - // Did everyting but return the currect count. - return TWRC_CHECKSTATUS; - } - *_pXfers = m_Xfers; - if (0 != m_Xfers.Count) - { - m_CurrentState = dsState_XferReady; - } - else - { - m_pGUI->DestroyIndicators(); - } - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::getXfer(pTW_PENDINGXFERS _pXfers) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - if (dsState_XferReady != m_CurrentState) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - if (_pXfers == 0) - { - setConditionCode(TWCC_BADVALUE); - //FileTools::write_log("1.txt", "getXfer _pXfers == 0"); - return TWRC_CHECKSTATUS; - } - - *_pXfers = m_Xfers; - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::resetXfer(pTW_PENDINGXFERS _pXfers) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - if (dsState_Loaded == m_CurrentState) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - - m_Xfers.Count = 0; - m_CurrentState = dsState_Enabled; - m_Scanner.Unlock(); - - if (_pXfers == 0) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - *_pXfers = m_Xfers; - - m_Scanner.StopScan();//鎵弿浠仠姝 - m_Scanner.resetScanner();//娓呯┖鍘熷浘闃熷垪涓庡凡澶勭悊鐨勫浘鍍忛槦鍒 - return twrc; -} - -////////////////////////////////////////////////////////////////////////////// -bool CTWAINDS_FreeImage::UpdateCapsFromConfig(CONFIGPARAMS pConfig) -{ - int nVal; - float fVal; - bool bret = true; // Set to false if anything fails - bool bVal = false; - CTWAINContainerInt *pnCap = 0; - CTWAINContainerBool *pbCap = false; - CTWAINContainerFix32 *pfCap = 0; - CTWAINContainerFix32Range *pfRCap = 0; - DWORD index = -1; - if (0 == (pnCap = dynamic_cast(findCapability(ICAP_PIXELTYPE)))) - { - cerr << "Could not get ICAP_PIXELTYPE" << endl; - bret = false; - } - else - { - bret = pnCap->SetCurrent(pConfig.Pixtype); - } - - if (0 == (pnCap = dynamic_cast(findCapability(ICAP_SUPPORTEDSIZES)))) - { - cerr << "Could not get ICAP_PIXELTYPE" << endl; - bret = false; - } - else - { - bret = pnCap->SetCurrent(pConfig.PaperSize); - } - - if (0 == (pbCap = dynamic_cast(findCapability(CAP_DUPLEXENABLED)))) - { - cerr << "Could not get ICAP_PIXELTYPE" << endl; - bret = false; - } - else - { - bret = pbCap->SetCurrent(pConfig.Duplex == 0 ? FALSE : TRUE); - } - - if (0 == (pnCap = dynamic_cast(findCapability(ICAP_ORIENTATION)))) - { - cerr << "Could not get ICAP_ORIENTATION" << endl; - bret = false; - } - else - { - bret = pnCap->SetCurrent(pConfig.Orentation == 4 ? TWOR_AUTOTEXT : pConfig.Orentation); - } - - if (0 == (pnCap = dynamic_cast(findCapability(ICAP_FILTER)))) - { - cerr << "Could not get ICAP_FILTER" << endl; - bret = false; - } - else - { - bret = pnCap->SetCurrent(pConfig.Filter); - } - - if (0 == (pfCap = dynamic_cast(findCapability(ICAP_XRESOLUTION)))) - { - cerr << "Could not get ICAP_XRESOLUTION" << endl; - bret = false; - } - else - { - //pfCap->SetCurrent(pConfig->wDPI); - bret = pfCap->SetCurrent((float)pConfig.Resolution); - } - - // Y resolution the same. - if (0 == (pfCap = dynamic_cast(findCapability(ICAP_YRESOLUTION)))) - { - cerr << "Could not get ICAP_YRESOLUTION" << endl; - bret = false; - } - else - { - //pfCap->SetCurrent(pConfig->wDPI); - bret = pfCap->SetCurrent(pConfig.Resolution); - } - - if (0 == (pfRCap = dynamic_cast(findCapability(ICAP_CONTRAST)))) - { - cerr << "Could not get ICAP_CONTRAST" << endl; - bret = false; - } - else - { - float value_Contrast = GetContrast(pConfig.Contrast); - bret = pfRCap->SetCurrent(value_Contrast); - } - - if (0 == (pfRCap = dynamic_cast(findCapability(ICAP_BRIGHTNESS)))) - { - cerr << "Could not get ICAP_BRIGHTNESS" << endl; - bret = false; - } - else - { - bret = pfRCap->SetCurrent(pConfig.Brightness); - } - // Y resolution the same. - if (0 == (pfRCap = dynamic_cast(findCapability(ICAP_GAMMA)))) - { - cerr << "Could not get ICAP_GAMMA" << endl; - bret = false; - } - else - { - bret = pfRCap->SetCurrent(pConfig.Gamma / 10.0); - } - - if (0 == (pbCap = dynamic_cast(findCapability(ICAP_AUTOMATICCROPUSESFRAME)))) - { - cerr << "Could not get ICAP_AUTOMATICCROPUSESFRAME" << endl; - bret = bret = false; - } - else - { - bool temp = (pConfig.PaperSize) == 90; - bret = pbCap->SetCurrent(temp); - - } - - //濉厖榛戞 - if (0 == (pbCap = dynamic_cast(findCapability(0x8004)))) - { - cerr << "Could not get ICAP_AUTOMATICCROPUSESFRAME" << endl; - bret = false; - } - else - { - bret = pbCap->SetCurrent(pConfig.EnFillBlack); - - } - - if (0 == (pbCap = dynamic_cast(findCapability(ICAP_AUTODISCARDBLANKPAGES)))) - { - cerr << "Could not get ICAP_AUTODISCARDBLANKPAGES" << endl; - bret = false; - } - else - { - bool temp = (pConfig.Duplex) == 2; - bret = pbCap->SetCurrent(temp); - } - - if (0 == (pbCap = dynamic_cast(findCapability(0x8091)))) - { - cerr << "Could not get ICAP_AUTODISCARDBLANKPAGES" << endl; - bret = false; - } - else - { - bool temp = (pConfig.Duplex) == 3; - bret = pbCap->SetCurrent(temp); - } - - if (0 == (pbCap = dynamic_cast(findCapability(ICAP_AUTOMATICDESKEW)))) - { - cerr << "Could not get ICAP_AUTOMATICDESKEW" << endl; - bret = false; - } - else - { - bret = pbCap->SetCurrent(pConfig.EnAutoDescrew); - } - - if (0 == (pbCap = dynamic_cast(findCapability(0x8005))))//鑳岄潰鏃嬭浆180 - { - cerr << "Could not get CAP_SKREWDETECT" << endl; - bret = false; - } - else - { - bret = pbCap->SetCurrent(pConfig.EnBackRotate180); - } - - if (0 == (pbCap = dynamic_cast(findCapability(0x8006))))//姝枩妫娴 - { - cerr << "Could not get ICAP_AUTOMATICDESKEW" << endl; - bret = false; - } - else - { - bret = pbCap->SetCurrent(pConfig.EnScrewDetect); - } - - if (0 == (pbCap = dynamic_cast(findCapability((CAP_DOUBLEFEEDDETECTION))))) - { - cerr << "Could not get CAP_DOUBLEFEEDDETECTION" << endl; - bret = false; - } - else - { - bret = pbCap->SetCurrent(pConfig.EnUltrasonicDetect); - } - - //姝枩妫娴嬬瓑绾 - if (0 == (pfRCap = dynamic_cast(findCapability(0x8021)))) - { - cerr << "Could not get CAP_SKREWDETECTLEVEL" << endl; - bret = false; - } - else - { - bret = pfRCap->SetCurrent(pConfig.ScrewDetectLevel); - } - - //瑁呰妫娴 - if (0 == (pbCap = dynamic_cast(findCapability(0x8090)))) - { - cerr << "Could not get CAP_STAPLEDETECT" << endl; - bret = false; - } - else - { - bret = pbCap->SetCurrent(pConfig.EnBindingDetect); - } - - //鎵弿寮犳暟 - if (0 == (pnCap = dynamic_cast(findCapability(CAP_XFERCOUNT)))) - { - //XdPrint("updateScannerFromCaps CAP_XFERCOUNT Error"); - bret = false; - } - else - { - bret = pnCap->SetCurrent(pConfig.ScanCount); - } - - //鍘婚櫎绌垮瓟 - if (0 == (pbCap = dynamic_cast(findCapability(0x8018)))) - { - bret = false; - } - else - { - pbCap->SetCurrent(pConfig.EnOutHole ? true : false); - //int aa=2; - } - - //鍘婚櫎绌垮瓟鍗犲箙闈㈡瘮渚 - if (0 == (pfRCap = dynamic_cast(findCapability(0x8092)))) - { - bret = false; - } - else - { - pfRCap->SetCurrent(pConfig.OutHoleRatio); - } - - //澶氭祦闄ょ孩 - if (0 == (pbCap = dynamic_cast(findCapability(0x8026)))) - { - bret = false; - } - else - { - pbCap->SetCurrent(pConfig.EnMultiOutPutR); - } - - return bret; -} - -std::string CTWAINDS_FreeImage::GetSerialNum() -{ - return m_Scanner.getSerialNum(); -} - -std::string CTWAINDS_FreeImage::GetFWVerison() -{ - return m_Scanner.getFWVersion(); -} - -bool CTWAINDS_FreeImage::IsImageQueueEmpty() -{ - return m_Scanner.isImageQueueEmpty(); -} - -bool CTWAINDS_FreeImage::StillRemainImages() -{ - return m_Scanner.stillhaveImage(); -} - -////////////////////////////////////////////////////////////////////////////// -bool CTWAINDS_FreeImage::updateScannerFromCaps() -{ - int nVal; - float fVal; - bool bret = true; // Set to false if anything fails - bool bVal = false; - - SFreeImage* settings; - - // Get current before updating - settings = m_Scanner.getSetting(); - - CTWAINContainerInt *pnCap = 0; - CTWAINContainerFix32 *pfCap = 0; - CTWAINContainerFix32Range *pfRCap = 0; - - //鍚庡姞 - CTWAINContainerBool *pbCap = false; - - if (0 == (pnCap = dynamic_cast(findCapability(ICAP_PIXELTYPE)))) - { - cerr << "Could not get ICAP_PIXELTYPE" << endl; - bret = false; - } - else - { - bret = pnCap->GetCurrent(nVal); - settings->m_nPixelType = nVal; - - if (nVal == 2) - { - settings->m_HardWareParams.PixType = TWPT_RGB; - } - else - { - settings->m_HardWareParams.PixType = TWPT_GRAY; - } - } - - if (0 == (pnCap = dynamic_cast(findCapability(ICAP_SUPPORTEDSIZES)))) - { - cerr << "Could not get ICAP_PIXELTYPE" << endl; - bret = false; - } - else - { - bret = pnCap->GetCurrent(nVal); - settings->m_HardWareParams.PaperType = nVal; - } - - if (0 == (pbCap = dynamic_cast(findCapability(CAP_DUPLEXENABLED)))) - { - cerr << "Could not get ICAP_PIXELTYPE" << endl; - bret = false; - } - else - { - bret = pbCap->GetCurrent(bVal); - settings->m_bDuplex = bVal; - } - - if (0 == (pnCap = dynamic_cast(findCapability(ICAP_ORIENTATION)))) - { - cerr << "Could not get ICAP_PIXELTYPE" << endl; - bret = false; - } - else - { - bret = pnCap->GetCurrent(nVal); - settings->m_wRotation = nVal == TWOR_AUTOTEXT ? 4 : nVal;; - } - - if (0 == (pnCap = dynamic_cast(findCapability(ICAP_FILTER)))) - { - cerr << "Could not get ICAP_PIXELTYPE" << endl; - bret = false; - } - else - { - bret = pnCap->GetCurrent(nVal); - settings->m_nFilter = nVal; - if (nVal != 0) - { - m_Scanner.m_HardWareParams.PixType = TWPT_RGB; - } - } - - // X resolution the same. - if (0 == (pfCap = dynamic_cast(findCapability(ICAP_XRESOLUTION)))) - { - cerr << "Could not get ICAP_XRESOLUTION" << endl; - bret = false; - } - else - { - bret = pfCap->GetCurrent(fVal); - settings->m_fXResolution = fVal; - settings->m_HardWareParams.Resolution = 200; - } - - // Y resolution the same. - if (0 == (pfCap = dynamic_cast(findCapability(ICAP_YRESOLUTION)))) - { - cerr << "Could not get ICAP_YRESOLUTION" << endl; - bret = false; - } - else - { - bret = pfCap->GetCurrent(fVal); - settings->m_fYResolution = fVal; - } - - if (0 == (pfRCap = dynamic_cast(findCapability(ICAP_CONTRAST)))) - { - cerr << "Could not get ICAP_CONTRAST" << endl; - bret = false; - } - else - { - bret = pfRCap->GetCurrent(fVal); - settings->m_fContrast = fVal; - } - - if (0 == (pfRCap = dynamic_cast(findCapability(ICAP_BRIGHTNESS)))) - { - cerr << "Could not get ICAP_BRIGHTNESS" << endl; - bret = false; - } - else - { - bret = pfRCap->GetCurrent(fVal); - settings->m_fBrightness = fVal; - } - // Y resolution the same. - if (0 == (pfRCap = dynamic_cast(findCapability(ICAP_GAMMA)))) - { - cerr << "Could not get ICAP_GAMMA" << endl; - bret = false; - } - else - { - bret = pfRCap->GetCurrent(fVal); - settings->m_fGamma = fVal; - } - - if (0 == (pbCap = dynamic_cast(findCapability(ICAP_AUTOMATICCROPUSESFRAME)))) - { - cerr << "Could not get ICAP_AUTOMATICCROPUSESFRAME" << endl; - bret = false; - } - else - { - bret = pbCap->GetCurrent(bVal); - settings->m_bAutoCrop = bVal; - } - - //濉厖榛戞 - if (0 == (pbCap = dynamic_cast(findCapability(0x8004)))) - { - cerr << "Could not get ICAP_AUTOMATICCROPUSESFRAME" << endl; - bret = false; - } - else - { - bret = pbCap->GetCurrent(bVal); - settings->m_bFillBlackRect = bVal; - } - - if (0 == (pbCap = dynamic_cast(findCapability(ICAP_AUTODISCARDBLANKPAGES)))) - { - cerr << "Could not get ICAP_AUTODISCARDBLANKPAGES" << endl; - bret = false; - } - else - { - bret = pbCap->GetCurrent(bVal); - settings->m_bAutoDiscardBlank = bVal; - } - - - if (0 == (pbCap = dynamic_cast(findCapability(0x8091)))) - { - cerr << "Could not get ICAP_AUTODISCARDBLANKPAGES" << endl; - bret = false; - } - else - { - bret = pbCap->GetCurrent(bVal); - settings->m_bAutoDiscardBlankInvoice = bVal; - } - - if (0 == (pbCap = dynamic_cast(findCapability(ICAP_AUTOMATICDESKEW)))) - { - cerr << "Could not get ICAP_AUTOMATICDESKEW" << endl; - bret = false; - } - else - { - bret = pbCap->GetCurrent(bVal); - settings->m_bAutoDeskew = bVal; - } - - if (0 == (pbCap = dynamic_cast(findCapability(CAP_DOUBLEFEEDDETECTION)))) - { - cerr << "Could not get CAP_DOUBLEFEEDDETECTION" << endl; - bret = false; - } - else - { - bret = pbCap->GetCurrent(bVal); - settings->m_HardWareParams.DoubleFeederOn = bVal; - } - - if (0 == (pbCap = dynamic_cast(findCapability(0x8005))))//鑳岄潰鏃嬭浆180 - { - cerr << "Could not get CAP_SKREWDETECT" << endl; - bret = false; - } - else - { - bret = pbCap->GetCurrent(bVal); - settings->m_bBackRotate180 = bVal; - } - - if (0 == (pbCap = dynamic_cast(findCapability(0x8006))))//姝枩妫娴 - { - cerr << "Could not get CAP_SKREWDETECT" << endl; - bret = false; - } - else - { - bret = pbCap->GetCurrent(bVal); - settings->m_HardWareParams.SkrewDetectOn = bVal; - } - - - if (0 == (pfRCap = dynamic_cast(findCapability(0x8021))))//姝枩妫娴嬬瓑绾 - { - cerr << "Could not get CAP_SKREWDETECTLEVEL" << endl; - bret = false; - } - else - { - bret = pfRCap->GetCurrent(fVal); - settings->m_HardWareParams.SkrewDetectLevel = fVal; - } - - if (0 == (pbCap = dynamic_cast(findCapability(0x8090))))//瑁呰妫娴 - { - cerr << "Could not get CAP_STAPLEDETECT" << endl; - bret = false; - } - else - { - bret = pbCap->GetCurrent(bVal); - settings->m_HardWareParams.StapleDetectOn = bVal; - } - - if (0 == (pnCap = dynamic_cast(findCapability(CAP_XFERCOUNT)))) - { - //XdPrint("updateScannerFromCaps CAP_XFERCOUNT Error"); - } - else - { - bret = pnCap->GetCurrent(nVal); - //m_Xfers.Count=nVal; - bool bVal = settings->m_bDuplex; - if (nVal == -1) - settings->m_wScanCount = nVal; - else - { - if (settings->m_bMultiOutput) - nVal /= 2; - settings->m_wScanCount = bVal ? nVal / 2 : nVal; - } - } - - //鍘婚櫎绌垮瓟 - if (0 == (pbCap = dynamic_cast(findCapability(0x8018)))) - { - bret = false; - } - else - { - bret = pbCap->GetCurrent(bVal); - settings->m_OutHole.EnOutHole = bVal; - //if (bVal) - //{ - // settings->m_bDuplex=true; - //} - } - - //鍘婚櫎绌垮瓟鍗犲箙闈㈡瘮渚 - if (0 == (pfRCap = dynamic_cast(findCapability(0x8092)))) - { - bret = false; - } - else - { - pfRCap->GetCurrent(fVal); - settings->m_OutHole.OutHoleRatio = (int)fVal; - } - - //澶氭祦闄ょ孩 - if (0 == (pbCap = dynamic_cast(findCapability(0x8026)))) - { - bret = false; - } - else - { - bret = pbCap->GetCurrent(bVal); - settings->m_bMultiOutput = bVal; - } - return bret; -} - -////////////////////////////////////////////////////////////////////////////// -bool CTWAINDS_FreeImage::DoCloseDSOkEvent() -{ - if (dsState_Enabled != m_CurrentState) - { - setConditionCode(TWCC_SEQERROR); - return false; - } - - // Update the scanner with the latest negotiated caps - //if (!updateScannerFromCaps()) - //{ - // return false; - //} - - return CTWAINDS_Base::DoCloseDSOkEvent(); -} - - -////////////////////////////////////////////////////////////////////////////// -CTWAINContainer* CTWAINDS_FreeImage::findCapability(const TW_UINT16 _unCap) -{ - CTWAINContainer *pRet = 0; - // When adding to findCapabiltiy remember the order of operations - // Some capabilities are dependent on others. - // see: http://www.twain.org/docs/CapOrderForWeb.PDF - switch (_unCap) - { - case ICAP_FRAMES: - pRet = m_pICAP_FRAMES; - break; - - case ICAP_BITDEPTH: - pRet = getICAP_BITDEPTH(); - break; - - case CAP_DEVICEONLINE: - { - CTWAINContainerBool *pBoolCon = dynamic_cast(m_IndependantCapMap[CAP_DEVICEONLINE]); - if (NULL != pBoolCon) - { - pBoolCon->SetCurrent(m_Scanner.getDeviceOnline() ? TRUE : FALSE); - pRet = pBoolCon; - } - } - break; - case CUSTCAP_DOCS_IN_ADF: - { - CTWAINContainerInt *pIntCon = dynamic_cast(m_IndependantCapMap[CUSTCAP_DOCS_IN_ADF]); - if (NULL != pIntCon) - { - pIntCon->SetCurrent(m_Scanner.GetMaxPagesInADF()); - pRet = pIntCon; - } - } - break; - - case CAP_FEEDERLOADED: - { - CTWAINContainerBool *pBoolCon = dynamic_cast(m_IndependantCapMap[CAP_FEEDERLOADED]); - if (NULL != pBoolCon) - { - pBoolCon->SetCurrent(m_Scanner.isFeederLoaded() ? TRUE : FALSE); - pRet = pBoolCon; - } - } - break; - case CAP_SERIALNUMBER: - { - CTWAINContainerString *pStringCon = dynamic_cast(m_IndependantCapMap[CAP_SERIALNUMBER]); - if (NULL != pStringCon) - { - pStringCon->SetCurrent(m_Scanner.getSerialNum()); - pRet = pStringCon; - } - } - break; - case 0x8025://FWVersion - { - CTWAINContainerString *pStringCon = dynamic_cast(m_IndependantCapMap[0x8025]); - if (NULL != pStringCon) - { - pStringCon->SetCurrent(m_Scanner.getFWVersion()); - pRet = pStringCon; - } - - } - break; - default: - // cycle through m_IndependantCapMap - pRet = CTWAINDS_Base::findCapability(_unCap); - break; - } - - return pRet; -} - -////////////////////////////////////////////////////////////////////////////// -CTWAINContainer* CTWAINDS_FreeImage::getICAP_BITDEPTH() -{ - CTWAINContainer* pRet = 0; - - // BitDepth depends on PixelType - TWAINCapabilitiesMap::iterator itCap = m_IndependantCapMap.find(ICAP_PIXELTYPE); - - if (itCap != m_IndependantCapMap.end()) - { - int nCurrentVal = -1; - CTWAINContainerInt* pnCap = dynamic_cast(itCap->second); - - if ((0 != pnCap) && (pnCap->GetCurrent(nCurrentVal))) - { - TWAINCapabilitiesMap_int::iterator itBDCap = m_BitDepthMap.find(nCurrentVal); - if (itBDCap != m_BitDepthMap.end()) - { - pRet = itBDCap->second; - } - } - } - - return pRet; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::dat_imagelayout(TW_UINT16 _MSG, - pTW_IMAGELAYOUT _pData) -{ - TW_INT16 twrc = TWRC_SUCCESS; - - switch (_MSG) - { - case MSG_GET: - case MSG_GETCURRENT: - case MSG_GETDEFAULT: - if (!(dsState_Open == m_CurrentState || - dsState_Enabled == m_CurrentState || - dsState_XferReady == m_CurrentState)) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - break; - - case MSG_RESET: - case MSG_SET: - if (dsState_Open != m_CurrentState) - { - setConditionCode(TWCC_SEQERROR); - return TWRC_FAILURE; - } - break; - } - - if ((0 == _pData) || (0 == m_pICAP_FRAMES)) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - CTWAINContainerInt* pDepCap = dynamic_cast(findCapability(ICAP_SUPPORTEDSIZES)); - - switch (_MSG) - { - case MSG_RESET: - if (!pDepCap->Reset()) - { - setConditionCode(TWCC_CAPBADOPERATION); - twrc = TWRC_FAILURE; - } - else - { - // this will update the frame to match the papersize - updatePostDependencies(MSG_RESET, ICAP_SUPPORTEDSIZES); - } - - //change the behavior to a get current - _MSG = MSG_GETCURRENT; - case MSG_GET: - case MSG_GETCURRENT: - case MSG_GETDEFAULT: - { - InternalFrame frame; - - if (MSG_GETDEFAULT == _MSG) - { - if (!m_pICAP_FRAMES->GetDefault(frame)) - { - twrc = TWRC_FAILURE; - setConditionCode(TWCC_CAPBADOPERATION); - } - } - else - { - if (!m_pICAP_FRAMES->GetCurrent(frame)) - { - twrc = TWRC_FAILURE; - setConditionCode(TWCC_CAPBADOPERATION); - } - } - - if (TWRC_SUCCESS == twrc) - { - int unit = TWUN_PIXELS; - float Xres = 100; - float Yres = 100; - getCurrentUnits(unit, Xres, Yres); - _pData->Frame = frame.AsTW_FRAME(unit, Xres, Yres); - _pData->FrameNumber = m_pICAP_FRAMES->getIndexForValue(frame); - _pData->DocumentNumber = m_DocumentNumber; - _pData->PageNumber = m_PageNumber; - } - } - break; - - case MSG_SET: - { - /// @todo check frame with physical extents. If frame is too big or too small modify it - /// and return TWCC_BADVALUE if too big else TWRC_CHECKSTATUS if changed. - - // Application that want multiple frames should negotiated frames through ICAP_FRAMES - // Layout can only set the current frame. - // Our simple source only supports one frame. - TW_CAPABILITY cap; - - TW_HANDLE hContainer = _DSM_Alloc(sizeof(TW_ONEVALUE_FRAME)); - if (0 != hContainer) - { - cap.hContainer = hContainer; - cap.Cap = ICAP_FRAMES; - cap.ConType = TWON_ONEVALUE; - pTW_ONEVALUE_FRAME pCap = (pTW_ONEVALUE_FRAME)_DSM_LockMemory(cap.hContainer); - pCap->Item = _pData->Frame; - - int unit = TWUN_PIXELS; - float Xres = 100; - float Yres = 100; - twrc = getCurrentUnits(unit, Xres, Yres); - InternalFrame frame(pCap->Item, unit, Xres, Yres); - bool bConstrained; - if (!ConstrainFrameToScanner(frame, bConstrained)) - { - setConditionCode(TWCC_BADVALUE); - twrc = TWRC_FAILURE; - } - else if (bConstrained) - { - pCap->Item = frame.AsTW_FRAME(unit, Xres, Yres); - twrc = TWRC_CHECKSTATUS; - } - - pCap->ItemType = TWTY_FRAME; - _DSM_UnlockMemory(hContainer); - - TW_INT16 Condition; - if (m_pICAP_FRAMES->Set(&cap, Condition)) - { - updatePostDependencies(MSG_SET, ICAP_FRAMES); - } - - _DSM_Free(hContainer); - } - else - { - twrc = TWRC_FAILURE; - setConditionCode(TWCC_CAPBADOPERATION); - } - - if (_pData->DocumentNumber != TWON_DONTCARE32) - { - m_DocumentNumber = _pData->DocumentNumber; - } - if (_pData->PageNumber != TWON_DONTCARE32) - { - m_PageNumber = _pData->PageNumber; - } - } - break; - - default: - setConditionCode(TWCC_BADPROTOCOL); - assert(0); - twrc = TWRC_FAILURE; - break; - } - - return twrc; -} - -TW_INT16 CTWAINDS_FreeImage::dat_extimageinfo(TW_UINT16 _MSG, pTW_EXTIMAGEINFO _pData) -{ - //TW_INFO info; - //info.InfoID=TWEI_BOOKNAME; - //info.ItemType=TWTY_UINT32; - //uint aa=22; - //info.Item=&aa; - //info.ReturnCode=TWRC_SUCCESS; - //_pData->Info->NumItems=1; - //_pData->Info-> - //_pData->Info=info; - //return TWRC_SUCCESS; - - setConditionCode(TWCC_CAPUNSUPPORTED); - return TWRC_SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::GetGustomDSData(pTW_CUSTOMDSDATA _pDSData) -{ - stringstream DsData; - if (_pDSData == 0) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - if (StoreCustomDSdata(DsData)) - { - DsData.seekp(0, ios_base::end); - DWORD dwSize = (DWORD)DsData.tellp(); - _pDSData->InfoLength = dwSize + sizeof(TW_GUID); - TW_HANDLE hData = _DSM_Alloc(_pDSData->InfoLength); - if (hData == 0) - { - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - char * pData = (char*)_DSM_LockMemory(hData); - if (pData == 0) - { - _DSM_Free(hData); - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - memcpy(pData, &CustomDSGUI, sizeof(TW_GUID)); - pData += sizeof(TW_GUID); - DsData.seekg(0, ios_base::beg); - DsData.read(pData, dwSize); - _DSM_UnlockMemory(hData); - _pDSData->hData = hData; - return TWRC_SUCCESS; - } - setConditionCode(TWCC_BUMMER); - return TWRC_FAILURE; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::SetGustomDSData(pTW_CUSTOMDSDATA _pDSData) -{ - if (_pDSData == 0 || _pDSData->hData == 0 || _pDSData->InfoLength <= sizeof(TW_GUID)) - { - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; - } - - stringstream DsData; - char * pData = (char*)_DSM_LockMemory(_pDSData->hData); - if (pData == 0) - { - setConditionCode(TWCC_LOWMEMORY); - return TWRC_FAILURE; - } - if (memcmp(pData, &CustomDSGUI, sizeof(TW_GUID)) == 0) - { - pData += sizeof(TW_GUID); - DsData.write(pData, _pDSData->InfoLength); - _DSM_UnlockMemory(_pDSData->hData); - stringstream DsDataBackUp; - if (StoreCustomDSdata(DsDataBackUp))//Back up current settings - { - if (ReadCustomDSdata(DsData)) - { - return TWRC_SUCCESS; - } - ReadCustomDSdata(DsDataBackUp);//restore current settings - } - } - setConditionCode(TWCC_BADVALUE); - return TWRC_FAILURE; -} - -////////////////////////////////////////////////////////////////////////////// -TW_INT16 CTWAINDS_FreeImage::validateCapabilitySet(TW_UINT16 _Cap, TW_UINT16 _ConType, BYTE* _pContainer) -{ - TW_INT16 twrc = CTWAINDS_Base::validateCapabilitySet(_Cap, _ConType, _pContainer); - if (twrc != TWRC_SUCCESS) - { - return twrc; - } - - switch (_Cap) - { - case CUSTCAP_DOCS_IN_ADF: - { - twrc = TWRC_FAILURE; - if (TWON_ONEVALUE == _ConType) - { - pTW_ONEVALUE pCap = (pTW_ONEVALUE)_pContainer; - - if (pCap) - { - if ((TW_INT16)pCap->Item >= 0) - { - twrc = TWRC_SUCCESS; - m_Scanner.SetMaxPagesInADF((TW_INT16)pCap->Item); - } - } - } - break; - } - default: - break; - } - - return twrc; -} - -bool CTWAINDS_FreeImage::StartScanning(bool showUI) -{ - // Update the scanner with the latest negotiated caps - if (!updateScannerFromCaps()) - { - //FileTools::write_log("1.txt", "StartScanning() !updateScannerFromCaps()"); - setConditionCode(TWCC_BADVALUE); - return false; - } - - m_pGUI->ShowIndicators(); - bool ret = m_Scanner.acquireImage(); - if (bIndicators) - { - if (!ret) - { - m_pGUI->DestroyIndicators(); - } - } - return ret; -}; - - -bool CTWAINDS_FreeImage::StopScanning() -{ - m_bCanceled = true; - return m_Scanner.StopScan(); -} diff --git a/CTWAINDS_FreeImage.h b/CTWAINDS_FreeImage.h deleted file mode 100644 index aff3617..0000000 --- a/CTWAINDS_FreeImage.h +++ /dev/null @@ -1,279 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CTWAINDS_FreeImage.h -* The main Data Source class. -* This class is derived from the Base class describing a TWAIN DS. -* @author TWAIN Working Group -* @date April 2007 -*/ -#ifndef __CTWAINDS_FREEIMAGE_H__ -#define __CTWAINDS_FREEIMAGE_H__ - -#include "CTWAINDS_Base.h" -#include "CScanner_FreeImage.h" -#include "JsonConfig.h" - - -#define CUSTCAP_LONGDOCUMENT CAP_CUSTOMBASE+1 -#define CUSTCAP_DOCS_IN_ADF CAP_CUSTOMBASE+2 - -#define kCUSTOMDSGUI "{A4FAF845-1383-4036-AEDC-17C3968188B4}" - -const TW_GUID CustomDSGUI = -{ 0xa4faf845, 0x1383, 0x4036, { 0xae, 0xdc, 0x17, 0xc3, 0x96, 0x81, 0x88, 0xb4 } }; - -typedef struct _CUST_DS_DATA_ELEMENT -{ - DWORD dwSize; - TW_UINT16 unCapID; - TW_UINT16 unCapIdx; - TW_UINT16 unItemType; - TW_UINT16 unContType; - DWORD dwVal[1]; -}CUST_DS_DATA_ELEMENT; - -/** -* This is the main DS class. It inherits the TWAIN base class, implements all -* the pure virtual functions and manages all of the required capabilities -*/ -class CTWAINDS_FreeImage : public CTWAINDS_Base -{ -public: - CTWAINDS_FreeImage(TW_IDENTITY AppID); - ~CTWAINDS_FreeImage(); - - /** - * Fills the passed in identity structure with our information. - * @param[in] _idStruct the TW_IDENTITY structure to fill - */ - void fillIdentityStructure(TW_IDENTITY& _idStruct); - - /** - * Initialize the Datasource. Allocate memory for Capabilities. - * Sets condition code if had problem. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 Initialize(); - - /** - * Get image information. - * Implementation of base class pure virtual function. - * Called when a DG_IMAGE / DAT_IMAGEINFO / MSG_GET op is sent. - * -If in state 6, general info is provided about the image about to be transferred. - * -If in state 7, specific info is provided about the current image just transferred. - * @param[out] _pImageInfo a TW_IMAGEINFO structure to return image information. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 getImageInfo(pTW_IMAGEINFO _pImageInfo); - - /** - * Open the Data Source. - * Implementation of base class pure virtual function. - * Called when a DG_CONTROL / DAT_IDENTITY / MSG_OPENDS op is sent. - * @param[in] _pOrigin a pointer to TW_IDENTITY structure of the Application identity. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 openDS(pTW_IDENTITY _pOrigin); - - /** - * Close the Data Source. - * Implementation of base class pure virtual function. - * Called when a DG_CONTROL / DAT_IDENTITY / MSG_CLOSEDS op is sent. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 closeDS(); - - /** - * Process events. - * Implementation of base class pure virtual function. - * Called when a DG_CONTROL / DAT_EVENT / MSG_PROCESSEVENT op is sent. - * @param[in] _pEvent a pointer to TW_EVENT structure. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 processEvent(pTW_EVENT _pEvent); - - /** - * Stop currect transfer if not done. Single from application that application is - * done with all data with current image. - * Check to see if there is still documents or data remaining to transfer. - * Implementation of base class pure virtual function. - * Called when a DG_CONTROL / DAT_PENDINGXFERS / MSG_ENDXFER op is sent. - * @param[out] _pXfers a pointer to TW_PENDINGXFERS structure. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 endXfer(pTW_PENDINGXFERS _pXfers); - - /** - * Check to see if there is still documents or data remaining to transfer. - * Called when a DG_CONTROL / DAT_PENDINGXFERS / MSG_GET op is sent. - * @param[out] _pXfers a pointer to TW_PENDINGXFERS structure. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 getXfer(pTW_PENDINGXFERS _pXfers); - - /** - * Flush all pending transfers from the Source.. - * Called when a DG_CONTROL / DAT_PENDINGXFERS / MSG_RESET op is sent. - * @param[out] _pXfers a pointer to TW_PENDINGXFERS structure. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 resetXfer(pTW_PENDINGXFERS _pXfers); - - /** - * Called by the base class when the data source is enabled. - * @param[in] _pData contains info about if the UI should be shown etc. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 enableDS(pTW_USERINTERFACE _pData); - - /** - * Enable the Data Source in setup mode. - * Called when a DG_CONTROL / DAT_USERINTERFACE / MSG_ENABLEDS op is sent. - * @param[in] _pData a pointer to a TW_USERINTERFACE structure. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 enableDSOnly(pTW_USERINTERFACE _pData); - - /** - * Called by the base class when the data source is disabled. - * @param[in] _pData a pointer to a TW_USERINTERFACE struct. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 disableDS(pTW_USERINTERFACE _pData); - - - /** - * handles DAT_IMAGELAYOUT requests - * @param[in] _MSG the message to handle. - * @param[in] _pData a pointer to TW_IMAGELAYOUT structure. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 dat_imagelayout(TW_UINT16 _MSG, pTW_IMAGELAYOUT _pData); - - /** - * Figures out what to do with the DAT_EXTIMAGEINFO request. - * @param[in] _MSG the message to handle. - * @param[in] _pData a pointer to a TW_EXTIMAGEINFO structure. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 dat_extimageinfo(TW_UINT16 _MSG, - pTW_EXTIMAGEINFO _pData); - - /** - * Called by the base class to when the application wants to get memory transfer data. - * @param[in] _pData filled with buffer size data - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 getMemoryXfer(pTW_SETUPMEMXFER _pData); - - /** - * Transfer image data from scanner to memory. - * Called during one of the transfer methods. - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 transfer(); - - /** - * Return a CTWAINContainer for requested capability. - * @param[in] _unCap the ICAP_xxxx that is requested. - * @return a CTWAINContainer for the capability. - */ - CTWAINContainer* findCapability(const TW_UINT16 _unCap); - - /** - * Request the DSM the most likly user clicks on the 揙K?button on GUI. - * @return true if successful. - */ - virtual bool DoCloseDSOkEvent(); - - /** - * Updates the scanner from the current caps. - * @return true if successful. - */ - bool updateScannerFromCaps(); - - /** - * Convenience function that will get the proper ICAP_BITDEPTH container - * @return CTWAINContainer BitDepth for current PixelType. - */ - CTWAINContainer* getICAP_BITDEPTH(); - - bool StartScanning(bool showUI=true); - bool StopScanning(); - bool ReadCustomDSdata(stringstream &DsData); - bool StoreCustomDSdata(stringstream &DsData); - bool StoreCapInStream(stringstream &_DsData, TW_UINT16 _unCapID, TW_UINT16 _unCapIdx, TW_UINT16 unContType); - bool ReadCapFromStream(stringstream &_DsData, TW_UINT16 _unCapID, TW_UINT16 _unCapIdx); - - /** - * Get Gustom DS data - * @param[out] _pDSData a pointer to a TW_CUSTOMDSDATA structure. - * @return a valid TWRC_xxxx return code, TWRC_SUCCESS on success. - */ - TW_INT16 GetGustomDSData(pTW_CUSTOMDSDATA _pDSData); - - /** - * Set Gustom DS data - * @param[in] _pDSData a pointer to a TW_CUSTOMDSDATA structure. - * @return a valid TWRC_xxxx return code, TWRC_SUCCESS on success. - */ - TW_INT16 SetGustomDSData(pTW_CUSTOMDSDATA _pDSData); - - /** - * Validate the value being used to set a capability. Ranges and enums can be tested - * by the capability but OneValues might have only some values that are acceptable. - * Override this function in base class to support more capabilities - * @param[in] Cap the Capability ID - * @param[in] ConType the container type - * @param[in] _pCap a pointer to BYTE. Pointer to Cap container - * @return a valid TWRC_xxxx return code. - */ - TW_INT16 validateCapabilitySet(TW_UINT16 _Cap, TW_UINT16 _ConType, BYTE* _pContainer); - - bool UpdateCapsFromConfig(CONFIGPARAMS pConfig); - std::string GetSerialNum(); - std::string GetFWVerison(); - bool IsImageQueueEmpty(); - bool StillRemainImages(); -protected: - CScanner_FreeImage m_Scanner; /**< The main scanner. */ - - TWAINCapabilitiesMap_int m_BitDepthMap; /**< Capability for various Bit Depths */ - CTWAINContainerFrame *m_pICAP_FRAMES; /**< Capabiltiy for a FRAMES based container */ - TW_IDENTITY m_AppID; - bool m_bCanceled; - CTWAIN_UI *m_pGUI; /**< This is the main MFC UI dialog */ - bool bIndicators; - BOOL b_created; -}; -#endif // __CTWAINDS_FREEIMAGE_H__ diff --git a/CTWAINDS_Sample1.cpp b/CTWAINDS_Sample1.cpp deleted file mode 100644 index ab77c20..0000000 --- a/CTWAINDS_Sample1.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/*************************************************************************** -* Copyright 漏 2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CTWAINDS_Sample1.cpp -* Reveals the main entry point for the DSM -* @author TWAIN Working Group -* @date April 2007 -*/ -#include "stdafx.h" -#include "CTWAINDS_Sample1.h" -#include -#include "twain.h" -////////////////////////////////////////////////////////////////////////////// -// Globals -/** -* gloabal pointer of the Data Source, for access to the main DS_Entry. -*/ -typedef struct _DS_inst -{ - TW_IDENTITY AppId; - CTWAINDS_Base *pDS; -}DS_inst; - -typedef list lstDS; -lstDS g_lstDS; - -#ifdef TWH_CMP_MSC - /** - * gloadbal Windows Instance handle for the DSM DLL... - */ - HINSTANCE g_hinstance = 0; -#endif - -////////////////////////////////////////////////////////////////////////////// -// This is the main entry point. This function is dlsym'd by the DSM. - -#ifdef TWH_CMP_MSC -TW_UINT16 FAR PASCAL -#else -FAR PASCAL TW_UINT16 -#endif -DS_Entry( pTW_IDENTITY _pOrigin, - TW_UINT32 _DG, - TW_UINT16 _DAT, - TW_UINT16 _MSG, - TW_MEMREF _pData) -{ - AFX_MANAGE_STATE(AfxGetStaticModuleState()); - CTWAINDS_Base* pTWAINLayer = 0; - if(_pOrigin) - { - lstDS::iterator llIter=g_lstDS.begin(); - for(;llIter!=g_lstDS.end();llIter++) - { - if((*llIter).AppId.Id==_pOrigin->Id) - { - pTWAINLayer=(*llIter).pDS; - } - } - } - // Curently we are not open - if( 0 == pTWAINLayer ) - { - // Special case DSM can request to get identity information about - // DS before it is open. In this special case, where the DS is not - // open, we return this static Idenity. - if( DG_CONTROL == _DG && DAT_IDENTITY == _DAT && MSG_GET == _MSG ) - { - // Copy the ID assigned by the DSM eventhough the spec states - // that the id will not be assigned until MSG_OPENDS - CTWAINDS_Base::m_TheIdentity.Id = ((pTW_IDENTITY)_pData)->Id; - memcpy( _pData, &CTWAINDS_Base::m_TheIdentity, sizeof(CTWAINDS_Base::m_TheIdentity) ); - - return TWRC_SUCCESS; - } - - // The DS is not open. If we get a request to close DS do not open - // just to close, instead return that it is success closed. - if( DG_CONTROL == _DG && DAT_IDENTITY == _DAT && MSG_CLOSEDS == _MSG ) - { - return TWRC_SUCCESS; - } - - // Open the DS - pTWAINLayer = new CTWAINDS_FreeImage(*_pOrigin); - if( NULL == pTWAINLayer - || TWRC_SUCCESS != pTWAINLayer->Initialize()) - { - // Failed to create the DS - //setConditionCode(TWCC_LOWMEMORY); - if(pTWAINLayer) - { - // Created but could not Initialize - delete pTWAINLayer; - } - return TWRC_FAILURE; - } - DS_inst _DS; - _DS.pDS = pTWAINLayer; - _DS.AppId = *_pOrigin; - g_lstDS.push_back(_DS); - - } - - // If we were not open before, we are now, so continue with the TWAIN call - TW_INT16 result = pTWAINLayer->DS_Entry(_pOrigin, _DG, _DAT, _MSG, _pData); - - /** - * Special case - free memory if closing DS - * @todo keep track of what apps are connecting to the ds and only - * delete when count goes down to 0 - */ - if( TWRC_SUCCESS == result && - DG_CONTROL == _DG && DAT_IDENTITY == _DAT && MSG_CLOSEDS == _MSG && - NULL != pTWAINLayer ) - { - lstDS::iterator llIter=g_lstDS.begin(); - for(;llIter!=g_lstDS.end();) - { - if((*llIter).AppId.Id==_pOrigin->Id) - { - delete (*llIter).pDS; - llIter = g_lstDS.erase(llIter); - continue; - } - llIter++; - } - } - return result; -} - -////////////////////////////////////////////////////////////////////////////// - - -//#ifdef TWH_CMP_MSC -///** -//* DllMain is only needed for Windows, and it's only needed to collect -//* our instance handle, which is also our module handle. Don't ever -//* put anything else in here, not even logging messages. It just isn't -//* safe... -//*/ -//BOOL WINAPI DllMain(HINSTANCE _hmodule, -// DWORD _dwReasonCalled, -// LPVOID) -//{ -// switch (_dwReasonCalled) -// { -// case DLL_THREAD_ATTACH: -// case DLL_THREAD_DETACH: -// break; -// case DLL_PROCESS_ATTACH: -// g_hinstance = _hmodule; -// break; -// case DLL_PROCESS_DETACH: -// unLoadDSMLib(); -// g_hinstance = 0; -// break; -// } -// return(TRUE); -//} -//#elif (TWNDS_CMP == TWNDS_CMP_GNUGPP) -// // Nothing for us to do... -//#else -// #error Sorry, we do not recognize this system... -//#endif - diff --git a/CTWAINDS_Sample1.h b/CTWAINDS_Sample1.h deleted file mode 100644 index 3e29254..0000000 --- a/CTWAINDS_Sample1.h +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CTWAINDS_Sample1.h -* Reveals the main entry point for the DSM -* @author TWAIN Working Group -* @date April 2007 -*/ - -#ifndef __CTWAINDS_SAMPLE1_H__ -#define __CTWAINDS_SAMPLE1_H__ - -#include "CTWAINDS_FreeImage.h" - -/** -* The main entry point - defined in twain.h -FAR PASCAL TW_UINT16 DS_Entry( pTW_IDENTITY _pOrigin, - TW_UINT32 _DG, - TW_UINT16 _DAT, - TW_UINT16 _MSG, - TW_MEMREF _pData); -*/ - -#endif //__CTWAINDS_SAMPLE1_H__ diff --git a/CTiffWriter.cpp b/CTiffWriter.cpp deleted file mode 100644 index cb7689b..0000000 --- a/CTiffWriter.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** - * @file CTiffWriter.cpp - * Write an image to disk as a tiff file. - * @author JFL Peripheral Solutions Inc. - * @date October 2007 - */ - -#include "stdafx.h" -#include "CTiffWriter.h" -#include - -CTiffWriter::CTiffWriter(const string& _filename, - const long int _width, - const long int _height, - const int _bitsPerPixel, - const unsigned long int _bytesPerRow) -{ - m_pImageStream = 0; - m_nOffset = 0; - m_filename = _filename; - - m_ImageWidth.TagID = kTIFF_TAG_IMGWIDTH; - m_ImageWidth.DataType = kTIFF_TY_LONG; - m_ImageWidth.DataCount = 1; - m_ImageWidth.DataOffset = _width; - - m_ImageLength.TagID = kTIFF_TAG_IMGLENGTH; - m_ImageLength.DataType = kTIFF_TY_LONG; - m_ImageLength.DataCount = 1; - m_ImageLength.DataOffset = _height; - - m_BitsPerSample.TagID = kTIFF_TAG_BITSPERSAMPLE; - m_BitsPerSample.DataType = kTIFF_TY_SHORT; - m_BitsPerSample.DataCount = 1; - - if(24 == _bitsPerPixel) - { - m_BitsPerSample.DataOffset = 8; - } - else - { - m_BitsPerSample.DataOffset = _bitsPerPixel; - } - - - m_Compression.TagID = kTIFF_TAG_COMPRESSION; - m_Compression.DataType = kTIFF_TY_SHORT; - m_Compression.DataCount = 1; - m_Compression.DataOffset = 1; - - m_PhotometricInterp.TagID = kTIFF_TAG_PHOTOMETRICINT; - m_PhotometricInterp.DataType = kTIFF_TY_SHORT; - m_PhotometricInterp.DataCount = 1; - - if(24 == _bitsPerPixel) - { - m_PhotometricInterp.DataOffset = 2; - } - else - { - m_PhotometricInterp.DataOffset = 1; - } - - // -there is only one strip that contains all the row data, and it starts right after the header. - // -There are always 12 tags being written for each tiff. - m_StripOffsets.TagID = kTIFF_TAG_STRIPOFFSETS; - m_StripOffsets.DataType = kTIFF_TY_SHORT; - m_StripOffsets.DataCount = 1; - m_StripOffsets.DataOffset = getSizeofHeader(); - - m_SamplesPerPixel.TagID = kTIFF_TAG_SAMPLESPERPIXEL; - m_SamplesPerPixel.DataType = kTIFF_TY_SHORT; - - if(24 == _bitsPerPixel) - { - m_SamplesPerPixel.DataCount = 1; - m_SamplesPerPixel.DataOffset = 3; - } - else - { - m_SamplesPerPixel.DataCount = 1; - m_SamplesPerPixel.DataOffset = 1; - } - - m_RowsPerStrip.TagID = kTIFF_TAG_ROWSPERSTRIP; - m_RowsPerStrip.DataType = kTIFF_TY_LONG; - m_RowsPerStrip.DataCount = 1; - m_RowsPerStrip.DataOffset = _height; - - m_StripByteCounts.TagID = kTIFF_TAG_STRIPBYTECOUNTS; - m_StripByteCounts.DataType = kTIFF_TY_LONG; - m_StripByteCounts.DataCount = 1; - m_StripByteCounts.DataOffset = _bytesPerRow * _height; - - m_XResolution.TagID = kTIFF_TAG_XRESOLUTION; - m_XResolution.DataType = kTIFF_TY_RATIONAL; - m_XResolution.DataCount = 1; - m_XResolution.DataOffset = m_StripOffsets.DataOffset - sizeof(DWORD)*4; // fixed offset from the end of the header - setXResolution(100, 1); - - m_YResolution.TagID = kTIFF_TAG_YRESOLUTION; - m_YResolution.DataType = kTIFF_TY_RATIONAL; - m_YResolution.DataCount = 1; - m_YResolution.DataOffset = m_StripOffsets.DataOffset - sizeof(DWORD)*2; // fixed offset from the end of the header - setYResolution(100, 1); - - m_ResolutionUnit.TagID = kTIFF_TAG_RESOLUTIONUNIT; - m_ResolutionUnit.DataType = kTIFF_TY_SHORT; - m_ResolutionUnit.DataCount = 1; - m_ResolutionUnit.DataOffset = 2; -} - -CTiffWriter::~CTiffWriter() -{ - if(0 != m_pImageStream) - { - if(m_pImageStream->is_open()) - { - m_pImageStream->close(); - } - delete m_pImageStream; - } -} - -void CTiffWriter::setImageWidth(const long int _v) -{ - m_ImageWidth.DataOffset = _v; -} - -void CTiffWriter::setImageHeight(const long int _v) -{ - m_ImageLength.DataOffset = _v; -} - -void CTiffWriter::setBitsPerSample(const int _v) -{ - m_BitsPerSample.DataOffset = _v; -} - -void CTiffWriter::setCompression(const int _v) -{ - m_Compression.DataOffset = _v; -} - -void CTiffWriter::setPhotometricInterp(const int _v) -{ - m_PhotometricInterp.DataOffset = _v; -} - -void CTiffWriter::setSamplesPerPixel(const int _v) -{ - m_SamplesPerPixel.DataOffset = _v; -} - -void CTiffWriter::setXResolution(const int _numerator, const int _denominator) -{ - m_xres[0] = _numerator; - m_xres[1] = _denominator; -} - -void CTiffWriter::setYResolution(const int _numerator, const int _denominator) -{ - m_yres[0] = _numerator; - m_yres[1] = _denominator; -} - -void CTiffWriter::setBytesPerRow(const int _v) -{ - m_StripByteCounts.DataOffset = _v * m_ImageLength.DataOffset; -} - -void CTiffWriter::GetImageHeader(stringstream &Header) -{ - // write the header - TIFFIFH hdr = {0x4949, 0x002a, sizeof(TIFFIFH)}; - Header.write(reinterpret_cast(&hdr), sizeof(TIFFIFH)); - - // write the Tags immediately after the header - WORD numTags = 12; - Header.write(reinterpret_cast(&numTags), sizeof(numTags)); - - const int nsize = sizeof(TIFFTag); - - Header.write(reinterpret_cast(&m_ImageWidth), nsize); - Header.write(reinterpret_cast(&m_ImageLength), nsize); - Header.write(reinterpret_cast(&m_BitsPerSample), nsize); - Header.write(reinterpret_cast(&m_Compression), nsize); - Header.write(reinterpret_cast(&m_PhotometricInterp), nsize); - Header.write(reinterpret_cast(&m_StripOffsets), nsize); - Header.write(reinterpret_cast(&m_SamplesPerPixel), nsize); - Header.write(reinterpret_cast(&m_RowsPerStrip), nsize); - Header.write(reinterpret_cast(&m_StripByteCounts), nsize); - Header.write(reinterpret_cast(&m_XResolution), nsize); - Header.write(reinterpret_cast(&m_YResolution), nsize); - Header.write(reinterpret_cast(&m_ResolutionUnit), nsize); - - // end the header by setting the next image offset to null - DWORD end = 0; - Header.write(reinterpret_cast(&end), sizeof(end)); - - // write the X and Y resolutions - Header.write(reinterpret_cast(&m_xres), sizeof(DWORD)*2); - - Header.write(reinterpret_cast(&m_yres), sizeof(DWORD)*2); -} - -bool CTiffWriter::writeImageHeader() -{ - // create the out stream if not done so already - if(0 == m_pImageStream) - { - m_pImageStream = new ofstream(); - } - - // open the stream. If already open, reset it - if(m_pImageStream->is_open()) - { - m_pImageStream->seekp(0); - } - else - { - m_pImageStream->open(m_filename.c_str(), ios_base::out|ios_base::binary|ios_base::trunc); - } - stringstream Header; - GetImageHeader(Header); - Header.seekp(0, ios_base::end); - m_nOffset =(int) Header.tellp(); - Header.seekg(0, ios_base::beg); - char *pData = new char[m_nOffset]; - Header.read(pData,m_nOffset); - m_pImageStream->write(pData,m_nOffset); - delete []pData; - return true; -} - -bool CTiffWriter::WriteTIFFData(char *_pData, DWORD _nCount) -{ - bool bret = false; - - if(0 != m_pImageStream && - m_pImageStream->good()) - { - m_pImageStream->seekp(m_nOffset); - m_pImageStream->write(_pData, _nCount); - m_nOffset += _nCount; - bret = true; - } - - return bret; -} - -unsigned int CTiffWriter::getSizeofHeader() -{ - // Header is as follows: - // TIFFIFH + Num. of Tags + each tag + Xres Data (2 dwords) + Yres Data (2 dwords) + Next Image offset (1 dword) - return sizeof(TIFFIFH)+sizeof(WORD)+sizeof(TIFFTag)*12+sizeof(DWORD)*5; -} diff --git a/CTiffWriter.h b/CTiffWriter.h deleted file mode 100644 index 9f73f14..0000000 --- a/CTiffWriter.h +++ /dev/null @@ -1,240 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CTiffWriter.h -* Write an image to disk as a tiff file. -* @author TWAIN Working Group -* @date October 2007 -*/ - -#ifndef __TIFFWRITER_H__ -#define __TIFFWRITER_H__ - -#include -#include - -using namespace std; - -#ifdef _MSC_VER - #include -#else - typedef uint16_t WORD; - typedef uint32_t DWORD; -#endif // _MSC_VER - -#define TIFF_UNCOMPRESSED 1 /**< TIFF compression types */ -#define TIFF_CCITTGROUP3 3 -#define TIFF_CCITTGROUP4 4 - -// TIFF types -#define kTIFF_TY_BYTE 1 /**< 8-bit unsigned int */ -#define kTIFF_TY_ASCII 2 /**< 8-bit byte that contains a 7-bit ASCII code; last byte must be binary 0 (NULL) */ -#define kTIFF_TY_SHORT 3 /**< 16-bit (2-byte) unsigned int */ -#define kTIFF_TY_LONG 4 /**< 32-bit (4-byte) unsigned int */ -#define kTIFF_TY_RATIONAL 5 /**< two LONGs; the first is the numerator of a fraction; the second, the denominator */ - -// these field types where introduced in TIFF 6.0 -#define kTIFF_TY_SBYTE 6 /**< 8-bit signed int */ -#define kTIFF_TY_UNDEFINED 7 /**< 8-bit byte that may contain anything, depending on the definition of the field */ -#define kTIFF_TY_SSHORT 8 /**< 16-bit (2-byte) signed int */ -#define kTIFF_TY_SLONG 9 /**< 32-bit (4-byte) signed int */ -#define kTIFF_TY_SRATIONAL 10 /**< two SLONG's; first is numerator of fraction, second is denominator */ -#define kTIFF_TY_FLOAT 11 /**< single precision (4-byte) IEEE format */ -#define kTIFF_TY_DOUBLE 12 /**< double precision (8-byte) IEEE format */ - -// TIFF Tags -#define kTIFF_TAG_IMGWIDTH 0x0100 /**< Image width, short or long */ -#define kTIFF_TAG_IMGLENGTH 0x0101 /**< Image length, short or long */ -#define kTIFF_TAG_BITSPERSAMPLE 0x0102 /**< BitsPerSample, short */ -#define kTIFF_TAG_COMPRESSION 0x0103 /**< Compression, short */ -#define kTIFF_TAG_PHOTOMETRICINT 0x0106 /**< PhotometricInterpretation, short */ -#define kTIFF_TAG_STRIPOFFSETS 0x0111 /**< StripOffsets, short or long */ -#define kTIFF_TAG_SAMPLESPERPIXEL 0x0115 /**< Samples per pixel, short */ -#define kTIFF_TAG_ROWSPERSTRIP 0x0116 /**< RowsPerStrip, short or long */ -#define kTIFF_TAG_STRIPBYTECOUNTS 0x0117 /**< StripByteCounts, short or long */ -#define kTIFF_TAG_XRESOLUTION 0x011A /**< X Resolution, rational */ -#define kTIFF_TAG_YRESOLUTION 0x011B /**< Y Resolution, rational */ -#define kTIFF_TAG_RESOLUTIONUNIT 0x0128 /**< Resolution unit, short */ -#define kTIFF_TAG_COLORMAP 0x0140 /**< ColorMap, short, RGB order, black = 0,0,0, TWAIN supports max 256 entry pallette */ - -/** -* TIFF Image File Header -*/ -struct TIFFIFH -{ - WORD Identifier; - WORD Version; - DWORD IFDOffset; -}; - -/** -* A TIFF Tag -* If the actual value of the tag is less then a DWORD, then offset will contain -* it, else offset is truly an offset to the value. -*/ -struct TIFFTag -{ - WORD TagID; - WORD DataType; - DWORD DataCount; - DWORD DataOffset; -}; - -/** -* This is a class that will progressively write a TIFF image to a file. -*/ -class CTiffWriter -{ -public: -/** -* Constructor for CTiffWriter. This is a class that will progressively -* write a TIFF image to a file. -* @param[in] _filename name of file to write to. -* @param[in] _width image width. -* @param[in] _height image height. -* @param[in] _bitsPerPixel number of bits per each pixel. -* @param[in] _bytesPerRow number of bytes per row of data. -*/ - CTiffWriter(const string& _filename, - const long int _width, - const long int _height, - const int _bitsPerPixel, - const unsigned long int _bytesPerRow); - -/** -* Deconstructor for CTiffWriter. -*/ - virtual ~CTiffWriter(); - -/** -* Set the width of the image. -* @param[in] _v the new image width -*/ - void setImageWidth(const long int _v); - -/** -* Set the height of the image. -* @param[in] _v the new image height -*/ - void setImageHeight(const long int _v); - -/** -* Set the bits per sample of the image. -* @param[in] _v the new bits per sample -*/ - void setBitsPerSample(const int _v); - -/** -* Set the compression method to use. -* @param[in] _v the new compression method -*/ - void setCompression(const int _v); - -/** -* Set the Photometric Interpretation. -* @param[in] _v the new Photometric Interpretation -*/ - void setPhotometricInterp(const int _v); - -/** -* Set the number of samples per pixel of the image. -* @param[in] _v the new samples per pixel -*/ - void setSamplesPerPixel(const int _v); - -/** -* Set the x resolution of the image. Using type kTIFF_TY_RATIONAL (fraction) -* @param[in] _numerator the numerator part of the fraction -* @param[in] _denominator the denominator part of the fraction -*/ - void setXResolution(const int _numerator, const int _denominator); - -/** -* Set the y resolution of the image. Using type kTIFF_TY_RATIONAL (fraction) -* @param[in] _numerator the numerator part of the fraction -* @param[in] _denominator the denominator part of the fraction -*/ - void setYResolution(const int _numerator, const int _denominator); - -/** -* Set the Bytes per row of the image. -* @param[in] _v the new bytes per row -*/ - void setBytesPerRow(const int _v); - - -/** -* Write the prepaired image header to the file. -* @return true for succes -*/ - bool writeImageHeader(); - -/** -* Write the data for the image to the file. -* @param[in] _pData pointer to the image data -* @param[in] _nCount number of bytes to write -* @return true for success -*/ - bool WriteTIFFData(char *_pData, DWORD _nCount); - -/** -* Return the size of the TIFF header for the image file. -* @return the size of the header -*/ - unsigned int getSizeofHeader(); - - void GetImageHeader(stringstream &Header); - -protected: - string m_filename; /**< Name and or path of file */ - int m_nOffset; /**< Current offset into file */ - - DWORD m_xres[2]; /**< The X resolution of the image */ - DWORD m_yres[2]; /**< The Y resolution of the image */ - - TIFFTag m_ImageWidth; /**< The image width in pixels */ - TIFFTag m_ImageLength; /**< The image height in pixels */ - TIFFTag m_BitsPerSample; /**< The number of Bits per sample */ - TIFFTag m_Compression; /**< The compression method to use */ - TIFFTag m_PhotometricInterp; /**< The Photometric Interpretation to use */ - TIFFTag m_StripOffsets; /**< The strip offset, where image data starts */ - TIFFTag m_SamplesPerPixel; /**< The number of channels (RGB, G, )*/ - TIFFTag m_RowsPerStrip; /**< The number of rows that make up each strip */ - TIFFTag m_StripByteCounts; /**< The size of each strip of image data */ - TIFFTag m_XResolution; /**< The offset to the X resolution */ - TIFFTag m_YResolution; /**< The offset to the Y resolution */ - TIFFTag m_ResolutionUnit; /**< The units of the Resolution */ - - ofstream* m_pImageStream; /**< The output stream to write the file to */ -}; - -#endif // __TIFFWRITER_H__ diff --git a/CTwainMutex.cpp b/CTwainMutex.cpp deleted file mode 100644 index c7c4fe7..0000000 --- a/CTwainMutex.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "stdafx.h" -#include "CTwainMutex.h" - -CTwainMutex::CTwainMutex(void) -{ - m_hTwainMutex=NULL; - m_bInited=FALSE; - memset(m_sTwainMutex,0,sizeof(m_sTwainMutex)); -} - -CTwainMutex::~CTwainMutex(void) -{ - - if (m_hTwainMutex!=NULL) - { - CloseHandle(m_hTwainMutex); - m_hTwainMutex=NULL; - } -} - -BOOL CTwainMutex::CreatTwainMutex(TCHAR *str_Mutex) -{ - TCHAR mutexName[MAX_PATH]={0}; - DWORD error_code=0; - HANDLE hMutex=NULL; - BOOL b_ret=FALSE; - if (m_hTwainMutex!=NULL) - { - return b_ret; - } - - _tcscpy(mutexName,str_Mutex); - - hMutex=CreateMutex(NULL,FALSE,mutexName); - if (hMutex!=NULL) - { - error_code=GetLastError(); - if (error_code==ERROR_ALREADY_EXISTS||error_code==ERROR_ACCESS_DENIED) - { - MessageBox(NULL,"设备已被其他程序占用,请关闭占用程序之后再重试!","提示",MB_OK|MB_ICONWARNING); - b_ret=CloseHandle(hMutex); - if (!b_ret) - { - MessageBox(NULL, TEXT("资源释放异常"), 0, MB_ICONWARNING); - } - hMutex=NULL; - return FALSE; - } - else - { - if (m_hTwainMutex!=NULL) - { - b_ret=CloseHandle(m_hTwainMutex); - if (!b_ret) - { - return FALSE; - } - m_hTwainMutex=NULL; - } - m_hTwainMutex=hMutex; - b_ret=TRUE; - } - return b_ret; - } - else - { - MessageBox(NULL, TEXT("程序初始化错误"), 0, MB_ICONWARNING); - } - return b_ret; -} - -BOOL CTwainMutex::CheckExistTwainMutex(TCHAR* str_Mutex) -{ - TCHAR szMutexName[MAX_PATH] = {0}; - DWORD error_code = 0; - BOOL b_ret = FALSE; - HANDLE hMutex = NULL; - - if (m_hTwainMutex!=NULL) - { - return TRUE; - } - - _tcscpy(szMutexName,str_Mutex); - hMutex=CreateMutex(NULL,FALSE,szMutexName); - if (hMutex!=NULL) - { - error_code=GetLastError(); - if (error_code==ERROR_ALREADY_EXISTS||error_code==ERROR_ACCESS_DENIED) - { - b_ret=CloseHandle(hMutex); - hMutex=NULL; - b_ret=TRUE; - return b_ret; - } - else - { - CloseHandle(hMutex); - b_ret=FALSE; - return b_ret; - } - } - else - { - return TRUE; - } - return b_ret; -} - -BOOL CTwainMutex::CloseTwainMutex() -{ - BOOL b_ret=FALSE; - if (m_hTwainMutex!=NULL) - { - b_ret=CloseHandle(m_hTwainMutex); - - if (!b_ret) - { - MessageBox(NULL, TEXT("释放资源失败"), 0, MB_ICONWARNING); - } - m_hTwainMutex=NULL; - return b_ret; - } - return TRUE; -} - diff --git a/CTwainMutex.h b/CTwainMutex.h deleted file mode 100644 index 0581a66..0000000 --- a/CTwainMutex.h +++ /dev/null @@ -1,16 +0,0 @@ -#include "stdafx.h" - -class CTwainMutex -{ -public: - CTwainMutex(void); - ~CTwainMutex(void); -public: - BOOL CreatTwainMutex(TCHAR *str_Mutex); - BOOL CheckExistTwainMutex(TCHAR *str_Mutex); - BOOL CloseTwainMutex(); -private: - HANDLE m_hTwainMutex; - TCHAR m_sTwainMutex[MAX_PATH]; - BOOL m_bInited; -}; \ No newline at end of file diff --git a/CUSBHotPlugged.cpp b/CUSBHotPlugged.cpp deleted file mode 100644 index 8c39800..0000000 --- a/CUSBHotPlugged.cpp +++ /dev/null @@ -1,193 +0,0 @@ -#include "stdafx.h" -#include "CUSBHotPlugged.h" - -CUSBHotPlugged::CUSBHotPlugged() -{ - //usbHotPlugged=this; - isconnected=true; - tHandle=NULL; - hWnd=NULL; - initThread(); -} - -CUSBHotPlugged::~CUSBHotPlugged() -{ - if (tHandle!=NULL) - { - PostThreadMessage(iThread,THRD_MESSAGE_EXIT,0,0); - WaitForSingleObject(tHandle,1000); - CloseHandle(tHandle); - } - if (hWnd!=NULL&&IsWindow(hWnd)) - { - //PostQuitMessage(0); - //SendMessage(hWnd,WM_CLOSE,); - BOOL ret= UnregisterClass(CLASS_NAME,GetModuleHandle(NULL)); - BOOL ret1=DestroyWindow(hWnd); - hWnd=NULL; - int aa=-1; - } -} - -bool CUSBHotPlugged::getIsConnected() -{ - return isconnected; -} - -void CUSBHotPlugged::UpdateDevice(PDEV_BROADCAST_DEVICEINTERFACE pDevInf, WPARAM wParam) -{ - CString szDevId = pDevInf->dbcc_name + 4; - int idx = szDevId.ReverseFind(_T('#')); - szDevId.Truncate(idx); - szDevId.Replace(_T('#'), _T('\\')); - szDevId.MakeUpper(); - - CString szClass; - idx = szDevId.Find(_T('\\')); - szClass = szDevId.Left(idx); - - CString szTmp; - if (DBT_DEVICEARRIVAL == wParam) \ - szTmp.Format(_T("Adding %s\r\n"), szDevId.GetBuffer()); - else - szTmp.Format(_T("Removing %s\r\n"), szDevId.GetBuffer()); - - _tprintf(szTmp); -} - -LRESULT CUSBHotPlugged::DeviceChange(UINT message, WPARAM wParam, LPARAM lParam) -{ - if (DBT_DEVICEARRIVAL == wParam || DBT_DEVICEREMOVECOMPLETE == wParam) - { - PDEV_BROADCAST_HDR pHdr = (PDEV_BROADCAST_HDR)lParam; - PDEV_BROADCAST_DEVICEINTERFACE pDevInf; - PDEV_BROADCAST_HANDLE pDevHnd; - PDEV_BROADCAST_OEM pDevOem; - PDEV_BROADCAST_PORT pDevPort; - PDEV_BROADCAST_VOLUME pDevVolume; - switch (pHdr->dbch_devicetype) - { - case DBT_DEVTYP_DEVICEINTERFACE: - pDevInf = (PDEV_BROADCAST_DEVICEINTERFACE)pHdr; - CUSBHotPlugged::UpdateDevice(pDevInf, wParam); - break; - - case DBT_DEVTYP_HANDLE: - pDevHnd = (PDEV_BROADCAST_HANDLE)pHdr; - break; - - case DBT_DEVTYP_OEM: - pDevOem = (PDEV_BROADCAST_OEM)pHdr; - break; - - case DBT_DEVTYP_PORT: - pDevPort = (PDEV_BROADCAST_PORT)pHdr; - break; - - case DBT_DEVTYP_VOLUME: - pDevVolume = (PDEV_BROADCAST_VOLUME)pHdr; - break; - } - } - return 0; -} - -LRESULT CALLBACK CUSBHotPlugged::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_PAINT: - break; - case WM_SIZE: - break; - case WM_DEVICECHANGE: - return DeviceChange(message, wParam, lParam); - } - - return DefWindowProc(hWnd, message, wParam, lParam); -} - -bool CUSBHotPlugged::CreateMessageOnlyWindow() -{ - hWnd = CreateWindowEx(0, CLASS_NAME, _T(""), WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, // Parent window - NULL, // Menu - GetModuleHandle(NULL), // Instance handle - NULL // Additional application data - ); - - return hWnd != NULL; -} - -void CUSBHotPlugged::RegisterDeviceNotify() -{ - HDEVNOTIFY hDevNotify; - for (int i = 0; i < sizeof(GUID_DEVINTERFACE_LIST) / sizeof(GUID); i++) - { - DEV_BROADCAST_DEVICEINTERFACE NotificationFilter; - ZeroMemory(&NotificationFilter, sizeof(NotificationFilter)); - NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE); - NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; - NotificationFilter.dbcc_classguid = GUID_DEVINTERFACE_LIST[i]; - hDevNotify = RegisterDeviceNotification(hWnd, &NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE); - } -} - -DWORD CUSBHotPlugged::ThrdFunc(LPVOID lpParam) -{ - - if (0 ==MyRegisterClass()) - return -1; - - if (!CreateMessageOnlyWindow()) - return -1; - - RegisterDeviceNotify(); - - MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) - { - if (msg.message == THRD_MESSAGE_EXIT) - { - //cout << "worker receive the exiting Message..." << endl; - return 0; - } - - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return 0; -} - -int CUSBHotPlugged::initThread() -{ - int ret=-1; - if (tHandle==NULL) - { - tHandle=CreateThread(NULL, sizeof(CUSBHotPlugged),_usbhotPlugDetect, (LPVOID)this, 0L, &iThread); - if (tHandle==NULL) - { - return ret; - } - ret=0; - } - return ret; -} - -DWORD WINAPI CUSBHotPlugged::_usbhotPlugDetect(LPVOID lp_param) -{ - CUSBHotPlugged* This=(CUSBHotPlugged*) lp_param; - return This->ThrdFunc(lp_param); -} - -ATOM CUSBHotPlugged::MyRegisterClass() -{ - //CUSBHotPlugged* This=(CUSBHotPlugged*) lp_param; - WNDCLASS wc = { 0 }; - wc.lpfnWndProc =WndProc; - wc.hInstance = GetModuleHandle(NULL); - wc.lpszClassName = CLASS_NAME; - return RegisterClass(&wc); -} diff --git a/CUSBHotPlugged.h b/CUSBHotPlugged.h deleted file mode 100644 index b733f82..0000000 --- a/CUSBHotPlugged.h +++ /dev/null @@ -1,57 +0,0 @@ -#include "stdafx.h" -#include -#include -#include -#include -#include -#include - -#pragma comment (lib, "Kernel32.lib") -#pragma comment (lib, "User32.lib") - -#define THRD_MESSAGE_EXIT WM_USER + 1 -const _TCHAR CLASS_NAME[] = _T("Sample Window Class"); - -static const GUID GUID_DEVINTERFACE_LIST[] = -{ - // GUID_DEVINTERFACE_USB_DEVICE - { 0xA5DCBF10, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED } }, - // GUID_DEVINTERFACE_DISK - { 0x53f56307, 0xb6bf, 0x11d0, { 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b } }, - // GUID_DEVINTERFACE_HID, - { 0x4D1E55B2, 0xF16F, 0x11CF, { 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } }, - // GUID_NDIS_LAN_CLASS - { 0xad498944, 0x762f, 0x11d0, { 0x8d, 0xcb, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c } }, - // GUID_DEVINTERFACE_COMPORT - { 0x86e0d1e0, 0x8089, 0x11d0, { 0x9c, 0xe4, 0x08, 0x00, 0x3e, 0x30, 0x1f, 0x73 } }, - // GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR - { 0x4D36E978, 0xE325, 0x11CE, { 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 } }, - // GUID_DEVINTERFACE_PARALLEL - { 0x97F76EF0, 0xF883, 0x11D0, { 0xAF, 0x1F, 0x00, 0x00, 0xF8, 0x00, 0x84, 0x5C } }, - // GUID_DEVINTERFACE_PARCLASS - { 0x811FC6A5, 0xF728, 0x11D0, { 0xA5, 0x37, 0x00, 0x00, 0xF8, 0x75, 0x3E, 0xD1 } } -}; - -class CUSBHotPlugged -{ -public: - CUSBHotPlugged(); - ~CUSBHotPlugged(); - bool getIsConnected(); -protected: - static void UpdateDevice(PDEV_BROADCAST_DEVICEINTERFACE pDevInf, WPARAM wParam); - static LRESULT DeviceChange(UINT message, WPARAM wParam, LPARAM lParam); - static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - bool CreateMessageOnlyWindow(); - void RegisterDeviceNotify(); - DWORD ThrdFunc(LPVOID lpParam); - int initThread(); - static DWORD WINAPI _usbhotPlugDetect(LPVOID lp_param); - ATOM MyRegisterClass(); -private: - bool isconnected; - HANDLE tHandle; - DWORD iThread; - HWND hWnd; - //CUSBHotPlugged* usbHotPlugged; -}; \ No newline at end of file diff --git a/Common.h b/Common.h deleted file mode 100644 index a4d1ee8..0000000 --- a/Common.h +++ /dev/null @@ -1,272 +0,0 @@ -/*************************************************************************** -* Copyright 漏 2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file Common.h -* Common defines and typedefs used by the DS, App, and scanner -* @author TWAIN Working Group -* @date April 2007 -*/ - -#ifndef __COMMON_H__ -#define __COMMON_H__ - -#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) - #define TWNDS_OS_WIN - #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - #endif - #include -#endif - -#if defined(__APPLE__) - #define TWNDS_OS_APPLE -#endif - -#include "twain.h" - -#ifdef TWH_CMP_GNU - #if !(defined(TWNDS_OS_WIN) || defined(TWNDS_OS_APPLE)) - #define TWNDS_OS_LINUX - #endif - #include - #include -#endif - -/** -* These headers are available on all platforms... -*/ -#include -#include -#include -#include -#include - -/** -* First off, figure out what compiler we're running and on which -* platform we think we're running it. We assume that you're building -* on the same platform you intend to run, so if you are cross compiling -* you will likely have a bit of work to do here... -*/ - -/** -* Compilers we support... -*/ -#define TWNDS_CMP_VISUALCPP 0x1001 // Preferably 2005+ -#define TWNDS_CMP_GNUGPP 0x1002 // Preferably v4.x+ -#define TWNDS_CMP_XCODE 0x1003 // Xcode - -/** -* If the user defines TWNDS_CMP in their make file or project, -* then we'll assume they want to take responsibility for picking -* how we'll build the system. At this point it seems like the -* compiler definition is used to select which native library calls -* we're dealing with, while the os definition is more about -* where we'll expect to find stuff on the running system, like -* directories... -*/ -#ifndef TWNDS_CMP - - // GNU g++ - #if defined(TWH_CMP_GNU) || defined(TWH_CMP_XCODE) - #define TWNDS_CMP TWNDS_CMP_GNUGPP - #define TWNDS_CMP_VERSION __GNUC__ - - #define kTWAIN_DSM_DIR "/usr/local/lib/" - - // Visual Studio C++ - #elif defined(TWH_CMP_MSC) - #define TWNDS_CMP TWNDS_CMP_VISUALCPP - #define TWNDS_CMP_VERSION _MSC_VER - // Not neccessary it is in Windows path - #define kTWAIN_DSM_DIR "" - - // Xcode - #elif defined (TWH_CMP_XCODE) - #define TWNDS_CMP TWNDS_CMP_XCODE - #define TWNDS_CMP_VERSION - - // ruh-roh... - #else - #error Sorry, we don't recognize this system... - #endif -#endif - - -/** -* @def LOADLIBRARY(lib) -* Call system loadibrary function. OS abstraction macro that tries to load a library. -* @param lib path and name of library -* -* @def LOADFUNCTION(lib, func) -* Call system GetProcAddress function. OS abstraction macro that tries to locate the addess of a funtion name. -* @param lib path and name of library -* @param func name of the funtion -* -* @def UNLOADLIBRARY(lib) -* Call system FreeLibrary function. OS abstraction macro that tries to release the library. -* @param lib library modual to unload -* -* @def UNLINK -* OS abstraction macro that calls system _unlink function. -* -* @def READ -* OS abstraction macro that calls system _read function. -* -* @def CLOSE -* OS abstraction macro that calls system _close function. -* -* @def SNPRINTF -* OS abstraction macro that calls system _snprintf function. -* -*/ - -#if (TWNDS_CMP == TWNDS_CMP_VISUALCPP) - //#include "stdafx.h" - #define DllExport __declspec( dllexport ) - #define LOADLIBRARY(lib) LoadLibraryA(lib) - #define LOADFUNCTION(lib, func) GetProcAddress(lib, func) - #define UNLOADLIBRARY(lib) FreeLibrary(lib) - #define UNLINK _unlink - #define READ _read - #define CLOSE _close - #define FILE_EXISTS(FILE_NAME) ((0xFFFFFFFF==GetFileAttributes(FILE_NAME))?FALSE:TRUE) - #define PATH_SEPERATOR '\\' - #ifndef PATH_MAX - #define PATH_MAX _MAX_PATH - #endif - - #if (TWNDS_CMP_VERSION >= 1400) - #define SNPRINTF _snprintf_s - #define SSCANF sscanf_s - #define FOPEN(pf,name,mode) (void)fopen_s(&pf,name,mode) - #define _OPEN(pf,name,mode,share,perm) (void)_sopen_s(&pf,name,mode,share,perm) - #else - #define SSCANF sscanf - #define SNPRINTF _snprintf - #define FOPEN(pf,name,mode) pf=fopen(name,mode) - #define _OPEN(pf,name,mode,share,perm) pf = _open(name,mode,share) - #endif - #define MAX(a, b) max(a,b) - #define MIN(a, b) min(a,b) - -#elif (TWNDS_CMP == TWNDS_CMP_GNUGPP) - #define DllExport - #define LOADLIBRARY(lib) dlopen(lib, RTLD_NOW) - #define LOADFUNCTION(lib, func) dlsym(lib, func) - #define UNLOADLIBRARY(lib) dlclose(lib) - #define UNLINK unlink - #define kTWAIN_DSM_DLL_NAME "libtwaindsm.so" - #define READ read - #define CLOSE close - #define PATH_SEPERATOR '/' - #define SNPRINTF snprintf - #define SSCANF sscanf - typedef void * HMODULE; - #define MAX(a, b) (((a) > (b)) ? (a) : (b)) - #define MIN(a, b) (((a) < (b)) ? (a) : (b)) - #define FILE_EXISTS(FILE_NAME) ((0 == access(FILE_NAME, R_OK))?TRUE:FALSE) - #define FOPEN(pf,name,mode) (pf=fopen(name,mode)) - - #if !defined(TRUE) - #define FALSE 0 - #define TRUE 1 - #endif - - #include - typedef uint16_t WORD; - typedef uint32_t DWORD; - -#else - #error Sorry, we don't recognize this system... -#endif - - -/** -* We want to use secure string functions whenever possible, if g++ -* every includes a set I think it would be excellent to switch over -* to it, but at least with Windows using them we stand a better -* chance of finding boo-boos... -*/ -#if (TWNDS_CMP == TWNDS_CMP_VISUALCPP) && (TWNDS_CMP_VERSION >= 1400) - #define SSTRCPY(d,z,s) strncpy_s(d,z,s,_TRUNCATE) - #define SSTRCAT(d,z,s) strncat_s(d,z,s,_TRUNCATE) - #define SSTRNCPY(d,z,s,m) strncpy_s(d,z,s,m) - #define SGETENV(d,z,n) ::GetEnvironmentVariable(n,d,z) - inline int SSNPRINTF(char *d, size_t z, size_t c, const char *f,...) - { - int result; - va_list valist; - va_start(valist,f); - result = _vsnprintf_s(d,z,c,f,valist); - va_end(valist); - return result; - } - -/** -* These functions are insecure, but everybody has them, so we -* don't need an else/error section like we use everywhere else... -*/ -#else - #define SSTRCPY(d,z,s) strcpy(d,s) - #define SSTRCAT(d,z,s) strcat(d,s) - #define SSTRNCPY(d,z,s,m) strncpy(d,s,m) - #define SGETENV(d,z,n) strcpy(d,getenv(n)?getenv(n):"") - inline int SSNPRINTF(char *d, size_t, size_t c, const char *f,...) - { - int result; - va_list valist; - va_start(valist,f); - #if (TWNDS_CMP == TWNDS_CMP_VISUALCPP) - result = _vsnprintf(d,c,f,valist); - #elif (TWNDS_CMP == TWNDS_CMP_GNUGPP) - result = vsnprintf(d,c,f,valist); - #else - #error Sorry, we don't recognize this system... - #endif - va_end(valist); - return result; - } -#endif - -/** -* Determine the number of bytes needed for one line. -*/ -#define BYTES_PERLINE(width, bpp) ((((int)(width)*(bpp))+7)/8) - -/** -* Determine the number of bytes needed rouned up to 4 byte alignment. -*/ -#define BYTES_PERLINE_ALIGN4(width, bpp) (((((int)(width)*(bpp))+31)/32)*4) - - -#endif // __COMMON_H__ - diff --git a/CommonDS.cpp b/CommonDS.cpp deleted file mode 100644 index 7054139..0000000 --- a/CommonDS.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CommonDS.cpp -* Utilities functions used by TWAIN Data Sources -* -* @author TWAIN Working Group -* @date October 2007 -*/ -#include "stdafx.h" -#include "CommonDS.h" - - -////////////////////////////////////////////////////////////////////////////// -float ConvertUnits(float val, int fromUnits, int toUnits, float resolution) -{ - double result = val; //assume we don't have to convert - - if( fromUnits != toUnits ) //if we do have to convert - { - //see what we're converting from, and convert to inches - switch(fromUnits) - { - case TWUN_INCHES: - // nothing to do - break; - - case TWUN_CENTIMETERS: - result = val / 2.54; - break; - - case TWUN_PICAS: - result = val / 6.0; - break; - - case TWUN_POINTS: - result = val / 72.0; - break; - - case TWUN_TWIPS: - result = val / 1440.0; - break; - - case TWUN_PIXELS: - if(resolution != 0) - { - result = val / resolution; - } - break; - - case TWUN_1000INCHES: - result = val / 1000.0; - break; - - default: - // problem - break; - } - - // We are now in inches - // see what we're converting to, and convert the result to those units - switch(toUnits) - { - case TWUN_INCHES: - // nothing to do - break; - - case TWUN_CENTIMETERS: - result *= 2.54; - break; - - case TWUN_PICAS: - result *= 6.0; - break; - - case TWUN_POINTS: - result *= 72.0; - break; - - case TWUN_TWIPS: - result *= 1440.0; - break; - - case TWUN_PIXELS: - result *= resolution; - break; - - case TWUN_1000INCHES: - result *= 1000; - break; - - default: - // problem - break; - } - } - return (float)result; //return the result -} - -TW_FIX32 ConvertUnits(TW_FIX32 val, int fromUnits, int toUnits, float resolution) -{ - TW_FIX32 result = val; - if( fromUnits != toUnits ) //if we do have to convert - { - result = FloatToFIX32(ConvertUnits( FIX32ToFloat(val), fromUnits, toUnits, resolution)); - } - return result; -} - -////////////////////////////////////////////////////////////////////////////// -TW_FRAME ConvertUnits(TW_FRAME val, int fromUnits, int toUnits, float Xresolution, float Yresolution) -{ - TW_FRAME result = val; - if( fromUnits != toUnits ) //if we do have to convert - { - result.Left = ConvertUnits( val.Left, fromUnits, toUnits, Xresolution); - result.Top = ConvertUnits( val.Top, fromUnits, toUnits, Yresolution); - result.Right = ConvertUnits( val.Right, fromUnits, toUnits, Xresolution); - result.Bottom = ConvertUnits( val.Bottom, fromUnits, toUnits, Yresolution); - } - return result; -} - - -////////////////////////////////////////////////////////////////////////////// - diff --git a/CommonDS.h b/CommonDS.h deleted file mode 100644 index 8a522fc..0000000 --- a/CommonDS.h +++ /dev/null @@ -1,121 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CommonDS.h -* Common defines and typedefs used by the DS -* @author TWAIN Working Group -* @date April 2007 -*/ - - -#ifndef __COMMONDS_H__ -#define __COMMONDS_H__ - - -#include "Common.h" -#include "FreeImage.h" -#include "CommonTWAIN.h" - -#ifdef TWH_CMP_MSC - #include "resource.h" -#endif - -#include "DSMInterface.h" -#include "TWAINContainer.h" -#include "TWAINContainerInt.h" -#include "TWAINContainerFix32.h" -#include "TWAINContainerFix32Range.h" -#include "TWAINContainerBool.h" -#include "TWAINContainerFrame.h" -#include "TWAINContainerString.h" -#include "CTiffWriter.h" - -#include -using namespace std; - -/** -* Base TWAIN Container -*/ -typedef map TWAINCapabilitiesMap; - -/** -* Int TWAIN Container -*/ -typedef map TWAINCapabilitiesMap_int; - -/** -* Fix32 TWAIN Container -*/ -typedef map TWAINCapabilitiesMap_FIX32; - - -/** -* Our internal dimention we use to store data -*/ -#define TWUN_1000INCHES 0x8000 - -/** -* A commonly used conversion function for converting a dimention of one unit to a dimention of another unit. -* converts the given value from fromUnits to toUnits; resolution is optional if pixels are not involved, and should be in dots-per-inch -* @param[in] val the value in float to convert. -* @param[in] fromUnits the original unit of the value. -* @param[in] toUnits the result unit ot convert to -* @param[in] resolution the resolution in dots per inch, used to express the unit. Required if one of the units is pixels. -* @return the converted value as float -*/ -float ConvertUnits(float val, int fromUnits, int toUnits, float resolution); - -/** -* A commonly used conversion function for converting a dimention of one unit to a dimention of another unit. -* converts the given value from fromUnits to toUnits; resolution is optional if pixels are not involved, and should be in dots-per-inch -* @param[in] val the value in TW_FIX32 to convert. -* @param[in] fromUnits the original unit of the value. -* @param[in] toUnits the result unit ot convert to -* @param[in] resolution the resolution in dots per inch, used to express the unit. Required if one of the units is pixels. -* @return the converted value as TW_FIX32 -*/ -TW_FIX32 ConvertUnits(TW_FIX32 val, int fromUnits, int toUnits, float resolution); - -/** -* A commonly used conversion function for converting a frame of one unit to a frame of another unit. -* converts the given frame from fromUnits to toUnits; resolution is optional if pixels are not involved, and should be in dots-per-inch -* @param[in] val the value as TW_FRAME to convert. -* @param[in] fromUnits the original unit of the value. -* @param[in] toUnits the result unit ot convert to -* @param[in] Xresolution the X resolution in dots per inch, used to express the unit. Required if one of the units is pixels. -* @param[in] Yresolution the Y resolution in dots per inch, used to express the unit. Required if one of the units is pixels. -* @return the converted frame as TW_FRAME -*/ -TW_FRAME ConvertUnits(TW_FRAME val, int fromUnits, int toUnits, float Xresolution, float Yresolution); - -#endif // __COMMONDS_H__ - diff --git a/CommonTWAIN.cpp b/CommonTWAIN.cpp deleted file mode 100644 index 8b6709c..0000000 --- a/CommonTWAIN.cpp +++ /dev/null @@ -1,634 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CommonTWAIN.cpp -* Utilities functions used by TWAIN Data Sources -* -* @author TWAIN Working Group -* @date October 2007 -*/ - -#include "stdafx.h" -#include "CommonTWAIN.h" - -extern TW_HANDLE _DSM_Alloc(TW_UINT32 _size); -extern TW_MEMREF _DSM_LockMemory(TW_HANDLE _hMemory); -extern void _DSM_UnlockMemory(TW_HANDLE _hMemory); -extern void _DSM_Free(TW_HANDLE _hMemory); - - -////////////////////////////////////////////////////////////////////////////// -TW_FIX32 FloatToFIX32 (float floater) -{ - TW_FIX32 Fix32_value; - TW_BOOL sign = (floater < 0)?TRUE:FALSE; - TW_INT32 value = (TW_INT32) (floater * 65536.0 + (sign?(-0.5):0.5)); - Fix32_value.Whole = (TW_UINT16)(value >> 16); - Fix32_value.Frac = (TW_UINT16)(value & 0x0000ffffL); - return (Fix32_value); -} - - -////////////////////////////////////////////////////////////////////////////// -float FIX32ToFloat(const TW_FIX32& _fix32) -{ - return float(_fix32.Whole) + float(_fix32.Frac / 65536.0); -} - - -////////////////////////////////////////////////////////////////////////////// -bool getCurrent(TW_CAPABILITY *pCap, TW_UINT32& val) -{ - bool bret = false; - - if(0 != pCap->hContainer) - { - if(TWON_ENUMERATION == pCap->ConType) - { - pTW_ENUMERATION pCapPT = (pTW_ENUMERATION)_DSM_LockMemory(pCap->hContainer); - switch(pCapPT->ItemType) - { - case TWTY_INT32: - val = (TW_INT32)((pTW_INT32)(&pCapPT->ItemList))[pCapPT->CurrentIndex]; - bret = true; - break; - - case TWTY_UINT32: - val = (TW_INT32)((pTW_UINT32)(&pCapPT->ItemList))[pCapPT->CurrentIndex]; - bret = true; - break; - - case TWTY_INT16: - val = (TW_INT32)((pTW_INT16)(&pCapPT->ItemList))[pCapPT->CurrentIndex]; - bret = true; - break; - - case TWTY_UINT16: - val = (TW_INT32)((pTW_UINT16)(&pCapPT->ItemList))[pCapPT->CurrentIndex]; - bret = true; - break; - - case TWTY_INT8: - val = (TW_INT32)((pTW_INT8)(&pCapPT->ItemList))[pCapPT->CurrentIndex]; - bret = true; - break; - - case TWTY_UINT8: - val = (TW_INT32)((pTW_UINT8)(&pCapPT->ItemList))[pCapPT->CurrentIndex]; - bret = true; - break; - - case TWTY_BOOL: - val = (TW_INT32)((pTW_BOOL)(&pCapPT->ItemList))[pCapPT->CurrentIndex]; - bret = true; - break; - - } - _DSM_UnlockMemory(pCap->hContainer); - } - else if(TWON_ONEVALUE == pCap->ConType) - { - pTW_ONEVALUE pCapPT = (pTW_ONEVALUE)_DSM_LockMemory(pCap->hContainer); - if(pCapPT->ItemType < TWTY_FIX32) - { - val = pCapPT->Item; - bret = true; - } - _DSM_UnlockMemory(pCap->hContainer); - } - else if(TWON_RANGE == pCap->ConType) - { - pTW_RANGE pCapPT = (pTW_RANGE)_DSM_LockMemory(pCap->hContainer); - if(pCapPT->ItemType < TWTY_FIX32) - { - val = pCapPT->CurrentValue; - bret = true; - } - _DSM_UnlockMemory(pCap->hContainer); - } - } - - return bret; -} - - -////////////////////////////////////////////////////////////////////////////// -bool getCurrent(TW_CAPABILITY *pCap, string& val) -{ - bool bret = false; - - if(0 != pCap->hContainer) - { - if(TWON_ENUMERATION == pCap->ConType) - { - pTW_ENUMERATION pCapPT = (pTW_ENUMERATION)_DSM_LockMemory(pCap->hContainer); - switch(pCapPT->ItemType) - { - case TWTY_STR32: - { - pTW_STR32 pStr = &((pTW_STR32)(&pCapPT->ItemList))[pCapPT->CurrentIndex]; - // In case the Capability is not null terminated - pStr[32] = 0; - val = pStr; - bret = true; - } - break; - - case TWTY_STR64: - { - pTW_STR64 pStr = &((pTW_STR64)(&pCapPT->ItemList))[pCapPT->CurrentIndex]; - // In case the Capability is not null terminated - pStr[64] = 0; - val = pStr; - bret = true; - } - break; - - case TWTY_STR128: - { - pTW_STR128 pStr = &((pTW_STR128)(&pCapPT->ItemList))[pCapPT->CurrentIndex]; - // In case the Capability is not null terminated - pStr[128] = 0; - val = pStr; - bret = true; - } - break; - - case TWTY_STR255: - { - pTW_STR255 pStr = &((pTW_STR255)(&pCapPT->ItemList))[pCapPT->CurrentIndex]; - // In case the Capability is not null terminated - pStr[255] = 0; - val = pStr; - bret = true; - } - break; - } - _DSM_UnlockMemory(pCap->hContainer); - } - else if(TWON_ONEVALUE == pCap->ConType) - { - pTW_ONEVALUE pCapPT = (pTW_ONEVALUE)_DSM_LockMemory(pCap->hContainer); - - switch(pCapPT->ItemType) - { - case TWTY_STR32: - { - pTW_STR32 pStr = ((pTW_STR32)(&pCapPT->Item)); - // In case the Capability is not null terminated - pStr[32] = 0; - val = pStr; - bret = true; - } - break; - - case TWTY_STR64: - { - pTW_STR64 pStr = ((pTW_STR64)(&pCapPT->Item)); - // In case the Capability is not null terminated - pStr[64] = 0; - val = pStr; - bret = true; - } - break; - - case TWTY_STR128: - { - pTW_STR128 pStr = ((pTW_STR128)(&pCapPT->Item)); - // In case the Capability is not null terminated - pStr[128] = 0; - val = pStr; - bret = true; - } - break; - - case TWTY_STR255: - { - pTW_STR255 pStr = ((pTW_STR255)(&pCapPT->Item)); - // In case the Capability is not null terminated - pStr[255] = 0; - val = pStr; - bret = true; - } - break; - } - _DSM_UnlockMemory(pCap->hContainer); - } - } - - return bret; -} -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -bool getCurrent(TW_CAPABILITY *pCap, TW_FIX32& val) -{ - bool bret = false; - - if(0 != pCap->hContainer) - { - if(TWON_ENUMERATION == pCap->ConType) - { - pTW_ENUMERATION_FIX32 pCapPT = (pTW_ENUMERATION_FIX32)_DSM_LockMemory(pCap->hContainer); - - if(TWTY_FIX32 == pCapPT->ItemType) - { - val = pCapPT->ItemList[pCapPT->CurrentIndex]; - bret = true; - } - _DSM_UnlockMemory(pCap->hContainer); - } - else if(TWON_ONEVALUE == pCap->ConType) - { - pTW_ONEVALUE_FIX32 pCapPT = (pTW_ONEVALUE_FIX32)_DSM_LockMemory(pCap->hContainer); - - if(TWTY_FIX32 == pCapPT->ItemType) - { - val = pCapPT->Item; - bret = true; - } - _DSM_UnlockMemory(pCap->hContainer); - } - else if(TWON_RANGE == pCap->ConType) - { - pTW_RANGE pCapPT = (pTW_RANGE)_DSM_LockMemory(pCap->hContainer); - if(TWTY_FIX32 == pCapPT->ItemType) - { - val = *(TW_FIX32*)&pCapPT->CurrentValue; - bret = true; - } - _DSM_UnlockMemory(pCap->hContainer); - } - } - - return bret; -} - -////////////////////////////////////////////////////////////////////////////// -bool getCurrent(TW_CAPABILITY *pCap, TW_FRAME& frame) -{ - bool bret = false; - - if(0 != pCap->hContainer) - { - if(TWON_ENUMERATION == pCap->ConType) - { - pTW_ENUMERATION_FRAME pCapPT = (pTW_ENUMERATION_FRAME)_DSM_LockMemory(pCap->hContainer); - - if(TWTY_FRAME == pCapPT->ItemType) - { - frame = pCapPT->ItemList[pCapPT->CurrentIndex]; - bret = true; - } - _DSM_UnlockMemory(pCap->hContainer); - } - else if(TWON_ONEVALUE == pCap->ConType) - { - pTW_ONEVALUE_FRAME pCapPT = (pTW_ONEVALUE_FRAME)_DSM_LockMemory(pCap->hContainer); - - if(TWTY_FRAME == pCapPT->ItemType) - { - frame = pCapPT->Item; - bret = true; - } - _DSM_UnlockMemory(pCap->hContainer); - } - } - - return bret; -} - -////////////////////////////////////////////////////////////////////////////// -bool GetItem(TW_CAPABILITY *pCap, TW_UINT32 item, TW_UINT32& val) -{ - bool bret = false; - - if(0 != pCap && 0 != pCap->hContainer) - { - if( TWON_ARRAY == pCap->ConType - || TWON_ENUMERATION == pCap->ConType ) - { - TW_UINT8 *pData = NULL; - unsigned int Count = 0; - TW_UINT16 Type = 0; - - if( TWON_ARRAY == pCap->ConType ) - { - pTW_ARRAY pArray = (pTW_ARRAY)_DSM_LockMemory(pCap->hContainer); - Count = pArray->NumItems; - Type = pArray->ItemType; - pData = &pArray->ItemList[0]; - } - - if( TWON_ENUMERATION == pCap->ConType ) - { - pTW_ENUMERATION pEnumeration = (pTW_ENUMERATION)_DSM_LockMemory(pCap->hContainer); - Count = pEnumeration->NumItems; - Type = pEnumeration->ItemType; - pData = &pEnumeration->ItemList[0]; - } - - if(item < Count) - { - switch(Type) - { - case TWTY_INT32: - val = (int)((pTW_INT32)(pData))[item]; - bret = true; - break; - - case TWTY_UINT32: - val = (int)((pTW_UINT32)(pData))[item]; - bret = true; - break; - - case TWTY_INT16: - val = (int)((pTW_INT16)(pData))[item]; - bret = true; - break; - - case TWTY_UINT16: - val = (int)((pTW_UINT16)(pData))[item]; - bret = true; - break; - - case TWTY_INT8: - val = (int)((pTW_INT8)(pData))[item]; - bret = true; - break; - - case TWTY_UINT8: - val = (int)((pTW_UINT8)(pData))[item]; - bret = true; - break; - - case TWTY_BOOL: - val = (int)((pTW_BOOL)(pData))[item]; - bret = true; - break; - - } - } - _DSM_UnlockMemory(pCap->hContainer); - } - } - - return bret; -} - -////////////////////////////////////////////////////////////////////////////// -bool GetItem(TW_CAPABILITY *pCap, TW_UINT32 item, string& val) -{ - bool bret = false; - - if(0 != pCap && 0 != pCap->hContainer) - { - if( TWON_ARRAY == pCap->ConType - || TWON_ENUMERATION == pCap->ConType ) - { - TW_UINT8 *pData = NULL; - unsigned int Count = 0; - TW_UINT16 Type = 0; - - if( TWON_ARRAY == pCap->ConType ) - { - pTW_ARRAY pArray = (pTW_ARRAY)_DSM_LockMemory(pCap->hContainer); - Count = pArray->NumItems; - Type = pArray->ItemType; - pData = &pArray->ItemList[0]; - } - - if( TWON_ENUMERATION == pCap->ConType ) - { - pTW_ENUMERATION pEnumeration = (pTW_ENUMERATION)_DSM_LockMemory(pCap->hContainer); - Count = pEnumeration->NumItems; - Type = pEnumeration->ItemType; - pData = &pEnumeration->ItemList[0]; - } - - if(item < Count) - { - switch(Type) - { - case TWTY_STR32: - { - pTW_STR32 pStr = &((pTW_STR32)(pData))[item]; - // In case the Capability is not null terminated - pStr[32] = 0; - val = pStr; - bret = true; - } - break; - - case TWTY_STR64: - { - pTW_STR64 pStr = &((pTW_STR64)(pData))[item]; - // In case the Capability is not null terminated - pStr[64] = 0; - val = pStr; - bret = true; - } - break; - - case TWTY_STR128: - { - pTW_STR128 pStr = &((pTW_STR128)(pData))[item]; - // In case the Capability is not null terminated - pStr[128] = 0; - val = pStr; - bret = true; - } - break; - - case TWTY_STR255: - { - pTW_STR255 pStr = &((pTW_STR255)(pData))[item]; - // In case the Capability is not null terminated - pStr[255] = 0; - val = pStr; - bret = true; - } - break; - } - } - _DSM_UnlockMemory(pCap->hContainer); - } - } - - return bret; -} - -////////////////////////////////////////////////////////////////////////////// -bool GetItem(TW_CAPABILITY *pCap, TW_UINT32 item, TW_FIX32& val) -{ - bool bret = false; - - if(0 != pCap && 0 != pCap->hContainer) - { - if( TWON_ARRAY == pCap->ConType - || TWON_ENUMERATION == pCap->ConType ) - { - TW_FIX32 *pData = NULL; - unsigned int Count = 0; - TW_UINT16 Type = 0; - - if( TWON_ARRAY == pCap->ConType ) - { - pTW_ARRAY_FIX32 pArray = (pTW_ARRAY_FIX32)_DSM_LockMemory(pCap->hContainer); - Count = pArray->NumItems; - Type = pArray->ItemType; - pData = &pArray->ItemList[0]; - } - - if( TWON_ENUMERATION == pCap->ConType ) - { - pTW_ENUMERATION_FIX32 pEnumeration = (pTW_ENUMERATION_FIX32)_DSM_LockMemory(pCap->hContainer); - Count = pEnumeration->NumItems; - Type = pEnumeration->ItemType; - pData = &pEnumeration->ItemList[0]; - } - - if(item < Count && Type == TWTY_FIX32) - { - val = pData[item]; - bret = true; - } - _DSM_UnlockMemory(pCap->hContainer); - } - } - - return bret; -} - -////////////////////////////////////////////////////////////////////////////// -bool GetItem(TW_CAPABILITY *pCap, TW_UINT32 item, TW_FRAME& val) -{ - bool bret = false; - - if(0 != pCap && 0 != pCap->hContainer) - { - if( TWON_ARRAY == pCap->ConType - || TWON_ENUMERATION == pCap->ConType ) - { - TW_FRAME *pData = NULL; - unsigned int Count = 0; - TW_UINT16 Type = 0; - - if( TWON_ARRAY == pCap->ConType ) - { - pTW_ARRAY_FRAME pArray = (pTW_ARRAY_FRAME)_DSM_LockMemory(pCap->hContainer); - Count = pArray->NumItems; - Type = pArray->ItemType; - pData = &pArray->ItemList[0]; - } - - if( TWON_ENUMERATION == pCap->ConType ) - { - pTW_ENUMERATION_FRAME pEnumeration = (pTW_ENUMERATION_FRAME)_DSM_LockMemory(pCap->hContainer); - Count = pEnumeration->NumItems; - Type = pEnumeration->ItemType; - pData = &pEnumeration->ItemList[0]; - } - - if(item < Count && Type == TWTY_FRAME) - { - val = pData[item]; - bret = true; - } - _DSM_UnlockMemory(pCap->hContainer); - } - } - - return bret; -} - -////////////////////////////////////////////////////////////////////////////// -int getTWTYsize(TW_UINT16 ItemType) -{ - int TypeSize = 0; - - switch(ItemType) - { - case TWTY_INT8: - TypeSize = sizeof(TW_INT8); - break; - case TWTY_INT16: - TypeSize = sizeof(TW_INT16); - break; - case TWTY_INT32: - TypeSize = sizeof(TW_INT32); - break; - case TWTY_UINT8: - TypeSize = sizeof(TW_UINT8); - break; - case TWTY_UINT16: - TypeSize = sizeof(TW_UINT16); - break; - case TWTY_UINT32: - TypeSize = sizeof(TW_UINT32); - break; - case TWTY_BOOL: - TypeSize = sizeof(TW_BOOL); - break; - case TWTY_FIX32: - TypeSize = sizeof(TW_FIX32); - break; - case TWTY_FRAME: - TypeSize = sizeof(TW_FRAME); - break; - case TWTY_STR32: - TypeSize = sizeof(TW_STR32); - break; - case TWTY_STR64: - TypeSize = sizeof(TW_STR64); - break; - case TWTY_STR128: - TypeSize = sizeof(TW_STR128); - break; - case TWTY_STR255: - TypeSize = sizeof(TW_STR255); - break; - case TWTY_STR1024: - TypeSize = sizeof(TW_STR1024); - break; - case TWTY_UNI512: - TypeSize = sizeof(TW_UNI512); - break; - case TWTY_HANDLE: - TypeSize = sizeof(TW_HANDLE); - break; - - default: - break; - } - return TypeSize; -} \ No newline at end of file diff --git a/CommonTWAIN.h b/CommonTWAIN.h deleted file mode 100644 index 4d0b769..0000000 --- a/CommonTWAIN.h +++ /dev/null @@ -1,475 +0,0 @@ -/*************************************************************************** -* Copyright 漏 2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CommonTWAIN.h -* Common defines and typedefs used by the DS -* @author TWAIN Working Group -* @date April 2007 -*/ - -#include "Common.h" - -#include -#ifndef __COMMONTWAIN_H__ -#define __COMMONTWAIN_H__ - - -using namespace std; - -typedef struct _TW_GUID { - unsigned long Data1; - unsigned short Data2; - unsigned short Data3; - unsigned char Data4[ 8 ]; -} TW_GUID; -/** -* @def kTWAIN_DSM_DLL_NAME -* File name of the DSM library. -*/ - -#ifdef TWH_CMP_MSC - #ifdef TWH_64BIT - #define kTWAIN_DSM_DLL_NAME "TWAINDSM.dll" - #else - #define kTWAIN_DSM_DLL_NAME "TWAINDSM.dll" - #endif // #ifdef TWH_64BIT -#elif defined(TWH_CMP_GNU) - #define kTWAIN_DSM_DLL_NAME "libtwaindsm.so" -#else - #error Sorry, we don't recognize this system... -#endif - - - - -/** -* A commonly used conversion function for converting float to TW_FIX32. -* @param[in] floater the float value to change to TW_FIX32 -* @return the value as TW_FIX32 -*/ -TW_FIX32 FloatToFIX32 (float floater); - -/** -* A commonly used conversion function for converting TW_FIX32 to float. -* @param[in] _fix32 the TW_FIX32 value to change to float -* @return the value as float -*/ -float FIX32ToFloat(const TW_FIX32& _fix32); - - -/* Set the packing: this occurs before any structures are defined */ -#ifdef TWH_CMP_MSC -#pragma pack (push, before_twain) -#pragma pack (2) -#elif defined(TWH_CMP_GNU) -#pragma pack (push, before_twain) -#ifdef __APPLE__ -//#pragma pack (4) -#else -#pragma pack (2) -#endif -#elif defined(TWH_CMP_BORLAND) -#pragma option -a2 -#endif - -// The following structures combinations are implimented and found in the TWAIN specifications -// BOOL INT8 INT16 INT32 UINT8 UINT16 UINT32 STR32 STR64 STR128 STR255 STR1024 UNI512 FIX32 FRAME -// OneValue x x x x x x x x x x -// Array x x x x x x -// Enumeration x x x x x x x x -// Range x x x x x - -/** - * TW_ONEVALUE that holds a TW_FIX32 item - */ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_FIX32 */ -#ifdef __APPLE__ - TW_UINT16 Dummy; -#endif - TW_FIX32 Item; /**< TW_FIX32 value being passed */ -} TW_ONEVALUE_FIX32, FAR * pTW_ONEVALUE_FIX32; /**< Pointer to TW_ONEVALUE that holds a TW_FIX32 item */ - -/** -* TW_ONEVALUE that holds a TW_STR32 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR32 */ - TW_STR32 Item; /**< TW_STR32 value being passed */ -} TW_ONEVALUE_STR32, FAR * pTW_ONEVALUE_STR32; /**< Pointer to TW_ONEVALUE that holds a TW_STR32 item */ - -/** -* TW_ONEVALUE that holds a TW_STR64 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR64 */ - TW_STR64 Item; /**< TW_STR32 value being passed */ -} TW_ONEVALUE_STR64, FAR * pTW_ONEVALUE_STR64; /**< Pointer to TW_ONEVALUE that holds a TW_STR32 item */ - -/** -* TW_ONEVALUE that holds a TW_STR128 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR128 */ - TW_STR128 Item; /**< TW_STR128 value being passed */ -} TW_ONEVALUE_STR128, FAR * pTW_ONEVALUE_STR128; /**< Pointer to TW_ONEVALUE that holds a TW_STR128 item */ - -/** -* TW_ONEVALUE that holds a TW_STR255 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR255 */ - TW_STR255 Item; /**< TW_STR255 value being passed */ -} TW_ONEVALUE_STR255, FAR * pTW_ONEVALUE_STR255; /**< Pointer to TW_ONEVALUE that holds a TW_STR255 item */ - - -/** -* TW_ONEVALUE that holds a TW_FRAME item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_FRAME */ -#ifdef __APPLE__ - TW_UINT16 Dummy; -#endif - TW_FRAME Item; /**< TW_FRAME structure being passed */ -} TW_ONEVALUE_FRAME, FAR * pTW_ONEVALUE_FRAME; /**< Pointer to TW_ONEVALUE that holds a TW_FRAME item */ - -/** -* TW_ARRAY that holds a TW_UINT8 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_UINT8 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT8 ItemList[1]; /**< Array of TW_UINT8 structures starts here */ -} TW_ARRAY_UINT8, FAR * pTW_ARRAY_UINT8; /**< Pointer to TW_ARRAY that holds a TW_UINT8 item */ - -/** -* TW_ARRAY that holds a TW_UINT16 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_UINT16 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT16 ItemList[1]; /**< Array of TW_UINT16 structures starts here */ -} TW_ARRAY_UINT16, FAR * pTW_ARRAY_UINT16; /**< Pointer to TW_ARRAY that holds a TW_UINT16 item */ - -/** -* TW_ARRAY that holds a TW_UINT32 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_UINT32 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT32 ItemList[1]; /**< Array of TW_UINT32 structures starts here */ -} TW_ARRAY_UINT32, FAR * pTW_ARRAY_UINT32; /**< Pointer to TW_ARRAY that holds a TW_UINT32 item */ - -/** -* TW_ARRAY that holds a TW_STR32 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR32 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_STR32 ItemList[1]; /**< Array of TW_STR32 structures starts here */ -} TW_ARRAY_STR32, FAR * pTW_ARRAY_STR32; /**< Pointer to TW_ARRAY that holds a TW_STR32 item */ - -/** -* TW_ARRAY that holds a TW_FIX32 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_FIX32 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_FIX32 ItemList[1]; /**< Array of TW_FIX32 structures starts here */ -} TW_ARRAY_FIX32, FAR * pTW_ARRAY_FIX32; /**< Pointer to TW_ARRAY that holds a TW_FIX32 item */ - -/** -* TW_ARRAY that holds a TW_FRAME item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_FRAME */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_FRAME ItemList[1]; /**< Array of TW_FRAME structures starts here */ -} TW_ARRAY_FRAME, FAR * pTW_ARRAY_FRAME; /**< Pointer to TW_ARRAY that holds a TW_FRAME item */ - -/** -* TW_ENUMERATION that holds a TW_BOOL item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_BOOL */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */ - TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */ - TW_BOOL ItemList[1]; /**< Array of ItemType values starts here */ -} TW_ENUMERATION_BOOL, FAR * pTW_ENUMERATION_BOOL; /**< Pointer to TW_ENUMERATION that holds an array TW_BOOL items */ - -/** -* TW_ENUMERATION that holds a TW_INT16 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_INT16 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */ - TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */ - TW_INT16 ItemList[1]; /**< Array of ItemType values starts here */ -} TW_ENUMERATION_INT16, FAR * pTW_ENUMERATION_INT16;/**< Pointer to TW_ENUMERATION that holds an array TW_INT16 items */ - -/** -* TW_ENUMERATION that holds a TW_INT32 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_INT32 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */ - TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */ - TW_INT32 ItemList[1]; /**< Array of ItemType values starts here */ -} TW_ENUMERATION_INT32, FAR * pTW_ENUMERATION_INT32;/**< Pointer to TW_ENUMERATION that holds an array TW_UINT32 items */ - -/** -* TW_ENUMERATION that holds a TW_UINT16 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_UINT16 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */ - TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */ - TW_UINT16 ItemList[1]; /**< Array of ItemType values starts here */ -} TW_ENUMERATION_UINT16, FAR * pTW_ENUMERATION_UINT16;/**< Pointer to TW_ENUMERATION that holds an array TW_UINT16 items */ - -/** -* TW_ENUMERATION that holds a TW_UINT32 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_UINT32 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */ - TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */ - TW_UINT32 ItemList[1]; /**< Array of ItemType values starts here */ -} TW_ENUMERATION_UINT32, FAR * pTW_ENUMERATION_UINT32;/**< Pointer to TW_ENUMERATION that holds an array TW_UINT32 items */ - -/** -* TW_ENUMERATION that holds a TW_STR32 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR32 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */ - TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */ - TW_STR32 ItemList[1]; /**< Array of ItemType values starts here */ -} TW_ENUMERATION_STR32, FAR * pTW_ENUMERATION_STR32;/**< Pointer to TW_ENUMERATION that holds an array TW_STR32 items */ - -/** -* TW_ENUMERATION that holds a TW_STR64 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR64 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */ - TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */ - TW_STR64 ItemList[1]; /**< Array of ItemType values starts here */ -} TW_ENUMERATION_STR64, FAR * pTW_ENUMERATION_STR64;/**< Pointer to TW_ENUMERATION that holds an array TW_STR32 items */ - -/** -* TW_ENUMERATION that holds a TW_STR128 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR128 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */ - TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */ - TW_STR128 ItemList[1]; /**< Array of ItemType values starts here */ -} TW_ENUMERATION_STR128, FAR * pTW_ENUMERATION_STR128;/**< Pointer to TW_ENUMERATION that holds an array TW_STR32 items */ - -/** -* TW_ENUMERATION that holds a TW_STR255 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR255 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */ - TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */ - TW_STR255 ItemList[1]; /**< Array of ItemType values starts here */ -} TW_ENUMERATION_STR255, FAR * pTW_ENUMERATION_STR255;/**< Pointer to TW_ENUMERATION that holds an array TW_STR255 items */ - -/** -* TW_ENUMERATION that holds a TW_FIX32 item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_FIX32 */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */ - TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */ - TW_FIX32 ItemList[1]; /**< Array of ItemType values starts here */ -} TW_ENUMERATION_FIX32, FAR * pTW_ENUMERATION_FIX32;/**< Pointer to TW_ENUMERATION that holds an array TW_FIX32 items */ - -/** -* TW_ENUMERATION that holds a TW_FRAME item -*/ -typedef struct { - TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_FRAME */ - TW_UINT32 NumItems; /**< How many items in ItemList */ - TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */ - TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */ - TW_FRAME ItemList[1]; /**< Array of TW_FRAME structures starts here */ -} TW_ENUMERATION_FRAME, FAR * pTW_ENUMERATION_FRAME;/**< Pointer to TW_ENUMERATION that holds a TW_FRAME item */ - -/** -* TW_RANGE that holds a TW_FIX32 item -*/ -typedef struct { - TW_UINT16 ItemType; -#ifdef __APPLE__ - TW_UINT16 Dummy; -#endif - TW_FIX32 MinValue; /* Starting value in the range. */ - TW_FIX32 MaxValue; /* Final value in the range. */ - TW_FIX32 StepSize; /* Increment from MinValue to MaxValue. */ - TW_FIX32 DefaultValue; /* Power-up value. */ - TW_FIX32 CurrentValue; /* The value that is currently in effect. */ -} TW_RANGE_FIX32, FAR * pTW_RANGE_FIX32; /**< Pointer to TW_RANGE that holds an array TW_FIX32 items */ - -/* Restore the previous packing alignment: this occurs after all structures are defined */ -#ifdef TWH_CMP_MSC -#pragma pack (pop, before_twain) -#elif defined(TWH_CMP_GNU) -#pragma pack (pop, before_twain) -#elif defined(TWH_CMP_BORLAND) -#pragma option 帽a. -//#elif defined(TWH_CMP_XCODE) -// #if PRAGMA_STRUCT_ALIGN -// #pragma options align=reset -// #elif PRAGMA_STRUCT_PACKPUSH -// #pragma pack (pop) -// #elif PRAGMA_STRUCT_PACK -// #pragma pack() -// #endif -#endif - -#ifdef TWH_CMP_GNU -#pragma pack(1) - -/** -* Structure contains information about the type, size, and layout of a file -* that contains a DIB. -*/ -typedef struct tagBITMAPFILEHEADER -{ - WORD bfType; /**< Specifies the file type, must be BM. */ - DWORD bfSize; /**< Specifies the size, in bytes, of the bitmap file. */ - WORD bfReserved1; /**< Reserved; must be zero. */ - WORD bfReserved2; /**< Reserved; must be zero. */ - DWORD bfOffBits; /**< Specifies the offset, in bytes, from the beginning of - the BITMAPFILEHEADER structure to the bitmap bits. */ -} BITMAPFILEHEADER; - -#pragma pack() // reset -#endif // TWH_CMP_GNU - - -/** -* Get the current value from a Capability as a TW_UINT32. -* @param[in] pCap a pointer to the capability to retrieve the current value -* @param[out] val the value retrieved from the capability -* @return true if successful -*/ -bool getCurrent(TW_CAPABILITY *pCap, TW_UINT32& val); - -/** -* Get the current value from a Capability as a string for capabilities of -* types TWTY_STR32, TWTY_STR64, TWTY_STR128, and TWTY_STR256 -* @param[in] pCap a pointer to the capability to retrieve the current value -* @param[out] val the value retrieved from the capability -* @return true if successful -*/ -bool getCurrent(TW_CAPABILITY *pCap, string& val); - -/** -* Get the current value from a Capability as a TW_FIX32. -* @param[in] pCap a pointer to the capability to retrieve the current value -* @param[out] val the value retrieved from the capability -* @return true if successful -*/ -bool getCurrent(TW_CAPABILITY *pCap, TW_FIX32& val); - -/** -* Get the current value from a Capability as a TW_FRAME. -* @param[in] pCap a pointer to the capability to retrieve the current value -* @param[out] val the value retrieved from the capability -* @return true if successful -*/ -bool getCurrent(TW_CAPABILITY *pCap, TW_FRAME& val); - -/** -* Get an item value from an array of values from a TW_ENUMERATION or TW_ARRAY -* type Capability as a TW_UINT32. -* @param[in] pCap a pointer to the capability to retrieve the value -* @pCount[in] item the 0 based location in the array to retrieve the item. -* @param[out] val the value retrieved from the capability -* @return true if successful. false if no value returned -*/ -bool GetItem(TW_CAPABILITY *pCap, TW_UINT32 item, TW_UINT32& val); - -/** -* Get an item value from an array of values from a TW_ENUMERATION or TW_ARRAY -* containing types TWTY_STR32, TWTY_STR64, TWTY_STR128, and TWTY_STR256 -* @param[in] pCap a pointer to the capability to retrieve the value -* @pCount[in] item the 0 based location in the array to retrieve the item. -* @param[out] val the value retrieved from the capability -* @return true if successful. false if no value returned -*/ -bool GetItem(TW_CAPABILITY *pCap, TW_UINT32 item, string& val); - -/** -* Get an item value from an array of values from a TW_ENUMERATION or TW_ARRAY -* containing type TWTY_FIX32 -* @param[in] pCap a pointer to the capability to retrieve the value -* @pCount[in] item the 0 based location in the array to retrieve the item. -* @param[out] val the value retrieved from the capability -* @return true if successful. false if no value returned -*/ -bool GetItem(TW_CAPABILITY *pCap, TW_UINT32 item, TW_FIX32& val); - -/** -* Get an item value from an array of values from a TW_ENUMERATION or TW_ARRAY -* containing type TWTY_FRAME -* @param[in] pCap a pointer to the capability to retrieve the value -* @pCount[in] item the 0 based location in the array to retrieve the item. -* @param[out] val the value retrieved from the capability -* @return true if successful. false if no value returned -*/ -bool GetItem(TW_CAPABILITY *pCap, TW_UINT32 item, TW_FRAME& val); - -/** -* Get the size of TWAIN type -* @param[in] ItemType the TWAIN type to return the size for -* @return the size of the type returned -*/ -int getTWTYsize(TW_UINT16 ItemType); - -#endif // __COMMONTWAIN_H__ - diff --git a/DSMInterface.cpp b/DSMInterface.cpp deleted file mode 100644 index 9b1dfcc..0000000 --- a/DSMInterface.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/*************************************************************************** -* Copyright 锟 2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file DSMInterface.cpp -* Common defines and typedefs used for accessing DSM for Twain Data Sources. -* @author TWAIN Working Group -* @date April 2007 -*/ - -#include "stdafx.h" -#include "DSMInterface.h" - -#include -using namespace std; - -/** -* gloabal pointer to the Data Source Manager -*/ -HMODULE gpDSM = 0; - -/** -* gloabal pointer to the Data Source Manager's Entry point -* - cleared & init'd in @see LoadDSMLib -*/ -TW_ENTRYPOINT g_DSM_Entry = -{ - 0,// TW_UINT32 Size; - 0,// DSMENTRYPROC DSM_Entry; - 0,// DSM_MEMALLOCATE DSM_MemAllocate; - 0,// DSM_MEMFREE DSM_MemFree; - 0,// DSM_MEMLOCK DSM_MemLock; - 0 // DSM_MEMUNLOCK DSM_MemUnlock; -}; - -#ifdef TWH_CMP_GNU - #include -#endif - -#ifdef TWNDS_OS_APPLE -// #include "CarbonCore/MacMemory.h" -#include -#endif - -/** -* This is the same as the main DS_Entry function. Routes traffic -* to the proper location. -* @param[in] _pOrigin Identifies the source DS for the message. -* @param[in] _pDest Identifies the destination application for the message. -* @param[in] _DG The Data Group. -* @param[in] _DAT The Data Attribute Type. -* @param[in] _MSG The message with respect to the Data Group and the Data Attribute Type. -* @param[in,out] _pData A pointer to the data structure or variable identified -* by the Data Attribute Type. -* @return a valid TWRC_xxxx return code. -*/ -TW_UINT16 _DSM_Entry( pTW_IDENTITY _pOrigin, - pTW_IDENTITY _pDest, - TW_UINT32 _DG, - TW_UINT16 _DAT, - TW_UINT16 _MSG, - TW_MEMREF _pData) -{ - TW_UINT16 ret = TWRC_FAILURE; - - // With DSM2 we do not need to load the DSM. We should have recieved - // Message with the entry points that we use. - // On windows with DSM1(twain_32.dll) we will need to first laod the dll - // then find the entry point First check to see if you have an entry point. - // On Mac we will use the dynamicaly linked at build time dll. - - if(0 == g_DSM_Entry.DSM_Entry) - { - // We do not already have the entry point for regisry callback - -#ifdef TWNDS_OS_APPLE - // This should only happen if not being called by the DSM2 - // Other words only on Mac with an older DSM - // So we use the old dll - g_DSM_Entry.DSM_Entry = DSM_Entry; - // ret = DSM_Entry(_pOrigin, _pDest, _DG, _DAT, _MSG, _pData); - -#elif defined (TWH_CMP_MSC) - - // This should only happen if not being called by the DSM2 - // Other words only on Windows with an older DSM - // So we load the old dll - char DSMName[MAX_PATH]; - - memset(DSMName, 0, MAX_PATH*sizeof(char)); - - if(GetWindowsDirectory (DSMName, MAX_PATH)==0) - { - DSMName[0]=0; - } -#if (TWNDS_CMP_VERSION >= 1400) - if (DSMName[strlen(DSMName)-1] != '\\') - { - strcat_s(DSMName,MAX_PATH, "\\"); - } - strcat_s (DSMName,MAX_PATH, "TWAIN_32.dll"); -#else - if (DSMName[strlen(DSMName)-1] != '\\') - { - strcat(DSMName, "\\"); - } - strcat(DSMName, "TWAIN_32.dll"); -#endif - - if((0 == gpDSM) && !LoadDSMLib(DSMName)) - { - cerr << "Could not load the DSM" << endl; - return TWRC_FAILURE; - } -#endif // TWNDS_OS_APPLE & TWH_CMP_MSC - } - - if(0 == g_DSM_Entry.DSM_Entry) - { - cerr << "No Entry Point for DSM_Entry" << endl; - return TWRC_FAILURE; - } - - // If we did not have an enty point before we do now. - ret = g_DSM_Entry.DSM_Entry(_pOrigin, _pDest, _DG, _DAT, _MSG, _pData); - - return ret; -} - -///////////////////////////////////////////////////////////////////////////// -bool LoadDSMLib(char* _pszLibName) -{ - // check if already opened - if(0 != gpDSM) - { - return true; - } - - memset(&g_DSM_Entry, 0, sizeof(TW_ENTRYPOINT)); - -#ifdef TWH_CMP_GNU - char *error; -#endif //TWH_CMP_GNU - - if((gpDSM=LOADLIBRARY(_pszLibName)) != 0) - { - if((g_DSM_Entry.DSM_Entry=(DSMENTRYPROC)LOADFUNCTION(gpDSM, "DSM_Entry")) == 0) - { -#ifdef TWH_CMP_MSC // dlsym returning NULL is not an error on Unix - cerr << "Error - Could not find DSM_Entry function in DSM: " << _pszLibName << endl; - return false; -#endif //TWH_CMP_MSC - } -#ifdef TWH_CMP_GNU - if ((error = dlerror()) != 0) - { - cerr << "App - dlsym: " << error << endl; - return false; - } -#endif //TWH_CMP_GNU - } - else - { - cerr << "Error - Could not load DSM: " << _pszLibName << endl; -#ifdef TWH_CMP_GNU - cerr << "App - dlopen: " << dlerror() << endl; -#endif //TWH_CMP_GNU - return false; - } - - - return true; -} - -///////////////////////////////////////////////////////////////////////////// -void unLoadDSMLib() -{ - if(gpDSM) - { - memset(&g_DSM_Entry, 0, sizeof(TW_ENTRYPOINT)); - UNLOADLIBRARY(gpDSM); - gpDSM = 0; - } -} - -///////////////////////////////////////////////////////////////////////////// -void setEntryPoints(pTW_ENTRYPOINT _pEntryPoints) -{ - if(_pEntryPoints) - { - g_DSM_Entry = *_pEntryPoints; - } - else - { - memset(&g_DSM_Entry, 0, sizeof(TW_ENTRYPOINT)); - } -} - -////////////////////////////////////////////////////////////////////////////// -// The following functions are defined in the DSM2, -// For backwards compatibiltiy on windows call the default function -TW_HANDLE _DSM_Alloc(TW_UINT32 _size) -{ - if(g_DSM_Entry.DSM_MemAllocate) - { - return g_DSM_Entry.DSM_MemAllocate(_size); - } - -#ifdef TWH_CMP_MSC - return ::GlobalAlloc(GPTR, _size); -#elif defined (TWNDS_OS_APPLE) - return NewHandle(_size); -#endif - - return 0; -} - -////////////////////////////////////////////////////////////////////////////// -void _DSM_Free(TW_HANDLE _hMemory) -{ - if(g_DSM_Entry.DSM_MemFree) - { - return g_DSM_Entry.DSM_MemFree(_hMemory); - } - -#ifdef TWH_CMP_MSC - ::GlobalFree(_hMemory); -#elif defined (TWNDS_OS_APPLE) - DisposeHandle(_hMemory); -#endif - - return; -} - -////////////////////////////////////////////////////////////////////////////// -TW_MEMREF _DSM_LockMemory(TW_HANDLE _hMemory) -{ - if(g_DSM_Entry.DSM_MemLock) - { - return g_DSM_Entry.DSM_MemLock(_hMemory); - } - -#ifdef TWH_CMP_MSC - return (TW_MEMREF)::GlobalLock(_hMemory); -#elif defined (TWNDS_OS_APPLE) - return (TW_MEMREF)(*_hMemory); -#endif - - return 0; -} - -////////////////////////////////////////////////////////////////////////////// -void _DSM_UnlockMemory(TW_HANDLE _hMemory) -{ - if(g_DSM_Entry.DSM_MemUnlock) - { - return g_DSM_Entry.DSM_MemUnlock(_hMemory); - } - -#ifdef TWH_CMP_MSC - ::GlobalUnlock(_hMemory); -#elif defined (TWNDS_OS_APPLE) - // do nothing -#endif - - return; -} - -////////////////////////////////////////////////////////////////////////////// diff --git a/DSMInterface.h b/DSMInterface.h deleted file mode 100644 index 74677d6..0000000 --- a/DSMInterface.h +++ /dev/null @@ -1,125 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file DSMInterface.h -* Common defines and typedefs used for accessing DSM for TWAIN Data Sources. -* @author TWAIN Working Group -* @date April 2007 -*/ - -#ifndef __DSMINTERFACE_H__ -#define __DSMINTERFACE_H__ - -#include "CommonDS.h" - -/** -* Load the DSM library. -* @param[in] the name of the DSM library to open -* @return true if success. -*/ -bool LoadDSMLib(char* _pszLibName); - -/** -* Unload the DSM library. -*/ -void unLoadDSMLib(); - -/** -* Initialize and register the entry point into the DSM. -* @param[in] _pOrigin Identifies the source module of the message. This could -* identify an Application, a Source, or the Source Manager. -* -* @param[in] _pDest Identifies the destination module for the message. -* This could identify an application or a data source. -* If this is NULL, the message goes to the Source Manager. -* -* @param[in] _DG The Data Group. -* Example: DG_IMAGE. -* -* @param[in] _DAT The Data Attribute Type. -* Example: DAT_IMAGEMEMXFER. -* -* @param[in] _MSG The message. Messages are interpreted by the destination module -* with respect to the Data Group and the Data Attribute Type. -* Example: MSG_GET. -* -* @param[in,out] _pData A pointer to the data structure or variable identified -* by the Data Attribute Type. -* Example: (TW_MEMREF)&ImageMemXfer -* where ImageMemXfer is a TW_IMAGEMEMXFER structure. -* -* @return a valid TWRC_xxxx return code. -* Example: TWRC_SUCCESS. -*/ -TW_UINT16 _DSM_Entry( pTW_IDENTITY _pOrigin, - pTW_IDENTITY _pDest, - TW_UINT32 _DG, - TW_UINT16 _DAT, - TW_UINT16 _MSG, - TW_MEMREF _pData); - - -/** -* Set up the EntryPoints for memory and callback -* @param[in] _pEntryPoints the structure for the entrypoints. -*/ -void setEntryPoints(pTW_ENTRYPOINT _pEntryPoints); - -/** -* Allocate global memory -* @param[in] _size of memory to allocate. -* @return TW_HANDLE to the memory allocated. -*/ -TW_HANDLE _DSM_Alloc(TW_UINT32 _size); - -/** -* Free previously allocated global memory -* @param[in] _hMemory TW_HANDLE to the memory needing free. -*/ -void _DSM_Free(TW_HANDLE _hMemory); - -/** -* Lock global memory from being updated by others. return a pointer to the -* memory so we can update it. -* @param[in] _hMemory TW_HANDLE to the memory to update. -* @return TW_MEMREF pointer to the memory. -*/ -TW_MEMREF _DSM_LockMemory(TW_HANDLE _hMemory); - -/** -* Unlock global memory after locking. to allow updating by others. -* @param[in] _hMemory TW_HANDLE to memory returned by _DSM_Alloc -*/ -void _DSM_UnlockMemory(TW_HANDLE _hMemory); - - -#endif // __DSMINTERFACE_H__ diff --git a/FeederPaper.cpp b/FeederPaper.cpp deleted file mode 100644 index 207d1cb..0000000 Binary files a/FeederPaper.cpp and /dev/null differ diff --git a/FeederPaper.h b/FeederPaper.h deleted file mode 100644 index dbf82f3..0000000 Binary files a/FeederPaper.h and /dev/null differ diff --git a/GDevice.cpp b/GDevice.cpp deleted file mode 100644 index 67fd8a5..0000000 --- a/GDevice.cpp +++ /dev/null @@ -1,553 +0,0 @@ -#include "stdafx.h" -#include "GDevice.h" -#include "IUsb.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "StopWatch.h" -#include "device_common.h" -#include "GScan200.h" - -#ifndef WIN32 - #include -#endif - -#include - -#define DSP_CODE_ADDR 0 -#define USER_ADDR 0x4000 - -using namespace std; -//class GScan200; - - -GDevice::GDevice(std::shared_ptr usb) -{ - m_bScan = false; - m_bListen = false; - m_usb = usb; - event_call = NULL; - image_call = NULL; - m_imagecall_userdata = NULL; - m_eventcall_userdata = NULL; - m_threadInt = NULL; - m_threadrecv = NULL; - m_run = false; -} - -GDevice::~GDevice() -{ - close(); -} - -bool GDevice::open() -{ - if (is_open()) - return true; - - if (m_usb && m_usb->open()) { - m_usb->set_timeout(1000); - init_cam(); - m_bListen = true; - m_bScan = true; - - if (m_threadInt) { - m_bListen = false; - m_threadInt->join(); - } - - if (m_threadrecv) { - m_bScan = false; - m_threadrecv->join(); - } - m_bListen = true; - m_bScan = true; - m_threadInt = std::shared_ptr(new std::thread(&GDevice::Int_main, this)); - m_threadrecv = std::shared_ptr(new std::thread(&GDevice::recv_main, this)); - return true; - } - return false; -} - -void GDevice::close() -{ - if (m_usb.get() && m_usb->is_open()) { - m_usb->set_timeout(100); - stop(); - - if (m_threadInt && m_threadInt->joinable()) { - m_bListen = false; - this_thread::sleep_for(std::chrono::milliseconds(100)); - XdPrint("closing m_threadInt\n"); - m_threadInt->join(); - m_threadInt = NULL; - XdPrint("close m_threadInt\n"); - } - - if (m_threadrecv && m_threadrecv->joinable()) { - m_bScan = false; - image_indexs.ShutDown(); - XdPrint("closing m_threadrecv\n"); - m_threadrecv->join(); - m_threadrecv = NULL; - XdPrint("close m_threadrecv\n"); - } - m_usb->close(); - XdPrint("close m_usb\n"); - } -} - -bool GDevice::is_open() -{ - if (m_usb.get()) - return m_usb->is_open(); - return false; -} - -bool GDevice::start(image_callback callfunc, void* userdata) -{ - if (is_run()) - return false; - - image_call = callfunc; - m_imagecall_userdata = userdata; - MotorSetting ms; - ms.value = read_reg(MOTOR_BOARD, 0x00); - ms.scan_enable = 0; - write_reg(MOTOR_BOARD, 0x00, ms.value); - ms.scan_enable = 1; - write_reg(MOTOR_BOARD, 0x00, ms.value); - m_run = true; - return true; -} - -void GDevice::set_event_call(event_callback callfunc, void* userdata) -{ - m_eventcall_userdata = userdata; - event_call = callfunc; -} - -void GDevice::stop() -{ - set_option(Cam_Options::scanner_stop_motor, 0); -} - -int GDevice::is_run() -{ - return m_run; -} - -void GDevice::reset() -{ - -} - -static std::string read_all_from(std::string path) -{ - int t; - FILE* file = fopen(path.c_str(), "rb"); - fseek(file, 0, SEEK_END); - t = ftell(file); - std::string buf(t, 0); - fseek(file, 0, SEEK_SET); - fread((void*)buf.c_str(), t, 1, file); - fclose(file); - return buf; -} - -void GDevice::write_dsp_fw(std::string path) -{ - std::string buf = read_all_from(path); - write_flash(DSP_CODE_ADDR, (void*)buf.c_str(), buf.size()); -} - -void GDevice::write_pid(unsigned short pid) -{ - write_flash(PID_ADDR, &pid, sizeof(pid)); -} - -unsigned short GDevice::read_pid() -{ - unsigned short pid; - read_flash(PID_ADDR, &pid, sizeof(pid)); - return pid; -} - - -void GDevice::write_devname(std::string name) -{ - if (name.size() > 64) - return; - - write_flash(DEVNAME_ADDR, (void*)name.c_str(), name.size()); -} - -std::string GDevice::read_devname() -{ - char devname[65] = {0}; - read_flash(DEVNAME_ADDR, devname, sizeof(devname) - 1); - return devname; -} - -bool GDevice::write_flash(unsigned int addr, void* data, int size) -{ - unsigned int writeAddr = addr; - int writed = 0; - int writing = 0; - while (writed < size) { - writing = min(crtlBufferSize, size - writed); - writeAddr = addr + writed; - { - std::lock_guard lck(m_mtxCtrl); - m_usb->control_msg(to_device, flash_access, ((Reg2Short*)&writeAddr)->short2, ((Reg2Short*)&writeAddr)->short1, writing, (unsigned char*)data + writed); - } - writed += writing; - } - return true; -} - -bool GDevice::read_flash(unsigned int addr, void* data, int size) -{ - unsigned int readAddr = addr; - int readed = 0; - int reading = 0; - while (readed < size) { - reading = min(crtlBufferSize, size - readed); - readAddr = addr + readed; - { - std::lock_guard lck(m_mtxCtrl); - m_usb->control_msg(from_device, flash_access, ((Reg2Short*)&readAddr)->short2, ((Reg2Short*)&readAddr)->short1, reading, (unsigned char*)data + readed); - } - readed += reading; - } - return true; -} - -const int int_buffer_size = 1024; -int index_count = 0; -static void write_log(std::string fullname, std::string log) -{ - std::string savepath; - savepath = fullname; - std::ofstream ofs(savepath, std::ios::app); - - SYSTEMTIME sys; - GetLocalTime(&sys); - ofs << sys.wYear << "/" << sys.wMonth << "/" << sys.wDay << " " << sys.wHour << ":" << sys.wMinute << ":" << sys.wSecond << ":" << sys.wMilliseconds << " " << log << std::endl; -} -int image_index_c = 0; -void GDevice::recv_main() -{ - const double timeout_ratio = (1000.0 / (15.0 * 1024 * 1024)); //!< s / Mbyte - int image_index = 0; - int buffer_size = 0; - int b_buffer_size = 0; - int f_buffer_size = 0; - unsigned char* bbuf = 0; - unsigned char* fbuf = 0; - unsigned char* buf; - int buffer_reading = 0; - int buffer_readed = 0; - const int read_timeout = 5000; - std::vector image_data; - StopWatch sw; - while (m_bScan) { - image_index = image_indexs.Take(); - if (!image_indexs.IsShutDown() && image_index >= 0) - { - buffer_reading = 0; - buffer_readed = 0; - buffer_size = frame_size(image_index); - image_data.resize(buffer_size * 2 + int_buffer_size); - buf = image_data.data() + int_buffer_size; - - sw.reset(); - while (sw.elapsed_ms() < read_timeout) { - while (DataOn() && sw.elapsed_ms() < read_timeout); - read_frame(image_index, buffer_readed); - buffer_reading = max(0, buffer_size - buffer_readed); - buffer_reading = read_data(buf + buffer_readed, buffer_reading, (int)(buffer_reading * timeout_ratio)); - if (buffer_reading > 0) - buffer_readed += buffer_reading; - - if (buffer_readed >= buffer_size) { - write_log("d:\\1.txt", std::to_string(image_index_c) + " time1 = " + std::to_string(sw.elapsed_ms())); - break; - } - } - - image_index_c++; - if (buffer_readed != buffer_size) - { - write_log("d:\\1.txt", std::to_string(image_index_c) + " error readed:" + std::to_string(buffer_readed) + " per read:" + std::to_string(buffer_size) + " time = " + std::to_string(sw.elapsed_ms())); - } - else { - write_log("d:\\1.txt", std::to_string(image_index_c) + " get" + " time = " + std::to_string(sw.elapsed_ms())); - } - - b_buffer_size = 0; - f_buffer_size = 0; - bbuf = buf - int_buffer_size; - fbuf = buf + buffer_size; - for (int i = 0; i < (buffer_size / int_buffer_size); i++) - { - if (buf[(i + 1) * int_buffer_size - 1] == 0) - { - memcpy(bbuf + b_buffer_size, buf + i * int_buffer_size, int_buffer_size - 1); - b_buffer_size += (int_buffer_size - 1); - } - else if (buf[(i + 1) * int_buffer_size - 1] == 255) - { - memcpy(fbuf + f_buffer_size, buf + i * int_buffer_size, int_buffer_size - 1); - f_buffer_size += (int_buffer_size - 1); - } - } - - if (image_call) - { - if ((bbuf != NULL && b_buffer_size > 0)&&(fbuf != NULL && f_buffer_size > 0)) - { - image_call(bbuf, b_buffer_size, fbuf, f_buffer_size, m_imagecall_userdata); - } - } - } - } -} - -void GDevice::Int_main() -{ - unsigned int int_buffer[4]; - int size = 0; - while (m_bListen) { - size = m_usb->read_int(int_buffer, sizeof(int_buffer)); - if (size >= 16) - { - if (int_buffer[2] != 0) - { - image_indexs.Put(int_buffer[1]); - } - MotorStatus* ms = (MotorStatus*)int_buffer; - - //int ret = get_option(Cam_Options::scanner_scan_status); - //XdPrint("scanner_scan_status %d \n",ret); - //if (!ret)//电机板工作中 - //{ - // XdPrint("scanner stoped 1\n"); - // ((GScan200*)m_eventcall_userdata)->set_scan_status(false);//停止或异常停止时,通知图像处理线程扫描仪已停止 - // m_run = false; - // XdPrint("scanner stoped 2\n"); - //} - //else - //{ - // XdPrint("scanner is scanning \n"); - //} - //if (ms->value && 0x7fe) { - // if(m_eventcall_userdata){ - // - // } - - //} - if (event_call) - { - //0x3fe ==>b 1111 1111 10 异常位高有效时 - if (ms->value & 0x3fe) { - ((GScan200*)m_eventcall_userdata)->set_scan_status(false); - event_call(ms->value, m_eventcall_userdata); - m_run = false; - XdPrint("scanner have error stoped \n"); - } - } - } - int ret = get_option(Cam_Options::scanner_scan_status); - if (m_run&&!ret)//电机板工作中 - { - XdPrint("scanner stoped 1\n"); - ((GScan200*)m_eventcall_userdata)->set_scan_status(false);//停止或异常停止时,通知图像处理线程扫描仪已停止 - m_run = false; - XdPrint("scanner stoped 2\n"); - } - } -} - -void GDevice::init_cam() -{ -} - -int GDevice::read_data(void* data, int length, int timeout) -{ - int readed = 0; - int reading = 0; - StopWatch sw; - while (readed < length && sw.elapsed_ms() < timeout) { - reading = max(0, min(length - readed, buffer_size)); - reading = m_usb->read_bulk((unsigned char*)data + readed, reading); - if (reading > 0) { - readed += reading; - } - } - return readed; -} - -void GDevice::read_frame(int index, int offset) -{ - write_reg(3, index, offset); -} - -int GDevice::frame_size(int index) -{ - return read_reg(3, index); -} - -int GDevice::read_reg(int type, int addr) -{ - int value; - std::lock_guard lck(m_mtxCtrl); - m_usb->control_msg(from_device, regs_access, type, addr, sizeof(value), &value); - return value; -} - - -void GDevice::write_reg(int type, int addr, int value) -{ - std::lock_guard lck(m_mtxCtrl); - m_usb->control_msg(to_device, regs_access, type, addr, sizeof(value), &value); -} - -void GDevice::set_option(Cam_Options option, unsigned int value) -{ - unsigned int val = 0; - switch (option) - { - case scanner_config: - write_reg(USERDEFINE, ModeParam, value); - break; - case scanner_scan_skrew: - val = read_reg(MOTOR_BOARD, 0x00); - ((MotorSetting*)& val)->skew_enable = value; - write_reg(MOTOR_BOARD, 0x00, val); - break; - case scanner_stample_enable: - val = read_reg(MOTOR_BOARD, 0x00); - ((MotorSetting*)& val)->staple_enable = value; - write_reg(MOTOR_BOARD, 0x00, val); - break; - case scanner_doublePape_enable: - val = read_reg(MOTOR_BOARD, 0x00); - ((MotorSetting*)& val)->double_paper = value; - write_reg(MOTOR_BOARD, 0x00, val); - break; - case scanner_stop_motor: - val = read_reg(MOTOR_BOARD, 0x00); - ((MotorSetting*)& val)->scan_enable = value; - write_reg(MOTOR_BOARD, 0x00, val); - break; - case scanner_error_clean: - val = read_reg(MOTOR_BOARD, 0x00); - ((MotorSetting*)& val)->error_clean = value; - write_reg(MOTOR_BOARD, 0x00, val); - break; - case scanner_Init_Status: - val = read_reg(MOTOR_BOARD, 0x00); - ((MotorSetting*)& val)->status_init = value; - write_reg(MOTOR_BOARD, 0x00, val); - break; - case scanner_IIC_Config: - val = read_reg(MOTOR_BOARD, 0x00); - ((MotorSetting*)& val)->iic_config = value; - write_reg(MOTOR_BOARD, 0x00, val); - break; - case scanner_Speed_Config: - val = read_reg(MOTOR_BOARD, 0x00); - ((MotorSetting*)& val)->speed_set_enable = value; - write_reg(MOTOR_BOARD, 0x00, val); - break; - default: - break; - } -} - -int GDevice::get_option(Cam_Options option) -{ - int value = 0; - switch (option) - { - case scanner_cover_status: - value = read_reg(1, 0x01); - value = ((MotorStatus*)& value)->open_machine; - break; - case scanner_pick_paper_stauts: - value = read_reg(1, 0x01); - value = ((MotorStatus*)& value)->pick_failed; - break; - case scanner_jam_stauts: - value = read_reg(1, 0x01); - value = ((MotorStatus*)& value)->stop_jam; - break; - case scanner_paper_count: - value = read_reg(1, 0x02); - value = ((MotorMode*)& value)->scan_num; - break; - case scanner_double_paper: - value = read_reg(1, 0x01); - value= ((MotorStatus*)& value)->double_paper; - break; - case scanner_staple_state: - value = read_reg(1, 0x01); - value = ((MotorStatus*)& value)->staple; - break; - case scanner_skrew_state: - value = read_reg(1, 0x01); - value = ((MotorStatus*)& value)->papertilted; - break; - case scanner_paper_have: - value = read_reg(MOTOR_BOARD, 0x02); - value = ((Motor_Mode*)& value)->feeding_paper_ready; - break; - case scanner_scan_status: - value = read_reg(MOTOR_BOARD, 0x02); - value = ((Motor_Mode*)& value)->scan_status; - break; - default: - break; - } - return value; -} - -std::vector GDevice::support_options() -{ - std::set options; - options.insert(Cam_Options::scanner_exposure_blue); - options.insert(Cam_Options::scanner_exposure_gray); - options.insert(Cam_Options::scanner_exposure_red); - - return std::vector(options.begin(), options.end()); -} - -void GDevice::pick_paper(void) -{ - MotorSetting ms; - ms.value = read_reg(MOTOR_BOARD, 0x00); - ms.pick_paper = 0; - write_reg(MOTOR_BOARD, 0x00, ms.value); - ms.pick_paper = 1; - write_reg(MOTOR_BOARD, 0x00, ms.value); -} - -void GDevice::trigger_scan(void) -{ - ScanTriger st; - st.value = 0; - write_reg(MAIN_BOARD, 0x02, st.value); - st.triger = 1; - write_reg(MAIN_BOARD, 0x02, st.value); -} - -bool GDevice::DataOn() -{ - return read_reg(USERDEFINE, IMAGEREGS); -} diff --git a/GDevice.h b/GDevice.h deleted file mode 100644 index 723a004..0000000 --- a/GDevice.h +++ /dev/null @@ -1,88 +0,0 @@ -#pragma once -#include "IGDevice.h" -#include -#include -#include -#include "BlockingQueue.h" -#include - -class IUsb; -class GDevice : public IGDevice -{ -public: - GDevice(std::shared_ptr usb); - virtual ~GDevice(); - // 通过 IGDevice 继承 - virtual bool open() override; - virtual void close() override; - virtual bool is_open() override; - bool start(image_callback callfunc, void* userdata); - void set_event_call(event_callback event_callfunc, void* userdata); - virtual void stop() override; - virtual int is_run() override; - virtual void reset() override; - - void write_dsp_fw(std::string path); - - void write_devname(std::string name); - std::string read_devname(); - - void write_reg(int type, int addr, int value); - int read_reg(int type, int addr); - - bool write_flash(unsigned int addr, void* data, int size); - bool read_flash(unsigned int addr, void* data, int size); - - void trigger_scan(void); - - void write_pid(unsigned short pid); - unsigned short read_pid(); - -private: - void recv_main(); - void Int_main(); - - void init_cam(); - - int read_data(void* data, int lenght, int timeout); - void read_frame(int index, int offset); - int frame_size(int index); - - - - - void pick_paper(void); - - bool DataOn(); - - std::shared_ptr m_usb; - const int buffer_size = 1204 * 1024; - const int crtlBufferSize = 512; - volatile bool m_bScan; - volatile bool m_bListen; - - std::shared_ptr m_threadInt; - std::shared_ptr m_threadrecv; - std::mutex m_mtxInt; - std::mutex m_mtxCtrl; - image_callback image_call; - event_callback event_call; - const int to_device = 0x40; - const int from_device = 0xc0; - const int regs_access = 0x0c; - const int flash_access = 0x04; - - const int regs_req = 0x0c; - - BlockingQueue image_indexs; - - void* m_imagecall_userdata; - void* m_eventcall_userdata; - volatile bool m_run; - - - // 通过 IGDevice 继承 - virtual void set_option(Cam_Options option,unsigned int value) override; - virtual int get_option(Cam_Options option) override; - virtual std::vector support_options() override; -}; diff --git a/GDeviceLists.cpp b/GDeviceLists.cpp deleted file mode 100644 index 4e07457..0000000 --- a/GDeviceLists.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "stdafx.h" -#include "GDeviceLists.h" -#include "UsbScanEx.h" -#include "GDevice.h" - - - std::list> HGDeviceLists::FindAll() - { - std::list> cameraLists; - - // std::list> usbs = CyUsbList::find_vid_pid(0x04b4, 0x1004); - std::list> usbs = UsbScan_List::find_vid_pid(0x064b, 0x7823); - - - for (auto i = usbs.begin(); i != usbs.end(); i++) - cameraLists.push_back(std::shared_ptr(new GDevice(*i))); - - return cameraLists; - } diff --git a/GDeviceLists.h b/GDeviceLists.h deleted file mode 100644 index 8d19ad9..0000000 --- a/GDeviceLists.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once -#include -#include - - -class IGDevice; - -class HGDeviceLists -{ -public: - static std::list> FindAll(); -}; diff --git a/GScan200.cpp b/GScan200.cpp deleted file mode 100644 index 0bedd78..0000000 --- a/GScan200.cpp +++ /dev/null @@ -1,189 +0,0 @@ -#include "stdafx.h" -#include "GScan200.h" -#include "GDeviceLists.h" -#include "IGDevice.h" -#include "opencv2/opencv.hpp" -#include "twain.h" -#include "config_new.h" -#include "device_common.h" -#include "GDevice.h" - -GScan200::GScan200() -{ -} - -GScan200::~GScan200() -{ - if (!error_msg.IsShutDown()) - error_msg.ShutDown(); - XdPrint("closed GScan200\n"); -} - -void GScan200::open(int vid, int pid) -{ - auto devs = HGDeviceLists::FindAll(); - if(!devs.empty()){ - m_dev = *(devs.begin()); - m_dev->open(); - } -} - -int GScan200::aquire_image(cv::Mat& image) -{ - while (true) { - if (m_dev && Get_IsImageQueueEmpty()) { - DoEvents(); - if (!is_scan()) - { - if (error_msg.Size()>0) - { - return error_msg.Take(); - } - return 0; - } - } - else { - if (m_pImages.valid()) { - image = popMat(); - return 0; - } - } - } - return 0; -} - -BOOL GScan200::IsConnected() -{ - return m_dev && m_dev->is_open(); -} - -std::string GScan200::GetFWVersion() -{ - if (fwVersion.empty()) { - fwVersion.resize(8); - ((GDevice*)(m_dev.get()))->read_flash(FWVERSION_ADDR, (void*)(fwVersion.data()), FLASH_FWVERSION_ADDR_SIZE); - } - return fwVersion; -} - -std::string GScan200::GetSerialNum() -{ - if (SerialNum.empty()) { - SerialNum.resize(12); - ((GDevice*)(m_dev.get()))->read_flash(SERIAL_ADDR, (void*)(SerialNum.data()), FLASH_SERIAL_ADDR_SIZE); - } - return SerialNum; -} - -bool GScan200::is_scan() -{ - return m_dev && m_dev->is_run(); -} - -BOOL GScan200::Get_Scanner_PaperOn() -{ - return m_dev->get_option(Cam_Options::scanner_paper_have); -} - -void GScan200::config_params(SFreeImage& params) -{ - config_new cfn(params); - unsigned int cfg_value=cfn.GetData(); - m_dev->set_option(Cam_Options::scanner_config, cfg_value); - m_pImages.setparam(params); -} - -void GScan200::Scanner_StartScan(UINT16 count) -{ - m_dev->start(image_call_s, this); - m_dev->set_event_call(event_call_g200, this); - m_pImages.SetScanningStatus(true); -} - -void GScan200::Stop_scan() -{ - m_dev->stop(); -} - -void GScan200::ResetScanner() -{ - -} - -bool GScan200::Get_IsImageQueueEmpty() -{ - return m_pImages.empty(); -} - -void GScan200::reset() -{ - if (m_dev) { - m_dev->stop(); - this_thread::sleep_for(chrono::milliseconds(200)); - m_pImages.clear(); - } -} - -void GScan200::setdecodepixtype(int twpixtype) -{ - pixType = (twpixtype == TWPT_RGB) ? TJPF_BGR : TJPF_GRAY; -} - -UINT32 GScan200::get_ErrorCode() -{ - return UINT32(); -} - -void GScan200::Set_ErrorCode(UINT32 value) -{ - error_msg.Clear(); -} - -int GScan200::get_scanned_num() -{ - int scanned_count = 0; - ((GDevice*)(m_dev.get()))->read_flash(CONT_ADDR, &scanned_count, FLASH_CONT_ADDR_SIZE); - return scanned_count; -} - -void GScan200::set_scan_status(bool isscan) -{ - m_pImages.SetScanningStatus(isscan); -} - -void GScan200::image_call_s(void* fdata, int fsize, void* bdata, int bsize, void* userdata) -{ - GScan200* This = (GScan200*)userdata; - This->image_call(fdata, fsize, bdata, bsize); -} - -void GScan200::event_call_g200(int error_value, void* userdata) -{ - GScan200* This = (GScan200*)userdata; - if (!This->error_msg.IsShutDown()) - { - MotorStatus ms; - ms.value = error_value; - if (ms.double_paper == 1) { This->error_msg.Put(DETECT_DOUBLE_FEED); };//error_msg.Put(DETECT_DOUBLE_FEED); - if (ms.open_machine == 1) { This->error_msg.Put(OPEN_COVER); };//error_msg.Put(OPEN_COVER); - if (ms.m1_paper_sin == 1) { This->error_msg.Put(NO_FEED); };//error_msg.Put(NO_FEED); - if (ms.pick_failed == 1) { This->error_msg.Put(FEED_IN_ERROR); };//error_msg.Put(FEED_IN_ERROR); - if (ms.stop_jam == 1) { This->error_msg.Put(PAPER_JAM); };//error_msg.Put(PAPER_JAM); - if (ms.staple == 1) { This->error_msg.Put(DETECT_STAPLE); };//error_msg.Put(DETECT_STAPLE); - if (ms.scan_mode_change == 1) { This->error_msg.Put(DETECT_STAPLE); };//error_msg.Put(DETECT_STAPLE); - if (ms.papertilted == 1) { This->error_msg.Put(PAPER_SKEW); };//error_msg.Put(PAPER_SKEW); - } -} - -void GScan200::image_call(void* fdata, int fsize, void* bdata, int bsize) -{ - if (fdata && fsize && bdata && bsize) - { - cv::Mat fmat(1, fsize, CV_8UC1, fdata); - cv::Mat bmat(1, bsize, CV_8UC1, bdata); - std::vector mats; - mats.push_back(fmat.clone()); - mats.push_back(bmat.clone()); - m_pImages.pushMat(JpegBuffer(mats, pixType, 0)); - } -} diff --git a/GScan200.h b/GScan200.h deleted file mode 100644 index 29665b7..0000000 --- a/GScan200.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once -#include "gscn_drv.h" -#include - -class IGDevice; - -class GScan200 : public IGScan, GScn_Drv -{ -public: - GScan200(); - virtual ~GScan200(); - virtual void open(int vid, int pid) override; - virtual int aquire_image(cv::Mat &image) override; - virtual BOOL IsConnected() override; - virtual std::string GetFWVersion() override; - virtual std::string GetSerialNum() override; - virtual bool is_scan() override; - virtual BOOL Get_Scanner_PaperOn() override; - virtual void config_params(SFreeImage ¶ms) override; - virtual void Scanner_StartScan(UINT16 count) override; - virtual void Stop_scan() override; - virtual void ResetScanner() override; - virtual bool Get_IsImageQueueEmpty() override; - virtual void reset() override; - virtual void setdecodepixtype(int twpixtype) override; - virtual UINT32 get_ErrorCode() override; - virtual void Set_ErrorCode(UINT32 value) override; - virtual int get_scanned_num() override; - void set_scan_status(bool isscan); -private: - static void image_call_s(void *fdata, int fsize, void *bdata, int bsize, void *userdata); - static void event_call_g200(int error_value, void* userdata); - void image_call(void *fdata, int fsize, void *bdata, int bsize); - BlockingQueue error_msg; - std::shared_ptr m_dev; -}; diff --git a/GScanO200.cpp b/GScanO200.cpp deleted file mode 100644 index 479b770..0000000 --- a/GScanO200.cpp +++ /dev/null @@ -1,351 +0,0 @@ -#include "stdafx.h" -#include "GScanO200.h" -#include "UsbScanEx.h" -#include "opencv2/opencv.hpp" -#include "twain.h" -#include "UsbScanEx.h" -#include "StopWatch.h" - -GScanO200::GScanO200() -{ -} - -GScanO200::~GScanO200() -{ - if (m_threadUsb && m_threadUsb->joinable()) { - devState = DEV_STOP; - m_threadUsb->join(); - m_threadUsb.reset(); - } -} - -void GScanO200::open(int vid, int pid) -{ - auto usbs = UsbScan_List::find_vid_pid(vid, pid); - - if (!usbs.empty()) { - m_usb = *usbs.begin(); - m_usb->open(); - } -} - -int GScanO200::aquire_image(cv::Mat& image) -{ - StopWatch sw; - sw.reset(); - double timeout; - while (true) - { - if (Get_IsImageQueueEmpty()) - { - DoEvents(); - if (sw.elapsed_s() > 15.00) - { - if (m_threadUsb && m_threadUsb->joinable()) { - devState = DEV_STOP; - m_threadUsb->join(); - m_threadUsb.reset(); - } - m_pImages.release_img_prc_thread();//释放图像处理线程 - Stop_scan();//停止扫描 - ResetScanner(); - return HARDWARE_ERROR; - } - - if (!is_scan()) - { - if (devState == DEV_WRONG) - { - return get_ErrorCode(); - } - return 0; - } - } - else - { - - if (m_pImages.valid()) - { - image = popMat(); - return 0; - } - } - } -} - -BOOL GScanO200::IsConnected() -{ - return m_usb && m_usb->is_connected(); -} - -std::string GScanO200::GetFWVersion() -{ - if (m_usb&&m_usb->is_connected()) - { - lock_guard< mutex> lock(m_imgLocker); - if (fwVersion.empty()) { - fwVersion = " "; - USBCB cmd= { GET_FW_VERSION,8,0,}; - m_usb->write_bulk(&cmd, sizeof(cmd)); - m_usb->read_bulk(&fwVersion[0], 8); - } - return fwVersion; - } - return ""; -} - -std::string GScanO200::GetSerialNum() -{ - if (m_usb->is_connected()) - { - std::lock_guard lck(m_imgLocker); - if (SerialNum.empty()) - { - SerialNum = " "; - USBCB usbcb = { GET_SERIAL,12,0 }; - m_usb->write_bulk(&usbcb, sizeof(usbcb)); - m_usb->read_bulk(&SerialNum[0], 12); - } - return SerialNum; - } - return ""; -} - -bool GScanO200::is_scan() -{ - std::lock_guard lck(m_imgLocker); - return devState == DEV_ISRUNNING; -} - -BOOL GScanO200::Get_Scanner_PaperOn() -{ - if (!m_usb->is_open()) - { - return FALSE; - } - USBCB usbcb = { GET_PAPER_STATUS ,0,0 }; - std::lock_guard lck(m_imgLocker); - m_usb->write_bulk(&usbcb, sizeof(usbcb)); - m_usb->read_bulk(&usbcb, sizeof(usbcb)); - return usbcb.u32_Data != 0; -} - -void GScanO200::config_params(SFreeImage& params) -{ - if (m_usb->is_connected()) - { - hgConfigClass cfg(params); - UINT32 cfgdata = cfg.GetData(); - USBCB usbcb = { CONFIGURED_DATA,cfgdata,0 }; - m_usb->write_bulk(&usbcb, sizeof(USBCB)); - setdecodepixtype(params.m_HardWareParams.PixType); - m_pImages.setparam(params); - } -} - -void GScanO200::Scanner_StartScan(UINT16 count) -{ - if (m_usb->is_connected()) - { - std::lock_guard lck(m_imgLocker); - USBCB usbcb = { START_COMMAND,(UINT32)count ,0 }; - m_usb->write_bulk(&usbcb, sizeof(usbcb)); - if (m_threadUsb && m_threadUsb->joinable()) { - m_threadUsb->join(); - } - m_threadUsb.reset(new std::thread(&GScanO200::usbmain, this)); - m_pImages.SetScanningStatus(true); - m_pImages.run(); - } -} - -void GScanO200::Stop_scan() -{ - if (!m_usb->is_connected()) - { - return; - } - std::lock_guard lck(m_imgLocker); - USBCB usbcb = { STOP ,0,0 }; - m_usb->write_bulk(&usbcb, sizeof(usbcb)); -} - -void GScanO200::ResetScanner() -{ - if (!m_usb->is_connected()) - return; - - std::lock_guard lck(m_imgLocker); - USBCB usbcb = { INIT_HARDWARE_SYS ,0,0 }; - m_usb->write_bulk(&usbcb, sizeof(usbcb)); -} - -bool GScanO200::Get_IsImageQueueEmpty() -{ - std::lock_guard lck(m_imgLocker); - return m_pImages.empty(); -} - -void GScanO200::reset() -{ - std::lock_guard lck(m_imgLocker); - while (!m_pImages.empty()) - { - m_pImages.clear(); - } -} - -void GScanO200::setdecodepixtype(int twpixtype) -{ - if (twpixtype == TWPT_RGB) - pixType = TJPF_BGR; - else - pixType = TJPF_GRAY; -} - -UINT32 GScanO200::get_ErrorCode() -{ - std::lock_guard lck(m_imgLocker); - return Error_Code; -} - -void GScanO200::Set_ErrorCode(UINT32 value) -{ - std::lock_guard lck(m_imgLocker); - Error_Code = value; -} - -int GScanO200::get_scanned_num() -{ - if (!m_usb->is_connected()) - return -1; - - std::lock_guard lck(m_imgLocker); - USBCB usbcb = { GET_SCANN_NUM ,0,0 }; - m_usb->write_bulk(&usbcb, sizeof(usbcb)); - return usbcb.u32_Count; -} - -DWORD GScanO200::usbmain() -{ - cv::Mat imgData; - cv::Mat bufferF; - cv::Mat bufferB; - devState = DEV_ISRUNNING; - while (devState == DEV_ISRUNNING) - { - if (!m_usb->is_connected()) - { - this_thread::sleep_for(chrono::milliseconds(200)); - continue; - } - USBCB usbcb = Get_Scanner_Status(); - switch (usbcb.u32_Data) - { - case HAVE_IMAGE: - { - int totalNum = usbcb.u32_Count; - DWORD transferCount = 0; - imgData = Get_Img_Data(totalNum); - if (imgData.empty()) { //!< transfer data error - Stop_scan(); - } - - bufferF = cv::Mat(imgData.rows, imgData.cols, CV_8UC1); - bufferB = cv::Mat(imgData.rows, imgData.cols, CV_8UC1); - 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); - } - } - vector mats; - mats.push_back(bufferB); - mats.push_back(bufferF); - pushMat(JpegBuffer(mats, pixType, 0)); - imgData.release(); - bufferB.release(); - bufferF.release(); - Pop_Image(); - break; - } - case STOP_SCAN: - { - m_pImages.SetScanningStatus(false); - devState = DEV_STOP; - break; - } - case COUNT_MODE: - case NO_FEED: - case OPEN_COVER: - case FEED_IN_ERROR: - case PAPER_JAM: - case DETECT_DOUBLE_FEED: - case DETECT_STAPLE: - case PAPER_SKEW: - case HARDWARE_ERROR: - case PC_SCAN_BUSY_or_ERROR: - m_pImages.SetScanningStatus(false); - Set_ErrorCode(usbcb.u32_Data); - devState = DEV_WRONG; - break; - case NORMAL: - break; - default: - break; - } - this_thread::sleep_for(chrono::milliseconds(20)); - } - return 0; -} - -/////////////////////////////////////////////////////////////////////////// -USBCB GScanO200::Get_Scanner_Status() -{ - if (!m_usb->is_connected()) - { - USBCB errorType = { NO_COMMAND ,PC_SCAN_BUSY_or_ERROR ,0 }; - return errorType; - } - USBCB usbcb = { GET_DSP_STATUS ,0,0 }; - m_usb->write_bulk(&usbcb, sizeof(usbcb)); - m_usb->read_bulk(&usbcb, sizeof(usbcb)); - return usbcb; -} - -cv::Mat GScanO200::Get_Img_Data(int bufferSize) -{ - cv::Mat iData(1, bufferSize, CV_8UC1); - StopWatch sw; - int readed = 0; - while (readed < bufferSize && sw.elapsed_ms() < 3000){ - USBCB usbcb = { GET_IMAGE,0,(UINT32)bufferSize }; - m_usb->write_bulk(&usbcb, sizeof(usbcb)); - readed = m_usb->read_bulk(iData.data, bufferSize); - } - - if (sw.elapsed_ms() > 3000) - return cv::Mat(); - - return iData; -} - -/////////////////////////////////////////////////////////////////////////// -void GScanO200::Pop_Image() -{ - if (!m_usb->is_open()) - { - return; - } - USBCB usbcb = { POP_IMAGE ,0,0 }; - m_usb->write_bulk(&usbcb, sizeof(usbcb)); -} diff --git a/GScanO200.h b/GScanO200.h deleted file mode 100644 index 53335fe..0000000 --- a/GScanO200.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once -#include "gscn_drv.h" -#include - - -class GScanO200 : public IGScan, GScn_Drv -{ -public: - GScanO200(); - virtual ~GScanO200(); - // 通过 IGScan 继承 - virtual void open(int vid, int pid) override; - virtual int aquire_image(cv::Mat& image) override; - virtual BOOL IsConnected() override; - virtual std::string GetFWVersion() override; - virtual std::string GetSerialNum() override; - virtual bool is_scan() override; - virtual BOOL Get_Scanner_PaperOn() override; - virtual void config_params(SFreeImage& params) override; - virtual void Scanner_StartScan(UINT16 count) override; - virtual void Stop_scan() override; - virtual void ResetScanner() override; - virtual bool Get_IsImageQueueEmpty() override; - virtual void reset() override; - virtual void setdecodepixtype(int twpixtype) override; - virtual UINT32 get_ErrorCode() override; - virtual void Set_ErrorCode(UINT32 value) override; - virtual int get_scanned_num() override; -private: - DWORD usbmain(); - USBCB Get_Scanner_Status(); - cv::Mat Get_Img_Data(int buffersize); - void Pop_Image(); - - std::shared_ptr m_usb; - std::unique_ptr m_threadUsb; -}; - diff --git a/HUAGO-LOGO-for UI.bmp b/HUAGO-LOGO-for UI.bmp deleted file mode 100644 index 090f567..0000000 Binary files a/HUAGO-LOGO-for UI.bmp and /dev/null differ diff --git a/IConfig.h b/IConfig.h deleted file mode 100644 index c369b59..0000000 --- a/IConfig.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -class IConfig -{ -public: - IConfig(void) {}; - virtual ~IConfig(void) {}; - virtual unsigned int GetData() = 0; -}; - diff --git a/IGDevice.h b/IGDevice.h deleted file mode 100644 index f23ede9..0000000 --- a/IGDevice.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once -#include - - -typedef void(*image_callback)(void*, int, void*, int, void*); -typedef void(*event_callback)(int, void*); - -enum Cam_Options { - scanner_config, //!< color, gray - scanner_exposure_gray, - scanner_exposure_green, - scanner_exposure_blue, - scanner_exposure_red, - scanner_status, - scanner_ad_gain, - scanner_ad_offset, - scanner_cover_status, //是否关闭盖子 - scanner_pick_paper_stauts, //是否搓纸失败 - scanner_jam_stauts, //是否卡纸 - scanner_paper_count, //扫描计数值 - scanner_trigger_scan, //触发扫描 - scanner_staple_state, //有无订书钉 - scanner_skrew_state, //歪斜状态 - scanner_paper_have, //有无纸张 - scanner_double_paper, //双张检测 - scanner_scan_triger,//扫描状态,1停止扫描,0正在扫描 - scanner_scan_skrew, //歪斜检测开关,1开,0关 - scanner_stample_enable, //订书钉检测使能,0:default;1:订书钉检测使能 - scanner_doublePape_enable,//双张检测使能 - scanner_stop_motor, //停止电机 - scanner_error_clean ,//异常清除 - scanner_Init_Status, //状态初始化使能 - scanner_IIC_Config, //IIC配置使能 - scanner_Speed_Config, //速度配置使能 - scanner_scan_status -}; - -class IGDevice -{ -public: - virtual ~IGDevice() {} - virtual bool open() = 0; - virtual void close() = 0; - virtual bool is_open() = 0; - virtual bool start(image_callback imagecall= NULL, void* userdata = NULL) = 0; - virtual void stop() = 0; - virtual int is_run() = 0; - virtual void reset() = 0; - virtual void set_event_call(event_callback event_callfunc, void* userdata) = 0; - virtual void set_option(Cam_Options option, unsigned int value) = 0; - virtual int get_option(Cam_Options option) = 0; - virtual std::vector support_options() = 0; -}; - diff --git a/IUsb.h b/IUsb.h deleted file mode 100644 index a7c3265..0000000 --- a/IUsb.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once -class IUsb -{ -public: - virtual ~IUsb() {} - virtual bool open() = 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; -}; \ No newline at end of file diff --git a/ImageApplyHeaders.h b/ImageApplyHeaders.h deleted file mode 100644 index 7768730..0000000 --- a/ImageApplyHeaders.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef IMAGE_APPLY_HEADER_H -#define IMAGE_APPLY_HEADER_H - -#include "ImageApply.h" -#include "ImageApplyAdjustColors.h" - - -#endif diff --git a/ImageMatQueue.cpp b/ImageMatQueue.cpp deleted file mode 100644 index 73951fd..0000000 --- a/ImageMatQueue.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include "StdAfx.h" -#include "ImageMatQueue.h" -#include "PublicFunc.h" -#include "filetools.h" -#include "ImageProcess/ImageApplyHeaders.h" -#include "ImageMultiOutput.h" - -using namespace cv; -using namespace std; - -#define DECODE_COLOR_BGR 1 -#define DECODE_GRAY 6 - -ImageMatQueue::ImageMatQueue(void) - : bRun(false), iscanning(false) -{ - bRun = true; - at_prced_image_remains = 0; - atm_orgin_image_remains = 0; - m_threadProc.reset(new thread(&ImageMatQueue::proc, this)); -} - -void ImageMatQueue::run() -{ -} - -ImageMatQueue::~ImageMatQueue(void) -{ - m_pImages.ShutDown(); - m_images.ShutDown(); - if (m_threadProc) { - bRun = false; - at_prced_image_remains = 0; - atm_orgin_image_remains = 0; - XdPrint("closeing m_threadProc\n"); - m_threadProc->join(); - m_threadProc = NULL; - XdPrint("closed m_threadProc\n"); - } -} - -void ImageMatQueue::pushMat(JpegBuffer& data) -{ - std::lock_guard lock(m_mtxJB); - m_pImages.Put(data); - atm_orgin_image_remains++; -} -static int outnum =0; -cv::Mat ImageMatQueue::popMat() -{ - std::lock_guard lock(m_mtxJB); - cv::Mat mat = _popMat(); - XdPrint("dequeue image %d \n", outnum++); - at_prced_image_remains--; - return mat; -} - -bool ImageMatQueue::valid() -{ - return (at_prced_image_remains != 0); -} - -void ImageMatQueue::clear() -{ - m_images.Clear(); - m_pImages.Clear(); - at_prced_image_remains = 0; - atm_orgin_image_remains = 0; -} - -void ImageMatQueue::setparam(SFreeImage param) -{ - scanParam = param; - m_iaList.clear(); - if (param.m_bAutoDiscardBlank || param.m_bAutoDiscardBlankInvoice) - m_iaList.push_back(shared_ptr(new CImageApplyDiscardBlank(param.m_bAutoDiscardBlank ? true : false))); - - { - CSize fixedSize = papersize.GetPaperSize(param.m_HardWareParams.PaperType, 200.0f); - m_iaList.push_back(shared_ptr(new CImageApplyAutoCrop(param.m_bAutoCrop, param.m_bFillBlackRect, param.m_bAutoDeskew, cv::Size(fixedSize.cx, fixedSize.cy)))); - } - - if (param.m_nPixelType != 0) //sharpen - m_iaList.push_back(shared_ptr(new CImageApplySharpen())); - - if (param.m_nFilter) - m_iaList.push_back(shared_ptr(new CImageApplyChannel(param.m_nFilter))); - - if (param.m_fBrightness != 0 || param.m_fContrast != 0 || param.m_fGamma != 1.0) - m_iaList.push_back(shared_ptr(new CImageApplyAdjustColors(param.m_fBrightness, param.m_fContrast, param.m_fGamma))); - - if (param.m_fXResolution != 200.0) - { - CSize dSize = papersize.GetPaperSize(param.m_HardWareParams.PaperType, param.m_fXResolution); - CImageApplyResize* apply = new CImageApplyResize(); - apply->setType(CImageApplyResize::DSIZE); - apply->setDSize(cv::Size(dSize.cx, dSize.cy)); - m_iaList.push_back(shared_ptr< CImageApply>(apply)); - } - - if (param.m_wRotation != 0 || param.m_bBackRotate180) - m_iaList.push_back(shared_ptr(new CImageApplyRotation(param.m_wRotation, param.m_bBackRotate180))); -} - -cv::Mat ImageMatQueue::_popMat() -{ - return m_images.Take(); -} - -void ImageMatQueue::EnqueueMat(cv::Mat &mat) -{ - std::lock_guard lock(m_Locker); - m_images.Put(mat); - at_prced_image_remains++; -} - -void ImageMatQueue::PaniusCount() -{ - std::lock_guard lock(m_Locker); - atm_orgin_image_remains--; -} - -void ImageMatQueue::SetScanningStatus(bool isscannning) -{ - std::lock_guard lock(m_mtxscan); - iscanning = isscannning; -} - -void ImageMatQueue::release_img_prc_thread() -{ - if (m_threadProc) { - bRun = false; - at_prced_image_remains = 0; - atm_orgin_image_remains = 0; - m_threadProc->join(); - m_threadProc = NULL; - iscanning = false; - } -} - -bool ImageMatQueue::empty() -{ - bool ret= ((atm_orgin_image_remains == 0 && - at_prced_image_remains == 0) && (!iscanning)); - return ret; -} - -static int index=0; -void ImageMatQueue::proc() -{ - JpegBuffer jb; - while (bRun) { - if (m_pImages.Size() <= 0) - { - continue; - } - jb = m_pImages.Take(); - if (!m_pImages.IsShutDown() && !jb.empty()) { - vector mats = jb.getMats(); - //if (scanParam.m_OutHole.EnOutHole && mats.size() == 2){ //确保能够获取正反两面图 - // if (!mats[0].empty() && !mats[1].empty()) - // ImageOutHole().puncture(mats[0], mats[1], 50.0, scanParam.m_OutHole.OutHoleRatio / 100.0, 50); - //} - - for (int i = 0; i < mats.size(); i++) { - if (!mats[i].empty()) { - for (int j = 0; j < m_iaList.size(); j++) { - if (mats[i].empty())//剔除空白页 - break; - - m_iaList[j]->apply(mats[i], i); - } - } - } - - for (int i = 0; i < mats.size(); i++) { - //if (!scanParam.m_bDuplex && i == 1) { - // mats[i].release(); - // break; - //} - - if (!mats[i].empty()){ - EnqueueMat(mats[i]); - XdPrint("enqueue image %d \n", index++); - } - } - - //if (scanParam.m_bMultiOutput) - //{ - // for (int i = 0; i < mats.size(); i++) - // { - // ImageMultiOutput m_mlt; - // Mat m_filterMat = m_mlt.GetMultiFilterMat(mats[i], 2); - // if (!m_filterMat.empty()) { - // if (!scanParam.m_bDuplex && i == 1) { - // mats[i].release(); - // break; - // } - - // if (!m_filterMat.empty()) - // EnqueueMat(m_filterMat); - // } - // } - //} - PaniusCount(); - } - jb = JpegBuffer(); - } -} \ No newline at end of file diff --git a/ImageMatQueue.h b/ImageMatQueue.h deleted file mode 100644 index c26e06d..0000000 --- a/ImageMatQueue.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once -//#include -#include -#include -#include -#include "JpegBuffer.h" -#include -#include "ImageProcess/ImageApplyHeaders.h" -#include "PublicFunc.h" -#include "BlockingQueue.h" -#include -#include -#include "PaperSize.h" -#include - -class ImageMatQueue -{ -public: - ImageMatQueue(void); - virtual ~ImageMatQueue(void); - - void pushMat(JpegBuffer& data); - cv::Mat popMat(); - bool empty(); - bool valid(); - void clear(); - void setparam(SFreeImage param); - void run(); -public: - void SetScanningStatus(bool isscannning); - void release_img_prc_thread(); -private: - void proc(); - cv::Mat _popMat(); - void EnqueueMat(cv::Mat &mat); - void PaniusCount(); - BlockingQueue m_images; - BlockingQueue m_pImages; - std::mutex m_Locker; - std::mutex m_mtxJB; - std::mutex m_mtxscan; - std::unique_ptr m_threadProc; - volatile bool bRun; - bool isduplex; - std::atomic at_prced_image_remains; - std::atomic atm_orgin_image_remains; - SFreeImage scanParam; - bool iscanning; - PaperSize papersize; - std::vector> m_iaList; -}; - diff --git a/ImageMultiOutput.cpp b/ImageMultiOutput.cpp deleted file mode 100644 index 44dc8cf..0000000 --- a/ImageMultiOutput.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "StdAfx.h" -#include "ImageMultiOutput.h" - - -ImageMultiOutput::ImageMultiOutput(void) -{ -} - - -ImageMultiOutput::~ImageMultiOutput(void) -{ -} - -//void ImageMultiOutput::apply(cv::Mat& pDib,int side) -//{ -// //throw std::logic_error("The method or operation is not implemented."); -//} - -cv::Mat ImageMultiOutput::GetMultiFilterMat(cv::Mat &src,int channel) -{ - return FilterColor(src,channel); -} - -cv::Mat ImageMultiOutput::FilterColor(cv::Mat image,short channel) -{ - cv::Mat dstImage(image.rows,image.cols,CV_8UC1); - - //int pixelSize = image.depth(); - int channels = image.channels(); - if(channel > channels -1){ - return dstImage; - } - if ( ( channel == 3 ) && ( channels != 4 ) && ( channels != 8 )) - { - return dstImage; - } - if ( channels <= 4 ) - { - int srcOffset = image.step - image.cols* channels ; - int dstOffset = dstImage.step - dstImage.cols; - unsigned char* src = image.data; - unsigned char* dst = dstImage.data; - src += channel; - - for ( int y = 0; y < image.rows; y++ ) - { - for ( int x = 0; x < image.cols; x++, src += channels , dst++ ) - { - unsigned short pix = *src; - if(pix >=130){ - pix = 255; - } - *dst = pix; - } - src += srcOffset; - dst += dstOffset; - } - } - return dstImage; -} diff --git a/ImageMultiOutput.h b/ImageMultiOutput.h deleted file mode 100644 index f272570..0000000 --- a/ImageMultiOutput.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once -#include "ImageProcess/ImageApply.h" - -class ImageMultiOutput -{ -public: - ImageMultiOutput(void); - ~ImageMultiOutput(void); - - cv::Mat GetMultiFilterMat(cv::Mat &src,int channel); -private: - cv::Mat FilterColor(cv::Mat image,short channel); - -}; - diff --git a/ImageProcess.cpp b/ImageProcess.cpp deleted file mode 100644 index 7d3022e..0000000 Binary files a/ImageProcess.cpp and /dev/null differ diff --git a/ImageProcess.h b/ImageProcess.h deleted file mode 100644 index 32b25d7..0000000 Binary files a/ImageProcess.h and /dev/null differ diff --git a/ImageProcess/ImageApply.cpp b/ImageProcess/ImageApply.cpp deleted file mode 100644 index 80f5fbf..0000000 --- a/ImageProcess/ImageApply.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "ImageApply.h" - -CImageApply::CImageApply(void) -{ -} - -CImageApply::~CImageApply(void) -{ -} diff --git a/ImageProcess/ImageApply.h b/ImageProcess/ImageApply.h deleted file mode 100644 index a63da5e..0000000 --- a/ImageProcess/ImageApply.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef IMAGE_APPLY_H -#define IMAGE_APPLY_H - -#include "../stdafx.h" -#include -#include -#include - -#if defined(LOG) -#include "filetools.h" -#endif - -class CImageApply -{ -public: - CImageApply(void); - virtual ~CImageApply(void); - - virtual void apply(cv::Mat& pDib,int side) = 0; -}; - -typedef std::shared_ptr ImageApplyPtr; - -#endif //!IMAGE_APPLY_H diff --git a/ImageProcess/ImageApplyAdjustColors.cpp b/ImageProcess/ImageApplyAdjustColors.cpp deleted file mode 100644 index 9e183b1..0000000 --- a/ImageProcess/ImageApplyAdjustColors.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "ImageApplyAdjustColors.h" - -CImageApplyAdjustColors::CImageApplyAdjustColors(void) - : m_brightness(0) - , m_contrast(0) - , m_gamma(1.0f) - , lut(1, 256, CV_8UC1) -{ - update_lutData(); -} - -CImageApplyAdjustColors::CImageApplyAdjustColors(int brightness, int contrast, float gamma) - : lut(1, 256, CV_8UC1) -{ - setAdjustColors(brightness, contrast, gamma); -} - -CImageApplyAdjustColors::~CImageApplyAdjustColors(void) -{ - -} - -void CImageApplyAdjustColors::apply(cv::Mat& pDib,int side) -{ - if (m_brightness != 0 || m_contrast != 0 || m_gamma != 1.0) - cv::LUT(pDib, lut, pDib); -} - -void CImageApplyAdjustColors::setAdjustColors(int brightness, int contrast, float gamma) -{ - setBrightness(brightness); - setContrast(contrast); - setGamma(gamma); - update_lutData(); -} - -void CImageApplyAdjustColors::setBrightness(int brightness) -{ - m_brightness = cv::max(-255, cv::min(brightness, 255)); - update_lutData(); -} - -void CImageApplyAdjustColors::setContrast(int contrast) -{ - m_contrast = cv::max(-127, cv::min(contrast, 127)); - update_lutData(); -} - -void CImageApplyAdjustColors::setGamma(float gamma) -{ - m_gamma = cv::max(0.1f, cv::min(gamma, 5.0f)); - update_lutData(); -} - -void CImageApplyAdjustColors::update_lutData() -{ - unsigned char* ptr = lut.data; - - if (m_gamma != 1.0f) - { - float g = 1.0f / m_gamma; - for (int i = 0; i < 256; i++) - ptr[i] = static_cast(cv::min(255, static_cast(cv::pow(i / 255.0f, g) * 255.0f + 0.5f))); - } - else - { - for (int i = 0; i < 256; i++) - { - //update contrast - if (i < 128) - ptr[i] = static_cast(cv::max(0, cv::min(i - m_contrast, 127))); - else - ptr[i] = static_cast(cv::max(127, cv::min(i + m_contrast, 255))); - - //update brightness - ptr[i] = static_cast(cv::max(0, cv::min(ptr[i] + m_brightness, 255))); - } - } -} diff --git a/ImageProcess/ImageApplyAdjustColors.h b/ImageProcess/ImageApplyAdjustColors.h deleted file mode 100644 index eb7a554..0000000 --- a/ImageProcess/ImageApplyAdjustColors.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef IMAGE_APPLY_ADJUST_COLOR_H -#define IMAGE_APPLY_ADJUST_COLOR_H - -#include "ImageApply.h" - -class CImageApplyAdjustColors : public CImageApply -{ -public: - - CImageApplyAdjustColors(void); - - CImageApplyAdjustColors(int brightness, int contrast, float gamma); - - virtual ~CImageApplyAdjustColors(void); - - virtual void apply(cv::Mat& pDib, int side); - - void setAdjustColors(int brightness, int contrast, float gamma); - - int getContrast() { return m_contrast; } - - int getBrightness() { return m_brightness; } - - double getGamma() { return m_gamma; } - - void setBrightness(int brightness); - - void setContrast(int contrast); - - void setGamma(float gamma); - -private: - - void update_lutData(); - -private: - - int m_brightness; - int m_contrast; - float m_gamma; - cv::Mat lut; -}; - -#endif // !IMAGE_APPLY_ADJUST_COLOR_H - - diff --git a/ImageProcess/ImageApplyAutoCrop.cpp b/ImageProcess/ImageApplyAutoCrop.cpp deleted file mode 100644 index b6eb66a..0000000 --- a/ImageProcess/ImageApplyAutoCrop.cpp +++ /dev/null @@ -1,165 +0,0 @@ -#include "ImageApplyAutoCrop.h" -#include "ImageProcess_Public.h" - -#define RE 8 - -CImageApplyAutoCrop::CImageApplyAutoCrop(bool isCrop, bool isFillBlank, bool isDesaskew, cv::Size size) - : m_isCrop(isCrop) - , m_isFillBlank(isFillBlank) - , m_isDesaskew(isDesaskew) - , m_fixedSize(size) - , m_threshold(35) - , m_noise(7) - , m_indent(5) -{ -} - - -CImageApplyAutoCrop::~CImageApplyAutoCrop() -{ -} - -void CImageApplyAutoCrop::apply(cv::Mat & pDib, int side) -{ - if (!m_isCrop && !m_isFillBlank && !m_isDesaskew) return; - cv::Mat src = pDib; - cv::Mat dst; - cv::Mat src_resize; - cv::resize(src, src_resize, cv::Size(src.cols / RE, src.rows / RE)); - cv::Mat scale_mat; - cv::Mat thre(src_resize.size(), CV_8UC1); - hg::threshold_Mat(src_resize, thre, m_threshold); - - cv::Mat element = getStructuringElement(cv::MORPH_RECT, cv::Size(m_noise, m_noise)); - cv::morphologyEx(thre, thre, cv::MORPH_OPEN, element); - - std::vector hierarchy; - std::vector> contours; - - hg::findContours(thre, contours, hierarchy, cv::RETR_EXTERNAL); - std::vector maxContour = hg::getMaxContour(contours, hierarchy); - - for (cv::Point& item : maxContour) - { - item.x = item.x * RE + RE / 2; - item.y = item.y * RE + RE / 2; - } - - if (maxContour.size() == 0) - { - thre.release(); - return; - } - thre.release(); - dst.release(); - - cv::RotatedRect rect = hg::getBoundingRect(maxContour); - - hg::convexHull(maxContour, maxContour); - - cv::Rect bounding_rect = rect.boundingRect(); - - if (m_isCrop) - if (m_isDesaskew) - dst = cv::Mat::zeros(cv::Size(rect.size), src.type()); - else - { - cv::Rect bounding_rect_clone = bounding_rect; - bounding_rect.x = cv::max(0, bounding_rect_clone.x); - bounding_rect.y = cv::max(0, bounding_rect_clone.y); - bounding_rect.width = cv::min(src.cols, bounding_rect_clone.x + bounding_rect_clone.width) - bounding_rect.x; - bounding_rect.height = cv::min(src.rows, bounding_rect_clone.y + bounding_rect_clone.height) - bounding_rect.y; - dst = src(bounding_rect).clone(); - } - else - if (m_isFillBlank) - dst = src.clone(); - else - dst = cv::Mat(src.rows, src.cols, src.type()); - - cv::Mat warp_mat; - if (m_isDesaskew) - { - cv::Point2f dstTri[3]; - cv::Point2f srcTri[4]; - rect.points(srcTri); - - for (cv::Point2f& p : srcTri) - p.y /= 1.5f; - - if (m_isCrop) - { - dstTri[0] = cv::Point2f(0, rect.size.height - 1); - dstTri[1] = cv::Point2f(0, 0); - dstTri[2] = cv::Point2f(rect.size.width - 1, 0); - } - else - { - float left = (src.cols - rect.size.width) / 2; - float right = left + rect.size.width - 1; - float top = (src.rows - rect.size.height) / 2; - float bottom = top + rect.size.height - 1; - dstTri[0] = cv::Point2f(left, bottom); - dstTri[1] = cv::Point2f(left, top); - dstTri[2] = cv::Point2f(right, top); - } - - cv::Size dSize = m_isCrop ? cv::Size(static_cast(rect.size.width), - static_cast(rect.size.height)) : dst.size(); - bounding_rect.width = dSize.width; - bounding_rect.height = dSize.height; - - warp_mat = cv::getAffineTransform(srcTri, dstTri); - cv::warpAffine(src, dst, warp_mat, dSize); - } - - if (m_isFillBlank) - { - if (m_isDesaskew) - for (cv::Point& item : maxContour) - item = hg::warpPoint(item, warp_mat); - else - { - if (m_isCrop) - { - cv::Point offset = bounding_rect.tl(); - for (cv::Point& item : maxContour) - item -= offset; - } - } - - hg::polyIndent(maxContour, m_indent); - hg::fillBlackBackGround(dst, maxContour); - } - - if (!m_isCrop) - { - cv::Rect fixed_roi; - if (m_fixedSize.width > dst.cols) - { - fixed_roi.x = 0; - fixed_roi.width = dst.cols; - } - else - { - fixed_roi.x = (dst.cols - m_fixedSize.width) / 2; - fixed_roi.width = m_fixedSize.width; - } - - if (m_fixedSize.height > dst.rows) - { - fixed_roi.y = 0; - fixed_roi.height = dst.rows; - } - else - { - fixed_roi.y = (dst.rows - m_fixedSize.height) / 2; - fixed_roi.height = m_fixedSize.height; - } - - dst = dst(fixed_roi); - } - - pDib.release(); - pDib = dst; -} diff --git a/ImageProcess/ImageApplyAutoCrop.h b/ImageProcess/ImageApplyAutoCrop.h deleted file mode 100644 index 491b2b8..0000000 --- a/ImageProcess/ImageApplyAutoCrop.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef IMAGE_APPLY_AUTO_CROP_H -#define IMAGE_APPLY_AUTO_CROP_H - -#include "ImageApply.h" - -class CImageApplyAutoCrop : public CImageApply -{ -public: - CImageApplyAutoCrop(bool isCrop,bool isFillBlank,bool isDesaskew,cv::Size size); - - virtual ~CImageApplyAutoCrop(); - - virtual void apply(cv::Mat& pDib, int side); - - bool isAutoCrop() { return m_isCrop; } - - bool isFillBlank() { return m_isFillBlank; } - - bool isDesaskew() { return m_isDesaskew; } - - double threshold() { return m_threshold; } - - int noise() { return m_noise; } - - int indent() { return m_indent; } - - cv::Size fixedSize() { return m_fixedSize; } - - void setAutoCrop(bool enabled) { m_isCrop = enabled; } - - void setFillBlank(bool enabled) { m_isFillBlank = enabled; } - - void setDesaskew(bool enabled) { m_isDesaskew = enabled; } - - void setThreshold(double value) { m_threshold = value; } - - void setNoise(int value) { m_noise = value; } - - void setIndent(int value) { m_indent = value; } - - void setFixedSize(cv::Size size) { m_fixedSize = size; } - -private: - bool m_isCrop; - bool m_isFillBlank; - bool m_isDesaskew; - - double m_threshold; - int m_noise; - int m_indent; - cv::Size m_fixedSize; - -}; - -#endif // !IMAGE_APPLY_AUTO_CROP_H - - diff --git a/ImageProcess/ImageApplyBWBinaray.cpp b/ImageProcess/ImageApplyBWBinaray.cpp deleted file mode 100644 index e321a5e..0000000 --- a/ImageProcess/ImageApplyBWBinaray.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "ImageApplyBWBinaray.h" - -CImageApplyBWBinaray::CImageApplyBWBinaray() - : m_threshold(127) - , m_type(THRESH_BINARY) - , m_blockSize(25) - , m_constant(5) -{ -} - - -CImageApplyBWBinaray::~CImageApplyBWBinaray(void) -{ -} - -void CImageApplyBWBinaray::apply(cv::Mat& pDib,int side) -{ - if (pDib.channels() == 3) - cv::cvtColor(pDib, pDib, cv::COLOR_BGR2GRAY); - - switch (m_type) - { - case THRESH_BINARY: - cv::threshold(pDib, pDib, m_threshold, 255, CV_THRESH_BINARY); - break; - case THRESH_OTSU: - cv::threshold(pDib, pDib, m_threshold, 255, CV_THRESH_OTSU); - break; - case ADAPTIVE_GAUSSIAN: - cv::adaptiveThreshold(pDib, pDib, 255, cv::ADAPTIVE_THRESH_GAUSSIAN_C, CV_THRESH_BINARY, m_blockSize, m_constant); - break; - case ADAPTIVE_MEAN: - cv::adaptiveThreshold(pDib, pDib, 255, cv::ADAPTIVE_THRESH_MEAN_C, CV_THRESH_BINARY, m_blockSize, m_constant); - break; - case ERROR_DIFFUSION: - break; - default: - break; - } -} \ No newline at end of file diff --git a/ImageProcess/ImageApplyBWBinaray.h b/ImageProcess/ImageApplyBWBinaray.h deleted file mode 100644 index b84e0a8..0000000 --- a/ImageProcess/ImageApplyBWBinaray.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef IMAGE_APPLY_BW_BINARAY_H -#define IMAGE_APPLY_BW_BINARAY_H - -#include "ImageApply.h" - - -class CImageApplyBWBinaray:public CImageApply -{ -public: - - enum ThresholdType - { - THRESH_BINARY, - THRESH_OTSU, - - ADAPTIVE_GAUSSIAN, - ADAPTIVE_MEAN, - - ERROR_DIFFUSION - }; - - CImageApplyBWBinaray(); - - virtual ~CImageApplyBWBinaray(void); - - virtual void apply(cv::Mat& pDib,int side); - - double getThreshold() { return m_threshold; } - - ThresholdType getThresholdType() { return m_type; } - - int getBlockSize() { return m_blockSize; } - - double getConstant() { return m_constant; } - - void setThreshold(double value) { m_threshold = value; } - - void setThresholdType(ThresholdType type) { m_type = type; } - - void setBlockSize(int value) { m_blockSize = value; } - - void setConstant(double value) { m_constant = value; } - -private: - double m_threshold; - - ThresholdType m_type; - - int m_blockSize; - - double m_constant; -}; - -#endif //!IMAGE_APPLY_BW_BINARAY_H - diff --git a/ImageProcess/ImageApplyChannel.cpp b/ImageProcess/ImageApplyChannel.cpp deleted file mode 100644 index b38a341..0000000 --- a/ImageProcess/ImageApplyChannel.cpp +++ /dev/null @@ -1,184 +0,0 @@ -#include "ImageApplyChannel.h" - -CImageApplyChannel::CImageApplyChannel(int index) - : m_cmIndex(index) -{ - colorTable=NULL; - if (index>3) - { - short channal=m_cmIndex==4?2:(m_cmIndex==5?1:0); - InitColorTable(channal); - } - -} - -CImageApplyChannel::~CImageApplyChannel(void) -{ - if (colorTable!=NULL) - { - free(colorTable); - } -} - -void CImageApplyChannel::apply(cv::Mat& pDib,int side) -{ - //FileTools::write_log("D:\\1.txt", "Exit CImageChannel apply"); - if (m_cmIndex>0&&m_cmIndex<4) - { - if (m_cmIndex <= pDib.channels()) - { - //0通道为B分量,1通道为G分量,2通道为R分量 - //m_cmIndex 1 除红 2 除绿 3 除蓝 - //2除红,1除绿,0除蓝 - //std::vector mats; - //cv::split(pDib, mats); - //int rmIndex=m_cmIndex==1?2:(m_cmIndex==2?1:0); - //pDib = mats[rmIndex]; - pDib=FilterColor(pDib,m_cmIndex==1?2:(m_cmIndex==2?1:0)); - //FileTools::write_log("D:\\1.txt", "Exit CImageChannel FilterColor apply"); - } - } - else if(m_cmIndex>=4&&m_cmIndex<=6) - { - short channal=m_cmIndex==4?2:(m_cmIndex==5?1:0); - pDib=colorEnhancement(pDib,channal); - //FileTools::write_log("D:\\1.txt", "Exit CImageChannel colorEnhancement apply"); - } - //FileTools::write_log("D:\\1.txt", "Exit CImageChannel apply"); -} - -void CImageApplyChannel::setCH(int channel) -{ - m_cmIndex = channel; -} - -int CImageApplyChannel::getCH() -{ - return m_cmIndex; -} - - -void CImageApplyChannel::RGBtoHSV(double r, double g, double b, double &h, double &s, double &v) -{ - double min, max, delta; - min = ( (rg ? r:g) > b ) ? (r>g ? r:g): b ; - v = max; // v - delta = max - min; - if (max != 0) - { - s = delta / max; // s - } - else - { - // r = g = b = 0 - // s = 0, v is undefined - s = 0; - h = -1; - return; - } - - if (r == max) - { - h = (g - b) / delta; // between yellow & magenta - } - else if (g == max) - { - h = 2 + (b - r) / delta; // between cyan & yellow - } - else - { - h = 4 + (r - g) / delta; // between magenta & cyan - } - h *= 60; // degrees - if (h < 0) - { - h += 360; - } -} - -void CImageApplyChannel::InitColorTable(short channel) -{ - //colorTable=new unsigned char(); - colorTable=(unsigned char *)malloc(sizeof(unsigned char)*256*256*256); - for (int i = 0; i < 256; i++) - { - for (int j = 0; j < 256; j++) - { - for (int k = 0; k < 256; k++) - { - if (channel == 2) //红色增强 - { - *(colorTable + i * 256 * 256 + j * 256 + k )= (unsigned char)(0 + 0.833 * j + 0.167 * k);//0.833 * j + 0.167 * k - } - else if (channel == 1) //绿色增强 - { - *(colorTable + i * 256 * 256 + j * 256 + k ) = (unsigned char)(0.731 * i + 0 + 0.268 * k); - } - else if (channel == 0) //蓝色增强 - { - *(colorTable + i * 256 * 256 + j * 256 + k ) = (unsigned char)(0.337 * i + 0.663 * j + 0); - } - } - } - } -} - -cv::Mat CImageApplyChannel::colorEnhancement(cv::Mat image,short channel) -{ - cv::Mat grayImage(image.rows,image.cols,CV_8UC1); - if (channel>3) - { - return grayImage; - } - - unsigned char * dstData = grayImage.data; - unsigned char * srcData = image.data; - for(int r = 0; r < image.rows; r++) - { - for (int c = 0; c < image.cols; c++) - { - *(dstData + r * grayImage.step + c ) = colorTable[*(srcData + r * image.step + c * 3 + 2 ) * 256 * 256 + *(srcData + r * image.step + c * 3 + 1 ) * 256+ *(srcData + r * image.step + c * 3 )]; - } - } - return grayImage; - -} - -cv::Mat CImageApplyChannel::FilterColor(cv::Mat image,short channel) -{ - cv::Mat dstImage(image.rows,image.cols,CV_8UC1); - - //int pixelSize = image.depth(); - int channels = image.channels(); - if(channel > channels -1){ - return dstImage; - } - if ( ( channel == 3 ) && ( channels != 4 ) && ( channels != 8 )) - { - return dstImage; - } - if ( channels <= 4 ) - { - int srcOffset = image.step - image.cols* channels ; - int dstOffset = dstImage.step - dstImage.cols; - unsigned char* src = image.data; - unsigned char* dst = dstImage.data; - src += channel; - - for ( int y = 0; y < image.rows; y++ ) - { - for ( int x = 0; x < image.cols; x++, src += channels , dst++ ) - { - unsigned short pix = *src; - if(pix >=130){ - pix = 255; - } - *dst = pix; - } - src += srcOffset; - dst += dstOffset; - } - } - return dstImage; -} \ No newline at end of file diff --git a/ImageProcess/ImageApplyChannel.h b/ImageProcess/ImageApplyChannel.h deleted file mode 100644 index 97fbaae..0000000 --- a/ImageProcess/ImageApplyChannel.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef IMAGE_APPLY_CHANNEL_H -#define IMAGE_APPLY_CHANNEL_H - -#include "imageapply.h" - -class CImageApplyChannel : public CImageApply -{ -public: - CImageApplyChannel(int index); - virtual ~CImageApplyChannel(void); - - virtual void apply(cv::Mat& pDib,int side); - void setCH(int channel); - int getCH(); - -private: - void RGBtoHSV(double r, double g, double b, double &h, double &s, double &v); - void InitColorTable(short channel); - cv::Mat colorEnhancement(cv::Mat image,short channel); - cv::Mat FilterColor(cv::Mat image,short channel); - int m_cmIndex; - unsigned char * colorTable; -}; - -#endif // !IMAGE_APPLY_CHANNEL_H \ No newline at end of file diff --git a/ImageProcess/ImageApplyCrop.cpp b/ImageProcess/ImageApplyCrop.cpp deleted file mode 100644 index f18842e..0000000 --- a/ImageProcess/ImageApplyCrop.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ImageApplyCrop.h" - -CImageApplyCrop::CImageApplyCrop(void) -{ -} - - -CImageApplyCrop::~CImageApplyCrop(void) -{ -} - -void CImageApplyCrop::apply(cv::Mat& pDib,int side) -{ - if (m_roi.x < 0 || m_roi.y < 0 || m_roi.br().x >= pDib.cols || m_roi.br().y >= pDib.rows || m_roi.width == 0 || m_roi.height == 0) - return; - - pDib = pDib(m_roi).clone(); -} diff --git a/ImageProcess/ImageApplyCrop.h b/ImageProcess/ImageApplyCrop.h deleted file mode 100644 index c3ce1e0..0000000 --- a/ImageProcess/ImageApplyCrop.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef IMAGE_APPLY_CROP_H -#define IMAGE_APPLY_CROP_H - -#include "imageapply.h" - -class CImageApplyCrop : public CImageApply -{ - -public: - - CImageApplyCrop(void); - - virtual ~CImageApplyCrop(void); - - virtual void apply(cv::Mat& pDib,int side); - - cv::Rect getROI() { return m_roi; } - - void setROI(const cv::Rect& rect) { m_roi = rect; } - -private: - - cv::Rect m_roi; -}; - -#endif // !IMAGE_APPLY_CROP_H \ No newline at end of file diff --git a/ImageProcess/ImageApplyDiscardBlank.cpp b/ImageProcess/ImageApplyDiscardBlank.cpp deleted file mode 100644 index 74746dd..0000000 --- a/ImageProcess/ImageApplyDiscardBlank.cpp +++ /dev/null @@ -1,216 +0,0 @@ -#include "ImageApplyDiscardBlank.h" - -using namespace cv; -using namespace std; - -int CImageApplyDiscardBlank::ProcessRectR(Mat & image, RotatedRect & rotatedRect, vector& maxContour, double scale, double thresh, int blobAreaSize) -{ - Mat gray; - int blockCount = 0; - if (image.channels() == 3) - { - if (scale != 1.0f) - { - Size ResImgSiz = Size(image.cols*scale, image.rows*scale); - resize(image, gray, cv::Size(), scale, scale, 0); - cvtColor(gray, gray, CV_BGR2GRAY); - } - else - { - cvtColor(image, gray, CV_BGR2GRAY); - } - } - else - { - if (scale != 1.0f) - { - resize(image, gray, cv::Size(), scale, scale, 0); - } - else - { - gray = image; - } - } - Mat threshold_img; - threshold(gray, threshold_img, thresh, 255.0, CV_THRESH_BINARY); - vector> contours; - std::vector h1; - GetContours(threshold_img, contours, h1, CV_CHAIN_APPROX_SIMPLE); - threshold_img.release(); - - if (contours.size() == 0) - { - return blockCount; - } - - vector list_com; - for (int i = 0; i < contours.size(); i++) - { - double area = contourArea(contours[i]); - if (area > blobAreaSize) - { - blockCount++; - for (int j = 0; j < contours[i].size(); j++) - { - list_com.push_back(contours[i][j]); - } - } - } - - if (list_com.size() == 0) - { - return blockCount; - } - - rotatedRect = minAreaRect(list_com); - rotatedRect.center.x /= (float)scale; - rotatedRect.center.y /= (float)scale; - rotatedRect.size.width /= (float)scale; - rotatedRect.size.height /= (float)scale; - - if (rotatedRect.angle < -45.0f) - { - rotatedRect.angle += 90.0f; - float l_temp = rotatedRect.size.width; - rotatedRect.size.width = rotatedRect.size.height; - rotatedRect.size.height = l_temp; - } - - vector hull(list_com.size()); - convexHull(list_com, hull); - - for (int i = 0; i < hull.size(); i++) - { - Point temp = list_com[hull[i]]; - int x = (int)(temp.x / scale); - int y = (int)(temp.y / scale); - maxContour.push_back(Point(x, y)); - } - - return blockCount; -} - - bool CImageApplyDiscardBlank:: Scalar_LE(cv::Scalar& val1, cv::Scalar& val2) -{ - for(int i = 0; i < 3; i++) - { - if(val1[i] > val2[i]) - return false; - } - return true; -} - - CImageApplyDiscardBlank::CImageApplyDiscardBlank(bool isnormal) - : devTh (10, 10, 10, 10), dSize(200),isNormalDiscard(isnormal) -{ -} - - - CImageApplyDiscardBlank::~CImageApplyDiscardBlank(void) -{ -} - -void CImageApplyDiscardBlank::setIntensity(int val) -{ - val = max(min(20, val), 2); - devTh = cv::Scalar(val, val, val, val); -} - -void CImageApplyDiscardBlank::setMinArea(int val) -{ - dSize = max(min(500, val), 100); -} - -void CImageApplyDiscardBlank::GetContours(const Mat& src, vector>& contours, vector& hierarchy, int retr /*= RETR_CCOMP*/) -{ - CvMat c_image = src; - MemStorage storage(cvCreateMemStorage()); - CvSeq* _ccontours = 0; - cvFindContours(&c_image, storage, &_ccontours, sizeof(CvContour), retr, CHAIN_APPROX_SIMPLE); - - if (!_ccontours) - { - contours.clear(); - return; - } - Seq all_contours(cvTreeToNodeSeq(_ccontours, sizeof(CvSeq), storage)); - int total = (int)all_contours.size(); - contours.resize(total); - - SeqIterator it = all_contours.begin(); - for (int i = 0; i < total; i++, ++it) - { - CvSeq* c = *it; - ((CvContour*)c)->color = (int)i; - int count = (int)c->total; - int* data = new int[count * 2]; - cvCvtSeqToArray(c, data); - for (int j = 0; j < count; j++) - { - contours[i].push_back(Point(data[j * 2], data[j * 2 + 1])); - } - delete[] data; - } - - hierarchy.resize(total); - it = all_contours.begin(); - for (int i = 0; i < total; i++, ++it) - { - CvSeq* c = *it; - int h_next = c->h_next ? ((CvContour*)c->h_next)->color : -1; - int h_prev = c->h_prev ? ((CvContour*)c->h_prev)->color : -1; - int v_next = c->v_next ? ((CvContour*)c->v_next)->color : -1; - int v_prev = c->v_prev ? ((CvContour*)c->v_prev)->color : -1; - hierarchy[i] = Vec4i(h_next, h_prev, v_next, v_prev); - } -} - -cv::Mat CImageApplyDiscardBlank::getRoiMat(cv::Mat& image) -{ - int gap = 100; - RotatedRect rect; - vector contour; - double scale = 0.25; - double thresh = 50; - int blobSize = 200; - int edgeWidth = 10; - ProcessRectR(image, rect, contour, scale, thresh, blobSize); - cv::Rect rect2 = rect.boundingRect(); - cv::Rect inRect = rect2 & Rect(0, 0, image.cols, image.rows); - gap = max(inRect.width - rect.size.width, inRect.height -rect.size.height)+100; - inRect = cv::Rect(inRect.x+ gap, inRect.y + gap, inRect.width -gap*2, inRect.height-gap*2); - return image(inRect); -} - -void CImageApplyDiscardBlank::apply(cv::Mat& pDib,int side) -{ - //FileTools::write_log("D:\\1.txt", "enter CImageProcDiscardBlank apply"); - setIntensity(isNormalDiscard?8:20); - setMinArea(isNormalDiscard?200:300); - - cv::Scalar mean; - cv::Scalar dev; - cv::Mat image = getRoiMat(pDib); - cv::Rect rect; - cv::Rect imRect(0, 0, image.cols, image.rows); - for(int i = 0; i < image.cols; i+= dSize) - { - for(int j = 0; j < image.rows; j+= dSize) - { - rect = cv::Rect(i, j,dSize, dSize) & imRect; - if(rect != cv::Rect()) - { - cv::meanStdDev (image(rect) , mean, dev); - if(!Scalar_LE(dev, devTh)) - { - m_res = false; - return; - } - } - } - } - m_res = true; - if (m_res) - pDib.release(); - //FileTools::write_log("D:\\1.txt", "exit CImageProcDiscardBlank apply"); -} \ No newline at end of file diff --git a/ImageProcess/ImageApplyDiscardBlank.h b/ImageProcess/ImageApplyDiscardBlank.h deleted file mode 100644 index 73ade6b..0000000 --- a/ImageProcess/ImageApplyDiscardBlank.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef IMAGE_APPLY_DISCARD_BLANK_H -#define IMAGE_APPLY_DISCARD_BLANK_H - -#include "ImageApply.h" - -class CImageApplyDiscardBlank : public CImageApply -{ -public: - CImageApplyDiscardBlank(bool isnormal=true); - virtual ~CImageApplyDiscardBlank(void); - - virtual void apply(cv::Mat& pDib,int side); - -private: - void setIntensity(int val); - void setMinArea(int val); - int ProcessRectR(cv::Mat & image, cv::RotatedRect & rotatedRect, std::vector& maxContour, double scale, double thresh, int blobAreaSize); - bool Scalar_LE(cv::Scalar& val1, cv::Scalar& val2); - void GetContours(const cv::Mat& src, std::vector>& contours, std::vector& hierarchy, int retr = cv::RETR_CCOMP); -private: - int dSize; - - bool m_res; - cv::Scalar devTh; - - bool isNormalDiscard; - cv::Mat getRoiMat(cv::Mat& pDib); -}; - -#endif // !IMAGE_APPLY_DISCARD_BLANK_H \ No newline at end of file diff --git a/ImageProcess/ImageApplyHeaders.h b/ImageProcess/ImageApplyHeaders.h deleted file mode 100644 index b166ba9..0000000 --- a/ImageProcess/ImageApplyHeaders.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef IMAGE_APPLY_HEADER_H -#define IMAGE_APPLY_HEADER_H - -#include "../stdafx.h" -#include "ImageApply.h" -#include "ImageApplyAdjustColors.h" -#include "ImageApplyAutoCrop.h" -#include "ImageApplyBWBinaray.h" -#include "ImageApplyChannel.h" -#include "ImageApplyCrop.h" -#include "ImageApplyDiscardBlank.h" -#include "ImageApplyOutHole.h" -#include "ImageApplyResize.h" -#include "ImageApplyRotation.h" -#include "ImageApplySharpen.h" -#include "ImageApplyTextOrientation.h" - -#endif diff --git a/ImageProcess/ImageApplyOutHole.cpp b/ImageProcess/ImageApplyOutHole.cpp deleted file mode 100644 index 3ae1053..0000000 --- a/ImageProcess/ImageApplyOutHole.cpp +++ /dev/null @@ -1,204 +0,0 @@ -#include "ImageApplyOutHole.h" -#include "ImageProcess_Public.h" - -ImageOutHole::ImageOutHole(void) -{ -} - -ImageOutHole::~ImageOutHole(void) -{ -} - -void ImageOutHole::puncture(cv::Mat& front, cv::Mat& back, double threshold, float edgeScale, float borderSize, bool isDoubleFaces) -{ - //二值化正反面图像 - threshold = std::min(std::max(threshold, 1.0), 254.0); - cv::Mat front_thre, back_thre; - hg::threshold_Mat(front, front_thre, threshold); - hg::threshold_Mat(back, back_thre, threshold); - - //反面二值化图像水平翻转 - cv::flip(back_thre, back_thre, 1); //1:Horizontal - - //正反面图像寻边 - std::vector> contours_front, contours_back; - std::vector b1_front, b1_back; - hg::findContours(front_thre.clone(), contours_front, b1_front, cv::RETR_EXTERNAL); - hg::findContours(back_thre.clone(), contours_back, b1_back, cv::RETR_EXTERNAL); - - //提取正反面图像最大轮廓 - std::vector maxContour_front = hg::getMaxContour(contours_front, b1_front); - std::vector maxContour_back = hg::getMaxContour(contours_back, b1_back); - - cv::RotatedRect rrect_front = hg::getBoundingRect(maxContour_front); //提取正面最大轮廓的最小外接矩形 - cv::RotatedRect rrect_back = hg::getBoundingRect(maxContour_back); //提取反面最大轮廓的最小外接矩形 - - //提取正反面图像重叠部分区域 - cv::Rect roi_front, roi_back; - cv::RotatedRect mask_rotatedRect; - getRoi(rrect_front, rrect_back, cv::Size(front.cols, front.rows), roi_front, roi_back, mask_rotatedRect); - - cv::Mat roiMat_front(front_thre, roi_front); //在正面二值图像中截取重叠部分 - cv::Mat roiMat_back(back_thre, roi_back); //在反面二值图像中截取重叠部分 - - //正反面二值图像做或运算,真正镂空区域保留0,其他地方填充为255 - //为了避免孔洞彻底贯穿纸边,认为绘制纸张轮廓,确保所有孔洞为封闭图形,不会与背景粘连。 - cv::Mat mask; - bitwise_or(roiMat_front, roiMat_back, mask); //或运算,正反面二值图像重叠 - - //二值图像重叠图像颜色取反,膨胀,提取轮廓 - std::vector> contours_mask; - std::vector b1_mask; - bitwise_not(mask, mask); - - dilate(mask, mask, cv::Mat(), cv::Point(-1, -1), 3, cv::BORDER_CONSTANT, cv::Scalar(255)); //膨胀算法,增大孔洞连通区域面积 - - polylines(mask, hg::getVertices(mask_rotatedRect), true, cv::Scalar(0), 15); //绘制纸张矩形边缘 - - hg::findContours(mask.clone(), contours_mask, b1_mask, cv::RETR_TREE); //提取重叠图像轮廓 - - //过滤非孔洞的联通区域 - std::vector> hole_contours = filterPoly(contours_mask, b1_mask, mask_rotatedRect, edgeScale, borderSize); - for (int i = 0; i < hole_contours.size(); i++) - cv::drawContours(mask, hole_contours, i, cv::Scalar(127), 2); - - for (size_t i = 0; i < hole_contours.size(); i++) - { - cv::Scalar color = getBackGroudColor(front(roi_front), hole_contours[i]); - cv::Mat temp = front(roi_front); - hg::fillPoly(temp, hole_contours[i], color); - } - - if (isDoubleFaces) - { - int width_ = roi_back.width; - roi_back.x = back.cols - roi_back.width - roi_back.x; //因为之前反面图像翻转,所以现在ROI也要进行相应翻转 - for (size_t i = 0; i < hole_contours.size(); i++) - { - std::vector hole_contour; - for (size_t j = 0; j < hole_contours[i].size(); j++) - hole_contour.push_back(cv::Point(width_ - hole_contours[i][j].x - 1, hole_contours[i][j].y)); - - cv::Scalar color = getBackGroudColor(back(roi_back), hole_contour); - cv::Mat temp = back(roi_back); - hg::fillPoly(temp, hole_contour, color); - } - } -} - -void ImageOutHole::getRoi(cv::RotatedRect rrect_front, cv::RotatedRect rrect_back, cv::Size srcSize, - cv::Rect& roi_front, cv::Rect& roi_back, cv::RotatedRect& mask_rotatedRect) -{ - cv::Size size(static_cast(rrect_front.size.width + rrect_back.size.width) / 2, static_cast(rrect_front.size.height + rrect_back.size.height) / 2); - float angle = (rrect_front.angle + rrect_back.angle) / 2; - - rrect_front.size = rrect_back.size = size; - rrect_front.angle = rrect_back.angle = angle; - - roi_front = rrect_front.boundingRect(); - roi_back = rrect_back.boundingRect(); - - if (roi_front.width != roi_back.width || roi_front.height != roi_back.height) - { - roi_front.height = roi_back.height; - roi_front.width = roi_back.width; - } - - cv::Point offset(0, 0); - int top = std::min(roi_front.y, roi_back.y); - if (top < 0) - { - roi_front.y -= top; - roi_back.y -= top; - roi_front.height += top; - roi_back.height += top; - offset.y += top; - } - - int left = std::min(roi_front.x, roi_back.x); - if (left < 0) - { - roi_front.x -= left; - roi_back.x -= left; - roi_front.width += left; - roi_back.width += left; - offset.x += left; - } - - int right = std::max(roi_front.x + roi_front.width, roi_back.x + roi_back.width); - if (right >= srcSize.width) - { - roi_front.width -= (right - srcSize.width + 1); - roi_back.width -= (right - srcSize.width + 1); - } - - int bottom = std::max(roi_front.y + roi_front.height, roi_back.y + roi_back.height); - if (bottom >= srcSize.height) - { - roi_front.height -= (bottom - srcSize.height + 1); - roi_back.height -= (bottom - srcSize.height + 1); - } - - mask_rotatedRect.center = cv::Point((roi_front.width + offset.x) / 2, (roi_front.height + offset.y) / 2); - mask_rotatedRect.size = size; - mask_rotatedRect.angle = angle; -} - -std::vector> ImageOutHole::filterPoly(std::vector>& contours, const std::vector& m, - cv::RotatedRect roi, float edgeScale, float areaThreshold) -{ - edgeScale = std::min(0.49f, std::max(edgeScale, 0.0f)); - cv::RotatedRect roi2(roi.center, cv::Size(static_cast(roi.size.width * (1 - edgeScale * 2)), - static_cast(roi.size.height * (1 - edgeScale * 2))), roi.angle); - - std::vector vertices_roi1 = hg::getVertices(roi); - std::vector vertices_roi2 = hg::getVertices(roi2); - - std::vector> hole_contours; - for (size_t i = 0, length = contours.size(); i < length; i++) - { - if (m[i][2] != -1) continue; - - cv::RotatedRect rrect = hg::getBoundingRect(contours[i]); - if (rrect.size.width > areaThreshold || rrect.size.height > areaThreshold) continue; - - bool enabled = true; - for (size_t j = 0, count = contours[i].size(); j < count; j++) - { - cv::Point p(contours[i][j]); - double temp1 = pointPolygonTest(vertices_roi1, p, false); //判断是否在纸张内 1:内;0:上;-1:外 - double temp2 = pointPolygonTest(vertices_roi2, p, false); //判断是否在边缘区域内 1:内;0:上;-1:外 - //如果在纸张外,或者边缘内,视为非孔洞 - if (temp1 < 0 || temp2 > 0) - { - enabled = false; - break; - } - } - - if (enabled) - hole_contours.push_back(contours[i]); - } - return hole_contours; -} - -cv::Scalar ImageOutHole::getBackGroudColor(const cv::Mat &image, const std::vector pixelPoints) -{ - if (pixelPoints.empty()) return cv::Scalar(255, 255, 255); - - int channels = image.channels(); - - int temp[3] = { 0 }; - for (size_t i = 0, length = pixelPoints.size(); i < length; ++i) - { - int x = cv::min(cv::max(0, pixelPoints[i].x), image.cols - 1); - int y = cv::min(cv::max(0, pixelPoints[i].y), image.rows - 1); - - const unsigned char* ptr = image.ptr(y, x); - for (int j = 0; j < channels; ++j) - temp[j] += ptr[j]; - } - - return cv::Scalar(temp[0] / pixelPoints.size(), temp[1] / pixelPoints.size(), temp[2] / pixelPoints.size()); -} - diff --git a/ImageProcess/ImageApplyOutHole.h b/ImageProcess/ImageApplyOutHole.h deleted file mode 100644 index 4b57067..0000000 --- a/ImageProcess/ImageApplyOutHole.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef IMAGE_APPLY_OUT_HOLE_H -#define IMAGE_APPLY_OUT_HOLE_H - -#include "opencv2/opencv.hpp" -#include - -class ImageOutHole -{ - -public: - - ImageOutHole(void); - - ~ImageOutHole(void); - -public: - - void puncture(cv::Mat& front, cv::Mat& back, double threshold, float edgeScale, float borderSize, bool isDoubleFaces = true); - -private: - - void getRoi(cv::RotatedRect rrect_front, cv::RotatedRect rrect_back, cv::Size srcSize, cv::Rect& roi_front, - cv::Rect& roi_back, cv::RotatedRect& mask_rotatedRect); - - std::vector > filterPoly(std::vector>& contours, const std::vector &m, cv::RotatedRect roi, - float edgeScale, float areaThreshold); - - cv::Scalar getBackGroudColor(const cv::Mat& image, const std::vector pixelPoints); -}; - -#endif // !IMAGE_APPLY_OUT_HOLE_H \ No newline at end of file diff --git a/ImageProcess/ImageApplyResize.cpp b/ImageProcess/ImageApplyResize.cpp deleted file mode 100644 index 6339ab4..0000000 --- a/ImageProcess/ImageApplyResize.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "ImageApplyResize.h" - -CImageApplyResize::CImageApplyResize() - : m_fx(1.0) - , m_fy(1.0) - , m_type(RATIO) -{ -} - - -CImageApplyResize::~CImageApplyResize(void) -{ -} - - -void CImageApplyResize::apply(cv::Mat& pDib,int side) -{ - if (m_type == RATIO) - cv::resize(pDib, pDib, cv::Size(0, 0), m_fx, m_fy); - else - cv::resize(pDib, pDib, m_dSize); -} diff --git a/ImageProcess/ImageApplyResize.h b/ImageProcess/ImageApplyResize.h deleted file mode 100644 index 6dee284..0000000 --- a/ImageProcess/ImageApplyResize.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef IMAGE_APPLY_RESIZE_H -#define IMAGE_APPLY_RESIZE_H - -#include "imageapply.h" - -class CImageApplyResize : public CImageApply -{ -public: - - enum ResizeType - { - RATIO, - DSIZE - }; - -public: - CImageApplyResize(); - - virtual ~CImageApplyResize(void); - - virtual void apply(cv::Mat& pDib,int side); - - double getFX() { return m_fx; } - - double getFY() { return m_fy; } - - cv::Size getDSize() { return m_dSize; } - - ResizeType getType() { return m_type; } - - void setFX(double value) { m_fx = value; } - - void setFY(double value) { m_fy = value; } - - void setDSize(const cv::Size& size) { m_dSize = size; } - - void setType(ResizeType type) { m_type = type; } - -private: - double m_fx; - double m_fy; - cv::Size m_dSize; - ResizeType m_type; -}; - -#endif // !IMAGE_APPLY_RESIZE_H \ No newline at end of file diff --git a/ImageProcess/ImageApplyRotation.cpp b/ImageProcess/ImageApplyRotation.cpp deleted file mode 100644 index beaba6d..0000000 --- a/ImageProcess/ImageApplyRotation.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "ImageApplyRotation.h" - -CImageApplyRotation::CImageApplyRotation(int index_of_orentation, bool m_bBackRotate) - : m_nRotation(index_of_orentation), m_BackRotate(m_bBackRotate) -{ -} - - -CImageApplyRotation::~CImageApplyRotation() -{ -} - -void CImageApplyRotation::setRotationFlip(int flip) -{ - m_nRotation = flip; -} - -int CImageApplyRotation::getRotetion() -{ - return m_nRotation; -} - -void CImageApplyRotation::apply(cv::Mat & pDib, int side) -{ - //FileTools::write_log("D:\\1.txt", "enter CImageRotation apply"); - if (m_nRotation == 4)//自动文本方向识别 - { - } - else if (m_BackRotate&&side == 1)//背面旋转180 - { - if (m_nRotation != 2)//旋转180度 - { - if (m_nRotation == 1 || m_nRotation == 3)//90° -90° - { - transpose(pDib, pDib); - flip(pDib, pDib, m_nRotation == 1 ? 0 : 1); - } - else - { - flip(pDib, pDib, 0); - flip(pDib, pDib, 1); - } - } - } - else //zh - { - if (m_nRotation == 1 || m_nRotation == 3)//90° -90° - { - transpose(pDib, pDib); - flip(pDib, pDib, m_nRotation == 1 ? 1 : 0); - } - else if (m_nRotation == 2) - { - flip(pDib, pDib, 0); - flip(pDib, pDib, 1); - } - } - //FileTools::write_log("D:\\1.txt", "exit CImageRotation apply"); -} \ No newline at end of file diff --git a/ImageProcess/ImageApplyRotation.h b/ImageProcess/ImageApplyRotation.h deleted file mode 100644 index 6a8bfb3..0000000 --- a/ImageProcess/ImageApplyRotation.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef IMAGE_APPLY_ROTATION_H -#define IMAGE_APPLY_ROTATION_H - -#include "ImageApply.h" - -class CImageApplyRotation : public CImageApply -{ - enum RotationType - { - ROTATE_90_CLOCKWISE, - ROTATE_180, - ROTATE_90_COUNTERCLOCKWISE - }; - -public: - - CImageApplyRotation(int index_of_orentation,bool m_bBackRotate=false); - - virtual ~CImageApplyRotation(); - - void setRotationFlip(int flip); - - int getRotetion(); - - // 通过 CImageApply 继承 - virtual void apply(cv::Mat & pDib,int side) override; - -private: - int m_nRotation; - bool m_BackRotate; - int side; -}; - -#endif // !IMAGE_APPLY_ROTATION_H \ No newline at end of file diff --git a/ImageProcess/ImageApplySharpen.cpp b/ImageProcess/ImageApplySharpen.cpp deleted file mode 100644 index 1245788..0000000 --- a/ImageProcess/ImageApplySharpen.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "ImageApplySharpen.h" - -CImageApplySharpen::CImageApplySharpen() - : kernel(5, 5, CV_32FC1) -{ - float kernel_data[] = { -0.1f, 0, 0, 0, -0.1f, 0, 0, 0, 0, 0, 0, 0, 1.5f, 0, 0, 0, 0, 0, 0, 0, -0.1f, 0, 0, 0, -0.1f }; - memcpy(kernel.data, kernel_data, sizeof(float) * 25); -} - -CImageApplySharpen::~CImageApplySharpen() -{ -} - -void CImageApplySharpen::apply(cv::Mat & pDib, int side) -{ - cv::filter2D(pDib, pDib, pDib.depth(), kernel); -} diff --git a/ImageProcess/ImageApplySharpen.h b/ImageProcess/ImageApplySharpen.h deleted file mode 100644 index aaee71c..0000000 --- a/ImageProcess/ImageApplySharpen.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef IMAGE_APPLY_SHARPEN_H -#define IMAGE_APPLY_SHARPEN_H - -#include "ImageApply.h" - -class CImageApplySharpen : public CImageApply -{ -public: - CImageApplySharpen(); - - virtual ~CImageApplySharpen(); - - virtual void apply(cv::Mat& pDib, int side); -private: - cv::Mat kernel; -}; - -#endif // !IMAGE_APPLY_SHARPEN_H diff --git a/ImageProcess/ImageApplyTextOrientation.cpp b/ImageProcess/ImageApplyTextOrientation.cpp deleted file mode 100644 index 3dce548..0000000 --- a/ImageProcess/ImageApplyTextOrientation.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "ImageApplyTextOrientation.h" - -ImageApplyTextOrientation::ImageApplyTextOrientation() -{ -} - - -ImageApplyTextOrientation::~ImageApplyTextOrientation() -{ -} diff --git a/ImageProcess/ImageApplyTextOrientation.h b/ImageProcess/ImageApplyTextOrientation.h deleted file mode 100644 index ecefa54..0000000 --- a/ImageProcess/ImageApplyTextOrientation.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef IMAGE_APPLY_TEXT_ORIENTATION_H -#define IMAGE_APPLY_TEXT_ORIENTATION_H - -#include "ImageApply.h" - -class ImageApplyTextOrientation -{ -public: - ImageApplyTextOrientation(); - ~ImageApplyTextOrientation(); -}; - -#endif // !IMAGE_APPLY_TEXT_ORIENTATION_H - diff --git a/ImageProcess/ImageProcess_Public.cpp b/ImageProcess/ImageProcess_Public.cpp deleted file mode 100644 index 709222f..0000000 --- a/ImageProcess/ImageProcess_Public.cpp +++ /dev/null @@ -1,289 +0,0 @@ -#include "ImageProcess_Public.h" - -namespace hg -{ - void convexHull(const std::vector& src, std::vector& dst, bool clockwise) - { - CvMemStorage* storage = cvCreateMemStorage(); // - CvSeq* ptseq = cvCreateSeq(CV_SEQ_KIND_GENERIC | CV_32SC2, sizeof(CvContour), sizeof(CvPoint), storage); //ptseqstorage - - // - for (const cv::Point& item : src) - { - CvPoint p; - p.x = item.x; - p.y = item.y; - cvSeqPush(ptseq, &p); - } - - //μhullstorage - CvSeq* hull = cvConvexHull2(ptseq, nullptr, clockwise ? CV_CLOCKWISE : CV_COUNTER_CLOCKWISE, 0); - - //dst - dst.clear(); - int hullCount = hull->total; - for (int i = 0; i < hullCount; i++) - dst.push_back(**CV_GET_SEQ_ELEM(CvPoint*, hull, i)); - - //storage - cvReleaseMemStorage(&storage); - } - -#define R_COLOR 255 - void fillBlackBackGround(cv::Mat& src, std::vector points) - { - uint index_top = 0; - uint index_bottom = 0; - for (size_t i = 0, length = points.size(); i < length; i++) - { - if (points[i].y < points[index_top].y) - index_top = i; - if (points[i].y > points[index_bottom].y) - index_bottom = i; - } - - std::vector edge_left; - uint temp = index_top; - while (temp != index_bottom) - { - edge_left.push_back(points[temp]); - temp = (temp + points.size() - 1) % points.size(); - } - edge_left.push_back(points[index_bottom]); - - std::vector edge_right; - temp = index_top; - while (temp != index_bottom) - { - edge_right.push_back(points[temp]); - temp = (temp + points.size() + 1) % points.size(); - } - edge_right.push_back(points[index_bottom]); - - std::vector left_edge; - std::vector left_ede_y; - for (size_t i = 0, length = edge_left.size() - 1; i < length; i++) - { - int y_top = edge_left[i].y; - int x_top = edge_left[i].x; - int y_bottom = edge_left[i + 1].y; - int x_bottom = edge_left[i + 1].x; - for (int y = y_top; y < y_bottom; y++) - if (y_top != y_bottom && y < src.rows) - { - left_edge.push_back(((x_bottom - x_top) * y + x_top * y_bottom - x_bottom * y_top) / (y_bottom - y_top)); - left_ede_y.push_back(y); - } - } - size_t step = src.step; - unsigned char* ptr = src.data + static_cast(edge_left[0].y) * step; - for (size_t i = 0, length = cv::min(left_edge.size(), static_cast(src.rows)); i < length; i++) - { - int offset = left_edge[i]; - if (offset < src.cols - 1 && offset > 0) - memset(ptr + i * step, R_COLOR, static_cast((offset + 1) * src.channels())); - } - std::vector right_edge; - std::vector right_edge_y; - for (size_t i = 0, length = edge_right.size() - 1; i < length; i++) - { - int y_top = edge_right[i].y; - int x_top = edge_right[i].x; - int y_bottom = edge_right[i + 1].y; - int x_bottom = edge_right[i + 1].x; - for (int y = y_top; y < y_bottom; y++) - if (y_top != y_bottom && y < src.rows) - { - right_edge.push_back(((x_bottom - x_top) * y + x_top * y_bottom - x_bottom * y_top) / (y_bottom - y_top)); - right_edge_y.push_back(y); - } - } - - ptr = src.data + static_cast(edge_right[0].y) * step; - for (size_t i = 0, length = cv::min(right_edge.size(), static_cast(src.rows)); i < length; i++) - { - int offset = right_edge[i]; - if (offset < src.cols - 1 && offset > 0) - memset(ptr + i * step + offset * src.channels(), R_COLOR, step - static_cast(offset * src.channels())); - } - - if (edge_left[0].y > 0) - memset(src.data, R_COLOR, static_cast(edge_left[0].y) * step); - - if (edge_left.back().y < src.rows - 1) - memset(src.data + static_cast(edge_left.back().y) * step, R_COLOR, - static_cast(src.rows - edge_left.back().y) * step); - } - - void fillPoly(cv::Mat & image, const std::vector& contours, const cv::Scalar & color) - { - size_t count = contours.size(); - cv::Point * points = new cv::Point[count]; - for (size_t i = 0; i < count; i++) - points[i] = contours[i]; - - const cv::Point* pointss[1] = { points }; - int npts[1]; - npts[0] = static_cast(count); - - cv::fillPoly(image, pointss, npts, 1, color); - - delete[] points; - } - - void findContours(const cv::Mat& src, std::vector>& contours, std::vector& hierarchy, int retr, int method, cv::Point offset) - { - CvMat c_image = src; - cv::MemStorage storage(cvCreateMemStorage()); - CvSeq* _ccontours = nullptr; - cvFindContours(&c_image, storage, &_ccontours, sizeof(CvContour), retr, method, CvPoint(offset)); - - if (!_ccontours) - { - contours.clear(); - return; - } - cv::Seq all_contours(cvTreeToNodeSeq(_ccontours, sizeof(CvSeq), storage)); - size_t total = all_contours.size(); - contours.resize(total); - - cv::SeqIterator it = all_contours.begin(); - for (size_t i = 0; i < total; i++, ++it) - { - CvSeq* c = *it; - reinterpret_cast(c)->color = static_cast(i); - int count = c->total; - int* data = new int[static_cast(count * 2)]; - cvCvtSeqToArray(c, data); - for (int j = 0; j < count; j++) - { - contours[i].push_back(cv::Point(data[j * 2], data[j * 2 + 1])); - } - delete[] data; - } - - hierarchy.resize(total); - it = all_contours.begin(); - for (size_t i = 0; i < total; i++, ++it) - { - CvSeq* c = *it; - int h_next = c->h_next ? reinterpret_cast(c->h_next)->color : -1; - int h_prev = c->h_prev ? reinterpret_cast(c->h_prev)->color : -1; - int v_next = c->v_next ? reinterpret_cast(c->v_next)->color : -1; - int v_prev = c->v_prev ? reinterpret_cast(c->v_prev)->color : -1; - hierarchy[i] = cv::Vec4i(h_next, h_prev, v_next, v_prev); - } - - storage.release(); - } - - cv::RotatedRect getBoundingRect(const std::vector& contour) - { - if (contour.empty()) return {}; - - cv::RotatedRect rect = minAreaRect(contour); - if (rect.angle < -45) - { - rect.angle += 90; - float temp = rect.size.width; - rect.size.width = rect.size.height; - rect.size.height = temp; - } - - return rect; - } - - std::vector getMaxContour(const std::vector>& contours, const std::vector& hierarchy) - { - std::vector maxContour; - if (contours.size() < 1) return {}; - - for (size_t i = 0, length = hierarchy.size(); i < length; i++) - if (hierarchy[i][3] == -1) - for (const auto &item : contours[i]) - maxContour.push_back(item); - - return maxContour; - } - - std::vector getVertices(const cv::RotatedRect& rect) - { - cv::Point2f box[4]; - rect.points(box); - std::vector points; - for (int i = 0; i < 4; i++) - points.push_back(cv::Point(box[i])); - - return points; - } - - void polyIndent(std::vector& points, float indent) - { - static cv::Point zero(0, 0); - cv::Point center = getBoundingRect(points).center; - for (cv::Point& item : points) - { - cv::Point vec = item - center; - if (vec != zero) - { - int length = vec.x * vec.x + vec.y * vec.y; - float x = cv::sqrt(static_cast(vec.x * vec.x / length)) * indent; - float y = cv::sqrt(static_cast(vec.y * vec.y / length)) * indent; - - if (vec.x < 0) x *= -1.0f; - if (vec.y < 0) y *= -1.0f; - - item.x -= static_cast(x); - item.y -= static_cast(y); - } - } - - hg::convexHull(points, points); - } - - cv::Mat transforColor(const cv::Mat& src) - { - if (src.channels() == 1) return src.clone(); - - std::vector channels(3); - cv::split(src, channels); - - cv::Mat temp, dst; - bitwise_or(channels[0], channels[1], temp); - bitwise_or(channels[2], temp, dst); - temp.release(); - - for (cv::Mat& index : channels) - index.release(); - return dst; - } - - void threshold_Mat(const cv::Mat& src, cv::Mat& dst, double thre) - { - if (src.channels() == 3) - { -#if 0 - if (cl_res.context) - transforColor_threshold_opencl(src, dst, static_cast(thre)); - else -#endif - { - cv::Mat gray = transforColor(src); - cv::threshold(gray, dst, thre, 255, cv::THRESH_BINARY); - gray.release(); - } - } - else - cv::threshold(src, dst, thre, 255, cv::THRESH_BINARY); - } - - cv::Point warpPoint(cv::Point p, const cv::Mat& warp_mat) - { - double src_data[3] = { static_cast(p.x), static_cast(p.y), 1 }; - cv::Mat src(3, 1, warp_mat.type(), src_data); //warp_mat.type() == CV_64FC1 - - cv::Mat dst = warp_mat * src; - double* ptr = reinterpret_cast(dst.data); - return cv::Point(static_cast(ptr[0]), static_cast(ptr[1])); - } -} \ No newline at end of file diff --git a/ImageProcess/ImageProcess_Public.h b/ImageProcess/ImageProcess_Public.h deleted file mode 100644 index f9c37a0..0000000 --- a/ImageProcess/ImageProcess_Public.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef IMAGE_PROCESS_PUBLIC_H -#define IMAGE_PROCESS_PUBLIC_H - -#include "opencv2/opencv.hpp" -#include - -namespace hg -{ - void convexHull(const std::vector& src, std::vector& dst, bool clockwise = false); - - void fillBlackBackGround(cv::Mat& src, std::vector points); - - void fillPoly(cv::Mat& image, const std::vector& contours, const cv::Scalar& color); - - void findContours(const cv::Mat& src, std::vector>& contours, std::vector& hierarchy, - int retr = cv::RETR_LIST, int method = cv::CHAIN_APPROX_SIMPLE, cv::Point offset = cv::Point(0, 0)); - - cv::RotatedRect getBoundingRect(const std::vector& contour); - - std::vector getMaxContour(const std::vector>& contours, const std::vector& hierarchy); - - std::vector getVertices(const cv::RotatedRect& rect); - - void polyIndent(std::vector& points, float indent); - - void threshold_Mat(const cv::Mat& src, cv::Mat& dst, double thre); - - cv::Mat transforColor(const cv::Mat& src); - - cv::Point warpPoint(cv::Point p, const cv::Mat& warp_mat); -} - -#endif // !IMAGE_PROCESS_C_H diff --git a/ImageTranferBW.cpp b/ImageTranferBW.cpp deleted file mode 100644 index ebf90a8..0000000 --- a/ImageTranferBW.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "stdafx.h" -#include "ImageTranferBW.h" - -using namespace cv; -ImageTranferBW::ImageTranferBW(cv::Mat & mat) -{ - threshold(mat, mat, 200, 255, CV_THRESH_BINARY); - - float kernel_data[] = { -0.1f, 0, 0, 0, -0.1f, 0, 0, 0, 0, 0, 0, 0, 1.5f, 0, 0, 0, 0, 0, 0, 0, -0.1f, 0, 0, 0, -0.1f }; - Mat kernel(5, 5, CV_32FC1, kernel_data); - filter2D(mat, mat, mat.depth(), kernel); - - m_width = mat.cols; - m_height = mat.rows; - - //!< 生成图像 - m_buffer = new unsigned char[height()*step()]; - memset(m_buffer, 0, height()*step()); - unsigned char* binary = m_buffer; - int n_lineByte = (m_width + 7) >> 3; - unsigned char * imageData = mat.data; - unsigned char temp; - for (int row = 0; row < m_height; row++) - { - for (int col = 0; col < m_width; col++) - { - int pos = col % 8; - int pix = *(imageData + row * mat.step1() + col); - temp = 1 << (7 - pos); - if (pix == 255) - { - *(binary + row * m_lineByte + col / 8) |= temp; - } - else - { - *(binary + row * m_lineByte + col / 8) &= (~temp); - } - } - } -} - -ImageTranferBW::~ImageTranferBW() -{ - if (m_buffer != NULL) - { - delete[] m_buffer; - } -} - -unsigned char * ImageTranferBW::getLineBits(int line/* = 0*/) -{ - return m_buffer + step()*line; -} - -int ImageTranferBW::step() -{ - int n_lineByte = (m_width + 7) >> 3; - m_lineByte = ((n_lineByte * 8 + 31) >> 5) << 2; - return m_lineByte; -} - -int ImageTranferBW::bpp() -{ - return 1; -} - -int ImageTranferBW::width() -{ - return m_width; -} - -int ImageTranferBW::height() -{ - return m_height; -} diff --git a/ImageTranferBW.h b/ImageTranferBW.h deleted file mode 100644 index 6c7893a..0000000 --- a/ImageTranferBW.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once -#include "ImageTransfer.h" - -class ImageTranferBW : - public ImageTransfer -{ -public: - ImageTranferBW(cv::Mat &mat); - ~ImageTranferBW(); - - // 通过 ImageTransfer 继承 - virtual unsigned char * getLineBits(int line = 0) override; - virtual int step() override; - virtual int bpp() override; - virtual int width() override; - virtual int height() override; -private: - unsigned char* m_buffer; - int m_width; - int m_height; - int m_lineByte; -}; - diff --git a/ImageTranferMat.cpp b/ImageTranferMat.cpp deleted file mode 100644 index 8612cb5..0000000 --- a/ImageTranferMat.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "stdafx.h" -#include "ImageTranferMat.h" - -ImageTranferMat::ImageTranferMat(cv::Mat & mat):m_mat(mat) {} - -ImageTranferMat::~ImageTranferMat(){} - -unsigned char * ImageTranferMat::getLineBits(int line/* = 0*/) -{ - return m_mat.ptr(line); -} - -int ImageTranferMat::step() -{ - return m_mat.step1(); -} - -int ImageTranferMat::bpp() -{ - return m_mat.elemSize() * 8; -} - -int ImageTranferMat::width() -{ - return m_mat.cols; -} - -int ImageTranferMat::height() -{ - return m_mat.rows; -} diff --git a/ImageTranferMat.h b/ImageTranferMat.h deleted file mode 100644 index 792f8ef..0000000 --- a/ImageTranferMat.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include "ImageTransfer.h" -class ImageTranferMat : - public ImageTransfer -{ -public: - ImageTranferMat(cv::Mat &mat); - virtual ~ImageTranferMat(); - - - - // 通过 ImageTransfer 继承 - virtual unsigned char * getLineBits(int line = 0) override; - - virtual int step() override; - - virtual int bpp() override; - - virtual int width() override; - - virtual int height() override; -private: - cv::Mat m_mat; - -}; - diff --git a/ImageTransfer.h b/ImageTransfer.h deleted file mode 100644 index ab57512..0000000 --- a/ImageTransfer.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once -#include - -class ImageTransfer -{ -public: - ImageTransfer() {} - virtual ~ImageTransfer() {} - - virtual unsigned char* getLineBits(int line = 0) = 0; - virtual int step() = 0; - virtual int bpp() = 0; - virtual int width() = 0; - virtual int height() = 0; -}; \ No newline at end of file diff --git a/IndicatorDlg.cpp b/IndicatorDlg.cpp deleted file mode 100644 index 9854f24..0000000 Binary files a/IndicatorDlg.cpp and /dev/null differ diff --git a/IndicatorDlg.h b/IndicatorDlg.h deleted file mode 100644 index f4f62d8..0000000 Binary files a/IndicatorDlg.h and /dev/null differ diff --git a/JpegBuffer.cpp b/JpegBuffer.cpp deleted file mode 100644 index 3ed25b3..0000000 --- a/JpegBuffer.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "StdAfx.h" -#include "JpegBuffer.h" -#include "jpeglib.h" -#include "twain.h" -//#include "filetools.h" - -using namespace std; - -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(std::vector mats, int color_type, int mFilter) -{ - matdatas = mats; - this->m_color_type = color_type; - this->m_mFilter = mFilter; -} - -JpegBuffer::JpegBuffer() -{ - this->m_buffer = cv::Mat(); - this->m_color_type = 2; - this->m_side = 0; - this->m_mFilter = 0; -} - - -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, pixType); - return image.clone(); -} - -std::vector JpegBuffer::getMats() -{ - std::vector retmats; - for (int i = 0; i < matdatas.size(); i++) - { - JpegLib jl; - cv::Mat image = jl.decode(matdatas[i], m_color_type); - retmats.push_back(image.clone()); - image.release(); - } - return retmats; -} - -int JpegBuffer::getMFilter() -{ - return m_mFilter; -} - -int JpegBuffer::getSide() -{ - return m_side; -} - -bool JpegBuffer::empty() -{ - return matdatas.empty(); -} diff --git a/JpegBuffer.h b/JpegBuffer.h deleted file mode 100644 index 810f2ee..0000000 --- a/JpegBuffer.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#include -//#include "jpeglib.h" - -class JpegBuffer -{ -public: - JpegBuffer(cv::Mat buffer,int color_type=6,int side=0,int mFilter=0); - JpegBuffer(std::vector mats, int color_type = 6,int mFilter = 0); - JpegBuffer(); - virtual ~JpegBuffer(void); - - unsigned char* getBuffer(); - cv::Mat buffer(); - int getSize(); - cv::Mat getMat( int pixType); - std::vector getMats(); - int getMFilter(); - int getSide(); - bool empty(); - -private: - - cv::Mat m_buffer; - std::vector matdatas; - int m_color_type; - int m_side; - int m_mFilter; -}; diff --git a/JsonConfig.cpp b/JsonConfig.cpp deleted file mode 100644 index 3414f47..0000000 --- a/JsonConfig.cpp +++ /dev/null @@ -1,458 +0,0 @@ -#include "StdAfx.h" -#include "JsonConfig.h" -#include -#include -#include -#include -#include "CJsonObject.hpp" - -JsonConfig::JsonConfig(void) -{ -} - - -JsonConfig::~JsonConfig(void) -{ -} - -/************************************************************************/ -/* 保存配置参数 */ -/************************************************************************/ -void JsonConfig::WriteToJson(PCONFIGPARAMS pConfigItem,const std::string fileNames,bool isConfigItem) -{ - - neb::CJsonObject outJson; - - outJson.AddEmptySubObject("Config");//header - outJson["Config"].Add(PIXTYPE,(int)(pConfigItem->Pixtype)); - outJson["Config"].Add(PAPARSIZE,(int)(pConfigItem->PaperSize)); - outJson["Config"].Add(AUTOCROP,(bool)(pConfigItem->EnAutoCrop),false); - outJson["Config"].Add(RESOLUTION,(int)(pConfigItem->Resolution)); - outJson["Config"].Add(DUPLEX,(int)(pConfigItem->Duplex)); - outJson["Config"].Add(DISCARBLANK,(bool)(pConfigItem->EnDiscardBlank),false); - outJson["Config"].Add(DISCARBLANKVINCE,(bool)(pConfigItem->EnDiscardBlankVince),false); - - outJson["Config"].Add(BRIGHTNESS,(int)(pConfigItem->Brightness)); - outJson["Config"].Add(AUTOCONTRAST,(bool)(pConfigItem->EnAutoContrast),false); - outJson["Config"].Add(CONTRAST,(int)(pConfigItem->Contrast)); - outJson["Config"].Add(GAMMA,(int)(pConfigItem->Gamma)); - - outJson["Config"].Add(FILTERTYPE,(int)(pConfigItem->Filter)); - outJson["Config"].Add(AUTODESCREW,(bool)(pConfigItem->EnAutoDescrew),false); - outJson["Config"].Add(FILLBLACK,(bool)(pConfigItem->EnFillBlack),false); - outJson["Config"].Add(MULTIOUTPUT,(bool)(pConfigItem->EnMultiOutPutR),false); - outJson["Config"].Add(OUTHOLE,(bool)(pConfigItem->EnOutHole),false); - outJson["Config"].Add(OUTHOLERATIO,(int)(pConfigItem->OutHoleRatio)); - - outJson["Config"].Add(ULTRADETECT,(bool)(pConfigItem->EnUltrasonicDetect),false); - outJson["Config"].Add(BINDINGDETECT,(bool)(pConfigItem->EnBindingDetect),false); - outJson["Config"].Add(SCANCOUNT,(int)(pConfigItem->ScanCount)); - outJson["Config"].Add(DOCORIENTATION,(int)(pConfigItem->Orentation)); - outJson["Config"].Add(BACKROTATE180,(bool)(pConfigItem->EnBackRotate180),false); - outJson["Config"].Add(SCREWDETECT,(bool)(pConfigItem->EnScrewDetect),false); - outJson["Config"].Add(SCREWLEVEL,(int)(pConfigItem->ScrewDetectLevel)); - if (isConfigItem) - { - outJson["Config"].Add(ITEMCAPTION,(string)(pConfigItem->Caption)); - outJson["Config"].Add(SAVEPATH,(string)(pConfigItem->SavePath)); - } - std::ofstream os; - os.open(fileNames.c_str()); - os< cfgArray,const std::string filename) -{ - //Json::StyledWriter sw; - neb::CJsonObject root; - root.AddEmptySubObject("Config"); - root["Config"].AddEmptySubArray(PIXTYPE); - root["Config"].AddEmptySubArray(PAPARSIZE); - root["Config"].AddEmptySubArray(AUTOCROP); - root["Config"].AddEmptySubArray(RESOLUTION); - root["Config"].AddEmptySubArray(DUPLEX); - root["Config"].AddEmptySubArray(DISCARBLANK); - root["Config"].AddEmptySubArray(DISCARBLANKVINCE); - - root["Config"].AddEmptySubArray(BRIGHTNESS); - root["Config"].AddEmptySubArray(AUTOCONTRAST); - root["Config"].AddEmptySubArray(CONTRAST); - root["Config"].AddEmptySubArray(GAMMA); - - root["Config"].AddEmptySubArray(FILTERTYPE); - root["Config"].AddEmptySubArray(AUTODESCREW); - root["Config"].AddEmptySubArray(FILLBLACK); - root["Config"].AddEmptySubArray(MULTIOUTPUT); - root["Config"].AddEmptySubArray(OUTHOLE); - root["Config"].AddEmptySubArray(OUTHOLERATIO); - - root["Config"].AddEmptySubArray(ULTRADETECT); - root["Config"].AddEmptySubArray(BINDINGDETECT); - root["Config"].AddEmptySubArray(SCANCOUNT); - root["Config"].AddEmptySubArray(DOCORIENTATION); - root["Config"].AddEmptySubArray(BACKROTATE180); - root["Config"].AddEmptySubArray(SCREWDETECT); - root["Config"].AddEmptySubArray(SCREWLEVEL); - - root["Config"].AddEmptySubArray(ITEMCAPTION); - root["Config"].AddEmptySubArray(SAVEPATH); - for (int i=0;i vc; - vc=ReadJsonArrayFromFile(s_default.c_str()); - if (vc.size()!=0) - { - return vc[0]; - } - return GetDefaultConfigParams(); -} - -bool JsonConfig::DeleteJsonFile(std::string path) -{ - return (remove(path.c_str())); -} - -std::vector JsonConfig::ReadJsonArrayFromFile(const std::string filename) -{ - std::vector re; - FILE* file=fopen(filename.c_str(),"rb"); - if (!file) - { - return re; - } - fseek(file,0,SEEK_END); - long size=ftell(file); - fseek(file,0,SEEK_SET); - std::string text; - char* buffer=new char[size+1]; - buffer[size]=0; - if (!fread(buffer,1,size,file)==(unsigned long)size) - { - return re; - } - text=buffer; - fclose(file); - delete []buffer; - re=parseJsonFromString(text); - return re; -} - -CONFIGPARAMS JsonConfig::GetDefaultConfigParams() -{ - CONFIGPARAMS params; - params.Pixtype=1;//灰度 - params.PaperSize=11;//A3 - params.EnAutoCrop=FALSE;//自动裁切 - params.Resolution=200;//200dpi - params.Duplex=1;//双面 - params.EnDiscardBlank=FALSE;//自动丢弃空白页 - params.EnDiscardBlankVince=FALSE; - - params.Brightness=0;//亮度 - params.EnAutoContrast=FALSE;//自动对比度 - params.Contrast=0;//对比度 - params.Gamma=10;//伽玛值 - - params.Filter=0;//除色 无 - params.EnFillBlack=FALSE;//不填黑框 - params.EnAutoDescrew=TRUE;//不自动纠偏 - params.EnMultiOutPutR=FALSE;//不多流输出除红 - params.EnOutHole=FALSE;//不去除孔洞 - params.OutHoleRatio=10;//默认值0.10 - - params.EnUltrasonicDetect=TRUE;//超声检测开关 开 - params.EnBindingDetect=FALSE;//装订检测开关 开 - params.ScanCount=-1;//扫描张数 - params.Orentation=0;//旋转方向0度 - params.EnBackRotate180=FALSE;//背面旋转180度 不旋转 - params.EnScrewDetect=TRUE;//歪斜检测 开 - params.ScrewDetectLevel=3;//歪斜检测等级 3级 - return params; -} - -std::vector JsonConfig::parseJsonFromString(const std::string str) -{ - - neb::CJsonObject root(str); - vector vcConfig; - - int size=0; - neb::CJsonObject itmPaparSize; - root["Config"].Get(PAPARSIZE,itmPaparSize); - size=itmPaparSize.GetArraySize(); - if (size>0) - { - neb::CJsonObject itmPixType; - root["Config"].Get(PIXTYPE,itmPixType); - neb::CJsonObject itmAutoCrop; - root["Config"].Get(AUTOCROP,itmAutoCrop); - neb::CJsonObject itmRes; - root["Config"].Get(RESOLUTION,itmRes); - neb::CJsonObject itmDulpex; - root["Config"].Get(DUPLEX,itmDulpex); - neb::CJsonObject itmDiscardBlk; - root["Config"].Get(DISCARBLANK,itmDiscardBlk); - neb::CJsonObject itmDiscardBlkVince; - root["Config"].Get(DISCARBLANKVINCE,itmDiscardBlkVince); - - neb::CJsonObject itmBrtnes; - root["Config"].Get(BRIGHTNESS,itmBrtnes); - neb::CJsonObject itmAutoCrnt; - root["Config"].Get(AUTOCONTRAST,itmAutoCrnt); - neb::CJsonObject itmContrast; - root["Config"].Get(CONTRAST,itmContrast); - neb::CJsonObject itmGamma; - root["Config"].Get(GAMMA,itmGamma); - - neb::CJsonObject itmFilter; - root["Config"].Get(FILTERTYPE,itmFilter); - neb::CJsonObject itmAutoDescrew; - root["Config"].Get(AUTODESCREW,itmAutoDescrew); - neb::CJsonObject itmFillBlack; - root["Config"].Get(FILLBLACK,itmFillBlack); - neb::CJsonObject itmMultiOutput; - root["Config"].Get(MULTIOUTPUT,itmMultiOutput); - neb::CJsonObject itmOutHole; - root["Config"].Get(OUTHOLE,itmOutHole); - neb::CJsonObject itmOutHoleRatio; - root["Config"].Get(OUTHOLERATIO,itmOutHoleRatio); - - neb::CJsonObject itmUltDetect; - root["Config"].Get(ULTRADETECT,itmUltDetect); - neb::CJsonObject itmBingdingDetect; - root["Config"].Get(BINDINGDETECT,itmBingdingDetect); - neb::CJsonObject itmScanCount; - root["Config"].Get(SCANCOUNT,itmScanCount); - neb::CJsonObject itmDocOrientation; - root["Config"].Get(DOCORIENTATION,itmDocOrientation); - neb::CJsonObject itmBackRotate; - root["Config"].Get(BACKROTATE180,itmBackRotate); - neb::CJsonObject itmScrewDetct; - root["Config"].Get(SCREWDETECT,itmScrewDetct); - neb::CJsonObject itmScrewLevel; - root["Config"].Get(SCREWLEVEL,itmScrewLevel); - - neb::CJsonObject itmCaption; - if (!root["Config"][ITEMCAPTION].IsEmpty()) - { - root["Config"].Get(ITEMCAPTION,itmCaption); - } - neb::CJsonObject itmSavePtah; - if (!root["Config"][SAVEPATH].IsEmpty()) - { - root["Config"].Get(SAVEPATH,itmSavePtah); - } - for (int i=0;i - -using namespace std; - -class JsonConfig -{ -public: - JsonConfig(void); - ~JsonConfig(void); -public: - void WriteToJson(PCONFIGPARAMS pConfigItem,const std::string fileName,bool isConfigItem=true); - //PCONFIGPARAMS ReadJsonFromFile(const char* fileNames); - void WriteJsonData(const std::string fileName); - void WriteJsonArrayToFile(std::vector cfgArray,const std::string filename); - CONFIGPARAMS ReadDefaultConfig(); - bool DeleteJsonFile(std::string path); - std::vector ReadJsonArrayFromFile(const std::string filename); - CONFIGPARAMS GetDefaultConfigParams(); -private: - std::vector parseJsonFromString(const std::string str) ; -}; - diff --git a/MFC_UI.cpp b/MFC_UI.cpp deleted file mode 100644 index 96814a9..0000000 --- a/MFC_UI.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "stdafx.h" -#include "MFC_UI.h" -#include "TwainUIDlg.h" -#include "IndicatorDlg.h" -#include "hugaotwainds.h" -#include "Resource.h" - -extern ChugaotwaindsApp theApp; - -void DeleteWnd(CDialog* pWnd) -{ - if (pWnd && pWnd->GetSafeHwnd()) - { - pWnd->DestroyWindow(); - delete pWnd; - } -} - -MFC_UI::MFC_UI(CTWAINDS_FreeImage *pDS) - : CTWAIN_UI(pDS) - , m_pChildWnd(0, DeleteWnd) - , m_pDlg(0, DeleteWnd) - , m_pIndicator(0, DeleteWnd) -{ -} - - -MFC_UI::~MFC_UI() -{ - -} - -TW_INT16 MFC_UI::DisplayTWAINGUI(TW_USERINTERFACE Data, bool bSetup, bool bIndicators) -{ - TW_INT16 ret = TWRC_SUCCESS; - TW_INT16 nRes = CTWAIN_UI::DisplayTWAINGUI(Data, bSetup, bIndicators); - if (nRes) - { - return nRes; - } - if (bSetup) - { - Data.ShowUI = 1; - } - - if (Data.ShowUI == 0 && !bIndicators) - { - return ret; - } - - if (Data.hParent) - { - m_pChildWnd = std::unique_ptr(new CDialog(), DeleteWnd); - m_pChildWnd->Create(IDD_DIALOGBACK, CWnd::FromHandle((HWND)Data.hParent)); - long ll = GetWindowLong(m_pChildWnd->GetSafeHwnd(), GWL_STYLE); - SetWindowLong(m_pChildWnd->GetSafeHwnd(), GWL_STYLE, WS_CHILD | ll); - SetParent(m_pChildWnd->GetSafeHwnd(), (HWND)Data.hParent); - } - - if (Data.ShowUI) - { - m_pDlg.reset(new TwainUIDlg(this, m_pChildWnd.get())); - m_pDlg->Create(IDD_DIALOG_TWAINUI, m_pChildWnd.get()); - m_pDlg->SetDlgItemText(IDC_CONFIRM,bSetup ? _T("确定") : _T("扫描")); - - if (m_pDlg) { - m_pDlg->ShowWindow(SW_SHOWNORMAL); - } - else { - ret = TWRC_FAILURE; - } - } - - return ret; -} - - -void MFC_UI::DestroyTWAINGUI() -{ - m_pIndicator.reset(); - m_pDlg.reset(); - m_pChildWnd.reset(); - - CTWAIN_UI::DestroyTWAINGUI(); -} - - -void MFC_UI::UpdateProgress(bool bShow, unsigned char ucProgress, unsigned int unPageNo, string strProgressTitle) -{ -} - -unsigned int MFC_UI::MyMessageBox(string strMessage, string strTitle, unsigned int unIconID) -{ - if (m_pChildWnd != NULL) - { - return ::MessageBox(m_pChildWnd->m_hWnd, strMessage.c_str(), strTitle.c_str(), unIconID); - } - return ::MessageBox(NULL, strMessage.c_str(), strTitle.c_str(), unIconID); -} - -bool MFC_UI::processEvent(pTW_EVENT _pEvent) -{ - if (m_pDlg) - { - if (IsDialogMessage(m_pDlg->m_hWnd, (LPMSG)(((pTW_EVENT)_pEvent)->pEvent))) - { - m_pDlg->SendMessage(_pEvent->TWMessage); - return TRUE; - } - } - return FALSE; -} - -void MFC_UI::ShowIndicators() -{ - if (m_bIndicators) { - m_pIndicator.reset(new IndicatorDlg(this)); - m_pIndicator->Create(IDD_DIALOG_INDICATOR,m_pDlg ? m_pDlg.get() : m_pChildWnd.get()); - m_pIndicator->ShowWindow(SW_SHOWNORMAL); - } -} - -void MFC_UI::DestroyIndicators() -{ - m_pIndicator.reset(); -} diff --git a/MFC_UI.h b/MFC_UI.h deleted file mode 100644 index b613fb7..0000000 --- a/MFC_UI.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once -#include "CTWAINDS_FreeImage.h" -#include "TWAIN_UI.h" -#include -class TwainUIDlg; -class CWnd; -class IndicatorDlg; -class ChugaotwaindsApp; - -class MFC_UI : - public CTWAIN_UI -{ -public: - MFC_UI(CTWAINDS_FreeImage *pDS); - ~MFC_UI(); - - /** -* Will show the TWAIN GUI -* @param[in] _pData contains info about if the UI should be shown etc. -* @return a valid TWRC_xxxx return code. -*/ - TW_INT16 DisplayTWAINGUI(TW_USERINTERFACE Data, bool bSetup, bool bIndicators); - - /** - * Close the user interface for TWAIN - */ - void DestroyTWAINGUI(); - void UpdateProgress(bool bShow, unsigned char ucProgress, unsigned int unPageNo, string strProgressTitle); - unsigned int MyMessageBox(string strMessage, string strTitle, unsigned int unIconID); - bool processEvent(pTW_EVENT _pEvent); - -private: - std::unique_ptr m_pChildWnd; - std::unique_ptr m_pDlg; - std::unique_ptr m_pIndicator; - ChugaotwaindsApp* m_app; - - // 通过 CTWAIN_UI 继承 - virtual void ShowIndicators() override; - virtual void DestroyIndicators() override; -}; - diff --git a/MutexEx.h b/MutexEx.h deleted file mode 100644 index d454cd3..0000000 --- a/MutexEx.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include -//对临界区同样进行封装 -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; -}; - - diff --git a/PaperSize.cpp b/PaperSize.cpp deleted file mode 100644 index f651888..0000000 --- a/PaperSize.cpp +++ /dev/null @@ -1,227 +0,0 @@ -#include "stdafx.h" -#include "PaperSize.h" - -using namespace std; - -PaperSize::PaperSize() -{ - InitPaperMap(); -} - - -PaperSize::~PaperSize() -{ -} - -void PaperSize::InitPaperMap() -{ - //自适应 - dpiDct.insert(pair, CSize>(pair((TwSS)90, 50.0), CSize(594, 898))); - dpiDct.insert(pair, CSize>(pair((TwSS)90, 75), CSize(892, 1347))); - dpiDct.insert(pair, CSize>(pair((TwSS)90, 100), CSize(1189, 1795))); - dpiDct.insert(pair, CSize>(pair((TwSS)90, 150), CSize(1784, 2693))); - dpiDct.insert(pair, CSize>(pair((TwSS)90, 200), CSize(2338, 3307))); - dpiDct.insert(pair, CSize>(pair((TwSS)90, 240), CSize(2854, 4308))); - dpiDct.insert(pair, CSize>(pair((TwSS)90, 300), CSize(3567, 5385))); - dpiDct.insert(pair, CSize>(pair((TwSS)90, 400), CSize(4756, 7180))); - dpiDct.insert(pair, CSize>(pair((TwSS)90, 600), CSize(7134, 10770))); - - //A3 - dpiDct.insert(pair, CSize>(pair(A3, 50), CSize(585, 827))); - dpiDct.insert(pair, CSize>(pair(A3, 75), CSize(877, 1240))); - dpiDct.insert(pair, CSize>(pair(A3, 100), CSize(1169, 1653))); - dpiDct.insert(pair, CSize>(pair(A3, 150), CSize(1753, 2480))); - dpiDct.insert(pair, CSize>(pair(A3, 200), CSize(2338, 3307))); - dpiDct.insert(pair, CSize>(pair(A3, 240), CSize(2806, 3968))); - dpiDct.insert(pair, CSize>(pair(A3, 300), CSize(3507, 4960))); - dpiDct.insert(pair, CSize>(pair(A3, 400), CSize(4677, 6614))); - dpiDct.insert(pair, CSize>(pair(A3, 600), CSize(7015, 9921))); - - //A4 - dpiDct.insert(pair, CSize>(pair(A4, 50), CSize(413, 585))); - dpiDct.insert(pair, CSize>(pair(A4, 75), CSize(620, 877))); - dpiDct.insert(pair, CSize>(pair(A4, 100), CSize(826, 1169))); - dpiDct.insert(pair, CSize>(pair(A4, 150), CSize(1240, 1753))); - dpiDct.insert(pair, CSize>(pair(A4, 200), CSize(1653, 2338))); - dpiDct.insert(pair, CSize>(pair(A4, 240), CSize(1984, 2806))); - dpiDct.insert(pair, CSize>(pair(A4, 300), CSize(2480, 3507))); - dpiDct.insert(pair, CSize>(pair(A4, 400), CSize(3307, 4677))); - dpiDct.insert(pair, CSize>(pair(A4, 600), CSize(4960, 7015))); - - //A4R - dpiDct.insert(pair, CSize>(pair(A4R, 50), CSize(585, 413))); - dpiDct.insert(pair, CSize>(pair(A4R, 75), CSize(877, 620))); - dpiDct.insert(pair, CSize>(pair(A4R, 100), CSize(1169, 826))); - dpiDct.insert(pair, CSize>(pair(A4R, 150), CSize(1753, 1240))); - dpiDct.insert(pair, CSize>(pair(A4R, 200), CSize(2338, 1653))); - dpiDct.insert(pair, CSize>(pair(A4R, 240), CSize(2806, 1984))); - dpiDct.insert(pair, CSize>(pair(A4R, 300), CSize(3507, 2480))); - dpiDct.insert(pair, CSize>(pair(A4R, 400), CSize(4677, 3307))); - dpiDct.insert(pair, CSize>(pair(A4R, 600), CSize(7015, 4960))); - - //A5 - dpiDct.insert(pair, CSize>(pair(A5, 50), CSize(291, 413))); - dpiDct.insert(pair, CSize>(pair(A5, 75), CSize(437, 620))); - dpiDct.insert(pair, CSize>(pair(A5, 100), CSize(582, 826))); - dpiDct.insert(pair, CSize>(pair(A5, 150), CSize(874, 1240))); - dpiDct.insert(pair, CSize>(pair(A5, 200), CSize(1165, 1653))); - dpiDct.insert(pair, CSize>(pair(A5, 240), CSize(1398, 1984))); - dpiDct.insert(pair, CSize>(pair(A5, 300), CSize(1748, 2480))); - dpiDct.insert(pair, CSize>(pair(A5, 400), CSize(2330, 3307))); - dpiDct.insert(pair, CSize>(pair(A5, 600), CSize(3496, 4960))); - - //A5R - dpiDct.insert(pair, CSize>(pair(A5R, 50), CSize(413, 291))); - dpiDct.insert(pair, CSize>(pair(A5R, 75), CSize(620, 437))); - dpiDct.insert(pair, CSize>(pair(A5R, 100), CSize(826, 582))); - dpiDct.insert(pair, CSize>(pair(A5R, 150), CSize(1240, 874))); - dpiDct.insert(pair, CSize>(pair(A5R, 200), CSize(1653, 1165))); - dpiDct.insert(pair, CSize>(pair(A5R, 240), CSize(1984, 1398))); - dpiDct.insert(pair, CSize>(pair(A5R, 300), CSize(2480, 1748))); - dpiDct.insert(pair, CSize>(pair(A5R, 400), CSize(3307, 2330))); - dpiDct.insert(pair, CSize>(pair(A5R, 600), CSize(4960, 3496))); - - //A6 - dpiDct.insert(pair, CSize>(pair(A6, 50), CSize(207, 291))); - dpiDct.insert(pair, CSize>(pair(A6, 75), CSize(310, 437))); - dpiDct.insert(pair, CSize>(pair(A6, 100), CSize(413, 582))); - dpiDct.insert(pair, CSize>(pair(A6, 150), CSize(620, 874))); - dpiDct.insert(pair, CSize>(pair(A6, 200), CSize(826, 1165))); - dpiDct.insert(pair, CSize>(pair(A6, 240), CSize(992, 1398))); - dpiDct.insert(pair, CSize>(pair(A6, 300), CSize(1240, 1748))); - dpiDct.insert(pair, CSize>(pair(A6, 400), CSize(1653, 2330))); - dpiDct.insert(pair, CSize>(pair(A6, 600), CSize(2480, 3496))); - - //A6R - dpiDct.insert(pair, CSize>(pair(A6R, 50), CSize(291, 207))); - dpiDct.insert(pair, CSize>(pair(A6R, 75), CSize(437, 310))); - dpiDct.insert(pair, CSize>(pair(A6R, 100), CSize(582, 413))); - dpiDct.insert(pair, CSize>(pair(A6R, 150), CSize(874, 620))); - dpiDct.insert(pair, CSize>(pair(A6R, 200), CSize(1165, 826))); - dpiDct.insert(pair, CSize>(pair(A6R, 240), CSize(1398, 992))); - dpiDct.insert(pair, CSize>(pair(A6R, 300), CSize(1748, 1240))); - dpiDct.insert(pair, CSize>(pair(A6R, 400), CSize(2330, 1653))); - dpiDct.insert(pair, CSize>(pair(A6R, 600), CSize(3496, 2480))); - - //长文稿,2倍A3 - dpiDct.insert(pair, CSize>(pair((TwSS)91, 50), CSize(585, 1653))); - dpiDct.insert(pair, CSize>(pair((TwSS)91, 75), CSize(877, 2480))); - dpiDct.insert(pair, CSize>(pair((TwSS)91, 100), CSize(1169, 1653 * 2))); - dpiDct.insert(pair, CSize>(pair((TwSS)91, 150), CSize(1753, 2480 * 2))); - dpiDct.insert(pair, CSize>(pair((TwSS)91, 200), CSize(2338, 3307 * 2))); - dpiDct.insert(pair, CSize>(pair((TwSS)91, 240), CSize(2806, 3968 * 2))); - dpiDct.insert(pair, CSize>(pair((TwSS)91, 300), CSize(3507, 4960 * 2))); - dpiDct.insert(pair, CSize>(pair((TwSS)91, 400), CSize(4677, 6614 * 2))); - dpiDct.insert(pair, CSize>(pair((TwSS)91, 600), CSize(7015, 9921 * 2))); - - //B4 - dpiDct.insert(pair, CSize>(pair(B4, 50), CSize(506, 717))); - dpiDct.insert(pair, CSize>(pair(B4, 75), CSize(759, 1075))); - dpiDct.insert(pair, CSize>(pair(B4, 100), CSize(1011, 1433))); - dpiDct.insert(pair, CSize>(pair(B4, 150), CSize(1517, 2149))); - dpiDct.insert(pair, CSize>(pair(B4, 200), CSize(2023, 2866))); - dpiDct.insert(pair, CSize>(pair(B4, 240), CSize(2428, 3439))); - dpiDct.insert(pair, CSize>(pair(B4, 300), CSize(3035, 4299))); - dpiDct.insert(pair, CSize>(pair(B4, 400), CSize(4047, 5732))); - dpiDct.insert(pair, CSize>(pair(B4, 600), CSize(6070, 8598))); - - //B5 - dpiDct.insert(pair, CSize>(pair(B5, 50), CSize(358, 506))); - dpiDct.insert(pair, CSize>(pair(B5, 75), CSize(537, 759))); - dpiDct.insert(pair, CSize>(pair(B5, 100), CSize(716, 1011))); - dpiDct.insert(pair, CSize>(pair(B5, 150), CSize(1074, 1517))); - dpiDct.insert(pair, CSize>(pair(B5, 200), CSize(1433, 2023))); - dpiDct.insert(pair, CSize>(pair(B5, 240), CSize(1719, 2428))); - dpiDct.insert(pair, CSize>(pair(B5, 300), CSize(2149, 3035))); - dpiDct.insert(pair, CSize>(pair(B5, 400), CSize(2866, 4047))); - dpiDct.insert(pair, CSize>(pair(B5, 600), CSize(4299, 6070))); - - //B5R - dpiDct.insert(pair, CSize>(pair(B5R, 50), CSize(506, 358))); - dpiDct.insert(pair, CSize>(pair(B5R, 75), CSize(759, 537))); - dpiDct.insert(pair, CSize>(pair(B5R, 100), CSize(1011, 716))); - dpiDct.insert(pair, CSize>(pair(B5R, 150), CSize(1517, 1075))); - dpiDct.insert(pair, CSize>(pair(B5R, 200), CSize(2023, 1433))); - dpiDct.insert(pair, CSize>(pair(B5R, 240), CSize(2428, 1719))); - dpiDct.insert(pair, CSize>(pair(B5R, 300), CSize(3035, 2149))); - dpiDct.insert(pair, CSize>(pair(B5R, 400), CSize(4047, 2866))); - dpiDct.insert(pair, CSize>(pair(B5R, 600), CSize(6070, 4299))); - - //B6 - dpiDct.insert(pair, CSize>(pair(B6, 50), CSize(252, 358))); - dpiDct.insert(pair, CSize>(pair(B6, 75), CSize(378, 537))); - dpiDct.insert(pair, CSize>(pair(B6, 100), CSize(503, 716))); - dpiDct.insert(pair, CSize>(pair(B6, 150), CSize(755, 1074))); - dpiDct.insert(pair, CSize>(pair(B6, 200), CSize(1007, 1433))); - dpiDct.insert(pair, CSize>(pair(B6, 240), CSize(1209, 1719))); - dpiDct.insert(pair, CSize>(pair(B6, 300), CSize(1511, 2149))); - dpiDct.insert(pair, CSize>(pair(B6, 400), CSize(2015, 2866))); - dpiDct.insert(pair, CSize>(pair(B6, 600), CSize(3023, 4299))); - - //B6R - dpiDct.insert(pair, CSize>(pair(B6R, 50), CSize(358, 252))); - dpiDct.insert(pair, CSize>(pair(B6R, 75), CSize(537, 378))); - dpiDct.insert(pair, CSize>(pair(B6R, 100), CSize(716, 503))); - dpiDct.insert(pair, CSize>(pair(B6R, 150), CSize(1074, 755))); - dpiDct.insert(pair, CSize>(pair(B6R, 200), CSize(1433, 1007))); - dpiDct.insert(pair, CSize>(pair(B6R, 240), CSize(1719, 1209))); - dpiDct.insert(pair, CSize>(pair(B6R, 300), CSize(2149, 1511))); - dpiDct.insert(pair, CSize>(pair(B6R, 400), CSize(2866, 2015))); - dpiDct.insert(pair, CSize>(pair(B6R, 600), CSize(4299, 3023))); - - //DOUBLE LETTER - dpiDct.insert(pair, CSize>(pair(DOUBLELetter, 50), CSize(550, 850))); - dpiDct.insert(pair, CSize>(pair(DOUBLELetter, 75), CSize(825, 1275))); - dpiDct.insert(pair, CSize>(pair(DOUBLELetter, 100), CSize(1100, 1700))); - dpiDct.insert(pair, CSize>(pair(DOUBLELetter, 150), CSize(1650, 2550))); - dpiDct.insert(pair, CSize>(pair(DOUBLELetter, 200), CSize(2200, 3400))); - dpiDct.insert(pair, CSize>(pair(DOUBLELetter, 240), CSize(2640, 4080))); - dpiDct.insert(pair, CSize>(pair(DOUBLELetter, 300), CSize(3300, 5100))); - dpiDct.insert(pair, CSize>(pair(DOUBLELetter, 400), CSize(4400, 6800))); - dpiDct.insert(pair, CSize>(pair(DOUBLELetter, 600), CSize(6600, 10200))); - - //LETTER - dpiDct.insert(pair, CSize>(pair(USLetter, 50), CSize(425, 550))); - dpiDct.insert(pair, CSize>(pair(USLetter, 75), CSize(638, 825))); - dpiDct.insert(pair, CSize>(pair(USLetter, 100), CSize(850, 1100))); - dpiDct.insert(pair, CSize>(pair(USLetter, 150), CSize(1275, 1650))); - dpiDct.insert(pair, CSize>(pair(USLetter, 200), CSize(1700, 2200))); - dpiDct.insert(pair, CSize>(pair(USLetter, 240), CSize(2040, 2640))); - dpiDct.insert(pair, CSize>(pair(USLetter, 300), CSize(2550, 3300))); - dpiDct.insert(pair, CSize>(pair(USLetter, 400), CSize(3400, 4400))); - dpiDct.insert(pair, CSize>(pair(USLetter, 600), CSize(5100, 6600))); - - //LETTERR - dpiDct.insert(pair, CSize>(pair(USLetterR, 50), CSize(550, 425))); - dpiDct.insert(pair, CSize>(pair(USLetterR, 75), CSize(825, 638))); - dpiDct.insert(pair, CSize>(pair(USLetterR, 100), CSize(1100, 850))); - dpiDct.insert(pair, CSize>(pair(USLetterR, 150), CSize(1650, 1275))); - dpiDct.insert(pair, CSize>(pair(USLetterR, 200), CSize(2200, 1700))); - dpiDct.insert(pair, CSize>(pair(USLetterR, 240), CSize(2640, 2040))); - dpiDct.insert(pair, CSize>(pair(USLetterR, 300), CSize(3300, 2550))); - dpiDct.insert(pair, CSize>(pair(USLetterR, 400), CSize(4400, 3400))); - dpiDct.insert(pair, CSize>(pair(USLetterR, 600), CSize(6600, 5100))); - - //LETTERR - dpiDct.insert(pair, CSize>(pair(USLegal, 50), CSize(425, 700))); - dpiDct.insert(pair, CSize>(pair(USLegal, 75), CSize(638, 1050))); - dpiDct.insert(pair, CSize>(pair(USLegal, 100), CSize(850, 1400))); - dpiDct.insert(pair, CSize>(pair(USLegal, 150), CSize(1275, 2100))); - dpiDct.insert(pair, CSize>(pair(USLegal, 200), CSize(1700, 2800))); - dpiDct.insert(pair, CSize>(pair(USLegal, 240), CSize(2040, 3360))); - dpiDct.insert(pair, CSize>(pair(USLegal, 300), CSize(2550, 4200))); - dpiDct.insert(pair, CSize>(pair(USLegal, 400), CSize(3400, 5600))); - dpiDct.insert(pair, CSize>(pair(USLegal, 600), CSize(5100, 8400))); -} - -CSize PaperSize::GetPaperSize(DWORD paperType, float dpi) -{ - CSize retSize; - map, CSize>::iterator iter; - iter = dpiDct.find(pair((TwSS)paperType, dpi)); - if (iter != dpiDct.end()) { - retSize = (*iter).second; - return retSize; - } - return CSize(2338, 3307); -} diff --git a/PaperSize.h b/PaperSize.h deleted file mode 100644 index 353d343..0000000 --- a/PaperSize.h +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once -#include - -class PaperSize -{ -public: - PaperSize(); - ~PaperSize(); - enum TwSS : unsigned short - { - None = 0, - A4Letter = 1, - A4 = 1, - B5Letter = 2, - JISB5 = 2, - B5 = 2, - USLetter = 3, - USLegal = 4, - A5 = 5, - B4 = 6, - ISOB4 = 6, - B6 = 7, - ISOB6 = 7, - USLedger = 9, - USExecutive = 10, - A3 = 11, - B3 = 12, - ISOB3 = 12, - A6 = 13, - C4 = 14, - C5 = 15, - C6 = 16, - _4A0 = 17, - _2A0 = 18, - A0 = 19, - A1 = 20, - A2 = 21, - A7 = 22, - A8 = 23, - A9 = 24, - A10 = 25, - ISOB0 = 26, - ISOB1 = 27, - ISOB2 = 28, - ISOB5 = 29, - ISOB7 = 30, - ISOB8 = 31, - ISOB9 = 32, - ISOB10 = 33, - JISB0 = 34, - JISB1 = 35, - JISB2 = 36, - JISB3 = 37, - JISB4 = 38, - JISB6 = 39, - JISB7 = 40, - JISB8 = 41, - JISB9 = 42, - JISB10 = 43, - C0 = 44, - C1 = 45, - C2 = 46, - C3 = 47, - C7 = 48, - C8 = 49, - C9 = 50, - C10 = 51, - USStatement = 52, - BusinessCard = 53, - A4R = 60, - A5R = 61, - A6R = 62, - B5R = 70, - B6R = 71, - USLetterR = 80, - DOUBLELetter = 81, - AUTO = 90 - }; -private: - void InitPaperMap(); - std::map, CSize> dpiDct; -public: - CSize GetPaperSize(DWORD paperType, float dpi); -}; - diff --git a/PublicFunc.cpp b/PublicFunc.cpp deleted file mode 100644 index 0738c8b..0000000 --- a/PublicFunc.cpp +++ /dev/null @@ -1,617 +0,0 @@ -#include "stdafx.h" -#include "PublicFunc.h" -//#include "UI_INI.h" -//#include "DirectshowCaptureVideo.h" -//#include "DirectshowCaptureVideoUvc.h" -//#include "WatermarkDataType.h" -//#include "SupperDevType.h" -#include "CTwainMutex.h" -#include - - - -BOOL g_b_show_ui_flg = FALSE; - -//WATER_PRO g_st_water_pro = {0}; -BOOL g_add_water_flg = FALSE; -DWORD g_dw_white_bright_count = 40000; - -//CDirectshowCaptureVideoUvc g_dc_uvc_video; -BOOL g_b_use_uvc_dev = FALSE; -TWAIN_IMAGE_DATA_INFO g_st_twain_bmp_info = {0}; -BOOL g_b_brigth_show_flg = TRUE; -HWND g_hwnd_dlg = NULL; - -//CDirectshowCaptureVideo g_dc_video; - -TCHAR* GetUserCustomFilePath(HWND hWin, TCHAR* lpFilePath, TCHAR *lp_head_text ) -{ - if ( lpFilePath == NULL ) - { - return NULL; - } - - BROWSEINFO bi = {0}; - TCHAR szBuffer[MAX_PATH] = {0}; - - memset(&bi, 0, sizeof(BROWSEINFO)); - - - bi.hwndOwner = hWin; - bi.pszDisplayName = GetExistFileDir(lpFilePath); - bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_SHAREABLE | BIF_USENEWUI | BIF_RETURNFSANCESTORS ; - - LPITEMIDLIST pIDList = NULL; - LPMALLOC lpMalloc = NULL; - //m_pUI_INI->GetMessageBoxStr(szBuffer, sizeof(szBuffer), 1041); - //bi.lpszTitle = szBuffer;//1041=请选择文件存储路径 - bi.lpszTitle = lp_head_text;//TEXT("请选择新建文件夹"); - bi.lpfn = (BFFCALLBACK)BrowserCallbackProc; //回调函数 - bi.lParam = (LPARAM)lpFilePath; //回调函数的使用的参数,用来设定默认路径 - - pIDList = SHBrowseForFolder(&bi); - if ( pIDList != NULL ) - { - SHGetPathFromIDList(pIDList, lpFilePath); - } - if ( SHGetMalloc( &lpMalloc ) ) - { - return NULL; //释放内存    - } - if ( pIDList == NULL ) - { - return NULL; //释放内存 - } - lpMalloc->Free(pIDList); - lpMalloc->Release(); - pIDList = NULL; - lpMalloc = NULL; - //_tcscpy(lpFilePath, szBuffer2); - return lpFilePath; -} - -TCHAR* GetCurExeFilePath(HINSTANCE hInstance, TCHAR* lpPath, DWORD dwSize) -{ - INT nRet = 0x0L; - TCHAR *p = NULL; - if ( lpPath == NULL || dwSize == 0 ) - { - return NULL; - } - nRet = GetModuleFileName(hInstance, lpPath, dwSize); - if (nRet > 0) - { - p = _tcsrchr(lpPath, TEXT('\\')); - if ( p != NULL ) - { - *(p+1) = TEXT('\0'); - } - else - { - return NULL; - } - } - else - { - return NULL; - } - return lpPath; -} - -TCHAR* GetExistFileDir(TCHAR* p_file_path) -{ - WIN32_FIND_DATA wfd = {0}; - LPSTR p_test = NULL; - HANDLE hFindFile = INVALID_HANDLE_VALUE; - - if ( p_file_path == NULL ) - return NULL; - - hFindFile = FindFirstFile(p_file_path, &wfd); - if (hFindFile != NULL) - { - FindClose(hFindFile); - hFindFile= INVALID_HANDLE_VALUE; - } - if ( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) - { - return p_file_path; - } - - p_test = _tcsrchr(p_file_path, '\\'); - if ( p_test != NULL ) - { - *p_test = 0; - return GetExistFileDir(p_file_path); - } - else - { - return NULL; - } -} - -DWORD CALLBACK BrowserCallbackProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - switch(uMsg) - { - case BFFM_INITIALIZED: //LPARAM(TEXT("D:\\test_adf_project")) - SendMessage(hWnd, BFFM_SETSELECTION, TRUE, lParam); //lpData就是上一个函数的 info.lParam ,也就是默认路径 - break; - default: - break; - } - return 0; -} - -BOOL CheckAndCreateFileDir(TCHAR* p_file_path, BOOL flg) -{ - TCHAR szTmp[MAX_PATH] = {0}; - WIN32_FIND_DATA wfd = {0}; - INT len = 0; - INT pos = 0; - BOOL bFlg = FALSE; - HANDLE hFindFile = INVALID_HANDLE_VALUE; - - if ( p_file_path == NULL ) - return FALSE; - - if ( *p_file_path >= 'a' && *p_file_path <= 'z' || *p_file_path >= 'A' && *p_file_path <= 'Z') - { - if ( *(p_file_path+1) != ':' && *(p_file_path+2) != '\\') - { - return FALSE; - } - } - if ( _access(p_file_path, 0) == 0) - { - return TRUE; - } - - if ( !flg ) - return FALSE; - - if ( CreateDirectory(p_file_path, NULL) ) - return TRUE; - - _tcscpy(szTmp, p_file_path); - - len = (INT)_tcslen(szTmp); - - bFlg = FALSE; - while(len) - { - if ( *(szTmp+len-1) == '\\' ) - { - bFlg = TRUE; - break; - } - len--; - } - if ( bFlg ) - { - *(szTmp+len-1) = 0; - CheckAndCreateFileDir(szTmp, flg); - return CreateDirectory(p_file_path, NULL); - } - else - return FALSE; -} - -BOOL CheckDiskFreeBitM(HWND hWin, TCHAR *p_disk_name, DWORD dw_min_bit_m) -{ - TCHAR *p = NULL; - TCHAR sz_root_path_name[MAX_PATH + 1] = {0}; - INT len = 0; - - DWORD dwTotalDiskSpace = 0; - DWORD dwFreeDiskSpace = 0; - DWORD dwUsedDiskSpace = 0; - - ULARGE_INTEGER uiFreeBytesAvailableToCaller; - ULARGE_INTEGER uiTotalNumberOfBytes; - ULARGE_INTEGER uiTotalNumberOfFreeBytes; - - UINT un_ret = 0; - if ( p_disk_name == NULL ) - return FALSE; - - len = _tcslen(p_disk_name); - if ( len > MAX_PATH ) - { - len = MAX_PATH; - } - - memcpy(sz_root_path_name, p_disk_name, (size_t)len); - - p = _tcsstr(sz_root_path_name, "\\"); - if ( p == NULL ) - { - if ( len == 2 ) - { - if ( !((sz_root_path_name[0] >= 'A' && sz_root_path_name[0] <= 'Z' || sz_root_path_name[0] >= 'a' && sz_root_path_name[0] <= 'z') && sz_root_path_name[1]== ':') ) - return FALSE; - } - else - return FALSE; - } - if ( p != NULL ) - *(p+1) = 0; - un_ret = GetDriveType(sz_root_path_name); - if ( un_ret == 0 || un_ret == 1) - { - return FALSE; - } - - if(GetDiskFreeSpaceEx(sz_root_path_name, &uiFreeBytesAvailableToCaller, &uiTotalNumberOfBytes, &uiTotalNumberOfFreeBytes)) - { - //dwTotalDiskSpace = (DWORD)(uiTotalNumberOfBytes.QuadPart / 1024 / 1024); - dwFreeDiskSpace = (DWORD)(uiFreeBytesAvailableToCaller.QuadPart >> 20); - //dwUsedDiskSpace = dwTotalDiskSpace - dwFreeDiskSpace; - if ( dwFreeDiskSpace < dw_min_bit_m ) - { - //ShowErrorStr(hWin, 1101);//1101=磁盘空间不足 - MyMessageBox( TEXT("磁盘分区可用空间不足"), 0, MB_ICONWARNING); - return FALSE; - } - } - else - { - MyMessageBox( TEXT("磁盘分区可用空间不足"), 0, MB_ICONWARNING); - //GetErrorMessage(NULL, 0, FALSE); - return FALSE; - } - //ShowErrorStr(hWin, 1101);//1101=磁盘空间不足 - //return FALSE; - return TRUE; -} - -HBITMAP SetButtonStaticBkBmp(HINSTANCE hInst, HWND hWin, UINT id, UINT iamge_id) -{ - - UINT ctr_msg = 0; - UINT str_iamge_type = 0; - HBITMAP hBitmap = NULL; - HBITMAP hOldBitmap = NULL; - //BS_ICON BS_BITMAP - //SS_BITMAP|SS_CENTERIMAGE SS_ICON - - LONG ctr_s = 0; - ctr_s = GetWindowLong(GetDlgItem(hWin, id), GWL_STYLE); - - ctr_msg = STM_SETIMAGE; - ctr_s |= SS_BITMAP | SS_CENTERIMAGE | SS_RIGHT; - - hBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(iamge_id)); - - if ( hBitmap == NULL ) - { - return NULL; - } - - SetWindowLong(GetDlgItem(hWin, id), GWL_STYLE, ctr_s); - hOldBitmap = (HBITMAP)SendDlgItemMessage(hWin, id, ctr_msg, IMAGE_BITMAP, (LPARAM)hBitmap); - if ( hOldBitmap != NULL ) - { - DeleteObject(hOldBitmap); - hOldBitmap = NULL; - } - DeleteObject(hBitmap); - hBitmap = NULL; - return hBitmap; -} - - -VOID FreeTwainFileListMem() -{ - if ( g_st_twain_bmp_info.p_wifl != NULL ) - { - free(g_st_twain_bmp_info.p_wifl); - g_st_twain_bmp_info.p_wifl = NULL; - } - - //if ( g_st_twain_bmp_info.st_bmp_info.p_image_data != NULL ) - //{ - // free(g_st_twain_bmp_info.st_bmp_info.p_image_data); - // g_st_twain_bmp_info.st_bmp_info.p_image_data = NULL; - //} - //memset(&g_st_twain_bmp_info, 0, sizeof(TWAIN_IMAGE_DATA_INFO)); -} - -BOOL MallocTwainFileListMem() -{ - if ( g_st_twain_bmp_info.p_wifl == NULL ) - { - memset(&g_st_twain_bmp_info, 0, sizeof(TWAIN_IMAGE_DATA_INFO)); - } - else if ( g_st_twain_bmp_info.n_wifl_count != 0 && g_st_twain_bmp_info.p_wifl == NULL ) - { - memset(&g_st_twain_bmp_info, 0, sizeof(TWAIN_IMAGE_DATA_INFO)); - } - - if ( g_st_twain_bmp_info.n_wifl_cur_count +3 > g_st_twain_bmp_info.n_wifl_count) - { - if ( SHGetSpecialFolderPath(NULL, g_st_twain_bmp_info.sz_path_dir, CSIDL_LOCAL_APPDATA, TRUE) ) - { - INT len = _tcslen(g_st_twain_bmp_info.sz_path_dir); - if ( len > 0 ) - { - //if ( g_st_twain_bmp_info.sz_path_dir[len -1] != '\\' ) - // _tcscat(g_st_twain_bmp_info.sz_path_dir, TEXT("\\")); - //_tcscat(g_st_twain_bmp_info.sz_path_dir, TWAIN_DATA_PATH); - //CheckAndCreateFileDir(g_st_twain_bmp_info.sz_path_dir, TRUE); - } - } - else - return FALSE; - if ( g_st_twain_bmp_info.p_wifl == NULL ) - { - g_st_twain_bmp_info.p_wifl = (PTWAIN_IMAGE_FILE_LIST)malloc(sizeof(TWAIN_IMAGE_FILE_LIST)* (g_st_twain_bmp_info.n_wifl_count + 20)); - if ( g_st_twain_bmp_info.p_wifl != NULL ) - { - memset(g_st_twain_bmp_info.p_wifl, 0, sizeof(TWAIN_IMAGE_FILE_LIST)* (g_st_twain_bmp_info.n_wifl_count + 20)); - g_st_twain_bmp_info.n_wifl_count += 20; - - - } - else - return FALSE; - } - else - { - PTWAIN_IMAGE_FILE_LIST p_wifl = (PTWAIN_IMAGE_FILE_LIST)malloc(sizeof(TWAIN_IMAGE_FILE_LIST)* (g_st_twain_bmp_info.n_wifl_count + 20)); - if ( g_st_twain_bmp_info.p_wifl != NULL ) - { - memset(p_wifl, 0, sizeof(TWAIN_IMAGE_FILE_LIST)* (g_st_twain_bmp_info.n_wifl_count + 20)); - memcpy(p_wifl, g_st_twain_bmp_info.p_wifl, sizeof(TWAIN_IMAGE_FILE_LIST)* g_st_twain_bmp_info.n_wifl_cur_count ); - g_st_twain_bmp_info.n_wifl_count += 20; - free(g_st_twain_bmp_info.p_wifl); - g_st_twain_bmp_info.p_wifl = p_wifl; - p_wifl = NULL; - } - else - return FALSE; - } - } - return TRUE; -} - -BOOL WriteTwianImageData(TCHAR *p_file_path, PBYTE p_data, DWORD dw_size) -{ - DWORD dw_write_size = 0; - - if ( p_file_path == NULL || p_data == NULL ) - return FALSE; - if ( _msize(p_data) < dw_size ) - return FALSE; - - DeleteFile(p_file_path); - HANDLE h_file = CreateFile(p_file_path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, NULL, NULL); - if ( h_file == INVALID_HANDLE_VALUE ) - { - return FALSE; - } - BOOL b_flg = WriteFile(h_file, p_data, dw_size, &dw_write_size,0); - if ( !b_flg || dw_size != dw_write_size ) - { - b_flg = FALSE; - } - CloseHandle(h_file); - h_file = INVALID_HANDLE_VALUE; - if ( !b_flg ) - { - DeleteFile(p_file_path); - } - - return TRUE; -} - -DWORD ReadTwianImageData(TCHAR *p_file_path) -{ - if ( p_file_path == NULL ) - return 0; - - DWORD dw_size = 0; - - HANDLE h_file = CreateFile(p_file_path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL); - if ( h_file == INVALID_HANDLE_VALUE ) - { - return 0; - } - dw_size = GetFileSize(h_file, 0); - if ( dw_size == 0 ) - { - CloseHandle(h_file); - return 0; - } - //if ( g_st_twain_bmp_info.st_bmp_info.p_image_data != NULL ) - //{ - // free(g_st_twain_bmp_info.st_bmp_info.p_image_data); - // g_st_twain_bmp_info.st_bmp_info.p_image_data = NULL; - //} - //DWORD dw_read_size = 0; - //g_st_twain_bmp_info.st_bmp_info.p_image_data = (PBYTE)malloc(dw_size); - //if ( g_st_twain_bmp_info.st_bmp_info.p_image_data == NULL ) - //{ - // CloseHandle(h_file); - // return 0; - //} - - //BOOL b_flg = ReadFile(h_file, ////g_st_twain_bmp_info.st_bmp_info.p_image_data, dw_size, /&dw_read_size,/ 0); - ////CloseHandle(h_file); - //h_file = INVALID_HANDLE_VALUE; - //if ( !b_flg || dw_size != dw_read_size) - //{ - // //free(g_st_twain_bmp_info.st_bmp_info.p_image_data); - // dw_size = 0; - //} - //else - // DeleteFile(p_file_path); - - return dw_size; -} - - -std::string UtfToString(std::string strValue) -{ - int nwLen = ::MultiByteToWideChar(CP_ACP, 0, strValue.c_str(), -1, NULL, 0); - wchar_t * pwBuf = new wchar_t[nwLen + 1];//加上末尾'\0' - ZeroMemory(pwBuf, nwLen * 2 + 2); - ::MultiByteToWideChar(CP_ACP, 0, strValue.c_str(), strValue.length(), pwBuf, nwLen); - int nLen = ::WideCharToMultiByte(CP_UTF8, 0, pwBuf, -1, NULL, NULL, NULL, NULL); - char * pBuf = new char[nLen + 1]; - ZeroMemory(pBuf, nLen + 1); - ::WideCharToMultiByte(CP_UTF8, 0, pwBuf, nwLen, pBuf, nLen, NULL, NULL); - std::string retStr(pBuf); - delete []pwBuf; - delete []pBuf; - pwBuf = NULL; - pBuf = NULL; - return retStr; -} - - -std::string StringToUtf(std::string strValue) -{ - int nwLen = MultiByteToWideChar(CP_UTF8, 0, strValue.c_str(), -1, NULL, 0); - wchar_t * pwBuf = new wchar_t[nwLen + 1];//加上末尾'\0' - memset(pwBuf, 0, nwLen * 2 + 2); - MultiByteToWideChar(CP_UTF8, 0, strValue.c_str(), strValue.length(), pwBuf, nwLen); - int nLen = WideCharToMultiByte(CP_ACP, 0, pwBuf, -1, NULL, NULL, NULL, NULL); - char * pBuf = new char[nLen + 1]; - memset(pBuf, 0, nLen + 1); - WideCharToMultiByte(CP_ACP, 0, pwBuf, nwLen, pBuf, nLen, NULL, NULL); - std::string retStr = pBuf; - delete []pBuf; - delete []pwBuf; - return retStr; -} - -DWORD MyMessageBox(TCHAR *p_str, TCHAR *p_str2, DWORD dw_id) -{ - if ( p_str2 == NULL ) - { - return MessageBox(g_hwnd_dlg, p_str, TEXT("test")/*g_p_cur_supper_sdti->sz_type_str*/, dw_id); - } - else - { - return MessageBox(g_hwnd_dlg, p_str, p_str2, dw_id); - } -} - -CTwainMutex g_sys_mutex; -BOOL g_not_user_sineng_dev = true; -BOOL g_InitSysMutexRun() -{ - //return g_sys_mutex.InitRunMutexId(COMPANY_NAME PRODUCT_NAME); - return true; - //return g_sys_mutex.CreatTwainMutex(SCANNERNAME); -} - -BOOL g_InitSysMutexScanRun(DWORD dwPid, DWORD dwUid) -{ - //return g_sys_mutex.InitScanRunMutexId(COMPANY_NAME PRODUCT_NAME, dwPid, dwUid); - return true; -} - -BOOL g_CloseSysMutexRun() -{ - //return g_sys_mutex.CloseAllScnDocA3Mutex(); - return g_sys_mutex.CloseTwainMutex(); -} - -BOOL g_CloseOneSysMutexRun() -{ - //return g_sys_mutex.CloseScnDocA3Mutex((SCN_MUTEX_TYPE)smt); - return true; - //return g_sys_mutex.CloseTwainMutex(); -} - -BOOL g_CheckSysMutex() -{ - //return g_sys_mutex.CheckScnDocA3Mutex((SCN_MUTEX_TYPE)smt); - return true; - return g_sys_mutex.CheckExistTwainMutex(SCANNERNAME); -} - -BOOL g_CreateSysMutex() -{ - //return g_sys_mutex.CreateScnDocA3Mutex((SCN_MUTEX_TYPE)smt); - //return true; - return g_sys_mutex.CreatTwainMutex(SCANNERNAME); -} - -RGBQUAD g_default_map[256] = {0}; - -BOOL ReadDefaultMap() -{ - int i = 0; - for ( i = 0; i < 256; i++ ) - { - g_default_map[i].rgbBlue = g_default_map[i].rgbGreen = g_default_map[i].rgbRed = i; - } - - TCHAR sz_path[MAX_PATH] = {0}; - bool nRet = GetModuleFileName(AfxGetApp()->m_hInstance, sz_path, sizeof(sz_path)); - if (nRet > 0) - { - TCHAR *p = _tcsrchr(sz_path, TEXT('\\')); - if ( p != NULL ) - { - *(p+1) = TEXT('\0'); - } - else - { - return TRUE; - } - } - _tcscat(sz_path, TEXT("default.map")); - HANDLE hfile = CreateFile(sz_path, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, NULL, NULL); - if ( hfile != INVALID_HANDLE_VALUE ) - { - DWORD dw_write = 0; - ReadFile(hfile, g_default_map, sizeof(g_default_map), &dw_write, NULL); - if ( dw_write != sizeof(g_default_map) ) - { - nRet = false; - } - CloseHandle(hfile); - } - return nRet; -} - -float GetContrast(int level) -{ - float ret=0.0; - switch (level) - { - case -3: - ret=-1000.0; - break; - case -2: - ret=-666.0; - break; - case -1: - ret=-333.0; - break; - case 1: - ret=333.0; - break; - case 2: - ret=666.0; - break; - case 3: - ret=1000.0; - break; - } - return ret; -} - -VOID XdPrint(_TCHAR* format, ...) -{ - va_list args; - va_start(args, format); - _TCHAR buf[256]; - _vstprintf(buf, format, args); - OutputDebugString(buf); - va_end(args); -} \ No newline at end of file diff --git a/PublicFunc.h b/PublicFunc.h deleted file mode 100644 index c498ad2..0000000 --- a/PublicFunc.h +++ /dev/null @@ -1,366 +0,0 @@ -#ifndef PUBLICFUNC_H_ -#define PUBLICFUNC_H_ - -#include "stdafx.h" -#include - -//#include "UI_INI.h" -//#include "DirectshowCaptureVideo.h" -//#include "DirectshowCaptureVideoUvc.h" -using namespace std; - -/************************************ -**扫描参数,json格式保存参数名称** -*************************************/ -#define PIXTYPE "iPixType" -#define PAPARSIZE "iPaparSize" -#define AUTOCROP "bAuotCrop" -#define RESOLUTION "iResolution" -#define DUPLEX "iDuplex" -#define DISCARBLANK "bDiscardBlank" -#define DISCARBLANKVINCE "bDiscardBlankVince" -#define FLOD "bFlod" -#define BRIGHTNESS "iBrightness" -#define AUTOCONTRAST "bAutoContrast" -#define CONTRAST "iContrast" -#define GAMMA "dGamma" -#define FILTERTYPE "iFilter" -#define FILLBLACK "bFillBlcak" -#define AUTODESCREW "bAutoDescrew" -#define ULTRADETECT "bUltrasonicDetect" -#define BINDINGDETECT "bBindingDetect" -#define SCANCOUNT "ScanCount" -#define DOCORIENTATION "bOrientation" -#define BACKROTATE180 "iBackRotate180" -#define SCREWDETECT "bScrewDetect" -#define SCREWLEVEL "iScrewLevel" -#define ITEMCAPTION "Caption" -#define SAVEPATH "SavePath" -#define MULTIOUTPUT "iMultiOutPut" -#define OUTHOLE "bOutHole" -#define OUTHOLERATIO "iOutHoleRatio" - -/****************** -**参数保存结构体** -*******************/ -struct tagCONFIGPARAMS -{ - /*基本选项卡参数*/ - INT Pixtype; - INT PaperSize; - BOOL EnAutoCrop; - INT Resolution; - INT Duplex; - BOOL EnDiscardBlank; - BOOL EnDiscardBlankVince; - BOOL EnFlod; - /*亮度对比度选项卡参数*/ - INT Brightness; - BOOL EnAutoContrast; - INT Contrast; - INT Gamma; - - /*图像处理选项卡参数*/ - INT Filter; - BOOL EnFillBlack; - BOOL EnAutoDescrew; - //BOOL EnMulti - BOOL EnOutHole; - INT OutHoleRatio; - BOOL EnMultiOutPutR; - - /*送纸部分选项卡参数*/ - BOOL EnUltrasonicDetect; - BOOL EnBindingDetect; - INT ScanCount; - INT Orentation; - BOOL EnBackRotate180; - BOOL EnScrewDetect; - INT ScrewDetectLevel; - - /*保存信息*/ - std::string Caption; - std::string SavePath; -}; - -typedef tagCONFIGPARAMS CONFIGPARAMS,*PCONFIGPARAMS; - -struct tagCONFIGINFO -{ - std::string Caption; - std::string SavePath; -}; - -typedef struct tagCONFIGINFO CONFIGINFO,*PCONFIGINFO; - -struct tagOutHole -{ - BOOL EnOutHole; - INT OutHoleRatio; -}; - -typedef tagOutHole OutHole,*pOutHole; - -struct tagHARDWAREPARAMS -{ - DWORD PaperType; - DWORD PixType; - FLOAT Resolution; - BOOL DoubleFeederOn; - BOOL StapleDetectOn; - BOOL SkrewDetectOn; - DWORD SkrewDetectLevel; -}; - -typedef tagHARDWAREPARAMS HARDWAREPARAMS, *PHARDWAREPARAMS; - -struct SFreeImage -{ - WORD m_nPaperSource; /**< the current paper source ADF or Flatbed*/ - bool m_bDuplex; /**< True to use duplex false for simplex, ignored if flatbed*/ - WORD m_nPixelType; /**< type of pixels to transfer image as */ - int m_nRight; /**< frame right edge */ - int m_nBottom; /**< frame bottom edge */ - int m_nLeft; /**< frame left edge */ - int m_nTop; /**< frame top edge */ - float m_fXResolution; /**< horizontal resolution */ - float m_fYResolution; /**< vertical resolution */ - float m_fGamma; /**< Gamma */ - float m_fContrast; /**< Contrast */ - float m_fBrightness; /**< Brightness */ - float m_fThreshold; /**< Threshold */ - //int m_nPaparType /**< 纸张类型*/ - //后加 - BOOL m_bAutoContrast; /**< 自动对比度*/ - bool m_bAutoCrop; /**< 自动裁切*/ - bool m_bAutoDiscardBlank; /**< 自动丢弃空白页通用*/ - bool m_bAutoDiscardBlankInvoice;/**自动丢弃空白页发票*/ - bool m_bAutoDeskew; /**< 自动纠偏*/ - bool m_bMultiOutput; /*多流输出*/ - WORD m_nFilter; /**< 除色*/ - bool m_bFillBlackRect; /**< 填黑框*/ - UINT16 m_wScanCount; /**< 扫描张数*/ - WORD m_wRotation; /**< 旋转方向*/ - bool m_bBackRotate180; /**< 背面旋转180*/ - HARDWAREPARAMS m_HardWareParams; /**< 硬件扫描参数*/ - OutHole m_OutHole; -}; - -typedef struct tag_USBCB { - UINT32 u32_CMD; - UINT32 u32_Data; - UINT32 u32_Count; -}USBCB, *PUSBCB; - -//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, - //获取有无纸的状态 - GET_PAPER_STATUS = 0x0d, - //下发元器件配置参数(灰度,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 -}; - -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 -}; - -typedef enum tagUsbSupported UsbSupported, *PUsbSupported; - - -#define CAPTION_LEN 256 -#define TWAIN_IMAGE_FILE_LIST_NAME TEXT(".dat") - -#ifndef malloc_my -#define malloc_my malloc -#endif - -typedef struct tagTWAIN_IMAGE_FILE_LIST -{ - INT n_item;// - TCHAR sz_path[MAX_PATH]; - DWORD dw_color_bit; - DWORD dw_width; - DWORD dw_height; - DWORD dw_dpi; - DWORD dw_image_size; - BOOL b_del_flg;//文件时是否删除, 传送一个删除一个 -}TWAIN_IMAGE_FILE_LIST,FAR*PTWAIN_IMAGE_FILE_LIST; - - -typedef struct tagTWAIN_IMAGE_DATA_INFO -{ - BOOL b_lock_flg;//是否在使用中 - //BOOL b_flg; - TCHAR sz_path_dir[MAX_PATH];//文件目录 - //IMAGE_BMP_INFO st_bmp_info;//图像信息 - PTWAIN_IMAGE_FILE_LIST p_wifl; - INT n_wifl_count;//内存大小 - INT n_wifl_cur_count;//当前使用内存个数 - INT n_wifl_cur_pos;//当前传送内存位置 - -}TWAIN_IMAGE_DATA_INFO, FAR*PTWAIN_IMAGE_DATA_INFO; - -DWORD ReadTwianImageData(TCHAR *p_file_path); -BOOL WriteTwianImageData(TCHAR *p_file_path, PBYTE p_data, DWORD dw_size); -BOOL MallocTwainFileListMem(); -VOID FreeTwainFileListMem(); - -//取得用户自定义目录,参数 窗口句柄,当前目录, 显示在浏览对话框上的字符串 -TCHAR* GetUserCustomFilePath(HWND hWin, LPSTR lpFilePath, TCHAR *lp_head_text = NULL); -//取得当前模块的文件路径, 参数,模块实列举并, 文件路径, 字符串的长度 -TCHAR* GetCurExeFilePath(HINSTANCE hInstance, TCHAR* lpPath, DWORD dwSize); -//取得路径中已经存在的路径,并返回 -TCHAR* GetExistFileDir(TCHAR* p_file_path); -//回调函数,取得用户自定义的文件路径 -DWORD CALLBACK BrowserCallbackProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ; - -std::string UtfToString(std::string strValue); - -std::string StringToUtf(std::string strValue); -//检查,创建文件夹, 参数 文件路径, = 真,创建p_file_path不寻在文件路径 -BOOL CheckAndCreateFileDir(TCHAR* p_file_path, BOOL flg); - -BOOL CheckDiskFreeBitM(HWND hWin, TCHAR *p_disk_name, DWORD dw_min_bit_m); -HBITMAP SetButtonStaticBkBmp(HINSTANCE hInst, HWND hWin, UINT id, UINT iamge_id); -DWORD MyMessageBox(TCHAR *p_str, TCHAR *p_str2, DWORD dw_id); - - -extern TWAIN_IMAGE_DATA_INFO g_st_twain_bmp_info; - -//extern CDirectshowCaptureVideo g_dc_video; -extern BOOL g_b_show_ui_flg; - -//extern WATER_PRO g_st_water_pro; -extern BOOL g_add_water_flg; -extern DWORD g_dw_white_bright_count; - -//extern CDirectshowCaptureVideoUvc g_dc_uvc_video; -extern BOOL g_b_use_uvc_dev ; -extern BOOL g_b_brigth_show_flg; - -extern HWND g_hwnd_dlg; - -//extern CSysMutex g_sys_mutex; - -typedef enum tagSYS_MUTEX_TYPE -{ - SYSMUTEX_APP_RUN_TYPE,// ok - SYSMUTEX_TWAIN_RUN_TYPE, - SYSMUTEX_APP_SCANNER_RUN_TYPE, - SYSMUTEX_TWAIN_SCANNER_RUN_TYPE -}SYS_MUTEX_TYPE, FAR* PSYS_MUTEX_TYPE; - -BOOL g_InitSysMutexRun(); -BOOL g_InitSysMutexScanRun(DWORD dwPid, DWORD dwUid); -BOOL g_CloseSysMutexRun(); -BOOL g_CloseOneSysMutexRun(); -BOOL g_CreateSysMutex(); -BOOL g_CheckSysMutex(); -float GetContrast(int level); -VOID XdPrint(_TCHAR* format, ...); -extern BOOL g_not_user_sineng_dev; -extern RGBQUAD g_default_map[256]; - -BOOL ReadDefaultMap(); -#endif \ No newline at end of file diff --git a/SaveConfigDlg.cpp b/SaveConfigDlg.cpp deleted file mode 100644 index d557d13..0000000 --- a/SaveConfigDlg.cpp +++ /dev/null @@ -1,91 +0,0 @@ -锘// SaveConfigDlg.cpp : 瀹炵幇鏂囦欢 -// - -#include "stdafx.h" -#include "hugaotwainds.h" -#include "SaveConfigDlg.h" -#include "afxdialogex.h" -//#include "UI_INI.h" -#include "TwainUIDlg.h" -//#include "JsonConfig.h" -#include - - -// SaveConfigDlg 瀵硅瘽妗 - -IMPLEMENT_DYNAMIC(SaveConfigDlg, CDialog) - -//extern CUI_INI* m_pUI_INI; -SaveConfigDlg::SaveConfigDlg(CWnd* pParent /*=NULL*/) - : CDialog(IDD_DIALOGSAVECONFIG, pParent) -{ - -} - -SaveConfigDlg::~SaveConfigDlg() -{ -} - -void SaveConfigDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} - - -BEGIN_MESSAGE_MAP(SaveConfigDlg, CDialog) - ON_BN_CLICKED(IDOK, &SaveConfigDlg::OnBnClickedOk) -END_MESSAGE_MAP() - - -// SaveConfigDlg 娑堟伅澶勭悊绋嬪簭 - - -void SaveConfigDlg::OnBnClickedOk() -{ - TwainUIDlg* m_Parent=(TwainUIDlg*)GetParent(); - CONFIGPARAMS citem={0}; - m_Parent->UpDateScanParam(&citem,false); - CString m_sName; - GetDlgItemTextA(IDC_EDITSAVENAME,m_sName); - TCHAR szIniFile[MAX_PATH] = { 0 }; - INT length=m_sName.GetLength(); - //INT length=10; - if (length>0&&length<50) - { - char invalid_FileChars[8]={'/','\\',':','*',' ?','<', '>','|'}; - for(short j=0;j<8;j++) - { - m_sName.Remove(invalid_FileChars[j]); - } - if (m_sName.IsEmpty()) - { - MessageBox(_TEXT("璇烽伩鍏嶈緭鍏ラ潪娉曞瓧绗('/','\\',':','*',' ?','<', '>','|')!"),_TEXT("鎻愮ず"),MB_OK|MB_ICONWARNING - ); - return; - } - SHGetSpecialFolderPath(NULL, szIniFile, CSIDL_LOCAL_APPDATA, TRUE); - _tcscat(szIniFile,HUAGAO_SCAN); - _tcscat(szIniFile, TWAIN_DATA_PATH); - citem.Caption=m_sName; - _tcscat(szIniFile,(_TEXT("/")+m_sName+_TEXT(".json"))); - std::string s_savePath(szIniFile); - citem.SavePath=s_savePath; - //((CListBox*)(m_Parent->GetDlgItem(IDC_LSTCONFIG)))->AddString(m_sName); - m_sName.ReleaseBuffer(); - JsonConfig cfg; - cfg.WriteToJson(&citem,s_savePath,true); - m_Parent->UpdateListConfig(); - CDialog::OnOK(); - } - else - { - if (length==0) - { - MessageBox(_TEXT("璇疯緭鍏ヤ繚瀛橀」鍚嶇О"),_TEXT("鎻愮ず")); - } - else - { - MessageBox(_TEXT("鏈澶氬彧鍏佽杈撳叆50涓瓧绗,璇烽噸鏂拌緭鍏"),_TEXT("鎻愮ず")); - } - } -} diff --git a/SaveConfigDlg.h b/SaveConfigDlg.h deleted file mode 100644 index 68b2515..0000000 --- a/SaveConfigDlg.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -//#include "UI_INI.h" -// SaveConfigDlg 对话框 - -class SaveConfigDlg : public CDialog -{ - DECLARE_DYNAMIC(SaveConfigDlg) - -public: - SaveConfigDlg(CWnd* pParent = NULL); // 标准构造函数 - virtual ~SaveConfigDlg(); - -// 对话框数据 - #ifdef AFX_DESIGN_TIME - enum { IDD = IDD_DIALOGSAVECONFIG }; - #endif - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 - - DECLARE_MESSAGE_MAP() -public: - afx_msg void OnBnClickedOk(); - -private: - CWnd* m_Parent; -}; diff --git a/StopWatch.h b/StopWatch.h deleted file mode 100644 index afa4ee9..0000000 --- a/StopWatch.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once -#include - -class StopWatch -{ -public: - StopWatch() { - _start = std::chrono::steady_clock::now(); - } - - void reset() { - _start = std::chrono::steady_clock::now(); - } - - double elapsed_s() { - return std::chrono::duration(std::chrono::steady_clock::now() - _start).count(); - } - - double elapsed_ms() { - return std::chrono::duration(std::chrono::steady_clock::now() - _start).count(); - } - - double elapsed_us() { - return std::chrono::duration(std::chrono::steady_clock::now() - _start).count(); - } - - double elapsed_ns() { - return std::chrono::duration(std::chrono::steady_clock::now() - _start).count(); - } - -private: - std::chrono::steady_clock::time_point _start; -}; - diff --git a/SupperScanImageMTF.cpp b/SupperScanImageMTF.cpp deleted file mode 100644 index 5957091..0000000 --- a/SupperScanImageMTF.cpp +++ /dev/null @@ -1,247 +0,0 @@ -#include "stdafx.h" -#include "SupperScanImageMTF.h" -#include "math.h" - -CSupperScanImageMTF::CSupperScanImageMTF(void) -{ - memset(&st_im, 0, sizeof(IMAGE_MTF)); - blank_bk = NULL; - cur_image = NULL; -} - -CSupperScanImageMTF::~CSupperScanImageMTF(void) -{ - memset(&st_im, 0, sizeof(IMAGE_MTF)); - delete[]blank_bk[0]; - delete[]blank_bk; - delete[]cur_image[0]; - delete[]cur_image; -} -/// -/// return the state of the image whether it is blank. -/// -bool CSupperScanImageMTF::GetImageBlankFlag() -{ - return is_blank; -} -/// -/// Initialize the information needed to estimate an image. -/// set the size of the image, the starting coordinate. -/// set the parameters related to the dafault values(10,10,1.0,76). -/// If the initialization finished,return true and the b_init_image_info_flg will be set to true; -/// otherwise return false. -/// -/// the width ,height of the input image. -/// the starting position on the width and the height direction. -bool CSupperScanImageMTF::InitMTFImageInfo(INT n_image_width, INT n_image_height, INT n_start_x, INT n_start_y) -{ - if (st_im.b_init_image_info_flg) - return TRUE; - if (n_image_width < 0 || n_image_height < 0 || n_start_x < 0 || n_start_y < 0) - { - return FALSE; - } - if ((n_image_width - n_start_x) < width_half_count * 2 || (n_image_height - n_start_y) < height_half_count * 2) - { - return FALSE; - } - memset(&st_im, 0, sizeof(IMAGE_MTF)); - st_im.st_image_size.n_image_height = n_image_height; - st_im.st_image_size.n_image_width = n_image_width; - st_im.st_image_size.n_image_start_x = n_start_x; - st_im.st_image_size.n_image_start_y = n_start_y; - FLOAT f_x = (n_image_width - n_start_x)*1.0F / (width_half_count * 2); - FLOAT f_y = (n_image_height - n_start_y)*1.0F / (height_half_count * 2); - st_im.n_mtf_image_width = (INT)f_x; - st_im.n_mtf_image_height = (INT)f_y; - - //SetSkipBlankPara(10, 10, 1, 76); - - st_im.b_init_image_info_flg = TRUE; - return TRUE; -} - -/// -/// estimate the input image whehter it is blank or not -/// set the size of the image, the starting coordinate; -/// set the parameters(INT w_half_count, INT h_half_count, INT f_range, INT thres) needed to estimate -/// an image blank to the dafault values(10,10,1.0,76). -/// allocate space for the two-dimensional array which will contain the computed variances of each region of the input image. -/// allocate space for the two-dimensional array which will contain the computed variances of each region of a blank image. -/// initialize both of the two arrays to 0.0. -/// -/// the width of the input image. -/// the height of the input image. -/// the starting position on the width direction . -/// the start position on the height direction. -bool CSupperScanImageMTF::IsImageBlank(PBYTE p_image_data, INT n_image_width, INT n_image_height, DWORD dw_bit_color) -{ - bool blank = false; - if (p_image_data == NULL && n_image_width != st_im.st_image_size.n_image_height && n_image_height != st_im.st_image_size.n_image_width) - return blank; - if (!st_im.b_init_image_info_flg) { - return blank; - } - INT n_w = 0; - INT n_h = 0; - INT n_x = 0; - INT n_y = 0; - DWORD dw_all_r = 0; - DWORD dw_all_g = 0; - DWORD dw_all_b = 0; - INT f_r_average = 0.0F; - INT f_g_average = 0.0F; - INT f_b_average = 0.0F; - DWORD dw_src_image_line_bytes = (n_image_width * dw_bit_color + 31) / 32 * 4; - - if (dw_bit_color >= 8 && dw_bit_color % 8 == 0 && dw_bit_color != 16) - { - DWORD dw_bit_pixel = dw_bit_color >> 3; - DWORD dwMTF_RECT_HEIGHT = n_image_height / (height_half_count * 2); - DWORD dwMTF_RECT_WIDTH = n_image_width / (width_half_count * 2); - PBYTE p_data_ls = NULL; - DWORD dw_data_pos_h_ls = 0; - DWORD dw_data_pos_w_ls = 0; - for (n_h = 0; n_h < height_half_count * 2; n_h++) - { - for (n_w = 0; n_w < width_half_count * 2; n_w++) - { - dw_all_r = 0; - dw_all_g = 0; - dw_all_b = 0; - p_data_ls = p_image_data + n_h * dwMTF_RECT_HEIGHT * dw_src_image_line_bytes + n_w * dwMTF_RECT_WIDTH * dw_bit_pixel; - dw_data_pos_h_ls = 0; - for (n_y = 0; n_y < dwMTF_RECT_HEIGHT; n_y++) - { - dw_data_pos_w_ls = 0; - for (n_x = 0; n_x < dwMTF_RECT_WIDTH; n_x++) - { - if (dw_bit_pixel == 1) { - dw_all_g += *(p_data_ls + dw_data_pos_h_ls + dw_data_pos_w_ls); - } - else { - dw_all_b += *(p_data_ls + dw_data_pos_h_ls + dw_data_pos_w_ls + 0); - dw_all_g += *(p_data_ls + dw_data_pos_h_ls + dw_data_pos_w_ls + 1); - dw_all_r += *(p_data_ls + dw_data_pos_h_ls + dw_data_pos_w_ls + 2); - } - dw_data_pos_w_ls += dw_bit_pixel; - } - dw_data_pos_h_ls += dw_src_image_line_bytes; - } - if (dw_bit_pixel == 1) { - f_r_average = f_g_average = f_b_average = dw_all_g / (dwMTF_RECT_HEIGHT * dwMTF_RECT_WIDTH); - } - else { - f_b_average = dw_all_b / (dwMTF_RECT_HEIGHT * dwMTF_RECT_WIDTH); - f_g_average = dw_all_g / (dwMTF_RECT_HEIGHT * dwMTF_RECT_WIDTH); - f_r_average = dw_all_r / (dwMTF_RECT_HEIGHT * dwMTF_RECT_WIDTH); - } - dw_all_r = 0; - dw_all_g = 0; - dw_all_b = 0; - p_data_ls = p_image_data + n_h * dwMTF_RECT_HEIGHT * dw_src_image_line_bytes + n_w * dwMTF_RECT_WIDTH * dw_bit_pixel; - dw_data_pos_h_ls = 0; - DWORD dw_tmp = 0x0L; - for (n_y = 0; n_y < dwMTF_RECT_HEIGHT; n_y++) - { - dw_data_pos_w_ls = 0; - for (n_x = 0; n_x < dwMTF_RECT_WIDTH; n_x++) - { - if (dw_bit_pixel == 1) { - dw_tmp = *(p_data_ls + dw_data_pos_h_ls + dw_data_pos_w_ls) - f_g_average; - dw_all_g += (DWORD)dw_tmp * dw_tmp; - } - else { - dw_tmp = *(p_data_ls + dw_data_pos_h_ls + dw_data_pos_w_ls + 0) - f_b_average; - dw_all_b += dw_tmp * dw_tmp; - dw_tmp = *(p_data_ls + dw_data_pos_h_ls + dw_data_pos_w_ls + 1) - f_g_average; - dw_all_g += dw_tmp * dw_tmp; - dw_tmp = *(p_data_ls + dw_data_pos_h_ls + dw_data_pos_w_ls + 2) - f_r_average; - dw_all_r += dw_tmp * dw_tmp; - } - dw_data_pos_w_ls += dw_bit_pixel; - } - dw_data_pos_h_ls += dw_src_image_line_bytes; - } - if (dw_bit_pixel == 1) { - cur_image[n_w][n_h].f_r_mtf = cur_image[n_w][n_h].f_g_mtf = cur_image[n_w][n_h].f_b_mtf = (INT)sqrt((dw_all_g*1.0F) / (dwMTF_RECT_HEIGHT * dwMTF_RECT_WIDTH - 1)); - } - else { - cur_image[n_w][n_h].f_r_mtf = (INT)sqrt((dw_all_r*1.0F) / (dwMTF_RECT_HEIGHT * dwMTF_RECT_WIDTH - 1)); - cur_image[n_w][n_h].f_g_mtf = (INT)sqrt((dw_all_g*1.0F) / (dwMTF_RECT_HEIGHT * dwMTF_RECT_WIDTH - 1)); - cur_image[n_w][n_h].f_b_mtf = (INT)sqrt((dw_all_b*1.0F) / (dwMTF_RECT_HEIGHT * dwMTF_RECT_WIDTH - 1)); - } - } - } - } - else - { - return blank; - } - st_im.n_cur_precent_rect_count = 0; - for (n_w = 0; n_w < width_half_count * 2; n_w++) - { - for (n_h = 0; n_h < height_half_count * 2; n_h++) - { - if (CMP_FLOAT_RANGLE(blank_bk[n_w][n_h].f_r_mtf, float_range, cur_image[n_w][n_h].f_r_mtf) && \ - CMP_FLOAT_RANGLE(blank_bk[n_w][n_h].f_g_mtf, float_range, cur_image[n_w][n_h].f_g_mtf) && \ - CMP_FLOAT_RANGLE(blank_bk[n_w][n_h].f_b_mtf, float_range, cur_image[n_w][n_h].f_b_mtf)) - { - st_im.n_cur_precent_rect_count++; - } - } - } - st_im.n_cur_precent_rect_count = (INT)((st_im.n_cur_precent_rect_count)*1.0F / (height_half_count * width_half_count * 4) * 100); - if (st_im.n_cur_precent_rect_count >= threshold)//背景 - { - blank = true; - is_blank = blank; - } - return blank; -} - -/// -/// Set the parameters needed to estimate whether an image is blank or not. -/// allocate space for the two two-dimensional array which will contain the computed variances of each region of the input image and a blank image respectively. -/// initialize both of the two arrays to 0.0. -/// If the setting finished,return true; otherwise return false. -/// -/// half of the number of blocks divided on the width and height of the input image. -/// the float range of variance compared with 0,because the variances of regions of an blank image are all 0. -/// the percent of regions whose variance is in the floating range. -bool CSupperScanImageMTF::SetSkipBlankPara(INT w_half_count, INT h_half_count, INT f_range, INT thres) { - if (w_half_count <= 0 || w_half_count >= (st_im.st_image_size.n_image_width >> 1) || h_half_count <= 0 || h_half_count >= st_im.st_image_size.n_image_height >> 1) { - return FALSE; - } - if (f_range < 0 || thres < 0 || thres >100) { - return FALSE; - } - this->width_half_count = w_half_count; - this->height_half_count = h_half_count; - this->float_range = f_range; - this->threshold = thres; - if (blank_bk != NULL) { - delete[]blank_bk[0]; - delete[]blank_bk; - } - if (cur_image != NULL) { - delete[]cur_image[0]; - delete[]cur_image; - } - blank_bk = new IMAGE_RECT_MTF *[width_half_count * 2];//背景mtf - cur_image = new IMAGE_RECT_MTF *[width_half_count * 2];//当前帧的MTF - blank_bk[0] = new IMAGE_RECT_MTF[width_half_count *height_half_count * 4]; - cur_image[0] = new IMAGE_RECT_MTF[width_half_count *height_half_count * 4]; - for (int i = 1; i < width_half_count * 2; ++i) { - blank_bk[i] = blank_bk[i - 1] + height_half_count * 2; - cur_image[i] = cur_image[i - 1] + height_half_count * 2; - } - IMAGE_RECT_MTF bk = { 0.0f, 0.0f, 0.0f }; - for (int i = 0; i < width_half_count * 2; ++i) { - for (int j = 0; j < height_half_count * 2; ++j) { - blank_bk[i][j] = bk; - cur_image[i][j] = bk; - } - } - return TRUE; -} \ No newline at end of file diff --git a/SupperScanImageMTF.h b/SupperScanImageMTF.h deleted file mode 100644 index 10f5ea8..0000000 --- a/SupperScanImageMTF.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once -#include -#define CMP_FLOAT_RANGLE(F_SRC,F_ERR,F_CUR) (F_CUR<=(F_SRC+F_ERR))&&(F_CUR>=(F_SRC-F_ERR)) - - -typedef struct tagIMAGE_SIZE_MTF -{ - INT n_image_width; - INT n_image_height; - INT n_image_start_x; - INT n_image_start_y; -}IMAGE_SIZE_MTF,*PIMAGE_SIZE_MTF; - -typedef struct tagIMAGE_RECT_MTF -{ - FLOAT f_r_mtf; - FLOAT f_g_mtf; - FLOAT f_b_mtf; -}IMAGE_RECT_MTF,*PIMAGE_RECT_MTF; - -typedef struct tagIMAGE_MTF -{ - INT width_half_count; - INT height_half_count; - INT n_mtf_image_width; - INT n_mtf_image_height; - INT n_cur_precent_rect_count; - IMAGE_SIZE_MTF st_image_size; - bool b_init_image_info_flg; -}IMAGE_MTF,*PIMAGE_MTF; - -class CSupperScanImageMTF -{ -public: - CSupperScanImageMTF(void); - ~CSupperScanImageMTF(void); - IMAGE_MTF st_im; - -private : - bool is_blank; - INT width_half_count; - INT height_half_count; - INT float_range; - INT threshold; - - bool b_init_image_info_flg; - IMAGE_RECT_MTF(**blank_bk); - IMAGE_RECT_MTF(**cur_image); - - -public: - bool SetSkipBlankPara(INT width_half_count,INT height_half_count,INT float_range,INT threshold); - bool GetImageBlankFlag(); - bool InitMTFImageInfo(INT n_image_width, INT n_image_height, INT n_start_x, INT n_start_y); - bool IsImageBlank(PBYTE p_image_data, INT n_image_width, INT n_image_height, DWORD dw_bit_color); - -}; diff --git a/TWAINContainer.cpp b/TWAINContainer.cpp deleted file mode 100644 index 598be39..0000000 --- a/TWAINContainer.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainer.cpp -* Base Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - -#include "stdafx.h" -#include "CommonDS.h" - -CTWAINContainer::CTWAINContainer(const TW_UINT16 _unCapID, - const TW_UINT16 _unItemType, - const TW_UINT16 _unGetType, - const TW_INT32 _nSupportedQueries, /*=TWQC_ALL*/ - const TW_UINT16 _unGetCurrentType, /*=TWON_ONEVALUE*/ - const TW_UINT16 _unGetDefaultType) /*=TWON_ONEVALUE*/ -{ - m_unCapID = _unCapID; - m_unItemType = _unItemType; - m_unGetType = _unGetType; - m_nMSG_QUERYSUPPORT = _nSupportedQueries; - m_unGetCurrentType = _unGetCurrentType; - m_unGetDefaultType = _unGetDefaultType; - - m_nCurrent = -1; - m_nDefault = -1; -} - -CTWAINContainer::~CTWAINContainer() -{ -} - -TW_UINT16 CTWAINContainer::GetCapID() -{ - return m_unCapID; -} - -TW_UINT16 CTWAINContainer::GetItemType() -{ - return m_unItemType; -} - -TW_UINT16 CTWAINContainer::GetGetType(const TW_UINT16 _unMsg) -{ - switch(_unMsg) - { - case MSG_GET: - return m_unGetType; - break; - case MSG_GETCURRENT: - return m_unGetCurrentType; - break; - case MSG_GETDEFAULT: - return m_unGetDefaultType; - break; - default: - break; - } - return TWON_ONEVALUE; -} - -unsigned int CTWAINContainer::getTWTYSize(TW_UINT16 _TWType) -{ - unsigned int unSize = 0; - - switch(_TWType) - { - case TWTY_INT8: - unSize = sizeof(TW_INT8); - break; - - case TWTY_INT16: - unSize = sizeof(TW_INT16); - break; - - case TWTY_INT32: - unSize = sizeof(TW_INT32); - break; - - case TWTY_UINT8: - unSize = sizeof(TW_UINT8); - break; - - case TWTY_UINT16: - unSize = sizeof(TW_UINT16); - break; - - case TWTY_BOOL: - unSize = sizeof(TW_BOOL); - break; - - case TWTY_UINT32: - unSize = sizeof(TW_UINT32); - break; - - case TWTY_FIX32: - unSize = sizeof(TW_FIX32); - break; - - case TWTY_FRAME: - unSize = sizeof(TW_FRAME); - break; - - case TWTY_STR32: - unSize = sizeof(TW_STR32); - break; - - case TWTY_STR64: - unSize = sizeof(TW_STR64); - break; - - case TWTY_STR128: - unSize = sizeof(TW_STR128); - break; - - case TWTY_STR255: - unSize = sizeof(TW_STR255); - break; - - case TWTY_STR1024: - unSize = sizeof(TW_STR1024); - break; - - case TWTY_UNI512: - unSize = sizeof(TW_UNI512); - break; - } - - return unSize; -} - -bool CTWAINContainer::isOperationAllowed(const TW_UINT16 _unMsg) -{ - bool bret = false; - - switch(_unMsg) - { - case MSG_RESET: - if(m_nMSG_QUERYSUPPORT & TWQC_RESET) - { - bret = true; - } - break; - - case MSG_SET: - if(m_nMSG_QUERYSUPPORT & TWQC_SET) - { - bret = true; - } - break; - - case MSG_GETCURRENT: - if(m_nMSG_QUERYSUPPORT & TWQC_GETCURRENT) - { - bret = true; - } - break; - - case MSG_GETDEFAULT: - if(m_nMSG_QUERYSUPPORT & TWQC_GETDEFAULT) - { - bret = true; - } - break; - - case MSG_GET: - if(m_nMSG_QUERYSUPPORT & TWQC_GET) - { - bret = true; - } - break; - } - - return bret; -} diff --git a/TWAINContainer.h b/TWAINContainer.h deleted file mode 100644 index f345a2b..0000000 --- a/TWAINContainer.h +++ /dev/null @@ -1,209 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainer.h -* Base Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - - -#ifndef __CTWAINCONTAINER_H__ -#define __CTWAINCONTAINER_H__ - -/** - @TODO TW_RANGE not implimented. Need to be able to Set with one type and return with another. - @TODO TWTY_STRnnn not implimented for any containers -*/ - -#ifdef TWH_CMP_GNU - #include -#endif // TWH_CMP_GNU - -#include "twain.h" - -#include -#include -using namespace std; - - -/** -* String Vector -*/ -typedef vector StringVector; - -/** -* Float Vector -*/ -typedef vector FloatVector; - -/** -* Int Vector -*/ -typedef vector IntVector; - - -/** -* All possible TWQC_xxxxx messages -*/ -#define TWQC_ALL (TWQC_GET | TWQC_SET | TWQC_GETDEFAULT | TWQC_GETCURRENT | TWQC_RESET) - -/** -* All get TWQC_xxxxx messages -*/ -#define TWQC_GETS (TWQC_GET | TWQC_GETDEFAULT | TWQC_GETCURRENT) - -/** -* TWAIN Container Base class. -* All values are stored internally as 1/1000th of an inch. They are converted -* as necessary when TWAIN containers are created. Any direct access will require -* the caller to do their own conversion. -*/ -class CTWAINContainer -{ - friend class CTWAIN_UI; -public: - /** - * Constructor. - * @param[in] _unCapID Capability ID - * @param[in] _unItemType TWAIN Type TWTY_xxxx being stored. - * @param[in] _unGetType TWON_xxxx container - * @param[in] _nSupportedQueries the supported querie types TWQC_xxxx - */ - CTWAINContainer(const TW_UINT16 _unCapID, - const TW_UINT16 _unItemType, - const TW_UINT16 _unGetType, - const TW_INT32 _nSupportedQueries = TWQC_ALL, - const TW_UINT16 _unGetCurrentType = TWON_ONEVALUE, - const TW_UINT16 _unGetDefaultType = TWON_ONEVALUE); -virtual ~CTWAINContainer(); - - /** - * Return the capability ID. - * @return the capability ID - */ - TW_UINT16 GetCapID(); - - /** - * Return the TWTY_xxxx item type. - * @return the item type - */ - TW_UINT16 GetItemType(); - - /** - * Return the TWON_xxxx containor type. - * @param[in] _MSG the MSG_GETxxxx get message. - * @return the containor type - */ - virtual TW_UINT16 GetGetType(const TW_UINT16 _unMsg); - - ////////////////////////////////////////////////////////////////////////////// - /** - * @name Pure Virtuals - * @{ - */ - // TWAIN operations - - /** - * Return the container. - * @param[in] _unMsg the MSG_GETxxxx get message. - * @return a handle to containor - */ - virtual TW_HANDLE GetContainer(const TW_UINT16 _unMsg) = 0; - - /** - * Set a container. - * @param[in] _pCap a pointer to TW_CAPABILITY structure. - * @param[out] Condition the TWCC_xxx code if failed - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition) = 0; - - /** - * Reset container back to default, - * @return true if success. - */ - virtual bool Reset() = 0; - -protected: - /** - * Check to see if type is valid. - * @param[in] _unTWType type to check - * @return true if valid - */ - virtual bool isValidType(const TW_UINT16 _unTWType) = 0; - - // END Pure Virtuals - //////////////////////////////////////////////////////////// - /** - * @} - */ - -public: - /** - * Return the size in bytes of the TWAIN type. - * @param[in] _TWType the type to retrieve the size of. - * @return the number of bytes of type. - */ - unsigned int getTWTYSize(TW_UINT16 _TWType); - - /** - * checks m_nMSG_QUERYSUPPORT to see if the operation in _unMsg is allowed - * @param[in] _unMsg message to check. - * @return true if allowed. - */ - bool isOperationAllowed(const TW_UINT16 _unMsg); - - /** - * Return a OR compasition of what messages are supported. - * @return messages supported. - */ - TW_INT32 getMSG_QUERYSUPPORT() - { - return m_nMSG_QUERYSUPPORT; - } - -protected: - TW_UINT16 m_unCapID; /**< Capability ID */ - TW_UINT16 m_unItemType; /**< Item TWTY_xxxx Type */ - TW_UINT16 m_unGetType; /**< Prefered Containor TWON_xxxx Type. Used with MSG_GET */ - TW_UINT16 m_unGetCurrentType; /**< Prefered Containor TWON_xxxx Type. Used with MSG_GETCURRENT */ - TW_UINT16 m_unGetDefaultType; /**< Prefered Containor TWON_xxxx Type. Used with MSG_GETCURRENT */ - - int m_nCurrent; /**< Holds an index of the currently set value. An Index into the appropriate Vector array. */ - int m_nDefault; /**< Holds an index of the default value. An Index into the appropriate Vector array. */ - - TW_INT32 m_nMSG_QUERYSUPPORT; /**< Holds the supported operations for this capability, all OR together. */ -}; - -#endif // __CTWAINCONTAINER_H__ - diff --git a/TWAINContainerBool.cpp b/TWAINContainerBool.cpp deleted file mode 100644 index ccbdc55..0000000 --- a/TWAINContainerBool.cpp +++ /dev/null @@ -1,340 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainerBool.cpp -* bool Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - -#include "stdafx.h" -#include "CommonDS.h" -#include - -CTWAINContainerBool::CTWAINContainerBool(const TW_UINT16 _unCapID, - const bool _bAPP2, - const TW_INT32 _nSupportedQueries /*=TWQC_ALL*/) - : CTWAINContainer(_unCapID, TWTY_BOOL, TWON_ENUMERATION, _nSupportedQueries) -{ - m_bApp2 = _bAPP2; -} - -CTWAINContainerBool::~CTWAINContainerBool() -{ -} - -TW_UINT16 CTWAINContainerBool::GetGetType(const TW_UINT16 _unMsg) -{ - switch(_unMsg) - { - case MSG_GET: - return m_bApp2?m_unGetType:TWON_ONEVALUE; - break; - case MSG_GETCURRENT: - return m_unGetCurrentType; - break; - case MSG_GETDEFAULT: - return m_unGetDefaultType; - break; - default: - break; - } - return TWON_ONEVALUE; -} - -TW_HANDLE CTWAINContainerBool::GetContainer(const TW_UINT16 _unMsg) -{ - TW_HANDLE hContainer = 0; - - if((MSG_GETCURRENT == _unMsg) || - (MSG_GET == _unMsg && !m_bApp2) || - (MSG_GETDEFAULT == _unMsg)) - { - hContainer = _DSM_Alloc(sizeof(TW_ONEVALUE)); - - if(0 != hContainer) - { - TW_ONEVALUE* pCap = (TW_ONEVALUE*)_DSM_LockMemory(hContainer); - - pCap->ItemType = TWTY_BOOL; - // If the Cap has been constrained the default may only be in the m_listBoolsDefault. - const bool bVal = ((MSG_GETDEFAULT == _unMsg)?m_listBoolsDefault[m_nDefault]:m_listBools[m_nCurrent])!=0; - - pCap->Item = bVal?1:0; - _DSM_UnlockMemory(hContainer); - } - } - else if(MSG_GET == _unMsg) - { - hContainer = _DSM_Alloc((TW_UINT32)(sizeof(TW_ENUMERATION)-1 + (sizeof(TW_BOOL) * (m_listBools.size())))); // -1 because already contains 1 byte - - if(0 != hContainer) - { - TW_ENUMERATION* pCap = (TW_ENUMERATION*)_DSM_LockMemory(hContainer); - - pCap->ItemType = TWTY_BOOL; - pCap->NumItems = (TW_UINT32)m_listBools.size(); - pCap->CurrentIndex = m_nCurrent; - //If the CAP has been constrained m_nDefault index might not point - // to the correct index and the index may not be valid. We need to - // find the value in the default list and see if we can find a match - // in the current list. If no match found then set to first index. - // see spec on twain.org Chap4 p73 Advanced Application Implementation | - // Capabilities | Constrained Capabilities and Message Responses | MSG_SET - const bool bVal = m_listBoolsDefault[m_nDefault]!=0; - int nIndex = getIndexForValue(bVal); - if(nIndex != -1) - { - pCap->DefaultIndex = nIndex; - } - else - { - // We use the first index. We could try transversing through the - // list and finding the closest match in value. But either way - // the application should not be using this value. - pCap->DefaultIndex = 0; - } - - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - ((TW_BOOL*)pCap->ItemList)[x] = m_listBools[x]?1:0; - } - - _DSM_UnlockMemory(hContainer); - } - } - - return hContainer; -} - -bool CTWAINContainerBool::isValidType(const TW_UINT16 _unTWType) -{ - return (TWTY_BOOL == _unTWType); -} - -TW_INT16 CTWAINContainerBool::Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition) -{ - TW_INT16 twrc = TWRC_SUCCESS; - Condition = TWCC_SUCCESS; - - if(TWON_ONEVALUE == _pCap->ConType) - { - TW_ONEVALUE* pCap = (TW_ONEVALUE*)_DSM_LockMemory(_pCap->hContainer); - - if(isValidType(pCap->ItemType)) - { - if(!SetCurrent((pCap->Item&0xFFFF)!=0)) - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - } - - _DSM_UnlockMemory(_pCap->hContainer); - } - else if(TWON_ENUMERATION == _pCap->ConType) - { - TW_ENUMERATION* pCap = (TW_ENUMERATION*)_DSM_LockMemory(_pCap->hContainer); - - if(isValidType(pCap->ItemType)) - { - int nNewCurrentIndex = pCap->CurrentIndex; - IntVector::iterator iter; - bool bListCleared = false; // We only want to crear the current list if we are passed - // valid data, and only clear it once through the loop of testing - bool bVal; - - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - bVal = ((TW_BOOL*)pCap->ItemList)[x]!=0; - - // only set the value if it exists in m_listBoolsDefault - iter = find(m_listBoolsDefault.begin(), m_listBoolsDefault.end(), (bVal?1:0)); - - if(iter != m_listBoolsDefault.end()) - { - // We have valid data - if(!bListCleared) - { - // only clear the list if we have not done so already - m_listBools.clear(); - bListCleared = true; - } - - // only add it if it was not added already - iter = find(m_listBools.begin(), m_listBools.end(), (bVal?1:0)); - if(iter == m_listBools.end()) - { - m_listBools.push_back(bVal); - } - else - { - if(x < pCap->CurrentIndex) - { - nNewCurrentIndex--; - } - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - else - { - // if the index is below the current then we need to adjust what is going to be current - if(x < pCap->CurrentIndex) - { - nNewCurrentIndex--; - } - - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - - // If the list has been cleared then there was at at least some valid data - if(bListCleared) - { - if(nNewCurrentIndex >= 0 && nNewCurrentIndex < (int)(m_listBools.size())) - { - m_nCurrent = nNewCurrentIndex; - } - else - { - // the new current index is not in range - m_nCurrent = 0; - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - else - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - } - else // NOT isValidType(pCap->ItemType)) - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - - _DSM_UnlockMemory(_pCap->hContainer); - } - else //bad container type - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - return twrc; -} - -bool CTWAINContainerBool::Reset() -{ - m_listBools.clear(); - - const int nSize = (int)(m_listBoolsDefault.size()); - - for(int x = 0; x < nSize; ++x) - { - m_listBools.push_back(m_listBoolsDefault[x]); - } - - m_nCurrent = m_nDefault; - - return true; -} - -bool CTWAINContainerBool::GetCurrent(bool &_bVal) -{ - if((m_nCurrent >= 0) && ((int)(m_listBools.size()) > m_nCurrent)) - { - _bVal = m_listBools[m_nCurrent]!=0; - return true; - } - - return false; -} - -bool CTWAINContainerBool::GetDefault(bool &_bVal) -{ - if((m_nDefault >= 0) && ((int)(m_listBoolsDefault.size()) > m_nDefault)) - { - _bVal = m_listBoolsDefault[m_nDefault]!=0; - return true; - } - - return false; -} - -const IntVector &CTWAINContainerBool::GetSupported() -{ - return m_listBools; -} - -bool CTWAINContainerBool::Add(const bool _bAdd, bool _bDefault /*= false*/) -{ - m_listBools.push_back(_bAdd); - m_listBoolsDefault.push_back(_bAdd); - if(m_nDefault == -1 || _bDefault) - { - m_nCurrent = (int)m_listBools.size()-1; - m_nDefault = (int)m_listBoolsDefault.size()-1; - } - return true; -} - -bool CTWAINContainerBool::SetCurrent(bool _bCurr) -{ - int nIdx = getIndexForValue(_bCurr); - if(nIdx < 0) - { - return false; - } - - m_nCurrent = nIdx; - return true; -} - -int CTWAINContainerBool::getIndexForValue(const bool _bVal) -{ - const int nSize = (int)(m_listBools.size()); - - for(int x = 0; x < nSize; ++x) - { - if(_bVal == (m_listBools[x]!=0)) - { - return x; - } - } - - return -1; -} - diff --git a/TWAINContainerBool.h b/TWAINContainerBool.h deleted file mode 100644 index b02a2a3..0000000 --- a/TWAINContainerBool.h +++ /dev/null @@ -1,138 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainerBool.h -* Fix32 Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - - -#ifndef __CTWAINCONTAINERBOOL_H__ -#define __CTWAINCONTAINERBOOL_H__ - -#include "TWAINContainer.h" - -/** -* This class can be used for any Bool based TWAIN container. -*/ -class CTWAINContainerBool : public CTWAINContainer -{ - friend class CTWAIN_UI; -public: - /** - * Constructor. - * @param[in] _unCapID Capability ID - * @param[in] _unItemType TWAIN Type TWTY_xxxx being stored. - * @param[in] _unGetType TWON_xxxx container - * @param[in] _nSupportedQueries the supported querie types TWQC_xxxx - */ - CTWAINContainerBool(const TW_UINT16 _unCapID, - const bool _bAPP2, - const TW_INT32 _nSupportedQueries = TWQC_ALL); - virtual ~CTWAINContainerBool(); - /** - * Return the TWON_xxxx containor type. - * @param[in] _MSG the MSG_GETxxxx get message. - * @return the containor type - */ - virtual TW_UINT16 GetGetType(const TW_UINT16 _unMsg); - virtual TW_HANDLE GetContainer(const TW_UINT16 _unMsg); - virtual TW_INT16 Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition); - virtual bool Reset(); - - // For float vals - /** - * Try to add a value for container. The first value added to a capabiltiy is set as the default and current value. - * @param[in] _flAdd the value to be added. - * @param[in] _bDefault if true explisitly sets this value to be the default and current. - * @return true if success. - */ - bool Add(const bool _blAdd, bool _bDefault = false); - - /** - * Try to set the current value for container. - * The value must already be part of the container. - * @param[in] _flAdd the value to be set as current. - * @return true if success. - */ - bool SetCurrent(bool _blCurr); - - /** - * Return the default value through _flVal if set. - * @param[out] _flVal set the default value on return. - * @return true if success. - */ - bool GetDefault(bool &_blVal); - - /** - * Return the current value through _flVal if set. - * @param[out] _flVal set the current value on return. - * @return true if success. - */ - bool GetCurrent(bool &_bVal); - - /** - * Return a vector of supported values. - * @return supported values. - */ - const IntVector &GetSupported(); - - /** - * Return the weather or not the value is supported by this capability. - * @param[in] _flVal the value to check to see if it is supported - * @return true is the _flVal is supported. - */ - bool isValueSupported(const bool _bVal) {return -1 != getIndexForValue(_bVal);} - - /** - * Return the index in vector list for value. - * @param[in] _flVal value to search for. - * @return the index of value, or -1 if does not exist. - */ - int getIndexForValue(const bool _bVal); - - -protected: - /** - * Check to see if type is valid. - * @param[in] _unTWType type to check - * @return true if valid - */ - bool isValidType(const TW_UINT16 _unTWType); - - IntVector m_listBools; /**< vector of valid container values. */ - IntVector m_listBoolsDefault; /**< vector of valid container default values. */ - bool m_bApp2; -}; - -#endif // __CTWAINCONTAINERBOOL_H__ diff --git a/TWAINContainerFix32.cpp b/TWAINContainerFix32.cpp deleted file mode 100644 index bcd9108..0000000 --- a/TWAINContainerFix32.cpp +++ /dev/null @@ -1,411 +0,0 @@ -/*************************************************************************** -* Copyright 锟 2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainerFix32.cpp -* Fix32 Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - -#include "stdafx.h" -#include "CommonDS.h" -#include -#include - -CTWAINContainerFix32::CTWAINContainerFix32(const TW_UINT16 _unCapID, - const TW_UINT16 _unGetType, - const TW_INT32 _nSupportedQueries/* = TWQC_ALL*/, - const TW_UINT16 _unGetCurrentType/* = TWON_ONEVALUE*/, - const TW_UINT16 _unGetDefaultType/* = TWON_ONEVALUE*/) - : CTWAINContainer(_unCapID, TWTY_FIX32, _unGetType, _nSupportedQueries,_unGetCurrentType,_unGetDefaultType) -{ -} - -CTWAINContainerFix32::~CTWAINContainerFix32() -{ -} - -TW_HANDLE CTWAINContainerFix32::GetContainer(const TW_UINT16 _unMsg) -{ - TW_HANDLE hContainer = 0; - TW_UINT16 unGetType=TWON_ONEVALUE; - switch(_unMsg) - { - case MSG_GET: - unGetType = m_unGetType; - break; - case MSG_GETCURRENT: - unGetType = m_unGetCurrentType; - break; - case MSG_GETDEFAULT: - unGetType = m_unGetDefaultType; - break; - } - - switch(unGetType) - { - default: - case TWON_ONEVALUE: - { - hContainer = _DSM_Alloc(sizeof(TW_ONEVALUE_FIX32)); - - if(0 != hContainer) - { - pTW_ONEVALUE_FIX32 pCap = (pTW_ONEVALUE_FIX32)_DSM_LockMemory(hContainer); - - pCap->ItemType = TWTY_FIX32; - // If the Cap has been constrained the default may only be in the m_listFloatsDefault. - const float flVal = (MSG_GETDEFAULT == _unMsg)?m_listFloatsDefault[m_nDefault]:m_listFloats[m_nCurrent]; - - pCap->Item = FloatToFIX32(flVal); - _DSM_UnlockMemory(hContainer); - } - } - break; - - case TWON_ENUMERATION: - { - hContainer = _DSM_Alloc(sizeof(TW_ENUMERATION_FIX32) + (sizeof(TW_FIX32) * (m_listFloats.size()-1))); // -1 because already contains 1 element - - if(0 != hContainer) - { - pTW_ENUMERATION_FIX32 pCap = (pTW_ENUMERATION_FIX32)_DSM_LockMemory(hContainer); - - pCap->ItemType = TWTY_FIX32; - pCap->NumItems = (TW_UINT32)m_listFloats.size(); - pCap->CurrentIndex = m_nCurrent; - //If the CAP has been constrained m_nDefault index might not point - // to the correct index and the index may not be valid. We need to - // find the value in the default list and see if we can find a match - // in the current list. If no match found then set to first index. - // see spec on twain.org Chap4 p73 Advanced Application Implementation | - // Capabilities | Constrained Capabilities and Message Responses | MSG_SET - const float flVal = m_listFloatsDefault[m_nDefault]; - int nIndex = getIndexForValue(flVal); - if(nIndex != -1) - { - pCap->DefaultIndex = nIndex; - } - else - { - // We use the first index. We could try transversing through the - // list and finding the closest match in value. But either way - // the application should not be using this value. - pCap->DefaultIndex = 0; - } - - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - pCap->ItemList[x] = FloatToFIX32(m_listFloats[x]); - } - - _DSM_UnlockMemory(hContainer); - } - } - break; - - case TWON_ARRAY: - { - hContainer = _DSM_Alloc(sizeof(TW_ARRAY_FIX32) + (sizeof(TW_FIX32) * (m_listFloats.size()-1))); // -1 because a TW_ARRAY_FIX32 already includes 1 element - - if(0 != hContainer) - { - pTW_ARRAY_FIX32 pCap = (pTW_ARRAY_FIX32)_DSM_LockMemory(hContainer); - pCap->ItemType = m_unItemType; - pCap->NumItems = (TW_UINT32)m_listFloats.size(); - - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - pCap->ItemList[x] = FloatToFIX32(m_listFloats[x]); - } - - _DSM_UnlockMemory(hContainer); - } - } - } - - return hContainer; -} - -bool CTWAINContainerFix32::isValidType(const TW_UINT16 _unTWType) -{ - bool bret = false; - - if(TWTY_FIX32 == _unTWType) - { - bret = true; - } - - return bret; -} - -TW_INT16 CTWAINContainerFix32::Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition) -{ - TW_INT16 twrc = TWRC_SUCCESS; - Condition = TWCC_SUCCESS; - - if(TWON_ONEVALUE == _pCap->ConType) - { - pTW_ONEVALUE_FIX32 pCap = (pTW_ONEVALUE_FIX32)_DSM_LockMemory(_pCap->hContainer); - - if(isValidType(pCap->ItemType)) - { - float flVal = FIX32ToFloat(pCap->Item); - switch(m_unGetType) - { - case TWON_ONEVALUE: - { - m_listFloats.clear(); - m_listFloats.push_back(flVal); - m_nCurrent = 0; - } - break; - case TWON_ENUMERATION: - { - int nVal = -1; - if((nVal = getIndexForValue(flVal)) >= 0) - { - m_nCurrent = nVal; - } - else - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - } - break; - //case TWON_ARRAY: - //break; - //case TWON_RANGE: - //break; - default: - twrc = TWRC_FAILURE; - Condition = TWCC_CAPBADOPERATION; - break; - } - } - - _DSM_UnlockMemory(_pCap->hContainer); - } - else if(TWON_ENUMERATION == _pCap->ConType) - { - pTW_ENUMERATION_FIX32 pCap = (pTW_ENUMERATION_FIX32)_DSM_LockMemory(_pCap->hContainer); - - if(isValidType(pCap->ItemType)) - { - int nNewCurrentIndex = pCap->CurrentIndex; - FloatVector::iterator iter; - bool bListCleared = false; // We only want to crear the current list if we are passed - // valid data, and only clear it once through the loop of testing - float flVal; - - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - flVal = FIX32ToFloat(pCap->ItemList[x]); - - // only set the value if it exists in m_listFloatsDefault - iter = find(m_listFloatsDefault.begin(), m_listFloatsDefault.end(), flVal); - - if(iter != m_listFloatsDefault.end()) - { - // We have valid data - if(!bListCleared) - { - // only clear the list if we have not done so already - m_listFloats.clear(); - bListCleared = true; - } - - // only add it if it was not added already - iter = find(m_listFloats.begin(), m_listFloats.end(), flVal); - if(iter == m_listFloats.end()) - { - m_listFloats.push_back(flVal); - } - else - { - if(x < pCap->CurrentIndex) - { - nNewCurrentIndex--; - } - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - else - { - // if the index is below the current then we need to adjust what is going to be current - if(x < pCap->CurrentIndex) - { - nNewCurrentIndex--; - } - - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - - // If the list has been cleared then there was at at least some valid data - if(bListCleared) - { - if(nNewCurrentIndex >= 0 && nNewCurrentIndex < (int)(m_listFloats.size())) - { - m_nCurrent = nNewCurrentIndex; - } - else - { - // the new current index is not in range - m_nCurrent = 0; - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - else - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - } - else // NOT isValidType(pCap->ItemType)) - { - twrc = TWRC_FAILURE; - Condition = TWCC_CAPBADOPERATION; - } - - _DSM_UnlockMemory(_pCap->hContainer); - } - else //bad container type - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - - return twrc; -} - -bool CTWAINContainerFix32::Reset() -{ - m_nCurrent = m_nDefault; - - m_listFloats.clear(); - - const int nSize = (int)(m_listFloatsDefault.size()); - - for(int x = 0; x < nSize; ++x) - { - m_listFloats.push_back(m_listFloatsDefault[x]); - } - - return true; -} - -bool CTWAINContainerFix32::GetCurrent(float &_flVal) -{ - bool bret = false; - - if((m_nCurrent >= 0) && ((int)(m_listFloats.size()) > m_nCurrent)) - { - _flVal = m_listFloats[m_nCurrent]; - bret = true; - } - - return bret; -} - -bool CTWAINContainerFix32::GetDefault(float &_flVal) -{ - bool bret = false; - - if((m_nDefault >= 0) && ((int)(m_listFloatsDefault.size()) > m_nDefault)) - { - _flVal = m_listFloatsDefault[m_nDefault]; - bret = true; - } - - return bret; -} - -const FloatVector &CTWAINContainerFix32::GetSupported() -{ - return m_listFloats; -} - -bool CTWAINContainerFix32::Add(const float _flAdd, bool _bDefault /*= false*/) -{ - m_listFloats.push_back(_flAdd); - m_listFloatsDefault.push_back(_flAdd); - if(m_nDefault == -1 || _bDefault) - { - m_nCurrent = m_nDefault = getIndexForValue(_flAdd); - } - return true; -} - -bool CTWAINContainerFix32::SetCurrent(float _flCurr) -{ - if(TWON_ONEVALUE == m_unGetType)//check before call - { - m_listFloats.clear(); - m_listFloats.push_back(_flCurr); - m_nCurrent = 0; - } - else - { - int nIdx = getIndexForValue(_flCurr); - if(nIdx < 0) - { - return false; - } - - m_nCurrent = nIdx; - } - return true; -} - -int CTWAINContainerFix32::getIndexForValue(const float _flVal) -{ - int ret = -1; - - const int nSize = (int)(m_listFloats.size()); - - for(int x = 0; x < nSize; ++x) - { - if(_flVal >= m_listFloats[x]-1.0/65536.0 && _flVal <= m_listFloats[x]+1.0/65536.0) //@TODO remove float comparison - { - ret = x; - break; - } - } - - return ret; -} - diff --git a/TWAINContainerFix32.h b/TWAINContainerFix32.h deleted file mode 100644 index 8f27421..0000000 --- a/TWAINContainerFix32.h +++ /dev/null @@ -1,137 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainerFix32.h -* Fix32 Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - - -#ifndef __CTWAINCONTAINERFIX32_H__ -#define __CTWAINCONTAINERFIX32_H__ - -#include "TWAINContainer.h" - -/** -* This class can be used for any Fix32 based TWAIN container. -* All values are stored internally as 1/1000th of an inch. They are converted -* as necessary when TWAIN containers are created. Any direct access will require -* the caller to do their own conversion. -*/ -class CTWAINContainerFix32 : public CTWAINContainer -{ - friend class CTWAIN_UI; -public: - /** - * Constructor. - * @param[in] _unCapID Capability ID - * @param[in] _unItemType TWAIN Type TWTY_xxxx being stored. - * @param[in] _unGetType TWON_xxxx container - * @param[in] _nSupportedQueries the supported querie types TWQC_xxxx - */ - CTWAINContainerFix32(const TW_UINT16 _unCapID, - const TW_UINT16 _unGetType, - const TW_INT32 _nSupportedQueries = TWQC_ALL, - const TW_UINT16 _unGetCurrentType = TWON_ONEVALUE, - const TW_UINT16 _unGetDefaultType = TWON_ONEVALUE); - virtual ~CTWAINContainerFix32(); - - virtual TW_HANDLE GetContainer(const TW_UINT16 _unMsg); - virtual TW_INT16 Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition); - virtual bool Reset(); - - // For float vals - /** - * Try to add a value for container. The first value added to a capabiltiy is set as the default and current value. - * @param[in] _flAdd the value to be added. - * @param[in] _bDefault if true explisitly sets this value to be the default and current. - * @return true if success. - */ - bool Add(const float _flAdd, bool _bDefault = false); - - /** - * Try to set the current value for container. - * The value must already be part of the container. - * @param[in] _flAdd the value to be set as current. - * @return true if success. - */ - bool SetCurrent(float _flCurr); - - /** - * Return the default value through _flVal if set. - * @param[out] _flVal set the default value on return. - * @return true if success. - */ - bool GetDefault(float &_flVal); - - /** - * Return the current value through _flVal if set. - * @param[out] _flVal set the current value on return. - * @return true if success. - */ - bool GetCurrent(float &_flVal); - - /** - * Return a vector of supported values. - * @return supported values. - */ - const FloatVector &GetSupported(); - - /** - * Return the weather or not the value is supported by this capability. - * @param[in] _flVal the value to check to see if it is supported - * @return true is the _flVal is supported. - */ - bool isValueSupported(const float _flVal) {return -1 != getIndexForValue(_flVal);} - - /** - * Return the index in vector list for value. - * @param[in] _flVal value to search for. - * @return the index of value, or -1 if does not exist. - */ - int getIndexForValue(const float _flVal); - - -protected: - /** - * Check to see if type is valid. - * @param[in] _unTWType type to check - * @return true if valid - */ - bool isValidType(const TW_UINT16 _unTWType); - - FloatVector m_listFloats; /**< vector of valid container values. */ - FloatVector m_listFloatsDefault; /**< vector of valid container default values. */ -}; - -#endif // __CTWAINCONTAINERFIX32_H__ diff --git a/TWAINContainerFix32Range.cpp b/TWAINContainerFix32Range.cpp deleted file mode 100644 index a0b0ef3..0000000 --- a/TWAINContainerFix32Range.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainerFix32.cpp -* Fix32 Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - -#include "stdafx.h" -#include "CommonDS.h" -#include - -CTWAINContainerFix32Range::CTWAINContainerFix32Range(const TW_UINT16 _unCapID, - const FLOAT_RANGE _InitRange, - const TW_INT32 _nSupportedQueries /*=TWQC_ALL*/) - : CTWAINContainer(_unCapID, TWTY_FIX32, TWON_RANGE, _nSupportedQueries) -{ - m_Cur = m_Def = _InitRange; -} - -CTWAINContainerFix32Range::~CTWAINContainerFix32Range() -{ -} - -TW_HANDLE CTWAINContainerFix32Range::GetContainer(const TW_UINT16 _unMsg) -{ - TW_HANDLE hContainer = 0; - - if((MSG_GETCURRENT == _unMsg) || - (MSG_GETDEFAULT == _unMsg)) - { - hContainer = _DSM_Alloc(sizeof(TW_ONEVALUE_FIX32)); - - if(0 != hContainer) - { - pTW_ONEVALUE_FIX32 pCap = (pTW_ONEVALUE_FIX32)_DSM_LockMemory(hContainer); - - pCap->ItemType = TWTY_FIX32; - const float flVal = (MSG_GETDEFAULT == _unMsg)?m_Def.fCurrentValue:m_Cur.fCurrentValue; - - pCap->Item = FloatToFIX32(flVal); - _DSM_UnlockMemory(hContainer); - } - } - else if(MSG_GET == _unMsg) - { - hContainer = _DSM_Alloc(sizeof(TW_RANGE_FIX32)); - - if(0 != hContainer) - { - pTW_RANGE_FIX32 pCap = (pTW_RANGE_FIX32)_DSM_LockMemory(hContainer); - - pCap->ItemType = TWTY_FIX32; - pCap->CurrentValue = FloatToFIX32(m_Cur.fCurrentValue); - pCap->DefaultValue = FloatToFIX32(m_Def.fCurrentValue); - pCap->MaxValue = FloatToFIX32(m_Cur.fMaxValue); - pCap->MinValue = FloatToFIX32(m_Cur.fMinValue); - pCap->StepSize = FloatToFIX32(m_Cur.fStepSize); - - _DSM_UnlockMemory(hContainer); - } - } - - return hContainer; -} - -bool CTWAINContainerFix32Range::isValidType(const TW_UINT16 _unTWType) -{ - return TWTY_FIX32 == _unTWType; -} - -TW_INT16 CTWAINContainerFix32Range::Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition) -{ - TW_INT16 twrc = TWRC_SUCCESS; - Condition = TWCC_SUCCESS; - - if(TWON_ONEVALUE == _pCap->ConType) - { - pTW_ONEVALUE_FIX32 pCap = (pTW_ONEVALUE_FIX32)_DSM_LockMemory(_pCap->hContainer); - - if(isValidType(pCap->ItemType)) - { - float flVal = FIX32ToFloat(pCap->Item); - int nRes = IsInRange(m_Cur,flVal); - - if(nRes!=0) - { - float flTemp = flVal; - nRes = IsInRange(m_Def,flTemp); - if(nRes<0) - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - else if(nRes==0) - { - m_Cur = m_Def; - m_Cur.fCurrentValue = flTemp; - } - else if(nRes>0) - { - if(flTemp != flVal) - { - m_Cur = m_Def; - } - m_Cur.fCurrentValue = flTemp; - } - twrc = TWRC_CHECKSTATUS; - } - else - { - m_Cur.fCurrentValue = flVal; - } - } - else - { - twrc = TWRC_FAILURE; - Condition = TWCC_CAPBADOPERATION; - } - _DSM_UnlockMemory(_pCap->hContainer); - } - else if(TWON_RANGE == _pCap->ConType) - { - pTW_RANGE_FIX32 pCap = (pTW_RANGE_FIX32)_DSM_LockMemory(_pCap->hContainer); - if(isValidType(pCap->ItemType)) - { - FLOAT_RANGE fNewRange; - fNewRange.fCurrentValue = FIX32ToFloat(pCap->CurrentValue); - fNewRange.fMaxValue = FIX32ToFloat(pCap->MaxValue); - fNewRange.fMinValue = FIX32ToFloat(pCap->MinValue); - fNewRange.fStepSize = FIX32ToFloat(pCap->StepSize); - int nRes = 0; - if(fNewRange.fMinValue>fNewRange.fMaxValue || - fNewRange.fCurrentValuefNewRange.fMaxValue || - fNewRange.fStepSize <=0 || - (fNewRange.fMinValue!=fNewRange.fMaxValue && - (((int)((fNewRange.fMaxValue-fNewRange.fMinValue)/fNewRange.fStepSize))*fNewRange.fStepSize+fNewRange.fMinValue)!=fNewRange.fMaxValue) || - m_Def.fStepSize>fNewRange.fStepSize || - (fNewRange.fMinValue!=fNewRange.fMaxValue && fNewRange.fMinValue+fNewRange.fStepSize>fNewRange.fMaxValue)) - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - if(twrc != TWRC_FAILURE) - { - nRes = IsInRange(m_Def,fNewRange.fCurrentValue); - if(nRes<0) - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - else if(nRes>0) - { - twrc = TWRC_CHECKSTATUS; - } - } - if(twrc != TWRC_FAILURE) - { - nRes = IsInRange(m_Def,fNewRange.fMinValue); - if(nRes<0) - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - else if(nRes>0) - { - twrc = TWRC_CHECKSTATUS; - } - } - if(twrc != TWRC_FAILURE) - { - nRes = IsInRange(m_Def,fNewRange.fMaxValue); - if(nRes<0) - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - else if(nRes>0) - { - twrc = TWRC_CHECKSTATUS; - } - } - if(twrc != TWRC_FAILURE) - { - int nIdx = (int)(fNewRange.fStepSize/m_Def.fStepSize); - if(nIdx*m_Def.fStepSize != fNewRange.fStepSize) - { - twrc = TWRC_CHECKSTATUS; - } - - if(((nIdx+0.5)*m_Def.fStepSize)>fNewRange.fStepSize) - { - fNewRange.fStepSize = nIdx*m_Def.fStepSize; - } - else - { - fNewRange.fStepSize = (nIdx+1)*m_Def.fStepSize; - } - } - if(twrc != TWRC_FAILURE) - { - if(IsInRange(fNewRange,fNewRange.fCurrentValue)<0) - { - twrc = TWRC_FAILURE; - } - } - if(twrc != TWRC_FAILURE) - { - fNewRange.fMaxValue = ((int)((fNewRange.fMaxValue - fNewRange.fMinValue)/fNewRange.fStepSize))*fNewRange.fStepSize + fNewRange.fMinValue; - m_Cur = fNewRange; - } - } - _DSM_UnlockMemory(_pCap->hContainer); - } - else //bad container type - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - - return twrc; -} - -bool CTWAINContainerFix32Range::Reset() -{ - m_Cur = m_Def; - return true; -} - -bool CTWAINContainerFix32Range::GetCurrent(float &_flVal) -{ - _flVal = m_Cur.fCurrentValue; - - return true; -} - -bool CTWAINContainerFix32Range::SetCurrent(float _flVal) -{ - int nRes = IsInRange(m_Cur,_flVal); - - if(nRes!=0) - { - float flTemp = _flVal; - nRes = IsInRange(m_Def,flTemp); - if(nRes<0) - { - return false; - } - else if(nRes==0) - { - m_Cur = m_Def; - m_Cur.fCurrentValue = _flVal; - } - else if(nRes>0) - { - if(flTemp != _flVal) - { - m_Cur = m_Def; - } - m_Cur.fCurrentValue = flTemp; - } - } - else - { - m_Cur.fCurrentValue = _flVal; - } - return true; -} - -bool CTWAINContainerFix32Range::GetDefault(float &_flVal) -{ - _flVal = m_Def.fCurrentValue; - - return true; -} - -void CTWAINContainerFix32Range::GetMinMaxStep(float &_flMinVal,float &_flMaxVal,float &_flStepVal) -{ - _flMinVal=m_Cur.fMinValue; - _flMaxVal=m_Cur.fMaxValue; - _flStepVal=m_Cur.fStepSize; -} - -int CTWAINContainerFix32Range::IsInRange(FLOAT_RANGE _Range, float &_flVal) -{ - if(_flVal<_Range.fMinValue || _flVal>_Range.fMaxValue) - { - return -1; - } - if(_Range.fMinValue == _Range.fMaxValue && _flVal!=_Range.fMinValue)//@TODO remove flaot comparision - { - return -1; - } - - int nIdx = (int)((_flVal-_Range.fMinValue)/_Range.fStepSize); - float fTemp = nIdx*_Range.fStepSize+_Range.fMinValue; - if(fTemp==_flVal)//@TODO remove float comparision - { - return 0; - } - - if((_flVal+_Range.fStepSize/2)>fTemp) - { - _flVal = fTemp; - } - else - { - _flVal = fTemp-_Range.fStepSize; - } - return 1; -} - diff --git a/TWAINContainerFix32Range.h b/TWAINContainerFix32Range.h deleted file mode 100644 index dfe2984..0000000 --- a/TWAINContainerFix32Range.h +++ /dev/null @@ -1,109 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainerFix32.h -* Fix32 Range Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - - -#ifndef __CTWAINContainerFix32RangeRANGE_H__ -#define __CTWAINContainerFix32RangeRANGE_H__ - -#include "TWAINContainer.h" -typedef struct { - float fMinValue; /* Starting value in the range. */ - float fMaxValue; /* Final value in the range. */ - float fStepSize; /* Increment from MinValue to MaxValue. */ - float fCurrentValue; /* The value that is currently in effect. */ -} FLOAT_RANGE; -/** -* This class can be used for any Fix32 based TWAIN container. -*/ -class CTWAINContainerFix32Range : public CTWAINContainer -{ - friend class CTWAIN_UI; -public: - /** - * Constructor. - * @param[in] _unCapID Capability ID - * @param[in] _unItemType TWAIN Type TWTY_xxxx being stored. - * @param[in] _unGetType TWON_xxxx container - * @param[in] _nSupportedQueries the supported querie types TWQC_xxxx - */ - CTWAINContainerFix32Range(const TW_UINT16 _unCapID, - const FLOAT_RANGE _InitRange, - const TW_INT32 _nSupportedQueries = TWQC_ALL); - virtual ~CTWAINContainerFix32Range(); - - virtual TW_HANDLE GetContainer(const TW_UINT16 _unMsg); - virtual TW_INT16 Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition); - virtual bool Reset(); - - /** - * Return the default value through _flVal if set. - * @param[out] _flVal set the default value on return. - * @return true if success. - */ - bool GetDefault(float &_flVal); - - /** - * Return the current value through _flVal if set. - * @param[out] _flVal set the current value on return. - * @return true if success. - */ - bool GetCurrent(float &_flVal); - /** - * Set the current value through _flVal. - * @param[in] _flVal the current value. - * @return true if success. - */ - bool SetCurrent(float _flVal); - - void GetMinMaxStep(float &_flMinVal,float &_flMaxVal,float &_flStepVal); - int IsInRange(FLOAT_RANGE _Range, float &_flVal); - -protected: - /** - * Check to see if type is valid. - * @param[in] _unTWType type to check - * @return true if valid - */ - bool isValidType(const TW_UINT16 _unTWType); - - FLOAT_RANGE m_Cur; - FLOAT_RANGE m_Def; - -}; - -#endif // __CTWAINContainerFix32RangeRANGE_H__ diff --git a/TWAINContainerFrame.cpp b/TWAINContainerFrame.cpp deleted file mode 100644 index cd3dea7..0000000 --- a/TWAINContainerFrame.cpp +++ /dev/null @@ -1,643 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainerFrame.cpp -* Frame Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - -#include "stdafx.h" -#include "CommonDS.h" -#include - -InternalFrame::InternalFrame() -{ - nLeft = 0; - nTop = 0; - nRight = 0; - nBottom = 0; -} - -InternalFrame::InternalFrame(int left, int top, int right, int bottom) -{ - nLeft = left; - nTop = top; - nRight = right; - nBottom = bottom; -} - -InternalFrame::InternalFrame(const TW_FRAME twFrame, int fromUnits, float Xresolution, float Yresolution) -{ - nLeft = int(ConvertUnits(FIX32ToFloat(twFrame.Left), fromUnits, TWUN_PIXELS, Xresolution)); - nTop = int(ConvertUnits(FIX32ToFloat(twFrame.Top), fromUnits, TWUN_PIXELS, Yresolution)); - nRight = int(ConvertUnits(FIX32ToFloat(twFrame.Right), fromUnits, TWUN_PIXELS, Xresolution)); - nBottom = int(ConvertUnits(FIX32ToFloat(twFrame.Bottom), fromUnits, TWUN_PIXELS, Yresolution)); -} - -InternalFrame::InternalFrame(const TW_UINT16 ss) -{ - //see which supported size they want the dimensions of - switch(ss) - { - case TWSS_USLEDGER: - SetFrame( 0, 0, 11.0f, 17.0f, TWUN_INCHES, 100, 100); - break; - case TWSS_USLEGAL: - SetFrame( 0, 0, 8.5f, 14.0f, TWUN_INCHES, 100, 100); - break; - case TWSS_USLETTER: - SetFrame( 0, 0, 8.5f, 11.0f, TWUN_INCHES, 100, 100); - break; - case TWSS_USEXECUTIVE: - SetFrame( 0, 0, 7.25f, 10.5f, TWUN_INCHES, 100, 100); - break; - case TWSS_USSTATEMENT: - SetFrame( 0, 0, 5.5f, 8.5f, TWUN_INCHES, 100, 100); - break; - case TWSS_BUSINESSCARD: - SetFrame( 0, 0, 3.5f, 2.0f, TWUN_INCHES, 100, 100); - break; - - case TWSS_4A0: - SetFrame( 0, 0,168.2f, 237.8f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_2A0: - SetFrame( 0, 0,118.9f, 168.2f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_A0: - SetFrame( 0, 0, 84.1f, 118.9f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_A1: - SetFrame( 0, 0, 59.4f, 84.1f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_A2: - SetFrame( 0, 0, 42.0f, 59.4f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_A3: - SetFrame( 0, 0, 29.7f, 42.0f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_A4: // case TWSS_A4LETTER: - SetFrame( 0, 0, 21.0f, 29.7f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_A5: - SetFrame( 0, 0, 14.8f, 21.0f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_A6: - SetFrame( 0, 0, 10.5f, 14.8f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_A7: - SetFrame( 0, 0, 7.4f, 10.5f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_A8: - SetFrame( 0, 0, 5.2f, 7.4f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_A9: - SetFrame( 0, 0, 3.7f, 5.2f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_A10: - SetFrame( 0, 0, 2.6f, 3.7f, TWUN_CENTIMETERS, 100, 100); - break; - - case TWSS_ISOB0: - SetFrame( 0, 0,100.0f, 141.4f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_ISOB1: - SetFrame( 0, 0, 70.7f, 100.0f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_ISOB2: - SetFrame( 0, 0, 50.0f, 70.7f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_ISOB3: // case TWSS_B3: - SetFrame( 0, 0, 35.3f, 50.0f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_ISOB4: // case TWSS_B4: - SetFrame( 0, 0, 25.0f, 35.4f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_ISOB5: - SetFrame( 0, 0, 17.6f, 25.0f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_ISOB6: // case TWSS_B6: - SetFrame( 0, 0, 12.5f, 17.6f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_ISOB7: - SetFrame( 0, 0, 8.8f, 12.5f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_ISOB8: - SetFrame( 0, 0, 6.2f, 8.8f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_ISOB9: - SetFrame( 0, 0, 4.4f, 6.2f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_ISOB10: - SetFrame( 0, 0, 3.1f, 4.4f, TWUN_CENTIMETERS, 100, 100); - break; - - case TWSS_JISB0: - SetFrame( 0, 0,103.0f, 145.6f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_JISB1: - SetFrame( 0, 0, 72.8f, 103.0f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_JISB2: - SetFrame( 0, 0, 51.5f, 72.8f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_JISB3: - SetFrame( 0, 0, 36.4f, 51.5f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_JISB4: - SetFrame( 0, 0, 25.7f, 36.4f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_JISB5: // case TWSS_B5LETTER: - SetFrame( 0, 0, 18.2f, 25.7f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_JISB6: - SetFrame( 0, 0, 12.8f, 18.2f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_JISB7: - SetFrame( 0, 0, 9.1f, 12.8f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_JISB8: - SetFrame( 0, 0, 6.4f, 9.1f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_JISB9: - SetFrame( 0, 0, 4.5f, 6.4f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_JISB10: - SetFrame( 0, 0, 3.2f, 4.5f, TWUN_CENTIMETERS, 100, 100); - break; - - case TWSS_C0: - SetFrame( 0, 0, 91.7f, 129.7f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_C1: - SetFrame( 0, 0, 64.8f, 91.7f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_C2: - SetFrame( 0, 0, 45.8f, 64.8f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_C3: - SetFrame( 0, 0, 32.4f, 45.8f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_C4: - SetFrame( 0, 0, 22.9f, 32.4f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_C5: - SetFrame( 0, 0, 16.2f, 22.9f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_C6: - SetFrame( 0, 0, 11.4f, 16.2f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_C7: - SetFrame( 0, 0, 8.1f, 11.4f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_C8: - SetFrame( 0, 0, 5.7f, 8.1f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_C9: - SetFrame( 0, 0, 4.0f, 5.7f, TWUN_CENTIMETERS, 100, 100); - break; - case TWSS_C10: - SetFrame( 0, 0, 2.8f, 4.0f, TWUN_CENTIMETERS, 100, 100); - break; - - default: - nLeft = nTop = nRight = nBottom = 0; - break; - } -} - - -InternalFrame* InternalFrame::SetFrame(float left, float top, float right, float bottom, int fromUnits, float Xresolution, float Yresolution) -{ - nLeft = int(ConvertUnits(left, fromUnits, TWUN_PIXELS, Xresolution)); - nTop = int(ConvertUnits(top, fromUnits, TWUN_PIXELS, Yresolution)); - nRight = int(ConvertUnits(right, fromUnits, TWUN_PIXELS, Xresolution)); - nBottom = int(ConvertUnits(bottom, fromUnits, TWUN_PIXELS, Yresolution)); - - return this; -} - -TW_FRAME InternalFrame::AsTW_FRAME(int toUnits, float Xresolution, float Yresolution) -{ - TW_FRAME frame; - frame.Left = FloatToFIX32(ConvertUnits(float(nLeft), TWUN_PIXELS, toUnits, Xresolution)); - frame.Top = FloatToFIX32(ConvertUnits(float(nTop), TWUN_PIXELS, toUnits, Yresolution)); - frame.Right = FloatToFIX32(ConvertUnits(float(nRight), TWUN_PIXELS, toUnits, Xresolution)); - frame.Bottom = FloatToFIX32(ConvertUnits(float(nBottom), TWUN_PIXELS, toUnits, Yresolution)); - return frame; -} - - -bool operator== (const InternalFrame& _frame1, const InternalFrame& _frame2) -{ - if((2> abs((int)_frame1.nLeft - (int)_frame2.nLeft) ) && - (2> abs((int)_frame1.nTop - (int)_frame2.nTop) ) && - (2> abs((int)_frame1.nRight - (int)_frame2.nRight) ) && - (2> abs((int)_frame1.nBottom - (int)_frame2.nBottom)) ) - { - return true; - } - - return false; -} - - -////////////////////////////////////////////////////////////////////////////// - - -CTWAINContainerFrame::CTWAINContainerFrame(const TW_UINT16 _unCapID, - const TW_UINT16 _unGetType, - const TW_INT32 _nSupportedQueries/* = TWQC_ALL*/, - const TW_UINT16 _unGetCurrentType/* = TWON_ONEVALUE*/, - const TW_UINT16 _unGetDefaultType/* = TWON_ONEVALUE*/) - : CTWAINContainer(_unCapID, TWTY_FRAME, _unGetType, _nSupportedQueries,_unGetCurrentType,_unGetDefaultType) -{ - m_Unit = TWUN_PIXELS; - m_Xres = 100; - m_Yres = 100; -} - -CTWAINContainerFrame::~CTWAINContainerFrame() -{ -} - -TW_HANDLE CTWAINContainerFrame::GetContainer(const TW_UINT16 _unMsg) -{ - TW_HANDLE hContainer = 0; - TW_UINT16 unGetType=TWON_ONEVALUE; - switch(_unMsg) - { - case MSG_GET: - unGetType = m_unGetType; - break; - case MSG_GETCURRENT: - unGetType = m_unGetCurrentType; - break; - case MSG_GETDEFAULT: - unGetType = m_unGetDefaultType; - break; - } - - switch(unGetType) - { - default: - case TWON_ONEVALUE: - { - hContainer = _DSM_Alloc(sizeof(TW_ONEVALUE_FRAME)); - - if(0 != hContainer) - { - pTW_ONEVALUE_FRAME pCap = (pTW_ONEVALUE_FRAME)_DSM_LockMemory(hContainer); - // If the Cap has been constrained the default may only be in the defaultlist. - InternalFrame frame = (MSG_GETDEFAULT == _unMsg)?m_listFramesDefault[m_nDefault]:m_listFrames[m_nCurrent]; - - pCap->Item = frame.AsTW_FRAME(m_Unit, m_Xres, m_Yres); - pCap->ItemType = m_unItemType; - - _DSM_UnlockMemory(hContainer); - } - } - break; - - case TWON_ENUMERATION: - { - hContainer = _DSM_Alloc(sizeof(TW_ENUMERATION_FRAME) + (sizeof(TW_FRAME) * (m_listFrames.size()-1))); // -1 because already contains 1 element - - if(0 != hContainer) - { - pTW_ENUMERATION_FRAME pCap = (pTW_ENUMERATION_FRAME)_DSM_LockMemory(hContainer); - - pCap->ItemType = m_unItemType; - pCap->NumItems = (TW_UINT32)m_listFrames.size(); - pCap->CurrentIndex = m_nCurrent; - //If the CAP has been constrained m_nDefault index might not point - // to the correct index and the index may not be valid. We need to - // find the value in the default list and see if we can find a match - // in the current list. If no match found then set to first index. - // see spec on twain.org Chap4 p73 Advanced Application Implementation | - // Capabilities | Constrained Capabilities and Message Responses | MSG_SET - const InternalFrame frame = m_listFramesDefault[m_nDefault]; - int nIndex = getIndexForValue(frame); - if(nIndex != -1) - { - pCap->DefaultIndex = nIndex; - } - else - { - // We use the first index. We could try transversing through the - // list and finding the closest match in value. But either way - // the application should not be using this value. - pCap->DefaultIndex = 0; - } - - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - pCap->ItemList[x] = m_listFrames[x].AsTW_FRAME(m_Unit, m_Xres, m_Yres); - } - - _DSM_UnlockMemory(hContainer); - } - } - break; - - case TWON_ARRAY: - { - hContainer = _DSM_Alloc(sizeof(TW_ARRAY_FRAME) + (sizeof(TW_FRAME) * (m_listFrames.size()-1))); // -1 because a TW_ARRAY_FIX32 already includes 1 element - - if(0 != hContainer) - { - pTW_ARRAY_FRAME pCap = (pTW_ARRAY_FRAME)_DSM_LockMemory(hContainer); - pCap->ItemType = m_unItemType; - pCap->NumItems = (TW_UINT32)m_listFrames.size(); - - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - pCap->ItemList[x] = m_listFrames[x].AsTW_FRAME(m_Unit, m_Xres, m_Yres); - } - - _DSM_UnlockMemory(hContainer); - } - } - }// switch(unGetType) - - return hContainer; -} - -bool CTWAINContainerFrame::isValidType(const TW_UINT16 _unTWType) -{ - bool bret = false; - - if(TWTY_FRAME == _unTWType) - { - bret = true; - } - - return bret; -} - -TW_INT16 CTWAINContainerFrame::Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition) -{ - // TW_FRAME can override the current and available list regardless if they - // are available in the default list. - TW_INT16 twrc = TWRC_SUCCESS; - Condition = TWCC_SUCCESS; - - if(TWON_ONEVALUE == _pCap->ConType) - { - pTW_ONEVALUE_FRAME pCap = (pTW_ONEVALUE_FRAME)_DSM_LockMemory(_pCap->hContainer); - - if(isValidType(pCap->ItemType)) - { - InternalFrame frame(pCap->Item, m_Unit, m_Xres, m_Yres); - - switch(m_unGetType) - { - case TWON_ONEVALUE: - case TWON_ENUMERATION: - { - /// @todo check to see if frame is in range - Set(frame); - } - break; - /* - case TWON_ENUMERATION: - { - int nVal = -1; - if((nVal = getIndexForValue(frame)) >= 0) - { - m_nCurrent = nVal; - } - else - { - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - break; - */ - //case TWON_ARRAY: - //break; - //case TWON_RANGE: - //break; - default: - twrc = TWRC_FAILURE; - Condition = TWCC_CAPBADOPERATION; - break; - } - } - - _DSM_UnlockMemory(_pCap->hContainer); - } - else if(TWON_ENUMERATION == _pCap->ConType) - { - pTW_ENUMERATION_FRAME pCap = (pTW_ENUMERATION_FRAME)_DSM_LockMemory(_pCap->hContainer); - - if(isValidType(pCap->ItemType)) - { - m_nCurrent = pCap->CurrentIndex; - // We ignor trying to set the default. The default can not be changed from outside - - FrameVector::iterator iter; - m_listFrames.clear(); - - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - InternalFrame frame(pCap->ItemList[x], m_Unit, m_Xres, m_Yres); - - // Only add items that are within the range of the frame regardless what is in our m_listFramesDefault - // iter = find(m_listFramesDefault.begin(), m_listFramesDefault.end(), frame); - - /// @todo check if value is within range - if(1) - { - m_listFrames.push_back(frame); - m_nCurrent = 0; - } - else - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - } - } - else // NOT isValidType(pCap->ItemType)) - { - twrc = TWRC_FAILURE; - Condition = TWCC_CAPBADOPERATION; - } - - _DSM_UnlockMemory(_pCap->hContainer); - } - else //bad container type - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - - return twrc; -} - -bool CTWAINContainerFrame::Set(const InternalFrame& _frame) -{ - // Set is only called after the Frame has been initilized by calling Add - if(m_nDefault == -1) - { - assert(m_nDefault != -1); - return false; - } - - m_listFrames.clear(); - m_listFrames.push_back(_frame); - m_nCurrent = 0; - return true; -} - -bool CTWAINContainerFrame::Reset() -{ - m_nCurrent = m_nDefault; - - m_listFrames.clear(); - - const int nSize = (int)(m_listFramesDefault.size()); - - for(int x = 0; x < nSize; ++x) - { - m_listFrames.push_back(m_listFramesDefault[x]); - } - - return true; -} - -bool CTWAINContainerFrame::GetCurrent(InternalFrame& _frame) -{ - bool bret = false; - - if(!(m_nMSG_QUERYSUPPORT & TWQC_GETCURRENT)) - { - return false; - } - - if((m_nCurrent >= 0) && ((int)(m_listFrames.size()) > m_nCurrent)) - { - _frame = m_listFrames[m_nCurrent]; - bret = true; - } - - return bret; -} - -bool CTWAINContainerFrame::GetDefault(InternalFrame& _frame) -{ - bool bret = false; - - if(!(m_nMSG_QUERYSUPPORT & TWQC_GETDEFAULT)) - { - return false; - } - - if((m_nDefault >= 0) && ((int)(m_listFramesDefault.size()) > m_nDefault)) - { - _frame = m_listFramesDefault[m_nDefault]; - bret = true; - } - - return bret; -} - -const FrameVector &CTWAINContainerFrame::GetSupported() -{ - return m_listFrames; -} - -bool CTWAINContainerFrame::Add(const int _nLeft, const int _nTop, const int _nRight, const int _nBottom, bool _bDefault /*= false*/) -{ - InternalFrame frame(_nLeft, _nTop, _nRight, _nBottom); - - return Add(frame, _bDefault); -} - -bool CTWAINContainerFrame::Add(const InternalFrame& _frame, bool _bDefault /*= false*/) -{ - m_listFrames.push_back(_frame); - m_listFramesDefault.push_back(_frame); - if(m_nDefault == -1 || _bDefault) - { - m_nCurrent = m_nDefault = getIndexForValue(_frame); - } - return true; -} - -bool CTWAINContainerFrame::SetCurrent(const int _nLeft, const int _nTop, const int _nRight, const int _nBottom) -{ - InternalFrame frame(_nLeft, _nTop, _nRight, _nBottom); - - return SetCurrent(frame); -} - -bool CTWAINContainerFrame::SetCurrent(const InternalFrame& _frame) -{ - int nIdx = getIndexForValue(_frame); - if(nIdx < 0) - { - return false; - } - - m_nCurrent = nIdx; - return true; -} - -int CTWAINContainerFrame::getIndexForValue(const InternalFrame& _frame) -{ - int ret = -1; - - const int nSize = (int)(m_listFrames.size()); - - for(int x = 0; x < nSize; ++x) - { - if(_frame == m_listFrames[x]) - { - ret = x; - break; - } - } - - return ret; -} - - -void CTWAINContainerFrame::setCurrentUnits(int Unit, float Xres, float Yres) -{ - m_Unit = Unit; - m_Xres = Xres; - m_Yres = Yres; -} diff --git a/TWAINContainerFrame.h b/TWAINContainerFrame.h deleted file mode 100644 index 3329d7e..0000000 --- a/TWAINContainerFrame.h +++ /dev/null @@ -1,255 +0,0 @@ -/*************************************************************************** -* Copyright 2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainerFrame.h -* Frame Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - - -#ifndef __CTWAINCONTAINERFRAME_H__ -#define __CTWAINCONTAINERFRAME_H__ - -#include "TWAINContainer.h" - -/** -* This structure is used to hold the values for a frame. -* All values are stored using internal units of 1/1000th of an inch -*/ -struct InternalFrame -{ - int nLeft; /**< left */ - int nTop; /**< top */ - int nRight; /**< right */ - int nBottom; /**< bottom */ - - /** - * Constructor - */ - InternalFrame(); - - /** - * Constructor - * @param[in] left Left - * @param[in] lop Top - * @param[in] right Right - * @param[in] bottom Bottom - */ - InternalFrame(int left, int top, int right, int bottom); - - /** - * Constructor Convert to interanal from TW_FRAME - * @param[in] twFrame external value to convert. - * @param[in] fromUnits the units to convert to - * @param[in] Xresolution the X resolution - * @param[in] Yresolution the Y resolution - * @return true if success. - */ - InternalFrame(const TW_FRAME twFrame, int fromUnits, float Xresolution, float Yresolution); - - /** - * create interanal frame from a SupportedSize - * @param[in] ss the CSupportedSize to create internal frame from - * @return the InternalFrame - */ - InternalFrame(const TW_UINT16 ss); - - /** - * Convert interanal frame value to external TW_FRAME value converting the units - * @param[in] toUnits the units to convert to - * @param[in] Xresolution the X resolution - * @param[in] Yresolution the Y resolution - * @return the frame as a TW_FRAME - */ - TW_FRAME AsTW_FRAME(int toUnits, float Xresolution, float Yresolution); - -protected: - /** - * Set the frame to interanal from external units - * @param[in] left Left - * @param[in] lop Top - * @param[in] right Right - * @param[in] bottom Bottom - * @param[in] fromUnits the units to convert to - * @param[in] Xresolution the X resolution - * @param[in] Yresolution the Y resolution - * @return true if success. - */ - InternalFrame * SetFrame(float left, float top, float right, float bottom, int fromUnits, float Xresolution, float Yresolution); -}; - -/** -* test if two frames are equal. -* @return true if equal. -*/ -bool operator== (const InternalFrame& _frame1, const InternalFrame& _frame2); - -/** -* Frame Vector -*/ -typedef vector FrameVector; - - - -/** -* This class can be used for any TW_FRAME based TWAIN container. -* -* All values are stored internally as 1/1000th of an inch. They are converted -* as necessary when TWAIN containers are created. Any direct access will require -* the caller to do their own conversion. -*/ -class CTWAINContainerFrame : public CTWAINContainer -{ - friend class CTWAIN_UI; -public: - /** - * Constructor. - * @param[in] _unCapID Capability ID - * @param[in] _unItemType TWAIN Type TWTY_xxxx being stored. - * @param[in] _unGetType TWON_xxxx container - * @param[in] _nSupportedQueries the supported querie types TWQC_xxxx - */ - CTWAINContainerFrame(const TW_UINT16 _unCapID, - const TW_UINT16 _unGetType, - const TW_INT32 _nSupportedQueries = TWQC_ALL, - const TW_UINT16 _unGetCurrentType = TWON_ONEVALUE, - const TW_UINT16 _unGetDefaultType = TWON_ONEVALUE); - virtual ~CTWAINContainerFrame(); - - virtual TW_HANDLE GetContainer(const TW_UINT16 _unMsg); - virtual TW_INT16 Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition); - virtual bool Reset(); - - /** - * Try to add a value for container. The first value added to a capabiltiy is set as the default and current value. - * @param[in] _frame the value to be added. - * @param[in] _bDefault if true explisitly sets this value to be the default and current. - * @return true if success. - */ - bool Add(const InternalFrame& _frame, bool _bDefault = false); - - /** - * Try to add a value for container. The first value added to a capabiltiy is set as the default and current value. - * @param[in] _nLeft left - * @param[in] _nTop top - * @param[in] _nRight right - * @param[in] _nBottom bottom - * @param[in] _bDefault if true explisitly sets this value to be the default and current. - * @return true if success. - */ - bool Add(const int _nLeft, const int _nTop, const int _nRight, const int _nBottom, bool _bDefault = false); - - /** - * Set the current Frame. Only used after the default has been set using Add - * @param[in] _frame the value to be added. - * @return true if success. - */ - bool Set(const InternalFrame& _frame); - - /** - * Try to set the current value for container. - * The value must already be part of the container. - * @param[in] _frame the value to be set as current. - * @return true if success. - */ - bool SetCurrent(const InternalFrame& _frame); - - /** - * Try to set the current value for container. - * The value must already be part of the container. - * @param[in] _nLeft left - * @param[in] _nTop top - * @param[in] _nRight right - * @param[in] _nBottom bottom - * @return true if success. - */ - bool SetCurrent(const int _nLeft, const int _nTop, const int _nRight, const int _nBottom); - - /** - * Return the default value through _frame if set. - * @param[out] _frame set the default value on return. - * @return true if success. - */ - bool GetDefault(InternalFrame& _frame); - - /** - * Return the current value through _frame if set. - * @param[out] _frame set the current value on return. - * @return true if success. - */ - bool GetCurrent(InternalFrame& _frame); - - /** - * Return a vector of supported values. - * @return supported values. - */ - const FrameVector &GetSupported(); - - /** - * Return the weather or not the value is supported by this capability. - * @param[in] _frame the value to check to see if it is supported - * @return true is the _frame is supported. - */ - bool isValueSupported(const InternalFrame& _frame) {return -1 != getIndexForValue(_frame);} - - /** - * Return the index in vector list for value. - * @param[in] _frame value to search for. - * @return the index of value, or -1 if does not exist. - */ - int getIndexForValue(const InternalFrame& _frame); - - /** - * set the current unit and resolution. Used to translate the Frames coming and going - * @param[in] Unit the current unit value. - * @param[in] Xres the current X resolution value. - * @param[in] Yres the current Y resolution value. - */ - void setCurrentUnits(int Unit, float Xres, float Yres); - -protected: - /** - * Check to see if type is valid. - * @param[in] _unTWType type to check - * @return true if valid - */ - bool isValidType(const TW_UINT16 _unTWType); - - FrameVector m_listFrames; /**< vector of valid container values. */ - FrameVector m_listFramesDefault; /**< vector of valid container default values. */ - int m_Unit; /**< used to translate the units coming and going */ - float m_Xres; /**< used to translate the units coming and going */ - float m_Yres; /**< used to translate the units coming and going */ -}; - -#endif // __CTWAINCONTAINERFRAME_H__ diff --git a/TWAINContainerInt.cpp b/TWAINContainerInt.cpp deleted file mode 100644 index d3cdfd8..0000000 --- a/TWAINContainerInt.cpp +++ /dev/null @@ -1,542 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainerInt.cpp -* Int Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - -#include "stdafx.h" -#include "CommonDS.h" -#include - - -CTWAINContainerInt::CTWAINContainerInt(const TW_UINT16 _unCapID, - const TW_UINT16 _unItemType, - const TW_UINT16 _unGetType, - const TW_INT32 _nSupportedQueries/* = TWQC_ALL*/, - const TW_UINT16 _unGetCurrentType/* = TWON_ONEVALUE*/, - const TW_UINT16 _unGetDefaultType/* = TWON_ONEVALUE*/) - : CTWAINContainer(_unCapID, _unItemType, _unGetType, _nSupportedQueries,_unGetCurrentType,_unGetDefaultType) -{ -} - -CTWAINContainerInt::~CTWAINContainerInt() -{ -} - -TW_HANDLE CTWAINContainerInt::GetContainer(const TW_UINT16 _unMsg) -{ - TW_HANDLE hContainer = 0; - TW_UINT16 unGetType=TWON_ONEVALUE; - switch(_unMsg) - { - case MSG_GET: - unGetType = m_unGetType; - break; - case MSG_GETCURRENT: - unGetType = m_unGetCurrentType; - break; - case MSG_GETDEFAULT: - unGetType = m_unGetDefaultType; - break; - } - - switch(unGetType) - { - default: - case TWON_ONEVALUE: - { - hContainer = _DSM_Alloc(sizeof(TW_ONEVALUE)); - - if(0 != hContainer) - { - pTW_ONEVALUE pCap = (pTW_ONEVALUE)_DSM_LockMemory(hContainer); - - pCap->ItemType = m_unItemType; - // If the Cap has been constrained the default may only be in the defaultlist. - pCap->Item = (MSG_GETDEFAULT == _unMsg)?m_listIntsDefault[m_nDefault]:m_listInts[m_nCurrent]; - - _DSM_UnlockMemory(hContainer); - } - } - break; - - case TWON_ENUMERATION: - { - unsigned int unSize = getTWTYSize(m_unItemType); - hContainer = _DSM_Alloc(sizeof(TW_ENUMERATION) -1 + (unSize * m_listInts.size())); - - if(0 != hContainer) - { - pTW_ENUMERATION pCap = (pTW_ENUMERATION)_DSM_LockMemory(hContainer); - - pCap->ItemType = m_unItemType; - pCap->NumItems = (TW_UINT32)m_listInts.size(); - pCap->CurrentIndex = m_nCurrent; - //If the CAP has been constrained m_nDefault index might not point - // to the correct index and the index may not be valid. We need to - // find the value in the default list and see if we can find a match - // in the current list. If no match found then set to first index. - // see spec on twain.org Chap4 p73 Advanced Application Implementation | - // Capabilities | Constrained Capabilities and Message Responses | MSG_SET - const int nVal = m_listIntsDefault[m_nDefault]; - int nIndex = getIndexForValue(nVal); - if(nIndex != -1) - { - pCap->DefaultIndex = nIndex; - } - else - { - // We use the first index. We could try transversing through the - // list and finding the closest match in value. But either way - // the application should not be using this value. - pCap->DefaultIndex = 0; - } - - fillValues(&pCap->ItemList, pCap->NumItems, m_unItemType); - - _DSM_UnlockMemory(hContainer); - } - } - break; - - case TWON_ARRAY: - { - unsigned int unSize = getTWTYSize(m_unItemType); - hContainer = _DSM_Alloc(sizeof(TW_ARRAY)-1 + (unSize * m_listInts.size())); - - if(0 != hContainer) - { - pTW_ARRAY pCap = (pTW_ARRAY)_DSM_LockMemory(hContainer); - pCap->ItemType = m_unItemType; - pCap->NumItems = (TW_UINT32)m_listInts.size(); - - fillValues(&pCap->ItemList, pCap->NumItems, m_unItemType); - - _DSM_UnlockMemory(hContainer); - } - } - } // switch(unGetType) - - return hContainer; -} - -void CTWAINContainerInt::fillValues(void* _pItemList, const TW_UINT32 _unNumItems, const TW_UINT16 _unItemType) -{ - for(TW_UINT32 x = 0; x < _unNumItems; ++x) - { - switch(_unItemType) - { - case TWTY_INT8: - ((TW_INT8*)_pItemList)[x] = (TW_INT8)m_listInts[x]; - break; - - case TWTY_INT16: - ((TW_INT16*)_pItemList)[x] = (TW_INT16)m_listInts[x]; - break; - - case TWTY_INT32: - ((TW_INT32*)_pItemList)[x] = (TW_INT32)m_listInts[x]; - break; - - case TWTY_UINT8: - ((TW_UINT8*)_pItemList)[x] = (TW_UINT8)m_listInts[x]; - break; - - case TWTY_UINT16: - ((TW_UINT16*)_pItemList)[x] = (TW_UINT16)m_listInts[x]; - break; - - case TWTY_UINT32: - ((TW_UINT32*)_pItemList)[x] = (TW_UINT32)m_listInts[x]; - break; - - case TWTY_BOOL: - ((TW_BOOL*)_pItemList)[x] = (TW_BOOL)m_listInts[x]; - break; - } - } -} - -bool CTWAINContainerInt::isValidType(const TW_UINT16 _unTWType) -{ - bool bret = false; - - switch(_unTWType) - { - case TWTY_INT8: - case TWTY_INT16: - case TWTY_INT32: - case TWTY_UINT8: - case TWTY_UINT16: - case TWTY_UINT32: - case TWTY_BOOL: - bret = true; - break; - } - - return bret; -} - -int CTWAINContainerInt::getValue(const pTW_ONEVALUE _pVal) -{ - int nRet = 0; - - switch(_pVal->ItemType) - { - case TWTY_INT8: - nRet = *((TW_INT8*)&(_pVal->Item)); - break; - - case TWTY_INT16: - nRet = *((TW_INT16*)&(_pVal->Item)); - break; - - case TWTY_INT32: - nRet = *((TW_INT32*)&(_pVal->Item)); - break; - - case TWTY_UINT8: - nRet = *((TW_UINT8*)&(_pVal->Item)); - break; - - case TWTY_UINT16: - nRet = *((TW_UINT16*)&(_pVal->Item)); - break; - - case TWTY_UINT32: - nRet = *((TW_UINT32*)&(_pVal->Item)); - break; - - case TWTY_BOOL: - nRet = *((TW_BOOL*)&(_pVal->Item)); - break; - } - - return nRet; -} - -TW_INT16 CTWAINContainerInt::Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition) -{ - TW_INT16 twrc = TWRC_SUCCESS; - Condition = TWCC_SUCCESS; - - if(TWON_ONEVALUE == _pCap->ConType) - { - pTW_ONEVALUE pCap = (pTW_ONEVALUE)_DSM_LockMemory(_pCap->hContainer); - if(isValidType(pCap->ItemType)) - { - switch(m_unGetType) - { - case TWON_ONEVALUE: - { - m_listInts.clear(); - m_listInts.push_back(getValue(pCap)); - m_nCurrent = 0; - } - break; - case TWON_ENUMERATION: - { - int nVal = -1; - - if( (nVal = getIndexForValue(getValue(pCap))) >= 0 ) - { - m_nCurrent = nVal; - } - else - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - } - break; - //case TWON_ARRAY: - //break; - //case TWON_RANGE: - //break; - default: - twrc = TWRC_FAILURE; - Condition = TWCC_CAPBADOPERATION; - break; - } - } - else // NOT isValidType(pCap->ItemType)) - { - twrc = TWRC_FAILURE; - Condition = TWCC_CAPBADOPERATION; - } - _DSM_UnlockMemory(_pCap->hContainer); - } - else if(TWON_ENUMERATION == _pCap->ConType) - { - pTW_ENUMERATION pCap = (pTW_ENUMERATION)_DSM_LockMemory(_pCap->hContainer); - - if(isValidType(pCap->ItemType)) - { - int nNewCurrentIndex = pCap->CurrentIndex; - IntVector::iterator iter; - bool bListCleared = false; // We only want to crear the current list if we are passed - // valid data, and only clear it once through the loop of testing - - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - // only set the value if it exists in m_listIntsDefault - int nValue = GetIndexIntValue(pCap, x); - iter = find(m_listIntsDefault.begin(), m_listIntsDefault.end(), nValue); - - if(iter != m_listIntsDefault.end()) - { - // We have valid data - if(!bListCleared) - { - // only clear the list if we have not done so already - m_listInts.clear(); - bListCleared = true; - } - - // only add it if it was not added already - iter = find(m_listInts.begin(), m_listInts.end(), nValue); - if(iter == m_listInts.end()) - { - m_listInts.push_back(nValue); - } - else - { - // if the index is below the current then we need to adjust what is going to be current - if(x < pCap->CurrentIndex) - { - nNewCurrentIndex--; - } - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - else - { - // if the index is below the current then we need to adjust what is going to be current - if(x < pCap->CurrentIndex) - { - nNewCurrentIndex--; - } - - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - - // If the list has been cleared then there was at at least some valid data - if(bListCleared) - { - if(nNewCurrentIndex >= 0 && nNewCurrentIndex < (int)(m_listInts.size())) - { - m_nCurrent = nNewCurrentIndex; - } - else - { - // the new current index is not in range - m_nCurrent = 0; - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - else - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - } - else // NOT isValidType(pCap->ItemType)) - { - twrc = TWRC_FAILURE; - Condition = TWCC_CAPBADOPERATION; - } - - _DSM_UnlockMemory(_pCap->hContainer); - } - else //bad container type - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - - return twrc; -} - -bool CTWAINContainerInt::Reset() -{ - m_nCurrent = m_nDefault; - - m_listInts.clear(); - - const int nSize = (int)(m_listIntsDefault.size()); - - for(int x = 0; x < nSize; ++x) - { - m_listInts.push_back(m_listIntsDefault[x]); - } - - return true; -} - -// For int vals -bool CTWAINContainerInt::GetCurrent(int &_nVal) -{ - bool bret = false; - - if(!(m_nMSG_QUERYSUPPORT & TWQC_GETCURRENT)) - { - return false; - } - - if((m_nCurrent >= 0) && ((int)(m_listInts.size()) > m_nCurrent)) - { - _nVal = m_listInts[m_nCurrent]; - bret = true; - } - - return bret; -} - -bool CTWAINContainerInt::GetDefault(int &_nVal) -{ - bool bret = false; - - if(!(m_nMSG_QUERYSUPPORT & TWQC_GETDEFAULT)) - { - return TWRC_FAILURE; - } - - if((m_nDefault >= 0) && ((int)(m_listIntsDefault.size()) > m_nDefault)) - { - _nVal = m_listIntsDefault[m_nDefault]; - bret = true; - } - - return bret; -} - -const IntVector &CTWAINContainerInt::GetSupported() -{ - return m_listInts; -} - -bool CTWAINContainerInt::Add(int _nAdd, bool _bDefault /*= false*/) -{ - m_listInts.push_back(_nAdd); - m_listIntsDefault.push_back(_nAdd); - if(m_nDefault == -1 || _bDefault) - { - m_nCurrent = m_nDefault = getIndexForValue(_nAdd); - } - return true; -} - -bool CTWAINContainerInt::SetCurrent(int _nCurr) -{ - if(TWON_ONEVALUE == m_unGetType)//check before call - { - m_listInts.clear(); - m_listInts.push_back(_nCurr); - m_nCurrent = 0; - } - else - { - int nIdx = getIndexForValue(_nCurr); - if(nIdx < 0) - { - return false; - } - - m_nCurrent = nIdx; - } - - return true; -} - -int CTWAINContainerInt::getIndexForValue(const int _nVal) -{ - int ret = -1; - - const int nSize = (int)(m_listInts.size()); - - for(int x = 0; x < nSize; ++x) - { - if(_nVal == m_listInts[x]) - { - ret = x; - break; - } - } - - return ret; -} - -int GetIndexIntValue(pTW_ENUMERATION pCap, TW_UINT32 index) -{ - int rtn = 0; - if(pCap && pCap->NumItems > index) - { - switch(pCap->ItemType) - { - case TWTY_INT8: - rtn = ((TW_INT8*)&pCap->ItemList)[index]; - break; - - case TWTY_INT16: - rtn = ((TW_INT16*)&pCap->ItemList)[index]; - break; - - case TWTY_INT32: - rtn = ((TW_INT32*)&pCap->ItemList)[index]; - break; - - case TWTY_UINT8: - rtn = ((TW_UINT8*)&pCap->ItemList)[index]; - break; - - case TWTY_UINT16: - rtn = ((TW_UINT16*)&pCap->ItemList)[index]; - break; - - case TWTY_UINT32: - rtn = ((TW_UINT32*)&pCap->ItemList)[index]; - break; - - case TWTY_BOOL: - rtn = ((TW_BOOL*)&pCap->ItemList)[index]; - break; - } - } - return rtn; -} diff --git a/TWAINContainerInt.h b/TWAINContainerInt.h deleted file mode 100644 index ba90afe..0000000 --- a/TWAINContainerInt.h +++ /dev/null @@ -1,159 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainerInt.h -* Int Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - - -#ifndef __CTWAINCONTAINERINT_H__ -#define __CTWAINCONTAINERINT_H__ - -#include "TWAINContainer.h" - - /** - * Return the Int Value of the index into an enumeration of Ints - * @param[in] pCap The enumeration to retreive the value - * @param[in] index the index into the enumeration to retrieve the value. - * @return the Int value at index into pCap - */ -int GetIndexIntValue(pTW_ENUMERATION pCap, TW_UINT32 index); - -/** -* This class can be used for any Integer based TWAIN container. -* All values are stored internally as 1/1000th of an inch. They are converted -* as necessary when TWAIN containers are created. Any direct access will require -* the caller to do their own conversion. -*/ -class CTWAINContainerInt : public CTWAINContainer -{ - friend class CTWAIN_UI; -public: - /** - * Constructor. - * @param[in] _unCapID Capability ID - * @param[in] _unItemType TWAIN Type TWTY_xxxx being stored. - * @param[in] _unGetType TWON_xxxx container - * @param[in] _nSupportedQueries the supported querie types TWQC_xxxx - */ - CTWAINContainerInt(const TW_UINT16 _unCapID, - const TW_UINT16 _unItemType, - const TW_UINT16 _unGetType, - const TW_INT32 _nSupportedQueries = TWQC_ALL, - const TW_UINT16 _unGetCurrentType = TWON_ONEVALUE, - const TW_UINT16 _unGetDefaultType = TWON_ONEVALUE); - virtual ~CTWAINContainerInt(); - - virtual TW_HANDLE GetContainer(const TW_UINT16 _unMsg); - virtual TW_INT16 Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition); - virtual bool Reset(); - - /** - * Try to add a value for container. The first value added to a capabiltiy is set as the default and current value. - * @param[in] _nAdd the value to be added. - * @param[in] _bDefault if true explisitly sets this value to be the default and current. - * @return true if success. - */ - bool Add(int _nAdd, bool _bDefault = false); - - /** - * Try to set the current value for container. - * The value must already be part of the container. - * @param[in] _nCurr the value to be set as current. - * @return true if success. - */ - bool SetCurrent(int _nCurr); - - /** - * Return the default value through _nVal if set. - * @param[out] _nVal set the default value on return. - * @return true if success. - */ - bool GetDefault(int &_nVal); - - /** - * Return the current value through _nVal if set. - * @param[out] _nVal set the current value on return. - * @return true if success. - */ - bool GetCurrent(int &_nVal); - - /** - * Return a vector of supported values. - * @return supported values. - */ - const IntVector &GetSupported(); - - /** - * Return the current value from the container. - * @param[in] _pVal pointer to TW_ONEVALUE container of - * @return the value converted to int. - */ - int getValue(const pTW_ONEVALUE _pVal); - - /** - * Return the weather or not the value is supported by this capability. - * @param[in] _nVal the value to check to see if it is supported - * @return true is the _nVal is supported. - */ - bool isValueSupported(const int _nVal) {return -1 != getIndexForValue(_nVal);} - - /** - * Return the index in vector list for value. - * @param[in] _flVal value to search for. - * @return the index of value, or -1 if does not exist. - */ - int getIndexForValue(const int _nVal); - -protected: - /** - * Check to see if type is valid. - * @param[in] _unTWType type to check - * @return true if valid - */ - bool isValidType(const TW_UINT16 _unTWType); - - /** - * This is a utility function used to help create the TWAIN container. - * @param[in] _pItemList container to fill up. - * @param[in] _unNumItems number of fields to fill in. - * @param[in] _unItemType type of item in container. - */ - void fillValues(void* _pItemList, const TW_UINT32 _unNumItems, const TW_UINT16 _unItemType); - - IntVector m_listInts; /**< vector of valid container values. */ - IntVector m_listIntsDefault; /**< vector of valid container default values. */ -}; - -#endif // __CTWAINCONTAINERINT_H__ diff --git a/TWAINContainerString.cpp b/TWAINContainerString.cpp deleted file mode 100644 index 227f6e0..0000000 --- a/TWAINContainerString.cpp +++ /dev/null @@ -1,444 +0,0 @@ -/*************************************************************************** -* Copyright 锟 2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainerInt.cpp -* Int Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - -#include "stdafx.h" -#include "CommonDS.h" -#include - - -CTWAINContainerString::CTWAINContainerString(const TW_UINT16 _unCapID, - const TW_UINT16 _unItemType, - const TW_UINT16 _unGetType, - const TW_INT32 _nSupportedQueries/* = TWQC_ALL*/, - const TW_UINT16 _unGetCurrentType/* = TWON_ONEVALUE*/, - const TW_UINT16 _unGetDefaultType/* = TWON_ONEVALUE*/) - : CTWAINContainer(_unCapID, _unItemType, _unGetType, _nSupportedQueries,_unGetCurrentType,_unGetDefaultType) -{ - m_unItemSize = getTWTYSize(_unItemType); -} - -CTWAINContainerString::~CTWAINContainerString() -{ -} - -TW_HANDLE CTWAINContainerString::GetContainer(const TW_UINT16 _unMsg) -{ - TW_HANDLE hContainer = 0; - TW_UINT16 unGetType=TWON_ONEVALUE; - switch(_unMsg) - { - case MSG_GET: - unGetType = m_unGetType; - break; - case MSG_GETCURRENT: - unGetType = m_unGetCurrentType; - break; - case MSG_GETDEFAULT: - unGetType = m_unGetDefaultType; - break; - } - - switch(unGetType) - { - default: - case TWON_ONEVALUE: - { - hContainer = _DSM_Alloc(sizeof(TW_ONEVALUE)+m_unItemSize-sizeof(TW_UINT32)); - if(0 != hContainer) - { - pTW_ONEVALUE pCap = (pTW_ONEVALUE)_DSM_LockMemory(hContainer); - - pCap->ItemType = m_unItemType; - // If the Cap has been constrained the default may only be in the defaultlist. - string strTemp = ((MSG_GETDEFAULT == _unMsg)?m_listStrsDefault[m_nDefault]:m_listStrs[m_nCurrent]); - memset((char*)&pCap->Item,0,m_unItemSize); -#ifdef __APPLE__ - memcpy(((char*)&pCap->Item)+1, strTemp.c_str(),MIN(m_unItemSize, strTemp.length())); - ((char*)&pCap->Item)[0]=strTemp.length(); -#else - memcpy((char*)&pCap->Item, strTemp.c_str(),MIN(m_unItemSize, strTemp.length())); -#endif - _DSM_UnlockMemory(hContainer); - } - } - break; - - case TWON_ENUMERATION: - { - hContainer = _DSM_Alloc(sizeof(TW_ENUMERATION) -1 + (m_unItemSize * m_listStrs.size())); - - if(0 != hContainer) - { - pTW_ENUMERATION pCap = (pTW_ENUMERATION)_DSM_LockMemory(hContainer); - - pCap->ItemType = m_unItemType; - pCap->NumItems = (TW_UINT32)m_listStrs.size(); - pCap->CurrentIndex = m_nCurrent; - //If the CAP has been constrained m_nDefault index might not point - // to the correct index and the index may not be valid. We need to - // find the value in the default list and see if we can find a match - // in the current list. If no match found then set to first index. - // see spec on twain.org Chap4 p73 Advanced Application Implementation | - // Capabilities | Constrained Capabilities and Message Responses | MSG_SET - const string strVal = m_listStrsDefault[m_nDefault]; - int nIndex = getIndexForValue(strVal); - if(nIndex != -1) - { - pCap->DefaultIndex = nIndex; - } - else - { - // We use the first index. We could try transversing through the - // list and finding the closest match in value. But either way - // the application should not be using this value. - pCap->DefaultIndex = 0; - } - - fillValues(&pCap->ItemList, pCap->NumItems); - - _DSM_UnlockMemory(hContainer); - } - } - break; - - case TWON_ARRAY: - { - hContainer = _DSM_Alloc(sizeof(TW_ARRAY)-1 + (m_unItemSize * m_listStrs.size())); - - if(0 != hContainer) - { - pTW_ARRAY pCap = (pTW_ARRAY)_DSM_LockMemory(hContainer); - pCap->ItemType = m_unItemType; - pCap->NumItems = (TW_UINT32)m_listStrs.size(); - - fillValues(&pCap->ItemList, pCap->NumItems); - - _DSM_UnlockMemory(hContainer); - } - } - } // switch(unGetType) - - return hContainer; -} - -void CTWAINContainerString::fillValues(void* _pItemList, const TW_UINT32 _unNumItems) -{ - for(TW_UINT32 x = 0; x < _unNumItems; ++x) - { - string strTemp = m_listStrs[x]; - char *pItem = (char*)_pItemList + m_unItemSize*x; - memset(pItem,0,m_unItemSize); -#ifdef __APPLE__ - memcpy(((char*)pItem)+1, strTemp.c_str(),MIN(m_unItemSize, strTemp.length())); - ((char*)pItem)[0]=strTemp.length(); -#else - memcpy(pItem, strTemp.c_str(),MIN(m_unItemSize, strTemp.length())); -#endif - } -} - -bool CTWAINContainerString::isValidType(const TW_UINT16 _unTWType) -{ - return m_unItemType == _unTWType; -} - -string CTWAINContainerString::getValue(const char* _pchVal) -{ - string strRet; - char *pstrTemp = new char[m_unItemSize+1]; - memcpy(pstrTemp,_pchVal,m_unItemSize); - pstrTemp[m_unItemSize]=0; - strRet = pstrTemp; - delete [] pstrTemp; - return strRet; -} - -TW_INT16 CTWAINContainerString::Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition) -{ - TW_INT16 twrc = TWRC_SUCCESS; - Condition = TWCC_SUCCESS; - - if(TWON_ONEVALUE == _pCap->ConType) - { - pTW_ONEVALUE pCap = (pTW_ONEVALUE)_DSM_LockMemory(_pCap->hContainer); - if(isValidType(pCap->ItemType)) - { - switch(m_unGetType) - { - case TWON_ONEVALUE: - { - m_listStrs.clear(); - m_listStrs.push_back(getValue((char*)&(pCap->Item))); - m_nCurrent = 0; - } - break; - case TWON_ENUMERATION: - { - int nVal = -1; - - if( (nVal = getIndexForValue(getValue((char*)&(pCap->Item)))) >= 0 ) - { - m_nCurrent = nVal; - } - else - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - } - break; - //case TWON_ARRAY: - //break; - //case TWON_RANGE: - //break; - default: - twrc = TWRC_FAILURE; - Condition = TWCC_CAPBADOPERATION; - break; - } - } - else // NOT isValidType(pCap->ItemType)) - { - twrc = TWRC_FAILURE; - Condition = TWCC_CAPBADOPERATION; - } - _DSM_UnlockMemory(_pCap->hContainer); - } - else if(TWON_ENUMERATION == _pCap->ConType) - { - pTW_ENUMERATION pCap = (pTW_ENUMERATION)_DSM_LockMemory(_pCap->hContainer); - - if(isValidType(pCap->ItemType)) - { - int nNewCurrentIndex = pCap->CurrentIndex; - StringVector::iterator iter; - bool bListCleared = false; // We only want to crear the current list if we are passed - // valid data, and only clear it once through the loop of testing - - for(TW_UINT32 x = 0; x < pCap->NumItems; ++x) - { - // only set the value if it exists in m_listStrsDefault - string strValue = getValue((char*)&(pCap->ItemList)+x*m_unItemSize); - - iter = find(m_listStrsDefault.begin(), m_listStrsDefault.end(), strValue); - - if(iter != m_listStrsDefault.end()) - { - // We have valid data - if(!bListCleared) - { - // only clear the list if we have not done so already - m_listStrs.clear(); - bListCleared = true; - } - - // only add it if it was not added already - iter = find(m_listStrs.begin(), m_listStrs.end(), strValue); - if(iter == m_listStrs.end()) - { - m_listStrs.push_back(strValue); - } - else - { - // if the index is below the current then we need to adjust what is going to be current - if(x < pCap->CurrentIndex) - { - nNewCurrentIndex--; - } - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - else - { - // if the index is below the current then we need to adjust what is going to be current - if(x < pCap->CurrentIndex) - { - nNewCurrentIndex--; - } - - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - - // If the list has been cleared then there was at at least some valid data - if(bListCleared) - { - if(nNewCurrentIndex >= 0 && nNewCurrentIndex < (int)(m_listStrs.size())) - { - m_nCurrent = nNewCurrentIndex; - } - else - { - // the new current index is not in range - m_nCurrent = 0; - twrc = TWRC_CHECKSTATUS; - Condition = TWCC_BADVALUE; - } - } - else - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - } - else // NOT isValidType(pCap->ItemType)) - { - twrc = TWRC_FAILURE; - Condition = TWCC_CAPBADOPERATION; - } - - _DSM_UnlockMemory(_pCap->hContainer); - } - else //bad container type - { - twrc = TWRC_FAILURE; - Condition = TWCC_BADVALUE; - } - - return twrc; -} - -bool CTWAINContainerString::Reset() -{ - m_nCurrent = m_nDefault; - - m_listStrs.clear(); - - const int nSize = (int)(m_listStrsDefault.size()); - - for(int x = 0; x < nSize; ++x) - { - m_listStrs.push_back(m_listStrsDefault[x]); - } - - return true; -} - -// For int vals -bool CTWAINContainerString::GetCurrent(string &_strVal) -{ - bool bret = false; - - if(!(m_nMSG_QUERYSUPPORT & TWQC_GETCURRENT)) - { - return false; - } - - if((m_nCurrent >= 0) && ((int)(m_listStrs.size()) > m_nCurrent)) - { - _strVal = m_listStrs[m_nCurrent]; - bret = true; - } - - return bret; -} - -bool CTWAINContainerString::GetDefault(string &_strVal) -{ - bool bret = false; - - if(!(m_nMSG_QUERYSUPPORT & TWQC_GETDEFAULT)) - { - return TWRC_FAILURE; - } - - if((m_nDefault >= 0) && ((int)(m_listStrsDefault.size()) > m_nDefault)) - { - _strVal = m_listStrsDefault[m_nDefault]; - bret = true; - } - - return bret; -} - -const StringVector &CTWAINContainerString::GetSupported() -{ - return m_listStrs; -} - -bool CTWAINContainerString::Add(string _strAdd, bool _bDefault /*= false*/) -{ - m_listStrs.push_back(_strAdd); - m_listStrsDefault.push_back(_strAdd); - if(m_nDefault == -1 || _bDefault) - { - m_nCurrent = m_nDefault = m_listStrsDefault.size()-1; - } - return true; -} - -bool CTWAINContainerString::SetCurrent(string _strCurr) -{ - if(TWON_ONEVALUE == m_unGetType)//check before call - { - m_listStrs.clear(); - m_listStrs.push_back(_strCurr); - m_nCurrent = 0; - } - else - { - int nIdx = getIndexForValue(_strCurr); - if(nIdx < 0) - { - return false; - } - - m_nCurrent = nIdx; - } - return true; -} - -int CTWAINContainerString::getIndexForValue(const string _strVal) -{ - int ret = -1; - - const int nSize = (int)(m_listStrs.size()); - - for(int x = 0; x < nSize; ++x) - { - if(_strVal == m_listStrs[x]) - { - ret = x; - break; - } - } - - return ret; -} diff --git a/TWAINContainerString.h b/TWAINContainerString.h deleted file mode 100644 index 9daf475..0000000 --- a/TWAINContainerString.h +++ /dev/null @@ -1,152 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAINContainerString.h -* String Container class for negotiating capabilities. -* @author TWAIN Working Group -* @date April 2007 -*/ - - -#ifndef __CTWAINContainerString_H__ -#define __CTWAINContainerString_H__ - -#include "TWAINContainer.h" - - -/** -* This class can be used for any Integer based TWAIN container. -* All values are stored internally as 1/1000th of an inch. They are converted -* as necessary when TWAIN containers are created. Any direct access will require -* the caller to do their own conversion. -*/ -class CTWAINContainerString : public CTWAINContainer -{ - friend class CTWAIN_UI; -public: - /** - * Constructor. - * @param[in] _unCapID Capability ID - * @param[in] _unItemType TWAIN Type TWTY_xxxx being stored. - * @param[in] _unGetType TWON_xxxx container - * @param[in] _nSupportedQueries the supported querie types TWQC_xxxx - */ - CTWAINContainerString(const TW_UINT16 _unCapID, - const TW_UINT16 _unItemType, - const TW_UINT16 _unGetType, - const TW_INT32 _nSupportedQueries = TWQC_ALL, - const TW_UINT16 _unGetCurrentType = TWON_ONEVALUE, - const TW_UINT16 _unGetDefaultType = TWON_ONEVALUE); - virtual ~CTWAINContainerString(); - - virtual TW_HANDLE GetContainer(const TW_UINT16 _unMsg); - virtual TW_INT16 Set(pTW_CAPABILITY _pCap, TW_INT16 &Condition); - virtual bool Reset(); - - /** - * Try to add a value for container. The first value added to a capabiltiy is set as the default and current value. - * @param[in] _nAdd the value to be added. - * @param[in] _bDefault if true explisitly sets this value to be the default and current. - * @return true if success. - */ - bool Add(string _strAdd, bool _bDefault = false); - - /** - * Try to set the current value for container. - * The value must already be part of the container. - * @param[in] _nCurr the value to be set as current. - * @return true if success. - */ - bool SetCurrent(string _strCurr); - - /** - * Return the default value through _nVal if set. - * @param[out] _nVal set the default value on return. - * @return true if success. - */ - bool GetDefault(string &_strVal); - - /** - * Return the current value through _nVal if set. - * @param[out] _nVal set the current value on return. - * @return true if success. - */ - bool GetCurrent(string &_strVal); - - /** - * Return a vector of supported values. - * @return supported values. - */ - const StringVector &GetSupported(); - - /** - * Return the current value from the container. - * @param[in] _pVal pointer to TW_ONEVALUE container of - * @return the value converted to int. - */ - string getValue(const char* _pchVal); - - /** - * Return the weather or not the value is supported by this capability. - * @param[in] _nVal the value to check to see if it is supported - * @return true is the _nVal is supported. - */ - bool isValueSupported(const string _strVal) {return -1 != getIndexForValue(_strVal);} - - /** - * Return the index in vector list for value. - * @param[in] _flVal value to search for. - * @return the index of value, or -1 if does not exist. - */ - int getIndexForValue(const string _strVal); - -protected: - /** - * Check to see if type is valid. - * @param[in] _unTWType type to check - * @return true if valid - */ - bool isValidType(const TW_UINT16 _unTWType); - - /** - * This is a utility function used to help create the TWAIN container. - * @param[in] _pItemList container to fill up. - * @param[in] _unNumItems number of fields to fill in. - */ - void fillValues(void* _pItemList, const TW_UINT32 _unNumItems); - - StringVector m_listStrs; /**< vector of valid container values. */ - StringVector m_listStrsDefault; /**< vector of valid container default values. */ - unsigned int m_unItemSize; /**< Size of single item */ -}; - -#endif // __CTWAINContainerString_H__ diff --git a/TWAIN_UI.cpp b/TWAIN_UI.cpp deleted file mode 100644 index 5f237e7..0000000 --- a/TWAIN_UI.cpp +++ /dev/null @@ -1,680 +0,0 @@ -/*************************************************************************** -* Copyright 锟 2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file CTWAINDS_FreeImage.cpp -* The main Data Source class. -* This class is derived from the Base class describing a TWAIN DS. -* @author TWAIN Working Group -* @date April 2007 -*/ -#include "stdafx.h" -#include "CommonDS.h" -#include "CTWAINDS_FreeImage.h" -#include "TWAIN_UI.h" -#include - -#ifdef TWH_CMP_GNU - #include - #include - #include - #include - #include - #define MAX_PATH 1024 -#elif defined(TWNDS_OS_WIN) - #include -#else - -#endif - -#include "MFC_UI.h" - - -/*++ nick -*/ -CTWAIN_UI* CreateUI(CTWAINDS_FreeImage *pDS) -{ - return new MFC_UI(pDS); -} - -void DestroyUI(CTWAIN_UI* pUI) -{ - if (pUI) - { - delete pUI; - } -} - -CTWAIN_UI::CTWAIN_UI(CTWAINDS_FreeImage *pDS) -{ - m_pDS = pDS; - m_bScanning=false; - memset(&m_EnableDSdata,0,sizeof(TW_USERINTERFACE)); - m_strProfilesDirectory==""; - - char strProfilesPath[MAX_PATH]; - char strOldPath[MAX_PATH]; -#ifdef TWH_CMP_GNU - getcwd(strOldPath,MAX_PATH); - - strcpy(strProfilesPath , getenv ("HOME")); -#elif defined(TWNDS_OS_WIN) - GetCurrentDirectory(MAX_PATH, strOldPath); - // get temp Application data directory for all users - if(!SHGetSpecialFolderPath(NULL, strProfilesPath, CSIDL_COMMON_APPDATA|CSIDL_FLAG_CREATE, TRUE)) - { - return; - } -#else - -#endif - - if(strProfilesPath[strlen(strProfilesPath)-1] != '/') - { - //SSTRCAT(strProfilesPath, MAX_PATH, "\\"); - strcat(strProfilesPath, "/"); - } - - SSTRCAT(strProfilesPath, MAX_PATH, PROFILELOCATION); - if(strProfilesPath[strlen(strProfilesPath)-1] != '/') - { - SSTRCAT(strProfilesPath, MAX_PATH, "/"); - } - SSTRCAT(strProfilesPath, MAX_PATH, kCUSTOMDSGUI); - if(strProfilesPath[strlen(strProfilesPath)-1] != '/') - { - SSTRCAT(strProfilesPath, MAX_PATH, "/"); - } - - // Set current directory to profiles directory -#ifdef TWH_CMP_GNU - if(chdir(strProfilesPath)) -#elif defined(TWNDS_OS_WIN) - if(!SetCurrentDirectory(strProfilesPath)) -#else - -#endif - { - char szPath[MAX_PATH]; - char szTempPath[MAX_PATH]; - char *pPath; - char *pSeparator; - - SSTRCPY(szPath, MAX_PATH, strProfilesPath); - pPath = szPath; - // creates profiles path if it is needed - while( pSeparator = strchr(pPath, '/') ) - { - *pSeparator = '\0'; - SSTRCPY(szTempPath, MAX_PATH, pPath); - SSTRCAT(szTempPath, MAX_PATH, "/"); - -#ifdef TWH_CMP_GNU - if(chdir(szTempPath)) -#elif defined(TWNDS_OS_WIN) - if(!SetCurrentDirectory(szTempPath)) -#else - -#endif - { -#ifdef TWH_CMP_GNU - if(mkdir(szTempPath,S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH)) -#elif defined(TWNDS_OS_WIN) - if( !CreateDirectory(szTempPath, NULL) ) -#else - -#endif - { - return; - } -#ifdef TWH_CMP_GNU - chmod(szTempPath,S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH); - if(chdir(szTempPath)) -#elif defined(TWNDS_OS_WIN) - if(!SetCurrentDirectory(szTempPath)) -#else - -#endif - { - return; - } - } - pPath = pSeparator+1; - } - } - - m_strProfilesDirectory = strProfilesPath; - -#ifdef TWH_CMP_GNU - chdir(strOldPath); -#elif defined(TWNDS_OS_WIN) - SetCurrentDirectory(strOldPath); -#else - -#endif -} - -TW_INT16 CTWAIN_UI::DisplayTWAINGUI(TW_USERINTERFACE Data, bool bSetup, bool bIndicators) -{ - m_bIndicators = bIndicators; - m_bSetup = bSetup; - m_EnableDSdata = Data; - m_bScanning =(Data.ShowUI==0); - return 0; -} -void CTWAIN_UI::DestroyTWAINGUI() -{ - m_bScanning=false; - memset(&m_EnableDSdata,0,sizeof(TW_USERINTERFACE)); - -} -void CTWAIN_UI::UpdateProgress(bool bShow, unsigned char ucProgress, unsigned int unPageNo, string strProgressTitle) -{ - ; -} -void CTWAIN_UI::Scan() -{ - if(m_pDS->StartScanning()) - { - m_bScanning = m_pDS->DoXferReadyEvent(); - } -} - -void CTWAIN_UI::Cancel() -{ - m_pDS->StopScanning(); - m_pDS->DoCloseDSRequestEvent(); -} - -void CTWAIN_UI::Save() -{ - m_pDS->DoCloseDSOkEvent(); -} -unsigned int CTWAIN_UI::MessageBox(string strMessage,string strTitle, unsigned int unIconID) -{ - return 0; -} - -bool CTWAIN_UI::processEvent(pTW_EVENT _pEvent) -{ - return false; -} - -int CTWAIN_UI::GetCurrentCapIndex(const TW_UINT16 _unCap) -{ - CTWAINContainer *pfCap = m_pDS->findCapability(_unCap); - if(pfCap==NULL) - { - assert(0); - return 0;//@TODO - } - - return pfCap->m_nCurrent; -} - -TW_FRAME CTWAIN_UI::GetCurrentFrame() -{ - CTWAINContainerFrame *pfCap = (CTWAINContainerFrame *)m_pDS->findCapability(ICAP_FRAMES); - if(pfCap==NULL) - { - assert(0); - return TW_FRAME();//@TODO - } - InternalFrame frame = pfCap->m_listFrames.at(pfCap->m_nCurrent); - int unit = TWUN_PIXELS; - float Xres = 100; - float Yres = 100; - m_pDS->getCurrentUnits(unit, Xres, Yres); - return frame.AsTW_FRAME(unit, Xres, Yres); -} - -const IntVector* CTWAIN_UI::GetValidCap(const TW_UINT16 _unCap) -{ - CTWAINContainer *pfCap = m_pDS->findCapability(_unCap); - if(pfCap==NULL) - { - assert(0); - return 0;//@TODO - } - if(typeid(*pfCap) == typeid(CTWAINContainerBool)) - { - CTWAINContainerBool *pfBoolCap = (CTWAINContainerBool*)pfCap; - return &pfBoolCap->m_listBools; - } - else if(typeid(*pfCap) == typeid(CTWAINContainerInt)) - { - CTWAINContainerInt *pfIntCap = (CTWAINContainerInt*)pfCap; - return &pfIntCap->m_listInts; - } - assert(0); - return 0; -} - -const FloatVector* CTWAIN_UI::GetValidCapFloat(const TW_UINT16 _unCap) -{ - CTWAINContainer *pfCap = m_pDS->findCapability(_unCap); - if(pfCap==NULL) - { - assert(0); - return 0;//@TODO - } - if(typeid(*pfCap) == typeid(CTWAINContainerFix32)) - { - CTWAINContainerFix32 *pfFix32Cap = (CTWAINContainerFix32*)pfCap; - return &pfFix32Cap->m_listFloats; - } - assert(0); - return 0; -} - -float CTWAIN_UI::GetCapValueFloat(const TW_UINT16 _unCap) -{ - CTWAINContainer *pfCap = m_pDS->findCapability(_unCap); - if(pfCap==NULL) - { - assert(0); - return 0;//@TODO - } - - float fVal; - if(typeid(*pfCap) == typeid(CTWAINContainerFix32)) - { - CTWAINContainerFix32 *pfFix32Cap = (CTWAINContainerFix32*)pfCap; - if(pfFix32Cap->GetCurrent(fVal)) - { - return fVal; - } - } - else if(typeid(*pfCap) == typeid(CTWAINContainerFix32Range)) - { - CTWAINContainerFix32Range *pfFix32Cap = (CTWAINContainerFix32Range*)pfCap; - if(pfFix32Cap->GetCurrent(fVal)) - { - return fVal; - } - } - assert(0); - return 0; -} - -bool CTWAIN_UI::SetCurrentFrame(float fTop, float fLeft, float fBottom, float fRight) -{ - TW_CAPABILITY cap; - cap.Cap = ICAP_FRAMES; - cap.ConType = TWON_ONEVALUE; - cap.hContainer = _DSM_Alloc(sizeof(TW_ONEVALUE_FRAME)); - TW_INT16 twRC; - if(0 != cap.hContainer) - { - TW_ONEVALUE_FRAME* pCap = (TW_ONEVALUE_FRAME*)_DSM_LockMemory(cap.hContainer); - pCap->ItemType = TWTY_FRAME; - pCap->Item.Top = FloatToFIX32(fTop); - pCap->Item.Left = FloatToFIX32(fLeft); - pCap->Item.Bottom = FloatToFIX32(fBottom); - pCap->Item.Right = FloatToFIX32(fRight); - - _DSM_UnlockMemory(cap.hContainer); - twRC = m_pDS->dat_capability(MSG_SET,&cap); - _DSM_Free(cap.hContainer); - } - else - { - return false; - } - - m_pDS->setConditionCode(TWCC_SUCCESS); // clear condition code - if(twRC==TWRC_SUCCESS || (twRC==TWRC_CHECKSTATUS)) - { - return true; - } - - return false; -} - -bool CTWAIN_UI::GetCapRangeFloat(const TW_UINT16 _unCap, float &fMin, float &fMax, float &fStep) -{ - CTWAINContainer *pfCap = m_pDS->findCapability(_unCap); - if(pfCap==NULL) - { - return false; - } - if(typeid(*pfCap) == typeid(CTWAINContainerFix32Range)) - { - CTWAINContainerFix32Range *pfFloatCap = (CTWAINContainerFix32Range*)pfCap; - pfFloatCap->GetMinMaxStep(fMin, fMax, fStep); - return true; - } - return false; -} - -bool CTWAIN_UI::SetCapValueFloat(const TW_UINT16 _unCap, float fVal) -{ - TW_CAPABILITY cap; - cap.Cap = _unCap; - cap.ConType = TWON_ONEVALUE; - cap.hContainer = _DSM_Alloc(sizeof(TW_FRAME)); - TW_INT16 twRC; - if(0 != cap.hContainer) - { - TW_ONEVALUE_FIX32* pCap = (TW_ONEVALUE_FIX32*)_DSM_LockMemory(cap.hContainer); - pCap->ItemType = TWTY_FIX32; - pCap->Item = FloatToFIX32(fVal); - _DSM_UnlockMemory(cap.hContainer); - twRC = m_pDS->dat_capability(MSG_SET,&cap); - _DSM_Free(cap.hContainer); - } - else - { - return false; - } - - m_pDS->setConditionCode(TWCC_SUCCESS); // clear condition code - if(twRC==TWRC_SUCCESS || (twRC==TWRC_CHECKSTATUS)) - { - return true; - } - - return false; -} - -bool CTWAIN_UI::SetCapValueInt(const TW_UINT16 _unCap, int nVal) -{ - CTWAINContainer *pCapCont = m_pDS->findCapability(_unCap); - - if(pCapCont ==0) - { - return false; - } - - TW_CAPABILITY cap; - cap.Cap = _unCap; - cap.ConType = TWON_ONEVALUE; - cap.hContainer = _DSM_Alloc(sizeof(TW_ONEVALUE)); - TW_INT16 twRC; - if(0 != cap.hContainer) - { - TW_ONEVALUE* pCap = (TW_ONEVALUE*)_DSM_LockMemory(cap.hContainer); - pCap->ItemType = pCapCont->GetItemType(); - pCap->Item = nVal; - _DSM_UnlockMemory(cap.hContainer); - twRC = m_pDS->dat_capability(MSG_SET,&cap); - _DSM_Free(cap.hContainer); - } - else - { - return false; - } - - m_pDS->setConditionCode(TWCC_SUCCESS); // clear condition code - if(twRC==TWRC_SUCCESS || (twRC==TWRC_CHECKSTATUS)) - { - return true; - } - - return false; -} - -bool CTWAIN_UI::ResetAllCaps() -{ - TW_CAPABILITY cap; - cap.Cap = CAP_SUPPORTEDCAPS; - cap.ConType = TWON_DONTCARE16; - cap.hContainer = 0; - TW_INT16 twRC; - twRC = m_pDS->dat_capability(MSG_RESETALL,&cap); - m_pDS->setConditionCode(TWCC_SUCCESS); // clear condition code - if(twRC==TWRC_SUCCESS || (twRC==TWRC_CHECKSTATUS)) - { - return true; - } - - return false; -} - -#ifdef TWH_CMP_GNU -void CTWAIN_UI::TW_GetAllProfiles(lstString& strFileNames) -{ - strFileNames.clear(); - // Set current directory to profiles directory - DIR *dir; - dirent *dirInfo; - if((dir = opendir(m_strProfilesDirectory.c_str())) == NULL) - { - return; - } - TW_CUSTOMDSDATA DSDataBackUp; - if(m_pDS->GetGustomDSData(&DSDataBackUp)!=TWRC_SUCCESS) - { - return ; - } - - while(dirInfo=readdir(dir)) - { - string strName = dirInfo->d_name; - if(strName.size()>strlen(FILEEXTENTION) && strName.substr(strName.size()-strlen(FILEEXTENTION),strlen(FILEEXTENTION))==FILEEXTENTION) - { - strName = strName.substr(0,strName.size()-strlen(FILEEXTENTION)); - try - { - // check if profile is valid - if(TW_LoadProfileFromFile(strName)) - { - strFileNames.push_back(strName); - } - } - catch(...) - { - } - - } - } - - m_pDS->SetGustomDSData(&DSDataBackUp); - - closedir(dir); -} -#elif defined(TWNDS_OS_WIN) -void CTWAIN_UI::TW_GetAllProfiles(lstString& strFileNames) -{ - char strOldPath[MAX_PATH]; - GetCurrentDirectory(MAX_PATH, strOldPath); - - strFileNames.clear(); - // Set current directory to profiles directory - if(!SetCurrentDirectory(m_strProfilesDirectory.c_str())) - { - return; - } - TW_CUSTOMDSDATA DSDataBackUp; - if(m_pDS->GetGustomDSData(&DSDataBackUp)!=TWRC_SUCCESS) - { - return ; - } - - WIN32_FIND_DATA FindFileData; - HANDLE hFind = NULL; - char szFileName[MAX_PATH]; - char *pDot; - - hFind = FindFirstFile("*"/*FILEEXTENTION*/, &FindFileData); - while(hFind != INVALID_HANDLE_VALUE) - { - SSTRCPY(szFileName, MAX_PATH, FindFileData.cFileName); - pDot = strchr(szFileName, '.'); - if(pDot) - { - *pDot = '\0'; - } - - try - { - // check if profile is valid - if(TW_LoadProfileFromFile(szFileName)) - { - strFileNames.push_back(szFileName); - } - } - catch(...) - { - } - if(!FindNextFile(hFind, &FindFileData)) - { - FindClose(hFind); - break; - } - } - - m_pDS->SetGustomDSData(&DSDataBackUp); - SetCurrentDirectory(strOldPath); -} -#else - -#endif - -bool CTWAIN_UI::TW_LoadProfileFromFile(string strFileName) -{ - TW_HANDLE hData; - strFileName = m_strProfilesDirectory+strFileName+FILEEXTENTION; - FILE *pFile = NULL; - //open file - FOPEN(pFile, strFileName.c_str(), "rb"); - if(pFile==0) - { - return false; - } - // get file size - fseek(pFile, 0, SEEK_END); - DWORD dwDataSize = (DWORD)ftell(pFile); - rewind(pFile); - bool bRes = true; - // it has to contains at least DS identity - if(dwDataSize==0) - { - fclose(pFile); - return false; - } - // allocate storage and read CustomDSdata - void * pData = NULL; - if(hData = _DSM_Alloc(dwDataSize)) - { - pData = _DSM_LockMemory(hData); - if(pData) - { - if(fread(pData, dwDataSize, 1, pFile)!=1) - { - bRes = false; - } - } - else - { - bRes = false; - } - } - else - { - bRes = false; - } - fclose(pFile); - - if(hData) - { - _DSM_UnlockMemory(hData); - if(bRes) - { - TW_CUSTOMDSDATA DSData; - DSData.hData = hData; - DSData.InfoLength = dwDataSize; - bRes = m_pDS->SetGustomDSData(&DSData)==TWRC_SUCCESS; - } - // free resource on error - _DSM_Free(hData); - } - - return bRes; -} - -bool CTWAIN_UI::TW_SaveProfileToFile(string strFileName) -{ - strFileName = m_strProfilesDirectory+strFileName+FILEEXTENTION; - - TW_CUSTOMDSDATA DSData; - if(m_pDS->GetGustomDSData(&DSData)!=TWRC_SUCCESS) - { - return false; - } - void* pData = _DSM_LockMemory(DSData.hData); - if(!pData) - { - _DSM_Free(DSData.hData); - return false; - } - - FILE *pFile = NULL; - bool bError = false; - //opens file - FOPEN(pFile, strFileName.c_str(), "wb"); - if(pFile) - { - bError = true; - //store CustomDSdata - if(fwrite(pData, DSData.InfoLength, 1, pFile)!=1) - { - bError = false; - } - fclose(pFile); - //remove file on error - if(!bError) - { - int i = remove(strFileName.c_str()); - } - } - - _DSM_UnlockMemory(DSData.hData); - _DSM_Free(DSData.hData); - - return bError; -} - -bool CTWAIN_UI::TW_DeleteProfile(string strFileName) -{ - if(!strFileName.empty())// if profile is selected - { - strFileName = m_strProfilesDirectory+strFileName+FILEEXTENTION; - - //delete file from the disk - return remove(strFileName.c_str())==0; - } - else - { - return false; - } -} - diff --git a/TWAIN_UI.h b/TWAIN_UI.h deleted file mode 100644 index d5748fb..0000000 --- a/TWAIN_UI.h +++ /dev/null @@ -1,133 +0,0 @@ -/*************************************************************************** -* Copyright 锟 2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** -* @file TWAIN_UI.h -* UI base class - framework independent -* @author TWAIN Working Group -* @date Nov 2009 -*/ -#ifndef __TWAIN_UI_H__ -#define __TWAIN_UI_H__ - -#include -//#include "UI_INI.h" - -#define FILEEXTENTION ".DSP" -#ifdef TWNDS_OS_LINUX - #define PROFILELOCATION ".TWAIN Working Group/Sample2/" -#elif defined(TWNDS_OS_WIN) - #define PROFILELOCATION "TWAIN Working Group/Sample2/" -#elif defined(TWNDS_OS_APPLE) - #define PROFILELOCATION "TWAIN Working Group/Sample2/" -#else - -#endif - -CTWAIN_UI* CreateUI(CTWAINDS_FreeImage *pDS); -void DestroyUI(CTWAIN_UI* pUI); - -typedef list lstString; - -class CTWAIN_UI -{ -public: - CTWAIN_UI(CTWAINDS_FreeImage *pDS); - ~CTWAIN_UI(){}; - /** - * Will show the TWAIN GUI - * @param[in] _pData contains info about if the UI should be shown etc. - * @return a valid TWRC_xxxx return code. - */ - virtual TW_INT16 DisplayTWAINGUI(TW_USERINTERFACE Data, bool bSetup, bool bIndicators); - - /** - * Close the user interface for TWAIN - */ - virtual void DestroyTWAINGUI(); - virtual void ShowIndicators() = 0; - virtual void DestroyIndicators() = 0; - virtual void UpdateProgress(bool bShow, unsigned char ucProgress, unsigned int unPageNo, string strProgressTitle); - virtual void Scan(); - virtual void Cancel(); - virtual void Save(); - virtual unsigned int MessageBox(string strMessage,string strTitle, unsigned int unIconID); - virtual bool processEvent(pTW_EVENT _pEvent); - int GetCurrentCapIndex(const TW_UINT16 _unCap); - const IntVector* GetValidCap(const TW_UINT16 _unCap); - const FloatVector* GetValidCapFloat(const TW_UINT16 _unCap); - TW_FRAME GetCurrentFrame(); - bool SetCurrentFrame(float fTop, float fLeft, float fBottom, float fRight); - bool GetCapRangeFloat(const TW_UINT16 _unCap, float &fMin, float &fMax, float &fStep); - float GetCapValueFloat(const TW_UINT16 _unCap); - bool SetCapValueFloat(const TW_UINT16 _unCap, float fVal); - bool SetCapValueInt(const TW_UINT16 _unCap, int nVal); - - /** - * Initialize combobox with profile names - * @param[in] pcbxProfiles a pointer to CComboBox. - * @return true on success - */ - void TW_GetAllProfiles(lstString& strFileNames); - /** - * Save CustomDSdata to file - * @param[in] strFileName a CString. Name of the file - * @param[in] hData a HGLOBAL. Handle to CustomDSdata - * @param[in] dwDataSize a hData. Size of CustomDSdata - * @return true on success - */ - bool TW_SaveProfileToFile(string strFileName); - /** - * Load CustomDSdata from file - * @param[in] strFileName a CString. Name of the file - * @param[out] hData a pointer to HGLOBAL. Handle to CustomDSdata - * @param[out] dwDataSize a pointer to hData. Size of CustomDSdata - * @return true on success - */ - bool TW_LoadProfileFromFile(string strFileName); - /** - * Delete selected profile from the disk - * @param[in] pcbxProfiles a pointer to CComboBox. - * @return true on success - */ - bool TW_DeleteProfile(string strFileName); - - bool ResetAllCaps(); - - CTWAINDS_FreeImage *m_pDS; - TW_USERINTERFACE m_EnableDSdata; - bool m_bScanning; - bool m_bSetup; - bool m_bIndicators; - string m_strProfilesDirectory; -}; - -#endif // __TWAIN_UI_H__ diff --git a/TWG-Logo.png b/TWG-Logo.png deleted file mode 100644 index 1b4d5f2..0000000 Binary files a/TWG-Logo.png and /dev/null differ diff --git a/TWG-LogoSmall.png b/TWG-LogoSmall.png deleted file mode 100644 index 2d56284..0000000 Binary files a/TWG-LogoSmall.png and /dev/null differ diff --git a/TwainString.cpp b/TwainString.cpp deleted file mode 100644 index 40560d3..0000000 --- a/TwainString.cpp +++ /dev/null @@ -1,6979 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** - * @file TwainString.cpp - * Convert TWAIN Constants to Strings - * @author JFL Peripheral Solutions Inc. - * @date Dec 2008 - */ -#include "stdafx.h" -#include "TwainString.h" - -extern TW_HANDLE _DSM_Alloc(TW_UINT32 _size); -extern void _DSM_Free(TW_HANDLE _hMemory); -extern TW_MEMREF _DSM_LockMemory(TW_HANDLE _hMemory); -extern void _DSM_UnlockMemory(TW_HANDLE _hMemory); - -/** the size of the temp buffer */ -#define TEMPBUFSIZE 1024 - -/** -* return a temp buffer from an array. Rotating through the queue. -* @return pointer to the buffer to use. -*/ -char * nextTempBuffer() -{ - static char szTempBuffer[3][TEMPBUFSIZE]; - static int nTempBuffer = 0; - - if(++nTempBuffer >= 3) - { - nTempBuffer = 0; - } - szTempBuffer[nTempBuffer][0] = '\0'; - return szTempBuffer[nTempBuffer]; -} - - -////////////////////////////////////////////////////////////////////////////// -const char* convertCAP_Item_toString(const TW_UINT16 _unCap, const TW_UINT32 _unItem, const TW_UINT16 _unType) -{ - const char* pszString = "Unknown capability"; - - switch(_unCap) - { - case CAP_ALARMS: - pszString = convertCAP_ALARMS_toString((TW_UINT16)_unItem); - break; - - case ICAP_AUTOSIZE: - pszString = convertICAP_AUTOSIZE_toString((TW_UINT16)_unItem); - break; - - case ICAP_COMPRESSION: - pszString = convertICAP_COMPRESSION_toString((TW_UINT16)_unItem); - break; - - case ICAP_BARCODESEARCHMODE: - pszString = convertICAP_BARCODESEARCHMODE_toString((TW_UINT16)_unItem); - break; - - case ICAP_BITORDER: - pszString = convertICAP_BITORDER_toString((TW_UINT16)_unItem); - break; - - case ICAP_AUTODISCARDBLANKPAGES: - pszString = convertICAP_AUTODISCARDBLANKPAGES_toString((TW_UINT16)_unItem); - break; - - case ICAP_BITDEPTH: - { - char *buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%u", _unItem); - pszString = buff; - } - break; - - case ICAP_BITDEPTHREDUCTION: - pszString = convertICAP_BITDEPTHREDUCTION_toString((TW_UINT16)_unItem); - break; - - case ICAP_SUPPORTEDBARCODETYPES: - pszString = convertICAP_SUPPORTEDBARCODETYPES_toString((TW_UINT16)_unItem); - break; - - case CAP_CAMERASIDE: - pszString = convertCAP_CAMERASIDE_toString((TW_UINT16)_unItem); - break; - - case CAP_CLEARBUFFERS: - pszString = convertCAP_CLEARBUFFERS_toString((TW_UINT16)_unItem); - break; - - case CAP_DEVICEEVENT: - pszString = convertCAP_DEVICEEVENT_toString((TW_UINT16)_unItem); - break; - - case CAP_DUPLEX: - pszString = convertCAP_DUPLEX_toString((TW_UINT16)_unItem); - break; - - case CAP_EXTENDEDCAPS: - pszString = convertCAP_toString((TW_UINT16)_unItem); - break; - - case CAP_FEEDERALIGNMENT: - pszString = convertCAP_FEEDERALIGNMENT_toString((TW_UINT16)_unItem); - break; - - case ICAP_FEEDERTYPE: - pszString = convertICAP_FEEDERTYPE_toString((TW_UINT16)_unItem); - break; - - case ICAP_IMAGEFILEFORMAT: - pszString = convertICAP_IMAGEFILEFORMAT_toString((TW_UINT16)_unItem); - break; - - case ICAP_FLASHUSED2: - pszString = convertICAP_FLASHUSED2_toString((TW_UINT16)_unItem); - break; - - case CAP_FEEDERORDER: - pszString = convertCAP_FEEDERORDER_toString((TW_UINT16)_unItem); - break; - - case CAP_FEEDERPOCKET: - pszString = convertCAP_FEEDERPOCKET_toString((TW_UINT16)_unItem); - break; - - case ICAP_FLIPROTATION: - pszString = convertICAP_FLIPROTATION_toString((TW_UINT16)_unItem); - break; - - case ICAP_FILTER: - pszString = convertICAP_FILTER_toString((TW_UINT16)_unItem); - break; - - case ICAP_ICCPROFILE: - pszString = convertICAP_ICCPROFILE_toString((TW_UINT16)_unItem); - break; - - case ICAP_IMAGEFILTER: - pszString = convertICAP_IMAGEFILTER_toString((TW_UINT16)_unItem); - break; - - case ICAP_IMAGEMERGE: - pszString = convertICAP_IMAGEMERGE_toString((TW_UINT16)_unItem); - break; - - case CAP_JOBCONTROL: - pszString = convertCAP_JOBCONTROL_toString((TW_UINT16)_unItem); - break; - - case ICAP_JPEGQUALITY: - pszString = convertICAP_JPEGQUALITY_toString((TW_UINT16)_unItem); - break; - - case ICAP_LIGHTPATH: - pszString = convertICAP_LIGHTPATH_toString((TW_UINT16)_unItem); - break; - - case ICAP_LIGHTSOURCE: - pszString = convertICAP_LIGHTSOURCE_toString((TW_UINT16)_unItem); - break; - - case ICAP_NOISEFILTER: - pszString = convertICAP_NOISEFILTER_toString((TW_UINT16)_unItem); - break; - - case ICAP_ORIENTATION: - pszString = convertICAP_ORIENTATION_toString((TW_UINT16)_unItem); - break; - - case ICAP_OVERSCAN: - pszString = convertICAP_OVERSCAN_toString((TW_UINT16)_unItem); - break; - - case ICAP_PLANARCHUNKY: - pszString = convertICAP_PLANARCHUNKY_toString((TW_UINT16)_unItem); - break; - - case ICAP_PIXELFLAVOR: - pszString = convertICAP_PIXELFLAVOR_toString((TW_UINT16)_unItem); - break; - - case CAP_PRINTERMODE: - pszString = convertCAP_PRINTERMODE_toString((TW_UINT16)_unItem); - break; - - case CAP_PRINTER: - pszString = convertCAP_PRINTER_toString((TW_UINT16)_unItem); - break; - - case CAP_POWERSUPPLY: - pszString = convertCAP_POWERSUPPLY_toString((TW_UINT16)_unItem); - break; - - case ICAP_PIXELTYPE: - pszString = convertICAP_PIXELTYPE_toString((TW_UINT16)_unItem); - break; - - case CAP_SEGMENTED: - pszString = convertCAP_SEGMENTED_toString((TW_UINT16)_unItem); - break; - - case ICAP_SUPPORTEDEXTIMAGEINFO: - pszString = convertExtImageInfoName_toString((TW_UINT16)_unItem); - break; - - case ICAP_SUPPORTEDSIZES: - pszString = convertICAP_SUPPORTEDSIZES_toString((TW_UINT16)_unItem); - break; - - case ICAP_XFERMECH: - pszString = convertICAP_XFERMECH_toString((TW_UINT16)_unItem); - break; - - case ICAP_UNITS: - pszString = convertICAP_UNITS_toString((TW_UINT16)_unItem); - break; - - default: - { - char *buff = nextTempBuffer(); - switch(_unType) - { - case TWTY_UINT8: - case TWTY_UINT16: - case TWTY_UINT32: - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%u [0x%x]", _unItem, _unItem); - break; - - case TWTY_INT8: - case TWTY_INT16: - case TWTY_INT32: - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%d", _unItem); - break; - - case TWTY_BOOL: - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%s", (TW_BOOL)_unItem? "True" : "False"); - break; - } - pszString = buff; - } - break; - } - - return pszString; -} - -////////////////////////////////////////////////////////////////////////////// -const char* convertEI_Item_toString(const TW_UINT16 _unEI, const TW_UINT32 _unItem) -{ - const char* pszString = NULL; - TW_UINT16 twItem = (TW_UINT16)_unItem; - switch(_unEI) - { - case TWEI_BARCODEROTATION: - pszString = convertTWEI_BARCODEROTATION_toString((TW_UINT16)_unItem); - break; - - case TWEI_BARCODETYPE: - pszString = CapabilityValueToString(ICAP_SUPPORTEDBARCODETYPES, TWTY_UINT16, &twItem);//convertICAP_SUPPORTEDBARCODETYPES_toString((TW_UINT16)_unItem); - break; - - case TWEI_PAGESIDE: //CAP_CAMERASIDE - pszString = CapabilityValueToString(CAP_CAMERASIDE, TWTY_UINT16, &twItem);//convertTWEI_PAGESIDE_toString((TW_UINT16)_unItem); - break; - - case TWEI_DESKEWSTATUS: - pszString = convertTWEI_DESKEWSTATUS_toString((TW_UINT16)_unItem); - break; - - case TWEI_FILESYSTEMSOURCE: - pszString = convertFileType_toString((TW_UINT16)_unItem); - break; - - case TWEI_PIXELFLAVOR: - pszString = CapabilityValueToString(ICAP_PIXELFLAVOR, TWTY_UINT16, &twItem);//convertICAP_PIXELFLAVOR_toString((TW_UINT16)_unItem); - break; - - case TWEI_MAGTYPE: - pszString = convertTWEI_MAGTYPE_toString((TW_UINT16)_unItem); - break; - - case TWEI_PATCHCODE: - pszString = convertTWEI_PATCHCODE_toString((TW_UINT16)_unItem); - break; - } - - return pszString; -} - - -////////////////////////////////////////////////////////////////////////////// -const char* convertCAP_toString(const TW_UINT16 _unCap) -{ - const char* text; - - switch(_unCap) - { - case ICAP_AUTODISCARDBLANKPAGES: - text = "ICAP_AUTODISCARDBLANKPAGES"; - break; - case CAP_CUSTOMBASE: - text = "CAP_CUSTOMBASE"; - break; - - case CAP_XFERCOUNT: - text = "CAP_XFERCOUNT"; - break; - - case ICAP_COMPRESSION: - text = "ICAP_COMPRESSION"; - break; - - case ICAP_PIXELTYPE: - text = "ICAP_PIXELTYPE"; - break; - - case ICAP_UNITS: - text = "ICAP_UNITS"; - break; - - case ICAP_XFERMECH: - text = "ICAP_XFERMECH"; - break; - - case CAP_AUTHOR: - text = "CAP_AUTHOR"; - break; - - case CAP_CAPTION: - text = "CAP_CAPTION"; - break; - - case CAP_FEEDERENABLED: - text = "CAP_FEEDERENABLED"; - break; - - case CAP_FEEDERLOADED: - text = "CAP_FEEDERLOADED"; - break; - - case CAP_TIMEDATE: - text = "CAP_TIMEDATE"; - break; - - case CAP_SUPPORTEDCAPS: - text = "CAP_SUPPORTEDCAPS"; - break; - - case CAP_EXTENDEDCAPS: - text = "CAP_EXTENDEDCAPS"; - break; - - case CAP_AUTOFEED: - text = "CAP_AUTOFEED"; - break; - - case CAP_CLEARPAGE: - text = "CAP_CLEARPAGE"; - break; - - case CAP_FEEDPAGE: - text = "CAP_FEEDPAGE"; - break; - - case CAP_REWINDPAGE: - text = "CAP_REWINDPAGE"; - break; - - case CAP_INDICATORS: - text = "CAP_INDICATORS"; - break; - - case CAP_SUPPORTEDCAPSEXT: - text = "CAP_SUPPORTEDCAPSEXT"; - break; - - case CAP_PAPERDETECTABLE: - text = "CAP_PAPERDETECTABLE"; - break; - - case CAP_UICONTROLLABLE: - text = "CAP_UICONTROLLABLE"; - break; - - case CAP_DEVICEONLINE: - text = "CAP_DEVICEONLINE"; - break; - - case CAP_AUTOSCAN: - text = "CAP_AUTOSCAN"; - break; - - case CAP_THUMBNAILSENABLED: - text = "CAP_THUMBNAILSENABLED"; - break; - - case CAP_DUPLEX: - text = "CAP_DUPLEX"; - break; - - case CAP_DUPLEXENABLED: - text = "CAP_DUPLEXENABLED"; - break; - - case CAP_ENABLEDSUIONLY: - text = "CAP_ENABLEDSUIONLY"; - break; - - case CAP_CUSTOMDSDATA: - text = "CAP_CUSTOMDSDATA"; - break; - - case CAP_ENDORSER: - text = "CAP_ENDORSER"; - break; - - case CAP_JOBCONTROL: - text = "CAP_JOBCONTROL"; - break; - - case CAP_ALARMS: - text = "CAP_ALARMS"; - break; - - case CAP_ALARMVOLUME: - text = "CAP_ALARMVOLUME"; - break; - - case CAP_AUTOMATICCAPTURE: - text = "CAP_AUTOMATICCAPTURE"; - break; - - case CAP_TIMEBEFOREFIRSTCAPTURE: - text = "CAP_TIMEBEFOREFIRSTCAPTURE"; - break; - - case CAP_TIMEBETWEENCAPTURES: - text = "CAP_TIMEBETWEENCAPTURES"; - break; - - case CAP_CLEARBUFFERS: - text = "CAP_CLEARBUFFERS"; - break; - - case CAP_MAXBATCHBUFFERS: - text = "CAP_MAXBATCHBUFFERS"; - break; - - case CAP_DEVICETIMEDATE: - text = "CAP_DEVICETIMEDATE"; - break; - - case CAP_POWERSUPPLY: - text = "CAP_POWERSUPPLY"; - break; - - case CAP_CAMERAPREVIEWUI: - text = "CAP_CAMERAPREVIEWUI"; - break; - - case CAP_DEVICEEVENT: - text = "CAP_DEVICEEVENT"; - break; - - case CAP_SERIALNUMBER: - text = "CAP_SERIALNUMBER"; - break; - - case CAP_PRINTER: - text = "CAP_PRINTER"; - break; - - case CAP_PRINTERENABLED: - text = "CAP_PRINTERENABLED"; - break; - - case CAP_PRINTERINDEX: - text = "CAP_PRINTERINDEX"; - break; - - case CAP_PRINTERMODE: - text = "CAP_PRINTERMODE"; - break; - - case CAP_PRINTERSTRING: - text = "CAP_PRINTERSTRING"; - break; - - case CAP_PRINTERSUFFIX: - text = "CAP_PRINTERSUFFIX"; - break; - - case CAP_LANGUAGE: - text = "CAP_LANGUAGE"; - break; - - case CAP_FEEDERALIGNMENT: - text = "CAP_FEEDERALIGNMENT"; - break; - - case CAP_FEEDERORDER: - text = "CAP_FEEDERORDER"; - break; - - case CAP_REACQUIREALLOWED: - text = "CAP_REACQUIREALLOWED"; - break; - - case CAP_BATTERYMINUTES: - text = "CAP_BATTERYMINUTES"; - break; - - case CAP_BATTERYPERCENTAGE: - text = "CAP_BATTERYPERCENTAGE"; - break; - - case CAP_CAMERASIDE: - text = "CAP_CAMERASIDE"; - break; - - case CAP_SEGMENTED: - text = "CAP_SEGMENTED"; - break; - - case CAP_CAMERAENABLED: - text = "CAP_CAMERAENABLED"; - break; - - case CAP_CAMERAORDER: - text = "CAP_CAMERAORDER"; - break; - - case CAP_MICRENABLED: - text = "CAP_MICRENABLED"; - break; - - case CAP_FEEDERPREP: - text = "CAP_FEEDERPREP"; - break; - - case CAP_FEEDERPOCKET: - text = "CAP_FEEDERPOCKET"; - break; - - case CAP_AUTOMATICSENSEMEDIUM: - text = "CAP_AUTOMATICSENSEMEDIUM"; - break; - - case CAP_CUSTOMINTERFACEGUID: - text = "CAP_CUSTOMINTERFACEGUID"; - break; - - case ICAP_AUTOBRIGHT: - text = "ICAP_AUTOBRIGHT"; - break; - - case ICAP_BRIGHTNESS: - text = "ICAP_BRIGHTNESS"; - break; - - case ICAP_CONTRAST: - text = "ICAP_CONTRAST"; - break; - - case ICAP_CUSTHALFTONE: - text = "ICAP_CUSTHALFTONE"; - break; - - case ICAP_EXPOSURETIME: - text = "ICAP_EXPOSURETIME"; - break; - - case ICAP_FILTER: - text = "ICAP_FILTER"; - break; - - case ICAP_FLASHUSED: - text = "ICAP_FLASHUSED"; - break; - - case ICAP_GAMMA: - text = "ICAP_GAMMA"; - break; - - case ICAP_HALFTONES: - text = "ICAP_HALFTONES"; - break; - - case ICAP_HIGHLIGHT: - text = "ICAP_HIGHLIGHT"; - break; - - case ICAP_IMAGEFILEFORMAT: - text = "ICAP_IMAGEFILEFORMAT"; - break; - - case ICAP_LAMPSTATE: - text = "ICAP_LAMPSTATE"; - break; - - case ICAP_LIGHTSOURCE: - text = "ICAP_LIGHTSOURCE"; - break; - - case ICAP_ORIENTATION: - text = "ICAP_ORIENTATION"; - break; - - case ICAP_PHYSICALWIDTH: - text = "ICAP_PHYSICALWIDTH"; - break; - - case ICAP_PHYSICALHEIGHT: - text = "ICAP_PHYSICALHEIGHT"; - break; - - case ICAP_SHADOW: - text = "ICAP_SHADOW"; - break; - - case ICAP_FRAMES: - text = "ICAP_FRAMES"; - break; - - case ICAP_XNATIVERESOLUTION: - text = "ICAP_XNATIVERESOLUTION"; - break; - - case ICAP_YNATIVERESOLUTION: - text = "ICAP_YNATIVERESOLUTION"; - break; - - case ICAP_XRESOLUTION: - text = "ICAP_XRESOLUTION"; - break; - - case ICAP_YRESOLUTION: - text = "ICAP_YRESOLUTION"; - break; - - case ICAP_MAXFRAMES: - text = "ICAP_MAXFRAMES"; - break; - - case ICAP_TILES: - text = "ICAP_TILES"; - break; - - case ICAP_BITORDER: - text = "ICAP_BITORDER"; - break; - - case ICAP_CCITTKFACTOR: - text = "ICAP_CCITTKFACTOR"; - break; - - case ICAP_LIGHTPATH: - text = "ICAP_LIGHTPATH"; - break; - - case ICAP_PIXELFLAVOR: - text = "ICAP_PIXELFLAVOR"; - break; - - case ICAP_PLANARCHUNKY: - text = "ICAP_PLANARCHUNKY"; - break; - - case ICAP_ROTATION: - text = "ICAP_ROTATION"; - break; - - case ICAP_SUPPORTEDSIZES: - text = "ICAP_SUPPORTEDSIZES"; - break; - - case ICAP_THRESHOLD: - text = "ICAP_THRESHOLD"; - break; - - case ICAP_XSCALING: - text = "ICAP_XSCALING"; - break; - - case ICAP_YSCALING: - text = "ICAP_YSCALING"; - break; - - case ICAP_BITORDERCODES: - text = "ICAP_BITORDERCODES"; - break; - - case ICAP_PIXELFLAVORCODES: - text = "ICAP_PIXELFLAVORCODES"; - break; - - case ICAP_JPEGPIXELTYPE: - text = "ICAP_JPEGPIXELTYPE"; - break; - - case ICAP_TIMEFILL: - text = "ICAP_TIMEFILL"; - break; - - case ICAP_BITDEPTH: - text = "ICAP_BITDEPTH"; - break; - - case ICAP_BITDEPTHREDUCTION: - text = "ICAP_BITDEPTHREDUCTION"; - break; - - case ICAP_UNDEFINEDIMAGESIZE: - text = "ICAP_UNDEFINEDIMAGESIZE"; - break; - - case ICAP_IMAGEDATASET: - text = "ICAP_IMAGEDATASET"; - break; - - case ICAP_EXTIMAGEINFO: - text = "ICAP_EXTIMAGEINFO"; - break; - - case ICAP_MINIMUMHEIGHT: - text = "ICAP_MINIMUMHEIGHT"; - break; - - case ICAP_MINIMUMWIDTH: - text = "ICAP_MINIMUMWIDTH"; - break; - - case ICAP_FLIPROTATION: - text = "ICAP_FLIPROTATION"; - break; - - case ICAP_BARCODEDETECTIONENABLED: - text = "ICAP_BARCODEDETECTIONENABLED"; - break; - - case ICAP_SUPPORTEDBARCODETYPES: - text = "ICAP_SUPPORTEDBARCODETYPES"; - break; - - case ICAP_BARCODEMAXSEARCHPRIORITIES: - text = "ICAP_BARCODEMAXSEARCHPRIORITIES"; - break; - - case ICAP_BARCODESEARCHPRIORITIES: - text = "ICAP_BARCODESEARCHPRIORITIES"; - break; - - case ICAP_BARCODESEARCHMODE: - text = "ICAP_BARCODESEARCHMODE"; - break; - - case ICAP_BARCODEMAXRETRIES: - text = "ICAP_BARCODEMAXRETRIES"; - break; - - case ICAP_BARCODETIMEOUT: - text = "ICAP_BARCODETIMEOUT"; - break; - - case ICAP_ZOOMFACTOR: - text = "ICAP_ZOOMFACTOR"; - break; - - case ICAP_PATCHCODEDETECTIONENABLED: - text = "ICAP_PATCHCODEDETECTIONENABLED"; - break; - - case ICAP_SUPPORTEDPATCHCODETYPES: - text = "ICAP_SUPPORTEDPATCHCODETYPES"; - break; - - case ICAP_PATCHCODEMAXSEARCHPRIORITIES: - text = "ICAP_PATCHCODEMAXSEARCHPRIORITIES"; - break; - - case ICAP_PATCHCODESEARCHPRIORITIES: - text = "ICAP_PATCHCODESEARCHPRIORITIES"; - break; - - case ICAP_PATCHCODESEARCHMODE: - text = "ICAP_PATCHCODESEARCHMODE"; - break; - - case ICAP_PATCHCODEMAXRETRIES: - text = "ICAP_PATCHCODEMAXRETRIES"; - break; - - case ICAP_PATCHCODETIMEOUT: - text = "ICAP_PATCHCODETIMEOUT"; - break; - - case ICAP_FLASHUSED2: - text = "ICAP_FLASHUSED2"; - break; - - case ICAP_IMAGEFILTER: - text = "ICAP_IMAGEFILTER"; - break; - - case ICAP_NOISEFILTER: - text = "ICAP_NOISEFILTER"; - break; - - case ICAP_OVERSCAN: - text = "ICAP_OVERSCAN"; - break; - - case ICAP_AUTOMATICBORDERDETECTION: - text = "ICAP_AUTOMATICBORDERDETECTION"; - break; - - case ICAP_AUTOMATICDESKEW: - text = "ICAP_AUTOMATICDESKEW"; - break; - - case ICAP_AUTOMATICROTATE: - text = "ICAP_AUTOMATICROTATE"; - break; - - case ICAP_JPEGQUALITY: - text = "ICAP_JPEGQUALITY"; - break; - - case ICAP_FEEDERTYPE: - text = "ICAP_FEEDERTYPE"; - break; - - case ICAP_ICCPROFILE: - text = "ICAP_ICCPROFILE"; - break; - - case ICAP_AUTOSIZE: - text = "ICAP_AUTOSIZE"; - break; - - case ICAP_AUTOMATICCROPUSESFRAME: - text = "ICAP_AUTOMATICCROPUSESFRAME"; - break; - - case ICAP_AUTOMATICLENGTHDETECTION: - text = "ICAP_AUTOMATICLENGTHDETECTION"; - break; - - case ICAP_AUTOMATICCOLORENABLED: - text = "ICAP_AUTOMATICCOLORENABLED"; - break; - - case ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE: - text = "ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE"; - break; - - case ICAP_COLORMANAGEMENTENABLED: - text = "ICAP_COLORMANAGEMENTENABLED"; - break; - - case ICAP_IMAGEMERGE: - text = "ICAP_IMAGEMERGE"; - break; - - case ICAP_IMAGEMERGEHEIGHTTHRESHOLD: - text = "ICAP_IMAGEMERGEHEIGHTTHRESHOLD"; - break; - - case ICAP_SUPPORTEDEXTIMAGEINFO: - text = "ICAP_SUPPORTEDEXTIMAGEINFO"; - break; - - case ACAP_AUDIOFILEFORMAT: - text = "ACAP_AUDIOFILEFORMAT"; - break; - - case ACAP_XFERMECH: - text = "ACAP_XFERMECH"; - break; - - default: - { - char * buff = nextTempBuffer(); - if(_unCap < CAP_CUSTOMBASE) - { - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown CAP 0x:%04X", _unCap); - } - else if (_unCap > CAP_CUSTOMBASE) - { - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Custom CAP 0x:%04X", _unCap); - } - else // == CAP_CUSTOMBASE - { - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Invalid CAP 0x:%04X", _unCap); - } - text = buff; - } - break; - } - - return text; -} - - - -////////////////////////////////////////////////////////////////////////////// -const char* convertTWTY_toString(const TW_UINT16 _unItem) -{ - const char* text; - - switch(_unItem) - { - case TWTY_INT8: - text = "TWTY_INT8"; - break; - - case TWTY_INT16: - text = "TWTY_INT16"; - break; - - case TWTY_INT32: - text = "TWTY_INT32"; - break; - - case TWTY_UINT8: - text = "TWTY_UINT8"; - break; - - case TWTY_UINT16: - text = "TWTY_UINT16"; - break; - - case TWTY_UINT32: - text = "TWTY_UINT32"; - break; - - case TWTY_BOOL: - text = "TWTY_BOOL"; - break; - - case TWTY_FIX32: - text = "TWTY_FIX32"; - break; - - case TWTY_FRAME: - text = "TWTY_FRAME"; - break; - - case TWTY_STR32: - text = "TWTY_STR32"; - break; - - case TWTY_STR64: - text = "TWTY_STR64"; - break; - - case TWTY_STR128: - text = "TWTY_STR128"; - break; - - case TWTY_STR255: - text = "TWTY_STR255"; - break; - - case TWTY_STR1024: - text = "TWTY_STR1024"; - break; - - case TWTY_UNI512: - text = "TWTY_UNI512"; - break; - - case TWTY_HANDLE: - text = "TWTY_HANDLE"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWTY 0x:%04X", _unItem); - text = buff; - } - break; - } - - return text; -} - - - -////////////////////////////////////////////////////////////////////////////// -// Convert Extended Image Info Attributes to String - -const char* convertExtImageInfoName_toString(int InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWEI_BARCODEX: - text = "TWEI_BARCODEX"; - break; - - case TWEI_BARCODEY: - text = "TWEI_BARCODEY"; - break; - - case TWEI_BARCODETEXT: - text = "TWEI_BARCODETEXT"; - break; - - case TWEI_BARCODETYPE: - text = "TWEI_BARCODETYPE"; - break; - - case TWEI_DESHADETOP: - text = "TWEI_DESHADETOP"; - break; - - case TWEI_DESHADELEFT: - text = "TWEI_DESHADELEFT"; - break; - - case TWEI_DESHADEHEIGHT: - text = "TWEI_DESHADEHEIGHT"; - break; - - case TWEI_DESHADEWIDTH: - text = "TWEI_DESHADEWIDTH"; - break; - - case TWEI_DESHADESIZE: - text = "TWEI_DESHADESIZE"; - break; - - case TWEI_SPECKLESREMOVED: - text = "TWEI_SPECKLESREMOVED"; - break; - - case TWEI_HORZLINEXCOORD: - text = "TWEI_HORZLINEXCOORD"; - break; - - case TWEI_HORZLINEYCOORD: - text = "TWEI_HORZLINEYCOORD"; - break; - - case TWEI_HORZLINELENGTH: - text = "TWEI_HORZLINELENGTH"; - break; - - case TWEI_HORZLINETHICKNESS: - text = "TWEI_HORZLINETHICKNESS"; - break; - - case TWEI_VERTLINEXCOORD: - text = "TWEI_VERTLINEXCOORD"; - break; - - case TWEI_VERTLINEYCOORD: - text = "TWEI_VERTLINEYCOORD"; - break; - - case TWEI_VERTLINELENGTH: - text = "TWEI_VERTLINELENGTH"; - break; - - case TWEI_VERTLINETHICKNESS: - text = "TWEI_VERTLINETHICKNESS"; - break; - - case TWEI_PATCHCODE: - text = "TWEI_PATCHCODE"; - break; - - case TWEI_ENDORSEDTEXT: - text = "TWEI_ENDORSEDTEXT"; - break; - - case TWEI_FORMCONFIDENCE: - text = "TWEI_FORMCONFIDENCE"; - break; - - case TWEI_FORMTEMPLATEMATCH: - text = "TWEI_FORMTEMPLATEMATCH"; - break; - - case TWEI_FORMTEMPLATEPAGEMATCH: - text = "TWEI_FORMTEMPLATEPAGEMATCH"; - break; - - case TWEI_FORMHORZDOCOFFSET: - text = "TWEI_FORMHORZDOCOFFSET"; - break; - - case TWEI_FORMVERTDOCOFFSET: - text = "TWEI_FORMVERTDOCOFFSET"; - break; - - case TWEI_BARCODECOUNT: - text = "TWEI_BARCODECOUNT"; - break; - - case TWEI_BARCODECONFIDENCE: - text = "TWEI_BARCODECONFIDENCE"; - break; - - case TWEI_BARCODEROTATION: - text = "TWEI_BARCODEROTATION"; - break; - - case TWEI_BARCODETEXTLENGTH: - text = "TWEI_BARCODETEXTLENGTH"; - break; - - case TWEI_DESHADECOUNT: - text = "TWEI_DESHADECOUNT"; - break; - - case TWEI_DESHADEBLACKCOUNTOLD: - text = "TWEI_DESHADEBLACKCOUNTOLD"; - break; - - case TWEI_DESHADEBLACKCOUNTNEW: - text = "TWEI_DESHADEBLACKCOUNTNEW"; - break; - - case TWEI_DESHADEBLACKRLMIN: - text = "TWEI_DESHADEBLACKRLMIN"; - break; - - case TWEI_DESHADEBLACKRLMAX: - text = "TWEI_DESHADEBLACKRLMAX"; - break; - - case TWEI_DESHADEWHITECOUNTOLD: - text = "TWEI_DESHADEWHITECOUNTOLD"; - break; - - case TWEI_DESHADEWHITECOUNTNEW: - text = "TWEI_DESHADEWHITECOUNTNEW"; - break; - - case TWEI_DESHADEWHITERLMIN: - text = "TWEI_DESHADEWHITERLMIN"; - break; - - case TWEI_DESHADEWHITERLAVE: - text = "TWEI_DESHADEWHITERLAVE"; - break; - - case TWEI_DESHADEWHITERLMAX: - text = "TWEI_DESHADEWHITERLMAX"; - break; - - case TWEI_BLACKSPECKLESREMOVED: - text = "TWEI_BLACKSPECKLESREMOVED"; - break; - - case TWEI_WHITESPECKLESREMOVED: - text = "TWEI_WHITESPECKLESREMOVED"; - break; - - case TWEI_HORZLINECOUNT: - text = "TWEI_HORZLINECOUNT"; - break; - - case TWEI_VERTLINECOUNT: - text = "TWEI_VERTLINECOUNT"; - break; - - case TWEI_DESKEWSTATUS: - text = "TWEI_DESKEWSTATUS"; - break; - - case TWEI_SKEWORIGINALANGLE: - text = "TWEI_SKEWORIGINALANGLE"; - break; - - case TWEI_SKEWFINALANGLE: - text = "TWEI_SKEWFINALANGLE"; - break; - - case TWEI_SKEWCONFIDENCE: - text = "TWEI_SKEWCONFIDENCE"; - break; - - case TWEI_SKEWWINDOWX1: - text = "TWEI_SKEWWINDOWX1"; - break; - - case TWEI_SKEWWINDOWY1: - text = "TWEI_SKEWWINDOWY1"; - break; - - case TWEI_SKEWWINDOWX2: - text = "TWEI_SKEWWINDOWX2"; - break; - - case TWEI_SKEWWINDOWY2: - text = "TWEI_SKEWWINDOWY2"; - break; - - case TWEI_SKEWWINDOWX3: - text = "TWEI_SKEWWINDOWX3"; - break; - - case TWEI_SKEWWINDOWY3: - text = "TWEI_SKEWWINDOWY3"; - break; - - case TWEI_SKEWWINDOWX4: - text = "TWEI_SKEWWINDOWX4"; - break; - - case TWEI_SKEWWINDOWY4: - text = "TWEI_SKEWWINDOWY4"; - break; - - case TWEI_BOOKNAME: - text = "TWEI_BOOKNAME"; - break; - - case TWEI_CHAPTERNUMBER: - text = "TWEI_CHAPTERNUMBER"; - break; - - case TWEI_DOCUMENTNUMBER: - text = "TWEI_DOCUMENTNUMBER"; - break; - - case TWEI_PAGENUMBER: - text = "TWEI_PAGENUMBER"; - break; - - case TWEI_CAMERA: - text = "TWEI_CAMERA"; - break; - - case TWEI_FRAMENUMBER: - text = "TWEI_FRAMENUMBER"; - break; - - case TWEI_FRAME: - text = "TWEI_FRAME"; - break; - - case TWEI_PIXELFLAVOR: - text = "TWEI_PIXELFLAVOR"; - break; - - case TWEI_PAGESIDE: - text = "TWEI_PAGESIDE"; - break; - - case TWEI_MAGDATA: - text = "TWEI_MAGDATA"; - break; - - case TWEI_MAGTYPE: - text = "TWEI_MAGTYPE"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "ExtImageInfo ID 0x:%04X",InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_ALARMS values to String -const char* convertCAP_ALARMS_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWAL_ALARM: - text = "Alarm"; - break; - - case TWAL_FEEDERERROR: - text = "Feeder Error"; - break; - - case TWAL_FEEDERWARNING: - text = "Feeder Warning"; - break; - - case TWAL_BARCODE: - text = "Barcode"; - break; - - case TWAL_DOUBLEFEED: - text = "Double Feed"; - break; - - case TWAL_JAM: - text = "Paper Jam"; - break; - - case TWAL_PATCHCODE: - text = "Patch Code"; - break; - - case TWAL_POWER: - text = "Power"; - break; - - case TWAL_SKEW: - text = "Skew"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWAL 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_AUTOSIZE values to String -const char* convertICAP_AUTOSIZE_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWAS_NONE: - text = "None"; - break; - - case TWAS_AUTO: - text = "Auto"; - break; - - case TWAS_CURRENT: - text = "Current"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWAS 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert TWEI_BARCODEROTATION values to String -const char* convertTWEI_BARCODEROTATION_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWBCOR_ROT0: - text = "TWBCOR_ROT0"; - break; - - case TWBCOR_ROT90: - text = "TWBCOR_ROT90"; - break; - - case TWBCOR_ROT180: - text = "TWBCOR_ROT180"; - break; - - case TWBCOR_ROT270: - text = "TWBCOR_ROT270"; - break; - - case TWBCOR_ROTX: - text = "TWBCOR_ROTX"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWBCOR 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_BARCODESEARCHMODE values to String -const char* convertICAP_BARCODESEARCHMODE_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWBD_HORZ: - text = "Horizontal"; - break; - - case TWBD_VERT: - text = "Vertical"; - break; - - case TWBD_HORZVERT: - text = "Horz Vert"; - break; - - case TWBD_VERTHORZ: - text = "Vert Horz"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWBD 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_BITORDER values to String -const char* convertICAP_BITORDER_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWBO_LSBFIRST: - text = "LSB first"; - break; - - case TWBO_MSBFIRST: - text = "MSB first"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWBO 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_AUTODISCARDBLANKPAGES values to String -const char* convertICAP_AUTODISCARDBLANKPAGES_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWBP_DISABLE: - text = "Disable"; - break; - - case TWBP_AUTO: - text = "Auto"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWBP 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_BITDEPTHREDUCTION values to String -const char* convertICAP_BITDEPTHREDUCTION_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWBR_THRESHOLD: - text = "Threshold"; - break; - - case TWBR_HALFTONE: - text = "Halftone"; - break; - - case TWBR_CUSTHALFTONE: - text = "Custom Halftone"; - break; - - case TWBR_DIFFUSION: - text = "Diffusion"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWBR 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_SUPPORTEDBARCODETYPES and TWEI_BARCODETYPE values to String -const char* convertICAP_SUPPORTEDBARCODETYPES_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWBT_3OF9: - text = "3of9"; - break; - - case TWBT_2OF5INTERLEAVED: - text = "2of5 interleaved"; - break; - - case TWBT_2OF5NONINTERLEAVED: - text = "2of5 noninterleaved"; - break; - - case TWBT_CODE93: - text = "code93"; - break; - - case TWBT_CODE128: - text = "code128"; - break; - - case TWBT_UCC128: - text = "UCC128"; - break; - - case TWBT_CODABAR: - text = "Codebar"; - break; - - case TWBT_UPCA: - text = "UPCA"; - break; - - case TWBT_UPCE: - text = "UPCE"; - break; - - case TWBT_EAN8: - text = "EAN8"; - break; - - case TWBT_EAN13: - text = "EAN13"; - break; - - case TWBT_POSTNET: - text = "POSTNET"; - break; - - case TWBT_PDF417: - text = "PDF417"; - break; - - case TWBT_2OF5INDUSTRIAL: - text = "2of5 industrial"; - break; - - case TWBT_2OF5MATRIX: - text = "2of5 matrix"; - break; - - case TWBT_2OF5DATALOGIC: - text = "2of5 datalogic"; - break; - - case TWBT_2OF5IATA: - text = "2of5 IATA"; - break; - - case TWBT_3OF9FULLASCII: - text = "3of9 fullASCII"; - break; - - case TWBT_CODABARWITHSTARTSTOP: - text = "Codabar with start stop"; - break; - - case TWBT_MAXICODE: - text = "MAXICODE"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWBT 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_COMPRESSION values to String -const char* convertICAP_COMPRESSION_toString(const TW_UINT16 _unItem) -{ - const char* text; - - switch(_unItem) - { - case TWCP_NONE: - text = "None"; - break; - - case TWCP_PACKBITS: - text = "PACKBITS"; - break; - - case TWCP_GROUP31D: - text = "GROUP31D"; - break; - - case TWCP_GROUP31DEOL: - text = "GROUP31DEOL"; - break; - - case TWCP_GROUP32D: - text = "GROUP32D"; - break; - - case TWCP_GROUP4: - text = "GROUP4"; - break; - - case TWCP_JPEG: - text = "JPEG"; - break; - - case TWCP_LZW: - text = "LZW"; - break; - - case TWCP_JBIG: - text = "JBIG"; - break; - - case TWCP_PNG: - text = "PNG"; - break; - - case TWCP_RLE4: - text = "RLE4"; - break; - - case TWCP_RLE8: - text = "RLE8"; - break; - - case TWCP_BITFIELDS: - text = "BITFIELDS"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWCP 0x:%04X", _unItem); - text = buff; - } - break; - } - - return text; -} - - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_CAMERASIDE values to String -const char* convertCAP_CAMERASIDE_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWCS_BOTH: - text = "Both"; - break; - - case TWCS_TOP: - text = "Top"; - break; - - case TWCS_BOTTOM: - text = "Bottom"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWCS 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert TWEI_PAGESIDE values to String -const char* convertTWEI_PAGESIDE_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWCS_TOP: - text = "TWCS_TOP"; - break; - - case TWCS_BOTTOM: - text = "TWCS_BOTTOM"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWCS 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_CLEARBUFFERS values to String -const char* convertCAP_CLEARBUFFERS_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWCB_AUTO: - text = "Auto"; - break; - - case TWCB_CLEAR: - text = "Clear"; - break; - - case TWCB_NOCLEAR: - text = "No Clear"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWCB 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_DEVICEEVENT values to String -const char* convertCAP_DEVICEEVENT_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWDE_CUSTOMEVENTS: - text = "Custom Events"; - break; - - case TWDE_CHECKAUTOMATICCAPTURE: - text = "Check Automatic Capture"; - break; - - case TWDE_CHECKBATTERY: - text = "Check Battery"; - break; - - case TWDE_CHECKDEVICEONLINE: - text = "Check Device Online"; - break; - - case TWDE_CHECKFLASH: - text = "Check Flash"; - break; - - case TWDE_CHECKPOWERSUPPLY: - text = "Check Power Supply"; - break; - - case TWDE_CHECKRESOLUTION: - text = "Check Resolution"; - break; - - case TWDE_DEVICEADDED: - text = "Device Added"; - break; - - case TWDE_DEVICEOFFLINE: - text = "Device Offline"; - break; - - case TWDE_DEVICEREADY: - text = "Device Ready"; - break; - - case TWDE_DEVICEREMOVED: - text = "Device Removed"; - break; - - case TWDE_IMAGECAPTURED: - text = "Image Captured"; - break; - - case TWDE_IMAGEDELETED: - text = "Image Deleted"; - break; - - case TWDE_PAPERDOUBLEFEED: - text = "Paper Doublefeed"; - break; - - case TWDE_PAPERJAM: - text = "Paperjam"; - break; - - case TWDE_LAMPFAILURE: - text = "Lamp Failure"; - break; - - case TWDE_POWERSAVE: - text = "Power Save"; - break; - - case TWDE_POWERSAVENOTIFY: - text = "Power Save Notify"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWDE 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert TWEI_DESKEWSTATUS values to String -const char* convertTWEI_DESKEWSTATUS_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWDSK_SUCCESS: - text = "TWDSK_SUCCESS"; - break; - - case TWDSK_REPORTONLY: - text = "TWDSK_REPORTONLY"; - break; - - case TWDSK_FAIL: - text = "TWDSK_FAIL"; - break; - - case TWDSK_DISABLED: - text = "TWDSK_DISABLED"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWDSK 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_DUPLEX values to String -const char* convertCAP_DUPLEX_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWDX_NONE: - text = "None"; - break; - - case TWDX_1PASSDUPLEX: - text = "1 Pass Duplex"; - break; - - case TWDX_2PASSDUPLEX: - text = "2 Pass Duplex"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWDX 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_FEEDERALIGNMENT values to String -const char* convertCAP_FEEDERALIGNMENT_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWFA_NONE: - text = "None"; - break; - - case TWFA_LEFT: - text = "Left"; - break; - - case TWFA_CENTER: - text = "Center"; - break; - - case TWFA_RIGHT: - text = "Right"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWFA 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_FEEDERTYPE values to String -const char* convertICAP_FEEDERTYPE_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWFE_GENERAL: - text = "General"; - break; - - case TWFE_PHOTO: - text = "Photo"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWFE 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Cover ICAP_IMAGEFILEFORMAT values to String -const char* convertICAP_IMAGEFILEFORMAT_toString(const TW_UINT16 _unItem) -{ - const char* text; - - switch(_unItem) - { - case TWFF_TIFF: - text = "tiff"; - break; - - case TWFF_PICT: - text = "pict"; - break; - - case TWFF_BMP: - text = "bmp"; - break; - - case TWFF_XBM: - text = "xbm"; - break; - - case TWFF_JFIF: - text = "jpeg"; - break; - - case TWFF_FPX: - text = "fpx"; - break; - - case TWFF_TIFFMULTI: - text = "multi image tiff"; - break; - - case TWFF_PNG: - text = "png"; - break; - - case TWFF_SPIFF: - text = "spiff"; - break; - - case TWFF_EXIF: - text = "exif"; - break; - - case TWFF_PDF: - text = "PDF"; - break; - - case TWFF_JP2: - text = "JP2"; - break; - - case TWFF_JPN: - text = "JPN"; - break; - - case TWFF_JPX: - text = "JPX"; - break; - - case TWFF_DEJAVU: - text = "DEJAVU"; - break; - - case TWFF_PDFA: - text = "PDF-A1";/* 2.0 Adobe PDF/A, Version 1*/ - break; - - case TWFF_PDFA2: - text = "PDF-A2";/* 2.1 Adobe PDF/A, Version 2*/ - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWFF 0x:%04X", _unItem); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Cover ICAP_IMAGEFILEFORMAT values to String -const char* convertICAP_IMAGEFILEFORMAT_toExt(const TW_UINT16 _unItem) -{ - const char* text; - - switch(_unItem) - { - case TWFF_PICT: - text = ".pict"; - break; - - case TWFF_BMP: - text = ".bmp"; - break; - - case TWFF_XBM: - text = ".xbm"; - break; - - case TWFF_JFIF: - text = ".jpeg"; - break; - - case TWFF_FPX: - text = ".fpx"; - break; - - case TWFF_TIFF: - case TWFF_TIFFMULTI: - text = ".tiff"; - break; - - case TWFF_PNG: - text = ".png"; - break; - - case TWFF_SPIFF: - text = ".spiff"; - break; - - case TWFF_EXIF: - text = ".exif"; - break; - - case TWFF_JP2: - text = ".jp2"; - break; - - case TWFF_JPN: - text = ".jpn"; - break; - - case TWFF_JPX: - text = ".jpx"; - break; - - case TWFF_DEJAVU: - text = ".dejavu"; - break; - - case TWFF_PDF: - case TWFF_PDFA: - case TWFF_PDFA2: - text = ".pdf"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, ".0x:%04X", _unItem);//Unknown TWFF - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_FLASHUSED2 values to String -const char* convertICAP_FLASHUSED2_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWFL_NONE: - text = "None"; - break; - - case TWFL_OFF: - text = "Off"; - break; - - case TWFL_ON: - text = "On"; - break; - - case TWFL_AUTO: - text = "Auto"; - break; - - case TWFL_REDEYE: - text = "Redeye"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWFL 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_FEEDERORDER values to String -const char* convertCAP_FEEDERORDER_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWFO_FIRSTPAGEFIRST: - text = "First Page First"; - break; - - case TWFO_LASTPAGEFIRST: - text = "Last Page First"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWFO 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_FEEDERPOCKET values to String -const char* convertCAP_FEEDERPOCKET_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWFP_POCKETERROR: - text = "Pocket Error"; - break; - - case TWFP_POCKET1: - text = "Pocket 1"; - break; - - case TWFP_POCKET2: - text = "Pocket 2"; - break; - - case TWFP_POCKET3: - text = "Pocket 3"; - break; - - case TWFP_POCKET4: - text = "Pocket 4"; - break; - - case TWFP_POCKET5: - text = "Pocket 5"; - break; - - case TWFP_POCKET6: - text = "Pocket 6"; - break; - - case TWFP_POCKET7: - text = "Pocket 7"; - break; - - case TWFP_POCKET8: - text = "Pocket 8"; - break; - - case TWFP_POCKET9: - text = "Pocket 9"; - break; - - case TWFP_POCKET10: - text = "Pocket 10"; - break; - - case TWFP_POCKET11: - text = "Pocket 11"; - break; - - case TWFP_POCKET12: - text = "Pocket 12"; - break; - - case TWFP_POCKET13: - text = "Pocket 13"; - break; - - case TWFP_POCKET14: - text = "Pocket 14"; - break; - - case TWFP_POCKET15: - text = "Pocket 15"; - break; - - case TWFP_POCKET16: - text = "Pocket 16"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWFP 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_FLIPROTATION values to String -const char* convertICAP_FLIPROTATION_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWFR_BOOK: - text = "Book"; - break; - - case TWFR_FANFOLD: - text = "Fanfold"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWFR 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_FILTER values to String -const char* convertICAP_FILTER_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWFT_RED: - text = "Red"; - break; - - case TWFT_GREEN: - text = "Green"; - break; - - case TWFT_BLUE: - text = "Blue"; - break; - - case TWFT_NONE: - text = "None"; - break; - - case TWFT_WHITE: - text = "White"; - break; - - case TWFT_CYAN: - text = "Cyan"; - break; - - case TWFT_MAGENTA: - text = "Magenta"; - break; - - case TWFT_YELLOW: - text = "Yellow"; - break; - - case TWFT_BLACK: - text = "Black"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWFT 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert TW_FILESYSTEM values to String -const char* convertTWEI_FILESYSTEM_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWFY_CAMERA: - text = "Camera"; - break; - - case TWFY_CAMERATOP: - text = "Camera Top"; - break; - - case TWFY_CAMERABOTTOM: - text = "Camera Bottom"; - break; - - case TWFY_CAMERAPREVIEW: - text = "Camera Preview"; - break; - - case TWFY_DOMAIN: - text = "Domain"; - break; - - case TWFY_HOST: - text = "Host"; - break; - - case TWFY_DIRECTORY: - text = "Directory"; - break; - - case TWFY_IMAGE: - text = "Image"; - break; - - case TWFY_UNKNOWN: - text = "Unknown"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWFY 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_ICCPROFILE values to String -const char* convertICAP_ICCPROFILE_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWIC_NONE: - text = "None"; - break; - - case TWIC_LINK: - text = "Link"; - break; - - case TWIC_EMBED: - text = "Embed"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWIC 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_IMAGEFILTER values to String -const char* convertICAP_IMAGEFILTER_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWIF_NONE: - text = "None"; - break; - - case TWIF_AUTO: - text = "Auto"; - break; - - case TWIF_LOWPASS: - text = "Low Pass"; - break; - - case TWIF_BANDPASS: - text = "Band Pass"; - break; - - case TWIF_HIGHPASS: - text = "High Pass"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWIF 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_IMAGEMERGE values to String -const char* convertICAP_IMAGEMERGE_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWIM_NONE: - text = "None"; - break; - - case TWIM_FRONTONTOP: - text = "Front on Top"; - break; - - case TWIM_FRONTONBOTTOM: - text = "Front on Bottom"; - break; - - case TWIM_FRONTONLEFT: - text = "Front on Left"; - break; - - case TWIM_FRONTONRIGHT: - text = "Front on Right"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWIM 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_JOBCONTROL values to String -const char* convertCAP_JOBCONTROL_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWJC_NONE: - text = "None"; - break; - - case TWJC_JSIC: - text = "JSIC"; - break; - - case TWJC_JSIS: - text = "JSIS"; - break; - - case TWJC_JSXC: - text = "JSXC"; - break; - - case TWJC_JSXS: - text = "JSXS"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWJC 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_JPEGQUALITY values to String -const char* convertICAP_JPEGQUALITY_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWJQ_UNKNOWN: - text = "Unknown"; - break; - - case TWJQ_LOW: - text = "Low"; - break; - - case TWJQ_MEDIUM: - text = "Medium"; - break; - - case TWJQ_HIGH: - text = "High"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%d", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_LIGHTPATH values to String -const char* convertICAP_LIGHTPATH_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWLP_REFLECTIVE: - text = "Reflective"; - break; - - case TWLP_TRANSMISSIVE: - text = "Transmissive"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWLP 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_LIGHTSOURCE values to String -const char* convertICAP_LIGHTSOURCE_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWLS_RED: - text = "Red"; - break; - - case TWLS_GREEN: - text = "Green"; - break; - - case TWLS_BLUE: - text = "Blue"; - break; - - case TWLS_NONE: - text = "None"; - break; - - case TWLS_WHITE: - text = "White"; - break; - - case TWLS_UV: - text = "UV"; - break; - - case TWLS_IR: - text = "IR"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWLS 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert TWEI_MAGTYPE values to String -const char* convertTWEI_MAGTYPE_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWMD_MICR: - text = "TWMD_MICR"; - break; - - case TWMD_RAW: - text = "TWMD_RAW"; - break; - - case TWMD_INVALID: - text = "TWMD_INVALID"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWMD 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_NOISEFILTER values to String -const char* convertICAP_NOISEFILTER_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWNF_NONE: - text = "None"; - break; - - case TWNF_AUTO: - text = "Auto"; - break; - - case TWNF_LONEPIXEL: - text = "Low Pixel"; - break; - - case TWNF_MAJORITYRULE: - text = "Majoriry Rule"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWNF 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_ORIENTATION values to String -const char* convertICAP_ORIENTATION_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { -// case TWOR_ROT0: -// text = ""; -// break; - - case TWOR_ROT90: - text = "Orientation 90"; - break; - - case TWOR_ROT180: - text = "Orientation 180"; - break; - -// case TWOR_ROT270: -// text = ""; -// break; - - case TWOR_PORTRAIT: - text = "Portrait"; - break; - - case TWOR_LANDSCAPE: - text = "Landscape"; - break; - - case TWOR_AUTO: - text = "Auto"; - break; - - case TWOR_AUTOTEXT: - text = "Auto Text"; - break; - - case TWOR_AUTOPICTURE: - text = "Auto Picture"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWOR 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_OVERSCAN values to String -const char* convertICAP_OVERSCAN_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWOV_NONE: - text = "None"; - break; - - case TWOV_AUTO: - text = "Auto"; - break; - - case TWOV_TOPBOTTOM: - text = "Top Bottom"; - break; - - case TWOV_LEFTRIGHT: - text = "Left Right"; - break; - - case TWOV_ALL: - text = "All"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWOV 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_PLANARCHUNKY values to String -const char* convertICAP_PLANARCHUNKY_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWPC_CHUNKY: - text = "Chunky"; - break; - - case TWPC_PLANAR: - text = "Planar"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWPC 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert TWEI_PATCHCODE values to String -const char* convertTWEI_PATCHCODE_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWPCH_PATCH1: - text = "TWPCH_PATCH1"; - break; - - case TWPCH_PATCH2: - text = "TWPCH_PATCH2"; - break; - - case TWPCH_PATCH3: - text = "TWPCH_PATCH3"; - break; - - case TWPCH_PATCH4: - text = "TWPCH_PATCH4"; - break; - - case TWPCH_PATCH6: - text = "TWPCH_PATCH6"; - break; - - case TWPCH_PATCHT: - text = "TWPCH_PATCHT"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWPCH 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_PIXELFLAVOR values to String -const char* convertICAP_PIXELFLAVOR_toString(const TW_UINT16 _unItem) -{ - const char* text; - - switch(_unItem) - { - case TWPF_CHOCOLATE: - text = "Chocolate"; - break; - - case TWPF_VANILLA: - text = "Vanilla"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWPF 0x:%04X", _unItem); - text = buff; - } - break; - } - - return text; -} - - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_PRINTERMODE values to String -const char* convertCAP_PRINTERMODE_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWPM_SINGLESTRING: - text = "Single String"; - break; - - case TWPM_MULTISTRING: - text = "Multi String"; - break; - - case TWPM_COMPOUNDSTRING: - text = "Compound String"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWPM 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_PRINTER values to String -const char* convertCAP_PRINTER_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWPR_IMPRINTERTOPBEFORE: - text = "Imprinter Top Before"; - break; - - case TWPR_IMPRINTERTOPAFTER: - text = "Imprinter Top After"; - break; - - case TWPR_IMPRINTERBOTTOMBEFORE: - text = "Imprinter Bottom Before"; - break; - - case TWPR_IMPRINTERBOTTOMAFTER: - text = "Imprinter Bottom After"; - break; - - case TWPR_ENDORSERTOPBEFORE: - text = "Endorser Top Before"; - break; - - case TWPR_ENDORSERTOPAFTER: - text = "Endorser Top After"; - break; - - case TWPR_ENDORSERBOTTOMBEFORE: - text = "Endorser Bottom Before"; - break; - - case TWPR_ENDORSERBOTTOMAFTER: - text = "Endorser Bottom After"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWPR 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_POWERSUPPLY values to String -const char* convertCAP_POWERSUPPLY_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWPS_EXTERNAL: - text = "External"; - break; - - case TWPS_BATTERY: - text = "Battery"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWPS 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_PIXELTYPE values to String -const char* convertICAP_PIXELTYPE_toString(const TW_UINT16 _unItem) -{ - const char* text; - - switch(_unItem) - { - case TWPT_BW: - text = "BW"; - break; - - case TWPT_GRAY: - text = "GRAY"; - break; - - case TWPT_RGB: - text = "RGB"; - break; - - case TWPT_PALETTE: - text = "PALETTE"; - break; - - case TWPT_CMY: - text = "CMY"; - break; - - case TWPT_CMYK: - text = "CMYK"; - break; - - case TWPT_YUV: - text = "YUV"; - break; - - case TWPT_YUVK: - text = "YUVK"; - break; - - case TWPT_CIEXYZ: - text = "CIEXYZ"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWPT 0x:%04X", _unItem); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert CAP_SEGMENTED values to String -const char* convertCAP_SEGMENTED_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWSG_NONE: - text = "None"; - break; - - case TWSG_AUTO: - text = "Auto"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWSG 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Convert ICAP_SUPPORTEDSIZES values to String -const char* convertICAP_SUPPORTEDSIZES_toString(const TW_UINT16 InfoID) -{ - const char* text; - - switch(InfoID) - { - case TWSS_NONE: - text = "None"; - break; - - case TWSS_A4: - text = "A4"; - break; - - case TWSS_JISB5: - text = "JIS B5"; - break; - - case TWSS_USLETTER: - text = "US Letter"; - break; - - case TWSS_USLEGAL: - text = "US Legal"; - break; - - case TWSS_A5: - text = "A5"; - break; - - case TWSS_ISOB4: - text = "ISO B4"; - break; - - case TWSS_ISOB6: - text = "ISO B6"; - break; - - case TWSS_USLEDGER: - text = "US Ledger"; - break; - - case TWSS_USEXECUTIVE: - text = "US Executive"; - break; - - case TWSS_A3: - text = "A3"; - break; - - case TWSS_ISOB3: - text = "ISO B3"; - break; - - case TWSS_A6: - text = "A6"; - break; - - case TWSS_C4: - text = "C4"; - break; - - case TWSS_C5: - text = "C5"; - break; - - case TWSS_C6: - text = "C6"; - break; - - case TWSS_4A0: - text = "4A0"; - break; - - case TWSS_2A0: - text = "2A0"; - break; - - case TWSS_A0: - text = "A0"; - break; - - case TWSS_A1: - text = "A1"; - break; - - case TWSS_A2: - text = "A2"; - break; - - case TWSS_A7: - text = "A7"; - break; - - case TWSS_A8: - text = "A8"; - break; - - case TWSS_A9: - text = "A9"; - break; - - case TWSS_A10: - text = "A10"; - break; - - case TWSS_ISOB0: - text = "ISO B0"; - break; - - case TWSS_ISOB1: - text = "ISO B1"; - break; - - case TWSS_ISOB2: - text = "ISO B2"; - break; - - case TWSS_ISOB5: - text = "ISO B5"; - break; - - case TWSS_ISOB7: - text = "ISO B7"; - break; - - case TWSS_ISOB8: - text = "ISO B8"; - break; - - case TWSS_ISOB9: - text = "ISO B9"; - break; - - case TWSS_ISOB10: - text = "ISO B10"; - break; - - case TWSS_JISB0: - text = "JIS B0"; - break; - - case TWSS_JISB1: - text = "JIS B1"; - break; - - case TWSS_JISB2: - text = "JIS B2"; - break; - - case TWSS_JISB3: - text = "JIS B3"; - break; - - case TWSS_JISB4: - text = "JIS B4"; - break; - - case TWSS_JISB6: - text = "JIS B6"; - break; - - case TWSS_JISB7: - text = "JIS B7"; - break; - - case TWSS_JISB8: - text = "JIS B8"; - break; - - case TWSS_JISB9: - text = "JIS B9"; - break; - - case TWSS_JISB10: - text = "JIS B10"; - break; - - case TWSS_C0: - text = "C0"; - break; - - case TWSS_C1: - text = "C1"; - break; - - case TWSS_C2: - text = "C2"; - break; - - case TWSS_C3: - text = "C3"; - break; - - case TWSS_C7: - text = "C7"; - break; - - case TWSS_C8: - text = "C8"; - break; - - case TWSS_C9: - text = "C9"; - break; - - case TWSS_C10: - text = "C10"; - break; - - case TWSS_USSTATEMENT: - text = "US Statement"; - break; - - case TWSS_BUSINESSCARD: - text = "Business Card"; - break; - - case TWSS_MAXSIZE: - text = "MAX size"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWSS 0x:%04X", InfoID); - text = buff; - } - break; - } - - return text; -} - -////////////////////////////////////////////////////////////////////////////// -// Covert ICAP_XFERMECH values to String -const char* convertICAP_XFERMECH_toString(const TW_UINT16 _unItem) -{ - const char* text; - - switch(_unItem) - { - case TWSX_NATIVE: - text = "Native"; - break; - - case TWSX_FILE: - text = "File"; - break; - - case TWSX_MEMORY: - text = "Memory"; - break; - - case TWSX_MEMFILE: - text = "Memory of File"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWSX 0x:%04X", _unItem); - text = buff; - } - break; - } - - return text; -} - - -////////////////////////////////////////////////////////////////////////////// -// Covert ICAP_UNITS values to String -const char* convertICAP_UNITS_toString(const TW_UINT16 _unItem) -{ - const char* text; - - switch(_unItem) - { - case TWUN_INCHES: - text = "Inches"; - break; - - case TWUN_CENTIMETERS: - text = "Centimeters"; - break; - - case TWUN_PICAS: - text = "Picas"; - break; - - case TWUN_POINTS: - text = "Points"; - break; - - case TWUN_TWIPS: - text = "Twips"; - break; - - case TWUN_PIXELS: - text = "Pixels"; - break; - - case TWUN_MILLIMETERS: - text = "Millimeters"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unknown TWUN 0x:%04X", _unItem); - text = buff; - } - break; - } - - return text; -} - - -const char* convertExtImageInfoItem_toString(const TW_INFO &ImgInfo) -{ - char * buff = nextTempBuffer(); - - if(TWRC_SUCCESS == ImgInfo.ReturnCode) - { - switch(ImgInfo.ItemType) - { - case TWTY_INT8: - case TWTY_INT16: - case TWTY_INT32: - case TWTY_UINT8: - case TWTY_UINT32: - case TWTY_UINT16: - case TWTY_BOOL: - // If the size of the data is larger than 4 bytes (regardless of 32bit or 64bit OS) then the data - // is no longer an array of data but a handle to the data. - // If the data does fit inside then it is possible to have an array of data. - if(getTWTYsize(ImgInfo.ItemType)*ImgInfo.NumItems <= sizeof(TW_UINT32)) - { - char *pTemp = buff; - const char *pItem = NULL; - int TempSize = TEMPBUFSIZE; - - for( int nItem=0; nItemLeft), FIX32ToFloat(pFrame->Top), - FIX32ToFloat(pFrame->Right), FIX32ToFloat(pFrame->Bottom)); - - _DSM_UnlockMemory((TW_HANDLE)ImgInfo.Item); - } - break; - - default: - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unsupporetd Type 0x:%04X", ImgInfo.ItemType); - break; - } - } - else if(TWRC_INFONOTSUPPORTED == ImgInfo.CondCode) - { - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Unsupporetd"); - } - else if(TWRC_DATANOTAVAILABLE == ImgInfo.CondCode) - { - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Data Not Available"); - } - else - { - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "unknown failure %d", ImgInfo.CondCode); - } - - return buff; -} - -const char* convertReturnCode_toString(const TW_UINT16 _unItem) -{ - const char* text; - - switch(_unItem) - { - case TWRC_SUCCESS: - text = "TWRC_SUCCESS"; - break; - - case TWRC_FAILURE: - text = "TWRC_FAILURE"; - break; - - case TWRC_CHECKSTATUS: - text = "TWRC_CHECKSTATUS"; - break; - - case TWRC_CANCEL: - text = "TWRC_CANCEL"; - break; - - case TWRC_DSEVENT: - text = "TWRC_DSEVENT"; - break; - - case TWRC_NOTDSEVENT: - text = "TWRC_NOTDSEVENT"; - break; - - case TWRC_XFERDONE: - text = "TWRC_XFERDONE"; - break; - - case TWRC_ENDOFLIST: - text = "TWRC_ENDOFLIST"; - break; - - case TWRC_INFONOTSUPPORTED: - text = "TWRC_INFONOTSUPPORTED"; - break; - - case TWRC_DATANOTAVAILABLE: - text = "TWRC_DATANOTAVAILABLE"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "ReturnCode 0x:%04X",_unItem); - text = buff; - } - break; - } - - return text; -} - -const char* convertConditionCode_toString(const TW_UINT16 _unItem) -{ - const char* text; - - switch(_unItem) - { - case TWCC_SUCCESS: - text = "TWCC_SUCCESS"; - break; - - case TWCC_BUMMER: - text = "TWCC_BUMMER"; - break; - - case TWCC_LOWMEMORY: - text = "TWCC_LOWMEMORY"; - break; - - case TWCC_NODS: - text = "TWCC_NODS"; - break; - - case TWCC_MAXCONNECTIONS: - text = "TWCC_MAXCONNECTIONS"; - break; - - case TWCC_OPERATIONERROR: - text = "TWCC_OPERATIONERROR"; - break; - - case TWCC_BADCAP: - text = "TWCC_BADCAP"; - break; - - case TWCC_BADPROTOCOL: - text = "TWCC_BADPROTOCOL"; - break; - - case TWCC_BADVALUE: - text = "TWCC_BADVALUE"; - break; - - case TWCC_SEQERROR: - text = "TWCC_SEQERROR"; - break; - - case TWCC_BADDEST: - text = "TWCC_BADDEST"; - break; - - case TWCC_CAPUNSUPPORTED: - text = "TWCC_CAPUNSUPPORTED"; - break; - - case TWCC_CAPBADOPERATION: - text = "TWCC_CAPBADOPERATION"; - break; - - case TWCC_CAPSEQERROR: - text = "TWCC_CAPSEQERROR"; - break; - - case TWCC_DENIED: - text = "TWCC_DENIED"; - break; - - case TWCC_FILEEXISTS: - text = "TWCC_FILEEXISTS"; - break; - - case TWCC_FILENOTFOUND: - text = "TWCC_FILENOTFOUND"; - break; - - case TWCC_NOTEMPTY: - text = "TWCC_NOTEMPTY"; - break; - - case TWCC_PAPERJAM: - text = "TWCC_PAPERJAM"; - break; - - case TWCC_PAPERDOUBLEFEED: - text = "TWCC_PAPERDOUBLEFEED"; - break; - - case TWCC_FILEWRITEERROR: - text = "TWCC_FILEWRITEERROR"; - break; - - case TWCC_CHECKDEVICEONLINE: - text = "TWCC_CHECKDEVICEONLINE"; - break; - - case TWCC_INTERLOCK: - text = "TWCC_INTERLOCK"; - break; - - case TWCC_DAMAGEDCORNER: - text = "TWCC_DAMAGEDCORNER"; - break; - - case TWCC_FOCUSERROR: - text = "TWCC_FOCUSERROR"; - break; - - case TWCC_DOCTOOLIGHT: - text = "TWCC_DOCTOOLIGHT"; - break; - - case TWCC_DOCTOODARK: - text = "TWCC_DOCTOODARK"; - break; - - case TWCC_NOMEDIA: - text = "TWCC_NOMEDIA"; - break; - - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "ConditionCode 0x:%04X",_unItem); - text = buff; - } - break; - } - - return text; -} - -const char* convertMessage_toString(const TW_UINT16 _unItem) -{ - const char* strRet; - switch(_unItem) - { - case MSG_GET: - strRet = "MSG_GET"; - break; - case MSG_GETCURRENT: - strRet = "MSG_GETCURRENT"; - break; - case MSG_GETDEFAULT: - strRet = "MSG_GETDEFAULT"; - break; - case MSG_GETFIRST: - strRet = "MSG_GETFIRST"; - break; - case MSG_GETNEXT: - strRet = "MSG_GETNEXT"; - break; - case MSG_SET: - strRet = "MSG_SET"; - break; - case MSG_RESET: - strRet = "MSG_RESET"; - break; - case MSG_QUERYSUPPORT: - strRet = "MSG_QUERYSUPPORT"; - break; - case MSG_GETHELP: - strRet = "MSG_GETHELP"; - break; - case MSG_GETLABEL: - strRet = "MSG_GETLABEL"; - break; - case MSG_GETLABELENUM: - strRet = "MSG_GETLABELENUM"; - break; - case MSG_XFERREADY: - strRet = "MSG_XFERREADY"; - break; - case MSG_CLOSEDSREQ: - strRet = "MSG_CLOSEDSREQ"; - break; - case MSG_CLOSEDSOK: - strRet = "MSG_CLOSEDSOK"; - break; - case MSG_DEVICEEVENT: - strRet = "MSG_DEVICEEVENT"; - break; - case MSG_OPENDSM: - strRet = "MSG_OPENDSM"; - break; - case MSG_CLOSEDSM: - strRet = "MSG_CLOSEDSM"; - break; - case MSG_OPENDS: - strRet = "MSG_OPENDS"; - break; - case MSG_CLOSEDS: - strRet = "MSG_CLOSEDS"; - break; - case MSG_USERSELECT: - strRet = "MSG_USERSELECT"; - break; - case MSG_DISABLEDS: - strRet = "MSG_DISABLEDS"; - break; - case MSG_ENABLEDS: - strRet = "MSG_ENABLEDS"; - break; - case MSG_ENABLEDSUIONLY: - strRet = "MSG_ENABLEDSUIONLY"; - break; - case MSG_PROCESSEVENT: - strRet = "MSG_PROCESSEVENT"; - break; - case MSG_ENDXFER: - strRet = "MSG_ENDXFER"; - break; - case MSG_STOPFEEDER: - strRet = "MSG_STOPFEEDER"; - break; - case MSG_CHANGEDIRECTORY: - strRet = "MSG_CHANGEDIRECTORY"; - break; - case MSG_CREATEDIRECTORY: - strRet = "MSG_CREATEDIRECTORY"; - break; - case MSG_DELETE: - strRet = "MSG_DELETE"; - break; - case MSG_FORMATMEDIA: - strRet = "MSG_FORMATMEDIA"; - break; - case MSG_GETCLOSE: - strRet = "MSG_GETCLOSE"; - break; - case MSG_GETFIRSTFILE: - strRet = "MSG_GETFIRSTFILE"; - break; - case MSG_GETINFO: - strRet = "MSG_GETINFO"; - break; - case MSG_GETNEXTFILE: - strRet = "MSG_GETNEXTFILE"; - break; - case MSG_RENAME: - strRet = "MSG_RENAME"; - break; - case MSG_COPY: - strRet = "MSG_COPY"; - break; - case MSG_AUTOMATICCAPTUREDIRECTORY: - strRet = "MSG_AUTOMATICCAPTUREDIRECTORY"; - break; - case MSG_PASSTHRU: - strRet = "MSG_PASSTHRU"; - break; - case MSG_REGISTER_CALLBACK: - strRet = "MSG_REGISTER_CALLBACK"; - break; - case MSG_RESETALL: - strRet = "MSG_RESETALL"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Message 0x:%04X",_unItem); - strRet = buff; - } - break; - } - return strRet; -} - -const char* convertDataGroup_toString(const TW_UINT16 _unItem) -{ - const char* strRet; - switch(_unItem) - { - case DG_CONTROL: - strRet = "DG_CONTROL"; - break; - case DG_IMAGE: - strRet = "DG_IMAGE"; - break; - case DG_AUDIO: - strRet = "DG_AUDIO"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "DataGroup 0x:%04X",_unItem); - strRet = buff; - } - break; - } - return strRet; -} - -const char* convertDataArgType_toString(const TW_UINT16 _unItem) -{ - const char* strRet; - switch(_unItem) - { - case DAT_NULL: - strRet = "DAT_NULL"; - break; - case DAT_CAPABILITY: - strRet = "DAT_CAPABILITY"; - break; - case DAT_EVENT: - strRet = "DAT_EVENT"; - break; - case DAT_IDENTITY: - strRet = "DAT_IDENTITY"; - break; - case DAT_PARENT: - strRet = "DAT_PARENT"; - break; - case DAT_PENDINGXFERS: - strRet = "DAT_PENDINGXFERS"; - break; - case DAT_SETUPMEMXFER: - strRet = "DAT_SETUPMEMXFER"; - break; - case DAT_SETUPFILEXFER: - strRet = "DAT_SETUPFILEXFER"; - break; - case DAT_STATUS: - strRet = "DAT_STATUS"; - break; - case DAT_USERINTERFACE: - strRet = "DAT_USERINTERFACE"; - break; - case DAT_XFERGROUP: - strRet = "DAT_XFERGROUP"; - break; - case DAT_CUSTOMDSDATA: - strRet = "DAT_CUSTOMDSDATA"; - break; - case DAT_DEVICEEVENT: - strRet = "DAT_DEVICEEVENT"; - break; - case DAT_FILESYSTEM: - strRet = "DAT_FILESYSTEM"; - break; - case DAT_PASSTHRU: - strRet = "DAT_PASSTHRU"; - break; - case DAT_CALLBACK: - strRet = "DAT_CALLBACK"; - break; - case DAT_STATUSUTF8: - strRet = "DAT_STATUSUTF8"; - break; - case DAT_IMAGEINFO: - strRet = "DAT_IMAGEINFO"; - break; - case DAT_IMAGELAYOUT: - strRet = "DAT_IMAGELAYOUT"; - break; - case DAT_IMAGEMEMXFER: - strRet = "DAT_IMAGEMEMXFER"; - break; - case DAT_IMAGENATIVEXFER: - strRet = "DAT_IMAGENATIVEXFER"; - break; - case DAT_IMAGEFILEXFER: - strRet = "DAT_IMAGEFILEXFER"; - break; - case DAT_CIECOLOR: - strRet = "DAT_CIECOLOR"; - break; - case DAT_GRAYRESPONSE: - strRet = "DAT_GRAYRESPONSE"; - break; - case DAT_RGBRESPONSE: - strRet = "DAT_RGBRESPONSE"; - break; - case DAT_JPEGCOMPRESSION: - strRet = "DAT_JPEGCOMPRESSION"; - break; - case DAT_PALETTE8: - strRet = "DAT_PALETTE8"; - break; - case DAT_EXTIMAGEINFO: - strRet = "DAT_EXTIMAGEINFO"; - break; - case DAT_AUDIOFILEXFER: - strRet = "DAT_AUDIOFILEXFER"; - break; - case DAT_AUDIOINFO: - strRet = "DAT_AUDIOINFO"; - break; - case DAT_AUDIONATIVEXFER: - strRet = "DAT_AUDIONATIVEXFER"; - break; - case DAT_ICCPROFILE: - strRet = "DAT_ICCPROFILE"; - break; - case DAT_IMAGEMEMFILEXFER: - strRet = "DAT_IMAGEMEMFILEXFER"; - break; - case DAT_ENTRYPOINT: - strRet = "DAT_ENTRYPOINT"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "DataArgumentType 0x:%04X",_unItem); - strRet = buff; - } - break; - } - return strRet; -} - -const char* convertContainerType_toString(const TW_UINT16 _unItem) -{ - const char* strRet; - switch(_unItem) - { - case TWON_ARRAY: - strRet = "TWON_ARRAY"; - break; - case TWON_ENUMERATION: - strRet = "TWON_ENUMERATION"; - break; - case TWON_ONEVALUE: - strRet = "TWON_ONEVALUE"; - break; - case TWON_RANGE: - strRet = "TWON_RANGE"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "DataArgumentType 0x:%04X",_unItem); - strRet = buff; - } - break; - } - return strRet; -} - -const char* convertQuerySupport_toString(const TW_UINT32 _unItem) -{ - const char* strRet = NULL; - string strVal; - if(_unItem&TWQC_GET) - { - strVal+="TWQC_GET"; - } - if(_unItem&TWQC_SET) - { - if(strVal.length()) - { - strVal+="|"; - } - strVal+="TWQC_SET"; - } - if(_unItem&TWQC_GETDEFAULT) - { - if(strVal.length()) - { - strVal+="|"; - } - strVal+="TWQC_GETDEFAULT"; - } - if(_unItem&TWQC_GETCURRENT) - { - if(strVal.length()) - { - strVal+="|"; - } - strVal+="TWQC_GETCURRENT"; - } - if(_unItem&TWQC_RESET) - { - if(strVal.length()) - { - strVal+="|"; - } - strVal+="TWQC_RESET"; - } - - if(strVal.length()) - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%s",strVal.c_str()); - strRet = buff; - } - if(NULL==strRet) - { - strRet = "NONE"; - } - return strRet; -} - -const char* convertFileFmt_toExtension(const TW_UINT16 _unItem) -{ - const char* strRet = NULL; - switch(_unItem) - { - case TWFF_PICT: - strRet = "pct"; - break; - case TWFF_BMP: - strRet = "bmp"; - break; - case TWFF_XBM: - strRet = "xbm"; - break; - case TWFF_JFIF: - strRet = "jpg"; - break; - case TWFF_FPX: - strRet = "fpx"; - break; - case TWFF_TIFF: - case TWFF_TIFFMULTI: - strRet = "tif"; - break; - case TWFF_PNG: - strRet = "png"; - break; - case TWFF_SPIFF: - strRet = "spf"; - break; - case TWFF_EXIF: - strRet = "xif"; - break; - case TWFF_JP2: - strRet = "jp2"; - break; - case TWFF_JPX: - strRet = "jpx"; - break; - case TWFF_DEJAVU: - strRet = "djv"; - break; - case TWFF_PDF: - case TWFF_PDFA: - case TWFF_PDFA2: - strRet = "pdf"; - break; - default: - strRet = "bin"; - break; - } - return strRet; -} - -const char *CapabilityValueToString(TW_UINT16 twCapId, TW_UINT16 twItemType, const void *pValue) -{ - const char *strRet = NULL; - - //Setup various pointers for later - const TW_FRAME *pFrame = static_cast(pValue); - const TW_FIX32 *pFix32 = static_cast(pValue); - const TW_UINT16 *pUint16 = static_cast(pValue); - const TW_UINT32 *pUint32 = static_cast(pValue); - const TW_INT16 *pInt16 = static_cast(pValue); - const TW_BOOL *pBool = static_cast(pValue); - const char *pStr = static_cast(pValue); - - //knock-out some standards first - switch(twItemType) - { - case TWTY_INT16: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%d", *pInt16); - strRet = buff; - } - break; - case TWTY_BOOL: - strRet = *pBool?"TRUE":"FALSE"; - break; - case TWTY_FIX32: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%.2f", FIX32ToFloat(*pFix32)); - strRet = buff; - } - break; - case TWTY_FRAME: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%.2f,%.2f,%.2f,%.2f", - FIX32ToFloat(pFrame->Left), FIX32ToFloat(pFrame->Top), FIX32ToFloat(pFrame->Right), FIX32ToFloat(pFrame->Bottom)); - strRet = buff; - } - break; - case TWTY_STR32: - case TWTY_STR64: - case TWTY_STR128: - case TWTY_STR255: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%s", pStr); - strRet = buff; - } - break; - } - - if(NULL==strRet) - { - switch(twCapId) - { -#if 0 - case CAP_CUSTOMDSDATA: - case CAP_FEEDERENABLED: - case CAP_FEEDERLOADED: - case CAP_AUTOFEED: - case CAP_CLEARPAGE: - case CAP_FEEDPAGE: - case CAP_REWINDPAGE: - case CAP_INDICATORS: - case CAP_PAPERDETECTABLE: - case CAP_UICONTROLLABLE: - case CAP_DEVICEONLINE: - case CAP_AUTOSCAN: - case CAP_THUMBNAILSENABLED: - case CAP_DUPLEXENABLED: - case CAP_ENABLEDSUIONLY: - strRet = *pBool?"TRUE":"FALSE"; - break; -#endif //#if 0 - case CAP_EXTENDEDCAPS: - case CAP_SUPPORTEDCAPS: - switch(*pUint16) - { - case CAP_XFERCOUNT : - strRet = "CAP_XFERCOUNT"; - break; - case ICAP_COMPRESSION: - strRet = "ICAP_COMPRESSION"; - break; - case ICAP_PIXELTYPE: - strRet = "ICAP_PIXELTYPE"; - break; - case ICAP_UNITS: - strRet = "ICAP_UNITS"; - break; - case ICAP_XFERMECH: - strRet = "ICAP_XFERMECH"; - break; - case CAP_AUTHOR: - strRet = "CAP_AUTHOR"; - break; - case CAP_CAPTION: - strRet = "CAP_CAPTION"; - break; - case CAP_FEEDERENABLED: - strRet = "CAP_FEEDERENABLED"; - break; - case CAP_FEEDERLOADED: - strRet = "CAP_FEEDERLOADED"; - break; - case CAP_TIMEDATE: - strRet = "CAP_TIMEDATE"; - break; - case CAP_SUPPORTEDCAPS: - strRet = "CAP_SUPPORTEDCAPS"; - break; - case CAP_EXTENDEDCAPS: - strRet = "CAP_EXTENDEDCAPS"; - break; - case CAP_AUTOFEED: - strRet = "CAP_AUTOFEED"; - break; - case CAP_CLEARPAGE: - strRet = "CAP_CLEARPAGE"; - break; - case CAP_FEEDPAGE: - strRet = "CAP_FEEDPAGE"; - break; - case CAP_REWINDPAGE: - strRet = "CAP_REWINDPAGE"; - break; - case CAP_INDICATORS: - strRet = "CAP_INDICATORS"; - break; - case CAP_SUPPORTEDCAPSEXT: - strRet = "CAP_SUPPORTEDCAPSEXT"; - break; - case CAP_PAPERDETECTABLE: - strRet = "CAP_PAPERDETECTABLE"; - break; - case CAP_UICONTROLLABLE: - strRet = "CAP_UICONTROLLABLE"; - break; - case CAP_DEVICEONLINE: - strRet = "CAP_DEVICEONLINE"; - break; - case CAP_AUTOSCAN: - strRet = "CAP_AUTOSCAN"; - break; - case CAP_THUMBNAILSENABLED: - strRet = "CAP_THUMBNAILSENABLED"; - break; - case CAP_DUPLEX: - strRet = "CAP_DUPLEX"; - break; - case CAP_DUPLEXENABLED: - strRet = "CAP_DUPLEXENABLED"; - break; - case CAP_ENABLEDSUIONLY: - strRet = "CAP_ENABLEDSUIONLY"; - break; - case CAP_CUSTOMDSDATA: - strRet = "CAP_CUSTOMDSDATA"; - break; - case CAP_ENDORSER: - strRet = "CAP_ENDORSER"; - break; - case CAP_JOBCONTROL: - strRet = "CAP_JOBCONTROL"; - break; - case CAP_ALARMS: - strRet = "CAP_ALARMS"; - break; - case CAP_ALARMVOLUME: - strRet = "CAP_ALARMVOLUME"; - break; - case CAP_AUTOMATICCAPTURE: - strRet = "CAP_AUTOMATICCAPTURE"; - break; - case CAP_TIMEBEFOREFIRSTCAPTURE: - strRet = "CAP_TIMEBEFOREFIRSTCAPTURE"; - break; - case CAP_TIMEBETWEENCAPTURES: - strRet = "CAP_TIMEBETWEENCAPTURES"; - break; - case CAP_CLEARBUFFERS: - strRet = "CAP_CLEARBUFFERS"; - break; - case CAP_MAXBATCHBUFFERS: - strRet = "CAP_MAXBATCHBUFFERS"; - break; - case CAP_DEVICETIMEDATE: - strRet = "CAP_DEVICETIMEDATE"; - break; - case CAP_POWERSUPPLY: - strRet = "CAP_POWERSUPPLY"; - break; - case CAP_CAMERAPREVIEWUI: - strRet = "CAP_CAMERAPREVIEWUI"; - break; - case CAP_DEVICEEVENT: - strRet = "CAP_DEVICEEVENT"; - break; - case CAP_SERIALNUMBER: - strRet = "CAP_SERIALNUMBER"; - break; - case CAP_PRINTER: - strRet = "CAP_PRINTER"; - break; - case CAP_PRINTERENABLED: - strRet = "CAP_PRINTERENABLED"; - break; - case CAP_PRINTERINDEX: - strRet = "CAP_PRINTERINDEX"; - break; - case CAP_PRINTERMODE: - strRet = "CAP_PRINTERMODE"; - break; - case CAP_PRINTERSTRING: - strRet = "CAP_PRINTERSTRING"; - break; - case CAP_PRINTERSUFFIX: - strRet = "CAP_PRINTERSUFFIX"; - break; - case CAP_LANGUAGE: - strRet = "CAP_LANGUAGE"; - break; - case CAP_FEEDERALIGNMENT: - strRet = "CAP_FEEDERALIGNMENT"; - break; - case CAP_FEEDERORDER: - strRet = "CAP_FEEDERORDER"; - break; - case CAP_REACQUIREALLOWED: - strRet = "CAP_REACQUIREALLOWED"; - break; - case CAP_BATTERYMINUTES: - strRet = "CAP_BATTERYMINUTES"; - break; - case CAP_BATTERYPERCENTAGE: - strRet = "CAP_BATTERYPERCENTAGE"; - break; - case CAP_CAMERASIDE: - strRet = "CAP_CAMERASIDE"; - break; - case CAP_SEGMENTED: - strRet = "CAP_SEGMENTED"; - break; - case CAP_CAMERAENABLED: - strRet = "CAP_CAMERAENABLED"; - break; - case CAP_CAMERAORDER: - strRet = "CAP_CAMERAORDER"; - break; - case CAP_MICRENABLED: - strRet = "CAP_MICRENABLED"; - break; - case CAP_FEEDERPREP: - strRet = "CAP_FEEDERPREP"; - break; - case CAP_FEEDERPOCKET: - strRet = "CAP_FEEDERPOCKET"; - break; - case CAP_AUTOMATICSENSEMEDIUM: - strRet = "CAP_AUTOMATICSENSEMEDIUM"; - break; - case CAP_CUSTOMINTERFACEGUID: - strRet = "CAP_CUSTOMINTERFACEGUID"; - break; - case ICAP_AUTOBRIGHT: - strRet = "ICAP_AUTOBRIGHT"; - break; - case ICAP_BRIGHTNESS: - strRet = "ICAP_BRIGHTNESS"; - break; - case ICAP_CONTRAST: - strRet = "ICAP_CONTRAST"; - break; - case ICAP_CUSTHALFTONE: - strRet = "ICAP_CUSTHALFTONE"; - break; - case ICAP_EXPOSURETIME: - strRet = "ICAP_EXPOSURETIME"; - break; - case ICAP_FILTER: - strRet = "ICAP_FILTER"; - break; - case ICAP_FLASHUSED: - strRet = "ICAP_FLASHUSED"; - break; - case ICAP_GAMMA: - strRet = "ICAP_GAMMA"; - break; - case ICAP_HALFTONES: - strRet = "ICAP_HALFTONES"; - break; - case ICAP_HIGHLIGHT: - strRet = "ICAP_HIGHLIGHT"; - break; - case ICAP_IMAGEFILEFORMAT: - strRet = "ICAP_IMAGEFILEFORMAT"; - break; - case ICAP_LAMPSTATE: - strRet = "ICAP_LAMPSTATE"; - break; - case ICAP_LIGHTSOURCE: - strRet = "ICAP_LIGHTSOURCE"; - break; - case ICAP_ORIENTATION: - strRet = "ICAP_ORIENTATION"; - break; - case ICAP_PHYSICALWIDTH: - strRet = "ICAP_PHYSICALWIDTH"; - break; - case ICAP_PHYSICALHEIGHT: - strRet = "ICAP_PHYSICALHEIGHT"; - break; - case ICAP_SHADOW: - strRet = "ICAP_SHADOW"; - break; - case ICAP_FRAMES: - strRet = "ICAP_FRAMES"; - break; - case ICAP_XNATIVERESOLUTION: - strRet = "ICAP_XNATIVERESOLUTION"; - break; - case ICAP_YNATIVERESOLUTION: - strRet = "ICAP_YNATIVERESOLUTION"; - break; - case ICAP_XRESOLUTION: - strRet = "ICAP_XRESOLUTION"; - break; - case ICAP_YRESOLUTION: - strRet = "ICAP_YRESOLUTION"; - break; - case ICAP_MAXFRAMES: - strRet = "ICAP_MAXFRAMES"; - break; - case ICAP_TILES: - strRet = "ICAP_TILES"; - break; - case ICAP_BITORDER: - strRet = "ICAP_BITORDER"; - break; - case ICAP_CCITTKFACTOR: - strRet = "ICAP_CCITTKFACTOR"; - break; - case ICAP_LIGHTPATH: - strRet = "ICAP_LIGHTPATH"; - break; - case ICAP_PIXELFLAVOR: - strRet = "ICAP_PIXELFLAVOR"; - break; - case ICAP_PLANARCHUNKY: - strRet = "ICAP_PLANARCHUNKY"; - break; - case ICAP_ROTATION: - strRet = "ICAP_ROTATION"; - break; - case ICAP_SUPPORTEDSIZES: - strRet = "ICAP_SUPPORTEDSIZES"; - break; - case ICAP_THRESHOLD: - strRet = "ICAP_THRESHOLD"; - break; - case ICAP_XSCALING: - strRet = "ICAP_XSCALING"; - break; - case ICAP_YSCALING: - strRet = "ICAP_YSCALING"; - break; - case ICAP_BITORDERCODES: - strRet = "ICAP_BITORDERCODES"; - break; - case ICAP_PIXELFLAVORCODES: - strRet = "ICAP_PIXELFLAVORCODES"; - break; - case ICAP_JPEGPIXELTYPE: - strRet = "ICAP_JPEGPIXELTYPE"; - break; - case ICAP_TIMEFILL: - strRet = "ICAP_TIMEFILL"; - break; - case ICAP_BITDEPTH: - strRet = "ICAP_BITDEPTH"; - break; - case ICAP_BITDEPTHREDUCTION: - strRet = "ICAP_BITDEPTHREDUCTION"; - break; - case ICAP_UNDEFINEDIMAGESIZE: - strRet = "ICAP_UNDEFINEDIMAGESIZE"; - break; - case ICAP_IMAGEDATASET: - strRet = "ICAP_IMAGEDATASET"; - break; - case ICAP_EXTIMAGEINFO: - strRet = "ICAP_EXTIMAGEINFO"; - break; - case ICAP_MINIMUMHEIGHT: - strRet = "ICAP_MINIMUMHEIGHT"; - break; - case ICAP_MINIMUMWIDTH: - strRet = "ICAP_MINIMUMWIDTH"; - break; - case ICAP_AUTODISCARDBLANKPAGES: - strRet = "ICAP_AUTODISCARDBLANKPAGES"; - break; - case ICAP_FLIPROTATION: - strRet = "ICAP_FLIPROTATION"; - break; - case ICAP_BARCODEDETECTIONENABLED: - strRet = "ICAP_BARCODEDETECTIONENABLED"; - break; - case ICAP_SUPPORTEDBARCODETYPES: - strRet = "ICAP_SUPPORTEDBARCODETYPES"; - break; - case ICAP_BARCODEMAXSEARCHPRIORITIES: - strRet = "ICAP_BARCODEMAXSEARCHPRIORITIES"; - break; - case ICAP_BARCODESEARCHPRIORITIES: - strRet = "ICAP_BARCODESEARCHPRIORITIES"; - break; - case ICAP_BARCODESEARCHMODE: - strRet = "ICAP_BARCODESEARCHMODE"; - break; - case ICAP_BARCODEMAXRETRIES: - strRet = "ICAP_BARCODEMAXRETRIES"; - break; - case ICAP_BARCODETIMEOUT: - strRet = "ICAP_BARCODETIMEOUT"; - break; - case ICAP_ZOOMFACTOR: - strRet = "ICAP_ZOOMFACTOR"; - break; - case ICAP_PATCHCODEDETECTIONENABLED: - strRet = "ICAP_PATCHCODEDETECTIONENABLED"; - break; - case ICAP_SUPPORTEDPATCHCODETYPES: - strRet = "ICAP_SUPPORTEDPATCHCODETYPES"; - break; - case ICAP_PATCHCODEMAXSEARCHPRIORITIES: - strRet = "ICAP_PATCHCODEMAXSEARCHPRIORITIES"; - break; - case ICAP_PATCHCODESEARCHPRIORITIES: - strRet = "ICAP_PATCHCODESEARCHPRIORITIES"; - break; - case ICAP_PATCHCODESEARCHMODE: - strRet = "ICAP_PATCHCODESEARCHMODE"; - break; - case ICAP_PATCHCODEMAXRETRIES: - strRet = "ICAP_PATCHCODEMAXRETRIES"; - break; - case ICAP_PATCHCODETIMEOUT: - strRet = "ICAP_PATCHCODETIMEOUT"; - break; - case ICAP_FLASHUSED2: - strRet = "ICAP_FLASHUSED2"; - break; - case ICAP_IMAGEFILTER: - strRet = "ICAP_IMAGEFILTER"; - break; - case ICAP_NOISEFILTER: - strRet = "ICAP_NOISEFILTER"; - break; - case ICAP_OVERSCAN: - strRet = "ICAP_OVERSCAN"; - break; - case ICAP_AUTOMATICBORDERDETECTION: - strRet = "ICAP_AUTOMATICBORDERDETECTION"; - break; - case ICAP_AUTOMATICDESKEW: - strRet = "ICAP_AUTOMATICDESKEW"; - break; - case ICAP_AUTOMATICROTATE: - strRet = "ICAP_AUTOMATICROTATE"; - break; - case ICAP_JPEGQUALITY: - strRet = "ICAP_JPEGQUALITY"; - break; - case ICAP_FEEDERTYPE: - strRet = "ICAP_FEEDERTYPE"; - break; - case ICAP_ICCPROFILE: - strRet = "ICAP_ICCPROFILE"; - break; - case ICAP_AUTOSIZE: - strRet = "ICAP_AUTOSIZE"; - break; - case ICAP_AUTOMATICCROPUSESFRAME: - strRet = "ICAP_AUTOMATICCROPUSESFRAME"; - break; - case ICAP_AUTOMATICLENGTHDETECTION: - strRet = "ICAP_AUTOMATICLENGTHDETECTION"; - break; - case ICAP_AUTOMATICCOLORENABLED: - strRet = "ICAP_AUTOMATICCOLORENABLED"; - break; - case ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE: - strRet = "ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE"; - break; - case ICAP_COLORMANAGEMENTENABLED: - strRet = "ICAP_COLORMANAGEMENTENABLED"; - break; - case ICAP_IMAGEMERGE: - strRet = "ICAP_IMAGEMERGE"; - break; - case ICAP_IMAGEMERGEHEIGHTTHRESHOLD: - strRet = "ICAP_IMAGEMERGEHEIGHTTHRESHOLD"; - break; - case ICAP_SUPPORTEDEXTIMAGEINFO: - strRet = "ICAP_SUPPORTEDEXTIMAGEINFO"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_SUPPORTEDEXTIMAGEINFO: - switch(*pUint16) - { - case TWEI_BARCODEX: - strRet = "TWEI_BARCODEX"; - break; - case TWEI_BARCODEY: - strRet = "TWEI_BARCODEY"; - break; - case TWEI_BARCODETEXT: - strRet = "TWEI_BARCODETEXT"; - break; - case TWEI_BARCODETYPE: - strRet = "TWEI_BARCODETYPE"; - break; - case TWEI_DESHADETOP: - strRet = "TWEI_DESHADETOP"; - break; - case TWEI_DESHADELEFT: - strRet = "TWEI_DESHADELEFT"; - break; - case TWEI_DESHADEHEIGHT: - strRet = "TWEI_DESHADEHEIGHT"; - break; - case TWEI_DESHADEWIDTH: - strRet = "TWEI_DESHADEWIDTH"; - break; - case TWEI_DESHADESIZE: - strRet = "TWEI_DESHADESIZE"; - break; - case TWEI_SPECKLESREMOVED: - strRet = "TWEI_SPECKLESREMOVED"; - break; - case TWEI_HORZLINEXCOORD: - strRet = "TWEI_HORZLINEXCOORD"; - break; - case TWEI_HORZLINEYCOORD: - strRet = "TWEI_HORZLINEYCOORD"; - break; - case TWEI_HORZLINELENGTH: - strRet = "TWEI_HORZLINELENGTH"; - break; - case TWEI_HORZLINETHICKNESS: - strRet = "TWEI_HORZLINETHICKNESS"; - break; - case TWEI_VERTLINEXCOORD: - strRet = "TWEI_VERTLINEXCOORD"; - break; - case TWEI_VERTLINEYCOORD: - strRet = "TWEI_VERTLINEYCOORD"; - break; - case TWEI_VERTLINELENGTH: - strRet = "TWEI_VERTLINELENGTH"; - break; - case TWEI_VERTLINETHICKNESS: - strRet = "TWEI_VERTLINETHICKNESS"; - break; - case TWEI_PATCHCODE: - strRet = "TWEI_PATCHCODE"; - break; - case TWEI_ENDORSEDTEXT: - strRet = "TWEI_ENDORSEDTEXT"; - break; - case TWEI_FORMCONFIDENCE: - strRet = "TWEI_FORMCONFIDENCE"; - break; - case TWEI_FORMTEMPLATEMATCH: - strRet = "TWEI_FORMTEMPLATEMATCH"; - break; - case TWEI_FORMTEMPLATEPAGEMATCH: - strRet = "TWEI_FORMTEMPLATEPAGEMATCH"; - break; - case TWEI_FORMHORZDOCOFFSET: - strRet = "TWEI_FORMHORZDOCOFFSET"; - break; - case TWEI_FORMVERTDOCOFFSET: - strRet = "TWEI_FORMVERTDOCOFFSET"; - break; - case TWEI_BARCODECOUNT: - strRet = "TWEI_BARCODECOUNT"; - break; - case TWEI_BARCODECONFIDENCE: - strRet = "TWEI_BARCODECONFIDENCE"; - break; - case TWEI_BARCODEROTATION: - strRet = "TWEI_BARCODEROTATION"; - break; - case TWEI_BARCODETEXTLENGTH: - strRet = "TWEI_BARCODETEXTLENGTH"; - break; - case TWEI_DESHADECOUNT: - strRet = "TWEI_DESHADECOUNT"; - break; - case TWEI_DESHADEBLACKCOUNTOLD: - strRet = "TWEI_DESHADEBLACKCOUNTOLD"; - break; - case TWEI_DESHADEBLACKCOUNTNEW: - strRet = "TWEI_DESHADEBLACKCOUNTNEW"; - break; - case TWEI_DESHADEBLACKRLMIN: - strRet = "TWEI_DESHADEBLACKRLMIN"; - break; - case TWEI_DESHADEBLACKRLMAX: - strRet = "TWEI_DESHADEBLACKRLMAX"; - break; - case TWEI_DESHADEWHITECOUNTOLD: - strRet = "TWEI_DESHADEWHITECOUNTOLD"; - break; - case TWEI_DESHADEWHITECOUNTNEW: - strRet = "TWEI_DESHADEWHITECOUNTNEW"; - break; - case TWEI_DESHADEWHITERLMIN: - strRet = "TWEI_DESHADEWHITERLMIN"; - break; - case TWEI_DESHADEWHITERLAVE: - strRet = "TWEI_DESHADEWHITERLAVE"; - break; - case TWEI_DESHADEWHITERLMAX: - strRet = "TWEI_DESHADEWHITERLMAX"; - break; - case TWEI_BLACKSPECKLESREMOVED: - strRet = "TWEI_BLACKSPECKLESREMOVED"; - break; - case TWEI_WHITESPECKLESREMOVED: - strRet = "TWEI_WHITESPECKLESREMOVED"; - break; - case TWEI_HORZLINECOUNT: - strRet = "TWEI_HORZLINECOUNT"; - break; - case TWEI_VERTLINECOUNT: - strRet = "TWEI_VERTLINECOUNT"; - break; - case TWEI_DESKEWSTATUS: - strRet = "TWEI_DESKEWSTATUS"; - break; - case TWEI_SKEWORIGINALANGLE: - strRet = "TWEI_SKEWORIGINALANGLE"; - break; - case TWEI_SKEWFINALANGLE: - strRet = "TWEI_SKEWFINALANGLE"; - break; - case TWEI_SKEWCONFIDENCE: - strRet = "TWEI_SKEWCONFIDENCE"; - break; - case TWEI_SKEWWINDOWX1: - strRet = "TWEI_SKEWWINDOWX1"; - break; - case TWEI_SKEWWINDOWY1: - strRet = "TWEI_SKEWWINDOWY1"; - break; - case TWEI_SKEWWINDOWX2: - strRet = "TWEI_SKEWWINDOWX2"; - break; - case TWEI_SKEWWINDOWY2: - strRet = "TWEI_SKEWWINDOWY2"; - break; - case TWEI_SKEWWINDOWX3: - strRet = "TWEI_SKEWWINDOWX3"; - break; - case TWEI_SKEWWINDOWY3: - strRet = "TWEI_SKEWWINDOWY3"; - break; - case TWEI_SKEWWINDOWX4: - strRet = "TWEI_SKEWWINDOWX4"; - break; - case TWEI_SKEWWINDOWY4: - strRet = "TWEI_SKEWWINDOWY4"; - break; - case TWEI_BOOKNAME: - strRet = "TWEI_BOOKNAME"; - break; - case TWEI_CHAPTERNUMBER: - strRet = "TWEI_CHAPTERNUMBER"; - break; - case TWEI_DOCUMENTNUMBER: - strRet = "TWEI_DOCUMENTNUMBER"; - break; - case TWEI_PAGENUMBER: - strRet = "TWEI_PAGENUMBER"; - break; - case TWEI_CAMERA: - strRet = "TWEI_CAMERA"; - break; - case TWEI_FRAMENUMBER: - strRet = "TWEI_FRAMENUMBER"; - break; - case TWEI_FRAME: - strRet = "TWEI_FRAME"; - break; - case TWEI_PIXELFLAVOR: - strRet = "TWEI_PIXELFLAVOR"; - break; - case TWEI_ICCPROFILE: - strRet = "TWEI_ICCPROFILE"; - break; - case TWEI_LASTSEGMENT: - strRet = "TWEI_LASTSEGMENT"; - break; - case TWEI_SEGMENTNUMBER: - strRet = "TWEI_SEGMENTNUMBER"; - break; - case TWEI_MAGDATA: - strRet = "TWEI_MAGDATA"; - break; - case TWEI_MAGTYPE: - strRet = "TWEI_MAGTYPE"; - break; - case TWEI_PAGESIDE: - strRet = "TWEI_PAGESIDE"; - break; - case TWEI_FILESYSTEMSOURCE: - strRet = "TWEI_FILESYSTEMSOURCE"; - break; - case TWEI_IMAGEMERGED: - strRet = "TWEI_IMAGEMERGED"; - break; - case TWEI_MAGDATALENGTH: - strRet = "TWEI_MAGDATALENGTH"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; -#if 0 - case ICAP_FRAMES: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%.2f,%.2f,%.2f,%.2f", - FIX32ToFloat(pFrame->Left), FIX32ToFloat(pFrame->Top), FIX32ToFloat(pFrame->Right), FIX32ToFloat(pFrame->Bottom)); - strRet = buff; - } - break; -#endif //#if 0 - case ICAP_MAXFRAMES: - case ICAP_BITDEPTH: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%d", *pUint16); - strRet = buff; - } - break; -#if 0 - case CAP_XFERCOUNT: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%d", *pInt16); - strRet = buff; - } - break; -#endif //#if 0 -#if 0 - case ICAP_GAMMA: - case ICAP_XRESOLUTION: - case ICAP_YRESOLUTION: - case ICAP_BRIGHTNESS: - case ICAP_CONTRAST: - case ICAP_THRESHOLD: - case ICAP_PHYSICALWIDTH: - case ICAP_PHYSICALHEIGHT: - case ICAP_MINIMUMHEIGHT: - case ICAP_MINIMUMWIDTH: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%.2f", FIX32ToFloat(*pFix32)); - strRet = buff; - } - break; -#endif //#if 0 - case CAP_CUSTOMINTERFACEGUID: - //case CAP_SERIALNUMBER: - case ICAP_HALFTONES: - case CAP_AUTHOR: - case CAP_CAPTION: - case CAP_TIMEDATE: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "%s", pStr); - strRet = buff; - } - break; - case CAP_ALARMS: - switch(*pUint16) - { - case TWAL_ALARM: - strRet = "TWAL_ALARM"; - break; - case TWAL_FEEDERERROR: - strRet = "TWAL_FEEDERERROR"; - break; - case TWAL_FEEDERWARNING: - strRet = "TWAL_FEEDERWARNING"; - break; - case TWAL_BARCODE: - strRet = "TWAL_BARCODE"; - break; - case TWAL_DOUBLEFEED: - strRet = "TWAL_DOUBLEFEED"; - break; - case TWAL_JAM: - strRet = "TWAL_JAM"; - break; - case TWAL_PATCHCODE: - strRet = "TWAL_PATCHCODE"; - break; - case TWAL_POWER: - strRet = "TWAL_POWER"; - break; - case TWAL_SKEW: - strRet = "TWAL_SKEW"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_AUTOSIZE: - switch(*pUint16) - { - case TWAS_NONE: - strRet = "TWAS_NONE"; - break; - case TWAS_AUTO: - strRet = "TWAS_AUTO"; - break; - case TWAS_CURRENT: - strRet = "TWAS_CURRENT"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_BARCODESEARCHMODE: - switch(*pUint16) - { - case TWBD_HORZ: - strRet = "TWBD_HORZ"; - break; - case TWBD_VERT: - strRet = "TWBD_VERT"; - break; - case TWBD_HORZVERT: - strRet = "TWBD_HORZVERT"; - break; - case TWBD_VERTHORZ: - strRet = "TWBD_VERTHORZ"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_BITORDER: - switch(*pUint16) - { - case TWBO_LSBFIRST: - strRet = "TWBO_LSBFIRST"; - break; - case TWBO_MSBFIRST: - strRet = "TWBO_MSBFIRST"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_AUTODISCARDBLANKPAGES: - switch(*pUint16) - { - case TWBP_DISABLE: - strRet = "TWBP_DISABLE"; - break; - case TWBP_AUTO: - strRet = "TWBP_AUTO"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_BITDEPTHREDUCTION: - switch(*pUint16) - { - case TWBR_THRESHOLD: - strRet = "TWBR_THRESHOLD"; - break; - case TWBR_HALFTONE: - strRet = "TWBR_HALFTONE"; - break; - case TWBR_CUSTHALFTONE: - strRet = "TWBR_CUSTHALFTONE"; - break; - case TWBR_DIFFUSION: - strRet = "TWBR_DIFFUSION"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_SUPPORTEDBARCODETYPES: /*and TWEI_BARCODETYPE values Added 1.7 */ - switch(*pUint16) - { - case TWBT_3OF9: - strRet = "TWBT_3OF9"; - break; - case TWBT_2OF5INTERLEAVED: - strRet = "TWBT_2OF5INTERLEAVED"; - break; - case TWBT_2OF5NONINTERLEAVED: - strRet = "TWBT_2OF5NONINTERLEAVED"; - break; - case TWBT_CODE93: - strRet = "TWBT_CODE93"; - break; - case TWBT_CODE128: - strRet = "TWBT_CODE128"; - break; - case TWBT_UCC128: - strRet = "TWBT_UCC128"; - break; - case TWBT_CODABAR: - strRet = "TWBT_CODABAR"; - break; - case TWBT_UPCA: - strRet = "TWBT_UPCA"; - break; - case TWBT_UPCE: - strRet = "TWBT_UPCE"; - break; - case TWBT_EAN8: - strRet = "TWBT_EAN8"; - break; - case TWBT_EAN13: - strRet = "TWBT_EAN13"; - break; - case TWBT_POSTNET: - strRet = "TWBT_POSTNET"; - break; - case TWBT_PDF417: - strRet = "TWBT_PDF417"; - break; - case TWBT_2OF5INDUSTRIAL: - strRet = "TWBT_2OF5INDUSTRIAL"; - break; - case TWBT_2OF5MATRIX: - strRet = "TWBT_2OF5MATRIX"; - break; - case TWBT_2OF5DATALOGIC: - strRet = "TWBT_2OF5DATALOGIC"; - break; - case TWBT_2OF5IATA: - strRet = "TWBT_2OF5IATA"; - break; - case TWBT_3OF9FULLASCII: - strRet = "TWBT_3OF9FULLASCII"; - break; - case TWBT_CODABARWITHSTARTSTOP: - strRet = "TWBT_CODABARWITHSTARTSTOP"; - break; - case TWBT_MAXICODE: - strRet = "TWBT_MAXICODE"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_COMPRESSION: - switch(*pUint16) - { - case TWCP_NONE: - strRet = "TWCP_NONE"; - break; - case TWCP_PACKBITS: - strRet = "TWCP_PACKBITS"; - break; - case TWCP_GROUP31D: - strRet = "TWCP_GROUP31D"; - break; - case TWCP_GROUP31DEOL: - strRet = "TWCP_GROUP31DEOL"; - break; - case TWCP_GROUP32D: - strRet = "TWCP_GROUP32D"; - break; - case TWCP_GROUP4: - strRet = "TWCP_GROUP4"; - break; - case TWCP_JPEG: - strRet = "TWCP_JPEG"; - break; - case TWCP_LZW: - strRet = "TWCP_LZW"; - break; - case TWCP_JBIG: - strRet = "TWCP_JBIG"; - break; - case TWCP_PNG: - strRet = "TWCP_PNG"; - break; - case TWCP_RLE4: - strRet = "TWCP_RLE4"; - break; - case TWCP_RLE8: - strRet = "TWCP_RLE8"; - break; - case TWCP_BITFIELDS: - strRet = "TWCP_BITFIELDS"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_CAMERASIDE: /* and TWEI_PAGESIDE values (CS_ means camera side) Added 1.91 */ - switch(*pUint16) - { - case TWCS_BOTH: - strRet = "TWCS_BOTH"; - break; - case TWCS_TOP: - strRet = "TWCS_TOP"; - break; - case TWCS_BOTTOM: - strRet = "TWCS_BOTTOM"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_CLEARBUFFERS: - switch(*pUint16) - { - case TWCB_AUTO: - strRet = "TWCB_AUTO"; - break; - case TWCB_CLEAR: - strRet = "TWCB_CLEAR"; - break; - case TWCB_NOCLEAR: - strRet = "TWCB_NOCLEAR"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_DEVICEEVENT: - switch(*pUint16) - { - case TWDE_CUSTOMEVENTS: - strRet = "TWDE_CUSTOMEVENTS"; - break; - case TWDE_CHECKAUTOMATICCAPTURE: - strRet = "TWDE_CHECKAUTOMATICCAPTURE"; - break; - case TWDE_CHECKBATTERY: - strRet = "TWDE_CHECKBATTERY"; - break; - case TWDE_CHECKDEVICEONLINE: - strRet = "TWDE_CHECKDEVICEONLINE"; - break; - case TWDE_CHECKFLASH: - strRet = "TWDE_CHECKFLASH"; - break; - case TWDE_CHECKPOWERSUPPLY: - strRet = "TWDE_CHECKPOWERSUPPLY"; - break; - case TWDE_CHECKRESOLUTION: - strRet = "TWDE_CHECKRESOLUTION"; - break; - case TWDE_DEVICEADDED: - strRet = "TWDE_DEVICEADDED"; - break; - case TWDE_DEVICEOFFLINE: - strRet = "TWDE_DEVICEOFFLINE"; - break; - case TWDE_DEVICEREADY: - strRet = "TWDE_DEVICEREADY"; - break; - case TWDE_DEVICEREMOVED: - strRet = "TWDE_DEVICEREMOVED"; - break; - case TWDE_IMAGECAPTURED: - strRet = "TWDE_IMAGECAPTURED"; - break; - case TWDE_IMAGEDELETED: - strRet = "TWDE_IMAGEDELETED"; - break; - case TWDE_PAPERDOUBLEFEED: - strRet = "TWDE_PAPERDOUBLEFEED"; - break; - case TWDE_PAPERJAM: - strRet = "TWDE_PAPERJAM"; - break; - case TWDE_LAMPFAILURE: - strRet = "TWDE_LAMPFAILURE"; - break; - case TWDE_POWERSAVE: - strRet = "TWDE_POWERSAVE"; - break; - case TWDE_POWERSAVENOTIFY: - strRet = "TWDE_POWERSAVENOTIFY"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_DUPLEX: - switch(*pUint16) - { - case TWDX_NONE: - strRet = "TWDX_NONE"; - break; - case TWDX_1PASSDUPLEX: - strRet = "TWDX_1PASSDUPLEX"; - break; - case TWDX_2PASSDUPLEX: - strRet = "TWDX_2PASSDUPLEX"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_FEEDERALIGNMENT: - switch(*pUint16) - { - case TWFA_NONE: - strRet = "TWFA_NONE"; - break; - case TWFA_LEFT: - strRet = "TWFA_LEFT"; - break; - case TWFA_CENTER: - strRet = "TWFA_CENTER"; - break; - case TWFA_RIGHT: - strRet = "TWFA_RIGHT"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_FEEDERTYPE: - switch(*pUint16) - { - case TWFE_GENERAL: - strRet = "TWFE_GENERAL"; - break; - case TWFE_PHOTO: - strRet = "TWFE_PHOTO"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_IMAGEFILEFORMAT: - switch(*pUint16) - { - case TWFF_TIFF: - strRet = "TWFF_TIFF"; - break; - case TWFF_PICT: - strRet = "TWFF_PICT"; - break; - case TWFF_BMP: - strRet = "TWFF_BMP"; - break; - case TWFF_XBM: - strRet = "TWFF_XBM"; - break; - case TWFF_JFIF: - strRet = "TWFF_JFIF"; - break; - case TWFF_FPX: - strRet = "TWFF_FPX"; - break; - case TWFF_TIFFMULTI: - strRet = "TWFF_TIFFMULTI"; - break; - case TWFF_PNG: - strRet = "TWFF_PNG"; - break; - case TWFF_SPIFF: - strRet = "TWFF_SPIFF"; - break; - case TWFF_EXIF: - strRet = "TWFF_EXIF"; - break; - case TWFF_PDF: - strRet = "TWFF_PDF"; - break; - case TWFF_JP2: - strRet = "TWFF_JP2"; - break; - case TWFF_JPN: - strRet = "TWFF_JPN"; - break; - case TWFF_JPX: - strRet = "TWFF_JPX"; - break; - case TWFF_DEJAVU: - strRet = "TWFF_DEJAVU"; - break; - case TWFF_PDFA: - strRet = "TWFF_PDFA"; - break; - case TWFF_PDFA2: - strRet = "TWFF_PDFA2"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_FLASHUSED2: - switch(*pUint16) - { - case TWFL_NONE: - strRet = "TWFL_NONE"; - break; - case TWFL_OFF: - strRet = "TWFL_OFF"; - break; - case TWFL_ON: - strRet = "TWFL_ON"; - break; - case TWFL_AUTO: - strRet = "TWFL_AUTO"; - break; - case TWFL_REDEYE: - strRet = "TWFL_REDEYE"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_FEEDERORDER: - switch(*pUint16) - { - case TWFO_FIRSTPAGEFIRST: - strRet = "TWFO_FIRSTPAGEFIRST"; - break; - case TWFO_LASTPAGEFIRST: - strRet = "TWFO_LASTPAGEFIRST"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_FEEDERPOCKET: - switch(*pUint16) - { - case TWFP_POCKETERROR: - strRet = "TWFP_POCKETERROR"; - break; - case TWFP_POCKET1: - strRet = "TWFP_POCKET1"; - break; - case TWFP_POCKET2: - strRet = "TWFP_POCKET2"; - break; - case TWFP_POCKET3: - strRet = "TWFP_POCKET3"; - break; - case TWFP_POCKET4: - strRet = "TWFP_POCKET4"; - break; - case TWFP_POCKET5: - strRet = "TWFP_POCKET5"; - break; - case TWFP_POCKET6: - strRet = "TWFP_POCKET6"; - break; - case TWFP_POCKET7: - strRet = "TWFP_POCKET7"; - break; - case TWFP_POCKET8: - strRet = "TWFP_POCKET8"; - break; - case TWFP_POCKET9: - strRet = "TWFP_POCKET9"; - break; - case TWFP_POCKET10: - strRet = "TWFP_POCKET10"; - break; - case TWFP_POCKET11: - strRet = "TWFP_POCKET11"; - break; - case TWFP_POCKET12: - strRet = "TWFP_POCKET12"; - break; - case TWFP_POCKET13: - strRet = "TWFP_POCKET13"; - break; - case TWFP_POCKET14: - strRet = "TWFP_POCKET14"; - break; - case TWFP_POCKET15: - strRet = "TWFP_POCKET15"; - break; - case TWFP_POCKET16: - strRet = "TWFP_POCKET16"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_FLIPROTATION: - switch(*pUint16) - { - case TWFR_BOOK: - strRet = "TWFR_BOOK"; - break; - case TWFR_FANFOLD: - strRet = "TWFR_FANFOLD"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_FILTER: - switch(*pUint16) - { - case TWFT_RED: - strRet = "TWFT_RED"; - break; - case TWFT_GREEN: - strRet = "TWFT_GREEN"; - break; - case TWFT_BLUE: - strRet = "TWFT_BLUE"; - break; - case TWFT_NONE: - strRet = "TWFT_NONE"; - break; - case TWFT_WHITE: - strRet = "TWFT_WHITE"; - break; - case TWFT_CYAN: - strRet = "TWFT_CYAN"; - break; - case TWFT_MAGENTA: - strRet = "TWFT_MAGENTA"; - break; - case TWFT_YELLOW: - strRet = "TWFT_YELLOW"; - break; - case TWFT_BLACK: - strRet = "TWFT_BLACK"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_ICCPROFILE: - switch(*pUint16) - { - case TWIC_NONE: - strRet = "TWIC_NONE"; - break; - case TWIC_LINK: - strRet = "TWIC_LINK"; - break; - case TWIC_EMBED: - strRet = "TWIC_EMBED"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_IMAGEFILTER: - switch(*pUint16) - { - case TWIF_NONE: - strRet = "TWIF_NONE"; - break; - case TWIF_AUTO: - strRet = "TWIF_AUTO"; - break; - case TWIF_LOWPASS: - strRet = "TWIF_LOWPASS"; - break; - case TWIF_BANDPASS: - strRet = "TWIF_BANDPASS"; - break; - case TWIF_HIGHPASS: - strRet = "TWIF_HIGHPASS"; - break; - // case TWIF_TEXT: - // strRet = "TWIF_TEXT"; - // break; - // case TWIF_FINELINE: - // strRet = "TWIF_FINELINE"; - // break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_IMAGEMERGE: - switch(*pUint16) - { - case TWIM_NONE: - strRet = "TWIM_NONE"; - break; - case TWIM_FRONTONTOP: - strRet = "TWIM_FRONTONTOP"; - break; - case TWIM_FRONTONBOTTOM: - strRet = "TWIM_FRONTONBOTTOM"; - break; - case TWIM_FRONTONLEFT: - strRet = "TWIM_FRONTONLEFT"; - break; - case TWIM_FRONTONRIGHT: - strRet = "TWIM_FRONTONRIGHT"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_JOBCONTROL: - switch(*pUint16) - { - case TWJC_NONE: - strRet = "TWJC_NONE"; - break; - case TWJC_JSIC: - strRet = "TWJC_JSIC"; - break; - case TWJC_JSIS: - strRet = "TWJC_JSIS"; - break; - case TWJC_JSXC: - strRet = "TWJC_JSXC"; - break; - case TWJC_JSXS: - strRet = "TWJC_JSXS"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_JPEGQUALITY: - switch(*pUint16) - { - case TWJQ_UNKNOWN: - strRet = "TWJQ_UNKNOWN"; - break; - case TWJQ_LOW: - strRet = "TWJQ_LOW"; - break; - case TWJQ_MEDIUM: - strRet = "TWJQ_MEDIUM"; - break; - case TWJQ_HIGH: - strRet = "TWJQ_HIGH"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_LIGHTPATH: - switch(*pUint16) - { - case TWLP_REFLECTIVE: - strRet = "TWLP_REFLECTIVE"; - break; - case TWLP_TRANSMISSIVE: - strRet = "TWLP_TRANSMISSIVE"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_LIGHTSOURCE: - switch(*pUint16) - { - case TWLS_RED: - strRet = "TWLS_RED"; - break; - case TWLS_GREEN: - strRet = "TWLS_GREEN"; - break; - case TWLS_BLUE: - strRet = "TWLS_BLUE"; - break; - case TWLS_NONE: - strRet = "TWLS_NONE"; - break; - case TWLS_WHITE: - strRet = "TWLS_WHITE"; - break; - case TWLS_UV: - strRet = "TWLS_UV"; - break; - case TWLS_IR: - strRet = "TWLS_IR"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_NOISEFILTER: - switch(*pUint16) - { - case TWNF_NONE: - strRet = "TWNF_NONE"; - break; - case TWNF_AUTO: - strRet = "TWNF_AUTO"; - break; - case TWNF_LONEPIXEL: - strRet = "TWNF_LONEPIXEL"; - break; - case TWNF_MAJORITYRULE: - strRet = "TWNF_MAJORITYRULE"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_ORIENTATION: - switch(*pUint16) - { - // case TWOR_ROT0: - // strRet = "TWOR_ROT0"; - // break; - case TWOR_ROT90: - strRet = "TWOR_ROT90"; - break; - case TWOR_ROT180: - strRet = "TWOR_ROT180"; - break; - // case TWOR_ROT270: - // strRet = "TWOR_ROT270"; - // break; - case TWOR_PORTRAIT: - strRet = "TWOR_PORTRAIT"; - break; - case TWOR_LANDSCAPE: - strRet = "TWOR_LANDSCAPE"; - break; - case TWOR_AUTO: - strRet = "TWOR_AUTO"; - break; - case TWOR_AUTOTEXT: - strRet = "TWOR_AUTOTEXT"; - break; - case TWOR_AUTOPICTURE: - strRet = "TWOR_AUTOPICTURE"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_OVERSCAN: - switch(*pUint16) - { - case TWOV_NONE: - strRet = "TWOV_NONE"; - break; - case TWOV_AUTO: - strRet = "TWOV_AUTO"; - break; - case TWOV_TOPBOTTOM: - strRet = "TWOV_TOPBOTTOM"; - break; - case TWOV_LEFTRIGHT: - strRet = "TWOV_LEFTRIGHT"; - break; - case TWOV_ALL: - strRet = "TWOV_ALL"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_PLANARCHUNKY: - switch(*pUint16) - { - case TWPC_CHUNKY: - strRet = "TWPC_CHUNKY"; - break; - case TWPC_PLANAR: - strRet = "TWPC_PLANAR"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_PIXELFLAVOR: - switch(*pUint16) - { - case TWPF_CHOCOLATE: - strRet = "TWPF_CHOCOLATE"; - break; - case TWPF_VANILLA: - strRet = "TWPF_VANILLA"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_PRINTERMODE: - switch(*pUint16) - { - case TWPM_SINGLESTRING: - strRet = "TWPM_SINGLESTRING"; - break; - case TWPM_MULTISTRING: - strRet = "TWPM_MULTISTRING"; - break; - case TWPM_COMPOUNDSTRING: - strRet = "TWPM_COMPOUNDSTRING"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_PRINTER: - switch(*pUint16) - { - case TWPR_IMPRINTERTOPBEFORE: - strRet = "TWPR_IMPRINTERTOPBEFORE"; - break; - case TWPR_IMPRINTERTOPAFTER: - strRet = "TWPR_IMPRINTERTOPAFTER"; - break; - case TWPR_IMPRINTERBOTTOMBEFORE: - strRet = "TWPR_IMPRINTERBOTTOMBEFORE"; - break; - case TWPR_IMPRINTERBOTTOMAFTER: - strRet = "TWPR_IMPRINTERBOTTOMAFTER"; - break; - case TWPR_ENDORSERTOPBEFORE: - strRet = "TWPR_ENDORSERTOPBEFORE"; - break; - case TWPR_ENDORSERTOPAFTER: - strRet = "TWPR_ENDORSERTOPAFTER"; - break; - case TWPR_ENDORSERBOTTOMBEFORE: - strRet = "TWPR_ENDORSERBOTTOMBEFORE"; - break; - case TWPR_ENDORSERBOTTOMAFTER: - strRet = "TWPR_ENDORSERBOTTOMAFTER"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_POWERSUPPLY: - switch(*pUint16) - { - case TWPS_EXTERNAL: - strRet = "TWPS_EXTERNAL"; - break; - case TWPS_BATTERY: - strRet = "TWPS_BATTERY"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_PIXELTYPE: - switch(*pUint16) - { - case TWPT_BW: - strRet = "TWPT_BW"; - break; - case TWPT_GRAY: - strRet = "TWPT_GRAY"; - break; - case TWPT_RGB: - strRet = "TWPT_RGB"; - break; - case TWPT_PALETTE: - strRet = "TWPT_PALETTE"; - break; - case TWPT_CMY: - strRet = "TWPT_CMY"; - break; - case TWPT_CMYK: - strRet = "TWPT_CMYK"; - break; - case TWPT_YUV: - strRet = "TWPT_YUV"; - break; - case TWPT_YUVK: - strRet = "TWPT_YUVK"; - break; - case TWPT_CIEXYZ: - strRet = "TWPT_CIEXYZ"; - break; - case TWPT_LAB: - strRet = "TWPT_LAB"; - break; - case TWPT_SRGB: - strRet = "TWPT_SRGB"; - break; - case TWPT_SCRGB: - strRet = "TWPT_SCRGB"; - break; - case TWPT_INFRARED: - strRet = "TWPT_INFRARED"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_SEGMENTED: - switch(*pUint16) - { - case TWSG_NONE: - strRet = "TWSG_NONE"; - break; - case TWSG_AUTO: - strRet = "TWSG_AUTO"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_SUPPORTEDSIZES: - switch(*pUint16) - { - case TWSS_NONE: - strRet = "TWSS_NONE"; - break; - case TWSS_A4: - strRet = "TWSS_A4"; - break; - case TWSS_JISB5: - strRet = "TWSS_JISB5"; - break; - case TWSS_USLETTER: - strRet = "TWSS_USLETTER"; - break; - case TWSS_USLEGAL: - strRet = "TWSS_USLEGAL"; - break; - case TWSS_A5: - strRet = "TWSS_A5"; - break; - case TWSS_ISOB4: - strRet = "TWSS_ISOB4"; - break; - case TWSS_ISOB6: - strRet = "TWSS_ISOB6"; - break; - case TWSS_USLEDGER: - strRet = "TWSS_USLEDGER"; - break; - case TWSS_USEXECUTIVE: - strRet = "TWSS_USEXECUTIVE"; - break; - case TWSS_A3: - strRet = "TWSS_A3"; - break; - case TWSS_ISOB3: - strRet = "TWSS_ISOB3"; - break; - case TWSS_A6: - strRet = "TWSS_A6"; - break; - case TWSS_C4: - strRet = "TWSS_C4"; - break; - case TWSS_C5: - strRet = "TWSS_C5"; - break; - case TWSS_C6: - strRet = "TWSS_C6"; - break; - case TWSS_4A0: - strRet = "TWSS_4A0"; - break; - case TWSS_2A0: - strRet = "TWSS_2A0"; - break; - case TWSS_A0: - strRet = "TWSS_A0"; - break; - case TWSS_A1: - strRet = "TWSS_A1"; - break; - case TWSS_A2: - strRet = "TWSS_A2"; - break; - case TWSS_A7: - strRet = "TWSS_A7"; - break; - case TWSS_A8: - strRet = "TWSS_A8"; - break; - case TWSS_A9: - strRet = "TWSS_A9"; - break; - case TWSS_A10: - strRet = "TWSS_A10"; - break; - case TWSS_ISOB0: - strRet = "TWSS_ISOB0"; - break; - case TWSS_ISOB1: - strRet = "TWSS_ISOB1"; - break; - case TWSS_ISOB2: - strRet = "TWSS_ISOB2"; - break; - case TWSS_ISOB5: - strRet = "TWSS_ISOB5"; - break; - case TWSS_ISOB7: - strRet = "TWSS_ISOB7"; - break; - case TWSS_ISOB8: - strRet = "TWSS_ISOB8"; - break; - case TWSS_ISOB9: - strRet = "TWSS_ISOB9"; - break; - case TWSS_ISOB10: - strRet = "TWSS_ISOB10"; - break; - case TWSS_JISB0: - strRet = "TWSS_JISB0"; - break; - case TWSS_JISB1: - strRet = "TWSS_JISB1"; - break; - case TWSS_JISB2: - strRet = "TWSS_JISB2"; - break; - case TWSS_JISB3: - strRet = "TWSS_JISB3"; - break; - case TWSS_JISB4: - strRet = "TWSS_JISB4"; - break; - case TWSS_JISB6: - strRet = "TWSS_JISB6"; - break; - case TWSS_JISB7: - strRet = "TWSS_JISB7"; - break; - case TWSS_JISB8: - strRet = "TWSS_JISB8"; - break; - case TWSS_JISB9: - strRet = "TWSS_JISB9"; - break; - case TWSS_JISB10: - strRet = "TWSS_JISB10"; - break; - case TWSS_C0: - strRet = "TWSS_C0"; - break; - case TWSS_C1: - strRet = "TWSS_C1"; - break; - case TWSS_C2: - strRet = "TWSS_C2"; - break; - case TWSS_C3: - strRet = "TWSS_C3"; - break; - case TWSS_C7: - strRet = "TWSS_C7"; - break; - case TWSS_C8: - strRet = "TWSS_C8"; - break; - case TWSS_C9: - strRet = "TWSS_C9"; - break; - case TWSS_C10: - strRet = "TWSS_C10"; - break; - case TWSS_USSTATEMENT: - strRet = "TWSS_USSTATEMENT"; - break; - case TWSS_BUSINESSCARD: - strRet = "TWSS_BUSINESSCARD"; - break; - case TWSS_MAXSIZE: - strRet = "TWSS_MAXSIZE"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_XFERMECH: - switch(*pUint16) - { - case TWSX_NATIVE: - strRet = "TWSX_NATIVE"; - break; - case TWSX_FILE: - strRet = "TWSX_FILE"; - break; - case TWSX_MEMORY: - strRet = "TWSX_MEMORY"; - break; - case TWSX_MEMFILE: - strRet = "TWSX_MEMFILE"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case ICAP_UNITS: - switch(*pUint16) - { - case TWUN_INCHES: - strRet = "TWUN_INCHES"; - break; - case TWUN_CENTIMETERS: - strRet = "TWUN_CENTIMETERS"; - break; - case TWUN_PICAS: - strRet = "TWUN_PICAS"; - break; - case TWUN_POINTS: - strRet = "TWUN_POINTS"; - break; - case TWUN_TWIPS: - strRet = "TWUN_TWIPS"; - break; - case TWUN_PIXELS: - strRet = "TWUN_PIXELS"; - break; - case TWUN_MILLIMETERS: - strRet = "TWUN_MILLIMETERS"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - case CAP_LANGUAGE: - switch(*pUint16) - { - case TWLG_USERLOCALE: - strRet = "TWLG_USERLOCALE"; - break; - case TWLG_DANISH: - strRet = "TWLG_DANISH"; - break; - case TWLG_DUTCH: - strRet = "TWLG_DUTCH"; - break; - case TWLG_ENGLISH: - strRet = "TWLG_ENGLISH"; - break; - case TWLG_FRENCH_CANADIAN: - strRet = "TWLG_FRENCH_CANADIAN"; - break; - case TWLG_FINNISH: - strRet = "TWLG_FINNISH"; - break; - case TWLG_FRENCH: - strRet = "TWLG_FRENCH"; - break; - case TWLG_GERMAN: - strRet = "TWLG_GERMAN"; - break; - case TWLG_ICELANDIC: - strRet = "TWLG_ICELANDIC"; - break; - case TWLG_ITALIAN: - strRet = "TWLG_ITALIAN"; - break; - case TWLG_NORWEGIAN: - strRet = "TWLG_NORWEGIAN"; - break; - case TWLG_PORTUGUESE: - strRet = "TWLG_PORTUGUESE"; - break; - case TWLG_SPANISH: - strRet = "TWLG_SPANISH"; - break; - case TWLG_SWEDISH: - strRet = "TWLG_SWEDISH"; - break; - case TWLG_ENGLISH_USA: - strRet = "TWLG_ENGLISH_USA"; - break; - case TWLG_AFRIKAANS: - strRet = "TWLG_AFRIKAANS"; - break; - case TWLG_ALBANIA: - strRet = "TWLG_ALBANIA"; - break; - case TWLG_ARABIC: - strRet = "TWLG_ARABIC"; - break; - case TWLG_ARABIC_ALGERIA: - strRet = "TWLG_ARABIC_ALGERIA"; - break; - case TWLG_ARABIC_BAHRAIN: - strRet = "TWLG_ARABIC_BAHRAIN"; - break; - case TWLG_ARABIC_EGYPT: - strRet = "TWLG_ARABIC_EGYPT"; - break; - case TWLG_ARABIC_IRAQ: - strRet = "TWLG_ARABIC_IRAQ"; - break; - case TWLG_ARABIC_JORDAN: - strRet = "TWLG_ARABIC_JORDAN"; - break; - case TWLG_ARABIC_KUWAIT: - strRet = "TWLG_ARABIC_KUWAIT"; - break; - case TWLG_ARABIC_LEBANON: - strRet = "TWLG_ARABIC_LEBANON"; - break; - case TWLG_ARABIC_LIBYA: - strRet = "TWLG_ARABIC_LIBYA"; - break; - case TWLG_ARABIC_MOROCCO: - strRet = "TWLG_ARABIC_MOROCCO"; - break; - case TWLG_ARABIC_OMAN: - strRet = "TWLG_ARABIC_OMAN"; - break; - case TWLG_ARABIC_QATAR: - strRet = "TWLG_ARABIC_QATAR"; - break; - case TWLG_ARABIC_SAUDIARABIA: - strRet = "TWLG_ARABIC_SAUDIARABIA"; - break; - case TWLG_ARABIC_SYRIA: - strRet = "TWLG_ARABIC_SYRIA"; - break; - case TWLG_ARABIC_TUNISIA: - strRet = "TWLG_ARABIC_TUNISIA"; - break; - case TWLG_ARABIC_UAE: - strRet = "TWLG_ARABIC_UAE"; - break; - case TWLG_ARABIC_YEMEN: - strRet = "TWLG_ARABIC_YEMEN"; - break; - case TWLG_BASQUE: - strRet = "TWLG_BASQUE"; - break; - case TWLG_BYELORUSSIAN: - strRet = "TWLG_BYELORUSSIAN"; - break; - case TWLG_BULGARIAN: - strRet = "TWLG_BULGARIAN"; - break; - case TWLG_CATALAN: - strRet = "TWLG_CATALAN"; - break; - case TWLG_CHINESE: - strRet = "TWLG_CHINESE"; - break; - case TWLG_CHINESE_HONGKONG: - strRet = "TWLG_CHINESE_HONGKONG"; - break; - case TWLG_CHINESE_PRC: - strRet = "TWLG_CHINESE_PRC"; - break; - case TWLG_CHINESE_SINGAPORE: - strRet = "TWLG_CHINESE_SINGAPORE"; - break; - case TWLG_CHINESE_SIMPLIFIED: - strRet = "TWLG_CHINESE_SIMPLIFIED"; - break; - case TWLG_CHINESE_TAIWAN: - strRet = "TWLG_CHINESE_TAIWAN"; - break; - case TWLG_CHINESE_TRADITIONAL: - strRet = "TWLG_CHINESE_TRADITIONAL"; - break; - case TWLG_CROATIA: - strRet = "TWLG_CROATIA"; - break; - case TWLG_CZECH: - strRet = "TWLG_CZECH"; - break; - case TWLG_DUTCH_BELGIAN: - strRet = "TWLG_DUTCH_BELGIAN"; - break; - case TWLG_ENGLISH_AUSTRALIAN: - strRet = "TWLG_ENGLISH_AUSTRALIAN"; - break; - case TWLG_ENGLISH_CANADIAN: - strRet = "TWLG_ENGLISH_CANADIAN"; - break; - case TWLG_ENGLISH_IRELAND: - strRet = "TWLG_ENGLISH_IRELAND"; - break; - case TWLG_ENGLISH_NEWZEALAND: - strRet = "TWLG_ENGLISH_NEWZEALAND"; - break; - case TWLG_ENGLISH_SOUTHAFRICA: - strRet = "TWLG_ENGLISH_SOUTHAFRICA"; - break; - case TWLG_ENGLISH_UK: - strRet = "TWLG_ENGLISH_UK"; - break; - case TWLG_ESTONIAN: - strRet = "TWLG_ESTONIAN"; - break; - case TWLG_FAEROESE: - strRet = "TWLG_FAEROESE"; - break; - case TWLG_FARSI: - strRet = "TWLG_FARSI"; - break; - case TWLG_FRENCH_BELGIAN: - strRet = "TWLG_FRENCH_BELGIAN"; - break; - case TWLG_FRENCH_LUXEMBOURG: - strRet = "TWLG_FRENCH_LUXEMBOURG"; - break; - case TWLG_FRENCH_SWISS: - strRet = "TWLG_FRENCH_SWISS"; - break; - case TWLG_GERMAN_AUSTRIAN: - strRet = "TWLG_GERMAN_AUSTRIAN"; - break; - case TWLG_GERMAN_LUXEMBOURG: - strRet = "TWLG_GERMAN_LUXEMBOURG"; - break; - case TWLG_GERMAN_LIECHTENSTEIN: - strRet = "TWLG_GERMAN_LIECHTENSTEIN"; - break; - case TWLG_GERMAN_SWISS: - strRet = "TWLG_GERMAN_SWISS"; - break; - case TWLG_GREEK: - strRet = "TWLG_GREEK"; - break; - case TWLG_HEBREW: - strRet = "TWLG_HEBREW"; - break; - case TWLG_HUNGARIAN: - strRet = "TWLG_HUNGARIAN"; - break; - case TWLG_INDONESIAN: - strRet = "TWLG_INDONESIAN"; - break; - case TWLG_ITALIAN_SWISS: - strRet = "TWLG_ITALIAN_SWISS"; - break; - case TWLG_JAPANESE: - strRet = "TWLG_JAPANESE"; - break; - case TWLG_KOREAN: - strRet = "TWLG_KOREAN"; - break; - case TWLG_KOREAN_JOHAB: - strRet = "TWLG_KOREAN_JOHAB"; - break; - case TWLG_LATVIAN: - strRet = "TWLG_LATVIAN"; - break; - case TWLG_LITHUANIAN: - strRet = "TWLG_LITHUANIAN"; - break; - case TWLG_NORWEGIAN_BOKMAL: - strRet = "TWLG_NORWEGIAN_BOKMAL"; - break; - case TWLG_NORWEGIAN_NYNORSK: - strRet = "TWLG_NORWEGIAN_NYNORSK"; - break; - case TWLG_POLISH: - strRet = "TWLG_POLISH"; - break; - case TWLG_PORTUGUESE_BRAZIL: - strRet = "TWLG_PORTUGUESE_BRAZIL"; - break; - case TWLG_ROMANIAN: - strRet = "TWLG_ROMANIAN"; - break; - case TWLG_RUSSIAN: - strRet = "TWLG_RUSSIAN"; - break; - case TWLG_SERBIAN_LATIN: - strRet = "TWLG_SERBIAN_LATIN"; - break; - case TWLG_SLOVAK: - strRet = "TWLG_SLOVAK"; - break; - case TWLG_SLOVENIAN: - strRet = "TWLG_SLOVENIAN"; - break; - case TWLG_SPANISH_MEXICAN: - strRet = "TWLG_SPANISH_MEXICAN"; - break; - case TWLG_SPANISH_MODERN: - strRet = "TWLG_SPANISH_MODERN"; - break; - case TWLG_THAI: - strRet = "TWLG_THAI"; - break; - case TWLG_TURKISH: - strRet = "TWLG_TURKISH"; - break; - case TWLG_UKRANIAN: - strRet = "TWLG_UKRANIAN"; - break; - case TWLG_ASSAMESE: - strRet = "TWLG_ASSAMESE"; - break; - case TWLG_BENGALI: - strRet = "TWLG_BENGALI"; - break; - case TWLG_BIHARI: - strRet = "TWLG_BIHARI"; - break; - case TWLG_BODO: - strRet = "TWLG_BODO"; - break; - case TWLG_DOGRI: - strRet = "TWLG_DOGRI"; - break; - case TWLG_GUJARATI: - strRet = "TWLG_GUJARATI"; - break; - case TWLG_HARYANVI: - strRet = "TWLG_HARYANVI"; - break; - case TWLG_HINDI: - strRet = "TWLG_HINDI"; - break; - case TWLG_KANNADA: - strRet = "TWLG_KANNADA"; - break; - case TWLG_KASHMIRI: - strRet = "TWLG_KASHMIRI"; - break; - case TWLG_MALAYALAM: - strRet = "TWLG_MALAYALAM"; - break; - case TWLG_MARATHI: - strRet = "TWLG_MARATHI"; - break; - case TWLG_MARWARI: - strRet = "TWLG_MARWARI"; - break; - case TWLG_MEGHALAYAN: - strRet = "TWLG_MEGHALAYAN"; - break; - case TWLG_MIZO: - strRet = "TWLG_MIZO"; - break; - case TWLG_NAGA: - strRet = "TWLG_NAGA"; - break; - case TWLG_ORISSI: - strRet = "TWLG_ORISSI"; - break; - case TWLG_PUNJABI: - strRet = "TWLG_PUNJABI"; - break; - case TWLG_PUSHTU: - strRet = "TWLG_PUSHTU"; - break; - case TWLG_SERBIAN_CYRILLIC: - strRet = "TWLG_SERBIAN_CYRILLIC"; - break; - case TWLG_SIKKIMI: - strRet = "TWLG_SIKKIMI"; - break; - case TWLG_SWEDISH_FINLAND: - strRet = "TWLG_SWEDISH_FINLAND"; - break; - case TWLG_TAMIL: - strRet = "TWLG_TAMIL"; - break; - case TWLG_TELUGU: - strRet = "TWLG_TELUGU"; - break; - case TWLG_TRIPURI: - strRet = "TWLG_TRIPURI"; - break; - case TWLG_URDU: - strRet = "TWLG_URDU"; - break; - case TWLG_VIETNAMESE: - strRet = "TWLG_VIETNAMESE"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "0x%04X", *pUint16); - strRet = buff; - } - break; - } - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Un-recognized Capability 0x%04X", twCapId); - strRet = buff; - } - break; - } - } - return strRet; -} - -const char *convertFileType_toString(const TW_UINT16 _nItem) -{ - const char *strRet = NULL; - switch(_nItem) - { - case TWFY_CAMERA: - strRet = "TWFY_CAMERA"; - break; - case TWFY_CAMERATOP: - strRet = "TWFY_CAMERATOP"; - break; - case TWFY_CAMERABOTTOM: - strRet = "TWFY_CAMERABOTTOM"; - break; - case TWFY_CAMERAPREVIEW: - strRet = "TWFY_CAMERAPREVIEW"; - break; - case TWFY_DOMAIN: - strRet = "TWFY_DOMAIN"; - break; - case TWFY_HOST: - strRet = "TWFY_HOST"; - break; - case TWFY_DIRECTORY: - strRet = "TWFY_DIRECTORY"; - break; - case TWFY_IMAGE: - strRet = "TWFY_IMAGE"; - break; - case TWFY_UNKNOWN: - strRet = "TWFY_UNKNOWN"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Un-recognized FileType 0x%04X", _nItem); - strRet = buff; - } - break; - } - return strRet; -} - -const char *convertFileFormat_toString(const TW_UINT16 _nItem) -{ - return CapabilityValueToString(ICAP_IMAGEFILEFORMAT, TWTY_UINT16, &_nItem); -} - -const char *convertEOJ_toString(const TW_UINT16 _nItem) -{ - const char *strRet = NULL; - switch(_nItem) - { - case TWEJ_NONE: - strRet = "TWEJ_NONE"; - break; - case TWEJ_MIDSEPARATOR: - strRet = "TWEJ_MIDSEPARATOR"; - break; - case TWEJ_PATCH1: - strRet = "TWEJ_PATCH1"; - break; - case TWEJ_PATCH2: - strRet = "TWEJ_PATCH2"; - break; - case TWEJ_PATCH3: - strRet = "TWEJ_PATCH3"; - break; - case TWEJ_PATCH4: - strRet = "TWEJ_PATCH4"; - break; - case TWEJ_PATCH6: - strRet = "TWEJ_PATCH6"; - break; - case TWEJ_PATCHT: - strRet = "TWEJ_PATCHT"; - break; - default: - { - char * buff = nextTempBuffer(); - SSNPRINTF(buff, TEMPBUFSIZE, TEMPBUFSIZE, "Un-recognized FileType 0x%04X", _nItem); - strRet = buff; - } - break; - } - return strRet; -} - diff --git a/TwainString.h b/TwainString.h deleted file mode 100644 index 22f183b..0000000 --- a/TwainString.h +++ /dev/null @@ -1,499 +0,0 @@ -/*************************************************************************** -* Copyright ?2007 TWAIN Working Group: -* Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company, -* Fujitsu Computer Products of America, JFL Peripheral Solutions Inc., -* Ricoh Corporation, and Xerox Corporation. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the TWAIN Working Group nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -***************************************************************************/ - -/** - * @file TwainString.h - * Convert TWAIN Constants to Strings - * @author JFL Peripheral Solutions Inc. - * @date Dec 2008 - */ - - -#ifndef __TWAINSTRING_H__ -#define __TWAINSTRING_H__ - -#pragma once - -#include "CommonTWAIN.h" - -typedef const char*(*pfnStringCvrtFuncType)(const TW_UINT16 _unItem); - -/** -* converts the integer CAP value into string form -* @param[in] _unCap the cap -* @return the equivalent cap string -*/ -const char* convertCAP_toString(const TW_UINT16 _unCap); - -/** -* converts the integer CAP transfer method into string form -* @param[in] _unCap the cap -* @param[in] _unItem the value -* @param[in] _unType the TWAIN Type of the item -* @return the equivalent string -*/ -const char* convertCAP_Item_toString(const TW_UINT16 _unCap, const TW_UINT32 _unItem, const TW_UINT16 _unType); - -/** -* converts the integer CAP transfer method into string form -* @param[in] _unEI the ExtendedImageInfo -* @param[in] _unItem the value -* @return the equivalent string, or NULL if not found -*/ -const char* convertEI_Item_toString(const TW_UINT16 _unEI, const TW_UINT32 _unItem); - -/** -* converts the integer CAP transfer method into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_XFERMECH_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP unit into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_UNITS_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Pixel type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_PIXELTYPE_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Pixel flavor value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_PIXELFLAVOR_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Image File format type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_IMAGEFILEFORMAT_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Image File format type value into .xxx extention string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_IMAGEFILEFORMAT_toExt(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Compression type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_COMPRESSION_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Alarms type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_ALARMS_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP AutoSize type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_AUTOSIZE_toString(const TW_UINT16 _unItem); - -/** -* converts the integer ICAP BarCode Search Mode type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_BARCODESEARCHMODE_toString(const TW_UINT16 _unItem); - -/** -* converts the integer ICAP Bit Order type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_BITORDER_toString(const TW_UINT16 _unItem); - -/** -* converts the integer ICAP Auto discard blank pages type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_AUTODISCARDBLANKPAGES_toString(const TW_UINT16 _unItem); - -/** -* converts the integer ICAP Bitdepth Reduction type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_BITDEPTHREDUCTION_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Supported Barcode Types type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_SUPPORTEDBARCODETYPES_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Cameraside type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_CAMERASIDE_toString(const TW_UINT16 _unItem); - -/** -* converts the integer TWEI Pageside type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertTWEI_PAGESIDE_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP ClearBuffers type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_CLEARBUFFERS_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Device Event type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_DEVICEEVENT_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Duplex type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_DUPLEX_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Feeder Alignment type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_FEEDERALIGNMENT_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Feeder Type type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_FEEDERTYPE_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Flash used2 type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_FLASHUSED2_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Feeder Order type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_FEEDERORDER_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Feeder Pocket type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_FEEDERPOCKET_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Flip Rotation type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_FLIPROTATION_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Filter type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_FILTER_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP ICC Profile type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_ICCPROFILE_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Image Filter type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_IMAGEFILTER_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Image Merge type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_IMAGEMERGE_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Job Control type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_JOBCONTROL_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP JPEG Quality type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_JPEGQUALITY_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Light Path type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_LIGHTPATH_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Light Source type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_LIGHTSOURCE_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Noise Filter type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_NOISEFILTER_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Orientation type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_ORIENTATION_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Overscan type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_OVERSCAN_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Planar Chunky type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_PLANARCHUNKY_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Printer Mode type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_PRINTERMODE_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Printer type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_PRINTER_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Power Supply type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_POWERSUPPLY_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Segmented type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertCAP_SEGMENTED_toString(const TW_UINT16 _unItem); - -/** -* converts the integer CAP Supported Sizes type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertICAP_SUPPORTEDSIZES_toString(const TW_UINT16 _unItem); - -/** -* converts the integer TWEI File System type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertTWEI_FILESYSTEM_toString(const TW_UINT16 _unItem); - -/** -* converts the integer TWEI Barcode Rotation type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertTWEI_BARCODEROTATION_toString(const TW_UINT16 _unItem); - -/** -* converts the integer TWEI Deskew Status type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertTWEI_DESKEWSTATUS_toString(const TW_UINT16 _unItem); - -/** -* converts the integer TWEI MAG Type type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertTWEI_MAGTYPE_toString(const TW_UINT16 _unItem); - -/** -* converts the integer TWEI Patch code type value into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertTWEI_PATCHCODE_toString(const TW_UINT16 _unItem); - -/** -* converts the integer TWTY value into string form -* @param[in] _unItem the TWTY value -* @return the equivalent string -*/ -const char* convertTWTY_toString(const TW_UINT16 _unItem); - -/** -* retrieve the extended image info name for a given Info ID for the current image -* @param[in] InfoID the id to retrieve the info of -* @return string of the extended image info -*/ -const char* convertExtImageInfoName_toString(int InfoID); - -/** -* retrieve the extended image info value for a given Info -* @param[in] ImgInfo the TW_INFO to retrieve the extended image info of -* @return string of the extended image info value -*/ -const char* convertExtImageInfoItem_toString(const TW_INFO &ImgInfo); - -/** -* converts the TWAIN Return Code into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertReturnCode_toString(const TW_UINT16 _unItem); - -/** -* converts the TWAIN Condition Code into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertConditionCode_toString(const TW_UINT16 _unItem); -/** -* converts the TWAIN Message into string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertMessage_toString(const TW_UINT16 _unItem); -/** -* converts the TWAIN Data Group to string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertDataGroup_toString(const TW_UINT16 _unItem); -/** -* converts the TWAIN Data Argument Type to string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertDataArgType_toString(const TW_UINT16 _unItem); -/** -* converts the TWAIN Container Type to string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertContainerType_toString(const TW_UINT16 _unItem); -/** -* converts the TWAIN QuerySupport value to string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char* convertQuerySupport_toString(const TW_UINT32 _unItem); -/** -* converts a TWAIN TWFF_ to the corresponding extension -* @param[in] _unItem the value -* @return the corresponding file extension -*/ -const char* convertFileFmt_toExtension(const TW_UINT16 _unItem); -/** -* converts a TWAIN Capability Item value to string form -* @param[in] twCapId the Id of the capability to convert -* @param[in] twItemType the type of the capability item -* @param[in] pValue a pointer to the item -* @return the equivalent string -*/ -const char *CapabilityValueToString(TW_UINT16 twCapId, TW_UINT16 twItemType, const void *pValue); -/** -* converts the TWAIN TWFY_ value to string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char *convertFileType_toString(const TW_UINT16 _unItem); -/** -* converts the TWAIN TWFF_ value to string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char *convertFileFormat_toString(const TW_UINT16 _unItem); -/** -* converts the TWAIN TWEJ_ value to string form -* @param[in] _unItem the value -* @return the equivalent string -*/ -const char *convertEOJ_toString(const TW_UINT16 _unItem); - -#endif // __TWAINSTRING_H__ diff --git a/TwainUIDlg.cpp b/TwainUIDlg.cpp deleted file mode 100644 index 8e0a387..0000000 Binary files a/TwainUIDlg.cpp and /dev/null differ diff --git a/TwainUIDlg.h b/TwainUIDlg.h deleted file mode 100644 index 84c3dc0..0000000 Binary files a/TwainUIDlg.h and /dev/null differ diff --git a/UsbScanEx.cpp b/UsbScanEx.cpp deleted file mode 100644 index 788b210..0000000 --- a/UsbScanEx.cpp +++ /dev/null @@ -1,335 +0,0 @@ -#include "stdafx.h" -#include "UsbScanEx.h" -#include -#include - -UsbScanEx::UsbScanEx(int index) -{ - m_h_dev = INVALID_HANDLE_VALUE; - timeout = 100; - m_h_index = index; - memset(ov, 0, sizeof(ov)); - CTRL_IN_OUT = 3; - for (int i = 0; i < (sizeof(ov) / sizeof(ov[0])); i++) - ov[i].hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); -} - -UsbScanEx::~UsbScanEx() -{ - if (m_h_dev != INVALID_HANDLE_VALUE) - close(); - - for (int i = 0; i < (sizeof(ov) / sizeof(ov[0])); i++) - CloseHandle(ov[i].hEvent); -} - -bool UsbScanEx::open() -{ - BOOL b_ret = FALSE; - TCHAR szDevPath[MAX_PATH] = { 0 }; - DWORD cbRet = 0; - - USBSCAN_TIMEOUT ut; - ut.TimeoutEvent = 1; - ut.TimeoutRead = 1; - ut.TimeoutWrite = 1; - - _stprintf(szDevPath, TEXT("\\\\.\\Usbscan%d"), m_h_index); - m_h_dev = CreateFile(szDevPath, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_FLAG_OVERLAPPED, - NULL); - if (m_h_dev != INVALID_HANDLE_VALUE) { - m_b_is_connected = TRUE; - b_ret = DeviceIoControl(m_h_dev, (DWORD)IOCTL_GET_PIPE_CONFIGURATION, - NULL, 0, &m_usbscan_config, sizeof(USBSCAN_PIPE_CONFIGURATION), - &cbRet, NULL); - if (b_ret && m_usbscan_config.NumberOfPipes > 0) { - for (int by_i = 0x00; (ULONG)by_i < m_usbscan_config.NumberOfPipes; by_i++) { - TCHAR szPipePath[MAX_PATH] = { 0 }; - _stprintf(szPipePath, TEXT("\\\\.\\Usbscan%d\\%d"), m_h_index, by_i); - m_usb_pipes[by_i].pipe_info = m_usbscan_config.PipeInfo[by_i]; - m_usb_pipes[by_i].h_pipe = CreateFile(szPipePath, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_FLAG_OVERLAPPED, - NULL); - if (m_usbscan_config.PipeInfo[by_i].PipeType == USBSCAN_PIPE_INTERRUPT) { - INT_IN = by_i; - } - else { - if (m_usbscan_config.PipeInfo[by_i].EndpointAddress & 0x80) { - BULK_IN = by_i; - } - else { - BULK_OUT = by_i; - } - } - b_ret = DeviceIoControl(m_usb_pipes[by_i].h_pipe, IOCTL_SET_TIMEOUT, &ut, sizeof(ut), NULL, 0, &cbRet, NULL); - } - } - } - else { - CloseHandle(m_h_dev); - m_h_dev = INVALID_HANDLE_VALUE; - } - return m_h_dev; -} - -bool UsbScanEx::close() -{ - BOOL b_ret = FALSE; - BYTE by_i = 0x00; - - if (m_h_dev != INVALID_HANDLE_VALUE) { - BOOL bState = FALSE; - DWORD cbRet = 0; - OVERLAPPED overlapped; - PIPE_TYPE pipeType = ALL_PIPE; - - memset(&overlapped, 0, sizeof(OVERLAPPED)); - overlapped.hEvent = - CreateEvent(NULL, // pointer to security attributes - FALSE, // automatic reset - FALSE, // initialize to nosignaled - NULL); // pointer to the event-object name - bState = - DeviceIoControl(m_h_dev, - (DWORD)IOCTL_CANCEL_IO, - (LPVOID)&pipeType, - sizeof(PIPE_TYPE), - NULL, - 0, - &cbRet, - &overlapped); - WaitForSingleObject(overlapped.hEvent, 1000); - CloseHandle(overlapped.hEvent); - - for (by_i = 0x00; by_i < m_usbscan_config.NumberOfPipes; by_i++) { - CancelIo(m_usb_pipes[by_i].h_pipe); - CloseHandle(m_usb_pipes[by_i].h_pipe); - m_usb_pipes[by_i].h_pipe = INVALID_HANDLE_VALUE; - } - - CancelIo(m_h_dev); - b_ret = CloseHandle(m_h_dev); - if (b_ret) { - m_h_dev = INVALID_HANDLE_VALUE; - b_ret = TRUE; - } - } - m_b_is_connected = FALSE; - return b_ret; -} - -void UsbScanEx::set_timeout(int timeout) -{ - this->timeout = timeout; -} - -int UsbScanEx::read_bulk(void* data, int len) -{ - BOOL b_ret = FALSE; - HANDLE h_pipe = m_usb_pipes[BULK_IN].h_pipe; - unsigned long pdw_ret = len; - LPOVERLAPPED lp_overlap = ov+BULK_IN; - lp_overlap->Internal = 0; - lp_overlap->InternalHigh = 0; - lp_overlap->Offset = 0; - lp_overlap->OffsetHigh = 0; - lp_overlap->Pointer = 0; - - if (m_h_dev != NULL) { - b_ret = ReadFile(h_pipe, data, len, &pdw_ret, lp_overlap); - - if (b_ret) { - return pdw_ret; - } - else { - switch (GetLastError()) - { - case ERROR_IO_PENDING: - GetOverlappedResult(h_pipe, lp_overlap, &pdw_ret, TRUE); - return pdw_ret; - - case ERROR_FILE_NOT_FOUND: - m_b_is_connected = false; - break; - default: - int a = 0; - break; - } - } - } - return 0; -} - -int UsbScanEx::write_bulk(void* data, int len) -{ - BOOL b_ret = FALSE; - HANDLE h_pipe = m_usb_pipes[BULK_OUT].h_pipe; - void* p_data = data; - unsigned long dw_size = len; - - LPOVERLAPPED lp_overlap = ov + BULK_OUT; - - if (m_h_dev == INVALID_HANDLE_VALUE) - return TRUE; - - b_ret = WriteFile(h_pipe, p_data, dw_size, &dw_size, lp_overlap); - if (b_ret) { - return dw_size; - } - else { - switch (GetLastError()) - { - case ERROR_IO_PENDING: - GetOverlappedResult(h_pipe, lp_overlap, &dw_size, TRUE); - return dw_size; - - case ERROR_FILE_NOT_FOUND: - m_b_is_connected = false; - break; - default: - int a = 0; - break; - } - } - return 0; -} - -int UsbScanEx::control_msg(int rtype, int req, int value, int index, int len, void* data) -{ - BOOL b_ret = FALSE; - _IO_BLOCK_EX irp; - DWORD dw_ret; - - if (m_h_dev == INVALID_HANDLE_VALUE) - return TRUE; - irp.uOffset = value; - irp.uLength = len; - irp.uIndex = index; - irp.pbyData = (LPBYTE)data; - irp.fTransferDirectionIn = (rtype >> 7); - irp.bRequest = req; - irp.bmRequestType = (rtype >> 5) & 0x03; - - LPOVERLAPPED lp_overlap = ov + CTRL_IN_OUT; - b_ret = DeviceIoControl(m_h_dev, IOCTL_SEND_USB_REQUEST, &irp, sizeof(irp), data, len, &dw_ret, lp_overlap); - - if (!b_ret) - b_ret = WaitForSingleObject(lp_overlap->hEvent, timeout) == WAIT_OBJECT_0; - - return b_ret; -} - -bool UsbScanEx::is_open() -{ - return m_h_dev != INVALID_HANDLE_VALUE; -} - -bool UsbScanEx::is_connected() -{ - return is_open();//m_b_is_connected; -} - -int UsbScanEx::read_int(void* data, int len) -{ - BOOL b_ret = FALSE; - DWORD dw_ret = 0L; - HANDLE h_pipe = m_usb_pipes[INT_IN].h_pipe; - LPOVERLAPPED lp_overlap = ov + INT_IN; - - if (m_h_dev == INVALID_HANDLE_VALUE) - return FALSE; - - b_ret = DeviceIoControl(h_pipe, (DWORD)IOCTL_WAIT_ON_DEVICE_EVENT, NULL, 0, - data, len, &dw_ret, lp_overlap); - - if (b_ret) { - return dw_ret; - } - else { - switch (GetLastError()) - { - case ERROR_IO_PENDING: - GetOverlappedResult(h_pipe, lp_overlap, &dw_ret, TRUE); - return dw_ret; - - case ERROR_FILE_NOT_FOUND: - m_b_is_connected = false; - break; - default: - break; - } - } - - return 0; -} - -UsbScan_List::~UsbScan_List() -{ -} - -std::list> UsbScan_List::find_all() -{ - auto devs = find_all_usb(); - std::list> usbs; - for (auto inter = devs.begin(); inter != devs.end(); inter++) { - usbs.push_back(std::shared_ptr(new UsbScanEx(inter->index))); - } - return usbs; -} - -std::list> UsbScan_List::find_vid_pid(int vid, int pid) -{ - auto devs = find_all_usb(); - std::list> usbs; - for (auto inter = devs.begin(); inter != devs.end(); inter++) { - if (inter->vid == vid && inter->pid == pid) - usbs.push_back(std::shared_ptr(new UsbScanEx(inter->index))); - } - return usbs; -} - -std::list UsbScan_List::find_all_usb() -{ - BOOL b_ret = FALSE; - DWORD cbRet = 0; - TCHAR szDevPath[MAX_PATH] = { 0 }; - DEVICE_DESCRIPTOR dev_desc; - HANDLE h_dev; - std::list usbs; - usb_scan_dev_info dev_info; - - for (int i = 0; i < 1024; i++) { - - _stprintf(szDevPath, TEXT("\\\\.\\Usbscan%d"), i); - h_dev = CreateFile(szDevPath, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_FLAG_OVERLAPPED, - NULL); - if (h_dev != INVALID_HANDLE_VALUE) { - b_ret = DeviceIoControl(h_dev, (DWORD)IOCTL_GET_DEVICE_DESCRIPTOR, - &dev_desc, sizeof(dev_desc), &dev_desc, sizeof(dev_desc), - &cbRet, NULL); - if (b_ret != 0) { - dev_info.index = i; - dev_info.vid = dev_desc.usVendorId; - dev_info.pid = dev_desc.usProductId; - usbs.push_back(dev_info); - } - CloseHandle(h_dev); - } - } - - return usbs; -} diff --git a/UsbScanEx.h b/UsbScanEx.h deleted file mode 100644 index fd30b89..0000000 --- a/UsbScanEx.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include "IUsb.h" - - -#pragma pack(1) -struct tag_usb_pipe -{ - HANDLE h_pipe; - USBSCAN_PIPE_INFORMATION pipe_info; - OVERLAPPED overlap; -}; -typedef struct tag_usb_pipe usb_pipe_t, * pusb_pipe_t; -#pragma pack() - -typedef struct tag_usb_scan_dev_info -{ - WORD vid; - WORD pid; - WORD index; -}usb_scan_dev_info, * pusb_scan_dev_info; - -typedef struct tag_usb_scan_dev -{ - USHORT _NumberOfDevs; - tag_usb_scan_dev_info dev_infos[1024]; -}usb_scan_dev, * pusb_scan_dev; - -class UsbScanEx : public IUsb -{ -public: - UsbScanEx(int index); - virtual ~UsbScanEx(); - // 通过 IUsb 继承 - virtual bool open() override; - virtual bool close() override; - virtual void set_timeout(int timeout) override; - virtual int read_bulk(void *data, int len) override; - virtual int write_bulk(void *data, int len) override; - virtual int control_msg(int rtype, int req, int value, int index, int len, void* data) override; - virtual bool is_open() override; - virtual bool is_connected() override; - virtual int read_int(void* data, int len) override; - -private: - - int BULK_OUT; - int BULK_IN; - int INT_IN; - int CTRL_IN_OUT; - USBSCAN_PIPE_CONFIGURATION m_usbscan_config; - usb_pipe_t m_usb_pipes[MAX_NUM_PIPES]; - HANDLE m_h_dev; - bool m_b_is_connected; - int m_h_index; - int timeout; - OVERLAPPED ov[4]; -}; - - -class UsbScan_List -{ -public: - ~UsbScan_List(); - - static std::list> find_all(); - static std::list> find_vid_pid(int vid, int pid); - -private: - static std::list find_all_usb(); - UsbScan_List(); - UsbScan_List(uint16_t vendor_id, uint16_t product_id); -}; diff --git a/cJSON.cpp b/cJSON.cpp deleted file mode 100644 index 866e37c..0000000 --- a/cJSON.cpp +++ /dev/null @@ -1,1088 +0,0 @@ -/* - Copyright (c) 2009 Dave Gamble - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - */ - -/* cJSON */ -/* JSON parser in C. */ -#include "stdafx.h" -#include -#include -#include -#include -#include -#include -#include -#include "cJSON.h" - - -static const char *ep; - -const char *cJSON_GetErrorPtr() -{ - return ep; -} - -static int cJSON_strcasecmp(const char *s1, const char *s2) -{ - if (!s1) - return (s1 == s2) ? 0 : 1; - if (!s2) - return 1; - for (; tolower(*s1) == tolower(*s2); ++s1, ++s2) - if (*s1 == 0) - return 0; - return tolower(*(const unsigned char *)s1) - - tolower(*(const unsigned char *)s2); -} - -static void *(*cJSON_malloc)(size_t sz) = malloc; -static void (*cJSON_free)(void *ptr) = free; - -static char* cJSON_strdup(const char* str) -{ - size_t len; - char* copy; - - len = strlen(str) + 1; - if (!(copy = (char*) cJSON_malloc(len))) - return 0; - memcpy(copy, str, len); - return copy; -} - -void cJSON_InitHooks(cJSON_Hooks* hooks) -{ - if (!hooks) - { /* Reset hooks */ - cJSON_malloc = malloc; - cJSON_free = free; - return; - } - - cJSON_malloc = (hooks->malloc_fn) ? hooks->malloc_fn : malloc; - cJSON_free = (hooks->free_fn) ? hooks->free_fn : free; -} - -/* Internal constructor. */ -static cJSON *cJSON_New_Item() -{ - cJSON* node = (cJSON*) cJSON_malloc(sizeof(cJSON)); - if (node) - memset(node, 0, sizeof(cJSON)); - return node; -} - -/* Delete a cJSON structure. */ -void cJSON_Delete(cJSON *c) -{ - cJSON *next; - while (c) - { - next = c->next; - if (!(c->type & cJSON_IsReference) && c->child) - cJSON_Delete(c->child); - if (!(c->type & cJSON_IsReference) && c->valuestring) - cJSON_free(c->valuestring); - if (c->string) - cJSON_free(c->string); - cJSON_free(c); - c = next; - } -} - -/* Parse the input text to generate a number, and populate the result into item. */ -static const char *parse_number(cJSON *item, const char *num) -{ - long double n = 0, scale = 0; - int subscale = 0, signsubscale = 1; - item->sign = 1; - - /* Could use sscanf for this? */ - if (*num == '-') - item->sign = -1, num++; /* Has sign? */ - if (*num == '0') - num++; /* is zero */ - if (*num >= '1' && *num <= '9') - do - n = (n * 10.0) + (*num++ - '0'); - while (*num >= '0' && *num <= '9'); /* Number? */ - if (*num == '.' && num[1] >= '0' && num[1] <= '9') - { - num++; - do - n = (n * 10.0) + (*num++ - '0'), scale--; - while (*num >= '0' && *num <= '9'); - } /* Fractional part? */ - if (*num == 'e' || *num == 'E') /* Exponent? */ - { - num++; - if (*num == '+') - num++; - else if (*num == '-') - signsubscale = -1, num++; /* With sign? */ - while (*num >= '0' && *num <= '9') - subscale = (subscale * 10) + (*num++ - '0'); /* Number? */ - } - - if (scale == 0 && subscale == 0) - { - item->valuedouble = (double)(item->sign * (uint64)n); - item->valueint = (uint64)(item->sign * (uint64)n); - item->type = cJSON_Int; - } - else - { - n = item->sign * n * pow(10.0, (scale + subscale * signsubscale)); /* number = +/- number.fraction * 10^+/- exponent */ - item->valuedouble = (double)n; - item->valueint = (uint64)n; - item->type = cJSON_Double; - } - return num; -} - -/* Render the number nicely from the given item into a string. */ -static char *print_double(cJSON *item) -{ - char *str; - double d = item->valuedouble; - str = (char*) cJSON_malloc(64); /* This is a nice tradeoff. */ - if (str) - { - if (fabs(floor(d) - d) <= DBL_EPSILON) - sprintf(str, "%.0f", d); - else if (fabs(d) < 1.0e-6 || fabs(d) > 1.0e9) - sprintf(str, "%lf", d); - else - sprintf(str, "%f", d); - } - return str; -} - -static char *print_int(cJSON *item) -{ - char *str; - str = (char*) cJSON_malloc(22); /* 2^64+1 can be represented in 21 chars. */ - if (str) - { - if (item->sign == -1) - { - if (item->valueint <= (int64)INT_MAX && item->valueint >= (int64)INT_MIN) - { - sprintf(str, "%d", (int32)item->valueint); - } - else - { - sprintf(str, "%lld", (int64)item->valueint); - } - } - else - { - if (item->valueint <= (uint64)UINT_MAX) - { - sprintf(str, "%u", (uint32)item->valueint); - } - else - { - sprintf(str, "%llu", item->valueint); - } - } - } - return str; -} - -/* Parse the input text into an unescaped cstring, and populate item. */ -static const unsigned char firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, - 0xF8, 0xFC }; -static const char *parse_string(cJSON *item, const char *str) -{ - const char *ptr = str + 1; - char *ptr2; - char *out; - int len = 0; - unsigned uc, uc2; - if (*str != '\"') - { - ep = str; - return 0; - } /* not a string! */ - - while (*ptr != '\"' && *ptr && ++len) - if (*ptr++ == '\\') - ptr++; /* Skip escaped quotes. */ - - out = (char*) cJSON_malloc(len + 1); /* This is how long we need for the string, roughly. */ - if (!out) - return 0; - - ptr = str + 1; - ptr2 = out; - while (*ptr != '\"' && *ptr) - { - if (*ptr != '\\') - *ptr2++ = *ptr++; - else - { - ptr++; - switch (*ptr) - { - case 'b': - *ptr2++ = '\b'; - break; - case 'f': - *ptr2++ = '\f'; - break; - case 'n': - *ptr2++ = '\n'; - break; - case 'r': - *ptr2++ = '\r'; - break; - case 't': - *ptr2++ = '\t'; - break; - case 'u': /* transcode utf16 to utf8. */ - sscanf(ptr + 1, "%4x", &uc); - ptr += 4; /* get the unicode char. */ - - if ((uc >= 0xDC00 && uc <= 0xDFFF) || uc == 0) - break; // check for invalid. - - if (uc >= 0xD800 && uc <= 0xDBFF) // UTF16 surrogate pairs. - { - if (ptr[1] != '\\' || ptr[2] != 'u') - break; // missing second-half of surrogate. - sscanf(ptr + 3, "%4x", &uc2); - ptr += 6; - if (uc2 < 0xDC00 || uc2 > 0xDFFF) - break; // invalid second-half of surrogate. - uc = 0x10000 | ((uc & 0x3FF) << 10) | (uc2 & 0x3FF); - } - - len = 4; - if (uc < 0x80) - len = 1; - else if (uc < 0x800) - len = 2; - else if (uc < 0x10000) - len = 3; - ptr2 += len; - - switch (len) - { - case 4: - *--ptr2 = ((uc | 0x80) & 0xBF); - uc >>= 6; - case 3: - *--ptr2 = ((uc | 0x80) & 0xBF); - uc >>= 6; - case 2: - *--ptr2 = ((uc | 0x80) & 0xBF); - uc >>= 6; - case 1: - *--ptr2 = (uc | firstByteMark[len]); - } - ptr2 += len; - break; - default: - *ptr2++ = *ptr; - break; - } - ptr++; - } - } - *ptr2 = 0; - if (*ptr == '\"') - ptr++; - item->valuestring = out; - item->type = cJSON_String; - return ptr; -} - -/* Render the cstring provided to an escaped version that can be printed. */ -static char *print_string_ptr(const char *str) -{ - const char *ptr; - char *ptr2, *out; - int len = 0; - unsigned char token; - - if (!str) - return cJSON_strdup(""); - ptr = str; - while ((token = *ptr) && ++len) - { - if (strchr("\"\\\b\f\n\r\t", token)) - len++; - else if (token < 32) - len += 5; - ptr++; - } - - out = (char*) cJSON_malloc(len + 3); - if (!out) - return 0; - - ptr2 = out; - ptr = str; - *ptr2++ = '\"'; - while (*ptr) - { - if ((unsigned char) *ptr > 31 && *ptr != '\"' && *ptr != '\\') - *ptr2++ = *ptr++; - else - { - *ptr2++ = '\\'; - switch (token = *ptr++) - { - case '\\': - *ptr2++ = '\\'; - break; - case '\"': - *ptr2++ = '\"'; - break; - case '\b': - *ptr2++ = 'b'; - break; - case '\f': - *ptr2++ = 'f'; - break; - case '\n': - *ptr2++ = 'n'; - break; - case '\r': - *ptr2++ = 'r'; - break; - case '\t': - *ptr2++ = 't'; - break; - default: - sprintf(ptr2, "u%04x", token); - ptr2 += 5; - break; /* escape and print */ - } - } - } - *ptr2++ = '\"'; - *ptr2++ = 0; - return out; -} -/* Invote print_string_ptr (which is useful) on an item. */ -static char *print_string(cJSON *item) -{ - return print_string_ptr(item->valuestring); -} - -/* Predeclare these prototypes. */ -static const char *parse_value(cJSON *item, const char *value); -static char *print_value(cJSON *item, int depth, int fmt); -static const char *parse_array(cJSON *item, const char *value); -static char *print_array(cJSON *item, int depth, int fmt); -static const char *parse_object(cJSON *item, const char *value); -static char *print_object(cJSON *item, int depth, int fmt); - -/* Utility to jump whitespace and cr/lf */ -static const char *skip(const char *in) -{ - while (in && *in && (unsigned char) *in <= 32) - in++; - return in; -} - -/* Parse an object - create a new root, and populate. */ -cJSON *cJSON_Parse(const char *value) -{ - cJSON *c = cJSON_New_Item(); - ep = 0; - if (!c) - return 0; /* memory fail */ - - if (!parse_value(c, skip(value))) - { - cJSON_Delete(c); - return 0; - } - return c; -} - -/* Render a cJSON item/entity/structure to text. */ -char *cJSON_Print(cJSON *item) -{ - return print_value(item, 0, 1); -} -char *cJSON_PrintUnformatted(cJSON *item) -{ - return print_value(item, 0, 0); -} - -/* Parser core - when encountering text, process appropriately. */ -static const char *parse_value(cJSON *item, const char *value) -{ - if (!value) - return 0; /* Fail on null. */ - if (!strncmp(value, "null", 4)) - { - item->type = cJSON_NULL; - return value + 4; - } - if (!strncmp(value, "false", 5)) - { - item->type = cJSON_False; - return value + 5; - } - if (!strncmp(value, "true", 4)) - { - item->type = cJSON_True; - item->valueint = 1; - return value + 4; - } - if (*value == '\"') - { - return parse_string(item, value); - } - if (*value == '-' || (*value >= '0' && *value <= '9')) - { - return parse_number(item, value); - } - if (*value == '[') - { - return parse_array(item, value); - } - if (*value == '{') - { - return parse_object(item, value); - } - - ep = value; - return 0; /* failure. */ -} - -/* Render a value to text. */ -static char *print_value(cJSON *item, int depth, int fmt) -{ - char *out = 0; - if (!item) - return 0; - switch ((item->type) & 255) - { - case cJSON_NULL: - out = cJSON_strdup("null"); - break; - case cJSON_False: - out = cJSON_strdup("false"); - break; - case cJSON_True: - out = cJSON_strdup("true"); - break; - case cJSON_Int: - out = print_int(item); - break; - case cJSON_Double: - out = print_double(item); - break; - case cJSON_String: - out = print_string(item); - break; - case cJSON_Array: - out = print_array(item, depth, fmt); - break; - case cJSON_Object: - out = print_object(item, depth, fmt); - break; - } - return out; -} - -/* Build an array from input text. */ -static const char *parse_array(cJSON *item, const char *value) -{ - cJSON *child; - if (*value != '[') - { - ep = value; - return 0; - } /* not an array! */ - - item->type = cJSON_Array; - value = skip(value + 1); - if (*value == ']') - return value + 1; /* empty array. */ - - item->child = child = cJSON_New_Item(); - if (!item->child) - return 0; /* memory fail */ - value = skip(parse_value(child, skip(value))); /* skip any spacing, get the value. */ - if (!value) - return 0; - - while (*value == ',') - { - cJSON *new_item; - if (!(new_item = cJSON_New_Item())) - return 0; /* memory fail */ - child->next = new_item; - new_item->prev = child; - child = new_item; - value = skip(parse_value(child, skip(value + 1))); - if (!value) - return 0; /* memory fail */ - } - - if (*value == ']') - return value + 1; /* end of array */ - ep = value; - return 0; /* malformed. */ -} - -/* Render an array to text */ -static char *print_array(cJSON *item, int depth, int fmt) -{ - char **entries; - char *out = 0, *ptr, *ret; - int len = 5; - cJSON *child = item->child; - int numentries = 0, i = 0, fail = 0; - - /* How many entries in the array? */ - while (child) - numentries++, child = child->next; - /* Allocate an array to hold the values for each */ - entries = (char**) cJSON_malloc(numentries * sizeof(char*)); - if (!entries) - return 0; - memset(entries, 0, numentries * sizeof(char*)); - /* Retrieve all the results: */ - child = item->child; - while (child && !fail) - { - ret = print_value(child, depth + 1, fmt); - entries[i++] = ret; - if (ret) - len += strlen(ret) + 2 + (fmt ? 1 : 0); - else - fail = 1; - child = child->next; - } - - /* If we didn't fail, try to malloc the output string */ - if (!fail) - out = (char*) cJSON_malloc(len); - /* If that fails, we fail. */ - if (!out) - fail = 1; - - /* Handle failure. */ - if (fail) - { - for (i = 0; i < numentries; i++) - if (entries[i]) - cJSON_free(entries[i]); - cJSON_free(entries); - return 0; - } - - /* Compose the output array. */ - *out = '['; - ptr = out + 1; - *ptr = 0; - for (i = 0; i < numentries; i++) - { - strcpy(ptr, entries[i]); - ptr += strlen(entries[i]); - if (i != numentries - 1) - { - *ptr++ = ','; - if (fmt) - *ptr++ = ' '; - *ptr = 0; - } - cJSON_free(entries[i]); - } - cJSON_free(entries); - *ptr++ = ']'; - *ptr++ = 0; - return out; -} - -/* Build an object from the text. */ -static const char *parse_object(cJSON *item, const char *value) -{ - cJSON *child; - if (*value != '{') - { - ep = value; - return 0; - } /* not an object! */ - - item->type = cJSON_Object; - value = skip(value + 1); - if (*value == '}') - return value + 1; /* empty array. */ - - item->child = child = cJSON_New_Item(); - if (!item->child) - return 0; - value = skip(parse_string(child, skip(value))); - if (!value) - return 0; - child->string = child->valuestring; - child->valuestring = 0; - if (*value != ':') - { - ep = value; - return 0; - } /* fail! */ - value = skip(parse_value(child, skip(value + 1))); /* skip any spacing, get the value. */ - if (!value) - return 0; - - while (*value == ',') - { - cJSON *new_item; - if (!(new_item = cJSON_New_Item())) - return 0; /* memory fail */ - child->next = new_item; - new_item->prev = child; - child = new_item; - value = skip(parse_string(child, skip(value + 1))); - if (!value) - return 0; - child->string = child->valuestring; - child->valuestring = 0; - if (*value != ':') - { - ep = value; - return 0; - } /* fail! */ - value = skip(parse_value(child, skip(value + 1))); /* skip any spacing, get the value. */ - if (!value) - return 0; - } - - if (*value == '}') - return value + 1; /* end of array */ - ep = value; - return 0; /* malformed. */ -} - -/* Render an object to text. */ -static char *print_object(cJSON *item, int depth, int fmt) -{ - char **entries = 0, **names = 0; - char *out = 0, *ptr, *ret, *str; - int len = 7, i = 0, j; - cJSON *child = item->child; - int numentries = 0, fail = 0; - /* Count the number of entries. */ - while (child) - numentries++, child = child->next; - /* Allocate space for the names and the objects */ - entries = (char**) cJSON_malloc(numentries * sizeof(char*)); - if (!entries) - return 0; - names = (char**) cJSON_malloc(numentries * sizeof(char*)); - if (!names) - { - cJSON_free(entries); - return 0; - } - memset(entries, 0, sizeof(char*) * numentries); - memset(names, 0, sizeof(char*) * numentries); - - /* Collect all the results into our arrays: */ - child = item->child; - depth++; - if (fmt) - len += depth; - while (child) - { - names[i] = str = print_string_ptr(child->string); - entries[i++] = ret = print_value(child, depth, fmt); - if (str && ret) - len += strlen(ret) + strlen(str) + 2 + (fmt ? 2 + depth : 0); - else - fail = 1; - child = child->next; - } - - /* Try to allocate the output string */ - if (!fail) - out = (char*) cJSON_malloc(len); - if (!out) - fail = 1; - - /* Handle failure */ - if (fail) - { - for (i = 0; i < numentries; i++) - { - if (names[i]) - cJSON_free(names[i]); - if (entries[i]) - cJSON_free(entries[i]); - } - cJSON_free(names); - cJSON_free(entries); - return 0; - } - - /* Compose the output: */ - *out = '{'; - ptr = out + 1; - if (fmt) - *ptr++ = '\n'; - *ptr = 0; - for (i = 0; i < numentries; i++) - { - if (fmt) - for (j = 0; j < depth; j++) - *ptr++ = '\t'; - strcpy(ptr, names[i]); - ptr += strlen(names[i]); - *ptr++ = ':'; - if (fmt) - *ptr++ = '\t'; - strcpy(ptr, entries[i]); - ptr += strlen(entries[i]); - if (i != numentries - 1) - *ptr++ = ','; - if (fmt) - *ptr++ = '\n'; - *ptr = 0; - cJSON_free(names[i]); - cJSON_free(entries[i]); - } - - cJSON_free(names); - cJSON_free(entries); - if (fmt) - for (i = 0; i < depth - 1; i++) - *ptr++ = '\t'; - *ptr++ = '}'; - *ptr++ = 0; - return out; -} - -/* Get Array size/item / object item. */ -int cJSON_GetArraySize(cJSON *array) -{ - cJSON *c = array->child; - int i = 0; - while (c) - i++, c = c->next; - return i; -} -cJSON *cJSON_GetArrayItem(cJSON *array, int item) -{ - cJSON *c = array->child; - while (c && item > 0) - item--, c = c->next; - return c; -} -cJSON *cJSON_GetObjectItem(cJSON *object, const char *string) -{ - cJSON *c = object->child; - while (c && cJSON_strcasecmp(c->string, string)) - c = c->next; - return c; -} - -/* Utility for array list handling. */ -static void suffix_object(cJSON *prev, cJSON *item) -{ - prev->next = item; - item->prev = prev; -} -/* Utility for handling references. */ -static cJSON *create_reference(cJSON *item) -{ - cJSON *ref = cJSON_New_Item(); - if (!ref) - return 0; - memcpy(ref, item, sizeof(cJSON)); - ref->string = 0; - ref->type |= cJSON_IsReference; - ref->next = ref->prev = 0; - return ref; -} - -/* Add item to array/object. */ -void cJSON_AddItemToArray(cJSON *array, cJSON *item) -{ - cJSON *c = array->child; - if (!item) - return; - if (!c) - { - array->child = item; - } - else - { - while (c && c->next) - c = c->next; - suffix_object(c, item); - } -} - -void cJSON_AddItemToArrayHead(cJSON *array, cJSON *item) -{ - cJSON *c = array->child; - if (!item) - return; - if (!c) - { - array->child = item; - } - else - { - item->prev = c->prev; - item->next = c; - c->prev = item; - array->child = item; - } -} - -void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) -{ - if (!item) - return; - if (item->string) - cJSON_free(item->string); - item->string = cJSON_strdup(string); - cJSON_AddItemToArray(object, item); -} -void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) -{ - cJSON_AddItemToArray(array, create_reference(item)); -} -void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, - cJSON *item) -{ - cJSON_AddItemToObject(object, string, create_reference(item)); -} - -cJSON *cJSON_DetachItemFromArray(cJSON *array, int which) -{ - cJSON *c = array->child; - while (c && which > 0) - c = c->next, which--; - if (!c) - return 0; - if (c->prev) - c->prev->next = c->next; - if (c->next) - c->next->prev = c->prev; - if (c == array->child) - array->child = c->next; - c->prev = c->next = 0; - return c; -} -void cJSON_DeleteItemFromArray(cJSON *array, int which) -{ - cJSON_Delete(cJSON_DetachItemFromArray(array, which)); -} -cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string) -{ - int i = 0; - cJSON *c = object->child; - while (c && cJSON_strcasecmp(c->string, string)) - i++, c = c->next; - if (c) - return cJSON_DetachItemFromArray(object, i); - return 0; -} -void cJSON_DeleteItemFromObject(cJSON *object, const char *string) -{ - cJSON_Delete(cJSON_DetachItemFromObject(object, string)); -} - -/* Replace array/object items with new ones. */ -void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) -{ - cJSON *c = array->child; - while (c && which > 0) - c = c->next, which--; - if (!c) - return; - newitem->next = c->next; - newitem->prev = c->prev; - if (newitem->next) - newitem->next->prev = newitem; - if (c == array->child) - array->child = newitem; - else - newitem->prev->next = newitem; - c->next = c->prev = 0; - cJSON_Delete(c); -} -void cJSON_ReplaceItemInObject(cJSON *object, const char *string, - cJSON *newitem) -{ - int i = 0; - cJSON *c = object->child; - while (c && cJSON_strcasecmp(c->string, string)) - i++, c = c->next; - if (c) - { - newitem->string = cJSON_strdup(string); - cJSON_ReplaceItemInArray(object, i, newitem); - } -} - -/* Create basic types: */ -cJSON *cJSON_CreateNull() -{ - cJSON *item = cJSON_New_Item(); - if (item) - item->type = cJSON_NULL; - return item; -} -cJSON *cJSON_CreateTrue() -{ - cJSON *item = cJSON_New_Item(); - if (item) - item->type = cJSON_True; - return item; -} -cJSON *cJSON_CreateFalse() -{ - cJSON *item = cJSON_New_Item(); - if (item) - item->type = cJSON_False; - return item; -} -cJSON *cJSON_CreateBool(int b) -{ - cJSON *item = cJSON_New_Item(); - if (item) - item->type = b ? cJSON_True : cJSON_False; - return item; -} -cJSON *cJSON_CreateDouble(double num, int sign) -{ - cJSON *item = cJSON_New_Item(); - if (item) - { - item->type = cJSON_Double; - item->valuedouble = num; - item->valueint = (uint64)num; - item->sign = sign; - } - return item; -} -cJSON *cJSON_CreateInt(uint64 num, int sign) -{ - cJSON *item = cJSON_New_Item(); - if (item) - { - item->type = cJSON_Int; - item->valuedouble = (double)num; - item->valueint = (uint64)num; - item->sign = sign; - } - return item; -} -cJSON *cJSON_CreateString(const char *string) -{ - cJSON *item = cJSON_New_Item(); - if (item) - { - item->type = cJSON_String; - item->valuestring = cJSON_strdup(string); - } - return item; -} -cJSON *cJSON_CreateArray() -{ - cJSON *item = cJSON_New_Item(); - if (item) - item->type = cJSON_Array; - return item; -} -cJSON *cJSON_CreateObject() -{ - cJSON *item = cJSON_New_Item(); - if (item) - item->type = cJSON_Object; - return item; -} - -/* Create Arrays: */ -cJSON *cJSON_CreateIntArray(int *numbers, int sign, int count) -{ - int i; - cJSON *n = 0, *p = 0, *a = cJSON_CreateArray(); - for (i = 0; a && i < count; i++) - { - n = cJSON_CreateDouble((long double)((unsigned int)numbers[i]), sign); - if (!i) - a->child = n; - else - suffix_object(p, n); - p = n; - } - return a; -} -cJSON *cJSON_CreateFloatArray(float *numbers, int count) -{ - int i; - cJSON *n = 0, *p = 0, *a = cJSON_CreateArray(); - for (i = 0; a && i < count; i++) - { - n = cJSON_CreateDouble((long double)numbers[i], -1); - if (!i) - a->child = n; - else - suffix_object(p, n); - p = n; - } - return a; -} -cJSON *cJSON_CreateDoubleArray(double *numbers, int count) -{ - int i; - cJSON *n = 0, *p = 0, *a = cJSON_CreateArray(); - for (i = 0; a && i < count; i++) - { - n = cJSON_CreateDouble((long double)numbers[i], -1); - if (!i) - a->child = n; - else - suffix_object(p, n); - p = n; - } - return a; -} -cJSON *cJSON_CreateStringArray(const char **strings, int count) -{ - int i; - cJSON *n = 0, *p = 0, *a = cJSON_CreateArray(); - for (i = 0; a && i < count; i++) - { - n = cJSON_CreateString(strings[i]); - if (!i) - a->child = n; - else - suffix_object(p, n); - p = n; - } - return a; -} - diff --git a/cJSON.h b/cJSON.h deleted file mode 100644 index 4084728..0000000 --- a/cJSON.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - Copyright (c) 2009 Dave Gamble - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - */ - -#ifndef cJSON__h -#define cJSON__h - - -typedef int int32; -typedef unsigned int uint32; -typedef long long int64; -typedef unsigned long long uint64; - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* cJSON Types: */ -#define cJSON_False 0 -#define cJSON_True 1 -#define cJSON_NULL 2 -#define cJSON_Int 3 -#define cJSON_Double 4 -#define cJSON_String 5 -#define cJSON_Array 6 -#define cJSON_Object 7 - -#define cJSON_IsReference 256 - -/* The cJSON structure: */ -typedef struct cJSON -{ - struct cJSON *next, *prev; /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ - struct cJSON *child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ - - int type; /* The type of the item, as above. */ - - char *valuestring; /* The item's string, if type==cJSON_String */ - uint64 valueint; /* The item's number, if type==cJSON_Number */ - double valuedouble; /* The item's number, if type==cJSON_Number */ - int sign; /* sign of valueint, 1(unsigned), -1(signed) */ - - char *string; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ -} cJSON; - -typedef struct cJSON_Hooks -{ - void *(*malloc_fn)(size_t sz); - void (*free_fn)(void *ptr); -} cJSON_Hooks; - -/* Supply malloc, realloc and free functions to cJSON */ -extern void cJSON_InitHooks(cJSON_Hooks* hooks); - -/* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */ -extern cJSON *cJSON_Parse(const char *value); -/* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */ -extern char *cJSON_Print(cJSON *item); -/* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */ -extern char *cJSON_PrintUnformatted(cJSON *item); -/* Delete a cJSON entity and all subentities. */ -extern void cJSON_Delete(cJSON *c); - -/* Returns the number of items in an array (or object). */ -extern int cJSON_GetArraySize(cJSON *array); -/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */ -extern cJSON *cJSON_GetArrayItem(cJSON *array, int item); -/* Get item "string" from object. Case insensitive. */ -extern cJSON *cJSON_GetObjectItem(cJSON *object, const char *string); - -/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ -extern const char *cJSON_GetErrorPtr(); - -/* These calls create a cJSON item of the appropriate type. */ -extern cJSON *cJSON_CreateNull(); -extern cJSON *cJSON_CreateTrue(); -extern cJSON *cJSON_CreateFalse(); -extern cJSON *cJSON_CreateBool(int b); -extern cJSON *cJSON_CreateDouble(double num, int sign); -extern cJSON *cJSON_CreateInt(uint64 num, int sign); -extern cJSON *cJSON_CreateString(const char *string); -extern cJSON *cJSON_CreateArray(); -extern cJSON *cJSON_CreateObject(); - -/* These utilities create an Array of count items. */ -extern cJSON *cJSON_CreateIntArray(int *numbers, int sign, int count); -extern cJSON *cJSON_CreateFloatArray(float *numbers, int count); -extern cJSON *cJSON_CreateDoubleArray(double *numbers, int count); -extern cJSON *cJSON_CreateStringArray(const char **strings, int count); - -/* Append item to the specified array/object. */ -extern void cJSON_AddItemToArray(cJSON *array, cJSON *item); -extern void cJSON_AddItemToArrayHead(cJSON *array, cJSON *item); /* add by Bwar on 2015-01-28 */ -extern void cJSON_AddItemToObject(cJSON *object, const char *string, - cJSON *item); -/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ -extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); -extern void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, - cJSON *item); - -/* Remove/Detatch items from Arrays/Objects. */ -extern cJSON *cJSON_DetachItemFromArray(cJSON *array, int which); -extern void cJSON_DeleteItemFromArray(cJSON *array, int which); -extern cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string); -extern void cJSON_DeleteItemFromObject(cJSON *object, const char *string); - -/* Update array items. */ -extern void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); -extern void cJSON_ReplaceItemInObject(cJSON *object, const char *string, - cJSON *newitem); - -#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull()) -#define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue()) -#define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse()) -#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n)) -#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s)) - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/config_new.cpp b/config_new.cpp deleted file mode 100644 index ce923f7..0000000 --- a/config_new.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "stdafx.h" -#include "config_new.h" - -config_new::config_new(SFreeImage param) -{ - ms.value = 0; - init_paperdic(); - init_colormodedic(); - init_dpidic(); - set_unused_default_value(); - ms.double_paper = param.m_HardWareParams.DoubleFeederOn; - ms.color_model = pixType[param.m_HardWareParams.PixType]; - ms.dpi = resolutions[param.m_HardWareParams.Resolution]; - ms.papar_type = paperTypes[param.m_HardWareParams.PaperType]; - ms.paper = ms.papar_type == 3; - ms.skew_enable = param.m_HardWareParams.SkrewDetectOn; - ms.skew_parameter = param.m_HardWareParams.SkrewDetectLevel; - ms.staple_enable = param.m_HardWareParams.StapleDetectOn; -} - -config_new::~config_new(void) -{ -} - -unsigned int config_new::GetData() -{ - return ms.value; -} - -void config_new::init_paperdic(void) -{ - paperTypes.insert(std::pair(11, 0));//A3 - paperTypes.insert(std::pair(1, 1));//A4 - paperTypes.insert(std::pair(60, 2));//A4R - paperTypes.insert(std::pair(5, 2));//A5 - paperTypes.insert(std::pair(61, 2));//A5R - paperTypes.insert(std::pair(13, 2));//A6 - paperTypes.insert(std::pair(62, 2));//A6R - paperTypes.insert(std::pair(6, 0));//B4 - paperTypes.insert(std::pair(2, 0));//B5 - paperTypes.insert(std::pair(70, 1));//B5R - paperTypes.insert(std::pair(7, 2));//B6 - paperTypes.insert(std::pair(71, 2));//B6R - paperTypes.insert(std::pair(3, 1));//LETTER - paperTypes.insert(std::pair(80, 2));//LETTERR - paperTypes.insert(std::pair(81, 0));//DOUBLE LETTER - paperTypes.insert(std::pair(4, 0));//LEGAL - paperTypes.insert(std::pair(90, 0));//Auto 按照A3进行扫描 - paperTypes.insert(std::pair(91, 3));//长文稿 -} - -void config_new::init_colormodedic(void) -{ - pixType.insert(std::pair(0, 0));//BW - pixType.insert(std::pair(1, 0));//Gray - pixType.insert(std::pair(2, 1));//RGB -} - -void config_new::init_dpidic(void) -{ - resolutions.insert(std::pair(300, 1));//300 - resolutions.insert(std::pair(200, 0));//200 - resolutions.insert(std::pair(600, 2));//600 -} - -void config_new::set_unused_default_value(void) -{ - ms.error_clean = 0; - ms.iic_config = 0; - ms.iic_config_addr = 0; - ms.pick_paper = 0; - ms.scan_enable = 0; - ms.status_init = 0; - ms.v_setting = 0; - ms.speed_set_enable = 0; - ms.key_staple_enable = 0; - ms.scan_busy_motor_stop = 1; -} diff --git a/config_new.h b/config_new.h deleted file mode 100644 index ae26800..0000000 --- a/config_new.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once -#include "IConfig.h" -#include "PublicFunc.h" -#include "device_common.h" -#include - -class config_new : - public IConfig -{ -public : - config_new(SFreeImage param); - virtual ~config_new(void); - virtual unsigned int GetData() override; -private: - void init_paperdic(void); - void init_colormodedic(void); - void init_dpidic(void); - void set_unused_default_value(void); -private: - std::map paperTypes; - std::map pixType; - std::map resolutions; - MotorSetting ms; -}; - diff --git a/device_common.h b/device_common.h deleted file mode 100644 index d4553b6..0000000 --- a/device_common.h +++ /dev/null @@ -1,168 +0,0 @@ -#pragma once -#define FLASH_ADDR_START (0x300000) //! -#include -#include -#include -#include - -class FileTools -{ -public: - - - static std::vector getFiles(std::string path) - { - std::vector files; - getFiles(path, files); - return files; - } - - static void write_log(std::string filename, std::string log) - { - char deskpatrh[_MAX_PATH]; - std::string savepath; - SHGetSpecialFolderPath(0, deskpatrh, CSIDL_DESKTOPDIRECTORY, 0); - std::string str(deskpatrh); - savepath = str + "\\" + filename; - ; - std::ofstream ofs(savepath, std::ios::app); - - SYSTEMTIME sys; - GetLocalTime(&sys); - ofs << sys.wYear << "/" << sys.wMonth << "/" << sys.wDay << " " << sys.wHour << ":" << sys.wMinute << ":" << sys.wSecond << ":" << sys.wMilliseconds << " " << log << std::endl; - } - -private: - static void getFiles(std::string path, std::vector& 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); - } - } - -}; diff --git a/gscn_drv.cpp b/gscn_drv.cpp deleted file mode 100644 index 8471b46..0000000 --- a/gscn_drv.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "stdafx.h" -#include "gscn_drv.h" -#include "stdio.h" -#include "turbojpeg.h" -#include -#include "twainEx.h" -#include "jpeglib.h" -#include "ImageProcess/ImageApplyHeaders.h" -#include "hugaotwainds.h" -#include "filetools.h" -#include "UsbScanEx.h" -#include "opencv2/opencv.hpp" - -extern ChugaotwaindsApp theApp; - -GScn_Drv::GScn_Drv() :pixType(TJPF_BGR) -{ - devState = DEV_STOP; - Error_Code = 0; -} - -GScn_Drv::~GScn_Drv() -{ -} - -void DoEvents() -{ - MSG msg; - if (PeekMessage(&msg , NULL, 0, 0, PM_REMOVE)) { - DispatchMessage(&msg); - - TranslateMessage(&msg); - } -} - -cv::Mat GScn_Drv::popMat() -{ - std::lock_guard lck(m_imgLocker); - cv::Mat image = m_pImages.popMat(); - return image; -} - -void GScn_Drv::pushMat(JpegBuffer& data) -{ - m_pImages.pushMat(data); -} - -void GScn_Drv::trim(std::string &s) -{ - int index = 0; - if (!s.empty()) - { - while ((index = s.find(' ', index)) != string::npos) - { - s.erase(index, 1); - } - } -} diff --git a/gscn_drv.h b/gscn_drv.h deleted file mode 100644 index c52dc66..0000000 --- a/gscn_drv.h +++ /dev/null @@ -1,87 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include "MutexEx.h" -#include "jpeglib.h" -#include -#include -#include -#include "ImageMatQueue.h" -#include "PublicFunc.h" -#include "scn_config.h" - - -enum tagDevState -{ - DEV_STOP = -1, - DEV_ISRUNNING, - DEV_WRONG -}; - -typedef enum tagDevState DevState, PDevState; - -enum tagEventIndex -{ - EVENT_IMAGE, - EVENT_NUM -}; - -class DiscardBlank; -class CImageApply; - -class IGScan -{ -public: - virtual ~IGScan()=0 {}; - - virtual void open(int vid, int pid) = 0;; - virtual int aquire_image(cv::Mat& image) = 0; - virtual BOOL IsConnected() = 0; - virtual std::string GetFWVersion() = 0; - virtual std::string GetSerialNum() = 0; - virtual bool is_scan() = 0; - virtual BOOL Get_Scanner_PaperOn() = 0; - virtual void config_params(SFreeImage& params) = 0; - virtual void Scanner_StartScan(UINT16 count) = 0; - virtual void Stop_scan() = 0; - virtual void ResetScanner() =0; - virtual bool Get_IsImageQueueEmpty() = 0; - virtual void reset() = 0; - - virtual void setdecodepixtype(int twpixtype)= 0; - virtual UINT32 get_ErrorCode() = 0; - virtual void Set_ErrorCode(UINT32 value) = 0; - virtual int get_scanned_num() = 0; -}; - - -class IUsb; - -class GScn_Drv -{ -public: - GScn_Drv(); - virtual ~GScn_Drv(); - -protected: - volatile UINT32 Error_Code; - - cv::Mat popMat(); - void pushMat(JpegBuffer& data); - - - void trim(std::string &s); - volatile int devState; - ImageMatQueue m_pImages; - - std::mutex m_Locker; - std::mutex m_imgLocker; - std::string fwVersion; - std::string SerialNum; - int pixType; -}; - -void DoEvents(); \ No newline at end of file diff --git a/hugaotwainds.aps b/hugaotwainds.aps deleted file mode 100644 index c46b6a8..0000000 Binary files a/hugaotwainds.aps and /dev/null differ diff --git a/hugaotwainds.cpp b/hugaotwainds.cpp deleted file mode 100644 index 0361cef..0000000 Binary files a/hugaotwainds.cpp and /dev/null differ diff --git a/hugaotwainds.def b/hugaotwainds.def deleted file mode 100644 index 25fb672..0000000 Binary files a/hugaotwainds.def and /dev/null differ diff --git a/hugaotwainds.h b/hugaotwainds.h deleted file mode 100644 index b086010..0000000 Binary files a/hugaotwainds.h and /dev/null differ diff --git a/hugaotwainds.rc b/hugaotwainds.rc deleted file mode 100644 index ab370b7..0000000 Binary files a/hugaotwainds.rc and /dev/null differ diff --git a/hugaotwainds.sln b/hugaotwainds.sln index 893801b..96c5a75 100644 --- a/hugaotwainds.sln +++ b/hugaotwainds.sln @@ -1,22 +1,36 @@ 锘 -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.902 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hugaotwainds", "hugaotwainds.vcxproj", "{F928F998-CD13-478E-8D23-5943C2B108F5}" +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hugaotwainds", "hugaotwainds\hugaotwainds.vcxproj", "{F928F998-CD13-478E-8D23-5943C2B108F5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F928F998-CD13-478E-8D23-5943C2B108F5}.Debug|Any CPU.ActiveCfg = Debug|x64 + {F928F998-CD13-478E-8D23-5943C2B108F5}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 + {F928F998-CD13-478E-8D23-5943C2B108F5}.Debug|Mixed Platforms.Build.0 = Debug|x64 + {F928F998-CD13-478E-8D23-5943C2B108F5}.Debug|Win32.ActiveCfg = Debug|Win32 + {F928F998-CD13-478E-8D23-5943C2B108F5}.Debug|Win32.Build.0 = Debug|Win32 {F928F998-CD13-478E-8D23-5943C2B108F5}.Debug|x64.ActiveCfg = Debug|x64 {F928F998-CD13-478E-8D23-5943C2B108F5}.Debug|x64.Build.0 = Debug|x64 {F928F998-CD13-478E-8D23-5943C2B108F5}.Debug|x86.ActiveCfg = Debug|Win32 {F928F998-CD13-478E-8D23-5943C2B108F5}.Debug|x86.Build.0 = Debug|Win32 + {F928F998-CD13-478E-8D23-5943C2B108F5}.Release|Any CPU.ActiveCfg = Release|x64 + {F928F998-CD13-478E-8D23-5943C2B108F5}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {F928F998-CD13-478E-8D23-5943C2B108F5}.Release|Mixed Platforms.Build.0 = Release|x64 + {F928F998-CD13-478E-8D23-5943C2B108F5}.Release|Win32.ActiveCfg = Release|Win32 + {F928F998-CD13-478E-8D23-5943C2B108F5}.Release|Win32.Build.0 = Release|Win32 {F928F998-CD13-478E-8D23-5943C2B108F5}.Release|x64.ActiveCfg = Release|x64 {F928F998-CD13-478E-8D23-5943C2B108F5}.Release|x64.Build.0 = Release|x64 {F928F998-CD13-478E-8D23-5943C2B108F5}.Release|x86.ActiveCfg = Release|Win32 @@ -26,6 +40,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {D1155319-EC53-450A-9D33-0F0732DEA035} + SolutionGuid = {93BB7BF9-5375-4DEB-B06A-EB8DF2E08909} EndGlobalSection EndGlobal diff --git a/hugaotwainds.vcxproj b/hugaotwainds.vcxproj deleted file mode 100644 index 1cdef2d..0000000 --- a/hugaotwainds.vcxproj +++ /dev/null @@ -1,404 +0,0 @@ -锘 - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 4.0 - {F928F998-CD13-478E-8D23-5943C2B108F5} - MFCDLLProj - hugaotwainds - 10.0.18362.0 - - - - DynamicLibrary - true - v142 - MultiByte - Dynamic - - - DynamicLibrary - false - v142 - true - MultiByte - Dynamic - - - DynamicLibrary - true - v142 - MultiByte - Dynamic - - - DynamicLibrary - false - v142 - true - MultiByte - Dynamic - - - - - - - - - - - - - - - - - - - - - true - .ds - C:\Windows\twain_32\huagoscan - $(IncludePath) - $(LibraryPath) - $(ReferencePath) - $(ExecutablePath) - false - - - true - ..\..\..\..\..\Windows\twain_32\Huagoscan - .ds - $(ReferencePath) - C:\Users\pm\Desktop\gHGwainDS\hugaotwainds\pub\external\lib;$(LibraryPath) - - - false - C:\Windows\twain_32\huagoscan - .ds - $(IncludePath) - $(LibraryPath) - - - false - ..\..\..\..\..\..\Windows\twain_32\HuagaoT - .ds - - - - Use - Level3 - Disabled - WIN32;_WINDOWS;_DEBUG;_USRDLL;HW_VER;HUAGAO_VER;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - .\pub\external\include;.\opencv\include;%(AdditionalIncludeDirectories) - MultiThreadedDebugDLL - - - Windows - .\hugaotwainds.def - .\pub\external\lib;.\opencv\x86\lib - turbojpeg.lib;opencv_world346d.lib;%(AdditionalDependencies) - true - - - false - _DEBUG;%(PreprocessorDefinitions) - - - 0x0804 - _DEBUG;%(PreprocessorDefinitions) - $(IntDir);%(AdditionalIncludeDirectories) - - - - - - - - - Use - Level3 - Disabled - _WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) - .\pub\external\include;.\pub\ddk;.\opencv\include;.\pub\json;%(AdditionalIncludeDirectories) - - - Windows - .\hugaotwainds.def - .\pub\external\lib;%(AdditionalLibraryDirectories) - FreeImage.lib;turbojpeg.lib;%(AdditionalDependencies) - - - false - _DEBUG;%(PreprocessorDefinitions) - - - 0x0804 - _DEBUG;%(PreprocessorDefinitions) - $(IntDir);%(AdditionalIncludeDirectories) - - - - - Use - Level3 - MaxSpeed - true - true - WIN32;_WINDOWS;NDEBUG;_USRDLL;HUAGAO_VER;HW_VER;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - .\pub\external\include;.\pub\ddk;.\opencv\include;%(AdditionalIncludeDirectories) - MultiThreadedDLL - - - Windows - true - true - .\hugaotwainds.def - turbojpeg.lib;opencv_world346.lib;%(AdditionalDependencies) - .\pub\external\lib;.\opencv\x86\lib - - - false - NDEBUG;%(PreprocessorDefinitions) - - - 0x0804 - NDEBUG;%(PreprocessorDefinitions) - $(IntDir);%(AdditionalIncludeDirectories) - - - - - Use - Level3 - MaxSpeed - true - true - _WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) - - - Windows - true - true - .\hugaotwainds.def - - - false - NDEBUG;%(PreprocessorDefinitions) - - - 0x0804 - NDEBUG;%(PreprocessorDefinitions) - $(IntDir);%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hugaotwainds.vcxproj.filters b/hugaotwainds.vcxproj.filters deleted file mode 100644 index 4660950..0000000 --- a/hugaotwainds.vcxproj.filters +++ /dev/null @@ -1,462 +0,0 @@ -锘 - - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {9d4abd69-2950-4bda-ab58-a0a4ddb300a6} - - - {3bb43090-3159-4362-b07b-6056df5661b9} - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {8c772ec0-65e1-4343-aab0-9c2bcaa573ba} - - - {ea453d1b-3dd5-4474-9596-0213a8a8be29} - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - USB閫氫俊 - - - USB閫氫俊 - - - UI - - - UI - - - UI - - - UI - - - UI - - - 鍏叡搴 - - - UI - - - UI - - - 鍏叡搴 - - - 鍥惧儚澶勭悊 - - - UI - - - 浠g爜鏂囦欢 - - - USB閫氫俊 - - - USB閫氫俊 - - - USB閫氫俊 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 鍏叡搴 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - USB閫氫俊 - - - USB閫氫俊 - - - USB閫氫俊 - - - USB閫氫俊 - - - USB閫氫俊 - - - 浠g爜鏂囦欢 - - - 浠g爜鏂囦欢 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - - - 浠g爜鏂囦欢 - - - 璧勬簮鏂囦欢 - - - 璧勬簮鏂囦欢 - - - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - USB閫氫俊 - - - USB閫氫俊 - - - UI - - - UI - - - UI - - - UI - - - UI - - - 璧勬簮鏂囦欢 - - - 鍏叡搴 - - - UI - - - USB閫氫俊 - - - UI - - - 澶存枃浠 - - - 鍏叡搴 - - - 鍥惧儚澶勭悊 - - - 澶存枃浠 - - - UI - - - 澶存枃浠 - - - USB閫氫俊 - - - USB閫氫俊 - - - USB閫氫俊 - - - 鍏叡搴 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 鍏叡搴 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 澶存枃浠 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - 鍥惧儚澶勭悊 - - - - - 璧勬簮鏂囦欢 - - - - - 璧勬簮鏂囦欢 - - - 璧勬簮鏂囦欢 - - - \ No newline at end of file diff --git a/hugaotwainds.vcxproj.user b/hugaotwainds.vcxproj.user deleted file mode 100644 index 2bba54f..0000000 --- a/hugaotwainds.vcxproj.user +++ /dev/null @@ -1,24 +0,0 @@ -锘 - - - E:\杞欢瀹夎鍖匼xnviewer\xnviewer\xnview.exe - C:\Windows\twain_32\huagoscan - WindowsLocalDebugger - - - hugaotwainds.rc - C:\Program Files (x86)\TWAIN Working Group\TWAIN 2.3 App Sample\TWAIN_App_mfc32.exe - ..\..\..\..\..\Windows\twain_32\Huagoscan - WindowsLocalDebugger - - - E:\杞欢瀹夎鍖匼xnviewer\xnviewer\xnview.exe - ..\..\..\..\Windows\twain_32\huagoscan - WindowsLocalDebugger - - - C:\Program Files %28x86%29\XnView\xnview.exe - ..\..\..\..\..\..\Windows\twain_32\HuagaoT - WindowsLocalDebugger - - \ No newline at end of file diff --git a/jpeglib.cpp b/jpeglib.cpp deleted file mode 100644 index 27bb274..0000000 --- a/jpeglib.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "stdafx.h" -#include "jpeglib.h" - -JpegLib::JpegLib() : -img_buffer(NULL), sizeBuffer(0) -{ - handle = std::shared_ptr (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(); - - 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); - int size = width * height *tjPixelSize[pixelFormat]; - - if (sizeBuffer != size) - { - clear(); - img_buffer = std::shared_ptr(tjAlloc(size), tjFree); - sizeBuffer = size; - } - - if (img_buffer) - { - tjDecompress2(handle.get(), buff, buff_size, img_buffer.get(), width, 0, height, pixelFormat, 0); - } -} - -int JpegLib::getWidth() -{ - return width; -} - -int JpegLib::getHeight() -{ - return height; -} - -int JpegLib::getBufferSize() -{ - return sizeBuffer; -} - -unsigned char* JpegLib::getData() -{ - return img_buffer.get(); -} \ No newline at end of file diff --git a/jpeglib.h b/jpeglib.h deleted file mode 100644 index c5bb51a..0000000 --- a/jpeglib.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include "turbojpeg.h" -#include -#include - -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 handle; - std::shared_ptr img_buffer; - int sizeBuffer; - int width; - int height; -}; diff --git a/opencv/include/opencv/cv.h b/opencv/include/opencv/cv.h deleted file mode 100644 index 19a74e2..0000000 --- a/opencv/include/opencv/cv.h +++ /dev/null @@ -1,73 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OLD_CV_H -#define OPENCV_OLD_CV_H - -#if defined(_MSC_VER) - #define CV_DO_PRAGMA(x) __pragma(x) - #define __CVSTR2__(x) #x - #define __CVSTR1__(x) __CVSTR2__(x) - #define __CVMSVCLOC__ __FILE__ "("__CVSTR1__(__LINE__)") : " - #define CV_MSG_PRAGMA(_msg) CV_DO_PRAGMA(message (__CVMSVCLOC__ _msg)) -#elif defined(__GNUC__) - #define CV_DO_PRAGMA(x) _Pragma (#x) - #define CV_MSG_PRAGMA(_msg) CV_DO_PRAGMA(message (_msg)) -#else - #define CV_DO_PRAGMA(x) - #define CV_MSG_PRAGMA(_msg) -#endif -#define CV_WARNING(x) CV_MSG_PRAGMA("Warning: " #x) - -//CV_WARNING("This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module") - -#include "opencv2/core/core_c.h" -#include "opencv2/imgproc/imgproc_c.h" -#include "opencv2/photo/photo_c.h" -#include "opencv2/video/tracking_c.h" -#include "opencv2/objdetect/objdetect_c.h" - -#if !defined(CV_IMPL) -#define CV_IMPL extern "C" -#endif //CV_IMPL - -#endif // __OPENCV_OLD_CV_H_ diff --git a/opencv/include/opencv/cv.hpp b/opencv/include/opencv/cv.hpp deleted file mode 100644 index 8673956..0000000 --- a/opencv/include/opencv/cv.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OLD_CV_HPP -#define OPENCV_OLD_CV_HPP - -//#if defined(__GNUC__) -//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module" -//#endif - -#include "cv.h" -#include "opencv2/core.hpp" -#include "opencv2/imgproc.hpp" -#include "opencv2/photo.hpp" -#include "opencv2/video.hpp" -#include "opencv2/highgui.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/calib3d.hpp" -#include "opencv2/objdetect.hpp" - -#endif diff --git a/opencv/include/opencv/cvaux.h b/opencv/include/opencv/cvaux.h deleted file mode 100644 index c0367cc..0000000 --- a/opencv/include/opencv/cvaux.h +++ /dev/null @@ -1,57 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// Intel License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000, Intel Corporation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of Intel Corporation may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OLD_AUX_H -#define OPENCV_OLD_AUX_H - -//#if defined(__GNUC__) -//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module" -//#endif - -#include "opencv2/core/core_c.h" -#include "opencv2/imgproc/imgproc_c.h" -#include "opencv2/photo/photo_c.h" -#include "opencv2/video/tracking_c.h" -#include "opencv2/objdetect/objdetect_c.h" - -#endif - -/* End of file. */ diff --git a/opencv/include/opencv/cvaux.hpp b/opencv/include/opencv/cvaux.hpp deleted file mode 100644 index 4888eef..0000000 --- a/opencv/include/opencv/cvaux.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// Intel License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000, Intel Corporation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of Intel Corporation may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OLD_AUX_HPP -#define OPENCV_OLD_AUX_HPP - -//#if defined(__GNUC__) -//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module" -//#endif - -#include "cvaux.h" -#include "opencv2/core/utility.hpp" - -#endif diff --git a/opencv/include/opencv/cvwimage.h b/opencv/include/opencv/cvwimage.h deleted file mode 100644 index ec0ab14..0000000 --- a/opencv/include/opencv/cvwimage.h +++ /dev/null @@ -1,46 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to -// this license. If you do not agree to this license, do not download, -// install, copy or use the software. -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2008, Google, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of Intel Corporation or contributors may not be used to endorse -// or promote products derived from this software without specific -// prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" -// and any express or implied warranties, including, but not limited to, the -// implied warranties of merchantability and fitness for a particular purpose -// are disclaimed. In no event shall the Intel Corporation or contributors be -// liable for any direct, indirect, incidental, special, exemplary, or -// consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. - - -#ifndef OPENCV_OLD_WIMAGE_HPP -#define OPENCV_OLD_WIMAGE_HPP - -#include "opencv2/core/wimage.hpp" - -#endif diff --git a/opencv/include/opencv/cxcore.h b/opencv/include/opencv/cxcore.h deleted file mode 100644 index dc070c7..0000000 --- a/opencv/include/opencv/cxcore.h +++ /dev/null @@ -1,52 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OLD_CXCORE_H -#define OPENCV_OLD_CXCORE_H - -//#if defined(__GNUC__) -//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module" -//#endif - -#include "opencv2/core/core_c.h" - -#endif diff --git a/opencv/include/opencv/cxcore.hpp b/opencv/include/opencv/cxcore.hpp deleted file mode 100644 index c371677..0000000 --- a/opencv/include/opencv/cxcore.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OLD_CXCORE_HPP -#define OPENCV_OLD_CXCORE_HPP - -//#if defined(__GNUC__) -//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module" -//#endif - -#include "cxcore.h" -#include "opencv2/core.hpp" - -#endif diff --git a/opencv/include/opencv/cxeigen.hpp b/opencv/include/opencv/cxeigen.hpp deleted file mode 100644 index 1d3df91..0000000 --- a/opencv/include/opencv/cxeigen.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OLD_EIGEN_HPP -#define OPENCV_OLD_EIGEN_HPP - -#include "opencv2/core/eigen.hpp" - -#endif diff --git a/opencv/include/opencv/cxmisc.h b/opencv/include/opencv/cxmisc.h deleted file mode 100644 index 9b9bc82..0000000 --- a/opencv/include/opencv/cxmisc.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef OPENCV_OLD_CXMISC_H -#define OPENCV_OLD_CXMISC_H - -#ifdef __cplusplus -# include "opencv2/core/utility.hpp" -#endif - -#endif diff --git a/opencv/include/opencv/highgui.h b/opencv/include/opencv/highgui.h deleted file mode 100644 index 69b394e..0000000 --- a/opencv/include/opencv/highgui.h +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// Intel License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000, Intel Corporation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of Intel Corporation may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OLD_HIGHGUI_H -#define OPENCV_OLD_HIGHGUI_H - -#include "opencv2/core/core_c.h" -#include "opencv2/highgui/highgui_c.h" - -#endif diff --git a/opencv/include/opencv/ml.h b/opencv/include/opencv/ml.h deleted file mode 100644 index 0c376ba..0000000 --- a/opencv/include/opencv/ml.h +++ /dev/null @@ -1,47 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// Intel License Agreement -// -// Copyright (C) 2000, Intel Corporation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of Intel Corporation may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OLD_ML_H -#define OPENCV_OLD_ML_H - -#include "opencv2/core/core_c.h" -#include "opencv2/ml.hpp" - -#endif diff --git a/opencv/include/opencv2/calib3d.hpp b/opencv/include/opencv2/calib3d.hpp deleted file mode 100644 index 3808526..0000000 --- a/opencv/include/opencv2/calib3d.hpp +++ /dev/null @@ -1,2618 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CALIB3D_HPP -#define OPENCV_CALIB3D_HPP - -#include "opencv2/core.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/core/affine.hpp" - -/** - @defgroup calib3d Camera Calibration and 3D Reconstruction - -The functions in this section use a so-called pinhole camera model. In this model, a scene view is -formed by projecting 3D points into the image plane using a perspective transformation. - -\f[s \; m' = A [R|t] M'\f] - -or - -\f[s \vecthree{u}{v}{1} = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1} -\begin{bmatrix} -r_{11} & r_{12} & r_{13} & t_1 \\ -r_{21} & r_{22} & r_{23} & t_2 \\ -r_{31} & r_{32} & r_{33} & t_3 -\end{bmatrix} -\begin{bmatrix} -X \\ -Y \\ -Z \\ -1 -\end{bmatrix}\f] - -where: - -- \f$(X, Y, Z)\f$ are the coordinates of a 3D point in the world coordinate space -- \f$(u, v)\f$ are the coordinates of the projection point in pixels -- \f$A\f$ is a camera matrix, or a matrix of intrinsic parameters -- \f$(cx, cy)\f$ is a principal point that is usually at the image center -- \f$fx, fy\f$ are the focal lengths expressed in pixel units. - -Thus, if an image from the camera is scaled by a factor, all of these parameters should be scaled -(multiplied/divided, respectively) by the same factor. The matrix of intrinsic parameters does not -depend on the scene viewed. So, once estimated, it can be re-used as long as the focal length is -fixed (in case of zoom lens). The joint rotation-translation matrix \f$[R|t]\f$ is called a matrix of -extrinsic parameters. It is used to describe the camera motion around a static scene, or vice versa, -rigid motion of an object in front of a still camera. That is, \f$[R|t]\f$ translates coordinates of a -point \f$(X, Y, Z)\f$ to a coordinate system, fixed with respect to the camera. The transformation above -is equivalent to the following (when \f$z \ne 0\f$ ): - -\f[\begin{array}{l} -\vecthree{x}{y}{z} = R \vecthree{X}{Y}{Z} + t \\ -x' = x/z \\ -y' = y/z \\ -u = f_x*x' + c_x \\ -v = f_y*y' + c_y -\end{array}\f] - -The following figure illustrates the pinhole camera model. - -![Pinhole camera model](pics/pinhole_camera_model.png) - -Real lenses usually have some distortion, mostly radial distortion and slight tangential distortion. -So, the above model is extended as: - -\f[\begin{array}{l} -\vecthree{x}{y}{z} = R \vecthree{X}{Y}{Z} + t \\ -x' = x/z \\ -y' = y/z \\ -x'' = x' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + 2 p_1 x' y' + p_2(r^2 + 2 x'^2) + s_1 r^2 + s_2 r^4 \\ -y'' = y' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' + s_3 r^2 + s_4 r^4 \\ -\text{where} \quad r^2 = x'^2 + y'^2 \\ -u = f_x*x'' + c_x \\ -v = f_y*y'' + c_y -\end{array}\f] - -\f$k_1\f$, \f$k_2\f$, \f$k_3\f$, \f$k_4\f$, \f$k_5\f$, and \f$k_6\f$ are radial distortion coefficients. \f$p_1\f$ and \f$p_2\f$ are -tangential distortion coefficients. \f$s_1\f$, \f$s_2\f$, \f$s_3\f$, and \f$s_4\f$, are the thin prism distortion -coefficients. Higher-order coefficients are not considered in OpenCV. - -The next figures show two common types of radial distortion: barrel distortion (typically \f$ k_1 < 0 \f$) and pincushion distortion (typically \f$ k_1 > 0 \f$). - -![](pics/distortion_examples.png) -![](pics/distortion_examples2.png) - -In some cases the image sensor may be tilted in order to focus an oblique plane in front of the -camera (Scheimpfug condition). This can be useful for particle image velocimetry (PIV) or -triangulation with a laser fan. The tilt causes a perspective distortion of \f$x''\f$ and -\f$y''\f$. This distortion can be modelled in the following way, see e.g. @cite Louhichi07. - -\f[\begin{array}{l} -s\vecthree{x'''}{y'''}{1} = -\vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}(\tau_x, \tau_y)} -{0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)} -{0}{0}{1} R(\tau_x, \tau_y) \vecthree{x''}{y''}{1}\\ -u = f_x*x''' + c_x \\ -v = f_y*y''' + c_y -\end{array}\f] - -where the matrix \f$R(\tau_x, \tau_y)\f$ is defined by two rotations with angular parameter \f$\tau_x\f$ -and \f$\tau_y\f$, respectively, - -\f[ -R(\tau_x, \tau_y) = -\vecthreethree{\cos(\tau_y)}{0}{-\sin(\tau_y)}{0}{1}{0}{\sin(\tau_y)}{0}{\cos(\tau_y)} -\vecthreethree{1}{0}{0}{0}{\cos(\tau_x)}{\sin(\tau_x)}{0}{-\sin(\tau_x)}{\cos(\tau_x)} = -\vecthreethree{\cos(\tau_y)}{\sin(\tau_y)\sin(\tau_x)}{-\sin(\tau_y)\cos(\tau_x)} -{0}{\cos(\tau_x)}{\sin(\tau_x)} -{\sin(\tau_y)}{-\cos(\tau_y)\sin(\tau_x)}{\cos(\tau_y)\cos(\tau_x)}. -\f] - -In the functions below the coefficients are passed or returned as - -\f[(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f] - -vector. That is, if the vector contains four elements, it means that \f$k_3=0\f$ . The distortion -coefficients do not depend on the scene viewed. Thus, they also belong to the intrinsic camera -parameters. And they remain the same regardless of the captured image resolution. If, for example, a -camera has been calibrated on images of 320 x 240 resolution, absolutely the same distortion -coefficients can be used for 640 x 480 images from the same camera while \f$f_x\f$, \f$f_y\f$, \f$c_x\f$, and -\f$c_y\f$ need to be scaled appropriately. - -The functions below use the above model to do the following: - -- Project 3D points to the image plane given intrinsic and extrinsic parameters. -- Compute extrinsic parameters given intrinsic parameters, a few 3D points, and their -projections. -- Estimate intrinsic and extrinsic camera parameters from several views of a known calibration -pattern (every view is described by several 3D-2D point correspondences). -- Estimate the relative position and orientation of the stereo camera "heads" and compute the -*rectification* transformation that makes the camera optical axes parallel. - -@note - - A calibration sample for 3 cameras in horizontal position can be found at - opencv_source_code/samples/cpp/3calibration.cpp - - A calibration sample based on a sequence of images can be found at - opencv_source_code/samples/cpp/calibration.cpp - - A calibration sample in order to do 3D reconstruction can be found at - opencv_source_code/samples/cpp/build3dmodel.cpp - - A calibration example on stereo calibration can be found at - opencv_source_code/samples/cpp/stereo_calib.cpp - - A calibration example on stereo matching can be found at - opencv_source_code/samples/cpp/stereo_match.cpp - - (Python) A camera calibration sample can be found at - opencv_source_code/samples/python/calibrate.py - - @{ - @defgroup calib3d_fisheye Fisheye camera model - - Definitions: Let P be a point in 3D of coordinates X in the world reference frame (stored in the - matrix X) The coordinate vector of P in the camera reference frame is: - - \f[Xc = R X + T\f] - - where R is the rotation matrix corresponding to the rotation vector om: R = rodrigues(om); call x, y - and z the 3 coordinates of Xc: - - \f[x = Xc_1 \\ y = Xc_2 \\ z = Xc_3\f] - - The pinhole projection coordinates of P is [a; b] where - - \f[a = x / z \ and \ b = y / z \\ r^2 = a^2 + b^2 \\ \theta = atan(r)\f] - - Fisheye distortion: - - \f[\theta_d = \theta (1 + k_1 \theta^2 + k_2 \theta^4 + k_3 \theta^6 + k_4 \theta^8)\f] - - The distorted point coordinates are [x'; y'] where - - \f[x' = (\theta_d / r) a \\ y' = (\theta_d / r) b \f] - - Finally, conversion into pixel coordinates: The final pixel coordinates vector [u; v] where: - - \f[u = f_x (x' + \alpha y') + c_x \\ - v = f_y y' + c_y\f] - - @defgroup calib3d_c C API - - @} - */ - -namespace cv -{ - -//! @addtogroup calib3d -//! @{ - -//! type of the robust estimation algorithm -enum { LMEDS = 4, //!< least-median of squares algorithm - RANSAC = 8, //!< RANSAC algorithm - RHO = 16 //!< RHO algorithm - }; - -enum { SOLVEPNP_ITERATIVE = 0, - SOLVEPNP_EPNP = 1, //!< EPnP: Efficient Perspective-n-Point Camera Pose Estimation @cite lepetit2009epnp - SOLVEPNP_P3P = 2, //!< Complete Solution Classification for the Perspective-Three-Point Problem @cite gao2003complete - SOLVEPNP_DLS = 3, //!< A Direct Least-Squares (DLS) Method for PnP @cite hesch2011direct - SOLVEPNP_UPNP = 4, //!< Exhaustive Linearization for Robust Camera Pose and Focal Length Estimation @cite penate2013exhaustive - SOLVEPNP_AP3P = 5, //!< An Efficient Algebraic Solution to the Perspective-Three-Point Problem @cite Ke17 - SOLVEPNP_MAX_COUNT //!< Used for count -}; - -enum { CALIB_CB_ADAPTIVE_THRESH = 1, - CALIB_CB_NORMALIZE_IMAGE = 2, - CALIB_CB_FILTER_QUADS = 4, - CALIB_CB_FAST_CHECK = 8 - }; - -enum { CALIB_CB_SYMMETRIC_GRID = 1, - CALIB_CB_ASYMMETRIC_GRID = 2, - CALIB_CB_CLUSTERING = 4 - }; - -enum { CALIB_USE_INTRINSIC_GUESS = 0x00001, - CALIB_FIX_ASPECT_RATIO = 0x00002, - CALIB_FIX_PRINCIPAL_POINT = 0x00004, - CALIB_ZERO_TANGENT_DIST = 0x00008, - CALIB_FIX_FOCAL_LENGTH = 0x00010, - CALIB_FIX_K1 = 0x00020, - CALIB_FIX_K2 = 0x00040, - CALIB_FIX_K3 = 0x00080, - CALIB_FIX_K4 = 0x00800, - CALIB_FIX_K5 = 0x01000, - CALIB_FIX_K6 = 0x02000, - CALIB_RATIONAL_MODEL = 0x04000, - CALIB_THIN_PRISM_MODEL = 0x08000, - CALIB_FIX_S1_S2_S3_S4 = 0x10000, - CALIB_TILTED_MODEL = 0x40000, - CALIB_FIX_TAUX_TAUY = 0x80000, - CALIB_USE_QR = 0x100000, //!< use QR instead of SVD decomposition for solving. Faster but potentially less precise - CALIB_FIX_TANGENT_DIST = 0x200000, - // only for stereo - CALIB_FIX_INTRINSIC = 0x00100, - CALIB_SAME_FOCAL_LENGTH = 0x00200, - // for stereo rectification - CALIB_ZERO_DISPARITY = 0x00400, - CALIB_USE_LU = (1 << 17), //!< use LU instead of SVD decomposition for solving. much faster but potentially less precise - CALIB_USE_EXTRINSIC_GUESS = (1 << 22) //!< for stereoCalibrate - }; - -//! the algorithm for finding fundamental matrix -enum { FM_7POINT = 1, //!< 7-point algorithm - FM_8POINT = 2, //!< 8-point algorithm - FM_LMEDS = 4, //!< least-median algorithm. 7-point algorithm is used. - FM_RANSAC = 8 //!< RANSAC algorithm. It needs at least 15 points. 7-point algorithm is used. - }; - -enum HandEyeCalibrationMethod -{ - CALIB_HAND_EYE_TSAI = 0, //!< A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/Eye Calibration @cite Tsai89 - CALIB_HAND_EYE_PARK = 1, //!< Robot Sensor Calibration: Solving AX = XB on the Euclidean Group @cite Park94 - CALIB_HAND_EYE_HORAUD = 2, //!< Hand-eye Calibration @cite Horaud95 - CALIB_HAND_EYE_ANDREFF = 3, //!< On-line Hand-Eye Calibration @cite Andreff99 - CALIB_HAND_EYE_DANIILIDIS = 4 //!< Hand-Eye Calibration Using Dual Quaternions @cite Daniilidis98 -}; - - -/** @brief Converts a rotation matrix to a rotation vector or vice versa. - -@param src Input rotation vector (3x1 or 1x3) or rotation matrix (3x3). -@param dst Output rotation matrix (3x3) or rotation vector (3x1 or 1x3), respectively. -@param jacobian Optional output Jacobian matrix, 3x9 or 9x3, which is a matrix of partial -derivatives of the output array components with respect to the input array components. - -\f[\begin{array}{l} \theta \leftarrow norm(r) \\ r \leftarrow r/ \theta \\ R = \cos{\theta} I + (1- \cos{\theta} ) r r^T + \sin{\theta} \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} \end{array}\f] - -Inverse transformation can be also done easily, since - -\f[\sin ( \theta ) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} = \frac{R - R^T}{2}\f] - -A rotation vector is a convenient and most compact representation of a rotation matrix (since any -rotation matrix has just 3 degrees of freedom). The representation is used in the global 3D geometry -optimization procedures like calibrateCamera, stereoCalibrate, or solvePnP . - */ -CV_EXPORTS_W void Rodrigues( InputArray src, OutputArray dst, OutputArray jacobian = noArray() ); - -/** @example samples/cpp/tutorial_code/features2D/Homography/pose_from_homography.cpp -An example program about pose estimation from coplanar points - -Check @ref tutorial_homography "the corresponding tutorial" for more details -*/ - -/** @brief Finds a perspective transformation between two planes. - -@param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2 -or vector\ . -@param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or -a vector\ . -@param method Method used to compute a homography matrix. The following methods are possible: -- **0** - a regular method using all the points, i.e., the least squares method -- **RANSAC** - RANSAC-based robust method -- **LMEDS** - Least-Median robust method -- **RHO** - PROSAC-based robust method -@param ransacReprojThreshold Maximum allowed reprojection error to treat a point pair as an inlier -(used in the RANSAC and RHO methods only). That is, if -\f[\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} * \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}\f] -then the point \f$i\f$ is considered as an outlier. If srcPoints and dstPoints are measured in pixels, -it usually makes sense to set this parameter somewhere in the range of 1 to 10. -@param mask Optional output mask set by a robust method ( RANSAC or LMEDS ). Note that the input -mask values are ignored. -@param maxIters The maximum number of RANSAC iterations. -@param confidence Confidence level, between 0 and 1. - -The function finds and returns the perspective transformation \f$H\f$ between the source and the -destination planes: - -\f[s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\f] - -so that the back-projection error - -\f[\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2\f] - -is minimized. If the parameter method is set to the default value 0, the function uses all the point -pairs to compute an initial homography estimate with a simple least-squares scheme. - -However, if not all of the point pairs ( \f$srcPoints_i\f$, \f$dstPoints_i\f$ ) fit the rigid perspective -transformation (that is, there are some outliers), this initial estimate will be poor. In this case, -you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different -random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix -using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the -computed homography (which is the number of inliers for RANSAC or the least median re-projection error for -LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and -the mask of inliers/outliers. - -Regardless of the method, robust or not, the computed homography matrix is refined further (using -inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the -re-projection error even more. - -The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to -distinguish inliers from outliers. The method LMeDS does not need any threshold but it works -correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the -noise is rather small, use the default method (method=0). - -The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is -determined up to a scale. Thus, it is normalized so that \f$h_{33}=1\f$. Note that whenever an \f$H\f$ matrix -cannot be estimated, an empty one will be returned. - -@sa -getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective, -perspectiveTransform - */ -CV_EXPORTS_W Mat findHomography( InputArray srcPoints, InputArray dstPoints, - int method = 0, double ransacReprojThreshold = 3, - OutputArray mask=noArray(), const int maxIters = 2000, - const double confidence = 0.995); - -/** @overload */ -CV_EXPORTS Mat findHomography( InputArray srcPoints, InputArray dstPoints, - OutputArray mask, int method = 0, double ransacReprojThreshold = 3 ); - -/** @brief Computes an RQ decomposition of 3x3 matrices. - -@param src 3x3 input matrix. -@param mtxR Output 3x3 upper-triangular matrix. -@param mtxQ Output 3x3 orthogonal matrix. -@param Qx Optional output 3x3 rotation matrix around x-axis. -@param Qy Optional output 3x3 rotation matrix around y-axis. -@param Qz Optional output 3x3 rotation matrix around z-axis. - -The function computes a RQ decomposition using the given rotations. This function is used in -decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera -and a rotation matrix. - -It optionally returns three rotation matrices, one for each axis, and the three Euler angles in -degrees (as the return value) that could be used in OpenGL. Note, there is always more than one -sequence of rotations about the three principal axes that results in the same orientation of an -object, e.g. see @cite Slabaugh . Returned tree rotation matrices and corresponding three Euler angles -are only one of the possible solutions. - */ -CV_EXPORTS_W Vec3d RQDecomp3x3( InputArray src, OutputArray mtxR, OutputArray mtxQ, - OutputArray Qx = noArray(), - OutputArray Qy = noArray(), - OutputArray Qz = noArray()); - -/** @brief Decomposes a projection matrix into a rotation matrix and a camera matrix. - -@param projMatrix 3x4 input projection matrix P. -@param cameraMatrix Output 3x3 camera matrix K. -@param rotMatrix Output 3x3 external rotation matrix R. -@param transVect Output 4x1 translation vector T. -@param rotMatrixX Optional 3x3 rotation matrix around x-axis. -@param rotMatrixY Optional 3x3 rotation matrix around y-axis. -@param rotMatrixZ Optional 3x3 rotation matrix around z-axis. -@param eulerAngles Optional three-element vector containing three Euler angles of rotation in -degrees. - -The function computes a decomposition of a projection matrix into a calibration and a rotation -matrix and the position of a camera. - -It optionally returns three rotation matrices, one for each axis, and three Euler angles that could -be used in OpenGL. Note, there is always more than one sequence of rotations about the three -principal axes that results in the same orientation of an object, e.g. see @cite Slabaugh . Returned -tree rotation matrices and corresponding three Euler angles are only one of the possible solutions. - -The function is based on RQDecomp3x3 . - */ -CV_EXPORTS_W void decomposeProjectionMatrix( InputArray projMatrix, OutputArray cameraMatrix, - OutputArray rotMatrix, OutputArray transVect, - OutputArray rotMatrixX = noArray(), - OutputArray rotMatrixY = noArray(), - OutputArray rotMatrixZ = noArray(), - OutputArray eulerAngles =noArray() ); - -/** @brief Computes partial derivatives of the matrix product for each multiplied matrix. - -@param A First multiplied matrix. -@param B Second multiplied matrix. -@param dABdA First output derivative matrix d(A\*B)/dA of size -\f$\texttt{A.rows*B.cols} \times {A.rows*A.cols}\f$ . -@param dABdB Second output derivative matrix d(A\*B)/dB of size -\f$\texttt{A.rows*B.cols} \times {B.rows*B.cols}\f$ . - -The function computes partial derivatives of the elements of the matrix product \f$A*B\f$ with regard to -the elements of each of the two input matrices. The function is used to compute the Jacobian -matrices in stereoCalibrate but can also be used in any other similar optimization function. - */ -CV_EXPORTS_W void matMulDeriv( InputArray A, InputArray B, OutputArray dABdA, OutputArray dABdB ); - -/** @brief Combines two rotation-and-shift transformations. - -@param rvec1 First rotation vector. -@param tvec1 First translation vector. -@param rvec2 Second rotation vector. -@param tvec2 Second translation vector. -@param rvec3 Output rotation vector of the superposition. -@param tvec3 Output translation vector of the superposition. -@param dr3dr1 -@param dr3dt1 -@param dr3dr2 -@param dr3dt2 -@param dt3dr1 -@param dt3dt1 -@param dt3dr2 -@param dt3dt2 Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and -tvec2, respectively. - -The functions compute: - -\f[\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\f] - -where \f$\mathrm{rodrigues}\f$ denotes a rotation vector to a rotation matrix transformation, and -\f$\mathrm{rodrigues}^{-1}\f$ denotes the inverse transformation. See Rodrigues for details. - -Also, the functions can compute the derivatives of the output vectors with regards to the input -vectors (see matMulDeriv ). The functions are used inside stereoCalibrate but can also be used in -your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a -function that contains a matrix multiplication. - */ -CV_EXPORTS_W void composeRT( InputArray rvec1, InputArray tvec1, - InputArray rvec2, InputArray tvec2, - OutputArray rvec3, OutputArray tvec3, - OutputArray dr3dr1 = noArray(), OutputArray dr3dt1 = noArray(), - OutputArray dr3dr2 = noArray(), OutputArray dr3dt2 = noArray(), - OutputArray dt3dr1 = noArray(), OutputArray dt3dt1 = noArray(), - OutputArray dt3dr2 = noArray(), OutputArray dt3dt2 = noArray() ); - -/** @brief Projects 3D points to an image plane. - -@param objectPoints Array of object points, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel (or -vector\ ), where N is the number of points in the view. -@param rvec Rotation vector. See Rodrigues for details. -@param tvec Translation vector. -@param cameraMatrix Camera matrix \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$ . -@param distCoeffs Input vector of distortion coefficients -\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of -4, 5, 8, 12 or 14 elements. If the vector is empty, the zero distortion coefficients are assumed. -@param imagePoints Output array of image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, or -vector\ . -@param jacobian Optional output 2Nx(10+\) jacobian matrix of derivatives of image -points with respect to components of the rotation vector, translation vector, focal lengths, -coordinates of the principal point and the distortion coefficients. In the old interface different -components of the jacobian are returned via different output parameters. -@param aspectRatio Optional "fixed aspect ratio" parameter. If the parameter is not 0, the -function assumes that the aspect ratio (*fx/fy*) is fixed and correspondingly adjusts the jacobian -matrix. - -The function computes projections of 3D points to the image plane given intrinsic and extrinsic -camera parameters. Optionally, the function computes Jacobians - matrices of partial derivatives of -image points coordinates (as functions of all the input parameters) with respect to the particular -parameters, intrinsic and/or extrinsic. The Jacobians are used during the global optimization in -calibrateCamera, solvePnP, and stereoCalibrate . The function itself can also be used to compute a -re-projection error given the current intrinsic and extrinsic parameters. - -@note By setting rvec=tvec=(0,0,0) or by setting cameraMatrix to a 3x3 identity matrix, or by -passing zero distortion coefficients, you can get various useful partial cases of the function. This -means that you can compute the distorted coordinates for a sparse set of points or apply a -perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup. - */ -CV_EXPORTS_W void projectPoints( InputArray objectPoints, - InputArray rvec, InputArray tvec, - InputArray cameraMatrix, InputArray distCoeffs, - OutputArray imagePoints, - OutputArray jacobian = noArray(), - double aspectRatio = 0 ); - -/** @example samples/cpp/tutorial_code/features2D/Homography/homography_from_camera_displacement.cpp -An example program about homography from the camera displacement - -Check @ref tutorial_homography "the corresponding tutorial" for more details -*/ - -/** @brief Finds an object pose from 3D-2D point correspondences. - -@param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or -1xN/Nx1 3-channel, where N is the number of points. vector\ can be also passed here. -@param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel, -where N is the number of points. vector\ can be also passed here. -@param cameraMatrix Input camera matrix \f$A = \vecthreethree{fx}{0}{cx}{0}{fy}{cy}{0}{0}{1}\f$ . -@param distCoeffs Input vector of distortion coefficients -\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of -4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are -assumed. -@param rvec Output rotation vector (see @ref Rodrigues ) that, together with tvec , brings points from -the model coordinate system to the camera coordinate system. -@param tvec Output translation vector. -@param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses -the provided rvec and tvec values as initial approximations of the rotation and translation -vectors, respectively, and further optimizes them. -@param flags Method for solving a PnP problem: -- **SOLVEPNP_ITERATIVE** Iterative method is based on Levenberg-Marquardt optimization. In -this case the function finds such a pose that minimizes reprojection error, that is the sum -of squared distances between the observed projections imagePoints and the projected (using -projectPoints ) objectPoints . -- **SOLVEPNP_P3P** Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang -"Complete Solution Classification for the Perspective-Three-Point Problem" (@cite gao2003complete). -In this case the function requires exactly four object and image points. -- **SOLVEPNP_AP3P** Method is based on the paper of T. Ke, S. Roumeliotis -"An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (@cite Ke17). -In this case the function requires exactly four object and image points. -- **SOLVEPNP_EPNP** Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the -paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (@cite lepetit2009epnp). -- **SOLVEPNP_DLS** Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis. -"A Direct Least-Squares (DLS) Method for PnP" (@cite hesch2011direct). -- **SOLVEPNP_UPNP** Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto, -F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length -Estimation" (@cite penate2013exhaustive). In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$ -assuming that both have the same value. Then the cameraMatrix is updated with the estimated -focal length. -- **SOLVEPNP_AP3P** Method is based on the paper of Tong Ke and Stergios I. Roumeliotis. -"An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (@cite Ke17). In this case the -function requires exactly four object and image points. - -The function estimates the object pose given a set of object points, their corresponding image -projections, as well as the camera matrix and the distortion coefficients, see the figure below -(more precisely, the X-axis of the camera frame is pointing to the right, the Y-axis downward -and the Z-axis forward). - -![](pnp.jpg) - -Points expressed in the world frame \f$ \bf{X}_w \f$ are projected into the image plane \f$ \left[ u, v \right] \f$ -using the perspective projection model \f$ \Pi \f$ and the camera intrinsic parameters matrix \f$ \bf{A} \f$: - -\f[ - \begin{align*} - \begin{bmatrix} - u \\ - v \\ - 1 - \end{bmatrix} &= - \bf{A} \hspace{0.1em} \Pi \hspace{0.2em} ^{c}\bf{M}_w - \begin{bmatrix} - X_{w} \\ - Y_{w} \\ - Z_{w} \\ - 1 - \end{bmatrix} \\ - \begin{bmatrix} - u \\ - v \\ - 1 - \end{bmatrix} &= - \begin{bmatrix} - f_x & 0 & c_x \\ - 0 & f_y & c_y \\ - 0 & 0 & 1 - \end{bmatrix} - \begin{bmatrix} - 1 & 0 & 0 & 0 \\ - 0 & 1 & 0 & 0 \\ - 0 & 0 & 1 & 0 - \end{bmatrix} - \begin{bmatrix} - r_{11} & r_{12} & r_{13} & t_x \\ - r_{21} & r_{22} & r_{23} & t_y \\ - r_{31} & r_{32} & r_{33} & t_z \\ - 0 & 0 & 0 & 1 - \end{bmatrix} - \begin{bmatrix} - X_{w} \\ - Y_{w} \\ - Z_{w} \\ - 1 - \end{bmatrix} - \end{align*} -\f] - -The estimated pose is thus the rotation (`rvec`) and the translation (`tvec`) vectors that allow to transform -a 3D point expressed in the world frame into the camera frame: - -\f[ - \begin{align*} - \begin{bmatrix} - X_c \\ - Y_c \\ - Z_c \\ - 1 - \end{bmatrix} &= - \hspace{0.2em} ^{c}\bf{M}_w - \begin{bmatrix} - X_{w} \\ - Y_{w} \\ - Z_{w} \\ - 1 - \end{bmatrix} \\ - \begin{bmatrix} - X_c \\ - Y_c \\ - Z_c \\ - 1 - \end{bmatrix} &= - \begin{bmatrix} - r_{11} & r_{12} & r_{13} & t_x \\ - r_{21} & r_{22} & r_{23} & t_y \\ - r_{31} & r_{32} & r_{33} & t_z \\ - 0 & 0 & 0 & 1 - \end{bmatrix} - \begin{bmatrix} - X_{w} \\ - Y_{w} \\ - Z_{w} \\ - 1 - \end{bmatrix} - \end{align*} -\f] - -@note - - An example of how to use solvePnP for planar augmented reality can be found at - opencv_source_code/samples/python/plane_ar.py - - If you are using Python: - - Numpy array slices won't work as input because solvePnP requires contiguous - arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of - modules/calib3d/src/solvepnp.cpp version 2.4.9) - - The P3P algorithm requires image points to be in an array of shape (N,1,2) due - to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9) - which requires 2-channel information. - - Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of - it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints = - np.ascontiguousarray(D[:,:2]).reshape((N,1,2)) - - The methods **SOLVEPNP_DLS** and **SOLVEPNP_UPNP** cannot be used as the current implementations are - unstable and sometimes give completely wrong results. If you pass one of these two - flags, **SOLVEPNP_EPNP** method will be used instead. - - The minimum number of points is 4 in the general case. In the case of **SOLVEPNP_P3P** and **SOLVEPNP_AP3P** - methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions - of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error). - - With **SOLVEPNP_ITERATIVE** method and `useExtrinsicGuess=true`, the minimum number of points is 3 (3 points - are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the - global solution to converge. - */ -CV_EXPORTS_W bool solvePnP( InputArray objectPoints, InputArray imagePoints, - InputArray cameraMatrix, InputArray distCoeffs, - OutputArray rvec, OutputArray tvec, - bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE ); - -/** @brief Finds an object pose from 3D-2D point correspondences using the RANSAC scheme. - -@param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or -1xN/Nx1 3-channel, where N is the number of points. vector\ can be also passed here. -@param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel, -where N is the number of points. vector\ can be also passed here. -@param cameraMatrix Input camera matrix \f$A = \vecthreethree{fx}{0}{cx}{0}{fy}{cy}{0}{0}{1}\f$ . -@param distCoeffs Input vector of distortion coefficients -\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of -4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are -assumed. -@param rvec Output rotation vector (see Rodrigues ) that, together with tvec , brings points from -the model coordinate system to the camera coordinate system. -@param tvec Output translation vector. -@param useExtrinsicGuess Parameter used for SOLVEPNP_ITERATIVE. If true (1), the function uses -the provided rvec and tvec values as initial approximations of the rotation and translation -vectors, respectively, and further optimizes them. -@param iterationsCount Number of iterations. -@param reprojectionError Inlier threshold value used by the RANSAC procedure. The parameter value -is the maximum allowed distance between the observed and computed point projections to consider it -an inlier. -@param confidence The probability that the algorithm produces a useful result. -@param inliers Output vector that contains indices of inliers in objectPoints and imagePoints . -@param flags Method for solving a PnP problem (see solvePnP ). - -The function estimates an object pose given a set of object points, their corresponding image -projections, as well as the camera matrix and the distortion coefficients. This function finds such -a pose that minimizes reprojection error, that is, the sum of squared distances between the observed -projections imagePoints and the projected (using projectPoints ) objectPoints. The use of RANSAC -makes the function resistant to outliers. - -@note - - An example of how to use solvePNPRansac for object detection can be found at - opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/ - - The default method used to estimate the camera pose for the Minimal Sample Sets step - is #SOLVEPNP_EPNP. Exceptions are: - - if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used. - - if the number of input points is equal to 4, #SOLVEPNP_P3P is used. - - The method used to estimate the camera pose using all the inliers is defined by the - flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case, - the method #SOLVEPNP_EPNP will be used instead. - */ -CV_EXPORTS_W bool solvePnPRansac( InputArray objectPoints, InputArray imagePoints, - InputArray cameraMatrix, InputArray distCoeffs, - OutputArray rvec, OutputArray tvec, - bool useExtrinsicGuess = false, int iterationsCount = 100, - float reprojectionError = 8.0, double confidence = 0.99, - OutputArray inliers = noArray(), int flags = SOLVEPNP_ITERATIVE ); -/** @brief Finds an object pose from 3 3D-2D point correspondences. - -@param objectPoints Array of object points in the object coordinate space, 3x3 1-channel or -1x3/3x1 3-channel. vector\ can be also passed here. -@param imagePoints Array of corresponding image points, 3x2 1-channel or 1x3/3x1 2-channel. - vector\ can be also passed here. -@param cameraMatrix Input camera matrix \f$A = \vecthreethree{fx}{0}{cx}{0}{fy}{cy}{0}{0}{1}\f$ . -@param distCoeffs Input vector of distortion coefficients -\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of -4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are -assumed. -@param rvecs Output rotation vectors (see Rodrigues ) that, together with tvecs , brings points from -the model coordinate system to the camera coordinate system. A P3P problem has up to 4 solutions. -@param tvecs Output translation vectors. -@param flags Method for solving a P3P problem: -- **SOLVEPNP_P3P** Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang -"Complete Solution Classification for the Perspective-Three-Point Problem" (@cite gao2003complete). -- **SOLVEPNP_AP3P** Method is based on the paper of Tong Ke and Stergios I. Roumeliotis. -"An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (@cite Ke17). - -The function estimates the object pose given 3 object points, their corresponding image -projections, as well as the camera matrix and the distortion coefficients. - */ -CV_EXPORTS_W int solveP3P( InputArray objectPoints, InputArray imagePoints, - InputArray cameraMatrix, InputArray distCoeffs, - OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, - int flags ); - -/** @brief Finds an initial camera matrix from 3D-2D point correspondences. - -@param objectPoints Vector of vectors of the calibration pattern points in the calibration pattern -coordinate space. In the old interface all the per-view vectors are concatenated. See -calibrateCamera for details. -@param imagePoints Vector of vectors of the projections of the calibration pattern points. In the -old interface all the per-view vectors are concatenated. -@param imageSize Image size in pixels used to initialize the principal point. -@param aspectRatio If it is zero or negative, both \f$f_x\f$ and \f$f_y\f$ are estimated independently. -Otherwise, \f$f_x = f_y * \texttt{aspectRatio}\f$ . - -The function estimates and returns an initial camera matrix for the camera calibration process. -Currently, the function only supports planar calibration patterns, which are patterns where each -object point has z-coordinate =0. - */ -CV_EXPORTS_W Mat initCameraMatrix2D( InputArrayOfArrays objectPoints, - InputArrayOfArrays imagePoints, - Size imageSize, double aspectRatio = 1.0 ); - -/** @brief Finds the positions of internal corners of the chessboard. - -@param image Source chessboard view. It must be an 8-bit grayscale or color image. -@param patternSize Number of inner corners per a chessboard row and column -( patternSize = cvSize(points_per_row,points_per_colum) = cvSize(columns,rows) ). -@param corners Output array of detected corners. -@param flags Various operation flags that can be zero or a combination of the following values: -- **CALIB_CB_ADAPTIVE_THRESH** Use adaptive thresholding to convert the image to black -and white, rather than a fixed threshold level (computed from the average image brightness). -- **CALIB_CB_NORMALIZE_IMAGE** Normalize the image gamma with equalizeHist before -applying fixed or adaptive thresholding. -- **CALIB_CB_FILTER_QUADS** Use additional criteria (like contour area, perimeter, -square-like shape) to filter out false quads extracted at the contour retrieval stage. -- **CALIB_CB_FAST_CHECK** Run a fast check on the image that looks for chessboard corners, -and shortcut the call if none is found. This can drastically speed up the call in the -degenerate condition when no chessboard is observed. - -The function attempts to determine whether the input image is a view of the chessboard pattern and -locate the internal chessboard corners. The function returns a non-zero value if all of the corners -are found and they are placed in a certain order (row by row, left to right in every row). -Otherwise, if the function fails to find all the corners or reorder them, it returns 0. For example, -a regular chessboard has 8 x 8 squares and 7 x 7 internal corners, that is, points where the black -squares touch each other. The detected coordinates are approximate, and to determine their positions -more accurately, the function calls cornerSubPix. You also may use the function cornerSubPix with -different parameters if returned coordinates are not accurate enough. - -Sample usage of detecting and drawing chessboard corners: : -@code - Size patternsize(8,6); //interior number of corners - Mat gray = ....; //source image - vector corners; //this will be filled by the detected corners - - //CALIB_CB_FAST_CHECK saves a lot of time on images - //that do not contain any chessboard corners - bool patternfound = findChessboardCorners(gray, patternsize, corners, - CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE - + CALIB_CB_FAST_CHECK); - - if(patternfound) - cornerSubPix(gray, corners, Size(11, 11), Size(-1, -1), - TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1)); - - drawChessboardCorners(img, patternsize, Mat(corners), patternfound); -@endcode -@note The function requires white space (like a square-thick border, the wider the better) around -the board to make the detection more robust in various environments. Otherwise, if there is no -border and the background is dark, the outer black squares cannot be segmented properly and so the -square grouping and ordering algorithm fails. - */ -CV_EXPORTS_W bool findChessboardCorners( InputArray image, Size patternSize, OutputArray corners, - int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE ); - -//! finds subpixel-accurate positions of the chessboard corners -CV_EXPORTS bool find4QuadCornerSubpix( InputArray img, InputOutputArray corners, Size region_size ); - -/** @brief Renders the detected chessboard corners. - -@param image Destination image. It must be an 8-bit color image. -@param patternSize Number of inner corners per a chessboard row and column -(patternSize = cv::Size(points_per_row,points_per_column)). -@param corners Array of detected corners, the output of findChessboardCorners. -@param patternWasFound Parameter indicating whether the complete board was found or not. The -return value of findChessboardCorners should be passed here. - -The function draws individual chessboard corners detected either as red circles if the board was not -found, or as colored corners connected with lines if the board was found. - */ -CV_EXPORTS_W void drawChessboardCorners( InputOutputArray image, Size patternSize, - InputArray corners, bool patternWasFound ); - -/** @brief Draw axes of the world/object coordinate system from pose estimation. @sa solvePnP - -@param image Input/output image. It must have 1 or 3 channels. The number of channels is not altered. -@param cameraMatrix Input 3x3 floating-point matrix of camera intrinsic parameters. -\f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ -@param distCoeffs Input vector of distortion coefficients -\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of -4, 5, 8, 12 or 14 elements. If the vector is empty, the zero distortion coefficients are assumed. -@param rvec Rotation vector (see @ref Rodrigues ) that, together with tvec , brings points from -the model coordinate system to the camera coordinate system. -@param tvec Translation vector. -@param length Length of the painted axes in the same unit than tvec (usually in meters). -@param thickness Line thickness of the painted axes. - -This function draws the axes of the world/object coordinate system w.r.t. to the camera frame. -OX is drawn in red, OY in green and OZ in blue. - */ -CV_EXPORTS_W void drawFrameAxes(InputOutputArray image, InputArray cameraMatrix, InputArray distCoeffs, - InputArray rvec, InputArray tvec, float length, int thickness=3); - -struct CV_EXPORTS_W_SIMPLE CirclesGridFinderParameters -{ - CV_WRAP CirclesGridFinderParameters(); - CV_PROP_RW cv::Size2f densityNeighborhoodSize; - CV_PROP_RW float minDensity; - CV_PROP_RW int kmeansAttempts; - CV_PROP_RW int minDistanceToAddKeypoint; - CV_PROP_RW int keypointScale; - CV_PROP_RW float minGraphConfidence; - CV_PROP_RW float vertexGain; - CV_PROP_RW float vertexPenalty; - CV_PROP_RW float existingVertexGain; - CV_PROP_RW float edgeGain; - CV_PROP_RW float edgePenalty; - CV_PROP_RW float convexHullFactor; - CV_PROP_RW float minRNGEdgeSwitchDist; - - enum GridType - { - SYMMETRIC_GRID, ASYMMETRIC_GRID - }; - GridType gridType; -}; - -struct CV_EXPORTS_W_SIMPLE CirclesGridFinderParameters2 : public CirclesGridFinderParameters -{ - CV_WRAP CirclesGridFinderParameters2(); - - CV_PROP_RW float squareSize; //!< Distance between two adjacent points. Used by CALIB_CB_CLUSTERING. - CV_PROP_RW float maxRectifiedDistance; //!< Max deviation from predicion. Used by CALIB_CB_CLUSTERING. -}; - -/** @brief Finds centers in the grid of circles. - -@param image grid view of input circles; it must be an 8-bit grayscale or color image. -@param patternSize number of circles per row and column -( patternSize = Size(points_per_row, points_per_colum) ). -@param centers output array of detected centers. -@param flags various operation flags that can be one of the following values: -- **CALIB_CB_SYMMETRIC_GRID** uses symmetric pattern of circles. -- **CALIB_CB_ASYMMETRIC_GRID** uses asymmetric pattern of circles. -- **CALIB_CB_CLUSTERING** uses a special algorithm for grid detection. It is more robust to -perspective distortions but much more sensitive to background clutter. -@param blobDetector feature detector that finds blobs like dark circles on light background. -@param parameters struct for finding circles in a grid pattern. - -The function attempts to determine whether the input image contains a grid of circles. If it is, the -function locates centers of the circles. The function returns a non-zero value if all of the centers -have been found and they have been placed in a certain order (row by row, left to right in every -row). Otherwise, if the function fails to find all the corners or reorder them, it returns 0. - -Sample usage of detecting and drawing the centers of circles: : -@code - Size patternsize(7,7); //number of centers - Mat gray = ....; //source image - vector centers; //this will be filled by the detected centers - - bool patternfound = findCirclesGrid(gray, patternsize, centers); - - drawChessboardCorners(img, patternsize, Mat(centers), patternfound); -@endcode -@note The function requires white space (like a square-thick border, the wider the better) around -the board to make the detection more robust in various environments. - */ -CV_EXPORTS_W bool findCirclesGrid( InputArray image, Size patternSize, - OutputArray centers, int flags, - const Ptr &blobDetector, - CirclesGridFinderParameters parameters); - -/** @overload */ -CV_EXPORTS_W bool findCirclesGrid2( InputArray image, Size patternSize, - OutputArray centers, int flags, - const Ptr &blobDetector, - CirclesGridFinderParameters2 parameters); - -/** @overload */ -CV_EXPORTS_W bool findCirclesGrid( InputArray image, Size patternSize, - OutputArray centers, int flags = CALIB_CB_SYMMETRIC_GRID, - const Ptr &blobDetector = SimpleBlobDetector::create()); - -/** @brief Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern. - -@param objectPoints In the new interface it is a vector of vectors of calibration pattern points in -the calibration pattern coordinate space (e.g. std::vector>). The outer -vector contains as many elements as the number of the pattern views. If the same calibration pattern -is shown in each view and it is fully visible, all the vectors will be the same. Although, it is -possible to use partially occluded patterns, or even different patterns in different views. Then, -the vectors will be different. The points are 3D, but since they are in a pattern coordinate system, -then, if the rig is planar, it may make sense to put the model to a XY coordinate plane so that -Z-coordinate of each input object point is 0. -In the old interface all the vectors of object points from different views are concatenated -together. -@param imagePoints In the new interface it is a vector of vectors of the projections of calibration -pattern points (e.g. std::vector>). imagePoints.size() and -objectPoints.size() and imagePoints[i].size() must be equal to objectPoints[i].size() for each i. -In the old interface all the vectors of object points from different views are concatenated -together. -@param imageSize Size of the image used only to initialize the intrinsic camera matrix. -@param cameraMatrix Output 3x3 floating-point camera matrix -\f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . If CV\_CALIB\_USE\_INTRINSIC\_GUESS -and/or CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be -initialized before calling the function. -@param distCoeffs Output vector of distortion coefficients -\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of -4, 5, 8, 12 or 14 elements. -@param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view -(e.g. std::vector>). That is, each k-th rotation vector together with the corresponding -k-th translation vector (see the next output parameter description) brings the calibration pattern -from the model coordinate space (in which object points are specified) to the world coordinate -space, that is, a real position of the calibration pattern in the k-th pattern view (k=0.. *M* -1). -@param tvecs Output vector of translation vectors estimated for each pattern view. -@param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic parameters. - Order of deviations values: -\f$(f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3, - s_4, \tau_x, \tau_y)\f$ If one of parameters is not estimated, it's deviation is equals to zero. -@param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic parameters. - Order of deviations values: \f$(R_1, T_1, \dotsc , R_M, T_M)\f$ where M is number of pattern views, - \f$R_i, T_i\f$ are concatenated 1x3 vectors. - @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view. -@param flags Different flags that may be zero or a combination of the following values: -- **CALIB_USE_INTRINSIC_GUESS** cameraMatrix contains valid initial values of -fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image -center ( imageSize is used), and focal distances are computed in a least-squares fashion. -Note, that if intrinsic parameters are known, there is no need to use this function just to -estimate extrinsic parameters. Use solvePnP instead. -- **CALIB_FIX_PRINCIPAL_POINT** The principal point is not changed during the global -optimization. It stays at the center or at a different location specified when -CALIB_USE_INTRINSIC_GUESS is set too. -- **CALIB_FIX_ASPECT_RATIO** The functions considers only fy as a free parameter. The -ratio fx/fy stays the same as in the input cameraMatrix . When -CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are -ignored, only their ratio is computed and used further. -- **CALIB_ZERO_TANGENT_DIST** Tangential distortion coefficients \f$(p_1, p_2)\f$ are set -to zeros and stay zero. -- **CALIB_FIX_K1,...,CALIB_FIX_K6** The corresponding radial distortion -coefficient is not changed during the optimization. If CALIB_USE_INTRINSIC_GUESS is -set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0. -- **CALIB_RATIONAL_MODEL** Coefficients k4, k5, and k6 are enabled. To provide the -backward compatibility, this extra flag should be explicitly specified to make the -calibration function use the rational model and return 8 coefficients. If the flag is not -set, the function computes and returns only 5 distortion coefficients. -- **CALIB_THIN_PRISM_MODEL** Coefficients s1, s2, s3 and s4 are enabled. To provide the -backward compatibility, this extra flag should be explicitly specified to make the -calibration function use the thin prism model and return 12 coefficients. If the flag is not -set, the function computes and returns only 5 distortion coefficients. -- **CALIB_FIX_S1_S2_S3_S4** The thin prism distortion coefficients are not changed during -the optimization. If CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the -supplied distCoeffs matrix is used. Otherwise, it is set to 0. -- **CALIB_TILTED_MODEL** Coefficients tauX and tauY are enabled. To provide the -backward compatibility, this extra flag should be explicitly specified to make the -calibration function use the tilted sensor model and return 14 coefficients. If the flag is not -set, the function computes and returns only 5 distortion coefficients. -- **CALIB_FIX_TAUX_TAUY** The coefficients of the tilted sensor model are not changed during -the optimization. If CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the -supplied distCoeffs matrix is used. Otherwise, it is set to 0. -@param criteria Termination criteria for the iterative optimization algorithm. - -@return the overall RMS re-projection error. - -The function estimates the intrinsic camera parameters and extrinsic parameters for each of the -views. The algorithm is based on @cite Zhang2000 and @cite BouguetMCT . The coordinates of 3D object -points and their corresponding 2D projections in each view must be specified. That may be achieved -by using an object with a known geometry and easily detectable feature points. Such an object is -called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as -a calibration rig (see findChessboardCorners ). Currently, initialization of intrinsic parameters -(when CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration -patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also -be used as long as initial cameraMatrix is provided. - -The algorithm performs the following steps: - -- Compute the initial intrinsic parameters (the option only available for planar calibration - patterns) or read them from the input parameters. The distortion coefficients are all set to - zeros initially unless some of CALIB_FIX_K? are specified. - -- Estimate the initial camera pose as if the intrinsic parameters have been already known. This is - done using solvePnP . - -- Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error, - that is, the total sum of squared distances between the observed feature points imagePoints and - the projected (using the current estimates for camera parameters and the poses) object points - objectPoints. See projectPoints for details. - -@note - If you use a non-square (=non-NxN) grid and findChessboardCorners for calibration, and - calibrateCamera returns bad values (zero distortion coefficients, an image center very far from - (w/2-0.5,h/2-0.5), and/or large differences between \f$f_x\f$ and \f$f_y\f$ (ratios of 10:1 or more)), - then you have probably used patternSize=cvSize(rows,cols) instead of using - patternSize=cvSize(cols,rows) in findChessboardCorners . - -@sa - findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort - */ -CV_EXPORTS_AS(calibrateCameraExtended) double calibrateCamera( InputArrayOfArrays objectPoints, - InputArrayOfArrays imagePoints, Size imageSize, - InputOutputArray cameraMatrix, InputOutputArray distCoeffs, - OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, - OutputArray stdDeviationsIntrinsics, - OutputArray stdDeviationsExtrinsics, - OutputArray perViewErrors, - int flags = 0, TermCriteria criteria = TermCriteria( - TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON) ); - -/** @overload double calibrateCamera( InputArrayOfArrays objectPoints, - InputArrayOfArrays imagePoints, Size imageSize, - InputOutputArray cameraMatrix, InputOutputArray distCoeffs, - OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, - OutputArray stdDeviations, OutputArray perViewErrors, - int flags = 0, TermCriteria criteria = TermCriteria( - TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON) ) - */ -CV_EXPORTS_W double calibrateCamera( InputArrayOfArrays objectPoints, - InputArrayOfArrays imagePoints, Size imageSize, - InputOutputArray cameraMatrix, InputOutputArray distCoeffs, - OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, - int flags = 0, TermCriteria criteria = TermCriteria( - TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON) ); - -/** @brief Computes useful camera characteristics from the camera matrix. - -@param cameraMatrix Input camera matrix that can be estimated by calibrateCamera or -stereoCalibrate . -@param imageSize Input image size in pixels. -@param apertureWidth Physical width in mm of the sensor. -@param apertureHeight Physical height in mm of the sensor. -@param fovx Output field of view in degrees along the horizontal sensor axis. -@param fovy Output field of view in degrees along the vertical sensor axis. -@param focalLength Focal length of the lens in mm. -@param principalPoint Principal point in mm. -@param aspectRatio \f$f_y/f_x\f$ - -The function computes various useful camera characteristics from the previously estimated camera -matrix. - -@note - Do keep in mind that the unity measure 'mm' stands for whatever unit of measure one chooses for - the chessboard pitch (it can thus be any value). - */ -CV_EXPORTS_W void calibrationMatrixValues( InputArray cameraMatrix, Size imageSize, - double apertureWidth, double apertureHeight, - CV_OUT double& fovx, CV_OUT double& fovy, - CV_OUT double& focalLength, CV_OUT Point2d& principalPoint, - CV_OUT double& aspectRatio ); - -/** @brief Calibrates the stereo camera. - -@param objectPoints Vector of vectors of the calibration pattern points. -@param imagePoints1 Vector of vectors of the projections of the calibration pattern points, -observed by the first camera. -@param imagePoints2 Vector of vectors of the projections of the calibration pattern points, -observed by the second camera. -@param cameraMatrix1 Input/output first camera matrix: -\f$\vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}\f$ , \f$j = 0,\, 1\f$ . If -any of CALIB_USE_INTRINSIC_GUESS , CALIB_FIX_ASPECT_RATIO , -CALIB_FIX_INTRINSIC , or CALIB_FIX_FOCAL_LENGTH are specified, some or all of the -matrix components must be initialized. See the flags description for details. -@param distCoeffs1 Input/output vector of distortion coefficients -\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of -4, 5, 8, 12 or 14 elements. The output vector length depends on the flags. -@param cameraMatrix2 Input/output second camera matrix. The parameter is similar to cameraMatrix1 -@param distCoeffs2 Input/output lens distortion coefficients for the second camera. The parameter -is similar to distCoeffs1 . -@param imageSize Size of the image used only to initialize intrinsic camera matrix. -@param R Output rotation matrix between the 1st and the 2nd camera coordinate systems. -@param T Output translation vector between the coordinate systems of the cameras. -@param E Output essential matrix. -@param F Output fundamental matrix. -@param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view. -@param flags Different flags that may be zero or a combination of the following values: -- **CALIB_FIX_INTRINSIC** Fix cameraMatrix? and distCoeffs? so that only R, T, E , and F -matrices are estimated. -- **CALIB_USE_INTRINSIC_GUESS** Optimize some or all of the intrinsic parameters -according to the specified flags. Initial values are provided by the user. -- **CALIB_USE_EXTRINSIC_GUESS** R, T contain valid initial values that are optimized further. -Otherwise R, T are initialized to the median value of the pattern views (each dimension separately). -- **CALIB_FIX_PRINCIPAL_POINT** Fix the principal points during the optimization. -- **CALIB_FIX_FOCAL_LENGTH** Fix \f$f^{(j)}_x\f$ and \f$f^{(j)}_y\f$ . -- **CALIB_FIX_ASPECT_RATIO** Optimize \f$f^{(j)}_y\f$ . Fix the ratio \f$f^{(j)}_x/f^{(j)}_y\f$ -. -- **CALIB_SAME_FOCAL_LENGTH** Enforce \f$f^{(0)}_x=f^{(1)}_x\f$ and \f$f^{(0)}_y=f^{(1)}_y\f$ . -- **CALIB_ZERO_TANGENT_DIST** Set tangential distortion coefficients for each camera to -zeros and fix there. -- **CALIB_FIX_K1,...,CALIB_FIX_K6** Do not change the corresponding radial -distortion coefficient during the optimization. If CALIB_USE_INTRINSIC_GUESS is set, -the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0. -- **CALIB_RATIONAL_MODEL** Enable coefficients k4, k5, and k6. To provide the backward -compatibility, this extra flag should be explicitly specified to make the calibration -function use the rational model and return 8 coefficients. If the flag is not set, the -function computes and returns only 5 distortion coefficients. -- **CALIB_THIN_PRISM_MODEL** Coefficients s1, s2, s3 and s4 are enabled. To provide the -backward compatibility, this extra flag should be explicitly specified to make the -calibration function use the thin prism model and return 12 coefficients. If the flag is not -set, the function computes and returns only 5 distortion coefficients. -- **CALIB_FIX_S1_S2_S3_S4** The thin prism distortion coefficients are not changed during -the optimization. If CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the -supplied distCoeffs matrix is used. Otherwise, it is set to 0. -- **CALIB_TILTED_MODEL** Coefficients tauX and tauY are enabled. To provide the -backward compatibility, this extra flag should be explicitly specified to make the -calibration function use the tilted sensor model and return 14 coefficients. If the flag is not -set, the function computes and returns only 5 distortion coefficients. -- **CALIB_FIX_TAUX_TAUY** The coefficients of the tilted sensor model are not changed during -the optimization. If CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the -supplied distCoeffs matrix is used. Otherwise, it is set to 0. -@param criteria Termination criteria for the iterative optimization algorithm. - -The function estimates transformation between two cameras making a stereo pair. If you have a stereo -camera where the relative position and orientation of two cameras is fixed, and if you computed -poses of an object relative to the first camera and to the second camera, (R1, T1) and (R2, T2), -respectively (this can be done with solvePnP ), then those poses definitely relate to each other. -This means that, given ( \f$R_1\f$,\f$T_1\f$ ), it should be possible to compute ( \f$R_2\f$,\f$T_2\f$ ). You only -need to know the position and orientation of the second camera relative to the first camera. This is -what the described function does. It computes ( \f$R\f$,\f$T\f$ ) so that: - -\f[R_2=R*R_1\f] -\f[T_2=R*T_1 + T,\f] - -Optionally, it computes the essential matrix E: - -\f[E= \vecthreethree{0}{-T_2}{T_1}{T_2}{0}{-T_0}{-T_1}{T_0}{0} *R\f] - -where \f$T_i\f$ are components of the translation vector \f$T\f$ : \f$T=[T_0, T_1, T_2]^T\f$ . And the function -can also compute the fundamental matrix F: - -\f[F = cameraMatrix2^{-T} E cameraMatrix1^{-1}\f] - -Besides the stereo-related information, the function can also perform a full calibration of each of -two cameras. However, due to the high dimensionality of the parameter space and noise in the input -data, the function can diverge from the correct solution. If the intrinsic parameters can be -estimated with high accuracy for each of the cameras individually (for example, using -calibrateCamera ), you are recommended to do so and then pass CALIB_FIX_INTRINSIC flag to the -function along with the computed intrinsic parameters. Otherwise, if all the parameters are -estimated at once, it makes sense to restrict some parameters, for example, pass -CALIB_SAME_FOCAL_LENGTH and CALIB_ZERO_TANGENT_DIST flags, which is usually a -reasonable assumption. - -Similarly to calibrateCamera , the function minimizes the total re-projection error for all the -points in all the available views from both cameras. The function returns the final value of the -re-projection error. - */ -CV_EXPORTS_AS(stereoCalibrateExtended) double stereoCalibrate( InputArrayOfArrays objectPoints, - InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, - InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1, - InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2, - Size imageSize, InputOutputArray R,InputOutputArray T, OutputArray E, OutputArray F, - OutputArray perViewErrors, int flags = CALIB_FIX_INTRINSIC, - TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6) ); - -/// @overload -CV_EXPORTS_W double stereoCalibrate( InputArrayOfArrays objectPoints, - InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, - InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1, - InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2, - Size imageSize, OutputArray R,OutputArray T, OutputArray E, OutputArray F, - int flags = CALIB_FIX_INTRINSIC, - TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6) ); - -/** @brief Computes rectification transforms for each head of a calibrated stereo camera. - -@param cameraMatrix1 First camera matrix. -@param distCoeffs1 First camera distortion parameters. -@param cameraMatrix2 Second camera matrix. -@param distCoeffs2 Second camera distortion parameters. -@param imageSize Size of the image used for stereo calibration. -@param R Rotation matrix between the coordinate systems of the first and the second cameras. -@param T Translation vector between coordinate systems of the cameras. -@param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. -@param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. -@param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first -camera. -@param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second -camera. -@param Q Output \f$4 \times 4\f$ disparity-to-depth mapping matrix (see reprojectImageTo3D ). -@param flags Operation flags that may be zero or CALIB_ZERO_DISPARITY . If the flag is set, -the function makes the principal points of each camera have the same pixel coordinates in the -rectified views. And if the flag is not set, the function may still shift the images in the -horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the -useful image area. -@param alpha Free scaling parameter. If it is -1 or absent, the function performs the default -scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified -images are zoomed and shifted so that only valid pixels are visible (no black areas after -rectification). alpha=1 means that the rectified image is decimated and shifted so that all the -pixels from the original images from the cameras are retained in the rectified images (no source -image pixels are lost). Obviously, any intermediate value yields an intermediate result between -those two extreme cases. -@param newImageSize New image resolution after rectification. The same size should be passed to -initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0) -is passed (default), it is set to the original imageSize . Setting it to larger value can help you -preserve details in the original image, especially when there is a big radial distortion. -@param validPixROI1 Optional output rectangles inside the rectified images where all the pixels -are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller -(see the picture below). -@param validPixROI2 Optional output rectangles inside the rectified images where all the pixels -are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller -(see the picture below). - -The function computes the rotation matrices for each camera that (virtually) make both camera image -planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies -the dense stereo correspondence problem. The function takes the matrices computed by stereoCalibrate -as input. As output, it provides two rotation matrices and also two projection matrices in the new -coordinates. The function distinguishes the following two cases: - -- **Horizontal stereo**: the first and the second camera views are shifted relative to each other - mainly along the x axis (with possible small vertical shift). In the rectified images, the - corresponding epipolar lines in the left and right cameras are horizontal and have the same - y-coordinate. P1 and P2 look like: - - \f[\texttt{P1} = \begin{bmatrix} f & 0 & cx_1 & 0 \\ 0 & f & cy & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}\f] - - \f[\texttt{P2} = \begin{bmatrix} f & 0 & cx_2 & T_x*f \\ 0 & f & cy & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix} ,\f] - - where \f$T_x\f$ is a horizontal shift between the cameras and \f$cx_1=cx_2\f$ if - CALIB_ZERO_DISPARITY is set. - -- **Vertical stereo**: the first and the second camera views are shifted relative to each other - mainly in vertical direction (and probably a bit in the horizontal direction too). The epipolar - lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like: - - \f[\texttt{P1} = \begin{bmatrix} f & 0 & cx & 0 \\ 0 & f & cy_1 & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}\f] - - \f[\texttt{P2} = \begin{bmatrix} f & 0 & cx & 0 \\ 0 & f & cy_2 & T_y*f \\ 0 & 0 & 1 & 0 \end{bmatrix} ,\f] - - where \f$T_y\f$ is a vertical shift between the cameras and \f$cy_1=cy_2\f$ if CALIB_ZERO_DISPARITY is - set. - -As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera -matrices. The matrices, together with R1 and R2 , can then be passed to initUndistortRectifyMap to -initialize the rectification map for each camera. - -See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through -the corresponding image regions. This means that the images are well rectified, which is what most -stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that -their interiors are all valid pixels. - -![image](pics/stereo_undistort.jpg) - */ -CV_EXPORTS_W void stereoRectify( InputArray cameraMatrix1, InputArray distCoeffs1, - InputArray cameraMatrix2, InputArray distCoeffs2, - Size imageSize, InputArray R, InputArray T, - OutputArray R1, OutputArray R2, - OutputArray P1, OutputArray P2, - OutputArray Q, int flags = CALIB_ZERO_DISPARITY, - double alpha = -1, Size newImageSize = Size(), - CV_OUT Rect* validPixROI1 = 0, CV_OUT Rect* validPixROI2 = 0 ); - -/** @brief Computes a rectification transform for an uncalibrated stereo camera. - -@param points1 Array of feature points in the first image. -@param points2 The corresponding points in the second image. The same formats as in -findFundamentalMat are supported. -@param F Input fundamental matrix. It can be computed from the same set of point pairs using -findFundamentalMat . -@param imgSize Size of the image. -@param H1 Output rectification homography matrix for the first image. -@param H2 Output rectification homography matrix for the second image. -@param threshold Optional threshold used to filter out the outliers. If the parameter is greater -than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points -for which \f$|\texttt{points2[i]}^T*\texttt{F}*\texttt{points1[i]}|>\texttt{threshold}\f$ ) are -rejected prior to computing the homographies. Otherwise, all the points are considered inliers. - -The function computes the rectification transformations without knowing intrinsic parameters of the -cameras and their relative position in the space, which explains the suffix "uncalibrated". Another -related difference from stereoRectify is that the function outputs not the rectification -transformations in the object (3D) space, but the planar perspective transformations encoded by the -homography matrices H1 and H2 . The function implements the algorithm @cite Hartley99 . - -@note - While the algorithm does not need to know the intrinsic parameters of the cameras, it heavily - depends on the epipolar geometry. Therefore, if the camera lenses have a significant distortion, - it would be better to correct it before computing the fundamental matrix and calling this - function. For example, distortion coefficients can be estimated for each head of stereo camera - separately by using calibrateCamera . Then, the images can be corrected using undistort , or - just the point coordinates can be corrected with undistortPoints . - */ -CV_EXPORTS_W bool stereoRectifyUncalibrated( InputArray points1, InputArray points2, - InputArray F, Size imgSize, - OutputArray H1, OutputArray H2, - double threshold = 5 ); - -//! computes the rectification transformations for 3-head camera, where all the heads are on the same line. -CV_EXPORTS_W float rectify3Collinear( InputArray cameraMatrix1, InputArray distCoeffs1, - InputArray cameraMatrix2, InputArray distCoeffs2, - InputArray cameraMatrix3, InputArray distCoeffs3, - InputArrayOfArrays imgpt1, InputArrayOfArrays imgpt3, - Size imageSize, InputArray R12, InputArray T12, - InputArray R13, InputArray T13, - OutputArray R1, OutputArray R2, OutputArray R3, - OutputArray P1, OutputArray P2, OutputArray P3, - OutputArray Q, double alpha, Size newImgSize, - CV_OUT Rect* roi1, CV_OUT Rect* roi2, int flags ); - -/** @brief Returns the new camera matrix based on the free scaling parameter. - -@param cameraMatrix Input camera matrix. -@param distCoeffs Input vector of distortion coefficients -\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of -4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are -assumed. -@param imageSize Original image size. -@param alpha Free scaling parameter between 0 (when all the pixels in the undistorted image are -valid) and 1 (when all the source image pixels are retained in the undistorted image). See -stereoRectify for details. -@param newImgSize Image size after rectification. By default, it is set to imageSize . -@param validPixROI Optional output rectangle that outlines all-good-pixels region in the -undistorted image. See roi1, roi2 description in stereoRectify . -@param centerPrincipalPoint Optional flag that indicates whether in the new camera matrix the -principal point should be at the image center or not. By default, the principal point is chosen to -best fit a subset of the source image (determined by alpha) to the corrected image. -@return new_camera_matrix Output new camera matrix. - -The function computes and returns the optimal new camera matrix based on the free scaling parameter. -By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original -image pixels if there is valuable information in the corners alpha=1 , or get something in between. -When alpha\>0 , the undistorted result is likely to have some black pixels corresponding to -"virtual" pixels outside of the captured distorted image. The original camera matrix, distortion -coefficients, the computed new camera matrix, and newImageSize should be passed to -initUndistortRectifyMap to produce the maps for remap . - */ -CV_EXPORTS_W Mat getOptimalNewCameraMatrix( InputArray cameraMatrix, InputArray distCoeffs, - Size imageSize, double alpha, Size newImgSize = Size(), - CV_OUT Rect* validPixROI = 0, - bool centerPrincipalPoint = false); - -/** @brief Computes Hand-Eye calibration: \f$_{}^{g}\textrm{T}_c\f$ - -@param[in] R_gripper2base Rotation part extracted from the homogeneous matrix that transforms a point -expressed in the gripper frame to the robot base frame (\f$_{}^{b}\textrm{T}_g\f$). -This is a vector (`vector`) that contains the rotation matrices for all the transformations -from gripper frame to robot base frame. -@param[in] t_gripper2base Translation part extracted from the homogeneous matrix that transforms a point -expressed in the gripper frame to the robot base frame (\f$_{}^{b}\textrm{T}_g\f$). -This is a vector (`vector`) that contains the translation vectors for all the transformations -from gripper frame to robot base frame. -@param[in] R_target2cam Rotation part extracted from the homogeneous matrix that transforms a point -expressed in the target frame to the camera frame (\f$_{}^{c}\textrm{T}_t\f$). -This is a vector (`vector`) that contains the rotation matrices for all the transformations -from calibration target frame to camera frame. -@param[in] t_target2cam Rotation part extracted from the homogeneous matrix that transforms a point -expressed in the target frame to the camera frame (\f$_{}^{c}\textrm{T}_t\f$). -This is a vector (`vector`) that contains the translation vectors for all the transformations -from calibration target frame to camera frame. -@param[out] R_cam2gripper Estimated rotation part extracted from the homogeneous matrix that transforms a point -expressed in the camera frame to the gripper frame (\f$_{}^{g}\textrm{T}_c\f$). -@param[out] t_cam2gripper Estimated translation part extracted from the homogeneous matrix that transforms a point -expressed in the camera frame to the gripper frame (\f$_{}^{g}\textrm{T}_c\f$). -@param[in] method One of the implemented Hand-Eye calibration method, see cv::HandEyeCalibrationMethod - -The function performs the Hand-Eye calibration using various methods. One approach consists in estimating the -rotation then the translation (separable solutions) and the following methods are implemented: - - R. Tsai, R. Lenz A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/EyeCalibration \cite Tsai89 - - F. Park, B. Martin Robot Sensor Calibration: Solving AX = XB on the Euclidean Group \cite Park94 - - R. Horaud, F. Dornaika Hand-Eye Calibration \cite Horaud95 - -Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions), -with the following implemented method: - - N. Andreff, R. Horaud, B. Espiau On-line Hand-Eye Calibration \cite Andreff99 - - K. Daniilidis Hand-Eye Calibration Using Dual Quaternions \cite Daniilidis98 - -The following picture describes the Hand-Eye calibration problem where the transformation between a camera ("eye") -mounted on a robot gripper ("hand") has to be estimated. - -![](pics/hand-eye_figure.png) - -The calibration procedure is the following: - - a static calibration pattern is used to estimate the transformation between the target frame - and the camera frame - - the robot gripper is moved in order to acquire several poses - - for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for - instance the robot kinematics -\f[ - \begin{bmatrix} - X_b\\ - Y_b\\ - Z_b\\ - 1 - \end{bmatrix} - = - \begin{bmatrix} - _{}^{b}\textrm{R}_g & _{}^{b}\textrm{t}_g \\ - 0_{1 \times 3} & 1 - \end{bmatrix} - \begin{bmatrix} - X_g\\ - Y_g\\ - Z_g\\ - 1 - \end{bmatrix} -\f] - - for each pose, the homogeneous transformation between the calibration target frame and the camera frame is recorded using - for instance a pose estimation method (PnP) from 2D-3D point correspondences -\f[ - \begin{bmatrix} - X_c\\ - Y_c\\ - Z_c\\ - 1 - \end{bmatrix} - = - \begin{bmatrix} - _{}^{c}\textrm{R}_t & _{}^{c}\textrm{t}_t \\ - 0_{1 \times 3} & 1 - \end{bmatrix} - \begin{bmatrix} - X_t\\ - Y_t\\ - Z_t\\ - 1 - \end{bmatrix} -\f] - -The Hand-Eye calibration procedure returns the following homogeneous transformation -\f[ - \begin{bmatrix} - X_g\\ - Y_g\\ - Z_g\\ - 1 - \end{bmatrix} - = - \begin{bmatrix} - _{}^{g}\textrm{R}_c & _{}^{g}\textrm{t}_c \\ - 0_{1 \times 3} & 1 - \end{bmatrix} - \begin{bmatrix} - X_c\\ - Y_c\\ - Z_c\\ - 1 - \end{bmatrix} -\f] - -This problem is also known as solving the \f$\mathbf{A}\mathbf{X}=\mathbf{X}\mathbf{B}\f$ equation: -\f[ - \begin{align*} - ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &= - \hspace{0.1em} ^{b}{\textrm{T}_g}^{(2)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\ - - (^{b}{\textrm{T}_g}^{(2)})^{-1} \hspace{0.2em} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c &= - \hspace{0.1em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\ - - \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\ - \end{align*} -\f] - -\note -Additional information can be found on this [website](http://campar.in.tum.de/Chair/HandEyeCalibration). -\note -A minimum of 2 motions with non parallel rotation axes are necessary to determine the hand-eye transformation. -So at least 3 different poses are required, but it is strongly recommended to use many more poses. - - */ -CV_EXPORTS_W void calibrateHandEye( InputArrayOfArrays R_gripper2base, InputArrayOfArrays t_gripper2base, - InputArrayOfArrays R_target2cam, InputArrayOfArrays t_target2cam, - OutputArray R_cam2gripper, OutputArray t_cam2gripper, - HandEyeCalibrationMethod method=CALIB_HAND_EYE_TSAI ); - -/** @brief Converts points from Euclidean to homogeneous space. - -@param src Input vector of N-dimensional points. -@param dst Output vector of N+1-dimensional points. - -The function converts points from Euclidean to homogeneous space by appending 1's to the tuple of -point coordinates. That is, each point (x1, x2, ..., xn) is converted to (x1, x2, ..., xn, 1). - */ -CV_EXPORTS_W void convertPointsToHomogeneous( InputArray src, OutputArray dst ); - -/** @brief Converts points from homogeneous to Euclidean space. - -@param src Input vector of N-dimensional points. -@param dst Output vector of N-1-dimensional points. - -The function converts points homogeneous to Euclidean space using perspective projection. That is, -each point (x1, x2, ... x(n-1), xn) is converted to (x1/xn, x2/xn, ..., x(n-1)/xn). When xn=0, the -output point coordinates will be (0,0,0,...). - */ -CV_EXPORTS_W void convertPointsFromHomogeneous( InputArray src, OutputArray dst ); - -/** @brief Converts points to/from homogeneous coordinates. - -@param src Input array or vector of 2D, 3D, or 4D points. -@param dst Output vector of 2D, 3D, or 4D points. - -The function converts 2D or 3D points from/to homogeneous coordinates by calling either -convertPointsToHomogeneous or convertPointsFromHomogeneous. - -@note The function is obsolete. Use one of the previous two functions instead. - */ -CV_EXPORTS void convertPointsHomogeneous( InputArray src, OutputArray dst ); - -/** @brief Calculates a fundamental matrix from the corresponding points in two images. - -@param points1 Array of N points from the first image. The point coordinates should be -floating-point (single or double precision). -@param points2 Array of the second image points of the same size and format as points1 . -@param method Method for computing a fundamental matrix. -- **CV_FM_7POINT** for a 7-point algorithm. \f$N = 7\f$ -- **CV_FM_8POINT** for an 8-point algorithm. \f$N \ge 8\f$ -- **CV_FM_RANSAC** for the RANSAC algorithm. \f$N \ge 8\f$ -- **CV_FM_LMEDS** for the LMedS algorithm. \f$N \ge 8\f$ -@param ransacReprojThreshold Parameter used only for RANSAC. It is the maximum distance from a point to an epipolar -line in pixels, beyond which the point is considered an outlier and is not used for computing the -final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the -point localization, image resolution, and the image noise. -@param confidence Parameter used for the RANSAC and LMedS methods only. It specifies a desirable level -of confidence (probability) that the estimated matrix is correct. -@param mask - -The epipolar geometry is described by the following equation: - -\f[[p_2; 1]^T F [p_1; 1] = 0\f] - -where \f$F\f$ is a fundamental matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding points in the first and the -second images, respectively. - -The function calculates the fundamental matrix using one of four methods listed above and returns -the found fundamental matrix. Normally just one matrix is found. But in case of the 7-point -algorithm, the function may return up to 3 solutions ( \f$9 \times 3\f$ matrix that stores all 3 -matrices sequentially). - -The calculated fundamental matrix may be passed further to computeCorrespondEpilines that finds the -epipolar lines corresponding to the specified points. It can also be passed to -stereoRectifyUncalibrated to compute the rectification transformation. : -@code - // Example. Estimation of fundamental matrix using the RANSAC algorithm - int point_count = 100; - vector points1(point_count); - vector points2(point_count); - - // initialize the points here ... - for( int i = 0; i < point_count; i++ ) - { - points1[i] = ...; - points2[i] = ...; - } - - Mat fundamental_matrix = - findFundamentalMat(points1, points2, FM_RANSAC, 3, 0.99); -@endcode - */ -CV_EXPORTS_W Mat findFundamentalMat( InputArray points1, InputArray points2, - int method = FM_RANSAC, - double ransacReprojThreshold = 3., double confidence = 0.99, - OutputArray mask = noArray() ); - -/** @overload */ -CV_EXPORTS Mat findFundamentalMat( InputArray points1, InputArray points2, - OutputArray mask, int method = FM_RANSAC, - double ransacReprojThreshold = 3., double confidence = 0.99 ); - -/** @brief Calculates an essential matrix from the corresponding points in two images. - -@param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should -be floating-point (single or double precision). -@param points2 Array of the second image points of the same size and format as points1 . -@param cameraMatrix Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . -Note that this function assumes that points1 and points2 are feature points from cameras with the -same camera matrix. -@param method Method for computing an essential matrix. -- **RANSAC** for the RANSAC algorithm. -- **LMEDS** for the LMedS algorithm. -@param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of -confidence (probability) that the estimated matrix is correct. -@param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar -line in pixels, beyond which the point is considered an outlier and is not used for computing the -final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the -point localization, image resolution, and the image noise. -@param mask Output array of N elements, every element of which is set to 0 for outliers and to 1 -for the other points. The array is computed only in the RANSAC and LMedS methods. - -This function estimates essential matrix based on the five-point algorithm solver in @cite Nister03 . -@cite SteweniusCFS is also a related. The epipolar geometry is described by the following equation: - -\f[[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0\f] - -where \f$E\f$ is an essential matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding points in the first and the -second images, respectively. The result of this function may be passed further to -decomposeEssentialMat or recoverPose to recover the relative pose between cameras. - */ -CV_EXPORTS_W Mat findEssentialMat( InputArray points1, InputArray points2, - InputArray cameraMatrix, int method = RANSAC, - double prob = 0.999, double threshold = 1.0, - OutputArray mask = noArray() ); - -/** @overload -@param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should -be floating-point (single or double precision). -@param points2 Array of the second image points of the same size and format as points1 . -@param focal focal length of the camera. Note that this function assumes that points1 and points2 -are feature points from cameras with same focal length and principal point. -@param pp principal point of the camera. -@param method Method for computing a fundamental matrix. -- **RANSAC** for the RANSAC algorithm. -- **LMEDS** for the LMedS algorithm. -@param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar -line in pixels, beyond which the point is considered an outlier and is not used for computing the -final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the -point localization, image resolution, and the image noise. -@param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of -confidence (probability) that the estimated matrix is correct. -@param mask Output array of N elements, every element of which is set to 0 for outliers and to 1 -for the other points. The array is computed only in the RANSAC and LMedS methods. - -This function differs from the one above that it computes camera matrix from focal length and -principal point: - -\f[K = -\begin{bmatrix} -f & 0 & x_{pp} \\ -0 & f & y_{pp} \\ -0 & 0 & 1 -\end{bmatrix}\f] - */ -CV_EXPORTS_W Mat findEssentialMat( InputArray points1, InputArray points2, - double focal = 1.0, Point2d pp = Point2d(0, 0), - int method = RANSAC, double prob = 0.999, - double threshold = 1.0, OutputArray mask = noArray() ); - -/** @brief Decompose an essential matrix to possible rotations and translation. - -@param E The input essential matrix. -@param R1 One possible rotation matrix. -@param R2 Another possible rotation matrix. -@param t One possible translation. - -This function decompose an essential matrix E using svd decomposition @cite HartleyZ00 . Generally 4 -possible poses exists for a given E. They are \f$[R_1, t]\f$, \f$[R_1, -t]\f$, \f$[R_2, t]\f$, \f$[R_2, -t]\f$. By -decomposing E, you can only get the direction of the translation, so the function returns unit t. - */ -CV_EXPORTS_W void decomposeEssentialMat( InputArray E, OutputArray R1, OutputArray R2, OutputArray t ); - -/** @brief Recover relative camera rotation and translation from an estimated essential matrix and the -corresponding points in two images, using cheirality check. Returns the number of inliers which pass -the check. - -@param E The input essential matrix. -@param points1 Array of N 2D points from the first image. The point coordinates should be -floating-point (single or double precision). -@param points2 Array of the second image points of the same size and format as points1 . -@param cameraMatrix Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . -Note that this function assumes that points1 and points2 are feature points from cameras with the -same camera matrix. -@param R Recovered relative rotation. -@param t Recovered relative translation. -@param mask Input/output mask for inliers in points1 and points2. -: If it is not empty, then it marks inliers in points1 and points2 for then given essential -matrix E. Only these inliers will be used to recover pose. In the output mask only inliers -which pass the cheirality check. -This function decomposes an essential matrix using decomposeEssentialMat and then verifies possible -pose hypotheses by doing cheirality check. The cheirality check basically means that the -triangulated 3D points should have positive depth. Some details can be found in @cite Nister03 . - -This function can be used to process output E and mask from findEssentialMat. In this scenario, -points1 and points2 are the same input for findEssentialMat. : -@code - // Example. Estimation of fundamental matrix using the RANSAC algorithm - int point_count = 100; - vector points1(point_count); - vector points2(point_count); - - // initialize the points here ... - for( int i = 0; i < point_count; i++ ) - { - points1[i] = ...; - points2[i] = ...; - } - - // cametra matrix with both focal lengths = 1, and principal point = (0, 0) - Mat cameraMatrix = Mat::eye(3, 3, CV_64F); - - Mat E, R, t, mask; - - E = findEssentialMat(points1, points2, cameraMatrix, RANSAC, 0.999, 1.0, mask); - recoverPose(E, points1, points2, cameraMatrix, R, t, mask); -@endcode - */ -CV_EXPORTS_W int recoverPose( InputArray E, InputArray points1, InputArray points2, - InputArray cameraMatrix, OutputArray R, OutputArray t, - InputOutputArray mask = noArray() ); - -/** @overload -@param E The input essential matrix. -@param points1 Array of N 2D points from the first image. The point coordinates should be -floating-point (single or double precision). -@param points2 Array of the second image points of the same size and format as points1 . -@param R Recovered relative rotation. -@param t Recovered relative translation. -@param focal Focal length of the camera. Note that this function assumes that points1 and points2 -are feature points from cameras with same focal length and principal point. -@param pp principal point of the camera. -@param mask Input/output mask for inliers in points1 and points2. -: If it is not empty, then it marks inliers in points1 and points2 for then given essential -matrix E. Only these inliers will be used to recover pose. In the output mask only inliers -which pass the cheirality check. - -This function differs from the one above that it computes camera matrix from focal length and -principal point: - -\f[K = -\begin{bmatrix} -f & 0 & x_{pp} \\ -0 & f & y_{pp} \\ -0 & 0 & 1 -\end{bmatrix}\f] - */ -CV_EXPORTS_W int recoverPose( InputArray E, InputArray points1, InputArray points2, - OutputArray R, OutputArray t, - double focal = 1.0, Point2d pp = Point2d(0, 0), - InputOutputArray mask = noArray() ); - -/** @overload -@param E The input essential matrix. -@param points1 Array of N 2D points from the first image. The point coordinates should be -floating-point (single or double precision). -@param points2 Array of the second image points of the same size and format as points1. -@param cameraMatrix Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . -Note that this function assumes that points1 and points2 are feature points from cameras with the -same camera matrix. -@param R Recovered relative rotation. -@param t Recovered relative translation. -@param distanceThresh threshold distance which is used to filter out far away points (i.e. infinite points). -@param mask Input/output mask for inliers in points1 and points2. -: If it is not empty, then it marks inliers in points1 and points2 for then given essential -matrix E. Only these inliers will be used to recover pose. In the output mask only inliers -which pass the cheirality check. -@param triangulatedPoints 3d points which were reconstructed by triangulation. - */ - -CV_EXPORTS_W int recoverPose( InputArray E, InputArray points1, InputArray points2, - InputArray cameraMatrix, OutputArray R, OutputArray t, double distanceThresh, InputOutputArray mask = noArray(), - OutputArray triangulatedPoints = noArray()); - -/** @brief For points in an image of a stereo pair, computes the corresponding epilines in the other image. - -@param points Input points. \f$N \times 1\f$ or \f$1 \times N\f$ matrix of type CV_32FC2 or -vector\ . -@param whichImage Index of the image (1 or 2) that contains the points . -@param F Fundamental matrix that can be estimated using findFundamentalMat or stereoRectify . -@param lines Output vector of the epipolar lines corresponding to the points in the other image. -Each line \f$ax + by + c=0\f$ is encoded by 3 numbers \f$(a, b, c)\f$ . - -For every point in one of the two images of a stereo pair, the function finds the equation of the -corresponding epipolar line in the other image. - -From the fundamental matrix definition (see findFundamentalMat ), line \f$l^{(2)}_i\f$ in the second -image for the point \f$p^{(1)}_i\f$ in the first image (when whichImage=1 ) is computed as: - -\f[l^{(2)}_i = F p^{(1)}_i\f] - -And vice versa, when whichImage=2, \f$l^{(1)}_i\f$ is computed from \f$p^{(2)}_i\f$ as: - -\f[l^{(1)}_i = F^T p^{(2)}_i\f] - -Line coefficients are defined up to a scale. They are normalized so that \f$a_i^2+b_i^2=1\f$ . - */ -CV_EXPORTS_W void computeCorrespondEpilines( InputArray points, int whichImage, - InputArray F, OutputArray lines ); - -/** @brief Reconstructs points by triangulation. - -@param projMatr1 3x4 projection matrix of the first camera. -@param projMatr2 3x4 projection matrix of the second camera. -@param projPoints1 2xN array of feature points in the first image. In case of c++ version it can -be also a vector of feature points or two-channel matrix of size 1xN or Nx1. -@param projPoints2 2xN array of corresponding points in the second image. In case of c++ version -it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1. -@param points4D 4xN array of reconstructed points in homogeneous coordinates. - -The function reconstructs 3-dimensional points (in homogeneous coordinates) by using their -observations with a stereo camera. Projections matrices can be obtained from stereoRectify. - -@note - Keep in mind that all input data should be of float type in order for this function to work. - -@sa - reprojectImageTo3D - */ -CV_EXPORTS_W void triangulatePoints( InputArray projMatr1, InputArray projMatr2, - InputArray projPoints1, InputArray projPoints2, - OutputArray points4D ); - -/** @brief Refines coordinates of corresponding points. - -@param F 3x3 fundamental matrix. -@param points1 1xN array containing the first set of points. -@param points2 1xN array containing the second set of points. -@param newPoints1 The optimized points1. -@param newPoints2 The optimized points2. - -The function implements the Optimal Triangulation Method (see Multiple View Geometry for details). -For each given point correspondence points1[i] \<-\> points2[i], and a fundamental matrix F, it -computes the corrected correspondences newPoints1[i] \<-\> newPoints2[i] that minimize the geometric -error \f$d(points1[i], newPoints1[i])^2 + d(points2[i],newPoints2[i])^2\f$ (where \f$d(a,b)\f$ is the -geometric distance between points \f$a\f$ and \f$b\f$ ) subject to the epipolar constraint -\f$newPoints2^T * F * newPoints1 = 0\f$ . - */ -CV_EXPORTS_W void correctMatches( InputArray F, InputArray points1, InputArray points2, - OutputArray newPoints1, OutputArray newPoints2 ); - -/** @brief Filters off small noise blobs (speckles) in the disparity map - -@param img The input 16-bit signed disparity image -@param newVal The disparity value used to paint-off the speckles -@param maxSpeckleSize The maximum speckle size to consider it a speckle. Larger blobs are not -affected by the algorithm -@param maxDiff Maximum difference between neighbor disparity pixels to put them into the same -blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point -disparity map, where disparity values are multiplied by 16, this scale factor should be taken into -account when specifying this parameter value. -@param buf The optional temporary buffer to avoid memory allocation within the function. - */ -CV_EXPORTS_W void filterSpeckles( InputOutputArray img, double newVal, - int maxSpeckleSize, double maxDiff, - InputOutputArray buf = noArray() ); - -//! computes valid disparity ROI from the valid ROIs of the rectified images (that are returned by cv::stereoRectify()) -CV_EXPORTS_W Rect getValidDisparityROI( Rect roi1, Rect roi2, - int minDisparity, int numberOfDisparities, - int SADWindowSize ); - -//! validates disparity using the left-right check. The matrix "cost" should be computed by the stereo correspondence algorithm -CV_EXPORTS_W void validateDisparity( InputOutputArray disparity, InputArray cost, - int minDisparity, int numberOfDisparities, - int disp12MaxDisp = 1 ); - -/** @brief Reprojects a disparity image to 3D space. - -@param disparity Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit -floating-point disparity image. If 16-bit signed format is used, the values are assumed to have no -fractional bits. -@param _3dImage Output 3-channel floating-point image of the same size as disparity . Each -element of _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity -map. -@param Q \f$4 \times 4\f$ perspective transformation matrix that can be obtained with stereoRectify. -@param handleMissingValues Indicates, whether the function should handle missing values (i.e. -points where the disparity was not computed). If handleMissingValues=true, then pixels with the -minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed -to 3D points with a very large Z value (currently set to 10000). -@param ddepth The optional output array depth. If it is -1, the output image will have CV_32F -depth. ddepth can also be set to CV_16S, CV_32S or CV_32F. - -The function transforms a single-channel disparity map to a 3-channel image representing a 3D -surface. That is, for each pixel (x,y) and the corresponding disparity d=disparity(x,y) , it -computes: - -\f[\begin{array}{l} [X \; Y \; Z \; W]^T = \texttt{Q} *[x \; y \; \texttt{disparity} (x,y) \; 1]^T \\ \texttt{\_3dImage} (x,y) = (X/W, \; Y/W, \; Z/W) \end{array}\f] - -The matrix Q can be an arbitrary \f$4 \times 4\f$ matrix (for example, the one computed by -stereoRectify). To reproject a sparse set of points {(x,y,d),...} to 3D space, use -perspectiveTransform . - */ -CV_EXPORTS_W void reprojectImageTo3D( InputArray disparity, - OutputArray _3dImage, InputArray Q, - bool handleMissingValues = false, - int ddepth = -1 ); - -/** @brief Calculates the Sampson Distance between two points. - -The function cv::sampsonDistance calculates and returns the first order approximation of the geometric error as: -\f[ -sd( \texttt{pt1} , \texttt{pt2} )= -\frac{(\texttt{pt2}^t \cdot \texttt{F} \cdot \texttt{pt1})^2} -{((\texttt{F} \cdot \texttt{pt1})(0))^2 + -((\texttt{F} \cdot \texttt{pt1})(1))^2 + -((\texttt{F}^t \cdot \texttt{pt2})(0))^2 + -((\texttt{F}^t \cdot \texttt{pt2})(1))^2} -\f] -The fundamental matrix may be calculated using the cv::findFundamentalMat function. See @cite HartleyZ00 11.4.3 for details. -@param pt1 first homogeneous 2d point -@param pt2 second homogeneous 2d point -@param F fundamental matrix -@return The computed Sampson distance. -*/ -CV_EXPORTS_W double sampsonDistance(InputArray pt1, InputArray pt2, InputArray F); - -/** @brief Computes an optimal affine transformation between two 3D point sets. - -It computes -\f[ -\begin{bmatrix} -x\\ -y\\ -z\\ -\end{bmatrix} -= -\begin{bmatrix} -a_{11} & a_{12} & a_{13}\\ -a_{21} & a_{22} & a_{23}\\ -a_{31} & a_{32} & a_{33}\\ -\end{bmatrix} -\begin{bmatrix} -X\\ -Y\\ -Z\\ -\end{bmatrix} -+ -\begin{bmatrix} -b_1\\ -b_2\\ -b_3\\ -\end{bmatrix} -\f] - -@param src First input 3D point set containing \f$(X,Y,Z)\f$. -@param dst Second input 3D point set containing \f$(x,y,z)\f$. -@param out Output 3D affine transformation matrix \f$3 \times 4\f$ of the form -\f[ -\begin{bmatrix} -a_{11} & a_{12} & a_{13} & b_1\\ -a_{21} & a_{22} & a_{23} & b_2\\ -a_{31} & a_{32} & a_{33} & b_3\\ -\end{bmatrix} -\f] -@param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier). -@param ransacThreshold Maximum reprojection error in the RANSAC algorithm to consider a point as -an inlier. -@param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything -between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation -significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation. - -The function estimates an optimal 3D affine transformation between two 3D point sets using the -RANSAC algorithm. - */ -CV_EXPORTS_W int estimateAffine3D(InputArray src, InputArray dst, - OutputArray out, OutputArray inliers, - double ransacThreshold = 3, double confidence = 0.99); - -/** @brief Computes an optimal affine transformation between two 2D point sets. - -It computes -\f[ -\begin{bmatrix} -x\\ -y\\ -\end{bmatrix} -= -\begin{bmatrix} -a_{11} & a_{12}\\ -a_{21} & a_{22}\\ -\end{bmatrix} -\begin{bmatrix} -X\\ -Y\\ -\end{bmatrix} -+ -\begin{bmatrix} -b_1\\ -b_2\\ -\end{bmatrix} -\f] - -@param from First input 2D point set containing \f$(X,Y)\f$. -@param to Second input 2D point set containing \f$(x,y)\f$. -@param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier). -@param method Robust method used to compute transformation. The following methods are possible: -- cv::RANSAC - RANSAC-based robust method -- cv::LMEDS - Least-Median robust method -RANSAC is the default method. -@param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider -a point as an inlier. Applies only to RANSAC. -@param maxIters The maximum number of robust method iterations. -@param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything -between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation -significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation. -@param refineIters Maximum number of iterations of refining algorithm (Levenberg-Marquardt). -Passing 0 will disable refining, so the output matrix will be output of robust method. - -@return Output 2D affine transformation matrix \f$2 \times 3\f$ or empty matrix if transformation -could not be estimated. The returned matrix has the following form: -\f[ -\begin{bmatrix} -a_{11} & a_{12} & b_1\\ -a_{21} & a_{22} & b_2\\ -\end{bmatrix} -\f] - -The function estimates an optimal 2D affine transformation between two 2D point sets using the -selected robust algorithm. - -The computed transformation is then refined further (using only inliers) with the -Levenberg-Marquardt method to reduce the re-projection error even more. - -@note -The RANSAC method can handle practically any ratio of outliers but needs a threshold to -distinguish inliers from outliers. The method LMeDS does not need any threshold but it works -correctly only when there are more than 50% of inliers. - -@sa estimateAffinePartial2D, getAffineTransform -*/ -CV_EXPORTS_W cv::Mat estimateAffine2D(InputArray from, InputArray to, OutputArray inliers = noArray(), - int method = RANSAC, double ransacReprojThreshold = 3, - size_t maxIters = 2000, double confidence = 0.99, - size_t refineIters = 10); - -/** @brief Computes an optimal limited affine transformation with 4 degrees of freedom between -two 2D point sets. - -@param from First input 2D point set. -@param to Second input 2D point set. -@param inliers Output vector indicating which points are inliers. -@param method Robust method used to compute transformation. The following methods are possible: -- cv::RANSAC - RANSAC-based robust method -- cv::LMEDS - Least-Median robust method -RANSAC is the default method. -@param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider -a point as an inlier. Applies only to RANSAC. -@param maxIters The maximum number of robust method iterations. -@param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything -between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation -significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation. -@param refineIters Maximum number of iterations of refining algorithm (Levenberg-Marquardt). -Passing 0 will disable refining, so the output matrix will be output of robust method. - -@return Output 2D affine transformation (4 degrees of freedom) matrix \f$2 \times 3\f$ or -empty matrix if transformation could not be estimated. - -The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to -combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust -estimation. - -The computed transformation is then refined further (using only inliers) with the -Levenberg-Marquardt method to reduce the re-projection error even more. - -Estimated transformation matrix is: -\f[ \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\ - \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y -\end{bmatrix} \f] -Where \f$ \theta \f$ is the rotation angle, \f$ s \f$ the scaling factor and \f$ t_x, t_y \f$ are -translations in \f$ x, y \f$ axes respectively. - -@note -The RANSAC method can handle practically any ratio of outliers but need a threshold to -distinguish inliers from outliers. The method LMeDS does not need any threshold but it works -correctly only when there are more than 50% of inliers. - -@sa estimateAffine2D, getAffineTransform -*/ -CV_EXPORTS_W cv::Mat estimateAffinePartial2D(InputArray from, InputArray to, OutputArray inliers = noArray(), - int method = RANSAC, double ransacReprojThreshold = 3, - size_t maxIters = 2000, double confidence = 0.99, - size_t refineIters = 10); - -/** @example samples/cpp/tutorial_code/features2D/Homography/decompose_homography.cpp -An example program with homography decomposition. - -Check @ref tutorial_homography "the corresponding tutorial" for more details. -*/ - -/** @brief Decompose a homography matrix to rotation(s), translation(s) and plane normal(s). - -@param H The input homography matrix between two images. -@param K The input intrinsic camera calibration matrix. -@param rotations Array of rotation matrices. -@param translations Array of translation matrices. -@param normals Array of plane normal matrices. - -This function extracts relative camera motion between two views observing a planar object from the -homography H induced by the plane. The intrinsic camera matrix K must also be provided. The function -may return up to four mathematical solution sets. At least two of the solutions may further be -invalidated if point correspondences are available by applying positive depth constraint (all points -must be in front of the camera). The decomposition method is described in detail in @cite Malis . - */ -CV_EXPORTS_W int decomposeHomographyMat(InputArray H, - InputArray K, - OutputArrayOfArrays rotations, - OutputArrayOfArrays translations, - OutputArrayOfArrays normals); - -/** @brief Filters homography decompositions based on additional information. - -@param rotations Vector of rotation matrices. -@param normals Vector of plane normal matrices. -@param beforePoints Vector of (rectified) visible reference points before the homography is applied -@param afterPoints Vector of (rectified) visible reference points after the homography is applied -@param possibleSolutions Vector of int indices representing the viable solution set after filtering -@param pointsMask optional Mat/Vector of 8u type representing the mask for the inliers as given by the findHomography function - -This function is intended to filter the output of the decomposeHomographyMat based on additional -information as described in @cite Malis . The summary of the method: the decomposeHomographyMat function -returns 2 unique solutions and their "opposites" for a total of 4 solutions. If we have access to the -sets of points visible in the camera frame before and after the homography transformation is applied, -we can determine which are the true potential solutions and which are the opposites by verifying which -homographies are consistent with all visible reference points being in front of the camera. The inputs -are left unchanged; the filtered solution set is returned as indices into the existing one. - -*/ -CV_EXPORTS_W void filterHomographyDecompByVisibleRefpoints(InputArrayOfArrays rotations, - InputArrayOfArrays normals, - InputArray beforePoints, - InputArray afterPoints, - OutputArray possibleSolutions, - InputArray pointsMask = noArray()); - -/** @brief The base class for stereo correspondence algorithms. - */ -class CV_EXPORTS_W StereoMatcher : public Algorithm -{ -public: - enum { DISP_SHIFT = 4, - DISP_SCALE = (1 << DISP_SHIFT) - }; - - /** @brief Computes disparity map for the specified stereo pair - - @param left Left 8-bit single-channel image. - @param right Right image of the same size and the same type as the left one. - @param disparity Output disparity map. It has the same size as the input images. Some algorithms, - like StereoBM or StereoSGBM compute 16-bit fixed-point disparity map (where each disparity value - has 4 fractional bits), whereas other algorithms output 32-bit floating-point disparity map. - */ - CV_WRAP virtual void compute( InputArray left, InputArray right, - OutputArray disparity ) = 0; - - CV_WRAP virtual int getMinDisparity() const = 0; - CV_WRAP virtual void setMinDisparity(int minDisparity) = 0; - - CV_WRAP virtual int getNumDisparities() const = 0; - CV_WRAP virtual void setNumDisparities(int numDisparities) = 0; - - CV_WRAP virtual int getBlockSize() const = 0; - CV_WRAP virtual void setBlockSize(int blockSize) = 0; - - CV_WRAP virtual int getSpeckleWindowSize() const = 0; - CV_WRAP virtual void setSpeckleWindowSize(int speckleWindowSize) = 0; - - CV_WRAP virtual int getSpeckleRange() const = 0; - CV_WRAP virtual void setSpeckleRange(int speckleRange) = 0; - - CV_WRAP virtual int getDisp12MaxDiff() const = 0; - CV_WRAP virtual void setDisp12MaxDiff(int disp12MaxDiff) = 0; -}; - - -/** @brief Class for computing stereo correspondence using the block matching algorithm, introduced and -contributed to OpenCV by K. Konolige. - */ -class CV_EXPORTS_W StereoBM : public StereoMatcher -{ -public: - enum { PREFILTER_NORMALIZED_RESPONSE = 0, - PREFILTER_XSOBEL = 1 - }; - - CV_WRAP virtual int getPreFilterType() const = 0; - CV_WRAP virtual void setPreFilterType(int preFilterType) = 0; - - CV_WRAP virtual int getPreFilterSize() const = 0; - CV_WRAP virtual void setPreFilterSize(int preFilterSize) = 0; - - CV_WRAP virtual int getPreFilterCap() const = 0; - CV_WRAP virtual void setPreFilterCap(int preFilterCap) = 0; - - CV_WRAP virtual int getTextureThreshold() const = 0; - CV_WRAP virtual void setTextureThreshold(int textureThreshold) = 0; - - CV_WRAP virtual int getUniquenessRatio() const = 0; - CV_WRAP virtual void setUniquenessRatio(int uniquenessRatio) = 0; - - CV_WRAP virtual int getSmallerBlockSize() const = 0; - CV_WRAP virtual void setSmallerBlockSize(int blockSize) = 0; - - CV_WRAP virtual Rect getROI1() const = 0; - CV_WRAP virtual void setROI1(Rect roi1) = 0; - - CV_WRAP virtual Rect getROI2() const = 0; - CV_WRAP virtual void setROI2(Rect roi2) = 0; - - /** @brief Creates StereoBM object - - @param numDisparities the disparity search range. For each pixel algorithm will find the best - disparity from 0 (default minimum disparity) to numDisparities. The search range can then be - shifted by changing the minimum disparity. - @param blockSize the linear size of the blocks compared by the algorithm. The size should be odd - (as the block is centered at the current pixel). Larger block size implies smoother, though less - accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher - chance for algorithm to find a wrong correspondence. - - The function create StereoBM object. You can then call StereoBM::compute() to compute disparity for - a specific stereo pair. - */ - CV_WRAP static Ptr create(int numDisparities = 0, int blockSize = 21); -}; - -/** @brief The class implements the modified H. Hirschmuller algorithm @cite HH08 that differs from the original -one as follows: - -- By default, the algorithm is single-pass, which means that you consider only 5 directions -instead of 8. Set mode=StereoSGBM::MODE_HH in createStereoSGBM to run the full variant of the -algorithm but beware that it may consume a lot of memory. -- The algorithm matches blocks, not individual pixels. Though, setting blockSize=1 reduces the -blocks to single pixels. -- Mutual information cost function is not implemented. Instead, a simpler Birchfield-Tomasi -sub-pixel metric from @cite BT98 is used. Though, the color images are supported as well. -- Some pre- and post- processing steps from K. Konolige algorithm StereoBM are included, for -example: pre-filtering (StereoBM::PREFILTER_XSOBEL type) and post-filtering (uniqueness -check, quadratic interpolation and speckle filtering). - -@note - - (Python) An example illustrating the use of the StereoSGBM matching algorithm can be found - at opencv_source_code/samples/python/stereo_match.py - */ -class CV_EXPORTS_W StereoSGBM : public StereoMatcher -{ -public: - enum - { - MODE_SGBM = 0, - MODE_HH = 1, - MODE_SGBM_3WAY = 2, - MODE_HH4 = 3 - }; - - CV_WRAP virtual int getPreFilterCap() const = 0; - CV_WRAP virtual void setPreFilterCap(int preFilterCap) = 0; - - CV_WRAP virtual int getUniquenessRatio() const = 0; - CV_WRAP virtual void setUniquenessRatio(int uniquenessRatio) = 0; - - CV_WRAP virtual int getP1() const = 0; - CV_WRAP virtual void setP1(int P1) = 0; - - CV_WRAP virtual int getP2() const = 0; - CV_WRAP virtual void setP2(int P2) = 0; - - CV_WRAP virtual int getMode() const = 0; - CV_WRAP virtual void setMode(int mode) = 0; - - /** @brief Creates StereoSGBM object - - @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes - rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. - @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than - zero. In the current implementation, this parameter must be divisible by 16. - @param blockSize Matched block size. It must be an odd number \>=1 . Normally, it should be - somewhere in the 3..11 range. - @param P1 The first parameter controlling the disparity smoothness. See below. - @param P2 The second parameter controlling the disparity smoothness. The larger the values are, - the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 - between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor - pixels. The algorithm requires P2 \> P1 . See stereo_match.cpp sample where some reasonably good - P1 and P2 values are shown (like 8\*number_of_image_channels\*SADWindowSize\*SADWindowSize and - 32\*number_of_image_channels\*SADWindowSize\*SADWindowSize , respectively). - @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right - disparity check. Set it to a non-positive value to disable the check. - @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first - computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. - The result values are passed to the Birchfield-Tomasi pixel cost function. - @param uniquenessRatio Margin in percentage by which the best (minimum) computed cost function - value should "win" the second best value to consider the found match correct. Normally, a value - within the 5-15 range is good enough. - @param speckleWindowSize Maximum size of smooth disparity regions to consider their noise speckles - and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the - 50-200 range. - @param speckleRange Maximum disparity variation within each connected component. If you do speckle - filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. - Normally, 1 or 2 is good enough. - @param mode Set it to StereoSGBM::MODE_HH to run the full-scale two-pass dynamic programming - algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and - huge for HD-size pictures. By default, it is set to false . - - The first constructor initializes StereoSGBM with all the default parameters. So, you only have to - set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter - to a custom value. - */ - CV_WRAP static Ptr create(int minDisparity = 0, int numDisparities = 16, int blockSize = 3, - int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, - int preFilterCap = 0, int uniquenessRatio = 0, - int speckleWindowSize = 0, int speckleRange = 0, - int mode = StereoSGBM::MODE_SGBM); -}; - -//! @} calib3d - -/** @brief The methods in this namespace use a so-called fisheye camera model. - @ingroup calib3d_fisheye -*/ -namespace fisheye -{ -//! @addtogroup calib3d_fisheye -//! @{ - - enum{ - CALIB_USE_INTRINSIC_GUESS = 1 << 0, - CALIB_RECOMPUTE_EXTRINSIC = 1 << 1, - CALIB_CHECK_COND = 1 << 2, - CALIB_FIX_SKEW = 1 << 3, - CALIB_FIX_K1 = 1 << 4, - CALIB_FIX_K2 = 1 << 5, - CALIB_FIX_K3 = 1 << 6, - CALIB_FIX_K4 = 1 << 7, - CALIB_FIX_INTRINSIC = 1 << 8, - CALIB_FIX_PRINCIPAL_POINT = 1 << 9 - }; - - /** @brief Projects points using fisheye model - - @param objectPoints Array of object points, 1xN/Nx1 3-channel (or vector\ ), where N is - the number of points in the view. - @param imagePoints Output array of image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, or - vector\. - @param affine - @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$. - @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$. - @param alpha The skew coefficient. - @param jacobian Optional output 2Nx15 jacobian matrix of derivatives of image points with respect - to components of the focal lengths, coordinates of the principal point, distortion coefficients, - rotation vector, translation vector, and the skew. In the old interface different components of - the jacobian are returned via different output parameters. - - The function computes projections of 3D points to the image plane given intrinsic and extrinsic - camera parameters. Optionally, the function computes Jacobians - matrices of partial derivatives of - image points coordinates (as functions of all the input parameters) with respect to the particular - parameters, intrinsic and/or extrinsic. - */ - CV_EXPORTS void projectPoints(InputArray objectPoints, OutputArray imagePoints, const Affine3d& affine, - InputArray K, InputArray D, double alpha = 0, OutputArray jacobian = noArray()); - - /** @overload */ - CV_EXPORTS_W void projectPoints(InputArray objectPoints, OutputArray imagePoints, InputArray rvec, InputArray tvec, - InputArray K, InputArray D, double alpha = 0, OutputArray jacobian = noArray()); - - /** @brief Distorts 2D points using fisheye model. - - @param undistorted Array of object points, 1xN/Nx1 2-channel (or vector\ ), where N is - the number of points in the view. - @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$. - @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$. - @param alpha The skew coefficient. - @param distorted Output array of image points, 1xN/Nx1 2-channel, or vector\ . - - Note that the function assumes the camera matrix of the undistorted points to be identity. - This means if you want to transform back points undistorted with undistortPoints() you have to - multiply them with \f$P^{-1}\f$. - */ - CV_EXPORTS_W void distortPoints(InputArray undistorted, OutputArray distorted, InputArray K, InputArray D, double alpha = 0); - - /** @brief Undistorts 2D points using fisheye model - - @param distorted Array of object points, 1xN/Nx1 2-channel (or vector\ ), where N is the - number of points in the view. - @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$. - @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$. - @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3 - 1-channel or 1x1 3-channel - @param P New camera matrix (3x3) or new projection matrix (3x4) - @param undistorted Output array of image points, 1xN/Nx1 2-channel, or vector\ . - */ - CV_EXPORTS_W void undistortPoints(InputArray distorted, OutputArray undistorted, - InputArray K, InputArray D, InputArray R = noArray(), InputArray P = noArray()); - - /** @brief Computes undistortion and rectification maps for image transform by cv::remap(). If D is empty zero - distortion is used, if R or P is empty identity matrixes are used. - - @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$. - @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$. - @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3 - 1-channel or 1x1 3-channel - @param P New camera matrix (3x3) or new projection matrix (3x4) - @param size Undistorted image size. - @param m1type Type of the first output map that can be CV_32FC1 or CV_16SC2 . See convertMaps() - for details. - @param map1 The first output map. - @param map2 The second output map. - */ - CV_EXPORTS_W void initUndistortRectifyMap(InputArray K, InputArray D, InputArray R, InputArray P, - const cv::Size& size, int m1type, OutputArray map1, OutputArray map2); - - /** @brief Transforms an image to compensate for fisheye lens distortion. - - @param distorted image with fisheye lens distortion. - @param undistorted Output image with compensated fisheye lens distortion. - @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$. - @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$. - @param Knew Camera matrix of the distorted image. By default, it is the identity matrix but you - may additionally scale and shift the result by using a different matrix. - @param new_size - - The function transforms an image to compensate radial and tangential lens distortion. - - The function is simply a combination of fisheye::initUndistortRectifyMap (with unity R ) and remap - (with bilinear interpolation). See the former function for details of the transformation being - performed. - - See below the results of undistortImage. - - a\) result of undistort of perspective camera model (all possible coefficients (k_1, k_2, k_3, - k_4, k_5, k_6) of distortion were optimized under calibration) - - b\) result of fisheye::undistortImage of fisheye camera model (all possible coefficients (k_1, k_2, - k_3, k_4) of fisheye distortion were optimized under calibration) - - c\) original image was captured with fisheye lens - - Pictures a) and b) almost the same. But if we consider points of image located far from the center - of image, we can notice that on image a) these points are distorted. - - ![image](pics/fisheye_undistorted.jpg) - */ - CV_EXPORTS_W void undistortImage(InputArray distorted, OutputArray undistorted, - InputArray K, InputArray D, InputArray Knew = cv::noArray(), const Size& new_size = Size()); - - /** @brief Estimates new camera matrix for undistortion or rectification. - - @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$. - @param image_size - @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$. - @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3 - 1-channel or 1x1 3-channel - @param P New camera matrix (3x3) or new projection matrix (3x4) - @param balance Sets the new focal length in range between the min focal length and the max focal - length. Balance is in range of [0, 1]. - @param new_size - @param fov_scale Divisor for new focal length. - */ - CV_EXPORTS_W void estimateNewCameraMatrixForUndistortRectify(InputArray K, InputArray D, const Size &image_size, InputArray R, - OutputArray P, double balance = 0.0, const Size& new_size = Size(), double fov_scale = 1.0); - - /** @brief Performs camera calibaration - - @param objectPoints vector of vectors of calibration pattern points in the calibration pattern - coordinate space. - @param imagePoints vector of vectors of the projections of calibration pattern points. - imagePoints.size() and objectPoints.size() and imagePoints[i].size() must be equal to - objectPoints[i].size() for each i. - @param image_size Size of the image used only to initialize the intrinsic camera matrix. - @param K Output 3x3 floating-point camera matrix - \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . If - fisheye::CALIB_USE_INTRINSIC_GUESS/ is specified, some or all of fx, fy, cx, cy must be - initialized before calling the function. - @param D Output vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$. - @param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view. - That is, each k-th rotation vector together with the corresponding k-th translation vector (see - the next output parameter description) brings the calibration pattern from the model coordinate - space (in which object points are specified) to the world coordinate space, that is, a real - position of the calibration pattern in the k-th pattern view (k=0.. *M* -1). - @param tvecs Output vector of translation vectors estimated for each pattern view. - @param flags Different flags that may be zero or a combination of the following values: - - **fisheye::CALIB_USE_INTRINSIC_GUESS** cameraMatrix contains valid initial values of - fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image - center ( imageSize is used), and focal distances are computed in a least-squares fashion. - - **fisheye::CALIB_RECOMPUTE_EXTRINSIC** Extrinsic will be recomputed after each iteration - of intrinsic optimization. - - **fisheye::CALIB_CHECK_COND** The functions will check validity of condition number. - - **fisheye::CALIB_FIX_SKEW** Skew coefficient (alpha) is set to zero and stay zero. - - **fisheye::CALIB_FIX_K1..fisheye::CALIB_FIX_K4** Selected distortion coefficients - are set to zeros and stay zero. - - **fisheye::CALIB_FIX_PRINCIPAL_POINT** The principal point is not changed during the global -optimization. It stays at the center or at a different location specified when CALIB_USE_INTRINSIC_GUESS is set too. - @param criteria Termination criteria for the iterative optimization algorithm. - */ - CV_EXPORTS_W double calibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, const Size& image_size, - InputOutputArray K, InputOutputArray D, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags = 0, - TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON)); - - /** @brief Stereo rectification for fisheye camera model - - @param K1 First camera matrix. - @param D1 First camera distortion parameters. - @param K2 Second camera matrix. - @param D2 Second camera distortion parameters. - @param imageSize Size of the image used for stereo calibration. - @param R Rotation matrix between the coordinate systems of the first and the second - cameras. - @param tvec Translation vector between coordinate systems of the cameras. - @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. - @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. - @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first - camera. - @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second - camera. - @param Q Output \f$4 \times 4\f$ disparity-to-depth mapping matrix (see reprojectImageTo3D ). - @param flags Operation flags that may be zero or CALIB_ZERO_DISPARITY . If the flag is set, - the function makes the principal points of each camera have the same pixel coordinates in the - rectified views. And if the flag is not set, the function may still shift the images in the - horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the - useful image area. - @param newImageSize New image resolution after rectification. The same size should be passed to - initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0) - is passed (default), it is set to the original imageSize . Setting it to larger value can help you - preserve details in the original image, especially when there is a big radial distortion. - @param balance Sets the new focal length in range between the min focal length and the max focal - length. Balance is in range of [0, 1]. - @param fov_scale Divisor for new focal length. - */ - CV_EXPORTS_W void stereoRectify(InputArray K1, InputArray D1, InputArray K2, InputArray D2, const Size &imageSize, InputArray R, InputArray tvec, - OutputArray R1, OutputArray R2, OutputArray P1, OutputArray P2, OutputArray Q, int flags, const Size &newImageSize = Size(), - double balance = 0.0, double fov_scale = 1.0); - - /** @brief Performs stereo calibration - - @param objectPoints Vector of vectors of the calibration pattern points. - @param imagePoints1 Vector of vectors of the projections of the calibration pattern points, - observed by the first camera. - @param imagePoints2 Vector of vectors of the projections of the calibration pattern points, - observed by the second camera. - @param K1 Input/output first camera matrix: - \f$\vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}\f$ , \f$j = 0,\, 1\f$ . If - any of fisheye::CALIB_USE_INTRINSIC_GUESS , fisheye::CALIB_FIX_INTRINSIC are specified, - some or all of the matrix components must be initialized. - @param D1 Input/output vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$ of 4 elements. - @param K2 Input/output second camera matrix. The parameter is similar to K1 . - @param D2 Input/output lens distortion coefficients for the second camera. The parameter is - similar to D1 . - @param imageSize Size of the image used only to initialize intrinsic camera matrix. - @param R Output rotation matrix between the 1st and the 2nd camera coordinate systems. - @param T Output translation vector between the coordinate systems of the cameras. - @param flags Different flags that may be zero or a combination of the following values: - - **fisheye::CALIB_FIX_INTRINSIC** Fix K1, K2? and D1, D2? so that only R, T matrices - are estimated. - - **fisheye::CALIB_USE_INTRINSIC_GUESS** K1, K2 contains valid initial values of - fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image - center (imageSize is used), and focal distances are computed in a least-squares fashion. - - **fisheye::CALIB_RECOMPUTE_EXTRINSIC** Extrinsic will be recomputed after each iteration - of intrinsic optimization. - - **fisheye::CALIB_CHECK_COND** The functions will check validity of condition number. - - **fisheye::CALIB_FIX_SKEW** Skew coefficient (alpha) is set to zero and stay zero. - - **fisheye::CALIB_FIX_K1..4** Selected distortion coefficients are set to zeros and stay - zero. - @param criteria Termination criteria for the iterative optimization algorithm. - */ - CV_EXPORTS_W double stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, - InputOutputArray K1, InputOutputArray D1, InputOutputArray K2, InputOutputArray D2, Size imageSize, - OutputArray R, OutputArray T, int flags = fisheye::CALIB_FIX_INTRINSIC, - TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON)); - -//! @} calib3d_fisheye -} // end namespace fisheye - -} //end namespace cv - -#ifndef DISABLE_OPENCV_24_COMPATIBILITY -#include "opencv2/calib3d/calib3d_c.h" -#endif - -#endif diff --git a/opencv/include/opencv2/calib3d/calib3d.hpp b/opencv/include/opencv2/calib3d/calib3d.hpp deleted file mode 100644 index b3da45e..0000000 --- a/opencv/include/opencv2/calib3d/calib3d.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/calib3d.hpp" diff --git a/opencv/include/opencv2/calib3d/calib3d_c.h b/opencv/include/opencv2/calib3d/calib3d_c.h deleted file mode 100644 index 8ec6390..0000000 --- a/opencv/include/opencv2/calib3d/calib3d_c.h +++ /dev/null @@ -1,427 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CALIB3D_C_H -#define OPENCV_CALIB3D_C_H - -#include "opencv2/core/core_c.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup calib3d_c - @{ - */ - -/****************************************************************************************\ -* Camera Calibration, Pose Estimation and Stereo * -\****************************************************************************************/ - -typedef struct CvPOSITObject CvPOSITObject; - -/* Allocates and initializes CvPOSITObject structure before doing cvPOSIT */ -CVAPI(CvPOSITObject*) cvCreatePOSITObject( CvPoint3D32f* points, int point_count ); - - -/* Runs POSIT (POSe from ITeration) algorithm for determining 3d position of - an object given its model and projection in a weak-perspective case */ -CVAPI(void) cvPOSIT( CvPOSITObject* posit_object, CvPoint2D32f* image_points, - double focal_length, CvTermCriteria criteria, - float* rotation_matrix, float* translation_vector); - -/* Releases CvPOSITObject structure */ -CVAPI(void) cvReleasePOSITObject( CvPOSITObject** posit_object ); - -/* updates the number of RANSAC iterations */ -CVAPI(int) cvRANSACUpdateNumIters( double p, double err_prob, - int model_points, int max_iters ); - -CVAPI(void) cvConvertPointsHomogeneous( const CvMat* src, CvMat* dst ); - -/* Calculates fundamental matrix given a set of corresponding points */ -#define CV_FM_7POINT 1 -#define CV_FM_8POINT 2 - -#define CV_LMEDS 4 -#define CV_RANSAC 8 - -#define CV_FM_LMEDS_ONLY CV_LMEDS -#define CV_FM_RANSAC_ONLY CV_RANSAC -#define CV_FM_LMEDS CV_LMEDS -#define CV_FM_RANSAC CV_RANSAC - -enum -{ - CV_ITERATIVE = 0, - CV_EPNP = 1, // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" - CV_P3P = 2, // X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem" - CV_DLS = 3 // Joel A. Hesch and Stergios I. Roumeliotis. "A Direct Least-Squares (DLS) Method for PnP" -}; - -CVAPI(int) cvFindFundamentalMat( const CvMat* points1, const CvMat* points2, - CvMat* fundamental_matrix, - int method CV_DEFAULT(CV_FM_RANSAC), - double param1 CV_DEFAULT(3.), double param2 CV_DEFAULT(0.99), - CvMat* status CV_DEFAULT(NULL) ); - -/* For each input point on one of images - computes parameters of the corresponding - epipolar line on the other image */ -CVAPI(void) cvComputeCorrespondEpilines( const CvMat* points, - int which_image, - const CvMat* fundamental_matrix, - CvMat* correspondent_lines ); - -/* Triangulation functions */ - -CVAPI(void) cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, - CvMat* projPoints1, CvMat* projPoints2, - CvMat* points4D); - -CVAPI(void) cvCorrectMatches(CvMat* F, CvMat* points1, CvMat* points2, - CvMat* new_points1, CvMat* new_points2); - - -/* Computes the optimal new camera matrix according to the free scaling parameter alpha: - alpha=0 - only valid pixels will be retained in the undistorted image - alpha=1 - all the source image pixels will be retained in the undistorted image -*/ -CVAPI(void) cvGetOptimalNewCameraMatrix( const CvMat* camera_matrix, - const CvMat* dist_coeffs, - CvSize image_size, double alpha, - CvMat* new_camera_matrix, - CvSize new_imag_size CV_DEFAULT(cvSize(0,0)), - CvRect* valid_pixel_ROI CV_DEFAULT(0), - int center_principal_point CV_DEFAULT(0)); - -/* Converts rotation vector to rotation matrix or vice versa */ -CVAPI(int) cvRodrigues2( const CvMat* src, CvMat* dst, - CvMat* jacobian CV_DEFAULT(0) ); - -/* Finds perspective transformation between the object plane and image (view) plane */ -CVAPI(int) cvFindHomography( const CvMat* src_points, - const CvMat* dst_points, - CvMat* homography, - int method CV_DEFAULT(0), - double ransacReprojThreshold CV_DEFAULT(3), - CvMat* mask CV_DEFAULT(0), - int maxIters CV_DEFAULT(2000), - double confidence CV_DEFAULT(0.995)); - -/* Computes RQ decomposition for 3x3 matrices */ -CVAPI(void) cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ, - CvMat *matrixQx CV_DEFAULT(NULL), - CvMat *matrixQy CV_DEFAULT(NULL), - CvMat *matrixQz CV_DEFAULT(NULL), - CvPoint3D64f *eulerAngles CV_DEFAULT(NULL)); - -/* Computes projection matrix decomposition */ -CVAPI(void) cvDecomposeProjectionMatrix( const CvMat *projMatr, CvMat *calibMatr, - CvMat *rotMatr, CvMat *posVect, - CvMat *rotMatrX CV_DEFAULT(NULL), - CvMat *rotMatrY CV_DEFAULT(NULL), - CvMat *rotMatrZ CV_DEFAULT(NULL), - CvPoint3D64f *eulerAngles CV_DEFAULT(NULL)); - -/* Computes d(AB)/dA and d(AB)/dB */ -CVAPI(void) cvCalcMatMulDeriv( const CvMat* A, const CvMat* B, CvMat* dABdA, CvMat* dABdB ); - -/* Computes r3 = rodrigues(rodrigues(r2)*rodrigues(r1)), - t3 = rodrigues(r2)*t1 + t2 and the respective derivatives */ -CVAPI(void) cvComposeRT( const CvMat* _rvec1, const CvMat* _tvec1, - const CvMat* _rvec2, const CvMat* _tvec2, - CvMat* _rvec3, CvMat* _tvec3, - CvMat* dr3dr1 CV_DEFAULT(0), CvMat* dr3dt1 CV_DEFAULT(0), - CvMat* dr3dr2 CV_DEFAULT(0), CvMat* dr3dt2 CV_DEFAULT(0), - CvMat* dt3dr1 CV_DEFAULT(0), CvMat* dt3dt1 CV_DEFAULT(0), - CvMat* dt3dr2 CV_DEFAULT(0), CvMat* dt3dt2 CV_DEFAULT(0) ); - -/* Projects object points to the view plane using - the specified extrinsic and intrinsic camera parameters */ -CVAPI(void) cvProjectPoints2( const CvMat* object_points, const CvMat* rotation_vector, - const CvMat* translation_vector, const CvMat* camera_matrix, - const CvMat* distortion_coeffs, CvMat* image_points, - CvMat* dpdrot CV_DEFAULT(NULL), CvMat* dpdt CV_DEFAULT(NULL), - CvMat* dpdf CV_DEFAULT(NULL), CvMat* dpdc CV_DEFAULT(NULL), - CvMat* dpddist CV_DEFAULT(NULL), - double aspect_ratio CV_DEFAULT(0)); - -/* Finds extrinsic camera parameters from - a few known corresponding point pairs and intrinsic parameters */ -CVAPI(void) cvFindExtrinsicCameraParams2( const CvMat* object_points, - const CvMat* image_points, - const CvMat* camera_matrix, - const CvMat* distortion_coeffs, - CvMat* rotation_vector, - CvMat* translation_vector, - int use_extrinsic_guess CV_DEFAULT(0) ); - -/* Computes initial estimate of the intrinsic camera parameters - in case of planar calibration target (e.g. chessboard) */ -CVAPI(void) cvInitIntrinsicParams2D( const CvMat* object_points, - const CvMat* image_points, - const CvMat* npoints, CvSize image_size, - CvMat* camera_matrix, - double aspect_ratio CV_DEFAULT(1.) ); - -#define CV_CALIB_CB_ADAPTIVE_THRESH 1 -#define CV_CALIB_CB_NORMALIZE_IMAGE 2 -#define CV_CALIB_CB_FILTER_QUADS 4 -#define CV_CALIB_CB_FAST_CHECK 8 - -// Performs a fast check if a chessboard is in the input image. This is a workaround to -// a problem of cvFindChessboardCorners being slow on images with no chessboard -// - src: input image -// - size: chessboard size -// Returns 1 if a chessboard can be in this image and findChessboardCorners should be called, -// 0 if there is no chessboard, -1 in case of error -CVAPI(int) cvCheckChessboard(IplImage* src, CvSize size); - - /* Detects corners on a chessboard calibration pattern */ -CVAPI(int) cvFindChessboardCorners( const void* image, CvSize pattern_size, - CvPoint2D32f* corners, - int* corner_count CV_DEFAULT(NULL), - int flags CV_DEFAULT(CV_CALIB_CB_ADAPTIVE_THRESH+CV_CALIB_CB_NORMALIZE_IMAGE) ); - -/* Draws individual chessboard corners or the whole chessboard detected */ -CVAPI(void) cvDrawChessboardCorners( CvArr* image, CvSize pattern_size, - CvPoint2D32f* corners, - int count, int pattern_was_found ); - -#define CV_CALIB_USE_INTRINSIC_GUESS 1 -#define CV_CALIB_FIX_ASPECT_RATIO 2 -#define CV_CALIB_FIX_PRINCIPAL_POINT 4 -#define CV_CALIB_ZERO_TANGENT_DIST 8 -#define CV_CALIB_FIX_FOCAL_LENGTH 16 -#define CV_CALIB_FIX_K1 32 -#define CV_CALIB_FIX_K2 64 -#define CV_CALIB_FIX_K3 128 -#define CV_CALIB_FIX_K4 2048 -#define CV_CALIB_FIX_K5 4096 -#define CV_CALIB_FIX_K6 8192 -#define CV_CALIB_RATIONAL_MODEL 16384 -#define CV_CALIB_THIN_PRISM_MODEL 32768 -#define CV_CALIB_FIX_S1_S2_S3_S4 65536 -#define CV_CALIB_TILTED_MODEL 262144 -#define CV_CALIB_FIX_TAUX_TAUY 524288 -#define CV_CALIB_FIX_TANGENT_DIST 2097152 - -#define CV_CALIB_NINTRINSIC 18 - -/* Finds intrinsic and extrinsic camera parameters - from a few views of known calibration pattern */ -CVAPI(double) cvCalibrateCamera2( const CvMat* object_points, - const CvMat* image_points, - const CvMat* point_counts, - CvSize image_size, - CvMat* camera_matrix, - CvMat* distortion_coeffs, - CvMat* rotation_vectors CV_DEFAULT(NULL), - CvMat* translation_vectors CV_DEFAULT(NULL), - int flags CV_DEFAULT(0), - CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria( - CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON)) ); - -/* Computes various useful characteristics of the camera from the data computed by - cvCalibrateCamera2 */ -CVAPI(void) cvCalibrationMatrixValues( const CvMat *camera_matrix, - CvSize image_size, - double aperture_width CV_DEFAULT(0), - double aperture_height CV_DEFAULT(0), - double *fovx CV_DEFAULT(NULL), - double *fovy CV_DEFAULT(NULL), - double *focal_length CV_DEFAULT(NULL), - CvPoint2D64f *principal_point CV_DEFAULT(NULL), - double *pixel_aspect_ratio CV_DEFAULT(NULL)); - -#define CV_CALIB_FIX_INTRINSIC 256 -#define CV_CALIB_SAME_FOCAL_LENGTH 512 - -/* Computes the transformation from one camera coordinate system to another one - from a few correspondent views of the same calibration target. Optionally, calibrates - both cameras */ -CVAPI(double) cvStereoCalibrate( const CvMat* object_points, const CvMat* image_points1, - const CvMat* image_points2, const CvMat* npoints, - CvMat* camera_matrix1, CvMat* dist_coeffs1, - CvMat* camera_matrix2, CvMat* dist_coeffs2, - CvSize image_size, CvMat* R, CvMat* T, - CvMat* E CV_DEFAULT(0), CvMat* F CV_DEFAULT(0), - int flags CV_DEFAULT(CV_CALIB_FIX_INTRINSIC), - CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria( - CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,1e-6)) ); - -#define CV_CALIB_ZERO_DISPARITY 1024 - -/* Computes 3D rotations (+ optional shift) for each camera coordinate system to make both - views parallel (=> to make all the epipolar lines horizontal or vertical) */ -CVAPI(void) cvStereoRectify( const CvMat* camera_matrix1, const CvMat* camera_matrix2, - const CvMat* dist_coeffs1, const CvMat* dist_coeffs2, - CvSize image_size, const CvMat* R, const CvMat* T, - CvMat* R1, CvMat* R2, CvMat* P1, CvMat* P2, - CvMat* Q CV_DEFAULT(0), - int flags CV_DEFAULT(CV_CALIB_ZERO_DISPARITY), - double alpha CV_DEFAULT(-1), - CvSize new_image_size CV_DEFAULT(cvSize(0,0)), - CvRect* valid_pix_ROI1 CV_DEFAULT(0), - CvRect* valid_pix_ROI2 CV_DEFAULT(0)); - -/* Computes rectification transformations for uncalibrated pair of images using a set - of point correspondences */ -CVAPI(int) cvStereoRectifyUncalibrated( const CvMat* points1, const CvMat* points2, - const CvMat* F, CvSize img_size, - CvMat* H1, CvMat* H2, - double threshold CV_DEFAULT(5)); - - - -/* stereo correspondence parameters and functions */ - -#define CV_STEREO_BM_NORMALIZED_RESPONSE 0 -#define CV_STEREO_BM_XSOBEL 1 - -/* Block matching algorithm structure */ -typedef struct CvStereoBMState -{ - // pre-filtering (normalization of input images) - int preFilterType; // =CV_STEREO_BM_NORMALIZED_RESPONSE now - int preFilterSize; // averaging window size: ~5x5..21x21 - int preFilterCap; // the output of pre-filtering is clipped by [-preFilterCap,preFilterCap] - - // correspondence using Sum of Absolute Difference (SAD) - int SADWindowSize; // ~5x5..21x21 - int minDisparity; // minimum disparity (can be negative) - int numberOfDisparities; // maximum disparity - minimum disparity (> 0) - - // post-filtering - int textureThreshold; // the disparity is only computed for pixels - // with textured enough neighborhood - int uniquenessRatio; // accept the computed disparity d* only if - // SAD(d) >= SAD(d*)*(1 + uniquenessRatio/100.) - // for any d != d*+/-1 within the search range. - int speckleWindowSize; // disparity variation window - int speckleRange; // acceptable range of variation in window - - int trySmallerWindows; // if 1, the results may be more accurate, - // at the expense of slower processing - CvRect roi1, roi2; - int disp12MaxDiff; - - // temporary buffers - CvMat* preFilteredImg0; - CvMat* preFilteredImg1; - CvMat* slidingSumBuf; - CvMat* cost; - CvMat* disp; -} CvStereoBMState; - -#define CV_STEREO_BM_BASIC 0 -#define CV_STEREO_BM_FISH_EYE 1 -#define CV_STEREO_BM_NARROW 2 - -CVAPI(CvStereoBMState*) cvCreateStereoBMState(int preset CV_DEFAULT(CV_STEREO_BM_BASIC), - int numberOfDisparities CV_DEFAULT(0)); - -CVAPI(void) cvReleaseStereoBMState( CvStereoBMState** state ); - -CVAPI(void) cvFindStereoCorrespondenceBM( const CvArr* left, const CvArr* right, - CvArr* disparity, CvStereoBMState* state ); - -CVAPI(CvRect) cvGetValidDisparityROI( CvRect roi1, CvRect roi2, int minDisparity, - int numberOfDisparities, int SADWindowSize ); - -CVAPI(void) cvValidateDisparity( CvArr* disparity, const CvArr* cost, - int minDisparity, int numberOfDisparities, - int disp12MaxDiff CV_DEFAULT(1) ); - -/* Reprojects the computed disparity image to the 3D space using the specified 4x4 matrix */ -CVAPI(void) cvReprojectImageTo3D( const CvArr* disparityImage, - CvArr* _3dImage, const CvMat* Q, - int handleMissingValues CV_DEFAULT(0) ); - -/** @} calib3d_c */ - -#ifdef __cplusplus -} // extern "C" - -////////////////////////////////////////////////////////////////////////////////////////// -class CV_EXPORTS CvLevMarq -{ -public: - CvLevMarq(); - CvLevMarq( int nparams, int nerrs, CvTermCriteria criteria= - cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON), - bool completeSymmFlag=false ); - ~CvLevMarq(); - void init( int nparams, int nerrs, CvTermCriteria criteria= - cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON), - bool completeSymmFlag=false ); - bool update( const CvMat*& param, CvMat*& J, CvMat*& err ); - bool updateAlt( const CvMat*& param, CvMat*& JtJ, CvMat*& JtErr, double*& errNorm ); - - void clear(); - void step(); - enum { DONE=0, STARTED=1, CALC_J=2, CHECK_ERR=3 }; - - cv::Ptr mask; - cv::Ptr prevParam; - cv::Ptr param; - cv::Ptr J; - cv::Ptr err; - cv::Ptr JtJ; - cv::Ptr JtJN; - cv::Ptr JtErr; - cv::Ptr JtJV; - cv::Ptr JtJW; - double prevErrNorm, errNorm; - int lambdaLg10; - CvTermCriteria criteria; - int state; - int iters; - bool completeSymmFlag; - int solveMethod; -}; - -#endif - -#endif /* OPENCV_CALIB3D_C_H */ diff --git a/opencv/include/opencv2/core.hpp b/opencv/include/opencv2/core.hpp deleted file mode 100644 index 089c0db..0000000 --- a/opencv/include/opencv2/core.hpp +++ /dev/null @@ -1,3285 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2015, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Copyright (C) 2015, OpenCV Foundation, all rights reserved. -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_HPP -#define OPENCV_CORE_HPP - -#ifndef __cplusplus -# error core.hpp header must be compiled as C++ -#endif - -#include "opencv2/core/cvdef.h" -#include "opencv2/core/version.hpp" -#include "opencv2/core/base.hpp" -#include "opencv2/core/cvstd.hpp" -#include "opencv2/core/traits.hpp" -#include "opencv2/core/matx.hpp" -#include "opencv2/core/types.hpp" -#include "opencv2/core/mat.hpp" -#include "opencv2/core/persistence.hpp" - -/** -@defgroup core Core functionality -@{ - @defgroup core_basic Basic structures - @defgroup core_c C structures and operations - @{ - @defgroup core_c_glue Connections with C++ - @} - @defgroup core_array Operations on arrays - @defgroup core_xml XML/YAML Persistence - @defgroup core_cluster Clustering - @defgroup core_utils Utility and system functions and macros - @{ - @defgroup core_utils_sse SSE utilities - @defgroup core_utils_neon NEON utilities - @defgroup core_utils_softfloat Softfloat support - @defgroup core_utils_samples Utility functions for OpenCV samples - @} - @defgroup core_opengl OpenGL interoperability - @defgroup core_ipp Intel IPP Asynchronous C/C++ Converters - @defgroup core_optim Optimization Algorithms - @defgroup core_directx DirectX interoperability - @defgroup core_eigen Eigen support - @defgroup core_opencl OpenCL support - @defgroup core_va_intel Intel VA-API/OpenCL (CL-VA) interoperability - @defgroup core_hal Hardware Acceleration Layer - @{ - @defgroup core_hal_functions Functions - @defgroup core_hal_interface Interface - @defgroup core_hal_intrin Universal intrinsics - @{ - @defgroup core_hal_intrin_impl Private implementation helpers - @} - @} -@} - */ - -namespace cv { - -//! @addtogroup core_utils -//! @{ - -/*! @brief Class passed to an error. - -This class encapsulates all or almost all necessary -information about the error happened in the program. The exception is -usually constructed and thrown implicitly via CV_Error and CV_Error_ macros. -@see error - */ -class CV_EXPORTS Exception : public std::exception -{ -public: - /*! - Default constructor - */ - Exception(); - /*! - Full constructor. Normally the constructor is not called explicitly. - Instead, the macros CV_Error(), CV_Error_() and CV_Assert() are used. - */ - Exception(int _code, const String& _err, const String& _func, const String& _file, int _line); - virtual ~Exception() throw(); - - /*! - \return the error description and the context as a text string. - */ - virtual const char *what() const throw() CV_OVERRIDE; - void formatMessage(); - - String msg; ///< the formatted error message - - int code; ///< error code @see CVStatus - String err; ///< error description - String func; ///< function name. Available only when the compiler supports getting it - String file; ///< source file name where the error has occurred - int line; ///< line number in the source file where the error has occurred -}; - -/*! @brief Signals an error and raises the exception. - -By default the function prints information about the error to stderr, -then it either stops if cv::setBreakOnError() had been called before or raises the exception. -It is possible to alternate error processing by using #redirectError(). -@param exc the exception raisen. -@deprecated drop this version - */ -CV_EXPORTS void error( const Exception& exc ); - -enum SortFlags { SORT_EVERY_ROW = 0, //!< each matrix row is sorted independently - SORT_EVERY_COLUMN = 1, //!< each matrix column is sorted - //!< independently; this flag and the previous one are - //!< mutually exclusive. - SORT_ASCENDING = 0, //!< each matrix row is sorted in the ascending - //!< order. - SORT_DESCENDING = 16 //!< each matrix row is sorted in the - //!< descending order; this flag and the previous one are also - //!< mutually exclusive. - }; - -//! @} core_utils - -//! @addtogroup core -//! @{ - -//! Covariation flags -enum CovarFlags { - /** The output covariance matrix is calculated as: - \f[\texttt{scale} \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...]^T \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...],\f] - The covariance matrix will be nsamples x nsamples. Such an unusual covariance matrix is used - for fast PCA of a set of very large vectors (see, for example, the EigenFaces technique for - face recognition). Eigenvalues of this "scrambled" matrix match the eigenvalues of the true - covariance matrix. The "true" eigenvectors can be easily calculated from the eigenvectors of - the "scrambled" covariance matrix. */ - COVAR_SCRAMBLED = 0, - /**The output covariance matrix is calculated as: - \f[\texttt{scale} \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...] \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...]^T,\f] - covar will be a square matrix of the same size as the total number of elements in each input - vector. One and only one of #COVAR_SCRAMBLED and #COVAR_NORMAL must be specified.*/ - COVAR_NORMAL = 1, - /** If the flag is specified, the function does not calculate mean from - the input vectors but, instead, uses the passed mean vector. This is useful if mean has been - pre-calculated or known in advance, or if the covariance matrix is calculated by parts. In - this case, mean is not a mean vector of the input sub-set of vectors but rather the mean - vector of the whole set.*/ - COVAR_USE_AVG = 2, - /** If the flag is specified, the covariance matrix is scaled. In the - "normal" mode, scale is 1./nsamples . In the "scrambled" mode, scale is the reciprocal of the - total number of elements in each input vector. By default (if the flag is not specified), the - covariance matrix is not scaled ( scale=1 ).*/ - COVAR_SCALE = 4, - /** If the flag is - specified, all the input vectors are stored as rows of the samples matrix. mean should be a - single-row vector in this case.*/ - COVAR_ROWS = 8, - /** If the flag is - specified, all the input vectors are stored as columns of the samples matrix. mean should be a - single-column vector in this case.*/ - COVAR_COLS = 16 -}; - -//! k-Means flags -enum KmeansFlags { - /** Select random initial centers in each attempt.*/ - KMEANS_RANDOM_CENTERS = 0, - /** Use kmeans++ center initialization by Arthur and Vassilvitskii [Arthur2007].*/ - KMEANS_PP_CENTERS = 2, - /** During the first (and possibly the only) attempt, use the - user-supplied labels instead of computing them from the initial centers. For the second and - further attempts, use the random or semi-random centers. Use one of KMEANS_\*_CENTERS flag - to specify the exact method.*/ - KMEANS_USE_INITIAL_LABELS = 1 -}; - -//! type of line -enum LineTypes { - FILLED = -1, - LINE_4 = 4, //!< 4-connected line - LINE_8 = 8, //!< 8-connected line - LINE_AA = 16 //!< antialiased line -}; - -//! Only a subset of Hershey fonts are supported -enum HersheyFonts { - FONT_HERSHEY_SIMPLEX = 0, //!< normal size sans-serif font - FONT_HERSHEY_PLAIN = 1, //!< small size sans-serif font - FONT_HERSHEY_DUPLEX = 2, //!< normal size sans-serif font (more complex than FONT_HERSHEY_SIMPLEX) - FONT_HERSHEY_COMPLEX = 3, //!< normal size serif font - FONT_HERSHEY_TRIPLEX = 4, //!< normal size serif font (more complex than FONT_HERSHEY_COMPLEX) - FONT_HERSHEY_COMPLEX_SMALL = 5, //!< smaller version of FONT_HERSHEY_COMPLEX - FONT_HERSHEY_SCRIPT_SIMPLEX = 6, //!< hand-writing style font - FONT_HERSHEY_SCRIPT_COMPLEX = 7, //!< more complex variant of FONT_HERSHEY_SCRIPT_SIMPLEX - FONT_ITALIC = 16 //!< flag for italic font -}; - -enum ReduceTypes { REDUCE_SUM = 0, //!< the output is the sum of all rows/columns of the matrix. - REDUCE_AVG = 1, //!< the output is the mean vector of all rows/columns of the matrix. - REDUCE_MAX = 2, //!< the output is the maximum (column/row-wise) of all rows/columns of the matrix. - REDUCE_MIN = 3 //!< the output is the minimum (column/row-wise) of all rows/columns of the matrix. - }; - - -/** @brief Swaps two matrices -*/ -CV_EXPORTS void swap(Mat& a, Mat& b); -/** @overload */ -CV_EXPORTS void swap( UMat& a, UMat& b ); - -//! @} core - -//! @addtogroup core_array -//! @{ - -/** @brief Computes the source location of an extrapolated pixel. - -The function computes and returns the coordinate of a donor pixel corresponding to the specified -extrapolated pixel when using the specified extrapolation border mode. For example, if you use -cv::BORDER_WRAP mode in the horizontal direction, cv::BORDER_REFLECT_101 in the vertical direction and -want to compute value of the "virtual" pixel Point(-5, 100) in a floating-point image img , it -looks like: -@code{.cpp} - float val = img.at(borderInterpolate(100, img.rows, cv::BORDER_REFLECT_101), - borderInterpolate(-5, img.cols, cv::BORDER_WRAP)); -@endcode -Normally, the function is not called directly. It is used inside filtering functions and also in -copyMakeBorder. -@param p 0-based coordinate of the extrapolated pixel along one of the axes, likely \<0 or \>= len -@param len Length of the array along the corresponding axis. -@param borderType Border type, one of the #BorderTypes, except for #BORDER_TRANSPARENT and -#BORDER_ISOLATED . When borderType==#BORDER_CONSTANT , the function always returns -1, regardless -of p and len. - -@sa copyMakeBorder -*/ -CV_EXPORTS_W int borderInterpolate(int p, int len, int borderType); - -/** @example samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp -An example using copyMakeBorder function. -Check @ref tutorial_copyMakeBorder "the corresponding tutorial" for more details -*/ - -/** @brief Forms a border around an image. - -The function copies the source image into the middle of the destination image. The areas to the -left, to the right, above and below the copied source image will be filled with extrapolated -pixels. This is not what filtering functions based on it do (they extrapolate pixels on-fly), but -what other more complex functions, including your own, may do to simplify image boundary handling. - -The function supports the mode when src is already in the middle of dst . In this case, the -function does not copy src itself but simply constructs the border, for example: - -@code{.cpp} - // let border be the same in all directions - int border=2; - // constructs a larger image to fit both the image and the border - Mat gray_buf(rgb.rows + border*2, rgb.cols + border*2, rgb.depth()); - // select the middle part of it w/o copying data - Mat gray(gray_canvas, Rect(border, border, rgb.cols, rgb.rows)); - // convert image from RGB to grayscale - cvtColor(rgb, gray, COLOR_RGB2GRAY); - // form a border in-place - copyMakeBorder(gray, gray_buf, border, border, - border, border, BORDER_REPLICATE); - // now do some custom filtering ... - ... -@endcode -@note When the source image is a part (ROI) of a bigger image, the function will try to use the -pixels outside of the ROI to form a border. To disable this feature and always do extrapolation, as -if src was not a ROI, use borderType | #BORDER_ISOLATED. - -@param src Source image. -@param dst Destination image of the same type as src and the size Size(src.cols+left+right, -src.rows+top+bottom) . -@param top -@param bottom -@param left -@param right Parameter specifying how many pixels in each direction from the source image rectangle -to extrapolate. For example, top=1, bottom=1, left=1, right=1 mean that 1 pixel-wide border needs -to be built. -@param borderType Border type. See borderInterpolate for details. -@param value Border value if borderType==BORDER_CONSTANT . - -@sa borderInterpolate -*/ -CV_EXPORTS_W void copyMakeBorder(InputArray src, OutputArray dst, - int top, int bottom, int left, int right, - int borderType, const Scalar& value = Scalar() ); - -/** @brief Calculates the per-element sum of two arrays or an array and a scalar. - -The function add calculates: -- Sum of two arrays when both input arrays have the same size and the same number of channels: -\f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\f] -- Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of -elements as `src1.channels()`: -\f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\f] -- Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of -elements as `src2.channels()`: -\f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} + \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\f] -where `I` is a multi-dimensional index of array elements. In case of multi-channel arrays, each -channel is processed independently. - -The first function in the list above can be replaced with matrix expressions: -@code{.cpp} - dst = src1 + src2; - dst += src1; // equivalent to add(dst, src1, dst); -@endcode -The input arrays and the output array can all have the same or different depths. For example, you -can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit -floating-point array. Depth of the output array is determined by the dtype parameter. In the second -and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can -be set to the default -1. In this case, the output array will have the same depth as the input -array, be it src1, src2 or both. -@note Saturation is not applied when the output array has the depth CV_32S. You may even get -result of an incorrect sign in the case of overflow. -@param src1 first input array or a scalar. -@param src2 second input array or a scalar. -@param dst output array that has the same size and number of channels as the input array(s); the -depth is defined by dtype or src1/src2. -@param mask optional operation mask - 8-bit single channel array, that specifies elements of the -output array to be changed. -@param dtype optional depth of the output array (see the discussion below). -@sa subtract, addWeighted, scaleAdd, Mat::convertTo -*/ -CV_EXPORTS_W void add(InputArray src1, InputArray src2, OutputArray dst, - InputArray mask = noArray(), int dtype = -1); - -/** @brief Calculates the per-element difference between two arrays or array and a scalar. - -The function subtract calculates: -- Difference between two arrays, when both input arrays have the same size and the same number of -channels: - \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) - \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\f] -- Difference between an array and a scalar, when src2 is constructed from Scalar or has the same -number of elements as `src1.channels()`: - \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) - \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\f] -- Difference between a scalar and an array, when src1 is constructed from Scalar or has the same -number of elements as `src2.channels()`: - \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} - \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\f] -- The reverse difference between a scalar and an array in the case of `SubRS`: - \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src2} - \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0\f] -where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each -channel is processed independently. - -The first function in the list above can be replaced with matrix expressions: -@code{.cpp} - dst = src1 - src2; - dst -= src1; // equivalent to subtract(dst, src1, dst); -@endcode -The input arrays and the output array can all have the same or different depths. For example, you -can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of -the output array is determined by dtype parameter. In the second and third cases above, as well as -in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this -case the output array will have the same depth as the input array, be it src1, src2 or both. -@note Saturation is not applied when the output array has the depth CV_32S. You may even get -result of an incorrect sign in the case of overflow. -@param src1 first input array or a scalar. -@param src2 second input array or a scalar. -@param dst output array of the same size and the same number of channels as the input array. -@param mask optional operation mask; this is an 8-bit single channel array that specifies elements -of the output array to be changed. -@param dtype optional depth of the output array -@sa add, addWeighted, scaleAdd, Mat::convertTo - */ -CV_EXPORTS_W void subtract(InputArray src1, InputArray src2, OutputArray dst, - InputArray mask = noArray(), int dtype = -1); - - -/** @brief Calculates the per-element scaled product of two arrays. - -The function multiply calculates the per-element product of two arrays: - -\f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I) \cdot \texttt{src2} (I))\f] - -There is also a @ref MatrixExpressions -friendly variant of the first function. See Mat::mul . - -For a not-per-element matrix product, see gemm . - -@note Saturation is not applied when the output array has the depth -CV_32S. You may even get result of an incorrect sign in the case of -overflow. -@param src1 first input array. -@param src2 second input array of the same size and the same type as src1. -@param dst output array of the same size and type as src1. -@param scale optional scale factor. -@param dtype optional depth of the output array -@sa add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare, -Mat::convertTo -*/ -CV_EXPORTS_W void multiply(InputArray src1, InputArray src2, - OutputArray dst, double scale = 1, int dtype = -1); - -/** @brief Performs per-element division of two arrays or a scalar by an array. - -The function cv::divide divides one array by another: -\f[\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}\f] -or a scalar by an array when there is no src1 : -\f[\texttt{dst(I) = saturate(scale/src2(I))}\f] - -When src2(I) is zero, dst(I) will also be zero. Different channels of -multi-channel arrays are processed independently. - -@note Saturation is not applied when the output array has the depth CV_32S. You may even get -result of an incorrect sign in the case of overflow. -@param src1 first input array. -@param src2 second input array of the same size and type as src1. -@param scale scalar factor. -@param dst output array of the same size and type as src2. -@param dtype optional depth of the output array; if -1, dst will have depth src2.depth(), but in -case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth(). -@sa multiply, add, subtract -*/ -CV_EXPORTS_W void divide(InputArray src1, InputArray src2, OutputArray dst, - double scale = 1, int dtype = -1); - -/** @overload */ -CV_EXPORTS_W void divide(double scale, InputArray src2, - OutputArray dst, int dtype = -1); - -/** @brief Calculates the sum of a scaled array and another array. - -The function scaleAdd is one of the classical primitive linear algebra operations, known as DAXPY -or SAXPY in [BLAS](http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms). It calculates -the sum of a scaled array and another array: -\f[\texttt{dst} (I)= \texttt{scale} \cdot \texttt{src1} (I) + \texttt{src2} (I)\f] -The function can also be emulated with a matrix expression, for example: -@code{.cpp} - Mat A(3, 3, CV_64F); - ... - A.row(0) = A.row(1)*2 + A.row(2); -@endcode -@param src1 first input array. -@param alpha scale factor for the first array. -@param src2 second input array of the same size and type as src1. -@param dst output array of the same size and type as src1. -@sa add, addWeighted, subtract, Mat::dot, Mat::convertTo -*/ -CV_EXPORTS_W void scaleAdd(InputArray src1, double alpha, InputArray src2, OutputArray dst); - -/** @example samples/cpp/tutorial_code/HighGUI/AddingImagesTrackbar.cpp -Check @ref tutorial_trackbar "the corresponding tutorial" for more details -*/ - -/** @brief Calculates the weighted sum of two arrays. - -The function addWeighted calculates the weighted sum of two arrays as follows: -\f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} + \texttt{src2} (I)* \texttt{beta} + \texttt{gamma} )\f] -where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each -channel is processed independently. -The function can be replaced with a matrix expression: -@code{.cpp} - dst = src1*alpha + src2*beta + gamma; -@endcode -@note Saturation is not applied when the output array has the depth CV_32S. You may even get -result of an incorrect sign in the case of overflow. -@param src1 first input array. -@param alpha weight of the first array elements. -@param src2 second input array of the same size and channel number as src1. -@param beta weight of the second array elements. -@param gamma scalar added to each sum. -@param dst output array that has the same size and number of channels as the input arrays. -@param dtype optional depth of the output array; when both input arrays have the same depth, dtype -can be set to -1, which will be equivalent to src1.depth(). -@sa add, subtract, scaleAdd, Mat::convertTo -*/ -CV_EXPORTS_W void addWeighted(InputArray src1, double alpha, InputArray src2, - double beta, double gamma, OutputArray dst, int dtype = -1); - -/** @brief Scales, calculates absolute values, and converts the result to 8-bit. - -On each element of the input array, the function convertScaleAbs -performs three operations sequentially: scaling, taking an absolute -value, conversion to an unsigned 8-bit type: -\f[\texttt{dst} (I)= \texttt{saturate\_cast} (| \texttt{src} (I)* \texttt{alpha} + \texttt{beta} |)\f] -In case of multi-channel arrays, the function processes each channel -independently. When the output is not 8-bit, the operation can be -emulated by calling the Mat::convertTo method (or by using matrix -expressions) and then by calculating an absolute value of the result. -For example: -@code{.cpp} - Mat_ A(30,30); - randu(A, Scalar(-100), Scalar(100)); - Mat_ B = A*5 + 3; - B = abs(B); - // Mat_ B = abs(A*5+3) will also do the job, - // but it will allocate a temporary matrix -@endcode -@param src input array. -@param dst output array. -@param alpha optional scale factor. -@param beta optional delta added to the scaled values. -@sa Mat::convertTo, cv::abs(const Mat&) -*/ -CV_EXPORTS_W void convertScaleAbs(InputArray src, OutputArray dst, - double alpha = 1, double beta = 0); - -/** @brief Converts an array to half precision floating number. - -This function converts FP32 (single precision floating point) from/to FP16 (half precision floating point). CV_16S format is used to represent FP16 data. -There are two use modes (src -> dst): CV_32F -> CV_16S and CV_16S -> CV_32F. The input array has to have type of CV_32F or -CV_16S to represent the bit depth. If the input array is neither of them, the function will raise an error. -The format of half precision floating point is defined in IEEE 754-2008. - -@param src input array. -@param dst output array. -*/ -CV_EXPORTS_W void convertFp16(InputArray src, OutputArray dst); - -/** @brief Performs a look-up table transform of an array. - -The function LUT fills the output array with values from the look-up table. Indices of the entries -are taken from the input array. That is, the function processes each element of src as follows: -\f[\texttt{dst} (I) \leftarrow \texttt{lut(src(I) + d)}\f] -where -\f[d = \fork{0}{if \(\texttt{src}\) has depth \(\texttt{CV_8U}\)}{128}{if \(\texttt{src}\) has depth \(\texttt{CV_8S}\)}\f] -@param src input array of 8-bit elements. -@param lut look-up table of 256 elements; in case of multi-channel input array, the table should -either have a single channel (in this case the same table is used for all channels) or the same -number of channels as in the input array. -@param dst output array of the same size and number of channels as src, and the same depth as lut. -@sa convertScaleAbs, Mat::convertTo -*/ -CV_EXPORTS_W void LUT(InputArray src, InputArray lut, OutputArray dst); - -/** @brief Calculates the sum of array elements. - -The function cv::sum calculates and returns the sum of array elements, -independently for each channel. -@param src input array that must have from 1 to 4 channels. -@sa countNonZero, mean, meanStdDev, norm, minMaxLoc, reduce -*/ -CV_EXPORTS_AS(sumElems) Scalar sum(InputArray src); - -/** @brief Counts non-zero array elements. - -The function returns the number of non-zero elements in src : -\f[\sum _{I: \; \texttt{src} (I) \ne0 } 1\f] -@param src single-channel array. -@sa mean, meanStdDev, norm, minMaxLoc, calcCovarMatrix -*/ -CV_EXPORTS_W int countNonZero( InputArray src ); - -/** @brief Returns the list of locations of non-zero pixels - -Given a binary matrix (likely returned from an operation such -as threshold(), compare(), >, ==, etc, return all of -the non-zero indices as a cv::Mat or std::vector (x,y) -For example: -@code{.cpp} - cv::Mat binaryImage; // input, binary image - cv::Mat locations; // output, locations of non-zero pixels - cv::findNonZero(binaryImage, locations); - - // access pixel coordinates - Point pnt = locations.at(i); -@endcode -or -@code{.cpp} - cv::Mat binaryImage; // input, binary image - vector locations; // output, locations of non-zero pixels - cv::findNonZero(binaryImage, locations); - - // access pixel coordinates - Point pnt = locations[i]; -@endcode -@param src single-channel array (type CV_8UC1) -@param idx the output array, type of cv::Mat or std::vector, corresponding to non-zero indices in the input -*/ -CV_EXPORTS_W void findNonZero( InputArray src, OutputArray idx ); - -/** @brief Calculates an average (mean) of array elements. - -The function cv::mean calculates the mean value M of array elements, -independently for each channel, and return it: -\f[\begin{array}{l} N = \sum _{I: \; \texttt{mask} (I) \ne 0} 1 \\ M_c = \left ( \sum _{I: \; \texttt{mask} (I) \ne 0}{ \texttt{mtx} (I)_c} \right )/N \end{array}\f] -When all the mask elements are 0's, the function returns Scalar::all(0) -@param src input array that should have from 1 to 4 channels so that the result can be stored in -Scalar_ . -@param mask optional operation mask. -@sa countNonZero, meanStdDev, norm, minMaxLoc -*/ -CV_EXPORTS_W Scalar mean(InputArray src, InputArray mask = noArray()); - -/** Calculates a mean and standard deviation of array elements. - -The function cv::meanStdDev calculates the mean and the standard deviation M -of array elements independently for each channel and returns it via the -output parameters: -\f[\begin{array}{l} N = \sum _{I, \texttt{mask} (I) \ne 0} 1 \\ \texttt{mean} _c = \frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \texttt{src} (I)_c}{N} \\ \texttt{stddev} _c = \sqrt{\frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \left ( \texttt{src} (I)_c - \texttt{mean} _c \right )^2}{N}} \end{array}\f] -When all the mask elements are 0's, the function returns -mean=stddev=Scalar::all(0). -@note The calculated standard deviation is only the diagonal of the -complete normalized covariance matrix. If the full matrix is needed, you -can reshape the multi-channel array M x N to the single-channel array -M\*N x mtx.channels() (only possible when the matrix is continuous) and -then pass the matrix to calcCovarMatrix . -@param src input array that should have from 1 to 4 channels so that the results can be stored in -Scalar_ 's. -@param mean output parameter: calculated mean value. -@param stddev output parameter: calculated standard deviation. -@param mask optional operation mask. -@sa countNonZero, mean, norm, minMaxLoc, calcCovarMatrix -*/ -CV_EXPORTS_W void meanStdDev(InputArray src, OutputArray mean, OutputArray stddev, - InputArray mask=noArray()); - -/** @brief Calculates the absolute norm of an array. - -This version of #norm calculates the absolute norm of src1. The type of norm to calculate is specified using #NormTypes. - -As example for one array consider the function \f$r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\f$. -The \f$ L_{1}, L_{2} \f$ and \f$ L_{\infty} \f$ norm for the sample value \f$r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\f$ -is calculated as follows -\f{align*} - \| r(-1) \|_{L_1} &= |-1| + |2| = 3 \\ - \| r(-1) \|_{L_2} &= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\ - \| r(-1) \|_{L_\infty} &= \max(|-1|,|2|) = 2 -\f} -and for \f$r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\f$ the calculation is -\f{align*} - \| r(0.5) \|_{L_1} &= |0.5| + |0.5| = 1 \\ - \| r(0.5) \|_{L_2} &= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\ - \| r(0.5) \|_{L_\infty} &= \max(|0.5|,|0.5|) = 0.5. -\f} -The following graphic shows all values for the three norm functions \f$\| r(x) \|_{L_1}, \| r(x) \|_{L_2}\f$ and \f$\| r(x) \|_{L_\infty}\f$. -It is notable that the \f$ L_{1} \f$ norm forms the upper and the \f$ L_{\infty} \f$ norm forms the lower border for the example function \f$ r(x) \f$. -![Graphs for the different norm functions from the above example](pics/NormTypes_OneArray_1-2-INF.png) - -When the mask parameter is specified and it is not empty, the norm is - -If normType is not specified, #NORM_L2 is used. -calculated only over the region specified by the mask. - -Multi-channel input arrays are treated as single-channel arrays, that is, -the results for all channels are combined. - -Hamming norms can only be calculated with CV_8U depth arrays. - -@param src1 first input array. -@param normType type of the norm (see #NormTypes). -@param mask optional operation mask; it must have the same size as src1 and CV_8UC1 type. -*/ -CV_EXPORTS_W double norm(InputArray src1, int normType = NORM_L2, InputArray mask = noArray()); - -/** @brief Calculates an absolute difference norm or a relative difference norm. - -This version of cv::norm calculates the absolute difference norm -or the relative difference norm of arrays src1 and src2. -The type of norm to calculate is specified using #NormTypes. - -@param src1 first input array. -@param src2 second input array of the same size and the same type as src1. -@param normType type of the norm (see #NormTypes). -@param mask optional operation mask; it must have the same size as src1 and CV_8UC1 type. -*/ -CV_EXPORTS_W double norm(InputArray src1, InputArray src2, - int normType = NORM_L2, InputArray mask = noArray()); -/** @overload -@param src first input array. -@param normType type of the norm (see #NormTypes). -*/ -CV_EXPORTS double norm( const SparseMat& src, int normType ); - -/** @brief Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric. - -This function calculates the Peak Signal-to-Noise Ratio (PSNR) image quality metric in decibels (dB), between two input arrays src1 and src2. Arrays must have depth CV_8U. - -The PSNR is calculated as follows: - -\f[ -\texttt{PSNR} = 10 \cdot \log_{10}{\left( \frac{R^2}{MSE} \right) } -\f] - -where R is the maximum integer value of depth CV_8U (255) and MSE is the mean squared error between the two arrays. - -@param src1 first input array. -@param src2 second input array of the same size as src1. - - */ -CV_EXPORTS_W double PSNR(InputArray src1, InputArray src2); - -/** @brief naive nearest neighbor finder - -see http://en.wikipedia.org/wiki/Nearest_neighbor_search -@todo document - */ -CV_EXPORTS_W void batchDistance(InputArray src1, InputArray src2, - OutputArray dist, int dtype, OutputArray nidx, - int normType = NORM_L2, int K = 0, - InputArray mask = noArray(), int update = 0, - bool crosscheck = false); - -/** @brief Normalizes the norm or value range of an array. - -The function cv::normalize normalizes scale and shift the input array elements so that -\f[\| \texttt{dst} \| _{L_p}= \texttt{alpha}\f] -(where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that -\f[\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\f] - -when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be -normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this -sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or -min-max but modify the whole array, you can use norm and Mat::convertTo. - -In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this, -the range transformation for sparse matrices is not allowed since it can shift the zero level. - -Possible usage with some positive example data: -@code{.cpp} - vector positiveData = { 2.0, 8.0, 10.0 }; - vector normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax; - - // Norm to probability (total count) - // sum(numbers) = 20.0 - // 2.0 0.1 (2.0/20.0) - // 8.0 0.4 (8.0/20.0) - // 10.0 0.5 (10.0/20.0) - normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1); - - // Norm to unit vector: ||positiveData|| = 1.0 - // 2.0 0.15 - // 8.0 0.62 - // 10.0 0.77 - normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2); - - // Norm to max element - // 2.0 0.2 (2.0/10.0) - // 8.0 0.8 (8.0/10.0) - // 10.0 1.0 (10.0/10.0) - normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF); - - // Norm to range [0.0;1.0] - // 2.0 0.0 (shift to left border) - // 8.0 0.75 (6.0/8.0) - // 10.0 1.0 (shift to right border) - normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX); -@endcode - -@param src input array. -@param dst output array of the same size as src . -@param alpha norm value to normalize to or the lower range boundary in case of the range -normalization. -@param beta upper range boundary in case of the range normalization; it is not used for the norm -normalization. -@param norm_type normalization type (see cv::NormTypes). -@param dtype when negative, the output array has the same type as src; otherwise, it has the same -number of channels as src and the depth =CV_MAT_DEPTH(dtype). -@param mask optional operation mask. -@sa norm, Mat::convertTo, SparseMat::convertTo -*/ -CV_EXPORTS_W void normalize( InputArray src, InputOutputArray dst, double alpha = 1, double beta = 0, - int norm_type = NORM_L2, int dtype = -1, InputArray mask = noArray()); - -/** @overload -@param src input array. -@param dst output array of the same size as src . -@param alpha norm value to normalize to or the lower range boundary in case of the range -normalization. -@param normType normalization type (see cv::NormTypes). -*/ -CV_EXPORTS void normalize( const SparseMat& src, SparseMat& dst, double alpha, int normType ); - -/** @brief Finds the global minimum and maximum in an array. - -The function cv::minMaxLoc finds the minimum and maximum element values and their positions. The -extremums are searched across the whole array or, if mask is not an empty array, in the specified -array region. - -The function do not work with multi-channel arrays. If you need to find minimum or maximum -elements across all the channels, use Mat::reshape first to reinterpret the array as -single-channel. Or you may extract the particular channel using either extractImageCOI , or -mixChannels , or split . -@param src input single-channel array. -@param minVal pointer to the returned minimum value; NULL is used if not required. -@param maxVal pointer to the returned maximum value; NULL is used if not required. -@param minLoc pointer to the returned minimum location (in 2D case); NULL is used if not required. -@param maxLoc pointer to the returned maximum location (in 2D case); NULL is used if not required. -@param mask optional mask used to select a sub-array. -@sa max, min, compare, inRange, extractImageCOI, mixChannels, split, Mat::reshape -*/ -CV_EXPORTS_W void minMaxLoc(InputArray src, CV_OUT double* minVal, - CV_OUT double* maxVal = 0, CV_OUT Point* minLoc = 0, - CV_OUT Point* maxLoc = 0, InputArray mask = noArray()); - - -/** @brief Finds the global minimum and maximum in an array - -The function cv::minMaxIdx finds the minimum and maximum element values and their positions. The -extremums are searched across the whole array or, if mask is not an empty array, in the specified -array region. The function does not work with multi-channel arrays. If you need to find minimum or -maximum elements across all the channels, use Mat::reshape first to reinterpret the array as -single-channel. Or you may extract the particular channel using either extractImageCOI , or -mixChannels , or split . In case of a sparse matrix, the minimum is found among non-zero elements -only. -@note When minIdx is not NULL, it must have at least 2 elements (as well as maxIdx), even if src is -a single-row or single-column matrix. In OpenCV (following MATLAB) each array has at least 2 -dimensions, i.e. single-column matrix is Mx1 matrix (and therefore minIdx/maxIdx will be -(i1,0)/(i2,0)) and single-row matrix is 1xN matrix (and therefore minIdx/maxIdx will be -(0,j1)/(0,j2)). -@param src input single-channel array. -@param minVal pointer to the returned minimum value; NULL is used if not required. -@param maxVal pointer to the returned maximum value; NULL is used if not required. -@param minIdx pointer to the returned minimum location (in nD case); NULL is used if not required; -Otherwise, it must point to an array of src.dims elements, the coordinates of the minimum element -in each dimension are stored there sequentially. -@param maxIdx pointer to the returned maximum location (in nD case). NULL is used if not required. -@param mask specified array region -*/ -CV_EXPORTS void minMaxIdx(InputArray src, double* minVal, double* maxVal = 0, - int* minIdx = 0, int* maxIdx = 0, InputArray mask = noArray()); - -/** @overload -@param a input single-channel array. -@param minVal pointer to the returned minimum value; NULL is used if not required. -@param maxVal pointer to the returned maximum value; NULL is used if not required. -@param minIdx pointer to the returned minimum location (in nD case); NULL is used if not required; -Otherwise, it must point to an array of src.dims elements, the coordinates of the minimum element -in each dimension are stored there sequentially. -@param maxIdx pointer to the returned maximum location (in nD case). NULL is used if not required. -*/ -CV_EXPORTS void minMaxLoc(const SparseMat& a, double* minVal, - double* maxVal, int* minIdx = 0, int* maxIdx = 0); - -/** @brief Reduces a matrix to a vector. - -The function #reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of -1D vectors and performing the specified operation on the vectors until a single row/column is -obtained. For example, the function can be used to compute horizontal and vertical projections of a -raster image. In case of #REDUCE_MAX and #REDUCE_MIN , the output image should have the same type as the source one. -In case of #REDUCE_SUM and #REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy. -And multi-channel arrays are also supported in these two reduction modes. - -The following code demonstrates its usage for a single channel matrix. -@snippet snippets/core_reduce.cpp example - -And the following code demonstrates its usage for a two-channel matrix. -@snippet snippets/core_reduce.cpp example2 - -@param src input 2D matrix. -@param dst output vector. Its size and type is defined by dim and dtype parameters. -@param dim dimension index along which the matrix is reduced. 0 means that the matrix is reduced to -a single row. 1 means that the matrix is reduced to a single column. -@param rtype reduction operation that could be one of #ReduceTypes -@param dtype when negative, the output vector will have the same type as the input matrix, -otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()). -@sa repeat -*/ -CV_EXPORTS_W void reduce(InputArray src, OutputArray dst, int dim, int rtype, int dtype = -1); - -/** @brief Creates one multi-channel array out of several single-channel ones. - -The function cv::merge merges several arrays to make a single multi-channel array. That is, each -element of the output array will be a concatenation of the elements of the input arrays, where -elements of i-th input array are treated as mv[i].channels()-element vectors. - -The function cv::split does the reverse operation. If you need to shuffle channels in some other -advanced way, use cv::mixChannels. - -The following example shows how to merge 3 single channel matrices into a single 3-channel matrix. -@snippet snippets/core_merge.cpp example - -@param mv input array of matrices to be merged; all the matrices in mv must have the same -size and the same depth. -@param count number of input matrices when mv is a plain C array; it must be greater than zero. -@param dst output array of the same size and the same depth as mv[0]; The number of channels will -be equal to the parameter count. -@sa mixChannels, split, Mat::reshape -*/ -CV_EXPORTS void merge(const Mat* mv, size_t count, OutputArray dst); - -/** @overload -@param mv input vector of matrices to be merged; all the matrices in mv must have the same -size and the same depth. -@param dst output array of the same size and the same depth as mv[0]; The number of channels will -be the total number of channels in the matrix array. - */ -CV_EXPORTS_W void merge(InputArrayOfArrays mv, OutputArray dst); - -/** @brief Divides a multi-channel array into several single-channel arrays. - -The function cv::split splits a multi-channel array into separate single-channel arrays: -\f[\texttt{mv} [c](I) = \texttt{src} (I)_c\f] -If you need to extract a single channel or do some other sophisticated channel permutation, use -mixChannels . - -The following example demonstrates how to split a 3-channel matrix into 3 single channel matrices. -@snippet snippets/core_split.cpp example - -@param src input multi-channel array. -@param mvbegin output array; the number of arrays must match src.channels(); the arrays themselves are -reallocated, if needed. -@sa merge, mixChannels, cvtColor -*/ -CV_EXPORTS void split(const Mat& src, Mat* mvbegin); - -/** @overload -@param m input multi-channel array. -@param mv output vector of arrays; the arrays themselves are reallocated, if needed. -*/ -CV_EXPORTS_W void split(InputArray m, OutputArrayOfArrays mv); - -/** @brief Copies specified channels from input arrays to the specified channels of -output arrays. - -The function cv::mixChannels provides an advanced mechanism for shuffling image channels. - -cv::split,cv::merge,cv::extractChannel,cv::insertChannel and some forms of cv::cvtColor are partial cases of cv::mixChannels. - -In the example below, the code splits a 4-channel BGRA image into a 3-channel BGR (with B and R -channels swapped) and a separate alpha-channel image: -@code{.cpp} - Mat bgra( 100, 100, CV_8UC4, Scalar(255,0,0,255) ); - Mat bgr( bgra.rows, bgra.cols, CV_8UC3 ); - Mat alpha( bgra.rows, bgra.cols, CV_8UC1 ); - - // forming an array of matrices is a quite efficient operation, - // because the matrix data is not copied, only the headers - Mat out[] = { bgr, alpha }; - // bgra[0] -> bgr[2], bgra[1] -> bgr[1], - // bgra[2] -> bgr[0], bgra[3] -> alpha[0] - int from_to[] = { 0,2, 1,1, 2,0, 3,3 }; - mixChannels( &bgra, 1, out, 2, from_to, 4 ); -@endcode -@note Unlike many other new-style C++ functions in OpenCV (see the introduction section and -Mat::create ), cv::mixChannels requires the output arrays to be pre-allocated before calling the -function. -@param src input array or vector of matrices; all of the matrices must have the same size and the -same depth. -@param nsrcs number of matrices in `src`. -@param dst output array or vector of matrices; all the matrices **must be allocated**; their size and -depth must be the same as in `src[0]`. -@param ndsts number of matrices in `dst`. -@param fromTo array of index pairs specifying which channels are copied and where; fromTo[k\*2] is -a 0-based index of the input channel in src, fromTo[k\*2+1] is an index of the output channel in -dst; the continuous channel numbering is used: the first input image channels are indexed from 0 to -src[0].channels()-1, the second input image channels are indexed from src[0].channels() to -src[0].channels() + src[1].channels()-1, and so on, the same scheme is used for the output image -channels; as a special case, when fromTo[k\*2] is negative, the corresponding output channel is -filled with zero . -@param npairs number of index pairs in `fromTo`. -@sa split, merge, extractChannel, insertChannel, cvtColor -*/ -CV_EXPORTS void mixChannels(const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, - const int* fromTo, size_t npairs); - -/** @overload -@param src input array or vector of matrices; all of the matrices must have the same size and the -same depth. -@param dst output array or vector of matrices; all the matrices **must be allocated**; their size and -depth must be the same as in src[0]. -@param fromTo array of index pairs specifying which channels are copied and where; fromTo[k\*2] is -a 0-based index of the input channel in src, fromTo[k\*2+1] is an index of the output channel in -dst; the continuous channel numbering is used: the first input image channels are indexed from 0 to -src[0].channels()-1, the second input image channels are indexed from src[0].channels() to -src[0].channels() + src[1].channels()-1, and so on, the same scheme is used for the output image -channels; as a special case, when fromTo[k\*2] is negative, the corresponding output channel is -filled with zero . -@param npairs number of index pairs in fromTo. -*/ -CV_EXPORTS void mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst, - const int* fromTo, size_t npairs); - -/** @overload -@param src input array or vector of matrices; all of the matrices must have the same size and the -same depth. -@param dst output array or vector of matrices; all the matrices **must be allocated**; their size and -depth must be the same as in src[0]. -@param fromTo array of index pairs specifying which channels are copied and where; fromTo[k\*2] is -a 0-based index of the input channel in src, fromTo[k\*2+1] is an index of the output channel in -dst; the continuous channel numbering is used: the first input image channels are indexed from 0 to -src[0].channels()-1, the second input image channels are indexed from src[0].channels() to -src[0].channels() + src[1].channels()-1, and so on, the same scheme is used for the output image -channels; as a special case, when fromTo[k\*2] is negative, the corresponding output channel is -filled with zero . -*/ -CV_EXPORTS_W void mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst, - const std::vector& fromTo); - -/** @brief Extracts a single channel from src (coi is 0-based index) -@param src input array -@param dst output array -@param coi index of channel to extract -@sa mixChannels, split -*/ -CV_EXPORTS_W void extractChannel(InputArray src, OutputArray dst, int coi); - -/** @brief Inserts a single channel to dst (coi is 0-based index) -@param src input array -@param dst output array -@param coi index of channel for insertion -@sa mixChannels, merge -*/ -CV_EXPORTS_W void insertChannel(InputArray src, InputOutputArray dst, int coi); - -/** @brief Flips a 2D array around vertical, horizontal, or both axes. - -The function cv::flip flips the array in one of three different ways (row -and column indices are 0-based): -\f[\texttt{dst} _{ij} = -\left\{ -\begin{array}{l l} -\texttt{src} _{\texttt{src.rows}-i-1,j} & if\; \texttt{flipCode} = 0 \\ -\texttt{src} _{i, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} > 0 \\ -\texttt{src} _{ \texttt{src.rows} -i-1, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} < 0 \\ -\end{array} -\right.\f] -The example scenarios of using the function are the following: -* Vertical flipping of the image (flipCode == 0) to switch between - top-left and bottom-left image origin. This is a typical operation - in video processing on Microsoft Windows\* OS. -* Horizontal flipping of the image with the subsequent horizontal - shift and absolute difference calculation to check for a - vertical-axis symmetry (flipCode \> 0). -* Simultaneous horizontal and vertical flipping of the image with - the subsequent shift and absolute difference calculation to check - for a central symmetry (flipCode \< 0). -* Reversing the order of point arrays (flipCode \> 0 or - flipCode == 0). -@param src input array. -@param dst output array of the same size and type as src. -@param flipCode a flag to specify how to flip the array; 0 means -flipping around the x-axis and positive value (for example, 1) means -flipping around y-axis. Negative value (for example, -1) means flipping -around both axes. -@sa transpose , repeat , completeSymm -*/ -CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode); - -enum RotateFlags { - ROTATE_90_CLOCKWISE = 0, //! A = (cv::Mat_(3, 2) << 1, 4, - 2, 5, - 3, 6); - cv::Mat_ B = (cv::Mat_(3, 2) << 7, 10, - 8, 11, - 9, 12); - - cv::Mat C; - cv::hconcat(A, B, C); - //C: - //[1, 4, 7, 10; - // 2, 5, 8, 11; - // 3, 6, 9, 12] - @endcode - @param src1 first input array to be considered for horizontal concatenation. - @param src2 second input array to be considered for horizontal concatenation. - @param dst output array. It has the same number of rows and depth as the src1 and src2, and the sum of cols of the src1 and src2. - */ -CV_EXPORTS void hconcat(InputArray src1, InputArray src2, OutputArray dst); -/** @overload - @code{.cpp} - std::vector matrices = { cv::Mat(4, 1, CV_8UC1, cv::Scalar(1)), - cv::Mat(4, 1, CV_8UC1, cv::Scalar(2)), - cv::Mat(4, 1, CV_8UC1, cv::Scalar(3)),}; - - cv::Mat out; - cv::hconcat( matrices, out ); - //out: - //[1, 2, 3; - // 1, 2, 3; - // 1, 2, 3; - // 1, 2, 3] - @endcode - @param src input array or vector of matrices. all of the matrices must have the same number of rows and the same depth. - @param dst output array. It has the same number of rows and depth as the src, and the sum of cols of the src. -same depth. - */ -CV_EXPORTS_W void hconcat(InputArrayOfArrays src, OutputArray dst); - -/** @brief Applies vertical concatenation to given matrices. - -The function vertically concatenates two or more cv::Mat matrices (with the same number of cols). -@code{.cpp} - cv::Mat matArray[] = { cv::Mat(1, 4, CV_8UC1, cv::Scalar(1)), - cv::Mat(1, 4, CV_8UC1, cv::Scalar(2)), - cv::Mat(1, 4, CV_8UC1, cv::Scalar(3)),}; - - cv::Mat out; - cv::vconcat( matArray, 3, out ); - //out: - //[1, 1, 1, 1; - // 2, 2, 2, 2; - // 3, 3, 3, 3] -@endcode -@param src input array or vector of matrices. all of the matrices must have the same number of cols and the same depth. -@param nsrc number of matrices in src. -@param dst output array. It has the same number of cols and depth as the src, and the sum of rows of the src. -@sa cv::hconcat(const Mat*, size_t, OutputArray), @sa cv::hconcat(InputArrayOfArrays, OutputArray) and @sa cv::hconcat(InputArray, InputArray, OutputArray) -*/ -CV_EXPORTS void vconcat(const Mat* src, size_t nsrc, OutputArray dst); -/** @overload - @code{.cpp} - cv::Mat_ A = (cv::Mat_(3, 2) << 1, 7, - 2, 8, - 3, 9); - cv::Mat_ B = (cv::Mat_(3, 2) << 4, 10, - 5, 11, - 6, 12); - - cv::Mat C; - cv::vconcat(A, B, C); - //C: - //[1, 7; - // 2, 8; - // 3, 9; - // 4, 10; - // 5, 11; - // 6, 12] - @endcode - @param src1 first input array to be considered for vertical concatenation. - @param src2 second input array to be considered for vertical concatenation. - @param dst output array. It has the same number of cols and depth as the src1 and src2, and the sum of rows of the src1 and src2. - */ -CV_EXPORTS void vconcat(InputArray src1, InputArray src2, OutputArray dst); -/** @overload - @code{.cpp} - std::vector matrices = { cv::Mat(1, 4, CV_8UC1, cv::Scalar(1)), - cv::Mat(1, 4, CV_8UC1, cv::Scalar(2)), - cv::Mat(1, 4, CV_8UC1, cv::Scalar(3)),}; - - cv::Mat out; - cv::vconcat( matrices, out ); - //out: - //[1, 1, 1, 1; - // 2, 2, 2, 2; - // 3, 3, 3, 3] - @endcode - @param src input array or vector of matrices. all of the matrices must have the same number of cols and the same depth - @param dst output array. It has the same number of cols and depth as the src, and the sum of rows of the src. -same depth. - */ -CV_EXPORTS_W void vconcat(InputArrayOfArrays src, OutputArray dst); - -/** @brief computes bitwise conjunction of the two arrays (dst = src1 & src2) -Calculates the per-element bit-wise conjunction of two arrays or an -array and a scalar. - -The function cv::bitwise_and calculates the per-element bit-wise logical conjunction for: -* Two arrays when src1 and src2 have the same size: - \f[\texttt{dst} (I) = \texttt{src1} (I) \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f] -* An array and a scalar when src2 is constructed from Scalar or has - the same number of elements as `src1.channels()`: - \f[\texttt{dst} (I) = \texttt{src1} (I) \wedge \texttt{src2} \quad \texttt{if mask} (I) \ne0\f] -* A scalar and an array when src1 is constructed from Scalar or has - the same number of elements as `src2.channels()`: - \f[\texttt{dst} (I) = \texttt{src1} \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f] -In case of floating-point arrays, their machine-specific bit -representations (usually IEEE754-compliant) are used for the operation. -In case of multi-channel arrays, each channel is processed -independently. In the second and third cases above, the scalar is first -converted to the array type. -@param src1 first input array or a scalar. -@param src2 second input array or a scalar. -@param dst output array that has the same size and type as the input -arrays. -@param mask optional operation mask, 8-bit single channel array, that -specifies elements of the output array to be changed. -*/ -CV_EXPORTS_W void bitwise_and(InputArray src1, InputArray src2, - OutputArray dst, InputArray mask = noArray()); - -/** @brief Calculates the per-element bit-wise disjunction of two arrays or an -array and a scalar. - -The function cv::bitwise_or calculates the per-element bit-wise logical disjunction for: -* Two arrays when src1 and src2 have the same size: - \f[\texttt{dst} (I) = \texttt{src1} (I) \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f] -* An array and a scalar when src2 is constructed from Scalar or has - the same number of elements as `src1.channels()`: - \f[\texttt{dst} (I) = \texttt{src1} (I) \vee \texttt{src2} \quad \texttt{if mask} (I) \ne0\f] -* A scalar and an array when src1 is constructed from Scalar or has - the same number of elements as `src2.channels()`: - \f[\texttt{dst} (I) = \texttt{src1} \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f] -In case of floating-point arrays, their machine-specific bit -representations (usually IEEE754-compliant) are used for the operation. -In case of multi-channel arrays, each channel is processed -independently. In the second and third cases above, the scalar is first -converted to the array type. -@param src1 first input array or a scalar. -@param src2 second input array or a scalar. -@param dst output array that has the same size and type as the input -arrays. -@param mask optional operation mask, 8-bit single channel array, that -specifies elements of the output array to be changed. -*/ -CV_EXPORTS_W void bitwise_or(InputArray src1, InputArray src2, - OutputArray dst, InputArray mask = noArray()); - -/** @brief Calculates the per-element bit-wise "exclusive or" operation on two -arrays or an array and a scalar. - -The function cv::bitwise_xor calculates the per-element bit-wise logical "exclusive-or" -operation for: -* Two arrays when src1 and src2 have the same size: - \f[\texttt{dst} (I) = \texttt{src1} (I) \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f] -* An array and a scalar when src2 is constructed from Scalar or has - the same number of elements as `src1.channels()`: - \f[\texttt{dst} (I) = \texttt{src1} (I) \oplus \texttt{src2} \quad \texttt{if mask} (I) \ne0\f] -* A scalar and an array when src1 is constructed from Scalar or has - the same number of elements as `src2.channels()`: - \f[\texttt{dst} (I) = \texttt{src1} \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f] -In case of floating-point arrays, their machine-specific bit -representations (usually IEEE754-compliant) are used for the operation. -In case of multi-channel arrays, each channel is processed -independently. In the 2nd and 3rd cases above, the scalar is first -converted to the array type. -@param src1 first input array or a scalar. -@param src2 second input array or a scalar. -@param dst output array that has the same size and type as the input -arrays. -@param mask optional operation mask, 8-bit single channel array, that -specifies elements of the output array to be changed. -*/ -CV_EXPORTS_W void bitwise_xor(InputArray src1, InputArray src2, - OutputArray dst, InputArray mask = noArray()); - -/** @brief Inverts every bit of an array. - -The function cv::bitwise_not calculates per-element bit-wise inversion of the input -array: -\f[\texttt{dst} (I) = \neg \texttt{src} (I)\f] -In case of a floating-point input array, its machine-specific bit -representation (usually IEEE754-compliant) is used for the operation. In -case of multi-channel arrays, each channel is processed independently. -@param src input array. -@param dst output array that has the same size and type as the input -array. -@param mask optional operation mask, 8-bit single channel array, that -specifies elements of the output array to be changed. -*/ -CV_EXPORTS_W void bitwise_not(InputArray src, OutputArray dst, - InputArray mask = noArray()); - -/** @brief Calculates the per-element absolute difference between two arrays or between an array and a scalar. - -The function cv::absdiff calculates: -* Absolute difference between two arrays when they have the same - size and type: - \f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2}(I)|)\f] -* Absolute difference between an array and a scalar when the second - array is constructed from Scalar or has as many elements as the - number of channels in `src1`: - \f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2} |)\f] -* Absolute difference between a scalar and an array when the first - array is constructed from Scalar or has as many elements as the - number of channels in `src2`: - \f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1} - \texttt{src2}(I) |)\f] - where I is a multi-dimensional index of array elements. In case of - multi-channel arrays, each channel is processed independently. -@note Saturation is not applied when the arrays have the depth CV_32S. -You may even get a negative value in the case of overflow. -@param src1 first input array or a scalar. -@param src2 second input array or a scalar. -@param dst output array that has the same size and type as input arrays. -@sa cv::abs(const Mat&) -*/ -CV_EXPORTS_W void absdiff(InputArray src1, InputArray src2, OutputArray dst); - -/** @brief Checks if array elements lie between the elements of two other arrays. - -The function checks the range as follows: -- For every element of a single-channel input array: - \f[\texttt{dst} (I)= \texttt{lowerb} (I)_0 \leq \texttt{src} (I)_0 \leq \texttt{upperb} (I)_0\f] -- For two-channel arrays: - \f[\texttt{dst} (I)= \texttt{lowerb} (I)_0 \leq \texttt{src} (I)_0 \leq \texttt{upperb} (I)_0 \land \texttt{lowerb} (I)_1 \leq \texttt{src} (I)_1 \leq \texttt{upperb} (I)_1\f] -- and so forth. - -That is, dst (I) is set to 255 (all 1 -bits) if src (I) is within the -specified 1D, 2D, 3D, ... box and 0 otherwise. - -When the lower and/or upper boundary parameters are scalars, the indexes -(I) at lowerb and upperb in the above formulas should be omitted. -@param src first input array. -@param lowerb inclusive lower boundary array or a scalar. -@param upperb inclusive upper boundary array or a scalar. -@param dst output array of the same size as src and CV_8U type. -*/ -CV_EXPORTS_W void inRange(InputArray src, InputArray lowerb, - InputArray upperb, OutputArray dst); - -/** @brief Performs the per-element comparison of two arrays or an array and scalar value. - -The function compares: -* Elements of two arrays when src1 and src2 have the same size: - \f[\texttt{dst} (I) = \texttt{src1} (I) \,\texttt{cmpop}\, \texttt{src2} (I)\f] -* Elements of src1 with a scalar src2 when src2 is constructed from - Scalar or has a single element: - \f[\texttt{dst} (I) = \texttt{src1}(I) \,\texttt{cmpop}\, \texttt{src2}\f] -* src1 with elements of src2 when src1 is constructed from Scalar or - has a single element: - \f[\texttt{dst} (I) = \texttt{src1} \,\texttt{cmpop}\, \texttt{src2} (I)\f] -When the comparison result is true, the corresponding element of output -array is set to 255. The comparison operations can be replaced with the -equivalent matrix expressions: -@code{.cpp} - Mat dst1 = src1 >= src2; - Mat dst2 = src1 < 8; - ... -@endcode -@param src1 first input array or a scalar; when it is an array, it must have a single channel. -@param src2 second input array or a scalar; when it is an array, it must have a single channel. -@param dst output array of type ref CV_8U that has the same size and the same number of channels as - the input arrays. -@param cmpop a flag, that specifies correspondence between the arrays (cv::CmpTypes) -@sa checkRange, min, max, threshold -*/ -CV_EXPORTS_W void compare(InputArray src1, InputArray src2, OutputArray dst, int cmpop); - -/** @brief Calculates per-element minimum of two arrays or an array and a scalar. - -The function cv::min calculates the per-element minimum of two arrays: -\f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{src2} (I))\f] -or array and a scalar: -\f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{value} )\f] -@param src1 first input array. -@param src2 second input array of the same size and type as src1. -@param dst output array of the same size and type as src1. -@sa max, compare, inRange, minMaxLoc -*/ -CV_EXPORTS_W void min(InputArray src1, InputArray src2, OutputArray dst); -/** @overload -needed to avoid conflicts with const _Tp& std::min(const _Tp&, const _Tp&, _Compare) -*/ -CV_EXPORTS void min(const Mat& src1, const Mat& src2, Mat& dst); -/** @overload -needed to avoid conflicts with const _Tp& std::min(const _Tp&, const _Tp&, _Compare) -*/ -CV_EXPORTS void min(const UMat& src1, const UMat& src2, UMat& dst); - -/** @brief Calculates per-element maximum of two arrays or an array and a scalar. - -The function cv::max calculates the per-element maximum of two arrays: -\f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{src2} (I))\f] -or array and a scalar: -\f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{value} )\f] -@param src1 first input array. -@param src2 second input array of the same size and type as src1 . -@param dst output array of the same size and type as src1. -@sa min, compare, inRange, minMaxLoc, @ref MatrixExpressions -*/ -CV_EXPORTS_W void max(InputArray src1, InputArray src2, OutputArray dst); -/** @overload -needed to avoid conflicts with const _Tp& std::min(const _Tp&, const _Tp&, _Compare) -*/ -CV_EXPORTS void max(const Mat& src1, const Mat& src2, Mat& dst); -/** @overload -needed to avoid conflicts with const _Tp& std::min(const _Tp&, const _Tp&, _Compare) -*/ -CV_EXPORTS void max(const UMat& src1, const UMat& src2, UMat& dst); - -/** @brief Calculates a square root of array elements. - -The function cv::sqrt calculates a square root of each input array element. -In case of multi-channel arrays, each channel is processed -independently. The accuracy is approximately the same as of the built-in -std::sqrt . -@param src input floating-point array. -@param dst output array of the same size and type as src. -*/ -CV_EXPORTS_W void sqrt(InputArray src, OutputArray dst); - -/** @brief Raises every array element to a power. - -The function cv::pow raises every element of the input array to power : -\f[\texttt{dst} (I) = \fork{\texttt{src}(I)^{power}}{if \(\texttt{power}\) is integer}{|\texttt{src}(I)|^{power}}{otherwise}\f] - -So, for a non-integer power exponent, the absolute values of input array -elements are used. However, it is possible to get true values for -negative values using some extra operations. In the example below, -computing the 5th root of array src shows: -@code{.cpp} - Mat mask = src < 0; - pow(src, 1./5, dst); - subtract(Scalar::all(0), dst, dst, mask); -@endcode -For some values of power, such as integer values, 0.5 and -0.5, -specialized faster algorithms are used. - -Special values (NaN, Inf) are not handled. -@param src input array. -@param power exponent of power. -@param dst output array of the same size and type as src. -@sa sqrt, exp, log, cartToPolar, polarToCart -*/ -CV_EXPORTS_W void pow(InputArray src, double power, OutputArray dst); - -/** @brief Calculates the exponent of every array element. - -The function cv::exp calculates the exponent of every element of the input -array: -\f[\texttt{dst} [I] = e^{ src(I) }\f] - -The maximum relative error is about 7e-6 for single-precision input and -less than 1e-10 for double-precision input. Currently, the function -converts denormalized values to zeros on output. Special values (NaN, -Inf) are not handled. -@param src input array. -@param dst output array of the same size and type as src. -@sa log , cartToPolar , polarToCart , phase , pow , sqrt , magnitude -*/ -CV_EXPORTS_W void exp(InputArray src, OutputArray dst); - -/** @brief Calculates the natural logarithm of every array element. - -The function cv::log calculates the natural logarithm of every element of the input array: -\f[\texttt{dst} (I) = \log (\texttt{src}(I)) \f] - -Output on zero, negative and special (NaN, Inf) values is undefined. - -@param src input array. -@param dst output array of the same size and type as src . -@sa exp, cartToPolar, polarToCart, phase, pow, sqrt, magnitude -*/ -CV_EXPORTS_W void log(InputArray src, OutputArray dst); - -/** @brief Calculates x and y coordinates of 2D vectors from their magnitude and angle. - -The function cv::polarToCart calculates the Cartesian coordinates of each 2D -vector represented by the corresponding elements of magnitude and angle: -\f[\begin{array}{l} \texttt{x} (I) = \texttt{magnitude} (I) \cos ( \texttt{angle} (I)) \\ \texttt{y} (I) = \texttt{magnitude} (I) \sin ( \texttt{angle} (I)) \\ \end{array}\f] - -The relative accuracy of the estimated coordinates is about 1e-6. -@param magnitude input floating-point array of magnitudes of 2D vectors; -it can be an empty matrix (=Mat()), in this case, the function assumes -that all the magnitudes are =1; if it is not empty, it must have the -same size and type as angle. -@param angle input floating-point array of angles of 2D vectors. -@param x output array of x-coordinates of 2D vectors; it has the same -size and type as angle. -@param y output array of y-coordinates of 2D vectors; it has the same -size and type as angle. -@param angleInDegrees when true, the input angles are measured in -degrees, otherwise, they are measured in radians. -@sa cartToPolar, magnitude, phase, exp, log, pow, sqrt -*/ -CV_EXPORTS_W void polarToCart(InputArray magnitude, InputArray angle, - OutputArray x, OutputArray y, bool angleInDegrees = false); - -/** @brief Calculates the magnitude and angle of 2D vectors. - -The function cv::cartToPolar calculates either the magnitude, angle, or both -for every 2D vector (x(I),y(I)): -\f[\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}\f] - -The angles are calculated with accuracy about 0.3 degrees. For the point -(0,0), the angle is set to 0. -@param x array of x-coordinates; this must be a single-precision or -double-precision floating-point array. -@param y array of y-coordinates, that must have the same size and same type as x. -@param magnitude output array of magnitudes of the same size and type as x. -@param angle output array of angles that has the same size and type as -x; the angles are measured in radians (from 0 to 2\*Pi) or in degrees (0 to 360 degrees). -@param angleInDegrees a flag, indicating whether the angles are measured -in radians (which is by default), or in degrees. -@sa Sobel, Scharr -*/ -CV_EXPORTS_W void cartToPolar(InputArray x, InputArray y, - OutputArray magnitude, OutputArray angle, - bool angleInDegrees = false); - -/** @brief Calculates the rotation angle of 2D vectors. - -The function cv::phase calculates the rotation angle of each 2D vector that -is formed from the corresponding elements of x and y : -\f[\texttt{angle} (I) = \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))\f] - -The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0 , -the corresponding angle(I) is set to 0. -@param x input floating-point array of x-coordinates of 2D vectors. -@param y input array of y-coordinates of 2D vectors; it must have the -same size and the same type as x. -@param angle output array of vector angles; it has the same size and -same type as x . -@param angleInDegrees when true, the function calculates the angle in -degrees, otherwise, they are measured in radians. -*/ -CV_EXPORTS_W void phase(InputArray x, InputArray y, OutputArray angle, - bool angleInDegrees = false); - -/** @brief Calculates the magnitude of 2D vectors. - -The function cv::magnitude calculates the magnitude of 2D vectors formed -from the corresponding elements of x and y arrays: -\f[\texttt{dst} (I) = \sqrt{\texttt{x}(I)^2 + \texttt{y}(I)^2}\f] -@param x floating-point array of x-coordinates of the vectors. -@param y floating-point array of y-coordinates of the vectors; it must -have the same size as x. -@param magnitude output array of the same size and type as x. -@sa cartToPolar, polarToCart, phase, sqrt -*/ -CV_EXPORTS_W void magnitude(InputArray x, InputArray y, OutputArray magnitude); - -/** @brief Checks every element of an input array for invalid values. - -The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal \> --DBL_MAX and maxVal \< DBL_MAX, the function also checks that each value is between minVal and -maxVal. In case of multi-channel arrays, each channel is processed independently. If some values -are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the -function either returns false (when quiet=true) or throws an exception. -@param a input array. -@param quiet a flag, indicating whether the functions quietly return false when the array elements -are out of range or they throw an exception. -@param pos optional output parameter, when not NULL, must be a pointer to array of src.dims -elements. -@param minVal inclusive lower boundary of valid values range. -@param maxVal exclusive upper boundary of valid values range. -*/ -CV_EXPORTS_W bool checkRange(InputArray a, bool quiet = true, CV_OUT Point* pos = 0, - double minVal = -DBL_MAX, double maxVal = DBL_MAX); - -/** @brief converts NaN's to the given number -*/ -CV_EXPORTS_W void patchNaNs(InputOutputArray a, double val = 0); - -/** @brief Performs generalized matrix multiplication. - -The function cv::gemm performs generalized matrix multiplication similar to the -gemm functions in BLAS level 3. For example, -`gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T)` -corresponds to -\f[\texttt{dst} = \texttt{alpha} \cdot \texttt{src1} ^T \cdot \texttt{src2} + \texttt{beta} \cdot \texttt{src3} ^T\f] - -In case of complex (two-channel) data, performed a complex matrix -multiplication. - -The function can be replaced with a matrix expression. For example, the -above call can be replaced with: -@code{.cpp} - dst = alpha*src1.t()*src2 + beta*src3.t(); -@endcode -@param src1 first multiplied input matrix that could be real(CV_32FC1, -CV_64FC1) or complex(CV_32FC2, CV_64FC2). -@param src2 second multiplied input matrix of the same type as src1. -@param alpha weight of the matrix product. -@param src3 third optional delta matrix added to the matrix product; it -should have the same type as src1 and src2. -@param beta weight of src3. -@param dst output matrix; it has the proper size and the same type as -input matrices. -@param flags operation flags (cv::GemmFlags) -@sa mulTransposed , transform -*/ -CV_EXPORTS_W void gemm(InputArray src1, InputArray src2, double alpha, - InputArray src3, double beta, OutputArray dst, int flags = 0); - -/** @brief Calculates the product of a matrix and its transposition. - -The function cv::mulTransposed calculates the product of src and its -transposition: -\f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\f] -if aTa=true , and -\f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\f] -otherwise. The function is used to calculate the covariance matrix. With -zero delta, it can be used as a faster substitute for general matrix -product A\*B when B=A' -@param src input single-channel matrix. Note that unlike gemm, the -function can multiply not only floating-point matrices. -@param dst output square matrix. -@param aTa Flag specifying the multiplication ordering. See the -description below. -@param delta Optional delta matrix subtracted from src before the -multiplication. When the matrix is empty ( delta=noArray() ), it is -assumed to be zero, that is, nothing is subtracted. If it has the same -size as src , it is simply subtracted. Otherwise, it is "repeated" (see -repeat ) to cover the full src and then subtracted. Type of the delta -matrix, when it is not empty, must be the same as the type of created -output matrix. See the dtype parameter description below. -@param scale Optional scale factor for the matrix product. -@param dtype Optional type of the output matrix. When it is negative, -the output matrix will have the same type as src . Otherwise, it will be -type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F . -@sa calcCovarMatrix, gemm, repeat, reduce -*/ -CV_EXPORTS_W void mulTransposed( InputArray src, OutputArray dst, bool aTa, - InputArray delta = noArray(), - double scale = 1, int dtype = -1 ); - -/** @brief Transposes a matrix. - -The function cv::transpose transposes the matrix src : -\f[\texttt{dst} (i,j) = \texttt{src} (j,i)\f] -@note No complex conjugation is done in case of a complex matrix. It -should be done separately if needed. -@param src input array. -@param dst output array of the same type as src. -*/ -CV_EXPORTS_W void transpose(InputArray src, OutputArray dst); - -/** @brief Performs the matrix transformation of every array element. - -The function cv::transform performs the matrix transformation of every -element of the array src and stores the results in dst : -\f[\texttt{dst} (I) = \texttt{m} \cdot \texttt{src} (I)\f] -(when m.cols=src.channels() ), or -\f[\texttt{dst} (I) = \texttt{m} \cdot [ \texttt{src} (I); 1]\f] -(when m.cols=src.channels()+1 ) - -Every element of the N -channel array src is interpreted as N -element -vector that is transformed using the M x N or M x (N+1) matrix m to -M-element vector - the corresponding element of the output array dst . - -The function may be used for geometrical transformation of -N -dimensional points, arbitrary linear color space transformation (such -as various kinds of RGB to YUV transforms), shuffling the image -channels, and so forth. -@param src input array that must have as many channels (1 to 4) as -m.cols or m.cols-1. -@param dst output array of the same size and depth as src; it has as -many channels as m.rows. -@param m transformation 2x2 or 2x3 floating-point matrix. -@sa perspectiveTransform, getAffineTransform, estimateAffine2D, warpAffine, warpPerspective -*/ -CV_EXPORTS_W void transform(InputArray src, OutputArray dst, InputArray m ); - -/** @brief Performs the perspective matrix transformation of vectors. - -The function cv::perspectiveTransform transforms every element of src by -treating it as a 2D or 3D vector, in the following way: -\f[(x, y, z) \rightarrow (x'/w, y'/w, z'/w)\f] -where -\f[(x', y', z', w') = \texttt{mat} \cdot \begin{bmatrix} x & y & z & 1 \end{bmatrix}\f] -and -\f[w = \fork{w'}{if \(w' \ne 0\)}{\infty}{otherwise}\f] - -Here a 3D vector transformation is shown. In case of a 2D vector -transformation, the z component is omitted. - -@note The function transforms a sparse set of 2D or 3D vectors. If you -want to transform an image using perspective transformation, use -warpPerspective . If you have an inverse problem, that is, you want to -compute the most probable perspective transformation out of several -pairs of corresponding points, you can use getPerspectiveTransform or -findHomography . -@param src input two-channel or three-channel floating-point array; each -element is a 2D/3D vector to be transformed. -@param dst output array of the same size and type as src. -@param m 3x3 or 4x4 floating-point transformation matrix. -@sa transform, warpPerspective, getPerspectiveTransform, findHomography -*/ -CV_EXPORTS_W void perspectiveTransform(InputArray src, OutputArray dst, InputArray m ); - -/** @brief Copies the lower or the upper half of a square matrix to its another half. - -The function cv::completeSymm copies the lower or the upper half of a square matrix to -its another half. The matrix diagonal remains unchanged: - - \f$\texttt{m}_{ij}=\texttt{m}_{ji}\f$ for \f$i > j\f$ if - lowerToUpper=false - - \f$\texttt{m}_{ij}=\texttt{m}_{ji}\f$ for \f$i < j\f$ if - lowerToUpper=true - -@param m input-output floating-point square matrix. -@param lowerToUpper operation flag; if true, the lower half is copied to -the upper half. Otherwise, the upper half is copied to the lower half. -@sa flip, transpose -*/ -CV_EXPORTS_W void completeSymm(InputOutputArray m, bool lowerToUpper = false); - -/** @brief Initializes a scaled identity matrix. - -The function cv::setIdentity initializes a scaled identity matrix: -\f[\texttt{mtx} (i,j)= \fork{\texttt{value}}{ if \(i=j\)}{0}{otherwise}\f] - -The function can also be emulated using the matrix initializers and the -matrix expressions: -@code - Mat A = Mat::eye(4, 3, CV_32F)*5; - // A will be set to [[5, 0, 0], [0, 5, 0], [0, 0, 5], [0, 0, 0]] -@endcode -@param mtx matrix to initialize (not necessarily square). -@param s value to assign to diagonal elements. -@sa Mat::zeros, Mat::ones, Mat::setTo, Mat::operator= -*/ -CV_EXPORTS_W void setIdentity(InputOutputArray mtx, const Scalar& s = Scalar(1)); - -/** @brief Returns the determinant of a square floating-point matrix. - -The function cv::determinant calculates and returns the determinant of the -specified matrix. For small matrices ( mtx.cols=mtx.rows\<=3 ), the -direct method is used. For larger matrices, the function uses LU -factorization with partial pivoting. - -For symmetric positively-determined matrices, it is also possible to use -eigen decomposition to calculate the determinant. -@param mtx input matrix that must have CV_32FC1 or CV_64FC1 type and -square size. -@sa trace, invert, solve, eigen, @ref MatrixExpressions -*/ -CV_EXPORTS_W double determinant(InputArray mtx); - -/** @brief Returns the trace of a matrix. - -The function cv::trace returns the sum of the diagonal elements of the -matrix mtx . -\f[\mathrm{tr} ( \texttt{mtx} ) = \sum _i \texttt{mtx} (i,i)\f] -@param mtx input matrix. -*/ -CV_EXPORTS_W Scalar trace(InputArray mtx); - -/** @brief Finds the inverse or pseudo-inverse of a matrix. - -The function cv::invert inverts the matrix src and stores the result in dst -. When the matrix src is singular or non-square, the function calculates -the pseudo-inverse matrix (the dst matrix) so that norm(src\*dst - I) is -minimal, where I is an identity matrix. - -In case of the #DECOMP_LU method, the function returns non-zero value if -the inverse has been successfully calculated and 0 if src is singular. - -In case of the #DECOMP_SVD method, the function returns the inverse -condition number of src (the ratio of the smallest singular value to the -largest singular value) and 0 if src is singular. The SVD method -calculates a pseudo-inverse matrix if src is singular. - -Similarly to #DECOMP_LU, the method #DECOMP_CHOLESKY works only with -non-singular square matrices that should also be symmetrical and -positively defined. In this case, the function stores the inverted -matrix in dst and returns non-zero. Otherwise, it returns 0. - -@param src input floating-point M x N matrix. -@param dst output matrix of N x M size and the same type as src. -@param flags inversion method (cv::DecompTypes) -@sa solve, SVD -*/ -CV_EXPORTS_W double invert(InputArray src, OutputArray dst, int flags = DECOMP_LU); - -/** @brief Solves one or more linear systems or least-squares problems. - -The function cv::solve solves a linear system or least-squares problem (the -latter is possible with SVD or QR methods, or by specifying the flag -#DECOMP_NORMAL ): -\f[\texttt{dst} = \arg \min _X \| \texttt{src1} \cdot \texttt{X} - \texttt{src2} \|\f] - -If #DECOMP_LU or #DECOMP_CHOLESKY method is used, the function returns 1 -if src1 (or \f$\texttt{src1}^T\texttt{src1}\f$ ) is non-singular. Otherwise, -it returns 0. In the latter case, dst is not valid. Other methods find a -pseudo-solution in case of a singular left-hand side part. - -@note If you want to find a unity-norm solution of an under-defined -singular system \f$\texttt{src1}\cdot\texttt{dst}=0\f$ , the function solve -will not do the work. Use SVD::solveZ instead. - -@param src1 input matrix on the left-hand side of the system. -@param src2 input matrix on the right-hand side of the system. -@param dst output solution. -@param flags solution (matrix inversion) method (#DecompTypes) -@sa invert, SVD, eigen -*/ -CV_EXPORTS_W bool solve(InputArray src1, InputArray src2, - OutputArray dst, int flags = DECOMP_LU); - -/** @brief Sorts each row or each column of a matrix. - -The function cv::sort sorts each matrix row or each matrix column in -ascending or descending order. So you should pass two operation flags to -get desired behaviour. If you want to sort matrix rows or columns -lexicographically, you can use STL std::sort generic function with the -proper comparison predicate. - -@param src input single-channel array. -@param dst output array of the same size and type as src. -@param flags operation flags, a combination of #SortFlags -@sa sortIdx, randShuffle -*/ -CV_EXPORTS_W void sort(InputArray src, OutputArray dst, int flags); - -/** @brief Sorts each row or each column of a matrix. - -The function cv::sortIdx sorts each matrix row or each matrix column in the -ascending or descending order. So you should pass two operation flags to -get desired behaviour. Instead of reordering the elements themselves, it -stores the indices of sorted elements in the output array. For example: -@code - Mat A = Mat::eye(3,3,CV_32F), B; - sortIdx(A, B, SORT_EVERY_ROW + SORT_ASCENDING); - // B will probably contain - // (because of equal elements in A some permutations are possible): - // [[1, 2, 0], [0, 2, 1], [0, 1, 2]] -@endcode -@param src input single-channel array. -@param dst output integer array of the same size as src. -@param flags operation flags that could be a combination of cv::SortFlags -@sa sort, randShuffle -*/ -CV_EXPORTS_W void sortIdx(InputArray src, OutputArray dst, int flags); - -/** @brief Finds the real roots of a cubic equation. - -The function solveCubic finds the real roots of a cubic equation: -- if coeffs is a 4-element vector: -\f[\texttt{coeffs} [0] x^3 + \texttt{coeffs} [1] x^2 + \texttt{coeffs} [2] x + \texttt{coeffs} [3] = 0\f] -- if coeffs is a 3-element vector: -\f[x^3 + \texttt{coeffs} [0] x^2 + \texttt{coeffs} [1] x + \texttt{coeffs} [2] = 0\f] - -The roots are stored in the roots array. -@param coeffs equation coefficients, an array of 3 or 4 elements. -@param roots output array of real roots that has 1 or 3 elements. -@return number of real roots. It can be 0, 1 or 2. -*/ -CV_EXPORTS_W int solveCubic(InputArray coeffs, OutputArray roots); - -/** @brief Finds the real or complex roots of a polynomial equation. - -The function cv::solvePoly finds real and complex roots of a polynomial equation: -\f[\texttt{coeffs} [n] x^{n} + \texttt{coeffs} [n-1] x^{n-1} + ... + \texttt{coeffs} [1] x + \texttt{coeffs} [0] = 0\f] -@param coeffs array of polynomial coefficients. -@param roots output (complex) array of roots. -@param maxIters maximum number of iterations the algorithm does. -*/ -CV_EXPORTS_W double solvePoly(InputArray coeffs, OutputArray roots, int maxIters = 300); - -/** @brief Calculates eigenvalues and eigenvectors of a symmetric matrix. - -The function cv::eigen calculates just eigenvalues, or eigenvalues and eigenvectors of the symmetric -matrix src: -@code - src*eigenvectors.row(i).t() = eigenvalues.at(i)*eigenvectors.row(i).t() -@endcode - -@note Use cv::eigenNonSymmetric for calculation of real eigenvalues and eigenvectors of non-symmetric matrix. - -@param src input matrix that must have CV_32FC1 or CV_64FC1 type, square size and be symmetrical -(src ^T^ == src). -@param eigenvalues output vector of eigenvalues of the same type as src; the eigenvalues are stored -in the descending order. -@param eigenvectors output matrix of eigenvectors; it has the same size and type as src; the -eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding -eigenvalues. -@sa eigenNonSymmetric, completeSymm , PCA -*/ -CV_EXPORTS_W bool eigen(InputArray src, OutputArray eigenvalues, - OutputArray eigenvectors = noArray()); - -/** @brief Calculates eigenvalues and eigenvectors of a non-symmetric matrix (real eigenvalues only). - -@note Assumes real eigenvalues. - -The function calculates eigenvalues and eigenvectors (optional) of the square matrix src: -@code - src*eigenvectors.row(i).t() = eigenvalues.at(i)*eigenvectors.row(i).t() -@endcode - -@param src input matrix (CV_32FC1 or CV_64FC1 type). -@param eigenvalues output vector of eigenvalues (type is the same type as src). -@param eigenvectors output matrix of eigenvectors (type is the same type as src). The eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding eigenvalues. -@sa eigen -*/ -CV_EXPORTS_W void eigenNonSymmetric(InputArray src, OutputArray eigenvalues, - OutputArray eigenvectors); - -/** @brief Calculates the covariance matrix of a set of vectors. - -The function cv::calcCovarMatrix calculates the covariance matrix and, optionally, the mean vector of -the set of input vectors. -@param samples samples stored as separate matrices -@param nsamples number of samples -@param covar output covariance matrix of the type ctype and square size. -@param mean input or output (depending on the flags) array as the average value of the input vectors. -@param flags operation flags as a combination of #CovarFlags -@param ctype type of the matrixl; it equals 'CV_64F' by default. -@sa PCA, mulTransposed, Mahalanobis -@todo InputArrayOfArrays -*/ -CV_EXPORTS void calcCovarMatrix( const Mat* samples, int nsamples, Mat& covar, Mat& mean, - int flags, int ctype = CV_64F); - -/** @overload -@note use #COVAR_ROWS or #COVAR_COLS flag -@param samples samples stored as rows/columns of a single matrix. -@param covar output covariance matrix of the type ctype and square size. -@param mean input or output (depending on the flags) array as the average value of the input vectors. -@param flags operation flags as a combination of #CovarFlags -@param ctype type of the matrixl; it equals 'CV_64F' by default. -*/ -CV_EXPORTS_W void calcCovarMatrix( InputArray samples, OutputArray covar, - InputOutputArray mean, int flags, int ctype = CV_64F); - -/** wrap PCA::operator() */ -CV_EXPORTS_W void PCACompute(InputArray data, InputOutputArray mean, - OutputArray eigenvectors, int maxComponents = 0); - -/** wrap PCA::operator() and add eigenvalues output parameter */ -CV_EXPORTS_AS(PCACompute2) void PCACompute(InputArray data, InputOutputArray mean, - OutputArray eigenvectors, OutputArray eigenvalues, - int maxComponents = 0); - -/** wrap PCA::operator() */ -CV_EXPORTS_W void PCACompute(InputArray data, InputOutputArray mean, - OutputArray eigenvectors, double retainedVariance); - -/** wrap PCA::operator() and add eigenvalues output parameter */ -CV_EXPORTS_AS(PCACompute2) void PCACompute(InputArray data, InputOutputArray mean, - OutputArray eigenvectors, OutputArray eigenvalues, - double retainedVariance); - -/** wrap PCA::project */ -CV_EXPORTS_W void PCAProject(InputArray data, InputArray mean, - InputArray eigenvectors, OutputArray result); - -/** wrap PCA::backProject */ -CV_EXPORTS_W void PCABackProject(InputArray data, InputArray mean, - InputArray eigenvectors, OutputArray result); - -/** wrap SVD::compute */ -CV_EXPORTS_W void SVDecomp( InputArray src, OutputArray w, OutputArray u, OutputArray vt, int flags = 0 ); - -/** wrap SVD::backSubst */ -CV_EXPORTS_W void SVBackSubst( InputArray w, InputArray u, InputArray vt, - InputArray rhs, OutputArray dst ); - -/** @brief Calculates the Mahalanobis distance between two vectors. - -The function cv::Mahalanobis calculates and returns the weighted distance between two vectors: -\f[d( \texttt{vec1} , \texttt{vec2} )= \sqrt{\sum_{i,j}{\texttt{icovar(i,j)}\cdot(\texttt{vec1}(I)-\texttt{vec2}(I))\cdot(\texttt{vec1(j)}-\texttt{vec2(j)})} }\f] -The covariance matrix may be calculated using the #calcCovarMatrix function and then inverted using -the invert function (preferably using the #DECOMP_SVD method, as the most accurate). -@param v1 first 1D input vector. -@param v2 second 1D input vector. -@param icovar inverse covariance matrix. -*/ -CV_EXPORTS_W double Mahalanobis(InputArray v1, InputArray v2, InputArray icovar); - -/** @brief Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array. - -The function cv::dft performs one of the following: -- Forward the Fourier transform of a 1D vector of N elements: - \f[Y = F^{(N)} \cdot X,\f] - where \f$F^{(N)}_{jk}=\exp(-2\pi i j k/N)\f$ and \f$i=\sqrt{-1}\f$ -- Inverse the Fourier transform of a 1D vector of N elements: - \f[\begin{array}{l} X'= \left (F^{(N)} \right )^{-1} \cdot Y = \left (F^{(N)} \right )^* \cdot y \\ X = (1/N) \cdot X, \end{array}\f] - where \f$F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T\f$ -- Forward the 2D Fourier transform of a M x N matrix: - \f[Y = F^{(M)} \cdot X \cdot F^{(N)}\f] -- Inverse the 2D Fourier transform of a M x N matrix: - \f[\begin{array}{l} X'= \left (F^{(M)} \right )^* \cdot Y \cdot \left (F^{(N)} \right )^* \\ X = \frac{1}{M \cdot N} \cdot X' \end{array}\f] - -In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input -spectrum of the inverse Fourier transform can be represented in a packed format called *CCS* -(complex-conjugate-symmetrical). It was borrowed from IPL (Intel\* Image Processing Library). Here -is how 2D *CCS* spectrum looks: -\f[\begin{bmatrix} Re Y_{0,0} & Re Y_{0,1} & Im Y_{0,1} & Re Y_{0,2} & Im Y_{0,2} & \cdots & Re Y_{0,N/2-1} & Im Y_{0,N/2-1} & Re Y_{0,N/2} \\ Re Y_{1,0} & Re Y_{1,1} & Im Y_{1,1} & Re Y_{1,2} & Im Y_{1,2} & \cdots & Re Y_{1,N/2-1} & Im Y_{1,N/2-1} & Re Y_{1,N/2} \\ Im Y_{1,0} & Re Y_{2,1} & Im Y_{2,1} & Re Y_{2,2} & Im Y_{2,2} & \cdots & Re Y_{2,N/2-1} & Im Y_{2,N/2-1} & Im Y_{1,N/2} \\ \hdotsfor{9} \\ Re Y_{M/2-1,0} & Re Y_{M-3,1} & Im Y_{M-3,1} & \hdotsfor{3} & Re Y_{M-3,N/2-1} & Im Y_{M-3,N/2-1}& Re Y_{M/2-1,N/2} \\ Im Y_{M/2-1,0} & Re Y_{M-2,1} & Im Y_{M-2,1} & \hdotsfor{3} & Re Y_{M-2,N/2-1} & Im Y_{M-2,N/2-1}& Im Y_{M/2-1,N/2} \\ Re Y_{M/2,0} & Re Y_{M-1,1} & Im Y_{M-1,1} & \hdotsfor{3} & Re Y_{M-1,N/2-1} & Im Y_{M-1,N/2-1}& Re Y_{M/2,N/2} \end{bmatrix}\f] - -In case of 1D transform of a real vector, the output looks like the first row of the matrix above. - -So, the function chooses an operation mode depending on the flags and size of the input array: -- If #DFT_ROWS is set or the input array has a single row or single column, the function - performs a 1D forward or inverse transform of each row of a matrix when #DFT_ROWS is set. - Otherwise, it performs a 2D transform. -- If the input array is real and #DFT_INVERSE is not set, the function performs a forward 1D or - 2D transform: - - When #DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as - input. - - When #DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as - input. In case of 2D transform, it uses the packed format as shown above. In case of a - single 1D transform, it looks like the first row of the matrix above. In case of - multiple 1D transforms (when using the #DFT_ROWS flag), each row of the output matrix - looks like the first row of the matrix above. -- If the input array is complex and either #DFT_INVERSE or #DFT_REAL_OUTPUT are not set, the - output is a complex array of the same size as input. The function performs a forward or - inverse 1D or 2D transform of the whole input array or each row of the input array - independently, depending on the flags DFT_INVERSE and DFT_ROWS. -- When #DFT_INVERSE is set and the input array is real, or it is complex but #DFT_REAL_OUTPUT - is set, the output is a real array of the same size as input. The function performs a 1D or 2D - inverse transformation of the whole input array or each individual row, depending on the flags - #DFT_INVERSE and #DFT_ROWS. - -If #DFT_SCALE is set, the scaling is done after the transformation. - -Unlike dct , the function supports arrays of arbitrary size. But only those arrays are processed -efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the -current implementation). Such an efficient DFT size can be calculated using the getOptimalDFTSize -method. - -The sample below illustrates how to calculate a DFT-based convolution of two 2D real arrays: -@code - void convolveDFT(InputArray A, InputArray B, OutputArray C) - { - // reallocate the output array if needed - C.create(abs(A.rows - B.rows)+1, abs(A.cols - B.cols)+1, A.type()); - Size dftSize; - // calculate the size of DFT transform - dftSize.width = getOptimalDFTSize(A.cols + B.cols - 1); - dftSize.height = getOptimalDFTSize(A.rows + B.rows - 1); - - // allocate temporary buffers and initialize them with 0's - Mat tempA(dftSize, A.type(), Scalar::all(0)); - Mat tempB(dftSize, B.type(), Scalar::all(0)); - - // copy A and B to the top-left corners of tempA and tempB, respectively - Mat roiA(tempA, Rect(0,0,A.cols,A.rows)); - A.copyTo(roiA); - Mat roiB(tempB, Rect(0,0,B.cols,B.rows)); - B.copyTo(roiB); - - // now transform the padded A & B in-place; - // use "nonzeroRows" hint for faster processing - dft(tempA, tempA, 0, A.rows); - dft(tempB, tempB, 0, B.rows); - - // multiply the spectrums; - // the function handles packed spectrum representations well - mulSpectrums(tempA, tempB, tempA); - - // transform the product back from the frequency domain. - // Even though all the result rows will be non-zero, - // you need only the first C.rows of them, and thus you - // pass nonzeroRows == C.rows - dft(tempA, tempA, DFT_INVERSE + DFT_SCALE, C.rows); - - // now copy the result back to C. - tempA(Rect(0, 0, C.cols, C.rows)).copyTo(C); - - // all the temporary buffers will be deallocated automatically - } -@endcode -To optimize this sample, consider the following approaches: -- Since nonzeroRows != 0 is passed to the forward transform calls and since A and B are copied to - the top-left corners of tempA and tempB, respectively, it is not necessary to clear the whole - tempA and tempB. It is only necessary to clear the tempA.cols - A.cols ( tempB.cols - B.cols) - rightmost columns of the matrices. -- This DFT-based convolution does not have to be applied to the whole big arrays, especially if B - is significantly smaller than A or vice versa. Instead, you can calculate convolution by parts. - To do this, you need to split the output array C into multiple tiles. For each tile, estimate - which parts of A and B are required to calculate convolution in this tile. If the tiles in C are - too small, the speed will decrease a lot because of repeated work. In the ultimate case, when - each tile in C is a single pixel, the algorithm becomes equivalent to the naive convolution - algorithm. If the tiles are too big, the temporary arrays tempA and tempB become too big and - there is also a slowdown because of bad cache locality. So, there is an optimal tile size - somewhere in the middle. -- If different tiles in C can be calculated in parallel and, thus, the convolution is done by - parts, the loop can be threaded. - -All of the above improvements have been implemented in #matchTemplate and #filter2D . Therefore, by -using them, you can get the performance even better than with the above theoretically optimal -implementation. Though, those two functions actually calculate cross-correlation, not convolution, -so you need to "flip" the second convolution operand B vertically and horizontally using flip . -@note -- An example using the discrete fourier transform can be found at - opencv_source_code/samples/cpp/dft.cpp -- (Python) An example using the dft functionality to perform Wiener deconvolution can be found - at opencv_source/samples/python/deconvolution.py -- (Python) An example rearranging the quadrants of a Fourier image can be found at - opencv_source/samples/python/dft.py -@param src input array that could be real or complex. -@param dst output array whose size and type depends on the flags . -@param flags transformation flags, representing a combination of the #DftFlags -@param nonzeroRows when the parameter is not zero, the function assumes that only the first -nonzeroRows rows of the input array (#DFT_INVERSE is not set) or only the first nonzeroRows of the -output array (#DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the -rows more efficiently and save some time; this technique is very useful for calculating array -cross-correlation or convolution using DFT. -@sa dct , getOptimalDFTSize , mulSpectrums, filter2D , matchTemplate , flip , cartToPolar , -magnitude , phase -*/ -CV_EXPORTS_W void dft(InputArray src, OutputArray dst, int flags = 0, int nonzeroRows = 0); - -/** @brief Calculates the inverse Discrete Fourier Transform of a 1D or 2D array. - -idft(src, dst, flags) is equivalent to dft(src, dst, flags | #DFT_INVERSE) . -@note None of dft and idft scales the result by default. So, you should pass #DFT_SCALE to one of -dft or idft explicitly to make these transforms mutually inverse. -@sa dft, dct, idct, mulSpectrums, getOptimalDFTSize -@param src input floating-point real or complex array. -@param dst output array whose size and type depend on the flags. -@param flags operation flags (see dft and #DftFlags). -@param nonzeroRows number of dst rows to process; the rest of the rows have undefined content (see -the convolution sample in dft description. -*/ -CV_EXPORTS_W void idft(InputArray src, OutputArray dst, int flags = 0, int nonzeroRows = 0); - -/** @brief Performs a forward or inverse discrete Cosine transform of 1D or 2D array. - -The function cv::dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D -floating-point array: -- Forward Cosine transform of a 1D vector of N elements: - \f[Y = C^{(N)} \cdot X\f] - where - \f[C^{(N)}_{jk}= \sqrt{\alpha_j/N} \cos \left ( \frac{\pi(2k+1)j}{2N} \right )\f] - and - \f$\alpha_0=1\f$, \f$\alpha_j=2\f$ for *j \> 0*. -- Inverse Cosine transform of a 1D vector of N elements: - \f[X = \left (C^{(N)} \right )^{-1} \cdot Y = \left (C^{(N)} \right )^T \cdot Y\f] - (since \f$C^{(N)}\f$ is an orthogonal matrix, \f$C^{(N)} \cdot \left(C^{(N)}\right)^T = I\f$ ) -- Forward 2D Cosine transform of M x N matrix: - \f[Y = C^{(N)} \cdot X \cdot \left (C^{(N)} \right )^T\f] -- Inverse 2D Cosine transform of M x N matrix: - \f[X = \left (C^{(N)} \right )^T \cdot X \cdot C^{(N)}\f] - -The function chooses the mode of operation by looking at the flags and size of the input array: -- If (flags & #DCT_INVERSE) == 0 , the function does a forward 1D or 2D transform. Otherwise, it - is an inverse 1D or 2D transform. -- If (flags & #DCT_ROWS) != 0 , the function performs a 1D transform of each row. -- If the array is a single column or a single row, the function performs a 1D transform. -- If none of the above is true, the function performs a 2D transform. - -@note Currently dct supports even-size arrays (2, 4, 6 ...). For data analysis and approximation, you -can pad the array when necessary. -Also, the function performance depends very much, and not monotonically, on the array size (see -getOptimalDFTSize ). In the current implementation DCT of a vector of size N is calculated via DFT -of a vector of size N/2 . Thus, the optimal DCT size N1 \>= N can be calculated as: -@code - size_t getOptimalDCTSize(size_t N) { return 2*getOptimalDFTSize((N+1)/2); } - N1 = getOptimalDCTSize(N); -@endcode -@param src input floating-point array. -@param dst output array of the same size and type as src . -@param flags transformation flags as a combination of cv::DftFlags (DCT_*) -@sa dft , getOptimalDFTSize , idct -*/ -CV_EXPORTS_W void dct(InputArray src, OutputArray dst, int flags = 0); - -/** @brief Calculates the inverse Discrete Cosine Transform of a 1D or 2D array. - -idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE). -@param src input floating-point single-channel array. -@param dst output array of the same size and type as src. -@param flags operation flags. -@sa dct, dft, idft, getOptimalDFTSize -*/ -CV_EXPORTS_W void idct(InputArray src, OutputArray dst, int flags = 0); - -/** @brief Performs the per-element multiplication of two Fourier spectrums. - -The function cv::mulSpectrums performs the per-element multiplication of the two CCS-packed or complex -matrices that are results of a real or complex Fourier transform. - -The function, together with dft and idft , may be used to calculate convolution (pass conjB=false ) -or correlation (pass conjB=true ) of two arrays rapidly. When the arrays are complex, they are -simply multiplied (per element) with an optional conjugation of the second-array elements. When the -arrays are real, they are assumed to be CCS-packed (see dft for details). -@param a first input array. -@param b second input array of the same size and type as src1 . -@param c output array of the same size and type as src1 . -@param flags operation flags; currently, the only supported flag is cv::DFT_ROWS, which indicates that -each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a `0` as value. -@param conjB optional flag that conjugates the second input array before the multiplication (true) -or not (false). -*/ -CV_EXPORTS_W void mulSpectrums(InputArray a, InputArray b, OutputArray c, - int flags, bool conjB = false); - -/** @brief Returns the optimal DFT size for a given vector size. - -DFT performance is not a monotonic function of a vector size. Therefore, when you calculate -convolution of two arrays or perform the spectral analysis of an array, it usually makes sense to -pad the input data with zeros to get a bit larger array that can be transformed much faster than the -original one. Arrays whose size is a power-of-two (2, 4, 8, 16, 32, ...) are the fastest to process. -Though, the arrays whose size is a product of 2's, 3's, and 5's (for example, 300 = 5\*5\*3\*2\*2) -are also processed quite efficiently. - -The function cv::getOptimalDFTSize returns the minimum number N that is greater than or equal to vecsize -so that the DFT of a vector of size N can be processed efficiently. In the current implementation N -= 2 ^p^ \* 3 ^q^ \* 5 ^r^ for some integer p, q, r. - -The function returns a negative number if vecsize is too large (very close to INT_MAX ). - -While the function cannot be used directly to estimate the optimal vector size for DCT transform -(since the current DCT implementation supports only even-size vectors), it can be easily processed -as getOptimalDFTSize((vecsize+1)/2)\*2. -@param vecsize vector size. -@sa dft , dct , idft , idct , mulSpectrums -*/ -CV_EXPORTS_W int getOptimalDFTSize(int vecsize); - -/** @brief Returns the default random number generator. - -The function cv::theRNG returns the default random number generator. For each thread, there is a -separate random number generator, so you can use the function safely in multi-thread environments. -If you just need to get a single random number using this generator or initialize an array, you can -use randu or randn instead. But if you are going to generate many random numbers inside a loop, it -is much faster to use this function to retrieve the generator and then use RNG::operator _Tp() . -@sa RNG, randu, randn -*/ -CV_EXPORTS RNG& theRNG(); - -/** @brief Sets state of default random number generator. - -The function cv::setRNGSeed sets state of default random number generator to custom value. -@param seed new state for default random number generator -@sa RNG, randu, randn -*/ -CV_EXPORTS_W void setRNGSeed(int seed); - -/** @brief Generates a single uniformly-distributed random number or an array of random numbers. - -Non-template variant of the function fills the matrix dst with uniformly-distributed -random numbers from the specified range: -\f[\texttt{low} _c \leq \texttt{dst} (I)_c < \texttt{high} _c\f] -@param dst output array of random numbers; the array must be pre-allocated. -@param low inclusive lower boundary of the generated random numbers. -@param high exclusive upper boundary of the generated random numbers. -@sa RNG, randn, theRNG -*/ -CV_EXPORTS_W void randu(InputOutputArray dst, InputArray low, InputArray high); - -/** @brief Fills the array with normally distributed random numbers. - -The function cv::randn fills the matrix dst with normally distributed random numbers with the specified -mean vector and the standard deviation matrix. The generated random numbers are clipped to fit the -value range of the output array data type. -@param dst output array of random numbers; the array must be pre-allocated and have 1 to 4 channels. -@param mean mean value (expectation) of the generated random numbers. -@param stddev standard deviation of the generated random numbers; it can be either a vector (in -which case a diagonal standard deviation matrix is assumed) or a square matrix. -@sa RNG, randu -*/ -CV_EXPORTS_W void randn(InputOutputArray dst, InputArray mean, InputArray stddev); - -/** @brief Shuffles the array elements randomly. - -The function cv::randShuffle shuffles the specified 1D array by randomly choosing pairs of elements and -swapping them. The number of such swap operations will be dst.rows\*dst.cols\*iterFactor . -@param dst input/output numerical 1D array. -@param iterFactor scale factor that determines the number of random swap operations (see the details -below). -@param rng optional random number generator used for shuffling; if it is zero, theRNG () is used -instead. -@sa RNG, sort -*/ -CV_EXPORTS_W void randShuffle(InputOutputArray dst, double iterFactor = 1., RNG* rng = 0); - -/** @brief Principal Component Analysis - -The class is used to calculate a special basis for a set of vectors. The -basis will consist of eigenvectors of the covariance matrix calculated -from the input set of vectors. The class %PCA can also transform -vectors to/from the new coordinate space defined by the basis. Usually, -in this new coordinate system, each vector from the original set (and -any linear combination of such vectors) can be quite accurately -approximated by taking its first few components, corresponding to the -eigenvectors of the largest eigenvalues of the covariance matrix. -Geometrically it means that you calculate a projection of the vector to -a subspace formed by a few eigenvectors corresponding to the dominant -eigenvalues of the covariance matrix. And usually such a projection is -very close to the original vector. So, you can represent the original -vector from a high-dimensional space with a much shorter vector -consisting of the projected vector's coordinates in the subspace. Such a -transformation is also known as Karhunen-Loeve Transform, or KLT. -See http://en.wikipedia.org/wiki/Principal_component_analysis - -The sample below is the function that takes two matrices. The first -function stores a set of vectors (a row per vector) that is used to -calculate PCA. The second function stores another "test" set of vectors -(a row per vector). First, these vectors are compressed with PCA, then -reconstructed back, and then the reconstruction error norm is computed -and printed for each vector. : - -@code{.cpp} -using namespace cv; - -PCA compressPCA(const Mat& pcaset, int maxComponents, - const Mat& testset, Mat& compressed) -{ - PCA pca(pcaset, // pass the data - Mat(), // we do not have a pre-computed mean vector, - // so let the PCA engine to compute it - PCA::DATA_AS_ROW, // indicate that the vectors - // are stored as matrix rows - // (use PCA::DATA_AS_COL if the vectors are - // the matrix columns) - maxComponents // specify, how many principal components to retain - ); - // if there is no test data, just return the computed basis, ready-to-use - if( !testset.data ) - return pca; - CV_Assert( testset.cols == pcaset.cols ); - - compressed.create(testset.rows, maxComponents, testset.type()); - - Mat reconstructed; - for( int i = 0; i < testset.rows; i++ ) - { - Mat vec = testset.row(i), coeffs = compressed.row(i), reconstructed; - // compress the vector, the result will be stored - // in the i-th row of the output matrix - pca.project(vec, coeffs); - // and then reconstruct it - pca.backProject(coeffs, reconstructed); - // and measure the error - printf("%d. diff = %g\n", i, norm(vec, reconstructed, NORM_L2)); - } - return pca; -} -@endcode -@sa calcCovarMatrix, mulTransposed, SVD, dft, dct -*/ -class CV_EXPORTS PCA -{ -public: - enum Flags { DATA_AS_ROW = 0, //!< indicates that the input samples are stored as matrix rows - DATA_AS_COL = 1, //!< indicates that the input samples are stored as matrix columns - USE_AVG = 2 //! - }; - - /** @brief default constructor - - The default constructor initializes an empty %PCA structure. The other - constructors initialize the structure and call PCA::operator()(). - */ - PCA(); - - /** @overload - @param data input samples stored as matrix rows or matrix columns. - @param mean optional mean value; if the matrix is empty (@c noArray()), - the mean is computed from the data. - @param flags operation flags; currently the parameter is only used to - specify the data layout (PCA::Flags) - @param maxComponents maximum number of components that %PCA should - retain; by default, all the components are retained. - */ - PCA(InputArray data, InputArray mean, int flags, int maxComponents = 0); - - /** @overload - @param data input samples stored as matrix rows or matrix columns. - @param mean optional mean value; if the matrix is empty (noArray()), - the mean is computed from the data. - @param flags operation flags; currently the parameter is only used to - specify the data layout (PCA::Flags) - @param retainedVariance Percentage of variance that PCA should retain. - Using this parameter will let the PCA decided how many components to - retain but it will always keep at least 2. - */ - PCA(InputArray data, InputArray mean, int flags, double retainedVariance); - - /** @brief performs %PCA - - The operator performs %PCA of the supplied dataset. It is safe to reuse - the same PCA structure for multiple datasets. That is, if the structure - has been previously used with another dataset, the existing internal - data is reclaimed and the new @ref eigenvalues, @ref eigenvectors and @ref - mean are allocated and computed. - - The computed @ref eigenvalues are sorted from the largest to the smallest and - the corresponding @ref eigenvectors are stored as eigenvectors rows. - - @param data input samples stored as the matrix rows or as the matrix - columns. - @param mean optional mean value; if the matrix is empty (noArray()), - the mean is computed from the data. - @param flags operation flags; currently the parameter is only used to - specify the data layout. (Flags) - @param maxComponents maximum number of components that PCA should - retain; by default, all the components are retained. - */ - PCA& operator()(InputArray data, InputArray mean, int flags, int maxComponents = 0); - - /** @overload - @param data input samples stored as the matrix rows or as the matrix - columns. - @param mean optional mean value; if the matrix is empty (noArray()), - the mean is computed from the data. - @param flags operation flags; currently the parameter is only used to - specify the data layout. (PCA::Flags) - @param retainedVariance Percentage of variance that %PCA should retain. - Using this parameter will let the %PCA decided how many components to - retain but it will always keep at least 2. - */ - PCA& operator()(InputArray data, InputArray mean, int flags, double retainedVariance); - - /** @brief Projects vector(s) to the principal component subspace. - - The methods project one or more vectors to the principal component - subspace, where each vector projection is represented by coefficients in - the principal component basis. The first form of the method returns the - matrix that the second form writes to the result. So the first form can - be used as a part of expression while the second form can be more - efficient in a processing loop. - @param vec input vector(s); must have the same dimensionality and the - same layout as the input data used at %PCA phase, that is, if - DATA_AS_ROW are specified, then `vec.cols==data.cols` - (vector dimensionality) and `vec.rows` is the number of vectors to - project, and the same is true for the PCA::DATA_AS_COL case. - */ - Mat project(InputArray vec) const; - - /** @overload - @param vec input vector(s); must have the same dimensionality and the - same layout as the input data used at PCA phase, that is, if - DATA_AS_ROW are specified, then `vec.cols==data.cols` - (vector dimensionality) and `vec.rows` is the number of vectors to - project, and the same is true for the PCA::DATA_AS_COL case. - @param result output vectors; in case of PCA::DATA_AS_COL, the - output matrix has as many columns as the number of input vectors, this - means that `result.cols==vec.cols` and the number of rows match the - number of principal components (for example, `maxComponents` parameter - passed to the constructor). - */ - void project(InputArray vec, OutputArray result) const; - - /** @brief Reconstructs vectors from their PC projections. - - The methods are inverse operations to PCA::project. They take PC - coordinates of projected vectors and reconstruct the original vectors. - Unless all the principal components have been retained, the - reconstructed vectors are different from the originals. But typically, - the difference is small if the number of components is large enough (but - still much smaller than the original vector dimensionality). As a - result, PCA is used. - @param vec coordinates of the vectors in the principal component - subspace, the layout and size are the same as of PCA::project output - vectors. - */ - Mat backProject(InputArray vec) const; - - /** @overload - @param vec coordinates of the vectors in the principal component - subspace, the layout and size are the same as of PCA::project output - vectors. - @param result reconstructed vectors; the layout and size are the same as - of PCA::project input vectors. - */ - void backProject(InputArray vec, OutputArray result) const; - - /** @brief write PCA objects - - Writes @ref eigenvalues @ref eigenvectors and @ref mean to specified FileStorage - */ - void write(FileStorage& fs) const; - - /** @brief load PCA objects - - Loads @ref eigenvalues @ref eigenvectors and @ref mean from specified FileNode - */ - void read(const FileNode& fn); - - Mat eigenvectors; //!< eigenvectors of the covariation matrix - Mat eigenvalues; //!< eigenvalues of the covariation matrix - Mat mean; //!< mean value subtracted before the projection and added after the back projection -}; - -/** @example samples/cpp/pca.cpp -An example using %PCA for dimensionality reduction while maintaining an amount of variance -*/ - -/** @example samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp -Check @ref tutorial_introduction_to_pca "the corresponding tutorial" for more details -*/ - -/** -@brief Linear Discriminant Analysis -@todo document this class -*/ -class CV_EXPORTS LDA -{ -public: - /** @brief constructor - Initializes a LDA with num_components (default 0). - */ - explicit LDA(int num_components = 0); - - /** Initializes and performs a Discriminant Analysis with Fisher's - Optimization Criterion on given data in src and corresponding labels - in labels. If 0 (or less) number of components are given, they are - automatically determined for given data in computation. - */ - LDA(InputArrayOfArrays src, InputArray labels, int num_components = 0); - - /** Serializes this object to a given filename. - */ - void save(const String& filename) const; - - /** Deserializes this object from a given filename. - */ - void load(const String& filename); - - /** Serializes this object to a given cv::FileStorage. - */ - void save(FileStorage& fs) const; - - /** Deserializes this object from a given cv::FileStorage. - */ - void load(const FileStorage& node); - - /** destructor - */ - ~LDA(); - - /** Compute the discriminants for data in src (row aligned) and labels. - */ - void compute(InputArrayOfArrays src, InputArray labels); - - /** Projects samples into the LDA subspace. - src may be one or more row aligned samples. - */ - Mat project(InputArray src); - - /** Reconstructs projections from the LDA subspace. - src may be one or more row aligned projections. - */ - Mat reconstruct(InputArray src); - - /** Returns the eigenvectors of this LDA. - */ - Mat eigenvectors() const { return _eigenvectors; } - - /** Returns the eigenvalues of this LDA. - */ - Mat eigenvalues() const { return _eigenvalues; } - - static Mat subspaceProject(InputArray W, InputArray mean, InputArray src); - static Mat subspaceReconstruct(InputArray W, InputArray mean, InputArray src); - -protected: - bool _dataAsRow; // unused, but needed for 3.0 ABI compatibility. - int _num_components; - Mat _eigenvectors; - Mat _eigenvalues; - void lda(InputArrayOfArrays src, InputArray labels); -}; - -/** @brief Singular Value Decomposition - -Class for computing Singular Value Decomposition of a floating-point -matrix. The Singular Value Decomposition is used to solve least-square -problems, under-determined linear systems, invert matrices, compute -condition numbers, and so on. - -If you want to compute a condition number of a matrix or an absolute value of -its determinant, you do not need `u` and `vt`. You can pass -flags=SVD::NO_UV|... . Another flag SVD::FULL_UV indicates that full-size u -and vt must be computed, which is not necessary most of the time. - -@sa invert, solve, eigen, determinant -*/ -class CV_EXPORTS SVD -{ -public: - enum Flags { - /** allow the algorithm to modify the decomposed matrix; it can save space and speed up - processing. currently ignored. */ - MODIFY_A = 1, - /** indicates that only a vector of singular values `w` is to be processed, while u and vt - will be set to empty matrices */ - NO_UV = 2, - /** when the matrix is not square, by default the algorithm produces u and vt matrices of - sufficiently large size for the further A reconstruction; if, however, FULL_UV flag is - specified, u and vt will be full-size square orthogonal matrices.*/ - FULL_UV = 4 - }; - - /** @brief the default constructor - - initializes an empty SVD structure - */ - SVD(); - - /** @overload - initializes an empty SVD structure and then calls SVD::operator() - @param src decomposed matrix. The depth has to be CV_32F or CV_64F. - @param flags operation flags (SVD::Flags) - */ - SVD( InputArray src, int flags = 0 ); - - /** @brief the operator that performs SVD. The previously allocated u, w and vt are released. - - The operator performs the singular value decomposition of the supplied - matrix. The u,`vt` , and the vector of singular values w are stored in - the structure. The same SVD structure can be reused many times with - different matrices. Each time, if needed, the previous u,`vt` , and w - are reclaimed and the new matrices are created, which is all handled by - Mat::create. - @param src decomposed matrix. The depth has to be CV_32F or CV_64F. - @param flags operation flags (SVD::Flags) - */ - SVD& operator ()( InputArray src, int flags = 0 ); - - /** @brief decomposes matrix and stores the results to user-provided matrices - - The methods/functions perform SVD of matrix. Unlike SVD::SVD constructor - and SVD::operator(), they store the results to the user-provided - matrices: - - @code{.cpp} - Mat A, w, u, vt; - SVD::compute(A, w, u, vt); - @endcode - - @param src decomposed matrix. The depth has to be CV_32F or CV_64F. - @param w calculated singular values - @param u calculated left singular vectors - @param vt transposed matrix of right singular vectors - @param flags operation flags - see SVD::Flags. - */ - static void compute( InputArray src, OutputArray w, - OutputArray u, OutputArray vt, int flags = 0 ); - - /** @overload - computes singular values of a matrix - @param src decomposed matrix. The depth has to be CV_32F or CV_64F. - @param w calculated singular values - @param flags operation flags - see SVD::Flags. - */ - static void compute( InputArray src, OutputArray w, int flags = 0 ); - - /** @brief performs back substitution - */ - static void backSubst( InputArray w, InputArray u, - InputArray vt, InputArray rhs, - OutputArray dst ); - - /** @brief solves an under-determined singular linear system - - The method finds a unit-length solution x of a singular linear system - A\*x = 0. Depending on the rank of A, there can be no solutions, a - single solution or an infinite number of solutions. In general, the - algorithm solves the following problem: - \f[dst = \arg \min _{x: \| x \| =1} \| src \cdot x \|\f] - @param src left-hand-side matrix. - @param dst found solution. - */ - static void solveZ( InputArray src, OutputArray dst ); - - /** @brief performs a singular value back substitution. - - The method calculates a back substitution for the specified right-hand - side: - - \f[\texttt{x} = \texttt{vt} ^T \cdot diag( \texttt{w} )^{-1} \cdot \texttt{u} ^T \cdot \texttt{rhs} \sim \texttt{A} ^{-1} \cdot \texttt{rhs}\f] - - Using this technique you can either get a very accurate solution of the - convenient linear system, or the best (in the least-squares terms) - pseudo-solution of an overdetermined linear system. - - @param rhs right-hand side of a linear system (u\*w\*v')\*dst = rhs to - be solved, where A has been previously decomposed. - - @param dst found solution of the system. - - @note Explicit SVD with the further back substitution only makes sense - if you need to solve many linear systems with the same left-hand side - (for example, src ). If all you need is to solve a single system - (possibly with multiple rhs immediately available), simply call solve - add pass #DECOMP_SVD there. It does absolutely the same thing. - */ - void backSubst( InputArray rhs, OutputArray dst ) const; - - /** @todo document */ - template static - void compute( const Matx<_Tp, m, n>& a, Matx<_Tp, nm, 1>& w, Matx<_Tp, m, nm>& u, Matx<_Tp, n, nm>& vt ); - - /** @todo document */ - template static - void compute( const Matx<_Tp, m, n>& a, Matx<_Tp, nm, 1>& w ); - - /** @todo document */ - template static - void backSubst( const Matx<_Tp, nm, 1>& w, const Matx<_Tp, m, nm>& u, const Matx<_Tp, n, nm>& vt, const Matx<_Tp, m, nb>& rhs, Matx<_Tp, n, nb>& dst ); - - Mat u, w, vt; -}; - -/** @brief Random Number Generator - -Random number generator. It encapsulates the state (currently, a 64-bit -integer) and has methods to return scalar random values and to fill -arrays with random values. Currently it supports uniform and Gaussian -(normal) distributions. The generator uses Multiply-With-Carry -algorithm, introduced by G. Marsaglia ( - ). -Gaussian-distribution random numbers are generated using the Ziggurat -algorithm ( ), -introduced by G. Marsaglia and W. W. Tsang. -*/ -class CV_EXPORTS RNG -{ -public: - enum { UNIFORM = 0, - NORMAL = 1 - }; - - /** @brief constructor - - These are the RNG constructors. The first form sets the state to some - pre-defined value, equal to 2\*\*32-1 in the current implementation. The - second form sets the state to the specified value. If you passed state=0 - , the constructor uses the above default value instead to avoid the - singular random number sequence, consisting of all zeros. - */ - RNG(); - /** @overload - @param state 64-bit value used to initialize the RNG. - */ - RNG(uint64 state); - /**The method updates the state using the MWC algorithm and returns the - next 32-bit random number.*/ - unsigned next(); - - /**Each of the methods updates the state using the MWC algorithm and - returns the next random number of the specified type. In case of integer - types, the returned number is from the available value range for the - specified type. In case of floating-point types, the returned value is - from [0,1) range. - */ - operator uchar(); - /** @overload */ - operator schar(); - /** @overload */ - operator ushort(); - /** @overload */ - operator short(); - /** @overload */ - operator unsigned(); - /** @overload */ - operator int(); - /** @overload */ - operator float(); - /** @overload */ - operator double(); - - /** @brief returns a random integer sampled uniformly from [0, N). - - The methods transform the state using the MWC algorithm and return the - next random number. The first form is equivalent to RNG::next . The - second form returns the random number modulo N , which means that the - result is in the range [0, N) . - */ - unsigned operator ()(); - /** @overload - @param N upper non-inclusive boundary of the returned random number. - */ - unsigned operator ()(unsigned N); - - /** @brief returns uniformly distributed integer random number from [a,b) range - - The methods transform the state using the MWC algorithm and return the - next uniformly-distributed random number of the specified type, deduced - from the input parameter type, from the range [a, b) . There is a nuance - illustrated by the following sample: - - @code{.cpp} - RNG rng; - - // always produces 0 - double a = rng.uniform(0, 1); - - // produces double from [0, 1) - double a1 = rng.uniform((double)0, (double)1); - - // produces float from [0, 1) - float b = rng.uniform(0.f, 1.f); - - // produces double from [0, 1) - double c = rng.uniform(0., 1.); - - // may cause compiler error because of ambiguity: - // RNG::uniform(0, (int)0.999999)? or RNG::uniform((double)0, 0.99999)? - double d = rng.uniform(0, 0.999999); - @endcode - - The compiler does not take into account the type of the variable to - which you assign the result of RNG::uniform . The only thing that - matters to the compiler is the type of a and b parameters. So, if you - want a floating-point random number, but the range boundaries are - integer numbers, either put dots in the end, if they are constants, or - use explicit type cast operators, as in the a1 initialization above. - @param a lower inclusive boundary of the returned random number. - @param b upper non-inclusive boundary of the returned random number. - */ - int uniform(int a, int b); - /** @overload */ - float uniform(float a, float b); - /** @overload */ - double uniform(double a, double b); - - /** @brief Fills arrays with random numbers. - - @param mat 2D or N-dimensional matrix; currently matrices with more than - 4 channels are not supported by the methods, use Mat::reshape as a - possible workaround. - @param distType distribution type, RNG::UNIFORM or RNG::NORMAL. - @param a first distribution parameter; in case of the uniform - distribution, this is an inclusive lower boundary, in case of the normal - distribution, this is a mean value. - @param b second distribution parameter; in case of the uniform - distribution, this is a non-inclusive upper boundary, in case of the - normal distribution, this is a standard deviation (diagonal of the - standard deviation matrix or the full standard deviation matrix). - @param saturateRange pre-saturation flag; for uniform distribution only; - if true, the method will first convert a and b to the acceptable value - range (according to the mat datatype) and then will generate uniformly - distributed random numbers within the range [saturate(a), saturate(b)), - if saturateRange=false, the method will generate uniformly distributed - random numbers in the original range [a, b) and then will saturate them, - it means, for example, that - theRNG().fill(mat_8u, RNG::UNIFORM, -DBL_MAX, DBL_MAX) will likely - produce array mostly filled with 0's and 255's, since the range (0, 255) - is significantly smaller than [-DBL_MAX, DBL_MAX). - - Each of the methods fills the matrix with the random values from the - specified distribution. As the new numbers are generated, the RNG state - is updated accordingly. In case of multiple-channel images, every - channel is filled independently, which means that RNG cannot generate - samples from the multi-dimensional Gaussian distribution with - non-diagonal covariance matrix directly. To do that, the method - generates samples from multi-dimensional standard Gaussian distribution - with zero mean and identity covariation matrix, and then transforms them - using transform to get samples from the specified Gaussian distribution. - */ - void fill( InputOutputArray mat, int distType, InputArray a, InputArray b, bool saturateRange = false ); - - /** @brief Returns the next random number sampled from the Gaussian distribution - @param sigma standard deviation of the distribution. - - The method transforms the state using the MWC algorithm and returns the - next random number from the Gaussian distribution N(0,sigma) . That is, - the mean value of the returned random numbers is zero and the standard - deviation is the specified sigma . - */ - double gaussian(double sigma); - - uint64 state; - - bool operator ==(const RNG& other) const; -}; - -/** @brief Mersenne Twister random number generator - -Inspired by http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c -@todo document -*/ -class CV_EXPORTS RNG_MT19937 -{ -public: - RNG_MT19937(); - RNG_MT19937(unsigned s); - void seed(unsigned s); - - unsigned next(); - - operator int(); - operator unsigned(); - operator float(); - operator double(); - - unsigned operator ()(unsigned N); - unsigned operator ()(); - - /** @brief returns uniformly distributed integer random number from [a,b) range*/ - int uniform(int a, int b); - /** @brief returns uniformly distributed floating-point random number from [a,b) range*/ - float uniform(float a, float b); - /** @brief returns uniformly distributed double-precision floating-point random number from [a,b) range*/ - double uniform(double a, double b); - -private: - enum PeriodParameters {N = 624, M = 397}; - unsigned state[N]; - int mti; -}; - -//! @} core_array - -//! @addtogroup core_cluster -//! @{ - -/** @example samples/cpp/kmeans.cpp -An example on K-means clustering -*/ - -/** @brief Finds centers of clusters and groups input samples around the clusters. - -The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters -and groups the input samples around the clusters. As an output, \f$\texttt{bestLabels}_i\f$ contains a -0-based cluster index for the sample stored in the \f$i^{th}\f$ row of the samples matrix. - -@note -- (Python) An example on K-means clustering can be found at - opencv_source_code/samples/python/kmeans.py -@param data Data for clustering. An array of N-Dimensional points with float coordinates is needed. -Examples of this array can be: -- Mat points(count, 2, CV_32F); -- Mat points(count, 1, CV_32FC2); -- Mat points(1, count, CV_32FC2); -- std::vector\ points(sampleCount); -@param K Number of clusters to split the set by. -@param bestLabels Input/output integer array that stores the cluster indices for every sample. -@param criteria The algorithm termination criteria, that is, the maximum number of iterations and/or -the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster -centers moves by less than criteria.epsilon on some iteration, the algorithm stops. -@param attempts Flag to specify the number of times the algorithm is executed using different -initial labellings. The algorithm returns the labels that yield the best compactness (see the last -function parameter). -@param flags Flag that can take values of cv::KmeansFlags -@param centers Output matrix of the cluster centers, one row per each cluster center. -@return The function returns the compactness measure that is computed as -\f[\sum _i \| \texttt{samples} _i - \texttt{centers} _{ \texttt{labels} _i} \| ^2\f] -after every attempt. The best (minimum) value is chosen and the corresponding labels and the -compactness value are returned by the function. Basically, you can use only the core of the -function, set the number of attempts to 1, initialize labels each time using a custom algorithm, -pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best -(most-compact) clustering. -*/ -CV_EXPORTS_W double kmeans( InputArray data, int K, InputOutputArray bestLabels, - TermCriteria criteria, int attempts, - int flags, OutputArray centers = noArray() ); - -//! @} core_cluster - -//! @addtogroup core_basic -//! @{ - -/////////////////////////////// Formatted output of cv::Mat /////////////////////////// - -/** @todo document */ -class CV_EXPORTS Formatted -{ -public: - virtual const char* next() = 0; - virtual void reset() = 0; - virtual ~Formatted(); -}; - -/** @todo document */ -class CV_EXPORTS Formatter -{ -public: - enum { FMT_DEFAULT = 0, - FMT_MATLAB = 1, - FMT_CSV = 2, - FMT_PYTHON = 3, - FMT_NUMPY = 4, - FMT_C = 5 - }; - - virtual ~Formatter(); - - virtual Ptr format(const Mat& mtx) const = 0; - - virtual void set32fPrecision(int p = 8) = 0; - virtual void set64fPrecision(int p = 16) = 0; - virtual void setMultiline(bool ml = true) = 0; - - static Ptr get(int fmt = FMT_DEFAULT); - -}; - -static inline -String& operator << (String& out, Ptr fmtd) -{ - fmtd->reset(); - for(const char* str = fmtd->next(); str; str = fmtd->next()) - out += cv::String(str); - return out; -} - -static inline -String& operator << (String& out, const Mat& mtx) -{ - return out << Formatter::get()->format(mtx); -} - -//////////////////////////////////////// Algorithm //////////////////////////////////// - -class CV_EXPORTS Algorithm; - -template struct ParamType {}; - - -/** @brief This is a base class for all more or less complex algorithms in OpenCV - -especially for classes of algorithms, for which there can be multiple implementations. The examples -are stereo correspondence (for which there are algorithms like block matching, semi-global block -matching, graph-cut etc.), background subtraction (which can be done using mixture-of-gaussians -models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck -etc.). - -Here is example of SimpleBlobDetector use in your application via Algorithm interface: -@snippet snippets/core_various.cpp Algorithm -*/ -class CV_EXPORTS_W Algorithm -{ -public: - Algorithm(); - virtual ~Algorithm(); - - /** @brief Clears the algorithm state - */ - CV_WRAP virtual void clear() {} - - /** @brief Stores algorithm parameters in a file storage - */ - virtual void write(FileStorage& fs) const { CV_UNUSED(fs); } - - /** @brief simplified API for language bindings - * @overload - */ - CV_WRAP void write(const Ptr& fs, const String& name = String()) const; - - /** @brief Reads algorithm parameters from a file storage - */ - CV_WRAP virtual void read(const FileNode& fn) { CV_UNUSED(fn); } - - /** @brief Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read - */ - CV_WRAP virtual bool empty() const { return false; } - - /** @brief Reads algorithm from the file node - - This is static template method of Algorithm. It's usage is following (in the case of SVM): - @code - cv::FileStorage fsRead("example.xml", FileStorage::READ); - Ptr svm = Algorithm::read(fsRead.root()); - @endcode - In order to make this method work, the derived class must overwrite Algorithm::read(const - FileNode& fn) and also have static create() method without parameters - (or with all the optional parameters) - */ - template static Ptr<_Tp> read(const FileNode& fn) - { - Ptr<_Tp> obj = _Tp::create(); - obj->read(fn); - return !obj->empty() ? obj : Ptr<_Tp>(); - } - - /** @brief Loads algorithm from the file - - @param filename Name of the file to read. - @param objname The optional name of the node to read (if empty, the first top-level node will be used) - - This is static template method of Algorithm. It's usage is following (in the case of SVM): - @code - Ptr svm = Algorithm::load("my_svm_model.xml"); - @endcode - In order to make this method work, the derived class must overwrite Algorithm::read(const - FileNode& fn). - */ - template static Ptr<_Tp> load(const String& filename, const String& objname=String()) - { - FileStorage fs(filename, FileStorage::READ); - CV_Assert(fs.isOpened()); - FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname]; - if (fn.empty()) return Ptr<_Tp>(); - Ptr<_Tp> obj = _Tp::create(); - obj->read(fn); - return !obj->empty() ? obj : Ptr<_Tp>(); - } - - /** @brief Loads algorithm from a String - - @param strModel The string variable containing the model you want to load. - @param objname The optional name of the node to read (if empty, the first top-level node will be used) - - This is static template method of Algorithm. It's usage is following (in the case of SVM): - @code - Ptr svm = Algorithm::loadFromString(myStringModel); - @endcode - */ - template static Ptr<_Tp> loadFromString(const String& strModel, const String& objname=String()) - { - FileStorage fs(strModel, FileStorage::READ + FileStorage::MEMORY); - FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname]; - Ptr<_Tp> obj = _Tp::create(); - obj->read(fn); - return !obj->empty() ? obj : Ptr<_Tp>(); - } - - /** Saves the algorithm to a file. - In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs). */ - CV_WRAP virtual void save(const String& filename) const; - - /** Returns the algorithm string identifier. - This string is used as top level xml/yml node tag when the object is saved to a file or string. */ - CV_WRAP virtual String getDefaultName() const; - -protected: - void writeFormat(FileStorage& fs) const; -}; - -struct Param { - enum { INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, MAT_VECTOR=5, ALGORITHM=6, FLOAT=7, - UNSIGNED_INT=8, UINT64=9, UCHAR=11, SCALAR=12 }; -}; - - - -template<> struct ParamType -{ - typedef bool const_param_type; - typedef bool member_type; - - enum { type = Param::BOOLEAN }; -}; - -template<> struct ParamType -{ - typedef int const_param_type; - typedef int member_type; - - enum { type = Param::INT }; -}; - -template<> struct ParamType -{ - typedef double const_param_type; - typedef double member_type; - - enum { type = Param::REAL }; -}; - -template<> struct ParamType -{ - typedef const String& const_param_type; - typedef String member_type; - - enum { type = Param::STRING }; -}; - -template<> struct ParamType -{ - typedef const Mat& const_param_type; - typedef Mat member_type; - - enum { type = Param::MAT }; -}; - -template<> struct ParamType > -{ - typedef const std::vector& const_param_type; - typedef std::vector member_type; - - enum { type = Param::MAT_VECTOR }; -}; - -template<> struct ParamType -{ - typedef const Ptr& const_param_type; - typedef Ptr member_type; - - enum { type = Param::ALGORITHM }; -}; - -template<> struct ParamType -{ - typedef float const_param_type; - typedef float member_type; - - enum { type = Param::FLOAT }; -}; - -template<> struct ParamType -{ - typedef unsigned const_param_type; - typedef unsigned member_type; - - enum { type = Param::UNSIGNED_INT }; -}; - -template<> struct ParamType -{ - typedef uint64 const_param_type; - typedef uint64 member_type; - - enum { type = Param::UINT64 }; -}; - -template<> struct ParamType -{ - typedef uchar const_param_type; - typedef uchar member_type; - - enum { type = Param::UCHAR }; -}; - -template<> struct ParamType -{ - typedef const Scalar& const_param_type; - typedef Scalar member_type; - - enum { type = Param::SCALAR }; -}; - -//! @} core_basic - -} //namespace cv - -#include "opencv2/core/operations.hpp" -#include "opencv2/core/cvstd.inl.hpp" -#include "opencv2/core/utility.hpp" -#include "opencv2/core/optim.hpp" -#include "opencv2/core/ovx.hpp" - -#endif /*OPENCV_CORE_HPP*/ diff --git a/opencv/include/opencv2/core/affine.hpp b/opencv/include/opencv2/core/affine.hpp deleted file mode 100644 index 7e2ed30..0000000 --- a/opencv/include/opencv2/core/affine.hpp +++ /dev/null @@ -1,678 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_AFFINE3_HPP -#define OPENCV_CORE_AFFINE3_HPP - -#ifdef __cplusplus - -#include - -namespace cv -{ - -//! @addtogroup core -//! @{ - - /** @brief Affine transform - * - * It represents a 4x4 homogeneous transformation matrix \f$T\f$ - * - * \f[T = - * \begin{bmatrix} - * R & t\\ - * 0 & 1\\ - * \end{bmatrix} - * \f] - * - * where \f$R\f$ is a 3x3 rotation matrix and \f$t\f$ is a 3x1 translation vector. - * - * You can specify \f$R\f$ either by a 3x3 rotation matrix or by a 3x1 rotation vector, - * which is converted to a 3x3 rotation matrix by the Rodrigues formula. - * - * To construct a matrix \f$T\f$ representing first rotation around the axis \f$r\f$ with rotation - * angle \f$|r|\f$ in radian (right hand rule) and then translation by the vector \f$t\f$, you can use - * - * @code - * cv::Vec3f r, t; - * cv::Affine3f T(r, t); - * @endcode - * - * If you already have the rotation matrix \f$R\f$, then you can use - * - * @code - * cv::Matx33f R; - * cv::Affine3f T(R, t); - * @endcode - * - * To extract the rotation matrix \f$R\f$ from \f$T\f$, use - * - * @code - * cv::Matx33f R = T.rotation(); - * @endcode - * - * To extract the translation vector \f$t\f$ from \f$T\f$, use - * - * @code - * cv::Vec3f t = T.translation(); - * @endcode - * - * To extract the rotation vector \f$r\f$ from \f$T\f$, use - * - * @code - * cv::Vec3f r = T.rvec(); - * @endcode - * - * Note that since the mapping from rotation vectors to rotation matrices - * is many to one. The returned rotation vector is not necessarily the one - * you used before to set the matrix. - * - * If you have two transformations \f$T = T_1 * T_2\f$, use - * - * @code - * cv::Affine3f T, T1, T2; - * T = T2.concatenate(T1); - * @endcode - * - * To get the inverse transform of \f$T\f$, use - * - * @code - * cv::Affine3f T, T_inv; - * T_inv = T.inv(); - * @endcode - * - */ - template - class Affine3 - { - public: - typedef T float_type; - typedef Matx Mat3; - typedef Matx Mat4; - typedef Vec Vec3; - - //! Default constructor. It represents a 4x4 identity matrix. - Affine3(); - - //! Augmented affine matrix - Affine3(const Mat4& affine); - - /** - * The resulting 4x4 matrix is - * - * \f[ - * \begin{bmatrix} - * R & t\\ - * 0 & 1\\ - * \end{bmatrix} - * \f] - * - * @param R 3x3 rotation matrix. - * @param t 3x1 translation vector. - */ - Affine3(const Mat3& R, const Vec3& t = Vec3::all(0)); - - /** - * Rodrigues vector. - * - * The last row of the current matrix is set to [0,0,0,1]. - * - * @param rvec 3x1 rotation vector. Its direction indicates the rotation axis and its length - * indicates the rotation angle in radian (using right hand rule). - * @param t 3x1 translation vector. - */ - Affine3(const Vec3& rvec, const Vec3& t = Vec3::all(0)); - - /** - * Combines all constructors above. Supports 4x4, 3x4, 3x3, 1x3, 3x1 sizes of data matrix. - * - * The last row of the current matrix is set to [0,0,0,1] when data is not 4x4. - * - * @param data 1-channel matrix. - * when it is 4x4, it is copied to the current matrix and t is not used. - * When it is 3x4, it is copied to the upper part 3x4 of the current matrix and t is not used. - * When it is 3x3, it is copied to the upper left 3x3 part of the current matrix. - * When it is 3x1 or 1x3, it is treated as a rotation vector and the Rodrigues formula is used - * to compute a 3x3 rotation matrix. - * @param t 3x1 translation vector. It is used only when data is neither 4x4 nor 3x4. - */ - explicit Affine3(const Mat& data, const Vec3& t = Vec3::all(0)); - - //! From 16-element array - explicit Affine3(const float_type* vals); - - //! Create an 4x4 identity transform - static Affine3 Identity(); - - /** - * Rotation matrix. - * - * Copy the rotation matrix to the upper left 3x3 part of the current matrix. - * The remaining elements of the current matrix are not changed. - * - * @param R 3x3 rotation matrix. - * - */ - void rotation(const Mat3& R); - - /** - * Rodrigues vector. - * - * It sets the upper left 3x3 part of the matrix. The remaining part is unaffected. - * - * @param rvec 3x1 rotation vector. The direction indicates the rotation axis and - * its length indicates the rotation angle in radian (using the right thumb convention). - */ - void rotation(const Vec3& rvec); - - /** - * Combines rotation methods above. Supports 3x3, 1x3, 3x1 sizes of data matrix. - * - * It sets the upper left 3x3 part of the matrix. The remaining part is unaffected. - * - * @param data 1-channel matrix. - * When it is a 3x3 matrix, it sets the upper left 3x3 part of the current matrix. - * When it is a 1x3 or 3x1 matrix, it is used as a rotation vector. The Rodrigues formula - * is used to compute the rotation matrix and sets the upper left 3x3 part of the current matrix. - */ - void rotation(const Mat& data); - - /** - * Copy the 3x3 matrix L to the upper left part of the current matrix - * - * It sets the upper left 3x3 part of the matrix. The remaining part is unaffected. - * - * @param L 3x3 matrix. - */ - void linear(const Mat3& L); - - /** - * Copy t to the first three elements of the last column of the current matrix - * - * It sets the upper right 3x1 part of the matrix. The remaining part is unaffected. - * - * @param t 3x1 translation vector. - */ - void translation(const Vec3& t); - - //! @return the upper left 3x3 part - Mat3 rotation() const; - - //! @return the upper left 3x3 part - Mat3 linear() const; - - //! @return the upper right 3x1 part - Vec3 translation() const; - - //! Rodrigues vector. - //! @return a vector representing the upper left 3x3 rotation matrix of the current matrix. - //! @warning Since the mapping between rotation vectors and rotation matrices is many to one, - //! this function returns only one rotation vector that represents the current rotation matrix, - //! which is not necessarily the same one set by `rotation(const Vec3& rvec)`. - Vec3 rvec() const; - - //! @return the inverse of the current matrix. - Affine3 inv(int method = cv::DECOMP_SVD) const; - - //! a.rotate(R) is equivalent to Affine(R, 0) * a; - Affine3 rotate(const Mat3& R) const; - - //! a.rotate(rvec) is equivalent to Affine(rvec, 0) * a; - Affine3 rotate(const Vec3& rvec) const; - - //! a.translate(t) is equivalent to Affine(E, t) * a, where E is an identity matrix - Affine3 translate(const Vec3& t) const; - - //! a.concatenate(affine) is equivalent to affine * a; - Affine3 concatenate(const Affine3& affine) const; - - template operator Affine3() const; - - template Affine3 cast() const; - - Mat4 matrix; - -#if defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H - Affine3(const Eigen::Transform& affine); - Affine3(const Eigen::Transform& affine); - operator Eigen::Transform() const; - operator Eigen::Transform() const; -#endif - }; - - template static - Affine3 operator*(const Affine3& affine1, const Affine3& affine2); - - //! V is a 3-element vector with member fields x, y and z - template static - V operator*(const Affine3& affine, const V& vector); - - typedef Affine3 Affine3f; - typedef Affine3 Affine3d; - - static Vec3f operator*(const Affine3f& affine, const Vec3f& vector); - static Vec3d operator*(const Affine3d& affine, const Vec3d& vector); - - template class DataType< Affine3<_Tp> > - { - public: - typedef Affine3<_Tp> value_type; - typedef Affine3::work_type> work_type; - typedef _Tp channel_type; - - enum { generic_type = 0, - channels = 16, - fmt = traits::SafeFmt::fmt + ((channels - 1) << 8) -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - ,depth = DataType::depth - ,type = CV_MAKETYPE(depth, channels) -#endif - }; - - typedef Vec vec_type; - }; - - namespace traits { - template - struct Depth< Affine3<_Tp> > { enum { value = Depth<_Tp>::value }; }; - template - struct Type< Affine3<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 16) }; }; - } // namespace - -//! @} core - -} - -//! @cond IGNORED - -/////////////////////////////////////////////////////////////////////////////////// -// Implementation - -template inline -cv::Affine3::Affine3() - : matrix(Mat4::eye()) -{} - -template inline -cv::Affine3::Affine3(const Mat4& affine) - : matrix(affine) -{} - -template inline -cv::Affine3::Affine3(const Mat3& R, const Vec3& t) -{ - rotation(R); - translation(t); - matrix.val[12] = matrix.val[13] = matrix.val[14] = 0; - matrix.val[15] = 1; -} - -template inline -cv::Affine3::Affine3(const Vec3& _rvec, const Vec3& t) -{ - rotation(_rvec); - translation(t); - matrix.val[12] = matrix.val[13] = matrix.val[14] = 0; - matrix.val[15] = 1; -} - -template inline -cv::Affine3::Affine3(const cv::Mat& data, const Vec3& t) -{ - CV_Assert(data.type() == cv::traits::Type::value); - CV_Assert(data.channels() == 1); - - if (data.cols == 4 && data.rows == 4) - { - data.copyTo(matrix); - return; - } - else if (data.cols == 4 && data.rows == 3) - { - rotation(data(Rect(0, 0, 3, 3))); - translation(data(Rect(3, 0, 1, 3))); - } - else - { - rotation(data); - translation(t); - } - - matrix.val[12] = matrix.val[13] = matrix.val[14] = 0; - matrix.val[15] = 1; -} - -template inline -cv::Affine3::Affine3(const float_type* vals) : matrix(vals) -{} - -template inline -cv::Affine3 cv::Affine3::Identity() -{ - return Affine3(cv::Affine3::Mat4::eye()); -} - -template inline -void cv::Affine3::rotation(const Mat3& R) -{ - linear(R); -} - -template inline -void cv::Affine3::rotation(const Vec3& _rvec) -{ - double theta = norm(_rvec); - - if (theta < DBL_EPSILON) - rotation(Mat3::eye()); - else - { - double c = std::cos(theta); - double s = std::sin(theta); - double c1 = 1. - c; - double itheta = (theta != 0) ? 1./theta : 0.; - - Point3_ r = _rvec*itheta; - - Mat3 rrt( r.x*r.x, r.x*r.y, r.x*r.z, r.x*r.y, r.y*r.y, r.y*r.z, r.x*r.z, r.y*r.z, r.z*r.z ); - Mat3 r_x( 0, -r.z, r.y, r.z, 0, -r.x, -r.y, r.x, 0 ); - - // R = cos(theta)*I + (1 - cos(theta))*r*rT + sin(theta)*[r_x] - // where [r_x] is [0 -rz ry; rz 0 -rx; -ry rx 0] - Mat3 R = c*Mat3::eye() + c1*rrt + s*r_x; - - rotation(R); - } -} - -//Combines rotation methods above. Supports 3x3, 1x3, 3x1 sizes of data matrix; -template inline -void cv::Affine3::rotation(const cv::Mat& data) -{ - CV_Assert(data.type() == cv::traits::Type::value); - CV_Assert(data.channels() == 1); - - if (data.cols == 3 && data.rows == 3) - { - Mat3 R; - data.copyTo(R); - rotation(R); - } - else if ((data.cols == 3 && data.rows == 1) || (data.cols == 1 && data.rows == 3)) - { - Vec3 _rvec; - data.reshape(1, 3).copyTo(_rvec); - rotation(_rvec); - } - else - CV_Error(Error::StsError, "Input matrix can only be 3x3, 1x3 or 3x1"); -} - -template inline -void cv::Affine3::linear(const Mat3& L) -{ - matrix.val[0] = L.val[0]; matrix.val[1] = L.val[1]; matrix.val[ 2] = L.val[2]; - matrix.val[4] = L.val[3]; matrix.val[5] = L.val[4]; matrix.val[ 6] = L.val[5]; - matrix.val[8] = L.val[6]; matrix.val[9] = L.val[7]; matrix.val[10] = L.val[8]; -} - -template inline -void cv::Affine3::translation(const Vec3& t) -{ - matrix.val[3] = t[0]; matrix.val[7] = t[1]; matrix.val[11] = t[2]; -} - -template inline -typename cv::Affine3::Mat3 cv::Affine3::rotation() const -{ - return linear(); -} - -template inline -typename cv::Affine3::Mat3 cv::Affine3::linear() const -{ - typename cv::Affine3::Mat3 R; - R.val[0] = matrix.val[0]; R.val[1] = matrix.val[1]; R.val[2] = matrix.val[ 2]; - R.val[3] = matrix.val[4]; R.val[4] = matrix.val[5]; R.val[5] = matrix.val[ 6]; - R.val[6] = matrix.val[8]; R.val[7] = matrix.val[9]; R.val[8] = matrix.val[10]; - return R; -} - -template inline -typename cv::Affine3::Vec3 cv::Affine3::translation() const -{ - return Vec3(matrix.val[3], matrix.val[7], matrix.val[11]); -} - -template inline -typename cv::Affine3::Vec3 cv::Affine3::rvec() const -{ - cv::Vec3d w; - cv::Matx33d u, vt, R = rotation(); - cv::SVD::compute(R, w, u, vt, cv::SVD::FULL_UV + cv::SVD::MODIFY_A); - R = u * vt; - - double rx = R.val[7] - R.val[5]; - double ry = R.val[2] - R.val[6]; - double rz = R.val[3] - R.val[1]; - - double s = std::sqrt((rx*rx + ry*ry + rz*rz)*0.25); - double c = (R.val[0] + R.val[4] + R.val[8] - 1) * 0.5; - c = c > 1.0 ? 1.0 : c < -1.0 ? -1.0 : c; - double theta = acos(c); - - if( s < 1e-5 ) - { - if( c > 0 ) - rx = ry = rz = 0; - else - { - double t; - t = (R.val[0] + 1) * 0.5; - rx = std::sqrt(std::max(t, 0.0)); - t = (R.val[4] + 1) * 0.5; - ry = std::sqrt(std::max(t, 0.0)) * (R.val[1] < 0 ? -1.0 : 1.0); - t = (R.val[8] + 1) * 0.5; - rz = std::sqrt(std::max(t, 0.0)) * (R.val[2] < 0 ? -1.0 : 1.0); - - if( fabs(rx) < fabs(ry) && fabs(rx) < fabs(rz) && (R.val[5] > 0) != (ry*rz > 0) ) - rz = -rz; - theta /= std::sqrt(rx*rx + ry*ry + rz*rz); - rx *= theta; - ry *= theta; - rz *= theta; - } - } - else - { - double vth = 1/(2*s); - vth *= theta; - rx *= vth; ry *= vth; rz *= vth; - } - - return cv::Vec3d(rx, ry, rz); -} - -template inline -cv::Affine3 cv::Affine3::inv(int method) const -{ - return matrix.inv(method); -} - -template inline -cv::Affine3 cv::Affine3::rotate(const Mat3& R) const -{ - Mat3 Lc = linear(); - Vec3 tc = translation(); - Mat4 result; - result.val[12] = result.val[13] = result.val[14] = 0; - result.val[15] = 1; - - for(int j = 0; j < 3; ++j) - { - for(int i = 0; i < 3; ++i) - { - float_type value = 0; - for(int k = 0; k < 3; ++k) - value += R(j, k) * Lc(k, i); - result(j, i) = value; - } - - result(j, 3) = R.row(j).dot(tc.t()); - } - return result; -} - -template inline -cv::Affine3 cv::Affine3::rotate(const Vec3& _rvec) const -{ - return rotate(Affine3f(_rvec).rotation()); -} - -template inline -cv::Affine3 cv::Affine3::translate(const Vec3& t) const -{ - Mat4 m = matrix; - m.val[ 3] += t[0]; - m.val[ 7] += t[1]; - m.val[11] += t[2]; - return m; -} - -template inline -cv::Affine3 cv::Affine3::concatenate(const Affine3& affine) const -{ - return (*this).rotate(affine.rotation()).translate(affine.translation()); -} - -template template inline -cv::Affine3::operator Affine3() const -{ - return Affine3(matrix); -} - -template template inline -cv::Affine3 cv::Affine3::cast() const -{ - return Affine3(matrix); -} - -template inline -cv::Affine3 cv::operator*(const cv::Affine3& affine1, const cv::Affine3& affine2) -{ - return affine2.concatenate(affine1); -} - -template inline -V cv::operator*(const cv::Affine3& affine, const V& v) -{ - const typename Affine3::Mat4& m = affine.matrix; - - V r; - r.x = m.val[0] * v.x + m.val[1] * v.y + m.val[ 2] * v.z + m.val[ 3]; - r.y = m.val[4] * v.x + m.val[5] * v.y + m.val[ 6] * v.z + m.val[ 7]; - r.z = m.val[8] * v.x + m.val[9] * v.y + m.val[10] * v.z + m.val[11]; - return r; -} - -static inline -cv::Vec3f cv::operator*(const cv::Affine3f& affine, const cv::Vec3f& v) -{ - const cv::Matx44f& m = affine.matrix; - cv::Vec3f r; - r.val[0] = m.val[0] * v[0] + m.val[1] * v[1] + m.val[ 2] * v[2] + m.val[ 3]; - r.val[1] = m.val[4] * v[0] + m.val[5] * v[1] + m.val[ 6] * v[2] + m.val[ 7]; - r.val[2] = m.val[8] * v[0] + m.val[9] * v[1] + m.val[10] * v[2] + m.val[11]; - return r; -} - -static inline -cv::Vec3d cv::operator*(const cv::Affine3d& affine, const cv::Vec3d& v) -{ - const cv::Matx44d& m = affine.matrix; - cv::Vec3d r; - r.val[0] = m.val[0] * v[0] + m.val[1] * v[1] + m.val[ 2] * v[2] + m.val[ 3]; - r.val[1] = m.val[4] * v[0] + m.val[5] * v[1] + m.val[ 6] * v[2] + m.val[ 7]; - r.val[2] = m.val[8] * v[0] + m.val[9] * v[1] + m.val[10] * v[2] + m.val[11]; - return r; -} - - - -#if defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H - -template inline -cv::Affine3::Affine3(const Eigen::Transform& affine) -{ - cv::Mat(4, 4, cv::traits::Type::value, affine.matrix().data()).copyTo(matrix); -} - -template inline -cv::Affine3::Affine3(const Eigen::Transform& affine) -{ - Eigen::Transform a = affine; - cv::Mat(4, 4, cv::traits::Type::value, a.matrix().data()).copyTo(matrix); -} - -template inline -cv::Affine3::operator Eigen::Transform() const -{ - Eigen::Transform r; - cv::Mat hdr(4, 4, cv::traits::Type::value, r.matrix().data()); - cv::Mat(matrix, false).copyTo(hdr); - return r; -} - -template inline -cv::Affine3::operator Eigen::Transform() const -{ - return this->operator Eigen::Transform(); -} - -#endif /* defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H */ - -//! @endcond - -#endif /* __cplusplus */ - -#endif /* OPENCV_CORE_AFFINE3_HPP */ diff --git a/opencv/include/opencv2/core/base.hpp b/opencv/include/opencv2/core/base.hpp deleted file mode 100644 index 31cd7a8..0000000 --- a/opencv/include/opencv2/core/base.hpp +++ /dev/null @@ -1,707 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2014, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_BASE_HPP -#define OPENCV_CORE_BASE_HPP - -#ifndef __cplusplus -# error base.hpp header must be compiled as C++ -#endif - -#include "opencv2/opencv_modules.hpp" - -#include -#include - -#include "opencv2/core/cvdef.h" -#include "opencv2/core/cvstd.hpp" - -namespace cv -{ - -//! @addtogroup core_utils -//! @{ - -namespace Error { -//! error codes -enum Code { - StsOk= 0, //!< everything is ok - StsBackTrace= -1, //!< pseudo error for back trace - StsError= -2, //!< unknown /unspecified error - StsInternal= -3, //!< internal error (bad state) - StsNoMem= -4, //!< insufficient memory - StsBadArg= -5, //!< function arg/param is bad - StsBadFunc= -6, //!< unsupported function - StsNoConv= -7, //!< iteration didn't converge - StsAutoTrace= -8, //!< tracing - HeaderIsNull= -9, //!< image header is NULL - BadImageSize= -10, //!< image size is invalid - BadOffset= -11, //!< offset is invalid - BadDataPtr= -12, //!< - BadStep= -13, //!< image step is wrong, this may happen for a non-continuous matrix. - BadModelOrChSeq= -14, //!< - BadNumChannels= -15, //!< bad number of channels, for example, some functions accept only single channel matrices. - BadNumChannel1U= -16, //!< - BadDepth= -17, //!< input image depth is not supported by the function - BadAlphaChannel= -18, //!< - BadOrder= -19, //!< number of dimensions is out of range - BadOrigin= -20, //!< incorrect input origin - BadAlign= -21, //!< incorrect input align - BadCallBack= -22, //!< - BadTileSize= -23, //!< - BadCOI= -24, //!< input COI is not supported - BadROISize= -25, //!< incorrect input roi - MaskIsTiled= -26, //!< - StsNullPtr= -27, //!< null pointer - StsVecLengthErr= -28, //!< incorrect vector length - StsFilterStructContentErr= -29, //!< incorrect filter structure content - StsKernelStructContentErr= -30, //!< incorrect transform kernel content - StsFilterOffsetErr= -31, //!< incorrect filter offset value - StsBadSize= -201, //!< the input/output structure size is incorrect - StsDivByZero= -202, //!< division by zero - StsInplaceNotSupported= -203, //!< in-place operation is not supported - StsObjectNotFound= -204, //!< request can't be completed - StsUnmatchedFormats= -205, //!< formats of input/output arrays differ - StsBadFlag= -206, //!< flag is wrong or not supported - StsBadPoint= -207, //!< bad CvPoint - StsBadMask= -208, //!< bad format of mask (neither 8uC1 nor 8sC1) - StsUnmatchedSizes= -209, //!< sizes of input/output structures do not match - StsUnsupportedFormat= -210, //!< the data format/type is not supported by the function - StsOutOfRange= -211, //!< some of parameters are out of range - StsParseError= -212, //!< invalid syntax/structure of the parsed file - StsNotImplemented= -213, //!< the requested function/feature is not implemented - StsBadMemBlock= -214, //!< an allocated block has been corrupted - StsAssert= -215, //!< assertion failed - GpuNotSupported= -216, //!< no CUDA support - GpuApiCallError= -217, //!< GPU API call error - OpenGlNotSupported= -218, //!< no OpenGL support - OpenGlApiCallError= -219, //!< OpenGL API call error - OpenCLApiCallError= -220, //!< OpenCL API call error - OpenCLDoubleNotSupported= -221, - OpenCLInitError= -222, //!< OpenCL initialization error - OpenCLNoAMDBlasFft= -223 -}; -} //Error - -//! @} core_utils - -//! @addtogroup core_array -//! @{ - -//! matrix decomposition types -enum DecompTypes { - /** Gaussian elimination with the optimal pivot element chosen. */ - DECOMP_LU = 0, - /** singular value decomposition (SVD) method; the system can be over-defined and/or the matrix - src1 can be singular */ - DECOMP_SVD = 1, - /** eigenvalue decomposition; the matrix src1 must be symmetrical */ - DECOMP_EIG = 2, - /** Cholesky \f$LL^T\f$ factorization; the matrix src1 must be symmetrical and positively - defined */ - DECOMP_CHOLESKY = 3, - /** QR factorization; the system can be over-defined and/or the matrix src1 can be singular */ - DECOMP_QR = 4, - /** while all the previous flags are mutually exclusive, this flag can be used together with - any of the previous; it means that the normal equations - \f$\texttt{src1}^T\cdot\texttt{src1}\cdot\texttt{dst}=\texttt{src1}^T\texttt{src2}\f$ are - solved instead of the original system - \f$\texttt{src1}\cdot\texttt{dst}=\texttt{src2}\f$ */ - DECOMP_NORMAL = 16 -}; - -/** norm types - -src1 and src2 denote input arrays. -*/ - -enum NormTypes { - /** - \f[ - norm = \forkthree - {\|\texttt{src1}\|_{L_{\infty}} = \max _I | \texttt{src1} (I)|}{if \(\texttt{normType} = \texttt{NORM_INF}\) } - {\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} = \max _I | \texttt{src1} (I) - \texttt{src2} (I)|}{if \(\texttt{normType} = \texttt{NORM_INF}\) } - {\frac{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} }{\|\texttt{src2}\|_{L_{\infty}} }}{if \(\texttt{normType} = \texttt{NORM_RELATIVE | NORM_INF}\) } - \f] - */ - NORM_INF = 1, - /** - \f[ - norm = \forkthree - {\| \texttt{src1} \| _{L_1} = \sum _I | \texttt{src1} (I)|}{if \(\texttt{normType} = \texttt{NORM_L1}\)} - { \| \texttt{src1} - \texttt{src2} \| _{L_1} = \sum _I | \texttt{src1} (I) - \texttt{src2} (I)|}{if \(\texttt{normType} = \texttt{NORM_L1}\) } - { \frac{\|\texttt{src1}-\texttt{src2}\|_{L_1} }{\|\texttt{src2}\|_{L_1}} }{if \(\texttt{normType} = \texttt{NORM_RELATIVE | NORM_L1}\) } - \f]*/ - NORM_L1 = 2, - /** - \f[ - norm = \forkthree - { \| \texttt{src1} \| _{L_2} = \sqrt{\sum_I \texttt{src1}(I)^2} }{if \(\texttt{normType} = \texttt{NORM_L2}\) } - { \| \texttt{src1} - \texttt{src2} \| _{L_2} = \sqrt{\sum_I (\texttt{src1}(I) - \texttt{src2}(I))^2} }{if \(\texttt{normType} = \texttt{NORM_L2}\) } - { \frac{\|\texttt{src1}-\texttt{src2}\|_{L_2} }{\|\texttt{src2}\|_{L_2}} }{if \(\texttt{normType} = \texttt{NORM_RELATIVE | NORM_L2}\) } - \f] - */ - NORM_L2 = 4, - /** - \f[ - norm = \forkthree - { \| \texttt{src1} \| _{L_2} ^{2} = \sum_I \texttt{src1}(I)^2} {if \(\texttt{normType} = \texttt{NORM_L2SQR}\)} - { \| \texttt{src1} - \texttt{src2} \| _{L_2} ^{2} = \sum_I (\texttt{src1}(I) - \texttt{src2}(I))^2 }{if \(\texttt{normType} = \texttt{NORM_L2SQR}\) } - { \left(\frac{\|\texttt{src1}-\texttt{src2}\|_{L_2} }{\|\texttt{src2}\|_{L_2}}\right)^2 }{if \(\texttt{normType} = \texttt{NORM_RELATIVE | NORM_L2}\) } - \f] - */ - NORM_L2SQR = 5, - /** - In the case of one input array, calculates the Hamming distance of the array from zero, - In the case of two input arrays, calculates the Hamming distance between the arrays. - */ - NORM_HAMMING = 6, - /** - Similar to NORM_HAMMING, but in the calculation, each two bits of the input sequence will - be added and treated as a single bit to be used in the same calculation as NORM_HAMMING. - */ - NORM_HAMMING2 = 7, - NORM_TYPE_MASK = 7, //!< bit-mask which can be used to separate norm type from norm flags - NORM_RELATIVE = 8, //!< flag - NORM_MINMAX = 32 //!< flag - }; - -//! comparison types -enum CmpTypes { CMP_EQ = 0, //!< src1 is equal to src2. - CMP_GT = 1, //!< src1 is greater than src2. - CMP_GE = 2, //!< src1 is greater than or equal to src2. - CMP_LT = 3, //!< src1 is less than src2. - CMP_LE = 4, //!< src1 is less than or equal to src2. - CMP_NE = 5 //!< src1 is unequal to src2. - }; - -//! generalized matrix multiplication flags -enum GemmFlags { GEMM_1_T = 1, //!< transposes src1 - GEMM_2_T = 2, //!< transposes src2 - GEMM_3_T = 4 //!< transposes src3 - }; - -enum DftFlags { - /** performs an inverse 1D or 2D transform instead of the default forward - transform. */ - DFT_INVERSE = 1, - /** scales the result: divide it by the number of array elements. Normally, it is - combined with DFT_INVERSE. */ - DFT_SCALE = 2, - /** performs a forward or inverse transform of every individual row of the input - matrix; this flag enables you to transform multiple vectors simultaneously and can be used to - decrease the overhead (which is sometimes several times larger than the processing itself) to - perform 3D and higher-dimensional transformations and so forth.*/ - DFT_ROWS = 4, - /** performs a forward transformation of 1D or 2D real array; the result, - though being a complex array, has complex-conjugate symmetry (*CCS*, see the function - description below for details), and such an array can be packed into a real array of the same - size as input, which is the fastest option and which is what the function does by default; - however, you may wish to get a full complex array (for simpler spectrum analysis, and so on) - - pass the flag to enable the function to produce a full-size complex output array. */ - DFT_COMPLEX_OUTPUT = 16, - /** performs an inverse transformation of a 1D or 2D complex array; the - result is normally a complex array of the same size, however, if the input array has - conjugate-complex symmetry (for example, it is a result of forward transformation with - DFT_COMPLEX_OUTPUT flag), the output is a real array; while the function itself does not - check whether the input is symmetrical or not, you can pass the flag and then the function - will assume the symmetry and produce the real output array (note that when the input is packed - into a real array and inverse transformation is executed, the function treats the input as a - packed complex-conjugate symmetrical array, and the output will also be a real array). */ - DFT_REAL_OUTPUT = 32, - /** specifies that input is complex input. If this flag is set, the input must have 2 channels. - On the other hand, for backwards compatibility reason, if input has 2 channels, input is - already considered complex. */ - DFT_COMPLEX_INPUT = 64, - /** performs an inverse 1D or 2D transform instead of the default forward transform. */ - DCT_INVERSE = DFT_INVERSE, - /** performs a forward or inverse transform of every individual row of the input - matrix. This flag enables you to transform multiple vectors simultaneously and can be used to - decrease the overhead (which is sometimes several times larger than the processing itself) to - perform 3D and higher-dimensional transforms and so forth.*/ - DCT_ROWS = DFT_ROWS -}; - -//! Various border types, image boundaries are denoted with `|` -//! @see borderInterpolate, copyMakeBorder -enum BorderTypes { - BORDER_CONSTANT = 0, //!< `iiiiii|abcdefgh|iiiiiii` with some specified `i` - BORDER_REPLICATE = 1, //!< `aaaaaa|abcdefgh|hhhhhhh` - BORDER_REFLECT = 2, //!< `fedcba|abcdefgh|hgfedcb` - BORDER_WRAP = 3, //!< `cdefgh|abcdefgh|abcdefg` - BORDER_REFLECT_101 = 4, //!< `gfedcb|abcdefgh|gfedcba` - BORDER_TRANSPARENT = 5, //!< `uvwxyz|abcdefgh|ijklmno` - - BORDER_REFLECT101 = BORDER_REFLECT_101, //!< same as BORDER_REFLECT_101 - BORDER_DEFAULT = BORDER_REFLECT_101, //!< same as BORDER_REFLECT_101 - BORDER_ISOLATED = 16 //!< do not look outside of ROI -}; - -//! @} core_array - -//! @addtogroup core_utils -//! @{ - -/*! @brief Signals an error and raises the exception. - -By default the function prints information about the error to stderr, -then it either stops if setBreakOnError() had been called before or raises the exception. -It is possible to alternate error processing by using redirectError(). -@param _code - error code (Error::Code) -@param _err - error description -@param _func - function name. Available only when the compiler supports getting it -@param _file - source file name where the error has occurred -@param _line - line number in the source file where the error has occurred -@see CV_Error, CV_Error_, CV_Assert, CV_DbgAssert - */ -CV_EXPORTS void error(int _code, const String& _err, const char* _func, const char* _file, int _line); - -#ifdef __GNUC__ -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Winvalid-noreturn" -# endif -#endif - -/** same as cv::error, but does not return */ -CV_INLINE CV_NORETURN void errorNoReturn(int _code, const String& _err, const char* _func, const char* _file, int _line) -{ - error(_code, _err, _func, _file, _line); -#ifdef __GNUC__ -# if !defined __clang__ && !defined __APPLE__ - // this suppresses this warning: "noreturn" function does return [enabled by default] - __builtin_trap(); - // or use infinite loop: for (;;) {} -# endif -#endif -} -#ifdef __GNUC__ -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic pop -# endif -#endif - -#ifdef CV_STATIC_ANALYSIS - -// In practice, some macro are not processed correctly (noreturn is not detected). -// We need to use simplified definition for them. -#define CV_Error(...) do { abort(); } while (0) -#define CV_Error_( code, args ) do { cv::format args; abort(); } while (0) -#define CV_Assert( expr ) do { if (!(expr)) abort(); } while (0) -#define CV_ErrorNoReturn CV_Error -#define CV_ErrorNoReturn_ CV_Error_ - -#else // CV_STATIC_ANALYSIS - -/** @brief Call the error handler. - -Currently, the error handler prints the error code and the error message to the standard -error stream `stderr`. In the Debug configuration, it then provokes memory access violation, so that -the execution stack and all the parameters can be analyzed by the debugger. In the Release -configuration, the exception is thrown. - -@param code one of Error::Code -@param msg error message -*/ -#define CV_Error( code, msg ) cv::error( code, msg, CV_Func, __FILE__, __LINE__ ) - -/** @brief Call the error handler. - -This macro can be used to construct an error message on-fly to include some dynamic information, -for example: -@code - // note the extra parentheses around the formatted text message - CV_Error_(Error::StsOutOfRange, - ("the value at (%d, %d)=%g is out of range", badPt.x, badPt.y, badValue)); -@endcode -@param code one of Error::Code -@param args printf-like formatted error message in parentheses -*/ -#define CV_Error_( code, args ) cv::error( code, cv::format args, CV_Func, __FILE__, __LINE__ ) - -/** @brief Checks a condition at runtime and throws exception if it fails - -The macros CV_Assert (and CV_DbgAssert(expr)) evaluate the specified expression. If it is 0, the macros -raise an error (see cv::error). The macro CV_Assert checks the condition in both Debug and Release -configurations while CV_DbgAssert is only retained in the Debug configuration. -*/ -#define CV_Assert( expr ) do { if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0) - -//! @cond IGNORED -#define CV__ErrorNoReturn( code, msg ) cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ ) -#define CV__ErrorNoReturn_( code, args ) cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ ) -#ifdef __OPENCV_BUILD -#undef CV_Error -#define CV_Error CV__ErrorNoReturn -#undef CV_Error_ -#define CV_Error_ CV__ErrorNoReturn_ -#undef CV_Assert -#define CV_Assert( expr ) do { if(!!(expr)) ; else cv::errorNoReturn( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0) -#else -// backward compatibility -#define CV_ErrorNoReturn CV__ErrorNoReturn -#define CV_ErrorNoReturn_ CV__ErrorNoReturn_ -#endif -//! @endcond - -#endif // CV_STATIC_ANALYSIS - -//! @cond IGNORED - -#if defined OPENCV_FORCE_MULTIARG_ASSERT_CHECK && defined CV_STATIC_ANALYSIS -#warning "OPENCV_FORCE_MULTIARG_ASSERT_CHECK can't be used with CV_STATIC_ANALYSIS" -#undef OPENCV_FORCE_MULTIARG_ASSERT_CHECK -#endif - -#ifdef OPENCV_FORCE_MULTIARG_ASSERT_CHECK -#define CV_Assert_1( expr ) do { if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0) -#else -#define CV_Assert_1 CV_Assert -#endif -#define CV_Assert_2( expr1, expr2 ) CV_Assert_1(expr1); CV_Assert_1(expr2) -#define CV_Assert_3( expr1, expr2, expr3 ) CV_Assert_2(expr1, expr2); CV_Assert_1(expr3) -#define CV_Assert_4( expr1, expr2, expr3, expr4 ) CV_Assert_3(expr1, expr2, expr3); CV_Assert_1(expr4) -#define CV_Assert_5( expr1, expr2, expr3, expr4, expr5 ) CV_Assert_4(expr1, expr2, expr3, expr4); CV_Assert_1(expr5) -#define CV_Assert_6( expr1, expr2, expr3, expr4, expr5, expr6 ) CV_Assert_5(expr1, expr2, expr3, expr4, expr5); CV_Assert_1(expr6) -#define CV_Assert_7( expr1, expr2, expr3, expr4, expr5, expr6, expr7 ) CV_Assert_6(expr1, expr2, expr3, expr4, expr5, expr6 ); CV_Assert_1(expr7) -#define CV_Assert_8( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8 ) CV_Assert_7(expr1, expr2, expr3, expr4, expr5, expr6, expr7 ); CV_Assert_1(expr8) -#define CV_Assert_9( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ) CV_Assert_8(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8 ); CV_Assert_1(expr9) -#define CV_Assert_10( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9, expr10 ) CV_Assert_9(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ); CV_Assert_1(expr10) - -#define CV_Assert_N(...) do { __CV_CAT(CV_Assert_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__); } while(0) - -#ifdef OPENCV_FORCE_MULTIARG_ASSERT_CHECK -#undef CV_Assert -#define CV_Assert CV_Assert_N -#endif -//! @endcond - -#if defined _DEBUG || defined CV_STATIC_ANALYSIS -# define CV_DbgAssert(expr) CV_Assert(expr) -#else -/** replaced with CV_Assert(expr) in Debug configuration */ -# define CV_DbgAssert(expr) -#endif - -/* - * Hamming distance functor - counts the bit differences between two strings - useful for the Brief descriptor - * bit count of A exclusive XOR'ed with B - */ -struct CV_EXPORTS Hamming -{ - enum { normType = NORM_HAMMING }; - typedef unsigned char ValueType; - typedef int ResultType; - - /** this will count the bits in a ^ b - */ - ResultType operator()( const unsigned char* a, const unsigned char* b, int size ) const; -}; - -typedef Hamming HammingLUT; - -/////////////////////////////////// inline norms //////////////////////////////////// - -template inline _Tp cv_abs(_Tp x) { return std::abs(x); } -inline int cv_abs(uchar x) { return x; } -inline int cv_abs(schar x) { return std::abs(x); } -inline int cv_abs(ushort x) { return x; } -inline int cv_abs(short x) { return std::abs(x); } - -template static inline -_AccTp normL2Sqr(const _Tp* a, int n) -{ - _AccTp s = 0; - int i=0; -#if CV_ENABLE_UNROLLED - for( ; i <= n - 4; i += 4 ) - { - _AccTp v0 = a[i], v1 = a[i+1], v2 = a[i+2], v3 = a[i+3]; - s += v0*v0 + v1*v1 + v2*v2 + v3*v3; - } -#endif - for( ; i < n; i++ ) - { - _AccTp v = a[i]; - s += v*v; - } - return s; -} - -template static inline -_AccTp normL1(const _Tp* a, int n) -{ - _AccTp s = 0; - int i = 0; -#if CV_ENABLE_UNROLLED - for(; i <= n - 4; i += 4 ) - { - s += (_AccTp)cv_abs(a[i]) + (_AccTp)cv_abs(a[i+1]) + - (_AccTp)cv_abs(a[i+2]) + (_AccTp)cv_abs(a[i+3]); - } -#endif - for( ; i < n; i++ ) - s += cv_abs(a[i]); - return s; -} - -template static inline -_AccTp normInf(const _Tp* a, int n) -{ - _AccTp s = 0; - for( int i = 0; i < n; i++ ) - s = std::max(s, (_AccTp)cv_abs(a[i])); - return s; -} - -template static inline -_AccTp normL2Sqr(const _Tp* a, const _Tp* b, int n) -{ - _AccTp s = 0; - int i= 0; -#if CV_ENABLE_UNROLLED - for(; i <= n - 4; i += 4 ) - { - _AccTp v0 = _AccTp(a[i] - b[i]), v1 = _AccTp(a[i+1] - b[i+1]), v2 = _AccTp(a[i+2] - b[i+2]), v3 = _AccTp(a[i+3] - b[i+3]); - s += v0*v0 + v1*v1 + v2*v2 + v3*v3; - } -#endif - for( ; i < n; i++ ) - { - _AccTp v = _AccTp(a[i] - b[i]); - s += v*v; - } - return s; -} - -static inline float normL2Sqr(const float* a, const float* b, int n) -{ - float s = 0.f; - for( int i = 0; i < n; i++ ) - { - float v = a[i] - b[i]; - s += v*v; - } - return s; -} - -template static inline -_AccTp normL1(const _Tp* a, const _Tp* b, int n) -{ - _AccTp s = 0; - int i= 0; -#if CV_ENABLE_UNROLLED - for(; i <= n - 4; i += 4 ) - { - _AccTp v0 = _AccTp(a[i] - b[i]), v1 = _AccTp(a[i+1] - b[i+1]), v2 = _AccTp(a[i+2] - b[i+2]), v3 = _AccTp(a[i+3] - b[i+3]); - s += std::abs(v0) + std::abs(v1) + std::abs(v2) + std::abs(v3); - } -#endif - for( ; i < n; i++ ) - { - _AccTp v = _AccTp(a[i] - b[i]); - s += std::abs(v); - } - return s; -} - -inline float normL1(const float* a, const float* b, int n) -{ - float s = 0.f; - for( int i = 0; i < n; i++ ) - { - s += std::abs(a[i] - b[i]); - } - return s; -} - -inline int normL1(const uchar* a, const uchar* b, int n) -{ - int s = 0; - for( int i = 0; i < n; i++ ) - { - s += std::abs(a[i] - b[i]); - } - return s; -} - -template static inline -_AccTp normInf(const _Tp* a, const _Tp* b, int n) -{ - _AccTp s = 0; - for( int i = 0; i < n; i++ ) - { - _AccTp v0 = a[i] - b[i]; - s = std::max(s, std::abs(v0)); - } - return s; -} - -/** @brief Computes the cube root of an argument. - - The function cubeRoot computes \f$\sqrt[3]{\texttt{val}}\f$. Negative arguments are handled correctly. - NaN and Inf are not handled. The accuracy approaches the maximum possible accuracy for - single-precision data. - @param val A function argument. - */ -CV_EXPORTS_W float cubeRoot(float val); - -/** @brief Calculates the angle of a 2D vector in degrees. - - The function fastAtan2 calculates the full-range angle of an input 2D vector. The angle is measured - in degrees and varies from 0 to 360 degrees. The accuracy is about 0.3 degrees. - @param x x-coordinate of the vector. - @param y y-coordinate of the vector. - */ -CV_EXPORTS_W float fastAtan2(float y, float x); - -/** proxy for hal::LU */ -CV_EXPORTS int LU(float* A, size_t astep, int m, float* b, size_t bstep, int n); -/** proxy for hal::LU */ -CV_EXPORTS int LU(double* A, size_t astep, int m, double* b, size_t bstep, int n); -/** proxy for hal::Cholesky */ -CV_EXPORTS bool Cholesky(float* A, size_t astep, int m, float* b, size_t bstep, int n); -/** proxy for hal::Cholesky */ -CV_EXPORTS bool Cholesky(double* A, size_t astep, int m, double* b, size_t bstep, int n); - -////////////////// forward declarations for important OpenCV types ////////////////// - -//! @cond IGNORED - -template class Vec; -template class Matx; - -template class Complex; -template class Point_; -template class Point3_; -template class Size_; -template class Rect_; -template class Scalar_; - -class CV_EXPORTS RotatedRect; -class CV_EXPORTS Range; -class CV_EXPORTS TermCriteria; -class CV_EXPORTS KeyPoint; -class CV_EXPORTS DMatch; -class CV_EXPORTS RNG; - -class CV_EXPORTS Mat; -class CV_EXPORTS MatExpr; - -class CV_EXPORTS UMat; - -class CV_EXPORTS SparseMat; -typedef Mat MatND; - -template class Mat_; -template class SparseMat_; - -class CV_EXPORTS MatConstIterator; -class CV_EXPORTS SparseMatIterator; -class CV_EXPORTS SparseMatConstIterator; -template class MatIterator_; -template class MatConstIterator_; -template class SparseMatIterator_; -template class SparseMatConstIterator_; - -namespace ogl -{ - class CV_EXPORTS Buffer; - class CV_EXPORTS Texture2D; - class CV_EXPORTS Arrays; -} - -namespace cuda -{ - class CV_EXPORTS GpuMat; - class CV_EXPORTS HostMem; - class CV_EXPORTS Stream; - class CV_EXPORTS Event; -} - -namespace cudev -{ - template class GpuMat_; -} - -namespace ipp -{ -#if OPENCV_ABI_COMPATIBILITY > 300 -CV_EXPORTS unsigned long long getIppFeatures(); -#else -CV_EXPORTS int getIppFeatures(); -#endif -CV_EXPORTS void setIppStatus(int status, const char * const funcname = NULL, const char * const filename = NULL, - int line = 0); -CV_EXPORTS int getIppStatus(); -CV_EXPORTS String getIppErrorLocation(); -CV_EXPORTS_W bool useIPP(); -CV_EXPORTS_W void setUseIPP(bool flag); -CV_EXPORTS_W String getIppVersion(); - -// IPP Not-Exact mode. This function may force use of IPP then both IPP and OpenCV provide proper results -// but have internal accuracy differences which have too much direct or indirect impact on accuracy tests. -CV_EXPORTS_W bool useIPP_NotExact(); -CV_EXPORTS_W void setUseIPP_NotExact(bool flag); -#if OPENCV_ABI_COMPATIBILITY < 400 -CV_EXPORTS_W bool useIPP_NE(); -CV_EXPORTS_W void setUseIPP_NE(bool flag); -#endif - -} // ipp - -//! @endcond - -//! @} core_utils - - - - -} // cv - -#include "opencv2/core/neon_utils.hpp" -#include "opencv2/core/vsx_utils.hpp" -#include "opencv2/core/check.hpp" - -#endif //OPENCV_CORE_BASE_HPP diff --git a/opencv/include/opencv2/core/bindings_utils.hpp b/opencv/include/opencv2/core/bindings_utils.hpp deleted file mode 100644 index c1123f2..0000000 --- a/opencv/include/opencv2/core/bindings_utils.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -#ifndef OPENCV_CORE_BINDINGS_UTILS_HPP -#define OPENCV_CORE_BINDINGS_UTILS_HPP - -namespace cv { namespace utils { -//! @addtogroup core_utils -//! @{ - -CV_EXPORTS_W String dumpInputArray(InputArray argument); - -CV_EXPORTS_W String dumpInputArrayOfArrays(InputArrayOfArrays argument); - -CV_EXPORTS_W String dumpInputOutputArray(InputOutputArray argument); - -CV_EXPORTS_W String dumpInputOutputArrayOfArrays(InputOutputArrayOfArrays argument); - -//! @} -}} // namespace - -#endif // OPENCV_CORE_BINDINGS_UTILS_HPP diff --git a/opencv/include/opencv2/core/bufferpool.hpp b/opencv/include/opencv2/core/bufferpool.hpp deleted file mode 100644 index 4698e5d..0000000 --- a/opencv/include/opencv2/core/bufferpool.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. -// -// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved. - -#ifndef OPENCV_CORE_BUFFER_POOL_HPP -#define OPENCV_CORE_BUFFER_POOL_HPP - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4265) -#endif - -namespace cv -{ - -//! @addtogroup core -//! @{ - -class BufferPoolController -{ -protected: - ~BufferPoolController() { } -public: - virtual size_t getReservedSize() const = 0; - virtual size_t getMaxReservedSize() const = 0; - virtual void setMaxReservedSize(size_t size) = 0; - virtual void freeAllReservedBuffers() = 0; -}; - -//! @} - -} - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -#endif // OPENCV_CORE_BUFFER_POOL_HPP diff --git a/opencv/include/opencv2/core/check.hpp b/opencv/include/opencv2/core/check.hpp deleted file mode 100644 index bf44138..0000000 --- a/opencv/include/opencv2/core/check.hpp +++ /dev/null @@ -1,157 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -#ifndef OPENCV_CORE_CHECK_HPP -#define OPENCV_CORE_CHECK_HPP - -#include - -namespace cv { - -/** Returns string of cv::Mat depth value: CV_8U -> "CV_8U" or "" */ -CV_EXPORTS const char* depthToString(int depth); - -/** Returns string of cv::Mat depth value: CV_8UC3 -> "CV_8UC3" or "" */ -CV_EXPORTS const String typeToString(int type); - - -//! @cond IGNORED -namespace detail { - -/** Returns string of cv::Mat depth value: CV_8U -> "CV_8U" or NULL */ -CV_EXPORTS const char* depthToString_(int depth); - -/** Returns string of cv::Mat depth value: CV_8UC3 -> "CV_8UC3" or cv::String() */ -CV_EXPORTS const cv::String typeToString_(int type); - -enum TestOp { - TEST_CUSTOM = 0, - TEST_EQ = 1, - TEST_NE = 2, - TEST_LE = 3, - TEST_LT = 4, - TEST_GE = 5, - TEST_GT = 6, - CV__LAST_TEST_OP -}; - -struct CheckContext { - const char* func; - const char* file; - int line; - enum TestOp testOp; - const char* message; - const char* p1_str; - const char* p2_str; -}; - -#ifndef CV__CHECK_FILENAME -# define CV__CHECK_FILENAME __FILE__ -#endif - -#ifndef CV__CHECK_FUNCTION -# if defined _MSC_VER -# define CV__CHECK_FUNCTION __FUNCSIG__ -# elif defined __GNUC__ -# define CV__CHECK_FUNCTION __PRETTY_FUNCTION__ -# else -# define CV__CHECK_FUNCTION "" -# endif -#endif - -#define CV__CHECK_LOCATION_VARNAME(id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_check_, id), __LINE__) -#define CV__DEFINE_CHECK_CONTEXT(id, message, testOp, p1_str, p2_str) \ - static const cv::detail::CheckContext CV__CHECK_LOCATION_VARNAME(id) = \ - { CV__CHECK_FUNCTION, CV__CHECK_FILENAME, __LINE__, testOp, message, p1_str, p2_str } - -CV_EXPORTS void CV_NORETURN check_failed_auto(const int v1, const int v2, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_auto(const size_t v1, const size_t v2, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_auto(const float v1, const float v2, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_auto(const double v1, const double v2, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_MatDepth(const int v1, const int v2, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_MatType(const int v1, const int v2, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_MatChannels(const int v1, const int v2, const CheckContext& ctx); - -CV_EXPORTS void CV_NORETURN check_failed_auto(const int v, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_auto(const size_t v, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_auto(const float v, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_auto(const double v, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_MatDepth(const int v, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_MatType(const int v, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_MatChannels(const int v, const CheckContext& ctx); - - -#define CV__TEST_EQ(v1, v2) ((v1) == (v2)) -#define CV__TEST_NE(v1, v2) ((v1) != (v2)) -#define CV__TEST_LE(v1, v2) ((v1) <= (v2)) -#define CV__TEST_LT(v1, v2) ((v1) < (v2)) -#define CV__TEST_GE(v1, v2) ((v1) >= (v2)) -#define CV__TEST_GT(v1, v2) ((v1) > (v2)) - -#define CV__CHECK(id, op, type, v1, v2, v1_str, v2_str, msg_str) do { \ - if(CV__TEST_##op((v1), (v2))) ; else { \ - CV__DEFINE_CHECK_CONTEXT(id, msg_str, cv::detail::TEST_ ## op, v1_str, v2_str); \ - cv::detail::check_failed_ ## type((v1), (v2), CV__CHECK_LOCATION_VARNAME(id)); \ - } \ -} while (0) - -#define CV__CHECK_CUSTOM_TEST(id, type, v, test_expr, v_str, test_expr_str, msg_str) do { \ - if(!!(test_expr)) ; else { \ - CV__DEFINE_CHECK_CONTEXT(id, msg_str, cv::detail::TEST_CUSTOM, v_str, test_expr_str); \ - cv::detail::check_failed_ ## type((v), CV__CHECK_LOCATION_VARNAME(id)); \ - } \ -} while (0) - -} // namespace -//! @endcond - - -/// Supported values of these types: int, float, double -#define CV_CheckEQ(v1, v2, msg) CV__CHECK(_, EQ, auto, v1, v2, #v1, #v2, msg) -#define CV_CheckNE(v1, v2, msg) CV__CHECK(_, NE, auto, v1, v2, #v1, #v2, msg) -#define CV_CheckLE(v1, v2, msg) CV__CHECK(_, LE, auto, v1, v2, #v1, #v2, msg) -#define CV_CheckLT(v1, v2, msg) CV__CHECK(_, LT, auto, v1, v2, #v1, #v2, msg) -#define CV_CheckGE(v1, v2, msg) CV__CHECK(_, GE, auto, v1, v2, #v1, #v2, msg) -#define CV_CheckGT(v1, v2, msg) CV__CHECK(_, GT, auto, v1, v2, #v1, #v2, msg) - -/// Check with additional "decoding" of type values in error message -#define CV_CheckTypeEQ(t1, t2, msg) CV__CHECK(_, EQ, MatType, t1, t2, #t1, #t2, msg) -/// Check with additional "decoding" of depth values in error message -#define CV_CheckDepthEQ(d1, d2, msg) CV__CHECK(_, EQ, MatDepth, d1, d2, #d1, #d2, msg) - -#define CV_CheckChannelsEQ(c1, c2, msg) CV__CHECK(_, EQ, MatChannels, c1, c2, #c1, #c2, msg) - -/// Example: type == CV_8UC1 || type == CV_8UC3 -#define CV_CheckType(t, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, MatType, t, (test_expr), #t, #test_expr, msg) - -/// Example: depth == CV_32F || depth == CV_64F -#define CV_CheckDepth(t, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, MatDepth, t, (test_expr), #t, #test_expr, msg) - -/// Example: v == A || v == B -#define CV_Check(v, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, auto, v, (test_expr), #v, #test_expr, msg) - -/// Some complex conditions: CV_Check(src2, src2.empty() || (src2.type() == src1.type() && src2.size() == src1.size()), "src2 should have same size/type as src1") -// TODO define pretty-printers - -#ifndef NDEBUG -#define CV_DbgCheck(v, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, auto, v, (test_expr), #v, #test_expr, msg) -#define CV_DbgCheckEQ(v1, v2, msg) CV__CHECK(_, EQ, auto, v1, v2, #v1, #v2, msg) -#define CV_DbgCheckNE(v1, v2, msg) CV__CHECK(_, NE, auto, v1, v2, #v1, #v2, msg) -#define CV_DbgCheckLE(v1, v2, msg) CV__CHECK(_, LE, auto, v1, v2, #v1, #v2, msg) -#define CV_DbgCheckLT(v1, v2, msg) CV__CHECK(_, LT, auto, v1, v2, #v1, #v2, msg) -#define CV_DbgCheckGE(v1, v2, msg) CV__CHECK(_, GE, auto, v1, v2, #v1, #v2, msg) -#define CV_DbgCheckGT(v1, v2, msg) CV__CHECK(_, GT, auto, v1, v2, #v1, #v2, msg) -#else -#define CV_DbgCheck(v, test_expr, msg) do { } while (0) -#define CV_DbgCheckEQ(v1, v2, msg) do { } while (0) -#define CV_DbgCheckNE(v1, v2, msg) do { } while (0) -#define CV_DbgCheckLE(v1, v2, msg) do { } while (0) -#define CV_DbgCheckLT(v1, v2, msg) do { } while (0) -#define CV_DbgCheckGE(v1, v2, msg) do { } while (0) -#define CV_DbgCheckGT(v1, v2, msg) do { } while (0) -#endif - -} // namespace - -#endif // OPENCV_CORE_CHECK_HPP diff --git a/opencv/include/opencv2/core/core.hpp b/opencv/include/opencv2/core/core.hpp deleted file mode 100644 index 4389183..0000000 --- a/opencv/include/opencv2/core/core.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/core.hpp" diff --git a/opencv/include/opencv2/core/core_c.h b/opencv/include/opencv2/core/core_c.h deleted file mode 100644 index e5fe516..0000000 --- a/opencv/include/opencv2/core/core_c.h +++ /dev/null @@ -1,3175 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - - -#ifndef OPENCV_CORE_C_H -#define OPENCV_CORE_C_H - -#include "opencv2/core/types_c.h" - -#ifdef __cplusplus -# ifdef _MSC_VER -/* disable warning C4190: 'function' has C-linkage specified, but returns UDT 'typename' - which is incompatible with C - - It is OK to disable it because we only extend few plain structures with - C++ construrtors for simpler interoperability with C++ API of the library -*/ -# pragma warning(disable:4190) -# elif defined __clang__ && __clang_major__ >= 3 -# pragma GCC diagnostic ignored "-Wreturn-type-c-linkage" -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup core_c - @{ -*/ - -/****************************************************************************************\ -* Array allocation, deallocation, initialization and access to elements * -\****************************************************************************************/ - -/** `malloc` wrapper. - If there is no enough memory, the function - (as well as other OpenCV functions that call cvAlloc) - raises an error. */ -CVAPI(void*) cvAlloc( size_t size ); - -/** `free` wrapper. - Here and further all the memory releasing functions - (that all call cvFree) take double pointer in order to - to clear pointer to the data after releasing it. - Passing pointer to NULL pointer is Ok: nothing happens in this case -*/ -CVAPI(void) cvFree_( void* ptr ); -#define cvFree(ptr) (cvFree_(*(ptr)), *(ptr)=0) - -/** @brief Creates an image header but does not allocate the image data. - -@param size Image width and height -@param depth Image depth (see cvCreateImage ) -@param channels Number of channels (see cvCreateImage ) - */ -CVAPI(IplImage*) cvCreateImageHeader( CvSize size, int depth, int channels ); - -/** @brief Initializes an image header that was previously allocated. - -The returned IplImage\* points to the initialized header. -@param image Image header to initialize -@param size Image width and height -@param depth Image depth (see cvCreateImage ) -@param channels Number of channels (see cvCreateImage ) -@param origin Top-left IPL_ORIGIN_TL or bottom-left IPL_ORIGIN_BL -@param align Alignment for image rows, typically 4 or 8 bytes - */ -CVAPI(IplImage*) cvInitImageHeader( IplImage* image, CvSize size, int depth, - int channels, int origin CV_DEFAULT(0), - int align CV_DEFAULT(4)); - -/** @brief Creates an image header and allocates the image data. - -This function call is equivalent to the following code: -@code - header = cvCreateImageHeader(size, depth, channels); - cvCreateData(header); -@endcode -@param size Image width and height -@param depth Bit depth of image elements. See IplImage for valid depths. -@param channels Number of channels per pixel. See IplImage for details. This function only creates -images with interleaved channels. - */ -CVAPI(IplImage*) cvCreateImage( CvSize size, int depth, int channels ); - -/** @brief Deallocates an image header. - -This call is an analogue of : -@code - if(image ) - { - iplDeallocate(*image, IPL_IMAGE_HEADER | IPL_IMAGE_ROI); - *image = 0; - } -@endcode -but it does not use IPL functions by default (see the CV_TURN_ON_IPL_COMPATIBILITY macro). -@param image Double pointer to the image header - */ -CVAPI(void) cvReleaseImageHeader( IplImage** image ); - -/** @brief Deallocates the image header and the image data. - -This call is a shortened form of : -@code - if(*image ) - { - cvReleaseData(*image); - cvReleaseImageHeader(image); - } -@endcode -@param image Double pointer to the image header -*/ -CVAPI(void) cvReleaseImage( IplImage** image ); - -/** Creates a copy of IPL image (widthStep may differ) */ -CVAPI(IplImage*) cvCloneImage( const IplImage* image ); - -/** @brief Sets the channel of interest in an IplImage. - -If the ROI is set to NULL and the coi is *not* 0, the ROI is allocated. Most OpenCV functions do -*not* support the COI setting, so to process an individual image/matrix channel one may copy (via -cvCopy or cvSplit) the channel to a separate image/matrix, process it and then copy the result -back (via cvCopy or cvMerge) if needed. -@param image A pointer to the image header -@param coi The channel of interest. 0 - all channels are selected, 1 - first channel is selected, -etc. Note that the channel indices become 1-based. - */ -CVAPI(void) cvSetImageCOI( IplImage* image, int coi ); - -/** @brief Returns the index of the channel of interest. - -Returns the channel of interest of in an IplImage. Returned values correspond to the coi in -cvSetImageCOI. -@param image A pointer to the image header - */ -CVAPI(int) cvGetImageCOI( const IplImage* image ); - -/** @brief Sets an image Region Of Interest (ROI) for a given rectangle. - -If the original image ROI was NULL and the rect is not the whole image, the ROI structure is -allocated. - -Most OpenCV functions support the use of ROI and treat the image rectangle as a separate image. For -example, all of the pixel coordinates are counted from the top-left (or bottom-left) corner of the -ROI, not the original image. -@param image A pointer to the image header -@param rect The ROI rectangle - */ -CVAPI(void) cvSetImageROI( IplImage* image, CvRect rect ); - -/** @brief Resets the image ROI to include the entire image and releases the ROI structure. - -This produces a similar result to the following, but in addition it releases the ROI structure. : -@code - cvSetImageROI(image, cvRect(0, 0, image->width, image->height )); - cvSetImageCOI(image, 0); -@endcode -@param image A pointer to the image header - */ -CVAPI(void) cvResetImageROI( IplImage* image ); - -/** @brief Returns the image ROI. - -If there is no ROI set, cvRect(0,0,image-\>width,image-\>height) is returned. -@param image A pointer to the image header - */ -CVAPI(CvRect) cvGetImageROI( const IplImage* image ); - -/** @brief Creates a matrix header but does not allocate the matrix data. - -The function allocates a new matrix header and returns a pointer to it. The matrix data can then be -allocated using cvCreateData or set explicitly to user-allocated data via cvSetData. -@param rows Number of rows in the matrix -@param cols Number of columns in the matrix -@param type Type of the matrix elements, see cvCreateMat - */ -CVAPI(CvMat*) cvCreateMatHeader( int rows, int cols, int type ); - -#define CV_AUTOSTEP 0x7fffffff - -/** @brief Initializes a pre-allocated matrix header. - -This function is often used to process raw data with OpenCV matrix functions. For example, the -following code computes the matrix product of two matrices, stored as ordinary arrays: -@code - double a[] = { 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12 }; - - double b[] = { 1, 5, 9, - 2, 6, 10, - 3, 7, 11, - 4, 8, 12 }; - - double c[9]; - CvMat Ma, Mb, Mc ; - - cvInitMatHeader(&Ma, 3, 4, CV_64FC1, a); - cvInitMatHeader(&Mb, 4, 3, CV_64FC1, b); - cvInitMatHeader(&Mc, 3, 3, CV_64FC1, c); - - cvMatMulAdd(&Ma, &Mb, 0, &Mc); - // the c array now contains the product of a (3x4) and b (4x3) -@endcode -@param mat A pointer to the matrix header to be initialized -@param rows Number of rows in the matrix -@param cols Number of columns in the matrix -@param type Type of the matrix elements, see cvCreateMat . -@param data Optional: data pointer assigned to the matrix header -@param step Optional: full row width in bytes of the assigned data. By default, the minimal -possible step is used which assumes there are no gaps between subsequent rows of the matrix. - */ -CVAPI(CvMat*) cvInitMatHeader( CvMat* mat, int rows, int cols, - int type, void* data CV_DEFAULT(NULL), - int step CV_DEFAULT(CV_AUTOSTEP) ); - -/** @brief Creates a matrix header and allocates the matrix data. - -The function call is equivalent to the following code: -@code - CvMat* mat = cvCreateMatHeader(rows, cols, type); - cvCreateData(mat); -@endcode -@param rows Number of rows in the matrix -@param cols Number of columns in the matrix -@param type The type of the matrix elements in the form -CV_\\C\ , where S=signed, U=unsigned, F=float. For -example, CV _ 8UC1 means the elements are 8-bit unsigned and the there is 1 channel, and CV _ -32SC2 means the elements are 32-bit signed and there are 2 channels. - */ -CVAPI(CvMat*) cvCreateMat( int rows, int cols, int type ); - -/** @brief Deallocates a matrix. - -The function decrements the matrix data reference counter and deallocates matrix header. If the data -reference counter is 0, it also deallocates the data. : -@code - if(*mat ) - cvDecRefData(*mat); - cvFree((void**)mat); -@endcode -@param mat Double pointer to the matrix - */ -CVAPI(void) cvReleaseMat( CvMat** mat ); - -/** @brief Decrements an array data reference counter. - -The function decrements the data reference counter in a CvMat or CvMatND if the reference counter - -pointer is not NULL. If the counter reaches zero, the data is deallocated. In the current -implementation the reference counter is not NULL only if the data was allocated using the -cvCreateData function. The counter will be NULL in other cases such as: external data was assigned -to the header using cvSetData, header is part of a larger matrix or image, or the header was -converted from an image or n-dimensional matrix header. -@param arr Pointer to an array header - */ -CV_INLINE void cvDecRefData( CvArr* arr ) -{ - if( CV_IS_MAT( arr )) - { - CvMat* mat = (CvMat*)arr; - mat->data.ptr = NULL; - if( mat->refcount != NULL && --*mat->refcount == 0 ) - cvFree( &mat->refcount ); - mat->refcount = NULL; - } - else if( CV_IS_MATND( arr )) - { - CvMatND* mat = (CvMatND*)arr; - mat->data.ptr = NULL; - if( mat->refcount != NULL && --*mat->refcount == 0 ) - cvFree( &mat->refcount ); - mat->refcount = NULL; - } -} - -/** @brief Increments array data reference counter. - -The function increments CvMat or CvMatND data reference counter and returns the new counter value if -the reference counter pointer is not NULL, otherwise it returns zero. -@param arr Array header - */ -CV_INLINE int cvIncRefData( CvArr* arr ) -{ - int refcount = 0; - if( CV_IS_MAT( arr )) - { - CvMat* mat = (CvMat*)arr; - if( mat->refcount != NULL ) - refcount = ++*mat->refcount; - } - else if( CV_IS_MATND( arr )) - { - CvMatND* mat = (CvMatND*)arr; - if( mat->refcount != NULL ) - refcount = ++*mat->refcount; - } - return refcount; -} - - -/** Creates an exact copy of the input matrix (except, may be, step value) */ -CVAPI(CvMat*) cvCloneMat( const CvMat* mat ); - - -/** @brief Returns matrix header corresponding to the rectangular sub-array of input image or matrix. - -The function returns header, corresponding to a specified rectangle of the input array. In other - -words, it allows the user to treat a rectangular part of input array as a stand-alone array. ROI is -taken into account by the function so the sub-array of ROI is actually extracted. -@param arr Input array -@param submat Pointer to the resultant sub-array header -@param rect Zero-based coordinates of the rectangle of interest - */ -CVAPI(CvMat*) cvGetSubRect( const CvArr* arr, CvMat* submat, CvRect rect ); -#define cvGetSubArr cvGetSubRect - -/** @brief Returns array row or row span. - -The function returns the header, corresponding to a specified row/row span of the input array. -cvGetRow(arr, submat, row) is a shortcut for cvGetRows(arr, submat, row, row+1). -@param arr Input array -@param submat Pointer to the resulting sub-array header -@param start_row Zero-based index of the starting row (inclusive) of the span -@param end_row Zero-based index of the ending row (exclusive) of the span -@param delta_row Index step in the row span. That is, the function extracts every delta_row -th -row from start_row and up to (but not including) end_row . - */ -CVAPI(CvMat*) cvGetRows( const CvArr* arr, CvMat* submat, - int start_row, int end_row, - int delta_row CV_DEFAULT(1)); - -/** @overload -@param arr Input array -@param submat Pointer to the resulting sub-array header -@param row Zero-based index of the selected row -*/ -CV_INLINE CvMat* cvGetRow( const CvArr* arr, CvMat* submat, int row ) -{ - return cvGetRows( arr, submat, row, row + 1, 1 ); -} - - -/** @brief Returns one of more array columns. - -The function returns the header, corresponding to a specified column span of the input array. That - -is, no data is copied. Therefore, any modifications of the submatrix will affect the original array. -If you need to copy the columns, use cvCloneMat. cvGetCol(arr, submat, col) is a shortcut for -cvGetCols(arr, submat, col, col+1). -@param arr Input array -@param submat Pointer to the resulting sub-array header -@param start_col Zero-based index of the starting column (inclusive) of the span -@param end_col Zero-based index of the ending column (exclusive) of the span - */ -CVAPI(CvMat*) cvGetCols( const CvArr* arr, CvMat* submat, - int start_col, int end_col ); - -/** @overload -@param arr Input array -@param submat Pointer to the resulting sub-array header -@param col Zero-based index of the selected column -*/ -CV_INLINE CvMat* cvGetCol( const CvArr* arr, CvMat* submat, int col ) -{ - return cvGetCols( arr, submat, col, col + 1 ); -} - -/** @brief Returns one of array diagonals. - -The function returns the header, corresponding to a specified diagonal of the input array. -@param arr Input array -@param submat Pointer to the resulting sub-array header -@param diag Index of the array diagonal. Zero value corresponds to the main diagonal, -1 -corresponds to the diagonal above the main, 1 corresponds to the diagonal below the main, and so -forth. - */ -CVAPI(CvMat*) cvGetDiag( const CvArr* arr, CvMat* submat, - int diag CV_DEFAULT(0)); - -/** low-level scalar <-> raw data conversion functions */ -CVAPI(void) cvScalarToRawData( const CvScalar* scalar, void* data, int type, - int extend_to_12 CV_DEFAULT(0) ); - -CVAPI(void) cvRawDataToScalar( const void* data, int type, CvScalar* scalar ); - -/** @brief Creates a new matrix header but does not allocate the matrix data. - -The function allocates a header for a multi-dimensional dense array. The array data can further be -allocated using cvCreateData or set explicitly to user-allocated data via cvSetData. -@param dims Number of array dimensions -@param sizes Array of dimension sizes -@param type Type of array elements, see cvCreateMat - */ -CVAPI(CvMatND*) cvCreateMatNDHeader( int dims, const int* sizes, int type ); - -/** @brief Creates the header and allocates the data for a multi-dimensional dense array. - -This function call is equivalent to the following code: -@code - CvMatND* mat = cvCreateMatNDHeader(dims, sizes, type); - cvCreateData(mat); -@endcode -@param dims Number of array dimensions. This must not exceed CV_MAX_DIM (32 by default, but can be -changed at build time). -@param sizes Array of dimension sizes. -@param type Type of array elements, see cvCreateMat . - */ -CVAPI(CvMatND*) cvCreateMatND( int dims, const int* sizes, int type ); - -/** @brief Initializes a pre-allocated multi-dimensional array header. - -@param mat A pointer to the array header to be initialized -@param dims The number of array dimensions -@param sizes An array of dimension sizes -@param type Type of array elements, see cvCreateMat -@param data Optional data pointer assigned to the matrix header - */ -CVAPI(CvMatND*) cvInitMatNDHeader( CvMatND* mat, int dims, const int* sizes, - int type, void* data CV_DEFAULT(NULL) ); - -/** @brief Deallocates a multi-dimensional array. - -The function decrements the array data reference counter and releases the array header. If the -reference counter reaches 0, it also deallocates the data. : -@code - if(*mat ) - cvDecRefData(*mat); - cvFree((void**)mat); -@endcode -@param mat Double pointer to the array - */ -CV_INLINE void cvReleaseMatND( CvMatND** mat ) -{ - cvReleaseMat( (CvMat**)mat ); -} - -/** Creates a copy of CvMatND (except, may be, steps) */ -CVAPI(CvMatND*) cvCloneMatND( const CvMatND* mat ); - -/** @brief Creates sparse array. - -The function allocates a multi-dimensional sparse array. Initially the array contain no elements, -that is PtrND and other related functions will return 0 for every index. -@param dims Number of array dimensions. In contrast to the dense matrix, the number of dimensions is -practically unlimited (up to \f$2^{16}\f$ ). -@param sizes Array of dimension sizes -@param type Type of array elements. The same as for CvMat - */ -CVAPI(CvSparseMat*) cvCreateSparseMat( int dims, const int* sizes, int type ); - -/** @brief Deallocates sparse array. - -The function releases the sparse array and clears the array pointer upon exit. -@param mat Double pointer to the array - */ -CVAPI(void) cvReleaseSparseMat( CvSparseMat** mat ); - -/** Creates a copy of CvSparseMat (except, may be, zero items) */ -CVAPI(CvSparseMat*) cvCloneSparseMat( const CvSparseMat* mat ); - -/** @brief Initializes sparse array elements iterator. - -The function initializes iterator of sparse array elements and returns pointer to the first element, -or NULL if the array is empty. -@param mat Input array -@param mat_iterator Initialized iterator - */ -CVAPI(CvSparseNode*) cvInitSparseMatIterator( const CvSparseMat* mat, - CvSparseMatIterator* mat_iterator ); - -/** @brief Returns the next sparse matrix element - -The function moves iterator to the next sparse matrix element and returns pointer to it. In the -current version there is no any particular order of the elements, because they are stored in the -hash table. The sample below demonstrates how to iterate through the sparse matrix: -@code - // print all the non-zero sparse matrix elements and compute their sum - double sum = 0; - int i, dims = cvGetDims(sparsemat); - CvSparseMatIterator it; - CvSparseNode* node = cvInitSparseMatIterator(sparsemat, &it); - - for(; node != 0; node = cvGetNextSparseNode(&it)) - { - int* idx = CV_NODE_IDX(array, node); - float val = *(float*)CV_NODE_VAL(array, node); - printf("M"); - for(i = 0; i < dims; i++ ) - printf("[%d]", idx[i]); - printf("=%g\n", val); - - sum += val; - } - - printf("nTotal sum = %g\n", sum); -@endcode -@param mat_iterator Sparse array iterator - */ -CV_INLINE CvSparseNode* cvGetNextSparseNode( CvSparseMatIterator* mat_iterator ) -{ - if( mat_iterator->node->next ) - return mat_iterator->node = mat_iterator->node->next; - else - { - int idx; - for( idx = ++mat_iterator->curidx; idx < mat_iterator->mat->hashsize; idx++ ) - { - CvSparseNode* node = (CvSparseNode*)mat_iterator->mat->hashtable[idx]; - if( node ) - { - mat_iterator->curidx = idx; - return mat_iterator->node = node; - } - } - return NULL; - } -} - - -#define CV_MAX_ARR 10 - -/** matrix iterator: used for n-ary operations on dense arrays */ -typedef struct CvNArrayIterator -{ - int count; /**< number of arrays */ - int dims; /**< number of dimensions to iterate */ - CvSize size; /**< maximal common linear size: { width = size, height = 1 } */ - uchar* ptr[CV_MAX_ARR]; /**< pointers to the array slices */ - int stack[CV_MAX_DIM]; /**< for internal use */ - CvMatND* hdr[CV_MAX_ARR]; /**< pointers to the headers of the - matrices that are processed */ -} -CvNArrayIterator; - -#define CV_NO_DEPTH_CHECK 1 -#define CV_NO_CN_CHECK 2 -#define CV_NO_SIZE_CHECK 4 - -/** initializes iterator that traverses through several arrays simulteneously - (the function together with cvNextArraySlice is used for - N-ari element-wise operations) */ -CVAPI(int) cvInitNArrayIterator( int count, CvArr** arrs, - const CvArr* mask, CvMatND* stubs, - CvNArrayIterator* array_iterator, - int flags CV_DEFAULT(0) ); - -/** returns zero value if iteration is finished, non-zero (slice length) otherwise */ -CVAPI(int) cvNextNArraySlice( CvNArrayIterator* array_iterator ); - - -/** @brief Returns type of array elements. - -The function returns type of the array elements. In the case of IplImage the type is converted to -CvMat-like representation. For example, if the image has been created as: -@code - IplImage* img = cvCreateImage(cvSize(640, 480), IPL_DEPTH_8U, 3); -@endcode -The code cvGetElemType(img) will return CV_8UC3. -@param arr Input array - */ -CVAPI(int) cvGetElemType( const CvArr* arr ); - -/** @brief Return number of array dimensions - -The function returns the array dimensionality and the array of dimension sizes. In the case of -IplImage or CvMat it always returns 2 regardless of number of image/matrix rows. For example, the -following code calculates total number of array elements: -@code - int sizes[CV_MAX_DIM]; - int i, total = 1; - int dims = cvGetDims(arr, size); - for(i = 0; i < dims; i++ ) - total *= sizes[i]; -@endcode -@param arr Input array -@param sizes Optional output vector of the array dimension sizes. For 2d arrays the number of rows -(height) goes first, number of columns (width) next. - */ -CVAPI(int) cvGetDims( const CvArr* arr, int* sizes CV_DEFAULT(NULL) ); - - -/** @brief Returns array size along the specified dimension. - -@param arr Input array -@param index Zero-based dimension index (for matrices 0 means number of rows, 1 means number of -columns; for images 0 means height, 1 means width) - */ -CVAPI(int) cvGetDimSize( const CvArr* arr, int index ); - - -/** @brief Return pointer to a particular array element. - -The functions return a pointer to a specific array element. Number of array dimension should match -to the number of indices passed to the function except for cvPtr1D function that can be used for -sequential access to 1D, 2D or nD dense arrays. - -The functions can be used for sparse arrays as well - if the requested node does not exist they -create it and set it to zero. - -All these as well as other functions accessing array elements ( cvGetND , cvGetRealND , cvSet -, cvSetND , cvSetRealND ) raise an error in case if the element index is out of range. -@param arr Input array -@param idx0 The first zero-based component of the element index -@param type Optional output parameter: type of matrix elements - */ -CVAPI(uchar*) cvPtr1D( const CvArr* arr, int idx0, int* type CV_DEFAULT(NULL)); -/** @overload */ -CVAPI(uchar*) cvPtr2D( const CvArr* arr, int idx0, int idx1, int* type CV_DEFAULT(NULL) ); -/** @overload */ -CVAPI(uchar*) cvPtr3D( const CvArr* arr, int idx0, int idx1, int idx2, - int* type CV_DEFAULT(NULL)); -/** @overload -@param arr Input array -@param idx Array of the element indices -@param type Optional output parameter: type of matrix elements -@param create_node Optional input parameter for sparse matrices. Non-zero value of the parameter -means that the requested element is created if it does not exist already. -@param precalc_hashval Optional input parameter for sparse matrices. If the pointer is not NULL, -the function does not recalculate the node hash value, but takes it from the specified location. -It is useful for speeding up pair-wise operations (TODO: provide an example) -*/ -CVAPI(uchar*) cvPtrND( const CvArr* arr, const int* idx, int* type CV_DEFAULT(NULL), - int create_node CV_DEFAULT(1), - unsigned* precalc_hashval CV_DEFAULT(NULL)); - -/** @brief Return a specific array element. - -The functions return a specific array element. In the case of a sparse array the functions return 0 -if the requested node does not exist (no new node is created by the functions). -@param arr Input array -@param idx0 The first zero-based component of the element index - */ -CVAPI(CvScalar) cvGet1D( const CvArr* arr, int idx0 ); -/** @overload */ -CVAPI(CvScalar) cvGet2D( const CvArr* arr, int idx0, int idx1 ); -/** @overload */ -CVAPI(CvScalar) cvGet3D( const CvArr* arr, int idx0, int idx1, int idx2 ); -/** @overload -@param arr Input array -@param idx Array of the element indices -*/ -CVAPI(CvScalar) cvGetND( const CvArr* arr, const int* idx ); - -/** @brief Return a specific element of single-channel 1D, 2D, 3D or nD array. - -Returns a specific element of a single-channel array. If the array has multiple channels, a runtime -error is raised. Note that Get?D functions can be used safely for both single-channel and -multiple-channel arrays though they are a bit slower. - -In the case of a sparse array the functions return 0 if the requested node does not exist (no new -node is created by the functions). -@param arr Input array. Must have a single channel. -@param idx0 The first zero-based component of the element index - */ -CVAPI(double) cvGetReal1D( const CvArr* arr, int idx0 ); -/** @overload */ -CVAPI(double) cvGetReal2D( const CvArr* arr, int idx0, int idx1 ); -/** @overload */ -CVAPI(double) cvGetReal3D( const CvArr* arr, int idx0, int idx1, int idx2 ); -/** @overload -@param arr Input array. Must have a single channel. -@param idx Array of the element indices -*/ -CVAPI(double) cvGetRealND( const CvArr* arr, const int* idx ); - -/** @brief Change the particular array element. - -The functions assign the new value to a particular array element. In the case of a sparse array the -functions create the node if it does not exist yet. -@param arr Input array -@param idx0 The first zero-based component of the element index -@param value The assigned value - */ -CVAPI(void) cvSet1D( CvArr* arr, int idx0, CvScalar value ); -/** @overload */ -CVAPI(void) cvSet2D( CvArr* arr, int idx0, int idx1, CvScalar value ); -/** @overload */ -CVAPI(void) cvSet3D( CvArr* arr, int idx0, int idx1, int idx2, CvScalar value ); -/** @overload -@param arr Input array -@param idx Array of the element indices -@param value The assigned value -*/ -CVAPI(void) cvSetND( CvArr* arr, const int* idx, CvScalar value ); - -/** @brief Change a specific array element. - -The functions assign a new value to a specific element of a single-channel array. If the array has -multiple channels, a runtime error is raised. Note that the Set\*D function can be used safely for -both single-channel and multiple-channel arrays, though they are a bit slower. - -In the case of a sparse array the functions create the node if it does not yet exist. -@param arr Input array -@param idx0 The first zero-based component of the element index -@param value The assigned value - */ -CVAPI(void) cvSetReal1D( CvArr* arr, int idx0, double value ); -/** @overload */ -CVAPI(void) cvSetReal2D( CvArr* arr, int idx0, int idx1, double value ); -/** @overload */ -CVAPI(void) cvSetReal3D( CvArr* arr, int idx0, - int idx1, int idx2, double value ); -/** @overload -@param arr Input array -@param idx Array of the element indices -@param value The assigned value -*/ -CVAPI(void) cvSetRealND( CvArr* arr, const int* idx, double value ); - -/** clears element of ND dense array, - in case of sparse arrays it deletes the specified node */ -CVAPI(void) cvClearND( CvArr* arr, const int* idx ); - -/** @brief Returns matrix header for arbitrary array. - -The function returns a matrix header for the input array that can be a matrix - CvMat, an image - -IplImage, or a multi-dimensional dense array - CvMatND (the third option is allowed only if -allowND != 0) . In the case of matrix the function simply returns the input pointer. In the case of -IplImage\* or CvMatND it initializes the header structure with parameters of the current image ROI -and returns &header. Because COI is not supported by CvMat, it is returned separately. - -The function provides an easy way to handle both types of arrays - IplImage and CvMat using the same -code. Input array must have non-zero data pointer, otherwise the function will report an error. - -@note If the input array is IplImage with planar data layout and COI set, the function returns the -pointer to the selected plane and COI == 0. This feature allows user to process IplImage structures -with planar data layout, even though OpenCV does not support such images. -@param arr Input array -@param header Pointer to CvMat structure used as a temporary buffer -@param coi Optional output parameter for storing COI -@param allowND If non-zero, the function accepts multi-dimensional dense arrays (CvMatND\*) and -returns 2D matrix (if CvMatND has two dimensions) or 1D matrix (when CvMatND has 1 dimension or -more than 2 dimensions). The CvMatND array must be continuous. -@sa cvGetImage, cvarrToMat. - */ -CVAPI(CvMat*) cvGetMat( const CvArr* arr, CvMat* header, - int* coi CV_DEFAULT(NULL), - int allowND CV_DEFAULT(0)); - -/** @brief Returns image header for arbitrary array. - -The function returns the image header for the input array that can be a matrix (CvMat) or image -(IplImage). In the case of an image the function simply returns the input pointer. In the case of -CvMat it initializes an image_header structure with the parameters of the input matrix. Note that -if we transform IplImage to CvMat using cvGetMat and then transform CvMat back to IplImage using -this function, we will get different headers if the ROI is set in the original image. -@param arr Input array -@param image_header Pointer to IplImage structure used as a temporary buffer - */ -CVAPI(IplImage*) cvGetImage( const CvArr* arr, IplImage* image_header ); - - -/** @brief Changes the shape of a multi-dimensional array without copying the data. - -The function is an advanced version of cvReshape that can work with multi-dimensional arrays as -well (though it can work with ordinary images and matrices) and change the number of dimensions. - -Below are the two samples from the cvReshape description rewritten using cvReshapeMatND: -@code - IplImage* color_img = cvCreateImage(cvSize(320,240), IPL_DEPTH_8U, 3); - IplImage gray_img_hdr, *gray_img; - gray_img = (IplImage*)cvReshapeMatND(color_img, sizeof(gray_img_hdr), &gray_img_hdr, 1, 0, 0); - ... - int size[] = { 2, 2, 2 }; - CvMatND* mat = cvCreateMatND(3, size, CV_32F); - CvMat row_header, *row; - row = (CvMat*)cvReshapeMatND(mat, sizeof(row_header), &row_header, 0, 1, 0); -@endcode -In C, the header file for this function includes a convenient macro cvReshapeND that does away with -the sizeof_header parameter. So, the lines containing the call to cvReshapeMatND in the examples -may be replaced as follow: -@code - gray_img = (IplImage*)cvReshapeND(color_img, &gray_img_hdr, 1, 0, 0); - ... - row = (CvMat*)cvReshapeND(mat, &row_header, 0, 1, 0); -@endcode -@param arr Input array -@param sizeof_header Size of output header to distinguish between IplImage, CvMat and CvMatND -output headers -@param header Output header to be filled -@param new_cn New number of channels. new_cn = 0 means that the number of channels remains -unchanged. -@param new_dims New number of dimensions. new_dims = 0 means that the number of dimensions -remains the same. -@param new_sizes Array of new dimension sizes. Only new_dims-1 values are used, because the -total number of elements must remain the same. Thus, if new_dims = 1, new_sizes array is not -used. - */ -CVAPI(CvArr*) cvReshapeMatND( const CvArr* arr, - int sizeof_header, CvArr* header, - int new_cn, int new_dims, int* new_sizes ); - -#define cvReshapeND( arr, header, new_cn, new_dims, new_sizes ) \ - cvReshapeMatND( (arr), sizeof(*(header)), (header), \ - (new_cn), (new_dims), (new_sizes)) - -/** @brief Changes shape of matrix/image without copying data. - -The function initializes the CvMat header so that it points to the same data as the original array -but has a different shape - different number of channels, different number of rows, or both. - -The following example code creates one image buffer and two image headers, the first is for a -320x240x3 image and the second is for a 960x240x1 image: -@code - IplImage* color_img = cvCreateImage(cvSize(320,240), IPL_DEPTH_8U, 3); - CvMat gray_mat_hdr; - IplImage gray_img_hdr, *gray_img; - cvReshape(color_img, &gray_mat_hdr, 1); - gray_img = cvGetImage(&gray_mat_hdr, &gray_img_hdr); -@endcode -And the next example converts a 3x3 matrix to a single 1x9 vector: -@code - CvMat* mat = cvCreateMat(3, 3, CV_32F); - CvMat row_header, *row; - row = cvReshape(mat, &row_header, 0, 1); -@endcode -@param arr Input array -@param header Output header to be filled -@param new_cn New number of channels. 'new_cn = 0' means that the number of channels remains -unchanged. -@param new_rows New number of rows. 'new_rows = 0' means that the number of rows remains -unchanged unless it needs to be changed according to new_cn value. -*/ -CVAPI(CvMat*) cvReshape( const CvArr* arr, CvMat* header, - int new_cn, int new_rows CV_DEFAULT(0) ); - -/** Repeats source 2d array several times in both horizontal and - vertical direction to fill destination array */ -CVAPI(void) cvRepeat( const CvArr* src, CvArr* dst ); - -/** @brief Allocates array data - -The function allocates image, matrix or multi-dimensional dense array data. Note that in the case of -matrix types OpenCV allocation functions are used. In the case of IplImage they are used unless -CV_TURN_ON_IPL_COMPATIBILITY() has been called before. In the latter case IPL functions are used -to allocate the data. -@param arr Array header - */ -CVAPI(void) cvCreateData( CvArr* arr ); - -/** @brief Releases array data. - -The function releases the array data. In the case of CvMat or CvMatND it simply calls -cvDecRefData(), that is the function can not deallocate external data. See also the note to -cvCreateData . -@param arr Array header - */ -CVAPI(void) cvReleaseData( CvArr* arr ); - -/** @brief Assigns user data to the array header. - -The function assigns user data to the array header. Header should be initialized before using -cvCreateMatHeader, cvCreateImageHeader, cvCreateMatNDHeader, cvInitMatHeader, -cvInitImageHeader or cvInitMatNDHeader. -@param arr Array header -@param data User data -@param step Full row length in bytes - */ -CVAPI(void) cvSetData( CvArr* arr, void* data, int step ); - -/** @brief Retrieves low-level information about the array. - -The function fills output variables with low-level information about the array data. All output - -parameters are optional, so some of the pointers may be set to NULL. If the array is IplImage with -ROI set, the parameters of ROI are returned. - -The following example shows how to get access to array elements. It computes absolute values of the -array elements : -@code - float* data; - int step; - CvSize size; - - cvGetRawData(array, (uchar**)&data, &step, &size); - step /= sizeof(data[0]); - - for(int y = 0; y < size.height; y++, data += step ) - for(int x = 0; x < size.width; x++ ) - data[x] = (float)fabs(data[x]); -@endcode -@param arr Array header -@param data Output pointer to the whole image origin or ROI origin if ROI is set -@param step Output full row length in bytes -@param roi_size Output ROI size - */ -CVAPI(void) cvGetRawData( const CvArr* arr, uchar** data, - int* step CV_DEFAULT(NULL), - CvSize* roi_size CV_DEFAULT(NULL)); - -/** @brief Returns size of matrix or image ROI. - -The function returns number of rows (CvSize::height) and number of columns (CvSize::width) of the -input matrix or image. In the case of image the size of ROI is returned. -@param arr array header - */ -CVAPI(CvSize) cvGetSize( const CvArr* arr ); - -/** @brief Copies one array to another. - -The function copies selected elements from an input array to an output array: - -\f[\texttt{dst} (I)= \texttt{src} (I) \quad \text{if} \quad \texttt{mask} (I) \ne 0.\f] - -If any of the passed arrays is of IplImage type, then its ROI and COI fields are used. Both arrays -must have the same type, the same number of dimensions, and the same size. The function can also -copy sparse arrays (mask is not supported in this case). -@param src The source array -@param dst The destination array -@param mask Operation mask, 8-bit single channel array; specifies elements of the destination array -to be changed - */ -CVAPI(void) cvCopy( const CvArr* src, CvArr* dst, - const CvArr* mask CV_DEFAULT(NULL) ); - -/** @brief Sets every element of an array to a given value. - -The function copies the scalar value to every selected element of the destination array: -\f[\texttt{arr} (I)= \texttt{value} \quad \text{if} \quad \texttt{mask} (I) \ne 0\f] -If array arr is of IplImage type, then is ROI used, but COI must not be set. -@param arr The destination array -@param value Fill value -@param mask Operation mask, 8-bit single channel array; specifies elements of the destination -array to be changed - */ -CVAPI(void) cvSet( CvArr* arr, CvScalar value, - const CvArr* mask CV_DEFAULT(NULL) ); - -/** @brief Clears the array. - -The function clears the array. In the case of dense arrays (CvMat, CvMatND or IplImage), -cvZero(array) is equivalent to cvSet(array,cvScalarAll(0),0). In the case of sparse arrays all the -elements are removed. -@param arr Array to be cleared - */ -CVAPI(void) cvSetZero( CvArr* arr ); -#define cvZero cvSetZero - - -/** Splits a multi-channel array into the set of single-channel arrays or - extracts particular [color] plane */ -CVAPI(void) cvSplit( const CvArr* src, CvArr* dst0, CvArr* dst1, - CvArr* dst2, CvArr* dst3 ); - -/** Merges a set of single-channel arrays into the single multi-channel array - or inserts one particular [color] plane to the array */ -CVAPI(void) cvMerge( const CvArr* src0, const CvArr* src1, - const CvArr* src2, const CvArr* src3, - CvArr* dst ); - -/** Copies several channels from input arrays to - certain channels of output arrays */ -CVAPI(void) cvMixChannels( const CvArr** src, int src_count, - CvArr** dst, int dst_count, - const int* from_to, int pair_count ); - -/** @brief Converts one array to another with optional linear transformation. - -The function has several different purposes, and thus has several different names. It copies one -array to another with optional scaling, which is performed first, and/or optional type conversion, -performed after: - -\f[\texttt{dst} (I) = \texttt{scale} \texttt{src} (I) + ( \texttt{shift} _0, \texttt{shift} _1,...)\f] - -All the channels of multi-channel arrays are processed independently. - -The type of conversion is done with rounding and saturation, that is if the result of scaling + -conversion can not be represented exactly by a value of the destination array element type, it is -set to the nearest representable value on the real axis. -@param src Source array -@param dst Destination array -@param scale Scale factor -@param shift Value added to the scaled source array elements - */ -CVAPI(void) cvConvertScale( const CvArr* src, CvArr* dst, - double scale CV_DEFAULT(1), - double shift CV_DEFAULT(0) ); -#define cvCvtScale cvConvertScale -#define cvScale cvConvertScale -#define cvConvert( src, dst ) cvConvertScale( (src), (dst), 1, 0 ) - - -/** Performs linear transformation on every source array element, - stores absolute value of the result: - dst(x,y,c) = abs(scale*src(x,y,c)+shift). - destination array must have 8u type. - In other cases one may use cvConvertScale + cvAbsDiffS */ -CVAPI(void) cvConvertScaleAbs( const CvArr* src, CvArr* dst, - double scale CV_DEFAULT(1), - double shift CV_DEFAULT(0) ); -#define cvCvtScaleAbs cvConvertScaleAbs - - -/** checks termination criteria validity and - sets eps to default_eps (if it is not set), - max_iter to default_max_iters (if it is not set) -*/ -CVAPI(CvTermCriteria) cvCheckTermCriteria( CvTermCriteria criteria, - double default_eps, - int default_max_iters ); - -/****************************************************************************************\ -* Arithmetic, logic and comparison operations * -\****************************************************************************************/ - -/** dst(mask) = src1(mask) + src2(mask) */ -CVAPI(void) cvAdd( const CvArr* src1, const CvArr* src2, CvArr* dst, - const CvArr* mask CV_DEFAULT(NULL)); - -/** dst(mask) = src(mask) + value */ -CVAPI(void) cvAddS( const CvArr* src, CvScalar value, CvArr* dst, - const CvArr* mask CV_DEFAULT(NULL)); - -/** dst(mask) = src1(mask) - src2(mask) */ -CVAPI(void) cvSub( const CvArr* src1, const CvArr* src2, CvArr* dst, - const CvArr* mask CV_DEFAULT(NULL)); - -/** dst(mask) = src(mask) - value = src(mask) + (-value) */ -CV_INLINE void cvSubS( const CvArr* src, CvScalar value, CvArr* dst, - const CvArr* mask CV_DEFAULT(NULL)) -{ - cvAddS( src, cvScalar( -value.val[0], -value.val[1], -value.val[2], -value.val[3]), - dst, mask ); -} - -/** dst(mask) = value - src(mask) */ -CVAPI(void) cvSubRS( const CvArr* src, CvScalar value, CvArr* dst, - const CvArr* mask CV_DEFAULT(NULL)); - -/** dst(idx) = src1(idx) * src2(idx) * scale - (scaled element-wise multiplication of 2 arrays) */ -CVAPI(void) cvMul( const CvArr* src1, const CvArr* src2, - CvArr* dst, double scale CV_DEFAULT(1) ); - -/** element-wise division/inversion with scaling: - dst(idx) = src1(idx) * scale / src2(idx) - or dst(idx) = scale / src2(idx) if src1 == 0 */ -CVAPI(void) cvDiv( const CvArr* src1, const CvArr* src2, - CvArr* dst, double scale CV_DEFAULT(1)); - -/** dst = src1 * scale + src2 */ -CVAPI(void) cvScaleAdd( const CvArr* src1, CvScalar scale, - const CvArr* src2, CvArr* dst ); -#define cvAXPY( A, real_scalar, B, C ) cvScaleAdd(A, cvRealScalar(real_scalar), B, C) - -/** dst = src1 * alpha + src2 * beta + gamma */ -CVAPI(void) cvAddWeighted( const CvArr* src1, double alpha, - const CvArr* src2, double beta, - double gamma, CvArr* dst ); - -/** @brief Calculates the dot product of two arrays in Euclidean metrics. - -The function calculates and returns the Euclidean dot product of two arrays. - -\f[src1 \bullet src2 = \sum _I ( \texttt{src1} (I) \texttt{src2} (I))\f] - -In the case of multiple channel arrays, the results for all channels are accumulated. In particular, -cvDotProduct(a,a) where a is a complex vector, will return \f$||\texttt{a}||^2\f$. The function can -process multi-dimensional arrays, row by row, layer by layer, and so on. -@param src1 The first source array -@param src2 The second source array - */ -CVAPI(double) cvDotProduct( const CvArr* src1, const CvArr* src2 ); - -/** dst(idx) = src1(idx) & src2(idx) */ -CVAPI(void) cvAnd( const CvArr* src1, const CvArr* src2, - CvArr* dst, const CvArr* mask CV_DEFAULT(NULL)); - -/** dst(idx) = src(idx) & value */ -CVAPI(void) cvAndS( const CvArr* src, CvScalar value, - CvArr* dst, const CvArr* mask CV_DEFAULT(NULL)); - -/** dst(idx) = src1(idx) | src2(idx) */ -CVAPI(void) cvOr( const CvArr* src1, const CvArr* src2, - CvArr* dst, const CvArr* mask CV_DEFAULT(NULL)); - -/** dst(idx) = src(idx) | value */ -CVAPI(void) cvOrS( const CvArr* src, CvScalar value, - CvArr* dst, const CvArr* mask CV_DEFAULT(NULL)); - -/** dst(idx) = src1(idx) ^ src2(idx) */ -CVAPI(void) cvXor( const CvArr* src1, const CvArr* src2, - CvArr* dst, const CvArr* mask CV_DEFAULT(NULL)); - -/** dst(idx) = src(idx) ^ value */ -CVAPI(void) cvXorS( const CvArr* src, CvScalar value, - CvArr* dst, const CvArr* mask CV_DEFAULT(NULL)); - -/** dst(idx) = ~src(idx) */ -CVAPI(void) cvNot( const CvArr* src, CvArr* dst ); - -/** dst(idx) = lower(idx) <= src(idx) < upper(idx) */ -CVAPI(void) cvInRange( const CvArr* src, const CvArr* lower, - const CvArr* upper, CvArr* dst ); - -/** dst(idx) = lower <= src(idx) < upper */ -CVAPI(void) cvInRangeS( const CvArr* src, CvScalar lower, - CvScalar upper, CvArr* dst ); - -#define CV_CMP_EQ 0 -#define CV_CMP_GT 1 -#define CV_CMP_GE 2 -#define CV_CMP_LT 3 -#define CV_CMP_LE 4 -#define CV_CMP_NE 5 - -/** The comparison operation support single-channel arrays only. - Destination image should be 8uC1 or 8sC1 */ - -/** dst(idx) = src1(idx) _cmp_op_ src2(idx) */ -CVAPI(void) cvCmp( const CvArr* src1, const CvArr* src2, CvArr* dst, int cmp_op ); - -/** dst(idx) = src1(idx) _cmp_op_ value */ -CVAPI(void) cvCmpS( const CvArr* src, double value, CvArr* dst, int cmp_op ); - -/** dst(idx) = min(src1(idx),src2(idx)) */ -CVAPI(void) cvMin( const CvArr* src1, const CvArr* src2, CvArr* dst ); - -/** dst(idx) = max(src1(idx),src2(idx)) */ -CVAPI(void) cvMax( const CvArr* src1, const CvArr* src2, CvArr* dst ); - -/** dst(idx) = min(src(idx),value) */ -CVAPI(void) cvMinS( const CvArr* src, double value, CvArr* dst ); - -/** dst(idx) = max(src(idx),value) */ -CVAPI(void) cvMaxS( const CvArr* src, double value, CvArr* dst ); - -/** dst(x,y,c) = abs(src1(x,y,c) - src2(x,y,c)) */ -CVAPI(void) cvAbsDiff( const CvArr* src1, const CvArr* src2, CvArr* dst ); - -/** dst(x,y,c) = abs(src(x,y,c) - value(c)) */ -CVAPI(void) cvAbsDiffS( const CvArr* src, CvArr* dst, CvScalar value ); -#define cvAbs( src, dst ) cvAbsDiffS( (src), (dst), cvScalarAll(0)) - -/****************************************************************************************\ -* Math operations * -\****************************************************************************************/ - -/** Does cartesian->polar coordinates conversion. - Either of output components (magnitude or angle) is optional */ -CVAPI(void) cvCartToPolar( const CvArr* x, const CvArr* y, - CvArr* magnitude, CvArr* angle CV_DEFAULT(NULL), - int angle_in_degrees CV_DEFAULT(0)); - -/** Does polar->cartesian coordinates conversion. - Either of output components (magnitude or angle) is optional. - If magnitude is missing it is assumed to be all 1's */ -CVAPI(void) cvPolarToCart( const CvArr* magnitude, const CvArr* angle, - CvArr* x, CvArr* y, - int angle_in_degrees CV_DEFAULT(0)); - -/** Does powering: dst(idx) = src(idx)^power */ -CVAPI(void) cvPow( const CvArr* src, CvArr* dst, double power ); - -/** Does exponention: dst(idx) = exp(src(idx)). - Overflow is not handled yet. Underflow is handled. - Maximal relative error is ~7e-6 for single-precision input */ -CVAPI(void) cvExp( const CvArr* src, CvArr* dst ); - -/** Calculates natural logarithms: dst(idx) = log(abs(src(idx))). - Logarithm of 0 gives large negative number(~-700) - Maximal relative error is ~3e-7 for single-precision output -*/ -CVAPI(void) cvLog( const CvArr* src, CvArr* dst ); - -/** Fast arctangent calculation */ -CVAPI(float) cvFastArctan( float y, float x ); - -/** Fast cubic root calculation */ -CVAPI(float) cvCbrt( float value ); - -#define CV_CHECK_RANGE 1 -#define CV_CHECK_QUIET 2 -/** Checks array values for NaNs, Infs or simply for too large numbers - (if CV_CHECK_RANGE is set). If CV_CHECK_QUIET is set, - no runtime errors is raised (function returns zero value in case of "bad" values). - Otherwise cvError is called */ -CVAPI(int) cvCheckArr( const CvArr* arr, int flags CV_DEFAULT(0), - double min_val CV_DEFAULT(0), double max_val CV_DEFAULT(0)); -#define cvCheckArray cvCheckArr - -#define CV_RAND_UNI 0 -#define CV_RAND_NORMAL 1 - -/** @brief Fills an array with random numbers and updates the RNG state. - -The function fills the destination array with uniformly or normally distributed random numbers. -@param rng CvRNG state initialized by cvRNG -@param arr The destination array -@param dist_type Distribution type -> - **CV_RAND_UNI** uniform distribution -> - **CV_RAND_NORMAL** normal or Gaussian distribution -@param param1 The first parameter of the distribution. In the case of a uniform distribution it is -the inclusive lower boundary of the random numbers range. In the case of a normal distribution it -is the mean value of the random numbers. -@param param2 The second parameter of the distribution. In the case of a uniform distribution it -is the exclusive upper boundary of the random numbers range. In the case of a normal distribution -it is the standard deviation of the random numbers. -@sa randu, randn, RNG::fill. - */ -CVAPI(void) cvRandArr( CvRNG* rng, CvArr* arr, int dist_type, - CvScalar param1, CvScalar param2 ); - -CVAPI(void) cvRandShuffle( CvArr* mat, CvRNG* rng, - double iter_factor CV_DEFAULT(1.)); - -#define CV_SORT_EVERY_ROW 0 -#define CV_SORT_EVERY_COLUMN 1 -#define CV_SORT_ASCENDING 0 -#define CV_SORT_DESCENDING 16 - -CVAPI(void) cvSort( const CvArr* src, CvArr* dst CV_DEFAULT(NULL), - CvArr* idxmat CV_DEFAULT(NULL), - int flags CV_DEFAULT(0)); - -/** Finds real roots of a cubic equation */ -CVAPI(int) cvSolveCubic( const CvMat* coeffs, CvMat* roots ); - -/** Finds all real and complex roots of a polynomial equation */ -CVAPI(void) cvSolvePoly(const CvMat* coeffs, CvMat *roots2, - int maxiter CV_DEFAULT(20), int fig CV_DEFAULT(100)); - -/****************************************************************************************\ -* Matrix operations * -\****************************************************************************************/ - -/** @brief Calculates the cross product of two 3D vectors. - -The function calculates the cross product of two 3D vectors: -\f[\texttt{dst} = \texttt{src1} \times \texttt{src2}\f] -or: -\f[\begin{array}{l} \texttt{dst} _1 = \texttt{src1} _2 \texttt{src2} _3 - \texttt{src1} _3 \texttt{src2} _2 \\ \texttt{dst} _2 = \texttt{src1} _3 \texttt{src2} _1 - \texttt{src1} _1 \texttt{src2} _3 \\ \texttt{dst} _3 = \texttt{src1} _1 \texttt{src2} _2 - \texttt{src1} _2 \texttt{src2} _1 \end{array}\f] -@param src1 The first source vector -@param src2 The second source vector -@param dst The destination vector - */ -CVAPI(void) cvCrossProduct( const CvArr* src1, const CvArr* src2, CvArr* dst ); - -/** Matrix transform: dst = A*B + C, C is optional */ -#define cvMatMulAdd( src1, src2, src3, dst ) cvGEMM( (src1), (src2), 1., (src3), 1., (dst), 0 ) -#define cvMatMul( src1, src2, dst ) cvMatMulAdd( (src1), (src2), NULL, (dst)) - -#define CV_GEMM_A_T 1 -#define CV_GEMM_B_T 2 -#define CV_GEMM_C_T 4 -/** Extended matrix transform: - dst = alpha*op(A)*op(B) + beta*op(C), where op(X) is X or X^T */ -CVAPI(void) cvGEMM( const CvArr* src1, const CvArr* src2, double alpha, - const CvArr* src3, double beta, CvArr* dst, - int tABC CV_DEFAULT(0)); -#define cvMatMulAddEx cvGEMM - -/** Transforms each element of source array and stores - resultant vectors in destination array */ -CVAPI(void) cvTransform( const CvArr* src, CvArr* dst, - const CvMat* transmat, - const CvMat* shiftvec CV_DEFAULT(NULL)); -#define cvMatMulAddS cvTransform - -/** Does perspective transform on every element of input array */ -CVAPI(void) cvPerspectiveTransform( const CvArr* src, CvArr* dst, - const CvMat* mat ); - -/** Calculates (A-delta)*(A-delta)^T (order=0) or (A-delta)^T*(A-delta) (order=1) */ -CVAPI(void) cvMulTransposed( const CvArr* src, CvArr* dst, int order, - const CvArr* delta CV_DEFAULT(NULL), - double scale CV_DEFAULT(1.) ); - -/** Tranposes matrix. Square matrices can be transposed in-place */ -CVAPI(void) cvTranspose( const CvArr* src, CvArr* dst ); -#define cvT cvTranspose - -/** Completes the symmetric matrix from the lower (LtoR=0) or from the upper (LtoR!=0) part */ -CVAPI(void) cvCompleteSymm( CvMat* matrix, int LtoR CV_DEFAULT(0) ); - -/** Mirror array data around horizontal (flip=0), - vertical (flip=1) or both(flip=-1) axises: - cvFlip(src) flips images vertically and sequences horizontally (inplace) */ -CVAPI(void) cvFlip( const CvArr* src, CvArr* dst CV_DEFAULT(NULL), - int flip_mode CV_DEFAULT(0)); -#define cvMirror cvFlip - - -#define CV_SVD_MODIFY_A 1 -#define CV_SVD_U_T 2 -#define CV_SVD_V_T 4 - -/** Performs Singular Value Decomposition of a matrix */ -CVAPI(void) cvSVD( CvArr* A, CvArr* W, CvArr* U CV_DEFAULT(NULL), - CvArr* V CV_DEFAULT(NULL), int flags CV_DEFAULT(0)); - -/** Performs Singular Value Back Substitution (solves A*X = B): - flags must be the same as in cvSVD */ -CVAPI(void) cvSVBkSb( const CvArr* W, const CvArr* U, - const CvArr* V, const CvArr* B, - CvArr* X, int flags ); - -#define CV_LU 0 -#define CV_SVD 1 -#define CV_SVD_SYM 2 -#define CV_CHOLESKY 3 -#define CV_QR 4 -#define CV_NORMAL 16 - -/** Inverts matrix */ -CVAPI(double) cvInvert( const CvArr* src, CvArr* dst, - int method CV_DEFAULT(CV_LU)); -#define cvInv cvInvert - -/** Solves linear system (src1)*(dst) = (src2) - (returns 0 if src1 is a singular and CV_LU method is used) */ -CVAPI(int) cvSolve( const CvArr* src1, const CvArr* src2, CvArr* dst, - int method CV_DEFAULT(CV_LU)); - -/** Calculates determinant of input matrix */ -CVAPI(double) cvDet( const CvArr* mat ); - -/** Calculates trace of the matrix (sum of elements on the main diagonal) */ -CVAPI(CvScalar) cvTrace( const CvArr* mat ); - -/** Finds eigen values and vectors of a symmetric matrix */ -CVAPI(void) cvEigenVV( CvArr* mat, CvArr* evects, CvArr* evals, - double eps CV_DEFAULT(0), - int lowindex CV_DEFAULT(-1), - int highindex CV_DEFAULT(-1)); - -///* Finds selected eigen values and vectors of a symmetric matrix */ -//CVAPI(void) cvSelectedEigenVV( CvArr* mat, CvArr* evects, CvArr* evals, -// int lowindex, int highindex ); - -/** Makes an identity matrix (mat_ij = i == j) */ -CVAPI(void) cvSetIdentity( CvArr* mat, CvScalar value CV_DEFAULT(cvRealScalar(1)) ); - -/** Fills matrix with given range of numbers */ -CVAPI(CvArr*) cvRange( CvArr* mat, double start, double end ); - -/** @anchor core_c_CovarFlags -@name Flags for cvCalcCovarMatrix -@see cvCalcCovarMatrix - @{ -*/ - -/** flag for cvCalcCovarMatrix, transpose([v1-avg, v2-avg,...]) * [v1-avg,v2-avg,...] */ -#define CV_COVAR_SCRAMBLED 0 - -/** flag for cvCalcCovarMatrix, [v1-avg, v2-avg,...] * transpose([v1-avg,v2-avg,...]) */ -#define CV_COVAR_NORMAL 1 - -/** flag for cvCalcCovarMatrix, do not calc average (i.e. mean vector) - use the input vector instead - (useful for calculating covariance matrix by parts) */ -#define CV_COVAR_USE_AVG 2 - -/** flag for cvCalcCovarMatrix, scale the covariance matrix coefficients by number of the vectors */ -#define CV_COVAR_SCALE 4 - -/** flag for cvCalcCovarMatrix, all the input vectors are stored in a single matrix, as its rows */ -#define CV_COVAR_ROWS 8 - -/** flag for cvCalcCovarMatrix, all the input vectors are stored in a single matrix, as its columns */ -#define CV_COVAR_COLS 16 - -/** @} */ - -/** Calculates covariation matrix for a set of vectors -@see @ref core_c_CovarFlags "flags" -*/ -CVAPI(void) cvCalcCovarMatrix( const CvArr** vects, int count, - CvArr* cov_mat, CvArr* avg, int flags ); - -#define CV_PCA_DATA_AS_ROW 0 -#define CV_PCA_DATA_AS_COL 1 -#define CV_PCA_USE_AVG 2 -CVAPI(void) cvCalcPCA( const CvArr* data, CvArr* mean, - CvArr* eigenvals, CvArr* eigenvects, int flags ); - -CVAPI(void) cvProjectPCA( const CvArr* data, const CvArr* mean, - const CvArr* eigenvects, CvArr* result ); - -CVAPI(void) cvBackProjectPCA( const CvArr* proj, const CvArr* mean, - const CvArr* eigenvects, CvArr* result ); - -/** Calculates Mahalanobis(weighted) distance */ -CVAPI(double) cvMahalanobis( const CvArr* vec1, const CvArr* vec2, const CvArr* mat ); -#define cvMahalonobis cvMahalanobis - -/****************************************************************************************\ -* Array Statistics * -\****************************************************************************************/ - -/** Finds sum of array elements */ -CVAPI(CvScalar) cvSum( const CvArr* arr ); - -/** Calculates number of non-zero pixels */ -CVAPI(int) cvCountNonZero( const CvArr* arr ); - -/** Calculates mean value of array elements */ -CVAPI(CvScalar) cvAvg( const CvArr* arr, const CvArr* mask CV_DEFAULT(NULL) ); - -/** Calculates mean and standard deviation of pixel values */ -CVAPI(void) cvAvgSdv( const CvArr* arr, CvScalar* mean, CvScalar* std_dev, - const CvArr* mask CV_DEFAULT(NULL) ); - -/** Finds global minimum, maximum and their positions */ -CVAPI(void) cvMinMaxLoc( const CvArr* arr, double* min_val, double* max_val, - CvPoint* min_loc CV_DEFAULT(NULL), - CvPoint* max_loc CV_DEFAULT(NULL), - const CvArr* mask CV_DEFAULT(NULL) ); - -/** @anchor core_c_NormFlags - @name Flags for cvNorm and cvNormalize - @{ -*/ -#define CV_C 1 -#define CV_L1 2 -#define CV_L2 4 -#define CV_NORM_MASK 7 -#define CV_RELATIVE 8 -#define CV_DIFF 16 -#define CV_MINMAX 32 - -#define CV_DIFF_C (CV_DIFF | CV_C) -#define CV_DIFF_L1 (CV_DIFF | CV_L1) -#define CV_DIFF_L2 (CV_DIFF | CV_L2) -#define CV_RELATIVE_C (CV_RELATIVE | CV_C) -#define CV_RELATIVE_L1 (CV_RELATIVE | CV_L1) -#define CV_RELATIVE_L2 (CV_RELATIVE | CV_L2) -/** @} */ - -/** Finds norm, difference norm or relative difference norm for an array (or two arrays) -@see ref core_c_NormFlags "flags" -*/ -CVAPI(double) cvNorm( const CvArr* arr1, const CvArr* arr2 CV_DEFAULT(NULL), - int norm_type CV_DEFAULT(CV_L2), - const CvArr* mask CV_DEFAULT(NULL) ); - -/** @see ref core_c_NormFlags "flags" */ -CVAPI(void) cvNormalize( const CvArr* src, CvArr* dst, - double a CV_DEFAULT(1.), double b CV_DEFAULT(0.), - int norm_type CV_DEFAULT(CV_L2), - const CvArr* mask CV_DEFAULT(NULL) ); - -/** @anchor core_c_ReduceFlags - @name Flags for cvReduce - @{ -*/ -#define CV_REDUCE_SUM 0 -#define CV_REDUCE_AVG 1 -#define CV_REDUCE_MAX 2 -#define CV_REDUCE_MIN 3 -/** @} */ - -/** @see @ref core_c_ReduceFlags "flags" */ -CVAPI(void) cvReduce( const CvArr* src, CvArr* dst, int dim CV_DEFAULT(-1), - int op CV_DEFAULT(CV_REDUCE_SUM) ); - -/****************************************************************************************\ -* Discrete Linear Transforms and Related Functions * -\****************************************************************************************/ - -/** @anchor core_c_DftFlags - @name Flags for cvDFT, cvDCT and cvMulSpectrums - @{ - */ -#define CV_DXT_FORWARD 0 -#define CV_DXT_INVERSE 1 -#define CV_DXT_SCALE 2 /**< divide result by size of array */ -#define CV_DXT_INV_SCALE (CV_DXT_INVERSE + CV_DXT_SCALE) -#define CV_DXT_INVERSE_SCALE CV_DXT_INV_SCALE -#define CV_DXT_ROWS 4 /**< transform each row individually */ -#define CV_DXT_MUL_CONJ 8 /**< conjugate the second argument of cvMulSpectrums */ -/** @} */ - -/** Discrete Fourier Transform: - complex->complex, - real->ccs (forward), - ccs->real (inverse) -@see core_c_DftFlags "flags" -*/ -CVAPI(void) cvDFT( const CvArr* src, CvArr* dst, int flags, - int nonzero_rows CV_DEFAULT(0) ); -#define cvFFT cvDFT - -/** Multiply results of DFTs: DFT(X)*DFT(Y) or DFT(X)*conj(DFT(Y)) -@see core_c_DftFlags "flags" -*/ -CVAPI(void) cvMulSpectrums( const CvArr* src1, const CvArr* src2, - CvArr* dst, int flags ); - -/** Finds optimal DFT vector size >= size0 */ -CVAPI(int) cvGetOptimalDFTSize( int size0 ); - -/** Discrete Cosine Transform -@see core_c_DftFlags "flags" -*/ -CVAPI(void) cvDCT( const CvArr* src, CvArr* dst, int flags ); - -/****************************************************************************************\ -* Dynamic data structures * -\****************************************************************************************/ - -/** Calculates length of sequence slice (with support of negative indices). */ -CVAPI(int) cvSliceLength( CvSlice slice, const CvSeq* seq ); - - -/** Creates new memory storage. - block_size == 0 means that default, - somewhat optimal size, is used (currently, it is 64K) */ -CVAPI(CvMemStorage*) cvCreateMemStorage( int block_size CV_DEFAULT(0)); - - -/** Creates a memory storage that will borrow memory blocks from parent storage */ -CVAPI(CvMemStorage*) cvCreateChildMemStorage( CvMemStorage* parent ); - - -/** Releases memory storage. All the children of a parent must be released before - the parent. A child storage returns all the blocks to parent when it is released */ -CVAPI(void) cvReleaseMemStorage( CvMemStorage** storage ); - - -/** Clears memory storage. This is the only way(!!!) (besides cvRestoreMemStoragePos) - to reuse memory allocated for the storage - cvClearSeq,cvClearSet ... - do not free any memory. - A child storage returns all the blocks to the parent when it is cleared */ -CVAPI(void) cvClearMemStorage( CvMemStorage* storage ); - -/** Remember a storage "free memory" position */ -CVAPI(void) cvSaveMemStoragePos( const CvMemStorage* storage, CvMemStoragePos* pos ); - -/** Restore a storage "free memory" position */ -CVAPI(void) cvRestoreMemStoragePos( CvMemStorage* storage, CvMemStoragePos* pos ); - -/** Allocates continuous buffer of the specified size in the storage */ -CVAPI(void*) cvMemStorageAlloc( CvMemStorage* storage, size_t size ); - -/** Allocates string in memory storage */ -CVAPI(CvString) cvMemStorageAllocString( CvMemStorage* storage, const char* ptr, - int len CV_DEFAULT(-1) ); - -/** Creates new empty sequence that will reside in the specified storage */ -CVAPI(CvSeq*) cvCreateSeq( int seq_flags, size_t header_size, - size_t elem_size, CvMemStorage* storage ); - -/** Changes default size (granularity) of sequence blocks. - The default size is ~1Kbyte */ -CVAPI(void) cvSetSeqBlockSize( CvSeq* seq, int delta_elems ); - - -/** Adds new element to the end of sequence. Returns pointer to the element */ -CVAPI(schar*) cvSeqPush( CvSeq* seq, const void* element CV_DEFAULT(NULL)); - - -/** Adds new element to the beginning of sequence. Returns pointer to it */ -CVAPI(schar*) cvSeqPushFront( CvSeq* seq, const void* element CV_DEFAULT(NULL)); - - -/** Removes the last element from sequence and optionally saves it */ -CVAPI(void) cvSeqPop( CvSeq* seq, void* element CV_DEFAULT(NULL)); - - -/** Removes the first element from sequence and optioanally saves it */ -CVAPI(void) cvSeqPopFront( CvSeq* seq, void* element CV_DEFAULT(NULL)); - - -#define CV_FRONT 1 -#define CV_BACK 0 -/** Adds several new elements to the end of sequence */ -CVAPI(void) cvSeqPushMulti( CvSeq* seq, const void* elements, - int count, int in_front CV_DEFAULT(0) ); - -/** Removes several elements from the end of sequence and optionally saves them */ -CVAPI(void) cvSeqPopMulti( CvSeq* seq, void* elements, - int count, int in_front CV_DEFAULT(0) ); - -/** Inserts a new element in the middle of sequence. - cvSeqInsert(seq,0,elem) == cvSeqPushFront(seq,elem) */ -CVAPI(schar*) cvSeqInsert( CvSeq* seq, int before_index, - const void* element CV_DEFAULT(NULL)); - -/** Removes specified sequence element */ -CVAPI(void) cvSeqRemove( CvSeq* seq, int index ); - - -/** Removes all the elements from the sequence. The freed memory - can be reused later only by the same sequence unless cvClearMemStorage - or cvRestoreMemStoragePos is called */ -CVAPI(void) cvClearSeq( CvSeq* seq ); - - -/** Retrieves pointer to specified sequence element. - Negative indices are supported and mean counting from the end - (e.g -1 means the last sequence element) */ -CVAPI(schar*) cvGetSeqElem( const CvSeq* seq, int index ); - -/** Calculates index of the specified sequence element. - Returns -1 if element does not belong to the sequence */ -CVAPI(int) cvSeqElemIdx( const CvSeq* seq, const void* element, - CvSeqBlock** block CV_DEFAULT(NULL) ); - -/** Initializes sequence writer. The new elements will be added to the end of sequence */ -CVAPI(void) cvStartAppendToSeq( CvSeq* seq, CvSeqWriter* writer ); - - -/** Combination of cvCreateSeq and cvStartAppendToSeq */ -CVAPI(void) cvStartWriteSeq( int seq_flags, int header_size, - int elem_size, CvMemStorage* storage, - CvSeqWriter* writer ); - -/** Closes sequence writer, updates sequence header and returns pointer - to the resultant sequence - (which may be useful if the sequence was created using cvStartWriteSeq)) -*/ -CVAPI(CvSeq*) cvEndWriteSeq( CvSeqWriter* writer ); - - -/** Updates sequence header. May be useful to get access to some of previously - written elements via cvGetSeqElem or sequence reader */ -CVAPI(void) cvFlushSeqWriter( CvSeqWriter* writer ); - - -/** Initializes sequence reader. - The sequence can be read in forward or backward direction */ -CVAPI(void) cvStartReadSeq( const CvSeq* seq, CvSeqReader* reader, - int reverse CV_DEFAULT(0) ); - - -/** Returns current sequence reader position (currently observed sequence element) */ -CVAPI(int) cvGetSeqReaderPos( CvSeqReader* reader ); - - -/** Changes sequence reader position. It may seek to an absolute or - to relative to the current position */ -CVAPI(void) cvSetSeqReaderPos( CvSeqReader* reader, int index, - int is_relative CV_DEFAULT(0)); - -/** Copies sequence content to a continuous piece of memory */ -CVAPI(void*) cvCvtSeqToArray( const CvSeq* seq, void* elements, - CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ) ); - -/** Creates sequence header for array. - After that all the operations on sequences that do not alter the content - can be applied to the resultant sequence */ -CVAPI(CvSeq*) cvMakeSeqHeaderForArray( int seq_type, int header_size, - int elem_size, void* elements, int total, - CvSeq* seq, CvSeqBlock* block ); - -/** Extracts sequence slice (with or without copying sequence elements) */ -CVAPI(CvSeq*) cvSeqSlice( const CvSeq* seq, CvSlice slice, - CvMemStorage* storage CV_DEFAULT(NULL), - int copy_data CV_DEFAULT(0)); - -CV_INLINE CvSeq* cvCloneSeq( const CvSeq* seq, CvMemStorage* storage CV_DEFAULT(NULL)) -{ - return cvSeqSlice( seq, CV_WHOLE_SEQ, storage, 1 ); -} - -/** Removes sequence slice */ -CVAPI(void) cvSeqRemoveSlice( CvSeq* seq, CvSlice slice ); - -/** Inserts a sequence or array into another sequence */ -CVAPI(void) cvSeqInsertSlice( CvSeq* seq, int before_index, const CvArr* from_arr ); - -/** a < b ? -1 : a > b ? 1 : 0 */ -typedef int (CV_CDECL* CvCmpFunc)(const void* a, const void* b, void* userdata ); - -/** Sorts sequence in-place given element comparison function */ -CVAPI(void) cvSeqSort( CvSeq* seq, CvCmpFunc func, void* userdata CV_DEFAULT(NULL) ); - -/** Finds element in a [sorted] sequence */ -CVAPI(schar*) cvSeqSearch( CvSeq* seq, const void* elem, CvCmpFunc func, - int is_sorted, int* elem_idx, - void* userdata CV_DEFAULT(NULL) ); - -/** Reverses order of sequence elements in-place */ -CVAPI(void) cvSeqInvert( CvSeq* seq ); - -/** Splits sequence into one or more equivalence classes using the specified criteria */ -CVAPI(int) cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, - CvSeq** labels, CvCmpFunc is_equal, void* userdata ); - -/************ Internal sequence functions ************/ -CVAPI(void) cvChangeSeqBlock( void* reader, int direction ); -CVAPI(void) cvCreateSeqBlock( CvSeqWriter* writer ); - - -/** Creates a new set */ -CVAPI(CvSet*) cvCreateSet( int set_flags, int header_size, - int elem_size, CvMemStorage* storage ); - -/** Adds new element to the set and returns pointer to it */ -CVAPI(int) cvSetAdd( CvSet* set_header, CvSetElem* elem CV_DEFAULT(NULL), - CvSetElem** inserted_elem CV_DEFAULT(NULL) ); - -/** Fast variant of cvSetAdd */ -CV_INLINE CvSetElem* cvSetNew( CvSet* set_header ) -{ - CvSetElem* elem = set_header->free_elems; - if( elem ) - { - set_header->free_elems = elem->next_free; - elem->flags = elem->flags & CV_SET_ELEM_IDX_MASK; - set_header->active_count++; - } - else - cvSetAdd( set_header, NULL, &elem ); - return elem; -} - -/** Removes set element given its pointer */ -CV_INLINE void cvSetRemoveByPtr( CvSet* set_header, void* elem ) -{ - CvSetElem* _elem = (CvSetElem*)elem; - assert( _elem->flags >= 0 /*&& (elem->flags & CV_SET_ELEM_IDX_MASK) < set_header->total*/ ); - _elem->next_free = set_header->free_elems; - _elem->flags = (_elem->flags & CV_SET_ELEM_IDX_MASK) | CV_SET_ELEM_FREE_FLAG; - set_header->free_elems = _elem; - set_header->active_count--; -} - -/** Removes element from the set by its index */ -CVAPI(void) cvSetRemove( CvSet* set_header, int index ); - -/** Returns a set element by index. If the element doesn't belong to the set, - NULL is returned */ -CV_INLINE CvSetElem* cvGetSetElem( const CvSet* set_header, int idx ) -{ - CvSetElem* elem = (CvSetElem*)(void *)cvGetSeqElem( (CvSeq*)set_header, idx ); - return elem && CV_IS_SET_ELEM( elem ) ? elem : 0; -} - -/** Removes all the elements from the set */ -CVAPI(void) cvClearSet( CvSet* set_header ); - -/** Creates new graph */ -CVAPI(CvGraph*) cvCreateGraph( int graph_flags, int header_size, - int vtx_size, int edge_size, - CvMemStorage* storage ); - -/** Adds new vertex to the graph */ -CVAPI(int) cvGraphAddVtx( CvGraph* graph, const CvGraphVtx* vtx CV_DEFAULT(NULL), - CvGraphVtx** inserted_vtx CV_DEFAULT(NULL) ); - - -/** Removes vertex from the graph together with all incident edges */ -CVAPI(int) cvGraphRemoveVtx( CvGraph* graph, int index ); -CVAPI(int) cvGraphRemoveVtxByPtr( CvGraph* graph, CvGraphVtx* vtx ); - - -/** Link two vertices specified by indices or pointers if they - are not connected or return pointer to already existing edge - connecting the vertices. - Functions return 1 if a new edge was created, 0 otherwise */ -CVAPI(int) cvGraphAddEdge( CvGraph* graph, - int start_idx, int end_idx, - const CvGraphEdge* edge CV_DEFAULT(NULL), - CvGraphEdge** inserted_edge CV_DEFAULT(NULL) ); - -CVAPI(int) cvGraphAddEdgeByPtr( CvGraph* graph, - CvGraphVtx* start_vtx, CvGraphVtx* end_vtx, - const CvGraphEdge* edge CV_DEFAULT(NULL), - CvGraphEdge** inserted_edge CV_DEFAULT(NULL) ); - -/** Remove edge connecting two vertices */ -CVAPI(void) cvGraphRemoveEdge( CvGraph* graph, int start_idx, int end_idx ); -CVAPI(void) cvGraphRemoveEdgeByPtr( CvGraph* graph, CvGraphVtx* start_vtx, - CvGraphVtx* end_vtx ); - -/** Find edge connecting two vertices */ -CVAPI(CvGraphEdge*) cvFindGraphEdge( const CvGraph* graph, int start_idx, int end_idx ); -CVAPI(CvGraphEdge*) cvFindGraphEdgeByPtr( const CvGraph* graph, - const CvGraphVtx* start_vtx, - const CvGraphVtx* end_vtx ); -#define cvGraphFindEdge cvFindGraphEdge -#define cvGraphFindEdgeByPtr cvFindGraphEdgeByPtr - -/** Remove all vertices and edges from the graph */ -CVAPI(void) cvClearGraph( CvGraph* graph ); - - -/** Count number of edges incident to the vertex */ -CVAPI(int) cvGraphVtxDegree( const CvGraph* graph, int vtx_idx ); -CVAPI(int) cvGraphVtxDegreeByPtr( const CvGraph* graph, const CvGraphVtx* vtx ); - - -/** Retrieves graph vertex by given index */ -#define cvGetGraphVtx( graph, idx ) (CvGraphVtx*)cvGetSetElem((CvSet*)(graph), (idx)) - -/** Retrieves index of a graph vertex given its pointer */ -#define cvGraphVtxIdx( graph, vtx ) ((vtx)->flags & CV_SET_ELEM_IDX_MASK) - -/** Retrieves index of a graph edge given its pointer */ -#define cvGraphEdgeIdx( graph, edge ) ((edge)->flags & CV_SET_ELEM_IDX_MASK) - -#define cvGraphGetVtxCount( graph ) ((graph)->active_count) -#define cvGraphGetEdgeCount( graph ) ((graph)->edges->active_count) - -#define CV_GRAPH_VERTEX 1 -#define CV_GRAPH_TREE_EDGE 2 -#define CV_GRAPH_BACK_EDGE 4 -#define CV_GRAPH_FORWARD_EDGE 8 -#define CV_GRAPH_CROSS_EDGE 16 -#define CV_GRAPH_ANY_EDGE 30 -#define CV_GRAPH_NEW_TREE 32 -#define CV_GRAPH_BACKTRACKING 64 -#define CV_GRAPH_OVER -1 - -#define CV_GRAPH_ALL_ITEMS -1 - -/** flags for graph vertices and edges */ -#define CV_GRAPH_ITEM_VISITED_FLAG (1 << 30) -#define CV_IS_GRAPH_VERTEX_VISITED(vtx) \ - (((CvGraphVtx*)(vtx))->flags & CV_GRAPH_ITEM_VISITED_FLAG) -#define CV_IS_GRAPH_EDGE_VISITED(edge) \ - (((CvGraphEdge*)(edge))->flags & CV_GRAPH_ITEM_VISITED_FLAG) -#define CV_GRAPH_SEARCH_TREE_NODE_FLAG (1 << 29) -#define CV_GRAPH_FORWARD_EDGE_FLAG (1 << 28) - -typedef struct CvGraphScanner -{ - CvGraphVtx* vtx; /* current graph vertex (or current edge origin) */ - CvGraphVtx* dst; /* current graph edge destination vertex */ - CvGraphEdge* edge; /* current edge */ - - CvGraph* graph; /* the graph */ - CvSeq* stack; /* the graph vertex stack */ - int index; /* the lower bound of certainly visited vertices */ - int mask; /* event mask */ -} -CvGraphScanner; - -/** Creates new graph scanner. */ -CVAPI(CvGraphScanner*) cvCreateGraphScanner( CvGraph* graph, - CvGraphVtx* vtx CV_DEFAULT(NULL), - int mask CV_DEFAULT(CV_GRAPH_ALL_ITEMS)); - -/** Releases graph scanner. */ -CVAPI(void) cvReleaseGraphScanner( CvGraphScanner** scanner ); - -/** Get next graph element */ -CVAPI(int) cvNextGraphItem( CvGraphScanner* scanner ); - -/** Creates a copy of graph */ -CVAPI(CvGraph*) cvCloneGraph( const CvGraph* graph, CvMemStorage* storage ); - - -/** Does look-up transformation. Elements of the source array - (that should be 8uC1 or 8sC1) are used as indexes in lutarr 256-element table */ -CVAPI(void) cvLUT( const CvArr* src, CvArr* dst, const CvArr* lut ); - - -/******************* Iteration through the sequence tree *****************/ -typedef struct CvTreeNodeIterator -{ - const void* node; - int level; - int max_level; -} -CvTreeNodeIterator; - -CVAPI(void) cvInitTreeNodeIterator( CvTreeNodeIterator* tree_iterator, - const void* first, int max_level ); -CVAPI(void*) cvNextTreeNode( CvTreeNodeIterator* tree_iterator ); -CVAPI(void*) cvPrevTreeNode( CvTreeNodeIterator* tree_iterator ); - -/** Inserts sequence into tree with specified "parent" sequence. - If parent is equal to frame (e.g. the most external contour), - then added contour will have null pointer to parent. */ -CVAPI(void) cvInsertNodeIntoTree( void* node, void* parent, void* frame ); - -/** Removes contour from tree (together with the contour children). */ -CVAPI(void) cvRemoveNodeFromTree( void* node, void* frame ); - -/** Gathers pointers to all the sequences, - accessible from the `first`, to the single sequence */ -CVAPI(CvSeq*) cvTreeToNodeSeq( const void* first, int header_size, - CvMemStorage* storage ); - -/** The function implements the K-means algorithm for clustering an array of sample - vectors in a specified number of classes */ -#define CV_KMEANS_USE_INITIAL_LABELS 1 -CVAPI(int) cvKMeans2( const CvArr* samples, int cluster_count, CvArr* labels, - CvTermCriteria termcrit, int attempts CV_DEFAULT(1), - CvRNG* rng CV_DEFAULT(0), int flags CV_DEFAULT(0), - CvArr* _centers CV_DEFAULT(0), double* compactness CV_DEFAULT(0) ); - -/****************************************************************************************\ -* System functions * -\****************************************************************************************/ - -/** Loads optimized functions from IPP, MKL etc. or switches back to pure C code */ -CVAPI(int) cvUseOptimized( int on_off ); - -typedef IplImage* (CV_STDCALL* Cv_iplCreateImageHeader) - (int,int,int,char*,char*,int,int,int,int,int, - IplROI*,IplImage*,void*,IplTileInfo*); -typedef void (CV_STDCALL* Cv_iplAllocateImageData)(IplImage*,int,int); -typedef void (CV_STDCALL* Cv_iplDeallocate)(IplImage*,int); -typedef IplROI* (CV_STDCALL* Cv_iplCreateROI)(int,int,int,int,int); -typedef IplImage* (CV_STDCALL* Cv_iplCloneImage)(const IplImage*); - -/** @brief Makes OpenCV use IPL functions for allocating IplImage and IplROI structures. - -Normally, the function is not called directly. Instead, a simple macro -CV_TURN_ON_IPL_COMPATIBILITY() is used that calls cvSetIPLAllocators and passes there pointers -to IPL allocation functions. : -@code - ... - CV_TURN_ON_IPL_COMPATIBILITY() - ... -@endcode -@param create_header pointer to a function, creating IPL image header. -@param allocate_data pointer to a function, allocating IPL image data. -@param deallocate pointer to a function, deallocating IPL image. -@param create_roi pointer to a function, creating IPL image ROI (i.e. Region of Interest). -@param clone_image pointer to a function, cloning an IPL image. - */ -CVAPI(void) cvSetIPLAllocators( Cv_iplCreateImageHeader create_header, - Cv_iplAllocateImageData allocate_data, - Cv_iplDeallocate deallocate, - Cv_iplCreateROI create_roi, - Cv_iplCloneImage clone_image ); - -#define CV_TURN_ON_IPL_COMPATIBILITY() \ - cvSetIPLAllocators( iplCreateImageHeader, iplAllocateImage, \ - iplDeallocate, iplCreateROI, iplCloneImage ) - -/****************************************************************************************\ -* Data Persistence * -\****************************************************************************************/ - -/********************************** High-level functions ********************************/ - -/** @brief Opens file storage for reading or writing data. - -The function opens file storage for reading or writing data. In the latter case, a new file is -created or an existing file is rewritten. The type of the read or written file is determined by the -filename extension: .xml for XML, .yml or .yaml for YAML and .json for JSON. - -At the same time, it also supports adding parameters like "example.xml?base64". - -The function returns a pointer to the CvFileStorage structure. -If the file cannot be opened then the function returns NULL. -@param filename Name of the file associated with the storage -@param memstorage Memory storage used for temporary data and for -: storing dynamic structures, such as CvSeq or CvGraph . If it is NULL, a temporary memory - storage is created and used. -@param flags Can be one of the following: -> - **CV_STORAGE_READ** the storage is open for reading -> - **CV_STORAGE_WRITE** the storage is open for writing - (use **CV_STORAGE_WRITE | CV_STORAGE_WRITE_BASE64** to write rawdata in Base64) -@param encoding - */ -CVAPI(CvFileStorage*) cvOpenFileStorage( const char* filename, CvMemStorage* memstorage, - int flags, const char* encoding CV_DEFAULT(NULL) ); - -/** @brief Releases file storage. - -The function closes the file associated with the storage and releases all the temporary structures. -It must be called after all I/O operations with the storage are finished. -@param fs Double pointer to the released file storage - */ -CVAPI(void) cvReleaseFileStorage( CvFileStorage** fs ); - -/** returns attribute value or 0 (NULL) if there is no such attribute */ -CVAPI(const char*) cvAttrValue( const CvAttrList* attr, const char* attr_name ); - -/** @brief Starts writing a new structure. - -The function starts writing a compound structure (collection) that can be a sequence or a map. After -all the structure fields, which can be scalars or structures, are written, cvEndWriteStruct should -be called. The function can be used to group some objects or to implement the write function for a -some user object (see CvTypeInfo). -@param fs File storage -@param name Name of the written structure. The structure can be accessed by this name when the -storage is read. -@param struct_flags A combination one of the following values: -- **CV_NODE_SEQ** the written structure is a sequence (see discussion of CvFileStorage ), - that is, its elements do not have a name. -- **CV_NODE_MAP** the written structure is a map (see discussion of CvFileStorage ), that - is, all its elements have names. -One and only one of the two above flags must be specified -- **CV_NODE_FLOW** the optional flag that makes sense only for YAML streams. It means that - the structure is written as a flow (not as a block), which is more compact. It is - recommended to use this flag for structures or arrays whose elements are all scalars. -@param type_name Optional parameter - the object type name. In - case of XML it is written as a type_id attribute of the structure opening tag. In the case of - YAML it is written after a colon following the structure name (see the example in - CvFileStorage description). In case of JSON it is written as a name/value pair. - Mainly it is used with user objects. When the storage is read, the - encoded type name is used to determine the object type (see CvTypeInfo and cvFindType ). -@param attributes This parameter is not used in the current implementation - */ -CVAPI(void) cvStartWriteStruct( CvFileStorage* fs, const char* name, - int struct_flags, const char* type_name CV_DEFAULT(NULL), - CvAttrList attributes CV_DEFAULT(cvAttrList())); - -/** @brief Finishes writing to a file node collection. -@param fs File storage -@sa cvStartWriteStruct. - */ -CVAPI(void) cvEndWriteStruct( CvFileStorage* fs ); - -/** @brief Writes an integer value. - -The function writes a single integer value (with or without a name) to the file storage. -@param fs File storage -@param name Name of the written value. Should be NULL if and only if the parent structure is a -sequence. -@param value The written value - */ -CVAPI(void) cvWriteInt( CvFileStorage* fs, const char* name, int value ); - -/** @brief Writes a floating-point value. - -The function writes a single floating-point value (with or without a name) to file storage. Special -values are encoded as follows: NaN (Not A Number) as .NaN, infinity as +.Inf or -.Inf. - -The following example shows how to use the low-level writing functions to store custom structures, -such as termination criteria, without registering a new type. : -@code - void write_termcriteria( CvFileStorage* fs, const char* struct_name, - CvTermCriteria* termcrit ) - { - cvStartWriteStruct( fs, struct_name, CV_NODE_MAP, NULL, cvAttrList(0,0)); - cvWriteComment( fs, "termination criteria", 1 ); // just a description - if( termcrit->type & CV_TERMCRIT_ITER ) - cvWriteInteger( fs, "max_iterations", termcrit->max_iter ); - if( termcrit->type & CV_TERMCRIT_EPS ) - cvWriteReal( fs, "accuracy", termcrit->epsilon ); - cvEndWriteStruct( fs ); - } -@endcode -@param fs File storage -@param name Name of the written value. Should be NULL if and only if the parent structure is a -sequence. -@param value The written value -*/ -CVAPI(void) cvWriteReal( CvFileStorage* fs, const char* name, double value ); - -/** @brief Writes a text string. - -The function writes a text string to file storage. -@param fs File storage -@param name Name of the written string . Should be NULL if and only if the parent structure is a -sequence. -@param str The written text string -@param quote If non-zero, the written string is put in quotes, regardless of whether they are -required. Otherwise, if the flag is zero, quotes are used only when they are required (e.g. when -the string starts with a digit or contains spaces). - */ -CVAPI(void) cvWriteString( CvFileStorage* fs, const char* name, - const char* str, int quote CV_DEFAULT(0) ); - -/** @brief Writes a comment. - -The function writes a comment into file storage. The comments are skipped when the storage is read. -@param fs File storage -@param comment The written comment, single-line or multi-line -@param eol_comment If non-zero, the function tries to put the comment at the end of current line. -If the flag is zero, if the comment is multi-line, or if it does not fit at the end of the current -line, the comment starts a new line. - */ -CVAPI(void) cvWriteComment( CvFileStorage* fs, const char* comment, - int eol_comment ); - -/** @brief Writes an object to file storage. - -The function writes an object to file storage. First, the appropriate type info is found using -cvTypeOf. Then, the write method associated with the type info is called. - -Attributes are used to customize the writing procedure. The standard types support the following -attributes (all the dt attributes have the same format as in cvWriteRawData): - --# CvSeq - - **header_dt** description of user fields of the sequence header that follow CvSeq, or - CvChain (if the sequence is a Freeman chain) or CvContour (if the sequence is a contour or - point sequence) - - **dt** description of the sequence elements. - - **recursive** if the attribute is present and is not equal to "0" or "false", the whole - tree of sequences (contours) is stored. --# CvGraph - - **header_dt** description of user fields of the graph header that follows CvGraph; - - **vertex_dt** description of user fields of graph vertices - - **edge_dt** description of user fields of graph edges (note that the edge weight is - always written, so there is no need to specify it explicitly) - -Below is the code that creates the YAML file shown in the CvFileStorage description: -@code - #include "cxcore.h" - - int main( int argc, char** argv ) - { - CvMat* mat = cvCreateMat( 3, 3, CV_32F ); - CvFileStorage* fs = cvOpenFileStorage( "example.yml", 0, CV_STORAGE_WRITE ); - - cvSetIdentity( mat ); - cvWrite( fs, "A", mat, cvAttrList(0,0) ); - - cvReleaseFileStorage( &fs ); - cvReleaseMat( &mat ); - return 0; - } -@endcode -@param fs File storage -@param name Name of the written object. Should be NULL if and only if the parent structure is a -sequence. -@param ptr Pointer to the object -@param attributes The attributes of the object. They are specific for each particular type (see -the discussion below). - */ -CVAPI(void) cvWrite( CvFileStorage* fs, const char* name, const void* ptr, - CvAttrList attributes CV_DEFAULT(cvAttrList())); - -/** @brief Starts the next stream. - -The function finishes the currently written stream and starts the next stream. In the case of XML -the file with multiple streams looks like this: -@code{.xml} - - - - - - - ... -@endcode -The YAML file will look like this: -@code{.yaml} - %YAML 1.0 - # stream #1 data - ... - --- - # stream #2 data -@endcode -This is useful for concatenating files or for resuming the writing process. -@param fs File storage - */ -CVAPI(void) cvStartNextStream( CvFileStorage* fs ); - -/** @brief Writes multiple numbers. - -The function writes an array, whose elements consist of single or multiple numbers. The function -call can be replaced with a loop containing a few cvWriteInt and cvWriteReal calls, but a single -call is more efficient. Note that because none of the elements have a name, they should be written -to a sequence rather than a map. -@param fs File storage -@param src Pointer to the written array -@param len Number of the array elements to write -@param dt Specification of each array element, see @ref format_spec "format specification" - */ -CVAPI(void) cvWriteRawData( CvFileStorage* fs, const void* src, - int len, const char* dt ); - -/** @brief Writes multiple numbers in Base64. - -If either CV_STORAGE_WRITE_BASE64 or cv::FileStorage::WRITE_BASE64 is used, -this function will be the same as cvWriteRawData. If neither, the main -difference is that it outputs a sequence in Base64 encoding rather than -in plain text. - -This function can only be used to write a sequence with a type "binary". - -@param fs File storage -@param src Pointer to the written array -@param len Number of the array elements to write -@param dt Specification of each array element, see @ref format_spec "format specification" -*/ -CVAPI(void) cvWriteRawDataBase64( CvFileStorage* fs, const void* src, - int len, const char* dt ); - -/** @brief Returns a unique pointer for a given name. - -The function returns a unique pointer for each particular file node name. This pointer can be then -passed to the cvGetFileNode function that is faster than cvGetFileNodeByName because it compares -text strings by comparing pointers rather than the strings' content. - -Consider the following example where an array of points is encoded as a sequence of 2-entry maps: -@code - points: - - { x: 10, y: 10 } - - { x: 20, y: 20 } - - { x: 30, y: 30 } - # ... -@endcode -Then, it is possible to get hashed "x" and "y" pointers to speed up decoding of the points. : -@code - #include "cxcore.h" - - int main( int argc, char** argv ) - { - CvFileStorage* fs = cvOpenFileStorage( "points.yml", 0, CV_STORAGE_READ ); - CvStringHashNode* x_key = cvGetHashedNode( fs, "x", -1, 1 ); - CvStringHashNode* y_key = cvGetHashedNode( fs, "y", -1, 1 ); - CvFileNode* points = cvGetFileNodeByName( fs, 0, "points" ); - - if( CV_NODE_IS_SEQ(points->tag) ) - { - CvSeq* seq = points->data.seq; - int i, total = seq->total; - CvSeqReader reader; - cvStartReadSeq( seq, &reader, 0 ); - for( i = 0; i < total; i++ ) - { - CvFileNode* pt = (CvFileNode*)reader.ptr; - #if 1 // faster variant - CvFileNode* xnode = cvGetFileNode( fs, pt, x_key, 0 ); - CvFileNode* ynode = cvGetFileNode( fs, pt, y_key, 0 ); - assert( xnode && CV_NODE_IS_INT(xnode->tag) && - ynode && CV_NODE_IS_INT(ynode->tag)); - int x = xnode->data.i; // or x = cvReadInt( xnode, 0 ); - int y = ynode->data.i; // or y = cvReadInt( ynode, 0 ); - #elif 1 // slower variant; does not use x_key & y_key - CvFileNode* xnode = cvGetFileNodeByName( fs, pt, "x" ); - CvFileNode* ynode = cvGetFileNodeByName( fs, pt, "y" ); - assert( xnode && CV_NODE_IS_INT(xnode->tag) && - ynode && CV_NODE_IS_INT(ynode->tag)); - int x = xnode->data.i; // or x = cvReadInt( xnode, 0 ); - int y = ynode->data.i; // or y = cvReadInt( ynode, 0 ); - #else // the slowest yet the easiest to use variant - int x = cvReadIntByName( fs, pt, "x", 0 ); - int y = cvReadIntByName( fs, pt, "y", 0 ); - #endif - CV_NEXT_SEQ_ELEM( seq->elem_size, reader ); - printf(" - } - } - cvReleaseFileStorage( &fs ); - return 0; - } -@endcode -Please note that whatever method of accessing a map you are using, it is still much slower than -using plain sequences; for example, in the above example, it is more efficient to encode the points -as pairs of integers in a single numeric sequence. -@param fs File storage -@param name Literal node name -@param len Length of the name (if it is known apriori), or -1 if it needs to be calculated -@param create_missing Flag that specifies, whether an absent key should be added into the hash table -*/ -CVAPI(CvStringHashNode*) cvGetHashedKey( CvFileStorage* fs, const char* name, - int len CV_DEFAULT(-1), - int create_missing CV_DEFAULT(0)); - -/** @brief Retrieves one of the top-level nodes of the file storage. - -The function returns one of the top-level file nodes. The top-level nodes do not have a name, they -correspond to the streams that are stored one after another in the file storage. If the index is out -of range, the function returns a NULL pointer, so all the top-level nodes can be iterated by -subsequent calls to the function with stream_index=0,1,..., until the NULL pointer is returned. -This function can be used as a base for recursive traversal of the file storage. -@param fs File storage -@param stream_index Zero-based index of the stream. See cvStartNextStream . In most cases, -there is only one stream in the file; however, there can be several. - */ -CVAPI(CvFileNode*) cvGetRootFileNode( const CvFileStorage* fs, - int stream_index CV_DEFAULT(0) ); - -/** @brief Finds a node in a map or file storage. - -The function finds a file node. It is a faster version of cvGetFileNodeByName (see -cvGetHashedKey discussion). Also, the function can insert a new node, if it is not in the map yet. -@param fs File storage -@param map The parent map. If it is NULL, the function searches a top-level node. If both map and -key are NULLs, the function returns the root file node - a map that contains top-level nodes. -@param key Unique pointer to the node name, retrieved with cvGetHashedKey -@param create_missing Flag that specifies whether an absent node should be added to the map - */ -CVAPI(CvFileNode*) cvGetFileNode( CvFileStorage* fs, CvFileNode* map, - const CvStringHashNode* key, - int create_missing CV_DEFAULT(0) ); - -/** @brief Finds a node in a map or file storage. - -The function finds a file node by name. The node is searched either in map or, if the pointer is -NULL, among the top-level file storage nodes. Using this function for maps and cvGetSeqElem (or -sequence reader) for sequences, it is possible to navigate through the file storage. To speed up -multiple queries for a certain key (e.g., in the case of an array of structures) one may use a -combination of cvGetHashedKey and cvGetFileNode. -@param fs File storage -@param map The parent map. If it is NULL, the function searches in all the top-level nodes -(streams), starting with the first one. -@param name The file node name - */ -CVAPI(CvFileNode*) cvGetFileNodeByName( const CvFileStorage* fs, - const CvFileNode* map, - const char* name ); - -/** @brief Retrieves an integer value from a file node. - -The function returns an integer that is represented by the file node. If the file node is NULL, the -default_value is returned (thus, it is convenient to call the function right after cvGetFileNode -without checking for a NULL pointer). If the file node has type CV_NODE_INT, then node-\>data.i is -returned. If the file node has type CV_NODE_REAL, then node-\>data.f is converted to an integer -and returned. Otherwise the error is reported. -@param node File node -@param default_value The value that is returned if node is NULL - */ -CV_INLINE int cvReadInt( const CvFileNode* node, int default_value CV_DEFAULT(0) ) -{ - return !node ? default_value : - CV_NODE_IS_INT(node->tag) ? node->data.i : - CV_NODE_IS_REAL(node->tag) ? cvRound(node->data.f) : 0x7fffffff; -} - -/** @brief Finds a file node and returns its value. - -The function is a simple superposition of cvGetFileNodeByName and cvReadInt. -@param fs File storage -@param map The parent map. If it is NULL, the function searches a top-level node. -@param name The node name -@param default_value The value that is returned if the file node is not found - */ -CV_INLINE int cvReadIntByName( const CvFileStorage* fs, const CvFileNode* map, - const char* name, int default_value CV_DEFAULT(0) ) -{ - return cvReadInt( cvGetFileNodeByName( fs, map, name ), default_value ); -} - -/** @brief Retrieves a floating-point value from a file node. - -The function returns a floating-point value that is represented by the file node. If the file node -is NULL, the default_value is returned (thus, it is convenient to call the function right after -cvGetFileNode without checking for a NULL pointer). If the file node has type CV_NODE_REAL , -then node-\>data.f is returned. If the file node has type CV_NODE_INT , then node-:math:\>data.f -is converted to floating-point and returned. Otherwise the result is not determined. -@param node File node -@param default_value The value that is returned if node is NULL - */ -CV_INLINE double cvReadReal( const CvFileNode* node, double default_value CV_DEFAULT(0.) ) -{ - return !node ? default_value : - CV_NODE_IS_INT(node->tag) ? (double)node->data.i : - CV_NODE_IS_REAL(node->tag) ? node->data.f : 1e300; -} - -/** @brief Finds a file node and returns its value. - -The function is a simple superposition of cvGetFileNodeByName and cvReadReal . -@param fs File storage -@param map The parent map. If it is NULL, the function searches a top-level node. -@param name The node name -@param default_value The value that is returned if the file node is not found - */ -CV_INLINE double cvReadRealByName( const CvFileStorage* fs, const CvFileNode* map, - const char* name, double default_value CV_DEFAULT(0.) ) -{ - return cvReadReal( cvGetFileNodeByName( fs, map, name ), default_value ); -} - -/** @brief Retrieves a text string from a file node. - -The function returns a text string that is represented by the file node. If the file node is NULL, -the default_value is returned (thus, it is convenient to call the function right after -cvGetFileNode without checking for a NULL pointer). If the file node has type CV_NODE_STR , then -node-:math:\>data.str.ptr is returned. Otherwise the result is not determined. -@param node File node -@param default_value The value that is returned if node is NULL - */ -CV_INLINE const char* cvReadString( const CvFileNode* node, - const char* default_value CV_DEFAULT(NULL) ) -{ - return !node ? default_value : CV_NODE_IS_STRING(node->tag) ? node->data.str.ptr : 0; -} - -/** @brief Finds a file node by its name and returns its value. - -The function is a simple superposition of cvGetFileNodeByName and cvReadString . -@param fs File storage -@param map The parent map. If it is NULL, the function searches a top-level node. -@param name The node name -@param default_value The value that is returned if the file node is not found - */ -CV_INLINE const char* cvReadStringByName( const CvFileStorage* fs, const CvFileNode* map, - const char* name, const char* default_value CV_DEFAULT(NULL) ) -{ - return cvReadString( cvGetFileNodeByName( fs, map, name ), default_value ); -} - - -/** @brief Decodes an object and returns a pointer to it. - -The function decodes a user object (creates an object in a native representation from the file -storage subtree) and returns it. The object to be decoded must be an instance of a registered type -that supports the read method (see CvTypeInfo). The type of the object is determined by the type -name that is encoded in the file. If the object is a dynamic structure, it is created either in -memory storage and passed to cvOpenFileStorage or, if a NULL pointer was passed, in temporary -memory storage, which is released when cvReleaseFileStorage is called. Otherwise, if the object is -not a dynamic structure, it is created in a heap and should be released with a specialized function -or by using the generic cvRelease. -@param fs File storage -@param node The root object node -@param attributes Unused parameter - */ -CVAPI(void*) cvRead( CvFileStorage* fs, CvFileNode* node, - CvAttrList* attributes CV_DEFAULT(NULL)); - -/** @brief Finds an object by name and decodes it. - -The function is a simple superposition of cvGetFileNodeByName and cvRead. -@param fs File storage -@param map The parent map. If it is NULL, the function searches a top-level node. -@param name The node name -@param attributes Unused parameter - */ -CV_INLINE void* cvReadByName( CvFileStorage* fs, const CvFileNode* map, - const char* name, CvAttrList* attributes CV_DEFAULT(NULL) ) -{ - return cvRead( fs, cvGetFileNodeByName( fs, map, name ), attributes ); -} - - -/** @brief Initializes the file node sequence reader. - -The function initializes the sequence reader to read data from a file node. The initialized reader -can be then passed to cvReadRawDataSlice. -@param fs File storage -@param src The file node (a sequence) to read numbers from -@param reader Pointer to the sequence reader - */ -CVAPI(void) cvStartReadRawData( const CvFileStorage* fs, const CvFileNode* src, - CvSeqReader* reader ); - -/** @brief Initializes file node sequence reader. - -The function reads one or more elements from the file node, representing a sequence, to a -user-specified array. The total number of read sequence elements is a product of total and the -number of components in each array element. For example, if dt=2if, the function will read total\*3 -sequence elements. As with any sequence, some parts of the file node sequence can be skipped or read -repeatedly by repositioning the reader using cvSetSeqReaderPos. -@param fs File storage -@param reader The sequence reader. Initialize it with cvStartReadRawData . -@param count The number of elements to read -@param dst Pointer to the destination array -@param dt Specification of each array element. It has the same format as in cvWriteRawData . - */ -CVAPI(void) cvReadRawDataSlice( const CvFileStorage* fs, CvSeqReader* reader, - int count, void* dst, const char* dt ); - -/** @brief Reads multiple numbers. - -The function reads elements from a file node that represents a sequence of scalars. -@param fs File storage -@param src The file node (a sequence) to read numbers from -@param dst Pointer to the destination array -@param dt Specification of each array element. It has the same format as in cvWriteRawData . - */ -CVAPI(void) cvReadRawData( const CvFileStorage* fs, const CvFileNode* src, - void* dst, const char* dt ); - -/** @brief Writes a file node to another file storage. - -The function writes a copy of a file node to file storage. Possible applications of the function are -merging several file storages into one and conversion between XML, YAML and JSON formats. -@param fs Destination file storage -@param new_node_name New name of the file node in the destination file storage. To keep the -existing name, use cvcvGetFileNodeName -@param node The written node -@param embed If the written node is a collection and this parameter is not zero, no extra level of -hierarchy is created. Instead, all the elements of node are written into the currently written -structure. Of course, map elements can only be embedded into another map, and sequence elements -can only be embedded into another sequence. - */ -CVAPI(void) cvWriteFileNode( CvFileStorage* fs, const char* new_node_name, - const CvFileNode* node, int embed ); - -/** @brief Returns the name of a file node. - -The function returns the name of a file node or NULL, if the file node does not have a name or if -node is NULL. -@param node File node - */ -CVAPI(const char*) cvGetFileNodeName( const CvFileNode* node ); - -/*********************************** Adding own types ***********************************/ - -/** @brief Registers a new type. - -The function registers a new type, which is described by info . The function creates a copy of the -structure, so the user should delete it after calling the function. -@param info Type info structure - */ -CVAPI(void) cvRegisterType( const CvTypeInfo* info ); - -/** @brief Unregisters the type. - -The function unregisters a type with a specified name. If the name is unknown, it is possible to -locate the type info by an instance of the type using cvTypeOf or by iterating the type list, -starting from cvFirstType, and then calling cvUnregisterType(info-\>typeName). -@param type_name Name of an unregistered type - */ -CVAPI(void) cvUnregisterType( const char* type_name ); - -/** @brief Returns the beginning of a type list. - -The function returns the first type in the list of registered types. Navigation through the list can -be done via the prev and next fields of the CvTypeInfo structure. - */ -CVAPI(CvTypeInfo*) cvFirstType(void); - -/** @brief Finds a type by its name. - -The function finds a registered type by its name. It returns NULL if there is no type with the -specified name. -@param type_name Type name - */ -CVAPI(CvTypeInfo*) cvFindType( const char* type_name ); - -/** @brief Returns the type of an object. - -The function finds the type of a given object. It iterates through the list of registered types and -calls the is_instance function/method for every type info structure with that object until one of -them returns non-zero or until the whole list has been traversed. In the latter case, the function -returns NULL. -@param struct_ptr The object pointer - */ -CVAPI(CvTypeInfo*) cvTypeOf( const void* struct_ptr ); - -/** @brief Releases an object. - -The function finds the type of a given object and calls release with the double pointer. -@param struct_ptr Double pointer to the object - */ -CVAPI(void) cvRelease( void** struct_ptr ); - -/** @brief Makes a clone of an object. - -The function finds the type of a given object and calls clone with the passed object. Of course, if -you know the object type, for example, struct_ptr is CvMat\*, it is faster to call the specific -function, like cvCloneMat. -@param struct_ptr The object to clone - */ -CVAPI(void*) cvClone( const void* struct_ptr ); - -/** @brief Saves an object to a file. - -The function saves an object to a file. It provides a simple interface to cvWrite . -@param filename File name -@param struct_ptr Object to save -@param name Optional object name. If it is NULL, the name will be formed from filename . -@param comment Optional comment to put in the beginning of the file -@param attributes Optional attributes passed to cvWrite - */ -CVAPI(void) cvSave( const char* filename, const void* struct_ptr, - const char* name CV_DEFAULT(NULL), - const char* comment CV_DEFAULT(NULL), - CvAttrList attributes CV_DEFAULT(cvAttrList())); - -/** @brief Loads an object from a file. - -The function loads an object from a file. It basically reads the specified file, find the first -top-level node and calls cvRead for that node. If the file node does not have type information or -the type information can not be found by the type name, the function returns NULL. After the object -is loaded, the file storage is closed and all the temporary buffers are deleted. Thus, to load a -dynamic structure, such as a sequence, contour, or graph, one should pass a valid memory storage -destination to the function. -@param filename File name -@param memstorage Memory storage for dynamic structures, such as CvSeq or CvGraph . It is not used -for matrices or images. -@param name Optional object name. If it is NULL, the first top-level object in the storage will be -loaded. -@param real_name Optional output parameter that will contain the name of the loaded object -(useful if name=NULL ) - */ -CVAPI(void*) cvLoad( const char* filename, - CvMemStorage* memstorage CV_DEFAULT(NULL), - const char* name CV_DEFAULT(NULL), - const char** real_name CV_DEFAULT(NULL) ); - -/*********************************** Measuring Execution Time ***************************/ - -/** helper functions for RNG initialization and accurate time measurement: - uses internal clock counter on x86 */ -CVAPI(int64) cvGetTickCount( void ); -CVAPI(double) cvGetTickFrequency( void ); - -/*********************************** CPU capabilities ***********************************/ - -CVAPI(int) cvCheckHardwareSupport(int feature); - -/*********************************** Multi-Threading ************************************/ - -/** retrieve/set the number of threads used in OpenMP implementations */ -CVAPI(int) cvGetNumThreads( void ); -CVAPI(void) cvSetNumThreads( int threads CV_DEFAULT(0) ); -/** get index of the thread being executed */ -CVAPI(int) cvGetThreadNum( void ); - - -/********************************** Error Handling **************************************/ - -/** Get current OpenCV error status */ -CVAPI(int) cvGetErrStatus( void ); - -/** Sets error status silently */ -CVAPI(void) cvSetErrStatus( int status ); - -#define CV_ErrModeLeaf 0 /* Print error and exit program */ -#define CV_ErrModeParent 1 /* Print error and continue */ -#define CV_ErrModeSilent 2 /* Don't print and continue */ - -/** Retrieves current error processing mode */ -CVAPI(int) cvGetErrMode( void ); - -/** Sets error processing mode, returns previously used mode */ -CVAPI(int) cvSetErrMode( int mode ); - -/** Sets error status and performs some additional actions (displaying message box, - writing message to stderr, terminating application etc.) - depending on the current error mode */ -CVAPI(void) cvError( int status, const char* func_name, - const char* err_msg, const char* file_name, int line ); - -/** Retrieves textual description of the error given its code */ -CVAPI(const char*) cvErrorStr( int status ); - -/** Retrieves detailed information about the last error occurred */ -CVAPI(int) cvGetErrInfo( const char** errcode_desc, const char** description, - const char** filename, int* line ); - -/** Maps IPP error codes to the counterparts from OpenCV */ -CVAPI(int) cvErrorFromIppStatus( int ipp_status ); - -typedef int (CV_CDECL *CvErrorCallback)( int status, const char* func_name, - const char* err_msg, const char* file_name, int line, void* userdata ); - -/** Assigns a new error-handling function */ -CVAPI(CvErrorCallback) cvRedirectError( CvErrorCallback error_handler, - void* userdata CV_DEFAULT(NULL), - void** prev_userdata CV_DEFAULT(NULL) ); - -/** Output nothing */ -CVAPI(int) cvNulDevReport( int status, const char* func_name, const char* err_msg, - const char* file_name, int line, void* userdata ); - -/** Output to console(fprintf(stderr,...)) */ -CVAPI(int) cvStdErrReport( int status, const char* func_name, const char* err_msg, - const char* file_name, int line, void* userdata ); - -/** Output to MessageBox(WIN32) */ -CVAPI(int) cvGuiBoxReport( int status, const char* func_name, const char* err_msg, - const char* file_name, int line, void* userdata ); - -#define OPENCV_ERROR(status,func,context) \ -cvError((status),(func),(context),__FILE__,__LINE__) - -#define OPENCV_ASSERT(expr,func,context) \ -{if (! (expr)) \ -{OPENCV_ERROR(CV_StsInternal,(func),(context));}} - -#define OPENCV_CALL( Func ) \ -{ \ -Func; \ -} - - -/** CV_FUNCNAME macro defines icvFuncName constant which is used by CV_ERROR macro */ -#ifdef CV_NO_FUNC_NAMES -#define CV_FUNCNAME( Name ) -#define cvFuncName "" -#else -#define CV_FUNCNAME( Name ) \ -static char cvFuncName[] = Name -#endif - - -/** - CV_ERROR macro unconditionally raises error with passed code and message. - After raising error, control will be transferred to the exit label. - */ -#define CV_ERROR( Code, Msg ) \ -{ \ - cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ ); \ - __CV_EXIT__; \ -} - -/** - CV_CHECK macro checks error status after CV (or IPL) - function call. If error detected, control will be transferred to the exit - label. - */ -#define CV_CHECK() \ -{ \ - if( cvGetErrStatus() < 0 ) \ - CV_ERROR( CV_StsBackTrace, "Inner function failed." ); \ -} - - -/** - CV_CALL macro calls CV (or IPL) function, checks error status and - signals a error if the function failed. Useful in "parent node" - error processing mode - */ -#define CV_CALL( Func ) \ -{ \ - Func; \ - CV_CHECK(); \ -} - - -/** Runtime assertion macro */ -#define CV_ASSERT( Condition ) \ -{ \ - if( !(Condition) ) \ - CV_ERROR( CV_StsInternal, "Assertion: " #Condition " failed" ); \ -} - -#define __CV_BEGIN__ { -#define __CV_END__ goto exit; exit: ; } -#define __CV_EXIT__ goto exit - -/** @} core_c */ - -#ifdef __cplusplus -} // extern "C" -#endif - -#ifdef __cplusplus - -//! @addtogroup core_c_glue -//! @{ - -//! class for automatic module/RTTI data registration/unregistration -struct CV_EXPORTS CvType -{ - CvType( const char* type_name, - CvIsInstanceFunc is_instance, CvReleaseFunc release=0, - CvReadFunc read=0, CvWriteFunc write=0, CvCloneFunc clone=0 ); - ~CvType(); - CvTypeInfo* info; - - static CvTypeInfo* first; - static CvTypeInfo* last; -}; - -//! @} - -#include "opencv2/core/utility.hpp" - -namespace cv -{ - -//! @addtogroup core_c_glue -//! @{ - -/////////////////////////////////////////// glue /////////////////////////////////////////// - -//! converts array (CvMat or IplImage) to cv::Mat -CV_EXPORTS Mat cvarrToMat(const CvArr* arr, bool copyData=false, - bool allowND=true, int coiMode=0, - AutoBuffer* buf=0); - -static inline Mat cvarrToMatND(const CvArr* arr, bool copyData=false, int coiMode=0) -{ - return cvarrToMat(arr, copyData, true, coiMode); -} - - -//! extracts Channel of Interest from CvMat or IplImage and makes cv::Mat out of it. -CV_EXPORTS void extractImageCOI(const CvArr* arr, OutputArray coiimg, int coi=-1); -//! inserts single-channel cv::Mat into a multi-channel CvMat or IplImage -CV_EXPORTS void insertImageCOI(InputArray coiimg, CvArr* arr, int coi=-1); - - - -////// specialized implementations of DefaultDeleter::operator() for classic OpenCV types ////// - -template<> CV_EXPORTS void DefaultDeleter::operator ()(CvMat* obj) const; -template<> CV_EXPORTS void DefaultDeleter::operator ()(IplImage* obj) const; -template<> CV_EXPORTS void DefaultDeleter::operator ()(CvMatND* obj) const; -template<> CV_EXPORTS void DefaultDeleter::operator ()(CvSparseMat* obj) const; -template<> CV_EXPORTS void DefaultDeleter::operator ()(CvMemStorage* obj) const; - -////////////// convenient wrappers for operating old-style dynamic structures ////////////// - -template class SeqIterator; - -typedef Ptr MemStorage; - -/*! - Template Sequence Class derived from CvSeq - - The class provides more convenient access to sequence elements, - STL-style operations and iterators. - - \note The class is targeted for simple data types, - i.e. no constructors or destructors - are called for the sequence elements. -*/ -template class Seq -{ -public: - typedef SeqIterator<_Tp> iterator; - typedef SeqIterator<_Tp> const_iterator; - - //! the default constructor - Seq(); - //! the constructor for wrapping CvSeq structure. The real element type in CvSeq should match _Tp. - Seq(const CvSeq* seq); - //! creates the empty sequence that resides in the specified storage - Seq(MemStorage& storage, int headerSize = sizeof(CvSeq)); - //! returns read-write reference to the specified element - _Tp& operator [](int idx); - //! returns read-only reference to the specified element - const _Tp& operator[](int idx) const; - //! returns iterator pointing to the beginning of the sequence - SeqIterator<_Tp> begin() const; - //! returns iterator pointing to the element following the last sequence element - SeqIterator<_Tp> end() const; - //! returns the number of elements in the sequence - size_t size() const; - //! returns the type of sequence elements (CV_8UC1 ... CV_64FC(CV_CN_MAX) ...) - int type() const; - //! returns the depth of sequence elements (CV_8U ... CV_64F) - int depth() const; - //! returns the number of channels in each sequence element - int channels() const; - //! returns the size of each sequence element - size_t elemSize() const; - //! returns index of the specified sequence element - size_t index(const _Tp& elem) const; - //! appends the specified element to the end of the sequence - void push_back(const _Tp& elem); - //! appends the specified element to the front of the sequence - void push_front(const _Tp& elem); - //! appends zero or more elements to the end of the sequence - void push_back(const _Tp* elems, size_t count); - //! appends zero or more elements to the front of the sequence - void push_front(const _Tp* elems, size_t count); - //! inserts the specified element to the specified position - void insert(int idx, const _Tp& elem); - //! inserts zero or more elements to the specified position - void insert(int idx, const _Tp* elems, size_t count); - //! removes element at the specified position - void remove(int idx); - //! removes the specified subsequence - void remove(const Range& r); - - //! returns reference to the first sequence element - _Tp& front(); - //! returns read-only reference to the first sequence element - const _Tp& front() const; - //! returns reference to the last sequence element - _Tp& back(); - //! returns read-only reference to the last sequence element - const _Tp& back() const; - //! returns true iff the sequence contains no elements - bool empty() const; - - //! removes all the elements from the sequence - void clear(); - //! removes the first element from the sequence - void pop_front(); - //! removes the last element from the sequence - void pop_back(); - //! removes zero or more elements from the beginning of the sequence - void pop_front(_Tp* elems, size_t count); - //! removes zero or more elements from the end of the sequence - void pop_back(_Tp* elems, size_t count); - - //! copies the whole sequence or the sequence slice to the specified vector - void copyTo(std::vector<_Tp>& vec, const Range& range=Range::all()) const; - //! returns the vector containing all the sequence elements - operator std::vector<_Tp>() const; - - CvSeq* seq; -}; - - -/*! - STL-style Sequence Iterator inherited from the CvSeqReader structure -*/ -template class SeqIterator : public CvSeqReader -{ -public: - //! the default constructor - SeqIterator(); - //! the constructor setting the iterator to the beginning or to the end of the sequence - SeqIterator(const Seq<_Tp>& seq, bool seekEnd=false); - //! positions the iterator within the sequence - void seek(size_t pos); - //! reports the current iterator position - size_t tell() const; - //! returns reference to the current sequence element - _Tp& operator *(); - //! returns read-only reference to the current sequence element - const _Tp& operator *() const; - //! moves iterator to the next sequence element - SeqIterator& operator ++(); - //! moves iterator to the next sequence element - SeqIterator operator ++(int) const; - //! moves iterator to the previous sequence element - SeqIterator& operator --(); - //! moves iterator to the previous sequence element - SeqIterator operator --(int) const; - - //! moves iterator forward by the specified offset (possibly negative) - SeqIterator& operator +=(int); - //! moves iterator backward by the specified offset (possibly negative) - SeqIterator& operator -=(int); - - // this is index of the current element module seq->total*2 - // (to distinguish between 0 and seq->total) - int index; -}; - - - -// bridge C++ => C Seq API -CV_EXPORTS schar* seqPush( CvSeq* seq, const void* element=0); -CV_EXPORTS schar* seqPushFront( CvSeq* seq, const void* element=0); -CV_EXPORTS void seqPop( CvSeq* seq, void* element=0); -CV_EXPORTS void seqPopFront( CvSeq* seq, void* element=0); -CV_EXPORTS void seqPopMulti( CvSeq* seq, void* elements, - int count, int in_front=0 ); -CV_EXPORTS void seqRemove( CvSeq* seq, int index ); -CV_EXPORTS void clearSeq( CvSeq* seq ); -CV_EXPORTS schar* getSeqElem( const CvSeq* seq, int index ); -CV_EXPORTS void seqRemoveSlice( CvSeq* seq, CvSlice slice ); -CV_EXPORTS void seqInsertSlice( CvSeq* seq, int before_index, const CvArr* from_arr ); - -template inline Seq<_Tp>::Seq() : seq(0) {} -template inline Seq<_Tp>::Seq( const CvSeq* _seq ) : seq((CvSeq*)_seq) -{ - CV_Assert(!_seq || _seq->elem_size == sizeof(_Tp)); -} - -template inline Seq<_Tp>::Seq( MemStorage& storage, - int headerSize ) -{ - CV_Assert(headerSize >= (int)sizeof(CvSeq)); - seq = cvCreateSeq(DataType<_Tp>::type, headerSize, sizeof(_Tp), storage); -} - -template inline _Tp& Seq<_Tp>::operator [](int idx) -{ return *(_Tp*)getSeqElem(seq, idx); } - -template inline const _Tp& Seq<_Tp>::operator [](int idx) const -{ return *(_Tp*)getSeqElem(seq, idx); } - -template inline SeqIterator<_Tp> Seq<_Tp>::begin() const -{ return SeqIterator<_Tp>(*this); } - -template inline SeqIterator<_Tp> Seq<_Tp>::end() const -{ return SeqIterator<_Tp>(*this, true); } - -template inline size_t Seq<_Tp>::size() const -{ return seq ? seq->total : 0; } - -template inline int Seq<_Tp>::type() const -{ return seq ? CV_MAT_TYPE(seq->flags) : 0; } - -template inline int Seq<_Tp>::depth() const -{ return seq ? CV_MAT_DEPTH(seq->flags) : 0; } - -template inline int Seq<_Tp>::channels() const -{ return seq ? CV_MAT_CN(seq->flags) : 0; } - -template inline size_t Seq<_Tp>::elemSize() const -{ return seq ? seq->elem_size : 0; } - -template inline size_t Seq<_Tp>::index(const _Tp& elem) const -{ return cvSeqElemIdx(seq, &elem); } - -template inline void Seq<_Tp>::push_back(const _Tp& elem) -{ cvSeqPush(seq, &elem); } - -template inline void Seq<_Tp>::push_front(const _Tp& elem) -{ cvSeqPushFront(seq, &elem); } - -template inline void Seq<_Tp>::push_back(const _Tp* elem, size_t count) -{ cvSeqPushMulti(seq, elem, (int)count, 0); } - -template inline void Seq<_Tp>::push_front(const _Tp* elem, size_t count) -{ cvSeqPushMulti(seq, elem, (int)count, 1); } - -template inline _Tp& Seq<_Tp>::back() -{ return *(_Tp*)getSeqElem(seq, -1); } - -template inline const _Tp& Seq<_Tp>::back() const -{ return *(const _Tp*)getSeqElem(seq, -1); } - -template inline _Tp& Seq<_Tp>::front() -{ return *(_Tp*)getSeqElem(seq, 0); } - -template inline const _Tp& Seq<_Tp>::front() const -{ return *(const _Tp*)getSeqElem(seq, 0); } - -template inline bool Seq<_Tp>::empty() const -{ return !seq || seq->total == 0; } - -template inline void Seq<_Tp>::clear() -{ if(seq) clearSeq(seq); } - -template inline void Seq<_Tp>::pop_back() -{ seqPop(seq); } - -template inline void Seq<_Tp>::pop_front() -{ seqPopFront(seq); } - -template inline void Seq<_Tp>::pop_back(_Tp* elem, size_t count) -{ seqPopMulti(seq, elem, (int)count, 0); } - -template inline void Seq<_Tp>::pop_front(_Tp* elem, size_t count) -{ seqPopMulti(seq, elem, (int)count, 1); } - -template inline void Seq<_Tp>::insert(int idx, const _Tp& elem) -{ seqInsert(seq, idx, &elem); } - -template inline void Seq<_Tp>::insert(int idx, const _Tp* elems, size_t count) -{ - CvMat m = cvMat(1, count, DataType<_Tp>::type, elems); - seqInsertSlice(seq, idx, &m); -} - -template inline void Seq<_Tp>::remove(int idx) -{ seqRemove(seq, idx); } - -template inline void Seq<_Tp>::remove(const Range& r) -{ seqRemoveSlice(seq, cvSlice(r.start, r.end)); } - -template inline void Seq<_Tp>::copyTo(std::vector<_Tp>& vec, const Range& range) const -{ - size_t len = !seq ? 0 : range == Range::all() ? seq->total : range.end - range.start; - vec.resize(len); - if( seq && len ) - cvCvtSeqToArray(seq, &vec[0], cvSlice(range)); -} - -template inline Seq<_Tp>::operator std::vector<_Tp>() const -{ - std::vector<_Tp> vec; - copyTo(vec); - return vec; -} - -template inline SeqIterator<_Tp>::SeqIterator() -{ memset(this, 0, sizeof(*this)); } - -template inline SeqIterator<_Tp>::SeqIterator(const Seq<_Tp>& _seq, bool seekEnd) -{ - cvStartReadSeq(_seq.seq, this); - index = seekEnd ? _seq.seq->total : 0; -} - -template inline void SeqIterator<_Tp>::seek(size_t pos) -{ - cvSetSeqReaderPos(this, (int)pos, false); - index = pos; -} - -template inline size_t SeqIterator<_Tp>::tell() const -{ return index; } - -template inline _Tp& SeqIterator<_Tp>::operator *() -{ return *(_Tp*)ptr; } - -template inline const _Tp& SeqIterator<_Tp>::operator *() const -{ return *(const _Tp*)ptr; } - -template inline SeqIterator<_Tp>& SeqIterator<_Tp>::operator ++() -{ - CV_NEXT_SEQ_ELEM(sizeof(_Tp), *this); - if( ++index >= seq->total*2 ) - index = 0; - return *this; -} - -template inline SeqIterator<_Tp> SeqIterator<_Tp>::operator ++(int) const -{ - SeqIterator<_Tp> it = *this; - ++*this; - return it; -} - -template inline SeqIterator<_Tp>& SeqIterator<_Tp>::operator --() -{ - CV_PREV_SEQ_ELEM(sizeof(_Tp), *this); - if( --index < 0 ) - index = seq->total*2-1; - return *this; -} - -template inline SeqIterator<_Tp> SeqIterator<_Tp>::operator --(int) const -{ - SeqIterator<_Tp> it = *this; - --*this; - return it; -} - -template inline SeqIterator<_Tp>& SeqIterator<_Tp>::operator +=(int delta) -{ - cvSetSeqReaderPos(this, delta, 1); - index += delta; - int n = seq->total*2; - if( index < 0 ) - index += n; - if( index >= n ) - index -= n; - return *this; -} - -template inline SeqIterator<_Tp>& SeqIterator<_Tp>::operator -=(int delta) -{ - return (*this += -delta); -} - -template inline ptrdiff_t operator - (const SeqIterator<_Tp>& a, - const SeqIterator<_Tp>& b) -{ - ptrdiff_t delta = a.index - b.index, n = a.seq->total; - if( delta > n || delta < -n ) - delta += delta < 0 ? n : -n; - return delta; -} - -template inline bool operator == (const SeqIterator<_Tp>& a, - const SeqIterator<_Tp>& b) -{ - return a.seq == b.seq && a.index == b.index; -} - -template inline bool operator != (const SeqIterator<_Tp>& a, - const SeqIterator<_Tp>& b) -{ - return !(a == b); -} - -//! @} - -} // cv - -#endif - -#endif diff --git a/opencv/include/opencv2/core/cuda.hpp b/opencv/include/opencv2/core/cuda.hpp deleted file mode 100644 index 820aba7..0000000 --- a/opencv/include/opencv2/core/cuda.hpp +++ /dev/null @@ -1,1049 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_CUDA_HPP -#define OPENCV_CORE_CUDA_HPP - -#ifndef __cplusplus -# error cuda.hpp header must be compiled as C++ -#endif - -#include "opencv2/core.hpp" -#include "opencv2/core/cuda_types.hpp" - -/** - @defgroup cuda CUDA-accelerated Computer Vision - @{ - @defgroup cudacore Core part - @{ - @defgroup cudacore_init Initialization and Information - @defgroup cudacore_struct Data Structures - @} - @} - */ - -namespace cv { namespace cuda { - -//! @addtogroup cudacore_struct -//! @{ - -//=================================================================================== -// GpuMat -//=================================================================================== - -/** @brief Base storage class for GPU memory with reference counting. - -Its interface matches the Mat interface with the following limitations: - -- no arbitrary dimensions support (only 2D) -- no functions that return references to their data (because references on GPU are not valid for - CPU) -- no expression templates technique support - -Beware that the latter limitation may lead to overloaded matrix operators that cause memory -allocations. The GpuMat class is convertible to cuda::PtrStepSz and cuda::PtrStep so it can be -passed directly to the kernel. - -@note In contrast with Mat, in most cases GpuMat::isContinuous() == false . This means that rows are -aligned to a size depending on the hardware. Single-row GpuMat is always a continuous matrix. - -@note You are not recommended to leave static or global GpuMat variables allocated, that is, to rely -on its destructor. The destruction order of such variables and CUDA context is undefined. GPU memory -release function returns error if the CUDA context has been destroyed before. - -Some member functions are described as a "Blocking Call" while some are described as a -"Non-Blocking Call". Blocking functions are synchronous to host. It is guaranteed that the GPU -operation is finished when the function returns. However, non-blocking functions are asynchronous to -host. Those functions may return even if the GPU operation is not finished. - -Compared to their blocking counterpart, non-blocking functions accept Stream as an additional -argument. If a non-default stream is passed, the GPU operation may overlap with operations in other -streams. - -@sa Mat - */ -class CV_EXPORTS GpuMat -{ -public: - class CV_EXPORTS Allocator - { - public: - virtual ~Allocator() {} - - // allocator must fill data, step and refcount fields - virtual bool allocate(GpuMat* mat, int rows, int cols, size_t elemSize) = 0; - virtual void free(GpuMat* mat) = 0; - }; - - //! default allocator - static Allocator* defaultAllocator(); - static void setDefaultAllocator(Allocator* allocator); - - //! default constructor - explicit GpuMat(Allocator* allocator = defaultAllocator()); - - //! constructs GpuMat of the specified size and type - GpuMat(int rows, int cols, int type, Allocator* allocator = defaultAllocator()); - GpuMat(Size size, int type, Allocator* allocator = defaultAllocator()); - - //! constucts GpuMat and fills it with the specified value _s - GpuMat(int rows, int cols, int type, Scalar s, Allocator* allocator = defaultAllocator()); - GpuMat(Size size, int type, Scalar s, Allocator* allocator = defaultAllocator()); - - //! copy constructor - GpuMat(const GpuMat& m); - - //! constructor for GpuMat headers pointing to user-allocated data - GpuMat(int rows, int cols, int type, void* data, size_t step = Mat::AUTO_STEP); - GpuMat(Size size, int type, void* data, size_t step = Mat::AUTO_STEP); - - //! creates a GpuMat header for a part of the bigger matrix - GpuMat(const GpuMat& m, Range rowRange, Range colRange); - GpuMat(const GpuMat& m, Rect roi); - - //! builds GpuMat from host memory (Blocking call) - explicit GpuMat(InputArray arr, Allocator* allocator = defaultAllocator()); - - //! destructor - calls release() - ~GpuMat(); - - //! assignment operators - GpuMat& operator =(const GpuMat& m); - - //! allocates new GpuMat data unless the GpuMat already has specified size and type - void create(int rows, int cols, int type); - void create(Size size, int type); - - //! decreases reference counter, deallocate the data when reference counter reaches 0 - void release(); - - //! swaps with other smart pointer - void swap(GpuMat& mat); - - /** @brief Performs data upload to GpuMat (Blocking call) - - This function copies data from host memory to device memory. As being a blocking call, it is - guaranteed that the copy operation is finished when this function returns. - */ - void upload(InputArray arr); - - /** @brief Performs data upload to GpuMat (Non-Blocking call) - - This function copies data from host memory to device memory. As being a non-blocking call, this - function may return even if the copy operation is not finished. - - The copy operation may be overlapped with operations in other non-default streams if \p stream is - not the default stream and \p dst is HostMem allocated with HostMem::PAGE_LOCKED option. - */ - void upload(InputArray arr, Stream& stream); - - /** @brief Performs data download from GpuMat (Blocking call) - - This function copies data from device memory to host memory. As being a blocking call, it is - guaranteed that the copy operation is finished when this function returns. - */ - void download(OutputArray dst) const; - - /** @brief Performs data download from GpuMat (Non-Blocking call) - - This function copies data from device memory to host memory. As being a non-blocking call, this - function may return even if the copy operation is not finished. - - The copy operation may be overlapped with operations in other non-default streams if \p stream is - not the default stream and \p dst is HostMem allocated with HostMem::PAGE_LOCKED option. - */ - void download(OutputArray dst, Stream& stream) const; - - //! returns deep copy of the GpuMat, i.e. the data is copied - GpuMat clone() const; - - //! copies the GpuMat content to device memory (Blocking call) - void copyTo(OutputArray dst) const; - - //! copies the GpuMat content to device memory (Non-Blocking call) - void copyTo(OutputArray dst, Stream& stream) const; - - //! copies those GpuMat elements to "m" that are marked with non-zero mask elements (Blocking call) - void copyTo(OutputArray dst, InputArray mask) const; - - //! copies those GpuMat elements to "m" that are marked with non-zero mask elements (Non-Blocking call) - void copyTo(OutputArray dst, InputArray mask, Stream& stream) const; - - //! sets some of the GpuMat elements to s (Blocking call) - GpuMat& setTo(Scalar s); - - //! sets some of the GpuMat elements to s (Non-Blocking call) - GpuMat& setTo(Scalar s, Stream& stream); - - //! sets some of the GpuMat elements to s, according to the mask (Blocking call) - GpuMat& setTo(Scalar s, InputArray mask); - - //! sets some of the GpuMat elements to s, according to the mask (Non-Blocking call) - GpuMat& setTo(Scalar s, InputArray mask, Stream& stream); - - //! converts GpuMat to another datatype (Blocking call) - void convertTo(OutputArray dst, int rtype) const; - - //! converts GpuMat to another datatype (Non-Blocking call) - void convertTo(OutputArray dst, int rtype, Stream& stream) const; - - //! converts GpuMat to another datatype with scaling (Blocking call) - void convertTo(OutputArray dst, int rtype, double alpha, double beta = 0.0) const; - - //! converts GpuMat to another datatype with scaling (Non-Blocking call) - void convertTo(OutputArray dst, int rtype, double alpha, Stream& stream) const; - - //! converts GpuMat to another datatype with scaling (Non-Blocking call) - void convertTo(OutputArray dst, int rtype, double alpha, double beta, Stream& stream) const; - - void assignTo(GpuMat& m, int type=-1) const; - - //! returns pointer to y-th row - uchar* ptr(int y = 0); - const uchar* ptr(int y = 0) const; - - //! template version of the above method - template _Tp* ptr(int y = 0); - template const _Tp* ptr(int y = 0) const; - - template operator PtrStepSz<_Tp>() const; - template operator PtrStep<_Tp>() const; - - //! returns a new GpuMat header for the specified row - GpuMat row(int y) const; - - //! returns a new GpuMat header for the specified column - GpuMat col(int x) const; - - //! ... for the specified row span - GpuMat rowRange(int startrow, int endrow) const; - GpuMat rowRange(Range r) const; - - //! ... for the specified column span - GpuMat colRange(int startcol, int endcol) const; - GpuMat colRange(Range r) const; - - //! extracts a rectangular sub-GpuMat (this is a generalized form of row, rowRange etc.) - GpuMat operator ()(Range rowRange, Range colRange) const; - GpuMat operator ()(Rect roi) const; - - //! creates alternative GpuMat header for the same data, with different - //! number of channels and/or different number of rows - GpuMat reshape(int cn, int rows = 0) const; - - //! locates GpuMat header within a parent GpuMat - void locateROI(Size& wholeSize, Point& ofs) const; - - //! moves/resizes the current GpuMat ROI inside the parent GpuMat - GpuMat& adjustROI(int dtop, int dbottom, int dleft, int dright); - - //! returns true iff the GpuMat data is continuous - //! (i.e. when there are no gaps between successive rows) - bool isContinuous() const; - - //! returns element size in bytes - size_t elemSize() const; - - //! returns the size of element channel in bytes - size_t elemSize1() const; - - //! returns element type - int type() const; - - //! returns element type - int depth() const; - - //! returns number of channels - int channels() const; - - //! returns step/elemSize1() - size_t step1() const; - - //! returns GpuMat size : width == number of columns, height == number of rows - Size size() const; - - //! returns true if GpuMat data is NULL - bool empty() const; - - //! internal use method: updates the continuity flag - void updateContinuityFlag(); - - /*! includes several bit-fields: - - the magic signature - - continuity flag - - depth - - number of channels - */ - int flags; - - //! the number of rows and columns - int rows, cols; - - //! a distance between successive rows in bytes; includes the gap if any - size_t step; - - //! pointer to the data - uchar* data; - - //! pointer to the reference counter; - //! when GpuMat points to user-allocated data, the pointer is NULL - int* refcount; - - //! helper fields used in locateROI and adjustROI - uchar* datastart; - const uchar* dataend; - - //! allocator - Allocator* allocator; -}; - -/** @brief Creates a continuous matrix. - -@param rows Row count. -@param cols Column count. -@param type Type of the matrix. -@param arr Destination matrix. This parameter changes only if it has a proper type and area ( -\f$\texttt{rows} \times \texttt{cols}\f$ ). - -Matrix is called continuous if its elements are stored continuously, that is, without gaps at the -end of each row. - */ -CV_EXPORTS void createContinuous(int rows, int cols, int type, OutputArray arr); - -/** @brief Ensures that the size of a matrix is big enough and the matrix has a proper type. - -@param rows Minimum desired number of rows. -@param cols Minimum desired number of columns. -@param type Desired matrix type. -@param arr Destination matrix. - -The function does not reallocate memory if the matrix has proper attributes already. - */ -CV_EXPORTS void ensureSizeIsEnough(int rows, int cols, int type, OutputArray arr); - -/** @brief BufferPool for use with CUDA streams - -BufferPool utilizes Stream's allocator to create new buffers for GpuMat's. It is -only useful when enabled with #setBufferPoolUsage. - -@code - setBufferPoolUsage(true); -@endcode - -@note #setBufferPoolUsage must be called \em before any Stream declaration. - -Users may specify custom allocator for Stream and may implement their own stream based -functions utilizing the same underlying GPU memory management. - -If custom allocator is not specified, BufferPool utilizes StackAllocator by -default. StackAllocator allocates a chunk of GPU device memory beforehand, -and when GpuMat is declared later on, it is given the pre-allocated memory. -This kind of strategy reduces the number of calls for memory allocating APIs -such as cudaMalloc or cudaMallocPitch. - -Below is an example that utilizes BufferPool with StackAllocator: - -@code - #include - - using namespace cv; - using namespace cv::cuda - - int main() - { - setBufferPoolUsage(true); // Tell OpenCV that we are going to utilize BufferPool - setBufferPoolConfig(getDevice(), 1024 * 1024 * 64, 2); // Allocate 64 MB, 2 stacks (default is 10 MB, 5 stacks) - - Stream stream1, stream2; // Each stream uses 1 stack - BufferPool pool1(stream1), pool2(stream2); - - GpuMat d_src1 = pool1.getBuffer(4096, 4096, CV_8UC1); // 16MB - GpuMat d_dst1 = pool1.getBuffer(4096, 4096, CV_8UC3); // 48MB, pool1 is now full - - GpuMat d_src2 = pool2.getBuffer(1024, 1024, CV_8UC1); // 1MB - GpuMat d_dst2 = pool2.getBuffer(1024, 1024, CV_8UC3); // 3MB - - cvtColor(d_src1, d_dst1, CV_GRAY2BGR, 0, stream1); - cvtColor(d_src2, d_dst2, CV_GRAY2BGR, 0, stream2); - } -@endcode - -If we allocate another GpuMat on pool1 in the above example, it will be carried out by -the DefaultAllocator since the stack for pool1 is full. - -@code - GpuMat d_add1 = pool1.getBuffer(1024, 1024, CV_8UC1); // Stack for pool1 is full, memory is allocated with DefaultAllocator -@endcode - -If a third stream is declared in the above example, allocating with #getBuffer -within that stream will also be carried out by the DefaultAllocator because we've run out of -stacks. - -@code - Stream stream3; // Only 2 stacks were allocated, we've run out of stacks - BufferPool pool3(stream3); - GpuMat d_src3 = pool3.getBuffer(1024, 1024, CV_8UC1); // Memory is allocated with DefaultAllocator -@endcode - -@warning When utilizing StackAllocator, deallocation order is important. - -Just like a stack, deallocation must be done in LIFO order. Below is an example of -erroneous usage that violates LIFO rule. If OpenCV is compiled in Debug mode, this -sample code will emit CV_Assert error. - -@code - int main() - { - setBufferPoolUsage(true); // Tell OpenCV that we are going to utilize BufferPool - Stream stream; // A default size (10 MB) stack is allocated to this stream - BufferPool pool(stream); - - GpuMat mat1 = pool.getBuffer(1024, 1024, CV_8UC1); // Allocate mat1 (1MB) - GpuMat mat2 = pool.getBuffer(1024, 1024, CV_8UC1); // Allocate mat2 (1MB) - - mat1.release(); // erroneous usage : mat2 must be deallocated before mat1 - } -@endcode - -Since C++ local variables are destroyed in the reverse order of construction, -the code sample below satisfies the LIFO rule. Local GpuMat's are deallocated -and the corresponding memory is automatically returned to the pool for later usage. - -@code - int main() - { - setBufferPoolUsage(true); // Tell OpenCV that we are going to utilize BufferPool - setBufferPoolConfig(getDevice(), 1024 * 1024 * 64, 2); // Allocate 64 MB, 2 stacks (default is 10 MB, 5 stacks) - - Stream stream1, stream2; // Each stream uses 1 stack - BufferPool pool1(stream1), pool2(stream2); - - for (int i = 0; i < 10; i++) - { - GpuMat d_src1 = pool1.getBuffer(4096, 4096, CV_8UC1); // 16MB - GpuMat d_dst1 = pool1.getBuffer(4096, 4096, CV_8UC3); // 48MB, pool1 is now full - - GpuMat d_src2 = pool2.getBuffer(1024, 1024, CV_8UC1); // 1MB - GpuMat d_dst2 = pool2.getBuffer(1024, 1024, CV_8UC3); // 3MB - - d_src1.setTo(Scalar(i), stream1); - d_src2.setTo(Scalar(i), stream2); - - cvtColor(d_src1, d_dst1, CV_GRAY2BGR, 0, stream1); - cvtColor(d_src2, d_dst2, CV_GRAY2BGR, 0, stream2); - // The order of destruction of the local variables is: - // d_dst2 => d_src2 => d_dst1 => d_src1 - // LIFO rule is satisfied, this code runs without error - } - } -@endcode - */ -class CV_EXPORTS BufferPool -{ -public: - - //! Gets the BufferPool for the given stream. - explicit BufferPool(Stream& stream); - - //! Allocates a new GpuMat of given size and type. - GpuMat getBuffer(int rows, int cols, int type); - - //! Allocates a new GpuMat of given size and type. - GpuMat getBuffer(Size size, int type) { return getBuffer(size.height, size.width, type); } - - //! Returns the allocator associated with the stream. - Ptr getAllocator() const { return allocator_; } - -private: - Ptr allocator_; -}; - -//! BufferPool management (must be called before Stream creation) -CV_EXPORTS void setBufferPoolUsage(bool on); -CV_EXPORTS void setBufferPoolConfig(int deviceId, size_t stackSize, int stackCount); - -//=================================================================================== -// HostMem -//=================================================================================== - -/** @brief Class with reference counting wrapping special memory type allocation functions from CUDA. - -Its interface is also Mat-like but with additional memory type parameters. - -- **PAGE_LOCKED** sets a page locked memory type used commonly for fast and asynchronous - uploading/downloading data from/to GPU. -- **SHARED** specifies a zero copy memory allocation that enables mapping the host memory to GPU - address space, if supported. -- **WRITE_COMBINED** sets the write combined buffer that is not cached by CPU. Such buffers are - used to supply GPU with data when GPU only reads it. The advantage is a better CPU cache - utilization. - -@note Allocation size of such memory types is usually limited. For more details, see *CUDA 2.2 -Pinned Memory APIs* document or *CUDA C Programming Guide*. - */ -class CV_EXPORTS HostMem -{ -public: - enum AllocType { PAGE_LOCKED = 1, SHARED = 2, WRITE_COMBINED = 4 }; - - static MatAllocator* getAllocator(AllocType alloc_type = PAGE_LOCKED); - - explicit HostMem(AllocType alloc_type = PAGE_LOCKED); - - HostMem(const HostMem& m); - - HostMem(int rows, int cols, int type, AllocType alloc_type = PAGE_LOCKED); - HostMem(Size size, int type, AllocType alloc_type = PAGE_LOCKED); - - //! creates from host memory with coping data - explicit HostMem(InputArray arr, AllocType alloc_type = PAGE_LOCKED); - - ~HostMem(); - - HostMem& operator =(const HostMem& m); - - //! swaps with other smart pointer - void swap(HostMem& b); - - //! returns deep copy of the matrix, i.e. the data is copied - HostMem clone() const; - - //! allocates new matrix data unless the matrix already has specified size and type. - void create(int rows, int cols, int type); - void create(Size size, int type); - - //! creates alternative HostMem header for the same data, with different - //! number of channels and/or different number of rows - HostMem reshape(int cn, int rows = 0) const; - - //! decrements reference counter and released memory if needed. - void release(); - - //! returns matrix header with disabled reference counting for HostMem data. - Mat createMatHeader() const; - - /** @brief Maps CPU memory to GPU address space and creates the cuda::GpuMat header without reference counting - for it. - - This can be done only if memory was allocated with the SHARED flag and if it is supported by the - hardware. Laptops often share video and CPU memory, so address spaces can be mapped, which - eliminates an extra copy. - */ - GpuMat createGpuMatHeader() const; - - // Please see cv::Mat for descriptions - bool isContinuous() const; - size_t elemSize() const; - size_t elemSize1() const; - int type() const; - int depth() const; - int channels() const; - size_t step1() const; - Size size() const; - bool empty() const; - - // Please see cv::Mat for descriptions - int flags; - int rows, cols; - size_t step; - - uchar* data; - int* refcount; - - uchar* datastart; - const uchar* dataend; - - AllocType alloc_type; -}; - -/** @brief Page-locks the memory of matrix and maps it for the device(s). - -@param m Input matrix. - */ -CV_EXPORTS void registerPageLocked(Mat& m); - -/** @brief Unmaps the memory of matrix and makes it pageable again. - -@param m Input matrix. - */ -CV_EXPORTS void unregisterPageLocked(Mat& m); - -//=================================================================================== -// Stream -//=================================================================================== - -/** @brief This class encapsulates a queue of asynchronous calls. - -@note Currently, you may face problems if an operation is enqueued twice with different data. Some -functions use the constant GPU memory, and next call may update the memory before the previous one -has been finished. But calling different operations asynchronously is safe because each operation -has its own constant buffer. Memory copy/upload/download/set operations to the buffers you hold are -also safe. - -@note The Stream class is not thread-safe. Please use different Stream objects for different CPU threads. - -@code -void thread1() -{ - cv::cuda::Stream stream1; - cv::cuda::func1(..., stream1); -} - -void thread2() -{ - cv::cuda::Stream stream2; - cv::cuda::func2(..., stream2); -} -@endcode - -@note By default all CUDA routines are launched in Stream::Null() object, if the stream is not specified by user. -In multi-threading environment the stream objects must be passed explicitly (see previous note). - */ -class CV_EXPORTS Stream -{ - typedef void (Stream::*bool_type)() const; - void this_type_does_not_support_comparisons() const {} - -public: - typedef void (*StreamCallback)(int status, void* userData); - - //! creates a new asynchronous stream - Stream(); - - //! creates a new asynchronous stream with custom allocator - Stream(const Ptr& allocator); - - /** @brief Returns true if the current stream queue is finished. Otherwise, it returns false. - */ - bool queryIfComplete() const; - - /** @brief Blocks the current CPU thread until all operations in the stream are complete. - */ - void waitForCompletion(); - - /** @brief Makes a compute stream wait on an event. - */ - void waitEvent(const Event& event); - - /** @brief Adds a callback to be called on the host after all currently enqueued items in the stream have - completed. - - @note Callbacks must not make any CUDA API calls. Callbacks must not perform any synchronization - that may depend on outstanding device work or other callbacks that are not mandated to run earlier. - Callbacks without a mandated order (in independent streams) execute in undefined order and may be - serialized. - */ - void enqueueHostCallback(StreamCallback callback, void* userData); - - //! return Stream object for default CUDA stream - static Stream& Null(); - - //! returns true if stream object is not default (!= 0) - operator bool_type() const; - - class Impl; - -private: - Ptr impl_; - Stream(const Ptr& impl); - - friend struct StreamAccessor; - friend class BufferPool; - friend class DefaultDeviceInitializer; -}; - -class CV_EXPORTS Event -{ -public: - enum CreateFlags - { - DEFAULT = 0x00, /**< Default event flag */ - BLOCKING_SYNC = 0x01, /**< Event uses blocking synchronization */ - DISABLE_TIMING = 0x02, /**< Event will not record timing data */ - INTERPROCESS = 0x04 /**< Event is suitable for interprocess use. DisableTiming must be set */ - }; - - explicit Event(CreateFlags flags = DEFAULT); - - //! records an event - void record(Stream& stream = Stream::Null()); - - //! queries an event's status - bool queryIfComplete() const; - - //! waits for an event to complete - void waitForCompletion(); - - //! computes the elapsed time between events - static float elapsedTime(const Event& start, const Event& end); - - class Impl; - -private: - Ptr impl_; - Event(const Ptr& impl); - - friend struct EventAccessor; -}; - -//! @} cudacore_struct - -//=================================================================================== -// Initialization & Info -//=================================================================================== - -//! @addtogroup cudacore_init -//! @{ - -/** @brief Returns the number of installed CUDA-enabled devices. - -Use this function before any other CUDA functions calls. If OpenCV is compiled without CUDA support, -this function returns 0. If the CUDA driver is not installed, or is incompatible, this function -returns -1. - */ -CV_EXPORTS int getCudaEnabledDeviceCount(); - -/** @brief Sets a device and initializes it for the current thread. - -@param device System index of a CUDA device starting with 0. - -If the call of this function is omitted, a default device is initialized at the fist CUDA usage. - */ -CV_EXPORTS void setDevice(int device); - -/** @brief Returns the current device index set by cuda::setDevice or initialized by default. - */ -CV_EXPORTS int getDevice(); - -/** @brief Explicitly destroys and cleans up all resources associated with the current device in the current -process. - -Any subsequent API call to this device will reinitialize the device. - */ -CV_EXPORTS void resetDevice(); - -/** @brief Enumeration providing CUDA computing features. - */ -enum FeatureSet -{ - FEATURE_SET_COMPUTE_10 = 10, - FEATURE_SET_COMPUTE_11 = 11, - FEATURE_SET_COMPUTE_12 = 12, - FEATURE_SET_COMPUTE_13 = 13, - FEATURE_SET_COMPUTE_20 = 20, - FEATURE_SET_COMPUTE_21 = 21, - FEATURE_SET_COMPUTE_30 = 30, - FEATURE_SET_COMPUTE_32 = 32, - FEATURE_SET_COMPUTE_35 = 35, - FEATURE_SET_COMPUTE_50 = 50, - - GLOBAL_ATOMICS = FEATURE_SET_COMPUTE_11, - SHARED_ATOMICS = FEATURE_SET_COMPUTE_12, - NATIVE_DOUBLE = FEATURE_SET_COMPUTE_13, - WARP_SHUFFLE_FUNCTIONS = FEATURE_SET_COMPUTE_30, - DYNAMIC_PARALLELISM = FEATURE_SET_COMPUTE_35 -}; - -//! checks whether current device supports the given feature -CV_EXPORTS bool deviceSupports(FeatureSet feature_set); - -/** @brief Class providing a set of static methods to check what NVIDIA\* card architecture the CUDA module was -built for. - -According to the CUDA C Programming Guide Version 3.2: "PTX code produced for some specific compute -capability can always be compiled to binary code of greater or equal compute capability". - */ -class CV_EXPORTS TargetArchs -{ -public: - /** @brief The following method checks whether the module was built with the support of the given feature: - - @param feature_set Features to be checked. See :ocvcuda::FeatureSet. - */ - static bool builtWith(FeatureSet feature_set); - - /** @brief There is a set of methods to check whether the module contains intermediate (PTX) or binary CUDA - code for the given architecture(s): - - @param major Major compute capability version. - @param minor Minor compute capability version. - */ - static bool has(int major, int minor); - static bool hasPtx(int major, int minor); - static bool hasBin(int major, int minor); - - static bool hasEqualOrLessPtx(int major, int minor); - static bool hasEqualOrGreater(int major, int minor); - static bool hasEqualOrGreaterPtx(int major, int minor); - static bool hasEqualOrGreaterBin(int major, int minor); -}; - -/** @brief Class providing functionality for querying the specified GPU properties. - */ -class CV_EXPORTS DeviceInfo -{ -public: - //! creates DeviceInfo object for the current GPU - DeviceInfo(); - - /** @brief The constructors. - - @param device_id System index of the CUDA device starting with 0. - - Constructs the DeviceInfo object for the specified device. If device_id parameter is missed, it - constructs an object for the current device. - */ - DeviceInfo(int device_id); - - /** @brief Returns system index of the CUDA device starting with 0. - */ - int deviceID() const; - - //! ASCII string identifying device - const char* name() const; - - //! global memory available on device in bytes - size_t totalGlobalMem() const; - - //! shared memory available per block in bytes - size_t sharedMemPerBlock() const; - - //! 32-bit registers available per block - int regsPerBlock() const; - - //! warp size in threads - int warpSize() const; - - //! maximum pitch in bytes allowed by memory copies - size_t memPitch() const; - - //! maximum number of threads per block - int maxThreadsPerBlock() const; - - //! maximum size of each dimension of a block - Vec3i maxThreadsDim() const; - - //! maximum size of each dimension of a grid - Vec3i maxGridSize() const; - - //! clock frequency in kilohertz - int clockRate() const; - - //! constant memory available on device in bytes - size_t totalConstMem() const; - - //! major compute capability - int majorVersion() const; - - //! minor compute capability - int minorVersion() const; - - //! alignment requirement for textures - size_t textureAlignment() const; - - //! pitch alignment requirement for texture references bound to pitched memory - size_t texturePitchAlignment() const; - - //! number of multiprocessors on device - int multiProcessorCount() const; - - //! specified whether there is a run time limit on kernels - bool kernelExecTimeoutEnabled() const; - - //! device is integrated as opposed to discrete - bool integrated() const; - - //! device can map host memory with cudaHostAlloc/cudaHostGetDevicePointer - bool canMapHostMemory() const; - - enum ComputeMode - { - ComputeModeDefault, /**< default compute mode (Multiple threads can use cudaSetDevice with this device) */ - ComputeModeExclusive, /**< compute-exclusive-thread mode (Only one thread in one process will be able to use cudaSetDevice with this device) */ - ComputeModeProhibited, /**< compute-prohibited mode (No threads can use cudaSetDevice with this device) */ - ComputeModeExclusiveProcess /**< compute-exclusive-process mode (Many threads in one process will be able to use cudaSetDevice with this device) */ - }; - - //! compute mode - ComputeMode computeMode() const; - - //! maximum 1D texture size - int maxTexture1D() const; - - //! maximum 1D mipmapped texture size - int maxTexture1DMipmap() const; - - //! maximum size for 1D textures bound to linear memory - int maxTexture1DLinear() const; - - //! maximum 2D texture dimensions - Vec2i maxTexture2D() const; - - //! maximum 2D mipmapped texture dimensions - Vec2i maxTexture2DMipmap() const; - - //! maximum dimensions (width, height, pitch) for 2D textures bound to pitched memory - Vec3i maxTexture2DLinear() const; - - //! maximum 2D texture dimensions if texture gather operations have to be performed - Vec2i maxTexture2DGather() const; - - //! maximum 3D texture dimensions - Vec3i maxTexture3D() const; - - //! maximum Cubemap texture dimensions - int maxTextureCubemap() const; - - //! maximum 1D layered texture dimensions - Vec2i maxTexture1DLayered() const; - - //! maximum 2D layered texture dimensions - Vec3i maxTexture2DLayered() const; - - //! maximum Cubemap layered texture dimensions - Vec2i maxTextureCubemapLayered() const; - - //! maximum 1D surface size - int maxSurface1D() const; - - //! maximum 2D surface dimensions - Vec2i maxSurface2D() const; - - //! maximum 3D surface dimensions - Vec3i maxSurface3D() const; - - //! maximum 1D layered surface dimensions - Vec2i maxSurface1DLayered() const; - - //! maximum 2D layered surface dimensions - Vec3i maxSurface2DLayered() const; - - //! maximum Cubemap surface dimensions - int maxSurfaceCubemap() const; - - //! maximum Cubemap layered surface dimensions - Vec2i maxSurfaceCubemapLayered() const; - - //! alignment requirements for surfaces - size_t surfaceAlignment() const; - - //! device can possibly execute multiple kernels concurrently - bool concurrentKernels() const; - - //! device has ECC support enabled - bool ECCEnabled() const; - - //! PCI bus ID of the device - int pciBusID() const; - - //! PCI device ID of the device - int pciDeviceID() const; - - //! PCI domain ID of the device - int pciDomainID() const; - - //! true if device is a Tesla device using TCC driver, false otherwise - bool tccDriver() const; - - //! number of asynchronous engines - int asyncEngineCount() const; - - //! device shares a unified address space with the host - bool unifiedAddressing() const; - - //! peak memory clock frequency in kilohertz - int memoryClockRate() const; - - //! global memory bus width in bits - int memoryBusWidth() const; - - //! size of L2 cache in bytes - int l2CacheSize() const; - - //! maximum resident threads per multiprocessor - int maxThreadsPerMultiProcessor() const; - - //! gets free and total device memory - void queryMemory(size_t& totalMemory, size_t& freeMemory) const; - size_t freeMemory() const; - size_t totalMemory() const; - - /** @brief Provides information on CUDA feature support. - - @param feature_set Features to be checked. See cuda::FeatureSet. - - This function returns true if the device has the specified CUDA feature. Otherwise, it returns false - */ - bool supports(FeatureSet feature_set) const; - - /** @brief Checks the CUDA module and device compatibility. - - This function returns true if the CUDA module can be run on the specified device. Otherwise, it - returns false . - */ - bool isCompatible() const; - -private: - int device_id_; -}; - -CV_EXPORTS void printCudaDeviceInfo(int device); -CV_EXPORTS void printShortCudaDeviceInfo(int device); - -/** @brief Converts an array to half precision floating number. - -@param _src input array. -@param _dst output array. -@param stream Stream for the asynchronous version. -@sa convertFp16 -*/ -CV_EXPORTS void convertFp16(InputArray _src, OutputArray _dst, Stream& stream = Stream::Null()); - -//! @} cudacore_init - -}} // namespace cv { namespace cuda { - - -#include "opencv2/core/cuda.inl.hpp" - -#endif /* OPENCV_CORE_CUDA_HPP */ diff --git a/opencv/include/opencv2/core/cuda.inl.hpp b/opencv/include/opencv2/core/cuda.inl.hpp deleted file mode 100644 index 35ae2e4..0000000 --- a/opencv/include/opencv2/core/cuda.inl.hpp +++ /dev/null @@ -1,631 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_CUDAINL_HPP -#define OPENCV_CORE_CUDAINL_HPP - -#include "opencv2/core/cuda.hpp" - -//! @cond IGNORED - -namespace cv { namespace cuda { - -//=================================================================================== -// GpuMat -//=================================================================================== - -inline -GpuMat::GpuMat(Allocator* allocator_) - : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_) -{} - -inline -GpuMat::GpuMat(int rows_, int cols_, int type_, Allocator* allocator_) - : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_) -{ - if (rows_ > 0 && cols_ > 0) - create(rows_, cols_, type_); -} - -inline -GpuMat::GpuMat(Size size_, int type_, Allocator* allocator_) - : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_) -{ - if (size_.height > 0 && size_.width > 0) - create(size_.height, size_.width, type_); -} - -inline -GpuMat::GpuMat(int rows_, int cols_, int type_, Scalar s_, Allocator* allocator_) - : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_) -{ - if (rows_ > 0 && cols_ > 0) - { - create(rows_, cols_, type_); - setTo(s_); - } -} - -inline -GpuMat::GpuMat(Size size_, int type_, Scalar s_, Allocator* allocator_) - : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_) -{ - if (size_.height > 0 && size_.width > 0) - { - create(size_.height, size_.width, type_); - setTo(s_); - } -} - -inline -GpuMat::GpuMat(const GpuMat& m) - : flags(m.flags), rows(m.rows), cols(m.cols), step(m.step), data(m.data), refcount(m.refcount), datastart(m.datastart), dataend(m.dataend), allocator(m.allocator) -{ - if (refcount) - CV_XADD(refcount, 1); -} - -inline -GpuMat::GpuMat(InputArray arr, Allocator* allocator_) : - flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_) -{ - upload(arr); -} - -inline -GpuMat::~GpuMat() -{ - release(); -} - -inline -GpuMat& GpuMat::operator =(const GpuMat& m) -{ - if (this != &m) - { - GpuMat temp(m); - swap(temp); - } - - return *this; -} - -inline -void GpuMat::create(Size size_, int type_) -{ - create(size_.height, size_.width, type_); -} - -inline -void GpuMat::swap(GpuMat& b) -{ - std::swap(flags, b.flags); - std::swap(rows, b.rows); - std::swap(cols, b.cols); - std::swap(step, b.step); - std::swap(data, b.data); - std::swap(datastart, b.datastart); - std::swap(dataend, b.dataend); - std::swap(refcount, b.refcount); - std::swap(allocator, b.allocator); -} - -inline -GpuMat GpuMat::clone() const -{ - GpuMat m; - copyTo(m); - return m; -} - -inline -void GpuMat::copyTo(OutputArray dst, InputArray mask) const -{ - copyTo(dst, mask, Stream::Null()); -} - -inline -GpuMat& GpuMat::setTo(Scalar s) -{ - return setTo(s, Stream::Null()); -} - -inline -GpuMat& GpuMat::setTo(Scalar s, InputArray mask) -{ - return setTo(s, mask, Stream::Null()); -} - -inline -void GpuMat::convertTo(OutputArray dst, int rtype) const -{ - convertTo(dst, rtype, Stream::Null()); -} - -inline -void GpuMat::convertTo(OutputArray dst, int rtype, double alpha, double beta) const -{ - convertTo(dst, rtype, alpha, beta, Stream::Null()); -} - -inline -void GpuMat::convertTo(OutputArray dst, int rtype, double alpha, Stream& stream) const -{ - convertTo(dst, rtype, alpha, 0.0, stream); -} - -inline -void GpuMat::assignTo(GpuMat& m, int _type) const -{ - if (_type < 0) - m = *this; - else - convertTo(m, _type); -} - -inline -uchar* GpuMat::ptr(int y) -{ - CV_DbgAssert( (unsigned)y < (unsigned)rows ); - return data + step * y; -} - -inline -const uchar* GpuMat::ptr(int y) const -{ - CV_DbgAssert( (unsigned)y < (unsigned)rows ); - return data + step * y; -} - -template inline -_Tp* GpuMat::ptr(int y) -{ - return (_Tp*)ptr(y); -} - -template inline -const _Tp* GpuMat::ptr(int y) const -{ - return (const _Tp*)ptr(y); -} - -template inline -GpuMat::operator PtrStepSz() const -{ - return PtrStepSz(rows, cols, (T*)data, step); -} - -template inline -GpuMat::operator PtrStep() const -{ - return PtrStep((T*)data, step); -} - -inline -GpuMat GpuMat::row(int y) const -{ - return GpuMat(*this, Range(y, y+1), Range::all()); -} - -inline -GpuMat GpuMat::col(int x) const -{ - return GpuMat(*this, Range::all(), Range(x, x+1)); -} - -inline -GpuMat GpuMat::rowRange(int startrow, int endrow) const -{ - return GpuMat(*this, Range(startrow, endrow), Range::all()); -} - -inline -GpuMat GpuMat::rowRange(Range r) const -{ - return GpuMat(*this, r, Range::all()); -} - -inline -GpuMat GpuMat::colRange(int startcol, int endcol) const -{ - return GpuMat(*this, Range::all(), Range(startcol, endcol)); -} - -inline -GpuMat GpuMat::colRange(Range r) const -{ - return GpuMat(*this, Range::all(), r); -} - -inline -GpuMat GpuMat::operator ()(Range rowRange_, Range colRange_) const -{ - return GpuMat(*this, rowRange_, colRange_); -} - -inline -GpuMat GpuMat::operator ()(Rect roi) const -{ - return GpuMat(*this, roi); -} - -inline -bool GpuMat::isContinuous() const -{ - return (flags & Mat::CONTINUOUS_FLAG) != 0; -} - -inline -size_t GpuMat::elemSize() const -{ - return CV_ELEM_SIZE(flags); -} - -inline -size_t GpuMat::elemSize1() const -{ - return CV_ELEM_SIZE1(flags); -} - -inline -int GpuMat::type() const -{ - return CV_MAT_TYPE(flags); -} - -inline -int GpuMat::depth() const -{ - return CV_MAT_DEPTH(flags); -} - -inline -int GpuMat::channels() const -{ - return CV_MAT_CN(flags); -} - -inline -size_t GpuMat::step1() const -{ - return step / elemSize1(); -} - -inline -Size GpuMat::size() const -{ - return Size(cols, rows); -} - -inline -bool GpuMat::empty() const -{ - return data == 0; -} - -static inline -GpuMat createContinuous(int rows, int cols, int type) -{ - GpuMat m; - createContinuous(rows, cols, type, m); - return m; -} - -static inline -void createContinuous(Size size, int type, OutputArray arr) -{ - createContinuous(size.height, size.width, type, arr); -} - -static inline -GpuMat createContinuous(Size size, int type) -{ - GpuMat m; - createContinuous(size, type, m); - return m; -} - -static inline -void ensureSizeIsEnough(Size size, int type, OutputArray arr) -{ - ensureSizeIsEnough(size.height, size.width, type, arr); -} - -static inline -void swap(GpuMat& a, GpuMat& b) -{ - a.swap(b); -} - -//=================================================================================== -// HostMem -//=================================================================================== - -inline -HostMem::HostMem(AllocType alloc_type_) - : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_) -{ -} - -inline -HostMem::HostMem(const HostMem& m) - : flags(m.flags), rows(m.rows), cols(m.cols), step(m.step), data(m.data), refcount(m.refcount), datastart(m.datastart), dataend(m.dataend), alloc_type(m.alloc_type) -{ - if( refcount ) - CV_XADD(refcount, 1); -} - -inline -HostMem::HostMem(int rows_, int cols_, int type_, AllocType alloc_type_) - : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_) -{ - if (rows_ > 0 && cols_ > 0) - create(rows_, cols_, type_); -} - -inline -HostMem::HostMem(Size size_, int type_, AllocType alloc_type_) - : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_) -{ - if (size_.height > 0 && size_.width > 0) - create(size_.height, size_.width, type_); -} - -inline -HostMem::HostMem(InputArray arr, AllocType alloc_type_) - : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_) -{ - arr.getMat().copyTo(*this); -} - -inline -HostMem::~HostMem() -{ - release(); -} - -inline -HostMem& HostMem::operator =(const HostMem& m) -{ - if (this != &m) - { - HostMem temp(m); - swap(temp); - } - - return *this; -} - -inline -void HostMem::swap(HostMem& b) -{ - std::swap(flags, b.flags); - std::swap(rows, b.rows); - std::swap(cols, b.cols); - std::swap(step, b.step); - std::swap(data, b.data); - std::swap(datastart, b.datastart); - std::swap(dataend, b.dataend); - std::swap(refcount, b.refcount); - std::swap(alloc_type, b.alloc_type); -} - -inline -HostMem HostMem::clone() const -{ - HostMem m(size(), type(), alloc_type); - createMatHeader().copyTo(m); - return m; -} - -inline -void HostMem::create(Size size_, int type_) -{ - create(size_.height, size_.width, type_); -} - -inline -Mat HostMem::createMatHeader() const -{ - return Mat(size(), type(), data, step); -} - -inline -bool HostMem::isContinuous() const -{ - return (flags & Mat::CONTINUOUS_FLAG) != 0; -} - -inline -size_t HostMem::elemSize() const -{ - return CV_ELEM_SIZE(flags); -} - -inline -size_t HostMem::elemSize1() const -{ - return CV_ELEM_SIZE1(flags); -} - -inline -int HostMem::type() const -{ - return CV_MAT_TYPE(flags); -} - -inline -int HostMem::depth() const -{ - return CV_MAT_DEPTH(flags); -} - -inline -int HostMem::channels() const -{ - return CV_MAT_CN(flags); -} - -inline -size_t HostMem::step1() const -{ - return step / elemSize1(); -} - -inline -Size HostMem::size() const -{ - return Size(cols, rows); -} - -inline -bool HostMem::empty() const -{ - return data == 0; -} - -static inline -void swap(HostMem& a, HostMem& b) -{ - a.swap(b); -} - -//=================================================================================== -// Stream -//=================================================================================== - -inline -Stream::Stream(const Ptr& impl) - : impl_(impl) -{ -} - -//=================================================================================== -// Event -//=================================================================================== - -inline -Event::Event(const Ptr& impl) - : impl_(impl) -{ -} - -//=================================================================================== -// Initialization & Info -//=================================================================================== - -inline -bool TargetArchs::has(int major, int minor) -{ - return hasPtx(major, minor) || hasBin(major, minor); -} - -inline -bool TargetArchs::hasEqualOrGreater(int major, int minor) -{ - return hasEqualOrGreaterPtx(major, minor) || hasEqualOrGreaterBin(major, minor); -} - -inline -DeviceInfo::DeviceInfo() -{ - device_id_ = getDevice(); -} - -inline -DeviceInfo::DeviceInfo(int device_id) -{ - CV_Assert( device_id >= 0 && device_id < getCudaEnabledDeviceCount() ); - device_id_ = device_id; -} - -inline -int DeviceInfo::deviceID() const -{ - return device_id_; -} - -inline -size_t DeviceInfo::freeMemory() const -{ - size_t _totalMemory = 0, _freeMemory = 0; - queryMemory(_totalMemory, _freeMemory); - return _freeMemory; -} - -inline -size_t DeviceInfo::totalMemory() const -{ - size_t _totalMemory = 0, _freeMemory = 0; - queryMemory(_totalMemory, _freeMemory); - return _totalMemory; -} - -inline -bool DeviceInfo::supports(FeatureSet feature_set) const -{ - int version = majorVersion() * 10 + minorVersion(); - return version >= feature_set; -} - - -}} // namespace cv { namespace cuda { - -//=================================================================================== -// Mat -//=================================================================================== - -namespace cv { - -inline -Mat::Mat(const cuda::GpuMat& m) - : flags(0), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), datalimit(0), allocator(0), u(0), size(&rows) -{ - m.download(*this); -} - -} - -//! @endcond - -#endif // OPENCV_CORE_CUDAINL_HPP diff --git a/opencv/include/opencv2/core/cuda/block.hpp b/opencv/include/opencv2/core/cuda/block.hpp deleted file mode 100644 index c277f0e..0000000 --- a/opencv/include/opencv2/core/cuda/block.hpp +++ /dev/null @@ -1,211 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_DEVICE_BLOCK_HPP -#define OPENCV_CUDA_DEVICE_BLOCK_HPP - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - struct Block - { - static __device__ __forceinline__ unsigned int id() - { - return blockIdx.x; - } - - static __device__ __forceinline__ unsigned int stride() - { - return blockDim.x * blockDim.y * blockDim.z; - } - - static __device__ __forceinline__ void sync() - { - __syncthreads(); - } - - static __device__ __forceinline__ int flattenedThreadId() - { - return threadIdx.z * blockDim.x * blockDim.y + threadIdx.y * blockDim.x + threadIdx.x; - } - - template - static __device__ __forceinline__ void fill(It beg, It end, const T& value) - { - int STRIDE = stride(); - It t = beg + flattenedThreadId(); - - for(; t < end; t += STRIDE) - *t = value; - } - - template - static __device__ __forceinline__ void yota(OutIt beg, OutIt end, T value) - { - int STRIDE = stride(); - int tid = flattenedThreadId(); - value += tid; - - for(OutIt t = beg + tid; t < end; t += STRIDE, value += STRIDE) - *t = value; - } - - template - static __device__ __forceinline__ void copy(InIt beg, InIt end, OutIt out) - { - int STRIDE = stride(); - InIt t = beg + flattenedThreadId(); - OutIt o = out + (t - beg); - - for(; t < end; t += STRIDE, o += STRIDE) - *o = *t; - } - - template - static __device__ __forceinline__ void transform(InIt beg, InIt end, OutIt out, UnOp op) - { - int STRIDE = stride(); - InIt t = beg + flattenedThreadId(); - OutIt o = out + (t - beg); - - for(; t < end; t += STRIDE, o += STRIDE) - *o = op(*t); - } - - template - static __device__ __forceinline__ void transform(InIt1 beg1, InIt1 end1, InIt2 beg2, OutIt out, BinOp op) - { - int STRIDE = stride(); - InIt1 t1 = beg1 + flattenedThreadId(); - InIt2 t2 = beg2 + flattenedThreadId(); - OutIt o = out + (t1 - beg1); - - for(; t1 < end1; t1 += STRIDE, t2 += STRIDE, o += STRIDE) - *o = op(*t1, *t2); - } - - template - static __device__ __forceinline__ void reduce(volatile T* buffer, BinOp op) - { - int tid = flattenedThreadId(); - T val = buffer[tid]; - - if (CTA_SIZE >= 1024) { if (tid < 512) buffer[tid] = val = op(val, buffer[tid + 512]); __syncthreads(); } - if (CTA_SIZE >= 512) { if (tid < 256) buffer[tid] = val = op(val, buffer[tid + 256]); __syncthreads(); } - if (CTA_SIZE >= 256) { if (tid < 128) buffer[tid] = val = op(val, buffer[tid + 128]); __syncthreads(); } - if (CTA_SIZE >= 128) { if (tid < 64) buffer[tid] = val = op(val, buffer[tid + 64]); __syncthreads(); } - - if (tid < 32) - { - if (CTA_SIZE >= 64) { buffer[tid] = val = op(val, buffer[tid + 32]); } - if (CTA_SIZE >= 32) { buffer[tid] = val = op(val, buffer[tid + 16]); } - if (CTA_SIZE >= 16) { buffer[tid] = val = op(val, buffer[tid + 8]); } - if (CTA_SIZE >= 8) { buffer[tid] = val = op(val, buffer[tid + 4]); } - if (CTA_SIZE >= 4) { buffer[tid] = val = op(val, buffer[tid + 2]); } - if (CTA_SIZE >= 2) { buffer[tid] = val = op(val, buffer[tid + 1]); } - } - } - - template - static __device__ __forceinline__ T reduce(volatile T* buffer, T init, BinOp op) - { - int tid = flattenedThreadId(); - T val = buffer[tid] = init; - __syncthreads(); - - if (CTA_SIZE >= 1024) { if (tid < 512) buffer[tid] = val = op(val, buffer[tid + 512]); __syncthreads(); } - if (CTA_SIZE >= 512) { if (tid < 256) buffer[tid] = val = op(val, buffer[tid + 256]); __syncthreads(); } - if (CTA_SIZE >= 256) { if (tid < 128) buffer[tid] = val = op(val, buffer[tid + 128]); __syncthreads(); } - if (CTA_SIZE >= 128) { if (tid < 64) buffer[tid] = val = op(val, buffer[tid + 64]); __syncthreads(); } - - if (tid < 32) - { - if (CTA_SIZE >= 64) { buffer[tid] = val = op(val, buffer[tid + 32]); } - if (CTA_SIZE >= 32) { buffer[tid] = val = op(val, buffer[tid + 16]); } - if (CTA_SIZE >= 16) { buffer[tid] = val = op(val, buffer[tid + 8]); } - if (CTA_SIZE >= 8) { buffer[tid] = val = op(val, buffer[tid + 4]); } - if (CTA_SIZE >= 4) { buffer[tid] = val = op(val, buffer[tid + 2]); } - if (CTA_SIZE >= 2) { buffer[tid] = val = op(val, buffer[tid + 1]); } - } - __syncthreads(); - return buffer[0]; - } - - template - static __device__ __forceinline__ void reduce_n(T* data, unsigned int n, BinOp op) - { - int ftid = flattenedThreadId(); - int sft = stride(); - - if (sft < n) - { - for (unsigned int i = sft + ftid; i < n; i += sft) - data[ftid] = op(data[ftid], data[i]); - - __syncthreads(); - - n = sft; - } - - while (n > 1) - { - unsigned int half = n/2; - - if (ftid < half) - data[ftid] = op(data[ftid], data[n - ftid - 1]); - - __syncthreads(); - - n = n - half; - } - } - }; -}}} - -//! @endcond - -#endif /* OPENCV_CUDA_DEVICE_BLOCK_HPP */ diff --git a/opencv/include/opencv2/core/cuda/border_interpolate.hpp b/opencv/include/opencv2/core/cuda/border_interpolate.hpp deleted file mode 100644 index 874f705..0000000 --- a/opencv/include/opencv2/core/cuda/border_interpolate.hpp +++ /dev/null @@ -1,722 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_BORDER_INTERPOLATE_HPP -#define OPENCV_CUDA_BORDER_INTERPOLATE_HPP - -#include "saturate_cast.hpp" -#include "vec_traits.hpp" -#include "vec_math.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - ////////////////////////////////////////////////////////////// - // BrdConstant - - template struct BrdRowConstant - { - typedef D result_type; - - explicit __host__ __device__ __forceinline__ BrdRowConstant(int width_, const D& val_ = VecTraits::all(0)) : width(width_), val(val_) {} - - template __device__ __forceinline__ D at_low(int x, const T* data) const - { - return x >= 0 ? saturate_cast(data[x]) : val; - } - - template __device__ __forceinline__ D at_high(int x, const T* data) const - { - return x < width ? saturate_cast(data[x]) : val; - } - - template __device__ __forceinline__ D at(int x, const T* data) const - { - return (x >= 0 && x < width) ? saturate_cast(data[x]) : val; - } - - int width; - D val; - }; - - template struct BrdColConstant - { - typedef D result_type; - - explicit __host__ __device__ __forceinline__ BrdColConstant(int height_, const D& val_ = VecTraits::all(0)) : height(height_), val(val_) {} - - template __device__ __forceinline__ D at_low(int y, const T* data, size_t step) const - { - return y >= 0 ? saturate_cast(*(const T*)((const char*)data + y * step)) : val; - } - - template __device__ __forceinline__ D at_high(int y, const T* data, size_t step) const - { - return y < height ? saturate_cast(*(const T*)((const char*)data + y * step)) : val; - } - - template __device__ __forceinline__ D at(int y, const T* data, size_t step) const - { - return (y >= 0 && y < height) ? saturate_cast(*(const T*)((const char*)data + y * step)) : val; - } - - int height; - D val; - }; - - template struct BrdConstant - { - typedef D result_type; - - __host__ __device__ __forceinline__ BrdConstant(int height_, int width_, const D& val_ = VecTraits::all(0)) : height(height_), width(width_), val(val_) - { - } - - template __device__ __forceinline__ D at(int y, int x, const T* data, size_t step) const - { - return (x >= 0 && x < width && y >= 0 && y < height) ? saturate_cast(((const T*)((const uchar*)data + y * step))[x]) : val; - } - - template __device__ __forceinline__ D at(typename Ptr2D::index_type y, typename Ptr2D::index_type x, const Ptr2D& src) const - { - return (x >= 0 && x < width && y >= 0 && y < height) ? saturate_cast(src(y, x)) : val; - } - - int height; - int width; - D val; - }; - - ////////////////////////////////////////////////////////////// - // BrdReplicate - - template struct BrdRowReplicate - { - typedef D result_type; - - explicit __host__ __device__ __forceinline__ BrdRowReplicate(int width) : last_col(width - 1) {} - template __host__ __device__ __forceinline__ BrdRowReplicate(int width, U) : last_col(width - 1) {} - - __device__ __forceinline__ int idx_col_low(int x) const - { - return ::max(x, 0); - } - - __device__ __forceinline__ int idx_col_high(int x) const - { - return ::min(x, last_col); - } - - __device__ __forceinline__ int idx_col(int x) const - { - return idx_col_low(idx_col_high(x)); - } - - template __device__ __forceinline__ D at_low(int x, const T* data) const - { - return saturate_cast(data[idx_col_low(x)]); - } - - template __device__ __forceinline__ D at_high(int x, const T* data) const - { - return saturate_cast(data[idx_col_high(x)]); - } - - template __device__ __forceinline__ D at(int x, const T* data) const - { - return saturate_cast(data[idx_col(x)]); - } - - int last_col; - }; - - template struct BrdColReplicate - { - typedef D result_type; - - explicit __host__ __device__ __forceinline__ BrdColReplicate(int height) : last_row(height - 1) {} - template __host__ __device__ __forceinline__ BrdColReplicate(int height, U) : last_row(height - 1) {} - - __device__ __forceinline__ int idx_row_low(int y) const - { - return ::max(y, 0); - } - - __device__ __forceinline__ int idx_row_high(int y) const - { - return ::min(y, last_row); - } - - __device__ __forceinline__ int idx_row(int y) const - { - return idx_row_low(idx_row_high(y)); - } - - template __device__ __forceinline__ D at_low(int y, const T* data, size_t step) const - { - return saturate_cast(*(const T*)((const char*)data + idx_row_low(y) * step)); - } - - template __device__ __forceinline__ D at_high(int y, const T* data, size_t step) const - { - return saturate_cast(*(const T*)((const char*)data + idx_row_high(y) * step)); - } - - template __device__ __forceinline__ D at(int y, const T* data, size_t step) const - { - return saturate_cast(*(const T*)((const char*)data + idx_row(y) * step)); - } - - int last_row; - }; - - template struct BrdReplicate - { - typedef D result_type; - - __host__ __device__ __forceinline__ BrdReplicate(int height, int width) : last_row(height - 1), last_col(width - 1) {} - template __host__ __device__ __forceinline__ BrdReplicate(int height, int width, U) : last_row(height - 1), last_col(width - 1) {} - - __device__ __forceinline__ int idx_row_low(int y) const - { - return ::max(y, 0); - } - - __device__ __forceinline__ int idx_row_high(int y) const - { - return ::min(y, last_row); - } - - __device__ __forceinline__ int idx_row(int y) const - { - return idx_row_low(idx_row_high(y)); - } - - __device__ __forceinline__ int idx_col_low(int x) const - { - return ::max(x, 0); - } - - __device__ __forceinline__ int idx_col_high(int x) const - { - return ::min(x, last_col); - } - - __device__ __forceinline__ int idx_col(int x) const - { - return idx_col_low(idx_col_high(x)); - } - - template __device__ __forceinline__ D at(int y, int x, const T* data, size_t step) const - { - return saturate_cast(((const T*)((const char*)data + idx_row(y) * step))[idx_col(x)]); - } - - template __device__ __forceinline__ D at(typename Ptr2D::index_type y, typename Ptr2D::index_type x, const Ptr2D& src) const - { - return saturate_cast(src(idx_row(y), idx_col(x))); - } - - int last_row; - int last_col; - }; - - ////////////////////////////////////////////////////////////// - // BrdReflect101 - - template struct BrdRowReflect101 - { - typedef D result_type; - - explicit __host__ __device__ __forceinline__ BrdRowReflect101(int width) : last_col(width - 1) {} - template __host__ __device__ __forceinline__ BrdRowReflect101(int width, U) : last_col(width - 1) {} - - __device__ __forceinline__ int idx_col_low(int x) const - { - return ::abs(x) % (last_col + 1); - } - - __device__ __forceinline__ int idx_col_high(int x) const - { - return ::abs(last_col - ::abs(last_col - x)) % (last_col + 1); - } - - __device__ __forceinline__ int idx_col(int x) const - { - return idx_col_low(idx_col_high(x)); - } - - template __device__ __forceinline__ D at_low(int x, const T* data) const - { - return saturate_cast(data[idx_col_low(x)]); - } - - template __device__ __forceinline__ D at_high(int x, const T* data) const - { - return saturate_cast(data[idx_col_high(x)]); - } - - template __device__ __forceinline__ D at(int x, const T* data) const - { - return saturate_cast(data[idx_col(x)]); - } - - int last_col; - }; - - template struct BrdColReflect101 - { - typedef D result_type; - - explicit __host__ __device__ __forceinline__ BrdColReflect101(int height) : last_row(height - 1) {} - template __host__ __device__ __forceinline__ BrdColReflect101(int height, U) : last_row(height - 1) {} - - __device__ __forceinline__ int idx_row_low(int y) const - { - return ::abs(y) % (last_row + 1); - } - - __device__ __forceinline__ int idx_row_high(int y) const - { - return ::abs(last_row - ::abs(last_row - y)) % (last_row + 1); - } - - __device__ __forceinline__ int idx_row(int y) const - { - return idx_row_low(idx_row_high(y)); - } - - template __device__ __forceinline__ D at_low(int y, const T* data, size_t step) const - { - return saturate_cast(*(const D*)((const char*)data + idx_row_low(y) * step)); - } - - template __device__ __forceinline__ D at_high(int y, const T* data, size_t step) const - { - return saturate_cast(*(const D*)((const char*)data + idx_row_high(y) * step)); - } - - template __device__ __forceinline__ D at(int y, const T* data, size_t step) const - { - return saturate_cast(*(const D*)((const char*)data + idx_row(y) * step)); - } - - int last_row; - }; - - template struct BrdReflect101 - { - typedef D result_type; - - __host__ __device__ __forceinline__ BrdReflect101(int height, int width) : last_row(height - 1), last_col(width - 1) {} - template __host__ __device__ __forceinline__ BrdReflect101(int height, int width, U) : last_row(height - 1), last_col(width - 1) {} - - __device__ __forceinline__ int idx_row_low(int y) const - { - return ::abs(y) % (last_row + 1); - } - - __device__ __forceinline__ int idx_row_high(int y) const - { - return ::abs(last_row - ::abs(last_row - y)) % (last_row + 1); - } - - __device__ __forceinline__ int idx_row(int y) const - { - return idx_row_low(idx_row_high(y)); - } - - __device__ __forceinline__ int idx_col_low(int x) const - { - return ::abs(x) % (last_col + 1); - } - - __device__ __forceinline__ int idx_col_high(int x) const - { - return ::abs(last_col - ::abs(last_col - x)) % (last_col + 1); - } - - __device__ __forceinline__ int idx_col(int x) const - { - return idx_col_low(idx_col_high(x)); - } - - template __device__ __forceinline__ D at(int y, int x, const T* data, size_t step) const - { - return saturate_cast(((const T*)((const char*)data + idx_row(y) * step))[idx_col(x)]); - } - - template __device__ __forceinline__ D at(typename Ptr2D::index_type y, typename Ptr2D::index_type x, const Ptr2D& src) const - { - return saturate_cast(src(idx_row(y), idx_col(x))); - } - - int last_row; - int last_col; - }; - - ////////////////////////////////////////////////////////////// - // BrdReflect - - template struct BrdRowReflect - { - typedef D result_type; - - explicit __host__ __device__ __forceinline__ BrdRowReflect(int width) : last_col(width - 1) {} - template __host__ __device__ __forceinline__ BrdRowReflect(int width, U) : last_col(width - 1) {} - - __device__ __forceinline__ int idx_col_low(int x) const - { - return (::abs(x) - (x < 0)) % (last_col + 1); - } - - __device__ __forceinline__ int idx_col_high(int x) const - { - return ::abs(last_col - ::abs(last_col - x) + (x > last_col)) % (last_col + 1); - } - - __device__ __forceinline__ int idx_col(int x) const - { - return idx_col_high(::abs(x) - (x < 0)); - } - - template __device__ __forceinline__ D at_low(int x, const T* data) const - { - return saturate_cast(data[idx_col_low(x)]); - } - - template __device__ __forceinline__ D at_high(int x, const T* data) const - { - return saturate_cast(data[idx_col_high(x)]); - } - - template __device__ __forceinline__ D at(int x, const T* data) const - { - return saturate_cast(data[idx_col(x)]); - } - - int last_col; - }; - - template struct BrdColReflect - { - typedef D result_type; - - explicit __host__ __device__ __forceinline__ BrdColReflect(int height) : last_row(height - 1) {} - template __host__ __device__ __forceinline__ BrdColReflect(int height, U) : last_row(height - 1) {} - - __device__ __forceinline__ int idx_row_low(int y) const - { - return (::abs(y) - (y < 0)) % (last_row + 1); - } - - __device__ __forceinline__ int idx_row_high(int y) const - { - return ::abs(last_row - ::abs(last_row - y) + (y > last_row)) % (last_row + 1); - } - - __device__ __forceinline__ int idx_row(int y) const - { - return idx_row_high(::abs(y) - (y < 0)); - } - - template __device__ __forceinline__ D at_low(int y, const T* data, size_t step) const - { - return saturate_cast(*(const D*)((const char*)data + idx_row_low(y) * step)); - } - - template __device__ __forceinline__ D at_high(int y, const T* data, size_t step) const - { - return saturate_cast(*(const D*)((const char*)data + idx_row_high(y) * step)); - } - - template __device__ __forceinline__ D at(int y, const T* data, size_t step) const - { - return saturate_cast(*(const D*)((const char*)data + idx_row(y) * step)); - } - - int last_row; - }; - - template struct BrdReflect - { - typedef D result_type; - - __host__ __device__ __forceinline__ BrdReflect(int height, int width) : last_row(height - 1), last_col(width - 1) {} - template __host__ __device__ __forceinline__ BrdReflect(int height, int width, U) : last_row(height - 1), last_col(width - 1) {} - - __device__ __forceinline__ int idx_row_low(int y) const - { - return (::abs(y) - (y < 0)) % (last_row + 1); - } - - __device__ __forceinline__ int idx_row_high(int y) const - { - return /*::abs*/(last_row - ::abs(last_row - y) + (y > last_row)) /*% (last_row + 1)*/; - } - - __device__ __forceinline__ int idx_row(int y) const - { - return idx_row_low(idx_row_high(y)); - } - - __device__ __forceinline__ int idx_col_low(int x) const - { - return (::abs(x) - (x < 0)) % (last_col + 1); - } - - __device__ __forceinline__ int idx_col_high(int x) const - { - return (last_col - ::abs(last_col - x) + (x > last_col)); - } - - __device__ __forceinline__ int idx_col(int x) const - { - return idx_col_low(idx_col_high(x)); - } - - template __device__ __forceinline__ D at(int y, int x, const T* data, size_t step) const - { - return saturate_cast(((const T*)((const char*)data + idx_row(y) * step))[idx_col(x)]); - } - - template __device__ __forceinline__ D at(typename Ptr2D::index_type y, typename Ptr2D::index_type x, const Ptr2D& src) const - { - return saturate_cast(src(idx_row(y), idx_col(x))); - } - - int last_row; - int last_col; - }; - - ////////////////////////////////////////////////////////////// - // BrdWrap - - template struct BrdRowWrap - { - typedef D result_type; - - explicit __host__ __device__ __forceinline__ BrdRowWrap(int width_) : width(width_) {} - template __host__ __device__ __forceinline__ BrdRowWrap(int width_, U) : width(width_) {} - - __device__ __forceinline__ int idx_col_low(int x) const - { - return (x >= 0) * x + (x < 0) * (x - ((x - width + 1) / width) * width); - } - - __device__ __forceinline__ int idx_col_high(int x) const - { - return (x < width) * x + (x >= width) * (x % width); - } - - __device__ __forceinline__ int idx_col(int x) const - { - return idx_col_high(idx_col_low(x)); - } - - template __device__ __forceinline__ D at_low(int x, const T* data) const - { - return saturate_cast(data[idx_col_low(x)]); - } - - template __device__ __forceinline__ D at_high(int x, const T* data) const - { - return saturate_cast(data[idx_col_high(x)]); - } - - template __device__ __forceinline__ D at(int x, const T* data) const - { - return saturate_cast(data[idx_col(x)]); - } - - int width; - }; - - template struct BrdColWrap - { - typedef D result_type; - - explicit __host__ __device__ __forceinline__ BrdColWrap(int height_) : height(height_) {} - template __host__ __device__ __forceinline__ BrdColWrap(int height_, U) : height(height_) {} - - __device__ __forceinline__ int idx_row_low(int y) const - { - return (y >= 0) * y + (y < 0) * (y - ((y - height + 1) / height) * height); - } - - __device__ __forceinline__ int idx_row_high(int y) const - { - return (y < height) * y + (y >= height) * (y % height); - } - - __device__ __forceinline__ int idx_row(int y) const - { - return idx_row_high(idx_row_low(y)); - } - - template __device__ __forceinline__ D at_low(int y, const T* data, size_t step) const - { - return saturate_cast(*(const D*)((const char*)data + idx_row_low(y) * step)); - } - - template __device__ __forceinline__ D at_high(int y, const T* data, size_t step) const - { - return saturate_cast(*(const D*)((const char*)data + idx_row_high(y) * step)); - } - - template __device__ __forceinline__ D at(int y, const T* data, size_t step) const - { - return saturate_cast(*(const D*)((const char*)data + idx_row(y) * step)); - } - - int height; - }; - - template struct BrdWrap - { - typedef D result_type; - - __host__ __device__ __forceinline__ BrdWrap(int height_, int width_) : - height(height_), width(width_) - { - } - template - __host__ __device__ __forceinline__ BrdWrap(int height_, int width_, U) : - height(height_), width(width_) - { - } - - __device__ __forceinline__ int idx_row_low(int y) const - { - return (y >= 0) ? y : (y - ((y - height + 1) / height) * height); - } - - __device__ __forceinline__ int idx_row_high(int y) const - { - return (y < height) ? y : (y % height); - } - - __device__ __forceinline__ int idx_row(int y) const - { - return idx_row_high(idx_row_low(y)); - } - - __device__ __forceinline__ int idx_col_low(int x) const - { - return (x >= 0) ? x : (x - ((x - width + 1) / width) * width); - } - - __device__ __forceinline__ int idx_col_high(int x) const - { - return (x < width) ? x : (x % width); - } - - __device__ __forceinline__ int idx_col(int x) const - { - return idx_col_high(idx_col_low(x)); - } - - template __device__ __forceinline__ D at(int y, int x, const T* data, size_t step) const - { - return saturate_cast(((const T*)((const char*)data + idx_row(y) * step))[idx_col(x)]); - } - - template __device__ __forceinline__ D at(typename Ptr2D::index_type y, typename Ptr2D::index_type x, const Ptr2D& src) const - { - return saturate_cast(src(idx_row(y), idx_col(x))); - } - - int height; - int width; - }; - - ////////////////////////////////////////////////////////////// - // BorderReader - - template struct BorderReader - { - typedef typename B::result_type elem_type; - typedef typename Ptr2D::index_type index_type; - - __host__ __device__ __forceinline__ BorderReader(const Ptr2D& ptr_, const B& b_) : ptr(ptr_), b(b_) {} - - __device__ __forceinline__ elem_type operator ()(index_type y, index_type x) const - { - return b.at(y, x, ptr); - } - - Ptr2D ptr; - B b; - }; - - // under win32 there is some bug with templated types that passed as kernel parameters - // with this specialization all works fine - template struct BorderReader< Ptr2D, BrdConstant > - { - typedef typename BrdConstant::result_type elem_type; - typedef typename Ptr2D::index_type index_type; - - __host__ __device__ __forceinline__ BorderReader(const Ptr2D& src_, const BrdConstant& b) : - src(src_), height(b.height), width(b.width), val(b.val) - { - } - - __device__ __forceinline__ D operator ()(index_type y, index_type x) const - { - return (x >= 0 && x < width && y >= 0 && y < height) ? saturate_cast(src(y, x)) : val; - } - - Ptr2D src; - int height; - int width; - D val; - }; -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif // OPENCV_CUDA_BORDER_INTERPOLATE_HPP diff --git a/opencv/include/opencv2/core/cuda/color.hpp b/opencv/include/opencv2/core/cuda/color.hpp deleted file mode 100644 index dcce280..0000000 --- a/opencv/include/opencv2/core/cuda/color.hpp +++ /dev/null @@ -1,309 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_COLOR_HPP -#define OPENCV_CUDA_COLOR_HPP - -#include "detail/color_detail.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - // All OPENCV_CUDA_IMPLEMENT_*_TRAITS(ColorSpace1_to_ColorSpace2, ...) macros implements - // template class ColorSpace1_to_ColorSpace2_traits - // { - // typedef ... functor_type; - // static __host__ __device__ functor_type create_functor(); - // }; - - OPENCV_CUDA_IMPLEMENT_RGB2RGB_TRAITS(bgr_to_rgb, 3, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2RGB_TRAITS(bgr_to_bgra, 3, 4, 0) - OPENCV_CUDA_IMPLEMENT_RGB2RGB_TRAITS(bgr_to_rgba, 3, 4, 2) - OPENCV_CUDA_IMPLEMENT_RGB2RGB_TRAITS(bgra_to_bgr, 4, 3, 0) - OPENCV_CUDA_IMPLEMENT_RGB2RGB_TRAITS(bgra_to_rgb, 4, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2RGB_TRAITS(bgra_to_rgba, 4, 4, 2) - - #undef OPENCV_CUDA_IMPLEMENT_RGB2RGB_TRAITS - - OPENCV_CUDA_IMPLEMENT_RGB2RGB5x5_TRAITS(bgr_to_bgr555, 3, 0, 5) - OPENCV_CUDA_IMPLEMENT_RGB2RGB5x5_TRAITS(bgr_to_bgr565, 3, 0, 6) - OPENCV_CUDA_IMPLEMENT_RGB2RGB5x5_TRAITS(rgb_to_bgr555, 3, 2, 5) - OPENCV_CUDA_IMPLEMENT_RGB2RGB5x5_TRAITS(rgb_to_bgr565, 3, 2, 6) - OPENCV_CUDA_IMPLEMENT_RGB2RGB5x5_TRAITS(bgra_to_bgr555, 4, 0, 5) - OPENCV_CUDA_IMPLEMENT_RGB2RGB5x5_TRAITS(bgra_to_bgr565, 4, 0, 6) - OPENCV_CUDA_IMPLEMENT_RGB2RGB5x5_TRAITS(rgba_to_bgr555, 4, 2, 5) - OPENCV_CUDA_IMPLEMENT_RGB2RGB5x5_TRAITS(rgba_to_bgr565, 4, 2, 6) - - #undef OPENCV_CUDA_IMPLEMENT_RGB2RGB5x5_TRAITS - - OPENCV_CUDA_IMPLEMENT_RGB5x52RGB_TRAITS(bgr555_to_rgb, 3, 2, 5) - OPENCV_CUDA_IMPLEMENT_RGB5x52RGB_TRAITS(bgr565_to_rgb, 3, 2, 6) - OPENCV_CUDA_IMPLEMENT_RGB5x52RGB_TRAITS(bgr555_to_bgr, 3, 0, 5) - OPENCV_CUDA_IMPLEMENT_RGB5x52RGB_TRAITS(bgr565_to_bgr, 3, 0, 6) - OPENCV_CUDA_IMPLEMENT_RGB5x52RGB_TRAITS(bgr555_to_rgba, 4, 2, 5) - OPENCV_CUDA_IMPLEMENT_RGB5x52RGB_TRAITS(bgr565_to_rgba, 4, 2, 6) - OPENCV_CUDA_IMPLEMENT_RGB5x52RGB_TRAITS(bgr555_to_bgra, 4, 0, 5) - OPENCV_CUDA_IMPLEMENT_RGB5x52RGB_TRAITS(bgr565_to_bgra, 4, 0, 6) - - #undef OPENCV_CUDA_IMPLEMENT_RGB5x52RGB_TRAITS - - OPENCV_CUDA_IMPLEMENT_GRAY2RGB_TRAITS(gray_to_bgr, 3) - OPENCV_CUDA_IMPLEMENT_GRAY2RGB_TRAITS(gray_to_bgra, 4) - - #undef OPENCV_CUDA_IMPLEMENT_GRAY2RGB_TRAITS - - OPENCV_CUDA_IMPLEMENT_GRAY2RGB5x5_TRAITS(gray_to_bgr555, 5) - OPENCV_CUDA_IMPLEMENT_GRAY2RGB5x5_TRAITS(gray_to_bgr565, 6) - - #undef OPENCV_CUDA_IMPLEMENT_GRAY2RGB5x5_TRAITS - - OPENCV_CUDA_IMPLEMENT_RGB5x52GRAY_TRAITS(bgr555_to_gray, 5) - OPENCV_CUDA_IMPLEMENT_RGB5x52GRAY_TRAITS(bgr565_to_gray, 6) - - #undef OPENCV_CUDA_IMPLEMENT_RGB5x52GRAY_TRAITS - - OPENCV_CUDA_IMPLEMENT_RGB2GRAY_TRAITS(rgb_to_gray, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2GRAY_TRAITS(bgr_to_gray, 3, 0) - OPENCV_CUDA_IMPLEMENT_RGB2GRAY_TRAITS(rgba_to_gray, 4, 2) - OPENCV_CUDA_IMPLEMENT_RGB2GRAY_TRAITS(bgra_to_gray, 4, 0) - - #undef OPENCV_CUDA_IMPLEMENT_RGB2GRAY_TRAITS - - OPENCV_CUDA_IMPLEMENT_RGB2YUV_TRAITS(rgb_to_yuv, 3, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2YUV_TRAITS(rgba_to_yuv, 4, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2YUV_TRAITS(rgb_to_yuv4, 3, 4, 2) - OPENCV_CUDA_IMPLEMENT_RGB2YUV_TRAITS(rgba_to_yuv4, 4, 4, 2) - OPENCV_CUDA_IMPLEMENT_RGB2YUV_TRAITS(bgr_to_yuv, 3, 3, 0) - OPENCV_CUDA_IMPLEMENT_RGB2YUV_TRAITS(bgra_to_yuv, 4, 3, 0) - OPENCV_CUDA_IMPLEMENT_RGB2YUV_TRAITS(bgr_to_yuv4, 3, 4, 0) - OPENCV_CUDA_IMPLEMENT_RGB2YUV_TRAITS(bgra_to_yuv4, 4, 4, 0) - - #undef OPENCV_CUDA_IMPLEMENT_RGB2YUV_TRAITS - - OPENCV_CUDA_IMPLEMENT_YUV2RGB_TRAITS(yuv_to_rgb, 3, 3, 2) - OPENCV_CUDA_IMPLEMENT_YUV2RGB_TRAITS(yuv_to_rgba, 3, 4, 2) - OPENCV_CUDA_IMPLEMENT_YUV2RGB_TRAITS(yuv4_to_rgb, 4, 3, 2) - OPENCV_CUDA_IMPLEMENT_YUV2RGB_TRAITS(yuv4_to_rgba, 4, 4, 2) - OPENCV_CUDA_IMPLEMENT_YUV2RGB_TRAITS(yuv_to_bgr, 3, 3, 0) - OPENCV_CUDA_IMPLEMENT_YUV2RGB_TRAITS(yuv_to_bgra, 3, 4, 0) - OPENCV_CUDA_IMPLEMENT_YUV2RGB_TRAITS(yuv4_to_bgr, 4, 3, 0) - OPENCV_CUDA_IMPLEMENT_YUV2RGB_TRAITS(yuv4_to_bgra, 4, 4, 0) - - #undef OPENCV_CUDA_IMPLEMENT_YUV2RGB_TRAITS - - OPENCV_CUDA_IMPLEMENT_RGB2YCrCb_TRAITS(rgb_to_YCrCb, 3, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2YCrCb_TRAITS(rgba_to_YCrCb, 4, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2YCrCb_TRAITS(rgb_to_YCrCb4, 3, 4, 2) - OPENCV_CUDA_IMPLEMENT_RGB2YCrCb_TRAITS(rgba_to_YCrCb4, 4, 4, 2) - OPENCV_CUDA_IMPLEMENT_RGB2YCrCb_TRAITS(bgr_to_YCrCb, 3, 3, 0) - OPENCV_CUDA_IMPLEMENT_RGB2YCrCb_TRAITS(bgra_to_YCrCb, 4, 3, 0) - OPENCV_CUDA_IMPLEMENT_RGB2YCrCb_TRAITS(bgr_to_YCrCb4, 3, 4, 0) - OPENCV_CUDA_IMPLEMENT_RGB2YCrCb_TRAITS(bgra_to_YCrCb4, 4, 4, 0) - - #undef OPENCV_CUDA_IMPLEMENT_RGB2YCrCb_TRAITS - - OPENCV_CUDA_IMPLEMENT_YCrCb2RGB_TRAITS(YCrCb_to_rgb, 3, 3, 2) - OPENCV_CUDA_IMPLEMENT_YCrCb2RGB_TRAITS(YCrCb_to_rgba, 3, 4, 2) - OPENCV_CUDA_IMPLEMENT_YCrCb2RGB_TRAITS(YCrCb4_to_rgb, 4, 3, 2) - OPENCV_CUDA_IMPLEMENT_YCrCb2RGB_TRAITS(YCrCb4_to_rgba, 4, 4, 2) - OPENCV_CUDA_IMPLEMENT_YCrCb2RGB_TRAITS(YCrCb_to_bgr, 3, 3, 0) - OPENCV_CUDA_IMPLEMENT_YCrCb2RGB_TRAITS(YCrCb_to_bgra, 3, 4, 0) - OPENCV_CUDA_IMPLEMENT_YCrCb2RGB_TRAITS(YCrCb4_to_bgr, 4, 3, 0) - OPENCV_CUDA_IMPLEMENT_YCrCb2RGB_TRAITS(YCrCb4_to_bgra, 4, 4, 0) - - #undef OPENCV_CUDA_IMPLEMENT_YCrCb2RGB_TRAITS - - OPENCV_CUDA_IMPLEMENT_RGB2XYZ_TRAITS(rgb_to_xyz, 3, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2XYZ_TRAITS(rgba_to_xyz, 4, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2XYZ_TRAITS(rgb_to_xyz4, 3, 4, 2) - OPENCV_CUDA_IMPLEMENT_RGB2XYZ_TRAITS(rgba_to_xyz4, 4, 4, 2) - OPENCV_CUDA_IMPLEMENT_RGB2XYZ_TRAITS(bgr_to_xyz, 3, 3, 0) - OPENCV_CUDA_IMPLEMENT_RGB2XYZ_TRAITS(bgra_to_xyz, 4, 3, 0) - OPENCV_CUDA_IMPLEMENT_RGB2XYZ_TRAITS(bgr_to_xyz4, 3, 4, 0) - OPENCV_CUDA_IMPLEMENT_RGB2XYZ_TRAITS(bgra_to_xyz4, 4, 4, 0) - - #undef OPENCV_CUDA_IMPLEMENT_RGB2XYZ_TRAITS - - OPENCV_CUDA_IMPLEMENT_XYZ2RGB_TRAITS(xyz_to_rgb, 3, 3, 2) - OPENCV_CUDA_IMPLEMENT_XYZ2RGB_TRAITS(xyz4_to_rgb, 4, 3, 2) - OPENCV_CUDA_IMPLEMENT_XYZ2RGB_TRAITS(xyz_to_rgba, 3, 4, 2) - OPENCV_CUDA_IMPLEMENT_XYZ2RGB_TRAITS(xyz4_to_rgba, 4, 4, 2) - OPENCV_CUDA_IMPLEMENT_XYZ2RGB_TRAITS(xyz_to_bgr, 3, 3, 0) - OPENCV_CUDA_IMPLEMENT_XYZ2RGB_TRAITS(xyz4_to_bgr, 4, 3, 0) - OPENCV_CUDA_IMPLEMENT_XYZ2RGB_TRAITS(xyz_to_bgra, 3, 4, 0) - OPENCV_CUDA_IMPLEMENT_XYZ2RGB_TRAITS(xyz4_to_bgra, 4, 4, 0) - - #undef OPENCV_CUDA_IMPLEMENT_XYZ2RGB_TRAITS - - OPENCV_CUDA_IMPLEMENT_RGB2HSV_TRAITS(rgb_to_hsv, 3, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2HSV_TRAITS(rgba_to_hsv, 4, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2HSV_TRAITS(rgb_to_hsv4, 3, 4, 2) - OPENCV_CUDA_IMPLEMENT_RGB2HSV_TRAITS(rgba_to_hsv4, 4, 4, 2) - OPENCV_CUDA_IMPLEMENT_RGB2HSV_TRAITS(bgr_to_hsv, 3, 3, 0) - OPENCV_CUDA_IMPLEMENT_RGB2HSV_TRAITS(bgra_to_hsv, 4, 3, 0) - OPENCV_CUDA_IMPLEMENT_RGB2HSV_TRAITS(bgr_to_hsv4, 3, 4, 0) - OPENCV_CUDA_IMPLEMENT_RGB2HSV_TRAITS(bgra_to_hsv4, 4, 4, 0) - - #undef OPENCV_CUDA_IMPLEMENT_RGB2HSV_TRAITS - - OPENCV_CUDA_IMPLEMENT_HSV2RGB_TRAITS(hsv_to_rgb, 3, 3, 2) - OPENCV_CUDA_IMPLEMENT_HSV2RGB_TRAITS(hsv_to_rgba, 3, 4, 2) - OPENCV_CUDA_IMPLEMENT_HSV2RGB_TRAITS(hsv4_to_rgb, 4, 3, 2) - OPENCV_CUDA_IMPLEMENT_HSV2RGB_TRAITS(hsv4_to_rgba, 4, 4, 2) - OPENCV_CUDA_IMPLEMENT_HSV2RGB_TRAITS(hsv_to_bgr, 3, 3, 0) - OPENCV_CUDA_IMPLEMENT_HSV2RGB_TRAITS(hsv_to_bgra, 3, 4, 0) - OPENCV_CUDA_IMPLEMENT_HSV2RGB_TRAITS(hsv4_to_bgr, 4, 3, 0) - OPENCV_CUDA_IMPLEMENT_HSV2RGB_TRAITS(hsv4_to_bgra, 4, 4, 0) - - #undef OPENCV_CUDA_IMPLEMENT_HSV2RGB_TRAITS - - OPENCV_CUDA_IMPLEMENT_RGB2HLS_TRAITS(rgb_to_hls, 3, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2HLS_TRAITS(rgba_to_hls, 4, 3, 2) - OPENCV_CUDA_IMPLEMENT_RGB2HLS_TRAITS(rgb_to_hls4, 3, 4, 2) - OPENCV_CUDA_IMPLEMENT_RGB2HLS_TRAITS(rgba_to_hls4, 4, 4, 2) - OPENCV_CUDA_IMPLEMENT_RGB2HLS_TRAITS(bgr_to_hls, 3, 3, 0) - OPENCV_CUDA_IMPLEMENT_RGB2HLS_TRAITS(bgra_to_hls, 4, 3, 0) - OPENCV_CUDA_IMPLEMENT_RGB2HLS_TRAITS(bgr_to_hls4, 3, 4, 0) - OPENCV_CUDA_IMPLEMENT_RGB2HLS_TRAITS(bgra_to_hls4, 4, 4, 0) - - #undef OPENCV_CUDA_IMPLEMENT_RGB2HLS_TRAITS - - OPENCV_CUDA_IMPLEMENT_HLS2RGB_TRAITS(hls_to_rgb, 3, 3, 2) - OPENCV_CUDA_IMPLEMENT_HLS2RGB_TRAITS(hls_to_rgba, 3, 4, 2) - OPENCV_CUDA_IMPLEMENT_HLS2RGB_TRAITS(hls4_to_rgb, 4, 3, 2) - OPENCV_CUDA_IMPLEMENT_HLS2RGB_TRAITS(hls4_to_rgba, 4, 4, 2) - OPENCV_CUDA_IMPLEMENT_HLS2RGB_TRAITS(hls_to_bgr, 3, 3, 0) - OPENCV_CUDA_IMPLEMENT_HLS2RGB_TRAITS(hls_to_bgra, 3, 4, 0) - OPENCV_CUDA_IMPLEMENT_HLS2RGB_TRAITS(hls4_to_bgr, 4, 3, 0) - OPENCV_CUDA_IMPLEMENT_HLS2RGB_TRAITS(hls4_to_bgra, 4, 4, 0) - - #undef OPENCV_CUDA_IMPLEMENT_HLS2RGB_TRAITS - - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(rgb_to_lab, 3, 3, true, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(rgba_to_lab, 4, 3, true, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(rgb_to_lab4, 3, 4, true, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(rgba_to_lab4, 4, 4, true, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(bgr_to_lab, 3, 3, true, 0) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(bgra_to_lab, 4, 3, true, 0) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(bgr_to_lab4, 3, 4, true, 0) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(bgra_to_lab4, 4, 4, true, 0) - - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(lrgb_to_lab, 3, 3, false, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(lrgba_to_lab, 4, 3, false, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(lrgb_to_lab4, 3, 4, false, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(lrgba_to_lab4, 4, 4, false, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(lbgr_to_lab, 3, 3, false, 0) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(lbgra_to_lab, 4, 3, false, 0) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(lbgr_to_lab4, 3, 4, false, 0) - OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(lbgra_to_lab4, 4, 4, false, 0) - - #undef OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS - - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab_to_rgb, 3, 3, true, 2) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab4_to_rgb, 4, 3, true, 2) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab_to_rgba, 3, 4, true, 2) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab4_to_rgba, 4, 4, true, 2) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab_to_bgr, 3, 3, true, 0) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab4_to_bgr, 4, 3, true, 0) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab_to_bgra, 3, 4, true, 0) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab4_to_bgra, 4, 4, true, 0) - - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab_to_lrgb, 3, 3, false, 2) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab4_to_lrgb, 4, 3, false, 2) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab_to_lrgba, 3, 4, false, 2) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab4_to_lrgba, 4, 4, false, 2) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab_to_lbgr, 3, 3, false, 0) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab4_to_lbgr, 4, 3, false, 0) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab_to_lbgra, 3, 4, false, 0) - OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(lab4_to_lbgra, 4, 4, false, 0) - - #undef OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS - - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(rgb_to_luv, 3, 3, true, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(rgba_to_luv, 4, 3, true, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(rgb_to_luv4, 3, 4, true, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(rgba_to_luv4, 4, 4, true, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(bgr_to_luv, 3, 3, true, 0) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(bgra_to_luv, 4, 3, true, 0) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(bgr_to_luv4, 3, 4, true, 0) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(bgra_to_luv4, 4, 4, true, 0) - - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(lrgb_to_luv, 3, 3, false, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(lrgba_to_luv, 4, 3, false, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(lrgb_to_luv4, 3, 4, false, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(lrgba_to_luv4, 4, 4, false, 2) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(lbgr_to_luv, 3, 3, false, 0) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(lbgra_to_luv, 4, 3, false, 0) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(lbgr_to_luv4, 3, 4, false, 0) - OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(lbgra_to_luv4, 4, 4, false, 0) - - #undef OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS - - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv_to_rgb, 3, 3, true, 2) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv4_to_rgb, 4, 3, true, 2) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv_to_rgba, 3, 4, true, 2) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv4_to_rgba, 4, 4, true, 2) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv_to_bgr, 3, 3, true, 0) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv4_to_bgr, 4, 3, true, 0) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv_to_bgra, 3, 4, true, 0) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv4_to_bgra, 4, 4, true, 0) - - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv_to_lrgb, 3, 3, false, 2) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv4_to_lrgb, 4, 3, false, 2) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv_to_lrgba, 3, 4, false, 2) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv4_to_lrgba, 4, 4, false, 2) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv_to_lbgr, 3, 3, false, 0) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv4_to_lbgr, 4, 3, false, 0) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv_to_lbgra, 3, 4, false, 0) - OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(luv4_to_lbgra, 4, 4, false, 0) - - #undef OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif // OPENCV_CUDA_COLOR_HPP diff --git a/opencv/include/opencv2/core/cuda/common.hpp b/opencv/include/opencv2/core/cuda/common.hpp deleted file mode 100644 index 14b1f3f..0000000 --- a/opencv/include/opencv2/core/cuda/common.hpp +++ /dev/null @@ -1,109 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_COMMON_HPP -#define OPENCV_CUDA_COMMON_HPP - -#include -#include "opencv2/core/cuda_types.hpp" -#include "opencv2/core/cvdef.h" -#include "opencv2/core/base.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -#ifndef CV_PI_F - #ifndef CV_PI - #define CV_PI_F 3.14159265f - #else - #define CV_PI_F ((float)CV_PI) - #endif -#endif - -namespace cv { namespace cuda { - static inline void checkCudaError(cudaError_t err, const char* file, const int line, const char* func) - { - if (cudaSuccess != err) - cv::error(cv::Error::GpuApiCallError, cudaGetErrorString(err), func, file, line); - } -}} - -#ifndef cudaSafeCall - #define cudaSafeCall(expr) cv::cuda::checkCudaError(expr, __FILE__, __LINE__, CV_Func) -#endif - -namespace cv { namespace cuda -{ - template static inline bool isAligned(const T* ptr, size_t size) - { - return reinterpret_cast(ptr) % size == 0; - } - - static inline bool isAligned(size_t step, size_t size) - { - return step % size == 0; - } -}} - -namespace cv { namespace cuda -{ - namespace device - { - __host__ __device__ __forceinline__ int divUp(int total, int grain) - { - return (total + grain - 1) / grain; - } - - template inline void bindTexture(const textureReference* tex, const PtrStepSz& img) - { - cudaChannelFormatDesc desc = cudaCreateChannelDesc(); - cudaSafeCall( cudaBindTexture2D(0, tex, img.ptr(), &desc, img.cols, img.rows, img.step) ); - } - } -}} - -//! @endcond - -#endif // OPENCV_CUDA_COMMON_HPP diff --git a/opencv/include/opencv2/core/cuda/datamov_utils.hpp b/opencv/include/opencv2/core/cuda/datamov_utils.hpp deleted file mode 100644 index 6820d0f..0000000 --- a/opencv/include/opencv2/core/cuda/datamov_utils.hpp +++ /dev/null @@ -1,113 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_DATAMOV_UTILS_HPP -#define OPENCV_CUDA_DATAMOV_UTILS_HPP - -#include "common.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 200 - - // for Fermi memory space is detected automatically - template struct ForceGlob - { - __device__ __forceinline__ static void Load(const T* ptr, int offset, T& val) { val = ptr[offset]; } - }; - - #else // __CUDA_ARCH__ >= 200 - - #if defined(_WIN64) || defined(__LP64__) - // 64-bit register modifier for inlined asm - #define OPENCV_CUDA_ASM_PTR "l" - #else - // 32-bit register modifier for inlined asm - #define OPENCV_CUDA_ASM_PTR "r" - #endif - - template struct ForceGlob; - - #define OPENCV_CUDA_DEFINE_FORCE_GLOB(base_type, ptx_type, reg_mod) \ - template <> struct ForceGlob \ - { \ - __device__ __forceinline__ static void Load(const base_type* ptr, int offset, base_type& val) \ - { \ - asm("ld.global."#ptx_type" %0, [%1];" : "="#reg_mod(val) : OPENCV_CUDA_ASM_PTR(ptr + offset)); \ - } \ - }; - - #define OPENCV_CUDA_DEFINE_FORCE_GLOB_B(base_type, ptx_type) \ - template <> struct ForceGlob \ - { \ - __device__ __forceinline__ static void Load(const base_type* ptr, int offset, base_type& val) \ - { \ - asm("ld.global."#ptx_type" %0, [%1];" : "=r"(*reinterpret_cast(&val)) : OPENCV_CUDA_ASM_PTR(ptr + offset)); \ - } \ - }; - - OPENCV_CUDA_DEFINE_FORCE_GLOB_B(uchar, u8) - OPENCV_CUDA_DEFINE_FORCE_GLOB_B(schar, s8) - OPENCV_CUDA_DEFINE_FORCE_GLOB_B(char, b8) - OPENCV_CUDA_DEFINE_FORCE_GLOB (ushort, u16, h) - OPENCV_CUDA_DEFINE_FORCE_GLOB (short, s16, h) - OPENCV_CUDA_DEFINE_FORCE_GLOB (uint, u32, r) - OPENCV_CUDA_DEFINE_FORCE_GLOB (int, s32, r) - OPENCV_CUDA_DEFINE_FORCE_GLOB (float, f32, f) - OPENCV_CUDA_DEFINE_FORCE_GLOB (double, f64, d) - - #undef OPENCV_CUDA_DEFINE_FORCE_GLOB - #undef OPENCV_CUDA_DEFINE_FORCE_GLOB_B - #undef OPENCV_CUDA_ASM_PTR - - #endif // __CUDA_ARCH__ >= 200 -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif // OPENCV_CUDA_DATAMOV_UTILS_HPP diff --git a/opencv/include/opencv2/core/cuda/detail/color_detail.hpp b/opencv/include/opencv2/core/cuda/detail/color_detail.hpp deleted file mode 100644 index bfb4055..0000000 --- a/opencv/include/opencv2/core/cuda/detail/color_detail.hpp +++ /dev/null @@ -1,1980 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_COLOR_DETAIL_HPP -#define OPENCV_CUDA_COLOR_DETAIL_HPP - -#include "../common.hpp" -#include "../vec_traits.hpp" -#include "../saturate_cast.hpp" -#include "../limits.hpp" -#include "../functional.hpp" - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - #ifndef CV_DESCALE - #define CV_DESCALE(x, n) (((x) + (1 << ((n)-1))) >> (n)) - #endif - - namespace color_detail - { - template struct ColorChannel - { - typedef float worktype_f; - static __device__ __forceinline__ T max() { return numeric_limits::max(); } - static __device__ __forceinline__ T half() { return (T)(max()/2 + 1); } - }; - - template<> struct ColorChannel - { - typedef float worktype_f; - static __device__ __forceinline__ float max() { return 1.f; } - static __device__ __forceinline__ float half() { return 0.5f; } - }; - - template static __device__ __forceinline__ void setAlpha(typename TypeVec::vec_type& vec, T val) - { - } - - template static __device__ __forceinline__ void setAlpha(typename TypeVec::vec_type& vec, T val) - { - vec.w = val; - } - - template static __device__ __forceinline__ T getAlpha(const typename TypeVec::vec_type& vec) - { - return ColorChannel::max(); - } - - template static __device__ __forceinline__ T getAlpha(const typename TypeVec::vec_type& vec) - { - return vec.w; - } - - enum - { - yuv_shift = 14, - xyz_shift = 12, - R2Y = 4899, - G2Y = 9617, - B2Y = 1868, - BLOCK_SIZE = 256 - }; - } - -////////////////// Various 3/4-channel to 3/4-channel RGB transformations ///////////////// - - namespace color_detail - { - template struct RGB2RGB - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ typename TypeVec::vec_type operator()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - dst.x = (&src.x)[bidx]; - dst.y = src.y; - dst.z = (&src.x)[bidx^2]; - setAlpha(dst, getAlpha(src)); - - return dst; - } - - __host__ __device__ __forceinline__ RGB2RGB() {} - __host__ __device__ __forceinline__ RGB2RGB(const RGB2RGB&) {} - }; - - template <> struct RGB2RGB : unary_function - { - __device__ uint operator()(uint src) const - { - uint dst = 0; - - dst |= (0xffu & (src >> 16)); - dst |= (0xffu & (src >> 8)) << 8; - dst |= (0xffu & (src)) << 16; - dst |= (0xffu & (src >> 24)) << 24; - - return dst; - } - - __host__ __device__ __forceinline__ RGB2RGB() {} - __host__ __device__ __forceinline__ RGB2RGB(const RGB2RGB&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_RGB2RGB_TRAITS(name, scn, dcn, bidx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - -/////////// Transforming 16-bit (565 or 555) RGB to/from 24/32-bit (888[8]) RGB ////////// - - namespace color_detail - { - template struct RGB2RGB5x5Converter; - template struct RGB2RGB5x5Converter<6, bidx> - { - static __device__ __forceinline__ ushort cvt(const uchar3& src) - { - return (ushort)(((&src.x)[bidx] >> 3) | ((src.y & ~3) << 3) | (((&src.x)[bidx^2] & ~7) << 8)); - } - - static __device__ __forceinline__ ushort cvt(uint src) - { - uint b = 0xffu & (src >> (bidx * 8)); - uint g = 0xffu & (src >> 8); - uint r = 0xffu & (src >> ((bidx ^ 2) * 8)); - return (ushort)((b >> 3) | ((g & ~3) << 3) | ((r & ~7) << 8)); - } - }; - - template struct RGB2RGB5x5Converter<5, bidx> - { - static __device__ __forceinline__ ushort cvt(const uchar3& src) - { - return (ushort)(((&src.x)[bidx] >> 3) | ((src.y & ~7) << 2) | (((&src.x)[bidx^2] & ~7) << 7)); - } - - static __device__ __forceinline__ ushort cvt(uint src) - { - uint b = 0xffu & (src >> (bidx * 8)); - uint g = 0xffu & (src >> 8); - uint r = 0xffu & (src >> ((bidx ^ 2) * 8)); - uint a = 0xffu & (src >> 24); - return (ushort)((b >> 3) | ((g & ~7) << 2) | ((r & ~7) << 7) | (a * 0x8000)); - } - }; - - template struct RGB2RGB5x5; - - template struct RGB2RGB5x5<3, bidx,green_bits> : unary_function - { - __device__ __forceinline__ ushort operator()(const uchar3& src) const - { - return RGB2RGB5x5Converter::cvt(src); - } - - __host__ __device__ __forceinline__ RGB2RGB5x5() {} - __host__ __device__ __forceinline__ RGB2RGB5x5(const RGB2RGB5x5&) {} - }; - - template struct RGB2RGB5x5<4, bidx,green_bits> : unary_function - { - __device__ __forceinline__ ushort operator()(uint src) const - { - return RGB2RGB5x5Converter::cvt(src); - } - - __host__ __device__ __forceinline__ RGB2RGB5x5() {} - __host__ __device__ __forceinline__ RGB2RGB5x5(const RGB2RGB5x5&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_RGB2RGB5x5_TRAITS(name, scn, bidx, green_bits) \ - struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2RGB5x5 functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - - namespace color_detail - { - template struct RGB5x52RGBConverter; - - template struct RGB5x52RGBConverter<5, bidx> - { - static __device__ __forceinline__ void cvt(uint src, uchar3& dst) - { - (&dst.x)[bidx] = src << 3; - dst.y = (src >> 2) & ~7; - (&dst.x)[bidx ^ 2] = (src >> 7) & ~7; - } - - static __device__ __forceinline__ void cvt(uint src, uint& dst) - { - dst = 0; - - dst |= (0xffu & (src << 3)) << (bidx * 8); - dst |= (0xffu & ((src >> 2) & ~7)) << 8; - dst |= (0xffu & ((src >> 7) & ~7)) << ((bidx ^ 2) * 8); - dst |= ((src & 0x8000) * 0xffu) << 24; - } - }; - - template struct RGB5x52RGBConverter<6, bidx> - { - static __device__ __forceinline__ void cvt(uint src, uchar3& dst) - { - (&dst.x)[bidx] = src << 3; - dst.y = (src >> 3) & ~3; - (&dst.x)[bidx ^ 2] = (src >> 8) & ~7; - } - - static __device__ __forceinline__ void cvt(uint src, uint& dst) - { - dst = 0xffu << 24; - - dst |= (0xffu & (src << 3)) << (bidx * 8); - dst |= (0xffu &((src >> 3) & ~3)) << 8; - dst |= (0xffu & ((src >> 8) & ~7)) << ((bidx ^ 2) * 8); - } - }; - - template struct RGB5x52RGB; - - template struct RGB5x52RGB<3, bidx, green_bits> : unary_function - { - __device__ __forceinline__ uchar3 operator()(ushort src) const - { - uchar3 dst; - RGB5x52RGBConverter::cvt(src, dst); - return dst; - } - __host__ __device__ __forceinline__ RGB5x52RGB() {} - __host__ __device__ __forceinline__ RGB5x52RGB(const RGB5x52RGB&) {} - - }; - - template struct RGB5x52RGB<4, bidx, green_bits> : unary_function - { - __device__ __forceinline__ uint operator()(ushort src) const - { - uint dst; - RGB5x52RGBConverter::cvt(src, dst); - return dst; - } - __host__ __device__ __forceinline__ RGB5x52RGB() {} - __host__ __device__ __forceinline__ RGB5x52RGB(const RGB5x52RGB&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_RGB5x52RGB_TRAITS(name, dcn, bidx, green_bits) \ - struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB5x52RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - -///////////////////////////////// Grayscale to Color //////////////////////////////// - - namespace color_detail - { - template struct Gray2RGB : unary_function::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator()(T src) const - { - typename TypeVec::vec_type dst; - - dst.z = dst.y = dst.x = src; - setAlpha(dst, ColorChannel::max()); - - return dst; - } - __host__ __device__ __forceinline__ Gray2RGB() {} - __host__ __device__ __forceinline__ Gray2RGB(const Gray2RGB&) {} - }; - - template <> struct Gray2RGB : unary_function - { - __device__ __forceinline__ uint operator()(uint src) const - { - uint dst = 0xffu << 24; - - dst |= src; - dst |= src << 8; - dst |= src << 16; - - return dst; - } - __host__ __device__ __forceinline__ Gray2RGB() {} - __host__ __device__ __forceinline__ Gray2RGB(const Gray2RGB&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_GRAY2RGB_TRAITS(name, dcn) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::Gray2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - - namespace color_detail - { - template struct Gray2RGB5x5Converter; - template<> struct Gray2RGB5x5Converter<6> - { - static __device__ __forceinline__ ushort cvt(uint t) - { - return (ushort)((t >> 3) | ((t & ~3) << 3) | ((t & ~7) << 8)); - } - }; - - template<> struct Gray2RGB5x5Converter<5> - { - static __device__ __forceinline__ ushort cvt(uint t) - { - t >>= 3; - return (ushort)(t | (t << 5) | (t << 10)); - } - }; - - template struct Gray2RGB5x5 : unary_function - { - __device__ __forceinline__ ushort operator()(uint src) const - { - return Gray2RGB5x5Converter::cvt(src); - } - - __host__ __device__ __forceinline__ Gray2RGB5x5() {} - __host__ __device__ __forceinline__ Gray2RGB5x5(const Gray2RGB5x5&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_GRAY2RGB5x5_TRAITS(name, green_bits) \ - struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::Gray2RGB5x5 functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - -///////////////////////////////// Color to Grayscale //////////////////////////////// - - namespace color_detail - { - template struct RGB5x52GrayConverter; - template <> struct RGB5x52GrayConverter<6> - { - static __device__ __forceinline__ uchar cvt(uint t) - { - return (uchar)CV_DESCALE(((t << 3) & 0xf8) * B2Y + ((t >> 3) & 0xfc) * G2Y + ((t >> 8) & 0xf8) * R2Y, yuv_shift); - } - }; - - template <> struct RGB5x52GrayConverter<5> - { - static __device__ __forceinline__ uchar cvt(uint t) - { - return (uchar)CV_DESCALE(((t << 3) & 0xf8) * B2Y + ((t >> 2) & 0xf8) * G2Y + ((t >> 7) & 0xf8) * R2Y, yuv_shift); - } - }; - - template struct RGB5x52Gray : unary_function - { - __device__ __forceinline__ uchar operator()(uint src) const - { - return RGB5x52GrayConverter::cvt(src); - } - __host__ __device__ __forceinline__ RGB5x52Gray() {} - __host__ __device__ __forceinline__ RGB5x52Gray(const RGB5x52Gray&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_RGB5x52GRAY_TRAITS(name, green_bits) \ - struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB5x52Gray functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - - namespace color_detail - { - template static __device__ __forceinline__ T RGB2GrayConvert(const T* src) - { - return (T)CV_DESCALE((unsigned)(src[bidx] * B2Y + src[1] * G2Y + src[bidx^2] * R2Y), yuv_shift); - } - - template static __device__ __forceinline__ uchar RGB2GrayConvert(uint src) - { - uint b = 0xffu & (src >> (bidx * 8)); - uint g = 0xffu & (src >> 8); - uint r = 0xffu & (src >> ((bidx ^ 2) * 8)); - return CV_DESCALE((uint)(b * B2Y + g * G2Y + r * R2Y), yuv_shift); - } - - template static __device__ __forceinline__ float RGB2GrayConvert(const float* src) - { - return src[bidx] * 0.114f + src[1] * 0.587f + src[bidx^2] * 0.299f; - } - - template struct RGB2Gray : unary_function::vec_type, T> - { - __device__ __forceinline__ T operator()(const typename TypeVec::vec_type& src) const - { - return RGB2GrayConvert(&src.x); - } - __host__ __device__ __forceinline__ RGB2Gray() {} - __host__ __device__ __forceinline__ RGB2Gray(const RGB2Gray&) {} - }; - - template struct RGB2Gray : unary_function - { - __device__ __forceinline__ uchar operator()(uint src) const - { - return RGB2GrayConvert(src); - } - __host__ __device__ __forceinline__ RGB2Gray() {} - __host__ __device__ __forceinline__ RGB2Gray(const RGB2Gray&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_RGB2GRAY_TRAITS(name, scn, bidx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2Gray functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - -///////////////////////////////////// RGB <-> YUV ////////////////////////////////////// - - namespace color_detail - { - __constant__ float c_RGB2YUVCoeffs_f[5] = { 0.114f, 0.587f, 0.299f, 0.492f, 0.877f }; - __constant__ int c_RGB2YUVCoeffs_i[5] = { B2Y, G2Y, R2Y, 8061, 14369 }; - - template static __device__ void RGB2YUVConvert(const T* src, D& dst) - { - const int delta = ColorChannel::half() * (1 << yuv_shift); - - const int Y = CV_DESCALE(src[0] * c_RGB2YUVCoeffs_i[bidx^2] + src[1] * c_RGB2YUVCoeffs_i[1] + src[2] * c_RGB2YUVCoeffs_i[bidx], yuv_shift); - const int Cr = CV_DESCALE((src[bidx^2] - Y) * c_RGB2YUVCoeffs_i[3] + delta, yuv_shift); - const int Cb = CV_DESCALE((src[bidx] - Y) * c_RGB2YUVCoeffs_i[4] + delta, yuv_shift); - - dst.x = saturate_cast(Y); - dst.y = saturate_cast(Cr); - dst.z = saturate_cast(Cb); - } - - template static __device__ __forceinline__ void RGB2YUVConvert(const float* src, D& dst) - { - dst.x = src[0] * c_RGB2YUVCoeffs_f[bidx^2] + src[1] * c_RGB2YUVCoeffs_f[1] + src[2] * c_RGB2YUVCoeffs_f[bidx]; - dst.y = (src[bidx^2] - dst.x) * c_RGB2YUVCoeffs_f[3] + ColorChannel::half(); - dst.z = (src[bidx] - dst.x) * c_RGB2YUVCoeffs_f[4] + ColorChannel::half(); - } - - template struct RGB2YUV - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator ()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - RGB2YUVConvert(&src.x, dst); - return dst; - } - __host__ __device__ __forceinline__ RGB2YUV() {} - __host__ __device__ __forceinline__ RGB2YUV(const RGB2YUV&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_RGB2YUV_TRAITS(name, scn, dcn, bidx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2YUV functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - - namespace color_detail - { - __constant__ float c_YUV2RGBCoeffs_f[5] = { 2.032f, -0.395f, -0.581f, 1.140f }; - __constant__ int c_YUV2RGBCoeffs_i[5] = { 33292, -6472, -9519, 18678 }; - - template static __device__ void YUV2RGBConvert(const T& src, D* dst) - { - const int b = src.x + CV_DESCALE((src.z - ColorChannel::half()) * c_YUV2RGBCoeffs_i[3], yuv_shift); - - const int g = src.x + CV_DESCALE((src.z - ColorChannel::half()) * c_YUV2RGBCoeffs_i[2] - + (src.y - ColorChannel::half()) * c_YUV2RGBCoeffs_i[1], yuv_shift); - - const int r = src.x + CV_DESCALE((src.y - ColorChannel::half()) * c_YUV2RGBCoeffs_i[0], yuv_shift); - - dst[bidx] = saturate_cast(b); - dst[1] = saturate_cast(g); - dst[bidx^2] = saturate_cast(r); - } - - template static __device__ uint YUV2RGBConvert(uint src) - { - const int x = 0xff & (src); - const int y = 0xff & (src >> 8); - const int z = 0xff & (src >> 16); - - const int b = x + CV_DESCALE((z - ColorChannel::half()) * c_YUV2RGBCoeffs_i[3], yuv_shift); - - const int g = x + CV_DESCALE((z - ColorChannel::half()) * c_YUV2RGBCoeffs_i[2] - + (y - ColorChannel::half()) * c_YUV2RGBCoeffs_i[1], yuv_shift); - - const int r = x + CV_DESCALE((y - ColorChannel::half()) * c_YUV2RGBCoeffs_i[0], yuv_shift); - - uint dst = 0xffu << 24; - - dst |= saturate_cast(b) << (bidx * 8); - dst |= saturate_cast(g) << 8; - dst |= saturate_cast(r) << ((bidx ^ 2) * 8); - - return dst; - } - - template static __device__ __forceinline__ void YUV2RGBConvert(const T& src, float* dst) - { - dst[bidx] = src.x + (src.z - ColorChannel::half()) * c_YUV2RGBCoeffs_f[3]; - - dst[1] = src.x + (src.z - ColorChannel::half()) * c_YUV2RGBCoeffs_f[2] - + (src.y - ColorChannel::half()) * c_YUV2RGBCoeffs_f[1]; - - dst[bidx^2] = src.x + (src.y - ColorChannel::half()) * c_YUV2RGBCoeffs_f[0]; - } - - template struct YUV2RGB - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator ()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - YUV2RGBConvert(src, &dst.x); - setAlpha(dst, ColorChannel::max()); - - return dst; - } - __host__ __device__ __forceinline__ YUV2RGB() {} - __host__ __device__ __forceinline__ YUV2RGB(const YUV2RGB&) {} - }; - - template struct YUV2RGB : unary_function - { - __device__ __forceinline__ uint operator ()(uint src) const - { - return YUV2RGBConvert(src); - } - __host__ __device__ __forceinline__ YUV2RGB() {} - __host__ __device__ __forceinline__ YUV2RGB(const YUV2RGB&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_YUV2RGB_TRAITS(name, scn, dcn, bidx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::YUV2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - -///////////////////////////////////// RGB <-> YCrCb ////////////////////////////////////// - - namespace color_detail - { - __constant__ float c_RGB2YCrCbCoeffs_f[5] = {0.299f, 0.587f, 0.114f, 0.713f, 0.564f}; - __constant__ int c_RGB2YCrCbCoeffs_i[5] = {R2Y, G2Y, B2Y, 11682, 9241}; - - template static __device__ void RGB2YCrCbConvert(const T* src, D& dst) - { - const int delta = ColorChannel::half() * (1 << yuv_shift); - - const int Y = CV_DESCALE(src[0] * c_RGB2YCrCbCoeffs_i[bidx^2] + src[1] * c_RGB2YCrCbCoeffs_i[1] + src[2] * c_RGB2YCrCbCoeffs_i[bidx], yuv_shift); - const int Cr = CV_DESCALE((src[bidx^2] - Y) * c_RGB2YCrCbCoeffs_i[3] + delta, yuv_shift); - const int Cb = CV_DESCALE((src[bidx] - Y) * c_RGB2YCrCbCoeffs_i[4] + delta, yuv_shift); - - dst.x = saturate_cast(Y); - dst.y = saturate_cast(Cr); - dst.z = saturate_cast(Cb); - } - - template static __device__ uint RGB2YCrCbConvert(uint src) - { - const int delta = ColorChannel::half() * (1 << yuv_shift); - - const int Y = CV_DESCALE((0xffu & src) * c_RGB2YCrCbCoeffs_i[bidx^2] + (0xffu & (src >> 8)) * c_RGB2YCrCbCoeffs_i[1] + (0xffu & (src >> 16)) * c_RGB2YCrCbCoeffs_i[bidx], yuv_shift); - const int Cr = CV_DESCALE(((0xffu & (src >> ((bidx ^ 2) * 8))) - Y) * c_RGB2YCrCbCoeffs_i[3] + delta, yuv_shift); - const int Cb = CV_DESCALE(((0xffu & (src >> (bidx * 8))) - Y) * c_RGB2YCrCbCoeffs_i[4] + delta, yuv_shift); - - uint dst = 0; - - dst |= saturate_cast(Y); - dst |= saturate_cast(Cr) << 8; - dst |= saturate_cast(Cb) << 16; - - return dst; - } - - template static __device__ __forceinline__ void RGB2YCrCbConvert(const float* src, D& dst) - { - dst.x = src[0] * c_RGB2YCrCbCoeffs_f[bidx^2] + src[1] * c_RGB2YCrCbCoeffs_f[1] + src[2] * c_RGB2YCrCbCoeffs_f[bidx]; - dst.y = (src[bidx^2] - dst.x) * c_RGB2YCrCbCoeffs_f[3] + ColorChannel::half(); - dst.z = (src[bidx] - dst.x) * c_RGB2YCrCbCoeffs_f[4] + ColorChannel::half(); - } - - template struct RGB2YCrCb - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator ()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - RGB2YCrCbConvert(&src.x, dst); - return dst; - } - __host__ __device__ __forceinline__ RGB2YCrCb() {} - __host__ __device__ __forceinline__ RGB2YCrCb(const RGB2YCrCb&) {} - }; - - template struct RGB2YCrCb : unary_function - { - __device__ __forceinline__ uint operator ()(uint src) const - { - return RGB2YCrCbConvert(src); - } - - __host__ __device__ __forceinline__ RGB2YCrCb() {} - __host__ __device__ __forceinline__ RGB2YCrCb(const RGB2YCrCb&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_RGB2YCrCb_TRAITS(name, scn, dcn, bidx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2YCrCb functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - - namespace color_detail - { - __constant__ float c_YCrCb2RGBCoeffs_f[5] = {1.403f, -0.714f, -0.344f, 1.773f}; - __constant__ int c_YCrCb2RGBCoeffs_i[5] = {22987, -11698, -5636, 29049}; - - template static __device__ void YCrCb2RGBConvert(const T& src, D* dst) - { - const int b = src.x + CV_DESCALE((src.z - ColorChannel::half()) * c_YCrCb2RGBCoeffs_i[3], yuv_shift); - const int g = src.x + CV_DESCALE((src.z - ColorChannel::half()) * c_YCrCb2RGBCoeffs_i[2] + (src.y - ColorChannel::half()) * c_YCrCb2RGBCoeffs_i[1], yuv_shift); - const int r = src.x + CV_DESCALE((src.y - ColorChannel::half()) * c_YCrCb2RGBCoeffs_i[0], yuv_shift); - - dst[bidx] = saturate_cast(b); - dst[1] = saturate_cast(g); - dst[bidx^2] = saturate_cast(r); - } - - template static __device__ uint YCrCb2RGBConvert(uint src) - { - const int x = 0xff & (src); - const int y = 0xff & (src >> 8); - const int z = 0xff & (src >> 16); - - const int b = x + CV_DESCALE((z - ColorChannel::half()) * c_YCrCb2RGBCoeffs_i[3], yuv_shift); - const int g = x + CV_DESCALE((z - ColorChannel::half()) * c_YCrCb2RGBCoeffs_i[2] + (y - ColorChannel::half()) * c_YCrCb2RGBCoeffs_i[1], yuv_shift); - const int r = x + CV_DESCALE((y - ColorChannel::half()) * c_YCrCb2RGBCoeffs_i[0], yuv_shift); - - uint dst = 0xffu << 24; - - dst |= saturate_cast(b) << (bidx * 8); - dst |= saturate_cast(g) << 8; - dst |= saturate_cast(r) << ((bidx ^ 2) * 8); - - return dst; - } - - template __device__ __forceinline__ void YCrCb2RGBConvert(const T& src, float* dst) - { - dst[bidx] = src.x + (src.z - ColorChannel::half()) * c_YCrCb2RGBCoeffs_f[3]; - dst[1] = src.x + (src.z - ColorChannel::half()) * c_YCrCb2RGBCoeffs_f[2] + (src.y - ColorChannel::half()) * c_YCrCb2RGBCoeffs_f[1]; - dst[bidx^2] = src.x + (src.y - ColorChannel::half()) * c_YCrCb2RGBCoeffs_f[0]; - } - - template struct YCrCb2RGB - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator ()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - YCrCb2RGBConvert(src, &dst.x); - setAlpha(dst, ColorChannel::max()); - - return dst; - } - __host__ __device__ __forceinline__ YCrCb2RGB() {} - __host__ __device__ __forceinline__ YCrCb2RGB(const YCrCb2RGB&) {} - }; - - template struct YCrCb2RGB : unary_function - { - __device__ __forceinline__ uint operator ()(uint src) const - { - return YCrCb2RGBConvert(src); - } - __host__ __device__ __forceinline__ YCrCb2RGB() {} - __host__ __device__ __forceinline__ YCrCb2RGB(const YCrCb2RGB&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_YCrCb2RGB_TRAITS(name, scn, dcn, bidx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::YCrCb2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - -////////////////////////////////////// RGB <-> XYZ /////////////////////////////////////// - - namespace color_detail - { - __constant__ float c_RGB2XYZ_D65f[9] = { 0.412453f, 0.357580f, 0.180423f, 0.212671f, 0.715160f, 0.072169f, 0.019334f, 0.119193f, 0.950227f }; - __constant__ int c_RGB2XYZ_D65i[9] = { 1689, 1465, 739, 871, 2929, 296, 79, 488, 3892 }; - - template static __device__ __forceinline__ void RGB2XYZConvert(const T* src, D& dst) - { - dst.z = saturate_cast(CV_DESCALE(src[bidx^2] * c_RGB2XYZ_D65i[6] + src[1] * c_RGB2XYZ_D65i[7] + src[bidx] * c_RGB2XYZ_D65i[8], xyz_shift)); - dst.x = saturate_cast(CV_DESCALE(src[bidx^2] * c_RGB2XYZ_D65i[0] + src[1] * c_RGB2XYZ_D65i[1] + src[bidx] * c_RGB2XYZ_D65i[2], xyz_shift)); - dst.y = saturate_cast(CV_DESCALE(src[bidx^2] * c_RGB2XYZ_D65i[3] + src[1] * c_RGB2XYZ_D65i[4] + src[bidx] * c_RGB2XYZ_D65i[5], xyz_shift)); - } - - template static __device__ __forceinline__ uint RGB2XYZConvert(uint src) - { - const uint b = 0xffu & (src >> (bidx * 8)); - const uint g = 0xffu & (src >> 8); - const uint r = 0xffu & (src >> ((bidx ^ 2) * 8)); - - const uint x = saturate_cast(CV_DESCALE(r * c_RGB2XYZ_D65i[0] + g * c_RGB2XYZ_D65i[1] + b * c_RGB2XYZ_D65i[2], xyz_shift)); - const uint y = saturate_cast(CV_DESCALE(r * c_RGB2XYZ_D65i[3] + g * c_RGB2XYZ_D65i[4] + b * c_RGB2XYZ_D65i[5], xyz_shift)); - const uint z = saturate_cast(CV_DESCALE(r * c_RGB2XYZ_D65i[6] + g * c_RGB2XYZ_D65i[7] + b * c_RGB2XYZ_D65i[8], xyz_shift)); - - uint dst = 0; - - dst |= x; - dst |= y << 8; - dst |= z << 16; - - return dst; - } - - template static __device__ __forceinline__ void RGB2XYZConvert(const float* src, D& dst) - { - dst.x = src[bidx^2] * c_RGB2XYZ_D65f[0] + src[1] * c_RGB2XYZ_D65f[1] + src[bidx] * c_RGB2XYZ_D65f[2]; - dst.y = src[bidx^2] * c_RGB2XYZ_D65f[3] + src[1] * c_RGB2XYZ_D65f[4] + src[bidx] * c_RGB2XYZ_D65f[5]; - dst.z = src[bidx^2] * c_RGB2XYZ_D65f[6] + src[1] * c_RGB2XYZ_D65f[7] + src[bidx] * c_RGB2XYZ_D65f[8]; - } - - template struct RGB2XYZ - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - RGB2XYZConvert(&src.x, dst); - - return dst; - } - __host__ __device__ __forceinline__ RGB2XYZ() {} - __host__ __device__ __forceinline__ RGB2XYZ(const RGB2XYZ&) {} - }; - - template struct RGB2XYZ : unary_function - { - __device__ __forceinline__ uint operator()(uint src) const - { - return RGB2XYZConvert(src); - } - __host__ __device__ __forceinline__ RGB2XYZ() {} - __host__ __device__ __forceinline__ RGB2XYZ(const RGB2XYZ&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_RGB2XYZ_TRAITS(name, scn, dcn, bidx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2XYZ functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - - namespace color_detail - { - __constant__ float c_XYZ2sRGB_D65f[9] = { 3.240479f, -1.53715f, -0.498535f, -0.969256f, 1.875991f, 0.041556f, 0.055648f, -0.204043f, 1.057311f }; - __constant__ int c_XYZ2sRGB_D65i[9] = { 13273, -6296, -2042, -3970, 7684, 170, 228, -836, 4331 }; - - template static __device__ __forceinline__ void XYZ2RGBConvert(const T& src, D* dst) - { - dst[bidx^2] = saturate_cast(CV_DESCALE(src.x * c_XYZ2sRGB_D65i[0] + src.y * c_XYZ2sRGB_D65i[1] + src.z * c_XYZ2sRGB_D65i[2], xyz_shift)); - dst[1] = saturate_cast(CV_DESCALE(src.x * c_XYZ2sRGB_D65i[3] + src.y * c_XYZ2sRGB_D65i[4] + src.z * c_XYZ2sRGB_D65i[5], xyz_shift)); - dst[bidx] = saturate_cast(CV_DESCALE(src.x * c_XYZ2sRGB_D65i[6] + src.y * c_XYZ2sRGB_D65i[7] + src.z * c_XYZ2sRGB_D65i[8], xyz_shift)); - } - - template static __device__ __forceinline__ uint XYZ2RGBConvert(uint src) - { - const int x = 0xff & src; - const int y = 0xff & (src >> 8); - const int z = 0xff & (src >> 16); - - const uint r = saturate_cast(CV_DESCALE(x * c_XYZ2sRGB_D65i[0] + y * c_XYZ2sRGB_D65i[1] + z * c_XYZ2sRGB_D65i[2], xyz_shift)); - const uint g = saturate_cast(CV_DESCALE(x * c_XYZ2sRGB_D65i[3] + y * c_XYZ2sRGB_D65i[4] + z * c_XYZ2sRGB_D65i[5], xyz_shift)); - const uint b = saturate_cast(CV_DESCALE(x * c_XYZ2sRGB_D65i[6] + y * c_XYZ2sRGB_D65i[7] + z * c_XYZ2sRGB_D65i[8], xyz_shift)); - - uint dst = 0xffu << 24; - - dst |= b << (bidx * 8); - dst |= g << 8; - dst |= r << ((bidx ^ 2) * 8); - - return dst; - } - - template static __device__ __forceinline__ void XYZ2RGBConvert(const T& src, float* dst) - { - dst[bidx^2] = src.x * c_XYZ2sRGB_D65f[0] + src.y * c_XYZ2sRGB_D65f[1] + src.z * c_XYZ2sRGB_D65f[2]; - dst[1] = src.x * c_XYZ2sRGB_D65f[3] + src.y * c_XYZ2sRGB_D65f[4] + src.z * c_XYZ2sRGB_D65f[5]; - dst[bidx] = src.x * c_XYZ2sRGB_D65f[6] + src.y * c_XYZ2sRGB_D65f[7] + src.z * c_XYZ2sRGB_D65f[8]; - } - - template struct XYZ2RGB - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - XYZ2RGBConvert(src, &dst.x); - setAlpha(dst, ColorChannel::max()); - - return dst; - } - __host__ __device__ __forceinline__ XYZ2RGB() {} - __host__ __device__ __forceinline__ XYZ2RGB(const XYZ2RGB&) {} - }; - - template struct XYZ2RGB : unary_function - { - __device__ __forceinline__ uint operator()(uint src) const - { - return XYZ2RGBConvert(src); - } - __host__ __device__ __forceinline__ XYZ2RGB() {} - __host__ __device__ __forceinline__ XYZ2RGB(const XYZ2RGB&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_XYZ2RGB_TRAITS(name, scn, dcn, bidx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::XYZ2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - -////////////////////////////////////// RGB <-> HSV /////////////////////////////////////// - - namespace color_detail - { - __constant__ int c_HsvDivTable [256] = {0, 1044480, 522240, 348160, 261120, 208896, 174080, 149211, 130560, 116053, 104448, 94953, 87040, 80345, 74606, 69632, 65280, 61440, 58027, 54973, 52224, 49737, 47476, 45412, 43520, 41779, 40172, 38684, 37303, 36017, 34816, 33693, 32640, 31651, 30720, 29842, 29013, 28229, 27486, 26782, 26112, 25475, 24869, 24290, 23738, 23211, 22706, 22223, 21760, 21316, 20890, 20480, 20086, 19707, 19342, 18991, 18651, 18324, 18008, 17703, 17408, 17123, 16846, 16579, 16320, 16069, 15825, 15589, 15360, 15137, 14921, 14711, 14507, 14308, 14115, 13926, 13743, 13565, 13391, 13221, 13056, 12895, 12738, 12584, 12434, 12288, 12145, 12006, 11869, 11736, 11605, 11478, 11353, 11231, 11111, 10995, 10880, 10768, 10658, 10550, 10445, 10341, 10240, 10141, 10043, 9947, 9854, 9761, 9671, 9582, 9495, 9410, 9326, 9243, 9162, 9082, 9004, 8927, 8852, 8777, 8704, 8632, 8561, 8492, 8423, 8356, 8290, 8224, 8160, 8097, 8034, 7973, 7913, 7853, 7795, 7737, 7680, 7624, 7569, 7514, 7461, 7408, 7355, 7304, 7253, 7203, 7154, 7105, 7057, 7010, 6963, 6917, 6872, 6827, 6782, 6739, 6695, 6653, 6611, 6569, 6528, 6487, 6447, 6408, 6369, 6330, 6292, 6254, 6217, 6180, 6144, 6108, 6073, 6037, 6003, 5968, 5935, 5901, 5868, 5835, 5803, 5771, 5739, 5708, 5677, 5646, 5615, 5585, 5556, 5526, 5497, 5468, 5440, 5412, 5384, 5356, 5329, 5302, 5275, 5249, 5222, 5196, 5171, 5145, 5120, 5095, 5070, 5046, 5022, 4998, 4974, 4950, 4927, 4904, 4881, 4858, 4836, 4813, 4791, 4769, 4748, 4726, 4705, 4684, 4663, 4642, 4622, 4601, 4581, 4561, 4541, 4522, 4502, 4483, 4464, 4445, 4426, 4407, 4389, 4370, 4352, 4334, 4316, 4298, 4281, 4263, 4246, 4229, 4212, 4195, 4178, 4161, 4145, 4128, 4112, 4096}; - __constant__ int c_HsvDivTable180[256] = {0, 122880, 61440, 40960, 30720, 24576, 20480, 17554, 15360, 13653, 12288, 11171, 10240, 9452, 8777, 8192, 7680, 7228, 6827, 6467, 6144, 5851, 5585, 5343, 5120, 4915, 4726, 4551, 4389, 4237, 4096, 3964, 3840, 3724, 3614, 3511, 3413, 3321, 3234, 3151, 3072, 2997, 2926, 2858, 2793, 2731, 2671, 2614, 2560, 2508, 2458, 2409, 2363, 2318, 2276, 2234, 2194, 2156, 2119, 2083, 2048, 2014, 1982, 1950, 1920, 1890, 1862, 1834, 1807, 1781, 1755, 1731, 1707, 1683, 1661, 1638, 1617, 1596, 1575, 1555, 1536, 1517, 1499, 1480, 1463, 1446, 1429, 1412, 1396, 1381, 1365, 1350, 1336, 1321, 1307, 1293, 1280, 1267, 1254, 1241, 1229, 1217, 1205, 1193, 1182, 1170, 1159, 1148, 1138, 1127, 1117, 1107, 1097, 1087, 1078, 1069, 1059, 1050, 1041, 1033, 1024, 1016, 1007, 999, 991, 983, 975, 968, 960, 953, 945, 938, 931, 924, 917, 910, 904, 897, 890, 884, 878, 871, 865, 859, 853, 847, 842, 836, 830, 825, 819, 814, 808, 803, 798, 793, 788, 783, 778, 773, 768, 763, 759, 754, 749, 745, 740, 736, 731, 727, 723, 719, 714, 710, 706, 702, 698, 694, 690, 686, 683, 679, 675, 671, 668, 664, 661, 657, 654, 650, 647, 643, 640, 637, 633, 630, 627, 624, 621, 617, 614, 611, 608, 605, 602, 599, 597, 594, 591, 588, 585, 582, 580, 577, 574, 572, 569, 566, 564, 561, 559, 556, 554, 551, 549, 546, 544, 541, 539, 537, 534, 532, 530, 527, 525, 523, 521, 518, 516, 514, 512, 510, 508, 506, 504, 502, 500, 497, 495, 493, 492, 490, 488, 486, 484, 482}; - __constant__ int c_HsvDivTable256[256] = {0, 174763, 87381, 58254, 43691, 34953, 29127, 24966, 21845, 19418, 17476, 15888, 14564, 13443, 12483, 11651, 10923, 10280, 9709, 9198, 8738, 8322, 7944, 7598, 7282, 6991, 6722, 6473, 6242, 6026, 5825, 5638, 5461, 5296, 5140, 4993, 4855, 4723, 4599, 4481, 4369, 4263, 4161, 4064, 3972, 3884, 3799, 3718, 3641, 3567, 3495, 3427, 3361, 3297, 3236, 3178, 3121, 3066, 3013, 2962, 2913, 2865, 2819, 2774, 2731, 2689, 2648, 2608, 2570, 2533, 2497, 2461, 2427, 2394, 2362, 2330, 2300, 2270, 2241, 2212, 2185, 2158, 2131, 2106, 2081, 2056, 2032, 2009, 1986, 1964, 1942, 1920, 1900, 1879, 1859, 1840, 1820, 1802, 1783, 1765, 1748, 1730, 1713, 1697, 1680, 1664, 1649, 1633, 1618, 1603, 1589, 1574, 1560, 1547, 1533, 1520, 1507, 1494, 1481, 1469, 1456, 1444, 1432, 1421, 1409, 1398, 1387, 1376, 1365, 1355, 1344, 1334, 1324, 1314, 1304, 1295, 1285, 1276, 1266, 1257, 1248, 1239, 1231, 1222, 1214, 1205, 1197, 1189, 1181, 1173, 1165, 1157, 1150, 1142, 1135, 1128, 1120, 1113, 1106, 1099, 1092, 1085, 1079, 1072, 1066, 1059, 1053, 1046, 1040, 1034, 1028, 1022, 1016, 1010, 1004, 999, 993, 987, 982, 976, 971, 966, 960, 955, 950, 945, 940, 935, 930, 925, 920, 915, 910, 906, 901, 896, 892, 887, 883, 878, 874, 869, 865, 861, 857, 853, 848, 844, 840, 836, 832, 828, 824, 820, 817, 813, 809, 805, 802, 798, 794, 791, 787, 784, 780, 777, 773, 770, 767, 763, 760, 757, 753, 750, 747, 744, 741, 737, 734, 731, 728, 725, 722, 719, 716, 713, 710, 708, 705, 702, 699, 696, 694, 691, 688, 685}; - - template static __device__ void RGB2HSVConvert(const uchar* src, D& dst) - { - const int hsv_shift = 12; - const int* hdiv_table = hr == 180 ? c_HsvDivTable180 : c_HsvDivTable256; - - int b = src[bidx], g = src[1], r = src[bidx^2]; - int h, s, v = b; - int vmin = b, diff; - int vr, vg; - - v = ::max(v, g); - v = ::max(v, r); - vmin = ::min(vmin, g); - vmin = ::min(vmin, r); - - diff = v - vmin; - vr = (v == r) * -1; - vg = (v == g) * -1; - - s = (diff * c_HsvDivTable[v] + (1 << (hsv_shift-1))) >> hsv_shift; - h = (vr & (g - b)) + (~vr & ((vg & (b - r + 2 * diff)) + ((~vg) & (r - g + 4 * diff)))); - h = (h * hdiv_table[diff] + (1 << (hsv_shift-1))) >> hsv_shift; - h += (h < 0) * hr; - - dst.x = saturate_cast(h); - dst.y = (uchar)s; - dst.z = (uchar)v; - } - - template static __device__ uint RGB2HSVConvert(uint src) - { - const int hsv_shift = 12; - const int* hdiv_table = hr == 180 ? c_HsvDivTable180 : c_HsvDivTable256; - - const int b = 0xff & (src >> (bidx * 8)); - const int g = 0xff & (src >> 8); - const int r = 0xff & (src >> ((bidx ^ 2) * 8)); - - int h, s, v = b; - int vmin = b, diff; - int vr, vg; - - v = ::max(v, g); - v = ::max(v, r); - vmin = ::min(vmin, g); - vmin = ::min(vmin, r); - - diff = v - vmin; - vr = (v == r) * -1; - vg = (v == g) * -1; - - s = (diff * c_HsvDivTable[v] + (1 << (hsv_shift-1))) >> hsv_shift; - h = (vr & (g - b)) + (~vr & ((vg & (b - r + 2 * diff)) + ((~vg) & (r - g + 4 * diff)))); - h = (h * hdiv_table[diff] + (1 << (hsv_shift-1))) >> hsv_shift; - h += (h < 0) * hr; - - uint dst = 0; - - dst |= saturate_cast(h); - dst |= (0xffu & s) << 8; - dst |= (0xffu & v) << 16; - - return dst; - } - - template static __device__ void RGB2HSVConvert(const float* src, D& dst) - { - const float hscale = hr * (1.f / 360.f); - - float b = src[bidx], g = src[1], r = src[bidx^2]; - float h, s, v; - - float vmin, diff; - - v = vmin = r; - v = fmax(v, g); - v = fmax(v, b); - vmin = fmin(vmin, g); - vmin = fmin(vmin, b); - - diff = v - vmin; - s = diff / (float)(::fabs(v) + numeric_limits::epsilon()); - diff = (float)(60. / (diff + numeric_limits::epsilon())); - - h = (v == r) * (g - b) * diff; - h += (v != r && v == g) * ((b - r) * diff + 120.f); - h += (v != r && v != g) * ((r - g) * diff + 240.f); - h += (h < 0) * 360.f; - - dst.x = h * hscale; - dst.y = s; - dst.z = v; - } - - template struct RGB2HSV - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - RGB2HSVConvert(&src.x, dst); - - return dst; - } - __host__ __device__ __forceinline__ RGB2HSV() {} - __host__ __device__ __forceinline__ RGB2HSV(const RGB2HSV&) {} - }; - - template struct RGB2HSV : unary_function - { - __device__ __forceinline__ uint operator()(uint src) const - { - return RGB2HSVConvert(src); - } - __host__ __device__ __forceinline__ RGB2HSV() {} - __host__ __device__ __forceinline__ RGB2HSV(const RGB2HSV&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_RGB2HSV_TRAITS(name, scn, dcn, bidx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2HSV functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; \ - template struct name ## _full_traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2HSV functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; \ - template <> struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2HSV functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; \ - template <> struct name ## _full_traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2HSV functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - - namespace color_detail - { - __constant__ int c_HsvSectorData[6][3] = { {1,3,0}, {1,0,2}, {3,0,1}, {0,2,1}, {0,1,3}, {2,1,0} }; - - template static __device__ void HSV2RGBConvert(const T& src, float* dst) - { - const float hscale = 6.f / hr; - - float h = src.x, s = src.y, v = src.z; - float b = v, g = v, r = v; - - if (s != 0) - { - h *= hscale; - - if( h < 0 ) - do h += 6; while( h < 0 ); - else if( h >= 6 ) - do h -= 6; while( h >= 6 ); - - int sector = __float2int_rd(h); - h -= sector; - - if ( (unsigned)sector >= 6u ) - { - sector = 0; - h = 0.f; - } - - float tab[4]; - tab[0] = v; - tab[1] = v * (1.f - s); - tab[2] = v * (1.f - s * h); - tab[3] = v * (1.f - s * (1.f - h)); - - b = tab[c_HsvSectorData[sector][0]]; - g = tab[c_HsvSectorData[sector][1]]; - r = tab[c_HsvSectorData[sector][2]]; - } - - dst[bidx] = b; - dst[1] = g; - dst[bidx^2] = r; - } - - template static __device__ void HSV2RGBConvert(const T& src, uchar* dst) - { - float3 buf; - - buf.x = src.x; - buf.y = src.y * (1.f / 255.f); - buf.z = src.z * (1.f / 255.f); - - HSV2RGBConvert(buf, &buf.x); - - dst[0] = saturate_cast(buf.x * 255.f); - dst[1] = saturate_cast(buf.y * 255.f); - dst[2] = saturate_cast(buf.z * 255.f); - } - - template static __device__ uint HSV2RGBConvert(uint src) - { - float3 buf; - - buf.x = src & 0xff; - buf.y = ((src >> 8) & 0xff) * (1.f/255.f); - buf.z = ((src >> 16) & 0xff) * (1.f/255.f); - - HSV2RGBConvert(buf, &buf.x); - - uint dst = 0xffu << 24; - - dst |= saturate_cast(buf.x * 255.f); - dst |= saturate_cast(buf.y * 255.f) << 8; - dst |= saturate_cast(buf.z * 255.f) << 16; - - return dst; - } - - template struct HSV2RGB - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - HSV2RGBConvert(src, &dst.x); - setAlpha(dst, ColorChannel::max()); - - return dst; - } - __host__ __device__ __forceinline__ HSV2RGB() {} - __host__ __device__ __forceinline__ HSV2RGB(const HSV2RGB&) {} - }; - - template struct HSV2RGB : unary_function - { - __device__ __forceinline__ uint operator()(uint src) const - { - return HSV2RGBConvert(src); - } - __host__ __device__ __forceinline__ HSV2RGB() {} - __host__ __device__ __forceinline__ HSV2RGB(const HSV2RGB&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_HSV2RGB_TRAITS(name, scn, dcn, bidx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::HSV2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; \ - template struct name ## _full_traits \ - { \ - typedef ::cv::cuda::device::color_detail::HSV2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; \ - template <> struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::HSV2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; \ - template <> struct name ## _full_traits \ - { \ - typedef ::cv::cuda::device::color_detail::HSV2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - -/////////////////////////////////////// RGB <-> HLS //////////////////////////////////////// - - namespace color_detail - { - template static __device__ void RGB2HLSConvert(const float* src, D& dst) - { - const float hscale = hr * (1.f / 360.f); - - float b = src[bidx], g = src[1], r = src[bidx^2]; - float h = 0.f, s = 0.f, l; - float vmin, vmax, diff; - - vmax = vmin = r; - vmax = fmax(vmax, g); - vmax = fmax(vmax, b); - vmin = fmin(vmin, g); - vmin = fmin(vmin, b); - - diff = vmax - vmin; - l = (vmax + vmin) * 0.5f; - - if (diff > numeric_limits::epsilon()) - { - s = (l < 0.5f) * diff / (vmax + vmin); - s += (l >= 0.5f) * diff / (2.0f - vmax - vmin); - - diff = 60.f / diff; - - h = (vmax == r) * (g - b) * diff; - h += (vmax != r && vmax == g) * ((b - r) * diff + 120.f); - h += (vmax != r && vmax != g) * ((r - g) * diff + 240.f); - h += (h < 0.f) * 360.f; - } - - dst.x = h * hscale; - dst.y = l; - dst.z = s; - } - - template static __device__ void RGB2HLSConvert(const uchar* src, D& dst) - { - float3 buf; - - buf.x = src[0] * (1.f / 255.f); - buf.y = src[1] * (1.f / 255.f); - buf.z = src[2] * (1.f / 255.f); - - RGB2HLSConvert(&buf.x, buf); - - dst.x = saturate_cast(buf.x); - dst.y = saturate_cast(buf.y*255.f); - dst.z = saturate_cast(buf.z*255.f); - } - - template static __device__ uint RGB2HLSConvert(uint src) - { - float3 buf; - - buf.x = (0xff & src) * (1.f / 255.f); - buf.y = (0xff & (src >> 8)) * (1.f / 255.f); - buf.z = (0xff & (src >> 16)) * (1.f / 255.f); - - RGB2HLSConvert(&buf.x, buf); - - uint dst = 0xffu << 24; - - dst |= saturate_cast(buf.x); - dst |= saturate_cast(buf.y * 255.f) << 8; - dst |= saturate_cast(buf.z * 255.f) << 16; - - return dst; - } - - template struct RGB2HLS - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - RGB2HLSConvert(&src.x, dst); - - return dst; - } - __host__ __device__ __forceinline__ RGB2HLS() {} - __host__ __device__ __forceinline__ RGB2HLS(const RGB2HLS&) {} - }; - - template struct RGB2HLS : unary_function - { - __device__ __forceinline__ uint operator()(uint src) const - { - return RGB2HLSConvert(src); - } - __host__ __device__ __forceinline__ RGB2HLS() {} - __host__ __device__ __forceinline__ RGB2HLS(const RGB2HLS&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_RGB2HLS_TRAITS(name, scn, dcn, bidx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2HLS functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; \ - template struct name ## _full_traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2HLS functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; \ - template <> struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2HLS functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; \ - template <> struct name ## _full_traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2HLS functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - - namespace color_detail - { - __constant__ int c_HlsSectorData[6][3] = { {1,3,0}, {1,0,2}, {3,0,1}, {0,2,1}, {0,1,3}, {2,1,0} }; - - template static __device__ void HLS2RGBConvert(const T& src, float* dst) - { - const float hscale = 6.0f / hr; - - float h = src.x, l = src.y, s = src.z; - float b = l, g = l, r = l; - - if (s != 0) - { - float p2 = (l <= 0.5f) * l * (1 + s); - p2 += (l > 0.5f) * (l + s - l * s); - float p1 = 2 * l - p2; - - h *= hscale; - - if( h < 0 ) - do h += 6; while( h < 0 ); - else if( h >= 6 ) - do h -= 6; while( h >= 6 ); - - int sector; - sector = __float2int_rd(h); - - h -= sector; - - float tab[4]; - tab[0] = p2; - tab[1] = p1; - tab[2] = p1 + (p2 - p1) * (1 - h); - tab[3] = p1 + (p2 - p1) * h; - - b = tab[c_HlsSectorData[sector][0]]; - g = tab[c_HlsSectorData[sector][1]]; - r = tab[c_HlsSectorData[sector][2]]; - } - - dst[bidx] = b; - dst[1] = g; - dst[bidx^2] = r; - } - - template static __device__ void HLS2RGBConvert(const T& src, uchar* dst) - { - float3 buf; - - buf.x = src.x; - buf.y = src.y * (1.f / 255.f); - buf.z = src.z * (1.f / 255.f); - - HLS2RGBConvert(buf, &buf.x); - - dst[0] = saturate_cast(buf.x * 255.f); - dst[1] = saturate_cast(buf.y * 255.f); - dst[2] = saturate_cast(buf.z * 255.f); - } - - template static __device__ uint HLS2RGBConvert(uint src) - { - float3 buf; - - buf.x = 0xff & src; - buf.y = (0xff & (src >> 8)) * (1.f / 255.f); - buf.z = (0xff & (src >> 16)) * (1.f / 255.f); - - HLS2RGBConvert(buf, &buf.x); - - uint dst = 0xffu << 24; - - dst |= saturate_cast(buf.x * 255.f); - dst |= saturate_cast(buf.y * 255.f) << 8; - dst |= saturate_cast(buf.z * 255.f) << 16; - - return dst; - } - - template struct HLS2RGB - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - HLS2RGBConvert(src, &dst.x); - setAlpha(dst, ColorChannel::max()); - - return dst; - } - __host__ __device__ __forceinline__ HLS2RGB() {} - __host__ __device__ __forceinline__ HLS2RGB(const HLS2RGB&) {} - }; - - template struct HLS2RGB : unary_function - { - __device__ __forceinline__ uint operator()(uint src) const - { - return HLS2RGBConvert(src); - } - __host__ __device__ __forceinline__ HLS2RGB() {} - __host__ __device__ __forceinline__ HLS2RGB(const HLS2RGB&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_HLS2RGB_TRAITS(name, scn, dcn, bidx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::HLS2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; \ - template struct name ## _full_traits \ - { \ - typedef ::cv::cuda::device::color_detail::HLS2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; \ - template <> struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::HLS2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; \ - template <> struct name ## _full_traits \ - { \ - typedef ::cv::cuda::device::color_detail::HLS2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - -///////////////////////////////////// RGB <-> Lab ///////////////////////////////////// - - namespace color_detail - { - enum - { - LAB_CBRT_TAB_SIZE = 1024, - GAMMA_TAB_SIZE = 1024, - lab_shift = xyz_shift, - gamma_shift = 3, - lab_shift2 = (lab_shift + gamma_shift), - LAB_CBRT_TAB_SIZE_B = (256 * 3 / 2 * (1 << gamma_shift)) - }; - - __constant__ ushort c_sRGBGammaTab_b[] = {0,1,1,2,2,3,4,4,5,6,6,7,8,8,9,10,11,11,12,13,14,15,16,17,19,20,21,22,24,25,26,28,29,31,33,34,36,38,40,41,43,45,47,49,51,54,56,58,60,63,65,68,70,73,75,78,81,83,86,89,92,95,98,101,105,108,111,115,118,121,125,129,132,136,140,144,147,151,155,160,164,168,172,176,181,185,190,194,199,204,209,213,218,223,228,233,239,244,249,255,260,265,271,277,282,288,294,300,306,312,318,324,331,337,343,350,356,363,370,376,383,390,397,404,411,418,426,433,440,448,455,463,471,478,486,494,502,510,518,527,535,543,552,560,569,578,586,595,604,613,622,631,641,650,659,669,678,688,698,707,717,727,737,747,757,768,778,788,799,809,820,831,842,852,863,875,886,897,908,920,931,943,954,966,978,990,1002,1014,1026,1038,1050,1063,1075,1088,1101,1113,1126,1139,1152,1165,1178,1192,1205,1218,1232,1245,1259,1273,1287,1301,1315,1329,1343,1357,1372,1386,1401,1415,1430,1445,1460,1475,1490,1505,1521,1536,1551,1567,1583,1598,1614,1630,1646,1662,1678,1695,1711,1728,1744,1761,1778,1794,1811,1828,1846,1863,1880,1897,1915,1933,1950,1968,1986,2004,2022,2040}; - - __device__ __forceinline__ int LabCbrt_b(int i) - { - float x = i * (1.f / (255.f * (1 << gamma_shift))); - return (1 << lab_shift2) * (x < 0.008856f ? x * 7.787f + 0.13793103448275862f : ::cbrtf(x)); - } - - template - __device__ __forceinline__ void RGB2LabConvert_b(const T& src, D& dst) - { - const int Lscale = (116 * 255 + 50) / 100; - const int Lshift = -((16 * 255 * (1 << lab_shift2) + 50) / 100); - - int B = blueIdx == 0 ? src.x : src.z; - int G = src.y; - int R = blueIdx == 0 ? src.z : src.x; - - if (srgb) - { - B = c_sRGBGammaTab_b[B]; - G = c_sRGBGammaTab_b[G]; - R = c_sRGBGammaTab_b[R]; - } - else - { - B <<= 3; - G <<= 3; - R <<= 3; - } - - int fX = LabCbrt_b(CV_DESCALE(B * 778 + G * 1541 + R * 1777, lab_shift)); - int fY = LabCbrt_b(CV_DESCALE(B * 296 + G * 2929 + R * 871, lab_shift)); - int fZ = LabCbrt_b(CV_DESCALE(B * 3575 + G * 448 + R * 73, lab_shift)); - - int L = CV_DESCALE(Lscale * fY + Lshift, lab_shift2); - int a = CV_DESCALE(500 * (fX - fY) + 128 * (1 << lab_shift2), lab_shift2); - int b = CV_DESCALE(200 * (fY - fZ) + 128 * (1 << lab_shift2), lab_shift2); - - dst.x = saturate_cast(L); - dst.y = saturate_cast(a); - dst.z = saturate_cast(b); - } - - __device__ __forceinline__ float splineInterpolate(float x, const float* tab, int n) - { - int ix = ::min(::max(int(x), 0), n-1); - x -= ix; - tab += ix * 4; - return ((tab[3] * x + tab[2]) * x + tab[1]) * x + tab[0]; - } - - __constant__ float c_sRGBGammaTab[] = {0,7.55853e-05,0.,-7.51331e-13,7.55853e-05,7.55853e-05,-2.25399e-12,3.75665e-12,0.000151171,7.55853e-05,9.01597e-12,-6.99932e-12,0.000226756,7.55853e-05,-1.1982e-11,2.41277e-12,0.000302341,7.55853e-05,-4.74369e-12,1.19001e-11,0.000377927,7.55853e-05,3.09568e-11,-2.09095e-11,0.000453512,7.55853e-05,-3.17718e-11,1.35303e-11,0.000529097,7.55853e-05,8.81905e-12,-4.10782e-12,0.000604683,7.55853e-05,-3.50439e-12,2.90097e-12,0.000680268,7.55853e-05,5.19852e-12,-7.49607e-12,0.000755853,7.55853e-05,-1.72897e-11,2.70833e-11,0.000831439,7.55854e-05,6.39602e-11,-4.26295e-11,0.000907024,7.55854e-05,-6.39282e-11,2.70193e-11,0.000982609,7.55853e-05,1.71298e-11,-7.24017e-12,0.00105819,7.55853e-05,-4.59077e-12,1.94137e-12,0.00113378,7.55853e-05,1.23333e-12,-5.25291e-13,0.00120937,7.55853e-05,-3.42545e-13,1.59799e-13,0.00128495,7.55853e-05,1.36852e-13,-1.13904e-13,0.00136054,7.55853e-05,-2.04861e-13,2.95818e-13,0.00143612,7.55853e-05,6.82594e-13,-1.06937e-12,0.00151171,7.55853e-05,-2.52551e-12,3.98166e-12,0.00158729,7.55853e-05,9.41946e-12,-1.48573e-11,0.00166288,7.55853e-05,-3.51523e-11,5.54474e-11,0.00173846,7.55854e-05,1.3119e-10,-9.0517e-11,0.00181405,7.55854e-05,-1.40361e-10,7.37899e-11,0.00188963,7.55853e-05,8.10085e-11,-8.82272e-11,0.00196522,7.55852e-05,-1.83673e-10,1.62704e-10,0.0020408,7.55853e-05,3.04438e-10,-2.13341e-10,0.00211639,7.55853e-05,-3.35586e-10,2.25e-10,0.00219197,7.55853e-05,3.39414e-10,-2.20997e-10,0.00226756,7.55853e-05,-3.23576e-10,1.93326e-10,0.00234315,7.55853e-05,2.564e-10,-8.66446e-11,0.00241873,7.55855e-05,-3.53328e-12,-7.9578e-11,0.00249432,7.55853e-05,-2.42267e-10,1.72126e-10,0.0025699,7.55853e-05,2.74111e-10,-1.43265e-10,0.00264549,7.55854e-05,-1.55683e-10,-6.47292e-11,0.00272107,7.55849e-05,-3.4987e-10,8.67842e-10,0.00279666,7.55868e-05,2.25366e-09,-3.8723e-09,0.00287224,7.55797e-05,-9.36325e-09,1.5087e-08,0.00294783,7.56063e-05,3.58978e-08,-5.69415e-08,0.00302341,7.55072e-05,-1.34927e-07,2.13144e-07,0.003099,7.58768e-05,5.04507e-07,1.38713e-07,0.00317552,7.7302e-05,9.20646e-07,-1.55186e-07,0.00325359,7.86777e-05,4.55087e-07,4.26813e-08,0.00333276,7.97159e-05,5.83131e-07,-1.06495e-08,0.00341305,8.08502e-05,5.51182e-07,3.87467e-09,0.00349446,8.19642e-05,5.62806e-07,-1.92586e-10,0.00357698,8.30892e-05,5.62228e-07,1.0866e-09,0.00366063,8.4217e-05,5.65488e-07,5.02818e-10,0.00374542,8.53494e-05,5.66997e-07,8.60211e-10,0.00383133,8.6486e-05,5.69577e-07,7.13044e-10,0.00391839,8.76273e-05,5.71716e-07,4.78527e-10,0.00400659,8.87722e-05,5.73152e-07,1.09818e-09,0.00409594,8.99218e-05,5.76447e-07,2.50964e-10,0.00418644,9.10754e-05,5.772e-07,1.15762e-09,0.00427809,9.22333e-05,5.80672e-07,2.40865e-10,0.0043709,9.33954e-05,5.81395e-07,1.13854e-09,0.00446488,9.45616e-05,5.84811e-07,3.27267e-10,0.00456003,9.57322e-05,5.85792e-07,8.1197e-10,0.00465635,9.69062e-05,5.88228e-07,6.15823e-10,0.00475384,9.80845e-05,5.90076e-07,9.15747e-10,0.00485252,9.92674e-05,5.92823e-07,3.778e-10,0.00495238,0.000100454,5.93956e-07,8.32623e-10,0.00505343,0.000101645,5.96454e-07,4.82695e-10,0.00515567,0.000102839,5.97902e-07,9.61904e-10,0.00525911,0.000104038,6.00788e-07,3.26281e-10,0.00536375,0.00010524,6.01767e-07,9.926e-10,0.00546959,0.000106447,6.04745e-07,3.59933e-10,0.00557664,0.000107657,6.05824e-07,8.2728e-10,0.0056849,0.000108871,6.08306e-07,5.21898e-10,0.00579438,0.00011009,6.09872e-07,8.10492e-10,0.00590508,0.000111312,6.12303e-07,4.27046e-10,0.00601701,0.000112538,6.13585e-07,7.40878e-10,0.00613016,0.000113767,6.15807e-07,8.00469e-10,0.00624454,0.000115001,6.18209e-07,2.48178e-10,0.00636016,0.000116238,6.18953e-07,1.00073e-09,0.00647702,0.000117479,6.21955e-07,4.05654e-10,0.00659512,0.000118724,6.23172e-07,6.36192e-10,0.00671447,0.000119973,6.25081e-07,7.74927e-10,0.00683507,0.000121225,6.27406e-07,4.54975e-10,0.00695692,0.000122481,6.28771e-07,6.64841e-10,0.00708003,0.000123741,6.30765e-07,6.10972e-10,0.00720441,0.000125004,6.32598e-07,6.16543e-10,0.00733004,0.000126271,6.34448e-07,6.48204e-10,0.00745695,0.000127542,6.36392e-07,5.15835e-10,0.00758513,0.000128816,6.3794e-07,5.48103e-10,0.00771458,0.000130094,6.39584e-07,1.01706e-09,0.00784532,0.000131376,6.42635e-07,4.0283e-11,0.00797734,0.000132661,6.42756e-07,6.84471e-10,0.00811064,0.000133949,6.4481e-07,9.47144e-10,0.00824524,0.000135241,6.47651e-07,1.83472e-10,0.00838112,0.000136537,6.48201e-07,1.11296e-09,0.00851831,0.000137837,6.5154e-07,2.13163e-11,0.0086568,0.00013914,6.51604e-07,6.64462e-10,0.00879659,0.000140445,6.53598e-07,1.04613e-09,0.00893769,0.000141756,6.56736e-07,-1.92377e-10,0.0090801,0.000143069,6.56159e-07,1.58601e-09,0.00922383,0.000144386,6.60917e-07,-5.63754e-10,0.00936888,0.000145706,6.59226e-07,1.60033e-09,0.00951524,0.000147029,6.64027e-07,-2.49543e-10,0.00966294,0.000148356,6.63278e-07,1.26043e-09,0.00981196,0.000149687,6.67059e-07,-1.35572e-10,0.00996231,0.00015102,6.66653e-07,1.14458e-09,0.010114,0.000152357,6.70086e-07,2.13864e-10,0.010267,0.000153698,6.70728e-07,7.93856e-10,0.0104214,0.000155042,6.73109e-07,3.36077e-10,0.0105771,0.000156389,6.74118e-07,6.55765e-10,0.0107342,0.000157739,6.76085e-07,7.66211e-10,0.0108926,0.000159094,6.78384e-07,4.66116e-12,0.0110524,0.000160451,6.78398e-07,1.07775e-09,0.0112135,0.000161811,6.81631e-07,3.41023e-10,0.011376,0.000163175,6.82654e-07,3.5205e-10,0.0115398,0.000164541,6.8371e-07,1.04473e-09,0.0117051,0.000165912,6.86844e-07,1.25757e-10,0.0118717,0.000167286,6.87222e-07,3.14818e-10,0.0120396,0.000168661,6.88166e-07,1.40886e-09,0.012209,0.000170042,6.92393e-07,-3.62244e-10,0.0123797,0.000171425,6.91306e-07,9.71397e-10,0.0125518,0.000172811,6.9422e-07,2.02003e-10,0.0127253,0.0001742,6.94826e-07,1.01448e-09,0.0129002,0.000175593,6.97869e-07,3.96653e-10,0.0130765,0.00017699,6.99059e-07,1.92927e-10,0.0132542,0.000178388,6.99638e-07,6.94305e-10,0.0134333,0.00017979,7.01721e-07,7.55108e-10,0.0136138,0.000181195,7.03986e-07,1.05918e-11,0.0137957,0.000182603,7.04018e-07,1.06513e-09,0.013979,0.000184015,7.07214e-07,3.85512e-10,0.0141637,0.00018543,7.0837e-07,1.86769e-10,0.0143499,0.000186848,7.0893e-07,7.30116e-10,0.0145374,0.000188268,7.11121e-07,6.17983e-10,0.0147264,0.000189692,7.12975e-07,5.23282e-10,0.0149168,0.000191119,7.14545e-07,8.28398e-11,0.0151087,0.000192549,7.14793e-07,1.0081e-09,0.0153019,0.000193981,7.17817e-07,5.41244e-10,0.0154966,0.000195418,7.19441e-07,-3.7907e-10,0.0156928,0.000196856,7.18304e-07,1.90641e-09,0.0158903,0.000198298,7.24023e-07,-7.27387e-10,0.0160893,0.000199744,7.21841e-07,1.00317e-09,0.0162898,0.000201191,7.24851e-07,4.39949e-10,0.0164917,0.000202642,7.2617e-07,9.6234e-10,0.0166951,0.000204097,7.29057e-07,-5.64019e-10,0.0168999,0.000205554,7.27365e-07,1.29374e-09,0.0171062,0.000207012,7.31247e-07,9.77025e-10,0.017314,0.000208478,7.34178e-07,-1.47651e-09,0.0175232,0.000209942,7.29748e-07,3.06636e-09,0.0177338,0.00021141,7.38947e-07,-1.47573e-09,0.017946,0.000212884,7.3452e-07,9.7386e-10,0.0181596,0.000214356,7.37442e-07,1.30562e-09,0.0183747,0.000215835,7.41358e-07,-6.08376e-10,0.0185913,0.000217315,7.39533e-07,1.12785e-09,0.0188093,0.000218798,7.42917e-07,-1.77711e-10,0.0190289,0.000220283,7.42384e-07,1.44562e-09,0.0192499,0.000221772,7.46721e-07,-1.68825e-11,0.0194724,0.000223266,7.4667e-07,4.84533e-10,0.0196964,0.000224761,7.48124e-07,-5.85298e-11,0.0199219,0.000226257,7.47948e-07,1.61217e-09,0.0201489,0.000227757,7.52785e-07,-8.02136e-10,0.0203775,0.00022926,7.50378e-07,1.59637e-09,0.0206075,0.000230766,7.55167e-07,4.47168e-12,0.020839,0.000232276,7.55181e-07,2.48387e-10,0.021072,0.000233787,7.55926e-07,8.6474e-10,0.0213066,0.000235302,7.5852e-07,1.78299e-11,0.0215426,0.000236819,7.58573e-07,9.26567e-10,0.0217802,0.000238339,7.61353e-07,1.34529e-12,0.0220193,0.000239862,7.61357e-07,9.30659e-10,0.0222599,0.000241387,7.64149e-07,1.34529e-12,0.0225021,0.000242915,7.64153e-07,9.26567e-10,0.0227458,0.000244447,7.66933e-07,1.76215e-11,0.022991,0.00024598,7.66986e-07,8.65536e-10,0.0232377,0.000247517,7.69582e-07,2.45677e-10,0.023486,0.000249057,7.70319e-07,1.44193e-11,0.0237358,0.000250598,7.70363e-07,1.55918e-09,0.0239872,0.000252143,7.7504e-07,-6.63173e-10,0.0242401,0.000253691,7.73051e-07,1.09357e-09,0.0244946,0.000255241,7.76331e-07,1.41919e-11,0.0247506,0.000256793,7.76374e-07,7.12248e-10,0.0250082,0.000258348,7.78511e-07,8.62049e-10,0.0252673,0.000259908,7.81097e-07,-4.35061e-10,0.025528,0.000261469,7.79792e-07,8.7825e-10,0.0257902,0.000263031,7.82426e-07,6.47181e-10,0.0260541,0.000264598,7.84368e-07,2.58448e-10,0.0263194,0.000266167,7.85143e-07,1.81558e-10,0.0265864,0.000267738,7.85688e-07,8.78041e-10,0.0268549,0.000269312,7.88322e-07,3.15102e-11,0.027125,0.000270889,7.88417e-07,8.58525e-10,0.0273967,0.000272468,7.90992e-07,2.59812e-10,0.02767,0.000274051,7.91772e-07,-3.5224e-11,0.0279448,0.000275634,7.91666e-07,1.74377e-09,0.0282212,0.000277223,7.96897e-07,-1.35196e-09,0.0284992,0.000278813,7.92841e-07,1.80141e-09,0.0287788,0.000280404,7.98246e-07,-2.65629e-10,0.0290601,0.000281999,7.97449e-07,1.12374e-09,0.0293428,0.000283598,8.0082e-07,-5.04106e-10,0.0296272,0.000285198,7.99308e-07,8.92764e-10,0.0299132,0.000286799,8.01986e-07,6.58379e-10,0.0302008,0.000288405,8.03961e-07,1.98971e-10,0.0304901,0.000290014,8.04558e-07,4.08382e-10,0.0307809,0.000291624,8.05783e-07,3.01839e-11,0.0310733,0.000293236,8.05874e-07,1.33343e-09,0.0313673,0.000294851,8.09874e-07,2.2419e-10,0.031663,0.000296472,8.10547e-07,-3.67606e-10,0.0319603,0.000298092,8.09444e-07,1.24624e-09,0.0322592,0.000299714,8.13182e-07,-8.92025e-10,0.0325597,0.000301338,8.10506e-07,2.32183e-09,0.0328619,0.000302966,8.17472e-07,-9.44719e-10,0.0331657,0.000304598,8.14638e-07,1.45703e-09,0.0334711,0.000306232,8.19009e-07,-1.15805e-09,0.0337781,0.000307866,8.15535e-07,3.17507e-09,0.0340868,0.000309507,8.2506e-07,-4.09161e-09,0.0343971,0.000311145,8.12785e-07,5.74079e-09,0.0347091,0.000312788,8.30007e-07,-3.97034e-09,0.0350227,0.000314436,8.18096e-07,2.68985e-09,0.035338,0.00031608,8.26166e-07,6.61676e-10,0.0356549,0.000317734,8.28151e-07,-1.61123e-09,0.0359734,0.000319386,8.23317e-07,2.05786e-09,0.0362936,0.000321038,8.29491e-07,8.30388e-10,0.0366155,0.0003227,8.31982e-07,-1.65424e-09,0.036939,0.000324359,8.27019e-07,2.06129e-09,0.0372642,0.000326019,8.33203e-07,8.59719e-10,0.0375911,0.000327688,8.35782e-07,-1.77488e-09,0.0379196,0.000329354,8.30458e-07,2.51464e-09,0.0382498,0.000331023,8.38002e-07,-8.33135e-10,0.0385817,0.000332696,8.35502e-07,8.17825e-10,0.0389152,0.00033437,8.37956e-07,1.28718e-09,0.0392504,0.00033605,8.41817e-07,-2.2413e-09,0.0395873,0.000337727,8.35093e-07,3.95265e-09,0.0399258,0.000339409,8.46951e-07,-2.39332e-09,0.0402661,0.000341095,8.39771e-07,1.89533e-09,0.040608,0.000342781,8.45457e-07,-1.46271e-09,0.0409517,0.000344467,8.41069e-07,3.95554e-09,0.041297,0.000346161,8.52936e-07,-3.18369e-09,0.041644,0.000347857,8.43385e-07,1.32873e-09,0.0419927,0.000349548,8.47371e-07,1.59402e-09,0.0423431,0.000351248,8.52153e-07,-2.54336e-10,0.0426952,0.000352951,8.5139e-07,-5.76676e-10,0.043049,0.000354652,8.4966e-07,2.56114e-09,0.0434045,0.000356359,8.57343e-07,-2.21744e-09,0.0437617,0.000358067,8.50691e-07,2.58344e-09,0.0441206,0.000359776,8.58441e-07,-6.65826e-10,0.0444813,0.000361491,8.56444e-07,7.99218e-11,0.0448436,0.000363204,8.56684e-07,3.46063e-10,0.0452077,0.000364919,8.57722e-07,2.26116e-09,0.0455734,0.000366641,8.64505e-07,-1.94005e-09,0.045941,0.000368364,8.58685e-07,1.77384e-09,0.0463102,0.000370087,8.64007e-07,-1.43005e-09,0.0466811,0.000371811,8.59717e-07,3.94634e-09,0.0470538,0.000373542,8.71556e-07,-3.17946e-09,0.0474282,0.000375276,8.62017e-07,1.32104e-09,0.0478043,0.000377003,8.6598e-07,1.62045e-09,0.0481822,0.00037874,8.70842e-07,-3.52297e-10,0.0485618,0.000380481,8.69785e-07,-2.11211e-10,0.0489432,0.00038222,8.69151e-07,1.19716e-09,0.0493263,0.000383962,8.72743e-07,-8.52026e-10,0.0497111,0.000385705,8.70187e-07,2.21092e-09,0.0500977,0.000387452,8.76819e-07,-5.41339e-10,0.050486,0.000389204,8.75195e-07,-4.5361e-11,0.0508761,0.000390954,8.75059e-07,7.22669e-10,0.0512679,0.000392706,8.77227e-07,8.79936e-10,0.0516615,0.000394463,8.79867e-07,-5.17048e-10,0.0520568,0.000396222,8.78316e-07,1.18833e-09,0.0524539,0.000397982,8.81881e-07,-5.11022e-10,0.0528528,0.000399744,8.80348e-07,8.55683e-10,0.0532534,0.000401507,8.82915e-07,8.13562e-10,0.0536558,0.000403276,8.85356e-07,-3.84603e-10,0.05406,0.000405045,8.84202e-07,7.24962e-10,0.0544659,0.000406816,8.86377e-07,1.20986e-09,0.0548736,0.000408592,8.90006e-07,-1.83896e-09,0.0552831,0.000410367,8.84489e-07,2.42071e-09,0.0556944,0.000412143,8.91751e-07,-3.93413e-10,0.0561074,0.000413925,8.90571e-07,-8.46967e-10,0.0565222,0.000415704,8.8803e-07,3.78122e-09,0.0569388,0.000417491,8.99374e-07,-3.1021e-09,0.0573572,0.000419281,8.90068e-07,1.17658e-09,0.0577774,0.000421064,8.93597e-07,2.12117e-09,0.0581993,0.000422858,8.99961e-07,-2.21068e-09,0.0586231,0.000424651,8.93329e-07,2.9961e-09,0.0590486,0.000426447,9.02317e-07,-2.32311e-09,0.059476,0.000428244,8.95348e-07,2.57122e-09,0.0599051,0.000430043,9.03062e-07,-5.11098e-10,0.0603361,0.000431847,9.01528e-07,-5.27166e-10,0.0607688,0.000433649,8.99947e-07,2.61984e-09,0.0612034,0.000435457,9.07806e-07,-2.50141e-09,0.0616397,0.000437265,9.00302e-07,3.66045e-09,0.0620779,0.000439076,9.11283e-07,-4.68977e-09,0.0625179,0.000440885,8.97214e-07,7.64783e-09,0.0629597,0.000442702,9.20158e-07,-7.27499e-09,0.0634033,0.000444521,8.98333e-07,6.55113e-09,0.0638487,0.000446337,9.17986e-07,-4.02844e-09,0.0642959,0.000448161,9.05901e-07,2.11196e-09,0.064745,0.000449979,9.12236e-07,3.03125e-09,0.0651959,0.000451813,9.2133e-07,-6.78648e-09,0.0656486,0.000453635,9.00971e-07,9.21375e-09,0.0661032,0.000455464,9.28612e-07,-7.71684e-09,0.0665596,0.000457299,9.05462e-07,6.7522e-09,0.0670178,0.00045913,9.25718e-07,-4.3907e-09,0.0674778,0.000460968,9.12546e-07,3.36e-09,0.0679397,0.000462803,9.22626e-07,-1.59876e-09,0.0684034,0.000464644,9.1783e-07,3.0351e-09,0.068869,0.000466488,9.26935e-07,-3.09101e-09,0.0693364,0.000468333,9.17662e-07,1.8785e-09,0.0698057,0.000470174,9.23298e-07,3.02733e-09,0.0702768,0.00047203,9.3238e-07,-6.53722e-09,0.0707497,0.000473875,9.12768e-07,8.22054e-09,0.0712245,0.000475725,9.37429e-07,-3.99325e-09,0.0717012,0.000477588,9.2545e-07,3.01839e-10,0.0721797,0.00047944,9.26355e-07,2.78597e-09,0.0726601,0.000481301,9.34713e-07,-3.99507e-09,0.0731423,0.000483158,9.22728e-07,5.7435e-09,0.0736264,0.000485021,9.39958e-07,-4.07776e-09,0.0741123,0.000486888,9.27725e-07,3.11695e-09,0.0746002,0.000488753,9.37076e-07,-9.39394e-10,0.0750898,0.000490625,9.34258e-07,6.4055e-10,0.0755814,0.000492495,9.3618e-07,-1.62265e-09,0.0760748,0.000494363,9.31312e-07,5.84995e-09,0.0765701,0.000496243,9.48861e-07,-6.87601e-09,0.0770673,0.00049812,9.28233e-07,6.75296e-09,0.0775664,0.000499997,9.48492e-07,-5.23467e-09,0.0780673,0.000501878,9.32788e-07,6.73523e-09,0.0785701,0.000503764,9.52994e-07,-6.80514e-09,0.0790748,0.000505649,9.32578e-07,5.5842e-09,0.0795814,0.000507531,9.49331e-07,-6.30583e-10,0.0800899,0.000509428,9.47439e-07,-3.0618e-09,0.0806003,0.000511314,9.38254e-07,5.4273e-09,0.0811125,0.000513206,9.54536e-07,-3.74627e-09,0.0816267,0.000515104,9.43297e-07,2.10713e-09,0.0821427,0.000516997,9.49618e-07,2.76839e-09,0.0826607,0.000518905,9.57924e-07,-5.73006e-09,0.0831805,0.000520803,9.40733e-07,5.25072e-09,0.0837023,0.0005227,9.56486e-07,-3.71718e-10,0.084226,0.000524612,9.5537e-07,-3.76404e-09,0.0847515,0.000526512,9.44078e-07,7.97735e-09,0.085279,0.000528424,9.6801e-07,-5.79367e-09,0.0858084,0.000530343,9.50629e-07,2.96268e-10,0.0863397,0.000532245,9.51518e-07,4.6086e-09,0.0868729,0.000534162,9.65344e-07,-3.82947e-09,0.087408,0.000536081,9.53856e-07,3.25861e-09,0.087945,0.000537998,9.63631e-07,-1.7543e-09,0.088484,0.00053992,9.58368e-07,3.75849e-09,0.0890249,0.000541848,9.69644e-07,-5.82891e-09,0.0895677,0.00054377,9.52157e-07,4.65593e-09,0.0901124,0.000545688,9.66125e-07,2.10643e-09,0.0906591,0.000547627,9.72444e-07,-5.63099e-09,0.0912077,0.000549555,9.55551e-07,5.51627e-09,0.0917582,0.000551483,9.721e-07,-1.53292e-09,0.0923106,0.000553422,9.67501e-07,6.15311e-10,0.092865,0.000555359,9.69347e-07,-9.28291e-10,0.0934213,0.000557295,9.66562e-07,3.09774e-09,0.0939796,0.000559237,9.75856e-07,-4.01186e-09,0.0945398,0.000561177,9.6382e-07,5.49892e-09,0.095102,0.000563121,9.80317e-07,-3.08258e-09,0.0956661,0.000565073,9.71069e-07,-6.19176e-10,0.0962321,0.000567013,9.69212e-07,5.55932e-09,0.0968001,0.000568968,9.8589e-07,-6.71704e-09,0.09737,0.00057092,9.65738e-07,6.40762e-09,0.0979419,0.00057287,9.84961e-07,-4.0122e-09,0.0985158,0.000574828,9.72925e-07,2.19059e-09,0.0990916,0.000576781,9.79496e-07,2.70048e-09,0.0996693,0.000578748,9.87598e-07,-5.54193e-09,0.100249,0.000580706,9.70972e-07,4.56597e-09,0.100831,0.000582662,9.8467e-07,2.17923e-09,0.101414,0.000584638,9.91208e-07,-5.83232e-09,0.102,0.000586603,9.73711e-07,6.24884e-09,0.102588,0.000588569,9.92457e-07,-4.26178e-09,0.103177,0.000590541,9.79672e-07,3.34781e-09,0.103769,0.00059251,9.89715e-07,-1.67904e-09,0.104362,0.000594485,9.84678e-07,3.36839e-09,0.104958,0.000596464,9.94783e-07,-4.34397e-09,0.105555,0.000598441,9.81751e-07,6.55696e-09,0.106155,0.000600424,1.00142e-06,-6.98272e-09,0.106756,0.000602406,9.80474e-07,6.4728e-09,0.107359,0.000604386,9.99893e-07,-4.00742e-09,0.107965,0.000606374,9.8787e-07,2.10654e-09,0.108572,0.000608356,9.9419e-07,3.0318e-09,0.109181,0.000610353,1.00329e-06,-6.7832e-09,0.109793,0.00061234,9.82936e-07,9.1998e-09,0.110406,0.000614333,1.01054e-06,-7.6642e-09,0.111021,0.000616331,9.87543e-07,6.55579e-09,0.111639,0.000618326,1.00721e-06,-3.65791e-09,0.112258,0.000620329,9.96236e-07,6.25467e-10,0.112879,0.000622324,9.98113e-07,1.15593e-09,0.113503,0.000624323,1.00158e-06,2.20158e-09,0.114128,0.000626333,1.00819e-06,-2.51191e-09,0.114755,0.000628342,1.00065e-06,3.95517e-10,0.115385,0.000630345,1.00184e-06,9.29807e-10,0.116016,0.000632351,1.00463e-06,3.33599e-09,0.116649,0.00063437,1.01463e-06,-6.82329e-09,0.117285,0.000636379,9.94163e-07,9.05595e-09,0.117922,0.000638395,1.02133e-06,-7.04862e-09,0.118562,0.000640416,1.00019e-06,4.23737e-09,0.119203,0.000642429,1.0129e-06,-2.45033e-09,0.119847,0.000644448,1.00555e-06,5.56395e-09,0.120492,0.000646475,1.02224e-06,-4.9043e-09,0.121139,0.000648505,1.00753e-06,-8.47952e-10,0.121789,0.000650518,1.00498e-06,8.29622e-09,0.122441,0.000652553,1.02987e-06,-9.98538e-09,0.123094,0.000654582,9.99914e-07,9.2936e-09,0.12375,0.00065661,1.02779e-06,-4.83707e-09,0.124407,0.000658651,1.01328e-06,2.60411e-09,0.125067,0.000660685,1.0211e-06,-5.57945e-09,0.125729,0.000662711,1.00436e-06,1.22631e-08,0.126392,0.000664756,1.04115e-06,-1.36704e-08,0.127058,0.000666798,1.00014e-06,1.26161e-08,0.127726,0.000668836,1.03798e-06,-6.99155e-09,0.128396,0.000670891,1.01701e-06,4.48836e-10,0.129068,0.000672926,1.01836e-06,5.19606e-09,0.129742,0.000674978,1.03394e-06,-6.3319e-09,0.130418,0.000677027,1.01495e-06,5.2305e-09,0.131096,0.000679073,1.03064e-06,3.11123e-10,0.131776,0.000681135,1.03157e-06,-6.47511e-09,0.132458,0.000683179,1.01215e-06,1.06882e-08,0.133142,0.000685235,1.04421e-06,-6.47519e-09,0.133829,0.000687304,1.02479e-06,3.11237e-10,0.134517,0.000689355,1.02572e-06,5.23035e-09,0.135207,0.000691422,1.04141e-06,-6.3316e-09,0.1359,0.000693486,1.02242e-06,5.19484e-09,0.136594,0.000695546,1.038e-06,4.53497e-10,0.137291,0.000697623,1.03936e-06,-7.00891e-09,0.137989,0.000699681,1.01834e-06,1.2681e-08,0.13869,0.000701756,1.05638e-06,-1.39128e-08,0.139393,0.000703827,1.01464e-06,1.31679e-08,0.140098,0.000705896,1.05414e-06,-8.95659e-09,0.140805,0.000707977,1.02727e-06,7.75742e-09,0.141514,0.000710055,1.05055e-06,-7.17182e-09,0.142225,0.000712135,1.02903e-06,6.02862e-09,0.142938,0.000714211,1.04712e-06,-2.04163e-09,0.143653,0.000716299,1.04099e-06,2.13792e-09,0.144371,0.000718387,1.04741e-06,-6.51009e-09,0.14509,0.000720462,1.02787e-06,9.00123e-09,0.145812,0.000722545,1.05488e-06,3.07523e-10,0.146535,0.000724656,1.0558e-06,-1.02312e-08,0.147261,0.000726737,1.02511e-06,1.0815e-08,0.147989,0.000728819,1.05755e-06,-3.22681e-09,0.148719,0.000730925,1.04787e-06,2.09244e-09,0.14945,0.000733027,1.05415e-06,-5.143e-09,0.150185,0.00073512,1.03872e-06,3.57844e-09,0.150921,0.000737208,1.04946e-06,5.73027e-09,0.151659,0.000739324,1.06665e-06,-1.15983e-08,0.152399,0.000741423,1.03185e-06,1.08605e-08,0.153142,0.000743519,1.06443e-06,-2.04106e-09,0.153886,0.000745642,1.05831e-06,-2.69642e-09,0.154633,0.00074775,1.05022e-06,-2.07425e-09,0.155382,0.000749844,1.044e-06,1.09934e-08,0.156133,0.000751965,1.07698e-06,-1.20972e-08,0.156886,0.000754083,1.04069e-06,7.59288e-09,0.157641,0.000756187,1.06347e-06,-3.37305e-09,0.158398,0.000758304,1.05335e-06,5.89921e-09,0.159158,0.000760428,1.07104e-06,-5.32248e-09,0.159919,0.000762554,1.05508e-06,4.8927e-10,0.160683,0.000764666,1.05654e-06,3.36547e-09,0.161448,0.000766789,1.06664e-06,9.50081e-10,0.162216,0.000768925,1.06949e-06,-7.16568e-09,0.162986,0.000771043,1.04799e-06,1.28114e-08,0.163758,0.000773177,1.08643e-06,-1.42774e-08,0.164533,0.000775307,1.0436e-06,1.44956e-08,0.165309,0.000777438,1.08708e-06,-1.39025e-08,0.166087,0.00077957,1.04538e-06,1.13118e-08,0.166868,0.000781695,1.07931e-06,-1.54224e-09,0.167651,0.000783849,1.07468e-06,-5.14312e-09,0.168436,0.000785983,1.05925e-06,7.21381e-09,0.169223,0.000788123,1.0809e-06,-8.81096e-09,0.170012,0.000790259,1.05446e-06,1.31289e-08,0.170803,0.000792407,1.09385e-06,-1.39022e-08,0.171597,0.000794553,1.05214e-06,1.26775e-08,0.172392,0.000796695,1.09018e-06,-7.00557e-09,0.17319,0.000798855,1.06916e-06,4.43796e-10,0.17399,0.000800994,1.07049e-06,5.23031e-09,0.174792,0.000803151,1.08618e-06,-6.46397e-09,0.175596,0.000805304,1.06679e-06,5.72444e-09,0.176403,0.000807455,1.08396e-06,-1.53254e-09,0.177211,0.000809618,1.07937e-06,4.05673e-10,0.178022,0.000811778,1.08058e-06,-9.01916e-11,0.178835,0.000813939,1.08031e-06,-4.49821e-11,0.17965,0.000816099,1.08018e-06,2.70234e-10,0.180467,0.00081826,1.08099e-06,-1.03603e-09,0.181286,0.000820419,1.07788e-06,3.87392e-09,0.182108,0.000822587,1.0895e-06,4.41522e-10,0.182932,0.000824767,1.09083e-06,-5.63997e-09,0.183758,0.000826932,1.07391e-06,7.21707e-09,0.184586,0.000829101,1.09556e-06,-8.32718e-09,0.185416,0.000831267,1.07058e-06,1.11907e-08,0.186248,0.000833442,1.10415e-06,-6.63336e-09,0.187083,0.00083563,1.08425e-06,4.41484e-10,0.187919,0.0008378,1.08557e-06,4.86754e-09,0.188758,0.000839986,1.10017e-06,-5.01041e-09,0.189599,0.000842171,1.08514e-06,2.72811e-10,0.190443,0.000844342,1.08596e-06,3.91916e-09,0.191288,0.000846526,1.09772e-06,-1.04819e-09,0.192136,0.000848718,1.09457e-06,2.73531e-10,0.192985,0.000850908,1.0954e-06,-4.58916e-11,0.193837,0.000853099,1.09526e-06,-9.01158e-11,0.194692,0.000855289,1.09499e-06,4.06506e-10,0.195548,0.00085748,1.09621e-06,-1.53595e-09,0.196407,0.000859668,1.0916e-06,5.73717e-09,0.197267,0.000861869,1.10881e-06,-6.51164e-09,0.19813,0.000864067,1.08928e-06,5.40831e-09,0.198995,0.000866261,1.1055e-06,-2.20401e-10,0.199863,0.000868472,1.10484e-06,-4.52652e-09,0.200732,0.000870668,1.09126e-06,3.42508e-09,0.201604,0.000872861,1.10153e-06,5.72762e-09,0.202478,0.000875081,1.11872e-06,-1.14344e-08,0.203354,0.000877284,1.08441e-06,1.02076e-08,0.204233,0.000879484,1.11504e-06,4.06355e-10,0.205113,0.000881715,1.11626e-06,-1.18329e-08,0.205996,0.000883912,1.08076e-06,1.71227e-08,0.206881,0.000886125,1.13213e-06,-1.19546e-08,0.207768,0.000888353,1.09626e-06,8.93465e-10,0.208658,0.000890548,1.09894e-06,8.38062e-09,0.209549,0.000892771,1.12408e-06,-4.61353e-09,0.210443,0.000895006,1.11024e-06,-4.82756e-09,0.211339,0.000897212,1.09576e-06,9.02245e-09,0.212238,0.00089943,1.12283e-06,-1.45997e-09,0.213138,0.000901672,1.11845e-06,-3.18255e-09,0.214041,0.000903899,1.1089e-06,-7.11073e-10,0.214946,0.000906115,1.10677e-06,6.02692e-09,0.215853,0.000908346,1.12485e-06,-8.49548e-09,0.216763,0.00091057,1.09936e-06,1.30537e-08,0.217675,0.000912808,1.13852e-06,-1.3917e-08,0.218588,0.000915044,1.09677e-06,1.28121e-08,0.219505,0.000917276,1.13521e-06,-7.5288e-09,0.220423,0.000919523,1.11262e-06,2.40205e-09,0.221344,0.000921756,1.11983e-06,-2.07941e-09,0.222267,0.000923989,1.11359e-06,5.91551e-09,0.223192,0.000926234,1.13134e-06,-6.68149e-09,0.224119,0.000928477,1.11129e-06,5.90929e-09,0.225049,0.000930717,1.12902e-06,-2.05436e-09,0.22598,0.000932969,1.12286e-06,2.30807e-09,0.226915,0.000935222,1.12978e-06,-7.17796e-09,0.227851,0.00093746,1.10825e-06,1.15028e-08,0.228789,0.000939711,1.14276e-06,-9.03083e-09,0.22973,0.000941969,1.11566e-06,9.71932e-09,0.230673,0.00094423,1.14482e-06,-1.49452e-08,0.231619,0.000946474,1.09998e-06,2.02591e-08,0.232566,0.000948735,1.16076e-06,-2.13879e-08,0.233516,0.000950993,1.0966e-06,2.05888e-08,0.234468,0.000953247,1.15837e-06,-1.62642e-08,0.235423,0.000955515,1.10957e-06,1.46658e-08,0.236379,0.000957779,1.15357e-06,-1.25966e-08,0.237338,0.000960048,1.11578e-06,5.91793e-09,0.238299,0.000962297,1.13353e-06,3.82602e-09,0.239263,0.000964576,1.14501e-06,-6.3208e-09,0.240229,0.000966847,1.12605e-06,6.55613e-09,0.241197,0.000969119,1.14572e-06,-5.00268e-09,0.242167,0.000971395,1.13071e-06,-1.44659e-09,0.243139,0.000973652,1.12637e-06,1.07891e-08,0.244114,0.000975937,1.15874e-06,-1.19073e-08,0.245091,0.000978219,1.12302e-06,7.03782e-09,0.246071,0.000980486,1.14413e-06,-1.34276e-09,0.247052,0.00098277,1.1401e-06,-1.66669e-09,0.248036,0.000985046,1.1351e-06,8.00935e-09,0.249022,0.00098734,1.15913e-06,-1.54694e-08,0.250011,0.000989612,1.11272e-06,2.4066e-08,0.251002,0.000991909,1.18492e-06,-2.11901e-08,0.251995,0.000994215,1.12135e-06,1.08973e-09,0.25299,0.000996461,1.12462e-06,1.68311e-08,0.253988,0.000998761,1.17511e-06,-8.8094e-09,0.254987,0.00100109,1.14868e-06,-1.13958e-08,0.25599,0.00100335,1.1145e-06,2.45902e-08,0.256994,0.00100565,1.18827e-06,-2.73603e-08,0.258001,0.00100795,1.10618e-06,2.52464e-08,0.25901,0.00101023,1.18192e-06,-1.40207e-08,0.260021,0.00101256,1.13986e-06,1.03387e-09,0.261035,0.00101484,1.14296e-06,9.8853e-09,0.262051,0.00101715,1.17262e-06,-1.07726e-08,0.263069,0.00101947,1.1403e-06,3.40272e-09,0.26409,0.00102176,1.15051e-06,-2.83827e-09,0.265113,0.00102405,1.142e-06,7.95039e-09,0.266138,0.00102636,1.16585e-06,8.39047e-10,0.267166,0.00102869,1.16836e-06,-1.13066e-08,0.268196,0.00103099,1.13444e-06,1.4585e-08,0.269228,0.00103331,1.1782e-06,-1.72314e-08,0.270262,0.00103561,1.1265e-06,2.45382e-08,0.271299,0.00103794,1.20012e-06,-2.13166e-08,0.272338,0.00104028,1.13617e-06,1.12364e-09,0.273379,0.00104255,1.13954e-06,1.68221e-08,0.274423,0.00104488,1.19001e-06,-8.80736e-09,0.275469,0.00104723,1.16358e-06,-1.13948e-08,0.276518,0.00104953,1.1294e-06,2.45839e-08,0.277568,0.00105186,1.20315e-06,-2.73361e-08,0.278621,0.00105418,1.12114e-06,2.51559e-08,0.279677,0.0010565,1.19661e-06,-1.36832e-08,0.280734,0.00105885,1.15556e-06,-2.25706e-10,0.281794,0.00106116,1.15488e-06,1.45862e-08,0.282857,0.00106352,1.19864e-06,-2.83167e-08,0.283921,0.00106583,1.11369e-06,3.90759e-08,0.284988,0.00106817,1.23092e-06,-3.85801e-08,0.286058,0.00107052,1.11518e-06,2.58375e-08,0.287129,0.00107283,1.19269e-06,-5.16498e-09,0.288203,0.0010752,1.1772e-06,-5.17768e-09,0.28928,0.00107754,1.16167e-06,-3.92671e-09,0.290358,0.00107985,1.14988e-06,2.08846e-08,0.29144,0.00108221,1.21254e-06,-2.00072e-08,0.292523,0.00108458,1.15252e-06,-4.60659e-10,0.293609,0.00108688,1.15114e-06,2.18499e-08,0.294697,0.00108925,1.21669e-06,-2.73343e-08,0.295787,0.0010916,1.13468e-06,2.78826e-08,0.29688,0.00109395,1.21833e-06,-2.45915e-08,0.297975,0.00109632,1.14456e-06,1.08787e-08,0.299073,0.00109864,1.17719e-06,1.08788e-08,0.300172,0.00110102,1.20983e-06,-2.45915e-08,0.301275,0.00110337,1.13605e-06,2.78828e-08,0.302379,0.00110573,1.2197e-06,-2.73348e-08,0.303486,0.00110808,1.1377e-06,2.18518e-08,0.304595,0.00111042,1.20325e-06,-4.67556e-10,0.305707,0.00111283,1.20185e-06,-1.99816e-08,0.306821,0.00111517,1.14191e-06,2.07891e-08,0.307937,0.00111752,1.20427e-06,-3.57026e-09,0.309056,0.00111992,1.19356e-06,-6.50797e-09,0.310177,0.00112228,1.17404e-06,-2.00165e-10,0.3113,0.00112463,1.17344e-06,7.30874e-09,0.312426,0.001127,1.19536e-06,7.67424e-10,0.313554,0.00112939,1.19767e-06,-1.03784e-08,0.314685,0.00113176,1.16653e-06,1.09437e-08,0.315818,0.00113412,1.19936e-06,-3.59406e-09,0.316953,0.00113651,1.18858e-06,3.43251e-09,0.318091,0.0011389,1.19888e-06,-1.0136e-08,0.319231,0.00114127,1.16847e-06,7.30915e-09,0.320374,0.00114363,1.1904e-06,1.07018e-08,0.321518,0.00114604,1.2225e-06,-2.03137e-08,0.322666,0.00114842,1.16156e-06,1.09484e-08,0.323815,0.00115078,1.19441e-06,6.32224e-09,0.324967,0.00115319,1.21337e-06,-6.43509e-09,0.326122,0.00115559,1.19407e-06,-1.03842e-08,0.327278,0.00115795,1.16291e-06,1.81697e-08,0.328438,0.00116033,1.21742e-06,-2.6901e-09,0.329599,0.00116276,1.20935e-06,-7.40939e-09,0.330763,0.00116515,1.18713e-06,2.52533e-09,0.331929,0.00116754,1.1947e-06,-2.69191e-09,0.333098,0.00116992,1.18663e-06,8.24218e-09,0.334269,0.00117232,1.21135e-06,-4.74377e-10,0.335443,0.00117474,1.20993e-06,-6.34471e-09,0.336619,0.00117714,1.1909e-06,-3.94922e-09,0.337797,0.00117951,1.17905e-06,2.21417e-08,0.338978,0.00118193,1.24547e-06,-2.50128e-08,0.340161,0.00118435,1.17043e-06,1.8305e-08,0.341346,0.00118674,1.22535e-06,-1.84048e-08,0.342534,0.00118914,1.17013e-06,2.55121e-08,0.343725,0.00119156,1.24667e-06,-2.40389e-08,0.344917,0.00119398,1.17455e-06,1.10389e-08,0.346113,0.00119636,1.20767e-06,9.68574e-09,0.34731,0.0011988,1.23673e-06,-1.99797e-08,0.34851,0.00120122,1.17679e-06,1.06284e-08,0.349713,0.0012036,1.20867e-06,7.26868e-09,0.350917,0.00120604,1.23048e-06,-9.90072e-09,0.352125,0.00120847,1.20078e-06,2.53177e-09,0.353334,0.00121088,1.20837e-06,-2.26199e-10,0.354546,0.0012133,1.20769e-06,-1.62705e-09,0.355761,0.00121571,1.20281e-06,6.73435e-09,0.356978,0.00121813,1.22302e-06,4.49207e-09,0.358197,0.00122059,1.23649e-06,-2.47027e-08,0.359419,0.00122299,1.16238e-06,3.47142e-08,0.360643,0.00122542,1.26653e-06,-2.47472e-08,0.36187,0.00122788,1.19229e-06,4.66965e-09,0.363099,0.00123028,1.20629e-06,6.06872e-09,0.36433,0.00123271,1.2245e-06,8.57729e-10,0.365564,0.00123516,1.22707e-06,-9.49952e-09,0.366801,0.00123759,1.19858e-06,7.33792e-09,0.36804,0.00124001,1.22059e-06,9.95025e-09,0.369281,0.00124248,1.25044e-06,-1.73366e-08,0.370525,0.00124493,1.19843e-06,-2.08464e-10,0.371771,0.00124732,1.1978e-06,1.81704e-08,0.373019,0.00124977,1.25232e-06,-1.28683e-08,0.37427,0.00125224,1.21371e-06,3.50042e-09,0.375524,0.00125468,1.22421e-06,-1.1335e-09,0.37678,0.00125712,1.22081e-06,1.03345e-09,0.378038,0.00125957,1.22391e-06,-3.00023e-09,0.379299,0.00126201,1.21491e-06,1.09676e-08,0.380562,0.00126447,1.24781e-06,-1.10676e-08,0.381828,0.00126693,1.21461e-06,3.50042e-09,0.383096,0.00126937,1.22511e-06,-2.93403e-09,0.384366,0.00127181,1.21631e-06,8.23574e-09,0.385639,0.00127427,1.24102e-06,-2.06607e-10,0.386915,0.00127675,1.2404e-06,-7.40935e-09,0.388193,0.00127921,1.21817e-06,4.1761e-11,0.389473,0.00128165,1.21829e-06,7.24223e-09,0.390756,0.0012841,1.24002e-06,7.91564e-10,0.392042,0.00128659,1.2424e-06,-1.04086e-08,0.393329,0.00128904,1.21117e-06,1.10405e-08,0.39462,0.0012915,1.24429e-06,-3.951e-09,0.395912,0.00129397,1.23244e-06,4.7634e-09,0.397208,0.00129645,1.24673e-06,-1.51025e-08,0.398505,0.0012989,1.20142e-06,2.58443e-08,0.399805,0.00130138,1.27895e-06,-2.86702e-08,0.401108,0.00130385,1.19294e-06,2.92318e-08,0.402413,0.00130632,1.28064e-06,-2.86524e-08,0.403721,0.0013088,1.19468e-06,2.57731e-08,0.405031,0.00131127,1.272e-06,-1.48355e-08,0.406343,0.00131377,1.2275e-06,3.76652e-09,0.407658,0.00131623,1.23879e-06,-2.30784e-10,0.408976,0.00131871,1.2381e-06,-2.84331e-09,0.410296,0.00132118,1.22957e-06,1.16041e-08,0.411618,0.00132367,1.26438e-06,-1.37708e-08,0.412943,0.00132616,1.22307e-06,1.36768e-08,0.41427,0.00132865,1.2641e-06,-1.1134e-08,0.4156,0.00133114,1.2307e-06,1.05714e-09,0.416933,0.00133361,1.23387e-06,6.90538e-09,0.418267,0.00133609,1.25459e-06,1.12372e-09,0.419605,0.00133861,1.25796e-06,-1.14002e-08,0.420945,0.00134109,1.22376e-06,1.46747e-08,0.422287,0.00134358,1.26778e-06,-1.7496e-08,0.423632,0.00134606,1.21529e-06,2.5507e-08,0.424979,0.00134857,1.29182e-06,-2.49272e-08,0.426329,0.00135108,1.21703e-06,1.45972e-08,0.427681,0.00135356,1.26083e-06,-3.65935e-09,0.429036,0.00135607,1.24985e-06,4.00178e-11,0.430393,0.00135857,1.24997e-06,3.49917e-09,0.431753,0.00136108,1.26047e-06,-1.40366e-08,0.433116,0.00136356,1.21836e-06,2.28448e-08,0.43448,0.00136606,1.28689e-06,-1.77378e-08,0.435848,0.00136858,1.23368e-06,1.83043e-08,0.437218,0.0013711,1.28859e-06,-2.56769e-08,0.43859,0.0013736,1.21156e-06,2.47987e-08,0.439965,0.0013761,1.28595e-06,-1.39133e-08,0.441342,0.00137863,1.24421e-06,1.05202e-09,0.442722,0.00138112,1.24737e-06,9.70507e-09,0.444104,0.00138365,1.27649e-06,-1.00698e-08,0.445489,0.00138617,1.24628e-06,7.72123e-10,0.446877,0.00138867,1.24859e-06,6.98132e-09,0.448267,0.00139118,1.26954e-06,1.10477e-09,0.449659,0.00139373,1.27285e-06,-1.14003e-08,0.451054,0.00139624,1.23865e-06,1.4694e-08,0.452452,0.00139876,1.28273e-06,-1.75734e-08,0.453852,0.00140127,1.23001e-06,2.5797e-08,0.455254,0.00140381,1.3074e-06,-2.60097e-08,0.456659,0.00140635,1.22937e-06,1.86371e-08,0.458067,0.00140886,1.28529e-06,-1.8736e-08,0.459477,0.00141137,1.22908e-06,2.65048e-08,0.46089,0.00141391,1.30859e-06,-2.76784e-08,0.462305,0.00141645,1.22556e-06,2.46043e-08,0.463722,0.00141897,1.29937e-06,-1.11341e-08,0.465143,0.00142154,1.26597e-06,-9.87033e-09,0.466565,0.00142404,1.23636e-06,2.08131e-08,0.467991,0.00142657,1.2988e-06,-1.37773e-08,0.469419,0.00142913,1.25746e-06,4.49378e-09,0.470849,0.00143166,1.27094e-06,-4.19781e-09,0.472282,0.00143419,1.25835e-06,1.22975e-08,0.473717,0.00143674,1.29524e-06,-1.51902e-08,0.475155,0.00143929,1.24967e-06,1.86608e-08,0.476596,0.00144184,1.30566e-06,-2.96506e-08,0.478039,0.00144436,1.2167e-06,4.03368e-08,0.479485,0.00144692,1.33771e-06,-4.22896e-08,0.480933,0.00144947,1.21085e-06,3.94148e-08,0.482384,0.00145201,1.32909e-06,-2.59626e-08,0.483837,0.00145459,1.2512e-06,4.83124e-09,0.485293,0.0014571,1.2657e-06,6.63757e-09,0.486751,0.00145966,1.28561e-06,-1.57911e-09,0.488212,0.00146222,1.28087e-06,-3.21468e-10,0.489676,0.00146478,1.27991e-06,2.86517e-09,0.491142,0.00146735,1.2885e-06,-1.11392e-08,0.49261,0.00146989,1.25508e-06,1.18893e-08,0.494081,0.00147244,1.29075e-06,-6.61574e-09,0.495555,0.001475,1.27091e-06,1.45736e-08,0.497031,0.00147759,1.31463e-06,-2.18759e-08,0.49851,0.00148015,1.249e-06,1.33252e-08,0.499992,0.00148269,1.28897e-06,-1.62277e-09,0.501476,0.00148526,1.28411e-06,-6.83421e-09,0.502962,0.00148781,1.2636e-06,2.89596e-08,0.504451,0.00149042,1.35048e-06,-4.93997e-08,0.505943,0.00149298,1.20228e-06,4.94299e-08,0.507437,0.00149553,1.35057e-06,-2.91107e-08,0.508934,0.00149814,1.26324e-06,7.40848e-09,0.510434,0.00150069,1.28547e-06,-5.23187e-10,0.511936,0.00150326,1.2839e-06,-5.31585e-09,0.51344,0.00150581,1.26795e-06,2.17866e-08,0.514947,0.00150841,1.33331e-06,-2.22257e-08,0.516457,0.00151101,1.26663e-06,7.51178e-09,0.517969,0.00151357,1.28917e-06,-7.82128e-09,0.519484,0.00151613,1.2657e-06,2.37733e-08,0.521002,0.00151873,1.33702e-06,-2.76674e-08,0.522522,0.00152132,1.25402e-06,2.72917e-08,0.524044,0.00152391,1.3359e-06,-2.18949e-08,0.525569,0.00152652,1.27021e-06,6.83372e-10,0.527097,0.00152906,1.27226e-06,1.91613e-08,0.528628,0.00153166,1.32974e-06,-1.77241e-08,0.53016,0.00153427,1.27657e-06,-7.86963e-09,0.531696,0.0015368,1.25296e-06,4.92027e-08,0.533234,0.00153945,1.40057e-06,-6.9732e-08,0.534775,0.00154204,1.19138e-06,5.09114e-08,0.536318,0.00154458,1.34411e-06,-1.4704e-08,0.537864,0.00154722,1.3e-06,7.9048e-09,0.539413,0.00154984,1.32371e-06,-1.69152e-08,0.540964,0.00155244,1.27297e-06,1.51355e-10,0.542517,0.00155499,1.27342e-06,1.63099e-08,0.544074,0.00155758,1.32235e-06,-5.78647e-09,0.545633,0.00156021,1.30499e-06,6.83599e-09,0.547194,0.00156284,1.3255e-06,-2.15575e-08,0.548758,0.00156543,1.26083e-06,1.97892e-08,0.550325,0.00156801,1.32019e-06,2.00525e-09,0.551894,0.00157065,1.32621e-06,-2.78103e-08,0.553466,0.00157322,1.24278e-06,4.96314e-08,0.555041,0.00157586,1.39167e-06,-5.1506e-08,0.556618,0.00157849,1.23716e-06,3.71835e-08,0.558198,0.00158107,1.34871e-06,-3.76233e-08,0.55978,0.00158366,1.23584e-06,5.37052e-08,0.561365,0.00158629,1.39695e-06,-5.79884e-08,0.562953,0.00158891,1.22299e-06,5.90392e-08,0.564543,0.00159153,1.4001e-06,-5.89592e-08,0.566136,0.00159416,1.22323e-06,5.7588e-08,0.567731,0.00159678,1.39599e-06,-5.21835e-08,0.569329,0.00159941,1.23944e-06,3.19369e-08,0.57093,0.00160199,1.33525e-06,-1.59594e-08,0.572533,0.00160461,1.28737e-06,3.19006e-08,0.574139,0.00160728,1.38307e-06,-5.20383e-08,0.575748,0.00160989,1.22696e-06,5.70431e-08,0.577359,0.00161251,1.39809e-06,-5.69247e-08,0.578973,0.00161514,1.22731e-06,5.14463e-08,0.580589,0.00161775,1.38165e-06,-2.9651e-08,0.582208,0.00162042,1.2927e-06,7.55339e-09,0.58383,0.00162303,1.31536e-06,-5.62636e-10,0.585455,0.00162566,1.31367e-06,-5.30281e-09,0.587081,0.00162827,1.29776e-06,2.17738e-08,0.588711,0.00163093,1.36309e-06,-2.21875e-08,0.590343,0.00163359,1.29652e-06,7.37164e-09,0.591978,0.00163621,1.31864e-06,-7.29907e-09,0.593616,0.00163882,1.29674e-06,2.18247e-08,0.595256,0.00164148,1.36221e-06,-2.03952e-08,0.596899,0.00164414,1.30103e-06,1.51241e-10,0.598544,0.00164675,1.30148e-06,1.97902e-08,0.600192,0.00164941,1.36085e-06,-1.97074e-08,0.601843,0.00165207,1.30173e-06,-5.65175e-10,0.603496,0.00165467,1.30004e-06,2.1968e-08,0.605152,0.00165734,1.36594e-06,-2.77024e-08,0.606811,0.00165999,1.28283e-06,2.92369e-08,0.608472,0.00166264,1.37054e-06,-2.96407e-08,0.610136,0.00166529,1.28162e-06,2.97215e-08,0.611803,0.00166795,1.37079e-06,-2.96408e-08,0.613472,0.0016706,1.28186e-06,2.92371e-08,0.615144,0.00167325,1.36957e-06,-2.77031e-08,0.616819,0.00167591,1.28647e-06,2.19708e-08,0.618496,0.00167855,1.35238e-06,-5.75407e-10,0.620176,0.00168125,1.35065e-06,-1.9669e-08,0.621858,0.00168389,1.29164e-06,1.96468e-08,0.623544,0.00168653,1.35058e-06,6.86403e-10,0.625232,0.00168924,1.35264e-06,-2.23924e-08,0.626922,0.00169187,1.28547e-06,2.92788e-08,0.628615,0.00169453,1.3733e-06,-3.51181e-08,0.630311,0.00169717,1.26795e-06,5.15889e-08,0.63201,0.00169987,1.42272e-06,-5.2028e-08,0.633711,0.00170255,1.26663e-06,3.73139e-08,0.635415,0.0017052,1.37857e-06,-3.76227e-08,0.637121,0.00170784,1.2657e-06,5.35722e-08,0.63883,0.00171054,1.42642e-06,-5.74567e-08,0.640542,0.00171322,1.25405e-06,5.70456e-08,0.642257,0.0017159,1.42519e-06,-5.15163e-08,0.643974,0.00171859,1.27064e-06,2.98103e-08,0.645694,0.00172122,1.36007e-06,-8.12016e-09,0.647417,0.00172392,1.33571e-06,2.67039e-09,0.649142,0.0017266,1.34372e-06,-2.56152e-09,0.65087,0.00172928,1.33604e-06,7.57571e-09,0.6526,0.00173197,1.35876e-06,-2.77413e-08,0.654334,0.00173461,1.27554e-06,4.3785e-08,0.65607,0.00173729,1.40689e-06,-2.81896e-08,0.657808,0.00174002,1.32233e-06,9.36893e-09,0.65955,0.00174269,1.35043e-06,-9.28617e-09,0.661294,0.00174536,1.32257e-06,2.77757e-08,0.66304,0.00174809,1.4059e-06,-4.2212e-08,0.66479,0.00175078,1.27926e-06,2.1863e-08,0.666542,0.0017534,1.34485e-06,1.43648e-08,0.668297,0.00175613,1.38795e-06,-1.97177e-08,0.670054,0.00175885,1.3288e-06,4.90115e-09,0.671814,0.00176152,1.3435e-06,1.13232e-10,0.673577,0.00176421,1.34384e-06,-5.3542e-09,0.675343,0.00176688,1.32778e-06,2.13035e-08,0.677111,0.0017696,1.39169e-06,-2.02553e-08,0.678882,0.00177232,1.33092e-06,1.13005e-10,0.680656,0.00177499,1.33126e-06,1.98031e-08,0.682432,0.00177771,1.39067e-06,-1.97211e-08,0.684211,0.00178043,1.33151e-06,-5.2349e-10,0.685993,0.00178309,1.32994e-06,2.18151e-08,0.687777,0.00178582,1.39538e-06,-2.71325e-08,0.689564,0.00178853,1.31398e-06,2.71101e-08,0.691354,0.00179124,1.39531e-06,-2.17035e-08,0.693147,0.00179396,1.3302e-06,9.92865e-11,0.694942,0.00179662,1.3305e-06,2.13063e-08,0.69674,0.00179935,1.39442e-06,-2.57198e-08,0.698541,0.00180206,1.31726e-06,2.19682e-08,0.700344,0.00180476,1.38317e-06,-2.54852e-09,0.70215,0.00180752,1.37552e-06,-1.17741e-08,0.703959,0.00181023,1.3402e-06,-9.95999e-09,0.705771,0.00181288,1.31032e-06,5.16141e-08,0.707585,0.00181566,1.46516e-06,-7.72869e-08,0.709402,0.00181836,1.2333e-06,7.87197e-08,0.711222,0.00182106,1.46946e-06,-5.87781e-08,0.713044,0.00182382,1.29312e-06,3.71834e-08,0.714869,0.00182652,1.40467e-06,-3.03511e-08,0.716697,0.00182924,1.31362e-06,2.46161e-08,0.718528,0.00183194,1.38747e-06,-8.5087e-09,0.720361,0.00183469,1.36194e-06,9.41892e-09,0.722197,0.00183744,1.3902e-06,-2.91671e-08,0.724036,0.00184014,1.3027e-06,4.76448e-08,0.725878,0.00184288,1.44563e-06,-4.22028e-08,0.727722,0.00184565,1.31902e-06,1.95682e-09,0.729569,0.00184829,1.3249e-06,3.43754e-08,0.731419,0.00185104,1.42802e-06,-2.0249e-08,0.733271,0.00185384,1.36727e-06,-1.29838e-08,0.735126,0.00185654,1.32832e-06,1.25794e-08,0.736984,0.00185923,1.36606e-06,2.22711e-08,0.738845,0.00186203,1.43287e-06,-4.20594e-08,0.740708,0.00186477,1.3067e-06,2.67571e-08,0.742574,0.00186746,1.38697e-06,-5.36424e-09,0.744443,0.00187022,1.37087e-06,-5.30023e-09,0.746315,0.00187295,1.35497e-06,2.65653e-08,0.748189,0.00187574,1.43467e-06,-4.13564e-08,0.750066,0.00187848,1.3106e-06,1.9651e-08,0.751946,0.00188116,1.36955e-06,2.23572e-08,0.753828,0.00188397,1.43663e-06,-4.9475e-08,0.755714,0.00188669,1.2882e-06,5.63335e-08,0.757602,0.00188944,1.4572e-06,-5.66499e-08,0.759493,0.00189218,1.28725e-06,5.10567e-08,0.761386,0.00189491,1.44042e-06,-2.83677e-08,0.763283,0.00189771,1.35532e-06,2.80962e-09,0.765182,0.00190042,1.36375e-06,1.71293e-08,0.767083,0.0019032,1.41513e-06,-1.17221e-08,0.768988,0.001906,1.37997e-06,-2.98453e-08,0.770895,0.00190867,1.29043e-06,7.14987e-08,0.772805,0.00191146,1.50493e-06,-7.73354e-08,0.774718,0.00191424,1.27292e-06,5.90292e-08,0.776634,0.00191697,1.45001e-06,-3.9572e-08,0.778552,0.00191975,1.33129e-06,3.9654e-08,0.780473,0.00192253,1.45026e-06,-5.94395e-08,0.782397,0.00192525,1.27194e-06,7.88945e-08,0.784324,0.00192803,1.50862e-06,-7.73249e-08,0.786253,0.00193082,1.27665e-06,5.15913e-08,0.788185,0.00193352,1.43142e-06,-9.83099e-09,0.79012,0.00193636,1.40193e-06,-1.22672e-08,0.792058,0.00193912,1.36513e-06,-7.05275e-10,0.793999,0.00194185,1.36301e-06,1.50883e-08,0.795942,0.00194462,1.40828e-06,-4.33147e-11,0.797888,0.00194744,1.40815e-06,-1.49151e-08,0.799837,0.00195021,1.3634e-06,9.93244e-11,0.801788,0.00195294,1.3637e-06,1.45179e-08,0.803743,0.00195571,1.40725e-06,1.43363e-09,0.8057,0.00195853,1.41155e-06,-2.02525e-08,0.80766,0.00196129,1.35079e-06,1.99718e-08,0.809622,0.00196405,1.41071e-06,-3.01649e-11,0.811588,0.00196687,1.41062e-06,-1.9851e-08,0.813556,0.00196964,1.35107e-06,1.98296e-08,0.815527,0.0019724,1.41056e-06,1.37485e-10,0.817501,0.00197522,1.41097e-06,-2.03796e-08,0.819477,0.00197798,1.34983e-06,2.17763e-08,0.821457,0.00198074,1.41516e-06,-7.12085e-09,0.823439,0.00198355,1.3938e-06,6.70707e-09,0.825424,0.00198636,1.41392e-06,-1.97074e-08,0.827412,0.00198913,1.35479e-06,1.25179e-08,0.829402,0.00199188,1.39235e-06,2.92405e-08,0.831396,0.00199475,1.48007e-06,-6.98755e-08,0.833392,0.0019975,1.27044e-06,7.14477e-08,0.835391,0.00200026,1.48479e-06,-3.71014e-08,0.837392,0.00200311,1.37348e-06,1.73533e-08,0.839397,0.00200591,1.42554e-06,-3.23118e-08,0.841404,0.00200867,1.32861e-06,5.2289e-08,0.843414,0.00201148,1.48547e-06,-5.76348e-08,0.845427,0.00201428,1.31257e-06,5.9041e-08,0.847443,0.00201708,1.48969e-06,-5.93197e-08,0.849461,0.00201988,1.31173e-06,5.90289e-08,0.851482,0.00202268,1.48882e-06,-5.75864e-08,0.853507,0.00202549,1.31606e-06,5.21075e-08,0.855533,0.00202828,1.47238e-06,-3.16344e-08,0.857563,0.00203113,1.37748e-06,1.48257e-08,0.859596,0.00203393,1.42196e-06,-2.76684e-08,0.861631,0.00203669,1.33895e-06,3.62433e-08,0.863669,0.00203947,1.44768e-06,1.90463e-09,0.86571,0.00204237,1.45339e-06,-4.38617e-08,0.867754,0.00204515,1.32181e-06,5.43328e-08,0.8698,0.00204796,1.48481e-06,-5.42603e-08,0.87185,0.00205076,1.32203e-06,4.34989e-08,0.873902,0.00205354,1.45252e-06,-5.26029e-10,0.875957,0.00205644,1.45095e-06,-4.13949e-08,0.878015,0.00205922,1.32676e-06,4.68962e-08,0.880075,0.00206201,1.46745e-06,-2.69807e-08,0.882139,0.00206487,1.38651e-06,1.42181e-09,0.884205,0.00206764,1.39077e-06,2.12935e-08,0.886274,0.00207049,1.45465e-06,-2.69912e-08,0.888346,0.00207332,1.37368e-06,2.70664e-08,0.890421,0.00207615,1.45488e-06,-2.16698e-08,0.892498,0.00207899,1.38987e-06,8.14756e-12,0.894579,0.00208177,1.38989e-06,2.16371e-08,0.896662,0.00208462,1.45481e-06,-2.6952e-08,0.898748,0.00208744,1.37395e-06,2.65663e-08,0.900837,0.00209027,1.45365e-06,-1.97084e-08,0.902928,0.00209312,1.39452e-06,-7.33731e-09,0.905023,0.00209589,1.37251e-06,4.90578e-08,0.90712,0.00209878,1.51968e-06,-6.96845e-08,0.90922,0.00210161,1.31063e-06,5.08664e-08,0.911323,0.00210438,1.46323e-06,-1.45717e-08,0.913429,0.00210727,1.41952e-06,7.42038e-09,0.915538,0.00211013,1.44178e-06,-1.51097e-08,0.917649,0.00211297,1.39645e-06,-6.58618e-09,0.919764,0.00211574,1.37669e-06,4.14545e-08,0.921881,0.00211862,1.50105e-06,-4.00222e-08,0.924001,0.0021215,1.38099e-06,-5.7518e-10,0.926124,0.00212426,1.37926e-06,4.23229e-08,0.92825,0.00212714,1.50623e-06,-4.9507e-08,0.930378,0.00213001,1.35771e-06,3.64958e-08,0.93251,0.00213283,1.4672e-06,-3.68713e-08,0.934644,0.00213566,1.35658e-06,5.13848e-08,0.936781,0.00213852,1.51074e-06,-4.94585e-08,0.938921,0.0021414,1.36236e-06,2.72399e-08,0.941064,0.0021442,1.44408e-06,1.0372e-10,0.943209,0.00214709,1.44439e-06,-2.76547e-08,0.945358,0.0021499,1.36143e-06,5.09106e-08,0.947509,0.00215277,1.51416e-06,-5.67784e-08,0.949663,0.00215563,1.34382e-06,5.69935e-08,0.95182,0.00215849,1.5148e-06,-5.19861e-08,0.95398,0.00216136,1.35885e-06,3.17417e-08,0.956143,0.00216418,1.45407e-06,-1.53758e-08,0.958309,0.00216704,1.40794e-06,2.97615e-08,0.960477,0.00216994,1.49723e-06,-4.40657e-08,0.962649,0.00217281,1.36503e-06,2.72919e-08,0.964823,0.00217562,1.44691e-06,-5.49729e-09,0.967,0.0021785,1.43041e-06,-5.30273e-09,0.96918,0.00218134,1.41451e-06,2.67084e-08,0.971363,0.00218425,1.49463e-06,-4.19265e-08,0.973548,0.00218711,1.36885e-06,2.17881e-08,0.975737,0.00218992,1.43422e-06,1.43789e-08,0.977928,0.00219283,1.47735e-06,-1.96989e-08,0.980122,0.00219572,1.41826e-06,4.81221e-09,0.98232,0.00219857,1.43269e-06,4.50048e-10,0.98452,0.00220144,1.43404e-06,-6.61237e-09,0.986722,0.00220429,1.41421e-06,2.59993e-08,0.988928,0.0022072,1.4922e-06,-3.77803e-08,0.991137,0.00221007,1.37886e-06,5.9127e-09,0.993348,0.00221284,1.3966e-06,1.33339e-07,0.995563,0.00221604,1.79662e-06,-5.98872e-07,0.99778,0.00222015,0.,0.}; - - template - __device__ __forceinline__ void RGB2LabConvert_f(const T& src, D& dst) - { - const float _1_3 = 1.0f / 3.0f; - const float _a = 16.0f / 116.0f; - - float B = blueIdx == 0 ? src.x : src.z; - float G = src.y; - float R = blueIdx == 0 ? src.z : src.x; - - if (srgb) - { - B = splineInterpolate(B * GAMMA_TAB_SIZE, c_sRGBGammaTab, GAMMA_TAB_SIZE); - G = splineInterpolate(G * GAMMA_TAB_SIZE, c_sRGBGammaTab, GAMMA_TAB_SIZE); - R = splineInterpolate(R * GAMMA_TAB_SIZE, c_sRGBGammaTab, GAMMA_TAB_SIZE); - } - - float X = B * 0.189828f + G * 0.376219f + R * 0.433953f; - float Y = B * 0.072169f + G * 0.715160f + R * 0.212671f; - float Z = B * 0.872766f + G * 0.109477f + R * 0.017758f; - - float FX = X > 0.008856f ? ::powf(X, _1_3) : (7.787f * X + _a); - float FY = Y > 0.008856f ? ::powf(Y, _1_3) : (7.787f * Y + _a); - float FZ = Z > 0.008856f ? ::powf(Z, _1_3) : (7.787f * Z + _a); - - float L = Y > 0.008856f ? (116.f * FY - 16.f) : (903.3f * Y); - float a = 500.f * (FX - FY); - float b = 200.f * (FY - FZ); - - dst.x = L; - dst.y = a; - dst.z = b; - } - - template struct RGB2Lab; - template - struct RGB2Lab - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator ()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - RGB2LabConvert_b(src, dst); - - return dst; - } - __host__ __device__ __forceinline__ RGB2Lab() {} - __host__ __device__ __forceinline__ RGB2Lab(const RGB2Lab&) {} - }; - template - struct RGB2Lab - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator ()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - RGB2LabConvert_f(src, dst); - - return dst; - } - __host__ __device__ __forceinline__ RGB2Lab() {} - __host__ __device__ __forceinline__ RGB2Lab(const RGB2Lab&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_RGB2Lab_TRAITS(name, scn, dcn, srgb, blueIdx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2Lab functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - - namespace color_detail - { - __constant__ float c_sRGBInvGammaTab[] = {0,0.0126255,0.,-8.33961e-06,0.0126172,0.0126005,-2.50188e-05,4.1698e-05,0.0252344,0.0126756,0.000100075,-0.000158451,0.0378516,0.0124004,-0.000375277,-0.000207393,0.0496693,0.0110276,-0.000997456,0.00016837,0.0598678,0.00953783,-0.000492346,2.07235e-05,0.068934,0.00861531,-0.000430176,3.62876e-05,0.0771554,0.00786382,-0.000321313,1.87625e-05,0.0847167,0.00727748,-0.000265025,1.53594e-05,0.0917445,0.00679351,-0.000218947,1.10545e-05,0.0983301,0.00638877,-0.000185784,8.66984e-06,0.104542,0.00604322,-0.000159774,6.82996e-06,0.110432,0.00574416,-0.000139284,5.51008e-06,0.116042,0.00548212,-0.000122754,4.52322e-06,0.121406,0.00525018,-0.000109184,3.75557e-06,0.126551,0.00504308,-9.79177e-05,3.17134e-06,0.131499,0.00485676,-8.84037e-05,2.68469e-06,0.13627,0.004688,-8.03496e-05,2.31725e-06,0.14088,0.00453426,-7.33978e-05,2.00868e-06,0.145343,0.00439349,-6.73718e-05,1.74775e-06,0.149671,0.00426399,-6.21286e-05,1.53547e-06,0.153875,0.00414434,-5.75222e-05,1.364e-06,0.157963,0.00403338,-5.34301e-05,1.20416e-06,0.161944,0.00393014,-4.98177e-05,1.09114e-06,0.165825,0.00383377,-4.65443e-05,9.57987e-07,0.169613,0.00374356,-4.36703e-05,8.88359e-07,0.173314,0.00365888,-4.10052e-05,7.7849e-07,0.176933,0.00357921,-3.86697e-05,7.36254e-07,0.180474,0.00350408,-3.6461e-05,6.42534e-07,0.183942,0.00343308,-3.45334e-05,6.12614e-07,0.187342,0.00336586,-3.26955e-05,5.42894e-07,0.190675,0.00330209,-3.10669e-05,5.08967e-07,0.193947,0.00324149,-2.954e-05,4.75977e-07,0.197159,0.00318383,-2.8112e-05,4.18343e-07,0.200315,0.00312887,-2.6857e-05,4.13651e-07,0.203418,0.00307639,-2.5616e-05,3.70847e-07,0.206469,0.00302627,-2.45035e-05,3.3813e-07,0.209471,0.00297828,-2.34891e-05,3.32999e-07,0.212426,0.0029323,-2.24901e-05,2.96826e-07,0.215336,0.00288821,-2.15996e-05,2.82736e-07,0.218203,0.00284586,-2.07514e-05,2.70961e-07,0.221029,0.00280517,-1.99385e-05,2.42744e-07,0.223814,0.00276602,-1.92103e-05,2.33277e-07,0.226561,0.0027283,-1.85105e-05,2.2486e-07,0.229271,0.00269195,-1.78359e-05,2.08383e-07,0.231945,0.00265691,-1.72108e-05,1.93305e-07,0.234585,0.00262307,-1.66308e-05,1.80687e-07,0.237192,0.00259035,-1.60888e-05,1.86632e-07,0.239766,0.00255873,-1.55289e-05,1.60569e-07,0.24231,0.00252815,-1.50472e-05,1.54566e-07,0.244823,0.00249852,-1.45835e-05,1.59939e-07,0.247307,0.00246983,-1.41037e-05,1.29549e-07,0.249763,0.00244202,-1.3715e-05,1.41429e-07,0.252191,0.00241501,-1.32907e-05,1.39198e-07,0.254593,0.00238885,-1.28731e-05,1.06444e-07,0.256969,0.00236342,-1.25538e-05,1.2048e-07,0.25932,0.00233867,-1.21924e-05,1.26892e-07,0.261647,0.00231467,-1.18117e-05,8.72084e-08,0.26395,0.00229131,-1.15501e-05,1.20323e-07,0.26623,0.00226857,-1.11891e-05,8.71514e-08,0.268487,0.00224645,-1.09276e-05,9.73165e-08,0.270723,0.00222489,-1.06357e-05,8.98259e-08,0.272937,0.00220389,-1.03662e-05,7.98218e-08,0.275131,0.00218339,-1.01267e-05,9.75254e-08,0.277304,0.00216343,-9.83416e-06,6.65195e-08,0.279458,0.00214396,-9.63461e-06,8.34313e-08,0.281592,0.00212494,-9.38431e-06,7.65919e-08,0.283708,0.00210641,-9.15454e-06,5.7236e-08,0.285805,0.00208827,-8.98283e-06,8.18939e-08,0.287885,0.00207055,-8.73715e-06,6.2224e-08,0.289946,0.00205326,-8.55047e-06,5.66388e-08,0.291991,0.00203633,-8.38056e-06,6.88491e-08,0.294019,0.00201978,-8.17401e-06,5.53955e-08,0.296031,0.00200359,-8.00782e-06,6.71971e-08,0.298027,0.00198778,-7.80623e-06,3.34439e-08,0.300007,0.00197227,-7.7059e-06,6.7248e-08,0.301971,0.00195706,-7.50416e-06,5.51915e-08,0.303921,0.00194221,-7.33858e-06,3.98124e-08,0.305856,0.00192766,-7.21915e-06,5.37795e-08,0.307776,0.00191338,-7.05781e-06,4.30919e-08,0.309683,0.00189939,-6.92853e-06,4.20744e-08,0.311575,0.00188566,-6.80231e-06,5.68321e-08,0.313454,0.00187223,-6.63181e-06,2.86195e-08,0.31532,0.00185905,-6.54595e-06,3.73075e-08,0.317172,0.00184607,-6.43403e-06,6.05684e-08,0.319012,0.00183338,-6.25233e-06,1.84426e-08,0.320839,0.00182094,-6.197e-06,4.44757e-08,0.322654,0.00180867,-6.06357e-06,4.20729e-08,0.324456,0.00179667,-5.93735e-06,2.56511e-08,0.326247,0.00178488,-5.8604e-06,3.41368e-08,0.328026,0.00177326,-5.75799e-06,4.64177e-08,0.329794,0.00176188,-5.61874e-06,1.86107e-08,0.33155,0.0017507,-5.5629e-06,2.81511e-08,0.333295,0.00173966,-5.47845e-06,4.75987e-08,0.335029,0.00172884,-5.33565e-06,1.98726e-08,0.336753,0.00171823,-5.27604e-06,2.19226e-08,0.338466,0.00170775,-5.21027e-06,4.14483e-08,0.340169,0.00169745,-5.08592e-06,2.09017e-08,0.341861,0.00168734,-5.02322e-06,2.39561e-08,0.343543,0.00167737,-4.95135e-06,3.22852e-08,0.345216,0.00166756,-4.85449e-06,2.57173e-08,0.346878,0.00165793,-4.77734e-06,1.38569e-08,0.348532,0.00164841,-4.73577e-06,3.80634e-08,0.350175,0.00163906,-4.62158e-06,1.27043e-08,0.35181,0.00162985,-4.58347e-06,3.03279e-08,0.353435,0.00162078,-4.49249e-06,1.49961e-08,0.355051,0.00161184,-4.4475e-06,2.88977e-08,0.356659,0.00160303,-4.3608e-06,1.84241e-08,0.358257,0.00159436,-4.30553e-06,1.6616e-08,0.359848,0.0015858,-4.25568e-06,3.43218e-08,0.361429,0.00157739,-4.15272e-06,-4.89172e-09,0.363002,0.00156907,-4.16739e-06,4.48498e-08,0.364567,0.00156087,-4.03284e-06,4.30676e-09,0.366124,0.00155282,-4.01992e-06,2.73303e-08,0.367673,0.00154486,-3.93793e-06,5.58036e-09,0.369214,0.001537,-3.92119e-06,3.97554e-08,0.370747,0.00152928,-3.80193e-06,-1.55904e-08,0.372272,0.00152163,-3.8487e-06,5.24081e-08,0.37379,0.00151409,-3.69147e-06,-1.52272e-08,0.375301,0.00150666,-3.73715e-06,3.83028e-08,0.376804,0.0014993,-3.62225e-06,1.10278e-08,0.378299,0.00149209,-3.58916e-06,6.99326e-09,0.379788,0.00148493,-3.56818e-06,2.06038e-08,0.381269,0.00147786,-3.50637e-06,2.98009e-08,0.382744,0.00147093,-3.41697e-06,-2.05978e-08,0.384211,0.00146404,-3.47876e-06,5.25899e-08,0.385672,0.00145724,-3.32099e-06,-1.09471e-08,0.387126,0.00145056,-3.35383e-06,2.10009e-08,0.388573,0.00144392,-3.29083e-06,1.63501e-08,0.390014,0.00143739,-3.24178e-06,3.00641e-09,0.391448,0.00143091,-3.23276e-06,3.12282e-08,0.392875,0.00142454,-3.13908e-06,-8.70932e-09,0.394297,0.00141824,-3.16521e-06,3.34114e-08,0.395712,0.00141201,-3.06497e-06,-5.72754e-09,0.397121,0.00140586,-3.08215e-06,1.9301e-08,0.398524,0.00139975,-3.02425e-06,1.7931e-08,0.39992,0.00139376,-2.97046e-06,-1.61822e-09,0.401311,0.00138781,-2.97531e-06,1.83442e-08,0.402696,0.00138192,-2.92028e-06,1.76485e-08,0.404075,0.00137613,-2.86733e-06,4.68617e-10,0.405448,0.00137039,-2.86593e-06,1.02794e-08,0.406816,0.00136469,-2.83509e-06,1.80179e-08,0.408178,0.00135908,-2.78104e-06,7.05594e-09,0.409534,0.00135354,-2.75987e-06,1.33633e-08,0.410885,0.00134806,-2.71978e-06,-9.04568e-10,0.41223,0.00134261,-2.72249e-06,2.0057e-08,0.41357,0.00133723,-2.66232e-06,1.00841e-08,0.414905,0.00133194,-2.63207e-06,-7.88835e-10,0.416234,0.00132667,-2.63444e-06,2.28734e-08,0.417558,0.00132147,-2.56582e-06,-1.29785e-09,0.418877,0.00131633,-2.56971e-06,1.21205e-08,0.420191,0.00131123,-2.53335e-06,1.24202e-08,0.421499,0.0013062,-2.49609e-06,-2.19681e-09,0.422803,0.0013012,-2.50268e-06,2.61696e-08,0.424102,0.00129628,-2.42417e-06,-1.30747e-08,0.425396,0.00129139,-2.46339e-06,2.6129e-08,0.426685,0.00128654,-2.38501e-06,-2.03454e-09,0.427969,0.00128176,-2.39111e-06,1.18115e-08,0.429248,0.00127702,-2.35567e-06,1.43932e-08,0.430523,0.00127235,-2.31249e-06,-9.77965e-09,0.431793,0.00126769,-2.34183e-06,2.47253e-08,0.433058,0.00126308,-2.26766e-06,2.85278e-10,0.434319,0.00125855,-2.2668e-06,3.93614e-09,0.435575,0.00125403,-2.25499e-06,1.37722e-08,0.436827,0.00124956,-2.21368e-06,5.79803e-10,0.438074,0.00124513,-2.21194e-06,1.37112e-08,0.439317,0.00124075,-2.1708e-06,4.17973e-09,0.440556,0.00123642,-2.15826e-06,-6.27703e-10,0.44179,0.0012321,-2.16015e-06,2.81332e-08,0.44302,0.00122787,-2.07575e-06,-2.24985e-08,0.444246,0.00122365,-2.14324e-06,3.20586e-08,0.445467,0.00121946,-2.04707e-06,-1.6329e-08,0.446685,0.00121532,-2.09605e-06,3.32573e-08,0.447898,0.00121122,-1.99628e-06,-2.72927e-08,0.449107,0.00120715,-2.07816e-06,4.6111e-08,0.450312,0.00120313,-1.93983e-06,-3.79416e-08,0.451514,0.00119914,-2.05365e-06,4.60507e-08,0.452711,0.00119517,-1.9155e-06,-2.7052e-08,0.453904,0.00119126,-1.99666e-06,3.23551e-08,0.455093,0.00118736,-1.89959e-06,-1.29613e-08,0.456279,0.00118352,-1.93848e-06,1.94905e-08,0.45746,0.0011797,-1.88e-06,-5.39588e-09,0.458638,0.00117593,-1.89619e-06,2.09282e-09,0.459812,0.00117214,-1.88991e-06,2.68267e-08,0.460982,0.00116844,-1.80943e-06,-1.99925e-08,0.462149,0.00116476,-1.86941e-06,2.3341e-08,0.463312,0.00116109,-1.79939e-06,-1.37674e-08,0.464471,0.00115745,-1.84069e-06,3.17287e-08,0.465627,0.00115387,-1.7455e-06,-2.37407e-08,0.466779,0.00115031,-1.81673e-06,3.34315e-08,0.467927,0.00114677,-1.71643e-06,-2.05786e-08,0.469073,0.00114328,-1.77817e-06,1.90802e-08,0.470214,0.00113978,-1.72093e-06,3.86247e-09,0.471352,0.00113635,-1.70934e-06,-4.72759e-09,0.472487,0.00113292,-1.72352e-06,1.50478e-08,0.473618,0.00112951,-1.67838e-06,4.14108e-09,0.474746,0.00112617,-1.66595e-06,-1.80986e-09,0.47587,0.00112283,-1.67138e-06,3.09816e-09,0.476991,0.0011195,-1.66209e-06,1.92198e-08,0.478109,0.00111623,-1.60443e-06,-2.03726e-08,0.479224,0.00111296,-1.66555e-06,3.2468e-08,0.480335,0.00110973,-1.56814e-06,-2.00922e-08,0.481443,0.00110653,-1.62842e-06,1.80983e-08,0.482548,0.00110333,-1.57413e-06,7.30362e-09,0.48365,0.0011002,-1.55221e-06,-1.75107e-08,0.484749,0.00109705,-1.60475e-06,3.29373e-08,0.485844,0.00109393,-1.50594e-06,-2.48315e-08,0.486937,0.00109085,-1.58043e-06,3.65865e-08,0.488026,0.0010878,-1.47067e-06,-3.21078e-08,0.489112,0.00108476,-1.56699e-06,3.22397e-08,0.490195,0.00108172,-1.47027e-06,-7.44391e-09,0.491276,0.00107876,-1.49261e-06,-2.46428e-09,0.492353,0.00107577,-1.5e-06,1.73011e-08,0.493427,0.00107282,-1.4481e-06,-7.13552e-09,0.494499,0.0010699,-1.4695e-06,1.1241e-08,0.495567,0.001067,-1.43578e-06,-8.02637e-09,0.496633,0.0010641,-1.45986e-06,2.08645e-08,0.497695,0.00106124,-1.39726e-06,-1.58271e-08,0.498755,0.0010584,-1.44475e-06,1.26415e-08,0.499812,0.00105555,-1.40682e-06,2.48655e-08,0.500866,0.00105281,-1.33222e-06,-5.24988e-08,0.501918,0.00104999,-1.48972e-06,6.59206e-08,0.502966,0.00104721,-1.29196e-06,-3.237e-08,0.504012,0.00104453,-1.38907e-06,3.95479e-09,0.505055,0.00104176,-1.3772e-06,1.65509e-08,0.506096,0.00103905,-1.32755e-06,-1.05539e-08,0.507133,0.00103637,-1.35921e-06,2.56648e-08,0.508168,0.00103373,-1.28222e-06,-3.25007e-08,0.509201,0.00103106,-1.37972e-06,4.47336e-08,0.51023,0.00102844,-1.24552e-06,-2.72245e-08,0.511258,0.00102587,-1.32719e-06,4.55952e-09,0.512282,0.00102323,-1.31352e-06,8.98645e-09,0.513304,0.00102063,-1.28656e-06,1.90992e-08,0.514323,0.00101811,-1.22926e-06,-2.57786e-08,0.51534,0.00101557,-1.30659e-06,2.44104e-08,0.516355,0.00101303,-1.23336e-06,-1.22581e-08,0.517366,0.00101053,-1.27014e-06,2.4622e-08,0.518376,0.00100806,-1.19627e-06,-2.66253e-08,0.519383,0.00100559,-1.27615e-06,2.22744e-08,0.520387,0.00100311,-1.20932e-06,-2.8679e-09,0.521389,0.00100068,-1.21793e-06,-1.08029e-08,0.522388,0.000998211,-1.25034e-06,4.60795e-08,0.523385,0.000995849,-1.1121e-06,-5.4306e-08,0.52438,0.000993462,-1.27502e-06,5.19354e-08,0.525372,0.000991067,-1.11921e-06,-3.42262e-08,0.526362,0.000988726,-1.22189e-06,2.53646e-08,0.52735,0.000986359,-1.14579e-06,-7.62782e-09,0.528335,0.000984044,-1.16868e-06,5.14668e-09,0.529318,0.000981722,-1.15324e-06,-1.29589e-08,0.530298,0.000979377,-1.19211e-06,4.66888e-08,0.531276,0.000977133,-1.05205e-06,-5.45868e-08,0.532252,0.000974865,-1.21581e-06,5.24495e-08,0.533226,0.000972591,-1.05846e-06,-3.60019e-08,0.534198,0.000970366,-1.16647e-06,3.19537e-08,0.535167,0.000968129,-1.07061e-06,-3.2208e-08,0.536134,0.000965891,-1.16723e-06,3.72738e-08,0.537099,0.000963668,-1.05541e-06,2.32205e-09,0.538061,0.000961564,-1.04844e-06,-4.65618e-08,0.539022,0.000959328,-1.18813e-06,6.47159e-08,0.53998,0.000957146,-9.93979e-07,-3.3488e-08,0.540936,0.000955057,-1.09444e-06,9.63166e-09,0.54189,0.000952897,-1.06555e-06,-5.03871e-09,0.542842,0.000950751,-1.08066e-06,1.05232e-08,0.543792,0.000948621,-1.04909e-06,2.25503e-08,0.544739,0.000946591,-9.81444e-07,-4.11195e-08,0.545685,0.000944504,-1.1048e-06,2.27182e-08,0.546628,0.000942363,-1.03665e-06,9.85146e-09,0.54757,0.000940319,-1.00709e-06,-2.51938e-09,0.548509,0.000938297,-1.01465e-06,2.25858e-10,0.549446,0.000936269,-1.01397e-06,1.61598e-09,0.550381,0.000934246,-1.00913e-06,-6.68983e-09,0.551315,0.000932207,-1.0292e-06,2.51434e-08,0.552246,0.000930224,-9.53765e-07,-3.42793e-08,0.553175,0.000928214,-1.0566e-06,5.23688e-08,0.554102,0.000926258,-8.99497e-07,-5.59865e-08,0.555028,0.000924291,-1.06746e-06,5.23679e-08,0.555951,0.000922313,-9.10352e-07,-3.42763e-08,0.556872,0.00092039,-1.01318e-06,2.51326e-08,0.557792,0.000918439,-9.37783e-07,-6.64954e-09,0.558709,0.000916543,-9.57732e-07,1.46554e-09,0.559625,0.000914632,-9.53335e-07,7.87281e-10,0.560538,0.000912728,-9.50973e-07,-4.61466e-09,0.56145,0.000910812,-9.64817e-07,1.76713e-08,0.56236,0.000908935,-9.11804e-07,-6.46564e-09,0.563268,0.000907092,-9.312e-07,8.19121e-09,0.564174,0.000905255,-9.06627e-07,-2.62992e-08,0.565078,0.000903362,-9.85524e-07,3.74007e-08,0.565981,0.000901504,-8.73322e-07,-4.0942e-09,0.566882,0.000899745,-8.85605e-07,-2.1024e-08,0.56778,0.00089791,-9.48677e-07,2.85854e-08,0.568677,0.000896099,-8.62921e-07,-3.3713e-08,0.569573,0.000894272,-9.64059e-07,4.6662e-08,0.570466,0.000892484,-8.24073e-07,-3.37258e-08,0.571358,0.000890734,-9.25251e-07,2.86365e-08,0.572247,0.00088897,-8.39341e-07,-2.12155e-08,0.573135,0.000887227,-9.02988e-07,-3.37913e-09,0.574022,0.000885411,-9.13125e-07,3.47319e-08,0.574906,0.000883689,-8.08929e-07,-1.63394e-08,0.575789,0.000882022,-8.57947e-07,-2.8979e-08,0.57667,0.00088022,-9.44885e-07,7.26509e-08,0.57755,0.000878548,-7.26932e-07,-8.28106e-08,0.578427,0.000876845,-9.75364e-07,7.97774e-08,0.579303,0.000875134,-7.36032e-07,-5.74849e-08,0.580178,0.00087349,-9.08486e-07,3.09529e-08,0.58105,0.000871765,-8.15628e-07,-6.72206e-09,0.581921,0.000870114,-8.35794e-07,-4.06451e-09,0.582791,0.00086843,-8.47987e-07,2.29799e-08,0.583658,0.000866803,-7.79048e-07,-2.82503e-08,0.584524,0.00086516,-8.63799e-07,3.04167e-08,0.585388,0.000863524,-7.72548e-07,-3.38119e-08,0.586251,0.000861877,-8.73984e-07,4.52264e-08,0.587112,0.000860265,-7.38305e-07,-2.78842e-08,0.587972,0.000858705,-8.21958e-07,6.70567e-09,0.58883,0.000857081,-8.01841e-07,1.06161e-09,0.589686,0.000855481,-7.98656e-07,-1.09521e-08,0.590541,0.00085385,-8.31512e-07,4.27468e-08,0.591394,0.000852316,-7.03272e-07,-4.08257e-08,0.592245,0.000850787,-8.25749e-07,1.34677e-09,0.593095,0.000849139,-8.21709e-07,3.54387e-08,0.593944,0.000847602,-7.15393e-07,-2.38924e-08,0.59479,0.0008461,-7.8707e-07,5.26143e-10,0.595636,0.000844527,-7.85491e-07,2.17879e-08,0.596479,0.000843021,-7.20127e-07,-2.80733e-08,0.597322,0.000841497,-8.04347e-07,3.09005e-08,0.598162,0.000839981,-7.11646e-07,-3.5924e-08,0.599002,0.00083845,-8.19418e-07,5.3191e-08,0.599839,0.000836971,-6.59845e-07,-5.76307e-08,0.600676,0.000835478,-8.32737e-07,5.81227e-08,0.60151,0.000833987,-6.58369e-07,-5.56507e-08,0.602344,0.000832503,-8.25321e-07,4.52706e-08,0.603175,0.000830988,-6.89509e-07,-6.22236e-09,0.604006,0.000829591,-7.08176e-07,-2.03811e-08,0.604834,0.000828113,-7.6932e-07,2.8142e-08,0.605662,0.000826659,-6.84894e-07,-3.25822e-08,0.606488,0.000825191,-7.8264e-07,4.25823e-08,0.607312,0.000823754,-6.54893e-07,-1.85376e-08,0.608135,0.000822389,-7.10506e-07,-2.80365e-08,0.608957,0.000820883,-7.94616e-07,7.1079e-08,0.609777,0.000819507,-5.81379e-07,-7.74655e-08,0.610596,0.000818112,-8.13775e-07,5.9969e-08,0.611413,0.000816665,-6.33868e-07,-4.32013e-08,0.612229,0.000815267,-7.63472e-07,5.32313e-08,0.613044,0.0008139,-6.03778e-07,-5.05148e-08,0.613857,0.000812541,-7.55323e-07,2.96187e-08,0.614669,0.000811119,-6.66466e-07,-8.35545e-09,0.615479,0.000809761,-6.91533e-07,3.80301e-09,0.616288,0.00080839,-6.80124e-07,-6.85666e-09,0.617096,0.000807009,-7.00694e-07,2.36237e-08,0.617903,0.000805678,-6.29822e-07,-2.80336e-08,0.618708,0.000804334,-7.13923e-07,2.8906e-08,0.619511,0.000802993,-6.27205e-07,-2.79859e-08,0.620314,0.000801655,-7.11163e-07,2.34329e-08,0.621114,0.000800303,-6.40864e-07,-6.14108e-09,0.621914,0.000799003,-6.59287e-07,1.13151e-09,0.622712,0.000797688,-6.55893e-07,1.61507e-09,0.62351,0.000796381,-6.51048e-07,-7.59186e-09,0.624305,0.000795056,-6.73823e-07,2.87524e-08,0.6251,0.000793794,-5.87566e-07,-4.7813e-08,0.625893,0.000792476,-7.31005e-07,4.32901e-08,0.626685,0.000791144,-6.01135e-07,-6.13814e-09,0.627475,0.000789923,-6.19549e-07,-1.87376e-08,0.628264,0.000788628,-6.75762e-07,2.14837e-08,0.629052,0.000787341,-6.11311e-07,-7.59265e-09,0.629839,0.000786095,-6.34089e-07,8.88692e-09,0.630625,0.000784854,-6.07428e-07,-2.7955e-08,0.631409,0.000783555,-6.91293e-07,4.33285e-08,0.632192,0.000782302,-5.61307e-07,-2.61497e-08,0.632973,0.000781101,-6.39757e-07,1.6658e-09,0.633754,0.000779827,-6.34759e-07,1.94866e-08,0.634533,0.000778616,-5.76299e-07,-2.00076e-08,0.635311,0.000777403,-6.36322e-07,9.39091e-10,0.636088,0.000776133,-6.33505e-07,1.62512e-08,0.636863,0.000774915,-5.84751e-07,-6.33937e-09,0.637638,0.000773726,-6.03769e-07,9.10609e-09,0.638411,0.000772546,-5.76451e-07,-3.00849e-08,0.639183,0.000771303,-6.66706e-07,5.1629e-08,0.639953,0.000770125,-5.11819e-07,-5.7222e-08,0.640723,0.000768929,-6.83485e-07,5.80497e-08,0.641491,0.000767736,-5.09336e-07,-5.57674e-08,0.642259,0.000766551,-6.76638e-07,4.58105e-08,0.643024,0.000765335,-5.39206e-07,-8.26541e-09,0.643789,0.000764231,-5.64002e-07,-1.27488e-08,0.644553,0.000763065,-6.02249e-07,-3.44168e-10,0.645315,0.00076186,-6.03281e-07,1.41254e-08,0.646077,0.000760695,-5.60905e-07,3.44727e-09,0.646837,0.000759584,-5.50563e-07,-2.79144e-08,0.647596,0.000758399,-6.34307e-07,4.86057e-08,0.648354,0.000757276,-4.88489e-07,-4.72989e-08,0.64911,0.000756158,-6.30386e-07,2.13807e-08,0.649866,0.000754961,-5.66244e-07,2.13808e-08,0.65062,0.000753893,-5.02102e-07,-4.7299e-08,0.651374,0.000752746,-6.43999e-07,4.86059e-08,0.652126,0.000751604,-4.98181e-07,-2.79154e-08,0.652877,0.000750524,-5.81927e-07,3.45089e-09,0.653627,0.000749371,-5.71575e-07,1.41119e-08,0.654376,0.00074827,-5.29239e-07,-2.93748e-10,0.655123,0.00074721,-5.3012e-07,-1.29368e-08,0.65587,0.000746111,-5.68931e-07,-7.56355e-09,0.656616,0.000744951,-5.91621e-07,4.3191e-08,0.65736,0.000743897,-4.62048e-07,-4.59911e-08,0.658103,0.000742835,-6.00022e-07,2.15642e-08,0.658846,0.0007417,-5.35329e-07,1.93389e-08,0.659587,0.000740687,-4.77312e-07,-3.93152e-08,0.660327,0.000739615,-5.95258e-07,1.87126e-08,0.661066,0.00073848,-5.3912e-07,2.40695e-08,0.661804,0.000737474,-4.66912e-07,-5.53859e-08,0.662541,0.000736374,-6.33069e-07,7.82648e-08,0.663277,0.000735343,-3.98275e-07,-7.88593e-08,0.664012,0.00073431,-6.34853e-07,5.83585e-08,0.664745,0.000733215,-4.59777e-07,-3.53656e-08,0.665478,0.000732189,-5.65874e-07,2.34994e-08,0.66621,0.000731128,-4.95376e-07,9.72743e-10,0.66694,0.00073014,-4.92458e-07,-2.73903e-08,0.66767,0.000729073,-5.74629e-07,4.89839e-08,0.668398,0.000728071,-4.27677e-07,-4.93359e-08,0.669126,0.000727068,-5.75685e-07,2.91504e-08,0.669853,0.000726004,-4.88234e-07,-7.66109e-09,0.670578,0.000725004,-5.11217e-07,1.49392e-09,0.671303,0.000723986,-5.06735e-07,1.68533e-09,0.672026,0.000722978,-5.01679e-07,-8.23525e-09,0.672749,0.00072195,-5.26385e-07,3.12556e-08,0.67347,0.000720991,-4.32618e-07,-5.71825e-08,0.674191,0.000719954,-6.04166e-07,7.8265e-08,0.67491,0.00071898,-3.69371e-07,-7.70634e-08,0.675628,0.00071801,-6.00561e-07,5.11747e-08,0.676346,0.000716963,-4.47037e-07,-8.42615e-09,0.677062,0.000716044,-4.72315e-07,-1.747e-08,0.677778,0.000715046,-5.24725e-07,1.87015e-08,0.678493,0.000714053,-4.68621e-07,2.26856e-09,0.679206,0.000713123,-4.61815e-07,-2.77758e-08,0.679919,0.000712116,-5.45142e-07,4.92298e-08,0.68063,0.000711173,-3.97453e-07,-4.99339e-08,0.681341,0.000710228,-5.47255e-07,3.12967e-08,0.682051,0.000709228,-4.53365e-07,-1.56481e-08,0.68276,0.000708274,-5.00309e-07,3.12958e-08,0.683467,0.000707367,-4.06422e-07,-4.99303e-08,0.684174,0.000706405,-5.56213e-07,4.9216e-08,0.68488,0.00070544,-4.08565e-07,-2.77245e-08,0.685585,0.00070454,-4.91738e-07,2.07748e-09,0.686289,0.000703562,-4.85506e-07,1.94146e-08,0.686992,0.00070265,-4.27262e-07,-2.01314e-08,0.687695,0.000701735,-4.87656e-07,1.50616e-09,0.688396,0.000700764,-4.83137e-07,1.41067e-08,0.689096,0.00069984,-4.40817e-07,1.67168e-09,0.689795,0.000698963,-4.35802e-07,-2.07934e-08,0.690494,0.000698029,-4.98182e-07,2.18972e-08,0.691192,0.000697099,-4.32491e-07,-7.19092e-09,0.691888,0.000696212,-4.54064e-07,6.86642e-09,0.692584,0.000695325,-4.33464e-07,-2.02747e-08,0.693279,0.000694397,-4.94288e-07,1.46279e-08,0.693973,0.000693452,-4.50405e-07,2.13678e-08,0.694666,0.000692616,-3.86301e-07,-4.04945e-08,0.695358,0.000691721,-5.07785e-07,2.14009e-08,0.696049,0.00069077,-4.43582e-07,1.44955e-08,0.69674,0.000689926,-4.00096e-07,-1.97783e-08,0.697429,0.000689067,-4.5943e-07,5.01296e-09,0.698118,0.000688163,-4.44392e-07,-2.73521e-10,0.698805,0.000687273,-4.45212e-07,-3.91893e-09,0.699492,0.000686371,-4.56969e-07,1.59493e-08,0.700178,0.000685505,-4.09121e-07,-2.73351e-10,0.700863,0.000684686,-4.09941e-07,-1.4856e-08,0.701548,0.000683822,-4.54509e-07,9.25979e-11,0.702231,0.000682913,-4.54231e-07,1.44855e-08,0.702913,0.000682048,-4.10775e-07,1.56992e-09,0.703595,0.000681231,-4.06065e-07,-2.07652e-08,0.704276,0.000680357,-4.68361e-07,2.18864e-08,0.704956,0.000679486,-4.02701e-07,-7.17595e-09,0.705635,0.000678659,-4.24229e-07,6.81748e-09,0.706313,0.000677831,-4.03777e-07,-2.0094e-08,0.70699,0.000676963,-4.64059e-07,1.39538e-08,0.707667,0.000676077,-4.22197e-07,2.38835e-08,0.708343,0.000675304,-3.50547e-07,-4.98831e-08,0.709018,0.000674453,-5.00196e-07,5.64395e-08,0.709692,0.000673622,-3.30878e-07,-5.66657e-08,0.710365,0.00067279,-5.00875e-07,5.1014e-08,0.711037,0.000671942,-3.47833e-07,-2.81809e-08,0.711709,0.000671161,-4.32376e-07,2.10513e-09,0.712379,0.000670303,-4.2606e-07,1.97604e-08,0.713049,0.00066951,-3.66779e-07,-2.15422e-08,0.713718,0.000668712,-4.31406e-07,6.8038e-09,0.714387,0.000667869,-4.10994e-07,-5.67295e-09,0.715054,0.00066703,-4.28013e-07,1.5888e-08,0.715721,0.000666222,-3.80349e-07,1.72576e-09,0.716387,0.000665467,-3.75172e-07,-2.27911e-08,0.717052,0.000664648,-4.43545e-07,2.9834e-08,0.717716,0.00066385,-3.54043e-07,-3.69401e-08,0.718379,0.000663031,-4.64864e-07,5.83219e-08,0.719042,0.000662277,-2.89898e-07,-7.71382e-08,0.719704,0.000661465,-5.21313e-07,7.14171e-08,0.720365,0.000660637,-3.07061e-07,-2.97161e-08,0.721025,0.000659934,-3.96209e-07,-1.21575e-08,0.721685,0.000659105,-4.32682e-07,1.87412e-08,0.722343,0.000658296,-3.76458e-07,-3.2029e-09,0.723001,0.000657533,-3.86067e-07,-5.9296e-09,0.723659,0.000656743,-4.03856e-07,2.69213e-08,0.724315,0.000656016,-3.23092e-07,-4.21511e-08,0.724971,0.000655244,-4.49545e-07,2.24737e-08,0.725625,0.000654412,-3.82124e-07,1.18611e-08,0.726279,0.000653683,-3.46541e-07,-1.03132e-08,0.726933,0.000652959,-3.7748e-07,-3.02128e-08,0.727585,0.000652114,-4.68119e-07,7.15597e-08,0.728237,0.000651392,-2.5344e-07,-7.72119e-08,0.728888,0.000650654,-4.85075e-07,5.8474e-08,0.729538,0.000649859,-3.09654e-07,-3.74746e-08,0.730188,0.000649127,-4.22077e-07,3.18197e-08,0.730837,0.000648379,-3.26618e-07,-3.01997e-08,0.731485,0.000647635,-4.17217e-07,2.93747e-08,0.732132,0.000646888,-3.29093e-07,-2.76943e-08,0.732778,0.000646147,-4.12176e-07,2.17979e-08,0.733424,0.000645388,-3.46783e-07,1.07292e-10,0.734069,0.000644695,-3.46461e-07,-2.22271e-08,0.734713,0.000643935,-4.13142e-07,2.91963e-08,0.735357,0.000643197,-3.25553e-07,-3.49536e-08,0.736,0.000642441,-4.30414e-07,5.10133e-08,0.736642,0.000641733,-2.77374e-07,-4.98904e-08,0.737283,0.000641028,-4.27045e-07,2.93392e-08,0.737924,0.000640262,-3.39028e-07,-7.86156e-09,0.738564,0.000639561,-3.62612e-07,2.10703e-09,0.739203,0.000638842,-3.56291e-07,-5.6653e-10,0.739842,0.000638128,-3.57991e-07,1.59086e-10,0.740479,0.000637412,-3.57513e-07,-6.98321e-11,0.741116,0.000636697,-3.57723e-07,1.20214e-10,0.741753,0.000635982,-3.57362e-07,-4.10987e-10,0.742388,0.000635266,-3.58595e-07,1.5237e-09,0.743023,0.000634553,-3.54024e-07,-5.68376e-09,0.743657,0.000633828,-3.71075e-07,2.12113e-08,0.744291,0.00063315,-3.07441e-07,-1.95569e-08,0.744924,0.000632476,-3.66112e-07,-2.58816e-09,0.745556,0.000631736,-3.73877e-07,2.99096e-08,0.746187,0.000631078,-2.84148e-07,-5.74454e-08,0.746818,0.000630337,-4.56484e-07,8.06629e-08,0.747448,0.000629666,-2.14496e-07,-8.63922e-08,0.748077,0.000628978,-4.73672e-07,8.60918e-08,0.748706,0.000628289,-2.15397e-07,-7.91613e-08,0.749334,0.000627621,-4.5288e-07,5.17393e-08,0.749961,0.00062687,-2.97663e-07,-8.58662e-09,0.750588,0.000626249,-3.23422e-07,-1.73928e-08,0.751214,0.00062555,-3.75601e-07,1.85532e-08,0.751839,0.000624855,-3.19941e-07,2.78479e-09,0.752463,0.000624223,-3.11587e-07,-2.96923e-08,0.753087,0.000623511,-4.00664e-07,5.63799e-08,0.75371,0.000622879,-2.31524e-07,-7.66179e-08,0.754333,0.000622186,-4.61378e-07,7.12778e-08,0.754955,0.000621477,-2.47545e-07,-2.96794e-08,0.755576,0.000620893,-3.36583e-07,-1.21648e-08,0.756196,0.000620183,-3.73077e-07,1.87339e-08,0.756816,0.000619493,-3.16875e-07,-3.16622e-09,0.757435,0.00061885,-3.26374e-07,-6.0691e-09,0.758054,0.000618179,-3.44581e-07,2.74426e-08,0.758672,0.000617572,-2.62254e-07,-4.40968e-08,0.759289,0.000616915,-3.94544e-07,2.97352e-08,0.759906,0.000616215,-3.05338e-07,-1.52393e-08,0.760522,0.000615559,-3.51056e-07,3.12221e-08,0.761137,0.000614951,-2.5739e-07,-5.00443e-08,0.761751,0.000614286,-4.07523e-07,4.9746e-08,0.762365,0.00061362,-2.58285e-07,-2.97303e-08,0.762979,0.000613014,-3.47476e-07,9.57079e-09,0.763591,0.000612348,-3.18764e-07,-8.55287e-09,0.764203,0.000611685,-3.44422e-07,2.46407e-08,0.764815,0.00061107,-2.705e-07,-3.04053e-08,0.765426,0.000610437,-3.61716e-07,3.73759e-08,0.766036,0.000609826,-2.49589e-07,-5.94935e-08,0.766645,0.000609149,-4.28069e-07,8.13889e-08,0.767254,0.000608537,-1.83902e-07,-8.72483e-08,0.767862,0.000607907,-4.45647e-07,8.87901e-08,0.76847,0.000607282,-1.79277e-07,-8.90983e-08,0.769077,0.000606656,-4.46572e-07,8.87892e-08,0.769683,0.000606029,-1.80204e-07,-8.72446e-08,0.770289,0.000605407,-4.41938e-07,8.13752e-08,0.770894,0.000604768,-1.97812e-07,-5.94423e-08,0.771498,0.000604194,-3.76139e-07,3.71848e-08,0.772102,0.000603553,-2.64585e-07,-2.96922e-08,0.772705,0.000602935,-3.53661e-07,2.19793e-08,0.773308,0.000602293,-2.87723e-07,1.37955e-09,0.77391,0.000601722,-2.83585e-07,-2.74976e-08,0.774512,0.000601072,-3.66077e-07,4.9006e-08,0.775112,0.000600487,-2.19059e-07,-4.93171e-08,0.775712,0.000599901,-3.67011e-07,2.90531e-08,0.776312,0.000599254,-2.79851e-07,-7.29081e-09,0.776911,0.000598673,-3.01724e-07,1.10077e-10,0.777509,0.00059807,-3.01393e-07,6.85053e-09,0.778107,0.000597487,-2.80842e-07,-2.75123e-08,0.778704,0.000596843,-3.63379e-07,4.35939e-08,0.779301,0.000596247,-2.32597e-07,-2.7654e-08,0.779897,0.000595699,-3.15559e-07,7.41741e-09,0.780492,0.00059509,-2.93307e-07,-2.01562e-09,0.781087,0.000594497,-2.99354e-07,6.45059e-10,0.781681,0.000593901,-2.97418e-07,-5.64635e-10,0.782275,0.000593304,-2.99112e-07,1.61347e-09,0.782868,0.000592711,-2.94272e-07,-5.88926e-09,0.78346,0.000592105,-3.1194e-07,2.19436e-08,0.784052,0.000591546,-2.46109e-07,-2.22805e-08,0.784643,0.000590987,-3.1295e-07,7.57368e-09,0.785234,0.000590384,-2.90229e-07,-8.01428e-09,0.785824,0.00058978,-3.14272e-07,2.44834e-08,0.786414,0.000589225,-2.40822e-07,-3.03148e-08,0.787003,0.000588652,-3.31766e-07,3.7171e-08,0.787591,0.0005881,-2.20253e-07,-5.87646e-08,0.788179,0.000587483,-3.96547e-07,7.86782e-08,0.788766,0.000586926,-1.60512e-07,-7.71342e-08,0.789353,0.000586374,-3.91915e-07,5.10444e-08,0.789939,0.000585743,-2.38782e-07,-7.83422e-09,0.790524,0.000585242,-2.62284e-07,-1.97076e-08,0.791109,0.000584658,-3.21407e-07,2.70598e-08,0.791693,0.000584097,-2.40228e-07,-2.89269e-08,0.792277,0.000583529,-3.27008e-07,2.90431e-08,0.792861,0.000582963,-2.39879e-07,-2.76409e-08,0.793443,0.0005824,-3.22802e-07,2.1916e-08,0.794025,0.00058182,-2.57054e-07,-4.18368e-10,0.794607,0.000581305,-2.58309e-07,-2.02425e-08,0.795188,0.000580727,-3.19036e-07,2.17838e-08,0.795768,0.000580155,-2.53685e-07,-7.28814e-09,0.796348,0.000579625,-2.75549e-07,7.36871e-09,0.796928,0.000579096,-2.53443e-07,-2.21867e-08,0.797506,0.000578523,-3.20003e-07,2.17736e-08,0.798085,0.000577948,-2.54683e-07,-5.30296e-09,0.798662,0.000577423,-2.70592e-07,-5.61698e-10,0.799239,0.00057688,-2.72277e-07,7.54977e-09,0.799816,0.000576358,-2.49627e-07,-2.96374e-08,0.800392,0.00057577,-3.38539e-07,5.1395e-08,0.800968,0.000575247,-1.84354e-07,-5.67335e-08,0.801543,0.000574708,-3.54555e-07,5.63297e-08,0.802117,0.000574168,-1.85566e-07,-4.93759e-08,0.802691,0.000573649,-3.33693e-07,2.19646e-08,0.803264,0.000573047,-2.678e-07,2.1122e-08,0.803837,0.000572575,-2.04433e-07,-4.68482e-08,0.804409,0.000572026,-3.44978e-07,4.70613e-08,0.804981,0.000571477,-2.03794e-07,-2.21877e-08,0.805552,0.000571003,-2.70357e-07,-1.79153e-08,0.806123,0.000570408,-3.24103e-07,3.42443e-08,0.806693,0.000569863,-2.2137e-07,1.47556e-10,0.807263,0.000569421,-2.20928e-07,-3.48345e-08,0.807832,0.000568874,-3.25431e-07,1.99812e-08,0.808401,0.000568283,-2.65487e-07,1.45143e-08,0.808969,0.000567796,-2.21945e-07,-1.84338e-08,0.809536,0.000567297,-2.77246e-07,-3.83608e-10,0.810103,0.000566741,-2.78397e-07,1.99683e-08,0.81067,0.000566244,-2.18492e-07,-1.98848e-08,0.811236,0.000565747,-2.78146e-07,-3.38976e-11,0.811801,0.000565191,-2.78248e-07,2.00204e-08,0.812366,0.000564695,-2.18187e-07,-2.04429e-08,0.812931,0.000564197,-2.79516e-07,2.1467e-09,0.813495,0.000563644,-2.73076e-07,1.18561e-08,0.814058,0.000563134,-2.37507e-07,1.00334e-08,0.814621,0.000562689,-2.07407e-07,-5.19898e-08,0.815183,0.000562118,-3.63376e-07,7.87163e-08,0.815745,0.000561627,-1.27227e-07,-8.40616e-08,0.816306,0.000561121,-3.79412e-07,7.87163e-08,0.816867,0.000560598,-1.43263e-07,-5.19898e-08,0.817428,0.000560156,-2.99233e-07,1.00335e-08,0.817988,0.000559587,-2.69132e-07,1.18559e-08,0.818547,0.000559085,-2.33564e-07,2.14764e-09,0.819106,0.000558624,-2.27122e-07,-2.04464e-08,0.819664,0.000558108,-2.88461e-07,2.00334e-08,0.820222,0.000557591,-2.28361e-07,-8.24277e-11,0.820779,0.000557135,-2.28608e-07,-1.97037e-08,0.821336,0.000556618,-2.87719e-07,1.92925e-08,0.821893,0.000556101,-2.29841e-07,2.13831e-09,0.822448,0.000555647,-2.23427e-07,-2.78458e-08,0.823004,0.000555117,-3.06964e-07,4.96402e-08,0.823559,0.000554652,-1.58043e-07,-5.15058e-08,0.824113,0.000554181,-3.12561e-07,3.71737e-08,0.824667,0.000553668,-2.0104e-07,-3.75844e-08,0.82522,0.000553153,-3.13793e-07,5.35592e-08,0.825773,0.000552686,-1.53115e-07,-5.74431e-08,0.826326,0.000552207,-3.25444e-07,5.7004e-08,0.826878,0.000551728,-1.54433e-07,-5.13635e-08,0.827429,0.000551265,-3.08523e-07,2.92406e-08,0.82798,0.000550735,-2.20801e-07,-5.99424e-09,0.828531,0.000550276,-2.38784e-07,-5.26363e-09,0.829081,0.000549782,-2.54575e-07,2.70488e-08,0.82963,0.000549354,-1.73429e-07,-4.33268e-08,0.83018,0.000548878,-3.03409e-07,2.7049e-08,0.830728,0.000548352,-2.22262e-07,-5.26461e-09,0.831276,0.000547892,-2.38056e-07,-5.99057e-09,0.831824,0.000547397,-2.56027e-07,2.92269e-08,0.832371,0.000546973,-1.68347e-07,-5.13125e-08,0.832918,0.000546482,-3.22284e-07,5.68139e-08,0.833464,0.000546008,-1.51843e-07,-5.67336e-08,0.83401,0.000545534,-3.22043e-07,5.09113e-08,0.834555,0.000545043,-1.6931e-07,-2.77022e-08,0.8351,0.000544621,-2.52416e-07,2.92924e-10,0.835644,0.000544117,-2.51537e-07,2.65305e-08,0.836188,0.000543694,-1.71946e-07,-4.68105e-08,0.836732,0.00054321,-3.12377e-07,4.15021e-08,0.837275,0.000542709,-1.87871e-07,1.13355e-11,0.837817,0.000542334,-1.87837e-07,-4.15474e-08,0.838359,0.000541833,-3.12479e-07,4.69691e-08,0.838901,0.000541349,-1.71572e-07,-2.71196e-08,0.839442,0.000540925,-2.52931e-07,1.90462e-09,0.839983,0.000540425,-2.47217e-07,1.95011e-08,0.840523,0.000539989,-1.88713e-07,-2.03045e-08,0.841063,0.00053955,-2.49627e-07,2.11216e-09,0.841602,0.000539057,-2.4329e-07,1.18558e-08,0.842141,0.000538606,-2.07723e-07,1.00691e-08,0.842679,0.000538221,-1.77516e-07,-5.21324e-08,0.843217,0.00053771,-3.33913e-07,7.92513e-08,0.843755,0.00053728,-9.6159e-08,-8.60587e-08,0.844292,0.000536829,-3.54335e-07,8.61696e-08,0.844828,0.000536379,-9.58263e-08,-7.98057e-08,0.845364,0.000535948,-3.35243e-07,5.42394e-08,0.8459,0.00053544,-1.72525e-07,-1.79426e-08,0.846435,0.000535041,-2.26353e-07,1.75308e-08,0.84697,0.000534641,-1.73761e-07,-5.21806e-08,0.847505,0.000534137,-3.30302e-07,7.19824e-08,0.848038,0.000533692,-1.14355e-07,-5.69349e-08,0.848572,0.000533293,-2.8516e-07,3.65479e-08,0.849105,0.000532832,-1.75516e-07,-2.96519e-08,0.849638,0.000532392,-2.64472e-07,2.2455e-08,0.85017,0.000531931,-1.97107e-07,-5.63451e-10,0.850702,0.000531535,-1.98797e-07,-2.02011e-08,0.851233,0.000531077,-2.59401e-07,2.17634e-08,0.851764,0.000530623,-1.94111e-07,-7.24794e-09,0.852294,0.000530213,-2.15854e-07,7.22832e-09,0.852824,0.000529803,-1.94169e-07,-2.16653e-08,0.853354,0.00052935,-2.59165e-07,1.98283e-08,0.853883,0.000528891,-1.9968e-07,1.95678e-09,0.854412,0.000528497,-1.9381e-07,-2.76554e-08,0.85494,0.000528027,-2.76776e-07,4.90603e-08,0.855468,0.00052762,-1.29596e-07,-4.93764e-08,0.855995,0.000527213,-2.77725e-07,2.92361e-08,0.856522,0.000526745,-1.90016e-07,-7.96341e-09,0.857049,0.000526341,-2.13907e-07,2.61752e-09,0.857575,0.000525922,-2.06054e-07,-2.50665e-09,0.8581,0.000525502,-2.13574e-07,7.40906e-09,0.858626,0.000525097,-1.91347e-07,-2.71296e-08,0.859151,0.000524633,-2.72736e-07,4.15048e-08,0.859675,0.000524212,-1.48221e-07,-1.96802e-08,0.860199,0.000523856,-2.07262e-07,-2.23886e-08,0.860723,0.000523375,-2.74428e-07,4.96299e-08,0.861246,0.000522975,-1.25538e-07,-5.69216e-08,0.861769,0.000522553,-2.96303e-07,5.88473e-08,0.862291,0.000522137,-1.19761e-07,-5.92584e-08,0.862813,0.00052172,-2.97536e-07,5.8977e-08,0.863334,0.000521301,-1.20605e-07,-5.74403e-08,0.863855,0.000520888,-2.92926e-07,5.15751e-08,0.864376,0.000520457,-1.38201e-07,-2.96506e-08,0.864896,0.000520091,-2.27153e-07,7.42277e-09,0.865416,0.000519659,-2.04885e-07,-4.05057e-11,0.865936,0.00051925,-2.05006e-07,-7.26074e-09,0.866455,0.000518818,-2.26788e-07,2.90835e-08,0.866973,0.000518451,-1.39538e-07,-4.94686e-08,0.867492,0.000518024,-2.87944e-07,4.95814e-08,0.868009,0.000517597,-1.39199e-07,-2.96479e-08,0.868527,0.000517229,-2.28143e-07,9.40539e-09,0.869044,0.000516801,-1.99927e-07,-7.9737e-09,0.86956,0.000516378,-2.23848e-07,2.24894e-08,0.870077,0.000515997,-1.5638e-07,-2.23793e-08,0.870592,0.000515617,-2.23517e-07,7.42302e-09,0.871108,0.000515193,-2.01248e-07,-7.31283e-09,0.871623,0.000514768,-2.23187e-07,2.18283e-08,0.872137,0.000514387,-1.57702e-07,-2.03959e-08,0.872652,0.000514011,-2.1889e-07,1.50711e-10,0.873165,0.000513573,-2.18437e-07,1.97931e-08,0.873679,0.000513196,-1.59058e-07,-1.97183e-08,0.874192,0.000512819,-2.18213e-07,-5.24324e-10,0.874704,0.000512381,-2.19786e-07,2.18156e-08,0.875217,0.000512007,-1.54339e-07,-2.71336e-08,0.875728,0.000511616,-2.3574e-07,2.71141e-08,0.87624,0.000511226,-1.54398e-07,-2.17182e-08,0.876751,0.000510852,-2.19552e-07,1.54131e-10,0.877262,0.000510414,-2.1909e-07,2.11017e-08,0.877772,0.000510039,-1.55785e-07,-2.49562e-08,0.878282,0.000509652,-2.30654e-07,1.91183e-08,0.878791,0.000509248,-1.73299e-07,8.08751e-09,0.8793,0.000508926,-1.49036e-07,-5.14684e-08,0.879809,0.000508474,-3.03441e-07,7.85766e-08,0.880317,0.000508103,-6.77112e-08,-8.40242e-08,0.880825,0.000507715,-3.19784e-07,7.87063e-08,0.881333,0.000507312,-8.36649e-08,-5.19871e-08,0.88184,0.000506988,-2.39626e-07,1.00327e-08,0.882346,0.000506539,-2.09528e-07,1.18562e-08,0.882853,0.000506156,-1.73959e-07,2.14703e-09,0.883359,0.000505814,-1.67518e-07,-2.04444e-08,0.883864,0.000505418,-2.28851e-07,2.00258e-08,0.88437,0.00050502,-1.68774e-07,-5.42855e-11,0.884874,0.000504682,-1.68937e-07,-1.98087e-08,0.885379,0.000504285,-2.28363e-07,1.96842e-08,0.885883,0.000503887,-1.6931e-07,6.76342e-10,0.886387,0.000503551,-1.67281e-07,-2.23896e-08,0.88689,0.000503149,-2.3445e-07,2.92774e-08,0.887393,0.000502768,-1.46618e-07,-3.51152e-08,0.887896,0.00050237,-2.51963e-07,5.15787e-08,0.888398,0.00050202,-9.72271e-08,-5.19903e-08,0.8889,0.00050167,-2.53198e-07,3.71732e-08,0.889401,0.000501275,-1.41678e-07,-3.70978e-08,0.889902,0.00050088,-2.52972e-07,5.16132e-08,0.890403,0.000500529,-9.81321e-08,-5.01459e-08,0.890903,0.000500183,-2.4857e-07,2.9761e-08,0.891403,0.000499775,-1.59287e-07,-9.29351e-09,0.891903,0.000499428,-1.87167e-07,7.41301e-09,0.892402,0.000499076,-1.64928e-07,-2.03585e-08,0.892901,0.000498685,-2.26004e-07,1.44165e-08,0.893399,0.000498276,-1.82754e-07,2.22974e-08,0.893898,0.000497978,-1.15862e-07,-4.40013e-08,0.894395,0.000497614,-2.47866e-07,3.44985e-08,0.894893,0.000497222,-1.44371e-07,-3.43882e-08,0.89539,0.00049683,-2.47535e-07,4.34497e-08,0.895886,0.000496465,-1.17186e-07,-2.02012e-08,0.896383,0.00049617,-1.7779e-07,-2.22497e-08,0.896879,0.000495748,-2.44539e-07,4.95952e-08,0.897374,0.000495408,-9.57532e-08,-5.69217e-08,0.89787,0.000495045,-2.66518e-07,5.88823e-08,0.898364,0.000494689,-8.98713e-08,-5.93983e-08,0.898859,0.000494331,-2.68066e-07,5.95017e-08,0.899353,0.000493973,-8.95613e-08,-5.9399e-08,0.899847,0.000493616,-2.67758e-07,5.8885e-08,0.90034,0.000493257,-9.11033e-08,-5.69317e-08,0.900833,0.000492904,-2.61898e-07,4.96326e-08,0.901326,0.000492529,-1.13001e-07,-2.23893e-08,0.901819,0.000492236,-1.80169e-07,-1.968e-08,0.902311,0.000491817,-2.39209e-07,4.15047e-08,0.902802,0.000491463,-1.14694e-07,-2.71296e-08,0.903293,0.000491152,-1.96083e-07,7.409e-09,0.903784,0.000490782,-1.73856e-07,-2.50645e-09,0.904275,0.000490427,-1.81376e-07,2.61679e-09,0.904765,0.000490072,-1.73525e-07,-7.96072e-09,0.905255,0.000489701,-1.97407e-07,2.92261e-08,0.905745,0.000489394,-1.09729e-07,-4.93389e-08,0.906234,0.000489027,-2.57746e-07,4.89204e-08,0.906723,0.000488658,-1.10985e-07,-2.71333e-08,0.907211,0.000488354,-1.92385e-07,8.30861e-12,0.907699,0.00048797,-1.9236e-07,2.71001e-08,0.908187,0.000487666,-1.1106e-07,-4.88041e-08,0.908675,0.000487298,-2.57472e-07,4.89069e-08,0.909162,0.000486929,-1.10751e-07,-2.76143e-08,0.909649,0.000486625,-1.93594e-07,1.9457e-09,0.910135,0.000486244,-1.87757e-07,1.98315e-08,0.910621,0.000485928,-1.28262e-07,-2.16671e-08,0.911107,0.000485606,-1.93264e-07,7.23216e-09,0.911592,0.000485241,-1.71567e-07,-7.26152e-09,0.912077,0.000484877,-1.93352e-07,2.18139e-08,0.912562,0.000484555,-1.2791e-07,-2.03895e-08,0.913047,0.000484238,-1.89078e-07,1.39494e-10,0.913531,0.000483861,-1.8866e-07,1.98315e-08,0.914014,0.000483543,-1.29165e-07,-1.98609e-08,0.914498,0.000483225,-1.88748e-07,7.39912e-12,0.914981,0.000482847,-1.88726e-07,1.98313e-08,0.915463,0.000482529,-1.29232e-07,-1.9728e-08,0.915946,0.000482212,-1.88416e-07,-5.24035e-10,0.916428,0.000481833,-1.89988e-07,2.18241e-08,0.916909,0.000481519,-1.24516e-07,-2.71679e-08,0.917391,0.000481188,-2.06019e-07,2.72427e-08,0.917872,0.000480858,-1.24291e-07,-2.21985e-08,0.918353,0.000480543,-1.90886e-07,1.94644e-09,0.918833,0.000480167,-1.85047e-07,1.44127e-08,0.919313,0.00047984,-1.41809e-07,7.39438e-12,0.919793,0.000479556,-1.41787e-07,-1.44423e-08,0.920272,0.000479229,-1.85114e-07,-1.84291e-09,0.920751,0.000478854,-1.90642e-07,2.18139e-08,0.92123,0.000478538,-1.25201e-07,-2.58081e-08,0.921708,0.00047821,-2.02625e-07,2.18139e-08,0.922186,0.00047787,-1.37183e-07,-1.84291e-09,0.922664,0.00047759,-1.42712e-07,-1.44423e-08,0.923141,0.000477262,-1.86039e-07,7.34701e-12,0.923618,0.00047689,-1.86017e-07,1.44129e-08,0.924095,0.000476561,-1.42778e-07,1.94572e-09,0.924572,0.000476281,-1.36941e-07,-2.21958e-08,0.925048,0.000475941,-2.03528e-07,2.72327e-08,0.925523,0.000475615,-1.2183e-07,-2.71304e-08,0.925999,0.00047529,-2.03221e-07,2.16843e-08,0.926474,0.000474949,-1.38168e-07,-2.16005e-12,0.926949,0.000474672,-1.38175e-07,-2.16756e-08,0.927423,0.000474331,-2.03202e-07,2.71001e-08,0.927897,0.000474006,-1.21902e-07,-2.71201e-08,0.928371,0.000473681,-2.03262e-07,2.17757e-08,0.928845,0.00047334,-1.37935e-07,-3.78028e-10,0.929318,0.000473063,-1.39069e-07,-2.02636e-08,0.929791,0.000472724,-1.9986e-07,2.18276e-08,0.930263,0.000472389,-1.34377e-07,-7.44231e-09,0.930736,0.000472098,-1.56704e-07,7.94165e-09,0.931208,0.000471809,-1.32879e-07,-2.43243e-08,0.931679,0.00047147,-2.05851e-07,2.97508e-08,0.932151,0.000471148,-1.16599e-07,-3.50742e-08,0.932622,0.000470809,-2.21822e-07,5.09414e-08,0.933092,0.000470518,-6.89976e-08,-4.94821e-08,0.933563,0.000470232,-2.17444e-07,2.77775e-08,0.934033,0.00046988,-1.34111e-07,-2.02351e-09,0.934502,0.000469606,-1.40182e-07,-1.96835e-08,0.934972,0.000469267,-1.99232e-07,2.11529e-08,0.935441,0.000468932,-1.35774e-07,-5.32332e-09,0.93591,0.000468644,-1.51743e-07,1.40413e-10,0.936378,0.000468341,-1.51322e-07,4.76166e-09,0.936846,0.000468053,-1.37037e-07,-1.9187e-08,0.937314,0.000467721,-1.94598e-07,1.23819e-08,0.937782,0.000467369,-1.57453e-07,2.92642e-08,0.938249,0.000467142,-6.96601e-08,-6.98342e-08,0.938716,0.000466793,-2.79163e-07,7.12586e-08,0.939183,0.000466449,-6.53869e-08,-3.63863e-08,0.939649,0.000466209,-1.74546e-07,1.46818e-08,0.940115,0.000465904,-1.305e-07,-2.2341e-08,0.940581,0.000465576,-1.97523e-07,1.50774e-08,0.941046,0.000465226,-1.52291e-07,2.16359e-08,0.941511,0.000464986,-8.73832e-08,-4.20162e-08,0.941976,0.000464685,-2.13432e-07,2.72198e-08,0.942441,0.00046434,-1.31773e-07,-7.2581e-09,0.942905,0.000464055,-1.53547e-07,1.81263e-09,0.943369,0.000463753,-1.48109e-07,7.58386e-12,0.943832,0.000463457,-1.48086e-07,-1.84298e-09,0.944296,0.000463155,-1.53615e-07,7.36433e-09,0.944759,0.00046287,-1.31522e-07,-2.76143e-08,0.945221,0.000462524,-2.14365e-07,4.34883e-08,0.945684,0.000462226,-8.39003e-08,-2.71297e-08,0.946146,0.000461977,-1.65289e-07,5.42595e-09,0.946608,0.000461662,-1.49012e-07,5.42593e-09,0.947069,0.000461381,-1.32734e-07,-2.71297e-08,0.94753,0.000461034,-2.14123e-07,4.34881e-08,0.947991,0.000460736,-8.36585e-08,-2.76134e-08,0.948452,0.000460486,-1.66499e-07,7.36083e-09,0.948912,0.000460175,-1.44416e-07,-1.82993e-09,0.949372,0.000459881,-1.49906e-07,-4.11073e-11,0.949832,0.000459581,-1.50029e-07,1.99434e-09,0.950291,0.000459287,-1.44046e-07,-7.93627e-09,0.950751,0.000458975,-1.67855e-07,2.97507e-08,0.951209,0.000458728,-7.86029e-08,-5.1462e-08,0.951668,0.000458417,-2.32989e-07,5.6888e-08,0.952126,0.000458121,-6.2325e-08,-5.68806e-08,0.952584,0.000457826,-2.32967e-07,5.14251e-08,0.953042,0.000457514,-7.86914e-08,-2.96107e-08,0.953499,0.000457268,-1.67523e-07,7.41296e-09,0.953956,0.000456955,-1.45285e-07,-4.11262e-11,0.954413,0.000456665,-1.45408e-07,-7.24847e-09,0.95487,0.000456352,-1.67153e-07,2.9035e-08,0.955326,0.000456105,-8.00484e-08,-4.92869e-08,0.955782,0.000455797,-2.27909e-07,4.89032e-08,0.956238,0.000455488,-8.11994e-08,-2.71166e-08,0.956693,0.000455244,-1.62549e-07,-4.13678e-11,0.957148,0.000454919,-1.62673e-07,2.72821e-08,0.957603,0.000454675,-8.0827e-08,-4.94824e-08,0.958057,0.000454365,-2.29274e-07,5.14382e-08,0.958512,0.000454061,-7.49597e-08,-3.7061e-08,0.958965,0.0004538,-1.86143e-07,3.72013e-08,0.959419,0.000453539,-7.45389e-08,-5.21396e-08,0.959873,0.000453234,-2.30958e-07,5.21476e-08,0.960326,0.000452928,-7.45146e-08,-3.72416e-08,0.960778,0.000452667,-1.8624e-07,3.72143e-08,0.961231,0.000452407,-7.45967e-08,-5.20109e-08,0.961683,0.000452101,-2.30629e-07,5.16199e-08,0.962135,0.000451795,-7.57696e-08,-3.52595e-08,0.962587,0.000451538,-1.81548e-07,2.98133e-08,0.963038,0.000451264,-9.2108e-08,-2.43892e-08,0.963489,0.000451007,-1.65276e-07,8.13892e-09,0.96394,0.000450701,-1.40859e-07,-8.16647e-09,0.964391,0.000450394,-1.65358e-07,2.45269e-08,0.964841,0.000450137,-9.17775e-08,-3.03367e-08,0.965291,0.000449863,-1.82787e-07,3.7215e-08,0.965741,0.000449609,-7.11424e-08,-5.89188e-08,0.96619,0.00044929,-2.47899e-07,7.92509e-08,0.966639,0.000449032,-1.01462e-08,-7.92707e-08,0.967088,0.000448773,-2.47958e-07,5.90181e-08,0.967537,0.000448455,-7.0904e-08,-3.75925e-08,0.967985,0.0004482,-1.83681e-07,3.17471e-08,0.968433,0.000447928,-8.84401e-08,-2.97913e-08,0.968881,0.000447662,-1.77814e-07,2.78133e-08,0.969329,0.000447389,-9.4374e-08,-2.18572e-08,0.969776,0.000447135,-1.59946e-07,1.10134e-11,0.970223,0.000446815,-1.59913e-07,2.18132e-08,0.97067,0.000446561,-9.44732e-08,-2.76591e-08,0.971116,0.000446289,-1.7745e-07,2.92185e-08,0.971562,0.000446022,-8.97948e-08,-2.96104e-08,0.972008,0.000445753,-1.78626e-07,2.96185e-08,0.972454,0.000445485,-8.97706e-08,-2.92588e-08,0.972899,0.000445218,-1.77547e-07,2.78123e-08,0.973344,0.000444946,-9.41103e-08,-2.23856e-08,0.973789,0.000444691,-1.61267e-07,2.12559e-09,0.974233,0.000444374,-1.5489e-07,1.38833e-08,0.974678,0.000444106,-1.13241e-07,1.94591e-09,0.975122,0.000443886,-1.07403e-07,-2.16669e-08,0.975565,0.000443606,-1.72404e-07,2.5117e-08,0.976009,0.000443336,-9.70526e-08,-1.91963e-08,0.976452,0.000443085,-1.54642e-07,-7.93627e-09,0.976895,0.000442752,-1.7845e-07,5.09414e-08,0.977338,0.000442548,-2.56262e-08,-7.66201e-08,0.97778,0.000442266,-2.55486e-07,7.67249e-08,0.978222,0.000441986,-2.53118e-08,-5.14655e-08,0.978664,0.000441781,-1.79708e-07,9.92773e-09,0.979106,0.000441451,-1.49925e-07,1.17546e-08,0.979547,0.000441186,-1.14661e-07,2.65868e-09,0.979988,0.000440965,-1.06685e-07,-2.23893e-08,0.980429,0.000440684,-1.73853e-07,2.72939e-08,0.980869,0.000440419,-9.19716e-08,-2.71816e-08,0.98131,0.000440153,-1.73516e-07,2.18278e-08,0.98175,0.000439872,-1.08033e-07,-5.24833e-10,0.982189,0.000439654,-1.09607e-07,-1.97284e-08,0.982629,0.000439376,-1.68793e-07,1.98339e-08,0.983068,0.000439097,-1.09291e-07,-2.62901e-12,0.983507,0.000438879,-1.09299e-07,-1.98234e-08,0.983946,0.000438601,-1.68769e-07,1.96916e-08,0.984384,0.000438322,-1.09694e-07,6.6157e-10,0.984823,0.000438105,-1.0771e-07,-2.23379e-08,0.985261,0.000437823,-1.74723e-07,2.90855e-08,0.985698,0.00043756,-8.74669e-08,-3.43992e-08,0.986136,0.000437282,-1.90665e-07,4.89068e-08,0.986573,0.000437048,-4.39442e-08,-4.20188e-08,0.98701,0.000436834,-1.7e-07,-4.11073e-11,0.987446,0.000436494,-1.70124e-07,4.21832e-08,0.987883,0.00043628,-4.35742e-08,-4.94824e-08,0.988319,0.000436044,-1.92021e-07,3.6537e-08,0.988755,0.00043577,-8.24102e-08,-3.70611e-08,0.989191,0.000435494,-1.93593e-07,5.21026e-08,0.989626,0.000435263,-3.72855e-08,-5.21402e-08,0.990061,0.000435032,-1.93706e-07,3.7249e-08,0.990496,0.000434756,-8.19592e-08,-3.72512e-08,0.990931,0.000434481,-1.93713e-07,5.21511e-08,0.991365,0.00043425,-3.72595e-08,-5.21439e-08,0.991799,0.000434019,-1.93691e-07,3.72152e-08,0.992233,0.000433743,-8.20456e-08,-3.71123e-08,0.992667,0.000433468,-1.93382e-07,5.16292e-08,0.9931,0.000433236,-3.84947e-08,-5.01953e-08,0.993533,0.000433008,-1.89081e-07,2.99427e-08,0.993966,0.00043272,-9.92525e-08,-9.9708e-09,0.994399,0.000432491,-1.29165e-07,9.94051e-09,0.994831,0.000432263,-9.93434e-08,-2.97912e-08,0.995263,0.000431975,-1.88717e-07,4.96198e-08,0.995695,0.000431746,-3.98578e-08,-4.94785e-08,0.996127,0.000431518,-1.88293e-07,2.9085e-08,0.996558,0.000431229,-1.01038e-07,-7.25675e-09,0.996989,0.000431005,-1.22809e-07,-5.79945e-11,0.99742,0.000430759,-1.22983e-07,7.48873e-09,0.997851,0.000430536,-1.00516e-07,-2.98969e-08,0.998281,0.000430245,-1.90207e-07,5.24942e-08,0.998711,0.000430022,-3.27246e-08,-6.08706e-08,0.999141,0.000429774,-2.15336e-07,7.17788e-08,0.999571,0.000429392,0.,0.}; - - template - __device__ __forceinline__ void Lab2RGBConvert_f(const T& src, D& dst) - { - const float lThresh = 0.008856f * 903.3f; - const float fThresh = 7.787f * 0.008856f + 16.0f / 116.0f; - - float Y, fy; - - if (src.x <= lThresh) - { - Y = src.x / 903.3f; - fy = 7.787f * Y + 16.0f / 116.0f; - } - else - { - fy = (src.x + 16.0f) / 116.0f; - Y = fy * fy * fy; - } - - float X = src.y / 500.0f + fy; - float Z = fy - src.z / 200.0f; - - if (X <= fThresh) - X = (X - 16.0f / 116.0f) / 7.787f; - else - X = X * X * X; - - if (Z <= fThresh) - Z = (Z - 16.0f / 116.0f) / 7.787f; - else - Z = Z * Z * Z; - - float B = 0.052891f * X - 0.204043f * Y + 1.151152f * Z; - float G = -0.921235f * X + 1.875991f * Y + 0.045244f * Z; - float R = 3.079933f * X - 1.537150f * Y - 0.542782f * Z; - - if (srgb) - { - B = splineInterpolate(B * GAMMA_TAB_SIZE, c_sRGBInvGammaTab, GAMMA_TAB_SIZE); - G = splineInterpolate(G * GAMMA_TAB_SIZE, c_sRGBInvGammaTab, GAMMA_TAB_SIZE); - R = splineInterpolate(R * GAMMA_TAB_SIZE, c_sRGBInvGammaTab, GAMMA_TAB_SIZE); - } - - dst.x = blueIdx == 0 ? B : R; - dst.y = G; - dst.z = blueIdx == 0 ? R : B; - setAlpha(dst, ColorChannel::max()); - } - - template - __device__ __forceinline__ void Lab2RGBConvert_b(const T& src, D& dst) - { - float3 srcf, dstf; - - srcf.x = src.x * (100.f / 255.f); - srcf.y = src.y - 128; - srcf.z = src.z - 128; - - Lab2RGBConvert_f(srcf, dstf); - - dst.x = saturate_cast(dstf.x * 255.f); - dst.y = saturate_cast(dstf.y * 255.f); - dst.z = saturate_cast(dstf.z * 255.f); - setAlpha(dst, ColorChannel::max()); - } - - template struct Lab2RGB; - template - struct Lab2RGB - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator ()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - Lab2RGBConvert_b(src, dst); - - return dst; - } - __host__ __device__ __forceinline__ Lab2RGB() {} - __host__ __device__ __forceinline__ Lab2RGB(const Lab2RGB&) {} - }; - template - struct Lab2RGB - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator ()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - Lab2RGBConvert_f(src, dst); - - return dst; - } - __host__ __device__ __forceinline__ Lab2RGB() {} - __host__ __device__ __forceinline__ Lab2RGB(const Lab2RGB&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_Lab2RGB_TRAITS(name, scn, dcn, srgb, blueIdx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::Lab2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - -///////////////////////////////////// RGB <-> Luv ///////////////////////////////////// - - namespace color_detail - { - __constant__ float c_LabCbrtTab[] = {0.137931,0.0114066,0.,1.18859e-07,0.149338,0.011407,3.56578e-07,-5.79396e-07,0.160745,0.0114059,-1.38161e-06,2.16892e-06,0.172151,0.0114097,5.12516e-06,-8.0814e-06,0.183558,0.0113957,-1.9119e-05,3.01567e-05,0.194965,0.0114479,7.13509e-05,-0.000112545,0.206371,0.011253,-0.000266285,-0.000106493,0.217252,0.0104009,-0.000585765,7.32149e-05,0.22714,0.00944906,-0.00036612,1.21917e-05,0.236235,0.0087534,-0.000329545,2.01753e-05,0.244679,0.00815483,-0.000269019,1.24435e-05,0.252577,0.00765412,-0.000231689,1.05618e-05,0.26001,0.00722243,-0.000200003,8.26662e-06,0.267041,0.00684723,-0.000175203,6.76746e-06,0.27372,0.00651712,-0.000154901,5.61192e-06,0.280088,0.00622416,-0.000138065,4.67009e-06,0.286179,0.00596204,-0.000124055,3.99012e-06,0.292021,0.0057259,-0.000112085,3.36032e-06,0.297638,0.00551181,-0.000102004,2.95338e-06,0.30305,0.00531666,-9.31435e-05,2.52875e-06,0.308277,0.00513796,-8.55572e-05,2.22022e-06,0.313331,0.00497351,-7.88966e-05,1.97163e-06,0.318228,0.00482163,-7.29817e-05,1.7248e-06,0.322978,0.00468084,-6.78073e-05,1.55998e-06,0.327593,0.0045499,-6.31274e-05,1.36343e-06,0.332081,0.00442774,-5.90371e-05,1.27136e-06,0.336451,0.00431348,-5.5223e-05,1.09111e-06,0.34071,0.00420631,-5.19496e-05,1.0399e-06,0.344866,0.00410553,-4.88299e-05,9.18347e-07,0.348923,0.00401062,-4.60749e-05,8.29942e-07,0.352889,0.00392096,-4.35851e-05,7.98478e-07,0.356767,0.00383619,-4.11896e-05,6.84917e-07,0.360562,0.00375586,-3.91349e-05,6.63976e-07,0.36428,0.00367959,-3.7143e-05,5.93086e-07,0.367923,0.00360708,-3.53637e-05,5.6976e-07,0.371495,0.00353806,-3.36544e-05,4.95533e-07,0.375,0.00347224,-3.21678e-05,4.87951e-07,0.378441,0.00340937,-3.0704e-05,4.4349e-07,0.38182,0.00334929,-2.93735e-05,4.20297e-07,0.38514,0.0032918,-2.81126e-05,3.7872e-07,0.388404,0.00323671,-2.69764e-05,3.596e-07,0.391614,0.00318384,-2.58976e-05,3.5845e-07,0.394772,0.00313312,-2.48223e-05,2.92765e-07,0.397881,0.00308435,-2.3944e-05,3.18232e-07,0.400942,0.00303742,-2.29893e-05,2.82046e-07,0.403957,0.00299229,-2.21432e-05,2.52315e-07,0.406927,0.00294876,-2.13862e-05,2.58416e-07,0.409855,0.00290676,-2.0611e-05,2.33939e-07,0.412741,0.00286624,-1.99092e-05,2.36342e-07,0.415587,0.00282713,-1.92001e-05,1.916e-07,0.418396,0.00278931,-1.86253e-05,2.1915e-07,0.421167,0.00275271,-1.79679e-05,1.83498e-07,0.423901,0.00271733,-1.74174e-05,1.79343e-07,0.426602,0.00268303,-1.68794e-05,1.72013e-07,0.429268,0.00264979,-1.63633e-05,1.75686e-07,0.431901,0.00261759,-1.58363e-05,1.3852e-07,0.434503,0.00258633,-1.54207e-05,1.64304e-07,0.437074,0.00255598,-1.49278e-05,1.28136e-07,0.439616,0.00252651,-1.45434e-05,1.57618e-07,0.442128,0.0024979,-1.40705e-05,1.0566e-07,0.444612,0.00247007,-1.37535e-05,1.34998e-07,0.447068,0.00244297,-1.33485e-05,1.29207e-07,0.449498,0.00241666,-1.29609e-05,9.32347e-08,0.451902,0.00239102,-1.26812e-05,1.23703e-07,0.45428,0.00236603,-1.23101e-05,9.74072e-08,0.456634,0.0023417,-1.20179e-05,1.12518e-07,0.458964,0.002318,-1.16803e-05,7.83681e-08,0.46127,0.00229488,-1.14452e-05,1.10452e-07,0.463554,0.00227232,-1.11139e-05,7.58719e-08,0.465815,0.00225032,-1.08863e-05,9.2699e-08,0.468055,0.00222882,-1.06082e-05,8.97738e-08,0.470273,0.00220788,-1.03388e-05,5.4845e-08,0.47247,0.00218736,-1.01743e-05,1.0808e-07,0.474648,0.00216734,-9.85007e-06,4.9277e-08,0.476805,0.00214779,-9.70224e-06,8.22408e-08,0.478943,0.00212863,-9.45551e-06,6.87942e-08,0.481063,0.00210993,-9.24913e-06,5.98144e-08,0.483163,0.00209161,-9.06969e-06,7.93789e-08,0.485246,0.00207371,-8.83155e-06,3.99032e-08,0.487311,0.00205616,-8.71184e-06,8.88325e-08,0.489358,0.002039,-8.44534e-06,2.20004e-08,0.491389,0.00202218,-8.37934e-06,9.13872e-08,0.493403,0.0020057,-8.10518e-06,2.96829e-08,0.495401,0.00198957,-8.01613e-06,5.81028e-08,0.497382,0.00197372,-7.84183e-06,6.5731e-08,0.499348,0.00195823,-7.64463e-06,3.66019e-08,0.501299,0.00194305,-7.53483e-06,2.62811e-08,0.503234,0.00192806,-7.45598e-06,9.66907e-08,0.505155,0.00191344,-7.16591e-06,4.18928e-09,0.507061,0.00189912,-7.15334e-06,6.53665e-08,0.508953,0.00188501,-6.95724e-06,3.23686e-08,0.510831,0.00187119,-6.86014e-06,4.35774e-08,0.512696,0.0018576,-6.72941e-06,3.17406e-08,0.514547,0.00184424,-6.63418e-06,6.78785e-08,0.516384,0.00183117,-6.43055e-06,-5.23126e-09,0.518209,0.0018183,-6.44624e-06,7.22562e-08,0.520021,0.00180562,-6.22947e-06,1.42292e-08,0.52182,0.0017932,-6.18679e-06,4.9641e-08,0.523607,0.00178098,-6.03786e-06,2.56259e-08,0.525382,0.00176898,-5.96099e-06,2.66696e-08,0.527145,0.00175714,-5.88098e-06,4.65094e-08,0.528897,0.00174552,-5.74145e-06,2.57114e-08,0.530637,0.00173411,-5.66431e-06,2.94588e-08,0.532365,0.00172287,-5.57594e-06,3.52667e-08,0.534082,0.00171182,-5.47014e-06,8.28868e-09,0.535789,0.00170091,-5.44527e-06,5.07871e-08,0.537484,0.00169017,-5.29291e-06,2.69817e-08,0.539169,0.00167967,-5.21197e-06,2.01009e-08,0.540844,0.0016693,-5.15166e-06,1.18237e-08,0.542508,0.00165903,-5.11619e-06,5.18135e-08,0.544162,0.00164896,-4.96075e-06,1.9341e-08,0.545806,0.00163909,-4.90273e-06,-9.96867e-09,0.54744,0.00162926,-4.93263e-06,8.01382e-08,0.549064,0.00161963,-4.69222e-06,-1.25601e-08,0.550679,0.00161021,-4.7299e-06,2.97067e-08,0.552285,0.00160084,-4.64078e-06,1.29426e-08,0.553881,0.0015916,-4.60195e-06,3.77327e-08,0.555468,0.00158251,-4.48875e-06,1.49412e-08,0.557046,0.00157357,-4.44393e-06,2.17118e-08,0.558615,0.00156475,-4.3788e-06,1.74206e-08,0.560176,0.00155605,-4.32653e-06,2.78152e-08,0.561727,0.00154748,-4.24309e-06,-9.47239e-09,0.563271,0.00153896,-4.27151e-06,6.9679e-08,0.564805,0.00153063,-4.06247e-06,-3.08246e-08,0.566332,0.00152241,-4.15494e-06,5.36188e-08,0.56785,0.00151426,-3.99409e-06,-4.83594e-09,0.56936,0.00150626,-4.00859e-06,2.53293e-08,0.570863,0.00149832,-3.93261e-06,2.27286e-08,0.572357,0.00149052,-3.86442e-06,2.96541e-09,0.573844,0.0014828,-3.85552e-06,2.50147e-08,0.575323,0.00147516,-3.78048e-06,1.61842e-08,0.576794,0.00146765,-3.73193e-06,2.94582e-08,0.578258,0.00146028,-3.64355e-06,-1.48076e-08,0.579715,0.00145295,-3.68798e-06,2.97724e-08,0.581164,0.00144566,-3.59866e-06,1.49272e-08,0.582606,0.00143851,-3.55388e-06,2.97285e-08,0.584041,0.00143149,-3.46469e-06,-1.46323e-08,0.585469,0.00142451,-3.50859e-06,2.88004e-08,0.58689,0.00141758,-3.42219e-06,1.864e-08,0.588304,0.00141079,-3.36627e-06,1.58482e-08,0.589712,0.00140411,-3.31872e-06,-2.24279e-08,0.591112,0.00139741,-3.38601e-06,7.38639e-08,0.592507,0.00139085,-3.16441e-06,-3.46088e-08,0.593894,0.00138442,-3.26824e-06,4.96675e-09,0.595275,0.0013779,-3.25334e-06,7.4346e-08,0.59665,0.00137162,-3.0303e-06,-6.39319e-08,0.598019,0.00136536,-3.2221e-06,6.21725e-08,0.599381,0.00135911,-3.03558e-06,-5.94423e-09,0.600737,0.00135302,-3.05341e-06,2.12091e-08,0.602087,0.00134697,-2.98979e-06,-1.92876e-08,0.603431,0.00134094,-3.04765e-06,5.5941e-08,0.604769,0.00133501,-2.87983e-06,-2.56622e-08,0.606101,0.00132917,-2.95681e-06,4.67078e-08,0.607427,0.0013234,-2.81669e-06,-4.19592e-08,0.608748,0.00131764,-2.94257e-06,6.15243e-08,0.610062,0.00131194,-2.75799e-06,-2.53244e-08,0.611372,0.00130635,-2.83397e-06,3.97739e-08,0.612675,0.0013008,-2.71465e-06,-1.45618e-08,0.613973,0.00129533,-2.75833e-06,1.84733e-08,0.615266,0.00128986,-2.70291e-06,2.73606e-10,0.616553,0.00128446,-2.70209e-06,4.00367e-08,0.617835,0.00127918,-2.58198e-06,-4.12113e-08,0.619111,0.00127389,-2.70561e-06,6.52039e-08,0.620383,0.00126867,-2.51e-06,-4.07901e-08,0.621649,0.00126353,-2.63237e-06,3.83516e-08,0.62291,0.00125838,-2.51732e-06,6.59315e-09,0.624166,0.00125337,-2.49754e-06,-5.11939e-09,0.625416,0.00124836,-2.5129e-06,1.38846e-08,0.626662,0.00124337,-2.47124e-06,9.18514e-09,0.627903,0.00123846,-2.44369e-06,8.97952e-09,0.629139,0.0012336,-2.41675e-06,1.45012e-08,0.63037,0.00122881,-2.37325e-06,-7.37949e-09,0.631597,0.00122404,-2.39538e-06,1.50169e-08,0.632818,0.00121929,-2.35033e-06,6.91648e-09,0.634035,0.00121461,-2.32958e-06,1.69219e-08,0.635248,0.00121,-2.27882e-06,-1.49997e-08,0.636455,0.0012054,-2.32382e-06,4.30769e-08,0.637659,0.00120088,-2.19459e-06,-3.80986e-08,0.638857,0.00119638,-2.30888e-06,4.97134e-08,0.640051,0.00119191,-2.15974e-06,-4.15463e-08,0.641241,0.00118747,-2.28438e-06,5.68667e-08,0.642426,0.00118307,-2.11378e-06,-7.10641e-09,0.643607,0.00117882,-2.1351e-06,-2.8441e-08,0.644784,0.00117446,-2.22042e-06,6.12658e-08,0.645956,0.00117021,-2.03663e-06,-3.78083e-08,0.647124,0.00116602,-2.15005e-06,3.03627e-08,0.648288,0.00116181,-2.05896e-06,-2.40379e-08,0.649448,0.00115762,-2.13108e-06,6.57887e-08,0.650603,0.00115356,-1.93371e-06,-6.03028e-08,0.651755,0.00114951,-2.11462e-06,5.62134e-08,0.652902,0.00114545,-1.94598e-06,-4.53417e-08,0.654046,0.00114142,-2.082e-06,6.55489e-08,0.655185,0.00113745,-1.88536e-06,-3.80396e-08,0.656321,0.00113357,-1.99948e-06,2.70049e-08,0.657452,0.00112965,-1.91846e-06,-1.03755e-08,0.65858,0.00112578,-1.94959e-06,1.44973e-08,0.659704,0.00112192,-1.9061e-06,1.1991e-08,0.660824,0.00111815,-1.87012e-06,-2.85634e-09,0.66194,0.0011144,-1.87869e-06,-5.65782e-10,0.663053,0.00111064,-1.88039e-06,5.11947e-09,0.664162,0.0011069,-1.86503e-06,3.96924e-08,0.665267,0.00110328,-1.74595e-06,-4.46795e-08,0.666368,0.00109966,-1.87999e-06,1.98161e-08,0.667466,0.00109596,-1.82054e-06,2.502e-08,0.66856,0.00109239,-1.74548e-06,-6.86593e-10,0.669651,0.0010889,-1.74754e-06,-2.22739e-08,0.670738,0.00108534,-1.81437e-06,3.01776e-08,0.671821,0.0010818,-1.72383e-06,2.07732e-08,0.672902,0.00107841,-1.66151e-06,-5.36658e-08,0.673978,0.00107493,-1.82251e-06,7.46802e-08,0.675051,0.00107151,-1.59847e-06,-6.62411e-08,0.676121,0.00106811,-1.79719e-06,7.10748e-08,0.677188,0.00106473,-1.58397e-06,-3.92441e-08,0.678251,0.00106145,-1.7017e-06,2.62973e-08,0.679311,0.00105812,-1.62281e-06,-6.34035e-09,0.680367,0.00105486,-1.64183e-06,-9.36249e-10,0.68142,0.00105157,-1.64464e-06,1.00854e-08,0.68247,0.00104831,-1.61438e-06,2.01995e-08,0.683517,0.00104514,-1.55378e-06,-3.1279e-08,0.68456,0.00104194,-1.64762e-06,4.53114e-08,0.685601,0.00103878,-1.51169e-06,-3.07573e-08,0.686638,0.00103567,-1.60396e-06,1.81133e-08,0.687672,0.00103251,-1.54962e-06,1.79085e-08,0.688703,0.00102947,-1.49589e-06,-3.01428e-08,0.689731,0.00102639,-1.58632e-06,4.30583e-08,0.690756,0.00102334,-1.45715e-06,-2.28814e-08,0.691778,0.00102036,-1.52579e-06,-1.11373e-08,0.692797,0.00101727,-1.5592e-06,6.74305e-08,0.693812,0.00101436,-1.35691e-06,-7.97709e-08,0.694825,0.0010114,-1.59622e-06,7.28391e-08,0.695835,0.00100843,-1.37771e-06,-3.27715e-08,0.696842,0.00100558,-1.47602e-06,-1.35807e-09,0.697846,0.00100262,-1.48009e-06,3.82037e-08,0.698847,0.000999775,-1.36548e-06,-3.22474e-08,0.699846,0.000996948,-1.46223e-06,3.11809e-08,0.700841,0.000994117,-1.36868e-06,-3.28714e-08,0.701834,0.000991281,-1.4673e-06,4.07001e-08,0.702824,0.000988468,-1.3452e-06,-1.07197e-08,0.703811,0.000985746,-1.37736e-06,2.17866e-09,0.704795,0.000982998,-1.37082e-06,2.00521e-09,0.705777,0.000980262,-1.3648e-06,-1.01996e-08,0.706756,0.000977502,-1.3954e-06,3.87931e-08,0.707732,0.000974827,-1.27902e-06,-2.57632e-08,0.708706,0.000972192,-1.35631e-06,4.65513e-09,0.709676,0.000969493,-1.34235e-06,7.14257e-09,0.710645,0.00096683,-1.32092e-06,2.63791e-08,0.71161,0.000964267,-1.24178e-06,-5.30543e-08,0.712573,0.000961625,-1.40095e-06,6.66289e-08,0.713533,0.000959023,-1.20106e-06,-3.46474e-08,0.714491,0.000956517,-1.305e-06,1.23559e-08,0.715446,0.000953944,-1.26793e-06,-1.47763e-08,0.716399,0.000951364,-1.31226e-06,4.67494e-08,0.717349,0.000948879,-1.17201e-06,-5.3012e-08,0.718297,0.000946376,-1.33105e-06,4.60894e-08,0.719242,0.000943852,-1.19278e-06,-1.21366e-08,0.720185,0.00094143,-1.22919e-06,2.45673e-09,0.721125,0.000938979,-1.22182e-06,2.30966e-09,0.722063,0.000936543,-1.21489e-06,-1.16954e-08,0.722998,0.000934078,-1.24998e-06,4.44718e-08,0.723931,0.000931711,-1.11656e-06,-4.69823e-08,0.724861,0.000929337,-1.25751e-06,2.4248e-08,0.725789,0.000926895,-1.18477e-06,9.5949e-09,0.726715,0.000924554,-1.15598e-06,-3.02286e-09,0.727638,0.000922233,-1.16505e-06,2.49649e-09,0.72856,0.00091991,-1.15756e-06,-6.96321e-09,0.729478,0.000917575,-1.17845e-06,2.53564e-08,0.730395,0.000915294,-1.10238e-06,-3.48578e-08,0.731309,0.000912984,-1.20695e-06,5.44704e-08,0.732221,0.000910734,-1.04354e-06,-6.38144e-08,0.73313,0.000908455,-1.23499e-06,8.15781e-08,0.734038,0.00090623,-9.90253e-07,-8.3684e-08,0.734943,0.000903999,-1.2413e-06,7.43441e-08,0.735846,0.000901739,-1.01827e-06,-3.48787e-08,0.736746,0.000899598,-1.12291e-06,5.56596e-09,0.737645,0.000897369,-1.10621e-06,1.26148e-08,0.738541,0.000895194,-1.06837e-06,3.57935e-09,0.739435,0.000893068,-1.05763e-06,-2.69322e-08,0.740327,0.000890872,-1.13842e-06,4.45448e-08,0.741217,0.000888729,-1.00479e-06,-3.20376e-08,0.742105,0.000886623,-1.1009e-06,2.40011e-08,0.74299,0.000884493,-1.0289e-06,-4.36209e-09,0.743874,0.000882422,-1.04199e-06,-6.55268e-09,0.744755,0.000880319,-1.06164e-06,3.05728e-08,0.745634,0.000878287,-9.69926e-07,-5.61338e-08,0.746512,0.000876179,-1.13833e-06,7.4753e-08,0.747387,0.000874127,-9.14068e-07,-6.40644e-08,0.74826,0.000872106,-1.10626e-06,6.22955e-08,0.749131,0.000870081,-9.19375e-07,-6.59083e-08,0.75,0.000868044,-1.1171e-06,8.21284e-08,0.750867,0.000866056,-8.70714e-07,-8.37915e-08,0.751732,0.000864064,-1.12209e-06,7.42237e-08,0.752595,0.000862042,-8.99418e-07,-3.42894e-08,0.753456,0.00086014,-1.00229e-06,3.32955e-09,0.754315,0.000858146,-9.92297e-07,2.09712e-08,0.755173,0.000856224,-9.29384e-07,-2.76096e-08,0.756028,0.000854282,-1.01221e-06,2.98627e-08,0.756881,0.000852348,-9.22625e-07,-3.22365e-08,0.757733,0.000850406,-1.01933e-06,3.94786e-08,0.758582,0.000848485,-9.00898e-07,-6.46833e-09,0.75943,0.000846664,-9.20303e-07,-1.36052e-08,0.760275,0.000844783,-9.61119e-07,1.28447e-09,0.761119,0.000842864,-9.57266e-07,8.4674e-09,0.761961,0.000840975,-9.31864e-07,2.44506e-08,0.762801,0.000839185,-8.58512e-07,-4.6665e-08,0.763639,0.000837328,-9.98507e-07,4.30001e-08,0.764476,0.00083546,-8.69507e-07,-6.12609e-09,0.76531,0.000833703,-8.87885e-07,-1.84959e-08,0.766143,0.000831871,-9.43372e-07,2.05052e-08,0.766974,0.000830046,-8.81857e-07,-3.92026e-09,0.767803,0.000828271,-8.93618e-07,-4.82426e-09,0.768631,0.000826469,-9.0809e-07,2.32172e-08,0.769456,0.000824722,-8.38439e-07,-2.84401e-08,0.77028,0.00082296,-9.23759e-07,3.09386e-08,0.771102,0.000821205,-8.30943e-07,-3.57099e-08,0.771922,0.000819436,-9.38073e-07,5.22963e-08,0.772741,0.000817717,-7.81184e-07,-5.42658e-08,0.773558,0.000815992,-9.43981e-07,4.55579e-08,0.774373,0.000814241,-8.07308e-07,-8.75656e-09,0.775186,0.0008126,-8.33578e-07,-1.05315e-08,0.775998,0.000810901,-8.65172e-07,-8.72188e-09,0.776808,0.000809145,-8.91338e-07,4.54191e-08,0.777616,0.000807498,-7.5508e-07,-5.37454e-08,0.778423,0.000805827,-9.16317e-07,5.03532e-08,0.779228,0.000804145,-7.65257e-07,-2.84584e-08,0.780031,0.000802529,-8.50632e-07,3.87579e-09,0.780833,0.00080084,-8.39005e-07,1.29552e-08,0.781633,0.0007992,-8.00139e-07,3.90804e-09,0.782432,0.000797612,-7.88415e-07,-2.85874e-08,0.783228,0.000795949,-8.74177e-07,5.0837e-08,0.784023,0.000794353,-7.21666e-07,-5.55513e-08,0.784817,0.000792743,-8.8832e-07,5.21587e-08,0.785609,0.000791123,-7.31844e-07,-3.38744e-08,0.786399,0.000789558,-8.33467e-07,2.37342e-08,0.787188,0.000787962,-7.62264e-07,-1.45775e-09,0.787975,0.000786433,-7.66638e-07,-1.79034e-08,0.788761,0.000784846,-8.20348e-07,1.34665e-08,0.789545,0.000783246,-7.79948e-07,2.3642e-08,0.790327,0.000781757,-7.09022e-07,-4.84297e-08,0.791108,0.000780194,-8.54311e-07,5.08674e-08,0.791888,0.000778638,-7.01709e-07,-3.58303e-08,0.792666,0.000777127,-8.092e-07,3.28493e-08,0.793442,0.000775607,-7.10652e-07,-3.59624e-08,0.794217,0.000774078,-8.1854e-07,5.13959e-08,0.79499,0.000772595,-6.64352e-07,-5.04121e-08,0.795762,0.000771115,-8.15588e-07,3.10431e-08,0.796532,0.000769577,-7.22459e-07,-1.41557e-08,0.797301,0.00076809,-7.64926e-07,2.55795e-08,0.798069,0.000766636,-6.88187e-07,-2.85578e-08,0.798835,0.000765174,-7.73861e-07,2.90472e-08,0.799599,0.000763714,-6.86719e-07,-2.80262e-08,0.800362,0.000762256,-7.70798e-07,2.34531e-08,0.801123,0.000760785,-7.00438e-07,-6.18144e-09,0.801884,0.000759366,-7.18983e-07,1.27263e-09,0.802642,0.000757931,-7.15165e-07,1.09101e-09,0.803399,0.000756504,-7.11892e-07,-5.63675e-09,0.804155,0.000755064,-7.28802e-07,2.14559e-08,0.80491,0.00075367,-6.64434e-07,-2.05821e-08,0.805663,0.00075228,-7.26181e-07,1.26812e-09,0.806414,0.000750831,-7.22377e-07,1.55097e-08,0.807164,0.000749433,-6.75848e-07,-3.70216e-09,0.807913,0.00074807,-6.86954e-07,-7.0105e-10,0.80866,0.000746694,-6.89057e-07,6.5063e-09,0.809406,0.000745336,-6.69538e-07,-2.53242e-08,0.810151,0.000743921,-7.45511e-07,3.51858e-08,0.810894,0.000742535,-6.39953e-07,3.79034e-09,0.811636,0.000741267,-6.28582e-07,-5.03471e-08,0.812377,0.000739858,-7.79624e-07,7.83886e-08,0.813116,0.000738534,-5.44458e-07,-8.43935e-08,0.813854,0.000737192,-7.97638e-07,8.03714e-08,0.81459,0.000735838,-5.56524e-07,-5.82784e-08,0.815325,0.00073455,-7.31359e-07,3.35329e-08,0.816059,0.000733188,-6.3076e-07,-1.62486e-08,0.816792,0.000731878,-6.79506e-07,3.14614e-08,0.817523,0.000730613,-5.85122e-07,-4.99925e-08,0.818253,0.000729293,-7.35099e-07,4.92994e-08,0.818982,0.000727971,-5.87201e-07,-2.79959e-08,0.819709,0.000726712,-6.71189e-07,3.07959e-09,0.820435,0.000725379,-6.6195e-07,1.56777e-08,0.82116,0.000724102,-6.14917e-07,-6.18564e-09,0.821883,0.000722854,-6.33474e-07,9.06488e-09,0.822606,0.000721614,-6.06279e-07,-3.00739e-08,0.823327,0.000720311,-6.96501e-07,5.16262e-08,0.824046,0.000719073,-5.41623e-07,-5.72214e-08,0.824765,0.000717818,-7.13287e-07,5.80503e-08,0.825482,0.000716566,-5.39136e-07,-5.57703e-08,0.826198,0.00071532,-7.06447e-07,4.58215e-08,0.826912,0.000714045,-5.68983e-07,-8.30636e-09,0.827626,0.000712882,-5.93902e-07,-1.25961e-08,0.828338,0.000711656,-6.3169e-07,-9.13985e-10,0.829049,0.00071039,-6.34432e-07,1.62519e-08,0.829759,0.00070917,-5.85676e-07,-4.48904e-09,0.830468,0.000707985,-5.99143e-07,1.70418e-09,0.831175,0.000706792,-5.9403e-07,-2.32768e-09,0.831881,0.000705597,-6.01014e-07,7.60648e-09,0.832586,0.000704418,-5.78194e-07,-2.80982e-08,0.83329,0.000703177,-6.62489e-07,4.51817e-08,0.833993,0.000701988,-5.26944e-07,-3.34192e-08,0.834694,0.000700834,-6.27201e-07,2.88904e-08,0.835394,0.000699666,-5.4053e-07,-2.25378e-08,0.836093,0.000698517,-6.08143e-07,1.65589e-09,0.836791,0.000697306,-6.03176e-07,1.59142e-08,0.837488,0.000696147,-5.55433e-07,-5.70801e-09,0.838184,0.000695019,-5.72557e-07,6.91792e-09,0.838878,0.000693895,-5.51803e-07,-2.19637e-08,0.839571,0.000692725,-6.17694e-07,2.13321e-08,0.840263,0.000691554,-5.53698e-07,-3.75996e-09,0.840954,0.000690435,-5.64978e-07,-6.29219e-09,0.841644,0.000689287,-5.83855e-07,2.89287e-08,0.842333,0.000688206,-4.97068e-07,-4.98181e-08,0.843021,0.000687062,-6.46523e-07,5.11344e-08,0.843707,0.000685922,-4.9312e-07,-3.55102e-08,0.844393,0.00068483,-5.9965e-07,3.13019e-08,0.845077,0.000683724,-5.05745e-07,-3.00925e-08,0.84576,0.000682622,-5.96022e-07,2.94636e-08,0.846442,0.000681519,-5.07631e-07,-2.81572e-08,0.847123,0.000680419,-5.92103e-07,2.35606e-08,0.847803,0.000679306,-5.21421e-07,-6.48045e-09,0.848482,0.000678243,-5.40863e-07,2.36124e-09,0.849159,0.000677169,-5.33779e-07,-2.96461e-09,0.849836,0.000676092,-5.42673e-07,9.49728e-09,0.850512,0.000675035,-5.14181e-07,-3.50245e-08,0.851186,0.000673902,-6.19254e-07,7.09959e-08,0.851859,0.000672876,-4.06267e-07,-7.01453e-08,0.852532,0.000671853,-6.16703e-07,3.07714e-08,0.853203,0.000670712,-5.24388e-07,6.66423e-09,0.853873,0.000669684,-5.04396e-07,2.17629e-09,0.854542,0.000668681,-4.97867e-07,-1.53693e-08,0.855211,0.000667639,-5.43975e-07,-3.03752e-10,0.855878,0.000666551,-5.44886e-07,1.65844e-08,0.856544,0.000665511,-4.95133e-07,-6.42907e-09,0.857209,0.000664501,-5.1442e-07,9.13195e-09,0.857873,0.0006635,-4.87024e-07,-3.00987e-08,0.858536,0.000662435,-5.7732e-07,5.16584e-08,0.859198,0.000661436,-4.22345e-07,-5.73255e-08,0.859859,0.000660419,-5.94322e-07,5.84343e-08,0.860518,0.000659406,-4.19019e-07,-5.72022e-08,0.861177,0.000658396,-5.90626e-07,5.11653e-08,0.861835,0.000657368,-4.3713e-07,-2.82495e-08,0.862492,0.000656409,-5.21878e-07,2.22788e-09,0.863148,0.000655372,-5.15195e-07,1.9338e-08,0.863803,0.0006544,-4.5718e-07,-1.99754e-08,0.864457,0.000653425,-5.17107e-07,9.59024e-10,0.86511,0.000652394,-5.1423e-07,1.61393e-08,0.865762,0.000651414,-4.65812e-07,-5.91149e-09,0.866413,0.000650465,-4.83546e-07,7.50665e-09,0.867063,0.00064952,-4.61026e-07,-2.4115e-08,0.867712,0.000648526,-5.33371e-07,2.93486e-08,0.86836,0.000647547,-4.45325e-07,-3.36748e-08,0.869007,0.000646555,-5.4635e-07,4.57461e-08,0.869653,0.0006456,-4.09112e-07,-3.01002e-08,0.870298,0.000644691,-4.99412e-07,1.50501e-08,0.870942,0.000643738,-4.54262e-07,-3.01002e-08,0.871585,0.000642739,-5.44563e-07,4.57461e-08,0.872228,0.000641787,-4.07324e-07,-3.36748e-08,0.872869,0.000640871,-5.08349e-07,2.93486e-08,0.873509,0.000639943,-4.20303e-07,-2.4115e-08,0.874149,0.00063903,-4.92648e-07,7.50655e-09,0.874787,0.000638067,-4.70128e-07,-5.91126e-09,0.875425,0.000637109,-4.87862e-07,1.61385e-08,0.876062,0.000636182,-4.39447e-07,9.61961e-10,0.876697,0.000635306,-4.36561e-07,-1.99863e-08,0.877332,0.000634373,-4.9652e-07,1.93785e-08,0.877966,0.000633438,-4.38384e-07,2.07697e-09,0.878599,0.000632567,-4.32153e-07,-2.76864e-08,0.879231,0.00063162,-5.15212e-07,4.90641e-08,0.879862,0.000630737,-3.6802e-07,-4.93606e-08,0.880493,0.000629852,-5.16102e-07,2.9169e-08,0.881122,0.000628908,-4.28595e-07,-7.71083e-09,0.881751,0.000628027,-4.51727e-07,1.6744e-09,0.882378,0.000627129,-4.46704e-07,1.01317e-09,0.883005,0.000626239,-4.43665e-07,-5.72703e-09,0.883631,0.000625334,-4.60846e-07,2.1895e-08,0.884255,0.000624478,-3.95161e-07,-2.22481e-08,0.88488,0.000623621,-4.61905e-07,7.4928e-09,0.885503,0.00062272,-4.39427e-07,-7.72306e-09,0.886125,0.000621818,-4.62596e-07,2.33995e-08,0.886746,0.000620963,-3.92398e-07,-2.62704e-08,0.887367,0.000620099,-4.71209e-07,2.20775e-08,0.887987,0.000619223,-4.04976e-07,-2.43496e-09,0.888605,0.000618406,-4.12281e-07,-1.23377e-08,0.889223,0.000617544,-4.49294e-07,-7.81876e-09,0.88984,0.000616622,-4.72751e-07,4.36128e-08,0.890457,0.000615807,-3.41912e-07,-4.7423e-08,0.891072,0.000614981,-4.84181e-07,2.68698e-08,0.891687,0.000614093,-4.03572e-07,-4.51384e-10,0.8923,0.000613285,-4.04926e-07,-2.50643e-08,0.892913,0.0006124,-4.80119e-07,4.11038e-08,0.893525,0.000611563,-3.56808e-07,-2.01414e-08,0.894136,0.000610789,-4.17232e-07,-2.01426e-08,0.894747,0.000609894,-4.7766e-07,4.11073e-08,0.895356,0.000609062,-3.54338e-07,-2.50773e-08,0.895965,0.000608278,-4.2957e-07,-4.02954e-10,0.896573,0.000607418,-4.30779e-07,2.66891e-08,0.89718,0.000606636,-3.50711e-07,-4.67489e-08,0.897786,0.000605795,-4.90958e-07,4.10972e-08,0.898391,0.000604936,-3.67666e-07,1.56948e-09,0.898996,0.000604205,-3.62958e-07,-4.73751e-08,0.8996,0.000603337,-5.05083e-07,6.87214e-08,0.900202,0.000602533,-2.98919e-07,-4.86966e-08,0.900805,0.000601789,-4.45009e-07,6.85589e-09,0.901406,0.00060092,-4.24441e-07,2.1273e-08,0.902007,0.000600135,-3.60622e-07,-3.23434e-08,0.902606,0.000599317,-4.57652e-07,4.84959e-08,0.903205,0.000598547,-3.12164e-07,-4.24309e-08,0.903803,0.000597795,-4.39457e-07,2.01844e-09,0.904401,0.000596922,-4.33402e-07,3.43571e-08,0.904997,0.000596159,-3.30331e-07,-2.02374e-08,0.905593,0.000595437,-3.91043e-07,-1.30123e-08,0.906188,0.000594616,-4.3008e-07,1.26819e-08,0.906782,0.000593794,-3.92034e-07,2.18894e-08,0.907376,0.000593076,-3.26366e-07,-4.06349e-08,0.907968,0.000592301,-4.4827e-07,2.1441e-08,0.90856,0.000591469,-3.83947e-07,1.44754e-08,0.909151,0.000590744,-3.40521e-07,-1.97379e-08,0.909742,0.000590004,-3.99735e-07,4.87161e-09,0.910331,0.000589219,-3.8512e-07,2.51532e-10,0.91092,0.00058845,-3.84366e-07,-5.87776e-09,0.911508,0.000587663,-4.01999e-07,2.32595e-08,0.912096,0.000586929,-3.3222e-07,-2.75554e-08,0.912682,0.000586182,-4.14887e-07,2.73573e-08,0.913268,0.000585434,-3.32815e-07,-2.22692e-08,0.913853,0.000584702,-3.99622e-07,2.11486e-09,0.914437,0.000583909,-3.93278e-07,1.38098e-08,0.915021,0.000583164,-3.51848e-07,2.25042e-09,0.915604,0.000582467,-3.45097e-07,-2.28115e-08,0.916186,0.000581708,-4.13531e-07,2.93911e-08,0.916767,0.000580969,-3.25358e-07,-3.51481e-08,0.917348,0.000580213,-4.30803e-07,5.15967e-08,0.917928,0.000579506,-2.76012e-07,-5.20296e-08,0.918507,0.000578798,-4.32101e-07,3.73124e-08,0.919085,0.000578046,-3.20164e-07,-3.76154e-08,0.919663,0.000577293,-4.3301e-07,5.35447e-08,0.92024,0.000576587,-2.72376e-07,-5.7354e-08,0.920816,0.000575871,-4.44438e-07,5.66621e-08,0.921391,0.000575152,-2.74452e-07,-5.00851e-08,0.921966,0.000574453,-4.24707e-07,2.4469e-08,0.92254,0.000573677,-3.513e-07,1.18138e-08,0.923114,0.000573009,-3.15859e-07,-1.21195e-08,0.923686,0.000572341,-3.52217e-07,-2.29403e-08,0.924258,0.000571568,-4.21038e-07,4.4276e-08,0.924829,0.000570859,-2.8821e-07,-3.49546e-08,0.9254,0.000570178,-3.93074e-07,3.59377e-08,0.92597,0.000569499,-2.85261e-07,-4.91915e-08,0.926539,0.000568781,-4.32835e-07,4.16189e-08,0.927107,0.00056804,-3.07979e-07,1.92523e-09,0.927675,0.00056743,-3.02203e-07,-4.93198e-08,0.928242,0.000566678,-4.50162e-07,7.61447e-08,0.928809,0.000566006,-2.21728e-07,-7.6445e-08,0.929374,0.000565333,-4.51063e-07,5.08216e-08,0.929939,0.000564583,-2.98599e-07,-7.63212e-09,0.930503,0.000563963,-3.21495e-07,-2.02931e-08,0.931067,0.000563259,-3.82374e-07,2.92001e-08,0.93163,0.000562582,-2.94774e-07,-3.69025e-08,0.932192,0.000561882,-4.05482e-07,5.88053e-08,0.932754,0.000561247,-2.29066e-07,-7.91094e-08,0.933315,0.000560552,-4.66394e-07,7.88184e-08,0.933875,0.000559856,-2.29939e-07,-5.73501e-08,0.934434,0.000559224,-4.01989e-07,3.13727e-08,0.934993,0.000558514,-3.07871e-07,-8.53611e-09,0.935551,0.000557873,-3.33479e-07,2.77175e-09,0.936109,0.000557214,-3.25164e-07,-2.55091e-09,0.936666,0.000556556,-3.32817e-07,7.43188e-09,0.937222,0.000555913,-3.10521e-07,-2.71766e-08,0.937778,0.00055521,-3.92051e-07,4.167e-08,0.938333,0.000554551,-2.67041e-07,-2.02941e-08,0.938887,0.000553956,-3.27923e-07,-2.00984e-08,0.93944,0.00055324,-3.88218e-07,4.10828e-08,0.939993,0.000552587,-2.6497e-07,-2.50237e-08,0.940546,0.000551982,-3.40041e-07,-5.92583e-10,0.941097,0.0005513,-3.41819e-07,2.7394e-08,0.941648,0.000550698,-2.59637e-07,-4.93788e-08,0.942199,0.000550031,-4.07773e-07,5.09119e-08,0.942748,0.000549368,-2.55038e-07,-3.50595e-08,0.943297,0.000548753,-3.60216e-07,2.97214e-08,0.943846,0.000548122,-2.71052e-07,-2.42215e-08,0.944394,0.000547507,-3.43716e-07,7.55985e-09,0.944941,0.000546842,-3.21037e-07,-6.01796e-09,0.945487,0.000546182,-3.3909e-07,1.65119e-08,0.946033,0.000545553,-2.89555e-07,-4.2498e-10,0.946578,0.000544973,-2.9083e-07,-1.4812e-08,0.947123,0.000544347,-3.35266e-07,6.83068e-11,0.947667,0.000543676,-3.35061e-07,1.45388e-08,0.94821,0.00054305,-2.91444e-07,1.38123e-09,0.948753,0.000542471,-2.87301e-07,-2.00637e-08,0.949295,0.000541836,-3.47492e-07,1.92688e-08,0.949837,0.000541199,-2.89685e-07,2.59298e-09,0.950378,0.000540628,-2.81906e-07,-2.96407e-08,0.950918,0.000539975,-3.70829e-07,5.63652e-08,0.951458,0.000539402,-2.01733e-07,-7.66107e-08,0.951997,0.000538769,-4.31565e-07,7.12638e-08,0.952535,0.00053812,-2.17774e-07,-2.96305e-08,0.953073,0.000537595,-3.06665e-07,-1.23464e-08,0.95361,0.000536945,-3.43704e-07,1.94114e-08,0.954147,0.000536316,-2.8547e-07,-5.69451e-09,0.954683,0.000535728,-3.02554e-07,3.36666e-09,0.955219,0.000535133,-2.92454e-07,-7.77208e-09,0.955753,0.000534525,-3.1577e-07,2.77216e-08,0.956288,0.000533976,-2.32605e-07,-4.35097e-08,0.956821,0.00053338,-3.63134e-07,2.7108e-08,0.957354,0.000532735,-2.8181e-07,-5.31772e-09,0.957887,0.000532156,-2.97764e-07,-5.83718e-09,0.958419,0.000531543,-3.15275e-07,2.86664e-08,0.95895,0.000530998,-2.29276e-07,-4.9224e-08,0.959481,0.000530392,-3.76948e-07,4.90201e-08,0.960011,0.000529785,-2.29887e-07,-2.76471e-08,0.96054,0.000529243,-3.12829e-07,1.96385e-09,0.961069,0.000528623,-3.06937e-07,1.97917e-08,0.961598,0.000528068,-2.47562e-07,-2.15261e-08,0.962125,0.000527508,-3.1214e-07,6.70795e-09,0.962653,0.000526904,-2.92016e-07,-5.30573e-09,0.963179,0.000526304,-3.07934e-07,1.4515e-08,0.963705,0.000525732,-2.64389e-07,6.85048e-09,0.964231,0.000525224,-2.43837e-07,-4.19169e-08,0.964756,0.00052461,-3.69588e-07,4.1608e-08,0.96528,0.000523996,-2.44764e-07,-5.30598e-09,0.965804,0.000523491,-2.60682e-07,-2.03841e-08,0.966327,0.000522908,-3.21834e-07,2.72378e-08,0.966849,0.000522346,-2.40121e-07,-2.89625e-08,0.967371,0.000521779,-3.27008e-07,2.90075e-08,0.967893,0.000521212,-2.39986e-07,-2.74629e-08,0.968414,0.00052065,-3.22374e-07,2.12396e-08,0.968934,0.000520069,-2.58656e-07,2.10922e-09,0.969454,0.000519558,-2.52328e-07,-2.96765e-08,0.969973,0.000518964,-3.41357e-07,5.6992e-08,0.970492,0.000518452,-1.70382e-07,-7.90821e-08,0.97101,0.000517874,-4.07628e-07,8.05224e-08,0.971528,0.000517301,-1.66061e-07,-6.41937e-08,0.972045,0.000516776,-3.58642e-07,5.70429e-08,0.972561,0.00051623,-1.87513e-07,-4.47686e-08,0.973077,0.00051572,-3.21819e-07,2.82237e-09,0.973593,0.000515085,-3.13352e-07,3.34792e-08,0.974108,0.000514559,-2.12914e-07,-1.75298e-08,0.974622,0.000514081,-2.65503e-07,-2.29648e-08,0.975136,0.000513481,-3.34398e-07,4.97843e-08,0.975649,0.000512961,-1.85045e-07,-5.6963e-08,0.976162,0.00051242,-3.55934e-07,5.88585e-08,0.976674,0.000511885,-1.79359e-07,-5.92616e-08,0.977185,0.000511348,-3.57143e-07,5.89785e-08,0.977696,0.000510811,-1.80208e-07,-5.74433e-08,0.978207,0.000510278,-3.52538e-07,5.15854e-08,0.978717,0.000509728,-1.97781e-07,-2.9689e-08,0.979226,0.000509243,-2.86848e-07,7.56591e-09,0.979735,0.000508692,-2.64151e-07,-5.74649e-10,0.980244,0.000508162,-2.65875e-07,-5.26732e-09,0.980752,0.000507615,-2.81677e-07,2.16439e-08,0.981259,0.000507116,-2.16745e-07,-2.17037e-08,0.981766,0.000506618,-2.81856e-07,5.56636e-09,0.982272,0.000506071,-2.65157e-07,-5.61689e-10,0.982778,0.000505539,-2.66842e-07,-3.31963e-09,0.983283,0.000504995,-2.76801e-07,1.38402e-08,0.983788,0.000504483,-2.3528e-07,7.56339e-09,0.984292,0.000504035,-2.1259e-07,-4.40938e-08,0.984796,0.000503478,-3.44871e-07,4.96026e-08,0.985299,0.000502937,-1.96064e-07,-3.51071e-08,0.985802,0.000502439,-3.01385e-07,3.12212e-08,0.986304,0.00050193,-2.07721e-07,-3.0173e-08,0.986806,0.000501424,-2.9824e-07,2.9866e-08,0.987307,0.000500917,-2.08642e-07,-2.96865e-08,0.987808,0.000500411,-2.97702e-07,2.92753e-08,0.988308,0.000499903,-2.09876e-07,-2.78101e-08,0.988807,0.0004994,-2.93306e-07,2.23604e-08,0.989307,0.000498881,-2.26225e-07,-2.02681e-09,0.989805,0.000498422,-2.32305e-07,-1.42531e-08,0.990303,0.000497915,-2.75065e-07,-5.65232e-10,0.990801,0.000497363,-2.76761e-07,1.65141e-08,0.991298,0.000496859,-2.27218e-07,-5.88639e-09,0.991795,0.000496387,-2.44878e-07,7.0315e-09,0.992291,0.000495918,-2.23783e-07,-2.22396e-08,0.992787,0.000495404,-2.90502e-07,2.23224e-08,0.993282,0.00049489,-2.23535e-07,-7.44543e-09,0.993776,0.000494421,-2.45871e-07,7.45924e-09,0.994271,0.000493951,-2.23493e-07,-2.23915e-08,0.994764,0.000493437,-2.90668e-07,2.25021e-08,0.995257,0.000492923,-2.23161e-07,-8.01218e-09,0.99575,0.000492453,-2.47198e-07,9.54669e-09,0.996242,0.000491987,-2.18558e-07,-3.01746e-08,0.996734,0.000491459,-3.09082e-07,5.1547e-08,0.997225,0.000490996,-1.54441e-07,-5.68039e-08,0.997716,0.000490517,-3.24853e-07,5.64594e-08,0.998206,0.000490036,-1.55474e-07,-4.98245e-08,0.998696,0.000489576,-3.04948e-07,2.36292e-08,0.999186,0.000489037,-2.3406e-07,1.49121e-08,0.999674,0.000488613,-1.89324e-07,-2.3673e-08,1.00016,0.000488164,-2.60343e-07,2.01754e-08,1.00065,0.000487704,-1.99816e-07,-5.70288e-08,1.00114,0.000487133,-3.70903e-07,8.87303e-08,1.00162,0.000486657,-1.04712e-07,-5.94737e-08,1.00211,0.000486269,-2.83133e-07,2.99553e-08,1.0026,0.000485793,-1.93267e-07,-6.03474e-08,1.00308,0.000485225,-3.74309e-07,9.2225e-08,1.00357,0.000484754,-9.76345e-08,-7.0134e-08,1.00405,0.000484348,-3.08036e-07,6.91016e-08,1.00454,0.000483939,-1.00731e-07,-8.70633e-08,1.00502,0.000483476,-3.61921e-07,4.07328e-08,1.0055,0.000482875,-2.39723e-07,4.33413e-08,1.00599,0.000482525,-1.09699e-07,-9.48886e-08,1.00647,0.000482021,-3.94365e-07,9.77947e-08,1.00695,0.000481526,-1.00981e-07,-5.78713e-08,1.00743,0.00048115,-2.74595e-07,1.44814e-08,1.00791,0.000480645,-2.31151e-07,-5.42665e-11,1.00839,0.000480182,-2.31314e-07,-1.42643e-08,1.00887,0.000479677,-2.74106e-07,5.71115e-08,1.00935,0.0004793,-1.02772e-07,-9.49724e-08,1.00983,0.000478809,-3.87689e-07,8.43596e-08,1.01031,0.000478287,-1.3461e-07,-4.04755e-09,1.01079,0.000478006,-1.46753e-07,-6.81694e-08,1.01127,0.000477508,-3.51261e-07,3.83067e-08,1.01174,0.00047692,-2.36341e-07,3.41521e-08,1.01222,0.00047655,-1.33885e-07,-5.57058e-08,1.0127,0.000476115,-3.01002e-07,6.94616e-08,1.01317,0.000475721,-9.26174e-08,-1.02931e-07,1.01365,0.000475227,-4.01412e-07,1.03846e-07,1.01412,0.000474736,-8.98751e-08,-7.40321e-08,1.0146,0.000474334,-3.11971e-07,7.30735e-08,1.01507,0.00047393,-9.27508e-08,-9.90527e-08,1.01554,0.000473447,-3.89909e-07,8.47188e-08,1.01602,0.000472921,-1.35753e-07,-1.40381e-09,1.01649,0.000472645,-1.39964e-07,-7.91035e-08,1.01696,0.000472128,-3.77275e-07,7.93993e-08,1.01744,0.000471612,-1.39077e-07,-7.52607e-11,1.01791,0.000471334,-1.39302e-07,-7.90983e-08,1.01838,0.000470818,-3.76597e-07,7.80499e-08,1.01885,0.000470299,-1.42448e-07,5.31733e-09,1.01932,0.00047003,-1.26496e-07,-9.93193e-08,1.01979,0.000469479,-4.24453e-07,1.53541e-07,1.02026,0.00046909,3.617e-08,-1.57217e-07,1.02073,0.000468691,-4.35482e-07,1.177e-07,1.02119,0.000468173,-8.23808e-08,-7.51659e-08,1.02166,0.000467783,-3.07878e-07,6.37538e-08,1.02213,0.000467358,-1.16617e-07,-6.064e-08,1.0226,0.000466943,-2.98537e-07,5.9597e-08,1.02306,0.000466525,-1.19746e-07,-5.85386e-08,1.02353,0.00046611,-2.95362e-07,5.53482e-08,1.024,0.000465685,-1.29317e-07,-4.36449e-08,1.02446,0.000465296,-2.60252e-07,2.20268e-11,1.02493,0.000464775,-2.60186e-07,4.35568e-08,1.02539,0.000464386,-1.29516e-07,-5.50398e-08,1.02586,0.000463961,-2.94635e-07,5.73932e-08,1.02632,0.000463544,-1.22456e-07,-5.53236e-08,1.02678,0.000463133,-2.88426e-07,4.46921e-08,1.02725,0.000462691,-1.5435e-07,-4.23534e-09,1.02771,0.000462369,-1.67056e-07,-2.77507e-08,1.02817,0.000461952,-2.50308e-07,-3.97101e-09,1.02863,0.000461439,-2.62221e-07,4.36348e-08,1.02909,0.000461046,-1.31317e-07,-5.13589e-08,1.02955,0.000460629,-2.85394e-07,4.25913e-08,1.03001,0.000460186,-1.5762e-07,2.0285e-10,1.03047,0.000459871,-1.57011e-07,-4.34027e-08,1.03093,0.000459427,-2.87219e-07,5.41987e-08,1.03139,0.000459015,-1.24623e-07,-5.4183e-08,1.03185,0.000458604,-2.87172e-07,4.33239e-08,1.03231,0.000458159,-1.572e-07,9.65817e-11,1.03277,0.000457845,-1.56911e-07,-4.37103e-08,1.03323,0.0004574,-2.88041e-07,5.55351e-08,1.03368,0.000456991,-1.21436e-07,-5.9221e-08,1.03414,0.00045657,-2.99099e-07,6.21394e-08,1.0346,0.000456158,-1.1268e-07,-7.01275e-08,1.03505,0.000455723,-3.23063e-07,9.91614e-08,1.03551,0.000455374,-2.55788e-08,-8.80996e-08,1.03596,0.000455058,-2.89878e-07,1.48184e-08,1.03642,0.000454523,-2.45422e-07,2.88258e-08,1.03687,0.000454119,-1.58945e-07,-1.09125e-08,1.03733,0.000453768,-1.91682e-07,1.48241e-08,1.03778,0.000453429,-1.4721e-07,-4.83838e-08,1.03823,0.00045299,-2.92361e-07,5.95019e-08,1.03869,0.000452584,-1.13856e-07,-7.04146e-08,1.03914,0.000452145,-3.25099e-07,1.02947e-07,1.03959,0.000451803,-1.62583e-08,-1.02955e-07,1.04004,0.000451462,-3.25123e-07,7.04544e-08,1.04049,0.000451023,-1.1376e-07,-5.96534e-08,1.04094,0.000450616,-2.9272e-07,4.89499e-08,1.04139,0.000450178,-1.45871e-07,-1.69369e-08,1.04184,0.000449835,-1.96681e-07,1.87977e-08,1.04229,0.000449498,-1.40288e-07,-5.82539e-08,1.04274,0.000449043,-3.1505e-07,9.50087e-08,1.04319,0.000448698,-3.00238e-08,-8.33623e-08,1.04364,0.000448388,-2.80111e-07,2.20363e-11,1.04409,0.000447828,-2.80045e-07,8.32742e-08,1.04454,0.000447517,-3.02221e-08,-9.47002e-08,1.04498,0.000447173,-3.14323e-07,5.7108e-08,1.04543,0.000446716,-1.42999e-07,-1.45225e-08,1.04588,0.000446386,-1.86566e-07,9.82022e-10,1.04632,0.000446016,-1.8362e-07,1.05944e-08,1.04677,0.00044568,-1.51837e-07,-4.33597e-08,1.04721,0.000445247,-2.81916e-07,4.36352e-08,1.04766,0.000444814,-1.51011e-07,-1.19717e-08,1.0481,0.000444476,-1.86926e-07,4.25158e-09,1.04855,0.000444115,-1.74171e-07,-5.03461e-09,1.04899,0.000443751,-1.89275e-07,1.58868e-08,1.04944,0.00044342,-1.41614e-07,-5.85127e-08,1.04988,0.000442961,-3.17152e-07,9.89548e-08,1.05032,0.000442624,-2.0288e-08,-9.88878e-08,1.05076,0.000442287,-3.16951e-07,5.81779e-08,1.05121,0.000441827,-1.42418e-07,-1.46144e-08,1.05165,0.000441499,-1.86261e-07,2.79892e-10,1.05209,0.000441127,-1.85421e-07,1.34949e-08,1.05253,0.000440797,-1.44937e-07,-5.42594e-08,1.05297,0.000440344,-3.07715e-07,8.43335e-08,1.05341,0.000439982,-5.47146e-08,-4.46558e-08,1.05385,0.000439738,-1.88682e-07,-2.49193e-08,1.05429,0.000439286,-2.6344e-07,2.5124e-08,1.05473,0.000438835,-1.88068e-07,4.36328e-08,1.05517,0.000438589,-5.71699e-08,-8.04459e-08,1.05561,0.000438234,-2.98508e-07,3.97324e-08,1.05605,0.000437756,-1.79311e-07,4.07258e-08,1.05648,0.000437519,-5.71332e-08,-8.34263e-08,1.05692,0.000437155,-3.07412e-07,5.45608e-08,1.05736,0.000436704,-1.4373e-07,-1.56078e-08,1.05779,0.000436369,-1.90553e-07,7.87043e-09,1.05823,0.000436012,-1.66942e-07,-1.58739e-08,1.05867,0.00043563,-2.14563e-07,5.56251e-08,1.0591,0.000435368,-4.76881e-08,-8.74172e-08,1.05954,0.000435011,-3.0994e-07,5.56251e-08,1.05997,0.000434558,-1.43064e-07,-1.58739e-08,1.06041,0.000434224,-1.90686e-07,7.87042e-09,1.06084,0.000433866,-1.67075e-07,-1.56078e-08,1.06127,0.000433485,-2.13898e-07,5.45609e-08,1.06171,0.000433221,-5.02157e-08,-8.34263e-08,1.06214,0.00043287,-3.00495e-07,4.07258e-08,1.06257,0.000432391,-1.78317e-07,3.97325e-08,1.063,0.000432154,-5.91198e-08,-8.04464e-08,1.06344,0.000431794,-3.00459e-07,4.36347e-08,1.06387,0.000431324,-1.69555e-07,2.5117e-08,1.0643,0.000431061,-9.42041e-08,-2.48934e-08,1.06473,0.000430798,-1.68884e-07,-4.47527e-08,1.06516,0.000430326,-3.03142e-07,8.46951e-08,1.06559,0.000429973,-4.90573e-08,-5.56089e-08,1.06602,0.000429708,-2.15884e-07,1.85314e-08,1.06645,0.000429332,-1.6029e-07,-1.85166e-08,1.06688,0.000428956,-2.1584e-07,5.5535e-08,1.06731,0.000428691,-4.92347e-08,-8.44142e-08,1.06774,0.000428339,-3.02477e-07,4.37032e-08,1.06816,0.000427865,-1.71368e-07,2.88107e-08,1.06859,0.000427609,-8.49356e-08,-3.97367e-08,1.06902,0.00042732,-2.04146e-07,1.09267e-08,1.06945,0.000426945,-1.71365e-07,-3.97023e-09,1.06987,0.00042659,-1.83276e-07,4.9542e-09,1.0703,0.000426238,-1.68414e-07,-1.58466e-08,1.07073,0.000425854,-2.15953e-07,5.84321e-08,1.07115,0.000425597,-4.0657e-08,-9.86725e-08,1.07158,0.00042522,-3.36674e-07,9.78392e-08,1.072,0.00042484,-4.31568e-08,-5.42658e-08,1.07243,0.000424591,-2.05954e-07,1.45377e-11,1.07285,0.000424179,-2.0591e-07,5.42076e-08,1.07328,0.00042393,-4.32877e-08,-9.76357e-08,1.0737,0.00042355,-3.36195e-07,9.79165e-08,1.07412,0.000423172,-4.24451e-08,-5.56118e-08,1.07455,0.00042292,-2.09281e-07,5.32143e-09,1.07497,0.000422518,-1.93316e-07,3.43261e-08,1.07539,0.000422234,-9.0338e-08,-2.34165e-08,1.07581,0.000421983,-1.60588e-07,-5.98692e-08,1.07623,0.000421482,-3.40195e-07,1.43684e-07,1.07666,0.000421233,9.08574e-08,-1.5724e-07,1.07708,0.000420943,-3.80862e-07,1.27647e-07,1.0775,0.000420564,2.0791e-09,-1.1493e-07,1.07792,0.000420223,-3.4271e-07,9.36534e-08,1.07834,0.000419819,-6.17499e-08,-2.12653e-08,1.07876,0.000419632,-1.25546e-07,-8.59219e-09,1.07918,0.000419355,-1.51322e-07,-6.35752e-08,1.0796,0.000418861,-3.42048e-07,1.43684e-07,1.08002,0.000418608,8.90034e-08,-1.53532e-07,1.08043,0.000418326,-3.71593e-07,1.12817e-07,1.08085,0.000417921,-3.31414e-08,-5.93184e-08,1.08127,0.000417677,-2.11097e-07,5.24697e-09,1.08169,0.00041727,-1.95356e-07,3.83305e-08,1.0821,0.000416995,-8.03642e-08,-3.93597e-08,1.08252,0.000416716,-1.98443e-07,-1.0094e-10,1.08294,0.000416319,-1.98746e-07,3.97635e-08,1.08335,0.00041604,-7.94557e-08,-3.97437e-08,1.08377,0.000415762,-1.98687e-07,1.94215e-12,1.08419,0.000415365,-1.98681e-07,3.97359e-08,1.0846,0.000415087,-7.94732e-08,-3.97362e-08,1.08502,0.000414809,-1.98682e-07,-4.31063e-13,1.08543,0.000414411,-1.98683e-07,3.97379e-08,1.08584,0.000414133,-7.94694e-08,-3.97418e-08,1.08626,0.000413855,-1.98695e-07,2.00563e-11,1.08667,0.000413458,-1.98635e-07,3.96616e-08,1.08709,0.000413179,-7.965e-08,-3.9457e-08,1.0875,0.000412902,-1.98021e-07,-1.04281e-09,1.08791,0.000412502,-2.01149e-07,4.36282e-08,1.08832,0.000412231,-7.02648e-08,-5.42608e-08,1.08874,0.000411928,-2.33047e-07,5.42057e-08,1.08915,0.000411624,-7.04301e-08,-4.33527e-08,1.08956,0.000411353,-2.00488e-07,-4.07378e-12,1.08997,0.000410952,-2.005e-07,4.3369e-08,1.09038,0.000410681,-7.03934e-08,-5.42627e-08,1.09079,0.000410378,-2.33182e-07,5.44726e-08,1.0912,0.000410075,-6.97637e-08,-4.44186e-08,1.09161,0.000409802,-2.03019e-07,3.99235e-09,1.09202,0.000409408,-1.91042e-07,2.84491e-08,1.09243,0.000409111,-1.05695e-07,1.42043e-09,1.09284,0.000408904,-1.01434e-07,-3.41308e-08,1.09325,0.000408599,-2.03826e-07,1.58937e-08,1.09366,0.000408239,-1.56145e-07,-2.94438e-08,1.09406,0.000407838,-2.44476e-07,1.01881e-07,1.09447,0.000407655,6.11676e-08,-1.39663e-07,1.09488,0.000407358,-3.57822e-07,9.91432e-08,1.09529,0.00040694,-6.03921e-08,-1.84912e-08,1.09569,0.000406764,-1.15866e-07,-2.51785e-08,1.0961,0.000406457,-1.91401e-07,-4.03115e-12,1.09651,0.000406074,-1.91413e-07,2.51947e-08,1.09691,0.000405767,-1.15829e-07,1.84346e-08,1.09732,0.00040559,-6.05254e-08,-9.89332e-08,1.09772,0.000405172,-3.57325e-07,1.3888e-07,1.09813,0.000404874,5.93136e-08,-9.8957e-08,1.09853,0.000404696,-2.37557e-07,1.853e-08,1.09894,0.000404277,-1.81968e-07,2.48372e-08,1.09934,0.000403987,-1.07456e-07,1.33047e-09,1.09975,0.000403776,-1.03465e-07,-3.01591e-08,1.10015,0.000403479,-1.93942e-07,9.66054e-11,1.10055,0.000403091,-1.93652e-07,2.97727e-08,1.10096,0.000402793,-1.04334e-07,2.19273e-11,1.10136,0.000402585,-1.04268e-07,-2.98604e-08,1.10176,0.000402287,-1.93849e-07,2.10325e-10,1.10216,0.0004019,-1.93218e-07,2.90191e-08,1.10256,0.0004016,-1.06161e-07,2.92264e-09,1.10297,0.000401397,-9.73931e-08,-4.07096e-08,1.10337,0.00040108,-2.19522e-07,4.07067e-08,1.10377,0.000400763,-9.7402e-08,-2.90783e-09,1.10417,0.000400559,-1.06126e-07,-2.90754e-08,1.10457,0.00040026,-1.93352e-07,9.00021e-14,1.10497,0.000399873,-1.93351e-07,2.9075e-08,1.10537,0.000399574,-1.06126e-07,2.90902e-09,1.10577,0.00039937,-9.73992e-08,-4.07111e-08,1.10617,0.000399053,-2.19533e-07,4.07262e-08,1.10657,0.000398736,-9.73541e-08,-2.98424e-09,1.10697,0.000398533,-1.06307e-07,-2.87892e-08,1.10736,0.000398234,-1.92674e-07,-1.06824e-09,1.10776,0.000397845,-1.95879e-07,3.30622e-08,1.10816,0.000397552,-9.66926e-08,-1.19712e-08,1.10856,0.000397323,-1.32606e-07,1.48225e-08,1.10895,0.000397102,-8.81387e-08,-4.73187e-08,1.10935,0.000396784,-2.30095e-07,5.52429e-08,1.10975,0.00039649,-6.4366e-08,-5.44437e-08,1.11014,0.000396198,-2.27697e-07,4.33226e-08,1.11054,0.000395872,-9.77293e-08,3.62656e-10,1.11094,0.000395678,-9.66414e-08,-4.47732e-08,1.11133,0.00039535,-2.30961e-07,5.95208e-08,1.11173,0.000395067,-5.23985e-08,-7.41008e-08,1.11212,0.00039474,-2.74701e-07,1.17673e-07,1.11252,0.000394543,7.83181e-08,-1.58172e-07,1.11291,0.000394225,-3.96199e-07,1.57389e-07,1.1133,0.000393905,7.59679e-08,-1.13756e-07,1.1137,0.000393716,-2.653e-07,5.92165e-08,1.11409,0.000393363,-8.76507e-08,-3.90074e-09,1.11449,0.000393176,-9.93529e-08,-4.36136e-08,1.11488,0.000392846,-2.30194e-07,5.91457e-08,1.11527,0.000392563,-5.27564e-08,-7.376e-08,1.11566,0.000392237,-2.74037e-07,1.16685e-07,1.11606,0.000392039,7.60189e-08,-1.54562e-07,1.11645,0.000391727,-3.87667e-07,1.43935e-07,1.11684,0.000391384,4.4137e-08,-6.35487e-08,1.11723,0.000391281,-1.46509e-07,-8.94896e-09,1.11762,0.000390961,-1.73356e-07,-1.98647e-08,1.11801,0.000390555,-2.3295e-07,8.8408e-08,1.1184,0.000390354,3.22736e-08,-9.53486e-08,1.11879,0.000390133,-2.53772e-07,5.45677e-08,1.11918,0.000389789,-9.0069e-08,-3.71296e-09,1.11957,0.000389598,-1.01208e-07,-3.97159e-08,1.11996,0.000389276,-2.20355e-07,4.33671e-08,1.12035,0.000388966,-9.02542e-08,-1.45431e-08,1.12074,0.000388741,-1.33883e-07,1.48052e-08,1.12113,0.000388518,-8.94678e-08,-4.46778e-08,1.12152,0.000388205,-2.23501e-07,4.46966e-08,1.12191,0.000387892,-8.94114e-08,-1.48992e-08,1.12229,0.000387669,-1.34109e-07,1.49003e-08,1.12268,0.000387445,-8.94082e-08,-4.47019e-08,1.12307,0.000387132,-2.23514e-07,4.4698e-08,1.12345,0.000386819,-8.942e-08,-1.48806e-08,1.12384,0.000386596,-1.34062e-07,1.48245e-08,1.12423,0.000386372,-8.95885e-08,-4.44172e-08,1.12461,0.00038606,-2.2284e-07,4.36351e-08,1.125,0.000385745,-9.19348e-08,-1.09139e-08,1.12539,0.000385528,-1.24677e-07,2.05584e-11,1.12577,0.000385279,-1.24615e-07,1.08317e-08,1.12616,0.000385062,-9.21198e-08,-4.33473e-08,1.12654,0.000384748,-2.22162e-07,4.33481e-08,1.12693,0.000384434,-9.21174e-08,-1.08356e-08,1.12731,0.000384217,-1.24624e-07,-5.50907e-12,1.12769,0.000383968,-1.24641e-07,1.08577e-08,1.12808,0.000383751,-9.20679e-08,-4.34252e-08,1.12846,0.000383437,-2.22343e-07,4.36337e-08,1.12884,0.000383123,-9.14422e-08,-1.19005e-08,1.12923,0.000382904,-1.27144e-07,3.96813e-09,1.12961,0.000382662,-1.15239e-07,-3.97207e-09,1.12999,0.000382419,-1.27155e-07,1.19201e-08,1.13038,0.000382201,-9.1395e-08,-4.37085e-08,1.13076,0.000381887,-2.2252e-07,4.37046e-08,1.13114,0.000381573,-9.14068e-08,-1.19005e-08,1.13152,0.000381355,-1.27108e-07,3.89734e-09,1.1319,0.000381112,-1.15416e-07,-3.68887e-09,1.13228,0.00038087,-1.26483e-07,1.08582e-08,1.13266,0.00038065,-9.39083e-08,-3.97438e-08,1.13304,0.000380343,-2.1314e-07,2.89076e-08,1.13342,0.000380003,-1.26417e-07,4.33225e-08,1.1338,0.00037988,3.55072e-09,-8.29883e-08,1.13418,0.000379638,-2.45414e-07,5.0212e-08,1.13456,0.000379298,-9.47781e-08,1.34964e-09,1.13494,0.000379113,-9.07292e-08,-5.56105e-08,1.13532,0.000378764,-2.57561e-07,1.01883e-07,1.1357,0.000378555,4.80889e-08,-1.13504e-07,1.13608,0.000378311,-2.92423e-07,1.13713e-07,1.13646,0.000378067,4.87176e-08,-1.02931e-07,1.13683,0.000377856,-2.60076e-07,5.95923e-08,1.13721,0.000377514,-8.12988e-08,-1.62288e-08,1.13759,0.000377303,-1.29985e-07,5.32278e-09,1.13797,0.000377059,-1.14017e-07,-5.06237e-09,1.13834,0.000376816,-1.29204e-07,1.49267e-08,1.13872,0.000376602,-8.44237e-08,-5.46444e-08,1.1391,0.000376269,-2.48357e-07,8.44417e-08,1.13947,0.000376026,4.96815e-09,-4.47039e-08,1.13985,0.000375902,-1.29143e-07,-2.48355e-08,1.14023,0.000375569,-2.0365e-07,2.48368e-08,1.1406,0.000375236,-1.2914e-07,4.46977e-08,1.14098,0.000375112,4.95341e-09,-8.44184e-08,1.14135,0.000374869,-2.48302e-07,5.45572e-08,1.14173,0.000374536,-8.463e-08,-1.46013e-08,1.1421,0.000374323,-1.28434e-07,3.8478e-09,1.14247,0.000374077,-1.1689e-07,-7.89941e-10,1.14285,0.000373841,-1.1926e-07,-6.88042e-10,1.14322,0.0003736,-1.21324e-07,3.54213e-09,1.1436,0.000373368,-1.10698e-07,-1.34805e-08,1.14397,0.000373107,-1.51139e-07,5.03798e-08,1.14434,0.000372767,0.,0.}; - - template - __device__ __forceinline__ void RGB2LuvConvert_f(const T& src, D& dst) - { - const float _d = 1.f / (0.950456f + 15 + 1.088754f * 3); - const float _un = 13 * (4 * 0.950456f * _d); - const float _vn = 13 * (9 * _d); - - float B = blueIdx == 0 ? src.x : src.z; - float G = src.y; - float R = blueIdx == 0 ? src.z : src.x; - - if (srgb) - { - B = splineInterpolate(B * GAMMA_TAB_SIZE, c_sRGBGammaTab, GAMMA_TAB_SIZE); - G = splineInterpolate(G * GAMMA_TAB_SIZE, c_sRGBGammaTab, GAMMA_TAB_SIZE); - R = splineInterpolate(R * GAMMA_TAB_SIZE, c_sRGBGammaTab, GAMMA_TAB_SIZE); - } - - float X = R * 0.412453f + G * 0.357580f + B * 0.180423f; - float Y = R * 0.212671f + G * 0.715160f + B * 0.072169f; - float Z = R * 0.019334f + G * 0.119193f + B * 0.950227f; - - float L = splineInterpolate(Y * (LAB_CBRT_TAB_SIZE / 1.5f), c_LabCbrtTab, LAB_CBRT_TAB_SIZE); - L = 116.f * L - 16.f; - - const float d = (4 * 13) / ::fmaxf(X + 15 * Y + 3 * Z, numeric_limits::epsilon()); - float u = L * (X * d - _un); - float v = L * ((9 * 0.25f) * Y * d - _vn); - - dst.x = L; - dst.y = u; - dst.z = v; - } - - template - __device__ __forceinline__ void RGB2LuvConvert_b(const T& src, D& dst) - { - float3 srcf, dstf; - - srcf.x = src.x * (1.f / 255.f); - srcf.y = src.y * (1.f / 255.f); - srcf.z = src.z * (1.f / 255.f); - - RGB2LuvConvert_f(srcf, dstf); - - dst.x = saturate_cast(dstf.x * 2.55f); - dst.y = saturate_cast(dstf.y * 0.72033898305084743f + 96.525423728813564f); - dst.z = saturate_cast(dstf.z * 0.9732824427480916f + 136.259541984732824f); - } - - template struct RGB2Luv; - template - struct RGB2Luv - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator ()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - RGB2LuvConvert_b(src, dst); - - return dst; - } - __host__ __device__ __forceinline__ RGB2Luv() {} - __host__ __device__ __forceinline__ RGB2Luv(const RGB2Luv&) {} - }; - template - struct RGB2Luv - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator ()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - RGB2LuvConvert_f(src, dst); - - return dst; - } - __host__ __device__ __forceinline__ RGB2Luv() {} - __host__ __device__ __forceinline__ RGB2Luv(const RGB2Luv&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_RGB2Luv_TRAITS(name, scn, dcn, srgb, blueIdx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::RGB2Luv functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - - namespace color_detail - { - template - __device__ __forceinline__ void Luv2RGBConvert_f(const T& src, D& dst) - { - const float _d = 1.f / (0.950456f + 15 + 1.088754f * 3); - const float _un = 4 * 0.950456f * _d; - const float _vn = 9 * _d; - - float L = src.x; - float u = src.y; - float v = src.z; - - float Y = (L + 16.f) * (1.f / 116.f); - Y = Y * Y * Y; - - float d = (1.f / 13.f) / L; - u = u * d + _un; - v = v * d + _vn; - - float iv = 1.f / v; - float X = 2.25f * u * Y * iv; - float Z = (12 - 3 * u - 20 * v) * Y * 0.25f * iv; - - float B = 0.055648f * X - 0.204043f * Y + 1.057311f * Z; - float G = -0.969256f * X + 1.875991f * Y + 0.041556f * Z; - float R = 3.240479f * X - 1.537150f * Y - 0.498535f * Z; - - if (srgb) - { - B = splineInterpolate(B * GAMMA_TAB_SIZE, c_sRGBInvGammaTab, GAMMA_TAB_SIZE); - G = splineInterpolate(G * GAMMA_TAB_SIZE, c_sRGBInvGammaTab, GAMMA_TAB_SIZE); - R = splineInterpolate(R * GAMMA_TAB_SIZE, c_sRGBInvGammaTab, GAMMA_TAB_SIZE); - } - - dst.x = blueIdx == 0 ? B : R; - dst.y = G; - dst.z = blueIdx == 0 ? R : B; - setAlpha(dst, ColorChannel::max()); - } - - template - __device__ __forceinline__ void Luv2RGBConvert_b(const T& src, D& dst) - { - float3 srcf, dstf; - - srcf.x = src.x * (100.f / 255.f); - srcf.y = src.y * 1.388235294117647f - 134.f; - srcf.z = src.z * 1.027450980392157f - 140.f; - - Luv2RGBConvert_f(srcf, dstf); - - dst.x = saturate_cast(dstf.x * 255.f); - dst.y = saturate_cast(dstf.y * 255.f); - dst.z = saturate_cast(dstf.z * 255.f); - setAlpha(dst, ColorChannel::max()); - } - - template struct Luv2RGB; - template - struct Luv2RGB - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator ()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - Luv2RGBConvert_b(src, dst); - - return dst; - } - __host__ __device__ __forceinline__ Luv2RGB() {} - __host__ __device__ __forceinline__ Luv2RGB(const Luv2RGB&) {} - }; - template - struct Luv2RGB - : unary_function::vec_type, typename TypeVec::vec_type> - { - __device__ __forceinline__ typename TypeVec::vec_type operator ()(const typename TypeVec::vec_type& src) const - { - typename TypeVec::vec_type dst; - - Luv2RGBConvert_f(src, dst); - - return dst; - } - __host__ __device__ __forceinline__ Luv2RGB() {} - __host__ __device__ __forceinline__ Luv2RGB(const Luv2RGB&) {} - }; - } - -#define OPENCV_CUDA_IMPLEMENT_Luv2RGB_TRAITS(name, scn, dcn, srgb, blueIdx) \ - template struct name ## _traits \ - { \ - typedef ::cv::cuda::device::color_detail::Luv2RGB functor_type; \ - static __host__ __device__ __forceinline__ functor_type create_functor() \ - { \ - return functor_type(); \ - } \ - }; - - #undef CV_DESCALE - -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif // OPENCV_CUDA_COLOR_DETAIL_HPP diff --git a/opencv/include/opencv2/core/cuda/detail/reduce.hpp b/opencv/include/opencv2/core/cuda/detail/reduce.hpp deleted file mode 100644 index 8af20b0..0000000 --- a/opencv/include/opencv2/core/cuda/detail/reduce.hpp +++ /dev/null @@ -1,365 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_REDUCE_DETAIL_HPP -#define OPENCV_CUDA_REDUCE_DETAIL_HPP - -#include -#include "../warp.hpp" -#include "../warp_shuffle.hpp" - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - namespace reduce_detail - { - template struct GetType; - template struct GetType - { - typedef T type; - }; - template struct GetType - { - typedef T type; - }; - template struct GetType - { - typedef T type; - }; - - template - struct For - { - template - static __device__ void loadToSmem(const PointerTuple& smem, const ValTuple& val, unsigned int tid) - { - thrust::get(smem)[tid] = thrust::get(val); - - For::loadToSmem(smem, val, tid); - } - template - static __device__ void loadFromSmem(const PointerTuple& smem, const ValTuple& val, unsigned int tid) - { - thrust::get(val) = thrust::get(smem)[tid]; - - For::loadFromSmem(smem, val, tid); - } - - template - static __device__ void merge(const PointerTuple& smem, const ValTuple& val, unsigned int tid, unsigned int delta, const OpTuple& op) - { - typename GetType::type>::type reg = thrust::get(smem)[tid + delta]; - thrust::get(smem)[tid] = thrust::get(val) = thrust::get(op)(thrust::get(val), reg); - - For::merge(smem, val, tid, delta, op); - } - template - static __device__ void mergeShfl(const ValTuple& val, unsigned int delta, unsigned int width, const OpTuple& op) - { - typename GetType::type>::type reg = shfl_down(thrust::get(val), delta, width); - thrust::get(val) = thrust::get(op)(thrust::get(val), reg); - - For::mergeShfl(val, delta, width, op); - } - }; - template - struct For - { - template - static __device__ void loadToSmem(const PointerTuple&, const ValTuple&, unsigned int) - { - } - template - static __device__ void loadFromSmem(const PointerTuple&, const ValTuple&, unsigned int) - { - } - - template - static __device__ void merge(const PointerTuple&, const ValTuple&, unsigned int, unsigned int, const OpTuple&) - { - } - template - static __device__ void mergeShfl(const ValTuple&, unsigned int, unsigned int, const OpTuple&) - { - } - }; - - template - __device__ __forceinline__ void loadToSmem(volatile T* smem, T& val, unsigned int tid) - { - smem[tid] = val; - } - template - __device__ __forceinline__ void loadFromSmem(volatile T* smem, T& val, unsigned int tid) - { - val = smem[tid]; - } - template - __device__ __forceinline__ void loadToSmem(const thrust::tuple& smem, - const thrust::tuple& val, - unsigned int tid) - { - For<0, thrust::tuple_size >::value>::loadToSmem(smem, val, tid); - } - template - __device__ __forceinline__ void loadFromSmem(const thrust::tuple& smem, - const thrust::tuple& val, - unsigned int tid) - { - For<0, thrust::tuple_size >::value>::loadFromSmem(smem, val, tid); - } - - template - __device__ __forceinline__ void merge(volatile T* smem, T& val, unsigned int tid, unsigned int delta, const Op& op) - { - T reg = smem[tid + delta]; - smem[tid] = val = op(val, reg); - } - template - __device__ __forceinline__ void mergeShfl(T& val, unsigned int delta, unsigned int width, const Op& op) - { - T reg = shfl_down(val, delta, width); - val = op(val, reg); - } - template - __device__ __forceinline__ void merge(const thrust::tuple& smem, - const thrust::tuple& val, - unsigned int tid, - unsigned int delta, - const thrust::tuple& op) - { - For<0, thrust::tuple_size >::value>::merge(smem, val, tid, delta, op); - } - template - __device__ __forceinline__ void mergeShfl(const thrust::tuple& val, - unsigned int delta, - unsigned int width, - const thrust::tuple& op) - { - For<0, thrust::tuple_size >::value>::mergeShfl(val, delta, width, op); - } - - template struct Generic - { - template - static __device__ void reduce(Pointer smem, Reference val, unsigned int tid, Op op) - { - loadToSmem(smem, val, tid); - if (N >= 32) - __syncthreads(); - - if (N >= 2048) - { - if (tid < 1024) - merge(smem, val, tid, 1024, op); - - __syncthreads(); - } - if (N >= 1024) - { - if (tid < 512) - merge(smem, val, tid, 512, op); - - __syncthreads(); - } - if (N >= 512) - { - if (tid < 256) - merge(smem, val, tid, 256, op); - - __syncthreads(); - } - if (N >= 256) - { - if (tid < 128) - merge(smem, val, tid, 128, op); - - __syncthreads(); - } - if (N >= 128) - { - if (tid < 64) - merge(smem, val, tid, 64, op); - - __syncthreads(); - } - if (N >= 64) - { - if (tid < 32) - merge(smem, val, tid, 32, op); - } - - if (tid < 16) - { - merge(smem, val, tid, 16, op); - merge(smem, val, tid, 8, op); - merge(smem, val, tid, 4, op); - merge(smem, val, tid, 2, op); - merge(smem, val, tid, 1, op); - } - } - }; - - template - struct Unroll - { - static __device__ void loopShfl(Reference val, Op op, unsigned int N) - { - mergeShfl(val, I, N, op); - Unroll::loopShfl(val, op, N); - } - static __device__ void loop(Pointer smem, Reference val, unsigned int tid, Op op) - { - merge(smem, val, tid, I, op); - Unroll::loop(smem, val, tid, op); - } - }; - template - struct Unroll<0, Pointer, Reference, Op> - { - static __device__ void loopShfl(Reference, Op, unsigned int) - { - } - static __device__ void loop(Pointer, Reference, unsigned int, Op) - { - } - }; - - template struct WarpOptimized - { - template - static __device__ void reduce(Pointer smem, Reference val, unsigned int tid, Op op) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300 - CV_UNUSED(smem); - CV_UNUSED(tid); - - Unroll::loopShfl(val, op, N); - #else - loadToSmem(smem, val, tid); - - if (tid < N / 2) - Unroll::loop(smem, val, tid, op); - #endif - } - }; - - template struct GenericOptimized32 - { - enum { M = N / 32 }; - - template - static __device__ void reduce(Pointer smem, Reference val, unsigned int tid, Op op) - { - const unsigned int laneId = Warp::laneId(); - - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300 - Unroll<16, Pointer, Reference, Op>::loopShfl(val, op, warpSize); - - if (laneId == 0) - loadToSmem(smem, val, tid / 32); - #else - loadToSmem(smem, val, tid); - - if (laneId < 16) - Unroll<16, Pointer, Reference, Op>::loop(smem, val, tid, op); - - __syncthreads(); - - if (laneId == 0) - loadToSmem(smem, val, tid / 32); - #endif - - __syncthreads(); - - loadFromSmem(smem, val, tid); - - if (tid < 32) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300 - Unroll::loopShfl(val, op, M); - #else - Unroll::loop(smem, val, tid, op); - #endif - } - } - }; - - template struct StaticIf; - template struct StaticIf - { - typedef T1 type; - }; - template struct StaticIf - { - typedef T2 type; - }; - - template struct IsPowerOf2 - { - enum { value = ((N != 0) && !(N & (N - 1))) }; - }; - - template struct Dispatcher - { - typedef typename StaticIf< - (N <= 32) && IsPowerOf2::value, - WarpOptimized, - typename StaticIf< - (N <= 1024) && IsPowerOf2::value, - GenericOptimized32, - Generic - >::type - >::type reductor; - }; - } -}}} - -//! @endcond - -#endif // OPENCV_CUDA_REDUCE_DETAIL_HPP diff --git a/opencv/include/opencv2/core/cuda/detail/reduce_key_val.hpp b/opencv/include/opencv2/core/cuda/detail/reduce_key_val.hpp deleted file mode 100644 index df37c17..0000000 --- a/opencv/include/opencv2/core/cuda/detail/reduce_key_val.hpp +++ /dev/null @@ -1,502 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_PRED_VAL_REDUCE_DETAIL_HPP -#define OPENCV_CUDA_PRED_VAL_REDUCE_DETAIL_HPP - -#include -#include "../warp.hpp" -#include "../warp_shuffle.hpp" - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - namespace reduce_key_val_detail - { - template struct GetType; - template struct GetType - { - typedef T type; - }; - template struct GetType - { - typedef T type; - }; - template struct GetType - { - typedef T type; - }; - - template - struct For - { - template - static __device__ void loadToSmem(const PointerTuple& smem, const ReferenceTuple& data, unsigned int tid) - { - thrust::get(smem)[tid] = thrust::get(data); - - For::loadToSmem(smem, data, tid); - } - template - static __device__ void loadFromSmem(const PointerTuple& smem, const ReferenceTuple& data, unsigned int tid) - { - thrust::get(data) = thrust::get(smem)[tid]; - - For::loadFromSmem(smem, data, tid); - } - - template - static __device__ void copyShfl(const ReferenceTuple& val, unsigned int delta, int width) - { - thrust::get(val) = shfl_down(thrust::get(val), delta, width); - - For::copyShfl(val, delta, width); - } - template - static __device__ void copy(const PointerTuple& svals, const ReferenceTuple& val, unsigned int tid, unsigned int delta) - { - thrust::get(svals)[tid] = thrust::get(val) = thrust::get(svals)[tid + delta]; - - For::copy(svals, val, tid, delta); - } - - template - static __device__ void mergeShfl(const KeyReferenceTuple& key, const ValReferenceTuple& val, const CmpTuple& cmp, unsigned int delta, int width) - { - typename GetType::type>::type reg = shfl_down(thrust::get(key), delta, width); - - if (thrust::get(cmp)(reg, thrust::get(key))) - { - thrust::get(key) = reg; - thrust::get(val) = shfl_down(thrust::get(val), delta, width); - } - - For::mergeShfl(key, val, cmp, delta, width); - } - template - static __device__ void merge(const KeyPointerTuple& skeys, const KeyReferenceTuple& key, - const ValPointerTuple& svals, const ValReferenceTuple& val, - const CmpTuple& cmp, - unsigned int tid, unsigned int delta) - { - typename GetType::type>::type reg = thrust::get(skeys)[tid + delta]; - - if (thrust::get(cmp)(reg, thrust::get(key))) - { - thrust::get(skeys)[tid] = thrust::get(key) = reg; - thrust::get(svals)[tid] = thrust::get(val) = thrust::get(svals)[tid + delta]; - } - - For::merge(skeys, key, svals, val, cmp, tid, delta); - } - }; - template - struct For - { - template - static __device__ void loadToSmem(const PointerTuple&, const ReferenceTuple&, unsigned int) - { - } - template - static __device__ void loadFromSmem(const PointerTuple&, const ReferenceTuple&, unsigned int) - { - } - - template - static __device__ void copyShfl(const ReferenceTuple&, unsigned int, int) - { - } - template - static __device__ void copy(const PointerTuple&, const ReferenceTuple&, unsigned int, unsigned int) - { - } - - template - static __device__ void mergeShfl(const KeyReferenceTuple&, const ValReferenceTuple&, const CmpTuple&, unsigned int, int) - { - } - template - static __device__ void merge(const KeyPointerTuple&, const KeyReferenceTuple&, - const ValPointerTuple&, const ValReferenceTuple&, - const CmpTuple&, - unsigned int, unsigned int) - { - } - }; - - ////////////////////////////////////////////////////// - // loadToSmem - - template - __device__ __forceinline__ void loadToSmem(volatile T* smem, T& data, unsigned int tid) - { - smem[tid] = data; - } - template - __device__ __forceinline__ void loadFromSmem(volatile T* smem, T& data, unsigned int tid) - { - data = smem[tid]; - } - template - __device__ __forceinline__ void loadToSmem(const thrust::tuple& smem, - const thrust::tuple& data, - unsigned int tid) - { - For<0, thrust::tuple_size >::value>::loadToSmem(smem, data, tid); - } - template - __device__ __forceinline__ void loadFromSmem(const thrust::tuple& smem, - const thrust::tuple& data, - unsigned int tid) - { - For<0, thrust::tuple_size >::value>::loadFromSmem(smem, data, tid); - } - - ////////////////////////////////////////////////////// - // copyVals - - template - __device__ __forceinline__ void copyValsShfl(V& val, unsigned int delta, int width) - { - val = shfl_down(val, delta, width); - } - template - __device__ __forceinline__ void copyVals(volatile V* svals, V& val, unsigned int tid, unsigned int delta) - { - svals[tid] = val = svals[tid + delta]; - } - template - __device__ __forceinline__ void copyValsShfl(const thrust::tuple& val, - unsigned int delta, - int width) - { - For<0, thrust::tuple_size >::value>::copyShfl(val, delta, width); - } - template - __device__ __forceinline__ void copyVals(const thrust::tuple& svals, - const thrust::tuple& val, - unsigned int tid, unsigned int delta) - { - For<0, thrust::tuple_size >::value>::copy(svals, val, tid, delta); - } - - ////////////////////////////////////////////////////// - // merge - - template - __device__ __forceinline__ void mergeShfl(K& key, V& val, const Cmp& cmp, unsigned int delta, int width) - { - K reg = shfl_down(key, delta, width); - - if (cmp(reg, key)) - { - key = reg; - copyValsShfl(val, delta, width); - } - } - template - __device__ __forceinline__ void merge(volatile K* skeys, K& key, volatile V* svals, V& val, const Cmp& cmp, unsigned int tid, unsigned int delta) - { - K reg = skeys[tid + delta]; - - if (cmp(reg, key)) - { - skeys[tid] = key = reg; - copyVals(svals, val, tid, delta); - } - } - template - __device__ __forceinline__ void mergeShfl(K& key, - const thrust::tuple& val, - const Cmp& cmp, - unsigned int delta, int width) - { - K reg = shfl_down(key, delta, width); - - if (cmp(reg, key)) - { - key = reg; - copyValsShfl(val, delta, width); - } - } - template - __device__ __forceinline__ void merge(volatile K* skeys, K& key, - const thrust::tuple& svals, - const thrust::tuple& val, - const Cmp& cmp, unsigned int tid, unsigned int delta) - { - K reg = skeys[tid + delta]; - - if (cmp(reg, key)) - { - skeys[tid] = key = reg; - copyVals(svals, val, tid, delta); - } - } - template - __device__ __forceinline__ void mergeShfl(const thrust::tuple& key, - const thrust::tuple& val, - const thrust::tuple& cmp, - unsigned int delta, int width) - { - For<0, thrust::tuple_size >::value>::mergeShfl(key, val, cmp, delta, width); - } - template - __device__ __forceinline__ void merge(const thrust::tuple& skeys, - const thrust::tuple& key, - const thrust::tuple& svals, - const thrust::tuple& val, - const thrust::tuple& cmp, - unsigned int tid, unsigned int delta) - { - For<0, thrust::tuple_size >::value>::merge(skeys, key, svals, val, cmp, tid, delta); - } - - ////////////////////////////////////////////////////// - // Generic - - template struct Generic - { - template - static __device__ void reduce(KP skeys, KR key, VP svals, VR val, unsigned int tid, Cmp cmp) - { - loadToSmem(skeys, key, tid); - loadValsToSmem(svals, val, tid); - if (N >= 32) - __syncthreads(); - - if (N >= 2048) - { - if (tid < 1024) - merge(skeys, key, svals, val, cmp, tid, 1024); - - __syncthreads(); - } - if (N >= 1024) - { - if (tid < 512) - merge(skeys, key, svals, val, cmp, tid, 512); - - __syncthreads(); - } - if (N >= 512) - { - if (tid < 256) - merge(skeys, key, svals, val, cmp, tid, 256); - - __syncthreads(); - } - if (N >= 256) - { - if (tid < 128) - merge(skeys, key, svals, val, cmp, tid, 128); - - __syncthreads(); - } - if (N >= 128) - { - if (tid < 64) - merge(skeys, key, svals, val, cmp, tid, 64); - - __syncthreads(); - } - if (N >= 64) - { - if (tid < 32) - merge(skeys, key, svals, val, cmp, tid, 32); - } - - if (tid < 16) - { - merge(skeys, key, svals, val, cmp, tid, 16); - merge(skeys, key, svals, val, cmp, tid, 8); - merge(skeys, key, svals, val, cmp, tid, 4); - merge(skeys, key, svals, val, cmp, tid, 2); - merge(skeys, key, svals, val, cmp, tid, 1); - } - } - }; - - template - struct Unroll - { - static __device__ void loopShfl(KR key, VR val, Cmp cmp, unsigned int N) - { - mergeShfl(key, val, cmp, I, N); - Unroll::loopShfl(key, val, cmp, N); - } - static __device__ void loop(KP skeys, KR key, VP svals, VR val, unsigned int tid, Cmp cmp) - { - merge(skeys, key, svals, val, cmp, tid, I); - Unroll::loop(skeys, key, svals, val, tid, cmp); - } - }; - template - struct Unroll<0, KP, KR, VP, VR, Cmp> - { - static __device__ void loopShfl(KR, VR, Cmp, unsigned int) - { - } - static __device__ void loop(KP, KR, VP, VR, unsigned int, Cmp) - { - } - }; - - template struct WarpOptimized - { - template - static __device__ void reduce(KP skeys, KR key, VP svals, VR val, unsigned int tid, Cmp cmp) - { - #if 0 // __CUDA_ARCH__ >= 300 - CV_UNUSED(skeys); - CV_UNUSED(svals); - CV_UNUSED(tid); - - Unroll::loopShfl(key, val, cmp, N); - #else - loadToSmem(skeys, key, tid); - loadToSmem(svals, val, tid); - - if (tid < N / 2) - Unroll::loop(skeys, key, svals, val, tid, cmp); - #endif - } - }; - - template struct GenericOptimized32 - { - enum { M = N / 32 }; - - template - static __device__ void reduce(KP skeys, KR key, VP svals, VR val, unsigned int tid, Cmp cmp) - { - const unsigned int laneId = Warp::laneId(); - - #if 0 // __CUDA_ARCH__ >= 300 - Unroll<16, KP, KR, VP, VR, Cmp>::loopShfl(key, val, cmp, warpSize); - - if (laneId == 0) - { - loadToSmem(skeys, key, tid / 32); - loadToSmem(svals, val, tid / 32); - } - #else - loadToSmem(skeys, key, tid); - loadToSmem(svals, val, tid); - - if (laneId < 16) - Unroll<16, KP, KR, VP, VR, Cmp>::loop(skeys, key, svals, val, tid, cmp); - - __syncthreads(); - - if (laneId == 0) - { - loadToSmem(skeys, key, tid / 32); - loadToSmem(svals, val, tid / 32); - } - #endif - - __syncthreads(); - - loadFromSmem(skeys, key, tid); - - if (tid < 32) - { - #if 0 // __CUDA_ARCH__ >= 300 - loadFromSmem(svals, val, tid); - - Unroll::loopShfl(key, val, cmp, M); - #else - Unroll::loop(skeys, key, svals, val, tid, cmp); - #endif - } - } - }; - - template struct StaticIf; - template struct StaticIf - { - typedef T1 type; - }; - template struct StaticIf - { - typedef T2 type; - }; - - template struct IsPowerOf2 - { - enum { value = ((N != 0) && !(N & (N - 1))) }; - }; - - template struct Dispatcher - { - typedef typename StaticIf< - (N <= 32) && IsPowerOf2::value, - WarpOptimized, - typename StaticIf< - (N <= 1024) && IsPowerOf2::value, - GenericOptimized32, - Generic - >::type - >::type reductor; - }; - } -}}} - -//! @endcond - -#endif // OPENCV_CUDA_PRED_VAL_REDUCE_DETAIL_HPP diff --git a/opencv/include/opencv2/core/cuda/detail/transform_detail.hpp b/opencv/include/opencv2/core/cuda/detail/transform_detail.hpp deleted file mode 100644 index 1919848..0000000 --- a/opencv/include/opencv2/core/cuda/detail/transform_detail.hpp +++ /dev/null @@ -1,392 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_TRANSFORM_DETAIL_HPP -#define OPENCV_CUDA_TRANSFORM_DETAIL_HPP - -#include "../common.hpp" -#include "../vec_traits.hpp" -#include "../functional.hpp" - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - namespace transform_detail - { - //! Read Write Traits - - template struct UnaryReadWriteTraits - { - typedef typename TypeVec::vec_type read_type; - typedef typename TypeVec::vec_type write_type; - }; - - template struct BinaryReadWriteTraits - { - typedef typename TypeVec::vec_type read_type1; - typedef typename TypeVec::vec_type read_type2; - typedef typename TypeVec::vec_type write_type; - }; - - //! Transform kernels - - template struct OpUnroller; - template <> struct OpUnroller<1> - { - template - static __device__ __forceinline__ void unroll(const T& src, D& dst, const Mask& mask, UnOp& op, int x_shifted, int y) - { - if (mask(y, x_shifted)) - dst.x = op(src.x); - } - - template - static __device__ __forceinline__ void unroll(const T1& src1, const T2& src2, D& dst, const Mask& mask, BinOp& op, int x_shifted, int y) - { - if (mask(y, x_shifted)) - dst.x = op(src1.x, src2.x); - } - }; - template <> struct OpUnroller<2> - { - template - static __device__ __forceinline__ void unroll(const T& src, D& dst, const Mask& mask, UnOp& op, int x_shifted, int y) - { - if (mask(y, x_shifted)) - dst.x = op(src.x); - if (mask(y, x_shifted + 1)) - dst.y = op(src.y); - } - - template - static __device__ __forceinline__ void unroll(const T1& src1, const T2& src2, D& dst, const Mask& mask, BinOp& op, int x_shifted, int y) - { - if (mask(y, x_shifted)) - dst.x = op(src1.x, src2.x); - if (mask(y, x_shifted + 1)) - dst.y = op(src1.y, src2.y); - } - }; - template <> struct OpUnroller<3> - { - template - static __device__ __forceinline__ void unroll(const T& src, D& dst, const Mask& mask, const UnOp& op, int x_shifted, int y) - { - if (mask(y, x_shifted)) - dst.x = op(src.x); - if (mask(y, x_shifted + 1)) - dst.y = op(src.y); - if (mask(y, x_shifted + 2)) - dst.z = op(src.z); - } - - template - static __device__ __forceinline__ void unroll(const T1& src1, const T2& src2, D& dst, const Mask& mask, const BinOp& op, int x_shifted, int y) - { - if (mask(y, x_shifted)) - dst.x = op(src1.x, src2.x); - if (mask(y, x_shifted + 1)) - dst.y = op(src1.y, src2.y); - if (mask(y, x_shifted + 2)) - dst.z = op(src1.z, src2.z); - } - }; - template <> struct OpUnroller<4> - { - template - static __device__ __forceinline__ void unroll(const T& src, D& dst, const Mask& mask, const UnOp& op, int x_shifted, int y) - { - if (mask(y, x_shifted)) - dst.x = op(src.x); - if (mask(y, x_shifted + 1)) - dst.y = op(src.y); - if (mask(y, x_shifted + 2)) - dst.z = op(src.z); - if (mask(y, x_shifted + 3)) - dst.w = op(src.w); - } - - template - static __device__ __forceinline__ void unroll(const T1& src1, const T2& src2, D& dst, const Mask& mask, const BinOp& op, int x_shifted, int y) - { - if (mask(y, x_shifted)) - dst.x = op(src1.x, src2.x); - if (mask(y, x_shifted + 1)) - dst.y = op(src1.y, src2.y); - if (mask(y, x_shifted + 2)) - dst.z = op(src1.z, src2.z); - if (mask(y, x_shifted + 3)) - dst.w = op(src1.w, src2.w); - } - }; - template <> struct OpUnroller<8> - { - template - static __device__ __forceinline__ void unroll(const T& src, D& dst, const Mask& mask, const UnOp& op, int x_shifted, int y) - { - if (mask(y, x_shifted)) - dst.a0 = op(src.a0); - if (mask(y, x_shifted + 1)) - dst.a1 = op(src.a1); - if (mask(y, x_shifted + 2)) - dst.a2 = op(src.a2); - if (mask(y, x_shifted + 3)) - dst.a3 = op(src.a3); - if (mask(y, x_shifted + 4)) - dst.a4 = op(src.a4); - if (mask(y, x_shifted + 5)) - dst.a5 = op(src.a5); - if (mask(y, x_shifted + 6)) - dst.a6 = op(src.a6); - if (mask(y, x_shifted + 7)) - dst.a7 = op(src.a7); - } - - template - static __device__ __forceinline__ void unroll(const T1& src1, const T2& src2, D& dst, const Mask& mask, const BinOp& op, int x_shifted, int y) - { - if (mask(y, x_shifted)) - dst.a0 = op(src1.a0, src2.a0); - if (mask(y, x_shifted + 1)) - dst.a1 = op(src1.a1, src2.a1); - if (mask(y, x_shifted + 2)) - dst.a2 = op(src1.a2, src2.a2); - if (mask(y, x_shifted + 3)) - dst.a3 = op(src1.a3, src2.a3); - if (mask(y, x_shifted + 4)) - dst.a4 = op(src1.a4, src2.a4); - if (mask(y, x_shifted + 5)) - dst.a5 = op(src1.a5, src2.a5); - if (mask(y, x_shifted + 6)) - dst.a6 = op(src1.a6, src2.a6); - if (mask(y, x_shifted + 7)) - dst.a7 = op(src1.a7, src2.a7); - } - }; - - template - static __global__ void transformSmart(const PtrStepSz src_, PtrStep dst_, const Mask mask, const UnOp op) - { - typedef TransformFunctorTraits ft; - typedef typename UnaryReadWriteTraits::read_type read_type; - typedef typename UnaryReadWriteTraits::write_type write_type; - - const int x = threadIdx.x + blockIdx.x * blockDim.x; - const int y = threadIdx.y + blockIdx.y * blockDim.y; - const int x_shifted = x * ft::smart_shift; - - if (y < src_.rows) - { - const T* src = src_.ptr(y); - D* dst = dst_.ptr(y); - - if (x_shifted + ft::smart_shift - 1 < src_.cols) - { - const read_type src_n_el = ((const read_type*)src)[x]; - OpUnroller::unroll(src_n_el, ((write_type*)dst)[x], mask, op, x_shifted, y); - } - else - { - for (int real_x = x_shifted; real_x < src_.cols; ++real_x) - { - if (mask(y, real_x)) - dst[real_x] = op(src[real_x]); - } - } - } - } - - template - __global__ static void transformSimple(const PtrStepSz src, PtrStep dst, const Mask mask, const UnOp op) - { - const int x = blockDim.x * blockIdx.x + threadIdx.x; - const int y = blockDim.y * blockIdx.y + threadIdx.y; - - if (x < src.cols && y < src.rows && mask(y, x)) - { - dst.ptr(y)[x] = op(src.ptr(y)[x]); - } - } - - template - static __global__ void transformSmart(const PtrStepSz src1_, const PtrStep src2_, PtrStep dst_, - const Mask mask, const BinOp op) - { - typedef TransformFunctorTraits ft; - typedef typename BinaryReadWriteTraits::read_type1 read_type1; - typedef typename BinaryReadWriteTraits::read_type2 read_type2; - typedef typename BinaryReadWriteTraits::write_type write_type; - - const int x = threadIdx.x + blockIdx.x * blockDim.x; - const int y = threadIdx.y + blockIdx.y * blockDim.y; - const int x_shifted = x * ft::smart_shift; - - if (y < src1_.rows) - { - const T1* src1 = src1_.ptr(y); - const T2* src2 = src2_.ptr(y); - D* dst = dst_.ptr(y); - - if (x_shifted + ft::smart_shift - 1 < src1_.cols) - { - const read_type1 src1_n_el = ((const read_type1*)src1)[x]; - const read_type2 src2_n_el = ((const read_type2*)src2)[x]; - - OpUnroller::unroll(src1_n_el, src2_n_el, ((write_type*)dst)[x], mask, op, x_shifted, y); - } - else - { - for (int real_x = x_shifted; real_x < src1_.cols; ++real_x) - { - if (mask(y, real_x)) - dst[real_x] = op(src1[real_x], src2[real_x]); - } - } - } - } - - template - static __global__ void transformSimple(const PtrStepSz src1, const PtrStep src2, PtrStep dst, - const Mask mask, const BinOp op) - { - const int x = blockDim.x * blockIdx.x + threadIdx.x; - const int y = blockDim.y * blockIdx.y + threadIdx.y; - - if (x < src1.cols && y < src1.rows && mask(y, x)) - { - const T1 src1_data = src1.ptr(y)[x]; - const T2 src2_data = src2.ptr(y)[x]; - dst.ptr(y)[x] = op(src1_data, src2_data); - } - } - - template struct TransformDispatcher; - template<> struct TransformDispatcher - { - template - static void call(PtrStepSz src, PtrStepSz dst, UnOp op, Mask mask, cudaStream_t stream) - { - typedef TransformFunctorTraits ft; - - const dim3 threads(ft::simple_block_dim_x, ft::simple_block_dim_y, 1); - const dim3 grid(divUp(src.cols, threads.x), divUp(src.rows, threads.y), 1); - - transformSimple<<>>(src, dst, mask, op); - cudaSafeCall( cudaGetLastError() ); - - if (stream == 0) - cudaSafeCall( cudaDeviceSynchronize() ); - } - - template - static void call(PtrStepSz src1, PtrStepSz src2, PtrStepSz dst, BinOp op, Mask mask, cudaStream_t stream) - { - typedef TransformFunctorTraits ft; - - const dim3 threads(ft::simple_block_dim_x, ft::simple_block_dim_y, 1); - const dim3 grid(divUp(src1.cols, threads.x), divUp(src1.rows, threads.y), 1); - - transformSimple<<>>(src1, src2, dst, mask, op); - cudaSafeCall( cudaGetLastError() ); - - if (stream == 0) - cudaSafeCall( cudaDeviceSynchronize() ); - } - }; - template<> struct TransformDispatcher - { - template - static void call(PtrStepSz src, PtrStepSz dst, UnOp op, Mask mask, cudaStream_t stream) - { - typedef TransformFunctorTraits ft; - - CV_StaticAssert(ft::smart_shift != 1, ""); - - if (!isAligned(src.data, ft::smart_shift * sizeof(T)) || !isAligned(src.step, ft::smart_shift * sizeof(T)) || - !isAligned(dst.data, ft::smart_shift * sizeof(D)) || !isAligned(dst.step, ft::smart_shift * sizeof(D))) - { - TransformDispatcher::call(src, dst, op, mask, stream); - return; - } - - const dim3 threads(ft::smart_block_dim_x, ft::smart_block_dim_y, 1); - const dim3 grid(divUp(src.cols, threads.x * ft::smart_shift), divUp(src.rows, threads.y), 1); - - transformSmart<<>>(src, dst, mask, op); - cudaSafeCall( cudaGetLastError() ); - - if (stream == 0) - cudaSafeCall( cudaDeviceSynchronize() ); - } - - template - static void call(PtrStepSz src1, PtrStepSz src2, PtrStepSz dst, BinOp op, Mask mask, cudaStream_t stream) - { - typedef TransformFunctorTraits ft; - - CV_StaticAssert(ft::smart_shift != 1, ""); - - if (!isAligned(src1.data, ft::smart_shift * sizeof(T1)) || !isAligned(src1.step, ft::smart_shift * sizeof(T1)) || - !isAligned(src2.data, ft::smart_shift * sizeof(T2)) || !isAligned(src2.step, ft::smart_shift * sizeof(T2)) || - !isAligned(dst.data, ft::smart_shift * sizeof(D)) || !isAligned(dst.step, ft::smart_shift * sizeof(D))) - { - TransformDispatcher::call(src1, src2, dst, op, mask, stream); - return; - } - - const dim3 threads(ft::smart_block_dim_x, ft::smart_block_dim_y, 1); - const dim3 grid(divUp(src1.cols, threads.x * ft::smart_shift), divUp(src1.rows, threads.y), 1); - - transformSmart<<>>(src1, src2, dst, mask, op); - cudaSafeCall( cudaGetLastError() ); - - if (stream == 0) - cudaSafeCall( cudaDeviceSynchronize() ); - } - }; - } // namespace transform_detail -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif // OPENCV_CUDA_TRANSFORM_DETAIL_HPP diff --git a/opencv/include/opencv2/core/cuda/detail/type_traits_detail.hpp b/opencv/include/opencv2/core/cuda/detail/type_traits_detail.hpp deleted file mode 100644 index a78bd2c..0000000 --- a/opencv/include/opencv2/core/cuda/detail/type_traits_detail.hpp +++ /dev/null @@ -1,191 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_TYPE_TRAITS_DETAIL_HPP -#define OPENCV_CUDA_TYPE_TRAITS_DETAIL_HPP - -#include "../common.hpp" -#include "../vec_traits.hpp" - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - namespace type_traits_detail - { - template struct Select { typedef T1 type; }; - template struct Select { typedef T2 type; }; - - template struct IsSignedIntergral { enum {value = 0}; }; - template <> struct IsSignedIntergral { enum {value = 1}; }; - template <> struct IsSignedIntergral { enum {value = 1}; }; - template <> struct IsSignedIntergral { enum {value = 1}; }; - template <> struct IsSignedIntergral { enum {value = 1}; }; - template <> struct IsSignedIntergral { enum {value = 1}; }; - template <> struct IsSignedIntergral { enum {value = 1}; }; - - template struct IsUnsignedIntegral { enum {value = 0}; }; - template <> struct IsUnsignedIntegral { enum {value = 1}; }; - template <> struct IsUnsignedIntegral { enum {value = 1}; }; - template <> struct IsUnsignedIntegral { enum {value = 1}; }; - template <> struct IsUnsignedIntegral { enum {value = 1}; }; - template <> struct IsUnsignedIntegral { enum {value = 1}; }; - template <> struct IsUnsignedIntegral { enum {value = 1}; }; - - template struct IsIntegral { enum {value = IsSignedIntergral::value || IsUnsignedIntegral::value}; }; - template <> struct IsIntegral { enum {value = 1}; }; - template <> struct IsIntegral { enum {value = 1}; }; - - template struct IsFloat { enum {value = 0}; }; - template <> struct IsFloat { enum {value = 1}; }; - template <> struct IsFloat { enum {value = 1}; }; - - template struct IsVec { enum {value = 0}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - template <> struct IsVec { enum {value = 1}; }; - - template struct AddParameterType { typedef const U& type; }; - template struct AddParameterType { typedef U& type; }; - template <> struct AddParameterType { typedef void type; }; - - template struct ReferenceTraits - { - enum { value = false }; - typedef U type; - }; - template struct ReferenceTraits - { - enum { value = true }; - typedef U type; - }; - - template struct PointerTraits - { - enum { value = false }; - typedef void type; - }; - template struct PointerTraits - { - enum { value = true }; - typedef U type; - }; - template struct PointerTraits - { - enum { value = true }; - typedef U type; - }; - - template struct UnConst - { - typedef U type; - enum { value = 0 }; - }; - template struct UnConst - { - typedef U type; - enum { value = 1 }; - }; - template struct UnConst - { - typedef U& type; - enum { value = 1 }; - }; - - template struct UnVolatile - { - typedef U type; - enum { value = 0 }; - }; - template struct UnVolatile - { - typedef U type; - enum { value = 1 }; - }; - template struct UnVolatile - { - typedef U& type; - enum { value = 1 }; - }; - } // namespace type_traits_detail -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif // OPENCV_CUDA_TYPE_TRAITS_DETAIL_HPP diff --git a/opencv/include/opencv2/core/cuda/detail/vec_distance_detail.hpp b/opencv/include/opencv2/core/cuda/detail/vec_distance_detail.hpp deleted file mode 100644 index 8283a99..0000000 --- a/opencv/include/opencv2/core/cuda/detail/vec_distance_detail.hpp +++ /dev/null @@ -1,121 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_VEC_DISTANCE_DETAIL_HPP -#define OPENCV_CUDA_VEC_DISTANCE_DETAIL_HPP - -#include "../datamov_utils.hpp" - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - namespace vec_distance_detail - { - template struct UnrollVecDiffCached - { - template - static __device__ void calcCheck(const T1* vecCached, const T2* vecGlob, int len, Dist& dist, int ind) - { - if (ind < len) - { - T1 val1 = *vecCached++; - - T2 val2; - ForceGlob::Load(vecGlob, ind, val2); - - dist.reduceIter(val1, val2); - - UnrollVecDiffCached::calcCheck(vecCached, vecGlob, len, dist, ind + THREAD_DIM); - } - } - - template - static __device__ void calcWithoutCheck(const T1* vecCached, const T2* vecGlob, Dist& dist) - { - T1 val1 = *vecCached++; - - T2 val2; - ForceGlob::Load(vecGlob, 0, val2); - vecGlob += THREAD_DIM; - - dist.reduceIter(val1, val2); - - UnrollVecDiffCached::calcWithoutCheck(vecCached, vecGlob, dist); - } - }; - template struct UnrollVecDiffCached - { - template - static __device__ __forceinline__ void calcCheck(const T1*, const T2*, int, Dist&, int) - { - } - - template - static __device__ __forceinline__ void calcWithoutCheck(const T1*, const T2*, Dist&) - { - } - }; - - template struct VecDiffCachedCalculator; - template struct VecDiffCachedCalculator - { - template - static __device__ __forceinline__ void calc(const T1* vecCached, const T2* vecGlob, int len, Dist& dist, int tid) - { - UnrollVecDiffCached::calcCheck(vecCached, vecGlob, len, dist, tid); - } - }; - template struct VecDiffCachedCalculator - { - template - static __device__ __forceinline__ void calc(const T1* vecCached, const T2* vecGlob, int len, Dist& dist, int tid) - { - UnrollVecDiffCached::calcWithoutCheck(vecCached, vecGlob + tid, dist); - } - }; - } // namespace vec_distance_detail -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif // OPENCV_CUDA_VEC_DISTANCE_DETAIL_HPP diff --git a/opencv/include/opencv2/core/cuda/dynamic_smem.hpp b/opencv/include/opencv2/core/cuda/dynamic_smem.hpp deleted file mode 100644 index 42570c6..0000000 --- a/opencv/include/opencv2/core/cuda/dynamic_smem.hpp +++ /dev/null @@ -1,88 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_DYNAMIC_SMEM_HPP -#define OPENCV_CUDA_DYNAMIC_SMEM_HPP - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - template struct DynamicSharedMem - { - __device__ __forceinline__ operator T*() - { - extern __shared__ int __smem[]; - return (T*)__smem; - } - - __device__ __forceinline__ operator const T*() const - { - extern __shared__ int __smem[]; - return (T*)__smem; - } - }; - - // specialize for double to avoid unaligned memory access compile errors - template<> struct DynamicSharedMem - { - __device__ __forceinline__ operator double*() - { - extern __shared__ double __smem_d[]; - return (double*)__smem_d; - } - - __device__ __forceinline__ operator const double*() const - { - extern __shared__ double __smem_d[]; - return (double*)__smem_d; - } - }; -}}} - -//! @endcond - -#endif // OPENCV_CUDA_DYNAMIC_SMEM_HPP diff --git a/opencv/include/opencv2/core/cuda/emulation.hpp b/opencv/include/opencv2/core/cuda/emulation.hpp deleted file mode 100644 index 17dc117..0000000 --- a/opencv/include/opencv2/core/cuda/emulation.hpp +++ /dev/null @@ -1,269 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_EMULATION_HPP_ -#define OPENCV_CUDA_EMULATION_HPP_ - -#include "common.hpp" -#include "warp_reduce.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - struct Emulation - { - - static __device__ __forceinline__ int syncthreadsOr(int pred) - { -#if defined (__CUDA_ARCH__) && (__CUDA_ARCH__ < 200) - // just campilation stab - return 0; -#else - return __syncthreads_or(pred); -#endif - } - - template - static __forceinline__ __device__ int Ballot(int predicate) - { -#if defined (__CUDA_ARCH__) && (__CUDA_ARCH__ >= 200) - return __ballot(predicate); -#else - __shared__ volatile int cta_buffer[CTA_SIZE]; - - int tid = threadIdx.x; - cta_buffer[tid] = predicate ? (1 << (tid & 31)) : 0; - return warp_reduce(cta_buffer); -#endif - } - - struct smem - { - enum { TAG_MASK = (1U << ( (sizeof(unsigned int) << 3) - 5U)) - 1U }; - - template - static __device__ __forceinline__ T atomicInc(T* address, T val) - { -#if defined (__CUDA_ARCH__) && (__CUDA_ARCH__ < 120) - T count; - unsigned int tag = threadIdx.x << ( (sizeof(unsigned int) << 3) - 5U); - do - { - count = *address & TAG_MASK; - count = tag | (count + 1); - *address = count; - } while (*address != count); - - return (count & TAG_MASK) - 1; -#else - return ::atomicInc(address, val); -#endif - } - - template - static __device__ __forceinline__ T atomicAdd(T* address, T val) - { -#if defined (__CUDA_ARCH__) && (__CUDA_ARCH__ < 120) - T count; - unsigned int tag = threadIdx.x << ( (sizeof(unsigned int) << 3) - 5U); - do - { - count = *address & TAG_MASK; - count = tag | (count + val); - *address = count; - } while (*address != count); - - return (count & TAG_MASK) - val; -#else - return ::atomicAdd(address, val); -#endif - } - - template - static __device__ __forceinline__ T atomicMin(T* address, T val) - { -#if defined (__CUDA_ARCH__) && (__CUDA_ARCH__ < 120) - T count = ::min(*address, val); - do - { - *address = count; - } while (*address > count); - - return count; -#else - return ::atomicMin(address, val); -#endif - } - }; // struct cmem - - struct glob - { - static __device__ __forceinline__ int atomicAdd(int* address, int val) - { - return ::atomicAdd(address, val); - } - static __device__ __forceinline__ unsigned int atomicAdd(unsigned int* address, unsigned int val) - { - return ::atomicAdd(address, val); - } - static __device__ __forceinline__ float atomicAdd(float* address, float val) - { - #if __CUDA_ARCH__ >= 200 - return ::atomicAdd(address, val); - #else - int* address_as_i = (int*) address; - int old = *address_as_i, assumed; - do { - assumed = old; - old = ::atomicCAS(address_as_i, assumed, - __float_as_int(val + __int_as_float(assumed))); - } while (assumed != old); - return __int_as_float(old); - #endif - } - static __device__ __forceinline__ double atomicAdd(double* address, double val) - { - #if __CUDA_ARCH__ >= 130 - unsigned long long int* address_as_ull = (unsigned long long int*) address; - unsigned long long int old = *address_as_ull, assumed; - do { - assumed = old; - old = ::atomicCAS(address_as_ull, assumed, - __double_as_longlong(val + __longlong_as_double(assumed))); - } while (assumed != old); - return __longlong_as_double(old); - #else - CV_UNUSED(address); - CV_UNUSED(val); - return 0.0; - #endif - } - - static __device__ __forceinline__ int atomicMin(int* address, int val) - { - return ::atomicMin(address, val); - } - static __device__ __forceinline__ float atomicMin(float* address, float val) - { - #if __CUDA_ARCH__ >= 120 - int* address_as_i = (int*) address; - int old = *address_as_i, assumed; - do { - assumed = old; - old = ::atomicCAS(address_as_i, assumed, - __float_as_int(::fminf(val, __int_as_float(assumed)))); - } while (assumed != old); - return __int_as_float(old); - #else - CV_UNUSED(address); - CV_UNUSED(val); - return 0.0f; - #endif - } - static __device__ __forceinline__ double atomicMin(double* address, double val) - { - #if __CUDA_ARCH__ >= 130 - unsigned long long int* address_as_ull = (unsigned long long int*) address; - unsigned long long int old = *address_as_ull, assumed; - do { - assumed = old; - old = ::atomicCAS(address_as_ull, assumed, - __double_as_longlong(::fmin(val, __longlong_as_double(assumed)))); - } while (assumed != old); - return __longlong_as_double(old); - #else - CV_UNUSED(address); - CV_UNUSED(val); - return 0.0; - #endif - } - - static __device__ __forceinline__ int atomicMax(int* address, int val) - { - return ::atomicMax(address, val); - } - static __device__ __forceinline__ float atomicMax(float* address, float val) - { - #if __CUDA_ARCH__ >= 120 - int* address_as_i = (int*) address; - int old = *address_as_i, assumed; - do { - assumed = old; - old = ::atomicCAS(address_as_i, assumed, - __float_as_int(::fmaxf(val, __int_as_float(assumed)))); - } while (assumed != old); - return __int_as_float(old); - #else - CV_UNUSED(address); - CV_UNUSED(val); - return 0.0f; - #endif - } - static __device__ __forceinline__ double atomicMax(double* address, double val) - { - #if __CUDA_ARCH__ >= 130 - unsigned long long int* address_as_ull = (unsigned long long int*) address; - unsigned long long int old = *address_as_ull, assumed; - do { - assumed = old; - old = ::atomicCAS(address_as_ull, assumed, - __double_as_longlong(::fmax(val, __longlong_as_double(assumed)))); - } while (assumed != old); - return __longlong_as_double(old); - #else - CV_UNUSED(address); - CV_UNUSED(val); - return 0.0; - #endif - } - }; - }; //struct Emulation -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif /* OPENCV_CUDA_EMULATION_HPP_ */ diff --git a/opencv/include/opencv2/core/cuda/filters.hpp b/opencv/include/opencv2/core/cuda/filters.hpp deleted file mode 100644 index bb94212..0000000 --- a/opencv/include/opencv2/core/cuda/filters.hpp +++ /dev/null @@ -1,286 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_FILTERS_HPP -#define OPENCV_CUDA_FILTERS_HPP - -#include "saturate_cast.hpp" -#include "vec_traits.hpp" -#include "vec_math.hpp" -#include "type_traits.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - template struct PointFilter - { - typedef typename Ptr2D::elem_type elem_type; - typedef float index_type; - - explicit __host__ __device__ __forceinline__ PointFilter(const Ptr2D& src_, float fx = 0.f, float fy = 0.f) - : src(src_) - { - CV_UNUSED(fx); - CV_UNUSED(fy); - } - - __device__ __forceinline__ elem_type operator ()(float y, float x) const - { - return src(__float2int_rz(y), __float2int_rz(x)); - } - - Ptr2D src; - }; - - template struct LinearFilter - { - typedef typename Ptr2D::elem_type elem_type; - typedef float index_type; - - explicit __host__ __device__ __forceinline__ LinearFilter(const Ptr2D& src_, float fx = 0.f, float fy = 0.f) - : src(src_) - { - CV_UNUSED(fx); - CV_UNUSED(fy); - } - __device__ __forceinline__ elem_type operator ()(float y, float x) const - { - typedef typename TypeVec::cn>::vec_type work_type; - - work_type out = VecTraits::all(0); - - const int x1 = __float2int_rd(x); - const int y1 = __float2int_rd(y); - const int x2 = x1 + 1; - const int y2 = y1 + 1; - - elem_type src_reg = src(y1, x1); - out = out + src_reg * ((x2 - x) * (y2 - y)); - - src_reg = src(y1, x2); - out = out + src_reg * ((x - x1) * (y2 - y)); - - src_reg = src(y2, x1); - out = out + src_reg * ((x2 - x) * (y - y1)); - - src_reg = src(y2, x2); - out = out + src_reg * ((x - x1) * (y - y1)); - - return saturate_cast(out); - } - - Ptr2D src; - }; - - template struct CubicFilter - { - typedef typename Ptr2D::elem_type elem_type; - typedef float index_type; - typedef typename TypeVec::cn>::vec_type work_type; - - explicit __host__ __device__ __forceinline__ CubicFilter(const Ptr2D& src_, float fx = 0.f, float fy = 0.f) - : src(src_) - { - CV_UNUSED(fx); - CV_UNUSED(fy); - } - - static __device__ __forceinline__ float bicubicCoeff(float x_) - { - float x = fabsf(x_); - if (x <= 1.0f) - { - return x * x * (1.5f * x - 2.5f) + 1.0f; - } - else if (x < 2.0f) - { - return x * (x * (-0.5f * x + 2.5f) - 4.0f) + 2.0f; - } - else - { - return 0.0f; - } - } - - __device__ elem_type operator ()(float y, float x) const - { - const float xmin = ::ceilf(x - 2.0f); - const float xmax = ::floorf(x + 2.0f); - - const float ymin = ::ceilf(y - 2.0f); - const float ymax = ::floorf(y + 2.0f); - - work_type sum = VecTraits::all(0); - float wsum = 0.0f; - - for (float cy = ymin; cy <= ymax; cy += 1.0f) - { - for (float cx = xmin; cx <= xmax; cx += 1.0f) - { - const float w = bicubicCoeff(x - cx) * bicubicCoeff(y - cy); - sum = sum + w * src(__float2int_rd(cy), __float2int_rd(cx)); - wsum += w; - } - } - - work_type res = (!wsum)? VecTraits::all(0) : sum / wsum; - - return saturate_cast(res); - } - - Ptr2D src; - }; - // for integer scaling - template struct IntegerAreaFilter - { - typedef typename Ptr2D::elem_type elem_type; - typedef float index_type; - - explicit __host__ __device__ __forceinline__ IntegerAreaFilter(const Ptr2D& src_, float scale_x_, float scale_y_) - : src(src_), scale_x(scale_x_), scale_y(scale_y_), scale(1.f / (scale_x * scale_y)) {} - - __device__ __forceinline__ elem_type operator ()(float y, float x) const - { - float fsx1 = x * scale_x; - float fsx2 = fsx1 + scale_x; - - int sx1 = __float2int_ru(fsx1); - int sx2 = __float2int_rd(fsx2); - - float fsy1 = y * scale_y; - float fsy2 = fsy1 + scale_y; - - int sy1 = __float2int_ru(fsy1); - int sy2 = __float2int_rd(fsy2); - - typedef typename TypeVec::cn>::vec_type work_type; - work_type out = VecTraits::all(0.f); - - for(int dy = sy1; dy < sy2; ++dy) - for(int dx = sx1; dx < sx2; ++dx) - { - out = out + src(dy, dx) * scale; - } - - return saturate_cast(out); - } - - Ptr2D src; - float scale_x, scale_y ,scale; - }; - - template struct AreaFilter - { - typedef typename Ptr2D::elem_type elem_type; - typedef float index_type; - - explicit __host__ __device__ __forceinline__ AreaFilter(const Ptr2D& src_, float scale_x_, float scale_y_) - : src(src_), scale_x(scale_x_), scale_y(scale_y_){} - - __device__ __forceinline__ elem_type operator ()(float y, float x) const - { - float fsx1 = x * scale_x; - float fsx2 = fsx1 + scale_x; - - int sx1 = __float2int_ru(fsx1); - int sx2 = __float2int_rd(fsx2); - - float fsy1 = y * scale_y; - float fsy2 = fsy1 + scale_y; - - int sy1 = __float2int_ru(fsy1); - int sy2 = __float2int_rd(fsy2); - - float scale = 1.f / (fminf(scale_x, src.width - fsx1) * fminf(scale_y, src.height - fsy1)); - - typedef typename TypeVec::cn>::vec_type work_type; - work_type out = VecTraits::all(0.f); - - for (int dy = sy1; dy < sy2; ++dy) - { - for (int dx = sx1; dx < sx2; ++dx) - out = out + src(dy, dx) * scale; - - if (sx1 > fsx1) - out = out + src(dy, (sx1 -1) ) * ((sx1 - fsx1) * scale); - - if (sx2 < fsx2) - out = out + src(dy, sx2) * ((fsx2 -sx2) * scale); - } - - if (sy1 > fsy1) - for (int dx = sx1; dx < sx2; ++dx) - out = out + src( (sy1 - 1) , dx) * ((sy1 -fsy1) * scale); - - if (sy2 < fsy2) - for (int dx = sx1; dx < sx2; ++dx) - out = out + src(sy2, dx) * ((fsy2 -sy2) * scale); - - if ((sy1 > fsy1) && (sx1 > fsx1)) - out = out + src( (sy1 - 1) , (sx1 - 1)) * ((sy1 -fsy1) * (sx1 -fsx1) * scale); - - if ((sy1 > fsy1) && (sx2 < fsx2)) - out = out + src( (sy1 - 1) , sx2) * ((sy1 -fsy1) * (fsx2 -sx2) * scale); - - if ((sy2 < fsy2) && (sx2 < fsx2)) - out = out + src(sy2, sx2) * ((fsy2 -sy2) * (fsx2 -sx2) * scale); - - if ((sy2 < fsy2) && (sx1 > fsx1)) - out = out + src(sy2, (sx1 - 1)) * ((fsy2 -sy2) * (sx1 -fsx1) * scale); - - return saturate_cast(out); - } - - Ptr2D src; - float scale_x, scale_y; - int width, haight; - }; -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif // OPENCV_CUDA_FILTERS_HPP diff --git a/opencv/include/opencv2/core/cuda/funcattrib.hpp b/opencv/include/opencv2/core/cuda/funcattrib.hpp deleted file mode 100644 index f582080..0000000 --- a/opencv/include/opencv2/core/cuda/funcattrib.hpp +++ /dev/null @@ -1,79 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP -#define OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP - -#include - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - template - void printFuncAttrib(Func& func) - { - - cudaFuncAttributes attrs; - cudaFuncGetAttributes(&attrs, func); - - printf("=== Function stats ===\n"); - printf("Name: \n"); - printf("sharedSizeBytes = %d\n", attrs.sharedSizeBytes); - printf("constSizeBytes = %d\n", attrs.constSizeBytes); - printf("localSizeBytes = %d\n", attrs.localSizeBytes); - printf("maxThreadsPerBlock = %d\n", attrs.maxThreadsPerBlock); - printf("numRegs = %d\n", attrs.numRegs); - printf("ptxVersion = %d\n", attrs.ptxVersion); - printf("binaryVersion = %d\n", attrs.binaryVersion); - printf("\n"); - fflush(stdout); - } -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif /* OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP */ diff --git a/opencv/include/opencv2/core/cuda/functional.hpp b/opencv/include/opencv2/core/cuda/functional.hpp deleted file mode 100644 index 3b531a1..0000000 --- a/opencv/include/opencv2/core/cuda/functional.hpp +++ /dev/null @@ -1,810 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_FUNCTIONAL_HPP -#define OPENCV_CUDA_FUNCTIONAL_HPP - -#include -#include "saturate_cast.hpp" -#include "vec_traits.hpp" -#include "type_traits.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - // Function Objects -#ifdef CV_CXX11 - template struct unary_function - { - typedef Argument argument_type; - typedef Result result_type; - }; - template struct binary_function - { - typedef Argument1 first_argument_type; - typedef Argument2 second_argument_type; - typedef Result result_type; - }; -#else - template struct unary_function : public std::unary_function {}; - template struct binary_function : public std::binary_function {}; -#endif - - // Arithmetic Operations - template struct plus : binary_function - { - __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a + b; - } - __host__ __device__ __forceinline__ plus() {} - __host__ __device__ __forceinline__ plus(const plus&) {} - }; - - template struct minus : binary_function - { - __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a - b; - } - __host__ __device__ __forceinline__ minus() {} - __host__ __device__ __forceinline__ minus(const minus&) {} - }; - - template struct multiplies : binary_function - { - __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a * b; - } - __host__ __device__ __forceinline__ multiplies() {} - __host__ __device__ __forceinline__ multiplies(const multiplies&) {} - }; - - template struct divides : binary_function - { - __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a / b; - } - __host__ __device__ __forceinline__ divides() {} - __host__ __device__ __forceinline__ divides(const divides&) {} - }; - - template struct modulus : binary_function - { - __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a % b; - } - __host__ __device__ __forceinline__ modulus() {} - __host__ __device__ __forceinline__ modulus(const modulus&) {} - }; - - template struct negate : unary_function - { - __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a) const - { - return -a; - } - __host__ __device__ __forceinline__ negate() {} - __host__ __device__ __forceinline__ negate(const negate&) {} - }; - - // Comparison Operations - template struct equal_to : binary_function - { - __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a == b; - } - __host__ __device__ __forceinline__ equal_to() {} - __host__ __device__ __forceinline__ equal_to(const equal_to&) {} - }; - - template struct not_equal_to : binary_function - { - __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a != b; - } - __host__ __device__ __forceinline__ not_equal_to() {} - __host__ __device__ __forceinline__ not_equal_to(const not_equal_to&) {} - }; - - template struct greater : binary_function - { - __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a > b; - } - __host__ __device__ __forceinline__ greater() {} - __host__ __device__ __forceinline__ greater(const greater&) {} - }; - - template struct less : binary_function - { - __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a < b; - } - __host__ __device__ __forceinline__ less() {} - __host__ __device__ __forceinline__ less(const less&) {} - }; - - template struct greater_equal : binary_function - { - __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a >= b; - } - __host__ __device__ __forceinline__ greater_equal() {} - __host__ __device__ __forceinline__ greater_equal(const greater_equal&) {} - }; - - template struct less_equal : binary_function - { - __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a <= b; - } - __host__ __device__ __forceinline__ less_equal() {} - __host__ __device__ __forceinline__ less_equal(const less_equal&) {} - }; - - // Logical Operations - template struct logical_and : binary_function - { - __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a && b; - } - __host__ __device__ __forceinline__ logical_and() {} - __host__ __device__ __forceinline__ logical_and(const logical_and&) {} - }; - - template struct logical_or : binary_function - { - __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a || b; - } - __host__ __device__ __forceinline__ logical_or() {} - __host__ __device__ __forceinline__ logical_or(const logical_or&) {} - }; - - template struct logical_not : unary_function - { - __device__ __forceinline__ bool operator ()(typename TypeTraits::ParameterType a) const - { - return !a; - } - __host__ __device__ __forceinline__ logical_not() {} - __host__ __device__ __forceinline__ logical_not(const logical_not&) {} - }; - - // Bitwise Operations - template struct bit_and : binary_function - { - __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a & b; - } - __host__ __device__ __forceinline__ bit_and() {} - __host__ __device__ __forceinline__ bit_and(const bit_and&) {} - }; - - template struct bit_or : binary_function - { - __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a | b; - } - __host__ __device__ __forceinline__ bit_or() {} - __host__ __device__ __forceinline__ bit_or(const bit_or&) {} - }; - - template struct bit_xor : binary_function - { - __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType a, - typename TypeTraits::ParameterType b) const - { - return a ^ b; - } - __host__ __device__ __forceinline__ bit_xor() {} - __host__ __device__ __forceinline__ bit_xor(const bit_xor&) {} - }; - - template struct bit_not : unary_function - { - __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType v) const - { - return ~v; - } - __host__ __device__ __forceinline__ bit_not() {} - __host__ __device__ __forceinline__ bit_not(const bit_not&) {} - }; - - // Generalized Identity Operations - template struct identity : unary_function - { - __device__ __forceinline__ typename TypeTraits::ParameterType operator()(typename TypeTraits::ParameterType x) const - { - return x; - } - __host__ __device__ __forceinline__ identity() {} - __host__ __device__ __forceinline__ identity(const identity&) {} - }; - - template struct project1st : binary_function - { - __device__ __forceinline__ typename TypeTraits::ParameterType operator()(typename TypeTraits::ParameterType lhs, typename TypeTraits::ParameterType rhs) const - { - return lhs; - } - __host__ __device__ __forceinline__ project1st() {} - __host__ __device__ __forceinline__ project1st(const project1st&) {} - }; - - template struct project2nd : binary_function - { - __device__ __forceinline__ typename TypeTraits::ParameterType operator()(typename TypeTraits::ParameterType lhs, typename TypeTraits::ParameterType rhs) const - { - return rhs; - } - __host__ __device__ __forceinline__ project2nd() {} - __host__ __device__ __forceinline__ project2nd(const project2nd&) {} - }; - - // Min/Max Operations - -#define OPENCV_CUDA_IMPLEMENT_MINMAX(name, type, op) \ - template <> struct name : binary_function \ - { \ - __device__ __forceinline__ type operator()(type lhs, type rhs) const {return op(lhs, rhs);} \ - __host__ __device__ __forceinline__ name() {}\ - __host__ __device__ __forceinline__ name(const name&) {}\ - }; - - template struct maximum : binary_function - { - __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType lhs, typename TypeTraits::ParameterType rhs) const - { - return max(lhs, rhs); - } - __host__ __device__ __forceinline__ maximum() {} - __host__ __device__ __forceinline__ maximum(const maximum&) {} - }; - - OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, uchar, ::max) - OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, schar, ::max) - OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, char, ::max) - OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, ushort, ::max) - OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, short, ::max) - OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, int, ::max) - OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, uint, ::max) - OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, float, ::fmax) - OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, double, ::fmax) - - template struct minimum : binary_function - { - __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType lhs, typename TypeTraits::ParameterType rhs) const - { - return min(lhs, rhs); - } - __host__ __device__ __forceinline__ minimum() {} - __host__ __device__ __forceinline__ minimum(const minimum&) {} - }; - - OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, uchar, ::min) - OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, schar, ::min) - OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, char, ::min) - OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, ushort, ::min) - OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, short, ::min) - OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, int, ::min) - OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, uint, ::min) - OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, float, ::fmin) - OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, double, ::fmin) - -#undef OPENCV_CUDA_IMPLEMENT_MINMAX - - // Math functions - - template struct abs_func : unary_function - { - __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType x) const - { - return abs(x); - } - - __host__ __device__ __forceinline__ abs_func() {} - __host__ __device__ __forceinline__ abs_func(const abs_func&) {} - }; - template <> struct abs_func : unary_function - { - __device__ __forceinline__ unsigned char operator ()(unsigned char x) const - { - return x; - } - - __host__ __device__ __forceinline__ abs_func() {} - __host__ __device__ __forceinline__ abs_func(const abs_func&) {} - }; - template <> struct abs_func : unary_function - { - __device__ __forceinline__ signed char operator ()(signed char x) const - { - return ::abs((int)x); - } - - __host__ __device__ __forceinline__ abs_func() {} - __host__ __device__ __forceinline__ abs_func(const abs_func&) {} - }; - template <> struct abs_func : unary_function - { - __device__ __forceinline__ char operator ()(char x) const - { - return ::abs((int)x); - } - - __host__ __device__ __forceinline__ abs_func() {} - __host__ __device__ __forceinline__ abs_func(const abs_func&) {} - }; - template <> struct abs_func : unary_function - { - __device__ __forceinline__ unsigned short operator ()(unsigned short x) const - { - return x; - } - - __host__ __device__ __forceinline__ abs_func() {} - __host__ __device__ __forceinline__ abs_func(const abs_func&) {} - }; - template <> struct abs_func : unary_function - { - __device__ __forceinline__ short operator ()(short x) const - { - return ::abs((int)x); - } - - __host__ __device__ __forceinline__ abs_func() {} - __host__ __device__ __forceinline__ abs_func(const abs_func&) {} - }; - template <> struct abs_func : unary_function - { - __device__ __forceinline__ unsigned int operator ()(unsigned int x) const - { - return x; - } - - __host__ __device__ __forceinline__ abs_func() {} - __host__ __device__ __forceinline__ abs_func(const abs_func&) {} - }; - template <> struct abs_func : unary_function - { - __device__ __forceinline__ int operator ()(int x) const - { - return ::abs(x); - } - - __host__ __device__ __forceinline__ abs_func() {} - __host__ __device__ __forceinline__ abs_func(const abs_func&) {} - }; - template <> struct abs_func : unary_function - { - __device__ __forceinline__ float operator ()(float x) const - { - return ::fabsf(x); - } - - __host__ __device__ __forceinline__ abs_func() {} - __host__ __device__ __forceinline__ abs_func(const abs_func&) {} - }; - template <> struct abs_func : unary_function - { - __device__ __forceinline__ double operator ()(double x) const - { - return ::fabs(x); - } - - __host__ __device__ __forceinline__ abs_func() {} - __host__ __device__ __forceinline__ abs_func(const abs_func&) {} - }; - -#define OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(name, func) \ - template struct name ## _func : unary_function \ - { \ - __device__ __forceinline__ float operator ()(typename TypeTraits::ParameterType v) const \ - { \ - return func ## f(v); \ - } \ - __host__ __device__ __forceinline__ name ## _func() {} \ - __host__ __device__ __forceinline__ name ## _func(const name ## _func&) {} \ - }; \ - template <> struct name ## _func : unary_function \ - { \ - __device__ __forceinline__ double operator ()(double v) const \ - { \ - return func(v); \ - } \ - __host__ __device__ __forceinline__ name ## _func() {} \ - __host__ __device__ __forceinline__ name ## _func(const name ## _func&) {} \ - }; - -#define OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR(name, func) \ - template struct name ## _func : binary_function \ - { \ - __device__ __forceinline__ float operator ()(typename TypeTraits::ParameterType v1, typename TypeTraits::ParameterType v2) const \ - { \ - return func ## f(v1, v2); \ - } \ - __host__ __device__ __forceinline__ name ## _func() {} \ - __host__ __device__ __forceinline__ name ## _func(const name ## _func&) {} \ - }; \ - template <> struct name ## _func : binary_function \ - { \ - __device__ __forceinline__ double operator ()(double v1, double v2) const \ - { \ - return func(v1, v2); \ - } \ - __host__ __device__ __forceinline__ name ## _func() {} \ - __host__ __device__ __forceinline__ name ## _func(const name ## _func&) {} \ - }; - - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(sqrt, ::sqrt) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(exp, ::exp) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(exp2, ::exp2) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(exp10, ::exp10) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(log, ::log) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(log2, ::log2) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(log10, ::log10) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(sin, ::sin) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(cos, ::cos) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(tan, ::tan) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(asin, ::asin) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(acos, ::acos) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(atan, ::atan) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(sinh, ::sinh) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(cosh, ::cosh) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(tanh, ::tanh) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(asinh, ::asinh) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(acosh, ::acosh) - OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(atanh, ::atanh) - - OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR(hypot, ::hypot) - OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR(atan2, ::atan2) - OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR(pow, ::pow) - - #undef OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR - #undef OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR_NO_DOUBLE - #undef OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR - - template struct hypot_sqr_func : binary_function - { - __device__ __forceinline__ T operator ()(typename TypeTraits::ParameterType src1, typename TypeTraits::ParameterType src2) const - { - return src1 * src1 + src2 * src2; - } - __host__ __device__ __forceinline__ hypot_sqr_func() {} - __host__ __device__ __forceinline__ hypot_sqr_func(const hypot_sqr_func&) {} - }; - - // Saturate Cast Functor - template struct saturate_cast_func : unary_function - { - __device__ __forceinline__ D operator ()(typename TypeTraits::ParameterType v) const - { - return saturate_cast(v); - } - __host__ __device__ __forceinline__ saturate_cast_func() {} - __host__ __device__ __forceinline__ saturate_cast_func(const saturate_cast_func&) {} - }; - - // Threshold Functors - template struct thresh_binary_func : unary_function - { - __host__ __device__ __forceinline__ thresh_binary_func(T thresh_, T maxVal_) : thresh(thresh_), maxVal(maxVal_) {} - - __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType src) const - { - return (src > thresh) * maxVal; - } - - __host__ __device__ __forceinline__ thresh_binary_func() {} - __host__ __device__ __forceinline__ thresh_binary_func(const thresh_binary_func& other) - : thresh(other.thresh), maxVal(other.maxVal) {} - - T thresh; - T maxVal; - }; - - template struct thresh_binary_inv_func : unary_function - { - __host__ __device__ __forceinline__ thresh_binary_inv_func(T thresh_, T maxVal_) : thresh(thresh_), maxVal(maxVal_) {} - - __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType src) const - { - return (src <= thresh) * maxVal; - } - - __host__ __device__ __forceinline__ thresh_binary_inv_func() {} - __host__ __device__ __forceinline__ thresh_binary_inv_func(const thresh_binary_inv_func& other) - : thresh(other.thresh), maxVal(other.maxVal) {} - - T thresh; - T maxVal; - }; - - template struct thresh_trunc_func : unary_function - { - explicit __host__ __device__ __forceinline__ thresh_trunc_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {CV_UNUSED(maxVal_);} - - __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType src) const - { - return minimum()(src, thresh); - } - - __host__ __device__ __forceinline__ thresh_trunc_func() {} - __host__ __device__ __forceinline__ thresh_trunc_func(const thresh_trunc_func& other) - : thresh(other.thresh) {} - - T thresh; - }; - - template struct thresh_to_zero_func : unary_function - { - explicit __host__ __device__ __forceinline__ thresh_to_zero_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {CV_UNUSED(maxVal_);} - - __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType src) const - { - return (src > thresh) * src; - } - - __host__ __device__ __forceinline__ thresh_to_zero_func() {} - __host__ __device__ __forceinline__ thresh_to_zero_func(const thresh_to_zero_func& other) - : thresh(other.thresh) {} - - T thresh; - }; - - template struct thresh_to_zero_inv_func : unary_function - { - explicit __host__ __device__ __forceinline__ thresh_to_zero_inv_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {CV_UNUSED(maxVal_);} - - __device__ __forceinline__ T operator()(typename TypeTraits::ParameterType src) const - { - return (src <= thresh) * src; - } - - __host__ __device__ __forceinline__ thresh_to_zero_inv_func() {} - __host__ __device__ __forceinline__ thresh_to_zero_inv_func(const thresh_to_zero_inv_func& other) - : thresh(other.thresh) {} - - T thresh; - }; - - // Function Object Adaptors - template struct unary_negate : unary_function - { - explicit __host__ __device__ __forceinline__ unary_negate(const Predicate& p) : pred(p) {} - - __device__ __forceinline__ bool operator()(typename TypeTraits::ParameterType x) const - { - return !pred(x); - } - - __host__ __device__ __forceinline__ unary_negate() {} - __host__ __device__ __forceinline__ unary_negate(const unary_negate& other) : pred(other.pred) {} - - Predicate pred; - }; - - template __host__ __device__ __forceinline__ unary_negate not1(const Predicate& pred) - { - return unary_negate(pred); - } - - template struct binary_negate : binary_function - { - explicit __host__ __device__ __forceinline__ binary_negate(const Predicate& p) : pred(p) {} - - __device__ __forceinline__ bool operator()(typename TypeTraits::ParameterType x, - typename TypeTraits::ParameterType y) const - { - return !pred(x,y); - } - - __host__ __device__ __forceinline__ binary_negate() {} - __host__ __device__ __forceinline__ binary_negate(const binary_negate& other) : pred(other.pred) {} - - Predicate pred; - }; - - template __host__ __device__ __forceinline__ binary_negate not2(const BinaryPredicate& pred) - { - return binary_negate(pred); - } - - template struct binder1st : unary_function - { - __host__ __device__ __forceinline__ binder1st(const Op& op_, const typename Op::first_argument_type& arg1_) : op(op_), arg1(arg1_) {} - - __device__ __forceinline__ typename Op::result_type operator ()(typename TypeTraits::ParameterType a) const - { - return op(arg1, a); - } - - __host__ __device__ __forceinline__ binder1st() {} - __host__ __device__ __forceinline__ binder1st(const binder1st& other) : op(other.op), arg1(other.arg1) {} - - Op op; - typename Op::first_argument_type arg1; - }; - - template __host__ __device__ __forceinline__ binder1st bind1st(const Op& op, const T& x) - { - return binder1st(op, typename Op::first_argument_type(x)); - } - - template struct binder2nd : unary_function - { - __host__ __device__ __forceinline__ binder2nd(const Op& op_, const typename Op::second_argument_type& arg2_) : op(op_), arg2(arg2_) {} - - __forceinline__ __device__ typename Op::result_type operator ()(typename TypeTraits::ParameterType a) const - { - return op(a, arg2); - } - - __host__ __device__ __forceinline__ binder2nd() {} - __host__ __device__ __forceinline__ binder2nd(const binder2nd& other) : op(other.op), arg2(other.arg2) {} - - Op op; - typename Op::second_argument_type arg2; - }; - - template __host__ __device__ __forceinline__ binder2nd bind2nd(const Op& op, const T& x) - { - return binder2nd(op, typename Op::second_argument_type(x)); - } - - // Functor Traits - template struct IsUnaryFunction - { - typedef char Yes; - struct No {Yes a[2];}; - - template static Yes check(unary_function); - static No check(...); - - static F makeF(); - - enum { value = (sizeof(check(makeF())) == sizeof(Yes)) }; - }; - - template struct IsBinaryFunction - { - typedef char Yes; - struct No {Yes a[2];}; - - template static Yes check(binary_function); - static No check(...); - - static F makeF(); - - enum { value = (sizeof(check(makeF())) == sizeof(Yes)) }; - }; - - namespace functional_detail - { - template struct UnOpShift { enum { shift = 1 }; }; - template struct UnOpShift { enum { shift = 4 }; }; - template struct UnOpShift { enum { shift = 2 }; }; - - template struct DefaultUnaryShift - { - enum { shift = UnOpShift::shift }; - }; - - template struct BinOpShift { enum { shift = 1 }; }; - template struct BinOpShift { enum { shift = 4 }; }; - template struct BinOpShift { enum { shift = 2 }; }; - - template struct DefaultBinaryShift - { - enum { shift = BinOpShift::shift }; - }; - - template ::value> struct ShiftDispatcher; - template struct ShiftDispatcher - { - enum { shift = DefaultUnaryShift::shift }; - }; - template struct ShiftDispatcher - { - enum { shift = DefaultBinaryShift::shift }; - }; - } - - template struct DefaultTransformShift - { - enum { shift = functional_detail::ShiftDispatcher::shift }; - }; - - template struct DefaultTransformFunctorTraits - { - enum { simple_block_dim_x = 16 }; - enum { simple_block_dim_y = 16 }; - - enum { smart_block_dim_x = 16 }; - enum { smart_block_dim_y = 16 }; - enum { smart_shift = DefaultTransformShift::shift }; - }; - - template struct TransformFunctorTraits : DefaultTransformFunctorTraits {}; - -#define OPENCV_CUDA_TRANSFORM_FUNCTOR_TRAITS(type) \ - template <> struct TransformFunctorTraits< type > : DefaultTransformFunctorTraits< type > -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif // OPENCV_CUDA_FUNCTIONAL_HPP diff --git a/opencv/include/opencv2/core/cuda/limits.hpp b/opencv/include/opencv2/core/cuda/limits.hpp deleted file mode 100644 index 7e15ed6..0000000 --- a/opencv/include/opencv2/core/cuda/limits.hpp +++ /dev/null @@ -1,128 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_LIMITS_HPP -#define OPENCV_CUDA_LIMITS_HPP - -#include -#include -#include "common.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ -template struct numeric_limits; - -template <> struct numeric_limits -{ - __device__ __forceinline__ static bool min() { return false; } - __device__ __forceinline__ static bool max() { return true; } - static const bool is_signed = false; -}; - -template <> struct numeric_limits -{ - __device__ __forceinline__ static signed char min() { return SCHAR_MIN; } - __device__ __forceinline__ static signed char max() { return SCHAR_MAX; } - static const bool is_signed = true; -}; - -template <> struct numeric_limits -{ - __device__ __forceinline__ static unsigned char min() { return 0; } - __device__ __forceinline__ static unsigned char max() { return UCHAR_MAX; } - static const bool is_signed = false; -}; - -template <> struct numeric_limits -{ - __device__ __forceinline__ static short min() { return SHRT_MIN; } - __device__ __forceinline__ static short max() { return SHRT_MAX; } - static const bool is_signed = true; -}; - -template <> struct numeric_limits -{ - __device__ __forceinline__ static unsigned short min() { return 0; } - __device__ __forceinline__ static unsigned short max() { return USHRT_MAX; } - static const bool is_signed = false; -}; - -template <> struct numeric_limits -{ - __device__ __forceinline__ static int min() { return INT_MIN; } - __device__ __forceinline__ static int max() { return INT_MAX; } - static const bool is_signed = true; -}; - -template <> struct numeric_limits -{ - __device__ __forceinline__ static unsigned int min() { return 0; } - __device__ __forceinline__ static unsigned int max() { return UINT_MAX; } - static const bool is_signed = false; -}; - -template <> struct numeric_limits -{ - __device__ __forceinline__ static float min() { return FLT_MIN; } - __device__ __forceinline__ static float max() { return FLT_MAX; } - __device__ __forceinline__ static float epsilon() { return FLT_EPSILON; } - static const bool is_signed = true; -}; - -template <> struct numeric_limits -{ - __device__ __forceinline__ static double min() { return DBL_MIN; } - __device__ __forceinline__ static double max() { return DBL_MAX; } - __device__ __forceinline__ static double epsilon() { return DBL_EPSILON; } - static const bool is_signed = true; -}; -}}} // namespace cv { namespace cuda { namespace cudev { - -//! @endcond - -#endif // OPENCV_CUDA_LIMITS_HPP diff --git a/opencv/include/opencv2/core/cuda/reduce.hpp b/opencv/include/opencv2/core/cuda/reduce.hpp deleted file mode 100644 index 5de3650..0000000 --- a/opencv/include/opencv2/core/cuda/reduce.hpp +++ /dev/null @@ -1,209 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_REDUCE_HPP -#define OPENCV_CUDA_REDUCE_HPP - -#ifndef THRUST_DEBUG // eliminate -Wundef warning -#define THRUST_DEBUG 0 -#endif - -#include -#include "detail/reduce.hpp" -#include "detail/reduce_key_val.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - template - __device__ __forceinline__ void reduce(volatile T* smem, T& val, unsigned int tid, const Op& op) - { - reduce_detail::Dispatcher::reductor::template reduce(smem, val, tid, op); - } - template - __device__ __forceinline__ void reduce(const thrust::tuple& smem, - const thrust::tuple& val, - unsigned int tid, - const thrust::tuple& op) - { - reduce_detail::Dispatcher::reductor::template reduce< - const thrust::tuple&, - const thrust::tuple&, - const thrust::tuple&>(smem, val, tid, op); - } - - template - __device__ __forceinline__ void reduceKeyVal(volatile K* skeys, K& key, volatile V* svals, V& val, unsigned int tid, const Cmp& cmp) - { - reduce_key_val_detail::Dispatcher::reductor::template reduce(skeys, key, svals, val, tid, cmp); - } - template - __device__ __forceinline__ void reduceKeyVal(volatile K* skeys, K& key, - const thrust::tuple& svals, - const thrust::tuple& val, - unsigned int tid, const Cmp& cmp) - { - reduce_key_val_detail::Dispatcher::reductor::template reduce&, - const thrust::tuple&, - const Cmp&>(skeys, key, svals, val, tid, cmp); - } - template - __device__ __forceinline__ void reduceKeyVal(const thrust::tuple& skeys, - const thrust::tuple& key, - const thrust::tuple& svals, - const thrust::tuple& val, - unsigned int tid, - const thrust::tuple& cmp) - { - reduce_key_val_detail::Dispatcher::reductor::template reduce< - const thrust::tuple&, - const thrust::tuple&, - const thrust::tuple&, - const thrust::tuple&, - const thrust::tuple& - >(skeys, key, svals, val, tid, cmp); - } - - // smem_tuple - - template - __device__ __forceinline__ - thrust::tuple - smem_tuple(T0* t0) - { - return thrust::make_tuple((volatile T0*) t0); - } - - template - __device__ __forceinline__ - thrust::tuple - smem_tuple(T0* t0, T1* t1) - { - return thrust::make_tuple((volatile T0*) t0, (volatile T1*) t1); - } - - template - __device__ __forceinline__ - thrust::tuple - smem_tuple(T0* t0, T1* t1, T2* t2) - { - return thrust::make_tuple((volatile T0*) t0, (volatile T1*) t1, (volatile T2*) t2); - } - - template - __device__ __forceinline__ - thrust::tuple - smem_tuple(T0* t0, T1* t1, T2* t2, T3* t3) - { - return thrust::make_tuple((volatile T0*) t0, (volatile T1*) t1, (volatile T2*) t2, (volatile T3*) t3); - } - - template - __device__ __forceinline__ - thrust::tuple - smem_tuple(T0* t0, T1* t1, T2* t2, T3* t3, T4* t4) - { - return thrust::make_tuple((volatile T0*) t0, (volatile T1*) t1, (volatile T2*) t2, (volatile T3*) t3, (volatile T4*) t4); - } - - template - __device__ __forceinline__ - thrust::tuple - smem_tuple(T0* t0, T1* t1, T2* t2, T3* t3, T4* t4, T5* t5) - { - return thrust::make_tuple((volatile T0*) t0, (volatile T1*) t1, (volatile T2*) t2, (volatile T3*) t3, (volatile T4*) t4, (volatile T5*) t5); - } - - template - __device__ __forceinline__ - thrust::tuple - smem_tuple(T0* t0, T1* t1, T2* t2, T3* t3, T4* t4, T5* t5, T6* t6) - { - return thrust::make_tuple((volatile T0*) t0, (volatile T1*) t1, (volatile T2*) t2, (volatile T3*) t3, (volatile T4*) t4, (volatile T5*) t5, (volatile T6*) t6); - } - - template - __device__ __forceinline__ - thrust::tuple - smem_tuple(T0* t0, T1* t1, T2* t2, T3* t3, T4* t4, T5* t5, T6* t6, T7* t7) - { - return thrust::make_tuple((volatile T0*) t0, (volatile T1*) t1, (volatile T2*) t2, (volatile T3*) t3, (volatile T4*) t4, (volatile T5*) t5, (volatile T6*) t6, (volatile T7*) t7); - } - - template - __device__ __forceinline__ - thrust::tuple - smem_tuple(T0* t0, T1* t1, T2* t2, T3* t3, T4* t4, T5* t5, T6* t6, T7* t7, T8* t8) - { - return thrust::make_tuple((volatile T0*) t0, (volatile T1*) t1, (volatile T2*) t2, (volatile T3*) t3, (volatile T4*) t4, (volatile T5*) t5, (volatile T6*) t6, (volatile T7*) t7, (volatile T8*) t8); - } - - template - __device__ __forceinline__ - thrust::tuple - smem_tuple(T0* t0, T1* t1, T2* t2, T3* t3, T4* t4, T5* t5, T6* t6, T7* t7, T8* t8, T9* t9) - { - return thrust::make_tuple((volatile T0*) t0, (volatile T1*) t1, (volatile T2*) t2, (volatile T3*) t3, (volatile T4*) t4, (volatile T5*) t5, (volatile T6*) t6, (volatile T7*) t7, (volatile T8*) t8, (volatile T9*) t9); - } -}}} - -//! @endcond - -#endif // OPENCV_CUDA_REDUCE_HPP diff --git a/opencv/include/opencv2/core/cuda/saturate_cast.hpp b/opencv/include/opencv2/core/cuda/saturate_cast.hpp deleted file mode 100644 index c3a3d1c..0000000 --- a/opencv/include/opencv2/core/cuda/saturate_cast.hpp +++ /dev/null @@ -1,292 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_SATURATE_CAST_HPP -#define OPENCV_CUDA_SATURATE_CAST_HPP - -#include "common.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - template __device__ __forceinline__ _Tp saturate_cast(uchar v) { return _Tp(v); } - template __device__ __forceinline__ _Tp saturate_cast(schar v) { return _Tp(v); } - template __device__ __forceinline__ _Tp saturate_cast(ushort v) { return _Tp(v); } - template __device__ __forceinline__ _Tp saturate_cast(short v) { return _Tp(v); } - template __device__ __forceinline__ _Tp saturate_cast(uint v) { return _Tp(v); } - template __device__ __forceinline__ _Tp saturate_cast(int v) { return _Tp(v); } - template __device__ __forceinline__ _Tp saturate_cast(float v) { return _Tp(v); } - template __device__ __forceinline__ _Tp saturate_cast(double v) { return _Tp(v); } - - template<> __device__ __forceinline__ uchar saturate_cast(schar v) - { - uint res = 0; - int vi = v; - asm("cvt.sat.u8.s8 %0, %1;" : "=r"(res) : "r"(vi)); - return res; - } - template<> __device__ __forceinline__ uchar saturate_cast(short v) - { - uint res = 0; - asm("cvt.sat.u8.s16 %0, %1;" : "=r"(res) : "h"(v)); - return res; - } - template<> __device__ __forceinline__ uchar saturate_cast(ushort v) - { - uint res = 0; - asm("cvt.sat.u8.u16 %0, %1;" : "=r"(res) : "h"(v)); - return res; - } - template<> __device__ __forceinline__ uchar saturate_cast(int v) - { - uint res = 0; - asm("cvt.sat.u8.s32 %0, %1;" : "=r"(res) : "r"(v)); - return res; - } - template<> __device__ __forceinline__ uchar saturate_cast(uint v) - { - uint res = 0; - asm("cvt.sat.u8.u32 %0, %1;" : "=r"(res) : "r"(v)); - return res; - } - template<> __device__ __forceinline__ uchar saturate_cast(float v) - { - uint res = 0; - asm("cvt.rni.sat.u8.f32 %0, %1;" : "=r"(res) : "f"(v)); - return res; - } - template<> __device__ __forceinline__ uchar saturate_cast(double v) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130 - uint res = 0; - asm("cvt.rni.sat.u8.f64 %0, %1;" : "=r"(res) : "d"(v)); - return res; - #else - return saturate_cast((float)v); - #endif - } - - template<> __device__ __forceinline__ schar saturate_cast(uchar v) - { - uint res = 0; - uint vi = v; - asm("cvt.sat.s8.u8 %0, %1;" : "=r"(res) : "r"(vi)); - return res; - } - template<> __device__ __forceinline__ schar saturate_cast(short v) - { - uint res = 0; - asm("cvt.sat.s8.s16 %0, %1;" : "=r"(res) : "h"(v)); - return res; - } - template<> __device__ __forceinline__ schar saturate_cast(ushort v) - { - uint res = 0; - asm("cvt.sat.s8.u16 %0, %1;" : "=r"(res) : "h"(v)); - return res; - } - template<> __device__ __forceinline__ schar saturate_cast(int v) - { - uint res = 0; - asm("cvt.sat.s8.s32 %0, %1;" : "=r"(res) : "r"(v)); - return res; - } - template<> __device__ __forceinline__ schar saturate_cast(uint v) - { - uint res = 0; - asm("cvt.sat.s8.u32 %0, %1;" : "=r"(res) : "r"(v)); - return res; - } - template<> __device__ __forceinline__ schar saturate_cast(float v) - { - uint res = 0; - asm("cvt.rni.sat.s8.f32 %0, %1;" : "=r"(res) : "f"(v)); - return res; - } - template<> __device__ __forceinline__ schar saturate_cast(double v) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130 - uint res = 0; - asm("cvt.rni.sat.s8.f64 %0, %1;" : "=r"(res) : "d"(v)); - return res; - #else - return saturate_cast((float)v); - #endif - } - - template<> __device__ __forceinline__ ushort saturate_cast(schar v) - { - ushort res = 0; - int vi = v; - asm("cvt.sat.u16.s8 %0, %1;" : "=h"(res) : "r"(vi)); - return res; - } - template<> __device__ __forceinline__ ushort saturate_cast(short v) - { - ushort res = 0; - asm("cvt.sat.u16.s16 %0, %1;" : "=h"(res) : "h"(v)); - return res; - } - template<> __device__ __forceinline__ ushort saturate_cast(int v) - { - ushort res = 0; - asm("cvt.sat.u16.s32 %0, %1;" : "=h"(res) : "r"(v)); - return res; - } - template<> __device__ __forceinline__ ushort saturate_cast(uint v) - { - ushort res = 0; - asm("cvt.sat.u16.u32 %0, %1;" : "=h"(res) : "r"(v)); - return res; - } - template<> __device__ __forceinline__ ushort saturate_cast(float v) - { - ushort res = 0; - asm("cvt.rni.sat.u16.f32 %0, %1;" : "=h"(res) : "f"(v)); - return res; - } - template<> __device__ __forceinline__ ushort saturate_cast(double v) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130 - ushort res = 0; - asm("cvt.rni.sat.u16.f64 %0, %1;" : "=h"(res) : "d"(v)); - return res; - #else - return saturate_cast((float)v); - #endif - } - - template<> __device__ __forceinline__ short saturate_cast(ushort v) - { - short res = 0; - asm("cvt.sat.s16.u16 %0, %1;" : "=h"(res) : "h"(v)); - return res; - } - template<> __device__ __forceinline__ short saturate_cast(int v) - { - short res = 0; - asm("cvt.sat.s16.s32 %0, %1;" : "=h"(res) : "r"(v)); - return res; - } - template<> __device__ __forceinline__ short saturate_cast(uint v) - { - short res = 0; - asm("cvt.sat.s16.u32 %0, %1;" : "=h"(res) : "r"(v)); - return res; - } - template<> __device__ __forceinline__ short saturate_cast(float v) - { - short res = 0; - asm("cvt.rni.sat.s16.f32 %0, %1;" : "=h"(res) : "f"(v)); - return res; - } - template<> __device__ __forceinline__ short saturate_cast(double v) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130 - short res = 0; - asm("cvt.rni.sat.s16.f64 %0, %1;" : "=h"(res) : "d"(v)); - return res; - #else - return saturate_cast((float)v); - #endif - } - - template<> __device__ __forceinline__ int saturate_cast(uint v) - { - int res = 0; - asm("cvt.sat.s32.u32 %0, %1;" : "=r"(res) : "r"(v)); - return res; - } - template<> __device__ __forceinline__ int saturate_cast(float v) - { - return __float2int_rn(v); - } - template<> __device__ __forceinline__ int saturate_cast(double v) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130 - return __double2int_rn(v); - #else - return saturate_cast((float)v); - #endif - } - - template<> __device__ __forceinline__ uint saturate_cast(schar v) - { - uint res = 0; - int vi = v; - asm("cvt.sat.u32.s8 %0, %1;" : "=r"(res) : "r"(vi)); - return res; - } - template<> __device__ __forceinline__ uint saturate_cast(short v) - { - uint res = 0; - asm("cvt.sat.u32.s16 %0, %1;" : "=r"(res) : "h"(v)); - return res; - } - template<> __device__ __forceinline__ uint saturate_cast(int v) - { - uint res = 0; - asm("cvt.sat.u32.s32 %0, %1;" : "=r"(res) : "r"(v)); - return res; - } - template<> __device__ __forceinline__ uint saturate_cast(float v) - { - return __float2uint_rn(v); - } - template<> __device__ __forceinline__ uint saturate_cast(double v) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130 - return __double2uint_rn(v); - #else - return saturate_cast((float)v); - #endif - } -}}} - -//! @endcond - -#endif /* OPENCV_CUDA_SATURATE_CAST_HPP */ diff --git a/opencv/include/opencv2/core/cuda/scan.hpp b/opencv/include/opencv2/core/cuda/scan.hpp deleted file mode 100644 index e128fb0..0000000 --- a/opencv/include/opencv2/core/cuda/scan.hpp +++ /dev/null @@ -1,258 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_SCAN_HPP -#define OPENCV_CUDA_SCAN_HPP - -#include "opencv2/core/cuda/common.hpp" -#include "opencv2/core/cuda/utility.hpp" -#include "opencv2/core/cuda/warp.hpp" -#include "opencv2/core/cuda/warp_shuffle.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - enum ScanKind { EXCLUSIVE = 0, INCLUSIVE = 1 }; - - template struct WarpScan - { - __device__ __forceinline__ WarpScan() {} - __device__ __forceinline__ WarpScan(const WarpScan& other) { CV_UNUSED(other); } - - __device__ __forceinline__ T operator()( volatile T *ptr , const unsigned int idx) - { - const unsigned int lane = idx & 31; - F op; - - if ( lane >= 1) ptr [idx ] = op(ptr [idx - 1], ptr [idx]); - if ( lane >= 2) ptr [idx ] = op(ptr [idx - 2], ptr [idx]); - if ( lane >= 4) ptr [idx ] = op(ptr [idx - 4], ptr [idx]); - if ( lane >= 8) ptr [idx ] = op(ptr [idx - 8], ptr [idx]); - if ( lane >= 16) ptr [idx ] = op(ptr [idx - 16], ptr [idx]); - - if( Kind == INCLUSIVE ) - return ptr [idx]; - else - return (lane > 0) ? ptr [idx - 1] : 0; - } - - __device__ __forceinline__ unsigned int index(const unsigned int tid) - { - return tid; - } - - __device__ __forceinline__ void init(volatile T *ptr){} - - static const int warp_offset = 0; - - typedef WarpScan merge; - }; - - template struct WarpScanNoComp - { - __device__ __forceinline__ WarpScanNoComp() {} - __device__ __forceinline__ WarpScanNoComp(const WarpScanNoComp& other) { CV_UNUSED(other); } - - __device__ __forceinline__ T operator()( volatile T *ptr , const unsigned int idx) - { - const unsigned int lane = threadIdx.x & 31; - F op; - - ptr [idx ] = op(ptr [idx - 1], ptr [idx]); - ptr [idx ] = op(ptr [idx - 2], ptr [idx]); - ptr [idx ] = op(ptr [idx - 4], ptr [idx]); - ptr [idx ] = op(ptr [idx - 8], ptr [idx]); - ptr [idx ] = op(ptr [idx - 16], ptr [idx]); - - if( Kind == INCLUSIVE ) - return ptr [idx]; - else - return (lane > 0) ? ptr [idx - 1] : 0; - } - - __device__ __forceinline__ unsigned int index(const unsigned int tid) - { - return (tid >> warp_log) * warp_smem_stride + 16 + (tid & warp_mask); - } - - __device__ __forceinline__ void init(volatile T *ptr) - { - ptr[threadIdx.x] = 0; - } - - static const int warp_smem_stride = 32 + 16 + 1; - static const int warp_offset = 16; - static const int warp_log = 5; - static const int warp_mask = 31; - - typedef WarpScanNoComp merge; - }; - - template struct BlockScan - { - __device__ __forceinline__ BlockScan() {} - __device__ __forceinline__ BlockScan(const BlockScan& other) { CV_UNUSED(other); } - - __device__ __forceinline__ T operator()(volatile T *ptr) - { - const unsigned int tid = threadIdx.x; - const unsigned int lane = tid & warp_mask; - const unsigned int warp = tid >> warp_log; - - Sc scan; - typename Sc::merge merge_scan; - const unsigned int idx = scan.index(tid); - - T val = scan(ptr, idx); - __syncthreads (); - - if( warp == 0) - scan.init(ptr); - __syncthreads (); - - if( lane == 31 ) - ptr [scan.warp_offset + warp ] = (Kind == INCLUSIVE) ? val : ptr [idx]; - __syncthreads (); - - if( warp == 0 ) - merge_scan(ptr, idx); - __syncthreads(); - - if ( warp > 0) - val = ptr [scan.warp_offset + warp - 1] + val; - __syncthreads (); - - ptr[idx] = val; - __syncthreads (); - - return val ; - } - - static const int warp_log = 5; - static const int warp_mask = 31; - }; - - template - __device__ T warpScanInclusive(T idata, volatile T* s_Data, unsigned int tid) - { - #if __CUDA_ARCH__ >= 300 - const unsigned int laneId = cv::cuda::device::Warp::laneId(); - - // scan on shuffl functions - #pragma unroll - for (int i = 1; i <= (OPENCV_CUDA_WARP_SIZE / 2); i *= 2) - { - const T n = cv::cuda::device::shfl_up(idata, i); - if (laneId >= i) - idata += n; - } - - return idata; - #else - unsigned int pos = 2 * tid - (tid & (OPENCV_CUDA_WARP_SIZE - 1)); - s_Data[pos] = 0; - pos += OPENCV_CUDA_WARP_SIZE; - s_Data[pos] = idata; - - s_Data[pos] += s_Data[pos - 1]; - s_Data[pos] += s_Data[pos - 2]; - s_Data[pos] += s_Data[pos - 4]; - s_Data[pos] += s_Data[pos - 8]; - s_Data[pos] += s_Data[pos - 16]; - - return s_Data[pos]; - #endif - } - - template - __device__ __forceinline__ T warpScanExclusive(T idata, volatile T* s_Data, unsigned int tid) - { - return warpScanInclusive(idata, s_Data, tid) - idata; - } - - template - __device__ T blockScanInclusive(T idata, volatile T* s_Data, unsigned int tid) - { - if (tiNumScanThreads > OPENCV_CUDA_WARP_SIZE) - { - //Bottom-level inclusive warp scan - T warpResult = warpScanInclusive(idata, s_Data, tid); - - //Save top elements of each warp for exclusive warp scan - //sync to wait for warp scans to complete (because s_Data is being overwritten) - __syncthreads(); - if ((tid & (OPENCV_CUDA_WARP_SIZE - 1)) == (OPENCV_CUDA_WARP_SIZE - 1)) - { - s_Data[tid >> OPENCV_CUDA_LOG_WARP_SIZE] = warpResult; - } - - //wait for warp scans to complete - __syncthreads(); - - if (tid < (tiNumScanThreads / OPENCV_CUDA_WARP_SIZE) ) - { - //grab top warp elements - T val = s_Data[tid]; - //calculate exclusive scan and write back to shared memory - s_Data[tid] = warpScanExclusive(val, s_Data, tid); - } - - //return updated warp scans with exclusive scan results - __syncthreads(); - - return warpResult + s_Data[tid >> OPENCV_CUDA_LOG_WARP_SIZE]; - } - else - { - return warpScanInclusive(idata, s_Data, tid); - } - } -}}} - -//! @endcond - -#endif // OPENCV_CUDA_SCAN_HPP diff --git a/opencv/include/opencv2/core/cuda/simd_functions.hpp b/opencv/include/opencv2/core/cuda/simd_functions.hpp deleted file mode 100644 index 3d8c2e0..0000000 --- a/opencv/include/opencv2/core/cuda/simd_functions.hpp +++ /dev/null @@ -1,869 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -/* - * Copyright (c) 2013 NVIDIA Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of NVIDIA Corporation nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef OPENCV_CUDA_SIMD_FUNCTIONS_HPP -#define OPENCV_CUDA_SIMD_FUNCTIONS_HPP - -#include "common.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - // 2 - - static __device__ __forceinline__ unsigned int vadd2(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vadd2.u32.u32.u32.sat %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #elif __CUDA_ARCH__ >= 200 - asm("vadd.u32.u32.u32.sat %0.h0, %1.h0, %2.h0, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vadd.u32.u32.u32.sat %0.h1, %1.h1, %2.h1, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int s; - s = a ^ b; // sum bits - r = a + b; // actual sum - s = s ^ r; // determine carry-ins for each bit position - s = s & 0x00010000; // carry-in to high word (= carry-out from low word) - r = r - s; // subtract out carry-out from low word - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vsub2(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vsub2.u32.u32.u32.sat %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #elif __CUDA_ARCH__ >= 200 - asm("vsub.u32.u32.u32.sat %0.h0, %1.h0, %2.h0, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vsub.u32.u32.u32.sat %0.h1, %1.h1, %2.h1, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int s; - s = a ^ b; // sum bits - r = a - b; // actual sum - s = s ^ r; // determine carry-ins for each bit position - s = s & 0x00010000; // borrow to high word - r = r + s; // compensate for borrow from low word - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vabsdiff2(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vabsdiff2.u32.u32.u32.sat %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #elif __CUDA_ARCH__ >= 200 - asm("vabsdiff.u32.u32.u32.sat %0.h0, %1.h0, %2.h0, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vabsdiff.u32.u32.u32.sat %0.h1, %1.h1, %2.h1, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int s, t, u, v; - s = a & 0x0000ffff; // extract low halfword - r = b & 0x0000ffff; // extract low halfword - u = ::max(r, s); // maximum of low halfwords - v = ::min(r, s); // minimum of low halfwords - s = a & 0xffff0000; // extract high halfword - r = b & 0xffff0000; // extract high halfword - t = ::max(r, s); // maximum of high halfwords - s = ::min(r, s); // minimum of high halfwords - r = u | t; // maximum of both halfwords - s = v | s; // minimum of both halfwords - r = r - s; // |a - b| = max(a,b) - min(a,b); - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vavg2(unsigned int a, unsigned int b) - { - unsigned int r, s; - - // HAKMEM #23: a + b = 2 * (a & b) + (a ^ b) ==> - // (a + b) / 2 = (a & b) + ((a ^ b) >> 1) - s = a ^ b; - r = a & b; - s = s & 0xfffefffe; // ensure shift doesn't cross halfword boundaries - s = s >> 1; - s = r + s; - - return s; - } - - static __device__ __forceinline__ unsigned int vavrg2(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vavrg2.u32.u32.u32 %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - // HAKMEM #23: a + b = 2 * (a | b) - (a ^ b) ==> - // (a + b + 1) / 2 = (a | b) - ((a ^ b) >> 1) - unsigned int s; - s = a ^ b; - r = a | b; - s = s & 0xfffefffe; // ensure shift doesn't cross half-word boundaries - s = s >> 1; - r = r - s; - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vseteq2(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vset2.u32.u32.eq %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - // inspired by Alan Mycroft's null-byte detection algorithm: - // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080)) - unsigned int c; - r = a ^ b; // 0x0000 if a == b - c = r | 0x80008000; // set msbs, to catch carry out - r = r ^ c; // extract msbs, msb = 1 if r < 0x8000 - c = c - 0x00010001; // msb = 0, if r was 0x0000 or 0x8000 - c = r & ~c; // msb = 1, if r was 0x0000 - r = c >> 15; // convert to bool - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vcmpeq2(unsigned int a, unsigned int b) - { - unsigned int r, c; - - #if __CUDA_ARCH__ >= 300 - r = vseteq2(a, b); - c = r << 16; // convert bool - r = c - r; // into mask - #else - // inspired by Alan Mycroft's null-byte detection algorithm: - // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080)) - r = a ^ b; // 0x0000 if a == b - c = r | 0x80008000; // set msbs, to catch carry out - r = r ^ c; // extract msbs, msb = 1 if r < 0x8000 - c = c - 0x00010001; // msb = 0, if r was 0x0000 or 0x8000 - c = r & ~c; // msb = 1, if r was 0x0000 - r = c >> 15; // convert - r = c - r; // msbs to - r = c | r; // mask - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vsetge2(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vset2.u32.u32.ge %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int c; - asm("not.b32 %0, %0;" : "+r"(b)); - c = vavrg2(a, b); // (a + ~b + 1) / 2 = (a - b) / 2 - c = c & 0x80008000; // msb = carry-outs - r = c >> 15; // convert to bool - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vcmpge2(unsigned int a, unsigned int b) - { - unsigned int r, c; - - #if __CUDA_ARCH__ >= 300 - r = vsetge2(a, b); - c = r << 16; // convert bool - r = c - r; // into mask - #else - asm("not.b32 %0, %0;" : "+r"(b)); - c = vavrg2(a, b); // (a + ~b + 1) / 2 = (a - b) / 2 - c = c & 0x80008000; // msb = carry-outs - r = c >> 15; // convert - r = c - r; // msbs to - r = c | r; // mask - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vsetgt2(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vset2.u32.u32.gt %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int c; - asm("not.b32 %0, %0;" : "+r"(b)); - c = vavg2(a, b); // (a + ~b) / 2 = (a - b) / 2 [rounded down] - c = c & 0x80008000; // msbs = carry-outs - r = c >> 15; // convert to bool - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vcmpgt2(unsigned int a, unsigned int b) - { - unsigned int r, c; - - #if __CUDA_ARCH__ >= 300 - r = vsetgt2(a, b); - c = r << 16; // convert bool - r = c - r; // into mask - #else - asm("not.b32 %0, %0;" : "+r"(b)); - c = vavg2(a, b); // (a + ~b) / 2 = (a - b) / 2 [rounded down] - c = c & 0x80008000; // msbs = carry-outs - r = c >> 15; // convert - r = c - r; // msbs to - r = c | r; // mask - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vsetle2(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vset2.u32.u32.le %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int c; - asm("not.b32 %0, %0;" : "+r"(a)); - c = vavrg2(a, b); // (b + ~a + 1) / 2 = (b - a) / 2 - c = c & 0x80008000; // msb = carry-outs - r = c >> 15; // convert to bool - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vcmple2(unsigned int a, unsigned int b) - { - unsigned int r, c; - - #if __CUDA_ARCH__ >= 300 - r = vsetle2(a, b); - c = r << 16; // convert bool - r = c - r; // into mask - #else - asm("not.b32 %0, %0;" : "+r"(a)); - c = vavrg2(a, b); // (b + ~a + 1) / 2 = (b - a) / 2 - c = c & 0x80008000; // msb = carry-outs - r = c >> 15; // convert - r = c - r; // msbs to - r = c | r; // mask - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vsetlt2(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vset2.u32.u32.lt %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int c; - asm("not.b32 %0, %0;" : "+r"(a)); - c = vavg2(a, b); // (b + ~a) / 2 = (b - a) / 2 [rounded down] - c = c & 0x80008000; // msb = carry-outs - r = c >> 15; // convert to bool - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vcmplt2(unsigned int a, unsigned int b) - { - unsigned int r, c; - - #if __CUDA_ARCH__ >= 300 - r = vsetlt2(a, b); - c = r << 16; // convert bool - r = c - r; // into mask - #else - asm("not.b32 %0, %0;" : "+r"(a)); - c = vavg2(a, b); // (b + ~a) / 2 = (b - a) / 2 [rounded down] - c = c & 0x80008000; // msb = carry-outs - r = c >> 15; // convert - r = c - r; // msbs to - r = c | r; // mask - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vsetne2(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm ("vset2.u32.u32.ne %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - // inspired by Alan Mycroft's null-byte detection algorithm: - // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080)) - unsigned int c; - r = a ^ b; // 0x0000 if a == b - c = r | 0x80008000; // set msbs, to catch carry out - c = c - 0x00010001; // msb = 0, if r was 0x0000 or 0x8000 - c = r | c; // msb = 1, if r was not 0x0000 - c = c & 0x80008000; // extract msbs - r = c >> 15; // convert to bool - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vcmpne2(unsigned int a, unsigned int b) - { - unsigned int r, c; - - #if __CUDA_ARCH__ >= 300 - r = vsetne2(a, b); - c = r << 16; // convert bool - r = c - r; // into mask - #else - // inspired by Alan Mycroft's null-byte detection algorithm: - // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080)) - r = a ^ b; // 0x0000 if a == b - c = r | 0x80008000; // set msbs, to catch carry out - c = c - 0x00010001; // msb = 0, if r was 0x0000 or 0x8000 - c = r | c; // msb = 1, if r was not 0x0000 - c = c & 0x80008000; // extract msbs - r = c >> 15; // convert - r = c - r; // msbs to - r = c | r; // mask - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vmax2(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vmax2.u32.u32.u32 %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #elif __CUDA_ARCH__ >= 200 - asm("vmax.u32.u32.u32 %0.h0, %1.h0, %2.h0, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vmax.u32.u32.u32 %0.h1, %1.h1, %2.h1, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int s, t, u; - r = a & 0x0000ffff; // extract low halfword - s = b & 0x0000ffff; // extract low halfword - t = ::max(r, s); // maximum of low halfwords - r = a & 0xffff0000; // extract high halfword - s = b & 0xffff0000; // extract high halfword - u = ::max(r, s); // maximum of high halfwords - r = t | u; // combine halfword maximums - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vmin2(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vmin2.u32.u32.u32 %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #elif __CUDA_ARCH__ >= 200 - asm("vmin.u32.u32.u32 %0.h0, %1.h0, %2.h0, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vmin.u32.u32.u32 %0.h1, %1.h1, %2.h1, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int s, t, u; - r = a & 0x0000ffff; // extract low halfword - s = b & 0x0000ffff; // extract low halfword - t = ::min(r, s); // minimum of low halfwords - r = a & 0xffff0000; // extract high halfword - s = b & 0xffff0000; // extract high halfword - u = ::min(r, s); // minimum of high halfwords - r = t | u; // combine halfword minimums - #endif - - return r; - } - - // 4 - - static __device__ __forceinline__ unsigned int vadd4(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vadd4.u32.u32.u32.sat %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #elif __CUDA_ARCH__ >= 200 - asm("vadd.u32.u32.u32.sat %0.b0, %1.b0, %2.b0, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vadd.u32.u32.u32.sat %0.b1, %1.b1, %2.b1, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vadd.u32.u32.u32.sat %0.b2, %1.b2, %2.b2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vadd.u32.u32.u32.sat %0.b3, %1.b3, %2.b3, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int s, t; - s = a ^ b; // sum bits - r = a & 0x7f7f7f7f; // clear msbs - t = b & 0x7f7f7f7f; // clear msbs - s = s & 0x80808080; // msb sum bits - r = r + t; // add without msbs, record carry-out in msbs - r = r ^ s; // sum of msb sum and carry-in bits, w/o carry-out - #endif /* __CUDA_ARCH__ >= 300 */ - - return r; - } - - static __device__ __forceinline__ unsigned int vsub4(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vsub4.u32.u32.u32.sat %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #elif __CUDA_ARCH__ >= 200 - asm("vsub.u32.u32.u32.sat %0.b0, %1.b0, %2.b0, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vsub.u32.u32.u32.sat %0.b1, %1.b1, %2.b1, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vsub.u32.u32.u32.sat %0.b2, %1.b2, %2.b2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vsub.u32.u32.u32.sat %0.b3, %1.b3, %2.b3, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int s, t; - s = a ^ ~b; // inverted sum bits - r = a | 0x80808080; // set msbs - t = b & 0x7f7f7f7f; // clear msbs - s = s & 0x80808080; // inverted msb sum bits - r = r - t; // subtract w/o msbs, record inverted borrows in msb - r = r ^ s; // combine inverted msb sum bits and borrows - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vavg4(unsigned int a, unsigned int b) - { - unsigned int r, s; - - // HAKMEM #23: a + b = 2 * (a & b) + (a ^ b) ==> - // (a + b) / 2 = (a & b) + ((a ^ b) >> 1) - s = a ^ b; - r = a & b; - s = s & 0xfefefefe; // ensure following shift doesn't cross byte boundaries - s = s >> 1; - s = r + s; - - return s; - } - - static __device__ __forceinline__ unsigned int vavrg4(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vavrg4.u32.u32.u32 %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - // HAKMEM #23: a + b = 2 * (a | b) - (a ^ b) ==> - // (a + b + 1) / 2 = (a | b) - ((a ^ b) >> 1) - unsigned int c; - c = a ^ b; - r = a | b; - c = c & 0xfefefefe; // ensure following shift doesn't cross byte boundaries - c = c >> 1; - r = r - c; - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vseteq4(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vset4.u32.u32.eq %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - // inspired by Alan Mycroft's null-byte detection algorithm: - // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080)) - unsigned int c; - r = a ^ b; // 0x00 if a == b - c = r | 0x80808080; // set msbs, to catch carry out - r = r ^ c; // extract msbs, msb = 1 if r < 0x80 - c = c - 0x01010101; // msb = 0, if r was 0x00 or 0x80 - c = r & ~c; // msb = 1, if r was 0x00 - r = c >> 7; // convert to bool - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vcmpeq4(unsigned int a, unsigned int b) - { - unsigned int r, t; - - #if __CUDA_ARCH__ >= 300 - r = vseteq4(a, b); - t = r << 8; // convert bool - r = t - r; // to mask - #else - // inspired by Alan Mycroft's null-byte detection algorithm: - // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080)) - t = a ^ b; // 0x00 if a == b - r = t | 0x80808080; // set msbs, to catch carry out - t = t ^ r; // extract msbs, msb = 1 if t < 0x80 - r = r - 0x01010101; // msb = 0, if t was 0x00 or 0x80 - r = t & ~r; // msb = 1, if t was 0x00 - t = r >> 7; // build mask - t = r - t; // from - r = t | r; // msbs - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vsetle4(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vset4.u32.u32.le %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int c; - asm("not.b32 %0, %0;" : "+r"(a)); - c = vavrg4(a, b); // (b + ~a + 1) / 2 = (b - a) / 2 - c = c & 0x80808080; // msb = carry-outs - r = c >> 7; // convert to bool - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vcmple4(unsigned int a, unsigned int b) - { - unsigned int r, c; - - #if __CUDA_ARCH__ >= 300 - r = vsetle4(a, b); - c = r << 8; // convert bool - r = c - r; // to mask - #else - asm("not.b32 %0, %0;" : "+r"(a)); - c = vavrg4(a, b); // (b + ~a + 1) / 2 = (b - a) / 2 - c = c & 0x80808080; // msbs = carry-outs - r = c >> 7; // convert - r = c - r; // msbs to - r = c | r; // mask - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vsetlt4(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vset4.u32.u32.lt %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int c; - asm("not.b32 %0, %0;" : "+r"(a)); - c = vavg4(a, b); // (b + ~a) / 2 = (b - a) / 2 [rounded down] - c = c & 0x80808080; // msb = carry-outs - r = c >> 7; // convert to bool - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vcmplt4(unsigned int a, unsigned int b) - { - unsigned int r, c; - - #if __CUDA_ARCH__ >= 300 - r = vsetlt4(a, b); - c = r << 8; // convert bool - r = c - r; // to mask - #else - asm("not.b32 %0, %0;" : "+r"(a)); - c = vavg4(a, b); // (b + ~a) / 2 = (b - a) / 2 [rounded down] - c = c & 0x80808080; // msbs = carry-outs - r = c >> 7; // convert - r = c - r; // msbs to - r = c | r; // mask - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vsetge4(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vset4.u32.u32.ge %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int c; - asm("not.b32 %0, %0;" : "+r"(b)); - c = vavrg4(a, b); // (a + ~b + 1) / 2 = (a - b) / 2 - c = c & 0x80808080; // msb = carry-outs - r = c >> 7; // convert to bool - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vcmpge4(unsigned int a, unsigned int b) - { - unsigned int r, s; - - #if __CUDA_ARCH__ >= 300 - r = vsetge4(a, b); - s = r << 8; // convert bool - r = s - r; // to mask - #else - asm ("not.b32 %0,%0;" : "+r"(b)); - r = vavrg4 (a, b); // (a + ~b + 1) / 2 = (a - b) / 2 - r = r & 0x80808080; // msb = carry-outs - s = r >> 7; // build mask - s = r - s; // from - r = s | r; // msbs - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vsetgt4(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vset4.u32.u32.gt %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int c; - asm("not.b32 %0, %0;" : "+r"(b)); - c = vavg4(a, b); // (a + ~b) / 2 = (a - b) / 2 [rounded down] - c = c & 0x80808080; // msb = carry-outs - r = c >> 7; // convert to bool - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vcmpgt4(unsigned int a, unsigned int b) - { - unsigned int r, c; - - #if __CUDA_ARCH__ >= 300 - r = vsetgt4(a, b); - c = r << 8; // convert bool - r = c - r; // to mask - #else - asm("not.b32 %0, %0;" : "+r"(b)); - c = vavg4(a, b); // (a + ~b) / 2 = (a - b) / 2 [rounded down] - c = c & 0x80808080; // msb = carry-outs - r = c >> 7; // convert - r = c - r; // msbs to - r = c | r; // mask - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vsetne4(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vset4.u32.u32.ne %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - // inspired by Alan Mycroft's null-byte detection algorithm: - // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080)) - unsigned int c; - r = a ^ b; // 0x00 if a == b - c = r | 0x80808080; // set msbs, to catch carry out - c = c - 0x01010101; // msb = 0, if r was 0x00 or 0x80 - c = r | c; // msb = 1, if r was not 0x00 - c = c & 0x80808080; // extract msbs - r = c >> 7; // convert to bool - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vcmpne4(unsigned int a, unsigned int b) - { - unsigned int r, c; - - #if __CUDA_ARCH__ >= 300 - r = vsetne4(a, b); - c = r << 8; // convert bool - r = c - r; // to mask - #else - // inspired by Alan Mycroft's null-byte detection algorithm: - // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080)) - r = a ^ b; // 0x00 if a == b - c = r | 0x80808080; // set msbs, to catch carry out - c = c - 0x01010101; // msb = 0, if r was 0x00 or 0x80 - c = r | c; // msb = 1, if r was not 0x00 - c = c & 0x80808080; // extract msbs - r = c >> 7; // convert - r = c - r; // msbs to - r = c | r; // mask - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vabsdiff4(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vabsdiff4.u32.u32.u32.sat %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #elif __CUDA_ARCH__ >= 200 - asm("vabsdiff.u32.u32.u32.sat %0.b0, %1.b0, %2.b0, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vabsdiff.u32.u32.u32.sat %0.b1, %1.b1, %2.b1, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vabsdiff.u32.u32.u32.sat %0.b2, %1.b2, %2.b2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vabsdiff.u32.u32.u32.sat %0.b3, %1.b3, %2.b3, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int s; - s = vcmpge4(a, b); // mask = 0xff if a >= b - r = a ^ b; // - s = (r & s) ^ b; // select a when a >= b, else select b => max(a,b) - r = s ^ r; // select a when b >= a, else select b => min(a,b) - r = s - r; // |a - b| = max(a,b) - min(a,b); - #endif - - return r; - } - - static __device__ __forceinline__ unsigned int vmax4(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vmax4.u32.u32.u32 %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #elif __CUDA_ARCH__ >= 200 - asm("vmax.u32.u32.u32 %0.b0, %1.b0, %2.b0, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vmax.u32.u32.u32 %0.b1, %1.b1, %2.b1, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vmax.u32.u32.u32 %0.b2, %1.b2, %2.b2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vmax.u32.u32.u32 %0.b3, %1.b3, %2.b3, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int s; - s = vcmpge4(a, b); // mask = 0xff if a >= b - r = a & s; // select a when b >= a - s = b & ~s; // select b when b < a - r = r | s; // combine byte selections - #endif - - return r; // byte-wise unsigned maximum - } - - static __device__ __forceinline__ unsigned int vmin4(unsigned int a, unsigned int b) - { - unsigned int r = 0; - - #if __CUDA_ARCH__ >= 300 - asm("vmin4.u32.u32.u32 %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #elif __CUDA_ARCH__ >= 200 - asm("vmin.u32.u32.u32 %0.b0, %1.b0, %2.b0, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vmin.u32.u32.u32 %0.b1, %1.b1, %2.b1, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vmin.u32.u32.u32 %0.b2, %1.b2, %2.b2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - asm("vmin.u32.u32.u32 %0.b3, %1.b3, %2.b3, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(r)); - #else - unsigned int s; - s = vcmpge4(b, a); // mask = 0xff if a >= b - r = a & s; // select a when b >= a - s = b & ~s; // select b when b < a - r = r | s; // combine byte selections - #endif - - return r; - } -}}} - -//! @endcond - -#endif // OPENCV_CUDA_SIMD_FUNCTIONS_HPP diff --git a/opencv/include/opencv2/core/cuda/transform.hpp b/opencv/include/opencv2/core/cuda/transform.hpp deleted file mode 100644 index 42aa6ea..0000000 --- a/opencv/include/opencv2/core/cuda/transform.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_TRANSFORM_HPP -#define OPENCV_CUDA_TRANSFORM_HPP - -#include "common.hpp" -#include "utility.hpp" -#include "detail/transform_detail.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - template - static inline void transform(PtrStepSz src, PtrStepSz dst, UnOp op, const Mask& mask, cudaStream_t stream) - { - typedef TransformFunctorTraits ft; - transform_detail::TransformDispatcher::cn == 1 && VecTraits::cn == 1 && ft::smart_shift != 1>::call(src, dst, op, mask, stream); - } - - template - static inline void transform(PtrStepSz src1, PtrStepSz src2, PtrStepSz dst, BinOp op, const Mask& mask, cudaStream_t stream) - { - typedef TransformFunctorTraits ft; - transform_detail::TransformDispatcher::cn == 1 && VecTraits::cn == 1 && VecTraits::cn == 1 && ft::smart_shift != 1>::call(src1, src2, dst, op, mask, stream); - } -}}} - -//! @endcond - -#endif // OPENCV_CUDA_TRANSFORM_HPP diff --git a/opencv/include/opencv2/core/cuda/type_traits.hpp b/opencv/include/opencv2/core/cuda/type_traits.hpp deleted file mode 100644 index 8b7a3fd..0000000 --- a/opencv/include/opencv2/core/cuda/type_traits.hpp +++ /dev/null @@ -1,90 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_TYPE_TRAITS_HPP -#define OPENCV_CUDA_TYPE_TRAITS_HPP - -#include "detail/type_traits_detail.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - template struct IsSimpleParameter - { - enum {value = type_traits_detail::IsIntegral::value || type_traits_detail::IsFloat::value || - type_traits_detail::PointerTraits::type>::value}; - }; - - template struct TypeTraits - { - typedef typename type_traits_detail::UnConst::type NonConstType; - typedef typename type_traits_detail::UnVolatile::type NonVolatileType; - typedef typename type_traits_detail::UnVolatile::type>::type UnqualifiedType; - typedef typename type_traits_detail::PointerTraits::type PointeeType; - typedef typename type_traits_detail::ReferenceTraits::type ReferredType; - - enum { isConst = type_traits_detail::UnConst::value }; - enum { isVolatile = type_traits_detail::UnVolatile::value }; - - enum { isReference = type_traits_detail::ReferenceTraits::value }; - enum { isPointer = type_traits_detail::PointerTraits::type>::value }; - - enum { isUnsignedInt = type_traits_detail::IsUnsignedIntegral::value }; - enum { isSignedInt = type_traits_detail::IsSignedIntergral::value }; - enum { isIntegral = type_traits_detail::IsIntegral::value }; - enum { isFloat = type_traits_detail::IsFloat::value }; - enum { isArith = isIntegral || isFloat }; - enum { isVec = type_traits_detail::IsVec::value }; - - typedef typename type_traits_detail::Select::value, - T, typename type_traits_detail::AddParameterType::type>::type ParameterType; - }; -}}} - -//! @endcond - -#endif // OPENCV_CUDA_TYPE_TRAITS_HPP diff --git a/opencv/include/opencv2/core/cuda/utility.hpp b/opencv/include/opencv2/core/cuda/utility.hpp deleted file mode 100644 index 7f5db48..0000000 --- a/opencv/include/opencv2/core/cuda/utility.hpp +++ /dev/null @@ -1,230 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_UTILITY_HPP -#define OPENCV_CUDA_UTILITY_HPP - -#include "saturate_cast.hpp" -#include "datamov_utils.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - struct CV_EXPORTS ThrustAllocator - { - typedef uchar value_type; - virtual ~ThrustAllocator(); - virtual __device__ __host__ uchar* allocate(size_t numBytes) = 0; - virtual __device__ __host__ void deallocate(uchar* ptr, size_t numBytes) = 0; - static ThrustAllocator& getAllocator(); - static void setAllocator(ThrustAllocator* allocator); - }; - #define OPENCV_CUDA_LOG_WARP_SIZE (5) - #define OPENCV_CUDA_WARP_SIZE (1 << OPENCV_CUDA_LOG_WARP_SIZE) - #define OPENCV_CUDA_LOG_MEM_BANKS ((__CUDA_ARCH__ >= 200) ? 5 : 4) // 32 banks on fermi, 16 on tesla - #define OPENCV_CUDA_MEM_BANKS (1 << OPENCV_CUDA_LOG_MEM_BANKS) - - /////////////////////////////////////////////////////////////////////////////// - // swap - - template void __device__ __host__ __forceinline__ swap(T& a, T& b) - { - const T temp = a; - a = b; - b = temp; - } - - /////////////////////////////////////////////////////////////////////////////// - // Mask Reader - - struct SingleMask - { - explicit __host__ __device__ __forceinline__ SingleMask(PtrStepb mask_) : mask(mask_) {} - __host__ __device__ __forceinline__ SingleMask(const SingleMask& mask_): mask(mask_.mask){} - - __device__ __forceinline__ bool operator()(int y, int x) const - { - return mask.ptr(y)[x] != 0; - } - - PtrStepb mask; - }; - - struct SingleMaskChannels - { - __host__ __device__ __forceinline__ SingleMaskChannels(PtrStepb mask_, int channels_) - : mask(mask_), channels(channels_) {} - __host__ __device__ __forceinline__ SingleMaskChannels(const SingleMaskChannels& mask_) - :mask(mask_.mask), channels(mask_.channels){} - - __device__ __forceinline__ bool operator()(int y, int x) const - { - return mask.ptr(y)[x / channels] != 0; - } - - PtrStepb mask; - int channels; - }; - - struct MaskCollection - { - explicit __host__ __device__ __forceinline__ MaskCollection(PtrStepb* maskCollection_) - : maskCollection(maskCollection_) {} - - __device__ __forceinline__ MaskCollection(const MaskCollection& masks_) - : maskCollection(masks_.maskCollection), curMask(masks_.curMask){} - - __device__ __forceinline__ void next() - { - curMask = *maskCollection++; - } - __device__ __forceinline__ void setMask(int z) - { - curMask = maskCollection[z]; - } - - __device__ __forceinline__ bool operator()(int y, int x) const - { - uchar val; - return curMask.data == 0 || (ForceGlob::Load(curMask.ptr(y), x, val), (val != 0)); - } - - const PtrStepb* maskCollection; - PtrStepb curMask; - }; - - struct WithOutMask - { - __host__ __device__ __forceinline__ WithOutMask(){} - __host__ __device__ __forceinline__ WithOutMask(const WithOutMask&){} - - __device__ __forceinline__ void next() const - { - } - __device__ __forceinline__ void setMask(int) const - { - } - - __device__ __forceinline__ bool operator()(int, int) const - { - return true; - } - - __device__ __forceinline__ bool operator()(int, int, int) const - { - return true; - } - - static __device__ __forceinline__ bool check(int, int) - { - return true; - } - - static __device__ __forceinline__ bool check(int, int, int) - { - return true; - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // Solve linear system - - // solve 2x2 linear system Ax=b - template __device__ __forceinline__ bool solve2x2(const T A[2][2], const T b[2], T x[2]) - { - T det = A[0][0] * A[1][1] - A[1][0] * A[0][1]; - - if (det != 0) - { - double invdet = 1.0 / det; - - x[0] = saturate_cast(invdet * (b[0] * A[1][1] - b[1] * A[0][1])); - - x[1] = saturate_cast(invdet * (A[0][0] * b[1] - A[1][0] * b[0])); - - return true; - } - - return false; - } - - // solve 3x3 linear system Ax=b - template __device__ __forceinline__ bool solve3x3(const T A[3][3], const T b[3], T x[3]) - { - T det = A[0][0] * (A[1][1] * A[2][2] - A[1][2] * A[2][1]) - - A[0][1] * (A[1][0] * A[2][2] - A[1][2] * A[2][0]) - + A[0][2] * (A[1][0] * A[2][1] - A[1][1] * A[2][0]); - - if (det != 0) - { - double invdet = 1.0 / det; - - x[0] = saturate_cast(invdet * - (b[0] * (A[1][1] * A[2][2] - A[1][2] * A[2][1]) - - A[0][1] * (b[1] * A[2][2] - A[1][2] * b[2] ) + - A[0][2] * (b[1] * A[2][1] - A[1][1] * b[2] ))); - - x[1] = saturate_cast(invdet * - (A[0][0] * (b[1] * A[2][2] - A[1][2] * b[2] ) - - b[0] * (A[1][0] * A[2][2] - A[1][2] * A[2][0]) + - A[0][2] * (A[1][0] * b[2] - b[1] * A[2][0]))); - - x[2] = saturate_cast(invdet * - (A[0][0] * (A[1][1] * b[2] - b[1] * A[2][1]) - - A[0][1] * (A[1][0] * b[2] - b[1] * A[2][0]) + - b[0] * (A[1][0] * A[2][1] - A[1][1] * A[2][0]))); - - return true; - } - - return false; - } -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif // OPENCV_CUDA_UTILITY_HPP diff --git a/opencv/include/opencv2/core/cuda/vec_distance.hpp b/opencv/include/opencv2/core/cuda/vec_distance.hpp deleted file mode 100644 index ef6e510..0000000 --- a/opencv/include/opencv2/core/cuda/vec_distance.hpp +++ /dev/null @@ -1,232 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_VEC_DISTANCE_HPP -#define OPENCV_CUDA_VEC_DISTANCE_HPP - -#include "reduce.hpp" -#include "functional.hpp" -#include "detail/vec_distance_detail.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - template struct L1Dist - { - typedef int value_type; - typedef int result_type; - - __device__ __forceinline__ L1Dist() : mySum(0) {} - - __device__ __forceinline__ void reduceIter(int val1, int val2) - { - mySum = __sad(val1, val2, mySum); - } - - template __device__ __forceinline__ void reduceAll(int* smem, int tid) - { - reduce(smem, mySum, tid, plus()); - } - - __device__ __forceinline__ operator int() const - { - return mySum; - } - - int mySum; - }; - template <> struct L1Dist - { - typedef float value_type; - typedef float result_type; - - __device__ __forceinline__ L1Dist() : mySum(0.0f) {} - - __device__ __forceinline__ void reduceIter(float val1, float val2) - { - mySum += ::fabs(val1 - val2); - } - - template __device__ __forceinline__ void reduceAll(float* smem, int tid) - { - reduce(smem, mySum, tid, plus()); - } - - __device__ __forceinline__ operator float() const - { - return mySum; - } - - float mySum; - }; - - struct L2Dist - { - typedef float value_type; - typedef float result_type; - - __device__ __forceinline__ L2Dist() : mySum(0.0f) {} - - __device__ __forceinline__ void reduceIter(float val1, float val2) - { - float reg = val1 - val2; - mySum += reg * reg; - } - - template __device__ __forceinline__ void reduceAll(float* smem, int tid) - { - reduce(smem, mySum, tid, plus()); - } - - __device__ __forceinline__ operator float() const - { - return sqrtf(mySum); - } - - float mySum; - }; - - struct HammingDist - { - typedef int value_type; - typedef int result_type; - - __device__ __forceinline__ HammingDist() : mySum(0) {} - - __device__ __forceinline__ void reduceIter(int val1, int val2) - { - mySum += __popc(val1 ^ val2); - } - - template __device__ __forceinline__ void reduceAll(int* smem, int tid) - { - reduce(smem, mySum, tid, plus()); - } - - __device__ __forceinline__ operator int() const - { - return mySum; - } - - int mySum; - }; - - // calc distance between two vectors in global memory - template - __device__ void calcVecDiffGlobal(const T1* vec1, const T2* vec2, int len, Dist& dist, typename Dist::result_type* smem, int tid) - { - for (int i = tid; i < len; i += THREAD_DIM) - { - T1 val1; - ForceGlob::Load(vec1, i, val1); - - T2 val2; - ForceGlob::Load(vec2, i, val2); - - dist.reduceIter(val1, val2); - } - - dist.reduceAll(smem, tid); - } - - // calc distance between two vectors, first vector is cached in register or shared memory, second vector is in global memory - template - __device__ __forceinline__ void calcVecDiffCached(const T1* vecCached, const T2* vecGlob, int len, Dist& dist, typename Dist::result_type* smem, int tid) - { - vec_distance_detail::VecDiffCachedCalculator::calc(vecCached, vecGlob, len, dist, tid); - - dist.reduceAll(smem, tid); - } - - // calc distance between two vectors in global memory - template struct VecDiffGlobal - { - explicit __device__ __forceinline__ VecDiffGlobal(const T1* vec1_, int = 0, void* = 0, int = 0, int = 0) - { - vec1 = vec1_; - } - - template - __device__ __forceinline__ void calc(const T2* vec2, int len, Dist& dist, typename Dist::result_type* smem, int tid) const - { - calcVecDiffGlobal(vec1, vec2, len, dist, smem, tid); - } - - const T1* vec1; - }; - - // calc distance between two vectors, first vector is cached in register memory, second vector is in global memory - template struct VecDiffCachedRegister - { - template __device__ __forceinline__ VecDiffCachedRegister(const T1* vec1, int len, U* smem, int glob_tid, int tid) - { - if (glob_tid < len) - smem[glob_tid] = vec1[glob_tid]; - __syncthreads(); - - U* vec1ValsPtr = vec1Vals; - - #pragma unroll - for (int i = tid; i < MAX_LEN; i += THREAD_DIM) - *vec1ValsPtr++ = smem[i]; - - __syncthreads(); - } - - template - __device__ __forceinline__ void calc(const T2* vec2, int len, Dist& dist, typename Dist::result_type* smem, int tid) const - { - calcVecDiffCached(vec1Vals, vec2, len, dist, smem, tid); - } - - U vec1Vals[MAX_LEN / THREAD_DIM]; - }; -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif // OPENCV_CUDA_VEC_DISTANCE_HPP diff --git a/opencv/include/opencv2/core/cuda/vec_math.hpp b/opencv/include/opencv2/core/cuda/vec_math.hpp deleted file mode 100644 index 9085b92..0000000 --- a/opencv/include/opencv2/core/cuda/vec_math.hpp +++ /dev/null @@ -1,930 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_VECMATH_HPP -#define OPENCV_CUDA_VECMATH_HPP - -#include "vec_traits.hpp" -#include "saturate_cast.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - -// saturate_cast - -namespace vec_math_detail -{ - template struct SatCastHelper; - template struct SatCastHelper<1, VecD> - { - template static __device__ __forceinline__ VecD cast(const VecS& v) - { - typedef typename VecTraits::elem_type D; - return VecTraits::make(saturate_cast(v.x)); - } - }; - template struct SatCastHelper<2, VecD> - { - template static __device__ __forceinline__ VecD cast(const VecS& v) - { - typedef typename VecTraits::elem_type D; - return VecTraits::make(saturate_cast(v.x), saturate_cast(v.y)); - } - }; - template struct SatCastHelper<3, VecD> - { - template static __device__ __forceinline__ VecD cast(const VecS& v) - { - typedef typename VecTraits::elem_type D; - return VecTraits::make(saturate_cast(v.x), saturate_cast(v.y), saturate_cast(v.z)); - } - }; - template struct SatCastHelper<4, VecD> - { - template static __device__ __forceinline__ VecD cast(const VecS& v) - { - typedef typename VecTraits::elem_type D; - return VecTraits::make(saturate_cast(v.x), saturate_cast(v.y), saturate_cast(v.z), saturate_cast(v.w)); - } - }; - - template static __device__ __forceinline__ VecD saturate_cast_helper(const VecS& v) - { - return SatCastHelper::cn, VecD>::cast(v); - } -} - -template static __device__ __forceinline__ T saturate_cast(const uchar1& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const char1& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const ushort1& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const short1& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const uint1& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const int1& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const float1& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const double1& v) {return vec_math_detail::saturate_cast_helper(v);} - -template static __device__ __forceinline__ T saturate_cast(const uchar2& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const char2& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const ushort2& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const short2& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const uint2& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const int2& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const float2& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const double2& v) {return vec_math_detail::saturate_cast_helper(v);} - -template static __device__ __forceinline__ T saturate_cast(const uchar3& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const char3& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const ushort3& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const short3& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const uint3& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const int3& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const float3& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const double3& v) {return vec_math_detail::saturate_cast_helper(v);} - -template static __device__ __forceinline__ T saturate_cast(const uchar4& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const char4& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const ushort4& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const short4& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const uint4& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const int4& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const float4& v) {return vec_math_detail::saturate_cast_helper(v);} -template static __device__ __forceinline__ T saturate_cast(const double4& v) {return vec_math_detail::saturate_cast_helper(v);} - -// unary operators - -#define CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(op, input_type, output_type) \ - __device__ __forceinline__ output_type ## 1 operator op(const input_type ## 1 & a) \ - { \ - return VecTraits::make(op (a.x)); \ - } \ - __device__ __forceinline__ output_type ## 2 operator op(const input_type ## 2 & a) \ - { \ - return VecTraits::make(op (a.x), op (a.y)); \ - } \ - __device__ __forceinline__ output_type ## 3 operator op(const input_type ## 3 & a) \ - { \ - return VecTraits::make(op (a.x), op (a.y), op (a.z)); \ - } \ - __device__ __forceinline__ output_type ## 4 operator op(const input_type ## 4 & a) \ - { \ - return VecTraits::make(op (a.x), op (a.y), op (a.z), op (a.w)); \ - } - -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(-, char, char) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(-, short, short) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(-, int, int) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(-, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(-, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(!, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(!, char, uchar) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(!, ushort, uchar) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(!, short, uchar) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(!, int, uchar) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(!, uint, uchar) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(!, float, uchar) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(!, double, uchar) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(~, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(~, char, char) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(~, ushort, ushort) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(~, short, short) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(~, int, int) -CV_CUDEV_IMPLEMENT_VEC_UNARY_OP(~, uint, uint) - -#undef CV_CUDEV_IMPLEMENT_VEC_UNARY_OP - -// unary functions - -#define CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(func_name, func, input_type, output_type) \ - __device__ __forceinline__ output_type ## 1 func_name(const input_type ## 1 & a) \ - { \ - return VecTraits::make(func (a.x)); \ - } \ - __device__ __forceinline__ output_type ## 2 func_name(const input_type ## 2 & a) \ - { \ - return VecTraits::make(func (a.x), func (a.y)); \ - } \ - __device__ __forceinline__ output_type ## 3 func_name(const input_type ## 3 & a) \ - { \ - return VecTraits::make(func (a.x), func (a.y), func (a.z)); \ - } \ - __device__ __forceinline__ output_type ## 4 func_name(const input_type ## 4 & a) \ - { \ - return VecTraits::make(func (a.x), func (a.y), func (a.z), func (a.w)); \ - } - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(abs, /*::abs*/, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(abs, ::abs, char, char) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(abs, /*::abs*/, ushort, ushort) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(abs, ::abs, short, short) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(abs, ::abs, int, int) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(abs, /*::abs*/, uint, uint) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(abs, ::fabsf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(abs, ::fabs, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sqrt, ::sqrtf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sqrt, ::sqrtf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sqrt, ::sqrtf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sqrt, ::sqrtf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sqrt, ::sqrtf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sqrt, ::sqrtf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sqrt, ::sqrtf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sqrt, ::sqrt, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp, ::expf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp, ::expf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp, ::expf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp, ::expf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp, ::expf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp, ::expf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp, ::expf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp, ::exp, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp2, ::exp2f, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp2, ::exp2f, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp2, ::exp2f, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp2, ::exp2f, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp2, ::exp2f, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp2, ::exp2f, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp2, ::exp2f, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp2, ::exp2, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp10, ::exp10f, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp10, ::exp10f, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp10, ::exp10f, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp10, ::exp10f, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp10, ::exp10f, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp10, ::exp10f, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp10, ::exp10f, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(exp10, ::exp10, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log, ::logf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log, ::logf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log, ::logf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log, ::logf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log, ::logf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log, ::logf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log, ::logf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log, ::log, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log2, ::log2f, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log2, ::log2f, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log2, ::log2f, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log2, ::log2f, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log2, ::log2f, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log2, ::log2f, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log2, ::log2f, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log2, ::log2, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log10, ::log10f, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log10, ::log10f, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log10, ::log10f, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log10, ::log10f, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log10, ::log10f, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log10, ::log10f, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log10, ::log10f, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(log10, ::log10, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sin, ::sinf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sin, ::sinf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sin, ::sinf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sin, ::sinf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sin, ::sinf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sin, ::sinf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sin, ::sinf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sin, ::sin, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cos, ::cosf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cos, ::cosf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cos, ::cosf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cos, ::cosf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cos, ::cosf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cos, ::cosf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cos, ::cosf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cos, ::cos, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tan, ::tanf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tan, ::tanf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tan, ::tanf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tan, ::tanf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tan, ::tanf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tan, ::tanf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tan, ::tanf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tan, ::tan, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asin, ::asinf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asin, ::asinf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asin, ::asinf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asin, ::asinf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asin, ::asinf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asin, ::asinf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asin, ::asinf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asin, ::asin, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acos, ::acosf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acos, ::acosf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acos, ::acosf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acos, ::acosf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acos, ::acosf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acos, ::acosf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acos, ::acosf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acos, ::acos, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atan, ::atanf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atan, ::atanf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atan, ::atanf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atan, ::atanf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atan, ::atanf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atan, ::atanf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atan, ::atanf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atan, ::atan, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sinh, ::sinhf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sinh, ::sinhf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sinh, ::sinhf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sinh, ::sinhf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sinh, ::sinhf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sinh, ::sinhf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sinh, ::sinhf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(sinh, ::sinh, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cosh, ::coshf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cosh, ::coshf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cosh, ::coshf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cosh, ::coshf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cosh, ::coshf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cosh, ::coshf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cosh, ::coshf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(cosh, ::cosh, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tanh, ::tanhf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tanh, ::tanhf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tanh, ::tanhf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tanh, ::tanhf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tanh, ::tanhf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tanh, ::tanhf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tanh, ::tanhf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(tanh, ::tanh, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asinh, ::asinhf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asinh, ::asinhf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asinh, ::asinhf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asinh, ::asinhf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asinh, ::asinhf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asinh, ::asinhf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asinh, ::asinhf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(asinh, ::asinh, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acosh, ::acoshf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acosh, ::acoshf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acosh, ::acoshf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acosh, ::acoshf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acosh, ::acoshf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acosh, ::acoshf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acosh, ::acoshf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(acosh, ::acosh, double, double) - -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atanh, ::atanhf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atanh, ::atanhf, char, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atanh, ::atanhf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atanh, ::atanhf, short, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atanh, ::atanhf, int, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atanh, ::atanhf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atanh, ::atanhf, float, float) -CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC(atanh, ::atanh, double, double) - -#undef CV_CUDEV_IMPLEMENT_VEC_UNARY_FUNC - -// binary operators (vec & vec) - -#define CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(op, input_type, output_type) \ - __device__ __forceinline__ output_type ## 1 operator op(const input_type ## 1 & a, const input_type ## 1 & b) \ - { \ - return VecTraits::make(a.x op b.x); \ - } \ - __device__ __forceinline__ output_type ## 2 operator op(const input_type ## 2 & a, const input_type ## 2 & b) \ - { \ - return VecTraits::make(a.x op b.x, a.y op b.y); \ - } \ - __device__ __forceinline__ output_type ## 3 operator op(const input_type ## 3 & a, const input_type ## 3 & b) \ - { \ - return VecTraits::make(a.x op b.x, a.y op b.y, a.z op b.z); \ - } \ - __device__ __forceinline__ output_type ## 4 operator op(const input_type ## 4 & a, const input_type ## 4 & b) \ - { \ - return VecTraits::make(a.x op b.x, a.y op b.y, a.z op b.z, a.w op b.w); \ - } - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(+, uchar, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(+, char, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(+, ushort, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(+, short, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(+, int, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(+, uint, uint) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(+, float, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(+, double, double) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(-, uchar, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(-, char, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(-, ushort, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(-, short, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(-, int, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(-, uint, uint) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(-, float, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(-, double, double) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(*, uchar, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(*, char, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(*, ushort, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(*, short, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(*, int, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(*, uint, uint) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(*, float, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(*, double, double) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(/, uchar, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(/, char, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(/, ushort, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(/, short, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(/, int, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(/, uint, uint) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(/, float, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(/, double, double) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(==, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(==, char, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(==, ushort, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(==, short, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(==, int, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(==, uint, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(==, float, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(==, double, uchar) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(!=, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(!=, char, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(!=, ushort, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(!=, short, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(!=, int, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(!=, uint, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(!=, float, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(!=, double, uchar) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>, char, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>, ushort, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>, short, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>, int, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>, uint, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>, float, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>, double, uchar) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<, char, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<, ushort, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<, short, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<, int, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<, uint, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<, float, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<, double, uchar) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>=, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>=, char, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>=, ushort, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>=, short, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>=, int, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>=, uint, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>=, float, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(>=, double, uchar) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<=, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<=, char, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<=, ushort, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<=, short, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<=, int, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<=, uint, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<=, float, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(<=, double, uchar) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&&, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&&, char, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&&, ushort, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&&, short, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&&, int, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&&, uint, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&&, float, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&&, double, uchar) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(||, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(||, char, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(||, ushort, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(||, short, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(||, int, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(||, uint, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(||, float, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(||, double, uchar) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&, char, char) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&, ushort, ushort) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&, short, short) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&, int, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(&, uint, uint) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(|, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(|, char, char) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(|, ushort, ushort) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(|, short, short) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(|, int, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(|, uint, uint) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(^, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(^, char, char) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(^, ushort, ushort) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(^, short, short) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(^, int, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_OP(^, uint, uint) - -#undef CV_CUDEV_IMPLEMENT_VEC_BINARY_OP - -// binary operators (vec & scalar) - -#define CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(op, input_type, scalar_type, output_type) \ - __device__ __forceinline__ output_type ## 1 operator op(const input_type ## 1 & a, scalar_type s) \ - { \ - return VecTraits::make(a.x op s); \ - } \ - __device__ __forceinline__ output_type ## 1 operator op(scalar_type s, const input_type ## 1 & b) \ - { \ - return VecTraits::make(s op b.x); \ - } \ - __device__ __forceinline__ output_type ## 2 operator op(const input_type ## 2 & a, scalar_type s) \ - { \ - return VecTraits::make(a.x op s, a.y op s); \ - } \ - __device__ __forceinline__ output_type ## 2 operator op(scalar_type s, const input_type ## 2 & b) \ - { \ - return VecTraits::make(s op b.x, s op b.y); \ - } \ - __device__ __forceinline__ output_type ## 3 operator op(const input_type ## 3 & a, scalar_type s) \ - { \ - return VecTraits::make(a.x op s, a.y op s, a.z op s); \ - } \ - __device__ __forceinline__ output_type ## 3 operator op(scalar_type s, const input_type ## 3 & b) \ - { \ - return VecTraits::make(s op b.x, s op b.y, s op b.z); \ - } \ - __device__ __forceinline__ output_type ## 4 operator op(const input_type ## 4 & a, scalar_type s) \ - { \ - return VecTraits::make(a.x op s, a.y op s, a.z op s, a.w op s); \ - } \ - __device__ __forceinline__ output_type ## 4 operator op(scalar_type s, const input_type ## 4 & b) \ - { \ - return VecTraits::make(s op b.x, s op b.y, s op b.z, s op b.w); \ - } - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, uchar, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, uchar, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, uchar, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, char, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, char, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, char, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, ushort, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, ushort, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, ushort, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, short, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, short, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, short, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, int, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, int, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, int, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, uint, uint, uint) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, uint, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, uint, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, float, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, float, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(+, double, double, double) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, uchar, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, uchar, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, uchar, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, char, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, char, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, char, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, ushort, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, ushort, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, ushort, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, short, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, short, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, short, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, int, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, int, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, int, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, uint, uint, uint) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, uint, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, uint, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, float, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, float, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(-, double, double, double) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, uchar, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, uchar, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, uchar, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, char, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, char, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, char, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, ushort, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, ushort, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, ushort, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, short, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, short, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, short, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, int, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, int, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, int, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, uint, uint, uint) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, uint, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, uint, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, float, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, float, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(*, double, double, double) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, uchar, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, uchar, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, uchar, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, char, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, char, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, char, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, ushort, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, ushort, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, ushort, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, short, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, short, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, short, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, int, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, int, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, int, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, uint, uint, uint) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, uint, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, uint, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, float, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, float, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(/, double, double, double) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(==, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(==, char, char, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(==, ushort, ushort, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(==, short, short, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(==, int, int, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(==, uint, uint, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(==, float, float, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(==, double, double, uchar) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(!=, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(!=, char, char, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(!=, ushort, ushort, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(!=, short, short, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(!=, int, int, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(!=, uint, uint, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(!=, float, float, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(!=, double, double, uchar) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>, char, char, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>, ushort, ushort, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>, short, short, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>, int, int, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>, uint, uint, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>, float, float, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>, double, double, uchar) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<, char, char, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<, ushort, ushort, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<, short, short, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<, int, int, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<, uint, uint, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<, float, float, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<, double, double, uchar) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>=, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>=, char, char, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>=, ushort, ushort, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>=, short, short, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>=, int, int, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>=, uint, uint, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>=, float, float, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(>=, double, double, uchar) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<=, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<=, char, char, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<=, ushort, ushort, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<=, short, short, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<=, int, int, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<=, uint, uint, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<=, float, float, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(<=, double, double, uchar) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&&, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&&, char, char, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&&, ushort, ushort, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&&, short, short, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&&, int, int, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&&, uint, uint, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&&, float, float, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&&, double, double, uchar) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(||, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(||, char, char, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(||, ushort, ushort, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(||, short, short, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(||, int, int, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(||, uint, uint, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(||, float, float, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(||, double, double, uchar) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&, char, char, char) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&, ushort, ushort, ushort) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&, short, short, short) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&, int, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(&, uint, uint, uint) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(|, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(|, char, char, char) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(|, ushort, ushort, ushort) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(|, short, short, short) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(|, int, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(|, uint, uint, uint) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(^, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(^, char, char, char) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(^, ushort, ushort, ushort) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(^, short, short, short) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(^, int, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP(^, uint, uint, uint) - -#undef CV_CUDEV_IMPLEMENT_SCALAR_BINARY_OP - -// binary function (vec & vec) - -#define CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(func_name, func, input_type, output_type) \ - __device__ __forceinline__ output_type ## 1 func_name(const input_type ## 1 & a, const input_type ## 1 & b) \ - { \ - return VecTraits::make(func (a.x, b.x)); \ - } \ - __device__ __forceinline__ output_type ## 2 func_name(const input_type ## 2 & a, const input_type ## 2 & b) \ - { \ - return VecTraits::make(func (a.x, b.x), func (a.y, b.y)); \ - } \ - __device__ __forceinline__ output_type ## 3 func_name(const input_type ## 3 & a, const input_type ## 3 & b) \ - { \ - return VecTraits::make(func (a.x, b.x), func (a.y, b.y), func (a.z, b.z)); \ - } \ - __device__ __forceinline__ output_type ## 4 func_name(const input_type ## 4 & a, const input_type ## 4 & b) \ - { \ - return VecTraits::make(func (a.x, b.x), func (a.y, b.y), func (a.z, b.z), func (a.w, b.w)); \ - } - -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(max, ::max, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(max, ::max, char, char) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(max, ::max, ushort, ushort) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(max, ::max, short, short) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(max, ::max, uint, uint) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(max, ::max, int, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(max, ::fmaxf, float, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(max, ::fmax, double, double) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(min, ::min, uchar, uchar) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(min, ::min, char, char) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(min, ::min, ushort, ushort) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(min, ::min, short, short) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(min, ::min, uint, uint) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(min, ::min, int, int) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(min, ::fminf, float, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(min, ::fmin, double, double) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(hypot, ::hypotf, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(hypot, ::hypotf, char, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(hypot, ::hypotf, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(hypot, ::hypotf, short, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(hypot, ::hypotf, uint, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(hypot, ::hypotf, int, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(hypot, ::hypotf, float, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(hypot, ::hypot, double, double) - -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(atan2, ::atan2f, uchar, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(atan2, ::atan2f, char, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(atan2, ::atan2f, ushort, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(atan2, ::atan2f, short, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(atan2, ::atan2f, uint, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(atan2, ::atan2f, int, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(atan2, ::atan2f, float, float) -CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC(atan2, ::atan2, double, double) - -#undef CV_CUDEV_IMPLEMENT_VEC_BINARY_FUNC - -// binary function (vec & scalar) - -#define CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(func_name, func, input_type, scalar_type, output_type) \ - __device__ __forceinline__ output_type ## 1 func_name(const input_type ## 1 & a, scalar_type s) \ - { \ - return VecTraits::make(func ((output_type) a.x, (output_type) s)); \ - } \ - __device__ __forceinline__ output_type ## 1 func_name(scalar_type s, const input_type ## 1 & b) \ - { \ - return VecTraits::make(func ((output_type) s, (output_type) b.x)); \ - } \ - __device__ __forceinline__ output_type ## 2 func_name(const input_type ## 2 & a, scalar_type s) \ - { \ - return VecTraits::make(func ((output_type) a.x, (output_type) s), func ((output_type) a.y, (output_type) s)); \ - } \ - __device__ __forceinline__ output_type ## 2 func_name(scalar_type s, const input_type ## 2 & b) \ - { \ - return VecTraits::make(func ((output_type) s, (output_type) b.x), func ((output_type) s, (output_type) b.y)); \ - } \ - __device__ __forceinline__ output_type ## 3 func_name(const input_type ## 3 & a, scalar_type s) \ - { \ - return VecTraits::make(func ((output_type) a.x, (output_type) s), func ((output_type) a.y, (output_type) s), func ((output_type) a.z, (output_type) s)); \ - } \ - __device__ __forceinline__ output_type ## 3 func_name(scalar_type s, const input_type ## 3 & b) \ - { \ - return VecTraits::make(func ((output_type) s, (output_type) b.x), func ((output_type) s, (output_type) b.y), func ((output_type) s, (output_type) b.z)); \ - } \ - __device__ __forceinline__ output_type ## 4 func_name(const input_type ## 4 & a, scalar_type s) \ - { \ - return VecTraits::make(func ((output_type) a.x, (output_type) s), func ((output_type) a.y, (output_type) s), func ((output_type) a.z, (output_type) s), func ((output_type) a.w, (output_type) s)); \ - } \ - __device__ __forceinline__ output_type ## 4 func_name(scalar_type s, const input_type ## 4 & b) \ - { \ - return VecTraits::make(func ((output_type) s, (output_type) b.x), func ((output_type) s, (output_type) b.y), func ((output_type) s, (output_type) b.z), func ((output_type) s, (output_type) b.w)); \ - } - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::max, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmaxf, uchar, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmax, uchar, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::max, char, char, char) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmaxf, char, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmax, char, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::max, ushort, ushort, ushort) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmaxf, ushort, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmax, ushort, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::max, short, short, short) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmaxf, short, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmax, short, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::max, uint, uint, uint) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmaxf, uint, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmax, uint, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::max, int, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmaxf, int, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmax, int, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmaxf, float, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmax, float, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(max, ::fmax, double, double, double) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::min, uchar, uchar, uchar) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fminf, uchar, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fmin, uchar, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::min, char, char, char) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fminf, char, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fmin, char, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::min, ushort, ushort, ushort) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fminf, ushort, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fmin, ushort, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::min, short, short, short) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fminf, short, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fmin, short, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::min, uint, uint, uint) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fminf, uint, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fmin, uint, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::min, int, int, int) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fminf, int, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fmin, int, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fminf, float, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fmin, float, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(min, ::fmin, double, double, double) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypotf, uchar, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypot, uchar, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypotf, char, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypot, char, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypotf, ushort, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypot, ushort, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypotf, short, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypot, short, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypotf, uint, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypot, uint, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypotf, int, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypot, int, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypotf, float, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypot, float, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(hypot, ::hypot, double, double, double) - -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2f, uchar, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2, uchar, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2f, char, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2, char, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2f, ushort, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2, ushort, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2f, short, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2, short, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2f, uint, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2, uint, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2f, int, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2, int, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2f, float, float, float) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2, float, double, double) -CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2, double, double, double) - -#undef CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC - -}}} // namespace cv { namespace cuda { namespace device - -//! @endcond - -#endif // OPENCV_CUDA_VECMATH_HPP diff --git a/opencv/include/opencv2/core/cuda/vec_traits.hpp b/opencv/include/opencv2/core/cuda/vec_traits.hpp deleted file mode 100644 index b5ff281..0000000 --- a/opencv/include/opencv2/core/cuda/vec_traits.hpp +++ /dev/null @@ -1,288 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_VEC_TRAITS_HPP -#define OPENCV_CUDA_VEC_TRAITS_HPP - -#include "common.hpp" - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - template struct TypeVec; - - struct __align__(8) uchar8 - { - uchar a0, a1, a2, a3, a4, a5, a6, a7; - }; - static __host__ __device__ __forceinline__ uchar8 make_uchar8(uchar a0, uchar a1, uchar a2, uchar a3, uchar a4, uchar a5, uchar a6, uchar a7) - { - uchar8 val = {a0, a1, a2, a3, a4, a5, a6, a7}; - return val; - } - struct __align__(8) char8 - { - schar a0, a1, a2, a3, a4, a5, a6, a7; - }; - static __host__ __device__ __forceinline__ char8 make_char8(schar a0, schar a1, schar a2, schar a3, schar a4, schar a5, schar a6, schar a7) - { - char8 val = {a0, a1, a2, a3, a4, a5, a6, a7}; - return val; - } - struct __align__(16) ushort8 - { - ushort a0, a1, a2, a3, a4, a5, a6, a7; - }; - static __host__ __device__ __forceinline__ ushort8 make_ushort8(ushort a0, ushort a1, ushort a2, ushort a3, ushort a4, ushort a5, ushort a6, ushort a7) - { - ushort8 val = {a0, a1, a2, a3, a4, a5, a6, a7}; - return val; - } - struct __align__(16) short8 - { - short a0, a1, a2, a3, a4, a5, a6, a7; - }; - static __host__ __device__ __forceinline__ short8 make_short8(short a0, short a1, short a2, short a3, short a4, short a5, short a6, short a7) - { - short8 val = {a0, a1, a2, a3, a4, a5, a6, a7}; - return val; - } - struct __align__(32) uint8 - { - uint a0, a1, a2, a3, a4, a5, a6, a7; - }; - static __host__ __device__ __forceinline__ uint8 make_uint8(uint a0, uint a1, uint a2, uint a3, uint a4, uint a5, uint a6, uint a7) - { - uint8 val = {a0, a1, a2, a3, a4, a5, a6, a7}; - return val; - } - struct __align__(32) int8 - { - int a0, a1, a2, a3, a4, a5, a6, a7; - }; - static __host__ __device__ __forceinline__ int8 make_int8(int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7) - { - int8 val = {a0, a1, a2, a3, a4, a5, a6, a7}; - return val; - } - struct __align__(32) float8 - { - float a0, a1, a2, a3, a4, a5, a6, a7; - }; - static __host__ __device__ __forceinline__ float8 make_float8(float a0, float a1, float a2, float a3, float a4, float a5, float a6, float a7) - { - float8 val = {a0, a1, a2, a3, a4, a5, a6, a7}; - return val; - } - struct double8 - { - double a0, a1, a2, a3, a4, a5, a6, a7; - }; - static __host__ __device__ __forceinline__ double8 make_double8(double a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7) - { - double8 val = {a0, a1, a2, a3, a4, a5, a6, a7}; - return val; - } - -#define OPENCV_CUDA_IMPLEMENT_TYPE_VEC(type) \ - template<> struct TypeVec { typedef type vec_type; }; \ - template<> struct TypeVec { typedef type ## 1 vec_type; }; \ - template<> struct TypeVec { typedef type ## 2 vec_type; }; \ - template<> struct TypeVec { typedef type ## 2 vec_type; }; \ - template<> struct TypeVec { typedef type ## 3 vec_type; }; \ - template<> struct TypeVec { typedef type ## 3 vec_type; }; \ - template<> struct TypeVec { typedef type ## 4 vec_type; }; \ - template<> struct TypeVec { typedef type ## 4 vec_type; }; \ - template<> struct TypeVec { typedef type ## 8 vec_type; }; \ - template<> struct TypeVec { typedef type ## 8 vec_type; }; - - OPENCV_CUDA_IMPLEMENT_TYPE_VEC(uchar) - OPENCV_CUDA_IMPLEMENT_TYPE_VEC(char) - OPENCV_CUDA_IMPLEMENT_TYPE_VEC(ushort) - OPENCV_CUDA_IMPLEMENT_TYPE_VEC(short) - OPENCV_CUDA_IMPLEMENT_TYPE_VEC(int) - OPENCV_CUDA_IMPLEMENT_TYPE_VEC(uint) - OPENCV_CUDA_IMPLEMENT_TYPE_VEC(float) - OPENCV_CUDA_IMPLEMENT_TYPE_VEC(double) - - #undef OPENCV_CUDA_IMPLEMENT_TYPE_VEC - - template<> struct TypeVec { typedef schar vec_type; }; - template<> struct TypeVec { typedef char2 vec_type; }; - template<> struct TypeVec { typedef char3 vec_type; }; - template<> struct TypeVec { typedef char4 vec_type; }; - template<> struct TypeVec { typedef char8 vec_type; }; - - template<> struct TypeVec { typedef uchar vec_type; }; - template<> struct TypeVec { typedef uchar2 vec_type; }; - template<> struct TypeVec { typedef uchar3 vec_type; }; - template<> struct TypeVec { typedef uchar4 vec_type; }; - template<> struct TypeVec { typedef uchar8 vec_type; }; - - template struct VecTraits; - -#define OPENCV_CUDA_IMPLEMENT_VEC_TRAITS(type) \ - template<> struct VecTraits \ - { \ - typedef type elem_type; \ - enum {cn=1}; \ - static __device__ __host__ __forceinline__ type all(type v) {return v;} \ - static __device__ __host__ __forceinline__ type make(type x) {return x;} \ - static __device__ __host__ __forceinline__ type make(const type* v) {return *v;} \ - }; \ - template<> struct VecTraits \ - { \ - typedef type elem_type; \ - enum {cn=1}; \ - static __device__ __host__ __forceinline__ type ## 1 all(type v) {return make_ ## type ## 1(v);} \ - static __device__ __host__ __forceinline__ type ## 1 make(type x) {return make_ ## type ## 1(x);} \ - static __device__ __host__ __forceinline__ type ## 1 make(const type* v) {return make_ ## type ## 1(*v);} \ - }; \ - template<> struct VecTraits \ - { \ - typedef type elem_type; \ - enum {cn=2}; \ - static __device__ __host__ __forceinline__ type ## 2 all(type v) {return make_ ## type ## 2(v, v);} \ - static __device__ __host__ __forceinline__ type ## 2 make(type x, type y) {return make_ ## type ## 2(x, y);} \ - static __device__ __host__ __forceinline__ type ## 2 make(const type* v) {return make_ ## type ## 2(v[0], v[1]);} \ - }; \ - template<> struct VecTraits \ - { \ - typedef type elem_type; \ - enum {cn=3}; \ - static __device__ __host__ __forceinline__ type ## 3 all(type v) {return make_ ## type ## 3(v, v, v);} \ - static __device__ __host__ __forceinline__ type ## 3 make(type x, type y, type z) {return make_ ## type ## 3(x, y, z);} \ - static __device__ __host__ __forceinline__ type ## 3 make(const type* v) {return make_ ## type ## 3(v[0], v[1], v[2]);} \ - }; \ - template<> struct VecTraits \ - { \ - typedef type elem_type; \ - enum {cn=4}; \ - static __device__ __host__ __forceinline__ type ## 4 all(type v) {return make_ ## type ## 4(v, v, v, v);} \ - static __device__ __host__ __forceinline__ type ## 4 make(type x, type y, type z, type w) {return make_ ## type ## 4(x, y, z, w);} \ - static __device__ __host__ __forceinline__ type ## 4 make(const type* v) {return make_ ## type ## 4(v[0], v[1], v[2], v[3]);} \ - }; \ - template<> struct VecTraits \ - { \ - typedef type elem_type; \ - enum {cn=8}; \ - static __device__ __host__ __forceinline__ type ## 8 all(type v) {return make_ ## type ## 8(v, v, v, v, v, v, v, v);} \ - static __device__ __host__ __forceinline__ type ## 8 make(type a0, type a1, type a2, type a3, type a4, type a5, type a6, type a7) {return make_ ## type ## 8(a0, a1, a2, a3, a4, a5, a6, a7);} \ - static __device__ __host__ __forceinline__ type ## 8 make(const type* v) {return make_ ## type ## 8(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);} \ - }; - - OPENCV_CUDA_IMPLEMENT_VEC_TRAITS(uchar) - OPENCV_CUDA_IMPLEMENT_VEC_TRAITS(ushort) - OPENCV_CUDA_IMPLEMENT_VEC_TRAITS(short) - OPENCV_CUDA_IMPLEMENT_VEC_TRAITS(int) - OPENCV_CUDA_IMPLEMENT_VEC_TRAITS(uint) - OPENCV_CUDA_IMPLEMENT_VEC_TRAITS(float) - OPENCV_CUDA_IMPLEMENT_VEC_TRAITS(double) - - #undef OPENCV_CUDA_IMPLEMENT_VEC_TRAITS - - template<> struct VecTraits - { - typedef char elem_type; - enum {cn=1}; - static __device__ __host__ __forceinline__ char all(char v) {return v;} - static __device__ __host__ __forceinline__ char make(char x) {return x;} - static __device__ __host__ __forceinline__ char make(const char* x) {return *x;} - }; - template<> struct VecTraits - { - typedef schar elem_type; - enum {cn=1}; - static __device__ __host__ __forceinline__ schar all(schar v) {return v;} - static __device__ __host__ __forceinline__ schar make(schar x) {return x;} - static __device__ __host__ __forceinline__ schar make(const schar* x) {return *x;} - }; - template<> struct VecTraits - { - typedef schar elem_type; - enum {cn=1}; - static __device__ __host__ __forceinline__ char1 all(schar v) {return make_char1(v);} - static __device__ __host__ __forceinline__ char1 make(schar x) {return make_char1(x);} - static __device__ __host__ __forceinline__ char1 make(const schar* v) {return make_char1(v[0]);} - }; - template<> struct VecTraits - { - typedef schar elem_type; - enum {cn=2}; - static __device__ __host__ __forceinline__ char2 all(schar v) {return make_char2(v, v);} - static __device__ __host__ __forceinline__ char2 make(schar x, schar y) {return make_char2(x, y);} - static __device__ __host__ __forceinline__ char2 make(const schar* v) {return make_char2(v[0], v[1]);} - }; - template<> struct VecTraits - { - typedef schar elem_type; - enum {cn=3}; - static __device__ __host__ __forceinline__ char3 all(schar v) {return make_char3(v, v, v);} - static __device__ __host__ __forceinline__ char3 make(schar x, schar y, schar z) {return make_char3(x, y, z);} - static __device__ __host__ __forceinline__ char3 make(const schar* v) {return make_char3(v[0], v[1], v[2]);} - }; - template<> struct VecTraits - { - typedef schar elem_type; - enum {cn=4}; - static __device__ __host__ __forceinline__ char4 all(schar v) {return make_char4(v, v, v, v);} - static __device__ __host__ __forceinline__ char4 make(schar x, schar y, schar z, schar w) {return make_char4(x, y, z, w);} - static __device__ __host__ __forceinline__ char4 make(const schar* v) {return make_char4(v[0], v[1], v[2], v[3]);} - }; - template<> struct VecTraits - { - typedef schar elem_type; - enum {cn=8}; - static __device__ __host__ __forceinline__ char8 all(schar v) {return make_char8(v, v, v, v, v, v, v, v);} - static __device__ __host__ __forceinline__ char8 make(schar a0, schar a1, schar a2, schar a3, schar a4, schar a5, schar a6, schar a7) {return make_char8(a0, a1, a2, a3, a4, a5, a6, a7);} - static __device__ __host__ __forceinline__ char8 make(const schar* v) {return make_char8(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);} - }; -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif // OPENCV_CUDA_VEC_TRAITS_HPP diff --git a/opencv/include/opencv2/core/cuda/warp.hpp b/opencv/include/opencv2/core/cuda/warp.hpp deleted file mode 100644 index 8af7e6a..0000000 --- a/opencv/include/opencv2/core/cuda/warp.hpp +++ /dev/null @@ -1,139 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_DEVICE_WARP_HPP -#define OPENCV_CUDA_DEVICE_WARP_HPP - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - struct Warp - { - enum - { - LOG_WARP_SIZE = 5, - WARP_SIZE = 1 << LOG_WARP_SIZE, - STRIDE = WARP_SIZE - }; - - /** \brief Returns the warp lane ID of the calling thread. */ - static __device__ __forceinline__ unsigned int laneId() - { - unsigned int ret; - asm("mov.u32 %0, %%laneid;" : "=r"(ret) ); - return ret; - } - - template - static __device__ __forceinline__ void fill(It beg, It end, const T& value) - { - for(It t = beg + laneId(); t < end; t += STRIDE) - *t = value; - } - - template - static __device__ __forceinline__ OutIt copy(InIt beg, InIt end, OutIt out) - { - for(InIt t = beg + laneId(); t < end; t += STRIDE, out += STRIDE) - *out = *t; - return out; - } - - template - static __device__ __forceinline__ OutIt transform(InIt beg, InIt end, OutIt out, UnOp op) - { - for(InIt t = beg + laneId(); t < end; t += STRIDE, out += STRIDE) - *out = op(*t); - return out; - } - - template - static __device__ __forceinline__ OutIt transform(InIt1 beg1, InIt1 end1, InIt2 beg2, OutIt out, BinOp op) - { - unsigned int lane = laneId(); - - InIt1 t1 = beg1 + lane; - InIt2 t2 = beg2 + lane; - for(; t1 < end1; t1 += STRIDE, t2 += STRIDE, out += STRIDE) - *out = op(*t1, *t2); - return out; - } - - template - static __device__ __forceinline__ T reduce(volatile T *ptr, BinOp op) - { - const unsigned int lane = laneId(); - - if (lane < 16) - { - T partial = ptr[lane]; - - ptr[lane] = partial = op(partial, ptr[lane + 16]); - ptr[lane] = partial = op(partial, ptr[lane + 8]); - ptr[lane] = partial = op(partial, ptr[lane + 4]); - ptr[lane] = partial = op(partial, ptr[lane + 2]); - ptr[lane] = partial = op(partial, ptr[lane + 1]); - } - - return *ptr; - } - - template - static __device__ __forceinline__ void yota(OutIt beg, OutIt end, T value) - { - unsigned int lane = laneId(); - value += lane; - - for(OutIt t = beg + lane; t < end; t += STRIDE, value += STRIDE) - *t = value; - } - }; -}}} // namespace cv { namespace cuda { namespace cudev - -//! @endcond - -#endif /* OPENCV_CUDA_DEVICE_WARP_HPP */ diff --git a/opencv/include/opencv2/core/cuda/warp_reduce.hpp b/opencv/include/opencv2/core/cuda/warp_reduce.hpp deleted file mode 100644 index 530303d..0000000 --- a/opencv/include/opencv2/core/cuda/warp_reduce.hpp +++ /dev/null @@ -1,76 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_WARP_REDUCE_HPP__ -#define OPENCV_CUDA_WARP_REDUCE_HPP__ - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ - template - __device__ __forceinline__ T warp_reduce(volatile T *ptr , const unsigned int tid = threadIdx.x) - { - const unsigned int lane = tid & 31; // index of thread in warp (0..31) - - if (lane < 16) - { - T partial = ptr[tid]; - - ptr[tid] = partial = partial + ptr[tid + 16]; - ptr[tid] = partial = partial + ptr[tid + 8]; - ptr[tid] = partial = partial + ptr[tid + 4]; - ptr[tid] = partial = partial + ptr[tid + 2]; - ptr[tid] = partial = partial + ptr[tid + 1]; - } - - return ptr[tid - lane]; - } -}}} // namespace cv { namespace cuda { namespace cudev { - -//! @endcond - -#endif /* OPENCV_CUDA_WARP_REDUCE_HPP__ */ diff --git a/opencv/include/opencv2/core/cuda/warp_shuffle.hpp b/opencv/include/opencv2/core/cuda/warp_shuffle.hpp deleted file mode 100644 index 0da54ae..0000000 --- a/opencv/include/opencv2/core/cuda/warp_shuffle.hpp +++ /dev/null @@ -1,162 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CUDA_WARP_SHUFFLE_HPP -#define OPENCV_CUDA_WARP_SHUFFLE_HPP - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -namespace cv { namespace cuda { namespace device -{ -#if __CUDACC_VER_MAJOR__ >= 9 -# define __shfl(x, y, z) __shfl_sync(0xFFFFFFFFU, x, y, z) -# define __shfl_up(x, y, z) __shfl_up_sync(0xFFFFFFFFU, x, y, z) -# define __shfl_down(x, y, z) __shfl_down_sync(0xFFFFFFFFU, x, y, z) -#endif - template - __device__ __forceinline__ T shfl(T val, int srcLane, int width = warpSize) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300 - return __shfl(val, srcLane, width); - #else - return T(); - #endif - } - __device__ __forceinline__ unsigned int shfl(unsigned int val, int srcLane, int width = warpSize) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300 - return (unsigned int) __shfl((int) val, srcLane, width); - #else - return 0; - #endif - } - __device__ __forceinline__ double shfl(double val, int srcLane, int width = warpSize) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300 - int lo = __double2loint(val); - int hi = __double2hiint(val); - - lo = __shfl(lo, srcLane, width); - hi = __shfl(hi, srcLane, width); - - return __hiloint2double(hi, lo); - #else - return 0.0; - #endif - } - - template - __device__ __forceinline__ T shfl_down(T val, unsigned int delta, int width = warpSize) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300 - return __shfl_down(val, delta, width); - #else - return T(); - #endif - } - __device__ __forceinline__ unsigned int shfl_down(unsigned int val, unsigned int delta, int width = warpSize) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300 - return (unsigned int) __shfl_down((int) val, delta, width); - #else - return 0; - #endif - } - __device__ __forceinline__ double shfl_down(double val, unsigned int delta, int width = warpSize) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300 - int lo = __double2loint(val); - int hi = __double2hiint(val); - - lo = __shfl_down(lo, delta, width); - hi = __shfl_down(hi, delta, width); - - return __hiloint2double(hi, lo); - #else - return 0.0; - #endif - } - - template - __device__ __forceinline__ T shfl_up(T val, unsigned int delta, int width = warpSize) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300 - return __shfl_up(val, delta, width); - #else - return T(); - #endif - } - __device__ __forceinline__ unsigned int shfl_up(unsigned int val, unsigned int delta, int width = warpSize) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300 - return (unsigned int) __shfl_up((int) val, delta, width); - #else - return 0; - #endif - } - __device__ __forceinline__ double shfl_up(double val, unsigned int delta, int width = warpSize) - { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300 - int lo = __double2loint(val); - int hi = __double2hiint(val); - - lo = __shfl_up(lo, delta, width); - hi = __shfl_up(hi, delta, width); - - return __hiloint2double(hi, lo); - #else - return 0.0; - #endif - } -}}} - -# undef __shfl -# undef __shfl_up -# undef __shfl_down - -//! @endcond - -#endif // OPENCV_CUDA_WARP_SHUFFLE_HPP diff --git a/opencv/include/opencv2/core/cuda_stream_accessor.hpp b/opencv/include/opencv2/core/cuda_stream_accessor.hpp deleted file mode 100644 index deaf356..0000000 --- a/opencv/include/opencv2/core/cuda_stream_accessor.hpp +++ /dev/null @@ -1,86 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP -#define OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP - -#ifndef __cplusplus -# error cuda_stream_accessor.hpp header must be compiled as C++ -#endif - -/** @file cuda_stream_accessor.hpp - * This is only header file that depends on CUDA Runtime API. All other headers are independent. - */ - -#include -#include "opencv2/core/cuda.hpp" - -namespace cv -{ - namespace cuda - { - -//! @addtogroup cudacore_struct -//! @{ - - /** @brief Class that enables getting cudaStream_t from cuda::Stream - */ - struct StreamAccessor - { - CV_EXPORTS static cudaStream_t getStream(const Stream& stream); - CV_EXPORTS static Stream wrapStream(cudaStream_t stream); - }; - - /** @brief Class that enables getting cudaEvent_t from cuda::Event - */ - struct EventAccessor - { - CV_EXPORTS static cudaEvent_t getEvent(const Event& event); - CV_EXPORTS static Event wrapEvent(cudaEvent_t event); - }; - -//! @} - - } -} - -#endif /* OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP */ diff --git a/opencv/include/opencv2/core/cuda_types.hpp b/opencv/include/opencv2/core/cuda_types.hpp deleted file mode 100644 index 45dc2ca..0000000 --- a/opencv/include/opencv2/core/cuda_types.hpp +++ /dev/null @@ -1,144 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_CUDA_TYPES_HPP -#define OPENCV_CORE_CUDA_TYPES_HPP - -#ifndef __cplusplus -# error cuda_types.hpp header must be compiled as C++ -#endif - -#if defined(__OPENCV_BUILD) && defined(__clang__) -#pragma clang diagnostic ignored "-Winconsistent-missing-override" -#endif -#if defined(__OPENCV_BUILD) && defined(__GNUC__) && __GNUC__ >= 5 -#pragma GCC diagnostic ignored "-Wsuggest-override" -#endif - -/** @file - * @deprecated Use @ref cudev instead. - */ - -//! @cond IGNORED - -#ifdef __CUDACC__ - #define __CV_CUDA_HOST_DEVICE__ __host__ __device__ __forceinline__ -#else - #define __CV_CUDA_HOST_DEVICE__ -#endif - -namespace cv -{ - namespace cuda - { - - // Simple lightweight structures that encapsulates information about an image on device. - // It is intended to pass to nvcc-compiled code. GpuMat depends on headers that nvcc can't compile - - template struct DevPtr - { - typedef T elem_type; - typedef int index_type; - - enum { elem_size = sizeof(elem_type) }; - - T* data; - - __CV_CUDA_HOST_DEVICE__ DevPtr() : data(0) {} - __CV_CUDA_HOST_DEVICE__ DevPtr(T* data_) : data(data_) {} - - __CV_CUDA_HOST_DEVICE__ size_t elemSize() const { return elem_size; } - __CV_CUDA_HOST_DEVICE__ operator T*() { return data; } - __CV_CUDA_HOST_DEVICE__ operator const T*() const { return data; } - }; - - template struct PtrSz : public DevPtr - { - __CV_CUDA_HOST_DEVICE__ PtrSz() : size(0) {} - __CV_CUDA_HOST_DEVICE__ PtrSz(T* data_, size_t size_) : DevPtr(data_), size(size_) {} - - size_t size; - }; - - template struct PtrStep : public DevPtr - { - __CV_CUDA_HOST_DEVICE__ PtrStep() : step(0) {} - __CV_CUDA_HOST_DEVICE__ PtrStep(T* data_, size_t step_) : DevPtr(data_), step(step_) {} - - size_t step; - - __CV_CUDA_HOST_DEVICE__ T* ptr(int y = 0) { return ( T*)( ( char*)DevPtr::data + y * step); } - __CV_CUDA_HOST_DEVICE__ const T* ptr(int y = 0) const { return (const T*)( (const char*)DevPtr::data + y * step); } - - __CV_CUDA_HOST_DEVICE__ T& operator ()(int y, int x) { return ptr(y)[x]; } - __CV_CUDA_HOST_DEVICE__ const T& operator ()(int y, int x) const { return ptr(y)[x]; } - }; - - template struct PtrStepSz : public PtrStep - { - __CV_CUDA_HOST_DEVICE__ PtrStepSz() : cols(0), rows(0) {} - __CV_CUDA_HOST_DEVICE__ PtrStepSz(int rows_, int cols_, T* data_, size_t step_) - : PtrStep(data_, step_), cols(cols_), rows(rows_) {} - - template - explicit PtrStepSz(const PtrStepSz& d) : PtrStep((T*)d.data, d.step), cols(d.cols), rows(d.rows){} - - int cols; - int rows; - }; - - typedef PtrStepSz PtrStepSzb; - typedef PtrStepSz PtrStepSzus; - typedef PtrStepSz PtrStepSzf; - typedef PtrStepSz PtrStepSzi; - - typedef PtrStep PtrStepb; - typedef PtrStep PtrStepus; - typedef PtrStep PtrStepf; - typedef PtrStep PtrStepi; - - } -} - -//! @endcond - -#endif /* OPENCV_CORE_CUDA_TYPES_HPP */ diff --git a/opencv/include/opencv2/core/cv_cpu_dispatch.h b/opencv/include/opencv2/core/cv_cpu_dispatch.h deleted file mode 100644 index 7f6d6b0..0000000 --- a/opencv/include/opencv2/core/cv_cpu_dispatch.h +++ /dev/null @@ -1,252 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -#if defined __OPENCV_BUILD \ - -#include "cv_cpu_config.h" -#include "cv_cpu_helper.h" - -#ifdef CV_CPU_DISPATCH_MODE -#define CV_CPU_OPTIMIZATION_NAMESPACE __CV_CAT(opt_, CV_CPU_DISPATCH_MODE) -#define CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN namespace __CV_CAT(opt_, CV_CPU_DISPATCH_MODE) { -#define CV_CPU_OPTIMIZATION_NAMESPACE_END } -#else -#define CV_CPU_OPTIMIZATION_NAMESPACE cpu_baseline -#define CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN namespace cpu_baseline { -#define CV_CPU_OPTIMIZATION_NAMESPACE_END } -#define CV_CPU_BASELINE_MODE 1 -#endif - - -#define __CV_CPU_DISPATCH_CHAIN_END(fn, args, mode, ...) /* done */ -#define __CV_CPU_DISPATCH(fn, args, mode, ...) __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) -#define __CV_CPU_DISPATCH_EXPAND(fn, args, ...) __CV_EXPAND(__CV_CPU_DISPATCH(fn, args, __VA_ARGS__)) -#define CV_CPU_DISPATCH(fn, args, ...) __CV_CPU_DISPATCH_EXPAND(fn, args, __VA_ARGS__, END) // expand macros - - -#if defined CV_ENABLE_INTRINSICS \ - && !defined CV_DISABLE_OPTIMIZATION \ - && !defined __CUDACC__ /* do not include SSE/AVX/NEON headers for NVCC compiler */ \ - -#ifdef CV_CPU_COMPILE_SSE2 -# include -# define CV_MMX 1 -# define CV_SSE 1 -# define CV_SSE2 1 -#endif -#ifdef CV_CPU_COMPILE_SSE3 -# include -# define CV_SSE3 1 -#endif -#ifdef CV_CPU_COMPILE_SSSE3 -# include -# define CV_SSSE3 1 -#endif -#ifdef CV_CPU_COMPILE_SSE4_1 -# include -# define CV_SSE4_1 1 -#endif -#ifdef CV_CPU_COMPILE_SSE4_2 -# include -# define CV_SSE4_2 1 -#endif -#ifdef CV_CPU_COMPILE_POPCNT -# ifdef _MSC_VER -# include -# if defined(_M_X64) -# define CV_POPCNT_U64 _mm_popcnt_u64 -# endif -# define CV_POPCNT_U32 _mm_popcnt_u32 -# else -# include -# if defined(__x86_64__) -# define CV_POPCNT_U64 __builtin_popcountll -# endif -# define CV_POPCNT_U32 __builtin_popcount -# endif -# define CV_POPCNT 1 -#endif -#ifdef CV_CPU_COMPILE_AVX -# include -# define CV_AVX 1 -#endif -#ifdef CV_CPU_COMPILE_FP16 -# if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) -# include -# else -# include -# endif -# define CV_FP16 1 -#endif -#ifdef CV_CPU_COMPILE_AVX2 -# include -# define CV_AVX2 1 -#endif -#ifdef CV_CPU_COMPILE_AVX_512F -# include -# define CV_AVX_512F 1 -#endif -#ifdef CV_CPU_COMPILE_AVX512_SKX -# include -# define CV_AVX512_SKX 1 -#endif -#ifdef CV_CPU_COMPILE_FMA3 -# define CV_FMA3 1 -#endif - -#if defined _WIN32 && defined(_M_ARM) -# include -# include -# define CV_NEON 1 -#elif defined(__ARM_NEON__) || (defined (__ARM_NEON) && defined(__aarch64__)) -# include -# define CV_NEON 1 -#endif - -#if defined(__ARM_NEON__) || defined(__aarch64__) -# include -#endif - -#ifdef CV_CPU_COMPILE_VSX -# include -# undef vector -# undef pixel -# undef bool -# define CV_VSX 1 -#endif - -#ifdef CV_CPU_COMPILE_VSX3 -# define CV_VSX3 1 -#endif - -#endif // CV_ENABLE_INTRINSICS && !CV_DISABLE_OPTIMIZATION && !__CUDACC__ - -#if defined CV_CPU_COMPILE_AVX && !defined CV_CPU_BASELINE_COMPILE_AVX -struct VZeroUpperGuard { -#ifdef __GNUC__ - __attribute__((always_inline)) -#endif - inline VZeroUpperGuard() { _mm256_zeroupper(); } -#ifdef __GNUC__ - __attribute__((always_inline)) -#endif - inline ~VZeroUpperGuard() { _mm256_zeroupper(); } -}; -#define __CV_AVX_GUARD VZeroUpperGuard __vzeroupper_guard; CV_UNUSED(__vzeroupper_guard); -#endif - -#ifdef __CV_AVX_GUARD -#define CV_AVX_GUARD __CV_AVX_GUARD -#else -#define CV_AVX_GUARD -#endif - -#endif // __OPENCV_BUILD - - - -#if !defined __OPENCV_BUILD /* Compatibility code */ \ - && !defined __CUDACC__ /* do not include SSE/AVX/NEON headers for NVCC compiler */ -#if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2) -# include -# define CV_MMX 1 -# define CV_SSE 1 -# define CV_SSE2 1 -#elif defined _WIN32 && defined(_M_ARM) -# include -# include -# define CV_NEON 1 -#elif defined(__ARM_NEON__) || (defined (__ARM_NEON) && defined(__aarch64__)) -# include -# define CV_NEON 1 -#elif defined(__VSX__) && defined(__PPC64__) && defined(__LITTLE_ENDIAN__) -# include -# undef vector -# undef pixel -# undef bool -# define CV_VSX 1 -#endif - -#endif // !__OPENCV_BUILD && !__CUDACC (Compatibility code) - - - -#ifndef CV_MMX -# define CV_MMX 0 -#endif -#ifndef CV_SSE -# define CV_SSE 0 -#endif -#ifndef CV_SSE2 -# define CV_SSE2 0 -#endif -#ifndef CV_SSE3 -# define CV_SSE3 0 -#endif -#ifndef CV_SSSE3 -# define CV_SSSE3 0 -#endif -#ifndef CV_SSE4_1 -# define CV_SSE4_1 0 -#endif -#ifndef CV_SSE4_2 -# define CV_SSE4_2 0 -#endif -#ifndef CV_POPCNT -# define CV_POPCNT 0 -#endif -#ifndef CV_AVX -# define CV_AVX 0 -#endif -#ifndef CV_FP16 -# define CV_FP16 0 -#endif -#ifndef CV_AVX2 -# define CV_AVX2 0 -#endif -#ifndef CV_FMA3 -# define CV_FMA3 0 -#endif -#ifndef CV_AVX_512F -# define CV_AVX_512F 0 -#endif -#ifndef CV_AVX_512BW -# define CV_AVX_512BW 0 -#endif -#ifndef CV_AVX_512CD -# define CV_AVX_512CD 0 -#endif -#ifndef CV_AVX_512DQ -# define CV_AVX_512DQ 0 -#endif -#ifndef CV_AVX_512ER -# define CV_AVX_512ER 0 -#endif -#ifndef CV_AVX_512IFMA512 -# define CV_AVX_512IFMA512 0 -#endif -#ifndef CV_AVX_512PF -# define CV_AVX_512PF 0 -#endif -#ifndef CV_AVX_512VBMI -# define CV_AVX_512VBMI 0 -#endif -#ifndef CV_AVX_512VL -# define CV_AVX_512VL 0 -#endif -#ifndef CV_AVX512_SKX -# define CV_AVX512_SKX 0 -#endif - -#ifndef CV_NEON -# define CV_NEON 0 -#endif - -#ifndef CV_VSX -# define CV_VSX 0 -#endif - -#ifndef CV_VSX3 -# define CV_VSX3 0 -#endif diff --git a/opencv/include/opencv2/core/cv_cpu_helper.h b/opencv/include/opencv2/core/cv_cpu_helper.h deleted file mode 100644 index ad13397..0000000 --- a/opencv/include/opencv2/core/cv_cpu_helper.h +++ /dev/null @@ -1,340 +0,0 @@ -// AUTOGENERATED, DO NOT EDIT - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_SSE -# define CV_TRY_SSE 1 -# define CV_CPU_FORCE_SSE 1 -# define CV_CPU_HAS_SUPPORT_SSE 1 -# define CV_CPU_CALL_SSE(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_SSE_(fn, args) return (opt_SSE::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_SSE -# define CV_TRY_SSE 1 -# define CV_CPU_FORCE_SSE 0 -# define CV_CPU_HAS_SUPPORT_SSE (cv::checkHardwareSupport(CV_CPU_SSE)) -# define CV_CPU_CALL_SSE(fn, args) if (CV_CPU_HAS_SUPPORT_SSE) return (opt_SSE::fn args) -# define CV_CPU_CALL_SSE_(fn, args) if (CV_CPU_HAS_SUPPORT_SSE) return (opt_SSE::fn args) -#else -# define CV_TRY_SSE 0 -# define CV_CPU_FORCE_SSE 0 -# define CV_CPU_HAS_SUPPORT_SSE 0 -# define CV_CPU_CALL_SSE(fn, args) -# define CV_CPU_CALL_SSE_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_SSE(fn, args, mode, ...) CV_CPU_CALL_SSE(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_SSE2 -# define CV_TRY_SSE2 1 -# define CV_CPU_FORCE_SSE2 1 -# define CV_CPU_HAS_SUPPORT_SSE2 1 -# define CV_CPU_CALL_SSE2(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_SSE2_(fn, args) return (opt_SSE2::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_SSE2 -# define CV_TRY_SSE2 1 -# define CV_CPU_FORCE_SSE2 0 -# define CV_CPU_HAS_SUPPORT_SSE2 (cv::checkHardwareSupport(CV_CPU_SSE2)) -# define CV_CPU_CALL_SSE2(fn, args) if (CV_CPU_HAS_SUPPORT_SSE2) return (opt_SSE2::fn args) -# define CV_CPU_CALL_SSE2_(fn, args) if (CV_CPU_HAS_SUPPORT_SSE2) return (opt_SSE2::fn args) -#else -# define CV_TRY_SSE2 0 -# define CV_CPU_FORCE_SSE2 0 -# define CV_CPU_HAS_SUPPORT_SSE2 0 -# define CV_CPU_CALL_SSE2(fn, args) -# define CV_CPU_CALL_SSE2_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_SSE2(fn, args, mode, ...) CV_CPU_CALL_SSE2(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_SSE3 -# define CV_TRY_SSE3 1 -# define CV_CPU_FORCE_SSE3 1 -# define CV_CPU_HAS_SUPPORT_SSE3 1 -# define CV_CPU_CALL_SSE3(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_SSE3_(fn, args) return (opt_SSE3::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_SSE3 -# define CV_TRY_SSE3 1 -# define CV_CPU_FORCE_SSE3 0 -# define CV_CPU_HAS_SUPPORT_SSE3 (cv::checkHardwareSupport(CV_CPU_SSE3)) -# define CV_CPU_CALL_SSE3(fn, args) if (CV_CPU_HAS_SUPPORT_SSE3) return (opt_SSE3::fn args) -# define CV_CPU_CALL_SSE3_(fn, args) if (CV_CPU_HAS_SUPPORT_SSE3) return (opt_SSE3::fn args) -#else -# define CV_TRY_SSE3 0 -# define CV_CPU_FORCE_SSE3 0 -# define CV_CPU_HAS_SUPPORT_SSE3 0 -# define CV_CPU_CALL_SSE3(fn, args) -# define CV_CPU_CALL_SSE3_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_SSE3(fn, args, mode, ...) CV_CPU_CALL_SSE3(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_SSSE3 -# define CV_TRY_SSSE3 1 -# define CV_CPU_FORCE_SSSE3 1 -# define CV_CPU_HAS_SUPPORT_SSSE3 1 -# define CV_CPU_CALL_SSSE3(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_SSSE3_(fn, args) return (opt_SSSE3::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_SSSE3 -# define CV_TRY_SSSE3 1 -# define CV_CPU_FORCE_SSSE3 0 -# define CV_CPU_HAS_SUPPORT_SSSE3 (cv::checkHardwareSupport(CV_CPU_SSSE3)) -# define CV_CPU_CALL_SSSE3(fn, args) if (CV_CPU_HAS_SUPPORT_SSSE3) return (opt_SSSE3::fn args) -# define CV_CPU_CALL_SSSE3_(fn, args) if (CV_CPU_HAS_SUPPORT_SSSE3) return (opt_SSSE3::fn args) -#else -# define CV_TRY_SSSE3 0 -# define CV_CPU_FORCE_SSSE3 0 -# define CV_CPU_HAS_SUPPORT_SSSE3 0 -# define CV_CPU_CALL_SSSE3(fn, args) -# define CV_CPU_CALL_SSSE3_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_SSSE3(fn, args, mode, ...) CV_CPU_CALL_SSSE3(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_SSE4_1 -# define CV_TRY_SSE4_1 1 -# define CV_CPU_FORCE_SSE4_1 1 -# define CV_CPU_HAS_SUPPORT_SSE4_1 1 -# define CV_CPU_CALL_SSE4_1(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_SSE4_1_(fn, args) return (opt_SSE4_1::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_SSE4_1 -# define CV_TRY_SSE4_1 1 -# define CV_CPU_FORCE_SSE4_1 0 -# define CV_CPU_HAS_SUPPORT_SSE4_1 (cv::checkHardwareSupport(CV_CPU_SSE4_1)) -# define CV_CPU_CALL_SSE4_1(fn, args) if (CV_CPU_HAS_SUPPORT_SSE4_1) return (opt_SSE4_1::fn args) -# define CV_CPU_CALL_SSE4_1_(fn, args) if (CV_CPU_HAS_SUPPORT_SSE4_1) return (opt_SSE4_1::fn args) -#else -# define CV_TRY_SSE4_1 0 -# define CV_CPU_FORCE_SSE4_1 0 -# define CV_CPU_HAS_SUPPORT_SSE4_1 0 -# define CV_CPU_CALL_SSE4_1(fn, args) -# define CV_CPU_CALL_SSE4_1_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_SSE4_1(fn, args, mode, ...) CV_CPU_CALL_SSE4_1(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_SSE4_2 -# define CV_TRY_SSE4_2 1 -# define CV_CPU_FORCE_SSE4_2 1 -# define CV_CPU_HAS_SUPPORT_SSE4_2 1 -# define CV_CPU_CALL_SSE4_2(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_SSE4_2_(fn, args) return (opt_SSE4_2::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_SSE4_2 -# define CV_TRY_SSE4_2 1 -# define CV_CPU_FORCE_SSE4_2 0 -# define CV_CPU_HAS_SUPPORT_SSE4_2 (cv::checkHardwareSupport(CV_CPU_SSE4_2)) -# define CV_CPU_CALL_SSE4_2(fn, args) if (CV_CPU_HAS_SUPPORT_SSE4_2) return (opt_SSE4_2::fn args) -# define CV_CPU_CALL_SSE4_2_(fn, args) if (CV_CPU_HAS_SUPPORT_SSE4_2) return (opt_SSE4_2::fn args) -#else -# define CV_TRY_SSE4_2 0 -# define CV_CPU_FORCE_SSE4_2 0 -# define CV_CPU_HAS_SUPPORT_SSE4_2 0 -# define CV_CPU_CALL_SSE4_2(fn, args) -# define CV_CPU_CALL_SSE4_2_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_SSE4_2(fn, args, mode, ...) CV_CPU_CALL_SSE4_2(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_POPCNT -# define CV_TRY_POPCNT 1 -# define CV_CPU_FORCE_POPCNT 1 -# define CV_CPU_HAS_SUPPORT_POPCNT 1 -# define CV_CPU_CALL_POPCNT(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_POPCNT_(fn, args) return (opt_POPCNT::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_POPCNT -# define CV_TRY_POPCNT 1 -# define CV_CPU_FORCE_POPCNT 0 -# define CV_CPU_HAS_SUPPORT_POPCNT (cv::checkHardwareSupport(CV_CPU_POPCNT)) -# define CV_CPU_CALL_POPCNT(fn, args) if (CV_CPU_HAS_SUPPORT_POPCNT) return (opt_POPCNT::fn args) -# define CV_CPU_CALL_POPCNT_(fn, args) if (CV_CPU_HAS_SUPPORT_POPCNT) return (opt_POPCNT::fn args) -#else -# define CV_TRY_POPCNT 0 -# define CV_CPU_FORCE_POPCNT 0 -# define CV_CPU_HAS_SUPPORT_POPCNT 0 -# define CV_CPU_CALL_POPCNT(fn, args) -# define CV_CPU_CALL_POPCNT_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_POPCNT(fn, args, mode, ...) CV_CPU_CALL_POPCNT(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_AVX -# define CV_TRY_AVX 1 -# define CV_CPU_FORCE_AVX 1 -# define CV_CPU_HAS_SUPPORT_AVX 1 -# define CV_CPU_CALL_AVX(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_AVX_(fn, args) return (opt_AVX::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_AVX -# define CV_TRY_AVX 1 -# define CV_CPU_FORCE_AVX 0 -# define CV_CPU_HAS_SUPPORT_AVX (cv::checkHardwareSupport(CV_CPU_AVX)) -# define CV_CPU_CALL_AVX(fn, args) if (CV_CPU_HAS_SUPPORT_AVX) return (opt_AVX::fn args) -# define CV_CPU_CALL_AVX_(fn, args) if (CV_CPU_HAS_SUPPORT_AVX) return (opt_AVX::fn args) -#else -# define CV_TRY_AVX 0 -# define CV_CPU_FORCE_AVX 0 -# define CV_CPU_HAS_SUPPORT_AVX 0 -# define CV_CPU_CALL_AVX(fn, args) -# define CV_CPU_CALL_AVX_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_AVX(fn, args, mode, ...) CV_CPU_CALL_AVX(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_FP16 -# define CV_TRY_FP16 1 -# define CV_CPU_FORCE_FP16 1 -# define CV_CPU_HAS_SUPPORT_FP16 1 -# define CV_CPU_CALL_FP16(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_FP16_(fn, args) return (opt_FP16::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_FP16 -# define CV_TRY_FP16 1 -# define CV_CPU_FORCE_FP16 0 -# define CV_CPU_HAS_SUPPORT_FP16 (cv::checkHardwareSupport(CV_CPU_FP16)) -# define CV_CPU_CALL_FP16(fn, args) if (CV_CPU_HAS_SUPPORT_FP16) return (opt_FP16::fn args) -# define CV_CPU_CALL_FP16_(fn, args) if (CV_CPU_HAS_SUPPORT_FP16) return (opt_FP16::fn args) -#else -# define CV_TRY_FP16 0 -# define CV_CPU_FORCE_FP16 0 -# define CV_CPU_HAS_SUPPORT_FP16 0 -# define CV_CPU_CALL_FP16(fn, args) -# define CV_CPU_CALL_FP16_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_FP16(fn, args, mode, ...) CV_CPU_CALL_FP16(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_AVX2 -# define CV_TRY_AVX2 1 -# define CV_CPU_FORCE_AVX2 1 -# define CV_CPU_HAS_SUPPORT_AVX2 1 -# define CV_CPU_CALL_AVX2(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_AVX2_(fn, args) return (opt_AVX2::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_AVX2 -# define CV_TRY_AVX2 1 -# define CV_CPU_FORCE_AVX2 0 -# define CV_CPU_HAS_SUPPORT_AVX2 (cv::checkHardwareSupport(CV_CPU_AVX2)) -# define CV_CPU_CALL_AVX2(fn, args) if (CV_CPU_HAS_SUPPORT_AVX2) return (opt_AVX2::fn args) -# define CV_CPU_CALL_AVX2_(fn, args) if (CV_CPU_HAS_SUPPORT_AVX2) return (opt_AVX2::fn args) -#else -# define CV_TRY_AVX2 0 -# define CV_CPU_FORCE_AVX2 0 -# define CV_CPU_HAS_SUPPORT_AVX2 0 -# define CV_CPU_CALL_AVX2(fn, args) -# define CV_CPU_CALL_AVX2_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_AVX2(fn, args, mode, ...) CV_CPU_CALL_AVX2(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_FMA3 -# define CV_TRY_FMA3 1 -# define CV_CPU_FORCE_FMA3 1 -# define CV_CPU_HAS_SUPPORT_FMA3 1 -# define CV_CPU_CALL_FMA3(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_FMA3_(fn, args) return (opt_FMA3::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_FMA3 -# define CV_TRY_FMA3 1 -# define CV_CPU_FORCE_FMA3 0 -# define CV_CPU_HAS_SUPPORT_FMA3 (cv::checkHardwareSupport(CV_CPU_FMA3)) -# define CV_CPU_CALL_FMA3(fn, args) if (CV_CPU_HAS_SUPPORT_FMA3) return (opt_FMA3::fn args) -# define CV_CPU_CALL_FMA3_(fn, args) if (CV_CPU_HAS_SUPPORT_FMA3) return (opt_FMA3::fn args) -#else -# define CV_TRY_FMA3 0 -# define CV_CPU_FORCE_FMA3 0 -# define CV_CPU_HAS_SUPPORT_FMA3 0 -# define CV_CPU_CALL_FMA3(fn, args) -# define CV_CPU_CALL_FMA3_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_FMA3(fn, args, mode, ...) CV_CPU_CALL_FMA3(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_AVX_512F -# define CV_TRY_AVX_512F 1 -# define CV_CPU_FORCE_AVX_512F 1 -# define CV_CPU_HAS_SUPPORT_AVX_512F 1 -# define CV_CPU_CALL_AVX_512F(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_AVX_512F_(fn, args) return (opt_AVX_512F::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_AVX_512F -# define CV_TRY_AVX_512F 1 -# define CV_CPU_FORCE_AVX_512F 0 -# define CV_CPU_HAS_SUPPORT_AVX_512F (cv::checkHardwareSupport(CV_CPU_AVX_512F)) -# define CV_CPU_CALL_AVX_512F(fn, args) if (CV_CPU_HAS_SUPPORT_AVX_512F) return (opt_AVX_512F::fn args) -# define CV_CPU_CALL_AVX_512F_(fn, args) if (CV_CPU_HAS_SUPPORT_AVX_512F) return (opt_AVX_512F::fn args) -#else -# define CV_TRY_AVX_512F 0 -# define CV_CPU_FORCE_AVX_512F 0 -# define CV_CPU_HAS_SUPPORT_AVX_512F 0 -# define CV_CPU_CALL_AVX_512F(fn, args) -# define CV_CPU_CALL_AVX_512F_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_AVX_512F(fn, args, mode, ...) CV_CPU_CALL_AVX_512F(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_AVX512_SKX -# define CV_TRY_AVX512_SKX 1 -# define CV_CPU_FORCE_AVX512_SKX 1 -# define CV_CPU_HAS_SUPPORT_AVX512_SKX 1 -# define CV_CPU_CALL_AVX512_SKX(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_AVX512_SKX_(fn, args) return (opt_AVX512_SKX::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_AVX512_SKX -# define CV_TRY_AVX512_SKX 1 -# define CV_CPU_FORCE_AVX512_SKX 0 -# define CV_CPU_HAS_SUPPORT_AVX512_SKX (cv::checkHardwareSupport(CV_CPU_AVX512_SKX)) -# define CV_CPU_CALL_AVX512_SKX(fn, args) if (CV_CPU_HAS_SUPPORT_AVX512_SKX) return (opt_AVX512_SKX::fn args) -# define CV_CPU_CALL_AVX512_SKX_(fn, args) if (CV_CPU_HAS_SUPPORT_AVX512_SKX) return (opt_AVX512_SKX::fn args) -#else -# define CV_TRY_AVX512_SKX 0 -# define CV_CPU_FORCE_AVX512_SKX 0 -# define CV_CPU_HAS_SUPPORT_AVX512_SKX 0 -# define CV_CPU_CALL_AVX512_SKX(fn, args) -# define CV_CPU_CALL_AVX512_SKX_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_AVX512_SKX(fn, args, mode, ...) CV_CPU_CALL_AVX512_SKX(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_NEON -# define CV_TRY_NEON 1 -# define CV_CPU_FORCE_NEON 1 -# define CV_CPU_HAS_SUPPORT_NEON 1 -# define CV_CPU_CALL_NEON(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_NEON_(fn, args) return (opt_NEON::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_NEON -# define CV_TRY_NEON 1 -# define CV_CPU_FORCE_NEON 0 -# define CV_CPU_HAS_SUPPORT_NEON (cv::checkHardwareSupport(CV_CPU_NEON)) -# define CV_CPU_CALL_NEON(fn, args) if (CV_CPU_HAS_SUPPORT_NEON) return (opt_NEON::fn args) -# define CV_CPU_CALL_NEON_(fn, args) if (CV_CPU_HAS_SUPPORT_NEON) return (opt_NEON::fn args) -#else -# define CV_TRY_NEON 0 -# define CV_CPU_FORCE_NEON 0 -# define CV_CPU_HAS_SUPPORT_NEON 0 -# define CV_CPU_CALL_NEON(fn, args) -# define CV_CPU_CALL_NEON_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_NEON(fn, args, mode, ...) CV_CPU_CALL_NEON(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_VSX -# define CV_TRY_VSX 1 -# define CV_CPU_FORCE_VSX 1 -# define CV_CPU_HAS_SUPPORT_VSX 1 -# define CV_CPU_CALL_VSX(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_VSX_(fn, args) return (opt_VSX::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_VSX -# define CV_TRY_VSX 1 -# define CV_CPU_FORCE_VSX 0 -# define CV_CPU_HAS_SUPPORT_VSX (cv::checkHardwareSupport(CV_CPU_VSX)) -# define CV_CPU_CALL_VSX(fn, args) if (CV_CPU_HAS_SUPPORT_VSX) return (opt_VSX::fn args) -# define CV_CPU_CALL_VSX_(fn, args) if (CV_CPU_HAS_SUPPORT_VSX) return (opt_VSX::fn args) -#else -# define CV_TRY_VSX 0 -# define CV_CPU_FORCE_VSX 0 -# define CV_CPU_HAS_SUPPORT_VSX 0 -# define CV_CPU_CALL_VSX(fn, args) -# define CV_CPU_CALL_VSX_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_VSX(fn, args, mode, ...) CV_CPU_CALL_VSX(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_VSX3 -# define CV_TRY_VSX3 1 -# define CV_CPU_FORCE_VSX3 1 -# define CV_CPU_HAS_SUPPORT_VSX3 1 -# define CV_CPU_CALL_VSX3(fn, args) return (cpu_baseline::fn args) -# define CV_CPU_CALL_VSX3_(fn, args) return (opt_VSX3::fn args) -#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_VSX3 -# define CV_TRY_VSX3 1 -# define CV_CPU_FORCE_VSX3 0 -# define CV_CPU_HAS_SUPPORT_VSX3 (cv::checkHardwareSupport(CV_CPU_VSX3)) -# define CV_CPU_CALL_VSX3(fn, args) if (CV_CPU_HAS_SUPPORT_VSX3) return (opt_VSX3::fn args) -# define CV_CPU_CALL_VSX3_(fn, args) if (CV_CPU_HAS_SUPPORT_VSX3) return (opt_VSX3::fn args) -#else -# define CV_TRY_VSX3 0 -# define CV_CPU_FORCE_VSX3 0 -# define CV_CPU_HAS_SUPPORT_VSX3 0 -# define CV_CPU_CALL_VSX3(fn, args) -# define CV_CPU_CALL_VSX3_(fn, args) -#endif -#define __CV_CPU_DISPATCH_CHAIN_VSX3(fn, args, mode, ...) CV_CPU_CALL_VSX3(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__)) - -#define CV_CPU_CALL_BASELINE(fn, args) return (cpu_baseline::fn args) -#define __CV_CPU_DISPATCH_CHAIN_BASELINE(fn, args, mode, ...) CV_CPU_CALL_BASELINE(fn, args) /* last in sequence */ diff --git a/opencv/include/opencv2/core/cvdef.h b/opencv/include/opencv2/core/cvdef.h deleted file mode 100644 index be7da7a..0000000 --- a/opencv/include/opencv2/core/cvdef.h +++ /dev/null @@ -1,763 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_CVDEF_H -#define OPENCV_CORE_CVDEF_H - -//! @addtogroup core_utils -//! @{ - -#if !defined CV_DOXYGEN && !defined CV_IGNORE_DEBUG_BUILD_GUARD -#if (defined(_MSC_VER) && (defined(DEBUG) || defined(_DEBUG))) || \ - (defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_DEBUG_PEDANTIC)) -// Guard to prevent using of binary incompatible binaries / runtimes -// https://github.com/opencv/opencv/pull/9161 -#define CV__DEBUG_NS_BEGIN namespace debug_build_guard { -#define CV__DEBUG_NS_END } -namespace cv { namespace debug_build_guard { } using namespace debug_build_guard; } -#endif -#endif - -#ifndef CV__DEBUG_NS_BEGIN -#define CV__DEBUG_NS_BEGIN -#define CV__DEBUG_NS_END -#endif - - -#ifdef __OPENCV_BUILD -#include "cvconfig.h" -#endif - -#ifndef __CV_EXPAND -#define __CV_EXPAND(x) x -#endif - -#ifndef __CV_CAT -#define __CV_CAT__(x, y) x ## y -#define __CV_CAT_(x, y) __CV_CAT__(x, y) -#define __CV_CAT(x, y) __CV_CAT_(x, y) -#endif - -#define __CV_VA_NUM_ARGS_HELPER(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N -#define __CV_VA_NUM_ARGS(...) __CV_VA_NUM_ARGS_HELPER(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) - -#if defined __GNUC__ -#define CV_Func __func__ -#elif defined _MSC_VER -#define CV_Func __FUNCTION__ -#else -#define CV_Func "" -#endif - -//! @cond IGNORED - -//////////////// static assert ///////////////// -#define CVAUX_CONCAT_EXP(a, b) a##b -#define CVAUX_CONCAT(a, b) CVAUX_CONCAT_EXP(a,b) - -#if defined(__clang__) -# ifndef __has_extension -# define __has_extension __has_feature /* compatibility, for older versions of clang */ -# endif -# if __has_extension(cxx_static_assert) -# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition) -# elif __has_extension(c_static_assert) -# define CV_StaticAssert(condition, reason) _Static_assert((condition), reason " " #condition) -# endif -#elif defined(__GNUC__) -# if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L) -# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition) -# endif -#elif defined(_MSC_VER) -# if _MSC_VER >= 1600 /* MSVC 10 */ -# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition) -# endif -#endif -#ifndef CV_StaticAssert -# if !defined(__clang__) && defined(__GNUC__) && (__GNUC__*100 + __GNUC_MINOR__ > 302) -# define CV_StaticAssert(condition, reason) ({ extern int __attribute__((error("CV_StaticAssert: " reason " " #condition))) CV_StaticAssert(); ((condition) ? 0 : CV_StaticAssert()); }) -# else - template struct CV_StaticAssert_failed; - template <> struct CV_StaticAssert_failed { enum { val = 1 }; }; - template struct CV_StaticAssert_test {}; -# define CV_StaticAssert(condition, reason)\ - typedef cv::CV_StaticAssert_test< sizeof(cv::CV_StaticAssert_failed< static_cast(condition) >) > CVAUX_CONCAT(CV_StaticAssert_failed_at_, __LINE__) -# endif -#endif - -// Suppress warning "-Wdeprecated-declarations" / C4996 -#if defined(_MSC_VER) - #define CV_DO_PRAGMA(x) __pragma(x) -#elif defined(__GNUC__) - #define CV_DO_PRAGMA(x) _Pragma (#x) -#else - #define CV_DO_PRAGMA(x) -#endif - -#ifdef _MSC_VER -#define CV_SUPPRESS_DEPRECATED_START \ - CV_DO_PRAGMA(warning(push)) \ - CV_DO_PRAGMA(warning(disable: 4996)) -#define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA(warning(pop)) -#elif defined (__clang__) || ((__GNUC__) && (__GNUC__*100 + __GNUC_MINOR__ > 405)) -#define CV_SUPPRESS_DEPRECATED_START \ - CV_DO_PRAGMA(GCC diagnostic push) \ - CV_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations") -#define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA(GCC diagnostic pop) -#else -#define CV_SUPPRESS_DEPRECATED_START -#define CV_SUPPRESS_DEPRECATED_END -#endif - -#define CV_UNUSED(name) (void)name - -#if defined __GNUC__ && !defined __EXCEPTIONS -#define CV_TRY -#define CV_CATCH(A, B) for (A B; false; ) -#define CV_CATCH_ALL if (false) -#define CV_THROW(A) abort() -#define CV_RETHROW() abort() -#else -#define CV_TRY try -#define CV_CATCH(A, B) catch(const A & B) -#define CV_CATCH_ALL catch(...) -#define CV_THROW(A) throw A -#define CV_RETHROW() throw -#endif - -//! @endcond - -// undef problematic defines sometimes defined by system headers (windows.h in particular) -#undef small -#undef min -#undef max -#undef abs -#undef Complex - -#include -#include "opencv2/core/hal/interface.h" - -#if defined __ICL -# define CV_ICC __ICL -#elif defined __ICC -# define CV_ICC __ICC -#elif defined __ECL -# define CV_ICC __ECL -#elif defined __ECC -# define CV_ICC __ECC -#elif defined __INTEL_COMPILER -# define CV_ICC __INTEL_COMPILER -#endif - -#ifndef CV_INLINE -# if defined __cplusplus -# define CV_INLINE static inline -# elif defined _MSC_VER -# define CV_INLINE __inline -# else -# define CV_INLINE static -# endif -#endif - -#ifndef CV_ALWAYS_INLINE -#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) -#define CV_ALWAYS_INLINE inline __attribute__((always_inline)) -#elif defined(_MSC_VER) -#define CV_ALWAYS_INLINE __forceinline -#else -#define CV_ALWAYS_INLINE inline -#endif -#endif - -#if defined CV_DISABLE_OPTIMIZATION || (defined CV_ICC && !defined CV_ENABLE_UNROLLED) -# define CV_ENABLE_UNROLLED 0 -#else -# define CV_ENABLE_UNROLLED 1 -#endif - -#ifdef __GNUC__ -# define CV_DECL_ALIGNED(x) __attribute__ ((aligned (x))) -#elif defined _MSC_VER -# define CV_DECL_ALIGNED(x) __declspec(align(x)) -#else -# define CV_DECL_ALIGNED(x) -#endif - -/* CPU features and intrinsics support */ -#define CV_CPU_NONE 0 -#define CV_CPU_MMX 1 -#define CV_CPU_SSE 2 -#define CV_CPU_SSE2 3 -#define CV_CPU_SSE3 4 -#define CV_CPU_SSSE3 5 -#define CV_CPU_SSE4_1 6 -#define CV_CPU_SSE4_2 7 -#define CV_CPU_POPCNT 8 -#define CV_CPU_FP16 9 -#define CV_CPU_AVX 10 -#define CV_CPU_AVX2 11 -#define CV_CPU_FMA3 12 - -#define CV_CPU_AVX_512F 13 -#define CV_CPU_AVX_512BW 14 -#define CV_CPU_AVX_512CD 15 -#define CV_CPU_AVX_512DQ 16 -#define CV_CPU_AVX_512ER 17 -#define CV_CPU_AVX_512IFMA512 18 // deprecated -#define CV_CPU_AVX_512IFMA 18 -#define CV_CPU_AVX_512PF 19 -#define CV_CPU_AVX_512VBMI 20 -#define CV_CPU_AVX_512VL 21 - -#define CV_CPU_NEON 100 - -#define CV_CPU_VSX 200 -#define CV_CPU_VSX3 201 - -// CPU features groups -#define CV_CPU_AVX512_SKX 256 - -// when adding to this list remember to update the following enum -#define CV_HARDWARE_MAX_FEATURE 512 - -/** @brief Available CPU features. -*/ -enum CpuFeatures { - CPU_MMX = 1, - CPU_SSE = 2, - CPU_SSE2 = 3, - CPU_SSE3 = 4, - CPU_SSSE3 = 5, - CPU_SSE4_1 = 6, - CPU_SSE4_2 = 7, - CPU_POPCNT = 8, - CPU_FP16 = 9, - CPU_AVX = 10, - CPU_AVX2 = 11, - CPU_FMA3 = 12, - - CPU_AVX_512F = 13, - CPU_AVX_512BW = 14, - CPU_AVX_512CD = 15, - CPU_AVX_512DQ = 16, - CPU_AVX_512ER = 17, - CPU_AVX_512IFMA512 = 18, // deprecated - CPU_AVX_512IFMA = 18, - CPU_AVX_512PF = 19, - CPU_AVX_512VBMI = 20, - CPU_AVX_512VL = 21, - - CPU_NEON = 100, - - CPU_VSX = 200, - CPU_VSX3 = 201, - - CPU_AVX512_SKX = 256, //!< Skylake-X with AVX-512F/CD/BW/DQ/VL - - CPU_MAX_FEATURE = 512 // see CV_HARDWARE_MAX_FEATURE -}; - - -#include "cv_cpu_dispatch.h" - - -/* fundamental constants */ -#define CV_PI 3.1415926535897932384626433832795 -#define CV_2PI 6.283185307179586476925286766559 -#define CV_LOG2 0.69314718055994530941723212145818 - -#if defined __ARM_FP16_FORMAT_IEEE \ - && !defined __CUDACC__ -# define CV_FP16_TYPE 1 -#else -# define CV_FP16_TYPE 0 -#endif - -typedef union Cv16suf -{ - short i; - ushort u; -#if CV_FP16_TYPE - __fp16 h; -#endif -} -Cv16suf; - -typedef union Cv32suf -{ - int i; - unsigned u; - float f; -} -Cv32suf; - -typedef union Cv64suf -{ - int64 i; - uint64 u; - double f; -} -Cv64suf; - -#define OPENCV_ABI_COMPATIBILITY 300 - -#ifdef __OPENCV_BUILD -# define DISABLE_OPENCV_24_COMPATIBILITY -# define OPENCV_DISABLE_DEPRECATED_COMPATIBILITY -#endif - -#ifdef CVAPI_EXPORTS -# if (defined _WIN32 || defined WINCE || defined __CYGWIN__) -# define CV_EXPORTS __declspec(dllexport) -# elif defined __GNUC__ && __GNUC__ >= 4 -# define CV_EXPORTS __attribute__ ((visibility ("default"))) -# endif -#endif - -#ifndef CV_EXPORTS -# define CV_EXPORTS -#endif - -#ifdef _MSC_VER -# define CV_EXPORTS_TEMPLATE -#else -# define CV_EXPORTS_TEMPLATE CV_EXPORTS -#endif - -#ifndef CV_DEPRECATED -# if defined(__GNUC__) -# define CV_DEPRECATED __attribute__ ((deprecated)) -# elif defined(_MSC_VER) -# define CV_DEPRECATED __declspec(deprecated) -# else -# define CV_DEPRECATED -# endif -#endif - -#ifndef CV_DEPRECATED_EXTERNAL -# if defined(__OPENCV_BUILD) -# define CV_DEPRECATED_EXTERNAL /* nothing */ -# else -# define CV_DEPRECATED_EXTERNAL CV_DEPRECATED -# endif -#endif - - -#ifndef CV_EXTERN_C -# ifdef __cplusplus -# define CV_EXTERN_C extern "C" -# else -# define CV_EXTERN_C -# endif -#endif - -/* special informative macros for wrapper generators */ -#define CV_EXPORTS_W CV_EXPORTS -#define CV_EXPORTS_W_SIMPLE CV_EXPORTS -#define CV_EXPORTS_AS(synonym) CV_EXPORTS -#define CV_EXPORTS_W_MAP CV_EXPORTS -#define CV_IN_OUT -#define CV_OUT -#define CV_PROP -#define CV_PROP_RW -#define CV_WRAP -#define CV_WRAP_AS(synonym) - -/****************************************************************************************\ -* Matrix type (Mat) * -\****************************************************************************************/ - -#define CV_MAT_CN_MASK ((CV_CN_MAX - 1) << CV_CN_SHIFT) -#define CV_MAT_CN(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1) -#define CV_MAT_TYPE_MASK (CV_DEPTH_MAX*CV_CN_MAX - 1) -#define CV_MAT_TYPE(flags) ((flags) & CV_MAT_TYPE_MASK) -#define CV_MAT_CONT_FLAG_SHIFT 14 -#define CV_MAT_CONT_FLAG (1 << CV_MAT_CONT_FLAG_SHIFT) -#define CV_IS_MAT_CONT(flags) ((flags) & CV_MAT_CONT_FLAG) -#define CV_IS_CONT_MAT CV_IS_MAT_CONT -#define CV_SUBMAT_FLAG_SHIFT 15 -#define CV_SUBMAT_FLAG (1 << CV_SUBMAT_FLAG_SHIFT) -#define CV_IS_SUBMAT(flags) ((flags) & CV_MAT_SUBMAT_FLAG) - -/** Size of each channel item, - 0x8442211 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */ -#define CV_ELEM_SIZE1(type) \ - ((((sizeof(size_t)<<28)|0x8442211) >> CV_MAT_DEPTH(type)*4) & 15) - -/** 0x3a50 = 11 10 10 01 01 00 00 ~ array of log2(sizeof(arr_type_elem)) */ -#define CV_ELEM_SIZE(type) \ - (CV_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> CV_MAT_DEPTH(type)*2) & 3)) - -#ifndef MIN -# define MIN(a,b) ((a) > (b) ? (b) : (a)) -#endif - -#ifndef MAX -# define MAX(a,b) ((a) < (b) ? (b) : (a)) -#endif - -/****************************************************************************************\ -* static analysys * -\****************************************************************************************/ - -// In practice, some macro are not processed correctly (noreturn is not detected). -// We need to use simplified definition for them. -#ifndef CV_STATIC_ANALYSIS -# if defined(__KLOCWORK__) || defined(__clang_analyzer__) || defined(__COVERITY__) -# define CV_STATIC_ANALYSIS 1 -# endif -#else -# if defined(CV_STATIC_ANALYSIS) && !(__CV_CAT(1, CV_STATIC_ANALYSIS) == 1) // defined and not empty -# if 0 == CV_STATIC_ANALYSIS -# undef CV_STATIC_ANALYSIS -# endif -# endif -#endif - -/****************************************************************************************\ -* Thread sanitizer * -\****************************************************************************************/ -#ifndef CV_THREAD_SANITIZER -# if defined(__has_feature) -# if __has_feature(thread_sanitizer) -# define CV_THREAD_SANITIZER -# endif -# endif -#endif - -/****************************************************************************************\ -* exchange-add operation for atomic operations on reference counters * -\****************************************************************************************/ - -#ifdef CV_XADD - // allow to use user-defined macro -#elif defined __GNUC__ || defined __clang__ -# if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ && !defined __EMSCRIPTEN__ && !defined(__CUDACC__) && !defined __INTEL_COMPILER -# ifdef __ATOMIC_ACQ_REL -# define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(addr), delta, __ATOMIC_ACQ_REL) -# else -# define CV_XADD(addr, delta) __atomic_fetch_add((_Atomic(int)*)(addr), delta, 4) -# endif -# else -# if defined __ATOMIC_ACQ_REL && !defined __clang__ - // version for gcc >= 4.7 -# define CV_XADD(addr, delta) (int)__atomic_fetch_add((unsigned*)(addr), (unsigned)(delta), __ATOMIC_ACQ_REL) -# else -# define CV_XADD(addr, delta) (int)__sync_fetch_and_add((unsigned*)(addr), (unsigned)(delta)) -# endif -# endif -#elif defined _MSC_VER && !defined RC_INVOKED -# include -# define CV_XADD(addr, delta) (int)_InterlockedExchangeAdd((long volatile*)addr, delta) -#else - CV_INLINE CV_XADD(int* addr, int delta) { int tmp = *addr; *addr += delta; return tmp; } -#endif - - -/****************************************************************************************\ -* CV_NORETURN attribute * -\****************************************************************************************/ - -#ifndef CV_NORETURN -# if defined(__GNUC__) -# define CV_NORETURN __attribute__((__noreturn__)) -# elif defined(_MSC_VER) && (_MSC_VER >= 1300) -# define CV_NORETURN __declspec(noreturn) -# else -# define CV_NORETURN /* nothing by default */ -# endif -#endif - - -/****************************************************************************************\ -* CV_NODISCARD attribute * -* encourages the compiler to issue a warning if the return value is discarded (C++17) * -\****************************************************************************************/ -#ifndef CV_NODISCARD -# if defined(__GNUC__) -# define CV_NODISCARD __attribute__((__warn_unused_result__)) // at least available with GCC 3.4 -# elif defined(__clang__) && defined(__has_attribute) -# if __has_attribute(__warn_unused_result__) -# define CV_NODISCARD __attribute__((__warn_unused_result__)) -# endif -# endif -#endif -#ifndef CV_NODISCARD -# define CV_NODISCARD /* nothing by default */ -#endif - - -/****************************************************************************************\ -* C++ 11 * -\****************************************************************************************/ -#ifndef CV_CXX11 -# if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) -# define CV_CXX11 1 -# endif -#else -# if CV_CXX11 == 0 -# undef CV_CXX11 -# endif -#endif - - -/****************************************************************************************\ -* C++ Move semantics * -\****************************************************************************************/ - -#ifndef CV_CXX_MOVE_SEMANTICS -# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(_MSC_VER) && _MSC_VER >= 1600) -# define CV_CXX_MOVE_SEMANTICS 1 -# elif defined(__clang) -# if __has_feature(cxx_rvalue_references) -# define CV_CXX_MOVE_SEMANTICS 1 -# endif -# endif -#else -# if CV_CXX_MOVE_SEMANTICS == 0 -# undef CV_CXX_MOVE_SEMANTICS -# endif -#endif - -/****************************************************************************************\ -* C++11 std::array * -\****************************************************************************************/ - -#ifndef CV_CXX_STD_ARRAY -# if __cplusplus >= 201103L || (defined(__cplusplus) && defined(_MSC_VER) && _MSC_VER >= 1900/*MSVS 2015*/) -# define CV_CXX_STD_ARRAY 1 -# include -# endif -#else -# if CV_CXX_STD_ARRAY == 0 -# undef CV_CXX_STD_ARRAY -# endif -#endif - - -/****************************************************************************************\ -* C++11 override / final * -\****************************************************************************************/ - -#ifndef CV_OVERRIDE -# ifdef CV_CXX11 -# define CV_OVERRIDE override -# endif -#endif -#ifndef CV_OVERRIDE -# define CV_OVERRIDE -#endif - -#ifndef CV_FINAL -# ifdef CV_CXX11 -# define CV_FINAL final -# endif -#endif -#ifndef CV_FINAL -# define CV_FINAL -#endif - - - -// Integer types portatibility -#ifdef OPENCV_STDINT_HEADER -#include OPENCV_STDINT_HEADER -#elif defined(__cplusplus) -#if defined(_MSC_VER) && _MSC_VER < 1600 /* MSVS 2010 */ -namespace cv { -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; -} -#elif defined(_MSC_VER) || __cplusplus >= 201103L -#include -namespace cv { -using std::int8_t; -using std::uint8_t; -using std::int16_t; -using std::uint16_t; -using std::int32_t; -using std::uint32_t; -using std::int64_t; -using std::uint64_t; -} -#else -#include -namespace cv { -typedef ::int8_t int8_t; -typedef ::uint8_t uint8_t; -typedef ::int16_t int16_t; -typedef ::uint16_t uint16_t; -typedef ::int32_t int32_t; -typedef ::uint32_t uint32_t; -typedef ::int64_t int64_t; -typedef ::uint64_t uint64_t; -} -#endif -#else // pure C -#include -#endif - -#ifdef __cplusplus -namespace cv -{ - -class float16_t -{ -public: -#if CV_FP16_TYPE - - float16_t() {} - explicit float16_t(float x) { h = (__fp16)x; } - operator float() const { return (float)h; } - static float16_t fromBits(ushort w) - { - Cv16suf u; - u.u = w; - float16_t result; - result.h = u.h; - return result; - } - static float16_t zero() - { - float16_t result; - result.h = (__fp16)0; - return result; - } - ushort bits() const - { - Cv16suf u; - u.h = h; - return u.u; - } -protected: - __fp16 h; - -#else - float16_t() {} - explicit float16_t(float x) - { - #if CV_AVX2 - __m128 v = _mm_load_ss(&x); - w = (ushort)_mm_cvtsi128_si32(_mm_cvtps_ph(v, 0)); - #else - Cv32suf in; - in.f = x; - unsigned sign = in.u & 0x80000000; - in.u ^= sign; - - if( in.u >= 0x47800000 ) - w = (ushort)(in.u > 0x7f800000 ? 0x7e00 : 0x7c00); - else - { - if (in.u < 0x38800000) - { - in.f += 0.5f; - w = (ushort)(in.u - 0x3f000000); - } - else - { - unsigned t = in.u + 0xc8000fff; - w = (ushort)((t + ((in.u >> 13) & 1)) >> 13); - } - } - - w = (ushort)(w | (sign >> 16)); - #endif - } - - operator float() const - { - #if CV_AVX2 - float f; - _mm_store_ss(&f, _mm_cvtph_ps(_mm_cvtsi32_si128(w))); - return f; - #else - Cv32suf out; - - unsigned t = ((w & 0x7fff) << 13) + 0x38000000; - unsigned sign = (w & 0x8000) << 16; - unsigned e = w & 0x7c00; - - out.u = t + (1 << 23); - out.u = (e >= 0x7c00 ? t + 0x38000000 : - e == 0 ? (out.f -= 6.103515625e-05f, out.u) : t) | sign; - return out.f; - #endif - } - - static float16_t fromBits(ushort b) - { - float16_t result; - result.w = b; - return result; - } - static float16_t zero() - { - float16_t result; - result.w = (ushort)0; - return result; - } - ushort bits() const { return w; } -protected: - ushort w; - -#endif -}; - -} -#endif - -//! @} - -#ifndef __cplusplus -#include "opencv2/core/fast_math.hpp" // define cvRound(double) -#endif - -#endif // OPENCV_CORE_CVDEF_H diff --git a/opencv/include/opencv2/core/cvstd.hpp b/opencv/include/opencv2/core/cvstd.hpp deleted file mode 100644 index 8af1162..0000000 --- a/opencv/include/opencv2/core/cvstd.hpp +++ /dev/null @@ -1,1040 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_CVSTD_HPP -#define OPENCV_CORE_CVSTD_HPP - -#ifndef __cplusplus -# error cvstd.hpp header must be compiled as C++ -#endif - -#include "opencv2/core/cvdef.h" -#include -#include -#include - -#include - -// import useful primitives from stl -# include -# include -# include //for abs(int) -# include - -namespace cv -{ - static inline uchar abs(uchar a) { return a; } - static inline ushort abs(ushort a) { return a; } - static inline unsigned abs(unsigned a) { return a; } - static inline uint64 abs(uint64 a) { return a; } - - using std::min; - using std::max; - using std::abs; - using std::swap; - using std::sqrt; - using std::exp; - using std::pow; - using std::log; -} - -namespace cv { - -//! @addtogroup core_utils -//! @{ - -//////////////////////////// memory management functions //////////////////////////// - -/** @brief Allocates an aligned memory buffer. - -The function allocates the buffer of the specified size and returns it. When the buffer size is 16 -bytes or more, the returned buffer is aligned to 16 bytes. -@param bufSize Allocated buffer size. - */ -CV_EXPORTS void* fastMalloc(size_t bufSize); - -/** @brief Deallocates a memory buffer. - -The function deallocates the buffer allocated with fastMalloc . If NULL pointer is passed, the -function does nothing. C version of the function clears the pointer *pptr* to avoid problems with -double memory deallocation. -@param ptr Pointer to the allocated buffer. - */ -CV_EXPORTS void fastFree(void* ptr); - -/*! - The STL-compliant memory Allocator based on cv::fastMalloc() and cv::fastFree() -*/ -template class Allocator -{ -public: - typedef _Tp value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - template class rebind { typedef Allocator other; }; - - explicit Allocator() {} - ~Allocator() {} - explicit Allocator(Allocator const&) {} - template - explicit Allocator(Allocator const&) {} - - // address - pointer address(reference r) { return &r; } - const_pointer address(const_reference r) { return &r; } - - pointer allocate(size_type count, const void* =0) { return reinterpret_cast(fastMalloc(count * sizeof (_Tp))); } - void deallocate(pointer p, size_type) { fastFree(p); } - - void construct(pointer p, const _Tp& v) { new(static_cast(p)) _Tp(v); } - void destroy(pointer p) { p->~_Tp(); } - - size_type max_size() const { return cv::max(static_cast<_Tp>(-1)/sizeof(_Tp), 1); } -}; - -//! @} core_utils - -//! @cond IGNORED - -namespace detail -{ - -// Metafunction to avoid taking a reference to void. -template -struct RefOrVoid { typedef T& type; }; - -template<> -struct RefOrVoid{ typedef void type; }; - -template<> -struct RefOrVoid{ typedef const void type; }; - -template<> -struct RefOrVoid{ typedef volatile void type; }; - -template<> -struct RefOrVoid{ typedef const volatile void type; }; - -// This class would be private to Ptr, if it didn't have to be a non-template. -struct PtrOwner; - -} - -template -struct DefaultDeleter -{ - void operator () (Y* p) const; -}; - -//! @endcond - -//! @addtogroup core_basic -//! @{ - -/** @brief Template class for smart pointers with shared ownership - -A Ptr\ pretends to be a pointer to an object of type T. Unlike an ordinary pointer, however, the -object will be automatically cleaned up once all Ptr instances pointing to it are destroyed. - -Ptr is similar to boost::shared_ptr that is part of the Boost library -() and std::shared_ptr from -the [C++11](http://en.wikipedia.org/wiki/C++11) standard. - -This class provides the following advantages: -- Default constructor, copy constructor, and assignment operator for an arbitrary C++ class or C - structure. For some objects, like files, windows, mutexes, sockets, and others, a copy - constructor or an assignment operator are difficult to define. For some other objects, like - complex classifiers in OpenCV, copy constructors are absent and not easy to implement. Finally, - some of complex OpenCV and your own data structures may be written in C. However, copy - constructors and default constructors can simplify programming a lot. Besides, they are often - required (for example, by STL containers). By using a Ptr to such an object instead of the - object itself, you automatically get all of the necessary constructors and the assignment - operator. -- *O(1)* complexity of the above-mentioned operations. While some structures, like std::vector, - provide a copy constructor and an assignment operator, the operations may take a considerable - amount of time if the data structures are large. But if the structures are put into a Ptr, the - overhead is small and independent of the data size. -- Automatic and customizable cleanup, even for C structures. See the example below with FILE\*. -- Heterogeneous collections of objects. The standard STL and most other C++ and OpenCV containers - can store only objects of the same type and the same size. The classical solution to store - objects of different types in the same container is to store pointers to the base class (Base\*) - instead but then you lose the automatic memory management. Again, by using Ptr\ instead - of raw pointers, you can solve the problem. - -A Ptr is said to *own* a pointer - that is, for each Ptr there is a pointer that will be deleted -once all Ptr instances that own it are destroyed. The owned pointer may be null, in which case -nothing is deleted. Each Ptr also *stores* a pointer. The stored pointer is the pointer the Ptr -pretends to be; that is, the one you get when you use Ptr::get or the conversion to T\*. It's -usually the same as the owned pointer, but if you use casts or the general shared-ownership -constructor, the two may diverge: the Ptr will still own the original pointer, but will itself point -to something else. - -The owned pointer is treated as a black box. The only thing Ptr needs to know about it is how to -delete it. This knowledge is encapsulated in the *deleter* - an auxiliary object that is associated -with the owned pointer and shared between all Ptr instances that own it. The default deleter is an -instance of DefaultDeleter, which uses the standard C++ delete operator; as such it will work with -any pointer allocated with the standard new operator. - -However, if the pointer must be deleted in a different way, you must specify a custom deleter upon -Ptr construction. A deleter is simply a callable object that accepts the pointer as its sole -argument. For example, if you want to wrap FILE, you may do so as follows: -@code - Ptr f(fopen("myfile.txt", "w"), fclose); - if(!f) throw ...; - fprintf(f, ....); - ... - // the file will be closed automatically by f's destructor. -@endcode -Alternatively, if you want all pointers of a particular type to be deleted the same way, you can -specialize DefaultDeleter::operator() for that type, like this: -@code - namespace cv { - template<> void DefaultDeleter::operator ()(FILE * obj) const - { - fclose(obj); - } - } -@endcode -For convenience, the following types from the OpenCV C API already have such a specialization that -calls the appropriate release function: -- CvCapture -- CvFileStorage -- CvHaarClassifierCascade -- CvMat -- CvMatND -- CvMemStorage -- CvSparseMat -- CvVideoWriter -- IplImage -@note The shared ownership mechanism is implemented with reference counting. As such, cyclic -ownership (e.g. when object a contains a Ptr to object b, which contains a Ptr to object a) will -lead to all involved objects never being cleaned up. Avoid such situations. -@note It is safe to concurrently read (but not write) a Ptr instance from multiple threads and -therefore it is normally safe to use it in multi-threaded applications. The same is true for Mat and -other C++ OpenCV classes that use internal reference counts. -*/ -template -struct Ptr -{ - /** Generic programming support. */ - typedef T element_type; - - /** The default constructor creates a null Ptr - one that owns and stores a null pointer. - */ - Ptr(); - - /** - If p is null, these are equivalent to the default constructor. - Otherwise, these constructors assume ownership of p - that is, the created Ptr owns and stores p - and assumes it is the sole owner of it. Don't use them if p is already owned by another Ptr, or - else p will get deleted twice. - With the first constructor, DefaultDeleter\() becomes the associated deleter (so p will - eventually be deleted with the standard delete operator). Y must be a complete type at the point - of invocation. - With the second constructor, d becomes the associated deleter. - Y\* must be convertible to T\*. - @param p Pointer to own. - @note It is often easier to use makePtr instead. - */ - template -#ifdef DISABLE_OPENCV_24_COMPATIBILITY - explicit -#endif - Ptr(Y* p); - - /** @overload - @param d Deleter to use for the owned pointer. - @param p Pointer to own. - */ - template - Ptr(Y* p, D d); - - /** - These constructors create a Ptr that shares ownership with another Ptr - that is, own the same - pointer as o. - With the first two, the same pointer is stored, as well; for the second, Y\* must be convertible - to T\*. - With the third, p is stored, and Y may be any type. This constructor allows to have completely - unrelated owned and stored pointers, and should be used with care to avoid confusion. A relatively - benign use is to create a non-owning Ptr, like this: - @code - ptr = Ptr(Ptr(), dont_delete_me); // owns nothing; will not delete the pointer. - @endcode - @param o Ptr to share ownership with. - */ - Ptr(const Ptr& o); - - /** @overload - @param o Ptr to share ownership with. - */ - template - Ptr(const Ptr& o); - - /** @overload - @param o Ptr to share ownership with. - @param p Pointer to store. - */ - template - Ptr(const Ptr& o, T* p); - - /** The destructor is equivalent to calling Ptr::release. */ - ~Ptr(); - - /** - Assignment replaces the current Ptr instance with one that owns and stores same pointers as o and - then destroys the old instance. - @param o Ptr to share ownership with. - */ - Ptr& operator = (const Ptr& o); - - /** @overload */ - template - Ptr& operator = (const Ptr& o); - - /** If no other Ptr instance owns the owned pointer, deletes it with the associated deleter. Then sets - both the owned and the stored pointers to NULL. - */ - void release(); - - /** - `ptr.reset(...)` is equivalent to `ptr = Ptr(...)`. - @param p Pointer to own. - */ - template - void reset(Y* p); - - /** @overload - @param d Deleter to use for the owned pointer. - @param p Pointer to own. - */ - template - void reset(Y* p, D d); - - /** - Swaps the owned and stored pointers (and deleters, if any) of this and o. - @param o Ptr to swap with. - */ - void swap(Ptr& o); - - /** Returns the stored pointer. */ - T* get() const; - - /** Ordinary pointer emulation. */ - typename detail::RefOrVoid::type operator * () const; - - /** Ordinary pointer emulation. */ - T* operator -> () const; - - /** Equivalent to get(). */ - operator T* () const; - - /** ptr.empty() is equivalent to `!ptr.get()`. */ - bool empty() const; - - /** Returns a Ptr that owns the same pointer as this, and stores the same - pointer as this, except converted via static_cast to Y*. - */ - template - Ptr staticCast() const; - - /** Ditto for const_cast. */ - template - Ptr constCast() const; - - /** Ditto for dynamic_cast. */ - template - Ptr dynamicCast() const; - -#ifdef CV_CXX_MOVE_SEMANTICS - Ptr(Ptr&& o); - Ptr& operator = (Ptr&& o); -#endif - -private: - detail::PtrOwner* owner; - T* stored; - - template - friend struct Ptr; // have to do this for the cross-type copy constructor -}; - -/** Equivalent to ptr1.swap(ptr2). Provided to help write generic algorithms. */ -template -void swap(Ptr& ptr1, Ptr& ptr2); - -/** Return whether ptr1.get() and ptr2.get() are equal and not equal, respectively. */ -template -bool operator == (const Ptr& ptr1, const Ptr& ptr2); -template -bool operator != (const Ptr& ptr1, const Ptr& ptr2); - -/** `makePtr(...)` is equivalent to `Ptr(new T(...))`. It is shorter than the latter, and it's -marginally safer than using a constructor or Ptr::reset, since it ensures that the owned pointer -is new and thus not owned by any other Ptr instance. -Unfortunately, perfect forwarding is impossible to implement in C++03, and so makePtr is limited -to constructors of T that have up to 10 arguments, none of which are non-const references. - */ -template -Ptr makePtr(); -/** @overload */ -template -Ptr makePtr(const A1& a1); -/** @overload */ -template -Ptr makePtr(const A1& a1, const A2& a2); -/** @overload */ -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3); -/** @overload */ -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4); -/** @overload */ -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5); -/** @overload */ -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6); -/** @overload */ -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7); -/** @overload */ -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8); -/** @overload */ -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9); -/** @overload */ -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10); - -//////////////////////////////// string class //////////////////////////////// - -class CV_EXPORTS FileNode; //for string constructor from FileNode - -class CV_EXPORTS String -{ -public: - typedef char value_type; - typedef char& reference; - typedef const char& const_reference; - typedef char* pointer; - typedef const char* const_pointer; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - typedef char* iterator; - typedef const char* const_iterator; - - static const size_t npos = size_t(-1); - - String(); - String(const String& str); - String(const String& str, size_t pos, size_t len = npos); - String(const char* s); - String(const char* s, size_t n); - String(size_t n, char c); - String(const char* first, const char* last); - template String(Iterator first, Iterator last); - explicit String(const FileNode& fn); - ~String(); - - String& operator=(const String& str); - String& operator=(const char* s); - String& operator=(char c); - - String& operator+=(const String& str); - String& operator+=(const char* s); - String& operator+=(char c); - - size_t size() const; - size_t length() const; - - char operator[](size_t idx) const; - char operator[](int idx) const; - - const char* begin() const; - const char* end() const; - - const char* c_str() const; - - bool empty() const; - void clear(); - - int compare(const char* s) const; - int compare(const String& str) const; - - void swap(String& str); - String substr(size_t pos = 0, size_t len = npos) const; - - size_t find(const char* s, size_t pos, size_t n) const; - size_t find(char c, size_t pos = 0) const; - size_t find(const String& str, size_t pos = 0) const; - size_t find(const char* s, size_t pos = 0) const; - - size_t rfind(const char* s, size_t pos, size_t n) const; - size_t rfind(char c, size_t pos = npos) const; - size_t rfind(const String& str, size_t pos = npos) const; - size_t rfind(const char* s, size_t pos = npos) const; - - size_t find_first_of(const char* s, size_t pos, size_t n) const; - size_t find_first_of(char c, size_t pos = 0) const; - size_t find_first_of(const String& str, size_t pos = 0) const; - size_t find_first_of(const char* s, size_t pos = 0) const; - - size_t find_last_of(const char* s, size_t pos, size_t n) const; - size_t find_last_of(char c, size_t pos = npos) const; - size_t find_last_of(const String& str, size_t pos = npos) const; - size_t find_last_of(const char* s, size_t pos = npos) const; - - friend String operator+ (const String& lhs, const String& rhs); - friend String operator+ (const String& lhs, const char* rhs); - friend String operator+ (const char* lhs, const String& rhs); - friend String operator+ (const String& lhs, char rhs); - friend String operator+ (char lhs, const String& rhs); - - String toLowerCase() const; - - String(const std::string& str); - String(const std::string& str, size_t pos, size_t len = npos); - String& operator=(const std::string& str); - String& operator+=(const std::string& str); - operator std::string() const; - - friend String operator+ (const String& lhs, const std::string& rhs); - friend String operator+ (const std::string& lhs, const String& rhs); - -private: - char* cstr_; - size_t len_; - - char* allocate(size_t len); // len without trailing 0 - void deallocate(); - - String(int); // disabled and invalid. Catch invalid usages like, commandLineParser.has(0) problem -}; - -//! @} core_basic - -////////////////////////// cv::String implementation ///////////////////////// - -//! @cond IGNORED - -inline -String::String() - : cstr_(0), len_(0) -{} - -inline -String::String(const String& str) - : cstr_(str.cstr_), len_(str.len_) -{ - if (cstr_) - CV_XADD(((int*)cstr_)-1, 1); -} - -inline -String::String(const String& str, size_t pos, size_t len) - : cstr_(0), len_(0) -{ - pos = min(pos, str.len_); - len = min(str.len_ - pos, len); - if (!len) return; - if (len == str.len_) - { - CV_XADD(((int*)str.cstr_)-1, 1); - cstr_ = str.cstr_; - len_ = str.len_; - return; - } - memcpy(allocate(len), str.cstr_ + pos, len); -} - -inline -String::String(const char* s) - : cstr_(0), len_(0) -{ - if (!s) return; - size_t len = strlen(s); - if (!len) return; - memcpy(allocate(len), s, len); -} - -inline -String::String(const char* s, size_t n) - : cstr_(0), len_(0) -{ - if (!n) return; - if (!s) return; - memcpy(allocate(n), s, n); -} - -inline -String::String(size_t n, char c) - : cstr_(0), len_(0) -{ - if (!n) return; - memset(allocate(n), c, n); -} - -inline -String::String(const char* first, const char* last) - : cstr_(0), len_(0) -{ - size_t len = (size_t)(last - first); - if (!len) return; - memcpy(allocate(len), first, len); -} - -template inline -String::String(Iterator first, Iterator last) - : cstr_(0), len_(0) -{ - size_t len = (size_t)(last - first); - if (!len) return; - char* str = allocate(len); - while (first != last) - { - *str++ = *first; - ++first; - } -} - -inline -String::~String() -{ - deallocate(); -} - -inline -String& String::operator=(const String& str) -{ - if (&str == this) return *this; - - deallocate(); - if (str.cstr_) CV_XADD(((int*)str.cstr_)-1, 1); - cstr_ = str.cstr_; - len_ = str.len_; - return *this; -} - -inline -String& String::operator=(const char* s) -{ - deallocate(); - if (!s) return *this; - size_t len = strlen(s); - if (len) memcpy(allocate(len), s, len); - return *this; -} - -inline -String& String::operator=(char c) -{ - deallocate(); - allocate(1)[0] = c; - return *this; -} - -inline -String& String::operator+=(const String& str) -{ - *this = *this + str; - return *this; -} - -inline -String& String::operator+=(const char* s) -{ - *this = *this + s; - return *this; -} - -inline -String& String::operator+=(char c) -{ - *this = *this + c; - return *this; -} - -inline -size_t String::size() const -{ - return len_; -} - -inline -size_t String::length() const -{ - return len_; -} - -inline -char String::operator[](size_t idx) const -{ - return cstr_[idx]; -} - -inline -char String::operator[](int idx) const -{ - return cstr_[idx]; -} - -inline -const char* String::begin() const -{ - return cstr_; -} - -inline -const char* String::end() const -{ - return len_ ? cstr_ + len_ : NULL; -} - -inline -bool String::empty() const -{ - return len_ == 0; -} - -inline -const char* String::c_str() const -{ - return cstr_ ? cstr_ : ""; -} - -inline -void String::swap(String& str) -{ - cv::swap(cstr_, str.cstr_); - cv::swap(len_, str.len_); -} - -inline -void String::clear() -{ - deallocate(); -} - -inline -int String::compare(const char* s) const -{ - if (cstr_ == s) return 0; - return strcmp(c_str(), s); -} - -inline -int String::compare(const String& str) const -{ - if (cstr_ == str.cstr_) return 0; - return strcmp(c_str(), str.c_str()); -} - -inline -String String::substr(size_t pos, size_t len) const -{ - return String(*this, pos, len); -} - -inline -size_t String::find(const char* s, size_t pos, size_t n) const -{ - if (n == 0 || pos + n > len_) return npos; - const char* lmax = cstr_ + len_ - n; - for (const char* i = cstr_ + pos; i <= lmax; ++i) - { - size_t j = 0; - while (j < n && s[j] == i[j]) ++j; - if (j == n) return (size_t)(i - cstr_); - } - return npos; -} - -inline -size_t String::find(char c, size_t pos) const -{ - return find(&c, pos, 1); -} - -inline -size_t String::find(const String& str, size_t pos) const -{ - return find(str.c_str(), pos, str.len_); -} - -inline -size_t String::find(const char* s, size_t pos) const -{ - if (pos >= len_ || !s[0]) return npos; - const char* lmax = cstr_ + len_; - for (const char* i = cstr_ + pos; i < lmax; ++i) - { - size_t j = 0; - while (s[j] && s[j] == i[j]) - { if(i + j >= lmax) return npos; - ++j; - } - if (!s[j]) return (size_t)(i - cstr_); - } - return npos; -} - -inline -size_t String::rfind(const char* s, size_t pos, size_t n) const -{ - if (n > len_) return npos; - if (pos > len_ - n) pos = len_ - n; - for (const char* i = cstr_ + pos; i >= cstr_; --i) - { - size_t j = 0; - while (j < n && s[j] == i[j]) ++j; - if (j == n) return (size_t)(i - cstr_); - } - return npos; -} - -inline -size_t String::rfind(char c, size_t pos) const -{ - return rfind(&c, pos, 1); -} - -inline -size_t String::rfind(const String& str, size_t pos) const -{ - return rfind(str.c_str(), pos, str.len_); -} - -inline -size_t String::rfind(const char* s, size_t pos) const -{ - return rfind(s, pos, strlen(s)); -} - -inline -size_t String::find_first_of(const char* s, size_t pos, size_t n) const -{ - if (n == 0 || pos + n > len_) return npos; - const char* lmax = cstr_ + len_; - for (const char* i = cstr_ + pos; i < lmax; ++i) - { - for (size_t j = 0; j < n; ++j) - if (s[j] == *i) - return (size_t)(i - cstr_); - } - return npos; -} - -inline -size_t String::find_first_of(char c, size_t pos) const -{ - return find_first_of(&c, pos, 1); -} - -inline -size_t String::find_first_of(const String& str, size_t pos) const -{ - return find_first_of(str.c_str(), pos, str.len_); -} - -inline -size_t String::find_first_of(const char* s, size_t pos) const -{ - if (len_ == 0) return npos; - if (pos >= len_ || !s[0]) return npos; - const char* lmax = cstr_ + len_; - for (const char* i = cstr_ + pos; i < lmax; ++i) - { - for (size_t j = 0; s[j]; ++j) - if (s[j] == *i) - return (size_t)(i - cstr_); - } - return npos; -} - -inline -size_t String::find_last_of(const char* s, size_t pos, size_t n) const -{ - if (len_ == 0) return npos; - if (pos >= len_) pos = len_ - 1; - for (const char* i = cstr_ + pos; i >= cstr_; --i) - { - for (size_t j = 0; j < n; ++j) - if (s[j] == *i) - return (size_t)(i - cstr_); - } - return npos; -} - -inline -size_t String::find_last_of(char c, size_t pos) const -{ - return find_last_of(&c, pos, 1); -} - -inline -size_t String::find_last_of(const String& str, size_t pos) const -{ - return find_last_of(str.c_str(), pos, str.len_); -} - -inline -size_t String::find_last_of(const char* s, size_t pos) const -{ - if (len_ == 0) return npos; - if (pos >= len_) pos = len_ - 1; - for (const char* i = cstr_ + pos; i >= cstr_; --i) - { - for (size_t j = 0; s[j]; ++j) - if (s[j] == *i) - return (size_t)(i - cstr_); - } - return npos; -} - -inline -String String::toLowerCase() const -{ - if (!cstr_) - return String(); - String res(cstr_, len_); - for (size_t i = 0; i < len_; ++i) - res.cstr_[i] = (char) ::tolower(cstr_[i]); - - return res; -} - -//! @endcond - -// ************************* cv::String non-member functions ************************* - -//! @relates cv::String -//! @{ - -inline -String operator + (const String& lhs, const String& rhs) -{ - String s; - s.allocate(lhs.len_ + rhs.len_); - if (lhs.len_) memcpy(s.cstr_, lhs.cstr_, lhs.len_); - if (rhs.len_) memcpy(s.cstr_ + lhs.len_, rhs.cstr_, rhs.len_); - return s; -} - -inline -String operator + (const String& lhs, const char* rhs) -{ - String s; - size_t rhslen = strlen(rhs); - s.allocate(lhs.len_ + rhslen); - if (lhs.len_) memcpy(s.cstr_, lhs.cstr_, lhs.len_); - if (rhslen) memcpy(s.cstr_ + lhs.len_, rhs, rhslen); - return s; -} - -inline -String operator + (const char* lhs, const String& rhs) -{ - String s; - size_t lhslen = strlen(lhs); - s.allocate(lhslen + rhs.len_); - if (lhslen) memcpy(s.cstr_, lhs, lhslen); - if (rhs.len_) memcpy(s.cstr_ + lhslen, rhs.cstr_, rhs.len_); - return s; -} - -inline -String operator + (const String& lhs, char rhs) -{ - String s; - s.allocate(lhs.len_ + 1); - if (lhs.len_) memcpy(s.cstr_, lhs.cstr_, lhs.len_); - s.cstr_[lhs.len_] = rhs; - return s; -} - -inline -String operator + (char lhs, const String& rhs) -{ - String s; - s.allocate(rhs.len_ + 1); - s.cstr_[0] = lhs; - if (rhs.len_) memcpy(s.cstr_ + 1, rhs.cstr_, rhs.len_); - return s; -} - -static inline bool operator== (const String& lhs, const String& rhs) { return 0 == lhs.compare(rhs); } -static inline bool operator== (const char* lhs, const String& rhs) { return 0 == rhs.compare(lhs); } -static inline bool operator== (const String& lhs, const char* rhs) { return 0 == lhs.compare(rhs); } -static inline bool operator!= (const String& lhs, const String& rhs) { return 0 != lhs.compare(rhs); } -static inline bool operator!= (const char* lhs, const String& rhs) { return 0 != rhs.compare(lhs); } -static inline bool operator!= (const String& lhs, const char* rhs) { return 0 != lhs.compare(rhs); } -static inline bool operator< (const String& lhs, const String& rhs) { return lhs.compare(rhs) < 0; } -static inline bool operator< (const char* lhs, const String& rhs) { return rhs.compare(lhs) > 0; } -static inline bool operator< (const String& lhs, const char* rhs) { return lhs.compare(rhs) < 0; } -static inline bool operator<= (const String& lhs, const String& rhs) { return lhs.compare(rhs) <= 0; } -static inline bool operator<= (const char* lhs, const String& rhs) { return rhs.compare(lhs) >= 0; } -static inline bool operator<= (const String& lhs, const char* rhs) { return lhs.compare(rhs) <= 0; } -static inline bool operator> (const String& lhs, const String& rhs) { return lhs.compare(rhs) > 0; } -static inline bool operator> (const char* lhs, const String& rhs) { return rhs.compare(lhs) < 0; } -static inline bool operator> (const String& lhs, const char* rhs) { return lhs.compare(rhs) > 0; } -static inline bool operator>= (const String& lhs, const String& rhs) { return lhs.compare(rhs) >= 0; } -static inline bool operator>= (const char* lhs, const String& rhs) { return rhs.compare(lhs) <= 0; } -static inline bool operator>= (const String& lhs, const char* rhs) { return lhs.compare(rhs) >= 0; } - -//! @} relates cv::String - -} // cv - -namespace std -{ - static inline void swap(cv::String& a, cv::String& b) { a.swap(b); } -} - -#include "opencv2/core/ptr.inl.hpp" - -#endif //OPENCV_CORE_CVSTD_HPP diff --git a/opencv/include/opencv2/core/cvstd.inl.hpp b/opencv/include/opencv2/core/cvstd.inl.hpp deleted file mode 100644 index ed37cac..0000000 --- a/opencv/include/opencv2/core/cvstd.inl.hpp +++ /dev/null @@ -1,285 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_CVSTDINL_HPP -#define OPENCV_CORE_CVSTDINL_HPP - -#include -#include - -//! @cond IGNORED - -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4127 ) -#endif - -namespace cv -{ - -template class DataType< std::complex<_Tp> > -{ -public: - typedef std::complex<_Tp> value_type; - typedef value_type work_type; - typedef _Tp channel_type; - - enum { generic_type = 0, - depth = DataType::depth, - channels = 2, - fmt = DataType::fmt + ((channels - 1) << 8), - type = CV_MAKETYPE(depth, channels) }; - - typedef Vec vec_type; -}; - -inline -String::String(const std::string& str) - : cstr_(0), len_(0) -{ - size_t len = str.size(); - if (len) memcpy(allocate(len), str.c_str(), len); -} - -inline -String::String(const std::string& str, size_t pos, size_t len) - : cstr_(0), len_(0) -{ - size_t strlen = str.size(); - pos = min(pos, strlen); - len = min(strlen - pos, len); - if (!len) return; - memcpy(allocate(len), str.c_str() + pos, len); -} - -inline -String& String::operator = (const std::string& str) -{ - deallocate(); - size_t len = str.size(); - if (len) memcpy(allocate(len), str.c_str(), len); - return *this; -} - -inline -String& String::operator += (const std::string& str) -{ - *this = *this + str; - return *this; -} - -inline -String::operator std::string() const -{ - return std::string(cstr_, len_); -} - -inline -String operator + (const String& lhs, const std::string& rhs) -{ - String s; - size_t rhslen = rhs.size(); - s.allocate(lhs.len_ + rhslen); - if (lhs.len_) memcpy(s.cstr_, lhs.cstr_, lhs.len_); - if (rhslen) memcpy(s.cstr_ + lhs.len_, rhs.c_str(), rhslen); - return s; -} - -inline -String operator + (const std::string& lhs, const String& rhs) -{ - String s; - size_t lhslen = lhs.size(); - s.allocate(lhslen + rhs.len_); - if (lhslen) memcpy(s.cstr_, lhs.c_str(), lhslen); - if (rhs.len_) memcpy(s.cstr_ + lhslen, rhs.cstr_, rhs.len_); - return s; -} - -inline -FileNode::operator std::string() const -{ - String value; - read(*this, value, value); - return value; -} - -template<> inline -void operator >> (const FileNode& n, std::string& value) -{ - read(n, value, std::string()); -} - -template<> inline -FileStorage& operator << (FileStorage& fs, const std::string& value) -{ - return fs << cv::String(value); -} - -static inline -std::ostream& operator << (std::ostream& os, const String& str) -{ - return os << str.c_str(); -} - -static inline -std::ostream& operator << (std::ostream& out, Ptr fmtd) -{ - fmtd->reset(); - for(const char* str = fmtd->next(); str; str = fmtd->next()) - out << str; - return out; -} - -static inline -std::ostream& operator << (std::ostream& out, const Mat& mtx) -{ - return out << Formatter::get()->format(mtx); -} - -static inline -std::ostream& operator << (std::ostream& out, const UMat& m) -{ - return out << m.getMat(ACCESS_READ); -} - -template static inline -std::ostream& operator << (std::ostream& out, const Complex<_Tp>& c) -{ - return out << "(" << c.re << "," << c.im << ")"; -} - -template static inline -std::ostream& operator << (std::ostream& out, const std::vector >& vec) -{ - return out << Formatter::get()->format(Mat(vec)); -} - - -template static inline -std::ostream& operator << (std::ostream& out, const std::vector >& vec) -{ - return out << Formatter::get()->format(Mat(vec)); -} - - -template static inline -std::ostream& operator << (std::ostream& out, const Matx<_Tp, m, n>& matx) -{ - return out << Formatter::get()->format(Mat(matx)); -} - -template static inline -std::ostream& operator << (std::ostream& out, const Point_<_Tp>& p) -{ - out << "[" << p.x << ", " << p.y << "]"; - return out; -} - -template static inline -std::ostream& operator << (std::ostream& out, const Point3_<_Tp>& p) -{ - out << "[" << p.x << ", " << p.y << ", " << p.z << "]"; - return out; -} - -template static inline -std::ostream& operator << (std::ostream& out, const Vec<_Tp, n>& vec) -{ - out << "["; - if (cv::traits::Depth<_Tp>::value <= CV_32S) - { - for (int i = 0; i < n - 1; ++i) { - out << (int)vec[i] << ", "; - } - out << (int)vec[n-1] << "]"; - } - else - { - for (int i = 0; i < n - 1; ++i) { - out << vec[i] << ", "; - } - out << vec[n-1] << "]"; - } - - return out; -} - -template static inline -std::ostream& operator << (std::ostream& out, const Size_<_Tp>& size) -{ - return out << "[" << size.width << " x " << size.height << "]"; -} - -template static inline -std::ostream& operator << (std::ostream& out, const Rect_<_Tp>& rect) -{ - return out << "[" << rect.width << " x " << rect.height << " from (" << rect.x << ", " << rect.y << ")]"; -} - -static inline std::ostream& operator << (std::ostream& out, const MatSize& msize) -{ - int i, dims = msize.dims(); - for( i = 0; i < dims; i++ ) - { - out << msize[i]; - if( i < dims-1 ) - out << " x "; - } - return out; -} - -static inline std::ostream &operator<< (std::ostream &s, cv::Range &r) -{ - return s << "[" << r.start << " : " << r.end << ")"; -} - -} // cv - -#ifdef _MSC_VER -#pragma warning( pop ) -#endif - -//! @endcond - -#endif // OPENCV_CORE_CVSTDINL_HPP diff --git a/opencv/include/opencv2/core/directx.hpp b/opencv/include/opencv2/core/directx.hpp deleted file mode 100644 index 056a85a..0000000 --- a/opencv/include/opencv2/core/directx.hpp +++ /dev/null @@ -1,184 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors as is and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the copyright holders or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_DIRECTX_HPP -#define OPENCV_CORE_DIRECTX_HPP - -#include "mat.hpp" -#include "ocl.hpp" - -#if !defined(__d3d11_h__) -struct ID3D11Device; -struct ID3D11Texture2D; -#endif - -#if !defined(__d3d10_h__) -struct ID3D10Device; -struct ID3D10Texture2D; -#endif - -#if !defined(_D3D9_H_) -struct IDirect3DDevice9; -struct IDirect3DDevice9Ex; -struct IDirect3DSurface9; -#endif - - -namespace cv { namespace directx { - -namespace ocl { -using namespace cv::ocl; - -//! @addtogroup core_directx -// This section describes OpenCL and DirectX interoperability. -// -// To enable DirectX support, configure OpenCV using CMake with WITH_DIRECTX=ON . Note, DirectX is -// supported only on Windows. -// -// To use OpenCL functionality you should first initialize OpenCL context from DirectX resource. -// -//! @{ - -// TODO static functions in the Context class -//! @brief Creates OpenCL context from D3D11 device -// -//! @param pD3D11Device - pointer to D3D11 device -//! @return Returns reference to OpenCL Context -CV_EXPORTS Context& initializeContextFromD3D11Device(ID3D11Device* pD3D11Device); - -//! @brief Creates OpenCL context from D3D10 device -// -//! @param pD3D10Device - pointer to D3D10 device -//! @return Returns reference to OpenCL Context -CV_EXPORTS Context& initializeContextFromD3D10Device(ID3D10Device* pD3D10Device); - -//! @brief Creates OpenCL context from Direct3DDevice9Ex device -// -//! @param pDirect3DDevice9Ex - pointer to Direct3DDevice9Ex device -//! @return Returns reference to OpenCL Context -CV_EXPORTS Context& initializeContextFromDirect3DDevice9Ex(IDirect3DDevice9Ex* pDirect3DDevice9Ex); - -//! @brief Creates OpenCL context from Direct3DDevice9 device -// -//! @param pDirect3DDevice9 - pointer to Direct3Device9 device -//! @return Returns reference to OpenCL Context -CV_EXPORTS Context& initializeContextFromDirect3DDevice9(IDirect3DDevice9* pDirect3DDevice9); - -//! @} - -} // namespace cv::directx::ocl - -//! @addtogroup core_directx -//! @{ - -//! @brief Converts InputArray to ID3D11Texture2D. If destination texture format is DXGI_FORMAT_NV12 then -//! input UMat expected to be in BGR format and data will be downsampled and color-converted to NV12. -// -//! @note Note: Destination texture must be allocated by application. Function does memory copy from src to -//! pD3D11Texture2D -// -//! @param src - source InputArray -//! @param pD3D11Texture2D - destination D3D11 texture -CV_EXPORTS void convertToD3D11Texture2D(InputArray src, ID3D11Texture2D* pD3D11Texture2D); - -//! @brief Converts ID3D11Texture2D to OutputArray. If input texture format is DXGI_FORMAT_NV12 then -//! data will be upsampled and color-converted to BGR format. -// -//! @note Note: Destination matrix will be re-allocated if it has not enough memory to match texture size. -//! function does memory copy from pD3D11Texture2D to dst -// -//! @param pD3D11Texture2D - source D3D11 texture -//! @param dst - destination OutputArray -CV_EXPORTS void convertFromD3D11Texture2D(ID3D11Texture2D* pD3D11Texture2D, OutputArray dst); - -//! @brief Converts InputArray to ID3D10Texture2D -// -//! @note Note: function does memory copy from src to -//! pD3D10Texture2D -// -//! @param src - source InputArray -//! @param pD3D10Texture2D - destination D3D10 texture -CV_EXPORTS void convertToD3D10Texture2D(InputArray src, ID3D10Texture2D* pD3D10Texture2D); - -//! @brief Converts ID3D10Texture2D to OutputArray -// -//! @note Note: function does memory copy from pD3D10Texture2D -//! to dst -// -//! @param pD3D10Texture2D - source D3D10 texture -//! @param dst - destination OutputArray -CV_EXPORTS void convertFromD3D10Texture2D(ID3D10Texture2D* pD3D10Texture2D, OutputArray dst); - -//! @brief Converts InputArray to IDirect3DSurface9 -// -//! @note Note: function does memory copy from src to -//! pDirect3DSurface9 -// -//! @param src - source InputArray -//! @param pDirect3DSurface9 - destination D3D10 texture -//! @param surfaceSharedHandle - shared handle -CV_EXPORTS void convertToDirect3DSurface9(InputArray src, IDirect3DSurface9* pDirect3DSurface9, void* surfaceSharedHandle = NULL); - -//! @brief Converts IDirect3DSurface9 to OutputArray -// -//! @note Note: function does memory copy from pDirect3DSurface9 -//! to dst -// -//! @param pDirect3DSurface9 - source D3D10 texture -//! @param dst - destination OutputArray -//! @param surfaceSharedHandle - shared handle -CV_EXPORTS void convertFromDirect3DSurface9(IDirect3DSurface9* pDirect3DSurface9, OutputArray dst, void* surfaceSharedHandle = NULL); - -//! @brief Get OpenCV type from DirectX type -//! @param iDXGI_FORMAT - enum DXGI_FORMAT for D3D10/D3D11 -//! @return OpenCV type or -1 if there is no equivalent -CV_EXPORTS int getTypeFromDXGI_FORMAT(const int iDXGI_FORMAT); // enum DXGI_FORMAT for D3D10/D3D11 - -//! @brief Get OpenCV type from DirectX type -//! @param iD3DFORMAT - enum D3DTYPE for D3D9 -//! @return OpenCV type or -1 if there is no equivalent -CV_EXPORTS int getTypeFromD3DFORMAT(const int iD3DFORMAT); // enum D3DTYPE for D3D9 - -//! @} - -} } // namespace cv::directx - -#endif // OPENCV_CORE_DIRECTX_HPP diff --git a/opencv/include/opencv2/core/eigen.hpp b/opencv/include/opencv2/core/eigen.hpp deleted file mode 100644 index 741648e..0000000 --- a/opencv/include/opencv2/core/eigen.hpp +++ /dev/null @@ -1,280 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - - -#ifndef OPENCV_CORE_EIGEN_HPP -#define OPENCV_CORE_EIGEN_HPP - -#include "opencv2/core.hpp" - -#if defined _MSC_VER && _MSC_VER >= 1200 -#pragma warning( disable: 4714 ) //__forceinline is not inlined -#pragma warning( disable: 4127 ) //conditional expression is constant -#pragma warning( disable: 4244 ) //conversion from '__int64' to 'int', possible loss of data -#endif - -namespace cv -{ - -//! @addtogroup core_eigen -//! @{ - -template static inline -void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, OutputArray dst ) -{ - if( !(src.Flags & Eigen::RowMajorBit) ) - { - Mat _src(src.cols(), src.rows(), traits::Type<_Tp>::value, - (void*)src.data(), src.outerStride()*sizeof(_Tp)); - transpose(_src, dst); - } - else - { - Mat _src(src.rows(), src.cols(), traits::Type<_Tp>::value, - (void*)src.data(), src.outerStride()*sizeof(_Tp)); - _src.copyTo(dst); - } -} - -// Matx case -template static inline -void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, - Matx<_Tp, _rows, _cols>& dst ) -{ - if( !(src.Flags & Eigen::RowMajorBit) ) - { - dst = Matx<_Tp, _cols, _rows>(static_cast(src.data())).t(); - } - else - { - dst = Matx<_Tp, _rows, _cols>(static_cast(src.data())); - } -} - -template static inline -void cv2eigen( const Mat& src, - Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst ) -{ - CV_DbgAssert(src.rows == _rows && src.cols == _cols); - if( !(dst.Flags & Eigen::RowMajorBit) ) - { - const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - if( src.type() == _dst.type() ) - transpose(src, _dst); - else if( src.cols == src.rows ) - { - src.convertTo(_dst, _dst.type()); - transpose(_dst, _dst); - } - else - Mat(src.t()).convertTo(_dst, _dst.type()); - } - else - { - const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - src.convertTo(_dst, _dst.type()); - } -} - -// Matx case -template static inline -void cv2eigen( const Matx<_Tp, _rows, _cols>& src, - Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst ) -{ - if( !(dst.Flags & Eigen::RowMajorBit) ) - { - const Mat _dst(_cols, _rows, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - transpose(src, _dst); - } - else - { - const Mat _dst(_rows, _cols, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - Mat(src).copyTo(_dst); - } -} - -template static inline -void cv2eigen( const Mat& src, - Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst ) -{ - dst.resize(src.rows, src.cols); - if( !(dst.Flags & Eigen::RowMajorBit) ) - { - const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - if( src.type() == _dst.type() ) - transpose(src, _dst); - else if( src.cols == src.rows ) - { - src.convertTo(_dst, _dst.type()); - transpose(_dst, _dst); - } - else - Mat(src.t()).convertTo(_dst, _dst.type()); - } - else - { - const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - src.convertTo(_dst, _dst.type()); - } -} - -// Matx case -template static inline -void cv2eigen( const Matx<_Tp, _rows, _cols>& src, - Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst ) -{ - dst.resize(_rows, _cols); - if( !(dst.Flags & Eigen::RowMajorBit) ) - { - const Mat _dst(_cols, _rows, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - transpose(src, _dst); - } - else - { - const Mat _dst(_rows, _cols, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - Mat(src).copyTo(_dst); - } -} - -template static inline -void cv2eigen( const Mat& src, - Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst ) -{ - CV_Assert(src.cols == 1); - dst.resize(src.rows); - - if( !(dst.Flags & Eigen::RowMajorBit) ) - { - const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - if( src.type() == _dst.type() ) - transpose(src, _dst); - else - Mat(src.t()).convertTo(_dst, _dst.type()); - } - else - { - const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - src.convertTo(_dst, _dst.type()); - } -} - -// Matx case -template static inline -void cv2eigen( const Matx<_Tp, _rows, 1>& src, - Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst ) -{ - dst.resize(_rows); - - if( !(dst.Flags & Eigen::RowMajorBit) ) - { - const Mat _dst(1, _rows, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - transpose(src, _dst); - } - else - { - const Mat _dst(_rows, 1, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - src.copyTo(_dst); - } -} - - -template static inline -void cv2eigen( const Mat& src, - Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst ) -{ - CV_Assert(src.rows == 1); - dst.resize(src.cols); - if( !(dst.Flags & Eigen::RowMajorBit) ) - { - const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - if( src.type() == _dst.type() ) - transpose(src, _dst); - else - Mat(src.t()).convertTo(_dst, _dst.type()); - } - else - { - const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - src.convertTo(_dst, _dst.type()); - } -} - -//Matx -template static inline -void cv2eigen( const Matx<_Tp, 1, _cols>& src, - Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst ) -{ - dst.resize(_cols); - if( !(dst.Flags & Eigen::RowMajorBit) ) - { - const Mat _dst(_cols, 1, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - transpose(src, _dst); - } - else - { - const Mat _dst(1, _cols, traits::Type<_Tp>::value, - dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - Mat(src).copyTo(_dst); - } -} - -//! @} - -} // cv - -#endif diff --git a/opencv/include/opencv2/core/fast_math.hpp b/opencv/include/opencv2/core/fast_math.hpp deleted file mode 100644 index d9ea28e..0000000 --- a/opencv/include/opencv2/core/fast_math.hpp +++ /dev/null @@ -1,271 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_FAST_MATH_HPP -#define OPENCV_CORE_FAST_MATH_HPP - -#include "opencv2/core/cvdef.h" - -#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \ - && defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__) -#include -#endif - - -//! @addtogroup core_utils -//! @{ - -/****************************************************************************************\ -* fast math * -\****************************************************************************************/ - -#ifdef __cplusplus -# include -#else -# ifdef __BORLANDC__ -# include -# else -# include -# endif -#endif - -#ifdef HAVE_TEGRA_OPTIMIZATION -# include "tegra_round.hpp" -#endif - -#if defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__ || defined __ARM_NEON__) && !defined __SOFTFP__ && !defined(__CUDACC__) - // 1. general scheme - #define ARM_ROUND(_value, _asm_string) \ - int res; \ - float temp; \ - CV_UNUSED(temp); \ - __asm__(_asm_string : [res] "=r" (res), [temp] "=w" (temp) : [value] "w" (_value)); \ - return res - // 2. version for double - #ifdef __clang__ - #define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %[value] \n vmov %[res], %[temp]") - #else - #define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %P[value] \n vmov %[res], %[temp]") - #endif - // 3. version for float - #define ARM_ROUND_FLT(value) ARM_ROUND(value, "vcvtr.s32.f32 %[temp], %[value]\n vmov %[res], %[temp]") -#endif - -/** @brief Rounds floating-point number to the nearest integer - - @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the - result is not defined. - */ -CV_INLINE int -cvRound( double value ) -{ -#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \ - && defined __SSE2__ && !defined __APPLE__) || CV_SSE2) && !defined(__CUDACC__) - __m128d t = _mm_set_sd( value ); - return _mm_cvtsd_si32(t); -#elif defined _MSC_VER && defined _M_IX86 - int t; - __asm - { - fld value; - fistp t; - } - return t; -#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \ - defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION - TEGRA_ROUND_DBL(value); -#elif defined CV_ICC || defined __GNUC__ -# if defined ARM_ROUND_DBL - ARM_ROUND_DBL(value); -# else - return (int)lrint(value); -# endif -#else - /* it's ok if round does not comply with IEEE754 standard; - the tests should allow +/-1 difference when the tested functions use round */ - return (int)(value + (value >= 0 ? 0.5 : -0.5)); -#endif -} - - -/** @brief Rounds floating-point number to the nearest integer not larger than the original. - - The function computes an integer i such that: - \f[i \le \texttt{value} < i+1\f] - @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the - result is not defined. - */ -CV_INLINE int cvFloor( double value ) -{ - int i = (int)value; - return i - (i > value); -} - -/** @brief Rounds floating-point number to the nearest integer not smaller than the original. - - The function computes an integer i such that: - \f[i \le \texttt{value} < i+1\f] - @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the - result is not defined. - */ -CV_INLINE int cvCeil( double value ) -{ - int i = (int)value; - return i + (i < value); -} - -/** @brief Determines if the argument is Not A Number. - - @param value The input floating-point value - - The function returns 1 if the argument is Not A Number (as defined by IEEE754 standard), 0 - otherwise. */ -CV_INLINE int cvIsNaN( double value ) -{ - Cv64suf ieee754; - ieee754.f = value; - return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) + - ((unsigned)ieee754.u != 0) > 0x7ff00000; -} - -/** @brief Determines if the argument is Infinity. - - @param value The input floating-point value - - The function returns 1 if the argument is a plus or minus infinity (as defined by IEEE754 standard) - and 0 otherwise. */ -CV_INLINE int cvIsInf( double value ) -{ - Cv64suf ieee754; - ieee754.f = value; - return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) == 0x7ff00000 && - (unsigned)ieee754.u == 0; -} - -#ifdef __cplusplus - -/** @overload */ -CV_INLINE int cvRound(float value) -{ -#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \ - && defined __SSE2__ && !defined __APPLE__) || CV_SSE2) && !defined(__CUDACC__) - __m128 t = _mm_set_ss( value ); - return _mm_cvtss_si32(t); -#elif defined _MSC_VER && defined _M_IX86 - int t; - __asm - { - fld value; - fistp t; - } - return t; -#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \ - defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION - TEGRA_ROUND_FLT(value); -#elif defined CV_ICC || defined __GNUC__ -# if defined ARM_ROUND_FLT - ARM_ROUND_FLT(value); -# else - return (int)lrintf(value); -# endif -#else - /* it's ok if round does not comply with IEEE754 standard; - the tests should allow +/-1 difference when the tested functions use round */ - return (int)(value + (value >= 0 ? 0.5f : -0.5f)); -#endif -} - -/** @overload */ -CV_INLINE int cvRound( int value ) -{ - return value; -} - -/** @overload */ -CV_INLINE int cvFloor( float value ) -{ - int i = (int)value; - return i - (i > value); -} - -/** @overload */ -CV_INLINE int cvFloor( int value ) -{ - return value; -} - -/** @overload */ -CV_INLINE int cvCeil( float value ) -{ - int i = (int)value; - return i + (i < value); -} - -/** @overload */ -CV_INLINE int cvCeil( int value ) -{ - return value; -} - -/** @overload */ -CV_INLINE int cvIsNaN( float value ) -{ - Cv32suf ieee754; - ieee754.f = value; - return (ieee754.u & 0x7fffffff) > 0x7f800000; -} - -/** @overload */ -CV_INLINE int cvIsInf( float value ) -{ - Cv32suf ieee754; - ieee754.f = value; - return (ieee754.u & 0x7fffffff) == 0x7f800000; -} - -#endif // __cplusplus - -//! @} core_utils - -#endif diff --git a/opencv/include/opencv2/core/hal/hal.hpp b/opencv/include/opencv2/core/hal/hal.hpp deleted file mode 100644 index 68900ec..0000000 --- a/opencv/include/opencv2/core/hal/hal.hpp +++ /dev/null @@ -1,250 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_HAL_HPP -#define OPENCV_HAL_HPP - -#include "opencv2/core/cvdef.h" -#include "opencv2/core/cvstd.hpp" -#include "opencv2/core/hal/interface.h" - -namespace cv { namespace hal { - -//! @addtogroup core_hal_functions -//! @{ - -CV_EXPORTS int normHamming(const uchar* a, int n); -CV_EXPORTS int normHamming(const uchar* a, const uchar* b, int n); - -CV_EXPORTS int normHamming(const uchar* a, int n, int cellSize); -CV_EXPORTS int normHamming(const uchar* a, const uchar* b, int n, int cellSize); - -CV_EXPORTS int LU32f(float* A, size_t astep, int m, float* b, size_t bstep, int n); -CV_EXPORTS int LU64f(double* A, size_t astep, int m, double* b, size_t bstep, int n); -CV_EXPORTS bool Cholesky32f(float* A, size_t astep, int m, float* b, size_t bstep, int n); -CV_EXPORTS bool Cholesky64f(double* A, size_t astep, int m, double* b, size_t bstep, int n); -CV_EXPORTS void SVD32f(float* At, size_t astep, float* W, float* U, size_t ustep, float* Vt, size_t vstep, int m, int n, int flags); -CV_EXPORTS void SVD64f(double* At, size_t astep, double* W, double* U, size_t ustep, double* Vt, size_t vstep, int m, int n, int flags); -CV_EXPORTS int QR32f(float* A, size_t astep, int m, int n, int k, float* b, size_t bstep, float* hFactors); -CV_EXPORTS int QR64f(double* A, size_t astep, int m, int n, int k, double* b, size_t bstep, double* hFactors); - -CV_EXPORTS void gemm32f(const float* src1, size_t src1_step, const float* src2, size_t src2_step, - float alpha, const float* src3, size_t src3_step, float beta, float* dst, size_t dst_step, - int m_a, int n_a, int n_d, int flags); -CV_EXPORTS void gemm64f(const double* src1, size_t src1_step, const double* src2, size_t src2_step, - double alpha, const double* src3, size_t src3_step, double beta, double* dst, size_t dst_step, - int m_a, int n_a, int n_d, int flags); -CV_EXPORTS void gemm32fc(const float* src1, size_t src1_step, const float* src2, size_t src2_step, - float alpha, const float* src3, size_t src3_step, float beta, float* dst, size_t dst_step, - int m_a, int n_a, int n_d, int flags); -CV_EXPORTS void gemm64fc(const double* src1, size_t src1_step, const double* src2, size_t src2_step, - double alpha, const double* src3, size_t src3_step, double beta, double* dst, size_t dst_step, - int m_a, int n_a, int n_d, int flags); - -CV_EXPORTS int normL1_(const uchar* a, const uchar* b, int n); -CV_EXPORTS float normL1_(const float* a, const float* b, int n); -CV_EXPORTS float normL2Sqr_(const float* a, const float* b, int n); - -CV_EXPORTS void exp32f(const float* src, float* dst, int n); -CV_EXPORTS void exp64f(const double* src, double* dst, int n); -CV_EXPORTS void log32f(const float* src, float* dst, int n); -CV_EXPORTS void log64f(const double* src, double* dst, int n); - -CV_EXPORTS void fastAtan32f(const float* y, const float* x, float* dst, int n, bool angleInDegrees); -CV_EXPORTS void fastAtan64f(const double* y, const double* x, double* dst, int n, bool angleInDegrees); -CV_EXPORTS void magnitude32f(const float* x, const float* y, float* dst, int n); -CV_EXPORTS void magnitude64f(const double* x, const double* y, double* dst, int n); -CV_EXPORTS void sqrt32f(const float* src, float* dst, int len); -CV_EXPORTS void sqrt64f(const double* src, double* dst, int len); -CV_EXPORTS void invSqrt32f(const float* src, float* dst, int len); -CV_EXPORTS void invSqrt64f(const double* src, double* dst, int len); - -CV_EXPORTS void split8u(const uchar* src, uchar** dst, int len, int cn ); -CV_EXPORTS void split16u(const ushort* src, ushort** dst, int len, int cn ); -CV_EXPORTS void split32s(const int* src, int** dst, int len, int cn ); -CV_EXPORTS void split64s(const int64* src, int64** dst, int len, int cn ); - -CV_EXPORTS void merge8u(const uchar** src, uchar* dst, int len, int cn ); -CV_EXPORTS void merge16u(const ushort** src, ushort* dst, int len, int cn ); -CV_EXPORTS void merge32s(const int** src, int* dst, int len, int cn ); -CV_EXPORTS void merge64s(const int64** src, int64* dst, int len, int cn ); - -CV_EXPORTS void add8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void add8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void add16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void add16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void add32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void add32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void add64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); - -CV_EXPORTS void sub8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void sub8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void sub16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void sub16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void sub32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void sub32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void sub64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); - -CV_EXPORTS void max8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void max8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void max16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void max16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void max32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void max32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void max64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); - -CV_EXPORTS void min8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void min8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void min16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void min16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void min32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void min32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void min64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); - -CV_EXPORTS void absdiff8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void absdiff8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void absdiff16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void absdiff16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void absdiff32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void absdiff32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void absdiff64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); - -CV_EXPORTS void and8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void or8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void xor8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); -CV_EXPORTS void not8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); - -CV_EXPORTS void cmp8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); -CV_EXPORTS void cmp8s(const schar* src1, size_t step1, const schar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); -CV_EXPORTS void cmp16u(const ushort* src1, size_t step1, const ushort* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); -CV_EXPORTS void cmp16s(const short* src1, size_t step1, const short* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); -CV_EXPORTS void cmp32s(const int* src1, size_t step1, const int* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); -CV_EXPORTS void cmp32f(const float* src1, size_t step1, const float* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); -CV_EXPORTS void cmp64f(const double* src1, size_t step1, const double* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); - -CV_EXPORTS void mul8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void mul8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void mul16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void mul16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void mul32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void mul32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void mul64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale); - -CV_EXPORTS void div8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void div8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void div16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void div16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void div32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void div32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void div64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale); - -CV_EXPORTS void recip8u( const uchar *, size_t, const uchar * src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void recip8s( const schar *, size_t, const schar * src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void recip16u( const ushort *, size_t, const ushort * src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void recip16s( const short *, size_t, const short * src2, size_t step2, short* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void recip32s( const int *, size_t, const int * src2, size_t step2, int* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void recip32f( const float *, size_t, const float * src2, size_t step2, float* dst, size_t step, int width, int height, void* scale); -CV_EXPORTS void recip64f( const double *, size_t, const double * src2, size_t step2, double* dst, size_t step, int width, int height, void* scale); - -CV_EXPORTS void addWeighted8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _scalars ); -CV_EXPORTS void addWeighted8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scalars ); -CV_EXPORTS void addWeighted16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scalars ); -CV_EXPORTS void addWeighted16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scalars ); -CV_EXPORTS void addWeighted32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scalars ); -CV_EXPORTS void addWeighted32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scalars ); -CV_EXPORTS void addWeighted64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scalars ); - -struct CV_EXPORTS DFT1D -{ - static Ptr create(int len, int count, int depth, int flags, bool * useBuffer = 0); - virtual void apply(const uchar *src, uchar *dst) = 0; - virtual ~DFT1D() {} -}; - -struct CV_EXPORTS DFT2D -{ - static Ptr create(int width, int height, int depth, - int src_channels, int dst_channels, - int flags, int nonzero_rows = 0); - virtual void apply(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step) = 0; - virtual ~DFT2D() {} -}; - -struct CV_EXPORTS DCT2D -{ - static Ptr create(int width, int height, int depth, int flags); - virtual void apply(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step) = 0; - virtual ~DCT2D() {} -}; - -//! @} core_hal - -//============================================================================= -// for binary compatibility with 3.0 - -//! @cond IGNORED - -CV_EXPORTS int LU(float* A, size_t astep, int m, float* b, size_t bstep, int n); -CV_EXPORTS int LU(double* A, size_t astep, int m, double* b, size_t bstep, int n); -CV_EXPORTS bool Cholesky(float* A, size_t astep, int m, float* b, size_t bstep, int n); -CV_EXPORTS bool Cholesky(double* A, size_t astep, int m, double* b, size_t bstep, int n); - -CV_EXPORTS void exp(const float* src, float* dst, int n); -CV_EXPORTS void exp(const double* src, double* dst, int n); -CV_EXPORTS void log(const float* src, float* dst, int n); -CV_EXPORTS void log(const double* src, double* dst, int n); - -CV_EXPORTS void fastAtan2(const float* y, const float* x, float* dst, int n, bool angleInDegrees); -CV_EXPORTS void magnitude(const float* x, const float* y, float* dst, int n); -CV_EXPORTS void magnitude(const double* x, const double* y, double* dst, int n); -CV_EXPORTS void sqrt(const float* src, float* dst, int len); -CV_EXPORTS void sqrt(const double* src, double* dst, int len); -CV_EXPORTS void invSqrt(const float* src, float* dst, int len); -CV_EXPORTS void invSqrt(const double* src, double* dst, int len); - -//! @endcond - -}} //cv::hal - -#endif //OPENCV_HAL_HPP diff --git a/opencv/include/opencv2/core/hal/interface.h b/opencv/include/opencv2/core/hal/interface.h deleted file mode 100644 index 8f64025..0000000 --- a/opencv/include/opencv2/core/hal/interface.h +++ /dev/null @@ -1,182 +0,0 @@ -#ifndef OPENCV_CORE_HAL_INTERFACE_H -#define OPENCV_CORE_HAL_INTERFACE_H - -//! @addtogroup core_hal_interface -//! @{ - -//! @name Return codes -//! @{ -#define CV_HAL_ERROR_OK 0 -#define CV_HAL_ERROR_NOT_IMPLEMENTED 1 -#define CV_HAL_ERROR_UNKNOWN -1 -//! @} - -#ifdef __cplusplus -#include -#else -#include -#include -#endif - -//! @name Data types -//! primitive types -//! - schar - signed 1 byte integer -//! - uchar - unsigned 1 byte integer -//! - short - signed 2 byte integer -//! - ushort - unsigned 2 byte integer -//! - int - signed 4 byte integer -//! - uint - unsigned 4 byte integer -//! - int64 - signed 8 byte integer -//! - uint64 - unsigned 8 byte integer -//! @{ -#if !defined _MSC_VER && !defined __BORLANDC__ -# if defined __cplusplus && __cplusplus >= 201103L && !defined __APPLE__ -# include -# ifdef __NEWLIB__ - typedef unsigned int uint; -# else - typedef std::uint32_t uint; -# endif -# else -# include - typedef uint32_t uint; -# endif -#else - typedef unsigned uint; -#endif - -typedef signed char schar; - -#ifndef __IPL_H__ - typedef unsigned char uchar; - typedef unsigned short ushort; -#endif - -#if defined _MSC_VER || defined __BORLANDC__ - typedef __int64 int64; - typedef unsigned __int64 uint64; -# define CV_BIG_INT(n) n##I64 -# define CV_BIG_UINT(n) n##UI64 -#else - typedef int64_t int64; - typedef uint64_t uint64; -# define CV_BIG_INT(n) n##LL -# define CV_BIG_UINT(n) n##ULL -#endif - -#define CV_CN_MAX 512 -#define CV_CN_SHIFT 3 -#define CV_DEPTH_MAX (1 << CV_CN_SHIFT) - -#define CV_8U 0 -#define CV_8S 1 -#define CV_16U 2 -#define CV_16S 3 -#define CV_32S 4 -#define CV_32F 5 -#define CV_64F 6 -#define CV_USRTYPE1 7 - -#define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1) -#define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK) - -#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT)) -#define CV_MAKE_TYPE CV_MAKETYPE - -#define CV_8UC1 CV_MAKETYPE(CV_8U,1) -#define CV_8UC2 CV_MAKETYPE(CV_8U,2) -#define CV_8UC3 CV_MAKETYPE(CV_8U,3) -#define CV_8UC4 CV_MAKETYPE(CV_8U,4) -#define CV_8UC(n) CV_MAKETYPE(CV_8U,(n)) - -#define CV_8SC1 CV_MAKETYPE(CV_8S,1) -#define CV_8SC2 CV_MAKETYPE(CV_8S,2) -#define CV_8SC3 CV_MAKETYPE(CV_8S,3) -#define CV_8SC4 CV_MAKETYPE(CV_8S,4) -#define CV_8SC(n) CV_MAKETYPE(CV_8S,(n)) - -#define CV_16UC1 CV_MAKETYPE(CV_16U,1) -#define CV_16UC2 CV_MAKETYPE(CV_16U,2) -#define CV_16UC3 CV_MAKETYPE(CV_16U,3) -#define CV_16UC4 CV_MAKETYPE(CV_16U,4) -#define CV_16UC(n) CV_MAKETYPE(CV_16U,(n)) - -#define CV_16SC1 CV_MAKETYPE(CV_16S,1) -#define CV_16SC2 CV_MAKETYPE(CV_16S,2) -#define CV_16SC3 CV_MAKETYPE(CV_16S,3) -#define CV_16SC4 CV_MAKETYPE(CV_16S,4) -#define CV_16SC(n) CV_MAKETYPE(CV_16S,(n)) - -#define CV_32SC1 CV_MAKETYPE(CV_32S,1) -#define CV_32SC2 CV_MAKETYPE(CV_32S,2) -#define CV_32SC3 CV_MAKETYPE(CV_32S,3) -#define CV_32SC4 CV_MAKETYPE(CV_32S,4) -#define CV_32SC(n) CV_MAKETYPE(CV_32S,(n)) - -#define CV_32FC1 CV_MAKETYPE(CV_32F,1) -#define CV_32FC2 CV_MAKETYPE(CV_32F,2) -#define CV_32FC3 CV_MAKETYPE(CV_32F,3) -#define CV_32FC4 CV_MAKETYPE(CV_32F,4) -#define CV_32FC(n) CV_MAKETYPE(CV_32F,(n)) - -#define CV_64FC1 CV_MAKETYPE(CV_64F,1) -#define CV_64FC2 CV_MAKETYPE(CV_64F,2) -#define CV_64FC3 CV_MAKETYPE(CV_64F,3) -#define CV_64FC4 CV_MAKETYPE(CV_64F,4) -#define CV_64FC(n) CV_MAKETYPE(CV_64F,(n)) -//! @} - -//! @name Comparison operation -//! @sa cv::CmpTypes -//! @{ -#define CV_HAL_CMP_EQ 0 -#define CV_HAL_CMP_GT 1 -#define CV_HAL_CMP_GE 2 -#define CV_HAL_CMP_LT 3 -#define CV_HAL_CMP_LE 4 -#define CV_HAL_CMP_NE 5 -//! @} - -//! @name Border processing modes -//! @sa cv::BorderTypes -//! @{ -#define CV_HAL_BORDER_CONSTANT 0 -#define CV_HAL_BORDER_REPLICATE 1 -#define CV_HAL_BORDER_REFLECT 2 -#define CV_HAL_BORDER_WRAP 3 -#define CV_HAL_BORDER_REFLECT_101 4 -#define CV_HAL_BORDER_TRANSPARENT 5 -#define CV_HAL_BORDER_ISOLATED 16 -//! @} - -//! @name DFT flags -//! @{ -#define CV_HAL_DFT_INVERSE 1 -#define CV_HAL_DFT_SCALE 2 -#define CV_HAL_DFT_ROWS 4 -#define CV_HAL_DFT_COMPLEX_OUTPUT 16 -#define CV_HAL_DFT_REAL_OUTPUT 32 -#define CV_HAL_DFT_TWO_STAGE 64 -#define CV_HAL_DFT_STAGE_COLS 128 -#define CV_HAL_DFT_IS_CONTINUOUS 512 -#define CV_HAL_DFT_IS_INPLACE 1024 -//! @} - -//! @name SVD flags -//! @{ -#define CV_HAL_SVD_NO_UV 1 -#define CV_HAL_SVD_SHORT_UV 2 -#define CV_HAL_SVD_MODIFY_A 4 -#define CV_HAL_SVD_FULL_UV 8 -//! @} - -//! @name Gemm flags -//! @{ -#define CV_HAL_GEMM_1_T 1 -#define CV_HAL_GEMM_2_T 2 -#define CV_HAL_GEMM_3_T 4 -//! @} - -//! @} - -#endif diff --git a/opencv/include/opencv2/core/hal/intrin.hpp b/opencv/include/opencv2/core/hal/intrin.hpp deleted file mode 100644 index 460c5c5..0000000 --- a/opencv/include/opencv2/core/hal/intrin.hpp +++ /dev/null @@ -1,429 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_HAL_INTRIN_HPP -#define OPENCV_HAL_INTRIN_HPP - -#include -#include -#include -#include "opencv2/core/cvdef.h" - -#define OPENCV_HAL_ADD(a, b) ((a) + (b)) -#define OPENCV_HAL_AND(a, b) ((a) & (b)) -#define OPENCV_HAL_NOP(a) (a) -#define OPENCV_HAL_1ST(a, b) (a) - -// unlike HAL API, which is in cv::hal, -// we put intrinsics into cv namespace to make its -// access from within opencv code more accessible -namespace cv { - -namespace hal { - -enum StoreMode -{ - STORE_UNALIGNED = 0, - STORE_ALIGNED = 1, - STORE_ALIGNED_NOCACHE = 2 -}; - -} - -template struct V_TypeTraits -{ -}; - -#define CV_INTRIN_DEF_TYPE_TRAITS(type, int_type_, uint_type_, abs_type_, w_type_, q_type_, sum_type_, nlanes128_) \ - template<> struct V_TypeTraits \ - { \ - typedef type value_type; \ - typedef int_type_ int_type; \ - typedef abs_type_ abs_type; \ - typedef uint_type_ uint_type; \ - typedef w_type_ w_type; \ - typedef q_type_ q_type; \ - typedef sum_type_ sum_type; \ - enum { nlanes128 = nlanes128_ }; \ - \ - static inline int_type reinterpret_int(type x) \ - { \ - union { type l; int_type i; } v; \ - v.l = x; \ - return v.i; \ - } \ - \ - static inline type reinterpret_from_int(int_type x) \ - { \ - union { type l; int_type i; } v; \ - v.i = x; \ - return v.l; \ - } \ - } - -CV_INTRIN_DEF_TYPE_TRAITS(uchar, schar, uchar, uchar, ushort, unsigned, unsigned, 16); -CV_INTRIN_DEF_TYPE_TRAITS(schar, schar, uchar, uchar, short, int, int, 16); -CV_INTRIN_DEF_TYPE_TRAITS(ushort, short, ushort, ushort, unsigned, uint64, unsigned, 8); -CV_INTRIN_DEF_TYPE_TRAITS(short, short, ushort, ushort, int, int64, int, 8); -CV_INTRIN_DEF_TYPE_TRAITS(unsigned, int, unsigned, unsigned, uint64, void, unsigned, 4); -CV_INTRIN_DEF_TYPE_TRAITS(int, int, unsigned, unsigned, int64, void, int, 4); -CV_INTRIN_DEF_TYPE_TRAITS(float, int, unsigned, float, double, void, float, 4); -CV_INTRIN_DEF_TYPE_TRAITS(uint64, int64, uint64, uint64, void, void, uint64, 2); -CV_INTRIN_DEF_TYPE_TRAITS(int64, int64, uint64, uint64, void, void, int64, 2); -CV_INTRIN_DEF_TYPE_TRAITS(double, int64, uint64, double, void, void, double, 2); - -#ifndef CV_DOXYGEN - -#ifdef CV_CPU_DISPATCH_MODE - #define CV_CPU_OPTIMIZATION_HAL_NAMESPACE __CV_CAT(hal_, CV_CPU_DISPATCH_MODE) - #define CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN namespace __CV_CAT(hal_, CV_CPU_DISPATCH_MODE) { - #define CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END } -#else - #define CV_CPU_OPTIMIZATION_HAL_NAMESPACE hal_baseline - #define CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN namespace hal_baseline { - #define CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END } -#endif - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END -using namespace CV_CPU_OPTIMIZATION_HAL_NAMESPACE; -#endif -} - -#ifdef CV_DOXYGEN -# undef CV_AVX2 -# undef CV_SSE2 -# undef CV_NEON -# undef CV_VSX -# undef CV_FP16 -#endif - -#if CV_SSE2 || CV_NEON || CV_VSX -#define CV__SIMD_FORWARD 128 -#include "opencv2/core/hal/intrin_forward.hpp" -#endif - -#if CV_SSE2 - -#include "opencv2/core/hal/intrin_sse_em.hpp" -#include "opencv2/core/hal/intrin_sse.hpp" - -#elif CV_NEON - -#include "opencv2/core/hal/intrin_neon.hpp" - -#elif CV_VSX - -#include "opencv2/core/hal/intrin_vsx.hpp" - -#else - -#define CV_SIMD128_CPP 1 -#include "opencv2/core/hal/intrin_cpp.hpp" - -#endif - -// AVX2 can be used together with SSE2, so -// we define those two sets of intrinsics at once. -// Most of the intrinsics do not conflict (the proper overloaded variant is -// resolved by the argument types, e.g. v_float32x4 ~ SSE2, v_float32x8 ~ AVX2), -// but some of AVX2 intrinsics get v256_ prefix instead of v_, e.g. v256_load() vs v_load(). -// Correspondingly, the wide intrinsics (which are mapped to the "widest" -// available instruction set) will get vx_ prefix -// (and will be mapped to v256_ counterparts) (e.g. vx_load() => v256_load()) -#if CV_AVX2 - -#define CV__SIMD_FORWARD 256 -#include "opencv2/core/hal/intrin_forward.hpp" -#include "opencv2/core/hal/intrin_avx.hpp" - -#endif - -//! @cond IGNORED - -namespace cv { - -#ifndef CV_DOXYGEN -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN -#endif - -#ifndef CV_SIMD128 -#define CV_SIMD128 0 -#endif - -#ifndef CV_SIMD128_64F -#define CV_SIMD128_64F 0 -#endif - -#ifndef CV_SIMD256 -#define CV_SIMD256 0 -#endif - -#ifndef CV_SIMD256_64F -#define CV_SIMD256_64F 0 -#endif - -#ifndef CV_SIMD512 -#define CV_SIMD512 0 -#endif - -#ifndef CV_SIMD512_64F -#define CV_SIMD512_64F 0 -#endif - -#ifndef CV_SIMD128_FP16 -#define CV_SIMD128_FP16 0 -#endif - -#ifndef CV_SIMD256_FP16 -#define CV_SIMD256_FP16 0 -#endif - -#ifndef CV_SIMD512_FP16 -#define CV_SIMD512_FP16 0 -#endif - -//================================================================================================== - -#define CV_INTRIN_DEFINE_WIDE_INTRIN(typ, vtyp, short_typ, prefix, loadsfx) \ - inline vtyp vx_setall_##short_typ(typ v) { return prefix##_setall_##short_typ(v); } \ - inline vtyp vx_setzero_##short_typ() { return prefix##_setzero_##short_typ(); } \ - inline vtyp vx_##loadsfx(const typ* ptr) { return prefix##_##loadsfx(ptr); } \ - inline vtyp vx_##loadsfx##_aligned(const typ* ptr) { return prefix##_##loadsfx##_aligned(ptr); } \ - inline vtyp vx_##loadsfx##_low(const typ* ptr) { return prefix##_##loadsfx##_low(ptr); } \ - inline vtyp vx_##loadsfx##_halves(const typ* ptr0, const typ* ptr1) { return prefix##_##loadsfx##_halves(ptr0, ptr1); } \ - inline void vx_store(typ* ptr, const vtyp& v) { return v_store(ptr, v); } \ - inline void vx_store_aligned(typ* ptr, const vtyp& v) { return v_store_aligned(ptr, v); } \ - inline vtyp vx_lut(const typ* ptr, const int* idx) { return prefix##_lut(ptr, idx); } \ - inline vtyp vx_lut_pairs(const typ* ptr, const int* idx) { return prefix##_lut_pairs(ptr, idx); } - -#define CV_INTRIN_DEFINE_WIDE_LUT_QUAD(typ, vtyp, prefix) \ - inline vtyp vx_lut_quads(const typ* ptr, const int* idx) { return prefix##_lut_quads(ptr, idx); } - -#define CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(typ, wtyp, prefix) \ - inline wtyp vx_load_expand(const typ* ptr) { return prefix##_load_expand(ptr); } - -#define CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND_Q(typ, qtyp, prefix) \ - inline qtyp vx_load_expand_q(const typ* ptr) { return prefix##_load_expand_q(ptr); } - -#define CV_INTRIN_DEFINE_WIDE_INTRIN_WITH_EXPAND(typ, vtyp, short_typ, wtyp, qtyp, prefix, loadsfx) \ - CV_INTRIN_DEFINE_WIDE_INTRIN(typ, vtyp, short_typ, prefix, loadsfx) \ - CV_INTRIN_DEFINE_WIDE_LUT_QUAD(typ, vtyp, prefix) \ - CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(typ, wtyp, prefix) \ - CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND_Q(typ, qtyp, prefix) - -#define CV_INTRIN_DEFINE_WIDE_INTRIN_ALL_TYPES(prefix) \ - CV_INTRIN_DEFINE_WIDE_INTRIN_WITH_EXPAND(uchar, v_uint8, u8, v_uint16, v_uint32, prefix, load) \ - CV_INTRIN_DEFINE_WIDE_INTRIN_WITH_EXPAND(schar, v_int8, s8, v_int16, v_int32, prefix, load) \ - CV_INTRIN_DEFINE_WIDE_INTRIN(ushort, v_uint16, u16, prefix, load) \ - CV_INTRIN_DEFINE_WIDE_LUT_QUAD(ushort, v_uint16, prefix) \ - CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(ushort, v_uint32, prefix) \ - CV_INTRIN_DEFINE_WIDE_INTRIN(short, v_int16, s16, prefix, load) \ - CV_INTRIN_DEFINE_WIDE_LUT_QUAD(short, v_int16, prefix) \ - CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(short, v_int32, prefix) \ - CV_INTRIN_DEFINE_WIDE_INTRIN(int, v_int32, s32, prefix, load) \ - CV_INTRIN_DEFINE_WIDE_LUT_QUAD(int, v_int32, prefix) \ - CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(int, v_int64, prefix) \ - CV_INTRIN_DEFINE_WIDE_INTRIN(unsigned, v_uint32, u32, prefix, load) \ - CV_INTRIN_DEFINE_WIDE_LUT_QUAD(unsigned, v_uint32, prefix) \ - CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(unsigned, v_uint64, prefix) \ - CV_INTRIN_DEFINE_WIDE_INTRIN(float, v_float32, f32, prefix, load) \ - CV_INTRIN_DEFINE_WIDE_LUT_QUAD(float, v_float32, prefix) \ - CV_INTRIN_DEFINE_WIDE_INTRIN(int64, v_int64, s64, prefix, load) \ - CV_INTRIN_DEFINE_WIDE_INTRIN(uint64, v_uint64, u64, prefix, load) \ - CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(float16_t, v_float32, prefix) - -template struct V_RegTraits -{ -}; - -#define CV_DEF_REG_TRAITS(prefix, _reg, lane_type, suffix, _u_reg, _w_reg, _q_reg, _int_reg, _round_reg) \ - template<> struct V_RegTraits<_reg> \ - { \ - typedef _reg reg; \ - typedef _u_reg u_reg; \ - typedef _w_reg w_reg; \ - typedef _q_reg q_reg; \ - typedef _int_reg int_reg; \ - typedef _round_reg round_reg; \ - } - -#if CV_SIMD128 || CV_SIMD128_CPP - CV_DEF_REG_TRAITS(v, v_uint8x16, uchar, u8, v_uint8x16, v_uint16x8, v_uint32x4, v_int8x16, void); - CV_DEF_REG_TRAITS(v, v_int8x16, schar, s8, v_uint8x16, v_int16x8, v_int32x4, v_int8x16, void); - CV_DEF_REG_TRAITS(v, v_uint16x8, ushort, u16, v_uint16x8, v_uint32x4, v_uint64x2, v_int16x8, void); - CV_DEF_REG_TRAITS(v, v_int16x8, short, s16, v_uint16x8, v_int32x4, v_int64x2, v_int16x8, void); - CV_DEF_REG_TRAITS(v, v_uint32x4, unsigned, u32, v_uint32x4, v_uint64x2, void, v_int32x4, void); - CV_DEF_REG_TRAITS(v, v_int32x4, int, s32, v_uint32x4, v_int64x2, void, v_int32x4, void); -#if CV_SIMD128_64F - CV_DEF_REG_TRAITS(v, v_float32x4, float, f32, v_float32x4, v_float64x2, void, v_int32x4, v_int32x4); -#else - CV_DEF_REG_TRAITS(v, v_float32x4, float, f32, v_float32x4, void, void, v_int32x4, v_int32x4); -#endif - CV_DEF_REG_TRAITS(v, v_uint64x2, uint64, u64, v_uint64x2, void, void, v_int64x2, void); - CV_DEF_REG_TRAITS(v, v_int64x2, int64, s64, v_uint64x2, void, void, v_int64x2, void); -#if CV_SIMD128_64F - CV_DEF_REG_TRAITS(v, v_float64x2, double, f64, v_float64x2, void, void, v_int64x2, v_int32x4); -#endif -#endif - -#if CV_SIMD256 - CV_DEF_REG_TRAITS(v256, v_uint8x32, uchar, u8, v_uint8x32, v_uint16x16, v_uint32x8, v_int8x32, void); - CV_DEF_REG_TRAITS(v256, v_int8x32, schar, s8, v_uint8x32, v_int16x16, v_int32x8, v_int8x32, void); - CV_DEF_REG_TRAITS(v256, v_uint16x16, ushort, u16, v_uint16x16, v_uint32x8, v_uint64x4, v_int16x16, void); - CV_DEF_REG_TRAITS(v256, v_int16x16, short, s16, v_uint16x16, v_int32x8, v_int64x4, v_int16x16, void); - CV_DEF_REG_TRAITS(v256, v_uint32x8, unsigned, u32, v_uint32x8, v_uint64x4, void, v_int32x8, void); - CV_DEF_REG_TRAITS(v256, v_int32x8, int, s32, v_uint32x8, v_int64x4, void, v_int32x8, void); - CV_DEF_REG_TRAITS(v256, v_float32x8, float, f32, v_float32x8, v_float64x4, void, v_int32x8, v_int32x8); - CV_DEF_REG_TRAITS(v256, v_uint64x4, uint64, u64, v_uint64x4, void, void, v_int64x4, void); - CV_DEF_REG_TRAITS(v256, v_int64x4, int64, s64, v_uint64x4, void, void, v_int64x4, void); - CV_DEF_REG_TRAITS(v256, v_float64x4, double, f64, v_float64x4, void, void, v_int64x4, v_int32x8); -#endif - -#if CV_SIMD512 && (!defined(CV__SIMD_FORCE_WIDTH) || CV__SIMD_FORCE_WIDTH == 512) -#define CV__SIMD_NAMESPACE simd512 -namespace CV__SIMD_NAMESPACE { - #define CV_SIMD 1 - #define CV_SIMD_64F CV_SIMD512_64F - #define CV_SIMD_WIDTH 64 - // TODO typedef v_uint8 / v_int32 / etc types here -} // namespace -using namespace CV__SIMD_NAMESPACE; -#elif CV_SIMD256 && (!defined(CV__SIMD_FORCE_WIDTH) || CV__SIMD_FORCE_WIDTH == 256) -#define CV__SIMD_NAMESPACE simd256 -namespace CV__SIMD_NAMESPACE { - #define CV_SIMD 1 - #define CV_SIMD_64F CV_SIMD256_64F - #define CV_SIMD_FP16 CV_SIMD256_FP16 - #define CV_SIMD_WIDTH 32 - typedef v_uint8x32 v_uint8; - typedef v_int8x32 v_int8; - typedef v_uint16x16 v_uint16; - typedef v_int16x16 v_int16; - typedef v_uint32x8 v_uint32; - typedef v_int32x8 v_int32; - typedef v_uint64x4 v_uint64; - typedef v_int64x4 v_int64; - typedef v_float32x8 v_float32; - CV_INTRIN_DEFINE_WIDE_INTRIN_ALL_TYPES(v256) - #if CV_SIMD256_64F - typedef v_float64x4 v_float64; - CV_INTRIN_DEFINE_WIDE_INTRIN(double, v_float64, f64, v256, load) - #endif - inline void vx_cleanup() { v256_cleanup(); } -} // namespace -using namespace CV__SIMD_NAMESPACE; -#elif (CV_SIMD128 || CV_SIMD128_CPP) && (!defined(CV__SIMD_FORCE_WIDTH) || CV__SIMD_FORCE_WIDTH == 128) -#define CV__SIMD_NAMESPACE simd128 -namespace CV__SIMD_NAMESPACE { - #define CV_SIMD CV_SIMD128 - #define CV_SIMD_64F CV_SIMD128_64F - #define CV_SIMD_WIDTH 16 - typedef v_uint8x16 v_uint8; - typedef v_int8x16 v_int8; - typedef v_uint16x8 v_uint16; - typedef v_int16x8 v_int16; - typedef v_uint32x4 v_uint32; - typedef v_int32x4 v_int32; - typedef v_uint64x2 v_uint64; - typedef v_int64x2 v_int64; - typedef v_float32x4 v_float32; - CV_INTRIN_DEFINE_WIDE_INTRIN_ALL_TYPES(v) - #if CV_SIMD128_64F - typedef v_float64x2 v_float64; - CV_INTRIN_DEFINE_WIDE_INTRIN(double, v_float64, f64, v, load) - #endif - inline void vx_cleanup() { v_cleanup(); } -} // namespace -using namespace CV__SIMD_NAMESPACE; -#endif - -inline unsigned int trailingZeros32(unsigned int value) { -#if defined(_MSC_VER) -#if (_MSC_VER < 1700) || defined(_M_ARM) - unsigned long index = 0; - _BitScanForward(&index, value); - return (unsigned int)index; -#elif defined(__clang__) - // clang-cl doesn't export _tzcnt_u32 for non BMI systems - return value ? __builtin_ctz(value) : 32; -#else - return _tzcnt_u32(value); -#endif -#elif defined(__GNUC__) || defined(__GNUG__) - return __builtin_ctz(value); -#elif defined(__ICC) || defined(__INTEL_COMPILER) - return _bit_scan_forward(value); -#elif defined(__clang__) - return llvm.cttz.i32(value, true); -#else - static const int MultiplyDeBruijnBitPosition[32] = { - 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, - 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 }; - return MultiplyDeBruijnBitPosition[((uint32_t)((value & -value) * 0x077CB531U)) >> 27]; -#endif -} - -#ifndef CV_DOXYGEN -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END -#endif - -#ifndef CV_SIMD_64F -#define CV_SIMD_64F 0 -#endif - -#ifndef CV_SIMD_FP16 -#define CV_SIMD_FP16 0 //!< Defined to 1 on native support of operations with float16x8_t / float16x16_t (SIMD256) types -#endif - - -#ifndef CV_SIMD -#define CV_SIMD 0 -#endif - -} // cv:: - -//! @endcond - -#endif diff --git a/opencv/include/opencv2/core/hal/intrin_avx.hpp b/opencv/include/opencv2/core/hal/intrin_avx.hpp deleted file mode 100644 index 58db714..0000000 --- a/opencv/include/opencv2/core/hal/intrin_avx.hpp +++ /dev/null @@ -1,2772 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html - -#ifndef OPENCV_HAL_INTRIN_AVX_HPP -#define OPENCV_HAL_INTRIN_AVX_HPP - -#define CV_SIMD256 1 -#define CV_SIMD256_64F 1 -#define CV_SIMD256_FP16 0 // no native operations with FP16 type. Only load/store from float32x8 are available (if CV_FP16 == 1) - -namespace cv -{ - -//! @cond IGNORED - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN - -///////// Utils //////////// - -inline __m256i _v256_combine(const __m128i& lo, const __m128i& hi) -{ return _mm256_inserti128_si256(_mm256_castsi128_si256(lo), hi, 1); } - -inline __m256 _v256_combine(const __m128& lo, const __m128& hi) -{ return _mm256_insertf128_ps(_mm256_castps128_ps256(lo), hi, 1); } - -inline __m256d _v256_combine(const __m128d& lo, const __m128d& hi) -{ return _mm256_insertf128_pd(_mm256_castpd128_pd256(lo), hi, 1); } - -inline int _v_cvtsi256_si32(const __m256i& a) -{ return _mm_cvtsi128_si32(_mm256_castsi256_si128(a)); } - -inline __m256i _v256_shuffle_odd_64(const __m256i& v) -{ return _mm256_permute4x64_epi64(v, _MM_SHUFFLE(3, 1, 2, 0)); } - -inline __m256d _v256_shuffle_odd_64(const __m256d& v) -{ return _mm256_permute4x64_pd(v, _MM_SHUFFLE(3, 1, 2, 0)); } - -template -inline __m256i _v256_permute2x128(const __m256i& a, const __m256i& b) -{ return _mm256_permute2x128_si256(a, b, imm); } - -template -inline __m256 _v256_permute2x128(const __m256& a, const __m256& b) -{ return _mm256_permute2f128_ps(a, b, imm); } - -template -inline __m256d _v256_permute2x128(const __m256d& a, const __m256d& b) -{ return _mm256_permute2f128_pd(a, b, imm); } - -template -inline _Tpvec v256_permute2x128(const _Tpvec& a, const _Tpvec& b) -{ return _Tpvec(_v256_permute2x128(a.val, b.val)); } - -template -inline __m256i _v256_permute4x64(const __m256i& a) -{ return _mm256_permute4x64_epi64(a, imm); } - -template -inline __m256d _v256_permute4x64(const __m256d& a) -{ return _mm256_permute4x64_pd(a, imm); } - -template -inline _Tpvec v256_permute4x64(const _Tpvec& a) -{ return _Tpvec(_v256_permute4x64(a.val)); } - -inline __m128i _v256_extract_high(const __m256i& v) -{ return _mm256_extracti128_si256(v, 1); } - -inline __m128 _v256_extract_high(const __m256& v) -{ return _mm256_extractf128_ps(v, 1); } - -inline __m128d _v256_extract_high(const __m256d& v) -{ return _mm256_extractf128_pd(v, 1); } - -inline __m128i _v256_extract_low(const __m256i& v) -{ return _mm256_castsi256_si128(v); } - -inline __m128 _v256_extract_low(const __m256& v) -{ return _mm256_castps256_ps128(v); } - -inline __m128d _v256_extract_low(const __m256d& v) -{ return _mm256_castpd256_pd128(v); } - -inline __m256i _v256_packs_epu32(const __m256i& a, const __m256i& b) -{ - const __m256i m = _mm256_set1_epi32(65535); - __m256i am = _mm256_min_epu32(a, m); - __m256i bm = _mm256_min_epu32(b, m); - return _mm256_packus_epi32(am, bm); -} - -///////// Types //////////// - -struct v_uint8x32 -{ - typedef uchar lane_type; - enum { nlanes = 32 }; - __m256i val; - - explicit v_uint8x32(__m256i v) : val(v) {} - v_uint8x32(uchar v0, uchar v1, uchar v2, uchar v3, - uchar v4, uchar v5, uchar v6, uchar v7, - uchar v8, uchar v9, uchar v10, uchar v11, - uchar v12, uchar v13, uchar v14, uchar v15, - uchar v16, uchar v17, uchar v18, uchar v19, - uchar v20, uchar v21, uchar v22, uchar v23, - uchar v24, uchar v25, uchar v26, uchar v27, - uchar v28, uchar v29, uchar v30, uchar v31) - { - val = _mm256_setr_epi8((char)v0, (char)v1, (char)v2, (char)v3, - (char)v4, (char)v5, (char)v6 , (char)v7, (char)v8, (char)v9, - (char)v10, (char)v11, (char)v12, (char)v13, (char)v14, (char)v15, - (char)v16, (char)v17, (char)v18, (char)v19, (char)v20, (char)v21, - (char)v22, (char)v23, (char)v24, (char)v25, (char)v26, (char)v27, - (char)v28, (char)v29, (char)v30, (char)v31); - } - v_uint8x32() : val(_mm256_setzero_si256()) {} - uchar get0() const { return (uchar)_v_cvtsi256_si32(val); } -}; - -struct v_int8x32 -{ - typedef schar lane_type; - enum { nlanes = 32 }; - __m256i val; - - explicit v_int8x32(__m256i v) : val(v) {} - v_int8x32(schar v0, schar v1, schar v2, schar v3, - schar v4, schar v5, schar v6, schar v7, - schar v8, schar v9, schar v10, schar v11, - schar v12, schar v13, schar v14, schar v15, - schar v16, schar v17, schar v18, schar v19, - schar v20, schar v21, schar v22, schar v23, - schar v24, schar v25, schar v26, schar v27, - schar v28, schar v29, schar v30, schar v31) - { - val = _mm256_setr_epi8(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, - v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, - v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31); - } - v_int8x32() : val(_mm256_setzero_si256()) {} - schar get0() const { return (schar)_v_cvtsi256_si32(val); } -}; - -struct v_uint16x16 -{ - typedef ushort lane_type; - enum { nlanes = 16 }; - __m256i val; - - explicit v_uint16x16(__m256i v) : val(v) {} - v_uint16x16(ushort v0, ushort v1, ushort v2, ushort v3, - ushort v4, ushort v5, ushort v6, ushort v7, - ushort v8, ushort v9, ushort v10, ushort v11, - ushort v12, ushort v13, ushort v14, ushort v15) - { - val = _mm256_setr_epi16((short)v0, (short)v1, (short)v2, (short)v3, - (short)v4, (short)v5, (short)v6, (short)v7, (short)v8, (short)v9, - (short)v10, (short)v11, (short)v12, (short)v13, (short)v14, (short)v15); - } - v_uint16x16() : val(_mm256_setzero_si256()) {} - ushort get0() const { return (ushort)_v_cvtsi256_si32(val); } -}; - -struct v_int16x16 -{ - typedef short lane_type; - enum { nlanes = 16 }; - __m256i val; - - explicit v_int16x16(__m256i v) : val(v) {} - v_int16x16(short v0, short v1, short v2, short v3, - short v4, short v5, short v6, short v7, - short v8, short v9, short v10, short v11, - short v12, short v13, short v14, short v15) - { - val = _mm256_setr_epi16(v0, v1, v2, v3, v4, v5, v6, v7, - v8, v9, v10, v11, v12, v13, v14, v15); - } - v_int16x16() : val(_mm256_setzero_si256()) {} - short get0() const { return (short)_v_cvtsi256_si32(val); } -}; - -struct v_uint32x8 -{ - typedef unsigned lane_type; - enum { nlanes = 8 }; - __m256i val; - - explicit v_uint32x8(__m256i v) : val(v) {} - v_uint32x8(unsigned v0, unsigned v1, unsigned v2, unsigned v3, - unsigned v4, unsigned v5, unsigned v6, unsigned v7) - { - val = _mm256_setr_epi32((unsigned)v0, (unsigned)v1, (unsigned)v2, - (unsigned)v3, (unsigned)v4, (unsigned)v5, (unsigned)v6, (unsigned)v7); - } - v_uint32x8() : val(_mm256_setzero_si256()) {} - unsigned get0() const { return (unsigned)_v_cvtsi256_si32(val); } -}; - -struct v_int32x8 -{ - typedef int lane_type; - enum { nlanes = 8 }; - __m256i val; - - explicit v_int32x8(__m256i v) : val(v) {} - v_int32x8(int v0, int v1, int v2, int v3, - int v4, int v5, int v6, int v7) - { - val = _mm256_setr_epi32(v0, v1, v2, v3, v4, v5, v6, v7); - } - v_int32x8() : val(_mm256_setzero_si256()) {} - int get0() const { return _v_cvtsi256_si32(val); } -}; - -struct v_float32x8 -{ - typedef float lane_type; - enum { nlanes = 8 }; - __m256 val; - - explicit v_float32x8(__m256 v) : val(v) {} - v_float32x8(float v0, float v1, float v2, float v3, - float v4, float v5, float v6, float v7) - { - val = _mm256_setr_ps(v0, v1, v2, v3, v4, v5, v6, v7); - } - v_float32x8() : val(_mm256_setzero_ps()) {} - float get0() const { return _mm_cvtss_f32(_mm256_castps256_ps128(val)); } -}; - -struct v_uint64x4 -{ - typedef uint64 lane_type; - enum { nlanes = 4 }; - __m256i val; - - explicit v_uint64x4(__m256i v) : val(v) {} - v_uint64x4(uint64 v0, uint64 v1, uint64 v2, uint64 v3) - { val = _mm256_setr_epi64x((int64)v0, (int64)v1, (int64)v2, (int64)v3); } - v_uint64x4() : val(_mm256_setzero_si256()) {} - uint64 get0() const - { - #if defined __x86_64__ || defined _M_X64 - return (uint64)_mm_cvtsi128_si64(_mm256_castsi256_si128(val)); - #else - int a = _mm_cvtsi128_si32(_mm256_castsi256_si128(val)); - int b = _mm_cvtsi128_si32(_mm256_castsi256_si128(_mm256_srli_epi64(val, 32))); - return (unsigned)a | ((uint64)(unsigned)b << 32); - #endif - } -}; - -struct v_int64x4 -{ - typedef int64 lane_type; - enum { nlanes = 4 }; - __m256i val; - - explicit v_int64x4(__m256i v) : val(v) {} - v_int64x4(int64 v0, int64 v1, int64 v2, int64 v3) - { val = _mm256_setr_epi64x(v0, v1, v2, v3); } - v_int64x4() : val(_mm256_setzero_si256()) {} - - int64 get0() const - { - #if defined __x86_64__ || defined _M_X64 - return (int64)_mm_cvtsi128_si64(_mm256_castsi256_si128(val)); - #else - int a = _mm_cvtsi128_si32(_mm256_castsi256_si128(val)); - int b = _mm_cvtsi128_si32(_mm256_castsi256_si128(_mm256_srli_epi64(val, 32))); - return (int64)((unsigned)a | ((uint64)(unsigned)b << 32)); - #endif - } -}; - -struct v_float64x4 -{ - typedef double lane_type; - enum { nlanes = 4 }; - __m256d val; - - explicit v_float64x4(__m256d v) : val(v) {} - v_float64x4(double v0, double v1, double v2, double v3) - { val = _mm256_setr_pd(v0, v1, v2, v3); } - v_float64x4() : val(_mm256_setzero_pd()) {} - double get0() const { return _mm_cvtsd_f64(_mm256_castpd256_pd128(val)); } -}; - -//////////////// Load and store operations /////////////// - -#define OPENCV_HAL_IMPL_AVX_LOADSTORE(_Tpvec, _Tp) \ - inline _Tpvec v256_load(const _Tp* ptr) \ - { return _Tpvec(_mm256_loadu_si256((const __m256i*)ptr)); } \ - inline _Tpvec v256_load_aligned(const _Tp* ptr) \ - { return _Tpvec(_mm256_load_si256((const __m256i*)ptr)); } \ - inline _Tpvec v256_load_low(const _Tp* ptr) \ - { \ - __m128i v128 = _mm_loadu_si128((const __m128i*)ptr); \ - return _Tpvec(_mm256_castsi128_si256(v128)); \ - } \ - inline _Tpvec v256_load_halves(const _Tp* ptr0, const _Tp* ptr1) \ - { \ - __m128i vlo = _mm_loadu_si128((const __m128i*)ptr0); \ - __m128i vhi = _mm_loadu_si128((const __m128i*)ptr1); \ - return _Tpvec(_v256_combine(vlo, vhi)); \ - } \ - inline void v_store(_Tp* ptr, const _Tpvec& a) \ - { _mm256_storeu_si256((__m256i*)ptr, a.val); } \ - inline void v_store_aligned(_Tp* ptr, const _Tpvec& a) \ - { _mm256_store_si256((__m256i*)ptr, a.val); } \ - inline void v_store_aligned_nocache(_Tp* ptr, const _Tpvec& a) \ - { _mm256_stream_si256((__m256i*)ptr, a.val); } \ - inline void v_store(_Tp* ptr, const _Tpvec& a, hal::StoreMode mode) \ - { \ - if( mode == hal::STORE_UNALIGNED ) \ - _mm256_storeu_si256((__m256i*)ptr, a.val); \ - else if( mode == hal::STORE_ALIGNED_NOCACHE ) \ - _mm256_stream_si256((__m256i*)ptr, a.val); \ - else \ - _mm256_store_si256((__m256i*)ptr, a.val); \ - } \ - inline void v_store_low(_Tp* ptr, const _Tpvec& a) \ - { _mm_storeu_si128((__m128i*)ptr, _v256_extract_low(a.val)); } \ - inline void v_store_high(_Tp* ptr, const _Tpvec& a) \ - { _mm_storeu_si128((__m128i*)ptr, _v256_extract_high(a.val)); } - -OPENCV_HAL_IMPL_AVX_LOADSTORE(v_uint8x32, uchar) -OPENCV_HAL_IMPL_AVX_LOADSTORE(v_int8x32, schar) -OPENCV_HAL_IMPL_AVX_LOADSTORE(v_uint16x16, ushort) -OPENCV_HAL_IMPL_AVX_LOADSTORE(v_int16x16, short) -OPENCV_HAL_IMPL_AVX_LOADSTORE(v_uint32x8, unsigned) -OPENCV_HAL_IMPL_AVX_LOADSTORE(v_int32x8, int) -OPENCV_HAL_IMPL_AVX_LOADSTORE(v_uint64x4, uint64) -OPENCV_HAL_IMPL_AVX_LOADSTORE(v_int64x4, int64) - -#define OPENCV_HAL_IMPL_AVX_LOADSTORE_FLT(_Tpvec, _Tp, suffix, halfreg) \ - inline _Tpvec v256_load(const _Tp* ptr) \ - { return _Tpvec(_mm256_loadu_##suffix(ptr)); } \ - inline _Tpvec v256_load_aligned(const _Tp* ptr) \ - { return _Tpvec(_mm256_load_##suffix(ptr)); } \ - inline _Tpvec v256_load_low(const _Tp* ptr) \ - { \ - return _Tpvec(_mm256_cast##suffix##128_##suffix##256 \ - (_mm_loadu_##suffix(ptr))); \ - } \ - inline _Tpvec v256_load_halves(const _Tp* ptr0, const _Tp* ptr1) \ - { \ - halfreg vlo = _mm_loadu_##suffix(ptr0); \ - halfreg vhi = _mm_loadu_##suffix(ptr1); \ - return _Tpvec(_v256_combine(vlo, vhi)); \ - } \ - inline void v_store(_Tp* ptr, const _Tpvec& a) \ - { _mm256_storeu_##suffix(ptr, a.val); } \ - inline void v_store_aligned(_Tp* ptr, const _Tpvec& a) \ - { _mm256_store_##suffix(ptr, a.val); } \ - inline void v_store_aligned_nocache(_Tp* ptr, const _Tpvec& a) \ - { _mm256_stream_##suffix(ptr, a.val); } \ - inline void v_store(_Tp* ptr, const _Tpvec& a, hal::StoreMode mode) \ - { \ - if( mode == hal::STORE_UNALIGNED ) \ - _mm256_storeu_##suffix(ptr, a.val); \ - else if( mode == hal::STORE_ALIGNED_NOCACHE ) \ - _mm256_stream_##suffix(ptr, a.val); \ - else \ - _mm256_store_##suffix(ptr, a.val); \ - } \ - inline void v_store_low(_Tp* ptr, const _Tpvec& a) \ - { _mm_storeu_##suffix(ptr, _v256_extract_low(a.val)); } \ - inline void v_store_high(_Tp* ptr, const _Tpvec& a) \ - { _mm_storeu_##suffix(ptr, _v256_extract_high(a.val)); } - -OPENCV_HAL_IMPL_AVX_LOADSTORE_FLT(v_float32x8, float, ps, __m128) -OPENCV_HAL_IMPL_AVX_LOADSTORE_FLT(v_float64x4, double, pd, __m128d) - -#define OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, _Tpvecf, suffix, cast) \ - inline _Tpvec v_reinterpret_as_##suffix(const _Tpvecf& a) \ - { return _Tpvec(cast(a.val)); } - -#define OPENCV_HAL_IMPL_AVX_INIT(_Tpvec, _Tp, suffix, ssuffix, ctype_s) \ - inline _Tpvec v256_setzero_##suffix() \ - { return _Tpvec(_mm256_setzero_si256()); } \ - inline _Tpvec v256_setall_##suffix(_Tp v) \ - { return _Tpvec(_mm256_set1_##ssuffix((ctype_s)v)); } \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_uint8x32, suffix, OPENCV_HAL_NOP) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_int8x32, suffix, OPENCV_HAL_NOP) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_uint16x16, suffix, OPENCV_HAL_NOP) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_int16x16, suffix, OPENCV_HAL_NOP) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_uint32x8, suffix, OPENCV_HAL_NOP) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_int32x8, suffix, OPENCV_HAL_NOP) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_uint64x4, suffix, OPENCV_HAL_NOP) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_int64x4, suffix, OPENCV_HAL_NOP) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_float32x8, suffix, _mm256_castps_si256) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_float64x4, suffix, _mm256_castpd_si256) - -OPENCV_HAL_IMPL_AVX_INIT(v_uint8x32, uchar, u8, epi8, char) -OPENCV_HAL_IMPL_AVX_INIT(v_int8x32, schar, s8, epi8, char) -OPENCV_HAL_IMPL_AVX_INIT(v_uint16x16, ushort, u16, epi16, short) -OPENCV_HAL_IMPL_AVX_INIT(v_int16x16, short, s16, epi16, short) -OPENCV_HAL_IMPL_AVX_INIT(v_uint32x8, unsigned, u32, epi32, int) -OPENCV_HAL_IMPL_AVX_INIT(v_int32x8, int, s32, epi32, int) -OPENCV_HAL_IMPL_AVX_INIT(v_uint64x4, uint64, u64, epi64x, int64) -OPENCV_HAL_IMPL_AVX_INIT(v_int64x4, int64, s64, epi64x, int64) - -#define OPENCV_HAL_IMPL_AVX_INIT_FLT(_Tpvec, _Tp, suffix, zsuffix, cast) \ - inline _Tpvec v256_setzero_##suffix() \ - { return _Tpvec(_mm256_setzero_##zsuffix()); } \ - inline _Tpvec v256_setall_##suffix(_Tp v) \ - { return _Tpvec(_mm256_set1_##zsuffix(v)); } \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_uint8x32, suffix, cast) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_int8x32, suffix, cast) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_uint16x16, suffix, cast) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_int16x16, suffix, cast) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_uint32x8, suffix, cast) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_int32x8, suffix, cast) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_uint64x4, suffix, cast) \ - OPENCV_HAL_IMPL_AVX_CAST(_Tpvec, v_int64x4, suffix, cast) - -OPENCV_HAL_IMPL_AVX_INIT_FLT(v_float32x8, float, f32, ps, _mm256_castsi256_ps) -OPENCV_HAL_IMPL_AVX_INIT_FLT(v_float64x4, double, f64, pd, _mm256_castsi256_pd) - -inline v_float32x8 v_reinterpret_as_f32(const v_float32x8& a) -{ return a; } -inline v_float32x8 v_reinterpret_as_f32(const v_float64x4& a) -{ return v_float32x8(_mm256_castpd_ps(a.val)); } - -inline v_float64x4 v_reinterpret_as_f64(const v_float64x4& a) -{ return a; } -inline v_float64x4 v_reinterpret_as_f64(const v_float32x8& a) -{ return v_float64x4(_mm256_castps_pd(a.val)); } - -#if CV_FP16 -inline v_float32x8 v256_load_fp16_f32(const short* ptr) -{ - return v_float32x8(_mm256_cvtph_ps(_mm_loadu_si128((const __m128i*)ptr))); -} - -inline void v_store_fp16(short* ptr, const v_float32x8& a) -{ - __m128i fp16_value = _mm256_cvtps_ph(a.val, 0); - _mm_store_si128((__m128i*)ptr, fp16_value); -} -#endif - -/* Recombine */ -/*#define OPENCV_HAL_IMPL_AVX_COMBINE(_Tpvec, perm) \ - inline _Tpvec v_combine_low(const _Tpvec& a, const _Tpvec& b) \ - { return _Tpvec(perm(a.val, b.val, 0x20)); } \ - inline _Tpvec v_combine_high(const _Tpvec& a, const _Tpvec& b) \ - { return _Tpvec(perm(a.val, b.val, 0x31)); } \ - inline void v_recombine(const _Tpvec& a, const _Tpvec& b, \ - _Tpvec& c, _Tpvec& d) \ - { c = v_combine_low(a, b); d = v_combine_high(a, b); } - -#define OPENCV_HAL_IMPL_AVX_UNPACKS(_Tpvec, suffix) \ - OPENCV_HAL_IMPL_AVX_COMBINE(_Tpvec, _mm256_permute2x128_si256) \ - inline void v_zip(const _Tpvec& a0, const _Tpvec& a1, \ - _Tpvec& b0, _Tpvec& b1) \ - { \ - __m256i v0 = _v256_shuffle_odd_64(a0.val); \ - __m256i v1 = _v256_shuffle_odd_64(a1.val); \ - b0.val = _mm256_unpacklo_##suffix(v0, v1); \ - b1.val = _mm256_unpackhi_##suffix(v0, v1); \ - } - -OPENCV_HAL_IMPL_AVX_UNPACKS(v_uint8x32, epi8) -OPENCV_HAL_IMPL_AVX_UNPACKS(v_int8x32, epi8) -OPENCV_HAL_IMPL_AVX_UNPACKS(v_uint16x16, epi16) -OPENCV_HAL_IMPL_AVX_UNPACKS(v_int16x16, epi16) -OPENCV_HAL_IMPL_AVX_UNPACKS(v_uint32x8, epi32) -OPENCV_HAL_IMPL_AVX_UNPACKS(v_int32x8, epi32) -OPENCV_HAL_IMPL_AVX_UNPACKS(v_uint64x4, epi64) -OPENCV_HAL_IMPL_AVX_UNPACKS(v_int64x4, epi64) -OPENCV_HAL_IMPL_AVX_COMBINE(v_float32x8, _mm256_permute2f128_ps) -OPENCV_HAL_IMPL_AVX_COMBINE(v_float64x4, _mm256_permute2f128_pd) - -inline void v_zip(const v_float32x8& a0, const v_float32x8& a1, v_float32x8& b0, v_float32x8& b1) -{ - __m256 v0 = _mm256_unpacklo_ps(a0.val, a1.val); - __m256 v1 = _mm256_unpackhi_ps(a0.val, a1.val); - v_recombine(v_float32x8(v0), v_float32x8(v1), b0, b1); -} - -inline void v_zip(const v_float64x4& a0, const v_float64x4& a1, v_float64x4& b0, v_float64x4& b1) -{ - __m256d v0 = _v_shuffle_odd_64(a0.val); - __m256d v1 = _v_shuffle_odd_64(a1.val); - b0.val = _mm256_unpacklo_pd(v0, v1); - b1.val = _mm256_unpackhi_pd(v0, v1); -}*/ - -//////////////// Variant Value reordering /////////////// - -// unpacks -#define OPENCV_HAL_IMPL_AVX_UNPACK(_Tpvec, suffix) \ - inline _Tpvec v256_unpacklo(const _Tpvec& a, const _Tpvec& b) \ - { return _Tpvec(_mm256_unpacklo_##suffix(a.val, b.val)); } \ - inline _Tpvec v256_unpackhi(const _Tpvec& a, const _Tpvec& b) \ - { return _Tpvec(_mm256_unpackhi_##suffix(a.val, b.val)); } - -OPENCV_HAL_IMPL_AVX_UNPACK(v_uint8x32, epi8) -OPENCV_HAL_IMPL_AVX_UNPACK(v_int8x32, epi8) -OPENCV_HAL_IMPL_AVX_UNPACK(v_uint16x16, epi16) -OPENCV_HAL_IMPL_AVX_UNPACK(v_int16x16, epi16) -OPENCV_HAL_IMPL_AVX_UNPACK(v_uint32x8, epi32) -OPENCV_HAL_IMPL_AVX_UNPACK(v_int32x8, epi32) -OPENCV_HAL_IMPL_AVX_UNPACK(v_uint64x4, epi64) -OPENCV_HAL_IMPL_AVX_UNPACK(v_int64x4, epi64) -OPENCV_HAL_IMPL_AVX_UNPACK(v_float32x8, ps) -OPENCV_HAL_IMPL_AVX_UNPACK(v_float64x4, pd) - -// blend -#define OPENCV_HAL_IMPL_AVX_BLEND(_Tpvec, suffix) \ - template \ - inline _Tpvec v256_blend(const _Tpvec& a, const _Tpvec& b) \ - { return _Tpvec(_mm256_blend_##suffix(a.val, b.val, m)); } - -OPENCV_HAL_IMPL_AVX_BLEND(v_uint16x16, epi16) -OPENCV_HAL_IMPL_AVX_BLEND(v_int16x16, epi16) -OPENCV_HAL_IMPL_AVX_BLEND(v_uint32x8, epi32) -OPENCV_HAL_IMPL_AVX_BLEND(v_int32x8, epi32) -OPENCV_HAL_IMPL_AVX_BLEND(v_float32x8, ps) -OPENCV_HAL_IMPL_AVX_BLEND(v_float64x4, pd) - -template -inline v_uint64x4 v256_blend(const v_uint64x4& a, const v_uint64x4& b) -{ - enum {M0 = m}; - enum {M1 = (M0 | (M0 << 2)) & 0x33}; - enum {M2 = (M1 | (M1 << 1)) & 0x55}; - enum {MM = M2 | (M2 << 1)}; - return v_uint64x4(_mm256_blend_epi32(a.val, b.val, MM)); -} -template -inline v_int64x4 v256_blend(const v_int64x4& a, const v_int64x4& b) -{ return v_int64x4(v256_blend(v_uint64x4(a.val), v_uint64x4(b.val)).val); } - -// shuffle -// todo: emluate 64bit -#define OPENCV_HAL_IMPL_AVX_SHUFFLE(_Tpvec, intrin) \ - template \ - inline _Tpvec v256_shuffle(const _Tpvec& a) \ - { return _Tpvec(_mm256_##intrin(a.val, m)); } - -OPENCV_HAL_IMPL_AVX_SHUFFLE(v_uint32x8, shuffle_epi32) -OPENCV_HAL_IMPL_AVX_SHUFFLE(v_int32x8, shuffle_epi32) -OPENCV_HAL_IMPL_AVX_SHUFFLE(v_float32x8, permute_ps) -OPENCV_HAL_IMPL_AVX_SHUFFLE(v_float64x4, permute_pd) - -template -inline void v256_zip(const _Tpvec& a, const _Tpvec& b, _Tpvec& ab0, _Tpvec& ab1) -{ - ab0 = v256_unpacklo(a, b); - ab1 = v256_unpackhi(a, b); -} - -template -inline _Tpvec v256_combine_diagonal(const _Tpvec& a, const _Tpvec& b) -{ return _Tpvec(_mm256_blend_epi32(a.val, b.val, 0xf0)); } - -inline v_float32x8 v256_combine_diagonal(const v_float32x8& a, const v_float32x8& b) -{ return v256_blend<0xf0>(a, b); } - -inline v_float64x4 v256_combine_diagonal(const v_float64x4& a, const v_float64x4& b) -{ return v256_blend<0xc>(a, b); } - -template -inline _Tpvec v256_alignr_128(const _Tpvec& a, const _Tpvec& b) -{ return v256_permute2x128<0x21>(a, b); } - -template -inline _Tpvec v256_alignr_64(const _Tpvec& a, const _Tpvec& b) -{ return _Tpvec(_mm256_alignr_epi8(a.val, b.val, 8)); } -inline v_float64x4 v256_alignr_64(const v_float64x4& a, const v_float64x4& b) -{ return v_float64x4(_mm256_shuffle_pd(b.val, a.val, _MM_SHUFFLE(0, 0, 1, 1))); } -// todo: emulate float32 - -template -inline _Tpvec v256_swap_halves(const _Tpvec& a) -{ return v256_permute2x128<1>(a, a); } - -template -inline _Tpvec v256_reverse_64(const _Tpvec& a) -{ return v256_permute4x64<_MM_SHUFFLE(0, 1, 2, 3)>(a); } - -// ZIP -#define OPENCV_HAL_IMPL_AVX_ZIP(_Tpvec) \ - inline _Tpvec v_combine_low(const _Tpvec& a, const _Tpvec& b) \ - { return v256_permute2x128<0x20>(a, b); } \ - inline _Tpvec v_combine_high(const _Tpvec& a, const _Tpvec& b) \ - { return v256_permute2x128<0x31>(a, b); } \ - inline void v_recombine(const _Tpvec& a, const _Tpvec& b, \ - _Tpvec& c, _Tpvec& d) \ - { \ - _Tpvec a1b0 = v256_alignr_128(a, b); \ - c = v256_combine_diagonal(a, a1b0); \ - d = v256_combine_diagonal(a1b0, b); \ - } \ - inline void v_zip(const _Tpvec& a, const _Tpvec& b, \ - _Tpvec& ab0, _Tpvec& ab1) \ - { \ - _Tpvec ab0ab2, ab1ab3; \ - v256_zip(a, b, ab0ab2, ab1ab3); \ - v_recombine(ab0ab2, ab1ab3, ab0, ab1); \ - } - -OPENCV_HAL_IMPL_AVX_ZIP(v_uint8x32) -OPENCV_HAL_IMPL_AVX_ZIP(v_int8x32) -OPENCV_HAL_IMPL_AVX_ZIP(v_uint16x16) -OPENCV_HAL_IMPL_AVX_ZIP(v_int16x16) -OPENCV_HAL_IMPL_AVX_ZIP(v_uint32x8) -OPENCV_HAL_IMPL_AVX_ZIP(v_int32x8) -OPENCV_HAL_IMPL_AVX_ZIP(v_uint64x4) -OPENCV_HAL_IMPL_AVX_ZIP(v_int64x4) -OPENCV_HAL_IMPL_AVX_ZIP(v_float32x8) -OPENCV_HAL_IMPL_AVX_ZIP(v_float64x4) - -////////// Arithmetic, bitwise and comparison operations ///////// - -/* Element-wise binary and unary operations */ - -/** Arithmetics **/ -#define OPENCV_HAL_IMPL_AVX_BIN_OP(bin_op, _Tpvec, intrin) \ - inline _Tpvec operator bin_op (const _Tpvec& a, const _Tpvec& b) \ - { return _Tpvec(intrin(a.val, b.val)); } \ - inline _Tpvec& operator bin_op##= (_Tpvec& a, const _Tpvec& b) \ - { a.val = intrin(a.val, b.val); return a; } - -OPENCV_HAL_IMPL_AVX_BIN_OP(+, v_uint8x32, _mm256_adds_epu8) -OPENCV_HAL_IMPL_AVX_BIN_OP(-, v_uint8x32, _mm256_subs_epu8) -OPENCV_HAL_IMPL_AVX_BIN_OP(+, v_int8x32, _mm256_adds_epi8) -OPENCV_HAL_IMPL_AVX_BIN_OP(-, v_int8x32, _mm256_subs_epi8) -OPENCV_HAL_IMPL_AVX_BIN_OP(+, v_uint16x16, _mm256_adds_epu16) -OPENCV_HAL_IMPL_AVX_BIN_OP(-, v_uint16x16, _mm256_subs_epu16) -OPENCV_HAL_IMPL_AVX_BIN_OP(+, v_int16x16, _mm256_adds_epi16) -OPENCV_HAL_IMPL_AVX_BIN_OP(-, v_int16x16, _mm256_subs_epi16) -OPENCV_HAL_IMPL_AVX_BIN_OP(+, v_uint32x8, _mm256_add_epi32) -OPENCV_HAL_IMPL_AVX_BIN_OP(-, v_uint32x8, _mm256_sub_epi32) -OPENCV_HAL_IMPL_AVX_BIN_OP(*, v_uint32x8, _mm256_mullo_epi32) -OPENCV_HAL_IMPL_AVX_BIN_OP(+, v_int32x8, _mm256_add_epi32) -OPENCV_HAL_IMPL_AVX_BIN_OP(-, v_int32x8, _mm256_sub_epi32) -OPENCV_HAL_IMPL_AVX_BIN_OP(*, v_int32x8, _mm256_mullo_epi32) -OPENCV_HAL_IMPL_AVX_BIN_OP(+, v_uint64x4, _mm256_add_epi64) -OPENCV_HAL_IMPL_AVX_BIN_OP(-, v_uint64x4, _mm256_sub_epi64) -OPENCV_HAL_IMPL_AVX_BIN_OP(+, v_int64x4, _mm256_add_epi64) -OPENCV_HAL_IMPL_AVX_BIN_OP(-, v_int64x4, _mm256_sub_epi64) - -OPENCV_HAL_IMPL_AVX_BIN_OP(+, v_float32x8, _mm256_add_ps) -OPENCV_HAL_IMPL_AVX_BIN_OP(-, v_float32x8, _mm256_sub_ps) -OPENCV_HAL_IMPL_AVX_BIN_OP(*, v_float32x8, _mm256_mul_ps) -OPENCV_HAL_IMPL_AVX_BIN_OP(/, v_float32x8, _mm256_div_ps) -OPENCV_HAL_IMPL_AVX_BIN_OP(+, v_float64x4, _mm256_add_pd) -OPENCV_HAL_IMPL_AVX_BIN_OP(-, v_float64x4, _mm256_sub_pd) -OPENCV_HAL_IMPL_AVX_BIN_OP(*, v_float64x4, _mm256_mul_pd) -OPENCV_HAL_IMPL_AVX_BIN_OP(/, v_float64x4, _mm256_div_pd) - -// saturating multiply 8-bit, 16-bit -inline v_uint8x32 operator * (const v_uint8x32& a, const v_uint8x32& b) -{ - v_uint16x16 c, d; - v_mul_expand(a, b, c, d); - return v_pack(c, d); -} -inline v_int8x32 operator * (const v_int8x32& a, const v_int8x32& b) -{ - v_int16x16 c, d; - v_mul_expand(a, b, c, d); - return v_pack(c, d); -} -inline v_uint16x16 operator * (const v_uint16x16& a, const v_uint16x16& b) -{ - __m256i pl = _mm256_mullo_epi16(a.val, b.val); - __m256i ph = _mm256_mulhi_epu16(a.val, b.val); - __m256i p0 = _mm256_unpacklo_epi16(pl, ph); - __m256i p1 = _mm256_unpackhi_epi16(pl, ph); - return v_uint16x16(_v256_packs_epu32(p0, p1)); -} -inline v_int16x16 operator * (const v_int16x16& a, const v_int16x16& b) -{ - __m256i pl = _mm256_mullo_epi16(a.val, b.val); - __m256i ph = _mm256_mulhi_epi16(a.val, b.val); - __m256i p0 = _mm256_unpacklo_epi16(pl, ph); - __m256i p1 = _mm256_unpackhi_epi16(pl, ph); - return v_int16x16(_mm256_packs_epi32(p0, p1)); -} -inline v_uint8x32& operator *= (v_uint8x32& a, const v_uint8x32& b) -{ a = a * b; return a; } -inline v_int8x32& operator *= (v_int8x32& a, const v_int8x32& b) -{ a = a * b; return a; } -inline v_uint16x16& operator *= (v_uint16x16& a, const v_uint16x16& b) -{ a = a * b; return a; } -inline v_int16x16& operator *= (v_int16x16& a, const v_int16x16& b) -{ a = a * b; return a; } - -/** Non-saturating arithmetics **/ -#define OPENCV_HAL_IMPL_AVX_BIN_FUNC(func, _Tpvec, intrin) \ - inline _Tpvec func(const _Tpvec& a, const _Tpvec& b) \ - { return _Tpvec(intrin(a.val, b.val)); } - -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_add_wrap, v_uint8x32, _mm256_add_epi8) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_add_wrap, v_int8x32, _mm256_add_epi8) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_add_wrap, v_uint16x16, _mm256_add_epi16) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_add_wrap, v_int16x16, _mm256_add_epi16) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_sub_wrap, v_uint8x32, _mm256_sub_epi8) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_sub_wrap, v_int8x32, _mm256_sub_epi8) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_sub_wrap, v_uint16x16, _mm256_sub_epi16) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_sub_wrap, v_int16x16, _mm256_sub_epi16) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_mul_wrap, v_uint16x16, _mm256_mullo_epi16) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_mul_wrap, v_int16x16, _mm256_mullo_epi16) - -inline v_uint8x32 v_mul_wrap(const v_uint8x32& a, const v_uint8x32& b) -{ - __m256i ad = _mm256_srai_epi16(a.val, 8); - __m256i bd = _mm256_srai_epi16(b.val, 8); - __m256i p0 = _mm256_mullo_epi16(a.val, b.val); // even - __m256i p1 = _mm256_slli_epi16(_mm256_mullo_epi16(ad, bd), 8); // odd - - const __m256i b01 = _mm256_set1_epi32(0xFF00FF00); - return v_uint8x32(_mm256_blendv_epi8(p0, p1, b01)); -} -inline v_int8x32 v_mul_wrap(const v_int8x32& a, const v_int8x32& b) -{ - return v_reinterpret_as_s8(v_mul_wrap(v_reinterpret_as_u8(a), v_reinterpret_as_u8(b))); -} - -// Multiply and expand -inline void v_mul_expand(const v_uint8x32& a, const v_uint8x32& b, - v_uint16x16& c, v_uint16x16& d) -{ - v_uint16x16 a0, a1, b0, b1; - v_expand(a, a0, a1); - v_expand(b, b0, b1); - c = v_mul_wrap(a0, b0); - d = v_mul_wrap(a1, b1); -} - -inline void v_mul_expand(const v_int8x32& a, const v_int8x32& b, - v_int16x16& c, v_int16x16& d) -{ - v_int16x16 a0, a1, b0, b1; - v_expand(a, a0, a1); - v_expand(b, b0, b1); - c = v_mul_wrap(a0, b0); - d = v_mul_wrap(a1, b1); -} - -inline void v_mul_expand(const v_int16x16& a, const v_int16x16& b, - v_int32x8& c, v_int32x8& d) -{ - v_int16x16 vhi = v_int16x16(_mm256_mulhi_epi16(a.val, b.val)); - - v_int16x16 v0, v1; - v_zip(v_mul_wrap(a, b), vhi, v0, v1); - - c = v_reinterpret_as_s32(v0); - d = v_reinterpret_as_s32(v1); -} - -inline void v_mul_expand(const v_uint16x16& a, const v_uint16x16& b, - v_uint32x8& c, v_uint32x8& d) -{ - v_uint16x16 vhi = v_uint16x16(_mm256_mulhi_epu16(a.val, b.val)); - - v_uint16x16 v0, v1; - v_zip(v_mul_wrap(a, b), vhi, v0, v1); - - c = v_reinterpret_as_u32(v0); - d = v_reinterpret_as_u32(v1); -} - -inline void v_mul_expand(const v_uint32x8& a, const v_uint32x8& b, - v_uint64x4& c, v_uint64x4& d) -{ - __m256i v0 = _mm256_mul_epu32(a.val, b.val); - __m256i v1 = _mm256_mul_epu32(_mm256_srli_epi64(a.val, 32), _mm256_srli_epi64(b.val, 32)); - v_zip(v_uint64x4(v0), v_uint64x4(v1), c, d); -} - -inline v_int16x16 v_mul_hi(const v_int16x16& a, const v_int16x16& b) { return v_int16x16(_mm256_mulhi_epi16(a.val, b.val)); } -inline v_uint16x16 v_mul_hi(const v_uint16x16& a, const v_uint16x16& b) { return v_uint16x16(_mm256_mulhi_epu16(a.val, b.val)); } - -/** Bitwise shifts **/ -#define OPENCV_HAL_IMPL_AVX_SHIFT_OP(_Tpuvec, _Tpsvec, suffix, srai) \ - inline _Tpuvec operator << (const _Tpuvec& a, int imm) \ - { return _Tpuvec(_mm256_slli_##suffix(a.val, imm)); } \ - inline _Tpsvec operator << (const _Tpsvec& a, int imm) \ - { return _Tpsvec(_mm256_slli_##suffix(a.val, imm)); } \ - inline _Tpuvec operator >> (const _Tpuvec& a, int imm) \ - { return _Tpuvec(_mm256_srli_##suffix(a.val, imm)); } \ - inline _Tpsvec operator >> (const _Tpsvec& a, int imm) \ - { return _Tpsvec(srai(a.val, imm)); } \ - template \ - inline _Tpuvec v_shl(const _Tpuvec& a) \ - { return _Tpuvec(_mm256_slli_##suffix(a.val, imm)); } \ - template \ - inline _Tpsvec v_shl(const _Tpsvec& a) \ - { return _Tpsvec(_mm256_slli_##suffix(a.val, imm)); } \ - template \ - inline _Tpuvec v_shr(const _Tpuvec& a) \ - { return _Tpuvec(_mm256_srli_##suffix(a.val, imm)); } \ - template \ - inline _Tpsvec v_shr(const _Tpsvec& a) \ - { return _Tpsvec(srai(a.val, imm)); } - -OPENCV_HAL_IMPL_AVX_SHIFT_OP(v_uint16x16, v_int16x16, epi16, _mm256_srai_epi16) -OPENCV_HAL_IMPL_AVX_SHIFT_OP(v_uint32x8, v_int32x8, epi32, _mm256_srai_epi32) - -inline __m256i _mm256_srai_epi64xx(const __m256i a, int imm) -{ - __m256i d = _mm256_set1_epi64x((int64)1 << 63); - __m256i r = _mm256_srli_epi64(_mm256_add_epi64(a, d), imm); - return _mm256_sub_epi64(r, _mm256_srli_epi64(d, imm)); -} -OPENCV_HAL_IMPL_AVX_SHIFT_OP(v_uint64x4, v_int64x4, epi64, _mm256_srai_epi64xx) - - -/** Bitwise logic **/ -#define OPENCV_HAL_IMPL_AVX_LOGIC_OP(_Tpvec, suffix, not_const) \ - OPENCV_HAL_IMPL_AVX_BIN_OP(&, _Tpvec, _mm256_and_##suffix) \ - OPENCV_HAL_IMPL_AVX_BIN_OP(|, _Tpvec, _mm256_or_##suffix) \ - OPENCV_HAL_IMPL_AVX_BIN_OP(^, _Tpvec, _mm256_xor_##suffix) \ - inline _Tpvec operator ~ (const _Tpvec& a) \ - { return _Tpvec(_mm256_xor_##suffix(a.val, not_const)); } - -OPENCV_HAL_IMPL_AVX_LOGIC_OP(v_uint8x32, si256, _mm256_set1_epi32(-1)) -OPENCV_HAL_IMPL_AVX_LOGIC_OP(v_int8x32, si256, _mm256_set1_epi32(-1)) -OPENCV_HAL_IMPL_AVX_LOGIC_OP(v_uint16x16, si256, _mm256_set1_epi32(-1)) -OPENCV_HAL_IMPL_AVX_LOGIC_OP(v_int16x16, si256, _mm256_set1_epi32(-1)) -OPENCV_HAL_IMPL_AVX_LOGIC_OP(v_uint32x8, si256, _mm256_set1_epi32(-1)) -OPENCV_HAL_IMPL_AVX_LOGIC_OP(v_int32x8, si256, _mm256_set1_epi32(-1)) -OPENCV_HAL_IMPL_AVX_LOGIC_OP(v_uint64x4, si256, _mm256_set1_epi64x(-1)) -OPENCV_HAL_IMPL_AVX_LOGIC_OP(v_int64x4, si256, _mm256_set1_epi64x(-1)) -OPENCV_HAL_IMPL_AVX_LOGIC_OP(v_float32x8, ps, _mm256_castsi256_ps(_mm256_set1_epi32(-1))) -OPENCV_HAL_IMPL_AVX_LOGIC_OP(v_float64x4, pd, _mm256_castsi256_pd(_mm256_set1_epi32(-1))) - -/** Select **/ -#define OPENCV_HAL_IMPL_AVX_SELECT(_Tpvec, suffix) \ - inline _Tpvec v_select(const _Tpvec& mask, const _Tpvec& a, const _Tpvec& b) \ - { return _Tpvec(_mm256_blendv_##suffix(b.val, a.val, mask.val)); } - -OPENCV_HAL_IMPL_AVX_SELECT(v_uint8x32, epi8) -OPENCV_HAL_IMPL_AVX_SELECT(v_int8x32, epi8) -OPENCV_HAL_IMPL_AVX_SELECT(v_uint16x16, epi8) -OPENCV_HAL_IMPL_AVX_SELECT(v_int16x16, epi8) -OPENCV_HAL_IMPL_AVX_SELECT(v_uint32x8, epi8) -OPENCV_HAL_IMPL_AVX_SELECT(v_int32x8, epi8) -OPENCV_HAL_IMPL_AVX_SELECT(v_float32x8, ps) -OPENCV_HAL_IMPL_AVX_SELECT(v_float64x4, pd) - -/** Comparison **/ -#define OPENCV_HAL_IMPL_AVX_CMP_OP_OV(_Tpvec) \ - inline _Tpvec operator != (const _Tpvec& a, const _Tpvec& b) \ - { return ~(a == b); } \ - inline _Tpvec operator < (const _Tpvec& a, const _Tpvec& b) \ - { return b > a; } \ - inline _Tpvec operator >= (const _Tpvec& a, const _Tpvec& b) \ - { return ~(a < b); } \ - inline _Tpvec operator <= (const _Tpvec& a, const _Tpvec& b) \ - { return b >= a; } - -#define OPENCV_HAL_IMPL_AVX_CMP_OP_INT(_Tpuvec, _Tpsvec, suffix, sbit) \ - inline _Tpuvec operator == (const _Tpuvec& a, const _Tpuvec& b) \ - { return _Tpuvec(_mm256_cmpeq_##suffix(a.val, b.val)); } \ - inline _Tpuvec operator > (const _Tpuvec& a, const _Tpuvec& b) \ - { \ - __m256i smask = _mm256_set1_##suffix(sbit); \ - return _Tpuvec(_mm256_cmpgt_##suffix( \ - _mm256_xor_si256(a.val, smask), \ - _mm256_xor_si256(b.val, smask))); \ - } \ - inline _Tpsvec operator == (const _Tpsvec& a, const _Tpsvec& b) \ - { return _Tpsvec(_mm256_cmpeq_##suffix(a.val, b.val)); } \ - inline _Tpsvec operator > (const _Tpsvec& a, const _Tpsvec& b) \ - { return _Tpsvec(_mm256_cmpgt_##suffix(a.val, b.val)); } \ - OPENCV_HAL_IMPL_AVX_CMP_OP_OV(_Tpuvec) \ - OPENCV_HAL_IMPL_AVX_CMP_OP_OV(_Tpsvec) - -OPENCV_HAL_IMPL_AVX_CMP_OP_INT(v_uint8x32, v_int8x32, epi8, (char)-128) -OPENCV_HAL_IMPL_AVX_CMP_OP_INT(v_uint16x16, v_int16x16, epi16, (short)-32768) -OPENCV_HAL_IMPL_AVX_CMP_OP_INT(v_uint32x8, v_int32x8, epi32, (int)0x80000000) - -#define OPENCV_HAL_IMPL_AVX_CMP_OP_64BIT(_Tpvec) \ - inline _Tpvec operator == (const _Tpvec& a, const _Tpvec& b) \ - { return _Tpvec(_mm256_cmpeq_epi64(a.val, b.val)); } \ - inline _Tpvec operator != (const _Tpvec& a, const _Tpvec& b) \ - { return ~(a == b); } - -OPENCV_HAL_IMPL_AVX_CMP_OP_64BIT(v_uint64x4) -OPENCV_HAL_IMPL_AVX_CMP_OP_64BIT(v_int64x4) - -#define OPENCV_HAL_IMPL_AVX_CMP_FLT(bin_op, imm8, _Tpvec, suffix) \ - inline _Tpvec operator bin_op (const _Tpvec& a, const _Tpvec& b) \ - { return _Tpvec(_mm256_cmp_##suffix(a.val, b.val, imm8)); } - -#define OPENCV_HAL_IMPL_AVX_CMP_OP_FLT(_Tpvec, suffix) \ - OPENCV_HAL_IMPL_AVX_CMP_FLT(==, _CMP_EQ_OQ, _Tpvec, suffix) \ - OPENCV_HAL_IMPL_AVX_CMP_FLT(!=, _CMP_NEQ_OQ, _Tpvec, suffix) \ - OPENCV_HAL_IMPL_AVX_CMP_FLT(<, _CMP_LT_OQ, _Tpvec, suffix) \ - OPENCV_HAL_IMPL_AVX_CMP_FLT(>, _CMP_GT_OQ, _Tpvec, suffix) \ - OPENCV_HAL_IMPL_AVX_CMP_FLT(<=, _CMP_LE_OQ, _Tpvec, suffix) \ - OPENCV_HAL_IMPL_AVX_CMP_FLT(>=, _CMP_GE_OQ, _Tpvec, suffix) - -OPENCV_HAL_IMPL_AVX_CMP_OP_FLT(v_float32x8, ps) -OPENCV_HAL_IMPL_AVX_CMP_OP_FLT(v_float64x4, pd) - -inline v_float32x8 v_not_nan(const v_float32x8& a) -{ return v_float32x8(_mm256_cmp_ps(a.val, a.val, _CMP_ORD_Q)); } -inline v_float64x4 v_not_nan(const v_float64x4& a) -{ return v_float64x4(_mm256_cmp_pd(a.val, a.val, _CMP_ORD_Q)); } - -/** min/max **/ -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_min, v_uint8x32, _mm256_min_epu8) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_max, v_uint8x32, _mm256_max_epu8) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_min, v_int8x32, _mm256_min_epi8) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_max, v_int8x32, _mm256_max_epi8) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_min, v_uint16x16, _mm256_min_epu16) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_max, v_uint16x16, _mm256_max_epu16) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_min, v_int16x16, _mm256_min_epi16) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_max, v_int16x16, _mm256_max_epi16) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_min, v_uint32x8, _mm256_min_epu32) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_max, v_uint32x8, _mm256_max_epu32) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_min, v_int32x8, _mm256_min_epi32) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_max, v_int32x8, _mm256_max_epi32) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_min, v_float32x8, _mm256_min_ps) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_max, v_float32x8, _mm256_max_ps) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_min, v_float64x4, _mm256_min_pd) -OPENCV_HAL_IMPL_AVX_BIN_FUNC(v_max, v_float64x4, _mm256_max_pd) - -/** Rotate **/ -template -inline v_uint8x32 v_rotate_left(const v_uint8x32& a, const v_uint8x32& b) -{ - enum {IMM_R = (16 - imm) & 0xFF}; - enum {IMM_R2 = (32 - imm) & 0xFF}; - - if (imm == 0) return a; - if (imm == 32) return b; - if (imm > 32) return v_uint8x32(); - - __m256i swap = _mm256_permute2x128_si256(a.val, b.val, 0x03); - if (imm == 16) return v_uint8x32(swap); - if (imm < 16) return v_uint8x32(_mm256_alignr_epi8(a.val, swap, IMM_R)); - return v_uint8x32(_mm256_alignr_epi8(swap, b.val, IMM_R2)); // imm < 32 -} - -template -inline v_uint8x32 v_rotate_right(const v_uint8x32& a, const v_uint8x32& b) -{ - enum {IMM_L = (imm - 16) & 0xFF}; - - if (imm == 0) return a; - if (imm == 32) return b; - if (imm > 32) return v_uint8x32(); - - __m256i swap = _mm256_permute2x128_si256(a.val, b.val, 0x21); - if (imm == 16) return v_uint8x32(swap); - if (imm < 16) return v_uint8x32(_mm256_alignr_epi8(swap, a.val, imm)); - return v_uint8x32(_mm256_alignr_epi8(b.val, swap, IMM_L)); -} - -template -inline v_uint8x32 v_rotate_left(const v_uint8x32& a) -{ - enum {IMM_L = (imm - 16) & 0xFF}; - enum {IMM_R = (16 - imm) & 0xFF}; - - if (imm == 0) return a; - if (imm > 32) return v_uint8x32(); - - // ESAC control[3] ? [127:0] = 0 - __m256i swapz = _mm256_permute2x128_si256(a.val, a.val, _MM_SHUFFLE(0, 0, 2, 0)); - if (imm == 16) return v_uint8x32(swapz); - if (imm < 16) return v_uint8x32(_mm256_alignr_epi8(a.val, swapz, IMM_R)); - return v_uint8x32(_mm256_slli_si256(swapz, IMM_L)); -} - -template -inline v_uint8x32 v_rotate_right(const v_uint8x32& a) -{ - enum {IMM_L = (imm - 16) & 0xFF}; - - if (imm == 0) return a; - if (imm > 32) return v_uint8x32(); - - // ESAC control[3] ? [127:0] = 0 - __m256i swapz = _mm256_permute2x128_si256(a.val, a.val, _MM_SHUFFLE(2, 0, 0, 1)); - if (imm == 16) return v_uint8x32(swapz); - if (imm < 16) return v_uint8x32(_mm256_alignr_epi8(swapz, a.val, imm)); - return v_uint8x32(_mm256_srli_si256(swapz, IMM_L)); -} - -#define OPENCV_HAL_IMPL_AVX_ROTATE_CAST(intrin, _Tpvec, cast) \ - template \ - inline _Tpvec intrin(const _Tpvec& a, const _Tpvec& b) \ - { \ - enum {IMMxW = imm * sizeof(typename _Tpvec::lane_type)}; \ - v_uint8x32 ret = intrin(v_reinterpret_as_u8(a), \ - v_reinterpret_as_u8(b)); \ - return _Tpvec(cast(ret.val)); \ - } \ - template \ - inline _Tpvec intrin(const _Tpvec& a) \ - { \ - enum {IMMxW = imm * sizeof(typename _Tpvec::lane_type)}; \ - v_uint8x32 ret = intrin(v_reinterpret_as_u8(a)); \ - return _Tpvec(cast(ret.val)); \ - } - -#define OPENCV_HAL_IMPL_AVX_ROTATE(_Tpvec) \ - OPENCV_HAL_IMPL_AVX_ROTATE_CAST(v_rotate_left, _Tpvec, OPENCV_HAL_NOP) \ - OPENCV_HAL_IMPL_AVX_ROTATE_CAST(v_rotate_right, _Tpvec, OPENCV_HAL_NOP) - -OPENCV_HAL_IMPL_AVX_ROTATE(v_int8x32) -OPENCV_HAL_IMPL_AVX_ROTATE(v_uint16x16) -OPENCV_HAL_IMPL_AVX_ROTATE(v_int16x16) -OPENCV_HAL_IMPL_AVX_ROTATE(v_uint32x8) -OPENCV_HAL_IMPL_AVX_ROTATE(v_int32x8) -OPENCV_HAL_IMPL_AVX_ROTATE(v_uint64x4) -OPENCV_HAL_IMPL_AVX_ROTATE(v_int64x4) - -OPENCV_HAL_IMPL_AVX_ROTATE_CAST(v_rotate_left, v_float32x8, _mm256_castsi256_ps) -OPENCV_HAL_IMPL_AVX_ROTATE_CAST(v_rotate_right, v_float32x8, _mm256_castsi256_ps) -OPENCV_HAL_IMPL_AVX_ROTATE_CAST(v_rotate_left, v_float64x4, _mm256_castsi256_pd) -OPENCV_HAL_IMPL_AVX_ROTATE_CAST(v_rotate_right, v_float64x4, _mm256_castsi256_pd) - -////////// Reduce and mask ///////// - -/** Reduce **/ -#define OPENCV_HAL_IMPL_AVX_REDUCE_16(_Tpvec, sctype, func, intrin) \ - inline sctype v_reduce_##func(const _Tpvec& a) \ - { \ - __m128i v0 = _v256_extract_low(a.val); \ - __m128i v1 = _v256_extract_high(a.val); \ - v0 = intrin(v0, v1); \ - v0 = intrin(v0, _mm_srli_si128(v0, 8)); \ - v0 = intrin(v0, _mm_srli_si128(v0, 4)); \ - v0 = intrin(v0, _mm_srli_si128(v0, 2)); \ - return (sctype) _mm_cvtsi128_si32(v0); \ - } - -OPENCV_HAL_IMPL_AVX_REDUCE_16(v_uint16x16, ushort, min, _mm_min_epu16) -OPENCV_HAL_IMPL_AVX_REDUCE_16(v_int16x16, short, min, _mm_min_epi16) -OPENCV_HAL_IMPL_AVX_REDUCE_16(v_uint16x16, ushort, max, _mm_max_epu16) -OPENCV_HAL_IMPL_AVX_REDUCE_16(v_int16x16, short, max, _mm_max_epi16) - -#define OPENCV_HAL_IMPL_AVX_REDUCE_8(_Tpvec, sctype, func, intrin) \ - inline sctype v_reduce_##func(const _Tpvec& a) \ - { \ - __m128i v0 = _v256_extract_low(a.val); \ - __m128i v1 = _v256_extract_high(a.val); \ - v0 = intrin(v0, v1); \ - v0 = intrin(v0, _mm_srli_si128(v0, 8)); \ - v0 = intrin(v0, _mm_srli_si128(v0, 4)); \ - return (sctype) _mm_cvtsi128_si32(v0); \ - } - -OPENCV_HAL_IMPL_AVX_REDUCE_8(v_uint32x8, unsigned, min, _mm_min_epu32) -OPENCV_HAL_IMPL_AVX_REDUCE_8(v_int32x8, int, min, _mm_min_epi32) -OPENCV_HAL_IMPL_AVX_REDUCE_8(v_uint32x8, unsigned, max, _mm_max_epu32) -OPENCV_HAL_IMPL_AVX_REDUCE_8(v_int32x8, int, max, _mm_max_epi32) - -#define OPENCV_HAL_IMPL_AVX_REDUCE_FLT(func, intrin) \ - inline float v_reduce_##func(const v_float32x8& a) \ - { \ - __m128 v0 = _v256_extract_low(a.val); \ - __m128 v1 = _v256_extract_high(a.val); \ - v0 = intrin(v0, v1); \ - v0 = intrin(v0, _mm_permute_ps(v0, _MM_SHUFFLE(0, 0, 3, 2))); \ - v0 = intrin(v0, _mm_permute_ps(v0, _MM_SHUFFLE(0, 0, 0, 3))); \ - return _mm_cvtss_f32(v0); \ - } - -OPENCV_HAL_IMPL_AVX_REDUCE_FLT(min, _mm_min_ps) -OPENCV_HAL_IMPL_AVX_REDUCE_FLT(max, _mm_max_ps) - -inline ushort v_reduce_sum(const v_uint16x16& a) -{ - __m128i a0 = _v256_extract_low(a.val); - __m128i a1 = _v256_extract_high(a.val); - - __m128i s0 = _mm_adds_epu16(a0, a1); - s0 = _mm_adds_epu16(s0, _mm_srli_si128(s0, 8)); - s0 = _mm_adds_epu16(s0, _mm_srli_si128(s0, 4)); - s0 = _mm_adds_epu16(s0, _mm_srli_si128(s0, 2)); - - return (ushort)_mm_cvtsi128_si32(s0); -} - -inline short v_reduce_sum(const v_int16x16& a) -{ - __m256i s0 = _mm256_hadds_epi16(a.val, a.val); - s0 = _mm256_hadds_epi16(s0, s0); - s0 = _mm256_hadds_epi16(s0, s0); - - __m128i s1 = _v256_extract_high(s0); - s1 = _mm_adds_epi16(_v256_extract_low(s0), s1); - - return (short)_mm_cvtsi128_si32(s1); -} - -inline int v_reduce_sum(const v_int32x8& a) -{ - __m256i s0 = _mm256_hadd_epi32(a.val, a.val); - s0 = _mm256_hadd_epi32(s0, s0); - - __m128i s1 = _v256_extract_high(s0); - s1 = _mm_add_epi32(_v256_extract_low(s0), s1); - - return _mm_cvtsi128_si32(s1); -} - -inline unsigned v_reduce_sum(const v_uint32x8& a) -{ return v_reduce_sum(v_reinterpret_as_s32(a)); } - -inline float v_reduce_sum(const v_float32x8& a) -{ - __m256 s0 = _mm256_hadd_ps(a.val, a.val); - s0 = _mm256_hadd_ps(s0, s0); - - __m128 s1 = _v256_extract_high(s0); - s1 = _mm_add_ps(_v256_extract_low(s0), s1); - - return _mm_cvtss_f32(s1); -} - -inline double v_reduce_sum(const v_float64x4& a) -{ - __m256d s0 = _mm256_hadd_pd(a.val, a.val); - return _mm_cvtsd_f64(_mm_add_pd(_v256_extract_low(s0), _v256_extract_high(s0))); -} - -inline v_float32x8 v_reduce_sum4(const v_float32x8& a, const v_float32x8& b, - const v_float32x8& c, const v_float32x8& d) -{ - __m256 ab = _mm256_hadd_ps(a.val, b.val); - __m256 cd = _mm256_hadd_ps(c.val, d.val); - return v_float32x8(_mm256_hadd_ps(ab, cd)); -} - -inline unsigned v_reduce_sad(const v_uint8x32& a, const v_uint8x32& b) -{ - return (unsigned)_v_cvtsi256_si32(_mm256_sad_epu8(a.val, b.val)); -} -inline unsigned v_reduce_sad(const v_int8x32& a, const v_int8x32& b) -{ - __m256i half = _mm256_set1_epi8(0x7f); - return (unsigned)_v_cvtsi256_si32(_mm256_sad_epu8(_mm256_add_epi8(a.val, half), _mm256_add_epi8(b.val, half))); -} -inline unsigned v_reduce_sad(const v_uint16x16& a, const v_uint16x16& b) -{ - v_uint32x8 l, h; - v_expand(v_add_wrap(a - b, b - a), l, h); - return v_reduce_sum(l + h); -} -inline unsigned v_reduce_sad(const v_int16x16& a, const v_int16x16& b) -{ - v_uint32x8 l, h; - v_expand(v_reinterpret_as_u16(v_sub_wrap(v_max(a, b), v_min(a, b))), l, h); - return v_reduce_sum(l + h); -} -inline unsigned v_reduce_sad(const v_uint32x8& a, const v_uint32x8& b) -{ - return v_reduce_sum(v_max(a, b) - v_min(a, b)); -} -inline unsigned v_reduce_sad(const v_int32x8& a, const v_int32x8& b) -{ - v_int32x8 m = a < b; - return v_reduce_sum(v_reinterpret_as_u32(((a - b) ^ m) - m)); -} -inline float v_reduce_sad(const v_float32x8& a, const v_float32x8& b) -{ - return v_reduce_sum((a - b) & v_float32x8(_mm256_castsi256_ps(_mm256_set1_epi32(0x7fffffff)))); -} - -/** Popcount **/ -#define OPENCV_HAL_IMPL_AVX_POPCOUNT(_Tpvec) \ - inline v_uint32x8 v_popcount(const _Tpvec& a) \ - { \ - const v_uint32x8 m1 = v256_setall_u32(0x55555555); \ - const v_uint32x8 m2 = v256_setall_u32(0x33333333); \ - const v_uint32x8 m4 = v256_setall_u32(0x0f0f0f0f); \ - v_uint32x8 p = v_reinterpret_as_u32(a); \ - p = ((p >> 1) & m1) + (p & m1); \ - p = ((p >> 2) & m2) + (p & m2); \ - p = ((p >> 4) & m4) + (p & m4); \ - p.val = _mm256_sad_epu8(p.val, _mm256_setzero_si256()); \ - return p; \ - } - -OPENCV_HAL_IMPL_AVX_POPCOUNT(v_uint8x32) -OPENCV_HAL_IMPL_AVX_POPCOUNT(v_int8x32) -OPENCV_HAL_IMPL_AVX_POPCOUNT(v_uint16x16) -OPENCV_HAL_IMPL_AVX_POPCOUNT(v_int16x16) -OPENCV_HAL_IMPL_AVX_POPCOUNT(v_uint32x8) -OPENCV_HAL_IMPL_AVX_POPCOUNT(v_int32x8) - -/** Mask **/ -inline int v_signmask(const v_int8x32& a) -{ return _mm256_movemask_epi8(a.val); } -inline int v_signmask(const v_uint8x32& a) -{ return v_signmask(v_reinterpret_as_s8(a)); } - -inline int v_signmask(const v_int16x16& a) -{ - v_int8x32 v = v_int8x32(_mm256_packs_epi16(a.val, a.val)); - return v_signmask(v) & 255; -} -inline int v_signmask(const v_uint16x16& a) -{ return v_signmask(v_reinterpret_as_s16(a)); } - -inline int v_signmask(const v_int32x8& a) -{ - __m256i a16 = _mm256_packs_epi32(a.val, a.val); - v_int8x32 v = v_int8x32(_mm256_packs_epi16(a16, a16)); - return v_signmask(v) & 15; -} -inline int v_signmask(const v_uint32x8& a) -{ return v_signmask(v_reinterpret_as_s32(a)); } - -inline int v_signmask(const v_float32x8& a) -{ return _mm256_movemask_ps(a.val); } -inline int v_signmask(const v_float64x4& a) -{ return _mm256_movemask_pd(a.val); } - -/** Checks **/ -#define OPENCV_HAL_IMPL_AVX_CHECK(_Tpvec, and_op, allmask) \ - inline bool v_check_all(const _Tpvec& a) \ - { \ - int mask = v_signmask(v_reinterpret_as_s8(a)); \ - return and_op(mask, allmask) == allmask; \ - } \ - inline bool v_check_any(const _Tpvec& a) \ - { \ - int mask = v_signmask(v_reinterpret_as_s8(a)); \ - return and_op(mask, allmask) != 0; \ - } - -OPENCV_HAL_IMPL_AVX_CHECK(v_uint8x32, OPENCV_HAL_1ST, -1) -OPENCV_HAL_IMPL_AVX_CHECK(v_int8x32, OPENCV_HAL_1ST, -1) -OPENCV_HAL_IMPL_AVX_CHECK(v_uint16x16, OPENCV_HAL_AND, (int)0xaaaa) -OPENCV_HAL_IMPL_AVX_CHECK(v_int16x16, OPENCV_HAL_AND, (int)0xaaaa) -OPENCV_HAL_IMPL_AVX_CHECK(v_uint32x8, OPENCV_HAL_AND, (int)0x8888) -OPENCV_HAL_IMPL_AVX_CHECK(v_int32x8, OPENCV_HAL_AND, (int)0x8888) - -#define OPENCV_HAL_IMPL_AVX_CHECK_FLT(_Tpvec, allmask) \ - inline bool v_check_all(const _Tpvec& a) \ - { \ - int mask = v_signmask(a); \ - return mask == allmask; \ - } \ - inline bool v_check_any(const _Tpvec& a) \ - { \ - int mask = v_signmask(a); \ - return mask != 0; \ - } - -OPENCV_HAL_IMPL_AVX_CHECK_FLT(v_float32x8, 255) -OPENCV_HAL_IMPL_AVX_CHECK_FLT(v_float64x4, 15) - - -////////// Other math ///////// - -/** Some frequent operations **/ -#define OPENCV_HAL_IMPL_AVX_MULADD(_Tpvec, suffix) \ - inline _Tpvec v_fma(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \ - { return _Tpvec(_mm256_fmadd_##suffix(a.val, b.val, c.val)); } \ - inline _Tpvec v_muladd(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \ - { return _Tpvec(_mm256_fmadd_##suffix(a.val, b.val, c.val)); } \ - inline _Tpvec v_sqrt(const _Tpvec& x) \ - { return _Tpvec(_mm256_sqrt_##suffix(x.val)); } \ - inline _Tpvec v_sqr_magnitude(const _Tpvec& a, const _Tpvec& b) \ - { return v_fma(a, a, b * b); } \ - inline _Tpvec v_magnitude(const _Tpvec& a, const _Tpvec& b) \ - { return v_sqrt(v_fma(a, a, b*b)); } - -OPENCV_HAL_IMPL_AVX_MULADD(v_float32x8, ps) -OPENCV_HAL_IMPL_AVX_MULADD(v_float64x4, pd) - -inline v_int32x8 v_fma(const v_int32x8& a, const v_int32x8& b, const v_int32x8& c) -{ - return a * b + c; -} - -inline v_int32x8 v_muladd(const v_int32x8& a, const v_int32x8& b, const v_int32x8& c) -{ - return v_fma(a, b, c); -} - -inline v_float32x8 v_invsqrt(const v_float32x8& x) -{ - v_float32x8 half = x * v256_setall_f32(0.5); - v_float32x8 t = v_float32x8(_mm256_rsqrt_ps(x.val)); - // todo: _mm256_fnmsub_ps - t *= v256_setall_f32(1.5) - ((t * t) * half); - return t; -} - -inline v_float64x4 v_invsqrt(const v_float64x4& x) -{ - return v256_setall_f64(1.) / v_sqrt(x); -} - -/** Absolute values **/ -#define OPENCV_HAL_IMPL_AVX_ABS(_Tpvec, suffix) \ - inline v_u##_Tpvec v_abs(const v_##_Tpvec& x) \ - { return v_u##_Tpvec(_mm256_abs_##suffix(x.val)); } - -OPENCV_HAL_IMPL_AVX_ABS(int8x32, epi8) -OPENCV_HAL_IMPL_AVX_ABS(int16x16, epi16) -OPENCV_HAL_IMPL_AVX_ABS(int32x8, epi32) - -inline v_float32x8 v_abs(const v_float32x8& x) -{ return x & v_float32x8(_mm256_castsi256_ps(_mm256_set1_epi32(0x7fffffff))); } -inline v_float64x4 v_abs(const v_float64x4& x) -{ return x & v_float64x4(_mm256_castsi256_pd(_mm256_srli_epi64(_mm256_set1_epi64x(-1), 1))); } - -/** Absolute difference **/ -inline v_uint8x32 v_absdiff(const v_uint8x32& a, const v_uint8x32& b) -{ return v_add_wrap(a - b, b - a); } -inline v_uint16x16 v_absdiff(const v_uint16x16& a, const v_uint16x16& b) -{ return v_add_wrap(a - b, b - a); } -inline v_uint32x8 v_absdiff(const v_uint32x8& a, const v_uint32x8& b) -{ return v_max(a, b) - v_min(a, b); } - -inline v_uint8x32 v_absdiff(const v_int8x32& a, const v_int8x32& b) -{ - v_int8x32 d = v_sub_wrap(a, b); - v_int8x32 m = a < b; - return v_reinterpret_as_u8(v_sub_wrap(d ^ m, m)); -} - -inline v_uint16x16 v_absdiff(const v_int16x16& a, const v_int16x16& b) -{ return v_reinterpret_as_u16(v_sub_wrap(v_max(a, b), v_min(a, b))); } - -inline v_uint32x8 v_absdiff(const v_int32x8& a, const v_int32x8& b) -{ - v_int32x8 d = a - b; - v_int32x8 m = a < b; - return v_reinterpret_as_u32((d ^ m) - m); -} - -inline v_float32x8 v_absdiff(const v_float32x8& a, const v_float32x8& b) -{ return v_abs(a - b); } - -inline v_float64x4 v_absdiff(const v_float64x4& a, const v_float64x4& b) -{ return v_abs(a - b); } - -/** Saturating absolute difference **/ -inline v_int8x32 v_absdiffs(const v_int8x32& a, const v_int8x32& b) -{ - v_int8x32 d = a - b; - v_int8x32 m = a < b; - return (d ^ m) - m; -} -inline v_int16x16 v_absdiffs(const v_int16x16& a, const v_int16x16& b) -{ return v_max(a, b) - v_min(a, b); } - -////////// Conversions ///////// - -/** Rounding **/ -inline v_int32x8 v_round(const v_float32x8& a) -{ return v_int32x8(_mm256_cvtps_epi32(a.val)); } - -inline v_int32x8 v_round(const v_float64x4& a) -{ return v_int32x8(_mm256_castsi128_si256(_mm256_cvtpd_epi32(a.val))); } - -inline v_int32x8 v_round(const v_float64x4& a, const v_float64x4& b) -{ - __m128i ai = _mm256_cvtpd_epi32(a.val), bi = _mm256_cvtpd_epi32(b.val); - return v_int32x8(_v256_combine(ai, bi)); -} - -inline v_int32x8 v_trunc(const v_float32x8& a) -{ return v_int32x8(_mm256_cvttps_epi32(a.val)); } - -inline v_int32x8 v_trunc(const v_float64x4& a) -{ return v_int32x8(_mm256_castsi128_si256(_mm256_cvttpd_epi32(a.val))); } - -inline v_int32x8 v_floor(const v_float32x8& a) -{ return v_int32x8(_mm256_cvttps_epi32(_mm256_floor_ps(a.val))); } - -inline v_int32x8 v_floor(const v_float64x4& a) -{ return v_trunc(v_float64x4(_mm256_floor_pd(a.val))); } - -inline v_int32x8 v_ceil(const v_float32x8& a) -{ return v_int32x8(_mm256_cvttps_epi32(_mm256_ceil_ps(a.val))); } - -inline v_int32x8 v_ceil(const v_float64x4& a) -{ return v_trunc(v_float64x4(_mm256_ceil_pd(a.val))); } - -/** To float **/ -inline v_float32x8 v_cvt_f32(const v_int32x8& a) -{ return v_float32x8(_mm256_cvtepi32_ps(a.val)); } - -inline v_float32x8 v_cvt_f32(const v_float64x4& a) -{ return v_float32x8(_mm256_castps128_ps256(_mm256_cvtpd_ps(a.val))); } - -inline v_float32x8 v_cvt_f32(const v_float64x4& a, const v_float64x4& b) -{ - __m128 af = _mm256_cvtpd_ps(a.val), bf = _mm256_cvtpd_ps(b.val); - return v_float32x8(_mm256_insertf128_ps(_mm256_castps128_ps256(af), bf, 1)); -} - -inline v_float64x4 v_cvt_f64(const v_int32x8& a) -{ return v_float64x4(_mm256_cvtepi32_pd(_v256_extract_low(a.val))); } - -inline v_float64x4 v_cvt_f64_high(const v_int32x8& a) -{ return v_float64x4(_mm256_cvtepi32_pd(_v256_extract_high(a.val))); } - -inline v_float64x4 v_cvt_f64(const v_float32x8& a) -{ return v_float64x4(_mm256_cvtps_pd(_v256_extract_low(a.val))); } - -inline v_float64x4 v_cvt_f64_high(const v_float32x8& a) -{ return v_float64x4(_mm256_cvtps_pd(_v256_extract_high(a.val))); } - -////////////// Lookup table access //////////////////// - -inline v_int8x32 v256_lut(const schar* tab, const int* idx) -{ - return v_int8x32(_mm256_setr_epi8(tab[idx[ 0]], tab[idx[ 1]], tab[idx[ 2]], tab[idx[ 3]], tab[idx[ 4]], tab[idx[ 5]], tab[idx[ 6]], tab[idx[ 7]], - tab[idx[ 8]], tab[idx[ 9]], tab[idx[10]], tab[idx[11]], tab[idx[12]], tab[idx[13]], tab[idx[14]], tab[idx[15]], - tab[idx[16]], tab[idx[17]], tab[idx[18]], tab[idx[19]], tab[idx[20]], tab[idx[21]], tab[idx[22]], tab[idx[23]], - tab[idx[24]], tab[idx[25]], tab[idx[26]], tab[idx[27]], tab[idx[28]], tab[idx[29]], tab[idx[30]], tab[idx[31]])); -} -inline v_int8x32 v256_lut_pairs(const schar* tab, const int* idx) -{ - return v_int8x32(_mm256_setr_epi16(*(const short*)(tab + idx[ 0]), *(const short*)(tab + idx[ 1]), *(const short*)(tab + idx[ 2]), *(const short*)(tab + idx[ 3]), - *(const short*)(tab + idx[ 4]), *(const short*)(tab + idx[ 5]), *(const short*)(tab + idx[ 6]), *(const short*)(tab + idx[ 7]), - *(const short*)(tab + idx[ 8]), *(const short*)(tab + idx[ 9]), *(const short*)(tab + idx[10]), *(const short*)(tab + idx[11]), - *(const short*)(tab + idx[12]), *(const short*)(tab + idx[13]), *(const short*)(tab + idx[14]), *(const short*)(tab + idx[15]))); -} -inline v_int8x32 v256_lut_quads(const schar* tab, const int* idx) -{ - return v_int8x32(_mm256_i32gather_epi32((const int*)tab, _mm256_loadu_si256((const __m256i*)idx), 1)); -} -inline v_uint8x32 v256_lut(const uchar* tab, const int* idx) { return v_reinterpret_as_u8(v256_lut((const schar *)tab, idx)); } -inline v_uint8x32 v256_lut_pairs(const uchar* tab, const int* idx) { return v_reinterpret_as_u8(v256_lut_pairs((const schar *)tab, idx)); } -inline v_uint8x32 v256_lut_quads(const uchar* tab, const int* idx) { return v_reinterpret_as_u8(v256_lut_quads((const schar *)tab, idx)); } - -inline v_int16x16 v256_lut(const short* tab, const int* idx) -{ - return v_int16x16(_mm256_setr_epi16(tab[idx[0]], tab[idx[1]], tab[idx[ 2]], tab[idx[ 3]], tab[idx[ 4]], tab[idx[ 5]], tab[idx[ 6]], tab[idx[ 7]], - tab[idx[8]], tab[idx[9]], tab[idx[10]], tab[idx[11]], tab[idx[12]], tab[idx[13]], tab[idx[14]], tab[idx[15]])); -} -inline v_int16x16 v256_lut_pairs(const short* tab, const int* idx) -{ - return v_int16x16(_mm256_i32gather_epi32((const int*)tab, _mm256_loadu_si256((const __m256i*)idx), 2)); -} -inline v_int16x16 v256_lut_quads(const short* tab, const int* idx) -{ -#if defined(__GNUC__) - return v_int16x16(_mm256_i32gather_epi64((const long long int*)tab, _mm_loadu_si128((const __m128i*)idx), 2));//Looks like intrinsic has wrong definition -#else - return v_int16x16(_mm256_i32gather_epi64((const int64*)tab, _mm_loadu_si128((const __m128i*)idx), 2)); -#endif -} -inline v_uint16x16 v256_lut(const ushort* tab, const int* idx) { return v_reinterpret_as_u16(v256_lut((const short *)tab, idx)); } -inline v_uint16x16 v256_lut_pairs(const ushort* tab, const int* idx) { return v_reinterpret_as_u16(v256_lut_pairs((const short *)tab, idx)); } -inline v_uint16x16 v256_lut_quads(const ushort* tab, const int* idx) { return v_reinterpret_as_u16(v256_lut_quads((const short *)tab, idx)); } - -inline v_int32x8 v256_lut(const int* tab, const int* idx) -{ - return v_int32x8(_mm256_i32gather_epi32(tab, _mm256_loadu_si256((const __m256i*)idx), 4)); -} -inline v_int32x8 v256_lut_pairs(const int* tab, const int* idx) -{ -#if defined(__GNUC__) - return v_int32x8(_mm256_i32gather_epi64((const long long int*)tab, _mm_loadu_si128((const __m128i*)idx), 4)); -#else - return v_int32x8(_mm256_i32gather_epi64((const int64*)tab, _mm_loadu_si128((const __m128i*)idx), 4)); -#endif -} -inline v_int32x8 v256_lut_quads(const int* tab, const int* idx) -{ - return v_int32x8(_mm256_insertf128_si256(_mm256_castsi128_si256(_mm_loadu_si128((const __m128i*)(tab + idx[0]))), _mm_loadu_si128((const __m128i*)(tab + idx[1])), 0x1)); -} -inline v_uint32x8 v256_lut(const unsigned* tab, const int* idx) { return v_reinterpret_as_u32(v256_lut((const int *)tab, idx)); } -inline v_uint32x8 v256_lut_pairs(const unsigned* tab, const int* idx) { return v_reinterpret_as_u32(v256_lut_pairs((const int *)tab, idx)); } -inline v_uint32x8 v256_lut_quads(const unsigned* tab, const int* idx) { return v_reinterpret_as_u32(v256_lut_quads((const int *)tab, idx)); } - -inline v_int64x4 v256_lut(const int64* tab, const int* idx) -{ -#if defined(__GNUC__) - return v_int64x4(_mm256_i32gather_epi64((const long long int*)tab, _mm_loadu_si128((const __m128i*)idx), 8)); -#else - return v_int64x4(_mm256_i32gather_epi64(tab, _mm_loadu_si128((const __m128i*)idx), 8)); -#endif -} -inline v_int64x4 v256_lut_pairs(const int64* tab, const int* idx) -{ - return v_int64x4(_mm256_insertf128_si256(_mm256_castsi128_si256(_mm_loadu_si128((const __m128i*)(tab + idx[0]))), _mm_loadu_si128((const __m128i*)(tab + idx[1])), 0x1)); -} -inline v_uint64x4 v256_lut(const uint64* tab, const int* idx) { return v_reinterpret_as_u64(v256_lut((const int64 *)tab, idx)); } -inline v_uint64x4 v256_lut_pairs(const uint64* tab, const int* idx) { return v_reinterpret_as_u64(v256_lut_pairs((const int64 *)tab, idx)); } - -inline v_float32x8 v256_lut(const float* tab, const int* idx) -{ - return v_float32x8(_mm256_i32gather_ps(tab, _mm256_loadu_si256((const __m256i*)idx), 4)); -} -inline v_float32x8 v256_lut_pairs(const float* tab, const int* idx) { return v_reinterpret_as_f32(v256_lut_pairs((const int *)tab, idx)); } -inline v_float32x8 v256_lut_quads(const float* tab, const int* idx) { return v_reinterpret_as_f32(v256_lut_quads((const int *)tab, idx)); } - -inline v_float64x4 v256_lut(const double* tab, const int* idx) -{ - return v_float64x4(_mm256_i32gather_pd(tab, _mm_loadu_si128((const __m128i*)idx), 8)); -} -inline v_float64x4 v256_lut_pairs(const double* tab, const int* idx) { return v_float64x4(_mm256_insertf128_pd(_mm256_castpd128_pd256(_mm_loadu_pd(tab + idx[0])), _mm_loadu_pd(tab + idx[1]), 0x1)); } - -inline v_int32x8 v_lut(const int* tab, const v_int32x8& idxvec) -{ - return v_int32x8(_mm256_i32gather_epi32(tab, idxvec.val, 4)); -} - -inline v_uint32x8 v_lut(const unsigned* tab, const v_int32x8& idxvec) -{ - return v_reinterpret_as_u32(v_lut((const int *)tab, idxvec)); -} - -inline v_float32x8 v_lut(const float* tab, const v_int32x8& idxvec) -{ - return v_float32x8(_mm256_i32gather_ps(tab, idxvec.val, 4)); -} - -inline v_float64x4 v_lut(const double* tab, const v_int32x8& idxvec) -{ - return v_float64x4(_mm256_i32gather_pd(tab, _mm256_castsi256_si128(idxvec.val), 8)); -} - -inline void v_lut_deinterleave(const float* tab, const v_int32x8& idxvec, v_float32x8& x, v_float32x8& y) -{ - int CV_DECL_ALIGNED(32) idx[8]; - v_store_aligned(idx, idxvec); - __m128 z = _mm_setzero_ps(); - __m128 xy01, xy45, xy23, xy67; - xy01 = _mm_loadl_pi(z, (const __m64*)(tab + idx[0])); - xy01 = _mm_loadh_pi(xy01, (const __m64*)(tab + idx[1])); - xy45 = _mm_loadl_pi(z, (const __m64*)(tab + idx[4])); - xy45 = _mm_loadh_pi(xy45, (const __m64*)(tab + idx[5])); - __m256 xy0145 = _v256_combine(xy01, xy45); - xy23 = _mm_loadl_pi(z, (const __m64*)(tab + idx[2])); - xy23 = _mm_loadh_pi(xy23, (const __m64*)(tab + idx[3])); - xy67 = _mm_loadl_pi(z, (const __m64*)(tab + idx[6])); - xy67 = _mm_loadh_pi(xy67, (const __m64*)(tab + idx[7])); - __m256 xy2367 = _v256_combine(xy23, xy67); - - __m256 xxyy0145 = _mm256_unpacklo_ps(xy0145, xy2367); - __m256 xxyy2367 = _mm256_unpackhi_ps(xy0145, xy2367); - - x = v_float32x8(_mm256_unpacklo_ps(xxyy0145, xxyy2367)); - y = v_float32x8(_mm256_unpackhi_ps(xxyy0145, xxyy2367)); -} - -inline void v_lut_deinterleave(const double* tab, const v_int32x8& idxvec, v_float64x4& x, v_float64x4& y) -{ - int CV_DECL_ALIGNED(32) idx[4]; - v_store_low(idx, idxvec); - __m128d xy0 = _mm_loadu_pd(tab + idx[0]); - __m128d xy2 = _mm_loadu_pd(tab + idx[2]); - __m128d xy1 = _mm_loadu_pd(tab + idx[1]); - __m128d xy3 = _mm_loadu_pd(tab + idx[3]); - __m256d xy02 = _v256_combine(xy0, xy2); - __m256d xy13 = _v256_combine(xy1, xy3); - - x = v_float64x4(_mm256_unpacklo_pd(xy02, xy13)); - y = v_float64x4(_mm256_unpackhi_pd(xy02, xy13)); -} - -inline v_int8x32 v_interleave_pairs(const v_int8x32& vec) -{ - return v_int8x32(_mm256_shuffle_epi8(vec.val, _mm256_set_epi64x(0x0f0d0e0c0b090a08, 0x0705060403010200, 0x0f0d0e0c0b090a08, 0x0705060403010200))); -} -inline v_uint8x32 v_interleave_pairs(const v_uint8x32& vec) { return v_reinterpret_as_u8(v_interleave_pairs(v_reinterpret_as_s8(vec))); } -inline v_int8x32 v_interleave_quads(const v_int8x32& vec) -{ - return v_int8x32(_mm256_shuffle_epi8(vec.val, _mm256_set_epi64x(0x0f0b0e0a0d090c08, 0x0703060205010400, 0x0f0b0e0a0d090c08, 0x0703060205010400))); -} -inline v_uint8x32 v_interleave_quads(const v_uint8x32& vec) { return v_reinterpret_as_u8(v_interleave_quads(v_reinterpret_as_s8(vec))); } - -inline v_int16x16 v_interleave_pairs(const v_int16x16& vec) -{ - return v_int16x16(_mm256_shuffle_epi8(vec.val, _mm256_set_epi64x(0x0f0e0b0a0d0c0908, 0x0706030205040100, 0x0f0e0b0a0d0c0908, 0x0706030205040100))); -} -inline v_uint16x16 v_interleave_pairs(const v_uint16x16& vec) { return v_reinterpret_as_u16(v_interleave_pairs(v_reinterpret_as_s16(vec))); } -inline v_int16x16 v_interleave_quads(const v_int16x16& vec) -{ - return v_int16x16(_mm256_shuffle_epi8(vec.val, _mm256_set_epi64x(0x0f0e07060d0c0504, 0x0b0a030209080100, 0x0f0e07060d0c0504, 0x0b0a030209080100))); -} -inline v_uint16x16 v_interleave_quads(const v_uint16x16& vec) { return v_reinterpret_as_u16(v_interleave_quads(v_reinterpret_as_s16(vec))); } - -inline v_int32x8 v_interleave_pairs(const v_int32x8& vec) -{ - return v_int32x8(_mm256_shuffle_epi32(vec.val, _MM_SHUFFLE(3, 1, 2, 0))); -} -inline v_uint32x8 v_interleave_pairs(const v_uint32x8& vec) { return v_reinterpret_as_u32(v_interleave_pairs(v_reinterpret_as_s32(vec))); } -inline v_float32x8 v_interleave_pairs(const v_float32x8& vec) { return v_reinterpret_as_f32(v_interleave_pairs(v_reinterpret_as_s32(vec))); } - -inline v_int8x32 v_pack_triplets(const v_int8x32& vec) -{ - return v_int8x32(_mm256_permutevar8x32_epi32(_mm256_shuffle_epi8(vec.val, _mm256_broadcastsi128_si256(_mm_set_epi64x(0xffffff0f0e0d0c0a, 0x0908060504020100))), - _mm256_set_epi64x(0x0000000700000007, 0x0000000600000005, 0x0000000400000002, 0x0000000100000000))); -} -inline v_uint8x32 v_pack_triplets(const v_uint8x32& vec) { return v_reinterpret_as_u8(v_pack_triplets(v_reinterpret_as_s8(vec))); } - -inline v_int16x16 v_pack_triplets(const v_int16x16& vec) -{ - return v_int16x16(_mm256_permutevar8x32_epi32(_mm256_shuffle_epi8(vec.val, _mm256_broadcastsi128_si256(_mm_set_epi64x(0xffff0f0e0d0c0b0a, 0x0908050403020100))), - _mm256_set_epi64x(0x0000000700000007, 0x0000000600000005, 0x0000000400000002, 0x0000000100000000))); -} -inline v_uint16x16 v_pack_triplets(const v_uint16x16& vec) { return v_reinterpret_as_u16(v_pack_triplets(v_reinterpret_as_s16(vec))); } - -inline v_int32x8 v_pack_triplets(const v_int32x8& vec) -{ - return v_int32x8(_mm256_permutevar8x32_epi32(vec.val, _mm256_set_epi64x(0x0000000700000007, 0x0000000600000005, 0x0000000400000002, 0x0000000100000000))); -} -inline v_uint32x8 v_pack_triplets(const v_uint32x8& vec) { return v_reinterpret_as_u32(v_pack_triplets(v_reinterpret_as_s32(vec))); } -inline v_float32x8 v_pack_triplets(const v_float32x8& vec) -{ - return v_float32x8(_mm256_permutevar8x32_ps(vec.val, _mm256_set_epi64x(0x0000000700000007, 0x0000000600000005, 0x0000000400000002, 0x0000000100000000))); -} - -////////// Matrix operations ///////// - -inline v_int32x8 v_dotprod(const v_int16x16& a, const v_int16x16& b) -{ return v_int32x8(_mm256_madd_epi16(a.val, b.val)); } - -inline v_int32x8 v_dotprod(const v_int16x16& a, const v_int16x16& b, const v_int32x8& c) -{ return v_dotprod(a, b) + c; } - -#define OPENCV_HAL_AVX_SPLAT2_PS(a, im) \ - v_float32x8(_mm256_permute_ps(a.val, _MM_SHUFFLE(im, im, im, im))) - -inline v_float32x8 v_matmul(const v_float32x8& v, const v_float32x8& m0, - const v_float32x8& m1, const v_float32x8& m2, - const v_float32x8& m3) -{ - v_float32x8 v04 = OPENCV_HAL_AVX_SPLAT2_PS(v, 0); - v_float32x8 v15 = OPENCV_HAL_AVX_SPLAT2_PS(v, 1); - v_float32x8 v26 = OPENCV_HAL_AVX_SPLAT2_PS(v, 2); - v_float32x8 v37 = OPENCV_HAL_AVX_SPLAT2_PS(v, 3); - return v_fma(v04, m0, v_fma(v15, m1, v_fma(v26, m2, v37 * m3))); -} - -inline v_float32x8 v_matmuladd(const v_float32x8& v, const v_float32x8& m0, - const v_float32x8& m1, const v_float32x8& m2, - const v_float32x8& a) -{ - v_float32x8 v04 = OPENCV_HAL_AVX_SPLAT2_PS(v, 0); - v_float32x8 v15 = OPENCV_HAL_AVX_SPLAT2_PS(v, 1); - v_float32x8 v26 = OPENCV_HAL_AVX_SPLAT2_PS(v, 2); - return v_fma(v04, m0, v_fma(v15, m1, v_fma(v26, m2, a))); -} - -#define OPENCV_HAL_IMPL_AVX_TRANSPOSE4x4(_Tpvec, suffix, cast_from, cast_to) \ - inline void v_transpose4x4(const _Tpvec& a0, const _Tpvec& a1, \ - const _Tpvec& a2, const _Tpvec& a3, \ - _Tpvec& b0, _Tpvec& b1, _Tpvec& b2, _Tpvec& b3) \ - { \ - __m256i t0 = cast_from(_mm256_unpacklo_##suffix(a0.val, a1.val)); \ - __m256i t1 = cast_from(_mm256_unpacklo_##suffix(a2.val, a3.val)); \ - __m256i t2 = cast_from(_mm256_unpackhi_##suffix(a0.val, a1.val)); \ - __m256i t3 = cast_from(_mm256_unpackhi_##suffix(a2.val, a3.val)); \ - b0.val = cast_to(_mm256_unpacklo_epi64(t0, t1)); \ - b1.val = cast_to(_mm256_unpackhi_epi64(t0, t1)); \ - b2.val = cast_to(_mm256_unpacklo_epi64(t2, t3)); \ - b3.val = cast_to(_mm256_unpackhi_epi64(t2, t3)); \ - } - -OPENCV_HAL_IMPL_AVX_TRANSPOSE4x4(v_uint32x8, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_AVX_TRANSPOSE4x4(v_int32x8, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_AVX_TRANSPOSE4x4(v_float32x8, ps, _mm256_castps_si256, _mm256_castsi256_ps) - -//////////////// Value reordering /////////////// - -/* Expand */ -#define OPENCV_HAL_IMPL_AVX_EXPAND(_Tpvec, _Tpwvec, _Tp, intrin) \ - inline void v_expand(const _Tpvec& a, _Tpwvec& b0, _Tpwvec& b1) \ - { \ - b0.val = intrin(_v256_extract_low(a.val)); \ - b1.val = intrin(_v256_extract_high(a.val)); \ - } \ - inline _Tpwvec v_expand_low(const _Tpvec& a) \ - { return _Tpwvec(intrin(_v256_extract_low(a.val))); } \ - inline _Tpwvec v_expand_high(const _Tpvec& a) \ - { return _Tpwvec(intrin(_v256_extract_high(a.val))); } \ - inline _Tpwvec v256_load_expand(const _Tp* ptr) \ - { \ - __m128i a = _mm_loadu_si128((const __m128i*)ptr); \ - return _Tpwvec(intrin(a)); \ - } - -OPENCV_HAL_IMPL_AVX_EXPAND(v_uint8x32, v_uint16x16, uchar, _mm256_cvtepu8_epi16) -OPENCV_HAL_IMPL_AVX_EXPAND(v_int8x32, v_int16x16, schar, _mm256_cvtepi8_epi16) -OPENCV_HAL_IMPL_AVX_EXPAND(v_uint16x16, v_uint32x8, ushort, _mm256_cvtepu16_epi32) -OPENCV_HAL_IMPL_AVX_EXPAND(v_int16x16, v_int32x8, short, _mm256_cvtepi16_epi32) -OPENCV_HAL_IMPL_AVX_EXPAND(v_uint32x8, v_uint64x4, unsigned, _mm256_cvtepu32_epi64) -OPENCV_HAL_IMPL_AVX_EXPAND(v_int32x8, v_int64x4, int, _mm256_cvtepi32_epi64) - -#define OPENCV_HAL_IMPL_AVX_EXPAND_Q(_Tpvec, _Tp, intrin) \ - inline _Tpvec v256_load_expand_q(const _Tp* ptr) \ - { \ - __m128i a = _mm_loadl_epi64((const __m128i*)ptr); \ - return _Tpvec(intrin(a)); \ - } - -OPENCV_HAL_IMPL_AVX_EXPAND_Q(v_uint32x8, uchar, _mm256_cvtepu8_epi32) -OPENCV_HAL_IMPL_AVX_EXPAND_Q(v_int32x8, schar, _mm256_cvtepi8_epi32) - -/* pack */ -// 16 -inline v_int8x32 v_pack(const v_int16x16& a, const v_int16x16& b) -{ return v_int8x32(_v256_shuffle_odd_64(_mm256_packs_epi16(a.val, b.val))); } - -inline v_uint8x32 v_pack(const v_uint16x16& a, const v_uint16x16& b) -{ - __m256i t = _mm256_set1_epi16(255); - __m256i a1 = _mm256_min_epu16(a.val, t); - __m256i b1 = _mm256_min_epu16(b.val, t); - return v_uint8x32(_v256_shuffle_odd_64(_mm256_packus_epi16(a1, b1))); -} - -inline v_uint8x32 v_pack_u(const v_int16x16& a, const v_int16x16& b) -{ - return v_uint8x32(_v256_shuffle_odd_64(_mm256_packus_epi16(a.val, b.val))); -} - -inline void v_pack_store(schar* ptr, const v_int16x16& a) -{ v_store_low(ptr, v_pack(a, a)); } - -inline void v_pack_store(uchar* ptr, const v_uint16x16& a) -{ - const __m256i m = _mm256_set1_epi16(255); - __m256i am = _mm256_min_epu16(a.val, m); - am = _v256_shuffle_odd_64(_mm256_packus_epi16(am, am)); - v_store_low(ptr, v_uint8x32(am)); -} - -inline void v_pack_u_store(uchar* ptr, const v_int16x16& a) -{ v_store_low(ptr, v_pack_u(a, a)); } - -template inline -v_uint8x32 v_rshr_pack(const v_uint16x16& a, const v_uint16x16& b) -{ - // we assume that n > 0, and so the shifted 16-bit values can be treated as signed numbers. - v_uint16x16 delta = v256_setall_u16((short)(1 << (n-1))); - return v_pack_u(v_reinterpret_as_s16((a + delta) >> n), - v_reinterpret_as_s16((b + delta) >> n)); -} - -template inline -void v_rshr_pack_store(uchar* ptr, const v_uint16x16& a) -{ - v_uint16x16 delta = v256_setall_u16((short)(1 << (n-1))); - v_pack_u_store(ptr, v_reinterpret_as_s16((a + delta) >> n)); -} - -template inline -v_uint8x32 v_rshr_pack_u(const v_int16x16& a, const v_int16x16& b) -{ - v_int16x16 delta = v256_setall_s16((short)(1 << (n-1))); - return v_pack_u((a + delta) >> n, (b + delta) >> n); -} - -template inline -void v_rshr_pack_u_store(uchar* ptr, const v_int16x16& a) -{ - v_int16x16 delta = v256_setall_s16((short)(1 << (n-1))); - v_pack_u_store(ptr, (a + delta) >> n); -} - -template inline -v_int8x32 v_rshr_pack(const v_int16x16& a, const v_int16x16& b) -{ - v_int16x16 delta = v256_setall_s16((short)(1 << (n-1))); - return v_pack((a + delta) >> n, (b + delta) >> n); -} - -template inline -void v_rshr_pack_store(schar* ptr, const v_int16x16& a) -{ - v_int16x16 delta = v256_setall_s16((short)(1 << (n-1))); - v_pack_store(ptr, (a + delta) >> n); -} - -// 32 -inline v_int16x16 v_pack(const v_int32x8& a, const v_int32x8& b) -{ return v_int16x16(_v256_shuffle_odd_64(_mm256_packs_epi32(a.val, b.val))); } - -inline v_uint16x16 v_pack(const v_uint32x8& a, const v_uint32x8& b) -{ return v_uint16x16(_v256_shuffle_odd_64(_v256_packs_epu32(a.val, b.val))); } - -inline v_uint16x16 v_pack_u(const v_int32x8& a, const v_int32x8& b) -{ return v_uint16x16(_v256_shuffle_odd_64(_mm256_packus_epi32(a.val, b.val))); } - -inline void v_pack_store(short* ptr, const v_int32x8& a) -{ v_store_low(ptr, v_pack(a, a)); } - -inline void v_pack_store(ushort* ptr, const v_uint32x8& a) -{ - const __m256i m = _mm256_set1_epi32(65535); - __m256i am = _mm256_min_epu32(a.val, m); - am = _v256_shuffle_odd_64(_mm256_packus_epi32(am, am)); - v_store_low(ptr, v_uint16x16(am)); -} - -inline void v_pack_u_store(ushort* ptr, const v_int32x8& a) -{ v_store_low(ptr, v_pack_u(a, a)); } - - -template inline -v_uint16x16 v_rshr_pack(const v_uint32x8& a, const v_uint32x8& b) -{ - // we assume that n > 0, and so the shifted 32-bit values can be treated as signed numbers. - v_uint32x8 delta = v256_setall_u32(1 << (n-1)); - return v_pack_u(v_reinterpret_as_s32((a + delta) >> n), - v_reinterpret_as_s32((b + delta) >> n)); -} - -template inline -void v_rshr_pack_store(ushort* ptr, const v_uint32x8& a) -{ - v_uint32x8 delta = v256_setall_u32(1 << (n-1)); - v_pack_u_store(ptr, v_reinterpret_as_s32((a + delta) >> n)); -} - -template inline -v_uint16x16 v_rshr_pack_u(const v_int32x8& a, const v_int32x8& b) -{ - v_int32x8 delta = v256_setall_s32(1 << (n-1)); - return v_pack_u((a + delta) >> n, (b + delta) >> n); -} - -template inline -void v_rshr_pack_u_store(ushort* ptr, const v_int32x8& a) -{ - v_int32x8 delta = v256_setall_s32(1 << (n-1)); - v_pack_u_store(ptr, (a + delta) >> n); -} - -template inline -v_int16x16 v_rshr_pack(const v_int32x8& a, const v_int32x8& b) -{ - v_int32x8 delta = v256_setall_s32(1 << (n-1)); - return v_pack((a + delta) >> n, (b + delta) >> n); -} - -template inline -void v_rshr_pack_store(short* ptr, const v_int32x8& a) -{ - v_int32x8 delta = v256_setall_s32(1 << (n-1)); - v_pack_store(ptr, (a + delta) >> n); -} - -// 64 -// Non-saturating pack -inline v_uint32x8 v_pack(const v_uint64x4& a, const v_uint64x4& b) -{ - __m256i a0 = _mm256_shuffle_epi32(a.val, _MM_SHUFFLE(0, 0, 2, 0)); - __m256i b0 = _mm256_shuffle_epi32(b.val, _MM_SHUFFLE(0, 0, 2, 0)); - __m256i ab = _mm256_unpacklo_epi64(a0, b0); // a0, a1, b0, b1, a2, a3, b2, b3 - return v_uint32x8(_v256_shuffle_odd_64(ab)); -} - -inline v_int32x8 v_pack(const v_int64x4& a, const v_int64x4& b) -{ return v_reinterpret_as_s32(v_pack(v_reinterpret_as_u64(a), v_reinterpret_as_u64(b))); } - -inline void v_pack_store(unsigned* ptr, const v_uint64x4& a) -{ - __m256i a0 = _mm256_shuffle_epi32(a.val, _MM_SHUFFLE(0, 0, 2, 0)); - v_store_low(ptr, v_uint32x8(_v256_shuffle_odd_64(a0))); -} - -inline void v_pack_store(int* ptr, const v_int64x4& b) -{ v_pack_store((unsigned*)ptr, v_reinterpret_as_u64(b)); } - -template inline -v_uint32x8 v_rshr_pack(const v_uint64x4& a, const v_uint64x4& b) -{ - v_uint64x4 delta = v256_setall_u64((uint64)1 << (n-1)); - return v_pack((a + delta) >> n, (b + delta) >> n); -} - -template inline -void v_rshr_pack_store(unsigned* ptr, const v_uint64x4& a) -{ - v_uint64x4 delta = v256_setall_u64((uint64)1 << (n-1)); - v_pack_store(ptr, (a + delta) >> n); -} - -template inline -v_int32x8 v_rshr_pack(const v_int64x4& a, const v_int64x4& b) -{ - v_int64x4 delta = v256_setall_s64((int64)1 << (n-1)); - return v_pack((a + delta) >> n, (b + delta) >> n); -} - -template inline -void v_rshr_pack_store(int* ptr, const v_int64x4& a) -{ - v_int64x4 delta = v256_setall_s64((int64)1 << (n-1)); - v_pack_store(ptr, (a + delta) >> n); -} - -// pack boolean -inline v_uint8x32 v_pack_b(const v_uint16x16& a, const v_uint16x16& b) -{ - __m256i ab = _mm256_packs_epi16(a.val, b.val); - return v_uint8x32(_v256_shuffle_odd_64(ab)); -} - -inline v_uint8x32 v_pack_b(const v_uint32x8& a, const v_uint32x8& b, - const v_uint32x8& c, const v_uint32x8& d) -{ - __m256i ab = _mm256_packs_epi32(a.val, b.val); - __m256i cd = _mm256_packs_epi32(c.val, d.val); - - __m256i abcd = _v256_shuffle_odd_64(_mm256_packs_epi16(ab, cd)); - return v_uint8x32(_mm256_shuffle_epi32(abcd, _MM_SHUFFLE(3, 1, 2, 0))); -} - -inline v_uint8x32 v_pack_b(const v_uint64x4& a, const v_uint64x4& b, const v_uint64x4& c, - const v_uint64x4& d, const v_uint64x4& e, const v_uint64x4& f, - const v_uint64x4& g, const v_uint64x4& h) -{ - __m256i ab = _mm256_packs_epi32(a.val, b.val); - __m256i cd = _mm256_packs_epi32(c.val, d.val); - __m256i ef = _mm256_packs_epi32(e.val, f.val); - __m256i gh = _mm256_packs_epi32(g.val, h.val); - - __m256i abcd = _mm256_packs_epi32(ab, cd); - __m256i efgh = _mm256_packs_epi32(ef, gh); - __m256i pkall = _v256_shuffle_odd_64(_mm256_packs_epi16(abcd, efgh)); - - __m256i rev = _mm256_alignr_epi8(pkall, pkall, 8); - return v_uint8x32(_mm256_unpacklo_epi16(pkall, rev)); -} - -/* Recombine */ -// its up there with load and store operations - -/* Extract */ -#define OPENCV_HAL_IMPL_AVX_EXTRACT(_Tpvec) \ - template \ - inline _Tpvec v_extract(const _Tpvec& a, const _Tpvec& b) \ - { return v_rotate_right(a, b); } - -OPENCV_HAL_IMPL_AVX_EXTRACT(v_uint8x32) -OPENCV_HAL_IMPL_AVX_EXTRACT(v_int8x32) -OPENCV_HAL_IMPL_AVX_EXTRACT(v_uint16x16) -OPENCV_HAL_IMPL_AVX_EXTRACT(v_int16x16) -OPENCV_HAL_IMPL_AVX_EXTRACT(v_uint32x8) -OPENCV_HAL_IMPL_AVX_EXTRACT(v_int32x8) -OPENCV_HAL_IMPL_AVX_EXTRACT(v_uint64x4) -OPENCV_HAL_IMPL_AVX_EXTRACT(v_int64x4) -OPENCV_HAL_IMPL_AVX_EXTRACT(v_float32x8) -OPENCV_HAL_IMPL_AVX_EXTRACT(v_float64x4) - - -///////////////////// load deinterleave ///////////////////////////// - -inline void v_load_deinterleave( const uchar* ptr, v_uint8x32& a, v_uint8x32& b ) -{ - __m256i ab0 = _mm256_loadu_si256((const __m256i*)ptr); - __m256i ab1 = _mm256_loadu_si256((const __m256i*)(ptr + 32)); - - const __m256i sh = _mm256_setr_epi8(0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15, - 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15); - __m256i p0 = _mm256_shuffle_epi8(ab0, sh); - __m256i p1 = _mm256_shuffle_epi8(ab1, sh); - __m256i pl = _mm256_permute2x128_si256(p0, p1, 0 + 2*16); - __m256i ph = _mm256_permute2x128_si256(p0, p1, 1 + 3*16); - __m256i a0 = _mm256_unpacklo_epi64(pl, ph); - __m256i b0 = _mm256_unpackhi_epi64(pl, ph); - a = v_uint8x32(a0); - b = v_uint8x32(b0); -} - -inline void v_load_deinterleave( const ushort* ptr, v_uint16x16& a, v_uint16x16& b ) -{ - __m256i ab0 = _mm256_loadu_si256((const __m256i*)ptr); - __m256i ab1 = _mm256_loadu_si256((const __m256i*)(ptr + 16)); - - const __m256i sh = _mm256_setr_epi8(0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15, - 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15); - __m256i p0 = _mm256_shuffle_epi8(ab0, sh); - __m256i p1 = _mm256_shuffle_epi8(ab1, sh); - __m256i pl = _mm256_permute2x128_si256(p0, p1, 0 + 2*16); - __m256i ph = _mm256_permute2x128_si256(p0, p1, 1 + 3*16); - __m256i a0 = _mm256_unpacklo_epi64(pl, ph); - __m256i b0 = _mm256_unpackhi_epi64(pl, ph); - a = v_uint16x16(a0); - b = v_uint16x16(b0); -} - -inline void v_load_deinterleave( const unsigned* ptr, v_uint32x8& a, v_uint32x8& b ) -{ - __m256i ab0 = _mm256_loadu_si256((const __m256i*)ptr); - __m256i ab1 = _mm256_loadu_si256((const __m256i*)(ptr + 8)); - - const int sh = 0+2*4+1*16+3*64; - __m256i p0 = _mm256_shuffle_epi32(ab0, sh); - __m256i p1 = _mm256_shuffle_epi32(ab1, sh); - __m256i pl = _mm256_permute2x128_si256(p0, p1, 0 + 2*16); - __m256i ph = _mm256_permute2x128_si256(p0, p1, 1 + 3*16); - __m256i a0 = _mm256_unpacklo_epi64(pl, ph); - __m256i b0 = _mm256_unpackhi_epi64(pl, ph); - a = v_uint32x8(a0); - b = v_uint32x8(b0); -} - -inline void v_load_deinterleave( const uint64* ptr, v_uint64x4& a, v_uint64x4& b ) -{ - __m256i ab0 = _mm256_loadu_si256((const __m256i*)ptr); - __m256i ab1 = _mm256_loadu_si256((const __m256i*)(ptr + 4)); - - __m256i pl = _mm256_permute2x128_si256(ab0, ab1, 0 + 2*16); - __m256i ph = _mm256_permute2x128_si256(ab0, ab1, 1 + 3*16); - __m256i a0 = _mm256_unpacklo_epi64(pl, ph); - __m256i b0 = _mm256_unpackhi_epi64(pl, ph); - a = v_uint64x4(a0); - b = v_uint64x4(b0); -} - -inline void v_load_deinterleave( const uchar* ptr, v_uint8x32& a, v_uint8x32& b, v_uint8x32& c ) -{ - __m256i bgr0 = _mm256_loadu_si256((const __m256i*)ptr); - __m256i bgr1 = _mm256_loadu_si256((const __m256i*)(ptr + 32)); - __m256i bgr2 = _mm256_loadu_si256((const __m256i*)(ptr + 64)); - - __m256i s02_low = _mm256_permute2x128_si256(bgr0, bgr2, 0 + 2*16); - __m256i s02_high = _mm256_permute2x128_si256(bgr0, bgr2, 1 + 3*16); - - const __m256i m0 = _mm256_setr_epi8(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, - 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0); - const __m256i m1 = _mm256_setr_epi8(0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1); - - __m256i b0 = _mm256_blendv_epi8(_mm256_blendv_epi8(s02_low, s02_high, m0), bgr1, m1); - __m256i g0 = _mm256_blendv_epi8(_mm256_blendv_epi8(s02_high, s02_low, m1), bgr1, m0); - __m256i r0 = _mm256_blendv_epi8(_mm256_blendv_epi8(bgr1, s02_low, m0), s02_high, m1); - - const __m256i - sh_b = _mm256_setr_epi8(0, 3, 6, 9, 12, 15, 2, 5, 8, 11, 14, 1, 4, 7, 10, 13, - 0, 3, 6, 9, 12, 15, 2, 5, 8, 11, 14, 1, 4, 7, 10, 13), - sh_g = _mm256_setr_epi8(1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2, 5, 8, 11, 14, - 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2, 5, 8, 11, 14), - sh_r = _mm256_setr_epi8(2, 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, - 2, 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15); - b0 = _mm256_shuffle_epi8(b0, sh_b); - g0 = _mm256_shuffle_epi8(g0, sh_g); - r0 = _mm256_shuffle_epi8(r0, sh_r); - - a = v_uint8x32(b0); - b = v_uint8x32(g0); - c = v_uint8x32(r0); -} - -inline void v_load_deinterleave( const ushort* ptr, v_uint16x16& a, v_uint16x16& b, v_uint16x16& c ) -{ - __m256i bgr0 = _mm256_loadu_si256((const __m256i*)ptr); - __m256i bgr1 = _mm256_loadu_si256((const __m256i*)(ptr + 16)); - __m256i bgr2 = _mm256_loadu_si256((const __m256i*)(ptr + 32)); - - __m256i s02_low = _mm256_permute2x128_si256(bgr0, bgr2, 0 + 2*16); - __m256i s02_high = _mm256_permute2x128_si256(bgr0, bgr2, 1 + 3*16); - - const __m256i m0 = _mm256_setr_epi8(0, 0, -1, -1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, -1, -1, - 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0); - const __m256i m1 = _mm256_setr_epi8(0, 0, 0, 0, -1, -1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, - -1, -1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, -1, -1, 0, 0); - __m256i b0 = _mm256_blendv_epi8(_mm256_blendv_epi8(s02_low, s02_high, m0), bgr1, m1); - __m256i g0 = _mm256_blendv_epi8(_mm256_blendv_epi8(bgr1, s02_low, m0), s02_high, m1); - __m256i r0 = _mm256_blendv_epi8(_mm256_blendv_epi8(s02_high, s02_low, m1), bgr1, m0); - const __m256i sh_b = _mm256_setr_epi8(0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, 4, 5, 10, 11, - 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, 4, 5, 10, 11); - const __m256i sh_g = _mm256_setr_epi8(2, 3, 8, 9, 14, 15, 4, 5, 10, 11, 0, 1, 6, 7, 12, 13, - 2, 3, 8, 9, 14, 15, 4, 5, 10, 11, 0, 1, 6, 7, 12, 13); - const __m256i sh_r = _mm256_setr_epi8(4, 5, 10, 11, 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, - 4, 5, 10, 11, 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15); - b0 = _mm256_shuffle_epi8(b0, sh_b); - g0 = _mm256_shuffle_epi8(g0, sh_g); - r0 = _mm256_shuffle_epi8(r0, sh_r); - - a = v_uint16x16(b0); - b = v_uint16x16(g0); - c = v_uint16x16(r0); -} - -inline void v_load_deinterleave( const unsigned* ptr, v_uint32x8& a, v_uint32x8& b, v_uint32x8& c ) -{ - __m256i bgr0 = _mm256_loadu_si256((const __m256i*)ptr); - __m256i bgr1 = _mm256_loadu_si256((const __m256i*)(ptr + 8)); - __m256i bgr2 = _mm256_loadu_si256((const __m256i*)(ptr + 16)); - - __m256i s02_low = _mm256_permute2x128_si256(bgr0, bgr2, 0 + 2*16); - __m256i s02_high = _mm256_permute2x128_si256(bgr0, bgr2, 1 + 3*16); - - __m256i b0 = _mm256_blend_epi32(_mm256_blend_epi32(s02_low, s02_high, 0x24), bgr1, 0x92); - __m256i g0 = _mm256_blend_epi32(_mm256_blend_epi32(s02_high, s02_low, 0x92), bgr1, 0x24); - __m256i r0 = _mm256_blend_epi32(_mm256_blend_epi32(bgr1, s02_low, 0x24), s02_high, 0x92); - - b0 = _mm256_shuffle_epi32(b0, 0x6c); - g0 = _mm256_shuffle_epi32(g0, 0xb1); - r0 = _mm256_shuffle_epi32(r0, 0xc6); - - a = v_uint32x8(b0); - b = v_uint32x8(g0); - c = v_uint32x8(r0); -} - -inline void v_load_deinterleave( const uint64* ptr, v_uint64x4& a, v_uint64x4& b, v_uint64x4& c ) -{ - __m256i bgr0 = _mm256_loadu_si256((const __m256i*)ptr); - __m256i bgr1 = _mm256_loadu_si256((const __m256i*)(ptr + 4)); - __m256i bgr2 = _mm256_loadu_si256((const __m256i*)(ptr + 8)); - - __m256i s01 = _mm256_blend_epi32(bgr0, bgr1, 0xf0); - __m256i s12 = _mm256_blend_epi32(bgr1, bgr2, 0xf0); - __m256i s20r = _mm256_permute4x64_epi64(_mm256_blend_epi32(bgr2, bgr0, 0xf0), 0x1b); - __m256i b0 = _mm256_unpacklo_epi64(s01, s20r); - __m256i g0 = _mm256_alignr_epi8(s12, s01, 8); - __m256i r0 = _mm256_unpackhi_epi64(s20r, s12); - - a = v_uint64x4(b0); - b = v_uint64x4(g0); - c = v_uint64x4(r0); -} - -inline void v_load_deinterleave( const uchar* ptr, v_uint8x32& a, v_uint8x32& b, v_uint8x32& c, v_uint8x32& d ) -{ - __m256i bgr0 = _mm256_loadu_si256((const __m256i*)ptr); - __m256i bgr1 = _mm256_loadu_si256((const __m256i*)(ptr + 32)); - __m256i bgr2 = _mm256_loadu_si256((const __m256i*)(ptr + 64)); - __m256i bgr3 = _mm256_loadu_si256((const __m256i*)(ptr + 96)); - const __m256i sh = _mm256_setr_epi8(0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, - 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15); - - __m256i p0 = _mm256_shuffle_epi8(bgr0, sh); - __m256i p1 = _mm256_shuffle_epi8(bgr1, sh); - __m256i p2 = _mm256_shuffle_epi8(bgr2, sh); - __m256i p3 = _mm256_shuffle_epi8(bgr3, sh); - - __m256i p01l = _mm256_unpacklo_epi32(p0, p1); - __m256i p01h = _mm256_unpackhi_epi32(p0, p1); - __m256i p23l = _mm256_unpacklo_epi32(p2, p3); - __m256i p23h = _mm256_unpackhi_epi32(p2, p3); - - __m256i pll = _mm256_permute2x128_si256(p01l, p23l, 0 + 2*16); - __m256i plh = _mm256_permute2x128_si256(p01l, p23l, 1 + 3*16); - __m256i phl = _mm256_permute2x128_si256(p01h, p23h, 0 + 2*16); - __m256i phh = _mm256_permute2x128_si256(p01h, p23h, 1 + 3*16); - - __m256i b0 = _mm256_unpacklo_epi32(pll, plh); - __m256i g0 = _mm256_unpackhi_epi32(pll, plh); - __m256i r0 = _mm256_unpacklo_epi32(phl, phh); - __m256i a0 = _mm256_unpackhi_epi32(phl, phh); - - a = v_uint8x32(b0); - b = v_uint8x32(g0); - c = v_uint8x32(r0); - d = v_uint8x32(a0); -} - -inline void v_load_deinterleave( const ushort* ptr, v_uint16x16& a, v_uint16x16& b, v_uint16x16& c, v_uint16x16& d ) -{ - __m256i bgr0 = _mm256_loadu_si256((const __m256i*)ptr); - __m256i bgr1 = _mm256_loadu_si256((const __m256i*)(ptr + 16)); - __m256i bgr2 = _mm256_loadu_si256((const __m256i*)(ptr + 32)); - __m256i bgr3 = _mm256_loadu_si256((const __m256i*)(ptr + 48)); - const __m256i sh = _mm256_setr_epi8(0, 1, 8, 9, 2, 3, 10, 11, 4, 5, 12, 13, 6, 7, 14, 15, - 0, 1, 8, 9, 2, 3, 10, 11, 4, 5, 12, 13, 6, 7, 14, 15); - __m256i p0 = _mm256_shuffle_epi8(bgr0, sh); - __m256i p1 = _mm256_shuffle_epi8(bgr1, sh); - __m256i p2 = _mm256_shuffle_epi8(bgr2, sh); - __m256i p3 = _mm256_shuffle_epi8(bgr3, sh); - - __m256i p01l = _mm256_unpacklo_epi32(p0, p1); - __m256i p01h = _mm256_unpackhi_epi32(p0, p1); - __m256i p23l = _mm256_unpacklo_epi32(p2, p3); - __m256i p23h = _mm256_unpackhi_epi32(p2, p3); - - __m256i pll = _mm256_permute2x128_si256(p01l, p23l, 0 + 2*16); - __m256i plh = _mm256_permute2x128_si256(p01l, p23l, 1 + 3*16); - __m256i phl = _mm256_permute2x128_si256(p01h, p23h, 0 + 2*16); - __m256i phh = _mm256_permute2x128_si256(p01h, p23h, 1 + 3*16); - - __m256i b0 = _mm256_unpacklo_epi32(pll, plh); - __m256i g0 = _mm256_unpackhi_epi32(pll, plh); - __m256i r0 = _mm256_unpacklo_epi32(phl, phh); - __m256i a0 = _mm256_unpackhi_epi32(phl, phh); - - a = v_uint16x16(b0); - b = v_uint16x16(g0); - c = v_uint16x16(r0); - d = v_uint16x16(a0); -} - -inline void v_load_deinterleave( const unsigned* ptr, v_uint32x8& a, v_uint32x8& b, v_uint32x8& c, v_uint32x8& d ) -{ - __m256i p0 = _mm256_loadu_si256((const __m256i*)ptr); - __m256i p1 = _mm256_loadu_si256((const __m256i*)(ptr + 8)); - __m256i p2 = _mm256_loadu_si256((const __m256i*)(ptr + 16)); - __m256i p3 = _mm256_loadu_si256((const __m256i*)(ptr + 24)); - - __m256i p01l = _mm256_unpacklo_epi32(p0, p1); - __m256i p01h = _mm256_unpackhi_epi32(p0, p1); - __m256i p23l = _mm256_unpacklo_epi32(p2, p3); - __m256i p23h = _mm256_unpackhi_epi32(p2, p3); - - __m256i pll = _mm256_permute2x128_si256(p01l, p23l, 0 + 2*16); - __m256i plh = _mm256_permute2x128_si256(p01l, p23l, 1 + 3*16); - __m256i phl = _mm256_permute2x128_si256(p01h, p23h, 0 + 2*16); - __m256i phh = _mm256_permute2x128_si256(p01h, p23h, 1 + 3*16); - - __m256i b0 = _mm256_unpacklo_epi32(pll, plh); - __m256i g0 = _mm256_unpackhi_epi32(pll, plh); - __m256i r0 = _mm256_unpacklo_epi32(phl, phh); - __m256i a0 = _mm256_unpackhi_epi32(phl, phh); - - a = v_uint32x8(b0); - b = v_uint32x8(g0); - c = v_uint32x8(r0); - d = v_uint32x8(a0); -} - -inline void v_load_deinterleave( const uint64* ptr, v_uint64x4& a, v_uint64x4& b, v_uint64x4& c, v_uint64x4& d ) -{ - __m256i bgra0 = _mm256_loadu_si256((const __m256i*)ptr); - __m256i bgra1 = _mm256_loadu_si256((const __m256i*)(ptr + 4)); - __m256i bgra2 = _mm256_loadu_si256((const __m256i*)(ptr + 8)); - __m256i bgra3 = _mm256_loadu_si256((const __m256i*)(ptr + 12)); - - __m256i l02 = _mm256_permute2x128_si256(bgra0, bgra2, 0 + 2*16); - __m256i h02 = _mm256_permute2x128_si256(bgra0, bgra2, 1 + 3*16); - __m256i l13 = _mm256_permute2x128_si256(bgra1, bgra3, 0 + 2*16); - __m256i h13 = _mm256_permute2x128_si256(bgra1, bgra3, 1 + 3*16); - - __m256i b0 = _mm256_unpacklo_epi64(l02, l13); - __m256i g0 = _mm256_unpackhi_epi64(l02, l13); - __m256i r0 = _mm256_unpacklo_epi64(h02, h13); - __m256i a0 = _mm256_unpackhi_epi64(h02, h13); - - a = v_uint64x4(b0); - b = v_uint64x4(g0); - c = v_uint64x4(r0); - d = v_uint64x4(a0); -} - -///////////////////////////// store interleave ///////////////////////////////////// - -inline void v_store_interleave( uchar* ptr, const v_uint8x32& x, const v_uint8x32& y, - hal::StoreMode mode=hal::STORE_UNALIGNED ) -{ - __m256i xy_l = _mm256_unpacklo_epi8(x.val, y.val); - __m256i xy_h = _mm256_unpackhi_epi8(x.val, y.val); - - __m256i xy0 = _mm256_permute2x128_si256(xy_l, xy_h, 0 + 2*16); - __m256i xy1 = _mm256_permute2x128_si256(xy_l, xy_h, 1 + 3*16); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm256_stream_si256((__m256i*)ptr, xy0); - _mm256_stream_si256((__m256i*)(ptr + 32), xy1); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm256_store_si256((__m256i*)ptr, xy0); - _mm256_store_si256((__m256i*)(ptr + 32), xy1); - } - else - { - _mm256_storeu_si256((__m256i*)ptr, xy0); - _mm256_storeu_si256((__m256i*)(ptr + 32), xy1); - } -} - -inline void v_store_interleave( ushort* ptr, const v_uint16x16& x, const v_uint16x16& y, - hal::StoreMode mode=hal::STORE_UNALIGNED ) -{ - __m256i xy_l = _mm256_unpacklo_epi16(x.val, y.val); - __m256i xy_h = _mm256_unpackhi_epi16(x.val, y.val); - - __m256i xy0 = _mm256_permute2x128_si256(xy_l, xy_h, 0 + 2*16); - __m256i xy1 = _mm256_permute2x128_si256(xy_l, xy_h, 1 + 3*16); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm256_stream_si256((__m256i*)ptr, xy0); - _mm256_stream_si256((__m256i*)(ptr + 16), xy1); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm256_store_si256((__m256i*)ptr, xy0); - _mm256_store_si256((__m256i*)(ptr + 16), xy1); - } - else - { - _mm256_storeu_si256((__m256i*)ptr, xy0); - _mm256_storeu_si256((__m256i*)(ptr + 16), xy1); - } -} - -inline void v_store_interleave( unsigned* ptr, const v_uint32x8& x, const v_uint32x8& y, - hal::StoreMode mode=hal::STORE_UNALIGNED ) -{ - __m256i xy_l = _mm256_unpacklo_epi32(x.val, y.val); - __m256i xy_h = _mm256_unpackhi_epi32(x.val, y.val); - - __m256i xy0 = _mm256_permute2x128_si256(xy_l, xy_h, 0 + 2*16); - __m256i xy1 = _mm256_permute2x128_si256(xy_l, xy_h, 1 + 3*16); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm256_stream_si256((__m256i*)ptr, xy0); - _mm256_stream_si256((__m256i*)(ptr + 8), xy1); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm256_store_si256((__m256i*)ptr, xy0); - _mm256_store_si256((__m256i*)(ptr + 8), xy1); - } - else - { - _mm256_storeu_si256((__m256i*)ptr, xy0); - _mm256_storeu_si256((__m256i*)(ptr + 8), xy1); - } -} - -inline void v_store_interleave( uint64* ptr, const v_uint64x4& x, const v_uint64x4& y, - hal::StoreMode mode=hal::STORE_UNALIGNED ) -{ - __m256i xy_l = _mm256_unpacklo_epi64(x.val, y.val); - __m256i xy_h = _mm256_unpackhi_epi64(x.val, y.val); - - __m256i xy0 = _mm256_permute2x128_si256(xy_l, xy_h, 0 + 2*16); - __m256i xy1 = _mm256_permute2x128_si256(xy_l, xy_h, 1 + 3*16); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm256_stream_si256((__m256i*)ptr, xy0); - _mm256_stream_si256((__m256i*)(ptr + 4), xy1); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm256_store_si256((__m256i*)ptr, xy0); - _mm256_store_si256((__m256i*)(ptr + 4), xy1); - } - else - { - _mm256_storeu_si256((__m256i*)ptr, xy0); - _mm256_storeu_si256((__m256i*)(ptr + 4), xy1); - } -} - -inline void v_store_interleave( uchar* ptr, const v_uint8x32& a, const v_uint8x32& b, const v_uint8x32& c, - hal::StoreMode mode=hal::STORE_UNALIGNED ) -{ - const __m256i sh_b = _mm256_setr_epi8( - 0, 11, 6, 1, 12, 7, 2, 13, 8, 3, 14, 9, 4, 15, 10, 5, - 0, 11, 6, 1, 12, 7, 2, 13, 8, 3, 14, 9, 4, 15, 10, 5); - const __m256i sh_g = _mm256_setr_epi8( - 5, 0, 11, 6, 1, 12, 7, 2, 13, 8, 3, 14, 9, 4, 15, 10, - 5, 0, 11, 6, 1, 12, 7, 2, 13, 8, 3, 14, 9, 4, 15, 10); - const __m256i sh_r = _mm256_setr_epi8( - 10, 5, 0, 11, 6, 1, 12, 7, 2, 13, 8, 3, 14, 9, 4, 15, - 10, 5, 0, 11, 6, 1, 12, 7, 2, 13, 8, 3, 14, 9, 4, 15); - - __m256i b0 = _mm256_shuffle_epi8(a.val, sh_b); - __m256i g0 = _mm256_shuffle_epi8(b.val, sh_g); - __m256i r0 = _mm256_shuffle_epi8(c.val, sh_r); - - const __m256i m0 = _mm256_setr_epi8(0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0); - const __m256i m1 = _mm256_setr_epi8(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, - 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0); - - __m256i p0 = _mm256_blendv_epi8(_mm256_blendv_epi8(b0, g0, m0), r0, m1); - __m256i p1 = _mm256_blendv_epi8(_mm256_blendv_epi8(g0, r0, m0), b0, m1); - __m256i p2 = _mm256_blendv_epi8(_mm256_blendv_epi8(r0, b0, m0), g0, m1); - - __m256i bgr0 = _mm256_permute2x128_si256(p0, p1, 0 + 2*16); - __m256i bgr1 = _mm256_permute2x128_si256(p2, p0, 0 + 3*16); - __m256i bgr2 = _mm256_permute2x128_si256(p1, p2, 1 + 3*16); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm256_stream_si256((__m256i*)ptr, bgr0); - _mm256_stream_si256((__m256i*)(ptr + 32), bgr1); - _mm256_stream_si256((__m256i*)(ptr + 64), bgr2); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm256_store_si256((__m256i*)ptr, bgr0); - _mm256_store_si256((__m256i*)(ptr + 32), bgr1); - _mm256_store_si256((__m256i*)(ptr + 64), bgr2); - } - else - { - _mm256_storeu_si256((__m256i*)ptr, bgr0); - _mm256_storeu_si256((__m256i*)(ptr + 32), bgr1); - _mm256_storeu_si256((__m256i*)(ptr + 64), bgr2); - } -} - -inline void v_store_interleave( ushort* ptr, const v_uint16x16& a, const v_uint16x16& b, const v_uint16x16& c, - hal::StoreMode mode=hal::STORE_UNALIGNED ) -{ - const __m256i sh_b = _mm256_setr_epi8( - 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, 4, 5, 10, 11, - 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, 4, 5, 10, 11); - const __m256i sh_g = _mm256_setr_epi8( - 10, 11, 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, 4, 5, - 10, 11, 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, 4, 5); - const __m256i sh_r = _mm256_setr_epi8( - 4, 5, 10, 11, 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, - 4, 5, 10, 11, 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15); - - __m256i b0 = _mm256_shuffle_epi8(a.val, sh_b); - __m256i g0 = _mm256_shuffle_epi8(b.val, sh_g); - __m256i r0 = _mm256_shuffle_epi8(c.val, sh_r); - - const __m256i m0 = _mm256_setr_epi8(0, 0, -1, -1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, -1, -1, - 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0); - const __m256i m1 = _mm256_setr_epi8(0, 0, 0, 0, -1, -1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, - -1, -1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, -1, -1, 0, 0); - - __m256i p0 = _mm256_blendv_epi8(_mm256_blendv_epi8(b0, g0, m0), r0, m1); - __m256i p1 = _mm256_blendv_epi8(_mm256_blendv_epi8(g0, r0, m0), b0, m1); - __m256i p2 = _mm256_blendv_epi8(_mm256_blendv_epi8(r0, b0, m0), g0, m1); - - __m256i bgr0 = _mm256_permute2x128_si256(p0, p2, 0 + 2*16); - //__m256i bgr1 = p1; - __m256i bgr2 = _mm256_permute2x128_si256(p0, p2, 1 + 3*16); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm256_stream_si256((__m256i*)ptr, bgr0); - _mm256_stream_si256((__m256i*)(ptr + 16), p1); - _mm256_stream_si256((__m256i*)(ptr + 32), bgr2); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm256_store_si256((__m256i*)ptr, bgr0); - _mm256_store_si256((__m256i*)(ptr + 16), p1); - _mm256_store_si256((__m256i*)(ptr + 32), bgr2); - } - else - { - _mm256_storeu_si256((__m256i*)ptr, bgr0); - _mm256_storeu_si256((__m256i*)(ptr + 16), p1); - _mm256_storeu_si256((__m256i*)(ptr + 32), bgr2); - } -} - -inline void v_store_interleave( unsigned* ptr, const v_uint32x8& a, const v_uint32x8& b, const v_uint32x8& c, - hal::StoreMode mode=hal::STORE_UNALIGNED ) -{ - __m256i b0 = _mm256_shuffle_epi32(a.val, 0x6c); - __m256i g0 = _mm256_shuffle_epi32(b.val, 0xb1); - __m256i r0 = _mm256_shuffle_epi32(c.val, 0xc6); - - __m256i p0 = _mm256_blend_epi32(_mm256_blend_epi32(b0, g0, 0x92), r0, 0x24); - __m256i p1 = _mm256_blend_epi32(_mm256_blend_epi32(g0, r0, 0x92), b0, 0x24); - __m256i p2 = _mm256_blend_epi32(_mm256_blend_epi32(r0, b0, 0x92), g0, 0x24); - - __m256i bgr0 = _mm256_permute2x128_si256(p0, p1, 0 + 2*16); - //__m256i bgr1 = p2; - __m256i bgr2 = _mm256_permute2x128_si256(p0, p1, 1 + 3*16); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm256_stream_si256((__m256i*)ptr, bgr0); - _mm256_stream_si256((__m256i*)(ptr + 8), p2); - _mm256_stream_si256((__m256i*)(ptr + 16), bgr2); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm256_store_si256((__m256i*)ptr, bgr0); - _mm256_store_si256((__m256i*)(ptr + 8), p2); - _mm256_store_si256((__m256i*)(ptr + 16), bgr2); - } - else - { - _mm256_storeu_si256((__m256i*)ptr, bgr0); - _mm256_storeu_si256((__m256i*)(ptr + 8), p2); - _mm256_storeu_si256((__m256i*)(ptr + 16), bgr2); - } -} - -inline void v_store_interleave( uint64* ptr, const v_uint64x4& a, const v_uint64x4& b, const v_uint64x4& c, - hal::StoreMode mode=hal::STORE_UNALIGNED ) -{ - __m256i s01 = _mm256_unpacklo_epi64(a.val, b.val); - __m256i s12 = _mm256_unpackhi_epi64(b.val, c.val); - __m256i s20 = _mm256_blend_epi32(c.val, a.val, 0xcc); - - __m256i bgr0 = _mm256_permute2x128_si256(s01, s20, 0 + 2*16); - __m256i bgr1 = _mm256_blend_epi32(s01, s12, 0x0f); - __m256i bgr2 = _mm256_permute2x128_si256(s20, s12, 1 + 3*16); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm256_stream_si256((__m256i*)ptr, bgr0); - _mm256_stream_si256((__m256i*)(ptr + 4), bgr1); - _mm256_stream_si256((__m256i*)(ptr + 8), bgr2); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm256_store_si256((__m256i*)ptr, bgr0); - _mm256_store_si256((__m256i*)(ptr + 4), bgr1); - _mm256_store_si256((__m256i*)(ptr + 8), bgr2); - } - else - { - _mm256_storeu_si256((__m256i*)ptr, bgr0); - _mm256_storeu_si256((__m256i*)(ptr + 4), bgr1); - _mm256_storeu_si256((__m256i*)(ptr + 8), bgr2); - } -} - -inline void v_store_interleave( uchar* ptr, const v_uint8x32& a, const v_uint8x32& b, - const v_uint8x32& c, const v_uint8x32& d, - hal::StoreMode mode=hal::STORE_UNALIGNED ) -{ - __m256i bg0 = _mm256_unpacklo_epi8(a.val, b.val); - __m256i bg1 = _mm256_unpackhi_epi8(a.val, b.val); - __m256i ra0 = _mm256_unpacklo_epi8(c.val, d.val); - __m256i ra1 = _mm256_unpackhi_epi8(c.val, d.val); - - __m256i bgra0_ = _mm256_unpacklo_epi16(bg0, ra0); - __m256i bgra1_ = _mm256_unpackhi_epi16(bg0, ra0); - __m256i bgra2_ = _mm256_unpacklo_epi16(bg1, ra1); - __m256i bgra3_ = _mm256_unpackhi_epi16(bg1, ra1); - - __m256i bgra0 = _mm256_permute2x128_si256(bgra0_, bgra1_, 0 + 2*16); - __m256i bgra2 = _mm256_permute2x128_si256(bgra0_, bgra1_, 1 + 3*16); - __m256i bgra1 = _mm256_permute2x128_si256(bgra2_, bgra3_, 0 + 2*16); - __m256i bgra3 = _mm256_permute2x128_si256(bgra2_, bgra3_, 1 + 3*16); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm256_stream_si256((__m256i*)ptr, bgra0); - _mm256_stream_si256((__m256i*)(ptr + 32), bgra1); - _mm256_stream_si256((__m256i*)(ptr + 64), bgra2); - _mm256_stream_si256((__m256i*)(ptr + 96), bgra3); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm256_store_si256((__m256i*)ptr, bgra0); - _mm256_store_si256((__m256i*)(ptr + 32), bgra1); - _mm256_store_si256((__m256i*)(ptr + 64), bgra2); - _mm256_store_si256((__m256i*)(ptr + 96), bgra3); - } - else - { - _mm256_storeu_si256((__m256i*)ptr, bgra0); - _mm256_storeu_si256((__m256i*)(ptr + 32), bgra1); - _mm256_storeu_si256((__m256i*)(ptr + 64), bgra2); - _mm256_storeu_si256((__m256i*)(ptr + 96), bgra3); - } -} - -inline void v_store_interleave( ushort* ptr, const v_uint16x16& a, const v_uint16x16& b, - const v_uint16x16& c, const v_uint16x16& d, - hal::StoreMode mode=hal::STORE_UNALIGNED ) -{ - __m256i bg0 = _mm256_unpacklo_epi16(a.val, b.val); - __m256i bg1 = _mm256_unpackhi_epi16(a.val, b.val); - __m256i ra0 = _mm256_unpacklo_epi16(c.val, d.val); - __m256i ra1 = _mm256_unpackhi_epi16(c.val, d.val); - - __m256i bgra0_ = _mm256_unpacklo_epi32(bg0, ra0); - __m256i bgra1_ = _mm256_unpackhi_epi32(bg0, ra0); - __m256i bgra2_ = _mm256_unpacklo_epi32(bg1, ra1); - __m256i bgra3_ = _mm256_unpackhi_epi32(bg1, ra1); - - __m256i bgra0 = _mm256_permute2x128_si256(bgra0_, bgra1_, 0 + 2*16); - __m256i bgra2 = _mm256_permute2x128_si256(bgra0_, bgra1_, 1 + 3*16); - __m256i bgra1 = _mm256_permute2x128_si256(bgra2_, bgra3_, 0 + 2*16); - __m256i bgra3 = _mm256_permute2x128_si256(bgra2_, bgra3_, 1 + 3*16); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm256_stream_si256((__m256i*)ptr, bgra0); - _mm256_stream_si256((__m256i*)(ptr + 16), bgra1); - _mm256_stream_si256((__m256i*)(ptr + 32), bgra2); - _mm256_stream_si256((__m256i*)(ptr + 48), bgra3); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm256_store_si256((__m256i*)ptr, bgra0); - _mm256_store_si256((__m256i*)(ptr + 16), bgra1); - _mm256_store_si256((__m256i*)(ptr + 32), bgra2); - _mm256_store_si256((__m256i*)(ptr + 48), bgra3); - } - else - { - _mm256_storeu_si256((__m256i*)ptr, bgra0); - _mm256_storeu_si256((__m256i*)(ptr + 16), bgra1); - _mm256_storeu_si256((__m256i*)(ptr + 32), bgra2); - _mm256_storeu_si256((__m256i*)(ptr + 48), bgra3); - } -} - -inline void v_store_interleave( unsigned* ptr, const v_uint32x8& a, const v_uint32x8& b, - const v_uint32x8& c, const v_uint32x8& d, - hal::StoreMode mode=hal::STORE_UNALIGNED ) -{ - __m256i bg0 = _mm256_unpacklo_epi32(a.val, b.val); - __m256i bg1 = _mm256_unpackhi_epi32(a.val, b.val); - __m256i ra0 = _mm256_unpacklo_epi32(c.val, d.val); - __m256i ra1 = _mm256_unpackhi_epi32(c.val, d.val); - - __m256i bgra0_ = _mm256_unpacklo_epi64(bg0, ra0); - __m256i bgra1_ = _mm256_unpackhi_epi64(bg0, ra0); - __m256i bgra2_ = _mm256_unpacklo_epi64(bg1, ra1); - __m256i bgra3_ = _mm256_unpackhi_epi64(bg1, ra1); - - __m256i bgra0 = _mm256_permute2x128_si256(bgra0_, bgra1_, 0 + 2*16); - __m256i bgra2 = _mm256_permute2x128_si256(bgra0_, bgra1_, 1 + 3*16); - __m256i bgra1 = _mm256_permute2x128_si256(bgra2_, bgra3_, 0 + 2*16); - __m256i bgra3 = _mm256_permute2x128_si256(bgra2_, bgra3_, 1 + 3*16); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm256_stream_si256((__m256i*)ptr, bgra0); - _mm256_stream_si256((__m256i*)(ptr + 8), bgra1); - _mm256_stream_si256((__m256i*)(ptr + 16), bgra2); - _mm256_stream_si256((__m256i*)(ptr + 24), bgra3); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm256_store_si256((__m256i*)ptr, bgra0); - _mm256_store_si256((__m256i*)(ptr + 8), bgra1); - _mm256_store_si256((__m256i*)(ptr + 16), bgra2); - _mm256_store_si256((__m256i*)(ptr + 24), bgra3); - } - else - { - _mm256_storeu_si256((__m256i*)ptr, bgra0); - _mm256_storeu_si256((__m256i*)(ptr + 8), bgra1); - _mm256_storeu_si256((__m256i*)(ptr + 16), bgra2); - _mm256_storeu_si256((__m256i*)(ptr + 24), bgra3); - } -} - -inline void v_store_interleave( uint64* ptr, const v_uint64x4& a, const v_uint64x4& b, - const v_uint64x4& c, const v_uint64x4& d, - hal::StoreMode mode=hal::STORE_UNALIGNED ) -{ - __m256i bg0 = _mm256_unpacklo_epi64(a.val, b.val); - __m256i bg1 = _mm256_unpackhi_epi64(a.val, b.val); - __m256i ra0 = _mm256_unpacklo_epi64(c.val, d.val); - __m256i ra1 = _mm256_unpackhi_epi64(c.val, d.val); - - __m256i bgra0 = _mm256_permute2x128_si256(bg0, ra0, 0 + 2*16); - __m256i bgra1 = _mm256_permute2x128_si256(bg1, ra1, 0 + 2*16); - __m256i bgra2 = _mm256_permute2x128_si256(bg0, ra0, 1 + 3*16); - __m256i bgra3 = _mm256_permute2x128_si256(bg1, ra1, 1 + 3*16); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm256_stream_si256((__m256i*)ptr, bgra0); - _mm256_stream_si256((__m256i*)(ptr + 4), bgra1); - _mm256_stream_si256((__m256i*)(ptr + 8), bgra2); - _mm256_stream_si256((__m256i*)(ptr + 12), bgra3); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm256_store_si256((__m256i*)ptr, bgra0); - _mm256_store_si256((__m256i*)(ptr + 4), bgra1); - _mm256_store_si256((__m256i*)(ptr + 8), bgra2); - _mm256_store_si256((__m256i*)(ptr + 12), bgra3); - } - else - { - _mm256_storeu_si256((__m256i*)ptr, bgra0); - _mm256_storeu_si256((__m256i*)(ptr + 4), bgra1); - _mm256_storeu_si256((__m256i*)(ptr + 8), bgra2); - _mm256_storeu_si256((__m256i*)(ptr + 12), bgra3); - } -} - -#define OPENCV_HAL_IMPL_AVX_LOADSTORE_INTERLEAVE(_Tpvec0, _Tp0, suffix0, _Tpvec1, _Tp1, suffix1) \ -inline void v_load_deinterleave( const _Tp0* ptr, _Tpvec0& a0, _Tpvec0& b0 ) \ -{ \ - _Tpvec1 a1, b1; \ - v_load_deinterleave((const _Tp1*)ptr, a1, b1); \ - a0 = v_reinterpret_as_##suffix0(a1); \ - b0 = v_reinterpret_as_##suffix0(b1); \ -} \ -inline void v_load_deinterleave( const _Tp0* ptr, _Tpvec0& a0, _Tpvec0& b0, _Tpvec0& c0 ) \ -{ \ - _Tpvec1 a1, b1, c1; \ - v_load_deinterleave((const _Tp1*)ptr, a1, b1, c1); \ - a0 = v_reinterpret_as_##suffix0(a1); \ - b0 = v_reinterpret_as_##suffix0(b1); \ - c0 = v_reinterpret_as_##suffix0(c1); \ -} \ -inline void v_load_deinterleave( const _Tp0* ptr, _Tpvec0& a0, _Tpvec0& b0, _Tpvec0& c0, _Tpvec0& d0 ) \ -{ \ - _Tpvec1 a1, b1, c1, d1; \ - v_load_deinterleave((const _Tp1*)ptr, a1, b1, c1, d1); \ - a0 = v_reinterpret_as_##suffix0(a1); \ - b0 = v_reinterpret_as_##suffix0(b1); \ - c0 = v_reinterpret_as_##suffix0(c1); \ - d0 = v_reinterpret_as_##suffix0(d1); \ -} \ -inline void v_store_interleave( _Tp0* ptr, const _Tpvec0& a0, const _Tpvec0& b0, \ - hal::StoreMode mode=hal::STORE_UNALIGNED ) \ -{ \ - _Tpvec1 a1 = v_reinterpret_as_##suffix1(a0); \ - _Tpvec1 b1 = v_reinterpret_as_##suffix1(b0); \ - v_store_interleave((_Tp1*)ptr, a1, b1, mode); \ -} \ -inline void v_store_interleave( _Tp0* ptr, const _Tpvec0& a0, const _Tpvec0& b0, const _Tpvec0& c0, \ - hal::StoreMode mode=hal::STORE_UNALIGNED ) \ -{ \ - _Tpvec1 a1 = v_reinterpret_as_##suffix1(a0); \ - _Tpvec1 b1 = v_reinterpret_as_##suffix1(b0); \ - _Tpvec1 c1 = v_reinterpret_as_##suffix1(c0); \ - v_store_interleave((_Tp1*)ptr, a1, b1, c1, mode); \ -} \ -inline void v_store_interleave( _Tp0* ptr, const _Tpvec0& a0, const _Tpvec0& b0, \ - const _Tpvec0& c0, const _Tpvec0& d0, \ - hal::StoreMode mode=hal::STORE_UNALIGNED ) \ -{ \ - _Tpvec1 a1 = v_reinterpret_as_##suffix1(a0); \ - _Tpvec1 b1 = v_reinterpret_as_##suffix1(b0); \ - _Tpvec1 c1 = v_reinterpret_as_##suffix1(c0); \ - _Tpvec1 d1 = v_reinterpret_as_##suffix1(d0); \ - v_store_interleave((_Tp1*)ptr, a1, b1, c1, d1, mode); \ -} - -OPENCV_HAL_IMPL_AVX_LOADSTORE_INTERLEAVE(v_int8x32, schar, s8, v_uint8x32, uchar, u8) -OPENCV_HAL_IMPL_AVX_LOADSTORE_INTERLEAVE(v_int16x16, short, s16, v_uint16x16, ushort, u16) -OPENCV_HAL_IMPL_AVX_LOADSTORE_INTERLEAVE(v_int32x8, int, s32, v_uint32x8, unsigned, u32) -OPENCV_HAL_IMPL_AVX_LOADSTORE_INTERLEAVE(v_float32x8, float, f32, v_uint32x8, unsigned, u32) -OPENCV_HAL_IMPL_AVX_LOADSTORE_INTERLEAVE(v_int64x4, int64, s64, v_uint64x4, uint64, u64) -OPENCV_HAL_IMPL_AVX_LOADSTORE_INTERLEAVE(v_float64x4, double, f64, v_uint64x4, uint64, u64) - -// FP16 -inline v_float32x8 v256_load_expand(const float16_t* ptr) -{ - return v_float32x8(_mm256_cvtph_ps(_mm_loadu_si128((const __m128i*)ptr))); -} - -inline void v_pack_store(float16_t* ptr, const v_float32x8& a) -{ - __m128i ah = _mm256_cvtps_ph(a.val, 0); - _mm_storeu_si128((__m128i*)ptr, ah); -} - -inline void v256_cleanup() { _mm256_zeroall(); } - -//! @name Check SIMD256 support -//! @{ -//! @brief Check CPU capability of SIMD operation -static inline bool hasSIMD256() -{ - return (CV_CPU_HAS_SUPPORT_AVX2) ? true : false; -} -//! @} - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END - -//! @endcond - -} // cv:: - -#endif // OPENCV_HAL_INTRIN_AVX_HPP diff --git a/opencv/include/opencv2/core/hal/intrin_cpp.hpp b/opencv/include/opencv2/core/hal/intrin_cpp.hpp deleted file mode 100644 index 757c67b..0000000 --- a/opencv/include/opencv2/core/hal/intrin_cpp.hpp +++ /dev/null @@ -1,2382 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_HAL_INTRIN_CPP_HPP -#define OPENCV_HAL_INTRIN_CPP_HPP - -#include -#include -#include -#include "opencv2/core/saturate.hpp" - -namespace cv -{ - -#ifndef CV_DOXYGEN -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN -#endif - -/** @addtogroup core_hal_intrin - -"Universal intrinsics" is a types and functions set intended to simplify vectorization of code on -different platforms. Currently there are two supported SIMD extensions: __SSE/SSE2__ on x86 -architectures and __NEON__ on ARM architectures, both allow working with 128 bit registers -containing packed values of different types. In case when there is no SIMD extension available -during compilation, fallback C++ implementation of intrinsics will be chosen and code will work as -expected although it could be slower. - -### Types - -There are several types representing 128-bit register as a vector of packed values, each type is -implemented as a structure based on a one SIMD register. - -- cv::v_uint8x16 and cv::v_int8x16: sixteen 8-bit integer values (unsigned/signed) - char -- cv::v_uint16x8 and cv::v_int16x8: eight 16-bit integer values (unsigned/signed) - short -- cv::v_uint32x4 and cv::v_int32x4: four 32-bit integer values (unsgined/signed) - int -- cv::v_uint64x2 and cv::v_int64x2: two 64-bit integer values (unsigned/signed) - int64 -- cv::v_float32x4: four 32-bit floating point values (signed) - float -- cv::v_float64x2: two 64-bit floating point valies (signed) - double - -@note -cv::v_float64x2 is not implemented in NEON variant, if you want to use this type, don't forget to -check the CV_SIMD128_64F preprocessor definition: -@code -#if CV_SIMD128_64F -//... -#endif -@endcode - -### Load and store operations - -These operations allow to set contents of the register explicitly or by loading it from some memory -block and to save contents of the register to memory block. - -- Constructors: -@ref v_reg::v_reg(const _Tp *ptr) "from memory", -@ref v_reg::v_reg(_Tp s0, _Tp s1) "from two values", ... -- Other create methods: -@ref v_setall_s8, @ref v_setall_u8, ..., -@ref v_setzero_u8, @ref v_setzero_s8, ... -- Memory operations: -@ref v_load, @ref v_load_aligned, @ref v_load_low, @ref v_load_halves, -@ref v_store, @ref v_store_aligned, -@ref v_store_high, @ref v_store_low - -### Value reordering - -These operations allow to reorder or recombine elements in one or multiple vectors. - -- Interleave, deinterleave (2, 3 and 4 channels): @ref v_load_deinterleave, @ref v_store_interleave -- Expand: @ref v_load_expand, @ref v_load_expand_q, @ref v_expand, @ref v_expand_low, @ref v_expand_high -- Pack: @ref v_pack, @ref v_pack_u, @ref v_pack_b, @ref v_rshr_pack, @ref v_rshr_pack_u, -@ref v_pack_store, @ref v_pack_u_store, @ref v_rshr_pack_store, @ref v_rshr_pack_u_store -- Recombine: @ref v_zip, @ref v_recombine, @ref v_combine_low, @ref v_combine_high -- Extract: @ref v_extract - - -### Arithmetic, bitwise and comparison operations - -Element-wise binary and unary operations. - -- Arithmetics: -@ref operator +(const v_reg &a, const v_reg &b) "+", -@ref operator -(const v_reg &a, const v_reg &b) "-", -@ref operator *(const v_reg &a, const v_reg &b) "*", -@ref operator /(const v_reg &a, const v_reg &b) "/", -@ref v_mul_expand - -- Non-saturating arithmetics: @ref v_add_wrap, @ref v_sub_wrap - -- Bitwise shifts: -@ref operator <<(const v_reg &a, int s) "<<", -@ref operator >>(const v_reg &a, int s) ">>", -@ref v_shl, @ref v_shr - -- Bitwise logic: -@ref operator&(const v_reg &a, const v_reg &b) "&", -@ref operator |(const v_reg &a, const v_reg &b) "|", -@ref operator ^(const v_reg &a, const v_reg &b) "^", -@ref operator ~(const v_reg &a) "~" - -- Comparison: -@ref operator >(const v_reg &a, const v_reg &b) ">", -@ref operator >=(const v_reg &a, const v_reg &b) ">=", -@ref operator <(const v_reg &a, const v_reg &b) "<", -@ref operator <=(const v_reg &a, const v_reg &b) "<=", -@ref operator==(const v_reg &a, const v_reg &b) "==", -@ref operator !=(const v_reg &a, const v_reg &b) "!=" - -- min/max: @ref v_min, @ref v_max - -### Reduce and mask - -Most of these operations return only one value. - -- Reduce: @ref v_reduce_min, @ref v_reduce_max, @ref v_reduce_sum, @ref v_popcount -- Mask: @ref v_signmask, @ref v_check_all, @ref v_check_any, @ref v_select - -### Other math - -- Some frequent operations: @ref v_sqrt, @ref v_invsqrt, @ref v_magnitude, @ref v_sqr_magnitude -- Absolute values: @ref v_abs, @ref v_absdiff, @ref v_absdiffs - -### Conversions - -Different type conversions and casts: - -- Rounding: @ref v_round, @ref v_floor, @ref v_ceil, @ref v_trunc, -- To float: @ref v_cvt_f32, @ref v_cvt_f64 -- Reinterpret: @ref v_reinterpret_as_u8, @ref v_reinterpret_as_s8, ... - -### Matrix operations - -In these operations vectors represent matrix rows/columns: @ref v_dotprod, @ref v_matmul, @ref v_transpose4x4 - -### Usability - -Most operations are implemented only for some subset of the available types, following matrices -shows the applicability of different operations to the types. - -Regular integers: - -| Operations\\Types | uint 8x16 | int 8x16 | uint 16x8 | int 16x8 | uint 32x4 | int 32x4 | -|-------------------|:-:|:-:|:-:|:-:|:-:|:-:| -|load, store | x | x | x | x | x | x | -|interleave | x | x | x | x | x | x | -|expand | x | x | x | x | x | x | -|expand_low | x | x | x | x | x | x | -|expand_high | x | x | x | x | x | x | -|expand_q | x | x | | | | | -|add, sub | x | x | x | x | x | x | -|add_wrap, sub_wrap | x | x | x | x | | | -|mul_wrap | x | x | x | x | | | -|mul | x | x | x | x | x | x | -|mul_expand | x | x | x | x | x | | -|compare | x | x | x | x | x | x | -|shift | | | x | x | x | x | -|dotprod | | | | x | | | -|logical | x | x | x | x | x | x | -|min, max | x | x | x | x | x | x | -|absdiff | x | x | x | x | x | x | -|absdiffs | | x | | x | | | -|reduce | | | | | x | x | -|mask | x | x | x | x | x | x | -|pack | x | x | x | x | x | x | -|pack_u | x | | x | | | | -|pack_b | x | | | | | | -|unpack | x | x | x | x | x | x | -|extract | x | x | x | x | x | x | -|rotate (lanes) | x | x | x | x | x | x | -|cvt_flt32 | | | | | | x | -|cvt_flt64 | | | | | | x | -|transpose4x4 | | | | | x | x | - -Big integers: - -| Operations\\Types | uint 64x2 | int 64x2 | -|-------------------|:-:|:-:| -|load, store | x | x | -|add, sub | x | x | -|shift | x | x | -|logical | x | x | -|extract | x | x | -|rotate (lanes) | x | x | - -Floating point: - -| Operations\\Types | float 32x4 | float 64x2 | -|-------------------|:-:|:-:| -|load, store | x | x | -|interleave | x | | -|add, sub | x | x | -|mul | x | x | -|div | x | x | -|compare | x | x | -|min, max | x | x | -|absdiff | x | x | -|reduce | x | | -|mask | x | x | -|unpack | x | x | -|cvt_flt32 | | x | -|cvt_flt64 | x | | -|sqrt, abs | x | x | -|float math | x | x | -|transpose4x4 | x | | -|extract | x | x | -|rotate (lanes) | x | x | - - @{ */ - -template struct v_reg -{ -//! @cond IGNORED - typedef _Tp lane_type; - enum { nlanes = n }; -// !@endcond - - /** @brief Constructor - - Initializes register with data from memory - @param ptr pointer to memory block with data for register */ - explicit v_reg(const _Tp* ptr) { for( int i = 0; i < n; i++ ) s[i] = ptr[i]; } - - /** @brief Constructor - - Initializes register with two 64-bit values */ - v_reg(_Tp s0, _Tp s1) { s[0] = s0; s[1] = s1; } - - /** @brief Constructor - - Initializes register with four 32-bit values */ - v_reg(_Tp s0, _Tp s1, _Tp s2, _Tp s3) { s[0] = s0; s[1] = s1; s[2] = s2; s[3] = s3; } - - /** @brief Constructor - - Initializes register with eight 16-bit values */ - v_reg(_Tp s0, _Tp s1, _Tp s2, _Tp s3, - _Tp s4, _Tp s5, _Tp s6, _Tp s7) - { - s[0] = s0; s[1] = s1; s[2] = s2; s[3] = s3; - s[4] = s4; s[5] = s5; s[6] = s6; s[7] = s7; - } - - /** @brief Constructor - - Initializes register with sixteen 8-bit values */ - v_reg(_Tp s0, _Tp s1, _Tp s2, _Tp s3, - _Tp s4, _Tp s5, _Tp s6, _Tp s7, - _Tp s8, _Tp s9, _Tp s10, _Tp s11, - _Tp s12, _Tp s13, _Tp s14, _Tp s15) - { - s[0] = s0; s[1] = s1; s[2] = s2; s[3] = s3; - s[4] = s4; s[5] = s5; s[6] = s6; s[7] = s7; - s[8] = s8; s[9] = s9; s[10] = s10; s[11] = s11; - s[12] = s12; s[13] = s13; s[14] = s14; s[15] = s15; - } - - /** @brief Default constructor - - Does not initialize anything*/ - v_reg() {} - - /** @brief Copy constructor */ - v_reg(const v_reg<_Tp, n> & r) - { - for( int i = 0; i < n; i++ ) - s[i] = r.s[i]; - } - /** @brief Access first value - - Returns value of the first lane according to register type, for example: - @code{.cpp} - v_int32x4 r(1, 2, 3, 4); - int v = r.get0(); // returns 1 - v_uint64x2 r(1, 2); - uint64_t v = r.get0(); // returns 1 - @endcode - */ - _Tp get0() const { return s[0]; } - -//! @cond IGNORED - _Tp get(const int i) const { return s[i]; } - v_reg<_Tp, n> high() const - { - v_reg<_Tp, n> c; - int i; - for( i = 0; i < n/2; i++ ) - { - c.s[i] = s[i+(n/2)]; - c.s[i+(n/2)] = 0; - } - return c; - } - - static v_reg<_Tp, n> zero() - { - v_reg<_Tp, n> c; - for( int i = 0; i < n; i++ ) - c.s[i] = (_Tp)0; - return c; - } - - static v_reg<_Tp, n> all(_Tp s) - { - v_reg<_Tp, n> c; - for( int i = 0; i < n; i++ ) - c.s[i] = s; - return c; - } - - template v_reg<_Tp2, n2> reinterpret_as() const - { - size_t bytes = std::min(sizeof(_Tp2)*n2, sizeof(_Tp)*n); - v_reg<_Tp2, n2> c; - std::memcpy(&c.s[0], &s[0], bytes); - return c; - } - - _Tp s[n]; -//! @endcond -}; - -/** @brief Sixteen 8-bit unsigned integer values */ -typedef v_reg v_uint8x16; -/** @brief Sixteen 8-bit signed integer values */ -typedef v_reg v_int8x16; -/** @brief Eight 16-bit unsigned integer values */ -typedef v_reg v_uint16x8; -/** @brief Eight 16-bit signed integer values */ -typedef v_reg v_int16x8; -/** @brief Four 32-bit unsigned integer values */ -typedef v_reg v_uint32x4; -/** @brief Four 32-bit signed integer values */ -typedef v_reg v_int32x4; -/** @brief Four 32-bit floating point values (single precision) */ -typedef v_reg v_float32x4; -/** @brief Two 64-bit floating point values (double precision) */ -typedef v_reg v_float64x2; -/** @brief Two 64-bit unsigned integer values */ -typedef v_reg v_uint64x2; -/** @brief Two 64-bit signed integer values */ -typedef v_reg v_int64x2; - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_BIN_OP(bin_op) \ -template inline v_reg<_Tp, n> \ - operator bin_op (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \ -{ \ - v_reg<_Tp, n> c; \ - for( int i = 0; i < n; i++ ) \ - c.s[i] = saturate_cast<_Tp>(a.s[i] bin_op b.s[i]); \ - return c; \ -} \ -template inline v_reg<_Tp, n>& \ - operator bin_op##= (v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \ -{ \ - for( int i = 0; i < n; i++ ) \ - a.s[i] = saturate_cast<_Tp>(a.s[i] bin_op b.s[i]); \ - return a; \ -} - -/** @brief Add values - -For all types. */ -OPENCV_HAL_IMPL_BIN_OP(+) - -/** @brief Subtract values - -For all types. */ -OPENCV_HAL_IMPL_BIN_OP(-) - -/** @brief Multiply values - -For 16- and 32-bit integer types and floating types. */ -OPENCV_HAL_IMPL_BIN_OP(*) - -/** @brief Divide values - -For floating types only. */ -OPENCV_HAL_IMPL_BIN_OP(/) - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_BIT_OP(bit_op) \ -template inline v_reg<_Tp, n> operator bit_op \ - (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \ -{ \ - v_reg<_Tp, n> c; \ - typedef typename V_TypeTraits<_Tp>::int_type itype; \ - for( int i = 0; i < n; i++ ) \ - c.s[i] = V_TypeTraits<_Tp>::reinterpret_from_int((itype)(V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) bit_op \ - V_TypeTraits<_Tp>::reinterpret_int(b.s[i]))); \ - return c; \ -} \ -template inline v_reg<_Tp, n>& operator \ - bit_op##= (v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \ -{ \ - typedef typename V_TypeTraits<_Tp>::int_type itype; \ - for( int i = 0; i < n; i++ ) \ - a.s[i] = V_TypeTraits<_Tp>::reinterpret_from_int((itype)(V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) bit_op \ - V_TypeTraits<_Tp>::reinterpret_int(b.s[i]))); \ - return a; \ -} - -/** @brief Bitwise AND - -Only for integer types. */ -OPENCV_HAL_IMPL_BIT_OP(&) - -/** @brief Bitwise OR - -Only for integer types. */ -OPENCV_HAL_IMPL_BIT_OP(|) - -/** @brief Bitwise XOR - -Only for integer types.*/ -OPENCV_HAL_IMPL_BIT_OP(^) - -/** @brief Bitwise NOT - -Only for integer types.*/ -template inline v_reg<_Tp, n> operator ~ (const v_reg<_Tp, n>& a) -{ - v_reg<_Tp, n> c; - for( int i = 0; i < n; i++ ) - { - c.s[i] = V_TypeTraits<_Tp>::reinterpret_from_int(~V_TypeTraits<_Tp>::reinterpret_int(a.s[i])); - } - return c; -} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_MATH_FUNC(func, cfunc, _Tp2) \ -template inline v_reg<_Tp2, n> func(const v_reg<_Tp, n>& a) \ -{ \ - v_reg<_Tp2, n> c; \ - for( int i = 0; i < n; i++ ) \ - c.s[i] = cfunc(a.s[i]); \ - return c; \ -} - -/** @brief Square root of elements - -Only for floating point types.*/ -OPENCV_HAL_IMPL_MATH_FUNC(v_sqrt, std::sqrt, _Tp) - -//! @cond IGNORED -OPENCV_HAL_IMPL_MATH_FUNC(v_sin, std::sin, _Tp) -OPENCV_HAL_IMPL_MATH_FUNC(v_cos, std::cos, _Tp) -OPENCV_HAL_IMPL_MATH_FUNC(v_exp, std::exp, _Tp) -OPENCV_HAL_IMPL_MATH_FUNC(v_log, std::log, _Tp) -//! @endcond - -/** @brief Absolute value of elements - -Only for floating point types.*/ -OPENCV_HAL_IMPL_MATH_FUNC(v_abs, (typename V_TypeTraits<_Tp>::abs_type)std::abs, - typename V_TypeTraits<_Tp>::abs_type) - -/** @brief Round elements - -Only for floating point types.*/ -OPENCV_HAL_IMPL_MATH_FUNC(v_round, cvRound, int) - -/** @brief Floor elements - -Only for floating point types.*/ -OPENCV_HAL_IMPL_MATH_FUNC(v_floor, cvFloor, int) - -/** @brief Ceil elements - -Only for floating point types.*/ -OPENCV_HAL_IMPL_MATH_FUNC(v_ceil, cvCeil, int) - -/** @brief Truncate elements - -Only for floating point types.*/ -OPENCV_HAL_IMPL_MATH_FUNC(v_trunc, int, int) - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_MINMAX_FUNC(func, cfunc) \ -template inline v_reg<_Tp, n> func(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \ -{ \ - v_reg<_Tp, n> c; \ - for( int i = 0; i < n; i++ ) \ - c.s[i] = cfunc(a.s[i], b.s[i]); \ - return c; \ -} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_REDUCE_MINMAX_FUNC(func, cfunc) \ -template inline _Tp func(const v_reg<_Tp, n>& a) \ -{ \ - _Tp c = a.s[0]; \ - for( int i = 1; i < n; i++ ) \ - c = cfunc(c, a.s[i]); \ - return c; \ -} - -/** @brief Choose min values for each pair - -Scheme: -@code -{A1 A2 ...} -{B1 B2 ...} --------------- -{min(A1,B1) min(A2,B2) ...} -@endcode -For all types except 64-bit integer. */ -OPENCV_HAL_IMPL_MINMAX_FUNC(v_min, std::min) - -/** @brief Choose max values for each pair - -Scheme: -@code -{A1 A2 ...} -{B1 B2 ...} --------------- -{max(A1,B1) max(A2,B2) ...} -@endcode -For all types except 64-bit integer. */ -OPENCV_HAL_IMPL_MINMAX_FUNC(v_max, std::max) - -/** @brief Find one min value - -Scheme: -@code -{A1 A2 A3 ...} => min(A1,A2,A3,...) -@endcode -For 32-bit integer and 32-bit floating point types. */ -OPENCV_HAL_IMPL_REDUCE_MINMAX_FUNC(v_reduce_min, std::min) - -/** @brief Find one max value - -Scheme: -@code -{A1 A2 A3 ...} => max(A1,A2,A3,...) -@endcode -For 32-bit integer and 32-bit floating point types. */ -OPENCV_HAL_IMPL_REDUCE_MINMAX_FUNC(v_reduce_max, std::max) - -static const unsigned char popCountTable[] = -{ - 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, -}; -/** @brief Count the 1 bits in the vector and return 4 values - -Scheme: -@code -{A1 A2 A3 ...} => popcount(A1) -@endcode -Any types but result will be in v_uint32x4*/ -template inline v_uint32x4 v_popcount(const v_reg<_Tp, n>& a) -{ - v_uint8x16 b; - b = v_reinterpret_as_u8(a); - for( int i = 0; i < v_uint8x16::nlanes; i++ ) - { - b.s[i] = popCountTable[b.s[i]]; - } - v_uint32x4 c; - for( int i = 0; i < v_uint32x4::nlanes; i++ ) - { - c.s[i] = b.s[i*4] + b.s[i*4+1] + b.s[i*4+2] + b.s[i*4+3]; - } - return c; -} - - -//! @cond IGNORED -template -inline void v_minmax( const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b, - v_reg<_Tp, n>& minval, v_reg<_Tp, n>& maxval ) -{ - for( int i = 0; i < n; i++ ) - { - minval.s[i] = std::min(a.s[i], b.s[i]); - maxval.s[i] = std::max(a.s[i], b.s[i]); - } -} -//! @endcond - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_CMP_OP(cmp_op) \ -template \ -inline v_reg<_Tp, n> operator cmp_op(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \ -{ \ - typedef typename V_TypeTraits<_Tp>::int_type itype; \ - v_reg<_Tp, n> c; \ - for( int i = 0; i < n; i++ ) \ - c.s[i] = V_TypeTraits<_Tp>::reinterpret_from_int((itype)-(int)(a.s[i] cmp_op b.s[i])); \ - return c; \ -} - -/** @brief Less-than comparison - -For all types except 64-bit integer values. */ -OPENCV_HAL_IMPL_CMP_OP(<) - -/** @brief Greater-than comparison - -For all types except 64-bit integer values. */ -OPENCV_HAL_IMPL_CMP_OP(>) - -/** @brief Less-than or equal comparison - -For all types except 64-bit integer values. */ -OPENCV_HAL_IMPL_CMP_OP(<=) - -/** @brief Greater-than or equal comparison - -For all types except 64-bit integer values. */ -OPENCV_HAL_IMPL_CMP_OP(>=) - -/** @brief Equal comparison - -For all types except 64-bit integer values. */ -OPENCV_HAL_IMPL_CMP_OP(==) - -/** @brief Not equal comparison - -For all types except 64-bit integer values. */ -OPENCV_HAL_IMPL_CMP_OP(!=) - -template -inline v_reg v_not_nan(const v_reg& a) -{ - typedef typename V_TypeTraits::int_type itype; - v_reg c; - for (int i = 0; i < n; i++) - c.s[i] = V_TypeTraits::reinterpret_from_int((itype)-(int)(a.s[i] == a.s[i])); - return c; -} -template -inline v_reg v_not_nan(const v_reg& a) -{ - typedef typename V_TypeTraits::int_type itype; - v_reg c; - for (int i = 0; i < n; i++) - c.s[i] = V_TypeTraits::reinterpret_from_int((itype)-(int)(a.s[i] == a.s[i])); - return c; -} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_ARITHM_OP(func, bin_op, cast_op, _Tp2) \ -template \ -inline v_reg<_Tp2, n> func(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \ -{ \ - typedef _Tp2 rtype; \ - v_reg c; \ - for( int i = 0; i < n; i++ ) \ - c.s[i] = cast_op(a.s[i] bin_op b.s[i]); \ - return c; \ -} - -/** @brief Add values without saturation - -For 8- and 16-bit integer values. */ -OPENCV_HAL_IMPL_ARITHM_OP(v_add_wrap, +, (_Tp), _Tp) - -/** @brief Subtract values without saturation - -For 8- and 16-bit integer values. */ -OPENCV_HAL_IMPL_ARITHM_OP(v_sub_wrap, -, (_Tp), _Tp) - -/** @brief Multiply values without saturation - -For 8- and 16-bit integer values. */ -OPENCV_HAL_IMPL_ARITHM_OP(v_mul_wrap, *, (_Tp), _Tp) - -//! @cond IGNORED -template inline T _absdiff(T a, T b) -{ - return a > b ? a - b : b - a; -} -//! @endcond - -/** @brief Absolute difference - -Returns \f$ |a - b| \f$ converted to corresponding unsigned type. -Example: -@code{.cpp} -v_int32x4 a, b; // {1, 2, 3, 4} and {4, 3, 2, 1} -v_uint32x4 c = v_absdiff(a, b); // result is {3, 1, 1, 3} -@endcode -For 8-, 16-, 32-bit integer source types. */ -template -inline v_reg::abs_type, n> v_absdiff(const v_reg<_Tp, n>& a, const v_reg<_Tp, n> & b) -{ - typedef typename V_TypeTraits<_Tp>::abs_type rtype; - v_reg c; - const rtype mask = (rtype)(std::numeric_limits<_Tp>::is_signed ? (1 << (sizeof(rtype)*8 - 1)) : 0); - for( int i = 0; i < n; i++ ) - { - rtype ua = a.s[i] ^ mask; - rtype ub = b.s[i] ^ mask; - c.s[i] = _absdiff(ua, ub); - } - return c; -} - -/** @overload - -For 32-bit floating point values */ -inline v_float32x4 v_absdiff(const v_float32x4& a, const v_float32x4& b) -{ - v_float32x4 c; - for( int i = 0; i < c.nlanes; i++ ) - c.s[i] = _absdiff(a.s[i], b.s[i]); - return c; -} - -/** @overload - -For 64-bit floating point values */ -inline v_float64x2 v_absdiff(const v_float64x2& a, const v_float64x2& b) -{ - v_float64x2 c; - for( int i = 0; i < c.nlanes; i++ ) - c.s[i] = _absdiff(a.s[i], b.s[i]); - return c; -} - -/** @brief Saturating absolute difference - -Returns \f$ saturate(|a - b|) \f$ . -For 8-, 16-bit signed integer source types. */ -template -inline v_reg<_Tp, n> v_absdiffs(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) -{ - v_reg<_Tp, n> c; - for( int i = 0; i < n; i++) - c.s[i] = saturate_cast<_Tp>(std::abs(a.s[i] - b.s[i])); - return c; -} - -/** @brief Inversed square root - -Returns \f$ 1/sqrt(a) \f$ -For floating point types only. */ -template -inline v_reg<_Tp, n> v_invsqrt(const v_reg<_Tp, n>& a) -{ - v_reg<_Tp, n> c; - for( int i = 0; i < n; i++ ) - c.s[i] = 1.f/std::sqrt(a.s[i]); - return c; -} - -/** @brief Magnitude - -Returns \f$ sqrt(a^2 + b^2) \f$ -For floating point types only. */ -template -inline v_reg<_Tp, n> v_magnitude(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) -{ - v_reg<_Tp, n> c; - for( int i = 0; i < n; i++ ) - c.s[i] = std::sqrt(a.s[i]*a.s[i] + b.s[i]*b.s[i]); - return c; -} - -/** @brief Square of the magnitude - -Returns \f$ a^2 + b^2 \f$ -For floating point types only. */ -template -inline v_reg<_Tp, n> v_sqr_magnitude(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) -{ - v_reg<_Tp, n> c; - for( int i = 0; i < n; i++ ) - c.s[i] = a.s[i]*a.s[i] + b.s[i]*b.s[i]; - return c; -} - -/** @brief Multiply and add - - Returns \f$ a*b + c \f$ - For floating point types and signed 32bit int only. */ -template -inline v_reg<_Tp, n> v_fma(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b, - const v_reg<_Tp, n>& c) -{ - v_reg<_Tp, n> d; - for( int i = 0; i < n; i++ ) - d.s[i] = a.s[i]*b.s[i] + c.s[i]; - return d; -} - -/** @brief A synonym for v_fma */ -template -inline v_reg<_Tp, n> v_muladd(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b, - const v_reg<_Tp, n>& c) -{ - return v_fma(a, b, c); -} - -/** @brief Dot product of elements - -Multiply values in two registers and sum adjacent result pairs. -Scheme: -@code - {A1 A2 ...} // 16-bit -x {B1 B2 ...} // 16-bit -------------- -{A1B1+A2B2 ...} // 32-bit -@endcode -Implemented only for 16-bit signed source type (v_int16x8). -*/ -template inline v_reg::w_type, n/2> - v_dotprod(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) -{ - typedef typename V_TypeTraits<_Tp>::w_type w_type; - v_reg c; - for( int i = 0; i < (n/2); i++ ) - c.s[i] = (w_type)a.s[i*2]*b.s[i*2] + (w_type)a.s[i*2+1]*b.s[i*2+1]; - return c; -} - -/** @brief Dot product of elements - -Same as cv::v_dotprod, but add a third element to the sum of adjacent pairs. -Scheme: -@code - {A1 A2 ...} // 16-bit -x {B1 B2 ...} // 16-bit -------------- - {A1B1+A2B2+C1 ...} // 32-bit - -@endcode -Implemented only for 16-bit signed source type (v_int16x8). -*/ -template inline v_reg::w_type, n/2> - v_dotprod(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b, const v_reg::w_type, n / 2>& c) -{ - typedef typename V_TypeTraits<_Tp>::w_type w_type; - v_reg s; - for( int i = 0; i < (n/2); i++ ) - s.s[i] = (w_type)a.s[i*2]*b.s[i*2] + (w_type)a.s[i*2+1]*b.s[i*2+1] + c.s[i]; - return s; -} - -/** @brief Multiply and expand - -Multiply values two registers and store results in two registers with wider pack type. -Scheme: -@code - {A B C D} // 32-bit -x {E F G H} // 32-bit ---------------- -{AE BF} // 64-bit - {CG DH} // 64-bit -@endcode -Example: -@code{.cpp} -v_uint32x4 a, b; // {1,2,3,4} and {2,2,2,2} -v_uint64x2 c, d; // results -v_mul_expand(a, b, c, d); // c, d = {2,4}, {6, 8} -@endcode -Implemented only for 16- and unsigned 32-bit source types (v_int16x8, v_uint16x8, v_uint32x4). -*/ -template inline void v_mul_expand(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b, - v_reg::w_type, n/2>& c, - v_reg::w_type, n/2>& d) -{ - typedef typename V_TypeTraits<_Tp>::w_type w_type; - for( int i = 0; i < (n/2); i++ ) - { - c.s[i] = (w_type)a.s[i]*b.s[i]; - d.s[i] = (w_type)a.s[i+(n/2)]*b.s[i+(n/2)]; - } -} - -/** @brief Multiply and extract high part - -Multiply values two registers and store high part of the results. -Implemented only for 16-bit source types (v_int16x8, v_uint16x8). Returns \f$ a*b >> 16 \f$ -*/ -template inline v_reg<_Tp, n> v_mul_hi(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) -{ - typedef typename V_TypeTraits<_Tp>::w_type w_type; - v_reg<_Tp, n> c; - for (int i = 0; i < n; i++) - c.s[i] = (_Tp)(((w_type)a.s[i] * b.s[i]) >> sizeof(_Tp)*8); - return c; -} - -//! @cond IGNORED -template inline void v_hsum(const v_reg<_Tp, n>& a, - v_reg::w_type, n/2>& c) -{ - typedef typename V_TypeTraits<_Tp>::w_type w_type; - for( int i = 0; i < (n/2); i++ ) - { - c.s[i] = (w_type)a.s[i*2] + a.s[i*2+1]; - } -} -//! @endcond - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_SHIFT_OP(shift_op) \ -template inline v_reg<_Tp, n> operator shift_op(const v_reg<_Tp, n>& a, int imm) \ -{ \ - v_reg<_Tp, n> c; \ - for( int i = 0; i < n; i++ ) \ - c.s[i] = (_Tp)(a.s[i] shift_op imm); \ - return c; \ -} - -/** @brief Bitwise shift left - -For 16-, 32- and 64-bit integer values. */ -OPENCV_HAL_IMPL_SHIFT_OP(<< ) - -/** @brief Bitwise shift right - -For 16-, 32- and 64-bit integer values. */ -OPENCV_HAL_IMPL_SHIFT_OP(>> ) - -/** @brief Element shift left among vector - -For all type */ -#define OPENCV_HAL_IMPL_ROTATE_SHIFT_OP(suffix,opA,opB) \ -template inline v_reg<_Tp, n> v_rotate_##suffix(const v_reg<_Tp, n>& a) \ -{ \ - v_reg<_Tp, n> b; \ - for (int i = 0; i < n; i++) \ - { \ - int sIndex = i opA imm; \ - if (0 <= sIndex && sIndex < n) \ - { \ - b.s[i] = a.s[sIndex]; \ - } \ - else \ - { \ - b.s[i] = 0; \ - } \ - } \ - return b; \ -} \ -template inline v_reg<_Tp, n> v_rotate_##suffix(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \ -{ \ - v_reg<_Tp, n> c; \ - for (int i = 0; i < n; i++) \ - { \ - int aIndex = i opA imm; \ - int bIndex = i opA imm opB n; \ - if (0 <= bIndex && bIndex < n) \ - { \ - c.s[i] = b.s[bIndex]; \ - } \ - else if (0 <= aIndex && aIndex < n) \ - { \ - c.s[i] = a.s[aIndex]; \ - } \ - else \ - { \ - c.s[i] = 0; \ - } \ - } \ - return c; \ -} - -OPENCV_HAL_IMPL_ROTATE_SHIFT_OP(left, -, +) -OPENCV_HAL_IMPL_ROTATE_SHIFT_OP(right, +, -) - -/** @brief Sum packed values - -Scheme: -@code -{A1 A2 A3 ...} => sum{A1,A2,A3,...} -@endcode -For 32-bit integer and 32-bit floating point types.*/ -template inline typename V_TypeTraits<_Tp>::sum_type v_reduce_sum(const v_reg<_Tp, n>& a) -{ - typename V_TypeTraits<_Tp>::sum_type c = a.s[0]; - for( int i = 1; i < n; i++ ) - c += a.s[i]; - return c; -} - -/** @brief Sums all elements of each input vector, returns the vector of sums - - Scheme: - @code - result[0] = a[0] + a[1] + a[2] + a[3] - result[1] = b[0] + b[1] + b[2] + b[3] - result[2] = c[0] + c[1] + c[2] + c[3] - result[3] = d[0] + d[1] + d[2] + d[3] - @endcode -*/ -inline v_float32x4 v_reduce_sum4(const v_float32x4& a, const v_float32x4& b, - const v_float32x4& c, const v_float32x4& d) -{ - v_float32x4 r; - r.s[0] = a.s[0] + a.s[1] + a.s[2] + a.s[3]; - r.s[1] = b.s[0] + b.s[1] + b.s[2] + b.s[3]; - r.s[2] = c.s[0] + c.s[1] + c.s[2] + c.s[3]; - r.s[3] = d.s[0] + d.s[1] + d.s[2] + d.s[3]; - return r; -} - -/** @brief Sum absolute differences of values - -Scheme: -@code -{A1 A2 A3 ...} {B1 B2 B3 ...} => sum{ABS(A1-B1),abs(A2-B2),abs(A3-B3),...} -@endcode -For all types except 64-bit types.*/ -template inline typename V_TypeTraits< typename V_TypeTraits<_Tp>::abs_type >::sum_type v_reduce_sad(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) -{ - typename V_TypeTraits< typename V_TypeTraits<_Tp>::abs_type >::sum_type c = _absdiff(a.s[0], b.s[0]); - for (int i = 1; i < n; i++) - c += _absdiff(a.s[i], b.s[i]); - return c; -} - -/** @brief Get negative values mask - -Returned value is a bit mask with bits set to 1 on places corresponding to negative packed values indexes. -Example: -@code{.cpp} -v_int32x4 r; // set to {-1, -1, 1, 1} -int mask = v_signmask(r); // mask = 3 <== 00000000 00000000 00000000 00000011 -@endcode -For all types except 64-bit. */ -template inline int v_signmask(const v_reg<_Tp, n>& a) -{ - int mask = 0; - for( int i = 0; i < n; i++ ) - mask |= (V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) < 0) << i; - return mask; -} - -/** @brief Check if all packed values are less than zero - -Unsigned values will be casted to signed: `uchar 254 => char -2`. -For all types except 64-bit. */ -template inline bool v_check_all(const v_reg<_Tp, n>& a) -{ - for( int i = 0; i < n; i++ ) - if( V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) >= 0 ) - return false; - return true; -} - -/** @brief Check if any of packed values is less than zero - -Unsigned values will be casted to signed: `uchar 254 => char -2`. -For all types except 64-bit. */ -template inline bool v_check_any(const v_reg<_Tp, n>& a) -{ - for( int i = 0; i < n; i++ ) - if( V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) < 0 ) - return true; - return false; -} - -/** @brief Per-element select (blend operation) - -Return value will be built by combining values _a_ and _b_ using the following scheme: - result[i] = mask[i] ? a[i] : b[i]; - -@note: _mask_ element values are restricted to these values: -- 0: select element from _b_ -- 0xff/0xffff/etc: select element from _a_ -(fully compatible with bitwise-based operator) -*/ -template inline v_reg<_Tp, n> v_select(const v_reg<_Tp, n>& mask, - const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) -{ - typedef V_TypeTraits<_Tp> Traits; - typedef typename Traits::int_type int_type; - v_reg<_Tp, n> c; - for( int i = 0; i < n; i++ ) - { - int_type m = Traits::reinterpret_int(mask.s[i]); - CV_DbgAssert(m == 0 || m == (~(int_type)0)); // restrict mask values: 0 or 0xff/0xffff/etc - c.s[i] = m ? a.s[i] : b.s[i]; - } - return c; -} - -/** @brief Expand values to the wider pack type - -Copy contents of register to two registers with 2x wider pack type. -Scheme: -@code - int32x4 int64x2 int64x2 -{A B C D} ==> {A B} , {C D} -@endcode */ -template inline void v_expand(const v_reg<_Tp, n>& a, - v_reg::w_type, n/2>& b0, - v_reg::w_type, n/2>& b1) -{ - for( int i = 0; i < (n/2); i++ ) - { - b0.s[i] = a.s[i]; - b1.s[i] = a.s[i+(n/2)]; - } -} - -/** @brief Expand lower values to the wider pack type - -Same as cv::v_expand, but return lower half of the vector. - -Scheme: -@code - int32x4 int64x2 -{A B C D} ==> {A B} -@endcode */ -template -inline v_reg::w_type, n/2> -v_expand_low(const v_reg<_Tp, n>& a) -{ - v_reg::w_type, n/2> b; - for( int i = 0; i < (n/2); i++ ) - b.s[i] = a.s[i]; - return b; -} - -/** @brief Expand higher values to the wider pack type - -Same as cv::v_expand_low, but expand higher half of the vector instead. - -Scheme: -@code - int32x4 int64x2 -{A B C D} ==> {C D} -@endcode */ -template -inline v_reg::w_type, n/2> -v_expand_high(const v_reg<_Tp, n>& a) -{ - v_reg::w_type, n/2> b; - for( int i = 0; i < (n/2); i++ ) - b.s[i] = a.s[i+(n/2)]; - return b; -} - -//! @cond IGNORED -template inline v_reg::int_type, n> - v_reinterpret_as_int(const v_reg<_Tp, n>& a) -{ - v_reg::int_type, n> c; - for( int i = 0; i < n; i++ ) - c.s[i] = V_TypeTraits<_Tp>::reinterpret_int(a.s[i]); - return c; -} - -template inline v_reg::uint_type, n> - v_reinterpret_as_uint(const v_reg<_Tp, n>& a) -{ - v_reg::uint_type, n> c; - for( int i = 0; i < n; i++ ) - c.s[i] = V_TypeTraits<_Tp>::reinterpret_uint(a.s[i]); - return c; -} -//! @endcond - -/** @brief Interleave two vectors - -Scheme: -@code - {A1 A2 A3 A4} - {B1 B2 B3 B4} ---------------- - {A1 B1 A2 B2} and {A3 B3 A4 B4} -@endcode -For all types except 64-bit. -*/ -template inline void v_zip( const v_reg<_Tp, n>& a0, const v_reg<_Tp, n>& a1, - v_reg<_Tp, n>& b0, v_reg<_Tp, n>& b1 ) -{ - int i; - for( i = 0; i < n/2; i++ ) - { - b0.s[i*2] = a0.s[i]; - b0.s[i*2+1] = a1.s[i]; - } - for( ; i < n; i++ ) - { - b1.s[i*2-n] = a0.s[i]; - b1.s[i*2-n+1] = a1.s[i]; - } -} - -/** @brief Load register contents from memory - -@param ptr pointer to memory block with data -@return register object - -@note Returned type will be detected from passed pointer type, for example uchar ==> cv::v_uint8x16, int ==> cv::v_int32x4, etc. - */ -template -inline v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128> v_load(const _Tp* ptr) -{ - return v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128>(ptr); -} - -/** @brief Load register contents from memory (aligned) - -similar to cv::v_load, but source memory block should be aligned (to 16-byte boundary) - */ -template -inline v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128> v_load_aligned(const _Tp* ptr) -{ - return v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128>(ptr); -} - -/** @brief Load 64-bits of data to lower part (high part is undefined). - -@param ptr memory block containing data for first half (0..n/2) - -@code{.cpp} -int lo[2] = { 1, 2 }; -v_int32x4 r = v_load_low(lo); -@endcode - */ -template -inline v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128> v_load_low(const _Tp* ptr) -{ - v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128> c; - for( int i = 0; i < c.nlanes/2; i++ ) - { - c.s[i] = ptr[i]; - } - return c; -} - -/** @brief Load register contents from two memory blocks - -@param loptr memory block containing data for first half (0..n/2) -@param hiptr memory block containing data for second half (n/2..n) - -@code{.cpp} -int lo[2] = { 1, 2 }, hi[2] = { 3, 4 }; -v_int32x4 r = v_load_halves(lo, hi); -@endcode - */ -template -inline v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128> v_load_halves(const _Tp* loptr, const _Tp* hiptr) -{ - v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128> c; - for( int i = 0; i < c.nlanes/2; i++ ) - { - c.s[i] = loptr[i]; - c.s[i+c.nlanes/2] = hiptr[i]; - } - return c; -} - -/** @brief Load register contents from memory with double expand - -Same as cv::v_load, but result pack type will be 2x wider than memory type. - -@code{.cpp} -short buf[4] = {1, 2, 3, 4}; // type is int16 -v_int32x4 r = v_load_expand(buf); // r = {1, 2, 3, 4} - type is int32 -@endcode -For 8-, 16-, 32-bit integer source types. */ -template -inline v_reg::w_type, V_TypeTraits<_Tp>::nlanes128 / 2> -v_load_expand(const _Tp* ptr) -{ - typedef typename V_TypeTraits<_Tp>::w_type w_type; - v_reg::nlanes128> c; - for( int i = 0; i < c.nlanes; i++ ) - { - c.s[i] = ptr[i]; - } - return c; -} - -/** @brief Load register contents from memory with quad expand - -Same as cv::v_load_expand, but result type is 4 times wider than source. -@code{.cpp} -char buf[4] = {1, 2, 3, 4}; // type is int8 -v_int32x4 r = v_load_q(buf); // r = {1, 2, 3, 4} - type is int32 -@endcode -For 8-bit integer source types. */ -template -inline v_reg::q_type, V_TypeTraits<_Tp>::nlanes128 / 4> -v_load_expand_q(const _Tp* ptr) -{ - typedef typename V_TypeTraits<_Tp>::q_type q_type; - v_reg::nlanes128> c; - for( int i = 0; i < c.nlanes; i++ ) - { - c.s[i] = ptr[i]; - } - return c; -} - -/** @brief Load and deinterleave (2 channels) - -Load data from memory deinterleave and store to 2 registers. -Scheme: -@code -{A1 B1 A2 B2 ...} ==> {A1 A2 ...}, {B1 B2 ...} -@endcode -For all types except 64-bit. */ -template inline void v_load_deinterleave(const _Tp* ptr, v_reg<_Tp, n>& a, - v_reg<_Tp, n>& b) -{ - int i, i2; - for( i = i2 = 0; i < n; i++, i2 += 2 ) - { - a.s[i] = ptr[i2]; - b.s[i] = ptr[i2+1]; - } -} - -/** @brief Load and deinterleave (3 channels) - -Load data from memory deinterleave and store to 3 registers. -Scheme: -@code -{A1 B1 C1 A2 B2 C2 ...} ==> {A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...} -@endcode -For all types except 64-bit. */ -template inline void v_load_deinterleave(const _Tp* ptr, v_reg<_Tp, n>& a, - v_reg<_Tp, n>& b, v_reg<_Tp, n>& c) -{ - int i, i3; - for( i = i3 = 0; i < n; i++, i3 += 3 ) - { - a.s[i] = ptr[i3]; - b.s[i] = ptr[i3+1]; - c.s[i] = ptr[i3+2]; - } -} - -/** @brief Load and deinterleave (4 channels) - -Load data from memory deinterleave and store to 4 registers. -Scheme: -@code -{A1 B1 C1 D1 A2 B2 C2 D2 ...} ==> {A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}, {D1 D2 ...} -@endcode -For all types except 64-bit. */ -template -inline void v_load_deinterleave(const _Tp* ptr, v_reg<_Tp, n>& a, - v_reg<_Tp, n>& b, v_reg<_Tp, n>& c, - v_reg<_Tp, n>& d) -{ - int i, i4; - for( i = i4 = 0; i < n; i++, i4 += 4 ) - { - a.s[i] = ptr[i4]; - b.s[i] = ptr[i4+1]; - c.s[i] = ptr[i4+2]; - d.s[i] = ptr[i4+3]; - } -} - -/** @brief Interleave and store (2 channels) - -Interleave and store data from 2 registers to memory. -Scheme: -@code -{A1 A2 ...}, {B1 B2 ...} ==> {A1 B1 A2 B2 ...} -@endcode -For all types except 64-bit. */ -template -inline void v_store_interleave( _Tp* ptr, const v_reg<_Tp, n>& a, - const v_reg<_Tp, n>& b, - hal::StoreMode /*mode*/=hal::STORE_UNALIGNED) -{ - int i, i2; - for( i = i2 = 0; i < n; i++, i2 += 2 ) - { - ptr[i2] = a.s[i]; - ptr[i2+1] = b.s[i]; - } -} - -/** @brief Interleave and store (3 channels) - -Interleave and store data from 3 registers to memory. -Scheme: -@code -{A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...} ==> {A1 B1 C1 A2 B2 C2 ...} -@endcode -For all types except 64-bit. */ -template -inline void v_store_interleave( _Tp* ptr, const v_reg<_Tp, n>& a, - const v_reg<_Tp, n>& b, const v_reg<_Tp, n>& c, - hal::StoreMode /*mode*/=hal::STORE_UNALIGNED) -{ - int i, i3; - for( i = i3 = 0; i < n; i++, i3 += 3 ) - { - ptr[i3] = a.s[i]; - ptr[i3+1] = b.s[i]; - ptr[i3+2] = c.s[i]; - } -} - -/** @brief Interleave and store (4 channels) - -Interleave and store data from 4 registers to memory. -Scheme: -@code -{A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}, {D1 D2 ...} ==> {A1 B1 C1 D1 A2 B2 C2 D2 ...} -@endcode -For all types except 64-bit. */ -template inline void v_store_interleave( _Tp* ptr, const v_reg<_Tp, n>& a, - const v_reg<_Tp, n>& b, const v_reg<_Tp, n>& c, - const v_reg<_Tp, n>& d, - hal::StoreMode /*mode*/=hal::STORE_UNALIGNED) -{ - int i, i4; - for( i = i4 = 0; i < n; i++, i4 += 4 ) - { - ptr[i4] = a.s[i]; - ptr[i4+1] = b.s[i]; - ptr[i4+2] = c.s[i]; - ptr[i4+3] = d.s[i]; - } -} - -/** @brief Store data to memory - -Store register contents to memory. -Scheme: -@code - REG {A B C D} ==> MEM {A B C D} -@endcode -Pointer can be unaligned. */ -template -inline void v_store(_Tp* ptr, const v_reg<_Tp, n>& a) -{ - for( int i = 0; i < n; i++ ) - ptr[i] = a.s[i]; -} - -/** @brief Store data to memory (lower half) - -Store lower half of register contents to memory. -Scheme: -@code - REG {A B C D} ==> MEM {A B} -@endcode */ -template -inline void v_store_low(_Tp* ptr, const v_reg<_Tp, n>& a) -{ - for( int i = 0; i < (n/2); i++ ) - ptr[i] = a.s[i]; -} - -/** @brief Store data to memory (higher half) - -Store higher half of register contents to memory. -Scheme: -@code - REG {A B C D} ==> MEM {C D} -@endcode */ -template -inline void v_store_high(_Tp* ptr, const v_reg<_Tp, n>& a) -{ - for( int i = 0; i < (n/2); i++ ) - ptr[i] = a.s[i+(n/2)]; -} - -/** @brief Store data to memory (aligned) - -Store register contents to memory. -Scheme: -@code - REG {A B C D} ==> MEM {A B C D} -@endcode -Pointer __should__ be aligned by 16-byte boundary. */ -template -inline void v_store_aligned(_Tp* ptr, const v_reg<_Tp, n>& a) -{ - for( int i = 0; i < n; i++ ) - ptr[i] = a.s[i]; -} - -template -inline void v_store_aligned_nocache(_Tp* ptr, const v_reg<_Tp, n>& a) -{ - for( int i = 0; i < n; i++ ) - ptr[i] = a.s[i]; -} - -template -inline void v_store_aligned(_Tp* ptr, const v_reg<_Tp, n>& a, hal::StoreMode /*mode*/) -{ - for( int i = 0; i < n; i++ ) - ptr[i] = a.s[i]; -} - -/** @brief Combine vector from first elements of two vectors - -Scheme: -@code - {A1 A2 A3 A4} - {B1 B2 B3 B4} ---------------- - {A1 A2 B1 B2} -@endcode -For all types except 64-bit. */ -template -inline v_reg<_Tp, n> v_combine_low(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) -{ - v_reg<_Tp, n> c; - for( int i = 0; i < (n/2); i++ ) - { - c.s[i] = a.s[i]; - c.s[i+(n/2)] = b.s[i]; - } - return c; -} - -/** @brief Combine vector from last elements of two vectors - -Scheme: -@code - {A1 A2 A3 A4} - {B1 B2 B3 B4} ---------------- - {A3 A4 B3 B4} -@endcode -For all types except 64-bit. */ -template -inline v_reg<_Tp, n> v_combine_high(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) -{ - v_reg<_Tp, n> c; - for( int i = 0; i < (n/2); i++ ) - { - c.s[i] = a.s[i+(n/2)]; - c.s[i+(n/2)] = b.s[i+(n/2)]; - } - return c; -} - -/** @brief Combine two vectors from lower and higher parts of two other vectors - -@code{.cpp} -low = cv::v_combine_low(a, b); -high = cv::v_combine_high(a, b); -@endcode */ -template -inline void v_recombine(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b, - v_reg<_Tp, n>& low, v_reg<_Tp, n>& high) -{ - for( int i = 0; i < (n/2); i++ ) - { - low.s[i] = a.s[i]; - low.s[i+(n/2)] = b.s[i]; - high.s[i] = a.s[i+(n/2)]; - high.s[i+(n/2)] = b.s[i+(n/2)]; - } -} - -/** @brief Vector extract - -Scheme: -@code - {A1 A2 A3 A4} - {B1 B2 B3 B4} -======================== -shift = 1 {A2 A3 A4 B1} -shift = 2 {A3 A4 B1 B2} -shift = 3 {A4 B1 B2 B3} -@endcode -Restriction: 0 <= shift < nlanes - -Usage: -@code -v_int32x4 a, b, c; -c = v_extract<2>(a, b); -@endcode -For all types. */ -template -inline v_reg<_Tp, n> v_extract(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) -{ - v_reg<_Tp, n> r; - const int shift = n - s; - int i = 0; - for (; i < shift; ++i) - r.s[i] = a.s[i+s]; - for (; i < n; ++i) - r.s[i] = b.s[i-shift]; - return r; -} - -/** @brief Round - -Rounds each value. Input type is float vector ==> output type is int vector.*/ -template inline v_reg v_round(const v_reg& a) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - c.s[i] = cvRound(a.s[i]); - return c; -} - -/** @overload */ -template inline v_reg v_round(const v_reg& a, const v_reg& b) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - { - c.s[i] = cvRound(a.s[i]); - c.s[i+n] = cvRound(b.s[i]); - } - return c; -} - -/** @brief Floor - -Floor each value. Input type is float vector ==> output type is int vector.*/ -template inline v_reg v_floor(const v_reg& a) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - c.s[i] = cvFloor(a.s[i]); - return c; -} - -/** @brief Ceil - -Ceil each value. Input type is float vector ==> output type is int vector.*/ -template inline v_reg v_ceil(const v_reg& a) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - c.s[i] = cvCeil(a.s[i]); - return c; -} - -/** @brief Trunc - -Truncate each value. Input type is float vector ==> output type is int vector.*/ -template inline v_reg v_trunc(const v_reg& a) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - c.s[i] = (int)(a.s[i]); - return c; -} - -/** @overload */ -template inline v_reg v_round(const v_reg& a) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - { - c.s[i] = cvRound(a.s[i]); - c.s[i+n] = 0; - } - return c; -} - -/** @overload */ -template inline v_reg v_floor(const v_reg& a) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - { - c.s[i] = cvFloor(a.s[i]); - c.s[i+n] = 0; - } - return c; -} - -/** @overload */ -template inline v_reg v_ceil(const v_reg& a) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - { - c.s[i] = cvCeil(a.s[i]); - c.s[i+n] = 0; - } - return c; -} - -/** @overload */ -template inline v_reg v_trunc(const v_reg& a) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - { - c.s[i] = cvCeil(a.s[i]); - c.s[i+n] = 0; - } - return c; -} - -/** @brief Convert to float - -Supported input type is cv::v_int32x4. */ -template inline v_reg v_cvt_f32(const v_reg& a) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - c.s[i] = (float)a.s[i]; - return c; -} - -template inline v_reg v_cvt_f32(const v_reg& a, const v_reg& b) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - { - c.s[i] = (float)a.s[i]; - c.s[i+n] = (float)b.s[i]; - } - return c; -} - -/** @brief Convert to double - -Supported input type is cv::v_int32x4. */ -template inline v_reg v_cvt_f64(const v_reg& a) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - c.s[i] = (double)a.s[i]; - return c; -} - -/** @brief Convert to double - -Supported input type is cv::v_float32x4. */ -template inline v_reg v_cvt_f64(const v_reg& a) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - c.s[i] = (double)a.s[i]; - return c; -} - -template inline v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128> v_lut(const _Tp* tab, const int* idx) -{ - v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128> c; - for (int i = 0; i < V_TypeTraits<_Tp>::nlanes128; i++) - c.s[i] = tab[idx[i]]; - return c; -} -template inline v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128> v_lut_pairs(const _Tp* tab, const int* idx) -{ - v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128> c; - for (int i = 0; i < V_TypeTraits<_Tp>::nlanes128; i++) - c.s[i] = tab[idx[i / 2] + i % 2]; - return c; -} -template inline v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128> v_lut_quads(const _Tp* tab, const int* idx) -{ - v_reg<_Tp, V_TypeTraits<_Tp>::nlanes128> c; - for (int i = 0; i < V_TypeTraits<_Tp>::nlanes128; i++) - c.s[i] = tab[idx[i / 4] + i % 4]; - return c; -} - -template inline v_reg v_lut(const int* tab, const v_reg& idx) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - c.s[i] = tab[idx.s[i]]; - return c; -} - -template inline v_reg v_lut(const unsigned* tab, const v_reg& idx) -{ - v_reg c; - for (int i = 0; i < n; i++) - c.s[i] = tab[idx.s[i]]; - return c; -} - -template inline v_reg v_lut(const float* tab, const v_reg& idx) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - c.s[i] = tab[idx.s[i]]; - return c; -} - -template inline v_reg v_lut(const double* tab, const v_reg& idx) -{ - v_reg c; - for( int i = 0; i < n; i++ ) - c.s[i] = tab[idx.s[i]]; - return c; -} - -template inline void v_lut_deinterleave(const float* tab, const v_reg& idx, - v_reg& x, v_reg& y) -{ - for( int i = 0; i < n; i++ ) - { - int j = idx.s[i]; - x.s[i] = tab[j]; - y.s[i] = tab[j+1]; - } -} - -template inline void v_lut_deinterleave(const double* tab, const v_reg& idx, - v_reg& x, v_reg& y) -{ - for( int i = 0; i < n; i++ ) - { - int j = idx.s[i]; - x.s[i] = tab[j]; - y.s[i] = tab[j+1]; - } -} - -template inline v_reg<_Tp, n> v_interleave_pairs(const v_reg<_Tp, n>& vec) -{ - v_reg c; - for (int i = 0; i < n/4; i++) - { - c.s[4*i ] = vec.s[4*i ]; - c.s[4*i+1] = vec.s[4*i+2]; - c.s[4*i+2] = vec.s[4*i+1]; - c.s[4*i+3] = vec.s[4*i+3]; - } - return c; -} - -template inline v_reg<_Tp, n> v_interleave_quads(const v_reg<_Tp, n>& vec) -{ - v_reg c; - for (int i = 0; i < n/8; i++) - { - c.s[8*i ] = vec.s[8*i ]; - c.s[8*i+1] = vec.s[8*i+4]; - c.s[8*i+2] = vec.s[8*i+1]; - c.s[8*i+3] = vec.s[8*i+5]; - c.s[8*i+4] = vec.s[8*i+2]; - c.s[8*i+5] = vec.s[8*i+6]; - c.s[8*i+6] = vec.s[8*i+3]; - c.s[8*i+7] = vec.s[8*i+7]; - } - return c; -} - -template inline v_reg<_Tp, n> v_pack_triplets(const v_reg<_Tp, n>& vec) -{ - v_reg c; - for (int i = 0; i < n/4; i++) - { - c.s[3*i ] = vec.s[4*i ]; - c.s[3*i+1] = vec.s[4*i+1]; - c.s[3*i+2] = vec.s[4*i+2]; - } - return c; -} - -/** @brief Transpose 4x4 matrix - -Scheme: -@code -a0 {A1 A2 A3 A4} -a1 {B1 B2 B3 B4} -a2 {C1 C2 C3 C4} -a3 {D1 D2 D3 D4} -=============== -b0 {A1 B1 C1 D1} -b1 {A2 B2 C2 D2} -b2 {A3 B3 C3 D3} -b3 {A4 B4 C4 D4} -@endcode -*/ -template -inline void v_transpose4x4( v_reg<_Tp, 4>& a0, const v_reg<_Tp, 4>& a1, - const v_reg<_Tp, 4>& a2, const v_reg<_Tp, 4>& a3, - v_reg<_Tp, 4>& b0, v_reg<_Tp, 4>& b1, - v_reg<_Tp, 4>& b2, v_reg<_Tp, 4>& b3 ) -{ - b0 = v_reg<_Tp, 4>(a0.s[0], a1.s[0], a2.s[0], a3.s[0]); - b1 = v_reg<_Tp, 4>(a0.s[1], a1.s[1], a2.s[1], a3.s[1]); - b2 = v_reg<_Tp, 4>(a0.s[2], a1.s[2], a2.s[2], a3.s[2]); - b3 = v_reg<_Tp, 4>(a0.s[3], a1.s[3], a2.s[3], a3.s[3]); -} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_C_INIT_ZERO(_Tpvec, _Tp, suffix) \ -inline _Tpvec v_setzero_##suffix() { return _Tpvec::zero(); } - -//! @name Init with zero -//! @{ -//! @brief Create new vector with zero elements -OPENCV_HAL_IMPL_C_INIT_ZERO(v_uint8x16, uchar, u8) -OPENCV_HAL_IMPL_C_INIT_ZERO(v_int8x16, schar, s8) -OPENCV_HAL_IMPL_C_INIT_ZERO(v_uint16x8, ushort, u16) -OPENCV_HAL_IMPL_C_INIT_ZERO(v_int16x8, short, s16) -OPENCV_HAL_IMPL_C_INIT_ZERO(v_uint32x4, unsigned, u32) -OPENCV_HAL_IMPL_C_INIT_ZERO(v_int32x4, int, s32) -OPENCV_HAL_IMPL_C_INIT_ZERO(v_float32x4, float, f32) -OPENCV_HAL_IMPL_C_INIT_ZERO(v_float64x2, double, f64) -OPENCV_HAL_IMPL_C_INIT_ZERO(v_uint64x2, uint64, u64) -OPENCV_HAL_IMPL_C_INIT_ZERO(v_int64x2, int64, s64) -//! @} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_C_INIT_VAL(_Tpvec, _Tp, suffix) \ -inline _Tpvec v_setall_##suffix(_Tp val) { return _Tpvec::all(val); } - -//! @name Init with value -//! @{ -//! @brief Create new vector with elements set to a specific value -OPENCV_HAL_IMPL_C_INIT_VAL(v_uint8x16, uchar, u8) -OPENCV_HAL_IMPL_C_INIT_VAL(v_int8x16, schar, s8) -OPENCV_HAL_IMPL_C_INIT_VAL(v_uint16x8, ushort, u16) -OPENCV_HAL_IMPL_C_INIT_VAL(v_int16x8, short, s16) -OPENCV_HAL_IMPL_C_INIT_VAL(v_uint32x4, unsigned, u32) -OPENCV_HAL_IMPL_C_INIT_VAL(v_int32x4, int, s32) -OPENCV_HAL_IMPL_C_INIT_VAL(v_float32x4, float, f32) -OPENCV_HAL_IMPL_C_INIT_VAL(v_float64x2, double, f64) -OPENCV_HAL_IMPL_C_INIT_VAL(v_uint64x2, uint64, u64) -OPENCV_HAL_IMPL_C_INIT_VAL(v_int64x2, int64, s64) -//! @} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_C_REINTERPRET(_Tpvec, _Tp, suffix) \ -template inline _Tpvec \ - v_reinterpret_as_##suffix(const v_reg<_Tp0, n0>& a) \ -{ return a.template reinterpret_as<_Tp, _Tpvec::nlanes>(); } - -//! @name Reinterpret -//! @{ -//! @brief Convert vector to different type without modifying underlying data. -OPENCV_HAL_IMPL_C_REINTERPRET(v_uint8x16, uchar, u8) -OPENCV_HAL_IMPL_C_REINTERPRET(v_int8x16, schar, s8) -OPENCV_HAL_IMPL_C_REINTERPRET(v_uint16x8, ushort, u16) -OPENCV_HAL_IMPL_C_REINTERPRET(v_int16x8, short, s16) -OPENCV_HAL_IMPL_C_REINTERPRET(v_uint32x4, unsigned, u32) -OPENCV_HAL_IMPL_C_REINTERPRET(v_int32x4, int, s32) -OPENCV_HAL_IMPL_C_REINTERPRET(v_float32x4, float, f32) -OPENCV_HAL_IMPL_C_REINTERPRET(v_float64x2, double, f64) -OPENCV_HAL_IMPL_C_REINTERPRET(v_uint64x2, uint64, u64) -OPENCV_HAL_IMPL_C_REINTERPRET(v_int64x2, int64, s64) -//! @} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_C_SHIFTL(_Tpvec, _Tp) \ -template inline _Tpvec v_shl(const _Tpvec& a) \ -{ return a << n; } - -//! @name Left shift -//! @{ -//! @brief Shift left -OPENCV_HAL_IMPL_C_SHIFTL(v_uint16x8, ushort) -OPENCV_HAL_IMPL_C_SHIFTL(v_int16x8, short) -OPENCV_HAL_IMPL_C_SHIFTL(v_uint32x4, unsigned) -OPENCV_HAL_IMPL_C_SHIFTL(v_int32x4, int) -OPENCV_HAL_IMPL_C_SHIFTL(v_uint64x2, uint64) -OPENCV_HAL_IMPL_C_SHIFTL(v_int64x2, int64) -//! @} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_C_SHIFTR(_Tpvec, _Tp) \ -template inline _Tpvec v_shr(const _Tpvec& a) \ -{ return a >> n; } - -//! @name Right shift -//! @{ -//! @brief Shift right -OPENCV_HAL_IMPL_C_SHIFTR(v_uint16x8, ushort) -OPENCV_HAL_IMPL_C_SHIFTR(v_int16x8, short) -OPENCV_HAL_IMPL_C_SHIFTR(v_uint32x4, unsigned) -OPENCV_HAL_IMPL_C_SHIFTR(v_int32x4, int) -OPENCV_HAL_IMPL_C_SHIFTR(v_uint64x2, uint64) -OPENCV_HAL_IMPL_C_SHIFTR(v_int64x2, int64) -//! @} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_C_RSHIFTR(_Tpvec, _Tp) \ -template inline _Tpvec v_rshr(const _Tpvec& a) \ -{ \ - _Tpvec c; \ - for( int i = 0; i < _Tpvec::nlanes; i++ ) \ - c.s[i] = (_Tp)((a.s[i] + ((_Tp)1 << (n - 1))) >> n); \ - return c; \ -} - -//! @name Rounding shift -//! @{ -//! @brief Rounding shift right -OPENCV_HAL_IMPL_C_RSHIFTR(v_uint16x8, ushort) -OPENCV_HAL_IMPL_C_RSHIFTR(v_int16x8, short) -OPENCV_HAL_IMPL_C_RSHIFTR(v_uint32x4, unsigned) -OPENCV_HAL_IMPL_C_RSHIFTR(v_int32x4, int) -OPENCV_HAL_IMPL_C_RSHIFTR(v_uint64x2, uint64) -OPENCV_HAL_IMPL_C_RSHIFTR(v_int64x2, int64) -//! @} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_C_PACK(_Tpvec, _Tpnvec, _Tpn, pack_suffix, cast) \ -inline _Tpnvec v_##pack_suffix(const _Tpvec& a, const _Tpvec& b) \ -{ \ - _Tpnvec c; \ - for( int i = 0; i < _Tpvec::nlanes; i++ ) \ - { \ - c.s[i] = cast<_Tpn>(a.s[i]); \ - c.s[i+_Tpvec::nlanes] = cast<_Tpn>(b.s[i]); \ - } \ - return c; \ -} - -//! @name Pack -//! @{ -//! @brief Pack values from two vectors to one -//! -//! Return vector type have twice more elements than input vector types. Variant with _u_ suffix also -//! converts to corresponding unsigned type. -//! -//! - pack: for 16-, 32- and 64-bit integer input types -//! - pack_u: for 16- and 32-bit signed integer input types -//! -//! @note All variants except 64-bit use saturation. -OPENCV_HAL_IMPL_C_PACK(v_uint16x8, v_uint8x16, uchar, pack, saturate_cast) -OPENCV_HAL_IMPL_C_PACK(v_int16x8, v_int8x16, schar, pack, saturate_cast) -OPENCV_HAL_IMPL_C_PACK(v_uint32x4, v_uint16x8, ushort, pack, saturate_cast) -OPENCV_HAL_IMPL_C_PACK(v_int32x4, v_int16x8, short, pack, saturate_cast) -OPENCV_HAL_IMPL_C_PACK(v_uint64x2, v_uint32x4, unsigned, pack, static_cast) -OPENCV_HAL_IMPL_C_PACK(v_int64x2, v_int32x4, int, pack, static_cast) -OPENCV_HAL_IMPL_C_PACK(v_int16x8, v_uint8x16, uchar, pack_u, saturate_cast) -OPENCV_HAL_IMPL_C_PACK(v_int32x4, v_uint16x8, ushort, pack_u, saturate_cast) -//! @} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_C_RSHR_PACK(_Tpvec, _Tp, _Tpnvec, _Tpn, pack_suffix, cast) \ -template inline _Tpnvec v_rshr_##pack_suffix(const _Tpvec& a, const _Tpvec& b) \ -{ \ - _Tpnvec c; \ - for( int i = 0; i < _Tpvec::nlanes; i++ ) \ - { \ - c.s[i] = cast<_Tpn>((a.s[i] + ((_Tp)1 << (n - 1))) >> n); \ - c.s[i+_Tpvec::nlanes] = cast<_Tpn>((b.s[i] + ((_Tp)1 << (n - 1))) >> n); \ - } \ - return c; \ -} - -//! @name Pack with rounding shift -//! @{ -//! @brief Pack values from two vectors to one with rounding shift -//! -//! Values from the input vectors will be shifted right by _n_ bits with rounding, converted to narrower -//! type and returned in the result vector. Variant with _u_ suffix converts to unsigned type. -//! -//! - pack: for 16-, 32- and 64-bit integer input types -//! - pack_u: for 16- and 32-bit signed integer input types -//! -//! @note All variants except 64-bit use saturation. -OPENCV_HAL_IMPL_C_RSHR_PACK(v_uint16x8, ushort, v_uint8x16, uchar, pack, saturate_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK(v_int16x8, short, v_int8x16, schar, pack, saturate_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK(v_uint32x4, unsigned, v_uint16x8, ushort, pack, saturate_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK(v_int32x4, int, v_int16x8, short, pack, saturate_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK(v_uint64x2, uint64, v_uint32x4, unsigned, pack, static_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK(v_int64x2, int64, v_int32x4, int, pack, static_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK(v_int16x8, short, v_uint8x16, uchar, pack_u, saturate_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK(v_int32x4, int, v_uint16x8, ushort, pack_u, saturate_cast) -//! @} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_C_PACK_STORE(_Tpvec, _Tp, _Tpnvec, _Tpn, pack_suffix, cast) \ -inline void v_##pack_suffix##_store(_Tpn* ptr, const _Tpvec& a) \ -{ \ - for( int i = 0; i < _Tpvec::nlanes; i++ ) \ - ptr[i] = cast<_Tpn>(a.s[i]); \ -} - -//! @name Pack and store -//! @{ -//! @brief Store values from the input vector into memory with pack -//! -//! Values will be stored into memory with conversion to narrower type. -//! Variant with _u_ suffix converts to corresponding unsigned type. -//! -//! - pack: for 16-, 32- and 64-bit integer input types -//! - pack_u: for 16- and 32-bit signed integer input types -//! -//! @note All variants except 64-bit use saturation. -OPENCV_HAL_IMPL_C_PACK_STORE(v_uint16x8, ushort, v_uint8x16, uchar, pack, saturate_cast) -OPENCV_HAL_IMPL_C_PACK_STORE(v_int16x8, short, v_int8x16, schar, pack, saturate_cast) -OPENCV_HAL_IMPL_C_PACK_STORE(v_uint32x4, unsigned, v_uint16x8, ushort, pack, saturate_cast) -OPENCV_HAL_IMPL_C_PACK_STORE(v_int32x4, int, v_int16x8, short, pack, saturate_cast) -OPENCV_HAL_IMPL_C_PACK_STORE(v_uint64x2, uint64, v_uint32x4, unsigned, pack, static_cast) -OPENCV_HAL_IMPL_C_PACK_STORE(v_int64x2, int64, v_int32x4, int, pack, static_cast) -OPENCV_HAL_IMPL_C_PACK_STORE(v_int16x8, short, v_uint8x16, uchar, pack_u, saturate_cast) -OPENCV_HAL_IMPL_C_PACK_STORE(v_int32x4, int, v_uint16x8, ushort, pack_u, saturate_cast) -//! @} - -//! @brief Helper macro -//! @ingroup core_hal_intrin_impl -#define OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(_Tpvec, _Tp, _Tpnvec, _Tpn, pack_suffix, cast) \ -template inline void v_rshr_##pack_suffix##_store(_Tpn* ptr, const _Tpvec& a) \ -{ \ - for( int i = 0; i < _Tpvec::nlanes; i++ ) \ - ptr[i] = cast<_Tpn>((a.s[i] + ((_Tp)1 << (n - 1))) >> n); \ -} - -//! @name Pack and store with rounding shift -//! @{ -//! @brief Store values from the input vector into memory with pack -//! -//! Values will be shifted _n_ bits right with rounding, converted to narrower type and stored into -//! memory. Variant with _u_ suffix converts to unsigned type. -//! -//! - pack: for 16-, 32- and 64-bit integer input types -//! - pack_u: for 16- and 32-bit signed integer input types -//! -//! @note All variants except 64-bit use saturation. -OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_uint16x8, ushort, v_uint8x16, uchar, pack, saturate_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int16x8, short, v_int8x16, schar, pack, saturate_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_uint32x4, unsigned, v_uint16x8, ushort, pack, saturate_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int32x4, int, v_int16x8, short, pack, saturate_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_uint64x2, uint64, v_uint32x4, unsigned, pack, static_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int64x2, int64, v_int32x4, int, pack, static_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int16x8, short, v_uint8x16, uchar, pack_u, saturate_cast) -OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int32x4, int, v_uint16x8, ushort, pack_u, saturate_cast) -//! @} - -//! @cond IGNORED -template -inline void _pack_b(_Tpm* mptr, const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) -{ - for (int i = 0; i < n; ++i) - { - mptr[i] = (_Tpm)a.s[i]; - mptr[i + n] = (_Tpm)b.s[i]; - } -} -//! @endcond - -//! @name Pack boolean values -//! @{ -//! @brief Pack boolean values from multiple vectors to one unsigned 8-bit integer vector -//! -//! @note Must provide valid boolean values to guarantee same result for all architectures. - -/** @brief -//! For 16-bit boolean values - -Scheme: -@code -a {0xFFFF 0 0 0xFFFF 0 0xFFFF 0xFFFF 0} -b {0xFFFF 0 0xFFFF 0 0 0xFFFF 0 0xFFFF} -=============== -{ - 0xFF 0 0 0xFF 0 0xFF 0xFF 0 - 0xFF 0 0xFF 0 0 0xFF 0 0xFF -} -@endcode */ - -inline v_uint8x16 v_pack_b(const v_uint16x8& a, const v_uint16x8& b) -{ - v_uint8x16 mask; - _pack_b(mask.s, a, b); - return mask; -} - -/** @overload -For 32-bit boolean values - -Scheme: -@code -a {0xFFFF.. 0 0 0xFFFF..} -b {0 0xFFFF.. 0xFFFF.. 0} -c {0xFFFF.. 0 0xFFFF.. 0} -d {0 0xFFFF.. 0 0xFFFF..} -=============== -{ - 0xFF 0 0 0xFF 0 0xFF 0xFF 0 - 0xFF 0 0xFF 0 0 0xFF 0 0xFF -} -@endcode */ - -inline v_uint8x16 v_pack_b(const v_uint32x4& a, const v_uint32x4& b, - const v_uint32x4& c, const v_uint32x4& d) -{ - v_uint8x16 mask; - _pack_b(mask.s, a, b); - _pack_b(mask.s + 8, c, d); - return mask; -} - -/** @overload -For 64-bit boolean values - -Scheme: -@code -a {0xFFFF.. 0} -b {0 0xFFFF..} -c {0xFFFF.. 0} -d {0 0xFFFF..} - -e {0xFFFF.. 0} -f {0xFFFF.. 0} -g {0 0xFFFF..} -h {0 0xFFFF..} -=============== -{ - 0xFF 0 0 0xFF 0xFF 0 0 0xFF - 0xFF 0 0xFF 0 0 0xFF 0 0xFF -} -@endcode */ -inline v_uint8x16 v_pack_b(const v_uint64x2& a, const v_uint64x2& b, const v_uint64x2& c, - const v_uint64x2& d, const v_uint64x2& e, const v_uint64x2& f, - const v_uint64x2& g, const v_uint64x2& h) -{ - v_uint8x16 mask; - _pack_b(mask.s, a, b); - _pack_b(mask.s + 4, c, d); - _pack_b(mask.s + 8, e, f); - _pack_b(mask.s + 12, g, h); - return mask; -} -//! @} - -/** @brief Matrix multiplication - -Scheme: -@code -{A0 A1 A2 A3} |V0| -{B0 B1 B2 B3} |V1| -{C0 C1 C2 C3} |V2| -{D0 D1 D2 D3} x |V3| -==================== -{R0 R1 R2 R3}, where: -R0 = A0V0 + A1V1 + A2V2 + A3V3, -R1 = B0V0 + B1V1 + B2V2 + B3V3 -... -@endcode -*/ -inline v_float32x4 v_matmul(const v_float32x4& v, const v_float32x4& m0, - const v_float32x4& m1, const v_float32x4& m2, - const v_float32x4& m3) -{ - return v_float32x4(v.s[0]*m0.s[0] + v.s[1]*m1.s[0] + v.s[2]*m2.s[0] + v.s[3]*m3.s[0], - v.s[0]*m0.s[1] + v.s[1]*m1.s[1] + v.s[2]*m2.s[1] + v.s[3]*m3.s[1], - v.s[0]*m0.s[2] + v.s[1]*m1.s[2] + v.s[2]*m2.s[2] + v.s[3]*m3.s[2], - v.s[0]*m0.s[3] + v.s[1]*m1.s[3] + v.s[2]*m2.s[3] + v.s[3]*m3.s[3]); -} - -/** @brief Matrix multiplication and add - -Scheme: -@code -{A0 A1 A2 } |V0| |D0| -{B0 B1 B2 } |V1| |D1| -{C0 C1 C2 } x |V2| + |D2| -==================== -{R0 R1 R2 R3}, where: -R0 = A0V0 + A1V1 + A2V2 + D0, -R1 = B0V0 + B1V1 + B2V2 + D1 -... -@endcode -*/ -inline v_float32x4 v_matmuladd(const v_float32x4& v, const v_float32x4& m0, - const v_float32x4& m1, const v_float32x4& m2, - const v_float32x4& m3) -{ - return v_float32x4(v.s[0]*m0.s[0] + v.s[1]*m1.s[0] + v.s[2]*m2.s[0] + m3.s[0], - v.s[0]*m0.s[1] + v.s[1]*m1.s[1] + v.s[2]*m2.s[1] + m3.s[1], - v.s[0]*m0.s[2] + v.s[1]*m1.s[2] + v.s[2]*m2.s[2] + m3.s[2], - v.s[0]*m0.s[3] + v.s[1]*m1.s[3] + v.s[2]*m2.s[3] + m3.s[3]); -} - -////// FP16 support /////// - -inline v_reg::nlanes128> -v_load_expand(const float16_t* ptr) -{ - v_reg::nlanes128> v; - for( int i = 0; i < v.nlanes; i++ ) - { - v.s[i] = ptr[i]; - } - return v; -} - -inline void -v_pack_store(float16_t* ptr, v_reg::nlanes128>& v) -{ - for( int i = 0; i < v.nlanes; i++ ) - { - ptr[i] = float16_t(v.s[i]); - } -} - -inline void v_cleanup() {} - -//! @} - -//! @name Check SIMD support -//! @{ -//! @brief Check CPU capability of SIMD operation -static inline bool hasSIMD128() -{ - return false; -} - -//! @} - -#ifndef CV_DOXYGEN -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END -#endif -} - -#endif diff --git a/opencv/include/opencv2/core/hal/intrin_forward.hpp b/opencv/include/opencv2/core/hal/intrin_forward.hpp deleted file mode 100644 index 4618552..0000000 --- a/opencv/include/opencv2/core/hal/intrin_forward.hpp +++ /dev/null @@ -1,158 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html - -#ifndef CV__SIMD_FORWARD -#error "Need to pre-define forward width" -#endif - -namespace cv -{ - -//! @cond IGNORED - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN - -/** Types **/ -#if CV__SIMD_FORWARD == 512 -// [todo] 512 -#error "AVX512 Not implemented yet" -#elif CV__SIMD_FORWARD == 256 -// 256 -#define __CV_VX(fun) v256_##fun -#define __CV_V_UINT8 v_uint8x32 -#define __CV_V_INT8 v_int8x32 -#define __CV_V_UINT16 v_uint16x16 -#define __CV_V_INT16 v_int16x16 -#define __CV_V_UINT32 v_uint32x8 -#define __CV_V_INT32 v_int32x8 -#define __CV_V_UINT64 v_uint64x4 -#define __CV_V_INT64 v_int64x4 -#define __CV_V_FLOAT32 v_float32x8 -#define __CV_V_FLOAT64 v_float64x4 -struct v_uint8x32; -struct v_int8x32; -struct v_uint16x16; -struct v_int16x16; -struct v_uint32x8; -struct v_int32x8; -struct v_uint64x4; -struct v_int64x4; -struct v_float32x8; -struct v_float64x4; -#else -// 128 -#define __CV_VX(fun) v_##fun -#define __CV_V_UINT8 v_uint8x16 -#define __CV_V_INT8 v_int8x16 -#define __CV_V_UINT16 v_uint16x8 -#define __CV_V_INT16 v_int16x8 -#define __CV_V_UINT32 v_uint32x4 -#define __CV_V_INT32 v_int32x4 -#define __CV_V_UINT64 v_uint64x2 -#define __CV_V_INT64 v_int64x2 -#define __CV_V_FLOAT32 v_float32x4 -#define __CV_V_FLOAT64 v_float64x2 -struct v_uint8x16; -struct v_int8x16; -struct v_uint16x8; -struct v_int16x8; -struct v_uint32x4; -struct v_int32x4; -struct v_uint64x2; -struct v_int64x2; -struct v_float32x4; -struct v_float64x2; -#endif - -/** Value reordering **/ - -// Expansion -void v_expand(const __CV_V_UINT8&, __CV_V_UINT16&, __CV_V_UINT16&); -void v_expand(const __CV_V_INT8&, __CV_V_INT16&, __CV_V_INT16&); -void v_expand(const __CV_V_UINT16&, __CV_V_UINT32&, __CV_V_UINT32&); -void v_expand(const __CV_V_INT16&, __CV_V_INT32&, __CV_V_INT32&); -void v_expand(const __CV_V_UINT32&, __CV_V_UINT64&, __CV_V_UINT64&); -void v_expand(const __CV_V_INT32&, __CV_V_INT64&, __CV_V_INT64&); -// Low Expansion -__CV_V_UINT16 v_expand_low(const __CV_V_UINT8&); -__CV_V_INT16 v_expand_low(const __CV_V_INT8&); -__CV_V_UINT32 v_expand_low(const __CV_V_UINT16&); -__CV_V_INT32 v_expand_low(const __CV_V_INT16&); -__CV_V_UINT64 v_expand_low(const __CV_V_UINT32&); -__CV_V_INT64 v_expand_low(const __CV_V_INT32&); -// High Expansion -__CV_V_UINT16 v_expand_high(const __CV_V_UINT8&); -__CV_V_INT16 v_expand_high(const __CV_V_INT8&); -__CV_V_UINT32 v_expand_high(const __CV_V_UINT16&); -__CV_V_INT32 v_expand_high(const __CV_V_INT16&); -__CV_V_UINT64 v_expand_high(const __CV_V_UINT32&); -__CV_V_INT64 v_expand_high(const __CV_V_INT32&); -// Load & Low Expansion -__CV_V_UINT16 __CV_VX(load_expand)(const uchar*); -__CV_V_INT16 __CV_VX(load_expand)(const schar*); -__CV_V_UINT32 __CV_VX(load_expand)(const ushort*); -__CV_V_INT32 __CV_VX(load_expand)(const short*); -__CV_V_UINT64 __CV_VX(load_expand)(const uint*); -__CV_V_INT64 __CV_VX(load_expand)(const int*); -// Load lower 8-bit and expand into 32-bit -__CV_V_UINT32 __CV_VX(load_expand_q)(const uchar*); -__CV_V_INT32 __CV_VX(load_expand_q)(const schar*); - -// Saturating Pack -__CV_V_UINT8 v_pack(const __CV_V_UINT16&, const __CV_V_UINT16&); -__CV_V_INT8 v_pack(const __CV_V_INT16&, const __CV_V_INT16&); -__CV_V_UINT16 v_pack(const __CV_V_UINT32&, const __CV_V_UINT32&); -__CV_V_INT16 v_pack(const __CV_V_INT32&, const __CV_V_INT32&); -// Non-saturating Pack -__CV_V_UINT32 v_pack(const __CV_V_UINT64&, const __CV_V_UINT64&); -__CV_V_INT32 v_pack(const __CV_V_INT64&, const __CV_V_INT64&); -// Pack signed integers with unsigned saturation -__CV_V_UINT8 v_pack_u(const __CV_V_INT16&, const __CV_V_INT16&); -__CV_V_UINT16 v_pack_u(const __CV_V_INT32&, const __CV_V_INT32&); - -/** Arithmetic, bitwise and comparison operations **/ - -// Non-saturating multiply -#if CV_VSX -template -Tvec v_mul_wrap(const Tvec& a, const Tvec& b); -#else -__CV_V_UINT8 v_mul_wrap(const __CV_V_UINT8&, const __CV_V_UINT8&); -__CV_V_INT8 v_mul_wrap(const __CV_V_INT8&, const __CV_V_INT8&); -__CV_V_UINT16 v_mul_wrap(const __CV_V_UINT16&, const __CV_V_UINT16&); -__CV_V_INT16 v_mul_wrap(const __CV_V_INT16&, const __CV_V_INT16&); -#endif - -// Multiply and expand -#if CV_VSX -template -void v_mul_expand(const Tvec& a, const Tvec& b, Twvec& c, Twvec& d); -#else -void v_mul_expand(const __CV_V_UINT8&, const __CV_V_UINT8&, __CV_V_UINT16&, __CV_V_UINT16&); -void v_mul_expand(const __CV_V_INT8&, const __CV_V_INT8&, __CV_V_INT16&, __CV_V_INT16&); -void v_mul_expand(const __CV_V_UINT16&, const __CV_V_UINT16&, __CV_V_UINT32&, __CV_V_UINT32&); -void v_mul_expand(const __CV_V_INT16&, const __CV_V_INT16&, __CV_V_INT32&, __CV_V_INT32&); -void v_mul_expand(const __CV_V_UINT32&, const __CV_V_UINT32&, __CV_V_UINT64&, __CV_V_UINT64&); -void v_mul_expand(const __CV_V_INT32&, const __CV_V_INT32&, __CV_V_INT64&, __CV_V_INT64&); -#endif - -/** Cleanup **/ -#undef CV__SIMD_FORWARD -#undef __CV_VX -#undef __CV_V_UINT8 -#undef __CV_V_INT8 -#undef __CV_V_UINT16 -#undef __CV_V_INT16 -#undef __CV_V_UINT32 -#undef __CV_V_INT32 -#undef __CV_V_UINT64 -#undef __CV_V_INT64 -#undef __CV_V_FLOAT32 -#undef __CV_V_FLOAT64 - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END - -//! @endcond - -} // cv:: \ No newline at end of file diff --git a/opencv/include/opencv2/core/hal/intrin_neon.hpp b/opencv/include/opencv2/core/hal/intrin_neon.hpp deleted file mode 100644 index 3b946ff..0000000 --- a/opencv/include/opencv2/core/hal/intrin_neon.hpp +++ /dev/null @@ -1,1943 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_HAL_INTRIN_NEON_HPP -#define OPENCV_HAL_INTRIN_NEON_HPP - -#include -#include "opencv2/core/utility.hpp" - -namespace cv -{ - -//! @cond IGNORED - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN - -#define CV_SIMD128 1 -#if defined(__aarch64__) -#define CV_SIMD128_64F 1 -#else -#define CV_SIMD128_64F 0 -#endif - -#if CV_SIMD128_64F -#define OPENCV_HAL_IMPL_NEON_REINTERPRET(_Tpv, suffix) \ -template static inline \ -_Tpv vreinterpretq_##suffix##_f64(T a) { return (_Tpv) a; } \ -template static inline \ -float64x2_t vreinterpretq_f64_##suffix(T a) { return (float64x2_t) a; } -OPENCV_HAL_IMPL_NEON_REINTERPRET(uint8x16_t, u8) -OPENCV_HAL_IMPL_NEON_REINTERPRET(int8x16_t, s8) -OPENCV_HAL_IMPL_NEON_REINTERPRET(uint16x8_t, u16) -OPENCV_HAL_IMPL_NEON_REINTERPRET(int16x8_t, s16) -OPENCV_HAL_IMPL_NEON_REINTERPRET(uint32x4_t, u32) -OPENCV_HAL_IMPL_NEON_REINTERPRET(int32x4_t, s32) -OPENCV_HAL_IMPL_NEON_REINTERPRET(uint64x2_t, u64) -OPENCV_HAL_IMPL_NEON_REINTERPRET(int64x2_t, s64) -OPENCV_HAL_IMPL_NEON_REINTERPRET(float32x4_t, f32) -#endif - -struct v_uint8x16 -{ - typedef uchar lane_type; - enum { nlanes = 16 }; - - v_uint8x16() {} - explicit v_uint8x16(uint8x16_t v) : val(v) {} - v_uint8x16(uchar v0, uchar v1, uchar v2, uchar v3, uchar v4, uchar v5, uchar v6, uchar v7, - uchar v8, uchar v9, uchar v10, uchar v11, uchar v12, uchar v13, uchar v14, uchar v15) - { - uchar v[] = {v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15}; - val = vld1q_u8(v); - } - uchar get0() const - { - return vgetq_lane_u8(val, 0); - } - - uint8x16_t val; -}; - -struct v_int8x16 -{ - typedef schar lane_type; - enum { nlanes = 16 }; - - v_int8x16() {} - explicit v_int8x16(int8x16_t v) : val(v) {} - v_int8x16(schar v0, schar v1, schar v2, schar v3, schar v4, schar v5, schar v6, schar v7, - schar v8, schar v9, schar v10, schar v11, schar v12, schar v13, schar v14, schar v15) - { - schar v[] = {v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15}; - val = vld1q_s8(v); - } - schar get0() const - { - return vgetq_lane_s8(val, 0); - } - - int8x16_t val; -}; - -struct v_uint16x8 -{ - typedef ushort lane_type; - enum { nlanes = 8 }; - - v_uint16x8() {} - explicit v_uint16x8(uint16x8_t v) : val(v) {} - v_uint16x8(ushort v0, ushort v1, ushort v2, ushort v3, ushort v4, ushort v5, ushort v6, ushort v7) - { - ushort v[] = {v0, v1, v2, v3, v4, v5, v6, v7}; - val = vld1q_u16(v); - } - ushort get0() const - { - return vgetq_lane_u16(val, 0); - } - - uint16x8_t val; -}; - -struct v_int16x8 -{ - typedef short lane_type; - enum { nlanes = 8 }; - - v_int16x8() {} - explicit v_int16x8(int16x8_t v) : val(v) {} - v_int16x8(short v0, short v1, short v2, short v3, short v4, short v5, short v6, short v7) - { - short v[] = {v0, v1, v2, v3, v4, v5, v6, v7}; - val = vld1q_s16(v); - } - short get0() const - { - return vgetq_lane_s16(val, 0); - } - - int16x8_t val; -}; - -struct v_uint32x4 -{ - typedef unsigned lane_type; - enum { nlanes = 4 }; - - v_uint32x4() {} - explicit v_uint32x4(uint32x4_t v) : val(v) {} - v_uint32x4(unsigned v0, unsigned v1, unsigned v2, unsigned v3) - { - unsigned v[] = {v0, v1, v2, v3}; - val = vld1q_u32(v); - } - unsigned get0() const - { - return vgetq_lane_u32(val, 0); - } - - uint32x4_t val; -}; - -struct v_int32x4 -{ - typedef int lane_type; - enum { nlanes = 4 }; - - v_int32x4() {} - explicit v_int32x4(int32x4_t v) : val(v) {} - v_int32x4(int v0, int v1, int v2, int v3) - { - int v[] = {v0, v1, v2, v3}; - val = vld1q_s32(v); - } - int get0() const - { - return vgetq_lane_s32(val, 0); - } - int32x4_t val; -}; - -struct v_float32x4 -{ - typedef float lane_type; - enum { nlanes = 4 }; - - v_float32x4() {} - explicit v_float32x4(float32x4_t v) : val(v) {} - v_float32x4(float v0, float v1, float v2, float v3) - { - float v[] = {v0, v1, v2, v3}; - val = vld1q_f32(v); - } - float get0() const - { - return vgetq_lane_f32(val, 0); - } - float32x4_t val; -}; - -struct v_uint64x2 -{ - typedef uint64 lane_type; - enum { nlanes = 2 }; - - v_uint64x2() {} - explicit v_uint64x2(uint64x2_t v) : val(v) {} - v_uint64x2(uint64 v0, uint64 v1) - { - uint64 v[] = {v0, v1}; - val = vld1q_u64(v); - } - uint64 get0() const - { - return vgetq_lane_u64(val, 0); - } - uint64x2_t val; -}; - -struct v_int64x2 -{ - typedef int64 lane_type; - enum { nlanes = 2 }; - - v_int64x2() {} - explicit v_int64x2(int64x2_t v) : val(v) {} - v_int64x2(int64 v0, int64 v1) - { - int64 v[] = {v0, v1}; - val = vld1q_s64(v); - } - int64 get0() const - { - return vgetq_lane_s64(val, 0); - } - int64x2_t val; -}; - -#if CV_SIMD128_64F -struct v_float64x2 -{ - typedef double lane_type; - enum { nlanes = 2 }; - - v_float64x2() {} - explicit v_float64x2(float64x2_t v) : val(v) {} - v_float64x2(double v0, double v1) - { - double v[] = {v0, v1}; - val = vld1q_f64(v); - } - double get0() const - { - return vgetq_lane_f64(val, 0); - } - float64x2_t val; -}; -#endif - -#if CV_FP16 -// Workaround for old compilers -static inline int16x4_t vreinterpret_s16_f16(float16x4_t a) { return (int16x4_t)a; } -static inline float16x4_t vreinterpret_f16_s16(int16x4_t a) { return (float16x4_t)a; } - -static inline float16x4_t cv_vld1_f16(const void* ptr) -{ -#ifndef vld1_f16 // APPLE compiler defines vld1_f16 as macro - return vreinterpret_f16_s16(vld1_s16((const short*)ptr)); -#else - return vld1_f16((const __fp16*)ptr); -#endif -} -static inline void cv_vst1_f16(void* ptr, float16x4_t a) -{ -#ifndef vst1_f16 // APPLE compiler defines vst1_f16 as macro - vst1_s16((short*)ptr, vreinterpret_s16_f16(a)); -#else - vst1_f16((__fp16*)ptr, a); -#endif -} - -#ifndef vdup_n_f16 - #define vdup_n_f16(v) (float16x4_t){v, v, v, v} -#endif - -#endif // CV_FP16 - -#if CV_FP16 -inline v_float32x4 v128_load_fp16_f32(const short* ptr) -{ - float16x4_t a = cv_vld1_f16((const __fp16*)ptr); - return v_float32x4(vcvt_f32_f16(a)); -} - -inline void v_store_fp16(short* ptr, const v_float32x4& a) -{ - float16x4_t fp16 = vcvt_f16_f32(a.val); - cv_vst1_f16((short*)ptr, fp16); -} -#endif - -#define OPENCV_HAL_IMPL_NEON_INIT(_Tpv, _Tp, suffix) \ -inline v_##_Tpv v_setzero_##suffix() { return v_##_Tpv(vdupq_n_##suffix((_Tp)0)); } \ -inline v_##_Tpv v_setall_##suffix(_Tp v) { return v_##_Tpv(vdupq_n_##suffix(v)); } \ -inline _Tpv##_t vreinterpretq_##suffix##_##suffix(_Tpv##_t v) { return v; } \ -inline v_uint8x16 v_reinterpret_as_u8(const v_##_Tpv& v) { return v_uint8x16(vreinterpretq_u8_##suffix(v.val)); } \ -inline v_int8x16 v_reinterpret_as_s8(const v_##_Tpv& v) { return v_int8x16(vreinterpretq_s8_##suffix(v.val)); } \ -inline v_uint16x8 v_reinterpret_as_u16(const v_##_Tpv& v) { return v_uint16x8(vreinterpretq_u16_##suffix(v.val)); } \ -inline v_int16x8 v_reinterpret_as_s16(const v_##_Tpv& v) { return v_int16x8(vreinterpretq_s16_##suffix(v.val)); } \ -inline v_uint32x4 v_reinterpret_as_u32(const v_##_Tpv& v) { return v_uint32x4(vreinterpretq_u32_##suffix(v.val)); } \ -inline v_int32x4 v_reinterpret_as_s32(const v_##_Tpv& v) { return v_int32x4(vreinterpretq_s32_##suffix(v.val)); } \ -inline v_uint64x2 v_reinterpret_as_u64(const v_##_Tpv& v) { return v_uint64x2(vreinterpretq_u64_##suffix(v.val)); } \ -inline v_int64x2 v_reinterpret_as_s64(const v_##_Tpv& v) { return v_int64x2(vreinterpretq_s64_##suffix(v.val)); } \ -inline v_float32x4 v_reinterpret_as_f32(const v_##_Tpv& v) { return v_float32x4(vreinterpretq_f32_##suffix(v.val)); } - -OPENCV_HAL_IMPL_NEON_INIT(uint8x16, uchar, u8) -OPENCV_HAL_IMPL_NEON_INIT(int8x16, schar, s8) -OPENCV_HAL_IMPL_NEON_INIT(uint16x8, ushort, u16) -OPENCV_HAL_IMPL_NEON_INIT(int16x8, short, s16) -OPENCV_HAL_IMPL_NEON_INIT(uint32x4, unsigned, u32) -OPENCV_HAL_IMPL_NEON_INIT(int32x4, int, s32) -OPENCV_HAL_IMPL_NEON_INIT(uint64x2, uint64, u64) -OPENCV_HAL_IMPL_NEON_INIT(int64x2, int64, s64) -OPENCV_HAL_IMPL_NEON_INIT(float32x4, float, f32) -#if CV_SIMD128_64F -#define OPENCV_HAL_IMPL_NEON_INIT_64(_Tpv, suffix) \ -inline v_float64x2 v_reinterpret_as_f64(const v_##_Tpv& v) { return v_float64x2(vreinterpretq_f64_##suffix(v.val)); } -OPENCV_HAL_IMPL_NEON_INIT(float64x2, double, f64) -OPENCV_HAL_IMPL_NEON_INIT_64(uint8x16, u8) -OPENCV_HAL_IMPL_NEON_INIT_64(int8x16, s8) -OPENCV_HAL_IMPL_NEON_INIT_64(uint16x8, u16) -OPENCV_HAL_IMPL_NEON_INIT_64(int16x8, s16) -OPENCV_HAL_IMPL_NEON_INIT_64(uint32x4, u32) -OPENCV_HAL_IMPL_NEON_INIT_64(int32x4, s32) -OPENCV_HAL_IMPL_NEON_INIT_64(uint64x2, u64) -OPENCV_HAL_IMPL_NEON_INIT_64(int64x2, s64) -OPENCV_HAL_IMPL_NEON_INIT_64(float32x4, f32) -OPENCV_HAL_IMPL_NEON_INIT_64(float64x2, f64) -#endif - -#define OPENCV_HAL_IMPL_NEON_PACK(_Tpvec, _Tp, hreg, suffix, _Tpwvec, pack, mov, rshr) \ -inline _Tpvec v_##pack(const _Tpwvec& a, const _Tpwvec& b) \ -{ \ - hreg a1 = mov(a.val), b1 = mov(b.val); \ - return _Tpvec(vcombine_##suffix(a1, b1)); \ -} \ -inline void v_##pack##_store(_Tp* ptr, const _Tpwvec& a) \ -{ \ - hreg a1 = mov(a.val); \ - vst1_##suffix(ptr, a1); \ -} \ -template inline \ -_Tpvec v_rshr_##pack(const _Tpwvec& a, const _Tpwvec& b) \ -{ \ - hreg a1 = rshr(a.val, n); \ - hreg b1 = rshr(b.val, n); \ - return _Tpvec(vcombine_##suffix(a1, b1)); \ -} \ -template inline \ -void v_rshr_##pack##_store(_Tp* ptr, const _Tpwvec& a) \ -{ \ - hreg a1 = rshr(a.val, n); \ - vst1_##suffix(ptr, a1); \ -} - -OPENCV_HAL_IMPL_NEON_PACK(v_uint8x16, uchar, uint8x8_t, u8, v_uint16x8, pack, vqmovn_u16, vqrshrn_n_u16) -OPENCV_HAL_IMPL_NEON_PACK(v_int8x16, schar, int8x8_t, s8, v_int16x8, pack, vqmovn_s16, vqrshrn_n_s16) -OPENCV_HAL_IMPL_NEON_PACK(v_uint16x8, ushort, uint16x4_t, u16, v_uint32x4, pack, vqmovn_u32, vqrshrn_n_u32) -OPENCV_HAL_IMPL_NEON_PACK(v_int16x8, short, int16x4_t, s16, v_int32x4, pack, vqmovn_s32, vqrshrn_n_s32) -OPENCV_HAL_IMPL_NEON_PACK(v_uint32x4, unsigned, uint32x2_t, u32, v_uint64x2, pack, vmovn_u64, vrshrn_n_u64) -OPENCV_HAL_IMPL_NEON_PACK(v_int32x4, int, int32x2_t, s32, v_int64x2, pack, vmovn_s64, vrshrn_n_s64) - -OPENCV_HAL_IMPL_NEON_PACK(v_uint8x16, uchar, uint8x8_t, u8, v_int16x8, pack_u, vqmovun_s16, vqrshrun_n_s16) -OPENCV_HAL_IMPL_NEON_PACK(v_uint16x8, ushort, uint16x4_t, u16, v_int32x4, pack_u, vqmovun_s32, vqrshrun_n_s32) - -// pack boolean -inline v_uint8x16 v_pack_b(const v_uint16x8& a, const v_uint16x8& b) -{ - uint8x16_t ab = vcombine_u8(vmovn_u16(a.val), vmovn_u16(b.val)); - return v_uint8x16(ab); -} - -inline v_uint8x16 v_pack_b(const v_uint32x4& a, const v_uint32x4& b, - const v_uint32x4& c, const v_uint32x4& d) -{ - uint16x8_t nab = vcombine_u16(vmovn_u32(a.val), vmovn_u32(b.val)); - uint16x8_t ncd = vcombine_u16(vmovn_u32(c.val), vmovn_u32(d.val)); - return v_uint8x16(vcombine_u8(vmovn_u16(nab), vmovn_u16(ncd))); -} - -inline v_uint8x16 v_pack_b(const v_uint64x2& a, const v_uint64x2& b, const v_uint64x2& c, - const v_uint64x2& d, const v_uint64x2& e, const v_uint64x2& f, - const v_uint64x2& g, const v_uint64x2& h) -{ - uint32x4_t ab = vcombine_u32(vmovn_u64(a.val), vmovn_u64(b.val)); - uint32x4_t cd = vcombine_u32(vmovn_u64(c.val), vmovn_u64(d.val)); - uint32x4_t ef = vcombine_u32(vmovn_u64(e.val), vmovn_u64(f.val)); - uint32x4_t gh = vcombine_u32(vmovn_u64(g.val), vmovn_u64(h.val)); - - uint16x8_t abcd = vcombine_u16(vmovn_u32(ab), vmovn_u32(cd)); - uint16x8_t efgh = vcombine_u16(vmovn_u32(ef), vmovn_u32(gh)); - return v_uint8x16(vcombine_u8(vmovn_u16(abcd), vmovn_u16(efgh))); -} - -inline v_float32x4 v_matmul(const v_float32x4& v, const v_float32x4& m0, - const v_float32x4& m1, const v_float32x4& m2, - const v_float32x4& m3) -{ - float32x2_t vl = vget_low_f32(v.val), vh = vget_high_f32(v.val); - float32x4_t res = vmulq_lane_f32(m0.val, vl, 0); - res = vmlaq_lane_f32(res, m1.val, vl, 1); - res = vmlaq_lane_f32(res, m2.val, vh, 0); - res = vmlaq_lane_f32(res, m3.val, vh, 1); - return v_float32x4(res); -} - -inline v_float32x4 v_matmuladd(const v_float32x4& v, const v_float32x4& m0, - const v_float32x4& m1, const v_float32x4& m2, - const v_float32x4& a) -{ - float32x2_t vl = vget_low_f32(v.val), vh = vget_high_f32(v.val); - float32x4_t res = vmulq_lane_f32(m0.val, vl, 0); - res = vmlaq_lane_f32(res, m1.val, vl, 1); - res = vmlaq_lane_f32(res, m2.val, vh, 0); - res = vaddq_f32(res, a.val); - return v_float32x4(res); -} - -#define OPENCV_HAL_IMPL_NEON_BIN_OP(bin_op, _Tpvec, intrin) \ -inline _Tpvec operator bin_op (const _Tpvec& a, const _Tpvec& b) \ -{ \ - return _Tpvec(intrin(a.val, b.val)); \ -} \ -inline _Tpvec& operator bin_op##= (_Tpvec& a, const _Tpvec& b) \ -{ \ - a.val = intrin(a.val, b.val); \ - return a; \ -} - -OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint8x16, vqaddq_u8) -OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint8x16, vqsubq_u8) -OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int8x16, vqaddq_s8) -OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int8x16, vqsubq_s8) -OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint16x8, vqaddq_u16) -OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint16x8, vqsubq_u16) -OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int16x8, vqaddq_s16) -OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int16x8, vqsubq_s16) -OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int32x4, vaddq_s32) -OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int32x4, vsubq_s32) -OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_int32x4, vmulq_s32) -OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint32x4, vaddq_u32) -OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint32x4, vsubq_u32) -OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_uint32x4, vmulq_u32) -OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_float32x4, vaddq_f32) -OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_float32x4, vsubq_f32) -OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_float32x4, vmulq_f32) -OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int64x2, vaddq_s64) -OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int64x2, vsubq_s64) -OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint64x2, vaddq_u64) -OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint64x2, vsubq_u64) -#if CV_SIMD128_64F -OPENCV_HAL_IMPL_NEON_BIN_OP(/, v_float32x4, vdivq_f32) -OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_float64x2, vaddq_f64) -OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_float64x2, vsubq_f64) -OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_float64x2, vmulq_f64) -OPENCV_HAL_IMPL_NEON_BIN_OP(/, v_float64x2, vdivq_f64) -#else -inline v_float32x4 operator / (const v_float32x4& a, const v_float32x4& b) -{ - float32x4_t reciprocal = vrecpeq_f32(b.val); - reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal); - reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal); - return v_float32x4(vmulq_f32(a.val, reciprocal)); -} -inline v_float32x4& operator /= (v_float32x4& a, const v_float32x4& b) -{ - float32x4_t reciprocal = vrecpeq_f32(b.val); - reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal); - reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal); - a.val = vmulq_f32(a.val, reciprocal); - return a; -} -#endif - -// saturating multiply 8-bit, 16-bit -#define OPENCV_HAL_IMPL_NEON_MUL_SAT(_Tpvec, _Tpwvec) \ - inline _Tpvec operator * (const _Tpvec& a, const _Tpvec& b) \ - { \ - _Tpwvec c, d; \ - v_mul_expand(a, b, c, d); \ - return v_pack(c, d); \ - } \ - inline _Tpvec& operator *= (_Tpvec& a, const _Tpvec& b) \ - { a = a * b; return a; } - -OPENCV_HAL_IMPL_NEON_MUL_SAT(v_int8x16, v_int16x8) -OPENCV_HAL_IMPL_NEON_MUL_SAT(v_uint8x16, v_uint16x8) -OPENCV_HAL_IMPL_NEON_MUL_SAT(v_int16x8, v_int32x4) -OPENCV_HAL_IMPL_NEON_MUL_SAT(v_uint16x8, v_uint32x4) - -// Multiply and expand -inline void v_mul_expand(const v_int8x16& a, const v_int8x16& b, - v_int16x8& c, v_int16x8& d) -{ - c.val = vmull_s8(vget_low_s8(a.val), vget_low_s8(b.val)); - d.val = vmull_s8(vget_high_s8(a.val), vget_high_s8(b.val)); -} - -inline void v_mul_expand(const v_uint8x16& a, const v_uint8x16& b, - v_uint16x8& c, v_uint16x8& d) -{ - c.val = vmull_u8(vget_low_u8(a.val), vget_low_u8(b.val)); - d.val = vmull_u8(vget_high_u8(a.val), vget_high_u8(b.val)); -} - -inline void v_mul_expand(const v_int16x8& a, const v_int16x8& b, - v_int32x4& c, v_int32x4& d) -{ - c.val = vmull_s16(vget_low_s16(a.val), vget_low_s16(b.val)); - d.val = vmull_s16(vget_high_s16(a.val), vget_high_s16(b.val)); -} - -inline void v_mul_expand(const v_uint16x8& a, const v_uint16x8& b, - v_uint32x4& c, v_uint32x4& d) -{ - c.val = vmull_u16(vget_low_u16(a.val), vget_low_u16(b.val)); - d.val = vmull_u16(vget_high_u16(a.val), vget_high_u16(b.val)); -} - -inline void v_mul_expand(const v_uint32x4& a, const v_uint32x4& b, - v_uint64x2& c, v_uint64x2& d) -{ - c.val = vmull_u32(vget_low_u32(a.val), vget_low_u32(b.val)); - d.val = vmull_u32(vget_high_u32(a.val), vget_high_u32(b.val)); -} - -inline v_int16x8 v_mul_hi(const v_int16x8& a, const v_int16x8& b) -{ - return v_int16x8(vcombine_s16( - vshrn_n_s32(vmull_s16( vget_low_s16(a.val), vget_low_s16(b.val)), 16), - vshrn_n_s32(vmull_s16(vget_high_s16(a.val), vget_high_s16(b.val)), 16) - )); -} -inline v_uint16x8 v_mul_hi(const v_uint16x8& a, const v_uint16x8& b) -{ - return v_uint16x8(vcombine_u16( - vshrn_n_u32(vmull_u16( vget_low_u16(a.val), vget_low_u16(b.val)), 16), - vshrn_n_u32(vmull_u16(vget_high_u16(a.val), vget_high_u16(b.val)), 16) - )); -} - -inline v_int32x4 v_dotprod(const v_int16x8& a, const v_int16x8& b) -{ - int32x4_t c = vmull_s16(vget_low_s16(a.val), vget_low_s16(b.val)); - int32x4_t d = vmull_s16(vget_high_s16(a.val), vget_high_s16(b.val)); - int32x4x2_t cd = vuzpq_s32(c, d); - return v_int32x4(vaddq_s32(cd.val[0], cd.val[1])); -} - -inline v_int32x4 v_dotprod(const v_int16x8& a, const v_int16x8& b, const v_int32x4& c) -{ - v_int32x4 s = v_dotprod(a, b); - return v_int32x4(vaddq_s32(s.val , c.val)); -} - -#define OPENCV_HAL_IMPL_NEON_LOGIC_OP(_Tpvec, suffix) \ - OPENCV_HAL_IMPL_NEON_BIN_OP(&, _Tpvec, vandq_##suffix) \ - OPENCV_HAL_IMPL_NEON_BIN_OP(|, _Tpvec, vorrq_##suffix) \ - OPENCV_HAL_IMPL_NEON_BIN_OP(^, _Tpvec, veorq_##suffix) \ - inline _Tpvec operator ~ (const _Tpvec& a) \ - { \ - return _Tpvec(vreinterpretq_##suffix##_u8(vmvnq_u8(vreinterpretq_u8_##suffix(a.val)))); \ - } - -OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint8x16, u8) -OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int8x16, s8) -OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint16x8, u16) -OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int16x8, s16) -OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint32x4, u32) -OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int32x4, s32) -OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint64x2, u64) -OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int64x2, s64) - -#define OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(bin_op, intrin) \ -inline v_float32x4 operator bin_op (const v_float32x4& a, const v_float32x4& b) \ -{ \ - return v_float32x4(vreinterpretq_f32_s32(intrin(vreinterpretq_s32_f32(a.val), vreinterpretq_s32_f32(b.val)))); \ -} \ -inline v_float32x4& operator bin_op##= (v_float32x4& a, const v_float32x4& b) \ -{ \ - a.val = vreinterpretq_f32_s32(intrin(vreinterpretq_s32_f32(a.val), vreinterpretq_s32_f32(b.val))); \ - return a; \ -} - -OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(&, vandq_s32) -OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(|, vorrq_s32) -OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(^, veorq_s32) - -inline v_float32x4 operator ~ (const v_float32x4& a) -{ - return v_float32x4(vreinterpretq_f32_s32(vmvnq_s32(vreinterpretq_s32_f32(a.val)))); -} - -#if CV_SIMD128_64F -inline v_float32x4 v_sqrt(const v_float32x4& x) -{ - return v_float32x4(vsqrtq_f32(x.val)); -} - -inline v_float32x4 v_invsqrt(const v_float32x4& x) -{ - v_float32x4 one = v_setall_f32(1.0f); - return one / v_sqrt(x); -} -#else -inline v_float32x4 v_sqrt(const v_float32x4& x) -{ - float32x4_t x1 = vmaxq_f32(x.val, vdupq_n_f32(FLT_MIN)); - float32x4_t e = vrsqrteq_f32(x1); - e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x1, e), e), e); - e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x1, e), e), e); - return v_float32x4(vmulq_f32(x.val, e)); -} - -inline v_float32x4 v_invsqrt(const v_float32x4& x) -{ - float32x4_t e = vrsqrteq_f32(x.val); - e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x.val, e), e), e); - e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x.val, e), e), e); - return v_float32x4(e); -} -#endif - -#define OPENCV_HAL_IMPL_NEON_ABS(_Tpuvec, _Tpsvec, usuffix, ssuffix) \ -inline _Tpuvec v_abs(const _Tpsvec& a) { return v_reinterpret_as_##usuffix(_Tpsvec(vabsq_##ssuffix(a.val))); } - -OPENCV_HAL_IMPL_NEON_ABS(v_uint8x16, v_int8x16, u8, s8) -OPENCV_HAL_IMPL_NEON_ABS(v_uint16x8, v_int16x8, u16, s16) -OPENCV_HAL_IMPL_NEON_ABS(v_uint32x4, v_int32x4, u32, s32) - -inline v_float32x4 v_abs(v_float32x4 x) -{ return v_float32x4(vabsq_f32(x.val)); } - -#if CV_SIMD128_64F -#define OPENCV_HAL_IMPL_NEON_DBL_BIT_OP(bin_op, intrin) \ -inline v_float64x2 operator bin_op (const v_float64x2& a, const v_float64x2& b) \ -{ \ - return v_float64x2(vreinterpretq_f64_s64(intrin(vreinterpretq_s64_f64(a.val), vreinterpretq_s64_f64(b.val)))); \ -} \ -inline v_float64x2& operator bin_op##= (v_float64x2& a, const v_float64x2& b) \ -{ \ - a.val = vreinterpretq_f64_s64(intrin(vreinterpretq_s64_f64(a.val), vreinterpretq_s64_f64(b.val))); \ - return a; \ -} - -OPENCV_HAL_IMPL_NEON_DBL_BIT_OP(&, vandq_s64) -OPENCV_HAL_IMPL_NEON_DBL_BIT_OP(|, vorrq_s64) -OPENCV_HAL_IMPL_NEON_DBL_BIT_OP(^, veorq_s64) - -inline v_float64x2 operator ~ (const v_float64x2& a) -{ - return v_float64x2(vreinterpretq_f64_s32(vmvnq_s32(vreinterpretq_s32_f64(a.val)))); -} - -inline v_float64x2 v_sqrt(const v_float64x2& x) -{ - return v_float64x2(vsqrtq_f64(x.val)); -} - -inline v_float64x2 v_invsqrt(const v_float64x2& x) -{ - v_float64x2 one = v_setall_f64(1.0f); - return one / v_sqrt(x); -} - -inline v_float64x2 v_abs(v_float64x2 x) -{ return v_float64x2(vabsq_f64(x.val)); } -#endif - -// TODO: exp, log, sin, cos - -#define OPENCV_HAL_IMPL_NEON_BIN_FUNC(_Tpvec, func, intrin) \ -inline _Tpvec func(const _Tpvec& a, const _Tpvec& b) \ -{ \ - return _Tpvec(intrin(a.val, b.val)); \ -} - -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_min, vminq_u8) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_max, vmaxq_u8) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_min, vminq_s8) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_max, vmaxq_s8) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_min, vminq_u16) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_max, vmaxq_u16) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_min, vminq_s16) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_max, vmaxq_s16) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint32x4, v_min, vminq_u32) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint32x4, v_max, vmaxq_u32) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int32x4, v_min, vminq_s32) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int32x4, v_max, vmaxq_s32) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float32x4, v_min, vminq_f32) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float32x4, v_max, vmaxq_f32) -#if CV_SIMD128_64F -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float64x2, v_min, vminq_f64) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float64x2, v_max, vmaxq_f64) -#endif - -#if CV_SIMD128_64F -inline int64x2_t vmvnq_s64(int64x2_t a) -{ - int64x2_t vx = vreinterpretq_s64_u32(vdupq_n_u32(0xFFFFFFFF)); - return veorq_s64(a, vx); -} -inline uint64x2_t vmvnq_u64(uint64x2_t a) -{ - uint64x2_t vx = vreinterpretq_u64_u32(vdupq_n_u32(0xFFFFFFFF)); - return veorq_u64(a, vx); -} -#endif -#define OPENCV_HAL_IMPL_NEON_INT_CMP_OP(_Tpvec, cast, suffix, not_suffix) \ -inline _Tpvec operator == (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(cast(vceqq_##suffix(a.val, b.val))); } \ -inline _Tpvec operator != (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(cast(vmvnq_##not_suffix(vceqq_##suffix(a.val, b.val)))); } \ -inline _Tpvec operator < (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(cast(vcltq_##suffix(a.val, b.val))); } \ -inline _Tpvec operator > (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(cast(vcgtq_##suffix(a.val, b.val))); } \ -inline _Tpvec operator <= (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(cast(vcleq_##suffix(a.val, b.val))); } \ -inline _Tpvec operator >= (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(cast(vcgeq_##suffix(a.val, b.val))); } - -OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_uint8x16, OPENCV_HAL_NOP, u8, u8) -OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_int8x16, vreinterpretq_s8_u8, s8, u8) -OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_uint16x8, OPENCV_HAL_NOP, u16, u16) -OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_int16x8, vreinterpretq_s16_u16, s16, u16) -OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_uint32x4, OPENCV_HAL_NOP, u32, u32) -OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_int32x4, vreinterpretq_s32_u32, s32, u32) -OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_float32x4, vreinterpretq_f32_u32, f32, u32) -#if CV_SIMD128_64F -OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_uint64x2, OPENCV_HAL_NOP, u64, u64) -OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_int64x2, vreinterpretq_s64_u64, s64, u64) -OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_float64x2, vreinterpretq_f64_u64, f64, u64) -#endif - -inline v_float32x4 v_not_nan(const v_float32x4& a) -{ return v_float32x4(vreinterpretq_f32_u32(vceqq_f32(a.val, a.val))); } -#if CV_SIMD128_64F -inline v_float64x2 v_not_nan(const v_float64x2& a) -{ return v_float64x2(vreinterpretq_f64_u64(vceqq_f64(a.val, a.val))); } -#endif - -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_add_wrap, vaddq_u8) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_add_wrap, vaddq_s8) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_add_wrap, vaddq_u16) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_add_wrap, vaddq_s16) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_sub_wrap, vsubq_u8) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_sub_wrap, vsubq_s8) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_sub_wrap, vsubq_u16) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_sub_wrap, vsubq_s16) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_mul_wrap, vmulq_u8) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_mul_wrap, vmulq_s8) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_mul_wrap, vmulq_u16) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_mul_wrap, vmulq_s16) - -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_absdiff, vabdq_u8) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_absdiff, vabdq_u16) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint32x4, v_absdiff, vabdq_u32) -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float32x4, v_absdiff, vabdq_f32) -#if CV_SIMD128_64F -OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float64x2, v_absdiff, vabdq_f64) -#endif - -/** Saturating absolute difference **/ -inline v_int8x16 v_absdiffs(const v_int8x16& a, const v_int8x16& b) -{ return v_int8x16(vqabsq_s8(vqsubq_s8(a.val, b.val))); } -inline v_int16x8 v_absdiffs(const v_int16x8& a, const v_int16x8& b) -{ return v_int16x8(vqabsq_s16(vqsubq_s16(a.val, b.val))); } - -#define OPENCV_HAL_IMPL_NEON_BIN_FUNC2(_Tpvec, _Tpvec2, cast, func, intrin) \ -inline _Tpvec2 func(const _Tpvec& a, const _Tpvec& b) \ -{ \ - return _Tpvec2(cast(intrin(a.val, b.val))); \ -} - -OPENCV_HAL_IMPL_NEON_BIN_FUNC2(v_int8x16, v_uint8x16, vreinterpretq_u8_s8, v_absdiff, vabdq_s8) -OPENCV_HAL_IMPL_NEON_BIN_FUNC2(v_int16x8, v_uint16x8, vreinterpretq_u16_s16, v_absdiff, vabdq_s16) -OPENCV_HAL_IMPL_NEON_BIN_FUNC2(v_int32x4, v_uint32x4, vreinterpretq_u32_s32, v_absdiff, vabdq_s32) - -inline v_float32x4 v_magnitude(const v_float32x4& a, const v_float32x4& b) -{ - v_float32x4 x(vmlaq_f32(vmulq_f32(a.val, a.val), b.val, b.val)); - return v_sqrt(x); -} - -inline v_float32x4 v_sqr_magnitude(const v_float32x4& a, const v_float32x4& b) -{ - return v_float32x4(vmlaq_f32(vmulq_f32(a.val, a.val), b.val, b.val)); -} - -inline v_float32x4 v_fma(const v_float32x4& a, const v_float32x4& b, const v_float32x4& c) -{ -#if CV_SIMD128_64F - // ARMv8, which adds support for 64-bit floating-point (so CV_SIMD128_64F is defined), - // also adds FMA support both for single- and double-precision floating-point vectors - return v_float32x4(vfmaq_f32(c.val, a.val, b.val)); -#else - return v_float32x4(vmlaq_f32(c.val, a.val, b.val)); -#endif -} - -inline v_int32x4 v_fma(const v_int32x4& a, const v_int32x4& b, const v_int32x4& c) -{ - return v_int32x4(vmlaq_s32(c.val, a.val, b.val)); -} - -inline v_float32x4 v_muladd(const v_float32x4& a, const v_float32x4& b, const v_float32x4& c) -{ - return v_fma(a, b, c); -} - -inline v_int32x4 v_muladd(const v_int32x4& a, const v_int32x4& b, const v_int32x4& c) -{ - return v_fma(a, b, c); -} - -#if CV_SIMD128_64F -inline v_float64x2 v_magnitude(const v_float64x2& a, const v_float64x2& b) -{ - v_float64x2 x(vaddq_f64(vmulq_f64(a.val, a.val), vmulq_f64(b.val, b.val))); - return v_sqrt(x); -} - -inline v_float64x2 v_sqr_magnitude(const v_float64x2& a, const v_float64x2& b) -{ - return v_float64x2(vaddq_f64(vmulq_f64(a.val, a.val), vmulq_f64(b.val, b.val))); -} - -inline v_float64x2 v_fma(const v_float64x2& a, const v_float64x2& b, const v_float64x2& c) -{ - return v_float64x2(vfmaq_f64(c.val, a.val, b.val)); -} - -inline v_float64x2 v_muladd(const v_float64x2& a, const v_float64x2& b, const v_float64x2& c) -{ - return v_fma(a, b, c); -} -#endif - -// trade efficiency for convenience -#define OPENCV_HAL_IMPL_NEON_SHIFT_OP(_Tpvec, suffix, _Tps, ssuffix) \ -inline _Tpvec operator << (const _Tpvec& a, int n) \ -{ return _Tpvec(vshlq_##suffix(a.val, vdupq_n_##ssuffix((_Tps)n))); } \ -inline _Tpvec operator >> (const _Tpvec& a, int n) \ -{ return _Tpvec(vshlq_##suffix(a.val, vdupq_n_##ssuffix((_Tps)-n))); } \ -template inline _Tpvec v_shl(const _Tpvec& a) \ -{ return _Tpvec(vshlq_n_##suffix(a.val, n)); } \ -template inline _Tpvec v_shr(const _Tpvec& a) \ -{ return _Tpvec(vshrq_n_##suffix(a.val, n)); } \ -template inline _Tpvec v_rshr(const _Tpvec& a) \ -{ return _Tpvec(vrshrq_n_##suffix(a.val, n)); } - -OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_uint8x16, u8, schar, s8) -OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int8x16, s8, schar, s8) -OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_uint16x8, u16, short, s16) -OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int16x8, s16, short, s16) -OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_uint32x4, u32, int, s32) -OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int32x4, s32, int, s32) -OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_uint64x2, u64, int64, s64) -OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int64x2, s64, int64, s64) - -#define OPENCV_HAL_IMPL_NEON_ROTATE_OP(_Tpvec, suffix) \ -template inline _Tpvec v_rotate_right(const _Tpvec& a) \ -{ return _Tpvec(vextq_##suffix(a.val, vdupq_n_##suffix(0), n)); } \ -template inline _Tpvec v_rotate_left(const _Tpvec& a) \ -{ return _Tpvec(vextq_##suffix(vdupq_n_##suffix(0), a.val, _Tpvec::nlanes - n)); } \ -template<> inline _Tpvec v_rotate_left<0>(const _Tpvec& a) \ -{ return a; } \ -template inline _Tpvec v_rotate_right(const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(vextq_##suffix(a.val, b.val, n)); } \ -template inline _Tpvec v_rotate_left(const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(vextq_##suffix(b.val, a.val, _Tpvec::nlanes - n)); } \ -template<> inline _Tpvec v_rotate_left<0>(const _Tpvec& a, const _Tpvec& b) \ -{ CV_UNUSED(b); return a; } - -OPENCV_HAL_IMPL_NEON_ROTATE_OP(v_uint8x16, u8) -OPENCV_HAL_IMPL_NEON_ROTATE_OP(v_int8x16, s8) -OPENCV_HAL_IMPL_NEON_ROTATE_OP(v_uint16x8, u16) -OPENCV_HAL_IMPL_NEON_ROTATE_OP(v_int16x8, s16) -OPENCV_HAL_IMPL_NEON_ROTATE_OP(v_uint32x4, u32) -OPENCV_HAL_IMPL_NEON_ROTATE_OP(v_int32x4, s32) -OPENCV_HAL_IMPL_NEON_ROTATE_OP(v_float32x4, f32) -OPENCV_HAL_IMPL_NEON_ROTATE_OP(v_uint64x2, u64) -OPENCV_HAL_IMPL_NEON_ROTATE_OP(v_int64x2, s64) -#if CV_SIMD128_64F -OPENCV_HAL_IMPL_NEON_ROTATE_OP(v_float64x2, f64) -#endif - -#define OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(_Tpvec, _Tp, suffix) \ -inline _Tpvec v_load(const _Tp* ptr) \ -{ return _Tpvec(vld1q_##suffix(ptr)); } \ -inline _Tpvec v_load_aligned(const _Tp* ptr) \ -{ return _Tpvec(vld1q_##suffix(ptr)); } \ -inline _Tpvec v_load_low(const _Tp* ptr) \ -{ return _Tpvec(vcombine_##suffix(vld1_##suffix(ptr), vdup_n_##suffix((_Tp)0))); } \ -inline _Tpvec v_load_halves(const _Tp* ptr0, const _Tp* ptr1) \ -{ return _Tpvec(vcombine_##suffix(vld1_##suffix(ptr0), vld1_##suffix(ptr1))); } \ -inline void v_store(_Tp* ptr, const _Tpvec& a) \ -{ vst1q_##suffix(ptr, a.val); } \ -inline void v_store_aligned(_Tp* ptr, const _Tpvec& a) \ -{ vst1q_##suffix(ptr, a.val); } \ -inline void v_store_aligned_nocache(_Tp* ptr, const _Tpvec& a) \ -{ vst1q_##suffix(ptr, a.val); } \ -inline void v_store(_Tp* ptr, const _Tpvec& a, hal::StoreMode /*mode*/) \ -{ vst1q_##suffix(ptr, a.val); } \ -inline void v_store_low(_Tp* ptr, const _Tpvec& a) \ -{ vst1_##suffix(ptr, vget_low_##suffix(a.val)); } \ -inline void v_store_high(_Tp* ptr, const _Tpvec& a) \ -{ vst1_##suffix(ptr, vget_high_##suffix(a.val)); } - -OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_uint8x16, uchar, u8) -OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_int8x16, schar, s8) -OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_uint16x8, ushort, u16) -OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_int16x8, short, s16) -OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_uint32x4, unsigned, u32) -OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_int32x4, int, s32) -OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_uint64x2, uint64, u64) -OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_int64x2, int64, s64) -OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_float32x4, float, f32) -#if CV_SIMD128_64F -OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_float64x2, double, f64) -#endif - -#define OPENCV_HAL_IMPL_NEON_REDUCE_OP_8(_Tpvec, _Tpnvec, scalartype, func, vectorfunc, suffix) \ -inline scalartype v_reduce_##func(const _Tpvec& a) \ -{ \ - _Tpnvec##_t a0 = vp##vectorfunc##_##suffix(vget_low_##suffix(a.val), vget_high_##suffix(a.val)); \ - a0 = vp##vectorfunc##_##suffix(a0, a0); \ - return (scalartype)vget_lane_##suffix(vp##vectorfunc##_##suffix(a0, a0),0); \ -} - -OPENCV_HAL_IMPL_NEON_REDUCE_OP_8(v_uint16x8, uint16x4, unsigned short, sum, add, u16) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_8(v_uint16x8, uint16x4, unsigned short, max, max, u16) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_8(v_uint16x8, uint16x4, unsigned short, min, min, u16) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_8(v_int16x8, int16x4, short, sum, add, s16) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_8(v_int16x8, int16x4, short, max, max, s16) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_8(v_int16x8, int16x4, short, min, min, s16) - -#define OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(_Tpvec, _Tpnvec, scalartype, func, vectorfunc, suffix) \ -inline scalartype v_reduce_##func(const _Tpvec& a) \ -{ \ - _Tpnvec##_t a0 = vp##vectorfunc##_##suffix(vget_low_##suffix(a.val), vget_high_##suffix(a.val)); \ - return (scalartype)vget_lane_##suffix(vp##vectorfunc##_##suffix(a0, vget_high_##suffix(a.val)),0); \ -} - -OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_uint32x4, uint32x2, unsigned, sum, add, u32) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_uint32x4, uint32x2, unsigned, max, max, u32) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_uint32x4, uint32x2, unsigned, min, min, u32) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_int32x4, int32x2, int, sum, add, s32) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_int32x4, int32x2, int, max, max, s32) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_int32x4, int32x2, int, min, min, s32) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_float32x4, float32x2, float, sum, add, f32) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_float32x4, float32x2, float, max, max, f32) -OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_float32x4, float32x2, float, min, min, f32) - -#if CV_SIMD128_64F -inline double v_reduce_sum(const v_float64x2& a) -{ - return vgetq_lane_f64(a.val, 0) + vgetq_lane_f64(a.val, 1); -} -#endif - -inline v_float32x4 v_reduce_sum4(const v_float32x4& a, const v_float32x4& b, - const v_float32x4& c, const v_float32x4& d) -{ - float32x4x2_t ab = vtrnq_f32(a.val, b.val); - float32x4x2_t cd = vtrnq_f32(c.val, d.val); - - float32x4_t u0 = vaddq_f32(ab.val[0], ab.val[1]); // a0+a1 b0+b1 a2+a3 b2+b3 - float32x4_t u1 = vaddq_f32(cd.val[0], cd.val[1]); // c0+c1 d0+d1 c2+c3 d2+d3 - - float32x4_t v0 = vcombine_f32(vget_low_f32(u0), vget_low_f32(u1)); - float32x4_t v1 = vcombine_f32(vget_high_f32(u0), vget_high_f32(u1)); - - return v_float32x4(vaddq_f32(v0, v1)); -} - -inline unsigned v_reduce_sad(const v_uint8x16& a, const v_uint8x16& b) -{ - uint32x4_t t0 = vpaddlq_u16(vpaddlq_u8(vabdq_u8(a.val, b.val))); - uint32x2_t t1 = vpadd_u32(vget_low_u32(t0), vget_high_u32(t0)); - return vget_lane_u32(vpadd_u32(t1, t1), 0); -} -inline unsigned v_reduce_sad(const v_int8x16& a, const v_int8x16& b) -{ - uint32x4_t t0 = vpaddlq_u16(vpaddlq_u8(vreinterpretq_u8_s8(vabdq_s8(a.val, b.val)))); - uint32x2_t t1 = vpadd_u32(vget_low_u32(t0), vget_high_u32(t0)); - return vget_lane_u32(vpadd_u32(t1, t1), 0); -} -inline unsigned v_reduce_sad(const v_uint16x8& a, const v_uint16x8& b) -{ - uint32x4_t t0 = vpaddlq_u16(vabdq_u16(a.val, b.val)); - uint32x2_t t1 = vpadd_u32(vget_low_u32(t0), vget_high_u32(t0)); - return vget_lane_u32(vpadd_u32(t1, t1), 0); -} -inline unsigned v_reduce_sad(const v_int16x8& a, const v_int16x8& b) -{ - uint32x4_t t0 = vpaddlq_u16(vreinterpretq_u16_s16(vabdq_s16(a.val, b.val))); - uint32x2_t t1 = vpadd_u32(vget_low_u32(t0), vget_high_u32(t0)); - return vget_lane_u32(vpadd_u32(t1, t1), 0); -} -inline unsigned v_reduce_sad(const v_uint32x4& a, const v_uint32x4& b) -{ - uint32x4_t t0 = vabdq_u32(a.val, b.val); - uint32x2_t t1 = vpadd_u32(vget_low_u32(t0), vget_high_u32(t0)); - return vget_lane_u32(vpadd_u32(t1, t1), 0); -} -inline unsigned v_reduce_sad(const v_int32x4& a, const v_int32x4& b) -{ - uint32x4_t t0 = vreinterpretq_u32_s32(vabdq_s32(a.val, b.val)); - uint32x2_t t1 = vpadd_u32(vget_low_u32(t0), vget_high_u32(t0)); - return vget_lane_u32(vpadd_u32(t1, t1), 0); -} -inline float v_reduce_sad(const v_float32x4& a, const v_float32x4& b) -{ - float32x4_t t0 = vabdq_f32(a.val, b.val); - float32x2_t t1 = vpadd_f32(vget_low_f32(t0), vget_high_f32(t0)); - return vget_lane_f32(vpadd_f32(t1, t1), 0); -} - -#define OPENCV_HAL_IMPL_NEON_POPCOUNT(_Tpvec, cast) \ -inline v_uint32x4 v_popcount(const _Tpvec& a) \ -{ \ - uint8x16_t t = vcntq_u8(cast(a.val)); \ - uint16x8_t t0 = vpaddlq_u8(t); /* 16 -> 8 */ \ - uint32x4_t t1 = vpaddlq_u16(t0); /* 8 -> 4 */ \ - return v_uint32x4(t1); \ -} - -OPENCV_HAL_IMPL_NEON_POPCOUNT(v_uint8x16, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_NEON_POPCOUNT(v_uint16x8, vreinterpretq_u8_u16) -OPENCV_HAL_IMPL_NEON_POPCOUNT(v_uint32x4, vreinterpretq_u8_u32) -OPENCV_HAL_IMPL_NEON_POPCOUNT(v_int8x16, vreinterpretq_u8_s8) -OPENCV_HAL_IMPL_NEON_POPCOUNT(v_int16x8, vreinterpretq_u8_s16) -OPENCV_HAL_IMPL_NEON_POPCOUNT(v_int32x4, vreinterpretq_u8_s32) - -inline int v_signmask(const v_uint8x16& a) -{ - int8x8_t m0 = vcreate_s8(CV_BIG_UINT(0x0706050403020100)); - uint8x16_t v0 = vshlq_u8(vshrq_n_u8(a.val, 7), vcombine_s8(m0, m0)); - uint64x2_t v1 = vpaddlq_u32(vpaddlq_u16(vpaddlq_u8(v0))); - return (int)vgetq_lane_u64(v1, 0) + ((int)vgetq_lane_u64(v1, 1) << 8); -} -inline int v_signmask(const v_int8x16& a) -{ return v_signmask(v_reinterpret_as_u8(a)); } - -inline int v_signmask(const v_uint16x8& a) -{ - int16x4_t m0 = vcreate_s16(CV_BIG_UINT(0x0003000200010000)); - uint16x8_t v0 = vshlq_u16(vshrq_n_u16(a.val, 15), vcombine_s16(m0, m0)); - uint64x2_t v1 = vpaddlq_u32(vpaddlq_u16(v0)); - return (int)vgetq_lane_u64(v1, 0) + ((int)vgetq_lane_u64(v1, 1) << 4); -} -inline int v_signmask(const v_int16x8& a) -{ return v_signmask(v_reinterpret_as_u16(a)); } - -inline int v_signmask(const v_uint32x4& a) -{ - int32x2_t m0 = vcreate_s32(CV_BIG_UINT(0x0000000100000000)); - uint32x4_t v0 = vshlq_u32(vshrq_n_u32(a.val, 31), vcombine_s32(m0, m0)); - uint64x2_t v1 = vpaddlq_u32(v0); - return (int)vgetq_lane_u64(v1, 0) + ((int)vgetq_lane_u64(v1, 1) << 2); -} -inline int v_signmask(const v_int32x4& a) -{ return v_signmask(v_reinterpret_as_u32(a)); } -inline int v_signmask(const v_float32x4& a) -{ return v_signmask(v_reinterpret_as_u32(a)); } -#if CV_SIMD128_64F -inline int v_signmask(const v_uint64x2& a) -{ - int64x1_t m0 = vdup_n_s64(0); - uint64x2_t v0 = vshlq_u64(vshrq_n_u64(a.val, 63), vcombine_s64(m0, m0)); - return (int)vgetq_lane_u64(v0, 0) + ((int)vgetq_lane_u64(v0, 1) << 1); -} -inline int v_signmask(const v_float64x2& a) -{ return v_signmask(v_reinterpret_as_u64(a)); } -#endif - -#define OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(_Tpvec, suffix, shift) \ -inline bool v_check_all(const v_##_Tpvec& a) \ -{ \ - _Tpvec##_t v0 = vshrq_n_##suffix(vmvnq_##suffix(a.val), shift); \ - uint64x2_t v1 = vreinterpretq_u64_##suffix(v0); \ - return (vgetq_lane_u64(v1, 0) | vgetq_lane_u64(v1, 1)) == 0; \ -} \ -inline bool v_check_any(const v_##_Tpvec& a) \ -{ \ - _Tpvec##_t v0 = vshrq_n_##suffix(a.val, shift); \ - uint64x2_t v1 = vreinterpretq_u64_##suffix(v0); \ - return (vgetq_lane_u64(v1, 0) | vgetq_lane_u64(v1, 1)) != 0; \ -} - -OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(uint8x16, u8, 7) -OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(uint16x8, u16, 15) -OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(uint32x4, u32, 31) -#if CV_SIMD128_64F -OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(uint64x2, u64, 63) -#endif - -inline bool v_check_all(const v_int8x16& a) -{ return v_check_all(v_reinterpret_as_u8(a)); } -inline bool v_check_all(const v_int16x8& a) -{ return v_check_all(v_reinterpret_as_u16(a)); } -inline bool v_check_all(const v_int32x4& a) -{ return v_check_all(v_reinterpret_as_u32(a)); } -inline bool v_check_all(const v_float32x4& a) -{ return v_check_all(v_reinterpret_as_u32(a)); } - -inline bool v_check_any(const v_int8x16& a) -{ return v_check_any(v_reinterpret_as_u8(a)); } -inline bool v_check_any(const v_int16x8& a) -{ return v_check_any(v_reinterpret_as_u16(a)); } -inline bool v_check_any(const v_int32x4& a) -{ return v_check_any(v_reinterpret_as_u32(a)); } -inline bool v_check_any(const v_float32x4& a) -{ return v_check_any(v_reinterpret_as_u32(a)); } - -#if CV_SIMD128_64F -inline bool v_check_all(const v_int64x2& a) -{ return v_check_all(v_reinterpret_as_u64(a)); } -inline bool v_check_all(const v_float64x2& a) -{ return v_check_all(v_reinterpret_as_u64(a)); } -inline bool v_check_any(const v_int64x2& a) -{ return v_check_any(v_reinterpret_as_u64(a)); } -inline bool v_check_any(const v_float64x2& a) -{ return v_check_any(v_reinterpret_as_u64(a)); } -#endif - -#define OPENCV_HAL_IMPL_NEON_SELECT(_Tpvec, suffix, usuffix) \ -inline _Tpvec v_select(const _Tpvec& mask, const _Tpvec& a, const _Tpvec& b) \ -{ \ - return _Tpvec(vbslq_##suffix(vreinterpretq_##usuffix##_##suffix(mask.val), a.val, b.val)); \ -} - -OPENCV_HAL_IMPL_NEON_SELECT(v_uint8x16, u8, u8) -OPENCV_HAL_IMPL_NEON_SELECT(v_int8x16, s8, u8) -OPENCV_HAL_IMPL_NEON_SELECT(v_uint16x8, u16, u16) -OPENCV_HAL_IMPL_NEON_SELECT(v_int16x8, s16, u16) -OPENCV_HAL_IMPL_NEON_SELECT(v_uint32x4, u32, u32) -OPENCV_HAL_IMPL_NEON_SELECT(v_int32x4, s32, u32) -OPENCV_HAL_IMPL_NEON_SELECT(v_float32x4, f32, u32) -#if CV_SIMD128_64F -OPENCV_HAL_IMPL_NEON_SELECT(v_float64x2, f64, u64) -#endif - -#define OPENCV_HAL_IMPL_NEON_EXPAND(_Tpvec, _Tpwvec, _Tp, suffix) \ -inline void v_expand(const _Tpvec& a, _Tpwvec& b0, _Tpwvec& b1) \ -{ \ - b0.val = vmovl_##suffix(vget_low_##suffix(a.val)); \ - b1.val = vmovl_##suffix(vget_high_##suffix(a.val)); \ -} \ -inline _Tpwvec v_expand_low(const _Tpvec& a) \ -{ \ - return _Tpwvec(vmovl_##suffix(vget_low_##suffix(a.val))); \ -} \ -inline _Tpwvec v_expand_high(const _Tpvec& a) \ -{ \ - return _Tpwvec(vmovl_##suffix(vget_high_##suffix(a.val))); \ -} \ -inline _Tpwvec v_load_expand(const _Tp* ptr) \ -{ \ - return _Tpwvec(vmovl_##suffix(vld1_##suffix(ptr))); \ -} - -OPENCV_HAL_IMPL_NEON_EXPAND(v_uint8x16, v_uint16x8, uchar, u8) -OPENCV_HAL_IMPL_NEON_EXPAND(v_int8x16, v_int16x8, schar, s8) -OPENCV_HAL_IMPL_NEON_EXPAND(v_uint16x8, v_uint32x4, ushort, u16) -OPENCV_HAL_IMPL_NEON_EXPAND(v_int16x8, v_int32x4, short, s16) -OPENCV_HAL_IMPL_NEON_EXPAND(v_uint32x4, v_uint64x2, uint, u32) -OPENCV_HAL_IMPL_NEON_EXPAND(v_int32x4, v_int64x2, int, s32) - -inline v_uint32x4 v_load_expand_q(const uchar* ptr) -{ - typedef unsigned int CV_DECL_ALIGNED(1) unaligned_uint; - uint8x8_t v0 = vcreate_u8(*(unaligned_uint*)ptr); - uint16x4_t v1 = vget_low_u16(vmovl_u8(v0)); - return v_uint32x4(vmovl_u16(v1)); -} - -inline v_int32x4 v_load_expand_q(const schar* ptr) -{ - typedef unsigned int CV_DECL_ALIGNED(1) unaligned_uint; - int8x8_t v0 = vcreate_s8(*(unaligned_uint*)ptr); - int16x4_t v1 = vget_low_s16(vmovl_s8(v0)); - return v_int32x4(vmovl_s16(v1)); -} - -#if defined(__aarch64__) -#define OPENCV_HAL_IMPL_NEON_UNPACKS(_Tpvec, suffix) \ -inline void v_zip(const v_##_Tpvec& a0, const v_##_Tpvec& a1, v_##_Tpvec& b0, v_##_Tpvec& b1) \ -{ \ - b0.val = vzip1q_##suffix(a0.val, a1.val); \ - b1.val = vzip2q_##suffix(a0.val, a1.val); \ -} \ -inline v_##_Tpvec v_combine_low(const v_##_Tpvec& a, const v_##_Tpvec& b) \ -{ \ - return v_##_Tpvec(vcombine_##suffix(vget_low_##suffix(a.val), vget_low_##suffix(b.val))); \ -} \ -inline v_##_Tpvec v_combine_high(const v_##_Tpvec& a, const v_##_Tpvec& b) \ -{ \ - return v_##_Tpvec(vcombine_##suffix(vget_high_##suffix(a.val), vget_high_##suffix(b.val))); \ -} \ -inline void v_recombine(const v_##_Tpvec& a, const v_##_Tpvec& b, v_##_Tpvec& c, v_##_Tpvec& d) \ -{ \ - c.val = vcombine_##suffix(vget_low_##suffix(a.val), vget_low_##suffix(b.val)); \ - d.val = vcombine_##suffix(vget_high_##suffix(a.val), vget_high_##suffix(b.val)); \ -} -#else -#define OPENCV_HAL_IMPL_NEON_UNPACKS(_Tpvec, suffix) \ -inline void v_zip(const v_##_Tpvec& a0, const v_##_Tpvec& a1, v_##_Tpvec& b0, v_##_Tpvec& b1) \ -{ \ - _Tpvec##x2_t p = vzipq_##suffix(a0.val, a1.val); \ - b0.val = p.val[0]; \ - b1.val = p.val[1]; \ -} \ -inline v_##_Tpvec v_combine_low(const v_##_Tpvec& a, const v_##_Tpvec& b) \ -{ \ - return v_##_Tpvec(vcombine_##suffix(vget_low_##suffix(a.val), vget_low_##suffix(b.val))); \ -} \ -inline v_##_Tpvec v_combine_high(const v_##_Tpvec& a, const v_##_Tpvec& b) \ -{ \ - return v_##_Tpvec(vcombine_##suffix(vget_high_##suffix(a.val), vget_high_##suffix(b.val))); \ -} \ -inline void v_recombine(const v_##_Tpvec& a, const v_##_Tpvec& b, v_##_Tpvec& c, v_##_Tpvec& d) \ -{ \ - c.val = vcombine_##suffix(vget_low_##suffix(a.val), vget_low_##suffix(b.val)); \ - d.val = vcombine_##suffix(vget_high_##suffix(a.val), vget_high_##suffix(b.val)); \ -} -#endif - -OPENCV_HAL_IMPL_NEON_UNPACKS(uint8x16, u8) -OPENCV_HAL_IMPL_NEON_UNPACKS(int8x16, s8) -OPENCV_HAL_IMPL_NEON_UNPACKS(uint16x8, u16) -OPENCV_HAL_IMPL_NEON_UNPACKS(int16x8, s16) -OPENCV_HAL_IMPL_NEON_UNPACKS(uint32x4, u32) -OPENCV_HAL_IMPL_NEON_UNPACKS(int32x4, s32) -OPENCV_HAL_IMPL_NEON_UNPACKS(float32x4, f32) -#if CV_SIMD128_64F -OPENCV_HAL_IMPL_NEON_UNPACKS(float64x2, f64) -#endif - -#define OPENCV_HAL_IMPL_NEON_EXTRACT(_Tpvec, suffix) \ -template \ -inline v_##_Tpvec v_extract(const v_##_Tpvec& a, const v_##_Tpvec& b) \ -{ \ - return v_##_Tpvec(vextq_##suffix(a.val, b.val, s)); \ -} - -OPENCV_HAL_IMPL_NEON_EXTRACT(uint8x16, u8) -OPENCV_HAL_IMPL_NEON_EXTRACT(int8x16, s8) -OPENCV_HAL_IMPL_NEON_EXTRACT(uint16x8, u16) -OPENCV_HAL_IMPL_NEON_EXTRACT(int16x8, s16) -OPENCV_HAL_IMPL_NEON_EXTRACT(uint32x4, u32) -OPENCV_HAL_IMPL_NEON_EXTRACT(int32x4, s32) -OPENCV_HAL_IMPL_NEON_EXTRACT(uint64x2, u64) -OPENCV_HAL_IMPL_NEON_EXTRACT(int64x2, s64) -OPENCV_HAL_IMPL_NEON_EXTRACT(float32x4, f32) -#if CV_SIMD128_64F -OPENCV_HAL_IMPL_NEON_EXTRACT(float64x2, f64) -#endif - -#if CV_SIMD128_64F -inline v_int32x4 v_round(const v_float32x4& a) -{ - float32x4_t a_ = a.val; - int32x4_t result; - __asm__ ("fcvtns %0.4s, %1.4s" - : "=w"(result) - : "w"(a_) - : /* No clobbers */); - return v_int32x4(result); -} -#else -inline v_int32x4 v_round(const v_float32x4& a) -{ - static const int32x4_t v_sign = vdupq_n_s32(1 << 31), - v_05 = vreinterpretq_s32_f32(vdupq_n_f32(0.5f)); - - int32x4_t v_addition = vorrq_s32(v_05, vandq_s32(v_sign, vreinterpretq_s32_f32(a.val))); - return v_int32x4(vcvtq_s32_f32(vaddq_f32(a.val, vreinterpretq_f32_s32(v_addition)))); -} -#endif -inline v_int32x4 v_floor(const v_float32x4& a) -{ - int32x4_t a1 = vcvtq_s32_f32(a.val); - uint32x4_t mask = vcgtq_f32(vcvtq_f32_s32(a1), a.val); - return v_int32x4(vaddq_s32(a1, vreinterpretq_s32_u32(mask))); -} - -inline v_int32x4 v_ceil(const v_float32x4& a) -{ - int32x4_t a1 = vcvtq_s32_f32(a.val); - uint32x4_t mask = vcgtq_f32(a.val, vcvtq_f32_s32(a1)); - return v_int32x4(vsubq_s32(a1, vreinterpretq_s32_u32(mask))); -} - -inline v_int32x4 v_trunc(const v_float32x4& a) -{ return v_int32x4(vcvtq_s32_f32(a.val)); } - -#if CV_SIMD128_64F -inline v_int32x4 v_round(const v_float64x2& a) -{ - static const int32x2_t zero = vdup_n_s32(0); - return v_int32x4(vcombine_s32(vmovn_s64(vcvtaq_s64_f64(a.val)), zero)); -} - -inline v_int32x4 v_round(const v_float64x2& a, const v_float64x2& b) -{ - return v_int32x4(vcombine_s32(vmovn_s64(vcvtaq_s64_f64(a.val)), vmovn_s64(vcvtaq_s64_f64(b.val)))); -} - -inline v_int32x4 v_floor(const v_float64x2& a) -{ - static const int32x2_t zero = vdup_n_s32(0); - int64x2_t a1 = vcvtq_s64_f64(a.val); - uint64x2_t mask = vcgtq_f64(vcvtq_f64_s64(a1), a.val); - a1 = vaddq_s64(a1, vreinterpretq_s64_u64(mask)); - return v_int32x4(vcombine_s32(vmovn_s64(a1), zero)); -} - -inline v_int32x4 v_ceil(const v_float64x2& a) -{ - static const int32x2_t zero = vdup_n_s32(0); - int64x2_t a1 = vcvtq_s64_f64(a.val); - uint64x2_t mask = vcgtq_f64(a.val, vcvtq_f64_s64(a1)); - a1 = vsubq_s64(a1, vreinterpretq_s64_u64(mask)); - return v_int32x4(vcombine_s32(vmovn_s64(a1), zero)); -} - -inline v_int32x4 v_trunc(const v_float64x2& a) -{ - static const int32x2_t zero = vdup_n_s32(0); - return v_int32x4(vcombine_s32(vmovn_s64(vcvtaq_s64_f64(a.val)), zero)); -} -#endif - -#define OPENCV_HAL_IMPL_NEON_TRANSPOSE4x4(_Tpvec, suffix) \ -inline void v_transpose4x4(const v_##_Tpvec& a0, const v_##_Tpvec& a1, \ - const v_##_Tpvec& a2, const v_##_Tpvec& a3, \ - v_##_Tpvec& b0, v_##_Tpvec& b1, \ - v_##_Tpvec& b2, v_##_Tpvec& b3) \ -{ \ - /* m00 m01 m02 m03 */ \ - /* m10 m11 m12 m13 */ \ - /* m20 m21 m22 m23 */ \ - /* m30 m31 m32 m33 */ \ - _Tpvec##x2_t t0 = vtrnq_##suffix(a0.val, a1.val); \ - _Tpvec##x2_t t1 = vtrnq_##suffix(a2.val, a3.val); \ - /* m00 m10 m02 m12 */ \ - /* m01 m11 m03 m13 */ \ - /* m20 m30 m22 m32 */ \ - /* m21 m31 m23 m33 */ \ - b0.val = vcombine_##suffix(vget_low_##suffix(t0.val[0]), vget_low_##suffix(t1.val[0])); \ - b1.val = vcombine_##suffix(vget_low_##suffix(t0.val[1]), vget_low_##suffix(t1.val[1])); \ - b2.val = vcombine_##suffix(vget_high_##suffix(t0.val[0]), vget_high_##suffix(t1.val[0])); \ - b3.val = vcombine_##suffix(vget_high_##suffix(t0.val[1]), vget_high_##suffix(t1.val[1])); \ -} - -OPENCV_HAL_IMPL_NEON_TRANSPOSE4x4(uint32x4, u32) -OPENCV_HAL_IMPL_NEON_TRANSPOSE4x4(int32x4, s32) -OPENCV_HAL_IMPL_NEON_TRANSPOSE4x4(float32x4, f32) - -#define OPENCV_HAL_IMPL_NEON_INTERLEAVED(_Tpvec, _Tp, suffix) \ -inline void v_load_deinterleave(const _Tp* ptr, v_##_Tpvec& a, v_##_Tpvec& b) \ -{ \ - _Tpvec##x2_t v = vld2q_##suffix(ptr); \ - a.val = v.val[0]; \ - b.val = v.val[1]; \ -} \ -inline void v_load_deinterleave(const _Tp* ptr, v_##_Tpvec& a, v_##_Tpvec& b, v_##_Tpvec& c) \ -{ \ - _Tpvec##x3_t v = vld3q_##suffix(ptr); \ - a.val = v.val[0]; \ - b.val = v.val[1]; \ - c.val = v.val[2]; \ -} \ -inline void v_load_deinterleave(const _Tp* ptr, v_##_Tpvec& a, v_##_Tpvec& b, \ - v_##_Tpvec& c, v_##_Tpvec& d) \ -{ \ - _Tpvec##x4_t v = vld4q_##suffix(ptr); \ - a.val = v.val[0]; \ - b.val = v.val[1]; \ - c.val = v.val[2]; \ - d.val = v.val[3]; \ -} \ -inline void v_store_interleave( _Tp* ptr, const v_##_Tpvec& a, const v_##_Tpvec& b, \ - hal::StoreMode /*mode*/=hal::STORE_UNALIGNED) \ -{ \ - _Tpvec##x2_t v; \ - v.val[0] = a.val; \ - v.val[1] = b.val; \ - vst2q_##suffix(ptr, v); \ -} \ -inline void v_store_interleave( _Tp* ptr, const v_##_Tpvec& a, const v_##_Tpvec& b, \ - const v_##_Tpvec& c, hal::StoreMode /*mode*/=hal::STORE_UNALIGNED) \ -{ \ - _Tpvec##x3_t v; \ - v.val[0] = a.val; \ - v.val[1] = b.val; \ - v.val[2] = c.val; \ - vst3q_##suffix(ptr, v); \ -} \ -inline void v_store_interleave( _Tp* ptr, const v_##_Tpvec& a, const v_##_Tpvec& b, \ - const v_##_Tpvec& c, const v_##_Tpvec& d, \ - hal::StoreMode /*mode*/=hal::STORE_UNALIGNED ) \ -{ \ - _Tpvec##x4_t v; \ - v.val[0] = a.val; \ - v.val[1] = b.val; \ - v.val[2] = c.val; \ - v.val[3] = d.val; \ - vst4q_##suffix(ptr, v); \ -} - -#define OPENCV_HAL_IMPL_NEON_INTERLEAVED_INT64(tp, suffix) \ -inline void v_load_deinterleave( const tp* ptr, v_##tp##x2& a, v_##tp##x2& b ) \ -{ \ - tp##x1_t a0 = vld1_##suffix(ptr); \ - tp##x1_t b0 = vld1_##suffix(ptr + 1); \ - tp##x1_t a1 = vld1_##suffix(ptr + 2); \ - tp##x1_t b1 = vld1_##suffix(ptr + 3); \ - a = v_##tp##x2(vcombine_##suffix(a0, a1)); \ - b = v_##tp##x2(vcombine_##suffix(b0, b1)); \ -} \ - \ -inline void v_load_deinterleave( const tp* ptr, v_##tp##x2& a, \ - v_##tp##x2& b, v_##tp##x2& c ) \ -{ \ - tp##x1_t a0 = vld1_##suffix(ptr); \ - tp##x1_t b0 = vld1_##suffix(ptr + 1); \ - tp##x1_t c0 = vld1_##suffix(ptr + 2); \ - tp##x1_t a1 = vld1_##suffix(ptr + 3); \ - tp##x1_t b1 = vld1_##suffix(ptr + 4); \ - tp##x1_t c1 = vld1_##suffix(ptr + 5); \ - a = v_##tp##x2(vcombine_##suffix(a0, a1)); \ - b = v_##tp##x2(vcombine_##suffix(b0, b1)); \ - c = v_##tp##x2(vcombine_##suffix(c0, c1)); \ -} \ - \ -inline void v_load_deinterleave( const tp* ptr, v_##tp##x2& a, v_##tp##x2& b, \ - v_##tp##x2& c, v_##tp##x2& d ) \ -{ \ - tp##x1_t a0 = vld1_##suffix(ptr); \ - tp##x1_t b0 = vld1_##suffix(ptr + 1); \ - tp##x1_t c0 = vld1_##suffix(ptr + 2); \ - tp##x1_t d0 = vld1_##suffix(ptr + 3); \ - tp##x1_t a1 = vld1_##suffix(ptr + 4); \ - tp##x1_t b1 = vld1_##suffix(ptr + 5); \ - tp##x1_t c1 = vld1_##suffix(ptr + 6); \ - tp##x1_t d1 = vld1_##suffix(ptr + 7); \ - a = v_##tp##x2(vcombine_##suffix(a0, a1)); \ - b = v_##tp##x2(vcombine_##suffix(b0, b1)); \ - c = v_##tp##x2(vcombine_##suffix(c0, c1)); \ - d = v_##tp##x2(vcombine_##suffix(d0, d1)); \ -} \ - \ -inline void v_store_interleave( tp* ptr, const v_##tp##x2& a, const v_##tp##x2& b, \ - hal::StoreMode /*mode*/=hal::STORE_UNALIGNED) \ -{ \ - vst1_##suffix(ptr, vget_low_##suffix(a.val)); \ - vst1_##suffix(ptr + 1, vget_low_##suffix(b.val)); \ - vst1_##suffix(ptr + 2, vget_high_##suffix(a.val)); \ - vst1_##suffix(ptr + 3, vget_high_##suffix(b.val)); \ -} \ - \ -inline void v_store_interleave( tp* ptr, const v_##tp##x2& a, \ - const v_##tp##x2& b, const v_##tp##x2& c, \ - hal::StoreMode /*mode*/=hal::STORE_UNALIGNED) \ -{ \ - vst1_##suffix(ptr, vget_low_##suffix(a.val)); \ - vst1_##suffix(ptr + 1, vget_low_##suffix(b.val)); \ - vst1_##suffix(ptr + 2, vget_low_##suffix(c.val)); \ - vst1_##suffix(ptr + 3, vget_high_##suffix(a.val)); \ - vst1_##suffix(ptr + 4, vget_high_##suffix(b.val)); \ - vst1_##suffix(ptr + 5, vget_high_##suffix(c.val)); \ -} \ - \ -inline void v_store_interleave( tp* ptr, const v_##tp##x2& a, const v_##tp##x2& b, \ - const v_##tp##x2& c, const v_##tp##x2& d, \ - hal::StoreMode /*mode*/=hal::STORE_UNALIGNED) \ -{ \ - vst1_##suffix(ptr, vget_low_##suffix(a.val)); \ - vst1_##suffix(ptr + 1, vget_low_##suffix(b.val)); \ - vst1_##suffix(ptr + 2, vget_low_##suffix(c.val)); \ - vst1_##suffix(ptr + 3, vget_low_##suffix(d.val)); \ - vst1_##suffix(ptr + 4, vget_high_##suffix(a.val)); \ - vst1_##suffix(ptr + 5, vget_high_##suffix(b.val)); \ - vst1_##suffix(ptr + 6, vget_high_##suffix(c.val)); \ - vst1_##suffix(ptr + 7, vget_high_##suffix(d.val)); \ -} - -OPENCV_HAL_IMPL_NEON_INTERLEAVED(uint8x16, uchar, u8) -OPENCV_HAL_IMPL_NEON_INTERLEAVED(int8x16, schar, s8) -OPENCV_HAL_IMPL_NEON_INTERLEAVED(uint16x8, ushort, u16) -OPENCV_HAL_IMPL_NEON_INTERLEAVED(int16x8, short, s16) -OPENCV_HAL_IMPL_NEON_INTERLEAVED(uint32x4, unsigned, u32) -OPENCV_HAL_IMPL_NEON_INTERLEAVED(int32x4, int, s32) -OPENCV_HAL_IMPL_NEON_INTERLEAVED(float32x4, float, f32) -#if CV_SIMD128_64F -OPENCV_HAL_IMPL_NEON_INTERLEAVED(float64x2, double, f64) -#endif - -OPENCV_HAL_IMPL_NEON_INTERLEAVED_INT64(int64, s64) -OPENCV_HAL_IMPL_NEON_INTERLEAVED_INT64(uint64, u64) - -inline v_float32x4 v_cvt_f32(const v_int32x4& a) -{ - return v_float32x4(vcvtq_f32_s32(a.val)); -} - -#if CV_SIMD128_64F -inline v_float32x4 v_cvt_f32(const v_float64x2& a) -{ - float32x2_t zero = vdup_n_f32(0.0f); - return v_float32x4(vcombine_f32(vcvt_f32_f64(a.val), zero)); -} - -inline v_float32x4 v_cvt_f32(const v_float64x2& a, const v_float64x2& b) -{ - return v_float32x4(vcombine_f32(vcvt_f32_f64(a.val), vcvt_f32_f64(b.val))); -} - -inline v_float64x2 v_cvt_f64(const v_int32x4& a) -{ - return v_float64x2(vcvt_f64_f32(vcvt_f32_s32(vget_low_s32(a.val)))); -} - -inline v_float64x2 v_cvt_f64_high(const v_int32x4& a) -{ - return v_float64x2(vcvt_f64_f32(vcvt_f32_s32(vget_high_s32(a.val)))); -} - -inline v_float64x2 v_cvt_f64(const v_float32x4& a) -{ - return v_float64x2(vcvt_f64_f32(vget_low_f32(a.val))); -} - -inline v_float64x2 v_cvt_f64_high(const v_float32x4& a) -{ - return v_float64x2(vcvt_f64_f32(vget_high_f32(a.val))); -} -#endif - -////////////// Lookup table access //////////////////// - -inline v_int8x16 v_lut(const schar* tab, const int* idx) -{ - schar CV_DECL_ALIGNED(32) elems[16] = - { - tab[idx[ 0]], - tab[idx[ 1]], - tab[idx[ 2]], - tab[idx[ 3]], - tab[idx[ 4]], - tab[idx[ 5]], - tab[idx[ 6]], - tab[idx[ 7]], - tab[idx[ 8]], - tab[idx[ 9]], - tab[idx[10]], - tab[idx[11]], - tab[idx[12]], - tab[idx[13]], - tab[idx[14]], - tab[idx[15]] - }; - return v_int8x16(vld1q_s8(elems)); -} -inline v_int8x16 v_lut_pairs(const schar* tab, const int* idx) -{ - schar CV_DECL_ALIGNED(32) elems[16] = - { - tab[idx[0]], - tab[idx[0] + 1], - tab[idx[1]], - tab[idx[1] + 1], - tab[idx[2]], - tab[idx[2] + 1], - tab[idx[3]], - tab[idx[3] + 1], - tab[idx[4]], - tab[idx[4] + 1], - tab[idx[5]], - tab[idx[5] + 1], - tab[idx[6]], - tab[idx[6] + 1], - tab[idx[7]], - tab[idx[7] + 1] - }; - return v_int8x16(vld1q_s8(elems)); -} -inline v_int8x16 v_lut_quads(const schar* tab, const int* idx) -{ - schar CV_DECL_ALIGNED(32) elems[16] = - { - tab[idx[0]], - tab[idx[0] + 1], - tab[idx[0] + 2], - tab[idx[0] + 3], - tab[idx[1]], - tab[idx[1] + 1], - tab[idx[1] + 2], - tab[idx[1] + 3], - tab[idx[2]], - tab[idx[2] + 1], - tab[idx[2] + 2], - tab[idx[2] + 3], - tab[idx[3]], - tab[idx[3] + 1], - tab[idx[3] + 2], - tab[idx[3] + 3] - }; - return v_int8x16(vld1q_s8(elems)); -} -inline v_uint8x16 v_lut(const uchar* tab, const int* idx) { return v_reinterpret_as_u8(v_lut((schar*)tab, idx)); } -inline v_uint8x16 v_lut_pairs(const uchar* tab, const int* idx) { return v_reinterpret_as_u8(v_lut_pairs((schar*)tab, idx)); } -inline v_uint8x16 v_lut_quads(const uchar* tab, const int* idx) { return v_reinterpret_as_u8(v_lut_quads((schar*)tab, idx)); } - -inline v_int16x8 v_lut(const short* tab, const int* idx) -{ - short CV_DECL_ALIGNED(32) elems[8] = - { - tab[idx[0]], - tab[idx[1]], - tab[idx[2]], - tab[idx[3]], - tab[idx[4]], - tab[idx[5]], - tab[idx[6]], - tab[idx[7]] - }; - return v_int16x8(vld1q_s16(elems)); -} -inline v_int16x8 v_lut_pairs(const short* tab, const int* idx) -{ - short CV_DECL_ALIGNED(32) elems[8] = - { - tab[idx[0]], - tab[idx[0] + 1], - tab[idx[1]], - tab[idx[1] + 1], - tab[idx[2]], - tab[idx[2] + 1], - tab[idx[3]], - tab[idx[3] + 1] - }; - return v_int16x8(vld1q_s16(elems)); -} -inline v_int16x8 v_lut_quads(const short* tab, const int* idx) -{ - return v_int16x8(vcombine_s16(vld1_s16(tab + idx[0]), vld1_s16(tab + idx[1]))); -} -inline v_uint16x8 v_lut(const ushort* tab, const int* idx) { return v_reinterpret_as_u16(v_lut((short*)tab, idx)); } -inline v_uint16x8 v_lut_pairs(const ushort* tab, const int* idx) { return v_reinterpret_as_u16(v_lut_pairs((short*)tab, idx)); } -inline v_uint16x8 v_lut_quads(const ushort* tab, const int* idx) { return v_reinterpret_as_u16(v_lut_quads((short*)tab, idx)); } - -inline v_int32x4 v_lut(const int* tab, const int* idx) -{ - int CV_DECL_ALIGNED(32) elems[4] = - { - tab[idx[0]], - tab[idx[1]], - tab[idx[2]], - tab[idx[3]] - }; - return v_int32x4(vld1q_s32(elems)); -} -inline v_int32x4 v_lut_pairs(const int* tab, const int* idx) -{ - return v_int32x4(vcombine_s32(vld1_s32(tab + idx[0]), vld1_s32(tab + idx[1]))); -} -inline v_int32x4 v_lut_quads(const int* tab, const int* idx) -{ - return v_int32x4(vld1q_s32(tab + idx[0])); -} -inline v_uint32x4 v_lut(const unsigned* tab, const int* idx) { return v_reinterpret_as_u32(v_lut((int*)tab, idx)); } -inline v_uint32x4 v_lut_pairs(const unsigned* tab, const int* idx) { return v_reinterpret_as_u32(v_lut_pairs((int*)tab, idx)); } -inline v_uint32x4 v_lut_quads(const unsigned* tab, const int* idx) { return v_reinterpret_as_u32(v_lut_quads((int*)tab, idx)); } - -inline v_int64x2 v_lut(const int64_t* tab, const int* idx) -{ - return v_int64x2(vcombine_s64(vcreate_s64(tab[idx[0]]), vcreate_s64(tab[idx[1]]))); -} -inline v_int64x2 v_lut_pairs(const int64_t* tab, const int* idx) -{ - return v_int64x2(vld1q_s64(tab + idx[0])); -} -inline v_uint64x2 v_lut(const uint64_t* tab, const int* idx) { return v_reinterpret_as_u64(v_lut((const int64_t *)tab, idx)); } -inline v_uint64x2 v_lut_pairs(const uint64_t* tab, const int* idx) { return v_reinterpret_as_u64(v_lut_pairs((const int64_t *)tab, idx)); } - -inline v_float32x4 v_lut(const float* tab, const int* idx) -{ - float CV_DECL_ALIGNED(32) elems[4] = - { - tab[idx[0]], - tab[idx[1]], - tab[idx[2]], - tab[idx[3]] - }; - return v_float32x4(vld1q_f32(elems)); -} -inline v_float32x4 v_lut_pairs(const float* tab, const int* idx) -{ - uint64 CV_DECL_ALIGNED(32) elems[2] = - { - *(uint64*)(tab + idx[0]), - *(uint64*)(tab + idx[1]) - }; - return v_float32x4(vreinterpretq_f32_u64(vld1q_u64(elems))); -} -inline v_float32x4 v_lut_quads(const float* tab, const int* idx) -{ - return v_float32x4(vld1q_f32(tab + idx[0])); -} - -inline v_int32x4 v_lut(const int* tab, const v_int32x4& idxvec) -{ - int CV_DECL_ALIGNED(32) elems[4] = - { - tab[vgetq_lane_s32(idxvec.val, 0)], - tab[vgetq_lane_s32(idxvec.val, 1)], - tab[vgetq_lane_s32(idxvec.val, 2)], - tab[vgetq_lane_s32(idxvec.val, 3)] - }; - return v_int32x4(vld1q_s32(elems)); -} - -inline v_uint32x4 v_lut(const unsigned* tab, const v_int32x4& idxvec) -{ - unsigned CV_DECL_ALIGNED(32) elems[4] = - { - tab[vgetq_lane_s32(idxvec.val, 0)], - tab[vgetq_lane_s32(idxvec.val, 1)], - tab[vgetq_lane_s32(idxvec.val, 2)], - tab[vgetq_lane_s32(idxvec.val, 3)] - }; - return v_uint32x4(vld1q_u32(elems)); -} - -inline v_float32x4 v_lut(const float* tab, const v_int32x4& idxvec) -{ - float CV_DECL_ALIGNED(32) elems[4] = - { - tab[vgetq_lane_s32(idxvec.val, 0)], - tab[vgetq_lane_s32(idxvec.val, 1)], - tab[vgetq_lane_s32(idxvec.val, 2)], - tab[vgetq_lane_s32(idxvec.val, 3)] - }; - return v_float32x4(vld1q_f32(elems)); -} - -inline void v_lut_deinterleave(const float* tab, const v_int32x4& idxvec, v_float32x4& x, v_float32x4& y) -{ - /*int CV_DECL_ALIGNED(32) idx[4]; - v_store(idx, idxvec); - - float32x4_t xy02 = vcombine_f32(vld1_f32(tab + idx[0]), vld1_f32(tab + idx[2])); - float32x4_t xy13 = vcombine_f32(vld1_f32(tab + idx[1]), vld1_f32(tab + idx[3])); - - float32x4x2_t xxyy = vuzpq_f32(xy02, xy13); - x = v_float32x4(xxyy.val[0]); - y = v_float32x4(xxyy.val[1]);*/ - int CV_DECL_ALIGNED(32) idx[4]; - v_store_aligned(idx, idxvec); - - x = v_float32x4(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]]); - y = v_float32x4(tab[idx[0]+1], tab[idx[1]+1], tab[idx[2]+1], tab[idx[3]+1]); -} - -inline v_int8x16 v_interleave_pairs(const v_int8x16& vec) -{ - return v_int8x16(vcombine_s8(vtbl1_s8(vget_low_s8(vec.val), vcreate_s8(0x0705060403010200)), vtbl1_s8(vget_high_s8(vec.val), vcreate_s8(0x0705060403010200)))); -} -inline v_uint8x16 v_interleave_pairs(const v_uint8x16& vec) { return v_reinterpret_as_u8(v_interleave_pairs(v_reinterpret_as_s8(vec))); } -inline v_int8x16 v_interleave_quads(const v_int8x16& vec) -{ - return v_int8x16(vcombine_s8(vtbl1_s8(vget_low_s8(vec.val), vcreate_s8(0x0703060205010400)), vtbl1_s8(vget_high_s8(vec.val), vcreate_s8(0x0703060205010400)))); -} -inline v_uint8x16 v_interleave_quads(const v_uint8x16& vec) { return v_reinterpret_as_u8(v_interleave_quads(v_reinterpret_as_s8(vec))); } - -inline v_int16x8 v_interleave_pairs(const v_int16x8& vec) -{ - return v_int16x8(vreinterpretq_s16_s8(vcombine_s8(vtbl1_s8(vget_low_s8(vreinterpretq_s8_s16(vec.val)), vcreate_s8(0x0706030205040100)), vtbl1_s8(vget_high_s8(vreinterpretq_s8_s16(vec.val)), vcreate_s8(0x0706030205040100))))); -} -inline v_uint16x8 v_interleave_pairs(const v_uint16x8& vec) { return v_reinterpret_as_u16(v_interleave_pairs(v_reinterpret_as_s16(vec))); } -inline v_int16x8 v_interleave_quads(const v_int16x8& vec) -{ - int16x4x2_t res = vzip_s16(vget_low_s16(vec.val), vget_high_s16(vec.val)); - return v_int16x8(vcombine_s16(res.val[0], res.val[1])); -} -inline v_uint16x8 v_interleave_quads(const v_uint16x8& vec) { return v_reinterpret_as_u16(v_interleave_quads(v_reinterpret_as_s16(vec))); } - -inline v_int32x4 v_interleave_pairs(const v_int32x4& vec) -{ - int32x2x2_t res = vzip_s32(vget_low_s32(vec.val), vget_high_s32(vec.val)); - return v_int32x4(vcombine_s32(res.val[0], res.val[1])); -} -inline v_uint32x4 v_interleave_pairs(const v_uint32x4& vec) { return v_reinterpret_as_u32(v_interleave_pairs(v_reinterpret_as_s32(vec))); } -inline v_float32x4 v_interleave_pairs(const v_float32x4& vec) { return v_reinterpret_as_f32(v_interleave_pairs(v_reinterpret_as_s32(vec))); } - -inline v_int8x16 v_pack_triplets(const v_int8x16& vec) -{ - return v_int8x16(vextq_s8(vcombine_s8(vtbl1_s8(vget_low_s8(vec.val), vcreate_s8(0x0605040201000000)), vtbl1_s8(vget_high_s8(vec.val), vcreate_s8(0x0807060504020100))), vdupq_n_s8(0), 2)); -} -inline v_uint8x16 v_pack_triplets(const v_uint8x16& vec) { return v_reinterpret_as_u8(v_pack_triplets(v_reinterpret_as_s8(vec))); } - -inline v_int16x8 v_pack_triplets(const v_int16x8& vec) -{ - return v_int16x8(vreinterpretq_s16_s8(vextq_s8(vcombine_s8(vtbl1_s8(vget_low_s8(vreinterpretq_s8_s16(vec.val)), vcreate_s8(0x0504030201000000)), vget_high_s8(vreinterpretq_s8_s16(vec.val))), vdupq_n_s8(0), 2))); -} -inline v_uint16x8 v_pack_triplets(const v_uint16x8& vec) { return v_reinterpret_as_u16(v_pack_triplets(v_reinterpret_as_s16(vec))); } - -inline v_int32x4 v_pack_triplets(const v_int32x4& vec) { return vec; } -inline v_uint32x4 v_pack_triplets(const v_uint32x4& vec) { return vec; } -inline v_float32x4 v_pack_triplets(const v_float32x4& vec) { return vec; } - -#if CV_SIMD128_64F -inline v_float64x2 v_lut(const double* tab, const int* idx) -{ - double CV_DECL_ALIGNED(32) elems[2] = - { - tab[idx[0]], - tab[idx[1]] - }; - return v_float64x2(vld1q_f64(elems)); -} - -inline v_float64x2 v_lut_pairs(const double* tab, const int* idx) -{ - return v_float64x2(vld1q_f64(tab + idx[0])); -} - -inline v_float64x2 v_lut(const double* tab, const v_int32x4& idxvec) -{ - double CV_DECL_ALIGNED(32) elems[2] = - { - tab[vgetq_lane_s32(idxvec.val, 0)], - tab[vgetq_lane_s32(idxvec.val, 1)], - }; - return v_float64x2(vld1q_f64(elems)); -} - -inline void v_lut_deinterleave(const double* tab, const v_int32x4& idxvec, v_float64x2& x, v_float64x2& y) -{ - int CV_DECL_ALIGNED(32) idx[4]; - v_store_aligned(idx, idxvec); - - x = v_float64x2(tab[idx[0]], tab[idx[1]]); - y = v_float64x2(tab[idx[0]+1], tab[idx[1]+1]); -} -#endif - -////// FP16 support /////// -#if CV_FP16 -inline v_float32x4 v_load_expand(const float16_t* ptr) -{ - float16x4_t v = - #ifndef vld1_f16 // APPLE compiler defines vld1_f16 as macro - (float16x4_t)vld1_s16((const short*)ptr); - #else - vld1_f16((const __fp16*)ptr); - #endif - return v_float32x4(vcvt_f32_f16(v)); -} - -inline void v_pack_store(float16_t* ptr, const v_float32x4& v) -{ - float16x4_t hv = vcvt_f16_f32(v.val); - - #ifndef vst1_f16 // APPLE compiler defines vst1_f16 as macro - vst1_s16((short*)ptr, (int16x4_t)hv); - #else - vst1_f16((__fp16*)ptr, hv); - #endif -} -#else -inline v_float32x4 v_load_expand(const float16_t* ptr) -{ - const int N = 4; - float buf[N]; - for( int i = 0; i < N; i++ ) buf[i] = (float)ptr[i]; - return v_load(buf); -} - -inline void v_pack_store(float16_t* ptr, const v_float32x4& v) -{ - const int N = 4; - float buf[N]; - v_store(buf, v); - for( int i = 0; i < N; i++ ) ptr[i] = float16_t(buf[i]); -} -#endif - -inline void v_cleanup() {} - -//! @name Check SIMD support -//! @{ -//! @brief Check CPU capability of SIMD operation -static inline bool hasSIMD128() -{ - return (CV_CPU_HAS_SUPPORT_NEON) ? true : false; -} - -//! @} - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END - -//! @endcond - -} - -#endif diff --git a/opencv/include/opencv2/core/hal/intrin_sse.hpp b/opencv/include/opencv2/core/hal/intrin_sse.hpp deleted file mode 100644 index a5adad0..0000000 --- a/opencv/include/opencv2/core/hal/intrin_sse.hpp +++ /dev/null @@ -1,3016 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_HAL_SSE_HPP -#define OPENCV_HAL_SSE_HPP - -#include -#include "opencv2/core/utility.hpp" - -#define CV_SIMD128 1 -#define CV_SIMD128_64F 1 -#define CV_SIMD128_FP16 0 // no native operations with FP16 type. - -namespace cv -{ - -//! @cond IGNORED - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN - -///////// Types //////////// - -struct v_uint8x16 -{ - typedef uchar lane_type; - typedef __m128i vector_type; - enum { nlanes = 16 }; - - v_uint8x16() : val(_mm_setzero_si128()) {} - explicit v_uint8x16(__m128i v) : val(v) {} - v_uint8x16(uchar v0, uchar v1, uchar v2, uchar v3, uchar v4, uchar v5, uchar v6, uchar v7, - uchar v8, uchar v9, uchar v10, uchar v11, uchar v12, uchar v13, uchar v14, uchar v15) - { - val = _mm_setr_epi8((char)v0, (char)v1, (char)v2, (char)v3, - (char)v4, (char)v5, (char)v6, (char)v7, - (char)v8, (char)v9, (char)v10, (char)v11, - (char)v12, (char)v13, (char)v14, (char)v15); - } - uchar get0() const - { - return (uchar)_mm_cvtsi128_si32(val); - } - - __m128i val; -}; - -struct v_int8x16 -{ - typedef schar lane_type; - typedef __m128i vector_type; - enum { nlanes = 16 }; - - v_int8x16() : val(_mm_setzero_si128()) {} - explicit v_int8x16(__m128i v) : val(v) {} - v_int8x16(schar v0, schar v1, schar v2, schar v3, schar v4, schar v5, schar v6, schar v7, - schar v8, schar v9, schar v10, schar v11, schar v12, schar v13, schar v14, schar v15) - { - val = _mm_setr_epi8((char)v0, (char)v1, (char)v2, (char)v3, - (char)v4, (char)v5, (char)v6, (char)v7, - (char)v8, (char)v9, (char)v10, (char)v11, - (char)v12, (char)v13, (char)v14, (char)v15); - } - schar get0() const - { - return (schar)_mm_cvtsi128_si32(val); - } - - __m128i val; -}; - -struct v_uint16x8 -{ - typedef ushort lane_type; - typedef __m128i vector_type; - enum { nlanes = 8 }; - - v_uint16x8() : val(_mm_setzero_si128()) {} - explicit v_uint16x8(__m128i v) : val(v) {} - v_uint16x8(ushort v0, ushort v1, ushort v2, ushort v3, ushort v4, ushort v5, ushort v6, ushort v7) - { - val = _mm_setr_epi16((short)v0, (short)v1, (short)v2, (short)v3, - (short)v4, (short)v5, (short)v6, (short)v7); - } - ushort get0() const - { - return (ushort)_mm_cvtsi128_si32(val); - } - - __m128i val; -}; - -struct v_int16x8 -{ - typedef short lane_type; - typedef __m128i vector_type; - enum { nlanes = 8 }; - - v_int16x8() : val(_mm_setzero_si128()) {} - explicit v_int16x8(__m128i v) : val(v) {} - v_int16x8(short v0, short v1, short v2, short v3, short v4, short v5, short v6, short v7) - { - val = _mm_setr_epi16((short)v0, (short)v1, (short)v2, (short)v3, - (short)v4, (short)v5, (short)v6, (short)v7); - } - short get0() const - { - return (short)_mm_cvtsi128_si32(val); - } - - __m128i val; -}; - -struct v_uint32x4 -{ - typedef unsigned lane_type; - typedef __m128i vector_type; - enum { nlanes = 4 }; - - v_uint32x4() : val(_mm_setzero_si128()) {} - explicit v_uint32x4(__m128i v) : val(v) {} - v_uint32x4(unsigned v0, unsigned v1, unsigned v2, unsigned v3) - { - val = _mm_setr_epi32((int)v0, (int)v1, (int)v2, (int)v3); - } - unsigned get0() const - { - return (unsigned)_mm_cvtsi128_si32(val); - } - - __m128i val; -}; - -struct v_int32x4 -{ - typedef int lane_type; - typedef __m128i vector_type; - enum { nlanes = 4 }; - - v_int32x4() : val(_mm_setzero_si128()) {} - explicit v_int32x4(__m128i v) : val(v) {} - v_int32x4(int v0, int v1, int v2, int v3) - { - val = _mm_setr_epi32(v0, v1, v2, v3); - } - int get0() const - { - return _mm_cvtsi128_si32(val); - } - - __m128i val; -}; - -struct v_float32x4 -{ - typedef float lane_type; - typedef __m128 vector_type; - enum { nlanes = 4 }; - - v_float32x4() : val(_mm_setzero_ps()) {} - explicit v_float32x4(__m128 v) : val(v) {} - v_float32x4(float v0, float v1, float v2, float v3) - { - val = _mm_setr_ps(v0, v1, v2, v3); - } - float get0() const - { - return _mm_cvtss_f32(val); - } - - __m128 val; -}; - -struct v_uint64x2 -{ - typedef uint64 lane_type; - typedef __m128i vector_type; - enum { nlanes = 2 }; - - v_uint64x2() : val(_mm_setzero_si128()) {} - explicit v_uint64x2(__m128i v) : val(v) {} - v_uint64x2(uint64 v0, uint64 v1) - { - val = _mm_setr_epi32((int)v0, (int)(v0 >> 32), (int)v1, (int)(v1 >> 32)); - } - uint64 get0() const - { - int a = _mm_cvtsi128_si32(val); - int b = _mm_cvtsi128_si32(_mm_srli_epi64(val, 32)); - return (unsigned)a | ((uint64)(unsigned)b << 32); - } - - __m128i val; -}; - -struct v_int64x2 -{ - typedef int64 lane_type; - typedef __m128i vector_type; - enum { nlanes = 2 }; - - v_int64x2() : val(_mm_setzero_si128()) {} - explicit v_int64x2(__m128i v) : val(v) {} - v_int64x2(int64 v0, int64 v1) - { - val = _mm_setr_epi32((int)v0, (int)(v0 >> 32), (int)v1, (int)(v1 >> 32)); - } - int64 get0() const - { - int a = _mm_cvtsi128_si32(val); - int b = _mm_cvtsi128_si32(_mm_srli_epi64(val, 32)); - return (int64)((unsigned)a | ((uint64)(unsigned)b << 32)); - } - - __m128i val; -}; - -struct v_float64x2 -{ - typedef double lane_type; - typedef __m128d vector_type; - enum { nlanes = 2 }; - - v_float64x2() : val(_mm_setzero_pd()) {} - explicit v_float64x2(__m128d v) : val(v) {} - v_float64x2(double v0, double v1) - { - val = _mm_setr_pd(v0, v1); - } - double get0() const - { - return _mm_cvtsd_f64(val); - } - - __m128d val; -}; - -namespace hal_sse_internal -{ - template - to_sse_type v_sse_reinterpret_as(const from_sse_type& val); - -#define OPENCV_HAL_IMPL_SSE_REINTERPRET_RAW(to_sse_type, from_sse_type, sse_cast_intrin) \ - template<> inline \ - to_sse_type v_sse_reinterpret_as(const from_sse_type& a) \ - { return sse_cast_intrin(a); } - - OPENCV_HAL_IMPL_SSE_REINTERPRET_RAW(__m128i, __m128i, OPENCV_HAL_NOP) - OPENCV_HAL_IMPL_SSE_REINTERPRET_RAW(__m128i, __m128, _mm_castps_si128) - OPENCV_HAL_IMPL_SSE_REINTERPRET_RAW(__m128i, __m128d, _mm_castpd_si128) - OPENCV_HAL_IMPL_SSE_REINTERPRET_RAW(__m128, __m128i, _mm_castsi128_ps) - OPENCV_HAL_IMPL_SSE_REINTERPRET_RAW(__m128, __m128, OPENCV_HAL_NOP) - OPENCV_HAL_IMPL_SSE_REINTERPRET_RAW(__m128, __m128d, _mm_castpd_ps) - OPENCV_HAL_IMPL_SSE_REINTERPRET_RAW(__m128d, __m128i, _mm_castsi128_pd) - OPENCV_HAL_IMPL_SSE_REINTERPRET_RAW(__m128d, __m128, _mm_castps_pd) - OPENCV_HAL_IMPL_SSE_REINTERPRET_RAW(__m128d, __m128d, OPENCV_HAL_NOP) -} - -#define OPENCV_HAL_IMPL_SSE_INITVEC(_Tpvec, _Tp, suffix, zsuffix, ssuffix, _Tps, cast) \ -inline _Tpvec v_setzero_##suffix() { return _Tpvec(_mm_setzero_##zsuffix()); } \ -inline _Tpvec v_setall_##suffix(_Tp v) { return _Tpvec(_mm_set1_##ssuffix((_Tps)v)); } \ -template inline _Tpvec v_reinterpret_as_##suffix(const _Tpvec0& a) \ -{ return _Tpvec(cast(a.val)); } - -OPENCV_HAL_IMPL_SSE_INITVEC(v_uint8x16, uchar, u8, si128, epi8, char, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_INITVEC(v_int8x16, schar, s8, si128, epi8, char, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_INITVEC(v_uint16x8, ushort, u16, si128, epi16, short, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_INITVEC(v_int16x8, short, s16, si128, epi16, short, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_INITVEC(v_uint32x4, unsigned, u32, si128, epi32, int, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_INITVEC(v_int32x4, int, s32, si128, epi32, int, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_INITVEC(v_float32x4, float, f32, ps, ps, float, _mm_castsi128_ps) -OPENCV_HAL_IMPL_SSE_INITVEC(v_float64x2, double, f64, pd, pd, double, _mm_castsi128_pd) - -inline v_uint64x2 v_setzero_u64() { return v_uint64x2(_mm_setzero_si128()); } -inline v_int64x2 v_setzero_s64() { return v_int64x2(_mm_setzero_si128()); } -inline v_uint64x2 v_setall_u64(uint64 val) { return v_uint64x2(val, val); } -inline v_int64x2 v_setall_s64(int64 val) { return v_int64x2(val, val); } - -template inline -v_uint64x2 v_reinterpret_as_u64(const _Tpvec& a) { return v_uint64x2(a.val); } -template inline -v_int64x2 v_reinterpret_as_s64(const _Tpvec& a) { return v_int64x2(a.val); } -inline v_float32x4 v_reinterpret_as_f32(const v_uint64x2& a) -{ return v_float32x4(_mm_castsi128_ps(a.val)); } -inline v_float32x4 v_reinterpret_as_f32(const v_int64x2& a) -{ return v_float32x4(_mm_castsi128_ps(a.val)); } -inline v_float64x2 v_reinterpret_as_f64(const v_uint64x2& a) -{ return v_float64x2(_mm_castsi128_pd(a.val)); } -inline v_float64x2 v_reinterpret_as_f64(const v_int64x2& a) -{ return v_float64x2(_mm_castsi128_pd(a.val)); } - -#define OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(_Tpvec, suffix) \ -inline _Tpvec v_reinterpret_as_##suffix(const v_float32x4& a) \ -{ return _Tpvec(_mm_castps_si128(a.val)); } \ -inline _Tpvec v_reinterpret_as_##suffix(const v_float64x2& a) \ -{ return _Tpvec(_mm_castpd_si128(a.val)); } - -OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_uint8x16, u8) -OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_int8x16, s8) -OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_uint16x8, u16) -OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_int16x8, s16) -OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_uint32x4, u32) -OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_int32x4, s32) -OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_uint64x2, u64) -OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_int64x2, s64) - -inline v_float32x4 v_reinterpret_as_f32(const v_float32x4& a) {return a; } -inline v_float64x2 v_reinterpret_as_f64(const v_float64x2& a) {return a; } -inline v_float32x4 v_reinterpret_as_f32(const v_float64x2& a) {return v_float32x4(_mm_castpd_ps(a.val)); } -inline v_float64x2 v_reinterpret_as_f64(const v_float32x4& a) {return v_float64x2(_mm_castps_pd(a.val)); } - -//////////////// PACK /////////////// -inline v_uint8x16 v_pack(const v_uint16x8& a, const v_uint16x8& b) -{ - __m128i delta = _mm_set1_epi16(255); - return v_uint8x16(_mm_packus_epi16(_mm_subs_epu16(a.val, _mm_subs_epu16(a.val, delta)), - _mm_subs_epu16(b.val, _mm_subs_epu16(b.val, delta)))); -} - -inline void v_pack_store(uchar* ptr, const v_uint16x8& a) -{ - __m128i delta = _mm_set1_epi16(255); - __m128i a1 = _mm_subs_epu16(a.val, _mm_subs_epu16(a.val, delta)); - _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi16(a1, a1)); -} - -inline v_uint8x16 v_pack_u(const v_int16x8& a, const v_int16x8& b) -{ return v_uint8x16(_mm_packus_epi16(a.val, b.val)); } - -inline void v_pack_u_store(uchar* ptr, const v_int16x8& a) -{ _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi16(a.val, a.val)); } - -template inline -v_uint8x16 v_rshr_pack(const v_uint16x8& a, const v_uint16x8& b) -{ - // we assume that n > 0, and so the shifted 16-bit values can be treated as signed numbers. - __m128i delta = _mm_set1_epi16((short)(1 << (n-1))); - return v_uint8x16(_mm_packus_epi16(_mm_srli_epi16(_mm_adds_epu16(a.val, delta), n), - _mm_srli_epi16(_mm_adds_epu16(b.val, delta), n))); -} - -template inline -void v_rshr_pack_store(uchar* ptr, const v_uint16x8& a) -{ - __m128i delta = _mm_set1_epi16((short)(1 << (n-1))); - __m128i a1 = _mm_srli_epi16(_mm_adds_epu16(a.val, delta), n); - _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi16(a1, a1)); -} - -template inline -v_uint8x16 v_rshr_pack_u(const v_int16x8& a, const v_int16x8& b) -{ - __m128i delta = _mm_set1_epi16((short)(1 << (n-1))); - return v_uint8x16(_mm_packus_epi16(_mm_srai_epi16(_mm_adds_epi16(a.val, delta), n), - _mm_srai_epi16(_mm_adds_epi16(b.val, delta), n))); -} - -template inline -void v_rshr_pack_u_store(uchar* ptr, const v_int16x8& a) -{ - __m128i delta = _mm_set1_epi16((short)(1 << (n-1))); - __m128i a1 = _mm_srai_epi16(_mm_adds_epi16(a.val, delta), n); - _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi16(a1, a1)); -} - -inline v_int8x16 v_pack(const v_int16x8& a, const v_int16x8& b) -{ return v_int8x16(_mm_packs_epi16(a.val, b.val)); } - -inline void v_pack_store(schar* ptr, const v_int16x8& a) -{ _mm_storel_epi64((__m128i*)ptr, _mm_packs_epi16(a.val, a.val)); } - -template inline -v_int8x16 v_rshr_pack(const v_int16x8& a, const v_int16x8& b) -{ - // we assume that n > 0, and so the shifted 16-bit values can be treated as signed numbers. - __m128i delta = _mm_set1_epi16((short)(1 << (n-1))); - return v_int8x16(_mm_packs_epi16(_mm_srai_epi16(_mm_adds_epi16(a.val, delta), n), - _mm_srai_epi16(_mm_adds_epi16(b.val, delta), n))); -} -template inline -void v_rshr_pack_store(schar* ptr, const v_int16x8& a) -{ - // we assume that n > 0, and so the shifted 16-bit values can be treated as signed numbers. - __m128i delta = _mm_set1_epi16((short)(1 << (n-1))); - __m128i a1 = _mm_srai_epi16(_mm_adds_epi16(a.val, delta), n); - _mm_storel_epi64((__m128i*)ptr, _mm_packs_epi16(a1, a1)); -} - - -// byte-wise "mask ? a : b" -inline __m128i v_select_si128(__m128i mask, __m128i a, __m128i b) -{ -#if CV_SSE4_1 - return _mm_blendv_epi8(b, a, mask); -#else - return _mm_xor_si128(b, _mm_and_si128(_mm_xor_si128(a, b), mask)); -#endif -} - -inline v_uint16x8 v_pack(const v_uint32x4& a, const v_uint32x4& b) -{ return v_uint16x8(_v128_packs_epu32(a.val, b.val)); } - -inline void v_pack_store(ushort* ptr, const v_uint32x4& a) -{ - __m128i z = _mm_setzero_si128(), maxval32 = _mm_set1_epi32(65535), delta32 = _mm_set1_epi32(32768); - __m128i a1 = _mm_sub_epi32(v_select_si128(_mm_cmpgt_epi32(z, a.val), maxval32, a.val), delta32); - __m128i r = _mm_packs_epi32(a1, a1); - _mm_storel_epi64((__m128i*)ptr, _mm_sub_epi16(r, _mm_set1_epi16(-32768))); -} - -template inline -v_uint16x8 v_rshr_pack(const v_uint32x4& a, const v_uint32x4& b) -{ - __m128i delta = _mm_set1_epi32(1 << (n-1)), delta32 = _mm_set1_epi32(32768); - __m128i a1 = _mm_sub_epi32(_mm_srli_epi32(_mm_add_epi32(a.val, delta), n), delta32); - __m128i b1 = _mm_sub_epi32(_mm_srli_epi32(_mm_add_epi32(b.val, delta), n), delta32); - return v_uint16x8(_mm_sub_epi16(_mm_packs_epi32(a1, b1), _mm_set1_epi16(-32768))); -} - -template inline -void v_rshr_pack_store(ushort* ptr, const v_uint32x4& a) -{ - __m128i delta = _mm_set1_epi32(1 << (n-1)), delta32 = _mm_set1_epi32(32768); - __m128i a1 = _mm_sub_epi32(_mm_srli_epi32(_mm_add_epi32(a.val, delta), n), delta32); - __m128i a2 = _mm_sub_epi16(_mm_packs_epi32(a1, a1), _mm_set1_epi16(-32768)); - _mm_storel_epi64((__m128i*)ptr, a2); -} - -inline v_uint16x8 v_pack_u(const v_int32x4& a, const v_int32x4& b) -{ -#if CV_SSE4_1 - return v_uint16x8(_mm_packus_epi32(a.val, b.val)); -#else - __m128i delta32 = _mm_set1_epi32(32768); - - // preliminary saturate negative values to zero - __m128i a1 = _mm_and_si128(a.val, _mm_cmpgt_epi32(a.val, _mm_set1_epi32(0))); - __m128i b1 = _mm_and_si128(b.val, _mm_cmpgt_epi32(b.val, _mm_set1_epi32(0))); - - __m128i r = _mm_packs_epi32(_mm_sub_epi32(a1, delta32), _mm_sub_epi32(b1, delta32)); - return v_uint16x8(_mm_sub_epi16(r, _mm_set1_epi16(-32768))); -#endif -} - -inline void v_pack_u_store(ushort* ptr, const v_int32x4& a) -{ -#if CV_SSE4_1 - _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi32(a.val, a.val)); -#else - __m128i delta32 = _mm_set1_epi32(32768); - __m128i a1 = _mm_sub_epi32(a.val, delta32); - __m128i r = _mm_sub_epi16(_mm_packs_epi32(a1, a1), _mm_set1_epi16(-32768)); - _mm_storel_epi64((__m128i*)ptr, r); -#endif -} - -template inline -v_uint16x8 v_rshr_pack_u(const v_int32x4& a, const v_int32x4& b) -{ -#if CV_SSE4_1 - __m128i delta = _mm_set1_epi32(1 << (n - 1)); - return v_uint16x8(_mm_packus_epi32(_mm_srai_epi32(_mm_add_epi32(a.val, delta), n), - _mm_srai_epi32(_mm_add_epi32(b.val, delta), n))); -#else - __m128i delta = _mm_set1_epi32(1 << (n-1)), delta32 = _mm_set1_epi32(32768); - __m128i a1 = _mm_sub_epi32(_mm_srai_epi32(_mm_add_epi32(a.val, delta), n), delta32); - __m128i a2 = _mm_sub_epi16(_mm_packs_epi32(a1, a1), _mm_set1_epi16(-32768)); - __m128i b1 = _mm_sub_epi32(_mm_srai_epi32(_mm_add_epi32(b.val, delta), n), delta32); - __m128i b2 = _mm_sub_epi16(_mm_packs_epi32(b1, b1), _mm_set1_epi16(-32768)); - return v_uint16x8(_mm_unpacklo_epi64(a2, b2)); -#endif -} - -template inline -void v_rshr_pack_u_store(ushort* ptr, const v_int32x4& a) -{ -#if CV_SSE4_1 - __m128i delta = _mm_set1_epi32(1 << (n - 1)); - __m128i a1 = _mm_srai_epi32(_mm_add_epi32(a.val, delta), n); - _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi32(a1, a1)); -#else - __m128i delta = _mm_set1_epi32(1 << (n-1)), delta32 = _mm_set1_epi32(32768); - __m128i a1 = _mm_sub_epi32(_mm_srai_epi32(_mm_add_epi32(a.val, delta), n), delta32); - __m128i a2 = _mm_sub_epi16(_mm_packs_epi32(a1, a1), _mm_set1_epi16(-32768)); - _mm_storel_epi64((__m128i*)ptr, a2); -#endif -} - -inline v_int16x8 v_pack(const v_int32x4& a, const v_int32x4& b) -{ return v_int16x8(_mm_packs_epi32(a.val, b.val)); } - -inline void v_pack_store(short* ptr, const v_int32x4& a) -{ - _mm_storel_epi64((__m128i*)ptr, _mm_packs_epi32(a.val, a.val)); -} - -template inline -v_int16x8 v_rshr_pack(const v_int32x4& a, const v_int32x4& b) -{ - __m128i delta = _mm_set1_epi32(1 << (n-1)); - return v_int16x8(_mm_packs_epi32(_mm_srai_epi32(_mm_add_epi32(a.val, delta), n), - _mm_srai_epi32(_mm_add_epi32(b.val, delta), n))); -} - -template inline -void v_rshr_pack_store(short* ptr, const v_int32x4& a) -{ - __m128i delta = _mm_set1_epi32(1 << (n-1)); - __m128i a1 = _mm_srai_epi32(_mm_add_epi32(a.val, delta), n); - _mm_storel_epi64((__m128i*)ptr, _mm_packs_epi32(a1, a1)); -} - - -// [a0 0 | b0 0] [a1 0 | b1 0] -inline v_uint32x4 v_pack(const v_uint64x2& a, const v_uint64x2& b) -{ - __m128i v0 = _mm_unpacklo_epi32(a.val, b.val); // a0 a1 0 0 - __m128i v1 = _mm_unpackhi_epi32(a.val, b.val); // b0 b1 0 0 - return v_uint32x4(_mm_unpacklo_epi32(v0, v1)); -} - -inline void v_pack_store(unsigned* ptr, const v_uint64x2& a) -{ - __m128i a1 = _mm_shuffle_epi32(a.val, _MM_SHUFFLE(0, 2, 2, 0)); - _mm_storel_epi64((__m128i*)ptr, a1); -} - -// [a0 0 | b0 0] [a1 0 | b1 0] -inline v_int32x4 v_pack(const v_int64x2& a, const v_int64x2& b) -{ - __m128i v0 = _mm_unpacklo_epi32(a.val, b.val); // a0 a1 0 0 - __m128i v1 = _mm_unpackhi_epi32(a.val, b.val); // b0 b1 0 0 - return v_int32x4(_mm_unpacklo_epi32(v0, v1)); -} - -inline void v_pack_store(int* ptr, const v_int64x2& a) -{ - __m128i a1 = _mm_shuffle_epi32(a.val, _MM_SHUFFLE(0, 2, 2, 0)); - _mm_storel_epi64((__m128i*)ptr, a1); -} - -template inline -v_uint32x4 v_rshr_pack(const v_uint64x2& a, const v_uint64x2& b) -{ - uint64 delta = (uint64)1 << (n-1); - v_uint64x2 delta2(delta, delta); - __m128i a1 = _mm_srli_epi64(_mm_add_epi64(a.val, delta2.val), n); - __m128i b1 = _mm_srli_epi64(_mm_add_epi64(b.val, delta2.val), n); - __m128i v0 = _mm_unpacklo_epi32(a1, b1); // a0 a1 0 0 - __m128i v1 = _mm_unpackhi_epi32(a1, b1); // b0 b1 0 0 - return v_uint32x4(_mm_unpacklo_epi32(v0, v1)); -} - -template inline -void v_rshr_pack_store(unsigned* ptr, const v_uint64x2& a) -{ - uint64 delta = (uint64)1 << (n-1); - v_uint64x2 delta2(delta, delta); - __m128i a1 = _mm_srli_epi64(_mm_add_epi64(a.val, delta2.val), n); - __m128i a2 = _mm_shuffle_epi32(a1, _MM_SHUFFLE(0, 2, 2, 0)); - _mm_storel_epi64((__m128i*)ptr, a2); -} - -inline __m128i v_sign_epi64(__m128i a) -{ - return _mm_shuffle_epi32(_mm_srai_epi32(a, 31), _MM_SHUFFLE(3, 3, 1, 1)); // x m0 | x m1 -} - -inline __m128i v_srai_epi64(__m128i a, int imm) -{ - __m128i smask = v_sign_epi64(a); - return _mm_xor_si128(_mm_srli_epi64(_mm_xor_si128(a, smask), imm), smask); -} - -template inline -v_int32x4 v_rshr_pack(const v_int64x2& a, const v_int64x2& b) -{ - int64 delta = (int64)1 << (n-1); - v_int64x2 delta2(delta, delta); - __m128i a1 = v_srai_epi64(_mm_add_epi64(a.val, delta2.val), n); - __m128i b1 = v_srai_epi64(_mm_add_epi64(b.val, delta2.val), n); - __m128i v0 = _mm_unpacklo_epi32(a1, b1); // a0 a1 0 0 - __m128i v1 = _mm_unpackhi_epi32(a1, b1); // b0 b1 0 0 - return v_int32x4(_mm_unpacklo_epi32(v0, v1)); -} - -template inline -void v_rshr_pack_store(int* ptr, const v_int64x2& a) -{ - int64 delta = (int64)1 << (n-1); - v_int64x2 delta2(delta, delta); - __m128i a1 = v_srai_epi64(_mm_add_epi64(a.val, delta2.val), n); - __m128i a2 = _mm_shuffle_epi32(a1, _MM_SHUFFLE(0, 2, 2, 0)); - _mm_storel_epi64((__m128i*)ptr, a2); -} - -// pack boolean -inline v_uint8x16 v_pack_b(const v_uint16x8& a, const v_uint16x8& b) -{ - __m128i ab = _mm_packs_epi16(a.val, b.val); - return v_uint8x16(ab); -} - -inline v_uint8x16 v_pack_b(const v_uint32x4& a, const v_uint32x4& b, - const v_uint32x4& c, const v_uint32x4& d) -{ - __m128i ab = _mm_packs_epi32(a.val, b.val); - __m128i cd = _mm_packs_epi32(c.val, d.val); - return v_uint8x16(_mm_packs_epi16(ab, cd)); -} - -inline v_uint8x16 v_pack_b(const v_uint64x2& a, const v_uint64x2& b, const v_uint64x2& c, - const v_uint64x2& d, const v_uint64x2& e, const v_uint64x2& f, - const v_uint64x2& g, const v_uint64x2& h) -{ - __m128i ab = _mm_packs_epi32(a.val, b.val); - __m128i cd = _mm_packs_epi32(c.val, d.val); - __m128i ef = _mm_packs_epi32(e.val, f.val); - __m128i gh = _mm_packs_epi32(g.val, h.val); - - __m128i abcd = _mm_packs_epi32(ab, cd); - __m128i efgh = _mm_packs_epi32(ef, gh); - return v_uint8x16(_mm_packs_epi16(abcd, efgh)); -} - -inline v_float32x4 v_matmul(const v_float32x4& v, const v_float32x4& m0, - const v_float32x4& m1, const v_float32x4& m2, - const v_float32x4& m3) -{ - __m128 v0 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(0, 0, 0, 0)), m0.val); - __m128 v1 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(1, 1, 1, 1)), m1.val); - __m128 v2 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(2, 2, 2, 2)), m2.val); - __m128 v3 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(3, 3, 3, 3)), m3.val); - - return v_float32x4(_mm_add_ps(_mm_add_ps(v0, v1), _mm_add_ps(v2, v3))); -} - -inline v_float32x4 v_matmuladd(const v_float32x4& v, const v_float32x4& m0, - const v_float32x4& m1, const v_float32x4& m2, - const v_float32x4& a) -{ - __m128 v0 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(0, 0, 0, 0)), m0.val); - __m128 v1 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(1, 1, 1, 1)), m1.val); - __m128 v2 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(2, 2, 2, 2)), m2.val); - - return v_float32x4(_mm_add_ps(_mm_add_ps(v0, v1), _mm_add_ps(v2, a.val))); -} - -#define OPENCV_HAL_IMPL_SSE_BIN_OP(bin_op, _Tpvec, intrin) \ - inline _Tpvec operator bin_op (const _Tpvec& a, const _Tpvec& b) \ - { \ - return _Tpvec(intrin(a.val, b.val)); \ - } \ - inline _Tpvec& operator bin_op##= (_Tpvec& a, const _Tpvec& b) \ - { \ - a.val = intrin(a.val, b.val); \ - return a; \ - } - -OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_uint8x16, _mm_adds_epu8) -OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_uint8x16, _mm_subs_epu8) -OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_int8x16, _mm_adds_epi8) -OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_int8x16, _mm_subs_epi8) -OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_uint16x8, _mm_adds_epu16) -OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_uint16x8, _mm_subs_epu16) -OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_int16x8, _mm_adds_epi16) -OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_int16x8, _mm_subs_epi16) -OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_uint32x4, _mm_add_epi32) -OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_uint32x4, _mm_sub_epi32) -OPENCV_HAL_IMPL_SSE_BIN_OP(*, v_uint32x4, _v128_mullo_epi32) -OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_int32x4, _mm_add_epi32) -OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_int32x4, _mm_sub_epi32) -OPENCV_HAL_IMPL_SSE_BIN_OP(*, v_int32x4, _v128_mullo_epi32) -OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_float32x4, _mm_add_ps) -OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_float32x4, _mm_sub_ps) -OPENCV_HAL_IMPL_SSE_BIN_OP(*, v_float32x4, _mm_mul_ps) -OPENCV_HAL_IMPL_SSE_BIN_OP(/, v_float32x4, _mm_div_ps) -OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_float64x2, _mm_add_pd) -OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_float64x2, _mm_sub_pd) -OPENCV_HAL_IMPL_SSE_BIN_OP(*, v_float64x2, _mm_mul_pd) -OPENCV_HAL_IMPL_SSE_BIN_OP(/, v_float64x2, _mm_div_pd) -OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_uint64x2, _mm_add_epi64) -OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_uint64x2, _mm_sub_epi64) -OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_int64x2, _mm_add_epi64) -OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_int64x2, _mm_sub_epi64) - -// saturating multiply 8-bit, 16-bit -#define OPENCV_HAL_IMPL_SSE_MUL_SAT(_Tpvec, _Tpwvec) \ - inline _Tpvec operator * (const _Tpvec& a, const _Tpvec& b) \ - { \ - _Tpwvec c, d; \ - v_mul_expand(a, b, c, d); \ - return v_pack(c, d); \ - } \ - inline _Tpvec& operator *= (_Tpvec& a, const _Tpvec& b) \ - { a = a * b; return a; } - -OPENCV_HAL_IMPL_SSE_MUL_SAT(v_uint8x16, v_uint16x8) -OPENCV_HAL_IMPL_SSE_MUL_SAT(v_int8x16, v_int16x8) -OPENCV_HAL_IMPL_SSE_MUL_SAT(v_uint16x8, v_uint32x4) -OPENCV_HAL_IMPL_SSE_MUL_SAT(v_int16x8, v_int32x4) - -// Multiply and expand -inline void v_mul_expand(const v_uint8x16& a, const v_uint8x16& b, - v_uint16x8& c, v_uint16x8& d) -{ - v_uint16x8 a0, a1, b0, b1; - v_expand(a, a0, a1); - v_expand(b, b0, b1); - c = v_mul_wrap(a0, b0); - d = v_mul_wrap(a1, b1); -} - -inline void v_mul_expand(const v_int8x16& a, const v_int8x16& b, - v_int16x8& c, v_int16x8& d) -{ - v_int16x8 a0, a1, b0, b1; - v_expand(a, a0, a1); - v_expand(b, b0, b1); - c = v_mul_wrap(a0, b0); - d = v_mul_wrap(a1, b1); -} - -inline void v_mul_expand(const v_int16x8& a, const v_int16x8& b, - v_int32x4& c, v_int32x4& d) -{ - __m128i v0 = _mm_mullo_epi16(a.val, b.val); - __m128i v1 = _mm_mulhi_epi16(a.val, b.val); - c.val = _mm_unpacklo_epi16(v0, v1); - d.val = _mm_unpackhi_epi16(v0, v1); -} - -inline void v_mul_expand(const v_uint16x8& a, const v_uint16x8& b, - v_uint32x4& c, v_uint32x4& d) -{ - __m128i v0 = _mm_mullo_epi16(a.val, b.val); - __m128i v1 = _mm_mulhi_epu16(a.val, b.val); - c.val = _mm_unpacklo_epi16(v0, v1); - d.val = _mm_unpackhi_epi16(v0, v1); -} - -inline void v_mul_expand(const v_uint32x4& a, const v_uint32x4& b, - v_uint64x2& c, v_uint64x2& d) -{ - __m128i c0 = _mm_mul_epu32(a.val, b.val); - __m128i c1 = _mm_mul_epu32(_mm_srli_epi64(a.val, 32), _mm_srli_epi64(b.val, 32)); - c.val = _mm_unpacklo_epi64(c0, c1); - d.val = _mm_unpackhi_epi64(c0, c1); -} - -inline v_int16x8 v_mul_hi(const v_int16x8& a, const v_int16x8& b) { return v_int16x8(_mm_mulhi_epi16(a.val, b.val)); } -inline v_uint16x8 v_mul_hi(const v_uint16x8& a, const v_uint16x8& b) { return v_uint16x8(_mm_mulhi_epu16(a.val, b.val)); } - -inline v_int32x4 v_dotprod(const v_int16x8& a, const v_int16x8& b) -{ - return v_int32x4(_mm_madd_epi16(a.val, b.val)); -} - -inline v_int32x4 v_dotprod(const v_int16x8& a, const v_int16x8& b, const v_int32x4& c) -{ - return v_int32x4(_mm_add_epi32(_mm_madd_epi16(a.val, b.val), c.val)); -} - -#define OPENCV_HAL_IMPL_SSE_LOGIC_OP(_Tpvec, suffix, not_const) \ - OPENCV_HAL_IMPL_SSE_BIN_OP(&, _Tpvec, _mm_and_##suffix) \ - OPENCV_HAL_IMPL_SSE_BIN_OP(|, _Tpvec, _mm_or_##suffix) \ - OPENCV_HAL_IMPL_SSE_BIN_OP(^, _Tpvec, _mm_xor_##suffix) \ - inline _Tpvec operator ~ (const _Tpvec& a) \ - { \ - return _Tpvec(_mm_xor_##suffix(a.val, not_const)); \ - } - -OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_uint8x16, si128, _mm_set1_epi32(-1)) -OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_int8x16, si128, _mm_set1_epi32(-1)) -OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_uint16x8, si128, _mm_set1_epi32(-1)) -OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_int16x8, si128, _mm_set1_epi32(-1)) -OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_uint32x4, si128, _mm_set1_epi32(-1)) -OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_int32x4, si128, _mm_set1_epi32(-1)) -OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_uint64x2, si128, _mm_set1_epi32(-1)) -OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_int64x2, si128, _mm_set1_epi32(-1)) -OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_float32x4, ps, _mm_castsi128_ps(_mm_set1_epi32(-1))) -OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_float64x2, pd, _mm_castsi128_pd(_mm_set1_epi32(-1))) - -inline v_float32x4 v_sqrt(const v_float32x4& x) -{ return v_float32x4(_mm_sqrt_ps(x.val)); } - -inline v_float32x4 v_invsqrt(const v_float32x4& x) -{ - const __m128 _0_5 = _mm_set1_ps(0.5f), _1_5 = _mm_set1_ps(1.5f); - __m128 t = x.val; - __m128 h = _mm_mul_ps(t, _0_5); - t = _mm_rsqrt_ps(t); - t = _mm_mul_ps(t, _mm_sub_ps(_1_5, _mm_mul_ps(_mm_mul_ps(t, t), h))); - return v_float32x4(t); -} - -inline v_float64x2 v_sqrt(const v_float64x2& x) -{ return v_float64x2(_mm_sqrt_pd(x.val)); } - -inline v_float64x2 v_invsqrt(const v_float64x2& x) -{ - const __m128d v_1 = _mm_set1_pd(1.); - return v_float64x2(_mm_div_pd(v_1, _mm_sqrt_pd(x.val))); -} - -#define OPENCV_HAL_IMPL_SSE_ABS_INT_FUNC(_Tpuvec, _Tpsvec, func, suffix, subWidth) \ -inline _Tpuvec v_abs(const _Tpsvec& x) \ -{ return _Tpuvec(_mm_##func##_ep##suffix(x.val, _mm_sub_ep##subWidth(_mm_setzero_si128(), x.val))); } - -OPENCV_HAL_IMPL_SSE_ABS_INT_FUNC(v_uint8x16, v_int8x16, min, u8, i8) -OPENCV_HAL_IMPL_SSE_ABS_INT_FUNC(v_uint16x8, v_int16x8, max, i16, i16) -inline v_uint32x4 v_abs(const v_int32x4& x) -{ - __m128i s = _mm_srli_epi32(x.val, 31); - __m128i f = _mm_srai_epi32(x.val, 31); - return v_uint32x4(_mm_add_epi32(_mm_xor_si128(x.val, f), s)); -} -inline v_float32x4 v_abs(const v_float32x4& x) -{ return v_float32x4(_mm_and_ps(x.val, _mm_castsi128_ps(_mm_set1_epi32(0x7fffffff)))); } -inline v_float64x2 v_abs(const v_float64x2& x) -{ - return v_float64x2(_mm_and_pd(x.val, - _mm_castsi128_pd(_mm_srli_epi64(_mm_set1_epi32(-1), 1)))); -} - -// TODO: exp, log, sin, cos - -#define OPENCV_HAL_IMPL_SSE_BIN_FUNC(_Tpvec, func, intrin) \ -inline _Tpvec func(const _Tpvec& a, const _Tpvec& b) \ -{ \ - return _Tpvec(intrin(a.val, b.val)); \ -} - -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint8x16, v_min, _mm_min_epu8) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint8x16, v_max, _mm_max_epu8) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_min, _mm_min_epi16) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_max, _mm_max_epi16) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_float32x4, v_min, _mm_min_ps) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_float32x4, v_max, _mm_max_ps) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_float64x2, v_min, _mm_min_pd) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_float64x2, v_max, _mm_max_pd) - -inline v_int8x16 v_min(const v_int8x16& a, const v_int8x16& b) -{ -#if CV_SSE4_1 - return v_int8x16(_mm_min_epi8(a.val, b.val)); -#else - __m128i delta = _mm_set1_epi8((char)-128); - return v_int8x16(_mm_xor_si128(delta, _mm_min_epu8(_mm_xor_si128(a.val, delta), - _mm_xor_si128(b.val, delta)))); -#endif -} -inline v_int8x16 v_max(const v_int8x16& a, const v_int8x16& b) -{ -#if CV_SSE4_1 - return v_int8x16(_mm_max_epi8(a.val, b.val)); -#else - __m128i delta = _mm_set1_epi8((char)-128); - return v_int8x16(_mm_xor_si128(delta, _mm_max_epu8(_mm_xor_si128(a.val, delta), - _mm_xor_si128(b.val, delta)))); -#endif -} -inline v_uint16x8 v_min(const v_uint16x8& a, const v_uint16x8& b) -{ -#if CV_SSE4_1 - return v_uint16x8(_mm_min_epu16(a.val, b.val)); -#else - return v_uint16x8(_mm_subs_epu16(a.val, _mm_subs_epu16(a.val, b.val))); -#endif -} -inline v_uint16x8 v_max(const v_uint16x8& a, const v_uint16x8& b) -{ -#if CV_SSE4_1 - return v_uint16x8(_mm_max_epu16(a.val, b.val)); -#else - return v_uint16x8(_mm_adds_epu16(_mm_subs_epu16(a.val, b.val), b.val)); -#endif -} -inline v_uint32x4 v_min(const v_uint32x4& a, const v_uint32x4& b) -{ -#if CV_SSE4_1 - return v_uint32x4(_mm_min_epu32(a.val, b.val)); -#else - __m128i delta = _mm_set1_epi32((int)0x80000000); - __m128i mask = _mm_cmpgt_epi32(_mm_xor_si128(a.val, delta), _mm_xor_si128(b.val, delta)); - return v_uint32x4(v_select_si128(mask, b.val, a.val)); -#endif -} -inline v_uint32x4 v_max(const v_uint32x4& a, const v_uint32x4& b) -{ -#if CV_SSE4_1 - return v_uint32x4(_mm_max_epu32(a.val, b.val)); -#else - __m128i delta = _mm_set1_epi32((int)0x80000000); - __m128i mask = _mm_cmpgt_epi32(_mm_xor_si128(a.val, delta), _mm_xor_si128(b.val, delta)); - return v_uint32x4(v_select_si128(mask, a.val, b.val)); -#endif -} -inline v_int32x4 v_min(const v_int32x4& a, const v_int32x4& b) -{ -#if CV_SSE4_1 - return v_int32x4(_mm_min_epi32(a.val, b.val)); -#else - return v_int32x4(v_select_si128(_mm_cmpgt_epi32(a.val, b.val), b.val, a.val)); -#endif -} -inline v_int32x4 v_max(const v_int32x4& a, const v_int32x4& b) -{ -#if CV_SSE4_1 - return v_int32x4(_mm_max_epi32(a.val, b.val)); -#else - return v_int32x4(v_select_si128(_mm_cmpgt_epi32(a.val, b.val), a.val, b.val)); -#endif -} - -#define OPENCV_HAL_IMPL_SSE_INT_CMP_OP(_Tpuvec, _Tpsvec, suffix, sbit) \ -inline _Tpuvec operator == (const _Tpuvec& a, const _Tpuvec& b) \ -{ return _Tpuvec(_mm_cmpeq_##suffix(a.val, b.val)); } \ -inline _Tpuvec operator != (const _Tpuvec& a, const _Tpuvec& b) \ -{ \ - __m128i not_mask = _mm_set1_epi32(-1); \ - return _Tpuvec(_mm_xor_si128(_mm_cmpeq_##suffix(a.val, b.val), not_mask)); \ -} \ -inline _Tpsvec operator == (const _Tpsvec& a, const _Tpsvec& b) \ -{ return _Tpsvec(_mm_cmpeq_##suffix(a.val, b.val)); } \ -inline _Tpsvec operator != (const _Tpsvec& a, const _Tpsvec& b) \ -{ \ - __m128i not_mask = _mm_set1_epi32(-1); \ - return _Tpsvec(_mm_xor_si128(_mm_cmpeq_##suffix(a.val, b.val), not_mask)); \ -} \ -inline _Tpuvec operator < (const _Tpuvec& a, const _Tpuvec& b) \ -{ \ - __m128i smask = _mm_set1_##suffix(sbit); \ - return _Tpuvec(_mm_cmpgt_##suffix(_mm_xor_si128(b.val, smask), _mm_xor_si128(a.val, smask))); \ -} \ -inline _Tpuvec operator > (const _Tpuvec& a, const _Tpuvec& b) \ -{ \ - __m128i smask = _mm_set1_##suffix(sbit); \ - return _Tpuvec(_mm_cmpgt_##suffix(_mm_xor_si128(a.val, smask), _mm_xor_si128(b.val, smask))); \ -} \ -inline _Tpuvec operator <= (const _Tpuvec& a, const _Tpuvec& b) \ -{ \ - __m128i smask = _mm_set1_##suffix(sbit); \ - __m128i not_mask = _mm_set1_epi32(-1); \ - __m128i res = _mm_cmpgt_##suffix(_mm_xor_si128(a.val, smask), _mm_xor_si128(b.val, smask)); \ - return _Tpuvec(_mm_xor_si128(res, not_mask)); \ -} \ -inline _Tpuvec operator >= (const _Tpuvec& a, const _Tpuvec& b) \ -{ \ - __m128i smask = _mm_set1_##suffix(sbit); \ - __m128i not_mask = _mm_set1_epi32(-1); \ - __m128i res = _mm_cmpgt_##suffix(_mm_xor_si128(b.val, smask), _mm_xor_si128(a.val, smask)); \ - return _Tpuvec(_mm_xor_si128(res, not_mask)); \ -} \ -inline _Tpsvec operator < (const _Tpsvec& a, const _Tpsvec& b) \ -{ \ - return _Tpsvec(_mm_cmpgt_##suffix(b.val, a.val)); \ -} \ -inline _Tpsvec operator > (const _Tpsvec& a, const _Tpsvec& b) \ -{ \ - return _Tpsvec(_mm_cmpgt_##suffix(a.val, b.val)); \ -} \ -inline _Tpsvec operator <= (const _Tpsvec& a, const _Tpsvec& b) \ -{ \ - __m128i not_mask = _mm_set1_epi32(-1); \ - return _Tpsvec(_mm_xor_si128(_mm_cmpgt_##suffix(a.val, b.val), not_mask)); \ -} \ -inline _Tpsvec operator >= (const _Tpsvec& a, const _Tpsvec& b) \ -{ \ - __m128i not_mask = _mm_set1_epi32(-1); \ - return _Tpsvec(_mm_xor_si128(_mm_cmpgt_##suffix(b.val, a.val), not_mask)); \ -} - -OPENCV_HAL_IMPL_SSE_INT_CMP_OP(v_uint8x16, v_int8x16, epi8, (char)-128) -OPENCV_HAL_IMPL_SSE_INT_CMP_OP(v_uint16x8, v_int16x8, epi16, (short)-32768) -OPENCV_HAL_IMPL_SSE_INT_CMP_OP(v_uint32x4, v_int32x4, epi32, (int)0x80000000) - -#define OPENCV_HAL_IMPL_SSE_FLT_CMP_OP(_Tpvec, suffix) \ -inline _Tpvec operator == (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(_mm_cmpeq_##suffix(a.val, b.val)); } \ -inline _Tpvec operator != (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(_mm_cmpneq_##suffix(a.val, b.val)); } \ -inline _Tpvec operator < (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(_mm_cmplt_##suffix(a.val, b.val)); } \ -inline _Tpvec operator > (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(_mm_cmpgt_##suffix(a.val, b.val)); } \ -inline _Tpvec operator <= (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(_mm_cmple_##suffix(a.val, b.val)); } \ -inline _Tpvec operator >= (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(_mm_cmpge_##suffix(a.val, b.val)); } - -OPENCV_HAL_IMPL_SSE_FLT_CMP_OP(v_float32x4, ps) -OPENCV_HAL_IMPL_SSE_FLT_CMP_OP(v_float64x2, pd) - -#define OPENCV_HAL_IMPL_SSE_64BIT_CMP_OP(_Tpvec, cast) \ -inline _Tpvec operator == (const _Tpvec& a, const _Tpvec& b) \ -{ return cast(v_reinterpret_as_f64(a) == v_reinterpret_as_f64(b)); } \ -inline _Tpvec operator != (const _Tpvec& a, const _Tpvec& b) \ -{ return cast(v_reinterpret_as_f64(a) != v_reinterpret_as_f64(b)); } - -OPENCV_HAL_IMPL_SSE_64BIT_CMP_OP(v_uint64x2, v_reinterpret_as_u64) -OPENCV_HAL_IMPL_SSE_64BIT_CMP_OP(v_int64x2, v_reinterpret_as_s64) - -inline v_float32x4 v_not_nan(const v_float32x4& a) -{ return v_float32x4(_mm_cmpord_ps(a.val, a.val)); } -inline v_float64x2 v_not_nan(const v_float64x2& a) -{ return v_float64x2(_mm_cmpord_pd(a.val, a.val)); } - -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint8x16, v_add_wrap, _mm_add_epi8) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int8x16, v_add_wrap, _mm_add_epi8) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint16x8, v_add_wrap, _mm_add_epi16) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_add_wrap, _mm_add_epi16) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint8x16, v_sub_wrap, _mm_sub_epi8) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int8x16, v_sub_wrap, _mm_sub_epi8) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint16x8, v_sub_wrap, _mm_sub_epi16) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_sub_wrap, _mm_sub_epi16) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint16x8, v_mul_wrap, _mm_mullo_epi16) -OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_mul_wrap, _mm_mullo_epi16) - -inline v_uint8x16 v_mul_wrap(const v_uint8x16& a, const v_uint8x16& b) -{ - __m128i ad = _mm_srai_epi16(a.val, 8); - __m128i bd = _mm_srai_epi16(b.val, 8); - __m128i p0 = _mm_mullo_epi16(a.val, b.val); // even - __m128i p1 = _mm_slli_epi16(_mm_mullo_epi16(ad, bd), 8); // odd - const __m128i b01 = _mm_set1_epi32(0xFF00FF00); - return v_uint8x16(_v128_blendv_epi8(p0, p1, b01)); -} -inline v_int8x16 v_mul_wrap(const v_int8x16& a, const v_int8x16& b) -{ - return v_reinterpret_as_s8(v_mul_wrap(v_reinterpret_as_u8(a), v_reinterpret_as_u8(b))); -} - -/** Absolute difference **/ - -inline v_uint8x16 v_absdiff(const v_uint8x16& a, const v_uint8x16& b) -{ return v_add_wrap(a - b, b - a); } -inline v_uint16x8 v_absdiff(const v_uint16x8& a, const v_uint16x8& b) -{ return v_add_wrap(a - b, b - a); } -inline v_uint32x4 v_absdiff(const v_uint32x4& a, const v_uint32x4& b) -{ return v_max(a, b) - v_min(a, b); } - -inline v_uint8x16 v_absdiff(const v_int8x16& a, const v_int8x16& b) -{ - v_int8x16 d = v_sub_wrap(a, b); - v_int8x16 m = a < b; - return v_reinterpret_as_u8(v_sub_wrap(d ^ m, m)); -} -inline v_uint16x8 v_absdiff(const v_int16x8& a, const v_int16x8& b) -{ - return v_reinterpret_as_u16(v_sub_wrap(v_max(a, b), v_min(a, b))); -} -inline v_uint32x4 v_absdiff(const v_int32x4& a, const v_int32x4& b) -{ - v_int32x4 d = a - b; - v_int32x4 m = a < b; - return v_reinterpret_as_u32((d ^ m) - m); -} - -/** Saturating absolute difference **/ -inline v_int8x16 v_absdiffs(const v_int8x16& a, const v_int8x16& b) -{ - v_int8x16 d = a - b; - v_int8x16 m = a < b; - return (d ^ m) - m; - } -inline v_int16x8 v_absdiffs(const v_int16x8& a, const v_int16x8& b) -{ return v_max(a, b) - v_min(a, b); } - - -inline v_int32x4 v_fma(const v_int32x4& a, const v_int32x4& b, const v_int32x4& c) -{ - return a * b + c; -} - -inline v_int32x4 v_muladd(const v_int32x4& a, const v_int32x4& b, const v_int32x4& c) -{ - return v_fma(a, b, c); -} - -inline v_float32x4 v_fma(const v_float32x4& a, const v_float32x4& b, const v_float32x4& c) -{ -#if CV_FMA3 - return v_float32x4(_mm_fmadd_ps(a.val, b.val, c.val)); -#else - return v_float32x4(_mm_add_ps(_mm_mul_ps(a.val, b.val), c.val)); -#endif -} - -inline v_float64x2 v_fma(const v_float64x2& a, const v_float64x2& b, const v_float64x2& c) -{ -#if CV_FMA3 - return v_float64x2(_mm_fmadd_pd(a.val, b.val, c.val)); -#else - return v_float64x2(_mm_add_pd(_mm_mul_pd(a.val, b.val), c.val)); -#endif -} - -#define OPENCV_HAL_IMPL_SSE_MISC_FLT_OP(_Tpvec, _Tp, _Tpreg, suffix, absmask_vec) \ -inline _Tpvec v_absdiff(const _Tpvec& a, const _Tpvec& b) \ -{ \ - _Tpreg absmask = _mm_castsi128_##suffix(absmask_vec); \ - return _Tpvec(_mm_and_##suffix(_mm_sub_##suffix(a.val, b.val), absmask)); \ -} \ -inline _Tpvec v_magnitude(const _Tpvec& a, const _Tpvec& b) \ -{ \ - _Tpvec res = v_fma(a, a, b*b); \ - return _Tpvec(_mm_sqrt_##suffix(res.val)); \ -} \ -inline _Tpvec v_sqr_magnitude(const _Tpvec& a, const _Tpvec& b) \ -{ \ - return v_fma(a, a, b*b); \ -} \ -inline _Tpvec v_muladd(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \ -{ \ - return v_fma(a, b, c); \ -} - -OPENCV_HAL_IMPL_SSE_MISC_FLT_OP(v_float32x4, float, __m128, ps, _mm_set1_epi32((int)0x7fffffff)) -OPENCV_HAL_IMPL_SSE_MISC_FLT_OP(v_float64x2, double, __m128d, pd, _mm_srli_epi64(_mm_set1_epi32(-1), 1)) - -#define OPENCV_HAL_IMPL_SSE_SHIFT_OP(_Tpuvec, _Tpsvec, suffix, srai) \ -inline _Tpuvec operator << (const _Tpuvec& a, int imm) \ -{ \ - return _Tpuvec(_mm_slli_##suffix(a.val, imm)); \ -} \ -inline _Tpsvec operator << (const _Tpsvec& a, int imm) \ -{ \ - return _Tpsvec(_mm_slli_##suffix(a.val, imm)); \ -} \ -inline _Tpuvec operator >> (const _Tpuvec& a, int imm) \ -{ \ - return _Tpuvec(_mm_srli_##suffix(a.val, imm)); \ -} \ -inline _Tpsvec operator >> (const _Tpsvec& a, int imm) \ -{ \ - return _Tpsvec(srai(a.val, imm)); \ -} \ -template \ -inline _Tpuvec v_shl(const _Tpuvec& a) \ -{ \ - return _Tpuvec(_mm_slli_##suffix(a.val, imm)); \ -} \ -template \ -inline _Tpsvec v_shl(const _Tpsvec& a) \ -{ \ - return _Tpsvec(_mm_slli_##suffix(a.val, imm)); \ -} \ -template \ -inline _Tpuvec v_shr(const _Tpuvec& a) \ -{ \ - return _Tpuvec(_mm_srli_##suffix(a.val, imm)); \ -} \ -template \ -inline _Tpsvec v_shr(const _Tpsvec& a) \ -{ \ - return _Tpsvec(srai(a.val, imm)); \ -} - -OPENCV_HAL_IMPL_SSE_SHIFT_OP(v_uint16x8, v_int16x8, epi16, _mm_srai_epi16) -OPENCV_HAL_IMPL_SSE_SHIFT_OP(v_uint32x4, v_int32x4, epi32, _mm_srai_epi32) -OPENCV_HAL_IMPL_SSE_SHIFT_OP(v_uint64x2, v_int64x2, epi64, v_srai_epi64) - -namespace hal_sse_internal -{ - template 16)), - bool is_first = (imm == 0), - bool is_half = (imm == 8), - bool is_second = (imm == 16), - bool is_other = (((imm > 0) && (imm < 8)) || ((imm > 8) && (imm < 16)))> - class v_sse_palignr_u8_class; - - template - class v_sse_palignr_u8_class; - - template - class v_sse_palignr_u8_class - { - public: - inline __m128i operator()(const __m128i& a, const __m128i&) const - { - return a; - } - }; - - template - class v_sse_palignr_u8_class - { - public: - inline __m128i operator()(const __m128i& a, const __m128i& b) const - { - return _mm_unpacklo_epi64(_mm_unpackhi_epi64(a, a), b); - } - }; - - template - class v_sse_palignr_u8_class - { - public: - inline __m128i operator()(const __m128i&, const __m128i& b) const - { - return b; - } - }; - - template - class v_sse_palignr_u8_class - { -#if CV_SSSE3 - public: - inline __m128i operator()(const __m128i& a, const __m128i& b) const - { - return _mm_alignr_epi8(b, a, imm); - } -#else - public: - inline __m128i operator()(const __m128i& a, const __m128i& b) const - { - enum { imm2 = (sizeof(__m128i) - imm) }; - return _mm_or_si128(_mm_srli_si128(a, imm), _mm_slli_si128(b, imm2)); - } -#endif - }; - - template - inline __m128i v_sse_palignr_u8(const __m128i& a, const __m128i& b) - { - CV_StaticAssert((imm >= 0) && (imm <= 16), "Invalid imm for v_sse_palignr_u8."); - return v_sse_palignr_u8_class()(a, b); - } -} - -template -inline _Tpvec v_rotate_right(const _Tpvec &a) -{ - using namespace hal_sse_internal; - enum { imm2 = (imm * sizeof(typename _Tpvec::lane_type)) }; - return _Tpvec(v_sse_reinterpret_as( - _mm_srli_si128( - v_sse_reinterpret_as<__m128i>(a.val), imm2))); -} - -template -inline _Tpvec v_rotate_left(const _Tpvec &a) -{ - using namespace hal_sse_internal; - enum { imm2 = (imm * sizeof(typename _Tpvec::lane_type)) }; - return _Tpvec(v_sse_reinterpret_as( - _mm_slli_si128( - v_sse_reinterpret_as<__m128i>(a.val), imm2))); -} - -template -inline _Tpvec v_rotate_right(const _Tpvec &a, const _Tpvec &b) -{ - using namespace hal_sse_internal; - enum { imm2 = (imm * sizeof(typename _Tpvec::lane_type)) }; - return _Tpvec(v_sse_reinterpret_as( - v_sse_palignr_u8( - v_sse_reinterpret_as<__m128i>(a.val), - v_sse_reinterpret_as<__m128i>(b.val)))); -} - -template -inline _Tpvec v_rotate_left(const _Tpvec &a, const _Tpvec &b) -{ - using namespace hal_sse_internal; - enum { imm2 = ((_Tpvec::nlanes - imm) * sizeof(typename _Tpvec::lane_type)) }; - return _Tpvec(v_sse_reinterpret_as( - v_sse_palignr_u8( - v_sse_reinterpret_as<__m128i>(b.val), - v_sse_reinterpret_as<__m128i>(a.val)))); -} - -#define OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(_Tpvec, _Tp) \ -inline _Tpvec v_load(const _Tp* ptr) \ -{ return _Tpvec(_mm_loadu_si128((const __m128i*)ptr)); } \ -inline _Tpvec v_load_aligned(const _Tp* ptr) \ -{ return _Tpvec(_mm_load_si128((const __m128i*)ptr)); } \ -inline _Tpvec v_load_low(const _Tp* ptr) \ -{ return _Tpvec(_mm_loadl_epi64((const __m128i*)ptr)); } \ -inline _Tpvec v_load_halves(const _Tp* ptr0, const _Tp* ptr1) \ -{ \ - return _Tpvec(_mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i*)ptr0), \ - _mm_loadl_epi64((const __m128i*)ptr1))); \ -} \ -inline void v_store(_Tp* ptr, const _Tpvec& a) \ -{ _mm_storeu_si128((__m128i*)ptr, a.val); } \ -inline void v_store_aligned(_Tp* ptr, const _Tpvec& a) \ -{ _mm_store_si128((__m128i*)ptr, a.val); } \ -inline void v_store_aligned_nocache(_Tp* ptr, const _Tpvec& a) \ -{ _mm_stream_si128((__m128i*)ptr, a.val); } \ -inline void v_store(_Tp* ptr, const _Tpvec& a, hal::StoreMode mode) \ -{ \ - if( mode == hal::STORE_UNALIGNED ) \ - _mm_storeu_si128((__m128i*)ptr, a.val); \ - else if( mode == hal::STORE_ALIGNED_NOCACHE ) \ - _mm_stream_si128((__m128i*)ptr, a.val); \ - else \ - _mm_store_si128((__m128i*)ptr, a.val); \ -} \ -inline void v_store_low(_Tp* ptr, const _Tpvec& a) \ -{ _mm_storel_epi64((__m128i*)ptr, a.val); } \ -inline void v_store_high(_Tp* ptr, const _Tpvec& a) \ -{ _mm_storel_epi64((__m128i*)ptr, _mm_unpackhi_epi64(a.val, a.val)); } - -OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_uint8x16, uchar) -OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_int8x16, schar) -OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_uint16x8, ushort) -OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_int16x8, short) -OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_uint32x4, unsigned) -OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_int32x4, int) -OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_uint64x2, uint64) -OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_int64x2, int64) - -#define OPENCV_HAL_IMPL_SSE_LOADSTORE_FLT_OP(_Tpvec, _Tp, suffix) \ -inline _Tpvec v_load(const _Tp* ptr) \ -{ return _Tpvec(_mm_loadu_##suffix(ptr)); } \ -inline _Tpvec v_load_aligned(const _Tp* ptr) \ -{ return _Tpvec(_mm_load_##suffix(ptr)); } \ -inline _Tpvec v_load_low(const _Tp* ptr) \ -{ return _Tpvec(_mm_castsi128_##suffix(_mm_loadl_epi64((const __m128i*)ptr))); } \ -inline _Tpvec v_load_halves(const _Tp* ptr0, const _Tp* ptr1) \ -{ \ - return _Tpvec(_mm_castsi128_##suffix( \ - _mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i*)ptr0), \ - _mm_loadl_epi64((const __m128i*)ptr1)))); \ -} \ -inline void v_store(_Tp* ptr, const _Tpvec& a) \ -{ _mm_storeu_##suffix(ptr, a.val); } \ -inline void v_store_aligned(_Tp* ptr, const _Tpvec& a) \ -{ _mm_store_##suffix(ptr, a.val); } \ -inline void v_store_aligned_nocache(_Tp* ptr, const _Tpvec& a) \ -{ _mm_stream_##suffix(ptr, a.val); } \ -inline void v_store(_Tp* ptr, const _Tpvec& a, hal::StoreMode mode) \ -{ \ - if( mode == hal::STORE_UNALIGNED ) \ - _mm_storeu_##suffix(ptr, a.val); \ - else if( mode == hal::STORE_ALIGNED_NOCACHE ) \ - _mm_stream_##suffix(ptr, a.val); \ - else \ - _mm_store_##suffix(ptr, a.val); \ -} \ -inline void v_store_low(_Tp* ptr, const _Tpvec& a) \ -{ _mm_storel_epi64((__m128i*)ptr, _mm_cast##suffix##_si128(a.val)); } \ -inline void v_store_high(_Tp* ptr, const _Tpvec& a) \ -{ \ - __m128i a1 = _mm_cast##suffix##_si128(a.val); \ - _mm_storel_epi64((__m128i*)ptr, _mm_unpackhi_epi64(a1, a1)); \ -} - -OPENCV_HAL_IMPL_SSE_LOADSTORE_FLT_OP(v_float32x4, float, ps) -OPENCV_HAL_IMPL_SSE_LOADSTORE_FLT_OP(v_float64x2, double, pd) - -#define OPENCV_HAL_IMPL_SSE_REDUCE_OP_8(_Tpvec, scalartype, func, suffix, sbit) \ -inline scalartype v_reduce_##func(const v_##_Tpvec& a) \ -{ \ - __m128i val = a.val; \ - val = _mm_##func##_##suffix(val, _mm_srli_si128(val,8)); \ - val = _mm_##func##_##suffix(val, _mm_srli_si128(val,4)); \ - val = _mm_##func##_##suffix(val, _mm_srli_si128(val,2)); \ - return (scalartype)_mm_cvtsi128_si32(val); \ -} \ -inline unsigned scalartype v_reduce_##func(const v_u##_Tpvec& a) \ -{ \ - __m128i val = a.val; \ - __m128i smask = _mm_set1_epi16(sbit); \ - val = _mm_xor_si128(val, smask); \ - val = _mm_##func##_##suffix(val, _mm_srli_si128(val,8)); \ - val = _mm_##func##_##suffix(val, _mm_srli_si128(val,4)); \ - val = _mm_##func##_##suffix(val, _mm_srli_si128(val,2)); \ - return (unsigned scalartype)(_mm_cvtsi128_si32(val) ^ sbit); \ -} -#define OPENCV_HAL_IMPL_SSE_REDUCE_OP_8_SUM(_Tpvec, scalartype, suffix) \ -inline scalartype v_reduce_sum(const v_##_Tpvec& a) \ -{ \ - __m128i val = a.val; \ - val = _mm_adds_epi##suffix(val, _mm_srli_si128(val, 8)); \ - val = _mm_adds_epi##suffix(val, _mm_srli_si128(val, 4)); \ - val = _mm_adds_epi##suffix(val, _mm_srli_si128(val, 2)); \ - return (scalartype)_mm_cvtsi128_si32(val); \ -} \ -inline unsigned scalartype v_reduce_sum(const v_u##_Tpvec& a) \ -{ \ - __m128i val = a.val; \ - val = _mm_adds_epu##suffix(val, _mm_srli_si128(val, 8)); \ - val = _mm_adds_epu##suffix(val, _mm_srli_si128(val, 4)); \ - val = _mm_adds_epu##suffix(val, _mm_srli_si128(val, 2)); \ - return (unsigned scalartype)_mm_cvtsi128_si32(val); \ -} -OPENCV_HAL_IMPL_SSE_REDUCE_OP_8(int16x8, short, max, epi16, (short)-32768) -OPENCV_HAL_IMPL_SSE_REDUCE_OP_8(int16x8, short, min, epi16, (short)-32768) -OPENCV_HAL_IMPL_SSE_REDUCE_OP_8_SUM(int16x8, short, 16) - -#define OPENCV_HAL_IMPL_SSE_REDUCE_OP_4_SUM(_Tpvec, scalartype, regtype, suffix, cast_from, cast_to, extract) \ -inline scalartype v_reduce_sum(const _Tpvec& a) \ -{ \ - regtype val = a.val; \ - val = _mm_add_##suffix(val, cast_to(_mm_srli_si128(cast_from(val), 8))); \ - val = _mm_add_##suffix(val, cast_to(_mm_srli_si128(cast_from(val), 4))); \ - return (scalartype)_mm_cvt##extract(val); \ -} - -#define OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(_Tpvec, scalartype, func, scalar_func) \ -inline scalartype v_reduce_##func(const _Tpvec& a) \ -{ \ - scalartype CV_DECL_ALIGNED(16) buf[4]; \ - v_store_aligned(buf, a); \ - scalartype s0 = scalar_func(buf[0], buf[1]); \ - scalartype s1 = scalar_func(buf[2], buf[3]); \ - return scalar_func(s0, s1); \ -} - -OPENCV_HAL_IMPL_SSE_REDUCE_OP_4_SUM(v_uint32x4, unsigned, __m128i, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP, si128_si32) -OPENCV_HAL_IMPL_SSE_REDUCE_OP_4_SUM(v_int32x4, int, __m128i, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP, si128_si32) -OPENCV_HAL_IMPL_SSE_REDUCE_OP_4_SUM(v_float32x4, float, __m128, ps, _mm_castps_si128, _mm_castsi128_ps, ss_f32) - -inline double v_reduce_sum(const v_float64x2& a) -{ - double CV_DECL_ALIGNED(32) idx[2]; - v_store_aligned(idx, a); - return idx[0] + idx[1]; -} - -inline v_float32x4 v_reduce_sum4(const v_float32x4& a, const v_float32x4& b, - const v_float32x4& c, const v_float32x4& d) -{ -#if CV_SSE3 - __m128 ab = _mm_hadd_ps(a.val, b.val); - __m128 cd = _mm_hadd_ps(c.val, d.val); - return v_float32x4(_mm_hadd_ps(ab, cd)); -#else - __m128 ac = _mm_add_ps(_mm_unpacklo_ps(a.val, c.val), _mm_unpackhi_ps(a.val, c.val)); - __m128 bd = _mm_add_ps(_mm_unpacklo_ps(b.val, d.val), _mm_unpackhi_ps(b.val, d.val)); - return v_float32x4(_mm_add_ps(_mm_unpacklo_ps(ac, bd), _mm_unpackhi_ps(ac, bd))); -#endif -} - -OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_uint32x4, unsigned, max, std::max) -OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_uint32x4, unsigned, min, std::min) -OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_int32x4, int, max, std::max) -OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_int32x4, int, min, std::min) -OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_float32x4, float, max, std::max) -OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_float32x4, float, min, std::min) - -inline unsigned v_reduce_sad(const v_uint8x16& a, const v_uint8x16& b) -{ - return (unsigned)_mm_cvtsi128_si32(_mm_sad_epu8(a.val, b.val)); -} -inline unsigned v_reduce_sad(const v_int8x16& a, const v_int8x16& b) -{ - __m128i half = _mm_set1_epi8(0x7f); - return (unsigned)_mm_cvtsi128_si32(_mm_sad_epu8(_mm_add_epi8(a.val, half), - _mm_add_epi8(b.val, half))); -} -inline unsigned v_reduce_sad(const v_uint16x8& a, const v_uint16x8& b) -{ - v_uint32x4 l, h; - v_expand(v_absdiff(a, b), l, h); - return v_reduce_sum(l + h); -} -inline unsigned v_reduce_sad(const v_int16x8& a, const v_int16x8& b) -{ - v_uint32x4 l, h; - v_expand(v_absdiff(a, b), l, h); - return v_reduce_sum(l + h); -} -inline unsigned v_reduce_sad(const v_uint32x4& a, const v_uint32x4& b) -{ - return v_reduce_sum(v_absdiff(a, b)); -} -inline unsigned v_reduce_sad(const v_int32x4& a, const v_int32x4& b) -{ - return v_reduce_sum(v_absdiff(a, b)); -} -inline float v_reduce_sad(const v_float32x4& a, const v_float32x4& b) -{ - return v_reduce_sum(v_absdiff(a, b)); -} - -#define OPENCV_HAL_IMPL_SSE_POPCOUNT(_Tpvec) \ -inline v_uint32x4 v_popcount(const _Tpvec& a) \ -{ \ - __m128i m1 = _mm_set1_epi32(0x55555555); \ - __m128i m2 = _mm_set1_epi32(0x33333333); \ - __m128i m4 = _mm_set1_epi32(0x0f0f0f0f); \ - __m128i p = a.val; \ - p = _mm_add_epi32(_mm_and_si128(_mm_srli_epi32(p, 1), m1), _mm_and_si128(p, m1)); \ - p = _mm_add_epi32(_mm_and_si128(_mm_srli_epi32(p, 2), m2), _mm_and_si128(p, m2)); \ - p = _mm_add_epi32(_mm_and_si128(_mm_srli_epi32(p, 4), m4), _mm_and_si128(p, m4)); \ - p = _mm_adds_epi8(p, _mm_srli_si128(p, 1)); \ - p = _mm_adds_epi8(p, _mm_srli_si128(p, 2)); \ - return v_uint32x4(_mm_and_si128(p, _mm_set1_epi32(0x000000ff))); \ -} - -OPENCV_HAL_IMPL_SSE_POPCOUNT(v_uint8x16) -OPENCV_HAL_IMPL_SSE_POPCOUNT(v_uint16x8) -OPENCV_HAL_IMPL_SSE_POPCOUNT(v_uint32x4) -OPENCV_HAL_IMPL_SSE_POPCOUNT(v_int8x16) -OPENCV_HAL_IMPL_SSE_POPCOUNT(v_int16x8) -OPENCV_HAL_IMPL_SSE_POPCOUNT(v_int32x4) - -#define OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(_Tpvec, suffix, pack_op, and_op, signmask, allmask) \ -inline int v_signmask(const _Tpvec& a) \ -{ \ - return and_op(_mm_movemask_##suffix(pack_op(a.val)), signmask); \ -} \ -inline bool v_check_all(const _Tpvec& a) \ -{ return and_op(_mm_movemask_##suffix(a.val), allmask) == allmask; } \ -inline bool v_check_any(const _Tpvec& a) \ -{ return and_op(_mm_movemask_##suffix(a.val), allmask) != 0; } - -#define OPENCV_HAL_PACKS(a) _mm_packs_epi16(a, a) -inline __m128i v_packq_epi32(__m128i a) -{ - __m128i b = _mm_packs_epi32(a, a); - return _mm_packs_epi16(b, b); -} - -OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_uint8x16, epi8, OPENCV_HAL_NOP, OPENCV_HAL_1ST, 65535, 65535) -OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_int8x16, epi8, OPENCV_HAL_NOP, OPENCV_HAL_1ST, 65535, 65535) -OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_uint16x8, epi8, OPENCV_HAL_PACKS, OPENCV_HAL_AND, 255, (int)0xaaaa) -OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_int16x8, epi8, OPENCV_HAL_PACKS, OPENCV_HAL_AND, 255, (int)0xaaaa) -OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_uint32x4, epi8, v_packq_epi32, OPENCV_HAL_AND, 15, (int)0x8888) -OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_int32x4, epi8, v_packq_epi32, OPENCV_HAL_AND, 15, (int)0x8888) -OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_float32x4, ps, OPENCV_HAL_NOP, OPENCV_HAL_1ST, 15, 15) -OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_float64x2, pd, OPENCV_HAL_NOP, OPENCV_HAL_1ST, 3, 3) - -#if CV_SSE4_1 -#define OPENCV_HAL_IMPL_SSE_SELECT(_Tpvec, cast_ret, cast, suffix) \ -inline _Tpvec v_select(const _Tpvec& mask, const _Tpvec& a, const _Tpvec& b) \ -{ \ - return _Tpvec(cast_ret(_mm_blendv_##suffix(cast(b.val), cast(a.val), cast(mask.val)))); \ -} - -OPENCV_HAL_IMPL_SSE_SELECT(v_uint8x16, OPENCV_HAL_NOP, OPENCV_HAL_NOP, epi8) -OPENCV_HAL_IMPL_SSE_SELECT(v_int8x16, OPENCV_HAL_NOP, OPENCV_HAL_NOP, epi8) -OPENCV_HAL_IMPL_SSE_SELECT(v_uint16x8, OPENCV_HAL_NOP, OPENCV_HAL_NOP, epi8) -OPENCV_HAL_IMPL_SSE_SELECT(v_int16x8, OPENCV_HAL_NOP, OPENCV_HAL_NOP, epi8) -OPENCV_HAL_IMPL_SSE_SELECT(v_uint32x4, _mm_castps_si128, _mm_castsi128_ps, ps) -OPENCV_HAL_IMPL_SSE_SELECT(v_int32x4, _mm_castps_si128, _mm_castsi128_ps, ps) -// OPENCV_HAL_IMPL_SSE_SELECT(v_uint64x2, TBD, TBD, pd) -// OPENCV_HAL_IMPL_SSE_SELECT(v_int64x2, TBD, TBD, ps) -OPENCV_HAL_IMPL_SSE_SELECT(v_float32x4, OPENCV_HAL_NOP, OPENCV_HAL_NOP, ps) -OPENCV_HAL_IMPL_SSE_SELECT(v_float64x2, OPENCV_HAL_NOP, OPENCV_HAL_NOP, pd) - -#else // CV_SSE4_1 - -#define OPENCV_HAL_IMPL_SSE_SELECT(_Tpvec, suffix) \ -inline _Tpvec v_select(const _Tpvec& mask, const _Tpvec& a, const _Tpvec& b) \ -{ \ - return _Tpvec(_mm_xor_##suffix(b.val, _mm_and_##suffix(_mm_xor_##suffix(b.val, a.val), mask.val))); \ -} - -OPENCV_HAL_IMPL_SSE_SELECT(v_uint8x16, si128) -OPENCV_HAL_IMPL_SSE_SELECT(v_int8x16, si128) -OPENCV_HAL_IMPL_SSE_SELECT(v_uint16x8, si128) -OPENCV_HAL_IMPL_SSE_SELECT(v_int16x8, si128) -OPENCV_HAL_IMPL_SSE_SELECT(v_uint32x4, si128) -OPENCV_HAL_IMPL_SSE_SELECT(v_int32x4, si128) -// OPENCV_HAL_IMPL_SSE_SELECT(v_uint64x2, si128) -// OPENCV_HAL_IMPL_SSE_SELECT(v_int64x2, si128) -OPENCV_HAL_IMPL_SSE_SELECT(v_float32x4, ps) -OPENCV_HAL_IMPL_SSE_SELECT(v_float64x2, pd) -#endif - -/* Expand */ -#define OPENCV_HAL_IMPL_SSE_EXPAND(_Tpvec, _Tpwvec, _Tp, intrin) \ - inline void v_expand(const _Tpvec& a, _Tpwvec& b0, _Tpwvec& b1) \ - { \ - b0.val = intrin(a.val); \ - b1.val = __CV_CAT(intrin, _high)(a.val); \ - } \ - inline _Tpwvec v_expand_low(const _Tpvec& a) \ - { return _Tpwvec(intrin(a.val)); } \ - inline _Tpwvec v_expand_high(const _Tpvec& a) \ - { return _Tpwvec(__CV_CAT(intrin, _high)(a.val)); } \ - inline _Tpwvec v_load_expand(const _Tp* ptr) \ - { \ - __m128i a = _mm_loadl_epi64((const __m128i*)ptr); \ - return _Tpwvec(intrin(a)); \ - } - -OPENCV_HAL_IMPL_SSE_EXPAND(v_uint8x16, v_uint16x8, uchar, _v128_cvtepu8_epi16) -OPENCV_HAL_IMPL_SSE_EXPAND(v_int8x16, v_int16x8, schar, _v128_cvtepi8_epi16) -OPENCV_HAL_IMPL_SSE_EXPAND(v_uint16x8, v_uint32x4, ushort, _v128_cvtepu16_epi32) -OPENCV_HAL_IMPL_SSE_EXPAND(v_int16x8, v_int32x4, short, _v128_cvtepi16_epi32) -OPENCV_HAL_IMPL_SSE_EXPAND(v_uint32x4, v_uint64x2, unsigned, _v128_cvtepu32_epi64) -OPENCV_HAL_IMPL_SSE_EXPAND(v_int32x4, v_int64x2, int, _v128_cvtepi32_epi64) - -#define OPENCV_HAL_IMPL_SSE_EXPAND_Q(_Tpvec, _Tp, intrin) \ - inline _Tpvec v_load_expand_q(const _Tp* ptr) \ - { \ - __m128i a = _mm_cvtsi32_si128(*(const int*)ptr); \ - return _Tpvec(intrin(a)); \ - } - -OPENCV_HAL_IMPL_SSE_EXPAND_Q(v_uint32x4, uchar, _v128_cvtepu8_epi32) -OPENCV_HAL_IMPL_SSE_EXPAND_Q(v_int32x4, schar, _v128_cvtepi8_epi32) - -#define OPENCV_HAL_IMPL_SSE_UNPACKS(_Tpvec, suffix, cast_from, cast_to) \ -inline void v_zip(const _Tpvec& a0, const _Tpvec& a1, _Tpvec& b0, _Tpvec& b1) \ -{ \ - b0.val = _mm_unpacklo_##suffix(a0.val, a1.val); \ - b1.val = _mm_unpackhi_##suffix(a0.val, a1.val); \ -} \ -inline _Tpvec v_combine_low(const _Tpvec& a, const _Tpvec& b) \ -{ \ - __m128i a1 = cast_from(a.val), b1 = cast_from(b.val); \ - return _Tpvec(cast_to(_mm_unpacklo_epi64(a1, b1))); \ -} \ -inline _Tpvec v_combine_high(const _Tpvec& a, const _Tpvec& b) \ -{ \ - __m128i a1 = cast_from(a.val), b1 = cast_from(b.val); \ - return _Tpvec(cast_to(_mm_unpackhi_epi64(a1, b1))); \ -} \ -inline void v_recombine(const _Tpvec& a, const _Tpvec& b, _Tpvec& c, _Tpvec& d) \ -{ \ - __m128i a1 = cast_from(a.val), b1 = cast_from(b.val); \ - c.val = cast_to(_mm_unpacklo_epi64(a1, b1)); \ - d.val = cast_to(_mm_unpackhi_epi64(a1, b1)); \ -} - -OPENCV_HAL_IMPL_SSE_UNPACKS(v_uint8x16, epi8, OPENCV_HAL_NOP, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_UNPACKS(v_int8x16, epi8, OPENCV_HAL_NOP, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_UNPACKS(v_uint16x8, epi16, OPENCV_HAL_NOP, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_UNPACKS(v_int16x8, epi16, OPENCV_HAL_NOP, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_UNPACKS(v_uint32x4, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_UNPACKS(v_int32x4, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_UNPACKS(v_float32x4, ps, _mm_castps_si128, _mm_castsi128_ps) -OPENCV_HAL_IMPL_SSE_UNPACKS(v_float64x2, pd, _mm_castpd_si128, _mm_castsi128_pd) - -template -inline _Tpvec v_extract(const _Tpvec& a, const _Tpvec& b) -{ - return v_rotate_right(a, b); -} - -inline v_int32x4 v_round(const v_float32x4& a) -{ return v_int32x4(_mm_cvtps_epi32(a.val)); } - -inline v_int32x4 v_floor(const v_float32x4& a) -{ - __m128i a1 = _mm_cvtps_epi32(a.val); - __m128i mask = _mm_castps_si128(_mm_cmpgt_ps(_mm_cvtepi32_ps(a1), a.val)); - return v_int32x4(_mm_add_epi32(a1, mask)); -} - -inline v_int32x4 v_ceil(const v_float32x4& a) -{ - __m128i a1 = _mm_cvtps_epi32(a.val); - __m128i mask = _mm_castps_si128(_mm_cmpgt_ps(a.val, _mm_cvtepi32_ps(a1))); - return v_int32x4(_mm_sub_epi32(a1, mask)); -} - -inline v_int32x4 v_trunc(const v_float32x4& a) -{ return v_int32x4(_mm_cvttps_epi32(a.val)); } - -inline v_int32x4 v_round(const v_float64x2& a) -{ return v_int32x4(_mm_cvtpd_epi32(a.val)); } - -inline v_int32x4 v_round(const v_float64x2& a, const v_float64x2& b) -{ - __m128i ai = _mm_cvtpd_epi32(a.val), bi = _mm_cvtpd_epi32(b.val); - return v_int32x4(_mm_unpacklo_epi64(ai, bi)); -} - -inline v_int32x4 v_floor(const v_float64x2& a) -{ - __m128i a1 = _mm_cvtpd_epi32(a.val); - __m128i mask = _mm_castpd_si128(_mm_cmpgt_pd(_mm_cvtepi32_pd(a1), a.val)); - mask = _mm_srli_si128(_mm_slli_si128(mask, 4), 8); // m0 m0 m1 m1 => m0 m1 0 0 - return v_int32x4(_mm_add_epi32(a1, mask)); -} - -inline v_int32x4 v_ceil(const v_float64x2& a) -{ - __m128i a1 = _mm_cvtpd_epi32(a.val); - __m128i mask = _mm_castpd_si128(_mm_cmpgt_pd(a.val, _mm_cvtepi32_pd(a1))); - mask = _mm_srli_si128(_mm_slli_si128(mask, 4), 8); // m0 m0 m1 m1 => m0 m1 0 0 - return v_int32x4(_mm_sub_epi32(a1, mask)); -} - -inline v_int32x4 v_trunc(const v_float64x2& a) -{ return v_int32x4(_mm_cvttpd_epi32(a.val)); } - -#define OPENCV_HAL_IMPL_SSE_TRANSPOSE4x4(_Tpvec, suffix, cast_from, cast_to) \ -inline void v_transpose4x4(const _Tpvec& a0, const _Tpvec& a1, \ - const _Tpvec& a2, const _Tpvec& a3, \ - _Tpvec& b0, _Tpvec& b1, \ - _Tpvec& b2, _Tpvec& b3) \ -{ \ - __m128i t0 = cast_from(_mm_unpacklo_##suffix(a0.val, a1.val)); \ - __m128i t1 = cast_from(_mm_unpacklo_##suffix(a2.val, a3.val)); \ - __m128i t2 = cast_from(_mm_unpackhi_##suffix(a0.val, a1.val)); \ - __m128i t3 = cast_from(_mm_unpackhi_##suffix(a2.val, a3.val)); \ -\ - b0.val = cast_to(_mm_unpacklo_epi64(t0, t1)); \ - b1.val = cast_to(_mm_unpackhi_epi64(t0, t1)); \ - b2.val = cast_to(_mm_unpacklo_epi64(t2, t3)); \ - b3.val = cast_to(_mm_unpackhi_epi64(t2, t3)); \ -} - -OPENCV_HAL_IMPL_SSE_TRANSPOSE4x4(v_uint32x4, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_TRANSPOSE4x4(v_int32x4, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP) -OPENCV_HAL_IMPL_SSE_TRANSPOSE4x4(v_float32x4, ps, _mm_castps_si128, _mm_castsi128_ps) - -// load deinterleave -inline void v_load_deinterleave(const uchar* ptr, v_uint8x16& a, v_uint8x16& b) -{ - __m128i t00 = _mm_loadu_si128((const __m128i*)ptr); - __m128i t01 = _mm_loadu_si128((const __m128i*)(ptr + 16)); - - __m128i t10 = _mm_unpacklo_epi8(t00, t01); - __m128i t11 = _mm_unpackhi_epi8(t00, t01); - - __m128i t20 = _mm_unpacklo_epi8(t10, t11); - __m128i t21 = _mm_unpackhi_epi8(t10, t11); - - __m128i t30 = _mm_unpacklo_epi8(t20, t21); - __m128i t31 = _mm_unpackhi_epi8(t20, t21); - - a.val = _mm_unpacklo_epi8(t30, t31); - b.val = _mm_unpackhi_epi8(t30, t31); -} - -inline void v_load_deinterleave(const uchar* ptr, v_uint8x16& a, v_uint8x16& b, v_uint8x16& c) -{ -#if CV_SSE4_1 - const __m128i m0 = _mm_setr_epi8(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0); - const __m128i m1 = _mm_setr_epi8(0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0); - __m128i s0 = _mm_loadu_si128((const __m128i*)ptr); - __m128i s1 = _mm_loadu_si128((const __m128i*)(ptr + 16)); - __m128i s2 = _mm_loadu_si128((const __m128i*)(ptr + 32)); - __m128i a0 = _mm_blendv_epi8(_mm_blendv_epi8(s0, s1, m0), s2, m1); - __m128i b0 = _mm_blendv_epi8(_mm_blendv_epi8(s1, s2, m0), s0, m1); - __m128i c0 = _mm_blendv_epi8(_mm_blendv_epi8(s2, s0, m0), s1, m1); - const __m128i sh_b = _mm_setr_epi8(0, 3, 6, 9, 12, 15, 2, 5, 8, 11, 14, 1, 4, 7, 10, 13); - const __m128i sh_g = _mm_setr_epi8(1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2, 5, 8, 11, 14); - const __m128i sh_r = _mm_setr_epi8(2, 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15); - a0 = _mm_shuffle_epi8(a0, sh_b); - b0 = _mm_shuffle_epi8(b0, sh_g); - c0 = _mm_shuffle_epi8(c0, sh_r); - a.val = a0; - b.val = b0; - c.val = c0; -#elif CV_SSSE3 - const __m128i m0 = _mm_setr_epi8(0, 3, 6, 9, 12, 15, 1, 4, 7, 10, 13, 2, 5, 8, 11, 14); - const __m128i m1 = _mm_alignr_epi8(m0, m0, 11); - const __m128i m2 = _mm_alignr_epi8(m0, m0, 6); - - __m128i t0 = _mm_loadu_si128((const __m128i*)ptr); - __m128i t1 = _mm_loadu_si128((const __m128i*)(ptr + 16)); - __m128i t2 = _mm_loadu_si128((const __m128i*)(ptr + 32)); - - __m128i s0 = _mm_shuffle_epi8(t0, m0); - __m128i s1 = _mm_shuffle_epi8(t1, m1); - __m128i s2 = _mm_shuffle_epi8(t2, m2); - - t0 = _mm_alignr_epi8(s1, _mm_slli_si128(s0, 10), 5); - a.val = _mm_alignr_epi8(s2, t0, 5); - - t1 = _mm_alignr_epi8(_mm_srli_si128(s1, 5), _mm_slli_si128(s0, 5), 6); - b.val = _mm_alignr_epi8(_mm_srli_si128(s2, 5), t1, 5); - - t2 = _mm_alignr_epi8(_mm_srli_si128(s2, 10), s1, 11); - c.val = _mm_alignr_epi8(t2, s0, 11); -#else - __m128i t00 = _mm_loadu_si128((const __m128i*)ptr); - __m128i t01 = _mm_loadu_si128((const __m128i*)(ptr + 16)); - __m128i t02 = _mm_loadu_si128((const __m128i*)(ptr + 32)); - - __m128i t10 = _mm_unpacklo_epi8(t00, _mm_unpackhi_epi64(t01, t01)); - __m128i t11 = _mm_unpacklo_epi8(_mm_unpackhi_epi64(t00, t00), t02); - __m128i t12 = _mm_unpacklo_epi8(t01, _mm_unpackhi_epi64(t02, t02)); - - __m128i t20 = _mm_unpacklo_epi8(t10, _mm_unpackhi_epi64(t11, t11)); - __m128i t21 = _mm_unpacklo_epi8(_mm_unpackhi_epi64(t10, t10), t12); - __m128i t22 = _mm_unpacklo_epi8(t11, _mm_unpackhi_epi64(t12, t12)); - - __m128i t30 = _mm_unpacklo_epi8(t20, _mm_unpackhi_epi64(t21, t21)); - __m128i t31 = _mm_unpacklo_epi8(_mm_unpackhi_epi64(t20, t20), t22); - __m128i t32 = _mm_unpacklo_epi8(t21, _mm_unpackhi_epi64(t22, t22)); - - a.val = _mm_unpacklo_epi8(t30, _mm_unpackhi_epi64(t31, t31)); - b.val = _mm_unpacklo_epi8(_mm_unpackhi_epi64(t30, t30), t32); - c.val = _mm_unpacklo_epi8(t31, _mm_unpackhi_epi64(t32, t32)); -#endif -} - -inline void v_load_deinterleave(const uchar* ptr, v_uint8x16& a, v_uint8x16& b, v_uint8x16& c, v_uint8x16& d) -{ - __m128i u0 = _mm_loadu_si128((const __m128i*)ptr); // a0 b0 c0 d0 a1 b1 c1 d1 ... - __m128i u1 = _mm_loadu_si128((const __m128i*)(ptr + 16)); // a4 b4 c4 d4 ... - __m128i u2 = _mm_loadu_si128((const __m128i*)(ptr + 32)); // a8 b8 c8 d8 ... - __m128i u3 = _mm_loadu_si128((const __m128i*)(ptr + 48)); // a12 b12 c12 d12 ... - - __m128i v0 = _mm_unpacklo_epi8(u0, u2); // a0 a8 b0 b8 ... - __m128i v1 = _mm_unpackhi_epi8(u0, u2); // a2 a10 b2 b10 ... - __m128i v2 = _mm_unpacklo_epi8(u1, u3); // a4 a12 b4 b12 ... - __m128i v3 = _mm_unpackhi_epi8(u1, u3); // a6 a14 b6 b14 ... - - u0 = _mm_unpacklo_epi8(v0, v2); // a0 a4 a8 a12 ... - u1 = _mm_unpacklo_epi8(v1, v3); // a2 a6 a10 a14 ... - u2 = _mm_unpackhi_epi8(v0, v2); // a1 a5 a9 a13 ... - u3 = _mm_unpackhi_epi8(v1, v3); // a3 a7 a11 a15 ... - - v0 = _mm_unpacklo_epi8(u0, u1); // a0 a2 a4 a6 ... - v1 = _mm_unpacklo_epi8(u2, u3); // a1 a3 a5 a7 ... - v2 = _mm_unpackhi_epi8(u0, u1); // c0 c2 c4 c6 ... - v3 = _mm_unpackhi_epi8(u2, u3); // c1 c3 c5 c7 ... - - a.val = _mm_unpacklo_epi8(v0, v1); - b.val = _mm_unpackhi_epi8(v0, v1); - c.val = _mm_unpacklo_epi8(v2, v3); - d.val = _mm_unpackhi_epi8(v2, v3); -} - -inline void v_load_deinterleave(const ushort* ptr, v_uint16x8& a, v_uint16x8& b) -{ - __m128i v0 = _mm_loadu_si128((__m128i*)(ptr)); // a0 b0 a1 b1 a2 b2 a3 b3 - __m128i v1 = _mm_loadu_si128((__m128i*)(ptr + 8)); // a4 b4 a5 b5 a6 b6 a7 b7 - - __m128i v2 = _mm_unpacklo_epi16(v0, v1); // a0 a4 b0 b4 a1 a5 b1 b5 - __m128i v3 = _mm_unpackhi_epi16(v0, v1); // a2 a6 b2 b6 a3 a7 b3 b7 - __m128i v4 = _mm_unpacklo_epi16(v2, v3); // a0 a2 a4 a6 b0 b2 b4 b6 - __m128i v5 = _mm_unpackhi_epi16(v2, v3); // a1 a3 a5 a7 b1 b3 b5 b7 - - a.val = _mm_unpacklo_epi16(v4, v5); // a0 a1 a2 a3 a4 a5 a6 a7 - b.val = _mm_unpackhi_epi16(v4, v5); // b0 b1 ab b3 b4 b5 b6 b7 -} - -inline void v_load_deinterleave(const ushort* ptr, v_uint16x8& a, v_uint16x8& b, v_uint16x8& c) -{ -#if CV_SSE4_1 - __m128i v0 = _mm_loadu_si128((__m128i*)(ptr)); - __m128i v1 = _mm_loadu_si128((__m128i*)(ptr + 8)); - __m128i v2 = _mm_loadu_si128((__m128i*)(ptr + 16)); - __m128i a0 = _mm_blend_epi16(_mm_blend_epi16(v0, v1, 0x92), v2, 0x24); - __m128i b0 = _mm_blend_epi16(_mm_blend_epi16(v2, v0, 0x92), v1, 0x24); - __m128i c0 = _mm_blend_epi16(_mm_blend_epi16(v1, v2, 0x92), v0, 0x24); - - const __m128i sh_a = _mm_setr_epi8(0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, 4, 5, 10, 11); - const __m128i sh_b = _mm_setr_epi8(2, 3, 8, 9, 14, 15, 4, 5, 10, 11, 0, 1, 6, 7, 12, 13); - const __m128i sh_c = _mm_setr_epi8(4, 5, 10, 11, 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15); - a0 = _mm_shuffle_epi8(a0, sh_a); - b0 = _mm_shuffle_epi8(b0, sh_b); - c0 = _mm_shuffle_epi8(c0, sh_c); - - a.val = a0; - b.val = b0; - c.val = c0; -#else - __m128i t00 = _mm_loadu_si128((const __m128i*)ptr); - __m128i t01 = _mm_loadu_si128((const __m128i*)(ptr + 8)); - __m128i t02 = _mm_loadu_si128((const __m128i*)(ptr + 16)); - - __m128i t10 = _mm_unpacklo_epi16(t00, _mm_unpackhi_epi64(t01, t01)); - __m128i t11 = _mm_unpacklo_epi16(_mm_unpackhi_epi64(t00, t00), t02); - __m128i t12 = _mm_unpacklo_epi16(t01, _mm_unpackhi_epi64(t02, t02)); - - __m128i t20 = _mm_unpacklo_epi16(t10, _mm_unpackhi_epi64(t11, t11)); - __m128i t21 = _mm_unpacklo_epi16(_mm_unpackhi_epi64(t10, t10), t12); - __m128i t22 = _mm_unpacklo_epi16(t11, _mm_unpackhi_epi64(t12, t12)); - - a.val = _mm_unpacklo_epi16(t20, _mm_unpackhi_epi64(t21, t21)); - b.val = _mm_unpacklo_epi16(_mm_unpackhi_epi64(t20, t20), t22); - c.val = _mm_unpacklo_epi16(t21, _mm_unpackhi_epi64(t22, t22)); -#endif -} - -inline void v_load_deinterleave(const ushort* ptr, v_uint16x8& a, v_uint16x8& b, v_uint16x8& c, v_uint16x8& d) -{ - __m128i u0 = _mm_loadu_si128((const __m128i*)ptr); // a0 b0 c0 d0 a1 b1 c1 d1 - __m128i u1 = _mm_loadu_si128((const __m128i*)(ptr + 8)); // a2 b2 c2 d2 ... - __m128i u2 = _mm_loadu_si128((const __m128i*)(ptr + 16)); // a4 b4 c4 d4 ... - __m128i u3 = _mm_loadu_si128((const __m128i*)(ptr + 24)); // a6 b6 c6 d6 ... - - __m128i v0 = _mm_unpacklo_epi16(u0, u2); // a0 a4 b0 b4 ... - __m128i v1 = _mm_unpackhi_epi16(u0, u2); // a1 a5 b1 b5 ... - __m128i v2 = _mm_unpacklo_epi16(u1, u3); // a2 a6 b2 b6 ... - __m128i v3 = _mm_unpackhi_epi16(u1, u3); // a3 a7 b3 b7 ... - - u0 = _mm_unpacklo_epi16(v0, v2); // a0 a2 a4 a6 ... - u1 = _mm_unpacklo_epi16(v1, v3); // a1 a3 a5 a7 ... - u2 = _mm_unpackhi_epi16(v0, v2); // c0 c2 c4 c6 ... - u3 = _mm_unpackhi_epi16(v1, v3); // c1 c3 c5 c7 ... - - a.val = _mm_unpacklo_epi16(u0, u1); - b.val = _mm_unpackhi_epi16(u0, u1); - c.val = _mm_unpacklo_epi16(u2, u3); - d.val = _mm_unpackhi_epi16(u2, u3); -} - -inline void v_load_deinterleave(const unsigned* ptr, v_uint32x4& a, v_uint32x4& b) -{ - __m128i v0 = _mm_loadu_si128((__m128i*)(ptr)); // a0 b0 a1 b1 - __m128i v1 = _mm_loadu_si128((__m128i*)(ptr + 4)); // a2 b2 a3 b3 - - __m128i v2 = _mm_unpacklo_epi32(v0, v1); // a0 a2 b0 b2 - __m128i v3 = _mm_unpackhi_epi32(v0, v1); // a1 a3 b1 b3 - - a.val = _mm_unpacklo_epi32(v2, v3); // a0 a1 a2 a3 - b.val = _mm_unpackhi_epi32(v2, v3); // b0 b1 ab b3 -} - -inline void v_load_deinterleave(const unsigned* ptr, v_uint32x4& a, v_uint32x4& b, v_uint32x4& c) -{ - __m128i t00 = _mm_loadu_si128((const __m128i*)ptr); - __m128i t01 = _mm_loadu_si128((const __m128i*)(ptr + 4)); - __m128i t02 = _mm_loadu_si128((const __m128i*)(ptr + 8)); - - __m128i t10 = _mm_unpacklo_epi32(t00, _mm_unpackhi_epi64(t01, t01)); - __m128i t11 = _mm_unpacklo_epi32(_mm_unpackhi_epi64(t00, t00), t02); - __m128i t12 = _mm_unpacklo_epi32(t01, _mm_unpackhi_epi64(t02, t02)); - - a.val = _mm_unpacklo_epi32(t10, _mm_unpackhi_epi64(t11, t11)); - b.val = _mm_unpacklo_epi32(_mm_unpackhi_epi64(t10, t10), t12); - c.val = _mm_unpacklo_epi32(t11, _mm_unpackhi_epi64(t12, t12)); -} - -inline void v_load_deinterleave(const unsigned* ptr, v_uint32x4& a, v_uint32x4& b, v_uint32x4& c, v_uint32x4& d) -{ - v_uint32x4 s0(_mm_loadu_si128((const __m128i*)ptr)); // a0 b0 c0 d0 - v_uint32x4 s1(_mm_loadu_si128((const __m128i*)(ptr + 4))); // a1 b1 c1 d1 - v_uint32x4 s2(_mm_loadu_si128((const __m128i*)(ptr + 8))); // a2 b2 c2 d2 - v_uint32x4 s3(_mm_loadu_si128((const __m128i*)(ptr + 12))); // a3 b3 c3 d3 - - v_transpose4x4(s0, s1, s2, s3, a, b, c, d); -} - -inline void v_load_deinterleave(const float* ptr, v_float32x4& a, v_float32x4& b) -{ - __m128 u0 = _mm_loadu_ps(ptr); // a0 b0 a1 b1 - __m128 u1 = _mm_loadu_ps((ptr + 4)); // a2 b2 a3 b3 - - a.val = _mm_shuffle_ps(u0, u1, _MM_SHUFFLE(2, 0, 2, 0)); // a0 a1 a2 a3 - b.val = _mm_shuffle_ps(u0, u1, _MM_SHUFFLE(3, 1, 3, 1)); // b0 b1 ab b3 -} - -inline void v_load_deinterleave(const float* ptr, v_float32x4& a, v_float32x4& b, v_float32x4& c) -{ - __m128 t0 = _mm_loadu_ps(ptr + 0); - __m128 t1 = _mm_loadu_ps(ptr + 4); - __m128 t2 = _mm_loadu_ps(ptr + 8); - - __m128 at12 = _mm_shuffle_ps(t1, t2, _MM_SHUFFLE(0, 1, 0, 2)); - a.val = _mm_shuffle_ps(t0, at12, _MM_SHUFFLE(2, 0, 3, 0)); - - __m128 bt01 = _mm_shuffle_ps(t0, t1, _MM_SHUFFLE(0, 0, 0, 1)); - __m128 bt12 = _mm_shuffle_ps(t1, t2, _MM_SHUFFLE(0, 2, 0, 3)); - b.val = _mm_shuffle_ps(bt01, bt12, _MM_SHUFFLE(2, 0, 2, 0)); - - __m128 ct01 = _mm_shuffle_ps(t0, t1, _MM_SHUFFLE(0, 1, 0, 2)); - c.val = _mm_shuffle_ps(ct01, t2, _MM_SHUFFLE(3, 0, 2, 0)); -} - -inline void v_load_deinterleave(const float* ptr, v_float32x4& a, v_float32x4& b, v_float32x4& c, v_float32x4& d) -{ - __m128 t0 = _mm_loadu_ps(ptr + 0); - __m128 t1 = _mm_loadu_ps(ptr + 4); - __m128 t2 = _mm_loadu_ps(ptr + 8); - __m128 t3 = _mm_loadu_ps(ptr + 12); - __m128 t02lo = _mm_unpacklo_ps(t0, t2); - __m128 t13lo = _mm_unpacklo_ps(t1, t3); - __m128 t02hi = _mm_unpackhi_ps(t0, t2); - __m128 t13hi = _mm_unpackhi_ps(t1, t3); - a.val = _mm_unpacklo_ps(t02lo, t13lo); - b.val = _mm_unpackhi_ps(t02lo, t13lo); - c.val = _mm_unpacklo_ps(t02hi, t13hi); - d.val = _mm_unpackhi_ps(t02hi, t13hi); -} - -inline void v_load_deinterleave(const uint64 *ptr, v_uint64x2& a, v_uint64x2& b) -{ - __m128i t0 = _mm_loadu_si128((const __m128i*)ptr); - __m128i t1 = _mm_loadu_si128((const __m128i*)(ptr + 2)); - - a = v_uint64x2(_mm_unpacklo_epi64(t0, t1)); - b = v_uint64x2(_mm_unpackhi_epi64(t0, t1)); -} - -inline void v_load_deinterleave(const uint64 *ptr, v_uint64x2& a, v_uint64x2& b, v_uint64x2& c) -{ - __m128i t0 = _mm_loadu_si128((const __m128i*)ptr); // a0, b0 - __m128i t1 = _mm_loadu_si128((const __m128i*)(ptr + 2)); // c0, a1 - __m128i t2 = _mm_loadu_si128((const __m128i*)(ptr + 4)); // b1, c1 - - t1 = _mm_shuffle_epi32(t1, 0x4e); // a1, c0 - - a = v_uint64x2(_mm_unpacklo_epi64(t0, t1)); - b = v_uint64x2(_mm_unpacklo_epi64(_mm_unpackhi_epi64(t0, t0), t2)); - c = v_uint64x2(_mm_unpackhi_epi64(t1, t2)); -} - -inline void v_load_deinterleave(const uint64 *ptr, v_uint64x2& a, - v_uint64x2& b, v_uint64x2& c, v_uint64x2& d) -{ - __m128i t0 = _mm_loadu_si128((const __m128i*)ptr); // a0 b0 - __m128i t1 = _mm_loadu_si128((const __m128i*)(ptr + 2)); // c0 d0 - __m128i t2 = _mm_loadu_si128((const __m128i*)(ptr + 4)); // a1 b1 - __m128i t3 = _mm_loadu_si128((const __m128i*)(ptr + 6)); // c1 d1 - - a = v_uint64x2(_mm_unpacklo_epi64(t0, t2)); - b = v_uint64x2(_mm_unpackhi_epi64(t0, t2)); - c = v_uint64x2(_mm_unpacklo_epi64(t1, t3)); - d = v_uint64x2(_mm_unpackhi_epi64(t1, t3)); -} - -// store interleave - -inline void v_store_interleave( uchar* ptr, const v_uint8x16& a, const v_uint8x16& b, - hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - __m128i v0 = _mm_unpacklo_epi8(a.val, b.val); - __m128i v1 = _mm_unpackhi_epi8(a.val, b.val); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_si128((__m128i*)(ptr), v0); - _mm_stream_si128((__m128i*)(ptr + 16), v1); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_si128((__m128i*)(ptr), v0); - _mm_store_si128((__m128i*)(ptr + 16), v1); - } - else - { - _mm_storeu_si128((__m128i*)(ptr), v0); - _mm_storeu_si128((__m128i*)(ptr + 16), v1); - } -} - -inline void v_store_interleave( uchar* ptr, const v_uint8x16& a, const v_uint8x16& b, - const v_uint8x16& c, hal::StoreMode mode = hal::STORE_UNALIGNED) -{ -#if CV_SSE4_1 - const __m128i sh_a = _mm_setr_epi8(0, 11, 6, 1, 12, 7, 2, 13, 8, 3, 14, 9, 4, 15, 10, 5); - const __m128i sh_b = _mm_setr_epi8(5, 0, 11, 6, 1, 12, 7, 2, 13, 8, 3, 14, 9, 4, 15, 10); - const __m128i sh_c = _mm_setr_epi8(10, 5, 0, 11, 6, 1, 12, 7, 2, 13, 8, 3, 14, 9, 4, 15); - __m128i a0 = _mm_shuffle_epi8(a.val, sh_a); - __m128i b0 = _mm_shuffle_epi8(b.val, sh_b); - __m128i c0 = _mm_shuffle_epi8(c.val, sh_c); - - const __m128i m0 = _mm_setr_epi8(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0); - const __m128i m1 = _mm_setr_epi8(0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0); - __m128i v0 = _mm_blendv_epi8(_mm_blendv_epi8(a0, b0, m1), c0, m0); - __m128i v1 = _mm_blendv_epi8(_mm_blendv_epi8(b0, c0, m1), a0, m0); - __m128i v2 = _mm_blendv_epi8(_mm_blendv_epi8(c0, a0, m1), b0, m0); -#elif CV_SSSE3 - const __m128i m0 = _mm_setr_epi8(0, 6, 11, 1, 7, 12, 2, 8, 13, 3, 9, 14, 4, 10, 15, 5); - const __m128i m1 = _mm_setr_epi8(5, 11, 0, 6, 12, 1, 7, 13, 2, 8, 14, 3, 9, 15, 4, 10); - const __m128i m2 = _mm_setr_epi8(10, 0, 5, 11, 1, 6, 12, 2, 7, 13, 3, 8, 14, 4, 9, 15); - - __m128i t0 = _mm_alignr_epi8(b.val, _mm_slli_si128(a.val, 10), 5); - t0 = _mm_alignr_epi8(c.val, t0, 5); - __m128i v0 = _mm_shuffle_epi8(t0, m0); - - __m128i t1 = _mm_alignr_epi8(_mm_srli_si128(b.val, 5), _mm_slli_si128(a.val, 5), 6); - t1 = _mm_alignr_epi8(_mm_srli_si128(c.val, 5), t1, 5); - __m128i v1 = _mm_shuffle_epi8(t1, m1); - - __m128i t2 = _mm_alignr_epi8(_mm_srli_si128(c.val, 10), b.val, 11); - t2 = _mm_alignr_epi8(t2, a.val, 11); - __m128i v2 = _mm_shuffle_epi8(t2, m2); -#else - __m128i z = _mm_setzero_si128(); - __m128i ab0 = _mm_unpacklo_epi8(a.val, b.val); - __m128i ab1 = _mm_unpackhi_epi8(a.val, b.val); - __m128i c0 = _mm_unpacklo_epi8(c.val, z); - __m128i c1 = _mm_unpackhi_epi8(c.val, z); - - __m128i p00 = _mm_unpacklo_epi16(ab0, c0); - __m128i p01 = _mm_unpackhi_epi16(ab0, c0); - __m128i p02 = _mm_unpacklo_epi16(ab1, c1); - __m128i p03 = _mm_unpackhi_epi16(ab1, c1); - - __m128i p10 = _mm_unpacklo_epi32(p00, p01); - __m128i p11 = _mm_unpackhi_epi32(p00, p01); - __m128i p12 = _mm_unpacklo_epi32(p02, p03); - __m128i p13 = _mm_unpackhi_epi32(p02, p03); - - __m128i p20 = _mm_unpacklo_epi64(p10, p11); - __m128i p21 = _mm_unpackhi_epi64(p10, p11); - __m128i p22 = _mm_unpacklo_epi64(p12, p13); - __m128i p23 = _mm_unpackhi_epi64(p12, p13); - - p20 = _mm_slli_si128(p20, 1); - p22 = _mm_slli_si128(p22, 1); - - __m128i p30 = _mm_slli_epi64(_mm_unpacklo_epi32(p20, p21), 8); - __m128i p31 = _mm_srli_epi64(_mm_unpackhi_epi32(p20, p21), 8); - __m128i p32 = _mm_slli_epi64(_mm_unpacklo_epi32(p22, p23), 8); - __m128i p33 = _mm_srli_epi64(_mm_unpackhi_epi32(p22, p23), 8); - - __m128i p40 = _mm_unpacklo_epi64(p30, p31); - __m128i p41 = _mm_unpackhi_epi64(p30, p31); - __m128i p42 = _mm_unpacklo_epi64(p32, p33); - __m128i p43 = _mm_unpackhi_epi64(p32, p33); - - __m128i v0 = _mm_or_si128(_mm_srli_si128(p40, 2), _mm_slli_si128(p41, 10)); - __m128i v1 = _mm_or_si128(_mm_srli_si128(p41, 6), _mm_slli_si128(p42, 6)); - __m128i v2 = _mm_or_si128(_mm_srli_si128(p42, 10), _mm_slli_si128(p43, 2)); -#endif - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_si128((__m128i*)(ptr), v0); - _mm_stream_si128((__m128i*)(ptr + 16), v1); - _mm_stream_si128((__m128i*)(ptr + 32), v2); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_si128((__m128i*)(ptr), v0); - _mm_store_si128((__m128i*)(ptr + 16), v1); - _mm_store_si128((__m128i*)(ptr + 32), v2); - } - else - { - _mm_storeu_si128((__m128i*)(ptr), v0); - _mm_storeu_si128((__m128i*)(ptr + 16), v1); - _mm_storeu_si128((__m128i*)(ptr + 32), v2); - } -} - -inline void v_store_interleave( uchar* ptr, const v_uint8x16& a, const v_uint8x16& b, - const v_uint8x16& c, const v_uint8x16& d, - hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - // a0 a1 a2 a3 .... - // b0 b1 b2 b3 .... - // c0 c1 c2 c3 .... - // d0 d1 d2 d3 .... - __m128i u0 = _mm_unpacklo_epi8(a.val, c.val); // a0 c0 a1 c1 ... - __m128i u1 = _mm_unpackhi_epi8(a.val, c.val); // a8 c8 a9 c9 ... - __m128i u2 = _mm_unpacklo_epi8(b.val, d.val); // b0 d0 b1 d1 ... - __m128i u3 = _mm_unpackhi_epi8(b.val, d.val); // b8 d8 b9 d9 ... - - __m128i v0 = _mm_unpacklo_epi8(u0, u2); // a0 b0 c0 d0 ... - __m128i v1 = _mm_unpackhi_epi8(u0, u2); // a4 b4 c4 d4 ... - __m128i v2 = _mm_unpacklo_epi8(u1, u3); // a8 b8 c8 d8 ... - __m128i v3 = _mm_unpackhi_epi8(u1, u3); // a12 b12 c12 d12 ... - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_si128((__m128i*)(ptr), v0); - _mm_stream_si128((__m128i*)(ptr + 16), v1); - _mm_stream_si128((__m128i*)(ptr + 32), v2); - _mm_stream_si128((__m128i*)(ptr + 48), v3); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_si128((__m128i*)(ptr), v0); - _mm_store_si128((__m128i*)(ptr + 16), v1); - _mm_store_si128((__m128i*)(ptr + 32), v2); - _mm_store_si128((__m128i*)(ptr + 48), v3); - } - else - { - _mm_storeu_si128((__m128i*)(ptr), v0); - _mm_storeu_si128((__m128i*)(ptr + 16), v1); - _mm_storeu_si128((__m128i*)(ptr + 32), v2); - _mm_storeu_si128((__m128i*)(ptr + 48), v3); - } -} - -inline void v_store_interleave( ushort* ptr, const v_uint16x8& a, const v_uint16x8& b, - hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - __m128i v0 = _mm_unpacklo_epi16(a.val, b.val); - __m128i v1 = _mm_unpackhi_epi16(a.val, b.val); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_si128((__m128i*)(ptr), v0); - _mm_stream_si128((__m128i*)(ptr + 8), v1); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_si128((__m128i*)(ptr), v0); - _mm_store_si128((__m128i*)(ptr + 8), v1); - } - else - { - _mm_storeu_si128((__m128i*)(ptr), v0); - _mm_storeu_si128((__m128i*)(ptr + 8), v1); - } -} - -inline void v_store_interleave( ushort* ptr, const v_uint16x8& a, - const v_uint16x8& b, const v_uint16x8& c, - hal::StoreMode mode = hal::STORE_UNALIGNED) -{ -#if CV_SSE4_1 - const __m128i sh_a = _mm_setr_epi8(0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, 4, 5, 10, 11); - const __m128i sh_b = _mm_setr_epi8(10, 11, 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15, 4, 5); - const __m128i sh_c = _mm_setr_epi8(4, 5, 10, 11, 0, 1, 6, 7, 12, 13, 2, 3, 8, 9, 14, 15); - __m128i a0 = _mm_shuffle_epi8(a.val, sh_a); - __m128i b0 = _mm_shuffle_epi8(b.val, sh_b); - __m128i c0 = _mm_shuffle_epi8(c.val, sh_c); - - __m128i v0 = _mm_blend_epi16(_mm_blend_epi16(a0, b0, 0x92), c0, 0x24); - __m128i v1 = _mm_blend_epi16(_mm_blend_epi16(c0, a0, 0x92), b0, 0x24); - __m128i v2 = _mm_blend_epi16(_mm_blend_epi16(b0, c0, 0x92), a0, 0x24); -#else - __m128i z = _mm_setzero_si128(); - __m128i ab0 = _mm_unpacklo_epi16(a.val, b.val); - __m128i ab1 = _mm_unpackhi_epi16(a.val, b.val); - __m128i c0 = _mm_unpacklo_epi16(c.val, z); - __m128i c1 = _mm_unpackhi_epi16(c.val, z); - - __m128i p10 = _mm_unpacklo_epi32(ab0, c0); - __m128i p11 = _mm_unpackhi_epi32(ab0, c0); - __m128i p12 = _mm_unpacklo_epi32(ab1, c1); - __m128i p13 = _mm_unpackhi_epi32(ab1, c1); - - __m128i p20 = _mm_unpacklo_epi64(p10, p11); - __m128i p21 = _mm_unpackhi_epi64(p10, p11); - __m128i p22 = _mm_unpacklo_epi64(p12, p13); - __m128i p23 = _mm_unpackhi_epi64(p12, p13); - - p20 = _mm_slli_si128(p20, 2); - p22 = _mm_slli_si128(p22, 2); - - __m128i p30 = _mm_unpacklo_epi64(p20, p21); - __m128i p31 = _mm_unpackhi_epi64(p20, p21); - __m128i p32 = _mm_unpacklo_epi64(p22, p23); - __m128i p33 = _mm_unpackhi_epi64(p22, p23); - - __m128i v0 = _mm_or_si128(_mm_srli_si128(p30, 2), _mm_slli_si128(p31, 10)); - __m128i v1 = _mm_or_si128(_mm_srli_si128(p31, 6), _mm_slli_si128(p32, 6)); - __m128i v2 = _mm_or_si128(_mm_srli_si128(p32, 10), _mm_slli_si128(p33, 2)); -#endif - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_si128((__m128i*)(ptr), v0); - _mm_stream_si128((__m128i*)(ptr + 8), v1); - _mm_stream_si128((__m128i*)(ptr + 16), v2); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_si128((__m128i*)(ptr), v0); - _mm_store_si128((__m128i*)(ptr + 8), v1); - _mm_store_si128((__m128i*)(ptr + 16), v2); - } - else - { - _mm_storeu_si128((__m128i*)(ptr), v0); - _mm_storeu_si128((__m128i*)(ptr + 8), v1); - _mm_storeu_si128((__m128i*)(ptr + 16), v2); - } -} - -inline void v_store_interleave( ushort* ptr, const v_uint16x8& a, const v_uint16x8& b, - const v_uint16x8& c, const v_uint16x8& d, - hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - // a0 a1 a2 a3 .... - // b0 b1 b2 b3 .... - // c0 c1 c2 c3 .... - // d0 d1 d2 d3 .... - __m128i u0 = _mm_unpacklo_epi16(a.val, c.val); // a0 c0 a1 c1 ... - __m128i u1 = _mm_unpackhi_epi16(a.val, c.val); // a4 c4 a5 c5 ... - __m128i u2 = _mm_unpacklo_epi16(b.val, d.val); // b0 d0 b1 d1 ... - __m128i u3 = _mm_unpackhi_epi16(b.val, d.val); // b4 d4 b5 d5 ... - - __m128i v0 = _mm_unpacklo_epi16(u0, u2); // a0 b0 c0 d0 ... - __m128i v1 = _mm_unpackhi_epi16(u0, u2); // a2 b2 c2 d2 ... - __m128i v2 = _mm_unpacklo_epi16(u1, u3); // a4 b4 c4 d4 ... - __m128i v3 = _mm_unpackhi_epi16(u1, u3); // a6 b6 c6 d6 ... - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_si128((__m128i*)(ptr), v0); - _mm_stream_si128((__m128i*)(ptr + 8), v1); - _mm_stream_si128((__m128i*)(ptr + 16), v2); - _mm_stream_si128((__m128i*)(ptr + 24), v3); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_si128((__m128i*)(ptr), v0); - _mm_store_si128((__m128i*)(ptr + 8), v1); - _mm_store_si128((__m128i*)(ptr + 16), v2); - _mm_store_si128((__m128i*)(ptr + 24), v3); - } - else - { - _mm_storeu_si128((__m128i*)(ptr), v0); - _mm_storeu_si128((__m128i*)(ptr + 8), v1); - _mm_storeu_si128((__m128i*)(ptr + 16), v2); - _mm_storeu_si128((__m128i*)(ptr + 24), v3); - } -} - -inline void v_store_interleave( unsigned* ptr, const v_uint32x4& a, const v_uint32x4& b, - hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - __m128i v0 = _mm_unpacklo_epi32(a.val, b.val); - __m128i v1 = _mm_unpackhi_epi32(a.val, b.val); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_si128((__m128i*)(ptr), v0); - _mm_stream_si128((__m128i*)(ptr + 4), v1); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_si128((__m128i*)(ptr), v0); - _mm_store_si128((__m128i*)(ptr + 4), v1); - } - else - { - _mm_storeu_si128((__m128i*)(ptr), v0); - _mm_storeu_si128((__m128i*)(ptr + 4), v1); - } -} - -inline void v_store_interleave( unsigned* ptr, const v_uint32x4& a, const v_uint32x4& b, - const v_uint32x4& c, hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - v_uint32x4 z = v_setzero_u32(), u0, u1, u2, u3; - v_transpose4x4(a, b, c, z, u0, u1, u2, u3); - - __m128i v0 = _mm_or_si128(u0.val, _mm_slli_si128(u1.val, 12)); - __m128i v1 = _mm_or_si128(_mm_srli_si128(u1.val, 4), _mm_slli_si128(u2.val, 8)); - __m128i v2 = _mm_or_si128(_mm_srli_si128(u2.val, 8), _mm_slli_si128(u3.val, 4)); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_si128((__m128i*)(ptr), v0); - _mm_stream_si128((__m128i*)(ptr + 4), v1); - _mm_stream_si128((__m128i*)(ptr + 8), v2); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_si128((__m128i*)(ptr), v0); - _mm_store_si128((__m128i*)(ptr + 4), v1); - _mm_store_si128((__m128i*)(ptr + 8), v2); - } - else - { - _mm_storeu_si128((__m128i*)(ptr), v0); - _mm_storeu_si128((__m128i*)(ptr + 4), v1); - _mm_storeu_si128((__m128i*)(ptr + 8), v2); - } -} - -inline void v_store_interleave(unsigned* ptr, const v_uint32x4& a, const v_uint32x4& b, - const v_uint32x4& c, const v_uint32x4& d, - hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - v_uint32x4 v0, v1, v2, v3; - v_transpose4x4(a, b, c, d, v0, v1, v2, v3); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_si128((__m128i*)(ptr), v0.val); - _mm_stream_si128((__m128i*)(ptr + 4), v1.val); - _mm_stream_si128((__m128i*)(ptr + 8), v2.val); - _mm_stream_si128((__m128i*)(ptr + 12), v3.val); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_si128((__m128i*)(ptr), v0.val); - _mm_store_si128((__m128i*)(ptr + 4), v1.val); - _mm_store_si128((__m128i*)(ptr + 8), v2.val); - _mm_store_si128((__m128i*)(ptr + 12), v3.val); - } - else - { - _mm_storeu_si128((__m128i*)(ptr), v0.val); - _mm_storeu_si128((__m128i*)(ptr + 4), v1.val); - _mm_storeu_si128((__m128i*)(ptr + 8), v2.val); - _mm_storeu_si128((__m128i*)(ptr + 12), v3.val); - } -} - -// 2-channel, float only -inline void v_store_interleave(float* ptr, const v_float32x4& a, const v_float32x4& b, - hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - __m128 v0 = _mm_unpacklo_ps(a.val, b.val); // a0 b0 a1 b1 - __m128 v1 = _mm_unpackhi_ps(a.val, b.val); // a2 b2 a3 b3 - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_ps(ptr, v0); - _mm_stream_ps(ptr + 4, v1); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_ps(ptr, v0); - _mm_store_ps(ptr + 4, v1); - } - else - { - _mm_storeu_ps(ptr, v0); - _mm_storeu_ps(ptr + 4, v1); - } -} - -inline void v_store_interleave(float* ptr, const v_float32x4& a, const v_float32x4& b, - const v_float32x4& c, hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - __m128 u0 = _mm_shuffle_ps(a.val, b.val, _MM_SHUFFLE(0, 0, 0, 0)); - __m128 u1 = _mm_shuffle_ps(c.val, a.val, _MM_SHUFFLE(1, 1, 0, 0)); - __m128 v0 = _mm_shuffle_ps(u0, u1, _MM_SHUFFLE(2, 0, 2, 0)); - __m128 u2 = _mm_shuffle_ps(b.val, c.val, _MM_SHUFFLE(1, 1, 1, 1)); - __m128 u3 = _mm_shuffle_ps(a.val, b.val, _MM_SHUFFLE(2, 2, 2, 2)); - __m128 v1 = _mm_shuffle_ps(u2, u3, _MM_SHUFFLE(2, 0, 2, 0)); - __m128 u4 = _mm_shuffle_ps(c.val, a.val, _MM_SHUFFLE(3, 3, 2, 2)); - __m128 u5 = _mm_shuffle_ps(b.val, c.val, _MM_SHUFFLE(3, 3, 3, 3)); - __m128 v2 = _mm_shuffle_ps(u4, u5, _MM_SHUFFLE(2, 0, 2, 0)); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_ps(ptr, v0); - _mm_stream_ps(ptr + 4, v1); - _mm_stream_ps(ptr + 8, v2); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_ps(ptr, v0); - _mm_store_ps(ptr + 4, v1); - _mm_store_ps(ptr + 8, v2); - } - else - { - _mm_storeu_ps(ptr, v0); - _mm_storeu_ps(ptr + 4, v1); - _mm_storeu_ps(ptr + 8, v2); - } -} - -inline void v_store_interleave(float* ptr, const v_float32x4& a, const v_float32x4& b, - const v_float32x4& c, const v_float32x4& d, - hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - __m128 u0 = _mm_unpacklo_ps(a.val, c.val); - __m128 u1 = _mm_unpacklo_ps(b.val, d.val); - __m128 u2 = _mm_unpackhi_ps(a.val, c.val); - __m128 u3 = _mm_unpackhi_ps(b.val, d.val); - __m128 v0 = _mm_unpacklo_ps(u0, u1); - __m128 v2 = _mm_unpacklo_ps(u2, u3); - __m128 v1 = _mm_unpackhi_ps(u0, u1); - __m128 v3 = _mm_unpackhi_ps(u2, u3); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_ps(ptr, v0); - _mm_stream_ps(ptr + 4, v1); - _mm_stream_ps(ptr + 8, v2); - _mm_stream_ps(ptr + 12, v3); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_ps(ptr, v0); - _mm_store_ps(ptr + 4, v1); - _mm_store_ps(ptr + 8, v2); - _mm_store_ps(ptr + 12, v3); - } - else - { - _mm_storeu_ps(ptr, v0); - _mm_storeu_ps(ptr + 4, v1); - _mm_storeu_ps(ptr + 8, v2); - _mm_storeu_ps(ptr + 12, v3); - } -} - -inline void v_store_interleave(uint64 *ptr, const v_uint64x2& a, const v_uint64x2& b, - hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - __m128i v0 = _mm_unpacklo_epi64(a.val, b.val); - __m128i v1 = _mm_unpackhi_epi64(a.val, b.val); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_si128((__m128i*)(ptr), v0); - _mm_stream_si128((__m128i*)(ptr + 2), v1); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_si128((__m128i*)(ptr), v0); - _mm_store_si128((__m128i*)(ptr + 2), v1); - } - else - { - _mm_storeu_si128((__m128i*)(ptr), v0); - _mm_storeu_si128((__m128i*)(ptr + 2), v1); - } -} - -inline void v_store_interleave(uint64 *ptr, const v_uint64x2& a, const v_uint64x2& b, - const v_uint64x2& c, hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - __m128i v0 = _mm_unpacklo_epi64(a.val, b.val); - __m128i v1 = _mm_unpacklo_epi64(c.val, _mm_unpackhi_epi64(a.val, a.val)); - __m128i v2 = _mm_unpackhi_epi64(b.val, c.val); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_si128((__m128i*)(ptr), v0); - _mm_stream_si128((__m128i*)(ptr + 2), v1); - _mm_stream_si128((__m128i*)(ptr + 4), v2); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_si128((__m128i*)(ptr), v0); - _mm_store_si128((__m128i*)(ptr + 2), v1); - _mm_store_si128((__m128i*)(ptr + 4), v2); - } - else - { - _mm_storeu_si128((__m128i*)(ptr), v0); - _mm_storeu_si128((__m128i*)(ptr + 2), v1); - _mm_storeu_si128((__m128i*)(ptr + 4), v2); - } -} - -inline void v_store_interleave(uint64 *ptr, const v_uint64x2& a, const v_uint64x2& b, - const v_uint64x2& c, const v_uint64x2& d, - hal::StoreMode mode = hal::STORE_UNALIGNED) -{ - __m128i v0 = _mm_unpacklo_epi64(a.val, b.val); - __m128i v1 = _mm_unpacklo_epi64(c.val, d.val); - __m128i v2 = _mm_unpackhi_epi64(a.val, b.val); - __m128i v3 = _mm_unpackhi_epi64(c.val, d.val); - - if( mode == hal::STORE_ALIGNED_NOCACHE ) - { - _mm_stream_si128((__m128i*)(ptr), v0); - _mm_stream_si128((__m128i*)(ptr + 2), v1); - _mm_stream_si128((__m128i*)(ptr + 4), v2); - _mm_stream_si128((__m128i*)(ptr + 6), v3); - } - else if( mode == hal::STORE_ALIGNED ) - { - _mm_store_si128((__m128i*)(ptr), v0); - _mm_store_si128((__m128i*)(ptr + 2), v1); - _mm_store_si128((__m128i*)(ptr + 4), v2); - _mm_store_si128((__m128i*)(ptr + 6), v3); - } - else - { - _mm_storeu_si128((__m128i*)(ptr), v0); - _mm_storeu_si128((__m128i*)(ptr + 2), v1); - _mm_storeu_si128((__m128i*)(ptr + 4), v2); - _mm_storeu_si128((__m128i*)(ptr + 6), v3); - } -} - -#define OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(_Tpvec0, _Tp0, suffix0, _Tpvec1, _Tp1, suffix1) \ -inline void v_load_deinterleave( const _Tp0* ptr, _Tpvec0& a0, _Tpvec0& b0 ) \ -{ \ - _Tpvec1 a1, b1; \ - v_load_deinterleave((const _Tp1*)ptr, a1, b1); \ - a0 = v_reinterpret_as_##suffix0(a1); \ - b0 = v_reinterpret_as_##suffix0(b1); \ -} \ -inline void v_load_deinterleave( const _Tp0* ptr, _Tpvec0& a0, _Tpvec0& b0, _Tpvec0& c0 ) \ -{ \ - _Tpvec1 a1, b1, c1; \ - v_load_deinterleave((const _Tp1*)ptr, a1, b1, c1); \ - a0 = v_reinterpret_as_##suffix0(a1); \ - b0 = v_reinterpret_as_##suffix0(b1); \ - c0 = v_reinterpret_as_##suffix0(c1); \ -} \ -inline void v_load_deinterleave( const _Tp0* ptr, _Tpvec0& a0, _Tpvec0& b0, _Tpvec0& c0, _Tpvec0& d0 ) \ -{ \ - _Tpvec1 a1, b1, c1, d1; \ - v_load_deinterleave((const _Tp1*)ptr, a1, b1, c1, d1); \ - a0 = v_reinterpret_as_##suffix0(a1); \ - b0 = v_reinterpret_as_##suffix0(b1); \ - c0 = v_reinterpret_as_##suffix0(c1); \ - d0 = v_reinterpret_as_##suffix0(d1); \ -} \ -inline void v_store_interleave( _Tp0* ptr, const _Tpvec0& a0, const _Tpvec0& b0, \ - hal::StoreMode mode = hal::STORE_UNALIGNED ) \ -{ \ - _Tpvec1 a1 = v_reinterpret_as_##suffix1(a0); \ - _Tpvec1 b1 = v_reinterpret_as_##suffix1(b0); \ - v_store_interleave((_Tp1*)ptr, a1, b1, mode); \ -} \ -inline void v_store_interleave( _Tp0* ptr, const _Tpvec0& a0, const _Tpvec0& b0, \ - const _Tpvec0& c0, hal::StoreMode mode = hal::STORE_UNALIGNED ) \ -{ \ - _Tpvec1 a1 = v_reinterpret_as_##suffix1(a0); \ - _Tpvec1 b1 = v_reinterpret_as_##suffix1(b0); \ - _Tpvec1 c1 = v_reinterpret_as_##suffix1(c0); \ - v_store_interleave((_Tp1*)ptr, a1, b1, c1, mode); \ -} \ -inline void v_store_interleave( _Tp0* ptr, const _Tpvec0& a0, const _Tpvec0& b0, \ - const _Tpvec0& c0, const _Tpvec0& d0, \ - hal::StoreMode mode = hal::STORE_UNALIGNED ) \ -{ \ - _Tpvec1 a1 = v_reinterpret_as_##suffix1(a0); \ - _Tpvec1 b1 = v_reinterpret_as_##suffix1(b0); \ - _Tpvec1 c1 = v_reinterpret_as_##suffix1(c0); \ - _Tpvec1 d1 = v_reinterpret_as_##suffix1(d0); \ - v_store_interleave((_Tp1*)ptr, a1, b1, c1, d1, mode); \ -} - -OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_int8x16, schar, s8, v_uint8x16, uchar, u8) -OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_int16x8, short, s16, v_uint16x8, ushort, u16) -OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_int32x4, int, s32, v_uint32x4, unsigned, u32) -OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_int64x2, int64, s64, v_uint64x2, uint64, u64) -OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_float64x2, double, f64, v_uint64x2, uint64, u64) - -inline v_float32x4 v_cvt_f32(const v_int32x4& a) -{ - return v_float32x4(_mm_cvtepi32_ps(a.val)); -} - -inline v_float32x4 v_cvt_f32(const v_float64x2& a) -{ - return v_float32x4(_mm_cvtpd_ps(a.val)); -} - -inline v_float32x4 v_cvt_f32(const v_float64x2& a, const v_float64x2& b) -{ - return v_float32x4(_mm_movelh_ps(_mm_cvtpd_ps(a.val), _mm_cvtpd_ps(b.val))); -} - -inline v_float64x2 v_cvt_f64(const v_int32x4& a) -{ - return v_float64x2(_mm_cvtepi32_pd(a.val)); -} - -inline v_float64x2 v_cvt_f64_high(const v_int32x4& a) -{ - return v_float64x2(_mm_cvtepi32_pd(_mm_srli_si128(a.val,8))); -} - -inline v_float64x2 v_cvt_f64(const v_float32x4& a) -{ - return v_float64x2(_mm_cvtps_pd(a.val)); -} - -inline v_float64x2 v_cvt_f64_high(const v_float32x4& a) -{ - return v_float64x2(_mm_cvtps_pd(_mm_movehl_ps(a.val, a.val))); -} - -#if CV_FP16 -inline v_float32x4 v128_load_fp16_f32(const short* ptr) -{ - return v_float32x4(_mm_cvtph_ps(_mm_loadu_si128((const __m128i*)ptr))); -} - -inline void v_store_fp16(short* ptr, const v_float32x4& a) -{ - __m128i fp16_value = _mm_cvtps_ph(a.val, 0); - _mm_storel_epi64((__m128i*)ptr, fp16_value); -} -#endif - -////////////// Lookup table access //////////////////// - -inline v_int8x16 v_lut(const schar* tab, const int* idx) -{ -#if defined(_MSC_VER) - return v_int8x16(_mm_setr_epi8(tab[idx[0]], tab[idx[1]], tab[idx[ 2]], tab[idx[ 3]], tab[idx[ 4]], tab[idx[ 5]], tab[idx[ 6]], tab[idx[ 7]], - tab[idx[8]], tab[idx[9]], tab[idx[10]], tab[idx[11]], tab[idx[12]], tab[idx[13]], tab[idx[14]], tab[idx[15]])); -#else - return v_int8x16(_mm_setr_epi64( - _mm_setr_pi8(tab[idx[0]], tab[idx[1]], tab[idx[ 2]], tab[idx[ 3]], tab[idx[ 4]], tab[idx[ 5]], tab[idx[ 6]], tab[idx[ 7]]), - _mm_setr_pi8(tab[idx[8]], tab[idx[9]], tab[idx[10]], tab[idx[11]], tab[idx[12]], tab[idx[13]], tab[idx[14]], tab[idx[15]]) - )); -#endif -} -inline v_int8x16 v_lut_pairs(const schar* tab, const int* idx) -{ -#if defined(_MSC_VER) - return v_int8x16(_mm_setr_epi16(*(const short*)(tab + idx[0]), *(const short*)(tab + idx[1]), *(const short*)(tab + idx[2]), *(const short*)(tab + idx[3]), - *(const short*)(tab + idx[4]), *(const short*)(tab + idx[5]), *(const short*)(tab + idx[6]), *(const short*)(tab + idx[7]))); -#else - return v_int8x16(_mm_setr_epi64( - _mm_setr_pi16(*(const short*)(tab + idx[0]), *(const short*)(tab + idx[1]), *(const short*)(tab + idx[2]), *(const short*)(tab + idx[3])), - _mm_setr_pi16(*(const short*)(tab + idx[4]), *(const short*)(tab + idx[5]), *(const short*)(tab + idx[6]), *(const short*)(tab + idx[7])) - )); -#endif -} -inline v_int8x16 v_lut_quads(const schar* tab, const int* idx) -{ -#if defined(_MSC_VER) - return v_int8x16(_mm_setr_epi32(*(const int*)(tab + idx[0]), *(const int*)(tab + idx[1]), - *(const int*)(tab + idx[2]), *(const int*)(tab + idx[3]))); -#else - return v_int8x16(_mm_setr_epi64( - _mm_setr_pi32(*(const int*)(tab + idx[0]), *(const int*)(tab + idx[1])), - _mm_setr_pi32(*(const int*)(tab + idx[2]), *(const int*)(tab + idx[3])) - )); -#endif -} -inline v_uint8x16 v_lut(const uchar* tab, const int* idx) { return v_reinterpret_as_u8(v_lut((const schar *)tab, idx)); } -inline v_uint8x16 v_lut_pairs(const uchar* tab, const int* idx) { return v_reinterpret_as_u8(v_lut_pairs((const schar *)tab, idx)); } -inline v_uint8x16 v_lut_quads(const uchar* tab, const int* idx) { return v_reinterpret_as_u8(v_lut_quads((const schar *)tab, idx)); } - -inline v_int16x8 v_lut(const short* tab, const int* idx) -{ -#if defined(_MSC_VER) - return v_int16x8(_mm_setr_epi16(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]], - tab[idx[4]], tab[idx[5]], tab[idx[6]], tab[idx[7]])); -#else - return v_int16x8(_mm_setr_epi64( - _mm_setr_pi16(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]]), - _mm_setr_pi16(tab[idx[4]], tab[idx[5]], tab[idx[6]], tab[idx[7]]) - )); -#endif -} -inline v_int16x8 v_lut_pairs(const short* tab, const int* idx) -{ -#if defined(_MSC_VER) - return v_int16x8(_mm_setr_epi32(*(const int*)(tab + idx[0]), *(const int*)(tab + idx[1]), - *(const int*)(tab + idx[2]), *(const int*)(tab + idx[3]))); -#else - return v_int16x8(_mm_setr_epi64( - _mm_setr_pi32(*(const int*)(tab + idx[0]), *(const int*)(tab + idx[1])), - _mm_setr_pi32(*(const int*)(tab + idx[2]), *(const int*)(tab + idx[3])) - )); -#endif -} -inline v_int16x8 v_lut_quads(const short* tab, const int* idx) -{ - return v_int16x8(_mm_set_epi64x(*(const int64_t*)(tab + idx[1]), *(const int64_t*)(tab + idx[0]))); -} -inline v_uint16x8 v_lut(const ushort* tab, const int* idx) { return v_reinterpret_as_u16(v_lut((const short *)tab, idx)); } -inline v_uint16x8 v_lut_pairs(const ushort* tab, const int* idx) { return v_reinterpret_as_u16(v_lut_pairs((const short *)tab, idx)); } -inline v_uint16x8 v_lut_quads(const ushort* tab, const int* idx) { return v_reinterpret_as_u16(v_lut_quads((const short *)tab, idx)); } - -inline v_int32x4 v_lut(const int* tab, const int* idx) -{ -#if defined(_MSC_VER) - return v_int32x4(_mm_setr_epi32(tab[idx[0]], tab[idx[1]], - tab[idx[2]], tab[idx[3]])); -#else - return v_int32x4(_mm_setr_epi64( - _mm_setr_pi32(tab[idx[0]], tab[idx[1]]), - _mm_setr_pi32(tab[idx[2]], tab[idx[3]]) - )); -#endif -} -inline v_int32x4 v_lut_pairs(const int* tab, const int* idx) -{ - return v_int32x4(_mm_set_epi64x(*(const int64_t*)(tab + idx[1]), *(const int64_t*)(tab + idx[0]))); -} -inline v_int32x4 v_lut_quads(const int* tab, const int* idx) -{ - return v_int32x4(_mm_loadu_si128((const __m128i*)(tab + idx[0]))); -} -inline v_uint32x4 v_lut(const unsigned* tab, const int* idx) { return v_reinterpret_as_u32(v_lut((const int *)tab, idx)); } -inline v_uint32x4 v_lut_pairs(const unsigned* tab, const int* idx) { return v_reinterpret_as_u32(v_lut_pairs((const int *)tab, idx)); } -inline v_uint32x4 v_lut_quads(const unsigned* tab, const int* idx) { return v_reinterpret_as_u32(v_lut_quads((const int *)tab, idx)); } - -inline v_int64x2 v_lut(const int64_t* tab, const int* idx) -{ - return v_int64x2(_mm_set_epi64x(tab[idx[1]], tab[idx[0]])); -} -inline v_int64x2 v_lut_pairs(const int64_t* tab, const int* idx) -{ - return v_int64x2(_mm_loadu_si128((const __m128i*)(tab + idx[0]))); -} -inline v_uint64x2 v_lut(const uint64_t* tab, const int* idx) { return v_reinterpret_as_u64(v_lut((const int64_t *)tab, idx)); } -inline v_uint64x2 v_lut_pairs(const uint64_t* tab, const int* idx) { return v_reinterpret_as_u64(v_lut_pairs((const int64_t *)tab, idx)); } - -inline v_float32x4 v_lut(const float* tab, const int* idx) -{ - return v_float32x4(_mm_setr_ps(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]])); -} -inline v_float32x4 v_lut_pairs(const float* tab, const int* idx) { return v_reinterpret_as_f32(v_lut_pairs((const int *)tab, idx)); } -inline v_float32x4 v_lut_quads(const float* tab, const int* idx) { return v_reinterpret_as_f32(v_lut_quads((const int *)tab, idx)); } - -inline v_float64x2 v_lut(const double* tab, const int* idx) -{ - return v_float64x2(_mm_setr_pd(tab[idx[0]], tab[idx[1]])); -} -inline v_float64x2 v_lut_pairs(const double* tab, const int* idx) { return v_float64x2(_mm_castsi128_pd(_mm_loadu_si128((const __m128i*)(tab + idx[0])))); } - -inline v_int32x4 v_lut(const int* tab, const v_int32x4& idxvec) -{ - int CV_DECL_ALIGNED(32) idx[4]; - v_store_aligned(idx, idxvec); - return v_int32x4(_mm_setr_epi32(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]])); -} - -inline v_uint32x4 v_lut(const unsigned* tab, const v_int32x4& idxvec) -{ - return v_reinterpret_as_u32(v_lut((const int *)tab, idxvec)); -} - -inline v_float32x4 v_lut(const float* tab, const v_int32x4& idxvec) -{ - int CV_DECL_ALIGNED(32) idx[4]; - v_store_aligned(idx, idxvec); - return v_float32x4(_mm_setr_ps(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]])); -} - -inline v_float64x2 v_lut(const double* tab, const v_int32x4& idxvec) -{ - int idx[2]; - v_store_low(idx, idxvec); - return v_float64x2(_mm_setr_pd(tab[idx[0]], tab[idx[1]])); -} - -// loads pairs from the table and deinterleaves them, e.g. returns: -// x = (tab[idxvec[0], tab[idxvec[1]], tab[idxvec[2]], tab[idxvec[3]]), -// y = (tab[idxvec[0]+1], tab[idxvec[1]+1], tab[idxvec[2]+1], tab[idxvec[3]+1]) -// note that the indices are float's indices, not the float-pair indices. -// in theory, this function can be used to implement bilinear interpolation, -// when idxvec are the offsets within the image. -inline void v_lut_deinterleave(const float* tab, const v_int32x4& idxvec, v_float32x4& x, v_float32x4& y) -{ - int CV_DECL_ALIGNED(32) idx[4]; - v_store_aligned(idx, idxvec); - __m128 z = _mm_setzero_ps(); - __m128 xy01 = _mm_loadl_pi(z, (__m64*)(tab + idx[0])); - __m128 xy23 = _mm_loadl_pi(z, (__m64*)(tab + idx[2])); - xy01 = _mm_loadh_pi(xy01, (__m64*)(tab + idx[1])); - xy23 = _mm_loadh_pi(xy23, (__m64*)(tab + idx[3])); - __m128 xxyy02 = _mm_unpacklo_ps(xy01, xy23); - __m128 xxyy13 = _mm_unpackhi_ps(xy01, xy23); - x = v_float32x4(_mm_unpacklo_ps(xxyy02, xxyy13)); - y = v_float32x4(_mm_unpackhi_ps(xxyy02, xxyy13)); -} - -inline void v_lut_deinterleave(const double* tab, const v_int32x4& idxvec, v_float64x2& x, v_float64x2& y) -{ - int idx[2]; - v_store_low(idx, idxvec); - __m128d xy0 = _mm_loadu_pd(tab + idx[0]); - __m128d xy1 = _mm_loadu_pd(tab + idx[1]); - x = v_float64x2(_mm_unpacklo_pd(xy0, xy1)); - y = v_float64x2(_mm_unpackhi_pd(xy0, xy1)); -} - -inline v_int8x16 v_interleave_pairs(const v_int8x16& vec) -{ -#if CV_SSSE3 - return v_int8x16(_mm_shuffle_epi8(vec.val, _mm_set_epi64x(0x0f0d0e0c0b090a08, 0x0705060403010200))); -#else - __m128i a = _mm_shufflelo_epi16(vec.val, _MM_SHUFFLE(3, 1, 2, 0)); - a = _mm_shufflehi_epi16(a, _MM_SHUFFLE(3, 1, 2, 0)); - a = _mm_shuffle_epi32(a, _MM_SHUFFLE(3, 1, 2, 0)); - return v_int8x16(_mm_unpacklo_epi8(a, _mm_unpackhi_epi64(a, a))); -#endif -} -inline v_uint8x16 v_interleave_pairs(const v_uint8x16& vec) { return v_reinterpret_as_u8(v_interleave_pairs(v_reinterpret_as_s8(vec))); } -inline v_int8x16 v_interleave_quads(const v_int8x16& vec) -{ -#if CV_SSSE3 - return v_int8x16(_mm_shuffle_epi8(vec.val, _mm_set_epi64x(0x0f0b0e0a0d090c08, 0x0703060205010400))); -#else - __m128i a = _mm_shuffle_epi32(vec.val, _MM_SHUFFLE(3, 1, 2, 0)); - return v_int8x16(_mm_unpacklo_epi8(a, _mm_unpackhi_epi64(a, a))); -#endif -} -inline v_uint8x16 v_interleave_quads(const v_uint8x16& vec) { return v_reinterpret_as_u8(v_interleave_quads(v_reinterpret_as_s8(vec))); } - -inline v_int16x8 v_interleave_pairs(const v_int16x8& vec) -{ -#if CV_SSSE3 - return v_int16x8(_mm_shuffle_epi8(vec.val, _mm_set_epi64x(0x0f0e0b0a0d0c0908, 0x0706030205040100))); -#else - __m128i a = _mm_shufflelo_epi16(vec.val, _MM_SHUFFLE(3, 1, 2, 0)); - return v_int16x8(_mm_shufflehi_epi16(a, _MM_SHUFFLE(3, 1, 2, 0))); -#endif -} -inline v_uint16x8 v_interleave_pairs(const v_uint16x8& vec) { return v_reinterpret_as_u16(v_interleave_pairs(v_reinterpret_as_s16(vec))); } -inline v_int16x8 v_interleave_quads(const v_int16x8& vec) -{ -#if CV_SSSE3 - return v_int16x8(_mm_shuffle_epi8(vec.val, _mm_set_epi64x(0x0f0e07060d0c0504, 0x0b0a030209080100))); -#else - return v_int16x8(_mm_unpacklo_epi16(vec.val, _mm_unpackhi_epi64(vec.val, vec.val))); -#endif -} -inline v_uint16x8 v_interleave_quads(const v_uint16x8& vec) { return v_reinterpret_as_u16(v_interleave_quads(v_reinterpret_as_s16(vec))); } - -inline v_int32x4 v_interleave_pairs(const v_int32x4& vec) -{ - return v_int32x4(_mm_shuffle_epi32(vec.val, _MM_SHUFFLE(3, 1, 2, 0))); -} -inline v_uint32x4 v_interleave_pairs(const v_uint32x4& vec) { return v_reinterpret_as_u32(v_interleave_pairs(v_reinterpret_as_s32(vec))); } -inline v_float32x4 v_interleave_pairs(const v_float32x4& vec) { return v_reinterpret_as_f32(v_interleave_pairs(v_reinterpret_as_s32(vec))); } - -inline v_int8x16 v_pack_triplets(const v_int8x16& vec) -{ -#if CV_SSSE3 - return v_int8x16(_mm_shuffle_epi8(vec.val, _mm_set_epi64x(0xffffff0f0e0d0c0a, 0x0908060504020100))); -#else - __m128i mask = _mm_set1_epi64x(0x00000000FFFFFFFF); - __m128i a = _mm_srli_si128(_mm_or_si128(_mm_andnot_si128(mask, vec.val), _mm_and_si128(mask, _mm_sll_epi32(vec.val, _mm_set_epi64x(0, 8)))), 1); - return v_int8x16(_mm_srli_si128(_mm_shufflelo_epi16(a, _MM_SHUFFLE(2, 1, 0, 3)), 2)); -#endif -} -inline v_uint8x16 v_pack_triplets(const v_uint8x16& vec) { return v_reinterpret_as_u8(v_pack_triplets(v_reinterpret_as_s8(vec))); } - -inline v_int16x8 v_pack_triplets(const v_int16x8& vec) -{ -#if CV_SSSE3 - return v_int16x8(_mm_shuffle_epi8(vec.val, _mm_set_epi64x(0xffff0f0e0d0c0b0a, 0x0908050403020100))); -#else - return v_int16x8(_mm_srli_si128(_mm_shufflelo_epi16(vec.val, _MM_SHUFFLE(2, 1, 0, 3)), 2)); -#endif -} -inline v_uint16x8 v_pack_triplets(const v_uint16x8& vec) { return v_reinterpret_as_u16(v_pack_triplets(v_reinterpret_as_s16(vec))); } - -inline v_int32x4 v_pack_triplets(const v_int32x4& vec) { return vec; } -inline v_uint32x4 v_pack_triplets(const v_uint32x4& vec) { return vec; } -inline v_float32x4 v_pack_triplets(const v_float32x4& vec) { return vec; } - -////////////// FP16 support /////////////////////////// - -inline v_float32x4 v_load_expand(const float16_t* ptr) -{ - const __m128i z = _mm_setzero_si128(), delta = _mm_set1_epi32(0x38000000); - const __m128i signmask = _mm_set1_epi32(0x80000000), maxexp = _mm_set1_epi32(0x7c000000); - const __m128 deltaf = _mm_castsi128_ps(_mm_set1_epi32(0x38800000)); - __m128i bits = _mm_unpacklo_epi16(z, _mm_loadl_epi64((const __m128i*)ptr)); // h << 16 - __m128i e = _mm_and_si128(bits, maxexp), sign = _mm_and_si128(bits, signmask); - __m128i t = _mm_add_epi32(_mm_srli_epi32(_mm_xor_si128(bits, sign), 3), delta); // ((h & 0x7fff) << 13) + delta - __m128i zt = _mm_castps_si128(_mm_sub_ps(_mm_castsi128_ps(_mm_add_epi32(t, _mm_set1_epi32(1 << 23))), deltaf)); - - t = _mm_add_epi32(t, _mm_and_si128(delta, _mm_cmpeq_epi32(maxexp, e))); - __m128i zmask = _mm_cmpeq_epi32(e, z); - __m128i ft = v_select_si128(zmask, zt, t); - return v_float32x4(_mm_castsi128_ps(_mm_or_si128(ft, sign))); -} - -inline void v_pack_store(float16_t* ptr, const v_float32x4& v) -{ - const __m128i signmask = _mm_set1_epi32(0x80000000); - const __m128i rval = _mm_set1_epi32(0x3f000000); - - __m128i t = _mm_castps_si128(v.val); - __m128i sign = _mm_srai_epi32(_mm_and_si128(t, signmask), 16); - t = _mm_andnot_si128(signmask, t); - - __m128i finitemask = _mm_cmpgt_epi32(_mm_set1_epi32(0x47800000), t); - __m128i isnan = _mm_cmpgt_epi32(t, _mm_set1_epi32(0x7f800000)); - __m128i naninf = v_select_si128(isnan, _mm_set1_epi32(0x7e00), _mm_set1_epi32(0x7c00)); - __m128i tinymask = _mm_cmpgt_epi32(_mm_set1_epi32(0x38800000), t); - __m128i tt = _mm_castps_si128(_mm_add_ps(_mm_castsi128_ps(t), _mm_castsi128_ps(rval))); - tt = _mm_sub_epi32(tt, rval); - __m128i odd = _mm_and_si128(_mm_srli_epi32(t, 13), _mm_set1_epi32(1)); - __m128i nt = _mm_add_epi32(t, _mm_set1_epi32(0xc8000fff)); - nt = _mm_srli_epi32(_mm_add_epi32(nt, odd), 13); - t = v_select_si128(tinymask, tt, nt); - t = v_select_si128(finitemask, t, naninf); - t = _mm_or_si128(t, sign); - t = _mm_packs_epi32(t, t); - _mm_storel_epi64((__m128i*)ptr, t); -} - -inline void v_cleanup() {} - -//! @name Check SIMD support -//! @{ -//! @brief Check CPU capability of SIMD operation -static inline bool hasSIMD128() -{ - return (CV_CPU_HAS_SUPPORT_SSE2) ? true : false; -} - -//! @} - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END - -//! @endcond - -} - -#endif diff --git a/opencv/include/opencv2/core/hal/intrin_sse_em.hpp b/opencv/include/opencv2/core/hal/intrin_sse_em.hpp deleted file mode 100644 index be27668..0000000 --- a/opencv/include/opencv2/core/hal/intrin_sse_em.hpp +++ /dev/null @@ -1,167 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html - -#ifndef OPENCV_HAL_INTRIN_SSE_EM_HPP -#define OPENCV_HAL_INTRIN_SSE_EM_HPP - -namespace cv -{ - -//! @cond IGNORED - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN - -#define OPENCV_HAL_SSE_WRAP_1(fun, tp) \ - inline tp _v128_##fun(const tp& a) \ - { return _mm_##fun(a); } - -#define OPENCV_HAL_SSE_WRAP_2(fun, tp) \ - inline tp _v128_##fun(const tp& a, const tp& b) \ - { return _mm_##fun(a, b); } - -#define OPENCV_HAL_SSE_WRAP_3(fun, tp) \ - inline tp _v128_##fun(const tp& a, const tp& b, const tp& c) \ - { return _mm_##fun(a, b, c); } - -///////////////////////////// XOP ///////////////////////////// - -// [todo] define CV_XOP -#if 1 // CV_XOP -inline __m128i _v128_comgt_epu32(const __m128i& a, const __m128i& b) -{ - const __m128i delta = _mm_set1_epi32((int)0x80000000); - return _mm_cmpgt_epi32(_mm_xor_si128(a, delta), _mm_xor_si128(b, delta)); -} -// wrapping XOP -#else -OPENCV_HAL_SSE_WRAP_2(_v128_comgt_epu32, __m128i) -#endif // !CV_XOP - -///////////////////////////// SSE4.1 ///////////////////////////// - -#if !CV_SSE4_1 - -/** Swizzle **/ -inline __m128i _v128_blendv_epi8(const __m128i& a, const __m128i& b, const __m128i& mask) -{ return _mm_xor_si128(a, _mm_and_si128(_mm_xor_si128(b, a), mask)); } - -/** Convert **/ -// 8 >> 16 -inline __m128i _v128_cvtepu8_epi16(const __m128i& a) -{ - const __m128i z = _mm_setzero_si128(); - return _mm_unpacklo_epi8(a, z); -} -inline __m128i _v128_cvtepi8_epi16(const __m128i& a) -{ return _mm_srai_epi16(_mm_unpacklo_epi8(a, a), 8); } -// 8 >> 32 -inline __m128i _v128_cvtepu8_epi32(const __m128i& a) -{ - const __m128i z = _mm_setzero_si128(); - return _mm_unpacklo_epi16(_mm_unpacklo_epi8(a, z), z); -} -inline __m128i _v128_cvtepi8_epi32(const __m128i& a) -{ - __m128i r = _mm_unpacklo_epi8(a, a); - r = _mm_unpacklo_epi8(r, r); - return _mm_srai_epi32(r, 24); -} -// 16 >> 32 -inline __m128i _v128_cvtepu16_epi32(const __m128i& a) -{ - const __m128i z = _mm_setzero_si128(); - return _mm_unpacklo_epi16(a, z); -} -inline __m128i _v128_cvtepi16_epi32(const __m128i& a) -{ return _mm_srai_epi32(_mm_unpacklo_epi16(a, a), 16); } -// 32 >> 64 -inline __m128i _v128_cvtepu32_epi64(const __m128i& a) -{ - const __m128i z = _mm_setzero_si128(); - return _mm_unpacklo_epi32(a, z); -} -inline __m128i _v128_cvtepi32_epi64(const __m128i& a) -{ return _mm_unpacklo_epi32(a, _mm_srai_epi32(a, 31)); } - -/** Arithmetic **/ -inline __m128i _v128_mullo_epi32(const __m128i& a, const __m128i& b) -{ - __m128i c0 = _mm_mul_epu32(a, b); - __m128i c1 = _mm_mul_epu32(_mm_srli_epi64(a, 32), _mm_srli_epi64(b, 32)); - __m128i d0 = _mm_unpacklo_epi32(c0, c1); - __m128i d1 = _mm_unpackhi_epi32(c0, c1); - return _mm_unpacklo_epi64(d0, d1); -} - -/** Math **/ -inline __m128i _v128_min_epu32(const __m128i& a, const __m128i& b) -{ return _v128_blendv_epi8(a, b, _v128_comgt_epu32(a, b)); } - -// wrapping SSE4.1 -#else -OPENCV_HAL_SSE_WRAP_1(cvtepu8_epi16, __m128i) -OPENCV_HAL_SSE_WRAP_1(cvtepi8_epi16, __m128i) -OPENCV_HAL_SSE_WRAP_1(cvtepu8_epi32, __m128i) -OPENCV_HAL_SSE_WRAP_1(cvtepi8_epi32, __m128i) -OPENCV_HAL_SSE_WRAP_1(cvtepu16_epi32, __m128i) -OPENCV_HAL_SSE_WRAP_1(cvtepi16_epi32, __m128i) -OPENCV_HAL_SSE_WRAP_1(cvtepu32_epi64, __m128i) -OPENCV_HAL_SSE_WRAP_1(cvtepi32_epi64, __m128i) -OPENCV_HAL_SSE_WRAP_2(min_epu32, __m128i) -OPENCV_HAL_SSE_WRAP_2(mullo_epi32, __m128i) -OPENCV_HAL_SSE_WRAP_3(blendv_epi8, __m128i) -#endif // !CV_SSE4_1 - -///////////////////////////// Revolutionary ///////////////////////////// - -/** Convert **/ -// 16 << 8 -inline __m128i _v128_cvtepu8_epi16_high(const __m128i& a) -{ - const __m128i z = _mm_setzero_si128(); - return _mm_unpackhi_epi8(a, z); -} -inline __m128i _v128_cvtepi8_epi16_high(const __m128i& a) -{ return _mm_srai_epi16(_mm_unpackhi_epi8(a, a), 8); } -// 32 << 16 -inline __m128i _v128_cvtepu16_epi32_high(const __m128i& a) -{ - const __m128i z = _mm_setzero_si128(); - return _mm_unpackhi_epi16(a, z); -} -inline __m128i _v128_cvtepi16_epi32_high(const __m128i& a) -{ return _mm_srai_epi32(_mm_unpackhi_epi16(a, a), 16); } -// 64 << 32 -inline __m128i _v128_cvtepu32_epi64_high(const __m128i& a) -{ - const __m128i z = _mm_setzero_si128(); - return _mm_unpackhi_epi32(a, z); -} -inline __m128i _v128_cvtepi32_epi64_high(const __m128i& a) -{ return _mm_unpackhi_epi32(a, _mm_srai_epi32(a, 31)); } - -/** Miscellaneous **/ -inline __m128i _v128_packs_epu32(const __m128i& a, const __m128i& b) -{ - const __m128i m = _mm_set1_epi32(65535); - __m128i am = _v128_min_epu32(a, m); - __m128i bm = _v128_min_epu32(b, m); -#if CV_SSE4_1 - return _mm_packus_epi32(am, bm); -#else - const __m128i d = _mm_set1_epi32(32768), nd = _mm_set1_epi16(-32768); - am = _mm_sub_epi32(am, d); - bm = _mm_sub_epi32(bm, d); - am = _mm_packs_epi32(am, bm); - return _mm_sub_epi16(am, nd); -#endif -} - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END - -//! @endcond - -} // cv:: - -#endif // OPENCV_HAL_INTRIN_SSE_EM_HPP \ No newline at end of file diff --git a/opencv/include/opencv2/core/hal/intrin_vsx.hpp b/opencv/include/opencv2/core/hal/intrin_vsx.hpp deleted file mode 100644 index c5ceb11..0000000 --- a/opencv/include/opencv2/core/hal/intrin_vsx.hpp +++ /dev/null @@ -1,1328 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html - -#ifndef OPENCV_HAL_VSX_HPP -#define OPENCV_HAL_VSX_HPP - -#include -#include "opencv2/core/utility.hpp" - -#define CV_SIMD128 1 -#define CV_SIMD128_64F 1 - -namespace cv -{ - -//! @cond IGNORED - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN - -///////// Types //////////// - -struct v_uint8x16 -{ - typedef uchar lane_type; - enum { nlanes = 16 }; - vec_uchar16 val; - - explicit v_uint8x16(const vec_uchar16& v) : val(v) - {} - v_uint8x16() : val(vec_uchar16_z) - {} - v_uint8x16(vec_bchar16 v) : val(vec_uchar16_c(v)) - {} - v_uint8x16(uchar v0, uchar v1, uchar v2, uchar v3, uchar v4, uchar v5, uchar v6, uchar v7, - uchar v8, uchar v9, uchar v10, uchar v11, uchar v12, uchar v13, uchar v14, uchar v15) - : val(vec_uchar16_set(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15)) - {} - uchar get0() const - { return vec_extract(val, 0); } -}; - -struct v_int8x16 -{ - typedef schar lane_type; - enum { nlanes = 16 }; - vec_char16 val; - - explicit v_int8x16(const vec_char16& v) : val(v) - {} - v_int8x16() : val(vec_char16_z) - {} - v_int8x16(vec_bchar16 v) : val(vec_char16_c(v)) - {} - v_int8x16(schar v0, schar v1, schar v2, schar v3, schar v4, schar v5, schar v6, schar v7, - schar v8, schar v9, schar v10, schar v11, schar v12, schar v13, schar v14, schar v15) - : val(vec_char16_set(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15)) - {} - schar get0() const - { return vec_extract(val, 0); } -}; - -struct v_uint16x8 -{ - typedef ushort lane_type; - enum { nlanes = 8 }; - vec_ushort8 val; - - explicit v_uint16x8(const vec_ushort8& v) : val(v) - {} - v_uint16x8() : val(vec_ushort8_z) - {} - v_uint16x8(vec_bshort8 v) : val(vec_ushort8_c(v)) - {} - v_uint16x8(ushort v0, ushort v1, ushort v2, ushort v3, ushort v4, ushort v5, ushort v6, ushort v7) - : val(vec_ushort8_set(v0, v1, v2, v3, v4, v5, v6, v7)) - {} - ushort get0() const - { return vec_extract(val, 0); } -}; - -struct v_int16x8 -{ - typedef short lane_type; - enum { nlanes = 8 }; - vec_short8 val; - - explicit v_int16x8(const vec_short8& v) : val(v) - {} - v_int16x8() : val(vec_short8_z) - {} - v_int16x8(vec_bshort8 v) : val(vec_short8_c(v)) - {} - v_int16x8(short v0, short v1, short v2, short v3, short v4, short v5, short v6, short v7) - : val(vec_short8_set(v0, v1, v2, v3, v4, v5, v6, v7)) - {} - short get0() const - { return vec_extract(val, 0); } -}; - -struct v_uint32x4 -{ - typedef unsigned lane_type; - enum { nlanes = 4 }; - vec_uint4 val; - - explicit v_uint32x4(const vec_uint4& v) : val(v) - {} - v_uint32x4() : val(vec_uint4_z) - {} - v_uint32x4(vec_bint4 v) : val(vec_uint4_c(v)) - {} - v_uint32x4(unsigned v0, unsigned v1, unsigned v2, unsigned v3) : val(vec_uint4_set(v0, v1, v2, v3)) - {} - uint get0() const - { return vec_extract(val, 0); } -}; - -struct v_int32x4 -{ - typedef int lane_type; - enum { nlanes = 4 }; - vec_int4 val; - - explicit v_int32x4(const vec_int4& v) : val(v) - {} - v_int32x4() : val(vec_int4_z) - {} - v_int32x4(vec_bint4 v) : val(vec_int4_c(v)) - {} - v_int32x4(int v0, int v1, int v2, int v3) : val(vec_int4_set(v0, v1, v2, v3)) - {} - int get0() const - { return vec_extract(val, 0); } -}; - -struct v_float32x4 -{ - typedef float lane_type; - enum { nlanes = 4 }; - vec_float4 val; - - explicit v_float32x4(const vec_float4& v) : val(v) - {} - v_float32x4() : val(vec_float4_z) - {} - v_float32x4(vec_bint4 v) : val(vec_float4_c(v)) - {} - v_float32x4(float v0, float v1, float v2, float v3) : val(vec_float4_set(v0, v1, v2, v3)) - {} - float get0() const - { return vec_extract(val, 0); } -}; - -struct v_uint64x2 -{ - typedef uint64 lane_type; - enum { nlanes = 2 }; - vec_udword2 val; - - explicit v_uint64x2(const vec_udword2& v) : val(v) - {} - v_uint64x2() : val(vec_udword2_z) - {} - v_uint64x2(vec_bdword2 v) : val(vec_udword2_c(v)) - {} - v_uint64x2(uint64 v0, uint64 v1) : val(vec_udword2_set(v0, v1)) - {} - uint64 get0() const - { return vec_extract(val, 0); } -}; - -struct v_int64x2 -{ - typedef int64 lane_type; - enum { nlanes = 2 }; - vec_dword2 val; - - explicit v_int64x2(const vec_dword2& v) : val(v) - {} - v_int64x2() : val(vec_dword2_z) - {} - v_int64x2(vec_bdword2 v) : val(vec_dword2_c(v)) - {} - v_int64x2(int64 v0, int64 v1) : val(vec_dword2_set(v0, v1)) - {} - int64 get0() const - { return vec_extract(val, 0); } -}; - -struct v_float64x2 -{ - typedef double lane_type; - enum { nlanes = 2 }; - vec_double2 val; - - explicit v_float64x2(const vec_double2& v) : val(v) - {} - v_float64x2() : val(vec_double2_z) - {} - v_float64x2(vec_bdword2 v) : val(vec_double2_c(v)) - {} - v_float64x2(double v0, double v1) : val(vec_double2_set(v0, v1)) - {} - double get0() const - { return vec_extract(val, 0); } -}; - -//////////////// Load and store operations /////////////// - -/* - * clang-5 aborted during parse "vec_xxx_c" only if it's - * inside a function template which is defined by preprocessor macro. - * - * if vec_xxx_c defined as C++ cast, clang-5 will pass it -*/ -#define OPENCV_HAL_IMPL_VSX_INITVEC(_Tpvec, _Tp, suffix, cast) \ -inline _Tpvec v_setzero_##suffix() { return _Tpvec(); } \ -inline _Tpvec v_setall_##suffix(_Tp v) { return _Tpvec(vec_splats((_Tp)v));} \ -template inline _Tpvec v_reinterpret_as_##suffix(const _Tpvec0 &a) \ -{ return _Tpvec((cast)a.val); } - -OPENCV_HAL_IMPL_VSX_INITVEC(v_uint8x16, uchar, u8, vec_uchar16) -OPENCV_HAL_IMPL_VSX_INITVEC(v_int8x16, schar, s8, vec_char16) -OPENCV_HAL_IMPL_VSX_INITVEC(v_uint16x8, ushort, u16, vec_ushort8) -OPENCV_HAL_IMPL_VSX_INITVEC(v_int16x8, short, s16, vec_short8) -OPENCV_HAL_IMPL_VSX_INITVEC(v_uint32x4, uint, u32, vec_uint4) -OPENCV_HAL_IMPL_VSX_INITVEC(v_int32x4, int, s32, vec_int4) -OPENCV_HAL_IMPL_VSX_INITVEC(v_uint64x2, uint64, u64, vec_udword2) -OPENCV_HAL_IMPL_VSX_INITVEC(v_int64x2, int64, s64, vec_dword2) -OPENCV_HAL_IMPL_VSX_INITVEC(v_float32x4, float, f32, vec_float4) -OPENCV_HAL_IMPL_VSX_INITVEC(v_float64x2, double, f64, vec_double2) - -#define OPENCV_HAL_IMPL_VSX_LOADSTORE_C(_Tpvec, _Tp, ld, ld_a, st, st_a) \ -inline _Tpvec v_load(const _Tp* ptr) \ -{ return _Tpvec(ld(0, ptr)); } \ -inline _Tpvec v_load_aligned(VSX_UNUSED(const _Tp* ptr)) \ -{ return _Tpvec(ld_a(0, ptr)); } \ -inline _Tpvec v_load_low(const _Tp* ptr) \ -{ return _Tpvec(vec_ld_l8(ptr)); } \ -inline _Tpvec v_load_halves(const _Tp* ptr0, const _Tp* ptr1) \ -{ return _Tpvec(vec_mergesqh(vec_ld_l8(ptr0), vec_ld_l8(ptr1))); } \ -inline void v_store(_Tp* ptr, const _Tpvec& a) \ -{ st(a.val, 0, ptr); } \ -inline void v_store_aligned(VSX_UNUSED(_Tp* ptr), const _Tpvec& a) \ -{ st_a(a.val, 0, ptr); } \ -inline void v_store_aligned_nocache(VSX_UNUSED(_Tp* ptr), const _Tpvec& a) \ -{ st_a(a.val, 0, ptr); } \ -inline void v_store(_Tp* ptr, const _Tpvec& a, hal::StoreMode mode) \ -{ if(mode == hal::STORE_UNALIGNED) st(a.val, 0, ptr); else st_a(a.val, 0, ptr); } \ -inline void v_store_low(_Tp* ptr, const _Tpvec& a) \ -{ vec_st_l8(a.val, ptr); } \ -inline void v_store_high(_Tp* ptr, const _Tpvec& a) \ -{ vec_st_h8(a.val, ptr); } - -// working around gcc bug for aligned ld/st -// if runtime check for vec_ld/st fail we failback to unaligned ld/st -// https://github.com/opencv/opencv/issues/13211 -#ifdef CV_COMPILER_VSX_BROKEN_ALIGNED - #define OPENCV_HAL_IMPL_VSX_LOADSTORE(_Tpvec, _Tp) \ - OPENCV_HAL_IMPL_VSX_LOADSTORE_C(_Tpvec, _Tp, vsx_ld, vsx_ld, vsx_st, vsx_st) -#else - #define OPENCV_HAL_IMPL_VSX_LOADSTORE(_Tpvec, _Tp) \ - OPENCV_HAL_IMPL_VSX_LOADSTORE_C(_Tpvec, _Tp, vsx_ld, vec_ld, vsx_st, vec_st) -#endif - -OPENCV_HAL_IMPL_VSX_LOADSTORE(v_uint8x16, uchar) -OPENCV_HAL_IMPL_VSX_LOADSTORE(v_int8x16, schar) -OPENCV_HAL_IMPL_VSX_LOADSTORE(v_uint16x8, ushort) -OPENCV_HAL_IMPL_VSX_LOADSTORE(v_int16x8, short) -OPENCV_HAL_IMPL_VSX_LOADSTORE(v_uint32x4, uint) -OPENCV_HAL_IMPL_VSX_LOADSTORE(v_int32x4, int) -OPENCV_HAL_IMPL_VSX_LOADSTORE(v_float32x4, float) - -OPENCV_HAL_IMPL_VSX_LOADSTORE_C(v_float64x2, double, vsx_ld, vsx_ld, vsx_st, vsx_st) -OPENCV_HAL_IMPL_VSX_LOADSTORE_C(v_uint64x2, uint64, vsx_ld2, vsx_ld2, vsx_st2, vsx_st2) -OPENCV_HAL_IMPL_VSX_LOADSTORE_C(v_int64x2, int64, vsx_ld2, vsx_ld2, vsx_st2, vsx_st2) - -//////////////// Value reordering /////////////// - -/* de&interleave */ -#define OPENCV_HAL_IMPL_VSX_INTERLEAVE(_Tp, _Tpvec) \ -inline void v_load_deinterleave(const _Tp* ptr, _Tpvec& a, _Tpvec& b) \ -{ vec_ld_deinterleave(ptr, a.val, b.val);} \ -inline void v_load_deinterleave(const _Tp* ptr, _Tpvec& a, \ - _Tpvec& b, _Tpvec& c) \ -{ vec_ld_deinterleave(ptr, a.val, b.val, c.val); } \ -inline void v_load_deinterleave(const _Tp* ptr, _Tpvec& a, _Tpvec& b, \ - _Tpvec& c, _Tpvec& d) \ -{ vec_ld_deinterleave(ptr, a.val, b.val, c.val, d.val); } \ -inline void v_store_interleave(_Tp* ptr, const _Tpvec& a, const _Tpvec& b, \ - hal::StoreMode /*mode*/=hal::STORE_UNALIGNED) \ -{ vec_st_interleave(a.val, b.val, ptr); } \ -inline void v_store_interleave(_Tp* ptr, const _Tpvec& a, \ - const _Tpvec& b, const _Tpvec& c, \ - hal::StoreMode /*mode*/=hal::STORE_UNALIGNED) \ -{ vec_st_interleave(a.val, b.val, c.val, ptr); } \ -inline void v_store_interleave(_Tp* ptr, const _Tpvec& a, const _Tpvec& b, \ - const _Tpvec& c, const _Tpvec& d, \ - hal::StoreMode /*mode*/=hal::STORE_UNALIGNED) \ -{ vec_st_interleave(a.val, b.val, c.val, d.val, ptr); } - -OPENCV_HAL_IMPL_VSX_INTERLEAVE(uchar, v_uint8x16) -OPENCV_HAL_IMPL_VSX_INTERLEAVE(schar, v_int8x16) -OPENCV_HAL_IMPL_VSX_INTERLEAVE(ushort, v_uint16x8) -OPENCV_HAL_IMPL_VSX_INTERLEAVE(short, v_int16x8) -OPENCV_HAL_IMPL_VSX_INTERLEAVE(uint, v_uint32x4) -OPENCV_HAL_IMPL_VSX_INTERLEAVE(int, v_int32x4) -OPENCV_HAL_IMPL_VSX_INTERLEAVE(float, v_float32x4) -OPENCV_HAL_IMPL_VSX_INTERLEAVE(double, v_float64x2) -OPENCV_HAL_IMPL_VSX_INTERLEAVE(int64, v_int64x2) -OPENCV_HAL_IMPL_VSX_INTERLEAVE(uint64, v_uint64x2) - -/* Expand */ -#define OPENCV_HAL_IMPL_VSX_EXPAND(_Tpvec, _Tpwvec, _Tp, fl, fh) \ -inline void v_expand(const _Tpvec& a, _Tpwvec& b0, _Tpwvec& b1) \ -{ \ - b0.val = fh(a.val); \ - b1.val = fl(a.val); \ -} \ -inline _Tpwvec v_expand_low(const _Tpvec& a) \ -{ return _Tpwvec(fh(a.val)); } \ -inline _Tpwvec v_expand_high(const _Tpvec& a) \ -{ return _Tpwvec(fl(a.val)); } \ -inline _Tpwvec v_load_expand(const _Tp* ptr) \ -{ return _Tpwvec(fh(vec_ld_l8(ptr))); } - -OPENCV_HAL_IMPL_VSX_EXPAND(v_uint8x16, v_uint16x8, uchar, vec_unpacklu, vec_unpackhu) -OPENCV_HAL_IMPL_VSX_EXPAND(v_int8x16, v_int16x8, schar, vec_unpackl, vec_unpackh) -OPENCV_HAL_IMPL_VSX_EXPAND(v_uint16x8, v_uint32x4, ushort, vec_unpacklu, vec_unpackhu) -OPENCV_HAL_IMPL_VSX_EXPAND(v_int16x8, v_int32x4, short, vec_unpackl, vec_unpackh) -OPENCV_HAL_IMPL_VSX_EXPAND(v_uint32x4, v_uint64x2, uint, vec_unpacklu, vec_unpackhu) -OPENCV_HAL_IMPL_VSX_EXPAND(v_int32x4, v_int64x2, int, vec_unpackl, vec_unpackh) - -inline v_uint32x4 v_load_expand_q(const uchar* ptr) -{ return v_uint32x4(vec_uint4_set(ptr[0], ptr[1], ptr[2], ptr[3])); } - -inline v_int32x4 v_load_expand_q(const schar* ptr) -{ return v_int32x4(vec_int4_set(ptr[0], ptr[1], ptr[2], ptr[3])); } - -/* pack */ -#define OPENCV_HAL_IMPL_VSX_PACK(_Tpvec, _Tp, _Tpwvec, _Tpvn, _Tpdel, sfnc, pkfnc, addfnc, pack) \ -inline _Tpvec v_##pack(const _Tpwvec& a, const _Tpwvec& b) \ -{ \ - return _Tpvec(pkfnc(a.val, b.val)); \ -} \ -inline void v_##pack##_store(_Tp* ptr, const _Tpwvec& a) \ -{ \ - vec_st_l8(pkfnc(a.val, a.val), ptr); \ -} \ -template \ -inline _Tpvec v_rshr_##pack(const _Tpwvec& a, const _Tpwvec& b) \ -{ \ - const __vector _Tpvn vn = vec_splats((_Tpvn)n); \ - const __vector _Tpdel delta = vec_splats((_Tpdel)((_Tpdel)1 << (n-1))); \ - return _Tpvec(pkfnc(sfnc(addfnc(a.val, delta), vn), sfnc(addfnc(b.val, delta), vn))); \ -} \ -template \ -inline void v_rshr_##pack##_store(_Tp* ptr, const _Tpwvec& a) \ -{ \ - const __vector _Tpvn vn = vec_splats((_Tpvn)n); \ - const __vector _Tpdel delta = vec_splats((_Tpdel)((_Tpdel)1 << (n-1))); \ - vec_st_l8(pkfnc(sfnc(addfnc(a.val, delta), vn), delta), ptr); \ -} - -OPENCV_HAL_IMPL_VSX_PACK(v_uint8x16, uchar, v_uint16x8, unsigned short, unsigned short, - vec_sr, vec_packs, vec_adds, pack) -OPENCV_HAL_IMPL_VSX_PACK(v_int8x16, schar, v_int16x8, unsigned short, short, - vec_sra, vec_packs, vec_adds, pack) - -OPENCV_HAL_IMPL_VSX_PACK(v_uint16x8, ushort, v_uint32x4, unsigned int, unsigned int, - vec_sr, vec_packs, vec_add, pack) -OPENCV_HAL_IMPL_VSX_PACK(v_int16x8, short, v_int32x4, unsigned int, int, - vec_sra, vec_packs, vec_add, pack) - -OPENCV_HAL_IMPL_VSX_PACK(v_uint32x4, uint, v_uint64x2, unsigned long long, unsigned long long, - vec_sr, vec_pack, vec_add, pack) -OPENCV_HAL_IMPL_VSX_PACK(v_int32x4, int, v_int64x2, unsigned long long, long long, - vec_sra, vec_pack, vec_add, pack) - -OPENCV_HAL_IMPL_VSX_PACK(v_uint8x16, uchar, v_int16x8, unsigned short, short, - vec_sra, vec_packsu, vec_adds, pack_u) -OPENCV_HAL_IMPL_VSX_PACK(v_uint16x8, ushort, v_int32x4, unsigned int, int, - vec_sra, vec_packsu, vec_add, pack_u) -// Following variant is not implemented on other platforms: -//OPENCV_HAL_IMPL_VSX_PACK(v_uint32x4, uint, v_int64x2, unsigned long long, long long, -// vec_sra, vec_packsu, vec_add, pack_u) - -// pack boolean -inline v_uint8x16 v_pack_b(const v_uint16x8& a, const v_uint16x8& b) -{ - vec_uchar16 ab = vec_pack(a.val, b.val); - return v_uint8x16(ab); -} - -inline v_uint8x16 v_pack_b(const v_uint32x4& a, const v_uint32x4& b, - const v_uint32x4& c, const v_uint32x4& d) -{ - vec_ushort8 ab = vec_pack(a.val, b.val); - vec_ushort8 cd = vec_pack(c.val, d.val); - return v_uint8x16(vec_pack(ab, cd)); -} - -inline v_uint8x16 v_pack_b(const v_uint64x2& a, const v_uint64x2& b, const v_uint64x2& c, - const v_uint64x2& d, const v_uint64x2& e, const v_uint64x2& f, - const v_uint64x2& g, const v_uint64x2& h) -{ - vec_uint4 ab = vec_pack(a.val, b.val); - vec_uint4 cd = vec_pack(c.val, d.val); - vec_uint4 ef = vec_pack(e.val, f.val); - vec_uint4 gh = vec_pack(g.val, h.val); - - vec_ushort8 abcd = vec_pack(ab, cd); - vec_ushort8 efgh = vec_pack(ef, gh); - return v_uint8x16(vec_pack(abcd, efgh)); -} - -/* Recombine */ -template -inline void v_zip(const _Tpvec& a0, const _Tpvec& a1, _Tpvec& b0, _Tpvec& b1) -{ - b0.val = vec_mergeh(a0.val, a1.val); - b1.val = vec_mergel(a0.val, a1.val); -} - -template -inline _Tpvec v_combine_high(const _Tpvec& a, const _Tpvec& b) -{ return _Tpvec(vec_mergesql(a.val, b.val)); } - -template -inline _Tpvec v_combine_low(const _Tpvec& a, const _Tpvec& b) -{ return _Tpvec(vec_mergesqh(a.val, b.val)); } - -template -inline void v_recombine(const _Tpvec& a, const _Tpvec& b, _Tpvec& c, _Tpvec& d) -{ - c.val = vec_mergesqh(a.val, b.val); - d.val = vec_mergesql(a.val, b.val); -} - -////////// Arithmetic, bitwise and comparison operations ///////// - -/* Element-wise binary and unary operations */ -/** Arithmetics **/ -#define OPENCV_HAL_IMPL_VSX_BIN_OP(bin_op, _Tpvec, intrin) \ -inline _Tpvec operator bin_op (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(intrin(a.val, b.val)); } \ -inline _Tpvec& operator bin_op##= (_Tpvec& a, const _Tpvec& b) \ -{ a.val = intrin(a.val, b.val); return a; } - -OPENCV_HAL_IMPL_VSX_BIN_OP(+, v_uint8x16, vec_adds) -OPENCV_HAL_IMPL_VSX_BIN_OP(-, v_uint8x16, vec_subs) -OPENCV_HAL_IMPL_VSX_BIN_OP(+, v_int8x16, vec_adds) -OPENCV_HAL_IMPL_VSX_BIN_OP(-, v_int8x16, vec_subs) -OPENCV_HAL_IMPL_VSX_BIN_OP(+, v_uint16x8, vec_adds) -OPENCV_HAL_IMPL_VSX_BIN_OP(-, v_uint16x8, vec_subs) -OPENCV_HAL_IMPL_VSX_BIN_OP(+, v_int16x8, vec_adds) -OPENCV_HAL_IMPL_VSX_BIN_OP(-, v_int16x8, vec_subs) -OPENCV_HAL_IMPL_VSX_BIN_OP(+, v_uint32x4, vec_add) -OPENCV_HAL_IMPL_VSX_BIN_OP(-, v_uint32x4, vec_sub) -OPENCV_HAL_IMPL_VSX_BIN_OP(*, v_uint32x4, vec_mul) -OPENCV_HAL_IMPL_VSX_BIN_OP(+, v_int32x4, vec_add) -OPENCV_HAL_IMPL_VSX_BIN_OP(-, v_int32x4, vec_sub) -OPENCV_HAL_IMPL_VSX_BIN_OP(*, v_int32x4, vec_mul) -OPENCV_HAL_IMPL_VSX_BIN_OP(+, v_float32x4, vec_add) -OPENCV_HAL_IMPL_VSX_BIN_OP(-, v_float32x4, vec_sub) -OPENCV_HAL_IMPL_VSX_BIN_OP(*, v_float32x4, vec_mul) -OPENCV_HAL_IMPL_VSX_BIN_OP(/, v_float32x4, vec_div) -OPENCV_HAL_IMPL_VSX_BIN_OP(+, v_float64x2, vec_add) -OPENCV_HAL_IMPL_VSX_BIN_OP(-, v_float64x2, vec_sub) -OPENCV_HAL_IMPL_VSX_BIN_OP(*, v_float64x2, vec_mul) -OPENCV_HAL_IMPL_VSX_BIN_OP(/, v_float64x2, vec_div) -OPENCV_HAL_IMPL_VSX_BIN_OP(+, v_uint64x2, vec_add) -OPENCV_HAL_IMPL_VSX_BIN_OP(-, v_uint64x2, vec_sub) -OPENCV_HAL_IMPL_VSX_BIN_OP(+, v_int64x2, vec_add) -OPENCV_HAL_IMPL_VSX_BIN_OP(-, v_int64x2, vec_sub) - -// saturating multiply -#define OPENCV_HAL_IMPL_VSX_MUL_SAT(_Tpvec, _Tpwvec) \ - inline _Tpvec operator * (const _Tpvec& a, const _Tpvec& b) \ - { \ - _Tpwvec c, d; \ - v_mul_expand(a, b, c, d); \ - return v_pack(c, d); \ - } \ - inline _Tpvec& operator *= (_Tpvec& a, const _Tpvec& b) \ - { a = a * b; return a; } - -OPENCV_HAL_IMPL_VSX_MUL_SAT(v_int8x16, v_int16x8) -OPENCV_HAL_IMPL_VSX_MUL_SAT(v_uint8x16, v_uint16x8) -OPENCV_HAL_IMPL_VSX_MUL_SAT(v_int16x8, v_int32x4) -OPENCV_HAL_IMPL_VSX_MUL_SAT(v_uint16x8, v_uint32x4) - -template -inline void v_mul_expand(const Tvec& a, const Tvec& b, Twvec& c, Twvec& d) -{ - Twvec p0 = Twvec(vec_mule(a.val, b.val)); - Twvec p1 = Twvec(vec_mulo(a.val, b.val)); - v_zip(p0, p1, c, d); -} - -inline void v_mul_expand(const v_uint32x4& a, const v_uint32x4& b, v_uint64x2& c, v_uint64x2& d) -{ - c.val = vec_mul(vec_unpackhu(a.val), vec_unpackhu(b.val)); - d.val = vec_mul(vec_unpacklu(a.val), vec_unpacklu(b.val)); -} - -inline v_int16x8 v_mul_hi(const v_int16x8& a, const v_int16x8& b) -{ - vec_int4 p0 = vec_mule(a.val, b.val); - vec_int4 p1 = vec_mulo(a.val, b.val); - static const vec_uchar16 perm = {2, 3, 18, 19, 6, 7, 22, 23, 10, 11, 26, 27, 14, 15, 30, 31}; - return v_int16x8(vec_perm(vec_short8_c(p0), vec_short8_c(p1), perm)); -} -inline v_uint16x8 v_mul_hi(const v_uint16x8& a, const v_uint16x8& b) -{ - vec_uint4 p0 = vec_mule(a.val, b.val); - vec_uint4 p1 = vec_mulo(a.val, b.val); - static const vec_uchar16 perm = {2, 3, 18, 19, 6, 7, 22, 23, 10, 11, 26, 27, 14, 15, 30, 31}; - return v_uint16x8(vec_perm(vec_ushort8_c(p0), vec_ushort8_c(p1), perm)); -} - -/** Non-saturating arithmetics **/ -#define OPENCV_HAL_IMPL_VSX_BIN_FUNC(func, intrin) \ -template \ -inline _Tpvec func(const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(intrin(a.val, b.val)); } - -OPENCV_HAL_IMPL_VSX_BIN_FUNC(v_add_wrap, vec_add) -OPENCV_HAL_IMPL_VSX_BIN_FUNC(v_sub_wrap, vec_sub) -OPENCV_HAL_IMPL_VSX_BIN_FUNC(v_mul_wrap, vec_mul) - -/** Bitwise shifts **/ -#define OPENCV_HAL_IMPL_VSX_SHIFT_OP(_Tpvec, shr, splfunc) \ -inline _Tpvec operator << (const _Tpvec& a, int imm) \ -{ return _Tpvec(vec_sl(a.val, splfunc(imm))); } \ -inline _Tpvec operator >> (const _Tpvec& a, int imm) \ -{ return _Tpvec(shr(a.val, splfunc(imm))); } \ -template inline _Tpvec v_shl(const _Tpvec& a) \ -{ return _Tpvec(vec_sl(a.val, splfunc(imm))); } \ -template inline _Tpvec v_shr(const _Tpvec& a) \ -{ return _Tpvec(shr(a.val, splfunc(imm))); } - -OPENCV_HAL_IMPL_VSX_SHIFT_OP(v_uint8x16, vec_sr, vec_uchar16_sp) -OPENCV_HAL_IMPL_VSX_SHIFT_OP(v_uint16x8, vec_sr, vec_ushort8_sp) -OPENCV_HAL_IMPL_VSX_SHIFT_OP(v_uint32x4, vec_sr, vec_uint4_sp) -OPENCV_HAL_IMPL_VSX_SHIFT_OP(v_uint64x2, vec_sr, vec_udword2_sp) -// algebraic right shift -OPENCV_HAL_IMPL_VSX_SHIFT_OP(v_int8x16, vec_sra, vec_uchar16_sp) -OPENCV_HAL_IMPL_VSX_SHIFT_OP(v_int16x8, vec_sra, vec_ushort8_sp) -OPENCV_HAL_IMPL_VSX_SHIFT_OP(v_int32x4, vec_sra, vec_uint4_sp) -OPENCV_HAL_IMPL_VSX_SHIFT_OP(v_int64x2, vec_sra, vec_udword2_sp) - -/** Bitwise logic **/ -#define OPENCV_HAL_IMPL_VSX_LOGIC_OP(_Tpvec) \ -OPENCV_HAL_IMPL_VSX_BIN_OP(&, _Tpvec, vec_and) \ -OPENCV_HAL_IMPL_VSX_BIN_OP(|, _Tpvec, vec_or) \ -OPENCV_HAL_IMPL_VSX_BIN_OP(^, _Tpvec, vec_xor) \ -inline _Tpvec operator ~ (const _Tpvec& a) \ -{ return _Tpvec(vec_not(a.val)); } - -OPENCV_HAL_IMPL_VSX_LOGIC_OP(v_uint8x16) -OPENCV_HAL_IMPL_VSX_LOGIC_OP(v_int8x16) -OPENCV_HAL_IMPL_VSX_LOGIC_OP(v_uint16x8) -OPENCV_HAL_IMPL_VSX_LOGIC_OP(v_int16x8) -OPENCV_HAL_IMPL_VSX_LOGIC_OP(v_uint32x4) -OPENCV_HAL_IMPL_VSX_LOGIC_OP(v_int32x4) -OPENCV_HAL_IMPL_VSX_LOGIC_OP(v_uint64x2) -OPENCV_HAL_IMPL_VSX_LOGIC_OP(v_int64x2) -OPENCV_HAL_IMPL_VSX_LOGIC_OP(v_float32x4) -OPENCV_HAL_IMPL_VSX_LOGIC_OP(v_float64x2) - -/** Bitwise select **/ -#define OPENCV_HAL_IMPL_VSX_SELECT(_Tpvec, cast) \ -inline _Tpvec v_select(const _Tpvec& mask, const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(vec_sel(b.val, a.val, cast(mask.val))); } - -OPENCV_HAL_IMPL_VSX_SELECT(v_uint8x16, vec_bchar16_c) -OPENCV_HAL_IMPL_VSX_SELECT(v_int8x16, vec_bchar16_c) -OPENCV_HAL_IMPL_VSX_SELECT(v_uint16x8, vec_bshort8_c) -OPENCV_HAL_IMPL_VSX_SELECT(v_int16x8, vec_bshort8_c) -OPENCV_HAL_IMPL_VSX_SELECT(v_uint32x4, vec_bint4_c) -OPENCV_HAL_IMPL_VSX_SELECT(v_int32x4, vec_bint4_c) -OPENCV_HAL_IMPL_VSX_SELECT(v_float32x4, vec_bint4_c) -OPENCV_HAL_IMPL_VSX_SELECT(v_float64x2, vec_bdword2_c) - -/** Comparison **/ -#define OPENCV_HAL_IMPL_VSX_INT_CMP_OP(_Tpvec) \ -inline _Tpvec operator == (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(vec_cmpeq(a.val, b.val)); } \ -inline _Tpvec operator != (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(vec_cmpne(a.val, b.val)); } \ -inline _Tpvec operator < (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(vec_cmplt(a.val, b.val)); } \ -inline _Tpvec operator > (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(vec_cmpgt(a.val, b.val)); } \ -inline _Tpvec operator <= (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(vec_cmple(a.val, b.val)); } \ -inline _Tpvec operator >= (const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(vec_cmpge(a.val, b.val)); } - -OPENCV_HAL_IMPL_VSX_INT_CMP_OP(v_uint8x16) -OPENCV_HAL_IMPL_VSX_INT_CMP_OP(v_int8x16) -OPENCV_HAL_IMPL_VSX_INT_CMP_OP(v_uint16x8) -OPENCV_HAL_IMPL_VSX_INT_CMP_OP(v_int16x8) -OPENCV_HAL_IMPL_VSX_INT_CMP_OP(v_uint32x4) -OPENCV_HAL_IMPL_VSX_INT_CMP_OP(v_int32x4) -OPENCV_HAL_IMPL_VSX_INT_CMP_OP(v_float32x4) -OPENCV_HAL_IMPL_VSX_INT_CMP_OP(v_float64x2) -OPENCV_HAL_IMPL_VSX_INT_CMP_OP(v_uint64x2) -OPENCV_HAL_IMPL_VSX_INT_CMP_OP(v_int64x2) - -inline v_float32x4 v_not_nan(const v_float32x4& a) -{ return v_float32x4(vec_cmpeq(a.val, a.val)); } -inline v_float64x2 v_not_nan(const v_float64x2& a) -{ return v_float64x2(vec_cmpeq(a.val, a.val)); } - -/** min/max **/ -OPENCV_HAL_IMPL_VSX_BIN_FUNC(v_min, vec_min) -OPENCV_HAL_IMPL_VSX_BIN_FUNC(v_max, vec_max) - -/** Rotate **/ -#define OPENCV_IMPL_VSX_ROTATE(_Tpvec, suffix, shf, cast) \ -template \ -inline _Tpvec v_rotate_##suffix(const _Tpvec& a) \ -{ \ - const int wd = imm * sizeof(typename _Tpvec::lane_type); \ - if (wd > 15) \ - return _Tpvec(); \ - return _Tpvec((cast)shf(vec_uchar16_c(a.val), vec_uchar16_sp(wd << 3))); \ -} - -#define OPENCV_IMPL_VSX_ROTATE_LR(_Tpvec, cast) \ -OPENCV_IMPL_VSX_ROTATE(_Tpvec, left, vec_slo, cast) \ -OPENCV_IMPL_VSX_ROTATE(_Tpvec, right, vec_sro, cast) - -OPENCV_IMPL_VSX_ROTATE_LR(v_uint8x16, vec_uchar16) -OPENCV_IMPL_VSX_ROTATE_LR(v_int8x16, vec_char16) -OPENCV_IMPL_VSX_ROTATE_LR(v_uint16x8, vec_ushort8) -OPENCV_IMPL_VSX_ROTATE_LR(v_int16x8, vec_short8) -OPENCV_IMPL_VSX_ROTATE_LR(v_uint32x4, vec_uint4) -OPENCV_IMPL_VSX_ROTATE_LR(v_int32x4, vec_int4) -OPENCV_IMPL_VSX_ROTATE_LR(v_float32x4, vec_float4) -OPENCV_IMPL_VSX_ROTATE_LR(v_uint64x2, vec_udword2) -OPENCV_IMPL_VSX_ROTATE_LR(v_int64x2, vec_dword2) -OPENCV_IMPL_VSX_ROTATE_LR(v_float64x2, vec_double2) - -template -inline _Tpvec v_rotate_right(const _Tpvec& a, const _Tpvec& b) -{ - enum { CV_SHIFT = 16 - imm * (sizeof(typename _Tpvec::lane_type)) }; - if (CV_SHIFT == 16) - return a; -#ifdef __IBMCPP__ - return _Tpvec(vec_sld(b.val, a.val, CV_SHIFT & 15)); -#else - return _Tpvec(vec_sld(b.val, a.val, CV_SHIFT)); -#endif -} - -template -inline _Tpvec v_rotate_left(const _Tpvec& a, const _Tpvec& b) -{ - enum { CV_SHIFT = imm * (sizeof(typename _Tpvec::lane_type)) }; - if (CV_SHIFT == 16) - return b; - return _Tpvec(vec_sld(a.val, b.val, CV_SHIFT)); -} - -#define OPENCV_IMPL_VSX_ROTATE_64_2RG(_Tpvec, suffix, rg1, rg2) \ -template \ -inline _Tpvec v_rotate_##suffix(const _Tpvec& a, const _Tpvec& b) \ -{ \ - if (imm == 1) \ - return _Tpvec(vec_permi(rg1.val, rg2.val, 2)); \ - return imm ? b : a; \ -} - -#define OPENCV_IMPL_VSX_ROTATE_64_2RG_LR(_Tpvec) \ -OPENCV_IMPL_VSX_ROTATE_64_2RG(_Tpvec, left, b, a) \ -OPENCV_IMPL_VSX_ROTATE_64_2RG(_Tpvec, right, a, b) - -OPENCV_IMPL_VSX_ROTATE_64_2RG_LR(v_float64x2) -OPENCV_IMPL_VSX_ROTATE_64_2RG_LR(v_uint64x2) -OPENCV_IMPL_VSX_ROTATE_64_2RG_LR(v_int64x2) - -/* Extract */ -template -inline _Tpvec v_extract(const _Tpvec& a, const _Tpvec& b) -{ return v_rotate_right(a, b); } - -////////// Reduce and mask ///////// - -/** Reduce **/ -inline short v_reduce_sum(const v_int16x8& a) -{ - const vec_int4 zero = vec_int4_z; - return saturate_cast(vec_extract(vec_sums(vec_sum4s(a.val, zero), zero), 3)); -} -inline ushort v_reduce_sum(const v_uint16x8& a) -{ - const vec_int4 v4 = vec_int4_c(vec_unpackhu(vec_adds(a.val, vec_sld(a.val, a.val, 8)))); - return saturate_cast(vec_extract(vec_sums(v4, vec_int4_z), 3)); -} - -#define OPENCV_HAL_IMPL_VSX_REDUCE_OP_4(_Tpvec, _Tpvec2, scalartype, suffix, func) \ -inline scalartype v_reduce_##suffix(const _Tpvec& a) \ -{ \ - const _Tpvec2 rs = func(a.val, vec_sld(a.val, a.val, 8)); \ - return vec_extract(func(rs, vec_sld(rs, rs, 4)), 0); \ -} -OPENCV_HAL_IMPL_VSX_REDUCE_OP_4(v_uint32x4, vec_uint4, uint, sum, vec_add) -OPENCV_HAL_IMPL_VSX_REDUCE_OP_4(v_uint32x4, vec_uint4, uint, max, vec_max) -OPENCV_HAL_IMPL_VSX_REDUCE_OP_4(v_uint32x4, vec_uint4, uint, min, vec_min) -OPENCV_HAL_IMPL_VSX_REDUCE_OP_4(v_int32x4, vec_int4, int, sum, vec_add) -OPENCV_HAL_IMPL_VSX_REDUCE_OP_4(v_int32x4, vec_int4, int, max, vec_max) -OPENCV_HAL_IMPL_VSX_REDUCE_OP_4(v_int32x4, vec_int4, int, min, vec_min) -OPENCV_HAL_IMPL_VSX_REDUCE_OP_4(v_float32x4, vec_float4, float, sum, vec_add) -OPENCV_HAL_IMPL_VSX_REDUCE_OP_4(v_float32x4, vec_float4, float, max, vec_max) -OPENCV_HAL_IMPL_VSX_REDUCE_OP_4(v_float32x4, vec_float4, float, min, vec_min) - -inline double v_reduce_sum(const v_float64x2& a) -{ - return vec_extract(vec_add(a.val, vec_permi(a.val, a.val, 3)), 0); -} - -#define OPENCV_HAL_IMPL_VSX_REDUCE_OP_8(_Tpvec, _Tpvec2, scalartype, suffix, func) \ -inline scalartype v_reduce_##suffix(const _Tpvec& a) \ -{ \ - _Tpvec2 rs = func(a.val, vec_sld(a.val, a.val, 8)); \ - rs = func(rs, vec_sld(rs, rs, 4)); \ - return vec_extract(func(rs, vec_sld(rs, rs, 2)), 0); \ -} -OPENCV_HAL_IMPL_VSX_REDUCE_OP_8(v_uint16x8, vec_ushort8, ushort, max, vec_max) -OPENCV_HAL_IMPL_VSX_REDUCE_OP_8(v_uint16x8, vec_ushort8, ushort, min, vec_min) -OPENCV_HAL_IMPL_VSX_REDUCE_OP_8(v_int16x8, vec_short8, short, max, vec_max) -OPENCV_HAL_IMPL_VSX_REDUCE_OP_8(v_int16x8, vec_short8, short, min, vec_min) - -inline v_float32x4 v_reduce_sum4(const v_float32x4& a, const v_float32x4& b, - const v_float32x4& c, const v_float32x4& d) -{ - vec_float4 ac = vec_add(vec_mergel(a.val, c.val), vec_mergeh(a.val, c.val)); - ac = vec_add(ac, vec_sld(ac, ac, 8)); - - vec_float4 bd = vec_add(vec_mergel(b.val, d.val), vec_mergeh(b.val, d.val)); - bd = vec_add(bd, vec_sld(bd, bd, 8)); - return v_float32x4(vec_mergeh(ac, bd)); -} - -inline unsigned v_reduce_sad(const v_uint8x16& a, const v_uint8x16& b) -{ - const vec_uint4 zero4 = vec_uint4_z; - vec_uint4 sum4 = vec_sum4s(vec_absd(a.val, b.val), zero4); - return (unsigned)vec_extract(vec_sums(vec_int4_c(sum4), vec_int4_c(zero4)), 3); -} -inline unsigned v_reduce_sad(const v_int8x16& a, const v_int8x16& b) -{ - const vec_int4 zero4 = vec_int4_z; - vec_char16 ad = vec_abss(vec_subs(a.val, b.val)); - vec_int4 sum4 = vec_sum4s(ad, zero4); - return (unsigned)vec_extract(vec_sums(sum4, zero4), 3); -} -inline unsigned v_reduce_sad(const v_uint16x8& a, const v_uint16x8& b) -{ - vec_ushort8 ad = vec_absd(a.val, b.val); - VSX_UNUSED(vec_int4) sum = vec_sums(vec_int4_c(vec_unpackhu(ad)), vec_int4_c(vec_unpacklu(ad))); - return (unsigned)vec_extract(sum, 3); -} -inline unsigned v_reduce_sad(const v_int16x8& a, const v_int16x8& b) -{ - const vec_int4 zero4 = vec_int4_z; - vec_short8 ad = vec_abss(vec_subs(a.val, b.val)); - vec_int4 sum4 = vec_sum4s(ad, zero4); - return (unsigned)vec_extract(vec_sums(sum4, zero4), 3); -} -inline unsigned v_reduce_sad(const v_uint32x4& a, const v_uint32x4& b) -{ - const vec_uint4 ad = vec_absd(a.val, b.val); - const vec_uint4 rd = vec_add(ad, vec_sld(ad, ad, 8)); - return vec_extract(vec_add(rd, vec_sld(rd, rd, 4)), 0); -} -inline unsigned v_reduce_sad(const v_int32x4& a, const v_int32x4& b) -{ - vec_int4 ad = vec_abss(vec_sub(a.val, b.val)); - return (unsigned)vec_extract(vec_sums(ad, vec_int4_z), 3); -} -inline float v_reduce_sad(const v_float32x4& a, const v_float32x4& b) -{ - const vec_float4 ad = vec_abs(vec_sub(a.val, b.val)); - const vec_float4 rd = vec_add(ad, vec_sld(ad, ad, 8)); - return vec_extract(vec_add(rd, vec_sld(rd, rd, 4)), 0); -} - -/** Popcount **/ -template -inline v_uint32x4 v_popcount(const _Tpvec& a) -{ return v_uint32x4(vec_popcntu(vec_uint4_c(a.val))); } - -/** Mask **/ -inline int v_signmask(const v_uint8x16& a) -{ - vec_uchar16 sv = vec_sr(a.val, vec_uchar16_sp(7)); - static const vec_uchar16 slm = {0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7}; - sv = vec_sl(sv, slm); - vec_uint4 sv4 = vec_sum4s(sv, vec_uint4_z); - static const vec_uint4 slm4 = {0, 0, 8, 8}; - sv4 = vec_sl(sv4, slm4); - return vec_extract(vec_sums((vec_int4) sv4, vec_int4_z), 3); -} -inline int v_signmask(const v_int8x16& a) -{ return v_signmask(v_reinterpret_as_u8(a)); } - -inline int v_signmask(const v_int16x8& a) -{ - static const vec_ushort8 slm = {0, 1, 2, 3, 4, 5, 6, 7}; - vec_short8 sv = vec_sr(a.val, vec_ushort8_sp(15)); - sv = vec_sl(sv, slm); - vec_int4 svi = vec_int4_z; - svi = vec_sums(vec_sum4s(sv, svi), svi); - return vec_extract(svi, 3); -} -inline int v_signmask(const v_uint16x8& a) -{ return v_signmask(v_reinterpret_as_s16(a)); } - -inline int v_signmask(const v_int32x4& a) -{ - static const vec_uint4 slm = {0, 1, 2, 3}; - vec_int4 sv = vec_sr(a.val, vec_uint4_sp(31)); - sv = vec_sl(sv, slm); - sv = vec_sums(sv, vec_int4_z); - return vec_extract(sv, 3); -} -inline int v_signmask(const v_uint32x4& a) -{ return v_signmask(v_reinterpret_as_s32(a)); } -inline int v_signmask(const v_float32x4& a) -{ return v_signmask(v_reinterpret_as_s32(a)); } - -inline int v_signmask(const v_int64x2& a) -{ - VSX_UNUSED(const vec_dword2) sv = vec_sr(a.val, vec_udword2_sp(63)); - return (int)vec_extract(sv, 0) | (int)vec_extract(sv, 1) << 1; -} -inline int v_signmask(const v_uint64x2& a) -{ return v_signmask(v_reinterpret_as_s64(a)); } -inline int v_signmask(const v_float64x2& a) -{ return v_signmask(v_reinterpret_as_s64(a)); } - -template -inline bool v_check_all(const _Tpvec& a) -{ return vec_all_lt(a.val, _Tpvec().val); } -inline bool v_check_all(const v_uint8x16& a) -{ return v_check_all(v_reinterpret_as_s8(a)); } -inline bool v_check_all(const v_uint16x8& a) -{ return v_check_all(v_reinterpret_as_s16(a)); } -inline bool v_check_all(const v_uint32x4& a) -{ return v_check_all(v_reinterpret_as_s32(a)); } -inline bool v_check_all(const v_float32x4& a) -{ return v_check_all(v_reinterpret_as_s32(a)); } -inline bool v_check_all(const v_float64x2& a) -{ return v_check_all(v_reinterpret_as_s64(a)); } - -template -inline bool v_check_any(const _Tpvec& a) -{ return vec_any_lt(a.val, _Tpvec().val); } -inline bool v_check_any(const v_uint8x16& a) -{ return v_check_any(v_reinterpret_as_s8(a)); } -inline bool v_check_any(const v_uint16x8& a) -{ return v_check_any(v_reinterpret_as_s16(a)); } -inline bool v_check_any(const v_uint32x4& a) -{ return v_check_any(v_reinterpret_as_s32(a)); } -inline bool v_check_any(const v_float32x4& a) -{ return v_check_any(v_reinterpret_as_s32(a)); } -inline bool v_check_any(const v_float64x2& a) -{ return v_check_any(v_reinterpret_as_s64(a)); } - -////////// Other math ///////// - -/** Some frequent operations **/ -inline v_float32x4 v_sqrt(const v_float32x4& x) -{ return v_float32x4(vec_sqrt(x.val)); } -inline v_float64x2 v_sqrt(const v_float64x2& x) -{ return v_float64x2(vec_sqrt(x.val)); } - -inline v_float32x4 v_invsqrt(const v_float32x4& x) -{ return v_float32x4(vec_rsqrt(x.val)); } -inline v_float64x2 v_invsqrt(const v_float64x2& x) -{ return v_float64x2(vec_rsqrt(x.val)); } - -#define OPENCV_HAL_IMPL_VSX_MULADD(_Tpvec) \ -inline _Tpvec v_magnitude(const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(vec_sqrt(vec_madd(a.val, a.val, vec_mul(b.val, b.val)))); } \ -inline _Tpvec v_sqr_magnitude(const _Tpvec& a, const _Tpvec& b) \ -{ return _Tpvec(vec_madd(a.val, a.val, vec_mul(b.val, b.val))); } \ -inline _Tpvec v_fma(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \ -{ return _Tpvec(vec_madd(a.val, b.val, c.val)); } \ -inline _Tpvec v_muladd(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \ -{ return _Tpvec(vec_madd(a.val, b.val, c.val)); } - -OPENCV_HAL_IMPL_VSX_MULADD(v_float32x4) -OPENCV_HAL_IMPL_VSX_MULADD(v_float64x2) - -inline v_int32x4 v_muladd(const v_int32x4& a, const v_int32x4& b, const v_int32x4& c) -{ return a * b + c; } - -// TODO: exp, log, sin, cos - -/** Absolute values **/ -inline v_uint8x16 v_abs(const v_int8x16& x) -{ return v_uint8x16(vec_uchar16_c(vec_abs(x.val))); } - -inline v_uint16x8 v_abs(const v_int16x8& x) -{ return v_uint16x8(vec_ushort8_c(vec_abs(x.val))); } - -inline v_uint32x4 v_abs(const v_int32x4& x) -{ return v_uint32x4(vec_uint4_c(vec_abs(x.val))); } - -inline v_float32x4 v_abs(const v_float32x4& x) -{ return v_float32x4(vec_abs(x.val)); } - -inline v_float64x2 v_abs(const v_float64x2& x) -{ return v_float64x2(vec_abs(x.val)); } - -/** Absolute difference **/ -// unsigned -OPENCV_HAL_IMPL_VSX_BIN_FUNC(v_absdiff, vec_absd) - -inline v_uint8x16 v_absdiff(const v_int8x16& a, const v_int8x16& b) -{ return v_reinterpret_as_u8(v_sub_wrap(v_max(a, b), v_min(a, b))); } -inline v_uint16x8 v_absdiff(const v_int16x8& a, const v_int16x8& b) -{ return v_reinterpret_as_u16(v_sub_wrap(v_max(a, b), v_min(a, b))); } -inline v_uint32x4 v_absdiff(const v_int32x4& a, const v_int32x4& b) -{ return v_reinterpret_as_u32(v_max(a, b) - v_min(a, b)); } - -inline v_float32x4 v_absdiff(const v_float32x4& a, const v_float32x4& b) -{ return v_abs(a - b); } -inline v_float64x2 v_absdiff(const v_float64x2& a, const v_float64x2& b) -{ return v_abs(a - b); } - -/** Absolute difference for signed integers **/ -inline v_int8x16 v_absdiffs(const v_int8x16& a, const v_int8x16& b) -{ return v_int8x16(vec_abss(vec_subs(a.val, b.val))); } -inline v_int16x8 v_absdiffs(const v_int16x8& a, const v_int16x8& b) -{ return v_int16x8(vec_abss(vec_subs(a.val, b.val))); } - -////////// Conversions ///////// - -/** Rounding **/ -inline v_int32x4 v_round(const v_float32x4& a) -{ return v_int32x4(vec_cts(vec_rint(a.val))); } - -inline v_int32x4 v_round(const v_float64x2& a) -{ return v_int32x4(vec_mergesqo(vec_ctso(vec_rint(a.val)), vec_int4_z)); } - -inline v_int32x4 v_round(const v_float64x2& a, const v_float64x2& b) -{ return v_int32x4(vec_mergesqo(vec_ctso(vec_rint(a.val)), vec_ctso(vec_rint(b.val)))); } - -inline v_int32x4 v_floor(const v_float32x4& a) -{ return v_int32x4(vec_cts(vec_floor(a.val))); } - -inline v_int32x4 v_floor(const v_float64x2& a) -{ return v_int32x4(vec_mergesqo(vec_ctso(vec_floor(a.val)), vec_int4_z)); } - -inline v_int32x4 v_ceil(const v_float32x4& a) -{ return v_int32x4(vec_cts(vec_ceil(a.val))); } - -inline v_int32x4 v_ceil(const v_float64x2& a) -{ return v_int32x4(vec_mergesqo(vec_ctso(vec_ceil(a.val)), vec_int4_z)); } - -inline v_int32x4 v_trunc(const v_float32x4& a) -{ return v_int32x4(vec_cts(a.val)); } - -inline v_int32x4 v_trunc(const v_float64x2& a) -{ return v_int32x4(vec_mergesqo(vec_ctso(a.val), vec_int4_z)); } - -/** To float **/ -inline v_float32x4 v_cvt_f32(const v_int32x4& a) -{ return v_float32x4(vec_ctf(a.val)); } - -inline v_float32x4 v_cvt_f32(const v_float64x2& a) -{ return v_float32x4(vec_mergesqo(vec_cvfo(a.val), vec_float4_z)); } - -inline v_float32x4 v_cvt_f32(const v_float64x2& a, const v_float64x2& b) -{ return v_float32x4(vec_mergesqo(vec_cvfo(a.val), vec_cvfo(b.val))); } - -inline v_float64x2 v_cvt_f64(const v_int32x4& a) -{ return v_float64x2(vec_ctdo(vec_mergeh(a.val, a.val))); } - -inline v_float64x2 v_cvt_f64_high(const v_int32x4& a) -{ return v_float64x2(vec_ctdo(vec_mergel(a.val, a.val))); } - -inline v_float64x2 v_cvt_f64(const v_float32x4& a) -{ return v_float64x2(vec_cvfo(vec_mergeh(a.val, a.val))); } - -inline v_float64x2 v_cvt_f64_high(const v_float32x4& a) -{ return v_float64x2(vec_cvfo(vec_mergel(a.val, a.val))); } - -////////////// Lookup table access //////////////////// - -inline v_int8x16 v_lut(const schar* tab, const int* idx) -{ - return v_int8x16(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]], tab[idx[4]], tab[idx[5]], tab[idx[6]], tab[idx[7]], - tab[idx[8]], tab[idx[9]], tab[idx[10]], tab[idx[11]], tab[idx[12]], tab[idx[13]], tab[idx[14]], tab[idx[15]]); -} -inline v_int8x16 v_lut_pairs(const schar* tab, const int* idx) -{ - return v_reinterpret_as_s8(v_int16x8(*(const short*)(tab+idx[0]), *(const short*)(tab+idx[1]), *(const short*)(tab+idx[2]), *(const short*)(tab+idx[3]), - *(const short*)(tab+idx[4]), *(const short*)(tab+idx[5]), *(const short*)(tab+idx[6]), *(const short*)(tab+idx[7]))); -} -inline v_int8x16 v_lut_quads(const schar* tab, const int* idx) -{ - return v_reinterpret_as_s8(v_int32x4(*(const int*)(tab+idx[0]), *(const int*)(tab+idx[1]), *(const int*)(tab+idx[2]), *(const int*)(tab+idx[3]))); -} -inline v_uint8x16 v_lut(const uchar* tab, const int* idx) { return v_reinterpret_as_u8(v_lut((const schar*)tab, idx)); } -inline v_uint8x16 v_lut_pairs(const uchar* tab, const int* idx) { return v_reinterpret_as_u8(v_lut_pairs((const schar*)tab, idx)); } -inline v_uint8x16 v_lut_quads(const uchar* tab, const int* idx) { return v_reinterpret_as_u8(v_lut_quads((const schar*)tab, idx)); } - -inline v_int16x8 v_lut(const short* tab, const int* idx) -{ - return v_int16x8(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]], tab[idx[4]], tab[idx[5]], tab[idx[6]], tab[idx[7]]); -} -inline v_int16x8 v_lut_pairs(const short* tab, const int* idx) -{ - return v_reinterpret_as_s16(v_int32x4(*(const int*)(tab + idx[0]), *(const int*)(tab + idx[1]), *(const int*)(tab + idx[2]), *(const int*)(tab + idx[3]))); -} -inline v_int16x8 v_lut_quads(const short* tab, const int* idx) -{ - return v_reinterpret_as_s16(v_int64x2(*(const int64*)(tab + idx[0]), *(const int64*)(tab + idx[1]))); -} -inline v_uint16x8 v_lut(const ushort* tab, const int* idx) { return v_reinterpret_as_u16(v_lut((const short*)tab, idx)); } -inline v_uint16x8 v_lut_pairs(const ushort* tab, const int* idx) { return v_reinterpret_as_u16(v_lut_pairs((const short*)tab, idx)); } -inline v_uint16x8 v_lut_quads(const ushort* tab, const int* idx) { return v_reinterpret_as_u16(v_lut_quads((const short*)tab, idx)); } - -inline v_int32x4 v_lut(const int* tab, const int* idx) -{ - return v_int32x4(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]]); -} -inline v_int32x4 v_lut_pairs(const int* tab, const int* idx) -{ - return v_reinterpret_as_s32(v_int64x2(*(const int64*)(tab + idx[0]), *(const int64*)(tab + idx[1]))); -} -inline v_int32x4 v_lut_quads(const int* tab, const int* idx) -{ - return v_int32x4(vsx_ld(0, tab + idx[0])); -} -inline v_uint32x4 v_lut(const unsigned* tab, const int* idx) { return v_reinterpret_as_u32(v_lut((const int*)tab, idx)); } -inline v_uint32x4 v_lut_pairs(const unsigned* tab, const int* idx) { return v_reinterpret_as_u32(v_lut_pairs((const int*)tab, idx)); } -inline v_uint32x4 v_lut_quads(const unsigned* tab, const int* idx) { return v_reinterpret_as_u32(v_lut_quads((const int*)tab, idx)); } - -inline v_int64x2 v_lut(const int64_t* tab, const int* idx) -{ - return v_int64x2(tab[idx[0]], tab[idx[1]]); -} -inline v_int64x2 v_lut_pairs(const int64_t* tab, const int* idx) -{ - return v_int64x2(vsx_ld2(0, tab + idx[0])); -} -inline v_uint64x2 v_lut(const uint64_t* tab, const int* idx) { return v_reinterpret_as_u64(v_lut((const int64_t *)tab, idx)); } -inline v_uint64x2 v_lut_pairs(const uint64_t* tab, const int* idx) { return v_reinterpret_as_u64(v_lut_pairs((const int64_t *)tab, idx)); } - -inline v_float32x4 v_lut(const float* tab, const int* idx) -{ - return v_float32x4(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]]); -} -inline v_float32x4 v_lut_pairs(const float* tab, const int* idx) { return v_reinterpret_as_f32(v_lut_pairs((const int*)tab, idx)); } -inline v_float32x4 v_lut_quads(const float* tab, const int* idx) { return v_load(tab + *idx); } - -inline v_float64x2 v_lut(const double* tab, const int* idx) -{ - return v_float64x2(tab[idx[0]], tab[idx[1]]); -} -inline v_float64x2 v_lut_pairs(const double* tab, const int* idx) { return v_load(tab + *idx); } - -inline v_int32x4 v_lut(const int* tab, const v_int32x4& idxvec) -{ - const int idx[4] = { - vec_extract(idxvec.val, 0), - vec_extract(idxvec.val, 1), - vec_extract(idxvec.val, 2), - vec_extract(idxvec.val, 3) - }; - return v_int32x4(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]]); -} - -inline v_uint32x4 v_lut(const unsigned* tab, const v_int32x4& idxvec) -{ - const int idx[4] = { - vec_extract(idxvec.val, 0), - vec_extract(idxvec.val, 1), - vec_extract(idxvec.val, 2), - vec_extract(idxvec.val, 3) - }; - return v_uint32x4(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]]); -} - -inline v_float32x4 v_lut(const float* tab, const v_int32x4& idxvec) -{ - const int idx[4] = { - vec_extract(idxvec.val, 0), - vec_extract(idxvec.val, 1), - vec_extract(idxvec.val, 2), - vec_extract(idxvec.val, 3) - }; - return v_float32x4(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]]); -} - -inline v_float64x2 v_lut(const double* tab, const v_int32x4& idxvec) -{ - const int idx[2] = { - vec_extract(idxvec.val, 0), - vec_extract(idxvec.val, 1) - }; - return v_float64x2(tab[idx[0]], tab[idx[1]]); -} - -inline void v_lut_deinterleave(const float* tab, const v_int32x4& idxvec, v_float32x4& x, v_float32x4& y) -{ - vec_float4 xy0 = vec_ld_l8(tab + vec_extract(idxvec.val, 0)); - vec_float4 xy1 = vec_ld_l8(tab + vec_extract(idxvec.val, 1)); - vec_float4 xy2 = vec_ld_l8(tab + vec_extract(idxvec.val, 2)); - vec_float4 xy3 = vec_ld_l8(tab + vec_extract(idxvec.val, 3)); - vec_float4 xy02 = vec_mergeh(xy0, xy2); // x0, x2, y0, y2 - vec_float4 xy13 = vec_mergeh(xy1, xy3); // x1, x3, y1, y3 - x.val = vec_mergeh(xy02, xy13); - y.val = vec_mergel(xy02, xy13); -} -inline void v_lut_deinterleave(const double* tab, const v_int32x4& idxvec, v_float64x2& x, v_float64x2& y) -{ - vec_double2 xy0 = vsx_ld(vec_extract(idxvec.val, 0), tab); - vec_double2 xy1 = vsx_ld(vec_extract(idxvec.val, 1), tab); - x.val = vec_mergeh(xy0, xy1); - y.val = vec_mergel(xy0, xy1); -} - -inline v_int8x16 v_interleave_pairs(const v_int8x16& vec) -{ - static const vec_uchar16 perm = {0, 2, 1, 3, 4, 6, 5, 7, 8, 10, 9, 11, 12, 14, 13, 15}; - return v_int8x16(vec_perm(vec.val, vec.val, perm)); -} -inline v_uint8x16 v_interleave_pairs(const v_uint8x16& vec) -{ return v_reinterpret_as_u8(v_interleave_pairs(v_reinterpret_as_s8(vec))); } - -inline v_int8x16 v_interleave_quads(const v_int8x16& vec) -{ - static const vec_uchar16 perm = {0, 4, 1, 5, 2, 6, 3, 7, 8, 12, 9, 13, 10, 14, 11, 15}; - return v_int8x16(vec_perm(vec.val, vec.val, perm)); -} -inline v_uint8x16 v_interleave_quads(const v_uint8x16& vec) -{ return v_reinterpret_as_u8(v_interleave_quads(v_reinterpret_as_s8(vec))); } - -inline v_int16x8 v_interleave_pairs(const v_int16x8& vec) -{ - static const vec_uchar16 perm = {0,1, 4,5, 2,3, 6,7, 8,9, 12,13, 10,11, 14,15}; - return v_int16x8(vec_perm(vec.val, vec.val, perm)); -} -inline v_uint16x8 v_interleave_pairs(const v_uint16x8& vec) -{ return v_reinterpret_as_u16(v_interleave_pairs(v_reinterpret_as_s16(vec))); } - -inline v_int16x8 v_interleave_quads(const v_int16x8& vec) -{ - static const vec_uchar16 perm = {0,1, 8,9, 2,3, 10,11, 4,5, 12,13, 6,7, 14,15}; - return v_int16x8(vec_perm(vec.val, vec.val, perm)); -} -inline v_uint16x8 v_interleave_quads(const v_uint16x8& vec) -{ return v_reinterpret_as_u16(v_interleave_quads(v_reinterpret_as_s16(vec))); } - -inline v_int32x4 v_interleave_pairs(const v_int32x4& vec) -{ - static const vec_uchar16 perm = {0,1,2,3, 8,9,10,11, 4,5,6,7, 12,13,14,15}; - return v_int32x4(vec_perm(vec.val, vec.val, perm)); -} -inline v_uint32x4 v_interleave_pairs(const v_uint32x4& vec) -{ return v_reinterpret_as_u32(v_interleave_pairs(v_reinterpret_as_s32(vec))); } -inline v_float32x4 v_interleave_pairs(const v_float32x4& vec) -{ return v_reinterpret_as_f32(v_interleave_pairs(v_reinterpret_as_s32(vec))); } - -inline v_int8x16 v_pack_triplets(const v_int8x16& vec) -{ - static const vec_uchar16 perm = {0, 1, 2, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15, 15, 15, 15}; - return v_int8x16(vec_perm(vec.val, vec.val, perm)); -} -inline v_uint8x16 v_pack_triplets(const v_uint8x16& vec) -{ return v_reinterpret_as_u8(v_pack_triplets(v_reinterpret_as_s8(vec))); } - -inline v_int16x8 v_pack_triplets(const v_int16x8& vec) -{ - static const vec_uchar16 perm = {0,1, 2,3, 4,5, 8,9, 10,11, 12,13, 14,15, 14,15}; - return v_int16x8(vec_perm(vec.val, vec.val, perm)); -} -inline v_uint16x8 v_pack_triplets(const v_uint16x8& vec) -{ return v_reinterpret_as_u16(v_pack_triplets(v_reinterpret_as_s16(vec))); } - -inline v_int32x4 v_pack_triplets(const v_int32x4& vec) -{ return vec; } -inline v_uint32x4 v_pack_triplets(const v_uint32x4& vec) -{ return vec; } -inline v_float32x4 v_pack_triplets(const v_float32x4& vec) -{ return vec; } - -/////// FP16 support //////// - -inline v_float32x4 v_load_expand(const float16_t* ptr) -{ - vec_ushort8 vf16 = vec_ld_l8((const ushort*)ptr); -#if CV_VSX3 && defined(vec_extract_fp_from_shorth) - return v_float32x4(vec_extract_fp_from_shorth(vf16)); -#elif CV_VSX3 && !defined(CV_COMPILER_VSX_BROKEN_ASM) - vec_float4 vf32; - __asm__ __volatile__ ("xvcvhpsp %x0,%x1" : "=wf" (vf32) : "wa" (vec_mergeh(vf16, vf16))); - return v_float32x4(vf32); -#else - const vec_int4 z = vec_int4_z, delta = vec_int4_sp(0x38000000); - const vec_int4 signmask = vec_int4_sp(0x80000000); - const vec_int4 maxexp = vec_int4_sp(0x7c000000); - const vec_float4 deltaf = vec_float4_c(vec_int4_sp(0x38800000)); - - vec_int4 bits = vec_int4_c(vec_mergeh(vec_short8_c(z), vec_short8_c(vf16))); - vec_int4 e = vec_and(bits, maxexp), sign = vec_and(bits, signmask); - vec_int4 t = vec_add(vec_sr(vec_xor(bits, sign), vec_uint4_sp(3)), delta); // ((h & 0x7fff) << 13) + delta - vec_int4 zt = vec_int4_c(vec_sub(vec_float4_c(vec_add(t, vec_int4_sp(1 << 23))), deltaf)); - - t = vec_add(t, vec_and(delta, vec_cmpeq(maxexp, e))); - vec_bint4 zmask = vec_cmpeq(e, z); - vec_int4 ft = vec_sel(t, zt, zmask); - return v_float32x4(vec_float4_c(vec_or(ft, sign))); -#endif -} - -inline void v_pack_store(float16_t* ptr, const v_float32x4& v) -{ -// fixme: Is there any buitin op or intrinsic that cover "xvcvsphp"? -#if CV_VSX3 && !defined(CV_COMPILER_VSX_BROKEN_ASM) - vec_ushort8 vf16; - __asm__ __volatile__ ("xvcvsphp %x0,%x1" : "=wa" (vf16) : "wf" (v.val)); - vec_st_l8(vec_mergesqe(vf16, vf16), ptr); -#else - const vec_int4 signmask = vec_int4_sp(0x80000000); - const vec_int4 rval = vec_int4_sp(0x3f000000); - - vec_int4 t = vec_int4_c(v.val); - vec_int4 sign = vec_sra(vec_and(t, signmask), vec_uint4_sp(16)); - t = vec_and(vec_nor(signmask, signmask), t); - - vec_bint4 finitemask = vec_cmpgt(vec_int4_sp(0x47800000), t); - vec_bint4 isnan = vec_cmpgt(t, vec_int4_sp(0x7f800000)); - vec_int4 naninf = vec_sel(vec_int4_sp(0x7c00), vec_int4_sp(0x7e00), isnan); - vec_bint4 tinymask = vec_cmpgt(vec_int4_sp(0x38800000), t); - vec_int4 tt = vec_int4_c(vec_add(vec_float4_c(t), vec_float4_c(rval))); - tt = vec_sub(tt, rval); - vec_int4 odd = vec_and(vec_sr(t, vec_uint4_sp(13)), vec_int4_sp(1)); - vec_int4 nt = vec_add(t, vec_int4_sp(0xc8000fff)); - nt = vec_sr(vec_add(nt, odd), vec_uint4_sp(13)); - t = vec_sel(nt, tt, tinymask); - t = vec_sel(naninf, t, finitemask); - t = vec_or(t, sign); - vec_st_l8(vec_packs(t, t), ptr); -#endif -} - -inline void v_cleanup() {} - - -/** Reinterpret **/ -/** its up there with load and store operations **/ - -////////// Matrix operations ///////// - -inline v_int32x4 v_dotprod(const v_int16x8& a, const v_int16x8& b) -{ return v_int32x4(vec_msum(a.val, b.val, vec_int4_z)); } - -inline v_int32x4 v_dotprod(const v_int16x8& a, const v_int16x8& b, const v_int32x4& c) -{ return v_int32x4(vec_msum(a.val, b.val, c.val)); } - -inline v_float32x4 v_matmul(const v_float32x4& v, const v_float32x4& m0, - const v_float32x4& m1, const v_float32x4& m2, - const v_float32x4& m3) -{ - const vec_float4 v0 = vec_splat(v.val, 0); - const vec_float4 v1 = vec_splat(v.val, 1); - const vec_float4 v2 = vec_splat(v.val, 2); - VSX_UNUSED(const vec_float4) v3 = vec_splat(v.val, 3); - return v_float32x4(vec_madd(v0, m0.val, vec_madd(v1, m1.val, vec_madd(v2, m2.val, vec_mul(v3, m3.val))))); -} - -inline v_float32x4 v_matmuladd(const v_float32x4& v, const v_float32x4& m0, - const v_float32x4& m1, const v_float32x4& m2, - const v_float32x4& a) -{ - const vec_float4 v0 = vec_splat(v.val, 0); - const vec_float4 v1 = vec_splat(v.val, 1); - const vec_float4 v2 = vec_splat(v.val, 2); - return v_float32x4(vec_madd(v0, m0.val, vec_madd(v1, m1.val, vec_madd(v2, m2.val, a.val)))); -} - -#define OPENCV_HAL_IMPL_VSX_TRANSPOSE4x4(_Tpvec, _Tpvec2) \ -inline void v_transpose4x4(const _Tpvec& a0, const _Tpvec& a1, \ - const _Tpvec& a2, const _Tpvec& a3, \ - _Tpvec& b0, _Tpvec& b1, _Tpvec& b2, _Tpvec& b3) \ -{ \ - _Tpvec2 a02 = vec_mergeh(a0.val, a2.val); \ - _Tpvec2 a13 = vec_mergeh(a1.val, a3.val); \ - b0.val = vec_mergeh(a02, a13); \ - b1.val = vec_mergel(a02, a13); \ - a02 = vec_mergel(a0.val, a2.val); \ - a13 = vec_mergel(a1.val, a3.val); \ - b2.val = vec_mergeh(a02, a13); \ - b3.val = vec_mergel(a02, a13); \ -} -OPENCV_HAL_IMPL_VSX_TRANSPOSE4x4(v_uint32x4, vec_uint4) -OPENCV_HAL_IMPL_VSX_TRANSPOSE4x4(v_int32x4, vec_int4) -OPENCV_HAL_IMPL_VSX_TRANSPOSE4x4(v_float32x4, vec_float4) - -//! @name Check SIMD support -//! @{ -//! @brief Check CPU capability of SIMD operation -static inline bool hasSIMD128() -{ - return (CV_CPU_HAS_SUPPORT_VSX) ? true : false; -} - -//! @} - -CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END - -//! @endcond - -} - -#endif // OPENCV_HAL_VSX_HPP diff --git a/opencv/include/opencv2/core/ippasync.hpp b/opencv/include/opencv2/core/ippasync.hpp deleted file mode 100644 index c35d8d8..0000000 --- a/opencv/include/opencv2/core/ippasync.hpp +++ /dev/null @@ -1,195 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2015, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_IPPASYNC_HPP -#define OPENCV_CORE_IPPASYNC_HPP - -#ifdef HAVE_IPP_A // this file will be removed in OpenCV 4.0 - -#include "opencv2/core.hpp" -#include -#include - -namespace cv -{ - -namespace hpp -{ - -/** @addtogroup core_ipp -This section describes conversion between OpenCV and [Intel® IPP Asynchronous -C/C++](http://software.intel.com/en-us/intel-ipp-preview) library. [Getting Started -Guide](http://registrationcenter.intel.com/irc_nas/3727/ipp_async_get_started.htm) help you to -install the library, configure header and library build paths. - */ -//! @{ - - //! convert OpenCV data type to hppDataType - inline int toHppType(const int cvType) - { - int depth = CV_MAT_DEPTH(cvType); - int hppType = depth == CV_8U ? HPP_DATA_TYPE_8U : - depth == CV_16U ? HPP_DATA_TYPE_16U : - depth == CV_16S ? HPP_DATA_TYPE_16S : - depth == CV_32S ? HPP_DATA_TYPE_32S : - depth == CV_32F ? HPP_DATA_TYPE_32F : - depth == CV_64F ? HPP_DATA_TYPE_64F : -1; - CV_Assert( hppType >= 0 ); - return hppType; - } - - //! convert hppDataType to OpenCV data type - inline int toCvType(const int hppType) - { - int cvType = hppType == HPP_DATA_TYPE_8U ? CV_8U : - hppType == HPP_DATA_TYPE_16U ? CV_16U : - hppType == HPP_DATA_TYPE_16S ? CV_16S : - hppType == HPP_DATA_TYPE_32S ? CV_32S : - hppType == HPP_DATA_TYPE_32F ? CV_32F : - hppType == HPP_DATA_TYPE_64F ? CV_64F : -1; - CV_Assert( cvType >= 0 ); - return cvType; - } - - /** @brief Convert hppiMatrix to Mat. - - This function allocates and initializes new matrix (if needed) that has the same size and type as - input matrix. Supports CV_8U, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F. - @param src input hppiMatrix. - @param dst output matrix. - @param accel accelerator instance (see hpp::getHpp for the list of acceleration framework types). - @param cn number of channels. - */ - inline void copyHppToMat(hppiMatrix* src, Mat& dst, hppAccel accel, int cn) - { - hppDataType type; - hpp32u width, height; - hppStatus sts; - - if (src == NULL) - return dst.release(); - - sts = hppiInquireMatrix(src, &type, &width, &height); - - CV_Assert( sts == HPP_STATUS_NO_ERROR); - - int matType = CV_MAKETYPE(toCvType(type), cn); - - CV_Assert(width%cn == 0); - - width /= cn; - - dst.create((int)height, (int)width, (int)matType); - - size_t newSize = (size_t)(height*(hpp32u)(dst.step)); - - sts = hppiGetMatrixData(accel,src,(hpp32u)(dst.step),dst.data,&newSize); - - CV_Assert( sts == HPP_STATUS_NO_ERROR); - } - - /** @brief Create Mat from hppiMatrix. - - This function allocates and initializes the Mat that has the same size and type as input matrix. - Supports CV_8U, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F. - @param src input hppiMatrix. - @param accel accelerator instance (see hpp::getHpp for the list of acceleration framework types). - @param cn number of channels. - @sa howToUseIPPAconversion, hpp::copyHppToMat, hpp::getHpp. - */ - inline Mat getMat(hppiMatrix* src, hppAccel accel, int cn) - { - Mat dst; - copyHppToMat(src, dst, accel, cn); - return dst; - } - - /** @brief Create hppiMatrix from Mat. - - This function allocates and initializes the hppiMatrix that has the same size and type as input - matrix, returns the hppiMatrix*. - - If you want to use zero-copy for GPU you should to have 4KB aligned matrix data. See details - [hppiCreateSharedMatrix](http://software.intel.com/ru-ru/node/501697). - - Supports CV_8U, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F. - - @note The hppiMatrix pointer to the image buffer in system memory refers to the src.data. Control - the lifetime of the matrix and don't change its data, if there is no special need. - @param src input matrix. - @param accel accelerator instance. Supports type: - - **HPP_ACCEL_TYPE_CPU** - accelerated by optimized CPU instructions. - - **HPP_ACCEL_TYPE_GPU** - accelerated by GPU programmable units or fixed-function - accelerators. - - **HPP_ACCEL_TYPE_ANY** - any acceleration or no acceleration available. - @sa howToUseIPPAconversion, hpp::getMat - */ - inline hppiMatrix* getHpp(const Mat& src, hppAccel accel) - { - int htype = toHppType(src.type()); - int cn = src.channels(); - - CV_Assert(src.data); - hppAccelType accelType = hppQueryAccelType(accel); - - if (accelType!=HPP_ACCEL_TYPE_CPU) - { - hpp32u pitch, size; - hppQueryMatrixAllocParams(accel, src.cols*cn, src.rows, htype, &pitch, &size); - if (pitch!=0 && size!=0) - if ((int)(src.data)%4096==0 && pitch==(hpp32u)(src.step)) - { - return hppiCreateSharedMatrix(htype, src.cols*cn, src.rows, src.data, pitch, size); - } - } - - return hppiCreateMatrix(htype, src.cols*cn, src.rows, src.data, (hpp32s)(src.step));; - } - -//! @} -}} - -#endif - -#endif diff --git a/opencv/include/opencv2/core/mat.hpp b/opencv/include/opencv2/core/mat.hpp deleted file mode 100644 index 2c23a2a..0000000 --- a/opencv/include/opencv2/core/mat.hpp +++ /dev/null @@ -1,3761 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_MAT_HPP -#define OPENCV_CORE_MAT_HPP - -#ifndef __cplusplus -# error mat.hpp header must be compiled as C++ -#endif - -#include "opencv2/core/matx.hpp" -#include "opencv2/core/types.hpp" - -#include "opencv2/core/bufferpool.hpp" - -#ifdef CV_CXX11 -#include -#endif - -namespace cv -{ - -//! @addtogroup core_basic -//! @{ - -enum { ACCESS_READ=1<<24, ACCESS_WRITE=1<<25, - ACCESS_RW=3<<24, ACCESS_MASK=ACCESS_RW, ACCESS_FAST=1<<26 }; - -CV__DEBUG_NS_BEGIN - -class CV_EXPORTS _OutputArray; - -//////////////////////// Input/Output Array Arguments ///////////////////////////////// - -/** @brief This is the proxy class for passing read-only input arrays into OpenCV functions. - -It is defined as: -@code - typedef const _InputArray& InputArray; -@endcode -where _InputArray is a class that can be constructed from `Mat`, `Mat_`, `Matx`, -`std::vector`, `std::vector >`, `std::vector`, `std::vector >`, -`UMat`, `std::vector` or `double`. It can also be constructed from a matrix expression. - -Since this is mostly implementation-level class, and its interface may change in future versions, we -do not describe it in details. There are a few key things, though, that should be kept in mind: - -- When you see in the reference manual or in OpenCV source code a function that takes - InputArray, it means that you can actually pass `Mat`, `Matx`, `vector` etc. (see above the - complete list). -- Optional input arguments: If some of the input arrays may be empty, pass cv::noArray() (or - simply cv::Mat() as you probably did before). -- The class is designed solely for passing parameters. That is, normally you *should not* - declare class members, local and global variables of this type. -- If you want to design your own function or a class method that can operate of arrays of - multiple types, you can use InputArray (or OutputArray) for the respective parameters. Inside - a function you should use _InputArray::getMat() method to construct a matrix header for the - array (without copying data). _InputArray::kind() can be used to distinguish Mat from - `vector<>` etc., but normally it is not needed. - -Here is how you can use a function that takes InputArray : -@code - std::vector vec; - // points or a circle - for( int i = 0; i < 30; i++ ) - vec.push_back(Point2f((float)(100 + 30*cos(i*CV_PI*2/5)), - (float)(100 - 30*sin(i*CV_PI*2/5)))); - cv::transform(vec, vec, cv::Matx23f(0.707, -0.707, 10, 0.707, 0.707, 20)); -@endcode -That is, we form an STL vector containing points, and apply in-place affine transformation to the -vector using the 2x3 matrix created inline as `Matx` instance. - -Here is how such a function can be implemented (for simplicity, we implement a very specific case of -it, according to the assertion statement inside) : -@code - void myAffineTransform(InputArray _src, OutputArray _dst, InputArray _m) - { - // get Mat headers for input arrays. This is O(1) operation, - // unless _src and/or _m are matrix expressions. - Mat src = _src.getMat(), m = _m.getMat(); - CV_Assert( src.type() == CV_32FC2 && m.type() == CV_32F && m.size() == Size(3, 2) ); - - // [re]create the output array so that it has the proper size and type. - // In case of Mat it calls Mat::create, in case of STL vector it calls vector::resize. - _dst.create(src.size(), src.type()); - Mat dst = _dst.getMat(); - - for( int i = 0; i < src.rows; i++ ) - for( int j = 0; j < src.cols; j++ ) - { - Point2f pt = src.at(i, j); - dst.at(i, j) = Point2f(m.at(0, 0)*pt.x + - m.at(0, 1)*pt.y + - m.at(0, 2), - m.at(1, 0)*pt.x + - m.at(1, 1)*pt.y + - m.at(1, 2)); - } - } -@endcode -There is another related type, InputArrayOfArrays, which is currently defined as a synonym for -InputArray: -@code - typedef InputArray InputArrayOfArrays; -@endcode -It denotes function arguments that are either vectors of vectors or vectors of matrices. A separate -synonym is needed to generate Python/Java etc. wrappers properly. At the function implementation -level their use is similar, but _InputArray::getMat(idx) should be used to get header for the -idx-th component of the outer vector and _InputArray::size().area() should be used to find the -number of components (vectors/matrices) of the outer vector. - -In general, type support is limited to cv::Mat types. Other types are forbidden. -But in some cases we need to support passing of custom non-general Mat types, like arrays of cv::KeyPoint, cv::DMatch, etc. -This data is not intented to be interpreted as an image data, or processed somehow like regular cv::Mat. -To pass such custom type use rawIn() / rawOut() / rawInOut() wrappers. -Custom type is wrapped as Mat-compatible `CV_8UC` values (N = sizeof(T), N <= CV_CN_MAX). - */ -class CV_EXPORTS _InputArray -{ -public: - enum { - KIND_SHIFT = 16, - FIXED_TYPE = 0x8000 << KIND_SHIFT, - FIXED_SIZE = 0x4000 << KIND_SHIFT, - KIND_MASK = 31 << KIND_SHIFT, - - NONE = 0 << KIND_SHIFT, - MAT = 1 << KIND_SHIFT, - MATX = 2 << KIND_SHIFT, - STD_VECTOR = 3 << KIND_SHIFT, - STD_VECTOR_VECTOR = 4 << KIND_SHIFT, - STD_VECTOR_MAT = 5 << KIND_SHIFT, - EXPR = 6 << KIND_SHIFT, - OPENGL_BUFFER = 7 << KIND_SHIFT, - CUDA_HOST_MEM = 8 << KIND_SHIFT, - CUDA_GPU_MAT = 9 << KIND_SHIFT, - UMAT =10 << KIND_SHIFT, - STD_VECTOR_UMAT =11 << KIND_SHIFT, - STD_BOOL_VECTOR =12 << KIND_SHIFT, - STD_VECTOR_CUDA_GPU_MAT = 13 << KIND_SHIFT, - STD_ARRAY =14 << KIND_SHIFT, - STD_ARRAY_MAT =15 << KIND_SHIFT - }; - - _InputArray(); - _InputArray(int _flags, void* _obj); - _InputArray(const Mat& m); - _InputArray(const MatExpr& expr); - _InputArray(const std::vector& vec); - template _InputArray(const Mat_<_Tp>& m); - template _InputArray(const std::vector<_Tp>& vec); - _InputArray(const std::vector& vec); - template _InputArray(const std::vector >& vec); - _InputArray(const std::vector >&); - template _InputArray(const std::vector >& vec); - template _InputArray(const _Tp* vec, int n); - template _InputArray(const Matx<_Tp, m, n>& matx); - _InputArray(const double& val); - _InputArray(const cuda::GpuMat& d_mat); - _InputArray(const std::vector& d_mat_array); - _InputArray(const ogl::Buffer& buf); - _InputArray(const cuda::HostMem& cuda_mem); - template _InputArray(const cudev::GpuMat_<_Tp>& m); - _InputArray(const UMat& um); - _InputArray(const std::vector& umv); - -#ifdef CV_CXX_STD_ARRAY - template _InputArray(const std::array<_Tp, _Nm>& arr); - template _InputArray(const std::array& arr); -#endif - - template static _InputArray rawIn(const std::vector<_Tp>& vec); -#ifdef CV_CXX_STD_ARRAY - template static _InputArray rawIn(const std::array<_Tp, _Nm>& arr); -#endif - - Mat getMat(int idx=-1) const; - Mat getMat_(int idx=-1) const; - UMat getUMat(int idx=-1) const; - void getMatVector(std::vector& mv) const; - void getUMatVector(std::vector& umv) const; - void getGpuMatVector(std::vector& gpumv) const; - cuda::GpuMat getGpuMat() const; - ogl::Buffer getOGlBuffer() const; - - int getFlags() const; - void* getObj() const; - Size getSz() const; - - int kind() const; - int dims(int i=-1) const; - int cols(int i=-1) const; - int rows(int i=-1) const; - Size size(int i=-1) const; - int sizend(int* sz, int i=-1) const; - bool sameSize(const _InputArray& arr) const; - size_t total(int i=-1) const; - int type(int i=-1) const; - int depth(int i=-1) const; - int channels(int i=-1) const; - bool isContinuous(int i=-1) const; - bool isSubmatrix(int i=-1) const; - bool empty() const; - void copyTo(const _OutputArray& arr) const; - void copyTo(const _OutputArray& arr, const _InputArray & mask) const; - size_t offset(int i=-1) const; - size_t step(int i=-1) const; - bool isMat() const; - bool isUMat() const; - bool isMatVector() const; - bool isUMatVector() const; - bool isMatx() const; - bool isVector() const; - bool isGpuMat() const; - bool isGpuMatVector() const; - ~_InputArray(); - -protected: - int flags; - void* obj; - Size sz; - - void init(int _flags, const void* _obj); - void init(int _flags, const void* _obj, Size _sz); -}; - - -/** @brief This type is very similar to InputArray except that it is used for input/output and output function -parameters. - -Just like with InputArray, OpenCV users should not care about OutputArray, they just pass `Mat`, -`vector` etc. to the functions. The same limitation as for `InputArray`: *Do not explicitly -create OutputArray instances* applies here too. - -If you want to make your function polymorphic (i.e. accept different arrays as output parameters), -it is also not very difficult. Take the sample above as the reference. Note that -_OutputArray::create() needs to be called before _OutputArray::getMat(). This way you guarantee -that the output array is properly allocated. - -Optional output parameters. If you do not need certain output array to be computed and returned to -you, pass cv::noArray(), just like you would in the case of optional input array. At the -implementation level, use _OutputArray::needed() to check if certain output array needs to be -computed or not. - -There are several synonyms for OutputArray that are used to assist automatic Python/Java/... wrapper -generators: -@code - typedef OutputArray OutputArrayOfArrays; - typedef OutputArray InputOutputArray; - typedef OutputArray InputOutputArrayOfArrays; -@endcode - */ -class CV_EXPORTS _OutputArray : public _InputArray -{ -public: - enum - { - DEPTH_MASK_8U = 1 << CV_8U, - DEPTH_MASK_8S = 1 << CV_8S, - DEPTH_MASK_16U = 1 << CV_16U, - DEPTH_MASK_16S = 1 << CV_16S, - DEPTH_MASK_32S = 1 << CV_32S, - DEPTH_MASK_32F = 1 << CV_32F, - DEPTH_MASK_64F = 1 << CV_64F, - DEPTH_MASK_ALL = (DEPTH_MASK_64F<<1)-1, - DEPTH_MASK_ALL_BUT_8S = DEPTH_MASK_ALL & ~DEPTH_MASK_8S, - DEPTH_MASK_FLT = DEPTH_MASK_32F + DEPTH_MASK_64F - }; - - _OutputArray(); - _OutputArray(int _flags, void* _obj); - _OutputArray(Mat& m); - _OutputArray(std::vector& vec); - _OutputArray(cuda::GpuMat& d_mat); - _OutputArray(std::vector& d_mat); - _OutputArray(ogl::Buffer& buf); - _OutputArray(cuda::HostMem& cuda_mem); - template _OutputArray(cudev::GpuMat_<_Tp>& m); - template _OutputArray(std::vector<_Tp>& vec); - _OutputArray(std::vector& vec); - template _OutputArray(std::vector >& vec); - _OutputArray(std::vector >&); - template _OutputArray(std::vector >& vec); - template _OutputArray(Mat_<_Tp>& m); - template _OutputArray(_Tp* vec, int n); - template _OutputArray(Matx<_Tp, m, n>& matx); - _OutputArray(UMat& m); - _OutputArray(std::vector& vec); - - _OutputArray(const Mat& m); - _OutputArray(const std::vector& vec); - _OutputArray(const cuda::GpuMat& d_mat); - _OutputArray(const std::vector& d_mat); - _OutputArray(const ogl::Buffer& buf); - _OutputArray(const cuda::HostMem& cuda_mem); - template _OutputArray(const cudev::GpuMat_<_Tp>& m); - template _OutputArray(const std::vector<_Tp>& vec); - template _OutputArray(const std::vector >& vec); - template _OutputArray(const std::vector >& vec); - template _OutputArray(const Mat_<_Tp>& m); - template _OutputArray(const _Tp* vec, int n); - template _OutputArray(const Matx<_Tp, m, n>& matx); - _OutputArray(const UMat& m); - _OutputArray(const std::vector& vec); - -#ifdef CV_CXX_STD_ARRAY - template _OutputArray(std::array<_Tp, _Nm>& arr); - template _OutputArray(const std::array<_Tp, _Nm>& arr); - template _OutputArray(std::array& arr); - template _OutputArray(const std::array& arr); -#endif - - template static _OutputArray rawOut(std::vector<_Tp>& vec); -#ifdef CV_CXX_STD_ARRAY - template static _OutputArray rawOut(std::array<_Tp, _Nm>& arr); -#endif - - bool fixedSize() const; - bool fixedType() const; - bool needed() const; - Mat& getMatRef(int i=-1) const; - UMat& getUMatRef(int i=-1) const; - cuda::GpuMat& getGpuMatRef() const; - std::vector& getGpuMatVecRef() const; - ogl::Buffer& getOGlBufferRef() const; - cuda::HostMem& getHostMemRef() const; - void create(Size sz, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const; - void create(int rows, int cols, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const; - void create(int dims, const int* size, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const; - void createSameSize(const _InputArray& arr, int mtype) const; - void release() const; - void clear() const; - void setTo(const _InputArray& value, const _InputArray & mask = _InputArray()) const; - - void assign(const UMat& u) const; - void assign(const Mat& m) const; - - void assign(const std::vector& v) const; - void assign(const std::vector& v) const; -}; - - -class CV_EXPORTS _InputOutputArray : public _OutputArray -{ -public: - _InputOutputArray(); - _InputOutputArray(int _flags, void* _obj); - _InputOutputArray(Mat& m); - _InputOutputArray(std::vector& vec); - _InputOutputArray(cuda::GpuMat& d_mat); - _InputOutputArray(ogl::Buffer& buf); - _InputOutputArray(cuda::HostMem& cuda_mem); - template _InputOutputArray(cudev::GpuMat_<_Tp>& m); - template _InputOutputArray(std::vector<_Tp>& vec); - _InputOutputArray(std::vector& vec); - template _InputOutputArray(std::vector >& vec); - template _InputOutputArray(std::vector >& vec); - template _InputOutputArray(Mat_<_Tp>& m); - template _InputOutputArray(_Tp* vec, int n); - template _InputOutputArray(Matx<_Tp, m, n>& matx); - _InputOutputArray(UMat& m); - _InputOutputArray(std::vector& vec); - - _InputOutputArray(const Mat& m); - _InputOutputArray(const std::vector& vec); - _InputOutputArray(const cuda::GpuMat& d_mat); - _InputOutputArray(const std::vector& d_mat); - _InputOutputArray(const ogl::Buffer& buf); - _InputOutputArray(const cuda::HostMem& cuda_mem); - template _InputOutputArray(const cudev::GpuMat_<_Tp>& m); - template _InputOutputArray(const std::vector<_Tp>& vec); - template _InputOutputArray(const std::vector >& vec); - template _InputOutputArray(const std::vector >& vec); - template _InputOutputArray(const Mat_<_Tp>& m); - template _InputOutputArray(const _Tp* vec, int n); - template _InputOutputArray(const Matx<_Tp, m, n>& matx); - _InputOutputArray(const UMat& m); - _InputOutputArray(const std::vector& vec); - -#ifdef CV_CXX_STD_ARRAY - template _InputOutputArray(std::array<_Tp, _Nm>& arr); - template _InputOutputArray(const std::array<_Tp, _Nm>& arr); - template _InputOutputArray(std::array& arr); - template _InputOutputArray(const std::array& arr); -#endif - - template static _InputOutputArray rawInOut(std::vector<_Tp>& vec); -#ifdef CV_CXX_STD_ARRAY - template _InputOutputArray rawInOut(std::array<_Tp, _Nm>& arr); -#endif - -}; - -/** Helper to wrap custom types. @see InputArray */ -template static inline _InputArray rawIn(_Tp& v); -/** Helper to wrap custom types. @see InputArray */ -template static inline _OutputArray rawOut(_Tp& v); -/** Helper to wrap custom types. @see InputArray */ -template static inline _InputOutputArray rawInOut(_Tp& v); - -CV__DEBUG_NS_END - -typedef const _InputArray& InputArray; -typedef InputArray InputArrayOfArrays; -typedef const _OutputArray& OutputArray; -typedef OutputArray OutputArrayOfArrays; -typedef const _InputOutputArray& InputOutputArray; -typedef InputOutputArray InputOutputArrayOfArrays; - -CV_EXPORTS InputOutputArray noArray(); - -/////////////////////////////////// MatAllocator ////////////////////////////////////// - -//! Usage flags for allocator -enum UMatUsageFlags -{ - USAGE_DEFAULT = 0, - - // buffer allocation policy is platform and usage specific - USAGE_ALLOCATE_HOST_MEMORY = 1 << 0, - USAGE_ALLOCATE_DEVICE_MEMORY = 1 << 1, - USAGE_ALLOCATE_SHARED_MEMORY = 1 << 2, // It is not equal to: USAGE_ALLOCATE_HOST_MEMORY | USAGE_ALLOCATE_DEVICE_MEMORY - - __UMAT_USAGE_FLAGS_32BIT = 0x7fffffff // Binary compatibility hint -}; - -struct CV_EXPORTS UMatData; - -/** @brief Custom array allocator -*/ -class CV_EXPORTS MatAllocator -{ -public: - MatAllocator() {} - virtual ~MatAllocator() {} - - // let's comment it off for now to detect and fix all the uses of allocator - //virtual void allocate(int dims, const int* sizes, int type, int*& refcount, - // uchar*& datastart, uchar*& data, size_t* step) = 0; - //virtual void deallocate(int* refcount, uchar* datastart, uchar* data) = 0; - virtual UMatData* allocate(int dims, const int* sizes, int type, - void* data, size_t* step, int flags, UMatUsageFlags usageFlags) const = 0; - virtual bool allocate(UMatData* data, int accessflags, UMatUsageFlags usageFlags) const = 0; - virtual void deallocate(UMatData* data) const = 0; - virtual void map(UMatData* data, int accessflags) const; - virtual void unmap(UMatData* data) const; - virtual void download(UMatData* data, void* dst, int dims, const size_t sz[], - const size_t srcofs[], const size_t srcstep[], - const size_t dststep[]) const; - virtual void upload(UMatData* data, const void* src, int dims, const size_t sz[], - const size_t dstofs[], const size_t dststep[], - const size_t srcstep[]) const; - virtual void copy(UMatData* srcdata, UMatData* dstdata, int dims, const size_t sz[], - const size_t srcofs[], const size_t srcstep[], - const size_t dstofs[], const size_t dststep[], bool sync) const; - - // default implementation returns DummyBufferPoolController - virtual BufferPoolController* getBufferPoolController(const char* id = NULL) const; -}; - - -//////////////////////////////// MatCommaInitializer ////////////////////////////////// - -/** @brief Comma-separated Matrix Initializer - - The class instances are usually not created explicitly. - Instead, they are created on "matrix << firstValue" operator. - - The sample below initializes 2x2 rotation matrix: - - \code - double angle = 30, a = cos(angle*CV_PI/180), b = sin(angle*CV_PI/180); - Mat R = (Mat_(2,2) << a, -b, b, a); - \endcode -*/ -template class MatCommaInitializer_ -{ -public: - //! the constructor, created by "matrix << firstValue" operator, where matrix is cv::Mat - MatCommaInitializer_(Mat_<_Tp>* _m); - //! the operator that takes the next value and put it to the matrix - template MatCommaInitializer_<_Tp>& operator , (T2 v); - //! another form of conversion operator - operator Mat_<_Tp>() const; -protected: - MatIterator_<_Tp> it; -}; - - -/////////////////////////////////////// Mat /////////////////////////////////////////// - -// note that umatdata might be allocated together -// with the matrix data, not as a separate object. -// therefore, it does not have constructor or destructor; -// it should be explicitly initialized using init(). -struct CV_EXPORTS UMatData -{ - enum { COPY_ON_MAP=1, HOST_COPY_OBSOLETE=2, - DEVICE_COPY_OBSOLETE=4, TEMP_UMAT=8, TEMP_COPIED_UMAT=24, - USER_ALLOCATED=32, DEVICE_MEM_MAPPED=64, - ASYNC_CLEANUP=128 - }; - UMatData(const MatAllocator* allocator); - ~UMatData(); - - // provide atomic access to the structure - void lock(); - void unlock(); - - bool hostCopyObsolete() const; - bool deviceCopyObsolete() const; - bool deviceMemMapped() const; - bool copyOnMap() const; - bool tempUMat() const; - bool tempCopiedUMat() const; - void markHostCopyObsolete(bool flag); - void markDeviceCopyObsolete(bool flag); - void markDeviceMemMapped(bool flag); - - const MatAllocator* prevAllocator; - const MatAllocator* currAllocator; - int urefcount; - int refcount; - uchar* data; - uchar* origdata; - size_t size; - - int flags; - void* handle; - void* userdata; - int allocatorFlags_; - int mapcount; - UMatData* originalUMatData; -}; - - -struct CV_EXPORTS MatSize -{ - explicit MatSize(int* _p); - int dims() const; - Size operator()() const; - const int& operator[](int i) const; - int& operator[](int i); - operator const int*() const; // TODO OpenCV 4.0: drop this - bool operator == (const MatSize& sz) const; - bool operator != (const MatSize& sz) const; - - int* p; -}; - -struct CV_EXPORTS MatStep -{ - MatStep(); - explicit MatStep(size_t s); - const size_t& operator[](int i) const; - size_t& operator[](int i); - operator size_t() const; - MatStep& operator = (size_t s); - - size_t* p; - size_t buf[2]; -protected: - MatStep& operator = (const MatStep&); -}; - -/** @example samples/cpp/cout_mat.cpp -An example demonstrating the serial out capabilities of cv::Mat -*/ - - /** @brief n-dimensional dense array class \anchor CVMat_Details - -The class Mat represents an n-dimensional dense numerical single-channel or multi-channel array. It -can be used to store real or complex-valued vectors and matrices, grayscale or color images, voxel -volumes, vector fields, point clouds, tensors, histograms (though, very high-dimensional histograms -may be better stored in a SparseMat ). The data layout of the array `M` is defined by the array -`M.step[]`, so that the address of element \f$(i_0,...,i_{M.dims-1})\f$, where \f$0\leq i_k= M.step[i+1]` (in fact, `M.step[i] >= M.step[i+1]*M.size[i+1]` ). This means -that 2-dimensional matrices are stored row-by-row, 3-dimensional matrices are stored plane-by-plane, -and so on. M.step[M.dims-1] is minimal and always equal to the element size M.elemSize() . - -So, the data layout in Mat is fully compatible with CvMat, IplImage, and CvMatND types from OpenCV -1.x. It is also compatible with the majority of dense array types from the standard toolkits and -SDKs, such as Numpy (ndarray), Win32 (independent device bitmaps), and others, that is, with any -array that uses *steps* (or *strides*) to compute the position of a pixel. Due to this -compatibility, it is possible to make a Mat header for user-allocated data and process it in-place -using OpenCV functions. - -There are many different ways to create a Mat object. The most popular options are listed below: - -- Use the create(nrows, ncols, type) method or the similar Mat(nrows, ncols, type[, fillValue]) -constructor. A new array of the specified size and type is allocated. type has the same meaning as -in the cvCreateMat method. For example, CV_8UC1 means a 8-bit single-channel array, CV_32FC2 -means a 2-channel (complex) floating-point array, and so on. -@code - // make a 7x7 complex matrix filled with 1+3j. - Mat M(7,7,CV_32FC2,Scalar(1,3)); - // and now turn M to a 100x60 15-channel 8-bit matrix. - // The old content will be deallocated - M.create(100,60,CV_8UC(15)); -@endcode -As noted in the introduction to this chapter, create() allocates only a new array when the shape -or type of the current array are different from the specified ones. - -- Create a multi-dimensional array: -@code - // create a 100x100x100 8-bit array - int sz[] = {100, 100, 100}; - Mat bigCube(3, sz, CV_8U, Scalar::all(0)); -@endcode -It passes the number of dimensions =1 to the Mat constructor but the created array will be -2-dimensional with the number of columns set to 1. So, Mat::dims is always \>= 2 (can also be 0 -when the array is empty). - -- Use a copy constructor or assignment operator where there can be an array or expression on the -right side (see below). As noted in the introduction, the array assignment is an O(1) operation -because it only copies the header and increases the reference counter. The Mat::clone() method can -be used to get a full (deep) copy of the array when you need it. - -- Construct a header for a part of another array. It can be a single row, single column, several -rows, several columns, rectangular region in the array (called a *minor* in algebra) or a -diagonal. Such operations are also O(1) because the new header references the same data. You can -actually modify a part of the array using this feature, for example: -@code - // add the 5-th row, multiplied by 3 to the 3rd row - M.row(3) = M.row(3) + M.row(5)*3; - // now copy the 7-th column to the 1-st column - // M.col(1) = M.col(7); // this will not work - Mat M1 = M.col(1); - M.col(7).copyTo(M1); - // create a new 320x240 image - Mat img(Size(320,240),CV_8UC3); - // select a ROI - Mat roi(img, Rect(10,10,100,100)); - // fill the ROI with (0,255,0) (which is green in RGB space); - // the original 320x240 image will be modified - roi = Scalar(0,255,0); -@endcode -Due to the additional datastart and dataend members, it is possible to compute a relative -sub-array position in the main *container* array using locateROI(): -@code - Mat A = Mat::eye(10, 10, CV_32S); - // extracts A columns, 1 (inclusive) to 3 (exclusive). - Mat B = A(Range::all(), Range(1, 3)); - // extracts B rows, 5 (inclusive) to 9 (exclusive). - // that is, C \~ A(Range(5, 9), Range(1, 3)) - Mat C = B(Range(5, 9), Range::all()); - Size size; Point ofs; - C.locateROI(size, ofs); - // size will be (width=10,height=10) and the ofs will be (x=1, y=5) -@endcode -As in case of whole matrices, if you need a deep copy, use the `clone()` method of the extracted -sub-matrices. - -- Make a header for user-allocated data. It can be useful to do the following: - -# Process "foreign" data using OpenCV (for example, when you implement a DirectShow\* filter or - a processing module for gstreamer, and so on). For example: - @code - void process_video_frame(const unsigned char* pixels, - int width, int height, int step) - { - Mat img(height, width, CV_8UC3, pixels, step); - GaussianBlur(img, img, Size(7,7), 1.5, 1.5); - } - @endcode - -# Quickly initialize small matrices and/or get a super-fast element access. - @code - double m[3][3] = {{a, b, c}, {d, e, f}, {g, h, i}}; - Mat M = Mat(3, 3, CV_64F, m).inv(); - @endcode - . - Partial yet very common cases of this *user-allocated data* case are conversions from CvMat and - IplImage to Mat. For this purpose, there is function cv::cvarrToMat taking pointers to CvMat or - IplImage and the optional flag indicating whether to copy the data or not. - @snippet samples/cpp/image.cpp iplimage - -- Use MATLAB-style array initializers, zeros(), ones(), eye(), for example: -@code - // create a double-precision identity matrix and add it to M. - M += Mat::eye(M.rows, M.cols, CV_64F); -@endcode - -- Use a comma-separated initializer: -@code - // create a 3x3 double-precision identity matrix - Mat M = (Mat_(3,3) << 1, 0, 0, 0, 1, 0, 0, 0, 1); -@endcode -With this approach, you first call a constructor of the Mat class with the proper parameters, and -then you just put `<< operator` followed by comma-separated values that can be constants, -variables, expressions, and so on. Also, note the extra parentheses required to avoid compilation -errors. - -Once the array is created, it is automatically managed via a reference-counting mechanism. If the -array header is built on top of user-allocated data, you should handle the data by yourself. The -array data is deallocated when no one points to it. If you want to release the data pointed by a -array header before the array destructor is called, use Mat::release(). - -The next important thing to learn about the array class is element access. This manual already -described how to compute an address of each array element. Normally, you are not required to use the -formula directly in the code. If you know the array element type (which can be retrieved using the -method Mat::type() ), you can access the element \f$M_{ij}\f$ of a 2-dimensional array as: -@code - M.at(i,j) += 1.f; -@endcode -assuming that `M` is a double-precision floating-point array. There are several variants of the method -at for a different number of dimensions. - -If you need to process a whole row of a 2D array, the most efficient way is to get the pointer to -the row first, and then just use the plain C operator [] : -@code - // compute sum of positive matrix elements - // (assuming that M is a double-precision matrix) - double sum=0; - for(int i = 0; i < M.rows; i++) - { - const double* Mi = M.ptr(i); - for(int j = 0; j < M.cols; j++) - sum += std::max(Mi[j], 0.); - } -@endcode -Some operations, like the one above, do not actually depend on the array shape. They just process -elements of an array one by one (or elements from multiple arrays that have the same coordinates, -for example, array addition). Such operations are called *element-wise*. It makes sense to check -whether all the input/output arrays are continuous, namely, have no gaps at the end of each row. If -yes, process them as a long single row: -@code - // compute the sum of positive matrix elements, optimized variant - double sum=0; - int cols = M.cols, rows = M.rows; - if(M.isContinuous()) - { - cols *= rows; - rows = 1; - } - for(int i = 0; i < rows; i++) - { - const double* Mi = M.ptr(i); - for(int j = 0; j < cols; j++) - sum += std::max(Mi[j], 0.); - } -@endcode -In case of the continuous matrix, the outer loop body is executed just once. So, the overhead is -smaller, which is especially noticeable in case of small matrices. - -Finally, there are STL-style iterators that are smart enough to skip gaps between successive rows: -@code - // compute sum of positive matrix elements, iterator-based variant - double sum=0; - MatConstIterator_ it = M.begin(), it_end = M.end(); - for(; it != it_end; ++it) - sum += std::max(*it, 0.); -@endcode -The matrix iterators are random-access iterators, so they can be passed to any STL algorithm, -including std::sort(). - -@note Matrix Expressions and arithmetic see MatExpr -*/ -class CV_EXPORTS Mat -{ -public: - /** - These are various constructors that form a matrix. As noted in the AutomaticAllocation, often - the default constructor is enough, and the proper matrix will be allocated by an OpenCV function. - The constructed matrix can further be assigned to another matrix or matrix expression or can be - allocated with Mat::create . In the former case, the old content is de-referenced. - */ - Mat(); - - /** @overload - @param rows Number of rows in a 2D array. - @param cols Number of columns in a 2D array. - @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or - CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - */ - Mat(int rows, int cols, int type); - - /** @overload - @param size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the - number of columns go in the reverse order. - @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or - CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - */ - Mat(Size size, int type); - - /** @overload - @param rows Number of rows in a 2D array. - @param cols Number of columns in a 2D array. - @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or - CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - @param s An optional value to initialize each matrix element with. To set all the matrix elements to - the particular value after the construction, use the assignment operator - Mat::operator=(const Scalar& value) . - */ - Mat(int rows, int cols, int type, const Scalar& s); - - /** @overload - @param size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the - number of columns go in the reverse order. - @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or - CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - @param s An optional value to initialize each matrix element with. To set all the matrix elements to - the particular value after the construction, use the assignment operator - Mat::operator=(const Scalar& value) . - */ - Mat(Size size, int type, const Scalar& s); - - /** @overload - @param ndims Array dimensionality. - @param sizes Array of integers specifying an n-dimensional array shape. - @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or - CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - */ - Mat(int ndims, const int* sizes, int type); - - /** @overload - @param sizes Array of integers specifying an n-dimensional array shape. - @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or - CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - */ - Mat(const std::vector& sizes, int type); - - /** @overload - @param ndims Array dimensionality. - @param sizes Array of integers specifying an n-dimensional array shape. - @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or - CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - @param s An optional value to initialize each matrix element with. To set all the matrix elements to - the particular value after the construction, use the assignment operator - Mat::operator=(const Scalar& value) . - */ - Mat(int ndims, const int* sizes, int type, const Scalar& s); - - /** @overload - @param sizes Array of integers specifying an n-dimensional array shape. - @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or - CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - @param s An optional value to initialize each matrix element with. To set all the matrix elements to - the particular value after the construction, use the assignment operator - Mat::operator=(const Scalar& value) . - */ - Mat(const std::vector& sizes, int type, const Scalar& s); - - - /** @overload - @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied - by these constructors. Instead, the header pointing to m data or its sub-array is constructed and - associated with it. The reference counter, if any, is incremented. So, when you modify the matrix - formed using such a constructor, you also modify the corresponding elements of m . If you want to - have an independent copy of the sub-array, use Mat::clone() . - */ - Mat(const Mat& m); - - /** @overload - @param rows Number of rows in a 2D array. - @param cols Number of columns in a 2D array. - @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or - CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - @param data Pointer to the user data. Matrix constructors that take data and step parameters do not - allocate matrix data. Instead, they just initialize the matrix header that points to the specified - data, which means that no data is copied. This operation is very efficient and can be used to - process external data using OpenCV functions. The external data is not automatically deallocated, so - you should take care of it. - @param step Number of bytes each matrix row occupies. The value should include the padding bytes at - the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is assumed - and the actual step is calculated as cols*elemSize(). See Mat::elemSize. - */ - Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP); - - /** @overload - @param size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the - number of columns go in the reverse order. - @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or - CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - @param data Pointer to the user data. Matrix constructors that take data and step parameters do not - allocate matrix data. Instead, they just initialize the matrix header that points to the specified - data, which means that no data is copied. This operation is very efficient and can be used to - process external data using OpenCV functions. The external data is not automatically deallocated, so - you should take care of it. - @param step Number of bytes each matrix row occupies. The value should include the padding bytes at - the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is assumed - and the actual step is calculated as cols*elemSize(). See Mat::elemSize. - */ - Mat(Size size, int type, void* data, size_t step=AUTO_STEP); - - /** @overload - @param ndims Array dimensionality. - @param sizes Array of integers specifying an n-dimensional array shape. - @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or - CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - @param data Pointer to the user data. Matrix constructors that take data and step parameters do not - allocate matrix data. Instead, they just initialize the matrix header that points to the specified - data, which means that no data is copied. This operation is very efficient and can be used to - process external data using OpenCV functions. The external data is not automatically deallocated, so - you should take care of it. - @param steps Array of ndims-1 steps in case of a multi-dimensional array (the last step is always - set to the element size). If not specified, the matrix is assumed to be continuous. - */ - Mat(int ndims, const int* sizes, int type, void* data, const size_t* steps=0); - - /** @overload - @param sizes Array of integers specifying an n-dimensional array shape. - @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or - CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - @param data Pointer to the user data. Matrix constructors that take data and step parameters do not - allocate matrix data. Instead, they just initialize the matrix header that points to the specified - data, which means that no data is copied. This operation is very efficient and can be used to - process external data using OpenCV functions. The external data is not automatically deallocated, so - you should take care of it. - @param steps Array of ndims-1 steps in case of a multi-dimensional array (the last step is always - set to the element size). If not specified, the matrix is assumed to be continuous. - */ - Mat(const std::vector& sizes, int type, void* data, const size_t* steps=0); - - /** @overload - @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied - by these constructors. Instead, the header pointing to m data or its sub-array is constructed and - associated with it. The reference counter, if any, is incremented. So, when you modify the matrix - formed using such a constructor, you also modify the corresponding elements of m . If you want to - have an independent copy of the sub-array, use Mat::clone() . - @param rowRange Range of the m rows to take. As usual, the range start is inclusive and the range - end is exclusive. Use Range::all() to take all the rows. - @param colRange Range of the m columns to take. Use Range::all() to take all the columns. - */ - Mat(const Mat& m, const Range& rowRange, const Range& colRange=Range::all()); - - /** @overload - @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied - by these constructors. Instead, the header pointing to m data or its sub-array is constructed and - associated with it. The reference counter, if any, is incremented. So, when you modify the matrix - formed using such a constructor, you also modify the corresponding elements of m . If you want to - have an independent copy of the sub-array, use Mat::clone() . - @param roi Region of interest. - */ - Mat(const Mat& m, const Rect& roi); - - /** @overload - @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied - by these constructors. Instead, the header pointing to m data or its sub-array is constructed and - associated with it. The reference counter, if any, is incremented. So, when you modify the matrix - formed using such a constructor, you also modify the corresponding elements of m . If you want to - have an independent copy of the sub-array, use Mat::clone() . - @param ranges Array of selected ranges of m along each dimensionality. - */ - Mat(const Mat& m, const Range* ranges); - - /** @overload - @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied - by these constructors. Instead, the header pointing to m data or its sub-array is constructed and - associated with it. The reference counter, if any, is incremented. So, when you modify the matrix - formed using such a constructor, you also modify the corresponding elements of m . If you want to - have an independent copy of the sub-array, use Mat::clone() . - @param ranges Array of selected ranges of m along each dimensionality. - */ - Mat(const Mat& m, const std::vector& ranges); - - /** @overload - @param vec STL vector whose elements form the matrix. The matrix has a single column and the number - of rows equal to the number of vector elements. Type of the matrix matches the type of vector - elements. The constructor can handle arbitrary types, for which there is a properly declared - DataType . This means that the vector elements must be primitive numbers or uni-type numerical - tuples of numbers. Mixed-type structures are not supported. The corresponding constructor is - explicit. Since STL vectors are not automatically converted to Mat instances, you should write - Mat(vec) explicitly. Unless you copy the data into the matrix ( copyData=true ), no new elements - will be added to the vector because it can potentially yield vector data reallocation, and, thus, - the matrix data pointer will be invalid. - @param copyData Flag to specify whether the underlying data of the STL vector should be copied - to (true) or shared with (false) the newly constructed matrix. When the data is copied, the - allocated buffer is managed using Mat reference counting mechanism. While the data is shared, - the reference counter is NULL, and you should not deallocate the data until the matrix is not - destructed. - */ - template explicit Mat(const std::vector<_Tp>& vec, bool copyData=false); - -#ifdef CV_CXX11 - /** @overload - */ - template::value>::type> - explicit Mat(const std::initializer_list<_Tp> list); - - /** @overload - */ - template explicit Mat(const std::initializer_list sizes, const std::initializer_list<_Tp> list); -#endif - -#ifdef CV_CXX_STD_ARRAY - /** @overload - */ - template explicit Mat(const std::array<_Tp, _Nm>& arr, bool copyData=false); -#endif - - /** @overload - */ - template explicit Mat(const Vec<_Tp, n>& vec, bool copyData=true); - - /** @overload - */ - template explicit Mat(const Matx<_Tp, m, n>& mtx, bool copyData=true); - - /** @overload - */ - template explicit Mat(const Point_<_Tp>& pt, bool copyData=true); - - /** @overload - */ - template explicit Mat(const Point3_<_Tp>& pt, bool copyData=true); - - /** @overload - */ - template explicit Mat(const MatCommaInitializer_<_Tp>& commaInitializer); - - //! download data from GpuMat - explicit Mat(const cuda::GpuMat& m); - - //! destructor - calls release() - ~Mat(); - - /** @brief assignment operators - - These are available assignment operators. Since they all are very different, make sure to read the - operator parameters description. - @param m Assigned, right-hand-side matrix. Matrix assignment is an O(1) operation. This means that - no data is copied but the data is shared and the reference counter, if any, is incremented. Before - assigning new data, the old data is de-referenced via Mat::release . - */ - Mat& operator = (const Mat& m); - - /** @overload - @param expr Assigned matrix expression object. As opposite to the first form of the assignment - operation, the second form can reuse already allocated matrix if it has the right size and type to - fit the matrix expression result. It is automatically handled by the real function that the matrix - expressions is expanded to. For example, C=A+B is expanded to add(A, B, C), and add takes care of - automatic C reallocation. - */ - Mat& operator = (const MatExpr& expr); - - //! retrieve UMat from Mat - UMat getUMat(int accessFlags, UMatUsageFlags usageFlags = USAGE_DEFAULT) const; - - /** @brief Creates a matrix header for the specified matrix row. - - The method makes a new header for the specified matrix row and returns it. This is an O(1) - operation, regardless of the matrix size. The underlying data of the new matrix is shared with the - original matrix. Here is the example of one of the classical basic matrix processing operations, - axpy, used by LU and many other algorithms: - @code - inline void matrix_axpy(Mat& A, int i, int j, double alpha) - { - A.row(i) += A.row(j)*alpha; - } - @endcode - @note In the current implementation, the following code does not work as expected: - @code - Mat A; - ... - A.row(i) = A.row(j); // will not work - @endcode - This happens because A.row(i) forms a temporary header that is further assigned to another header. - Remember that each of these operations is O(1), that is, no data is copied. Thus, the above - assignment is not true if you may have expected the j-th row to be copied to the i-th row. To - achieve that, you should either turn this simple assignment into an expression or use the - Mat::copyTo method: - @code - Mat A; - ... - // works, but looks a bit obscure. - A.row(i) = A.row(j) + 0; - // this is a bit longer, but the recommended method. - A.row(j).copyTo(A.row(i)); - @endcode - @param y A 0-based row index. - */ - Mat row(int y) const; - - /** @brief Creates a matrix header for the specified matrix column. - - The method makes a new header for the specified matrix column and returns it. This is an O(1) - operation, regardless of the matrix size. The underlying data of the new matrix is shared with the - original matrix. See also the Mat::row description. - @param x A 0-based column index. - */ - Mat col(int x) const; - - /** @brief Creates a matrix header for the specified row span. - - The method makes a new header for the specified row span of the matrix. Similarly to Mat::row and - Mat::col , this is an O(1) operation. - @param startrow An inclusive 0-based start index of the row span. - @param endrow An exclusive 0-based ending index of the row span. - */ - Mat rowRange(int startrow, int endrow) const; - - /** @overload - @param r Range structure containing both the start and the end indices. - */ - Mat rowRange(const Range& r) const; - - /** @brief Creates a matrix header for the specified column span. - - The method makes a new header for the specified column span of the matrix. Similarly to Mat::row and - Mat::col , this is an O(1) operation. - @param startcol An inclusive 0-based start index of the column span. - @param endcol An exclusive 0-based ending index of the column span. - */ - Mat colRange(int startcol, int endcol) const; - - /** @overload - @param r Range structure containing both the start and the end indices. - */ - Mat colRange(const Range& r) const; - - /** @brief Extracts a diagonal from a matrix - - The method makes a new header for the specified matrix diagonal. The new matrix is represented as a - single-column matrix. Similarly to Mat::row and Mat::col, this is an O(1) operation. - @param d index of the diagonal, with the following values: - - `d=0` is the main diagonal. - - `d<0` is a diagonal from the lower half. For example, d=-1 means the diagonal is set - immediately below the main one. - - `d>0` is a diagonal from the upper half. For example, d=1 means the diagonal is set - immediately above the main one. - For example: - @code - Mat m = (Mat_(3,3) << - 1,2,3, - 4,5,6, - 7,8,9); - Mat d0 = m.diag(0); - Mat d1 = m.diag(1); - Mat d_1 = m.diag(-1); - @endcode - The resulting matrices are - @code - d0 = - [1; - 5; - 9] - d1 = - [2; - 6] - d_1 = - [4; - 8] - @endcode - */ - Mat diag(int d=0) const; - - /** @brief creates a diagonal matrix - - The method creates a square diagonal matrix from specified main diagonal. - @param d One-dimensional matrix that represents the main diagonal. - */ - static Mat diag(const Mat& d); - - /** @brief Creates a full copy of the array and the underlying data. - - The method creates a full copy of the array. The original step[] is not taken into account. So, the - array copy is a continuous array occupying total()*elemSize() bytes. - */ - Mat clone() const CV_NODISCARD; - - /** @brief Copies the matrix to another one. - - The method copies the matrix data to another matrix. Before copying the data, the method invokes : - @code - m.create(this->size(), this->type()); - @endcode - so that the destination matrix is reallocated if needed. While m.copyTo(m); works flawlessly, the - function does not handle the case of a partial overlap between the source and the destination - matrices. - - When the operation mask is specified, if the Mat::create call shown above reallocates the matrix, - the newly allocated matrix is initialized with all zeros before copying the data. - @param m Destination matrix. If it does not have a proper size or type before the operation, it is - reallocated. - */ - void copyTo( OutputArray m ) const; - - /** @overload - @param m Destination matrix. If it does not have a proper size or type before the operation, it is - reallocated. - @param mask Operation mask of the same size as \*this. Its non-zero elements indicate which matrix - elements need to be copied. The mask has to be of type CV_8U and can have 1 or multiple channels. - */ - void copyTo( OutputArray m, InputArray mask ) const; - - /** @brief Converts an array to another data type with optional scaling. - - The method converts source pixel values to the target data type. saturate_cast\<\> is applied at - the end to avoid possible overflows: - - \f[m(x,y) = saturate \_ cast( \alpha (*this)(x,y) + \beta )\f] - @param m output matrix; if it does not have a proper size or type before the operation, it is - reallocated. - @param rtype desired output matrix type or, rather, the depth since the number of channels are the - same as the input has; if rtype is negative, the output matrix will have the same type as the input. - @param alpha optional scale factor. - @param beta optional delta added to the scaled values. - */ - void convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 ) const; - - /** @brief Provides a functional form of convertTo. - - This is an internally used method called by the @ref MatrixExpressions engine. - @param m Destination array. - @param type Desired destination array depth (or -1 if it should be the same as the source type). - */ - void assignTo( Mat& m, int type=-1 ) const; - - /** @brief Sets all or some of the array elements to the specified value. - @param s Assigned scalar converted to the actual array type. - */ - Mat& operator = (const Scalar& s); - - /** @brief Sets all or some of the array elements to the specified value. - - This is an advanced variant of the Mat::operator=(const Scalar& s) operator. - @param value Assigned scalar converted to the actual array type. - @param mask Operation mask of the same size as \*this. Its non-zero elements indicate which matrix - elements need to be copied. The mask has to be of type CV_8U and can have 1 or multiple channels - */ - Mat& setTo(InputArray value, InputArray mask=noArray()); - - /** @brief Changes the shape and/or the number of channels of a 2D matrix without copying the data. - - The method makes a new matrix header for \*this elements. The new matrix may have a different size - and/or different number of channels. Any combination is possible if: - - No extra elements are included into the new matrix and no elements are excluded. Consequently, - the product rows\*cols\*channels() must stay the same after the transformation. - - No data is copied. That is, this is an O(1) operation. Consequently, if you change the number of - rows, or the operation changes the indices of elements row in some other way, the matrix must be - continuous. See Mat::isContinuous . - - For example, if there is a set of 3D points stored as an STL vector, and you want to represent the - points as a 3xN matrix, do the following: - @code - std::vector vec; - ... - Mat pointMat = Mat(vec). // convert vector to Mat, O(1) operation - reshape(1). // make Nx3 1-channel matrix out of Nx1 3-channel. - // Also, an O(1) operation - t(); // finally, transpose the Nx3 matrix. - // This involves copying all the elements - @endcode - @param cn New number of channels. If the parameter is 0, the number of channels remains the same. - @param rows New number of rows. If the parameter is 0, the number of rows remains the same. - */ - Mat reshape(int cn, int rows=0) const; - - /** @overload */ - Mat reshape(int cn, int newndims, const int* newsz) const; - - /** @overload */ - Mat reshape(int cn, const std::vector& newshape) const; - - /** @brief Transposes a matrix. - - The method performs matrix transposition by means of matrix expressions. It does not perform the - actual transposition but returns a temporary matrix transposition object that can be further used as - a part of more complex matrix expressions or can be assigned to a matrix: - @code - Mat A1 = A + Mat::eye(A.size(), A.type())*lambda; - Mat C = A1.t()*A1; // compute (A + lambda*I)^t * (A + lamda*I) - @endcode - */ - MatExpr t() const; - - /** @brief Inverses a matrix. - - The method performs a matrix inversion by means of matrix expressions. This means that a temporary - matrix inversion object is returned by the method and can be used further as a part of more complex - matrix expressions or can be assigned to a matrix. - @param method Matrix inversion method. One of cv::DecompTypes - */ - MatExpr inv(int method=DECOMP_LU) const; - - /** @brief Performs an element-wise multiplication or division of the two matrices. - - The method returns a temporary object encoding per-element array multiplication, with optional - scale. Note that this is not a matrix multiplication that corresponds to a simpler "\*" operator. - - Example: - @code - Mat C = A.mul(5/B); // equivalent to divide(A, B, C, 5) - @endcode - @param m Another array of the same type and the same size as \*this, or a matrix expression. - @param scale Optional scale factor. - */ - MatExpr mul(InputArray m, double scale=1) const; - - /** @brief Computes a cross-product of two 3-element vectors. - - The method computes a cross-product of two 3-element vectors. The vectors must be 3-element - floating-point vectors of the same shape and size. The result is another 3-element vector of the - same shape and type as operands. - @param m Another cross-product operand. - */ - Mat cross(InputArray m) const; - - /** @brief Computes a dot-product of two vectors. - - The method computes a dot-product of two matrices. If the matrices are not single-column or - single-row vectors, the top-to-bottom left-to-right scan ordering is used to treat them as 1D - vectors. The vectors must have the same size and type. If the matrices have more than one channel, - the dot products from all the channels are summed together. - @param m another dot-product operand. - */ - double dot(InputArray m) const; - - /** @brief Returns a zero array of the specified size and type. - - The method returns a Matlab-style zero array initializer. It can be used to quickly form a constant - array as a function parameter, part of a matrix expression, or as a matrix initializer: - @code - Mat A; - A = Mat::zeros(3, 3, CV_32F); - @endcode - In the example above, a new matrix is allocated only if A is not a 3x3 floating-point matrix. - Otherwise, the existing matrix A is filled with zeros. - @param rows Number of rows. - @param cols Number of columns. - @param type Created matrix type. - */ - static MatExpr zeros(int rows, int cols, int type); - - /** @overload - @param size Alternative to the matrix size specification Size(cols, rows) . - @param type Created matrix type. - */ - static MatExpr zeros(Size size, int type); - - /** @overload - @param ndims Array dimensionality. - @param sz Array of integers specifying the array shape. - @param type Created matrix type. - */ - static MatExpr zeros(int ndims, const int* sz, int type); - - /** @brief Returns an array of all 1's of the specified size and type. - - The method returns a Matlab-style 1's array initializer, similarly to Mat::zeros. Note that using - this method you can initialize an array with an arbitrary value, using the following Matlab idiom: - @code - Mat A = Mat::ones(100, 100, CV_8U)*3; // make 100x100 matrix filled with 3. - @endcode - The above operation does not form a 100x100 matrix of 1's and then multiply it by 3. Instead, it - just remembers the scale factor (3 in this case) and use it when actually invoking the matrix - initializer. - @note In case of multi-channels type, only the first channel will be initialized with 1's, the - others will be set to 0's. - @param rows Number of rows. - @param cols Number of columns. - @param type Created matrix type. - */ - static MatExpr ones(int rows, int cols, int type); - - /** @overload - @param size Alternative to the matrix size specification Size(cols, rows) . - @param type Created matrix type. - */ - static MatExpr ones(Size size, int type); - - /** @overload - @param ndims Array dimensionality. - @param sz Array of integers specifying the array shape. - @param type Created matrix type. - */ - static MatExpr ones(int ndims, const int* sz, int type); - - /** @brief Returns an identity matrix of the specified size and type. - - The method returns a Matlab-style identity matrix initializer, similarly to Mat::zeros. Similarly to - Mat::ones, you can use a scale operation to create a scaled identity matrix efficiently: - @code - // make a 4x4 diagonal matrix with 0.1's on the diagonal. - Mat A = Mat::eye(4, 4, CV_32F)*0.1; - @endcode - @note In case of multi-channels type, identity matrix will be initialized only for the first channel, - the others will be set to 0's - @param rows Number of rows. - @param cols Number of columns. - @param type Created matrix type. - */ - static MatExpr eye(int rows, int cols, int type); - - /** @overload - @param size Alternative matrix size specification as Size(cols, rows) . - @param type Created matrix type. - */ - static MatExpr eye(Size size, int type); - - /** @brief Allocates new array data if needed. - - This is one of the key Mat methods. Most new-style OpenCV functions and methods that produce arrays - call this method for each output array. The method uses the following algorithm: - - -# If the current array shape and the type match the new ones, return immediately. Otherwise, - de-reference the previous data by calling Mat::release. - -# Initialize the new header. - -# Allocate the new data of total()\*elemSize() bytes. - -# Allocate the new, associated with the data, reference counter and set it to 1. - - Such a scheme makes the memory management robust and efficient at the same time and helps avoid - extra typing for you. This means that usually there is no need to explicitly allocate output arrays. - That is, instead of writing: - @code - Mat color; - ... - Mat gray(color.rows, color.cols, color.depth()); - cvtColor(color, gray, COLOR_BGR2GRAY); - @endcode - you can simply write: - @code - Mat color; - ... - Mat gray; - cvtColor(color, gray, COLOR_BGR2GRAY); - @endcode - because cvtColor, as well as the most of OpenCV functions, calls Mat::create() for the output array - internally. - @param rows New number of rows. - @param cols New number of columns. - @param type New matrix type. - */ - void create(int rows, int cols, int type); - - /** @overload - @param size Alternative new matrix size specification: Size(cols, rows) - @param type New matrix type. - */ - void create(Size size, int type); - - /** @overload - @param ndims New array dimensionality. - @param sizes Array of integers specifying a new array shape. - @param type New matrix type. - */ - void create(int ndims, const int* sizes, int type); - - /** @overload - @param sizes Array of integers specifying a new array shape. - @param type New matrix type. - */ - void create(const std::vector& sizes, int type); - - /** @brief Increments the reference counter. - - The method increments the reference counter associated with the matrix data. If the matrix header - points to an external data set (see Mat::Mat ), the reference counter is NULL, and the method has no - effect in this case. Normally, to avoid memory leaks, the method should not be called explicitly. It - is called implicitly by the matrix assignment operator. The reference counter increment is an atomic - operation on the platforms that support it. Thus, it is safe to operate on the same matrices - asynchronously in different threads. - */ - void addref(); - - /** @brief Decrements the reference counter and deallocates the matrix if needed. - - The method decrements the reference counter associated with the matrix data. When the reference - counter reaches 0, the matrix data is deallocated and the data and the reference counter pointers - are set to NULL's. If the matrix header points to an external data set (see Mat::Mat ), the - reference counter is NULL, and the method has no effect in this case. - - This method can be called manually to force the matrix data deallocation. But since this method is - automatically called in the destructor, or by any other method that changes the data pointer, it is - usually not needed. The reference counter decrement and check for 0 is an atomic operation on the - platforms that support it. Thus, it is safe to operate on the same matrices asynchronously in - different threads. - */ - void release(); - - //! internal use function, consider to use 'release' method instead; deallocates the matrix data - void deallocate(); - //! internal use function; properly re-allocates _size, _step arrays - void copySize(const Mat& m); - - /** @brief Reserves space for the certain number of rows. - - The method reserves space for sz rows. If the matrix already has enough space to store sz rows, - nothing happens. If the matrix is reallocated, the first Mat::rows rows are preserved. The method - emulates the corresponding method of the STL vector class. - @param sz Number of rows. - */ - void reserve(size_t sz); - - /** @brief Reserves space for the certain number of bytes. - - The method reserves space for sz bytes. If the matrix already has enough space to store sz bytes, - nothing happens. If matrix has to be reallocated its previous content could be lost. - @param sz Number of bytes. - */ - void reserveBuffer(size_t sz); - - /** @brief Changes the number of matrix rows. - - The methods change the number of matrix rows. If the matrix is reallocated, the first - min(Mat::rows, sz) rows are preserved. The methods emulate the corresponding methods of the STL - vector class. - @param sz New number of rows. - */ - void resize(size_t sz); - - /** @overload - @param sz New number of rows. - @param s Value assigned to the newly added elements. - */ - void resize(size_t sz, const Scalar& s); - - //! internal function - void push_back_(const void* elem); - - /** @brief Adds elements to the bottom of the matrix. - - The methods add one or more elements to the bottom of the matrix. They emulate the corresponding - method of the STL vector class. When elem is Mat , its type and the number of columns must be the - same as in the container matrix. - @param elem Added element(s). - */ - template void push_back(const _Tp& elem); - - /** @overload - @param elem Added element(s). - */ - template void push_back(const Mat_<_Tp>& elem); - - /** @overload - @param elem Added element(s). - */ - template void push_back(const std::vector<_Tp>& elem); - - /** @overload - @param m Added line(s). - */ - void push_back(const Mat& m); - - /** @brief Removes elements from the bottom of the matrix. - - The method removes one or more rows from the bottom of the matrix. - @param nelems Number of removed rows. If it is greater than the total number of rows, an exception - is thrown. - */ - void pop_back(size_t nelems=1); - - /** @brief Locates the matrix header within a parent matrix. - - After you extracted a submatrix from a matrix using Mat::row, Mat::col, Mat::rowRange, - Mat::colRange, and others, the resultant submatrix points just to the part of the original big - matrix. However, each submatrix contains information (represented by datastart and dataend - fields) that helps reconstruct the original matrix size and the position of the extracted - submatrix within the original matrix. The method locateROI does exactly that. - @param wholeSize Output parameter that contains the size of the whole matrix containing *this* - as a part. - @param ofs Output parameter that contains an offset of *this* inside the whole matrix. - */ - void locateROI( Size& wholeSize, Point& ofs ) const; - - /** @brief Adjusts a submatrix size and position within the parent matrix. - - The method is complimentary to Mat::locateROI . The typical use of these functions is to determine - the submatrix position within the parent matrix and then shift the position somehow. Typically, it - can be required for filtering operations when pixels outside of the ROI should be taken into - account. When all the method parameters are positive, the ROI needs to grow in all directions by the - specified amount, for example: - @code - A.adjustROI(2, 2, 2, 2); - @endcode - In this example, the matrix size is increased by 4 elements in each direction. The matrix is shifted - by 2 elements to the left and 2 elements up, which brings in all the necessary pixels for the - filtering with the 5x5 kernel. - - adjustROI forces the adjusted ROI to be inside of the parent matrix that is boundaries of the - adjusted ROI are constrained by boundaries of the parent matrix. For example, if the submatrix A is - located in the first row of a parent matrix and you called A.adjustROI(2, 2, 2, 2) then A will not - be increased in the upward direction. - - The function is used internally by the OpenCV filtering functions, like filter2D , morphological - operations, and so on. - @param dtop Shift of the top submatrix boundary upwards. - @param dbottom Shift of the bottom submatrix boundary downwards. - @param dleft Shift of the left submatrix boundary to the left. - @param dright Shift of the right submatrix boundary to the right. - @sa copyMakeBorder - */ - Mat& adjustROI( int dtop, int dbottom, int dleft, int dright ); - - /** @brief Extracts a rectangular submatrix. - - The operators make a new header for the specified sub-array of \*this . They are the most - generalized forms of Mat::row, Mat::col, Mat::rowRange, and Mat::colRange . For example, - `A(Range(0, 10), Range::all())` is equivalent to `A.rowRange(0, 10)`. Similarly to all of the above, - the operators are O(1) operations, that is, no matrix data is copied. - @param rowRange Start and end row of the extracted submatrix. The upper boundary is not included. To - select all the rows, use Range::all(). - @param colRange Start and end column of the extracted submatrix. The upper boundary is not included. - To select all the columns, use Range::all(). - */ - Mat operator()( Range rowRange, Range colRange ) const; - - /** @overload - @param roi Extracted submatrix specified as a rectangle. - */ - Mat operator()( const Rect& roi ) const; - - /** @overload - @param ranges Array of selected ranges along each array dimension. - */ - Mat operator()( const Range* ranges ) const; - - /** @overload - @param ranges Array of selected ranges along each array dimension. - */ - Mat operator()(const std::vector& ranges) const; - - // //! converts header to CvMat; no data is copied - // operator CvMat() const; - // //! converts header to CvMatND; no data is copied - // operator CvMatND() const; - // //! converts header to IplImage; no data is copied - // operator IplImage() const; - - template operator std::vector<_Tp>() const; - template operator Vec<_Tp, n>() const; - template operator Matx<_Tp, m, n>() const; - -#ifdef CV_CXX_STD_ARRAY - template operator std::array<_Tp, _Nm>() const; -#endif - - /** @brief Reports whether the matrix is continuous or not. - - The method returns true if the matrix elements are stored continuously without gaps at the end of - each row. Otherwise, it returns false. Obviously, 1x1 or 1xN matrices are always continuous. - Matrices created with Mat::create are always continuous. But if you extract a part of the matrix - using Mat::col, Mat::diag, and so on, or constructed a matrix header for externally allocated data, - such matrices may no longer have this property. - - The continuity flag is stored as a bit in the Mat::flags field and is computed automatically when - you construct a matrix header. Thus, the continuity check is a very fast operation, though - theoretically it could be done as follows: - @code - // alternative implementation of Mat::isContinuous() - bool myCheckMatContinuity(const Mat& m) - { - //return (m.flags & Mat::CONTINUOUS_FLAG) != 0; - return m.rows == 1 || m.step == m.cols*m.elemSize(); - } - @endcode - The method is used in quite a few of OpenCV functions. The point is that element-wise operations - (such as arithmetic and logical operations, math functions, alpha blending, color space - transformations, and others) do not depend on the image geometry. Thus, if all the input and output - arrays are continuous, the functions can process them as very long single-row vectors. The example - below illustrates how an alpha-blending function can be implemented: - @code - template - void alphaBlendRGBA(const Mat& src1, const Mat& src2, Mat& dst) - { - const float alpha_scale = (float)std::numeric_limits::max(), - inv_scale = 1.f/alpha_scale; - - CV_Assert( src1.type() == src2.type() && - src1.type() == CV_MAKETYPE(traits::Depth::value, 4) && - src1.size() == src2.size()); - Size size = src1.size(); - dst.create(size, src1.type()); - - // here is the idiom: check the arrays for continuity and, - // if this is the case, - // treat the arrays as 1D vectors - if( src1.isContinuous() && src2.isContinuous() && dst.isContinuous() ) - { - size.width *= size.height; - size.height = 1; - } - size.width *= 4; - - for( int i = 0; i < size.height; i++ ) - { - // when the arrays are continuous, - // the outer loop is executed only once - const T* ptr1 = src1.ptr(i); - const T* ptr2 = src2.ptr(i); - T* dptr = dst.ptr(i); - - for( int j = 0; j < size.width; j += 4 ) - { - float alpha = ptr1[j+3]*inv_scale, beta = ptr2[j+3]*inv_scale; - dptr[j] = saturate_cast(ptr1[j]*alpha + ptr2[j]*beta); - dptr[j+1] = saturate_cast(ptr1[j+1]*alpha + ptr2[j+1]*beta); - dptr[j+2] = saturate_cast(ptr1[j+2]*alpha + ptr2[j+2]*beta); - dptr[j+3] = saturate_cast((1 - (1-alpha)*(1-beta))*alpha_scale); - } - } - } - @endcode - This approach, while being very simple, can boost the performance of a simple element-operation by - 10-20 percents, especially if the image is rather small and the operation is quite simple. - - Another OpenCV idiom in this function, a call of Mat::create for the destination array, that - allocates the destination array unless it already has the proper size and type. And while the newly - allocated arrays are always continuous, you still need to check the destination array because - Mat::create does not always allocate a new matrix. - */ - bool isContinuous() const; - - //! returns true if the matrix is a submatrix of another matrix - bool isSubmatrix() const; - - /** @brief Returns the matrix element size in bytes. - - The method returns the matrix element size in bytes. For example, if the matrix type is CV_16SC3 , - the method returns 3\*sizeof(short) or 6. - */ - size_t elemSize() const; - - /** @brief Returns the size of each matrix element channel in bytes. - - The method returns the matrix element channel size in bytes, that is, it ignores the number of - channels. For example, if the matrix type is CV_16SC3 , the method returns sizeof(short) or 2. - */ - size_t elemSize1() const; - - /** @brief Returns the type of a matrix element. - - The method returns a matrix element type. This is an identifier compatible with the CvMat type - system, like CV_16SC3 or 16-bit signed 3-channel array, and so on. - */ - int type() const; - - /** @brief Returns the depth of a matrix element. - - The method returns the identifier of the matrix element depth (the type of each individual channel). - For example, for a 16-bit signed element array, the method returns CV_16S . A complete list of - matrix types contains the following values: - - CV_8U - 8-bit unsigned integers ( 0..255 ) - - CV_8S - 8-bit signed integers ( -128..127 ) - - CV_16U - 16-bit unsigned integers ( 0..65535 ) - - CV_16S - 16-bit signed integers ( -32768..32767 ) - - CV_32S - 32-bit signed integers ( -2147483648..2147483647 ) - - CV_32F - 32-bit floating-point numbers ( -FLT_MAX..FLT_MAX, INF, NAN ) - - CV_64F - 64-bit floating-point numbers ( -DBL_MAX..DBL_MAX, INF, NAN ) - */ - int depth() const; - - /** @brief Returns the number of matrix channels. - - The method returns the number of matrix channels. - */ - int channels() const; - - /** @brief Returns a normalized step. - - The method returns a matrix step divided by Mat::elemSize1() . It can be useful to quickly access an - arbitrary matrix element. - */ - size_t step1(int i=0) const; - - /** @brief Returns true if the array has no elements. - - The method returns true if Mat::total() is 0 or if Mat::data is NULL. Because of pop_back() and - resize() methods `M.total() == 0` does not imply that `M.data == NULL`. - */ - bool empty() const; - - /** @brief Returns the total number of array elements. - - The method returns the number of array elements (a number of pixels if the array represents an - image). - */ - size_t total() const; - - /** @brief Returns the total number of array elements. - - The method returns the number of elements within a certain sub-array slice with startDim <= dim < endDim - */ - size_t total(int startDim, int endDim=INT_MAX) const; - - /** - * @param elemChannels Number of channels or number of columns the matrix should have. - * For a 2-D matrix, when the matrix has only 1 column, then it should have - * elemChannels channels; When the matrix has only 1 channel, - * then it should have elemChannels columns. - * For a 3-D matrix, it should have only one channel. Furthermore, - * if the number of planes is not one, then the number of rows - * within every plane has to be 1; if the number of rows within - * every plane is not 1, then the number of planes has to be 1. - * @param depth The depth the matrix should have. Set it to -1 when any depth is fine. - * @param requireContinuous Set it to true to require the matrix to be continuous - * @return -1 if the requirement is not satisfied. - * Otherwise, it returns the number of elements in the matrix. Note - * that an element may have multiple channels. - * - * The following code demonstrates its usage for a 2-d matrix: - * @snippet snippets/core_mat_checkVector.cpp example-2d - * - * The following code demonstrates its usage for a 3-d matrix: - * @snippet snippets/core_mat_checkVector.cpp example-3d - */ - int checkVector(int elemChannels, int depth=-1, bool requireContinuous=true) const; - - /** @brief Returns a pointer to the specified matrix row. - - The methods return `uchar*` or typed pointer to the specified matrix row. See the sample in - Mat::isContinuous to know how to use these methods. - @param i0 A 0-based row index. - */ - uchar* ptr(int i0=0); - /** @overload */ - const uchar* ptr(int i0=0) const; - - /** @overload - @param row Index along the dimension 0 - @param col Index along the dimension 1 - */ - uchar* ptr(int row, int col); - /** @overload - @param row Index along the dimension 0 - @param col Index along the dimension 1 - */ - const uchar* ptr(int row, int col) const; - - /** @overload */ - uchar* ptr(int i0, int i1, int i2); - /** @overload */ - const uchar* ptr(int i0, int i1, int i2) const; - - /** @overload */ - uchar* ptr(const int* idx); - /** @overload */ - const uchar* ptr(const int* idx) const; - /** @overload */ - template uchar* ptr(const Vec& idx); - /** @overload */ - template const uchar* ptr(const Vec& idx) const; - - /** @overload */ - template _Tp* ptr(int i0=0); - /** @overload */ - template const _Tp* ptr(int i0=0) const; - /** @overload - @param row Index along the dimension 0 - @param col Index along the dimension 1 - */ - template _Tp* ptr(int row, int col); - /** @overload - @param row Index along the dimension 0 - @param col Index along the dimension 1 - */ - template const _Tp* ptr(int row, int col) const; - /** @overload */ - template _Tp* ptr(int i0, int i1, int i2); - /** @overload */ - template const _Tp* ptr(int i0, int i1, int i2) const; - /** @overload */ - template _Tp* ptr(const int* idx); - /** @overload */ - template const _Tp* ptr(const int* idx) const; - /** @overload */ - template _Tp* ptr(const Vec& idx); - /** @overload */ - template const _Tp* ptr(const Vec& idx) const; - - /** @brief Returns a reference to the specified array element. - - The template methods return a reference to the specified array element. For the sake of higher - performance, the index range checks are only performed in the Debug configuration. - - Note that the variants with a single index (i) can be used to access elements of single-row or - single-column 2-dimensional arrays. That is, if, for example, A is a 1 x N floating-point matrix and - B is an M x 1 integer matrix, you can simply write `A.at(k+4)` and `B.at(2*i+1)` - instead of `A.at(0,k+4)` and `B.at(2*i+1,0)`, respectively. - - The example below initializes a Hilbert matrix: - @code - Mat H(100, 100, CV_64F); - for(int i = 0; i < H.rows; i++) - for(int j = 0; j < H.cols; j++) - H.at(i,j)=1./(i+j+1); - @endcode - - Keep in mind that the size identifier used in the at operator cannot be chosen at random. It depends - on the image from which you are trying to retrieve the data. The table below gives a better insight in this: - - If matrix is of type `CV_8U` then use `Mat.at(y,x)`. - - If matrix is of type `CV_8S` then use `Mat.at(y,x)`. - - If matrix is of type `CV_16U` then use `Mat.at(y,x)`. - - If matrix is of type `CV_16S` then use `Mat.at(y,x)`. - - If matrix is of type `CV_32S` then use `Mat.at(y,x)`. - - If matrix is of type `CV_32F` then use `Mat.at(y,x)`. - - If matrix is of type `CV_64F` then use `Mat.at(y,x)`. - - @param i0 Index along the dimension 0 - */ - template _Tp& at(int i0=0); - /** @overload - @param i0 Index along the dimension 0 - */ - template const _Tp& at(int i0=0) const; - /** @overload - @param row Index along the dimension 0 - @param col Index along the dimension 1 - */ - template _Tp& at(int row, int col); - /** @overload - @param row Index along the dimension 0 - @param col Index along the dimension 1 - */ - template const _Tp& at(int row, int col) const; - - /** @overload - @param i0 Index along the dimension 0 - @param i1 Index along the dimension 1 - @param i2 Index along the dimension 2 - */ - template _Tp& at(int i0, int i1, int i2); - /** @overload - @param i0 Index along the dimension 0 - @param i1 Index along the dimension 1 - @param i2 Index along the dimension 2 - */ - template const _Tp& at(int i0, int i1, int i2) const; - - /** @overload - @param idx Array of Mat::dims indices. - */ - template _Tp& at(const int* idx); - /** @overload - @param idx Array of Mat::dims indices. - */ - template const _Tp& at(const int* idx) const; - - /** @overload */ - template _Tp& at(const Vec& idx); - /** @overload */ - template const _Tp& at(const Vec& idx) const; - - /** @overload - special versions for 2D arrays (especially convenient for referencing image pixels) - @param pt Element position specified as Point(j,i) . - */ - template _Tp& at(Point pt); - /** @overload - special versions for 2D arrays (especially convenient for referencing image pixels) - @param pt Element position specified as Point(j,i) . - */ - template const _Tp& at(Point pt) const; - - /** @brief Returns the matrix iterator and sets it to the first matrix element. - - The methods return the matrix read-only or read-write iterators. The use of matrix iterators is very - similar to the use of bi-directional STL iterators. In the example below, the alpha blending - function is rewritten using the matrix iterators: - @code - template - void alphaBlendRGBA(const Mat& src1, const Mat& src2, Mat& dst) - { - typedef Vec VT; - - const float alpha_scale = (float)std::numeric_limits::max(), - inv_scale = 1.f/alpha_scale; - - CV_Assert( src1.type() == src2.type() && - src1.type() == traits::Type::value && - src1.size() == src2.size()); - Size size = src1.size(); - dst.create(size, src1.type()); - - MatConstIterator_ it1 = src1.begin(), it1_end = src1.end(); - MatConstIterator_ it2 = src2.begin(); - MatIterator_ dst_it = dst.begin(); - - for( ; it1 != it1_end; ++it1, ++it2, ++dst_it ) - { - VT pix1 = *it1, pix2 = *it2; - float alpha = pix1[3]*inv_scale, beta = pix2[3]*inv_scale; - *dst_it = VT(saturate_cast(pix1[0]*alpha + pix2[0]*beta), - saturate_cast(pix1[1]*alpha + pix2[1]*beta), - saturate_cast(pix1[2]*alpha + pix2[2]*beta), - saturate_cast((1 - (1-alpha)*(1-beta))*alpha_scale)); - } - } - @endcode - */ - template MatIterator_<_Tp> begin(); - template MatConstIterator_<_Tp> begin() const; - - /** @brief Returns the matrix iterator and sets it to the after-last matrix element. - - The methods return the matrix read-only or read-write iterators, set to the point following the last - matrix element. - */ - template MatIterator_<_Tp> end(); - template MatConstIterator_<_Tp> end() const; - - /** @brief Runs the given functor over all matrix elements in parallel. - - The operation passed as argument has to be a function pointer, a function object or a lambda(C++11). - - Example 1. All of the operations below put 0xFF the first channel of all matrix elements: - @code - Mat image(1920, 1080, CV_8UC3); - typedef cv::Point3_ Pixel; - - // first. raw pointer access. - for (int r = 0; r < image.rows; ++r) { - Pixel* ptr = image.ptr(r, 0); - const Pixel* ptr_end = ptr + image.cols; - for (; ptr != ptr_end; ++ptr) { - ptr->x = 255; - } - } - - // Using MatIterator. (Simple but there are a Iterator's overhead) - for (Pixel &p : cv::Mat_(image)) { - p.x = 255; - } - - // Parallel execution with function object. - struct Operator { - void operator ()(Pixel &pixel, const int * position) { - pixel.x = 255; - } - }; - image.forEach(Operator()); - - // Parallel execution using C++11 lambda. - image.forEach([](Pixel &p, const int * position) -> void { - p.x = 255; - }); - @endcode - Example 2. Using the pixel's position: - @code - // Creating 3D matrix (255 x 255 x 255) typed uint8_t - // and initialize all elements by the value which equals elements position. - // i.e. pixels (x,y,z) = (1,2,3) is (b,g,r) = (1,2,3). - - int sizes[] = { 255, 255, 255 }; - typedef cv::Point3_ Pixel; - - Mat_ image = Mat::zeros(3, sizes, CV_8UC3); - - image.forEach([&](Pixel& pixel, const int position[]) -> void { - pixel.x = position[0]; - pixel.y = position[1]; - pixel.z = position[2]; - }); - @endcode - */ - template void forEach(const Functor& operation); - /** @overload */ - template void forEach(const Functor& operation) const; - -#ifdef CV_CXX_MOVE_SEMANTICS - Mat(Mat&& m); - Mat& operator = (Mat&& m); -#endif - - enum { MAGIC_VAL = 0x42FF0000, AUTO_STEP = 0, CONTINUOUS_FLAG = CV_MAT_CONT_FLAG, SUBMATRIX_FLAG = CV_SUBMAT_FLAG }; - enum { MAGIC_MASK = 0xFFFF0000, TYPE_MASK = 0x00000FFF, DEPTH_MASK = 7 }; - - /*! includes several bit-fields: - - the magic signature - - continuity flag - - depth - - number of channels - */ - int flags; - //! the matrix dimensionality, >= 2 - int dims; - //! the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions - int rows, cols; - //! pointer to the data - uchar* data; - - //! helper fields used in locateROI and adjustROI - const uchar* datastart; - const uchar* dataend; - const uchar* datalimit; - - //! custom allocator - MatAllocator* allocator; - //! and the standard allocator - static MatAllocator* getStdAllocator(); - static MatAllocator* getDefaultAllocator(); - static void setDefaultAllocator(MatAllocator* allocator); - - //! internal use method: updates the continuity flag - void updateContinuityFlag(); - - //! interaction with UMat - UMatData* u; - - MatSize size; - MatStep step; - -protected: - template void forEach_impl(const Functor& operation); -}; - - -///////////////////////////////// Mat_<_Tp> //////////////////////////////////// - -/** @brief Template matrix class derived from Mat - -@code{.cpp} - template class Mat_ : public Mat - { - public: - // ... some specific methods - // and - // no new extra fields - }; -@endcode -The class `Mat_<_Tp>` is a *thin* template wrapper on top of the Mat class. It does not have any -extra data fields. Nor this class nor Mat has any virtual methods. Thus, references or pointers to -these two classes can be freely but carefully converted one to another. For example: -@code{.cpp} - // create a 100x100 8-bit matrix - Mat M(100,100,CV_8U); - // this will be compiled fine. no any data conversion will be done. - Mat_& M1 = (Mat_&)M; - // the program is likely to crash at the statement below - M1(99,99) = 1.f; -@endcode -While Mat is sufficient in most cases, Mat_ can be more convenient if you use a lot of element -access operations and if you know matrix type at the compilation time. Note that -`Mat::at(int y,int x)` and `Mat_::operator()(int y,int x)` do absolutely the same -and run at the same speed, but the latter is certainly shorter: -@code{.cpp} - Mat_ M(20,20); - for(int i = 0; i < M.rows; i++) - for(int j = 0; j < M.cols; j++) - M(i,j) = 1./(i+j+1); - Mat E, V; - eigen(M,E,V); - cout << E.at(0,0)/E.at(M.rows-1,0); -@endcode -To use Mat_ for multi-channel images/matrices, pass Vec as a Mat_ parameter: -@code{.cpp} - // allocate a 320x240 color image and fill it with green (in RGB space) - Mat_ img(240, 320, Vec3b(0,255,0)); - // now draw a diagonal white line - for(int i = 0; i < 100; i++) - img(i,i)=Vec3b(255,255,255); - // and now scramble the 2nd (red) channel of each pixel - for(int i = 0; i < img.rows; i++) - for(int j = 0; j < img.cols; j++) - img(i,j)[2] ^= (uchar)(i ^ j); -@endcode -Mat_ is fully compatible with C++11 range-based for loop. For example such loop -can be used to safely apply look-up table: -@code{.cpp} -void applyTable(Mat_& I, const uchar* const table) -{ - for(auto& pixel : I) - { - pixel = table[pixel]; - } -} -@endcode - */ -template class Mat_ : public Mat -{ -public: - typedef _Tp value_type; - typedef typename DataType<_Tp>::channel_type channel_type; - typedef MatIterator_<_Tp> iterator; - typedef MatConstIterator_<_Tp> const_iterator; - - //! default constructor - Mat_(); - //! equivalent to Mat(_rows, _cols, DataType<_Tp>::type) - Mat_(int _rows, int _cols); - //! constructor that sets each matrix element to specified value - Mat_(int _rows, int _cols, const _Tp& value); - //! equivalent to Mat(_size, DataType<_Tp>::type) - explicit Mat_(Size _size); - //! constructor that sets each matrix element to specified value - Mat_(Size _size, const _Tp& value); - //! n-dim array constructor - Mat_(int _ndims, const int* _sizes); - //! n-dim array constructor that sets each matrix element to specified value - Mat_(int _ndims, const int* _sizes, const _Tp& value); - //! copy/conversion constructor. If m is of different type, it's converted - Mat_(const Mat& m); - //! copy constructor - Mat_(const Mat_& m); - //! constructs a matrix on top of user-allocated data. step is in bytes(!!!), regardless of the type - Mat_(int _rows, int _cols, _Tp* _data, size_t _step=AUTO_STEP); - //! constructs n-dim matrix on top of user-allocated data. steps are in bytes(!!!), regardless of the type - Mat_(int _ndims, const int* _sizes, _Tp* _data, const size_t* _steps=0); - //! selects a submatrix - Mat_(const Mat_& m, const Range& rowRange, const Range& colRange=Range::all()); - //! selects a submatrix - Mat_(const Mat_& m, const Rect& roi); - //! selects a submatrix, n-dim version - Mat_(const Mat_& m, const Range* ranges); - //! selects a submatrix, n-dim version - Mat_(const Mat_& m, const std::vector& ranges); - //! from a matrix expression - explicit Mat_(const MatExpr& e); - //! makes a matrix out of Vec, std::vector, Point_ or Point3_. The matrix will have a single column - explicit Mat_(const std::vector<_Tp>& vec, bool copyData=false); - template explicit Mat_(const Vec::channel_type, n>& vec, bool copyData=true); - template explicit Mat_(const Matx::channel_type, m, n>& mtx, bool copyData=true); - explicit Mat_(const Point_::channel_type>& pt, bool copyData=true); - explicit Mat_(const Point3_::channel_type>& pt, bool copyData=true); - explicit Mat_(const MatCommaInitializer_<_Tp>& commaInitializer); - -#ifdef CV_CXX11 - Mat_(std::initializer_list<_Tp> values); - explicit Mat_(const std::initializer_list sizes, const std::initializer_list<_Tp> values); -#endif - -#ifdef CV_CXX_STD_ARRAY - template explicit Mat_(const std::array<_Tp, _Nm>& arr, bool copyData=false); -#endif - - Mat_& operator = (const Mat& m); - Mat_& operator = (const Mat_& m); - //! set all the elements to s. - Mat_& operator = (const _Tp& s); - //! assign a matrix expression - Mat_& operator = (const MatExpr& e); - - //! iterators; they are smart enough to skip gaps in the end of rows - iterator begin(); - iterator end(); - const_iterator begin() const; - const_iterator end() const; - - //! template methods for for operation over all matrix elements. - // the operations take care of skipping gaps in the end of rows (if any) - template void forEach(const Functor& operation); - template void forEach(const Functor& operation) const; - - //! equivalent to Mat::create(_rows, _cols, DataType<_Tp>::type) - void create(int _rows, int _cols); - //! equivalent to Mat::create(_size, DataType<_Tp>::type) - void create(Size _size); - //! equivalent to Mat::create(_ndims, _sizes, DatType<_Tp>::type) - void create(int _ndims, const int* _sizes); - //! equivalent to Mat::release() - void release(); - //! cross-product - Mat_ cross(const Mat_& m) const; - //! data type conversion - template operator Mat_() const; - //! overridden forms of Mat::row() etc. - Mat_ row(int y) const; - Mat_ col(int x) const; - Mat_ diag(int d=0) const; - Mat_ clone() const CV_NODISCARD; - - //! overridden forms of Mat::elemSize() etc. - size_t elemSize() const; - size_t elemSize1() const; - int type() const; - int depth() const; - int channels() const; - size_t step1(int i=0) const; - //! returns step()/sizeof(_Tp) - size_t stepT(int i=0) const; - - //! overridden forms of Mat::zeros() etc. Data type is omitted, of course - static MatExpr zeros(int rows, int cols); - static MatExpr zeros(Size size); - static MatExpr zeros(int _ndims, const int* _sizes); - static MatExpr ones(int rows, int cols); - static MatExpr ones(Size size); - static MatExpr ones(int _ndims, const int* _sizes); - static MatExpr eye(int rows, int cols); - static MatExpr eye(Size size); - - //! some more overridden methods - Mat_& adjustROI( int dtop, int dbottom, int dleft, int dright ); - Mat_ operator()( const Range& rowRange, const Range& colRange ) const; - Mat_ operator()( const Rect& roi ) const; - Mat_ operator()( const Range* ranges ) const; - Mat_ operator()(const std::vector& ranges) const; - - //! more convenient forms of row and element access operators - _Tp* operator [](int y); - const _Tp* operator [](int y) const; - - //! returns reference to the specified element - _Tp& operator ()(const int* idx); - //! returns read-only reference to the specified element - const _Tp& operator ()(const int* idx) const; - - //! returns reference to the specified element - template _Tp& operator ()(const Vec& idx); - //! returns read-only reference to the specified element - template const _Tp& operator ()(const Vec& idx) const; - - //! returns reference to the specified element (1D case) - _Tp& operator ()(int idx0); - //! returns read-only reference to the specified element (1D case) - const _Tp& operator ()(int idx0) const; - //! returns reference to the specified element (2D case) - _Tp& operator ()(int row, int col); - //! returns read-only reference to the specified element (2D case) - const _Tp& operator ()(int row, int col) const; - //! returns reference to the specified element (3D case) - _Tp& operator ()(int idx0, int idx1, int idx2); - //! returns read-only reference to the specified element (3D case) - const _Tp& operator ()(int idx0, int idx1, int idx2) const; - - _Tp& operator ()(Point pt); - const _Tp& operator ()(Point pt) const; - - //! conversion to vector. - operator std::vector<_Tp>() const; - -#ifdef CV_CXX_STD_ARRAY - //! conversion to array. - template operator std::array<_Tp, _Nm>() const; -#endif - - //! conversion to Vec - template operator Vec::channel_type, n>() const; - //! conversion to Matx - template operator Matx::channel_type, m, n>() const; - -#ifdef CV_CXX_MOVE_SEMANTICS - Mat_(Mat_&& m); - Mat_& operator = (Mat_&& m); - - Mat_(Mat&& m); - Mat_& operator = (Mat&& m); - - Mat_(MatExpr&& e); -#endif -}; - -typedef Mat_ Mat1b; -typedef Mat_ Mat2b; -typedef Mat_ Mat3b; -typedef Mat_ Mat4b; - -typedef Mat_ Mat1s; -typedef Mat_ Mat2s; -typedef Mat_ Mat3s; -typedef Mat_ Mat4s; - -typedef Mat_ Mat1w; -typedef Mat_ Mat2w; -typedef Mat_ Mat3w; -typedef Mat_ Mat4w; - -typedef Mat_ Mat1i; -typedef Mat_ Mat2i; -typedef Mat_ Mat3i; -typedef Mat_ Mat4i; - -typedef Mat_ Mat1f; -typedef Mat_ Mat2f; -typedef Mat_ Mat3f; -typedef Mat_ Mat4f; - -typedef Mat_ Mat1d; -typedef Mat_ Mat2d; -typedef Mat_ Mat3d; -typedef Mat_ Mat4d; - -/** @todo document */ -class CV_EXPORTS UMat -{ -public: - //! default constructor - UMat(UMatUsageFlags usageFlags = USAGE_DEFAULT); - //! constructs 2D matrix of the specified size and type - // (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.) - UMat(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT); - UMat(Size size, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT); - //! constucts 2D matrix and fills it with the specified value _s. - UMat(int rows, int cols, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT); - UMat(Size size, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT); - - //! constructs n-dimensional matrix - UMat(int ndims, const int* sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT); - UMat(int ndims, const int* sizes, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT); - - //! copy constructor - UMat(const UMat& m); - - //! creates a matrix header for a part of the bigger matrix - UMat(const UMat& m, const Range& rowRange, const Range& colRange=Range::all()); - UMat(const UMat& m, const Rect& roi); - UMat(const UMat& m, const Range* ranges); - UMat(const UMat& m, const std::vector& ranges); - //! builds matrix from std::vector with or without copying the data - template explicit UMat(const std::vector<_Tp>& vec, bool copyData=false); - - //! builds matrix from cv::Vec; the data is copied by default - template explicit UMat(const Vec<_Tp, n>& vec, bool copyData=true); - //! builds matrix from cv::Matx; the data is copied by default - template explicit UMat(const Matx<_Tp, m, n>& mtx, bool copyData=true); - //! builds matrix from a 2D point - template explicit UMat(const Point_<_Tp>& pt, bool copyData=true); - //! builds matrix from a 3D point - template explicit UMat(const Point3_<_Tp>& pt, bool copyData=true); - //! builds matrix from comma initializer - template explicit UMat(const MatCommaInitializer_<_Tp>& commaInitializer); - - //! destructor - calls release() - ~UMat(); - //! assignment operators - UMat& operator = (const UMat& m); - - Mat getMat(int flags) const; - - //! returns a new matrix header for the specified row - UMat row(int y) const; - //! returns a new matrix header for the specified column - UMat col(int x) const; - //! ... for the specified row span - UMat rowRange(int startrow, int endrow) const; - UMat rowRange(const Range& r) const; - //! ... for the specified column span - UMat colRange(int startcol, int endcol) const; - UMat colRange(const Range& r) const; - //! ... for the specified diagonal - //! (d=0 - the main diagonal, - //! >0 - a diagonal from the upper half, - //! <0 - a diagonal from the lower half) - UMat diag(int d=0) const; - //! constructs a square diagonal matrix which main diagonal is vector "d" - static UMat diag(const UMat& d); - - //! returns deep copy of the matrix, i.e. the data is copied - UMat clone() const CV_NODISCARD; - //! copies the matrix content to "m". - // It calls m.create(this->size(), this->type()). - void copyTo( OutputArray m ) const; - //! copies those matrix elements to "m" that are marked with non-zero mask elements. - void copyTo( OutputArray m, InputArray mask ) const; - //! converts matrix to another datatype with optional scaling. See cvConvertScale. - void convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 ) const; - - void assignTo( UMat& m, int type=-1 ) const; - - //! sets every matrix element to s - UMat& operator = (const Scalar& s); - //! sets some of the matrix elements to s, according to the mask - UMat& setTo(InputArray value, InputArray mask=noArray()); - //! creates alternative matrix header for the same data, with different - // number of channels and/or different number of rows. see cvReshape. - UMat reshape(int cn, int rows=0) const; - UMat reshape(int cn, int newndims, const int* newsz) const; - - //! matrix transposition by means of matrix expressions - UMat t() const; - //! matrix inversion by means of matrix expressions - UMat inv(int method=DECOMP_LU) const; - //! per-element matrix multiplication by means of matrix expressions - UMat mul(InputArray m, double scale=1) const; - - //! computes dot-product - double dot(InputArray m) const; - - //! Matlab-style matrix initialization - static UMat zeros(int rows, int cols, int type); - static UMat zeros(Size size, int type); - static UMat zeros(int ndims, const int* sz, int type); - static UMat ones(int rows, int cols, int type); - static UMat ones(Size size, int type); - static UMat ones(int ndims, const int* sz, int type); - static UMat eye(int rows, int cols, int type); - static UMat eye(Size size, int type); - - //! allocates new matrix data unless the matrix already has specified size and type. - // previous data is unreferenced if needed. - void create(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT); - void create(Size size, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT); - void create(int ndims, const int* sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT); - void create(const std::vector& sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT); - - //! increases the reference counter; use with care to avoid memleaks - void addref(); - //! decreases reference counter; - // deallocates the data when reference counter reaches 0. - void release(); - - //! deallocates the matrix data - void deallocate(); - //! internal use function; properly re-allocates _size, _step arrays - void copySize(const UMat& m); - - //! locates matrix header within a parent matrix. See below - void locateROI( Size& wholeSize, Point& ofs ) const; - //! moves/resizes the current matrix ROI inside the parent matrix. - UMat& adjustROI( int dtop, int dbottom, int dleft, int dright ); - //! extracts a rectangular sub-matrix - // (this is a generalized form of row, rowRange etc.) - UMat operator()( Range rowRange, Range colRange ) const; - UMat operator()( const Rect& roi ) const; - UMat operator()( const Range* ranges ) const; - UMat operator()(const std::vector& ranges) const; - - //! returns true iff the matrix data is continuous - // (i.e. when there are no gaps between successive rows). - // similar to CV_IS_MAT_CONT(cvmat->type) - bool isContinuous() const; - - //! returns true if the matrix is a submatrix of another matrix - bool isSubmatrix() const; - - //! returns element size in bytes, - // similar to CV_ELEM_SIZE(cvmat->type) - size_t elemSize() const; - //! returns the size of element channel in bytes. - size_t elemSize1() const; - //! returns element type, similar to CV_MAT_TYPE(cvmat->type) - int type() const; - //! returns element type, similar to CV_MAT_DEPTH(cvmat->type) - int depth() const; - //! returns element type, similar to CV_MAT_CN(cvmat->type) - int channels() const; - //! returns step/elemSize1() - size_t step1(int i=0) const; - //! returns true if matrix data is NULL - bool empty() const; - //! returns the total number of matrix elements - size_t total() const; - - //! returns N if the matrix is 1-channel (N x ptdim) or ptdim-channel (1 x N) or (N x 1); negative number otherwise - int checkVector(int elemChannels, int depth=-1, bool requireContinuous=true) const; - -#ifdef CV_CXX_MOVE_SEMANTICS - UMat(UMat&& m); - UMat& operator = (UMat&& m); -#endif - - /*! Returns the OpenCL buffer handle on which UMat operates on. - The UMat instance should be kept alive during the use of the handle to prevent the buffer to be - returned to the OpenCV buffer pool. - */ - void* handle(int accessFlags) const; - void ndoffset(size_t* ofs) const; - - enum { MAGIC_VAL = 0x42FF0000, AUTO_STEP = 0, CONTINUOUS_FLAG = CV_MAT_CONT_FLAG, SUBMATRIX_FLAG = CV_SUBMAT_FLAG }; - enum { MAGIC_MASK = 0xFFFF0000, TYPE_MASK = 0x00000FFF, DEPTH_MASK = 7 }; - - /*! includes several bit-fields: - - the magic signature - - continuity flag - - depth - - number of channels - */ - int flags; - //! the matrix dimensionality, >= 2 - int dims; - //! the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions - int rows, cols; - - //! custom allocator - MatAllocator* allocator; - UMatUsageFlags usageFlags; // usage flags for allocator - //! and the standard allocator - static MatAllocator* getStdAllocator(); - - //! internal use method: updates the continuity flag - void updateContinuityFlag(); - - // black-box container of UMat data - UMatData* u; - - // offset of the submatrix (or 0) - size_t offset; - - MatSize size; - MatStep step; - -protected: -}; - - -/////////////////////////// multi-dimensional sparse matrix ////////////////////////// - -/** @brief The class SparseMat represents multi-dimensional sparse numerical arrays. - -Such a sparse array can store elements of any type that Mat can store. *Sparse* means that only -non-zero elements are stored (though, as a result of operations on a sparse matrix, some of its -stored elements can actually become 0. It is up to you to detect such elements and delete them -using SparseMat::erase ). The non-zero elements are stored in a hash table that grows when it is -filled so that the search time is O(1) in average (regardless of whether element is there or not). -Elements can be accessed using the following methods: -- Query operations (SparseMat::ptr and the higher-level SparseMat::ref, SparseMat::value and - SparseMat::find), for example: - @code - const int dims = 5; - int size[5] = {10, 10, 10, 10, 10}; - SparseMat sparse_mat(dims, size, CV_32F); - for(int i = 0; i < 1000; i++) - { - int idx[dims]; - for(int k = 0; k < dims; k++) - idx[k] = rand() % size[k]; - sparse_mat.ref(idx) += 1.f; - } - cout << "nnz = " << sparse_mat.nzcount() << endl; - @endcode -- Sparse matrix iterators. They are similar to MatIterator but different from NAryMatIterator. - That is, the iteration loop is familiar to STL users: - @code - // prints elements of a sparse floating-point matrix - // and the sum of elements. - SparseMatConstIterator_ - it = sparse_mat.begin(), - it_end = sparse_mat.end(); - double s = 0; - int dims = sparse_mat.dims(); - for(; it != it_end; ++it) - { - // print element indices and the element value - const SparseMat::Node* n = it.node(); - printf("("); - for(int i = 0; i < dims; i++) - printf("%d%s", n->idx[i], i < dims-1 ? ", " : ")"); - printf(": %g\n", it.value()); - s += *it; - } - printf("Element sum is %g\n", s); - @endcode - If you run this loop, you will notice that elements are not enumerated in a logical order - (lexicographical, and so on). They come in the same order as they are stored in the hash table - (semi-randomly). You may collect pointers to the nodes and sort them to get the proper ordering. - Note, however, that pointers to the nodes may become invalid when you add more elements to the - matrix. This may happen due to possible buffer reallocation. -- Combination of the above 2 methods when you need to process 2 or more sparse matrices - simultaneously. For example, this is how you can compute unnormalized cross-correlation of the 2 - floating-point sparse matrices: - @code - double cross_corr(const SparseMat& a, const SparseMat& b) - { - const SparseMat *_a = &a, *_b = &b; - // if b contains less elements than a, - // it is faster to iterate through b - if(_a->nzcount() > _b->nzcount()) - std::swap(_a, _b); - SparseMatConstIterator_ it = _a->begin(), - it_end = _a->end(); - double ccorr = 0; - for(; it != it_end; ++it) - { - // take the next element from the first matrix - float avalue = *it; - const Node* anode = it.node(); - // and try to find an element with the same index in the second matrix. - // since the hash value depends only on the element index, - // reuse the hash value stored in the node - float bvalue = _b->value(anode->idx,&anode->hashval); - ccorr += avalue*bvalue; - } - return ccorr; - } - @endcode - */ -class CV_EXPORTS SparseMat -{ -public: - typedef SparseMatIterator iterator; - typedef SparseMatConstIterator const_iterator; - - enum { MAGIC_VAL=0x42FD0000, MAX_DIM=32, HASH_SCALE=0x5bd1e995, HASH_BIT=0x80000000 }; - - //! the sparse matrix header - struct CV_EXPORTS Hdr - { - Hdr(int _dims, const int* _sizes, int _type); - void clear(); - int refcount; - int dims; - int valueOffset; - size_t nodeSize; - size_t nodeCount; - size_t freeList; - std::vector pool; - std::vector hashtab; - int size[MAX_DIM]; - }; - - //! sparse matrix node - element of a hash table - struct CV_EXPORTS Node - { - //! hash value - size_t hashval; - //! index of the next node in the same hash table entry - size_t next; - //! index of the matrix element - int idx[MAX_DIM]; - }; - - /** @brief Various SparseMat constructors. - */ - SparseMat(); - - /** @overload - @param dims Array dimensionality. - @param _sizes Sparce matrix size on all dementions. - @param _type Sparse matrix data type. - */ - SparseMat(int dims, const int* _sizes, int _type); - - /** @overload - @param m Source matrix for copy constructor. If m is dense matrix (ocvMat) then it will be converted - to sparse representation. - */ - SparseMat(const SparseMat& m); - - /** @overload - @param m Source matrix for copy constructor. If m is dense matrix (ocvMat) then it will be converted - to sparse representation. - */ - explicit SparseMat(const Mat& m); - - //! the destructor - ~SparseMat(); - - //! assignment operator. This is O(1) operation, i.e. no data is copied - SparseMat& operator = (const SparseMat& m); - //! equivalent to the corresponding constructor - SparseMat& operator = (const Mat& m); - - //! creates full copy of the matrix - SparseMat clone() const CV_NODISCARD; - - //! copies all the data to the destination matrix. All the previous content of m is erased - void copyTo( SparseMat& m ) const; - //! converts sparse matrix to dense matrix. - void copyTo( Mat& m ) const; - //! multiplies all the matrix elements by the specified scale factor alpha and converts the results to the specified data type - void convertTo( SparseMat& m, int rtype, double alpha=1 ) const; - //! converts sparse matrix to dense n-dim matrix with optional type conversion and scaling. - /*! - @param [out] m - output matrix; if it does not have a proper size or type before the operation, - it is reallocated - @param [in] rtype - desired output matrix type or, rather, the depth since the number of channels - are the same as the input has; if rtype is negative, the output matrix will have the - same type as the input. - @param [in] alpha - optional scale factor - @param [in] beta - optional delta added to the scaled values - */ - void convertTo( Mat& m, int rtype, double alpha=1, double beta=0 ) const; - - // not used now - void assignTo( SparseMat& m, int type=-1 ) const; - - //! reallocates sparse matrix. - /*! - If the matrix already had the proper size and type, - it is simply cleared with clear(), otherwise, - the old matrix is released (using release()) and the new one is allocated. - */ - void create(int dims, const int* _sizes, int _type); - //! sets all the sparse matrix elements to 0, which means clearing the hash table. - void clear(); - //! manually increments the reference counter to the header. - void addref(); - // decrements the header reference counter. When the counter reaches 0, the header and all the underlying data are deallocated. - void release(); - - //! converts sparse matrix to the old-style representation; all the elements are copied. - //operator CvSparseMat*() const; - //! returns the size of each element in bytes (not including the overhead - the space occupied by SparseMat::Node elements) - size_t elemSize() const; - //! returns elemSize()/channels() - size_t elemSize1() const; - - //! returns type of sparse matrix elements - int type() const; - //! returns the depth of sparse matrix elements - int depth() const; - //! returns the number of channels - int channels() const; - - //! returns the array of sizes, or NULL if the matrix is not allocated - const int* size() const; - //! returns the size of i-th matrix dimension (or 0) - int size(int i) const; - //! returns the matrix dimensionality - int dims() const; - //! returns the number of non-zero elements (=the number of hash table nodes) - size_t nzcount() const; - - //! computes the element hash value (1D case) - size_t hash(int i0) const; - //! computes the element hash value (2D case) - size_t hash(int i0, int i1) const; - //! computes the element hash value (3D case) - size_t hash(int i0, int i1, int i2) const; - //! computes the element hash value (nD case) - size_t hash(const int* idx) const; - - //!@{ - /*! - specialized variants for 1D, 2D, 3D cases and the generic_type one for n-D case. - return pointer to the matrix element. - - if the element is there (it's non-zero), the pointer to it is returned - - if it's not there and createMissing=false, NULL pointer is returned - - if it's not there and createMissing=true, then the new element - is created and initialized with 0. Pointer to it is returned - - if the optional hashval pointer is not NULL, the element hash value is - not computed, but *hashval is taken instead. - */ - //! returns pointer to the specified element (1D case) - uchar* ptr(int i0, bool createMissing, size_t* hashval=0); - //! returns pointer to the specified element (2D case) - uchar* ptr(int i0, int i1, bool createMissing, size_t* hashval=0); - //! returns pointer to the specified element (3D case) - uchar* ptr(int i0, int i1, int i2, bool createMissing, size_t* hashval=0); - //! returns pointer to the specified element (nD case) - uchar* ptr(const int* idx, bool createMissing, size_t* hashval=0); - //!@} - - //!@{ - /*! - return read-write reference to the specified sparse matrix element. - - `ref<_Tp>(i0,...[,hashval])` is equivalent to `*(_Tp*)ptr(i0,...,true[,hashval])`. - The methods always return a valid reference. - If the element did not exist, it is created and initialiazed with 0. - */ - //! returns reference to the specified element (1D case) - template _Tp& ref(int i0, size_t* hashval=0); - //! returns reference to the specified element (2D case) - template _Tp& ref(int i0, int i1, size_t* hashval=0); - //! returns reference to the specified element (3D case) - template _Tp& ref(int i0, int i1, int i2, size_t* hashval=0); - //! returns reference to the specified element (nD case) - template _Tp& ref(const int* idx, size_t* hashval=0); - //!@} - - //!@{ - /*! - return value of the specified sparse matrix element. - - `value<_Tp>(i0,...[,hashval])` is equivalent to - @code - { const _Tp* p = find<_Tp>(i0,...[,hashval]); return p ? *p : _Tp(); } - @endcode - - That is, if the element did not exist, the methods return 0. - */ - //! returns value of the specified element (1D case) - template _Tp value(int i0, size_t* hashval=0) const; - //! returns value of the specified element (2D case) - template _Tp value(int i0, int i1, size_t* hashval=0) const; - //! returns value of the specified element (3D case) - template _Tp value(int i0, int i1, int i2, size_t* hashval=0) const; - //! returns value of the specified element (nD case) - template _Tp value(const int* idx, size_t* hashval=0) const; - //!@} - - //!@{ - /*! - Return pointer to the specified sparse matrix element if it exists - - `find<_Tp>(i0,...[,hashval])` is equivalent to `(_const Tp*)ptr(i0,...false[,hashval])`. - - If the specified element does not exist, the methods return NULL. - */ - //! returns pointer to the specified element (1D case) - template const _Tp* find(int i0, size_t* hashval=0) const; - //! returns pointer to the specified element (2D case) - template const _Tp* find(int i0, int i1, size_t* hashval=0) const; - //! returns pointer to the specified element (3D case) - template const _Tp* find(int i0, int i1, int i2, size_t* hashval=0) const; - //! returns pointer to the specified element (nD case) - template const _Tp* find(const int* idx, size_t* hashval=0) const; - //!@} - - //! erases the specified element (2D case) - void erase(int i0, int i1, size_t* hashval=0); - //! erases the specified element (3D case) - void erase(int i0, int i1, int i2, size_t* hashval=0); - //! erases the specified element (nD case) - void erase(const int* idx, size_t* hashval=0); - - //!@{ - /*! - return the sparse matrix iterator pointing to the first sparse matrix element - */ - //! returns the sparse matrix iterator at the matrix beginning - SparseMatIterator begin(); - //! returns the sparse matrix iterator at the matrix beginning - template SparseMatIterator_<_Tp> begin(); - //! returns the read-only sparse matrix iterator at the matrix beginning - SparseMatConstIterator begin() const; - //! returns the read-only sparse matrix iterator at the matrix beginning - template SparseMatConstIterator_<_Tp> begin() const; - //!@} - /*! - return the sparse matrix iterator pointing to the element following the last sparse matrix element - */ - //! returns the sparse matrix iterator at the matrix end - SparseMatIterator end(); - //! returns the read-only sparse matrix iterator at the matrix end - SparseMatConstIterator end() const; - //! returns the typed sparse matrix iterator at the matrix end - template SparseMatIterator_<_Tp> end(); - //! returns the typed read-only sparse matrix iterator at the matrix end - template SparseMatConstIterator_<_Tp> end() const; - - //! returns the value stored in the sparse martix node - template _Tp& value(Node* n); - //! returns the value stored in the sparse martix node - template const _Tp& value(const Node* n) const; - - ////////////// some internal-use methods /////////////// - Node* node(size_t nidx); - const Node* node(size_t nidx) const; - - uchar* newNode(const int* idx, size_t hashval); - void removeNode(size_t hidx, size_t nidx, size_t previdx); - void resizeHashTab(size_t newsize); - - int flags; - Hdr* hdr; -}; - - - -///////////////////////////////// SparseMat_<_Tp> //////////////////////////////////// - -/** @brief Template sparse n-dimensional array class derived from SparseMat - -SparseMat_ is a thin wrapper on top of SparseMat created in the same way as Mat_ . It simplifies -notation of some operations: -@code - int sz[] = {10, 20, 30}; - SparseMat_ M(3, sz); - ... - M.ref(1, 2, 3) = M(4, 5, 6) + M(7, 8, 9); -@endcode - */ -template class SparseMat_ : public SparseMat -{ -public: - typedef SparseMatIterator_<_Tp> iterator; - typedef SparseMatConstIterator_<_Tp> const_iterator; - - //! the default constructor - SparseMat_(); - //! the full constructor equivalent to SparseMat(dims, _sizes, DataType<_Tp>::type) - SparseMat_(int dims, const int* _sizes); - //! the copy constructor. If DataType<_Tp>.type != m.type(), the m elements are converted - SparseMat_(const SparseMat& m); - //! the copy constructor. This is O(1) operation - no data is copied - SparseMat_(const SparseMat_& m); - //! converts dense matrix to the sparse form - SparseMat_(const Mat& m); - //! converts the old-style sparse matrix to the C++ class. All the elements are copied - //SparseMat_(const CvSparseMat* m); - //! the assignment operator. If DataType<_Tp>.type != m.type(), the m elements are converted - SparseMat_& operator = (const SparseMat& m); - //! the assignment operator. This is O(1) operation - no data is copied - SparseMat_& operator = (const SparseMat_& m); - //! converts dense matrix to the sparse form - SparseMat_& operator = (const Mat& m); - - //! makes full copy of the matrix. All the elements are duplicated - SparseMat_ clone() const CV_NODISCARD; - //! equivalent to cv::SparseMat::create(dims, _sizes, DataType<_Tp>::type) - void create(int dims, const int* _sizes); - //! converts sparse matrix to the old-style CvSparseMat. All the elements are copied - //operator CvSparseMat*() const; - - //! returns type of the matrix elements - int type() const; - //! returns depth of the matrix elements - int depth() const; - //! returns the number of channels in each matrix element - int channels() const; - - //! equivalent to SparseMat::ref<_Tp>(i0, hashval) - _Tp& ref(int i0, size_t* hashval=0); - //! equivalent to SparseMat::ref<_Tp>(i0, i1, hashval) - _Tp& ref(int i0, int i1, size_t* hashval=0); - //! equivalent to SparseMat::ref<_Tp>(i0, i1, i2, hashval) - _Tp& ref(int i0, int i1, int i2, size_t* hashval=0); - //! equivalent to SparseMat::ref<_Tp>(idx, hashval) - _Tp& ref(const int* idx, size_t* hashval=0); - - //! equivalent to SparseMat::value<_Tp>(i0, hashval) - _Tp operator()(int i0, size_t* hashval=0) const; - //! equivalent to SparseMat::value<_Tp>(i0, i1, hashval) - _Tp operator()(int i0, int i1, size_t* hashval=0) const; - //! equivalent to SparseMat::value<_Tp>(i0, i1, i2, hashval) - _Tp operator()(int i0, int i1, int i2, size_t* hashval=0) const; - //! equivalent to SparseMat::value<_Tp>(idx, hashval) - _Tp operator()(const int* idx, size_t* hashval=0) const; - - //! returns sparse matrix iterator pointing to the first sparse matrix element - SparseMatIterator_<_Tp> begin(); - //! returns read-only sparse matrix iterator pointing to the first sparse matrix element - SparseMatConstIterator_<_Tp> begin() const; - //! returns sparse matrix iterator pointing to the element following the last sparse matrix element - SparseMatIterator_<_Tp> end(); - //! returns read-only sparse matrix iterator pointing to the element following the last sparse matrix element - SparseMatConstIterator_<_Tp> end() const; -}; - - - -////////////////////////////////// MatConstIterator ////////////////////////////////// - -class CV_EXPORTS MatConstIterator -{ -public: - typedef uchar* value_type; - typedef ptrdiff_t difference_type; - typedef const uchar** pointer; - typedef uchar* reference; - - typedef std::random_access_iterator_tag iterator_category; - - //! default constructor - MatConstIterator(); - //! constructor that sets the iterator to the beginning of the matrix - MatConstIterator(const Mat* _m); - //! constructor that sets the iterator to the specified element of the matrix - MatConstIterator(const Mat* _m, int _row, int _col=0); - //! constructor that sets the iterator to the specified element of the matrix - MatConstIterator(const Mat* _m, Point _pt); - //! constructor that sets the iterator to the specified element of the matrix - MatConstIterator(const Mat* _m, const int* _idx); - //! copy constructor - MatConstIterator(const MatConstIterator& it); - - //! copy operator - MatConstIterator& operator = (const MatConstIterator& it); - //! returns the current matrix element - const uchar* operator *() const; - //! returns the i-th matrix element, relative to the current - const uchar* operator [](ptrdiff_t i) const; - - //! shifts the iterator forward by the specified number of elements - MatConstIterator& operator += (ptrdiff_t ofs); - //! shifts the iterator backward by the specified number of elements - MatConstIterator& operator -= (ptrdiff_t ofs); - //! decrements the iterator - MatConstIterator& operator --(); - //! decrements the iterator - MatConstIterator operator --(int); - //! increments the iterator - MatConstIterator& operator ++(); - //! increments the iterator - MatConstIterator operator ++(int); - //! returns the current iterator position - Point pos() const; - //! returns the current iterator position - void pos(int* _idx) const; - - ptrdiff_t lpos() const; - void seek(ptrdiff_t ofs, bool relative = false); - void seek(const int* _idx, bool relative = false); - - const Mat* m; - size_t elemSize; - const uchar* ptr; - const uchar* sliceStart; - const uchar* sliceEnd; -}; - - - -////////////////////////////////// MatConstIterator_ ///////////////////////////////// - -/** @brief Matrix read-only iterator - */ -template -class MatConstIterator_ : public MatConstIterator -{ -public: - typedef _Tp value_type; - typedef ptrdiff_t difference_type; - typedef const _Tp* pointer; - typedef const _Tp& reference; - - typedef std::random_access_iterator_tag iterator_category; - - //! default constructor - MatConstIterator_(); - //! constructor that sets the iterator to the beginning of the matrix - MatConstIterator_(const Mat_<_Tp>* _m); - //! constructor that sets the iterator to the specified element of the matrix - MatConstIterator_(const Mat_<_Tp>* _m, int _row, int _col=0); - //! constructor that sets the iterator to the specified element of the matrix - MatConstIterator_(const Mat_<_Tp>* _m, Point _pt); - //! constructor that sets the iterator to the specified element of the matrix - MatConstIterator_(const Mat_<_Tp>* _m, const int* _idx); - //! copy constructor - MatConstIterator_(const MatConstIterator_& it); - - //! copy operator - MatConstIterator_& operator = (const MatConstIterator_& it); - //! returns the current matrix element - const _Tp& operator *() const; - //! returns the i-th matrix element, relative to the current - const _Tp& operator [](ptrdiff_t i) const; - - //! shifts the iterator forward by the specified number of elements - MatConstIterator_& operator += (ptrdiff_t ofs); - //! shifts the iterator backward by the specified number of elements - MatConstIterator_& operator -= (ptrdiff_t ofs); - //! decrements the iterator - MatConstIterator_& operator --(); - //! decrements the iterator - MatConstIterator_ operator --(int); - //! increments the iterator - MatConstIterator_& operator ++(); - //! increments the iterator - MatConstIterator_ operator ++(int); - //! returns the current iterator position - Point pos() const; -}; - - - -//////////////////////////////////// MatIterator_ //////////////////////////////////// - -/** @brief Matrix read-write iterator -*/ -template -class MatIterator_ : public MatConstIterator_<_Tp> -{ -public: - typedef _Tp* pointer; - typedef _Tp& reference; - - typedef std::random_access_iterator_tag iterator_category; - - //! the default constructor - MatIterator_(); - //! constructor that sets the iterator to the beginning of the matrix - MatIterator_(Mat_<_Tp>* _m); - //! constructor that sets the iterator to the specified element of the matrix - MatIterator_(Mat_<_Tp>* _m, int _row, int _col=0); - //! constructor that sets the iterator to the specified element of the matrix - MatIterator_(Mat_<_Tp>* _m, Point _pt); - //! constructor that sets the iterator to the specified element of the matrix - MatIterator_(Mat_<_Tp>* _m, const int* _idx); - //! copy constructor - MatIterator_(const MatIterator_& it); - //! copy operator - MatIterator_& operator = (const MatIterator_<_Tp>& it ); - - //! returns the current matrix element - _Tp& operator *() const; - //! returns the i-th matrix element, relative to the current - _Tp& operator [](ptrdiff_t i) const; - - //! shifts the iterator forward by the specified number of elements - MatIterator_& operator += (ptrdiff_t ofs); - //! shifts the iterator backward by the specified number of elements - MatIterator_& operator -= (ptrdiff_t ofs); - //! decrements the iterator - MatIterator_& operator --(); - //! decrements the iterator - MatIterator_ operator --(int); - //! increments the iterator - MatIterator_& operator ++(); - //! increments the iterator - MatIterator_ operator ++(int); -}; - - - -/////////////////////////////// SparseMatConstIterator /////////////////////////////// - -/** @brief Read-Only Sparse Matrix Iterator. - - Here is how to use the iterator to compute the sum of floating-point sparse matrix elements: - - \code - SparseMatConstIterator it = m.begin(), it_end = m.end(); - double s = 0; - CV_Assert( m.type() == CV_32F ); - for( ; it != it_end; ++it ) - s += it.value(); - \endcode -*/ -class CV_EXPORTS SparseMatConstIterator -{ -public: - //! the default constructor - SparseMatConstIterator(); - //! the full constructor setting the iterator to the first sparse matrix element - SparseMatConstIterator(const SparseMat* _m); - //! the copy constructor - SparseMatConstIterator(const SparseMatConstIterator& it); - - //! the assignment operator - SparseMatConstIterator& operator = (const SparseMatConstIterator& it); - - //! template method returning the current matrix element - template const _Tp& value() const; - //! returns the current node of the sparse matrix. it.node->idx is the current element index - const SparseMat::Node* node() const; - - //! moves iterator to the previous element - SparseMatConstIterator& operator --(); - //! moves iterator to the previous element - SparseMatConstIterator operator --(int); - //! moves iterator to the next element - SparseMatConstIterator& operator ++(); - //! moves iterator to the next element - SparseMatConstIterator operator ++(int); - - //! moves iterator to the element after the last element - void seekEnd(); - - const SparseMat* m; - size_t hashidx; - uchar* ptr; -}; - - - -////////////////////////////////// SparseMatIterator ///////////////////////////////// - -/** @brief Read-write Sparse Matrix Iterator - - The class is similar to cv::SparseMatConstIterator, - but can be used for in-place modification of the matrix elements. -*/ -class CV_EXPORTS SparseMatIterator : public SparseMatConstIterator -{ -public: - //! the default constructor - SparseMatIterator(); - //! the full constructor setting the iterator to the first sparse matrix element - SparseMatIterator(SparseMat* _m); - //! the full constructor setting the iterator to the specified sparse matrix element - SparseMatIterator(SparseMat* _m, const int* idx); - //! the copy constructor - SparseMatIterator(const SparseMatIterator& it); - - //! the assignment operator - SparseMatIterator& operator = (const SparseMatIterator& it); - //! returns read-write reference to the current sparse matrix element - template _Tp& value() const; - //! returns pointer to the current sparse matrix node. it.node->idx is the index of the current element (do not modify it!) - SparseMat::Node* node() const; - - //! moves iterator to the next element - SparseMatIterator& operator ++(); - //! moves iterator to the next element - SparseMatIterator operator ++(int); -}; - - - -/////////////////////////////// SparseMatConstIterator_ ////////////////////////////// - -/** @brief Template Read-Only Sparse Matrix Iterator Class. - - This is the derived from SparseMatConstIterator class that - introduces more convenient operator *() for accessing the current element. -*/ -template class SparseMatConstIterator_ : public SparseMatConstIterator -{ -public: - - typedef std::forward_iterator_tag iterator_category; - - //! the default constructor - SparseMatConstIterator_(); - //! the full constructor setting the iterator to the first sparse matrix element - SparseMatConstIterator_(const SparseMat_<_Tp>* _m); - SparseMatConstIterator_(const SparseMat* _m); - //! the copy constructor - SparseMatConstIterator_(const SparseMatConstIterator_& it); - - //! the assignment operator - SparseMatConstIterator_& operator = (const SparseMatConstIterator_& it); - //! the element access operator - const _Tp& operator *() const; - - //! moves iterator to the next element - SparseMatConstIterator_& operator ++(); - //! moves iterator to the next element - SparseMatConstIterator_ operator ++(int); -}; - - - -///////////////////////////////// SparseMatIterator_ ///////////////////////////////// - -/** @brief Template Read-Write Sparse Matrix Iterator Class. - - This is the derived from cv::SparseMatConstIterator_ class that - introduces more convenient operator *() for accessing the current element. -*/ -template class SparseMatIterator_ : public SparseMatConstIterator_<_Tp> -{ -public: - - typedef std::forward_iterator_tag iterator_category; - - //! the default constructor - SparseMatIterator_(); - //! the full constructor setting the iterator to the first sparse matrix element - SparseMatIterator_(SparseMat_<_Tp>* _m); - SparseMatIterator_(SparseMat* _m); - //! the copy constructor - SparseMatIterator_(const SparseMatIterator_& it); - - //! the assignment operator - SparseMatIterator_& operator = (const SparseMatIterator_& it); - //! returns the reference to the current element - _Tp& operator *() const; - - //! moves the iterator to the next element - SparseMatIterator_& operator ++(); - //! moves the iterator to the next element - SparseMatIterator_ operator ++(int); -}; - - - -/////////////////////////////////// NAryMatIterator ////////////////////////////////// - -/** @brief n-ary multi-dimensional array iterator. - -Use the class to implement unary, binary, and, generally, n-ary element-wise operations on -multi-dimensional arrays. Some of the arguments of an n-ary function may be continuous arrays, some -may be not. It is possible to use conventional MatIterator 's for each array but incrementing all of -the iterators after each small operations may be a big overhead. In this case consider using -NAryMatIterator to iterate through several matrices simultaneously as long as they have the same -geometry (dimensionality and all the dimension sizes are the same). On each iteration `it.planes[0]`, -`it.planes[1]`,... will be the slices of the corresponding matrices. - -The example below illustrates how you can compute a normalized and threshold 3D color histogram: -@code - void computeNormalizedColorHist(const Mat& image, Mat& hist, int N, double minProb) - { - const int histSize[] = {N, N, N}; - - // make sure that the histogram has a proper size and type - hist.create(3, histSize, CV_32F); - - // and clear it - hist = Scalar(0); - - // the loop below assumes that the image - // is a 8-bit 3-channel. check it. - CV_Assert(image.type() == CV_8UC3); - MatConstIterator_ it = image.begin(), - it_end = image.end(); - for( ; it != it_end; ++it ) - { - const Vec3b& pix = *it; - hist.at(pix[0]*N/256, pix[1]*N/256, pix[2]*N/256) += 1.f; - } - - minProb *= image.rows*image.cols; - - // initialize iterator (the style is different from STL). - // after initialization the iterator will contain - // the number of slices or planes the iterator will go through. - // it simultaneously increments iterators for several matrices - // supplied as a null terminated list of pointers - const Mat* arrays[] = {&hist, 0}; - Mat planes[1]; - NAryMatIterator itNAry(arrays, planes, 1); - double s = 0; - // iterate through the matrix. on each iteration - // itNAry.planes[i] (of type Mat) will be set to the current plane - // of the i-th n-dim matrix passed to the iterator constructor. - for(int p = 0; p < itNAry.nplanes; p++, ++itNAry) - { - threshold(itNAry.planes[0], itNAry.planes[0], minProb, 0, THRESH_TOZERO); - s += sum(itNAry.planes[0])[0]; - } - - s = 1./s; - itNAry = NAryMatIterator(arrays, planes, 1); - for(int p = 0; p < itNAry.nplanes; p++, ++itNAry) - itNAry.planes[0] *= s; - } -@endcode - */ -class CV_EXPORTS NAryMatIterator -{ -public: - //! the default constructor - NAryMatIterator(); - //! the full constructor taking arbitrary number of n-dim matrices - NAryMatIterator(const Mat** arrays, uchar** ptrs, int narrays=-1); - //! the full constructor taking arbitrary number of n-dim matrices - NAryMatIterator(const Mat** arrays, Mat* planes, int narrays=-1); - //! the separate iterator initialization method - void init(const Mat** arrays, Mat* planes, uchar** ptrs, int narrays=-1); - - //! proceeds to the next plane of every iterated matrix - NAryMatIterator& operator ++(); - //! proceeds to the next plane of every iterated matrix (postfix increment operator) - NAryMatIterator operator ++(int); - - //! the iterated arrays - const Mat** arrays; - //! the current planes - Mat* planes; - //! data pointers - uchar** ptrs; - //! the number of arrays - int narrays; - //! the number of hyper-planes that the iterator steps through - size_t nplanes; - //! the size of each segment (in elements) - size_t size; -protected: - int iterdepth; - size_t idx; -}; - - - -///////////////////////////////// Matrix Expressions ///////////////////////////////// - -class CV_EXPORTS MatOp -{ -public: - MatOp(); - virtual ~MatOp(); - - virtual bool elementWise(const MatExpr& expr) const; - virtual void assign(const MatExpr& expr, Mat& m, int type=-1) const = 0; - virtual void roi(const MatExpr& expr, const Range& rowRange, - const Range& colRange, MatExpr& res) const; - virtual void diag(const MatExpr& expr, int d, MatExpr& res) const; - virtual void augAssignAdd(const MatExpr& expr, Mat& m) const; - virtual void augAssignSubtract(const MatExpr& expr, Mat& m) const; - virtual void augAssignMultiply(const MatExpr& expr, Mat& m) const; - virtual void augAssignDivide(const MatExpr& expr, Mat& m) const; - virtual void augAssignAnd(const MatExpr& expr, Mat& m) const; - virtual void augAssignOr(const MatExpr& expr, Mat& m) const; - virtual void augAssignXor(const MatExpr& expr, Mat& m) const; - - virtual void add(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const; - virtual void add(const MatExpr& expr1, const Scalar& s, MatExpr& res) const; - - virtual void subtract(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const; - virtual void subtract(const Scalar& s, const MatExpr& expr, MatExpr& res) const; - - virtual void multiply(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res, double scale=1) const; - virtual void multiply(const MatExpr& expr1, double s, MatExpr& res) const; - - virtual void divide(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res, double scale=1) const; - virtual void divide(double s, const MatExpr& expr, MatExpr& res) const; - - virtual void abs(const MatExpr& expr, MatExpr& res) const; - - virtual void transpose(const MatExpr& expr, MatExpr& res) const; - virtual void matmul(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const; - virtual void invert(const MatExpr& expr, int method, MatExpr& res) const; - - virtual Size size(const MatExpr& expr) const; - virtual int type(const MatExpr& expr) const; -}; - -/** @brief Matrix expression representation -@anchor MatrixExpressions -This is a list of implemented matrix operations that can be combined in arbitrary complex -expressions (here A, B stand for matrices ( Mat ), s for a scalar ( Scalar ), alpha for a -real-valued scalar ( double )): -- Addition, subtraction, negation: `A+B`, `A-B`, `A+s`, `A-s`, `s+A`, `s-A`, `-A` -- Scaling: `A*alpha` -- Per-element multiplication and division: `A.mul(B)`, `A/B`, `alpha/A` -- Matrix multiplication: `A*B` -- Transposition: `A.t()` (means AT) -- Matrix inversion and pseudo-inversion, solving linear systems and least-squares problems: - `A.inv([method]) (~ A-1)`, `A.inv([method])*B (~ X: AX=B)` -- Comparison: `A cmpop B`, `A cmpop alpha`, `alpha cmpop A`, where *cmpop* is one of - `>`, `>=`, `==`, `!=`, `<=`, `<`. The result of comparison is an 8-bit single channel mask whose - elements are set to 255 (if the particular element or pair of elements satisfy the condition) or - 0. -- Bitwise logical operations: `A logicop B`, `A logicop s`, `s logicop A`, `~A`, where *logicop* is one of - `&`, `|`, `^`. -- Element-wise minimum and maximum: `min(A, B)`, `min(A, alpha)`, `max(A, B)`, `max(A, alpha)` -- Element-wise absolute value: `abs(A)` -- Cross-product, dot-product: `A.cross(B)`, `A.dot(B)` -- Any function of matrix or matrices and scalars that returns a matrix or a scalar, such as norm, - mean, sum, countNonZero, trace, determinant, repeat, and others. -- Matrix initializers ( Mat::eye(), Mat::zeros(), Mat::ones() ), matrix comma-separated - initializers, matrix constructors and operators that extract sub-matrices (see Mat description). -- Mat_() constructors to cast the result to the proper type. -@note Comma-separated initializers and probably some other operations may require additional -explicit Mat() or Mat_() constructor calls to resolve a possible ambiguity. - -Here are examples of matrix expressions: -@code - // compute pseudo-inverse of A, equivalent to A.inv(DECOMP_SVD) - SVD svd(A); - Mat pinvA = svd.vt.t()*Mat::diag(1./svd.w)*svd.u.t(); - - // compute the new vector of parameters in the Levenberg-Marquardt algorithm - x -= (A.t()*A + lambda*Mat::eye(A.cols,A.cols,A.type())).inv(DECOMP_CHOLESKY)*(A.t()*err); - - // sharpen image using "unsharp mask" algorithm - Mat blurred; double sigma = 1, threshold = 5, amount = 1; - GaussianBlur(img, blurred, Size(), sigma, sigma); - Mat lowContrastMask = abs(img - blurred) < threshold; - Mat sharpened = img*(1+amount) + blurred*(-amount); - img.copyTo(sharpened, lowContrastMask); -@endcode -*/ -class CV_EXPORTS MatExpr -{ -public: - MatExpr(); - explicit MatExpr(const Mat& m); - - MatExpr(const MatOp* _op, int _flags, const Mat& _a = Mat(), const Mat& _b = Mat(), - const Mat& _c = Mat(), double _alpha = 1, double _beta = 1, const Scalar& _s = Scalar()); - - operator Mat() const; - template operator Mat_<_Tp>() const; - - Size size() const; - int type() const; - - MatExpr row(int y) const; - MatExpr col(int x) const; - MatExpr diag(int d = 0) const; - MatExpr operator()( const Range& rowRange, const Range& colRange ) const; - MatExpr operator()( const Rect& roi ) const; - - MatExpr t() const; - MatExpr inv(int method = DECOMP_LU) const; - MatExpr mul(const MatExpr& e, double scale=1) const; - MatExpr mul(const Mat& m, double scale=1) const; - - Mat cross(const Mat& m) const; - double dot(const Mat& m) const; - - const MatOp* op; - int flags; - - Mat a, b, c; - double alpha, beta; - Scalar s; -}; - -//! @} core_basic - -//! @relates cv::MatExpr -//! @{ -CV_EXPORTS MatExpr operator + (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator + (const Mat& a, const Scalar& s); -CV_EXPORTS MatExpr operator + (const Scalar& s, const Mat& a); -CV_EXPORTS MatExpr operator + (const MatExpr& e, const Mat& m); -CV_EXPORTS MatExpr operator + (const Mat& m, const MatExpr& e); -CV_EXPORTS MatExpr operator + (const MatExpr& e, const Scalar& s); -CV_EXPORTS MatExpr operator + (const Scalar& s, const MatExpr& e); -CV_EXPORTS MatExpr operator + (const MatExpr& e1, const MatExpr& e2); -template static inline -MatExpr operator + (const Mat& a, const Matx<_Tp, m, n>& b) { return a + Mat(b); } -template static inline -MatExpr operator + (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) + b; } - -CV_EXPORTS MatExpr operator - (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator - (const Mat& a, const Scalar& s); -CV_EXPORTS MatExpr operator - (const Scalar& s, const Mat& a); -CV_EXPORTS MatExpr operator - (const MatExpr& e, const Mat& m); -CV_EXPORTS MatExpr operator - (const Mat& m, const MatExpr& e); -CV_EXPORTS MatExpr operator - (const MatExpr& e, const Scalar& s); -CV_EXPORTS MatExpr operator - (const Scalar& s, const MatExpr& e); -CV_EXPORTS MatExpr operator - (const MatExpr& e1, const MatExpr& e2); -template static inline -MatExpr operator - (const Mat& a, const Matx<_Tp, m, n>& b) { return a - Mat(b); } -template static inline -MatExpr operator - (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) - b; } - -CV_EXPORTS MatExpr operator - (const Mat& m); -CV_EXPORTS MatExpr operator - (const MatExpr& e); - -CV_EXPORTS MatExpr operator * (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator * (const Mat& a, double s); -CV_EXPORTS MatExpr operator * (double s, const Mat& a); -CV_EXPORTS MatExpr operator * (const MatExpr& e, const Mat& m); -CV_EXPORTS MatExpr operator * (const Mat& m, const MatExpr& e); -CV_EXPORTS MatExpr operator * (const MatExpr& e, double s); -CV_EXPORTS MatExpr operator * (double s, const MatExpr& e); -CV_EXPORTS MatExpr operator * (const MatExpr& e1, const MatExpr& e2); -template static inline -MatExpr operator * (const Mat& a, const Matx<_Tp, m, n>& b) { return a * Mat(b); } -template static inline -MatExpr operator * (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) * b; } - -CV_EXPORTS MatExpr operator / (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator / (const Mat& a, double s); -CV_EXPORTS MatExpr operator / (double s, const Mat& a); -CV_EXPORTS MatExpr operator / (const MatExpr& e, const Mat& m); -CV_EXPORTS MatExpr operator / (const Mat& m, const MatExpr& e); -CV_EXPORTS MatExpr operator / (const MatExpr& e, double s); -CV_EXPORTS MatExpr operator / (double s, const MatExpr& e); -CV_EXPORTS MatExpr operator / (const MatExpr& e1, const MatExpr& e2); -template static inline -MatExpr operator / (const Mat& a, const Matx<_Tp, m, n>& b) { return a / Mat(b); } -template static inline -MatExpr operator / (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) / b; } - -CV_EXPORTS MatExpr operator < (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator < (const Mat& a, double s); -CV_EXPORTS MatExpr operator < (double s, const Mat& a); -template static inline -MatExpr operator < (const Mat& a, const Matx<_Tp, m, n>& b) { return a < Mat(b); } -template static inline -MatExpr operator < (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) < b; } - -CV_EXPORTS MatExpr operator <= (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator <= (const Mat& a, double s); -CV_EXPORTS MatExpr operator <= (double s, const Mat& a); -template static inline -MatExpr operator <= (const Mat& a, const Matx<_Tp, m, n>& b) { return a <= Mat(b); } -template static inline -MatExpr operator <= (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) <= b; } - -CV_EXPORTS MatExpr operator == (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator == (const Mat& a, double s); -CV_EXPORTS MatExpr operator == (double s, const Mat& a); -template static inline -MatExpr operator == (const Mat& a, const Matx<_Tp, m, n>& b) { return a == Mat(b); } -template static inline -MatExpr operator == (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) == b; } - -CV_EXPORTS MatExpr operator != (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator != (const Mat& a, double s); -CV_EXPORTS MatExpr operator != (double s, const Mat& a); -template static inline -MatExpr operator != (const Mat& a, const Matx<_Tp, m, n>& b) { return a != Mat(b); } -template static inline -MatExpr operator != (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) != b; } - -CV_EXPORTS MatExpr operator >= (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator >= (const Mat& a, double s); -CV_EXPORTS MatExpr operator >= (double s, const Mat& a); -template static inline -MatExpr operator >= (const Mat& a, const Matx<_Tp, m, n>& b) { return a >= Mat(b); } -template static inline -MatExpr operator >= (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) >= b; } - -CV_EXPORTS MatExpr operator > (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator > (const Mat& a, double s); -CV_EXPORTS MatExpr operator > (double s, const Mat& a); -template static inline -MatExpr operator > (const Mat& a, const Matx<_Tp, m, n>& b) { return a > Mat(b); } -template static inline -MatExpr operator > (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) > b; } - -CV_EXPORTS MatExpr operator & (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator & (const Mat& a, const Scalar& s); -CV_EXPORTS MatExpr operator & (const Scalar& s, const Mat& a); -template static inline -MatExpr operator & (const Mat& a, const Matx<_Tp, m, n>& b) { return a & Mat(b); } -template static inline -MatExpr operator & (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) & b; } - -CV_EXPORTS MatExpr operator | (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator | (const Mat& a, const Scalar& s); -CV_EXPORTS MatExpr operator | (const Scalar& s, const Mat& a); -template static inline -MatExpr operator | (const Mat& a, const Matx<_Tp, m, n>& b) { return a | Mat(b); } -template static inline -MatExpr operator | (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) | b; } - -CV_EXPORTS MatExpr operator ^ (const Mat& a, const Mat& b); -CV_EXPORTS MatExpr operator ^ (const Mat& a, const Scalar& s); -CV_EXPORTS MatExpr operator ^ (const Scalar& s, const Mat& a); -template static inline -MatExpr operator ^ (const Mat& a, const Matx<_Tp, m, n>& b) { return a ^ Mat(b); } -template static inline -MatExpr operator ^ (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) ^ b; } - -CV_EXPORTS MatExpr operator ~(const Mat& m); - -CV_EXPORTS MatExpr min(const Mat& a, const Mat& b); -CV_EXPORTS MatExpr min(const Mat& a, double s); -CV_EXPORTS MatExpr min(double s, const Mat& a); -template static inline -MatExpr min (const Mat& a, const Matx<_Tp, m, n>& b) { return min(a, Mat(b)); } -template static inline -MatExpr min (const Matx<_Tp, m, n>& a, const Mat& b) { return min(Mat(a), b); } - -CV_EXPORTS MatExpr max(const Mat& a, const Mat& b); -CV_EXPORTS MatExpr max(const Mat& a, double s); -CV_EXPORTS MatExpr max(double s, const Mat& a); -template static inline -MatExpr max (const Mat& a, const Matx<_Tp, m, n>& b) { return max(a, Mat(b)); } -template static inline -MatExpr max (const Matx<_Tp, m, n>& a, const Mat& b) { return max(Mat(a), b); } - -/** @brief Calculates an absolute value of each matrix element. - -abs is a meta-function that is expanded to one of absdiff or convertScaleAbs forms: -- C = abs(A-B) is equivalent to `absdiff(A, B, C)` -- C = abs(A) is equivalent to `absdiff(A, Scalar::all(0), C)` -- C = `Mat_ >(abs(A*alpha + beta))` is equivalent to `convertScaleAbs(A, C, alpha, -beta)` - -The output matrix has the same size and the same type as the input one except for the last case, -where C is depth=CV_8U . -@param m matrix. -@sa @ref MatrixExpressions, absdiff, convertScaleAbs - */ -CV_EXPORTS MatExpr abs(const Mat& m); -/** @overload -@param e matrix expression. -*/ -CV_EXPORTS MatExpr abs(const MatExpr& e); -//! @} relates cv::MatExpr - -} // cv - -#include "opencv2/core/mat.inl.hpp" - -#endif // OPENCV_CORE_MAT_HPP diff --git a/opencv/include/opencv2/core/mat.inl.hpp b/opencv/include/opencv2/core/mat.inl.hpp deleted file mode 100644 index a2e7923..0000000 --- a/opencv/include/opencv2/core/mat.inl.hpp +++ /dev/null @@ -1,4027 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_MATRIX_OPERATIONS_HPP -#define OPENCV_CORE_MATRIX_OPERATIONS_HPP - -#ifndef __cplusplus -# error mat.inl.hpp header must be compiled as C++ -#endif - -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4127 ) -#endif - -namespace cv -{ -CV__DEBUG_NS_BEGIN - - -//! @cond IGNORED - -////////////////////////// Custom (raw) type wrapper ////////////////////////// - -template static inline -int rawType() -{ - CV_StaticAssert(sizeof(_Tp) <= CV_CN_MAX, "sizeof(_Tp) is too large"); - const int elemSize = sizeof(_Tp); - return (int)CV_MAKETYPE(CV_8U, elemSize); -} - -//////////////////////// Input/Output Arrays //////////////////////// - -inline void _InputArray::init(int _flags, const void* _obj) -{ flags = _flags; obj = (void*)_obj; } - -inline void _InputArray::init(int _flags, const void* _obj, Size _sz) -{ flags = _flags; obj = (void*)_obj; sz = _sz; } - -inline void* _InputArray::getObj() const { return obj; } -inline int _InputArray::getFlags() const { return flags; } -inline Size _InputArray::getSz() const { return sz; } - -inline _InputArray::_InputArray() { init(NONE, 0); } -inline _InputArray::_InputArray(int _flags, void* _obj) { init(_flags, _obj); } -inline _InputArray::_InputArray(const Mat& m) { init(MAT+ACCESS_READ, &m); } -inline _InputArray::_InputArray(const std::vector& vec) { init(STD_VECTOR_MAT+ACCESS_READ, &vec); } -inline _InputArray::_InputArray(const UMat& m) { init(UMAT+ACCESS_READ, &m); } -inline _InputArray::_InputArray(const std::vector& vec) { init(STD_VECTOR_UMAT+ACCESS_READ, &vec); } - -template inline -_InputArray::_InputArray(const std::vector<_Tp>& vec) -{ init(FIXED_TYPE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_READ, &vec); } - -#ifdef CV_CXX_STD_ARRAY -template inline -_InputArray::_InputArray(const std::array<_Tp, _Nm>& arr) -{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_READ, arr.data(), Size(1, _Nm)); } - -template inline -_InputArray::_InputArray(const std::array& arr) -{ init(STD_ARRAY_MAT + ACCESS_READ, arr.data(), Size(1, _Nm)); } -#endif - -inline -_InputArray::_InputArray(const std::vector& vec) -{ init(FIXED_TYPE + STD_BOOL_VECTOR + traits::Type::value + ACCESS_READ, &vec); } - -template inline -_InputArray::_InputArray(const std::vector >& vec) -{ init(FIXED_TYPE + STD_VECTOR_VECTOR + traits::Type<_Tp>::value + ACCESS_READ, &vec); } - -inline -_InputArray::_InputArray(const std::vector >&) -{ CV_Error(Error::StsUnsupportedFormat, "std::vector > is not supported!\n"); } - -template inline -_InputArray::_InputArray(const std::vector >& vec) -{ init(FIXED_TYPE + STD_VECTOR_MAT + traits::Type<_Tp>::value + ACCESS_READ, &vec); } - -template inline -_InputArray::_InputArray(const Matx<_Tp, m, n>& mtx) -{ init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_READ, &mtx, Size(n, m)); } - -template inline -_InputArray::_InputArray(const _Tp* vec, int n) -{ init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_READ, vec, Size(n, 1)); } - -template inline -_InputArray::_InputArray(const Mat_<_Tp>& m) -{ init(FIXED_TYPE + MAT + traits::Type<_Tp>::value + ACCESS_READ, &m); } - -inline _InputArray::_InputArray(const double& val) -{ init(FIXED_TYPE + FIXED_SIZE + MATX + CV_64F + ACCESS_READ, &val, Size(1,1)); } - -inline _InputArray::_InputArray(const MatExpr& expr) -{ init(FIXED_TYPE + FIXED_SIZE + EXPR + ACCESS_READ, &expr); } - -inline _InputArray::_InputArray(const cuda::GpuMat& d_mat) -{ init(CUDA_GPU_MAT + ACCESS_READ, &d_mat); } - -inline _InputArray::_InputArray(const std::vector& d_mat) -{ init(STD_VECTOR_CUDA_GPU_MAT + ACCESS_READ, &d_mat);} - -inline _InputArray::_InputArray(const ogl::Buffer& buf) -{ init(OPENGL_BUFFER + ACCESS_READ, &buf); } - -inline _InputArray::_InputArray(const cuda::HostMem& cuda_mem) -{ init(CUDA_HOST_MEM + ACCESS_READ, &cuda_mem); } - -template inline -_InputArray _InputArray::rawIn(const std::vector<_Tp>& vec) -{ - _InputArray v; - v.flags = _InputArray::FIXED_TYPE + _InputArray::STD_VECTOR + rawType<_Tp>() + ACCESS_READ; - v.obj = (void*)&vec; - return v; -} - -#ifdef CV_CXX_STD_ARRAY -template inline -_InputArray _InputArray::rawIn(const std::array<_Tp, _Nm>& arr) -{ - _InputArray v; - v.flags = FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_READ; - v.obj = (void*)arr.data(); - v.sz = Size(1, _Nm); - return v; -} -#endif - -inline _InputArray::~_InputArray() {} - -inline Mat _InputArray::getMat(int i) const -{ - if( kind() == MAT && i < 0 ) - return *(const Mat*)obj; - return getMat_(i); -} - -inline bool _InputArray::isMat() const { return kind() == _InputArray::MAT; } -inline bool _InputArray::isUMat() const { return kind() == _InputArray::UMAT; } -inline bool _InputArray::isMatVector() const { return kind() == _InputArray::STD_VECTOR_MAT; } -inline bool _InputArray::isUMatVector() const { return kind() == _InputArray::STD_VECTOR_UMAT; } -inline bool _InputArray::isMatx() const { return kind() == _InputArray::MATX; } -inline bool _InputArray::isVector() const { return kind() == _InputArray::STD_VECTOR || - kind() == _InputArray::STD_BOOL_VECTOR || - kind() == _InputArray::STD_ARRAY; } -inline bool _InputArray::isGpuMat() const { return kind() == _InputArray::CUDA_GPU_MAT; } -inline bool _InputArray::isGpuMatVector() const { return kind() == _InputArray::STD_VECTOR_CUDA_GPU_MAT; } - -//////////////////////////////////////////////////////////////////////////////////////// - -inline _OutputArray::_OutputArray() { init(ACCESS_WRITE, 0); } -inline _OutputArray::_OutputArray(int _flags, void* _obj) { init(_flags|ACCESS_WRITE, _obj); } -inline _OutputArray::_OutputArray(Mat& m) { init(MAT+ACCESS_WRITE, &m); } -inline _OutputArray::_OutputArray(std::vector& vec) { init(STD_VECTOR_MAT+ACCESS_WRITE, &vec); } -inline _OutputArray::_OutputArray(UMat& m) { init(UMAT+ACCESS_WRITE, &m); } -inline _OutputArray::_OutputArray(std::vector& vec) { init(STD_VECTOR_UMAT+ACCESS_WRITE, &vec); } - -template inline -_OutputArray::_OutputArray(std::vector<_Tp>& vec) -{ init(FIXED_TYPE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_WRITE, &vec); } - -#ifdef CV_CXX_STD_ARRAY -template inline -_OutputArray::_OutputArray(std::array<_Tp, _Nm>& arr) -{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_WRITE, arr.data(), Size(1, _Nm)); } - -template inline -_OutputArray::_OutputArray(std::array& arr) -{ init(STD_ARRAY_MAT + ACCESS_WRITE, arr.data(), Size(1, _Nm)); } -#endif - -inline -_OutputArray::_OutputArray(std::vector&) -{ CV_Error(Error::StsUnsupportedFormat, "std::vector cannot be an output array\n"); } - -template inline -_OutputArray::_OutputArray(std::vector >& vec) -{ init(FIXED_TYPE + STD_VECTOR_VECTOR + traits::Type<_Tp>::value + ACCESS_WRITE, &vec); } - -inline -_OutputArray::_OutputArray(std::vector >&) -{ CV_Error(Error::StsUnsupportedFormat, "std::vector > cannot be an output array\n"); } - -template inline -_OutputArray::_OutputArray(std::vector >& vec) -{ init(FIXED_TYPE + STD_VECTOR_MAT + traits::Type<_Tp>::value + ACCESS_WRITE, &vec); } - -template inline -_OutputArray::_OutputArray(Mat_<_Tp>& m) -{ init(FIXED_TYPE + MAT + traits::Type<_Tp>::value + ACCESS_WRITE, &m); } - -template inline -_OutputArray::_OutputArray(Matx<_Tp, m, n>& mtx) -{ init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_WRITE, &mtx, Size(n, m)); } - -template inline -_OutputArray::_OutputArray(_Tp* vec, int n) -{ init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_WRITE, vec, Size(n, 1)); } - -template inline -_OutputArray::_OutputArray(const std::vector<_Tp>& vec) -{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_WRITE, &vec); } - -#ifdef CV_CXX_STD_ARRAY -template inline -_OutputArray::_OutputArray(const std::array<_Tp, _Nm>& arr) -{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_WRITE, arr.data(), Size(1, _Nm)); } - -template inline -_OutputArray::_OutputArray(const std::array& arr) -{ init(FIXED_SIZE + STD_ARRAY_MAT + ACCESS_WRITE, arr.data(), Size(1, _Nm)); } -#endif - -template inline -_OutputArray::_OutputArray(const std::vector >& vec) -{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_VECTOR + traits::Type<_Tp>::value + ACCESS_WRITE, &vec); } - -template inline -_OutputArray::_OutputArray(const std::vector >& vec) -{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_MAT + traits::Type<_Tp>::value + ACCESS_WRITE, &vec); } - -template inline -_OutputArray::_OutputArray(const Mat_<_Tp>& m) -{ init(FIXED_TYPE + FIXED_SIZE + MAT + traits::Type<_Tp>::value + ACCESS_WRITE, &m); } - -template inline -_OutputArray::_OutputArray(const Matx<_Tp, m, n>& mtx) -{ init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_WRITE, &mtx, Size(n, m)); } - -template inline -_OutputArray::_OutputArray(const _Tp* vec, int n) -{ init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_WRITE, vec, Size(n, 1)); } - -inline _OutputArray::_OutputArray(cuda::GpuMat& d_mat) -{ init(CUDA_GPU_MAT + ACCESS_WRITE, &d_mat); } - -inline _OutputArray::_OutputArray(std::vector& d_mat) -{ init(STD_VECTOR_CUDA_GPU_MAT + ACCESS_WRITE, &d_mat);} - -inline _OutputArray::_OutputArray(ogl::Buffer& buf) -{ init(OPENGL_BUFFER + ACCESS_WRITE, &buf); } - -inline _OutputArray::_OutputArray(cuda::HostMem& cuda_mem) -{ init(CUDA_HOST_MEM + ACCESS_WRITE, &cuda_mem); } - -inline _OutputArray::_OutputArray(const Mat& m) -{ init(FIXED_TYPE + FIXED_SIZE + MAT + ACCESS_WRITE, &m); } - -inline _OutputArray::_OutputArray(const std::vector& vec) -{ init(FIXED_SIZE + STD_VECTOR_MAT + ACCESS_WRITE, &vec); } - -inline _OutputArray::_OutputArray(const UMat& m) -{ init(FIXED_TYPE + FIXED_SIZE + UMAT + ACCESS_WRITE, &m); } - -inline _OutputArray::_OutputArray(const std::vector& vec) -{ init(FIXED_SIZE + STD_VECTOR_UMAT + ACCESS_WRITE, &vec); } - -inline _OutputArray::_OutputArray(const cuda::GpuMat& d_mat) -{ init(FIXED_TYPE + FIXED_SIZE + CUDA_GPU_MAT + ACCESS_WRITE, &d_mat); } - - -inline _OutputArray::_OutputArray(const ogl::Buffer& buf) -{ init(FIXED_TYPE + FIXED_SIZE + OPENGL_BUFFER + ACCESS_WRITE, &buf); } - -inline _OutputArray::_OutputArray(const cuda::HostMem& cuda_mem) -{ init(FIXED_TYPE + FIXED_SIZE + CUDA_HOST_MEM + ACCESS_WRITE, &cuda_mem); } - -template inline -_OutputArray _OutputArray::rawOut(std::vector<_Tp>& vec) -{ - _OutputArray v; - v.flags = _InputArray::FIXED_TYPE + _InputArray::STD_VECTOR + rawType<_Tp>() + ACCESS_WRITE; - v.obj = (void*)&vec; - return v; -} - -#ifdef CV_CXX_STD_ARRAY -template inline -_OutputArray _OutputArray::rawOut(std::array<_Tp, _Nm>& arr) -{ - _OutputArray v; - v.flags = FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_WRITE; - v.obj = (void*)arr.data(); - v.sz = Size(1, _Nm); - return v; -} -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -inline _InputOutputArray::_InputOutputArray() { init(ACCESS_RW, 0); } -inline _InputOutputArray::_InputOutputArray(int _flags, void* _obj) { init(_flags|ACCESS_RW, _obj); } -inline _InputOutputArray::_InputOutputArray(Mat& m) { init(MAT+ACCESS_RW, &m); } -inline _InputOutputArray::_InputOutputArray(std::vector& vec) { init(STD_VECTOR_MAT+ACCESS_RW, &vec); } -inline _InputOutputArray::_InputOutputArray(UMat& m) { init(UMAT+ACCESS_RW, &m); } -inline _InputOutputArray::_InputOutputArray(std::vector& vec) { init(STD_VECTOR_UMAT+ACCESS_RW, &vec); } - -template inline -_InputOutputArray::_InputOutputArray(std::vector<_Tp>& vec) -{ init(FIXED_TYPE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_RW, &vec); } - -#ifdef CV_CXX_STD_ARRAY -template inline -_InputOutputArray::_InputOutputArray(std::array<_Tp, _Nm>& arr) -{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_RW, arr.data(), Size(1, _Nm)); } - -template inline -_InputOutputArray::_InputOutputArray(std::array& arr) -{ init(STD_ARRAY_MAT + ACCESS_RW, arr.data(), Size(1, _Nm)); } -#endif - -inline _InputOutputArray::_InputOutputArray(std::vector&) -{ CV_Error(Error::StsUnsupportedFormat, "std::vector cannot be an input/output array\n"); } - -template inline -_InputOutputArray::_InputOutputArray(std::vector >& vec) -{ init(FIXED_TYPE + STD_VECTOR_VECTOR + traits::Type<_Tp>::value + ACCESS_RW, &vec); } - -template inline -_InputOutputArray::_InputOutputArray(std::vector >& vec) -{ init(FIXED_TYPE + STD_VECTOR_MAT + traits::Type<_Tp>::value + ACCESS_RW, &vec); } - -template inline -_InputOutputArray::_InputOutputArray(Mat_<_Tp>& m) -{ init(FIXED_TYPE + MAT + traits::Type<_Tp>::value + ACCESS_RW, &m); } - -template inline -_InputOutputArray::_InputOutputArray(Matx<_Tp, m, n>& mtx) -{ init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_RW, &mtx, Size(n, m)); } - -template inline -_InputOutputArray::_InputOutputArray(_Tp* vec, int n) -{ init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_RW, vec, Size(n, 1)); } - -template inline -_InputOutputArray::_InputOutputArray(const std::vector<_Tp>& vec) -{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_RW, &vec); } - -#ifdef CV_CXX_STD_ARRAY -template inline -_InputOutputArray::_InputOutputArray(const std::array<_Tp, _Nm>& arr) -{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_RW, arr.data(), Size(1, _Nm)); } - -template inline -_InputOutputArray::_InputOutputArray(const std::array& arr) -{ init(FIXED_SIZE + STD_ARRAY_MAT + ACCESS_RW, arr.data(), Size(1, _Nm)); } -#endif - -template inline -_InputOutputArray::_InputOutputArray(const std::vector >& vec) -{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_VECTOR + traits::Type<_Tp>::value + ACCESS_RW, &vec); } - -template inline -_InputOutputArray::_InputOutputArray(const std::vector >& vec) -{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_MAT + traits::Type<_Tp>::value + ACCESS_RW, &vec); } - -template inline -_InputOutputArray::_InputOutputArray(const Mat_<_Tp>& m) -{ init(FIXED_TYPE + FIXED_SIZE + MAT + traits::Type<_Tp>::value + ACCESS_RW, &m); } - -template inline -_InputOutputArray::_InputOutputArray(const Matx<_Tp, m, n>& mtx) -{ init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_RW, &mtx, Size(n, m)); } - -template inline -_InputOutputArray::_InputOutputArray(const _Tp* vec, int n) -{ init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_RW, vec, Size(n, 1)); } - -inline _InputOutputArray::_InputOutputArray(cuda::GpuMat& d_mat) -{ init(CUDA_GPU_MAT + ACCESS_RW, &d_mat); } - -inline _InputOutputArray::_InputOutputArray(ogl::Buffer& buf) -{ init(OPENGL_BUFFER + ACCESS_RW, &buf); } - -inline _InputOutputArray::_InputOutputArray(cuda::HostMem& cuda_mem) -{ init(CUDA_HOST_MEM + ACCESS_RW, &cuda_mem); } - -inline _InputOutputArray::_InputOutputArray(const Mat& m) -{ init(FIXED_TYPE + FIXED_SIZE + MAT + ACCESS_RW, &m); } - -inline _InputOutputArray::_InputOutputArray(const std::vector& vec) -{ init(FIXED_SIZE + STD_VECTOR_MAT + ACCESS_RW, &vec); } - -inline _InputOutputArray::_InputOutputArray(const UMat& m) -{ init(FIXED_TYPE + FIXED_SIZE + UMAT + ACCESS_RW, &m); } - -inline _InputOutputArray::_InputOutputArray(const std::vector& vec) -{ init(FIXED_SIZE + STD_VECTOR_UMAT + ACCESS_RW, &vec); } - -inline _InputOutputArray::_InputOutputArray(const cuda::GpuMat& d_mat) -{ init(FIXED_TYPE + FIXED_SIZE + CUDA_GPU_MAT + ACCESS_RW, &d_mat); } - -inline _InputOutputArray::_InputOutputArray(const std::vector& d_mat) -{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_CUDA_GPU_MAT + ACCESS_RW, &d_mat);} - -template<> inline _InputOutputArray::_InputOutputArray(std::vector& d_mat) -{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_CUDA_GPU_MAT + ACCESS_RW, &d_mat);} - -inline _InputOutputArray::_InputOutputArray(const ogl::Buffer& buf) -{ init(FIXED_TYPE + FIXED_SIZE + OPENGL_BUFFER + ACCESS_RW, &buf); } - -inline _InputOutputArray::_InputOutputArray(const cuda::HostMem& cuda_mem) -{ init(FIXED_TYPE + FIXED_SIZE + CUDA_HOST_MEM + ACCESS_RW, &cuda_mem); } - -template inline -_InputOutputArray _InputOutputArray::rawInOut(std::vector<_Tp>& vec) -{ - _InputOutputArray v; - v.flags = _InputArray::FIXED_TYPE + _InputArray::STD_VECTOR + rawType<_Tp>() + ACCESS_RW; - v.obj = (void*)&vec; - return v; -} - -#ifdef CV_CXX_STD_ARRAY -template inline -_InputOutputArray _InputOutputArray::rawInOut(std::array<_Tp, _Nm>& arr) -{ - _InputOutputArray v; - v.flags = FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_RW; - v.obj = (void*)arr.data(); - v.sz = Size(1, _Nm); - return v; -} -#endif - - -template static inline _InputArray rawIn(_Tp& v) { return _InputArray::rawIn(v); } -template static inline _OutputArray rawOut(_Tp& v) { return _OutputArray::rawOut(v); } -template static inline _InputOutputArray rawInOut(_Tp& v) { return _InputOutputArray::rawInOut(v); } - -CV__DEBUG_NS_END - -//////////////////////////////////////////// Mat ////////////////////////////////////////// - -inline -Mat::Mat() - : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), - datalimit(0), allocator(0), u(0), size(&rows), step(0) -{} - -inline -Mat::Mat(int _rows, int _cols, int _type) - : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), - datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - create(_rows, _cols, _type); -} - -inline -Mat::Mat(int _rows, int _cols, int _type, const Scalar& _s) - : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), - datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - create(_rows, _cols, _type); - *this = _s; -} - -inline -Mat::Mat(Size _sz, int _type) - : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), - datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - create( _sz.height, _sz.width, _type ); -} - -inline -Mat::Mat(Size _sz, int _type, const Scalar& _s) - : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), - datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - create(_sz.height, _sz.width, _type); - *this = _s; -} - -inline -Mat::Mat(int _dims, const int* _sz, int _type) - : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), - datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - create(_dims, _sz, _type); -} - -inline -Mat::Mat(int _dims, const int* _sz, int _type, const Scalar& _s) - : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), - datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - create(_dims, _sz, _type); - *this = _s; -} - -inline -Mat::Mat(const std::vector& _sz, int _type) - : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), - datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - create(_sz, _type); -} - -inline -Mat::Mat(const std::vector& _sz, int _type, const Scalar& _s) - : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), - datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - create(_sz, _type); - *this = _s; -} - -inline -Mat::Mat(const Mat& m) - : flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), data(m.data), - datastart(m.datastart), dataend(m.dataend), datalimit(m.datalimit), allocator(m.allocator), - u(m.u), size(&rows), step(0) -{ - if( u ) - CV_XADD(&u->refcount, 1); - if( m.dims <= 2 ) - { - step[0] = m.step[0]; step[1] = m.step[1]; - } - else - { - dims = 0; - copySize(m); - } -} - -inline -Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step) - : flags(MAGIC_VAL + (_type & TYPE_MASK)), dims(2), rows(_rows), cols(_cols), - data((uchar*)_data), datastart((uchar*)_data), dataend(0), datalimit(0), - allocator(0), u(0), size(&rows) -{ - CV_Assert(total() == 0 || data != NULL); - - size_t esz = CV_ELEM_SIZE(_type), esz1 = CV_ELEM_SIZE1(_type); - size_t minstep = cols * esz; - if( _step == AUTO_STEP ) - { - _step = minstep; - } - else - { - CV_DbgAssert( _step >= minstep ); - if (_step % esz1 != 0) - { - CV_Error(Error::BadStep, "Step must be a multiple of esz1"); - } - } - step[0] = _step; - step[1] = esz; - datalimit = datastart + _step * rows; - dataend = datalimit - _step + minstep; - updateContinuityFlag(); -} - -inline -Mat::Mat(Size _sz, int _type, void* _data, size_t _step) - : flags(MAGIC_VAL + (_type & TYPE_MASK)), dims(2), rows(_sz.height), cols(_sz.width), - data((uchar*)_data), datastart((uchar*)_data), dataend(0), datalimit(0), - allocator(0), u(0), size(&rows) -{ - CV_Assert(total() == 0 || data != NULL); - - size_t esz = CV_ELEM_SIZE(_type), esz1 = CV_ELEM_SIZE1(_type); - size_t minstep = cols*esz; - if( _step == AUTO_STEP ) - { - _step = minstep; - } - else - { - CV_DbgAssert( _step >= minstep ); - - if (_step % esz1 != 0) - { - CV_Error(Error::BadStep, "Step must be a multiple of esz1"); - } - } - step[0] = _step; - step[1] = esz; - datalimit = datastart + _step*rows; - dataend = datalimit - _step + minstep; - updateContinuityFlag(); -} - -template inline -Mat::Mat(const std::vector<_Tp>& vec, bool copyData) - : flags(MAGIC_VAL | traits::Type<_Tp>::value | CV_MAT_CONT_FLAG), dims(2), rows((int)vec.size()), - cols(1), data(0), datastart(0), dataend(0), datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - if(vec.empty()) - return; - if( !copyData ) - { - step[0] = step[1] = sizeof(_Tp); - datastart = data = (uchar*)&vec[0]; - datalimit = dataend = datastart + rows * step[0]; - } - else - Mat((int)vec.size(), 1, traits::Type<_Tp>::value, (uchar*)&vec[0]).copyTo(*this); -} - -#ifdef CV_CXX11 -template inline -Mat::Mat(const std::initializer_list<_Tp> list) - : Mat() -{ - CV_Assert(list.size() != 0); - Mat((int)list.size(), 1, traits::Type<_Tp>::value, (uchar*)list.begin()).copyTo(*this); -} - -template inline -Mat::Mat(const std::initializer_list sizes, const std::initializer_list<_Tp> list) - : Mat() -{ - size_t size_total = 1; - for(auto s : sizes) - size_total *= s; - CV_Assert(list.size() != 0); - CV_Assert(size_total == list.size()); - Mat((int)sizes.size(), (int*)sizes.begin(), traits::Type<_Tp>::value, (uchar*)list.begin()).copyTo(*this); -} -#endif - -#ifdef CV_CXX_STD_ARRAY -template inline -Mat::Mat(const std::array<_Tp, _Nm>& arr, bool copyData) - : flags(MAGIC_VAL | traits::Type<_Tp>::value | CV_MAT_CONT_FLAG), dims(2), rows((int)arr.size()), - cols(1), data(0), datastart(0), dataend(0), datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - if(arr.empty()) - return; - if( !copyData ) - { - step[0] = step[1] = sizeof(_Tp); - datastart = data = (uchar*)arr.data(); - datalimit = dataend = datastart + rows * step[0]; - } - else - Mat((int)arr.size(), 1, traits::Type<_Tp>::value, (uchar*)arr.data()).copyTo(*this); -} -#endif - -template inline -Mat::Mat(const Vec<_Tp, n>& vec, bool copyData) - : flags(MAGIC_VAL | traits::Type<_Tp>::value | CV_MAT_CONT_FLAG), dims(2), rows(n), cols(1), data(0), - datastart(0), dataend(0), datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - if( !copyData ) - { - step[0] = step[1] = sizeof(_Tp); - datastart = data = (uchar*)vec.val; - datalimit = dataend = datastart + rows * step[0]; - } - else - Mat(n, 1, traits::Type<_Tp>::value, (void*)vec.val).copyTo(*this); -} - - -template inline -Mat::Mat(const Matx<_Tp,m,n>& M, bool copyData) - : flags(MAGIC_VAL | traits::Type<_Tp>::value | CV_MAT_CONT_FLAG), dims(2), rows(m), cols(n), data(0), - datastart(0), dataend(0), datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - if( !copyData ) - { - step[0] = cols * sizeof(_Tp); - step[1] = sizeof(_Tp); - datastart = data = (uchar*)M.val; - datalimit = dataend = datastart + rows * step[0]; - } - else - Mat(m, n, traits::Type<_Tp>::value, (uchar*)M.val).copyTo(*this); -} - -template inline -Mat::Mat(const Point_<_Tp>& pt, bool copyData) - : flags(MAGIC_VAL | traits::Type<_Tp>::value | CV_MAT_CONT_FLAG), dims(2), rows(2), cols(1), data(0), - datastart(0), dataend(0), datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - if( !copyData ) - { - step[0] = step[1] = sizeof(_Tp); - datastart = data = (uchar*)&pt.x; - datalimit = dataend = datastart + rows * step[0]; - } - else - { - create(2, 1, traits::Type<_Tp>::value); - ((_Tp*)data)[0] = pt.x; - ((_Tp*)data)[1] = pt.y; - } -} - -template inline -Mat::Mat(const Point3_<_Tp>& pt, bool copyData) - : flags(MAGIC_VAL | traits::Type<_Tp>::value | CV_MAT_CONT_FLAG), dims(2), rows(3), cols(1), data(0), - datastart(0), dataend(0), datalimit(0), allocator(0), u(0), size(&rows), step(0) -{ - if( !copyData ) - { - step[0] = step[1] = sizeof(_Tp); - datastart = data = (uchar*)&pt.x; - datalimit = dataend = datastart + rows * step[0]; - } - else - { - create(3, 1, traits::Type<_Tp>::value); - ((_Tp*)data)[0] = pt.x; - ((_Tp*)data)[1] = pt.y; - ((_Tp*)data)[2] = pt.z; - } -} - -template inline -Mat::Mat(const MatCommaInitializer_<_Tp>& commaInitializer) - : flags(MAGIC_VAL | traits::Type<_Tp>::value | CV_MAT_CONT_FLAG), dims(0), rows(0), cols(0), data(0), - datastart(0), dataend(0), allocator(0), u(0), size(&rows) -{ - *this = commaInitializer.operator Mat_<_Tp>(); -} - -inline -Mat::~Mat() -{ - release(); - if( step.p != step.buf ) - fastFree(step.p); -} - -inline -Mat& Mat::operator = (const Mat& m) -{ - if( this != &m ) - { - if( m.u ) - CV_XADD(&m.u->refcount, 1); - release(); - flags = m.flags; - if( dims <= 2 && m.dims <= 2 ) - { - dims = m.dims; - rows = m.rows; - cols = m.cols; - step[0] = m.step[0]; - step[1] = m.step[1]; - } - else - copySize(m); - data = m.data; - datastart = m.datastart; - dataend = m.dataend; - datalimit = m.datalimit; - allocator = m.allocator; - u = m.u; - } - return *this; -} - -inline -Mat Mat::row(int y) const -{ - return Mat(*this, Range(y, y + 1), Range::all()); -} - -inline -Mat Mat::col(int x) const -{ - return Mat(*this, Range::all(), Range(x, x + 1)); -} - -inline -Mat Mat::rowRange(int startrow, int endrow) const -{ - return Mat(*this, Range(startrow, endrow), Range::all()); -} - -inline -Mat Mat::rowRange(const Range& r) const -{ - return Mat(*this, r, Range::all()); -} - -inline -Mat Mat::colRange(int startcol, int endcol) const -{ - return Mat(*this, Range::all(), Range(startcol, endcol)); -} - -inline -Mat Mat::colRange(const Range& r) const -{ - return Mat(*this, Range::all(), r); -} - -inline -Mat Mat::clone() const -{ - Mat m; - copyTo(m); - return m; -} - -inline -void Mat::assignTo( Mat& m, int _type ) const -{ - if( _type < 0 ) - m = *this; - else - convertTo(m, _type); -} - -inline -void Mat::create(int _rows, int _cols, int _type) -{ - _type &= TYPE_MASK; - if( dims <= 2 && rows == _rows && cols == _cols && type() == _type && data ) - return; - int sz[] = {_rows, _cols}; - create(2, sz, _type); -} - -inline -void Mat::create(Size _sz, int _type) -{ - create(_sz.height, _sz.width, _type); -} - -inline -void Mat::addref() -{ - if( u ) - CV_XADD(&u->refcount, 1); -} - -inline -void Mat::release() -{ - if( u && CV_XADD(&u->refcount, -1) == 1 ) - deallocate(); - u = NULL; - datastart = dataend = datalimit = data = 0; - for(int i = 0; i < dims; i++) - size.p[i] = 0; -#ifdef _DEBUG - flags = MAGIC_VAL; - dims = rows = cols = 0; - if(step.p != step.buf) - { - fastFree(step.p); - step.p = step.buf; - size.p = &rows; - } -#endif -} - -inline -Mat Mat::operator()( Range _rowRange, Range _colRange ) const -{ - return Mat(*this, _rowRange, _colRange); -} - -inline -Mat Mat::operator()( const Rect& roi ) const -{ - return Mat(*this, roi); -} - -inline -Mat Mat::operator()(const Range* ranges) const -{ - return Mat(*this, ranges); -} - -inline -Mat Mat::operator()(const std::vector& ranges) const -{ - return Mat(*this, ranges); -} - -inline -bool Mat::isContinuous() const -{ - return (flags & CONTINUOUS_FLAG) != 0; -} - -inline -bool Mat::isSubmatrix() const -{ - return (flags & SUBMATRIX_FLAG) != 0; -} - -inline -size_t Mat::elemSize() const -{ - size_t res = dims > 0 ? step.p[dims - 1] : 0; - CV_DbgAssert(res != 0); - return res; -} - -inline -size_t Mat::elemSize1() const -{ - return CV_ELEM_SIZE1(flags); -} - -inline -int Mat::type() const -{ - return CV_MAT_TYPE(flags); -} - -inline -int Mat::depth() const -{ - return CV_MAT_DEPTH(flags); -} - -inline -int Mat::channels() const -{ - return CV_MAT_CN(flags); -} - -inline -size_t Mat::step1(int i) const -{ - return step.p[i] / elemSize1(); -} - -inline -bool Mat::empty() const -{ - return data == 0 || total() == 0 || dims == 0; -} - -inline -size_t Mat::total() const -{ - if( dims <= 2 ) - return (size_t)rows * cols; - size_t p = 1; - for( int i = 0; i < dims; i++ ) - p *= size[i]; - return p; -} - -inline -size_t Mat::total(int startDim, int endDim) const -{ - CV_Assert( 0 <= startDim && startDim <= endDim); - size_t p = 1; - int endDim_ = endDim <= dims ? endDim : dims; - for( int i = startDim; i < endDim_; i++ ) - p *= size[i]; - return p; -} - -inline -uchar* Mat::ptr(int y) -{ - CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) ); - return data + step.p[0] * y; -} - -inline -const uchar* Mat::ptr(int y) const -{ - CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) ); - return data + step.p[0] * y; -} - -template inline -_Tp* Mat::ptr(int y) -{ - CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) ); - return (_Tp*)(data + step.p[0] * y); -} - -template inline -const _Tp* Mat::ptr(int y) const -{ - CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) ); - return (const _Tp*)(data + step.p[0] * y); -} - -inline -uchar* Mat::ptr(int i0, int i1) -{ - CV_DbgAssert(dims >= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]); - return data + i0 * step.p[0] + i1 * step.p[1]; -} - -inline -const uchar* Mat::ptr(int i0, int i1) const -{ - CV_DbgAssert(dims >= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]); - return data + i0 * step.p[0] + i1 * step.p[1]; -} - -template inline -_Tp* Mat::ptr(int i0, int i1) -{ - CV_DbgAssert(dims >= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]); - return (_Tp*)(data + i0 * step.p[0] + i1 * step.p[1]); -} - -template inline -const _Tp* Mat::ptr(int i0, int i1) const -{ - CV_DbgAssert(dims >= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]); - return (const _Tp*)(data + i0 * step.p[0] + i1 * step.p[1]); -} - -inline -uchar* Mat::ptr(int i0, int i1, int i2) -{ - CV_DbgAssert(dims >= 3); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]); - CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]); - return data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2]; -} - -inline -const uchar* Mat::ptr(int i0, int i1, int i2) const -{ - CV_DbgAssert(dims >= 3); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]); - CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]); - return data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2]; -} - -template inline -_Tp* Mat::ptr(int i0, int i1, int i2) -{ - CV_DbgAssert(dims >= 3); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]); - CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]); - return (_Tp*)(data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2]); -} - -template inline -const _Tp* Mat::ptr(int i0, int i1, int i2) const -{ - CV_DbgAssert(dims >= 3); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]); - CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]); - return (const _Tp*)(data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2]); -} - -inline -uchar* Mat::ptr(const int* idx) -{ - int i, d = dims; - uchar* p = data; - CV_DbgAssert( d >= 1 && p ); - for( i = 0; i < d; i++ ) - { - CV_DbgAssert( (unsigned)idx[i] < (unsigned)size.p[i] ); - p += idx[i] * step.p[i]; - } - return p; -} - -inline -const uchar* Mat::ptr(const int* idx) const -{ - int i, d = dims; - uchar* p = data; - CV_DbgAssert( d >= 1 && p ); - for( i = 0; i < d; i++ ) - { - CV_DbgAssert( (unsigned)idx[i] < (unsigned)size.p[i] ); - p += idx[i] * step.p[i]; - } - return p; -} - -template inline -_Tp* Mat::ptr(const int* idx) -{ - int i, d = dims; - uchar* p = data; - CV_DbgAssert( d >= 1 && p ); - for( i = 0; i < d; i++ ) - { - CV_DbgAssert( (unsigned)idx[i] < (unsigned)size.p[i] ); - p += idx[i] * step.p[i]; - } - return (_Tp*)p; -} - -template inline -const _Tp* Mat::ptr(const int* idx) const -{ - int i, d = dims; - uchar* p = data; - CV_DbgAssert( d >= 1 && p ); - for( i = 0; i < d; i++ ) - { - CV_DbgAssert( (unsigned)idx[i] < (unsigned)size.p[i] ); - p += idx[i] * step.p[i]; - } - return (const _Tp*)p; -} - -template inline -_Tp& Mat::at(int i0, int i1) -{ - CV_DbgAssert(dims <= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)(i1 * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels())); - CV_DbgAssert(CV_ELEM_SIZE1(traits::Depth<_Tp>::value) == elemSize1()); - return ((_Tp*)(data + step.p[0] * i0))[i1]; -} - -template inline -const _Tp& Mat::at(int i0, int i1) const -{ - CV_DbgAssert(dims <= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)(i1 * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels())); - CV_DbgAssert(CV_ELEM_SIZE1(traits::Depth<_Tp>::value) == elemSize1()); - return ((const _Tp*)(data + step.p[0] * i0))[i1]; -} - -template inline -_Tp& Mat::at(Point pt) -{ - CV_DbgAssert(dims <= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)(pt.x * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels())); - CV_DbgAssert(CV_ELEM_SIZE1(traits::Depth<_Tp>::value) == elemSize1()); - return ((_Tp*)(data + step.p[0] * pt.y))[pt.x]; -} - -template inline -const _Tp& Mat::at(Point pt) const -{ - CV_DbgAssert(dims <= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)(pt.x * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels())); - CV_DbgAssert(CV_ELEM_SIZE1(traits::Depth<_Tp>::value) == elemSize1()); - return ((const _Tp*)(data + step.p[0] * pt.y))[pt.x]; -} - -template inline -_Tp& Mat::at(int i0) -{ - CV_DbgAssert(dims <= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)(size.p[0] * size.p[1])); - CV_DbgAssert(elemSize() == sizeof(_Tp)); - if( isContinuous() || size.p[0] == 1 ) - return ((_Tp*)data)[i0]; - if( size.p[1] == 1 ) - return *(_Tp*)(data + step.p[0] * i0); - int i = i0 / cols, j = i0 - i * cols; - return ((_Tp*)(data + step.p[0] * i))[j]; -} - -template inline -const _Tp& Mat::at(int i0) const -{ - CV_DbgAssert(dims <= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)(size.p[0] * size.p[1])); - CV_DbgAssert(elemSize() == sizeof(_Tp)); - if( isContinuous() || size.p[0] == 1 ) - return ((const _Tp*)data)[i0]; - if( size.p[1] == 1 ) - return *(const _Tp*)(data + step.p[0] * i0); - int i = i0 / cols, j = i0 - i * cols; - return ((const _Tp*)(data + step.p[0] * i))[j]; -} - -template inline -_Tp& Mat::at(int i0, int i1, int i2) -{ - CV_DbgAssert( elemSize() == sizeof(_Tp) ); - return *(_Tp*)ptr(i0, i1, i2); -} - -template inline -const _Tp& Mat::at(int i0, int i1, int i2) const -{ - CV_DbgAssert( elemSize() == sizeof(_Tp) ); - return *(const _Tp*)ptr(i0, i1, i2); -} - -template inline -_Tp& Mat::at(const int* idx) -{ - CV_DbgAssert( elemSize() == sizeof(_Tp) ); - return *(_Tp*)ptr(idx); -} - -template inline -const _Tp& Mat::at(const int* idx) const -{ - CV_DbgAssert( elemSize() == sizeof(_Tp) ); - return *(const _Tp*)ptr(idx); -} - -template inline -_Tp& Mat::at(const Vec& idx) -{ - CV_DbgAssert( elemSize() == sizeof(_Tp) ); - return *(_Tp*)ptr(idx.val); -} - -template inline -const _Tp& Mat::at(const Vec& idx) const -{ - CV_DbgAssert( elemSize() == sizeof(_Tp) ); - return *(const _Tp*)ptr(idx.val); -} - -template inline -MatConstIterator_<_Tp> Mat::begin() const -{ - CV_DbgAssert( elemSize() == sizeof(_Tp) ); - return MatConstIterator_<_Tp>((const Mat_<_Tp>*)this); -} - -template inline -MatConstIterator_<_Tp> Mat::end() const -{ - CV_DbgAssert( elemSize() == sizeof(_Tp) ); - MatConstIterator_<_Tp> it((const Mat_<_Tp>*)this); - it += total(); - return it; -} - -template inline -MatIterator_<_Tp> Mat::begin() -{ - CV_DbgAssert( elemSize() == sizeof(_Tp) ); - return MatIterator_<_Tp>((Mat_<_Tp>*)this); -} - -template inline -MatIterator_<_Tp> Mat::end() -{ - CV_DbgAssert( elemSize() == sizeof(_Tp) ); - MatIterator_<_Tp> it((Mat_<_Tp>*)this); - it += total(); - return it; -} - -template inline -void Mat::forEach(const Functor& operation) { - this->forEach_impl<_Tp>(operation); -} - -template inline -void Mat::forEach(const Functor& operation) const { - // call as not const - (const_cast(this))->forEach<_Tp>(operation); -} - -template inline -Mat::operator std::vector<_Tp>() const -{ - std::vector<_Tp> v; - copyTo(v); - return v; -} - -#ifdef CV_CXX_STD_ARRAY -template inline -Mat::operator std::array<_Tp, _Nm>() const -{ - std::array<_Tp, _Nm> v; - copyTo(v); - return v; -} -#endif - -template inline -Mat::operator Vec<_Tp, n>() const -{ - CV_Assert( data && dims <= 2 && (rows == 1 || cols == 1) && - rows + cols - 1 == n && channels() == 1 ); - - if( isContinuous() && type() == traits::Type<_Tp>::value ) - return Vec<_Tp, n>((_Tp*)data); - Vec<_Tp, n> v; - Mat tmp(rows, cols, traits::Type<_Tp>::value, v.val); - convertTo(tmp, tmp.type()); - return v; -} - -template inline -Mat::operator Matx<_Tp, m, n>() const -{ - CV_Assert( data && dims <= 2 && rows == m && cols == n && channels() == 1 ); - - if( isContinuous() && type() == traits::Type<_Tp>::value ) - return Matx<_Tp, m, n>((_Tp*)data); - Matx<_Tp, m, n> mtx; - Mat tmp(rows, cols, traits::Type<_Tp>::value, mtx.val); - convertTo(tmp, tmp.type()); - return mtx; -} - -template inline -void Mat::push_back(const _Tp& elem) -{ - if( !data ) - { - *this = Mat(1, 1, traits::Type<_Tp>::value, (void*)&elem).clone(); - return; - } - CV_Assert(traits::Type<_Tp>::value == type() && cols == 1 - /* && dims == 2 (cols == 1 implies dims == 2) */); - const uchar* tmp = dataend + step[0]; - if( !isSubmatrix() && isContinuous() && tmp <= datalimit ) - { - *(_Tp*)(data + (size.p[0]++) * step.p[0]) = elem; - dataend = tmp; - } - else - push_back_(&elem); -} - -template inline -void Mat::push_back(const Mat_<_Tp>& m) -{ - push_back((const Mat&)m); -} - -template<> inline -void Mat::push_back(const MatExpr& expr) -{ - push_back(static_cast(expr)); -} - - -template inline -void Mat::push_back(const std::vector<_Tp>& v) -{ - push_back(Mat(v)); -} - -#ifdef CV_CXX_MOVE_SEMANTICS - -inline -Mat::Mat(Mat&& m) - : flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), data(m.data), - datastart(m.datastart), dataend(m.dataend), datalimit(m.datalimit), allocator(m.allocator), - u(m.u), size(&rows) -{ - if (m.dims <= 2) // move new step/size info - { - step[0] = m.step[0]; - step[1] = m.step[1]; - } - else - { - CV_DbgAssert(m.step.p != m.step.buf); - step.p = m.step.p; - size.p = m.size.p; - m.step.p = m.step.buf; - m.size.p = &m.rows; - } - m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0; - m.data = NULL; m.datastart = NULL; m.dataend = NULL; m.datalimit = NULL; - m.allocator = NULL; - m.u = NULL; -} - -inline -Mat& Mat::operator = (Mat&& m) -{ - if (this == &m) - return *this; - - release(); - flags = m.flags; dims = m.dims; rows = m.rows; cols = m.cols; data = m.data; - datastart = m.datastart; dataend = m.dataend; datalimit = m.datalimit; allocator = m.allocator; - u = m.u; - if (step.p != step.buf) // release self step/size - { - fastFree(step.p); - step.p = step.buf; - size.p = &rows; - } - if (m.dims <= 2) // move new step/size info - { - step[0] = m.step[0]; - step[1] = m.step[1]; - } - else - { - CV_DbgAssert(m.step.p != m.step.buf); - step.p = m.step.p; - size.p = m.size.p; - m.step.p = m.step.buf; - m.size.p = &m.rows; - } - m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0; - m.data = NULL; m.datastart = NULL; m.dataend = NULL; m.datalimit = NULL; - m.allocator = NULL; - m.u = NULL; - return *this; -} - -#endif - - -///////////////////////////// MatSize //////////////////////////// - -inline -MatSize::MatSize(int* _p) - : p(_p) {} - -inline -int MatSize::dims() const -{ - return (p - 1)[0]; -} - -inline -Size MatSize::operator()() const -{ - CV_DbgAssert(dims() <= 2); - return Size(p[1], p[0]); -} - -inline -const int& MatSize::operator[](int i) const -{ - CV_DbgAssert(i < dims()); -#ifdef __OPENCV_BUILD - CV_DbgAssert(i >= 0); -#endif - return p[i]; -} - -inline -int& MatSize::operator[](int i) -{ - CV_DbgAssert(i < dims()); -#ifdef __OPENCV_BUILD - CV_DbgAssert(i >= 0); -#endif - return p[i]; -} - -inline -MatSize::operator const int*() const -{ - return p; -} - -inline -bool MatSize::operator == (const MatSize& sz) const -{ - int d = dims(); - int dsz = sz.dims(); - if( d != dsz ) - return false; - if( d == 2 ) - return p[0] == sz.p[0] && p[1] == sz.p[1]; - - for( int i = 0; i < d; i++ ) - if( p[i] != sz.p[i] ) - return false; - return true; -} - -inline -bool MatSize::operator != (const MatSize& sz) const -{ - return !(*this == sz); -} - - - -///////////////////////////// MatStep //////////////////////////// - -inline -MatStep::MatStep() -{ - p = buf; p[0] = p[1] = 0; -} - -inline -MatStep::MatStep(size_t s) -{ - p = buf; p[0] = s; p[1] = 0; -} - -inline -const size_t& MatStep::operator[](int i) const -{ - return p[i]; -} - -inline -size_t& MatStep::operator[](int i) -{ - return p[i]; -} - -inline MatStep::operator size_t() const -{ - CV_DbgAssert( p == buf ); - return buf[0]; -} - -inline MatStep& MatStep::operator = (size_t s) -{ - CV_DbgAssert( p == buf ); - buf[0] = s; - return *this; -} - - - -////////////////////////////// Mat_<_Tp> //////////////////////////// - -template inline -Mat_<_Tp>::Mat_() - : Mat() -{ - flags = (flags & ~CV_MAT_TYPE_MASK) | traits::Type<_Tp>::value; -} - -template inline -Mat_<_Tp>::Mat_(int _rows, int _cols) - : Mat(_rows, _cols, traits::Type<_Tp>::value) -{ -} - -template inline -Mat_<_Tp>::Mat_(int _rows, int _cols, const _Tp& value) - : Mat(_rows, _cols, traits::Type<_Tp>::value) -{ - *this = value; -} - -template inline -Mat_<_Tp>::Mat_(Size _sz) - : Mat(_sz.height, _sz.width, traits::Type<_Tp>::value) -{} - -template inline -Mat_<_Tp>::Mat_(Size _sz, const _Tp& value) - : Mat(_sz.height, _sz.width, traits::Type<_Tp>::value) -{ - *this = value; -} - -template inline -Mat_<_Tp>::Mat_(int _dims, const int* _sz) - : Mat(_dims, _sz, traits::Type<_Tp>::value) -{} - -template inline -Mat_<_Tp>::Mat_(int _dims, const int* _sz, const _Tp& _s) - : Mat(_dims, _sz, traits::Type<_Tp>::value, Scalar(_s)) -{} - -template inline -Mat_<_Tp>::Mat_(int _dims, const int* _sz, _Tp* _data, const size_t* _steps) - : Mat(_dims, _sz, traits::Type<_Tp>::value, _data, _steps) -{} - -template inline -Mat_<_Tp>::Mat_(const Mat_<_Tp>& m, const Range* ranges) - : Mat(m, ranges) -{} - -template inline -Mat_<_Tp>::Mat_(const Mat_<_Tp>& m, const std::vector& ranges) - : Mat(m, ranges) -{} - -template inline -Mat_<_Tp>::Mat_(const Mat& m) - : Mat() -{ - flags = (flags & ~CV_MAT_TYPE_MASK) | traits::Type<_Tp>::value; - *this = m; -} - -template inline -Mat_<_Tp>::Mat_(const Mat_& m) - : Mat(m) -{} - -template inline -Mat_<_Tp>::Mat_(int _rows, int _cols, _Tp* _data, size_t steps) - : Mat(_rows, _cols, traits::Type<_Tp>::value, _data, steps) -{} - -template inline -Mat_<_Tp>::Mat_(const Mat_& m, const Range& _rowRange, const Range& _colRange) - : Mat(m, _rowRange, _colRange) -{} - -template inline -Mat_<_Tp>::Mat_(const Mat_& m, const Rect& roi) - : Mat(m, roi) -{} - -template template inline -Mat_<_Tp>::Mat_(const Vec::channel_type, n>& vec, bool copyData) - : Mat(n / DataType<_Tp>::channels, 1, traits::Type<_Tp>::value, (void*)&vec) -{ - CV_Assert(n%DataType<_Tp>::channels == 0); - if( copyData ) - *this = clone(); -} - -template template inline -Mat_<_Tp>::Mat_(const Matx::channel_type, m, n>& M, bool copyData) - : Mat(m, n / DataType<_Tp>::channels, traits::Type<_Tp>::value, (void*)&M) -{ - CV_Assert(n % DataType<_Tp>::channels == 0); - if( copyData ) - *this = clone(); -} - -template inline -Mat_<_Tp>::Mat_(const Point_::channel_type>& pt, bool copyData) - : Mat(2 / DataType<_Tp>::channels, 1, traits::Type<_Tp>::value, (void*)&pt) -{ - CV_Assert(2 % DataType<_Tp>::channels == 0); - if( copyData ) - *this = clone(); -} - -template inline -Mat_<_Tp>::Mat_(const Point3_::channel_type>& pt, bool copyData) - : Mat(3 / DataType<_Tp>::channels, 1, traits::Type<_Tp>::value, (void*)&pt) -{ - CV_Assert(3 % DataType<_Tp>::channels == 0); - if( copyData ) - *this = clone(); -} - -template inline -Mat_<_Tp>::Mat_(const MatCommaInitializer_<_Tp>& commaInitializer) - : Mat(commaInitializer) -{} - -template inline -Mat_<_Tp>::Mat_(const std::vector<_Tp>& vec, bool copyData) - : Mat(vec, copyData) -{} - -#ifdef CV_CXX11 -template inline -Mat_<_Tp>::Mat_(std::initializer_list<_Tp> list) - : Mat(list) -{} - -template inline -Mat_<_Tp>::Mat_(const std::initializer_list sizes, std::initializer_list<_Tp> list) - : Mat(sizes, list) -{} -#endif - -#ifdef CV_CXX_STD_ARRAY -template template inline -Mat_<_Tp>::Mat_(const std::array<_Tp, _Nm>& arr, bool copyData) - : Mat(arr, copyData) -{} -#endif - -template inline -Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat& m) -{ - if( traits::Type<_Tp>::value == m.type() ) - { - Mat::operator = (m); - return *this; - } - if( traits::Depth<_Tp>::value == m.depth() ) - { - return (*this = m.reshape(DataType<_Tp>::channels, m.dims, 0)); - } - CV_Assert(DataType<_Tp>::channels == m.channels() || m.empty()); - m.convertTo(*this, type()); - return *this; -} - -template inline -Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat_& m) -{ - Mat::operator=(m); - return *this; -} - -template inline -Mat_<_Tp>& Mat_<_Tp>::operator = (const _Tp& s) -{ - typedef typename DataType<_Tp>::vec_type VT; - Mat::operator=(Scalar((const VT&)s)); - return *this; -} - -template inline -void Mat_<_Tp>::create(int _rows, int _cols) -{ - Mat::create(_rows, _cols, traits::Type<_Tp>::value); -} - -template inline -void Mat_<_Tp>::create(Size _sz) -{ - Mat::create(_sz, traits::Type<_Tp>::value); -} - -template inline -void Mat_<_Tp>::create(int _dims, const int* _sz) -{ - Mat::create(_dims, _sz, traits::Type<_Tp>::value); -} - -template inline -void Mat_<_Tp>::release() -{ - Mat::release(); -#ifdef _DEBUG - flags = (flags & ~CV_MAT_TYPE_MASK) | traits::Type<_Tp>::value; -#endif -} - -template inline -Mat_<_Tp> Mat_<_Tp>::cross(const Mat_& m) const -{ - return Mat_<_Tp>(Mat::cross(m)); -} - -template template inline -Mat_<_Tp>::operator Mat_() const -{ - return Mat_(*this); -} - -template inline -Mat_<_Tp> Mat_<_Tp>::row(int y) const -{ - return Mat_(*this, Range(y, y+1), Range::all()); -} - -template inline -Mat_<_Tp> Mat_<_Tp>::col(int x) const -{ - return Mat_(*this, Range::all(), Range(x, x+1)); -} - -template inline -Mat_<_Tp> Mat_<_Tp>::diag(int d) const -{ - return Mat_(Mat::diag(d)); -} - -template inline -Mat_<_Tp> Mat_<_Tp>::clone() const -{ - return Mat_(Mat::clone()); -} - -template inline -size_t Mat_<_Tp>::elemSize() const -{ - CV_DbgAssert( Mat::elemSize() == sizeof(_Tp) ); - return sizeof(_Tp); -} - -template inline -size_t Mat_<_Tp>::elemSize1() const -{ - CV_DbgAssert( Mat::elemSize1() == sizeof(_Tp) / DataType<_Tp>::channels ); - return sizeof(_Tp) / DataType<_Tp>::channels; -} - -template inline -int Mat_<_Tp>::type() const -{ - CV_DbgAssert( Mat::type() == traits::Type<_Tp>::value ); - return traits::Type<_Tp>::value; -} - -template inline -int Mat_<_Tp>::depth() const -{ - CV_DbgAssert( Mat::depth() == traits::Depth<_Tp>::value ); - return traits::Depth<_Tp>::value; -} - -template inline -int Mat_<_Tp>::channels() const -{ - CV_DbgAssert( Mat::channels() == DataType<_Tp>::channels ); - return DataType<_Tp>::channels; -} - -template inline -size_t Mat_<_Tp>::stepT(int i) const -{ - return step.p[i] / elemSize(); -} - -template inline -size_t Mat_<_Tp>::step1(int i) const -{ - return step.p[i] / elemSize1(); -} - -template inline -Mat_<_Tp>& Mat_<_Tp>::adjustROI( int dtop, int dbottom, int dleft, int dright ) -{ - return (Mat_<_Tp>&)(Mat::adjustROI(dtop, dbottom, dleft, dright)); -} - -template inline -Mat_<_Tp> Mat_<_Tp>::operator()( const Range& _rowRange, const Range& _colRange ) const -{ - return Mat_<_Tp>(*this, _rowRange, _colRange); -} - -template inline -Mat_<_Tp> Mat_<_Tp>::operator()( const Rect& roi ) const -{ - return Mat_<_Tp>(*this, roi); -} - -template inline -Mat_<_Tp> Mat_<_Tp>::operator()( const Range* ranges ) const -{ - return Mat_<_Tp>(*this, ranges); -} - -template inline -Mat_<_Tp> Mat_<_Tp>::operator()(const std::vector& ranges) const -{ - return Mat_<_Tp>(*this, ranges); -} - -template inline -_Tp* Mat_<_Tp>::operator [](int y) -{ - CV_DbgAssert( 0 <= y && y < size.p[0] ); - return (_Tp*)(data + y*step.p[0]); -} - -template inline -const _Tp* Mat_<_Tp>::operator [](int y) const -{ - CV_DbgAssert( 0 <= y && y < size.p[0] ); - return (const _Tp*)(data + y*step.p[0]); -} - -template inline -_Tp& Mat_<_Tp>::operator ()(int i0, int i1) -{ - CV_DbgAssert(dims <= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]); - CV_DbgAssert(type() == traits::Type<_Tp>::value); - return ((_Tp*)(data + step.p[0] * i0))[i1]; -} - -template inline -const _Tp& Mat_<_Tp>::operator ()(int i0, int i1) const -{ - CV_DbgAssert(dims <= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]); - CV_DbgAssert(type() == traits::Type<_Tp>::value); - return ((const _Tp*)(data + step.p[0] * i0))[i1]; -} - -template inline -_Tp& Mat_<_Tp>::operator ()(Point pt) -{ - CV_DbgAssert(dims <= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)pt.x < (unsigned)size.p[1]); - CV_DbgAssert(type() == traits::Type<_Tp>::value); - return ((_Tp*)(data + step.p[0] * pt.y))[pt.x]; -} - -template inline -const _Tp& Mat_<_Tp>::operator ()(Point pt) const -{ - CV_DbgAssert(dims <= 2); - CV_DbgAssert(data); - CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]); - CV_DbgAssert((unsigned)pt.x < (unsigned)size.p[1]); - CV_DbgAssert(type() == traits::Type<_Tp>::value); - return ((const _Tp*)(data + step.p[0] * pt.y))[pt.x]; -} - -template inline -_Tp& Mat_<_Tp>::operator ()(const int* idx) -{ - return Mat::at<_Tp>(idx); -} - -template inline -const _Tp& Mat_<_Tp>::operator ()(const int* idx) const -{ - return Mat::at<_Tp>(idx); -} - -template template inline -_Tp& Mat_<_Tp>::operator ()(const Vec& idx) -{ - return Mat::at<_Tp>(idx); -} - -template template inline -const _Tp& Mat_<_Tp>::operator ()(const Vec& idx) const -{ - return Mat::at<_Tp>(idx); -} - -template inline -_Tp& Mat_<_Tp>::operator ()(int i0) -{ - return this->at<_Tp>(i0); -} - -template inline -const _Tp& Mat_<_Tp>::operator ()(int i0) const -{ - return this->at<_Tp>(i0); -} - -template inline -_Tp& Mat_<_Tp>::operator ()(int i0, int i1, int i2) -{ - return this->at<_Tp>(i0, i1, i2); -} - -template inline -const _Tp& Mat_<_Tp>::operator ()(int i0, int i1, int i2) const -{ - return this->at<_Tp>(i0, i1, i2); -} - -template inline -Mat_<_Tp>::operator std::vector<_Tp>() const -{ - std::vector<_Tp> v; - copyTo(v); - return v; -} - -#ifdef CV_CXX_STD_ARRAY -template template inline -Mat_<_Tp>::operator std::array<_Tp, _Nm>() const -{ - std::array<_Tp, _Nm> a; - copyTo(a); - return a; -} -#endif - -template template inline -Mat_<_Tp>::operator Vec::channel_type, n>() const -{ - CV_Assert(n % DataType<_Tp>::channels == 0); - -#if defined _MSC_VER - const Mat* pMat = (const Mat*)this; // workaround for MSVS <= 2012 compiler bugs (but GCC 4.6 dislikes this workaround) - return pMat->operator Vec::channel_type, n>(); -#else - return this->Mat::operator Vec::channel_type, n>(); -#endif -} - -template template inline -Mat_<_Tp>::operator Matx::channel_type, m, n>() const -{ - CV_Assert(n % DataType<_Tp>::channels == 0); - -#if defined _MSC_VER - const Mat* pMat = (const Mat*)this; // workaround for MSVS <= 2012 compiler bugs (but GCC 4.6 dislikes this workaround) - Matx::channel_type, m, n> res = pMat->operator Matx::channel_type, m, n>(); - return res; -#else - Matx::channel_type, m, n> res = this->Mat::operator Matx::channel_type, m, n>(); - return res; -#endif -} - -template inline -MatConstIterator_<_Tp> Mat_<_Tp>::begin() const -{ - return Mat::begin<_Tp>(); -} - -template inline -MatConstIterator_<_Tp> Mat_<_Tp>::end() const -{ - return Mat::end<_Tp>(); -} - -template inline -MatIterator_<_Tp> Mat_<_Tp>::begin() -{ - return Mat::begin<_Tp>(); -} - -template inline -MatIterator_<_Tp> Mat_<_Tp>::end() -{ - return Mat::end<_Tp>(); -} - -template template inline -void Mat_<_Tp>::forEach(const Functor& operation) { - Mat::forEach<_Tp, Functor>(operation); -} - -template template inline -void Mat_<_Tp>::forEach(const Functor& operation) const { - Mat::forEach<_Tp, Functor>(operation); -} - -#ifdef CV_CXX_MOVE_SEMANTICS - -template inline -Mat_<_Tp>::Mat_(Mat_&& m) - : Mat(m) -{ -} - -template inline -Mat_<_Tp>& Mat_<_Tp>::operator = (Mat_&& m) -{ - Mat::operator = (std::move(m)); - return *this; -} - -template inline -Mat_<_Tp>::Mat_(Mat&& m) - : Mat() -{ - flags = (flags & ~CV_MAT_TYPE_MASK) | traits::Type<_Tp>::value; - *this = m; -} - -template inline -Mat_<_Tp>& Mat_<_Tp>::operator = (Mat&& m) -{ - if( traits::Type<_Tp>::value == m.type() ) - { - Mat::operator = ((Mat&&)m); - return *this; - } - if( traits::Depth<_Tp>::value == m.depth() ) - { - Mat::operator = ((Mat&&)m.reshape(DataType<_Tp>::channels, m.dims, 0)); - return *this; - } - CV_DbgAssert(DataType<_Tp>::channels == m.channels()); - m.convertTo(*this, type()); - return *this; -} - -template inline -Mat_<_Tp>::Mat_(MatExpr&& e) - : Mat() -{ - flags = (flags & ~CV_MAT_TYPE_MASK) | traits::Type<_Tp>::value; - *this = Mat(e); -} - -#endif - -///////////////////////////// SparseMat ///////////////////////////// - -inline -SparseMat::SparseMat() - : flags(MAGIC_VAL), hdr(0) -{} - -inline -SparseMat::SparseMat(int _dims, const int* _sizes, int _type) - : flags(MAGIC_VAL), hdr(0) -{ - create(_dims, _sizes, _type); -} - -inline -SparseMat::SparseMat(const SparseMat& m) - : flags(m.flags), hdr(m.hdr) -{ - addref(); -} - -inline -SparseMat::~SparseMat() -{ - release(); -} - -inline -SparseMat& SparseMat::operator = (const SparseMat& m) -{ - if( this != &m ) - { - if( m.hdr ) - CV_XADD(&m.hdr->refcount, 1); - release(); - flags = m.flags; - hdr = m.hdr; - } - return *this; -} - -inline -SparseMat& SparseMat::operator = (const Mat& m) -{ - return (*this = SparseMat(m)); -} - -inline -SparseMat SparseMat::clone() const -{ - SparseMat temp; - this->copyTo(temp); - return temp; -} - -inline -void SparseMat::assignTo( SparseMat& m, int _type ) const -{ - if( _type < 0 ) - m = *this; - else - convertTo(m, _type); -} - -inline -void SparseMat::addref() -{ - if( hdr ) - CV_XADD(&hdr->refcount, 1); -} - -inline -void SparseMat::release() -{ - if( hdr && CV_XADD(&hdr->refcount, -1) == 1 ) - delete hdr; - hdr = 0; -} - -inline -size_t SparseMat::elemSize() const -{ - return CV_ELEM_SIZE(flags); -} - -inline -size_t SparseMat::elemSize1() const -{ - return CV_ELEM_SIZE1(flags); -} - -inline -int SparseMat::type() const -{ - return CV_MAT_TYPE(flags); -} - -inline -int SparseMat::depth() const -{ - return CV_MAT_DEPTH(flags); -} - -inline -int SparseMat::channels() const -{ - return CV_MAT_CN(flags); -} - -inline -const int* SparseMat::size() const -{ - return hdr ? hdr->size : 0; -} - -inline -int SparseMat::size(int i) const -{ - if( hdr ) - { - CV_DbgAssert((unsigned)i < (unsigned)hdr->dims); - return hdr->size[i]; - } - return 0; -} - -inline -int SparseMat::dims() const -{ - return hdr ? hdr->dims : 0; -} - -inline -size_t SparseMat::nzcount() const -{ - return hdr ? hdr->nodeCount : 0; -} - -inline -size_t SparseMat::hash(int i0) const -{ - return (size_t)i0; -} - -inline -size_t SparseMat::hash(int i0, int i1) const -{ - return (size_t)(unsigned)i0 * HASH_SCALE + (unsigned)i1; -} - -inline -size_t SparseMat::hash(int i0, int i1, int i2) const -{ - return ((size_t)(unsigned)i0 * HASH_SCALE + (unsigned)i1) * HASH_SCALE + (unsigned)i2; -} - -inline -size_t SparseMat::hash(const int* idx) const -{ - size_t h = (unsigned)idx[0]; - if( !hdr ) - return 0; - int d = hdr->dims; - for(int i = 1; i < d; i++ ) - h = h * HASH_SCALE + (unsigned)idx[i]; - return h; -} - -template inline -_Tp& SparseMat::ref(int i0, size_t* hashval) -{ - return *(_Tp*)((SparseMat*)this)->ptr(i0, true, hashval); -} - -template inline -_Tp& SparseMat::ref(int i0, int i1, size_t* hashval) -{ - return *(_Tp*)((SparseMat*)this)->ptr(i0, i1, true, hashval); -} - -template inline -_Tp& SparseMat::ref(int i0, int i1, int i2, size_t* hashval) -{ - return *(_Tp*)((SparseMat*)this)->ptr(i0, i1, i2, true, hashval); -} - -template inline -_Tp& SparseMat::ref(const int* idx, size_t* hashval) -{ - return *(_Tp*)((SparseMat*)this)->ptr(idx, true, hashval); -} - -template inline -_Tp SparseMat::value(int i0, size_t* hashval) const -{ - const _Tp* p = (const _Tp*)((SparseMat*)this)->ptr(i0, false, hashval); - return p ? *p : _Tp(); -} - -template inline -_Tp SparseMat::value(int i0, int i1, size_t* hashval) const -{ - const _Tp* p = (const _Tp*)((SparseMat*)this)->ptr(i0, i1, false, hashval); - return p ? *p : _Tp(); -} - -template inline -_Tp SparseMat::value(int i0, int i1, int i2, size_t* hashval) const -{ - const _Tp* p = (const _Tp*)((SparseMat*)this)->ptr(i0, i1, i2, false, hashval); - return p ? *p : _Tp(); -} - -template inline -_Tp SparseMat::value(const int* idx, size_t* hashval) const -{ - const _Tp* p = (const _Tp*)((SparseMat*)this)->ptr(idx, false, hashval); - return p ? *p : _Tp(); -} - -template inline -const _Tp* SparseMat::find(int i0, size_t* hashval) const -{ - return (const _Tp*)((SparseMat*)this)->ptr(i0, false, hashval); -} - -template inline -const _Tp* SparseMat::find(int i0, int i1, size_t* hashval) const -{ - return (const _Tp*)((SparseMat*)this)->ptr(i0, i1, false, hashval); -} - -template inline -const _Tp* SparseMat::find(int i0, int i1, int i2, size_t* hashval) const -{ - return (const _Tp*)((SparseMat*)this)->ptr(i0, i1, i2, false, hashval); -} - -template inline -const _Tp* SparseMat::find(const int* idx, size_t* hashval) const -{ - return (const _Tp*)((SparseMat*)this)->ptr(idx, false, hashval); -} - -template inline -_Tp& SparseMat::value(Node* n) -{ - return *(_Tp*)((uchar*)n + hdr->valueOffset); -} - -template inline -const _Tp& SparseMat::value(const Node* n) const -{ - return *(const _Tp*)((const uchar*)n + hdr->valueOffset); -} - -inline -SparseMat::Node* SparseMat::node(size_t nidx) -{ - return (Node*)(void*)&hdr->pool[nidx]; -} - -inline -const SparseMat::Node* SparseMat::node(size_t nidx) const -{ - return (const Node*)(const void*)&hdr->pool[nidx]; -} - -inline -SparseMatIterator SparseMat::begin() -{ - return SparseMatIterator(this); -} - -inline -SparseMatConstIterator SparseMat::begin() const -{ - return SparseMatConstIterator(this); -} - -inline -SparseMatIterator SparseMat::end() -{ - SparseMatIterator it(this); - it.seekEnd(); - return it; -} - -inline -SparseMatConstIterator SparseMat::end() const -{ - SparseMatConstIterator it(this); - it.seekEnd(); - return it; -} - -template inline -SparseMatIterator_<_Tp> SparseMat::begin() -{ - return SparseMatIterator_<_Tp>(this); -} - -template inline -SparseMatConstIterator_<_Tp> SparseMat::begin() const -{ - return SparseMatConstIterator_<_Tp>(this); -} - -template inline -SparseMatIterator_<_Tp> SparseMat::end() -{ - SparseMatIterator_<_Tp> it(this); - it.seekEnd(); - return it; -} - -template inline -SparseMatConstIterator_<_Tp> SparseMat::end() const -{ - SparseMatConstIterator_<_Tp> it(this); - it.seekEnd(); - return it; -} - - - -///////////////////////////// SparseMat_ //////////////////////////// - -template inline -SparseMat_<_Tp>::SparseMat_() -{ - flags = MAGIC_VAL | traits::Type<_Tp>::value; -} - -template inline -SparseMat_<_Tp>::SparseMat_(int _dims, const int* _sizes) - : SparseMat(_dims, _sizes, traits::Type<_Tp>::value) -{} - -template inline -SparseMat_<_Tp>::SparseMat_(const SparseMat& m) -{ - if( m.type() == traits::Type<_Tp>::value ) - *this = (const SparseMat_<_Tp>&)m; - else - m.convertTo(*this, traits::Type<_Tp>::value); -} - -template inline -SparseMat_<_Tp>::SparseMat_(const SparseMat_<_Tp>& m) -{ - this->flags = m.flags; - this->hdr = m.hdr; - if( this->hdr ) - CV_XADD(&this->hdr->refcount, 1); -} - -template inline -SparseMat_<_Tp>::SparseMat_(const Mat& m) -{ - SparseMat sm(m); - *this = sm; -} - -template inline -SparseMat_<_Tp>& SparseMat_<_Tp>::operator = (const SparseMat_<_Tp>& m) -{ - if( this != &m ) - { - if( m.hdr ) CV_XADD(&m.hdr->refcount, 1); - release(); - flags = m.flags; - hdr = m.hdr; - } - return *this; -} - -template inline -SparseMat_<_Tp>& SparseMat_<_Tp>::operator = (const SparseMat& m) -{ - if( m.type() == traits::Type<_Tp>::value ) - return (*this = (const SparseMat_<_Tp>&)m); - m.convertTo(*this, traits::Type<_Tp>::value); - return *this; -} - -template inline -SparseMat_<_Tp>& SparseMat_<_Tp>::operator = (const Mat& m) -{ - return (*this = SparseMat(m)); -} - -template inline -SparseMat_<_Tp> SparseMat_<_Tp>::clone() const -{ - SparseMat_<_Tp> m; - this->copyTo(m); - return m; -} - -template inline -void SparseMat_<_Tp>::create(int _dims, const int* _sizes) -{ - SparseMat::create(_dims, _sizes, traits::Type<_Tp>::value); -} - -template inline -int SparseMat_<_Tp>::type() const -{ - return traits::Type<_Tp>::value; -} - -template inline -int SparseMat_<_Tp>::depth() const -{ - return traits::Depth<_Tp>::value; -} - -template inline -int SparseMat_<_Tp>::channels() const -{ - return DataType<_Tp>::channels; -} - -template inline -_Tp& SparseMat_<_Tp>::ref(int i0, size_t* hashval) -{ - return SparseMat::ref<_Tp>(i0, hashval); -} - -template inline -_Tp SparseMat_<_Tp>::operator()(int i0, size_t* hashval) const -{ - return SparseMat::value<_Tp>(i0, hashval); -} - -template inline -_Tp& SparseMat_<_Tp>::ref(int i0, int i1, size_t* hashval) -{ - return SparseMat::ref<_Tp>(i0, i1, hashval); -} - -template inline -_Tp SparseMat_<_Tp>::operator()(int i0, int i1, size_t* hashval) const -{ - return SparseMat::value<_Tp>(i0, i1, hashval); -} - -template inline -_Tp& SparseMat_<_Tp>::ref(int i0, int i1, int i2, size_t* hashval) -{ - return SparseMat::ref<_Tp>(i0, i1, i2, hashval); -} - -template inline -_Tp SparseMat_<_Tp>::operator()(int i0, int i1, int i2, size_t* hashval) const -{ - return SparseMat::value<_Tp>(i0, i1, i2, hashval); -} - -template inline -_Tp& SparseMat_<_Tp>::ref(const int* idx, size_t* hashval) -{ - return SparseMat::ref<_Tp>(idx, hashval); -} - -template inline -_Tp SparseMat_<_Tp>::operator()(const int* idx, size_t* hashval) const -{ - return SparseMat::value<_Tp>(idx, hashval); -} - -template inline -SparseMatIterator_<_Tp> SparseMat_<_Tp>::begin() -{ - return SparseMatIterator_<_Tp>(this); -} - -template inline -SparseMatConstIterator_<_Tp> SparseMat_<_Tp>::begin() const -{ - return SparseMatConstIterator_<_Tp>(this); -} - -template inline -SparseMatIterator_<_Tp> SparseMat_<_Tp>::end() -{ - SparseMatIterator_<_Tp> it(this); - it.seekEnd(); - return it; -} - -template inline -SparseMatConstIterator_<_Tp> SparseMat_<_Tp>::end() const -{ - SparseMatConstIterator_<_Tp> it(this); - it.seekEnd(); - return it; -} - - - -////////////////////////// MatConstIterator ///////////////////////// - -inline -MatConstIterator::MatConstIterator() - : m(0), elemSize(0), ptr(0), sliceStart(0), sliceEnd(0) -{} - -inline -MatConstIterator::MatConstIterator(const Mat* _m) - : m(_m), elemSize(_m->elemSize()), ptr(0), sliceStart(0), sliceEnd(0) -{ - if( m && m->isContinuous() ) - { - sliceStart = m->ptr(); - sliceEnd = sliceStart + m->total()*elemSize; - } - seek((const int*)0); -} - -inline -MatConstIterator::MatConstIterator(const Mat* _m, int _row, int _col) - : m(_m), elemSize(_m->elemSize()), ptr(0), sliceStart(0), sliceEnd(0) -{ - CV_Assert(m && m->dims <= 2); - if( m->isContinuous() ) - { - sliceStart = m->ptr(); - sliceEnd = sliceStart + m->total()*elemSize; - } - int idx[] = {_row, _col}; - seek(idx); -} - -inline -MatConstIterator::MatConstIterator(const Mat* _m, Point _pt) - : m(_m), elemSize(_m->elemSize()), ptr(0), sliceStart(0), sliceEnd(0) -{ - CV_Assert(m && m->dims <= 2); - if( m->isContinuous() ) - { - sliceStart = m->ptr(); - sliceEnd = sliceStart + m->total()*elemSize; - } - int idx[] = {_pt.y, _pt.x}; - seek(idx); -} - -inline -MatConstIterator::MatConstIterator(const MatConstIterator& it) - : m(it.m), elemSize(it.elemSize), ptr(it.ptr), sliceStart(it.sliceStart), sliceEnd(it.sliceEnd) -{} - -inline -MatConstIterator& MatConstIterator::operator = (const MatConstIterator& it ) -{ - m = it.m; elemSize = it.elemSize; ptr = it.ptr; - sliceStart = it.sliceStart; sliceEnd = it.sliceEnd; - return *this; -} - -inline -const uchar* MatConstIterator::operator *() const -{ - return ptr; -} - -inline MatConstIterator& MatConstIterator::operator += (ptrdiff_t ofs) -{ - if( !m || ofs == 0 ) - return *this; - ptrdiff_t ofsb = ofs*elemSize; - ptr += ofsb; - if( ptr < sliceStart || sliceEnd <= ptr ) - { - ptr -= ofsb; - seek(ofs, true); - } - return *this; -} - -inline -MatConstIterator& MatConstIterator::operator -= (ptrdiff_t ofs) -{ - return (*this += -ofs); -} - -inline -MatConstIterator& MatConstIterator::operator --() -{ - if( m && (ptr -= elemSize) < sliceStart ) - { - ptr += elemSize; - seek(-1, true); - } - return *this; -} - -inline -MatConstIterator MatConstIterator::operator --(int) -{ - MatConstIterator b = *this; - *this += -1; - return b; -} - -inline -MatConstIterator& MatConstIterator::operator ++() -{ - if( m && (ptr += elemSize) >= sliceEnd ) - { - ptr -= elemSize; - seek(1, true); - } - return *this; -} - -inline MatConstIterator MatConstIterator::operator ++(int) -{ - MatConstIterator b = *this; - *this += 1; - return b; -} - - -static inline -bool operator == (const MatConstIterator& a, const MatConstIterator& b) -{ - return a.m == b.m && a.ptr == b.ptr; -} - -static inline -bool operator != (const MatConstIterator& a, const MatConstIterator& b) -{ - return !(a == b); -} - -static inline -bool operator < (const MatConstIterator& a, const MatConstIterator& b) -{ - return a.ptr < b.ptr; -} - -static inline -bool operator > (const MatConstIterator& a, const MatConstIterator& b) -{ - return a.ptr > b.ptr; -} - -static inline -bool operator <= (const MatConstIterator& a, const MatConstIterator& b) -{ - return a.ptr <= b.ptr; -} - -static inline -bool operator >= (const MatConstIterator& a, const MatConstIterator& b) -{ - return a.ptr >= b.ptr; -} - -static inline -ptrdiff_t operator - (const MatConstIterator& b, const MatConstIterator& a) -{ - if( a.m != b.m ) - return ((size_t)(-1) >> 1); - if( a.sliceEnd == b.sliceEnd ) - return (b.ptr - a.ptr)/static_cast(b.elemSize); - - return b.lpos() - a.lpos(); -} - -static inline -MatConstIterator operator + (const MatConstIterator& a, ptrdiff_t ofs) -{ - MatConstIterator b = a; - return b += ofs; -} - -static inline -MatConstIterator operator + (ptrdiff_t ofs, const MatConstIterator& a) -{ - MatConstIterator b = a; - return b += ofs; -} - -static inline -MatConstIterator operator - (const MatConstIterator& a, ptrdiff_t ofs) -{ - MatConstIterator b = a; - return b += -ofs; -} - - -inline -const uchar* MatConstIterator::operator [](ptrdiff_t i) const -{ - return *(*this + i); -} - - - -///////////////////////// MatConstIterator_ ///////////////////////// - -template inline -MatConstIterator_<_Tp>::MatConstIterator_() -{} - -template inline -MatConstIterator_<_Tp>::MatConstIterator_(const Mat_<_Tp>* _m) - : MatConstIterator(_m) -{} - -template inline -MatConstIterator_<_Tp>::MatConstIterator_(const Mat_<_Tp>* _m, int _row, int _col) - : MatConstIterator(_m, _row, _col) -{} - -template inline -MatConstIterator_<_Tp>::MatConstIterator_(const Mat_<_Tp>* _m, Point _pt) - : MatConstIterator(_m, _pt) -{} - -template inline -MatConstIterator_<_Tp>::MatConstIterator_(const MatConstIterator_& it) - : MatConstIterator(it) -{} - -template inline -MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator = (const MatConstIterator_& it ) -{ - MatConstIterator::operator = (it); - return *this; -} - -template inline -const _Tp& MatConstIterator_<_Tp>::operator *() const -{ - return *(_Tp*)(this->ptr); -} - -template inline -MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator += (ptrdiff_t ofs) -{ - MatConstIterator::operator += (ofs); - return *this; -} - -template inline -MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator -= (ptrdiff_t ofs) -{ - return (*this += -ofs); -} - -template inline -MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator --() -{ - MatConstIterator::operator --(); - return *this; -} - -template inline -MatConstIterator_<_Tp> MatConstIterator_<_Tp>::operator --(int) -{ - MatConstIterator_ b = *this; - MatConstIterator::operator --(); - return b; -} - -template inline -MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator ++() -{ - MatConstIterator::operator ++(); - return *this; -} - -template inline -MatConstIterator_<_Tp> MatConstIterator_<_Tp>::operator ++(int) -{ - MatConstIterator_ b = *this; - MatConstIterator::operator ++(); - return b; -} - - -template inline -Point MatConstIterator_<_Tp>::pos() const -{ - if( !m ) - return Point(); - CV_DbgAssert( m->dims <= 2 ); - if( m->isContinuous() ) - { - ptrdiff_t ofs = (const _Tp*)ptr - (const _Tp*)m->data; - int y = (int)(ofs / m->cols); - int x = (int)(ofs - (ptrdiff_t)y * m->cols); - return Point(x, y); - } - else - { - ptrdiff_t ofs = (uchar*)ptr - m->data; - int y = (int)(ofs / m->step); - int x = (int)((ofs - y * m->step)/sizeof(_Tp)); - return Point(x, y); - } -} - - -template static inline -bool operator == (const MatConstIterator_<_Tp>& a, const MatConstIterator_<_Tp>& b) -{ - return a.m == b.m && a.ptr == b.ptr; -} - -template static inline -bool operator != (const MatConstIterator_<_Tp>& a, const MatConstIterator_<_Tp>& b) -{ - return a.m != b.m || a.ptr != b.ptr; -} - -template static inline -MatConstIterator_<_Tp> operator + (const MatConstIterator_<_Tp>& a, ptrdiff_t ofs) -{ - MatConstIterator t = (const MatConstIterator&)a + ofs; - return (MatConstIterator_<_Tp>&)t; -} - -template static inline -MatConstIterator_<_Tp> operator + (ptrdiff_t ofs, const MatConstIterator_<_Tp>& a) -{ - MatConstIterator t = (const MatConstIterator&)a + ofs; - return (MatConstIterator_<_Tp>&)t; -} - -template static inline -MatConstIterator_<_Tp> operator - (const MatConstIterator_<_Tp>& a, ptrdiff_t ofs) -{ - MatConstIterator t = (const MatConstIterator&)a - ofs; - return (MatConstIterator_<_Tp>&)t; -} - -template inline -const _Tp& MatConstIterator_<_Tp>::operator [](ptrdiff_t i) const -{ - return *(_Tp*)MatConstIterator::operator [](i); -} - - - -//////////////////////////// MatIterator_ /////////////////////////// - -template inline -MatIterator_<_Tp>::MatIterator_() - : MatConstIterator_<_Tp>() -{} - -template inline -MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m) - : MatConstIterator_<_Tp>(_m) -{} - -template inline -MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m, int _row, int _col) - : MatConstIterator_<_Tp>(_m, _row, _col) -{} - -template inline -MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m, Point _pt) - : MatConstIterator_<_Tp>(_m, _pt) -{} - -template inline -MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m, const int* _idx) - : MatConstIterator_<_Tp>(_m, _idx) -{} - -template inline -MatIterator_<_Tp>::MatIterator_(const MatIterator_& it) - : MatConstIterator_<_Tp>(it) -{} - -template inline -MatIterator_<_Tp>& MatIterator_<_Tp>::operator = (const MatIterator_<_Tp>& it ) -{ - MatConstIterator::operator = (it); - return *this; -} - -template inline -_Tp& MatIterator_<_Tp>::operator *() const -{ - return *(_Tp*)(this->ptr); -} - -template inline -MatIterator_<_Tp>& MatIterator_<_Tp>::operator += (ptrdiff_t ofs) -{ - MatConstIterator::operator += (ofs); - return *this; -} - -template inline -MatIterator_<_Tp>& MatIterator_<_Tp>::operator -= (ptrdiff_t ofs) -{ - MatConstIterator::operator += (-ofs); - return *this; -} - -template inline -MatIterator_<_Tp>& MatIterator_<_Tp>::operator --() -{ - MatConstIterator::operator --(); - return *this; -} - -template inline -MatIterator_<_Tp> MatIterator_<_Tp>::operator --(int) -{ - MatIterator_ b = *this; - MatConstIterator::operator --(); - return b; -} - -template inline -MatIterator_<_Tp>& MatIterator_<_Tp>::operator ++() -{ - MatConstIterator::operator ++(); - return *this; -} - -template inline -MatIterator_<_Tp> MatIterator_<_Tp>::operator ++(int) -{ - MatIterator_ b = *this; - MatConstIterator::operator ++(); - return b; -} - -template inline -_Tp& MatIterator_<_Tp>::operator [](ptrdiff_t i) const -{ - return *(*this + i); -} - - -template static inline -bool operator == (const MatIterator_<_Tp>& a, const MatIterator_<_Tp>& b) -{ - return a.m == b.m && a.ptr == b.ptr; -} - -template static inline -bool operator != (const MatIterator_<_Tp>& a, const MatIterator_<_Tp>& b) -{ - return a.m != b.m || a.ptr != b.ptr; -} - -template static inline -MatIterator_<_Tp> operator + (const MatIterator_<_Tp>& a, ptrdiff_t ofs) -{ - MatConstIterator t = (const MatConstIterator&)a + ofs; - return (MatIterator_<_Tp>&)t; -} - -template static inline -MatIterator_<_Tp> operator + (ptrdiff_t ofs, const MatIterator_<_Tp>& a) -{ - MatConstIterator t = (const MatConstIterator&)a + ofs; - return (MatIterator_<_Tp>&)t; -} - -template static inline -MatIterator_<_Tp> operator - (const MatIterator_<_Tp>& a, ptrdiff_t ofs) -{ - MatConstIterator t = (const MatConstIterator&)a - ofs; - return (MatIterator_<_Tp>&)t; -} - - - -/////////////////////// SparseMatConstIterator ////////////////////// - -inline -SparseMatConstIterator::SparseMatConstIterator() - : m(0), hashidx(0), ptr(0) -{} - -inline -SparseMatConstIterator::SparseMatConstIterator(const SparseMatConstIterator& it) - : m(it.m), hashidx(it.hashidx), ptr(it.ptr) -{} - -inline SparseMatConstIterator& SparseMatConstIterator::operator = (const SparseMatConstIterator& it) -{ - if( this != &it ) - { - m = it.m; - hashidx = it.hashidx; - ptr = it.ptr; - } - return *this; -} - -template inline -const _Tp& SparseMatConstIterator::value() const -{ - return *(const _Tp*)ptr; -} - -inline -const SparseMat::Node* SparseMatConstIterator::node() const -{ - return (ptr && m && m->hdr) ? (const SparseMat::Node*)(const void*)(ptr - m->hdr->valueOffset) : 0; -} - -inline -SparseMatConstIterator SparseMatConstIterator::operator ++(int) -{ - SparseMatConstIterator it = *this; - ++*this; - return it; -} - -inline -void SparseMatConstIterator::seekEnd() -{ - if( m && m->hdr ) - { - hashidx = m->hdr->hashtab.size(); - ptr = 0; - } -} - - -static inline -bool operator == (const SparseMatConstIterator& it1, const SparseMatConstIterator& it2) -{ - return it1.m == it2.m && it1.ptr == it2.ptr; -} - -static inline -bool operator != (const SparseMatConstIterator& it1, const SparseMatConstIterator& it2) -{ - return !(it1 == it2); -} - - - -///////////////////////// SparseMatIterator ///////////////////////// - -inline -SparseMatIterator::SparseMatIterator() -{} - -inline -SparseMatIterator::SparseMatIterator(SparseMat* _m) - : SparseMatConstIterator(_m) -{} - -inline -SparseMatIterator::SparseMatIterator(const SparseMatIterator& it) - : SparseMatConstIterator(it) -{} - -inline -SparseMatIterator& SparseMatIterator::operator = (const SparseMatIterator& it) -{ - (SparseMatConstIterator&)*this = it; - return *this; -} - -template inline -_Tp& SparseMatIterator::value() const -{ - return *(_Tp*)ptr; -} - -inline -SparseMat::Node* SparseMatIterator::node() const -{ - return (SparseMat::Node*)SparseMatConstIterator::node(); -} - -inline -SparseMatIterator& SparseMatIterator::operator ++() -{ - SparseMatConstIterator::operator ++(); - return *this; -} - -inline -SparseMatIterator SparseMatIterator::operator ++(int) -{ - SparseMatIterator it = *this; - ++*this; - return it; -} - - - -////////////////////// SparseMatConstIterator_ ////////////////////// - -template inline -SparseMatConstIterator_<_Tp>::SparseMatConstIterator_() -{} - -template inline -SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(const SparseMat_<_Tp>* _m) - : SparseMatConstIterator(_m) -{} - -template inline -SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(const SparseMat* _m) - : SparseMatConstIterator(_m) -{ - CV_Assert( _m->type() == traits::Type<_Tp>::value ); -} - -template inline -SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(const SparseMatConstIterator_<_Tp>& it) - : SparseMatConstIterator(it) -{} - -template inline -SparseMatConstIterator_<_Tp>& SparseMatConstIterator_<_Tp>::operator = (const SparseMatConstIterator_<_Tp>& it) -{ - return reinterpret_cast&> - (*reinterpret_cast(this) = - reinterpret_cast(it)); -} - -template inline -const _Tp& SparseMatConstIterator_<_Tp>::operator *() const -{ - return *(const _Tp*)this->ptr; -} - -template inline -SparseMatConstIterator_<_Tp>& SparseMatConstIterator_<_Tp>::operator ++() -{ - SparseMatConstIterator::operator ++(); - return *this; -} - -template inline -SparseMatConstIterator_<_Tp> SparseMatConstIterator_<_Tp>::operator ++(int) -{ - SparseMatConstIterator_<_Tp> it = *this; - SparseMatConstIterator::operator ++(); - return it; -} - - - -///////////////////////// SparseMatIterator_ //////////////////////// - -template inline -SparseMatIterator_<_Tp>::SparseMatIterator_() -{} - -template inline -SparseMatIterator_<_Tp>::SparseMatIterator_(SparseMat_<_Tp>* _m) - : SparseMatConstIterator_<_Tp>(_m) -{} - -template inline -SparseMatIterator_<_Tp>::SparseMatIterator_(SparseMat* _m) - : SparseMatConstIterator_<_Tp>(_m) -{} - -template inline -SparseMatIterator_<_Tp>::SparseMatIterator_(const SparseMatIterator_<_Tp>& it) - : SparseMatConstIterator_<_Tp>(it) -{} - -template inline -SparseMatIterator_<_Tp>& SparseMatIterator_<_Tp>::operator = (const SparseMatIterator_<_Tp>& it) -{ - return reinterpret_cast&> - (*reinterpret_cast(this) = - reinterpret_cast(it)); -} - -template inline -_Tp& SparseMatIterator_<_Tp>::operator *() const -{ - return *(_Tp*)this->ptr; -} - -template inline -SparseMatIterator_<_Tp>& SparseMatIterator_<_Tp>::operator ++() -{ - SparseMatConstIterator::operator ++(); - return *this; -} - -template inline -SparseMatIterator_<_Tp> SparseMatIterator_<_Tp>::operator ++(int) -{ - SparseMatIterator_<_Tp> it = *this; - SparseMatConstIterator::operator ++(); - return it; -} - - - -//////////////////////// MatCommaInitializer_ /////////////////////// - -template inline -MatCommaInitializer_<_Tp>::MatCommaInitializer_(Mat_<_Tp>* _m) - : it(_m) -{} - -template template inline -MatCommaInitializer_<_Tp>& MatCommaInitializer_<_Tp>::operator , (T2 v) -{ - CV_DbgAssert( this->it < ((const Mat_<_Tp>*)this->it.m)->end() ); - *this->it = _Tp(v); - ++this->it; - return *this; -} - -template inline -MatCommaInitializer_<_Tp>::operator Mat_<_Tp>() const -{ - CV_DbgAssert( this->it == ((const Mat_<_Tp>*)this->it.m)->end() ); - return Mat_<_Tp>(*this->it.m); -} - - -template static inline -MatCommaInitializer_<_Tp> operator << (const Mat_<_Tp>& m, T2 val) -{ - MatCommaInitializer_<_Tp> commaInitializer((Mat_<_Tp>*)&m); - return (commaInitializer, val); -} - - - -///////////////////////// Matrix Expressions //////////////////////// - -inline -Mat& Mat::operator = (const MatExpr& e) -{ - e.op->assign(e, *this); - return *this; -} - -template inline -Mat_<_Tp>::Mat_(const MatExpr& e) -{ - e.op->assign(e, *this, traits::Type<_Tp>::value); -} - -template inline -Mat_<_Tp>& Mat_<_Tp>::operator = (const MatExpr& e) -{ - e.op->assign(e, *this, traits::Type<_Tp>::value); - return *this; -} - -template inline -MatExpr Mat_<_Tp>::zeros(int rows, int cols) -{ - return Mat::zeros(rows, cols, traits::Type<_Tp>::value); -} - -template inline -MatExpr Mat_<_Tp>::zeros(Size sz) -{ - return Mat::zeros(sz, traits::Type<_Tp>::value); -} - -template inline -MatExpr Mat_<_Tp>::ones(int rows, int cols) -{ - return Mat::ones(rows, cols, traits::Type<_Tp>::value); -} - -template inline -MatExpr Mat_<_Tp>::ones(Size sz) -{ - return Mat::ones(sz, traits::Type<_Tp>::value); -} - -template inline -MatExpr Mat_<_Tp>::eye(int rows, int cols) -{ - return Mat::eye(rows, cols, traits::Type<_Tp>::value); -} - -template inline -MatExpr Mat_<_Tp>::eye(Size sz) -{ - return Mat::eye(sz, traits::Type<_Tp>::value); -} - -inline -MatExpr::MatExpr() - : op(0), flags(0), a(Mat()), b(Mat()), c(Mat()), alpha(0), beta(0), s() -{} - -inline -MatExpr::MatExpr(const MatOp* _op, int _flags, const Mat& _a, const Mat& _b, - const Mat& _c, double _alpha, double _beta, const Scalar& _s) - : op(_op), flags(_flags), a(_a), b(_b), c(_c), alpha(_alpha), beta(_beta), s(_s) -{} - -inline -MatExpr::operator Mat() const -{ - Mat m; - op->assign(*this, m); - return m; -} - -template inline -MatExpr::operator Mat_<_Tp>() const -{ - Mat_<_Tp> m; - op->assign(*this, m, traits::Type<_Tp>::value); - return m; -} - - -template static inline -MatExpr min(const Mat_<_Tp>& a, const Mat_<_Tp>& b) -{ - return cv::min((const Mat&)a, (const Mat&)b); -} - -template static inline -MatExpr min(const Mat_<_Tp>& a, double s) -{ - return cv::min((const Mat&)a, s); -} - -template static inline -MatExpr min(double s, const Mat_<_Tp>& a) -{ - return cv::min((const Mat&)a, s); -} - -template static inline -MatExpr max(const Mat_<_Tp>& a, const Mat_<_Tp>& b) -{ - return cv::max((const Mat&)a, (const Mat&)b); -} - -template static inline -MatExpr max(const Mat_<_Tp>& a, double s) -{ - return cv::max((const Mat&)a, s); -} - -template static inline -MatExpr max(double s, const Mat_<_Tp>& a) -{ - return cv::max((const Mat&)a, s); -} - -template static inline -MatExpr abs(const Mat_<_Tp>& m) -{ - return cv::abs((const Mat&)m); -} - - -static inline -Mat& operator += (Mat& a, const MatExpr& b) -{ - b.op->augAssignAdd(b, a); - return a; -} - -static inline -const Mat& operator += (const Mat& a, const MatExpr& b) -{ - b.op->augAssignAdd(b, (Mat&)a); - return a; -} - -template static inline -Mat_<_Tp>& operator += (Mat_<_Tp>& a, const MatExpr& b) -{ - b.op->augAssignAdd(b, a); - return a; -} - -template static inline -const Mat_<_Tp>& operator += (const Mat_<_Tp>& a, const MatExpr& b) -{ - b.op->augAssignAdd(b, (Mat&)a); - return a; -} - -static inline -Mat& operator -= (Mat& a, const MatExpr& b) -{ - b.op->augAssignSubtract(b, a); - return a; -} - -static inline -const Mat& operator -= (const Mat& a, const MatExpr& b) -{ - b.op->augAssignSubtract(b, (Mat&)a); - return a; -} - -template static inline -Mat_<_Tp>& operator -= (Mat_<_Tp>& a, const MatExpr& b) -{ - b.op->augAssignSubtract(b, a); - return a; -} - -template static inline -const Mat_<_Tp>& operator -= (const Mat_<_Tp>& a, const MatExpr& b) -{ - b.op->augAssignSubtract(b, (Mat&)a); - return a; -} - -static inline -Mat& operator *= (Mat& a, const MatExpr& b) -{ - b.op->augAssignMultiply(b, a); - return a; -} - -static inline -const Mat& operator *= (const Mat& a, const MatExpr& b) -{ - b.op->augAssignMultiply(b, (Mat&)a); - return a; -} - -template static inline -Mat_<_Tp>& operator *= (Mat_<_Tp>& a, const MatExpr& b) -{ - b.op->augAssignMultiply(b, a); - return a; -} - -template static inline -const Mat_<_Tp>& operator *= (const Mat_<_Tp>& a, const MatExpr& b) -{ - b.op->augAssignMultiply(b, (Mat&)a); - return a; -} - -static inline -Mat& operator /= (Mat& a, const MatExpr& b) -{ - b.op->augAssignDivide(b, a); - return a; -} - -static inline -const Mat& operator /= (const Mat& a, const MatExpr& b) -{ - b.op->augAssignDivide(b, (Mat&)a); - return a; -} - -template static inline -Mat_<_Tp>& operator /= (Mat_<_Tp>& a, const MatExpr& b) -{ - b.op->augAssignDivide(b, a); - return a; -} - -template static inline -const Mat_<_Tp>& operator /= (const Mat_<_Tp>& a, const MatExpr& b) -{ - b.op->augAssignDivide(b, (Mat&)a); - return a; -} - - -//////////////////////////////// UMat //////////////////////////////// - -inline -UMat::UMat(UMatUsageFlags _usageFlags) -: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows) -{} - -inline -UMat::UMat(int _rows, int _cols, int _type, UMatUsageFlags _usageFlags) -: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows) -{ - create(_rows, _cols, _type); -} - -inline -UMat::UMat(int _rows, int _cols, int _type, const Scalar& _s, UMatUsageFlags _usageFlags) -: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows) -{ - create(_rows, _cols, _type); - *this = _s; -} - -inline -UMat::UMat(Size _sz, int _type, UMatUsageFlags _usageFlags) -: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows) -{ - create( _sz.height, _sz.width, _type ); -} - -inline -UMat::UMat(Size _sz, int _type, const Scalar& _s, UMatUsageFlags _usageFlags) -: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows) -{ - create(_sz.height, _sz.width, _type); - *this = _s; -} - -inline -UMat::UMat(int _dims, const int* _sz, int _type, UMatUsageFlags _usageFlags) -: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows) -{ - create(_dims, _sz, _type); -} - -inline -UMat::UMat(int _dims, const int* _sz, int _type, const Scalar& _s, UMatUsageFlags _usageFlags) -: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows) -{ - create(_dims, _sz, _type); - *this = _s; -} - -inline -UMat::UMat(const UMat& m) -: flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), allocator(m.allocator), - usageFlags(m.usageFlags), u(m.u), offset(m.offset), size(&rows) -{ - addref(); - if( m.dims <= 2 ) - { - step[0] = m.step[0]; step[1] = m.step[1]; - } - else - { - dims = 0; - copySize(m); - } -} - - -template inline -UMat::UMat(const std::vector<_Tp>& vec, bool copyData) -: flags(MAGIC_VAL | traits::Type<_Tp>::value | CV_MAT_CONT_FLAG), dims(2), rows((int)vec.size()), -cols(1), allocator(0), usageFlags(USAGE_DEFAULT), u(0), offset(0), size(&rows) -{ - if(vec.empty()) - return; - if( !copyData ) - { - // !!!TODO!!! - CV_Error(Error::StsNotImplemented, ""); - } - else - Mat((int)vec.size(), 1, traits::Type<_Tp>::value, (uchar*)&vec[0]).copyTo(*this); -} - -inline -UMat& UMat::operator = (const UMat& m) -{ - if( this != &m ) - { - const_cast(m).addref(); - release(); - flags = m.flags; - if( dims <= 2 && m.dims <= 2 ) - { - dims = m.dims; - rows = m.rows; - cols = m.cols; - step[0] = m.step[0]; - step[1] = m.step[1]; - } - else - copySize(m); - allocator = m.allocator; - if (usageFlags == USAGE_DEFAULT) - usageFlags = m.usageFlags; - u = m.u; - offset = m.offset; - } - return *this; -} - -inline -UMat UMat::row(int y) const -{ - return UMat(*this, Range(y, y + 1), Range::all()); -} - -inline -UMat UMat::col(int x) const -{ - return UMat(*this, Range::all(), Range(x, x + 1)); -} - -inline -UMat UMat::rowRange(int startrow, int endrow) const -{ - return UMat(*this, Range(startrow, endrow), Range::all()); -} - -inline -UMat UMat::rowRange(const Range& r) const -{ - return UMat(*this, r, Range::all()); -} - -inline -UMat UMat::colRange(int startcol, int endcol) const -{ - return UMat(*this, Range::all(), Range(startcol, endcol)); -} - -inline -UMat UMat::colRange(const Range& r) const -{ - return UMat(*this, Range::all(), r); -} - -inline -UMat UMat::clone() const -{ - UMat m; - copyTo(m); - return m; -} - -inline -void UMat::assignTo( UMat& m, int _type ) const -{ - if( _type < 0 ) - m = *this; - else - convertTo(m, _type); -} - -inline -void UMat::create(int _rows, int _cols, int _type, UMatUsageFlags _usageFlags) -{ - _type &= TYPE_MASK; - if( dims <= 2 && rows == _rows && cols == _cols && type() == _type && u ) - return; - int sz[] = {_rows, _cols}; - create(2, sz, _type, _usageFlags); -} - -inline -void UMat::create(Size _sz, int _type, UMatUsageFlags _usageFlags) -{ - create(_sz.height, _sz.width, _type, _usageFlags); -} - -inline -void UMat::addref() -{ - if( u ) - CV_XADD(&(u->urefcount), 1); -} - -inline void UMat::release() -{ - if( u && CV_XADD(&(u->urefcount), -1) == 1 ) - deallocate(); - for(int i = 0; i < dims; i++) - size.p[i] = 0; - u = 0; -} - -inline -UMat UMat::operator()( Range _rowRange, Range _colRange ) const -{ - return UMat(*this, _rowRange, _colRange); -} - -inline -UMat UMat::operator()( const Rect& roi ) const -{ - return UMat(*this, roi); -} - -inline -UMat UMat::operator()(const Range* ranges) const -{ - return UMat(*this, ranges); -} - -inline -UMat UMat::operator()(const std::vector& ranges) const -{ - return UMat(*this, ranges); -} - -inline -bool UMat::isContinuous() const -{ - return (flags & CONTINUOUS_FLAG) != 0; -} - -inline -bool UMat::isSubmatrix() const -{ - return (flags & SUBMATRIX_FLAG) != 0; -} - -inline -size_t UMat::elemSize() const -{ - size_t res = dims > 0 ? step.p[dims - 1] : 0; - CV_DbgAssert(res != 0); - return res; -} - -inline -size_t UMat::elemSize1() const -{ - return CV_ELEM_SIZE1(flags); -} - -inline -int UMat::type() const -{ - return CV_MAT_TYPE(flags); -} - -inline -int UMat::depth() const -{ - return CV_MAT_DEPTH(flags); -} - -inline -int UMat::channels() const -{ - return CV_MAT_CN(flags); -} - -inline -size_t UMat::step1(int i) const -{ - return step.p[i] / elemSize1(); -} - -inline -bool UMat::empty() const -{ - return u == 0 || total() == 0 || dims == 0; -} - -inline -size_t UMat::total() const -{ - if( dims <= 2 ) - return (size_t)rows * cols; - size_t p = 1; - for( int i = 0; i < dims; i++ ) - p *= size[i]; - return p; -} - -#ifdef CV_CXX_MOVE_SEMANTICS - -inline -UMat::UMat(UMat&& m) -: flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), allocator(m.allocator), - usageFlags(m.usageFlags), u(m.u), offset(m.offset), size(&rows) -{ - if (m.dims <= 2) // move new step/size info - { - step[0] = m.step[0]; - step[1] = m.step[1]; - } - else - { - CV_DbgAssert(m.step.p != m.step.buf); - step.p = m.step.p; - size.p = m.size.p; - m.step.p = m.step.buf; - m.size.p = &m.rows; - } - m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0; - m.allocator = NULL; - m.u = NULL; - m.offset = 0; -} - -inline -UMat& UMat::operator = (UMat&& m) -{ - if (this == &m) - return *this; - release(); - flags = m.flags; dims = m.dims; rows = m.rows; cols = m.cols; - allocator = m.allocator; usageFlags = m.usageFlags; - u = m.u; - offset = m.offset; - if (step.p != step.buf) // release self step/size - { - fastFree(step.p); - step.p = step.buf; - size.p = &rows; - } - if (m.dims <= 2) // move new step/size info - { - step[0] = m.step[0]; - step[1] = m.step[1]; - } - else - { - CV_DbgAssert(m.step.p != m.step.buf); - step.p = m.step.p; - size.p = m.size.p; - m.step.p = m.step.buf; - m.size.p = &m.rows; - } - m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0; - m.allocator = NULL; - m.u = NULL; - m.offset = 0; - return *this; -} - -#endif - - -inline bool UMatData::hostCopyObsolete() const { return (flags & HOST_COPY_OBSOLETE) != 0; } -inline bool UMatData::deviceCopyObsolete() const { return (flags & DEVICE_COPY_OBSOLETE) != 0; } -inline bool UMatData::deviceMemMapped() const { return (flags & DEVICE_MEM_MAPPED) != 0; } -inline bool UMatData::copyOnMap() const { return (flags & COPY_ON_MAP) != 0; } -inline bool UMatData::tempUMat() const { return (flags & TEMP_UMAT) != 0; } -inline bool UMatData::tempCopiedUMat() const { return (flags & TEMP_COPIED_UMAT) == TEMP_COPIED_UMAT; } - -inline void UMatData::markDeviceMemMapped(bool flag) -{ - if(flag) - flags |= DEVICE_MEM_MAPPED; - else - flags &= ~DEVICE_MEM_MAPPED; -} - -inline void UMatData::markHostCopyObsolete(bool flag) -{ - if(flag) - flags |= HOST_COPY_OBSOLETE; - else - flags &= ~HOST_COPY_OBSOLETE; -} -inline void UMatData::markDeviceCopyObsolete(bool flag) -{ - if(flag) - flags |= DEVICE_COPY_OBSOLETE; - else - flags &= ~DEVICE_COPY_OBSOLETE; -} - -//! @endcond - -} //cv - -#ifdef _MSC_VER -#pragma warning( pop ) -#endif - -#endif diff --git a/opencv/include/opencv2/core/matx.hpp b/opencv/include/opencv2/core/matx.hpp deleted file mode 100644 index d8e17e7..0000000 --- a/opencv/include/opencv2/core/matx.hpp +++ /dev/null @@ -1,1477 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_MATX_HPP -#define OPENCV_CORE_MATX_HPP - -#ifndef __cplusplus -# error matx.hpp header must be compiled as C++ -#endif - -#include "opencv2/core/cvdef.h" -#include "opencv2/core/base.hpp" -#include "opencv2/core/traits.hpp" -#include "opencv2/core/saturate.hpp" - -#ifdef CV_CXX11 -#include -#endif - -namespace cv -{ - -//! @addtogroup core_basic -//! @{ - -////////////////////////////// Small Matrix /////////////////////////// - -//! @cond IGNORED -// FIXIT Remove this (especially CV_EXPORTS modifier) -struct CV_EXPORTS Matx_AddOp { Matx_AddOp() {} Matx_AddOp(const Matx_AddOp&) {} }; -struct CV_EXPORTS Matx_SubOp { Matx_SubOp() {} Matx_SubOp(const Matx_SubOp&) {} }; -struct CV_EXPORTS Matx_ScaleOp { Matx_ScaleOp() {} Matx_ScaleOp(const Matx_ScaleOp&) {} }; -struct CV_EXPORTS Matx_MulOp { Matx_MulOp() {} Matx_MulOp(const Matx_MulOp&) {} }; -struct CV_EXPORTS Matx_DivOp { Matx_DivOp() {} Matx_DivOp(const Matx_DivOp&) {} }; -struct CV_EXPORTS Matx_MatMulOp { Matx_MatMulOp() {} Matx_MatMulOp(const Matx_MatMulOp&) {} }; -struct CV_EXPORTS Matx_TOp { Matx_TOp() {} Matx_TOp(const Matx_TOp&) {} }; -//! @endcond - -/** @brief Template class for small matrices whose type and size are known at compilation time - -If you need a more flexible type, use Mat . The elements of the matrix M are accessible using the -M(i,j) notation. Most of the common matrix operations (see also @ref MatrixExpressions ) are -available. To do an operation on Matx that is not implemented, you can easily convert the matrix to -Mat and backwards: -@code{.cpp} - Matx33f m(1, 2, 3, - 4, 5, 6, - 7, 8, 9); - cout << sum(Mat(m*m.t())) << endl; -@endcode -Except of the plain constructor which takes a list of elements, Matx can be initialized from a C-array: -@code{.cpp} - float values[] = { 1, 2, 3}; - Matx31f m(values); -@endcode -In case if C++11 features are available, std::initializer_list can be also used to initialize Matx: -@code{.cpp} - Matx31f m = { 1, 2, 3}; -@endcode - */ -template class Matx -{ -public: - enum { - rows = m, - cols = n, - channels = rows*cols, -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - depth = traits::Type<_Tp>::value, - type = CV_MAKETYPE(depth, channels), -#endif - shortdim = (m < n ? m : n) - }; - - typedef _Tp value_type; - typedef Matx<_Tp, m, n> mat_type; - typedef Matx<_Tp, shortdim, 1> diag_type; - - //! default constructor - Matx(); - - explicit Matx(_Tp v0); //!< 1x1 matrix - Matx(_Tp v0, _Tp v1); //!< 1x2 or 2x1 matrix - Matx(_Tp v0, _Tp v1, _Tp v2); //!< 1x3 or 3x1 matrix - Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3); //!< 1x4, 2x2 or 4x1 matrix - Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4); //!< 1x5 or 5x1 matrix - Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5); //!< 1x6, 2x3, 3x2 or 6x1 matrix - Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6); //!< 1x7 or 7x1 matrix - Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7); //!< 1x8, 2x4, 4x2 or 8x1 matrix - Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8); //!< 1x9, 3x3 or 9x1 matrix - Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9); //!< 1x10, 2x5 or 5x2 or 10x1 matrix - Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, - _Tp v4, _Tp v5, _Tp v6, _Tp v7, - _Tp v8, _Tp v9, _Tp v10, _Tp v11); //!< 1x12, 2x6, 3x4, 4x3, 6x2 or 12x1 matrix - Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, - _Tp v4, _Tp v5, _Tp v6, _Tp v7, - _Tp v8, _Tp v9, _Tp v10, _Tp v11, - _Tp v12, _Tp v13); //!< 1x14, 2x7, 7x2 or 14x1 matrix - Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, - _Tp v4, _Tp v5, _Tp v6, _Tp v7, - _Tp v8, _Tp v9, _Tp v10, _Tp v11, - _Tp v12, _Tp v13, _Tp v14, _Tp v15); //!< 1x16, 4x4 or 16x1 matrix - explicit Matx(const _Tp* vals); //!< initialize from a plain array - -#ifdef CV_CXX11 - Matx(std::initializer_list<_Tp>); //!< initialize from an initializer list -#endif - - static Matx all(_Tp alpha); - static Matx zeros(); - static Matx ones(); - static Matx eye(); - static Matx diag(const diag_type& d); - static Matx randu(_Tp a, _Tp b); - static Matx randn(_Tp a, _Tp b); - - //! dot product computed with the default precision - _Tp dot(const Matx<_Tp, m, n>& v) const; - - //! dot product computed in double-precision arithmetics - double ddot(const Matx<_Tp, m, n>& v) const; - - //! conversion to another data type - template operator Matx() const; - - //! change the matrix shape - template Matx<_Tp, m1, n1> reshape() const; - - //! extract part of the matrix - template Matx<_Tp, m1, n1> get_minor(int base_row, int base_col) const; - - //! extract the matrix row - Matx<_Tp, 1, n> row(int i) const; - - //! extract the matrix column - Matx<_Tp, m, 1> col(int i) const; - - //! extract the matrix diagonal - diag_type diag() const; - - //! transpose the matrix - Matx<_Tp, n, m> t() const; - - //! invert the matrix - Matx<_Tp, n, m> inv(int method=DECOMP_LU, bool *p_is_ok = NULL) const; - - //! solve linear system - template Matx<_Tp, n, l> solve(const Matx<_Tp, m, l>& rhs, int flags=DECOMP_LU) const; - Vec<_Tp, n> solve(const Vec<_Tp, m>& rhs, int method) const; - - //! multiply two matrices element-wise - Matx<_Tp, m, n> mul(const Matx<_Tp, m, n>& a) const; - - //! divide two matrices element-wise - Matx<_Tp, m, n> div(const Matx<_Tp, m, n>& a) const; - - //! element access - const _Tp& operator ()(int row, int col) const; - _Tp& operator ()(int row, int col); - - //! 1D element access - const _Tp& operator ()(int i) const; - _Tp& operator ()(int i); - - Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_AddOp); - Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_SubOp); - template Matx(const Matx<_Tp, m, n>& a, _T2 alpha, Matx_ScaleOp); - Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_MulOp); - Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_DivOp); - template Matx(const Matx<_Tp, m, l>& a, const Matx<_Tp, l, n>& b, Matx_MatMulOp); - Matx(const Matx<_Tp, n, m>& a, Matx_TOp); - - _Tp val[m*n]; //< matrix elements -}; - -typedef Matx Matx12f; -typedef Matx Matx12d; -typedef Matx Matx13f; -typedef Matx Matx13d; -typedef Matx Matx14f; -typedef Matx Matx14d; -typedef Matx Matx16f; -typedef Matx Matx16d; - -typedef Matx Matx21f; -typedef Matx Matx21d; -typedef Matx Matx31f; -typedef Matx Matx31d; -typedef Matx Matx41f; -typedef Matx Matx41d; -typedef Matx Matx61f; -typedef Matx Matx61d; - -typedef Matx Matx22f; -typedef Matx Matx22d; -typedef Matx Matx23f; -typedef Matx Matx23d; -typedef Matx Matx32f; -typedef Matx Matx32d; - -typedef Matx Matx33f; -typedef Matx Matx33d; - -typedef Matx Matx34f; -typedef Matx Matx34d; -typedef Matx Matx43f; -typedef Matx Matx43d; - -typedef Matx Matx44f; -typedef Matx Matx44d; -typedef Matx Matx66f; -typedef Matx Matx66d; - -/*! - traits -*/ -template class DataType< Matx<_Tp, m, n> > -{ -public: - typedef Matx<_Tp, m, n> value_type; - typedef Matx::work_type, m, n> work_type; - typedef _Tp channel_type; - typedef value_type vec_type; - - enum { generic_type = 0, - channels = m * n, - fmt = traits::SafeFmt::fmt + ((channels - 1) << 8) -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - ,depth = DataType::depth - ,type = CV_MAKETYPE(depth, channels) -#endif - }; -}; - -namespace traits { -template -struct Depth< Matx<_Tp, m, n> > { enum { value = Depth<_Tp>::value }; }; -template -struct Type< Matx<_Tp, m, n> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, n*m) }; }; -} // namespace - - -/** @brief Comma-separated Matrix Initializer -*/ -template class MatxCommaInitializer -{ -public: - MatxCommaInitializer(Matx<_Tp, m, n>* _mtx); - template MatxCommaInitializer<_Tp, m, n>& operator , (T2 val); - Matx<_Tp, m, n> operator *() const; - - Matx<_Tp, m, n>* dst; - int idx; -}; - -/* - Utility methods -*/ -template static double determinant(const Matx<_Tp, m, m>& a); -template static double trace(const Matx<_Tp, m, n>& a); -template static double norm(const Matx<_Tp, m, n>& M); -template static double norm(const Matx<_Tp, m, n>& M, int normType); - - - -/////////////////////// Vec (used as element of multi-channel images ///////////////////// - -/** @brief Template class for short numerical vectors, a partial case of Matx - -This template class represents short numerical vectors (of 1, 2, 3, 4 ... elements) on which you -can perform basic arithmetical operations, access individual elements using [] operator etc. The -vectors are allocated on stack, as opposite to std::valarray, std::vector, cv::Mat etc., which -elements are dynamically allocated in the heap. - -The template takes 2 parameters: -@tparam _Tp element type -@tparam cn the number of elements - -In addition to the universal notation like Vec, you can use shorter aliases -for the most popular specialized variants of Vec, e.g. Vec3f ~ Vec. - -It is possible to convert Vec\ to/from Point_, Vec\ to/from Point3_ , and Vec\ -to CvScalar or Scalar_. Use operator[] to access the elements of Vec. - -All the expected vector operations are also implemented: -- v1 = v2 + v3 -- v1 = v2 - v3 -- v1 = v2 \* scale -- v1 = scale \* v2 -- v1 = -v2 -- v1 += v2 and other augmenting operations -- v1 == v2, v1 != v2 -- norm(v1) (euclidean norm) -The Vec class is commonly used to describe pixel types of multi-channel arrays. See Mat for details. -*/ -template class Vec : public Matx<_Tp, cn, 1> -{ -public: - typedef _Tp value_type; - enum { - channels = cn, -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - depth = Matx<_Tp, cn, 1>::depth, - type = CV_MAKETYPE(depth, channels), -#endif - _dummy_enum_finalizer = 0 - }; - - //! default constructor - Vec(); - - Vec(_Tp v0); //!< 1-element vector constructor - Vec(_Tp v0, _Tp v1); //!< 2-element vector constructor - Vec(_Tp v0, _Tp v1, _Tp v2); //!< 3-element vector constructor - Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3); //!< 4-element vector constructor - Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4); //!< 5-element vector constructor - Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5); //!< 6-element vector constructor - Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6); //!< 7-element vector constructor - Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7); //!< 8-element vector constructor - Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8); //!< 9-element vector constructor - Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9); //!< 10-element vector constructor - Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13); //!< 14-element vector constructor - explicit Vec(const _Tp* values); - -#ifdef CV_CXX11 - Vec(std::initializer_list<_Tp>); -#endif - - Vec(const Vec<_Tp, cn>& v); - - static Vec all(_Tp alpha); - - //! per-element multiplication - Vec mul(const Vec<_Tp, cn>& v) const; - - //! conjugation (makes sense for complex numbers and quaternions) - Vec conj() const; - - /*! - cross product of the two 3D vectors. - - For other dimensionalities the exception is raised - */ - Vec cross(const Vec& v) const; - //! conversion to another data type - template operator Vec() const; - - /*! element access */ - const _Tp& operator [](int i) const; - _Tp& operator[](int i); - const _Tp& operator ()(int i) const; - _Tp& operator ()(int i); - - Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_AddOp); - Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_SubOp); - template Vec(const Matx<_Tp, cn, 1>& a, _T2 alpha, Matx_ScaleOp); -}; - -/** @name Shorter aliases for the most popular specializations of Vec - @{ -*/ -typedef Vec Vec2b; -typedef Vec Vec3b; -typedef Vec Vec4b; - -typedef Vec Vec2s; -typedef Vec Vec3s; -typedef Vec Vec4s; - -typedef Vec Vec2w; -typedef Vec Vec3w; -typedef Vec Vec4w; - -typedef Vec Vec2i; -typedef Vec Vec3i; -typedef Vec Vec4i; -typedef Vec Vec6i; -typedef Vec Vec8i; - -typedef Vec Vec2f; -typedef Vec Vec3f; -typedef Vec Vec4f; -typedef Vec Vec6f; - -typedef Vec Vec2d; -typedef Vec Vec3d; -typedef Vec Vec4d; -typedef Vec Vec6d; -/** @} */ - -/*! - traits -*/ -template class DataType< Vec<_Tp, cn> > -{ -public: - typedef Vec<_Tp, cn> value_type; - typedef Vec::work_type, cn> work_type; - typedef _Tp channel_type; - typedef value_type vec_type; - - enum { generic_type = 0, - channels = cn, - fmt = DataType::fmt + ((channels - 1) << 8), -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - depth = DataType::depth, - type = CV_MAKETYPE(depth, channels), -#endif - _dummy_enum_finalizer = 0 - }; -}; - -namespace traits { -template -struct Depth< Vec<_Tp, cn> > { enum { value = Depth<_Tp>::value }; }; -template -struct Type< Vec<_Tp, cn> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, cn) }; }; -} // namespace - - -/** @brief Comma-separated Vec Initializer -*/ -template class VecCommaInitializer : public MatxCommaInitializer<_Tp, m, 1> -{ -public: - VecCommaInitializer(Vec<_Tp, m>* _vec); - template VecCommaInitializer<_Tp, m>& operator , (T2 val); - Vec<_Tp, m> operator *() const; -}; - -template static Vec<_Tp, cn> normalize(const Vec<_Tp, cn>& v); - -//! @} core_basic - -//! @cond IGNORED - -///////////////////////////////////// helper classes ///////////////////////////////////// -namespace internal -{ - -template struct Matx_DetOp -{ - double operator ()(const Matx<_Tp, m, m>& a) const - { - Matx<_Tp, m, m> temp = a; - double p = LU(temp.val, m*sizeof(_Tp), m, 0, 0, 0); - if( p == 0 ) - return p; - for( int i = 0; i < m; i++ ) - p *= temp(i, i); - return p; - } -}; - -template struct Matx_DetOp<_Tp, 1> -{ - double operator ()(const Matx<_Tp, 1, 1>& a) const - { - return a(0,0); - } -}; - -template struct Matx_DetOp<_Tp, 2> -{ - double operator ()(const Matx<_Tp, 2, 2>& a) const - { - return a(0,0)*a(1,1) - a(0,1)*a(1,0); - } -}; - -template struct Matx_DetOp<_Tp, 3> -{ - double operator ()(const Matx<_Tp, 3, 3>& a) const - { - return a(0,0)*(a(1,1)*a(2,2) - a(2,1)*a(1,2)) - - a(0,1)*(a(1,0)*a(2,2) - a(2,0)*a(1,2)) + - a(0,2)*(a(1,0)*a(2,1) - a(2,0)*a(1,1)); - } -}; - -template Vec<_Tp, 2> inline conjugate(const Vec<_Tp, 2>& v) -{ - return Vec<_Tp, 2>(v[0], -v[1]); -} - -template Vec<_Tp, 4> inline conjugate(const Vec<_Tp, 4>& v) -{ - return Vec<_Tp, 4>(v[0], -v[1], -v[2], -v[3]); -} - -} // internal - - - -////////////////////////////////// Matx Implementation /////////////////////////////////// - -template inline -Matx<_Tp, m, n>::Matx() -{ - for(int i = 0; i < channels; i++) val[i] = _Tp(0); -} - -template inline -Matx<_Tp, m, n>::Matx(_Tp v0) -{ - val[0] = v0; - for(int i = 1; i < channels; i++) val[i] = _Tp(0); -} - -template inline -Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1) -{ - CV_StaticAssert(channels >= 2, "Matx should have at least 2 elements."); - val[0] = v0; val[1] = v1; - for(int i = 2; i < channels; i++) val[i] = _Tp(0); -} - -template inline -Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2) -{ - CV_StaticAssert(channels >= 3, "Matx should have at least 3 elements."); - val[0] = v0; val[1] = v1; val[2] = v2; - for(int i = 3; i < channels; i++) val[i] = _Tp(0); -} - -template inline -Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3) -{ - CV_StaticAssert(channels >= 4, "Matx should have at least 4 elements."); - val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; - for(int i = 4; i < channels; i++) val[i] = _Tp(0); -} - -template inline -Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4) -{ - CV_StaticAssert(channels >= 5, "Matx should have at least 5 elements."); - val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; val[4] = v4; - for(int i = 5; i < channels; i++) val[i] = _Tp(0); -} - -template inline -Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5) -{ - CV_StaticAssert(channels >= 6, "Matx should have at least 6 elements."); - val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; - val[4] = v4; val[5] = v5; - for(int i = 6; i < channels; i++) val[i] = _Tp(0); -} - -template inline -Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6) -{ - CV_StaticAssert(channels >= 7, "Matx should have at least 7 elements."); - val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; - val[4] = v4; val[5] = v5; val[6] = v6; - for(int i = 7; i < channels; i++) val[i] = _Tp(0); -} - -template inline -Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7) -{ - CV_StaticAssert(channels >= 8, "Matx should have at least 8 elements."); - val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; - val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7; - for(int i = 8; i < channels; i++) val[i] = _Tp(0); -} - -template inline -Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8) -{ - CV_StaticAssert(channels >= 9, "Matx should have at least 9 elements."); - val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; - val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7; - val[8] = v8; - for(int i = 9; i < channels; i++) val[i] = _Tp(0); -} - -template inline -Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9) -{ - CV_StaticAssert(channels >= 10, "Matx should have at least 10 elements."); - val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; - val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7; - val[8] = v8; val[9] = v9; - for(int i = 10; i < channels; i++) val[i] = _Tp(0); -} - - -template inline -Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11) -{ - CV_StaticAssert(channels >= 12, "Matx should have at least 12 elements."); - val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; - val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7; - val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11; - for(int i = 12; i < channels; i++) val[i] = _Tp(0); -} - -template inline -Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13) -{ - CV_StaticAssert(channels >= 14, "Matx should have at least 14 elements."); - val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; - val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7; - val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11; - val[12] = v12; val[13] = v13; - for (int i = 14; i < channels; i++) val[i] = _Tp(0); -} - - -template inline -Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13, _Tp v14, _Tp v15) -{ - CV_StaticAssert(channels >= 16, "Matx should have at least 16 elements."); - val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; - val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7; - val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11; - val[12] = v12; val[13] = v13; val[14] = v14; val[15] = v15; - for(int i = 16; i < channels; i++) val[i] = _Tp(0); -} - -template inline -Matx<_Tp, m, n>::Matx(const _Tp* values) -{ - for( int i = 0; i < channels; i++ ) val[i] = values[i]; -} - -#ifdef CV_CXX11 -template inline -Matx<_Tp, m, n>::Matx(std::initializer_list<_Tp> list) -{ - CV_DbgAssert(list.size() == channels); - int i = 0; - for(const auto& elem : list) - { - val[i++] = elem; - } -} -#endif - -template inline -Matx<_Tp, m, n> Matx<_Tp, m, n>::all(_Tp alpha) -{ - Matx<_Tp, m, n> M; - for( int i = 0; i < m*n; i++ ) M.val[i] = alpha; - return M; -} - -template inline -Matx<_Tp,m,n> Matx<_Tp,m,n>::zeros() -{ - return all(0); -} - -template inline -Matx<_Tp,m,n> Matx<_Tp,m,n>::ones() -{ - return all(1); -} - -template inline -Matx<_Tp,m,n> Matx<_Tp,m,n>::eye() -{ - Matx<_Tp,m,n> M; - for(int i = 0; i < shortdim; i++) - M(i,i) = 1; - return M; -} - -template inline -_Tp Matx<_Tp, m, n>::dot(const Matx<_Tp, m, n>& M) const -{ - _Tp s = 0; - for( int i = 0; i < channels; i++ ) s += val[i]*M.val[i]; - return s; -} - -template inline -double Matx<_Tp, m, n>::ddot(const Matx<_Tp, m, n>& M) const -{ - double s = 0; - for( int i = 0; i < channels; i++ ) s += (double)val[i]*M.val[i]; - return s; -} - -template inline -Matx<_Tp,m,n> Matx<_Tp,m,n>::diag(const typename Matx<_Tp,m,n>::diag_type& d) -{ - Matx<_Tp,m,n> M; - for(int i = 0; i < shortdim; i++) - M(i,i) = d(i, 0); - return M; -} - -template template -inline Matx<_Tp, m, n>::operator Matx() const -{ - Matx M; - for( int i = 0; i < m*n; i++ ) M.val[i] = saturate_cast(val[i]); - return M; -} - -template template inline -Matx<_Tp, m1, n1> Matx<_Tp, m, n>::reshape() const -{ - CV_StaticAssert(m1*n1 == m*n, "Input and destnarion matrices must have the same number of elements"); - return (const Matx<_Tp, m1, n1>&)*this; -} - -template -template inline -Matx<_Tp, m1, n1> Matx<_Tp, m, n>::get_minor(int base_row, int base_col) const -{ - CV_DbgAssert(0 <= base_row && base_row+m1 <= m && 0 <= base_col && base_col+n1 <= n); - Matx<_Tp, m1, n1> s; - for( int di = 0; di < m1; di++ ) - for( int dj = 0; dj < n1; dj++ ) - s(di, dj) = (*this)(base_row+di, base_col+dj); - return s; -} - -template inline -Matx<_Tp, 1, n> Matx<_Tp, m, n>::row(int i) const -{ - CV_DbgAssert((unsigned)i < (unsigned)m); - return Matx<_Tp, 1, n>(&val[i*n]); -} - -template inline -Matx<_Tp, m, 1> Matx<_Tp, m, n>::col(int j) const -{ - CV_DbgAssert((unsigned)j < (unsigned)n); - Matx<_Tp, m, 1> v; - for( int i = 0; i < m; i++ ) - v.val[i] = val[i*n + j]; - return v; -} - -template inline -typename Matx<_Tp, m, n>::diag_type Matx<_Tp, m, n>::diag() const -{ - diag_type d; - for( int i = 0; i < shortdim; i++ ) - d.val[i] = val[i*n + i]; - return d; -} - -template inline -const _Tp& Matx<_Tp, m, n>::operator()(int row_idx, int col_idx) const -{ - CV_DbgAssert( (unsigned)row_idx < (unsigned)m && (unsigned)col_idx < (unsigned)n ); - return this->val[row_idx*n + col_idx]; -} - -template inline -_Tp& Matx<_Tp, m, n>::operator ()(int row_idx, int col_idx) -{ - CV_DbgAssert( (unsigned)row_idx < (unsigned)m && (unsigned)col_idx < (unsigned)n ); - return val[row_idx*n + col_idx]; -} - -template inline -const _Tp& Matx<_Tp, m, n>::operator ()(int i) const -{ - CV_StaticAssert(m == 1 || n == 1, "Single index indexation requires matrix to be a column or a row"); - CV_DbgAssert( (unsigned)i < (unsigned)(m+n-1) ); - return val[i]; -} - -template inline -_Tp& Matx<_Tp, m, n>::operator ()(int i) -{ - CV_StaticAssert(m == 1 || n == 1, "Single index indexation requires matrix to be a column or a row"); - CV_DbgAssert( (unsigned)i < (unsigned)(m+n-1) ); - return val[i]; -} - -template inline -Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_AddOp) -{ - for( int i = 0; i < channels; i++ ) - val[i] = saturate_cast<_Tp>(a.val[i] + b.val[i]); -} - -template inline -Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_SubOp) -{ - for( int i = 0; i < channels; i++ ) - val[i] = saturate_cast<_Tp>(a.val[i] - b.val[i]); -} - -template template inline -Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, _T2 alpha, Matx_ScaleOp) -{ - for( int i = 0; i < channels; i++ ) - val[i] = saturate_cast<_Tp>(a.val[i] * alpha); -} - -template inline -Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_MulOp) -{ - for( int i = 0; i < channels; i++ ) - val[i] = saturate_cast<_Tp>(a.val[i] * b.val[i]); -} - -template inline -Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_DivOp) -{ - for( int i = 0; i < channels; i++ ) - val[i] = saturate_cast<_Tp>(a.val[i] / b.val[i]); -} - -template template inline -Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, l>& a, const Matx<_Tp, l, n>& b, Matx_MatMulOp) -{ - for( int i = 0; i < m; i++ ) - for( int j = 0; j < n; j++ ) - { - _Tp s = 0; - for( int k = 0; k < l; k++ ) - s += a(i, k) * b(k, j); - val[i*n + j] = s; - } -} - -template inline -Matx<_Tp,m,n>::Matx(const Matx<_Tp, n, m>& a, Matx_TOp) -{ - for( int i = 0; i < m; i++ ) - for( int j = 0; j < n; j++ ) - val[i*n + j] = a(j, i); -} - -template inline -Matx<_Tp, m, n> Matx<_Tp, m, n>::mul(const Matx<_Tp, m, n>& a) const -{ - return Matx<_Tp, m, n>(*this, a, Matx_MulOp()); -} - -template inline -Matx<_Tp, m, n> Matx<_Tp, m, n>::div(const Matx<_Tp, m, n>& a) const -{ - return Matx<_Tp, m, n>(*this, a, Matx_DivOp()); -} - -template inline -Matx<_Tp, n, m> Matx<_Tp, m, n>::t() const -{ - return Matx<_Tp, n, m>(*this, Matx_TOp()); -} - -template inline -Vec<_Tp, n> Matx<_Tp, m, n>::solve(const Vec<_Tp, m>& rhs, int method) const -{ - Matx<_Tp, n, 1> x = solve((const Matx<_Tp, m, 1>&)(rhs), method); - return (Vec<_Tp, n>&)(x); -} - -template static inline -double determinant(const Matx<_Tp, m, m>& a) -{ - return cv::internal::Matx_DetOp<_Tp, m>()(a); -} - -template static inline -double trace(const Matx<_Tp, m, n>& a) -{ - _Tp s = 0; - for( int i = 0; i < std::min(m, n); i++ ) - s += a(i,i); - return s; -} - -template static inline -double norm(const Matx<_Tp, m, n>& M) -{ - return std::sqrt(normL2Sqr<_Tp, double>(M.val, m*n)); -} - -template static inline -double norm(const Matx<_Tp, m, n>& M, int normType) -{ - switch(normType) { - case NORM_INF: - return (double)normInf<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n); - case NORM_L1: - return (double)normL1<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n); - case NORM_L2SQR: - return (double)normL2Sqr<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n); - default: - case NORM_L2: - return std::sqrt((double)normL2Sqr<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n)); - } -} - - - -//////////////////////////////// matx comma initializer ////////////////////////////////// - -template static inline -MatxCommaInitializer<_Tp, m, n> operator << (const Matx<_Tp, m, n>& mtx, _T2 val) -{ - MatxCommaInitializer<_Tp, m, n> commaInitializer((Matx<_Tp, m, n>*)&mtx); - return (commaInitializer, val); -} - -template inline -MatxCommaInitializer<_Tp, m, n>::MatxCommaInitializer(Matx<_Tp, m, n>* _mtx) - : dst(_mtx), idx(0) -{} - -template template inline -MatxCommaInitializer<_Tp, m, n>& MatxCommaInitializer<_Tp, m, n>::operator , (_T2 value) -{ - CV_DbgAssert( idx < m*n ); - dst->val[idx++] = saturate_cast<_Tp>(value); - return *this; -} - -template inline -Matx<_Tp, m, n> MatxCommaInitializer<_Tp, m, n>::operator *() const -{ - CV_DbgAssert( idx == n*m ); - return *dst; -} - - - -/////////////////////////////////// Vec Implementation /////////////////////////////////// - -template inline -Vec<_Tp, cn>::Vec() {} - -template inline -Vec<_Tp, cn>::Vec(_Tp v0) - : Matx<_Tp, cn, 1>(v0) {} - -template inline -Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1) - : Matx<_Tp, cn, 1>(v0, v1) {} - -template inline -Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2) - : Matx<_Tp, cn, 1>(v0, v1, v2) {} - -template inline -Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3) - : Matx<_Tp, cn, 1>(v0, v1, v2, v3) {} - -template inline -Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4) - : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4) {} - -template inline -Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5) - : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5) {} - -template inline -Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6) - : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6) {} - -template inline -Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7) - : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7) {} - -template inline -Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8) - : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7, v8) {} - -template inline -Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9) - : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {} - -template inline -Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13) - : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) {} - -template inline -Vec<_Tp, cn>::Vec(const _Tp* values) - : Matx<_Tp, cn, 1>(values) {} - -#ifdef CV_CXX11 -template inline -Vec<_Tp, cn>::Vec(std::initializer_list<_Tp> list) - : Matx<_Tp, cn, 1>(list) {} -#endif - -template inline -Vec<_Tp, cn>::Vec(const Vec<_Tp, cn>& m) - : Matx<_Tp, cn, 1>(m.val) {} - -template inline -Vec<_Tp, cn>::Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_AddOp op) - : Matx<_Tp, cn, 1>(a, b, op) {} - -template inline -Vec<_Tp, cn>::Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_SubOp op) - : Matx<_Tp, cn, 1>(a, b, op) {} - -template template inline -Vec<_Tp, cn>::Vec(const Matx<_Tp, cn, 1>& a, _T2 alpha, Matx_ScaleOp op) - : Matx<_Tp, cn, 1>(a, alpha, op) {} - -template inline -Vec<_Tp, cn> Vec<_Tp, cn>::all(_Tp alpha) -{ - Vec v; - for( int i = 0; i < cn; i++ ) v.val[i] = alpha; - return v; -} - -template inline -Vec<_Tp, cn> Vec<_Tp, cn>::mul(const Vec<_Tp, cn>& v) const -{ - Vec<_Tp, cn> w; - for( int i = 0; i < cn; i++ ) w.val[i] = saturate_cast<_Tp>(this->val[i]*v.val[i]); - return w; -} - -template<> inline -Vec Vec::conj() const -{ - return cv::internal::conjugate(*this); -} - -template<> inline -Vec Vec::conj() const -{ - return cv::internal::conjugate(*this); -} - -template<> inline -Vec Vec::conj() const -{ - return cv::internal::conjugate(*this); -} - -template<> inline -Vec Vec::conj() const -{ - return cv::internal::conjugate(*this); -} - -template inline -Vec<_Tp, cn> Vec<_Tp, cn>::cross(const Vec<_Tp, cn>&) const -{ - CV_StaticAssert(cn == 3, "for arbitrary-size vector there is no cross-product defined"); - return Vec<_Tp, cn>(); -} - -template<> inline -Vec Vec::cross(const Vec& v) const -{ - return Vec(this->val[1]*v.val[2] - this->val[2]*v.val[1], - this->val[2]*v.val[0] - this->val[0]*v.val[2], - this->val[0]*v.val[1] - this->val[1]*v.val[0]); -} - -template<> inline -Vec Vec::cross(const Vec& v) const -{ - return Vec(this->val[1]*v.val[2] - this->val[2]*v.val[1], - this->val[2]*v.val[0] - this->val[0]*v.val[2], - this->val[0]*v.val[1] - this->val[1]*v.val[0]); -} - -template template inline -Vec<_Tp, cn>::operator Vec() const -{ - Vec v; - for( int i = 0; i < cn; i++ ) v.val[i] = saturate_cast(this->val[i]); - return v; -} - -template inline -const _Tp& Vec<_Tp, cn>::operator [](int i) const -{ - CV_DbgAssert( (unsigned)i < (unsigned)cn ); - return this->val[i]; -} - -template inline -_Tp& Vec<_Tp, cn>::operator [](int i) -{ - CV_DbgAssert( (unsigned)i < (unsigned)cn ); - return this->val[i]; -} - -template inline -const _Tp& Vec<_Tp, cn>::operator ()(int i) const -{ - CV_DbgAssert( (unsigned)i < (unsigned)cn ); - return this->val[i]; -} - -template inline -_Tp& Vec<_Tp, cn>::operator ()(int i) -{ - CV_DbgAssert( (unsigned)i < (unsigned)cn ); - return this->val[i]; -} - -template inline -Vec<_Tp, cn> normalize(const Vec<_Tp, cn>& v) -{ - double nv = norm(v); - return v * (nv ? 1./nv : 0.); -} - - - -//////////////////////////////// vec comma initializer ////////////////////////////////// - - -template static inline -VecCommaInitializer<_Tp, cn> operator << (const Vec<_Tp, cn>& vec, _T2 val) -{ - VecCommaInitializer<_Tp, cn> commaInitializer((Vec<_Tp, cn>*)&vec); - return (commaInitializer, val); -} - -template inline -VecCommaInitializer<_Tp, cn>::VecCommaInitializer(Vec<_Tp, cn>* _vec) - : MatxCommaInitializer<_Tp, cn, 1>(_vec) -{} - -template template inline -VecCommaInitializer<_Tp, cn>& VecCommaInitializer<_Tp, cn>::operator , (_T2 value) -{ - CV_DbgAssert( this->idx < cn ); - this->dst->val[this->idx++] = saturate_cast<_Tp>(value); - return *this; -} - -template inline -Vec<_Tp, cn> VecCommaInitializer<_Tp, cn>::operator *() const -{ - CV_DbgAssert( this->idx == cn ); - return *this->dst; -} - -//! @endcond - -///////////////////////////// Matx out-of-class operators //////////////////////////////// - -//! @relates cv::Matx -//! @{ - -template static inline -Matx<_Tp1, m, n>& operator += (Matx<_Tp1, m, n>& a, const Matx<_Tp2, m, n>& b) -{ - for( int i = 0; i < m*n; i++ ) - a.val[i] = saturate_cast<_Tp1>(a.val[i] + b.val[i]); - return a; -} - -template static inline -Matx<_Tp1, m, n>& operator -= (Matx<_Tp1, m, n>& a, const Matx<_Tp2, m, n>& b) -{ - for( int i = 0; i < m*n; i++ ) - a.val[i] = saturate_cast<_Tp1>(a.val[i] - b.val[i]); - return a; -} - -template static inline -Matx<_Tp, m, n> operator + (const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b) -{ - return Matx<_Tp, m, n>(a, b, Matx_AddOp()); -} - -template static inline -Matx<_Tp, m, n> operator - (const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b) -{ - return Matx<_Tp, m, n>(a, b, Matx_SubOp()); -} - -template static inline -Matx<_Tp, m, n>& operator *= (Matx<_Tp, m, n>& a, int alpha) -{ - for( int i = 0; i < m*n; i++ ) - a.val[i] = saturate_cast<_Tp>(a.val[i] * alpha); - return a; -} - -template static inline -Matx<_Tp, m, n>& operator *= (Matx<_Tp, m, n>& a, float alpha) -{ - for( int i = 0; i < m*n; i++ ) - a.val[i] = saturate_cast<_Tp>(a.val[i] * alpha); - return a; -} - -template static inline -Matx<_Tp, m, n>& operator *= (Matx<_Tp, m, n>& a, double alpha) -{ - for( int i = 0; i < m*n; i++ ) - a.val[i] = saturate_cast<_Tp>(a.val[i] * alpha); - return a; -} - -template static inline -Matx<_Tp, m, n> operator * (const Matx<_Tp, m, n>& a, int alpha) -{ - return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp()); -} - -template static inline -Matx<_Tp, m, n> operator * (const Matx<_Tp, m, n>& a, float alpha) -{ - return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp()); -} - -template static inline -Matx<_Tp, m, n> operator * (const Matx<_Tp, m, n>& a, double alpha) -{ - return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp()); -} - -template static inline -Matx<_Tp, m, n> operator * (int alpha, const Matx<_Tp, m, n>& a) -{ - return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp()); -} - -template static inline -Matx<_Tp, m, n> operator * (float alpha, const Matx<_Tp, m, n>& a) -{ - return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp()); -} - -template static inline -Matx<_Tp, m, n> operator * (double alpha, const Matx<_Tp, m, n>& a) -{ - return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp()); -} - -template static inline -Matx<_Tp, m, n> operator - (const Matx<_Tp, m, n>& a) -{ - return Matx<_Tp, m, n>(a, -1, Matx_ScaleOp()); -} - -template static inline -Matx<_Tp, m, n> operator * (const Matx<_Tp, m, l>& a, const Matx<_Tp, l, n>& b) -{ - return Matx<_Tp, m, n>(a, b, Matx_MatMulOp()); -} - -template static inline -Vec<_Tp, m> operator * (const Matx<_Tp, m, n>& a, const Vec<_Tp, n>& b) -{ - Matx<_Tp, m, 1> c(a, b, Matx_MatMulOp()); - return (const Vec<_Tp, m>&)(c); -} - -template static inline -bool operator == (const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b) -{ - for( int i = 0; i < m*n; i++ ) - if( a.val[i] != b.val[i] ) return false; - return true; -} - -template static inline -bool operator != (const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b) -{ - return !(a == b); -} - -//! @} - -////////////////////////////// Vec out-of-class operators //////////////////////////////// - -//! @relates cv::Vec -//! @{ - -template static inline -Vec<_Tp1, cn>& operator += (Vec<_Tp1, cn>& a, const Vec<_Tp2, cn>& b) -{ - for( int i = 0; i < cn; i++ ) - a.val[i] = saturate_cast<_Tp1>(a.val[i] + b.val[i]); - return a; -} - -template static inline -Vec<_Tp1, cn>& operator -= (Vec<_Tp1, cn>& a, const Vec<_Tp2, cn>& b) -{ - for( int i = 0; i < cn; i++ ) - a.val[i] = saturate_cast<_Tp1>(a.val[i] - b.val[i]); - return a; -} - -template static inline -Vec<_Tp, cn> operator + (const Vec<_Tp, cn>& a, const Vec<_Tp, cn>& b) -{ - return Vec<_Tp, cn>(a, b, Matx_AddOp()); -} - -template static inline -Vec<_Tp, cn> operator - (const Vec<_Tp, cn>& a, const Vec<_Tp, cn>& b) -{ - return Vec<_Tp, cn>(a, b, Matx_SubOp()); -} - -template static inline -Vec<_Tp, cn>& operator *= (Vec<_Tp, cn>& a, int alpha) -{ - for( int i = 0; i < cn; i++ ) - a[i] = saturate_cast<_Tp>(a[i]*alpha); - return a; -} - -template static inline -Vec<_Tp, cn>& operator *= (Vec<_Tp, cn>& a, float alpha) -{ - for( int i = 0; i < cn; i++ ) - a[i] = saturate_cast<_Tp>(a[i]*alpha); - return a; -} - -template static inline -Vec<_Tp, cn>& operator *= (Vec<_Tp, cn>& a, double alpha) -{ - for( int i = 0; i < cn; i++ ) - a[i] = saturate_cast<_Tp>(a[i]*alpha); - return a; -} - -template static inline -Vec<_Tp, cn>& operator /= (Vec<_Tp, cn>& a, int alpha) -{ - double ialpha = 1./alpha; - for( int i = 0; i < cn; i++ ) - a[i] = saturate_cast<_Tp>(a[i]*ialpha); - return a; -} - -template static inline -Vec<_Tp, cn>& operator /= (Vec<_Tp, cn>& a, float alpha) -{ - float ialpha = 1.f/alpha; - for( int i = 0; i < cn; i++ ) - a[i] = saturate_cast<_Tp>(a[i]*ialpha); - return a; -} - -template static inline -Vec<_Tp, cn>& operator /= (Vec<_Tp, cn>& a, double alpha) -{ - double ialpha = 1./alpha; - for( int i = 0; i < cn; i++ ) - a[i] = saturate_cast<_Tp>(a[i]*ialpha); - return a; -} - -template static inline -Vec<_Tp, cn> operator * (const Vec<_Tp, cn>& a, int alpha) -{ - return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp()); -} - -template static inline -Vec<_Tp, cn> operator * (int alpha, const Vec<_Tp, cn>& a) -{ - return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp()); -} - -template static inline -Vec<_Tp, cn> operator * (const Vec<_Tp, cn>& a, float alpha) -{ - return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp()); -} - -template static inline -Vec<_Tp, cn> operator * (float alpha, const Vec<_Tp, cn>& a) -{ - return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp()); -} - -template static inline -Vec<_Tp, cn> operator * (const Vec<_Tp, cn>& a, double alpha) -{ - return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp()); -} - -template static inline -Vec<_Tp, cn> operator * (double alpha, const Vec<_Tp, cn>& a) -{ - return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp()); -} - -template static inline -Vec<_Tp, cn> operator / (const Vec<_Tp, cn>& a, int alpha) -{ - return Vec<_Tp, cn>(a, 1./alpha, Matx_ScaleOp()); -} - -template static inline -Vec<_Tp, cn> operator / (const Vec<_Tp, cn>& a, float alpha) -{ - return Vec<_Tp, cn>(a, 1.f/alpha, Matx_ScaleOp()); -} - -template static inline -Vec<_Tp, cn> operator / (const Vec<_Tp, cn>& a, double alpha) -{ - return Vec<_Tp, cn>(a, 1./alpha, Matx_ScaleOp()); -} - -template static inline -Vec<_Tp, cn> operator - (const Vec<_Tp, cn>& a) -{ - Vec<_Tp,cn> t; - for( int i = 0; i < cn; i++ ) t.val[i] = saturate_cast<_Tp>(-a.val[i]); - return t; -} - -template inline Vec<_Tp, 4> operator * (const Vec<_Tp, 4>& v1, const Vec<_Tp, 4>& v2) -{ - return Vec<_Tp, 4>(saturate_cast<_Tp>(v1[0]*v2[0] - v1[1]*v2[1] - v1[2]*v2[2] - v1[3]*v2[3]), - saturate_cast<_Tp>(v1[0]*v2[1] + v1[1]*v2[0] + v1[2]*v2[3] - v1[3]*v2[2]), - saturate_cast<_Tp>(v1[0]*v2[2] - v1[1]*v2[3] + v1[2]*v2[0] + v1[3]*v2[1]), - saturate_cast<_Tp>(v1[0]*v2[3] + v1[1]*v2[2] - v1[2]*v2[1] + v1[3]*v2[0])); -} - -template inline Vec<_Tp, 4>& operator *= (Vec<_Tp, 4>& v1, const Vec<_Tp, 4>& v2) -{ - v1 = v1 * v2; - return v1; -} - -//! @} - -} // cv - -#endif // OPENCV_CORE_MATX_HPP diff --git a/opencv/include/opencv2/core/neon_utils.hpp b/opencv/include/opencv2/core/neon_utils.hpp deleted file mode 100644 index 573ba99..0000000 --- a/opencv/include/opencv2/core/neon_utils.hpp +++ /dev/null @@ -1,128 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_HAL_NEON_UTILS_HPP -#define OPENCV_HAL_NEON_UTILS_HPP - -#include "opencv2/core/cvdef.h" - -//! @addtogroup core_utils_neon -//! @{ - -#if CV_NEON - -inline int32x2_t cv_vrnd_s32_f32(float32x2_t v) -{ - static int32x2_t v_sign = vdup_n_s32(1 << 31), - v_05 = vreinterpret_s32_f32(vdup_n_f32(0.5f)); - - int32x2_t v_addition = vorr_s32(v_05, vand_s32(v_sign, vreinterpret_s32_f32(v))); - return vcvt_s32_f32(vadd_f32(v, vreinterpret_f32_s32(v_addition))); -} - -inline int32x4_t cv_vrndq_s32_f32(float32x4_t v) -{ - static int32x4_t v_sign = vdupq_n_s32(1 << 31), - v_05 = vreinterpretq_s32_f32(vdupq_n_f32(0.5f)); - - int32x4_t v_addition = vorrq_s32(v_05, vandq_s32(v_sign, vreinterpretq_s32_f32(v))); - return vcvtq_s32_f32(vaddq_f32(v, vreinterpretq_f32_s32(v_addition))); -} - -inline uint32x2_t cv_vrnd_u32_f32(float32x2_t v) -{ - static float32x2_t v_05 = vdup_n_f32(0.5f); - return vcvt_u32_f32(vadd_f32(v, v_05)); -} - -inline uint32x4_t cv_vrndq_u32_f32(float32x4_t v) -{ - static float32x4_t v_05 = vdupq_n_f32(0.5f); - return vcvtq_u32_f32(vaddq_f32(v, v_05)); -} - -inline float32x4_t cv_vrecpq_f32(float32x4_t val) -{ - float32x4_t reciprocal = vrecpeq_f32(val); - reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal); - reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal); - return reciprocal; -} - -inline float32x2_t cv_vrecp_f32(float32x2_t val) -{ - float32x2_t reciprocal = vrecpe_f32(val); - reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal); - reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal); - return reciprocal; -} - -inline float32x4_t cv_vrsqrtq_f32(float32x4_t val) -{ - float32x4_t e = vrsqrteq_f32(val); - e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e); - e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e); - return e; -} - -inline float32x2_t cv_vrsqrt_f32(float32x2_t val) -{ - float32x2_t e = vrsqrte_f32(val); - e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e); - e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e); - return e; -} - -inline float32x4_t cv_vsqrtq_f32(float32x4_t val) -{ - return cv_vrecpq_f32(cv_vrsqrtq_f32(val)); -} - -inline float32x2_t cv_vsqrt_f32(float32x2_t val) -{ - return cv_vrecp_f32(cv_vrsqrt_f32(val)); -} - -#endif - -//! @} - -#endif // OPENCV_HAL_NEON_UTILS_HPP diff --git a/opencv/include/opencv2/core/ocl.hpp b/opencv/include/opencv2/core/ocl.hpp deleted file mode 100644 index 95f0fcd..0000000 --- a/opencv/include/opencv2/core/ocl.hpp +++ /dev/null @@ -1,843 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the OpenCV Foundation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OPENCL_HPP -#define OPENCV_OPENCL_HPP - -#include "opencv2/core.hpp" - -namespace cv { namespace ocl { - -//! @addtogroup core_opencl -//! @{ - -CV_EXPORTS_W bool haveOpenCL(); -CV_EXPORTS_W bool useOpenCL(); -CV_EXPORTS_W bool haveAmdBlas(); -CV_EXPORTS_W bool haveAmdFft(); -CV_EXPORTS_W void setUseOpenCL(bool flag); -CV_EXPORTS_W void finish(); - -CV_EXPORTS bool haveSVM(); - -class CV_EXPORTS Context; -class CV_EXPORTS_W_SIMPLE Device; -class CV_EXPORTS Kernel; -class CV_EXPORTS Program; -class CV_EXPORTS ProgramSource; -class CV_EXPORTS Queue; -class CV_EXPORTS PlatformInfo; -class CV_EXPORTS Image2D; - -class CV_EXPORTS_W_SIMPLE Device -{ -public: - CV_WRAP Device(); - explicit Device(void* d); - Device(const Device& d); - Device& operator = (const Device& d); - CV_WRAP ~Device(); - - void set(void* d); - - enum - { - TYPE_DEFAULT = (1 << 0), - TYPE_CPU = (1 << 1), - TYPE_GPU = (1 << 2), - TYPE_ACCELERATOR = (1 << 3), - TYPE_DGPU = TYPE_GPU + (1 << 16), - TYPE_IGPU = TYPE_GPU + (1 << 17), - TYPE_ALL = 0xFFFFFFFF - }; - - CV_WRAP String name() const; - CV_WRAP String extensions() const; - CV_WRAP bool isExtensionSupported(const String& extensionName) const; - CV_WRAP String version() const; - CV_WRAP String vendorName() const; - CV_WRAP String OpenCL_C_Version() const; - CV_WRAP String OpenCLVersion() const; - CV_WRAP int deviceVersionMajor() const; - CV_WRAP int deviceVersionMinor() const; - CV_WRAP String driverVersion() const; - void* ptr() const; - - CV_WRAP int type() const; - - CV_WRAP int addressBits() const; - CV_WRAP bool available() const; - CV_WRAP bool compilerAvailable() const; - CV_WRAP bool linkerAvailable() const; - - enum - { - FP_DENORM=(1 << 0), - FP_INF_NAN=(1 << 1), - FP_ROUND_TO_NEAREST=(1 << 2), - FP_ROUND_TO_ZERO=(1 << 3), - FP_ROUND_TO_INF=(1 << 4), - FP_FMA=(1 << 5), - FP_SOFT_FLOAT=(1 << 6), - FP_CORRECTLY_ROUNDED_DIVIDE_SQRT=(1 << 7) - }; - CV_WRAP int doubleFPConfig() const; - CV_WRAP int singleFPConfig() const; - CV_WRAP int halfFPConfig() const; - - CV_WRAP bool endianLittle() const; - CV_WRAP bool errorCorrectionSupport() const; - - enum - { - EXEC_KERNEL=(1 << 0), - EXEC_NATIVE_KERNEL=(1 << 1) - }; - CV_WRAP int executionCapabilities() const; - - CV_WRAP size_t globalMemCacheSize() const; - - enum - { - NO_CACHE=0, - READ_ONLY_CACHE=1, - READ_WRITE_CACHE=2 - }; - CV_WRAP int globalMemCacheType() const; - CV_WRAP int globalMemCacheLineSize() const; - CV_WRAP size_t globalMemSize() const; - - CV_WRAP size_t localMemSize() const; - enum - { - NO_LOCAL_MEM=0, - LOCAL_IS_LOCAL=1, - LOCAL_IS_GLOBAL=2 - }; - CV_WRAP int localMemType() const; - CV_WRAP bool hostUnifiedMemory() const; - - CV_WRAP bool imageSupport() const; - - CV_WRAP bool imageFromBufferSupport() const; - uint imagePitchAlignment() const; - uint imageBaseAddressAlignment() const; - - /// deprecated, use isExtensionSupported() method (probably with "cl_khr_subgroups" value) - CV_WRAP bool intelSubgroupsSupport() const; - - CV_WRAP size_t image2DMaxWidth() const; - CV_WRAP size_t image2DMaxHeight() const; - - CV_WRAP size_t image3DMaxWidth() const; - CV_WRAP size_t image3DMaxHeight() const; - CV_WRAP size_t image3DMaxDepth() const; - - CV_WRAP size_t imageMaxBufferSize() const; - CV_WRAP size_t imageMaxArraySize() const; - - enum - { - UNKNOWN_VENDOR=0, - VENDOR_AMD=1, - VENDOR_INTEL=2, - VENDOR_NVIDIA=3 - }; - CV_WRAP int vendorID() const; - // FIXIT - // dev.isAMD() doesn't work for OpenCL CPU devices from AMD OpenCL platform. - // This method should use platform name instead of vendor name. - // After fix restore code in arithm.cpp: ocl_compare() - CV_WRAP inline bool isAMD() const { return vendorID() == VENDOR_AMD; } - CV_WRAP inline bool isIntel() const { return vendorID() == VENDOR_INTEL; } - CV_WRAP inline bool isNVidia() const { return vendorID() == VENDOR_NVIDIA; } - - CV_WRAP int maxClockFrequency() const; - CV_WRAP int maxComputeUnits() const; - CV_WRAP int maxConstantArgs() const; - CV_WRAP size_t maxConstantBufferSize() const; - - CV_WRAP size_t maxMemAllocSize() const; - CV_WRAP size_t maxParameterSize() const; - - CV_WRAP int maxReadImageArgs() const; - CV_WRAP int maxWriteImageArgs() const; - CV_WRAP int maxSamplers() const; - - CV_WRAP size_t maxWorkGroupSize() const; - CV_WRAP int maxWorkItemDims() const; - void maxWorkItemSizes(size_t*) const; - - CV_WRAP int memBaseAddrAlign() const; - - CV_WRAP int nativeVectorWidthChar() const; - CV_WRAP int nativeVectorWidthShort() const; - CV_WRAP int nativeVectorWidthInt() const; - CV_WRAP int nativeVectorWidthLong() const; - CV_WRAP int nativeVectorWidthFloat() const; - CV_WRAP int nativeVectorWidthDouble() const; - CV_WRAP int nativeVectorWidthHalf() const; - - CV_WRAP int preferredVectorWidthChar() const; - CV_WRAP int preferredVectorWidthShort() const; - CV_WRAP int preferredVectorWidthInt() const; - CV_WRAP int preferredVectorWidthLong() const; - CV_WRAP int preferredVectorWidthFloat() const; - CV_WRAP int preferredVectorWidthDouble() const; - CV_WRAP int preferredVectorWidthHalf() const; - - CV_WRAP size_t printfBufferSize() const; - CV_WRAP size_t profilingTimerResolution() const; - - CV_WRAP static const Device& getDefault(); - -protected: - struct Impl; - Impl* p; -}; - - -class CV_EXPORTS Context -{ -public: - Context(); - explicit Context(int dtype); - ~Context(); - Context(const Context& c); - Context& operator = (const Context& c); - - bool create(); - bool create(int dtype); - size_t ndevices() const; - const Device& device(size_t idx) const; - Program getProg(const ProgramSource& prog, - const String& buildopt, String& errmsg); - void unloadProg(Program& prog); - - static Context& getDefault(bool initialize = true); - void* ptr() const; - - friend void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device); - - bool useSVM() const; - void setUseSVM(bool enabled); - - struct Impl; - inline Impl* getImpl() const { return (Impl*)p; } -//protected: - Impl* p; -}; - -class CV_EXPORTS Platform -{ -public: - Platform(); - ~Platform(); - Platform(const Platform& p); - Platform& operator = (const Platform& p); - - void* ptr() const; - static Platform& getDefault(); - - friend void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device); -protected: - struct Impl; - Impl* p; -}; - -/** @brief Attaches OpenCL context to OpenCV -@note - OpenCV will check if available OpenCL platform has platformName name, then assign context to - OpenCV and call `clRetainContext` function. The deviceID device will be used as target device and - new command queue will be created. -@param platformName name of OpenCL platform to attach, this string is used to check if platform is available to OpenCV at runtime -@param platformID ID of platform attached context was created for -@param context OpenCL context to be attached to OpenCV -@param deviceID ID of device, must be created from attached context -*/ -CV_EXPORTS void attachContext(const String& platformName, void* platformID, void* context, void* deviceID); - -/** @brief Convert OpenCL buffer to UMat -@note - OpenCL buffer (cl_mem_buffer) should contain 2D image data, compatible with OpenCV. Memory - content is not copied from `clBuffer` to UMat. Instead, buffer handle assigned to UMat and - `clRetainMemObject` is called. -@param cl_mem_buffer source clBuffer handle -@param step num of bytes in single row -@param rows number of rows -@param cols number of cols -@param type OpenCV type of image -@param dst destination UMat -*/ -CV_EXPORTS void convertFromBuffer(void* cl_mem_buffer, size_t step, int rows, int cols, int type, UMat& dst); - -/** @brief Convert OpenCL image2d_t to UMat -@note - OpenCL `image2d_t` (cl_mem_image), should be compatible with OpenCV UMat formats. Memory content - is copied from image to UMat with `clEnqueueCopyImageToBuffer` function. -@param cl_mem_image source image2d_t handle -@param dst destination UMat -*/ -CV_EXPORTS void convertFromImage(void* cl_mem_image, UMat& dst); - -// TODO Move to internal header -void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device); - -class CV_EXPORTS Queue -{ -public: - Queue(); - explicit Queue(const Context& c, const Device& d=Device()); - ~Queue(); - Queue(const Queue& q); - Queue& operator = (const Queue& q); - - bool create(const Context& c=Context(), const Device& d=Device()); - void finish(); - void* ptr() const; - static Queue& getDefault(); - - /// @brief Returns OpenCL command queue with enable profiling mode support - const Queue& getProfilingQueue() const; - - struct Impl; friend struct Impl; - inline Impl* getImpl() const { return p; } -protected: - Impl* p; -}; - - -class CV_EXPORTS KernelArg -{ -public: - enum { LOCAL=1, READ_ONLY=2, WRITE_ONLY=4, READ_WRITE=6, CONSTANT=8, PTR_ONLY = 16, NO_SIZE=256 }; - KernelArg(int _flags, UMat* _m, int wscale=1, int iwscale=1, const void* _obj=0, size_t _sz=0); - KernelArg(); - - static KernelArg Local(size_t localMemSize) - { return KernelArg(LOCAL, 0, 1, 1, 0, localMemSize); } - static KernelArg PtrWriteOnly(const UMat& m) - { return KernelArg(PTR_ONLY+WRITE_ONLY, (UMat*)&m); } - static KernelArg PtrReadOnly(const UMat& m) - { return KernelArg(PTR_ONLY+READ_ONLY, (UMat*)&m); } - static KernelArg PtrReadWrite(const UMat& m) - { return KernelArg(PTR_ONLY+READ_WRITE, (UMat*)&m); } - static KernelArg ReadWrite(const UMat& m, int wscale=1, int iwscale=1) - { return KernelArg(READ_WRITE, (UMat*)&m, wscale, iwscale); } - static KernelArg ReadWriteNoSize(const UMat& m, int wscale=1, int iwscale=1) - { return KernelArg(READ_WRITE+NO_SIZE, (UMat*)&m, wscale, iwscale); } - static KernelArg ReadOnly(const UMat& m, int wscale=1, int iwscale=1) - { return KernelArg(READ_ONLY, (UMat*)&m, wscale, iwscale); } - static KernelArg WriteOnly(const UMat& m, int wscale=1, int iwscale=1) - { return KernelArg(WRITE_ONLY, (UMat*)&m, wscale, iwscale); } - static KernelArg ReadOnlyNoSize(const UMat& m, int wscale=1, int iwscale=1) - { return KernelArg(READ_ONLY+NO_SIZE, (UMat*)&m, wscale, iwscale); } - static KernelArg WriteOnlyNoSize(const UMat& m, int wscale=1, int iwscale=1) - { return KernelArg(WRITE_ONLY+NO_SIZE, (UMat*)&m, wscale, iwscale); } - static KernelArg Constant(const Mat& m); - template static KernelArg Constant(const _Tp* arr, size_t n) - { return KernelArg(CONSTANT, 0, 1, 1, (void*)arr, n); } - - int flags; - UMat* m; - const void* obj; - size_t sz; - int wscale, iwscale; -}; - - -class CV_EXPORTS Kernel -{ -public: - Kernel(); - Kernel(const char* kname, const Program& prog); - Kernel(const char* kname, const ProgramSource& prog, - const String& buildopts = String(), String* errmsg=0); - ~Kernel(); - Kernel(const Kernel& k); - Kernel& operator = (const Kernel& k); - - bool empty() const; - bool create(const char* kname, const Program& prog); - bool create(const char* kname, const ProgramSource& prog, - const String& buildopts, String* errmsg=0); - - int set(int i, const void* value, size_t sz); - int set(int i, const Image2D& image2D); - int set(int i, const UMat& m); - int set(int i, const KernelArg& arg); - template int set(int i, const _Tp& value) - { return set(i, &value, sizeof(value)); } - - template - Kernel& args(const _Tp0& a0) - { - set(0, a0); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1) - { - int i = set(0, a0); set(i, a1); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2) - { - int i = set(0, a0); i = set(i, a1); set(i, a2); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, - const _Tp3& a3, const _Tp4& a4) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); - i = set(i, a3); set(i, a4); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, - const _Tp3& a3, const _Tp4& a4, const _Tp5& a5) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); - i = set(i, a3); i = set(i, a4); set(i, a5); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3, - const _Tp4& a4, const _Tp5& a5, const _Tp6& a6) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); - i = set(i, a4); i = set(i, a5); set(i, a6); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3, - const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); - i = set(i, a4); i = set(i, a5); i = set(i, a6); set(i, a7); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3, - const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7, - const _Tp8& a8) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); - i = set(i, a5); i = set(i, a6); i = set(i, a7); set(i, a8); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3, - const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7, - const _Tp8& a8, const _Tp9& a9) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5); - i = set(i, a6); i = set(i, a7); i = set(i, a8); set(i, a9); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3, - const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7, - const _Tp8& a8, const _Tp9& a9, const _Tp10& a10) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5); - i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); set(i, a10); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3, - const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7, - const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5); - i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); set(i, a11); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3, - const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7, - const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11, - const _Tp12& a12) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5); - i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11); - set(i, a12); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3, - const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7, - const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11, - const _Tp12& a12, const _Tp13& a13) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5); - i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11); - i = set(i, a12); set(i, a13); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3, - const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7, - const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11, - const _Tp12& a12, const _Tp13& a13, const _Tp14& a14) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5); - i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11); - i = set(i, a12); i = set(i, a13); set(i, a14); return *this; - } - - template - Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3, - const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7, - const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11, - const _Tp12& a12, const _Tp13& a13, const _Tp14& a14, const _Tp15& a15) - { - int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5); - i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11); - i = set(i, a12); i = set(i, a13); i = set(i, a14); set(i, a15); return *this; - } - /** @brief Run the OpenCL kernel. - @param dims the work problem dimensions. It is the length of globalsize and localsize. It can be either 1, 2 or 3. - @param globalsize work items for each dimension. It is not the final globalsize passed to - OpenCL. Each dimension will be adjusted to the nearest integer divisible by the corresponding - value in localsize. If localsize is NULL, it will still be adjusted depending on dims. The - adjusted values are greater than or equal to the original values. - @param localsize work-group size for each dimension. - @param sync specify whether to wait for OpenCL computation to finish before return. - @param q command queue - */ - bool run(int dims, size_t globalsize[], - size_t localsize[], bool sync, const Queue& q=Queue()); - bool runTask(bool sync, const Queue& q=Queue()); - - /** @brief Similar to synchronized run() call with returning of kernel execution time - * Separate OpenCL command queue may be used (with CL_QUEUE_PROFILING_ENABLE) - * @return Execution time in nanoseconds or negative number on error - */ - int64 runProfiling(int dims, size_t globalsize[], size_t localsize[], const Queue& q=Queue()); - - size_t workGroupSize() const; - size_t preferedWorkGroupSizeMultiple() const; - bool compileWorkGroupSize(size_t wsz[]) const; - size_t localMemSize() const; - - void* ptr() const; - struct Impl; - -protected: - Impl* p; -}; - -class CV_EXPORTS Program -{ -public: - Program(); - Program(const ProgramSource& src, - const String& buildflags, String& errmsg); - Program(const Program& prog); - - Program& operator = (const Program& prog); - ~Program(); - - bool create(const ProgramSource& src, - const String& buildflags, String& errmsg); - - void* ptr() const; - - /** - * @brief Query device-specific program binary. - * - * Returns RAW OpenCL executable binary without additional attachments. - * - * @sa ProgramSource::fromBinary - * - * @param[out] binary output buffer - */ - void getBinary(std::vector& binary) const; - - struct Impl; friend struct Impl; - inline Impl* getImpl() const { return (Impl*)p; } -protected: - Impl* p; -public: -#ifndef OPENCV_REMOVE_DEPRECATED_API - // TODO Remove this - CV_DEPRECATED bool read(const String& buf, const String& buildflags); // removed, use ProgramSource instead - CV_DEPRECATED bool write(String& buf) const; // removed, use getBinary() method instead (RAW OpenCL binary) - CV_DEPRECATED const ProgramSource& source() const; // implementation removed - CV_DEPRECATED String getPrefix() const; // deprecated, implementation replaced - CV_DEPRECATED static String getPrefix(const String& buildflags); // deprecated, implementation replaced -#endif -}; - - -class CV_EXPORTS ProgramSource -{ -public: - typedef uint64 hash_t; // deprecated - - ProgramSource(); - explicit ProgramSource(const String& module, const String& name, const String& codeStr, const String& codeHash); - explicit ProgramSource(const String& prog); // deprecated - explicit ProgramSource(const char* prog); // deprecated - ~ProgramSource(); - ProgramSource(const ProgramSource& prog); - ProgramSource& operator = (const ProgramSource& prog); - - const String& source() const; // deprecated - hash_t hash() const; // deprecated - - - /** @brief Describe OpenCL program binary. - * Do not call clCreateProgramWithBinary() and/or clBuildProgram(). - * - * Caller should guarantee binary buffer lifetime greater than ProgramSource object (and any of its copies). - * - * This kind of binary is not portable between platforms in general - it is specific to OpenCL vendor / device / driver version. - * - * @param module name of program owner module - * @param name unique name of program (module+name is used as key for OpenCL program caching) - * @param binary buffer address. See buffer lifetime requirement in description. - * @param size buffer size - * @param buildOptions additional program-related build options passed to clBuildProgram() - * @return created ProgramSource object - */ - static ProgramSource fromBinary(const String& module, const String& name, - const unsigned char* binary, const size_t size, - const cv::String& buildOptions = cv::String()); - - /** @brief Describe OpenCL program in SPIR format. - * Do not call clCreateProgramWithBinary() and/or clBuildProgram(). - * - * Supports SPIR 1.2 by default (pass '-spir-std=X.Y' in buildOptions to override this behavior) - * - * Caller should guarantee binary buffer lifetime greater than ProgramSource object (and any of its copies). - * - * Programs in this format are portable between OpenCL implementations with 'khr_spir' extension: - * https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/cl_khr_spir.html - * (but they are not portable between different platforms: 32-bit / 64-bit) - * - * Note: these programs can't support vendor specific extensions, like 'cl_intel_subgroups'. - * - * @param module name of program owner module - * @param name unique name of program (module+name is used as key for OpenCL program caching) - * @param binary buffer address. See buffer lifetime requirement in description. - * @param size buffer size - * @param buildOptions additional program-related build options passed to clBuildProgram() - * (these options are added automatically: '-x spir' and '-spir-std=1.2') - * @return created ProgramSource object. - */ - static ProgramSource fromSPIR(const String& module, const String& name, - const unsigned char* binary, const size_t size, - const cv::String& buildOptions = cv::String()); - - //OpenCL 2.1+ only - //static Program fromSPIRV(const String& module, const String& name, - // const unsigned char* binary, const size_t size, - // const cv::String& buildOptions = cv::String()); - - struct Impl; friend struct Impl; - inline Impl* getImpl() const { return (Impl*)p; } -protected: - Impl* p; -}; - -class CV_EXPORTS PlatformInfo -{ -public: - PlatformInfo(); - explicit PlatformInfo(void* id); - ~PlatformInfo(); - - PlatformInfo(const PlatformInfo& i); - PlatformInfo& operator =(const PlatformInfo& i); - - String name() const; - String vendor() const; - String version() const; - int deviceNumber() const; - void getDevice(Device& device, int d) const; - -protected: - struct Impl; - Impl* p; -}; - -CV_EXPORTS const char* convertTypeStr(int sdepth, int ddepth, int cn, char* buf); -CV_EXPORTS const char* typeToStr(int t); -CV_EXPORTS const char* memopTypeToStr(int t); -CV_EXPORTS const char* vecopTypeToStr(int t); -CV_EXPORTS const char* getOpenCLErrorString(int errorCode); -CV_EXPORTS String kernelToStr(InputArray _kernel, int ddepth = -1, const char * name = NULL); -CV_EXPORTS void getPlatfomsInfo(std::vector& platform_info); - - -enum OclVectorStrategy -{ - // all matrices have its own vector width - OCL_VECTOR_OWN = 0, - // all matrices have maximal vector width among all matrices - // (useful for cases when matrices have different data types) - OCL_VECTOR_MAX = 1, - - // default strategy - OCL_VECTOR_DEFAULT = OCL_VECTOR_OWN -}; - -CV_EXPORTS int predictOptimalVectorWidth(InputArray src1, InputArray src2 = noArray(), InputArray src3 = noArray(), - InputArray src4 = noArray(), InputArray src5 = noArray(), InputArray src6 = noArray(), - InputArray src7 = noArray(), InputArray src8 = noArray(), InputArray src9 = noArray(), - OclVectorStrategy strat = OCL_VECTOR_DEFAULT); - -CV_EXPORTS int checkOptimalVectorWidth(const int *vectorWidths, - InputArray src1, InputArray src2 = noArray(), InputArray src3 = noArray(), - InputArray src4 = noArray(), InputArray src5 = noArray(), InputArray src6 = noArray(), - InputArray src7 = noArray(), InputArray src8 = noArray(), InputArray src9 = noArray(), - OclVectorStrategy strat = OCL_VECTOR_DEFAULT); - -// with OCL_VECTOR_MAX strategy -CV_EXPORTS int predictOptimalVectorWidthMax(InputArray src1, InputArray src2 = noArray(), InputArray src3 = noArray(), - InputArray src4 = noArray(), InputArray src5 = noArray(), InputArray src6 = noArray(), - InputArray src7 = noArray(), InputArray src8 = noArray(), InputArray src9 = noArray()); - -CV_EXPORTS void buildOptionsAddMatrixDescription(String& buildOptions, const String& name, InputArray _m); - -class CV_EXPORTS Image2D -{ -public: - Image2D(); - - /** - @param src UMat object from which to get image properties and data - @param norm flag to enable the use of normalized channel data types - @param alias flag indicating that the image should alias the src UMat. If true, changes to the - image or src will be reflected in both objects. - */ - explicit Image2D(const UMat &src, bool norm = false, bool alias = false); - Image2D(const Image2D & i); - ~Image2D(); - - Image2D & operator = (const Image2D & i); - - /** Indicates if creating an aliased image should succeed. - Depends on the underlying platform and the dimensions of the UMat. - */ - static bool canCreateAlias(const UMat &u); - - /** Indicates if the image format is supported. - */ - static bool isFormatSupported(int depth, int cn, bool norm); - - void* ptr() const; -protected: - struct Impl; - Impl* p; -}; - -class CV_EXPORTS Timer -{ -public: - Timer(const Queue& q); - ~Timer(); - void start(); - void stop(); - - uint64 durationNS() const; //< duration in nanoseconds - -protected: - struct Impl; - Impl* const p; - -private: - Timer(const Timer&); // disabled - Timer& operator=(const Timer&); // disabled -}; - -CV_EXPORTS MatAllocator* getOpenCLAllocator(); - - -#ifdef __OPENCV_BUILD -namespace internal { - -CV_EXPORTS bool isOpenCLForced(); -#define OCL_FORCE_CHECK(condition) (cv::ocl::internal::isOpenCLForced() || (condition)) - -CV_EXPORTS bool isPerformanceCheckBypassed(); -#define OCL_PERFORMANCE_CHECK(condition) (cv::ocl::internal::isPerformanceCheckBypassed() || (condition)) - -CV_EXPORTS bool isCLBuffer(UMat& u); - -} // namespace internal -#endif - -//! @} - -}} - -#endif diff --git a/opencv/include/opencv2/core/ocl_genbase.hpp b/opencv/include/opencv2/core/ocl_genbase.hpp deleted file mode 100644 index 5334cf1..0000000 --- a/opencv/include/opencv2/core/ocl_genbase.hpp +++ /dev/null @@ -1,69 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the OpenCV Foundation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OPENCL_GENBASE_HPP -#define OPENCV_OPENCL_GENBASE_HPP - -//! @cond IGNORED - -namespace cv { -namespace ocl { - -class ProgramSource; - -namespace internal { - -struct CV_EXPORTS ProgramEntry -{ - const char* module; - const char* name; - const char* programCode; - const char* programHash; - ProgramSource* pProgramSource; - - operator ProgramSource& () const; -}; - -} } } // namespace - -//! @endcond - -#endif diff --git a/opencv/include/opencv2/core/opencl/ocl_defs.hpp b/opencv/include/opencv2/core/opencl/ocl_defs.hpp deleted file mode 100644 index 605a65f..0000000 --- a/opencv/include/opencv2/core/opencl/ocl_defs.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved. -// Third party copyrights are property of their respective owners. - -#ifndef OPENCV_CORE_OPENCL_DEFS_HPP -#define OPENCV_CORE_OPENCL_DEFS_HPP - -#include "opencv2/core/utility.hpp" -#include "cvconfig.h" - -namespace cv { namespace ocl { -#ifdef HAVE_OPENCL -/// Call is similar to useOpenCL() but doesn't try to load OpenCL runtime or create OpenCL context -CV_EXPORTS bool isOpenCLActivated(); -#else -static inline bool isOpenCLActivated() { return false; } -#endif -}} // namespace - - -//#define CV_OPENCL_RUN_ASSERT - -#ifdef HAVE_OPENCL - -#ifdef CV_OPENCL_RUN_VERBOSE -#define CV_OCL_RUN_(condition, func, ...) \ - { \ - if (cv::ocl::isOpenCLActivated() && (condition) && func) \ - { \ - printf("%s: OpenCL implementation is running\n", CV_Func); \ - fflush(stdout); \ - CV_IMPL_ADD(CV_IMPL_OCL); \ - return __VA_ARGS__; \ - } \ - else \ - { \ - printf("%s: Plain implementation is running\n", CV_Func); \ - fflush(stdout); \ - } \ - } -#elif defined CV_OPENCL_RUN_ASSERT -#define CV_OCL_RUN_(condition, func, ...) \ - { \ - if (cv::ocl::isOpenCLActivated() && (condition)) \ - { \ - if(func) \ - { \ - CV_IMPL_ADD(CV_IMPL_OCL); \ - } \ - else \ - { \ - CV_Error(cv::Error::StsAssert, #func); \ - } \ - return __VA_ARGS__; \ - } \ - } -#else -#define CV_OCL_RUN_(condition, func, ...) \ - if (cv::ocl::isOpenCLActivated() && (condition) && func) \ - { \ - CV_IMPL_ADD(CV_IMPL_OCL); \ - return __VA_ARGS__; \ - } -#endif - -#else -#define CV_OCL_RUN_(condition, func, ...) -#endif - -#define CV_OCL_RUN(condition, func) CV_OCL_RUN_(condition, func) - -#endif // OPENCV_CORE_OPENCL_DEFS_HPP diff --git a/opencv/include/opencv2/core/opencl/opencl_info.hpp b/opencv/include/opencv2/core/opencl/opencl_info.hpp deleted file mode 100644 index b5d3739..0000000 --- a/opencv/include/opencv2/core/opencl/opencl_info.hpp +++ /dev/null @@ -1,198 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -#include - -#include -#include - -#ifndef DUMP_CONFIG_PROPERTY -#define DUMP_CONFIG_PROPERTY(...) -#endif - -#ifndef DUMP_MESSAGE_STDOUT -#define DUMP_MESSAGE_STDOUT(...) do { std::cout << __VA_ARGS__ << std::endl; } while (false) -#endif - -namespace cv { - -namespace { -static std::string bytesToStringRepr(size_t value) -{ - size_t b = value % 1024; - value /= 1024; - - size_t kb = value % 1024; - value /= 1024; - - size_t mb = value % 1024; - value /= 1024; - - size_t gb = value; - - std::ostringstream stream; - - if (gb > 0) - stream << gb << " GB "; - if (mb > 0) - stream << mb << " MB "; - if (kb > 0) - stream << kb << " KB "; - if (b > 0) - stream << b << " B"; - - std::string s = stream.str(); - if (s[s.size() - 1] == ' ') - s = s.substr(0, s.size() - 1); - return s; -} -} // namespace - -static void dumpOpenCLInformation() -{ - using namespace cv::ocl; - - try - { - if (!haveOpenCL() || !useOpenCL()) - { - DUMP_MESSAGE_STDOUT("OpenCL is disabled"); - DUMP_CONFIG_PROPERTY("cv_ocl", "disabled"); - return; - } - - std::vector platforms; - cv::ocl::getPlatfomsInfo(platforms); - if (platforms.size() > 0) - { - DUMP_MESSAGE_STDOUT("OpenCL Platforms: "); - for (size_t i = 0; i < platforms.size(); i++) - { - const PlatformInfo* platform = &platforms[i]; - DUMP_MESSAGE_STDOUT(" " << platform->name().c_str()); - Device current_device; - for (int j = 0; j < platform->deviceNumber(); j++) - { - platform->getDevice(current_device, j); - const char* deviceTypeStr = current_device.type() == Device::TYPE_CPU - ? ("CPU") : (current_device.type() == Device::TYPE_GPU ? current_device.hostUnifiedMemory() ? "iGPU" : "dGPU" : "unknown"); - DUMP_MESSAGE_STDOUT( " " << deviceTypeStr << ": " << current_device.name().c_str() << " (" << current_device.version().c_str() << ")"); - DUMP_CONFIG_PROPERTY( cv::format("cv_ocl_platform_%d_device_%d", (int)i, (int)j ), - cv::format("(Platform=%s)(Type=%s)(Name=%s)(Version=%s)", - platform->name().c_str(), deviceTypeStr, current_device.name().c_str(), current_device.version().c_str()) ); - } - } - } - else - { - DUMP_MESSAGE_STDOUT("OpenCL is not available"); - DUMP_CONFIG_PROPERTY("cv_ocl", "not available"); - return; - } - - const Device& device = Device::getDefault(); - if (!device.available()) - CV_Error(Error::OpenCLInitError, "OpenCL device is not available"); - - DUMP_MESSAGE_STDOUT("Current OpenCL device: "); - -#if 0 - DUMP_MESSAGE_STDOUT(" Platform = " << device.getPlatform().name()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_platformName", device.getPlatform().name()); -#endif - - const char* deviceTypeStr = device.type() == Device::TYPE_CPU - ? ("CPU") : (device.type() == Device::TYPE_GPU ? device.hostUnifiedMemory() ? "iGPU" : "dGPU" : "unknown"); - DUMP_MESSAGE_STDOUT(" Type = " << deviceTypeStr); - DUMP_CONFIG_PROPERTY("cv_ocl_current_deviceType", deviceTypeStr); - - DUMP_MESSAGE_STDOUT(" Name = " << device.name()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_deviceName", device.name()); - - DUMP_MESSAGE_STDOUT(" Version = " << device.version()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_deviceVersion", device.version()); - - DUMP_MESSAGE_STDOUT(" Driver version = " << device.driverVersion()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_driverVersion", device.driverVersion()); - - DUMP_MESSAGE_STDOUT(" Address bits = " << device.addressBits()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_addressBits", device.addressBits()); - - DUMP_MESSAGE_STDOUT(" Compute units = " << device.maxComputeUnits()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_maxComputeUnits", device.maxComputeUnits()); - - DUMP_MESSAGE_STDOUT(" Max work group size = " << device.maxWorkGroupSize()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_maxWorkGroupSize", device.maxWorkGroupSize()); - - std::string localMemorySizeStr = bytesToStringRepr(device.localMemSize()); - DUMP_MESSAGE_STDOUT(" Local memory size = " << localMemorySizeStr); - DUMP_CONFIG_PROPERTY("cv_ocl_current_localMemSize", device.localMemSize()); - - std::string maxMemAllocSizeStr = bytesToStringRepr(device.maxMemAllocSize()); - DUMP_MESSAGE_STDOUT(" Max memory allocation size = " << maxMemAllocSizeStr); - DUMP_CONFIG_PROPERTY("cv_ocl_current_maxMemAllocSize", device.maxMemAllocSize()); - - const char* doubleSupportStr = device.doubleFPConfig() > 0 ? "Yes" : "No"; - DUMP_MESSAGE_STDOUT(" Double support = " << doubleSupportStr); - DUMP_CONFIG_PROPERTY("cv_ocl_current_haveDoubleSupport", device.doubleFPConfig() > 0); - - const char* isUnifiedMemoryStr = device.hostUnifiedMemory() ? "Yes" : "No"; - DUMP_MESSAGE_STDOUT(" Host unified memory = " << isUnifiedMemoryStr); - DUMP_CONFIG_PROPERTY("cv_ocl_current_hostUnifiedMemory", device.hostUnifiedMemory()); - - DUMP_MESSAGE_STDOUT(" Device extensions:"); - String extensionsStr = device.extensions(); - size_t pos = 0; - while (pos < extensionsStr.size()) - { - size_t pos2 = extensionsStr.find(' ', pos); - if (pos2 == String::npos) - pos2 = extensionsStr.size(); - if (pos2 > pos) - { - String extensionName = extensionsStr.substr(pos, pos2 - pos); - DUMP_MESSAGE_STDOUT(" " << extensionName); - } - pos = pos2 + 1; - } - DUMP_CONFIG_PROPERTY("cv_ocl_current_extensions", extensionsStr.c_str()); - - const char* haveAmdBlasStr = haveAmdBlas() ? "Yes" : "No"; - DUMP_MESSAGE_STDOUT(" Has AMD Blas = " << haveAmdBlasStr); - DUMP_CONFIG_PROPERTY("cv_ocl_current_AmdBlas", haveAmdBlas()); - - const char* haveAmdFftStr = haveAmdFft() ? "Yes" : "No"; - DUMP_MESSAGE_STDOUT(" Has AMD Fft = " << haveAmdFftStr); - DUMP_CONFIG_PROPERTY("cv_ocl_current_AmdFft", haveAmdFft()); - - - DUMP_MESSAGE_STDOUT(" Preferred vector width char = " << device.preferredVectorWidthChar()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_preferredVectorWidthChar", device.preferredVectorWidthChar()); - - DUMP_MESSAGE_STDOUT(" Preferred vector width short = " << device.preferredVectorWidthShort()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_preferredVectorWidthShort", device.preferredVectorWidthShort()); - - DUMP_MESSAGE_STDOUT(" Preferred vector width int = " << device.preferredVectorWidthInt()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_preferredVectorWidthInt", device.preferredVectorWidthInt()); - - DUMP_MESSAGE_STDOUT(" Preferred vector width long = " << device.preferredVectorWidthLong()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_preferredVectorWidthLong", device.preferredVectorWidthLong()); - - DUMP_MESSAGE_STDOUT(" Preferred vector width float = " << device.preferredVectorWidthFloat()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_preferredVectorWidthFloat", device.preferredVectorWidthFloat()); - - DUMP_MESSAGE_STDOUT(" Preferred vector width double = " << device.preferredVectorWidthDouble()); - DUMP_CONFIG_PROPERTY("cv_ocl_current_preferredVectorWidthDouble", device.preferredVectorWidthDouble()); - } - catch (...) - { - DUMP_MESSAGE_STDOUT("Exception. Can't dump OpenCL info"); - DUMP_MESSAGE_STDOUT("OpenCL device not available"); - DUMP_CONFIG_PROPERTY("cv_ocl", "not available"); - } -} -#undef DUMP_MESSAGE_STDOUT -#undef DUMP_CONFIG_PROPERTY - -} // namespace diff --git a/opencv/include/opencv2/core/opencl/opencl_svm.hpp b/opencv/include/opencv2/core/opencl/opencl_svm.hpp deleted file mode 100644 index 7453082..0000000 --- a/opencv/include/opencv2/core/opencl/opencl_svm.hpp +++ /dev/null @@ -1,81 +0,0 @@ -/* See LICENSE file in the root OpenCV directory */ - -#ifndef OPENCV_CORE_OPENCL_SVM_HPP -#define OPENCV_CORE_OPENCL_SVM_HPP - -// -// Internal usage only (binary compatibility is not guaranteed) -// -#ifndef __OPENCV_BUILD -#error Internal header file -#endif - -#if defined(HAVE_OPENCL) && defined(HAVE_OPENCL_SVM) -#include "runtime/opencl_core.hpp" -#include "runtime/opencl_svm_20.hpp" -#include "runtime/opencl_svm_hsa_extension.hpp" - -namespace cv { namespace ocl { namespace svm { - -struct SVMCapabilities -{ - enum Value - { - SVM_COARSE_GRAIN_BUFFER = (1 << 0), - SVM_FINE_GRAIN_BUFFER = (1 << 1), - SVM_FINE_GRAIN_SYSTEM = (1 << 2), - SVM_ATOMICS = (1 << 3), - }; - int value_; - - SVMCapabilities(int capabilities = 0) : value_(capabilities) { } - operator int() const { return value_; } - - inline bool isNoSVMSupport() const { return value_ == 0; } - inline bool isSupportCoarseGrainBuffer() const { return (value_ & SVM_COARSE_GRAIN_BUFFER) != 0; } - inline bool isSupportFineGrainBuffer() const { return (value_ & SVM_FINE_GRAIN_BUFFER) != 0; } - inline bool isSupportFineGrainSystem() const { return (value_ & SVM_FINE_GRAIN_SYSTEM) != 0; } - inline bool isSupportAtomics() const { return (value_ & SVM_ATOMICS) != 0; } -}; - -CV_EXPORTS const SVMCapabilities getSVMCapabilitites(const ocl::Context& context); - -struct SVMFunctions -{ - clSVMAllocAMD_fn fn_clSVMAlloc; - clSVMFreeAMD_fn fn_clSVMFree; - clSetKernelArgSVMPointerAMD_fn fn_clSetKernelArgSVMPointer; - //clSetKernelExecInfoAMD_fn fn_clSetKernelExecInfo; - //clEnqueueSVMFreeAMD_fn fn_clEnqueueSVMFree; - clEnqueueSVMMemcpyAMD_fn fn_clEnqueueSVMMemcpy; - clEnqueueSVMMemFillAMD_fn fn_clEnqueueSVMMemFill; - clEnqueueSVMMapAMD_fn fn_clEnqueueSVMMap; - clEnqueueSVMUnmapAMD_fn fn_clEnqueueSVMUnmap; - - inline SVMFunctions() - : fn_clSVMAlloc(NULL), fn_clSVMFree(NULL), - fn_clSetKernelArgSVMPointer(NULL), /*fn_clSetKernelExecInfo(NULL),*/ - /*fn_clEnqueueSVMFree(NULL),*/ fn_clEnqueueSVMMemcpy(NULL), fn_clEnqueueSVMMemFill(NULL), - fn_clEnqueueSVMMap(NULL), fn_clEnqueueSVMUnmap(NULL) - { - // nothing - } - - inline bool isValid() const - { - return fn_clSVMAlloc != NULL && fn_clSVMFree && fn_clSetKernelArgSVMPointer && - /*fn_clSetKernelExecInfo && fn_clEnqueueSVMFree &&*/ fn_clEnqueueSVMMemcpy && - fn_clEnqueueSVMMemFill && fn_clEnqueueSVMMap && fn_clEnqueueSVMUnmap; - } -}; - -// We should guarantee that SVMFunctions lifetime is not less than context's lifetime -CV_EXPORTS const SVMFunctions* getSVMFunctions(const ocl::Context& context); - -CV_EXPORTS bool useSVM(UMatUsageFlags usageFlags); - -}}} //namespace cv::ocl::svm -#endif - -#endif // OPENCV_CORE_OPENCL_SVM_HPP -/* End of file. */ diff --git a/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_clamdblas.hpp b/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_clamdblas.hpp deleted file mode 100644 index 65c8493..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_clamdblas.hpp +++ /dev/null @@ -1,714 +0,0 @@ -// -// AUTOGENERATED, DO NOT EDIT -// -#ifndef OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP -#error "Invalid usage" -#endif - -// generated by parser_clamdblas.py -#define clAmdBlasAddScratchImage clAmdBlasAddScratchImage_ -#define clAmdBlasCaxpy clAmdBlasCaxpy_ -#define clAmdBlasCcopy clAmdBlasCcopy_ -#define clAmdBlasCdotc clAmdBlasCdotc_ -#define clAmdBlasCdotu clAmdBlasCdotu_ -#define clAmdBlasCgbmv clAmdBlasCgbmv_ -#define clAmdBlasCgemm clAmdBlasCgemm_ -#define clAmdBlasCgemmEx clAmdBlasCgemmEx_ -#define clAmdBlasCgemv clAmdBlasCgemv_ -#define clAmdBlasCgemvEx clAmdBlasCgemvEx_ -#define clAmdBlasCgerc clAmdBlasCgerc_ -#define clAmdBlasCgeru clAmdBlasCgeru_ -#define clAmdBlasChbmv clAmdBlasChbmv_ -#define clAmdBlasChemm clAmdBlasChemm_ -#define clAmdBlasChemv clAmdBlasChemv_ -#define clAmdBlasCher clAmdBlasCher_ -#define clAmdBlasCher2 clAmdBlasCher2_ -#define clAmdBlasCher2k clAmdBlasCher2k_ -#define clAmdBlasCherk clAmdBlasCherk_ -#define clAmdBlasChpmv clAmdBlasChpmv_ -#define clAmdBlasChpr clAmdBlasChpr_ -#define clAmdBlasChpr2 clAmdBlasChpr2_ -#define clAmdBlasCrotg clAmdBlasCrotg_ -#define clAmdBlasCscal clAmdBlasCscal_ -#define clAmdBlasCsrot clAmdBlasCsrot_ -#define clAmdBlasCsscal clAmdBlasCsscal_ -#define clAmdBlasCswap clAmdBlasCswap_ -#define clAmdBlasCsymm clAmdBlasCsymm_ -#define clAmdBlasCsyr2k clAmdBlasCsyr2k_ -#define clAmdBlasCsyr2kEx clAmdBlasCsyr2kEx_ -#define clAmdBlasCsyrk clAmdBlasCsyrk_ -#define clAmdBlasCsyrkEx clAmdBlasCsyrkEx_ -#define clAmdBlasCtbmv clAmdBlasCtbmv_ -#define clAmdBlasCtbsv clAmdBlasCtbsv_ -#define clAmdBlasCtpmv clAmdBlasCtpmv_ -#define clAmdBlasCtpsv clAmdBlasCtpsv_ -#define clAmdBlasCtrmm clAmdBlasCtrmm_ -#define clAmdBlasCtrmmEx clAmdBlasCtrmmEx_ -#define clAmdBlasCtrmv clAmdBlasCtrmv_ -#define clAmdBlasCtrsm clAmdBlasCtrsm_ -#define clAmdBlasCtrsmEx clAmdBlasCtrsmEx_ -#define clAmdBlasCtrsv clAmdBlasCtrsv_ -#define clAmdBlasDasum clAmdBlasDasum_ -#define clAmdBlasDaxpy clAmdBlasDaxpy_ -#define clAmdBlasDcopy clAmdBlasDcopy_ -#define clAmdBlasDdot clAmdBlasDdot_ -#define clAmdBlasDgbmv clAmdBlasDgbmv_ -#define clAmdBlasDgemm clAmdBlasDgemm_ -#define clAmdBlasDgemmEx clAmdBlasDgemmEx_ -#define clAmdBlasDgemv clAmdBlasDgemv_ -#define clAmdBlasDgemvEx clAmdBlasDgemvEx_ -#define clAmdBlasDger clAmdBlasDger_ -#define clAmdBlasDnrm2 clAmdBlasDnrm2_ -#define clAmdBlasDrot clAmdBlasDrot_ -#define clAmdBlasDrotg clAmdBlasDrotg_ -#define clAmdBlasDrotm clAmdBlasDrotm_ -#define clAmdBlasDrotmg clAmdBlasDrotmg_ -#define clAmdBlasDsbmv clAmdBlasDsbmv_ -#define clAmdBlasDscal clAmdBlasDscal_ -#define clAmdBlasDspmv clAmdBlasDspmv_ -#define clAmdBlasDspr clAmdBlasDspr_ -#define clAmdBlasDspr2 clAmdBlasDspr2_ -#define clAmdBlasDswap clAmdBlasDswap_ -#define clAmdBlasDsymm clAmdBlasDsymm_ -#define clAmdBlasDsymv clAmdBlasDsymv_ -#define clAmdBlasDsymvEx clAmdBlasDsymvEx_ -#define clAmdBlasDsyr clAmdBlasDsyr_ -#define clAmdBlasDsyr2 clAmdBlasDsyr2_ -#define clAmdBlasDsyr2k clAmdBlasDsyr2k_ -#define clAmdBlasDsyr2kEx clAmdBlasDsyr2kEx_ -#define clAmdBlasDsyrk clAmdBlasDsyrk_ -#define clAmdBlasDsyrkEx clAmdBlasDsyrkEx_ -#define clAmdBlasDtbmv clAmdBlasDtbmv_ -#define clAmdBlasDtbsv clAmdBlasDtbsv_ -#define clAmdBlasDtpmv clAmdBlasDtpmv_ -#define clAmdBlasDtpsv clAmdBlasDtpsv_ -#define clAmdBlasDtrmm clAmdBlasDtrmm_ -#define clAmdBlasDtrmmEx clAmdBlasDtrmmEx_ -#define clAmdBlasDtrmv clAmdBlasDtrmv_ -#define clAmdBlasDtrsm clAmdBlasDtrsm_ -#define clAmdBlasDtrsmEx clAmdBlasDtrsmEx_ -#define clAmdBlasDtrsv clAmdBlasDtrsv_ -#define clAmdBlasDzasum clAmdBlasDzasum_ -#define clAmdBlasDznrm2 clAmdBlasDznrm2_ -#define clAmdBlasGetVersion clAmdBlasGetVersion_ -#define clAmdBlasRemoveScratchImage clAmdBlasRemoveScratchImage_ -#define clAmdBlasSasum clAmdBlasSasum_ -#define clAmdBlasSaxpy clAmdBlasSaxpy_ -#define clAmdBlasScasum clAmdBlasScasum_ -#define clAmdBlasScnrm2 clAmdBlasScnrm2_ -#define clAmdBlasScopy clAmdBlasScopy_ -#define clAmdBlasSdot clAmdBlasSdot_ -#define clAmdBlasSetup clAmdBlasSetup_ -#define clAmdBlasSgbmv clAmdBlasSgbmv_ -#define clAmdBlasSgemm clAmdBlasSgemm_ -#define clAmdBlasSgemmEx clAmdBlasSgemmEx_ -#define clAmdBlasSgemv clAmdBlasSgemv_ -#define clAmdBlasSgemvEx clAmdBlasSgemvEx_ -#define clAmdBlasSger clAmdBlasSger_ -#define clAmdBlasSnrm2 clAmdBlasSnrm2_ -#define clAmdBlasSrot clAmdBlasSrot_ -#define clAmdBlasSrotg clAmdBlasSrotg_ -#define clAmdBlasSrotm clAmdBlasSrotm_ -#define clAmdBlasSrotmg clAmdBlasSrotmg_ -#define clAmdBlasSsbmv clAmdBlasSsbmv_ -#define clAmdBlasSscal clAmdBlasSscal_ -#define clAmdBlasSspmv clAmdBlasSspmv_ -#define clAmdBlasSspr clAmdBlasSspr_ -#define clAmdBlasSspr2 clAmdBlasSspr2_ -#define clAmdBlasSswap clAmdBlasSswap_ -#define clAmdBlasSsymm clAmdBlasSsymm_ -#define clAmdBlasSsymv clAmdBlasSsymv_ -#define clAmdBlasSsymvEx clAmdBlasSsymvEx_ -#define clAmdBlasSsyr clAmdBlasSsyr_ -#define clAmdBlasSsyr2 clAmdBlasSsyr2_ -#define clAmdBlasSsyr2k clAmdBlasSsyr2k_ -#define clAmdBlasSsyr2kEx clAmdBlasSsyr2kEx_ -#define clAmdBlasSsyrk clAmdBlasSsyrk_ -#define clAmdBlasSsyrkEx clAmdBlasSsyrkEx_ -#define clAmdBlasStbmv clAmdBlasStbmv_ -#define clAmdBlasStbsv clAmdBlasStbsv_ -#define clAmdBlasStpmv clAmdBlasStpmv_ -#define clAmdBlasStpsv clAmdBlasStpsv_ -#define clAmdBlasStrmm clAmdBlasStrmm_ -#define clAmdBlasStrmmEx clAmdBlasStrmmEx_ -#define clAmdBlasStrmv clAmdBlasStrmv_ -#define clAmdBlasStrsm clAmdBlasStrsm_ -#define clAmdBlasStrsmEx clAmdBlasStrsmEx_ -#define clAmdBlasStrsv clAmdBlasStrsv_ -#define clAmdBlasTeardown clAmdBlasTeardown_ -#define clAmdBlasZaxpy clAmdBlasZaxpy_ -#define clAmdBlasZcopy clAmdBlasZcopy_ -#define clAmdBlasZdotc clAmdBlasZdotc_ -#define clAmdBlasZdotu clAmdBlasZdotu_ -#define clAmdBlasZdrot clAmdBlasZdrot_ -#define clAmdBlasZdscal clAmdBlasZdscal_ -#define clAmdBlasZgbmv clAmdBlasZgbmv_ -#define clAmdBlasZgemm clAmdBlasZgemm_ -#define clAmdBlasZgemmEx clAmdBlasZgemmEx_ -#define clAmdBlasZgemv clAmdBlasZgemv_ -#define clAmdBlasZgemvEx clAmdBlasZgemvEx_ -#define clAmdBlasZgerc clAmdBlasZgerc_ -#define clAmdBlasZgeru clAmdBlasZgeru_ -#define clAmdBlasZhbmv clAmdBlasZhbmv_ -#define clAmdBlasZhemm clAmdBlasZhemm_ -#define clAmdBlasZhemv clAmdBlasZhemv_ -#define clAmdBlasZher clAmdBlasZher_ -#define clAmdBlasZher2 clAmdBlasZher2_ -#define clAmdBlasZher2k clAmdBlasZher2k_ -#define clAmdBlasZherk clAmdBlasZherk_ -#define clAmdBlasZhpmv clAmdBlasZhpmv_ -#define clAmdBlasZhpr clAmdBlasZhpr_ -#define clAmdBlasZhpr2 clAmdBlasZhpr2_ -#define clAmdBlasZrotg clAmdBlasZrotg_ -#define clAmdBlasZscal clAmdBlasZscal_ -#define clAmdBlasZswap clAmdBlasZswap_ -#define clAmdBlasZsymm clAmdBlasZsymm_ -#define clAmdBlasZsyr2k clAmdBlasZsyr2k_ -#define clAmdBlasZsyr2kEx clAmdBlasZsyr2kEx_ -#define clAmdBlasZsyrk clAmdBlasZsyrk_ -#define clAmdBlasZsyrkEx clAmdBlasZsyrkEx_ -#define clAmdBlasZtbmv clAmdBlasZtbmv_ -#define clAmdBlasZtbsv clAmdBlasZtbsv_ -#define clAmdBlasZtpmv clAmdBlasZtpmv_ -#define clAmdBlasZtpsv clAmdBlasZtpsv_ -#define clAmdBlasZtrmm clAmdBlasZtrmm_ -#define clAmdBlasZtrmmEx clAmdBlasZtrmmEx_ -#define clAmdBlasZtrmv clAmdBlasZtrmv_ -#define clAmdBlasZtrsm clAmdBlasZtrsm_ -#define clAmdBlasZtrsmEx clAmdBlasZtrsmEx_ -#define clAmdBlasZtrsv clAmdBlasZtrsv_ -#define clAmdBlasiCamax clAmdBlasiCamax_ -#define clAmdBlasiDamax clAmdBlasiDamax_ -#define clAmdBlasiSamax clAmdBlasiSamax_ -#define clAmdBlasiZamax clAmdBlasiZamax_ - -#include - -// generated by parser_clamdblas.py -#undef clAmdBlasAddScratchImage -//#define clAmdBlasAddScratchImage clAmdBlasAddScratchImage_pfn -#undef clAmdBlasCaxpy -//#define clAmdBlasCaxpy clAmdBlasCaxpy_pfn -#undef clAmdBlasCcopy -//#define clAmdBlasCcopy clAmdBlasCcopy_pfn -#undef clAmdBlasCdotc -//#define clAmdBlasCdotc clAmdBlasCdotc_pfn -#undef clAmdBlasCdotu -//#define clAmdBlasCdotu clAmdBlasCdotu_pfn -#undef clAmdBlasCgbmv -//#define clAmdBlasCgbmv clAmdBlasCgbmv_pfn -#undef clAmdBlasCgemm -//#define clAmdBlasCgemm clAmdBlasCgemm_pfn -#undef clAmdBlasCgemmEx -#define clAmdBlasCgemmEx clAmdBlasCgemmEx_pfn -#undef clAmdBlasCgemv -//#define clAmdBlasCgemv clAmdBlasCgemv_pfn -#undef clAmdBlasCgemvEx -//#define clAmdBlasCgemvEx clAmdBlasCgemvEx_pfn -#undef clAmdBlasCgerc -//#define clAmdBlasCgerc clAmdBlasCgerc_pfn -#undef clAmdBlasCgeru -//#define clAmdBlasCgeru clAmdBlasCgeru_pfn -#undef clAmdBlasChbmv -//#define clAmdBlasChbmv clAmdBlasChbmv_pfn -#undef clAmdBlasChemm -//#define clAmdBlasChemm clAmdBlasChemm_pfn -#undef clAmdBlasChemv -//#define clAmdBlasChemv clAmdBlasChemv_pfn -#undef clAmdBlasCher -//#define clAmdBlasCher clAmdBlasCher_pfn -#undef clAmdBlasCher2 -//#define clAmdBlasCher2 clAmdBlasCher2_pfn -#undef clAmdBlasCher2k -//#define clAmdBlasCher2k clAmdBlasCher2k_pfn -#undef clAmdBlasCherk -//#define clAmdBlasCherk clAmdBlasCherk_pfn -#undef clAmdBlasChpmv -//#define clAmdBlasChpmv clAmdBlasChpmv_pfn -#undef clAmdBlasChpr -//#define clAmdBlasChpr clAmdBlasChpr_pfn -#undef clAmdBlasChpr2 -//#define clAmdBlasChpr2 clAmdBlasChpr2_pfn -#undef clAmdBlasCrotg -//#define clAmdBlasCrotg clAmdBlasCrotg_pfn -#undef clAmdBlasCscal -//#define clAmdBlasCscal clAmdBlasCscal_pfn -#undef clAmdBlasCsrot -//#define clAmdBlasCsrot clAmdBlasCsrot_pfn -#undef clAmdBlasCsscal -//#define clAmdBlasCsscal clAmdBlasCsscal_pfn -#undef clAmdBlasCswap -//#define clAmdBlasCswap clAmdBlasCswap_pfn -#undef clAmdBlasCsymm -//#define clAmdBlasCsymm clAmdBlasCsymm_pfn -#undef clAmdBlasCsyr2k -//#define clAmdBlasCsyr2k clAmdBlasCsyr2k_pfn -#undef clAmdBlasCsyr2kEx -//#define clAmdBlasCsyr2kEx clAmdBlasCsyr2kEx_pfn -#undef clAmdBlasCsyrk -//#define clAmdBlasCsyrk clAmdBlasCsyrk_pfn -#undef clAmdBlasCsyrkEx -//#define clAmdBlasCsyrkEx clAmdBlasCsyrkEx_pfn -#undef clAmdBlasCtbmv -//#define clAmdBlasCtbmv clAmdBlasCtbmv_pfn -#undef clAmdBlasCtbsv -//#define clAmdBlasCtbsv clAmdBlasCtbsv_pfn -#undef clAmdBlasCtpmv -//#define clAmdBlasCtpmv clAmdBlasCtpmv_pfn -#undef clAmdBlasCtpsv -//#define clAmdBlasCtpsv clAmdBlasCtpsv_pfn -#undef clAmdBlasCtrmm -//#define clAmdBlasCtrmm clAmdBlasCtrmm_pfn -#undef clAmdBlasCtrmmEx -//#define clAmdBlasCtrmmEx clAmdBlasCtrmmEx_pfn -#undef clAmdBlasCtrmv -//#define clAmdBlasCtrmv clAmdBlasCtrmv_pfn -#undef clAmdBlasCtrsm -//#define clAmdBlasCtrsm clAmdBlasCtrsm_pfn -#undef clAmdBlasCtrsmEx -//#define clAmdBlasCtrsmEx clAmdBlasCtrsmEx_pfn -#undef clAmdBlasCtrsv -//#define clAmdBlasCtrsv clAmdBlasCtrsv_pfn -#undef clAmdBlasDasum -//#define clAmdBlasDasum clAmdBlasDasum_pfn -#undef clAmdBlasDaxpy -//#define clAmdBlasDaxpy clAmdBlasDaxpy_pfn -#undef clAmdBlasDcopy -//#define clAmdBlasDcopy clAmdBlasDcopy_pfn -#undef clAmdBlasDdot -//#define clAmdBlasDdot clAmdBlasDdot_pfn -#undef clAmdBlasDgbmv -//#define clAmdBlasDgbmv clAmdBlasDgbmv_pfn -#undef clAmdBlasDgemm -//#define clAmdBlasDgemm clAmdBlasDgemm_pfn -#undef clAmdBlasDgemmEx -#define clAmdBlasDgemmEx clAmdBlasDgemmEx_pfn -#undef clAmdBlasDgemv -//#define clAmdBlasDgemv clAmdBlasDgemv_pfn -#undef clAmdBlasDgemvEx -//#define clAmdBlasDgemvEx clAmdBlasDgemvEx_pfn -#undef clAmdBlasDger -//#define clAmdBlasDger clAmdBlasDger_pfn -#undef clAmdBlasDnrm2 -//#define clAmdBlasDnrm2 clAmdBlasDnrm2_pfn -#undef clAmdBlasDrot -//#define clAmdBlasDrot clAmdBlasDrot_pfn -#undef clAmdBlasDrotg -//#define clAmdBlasDrotg clAmdBlasDrotg_pfn -#undef clAmdBlasDrotm -//#define clAmdBlasDrotm clAmdBlasDrotm_pfn -#undef clAmdBlasDrotmg -//#define clAmdBlasDrotmg clAmdBlasDrotmg_pfn -#undef clAmdBlasDsbmv -//#define clAmdBlasDsbmv clAmdBlasDsbmv_pfn -#undef clAmdBlasDscal -//#define clAmdBlasDscal clAmdBlasDscal_pfn -#undef clAmdBlasDspmv -//#define clAmdBlasDspmv clAmdBlasDspmv_pfn -#undef clAmdBlasDspr -//#define clAmdBlasDspr clAmdBlasDspr_pfn -#undef clAmdBlasDspr2 -//#define clAmdBlasDspr2 clAmdBlasDspr2_pfn -#undef clAmdBlasDswap -//#define clAmdBlasDswap clAmdBlasDswap_pfn -#undef clAmdBlasDsymm -//#define clAmdBlasDsymm clAmdBlasDsymm_pfn -#undef clAmdBlasDsymv -//#define clAmdBlasDsymv clAmdBlasDsymv_pfn -#undef clAmdBlasDsymvEx -//#define clAmdBlasDsymvEx clAmdBlasDsymvEx_pfn -#undef clAmdBlasDsyr -//#define clAmdBlasDsyr clAmdBlasDsyr_pfn -#undef clAmdBlasDsyr2 -//#define clAmdBlasDsyr2 clAmdBlasDsyr2_pfn -#undef clAmdBlasDsyr2k -//#define clAmdBlasDsyr2k clAmdBlasDsyr2k_pfn -#undef clAmdBlasDsyr2kEx -//#define clAmdBlasDsyr2kEx clAmdBlasDsyr2kEx_pfn -#undef clAmdBlasDsyrk -//#define clAmdBlasDsyrk clAmdBlasDsyrk_pfn -#undef clAmdBlasDsyrkEx -//#define clAmdBlasDsyrkEx clAmdBlasDsyrkEx_pfn -#undef clAmdBlasDtbmv -//#define clAmdBlasDtbmv clAmdBlasDtbmv_pfn -#undef clAmdBlasDtbsv -//#define clAmdBlasDtbsv clAmdBlasDtbsv_pfn -#undef clAmdBlasDtpmv -//#define clAmdBlasDtpmv clAmdBlasDtpmv_pfn -#undef clAmdBlasDtpsv -//#define clAmdBlasDtpsv clAmdBlasDtpsv_pfn -#undef clAmdBlasDtrmm -//#define clAmdBlasDtrmm clAmdBlasDtrmm_pfn -#undef clAmdBlasDtrmmEx -//#define clAmdBlasDtrmmEx clAmdBlasDtrmmEx_pfn -#undef clAmdBlasDtrmv -//#define clAmdBlasDtrmv clAmdBlasDtrmv_pfn -#undef clAmdBlasDtrsm -//#define clAmdBlasDtrsm clAmdBlasDtrsm_pfn -#undef clAmdBlasDtrsmEx -//#define clAmdBlasDtrsmEx clAmdBlasDtrsmEx_pfn -#undef clAmdBlasDtrsv -//#define clAmdBlasDtrsv clAmdBlasDtrsv_pfn -#undef clAmdBlasDzasum -//#define clAmdBlasDzasum clAmdBlasDzasum_pfn -#undef clAmdBlasDznrm2 -//#define clAmdBlasDznrm2 clAmdBlasDznrm2_pfn -#undef clAmdBlasGetVersion -//#define clAmdBlasGetVersion clAmdBlasGetVersion_pfn -#undef clAmdBlasRemoveScratchImage -//#define clAmdBlasRemoveScratchImage clAmdBlasRemoveScratchImage_pfn -#undef clAmdBlasSasum -//#define clAmdBlasSasum clAmdBlasSasum_pfn -#undef clAmdBlasSaxpy -//#define clAmdBlasSaxpy clAmdBlasSaxpy_pfn -#undef clAmdBlasScasum -//#define clAmdBlasScasum clAmdBlasScasum_pfn -#undef clAmdBlasScnrm2 -//#define clAmdBlasScnrm2 clAmdBlasScnrm2_pfn -#undef clAmdBlasScopy -//#define clAmdBlasScopy clAmdBlasScopy_pfn -#undef clAmdBlasSdot -//#define clAmdBlasSdot clAmdBlasSdot_pfn -#undef clAmdBlasSetup -#define clAmdBlasSetup clAmdBlasSetup_pfn -#undef clAmdBlasSgbmv -//#define clAmdBlasSgbmv clAmdBlasSgbmv_pfn -#undef clAmdBlasSgemm -//#define clAmdBlasSgemm clAmdBlasSgemm_pfn -#undef clAmdBlasSgemmEx -#define clAmdBlasSgemmEx clAmdBlasSgemmEx_pfn -#undef clAmdBlasSgemv -//#define clAmdBlasSgemv clAmdBlasSgemv_pfn -#undef clAmdBlasSgemvEx -//#define clAmdBlasSgemvEx clAmdBlasSgemvEx_pfn -#undef clAmdBlasSger -//#define clAmdBlasSger clAmdBlasSger_pfn -#undef clAmdBlasSnrm2 -//#define clAmdBlasSnrm2 clAmdBlasSnrm2_pfn -#undef clAmdBlasSrot -//#define clAmdBlasSrot clAmdBlasSrot_pfn -#undef clAmdBlasSrotg -//#define clAmdBlasSrotg clAmdBlasSrotg_pfn -#undef clAmdBlasSrotm -//#define clAmdBlasSrotm clAmdBlasSrotm_pfn -#undef clAmdBlasSrotmg -//#define clAmdBlasSrotmg clAmdBlasSrotmg_pfn -#undef clAmdBlasSsbmv -//#define clAmdBlasSsbmv clAmdBlasSsbmv_pfn -#undef clAmdBlasSscal -//#define clAmdBlasSscal clAmdBlasSscal_pfn -#undef clAmdBlasSspmv -//#define clAmdBlasSspmv clAmdBlasSspmv_pfn -#undef clAmdBlasSspr -//#define clAmdBlasSspr clAmdBlasSspr_pfn -#undef clAmdBlasSspr2 -//#define clAmdBlasSspr2 clAmdBlasSspr2_pfn -#undef clAmdBlasSswap -//#define clAmdBlasSswap clAmdBlasSswap_pfn -#undef clAmdBlasSsymm -//#define clAmdBlasSsymm clAmdBlasSsymm_pfn -#undef clAmdBlasSsymv -//#define clAmdBlasSsymv clAmdBlasSsymv_pfn -#undef clAmdBlasSsymvEx -//#define clAmdBlasSsymvEx clAmdBlasSsymvEx_pfn -#undef clAmdBlasSsyr -//#define clAmdBlasSsyr clAmdBlasSsyr_pfn -#undef clAmdBlasSsyr2 -//#define clAmdBlasSsyr2 clAmdBlasSsyr2_pfn -#undef clAmdBlasSsyr2k -//#define clAmdBlasSsyr2k clAmdBlasSsyr2k_pfn -#undef clAmdBlasSsyr2kEx -//#define clAmdBlasSsyr2kEx clAmdBlasSsyr2kEx_pfn -#undef clAmdBlasSsyrk -//#define clAmdBlasSsyrk clAmdBlasSsyrk_pfn -#undef clAmdBlasSsyrkEx -//#define clAmdBlasSsyrkEx clAmdBlasSsyrkEx_pfn -#undef clAmdBlasStbmv -//#define clAmdBlasStbmv clAmdBlasStbmv_pfn -#undef clAmdBlasStbsv -//#define clAmdBlasStbsv clAmdBlasStbsv_pfn -#undef clAmdBlasStpmv -//#define clAmdBlasStpmv clAmdBlasStpmv_pfn -#undef clAmdBlasStpsv -//#define clAmdBlasStpsv clAmdBlasStpsv_pfn -#undef clAmdBlasStrmm -//#define clAmdBlasStrmm clAmdBlasStrmm_pfn -#undef clAmdBlasStrmmEx -//#define clAmdBlasStrmmEx clAmdBlasStrmmEx_pfn -#undef clAmdBlasStrmv -//#define clAmdBlasStrmv clAmdBlasStrmv_pfn -#undef clAmdBlasStrsm -//#define clAmdBlasStrsm clAmdBlasStrsm_pfn -#undef clAmdBlasStrsmEx -//#define clAmdBlasStrsmEx clAmdBlasStrsmEx_pfn -#undef clAmdBlasStrsv -//#define clAmdBlasStrsv clAmdBlasStrsv_pfn -#undef clAmdBlasTeardown -#define clAmdBlasTeardown clAmdBlasTeardown_pfn -#undef clAmdBlasZaxpy -//#define clAmdBlasZaxpy clAmdBlasZaxpy_pfn -#undef clAmdBlasZcopy -//#define clAmdBlasZcopy clAmdBlasZcopy_pfn -#undef clAmdBlasZdotc -//#define clAmdBlasZdotc clAmdBlasZdotc_pfn -#undef clAmdBlasZdotu -//#define clAmdBlasZdotu clAmdBlasZdotu_pfn -#undef clAmdBlasZdrot -//#define clAmdBlasZdrot clAmdBlasZdrot_pfn -#undef clAmdBlasZdscal -//#define clAmdBlasZdscal clAmdBlasZdscal_pfn -#undef clAmdBlasZgbmv -//#define clAmdBlasZgbmv clAmdBlasZgbmv_pfn -#undef clAmdBlasZgemm -//#define clAmdBlasZgemm clAmdBlasZgemm_pfn -#undef clAmdBlasZgemmEx -#define clAmdBlasZgemmEx clAmdBlasZgemmEx_pfn -#undef clAmdBlasZgemv -//#define clAmdBlasZgemv clAmdBlasZgemv_pfn -#undef clAmdBlasZgemvEx -//#define clAmdBlasZgemvEx clAmdBlasZgemvEx_pfn -#undef clAmdBlasZgerc -//#define clAmdBlasZgerc clAmdBlasZgerc_pfn -#undef clAmdBlasZgeru -//#define clAmdBlasZgeru clAmdBlasZgeru_pfn -#undef clAmdBlasZhbmv -//#define clAmdBlasZhbmv clAmdBlasZhbmv_pfn -#undef clAmdBlasZhemm -//#define clAmdBlasZhemm clAmdBlasZhemm_pfn -#undef clAmdBlasZhemv -//#define clAmdBlasZhemv clAmdBlasZhemv_pfn -#undef clAmdBlasZher -//#define clAmdBlasZher clAmdBlasZher_pfn -#undef clAmdBlasZher2 -//#define clAmdBlasZher2 clAmdBlasZher2_pfn -#undef clAmdBlasZher2k -//#define clAmdBlasZher2k clAmdBlasZher2k_pfn -#undef clAmdBlasZherk -//#define clAmdBlasZherk clAmdBlasZherk_pfn -#undef clAmdBlasZhpmv -//#define clAmdBlasZhpmv clAmdBlasZhpmv_pfn -#undef clAmdBlasZhpr -//#define clAmdBlasZhpr clAmdBlasZhpr_pfn -#undef clAmdBlasZhpr2 -//#define clAmdBlasZhpr2 clAmdBlasZhpr2_pfn -#undef clAmdBlasZrotg -//#define clAmdBlasZrotg clAmdBlasZrotg_pfn -#undef clAmdBlasZscal -//#define clAmdBlasZscal clAmdBlasZscal_pfn -#undef clAmdBlasZswap -//#define clAmdBlasZswap clAmdBlasZswap_pfn -#undef clAmdBlasZsymm -//#define clAmdBlasZsymm clAmdBlasZsymm_pfn -#undef clAmdBlasZsyr2k -//#define clAmdBlasZsyr2k clAmdBlasZsyr2k_pfn -#undef clAmdBlasZsyr2kEx -//#define clAmdBlasZsyr2kEx clAmdBlasZsyr2kEx_pfn -#undef clAmdBlasZsyrk -//#define clAmdBlasZsyrk clAmdBlasZsyrk_pfn -#undef clAmdBlasZsyrkEx -//#define clAmdBlasZsyrkEx clAmdBlasZsyrkEx_pfn -#undef clAmdBlasZtbmv -//#define clAmdBlasZtbmv clAmdBlasZtbmv_pfn -#undef clAmdBlasZtbsv -//#define clAmdBlasZtbsv clAmdBlasZtbsv_pfn -#undef clAmdBlasZtpmv -//#define clAmdBlasZtpmv clAmdBlasZtpmv_pfn -#undef clAmdBlasZtpsv -//#define clAmdBlasZtpsv clAmdBlasZtpsv_pfn -#undef clAmdBlasZtrmm -//#define clAmdBlasZtrmm clAmdBlasZtrmm_pfn -#undef clAmdBlasZtrmmEx -//#define clAmdBlasZtrmmEx clAmdBlasZtrmmEx_pfn -#undef clAmdBlasZtrmv -//#define clAmdBlasZtrmv clAmdBlasZtrmv_pfn -#undef clAmdBlasZtrsm -//#define clAmdBlasZtrsm clAmdBlasZtrsm_pfn -#undef clAmdBlasZtrsmEx -//#define clAmdBlasZtrsmEx clAmdBlasZtrsmEx_pfn -#undef clAmdBlasZtrsv -//#define clAmdBlasZtrsv clAmdBlasZtrsv_pfn -#undef clAmdBlasiCamax -//#define clAmdBlasiCamax clAmdBlasiCamax_pfn -#undef clAmdBlasiDamax -//#define clAmdBlasiDamax clAmdBlasiDamax_pfn -#undef clAmdBlasiSamax -//#define clAmdBlasiSamax clAmdBlasiSamax_pfn -#undef clAmdBlasiZamax -//#define clAmdBlasiZamax clAmdBlasiZamax_pfn - -// generated by parser_clamdblas.py -//extern CL_RUNTIME_EXPORT cl_ulong (*clAmdBlasAddScratchImage)(cl_context context, size_t width, size_t height, clAmdBlasStatus* status); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCaxpy)(size_t N, cl_float2 alpha, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCcopy)(size_t N, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCdotc)(size_t N, cl_mem dotProduct, size_t offDP, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCdotu)(size_t N, cl_mem dotProduct, size_t offDP, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgbmv)(clAmdBlasOrder order, clAmdBlasTranspose trans, size_t M, size_t N, size_t KL, size_t KU, cl_float2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_float2 beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgemm)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, FloatComplex beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgemmEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, FloatComplex beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgemv)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, FloatComplex alpha, const cl_mem A, size_t lda, const cl_mem x, size_t offx, int incx, FloatComplex beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgemvEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, FloatComplex alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem x, size_t offx, int incx, FloatComplex beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgerc)(clAmdBlasOrder order, size_t M, size_t N, cl_float2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgeru)(clAmdBlasOrder order, size_t M, size_t N, cl_float2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasChbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, size_t K, cl_float2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_float2 beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasChemm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, size_t M, size_t N, cl_float2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_float2 beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasChemv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, FloatComplex alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, FloatComplex beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCher)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCher2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCher2k)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_float beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCherk)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, float alpha, const cl_mem A, size_t offa, size_t lda, float beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasChpmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float2 alpha, const cl_mem AP, size_t offa, const cl_mem X, size_t offx, int incx, cl_float2 beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasChpr)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasChpr2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCrotg)(cl_mem CA, size_t offCA, cl_mem CB, size_t offCB, cl_mem C, size_t offC, cl_mem S, size_t offS, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCscal)(size_t N, cl_float2 alpha, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsrot)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_float C, cl_float S, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsscal)(size_t N, cl_float alpha, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCswap)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsymm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, size_t M, size_t N, cl_float2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_float2 beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsyr2k)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, FloatComplex beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsyr2kEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, FloatComplex beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsyrk)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t lda, FloatComplex beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsyrkEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t offA, size_t lda, FloatComplex beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtbsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtpmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem AP, size_t offa, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtpsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtrmm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, FloatComplex alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtrmmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, FloatComplex alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtrmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtrsm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, FloatComplex alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtrsmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, FloatComplex alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtrsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDasum)(size_t N, cl_mem asum, size_t offAsum, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDaxpy)(size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDcopy)(size_t N, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDdot)(size_t N, cl_mem dotProduct, size_t offDP, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDgbmv)(clAmdBlasOrder order, clAmdBlasTranspose trans, size_t M, size_t N, size_t KL, size_t KU, cl_double alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_double beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDgemm)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, cl_double beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDgemmEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, cl_double beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDgemv)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t lda, const cl_mem x, size_t offx, int incx, cl_double beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDgemvEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem x, size_t offx, int incx, cl_double beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDger)(clAmdBlasOrder order, size_t M, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDnrm2)(size_t N, cl_mem NRM2, size_t offNRM2, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDrot)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_double C, cl_double S, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDrotg)(cl_mem DA, size_t offDA, cl_mem DB, size_t offDB, cl_mem C, size_t offC, cl_mem S, size_t offS, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDrotm)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, const cl_mem DPARAM, size_t offDparam, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDrotmg)(cl_mem DD1, size_t offDD1, cl_mem DD2, size_t offDD2, cl_mem DX1, size_t offDX1, const cl_mem DY1, size_t offDY1, cl_mem DPARAM, size_t offDparam, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_double beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDscal)(size_t N, cl_double alpha, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDspmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem AP, size_t offa, const cl_mem X, size_t offx, int incx, cl_double beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDspr)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDspr2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDswap)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsymm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_double beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsymv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem A, size_t lda, const cl_mem x, size_t offx, int incx, cl_double beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsymvEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem x, size_t offx, int incx, cl_double beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsyr)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsyr2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsyr2k)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, cl_double beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsyr2kEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, cl_double beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsyrk)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t lda, cl_double beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsyrkEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t offA, size_t lda, cl_double beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtbsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtpmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem AP, size_t offa, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtpsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtrmm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtrmmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtrmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtrsm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtrsmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtrsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDzasum)(size_t N, cl_mem asum, size_t offAsum, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDznrm2)(size_t N, cl_mem NRM2, size_t offNRM2, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasGetVersion)(cl_uint* major, cl_uint* minor, cl_uint* patch); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasRemoveScratchImage)(cl_ulong imageID); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSasum)(size_t N, cl_mem asum, size_t offAsum, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSaxpy)(size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasScasum)(size_t N, cl_mem asum, size_t offAsum, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasScnrm2)(size_t N, cl_mem NRM2, size_t offNRM2, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasScopy)(size_t N, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSdot)(size_t N, cl_mem dotProduct, size_t offDP, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSetup)(); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSgbmv)(clAmdBlasOrder order, clAmdBlasTranspose trans, size_t M, size_t N, size_t KL, size_t KU, cl_float alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_float beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSgemm)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, cl_float beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSgemmEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, cl_float beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSgemv)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t lda, const cl_mem x, size_t offx, int incx, cl_float beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSgemvEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem x, size_t offx, int incx, cl_float beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSger)(clAmdBlasOrder order, size_t M, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSnrm2)(size_t N, cl_mem NRM2, size_t offNRM2, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSrot)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_float C, cl_float S, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSrotg)(cl_mem SA, size_t offSA, cl_mem SB, size_t offSB, cl_mem C, size_t offC, cl_mem S, size_t offS, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSrotm)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, const cl_mem SPARAM, size_t offSparam, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSrotmg)(cl_mem SD1, size_t offSD1, cl_mem SD2, size_t offSD2, cl_mem SX1, size_t offSX1, const cl_mem SY1, size_t offSY1, cl_mem SPARAM, size_t offSparam, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_float beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSscal)(size_t N, cl_float alpha, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSspmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem AP, size_t offa, const cl_mem X, size_t offx, int incx, cl_float beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSspr)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSspr2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSswap)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsymm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_float beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsymv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem A, size_t lda, const cl_mem x, size_t offx, int incx, cl_float beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsymvEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem x, size_t offx, int incx, cl_float beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsyr)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsyr2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsyr2k)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, cl_float beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsyr2kEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, cl_float beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsyrk)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t lda, cl_float beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsyrkEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t offA, size_t lda, cl_float beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStbsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStpmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem AP, size_t offa, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStpsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStrmm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStrmmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStrmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStrsm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStrsmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStrsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -extern CL_RUNTIME_EXPORT void (*clAmdBlasTeardown)(); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZaxpy)(size_t N, cl_double2 alpha, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZcopy)(size_t N, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZdotc)(size_t N, cl_mem dotProduct, size_t offDP, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZdotu)(size_t N, cl_mem dotProduct, size_t offDP, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZdrot)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_double C, cl_double S, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZdscal)(size_t N, cl_double alpha, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgbmv)(clAmdBlasOrder order, clAmdBlasTranspose trans, size_t M, size_t N, size_t KL, size_t KU, cl_double2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_double2 beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgemm)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, DoubleComplex beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgemmEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, DoubleComplex beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgemv)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, DoubleComplex alpha, const cl_mem A, size_t lda, const cl_mem x, size_t offx, int incx, DoubleComplex beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgemvEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, DoubleComplex alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem x, size_t offx, int incx, DoubleComplex beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgerc)(clAmdBlasOrder order, size_t M, size_t N, cl_double2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgeru)(clAmdBlasOrder order, size_t M, size_t N, cl_double2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZhbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, size_t K, cl_double2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_double2 beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZhemm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, size_t M, size_t N, cl_double2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_double2 beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZhemv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, DoubleComplex alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, DoubleComplex beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZher)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZher2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZher2k)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_double beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZherk)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, double alpha, const cl_mem A, size_t offa, size_t lda, double beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZhpmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double2 alpha, const cl_mem AP, size_t offa, const cl_mem X, size_t offx, int incx, cl_double2 beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZhpr)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZhpr2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZrotg)(cl_mem CA, size_t offCA, cl_mem CB, size_t offCB, cl_mem C, size_t offC, cl_mem S, size_t offS, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZscal)(size_t N, cl_double2 alpha, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZswap)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZsymm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, size_t M, size_t N, cl_double2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_double2 beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZsyr2k)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, DoubleComplex beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZsyr2kEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, DoubleComplex beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZsyrk)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t lda, DoubleComplex beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZsyrkEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t offA, size_t lda, DoubleComplex beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtbsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtpmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem AP, size_t offa, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtpsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtrmm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, DoubleComplex alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtrmmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, DoubleComplex alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtrmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtrsm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, DoubleComplex alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtrsmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, DoubleComplex alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtrsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasiCamax)(size_t N, cl_mem iMax, size_t offiMax, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasiDamax)(size_t N, cl_mem iMax, size_t offiMax, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasiSamax)(size_t N, cl_mem iMax, size_t offiMax, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); -//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasiZamax)(size_t N, cl_mem iMax, size_t offiMax, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events); diff --git a/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_clamdfft.hpp b/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_clamdfft.hpp deleted file mode 100644 index 1457d7e..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_clamdfft.hpp +++ /dev/null @@ -1,142 +0,0 @@ -// -// AUTOGENERATED, DO NOT EDIT -// -#ifndef OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP -#error "Invalid usage" -#endif - -// generated by parser_clamdfft.py -#define clAmdFftBakePlan clAmdFftBakePlan_ -#define clAmdFftCopyPlan clAmdFftCopyPlan_ -#define clAmdFftCreateDefaultPlan clAmdFftCreateDefaultPlan_ -#define clAmdFftDestroyPlan clAmdFftDestroyPlan_ -#define clAmdFftEnqueueTransform clAmdFftEnqueueTransform_ -#define clAmdFftGetLayout clAmdFftGetLayout_ -#define clAmdFftGetPlanBatchSize clAmdFftGetPlanBatchSize_ -#define clAmdFftGetPlanContext clAmdFftGetPlanContext_ -#define clAmdFftGetPlanDim clAmdFftGetPlanDim_ -#define clAmdFftGetPlanDistance clAmdFftGetPlanDistance_ -#define clAmdFftGetPlanInStride clAmdFftGetPlanInStride_ -#define clAmdFftGetPlanLength clAmdFftGetPlanLength_ -#define clAmdFftGetPlanOutStride clAmdFftGetPlanOutStride_ -#define clAmdFftGetPlanPrecision clAmdFftGetPlanPrecision_ -#define clAmdFftGetPlanScale clAmdFftGetPlanScale_ -#define clAmdFftGetPlanTransposeResult clAmdFftGetPlanTransposeResult_ -#define clAmdFftGetResultLocation clAmdFftGetResultLocation_ -#define clAmdFftGetTmpBufSize clAmdFftGetTmpBufSize_ -#define clAmdFftGetVersion clAmdFftGetVersion_ -#define clAmdFftSetLayout clAmdFftSetLayout_ -#define clAmdFftSetPlanBatchSize clAmdFftSetPlanBatchSize_ -#define clAmdFftSetPlanDim clAmdFftSetPlanDim_ -#define clAmdFftSetPlanDistance clAmdFftSetPlanDistance_ -#define clAmdFftSetPlanInStride clAmdFftSetPlanInStride_ -#define clAmdFftSetPlanLength clAmdFftSetPlanLength_ -#define clAmdFftSetPlanOutStride clAmdFftSetPlanOutStride_ -#define clAmdFftSetPlanPrecision clAmdFftSetPlanPrecision_ -#define clAmdFftSetPlanScale clAmdFftSetPlanScale_ -#define clAmdFftSetPlanTransposeResult clAmdFftSetPlanTransposeResult_ -#define clAmdFftSetResultLocation clAmdFftSetResultLocation_ -#define clAmdFftSetup clAmdFftSetup_ -#define clAmdFftTeardown clAmdFftTeardown_ - -#include - -// generated by parser_clamdfft.py -#undef clAmdFftBakePlan -#define clAmdFftBakePlan clAmdFftBakePlan_pfn -#undef clAmdFftCopyPlan -//#define clAmdFftCopyPlan clAmdFftCopyPlan_pfn -#undef clAmdFftCreateDefaultPlan -#define clAmdFftCreateDefaultPlan clAmdFftCreateDefaultPlan_pfn -#undef clAmdFftDestroyPlan -#define clAmdFftDestroyPlan clAmdFftDestroyPlan_pfn -#undef clAmdFftEnqueueTransform -#define clAmdFftEnqueueTransform clAmdFftEnqueueTransform_pfn -#undef clAmdFftGetLayout -//#define clAmdFftGetLayout clAmdFftGetLayout_pfn -#undef clAmdFftGetPlanBatchSize -//#define clAmdFftGetPlanBatchSize clAmdFftGetPlanBatchSize_pfn -#undef clAmdFftGetPlanContext -//#define clAmdFftGetPlanContext clAmdFftGetPlanContext_pfn -#undef clAmdFftGetPlanDim -//#define clAmdFftGetPlanDim clAmdFftGetPlanDim_pfn -#undef clAmdFftGetPlanDistance -//#define clAmdFftGetPlanDistance clAmdFftGetPlanDistance_pfn -#undef clAmdFftGetPlanInStride -//#define clAmdFftGetPlanInStride clAmdFftGetPlanInStride_pfn -#undef clAmdFftGetPlanLength -//#define clAmdFftGetPlanLength clAmdFftGetPlanLength_pfn -#undef clAmdFftGetPlanOutStride -//#define clAmdFftGetPlanOutStride clAmdFftGetPlanOutStride_pfn -#undef clAmdFftGetPlanPrecision -//#define clAmdFftGetPlanPrecision clAmdFftGetPlanPrecision_pfn -#undef clAmdFftGetPlanScale -//#define clAmdFftGetPlanScale clAmdFftGetPlanScale_pfn -#undef clAmdFftGetPlanTransposeResult -//#define clAmdFftGetPlanTransposeResult clAmdFftGetPlanTransposeResult_pfn -#undef clAmdFftGetResultLocation -//#define clAmdFftGetResultLocation clAmdFftGetResultLocation_pfn -#undef clAmdFftGetTmpBufSize -#define clAmdFftGetTmpBufSize clAmdFftGetTmpBufSize_pfn -#undef clAmdFftGetVersion -#define clAmdFftGetVersion clAmdFftGetVersion_pfn -#undef clAmdFftSetLayout -#define clAmdFftSetLayout clAmdFftSetLayout_pfn -#undef clAmdFftSetPlanBatchSize -#define clAmdFftSetPlanBatchSize clAmdFftSetPlanBatchSize_pfn -#undef clAmdFftSetPlanDim -//#define clAmdFftSetPlanDim clAmdFftSetPlanDim_pfn -#undef clAmdFftSetPlanDistance -#define clAmdFftSetPlanDistance clAmdFftSetPlanDistance_pfn -#undef clAmdFftSetPlanInStride -#define clAmdFftSetPlanInStride clAmdFftSetPlanInStride_pfn -#undef clAmdFftSetPlanLength -//#define clAmdFftSetPlanLength clAmdFftSetPlanLength_pfn -#undef clAmdFftSetPlanOutStride -#define clAmdFftSetPlanOutStride clAmdFftSetPlanOutStride_pfn -#undef clAmdFftSetPlanPrecision -#define clAmdFftSetPlanPrecision clAmdFftSetPlanPrecision_pfn -#undef clAmdFftSetPlanScale -#define clAmdFftSetPlanScale clAmdFftSetPlanScale_pfn -#undef clAmdFftSetPlanTransposeResult -//#define clAmdFftSetPlanTransposeResult clAmdFftSetPlanTransposeResult_pfn -#undef clAmdFftSetResultLocation -#define clAmdFftSetResultLocation clAmdFftSetResultLocation_pfn -#undef clAmdFftSetup -#define clAmdFftSetup clAmdFftSetup_pfn -#undef clAmdFftTeardown -#define clAmdFftTeardown clAmdFftTeardown_pfn - -// generated by parser_clamdfft.py -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftBakePlan)(clAmdFftPlanHandle plHandle, cl_uint numQueues, cl_command_queue* commQueueFFT, void (CL_CALLBACK* pfn_notify) (clAmdFftPlanHandle plHandle, void* user_data), void* user_data); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftCopyPlan)(clAmdFftPlanHandle* out_plHandle, cl_context new_context, clAmdFftPlanHandle in_plHandle); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftCreateDefaultPlan)(clAmdFftPlanHandle* plHandle, cl_context context, const clAmdFftDim dim, const size_t* clLengths); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftDestroyPlan)(clAmdFftPlanHandle* plHandle); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftEnqueueTransform)(clAmdFftPlanHandle plHandle, clAmdFftDirection dir, cl_uint numQueuesAndEvents, cl_command_queue* commQueues, cl_uint numWaitEvents, const cl_event* waitEvents, cl_event* outEvents, cl_mem* inputBuffers, cl_mem* outputBuffers, cl_mem tmpBuffer); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetLayout)(const clAmdFftPlanHandle plHandle, clAmdFftLayout* iLayout, clAmdFftLayout* oLayout); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanBatchSize)(const clAmdFftPlanHandle plHandle, size_t* batchSize); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanContext)(const clAmdFftPlanHandle plHandle, cl_context* context); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanDim)(const clAmdFftPlanHandle plHandle, clAmdFftDim* dim, cl_uint* size); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanDistance)(const clAmdFftPlanHandle plHandle, size_t* iDist, size_t* oDist); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanInStride)(const clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clStrides); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanLength)(const clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clLengths); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanOutStride)(const clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clStrides); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanPrecision)(const clAmdFftPlanHandle plHandle, clAmdFftPrecision* precision); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanScale)(const clAmdFftPlanHandle plHandle, clAmdFftDirection dir, cl_float* scale); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanTransposeResult)(const clAmdFftPlanHandle plHandle, clAmdFftResultTransposed* transposed); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetResultLocation)(const clAmdFftPlanHandle plHandle, clAmdFftResultLocation* placeness); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetTmpBufSize)(const clAmdFftPlanHandle plHandle, size_t* buffersize); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetVersion)(cl_uint* major, cl_uint* minor, cl_uint* patch); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetLayout)(clAmdFftPlanHandle plHandle, clAmdFftLayout iLayout, clAmdFftLayout oLayout); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanBatchSize)(clAmdFftPlanHandle plHandle, size_t batchSize); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanDim)(clAmdFftPlanHandle plHandle, const clAmdFftDim dim); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanDistance)(clAmdFftPlanHandle plHandle, size_t iDist, size_t oDist); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanInStride)(clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clStrides); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanLength)(clAmdFftPlanHandle plHandle, const clAmdFftDim dim, const size_t* clLengths); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanOutStride)(clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clStrides); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanPrecision)(clAmdFftPlanHandle plHandle, clAmdFftPrecision precision); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanScale)(clAmdFftPlanHandle plHandle, clAmdFftDirection dir, cl_float scale); -//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanTransposeResult)(clAmdFftPlanHandle plHandle, clAmdFftResultTransposed transposed); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetResultLocation)(clAmdFftPlanHandle plHandle, clAmdFftResultLocation placeness); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetup)(const clAmdFftSetupData* setupData); -extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftTeardown)(); diff --git a/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp b/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp deleted file mode 100644 index 28618a1..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp +++ /dev/null @@ -1,371 +0,0 @@ -// -// AUTOGENERATED, DO NOT EDIT -// -#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP -#error "Invalid usage" -#endif - -// generated by parser_cl.py -#define clBuildProgram clBuildProgram_ -#define clCompileProgram clCompileProgram_ -#define clCreateBuffer clCreateBuffer_ -#define clCreateCommandQueue clCreateCommandQueue_ -#define clCreateContext clCreateContext_ -#define clCreateContextFromType clCreateContextFromType_ -#define clCreateImage clCreateImage_ -#define clCreateImage2D clCreateImage2D_ -#define clCreateImage3D clCreateImage3D_ -#define clCreateKernel clCreateKernel_ -#define clCreateKernelsInProgram clCreateKernelsInProgram_ -#define clCreateProgramWithBinary clCreateProgramWithBinary_ -#define clCreateProgramWithBuiltInKernels clCreateProgramWithBuiltInKernels_ -#define clCreateProgramWithSource clCreateProgramWithSource_ -#define clCreateSampler clCreateSampler_ -#define clCreateSubBuffer clCreateSubBuffer_ -#define clCreateSubDevices clCreateSubDevices_ -#define clCreateUserEvent clCreateUserEvent_ -#define clEnqueueBarrier clEnqueueBarrier_ -#define clEnqueueBarrierWithWaitList clEnqueueBarrierWithWaitList_ -#define clEnqueueCopyBuffer clEnqueueCopyBuffer_ -#define clEnqueueCopyBufferRect clEnqueueCopyBufferRect_ -#define clEnqueueCopyBufferToImage clEnqueueCopyBufferToImage_ -#define clEnqueueCopyImage clEnqueueCopyImage_ -#define clEnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer_ -#define clEnqueueFillBuffer clEnqueueFillBuffer_ -#define clEnqueueFillImage clEnqueueFillImage_ -#define clEnqueueMapBuffer clEnqueueMapBuffer_ -#define clEnqueueMapImage clEnqueueMapImage_ -#define clEnqueueMarker clEnqueueMarker_ -#define clEnqueueMarkerWithWaitList clEnqueueMarkerWithWaitList_ -#define clEnqueueMigrateMemObjects clEnqueueMigrateMemObjects_ -#define clEnqueueNDRangeKernel clEnqueueNDRangeKernel_ -#define clEnqueueNativeKernel clEnqueueNativeKernel_ -#define clEnqueueReadBuffer clEnqueueReadBuffer_ -#define clEnqueueReadBufferRect clEnqueueReadBufferRect_ -#define clEnqueueReadImage clEnqueueReadImage_ -#define clEnqueueTask clEnqueueTask_ -#define clEnqueueUnmapMemObject clEnqueueUnmapMemObject_ -#define clEnqueueWaitForEvents clEnqueueWaitForEvents_ -#define clEnqueueWriteBuffer clEnqueueWriteBuffer_ -#define clEnqueueWriteBufferRect clEnqueueWriteBufferRect_ -#define clEnqueueWriteImage clEnqueueWriteImage_ -#define clFinish clFinish_ -#define clFlush clFlush_ -#define clGetCommandQueueInfo clGetCommandQueueInfo_ -#define clGetContextInfo clGetContextInfo_ -#define clGetDeviceIDs clGetDeviceIDs_ -#define clGetDeviceInfo clGetDeviceInfo_ -#define clGetEventInfo clGetEventInfo_ -#define clGetEventProfilingInfo clGetEventProfilingInfo_ -#define clGetExtensionFunctionAddress clGetExtensionFunctionAddress_ -#define clGetExtensionFunctionAddressForPlatform clGetExtensionFunctionAddressForPlatform_ -#define clGetImageInfo clGetImageInfo_ -#define clGetKernelArgInfo clGetKernelArgInfo_ -#define clGetKernelInfo clGetKernelInfo_ -#define clGetKernelWorkGroupInfo clGetKernelWorkGroupInfo_ -#define clGetMemObjectInfo clGetMemObjectInfo_ -#define clGetPlatformIDs clGetPlatformIDs_ -#define clGetPlatformInfo clGetPlatformInfo_ -#define clGetProgramBuildInfo clGetProgramBuildInfo_ -#define clGetProgramInfo clGetProgramInfo_ -#define clGetSamplerInfo clGetSamplerInfo_ -#define clGetSupportedImageFormats clGetSupportedImageFormats_ -#define clLinkProgram clLinkProgram_ -#define clReleaseCommandQueue clReleaseCommandQueue_ -#define clReleaseContext clReleaseContext_ -#define clReleaseDevice clReleaseDevice_ -#define clReleaseEvent clReleaseEvent_ -#define clReleaseKernel clReleaseKernel_ -#define clReleaseMemObject clReleaseMemObject_ -#define clReleaseProgram clReleaseProgram_ -#define clReleaseSampler clReleaseSampler_ -#define clRetainCommandQueue clRetainCommandQueue_ -#define clRetainContext clRetainContext_ -#define clRetainDevice clRetainDevice_ -#define clRetainEvent clRetainEvent_ -#define clRetainKernel clRetainKernel_ -#define clRetainMemObject clRetainMemObject_ -#define clRetainProgram clRetainProgram_ -#define clRetainSampler clRetainSampler_ -#define clSetEventCallback clSetEventCallback_ -#define clSetKernelArg clSetKernelArg_ -#define clSetMemObjectDestructorCallback clSetMemObjectDestructorCallback_ -#define clSetUserEventStatus clSetUserEventStatus_ -#define clUnloadCompiler clUnloadCompiler_ -#define clUnloadPlatformCompiler clUnloadPlatformCompiler_ -#define clWaitForEvents clWaitForEvents_ - -#if defined __APPLE__ -#define CL_SILENCE_DEPRECATION -#include -#else -#include -#endif - -// generated by parser_cl.py -#undef clBuildProgram -#define clBuildProgram clBuildProgram_pfn -#undef clCompileProgram -#define clCompileProgram clCompileProgram_pfn -#undef clCreateBuffer -#define clCreateBuffer clCreateBuffer_pfn -#undef clCreateCommandQueue -#define clCreateCommandQueue clCreateCommandQueue_pfn -#undef clCreateContext -#define clCreateContext clCreateContext_pfn -#undef clCreateContextFromType -#define clCreateContextFromType clCreateContextFromType_pfn -#undef clCreateImage -#define clCreateImage clCreateImage_pfn -#undef clCreateImage2D -#define clCreateImage2D clCreateImage2D_pfn -#undef clCreateImage3D -#define clCreateImage3D clCreateImage3D_pfn -#undef clCreateKernel -#define clCreateKernel clCreateKernel_pfn -#undef clCreateKernelsInProgram -#define clCreateKernelsInProgram clCreateKernelsInProgram_pfn -#undef clCreateProgramWithBinary -#define clCreateProgramWithBinary clCreateProgramWithBinary_pfn -#undef clCreateProgramWithBuiltInKernels -#define clCreateProgramWithBuiltInKernels clCreateProgramWithBuiltInKernels_pfn -#undef clCreateProgramWithSource -#define clCreateProgramWithSource clCreateProgramWithSource_pfn -#undef clCreateSampler -#define clCreateSampler clCreateSampler_pfn -#undef clCreateSubBuffer -#define clCreateSubBuffer clCreateSubBuffer_pfn -#undef clCreateSubDevices -#define clCreateSubDevices clCreateSubDevices_pfn -#undef clCreateUserEvent -#define clCreateUserEvent clCreateUserEvent_pfn -#undef clEnqueueBarrier -#define clEnqueueBarrier clEnqueueBarrier_pfn -#undef clEnqueueBarrierWithWaitList -#define clEnqueueBarrierWithWaitList clEnqueueBarrierWithWaitList_pfn -#undef clEnqueueCopyBuffer -#define clEnqueueCopyBuffer clEnqueueCopyBuffer_pfn -#undef clEnqueueCopyBufferRect -#define clEnqueueCopyBufferRect clEnqueueCopyBufferRect_pfn -#undef clEnqueueCopyBufferToImage -#define clEnqueueCopyBufferToImage clEnqueueCopyBufferToImage_pfn -#undef clEnqueueCopyImage -#define clEnqueueCopyImage clEnqueueCopyImage_pfn -#undef clEnqueueCopyImageToBuffer -#define clEnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer_pfn -#undef clEnqueueFillBuffer -#define clEnqueueFillBuffer clEnqueueFillBuffer_pfn -#undef clEnqueueFillImage -#define clEnqueueFillImage clEnqueueFillImage_pfn -#undef clEnqueueMapBuffer -#define clEnqueueMapBuffer clEnqueueMapBuffer_pfn -#undef clEnqueueMapImage -#define clEnqueueMapImage clEnqueueMapImage_pfn -#undef clEnqueueMarker -#define clEnqueueMarker clEnqueueMarker_pfn -#undef clEnqueueMarkerWithWaitList -#define clEnqueueMarkerWithWaitList clEnqueueMarkerWithWaitList_pfn -#undef clEnqueueMigrateMemObjects -#define clEnqueueMigrateMemObjects clEnqueueMigrateMemObjects_pfn -#undef clEnqueueNDRangeKernel -#define clEnqueueNDRangeKernel clEnqueueNDRangeKernel_pfn -#undef clEnqueueNativeKernel -#define clEnqueueNativeKernel clEnqueueNativeKernel_pfn -#undef clEnqueueReadBuffer -#define clEnqueueReadBuffer clEnqueueReadBuffer_pfn -#undef clEnqueueReadBufferRect -#define clEnqueueReadBufferRect clEnqueueReadBufferRect_pfn -#undef clEnqueueReadImage -#define clEnqueueReadImage clEnqueueReadImage_pfn -#undef clEnqueueTask -#define clEnqueueTask clEnqueueTask_pfn -#undef clEnqueueUnmapMemObject -#define clEnqueueUnmapMemObject clEnqueueUnmapMemObject_pfn -#undef clEnqueueWaitForEvents -#define clEnqueueWaitForEvents clEnqueueWaitForEvents_pfn -#undef clEnqueueWriteBuffer -#define clEnqueueWriteBuffer clEnqueueWriteBuffer_pfn -#undef clEnqueueWriteBufferRect -#define clEnqueueWriteBufferRect clEnqueueWriteBufferRect_pfn -#undef clEnqueueWriteImage -#define clEnqueueWriteImage clEnqueueWriteImage_pfn -#undef clFinish -#define clFinish clFinish_pfn -#undef clFlush -#define clFlush clFlush_pfn -#undef clGetCommandQueueInfo -#define clGetCommandQueueInfo clGetCommandQueueInfo_pfn -#undef clGetContextInfo -#define clGetContextInfo clGetContextInfo_pfn -#undef clGetDeviceIDs -#define clGetDeviceIDs clGetDeviceIDs_pfn -#undef clGetDeviceInfo -#define clGetDeviceInfo clGetDeviceInfo_pfn -#undef clGetEventInfo -#define clGetEventInfo clGetEventInfo_pfn -#undef clGetEventProfilingInfo -#define clGetEventProfilingInfo clGetEventProfilingInfo_pfn -#undef clGetExtensionFunctionAddress -#define clGetExtensionFunctionAddress clGetExtensionFunctionAddress_pfn -#undef clGetExtensionFunctionAddressForPlatform -#define clGetExtensionFunctionAddressForPlatform clGetExtensionFunctionAddressForPlatform_pfn -#undef clGetImageInfo -#define clGetImageInfo clGetImageInfo_pfn -#undef clGetKernelArgInfo -#define clGetKernelArgInfo clGetKernelArgInfo_pfn -#undef clGetKernelInfo -#define clGetKernelInfo clGetKernelInfo_pfn -#undef clGetKernelWorkGroupInfo -#define clGetKernelWorkGroupInfo clGetKernelWorkGroupInfo_pfn -#undef clGetMemObjectInfo -#define clGetMemObjectInfo clGetMemObjectInfo_pfn -#undef clGetPlatformIDs -#define clGetPlatformIDs clGetPlatformIDs_pfn -#undef clGetPlatformInfo -#define clGetPlatformInfo clGetPlatformInfo_pfn -#undef clGetProgramBuildInfo -#define clGetProgramBuildInfo clGetProgramBuildInfo_pfn -#undef clGetProgramInfo -#define clGetProgramInfo clGetProgramInfo_pfn -#undef clGetSamplerInfo -#define clGetSamplerInfo clGetSamplerInfo_pfn -#undef clGetSupportedImageFormats -#define clGetSupportedImageFormats clGetSupportedImageFormats_pfn -#undef clLinkProgram -#define clLinkProgram clLinkProgram_pfn -#undef clReleaseCommandQueue -#define clReleaseCommandQueue clReleaseCommandQueue_pfn -#undef clReleaseContext -#define clReleaseContext clReleaseContext_pfn -#undef clReleaseDevice -#define clReleaseDevice clReleaseDevice_pfn -#undef clReleaseEvent -#define clReleaseEvent clReleaseEvent_pfn -#undef clReleaseKernel -#define clReleaseKernel clReleaseKernel_pfn -#undef clReleaseMemObject -#define clReleaseMemObject clReleaseMemObject_pfn -#undef clReleaseProgram -#define clReleaseProgram clReleaseProgram_pfn -#undef clReleaseSampler -#define clReleaseSampler clReleaseSampler_pfn -#undef clRetainCommandQueue -#define clRetainCommandQueue clRetainCommandQueue_pfn -#undef clRetainContext -#define clRetainContext clRetainContext_pfn -#undef clRetainDevice -#define clRetainDevice clRetainDevice_pfn -#undef clRetainEvent -#define clRetainEvent clRetainEvent_pfn -#undef clRetainKernel -#define clRetainKernel clRetainKernel_pfn -#undef clRetainMemObject -#define clRetainMemObject clRetainMemObject_pfn -#undef clRetainProgram -#define clRetainProgram clRetainProgram_pfn -#undef clRetainSampler -#define clRetainSampler clRetainSampler_pfn -#undef clSetEventCallback -#define clSetEventCallback clSetEventCallback_pfn -#undef clSetKernelArg -#define clSetKernelArg clSetKernelArg_pfn -#undef clSetMemObjectDestructorCallback -#define clSetMemObjectDestructorCallback clSetMemObjectDestructorCallback_pfn -#undef clSetUserEventStatus -#define clSetUserEventStatus clSetUserEventStatus_pfn -#undef clUnloadCompiler -#define clUnloadCompiler clUnloadCompiler_pfn -#undef clUnloadPlatformCompiler -#define clUnloadPlatformCompiler clUnloadPlatformCompiler_pfn -#undef clWaitForEvents -#define clWaitForEvents clWaitForEvents_pfn - -// generated by parser_cl.py -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clBuildProgram)(cl_program, cl_uint, const cl_device_id*, const char*, void (CL_CALLBACK*) (cl_program, void*), void*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clCompileProgram)(cl_program, cl_uint, const cl_device_id*, const char*, cl_uint, const cl_program*, const char**, void (CL_CALLBACK*) (cl_program, void*), void*); -extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateBuffer)(cl_context, cl_mem_flags, size_t, void*, cl_int*); -extern CL_RUNTIME_EXPORT cl_command_queue (CL_API_CALL*clCreateCommandQueue)(cl_context, cl_device_id, cl_command_queue_properties, cl_int*); -extern CL_RUNTIME_EXPORT cl_context (CL_API_CALL*clCreateContext)(const cl_context_properties*, cl_uint, const cl_device_id*, void (CL_CALLBACK*) (const char*, const void*, size_t, void*), void*, cl_int*); -extern CL_RUNTIME_EXPORT cl_context (CL_API_CALL*clCreateContextFromType)(const cl_context_properties*, cl_device_type, void (CL_CALLBACK*) (const char*, const void*, size_t, void*), void*, cl_int*); -extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateImage)(cl_context, cl_mem_flags, const cl_image_format*, const cl_image_desc*, void*, cl_int*); -extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateImage2D)(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, void*, cl_int*); -extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateImage3D)(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, size_t, size_t, void*, cl_int*); -extern CL_RUNTIME_EXPORT cl_kernel (CL_API_CALL*clCreateKernel)(cl_program, const char*, cl_int*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clCreateKernelsInProgram)(cl_program, cl_uint, cl_kernel*, cl_uint*); -extern CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clCreateProgramWithBinary)(cl_context, cl_uint, const cl_device_id*, const size_t*, const unsigned char**, cl_int*, cl_int*); -extern CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clCreateProgramWithBuiltInKernels)(cl_context, cl_uint, const cl_device_id*, const char*, cl_int*); -extern CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clCreateProgramWithSource)(cl_context, cl_uint, const char**, const size_t*, cl_int*); -extern CL_RUNTIME_EXPORT cl_sampler (CL_API_CALL*clCreateSampler)(cl_context, cl_bool, cl_addressing_mode, cl_filter_mode, cl_int*); -extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateSubBuffer)(cl_mem, cl_mem_flags, cl_buffer_create_type, const void*, cl_int*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clCreateSubDevices)(cl_device_id, const cl_device_partition_property*, cl_uint, cl_device_id*, cl_uint*); -extern CL_RUNTIME_EXPORT cl_event (CL_API_CALL*clCreateUserEvent)(cl_context, cl_int*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueBarrier)(cl_command_queue); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueBarrierWithWaitList)(cl_command_queue, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyBuffer)(cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyBufferRect)(cl_command_queue, cl_mem, cl_mem, const size_t*, const size_t*, const size_t*, size_t, size_t, size_t, size_t, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyBufferToImage)(cl_command_queue, cl_mem, cl_mem, size_t, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyImage)(cl_command_queue, cl_mem, cl_mem, const size_t*, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyImageToBuffer)(cl_command_queue, cl_mem, cl_mem, const size_t*, const size_t*, size_t, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueFillBuffer)(cl_command_queue, cl_mem, const void*, size_t, size_t, size_t, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueFillImage)(cl_command_queue, cl_mem, const void*, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT void* (CL_API_CALL*clEnqueueMapBuffer)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, const cl_event*, cl_event*, cl_int*); -extern CL_RUNTIME_EXPORT void* (CL_API_CALL*clEnqueueMapImage)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, const size_t*, const size_t*, size_t*, size_t*, cl_uint, const cl_event*, cl_event*, cl_int*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueMarker)(cl_command_queue, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueMarkerWithWaitList)(cl_command_queue, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueMigrateMemObjects)(cl_command_queue, cl_uint, const cl_mem*, cl_mem_migration_flags, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueNDRangeKernel)(cl_command_queue, cl_kernel, cl_uint, const size_t*, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueNativeKernel)(cl_command_queue, void (CL_CALLBACK*) (void*), void*, size_t, cl_uint, const cl_mem*, const void**, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReadBuffer)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, void*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReadBufferRect)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, const size_t*, size_t, size_t, size_t, size_t, void*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReadImage)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, size_t, size_t, void*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueTask)(cl_command_queue, cl_kernel, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueUnmapMemObject)(cl_command_queue, cl_mem, void*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWaitForEvents)(cl_command_queue, cl_uint, const cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWriteBuffer)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWriteBufferRect)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, const size_t*, size_t, size_t, size_t, size_t, const void*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWriteImage)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, size_t, size_t, const void*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clFinish)(cl_command_queue); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clFlush)(cl_command_queue); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetCommandQueueInfo)(cl_command_queue, cl_command_queue_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetContextInfo)(cl_context, cl_context_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetDeviceIDs)(cl_platform_id, cl_device_type, cl_uint, cl_device_id*, cl_uint*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetDeviceInfo)(cl_device_id, cl_device_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetEventInfo)(cl_event, cl_event_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetEventProfilingInfo)(cl_event, cl_profiling_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT void* (CL_API_CALL*clGetExtensionFunctionAddress)(const char*); -extern CL_RUNTIME_EXPORT void* (CL_API_CALL*clGetExtensionFunctionAddressForPlatform)(cl_platform_id, const char*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetImageInfo)(cl_mem, cl_image_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetKernelArgInfo)(cl_kernel, cl_uint, cl_kernel_arg_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetKernelInfo)(cl_kernel, cl_kernel_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetKernelWorkGroupInfo)(cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetMemObjectInfo)(cl_mem, cl_mem_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetPlatformIDs)(cl_uint, cl_platform_id*, cl_uint*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetPlatformInfo)(cl_platform_id, cl_platform_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetProgramBuildInfo)(cl_program, cl_device_id, cl_program_build_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetProgramInfo)(cl_program, cl_program_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetSamplerInfo)(cl_sampler, cl_sampler_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetSupportedImageFormats)(cl_context, cl_mem_flags, cl_mem_object_type, cl_uint, cl_image_format*, cl_uint*); -extern CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clLinkProgram)(cl_context, cl_uint, const cl_device_id*, const char*, cl_uint, const cl_program*, void (CL_CALLBACK*) (cl_program, void*), void*, cl_int*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseCommandQueue)(cl_command_queue); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseContext)(cl_context); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseDevice)(cl_device_id); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseEvent)(cl_event); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseKernel)(cl_kernel); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseMemObject)(cl_mem); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseProgram)(cl_program); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseSampler)(cl_sampler); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainCommandQueue)(cl_command_queue); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainContext)(cl_context); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainDevice)(cl_device_id); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainEvent)(cl_event); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainKernel)(cl_kernel); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainMemObject)(cl_mem); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainProgram)(cl_program); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainSampler)(cl_sampler); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetEventCallback)(cl_event, cl_int, void (CL_CALLBACK*) (cl_event, cl_int, void*), void*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetKernelArg)(cl_kernel, cl_uint, size_t, const void*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetMemObjectDestructorCallback)(cl_mem, void (CL_CALLBACK*) (cl_mem, void*), void*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetUserEventStatus)(cl_event, cl_int); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clUnloadCompiler)(); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clUnloadPlatformCompiler)(cl_platform_id); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clWaitForEvents)(cl_uint, const cl_event*); diff --git a/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_core_wrappers.hpp b/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_core_wrappers.hpp deleted file mode 100644 index 216b22b..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_core_wrappers.hpp +++ /dev/null @@ -1,272 +0,0 @@ -// -// AUTOGENERATED, DO NOT EDIT -// -#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP -#error "Invalid usage" -#endif - -// generated by parser_cl.py -#undef clBuildProgram -#define clBuildProgram clBuildProgram_fn -inline cl_int clBuildProgram(cl_program p0, cl_uint p1, const cl_device_id* p2, const char* p3, void (CL_CALLBACK*p4) (cl_program, void*), void* p5) { return clBuildProgram_pfn(p0, p1, p2, p3, p4, p5); } -#undef clCompileProgram -#define clCompileProgram clCompileProgram_fn -inline cl_int clCompileProgram(cl_program p0, cl_uint p1, const cl_device_id* p2, const char* p3, cl_uint p4, const cl_program* p5, const char** p6, void (CL_CALLBACK*p7) (cl_program, void*), void* p8) { return clCompileProgram_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); } -#undef clCreateBuffer -#define clCreateBuffer clCreateBuffer_fn -inline cl_mem clCreateBuffer(cl_context p0, cl_mem_flags p1, size_t p2, void* p3, cl_int* p4) { return clCreateBuffer_pfn(p0, p1, p2, p3, p4); } -#undef clCreateCommandQueue -#define clCreateCommandQueue clCreateCommandQueue_fn -inline cl_command_queue clCreateCommandQueue(cl_context p0, cl_device_id p1, cl_command_queue_properties p2, cl_int* p3) { return clCreateCommandQueue_pfn(p0, p1, p2, p3); } -#undef clCreateContext -#define clCreateContext clCreateContext_fn -inline cl_context clCreateContext(const cl_context_properties* p0, cl_uint p1, const cl_device_id* p2, void (CL_CALLBACK*p3) (const char*, const void*, size_t, void*), void* p4, cl_int* p5) { return clCreateContext_pfn(p0, p1, p2, p3, p4, p5); } -#undef clCreateContextFromType -#define clCreateContextFromType clCreateContextFromType_fn -inline cl_context clCreateContextFromType(const cl_context_properties* p0, cl_device_type p1, void (CL_CALLBACK*p2) (const char*, const void*, size_t, void*), void* p3, cl_int* p4) { return clCreateContextFromType_pfn(p0, p1, p2, p3, p4); } -#undef clCreateImage -#define clCreateImage clCreateImage_fn -inline cl_mem clCreateImage(cl_context p0, cl_mem_flags p1, const cl_image_format* p2, const cl_image_desc* p3, void* p4, cl_int* p5) { return clCreateImage_pfn(p0, p1, p2, p3, p4, p5); } -#undef clCreateImage2D -#define clCreateImage2D clCreateImage2D_fn -inline cl_mem clCreateImage2D(cl_context p0, cl_mem_flags p1, const cl_image_format* p2, size_t p3, size_t p4, size_t p5, void* p6, cl_int* p7) { return clCreateImage2D_pfn(p0, p1, p2, p3, p4, p5, p6, p7); } -#undef clCreateImage3D -#define clCreateImage3D clCreateImage3D_fn -inline cl_mem clCreateImage3D(cl_context p0, cl_mem_flags p1, const cl_image_format* p2, size_t p3, size_t p4, size_t p5, size_t p6, size_t p7, void* p8, cl_int* p9) { return clCreateImage3D_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); } -#undef clCreateKernel -#define clCreateKernel clCreateKernel_fn -inline cl_kernel clCreateKernel(cl_program p0, const char* p1, cl_int* p2) { return clCreateKernel_pfn(p0, p1, p2); } -#undef clCreateKernelsInProgram -#define clCreateKernelsInProgram clCreateKernelsInProgram_fn -inline cl_int clCreateKernelsInProgram(cl_program p0, cl_uint p1, cl_kernel* p2, cl_uint* p3) { return clCreateKernelsInProgram_pfn(p0, p1, p2, p3); } -#undef clCreateProgramWithBinary -#define clCreateProgramWithBinary clCreateProgramWithBinary_fn -inline cl_program clCreateProgramWithBinary(cl_context p0, cl_uint p1, const cl_device_id* p2, const size_t* p3, const unsigned char** p4, cl_int* p5, cl_int* p6) { return clCreateProgramWithBinary_pfn(p0, p1, p2, p3, p4, p5, p6); } -#undef clCreateProgramWithBuiltInKernels -#define clCreateProgramWithBuiltInKernels clCreateProgramWithBuiltInKernels_fn -inline cl_program clCreateProgramWithBuiltInKernels(cl_context p0, cl_uint p1, const cl_device_id* p2, const char* p3, cl_int* p4) { return clCreateProgramWithBuiltInKernels_pfn(p0, p1, p2, p3, p4); } -#undef clCreateProgramWithSource -#define clCreateProgramWithSource clCreateProgramWithSource_fn -inline cl_program clCreateProgramWithSource(cl_context p0, cl_uint p1, const char** p2, const size_t* p3, cl_int* p4) { return clCreateProgramWithSource_pfn(p0, p1, p2, p3, p4); } -#undef clCreateSampler -#define clCreateSampler clCreateSampler_fn -inline cl_sampler clCreateSampler(cl_context p0, cl_bool p1, cl_addressing_mode p2, cl_filter_mode p3, cl_int* p4) { return clCreateSampler_pfn(p0, p1, p2, p3, p4); } -#undef clCreateSubBuffer -#define clCreateSubBuffer clCreateSubBuffer_fn -inline cl_mem clCreateSubBuffer(cl_mem p0, cl_mem_flags p1, cl_buffer_create_type p2, const void* p3, cl_int* p4) { return clCreateSubBuffer_pfn(p0, p1, p2, p3, p4); } -#undef clCreateSubDevices -#define clCreateSubDevices clCreateSubDevices_fn -inline cl_int clCreateSubDevices(cl_device_id p0, const cl_device_partition_property* p1, cl_uint p2, cl_device_id* p3, cl_uint* p4) { return clCreateSubDevices_pfn(p0, p1, p2, p3, p4); } -#undef clCreateUserEvent -#define clCreateUserEvent clCreateUserEvent_fn -inline cl_event clCreateUserEvent(cl_context p0, cl_int* p1) { return clCreateUserEvent_pfn(p0, p1); } -#undef clEnqueueBarrier -#define clEnqueueBarrier clEnqueueBarrier_fn -inline cl_int clEnqueueBarrier(cl_command_queue p0) { return clEnqueueBarrier_pfn(p0); } -#undef clEnqueueBarrierWithWaitList -#define clEnqueueBarrierWithWaitList clEnqueueBarrierWithWaitList_fn -inline cl_int clEnqueueBarrierWithWaitList(cl_command_queue p0, cl_uint p1, const cl_event* p2, cl_event* p3) { return clEnqueueBarrierWithWaitList_pfn(p0, p1, p2, p3); } -#undef clEnqueueCopyBuffer -#define clEnqueueCopyBuffer clEnqueueCopyBuffer_fn -inline cl_int clEnqueueCopyBuffer(cl_command_queue p0, cl_mem p1, cl_mem p2, size_t p3, size_t p4, size_t p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueCopyBuffer_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); } -#undef clEnqueueCopyBufferRect -#define clEnqueueCopyBufferRect clEnqueueCopyBufferRect_fn -inline cl_int clEnqueueCopyBufferRect(cl_command_queue p0, cl_mem p1, cl_mem p2, const size_t* p3, const size_t* p4, const size_t* p5, size_t p6, size_t p7, size_t p8, size_t p9, cl_uint p10, const cl_event* p11, cl_event* p12) { return clEnqueueCopyBufferRect_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); } -#undef clEnqueueCopyBufferToImage -#define clEnqueueCopyBufferToImage clEnqueueCopyBufferToImage_fn -inline cl_int clEnqueueCopyBufferToImage(cl_command_queue p0, cl_mem p1, cl_mem p2, size_t p3, const size_t* p4, const size_t* p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueCopyBufferToImage_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); } -#undef clEnqueueCopyImage -#define clEnqueueCopyImage clEnqueueCopyImage_fn -inline cl_int clEnqueueCopyImage(cl_command_queue p0, cl_mem p1, cl_mem p2, const size_t* p3, const size_t* p4, const size_t* p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueCopyImage_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); } -#undef clEnqueueCopyImageToBuffer -#define clEnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer_fn -inline cl_int clEnqueueCopyImageToBuffer(cl_command_queue p0, cl_mem p1, cl_mem p2, const size_t* p3, const size_t* p4, size_t p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueCopyImageToBuffer_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); } -#undef clEnqueueFillBuffer -#define clEnqueueFillBuffer clEnqueueFillBuffer_fn -inline cl_int clEnqueueFillBuffer(cl_command_queue p0, cl_mem p1, const void* p2, size_t p3, size_t p4, size_t p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueFillBuffer_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); } -#undef clEnqueueFillImage -#define clEnqueueFillImage clEnqueueFillImage_fn -inline cl_int clEnqueueFillImage(cl_command_queue p0, cl_mem p1, const void* p2, const size_t* p3, const size_t* p4, cl_uint p5, const cl_event* p6, cl_event* p7) { return clEnqueueFillImage_pfn(p0, p1, p2, p3, p4, p5, p6, p7); } -#undef clEnqueueMapBuffer -#define clEnqueueMapBuffer clEnqueueMapBuffer_fn -inline void* clEnqueueMapBuffer(cl_command_queue p0, cl_mem p1, cl_bool p2, cl_map_flags p3, size_t p4, size_t p5, cl_uint p6, const cl_event* p7, cl_event* p8, cl_int* p9) { return clEnqueueMapBuffer_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); } -#undef clEnqueueMapImage -#define clEnqueueMapImage clEnqueueMapImage_fn -inline void* clEnqueueMapImage(cl_command_queue p0, cl_mem p1, cl_bool p2, cl_map_flags p3, const size_t* p4, const size_t* p5, size_t* p6, size_t* p7, cl_uint p8, const cl_event* p9, cl_event* p10, cl_int* p11) { return clEnqueueMapImage_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); } -#undef clEnqueueMarker -#define clEnqueueMarker clEnqueueMarker_fn -inline cl_int clEnqueueMarker(cl_command_queue p0, cl_event* p1) { return clEnqueueMarker_pfn(p0, p1); } -#undef clEnqueueMarkerWithWaitList -#define clEnqueueMarkerWithWaitList clEnqueueMarkerWithWaitList_fn -inline cl_int clEnqueueMarkerWithWaitList(cl_command_queue p0, cl_uint p1, const cl_event* p2, cl_event* p3) { return clEnqueueMarkerWithWaitList_pfn(p0, p1, p2, p3); } -#undef clEnqueueMigrateMemObjects -#define clEnqueueMigrateMemObjects clEnqueueMigrateMemObjects_fn -inline cl_int clEnqueueMigrateMemObjects(cl_command_queue p0, cl_uint p1, const cl_mem* p2, cl_mem_migration_flags p3, cl_uint p4, const cl_event* p5, cl_event* p6) { return clEnqueueMigrateMemObjects_pfn(p0, p1, p2, p3, p4, p5, p6); } -#undef clEnqueueNDRangeKernel -#define clEnqueueNDRangeKernel clEnqueueNDRangeKernel_fn -inline cl_int clEnqueueNDRangeKernel(cl_command_queue p0, cl_kernel p1, cl_uint p2, const size_t* p3, const size_t* p4, const size_t* p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueNDRangeKernel_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); } -#undef clEnqueueNativeKernel -#define clEnqueueNativeKernel clEnqueueNativeKernel_fn -inline cl_int clEnqueueNativeKernel(cl_command_queue p0, void (CL_CALLBACK*p1) (void*), void* p2, size_t p3, cl_uint p4, const cl_mem* p5, const void** p6, cl_uint p7, const cl_event* p8, cl_event* p9) { return clEnqueueNativeKernel_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); } -#undef clEnqueueReadBuffer -#define clEnqueueReadBuffer clEnqueueReadBuffer_fn -inline cl_int clEnqueueReadBuffer(cl_command_queue p0, cl_mem p1, cl_bool p2, size_t p3, size_t p4, void* p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueReadBuffer_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); } -#undef clEnqueueReadBufferRect -#define clEnqueueReadBufferRect clEnqueueReadBufferRect_fn -inline cl_int clEnqueueReadBufferRect(cl_command_queue p0, cl_mem p1, cl_bool p2, const size_t* p3, const size_t* p4, const size_t* p5, size_t p6, size_t p7, size_t p8, size_t p9, void* p10, cl_uint p11, const cl_event* p12, cl_event* p13) { return clEnqueueReadBufferRect_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); } -#undef clEnqueueReadImage -#define clEnqueueReadImage clEnqueueReadImage_fn -inline cl_int clEnqueueReadImage(cl_command_queue p0, cl_mem p1, cl_bool p2, const size_t* p3, const size_t* p4, size_t p5, size_t p6, void* p7, cl_uint p8, const cl_event* p9, cl_event* p10) { return clEnqueueReadImage_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); } -#undef clEnqueueTask -#define clEnqueueTask clEnqueueTask_fn -inline cl_int clEnqueueTask(cl_command_queue p0, cl_kernel p1, cl_uint p2, const cl_event* p3, cl_event* p4) { return clEnqueueTask_pfn(p0, p1, p2, p3, p4); } -#undef clEnqueueUnmapMemObject -#define clEnqueueUnmapMemObject clEnqueueUnmapMemObject_fn -inline cl_int clEnqueueUnmapMemObject(cl_command_queue p0, cl_mem p1, void* p2, cl_uint p3, const cl_event* p4, cl_event* p5) { return clEnqueueUnmapMemObject_pfn(p0, p1, p2, p3, p4, p5); } -#undef clEnqueueWaitForEvents -#define clEnqueueWaitForEvents clEnqueueWaitForEvents_fn -inline cl_int clEnqueueWaitForEvents(cl_command_queue p0, cl_uint p1, const cl_event* p2) { return clEnqueueWaitForEvents_pfn(p0, p1, p2); } -#undef clEnqueueWriteBuffer -#define clEnqueueWriteBuffer clEnqueueWriteBuffer_fn -inline cl_int clEnqueueWriteBuffer(cl_command_queue p0, cl_mem p1, cl_bool p2, size_t p3, size_t p4, const void* p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueWriteBuffer_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); } -#undef clEnqueueWriteBufferRect -#define clEnqueueWriteBufferRect clEnqueueWriteBufferRect_fn -inline cl_int clEnqueueWriteBufferRect(cl_command_queue p0, cl_mem p1, cl_bool p2, const size_t* p3, const size_t* p4, const size_t* p5, size_t p6, size_t p7, size_t p8, size_t p9, const void* p10, cl_uint p11, const cl_event* p12, cl_event* p13) { return clEnqueueWriteBufferRect_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); } -#undef clEnqueueWriteImage -#define clEnqueueWriteImage clEnqueueWriteImage_fn -inline cl_int clEnqueueWriteImage(cl_command_queue p0, cl_mem p1, cl_bool p2, const size_t* p3, const size_t* p4, size_t p5, size_t p6, const void* p7, cl_uint p8, const cl_event* p9, cl_event* p10) { return clEnqueueWriteImage_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); } -#undef clFinish -#define clFinish clFinish_fn -inline cl_int clFinish(cl_command_queue p0) { return clFinish_pfn(p0); } -#undef clFlush -#define clFlush clFlush_fn -inline cl_int clFlush(cl_command_queue p0) { return clFlush_pfn(p0); } -#undef clGetCommandQueueInfo -#define clGetCommandQueueInfo clGetCommandQueueInfo_fn -inline cl_int clGetCommandQueueInfo(cl_command_queue p0, cl_command_queue_info p1, size_t p2, void* p3, size_t* p4) { return clGetCommandQueueInfo_pfn(p0, p1, p2, p3, p4); } -#undef clGetContextInfo -#define clGetContextInfo clGetContextInfo_fn -inline cl_int clGetContextInfo(cl_context p0, cl_context_info p1, size_t p2, void* p3, size_t* p4) { return clGetContextInfo_pfn(p0, p1, p2, p3, p4); } -#undef clGetDeviceIDs -#define clGetDeviceIDs clGetDeviceIDs_fn -inline cl_int clGetDeviceIDs(cl_platform_id p0, cl_device_type p1, cl_uint p2, cl_device_id* p3, cl_uint* p4) { return clGetDeviceIDs_pfn(p0, p1, p2, p3, p4); } -#undef clGetDeviceInfo -#define clGetDeviceInfo clGetDeviceInfo_fn -inline cl_int clGetDeviceInfo(cl_device_id p0, cl_device_info p1, size_t p2, void* p3, size_t* p4) { return clGetDeviceInfo_pfn(p0, p1, p2, p3, p4); } -#undef clGetEventInfo -#define clGetEventInfo clGetEventInfo_fn -inline cl_int clGetEventInfo(cl_event p0, cl_event_info p1, size_t p2, void* p3, size_t* p4) { return clGetEventInfo_pfn(p0, p1, p2, p3, p4); } -#undef clGetEventProfilingInfo -#define clGetEventProfilingInfo clGetEventProfilingInfo_fn -inline cl_int clGetEventProfilingInfo(cl_event p0, cl_profiling_info p1, size_t p2, void* p3, size_t* p4) { return clGetEventProfilingInfo_pfn(p0, p1, p2, p3, p4); } -#undef clGetExtensionFunctionAddress -#define clGetExtensionFunctionAddress clGetExtensionFunctionAddress_fn -inline void* clGetExtensionFunctionAddress(const char* p0) { return clGetExtensionFunctionAddress_pfn(p0); } -#undef clGetExtensionFunctionAddressForPlatform -#define clGetExtensionFunctionAddressForPlatform clGetExtensionFunctionAddressForPlatform_fn -inline void* clGetExtensionFunctionAddressForPlatform(cl_platform_id p0, const char* p1) { return clGetExtensionFunctionAddressForPlatform_pfn(p0, p1); } -#undef clGetImageInfo -#define clGetImageInfo clGetImageInfo_fn -inline cl_int clGetImageInfo(cl_mem p0, cl_image_info p1, size_t p2, void* p3, size_t* p4) { return clGetImageInfo_pfn(p0, p1, p2, p3, p4); } -#undef clGetKernelArgInfo -#define clGetKernelArgInfo clGetKernelArgInfo_fn -inline cl_int clGetKernelArgInfo(cl_kernel p0, cl_uint p1, cl_kernel_arg_info p2, size_t p3, void* p4, size_t* p5) { return clGetKernelArgInfo_pfn(p0, p1, p2, p3, p4, p5); } -#undef clGetKernelInfo -#define clGetKernelInfo clGetKernelInfo_fn -inline cl_int clGetKernelInfo(cl_kernel p0, cl_kernel_info p1, size_t p2, void* p3, size_t* p4) { return clGetKernelInfo_pfn(p0, p1, p2, p3, p4); } -#undef clGetKernelWorkGroupInfo -#define clGetKernelWorkGroupInfo clGetKernelWorkGroupInfo_fn -inline cl_int clGetKernelWorkGroupInfo(cl_kernel p0, cl_device_id p1, cl_kernel_work_group_info p2, size_t p3, void* p4, size_t* p5) { return clGetKernelWorkGroupInfo_pfn(p0, p1, p2, p3, p4, p5); } -#undef clGetMemObjectInfo -#define clGetMemObjectInfo clGetMemObjectInfo_fn -inline cl_int clGetMemObjectInfo(cl_mem p0, cl_mem_info p1, size_t p2, void* p3, size_t* p4) { return clGetMemObjectInfo_pfn(p0, p1, p2, p3, p4); } -#undef clGetPlatformIDs -#define clGetPlatformIDs clGetPlatformIDs_fn -inline cl_int clGetPlatformIDs(cl_uint p0, cl_platform_id* p1, cl_uint* p2) { return clGetPlatformIDs_pfn(p0, p1, p2); } -#undef clGetPlatformInfo -#define clGetPlatformInfo clGetPlatformInfo_fn -inline cl_int clGetPlatformInfo(cl_platform_id p0, cl_platform_info p1, size_t p2, void* p3, size_t* p4) { return clGetPlatformInfo_pfn(p0, p1, p2, p3, p4); } -#undef clGetProgramBuildInfo -#define clGetProgramBuildInfo clGetProgramBuildInfo_fn -inline cl_int clGetProgramBuildInfo(cl_program p0, cl_device_id p1, cl_program_build_info p2, size_t p3, void* p4, size_t* p5) { return clGetProgramBuildInfo_pfn(p0, p1, p2, p3, p4, p5); } -#undef clGetProgramInfo -#define clGetProgramInfo clGetProgramInfo_fn -inline cl_int clGetProgramInfo(cl_program p0, cl_program_info p1, size_t p2, void* p3, size_t* p4) { return clGetProgramInfo_pfn(p0, p1, p2, p3, p4); } -#undef clGetSamplerInfo -#define clGetSamplerInfo clGetSamplerInfo_fn -inline cl_int clGetSamplerInfo(cl_sampler p0, cl_sampler_info p1, size_t p2, void* p3, size_t* p4) { return clGetSamplerInfo_pfn(p0, p1, p2, p3, p4); } -#undef clGetSupportedImageFormats -#define clGetSupportedImageFormats clGetSupportedImageFormats_fn -inline cl_int clGetSupportedImageFormats(cl_context p0, cl_mem_flags p1, cl_mem_object_type p2, cl_uint p3, cl_image_format* p4, cl_uint* p5) { return clGetSupportedImageFormats_pfn(p0, p1, p2, p3, p4, p5); } -#undef clLinkProgram -#define clLinkProgram clLinkProgram_fn -inline cl_program clLinkProgram(cl_context p0, cl_uint p1, const cl_device_id* p2, const char* p3, cl_uint p4, const cl_program* p5, void (CL_CALLBACK*p6) (cl_program, void*), void* p7, cl_int* p8) { return clLinkProgram_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); } -#undef clReleaseCommandQueue -#define clReleaseCommandQueue clReleaseCommandQueue_fn -inline cl_int clReleaseCommandQueue(cl_command_queue p0) { return clReleaseCommandQueue_pfn(p0); } -#undef clReleaseContext -#define clReleaseContext clReleaseContext_fn -inline cl_int clReleaseContext(cl_context p0) { return clReleaseContext_pfn(p0); } -#undef clReleaseDevice -#define clReleaseDevice clReleaseDevice_fn -inline cl_int clReleaseDevice(cl_device_id p0) { return clReleaseDevice_pfn(p0); } -#undef clReleaseEvent -#define clReleaseEvent clReleaseEvent_fn -inline cl_int clReleaseEvent(cl_event p0) { return clReleaseEvent_pfn(p0); } -#undef clReleaseKernel -#define clReleaseKernel clReleaseKernel_fn -inline cl_int clReleaseKernel(cl_kernel p0) { return clReleaseKernel_pfn(p0); } -#undef clReleaseMemObject -#define clReleaseMemObject clReleaseMemObject_fn -inline cl_int clReleaseMemObject(cl_mem p0) { return clReleaseMemObject_pfn(p0); } -#undef clReleaseProgram -#define clReleaseProgram clReleaseProgram_fn -inline cl_int clReleaseProgram(cl_program p0) { return clReleaseProgram_pfn(p0); } -#undef clReleaseSampler -#define clReleaseSampler clReleaseSampler_fn -inline cl_int clReleaseSampler(cl_sampler p0) { return clReleaseSampler_pfn(p0); } -#undef clRetainCommandQueue -#define clRetainCommandQueue clRetainCommandQueue_fn -inline cl_int clRetainCommandQueue(cl_command_queue p0) { return clRetainCommandQueue_pfn(p0); } -#undef clRetainContext -#define clRetainContext clRetainContext_fn -inline cl_int clRetainContext(cl_context p0) { return clRetainContext_pfn(p0); } -#undef clRetainDevice -#define clRetainDevice clRetainDevice_fn -inline cl_int clRetainDevice(cl_device_id p0) { return clRetainDevice_pfn(p0); } -#undef clRetainEvent -#define clRetainEvent clRetainEvent_fn -inline cl_int clRetainEvent(cl_event p0) { return clRetainEvent_pfn(p0); } -#undef clRetainKernel -#define clRetainKernel clRetainKernel_fn -inline cl_int clRetainKernel(cl_kernel p0) { return clRetainKernel_pfn(p0); } -#undef clRetainMemObject -#define clRetainMemObject clRetainMemObject_fn -inline cl_int clRetainMemObject(cl_mem p0) { return clRetainMemObject_pfn(p0); } -#undef clRetainProgram -#define clRetainProgram clRetainProgram_fn -inline cl_int clRetainProgram(cl_program p0) { return clRetainProgram_pfn(p0); } -#undef clRetainSampler -#define clRetainSampler clRetainSampler_fn -inline cl_int clRetainSampler(cl_sampler p0) { return clRetainSampler_pfn(p0); } -#undef clSetEventCallback -#define clSetEventCallback clSetEventCallback_fn -inline cl_int clSetEventCallback(cl_event p0, cl_int p1, void (CL_CALLBACK*p2) (cl_event, cl_int, void*), void* p3) { return clSetEventCallback_pfn(p0, p1, p2, p3); } -#undef clSetKernelArg -#define clSetKernelArg clSetKernelArg_fn -inline cl_int clSetKernelArg(cl_kernel p0, cl_uint p1, size_t p2, const void* p3) { return clSetKernelArg_pfn(p0, p1, p2, p3); } -#undef clSetMemObjectDestructorCallback -#define clSetMemObjectDestructorCallback clSetMemObjectDestructorCallback_fn -inline cl_int clSetMemObjectDestructorCallback(cl_mem p0, void (CL_CALLBACK*p1) (cl_mem, void*), void* p2) { return clSetMemObjectDestructorCallback_pfn(p0, p1, p2); } -#undef clSetUserEventStatus -#define clSetUserEventStatus clSetUserEventStatus_fn -inline cl_int clSetUserEventStatus(cl_event p0, cl_int p1) { return clSetUserEventStatus_pfn(p0, p1); } -#undef clUnloadCompiler -#define clUnloadCompiler clUnloadCompiler_fn -inline cl_int clUnloadCompiler() { return clUnloadCompiler_pfn(); } -#undef clUnloadPlatformCompiler -#define clUnloadPlatformCompiler clUnloadPlatformCompiler_fn -inline cl_int clUnloadPlatformCompiler(cl_platform_id p0) { return clUnloadPlatformCompiler_pfn(p0); } -#undef clWaitForEvents -#define clWaitForEvents clWaitForEvents_fn -inline cl_int clWaitForEvents(cl_uint p0, const cl_event* p1) { return clWaitForEvents_pfn(p0, p1); } diff --git a/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp b/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp deleted file mode 100644 index 0b12aed..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// -// AUTOGENERATED, DO NOT EDIT -// -#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP -#error "Invalid usage" -#endif - -// generated by parser_cl.py -#define clCreateFromGLBuffer clCreateFromGLBuffer_ -#define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_ -#define clCreateFromGLTexture clCreateFromGLTexture_ -#define clCreateFromGLTexture2D clCreateFromGLTexture2D_ -#define clCreateFromGLTexture3D clCreateFromGLTexture3D_ -#define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_ -#define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_ -#define clGetGLContextInfoKHR clGetGLContextInfoKHR_ -#define clGetGLObjectInfo clGetGLObjectInfo_ -#define clGetGLTextureInfo clGetGLTextureInfo_ - -#if defined __APPLE__ -#include -#else -#include -#endif - -// generated by parser_cl.py -#undef clCreateFromGLBuffer -#define clCreateFromGLBuffer clCreateFromGLBuffer_pfn -#undef clCreateFromGLRenderbuffer -#define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_pfn -#undef clCreateFromGLTexture -#define clCreateFromGLTexture clCreateFromGLTexture_pfn -#undef clCreateFromGLTexture2D -#define clCreateFromGLTexture2D clCreateFromGLTexture2D_pfn -#undef clCreateFromGLTexture3D -#define clCreateFromGLTexture3D clCreateFromGLTexture3D_pfn -#undef clEnqueueAcquireGLObjects -#define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_pfn -#undef clEnqueueReleaseGLObjects -#define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_pfn -#undef clGetGLContextInfoKHR -#define clGetGLContextInfoKHR clGetGLContextInfoKHR_pfn -#undef clGetGLObjectInfo -#define clGetGLObjectInfo clGetGLObjectInfo_pfn -#undef clGetGLTextureInfo -#define clGetGLTextureInfo clGetGLTextureInfo_pfn - -#ifdef cl_khr_gl_sharing - -// generated by parser_cl.py -extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLBuffer)(cl_context, cl_mem_flags, cl_GLuint, int*); -extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLRenderbuffer)(cl_context, cl_mem_flags, cl_GLuint, cl_int*); -extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*); -extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture2D)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*); -extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture3D)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueAcquireGLObjects)(cl_command_queue, cl_uint, const cl_mem*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReleaseGLObjects)(cl_command_queue, cl_uint, const cl_mem*, cl_uint, const cl_event*, cl_event*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLContextInfoKHR)(const cl_context_properties*, cl_gl_context_info, size_t, void*, size_t*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLObjectInfo)(cl_mem, cl_gl_object_type*, cl_GLuint*); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLTextureInfo)(cl_mem, cl_gl_texture_info, size_t, void*, size_t*); - -#endif // cl_khr_gl_sharing diff --git a/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp b/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp deleted file mode 100644 index 12f342b..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// AUTOGENERATED, DO NOT EDIT -// -#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP -#error "Invalid usage" -#endif - -#ifdef cl_khr_gl_sharing - -// generated by parser_cl.py -#undef clCreateFromGLBuffer -#define clCreateFromGLBuffer clCreateFromGLBuffer_fn -inline cl_mem clCreateFromGLBuffer(cl_context p0, cl_mem_flags p1, cl_GLuint p2, int* p3) { return clCreateFromGLBuffer_pfn(p0, p1, p2, p3); } -#undef clCreateFromGLRenderbuffer -#define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_fn -inline cl_mem clCreateFromGLRenderbuffer(cl_context p0, cl_mem_flags p1, cl_GLuint p2, cl_int* p3) { return clCreateFromGLRenderbuffer_pfn(p0, p1, p2, p3); } -#undef clCreateFromGLTexture -#define clCreateFromGLTexture clCreateFromGLTexture_fn -inline cl_mem clCreateFromGLTexture(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture_pfn(p0, p1, p2, p3, p4, p5); } -#undef clCreateFromGLTexture2D -#define clCreateFromGLTexture2D clCreateFromGLTexture2D_fn -inline cl_mem clCreateFromGLTexture2D(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture2D_pfn(p0, p1, p2, p3, p4, p5); } -#undef clCreateFromGLTexture3D -#define clCreateFromGLTexture3D clCreateFromGLTexture3D_fn -inline cl_mem clCreateFromGLTexture3D(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture3D_pfn(p0, p1, p2, p3, p4, p5); } -#undef clEnqueueAcquireGLObjects -#define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_fn -inline cl_int clEnqueueAcquireGLObjects(cl_command_queue p0, cl_uint p1, const cl_mem* p2, cl_uint p3, const cl_event* p4, cl_event* p5) { return clEnqueueAcquireGLObjects_pfn(p0, p1, p2, p3, p4, p5); } -#undef clEnqueueReleaseGLObjects -#define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_fn -inline cl_int clEnqueueReleaseGLObjects(cl_command_queue p0, cl_uint p1, const cl_mem* p2, cl_uint p3, const cl_event* p4, cl_event* p5) { return clEnqueueReleaseGLObjects_pfn(p0, p1, p2, p3, p4, p5); } -#undef clGetGLContextInfoKHR -#define clGetGLContextInfoKHR clGetGLContextInfoKHR_fn -inline cl_int clGetGLContextInfoKHR(const cl_context_properties* p0, cl_gl_context_info p1, size_t p2, void* p3, size_t* p4) { return clGetGLContextInfoKHR_pfn(p0, p1, p2, p3, p4); } -#undef clGetGLObjectInfo -#define clGetGLObjectInfo clGetGLObjectInfo_fn -inline cl_int clGetGLObjectInfo(cl_mem p0, cl_gl_object_type* p1, cl_GLuint* p2) { return clGetGLObjectInfo_pfn(p0, p1, p2); } -#undef clGetGLTextureInfo -#define clGetGLTextureInfo clGetGLTextureInfo_fn -inline cl_int clGetGLTextureInfo(cl_mem p0, cl_gl_texture_info p1, size_t p2, void* p3, size_t* p4) { return clGetGLTextureInfo_pfn(p0, p1, p2, p3, p4); } - -#endif // cl_khr_gl_sharing diff --git a/opencv/include/opencv2/core/opencl/runtime/opencl_clamdblas.hpp b/opencv/include/opencv2/core/opencl/runtime/opencl_clamdblas.hpp deleted file mode 100644 index 2ad8ac0..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/opencl_clamdblas.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the OpenCV Foundation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP -#define OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP - -#ifdef HAVE_CLAMDBLAS - -#include "opencl_core.hpp" - -#include "autogenerated/opencl_clamdblas.hpp" - -#endif // HAVE_CLAMDBLAS - -#endif // OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP diff --git a/opencv/include/opencv2/core/opencl/runtime/opencl_clamdfft.hpp b/opencv/include/opencv2/core/opencl/runtime/opencl_clamdfft.hpp deleted file mode 100644 index a328f72..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/opencl_clamdfft.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the OpenCV Foundation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP -#define OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP - -#ifdef HAVE_CLAMDFFT - -#include "opencl_core.hpp" - -#include "autogenerated/opencl_clamdfft.hpp" - -#endif // HAVE_CLAMDFFT - -#endif // OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP diff --git a/opencv/include/opencv2/core/opencl/runtime/opencl_core.hpp b/opencv/include/opencv2/core/opencl/runtime/opencl_core.hpp deleted file mode 100644 index 0404b31..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/opencl_core.hpp +++ /dev/null @@ -1,84 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the OpenCV Foundation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP -#define OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP - -#ifdef HAVE_OPENCL - -#ifndef CL_RUNTIME_EXPORT -#if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_CORE_SHARED)) && (defined _WIN32 || defined WINCE) && \ - !(defined(__OPENCV_BUILD) && defined(OPENCV_MODULE_IS_PART_OF_WORLD)) -#define CL_RUNTIME_EXPORT __declspec(dllimport) -#else -#define CL_RUNTIME_EXPORT -#endif -#endif - -#ifdef HAVE_OPENCL_SVM -#define clSVMAlloc clSVMAlloc_ -#define clSVMFree clSVMFree_ -#define clSetKernelArgSVMPointer clSetKernelArgSVMPointer_ -#define clSetKernelExecInfo clSetKernelExecInfo_ -#define clEnqueueSVMFree clEnqueueSVMFree_ -#define clEnqueueSVMMemcpy clEnqueueSVMMemcpy_ -#define clEnqueueSVMMemFill clEnqueueSVMMemFill_ -#define clEnqueueSVMMap clEnqueueSVMMap_ -#define clEnqueueSVMUnmap clEnqueueSVMUnmap_ -#endif - -#include "autogenerated/opencl_core.hpp" - -#ifndef CL_DEVICE_DOUBLE_FP_CONFIG -#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 -#endif - -#ifndef CL_DEVICE_HALF_FP_CONFIG -#define CL_DEVICE_HALF_FP_CONFIG 0x1033 -#endif - -#ifndef CL_VERSION_1_2 -#define CV_REQUIRE_OPENCL_1_2_ERROR CV_Error(cv::Error::OpenCLApiCallError, "OpenCV compiled without OpenCL v1.2 support, so we can't use functionality from OpenCL v1.2") -#endif - -#endif // HAVE_OPENCL - -#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP diff --git a/opencv/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp b/opencv/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp deleted file mode 100644 index 38fcae9..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the OpenCV Foundation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP -#define OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP - -#include "autogenerated/opencl_core_wrappers.hpp" - -#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP diff --git a/opencv/include/opencv2/core/opencl/runtime/opencl_gl.hpp b/opencv/include/opencv2/core/opencl/runtime/opencl_gl.hpp deleted file mode 100644 index 659c7d8..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/opencl_gl.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the OpenCV Foundation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP -#define OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP - -#if defined HAVE_OPENCL && defined HAVE_OPENGL - -#include "opencl_core.hpp" - -#include "autogenerated/opencl_gl.hpp" - -#endif // defined HAVE_OPENCL && defined HAVE_OPENGL - -#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP diff --git a/opencv/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp b/opencv/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp deleted file mode 100644 index 9700004..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the OpenCV Foundation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP -#define OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP - -#include "autogenerated/opencl_gl_wrappers.hpp" - -#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP diff --git a/opencv/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp b/opencv/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp deleted file mode 100644 index 9636b19..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/* See LICENSE file in the root OpenCV directory */ - -#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP -#define OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP - -#if defined(HAVE_OPENCL_SVM) -#include "opencl_core.hpp" - -#include "opencl_svm_definitions.hpp" - -#undef clSVMAlloc -#define clSVMAlloc clSVMAlloc_pfn -#undef clSVMFree -#define clSVMFree clSVMFree_pfn -#undef clSetKernelArgSVMPointer -#define clSetKernelArgSVMPointer clSetKernelArgSVMPointer_pfn -#undef clSetKernelExecInfo -//#define clSetKernelExecInfo clSetKernelExecInfo_pfn -#undef clEnqueueSVMFree -//#define clEnqueueSVMFree clEnqueueSVMFree_pfn -#undef clEnqueueSVMMemcpy -#define clEnqueueSVMMemcpy clEnqueueSVMMemcpy_pfn -#undef clEnqueueSVMMemFill -#define clEnqueueSVMMemFill clEnqueueSVMMemFill_pfn -#undef clEnqueueSVMMap -#define clEnqueueSVMMap clEnqueueSVMMap_pfn -#undef clEnqueueSVMUnmap -#define clEnqueueSVMUnmap clEnqueueSVMUnmap_pfn - -extern CL_RUNTIME_EXPORT void* (CL_API_CALL *clSVMAlloc)(cl_context context, cl_svm_mem_flags flags, size_t size, unsigned int alignment); -extern CL_RUNTIME_EXPORT void (CL_API_CALL *clSVMFree)(cl_context context, void* svm_pointer); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clSetKernelArgSVMPointer)(cl_kernel kernel, cl_uint arg_index, const void* arg_value); -//extern CL_RUNTIME_EXPORT void* (CL_API_CALL *clSetKernelExecInfo)(cl_kernel kernel, cl_kernel_exec_info param_name, size_t param_value_size, const void* param_value); -//extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMFree)(cl_command_queue command_queue, cl_uint num_svm_pointers, void* svm_pointers[], -// void (CL_CALLBACK *pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void* svm_pointers[], void* user_data), void* user_data, -// cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMemcpy)(cl_command_queue command_queue, cl_bool blocking_copy, void* dst_ptr, const void* src_ptr, size_t size, - cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMemFill)(cl_command_queue command_queue, void* svm_ptr, const void* pattern, size_t pattern_size, size_t size, - cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMap)(cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags map_flags, void* svm_ptr, size_t size, - cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); -extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMUnmap)(cl_command_queue command_queue, void* svm_ptr, - cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); - -#endif // HAVE_OPENCL_SVM - -#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP diff --git a/opencv/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp b/opencv/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp deleted file mode 100644 index 97c927b..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* See LICENSE file in the root OpenCV directory */ - -#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP -#define OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP - -#if defined(HAVE_OPENCL_SVM) -#if defined(CL_VERSION_2_0) - -// OpenCL 2.0 contains SVM definitions - -#else - -typedef cl_bitfield cl_device_svm_capabilities; -typedef cl_bitfield cl_svm_mem_flags; -typedef cl_uint cl_kernel_exec_info; - -// -// TODO Add real values after OpenCL 2.0 release -// - -#ifndef CL_DEVICE_SVM_CAPABILITIES -#define CL_DEVICE_SVM_CAPABILITIES 0x1053 - -#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER (1 << 0) -#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER (1 << 1) -#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM (1 << 2) -#define CL_DEVICE_SVM_ATOMICS (1 << 3) -#endif - -#ifndef CL_MEM_SVM_FINE_GRAIN_BUFFER -#define CL_MEM_SVM_FINE_GRAIN_BUFFER (1 << 10) -#endif - -#ifndef CL_MEM_SVM_ATOMICS -#define CL_MEM_SVM_ATOMICS (1 << 11) -#endif - - -#endif // CL_VERSION_2_0 -#endif // HAVE_OPENCL_SVM - -#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP diff --git a/opencv/include/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp b/opencv/include/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp deleted file mode 100644 index 497bc3d..0000000 --- a/opencv/include/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp +++ /dev/null @@ -1,166 +0,0 @@ -/* See LICENSE file in the root OpenCV directory */ - -#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_HSA_EXTENSION_HPP -#define OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_HSA_EXTENSION_HPP - -#if defined(HAVE_OPENCL_SVM) -#include "opencl_core.hpp" - -#ifndef CL_DEVICE_SVM_CAPABILITIES_AMD -// -// Part of the file is an extract from the cl_ext.h file from AMD APP SDK package. -// Below is the original copyright. -// -/******************************************************************************* - * Copyright (c) 2008-2013 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and/or associated documentation files (the - * "Materials"), to deal in the Materials without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Materials, and to - * permit persons to whom the Materials are furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Materials. - * - * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - ******************************************************************************/ - -/******************************************* - * Shared Virtual Memory (SVM) extension - *******************************************/ -typedef cl_bitfield cl_device_svm_capabilities_amd; -typedef cl_bitfield cl_svm_mem_flags_amd; -typedef cl_uint cl_kernel_exec_info_amd; - -/* cl_device_info */ -#define CL_DEVICE_SVM_CAPABILITIES_AMD 0x1053 -#define CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT_AMD 0x1054 - -/* cl_device_svm_capabilities_amd */ -#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_AMD (1 << 0) -#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_AMD (1 << 1) -#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_AMD (1 << 2) -#define CL_DEVICE_SVM_ATOMICS_AMD (1 << 3) - -/* cl_svm_mem_flags_amd */ -#define CL_MEM_SVM_FINE_GRAIN_BUFFER_AMD (1 << 10) -#define CL_MEM_SVM_ATOMICS_AMD (1 << 11) - -/* cl_mem_info */ -#define CL_MEM_USES_SVM_POINTER_AMD 0x1109 - -/* cl_kernel_exec_info_amd */ -#define CL_KERNEL_EXEC_INFO_SVM_PTRS_AMD 0x11B6 -#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_AMD 0x11B7 - -/* cl_command_type */ -#define CL_COMMAND_SVM_FREE_AMD 0x1209 -#define CL_COMMAND_SVM_MEMCPY_AMD 0x120A -#define CL_COMMAND_SVM_MEMFILL_AMD 0x120B -#define CL_COMMAND_SVM_MAP_AMD 0x120C -#define CL_COMMAND_SVM_UNMAP_AMD 0x120D - -typedef CL_API_ENTRY void* -(CL_API_CALL * clSVMAllocAMD_fn)( - cl_context /* context */, - cl_svm_mem_flags_amd /* flags */, - size_t /* size */, - unsigned int /* alignment */ -) CL_EXT_SUFFIX__VERSION_1_2; - -typedef CL_API_ENTRY void -(CL_API_CALL * clSVMFreeAMD_fn)( - cl_context /* context */, - void* /* svm_pointer */ -) CL_EXT_SUFFIX__VERSION_1_2; - -typedef CL_API_ENTRY cl_int -(CL_API_CALL * clEnqueueSVMFreeAMD_fn)( - cl_command_queue /* command_queue */, - cl_uint /* num_svm_pointers */, - void** /* svm_pointers */, - void (CL_CALLBACK *)( /*pfn_free_func*/ - cl_command_queue /* queue */, - cl_uint /* num_svm_pointers */, - void** /* svm_pointers */, - void* /* user_data */), - void* /* user_data */, - cl_uint /* num_events_in_wait_list */, - const cl_event* /* event_wait_list */, - cl_event* /* event */ -) CL_EXT_SUFFIX__VERSION_1_2; - -typedef CL_API_ENTRY cl_int -(CL_API_CALL * clEnqueueSVMMemcpyAMD_fn)( - cl_command_queue /* command_queue */, - cl_bool /* blocking_copy */, - void* /* dst_ptr */, - const void* /* src_ptr */, - size_t /* size */, - cl_uint /* num_events_in_wait_list */, - const cl_event* /* event_wait_list */, - cl_event* /* event */ -) CL_EXT_SUFFIX__VERSION_1_2; - -typedef CL_API_ENTRY cl_int -(CL_API_CALL * clEnqueueSVMMemFillAMD_fn)( - cl_command_queue /* command_queue */, - void* /* svm_ptr */, - const void* /* pattern */, - size_t /* pattern_size */, - size_t /* size */, - cl_uint /* num_events_in_wait_list */, - const cl_event* /* event_wait_list */, - cl_event* /* event */ -) CL_EXT_SUFFIX__VERSION_1_2; - -typedef CL_API_ENTRY cl_int -(CL_API_CALL * clEnqueueSVMMapAMD_fn)( - cl_command_queue /* command_queue */, - cl_bool /* blocking_map */, - cl_map_flags /* map_flags */, - void* /* svm_ptr */, - size_t /* size */, - cl_uint /* num_events_in_wait_list */, - const cl_event* /* event_wait_list */, - cl_event* /* event */ -) CL_EXT_SUFFIX__VERSION_1_2; - -typedef CL_API_ENTRY cl_int -(CL_API_CALL * clEnqueueSVMUnmapAMD_fn)( - cl_command_queue /* command_queue */, - void* /* svm_ptr */, - cl_uint /* num_events_in_wait_list */, - const cl_event* /* event_wait_list */, - cl_event* /* event */ -) CL_EXT_SUFFIX__VERSION_1_2; - -typedef CL_API_ENTRY cl_int -(CL_API_CALL * clSetKernelArgSVMPointerAMD_fn)( - cl_kernel /* kernel */, - cl_uint /* arg_index */, - const void * /* arg_value */ -) CL_EXT_SUFFIX__VERSION_1_2; - -typedef CL_API_ENTRY cl_int -(CL_API_CALL * clSetKernelExecInfoAMD_fn)( - cl_kernel /* kernel */, - cl_kernel_exec_info_amd /* param_name */, - size_t /* param_value_size */, - const void * /* param_value */ -) CL_EXT_SUFFIX__VERSION_1_2; - -#endif - -#endif // HAVE_OPENCL_SVM - -#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_HSA_EXTENSION_HPP diff --git a/opencv/include/opencv2/core/opengl.hpp b/opencv/include/opencv2/core/opengl.hpp deleted file mode 100644 index a6288be..0000000 --- a/opencv/include/opencv2/core/opengl.hpp +++ /dev/null @@ -1,725 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_OPENGL_HPP -#define OPENCV_CORE_OPENGL_HPP - -#ifndef __cplusplus -# error opengl.hpp header must be compiled as C++ -#endif - -#include "opencv2/core.hpp" -#include "ocl.hpp" - -namespace cv { namespace ogl { - -/** @addtogroup core_opengl -This section describes OpenGL interoperability. - -To enable OpenGL support, configure OpenCV using CMake with WITH_OPENGL=ON . Currently OpenGL is -supported only with WIN32, GTK and Qt backends on Windows and Linux (MacOS and Android are not -supported). For GTK backend gtkglext-1.0 library is required. - -To use OpenGL functionality you should first create OpenGL context (window or frame buffer). You can -do this with namedWindow function or with other OpenGL toolkit (GLUT, for example). -*/ -//! @{ - -/////////////////// OpenGL Objects /////////////////// - -/** @brief Smart pointer for OpenGL buffer object with reference counting. - -Buffer Objects are OpenGL objects that store an array of unformatted memory allocated by the OpenGL -context. These can be used to store vertex data, pixel data retrieved from images or the -framebuffer, and a variety of other things. - -ogl::Buffer has interface similar with Mat interface and represents 2D array memory. - -ogl::Buffer supports memory transfers between host and device and also can be mapped to CUDA memory. - */ -class CV_EXPORTS Buffer -{ -public: - /** @brief The target defines how you intend to use the buffer object. - */ - enum Target - { - ARRAY_BUFFER = 0x8892, //!< The buffer will be used as a source for vertex data - ELEMENT_ARRAY_BUFFER = 0x8893, //!< The buffer will be used for indices (in glDrawElements, for example) - PIXEL_PACK_BUFFER = 0x88EB, //!< The buffer will be used for reading from OpenGL textures - PIXEL_UNPACK_BUFFER = 0x88EC //!< The buffer will be used for writing to OpenGL textures - }; - - enum Access - { - READ_ONLY = 0x88B8, - WRITE_ONLY = 0x88B9, - READ_WRITE = 0x88BA - }; - - /** @brief The constructors. - - Creates empty ogl::Buffer object, creates ogl::Buffer object from existed buffer ( abufId - parameter), allocates memory for ogl::Buffer object or copies from host/device memory. - */ - Buffer(); - - /** @overload - @param arows Number of rows in a 2D array. - @param acols Number of columns in a 2D array. - @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details. - @param abufId Buffer object name. - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - Buffer(int arows, int acols, int atype, unsigned int abufId, bool autoRelease = false); - - /** @overload - @param asize 2D array size. - @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details. - @param abufId Buffer object name. - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - Buffer(Size asize, int atype, unsigned int abufId, bool autoRelease = false); - - /** @overload - @param arows Number of rows in a 2D array. - @param acols Number of columns in a 2D array. - @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details. - @param target Buffer usage. See cv::ogl::Buffer::Target . - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - Buffer(int arows, int acols, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false); - - /** @overload - @param asize 2D array size. - @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details. - @param target Buffer usage. See cv::ogl::Buffer::Target . - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - Buffer(Size asize, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false); - - /** @overload - @param arr Input array (host or device memory, it can be Mat , cuda::GpuMat or std::vector ). - @param target Buffer usage. See cv::ogl::Buffer::Target . - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - explicit Buffer(InputArray arr, Target target = ARRAY_BUFFER, bool autoRelease = false); - - /** @brief Allocates memory for ogl::Buffer object. - - @param arows Number of rows in a 2D array. - @param acols Number of columns in a 2D array. - @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details. - @param target Buffer usage. See cv::ogl::Buffer::Target . - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - void create(int arows, int acols, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false); - - /** @overload - @param asize 2D array size. - @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details. - @param target Buffer usage. See cv::ogl::Buffer::Target . - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - void create(Size asize, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false); - - /** @brief Decrements the reference counter and destroys the buffer object if needed. - - The function will call setAutoRelease(true) . - */ - void release(); - - /** @brief Sets auto release mode. - - The lifetime of the OpenGL object is tied to the lifetime of the context. If OpenGL context was - bound to a window it could be released at any time (user can close a window). If object's destructor - is called after destruction of the context it will cause an error. Thus ogl::Buffer doesn't destroy - OpenGL object in destructor by default (all OpenGL resources will be released with OpenGL context). - This function can force ogl::Buffer destructor to destroy OpenGL object. - @param flag Auto release mode (if true, release will be called in object's destructor). - */ - void setAutoRelease(bool flag); - - /** @brief Copies from host/device memory to OpenGL buffer. - @param arr Input array (host or device memory, it can be Mat , cuda::GpuMat or std::vector ). - @param target Buffer usage. See cv::ogl::Buffer::Target . - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - void copyFrom(InputArray arr, Target target = ARRAY_BUFFER, bool autoRelease = false); - - /** @overload */ - void copyFrom(InputArray arr, cuda::Stream& stream, Target target = ARRAY_BUFFER, bool autoRelease = false); - - /** @brief Copies from OpenGL buffer to host/device memory or another OpenGL buffer object. - - @param arr Destination array (host or device memory, can be Mat , cuda::GpuMat , std::vector or - ogl::Buffer ). - */ - void copyTo(OutputArray arr) const; - - /** @overload */ - void copyTo(OutputArray arr, cuda::Stream& stream) const; - - /** @brief Creates a full copy of the buffer object and the underlying data. - - @param target Buffer usage for destination buffer. - @param autoRelease Auto release mode for destination buffer. - */ - Buffer clone(Target target = ARRAY_BUFFER, bool autoRelease = false) const; - - /** @brief Binds OpenGL buffer to the specified buffer binding point. - - @param target Binding point. See cv::ogl::Buffer::Target . - */ - void bind(Target target) const; - - /** @brief Unbind any buffers from the specified binding point. - - @param target Binding point. See cv::ogl::Buffer::Target . - */ - static void unbind(Target target); - - /** @brief Maps OpenGL buffer to host memory. - - mapHost maps to the client's address space the entire data store of the buffer object. The data can - then be directly read and/or written relative to the returned pointer, depending on the specified - access policy. - - A mapped data store must be unmapped with ogl::Buffer::unmapHost before its buffer object is used. - - This operation can lead to memory transfers between host and device. - - Only one buffer object can be mapped at a time. - @param access Access policy, indicating whether it will be possible to read from, write to, or both - read from and write to the buffer object's mapped data store. The symbolic constant must be - ogl::Buffer::READ_ONLY , ogl::Buffer::WRITE_ONLY or ogl::Buffer::READ_WRITE . - */ - Mat mapHost(Access access); - - /** @brief Unmaps OpenGL buffer. - */ - void unmapHost(); - - //! map to device memory (blocking) - cuda::GpuMat mapDevice(); - void unmapDevice(); - - /** @brief Maps OpenGL buffer to CUDA device memory. - - This operation doesn't copy data. Several buffer objects can be mapped to CUDA memory at a time. - - A mapped data store must be unmapped with ogl::Buffer::unmapDevice before its buffer object is used. - */ - cuda::GpuMat mapDevice(cuda::Stream& stream); - - /** @brief Unmaps OpenGL buffer. - */ - void unmapDevice(cuda::Stream& stream); - - int rows() const; - int cols() const; - Size size() const; - bool empty() const; - - int type() const; - int depth() const; - int channels() const; - int elemSize() const; - int elemSize1() const; - - //! get OpenGL opject id - unsigned int bufId() const; - - class Impl; - -private: - Ptr impl_; - int rows_; - int cols_; - int type_; -}; - -/** @brief Smart pointer for OpenGL 2D texture memory with reference counting. - */ -class CV_EXPORTS Texture2D -{ -public: - /** @brief An Image Format describes the way that the images in Textures store their data. - */ - enum Format - { - NONE = 0, - DEPTH_COMPONENT = 0x1902, //!< Depth - RGB = 0x1907, //!< Red, Green, Blue - RGBA = 0x1908 //!< Red, Green, Blue, Alpha - }; - - /** @brief The constructors. - - Creates empty ogl::Texture2D object, allocates memory for ogl::Texture2D object or copies from - host/device memory. - */ - Texture2D(); - - /** @overload */ - Texture2D(int arows, int acols, Format aformat, unsigned int atexId, bool autoRelease = false); - - /** @overload */ - Texture2D(Size asize, Format aformat, unsigned int atexId, bool autoRelease = false); - - /** @overload - @param arows Number of rows. - @param acols Number of columns. - @param aformat Image format. See cv::ogl::Texture2D::Format . - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - Texture2D(int arows, int acols, Format aformat, bool autoRelease = false); - - /** @overload - @param asize 2D array size. - @param aformat Image format. See cv::ogl::Texture2D::Format . - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - Texture2D(Size asize, Format aformat, bool autoRelease = false); - - /** @overload - @param arr Input array (host or device memory, it can be Mat , cuda::GpuMat or ogl::Buffer ). - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - explicit Texture2D(InputArray arr, bool autoRelease = false); - - /** @brief Allocates memory for ogl::Texture2D object. - - @param arows Number of rows. - @param acols Number of columns. - @param aformat Image format. See cv::ogl::Texture2D::Format . - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - void create(int arows, int acols, Format aformat, bool autoRelease = false); - /** @overload - @param asize 2D array size. - @param aformat Image format. See cv::ogl::Texture2D::Format . - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - void create(Size asize, Format aformat, bool autoRelease = false); - - /** @brief Decrements the reference counter and destroys the texture object if needed. - - The function will call setAutoRelease(true) . - */ - void release(); - - /** @brief Sets auto release mode. - - @param flag Auto release mode (if true, release will be called in object's destructor). - - The lifetime of the OpenGL object is tied to the lifetime of the context. If OpenGL context was - bound to a window it could be released at any time (user can close a window). If object's destructor - is called after destruction of the context it will cause an error. Thus ogl::Texture2D doesn't - destroy OpenGL object in destructor by default (all OpenGL resources will be released with OpenGL - context). This function can force ogl::Texture2D destructor to destroy OpenGL object. - */ - void setAutoRelease(bool flag); - - /** @brief Copies from host/device memory to OpenGL texture. - - @param arr Input array (host or device memory, it can be Mat , cuda::GpuMat or ogl::Buffer ). - @param autoRelease Auto release mode (if true, release will be called in object's destructor). - */ - void copyFrom(InputArray arr, bool autoRelease = false); - - /** @brief Copies from OpenGL texture to host/device memory or another OpenGL texture object. - - @param arr Destination array (host or device memory, can be Mat , cuda::GpuMat , ogl::Buffer or - ogl::Texture2D ). - @param ddepth Destination depth. - @param autoRelease Auto release mode for destination buffer (if arr is OpenGL buffer or texture). - */ - void copyTo(OutputArray arr, int ddepth = CV_32F, bool autoRelease = false) const; - - /** @brief Binds texture to current active texture unit for GL_TEXTURE_2D target. - */ - void bind() const; - - int rows() const; - int cols() const; - Size size() const; - bool empty() const; - - Format format() const; - - //! get OpenGL opject id - unsigned int texId() const; - - class Impl; - -private: - Ptr impl_; - int rows_; - int cols_; - Format format_; -}; - -/** @brief Wrapper for OpenGL Client-Side Vertex arrays. - -ogl::Arrays stores vertex data in ogl::Buffer objects. - */ -class CV_EXPORTS Arrays -{ -public: - /** @brief Default constructor - */ - Arrays(); - - /** @brief Sets an array of vertex coordinates. - @param vertex array with vertex coordinates, can be both host and device memory. - */ - void setVertexArray(InputArray vertex); - - /** @brief Resets vertex coordinates. - */ - void resetVertexArray(); - - /** @brief Sets an array of vertex colors. - @param color array with vertex colors, can be both host and device memory. - */ - void setColorArray(InputArray color); - - /** @brief Resets vertex colors. - */ - void resetColorArray(); - - /** @brief Sets an array of vertex normals. - @param normal array with vertex normals, can be both host and device memory. - */ - void setNormalArray(InputArray normal); - - /** @brief Resets vertex normals. - */ - void resetNormalArray(); - - /** @brief Sets an array of vertex texture coordinates. - @param texCoord array with vertex texture coordinates, can be both host and device memory. - */ - void setTexCoordArray(InputArray texCoord); - - /** @brief Resets vertex texture coordinates. - */ - void resetTexCoordArray(); - - /** @brief Releases all inner buffers. - */ - void release(); - - /** @brief Sets auto release mode all inner buffers. - @param flag Auto release mode. - */ - void setAutoRelease(bool flag); - - /** @brief Binds all vertex arrays. - */ - void bind() const; - - /** @brief Returns the vertex count. - */ - int size() const; - bool empty() const; - -private: - int size_; - Buffer vertex_; - Buffer color_; - Buffer normal_; - Buffer texCoord_; -}; - -/////////////////// Render Functions /////////////////// - -//! render mode -enum RenderModes { - POINTS = 0x0000, - LINES = 0x0001, - LINE_LOOP = 0x0002, - LINE_STRIP = 0x0003, - TRIANGLES = 0x0004, - TRIANGLE_STRIP = 0x0005, - TRIANGLE_FAN = 0x0006, - QUADS = 0x0007, - QUAD_STRIP = 0x0008, - POLYGON = 0x0009 -}; - -/** @brief Render OpenGL texture or primitives. -@param tex Texture to draw. -@param wndRect Region of window, where to draw a texture (normalized coordinates). -@param texRect Region of texture to draw (normalized coordinates). - */ -CV_EXPORTS void render(const Texture2D& tex, - Rect_ wndRect = Rect_(0.0, 0.0, 1.0, 1.0), - Rect_ texRect = Rect_(0.0, 0.0, 1.0, 1.0)); - -/** @overload -@param arr Array of privitives vertices. -@param mode Render mode. One of cv::ogl::RenderModes -@param color Color for all vertices. Will be used if arr doesn't contain color array. -*/ -CV_EXPORTS void render(const Arrays& arr, int mode = POINTS, Scalar color = Scalar::all(255)); - -/** @overload -@param arr Array of privitives vertices. -@param indices Array of vertices indices (host or device memory). -@param mode Render mode. One of cv::ogl::RenderModes -@param color Color for all vertices. Will be used if arr doesn't contain color array. -*/ -CV_EXPORTS void render(const Arrays& arr, InputArray indices, int mode = POINTS, Scalar color = Scalar::all(255)); - -/////////////////// CL-GL Interoperability Functions /////////////////// - -namespace ocl { -using namespace cv::ocl; - -// TODO static functions in the Context class -/** @brief Creates OpenCL context from GL. -@return Returns reference to OpenCL Context - */ -CV_EXPORTS Context& initializeContextFromGL(); - -} // namespace cv::ogl::ocl - -/** @brief Converts InputArray to Texture2D object. -@param src - source InputArray. -@param texture - destination Texture2D object. - */ -CV_EXPORTS void convertToGLTexture2D(InputArray src, Texture2D& texture); - -/** @brief Converts Texture2D object to OutputArray. -@param texture - source Texture2D object. -@param dst - destination OutputArray. - */ -CV_EXPORTS void convertFromGLTexture2D(const Texture2D& texture, OutputArray dst); - -/** @brief Maps Buffer object to process on CL side (convert to UMat). - -Function creates CL buffer from GL one, and then constructs UMat that can be used -to process buffer data with OpenCV functions. Note that in current implementation -UMat constructed this way doesn't own corresponding GL buffer object, so it is -the user responsibility to close down CL/GL buffers relationships by explicitly -calling unmapGLBuffer() function. -@param buffer - source Buffer object. -@param accessFlags - data access flags (ACCESS_READ|ACCESS_WRITE). -@return Returns UMat object - */ -CV_EXPORTS UMat mapGLBuffer(const Buffer& buffer, int accessFlags = ACCESS_READ|ACCESS_WRITE); - -/** @brief Unmaps Buffer object (releases UMat, previously mapped from Buffer). - -Function must be called explicitly by the user for each UMat previously constructed -by the call to mapGLBuffer() function. -@param u - source UMat, created by mapGLBuffer(). - */ -CV_EXPORTS void unmapGLBuffer(UMat& u); - -//! @} -}} // namespace cv::ogl - -namespace cv { namespace cuda { - -/** @brief Sets a CUDA device and initializes it for the current thread with OpenGL interoperability. - -This function should be explicitly called after OpenGL context creation and before any CUDA calls. -@param device System index of a CUDA device starting with 0. -@ingroup core_opengl - */ -CV_EXPORTS void setGlDevice(int device = 0); - -}} - -//! @cond IGNORED - -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// - -inline -cv::ogl::Buffer::Buffer(int arows, int acols, int atype, Target target, bool autoRelease) : rows_(0), cols_(0), type_(0) -{ - create(arows, acols, atype, target, autoRelease); -} - -inline -cv::ogl::Buffer::Buffer(Size asize, int atype, Target target, bool autoRelease) : rows_(0), cols_(0), type_(0) -{ - create(asize, atype, target, autoRelease); -} - -inline -void cv::ogl::Buffer::create(Size asize, int atype, Target target, bool autoRelease) -{ - create(asize.height, asize.width, atype, target, autoRelease); -} - -inline -int cv::ogl::Buffer::rows() const -{ - return rows_; -} - -inline -int cv::ogl::Buffer::cols() const -{ - return cols_; -} - -inline -cv::Size cv::ogl::Buffer::size() const -{ - return Size(cols_, rows_); -} - -inline -bool cv::ogl::Buffer::empty() const -{ - return rows_ == 0 || cols_ == 0; -} - -inline -int cv::ogl::Buffer::type() const -{ - return type_; -} - -inline -int cv::ogl::Buffer::depth() const -{ - return CV_MAT_DEPTH(type_); -} - -inline -int cv::ogl::Buffer::channels() const -{ - return CV_MAT_CN(type_); -} - -inline -int cv::ogl::Buffer::elemSize() const -{ - return CV_ELEM_SIZE(type_); -} - -inline -int cv::ogl::Buffer::elemSize1() const -{ - return CV_ELEM_SIZE1(type_); -} - -/////// - -inline -cv::ogl::Texture2D::Texture2D(int arows, int acols, Format aformat, bool autoRelease) : rows_(0), cols_(0), format_(NONE) -{ - create(arows, acols, aformat, autoRelease); -} - -inline -cv::ogl::Texture2D::Texture2D(Size asize, Format aformat, bool autoRelease) : rows_(0), cols_(0), format_(NONE) -{ - create(asize, aformat, autoRelease); -} - -inline -void cv::ogl::Texture2D::create(Size asize, Format aformat, bool autoRelease) -{ - create(asize.height, asize.width, aformat, autoRelease); -} - -inline -int cv::ogl::Texture2D::rows() const -{ - return rows_; -} - -inline -int cv::ogl::Texture2D::cols() const -{ - return cols_; -} - -inline -cv::Size cv::ogl::Texture2D::size() const -{ - return Size(cols_, rows_); -} - -inline -bool cv::ogl::Texture2D::empty() const -{ - return rows_ == 0 || cols_ == 0; -} - -inline -cv::ogl::Texture2D::Format cv::ogl::Texture2D::format() const -{ - return format_; -} - -/////// - -inline -cv::ogl::Arrays::Arrays() : size_(0) -{ -} - -inline -int cv::ogl::Arrays::size() const -{ - return size_; -} - -inline -bool cv::ogl::Arrays::empty() const -{ - return size_ == 0; -} - -//! @endcond - -#endif /* OPENCV_CORE_OPENGL_HPP */ diff --git a/opencv/include/opencv2/core/operations.hpp b/opencv/include/opencv2/core/operations.hpp deleted file mode 100644 index 082fef4..0000000 --- a/opencv/include/opencv2/core/operations.hpp +++ /dev/null @@ -1,573 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_OPERATIONS_HPP -#define OPENCV_CORE_OPERATIONS_HPP - -#ifndef __cplusplus -# error operations.hpp header must be compiled as C++ -#endif - -#include - -//! @cond IGNORED - -namespace cv -{ - -////////////////////////////// Matx methods depending on core API ///////////////////////////// - -namespace internal -{ - -template struct Matx_FastInvOp -{ - bool operator()(const Matx<_Tp, m, n>& a, Matx<_Tp, n, m>& b, int method) const - { - return invert(a, b, method) != 0; - } -}; - -template struct Matx_FastInvOp<_Tp, m, m> -{ - bool operator()(const Matx<_Tp, m, m>& a, Matx<_Tp, m, m>& b, int method) const - { - if (method == DECOMP_LU || method == DECOMP_CHOLESKY) - { - Matx<_Tp, m, m> temp = a; - - // assume that b is all 0's on input => make it a unity matrix - for (int i = 0; i < m; i++) - b(i, i) = (_Tp)1; - - if (method == DECOMP_CHOLESKY) - return Cholesky(temp.val, m*sizeof(_Tp), m, b.val, m*sizeof(_Tp), m); - - return LU(temp.val, m*sizeof(_Tp), m, b.val, m*sizeof(_Tp), m) != 0; - } - else - { - return invert(a, b, method) != 0; - } - } -}; - -template struct Matx_FastInvOp<_Tp, 2, 2> -{ - bool operator()(const Matx<_Tp, 2, 2>& a, Matx<_Tp, 2, 2>& b, int /*method*/) const - { - _Tp d = (_Tp)determinant(a); - if (d == 0) - return false; - d = 1/d; - b(1,1) = a(0,0)*d; - b(0,0) = a(1,1)*d; - b(0,1) = -a(0,1)*d; - b(1,0) = -a(1,0)*d; - return true; - } -}; - -template struct Matx_FastInvOp<_Tp, 3, 3> -{ - bool operator()(const Matx<_Tp, 3, 3>& a, Matx<_Tp, 3, 3>& b, int /*method*/) const - { - _Tp d = (_Tp)determinant(a); - if (d == 0) - return false; - d = 1/d; - b(0,0) = (a(1,1) * a(2,2) - a(1,2) * a(2,1)) * d; - b(0,1) = (a(0,2) * a(2,1) - a(0,1) * a(2,2)) * d; - b(0,2) = (a(0,1) * a(1,2) - a(0,2) * a(1,1)) * d; - - b(1,0) = (a(1,2) * a(2,0) - a(1,0) * a(2,2)) * d; - b(1,1) = (a(0,0) * a(2,2) - a(0,2) * a(2,0)) * d; - b(1,2) = (a(0,2) * a(1,0) - a(0,0) * a(1,2)) * d; - - b(2,0) = (a(1,0) * a(2,1) - a(1,1) * a(2,0)) * d; - b(2,1) = (a(0,1) * a(2,0) - a(0,0) * a(2,1)) * d; - b(2,2) = (a(0,0) * a(1,1) - a(0,1) * a(1,0)) * d; - return true; - } -}; - - -template struct Matx_FastSolveOp -{ - bool operator()(const Matx<_Tp, m, l>& a, const Matx<_Tp, m, n>& b, - Matx<_Tp, l, n>& x, int method) const - { - return cv::solve(a, b, x, method); - } -}; - -template struct Matx_FastSolveOp<_Tp, m, m, n> -{ - bool operator()(const Matx<_Tp, m, m>& a, const Matx<_Tp, m, n>& b, - Matx<_Tp, m, n>& x, int method) const - { - if (method == DECOMP_LU || method == DECOMP_CHOLESKY) - { - Matx<_Tp, m, m> temp = a; - x = b; - if( method == DECOMP_CHOLESKY ) - return Cholesky(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n); - - return LU(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n) != 0; - } - else - { - return cv::solve(a, b, x, method); - } - } -}; - -template struct Matx_FastSolveOp<_Tp, 2, 2, 1> -{ - bool operator()(const Matx<_Tp, 2, 2>& a, const Matx<_Tp, 2, 1>& b, - Matx<_Tp, 2, 1>& x, int) const - { - _Tp d = (_Tp)determinant(a); - if (d == 0) - return false; - d = 1/d; - x(0) = (b(0)*a(1,1) - b(1)*a(0,1))*d; - x(1) = (b(1)*a(0,0) - b(0)*a(1,0))*d; - return true; - } -}; - -template struct Matx_FastSolveOp<_Tp, 3, 3, 1> -{ - bool operator()(const Matx<_Tp, 3, 3>& a, const Matx<_Tp, 3, 1>& b, - Matx<_Tp, 3, 1>& x, int) const - { - _Tp d = (_Tp)determinant(a); - if (d == 0) - return false; - d = 1/d; - x(0) = d*(b(0)*(a(1,1)*a(2,2) - a(1,2)*a(2,1)) - - a(0,1)*(b(1)*a(2,2) - a(1,2)*b(2)) + - a(0,2)*(b(1)*a(2,1) - a(1,1)*b(2))); - - x(1) = d*(a(0,0)*(b(1)*a(2,2) - a(1,2)*b(2)) - - b(0)*(a(1,0)*a(2,2) - a(1,2)*a(2,0)) + - a(0,2)*(a(1,0)*b(2) - b(1)*a(2,0))); - - x(2) = d*(a(0,0)*(a(1,1)*b(2) - b(1)*a(2,1)) - - a(0,1)*(a(1,0)*b(2) - b(1)*a(2,0)) + - b(0)*(a(1,0)*a(2,1) - a(1,1)*a(2,0))); - return true; - } -}; - -} // internal - -template inline -Matx<_Tp,m,n> Matx<_Tp,m,n>::randu(_Tp a, _Tp b) -{ - Matx<_Tp,m,n> M; - cv::randu(M, Scalar(a), Scalar(b)); - return M; -} - -template inline -Matx<_Tp,m,n> Matx<_Tp,m,n>::randn(_Tp a, _Tp b) -{ - Matx<_Tp,m,n> M; - cv::randn(M, Scalar(a), Scalar(b)); - return M; -} - -template inline -Matx<_Tp, n, m> Matx<_Tp, m, n>::inv(int method, bool *p_is_ok /*= NULL*/) const -{ - Matx<_Tp, n, m> b; - bool ok = cv::internal::Matx_FastInvOp<_Tp, m, n>()(*this, b, method); - if (p_is_ok) *p_is_ok = ok; - return ok ? b : Matx<_Tp, n, m>::zeros(); -} - -template template inline -Matx<_Tp, n, l> Matx<_Tp, m, n>::solve(const Matx<_Tp, m, l>& rhs, int method) const -{ - Matx<_Tp, n, l> x; - bool ok = cv::internal::Matx_FastSolveOp<_Tp, m, n, l>()(*this, rhs, x, method); - return ok ? x : Matx<_Tp, n, l>::zeros(); -} - - - -////////////////////////// Augmenting algebraic & logical operations ////////////////////////// - -#define CV_MAT_AUG_OPERATOR1(op, cvop, A, B) \ - static inline A& operator op (A& a, const B& b) { cvop; return a; } - -#define CV_MAT_AUG_OPERATOR(op, cvop, A, B) \ - CV_MAT_AUG_OPERATOR1(op, cvop, A, B) \ - CV_MAT_AUG_OPERATOR1(op, cvop, const A, B) - -#define CV_MAT_AUG_OPERATOR_T(op, cvop, A, B) \ - template CV_MAT_AUG_OPERATOR1(op, cvop, A, B) \ - template CV_MAT_AUG_OPERATOR1(op, cvop, const A, B) - -#define CV_MAT_AUG_OPERATOR_TN(op, cvop, A) \ - template static inline A& operator op (A& a, const Matx<_Tp,m,n>& b) { cvop; return a; } \ - template static inline const A& operator op (const A& a, const Matx<_Tp,m,n>& b) { cvop; return a; } - -CV_MAT_AUG_OPERATOR (+=, cv::add(a,b,a), Mat, Mat) -CV_MAT_AUG_OPERATOR (+=, cv::add(a,b,a), Mat, Scalar) -CV_MAT_AUG_OPERATOR_T(+=, cv::add(a,b,a), Mat_<_Tp>, Mat) -CV_MAT_AUG_OPERATOR_T(+=, cv::add(a,b,a), Mat_<_Tp>, Scalar) -CV_MAT_AUG_OPERATOR_T(+=, cv::add(a,b,a), Mat_<_Tp>, Mat_<_Tp>) -CV_MAT_AUG_OPERATOR_TN(+=, cv::add(a,Mat(b),a), Mat) -CV_MAT_AUG_OPERATOR_TN(+=, cv::add(a,Mat(b),a), Mat_<_Tp>) - -CV_MAT_AUG_OPERATOR (-=, cv::subtract(a,b,a), Mat, Mat) -CV_MAT_AUG_OPERATOR (-=, cv::subtract(a,b,a), Mat, Scalar) -CV_MAT_AUG_OPERATOR_T(-=, cv::subtract(a,b,a), Mat_<_Tp>, Mat) -CV_MAT_AUG_OPERATOR_T(-=, cv::subtract(a,b,a), Mat_<_Tp>, Scalar) -CV_MAT_AUG_OPERATOR_T(-=, cv::subtract(a,b,a), Mat_<_Tp>, Mat_<_Tp>) -CV_MAT_AUG_OPERATOR_TN(-=, cv::subtract(a,Mat(b),a), Mat) -CV_MAT_AUG_OPERATOR_TN(-=, cv::subtract(a,Mat(b),a), Mat_<_Tp>) - -CV_MAT_AUG_OPERATOR (*=, cv::gemm(a, b, 1, Mat(), 0, a, 0), Mat, Mat) -CV_MAT_AUG_OPERATOR_T(*=, cv::gemm(a, b, 1, Mat(), 0, a, 0), Mat_<_Tp>, Mat) -CV_MAT_AUG_OPERATOR_T(*=, cv::gemm(a, b, 1, Mat(), 0, a, 0), Mat_<_Tp>, Mat_<_Tp>) -CV_MAT_AUG_OPERATOR (*=, a.convertTo(a, -1, b), Mat, double) -CV_MAT_AUG_OPERATOR_T(*=, a.convertTo(a, -1, b), Mat_<_Tp>, double) -CV_MAT_AUG_OPERATOR_TN(*=, cv::gemm(a, Mat(b), 1, Mat(), 0, a, 0), Mat) -CV_MAT_AUG_OPERATOR_TN(*=, cv::gemm(a, Mat(b), 1, Mat(), 0, a, 0), Mat_<_Tp>) - -CV_MAT_AUG_OPERATOR (/=, cv::divide(a,b,a), Mat, Mat) -CV_MAT_AUG_OPERATOR_T(/=, cv::divide(a,b,a), Mat_<_Tp>, Mat) -CV_MAT_AUG_OPERATOR_T(/=, cv::divide(a,b,a), Mat_<_Tp>, Mat_<_Tp>) -CV_MAT_AUG_OPERATOR (/=, a.convertTo((Mat&)a, -1, 1./b), Mat, double) -CV_MAT_AUG_OPERATOR_T(/=, a.convertTo((Mat&)a, -1, 1./b), Mat_<_Tp>, double) -CV_MAT_AUG_OPERATOR_TN(/=, cv::divide(a, Mat(b), a), Mat) -CV_MAT_AUG_OPERATOR_TN(/=, cv::divide(a, Mat(b), a), Mat_<_Tp>) - -CV_MAT_AUG_OPERATOR (&=, cv::bitwise_and(a,b,a), Mat, Mat) -CV_MAT_AUG_OPERATOR (&=, cv::bitwise_and(a,b,a), Mat, Scalar) -CV_MAT_AUG_OPERATOR_T(&=, cv::bitwise_and(a,b,a), Mat_<_Tp>, Mat) -CV_MAT_AUG_OPERATOR_T(&=, cv::bitwise_and(a,b,a), Mat_<_Tp>, Scalar) -CV_MAT_AUG_OPERATOR_T(&=, cv::bitwise_and(a,b,a), Mat_<_Tp>, Mat_<_Tp>) -CV_MAT_AUG_OPERATOR_TN(&=, cv::bitwise_and(a, Mat(b), a), Mat) -CV_MAT_AUG_OPERATOR_TN(&=, cv::bitwise_and(a, Mat(b), a), Mat_<_Tp>) - -CV_MAT_AUG_OPERATOR (|=, cv::bitwise_or(a,b,a), Mat, Mat) -CV_MAT_AUG_OPERATOR (|=, cv::bitwise_or(a,b,a), Mat, Scalar) -CV_MAT_AUG_OPERATOR_T(|=, cv::bitwise_or(a,b,a), Mat_<_Tp>, Mat) -CV_MAT_AUG_OPERATOR_T(|=, cv::bitwise_or(a,b,a), Mat_<_Tp>, Scalar) -CV_MAT_AUG_OPERATOR_T(|=, cv::bitwise_or(a,b,a), Mat_<_Tp>, Mat_<_Tp>) -CV_MAT_AUG_OPERATOR_TN(|=, cv::bitwise_or(a, Mat(b), a), Mat) -CV_MAT_AUG_OPERATOR_TN(|=, cv::bitwise_or(a, Mat(b), a), Mat_<_Tp>) - -CV_MAT_AUG_OPERATOR (^=, cv::bitwise_xor(a,b,a), Mat, Mat) -CV_MAT_AUG_OPERATOR (^=, cv::bitwise_xor(a,b,a), Mat, Scalar) -CV_MAT_AUG_OPERATOR_T(^=, cv::bitwise_xor(a,b,a), Mat_<_Tp>, Mat) -CV_MAT_AUG_OPERATOR_T(^=, cv::bitwise_xor(a,b,a), Mat_<_Tp>, Scalar) -CV_MAT_AUG_OPERATOR_T(^=, cv::bitwise_xor(a,b,a), Mat_<_Tp>, Mat_<_Tp>) -CV_MAT_AUG_OPERATOR_TN(^=, cv::bitwise_xor(a, Mat(b), a), Mat) -CV_MAT_AUG_OPERATOR_TN(^=, cv::bitwise_xor(a, Mat(b), a), Mat_<_Tp>) - -#undef CV_MAT_AUG_OPERATOR_TN -#undef CV_MAT_AUG_OPERATOR_T -#undef CV_MAT_AUG_OPERATOR -#undef CV_MAT_AUG_OPERATOR1 - - - -///////////////////////////////////////////// SVD ///////////////////////////////////////////// - -inline SVD::SVD() {} -inline SVD::SVD( InputArray m, int flags ) { operator ()(m, flags); } -inline void SVD::solveZ( InputArray m, OutputArray _dst ) -{ - Mat mtx = m.getMat(); - SVD svd(mtx, (mtx.rows >= mtx.cols ? 0 : SVD::FULL_UV)); - _dst.create(svd.vt.cols, 1, svd.vt.type()); - Mat dst = _dst.getMat(); - svd.vt.row(svd.vt.rows-1).reshape(1,svd.vt.cols).copyTo(dst); -} - -template inline void - SVD::compute( const Matx<_Tp, m, n>& a, Matx<_Tp, nm, 1>& w, Matx<_Tp, m, nm>& u, Matx<_Tp, n, nm>& vt ) -{ - CV_StaticAssert( nm == MIN(m, n), "Invalid size of output vector."); - Mat _a(a, false), _u(u, false), _w(w, false), _vt(vt, false); - SVD::compute(_a, _w, _u, _vt); - CV_Assert(_w.data == (uchar*)&w.val[0] && _u.data == (uchar*)&u.val[0] && _vt.data == (uchar*)&vt.val[0]); -} - -template inline void -SVD::compute( const Matx<_Tp, m, n>& a, Matx<_Tp, nm, 1>& w ) -{ - CV_StaticAssert( nm == MIN(m, n), "Invalid size of output vector."); - Mat _a(a, false), _w(w, false); - SVD::compute(_a, _w); - CV_Assert(_w.data == (uchar*)&w.val[0]); -} - -template inline void -SVD::backSubst( const Matx<_Tp, nm, 1>& w, const Matx<_Tp, m, nm>& u, - const Matx<_Tp, n, nm>& vt, const Matx<_Tp, m, nb>& rhs, - Matx<_Tp, n, nb>& dst ) -{ - CV_StaticAssert( nm == MIN(m, n), "Invalid size of output vector."); - Mat _u(u, false), _w(w, false), _vt(vt, false), _rhs(rhs, false), _dst(dst, false); - SVD::backSubst(_w, _u, _vt, _rhs, _dst); - CV_Assert(_dst.data == (uchar*)&dst.val[0]); -} - - - -/////////////////////////////////// Multiply-with-Carry RNG /////////////////////////////////// - -inline RNG::RNG() { state = 0xffffffff; } -inline RNG::RNG(uint64 _state) { state = _state ? _state : 0xffffffff; } - -inline RNG::operator uchar() { return (uchar)next(); } -inline RNG::operator schar() { return (schar)next(); } -inline RNG::operator ushort() { return (ushort)next(); } -inline RNG::operator short() { return (short)next(); } -inline RNG::operator int() { return (int)next(); } -inline RNG::operator unsigned() { return next(); } -inline RNG::operator float() { return next()*2.3283064365386962890625e-10f; } -inline RNG::operator double() { unsigned t = next(); return (((uint64)t << 32) | next()) * 5.4210108624275221700372640043497e-20; } - -inline unsigned RNG::operator ()(unsigned N) { return (unsigned)uniform(0,N); } -inline unsigned RNG::operator ()() { return next(); } - -inline int RNG::uniform(int a, int b) { return a == b ? a : (int)(next() % (b - a) + a); } -inline float RNG::uniform(float a, float b) { return ((float)*this)*(b - a) + a; } -inline double RNG::uniform(double a, double b) { return ((double)*this)*(b - a) + a; } - -inline bool RNG::operator ==(const RNG& other) const { return state == other.state; } - -inline unsigned RNG::next() -{ - state = (uint64)(unsigned)state* /*CV_RNG_COEFF*/ 4164903690U + (unsigned)(state >> 32); - return (unsigned)state; -} - -//! returns the next unifomly-distributed random number of the specified type -template static inline _Tp randu() -{ - return (_Tp)theRNG(); -} - -///////////////////////////////// Formatted string generation ///////////////////////////////// - -/** @brief Returns a text string formatted using the printf-like expression. - -The function acts like sprintf but forms and returns an STL string. It can be used to form an error -message in the Exception constructor. -@param fmt printf-compatible formatting specifiers. - */ -CV_EXPORTS String format( const char* fmt, ... ); - -///////////////////////////////// Formatted output of cv::Mat ///////////////////////////////// - -static inline -Ptr format(InputArray mtx, int fmt) -{ - return Formatter::get(fmt)->format(mtx.getMat()); -} - -static inline -int print(Ptr fmtd, FILE* stream = stdout) -{ - int written = 0; - fmtd->reset(); - for(const char* str = fmtd->next(); str; str = fmtd->next()) - written += fputs(str, stream); - - return written; -} - -static inline -int print(const Mat& mtx, FILE* stream = stdout) -{ - return print(Formatter::get()->format(mtx), stream); -} - -static inline -int print(const UMat& mtx, FILE* stream = stdout) -{ - return print(Formatter::get()->format(mtx.getMat(ACCESS_READ)), stream); -} - -template static inline -int print(const std::vector >& vec, FILE* stream = stdout) -{ - return print(Formatter::get()->format(Mat(vec)), stream); -} - -template static inline -int print(const std::vector >& vec, FILE* stream = stdout) -{ - return print(Formatter::get()->format(Mat(vec)), stream); -} - -template static inline -int print(const Matx<_Tp, m, n>& matx, FILE* stream = stdout) -{ - return print(Formatter::get()->format(cv::Mat(matx)), stream); -} - -//! @endcond - -/****************************************************************************************\ -* Auxiliary algorithms * -\****************************************************************************************/ - -/** @brief Splits an element set into equivalency classes. - -The generic function partition implements an \f$O(N^2)\f$ algorithm for splitting a set of \f$N\f$ elements -into one or more equivalency classes, as described in - . The function returns the number of -equivalency classes. -@param _vec Set of elements stored as a vector. -@param labels Output vector of labels. It contains as many elements as vec. Each label labels[i] is -a 0-based cluster index of `vec[i]`. -@param predicate Equivalence predicate (pointer to a boolean function of two arguments or an -instance of the class that has the method bool operator()(const _Tp& a, const _Tp& b) ). The -predicate returns true when the elements are certainly in the same class, and returns false if they -may or may not be in the same class. -@ingroup core_cluster -*/ -template int -partition( const std::vector<_Tp>& _vec, std::vector& labels, - _EqPredicate predicate=_EqPredicate()) -{ - int i, j, N = (int)_vec.size(); - const _Tp* vec = &_vec[0]; - - const int PARENT=0; - const int RANK=1; - - std::vector _nodes(N*2); - int (*nodes)[2] = (int(*)[2])&_nodes[0]; - - // The first O(N) pass: create N single-vertex trees - for(i = 0; i < N; i++) - { - nodes[i][PARENT]=-1; - nodes[i][RANK] = 0; - } - - // The main O(N^2) pass: merge connected components - for( i = 0; i < N; i++ ) - { - int root = i; - - // find root - while( nodes[root][PARENT] >= 0 ) - root = nodes[root][PARENT]; - - for( j = 0; j < N; j++ ) - { - if( i == j || !predicate(vec[i], vec[j])) - continue; - int root2 = j; - - while( nodes[root2][PARENT] >= 0 ) - root2 = nodes[root2][PARENT]; - - if( root2 != root ) - { - // unite both trees - int rank = nodes[root][RANK], rank2 = nodes[root2][RANK]; - if( rank > rank2 ) - nodes[root2][PARENT] = root; - else - { - nodes[root][PARENT] = root2; - nodes[root2][RANK] += rank == rank2; - root = root2; - } - CV_Assert( nodes[root][PARENT] < 0 ); - - int k = j, parent; - - // compress the path from node2 to root - while( (parent = nodes[k][PARENT]) >= 0 ) - { - nodes[k][PARENT] = root; - k = parent; - } - - // compress the path from node to root - k = i; - while( (parent = nodes[k][PARENT]) >= 0 ) - { - nodes[k][PARENT] = root; - k = parent; - } - } - } - } - - // Final O(N) pass: enumerate classes - labels.resize(N); - int nclasses = 0; - - for( i = 0; i < N; i++ ) - { - int root = i; - while( nodes[root][PARENT] >= 0 ) - root = nodes[root][PARENT]; - // re-use the rank as the class label - if( nodes[root][RANK] >= 0 ) - nodes[root][RANK] = ~nclasses++; - labels[i] = ~nodes[root][RANK]; - } - - return nclasses; -} - -} // cv - -#endif diff --git a/opencv/include/opencv2/core/optim.hpp b/opencv/include/opencv2/core/optim.hpp deleted file mode 100644 index c4729a9..0000000 --- a/opencv/include/opencv2/core/optim.hpp +++ /dev/null @@ -1,302 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the OpenCV Foundation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OPTIM_HPP -#define OPENCV_OPTIM_HPP - -#include "opencv2/core.hpp" - -namespace cv -{ - -/** @addtogroup core_optim -The algorithms in this section minimize or maximize function value within specified constraints or -without any constraints. -@{ -*/ - -/** @brief Basic interface for all solvers - */ -class CV_EXPORTS MinProblemSolver : public Algorithm -{ -public: - /** @brief Represents function being optimized - */ - class CV_EXPORTS Function - { - public: - virtual ~Function() {} - virtual int getDims() const = 0; - virtual double getGradientEps() const; - virtual double calc(const double* x) const = 0; - virtual void getGradient(const double* x,double* grad); - }; - - /** @brief Getter for the optimized function. - - The optimized function is represented by Function interface, which requires derivatives to - implement the calc(double*) and getDim() methods to evaluate the function. - - @return Smart-pointer to an object that implements Function interface - it represents the - function that is being optimized. It can be empty, if no function was given so far. - */ - virtual Ptr getFunction() const = 0; - - /** @brief Setter for the optimized function. - - *It should be called at least once before the call to* minimize(), as default value is not usable. - - @param f The new function to optimize. - */ - virtual void setFunction(const Ptr& f) = 0; - - /** @brief Getter for the previously set terminal criteria for this algorithm. - - @return Deep copy of the terminal criteria used at the moment. - */ - virtual TermCriteria getTermCriteria() const = 0; - - /** @brief Set terminal criteria for solver. - - This method *is not necessary* to be called before the first call to minimize(), as the default - value is sensible. - - Algorithm stops when the number of function evaluations done exceeds termcrit.maxCount, when - the function values at the vertices of simplex are within termcrit.epsilon range or simplex - becomes so small that it can enclosed in a box with termcrit.epsilon sides, whatever comes - first. - @param termcrit Terminal criteria to be used, represented as cv::TermCriteria structure. - */ - virtual void setTermCriteria(const TermCriteria& termcrit) = 0; - - /** @brief actually runs the algorithm and performs the minimization. - - The sole input parameter determines the centroid of the starting simplex (roughly, it tells - where to start), all the others (terminal criteria, initial step, function to be minimized) are - supposed to be set via the setters before the call to this method or the default values (not - always sensible) will be used. - - @param x The initial point, that will become a centroid of an initial simplex. After the algorithm - will terminate, it will be set to the point where the algorithm stops, the point of possible - minimum. - @return The value of a function at the point found. - */ - virtual double minimize(InputOutputArray x) = 0; -}; - -/** @brief This class is used to perform the non-linear non-constrained minimization of a function, - -defined on an `n`-dimensional Euclidean space, using the **Nelder-Mead method**, also known as -**downhill simplex method**. The basic idea about the method can be obtained from -. - -It should be noted, that this method, although deterministic, is rather a heuristic and therefore -may converge to a local minima, not necessary a global one. It is iterative optimization technique, -which at each step uses an information about the values of a function evaluated only at `n+1` -points, arranged as a *simplex* in `n`-dimensional space (hence the second name of the method). At -each step new point is chosen to evaluate function at, obtained value is compared with previous -ones and based on this information simplex changes it's shape , slowly moving to the local minimum. -Thus this method is using *only* function values to make decision, on contrary to, say, Nonlinear -Conjugate Gradient method (which is also implemented in optim). - -Algorithm stops when the number of function evaluations done exceeds termcrit.maxCount, when the -function values at the vertices of simplex are within termcrit.epsilon range or simplex becomes so -small that it can enclosed in a box with termcrit.epsilon sides, whatever comes first, for some -defined by user positive integer termcrit.maxCount and positive non-integer termcrit.epsilon. - -@note DownhillSolver is a derivative of the abstract interface -cv::MinProblemSolver, which in turn is derived from the Algorithm interface and is used to -encapsulate the functionality, common to all non-linear optimization algorithms in the optim -module. - -@note term criteria should meet following condition: -@code - termcrit.type == (TermCriteria::MAX_ITER + TermCriteria::EPS) && termcrit.epsilon > 0 && termcrit.maxCount > 0 -@endcode - */ -class CV_EXPORTS DownhillSolver : public MinProblemSolver -{ -public: - /** @brief Returns the initial step that will be used in downhill simplex algorithm. - - @param step Initial step that will be used in algorithm. Note, that although corresponding setter - accepts column-vectors as well as row-vectors, this method will return a row-vector. - @see DownhillSolver::setInitStep - */ - virtual void getInitStep(OutputArray step) const=0; - - /** @brief Sets the initial step that will be used in downhill simplex algorithm. - - Step, together with initial point (givin in DownhillSolver::minimize) are two `n`-dimensional - vectors that are used to determine the shape of initial simplex. Roughly said, initial point - determines the position of a simplex (it will become simplex's centroid), while step determines the - spread (size in each dimension) of a simplex. To be more precise, if \f$s,x_0\in\mathbb{R}^n\f$ are - the initial step and initial point respectively, the vertices of a simplex will be: - \f$v_0:=x_0-\frac{1}{2} s\f$ and \f$v_i:=x_0+s_i\f$ for \f$i=1,2,\dots,n\f$ where \f$s_i\f$ denotes - projections of the initial step of *n*-th coordinate (the result of projection is treated to be - vector given by \f$s_i:=e_i\cdot\left\f$, where \f$e_i\f$ form canonical basis) - - @param step Initial step that will be used in algorithm. Roughly said, it determines the spread - (size in each dimension) of an initial simplex. - */ - virtual void setInitStep(InputArray step)=0; - - /** @brief This function returns the reference to the ready-to-use DownhillSolver object. - - All the parameters are optional, so this procedure can be called even without parameters at - all. In this case, the default values will be used. As default value for terminal criteria are - the only sensible ones, MinProblemSolver::setFunction() and DownhillSolver::setInitStep() - should be called upon the obtained object, if the respective parameters were not given to - create(). Otherwise, the two ways (give parameters to createDownhillSolver() or miss them out - and call the MinProblemSolver::setFunction() and DownhillSolver::setInitStep()) are absolutely - equivalent (and will drop the same errors in the same way, should invalid input be detected). - @param f Pointer to the function that will be minimized, similarly to the one you submit via - MinProblemSolver::setFunction. - @param initStep Initial step, that will be used to construct the initial simplex, similarly to the one - you submit via MinProblemSolver::setInitStep. - @param termcrit Terminal criteria to the algorithm, similarly to the one you submit via - MinProblemSolver::setTermCriteria. - */ - static Ptr create(const Ptr& f=Ptr(), - InputArray initStep=Mat_(1,1,0.0), - TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5000,0.000001)); -}; - -/** @brief This class is used to perform the non-linear non-constrained minimization of a function -with known gradient, - -defined on an *n*-dimensional Euclidean space, using the **Nonlinear Conjugate Gradient method**. -The implementation was done based on the beautifully clear explanatory article [An Introduction to -the Conjugate Gradient Method Without the Agonizing -Pain](http://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf) by Jonathan Richard -Shewchuk. The method can be seen as an adaptation of a standard Conjugate Gradient method (see, for -example ) for numerically solving the -systems of linear equations. - -It should be noted, that this method, although deterministic, is rather a heuristic method and -therefore may converge to a local minima, not necessary a global one. What is even more disastrous, -most of its behaviour is ruled by gradient, therefore it essentially cannot distinguish between -local minima and maxima. Therefore, if it starts sufficiently near to the local maximum, it may -converge to it. Another obvious restriction is that it should be possible to compute the gradient of -a function at any point, thus it is preferable to have analytic expression for gradient and -computational burden should be born by the user. - -The latter responsibility is accompilished via the getGradient method of a -MinProblemSolver::Function interface (which represents function being optimized). This method takes -point a point in *n*-dimensional space (first argument represents the array of coordinates of that -point) and comput its gradient (it should be stored in the second argument as an array). - -@note class ConjGradSolver thus does not add any new methods to the basic MinProblemSolver interface. - -@note term criteria should meet following condition: -@code - termcrit.type == (TermCriteria::MAX_ITER + TermCriteria::EPS) && termcrit.epsilon > 0 && termcrit.maxCount > 0 - // or - termcrit.type == TermCriteria::MAX_ITER) && termcrit.maxCount > 0 -@endcode - */ -class CV_EXPORTS ConjGradSolver : public MinProblemSolver -{ -public: - /** @brief This function returns the reference to the ready-to-use ConjGradSolver object. - - All the parameters are optional, so this procedure can be called even without parameters at - all. In this case, the default values will be used. As default value for terminal criteria are - the only sensible ones, MinProblemSolver::setFunction() should be called upon the obtained - object, if the function was not given to create(). Otherwise, the two ways (submit it to - create() or miss it out and call the MinProblemSolver::setFunction()) are absolutely equivalent - (and will drop the same errors in the same way, should invalid input be detected). - @param f Pointer to the function that will be minimized, similarly to the one you submit via - MinProblemSolver::setFunction. - @param termcrit Terminal criteria to the algorithm, similarly to the one you submit via - MinProblemSolver::setTermCriteria. - */ - static Ptr create(const Ptr& f=Ptr(), - TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5000,0.000001)); -}; - -//! return codes for cv::solveLP() function -enum SolveLPResult -{ - SOLVELP_UNBOUNDED = -2, //!< problem is unbounded (target function can achieve arbitrary high values) - SOLVELP_UNFEASIBLE = -1, //!< problem is unfeasible (there are no points that satisfy all the constraints imposed) - SOLVELP_SINGLE = 0, //!< there is only one maximum for target function - SOLVELP_MULTI = 1 //!< there are multiple maxima for target function - the arbitrary one is returned -}; - -/** @brief Solve given (non-integer) linear programming problem using the Simplex Algorithm (Simplex Method). - -What we mean here by "linear programming problem" (or LP problem, for short) can be formulated as: - -\f[\mbox{Maximize } c\cdot x\\ - \mbox{Subject to:}\\ - Ax\leq b\\ - x\geq 0\f] - -Where \f$c\f$ is fixed `1`-by-`n` row-vector, \f$A\f$ is fixed `m`-by-`n` matrix, \f$b\f$ is fixed `m`-by-`1` -column vector and \f$x\f$ is an arbitrary `n`-by-`1` column vector, which satisfies the constraints. - -Simplex algorithm is one of many algorithms that are designed to handle this sort of problems -efficiently. Although it is not optimal in theoretical sense (there exist algorithms that can solve -any problem written as above in polynomial time, while simplex method degenerates to exponential -time for some special cases), it is well-studied, easy to implement and is shown to work well for -real-life purposes. - -The particular implementation is taken almost verbatim from **Introduction to Algorithms, third -edition** by T. H. Cormen, C. E. Leiserson, R. L. Rivest and Clifford Stein. In particular, the -Bland's rule is used to prevent cycling. - -@param Func This row-vector corresponds to \f$c\f$ in the LP problem formulation (see above). It should -contain 32- or 64-bit floating point numbers. As a convenience, column-vector may be also submitted, -in the latter case it is understood to correspond to \f$c^T\f$. -@param Constr `m`-by-`n+1` matrix, whose rightmost column corresponds to \f$b\f$ in formulation above -and the remaining to \f$A\f$. It should contain 32- or 64-bit floating point numbers. -@param z The solution will be returned here as a column-vector - it corresponds to \f$c\f$ in the -formulation above. It will contain 64-bit floating point numbers. -@return One of cv::SolveLPResult - */ -CV_EXPORTS_W int solveLP(const Mat& Func, const Mat& Constr, Mat& z); - -//! @} - -}// cv - -#endif diff --git a/opencv/include/opencv2/core/ovx.hpp b/opencv/include/opencv2/core/ovx.hpp deleted file mode 100644 index 8bb7d54..0000000 --- a/opencv/include/opencv2/core/ovx.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -// Copyright (C) 2016, Intel Corporation, all rights reserved. -// Third party copyrights are property of their respective owners. - -// OpenVX related definitions and declarations - -#pragma once -#ifndef OPENCV_OVX_HPP -#define OPENCV_OVX_HPP - -#include "cvdef.h" - -namespace cv -{ -/// Check if use of OpenVX is possible -CV_EXPORTS_W bool haveOpenVX(); - -/// Check if use of OpenVX is enabled -CV_EXPORTS_W bool useOpenVX(); - -/// Enable/disable use of OpenVX -CV_EXPORTS_W void setUseOpenVX(bool flag); -} // namespace cv - -#endif // OPENCV_OVX_HPP diff --git a/opencv/include/opencv2/core/persistence.hpp b/opencv/include/opencv2/core/persistence.hpp deleted file mode 100644 index 126393f..0000000 --- a/opencv/include/opencv2/core/persistence.hpp +++ /dev/null @@ -1,1366 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_PERSISTENCE_HPP -#define OPENCV_CORE_PERSISTENCE_HPP - -#ifndef CV_DOXYGEN -/// Define to support persistence legacy formats -#define CV__LEGACY_PERSISTENCE -#endif - -#ifndef __cplusplus -# error persistence.hpp header must be compiled as C++ -#endif - -//! @addtogroup core_c -//! @{ - -/** @brief "black box" representation of the file storage associated with a file on disk. - -Several functions that are described below take CvFileStorage\* as inputs and allow the user to -save or to load hierarchical collections that consist of scalar values, standard CXCore objects -(such as matrices, sequences, graphs), and user-defined objects. - -OpenCV can read and write data in XML (), YAML () or -JSON () formats. Below is an example of 3x3 floating-point identity matrix A, -stored in XML and YAML files -using CXCore functions: -XML: -@code{.xml} - - - - 3 - 3 -
f
- 1. 0. 0. 0. 1. 0. 0. 0. 1. -
-
-@endcode -YAML: -@code{.yaml} - %YAML:1.0 - A: !!opencv-matrix - rows: 3 - cols: 3 - dt: f - data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1.] -@endcode -As it can be seen from the examples, XML uses nested tags to represent hierarchy, while YAML uses -indentation for that purpose (similar to the Python programming language). - -The same functions can read and write data in both formats; the particular format is determined by -the extension of the opened file, ".xml" for XML files, ".yml" or ".yaml" for YAML and ".json" for -JSON. - */ -typedef struct CvFileStorage CvFileStorage; -typedef struct CvFileNode CvFileNode; -typedef struct CvMat CvMat; -typedef struct CvMatND CvMatND; - -//! @} core_c - -#include "opencv2/core/types.hpp" -#include "opencv2/core/mat.hpp" - -namespace cv { - -/** @addtogroup core_xml - -XML/YAML/JSON file storages. {#xml_storage} -======================= -Writing to a file storage. --------------------------- -You can store and then restore various OpenCV data structures to/from XML (), -YAML () or JSON () formats. Also, it is possible to store -and load arbitrarily complex data structures, which include OpenCV data structures, as well as -primitive data types (integer and floating-point numbers and text strings) as their elements. - -Use the following procedure to write something to XML, YAML or JSON: --# Create new FileStorage and open it for writing. It can be done with a single call to -FileStorage::FileStorage constructor that takes a filename, or you can use the default constructor -and then call FileStorage::open. Format of the file (XML, YAML or JSON) is determined from the filename -extension (".xml", ".yml"/".yaml" and ".json", respectively) --# Write all the data you want using the streaming operator `<<`, just like in the case of STL -streams. --# Close the file using FileStorage::release. FileStorage destructor also closes the file. - -Here is an example: -@code - #include "opencv2/opencv.hpp" - #include - - using namespace cv; - - int main(int, char** argv) - { - FileStorage fs("test.yml", FileStorage::WRITE); - - fs << "frameCount" << 5; - time_t rawtime; time(&rawtime); - fs << "calibrationDate" << asctime(localtime(&rawtime)); - Mat cameraMatrix = (Mat_(3,3) << 1000, 0, 320, 0, 1000, 240, 0, 0, 1); - Mat distCoeffs = (Mat_(5,1) << 0.1, 0.01, -0.001, 0, 0); - fs << "cameraMatrix" << cameraMatrix << "distCoeffs" << distCoeffs; - fs << "features" << "["; - for( int i = 0; i < 3; i++ ) - { - int x = rand() % 640; - int y = rand() % 480; - uchar lbp = rand() % 256; - - fs << "{:" << "x" << x << "y" << y << "lbp" << "[:"; - for( int j = 0; j < 8; j++ ) - fs << ((lbp >> j) & 1); - fs << "]" << "}"; - } - fs << "]"; - fs.release(); - return 0; - } -@endcode -The sample above stores to YML an integer, a text string (calibration date), 2 matrices, and a custom -structure "feature", which includes feature coordinates and LBP (local binary pattern) value. Here -is output of the sample: -@code{.yaml} -%YAML:1.0 -frameCount: 5 -calibrationDate: "Fri Jun 17 14:09:29 2011\n" -cameraMatrix: !!opencv-matrix - rows: 3 - cols: 3 - dt: d - data: [ 1000., 0., 320., 0., 1000., 240., 0., 0., 1. ] -distCoeffs: !!opencv-matrix - rows: 5 - cols: 1 - dt: d - data: [ 1.0000000000000001e-01, 1.0000000000000000e-02, - -1.0000000000000000e-03, 0., 0. ] -features: - - { x:167, y:49, lbp:[ 1, 0, 0, 1, 1, 0, 1, 1 ] } - - { x:298, y:130, lbp:[ 0, 0, 0, 1, 0, 0, 1, 1 ] } - - { x:344, y:158, lbp:[ 1, 1, 0, 0, 0, 0, 1, 0 ] } -@endcode - -As an exercise, you can replace ".yml" with ".xml" or ".json" in the sample above and see, how the -corresponding XML file will look like. - -Several things can be noted by looking at the sample code and the output: - -- The produced YAML (and XML/JSON) consists of heterogeneous collections that can be nested. There are - 2 types of collections: named collections (mappings) and unnamed collections (sequences). In mappings - each element has a name and is accessed by name. This is similar to structures and std::map in - C/C++ and dictionaries in Python. In sequences elements do not have names, they are accessed by - indices. This is similar to arrays and std::vector in C/C++ and lists, tuples in Python. - "Heterogeneous" means that elements of each single collection can have different types. - - Top-level collection in YAML/XML/JSON is a mapping. Each matrix is stored as a mapping, and the matrix - elements are stored as a sequence. Then, there is a sequence of features, where each feature is - represented a mapping, and lbp value in a nested sequence. - -- When you write to a mapping (a structure), you write element name followed by its value. When you - write to a sequence, you simply write the elements one by one. OpenCV data structures (such as - cv::Mat) are written in absolutely the same way as simple C data structures - using `<<` - operator. - -- To write a mapping, you first write the special string `{` to the storage, then write the - elements as pairs (`fs << << `) and then write the closing - `}`. - -- To write a sequence, you first write the special string `[`, then write the elements, then - write the closing `]`. - -- In YAML/JSON (but not XML), mappings and sequences can be written in a compact Python-like inline - form. In the sample above matrix elements, as well as each feature, including its lbp value, is - stored in such inline form. To store a mapping/sequence in a compact form, put `:` after the - opening character, e.g. use `{:` instead of `{` and `[:` instead of `[`. When the - data is written to XML, those extra `:` are ignored. - -Reading data from a file storage. ---------------------------------- -To read the previously written XML, YAML or JSON file, do the following: --# Open the file storage using FileStorage::FileStorage constructor or FileStorage::open method. - In the current implementation the whole file is parsed and the whole representation of file - storage is built in memory as a hierarchy of file nodes (see FileNode) - --# Read the data you are interested in. Use FileStorage::operator [], FileNode::operator [] - and/or FileNodeIterator. - --# Close the storage using FileStorage::release. - -Here is how to read the file created by the code sample above: -@code - FileStorage fs2("test.yml", FileStorage::READ); - - // first method: use (type) operator on FileNode. - int frameCount = (int)fs2["frameCount"]; - - String date; - // second method: use FileNode::operator >> - fs2["calibrationDate"] >> date; - - Mat cameraMatrix2, distCoeffs2; - fs2["cameraMatrix"] >> cameraMatrix2; - fs2["distCoeffs"] >> distCoeffs2; - - cout << "frameCount: " << frameCount << endl - << "calibration date: " << date << endl - << "camera matrix: " << cameraMatrix2 << endl - << "distortion coeffs: " << distCoeffs2 << endl; - - FileNode features = fs2["features"]; - FileNodeIterator it = features.begin(), it_end = features.end(); - int idx = 0; - std::vector lbpval; - - // iterate through a sequence using FileNodeIterator - for( ; it != it_end; ++it, idx++ ) - { - cout << "feature #" << idx << ": "; - cout << "x=" << (int)(*it)["x"] << ", y=" << (int)(*it)["y"] << ", lbp: ("; - // you can also easily read numerical arrays using FileNode >> std::vector operator. - (*it)["lbp"] >> lbpval; - for( int i = 0; i < (int)lbpval.size(); i++ ) - cout << " " << (int)lbpval[i]; - cout << ")" << endl; - } - fs2.release(); -@endcode - -Format specification {#format_spec} --------------------- -`([count]{u|c|w|s|i|f|d})`... where the characters correspond to fundamental C++ types: -- `u` 8-bit unsigned number -- `c` 8-bit signed number -- `w` 16-bit unsigned number -- `s` 16-bit signed number -- `i` 32-bit signed number -- `f` single precision floating-point number -- `d` double precision floating-point number -- `r` pointer, 32 lower bits of which are written as a signed integer. The type can be used to - store structures with links between the elements. - -`count` is the optional counter of values of a given type. For example, `2if` means that each array -element is a structure of 2 integers, followed by a single-precision floating-point number. The -equivalent notations of the above specification are `iif`, `2i1f` and so forth. Other examples: `u` -means that the array consists of bytes, and `2d` means the array consists of pairs of doubles. - -@see @ref samples/cpp/filestorage.cpp -*/ - -//! @{ - -/** @example samples/cpp/filestorage.cpp -A complete example using the FileStorage interface -*/ - -////////////////////////// XML & YAML I/O ////////////////////////// - -class CV_EXPORTS FileNode; -class CV_EXPORTS FileNodeIterator; - -/** @brief XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or -reading data to/from a file. - */ -class CV_EXPORTS_W FileStorage -{ -public: - //! file storage mode - enum Mode - { - READ = 0, //!< value, open the file for reading - WRITE = 1, //!< value, open the file for writing - APPEND = 2, //!< value, open the file for appending - MEMORY = 4, //!< flag, read data from source or write data to the internal buffer (which is - //!< returned by FileStorage::release) - FORMAT_MASK = (7<<3), //!< mask for format flags - FORMAT_AUTO = 0, //!< flag, auto format - FORMAT_XML = (1<<3), //!< flag, XML format - FORMAT_YAML = (2<<3), //!< flag, YAML format - FORMAT_JSON = (3<<3), //!< flag, JSON format - - BASE64 = 64, //!< flag, write rawdata in Base64 by default. (consider using WRITE_BASE64) - WRITE_BASE64 = BASE64 | WRITE, //!< flag, enable both WRITE and BASE64 - }; - enum - { - UNDEFINED = 0, - VALUE_EXPECTED = 1, - NAME_EXPECTED = 2, - INSIDE_MAP = 4 - }; - - /** @brief The constructors. - - The full constructor opens the file. Alternatively you can use the default constructor and then - call FileStorage::open. - */ - CV_WRAP FileStorage(); - - /** @overload - @copydoc open() - */ - CV_WRAP FileStorage(const String& filename, int flags, const String& encoding=String()); - - /** @overload */ - FileStorage(CvFileStorage* fs, bool owning=true); - - //! the destructor. calls release() - virtual ~FileStorage(); - - /** @brief Opens a file. - - See description of parameters in FileStorage::FileStorage. The method calls FileStorage::release - before opening the file. - @param filename Name of the file to open or the text string to read the data from. - Extension of the file (.xml, .yml/.yaml or .json) determines its format (XML, YAML or JSON - respectively). Also you can append .gz to work with compressed files, for example myHugeMatrix.xml.gz. If both - FileStorage::WRITE and FileStorage::MEMORY flags are specified, source is used just to specify - the output file format (e.g. mydata.xml, .yml etc.). A file name can also contain parameters. - You can use this format, "*?base64" (e.g. "file.json?base64" (case sensitive)), as an alternative to - FileStorage::BASE64 flag. - @param flags Mode of operation. One of FileStorage::Mode - @param encoding Encoding of the file. Note that UTF-16 XML encoding is not supported currently and - you should use 8-bit encoding instead of it. - */ - CV_WRAP virtual bool open(const String& filename, int flags, const String& encoding=String()); - - /** @brief Checks whether the file is opened. - - @returns true if the object is associated with the current file and false otherwise. It is a - good practice to call this method after you tried to open a file. - */ - CV_WRAP virtual bool isOpened() const; - - /** @brief Closes the file and releases all the memory buffers. - - Call this method after all I/O operations with the storage are finished. - */ - CV_WRAP virtual void release(); - - /** @brief Closes the file and releases all the memory buffers. - - Call this method after all I/O operations with the storage are finished. If the storage was - opened for writing data and FileStorage::WRITE was specified - */ - CV_WRAP virtual String releaseAndGetString(); - - /** @brief Returns the first element of the top-level mapping. - @returns The first element of the top-level mapping. - */ - CV_WRAP FileNode getFirstTopLevelNode() const; - - /** @brief Returns the top-level mapping - @param streamidx Zero-based index of the stream. In most cases there is only one stream in the file. - However, YAML supports multiple streams and so there can be several. - @returns The top-level mapping. - */ - CV_WRAP FileNode root(int streamidx=0) const; - - /** @brief Returns the specified element of the top-level mapping. - @param nodename Name of the file node. - @returns Node with the given name. - */ - FileNode operator[](const String& nodename) const; - - /** @overload */ - CV_WRAP_AS(getNode) FileNode operator[](const char* nodename) const; - - /** @brief Returns the obsolete C FileStorage structure. - @returns Pointer to the underlying C FileStorage structure - */ - CvFileStorage* operator *() { return fs.get(); } - - /** @overload */ - const CvFileStorage* operator *() const { return fs.get(); } - - /** @brief Writes multiple numbers. - - Writes one or more numbers of the specified format to the currently written structure. Usually it is - more convenient to use operator `<<` instead of this method. - @param fmt Specification of each array element, see @ref format_spec "format specification" - @param vec Pointer to the written array. - @param len Number of the uchar elements to write. - */ - void writeRaw( const String& fmt, const uchar* vec, size_t len ); - - /** @brief Writes the registered C structure (CvMat, CvMatND, CvSeq). - @param name Name of the written object. - @param obj Pointer to the object. - @see ocvWrite for details. - */ - void writeObj( const String& name, const void* obj ); - - /** - * @brief Simplified writing API to use with bindings. - * @param name Name of the written object - * @param val Value of the written object - */ - CV_WRAP void write(const String& name, int val); - /// @overload - CV_WRAP void write(const String& name, double val); - /// @overload - CV_WRAP void write(const String& name, const String& val); - /// @overload - CV_WRAP void write(const String& name, InputArray val); - - /** @brief Writes a comment. - - The function writes a comment into file storage. The comments are skipped when the storage is read. - @param comment The written comment, single-line or multi-line - @param append If true, the function tries to put the comment at the end of current line. - Else if the comment is multi-line, or if it does not fit at the end of the current - line, the comment starts a new line. - */ - CV_WRAP void writeComment(const String& comment, bool append = false); - - /** @brief Returns the normalized object name for the specified name of a file. - @param filename Name of a file - @returns The normalized object name. - */ - static String getDefaultObjectName(const String& filename); - - /** @brief Returns the current format. - * @returns The current format, see FileStorage::Mode - */ - CV_WRAP int getFormat() const; - - Ptr fs; //!< the underlying C FileStorage structure - String elname; //!< the currently written element - std::vector structs; //!< the stack of written structures - int state; //!< the writer state -}; - -template<> CV_EXPORTS void DefaultDeleter::operator ()(CvFileStorage* obj) const; - -/** @brief File Storage Node class. - -The node is used to store each and every element of the file storage opened for reading. When -XML/YAML file is read, it is first parsed and stored in the memory as a hierarchical collection of -nodes. Each node can be a "leaf" that is contain a single number or a string, or be a collection of -other nodes. There can be named collections (mappings) where each element has a name and it is -accessed by a name, and ordered collections (sequences) where elements do not have names but rather -accessed by index. Type of the file node can be determined using FileNode::type method. - -Note that file nodes are only used for navigating file storages opened for reading. When a file -storage is opened for writing, no data is stored in memory after it is written. - */ -class CV_EXPORTS_W_SIMPLE FileNode -{ -public: - //! type of the file storage node - enum Type - { - NONE = 0, //!< empty node - INT = 1, //!< an integer - REAL = 2, //!< floating-point number - FLOAT = REAL, //!< synonym or REAL - STR = 3, //!< text string in UTF-8 encoding - STRING = STR, //!< synonym for STR - REF = 4, //!< integer of size size_t. Typically used for storing complex dynamic structures where some elements reference the others - SEQ = 5, //!< sequence - MAP = 6, //!< mapping - TYPE_MASK = 7, - FLOW = 8, //!< compact representation of a sequence or mapping. Used only by YAML writer - USER = 16, //!< a registered object (e.g. a matrix) - EMPTY = 32, //!< empty structure (sequence or mapping) - NAMED = 64 //!< the node has a name (i.e. it is element of a mapping) - }; - /** @brief The constructors. - - These constructors are used to create a default file node, construct it from obsolete structures or - from the another file node. - */ - CV_WRAP FileNode(); - - /** @overload - @param fs Pointer to the obsolete file storage structure. - @param node File node to be used as initialization for the created file node. - */ - FileNode(const CvFileStorage* fs, const CvFileNode* node); - - /** @overload - @param node File node to be used as initialization for the created file node. - */ - FileNode(const FileNode& node); - - /** @brief Returns element of a mapping node or a sequence node. - @param nodename Name of an element in the mapping node. - @returns Returns the element with the given identifier. - */ - FileNode operator[](const String& nodename) const; - - /** @overload - @param nodename Name of an element in the mapping node. - */ - CV_WRAP_AS(getNode) FileNode operator[](const char* nodename) const; - - /** @overload - @param i Index of an element in the sequence node. - */ - CV_WRAP_AS(at) FileNode operator[](int i) const; - - /** @brief Returns keys of a mapping node. - @returns Keys of a mapping node. - */ - CV_WRAP std::vector keys() const; - - /** @brief Returns type of the node. - @returns Type of the node. See FileNode::Type - */ - CV_WRAP int type() const; - - //! returns true if the node is empty - CV_WRAP bool empty() const; - //! returns true if the node is a "none" object - CV_WRAP bool isNone() const; - //! returns true if the node is a sequence - CV_WRAP bool isSeq() const; - //! returns true if the node is a mapping - CV_WRAP bool isMap() const; - //! returns true if the node is an integer - CV_WRAP bool isInt() const; - //! returns true if the node is a floating-point number - CV_WRAP bool isReal() const; - //! returns true if the node is a text string - CV_WRAP bool isString() const; - //! returns true if the node has a name - CV_WRAP bool isNamed() const; - //! returns the node name or an empty string if the node is nameless - CV_WRAP String name() const; - //! returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise. - CV_WRAP size_t size() const; - //! returns the node content as an integer. If the node stores floating-point number, it is rounded. - operator int() const; - //! returns the node content as float - operator float() const; - //! returns the node content as double - operator double() const; - //! returns the node content as text string - operator String() const; - operator std::string() const; - - //! returns pointer to the underlying file node - CvFileNode* operator *(); - //! returns pointer to the underlying file node - const CvFileNode* operator* () const; - - //! returns iterator pointing to the first node element - FileNodeIterator begin() const; - //! returns iterator pointing to the element following the last node element - FileNodeIterator end() const; - - /** @brief Reads node elements to the buffer with the specified format. - - Usually it is more convenient to use operator `>>` instead of this method. - @param fmt Specification of each array element. See @ref format_spec "format specification" - @param vec Pointer to the destination array. - @param len Number of elements to read. If it is greater than number of remaining elements then all - of them will be read. - */ - void readRaw( const String& fmt, uchar* vec, size_t len ) const; - - //! reads the registered object and returns pointer to it - void* readObj() const; - - //! Simplified reading API to use with bindings. - CV_WRAP double real() const; - //! Simplified reading API to use with bindings. - CV_WRAP String string() const; - //! Simplified reading API to use with bindings. - CV_WRAP Mat mat() const; - - // do not use wrapper pointer classes for better efficiency - const CvFileStorage* fs; - const CvFileNode* node; -}; - - -/** @brief used to iterate through sequences and mappings. - -A standard STL notation, with node.begin(), node.end() denoting the beginning and the end of a -sequence, stored in node. See the data reading sample in the beginning of the section. - */ -class CV_EXPORTS FileNodeIterator -{ -public: - /** @brief The constructors. - - These constructors are used to create a default iterator, set it to specific element in a file node - or construct it from another iterator. - */ - FileNodeIterator(); - - /** @overload - @param fs File storage for the iterator. - @param node File node for the iterator. - @param ofs Index of the element in the node. The created iterator will point to this element. - */ - FileNodeIterator(const CvFileStorage* fs, const CvFileNode* node, size_t ofs=0); - - /** @overload - @param it Iterator to be used as initialization for the created iterator. - */ - FileNodeIterator(const FileNodeIterator& it); - - //! returns the currently observed element - FileNode operator *() const; - //! accesses the currently observed element methods - FileNode operator ->() const; - - //! moves iterator to the next node - FileNodeIterator& operator ++ (); - //! moves iterator to the next node - FileNodeIterator operator ++ (int); - //! moves iterator to the previous node - FileNodeIterator& operator -- (); - //! moves iterator to the previous node - FileNodeIterator operator -- (int); - //! moves iterator forward by the specified offset (possibly negative) - FileNodeIterator& operator += (int ofs); - //! moves iterator backward by the specified offset (possibly negative) - FileNodeIterator& operator -= (int ofs); - - /** @brief Reads node elements to the buffer with the specified format. - - Usually it is more convenient to use operator `>>` instead of this method. - @param fmt Specification of each array element. See @ref format_spec "format specification" - @param vec Pointer to the destination array. - @param maxCount Number of elements to read. If it is greater than number of remaining elements then - all of them will be read. - */ - FileNodeIterator& readRaw( const String& fmt, uchar* vec, - size_t maxCount=(size_t)INT_MAX ); - - struct SeqReader - { - int header_size; - void* seq; /* sequence, beign read; CvSeq */ - void* block; /* current block; CvSeqBlock */ - schar* ptr; /* pointer to element be read next */ - schar* block_min; /* pointer to the beginning of block */ - schar* block_max; /* pointer to the end of block */ - int delta_index;/* = seq->first->start_index */ - schar* prev_elem; /* pointer to previous element */ - }; - - const CvFileStorage* fs; - const CvFileNode* container; - SeqReader reader; - size_t remaining; -}; - -//! @} core_xml - -/////////////////// XML & YAML I/O implementation ////////////////// - -//! @relates cv::FileStorage -//! @{ - -CV_EXPORTS void write( FileStorage& fs, const String& name, int value ); -CV_EXPORTS void write( FileStorage& fs, const String& name, float value ); -CV_EXPORTS void write( FileStorage& fs, const String& name, double value ); -CV_EXPORTS void write( FileStorage& fs, const String& name, const String& value ); -CV_EXPORTS void write( FileStorage& fs, const String& name, const Mat& value ); -CV_EXPORTS void write( FileStorage& fs, const String& name, const SparseMat& value ); -#ifdef CV__LEGACY_PERSISTENCE -CV_EXPORTS void write( FileStorage& fs, const String& name, const std::vector& value); -CV_EXPORTS void write( FileStorage& fs, const String& name, const std::vector& value); -#endif - -CV_EXPORTS void writeScalar( FileStorage& fs, int value ); -CV_EXPORTS void writeScalar( FileStorage& fs, float value ); -CV_EXPORTS void writeScalar( FileStorage& fs, double value ); -CV_EXPORTS void writeScalar( FileStorage& fs, const String& value ); - -//! @} - -//! @relates cv::FileNode -//! @{ - -CV_EXPORTS void read(const FileNode& node, int& value, int default_value); -CV_EXPORTS void read(const FileNode& node, float& value, float default_value); -CV_EXPORTS void read(const FileNode& node, double& value, double default_value); -CV_EXPORTS void read(const FileNode& node, String& value, const String& default_value); -CV_EXPORTS void read(const FileNode& node, std::string& value, const std::string& default_value); -CV_EXPORTS void read(const FileNode& node, Mat& mat, const Mat& default_mat = Mat() ); -CV_EXPORTS void read(const FileNode& node, SparseMat& mat, const SparseMat& default_mat = SparseMat() ); -#ifdef CV__LEGACY_PERSISTENCE -CV_EXPORTS void read(const FileNode& node, std::vector& keypoints); -CV_EXPORTS void read(const FileNode& node, std::vector& matches); -#endif -CV_EXPORTS void read(const FileNode& node, KeyPoint& value, const KeyPoint& default_value); -CV_EXPORTS void read(const FileNode& node, DMatch& value, const DMatch& default_value); - -template static inline void read(const FileNode& node, Point_<_Tp>& value, const Point_<_Tp>& default_value) -{ - std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp; - value = temp.size() != 2 ? default_value : Point_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1])); -} - -template static inline void read(const FileNode& node, Point3_<_Tp>& value, const Point3_<_Tp>& default_value) -{ - std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp; - value = temp.size() != 3 ? default_value : Point3_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]), - saturate_cast<_Tp>(temp[2])); -} - -template static inline void read(const FileNode& node, Size_<_Tp>& value, const Size_<_Tp>& default_value) -{ - std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp; - value = temp.size() != 2 ? default_value : Size_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1])); -} - -template static inline void read(const FileNode& node, Complex<_Tp>& value, const Complex<_Tp>& default_value) -{ - std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp; - value = temp.size() != 2 ? default_value : Complex<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1])); -} - -template static inline void read(const FileNode& node, Rect_<_Tp>& value, const Rect_<_Tp>& default_value) -{ - std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp; - value = temp.size() != 4 ? default_value : Rect_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]), - saturate_cast<_Tp>(temp[2]), saturate_cast<_Tp>(temp[3])); -} - -template static inline void read(const FileNode& node, Vec<_Tp, cn>& value, const Vec<_Tp, cn>& default_value) -{ - std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp; - value = temp.size() != cn ? default_value : Vec<_Tp, cn>(&temp[0]); -} - -template static inline void read(const FileNode& node, Scalar_<_Tp>& value, const Scalar_<_Tp>& default_value) -{ - std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp; - value = temp.size() != 4 ? default_value : Scalar_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]), - saturate_cast<_Tp>(temp[2]), saturate_cast<_Tp>(temp[3])); -} - -static inline void read(const FileNode& node, Range& value, const Range& default_value) -{ - Point2i temp(value.start, value.end); const Point2i default_temp = Point2i(default_value.start, default_value.end); - read(node, temp, default_temp); - value.start = temp.x; value.end = temp.y; -} - -//! @} - -/** @brief Writes string to a file storage. -@relates cv::FileStorage - */ -CV_EXPORTS FileStorage& operator << (FileStorage& fs, const String& str); - -//! @cond IGNORED - -namespace internal -{ - class CV_EXPORTS WriteStructContext - { - public: - WriteStructContext(FileStorage& _fs, const String& name, int flags, const String& typeName = String()); - ~WriteStructContext(); - private: - FileStorage* fs; - }; - - template class VecWriterProxy - { - public: - VecWriterProxy( FileStorage* _fs ) : fs(_fs) {} - void operator()(const std::vector<_Tp>& vec) const - { - size_t count = vec.size(); - for (size_t i = 0; i < count; i++) - write(*fs, vec[i]); - } - private: - FileStorage* fs; - }; - - template class VecWriterProxy<_Tp, 1> - { - public: - VecWriterProxy( FileStorage* _fs ) : fs(_fs) {} - void operator()(const std::vector<_Tp>& vec) const - { - int _fmt = traits::SafeFmt<_Tp>::fmt; - char fmt[] = { (char)((_fmt >> 8) + '1'), (char)_fmt, '\0' }; - fs->writeRaw(fmt, !vec.empty() ? (uchar*)&vec[0] : 0, vec.size() * sizeof(_Tp)); - } - private: - FileStorage* fs; - }; - - template class VecReaderProxy - { - public: - VecReaderProxy( FileNodeIterator* _it ) : it(_it) {} - void operator()(std::vector<_Tp>& vec, size_t count) const - { - count = std::min(count, it->remaining); - vec.resize(count); - for (size_t i = 0; i < count; i++, ++(*it)) - read(**it, vec[i], _Tp()); - } - private: - FileNodeIterator* it; - }; - - template class VecReaderProxy<_Tp, 1> - { - public: - VecReaderProxy( FileNodeIterator* _it ) : it(_it) {} - void operator()(std::vector<_Tp>& vec, size_t count) const - { - size_t remaining = it->remaining; - size_t cn = DataType<_Tp>::channels; - int _fmt = traits::SafeFmt<_Tp>::fmt; - CV_Assert((_fmt >> 8) < 9); - char fmt[] = { (char)((_fmt >> 8)+'1'), (char)_fmt, '\0' }; - CV_Assert((remaining % cn) == 0); - size_t remaining1 = remaining / cn; - count = count < remaining1 ? count : remaining1; - vec.resize(count); - it->readRaw(fmt, !vec.empty() ? (uchar*)&vec[0] : 0, count*sizeof(_Tp)); - } - private: - FileNodeIterator* it; - }; - -} // internal - -//! @endcond - -//! @relates cv::FileStorage -//! @{ - -template static inline -void write(FileStorage& fs, const _Tp& value) -{ - write(fs, String(), value); -} - -template<> inline -void write( FileStorage& fs, const int& value ) -{ - writeScalar(fs, value); -} - -template<> inline -void write( FileStorage& fs, const float& value ) -{ - writeScalar(fs, value); -} - -template<> inline -void write( FileStorage& fs, const double& value ) -{ - writeScalar(fs, value); -} - -template<> inline -void write( FileStorage& fs, const String& value ) -{ - writeScalar(fs, value); -} - -template static inline -void write(FileStorage& fs, const Point_<_Tp>& pt ) -{ - write(fs, pt.x); - write(fs, pt.y); -} - -template static inline -void write(FileStorage& fs, const Point3_<_Tp>& pt ) -{ - write(fs, pt.x); - write(fs, pt.y); - write(fs, pt.z); -} - -template static inline -void write(FileStorage& fs, const Size_<_Tp>& sz ) -{ - write(fs, sz.width); - write(fs, sz.height); -} - -template static inline -void write(FileStorage& fs, const Complex<_Tp>& c ) -{ - write(fs, c.re); - write(fs, c.im); -} - -template static inline -void write(FileStorage& fs, const Rect_<_Tp>& r ) -{ - write(fs, r.x); - write(fs, r.y); - write(fs, r.width); - write(fs, r.height); -} - -template static inline -void write(FileStorage& fs, const Vec<_Tp, cn>& v ) -{ - for(int i = 0; i < cn; i++) - write(fs, v.val[i]); -} - -template static inline -void write(FileStorage& fs, const Scalar_<_Tp>& s ) -{ - write(fs, s.val[0]); - write(fs, s.val[1]); - write(fs, s.val[2]); - write(fs, s.val[3]); -} - -static inline -void write(FileStorage& fs, const Range& r ) -{ - write(fs, r.start); - write(fs, r.end); -} - -template static inline -void write( FileStorage& fs, const std::vector<_Tp>& vec ) -{ - cv::internal::VecWriterProxy<_Tp, traits::SafeFmt<_Tp>::fmt != 0> w(&fs); - w(vec); -} - -template static inline -void write(FileStorage& fs, const String& name, const Point_<_Tp>& pt ) -{ - cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW); - write(fs, pt); -} - -template static inline -void write(FileStorage& fs, const String& name, const Point3_<_Tp>& pt ) -{ - cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW); - write(fs, pt); -} - -template static inline -void write(FileStorage& fs, const String& name, const Size_<_Tp>& sz ) -{ - cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW); - write(fs, sz); -} - -template static inline -void write(FileStorage& fs, const String& name, const Complex<_Tp>& c ) -{ - cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW); - write(fs, c); -} - -template static inline -void write(FileStorage& fs, const String& name, const Rect_<_Tp>& r ) -{ - cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW); - write(fs, r); -} - -template static inline -void write(FileStorage& fs, const String& name, const Vec<_Tp, cn>& v ) -{ - cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW); - write(fs, v); -} - -template static inline -void write(FileStorage& fs, const String& name, const Scalar_<_Tp>& s ) -{ - cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW); - write(fs, s); -} - -static inline -void write(FileStorage& fs, const String& name, const Range& r ) -{ - cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW); - write(fs, r); -} - -static inline -void write(FileStorage& fs, const String& name, const KeyPoint& kpt) -{ - cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW); - write(fs, kpt.pt.x); - write(fs, kpt.pt.y); - write(fs, kpt.size); - write(fs, kpt.angle); - write(fs, kpt.response); - write(fs, kpt.octave); - write(fs, kpt.class_id); -} - -static inline -void write(FileStorage& fs, const String& name, const DMatch& m) -{ - cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW); - write(fs, m.queryIdx); - write(fs, m.trainIdx); - write(fs, m.imgIdx); - write(fs, m.distance); -} - -template static inline -void write( FileStorage& fs, const String& name, const std::vector<_Tp>& vec ) -{ - cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+(traits::SafeFmt<_Tp>::fmt != 0 ? FileNode::FLOW : 0)); - write(fs, vec); -} - -template static inline -void write( FileStorage& fs, const String& name, const std::vector< std::vector<_Tp> >& vec ) -{ - cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ); - for(size_t i = 0; i < vec.size(); i++) - { - cv::internal::WriteStructContext ws_(fs, name, FileNode::SEQ+(traits::SafeFmt<_Tp>::fmt != 0 ? FileNode::FLOW : 0)); - write(fs, vec[i]); - } -} - -#ifdef CV__LEGACY_PERSISTENCE -// This code is not needed anymore, but it is preserved here to keep source compatibility -// Implementation is similar to templates instantiations -static inline void write(FileStorage& fs, const KeyPoint& kpt) { write(fs, String(), kpt); } -static inline void write(FileStorage& fs, const DMatch& m) { write(fs, String(), m); } -static inline void write(FileStorage& fs, const std::vector& vec) -{ - cv::internal::VecWriterProxy w(&fs); - w(vec); -} -static inline void write(FileStorage& fs, const std::vector& vec) -{ - cv::internal::VecWriterProxy w(&fs); - w(vec); - -} -#endif - -//! @} FileStorage - -//! @relates cv::FileNode -//! @{ - -static inline -void read(const FileNode& node, bool& value, bool default_value) -{ - int temp; - read(node, temp, (int)default_value); - value = temp != 0; -} - -static inline -void read(const FileNode& node, uchar& value, uchar default_value) -{ - int temp; - read(node, temp, (int)default_value); - value = saturate_cast(temp); -} - -static inline -void read(const FileNode& node, schar& value, schar default_value) -{ - int temp; - read(node, temp, (int)default_value); - value = saturate_cast(temp); -} - -static inline -void read(const FileNode& node, ushort& value, ushort default_value) -{ - int temp; - read(node, temp, (int)default_value); - value = saturate_cast(temp); -} - -static inline -void read(const FileNode& node, short& value, short default_value) -{ - int temp; - read(node, temp, (int)default_value); - value = saturate_cast(temp); -} - -template static inline -void read( FileNodeIterator& it, std::vector<_Tp>& vec, size_t maxCount = (size_t)INT_MAX ) -{ - cv::internal::VecReaderProxy<_Tp, traits::SafeFmt<_Tp>::fmt != 0> r(&it); - r(vec, maxCount); -} - -template static inline -void read( const FileNode& node, std::vector<_Tp>& vec, const std::vector<_Tp>& default_value = std::vector<_Tp>() ) -{ - if(!node.node) - vec = default_value; - else - { - FileNodeIterator it = node.begin(); - read( it, vec ); - } -} - -static inline -void read( const FileNode& node, std::vector& vec, const std::vector& default_value ) -{ - if(!node.node) - vec = default_value; - else - read(node, vec); -} - -static inline -void read( const FileNode& node, std::vector& vec, const std::vector& default_value ) -{ - if(!node.node) - vec = default_value; - else - read(node, vec); -} - -//! @} FileNode - -//! @relates cv::FileStorage -//! @{ - -/** @brief Writes data to a file storage. - */ -template static inline -FileStorage& operator << (FileStorage& fs, const _Tp& value) -{ - if( !fs.isOpened() ) - return fs; - if( fs.state == FileStorage::NAME_EXPECTED + FileStorage::INSIDE_MAP ) - CV_Error( Error::StsError, "No element name has been given" ); - write( fs, fs.elname, value ); - if( fs.state & FileStorage::INSIDE_MAP ) - fs.state = FileStorage::NAME_EXPECTED + FileStorage::INSIDE_MAP; - return fs; -} - -/** @brief Writes data to a file storage. - */ -static inline -FileStorage& operator << (FileStorage& fs, const char* str) -{ - return (fs << String(str)); -} - -/** @brief Writes data to a file storage. - */ -static inline -FileStorage& operator << (FileStorage& fs, char* value) -{ - return (fs << String(value)); -} - -//! @} FileStorage - -//! @relates cv::FileNodeIterator -//! @{ - -/** @brief Reads data from a file storage. - */ -template static inline -FileNodeIterator& operator >> (FileNodeIterator& it, _Tp& value) -{ - read( *it, value, _Tp()); - return ++it; -} - -/** @brief Reads data from a file storage. - */ -template static inline -FileNodeIterator& operator >> (FileNodeIterator& it, std::vector<_Tp>& vec) -{ - cv::internal::VecReaderProxy<_Tp, traits::SafeFmt<_Tp>::fmt != 0> r(&it); - r(vec, (size_t)INT_MAX); - return it; -} - -//! @} FileNodeIterator - -//! @relates cv::FileNode -//! @{ - -/** @brief Reads data from a file storage. - */ -template static inline -void operator >> (const FileNode& n, _Tp& value) -{ - read( n, value, _Tp()); -} - -/** @brief Reads data from a file storage. - */ -template static inline -void operator >> (const FileNode& n, std::vector<_Tp>& vec) -{ - FileNodeIterator it = n.begin(); - it >> vec; -} - -/** @brief Reads KeyPoint from a file storage. -*/ -//It needs special handling because it contains two types of fields, int & float. -static inline -void operator >> (const FileNode& n, KeyPoint& kpt) -{ - FileNodeIterator it = n.begin(); - it >> kpt.pt.x >> kpt.pt.y >> kpt.size >> kpt.angle >> kpt.response >> kpt.octave >> kpt.class_id; -} - -#ifdef CV__LEGACY_PERSISTENCE -static inline -void operator >> (const FileNode& n, std::vector& vec) -{ - read(n, vec); -} -static inline -void operator >> (const FileNode& n, std::vector& vec) -{ - read(n, vec); -} -#endif - -/** @brief Reads DMatch from a file storage. -*/ -//It needs special handling because it contains two types of fields, int & float. -static inline -void operator >> (const FileNode& n, DMatch& m) -{ - FileNodeIterator it = n.begin(); - it >> m.queryIdx >> m.trainIdx >> m.imgIdx >> m.distance; -} - -//! @} FileNode - -//! @relates cv::FileNodeIterator -//! @{ - -static inline -bool operator == (const FileNodeIterator& it1, const FileNodeIterator& it2) -{ - return it1.fs == it2.fs && it1.container == it2.container && - it1.reader.ptr == it2.reader.ptr && it1.remaining == it2.remaining; -} - -static inline -bool operator != (const FileNodeIterator& it1, const FileNodeIterator& it2) -{ - return !(it1 == it2); -} - -static inline -ptrdiff_t operator - (const FileNodeIterator& it1, const FileNodeIterator& it2) -{ - return it2.remaining - it1.remaining; -} - -static inline -bool operator < (const FileNodeIterator& it1, const FileNodeIterator& it2) -{ - return it1.remaining > it2.remaining; -} - -//! @} FileNodeIterator - -//! @cond IGNORED - -inline FileNode FileStorage::getFirstTopLevelNode() const { FileNode r = root(); FileNodeIterator it = r.begin(); return it != r.end() ? *it : FileNode(); } -inline FileNode::FileNode() : fs(0), node(0) {} -inline FileNode::FileNode(const CvFileStorage* _fs, const CvFileNode* _node) : fs(_fs), node(_node) {} -inline FileNode::FileNode(const FileNode& _node) : fs(_node.fs), node(_node.node) {} -inline bool FileNode::empty() const { return node == 0; } -inline bool FileNode::isNone() const { return type() == NONE; } -inline bool FileNode::isSeq() const { return type() == SEQ; } -inline bool FileNode::isMap() const { return type() == MAP; } -inline bool FileNode::isInt() const { return type() == INT; } -inline bool FileNode::isReal() const { return type() == REAL; } -inline bool FileNode::isString() const { return type() == STR; } -inline CvFileNode* FileNode::operator *() { return (CvFileNode*)node; } -inline const CvFileNode* FileNode::operator* () const { return node; } -inline FileNode::operator int() const { int value; read(*this, value, 0); return value; } -inline FileNode::operator float() const { float value; read(*this, value, 0.f); return value; } -inline FileNode::operator double() const { double value; read(*this, value, 0.); return value; } -inline FileNode::operator String() const { String value; read(*this, value, value); return value; } -inline double FileNode::real() const { return double(*this); } -inline String FileNode::string() const { return String(*this); } -inline Mat FileNode::mat() const { Mat value; read(*this, value, value); return value; } -inline FileNodeIterator FileNode::begin() const { return FileNodeIterator(fs, node); } -inline FileNodeIterator FileNode::end() const { return FileNodeIterator(fs, node, size()); } -inline void FileNode::readRaw( const String& fmt, uchar* vec, size_t len ) const { begin().readRaw( fmt, vec, len ); } -inline FileNode FileNodeIterator::operator *() const { return FileNode(fs, (const CvFileNode*)(const void*)reader.ptr); } -inline FileNode FileNodeIterator::operator ->() const { return FileNode(fs, (const CvFileNode*)(const void*)reader.ptr); } -inline String::String(const FileNode& fn): cstr_(0), len_(0) { read(fn, *this, *this); } - -//! @endcond - - -CV_EXPORTS void cvStartWriteRawData_Base64(::CvFileStorage * fs, const char* name, int len, const char* dt); - -CV_EXPORTS void cvWriteRawData_Base64(::CvFileStorage * fs, const void* _data, int len); - -CV_EXPORTS void cvEndWriteRawData_Base64(::CvFileStorage * fs); - -CV_EXPORTS void cvWriteMat_Base64(::CvFileStorage* fs, const char* name, const ::CvMat* mat); - -CV_EXPORTS void cvWriteMatND_Base64(::CvFileStorage* fs, const char* name, const ::CvMatND* mat); - -} // cv - -#endif // OPENCV_CORE_PERSISTENCE_HPP diff --git a/opencv/include/opencv2/core/ptr.inl.hpp b/opencv/include/opencv2/core/ptr.inl.hpp deleted file mode 100644 index 466f634..0000000 --- a/opencv/include/opencv2/core/ptr.inl.hpp +++ /dev/null @@ -1,379 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2013, NVIDIA Corporation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the copyright holders or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_PTR_INL_HPP -#define OPENCV_CORE_PTR_INL_HPP - -#include - -//! @cond IGNORED - -namespace cv { - -template -void DefaultDeleter::operator () (Y* p) const -{ - delete p; -} - -namespace detail -{ - -struct PtrOwner -{ - PtrOwner() : refCount(1) - {} - - void incRef() - { - CV_XADD(&refCount, 1); - } - - void decRef() - { - if (CV_XADD(&refCount, -1) == 1) deleteSelf(); - } - -protected: - /* This doesn't really need to be virtual, since PtrOwner is never deleted - directly, but it doesn't hurt and it helps avoid warnings. */ - virtual ~PtrOwner() - {} - - virtual void deleteSelf() = 0; - -private: - unsigned int refCount; - - // noncopyable - PtrOwner(const PtrOwner&); - PtrOwner& operator = (const PtrOwner&); -}; - -template -struct PtrOwnerImpl CV_FINAL : PtrOwner -{ - PtrOwnerImpl(Y* p, D d) : owned(p), deleter(d) - {} - - void deleteSelf() CV_OVERRIDE - { - deleter(owned); - delete this; - } - -private: - Y* owned; - D deleter; -}; - - -} - -template -Ptr::Ptr() : owner(NULL), stored(NULL) -{} - -template -template -Ptr::Ptr(Y* p) - : owner(p - ? new detail::PtrOwnerImpl >(p, DefaultDeleter()) - : NULL), - stored(p) -{} - -template -template -Ptr::Ptr(Y* p, D d) - : owner(p - ? new detail::PtrOwnerImpl(p, d) - : NULL), - stored(p) -{} - -template -Ptr::Ptr(const Ptr& o) : owner(o.owner), stored(o.stored) -{ - if (owner) owner->incRef(); -} - -template -template -Ptr::Ptr(const Ptr& o) : owner(o.owner), stored(o.stored) -{ - if (owner) owner->incRef(); -} - -template -template -Ptr::Ptr(const Ptr& o, T* p) : owner(o.owner), stored(p) -{ - if (owner) owner->incRef(); -} - -template -Ptr::~Ptr() -{ - release(); -} - -template -Ptr& Ptr::operator = (const Ptr& o) -{ - Ptr(o).swap(*this); - return *this; -} - -template -template -Ptr& Ptr::operator = (const Ptr& o) -{ - Ptr(o).swap(*this); - return *this; -} - -template -void Ptr::release() -{ - if (owner) owner->decRef(); - owner = NULL; - stored = NULL; -} - -template -template -void Ptr::reset(Y* p) -{ - Ptr(p).swap(*this); -} - -template -template -void Ptr::reset(Y* p, D d) -{ - Ptr(p, d).swap(*this); -} - -template -void Ptr::swap(Ptr& o) -{ - std::swap(owner, o.owner); - std::swap(stored, o.stored); -} - -template -T* Ptr::get() const -{ - return stored; -} - -template -typename detail::RefOrVoid::type Ptr::operator * () const -{ - return *stored; -} - -template -T* Ptr::operator -> () const -{ - return stored; -} - -template -Ptr::operator T* () const -{ - return stored; -} - - -template -bool Ptr::empty() const -{ - return !stored; -} - -template -template -Ptr Ptr::staticCast() const -{ - return Ptr(*this, static_cast(stored)); -} - -template -template -Ptr Ptr::constCast() const -{ - return Ptr(*this, const_cast(stored)); -} - -template -template -Ptr Ptr::dynamicCast() const -{ - return Ptr(*this, dynamic_cast(stored)); -} - -#ifdef CV_CXX_MOVE_SEMANTICS - -template -Ptr::Ptr(Ptr&& o) : owner(o.owner), stored(o.stored) -{ - o.owner = NULL; - o.stored = NULL; -} - -template -Ptr& Ptr::operator = (Ptr&& o) -{ - if (this == &o) - return *this; - - release(); - owner = o.owner; - stored = o.stored; - o.owner = NULL; - o.stored = NULL; - return *this; -} - -#endif - - -template -void swap(Ptr& ptr1, Ptr& ptr2){ - ptr1.swap(ptr2); -} - -template -bool operator == (const Ptr& ptr1, const Ptr& ptr2) -{ - return ptr1.get() == ptr2.get(); -} - -template -bool operator != (const Ptr& ptr1, const Ptr& ptr2) -{ - return ptr1.get() != ptr2.get(); -} - -template -Ptr makePtr() -{ - return Ptr(new T()); -} - -template -Ptr makePtr(const A1& a1) -{ - return Ptr(new T(a1)); -} - -template -Ptr makePtr(const A1& a1, const A2& a2) -{ - return Ptr(new T(a1, a2)); -} - -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3) -{ - return Ptr(new T(a1, a2, a3)); -} - -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4) -{ - return Ptr(new T(a1, a2, a3, a4)); -} - -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5) -{ - return Ptr(new T(a1, a2, a3, a4, a5)); -} - -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6) -{ - return Ptr(new T(a1, a2, a3, a4, a5, a6)); -} - -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7) -{ - return Ptr(new T(a1, a2, a3, a4, a5, a6, a7)); -} - -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8) -{ - return Ptr(new T(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9) -{ - return Ptr(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} - -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10) -{ - return Ptr(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)); -} - -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10, const A11& a11) -{ - return Ptr(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)); -} - -template -Ptr makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10, const A11& a11, const A12& a12) -{ - return Ptr(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)); -} -} // namespace cv - -//! @endcond - -#endif // OPENCV_CORE_PTR_INL_HPP diff --git a/opencv/include/opencv2/core/saturate.hpp b/opencv/include/opencv2/core/saturate.hpp deleted file mode 100644 index 118599f..0000000 --- a/opencv/include/opencv2/core/saturate.hpp +++ /dev/null @@ -1,165 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2014, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_SATURATE_HPP -#define OPENCV_CORE_SATURATE_HPP - -#include "opencv2/core/cvdef.h" -#include "opencv2/core/fast_math.hpp" - -namespace cv -{ - -//! @addtogroup core_utils -//! @{ - -/////////////// saturate_cast (used in image & signal processing) /////////////////// - -/** @brief Template function for accurate conversion from one primitive type to another. - - The function saturate_cast resembles the standard C++ cast operations, such as static_cast\() - and others. It perform an efficient and accurate conversion from one primitive type to another - (see the introduction chapter). saturate in the name means that when the input value v is out of the - range of the target type, the result is not formed just by taking low bits of the input, but instead - the value is clipped. For example: - @code - uchar a = saturate_cast(-100); // a = 0 (UCHAR_MIN) - short b = saturate_cast(33333.33333); // b = 32767 (SHRT_MAX) - @endcode - Such clipping is done when the target type is unsigned char , signed char , unsigned short or - signed short . For 32-bit integers, no clipping is done. - - When the parameter is a floating-point value and the target type is an integer (8-, 16- or 32-bit), - the floating-point value is first rounded to the nearest integer and then clipped if needed (when - the target type is 8- or 16-bit). - - This operation is used in the simplest or most complex image processing functions in OpenCV. - - @param v Function parameter. - @sa add, subtract, multiply, divide, Mat::convertTo - */ -template static inline _Tp saturate_cast(uchar v) { return _Tp(v); } -/** @overload */ -template static inline _Tp saturate_cast(schar v) { return _Tp(v); } -/** @overload */ -template static inline _Tp saturate_cast(ushort v) { return _Tp(v); } -/** @overload */ -template static inline _Tp saturate_cast(short v) { return _Tp(v); } -/** @overload */ -template static inline _Tp saturate_cast(unsigned v) { return _Tp(v); } -/** @overload */ -template static inline _Tp saturate_cast(int v) { return _Tp(v); } -/** @overload */ -template static inline _Tp saturate_cast(float v) { return _Tp(v); } -/** @overload */ -template static inline _Tp saturate_cast(double v) { return _Tp(v); } -/** @overload */ -template static inline _Tp saturate_cast(int64 v) { return _Tp(v); } -/** @overload */ -template static inline _Tp saturate_cast(uint64 v) { return _Tp(v); } - -template<> inline uchar saturate_cast(schar v) { return (uchar)std::max((int)v, 0); } -template<> inline uchar saturate_cast(ushort v) { return (uchar)std::min((unsigned)v, (unsigned)UCHAR_MAX); } -template<> inline uchar saturate_cast(int v) { return (uchar)((unsigned)v <= UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0); } -template<> inline uchar saturate_cast(short v) { return saturate_cast((int)v); } -template<> inline uchar saturate_cast(unsigned v) { return (uchar)std::min(v, (unsigned)UCHAR_MAX); } -template<> inline uchar saturate_cast(float v) { int iv = cvRound(v); return saturate_cast(iv); } -template<> inline uchar saturate_cast(double v) { int iv = cvRound(v); return saturate_cast(iv); } -template<> inline uchar saturate_cast(int64 v) { return (uchar)((uint64)v <= (uint64)UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0); } -template<> inline uchar saturate_cast(uint64 v) { return (uchar)std::min(v, (uint64)UCHAR_MAX); } - -template<> inline schar saturate_cast(uchar v) { return (schar)std::min((int)v, SCHAR_MAX); } -template<> inline schar saturate_cast(ushort v) { return (schar)std::min((unsigned)v, (unsigned)SCHAR_MAX); } -template<> inline schar saturate_cast(int v) { return (schar)((unsigned)(v-SCHAR_MIN) <= (unsigned)UCHAR_MAX ? v : v > 0 ? SCHAR_MAX : SCHAR_MIN); } -template<> inline schar saturate_cast(short v) { return saturate_cast((int)v); } -template<> inline schar saturate_cast(unsigned v) { return (schar)std::min(v, (unsigned)SCHAR_MAX); } -template<> inline schar saturate_cast(float v) { int iv = cvRound(v); return saturate_cast(iv); } -template<> inline schar saturate_cast(double v) { int iv = cvRound(v); return saturate_cast(iv); } -template<> inline schar saturate_cast(int64 v) { return (schar)((uint64)((int64)v-SCHAR_MIN) <= (uint64)UCHAR_MAX ? v : v > 0 ? SCHAR_MAX : SCHAR_MIN); } -template<> inline schar saturate_cast(uint64 v) { return (schar)std::min(v, (uint64)SCHAR_MAX); } - -template<> inline ushort saturate_cast(schar v) { return (ushort)std::max((int)v, 0); } -template<> inline ushort saturate_cast(short v) { return (ushort)std::max((int)v, 0); } -template<> inline ushort saturate_cast(int v) { return (ushort)((unsigned)v <= (unsigned)USHRT_MAX ? v : v > 0 ? USHRT_MAX : 0); } -template<> inline ushort saturate_cast(unsigned v) { return (ushort)std::min(v, (unsigned)USHRT_MAX); } -template<> inline ushort saturate_cast(float v) { int iv = cvRound(v); return saturate_cast(iv); } -template<> inline ushort saturate_cast(double v) { int iv = cvRound(v); return saturate_cast(iv); } -template<> inline ushort saturate_cast(int64 v) { return (ushort)((uint64)v <= (uint64)USHRT_MAX ? v : v > 0 ? USHRT_MAX : 0); } -template<> inline ushort saturate_cast(uint64 v) { return (ushort)std::min(v, (uint64)USHRT_MAX); } - -template<> inline short saturate_cast(ushort v) { return (short)std::min((int)v, SHRT_MAX); } -template<> inline short saturate_cast(int v) { return (short)((unsigned)(v - SHRT_MIN) <= (unsigned)USHRT_MAX ? v : v > 0 ? SHRT_MAX : SHRT_MIN); } -template<> inline short saturate_cast(unsigned v) { return (short)std::min(v, (unsigned)SHRT_MAX); } -template<> inline short saturate_cast(float v) { int iv = cvRound(v); return saturate_cast(iv); } -template<> inline short saturate_cast(double v) { int iv = cvRound(v); return saturate_cast(iv); } -template<> inline short saturate_cast(int64 v) { return (short)((uint64)((int64)v - SHRT_MIN) <= (uint64)USHRT_MAX ? v : v > 0 ? SHRT_MAX : SHRT_MIN); } -template<> inline short saturate_cast(uint64 v) { return (short)std::min(v, (uint64)SHRT_MAX); } - -template<> inline int saturate_cast(unsigned v) { return (int)std::min(v, (unsigned)INT_MAX); } -template<> inline int saturate_cast(int64 v) { return (int)((uint64)(v - INT_MIN) <= (uint64)UINT_MAX ? v : v > 0 ? INT_MAX : INT_MIN); } -template<> inline int saturate_cast(uint64 v) { return (int)std::min(v, (uint64)INT_MAX); } -template<> inline int saturate_cast(float v) { return cvRound(v); } -template<> inline int saturate_cast(double v) { return cvRound(v); } - -template<> inline unsigned saturate_cast(schar v) { return (unsigned)std::max(v, (schar)0); } -template<> inline unsigned saturate_cast(short v) { return (unsigned)std::max(v, (short)0); } -template<> inline unsigned saturate_cast(int v) { return (unsigned)std::max(v, (int)0); } -template<> inline unsigned saturate_cast(int64 v) { return (unsigned)((uint64)v <= (uint64)UINT_MAX ? v : v > 0 ? UINT_MAX : 0); } -template<> inline unsigned saturate_cast(uint64 v) { return (unsigned)std::min(v, (uint64)UINT_MAX); } -// we intentionally do not clip negative numbers, to make -1 become 0xffffffff etc. -template<> inline unsigned saturate_cast(float v) { return static_cast(cvRound(v)); } -template<> inline unsigned saturate_cast(double v) { return static_cast(cvRound(v)); } - -template<> inline uint64 saturate_cast(schar v) { return (uint64)std::max(v, (schar)0); } -template<> inline uint64 saturate_cast(short v) { return (uint64)std::max(v, (short)0); } -template<> inline uint64 saturate_cast(int v) { return (uint64)std::max(v, (int)0); } -template<> inline uint64 saturate_cast(int64 v) { return (uint64)std::max(v, (int64)0); } - -template<> inline int64 saturate_cast(uint64 v) { return (int64)std::min(v, (uint64)LLONG_MAX); } - -//! @} - -} // cv - -#endif // OPENCV_CORE_SATURATE_HPP diff --git a/opencv/include/opencv2/core/softfloat.hpp b/opencv/include/opencv2/core/softfloat.hpp deleted file mode 100644 index 5470980..0000000 --- a/opencv/include/opencv2/core/softfloat.hpp +++ /dev/null @@ -1,514 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html - -// This file is based on files from package issued with the following license: - -/*============================================================================ - -This C header file is part of the SoftFloat IEEE Floating-Point Arithmetic -Package, Release 3c, by John R. Hauser. - -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the -University of California. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions, and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions, and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the University nor the names of its contributors may - be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE -DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=============================================================================*/ - -#pragma once -#ifndef softfloat_h -#define softfloat_h 1 - -#include "cvdef.h" - -namespace cv -{ - -/** @addtogroup core_utils_softfloat - - [SoftFloat](http://www.jhauser.us/arithmetic/SoftFloat.html) is a software implementation - of floating-point calculations according to IEEE 754 standard. - All calculations are done in integers, that's why they are machine-independent and bit-exact. - This library can be useful in accuracy-critical parts like look-up tables generation, tests, etc. - OpenCV contains a subset of SoftFloat partially rewritten to C++. - - ### Types - - There are two basic types: @ref softfloat and @ref softdouble. - These types are binary compatible with float and double types respectively - and support conversions to/from them. - Other types from original SoftFloat library like fp16 or fp128 were thrown away - as well as quiet/signaling NaN support, on-the-fly rounding mode switch - and exception flags (though exceptions can be implemented in the future). - - ### Operations - - Both types support the following: - - Construction from signed and unsigned 32-bit and 64 integers, - float/double or raw binary representation - - Conversions between each other, to float or double and to int - using @ref cvRound, @ref cvTrunc, @ref cvFloor, @ref cvCeil or a bunch of - saturate_cast functions - - Add, subtract, multiply, divide, remainder, square root, FMA with absolute precision - - Comparison operations - - Explicit sign, exponent and significand manipulation through get/set methods, - number state indicators (isInf, isNan, isSubnormal) - - Type-specific constants like eps, minimum/maximum value, best pi approximation, etc. - - min(), max(), abs(), exp(), log() and pow() functions - -*/ -//! @{ - -struct softfloat; -struct softdouble; - -struct CV_EXPORTS softfloat -{ -public: - /** @brief Default constructor */ - softfloat() { v = 0; } - /** @brief Copy constructor */ - softfloat( const softfloat& c) { v = c.v; } - /** @brief Assign constructor */ - softfloat& operator=( const softfloat& c ) - { - if(&c != this) v = c.v; - return *this; - } - /** @brief Construct from raw - - Builds new value from raw binary representation - */ - static const softfloat fromRaw( const uint32_t a ) { softfloat x; x.v = a; return x; } - - /** @brief Construct from integer */ - explicit softfloat( const uint32_t ); - explicit softfloat( const uint64_t ); - explicit softfloat( const int32_t ); - explicit softfloat( const int64_t ); - -#ifdef CV_INT32_T_IS_LONG_INT - // for platforms with int32_t = long int - explicit softfloat( const int a ) { *this = softfloat(static_cast(a)); } -#endif - - /** @brief Construct from float */ - explicit softfloat( const float a ) { Cv32suf s; s.f = a; v = s.u; } - - /** @brief Type casts */ - operator softdouble() const; - operator float() const { Cv32suf s; s.u = v; return s.f; } - - /** @brief Basic arithmetics */ - softfloat operator + (const softfloat&) const; - softfloat operator - (const softfloat&) const; - softfloat operator * (const softfloat&) const; - softfloat operator / (const softfloat&) const; - softfloat operator - () const { softfloat x; x.v = v ^ (1U << 31); return x; } - - /** @brief Remainder operator - - A quote from original SoftFloat manual: - - > The IEEE Standard remainder operation computes the value - > a - n * b, where n is the integer closest to a / b. - > If a / b is exactly halfway between two integers, n is the even integer - > closest to a / b. The IEEE Standard鈥檚 remainder operation is always exact and so requires no rounding. - > Depending on the relative magnitudes of the operands, the remainder functions - > can take considerably longer to execute than the other SoftFloat functions. - > This is an inherent characteristic of the remainder operation itself and is not a flaw - > in the SoftFloat implementation. - */ - softfloat operator % (const softfloat&) const; - - softfloat& operator += (const softfloat& a) { *this = *this + a; return *this; } - softfloat& operator -= (const softfloat& a) { *this = *this - a; return *this; } - softfloat& operator *= (const softfloat& a) { *this = *this * a; return *this; } - softfloat& operator /= (const softfloat& a) { *this = *this / a; return *this; } - softfloat& operator %= (const softfloat& a) { *this = *this % a; return *this; } - - /** @brief Comparison operations - - - Any operation with NaN produces false - + The only exception is when x is NaN: x != y for any y. - - Positive and negative zeros are equal - */ - bool operator == ( const softfloat& ) const; - bool operator != ( const softfloat& ) const; - bool operator > ( const softfloat& ) const; - bool operator >= ( const softfloat& ) const; - bool operator < ( const softfloat& ) const; - bool operator <= ( const softfloat& ) const; - - /** @brief NaN state indicator */ - inline bool isNaN() const { return (v & 0x7fffffff) > 0x7f800000; } - /** @brief Inf state indicator */ - inline bool isInf() const { return (v & 0x7fffffff) == 0x7f800000; } - /** @brief Subnormal number indicator */ - inline bool isSubnormal() const { return ((v >> 23) & 0xFF) == 0; } - - /** @brief Get sign bit */ - inline bool getSign() const { return (v >> 31) != 0; } - /** @brief Construct a copy with new sign bit */ - inline softfloat setSign(bool sign) const { softfloat x; x.v = (v & ((1U << 31) - 1)) | ((uint32_t)sign << 31); return x; } - /** @brief Get 0-based exponent */ - inline int getExp() const { return ((v >> 23) & 0xFF) - 127; } - /** @brief Construct a copy with new 0-based exponent */ - inline softfloat setExp(int e) const { softfloat x; x.v = (v & 0x807fffff) | (((e + 127) & 0xFF) << 23 ); return x; } - - /** @brief Get a fraction part - - Returns a number 1 <= x < 2 with the same significand - */ - inline softfloat getFrac() const - { - uint_fast32_t vv = (v & 0x007fffff) | (127 << 23); - return softfloat::fromRaw(vv); - } - /** @brief Construct a copy with provided significand - - Constructs a copy of a number with significand taken from parameter - */ - inline softfloat setFrac(const softfloat& s) const - { - softfloat x; - x.v = (v & 0xff800000) | (s.v & 0x007fffff); - return x; - } - - /** @brief Zero constant */ - static softfloat zero() { return softfloat::fromRaw( 0 ); } - /** @brief Positive infinity constant */ - static softfloat inf() { return softfloat::fromRaw( 0xFF << 23 ); } - /** @brief Default NaN constant */ - static softfloat nan() { return softfloat::fromRaw( 0x7fffffff ); } - /** @brief One constant */ - static softfloat one() { return softfloat::fromRaw( 127 << 23 ); } - /** @brief Smallest normalized value */ - static softfloat min() { return softfloat::fromRaw( 0x01 << 23 ); } - /** @brief Difference between 1 and next representable value */ - static softfloat eps() { return softfloat::fromRaw( (127 - 23) << 23 ); } - /** @brief Biggest finite value */ - static softfloat max() { return softfloat::fromRaw( (0xFF << 23) - 1 ); } - /** @brief Correct pi approximation */ - static softfloat pi() { return softfloat::fromRaw( 0x40490fdb ); } - - uint32_t v; -}; - -/*---------------------------------------------------------------------------- -*----------------------------------------------------------------------------*/ - -struct CV_EXPORTS softdouble -{ -public: - /** @brief Default constructor */ - softdouble() : v(0) { } - /** @brief Copy constructor */ - softdouble( const softdouble& c) { v = c.v; } - /** @brief Assign constructor */ - softdouble& operator=( const softdouble& c ) - { - if(&c != this) v = c.v; - return *this; - } - /** @brief Construct from raw - - Builds new value from raw binary representation - */ - static softdouble fromRaw( const uint64_t a ) { softdouble x; x.v = a; return x; } - - /** @brief Construct from integer */ - explicit softdouble( const uint32_t ); - explicit softdouble( const uint64_t ); - explicit softdouble( const int32_t ); - explicit softdouble( const int64_t ); - -#ifdef CV_INT32_T_IS_LONG_INT - // for platforms with int32_t = long int - explicit softdouble( const int a ) { *this = softdouble(static_cast(a)); } -#endif - - /** @brief Construct from double */ - explicit softdouble( const double a ) { Cv64suf s; s.f = a; v = s.u; } - - /** @brief Type casts */ - operator softfloat() const; - operator double() const { Cv64suf s; s.u = v; return s.f; } - - /** @brief Basic arithmetics */ - softdouble operator + (const softdouble&) const; - softdouble operator - (const softdouble&) const; - softdouble operator * (const softdouble&) const; - softdouble operator / (const softdouble&) const; - softdouble operator - () const { softdouble x; x.v = v ^ (1ULL << 63); return x; } - - /** @brief Remainder operator - - A quote from original SoftFloat manual: - - > The IEEE Standard remainder operation computes the value - > a - n * b, where n is the integer closest to a / b. - > If a / b is exactly halfway between two integers, n is the even integer - > closest to a / b. The IEEE Standard鈥檚 remainder operation is always exact and so requires no rounding. - > Depending on the relative magnitudes of the operands, the remainder functions - > can take considerably longer to execute than the other SoftFloat functions. - > This is an inherent characteristic of the remainder operation itself and is not a flaw - > in the SoftFloat implementation. - */ - softdouble operator % (const softdouble&) const; - - softdouble& operator += (const softdouble& a) { *this = *this + a; return *this; } - softdouble& operator -= (const softdouble& a) { *this = *this - a; return *this; } - softdouble& operator *= (const softdouble& a) { *this = *this * a; return *this; } - softdouble& operator /= (const softdouble& a) { *this = *this / a; return *this; } - softdouble& operator %= (const softdouble& a) { *this = *this % a; return *this; } - - /** @brief Comparison operations - - - Any operation with NaN produces false - + The only exception is when x is NaN: x != y for any y. - - Positive and negative zeros are equal - */ - bool operator == ( const softdouble& ) const; - bool operator != ( const softdouble& ) const; - bool operator > ( const softdouble& ) const; - bool operator >= ( const softdouble& ) const; - bool operator < ( const softdouble& ) const; - bool operator <= ( const softdouble& ) const; - - /** @brief NaN state indicator */ - inline bool isNaN() const { return (v & 0x7fffffffffffffff) > 0x7ff0000000000000; } - /** @brief Inf state indicator */ - inline bool isInf() const { return (v & 0x7fffffffffffffff) == 0x7ff0000000000000; } - /** @brief Subnormal number indicator */ - inline bool isSubnormal() const { return ((v >> 52) & 0x7FF) == 0; } - - /** @brief Get sign bit */ - inline bool getSign() const { return (v >> 63) != 0; } - /** @brief Construct a copy with new sign bit */ - softdouble setSign(bool sign) const { softdouble x; x.v = (v & ((1ULL << 63) - 1)) | ((uint_fast64_t)(sign) << 63); return x; } - /** @brief Get 0-based exponent */ - inline int getExp() const { return ((v >> 52) & 0x7FF) - 1023; } - /** @brief Construct a copy with new 0-based exponent */ - inline softdouble setExp(int e) const - { - softdouble x; - x.v = (v & 0x800FFFFFFFFFFFFF) | ((uint_fast64_t)((e + 1023) & 0x7FF) << 52); - return x; - } - - /** @brief Get a fraction part - - Returns a number 1 <= x < 2 with the same significand - */ - inline softdouble getFrac() const - { - uint_fast64_t vv = (v & 0x000FFFFFFFFFFFFF) | ((uint_fast64_t)(1023) << 52); - return softdouble::fromRaw(vv); - } - /** @brief Construct a copy with provided significand - - Constructs a copy of a number with significand taken from parameter - */ - inline softdouble setFrac(const softdouble& s) const - { - softdouble x; - x.v = (v & 0xFFF0000000000000) | (s.v & 0x000FFFFFFFFFFFFF); - return x; - } - - /** @brief Zero constant */ - static softdouble zero() { return softdouble::fromRaw( 0 ); } - /** @brief Positive infinity constant */ - static softdouble inf() { return softdouble::fromRaw( (uint_fast64_t)(0x7FF) << 52 ); } - /** @brief Default NaN constant */ - static softdouble nan() { return softdouble::fromRaw( CV_BIG_INT(0x7FFFFFFFFFFFFFFF) ); } - /** @brief One constant */ - static softdouble one() { return softdouble::fromRaw( (uint_fast64_t)( 1023) << 52 ); } - /** @brief Smallest normalized value */ - static softdouble min() { return softdouble::fromRaw( (uint_fast64_t)( 0x01) << 52 ); } - /** @brief Difference between 1 and next representable value */ - static softdouble eps() { return softdouble::fromRaw( (uint_fast64_t)( 1023 - 52 ) << 52 ); } - /** @brief Biggest finite value */ - static softdouble max() { return softdouble::fromRaw( ((uint_fast64_t)(0x7FF) << 52) - 1 ); } - /** @brief Correct pi approximation */ - static softdouble pi() { return softdouble::fromRaw( CV_BIG_INT(0x400921FB54442D18) ); } - - uint64_t v; -}; - -/*---------------------------------------------------------------------------- -*----------------------------------------------------------------------------*/ - -/** @brief Fused Multiplication and Addition - -Computes (a*b)+c with single rounding -*/ -CV_EXPORTS softfloat mulAdd( const softfloat& a, const softfloat& b, const softfloat & c); -CV_EXPORTS softdouble mulAdd( const softdouble& a, const softdouble& b, const softdouble& c); - -/** @brief Square root */ -CV_EXPORTS softfloat sqrt( const softfloat& a ); -CV_EXPORTS softdouble sqrt( const softdouble& a ); -} - -/*---------------------------------------------------------------------------- -| Ported from OpenCV and added for usability -*----------------------------------------------------------------------------*/ - -/** @brief Truncates number to integer with minimum magnitude */ -CV_EXPORTS int cvTrunc(const cv::softfloat& a); -CV_EXPORTS int cvTrunc(const cv::softdouble& a); - -/** @brief Rounds a number to nearest even integer */ -CV_EXPORTS int cvRound(const cv::softfloat& a); -CV_EXPORTS int cvRound(const cv::softdouble& a); - -/** @brief Rounds a number to nearest even long long integer */ -CV_EXPORTS int64_t cvRound64(const cv::softdouble& a); - -/** @brief Rounds a number down to integer */ -CV_EXPORTS int cvFloor(const cv::softfloat& a); -CV_EXPORTS int cvFloor(const cv::softdouble& a); - -/** @brief Rounds number up to integer */ -CV_EXPORTS int cvCeil(const cv::softfloat& a); -CV_EXPORTS int cvCeil(const cv::softdouble& a); - -namespace cv -{ -/** @brief Saturate casts */ -template static inline _Tp saturate_cast(softfloat a) { return _Tp(a); } -template static inline _Tp saturate_cast(softdouble a) { return _Tp(a); } - -template<> inline uchar saturate_cast(softfloat a) { return (uchar)std::max(std::min(cvRound(a), (int)UCHAR_MAX), 0); } -template<> inline uchar saturate_cast(softdouble a) { return (uchar)std::max(std::min(cvRound(a), (int)UCHAR_MAX), 0); } - -template<> inline schar saturate_cast(softfloat a) { return (schar)std::min(std::max(cvRound(a), (int)SCHAR_MIN), (int)SCHAR_MAX); } -template<> inline schar saturate_cast(softdouble a) { return (schar)std::min(std::max(cvRound(a), (int)SCHAR_MIN), (int)SCHAR_MAX); } - -template<> inline ushort saturate_cast(softfloat a) { return (ushort)std::max(std::min(cvRound(a), (int)USHRT_MAX), 0); } -template<> inline ushort saturate_cast(softdouble a) { return (ushort)std::max(std::min(cvRound(a), (int)USHRT_MAX), 0); } - -template<> inline short saturate_cast(softfloat a) { return (short)std::min(std::max(cvRound(a), (int)SHRT_MIN), (int)SHRT_MAX); } -template<> inline short saturate_cast(softdouble a) { return (short)std::min(std::max(cvRound(a), (int)SHRT_MIN), (int)SHRT_MAX); } - -template<> inline int saturate_cast(softfloat a) { return cvRound(a); } -template<> inline int saturate_cast(softdouble a) { return cvRound(a); } - -template<> inline int64_t saturate_cast(softfloat a) { return cvRound(a); } -template<> inline int64_t saturate_cast(softdouble a) { return cvRound64(a); } - -/** @brief Saturate cast to unsigned integer and unsigned long long integer -We intentionally do not clip negative numbers, to make -1 become 0xffffffff etc. -*/ -template<> inline unsigned saturate_cast(softfloat a) { return cvRound(a); } -template<> inline unsigned saturate_cast(softdouble a) { return cvRound(a); } - -template<> inline uint64_t saturate_cast(softfloat a) { return cvRound(a); } -template<> inline uint64_t saturate_cast(softdouble a) { return cvRound64(a); } - -/** @brief Min and Max functions */ -inline softfloat min(const softfloat& a, const softfloat& b) { return (a > b) ? b : a; } -inline softdouble min(const softdouble& a, const softdouble& b) { return (a > b) ? b : a; } - -inline softfloat max(const softfloat& a, const softfloat& b) { return (a > b) ? a : b; } -inline softdouble max(const softdouble& a, const softdouble& b) { return (a > b) ? a : b; } - -/** @brief Absolute value */ -inline softfloat abs( softfloat a) { softfloat x; x.v = a.v & ((1U << 31) - 1); return x; } -inline softdouble abs( softdouble a) { softdouble x; x.v = a.v & ((1ULL << 63) - 1); return x; } - -/** @brief Exponent - -Special cases: -- exp(NaN) is NaN -- exp(-Inf) == 0 -- exp(+Inf) == +Inf -*/ -CV_EXPORTS softfloat exp( const softfloat& a); -CV_EXPORTS softdouble exp( const softdouble& a); - -/** @brief Natural logarithm - -Special cases: -- log(NaN), log(x < 0) are NaN -- log(0) == -Inf -*/ -CV_EXPORTS softfloat log( const softfloat& a ); -CV_EXPORTS softdouble log( const softdouble& a ); - -/** @brief Raising to the power - -Special cases: -- x**NaN is NaN for any x -- ( |x| == 1 )**Inf is NaN -- ( |x| > 1 )**+Inf or ( |x| < 1 )**-Inf is +Inf -- ( |x| > 1 )**-Inf or ( |x| < 1 )**+Inf is 0 -- x ** 0 == 1 for any x -- x ** 1 == 1 for any x -- NaN ** y is NaN for any other y -- Inf**(y < 0) == 0 -- Inf ** y is +Inf for any other y -- (x < 0)**y is NaN for any other y if x can't be correctly rounded to integer -- 0 ** 0 == 1 -- 0 ** (y < 0) is +Inf -- 0 ** (y > 0) is 0 -*/ -CV_EXPORTS softfloat pow( const softfloat& a, const softfloat& b); -CV_EXPORTS softdouble pow( const softdouble& a, const softdouble& b); - -/** @brief Cube root - -Special cases: -- cbrt(NaN) is NaN -- cbrt(+/-Inf) is +/-Inf -*/ -CV_EXPORTS softfloat cbrt( const softfloat& a ); - -/** @brief Sine - -Special cases: -- sin(Inf) or sin(NaN) is NaN -- sin(x) == x when sin(x) is close to zero -*/ -CV_EXPORTS softdouble sin( const softdouble& a ); - -/** @brief Cosine - * -Special cases: -- cos(Inf) or cos(NaN) is NaN -- cos(x) == +/- 1 when cos(x) is close to +/- 1 -*/ -CV_EXPORTS softdouble cos( const softdouble& a ); - -} - -//! @} - -#endif diff --git a/opencv/include/opencv2/core/sse_utils.hpp b/opencv/include/opencv2/core/sse_utils.hpp deleted file mode 100644 index 0906583..0000000 --- a/opencv/include/opencv2/core/sse_utils.hpp +++ /dev/null @@ -1,652 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_SSE_UTILS_HPP -#define OPENCV_CORE_SSE_UTILS_HPP - -#ifndef __cplusplus -# error sse_utils.hpp header must be compiled as C++ -#endif - -#include "opencv2/core/cvdef.h" - -//! @addtogroup core_utils_sse -//! @{ - -#if CV_SSE2 - -inline void _mm_deinterleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1) -{ - __m128i layer1_chunk0 = _mm_unpacklo_epi8(v_r0, v_g0); - __m128i layer1_chunk1 = _mm_unpackhi_epi8(v_r0, v_g0); - __m128i layer1_chunk2 = _mm_unpacklo_epi8(v_r1, v_g1); - __m128i layer1_chunk3 = _mm_unpackhi_epi8(v_r1, v_g1); - - __m128i layer2_chunk0 = _mm_unpacklo_epi8(layer1_chunk0, layer1_chunk2); - __m128i layer2_chunk1 = _mm_unpackhi_epi8(layer1_chunk0, layer1_chunk2); - __m128i layer2_chunk2 = _mm_unpacklo_epi8(layer1_chunk1, layer1_chunk3); - __m128i layer2_chunk3 = _mm_unpackhi_epi8(layer1_chunk1, layer1_chunk3); - - __m128i layer3_chunk0 = _mm_unpacklo_epi8(layer2_chunk0, layer2_chunk2); - __m128i layer3_chunk1 = _mm_unpackhi_epi8(layer2_chunk0, layer2_chunk2); - __m128i layer3_chunk2 = _mm_unpacklo_epi8(layer2_chunk1, layer2_chunk3); - __m128i layer3_chunk3 = _mm_unpackhi_epi8(layer2_chunk1, layer2_chunk3); - - __m128i layer4_chunk0 = _mm_unpacklo_epi8(layer3_chunk0, layer3_chunk2); - __m128i layer4_chunk1 = _mm_unpackhi_epi8(layer3_chunk0, layer3_chunk2); - __m128i layer4_chunk2 = _mm_unpacklo_epi8(layer3_chunk1, layer3_chunk3); - __m128i layer4_chunk3 = _mm_unpackhi_epi8(layer3_chunk1, layer3_chunk3); - - v_r0 = _mm_unpacklo_epi8(layer4_chunk0, layer4_chunk2); - v_r1 = _mm_unpackhi_epi8(layer4_chunk0, layer4_chunk2); - v_g0 = _mm_unpacklo_epi8(layer4_chunk1, layer4_chunk3); - v_g1 = _mm_unpackhi_epi8(layer4_chunk1, layer4_chunk3); -} - -inline void _mm_deinterleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, - __m128i & v_g1, __m128i & v_b0, __m128i & v_b1) -{ - __m128i layer1_chunk0 = _mm_unpacklo_epi8(v_r0, v_g1); - __m128i layer1_chunk1 = _mm_unpackhi_epi8(v_r0, v_g1); - __m128i layer1_chunk2 = _mm_unpacklo_epi8(v_r1, v_b0); - __m128i layer1_chunk3 = _mm_unpackhi_epi8(v_r1, v_b0); - __m128i layer1_chunk4 = _mm_unpacklo_epi8(v_g0, v_b1); - __m128i layer1_chunk5 = _mm_unpackhi_epi8(v_g0, v_b1); - - __m128i layer2_chunk0 = _mm_unpacklo_epi8(layer1_chunk0, layer1_chunk3); - __m128i layer2_chunk1 = _mm_unpackhi_epi8(layer1_chunk0, layer1_chunk3); - __m128i layer2_chunk2 = _mm_unpacklo_epi8(layer1_chunk1, layer1_chunk4); - __m128i layer2_chunk3 = _mm_unpackhi_epi8(layer1_chunk1, layer1_chunk4); - __m128i layer2_chunk4 = _mm_unpacklo_epi8(layer1_chunk2, layer1_chunk5); - __m128i layer2_chunk5 = _mm_unpackhi_epi8(layer1_chunk2, layer1_chunk5); - - __m128i layer3_chunk0 = _mm_unpacklo_epi8(layer2_chunk0, layer2_chunk3); - __m128i layer3_chunk1 = _mm_unpackhi_epi8(layer2_chunk0, layer2_chunk3); - __m128i layer3_chunk2 = _mm_unpacklo_epi8(layer2_chunk1, layer2_chunk4); - __m128i layer3_chunk3 = _mm_unpackhi_epi8(layer2_chunk1, layer2_chunk4); - __m128i layer3_chunk4 = _mm_unpacklo_epi8(layer2_chunk2, layer2_chunk5); - __m128i layer3_chunk5 = _mm_unpackhi_epi8(layer2_chunk2, layer2_chunk5); - - __m128i layer4_chunk0 = _mm_unpacklo_epi8(layer3_chunk0, layer3_chunk3); - __m128i layer4_chunk1 = _mm_unpackhi_epi8(layer3_chunk0, layer3_chunk3); - __m128i layer4_chunk2 = _mm_unpacklo_epi8(layer3_chunk1, layer3_chunk4); - __m128i layer4_chunk3 = _mm_unpackhi_epi8(layer3_chunk1, layer3_chunk4); - __m128i layer4_chunk4 = _mm_unpacklo_epi8(layer3_chunk2, layer3_chunk5); - __m128i layer4_chunk5 = _mm_unpackhi_epi8(layer3_chunk2, layer3_chunk5); - - v_r0 = _mm_unpacklo_epi8(layer4_chunk0, layer4_chunk3); - v_r1 = _mm_unpackhi_epi8(layer4_chunk0, layer4_chunk3); - v_g0 = _mm_unpacklo_epi8(layer4_chunk1, layer4_chunk4); - v_g1 = _mm_unpackhi_epi8(layer4_chunk1, layer4_chunk4); - v_b0 = _mm_unpacklo_epi8(layer4_chunk2, layer4_chunk5); - v_b1 = _mm_unpackhi_epi8(layer4_chunk2, layer4_chunk5); -} - -inline void _mm_deinterleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1, - __m128i & v_b0, __m128i & v_b1, __m128i & v_a0, __m128i & v_a1) -{ - __m128i layer1_chunk0 = _mm_unpacklo_epi8(v_r0, v_b0); - __m128i layer1_chunk1 = _mm_unpackhi_epi8(v_r0, v_b0); - __m128i layer1_chunk2 = _mm_unpacklo_epi8(v_r1, v_b1); - __m128i layer1_chunk3 = _mm_unpackhi_epi8(v_r1, v_b1); - __m128i layer1_chunk4 = _mm_unpacklo_epi8(v_g0, v_a0); - __m128i layer1_chunk5 = _mm_unpackhi_epi8(v_g0, v_a0); - __m128i layer1_chunk6 = _mm_unpacklo_epi8(v_g1, v_a1); - __m128i layer1_chunk7 = _mm_unpackhi_epi8(v_g1, v_a1); - - __m128i layer2_chunk0 = _mm_unpacklo_epi8(layer1_chunk0, layer1_chunk4); - __m128i layer2_chunk1 = _mm_unpackhi_epi8(layer1_chunk0, layer1_chunk4); - __m128i layer2_chunk2 = _mm_unpacklo_epi8(layer1_chunk1, layer1_chunk5); - __m128i layer2_chunk3 = _mm_unpackhi_epi8(layer1_chunk1, layer1_chunk5); - __m128i layer2_chunk4 = _mm_unpacklo_epi8(layer1_chunk2, layer1_chunk6); - __m128i layer2_chunk5 = _mm_unpackhi_epi8(layer1_chunk2, layer1_chunk6); - __m128i layer2_chunk6 = _mm_unpacklo_epi8(layer1_chunk3, layer1_chunk7); - __m128i layer2_chunk7 = _mm_unpackhi_epi8(layer1_chunk3, layer1_chunk7); - - __m128i layer3_chunk0 = _mm_unpacklo_epi8(layer2_chunk0, layer2_chunk4); - __m128i layer3_chunk1 = _mm_unpackhi_epi8(layer2_chunk0, layer2_chunk4); - __m128i layer3_chunk2 = _mm_unpacklo_epi8(layer2_chunk1, layer2_chunk5); - __m128i layer3_chunk3 = _mm_unpackhi_epi8(layer2_chunk1, layer2_chunk5); - __m128i layer3_chunk4 = _mm_unpacklo_epi8(layer2_chunk2, layer2_chunk6); - __m128i layer3_chunk5 = _mm_unpackhi_epi8(layer2_chunk2, layer2_chunk6); - __m128i layer3_chunk6 = _mm_unpacklo_epi8(layer2_chunk3, layer2_chunk7); - __m128i layer3_chunk7 = _mm_unpackhi_epi8(layer2_chunk3, layer2_chunk7); - - __m128i layer4_chunk0 = _mm_unpacklo_epi8(layer3_chunk0, layer3_chunk4); - __m128i layer4_chunk1 = _mm_unpackhi_epi8(layer3_chunk0, layer3_chunk4); - __m128i layer4_chunk2 = _mm_unpacklo_epi8(layer3_chunk1, layer3_chunk5); - __m128i layer4_chunk3 = _mm_unpackhi_epi8(layer3_chunk1, layer3_chunk5); - __m128i layer4_chunk4 = _mm_unpacklo_epi8(layer3_chunk2, layer3_chunk6); - __m128i layer4_chunk5 = _mm_unpackhi_epi8(layer3_chunk2, layer3_chunk6); - __m128i layer4_chunk6 = _mm_unpacklo_epi8(layer3_chunk3, layer3_chunk7); - __m128i layer4_chunk7 = _mm_unpackhi_epi8(layer3_chunk3, layer3_chunk7); - - v_r0 = _mm_unpacklo_epi8(layer4_chunk0, layer4_chunk4); - v_r1 = _mm_unpackhi_epi8(layer4_chunk0, layer4_chunk4); - v_g0 = _mm_unpacklo_epi8(layer4_chunk1, layer4_chunk5); - v_g1 = _mm_unpackhi_epi8(layer4_chunk1, layer4_chunk5); - v_b0 = _mm_unpacklo_epi8(layer4_chunk2, layer4_chunk6); - v_b1 = _mm_unpackhi_epi8(layer4_chunk2, layer4_chunk6); - v_a0 = _mm_unpacklo_epi8(layer4_chunk3, layer4_chunk7); - v_a1 = _mm_unpackhi_epi8(layer4_chunk3, layer4_chunk7); -} - -inline void _mm_interleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1) -{ - __m128i v_mask = _mm_set1_epi16(0x00ff); - - __m128i layer4_chunk0 = _mm_packus_epi16(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask)); - __m128i layer4_chunk2 = _mm_packus_epi16(_mm_srli_epi16(v_r0, 8), _mm_srli_epi16(v_r1, 8)); - __m128i layer4_chunk1 = _mm_packus_epi16(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask)); - __m128i layer4_chunk3 = _mm_packus_epi16(_mm_srli_epi16(v_g0, 8), _mm_srli_epi16(v_g1, 8)); - - __m128i layer3_chunk0 = _mm_packus_epi16(_mm_and_si128(layer4_chunk0, v_mask), _mm_and_si128(layer4_chunk1, v_mask)); - __m128i layer3_chunk2 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk0, 8), _mm_srli_epi16(layer4_chunk1, 8)); - __m128i layer3_chunk1 = _mm_packus_epi16(_mm_and_si128(layer4_chunk2, v_mask), _mm_and_si128(layer4_chunk3, v_mask)); - __m128i layer3_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk2, 8), _mm_srli_epi16(layer4_chunk3, 8)); - - __m128i layer2_chunk0 = _mm_packus_epi16(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask)); - __m128i layer2_chunk2 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk0, 8), _mm_srli_epi16(layer3_chunk1, 8)); - __m128i layer2_chunk1 = _mm_packus_epi16(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask)); - __m128i layer2_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk2, 8), _mm_srli_epi16(layer3_chunk3, 8)); - - __m128i layer1_chunk0 = _mm_packus_epi16(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask)); - __m128i layer1_chunk2 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk0, 8), _mm_srli_epi16(layer2_chunk1, 8)); - __m128i layer1_chunk1 = _mm_packus_epi16(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask)); - __m128i layer1_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk2, 8), _mm_srli_epi16(layer2_chunk3, 8)); - - v_r0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask)); - v_g0 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk0, 8), _mm_srli_epi16(layer1_chunk1, 8)); - v_r1 = _mm_packus_epi16(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask)); - v_g1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk2, 8), _mm_srli_epi16(layer1_chunk3, 8)); -} - -inline void _mm_interleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, - __m128i & v_g1, __m128i & v_b0, __m128i & v_b1) -{ - __m128i v_mask = _mm_set1_epi16(0x00ff); - - __m128i layer4_chunk0 = _mm_packus_epi16(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask)); - __m128i layer4_chunk3 = _mm_packus_epi16(_mm_srli_epi16(v_r0, 8), _mm_srli_epi16(v_r1, 8)); - __m128i layer4_chunk1 = _mm_packus_epi16(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask)); - __m128i layer4_chunk4 = _mm_packus_epi16(_mm_srli_epi16(v_g0, 8), _mm_srli_epi16(v_g1, 8)); - __m128i layer4_chunk2 = _mm_packus_epi16(_mm_and_si128(v_b0, v_mask), _mm_and_si128(v_b1, v_mask)); - __m128i layer4_chunk5 = _mm_packus_epi16(_mm_srli_epi16(v_b0, 8), _mm_srli_epi16(v_b1, 8)); - - __m128i layer3_chunk0 = _mm_packus_epi16(_mm_and_si128(layer4_chunk0, v_mask), _mm_and_si128(layer4_chunk1, v_mask)); - __m128i layer3_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk0, 8), _mm_srli_epi16(layer4_chunk1, 8)); - __m128i layer3_chunk1 = _mm_packus_epi16(_mm_and_si128(layer4_chunk2, v_mask), _mm_and_si128(layer4_chunk3, v_mask)); - __m128i layer3_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk2, 8), _mm_srli_epi16(layer4_chunk3, 8)); - __m128i layer3_chunk2 = _mm_packus_epi16(_mm_and_si128(layer4_chunk4, v_mask), _mm_and_si128(layer4_chunk5, v_mask)); - __m128i layer3_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk4, 8), _mm_srli_epi16(layer4_chunk5, 8)); - - __m128i layer2_chunk0 = _mm_packus_epi16(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask)); - __m128i layer2_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk0, 8), _mm_srli_epi16(layer3_chunk1, 8)); - __m128i layer2_chunk1 = _mm_packus_epi16(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask)); - __m128i layer2_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk2, 8), _mm_srli_epi16(layer3_chunk3, 8)); - __m128i layer2_chunk2 = _mm_packus_epi16(_mm_and_si128(layer3_chunk4, v_mask), _mm_and_si128(layer3_chunk5, v_mask)); - __m128i layer2_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk4, 8), _mm_srli_epi16(layer3_chunk5, 8)); - - __m128i layer1_chunk0 = _mm_packus_epi16(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask)); - __m128i layer1_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk0, 8), _mm_srli_epi16(layer2_chunk1, 8)); - __m128i layer1_chunk1 = _mm_packus_epi16(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask)); - __m128i layer1_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk2, 8), _mm_srli_epi16(layer2_chunk3, 8)); - __m128i layer1_chunk2 = _mm_packus_epi16(_mm_and_si128(layer2_chunk4, v_mask), _mm_and_si128(layer2_chunk5, v_mask)); - __m128i layer1_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk4, 8), _mm_srli_epi16(layer2_chunk5, 8)); - - v_r0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask)); - v_g1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk0, 8), _mm_srli_epi16(layer1_chunk1, 8)); - v_r1 = _mm_packus_epi16(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask)); - v_b0 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk2, 8), _mm_srli_epi16(layer1_chunk3, 8)); - v_g0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk4, v_mask), _mm_and_si128(layer1_chunk5, v_mask)); - v_b1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk4, 8), _mm_srli_epi16(layer1_chunk5, 8)); -} - -inline void _mm_interleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1, - __m128i & v_b0, __m128i & v_b1, __m128i & v_a0, __m128i & v_a1) -{ - __m128i v_mask = _mm_set1_epi16(0x00ff); - - __m128i layer4_chunk0 = _mm_packus_epi16(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask)); - __m128i layer4_chunk4 = _mm_packus_epi16(_mm_srli_epi16(v_r0, 8), _mm_srli_epi16(v_r1, 8)); - __m128i layer4_chunk1 = _mm_packus_epi16(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask)); - __m128i layer4_chunk5 = _mm_packus_epi16(_mm_srli_epi16(v_g0, 8), _mm_srli_epi16(v_g1, 8)); - __m128i layer4_chunk2 = _mm_packus_epi16(_mm_and_si128(v_b0, v_mask), _mm_and_si128(v_b1, v_mask)); - __m128i layer4_chunk6 = _mm_packus_epi16(_mm_srli_epi16(v_b0, 8), _mm_srli_epi16(v_b1, 8)); - __m128i layer4_chunk3 = _mm_packus_epi16(_mm_and_si128(v_a0, v_mask), _mm_and_si128(v_a1, v_mask)); - __m128i layer4_chunk7 = _mm_packus_epi16(_mm_srli_epi16(v_a0, 8), _mm_srli_epi16(v_a1, 8)); - - __m128i layer3_chunk0 = _mm_packus_epi16(_mm_and_si128(layer4_chunk0, v_mask), _mm_and_si128(layer4_chunk1, v_mask)); - __m128i layer3_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk0, 8), _mm_srli_epi16(layer4_chunk1, 8)); - __m128i layer3_chunk1 = _mm_packus_epi16(_mm_and_si128(layer4_chunk2, v_mask), _mm_and_si128(layer4_chunk3, v_mask)); - __m128i layer3_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk2, 8), _mm_srli_epi16(layer4_chunk3, 8)); - __m128i layer3_chunk2 = _mm_packus_epi16(_mm_and_si128(layer4_chunk4, v_mask), _mm_and_si128(layer4_chunk5, v_mask)); - __m128i layer3_chunk6 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk4, 8), _mm_srli_epi16(layer4_chunk5, 8)); - __m128i layer3_chunk3 = _mm_packus_epi16(_mm_and_si128(layer4_chunk6, v_mask), _mm_and_si128(layer4_chunk7, v_mask)); - __m128i layer3_chunk7 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk6, 8), _mm_srli_epi16(layer4_chunk7, 8)); - - __m128i layer2_chunk0 = _mm_packus_epi16(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask)); - __m128i layer2_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk0, 8), _mm_srli_epi16(layer3_chunk1, 8)); - __m128i layer2_chunk1 = _mm_packus_epi16(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask)); - __m128i layer2_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk2, 8), _mm_srli_epi16(layer3_chunk3, 8)); - __m128i layer2_chunk2 = _mm_packus_epi16(_mm_and_si128(layer3_chunk4, v_mask), _mm_and_si128(layer3_chunk5, v_mask)); - __m128i layer2_chunk6 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk4, 8), _mm_srli_epi16(layer3_chunk5, 8)); - __m128i layer2_chunk3 = _mm_packus_epi16(_mm_and_si128(layer3_chunk6, v_mask), _mm_and_si128(layer3_chunk7, v_mask)); - __m128i layer2_chunk7 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk6, 8), _mm_srli_epi16(layer3_chunk7, 8)); - - __m128i layer1_chunk0 = _mm_packus_epi16(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask)); - __m128i layer1_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk0, 8), _mm_srli_epi16(layer2_chunk1, 8)); - __m128i layer1_chunk1 = _mm_packus_epi16(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask)); - __m128i layer1_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk2, 8), _mm_srli_epi16(layer2_chunk3, 8)); - __m128i layer1_chunk2 = _mm_packus_epi16(_mm_and_si128(layer2_chunk4, v_mask), _mm_and_si128(layer2_chunk5, v_mask)); - __m128i layer1_chunk6 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk4, 8), _mm_srli_epi16(layer2_chunk5, 8)); - __m128i layer1_chunk3 = _mm_packus_epi16(_mm_and_si128(layer2_chunk6, v_mask), _mm_and_si128(layer2_chunk7, v_mask)); - __m128i layer1_chunk7 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk6, 8), _mm_srli_epi16(layer2_chunk7, 8)); - - v_r0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask)); - v_b0 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk0, 8), _mm_srli_epi16(layer1_chunk1, 8)); - v_r1 = _mm_packus_epi16(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask)); - v_b1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk2, 8), _mm_srli_epi16(layer1_chunk3, 8)); - v_g0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk4, v_mask), _mm_and_si128(layer1_chunk5, v_mask)); - v_a0 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk4, 8), _mm_srli_epi16(layer1_chunk5, 8)); - v_g1 = _mm_packus_epi16(_mm_and_si128(layer1_chunk6, v_mask), _mm_and_si128(layer1_chunk7, v_mask)); - v_a1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk6, 8), _mm_srli_epi16(layer1_chunk7, 8)); -} - -inline void _mm_deinterleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1) -{ - __m128i layer1_chunk0 = _mm_unpacklo_epi16(v_r0, v_g0); - __m128i layer1_chunk1 = _mm_unpackhi_epi16(v_r0, v_g0); - __m128i layer1_chunk2 = _mm_unpacklo_epi16(v_r1, v_g1); - __m128i layer1_chunk3 = _mm_unpackhi_epi16(v_r1, v_g1); - - __m128i layer2_chunk0 = _mm_unpacklo_epi16(layer1_chunk0, layer1_chunk2); - __m128i layer2_chunk1 = _mm_unpackhi_epi16(layer1_chunk0, layer1_chunk2); - __m128i layer2_chunk2 = _mm_unpacklo_epi16(layer1_chunk1, layer1_chunk3); - __m128i layer2_chunk3 = _mm_unpackhi_epi16(layer1_chunk1, layer1_chunk3); - - __m128i layer3_chunk0 = _mm_unpacklo_epi16(layer2_chunk0, layer2_chunk2); - __m128i layer3_chunk1 = _mm_unpackhi_epi16(layer2_chunk0, layer2_chunk2); - __m128i layer3_chunk2 = _mm_unpacklo_epi16(layer2_chunk1, layer2_chunk3); - __m128i layer3_chunk3 = _mm_unpackhi_epi16(layer2_chunk1, layer2_chunk3); - - v_r0 = _mm_unpacklo_epi16(layer3_chunk0, layer3_chunk2); - v_r1 = _mm_unpackhi_epi16(layer3_chunk0, layer3_chunk2); - v_g0 = _mm_unpacklo_epi16(layer3_chunk1, layer3_chunk3); - v_g1 = _mm_unpackhi_epi16(layer3_chunk1, layer3_chunk3); -} - -inline void _mm_deinterleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, - __m128i & v_g1, __m128i & v_b0, __m128i & v_b1) -{ - __m128i layer1_chunk0 = _mm_unpacklo_epi16(v_r0, v_g1); - __m128i layer1_chunk1 = _mm_unpackhi_epi16(v_r0, v_g1); - __m128i layer1_chunk2 = _mm_unpacklo_epi16(v_r1, v_b0); - __m128i layer1_chunk3 = _mm_unpackhi_epi16(v_r1, v_b0); - __m128i layer1_chunk4 = _mm_unpacklo_epi16(v_g0, v_b1); - __m128i layer1_chunk5 = _mm_unpackhi_epi16(v_g0, v_b1); - - __m128i layer2_chunk0 = _mm_unpacklo_epi16(layer1_chunk0, layer1_chunk3); - __m128i layer2_chunk1 = _mm_unpackhi_epi16(layer1_chunk0, layer1_chunk3); - __m128i layer2_chunk2 = _mm_unpacklo_epi16(layer1_chunk1, layer1_chunk4); - __m128i layer2_chunk3 = _mm_unpackhi_epi16(layer1_chunk1, layer1_chunk4); - __m128i layer2_chunk4 = _mm_unpacklo_epi16(layer1_chunk2, layer1_chunk5); - __m128i layer2_chunk5 = _mm_unpackhi_epi16(layer1_chunk2, layer1_chunk5); - - __m128i layer3_chunk0 = _mm_unpacklo_epi16(layer2_chunk0, layer2_chunk3); - __m128i layer3_chunk1 = _mm_unpackhi_epi16(layer2_chunk0, layer2_chunk3); - __m128i layer3_chunk2 = _mm_unpacklo_epi16(layer2_chunk1, layer2_chunk4); - __m128i layer3_chunk3 = _mm_unpackhi_epi16(layer2_chunk1, layer2_chunk4); - __m128i layer3_chunk4 = _mm_unpacklo_epi16(layer2_chunk2, layer2_chunk5); - __m128i layer3_chunk5 = _mm_unpackhi_epi16(layer2_chunk2, layer2_chunk5); - - v_r0 = _mm_unpacklo_epi16(layer3_chunk0, layer3_chunk3); - v_r1 = _mm_unpackhi_epi16(layer3_chunk0, layer3_chunk3); - v_g0 = _mm_unpacklo_epi16(layer3_chunk1, layer3_chunk4); - v_g1 = _mm_unpackhi_epi16(layer3_chunk1, layer3_chunk4); - v_b0 = _mm_unpacklo_epi16(layer3_chunk2, layer3_chunk5); - v_b1 = _mm_unpackhi_epi16(layer3_chunk2, layer3_chunk5); -} - -inline void _mm_deinterleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1, - __m128i & v_b0, __m128i & v_b1, __m128i & v_a0, __m128i & v_a1) -{ - __m128i layer1_chunk0 = _mm_unpacklo_epi16(v_r0, v_b0); - __m128i layer1_chunk1 = _mm_unpackhi_epi16(v_r0, v_b0); - __m128i layer1_chunk2 = _mm_unpacklo_epi16(v_r1, v_b1); - __m128i layer1_chunk3 = _mm_unpackhi_epi16(v_r1, v_b1); - __m128i layer1_chunk4 = _mm_unpacklo_epi16(v_g0, v_a0); - __m128i layer1_chunk5 = _mm_unpackhi_epi16(v_g0, v_a0); - __m128i layer1_chunk6 = _mm_unpacklo_epi16(v_g1, v_a1); - __m128i layer1_chunk7 = _mm_unpackhi_epi16(v_g1, v_a1); - - __m128i layer2_chunk0 = _mm_unpacklo_epi16(layer1_chunk0, layer1_chunk4); - __m128i layer2_chunk1 = _mm_unpackhi_epi16(layer1_chunk0, layer1_chunk4); - __m128i layer2_chunk2 = _mm_unpacklo_epi16(layer1_chunk1, layer1_chunk5); - __m128i layer2_chunk3 = _mm_unpackhi_epi16(layer1_chunk1, layer1_chunk5); - __m128i layer2_chunk4 = _mm_unpacklo_epi16(layer1_chunk2, layer1_chunk6); - __m128i layer2_chunk5 = _mm_unpackhi_epi16(layer1_chunk2, layer1_chunk6); - __m128i layer2_chunk6 = _mm_unpacklo_epi16(layer1_chunk3, layer1_chunk7); - __m128i layer2_chunk7 = _mm_unpackhi_epi16(layer1_chunk3, layer1_chunk7); - - __m128i layer3_chunk0 = _mm_unpacklo_epi16(layer2_chunk0, layer2_chunk4); - __m128i layer3_chunk1 = _mm_unpackhi_epi16(layer2_chunk0, layer2_chunk4); - __m128i layer3_chunk2 = _mm_unpacklo_epi16(layer2_chunk1, layer2_chunk5); - __m128i layer3_chunk3 = _mm_unpackhi_epi16(layer2_chunk1, layer2_chunk5); - __m128i layer3_chunk4 = _mm_unpacklo_epi16(layer2_chunk2, layer2_chunk6); - __m128i layer3_chunk5 = _mm_unpackhi_epi16(layer2_chunk2, layer2_chunk6); - __m128i layer3_chunk6 = _mm_unpacklo_epi16(layer2_chunk3, layer2_chunk7); - __m128i layer3_chunk7 = _mm_unpackhi_epi16(layer2_chunk3, layer2_chunk7); - - v_r0 = _mm_unpacklo_epi16(layer3_chunk0, layer3_chunk4); - v_r1 = _mm_unpackhi_epi16(layer3_chunk0, layer3_chunk4); - v_g0 = _mm_unpacklo_epi16(layer3_chunk1, layer3_chunk5); - v_g1 = _mm_unpackhi_epi16(layer3_chunk1, layer3_chunk5); - v_b0 = _mm_unpacklo_epi16(layer3_chunk2, layer3_chunk6); - v_b1 = _mm_unpackhi_epi16(layer3_chunk2, layer3_chunk6); - v_a0 = _mm_unpacklo_epi16(layer3_chunk3, layer3_chunk7); - v_a1 = _mm_unpackhi_epi16(layer3_chunk3, layer3_chunk7); -} - -#if CV_SSE4_1 - -inline void _mm_interleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1) -{ - __m128i v_mask = _mm_set1_epi32(0x0000ffff); - - __m128i layer3_chunk0 = _mm_packus_epi32(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask)); - __m128i layer3_chunk2 = _mm_packus_epi32(_mm_srli_epi32(v_r0, 16), _mm_srli_epi32(v_r1, 16)); - __m128i layer3_chunk1 = _mm_packus_epi32(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask)); - __m128i layer3_chunk3 = _mm_packus_epi32(_mm_srli_epi32(v_g0, 16), _mm_srli_epi32(v_g1, 16)); - - __m128i layer2_chunk0 = _mm_packus_epi32(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask)); - __m128i layer2_chunk2 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk0, 16), _mm_srli_epi32(layer3_chunk1, 16)); - __m128i layer2_chunk1 = _mm_packus_epi32(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask)); - __m128i layer2_chunk3 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk2, 16), _mm_srli_epi32(layer3_chunk3, 16)); - - __m128i layer1_chunk0 = _mm_packus_epi32(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask)); - __m128i layer1_chunk2 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk0, 16), _mm_srli_epi32(layer2_chunk1, 16)); - __m128i layer1_chunk1 = _mm_packus_epi32(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask)); - __m128i layer1_chunk3 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk2, 16), _mm_srli_epi32(layer2_chunk3, 16)); - - v_r0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask)); - v_g0 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk0, 16), _mm_srli_epi32(layer1_chunk1, 16)); - v_r1 = _mm_packus_epi32(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask)); - v_g1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk2, 16), _mm_srli_epi32(layer1_chunk3, 16)); -} - -inline void _mm_interleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, - __m128i & v_g1, __m128i & v_b0, __m128i & v_b1) -{ - __m128i v_mask = _mm_set1_epi32(0x0000ffff); - - __m128i layer3_chunk0 = _mm_packus_epi32(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask)); - __m128i layer3_chunk3 = _mm_packus_epi32(_mm_srli_epi32(v_r0, 16), _mm_srli_epi32(v_r1, 16)); - __m128i layer3_chunk1 = _mm_packus_epi32(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask)); - __m128i layer3_chunk4 = _mm_packus_epi32(_mm_srli_epi32(v_g0, 16), _mm_srli_epi32(v_g1, 16)); - __m128i layer3_chunk2 = _mm_packus_epi32(_mm_and_si128(v_b0, v_mask), _mm_and_si128(v_b1, v_mask)); - __m128i layer3_chunk5 = _mm_packus_epi32(_mm_srli_epi32(v_b0, 16), _mm_srli_epi32(v_b1, 16)); - - __m128i layer2_chunk0 = _mm_packus_epi32(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask)); - __m128i layer2_chunk3 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk0, 16), _mm_srli_epi32(layer3_chunk1, 16)); - __m128i layer2_chunk1 = _mm_packus_epi32(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask)); - __m128i layer2_chunk4 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk2, 16), _mm_srli_epi32(layer3_chunk3, 16)); - __m128i layer2_chunk2 = _mm_packus_epi32(_mm_and_si128(layer3_chunk4, v_mask), _mm_and_si128(layer3_chunk5, v_mask)); - __m128i layer2_chunk5 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk4, 16), _mm_srli_epi32(layer3_chunk5, 16)); - - __m128i layer1_chunk0 = _mm_packus_epi32(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask)); - __m128i layer1_chunk3 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk0, 16), _mm_srli_epi32(layer2_chunk1, 16)); - __m128i layer1_chunk1 = _mm_packus_epi32(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask)); - __m128i layer1_chunk4 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk2, 16), _mm_srli_epi32(layer2_chunk3, 16)); - __m128i layer1_chunk2 = _mm_packus_epi32(_mm_and_si128(layer2_chunk4, v_mask), _mm_and_si128(layer2_chunk5, v_mask)); - __m128i layer1_chunk5 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk4, 16), _mm_srli_epi32(layer2_chunk5, 16)); - - v_r0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask)); - v_g1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk0, 16), _mm_srli_epi32(layer1_chunk1, 16)); - v_r1 = _mm_packus_epi32(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask)); - v_b0 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk2, 16), _mm_srli_epi32(layer1_chunk3, 16)); - v_g0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk4, v_mask), _mm_and_si128(layer1_chunk5, v_mask)); - v_b1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk4, 16), _mm_srli_epi32(layer1_chunk5, 16)); -} - -inline void _mm_interleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1, - __m128i & v_b0, __m128i & v_b1, __m128i & v_a0, __m128i & v_a1) -{ - __m128i v_mask = _mm_set1_epi32(0x0000ffff); - - __m128i layer3_chunk0 = _mm_packus_epi32(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask)); - __m128i layer3_chunk4 = _mm_packus_epi32(_mm_srli_epi32(v_r0, 16), _mm_srli_epi32(v_r1, 16)); - __m128i layer3_chunk1 = _mm_packus_epi32(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask)); - __m128i layer3_chunk5 = _mm_packus_epi32(_mm_srli_epi32(v_g0, 16), _mm_srli_epi32(v_g1, 16)); - __m128i layer3_chunk2 = _mm_packus_epi32(_mm_and_si128(v_b0, v_mask), _mm_and_si128(v_b1, v_mask)); - __m128i layer3_chunk6 = _mm_packus_epi32(_mm_srli_epi32(v_b0, 16), _mm_srli_epi32(v_b1, 16)); - __m128i layer3_chunk3 = _mm_packus_epi32(_mm_and_si128(v_a0, v_mask), _mm_and_si128(v_a1, v_mask)); - __m128i layer3_chunk7 = _mm_packus_epi32(_mm_srli_epi32(v_a0, 16), _mm_srli_epi32(v_a1, 16)); - - __m128i layer2_chunk0 = _mm_packus_epi32(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask)); - __m128i layer2_chunk4 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk0, 16), _mm_srli_epi32(layer3_chunk1, 16)); - __m128i layer2_chunk1 = _mm_packus_epi32(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask)); - __m128i layer2_chunk5 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk2, 16), _mm_srli_epi32(layer3_chunk3, 16)); - __m128i layer2_chunk2 = _mm_packus_epi32(_mm_and_si128(layer3_chunk4, v_mask), _mm_and_si128(layer3_chunk5, v_mask)); - __m128i layer2_chunk6 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk4, 16), _mm_srli_epi32(layer3_chunk5, 16)); - __m128i layer2_chunk3 = _mm_packus_epi32(_mm_and_si128(layer3_chunk6, v_mask), _mm_and_si128(layer3_chunk7, v_mask)); - __m128i layer2_chunk7 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk6, 16), _mm_srli_epi32(layer3_chunk7, 16)); - - __m128i layer1_chunk0 = _mm_packus_epi32(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask)); - __m128i layer1_chunk4 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk0, 16), _mm_srli_epi32(layer2_chunk1, 16)); - __m128i layer1_chunk1 = _mm_packus_epi32(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask)); - __m128i layer1_chunk5 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk2, 16), _mm_srli_epi32(layer2_chunk3, 16)); - __m128i layer1_chunk2 = _mm_packus_epi32(_mm_and_si128(layer2_chunk4, v_mask), _mm_and_si128(layer2_chunk5, v_mask)); - __m128i layer1_chunk6 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk4, 16), _mm_srli_epi32(layer2_chunk5, 16)); - __m128i layer1_chunk3 = _mm_packus_epi32(_mm_and_si128(layer2_chunk6, v_mask), _mm_and_si128(layer2_chunk7, v_mask)); - __m128i layer1_chunk7 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk6, 16), _mm_srli_epi32(layer2_chunk7, 16)); - - v_r0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask)); - v_b0 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk0, 16), _mm_srli_epi32(layer1_chunk1, 16)); - v_r1 = _mm_packus_epi32(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask)); - v_b1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk2, 16), _mm_srli_epi32(layer1_chunk3, 16)); - v_g0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk4, v_mask), _mm_and_si128(layer1_chunk5, v_mask)); - v_a0 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk4, 16), _mm_srli_epi32(layer1_chunk5, 16)); - v_g1 = _mm_packus_epi32(_mm_and_si128(layer1_chunk6, v_mask), _mm_and_si128(layer1_chunk7, v_mask)); - v_a1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk6, 16), _mm_srli_epi32(layer1_chunk7, 16)); -} - -#endif // CV_SSE4_1 - -inline void _mm_deinterleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1) -{ - __m128 layer1_chunk0 = _mm_unpacklo_ps(v_r0, v_g0); - __m128 layer1_chunk1 = _mm_unpackhi_ps(v_r0, v_g0); - __m128 layer1_chunk2 = _mm_unpacklo_ps(v_r1, v_g1); - __m128 layer1_chunk3 = _mm_unpackhi_ps(v_r1, v_g1); - - __m128 layer2_chunk0 = _mm_unpacklo_ps(layer1_chunk0, layer1_chunk2); - __m128 layer2_chunk1 = _mm_unpackhi_ps(layer1_chunk0, layer1_chunk2); - __m128 layer2_chunk2 = _mm_unpacklo_ps(layer1_chunk1, layer1_chunk3); - __m128 layer2_chunk3 = _mm_unpackhi_ps(layer1_chunk1, layer1_chunk3); - - v_r0 = _mm_unpacklo_ps(layer2_chunk0, layer2_chunk2); - v_r1 = _mm_unpackhi_ps(layer2_chunk0, layer2_chunk2); - v_g0 = _mm_unpacklo_ps(layer2_chunk1, layer2_chunk3); - v_g1 = _mm_unpackhi_ps(layer2_chunk1, layer2_chunk3); -} - -inline void _mm_deinterleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, - __m128 & v_g1, __m128 & v_b0, __m128 & v_b1) -{ - __m128 layer1_chunk0 = _mm_unpacklo_ps(v_r0, v_g1); - __m128 layer1_chunk1 = _mm_unpackhi_ps(v_r0, v_g1); - __m128 layer1_chunk2 = _mm_unpacklo_ps(v_r1, v_b0); - __m128 layer1_chunk3 = _mm_unpackhi_ps(v_r1, v_b0); - __m128 layer1_chunk4 = _mm_unpacklo_ps(v_g0, v_b1); - __m128 layer1_chunk5 = _mm_unpackhi_ps(v_g0, v_b1); - - __m128 layer2_chunk0 = _mm_unpacklo_ps(layer1_chunk0, layer1_chunk3); - __m128 layer2_chunk1 = _mm_unpackhi_ps(layer1_chunk0, layer1_chunk3); - __m128 layer2_chunk2 = _mm_unpacklo_ps(layer1_chunk1, layer1_chunk4); - __m128 layer2_chunk3 = _mm_unpackhi_ps(layer1_chunk1, layer1_chunk4); - __m128 layer2_chunk4 = _mm_unpacklo_ps(layer1_chunk2, layer1_chunk5); - __m128 layer2_chunk5 = _mm_unpackhi_ps(layer1_chunk2, layer1_chunk5); - - v_r0 = _mm_unpacklo_ps(layer2_chunk0, layer2_chunk3); - v_r1 = _mm_unpackhi_ps(layer2_chunk0, layer2_chunk3); - v_g0 = _mm_unpacklo_ps(layer2_chunk1, layer2_chunk4); - v_g1 = _mm_unpackhi_ps(layer2_chunk1, layer2_chunk4); - v_b0 = _mm_unpacklo_ps(layer2_chunk2, layer2_chunk5); - v_b1 = _mm_unpackhi_ps(layer2_chunk2, layer2_chunk5); -} - -inline void _mm_deinterleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1, - __m128 & v_b0, __m128 & v_b1, __m128 & v_a0, __m128 & v_a1) -{ - __m128 layer1_chunk0 = _mm_unpacklo_ps(v_r0, v_b0); - __m128 layer1_chunk1 = _mm_unpackhi_ps(v_r0, v_b0); - __m128 layer1_chunk2 = _mm_unpacklo_ps(v_r1, v_b1); - __m128 layer1_chunk3 = _mm_unpackhi_ps(v_r1, v_b1); - __m128 layer1_chunk4 = _mm_unpacklo_ps(v_g0, v_a0); - __m128 layer1_chunk5 = _mm_unpackhi_ps(v_g0, v_a0); - __m128 layer1_chunk6 = _mm_unpacklo_ps(v_g1, v_a1); - __m128 layer1_chunk7 = _mm_unpackhi_ps(v_g1, v_a1); - - __m128 layer2_chunk0 = _mm_unpacklo_ps(layer1_chunk0, layer1_chunk4); - __m128 layer2_chunk1 = _mm_unpackhi_ps(layer1_chunk0, layer1_chunk4); - __m128 layer2_chunk2 = _mm_unpacklo_ps(layer1_chunk1, layer1_chunk5); - __m128 layer2_chunk3 = _mm_unpackhi_ps(layer1_chunk1, layer1_chunk5); - __m128 layer2_chunk4 = _mm_unpacklo_ps(layer1_chunk2, layer1_chunk6); - __m128 layer2_chunk5 = _mm_unpackhi_ps(layer1_chunk2, layer1_chunk6); - __m128 layer2_chunk6 = _mm_unpacklo_ps(layer1_chunk3, layer1_chunk7); - __m128 layer2_chunk7 = _mm_unpackhi_ps(layer1_chunk3, layer1_chunk7); - - v_r0 = _mm_unpacklo_ps(layer2_chunk0, layer2_chunk4); - v_r1 = _mm_unpackhi_ps(layer2_chunk0, layer2_chunk4); - v_g0 = _mm_unpacklo_ps(layer2_chunk1, layer2_chunk5); - v_g1 = _mm_unpackhi_ps(layer2_chunk1, layer2_chunk5); - v_b0 = _mm_unpacklo_ps(layer2_chunk2, layer2_chunk6); - v_b1 = _mm_unpackhi_ps(layer2_chunk2, layer2_chunk6); - v_a0 = _mm_unpacklo_ps(layer2_chunk3, layer2_chunk7); - v_a1 = _mm_unpackhi_ps(layer2_chunk3, layer2_chunk7); -} - -inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1) -{ - enum { mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1) }; - - __m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo); - __m128 layer2_chunk2 = _mm_shuffle_ps(v_r0, v_r1, mask_hi); - __m128 layer2_chunk1 = _mm_shuffle_ps(v_g0, v_g1, mask_lo); - __m128 layer2_chunk3 = _mm_shuffle_ps(v_g0, v_g1, mask_hi); - - __m128 layer1_chunk0 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_lo); - __m128 layer1_chunk2 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_hi); - __m128 layer1_chunk1 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_lo); - __m128 layer1_chunk3 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_hi); - - v_r0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_lo); - v_g0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_hi); - v_r1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_lo); - v_g1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_hi); -} - -inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, - __m128 & v_g1, __m128 & v_b0, __m128 & v_b1) -{ - enum { mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1) }; - - __m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo); - __m128 layer2_chunk3 = _mm_shuffle_ps(v_r0, v_r1, mask_hi); - __m128 layer2_chunk1 = _mm_shuffle_ps(v_g0, v_g1, mask_lo); - __m128 layer2_chunk4 = _mm_shuffle_ps(v_g0, v_g1, mask_hi); - __m128 layer2_chunk2 = _mm_shuffle_ps(v_b0, v_b1, mask_lo); - __m128 layer2_chunk5 = _mm_shuffle_ps(v_b0, v_b1, mask_hi); - - __m128 layer1_chunk0 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_lo); - __m128 layer1_chunk3 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_hi); - __m128 layer1_chunk1 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_lo); - __m128 layer1_chunk4 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_hi); - __m128 layer1_chunk2 = _mm_shuffle_ps(layer2_chunk4, layer2_chunk5, mask_lo); - __m128 layer1_chunk5 = _mm_shuffle_ps(layer2_chunk4, layer2_chunk5, mask_hi); - - v_r0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_lo); - v_g1 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_hi); - v_r1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_lo); - v_b0 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_hi); - v_g0 = _mm_shuffle_ps(layer1_chunk4, layer1_chunk5, mask_lo); - v_b1 = _mm_shuffle_ps(layer1_chunk4, layer1_chunk5, mask_hi); -} - -inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1, - __m128 & v_b0, __m128 & v_b1, __m128 & v_a0, __m128 & v_a1) -{ - enum { mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1) }; - - __m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo); - __m128 layer2_chunk4 = _mm_shuffle_ps(v_r0, v_r1, mask_hi); - __m128 layer2_chunk1 = _mm_shuffle_ps(v_g0, v_g1, mask_lo); - __m128 layer2_chunk5 = _mm_shuffle_ps(v_g0, v_g1, mask_hi); - __m128 layer2_chunk2 = _mm_shuffle_ps(v_b0, v_b1, mask_lo); - __m128 layer2_chunk6 = _mm_shuffle_ps(v_b0, v_b1, mask_hi); - __m128 layer2_chunk3 = _mm_shuffle_ps(v_a0, v_a1, mask_lo); - __m128 layer2_chunk7 = _mm_shuffle_ps(v_a0, v_a1, mask_hi); - - __m128 layer1_chunk0 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_lo); - __m128 layer1_chunk4 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_hi); - __m128 layer1_chunk1 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_lo); - __m128 layer1_chunk5 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_hi); - __m128 layer1_chunk2 = _mm_shuffle_ps(layer2_chunk4, layer2_chunk5, mask_lo); - __m128 layer1_chunk6 = _mm_shuffle_ps(layer2_chunk4, layer2_chunk5, mask_hi); - __m128 layer1_chunk3 = _mm_shuffle_ps(layer2_chunk6, layer2_chunk7, mask_lo); - __m128 layer1_chunk7 = _mm_shuffle_ps(layer2_chunk6, layer2_chunk7, mask_hi); - - v_r0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_lo); - v_b0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_hi); - v_r1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_lo); - v_b1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_hi); - v_g0 = _mm_shuffle_ps(layer1_chunk4, layer1_chunk5, mask_lo); - v_a0 = _mm_shuffle_ps(layer1_chunk4, layer1_chunk5, mask_hi); - v_g1 = _mm_shuffle_ps(layer1_chunk6, layer1_chunk7, mask_lo); - v_a1 = _mm_shuffle_ps(layer1_chunk6, layer1_chunk7, mask_hi); -} - -#endif // CV_SSE2 - -//! @} - -#endif //OPENCV_CORE_SSE_UTILS_HPP diff --git a/opencv/include/opencv2/core/traits.hpp b/opencv/include/opencv2/core/traits.hpp deleted file mode 100644 index 6cb10f4..0000000 --- a/opencv/include/opencv2/core/traits.hpp +++ /dev/null @@ -1,397 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_TRAITS_HPP -#define OPENCV_CORE_TRAITS_HPP - -#include "opencv2/core/cvdef.h" - -namespace cv -{ - -//#define OPENCV_TRAITS_ENABLE_DEPRECATED - -//! @addtogroup core_basic -//! @{ - -/** @brief Template "trait" class for OpenCV primitive data types. - -@note Deprecated. This is replaced by "single purpose" traits: traits::Type and traits::Depth - -A primitive OpenCV data type is one of unsigned char, bool, signed char, unsigned short, signed -short, int, float, double, or a tuple of values of one of these types, where all the values in the -tuple have the same type. Any primitive type from the list can be defined by an identifier in the -form CV_\{U|S|F}C(\), for example: uchar \~ CV_8UC1, 3-element -floating-point tuple \~ CV_32FC3, and so on. A universal OpenCV structure that is able to store a -single instance of such a primitive data type is Vec. Multiple instances of such a type can be -stored in a std::vector, Mat, Mat_, SparseMat, SparseMat_, or any other container that is able to -store Vec instances. - -The DataType class is basically used to provide a description of such primitive data types without -adding any fields or methods to the corresponding classes (and it is actually impossible to add -anything to primitive C/C++ data types). This technique is known in C++ as class traits. It is not -DataType itself that is used but its specialized versions, such as: -@code - template<> class DataType - { - typedef uchar value_type; - typedef int work_type; - typedef uchar channel_type; - enum { channel_type = CV_8U, channels = 1, fmt='u', type = CV_8U }; - }; - ... - template DataType > - { - typedef std::complex<_Tp> value_type; - typedef std::complex<_Tp> work_type; - typedef _Tp channel_type; - // DataDepth is another helper trait class - enum { depth = DataDepth<_Tp>::value, channels=2, - fmt=(channels-1)*256+DataDepth<_Tp>::fmt, - type=CV_MAKETYPE(depth, channels) }; - }; - ... -@endcode -The main purpose of this class is to convert compilation-time type information to an -OpenCV-compatible data type identifier, for example: -@code - // allocates a 30x40 floating-point matrix - Mat A(30, 40, DataType::type); - - Mat B = Mat_ >(3, 3); - // the statement below will print 6, 2 , that is depth == CV_64F, channels == 2 - cout << B.depth() << ", " << B.channels() << endl; -@endcode -So, such traits are used to tell OpenCV which data type you are working with, even if such a type is -not native to OpenCV. For example, the matrix B initialization above is compiled because OpenCV -defines the proper specialized template class DataType\ \> . This mechanism is also -useful (and used in OpenCV this way) for generic algorithms implementations. - -@note Default values were dropped to stop confusing developers about using of unsupported types (see #7599) -*/ -template class DataType -{ -public: -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - typedef _Tp value_type; - typedef value_type work_type; - typedef value_type channel_type; - typedef value_type vec_type; - enum { generic_type = 1, - depth = -1, - channels = 1, - fmt = 0, - type = CV_MAKETYPE(depth, channels) - }; -#endif -}; - -template<> class DataType -{ -public: - typedef bool value_type; - typedef int work_type; - typedef value_type channel_type; - typedef value_type vec_type; - enum { generic_type = 0, - depth = CV_8U, - channels = 1, - fmt = (int)'u', - type = CV_MAKETYPE(depth, channels) - }; -}; - -template<> class DataType -{ -public: - typedef uchar value_type; - typedef int work_type; - typedef value_type channel_type; - typedef value_type vec_type; - enum { generic_type = 0, - depth = CV_8U, - channels = 1, - fmt = (int)'u', - type = CV_MAKETYPE(depth, channels) - }; -}; - -template<> class DataType -{ -public: - typedef schar value_type; - typedef int work_type; - typedef value_type channel_type; - typedef value_type vec_type; - enum { generic_type = 0, - depth = CV_8S, - channels = 1, - fmt = (int)'c', - type = CV_MAKETYPE(depth, channels) - }; -}; - -template<> class DataType -{ -public: - typedef schar value_type; - typedef int work_type; - typedef value_type channel_type; - typedef value_type vec_type; - enum { generic_type = 0, - depth = CV_8S, - channels = 1, - fmt = (int)'c', - type = CV_MAKETYPE(depth, channels) - }; -}; - -template<> class DataType -{ -public: - typedef ushort value_type; - typedef int work_type; - typedef value_type channel_type; - typedef value_type vec_type; - enum { generic_type = 0, - depth = CV_16U, - channels = 1, - fmt = (int)'w', - type = CV_MAKETYPE(depth, channels) - }; -}; - -template<> class DataType -{ -public: - typedef short value_type; - typedef int work_type; - typedef value_type channel_type; - typedef value_type vec_type; - enum { generic_type = 0, - depth = CV_16S, - channels = 1, - fmt = (int)'s', - type = CV_MAKETYPE(depth, channels) - }; -}; - -template<> class DataType -{ -public: - typedef int value_type; - typedef value_type work_type; - typedef value_type channel_type; - typedef value_type vec_type; - enum { generic_type = 0, - depth = CV_32S, - channels = 1, - fmt = (int)'i', - type = CV_MAKETYPE(depth, channels) - }; -}; - -template<> class DataType -{ -public: - typedef float value_type; - typedef value_type work_type; - typedef value_type channel_type; - typedef value_type vec_type; - enum { generic_type = 0, - depth = CV_32F, - channels = 1, - fmt = (int)'f', - type = CV_MAKETYPE(depth, channels) - }; -}; - -template<> class DataType -{ -public: - typedef double value_type; - typedef value_type work_type; - typedef value_type channel_type; - typedef value_type vec_type; - enum { generic_type = 0, - depth = CV_64F, - channels = 1, - fmt = (int)'d', - type = CV_MAKETYPE(depth, channels) - }; -}; - - -/** @brief A helper class for cv::DataType - -The class is specialized for each fundamental numerical data type supported by OpenCV. It provides -DataDepth::value constant. -*/ -template class DataDepth -{ -public: - enum - { - value = DataType<_Tp>::depth, - fmt = DataType<_Tp>::fmt - }; -}; - - -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - -template class TypeDepth -{ -#ifdef OPENCV_TRAITS_ENABLE_LEGACY_DEFAULTS - enum { depth = CV_USRTYPE1 }; - typedef void value_type; -#endif -}; - -template<> class TypeDepth -{ - enum { depth = CV_8U }; - typedef uchar value_type; -}; - -template<> class TypeDepth -{ - enum { depth = CV_8S }; - typedef schar value_type; -}; - -template<> class TypeDepth -{ - enum { depth = CV_16U }; - typedef ushort value_type; -}; - -template<> class TypeDepth -{ - enum { depth = CV_16S }; - typedef short value_type; -}; - -template<> class TypeDepth -{ - enum { depth = CV_32S }; - typedef int value_type; -}; - -template<> class TypeDepth -{ - enum { depth = CV_32F }; - typedef float value_type; -}; - -template<> class TypeDepth -{ - enum { depth = CV_64F }; - typedef double value_type; -}; - -#endif - -//! @} - -namespace traits { - -namespace internal { -#define CV_CREATE_MEMBER_CHECK(X) \ -template class CheckMember_##X { \ - struct Fallback { int X; }; \ - struct Derived : T, Fallback { }; \ - template struct Check; \ - typedef char CV_NO[1]; \ - typedef char CV_YES[2]; \ - template static CV_NO & func(Check *); \ - template static CV_YES & func(...); \ -public: \ - typedef CheckMember_##X type; \ - enum { value = sizeof(func(0)) == sizeof(CV_YES) }; \ -}; - -CV_CREATE_MEMBER_CHECK(fmt) -CV_CREATE_MEMBER_CHECK(type) - -} // namespace internal - - -template -struct Depth -{ enum { value = DataType::depth }; }; - -template -struct Type -{ enum { value = DataType::type }; }; - -/** Similar to traits::Type but has value = -1 in case of unknown type (instead of compiler error) */ -template >::value > -struct SafeType {}; - -template -struct SafeType -{ enum { value = -1 }; }; - -template -struct SafeType -{ enum { value = Type::value }; }; - - -template >::value > -struct SafeFmt {}; - -template -struct SafeFmt -{ enum { fmt = 0 }; }; - -template -struct SafeFmt -{ enum { fmt = DataType::fmt }; }; - - -} // namespace - -} // cv - -#endif // OPENCV_CORE_TRAITS_HPP diff --git a/opencv/include/opencv2/core/types.hpp b/opencv/include/opencv2/core/types.hpp deleted file mode 100644 index ef9ab59..0000000 --- a/opencv/include/opencv2/core/types.hpp +++ /dev/null @@ -1,2391 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_TYPES_HPP -#define OPENCV_CORE_TYPES_HPP - -#ifndef __cplusplus -# error types.hpp header must be compiled as C++ -#endif - -#include -#include -#include -#include - -#include "opencv2/core/cvdef.h" -#include "opencv2/core/cvstd.hpp" -#include "opencv2/core/matx.hpp" - -namespace cv -{ - -//! @addtogroup core_basic -//! @{ - -//////////////////////////////// Complex ////////////////////////////// - -/** @brief A complex number class. - - The template class is similar and compatible with std::complex, however it provides slightly - more convenient access to the real and imaginary parts using through the simple field access, as opposite - to std::complex::real() and std::complex::imag(). -*/ -template class Complex -{ -public: - - //! default constructor - Complex(); - Complex( _Tp _re, _Tp _im = 0 ); - - //! conversion to another data type - template operator Complex() const; - //! conjugation - Complex conj() const; - - _Tp re, im; //< the real and the imaginary parts -}; - -typedef Complex Complexf; -typedef Complex Complexd; - -template class DataType< Complex<_Tp> > -{ -public: - typedef Complex<_Tp> value_type; - typedef value_type work_type; - typedef _Tp channel_type; - - enum { generic_type = 0, - channels = 2, - fmt = DataType::fmt + ((channels - 1) << 8) -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - ,depth = DataType::depth - ,type = CV_MAKETYPE(depth, channels) -#endif - }; - - typedef Vec vec_type; -}; - -namespace traits { -template -struct Depth< Complex<_Tp> > { enum { value = Depth<_Tp>::value }; }; -template -struct Type< Complex<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 2) }; }; -} // namespace - - -//////////////////////////////// Point_ //////////////////////////////// - -/** @brief Template class for 2D points specified by its coordinates `x` and `y`. - -An instance of the class is interchangeable with C structures, CvPoint and CvPoint2D32f . There is -also a cast operator to convert point coordinates to the specified type. The conversion from -floating-point coordinates to integer coordinates is done by rounding. Commonly, the conversion -uses this operation for each of the coordinates. Besides the class members listed in the -declaration above, the following operations on points are implemented: -@code - pt1 = pt2 + pt3; - pt1 = pt2 - pt3; - pt1 = pt2 * a; - pt1 = a * pt2; - pt1 = pt2 / a; - pt1 += pt2; - pt1 -= pt2; - pt1 *= a; - pt1 /= a; - double value = norm(pt); // L2 norm - pt1 == pt2; - pt1 != pt2; -@endcode -For your convenience, the following type aliases are defined: -@code - typedef Point_ Point2i; - typedef Point2i Point; - typedef Point_ Point2f; - typedef Point_ Point2d; -@endcode -Example: -@code - Point2f a(0.3f, 0.f), b(0.f, 0.4f); - Point pt = (a + b)*10.f; - cout << pt.x << ", " << pt.y << endl; -@endcode -*/ -template class Point_ -{ -public: - typedef _Tp value_type; - - //! default constructor - Point_(); - Point_(_Tp _x, _Tp _y); - Point_(const Point_& pt); - Point_(const Size_<_Tp>& sz); - Point_(const Vec<_Tp, 2>& v); - - Point_& operator = (const Point_& pt); - //! conversion to another data type - template operator Point_<_Tp2>() const; - - //! conversion to the old-style C structures - operator Vec<_Tp, 2>() const; - - //! dot product - _Tp dot(const Point_& pt) const; - //! dot product computed in double-precision arithmetics - double ddot(const Point_& pt) const; - //! cross-product - double cross(const Point_& pt) const; - //! checks whether the point is inside the specified rectangle - bool inside(const Rect_<_Tp>& r) const; - _Tp x; //!< x coordinate of the point - _Tp y; //!< y coordinate of the point -}; - -typedef Point_ Point2i; -typedef Point_ Point2l; -typedef Point_ Point2f; -typedef Point_ Point2d; -typedef Point2i Point; - -template class DataType< Point_<_Tp> > -{ -public: - typedef Point_<_Tp> value_type; - typedef Point_::work_type> work_type; - typedef _Tp channel_type; - - enum { generic_type = 0, - channels = 2, - fmt = traits::SafeFmt::fmt + ((channels - 1) << 8) -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - ,depth = DataType::depth - ,type = CV_MAKETYPE(depth, channels) -#endif - }; - - typedef Vec vec_type; -}; - -namespace traits { -template -struct Depth< Point_<_Tp> > { enum { value = Depth<_Tp>::value }; }; -template -struct Type< Point_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 2) }; }; -} // namespace - - -//////////////////////////////// Point3_ //////////////////////////////// - -/** @brief Template class for 3D points specified by its coordinates `x`, `y` and `z`. - -An instance of the class is interchangeable with the C structure CvPoint2D32f . Similarly to -Point_ , the coordinates of 3D points can be converted to another type. The vector arithmetic and -comparison operations are also supported. - -The following Point3_\<\> aliases are available: -@code - typedef Point3_ Point3i; - typedef Point3_ Point3f; - typedef Point3_ Point3d; -@endcode -@see cv::Point3i, cv::Point3f and cv::Point3d -*/ -template class Point3_ -{ -public: - typedef _Tp value_type; - - //! default constructor - Point3_(); - Point3_(_Tp _x, _Tp _y, _Tp _z); - Point3_(const Point3_& pt); - explicit Point3_(const Point_<_Tp>& pt); - Point3_(const Vec<_Tp, 3>& v); - - Point3_& operator = (const Point3_& pt); - //! conversion to another data type - template operator Point3_<_Tp2>() const; - //! conversion to cv::Vec<> -#if OPENCV_ABI_COMPATIBILITY > 300 - template operator Vec<_Tp2, 3>() const; -#else - operator Vec<_Tp, 3>() const; -#endif - - //! dot product - _Tp dot(const Point3_& pt) const; - //! dot product computed in double-precision arithmetics - double ddot(const Point3_& pt) const; - //! cross product of the 2 3D points - Point3_ cross(const Point3_& pt) const; - _Tp x; //!< x coordinate of the 3D point - _Tp y; //!< y coordinate of the 3D point - _Tp z; //!< z coordinate of the 3D point -}; - -typedef Point3_ Point3i; -typedef Point3_ Point3f; -typedef Point3_ Point3d; - -template class DataType< Point3_<_Tp> > -{ -public: - typedef Point3_<_Tp> value_type; - typedef Point3_::work_type> work_type; - typedef _Tp channel_type; - - enum { generic_type = 0, - channels = 3, - fmt = traits::SafeFmt::fmt + ((channels - 1) << 8) -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - ,depth = DataType::depth - ,type = CV_MAKETYPE(depth, channels) -#endif - }; - - typedef Vec vec_type; -}; - -namespace traits { -template -struct Depth< Point3_<_Tp> > { enum { value = Depth<_Tp>::value }; }; -template -struct Type< Point3_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 3) }; }; -} // namespace - -//////////////////////////////// Size_ //////////////////////////////// - -/** @brief Template class for specifying the size of an image or rectangle. - -The class includes two members called width and height. The structure can be converted to and from -the old OpenCV structures CvSize and CvSize2D32f . The same set of arithmetic and comparison -operations as for Point_ is available. - -OpenCV defines the following Size_\<\> aliases: -@code - typedef Size_ Size2i; - typedef Size2i Size; - typedef Size_ Size2f; -@endcode -*/ -template class Size_ -{ -public: - typedef _Tp value_type; - - //! default constructor - Size_(); - Size_(_Tp _width, _Tp _height); - Size_(const Size_& sz); - Size_(const Point_<_Tp>& pt); - - Size_& operator = (const Size_& sz); - //! the area (width*height) - _Tp area() const; - //! true if empty - bool empty() const; - - //! conversion of another data type. - template operator Size_<_Tp2>() const; - - _Tp width; //!< the width - _Tp height; //!< the height -}; - -typedef Size_ Size2i; -typedef Size_ Size2l; -typedef Size_ Size2f; -typedef Size_ Size2d; -typedef Size2i Size; - -template class DataType< Size_<_Tp> > -{ -public: - typedef Size_<_Tp> value_type; - typedef Size_::work_type> work_type; - typedef _Tp channel_type; - - enum { generic_type = 0, - channels = 2, - fmt = DataType::fmt + ((channels - 1) << 8) -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - ,depth = DataType::depth - ,type = CV_MAKETYPE(depth, channels) -#endif - }; - - typedef Vec vec_type; -}; - -namespace traits { -template -struct Depth< Size_<_Tp> > { enum { value = Depth<_Tp>::value }; }; -template -struct Type< Size_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 2) }; }; -} // namespace - -//////////////////////////////// Rect_ //////////////////////////////// - -/** @brief Template class for 2D rectangles - -described by the following parameters: -- Coordinates of the top-left corner. This is a default interpretation of Rect_::x and Rect_::y - in OpenCV. Though, in your algorithms you may count x and y from the bottom-left corner. -- Rectangle width and height. - -OpenCV typically assumes that the top and left boundary of the rectangle are inclusive, while the -right and bottom boundaries are not. For example, the method Rect_::contains returns true if - -\f[x \leq pt.x < x+width, - y \leq pt.y < y+height\f] - -Virtually every loop over an image ROI in OpenCV (where ROI is specified by Rect_\ ) is -implemented as: -@code - for(int y = roi.y; y < roi.y + roi.height; y++) - for(int x = roi.x; x < roi.x + roi.width; x++) - { - // ... - } -@endcode -In addition to the class members, the following operations on rectangles are implemented: -- \f$\texttt{rect} = \texttt{rect} \pm \texttt{point}\f$ (shifting a rectangle by a certain offset) -- \f$\texttt{rect} = \texttt{rect} \pm \texttt{size}\f$ (expanding or shrinking a rectangle by a - certain amount) -- rect += point, rect -= point, rect += size, rect -= size (augmenting operations) -- rect = rect1 & rect2 (rectangle intersection) -- rect = rect1 | rect2 (minimum area rectangle containing rect1 and rect2 ) -- rect &= rect1, rect |= rect1 (and the corresponding augmenting operations) -- rect == rect1, rect != rect1 (rectangle comparison) - -This is an example how the partial ordering on rectangles can be established (rect1 \f$\subseteq\f$ -rect2): -@code - template inline bool - operator <= (const Rect_<_Tp>& r1, const Rect_<_Tp>& r2) - { - return (r1 & r2) == r1; - } -@endcode -For your convenience, the Rect_\<\> alias is available: cv::Rect -*/ -template class Rect_ -{ -public: - typedef _Tp value_type; - - //! default constructor - Rect_(); - Rect_(_Tp _x, _Tp _y, _Tp _width, _Tp _height); - Rect_(const Rect_& r); - Rect_(const Point_<_Tp>& org, const Size_<_Tp>& sz); - Rect_(const Point_<_Tp>& pt1, const Point_<_Tp>& pt2); - - Rect_& operator = ( const Rect_& r ); - //! the top-left corner - Point_<_Tp> tl() const; - //! the bottom-right corner - Point_<_Tp> br() const; - - //! size (width, height) of the rectangle - Size_<_Tp> size() const; - //! area (width*height) of the rectangle - _Tp area() const; - //! true if empty - bool empty() const; - - //! conversion to another data type - template operator Rect_<_Tp2>() const; - - //! checks whether the rectangle contains the point - bool contains(const Point_<_Tp>& pt) const; - - _Tp x; //!< x coordinate of the top-left corner - _Tp y; //!< y coordinate of the top-left corner - _Tp width; //!< width of the rectangle - _Tp height; //!< height of the rectangle -}; - -typedef Rect_ Rect2i; -typedef Rect_ Rect2f; -typedef Rect_ Rect2d; -typedef Rect2i Rect; - -template class DataType< Rect_<_Tp> > -{ -public: - typedef Rect_<_Tp> value_type; - typedef Rect_::work_type> work_type; - typedef _Tp channel_type; - - enum { generic_type = 0, - channels = 4, - fmt = traits::SafeFmt::fmt + ((channels - 1) << 8) -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - ,depth = DataType::depth - ,type = CV_MAKETYPE(depth, channels) -#endif - }; - - typedef Vec vec_type; -}; - -namespace traits { -template -struct Depth< Rect_<_Tp> > { enum { value = Depth<_Tp>::value }; }; -template -struct Type< Rect_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 4) }; }; -} // namespace - -///////////////////////////// RotatedRect ///////////////////////////// - -/** @brief The class represents rotated (i.e. not up-right) rectangles on a plane. - -Each rectangle is specified by the center point (mass center), length of each side (represented by -#Size2f structure) and the rotation angle in degrees. - -The sample below demonstrates how to use RotatedRect: -@snippet snippets/core_various.cpp RotatedRect_demo -![image](pics/rotatedrect.png) - -@sa CamShift, fitEllipse, minAreaRect, CvBox2D -*/ -class CV_EXPORTS RotatedRect -{ -public: - //! default constructor - RotatedRect(); - /** full constructor - @param center The rectangle mass center. - @param size Width and height of the rectangle. - @param angle The rotation angle in a clockwise direction. When the angle is 0, 90, 180, 270 etc., - the rectangle becomes an up-right rectangle. - */ - RotatedRect(const Point2f& center, const Size2f& size, float angle); - /** - Any 3 end points of the RotatedRect. They must be given in order (either clockwise or - anticlockwise). - */ - RotatedRect(const Point2f& point1, const Point2f& point2, const Point2f& point3); - - /** returns 4 vertices of the rectangle - @param pts The points array for storing rectangle vertices. The order is bottomLeft, topLeft, topRight, bottomRight. - */ - void points(Point2f pts[]) const; - //! returns the minimal up-right integer rectangle containing the rotated rectangle - Rect boundingRect() const; - //! returns the minimal (exact) floating point rectangle containing the rotated rectangle, not intended for use with images - Rect_ boundingRect2f() const; - //! returns the rectangle mass center - Point2f center; - //! returns width and height of the rectangle - Size2f size; - //! returns the rotation angle. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle. - float angle; -}; - -template<> class DataType< RotatedRect > -{ -public: - typedef RotatedRect value_type; - typedef value_type work_type; - typedef float channel_type; - - enum { generic_type = 0, - channels = (int)sizeof(value_type)/sizeof(channel_type), // 5 - fmt = traits::SafeFmt::fmt + ((channels - 1) << 8) -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - ,depth = DataType::depth - ,type = CV_MAKETYPE(depth, channels) -#endif - }; - - typedef Vec vec_type; -}; - -namespace traits { -template<> -struct Depth< RotatedRect > { enum { value = Depth::value }; }; -template<> -struct Type< RotatedRect > { enum { value = CV_MAKETYPE(Depth::value, (int)sizeof(RotatedRect)/sizeof(float)) }; }; -} // namespace - - -//////////////////////////////// Range ///////////////////////////////// - -/** @brief Template class specifying a continuous subsequence (slice) of a sequence. - -The class is used to specify a row or a column span in a matrix ( Mat ) and for many other purposes. -Range(a,b) is basically the same as a:b in Matlab or a..b in Python. As in Python, start is an -inclusive left boundary of the range and end is an exclusive right boundary of the range. Such a -half-opened interval is usually denoted as \f$[start,end)\f$ . - -The static method Range::all() returns a special variable that means "the whole sequence" or "the -whole range", just like " : " in Matlab or " ... " in Python. All the methods and functions in -OpenCV that take Range support this special Range::all() value. But, of course, in case of your own -custom processing, you will probably have to check and handle it explicitly: -@code - void my_function(..., const Range& r, ....) - { - if(r == Range::all()) { - // process all the data - } - else { - // process [r.start, r.end) - } - } -@endcode -*/ -class CV_EXPORTS Range -{ -public: - Range(); - Range(int _start, int _end); - int size() const; - bool empty() const; - static Range all(); - - int start, end; -}; - -template<> class DataType -{ -public: - typedef Range value_type; - typedef value_type work_type; - typedef int channel_type; - - enum { generic_type = 0, - channels = 2, - fmt = traits::SafeFmt::fmt + ((channels - 1) << 8) -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - ,depth = DataType::depth - ,type = CV_MAKETYPE(depth, channels) -#endif - }; - - typedef Vec vec_type; -}; - -namespace traits { -template<> -struct Depth< Range > { enum { value = Depth::value }; }; -template<> -struct Type< Range > { enum { value = CV_MAKETYPE(Depth::value, 2) }; }; -} // namespace - - -//////////////////////////////// Scalar_ /////////////////////////////// - -/** @brief Template class for a 4-element vector derived from Vec. - -Being derived from Vec\<_Tp, 4\> , Scalar\_ and Scalar can be used just as typical 4-element -vectors. In addition, they can be converted to/from CvScalar . The type Scalar is widely used in -OpenCV to pass pixel values. -*/ -template class Scalar_ : public Vec<_Tp, 4> -{ -public: - //! default constructor - Scalar_(); - Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0); - Scalar_(_Tp v0); - - template - Scalar_(const Vec<_Tp2, cn>& v); - - //! returns a scalar with all elements set to v0 - static Scalar_<_Tp> all(_Tp v0); - - //! conversion to another data type - template operator Scalar_() const; - - //! per-element product - Scalar_<_Tp> mul(const Scalar_<_Tp>& a, double scale=1 ) const; - - //! returns (v0, -v1, -v2, -v3) - Scalar_<_Tp> conj() const; - - //! returns true iff v1 == v2 == v3 == 0 - bool isReal() const; -}; - -typedef Scalar_ Scalar; - -template class DataType< Scalar_<_Tp> > -{ -public: - typedef Scalar_<_Tp> value_type; - typedef Scalar_::work_type> work_type; - typedef _Tp channel_type; - - enum { generic_type = 0, - channels = 4, - fmt = traits::SafeFmt::fmt + ((channels - 1) << 8) -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - ,depth = DataType::depth - ,type = CV_MAKETYPE(depth, channels) -#endif - }; - - typedef Vec vec_type; -}; - -namespace traits { -template -struct Depth< Scalar_<_Tp> > { enum { value = Depth<_Tp>::value }; }; -template -struct Type< Scalar_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 4) }; }; -} // namespace - - -/////////////////////////////// KeyPoint //////////////////////////////// - -/** @brief Data structure for salient point detectors. - -The class instance stores a keypoint, i.e. a point feature found by one of many available keypoint -detectors, such as Harris corner detector, #FAST, %StarDetector, %SURF, %SIFT etc. - -The keypoint is characterized by the 2D position, scale (proportional to the diameter of the -neighborhood that needs to be taken into account), orientation and some other parameters. The -keypoint neighborhood is then analyzed by another algorithm that builds a descriptor (usually -represented as a feature vector). The keypoints representing the same object in different images -can then be matched using %KDTree or another method. -*/ -class CV_EXPORTS_W_SIMPLE KeyPoint -{ -public: - //! the default constructor - CV_WRAP KeyPoint(); - /** - @param _pt x & y coordinates of the keypoint - @param _size keypoint diameter - @param _angle keypoint orientation - @param _response keypoint detector response on the keypoint (that is, strength of the keypoint) - @param _octave pyramid octave in which the keypoint has been detected - @param _class_id object id - */ - KeyPoint(Point2f _pt, float _size, float _angle=-1, float _response=0, int _octave=0, int _class_id=-1); - /** - @param x x-coordinate of the keypoint - @param y y-coordinate of the keypoint - @param _size keypoint diameter - @param _angle keypoint orientation - @param _response keypoint detector response on the keypoint (that is, strength of the keypoint) - @param _octave pyramid octave in which the keypoint has been detected - @param _class_id object id - */ - CV_WRAP KeyPoint(float x, float y, float _size, float _angle=-1, float _response=0, int _octave=0, int _class_id=-1); - - size_t hash() const; - - /** - This method converts vector of keypoints to vector of points or the reverse, where each keypoint is - assigned the same size and the same orientation. - - @param keypoints Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB - @param points2f Array of (x,y) coordinates of each keypoint - @param keypointIndexes Array of indexes of keypoints to be converted to points. (Acts like a mask to - convert only specified keypoints) - */ - CV_WRAP static void convert(const std::vector& keypoints, - CV_OUT std::vector& points2f, - const std::vector& keypointIndexes=std::vector()); - /** @overload - @param points2f Array of (x,y) coordinates of each keypoint - @param keypoints Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB - @param size keypoint diameter - @param response keypoint detector response on the keypoint (that is, strength of the keypoint) - @param octave pyramid octave in which the keypoint has been detected - @param class_id object id - */ - CV_WRAP static void convert(const std::vector& points2f, - CV_OUT std::vector& keypoints, - float size=1, float response=1, int octave=0, int class_id=-1); - - /** - This method computes overlap for pair of keypoints. Overlap is the ratio between area of keypoint - regions' intersection and area of keypoint regions' union (considering keypoint region as circle). - If they don't overlap, we get zero. If they coincide at same location with same size, we get 1. - @param kp1 First keypoint - @param kp2 Second keypoint - */ - CV_WRAP static float overlap(const KeyPoint& kp1, const KeyPoint& kp2); - - CV_PROP_RW Point2f pt; //!< coordinates of the keypoints - CV_PROP_RW float size; //!< diameter of the meaningful keypoint neighborhood - CV_PROP_RW float angle; //!< computed orientation of the keypoint (-1 if not applicable); - //!< it's in [0,360) degrees and measured relative to - //!< image coordinate system, ie in clockwise. - CV_PROP_RW float response; //!< the response by which the most strong keypoints have been selected. Can be used for the further sorting or subsampling - CV_PROP_RW int octave; //!< octave (pyramid layer) from which the keypoint has been extracted - CV_PROP_RW int class_id; //!< object class (if the keypoints need to be clustered by an object they belong to) -}; - -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED -template<> class DataType -{ -public: - typedef KeyPoint value_type; - typedef float work_type; - typedef float channel_type; - - enum { generic_type = 0, - depth = DataType::depth, - channels = (int)(sizeof(value_type)/sizeof(channel_type)), // 7 - fmt = DataType::fmt + ((channels - 1) << 8), - type = CV_MAKETYPE(depth, channels) - }; - - typedef Vec vec_type; -}; -#endif - - -//////////////////////////////// DMatch ///////////////////////////////// - -/** @brief Class for matching keypoint descriptors - -query descriptor index, train descriptor index, train image index, and distance between -descriptors. -*/ -class CV_EXPORTS_W_SIMPLE DMatch -{ -public: - CV_WRAP DMatch(); - CV_WRAP DMatch(int _queryIdx, int _trainIdx, float _distance); - CV_WRAP DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance); - - CV_PROP_RW int queryIdx; //!< query descriptor index - CV_PROP_RW int trainIdx; //!< train descriptor index - CV_PROP_RW int imgIdx; //!< train image index - - CV_PROP_RW float distance; - - // less is better - bool operator<(const DMatch &m) const; -}; - -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED -template<> class DataType -{ -public: - typedef DMatch value_type; - typedef int work_type; - typedef int channel_type; - - enum { generic_type = 0, - depth = DataType::depth, - channels = (int)(sizeof(value_type)/sizeof(channel_type)), // 4 - fmt = DataType::fmt + ((channels - 1) << 8), - type = CV_MAKETYPE(depth, channels) - }; - - typedef Vec vec_type; -}; -#endif - - -///////////////////////////// TermCriteria ////////////////////////////// - -/** @brief The class defining termination criteria for iterative algorithms. - -You can initialize it by default constructor and then override any parameters, or the structure may -be fully initialized using the advanced variant of the constructor. -*/ -class CV_EXPORTS TermCriteria -{ -public: - /** - Criteria type, can be one of: COUNT, EPS or COUNT + EPS - */ - enum Type - { - COUNT=1, //!< the maximum number of iterations or elements to compute - MAX_ITER=COUNT, //!< ditto - EPS=2 //!< the desired accuracy or change in parameters at which the iterative algorithm stops - }; - - //! default constructor - TermCriteria(); - /** - @param type The type of termination criteria, one of TermCriteria::Type - @param maxCount The maximum number of iterations or elements to compute. - @param epsilon The desired accuracy or change in parameters at which the iterative algorithm stops. - */ - TermCriteria(int type, int maxCount, double epsilon); - - inline bool isValid() const - { - const bool isCount = (type & COUNT) && maxCount > 0; - const bool isEps = (type & EPS) && !cvIsNaN(epsilon); - return isCount || isEps; - } - - int type; //!< the type of termination criteria: COUNT, EPS or COUNT + EPS - int maxCount; //!< the maximum number of iterations/elements - double epsilon; //!< the desired accuracy -}; - - -//! @} core_basic - -///////////////////////// raster image moments ////////////////////////// - -//! @addtogroup imgproc_shape -//! @{ - -/** @brief struct returned by cv::moments - -The spatial moments \f$\texttt{Moments::m}_{ji}\f$ are computed as: - -\f[\texttt{m} _{ji}= \sum _{x,y} \left ( \texttt{array} (x,y) \cdot x^j \cdot y^i \right )\f] - -The central moments \f$\texttt{Moments::mu}_{ji}\f$ are computed as: - -\f[\texttt{mu} _{ji}= \sum _{x,y} \left ( \texttt{array} (x,y) \cdot (x - \bar{x} )^j \cdot (y - \bar{y} )^i \right )\f] - -where \f$(\bar{x}, \bar{y})\f$ is the mass center: - -\f[\bar{x} = \frac{\texttt{m}_{10}}{\texttt{m}_{00}} , \; \bar{y} = \frac{\texttt{m}_{01}}{\texttt{m}_{00}}\f] - -The normalized central moments \f$\texttt{Moments::nu}_{ij}\f$ are computed as: - -\f[\texttt{nu} _{ji}= \frac{\texttt{mu}_{ji}}{\texttt{m}_{00}^{(i+j)/2+1}} .\f] - -@note -\f$\texttt{mu}_{00}=\texttt{m}_{00}\f$, \f$\texttt{nu}_{00}=1\f$ -\f$\texttt{nu}_{10}=\texttt{mu}_{10}=\texttt{mu}_{01}=\texttt{mu}_{10}=0\f$ , hence the values are not -stored. - -The moments of a contour are defined in the same way but computed using the Green's formula (see -). So, due to a limited raster resolution, the moments -computed for a contour are slightly different from the moments computed for the same rasterized -contour. - -@note -Since the contour moments are computed using Green formula, you may get seemingly odd results for -contours with self-intersections, e.g. a zero area (m00) for butterfly-shaped contours. - */ -class CV_EXPORTS_W_MAP Moments -{ -public: - //! the default constructor - Moments(); - //! the full constructor - Moments(double m00, double m10, double m01, double m20, double m11, - double m02, double m30, double m21, double m12, double m03 ); - ////! the conversion from CvMoments - //Moments( const CvMoments& moments ); - ////! the conversion to CvMoments - //operator CvMoments() const; - - //! @name spatial moments - //! @{ - CV_PROP_RW double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; - //! @} - - //! @name central moments - //! @{ - CV_PROP_RW double mu20, mu11, mu02, mu30, mu21, mu12, mu03; - //! @} - - //! @name central normalized moments - //! @{ - CV_PROP_RW double nu20, nu11, nu02, nu30, nu21, nu12, nu03; - //! @} -}; - -template<> class DataType -{ -public: - typedef Moments value_type; - typedef double work_type; - typedef double channel_type; - - enum { generic_type = 0, - channels = (int)(sizeof(value_type)/sizeof(channel_type)), // 24 - fmt = DataType::fmt + ((channels - 1) << 8) -#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - ,depth = DataType::depth - ,type = CV_MAKETYPE(depth, channels) -#endif - }; - - typedef Vec vec_type; -}; - -namespace traits { -template<> -struct Depth< Moments > { enum { value = Depth::value }; }; -template<> -struct Type< Moments > { enum { value = CV_MAKETYPE(Depth::value, (int)(sizeof(Moments)/sizeof(double))) }; }; -} // namespace - -//! @} imgproc_shape - -//! @cond IGNORED - -///////////////////////////////////////////////////////////////////////// -///////////////////////////// Implementation //////////////////////////// -///////////////////////////////////////////////////////////////////////// - -//////////////////////////////// Complex //////////////////////////////// - -template inline -Complex<_Tp>::Complex() - : re(0), im(0) {} - -template inline -Complex<_Tp>::Complex( _Tp _re, _Tp _im ) - : re(_re), im(_im) {} - -template template inline -Complex<_Tp>::operator Complex() const -{ - return Complex(saturate_cast(re), saturate_cast(im)); -} - -template inline -Complex<_Tp> Complex<_Tp>::conj() const -{ - return Complex<_Tp>(re, -im); -} - - -template static inline -bool operator == (const Complex<_Tp>& a, const Complex<_Tp>& b) -{ - return a.re == b.re && a.im == b.im; -} - -template static inline -bool operator != (const Complex<_Tp>& a, const Complex<_Tp>& b) -{ - return a.re != b.re || a.im != b.im; -} - -template static inline -Complex<_Tp> operator + (const Complex<_Tp>& a, const Complex<_Tp>& b) -{ - return Complex<_Tp>( a.re + b.re, a.im + b.im ); -} - -template static inline -Complex<_Tp>& operator += (Complex<_Tp>& a, const Complex<_Tp>& b) -{ - a.re += b.re; a.im += b.im; - return a; -} - -template static inline -Complex<_Tp> operator - (const Complex<_Tp>& a, const Complex<_Tp>& b) -{ - return Complex<_Tp>( a.re - b.re, a.im - b.im ); -} - -template static inline -Complex<_Tp>& operator -= (Complex<_Tp>& a, const Complex<_Tp>& b) -{ - a.re -= b.re; a.im -= b.im; - return a; -} - -template static inline -Complex<_Tp> operator - (const Complex<_Tp>& a) -{ - return Complex<_Tp>(-a.re, -a.im); -} - -template static inline -Complex<_Tp> operator * (const Complex<_Tp>& a, const Complex<_Tp>& b) -{ - return Complex<_Tp>( a.re*b.re - a.im*b.im, a.re*b.im + a.im*b.re ); -} - -template static inline -Complex<_Tp> operator * (const Complex<_Tp>& a, _Tp b) -{ - return Complex<_Tp>( a.re*b, a.im*b ); -} - -template static inline -Complex<_Tp> operator * (_Tp b, const Complex<_Tp>& a) -{ - return Complex<_Tp>( a.re*b, a.im*b ); -} - -template static inline -Complex<_Tp> operator + (const Complex<_Tp>& a, _Tp b) -{ - return Complex<_Tp>( a.re + b, a.im ); -} - -template static inline -Complex<_Tp> operator - (const Complex<_Tp>& a, _Tp b) -{ return Complex<_Tp>( a.re - b, a.im ); } - -template static inline -Complex<_Tp> operator + (_Tp b, const Complex<_Tp>& a) -{ - return Complex<_Tp>( a.re + b, a.im ); -} - -template static inline -Complex<_Tp> operator - (_Tp b, const Complex<_Tp>& a) -{ - return Complex<_Tp>( b - a.re, -a.im ); -} - -template static inline -Complex<_Tp>& operator += (Complex<_Tp>& a, _Tp b) -{ - a.re += b; return a; -} - -template static inline -Complex<_Tp>& operator -= (Complex<_Tp>& a, _Tp b) -{ - a.re -= b; return a; -} - -template static inline -Complex<_Tp>& operator *= (Complex<_Tp>& a, _Tp b) -{ - a.re *= b; a.im *= b; return a; -} - -template static inline -double abs(const Complex<_Tp>& a) -{ - return std::sqrt( (double)a.re*a.re + (double)a.im*a.im); -} - -template static inline -Complex<_Tp> operator / (const Complex<_Tp>& a, const Complex<_Tp>& b) -{ - double t = 1./((double)b.re*b.re + (double)b.im*b.im); - return Complex<_Tp>( (_Tp)((a.re*b.re + a.im*b.im)*t), - (_Tp)((-a.re*b.im + a.im*b.re)*t) ); -} - -template static inline -Complex<_Tp>& operator /= (Complex<_Tp>& a, const Complex<_Tp>& b) -{ - a = a / b; - return a; -} - -template static inline -Complex<_Tp> operator / (const Complex<_Tp>& a, _Tp b) -{ - _Tp t = (_Tp)1/b; - return Complex<_Tp>( a.re*t, a.im*t ); -} - -template static inline -Complex<_Tp> operator / (_Tp b, const Complex<_Tp>& a) -{ - return Complex<_Tp>(b)/a; -} - -template static inline -Complex<_Tp> operator /= (const Complex<_Tp>& a, _Tp b) -{ - _Tp t = (_Tp)1/b; - a.re *= t; a.im *= t; return a; -} - - - -//////////////////////////////// 2D Point /////////////////////////////// - -template inline -Point_<_Tp>::Point_() - : x(0), y(0) {} - -template inline -Point_<_Tp>::Point_(_Tp _x, _Tp _y) - : x(_x), y(_y) {} - -template inline -Point_<_Tp>::Point_(const Point_& pt) - : x(pt.x), y(pt.y) {} - -template inline -Point_<_Tp>::Point_(const Size_<_Tp>& sz) - : x(sz.width), y(sz.height) {} - -template inline -Point_<_Tp>::Point_(const Vec<_Tp,2>& v) - : x(v[0]), y(v[1]) {} - -template inline -Point_<_Tp>& Point_<_Tp>::operator = (const Point_& pt) -{ - x = pt.x; y = pt.y; - return *this; -} - -template template inline -Point_<_Tp>::operator Point_<_Tp2>() const -{ - return Point_<_Tp2>(saturate_cast<_Tp2>(x), saturate_cast<_Tp2>(y)); -} - -template inline -Point_<_Tp>::operator Vec<_Tp, 2>() const -{ - return Vec<_Tp, 2>(x, y); -} - -template inline -_Tp Point_<_Tp>::dot(const Point_& pt) const -{ - return saturate_cast<_Tp>(x*pt.x + y*pt.y); -} - -template inline -double Point_<_Tp>::ddot(const Point_& pt) const -{ - return (double)x*pt.x + (double)y*pt.y; -} - -template inline -double Point_<_Tp>::cross(const Point_& pt) const -{ - return (double)x*pt.y - (double)y*pt.x; -} - -template inline bool -Point_<_Tp>::inside( const Rect_<_Tp>& r ) const -{ - return r.contains(*this); -} - - -template static inline -Point_<_Tp>& operator += (Point_<_Tp>& a, const Point_<_Tp>& b) -{ - a.x += b.x; - a.y += b.y; - return a; -} - -template static inline -Point_<_Tp>& operator -= (Point_<_Tp>& a, const Point_<_Tp>& b) -{ - a.x -= b.x; - a.y -= b.y; - return a; -} - -template static inline -Point_<_Tp>& operator *= (Point_<_Tp>& a, int b) -{ - a.x = saturate_cast<_Tp>(a.x * b); - a.y = saturate_cast<_Tp>(a.y * b); - return a; -} - -template static inline -Point_<_Tp>& operator *= (Point_<_Tp>& a, float b) -{ - a.x = saturate_cast<_Tp>(a.x * b); - a.y = saturate_cast<_Tp>(a.y * b); - return a; -} - -template static inline -Point_<_Tp>& operator *= (Point_<_Tp>& a, double b) -{ - a.x = saturate_cast<_Tp>(a.x * b); - a.y = saturate_cast<_Tp>(a.y * b); - return a; -} - -template static inline -Point_<_Tp>& operator /= (Point_<_Tp>& a, int b) -{ - a.x = saturate_cast<_Tp>(a.x / b); - a.y = saturate_cast<_Tp>(a.y / b); - return a; -} - -template static inline -Point_<_Tp>& operator /= (Point_<_Tp>& a, float b) -{ - a.x = saturate_cast<_Tp>(a.x / b); - a.y = saturate_cast<_Tp>(a.y / b); - return a; -} - -template static inline -Point_<_Tp>& operator /= (Point_<_Tp>& a, double b) -{ - a.x = saturate_cast<_Tp>(a.x / b); - a.y = saturate_cast<_Tp>(a.y / b); - return a; -} - -template static inline -double norm(const Point_<_Tp>& pt) -{ - return std::sqrt((double)pt.x*pt.x + (double)pt.y*pt.y); -} - -template static inline -bool operator == (const Point_<_Tp>& a, const Point_<_Tp>& b) -{ - return a.x == b.x && a.y == b.y; -} - -template static inline -bool operator != (const Point_<_Tp>& a, const Point_<_Tp>& b) -{ - return a.x != b.x || a.y != b.y; -} - -template static inline -Point_<_Tp> operator + (const Point_<_Tp>& a, const Point_<_Tp>& b) -{ - return Point_<_Tp>( saturate_cast<_Tp>(a.x + b.x), saturate_cast<_Tp>(a.y + b.y) ); -} - -template static inline -Point_<_Tp> operator - (const Point_<_Tp>& a, const Point_<_Tp>& b) -{ - return Point_<_Tp>( saturate_cast<_Tp>(a.x - b.x), saturate_cast<_Tp>(a.y - b.y) ); -} - -template static inline -Point_<_Tp> operator - (const Point_<_Tp>& a) -{ - return Point_<_Tp>( saturate_cast<_Tp>(-a.x), saturate_cast<_Tp>(-a.y) ); -} - -template static inline -Point_<_Tp> operator * (const Point_<_Tp>& a, int b) -{ - return Point_<_Tp>( saturate_cast<_Tp>(a.x*b), saturate_cast<_Tp>(a.y*b) ); -} - -template static inline -Point_<_Tp> operator * (int a, const Point_<_Tp>& b) -{ - return Point_<_Tp>( saturate_cast<_Tp>(b.x*a), saturate_cast<_Tp>(b.y*a) ); -} - -template static inline -Point_<_Tp> operator * (const Point_<_Tp>& a, float b) -{ - return Point_<_Tp>( saturate_cast<_Tp>(a.x*b), saturate_cast<_Tp>(a.y*b) ); -} - -template static inline -Point_<_Tp> operator * (float a, const Point_<_Tp>& b) -{ - return Point_<_Tp>( saturate_cast<_Tp>(b.x*a), saturate_cast<_Tp>(b.y*a) ); -} - -template static inline -Point_<_Tp> operator * (const Point_<_Tp>& a, double b) -{ - return Point_<_Tp>( saturate_cast<_Tp>(a.x*b), saturate_cast<_Tp>(a.y*b) ); -} - -template static inline -Point_<_Tp> operator * (double a, const Point_<_Tp>& b) -{ - return Point_<_Tp>( saturate_cast<_Tp>(b.x*a), saturate_cast<_Tp>(b.y*a) ); -} - -template static inline -Point_<_Tp> operator * (const Matx<_Tp, 2, 2>& a, const Point_<_Tp>& b) -{ - Matx<_Tp, 2, 1> tmp = a * Vec<_Tp,2>(b.x, b.y); - return Point_<_Tp>(tmp.val[0], tmp.val[1]); -} - -template static inline -Point3_<_Tp> operator * (const Matx<_Tp, 3, 3>& a, const Point_<_Tp>& b) -{ - Matx<_Tp, 3, 1> tmp = a * Vec<_Tp,3>(b.x, b.y, 1); - return Point3_<_Tp>(tmp.val[0], tmp.val[1], tmp.val[2]); -} - -template static inline -Point_<_Tp> operator / (const Point_<_Tp>& a, int b) -{ - Point_<_Tp> tmp(a); - tmp /= b; - return tmp; -} - -template static inline -Point_<_Tp> operator / (const Point_<_Tp>& a, float b) -{ - Point_<_Tp> tmp(a); - tmp /= b; - return tmp; -} - -template static inline -Point_<_Tp> operator / (const Point_<_Tp>& a, double b) -{ - Point_<_Tp> tmp(a); - tmp /= b; - return tmp; -} - - -template static inline _AccTp normL2Sqr(const Point_& pt); -template static inline _AccTp normL2Sqr(const Point_& pt); -template static inline _AccTp normL2Sqr(const Point_& pt); -template static inline _AccTp normL2Sqr(const Point_& pt); - -template<> inline int normL2Sqr(const Point_& pt) { return pt.dot(pt); } -template<> inline int64 normL2Sqr(const Point_& pt) { return pt.dot(pt); } -template<> inline float normL2Sqr(const Point_& pt) { return pt.dot(pt); } -template<> inline double normL2Sqr(const Point_& pt) { return pt.dot(pt); } - -template<> inline double normL2Sqr(const Point_& pt) { return pt.ddot(pt); } -template<> inline double normL2Sqr(const Point_& pt) { return pt.ddot(pt); } - - - -//////////////////////////////// 3D Point /////////////////////////////// - -template inline -Point3_<_Tp>::Point3_() - : x(0), y(0), z(0) {} - -template inline -Point3_<_Tp>::Point3_(_Tp _x, _Tp _y, _Tp _z) - : x(_x), y(_y), z(_z) {} - -template inline -Point3_<_Tp>::Point3_(const Point3_& pt) - : x(pt.x), y(pt.y), z(pt.z) {} - -template inline -Point3_<_Tp>::Point3_(const Point_<_Tp>& pt) - : x(pt.x), y(pt.y), z(_Tp()) {} - -template inline -Point3_<_Tp>::Point3_(const Vec<_Tp, 3>& v) - : x(v[0]), y(v[1]), z(v[2]) {} - -template template inline -Point3_<_Tp>::operator Point3_<_Tp2>() const -{ - return Point3_<_Tp2>(saturate_cast<_Tp2>(x), saturate_cast<_Tp2>(y), saturate_cast<_Tp2>(z)); -} - -#if OPENCV_ABI_COMPATIBILITY > 300 -template template inline -Point3_<_Tp>::operator Vec<_Tp2, 3>() const -{ - return Vec<_Tp2, 3>(x, y, z); -} -#else -template inline -Point3_<_Tp>::operator Vec<_Tp, 3>() const -{ - return Vec<_Tp, 3>(x, y, z); -} -#endif - -template inline -Point3_<_Tp>& Point3_<_Tp>::operator = (const Point3_& pt) -{ - x = pt.x; y = pt.y; z = pt.z; - return *this; -} - -template inline -_Tp Point3_<_Tp>::dot(const Point3_& pt) const -{ - return saturate_cast<_Tp>(x*pt.x + y*pt.y + z*pt.z); -} - -template inline -double Point3_<_Tp>::ddot(const Point3_& pt) const -{ - return (double)x*pt.x + (double)y*pt.y + (double)z*pt.z; -} - -template inline -Point3_<_Tp> Point3_<_Tp>::cross(const Point3_<_Tp>& pt) const -{ - return Point3_<_Tp>(y*pt.z - z*pt.y, z*pt.x - x*pt.z, x*pt.y - y*pt.x); -} - - -template static inline -Point3_<_Tp>& operator += (Point3_<_Tp>& a, const Point3_<_Tp>& b) -{ - a.x += b.x; - a.y += b.y; - a.z += b.z; - return a; -} - -template static inline -Point3_<_Tp>& operator -= (Point3_<_Tp>& a, const Point3_<_Tp>& b) -{ - a.x -= b.x; - a.y -= b.y; - a.z -= b.z; - return a; -} - -template static inline -Point3_<_Tp>& operator *= (Point3_<_Tp>& a, int b) -{ - a.x = saturate_cast<_Tp>(a.x * b); - a.y = saturate_cast<_Tp>(a.y * b); - a.z = saturate_cast<_Tp>(a.z * b); - return a; -} - -template static inline -Point3_<_Tp>& operator *= (Point3_<_Tp>& a, float b) -{ - a.x = saturate_cast<_Tp>(a.x * b); - a.y = saturate_cast<_Tp>(a.y * b); - a.z = saturate_cast<_Tp>(a.z * b); - return a; -} - -template static inline -Point3_<_Tp>& operator *= (Point3_<_Tp>& a, double b) -{ - a.x = saturate_cast<_Tp>(a.x * b); - a.y = saturate_cast<_Tp>(a.y * b); - a.z = saturate_cast<_Tp>(a.z * b); - return a; -} - -template static inline -Point3_<_Tp>& operator /= (Point3_<_Tp>& a, int b) -{ - a.x = saturate_cast<_Tp>(a.x / b); - a.y = saturate_cast<_Tp>(a.y / b); - a.z = saturate_cast<_Tp>(a.z / b); - return a; -} - -template static inline -Point3_<_Tp>& operator /= (Point3_<_Tp>& a, float b) -{ - a.x = saturate_cast<_Tp>(a.x / b); - a.y = saturate_cast<_Tp>(a.y / b); - a.z = saturate_cast<_Tp>(a.z / b); - return a; -} - -template static inline -Point3_<_Tp>& operator /= (Point3_<_Tp>& a, double b) -{ - a.x = saturate_cast<_Tp>(a.x / b); - a.y = saturate_cast<_Tp>(a.y / b); - a.z = saturate_cast<_Tp>(a.z / b); - return a; -} - -template static inline -double norm(const Point3_<_Tp>& pt) -{ - return std::sqrt((double)pt.x*pt.x + (double)pt.y*pt.y + (double)pt.z*pt.z); -} - -template static inline -bool operator == (const Point3_<_Tp>& a, const Point3_<_Tp>& b) -{ - return a.x == b.x && a.y == b.y && a.z == b.z; -} - -template static inline -bool operator != (const Point3_<_Tp>& a, const Point3_<_Tp>& b) -{ - return a.x != b.x || a.y != b.y || a.z != b.z; -} - -template static inline -Point3_<_Tp> operator + (const Point3_<_Tp>& a, const Point3_<_Tp>& b) -{ - return Point3_<_Tp>( saturate_cast<_Tp>(a.x + b.x), saturate_cast<_Tp>(a.y + b.y), saturate_cast<_Tp>(a.z + b.z)); -} - -template static inline -Point3_<_Tp> operator - (const Point3_<_Tp>& a, const Point3_<_Tp>& b) -{ - return Point3_<_Tp>( saturate_cast<_Tp>(a.x - b.x), saturate_cast<_Tp>(a.y - b.y), saturate_cast<_Tp>(a.z - b.z)); -} - -template static inline -Point3_<_Tp> operator - (const Point3_<_Tp>& a) -{ - return Point3_<_Tp>( saturate_cast<_Tp>(-a.x), saturate_cast<_Tp>(-a.y), saturate_cast<_Tp>(-a.z) ); -} - -template static inline -Point3_<_Tp> operator * (const Point3_<_Tp>& a, int b) -{ - return Point3_<_Tp>( saturate_cast<_Tp>(a.x*b), saturate_cast<_Tp>(a.y*b), saturate_cast<_Tp>(a.z*b) ); -} - -template static inline -Point3_<_Tp> operator * (int a, const Point3_<_Tp>& b) -{ - return Point3_<_Tp>( saturate_cast<_Tp>(b.x * a), saturate_cast<_Tp>(b.y * a), saturate_cast<_Tp>(b.z * a) ); -} - -template static inline -Point3_<_Tp> operator * (const Point3_<_Tp>& a, float b) -{ - return Point3_<_Tp>( saturate_cast<_Tp>(a.x * b), saturate_cast<_Tp>(a.y * b), saturate_cast<_Tp>(a.z * b) ); -} - -template static inline -Point3_<_Tp> operator * (float a, const Point3_<_Tp>& b) -{ - return Point3_<_Tp>( saturate_cast<_Tp>(b.x * a), saturate_cast<_Tp>(b.y * a), saturate_cast<_Tp>(b.z * a) ); -} - -template static inline -Point3_<_Tp> operator * (const Point3_<_Tp>& a, double b) -{ - return Point3_<_Tp>( saturate_cast<_Tp>(a.x * b), saturate_cast<_Tp>(a.y * b), saturate_cast<_Tp>(a.z * b) ); -} - -template static inline -Point3_<_Tp> operator * (double a, const Point3_<_Tp>& b) -{ - return Point3_<_Tp>( saturate_cast<_Tp>(b.x * a), saturate_cast<_Tp>(b.y * a), saturate_cast<_Tp>(b.z * a) ); -} - -template static inline -Point3_<_Tp> operator * (const Matx<_Tp, 3, 3>& a, const Point3_<_Tp>& b) -{ - Matx<_Tp, 3, 1> tmp = a * Vec<_Tp,3>(b.x, b.y, b.z); - return Point3_<_Tp>(tmp.val[0], tmp.val[1], tmp.val[2]); -} - -template static inline -Matx<_Tp, 4, 1> operator * (const Matx<_Tp, 4, 4>& a, const Point3_<_Tp>& b) -{ - return a * Matx<_Tp, 4, 1>(b.x, b.y, b.z, 1); -} - -template static inline -Point3_<_Tp> operator / (const Point3_<_Tp>& a, int b) -{ - Point3_<_Tp> tmp(a); - tmp /= b; - return tmp; -} - -template static inline -Point3_<_Tp> operator / (const Point3_<_Tp>& a, float b) -{ - Point3_<_Tp> tmp(a); - tmp /= b; - return tmp; -} - -template static inline -Point3_<_Tp> operator / (const Point3_<_Tp>& a, double b) -{ - Point3_<_Tp> tmp(a); - tmp /= b; - return tmp; -} - - - -////////////////////////////////// Size ///////////////////////////////// - -template inline -Size_<_Tp>::Size_() - : width(0), height(0) {} - -template inline -Size_<_Tp>::Size_(_Tp _width, _Tp _height) - : width(_width), height(_height) {} - -template inline -Size_<_Tp>::Size_(const Size_& sz) - : width(sz.width), height(sz.height) {} - -template inline -Size_<_Tp>::Size_(const Point_<_Tp>& pt) - : width(pt.x), height(pt.y) {} - -template template inline -Size_<_Tp>::operator Size_<_Tp2>() const -{ - return Size_<_Tp2>(saturate_cast<_Tp2>(width), saturate_cast<_Tp2>(height)); -} - -template inline -Size_<_Tp>& Size_<_Tp>::operator = (const Size_<_Tp>& sz) -{ - width = sz.width; height = sz.height; - return *this; -} - -template inline -_Tp Size_<_Tp>::area() const -{ - const _Tp result = width * height; - CV_DbgAssert(!std::numeric_limits<_Tp>::is_integer - || width == 0 || result / width == height); // make sure the result fits in the return value - return result; -} - -template inline -bool Size_<_Tp>::empty() const -{ - return width <= 0 || height <= 0; -} - - -template static inline -Size_<_Tp>& operator *= (Size_<_Tp>& a, _Tp b) -{ - a.width *= b; - a.height *= b; - return a; -} - -template static inline -Size_<_Tp> operator * (const Size_<_Tp>& a, _Tp b) -{ - Size_<_Tp> tmp(a); - tmp *= b; - return tmp; -} - -template static inline -Size_<_Tp>& operator /= (Size_<_Tp>& a, _Tp b) -{ - a.width /= b; - a.height /= b; - return a; -} - -template static inline -Size_<_Tp> operator / (const Size_<_Tp>& a, _Tp b) -{ - Size_<_Tp> tmp(a); - tmp /= b; - return tmp; -} - -template static inline -Size_<_Tp>& operator += (Size_<_Tp>& a, const Size_<_Tp>& b) -{ - a.width += b.width; - a.height += b.height; - return a; -} - -template static inline -Size_<_Tp> operator + (const Size_<_Tp>& a, const Size_<_Tp>& b) -{ - Size_<_Tp> tmp(a); - tmp += b; - return tmp; -} - -template static inline -Size_<_Tp>& operator -= (Size_<_Tp>& a, const Size_<_Tp>& b) -{ - a.width -= b.width; - a.height -= b.height; - return a; -} - -template static inline -Size_<_Tp> operator - (const Size_<_Tp>& a, const Size_<_Tp>& b) -{ - Size_<_Tp> tmp(a); - tmp -= b; - return tmp; -} - -template static inline -bool operator == (const Size_<_Tp>& a, const Size_<_Tp>& b) -{ - return a.width == b.width && a.height == b.height; -} - -template static inline -bool operator != (const Size_<_Tp>& a, const Size_<_Tp>& b) -{ - return !(a == b); -} - - - -////////////////////////////////// Rect ///////////////////////////////// - -template inline -Rect_<_Tp>::Rect_() - : x(0), y(0), width(0), height(0) {} - -template inline -Rect_<_Tp>::Rect_(_Tp _x, _Tp _y, _Tp _width, _Tp _height) - : x(_x), y(_y), width(_width), height(_height) {} - -template inline -Rect_<_Tp>::Rect_(const Rect_<_Tp>& r) - : x(r.x), y(r.y), width(r.width), height(r.height) {} - -template inline -Rect_<_Tp>::Rect_(const Point_<_Tp>& org, const Size_<_Tp>& sz) - : x(org.x), y(org.y), width(sz.width), height(sz.height) {} - -template inline -Rect_<_Tp>::Rect_(const Point_<_Tp>& pt1, const Point_<_Tp>& pt2) -{ - x = std::min(pt1.x, pt2.x); - y = std::min(pt1.y, pt2.y); - width = std::max(pt1.x, pt2.x) - x; - height = std::max(pt1.y, pt2.y) - y; -} - -template inline -Rect_<_Tp>& Rect_<_Tp>::operator = ( const Rect_<_Tp>& r ) -{ - x = r.x; - y = r.y; - width = r.width; - height = r.height; - return *this; -} - -template inline -Point_<_Tp> Rect_<_Tp>::tl() const -{ - return Point_<_Tp>(x,y); -} - -template inline -Point_<_Tp> Rect_<_Tp>::br() const -{ - return Point_<_Tp>(x + width, y + height); -} - -template inline -Size_<_Tp> Rect_<_Tp>::size() const -{ - return Size_<_Tp>(width, height); -} - -template inline -_Tp Rect_<_Tp>::area() const -{ - const _Tp result = width * height; - CV_DbgAssert(!std::numeric_limits<_Tp>::is_integer - || width == 0 || result / width == height); // make sure the result fits in the return value - return result; -} - -template inline -bool Rect_<_Tp>::empty() const -{ - return width <= 0 || height <= 0; -} - -template template inline -Rect_<_Tp>::operator Rect_<_Tp2>() const -{ - return Rect_<_Tp2>(saturate_cast<_Tp2>(x), saturate_cast<_Tp2>(y), saturate_cast<_Tp2>(width), saturate_cast<_Tp2>(height)); -} - -template inline -bool Rect_<_Tp>::contains(const Point_<_Tp>& pt) const -{ - return x <= pt.x && pt.x < x + width && y <= pt.y && pt.y < y + height; -} - - -template static inline -Rect_<_Tp>& operator += ( Rect_<_Tp>& a, const Point_<_Tp>& b ) -{ - a.x += b.x; - a.y += b.y; - return a; -} - -template static inline -Rect_<_Tp>& operator -= ( Rect_<_Tp>& a, const Point_<_Tp>& b ) -{ - a.x -= b.x; - a.y -= b.y; - return a; -} - -template static inline -Rect_<_Tp>& operator += ( Rect_<_Tp>& a, const Size_<_Tp>& b ) -{ - a.width += b.width; - a.height += b.height; - return a; -} - -template static inline -Rect_<_Tp>& operator -= ( Rect_<_Tp>& a, const Size_<_Tp>& b ) -{ - const _Tp width = a.width - b.width; - const _Tp height = a.height - b.height; - CV_DbgAssert(width >= 0 && height >= 0); - a.width = width; - a.height = height; - return a; -} - -template static inline -Rect_<_Tp>& operator &= ( Rect_<_Tp>& a, const Rect_<_Tp>& b ) -{ - _Tp x1 = std::max(a.x, b.x); - _Tp y1 = std::max(a.y, b.y); - a.width = std::min(a.x + a.width, b.x + b.width) - x1; - a.height = std::min(a.y + a.height, b.y + b.height) - y1; - a.x = x1; - a.y = y1; - if( a.width <= 0 || a.height <= 0 ) - a = Rect(); - return a; -} - -template static inline -Rect_<_Tp>& operator |= ( Rect_<_Tp>& a, const Rect_<_Tp>& b ) -{ - if (a.empty()) { - a = b; - } - else if (!b.empty()) { - _Tp x1 = std::min(a.x, b.x); - _Tp y1 = std::min(a.y, b.y); - a.width = std::max(a.x + a.width, b.x + b.width) - x1; - a.height = std::max(a.y + a.height, b.y + b.height) - y1; - a.x = x1; - a.y = y1; - } - return a; -} - -template static inline -bool operator == (const Rect_<_Tp>& a, const Rect_<_Tp>& b) -{ - return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; -} - -template static inline -bool operator != (const Rect_<_Tp>& a, const Rect_<_Tp>& b) -{ - return a.x != b.x || a.y != b.y || a.width != b.width || a.height != b.height; -} - -template static inline -Rect_<_Tp> operator + (const Rect_<_Tp>& a, const Point_<_Tp>& b) -{ - return Rect_<_Tp>( a.x + b.x, a.y + b.y, a.width, a.height ); -} - -template static inline -Rect_<_Tp> operator - (const Rect_<_Tp>& a, const Point_<_Tp>& b) -{ - return Rect_<_Tp>( a.x - b.x, a.y - b.y, a.width, a.height ); -} - -template static inline -Rect_<_Tp> operator + (const Rect_<_Tp>& a, const Size_<_Tp>& b) -{ - return Rect_<_Tp>( a.x, a.y, a.width + b.width, a.height + b.height ); -} - -template static inline -Rect_<_Tp> operator - (const Rect_<_Tp>& a, const Size_<_Tp>& b) -{ - const _Tp width = a.width - b.width; - const _Tp height = a.height - b.height; - CV_DbgAssert(width >= 0 && height >= 0); - return Rect_<_Tp>( a.x, a.y, width, height ); -} - -template static inline -Rect_<_Tp> operator & (const Rect_<_Tp>& a, const Rect_<_Tp>& b) -{ - Rect_<_Tp> c = a; - return c &= b; -} - -template static inline -Rect_<_Tp> operator | (const Rect_<_Tp>& a, const Rect_<_Tp>& b) -{ - Rect_<_Tp> c = a; - return c |= b; -} - -/** - * @brief measure dissimilarity between two sample sets - * - * computes the complement of the Jaccard Index as described in . - * For rectangles this reduces to computing the intersection over the union. - */ -template static inline -double jaccardDistance(const Rect_<_Tp>& a, const Rect_<_Tp>& b) { - _Tp Aa = a.area(); - _Tp Ab = b.area(); - - if ((Aa + Ab) <= std::numeric_limits<_Tp>::epsilon()) { - // jaccard_index = 1 -> distance = 0 - return 0.0; - } - - double Aab = (a & b).area(); - // distance = 1 - jaccard_index - return 1.0 - Aab / (Aa + Ab - Aab); -} - -////////////////////////////// RotatedRect ////////////////////////////// - -inline -RotatedRect::RotatedRect() - : center(), size(), angle(0) {} - -inline -RotatedRect::RotatedRect(const Point2f& _center, const Size2f& _size, float _angle) - : center(_center), size(_size), angle(_angle) {} - - - -///////////////////////////////// Range ///////////////////////////////// - -inline -Range::Range() - : start(0), end(0) {} - -inline -Range::Range(int _start, int _end) - : start(_start), end(_end) {} - -inline -int Range::size() const -{ - return end - start; -} - -inline -bool Range::empty() const -{ - return start == end; -} - -inline -Range Range::all() -{ - return Range(INT_MIN, INT_MAX); -} - - -static inline -bool operator == (const Range& r1, const Range& r2) -{ - return r1.start == r2.start && r1.end == r2.end; -} - -static inline -bool operator != (const Range& r1, const Range& r2) -{ - return !(r1 == r2); -} - -static inline -bool operator !(const Range& r) -{ - return r.start == r.end; -} - -static inline -Range operator & (const Range& r1, const Range& r2) -{ - Range r(std::max(r1.start, r2.start), std::min(r1.end, r2.end)); - r.end = std::max(r.end, r.start); - return r; -} - -static inline -Range& operator &= (Range& r1, const Range& r2) -{ - r1 = r1 & r2; - return r1; -} - -static inline -Range operator + (const Range& r1, int delta) -{ - return Range(r1.start + delta, r1.end + delta); -} - -static inline -Range operator + (int delta, const Range& r1) -{ - return Range(r1.start + delta, r1.end + delta); -} - -static inline -Range operator - (const Range& r1, int delta) -{ - return r1 + (-delta); -} - - - -///////////////////////////////// Scalar //////////////////////////////// - -template inline -Scalar_<_Tp>::Scalar_() -{ - this->val[0] = this->val[1] = this->val[2] = this->val[3] = 0; -} - -template inline -Scalar_<_Tp>::Scalar_(_Tp v0, _Tp v1, _Tp v2, _Tp v3) -{ - this->val[0] = v0; - this->val[1] = v1; - this->val[2] = v2; - this->val[3] = v3; -} - -template template inline -Scalar_<_Tp>::Scalar_(const Vec<_Tp2, cn>& v) -{ - int i; - for( i = 0; i < (cn < 4 ? cn : 4); i++ ) - this->val[i] = cv::saturate_cast<_Tp>(v.val[i]); - for( ; i < 4; i++ ) - this->val[i] = 0; -} - -template inline -Scalar_<_Tp>::Scalar_(_Tp v0) -{ - this->val[0] = v0; - this->val[1] = this->val[2] = this->val[3] = 0; -} - -template inline -Scalar_<_Tp> Scalar_<_Tp>::all(_Tp v0) -{ - return Scalar_<_Tp>(v0, v0, v0, v0); -} - - -template inline -Scalar_<_Tp> Scalar_<_Tp>::mul(const Scalar_<_Tp>& a, double scale ) const -{ - return Scalar_<_Tp>(saturate_cast<_Tp>(this->val[0] * a.val[0] * scale), - saturate_cast<_Tp>(this->val[1] * a.val[1] * scale), - saturate_cast<_Tp>(this->val[2] * a.val[2] * scale), - saturate_cast<_Tp>(this->val[3] * a.val[3] * scale)); -} - -template inline -Scalar_<_Tp> Scalar_<_Tp>::conj() const -{ - return Scalar_<_Tp>(saturate_cast<_Tp>( this->val[0]), - saturate_cast<_Tp>(-this->val[1]), - saturate_cast<_Tp>(-this->val[2]), - saturate_cast<_Tp>(-this->val[3])); -} - -template inline -bool Scalar_<_Tp>::isReal() const -{ - return this->val[1] == 0 && this->val[2] == 0 && this->val[3] == 0; -} - - -template template inline -Scalar_<_Tp>::operator Scalar_() const -{ - return Scalar_(saturate_cast(this->val[0]), - saturate_cast(this->val[1]), - saturate_cast(this->val[2]), - saturate_cast(this->val[3])); -} - - -template static inline -Scalar_<_Tp>& operator += (Scalar_<_Tp>& a, const Scalar_<_Tp>& b) -{ - a.val[0] += b.val[0]; - a.val[1] += b.val[1]; - a.val[2] += b.val[2]; - a.val[3] += b.val[3]; - return a; -} - -template static inline -Scalar_<_Tp>& operator -= (Scalar_<_Tp>& a, const Scalar_<_Tp>& b) -{ - a.val[0] -= b.val[0]; - a.val[1] -= b.val[1]; - a.val[2] -= b.val[2]; - a.val[3] -= b.val[3]; - return a; -} - -template static inline -Scalar_<_Tp>& operator *= ( Scalar_<_Tp>& a, _Tp v ) -{ - a.val[0] *= v; - a.val[1] *= v; - a.val[2] *= v; - a.val[3] *= v; - return a; -} - -template static inline -bool operator == ( const Scalar_<_Tp>& a, const Scalar_<_Tp>& b ) -{ - return a.val[0] == b.val[0] && a.val[1] == b.val[1] && - a.val[2] == b.val[2] && a.val[3] == b.val[3]; -} - -template static inline -bool operator != ( const Scalar_<_Tp>& a, const Scalar_<_Tp>& b ) -{ - return a.val[0] != b.val[0] || a.val[1] != b.val[1] || - a.val[2] != b.val[2] || a.val[3] != b.val[3]; -} - -template static inline -Scalar_<_Tp> operator + (const Scalar_<_Tp>& a, const Scalar_<_Tp>& b) -{ - return Scalar_<_Tp>(a.val[0] + b.val[0], - a.val[1] + b.val[1], - a.val[2] + b.val[2], - a.val[3] + b.val[3]); -} - -template static inline -Scalar_<_Tp> operator - (const Scalar_<_Tp>& a, const Scalar_<_Tp>& b) -{ - return Scalar_<_Tp>(saturate_cast<_Tp>(a.val[0] - b.val[0]), - saturate_cast<_Tp>(a.val[1] - b.val[1]), - saturate_cast<_Tp>(a.val[2] - b.val[2]), - saturate_cast<_Tp>(a.val[3] - b.val[3])); -} - -template static inline -Scalar_<_Tp> operator * (const Scalar_<_Tp>& a, _Tp alpha) -{ - return Scalar_<_Tp>(a.val[0] * alpha, - a.val[1] * alpha, - a.val[2] * alpha, - a.val[3] * alpha); -} - -template static inline -Scalar_<_Tp> operator * (_Tp alpha, const Scalar_<_Tp>& a) -{ - return a*alpha; -} - -template static inline -Scalar_<_Tp> operator - (const Scalar_<_Tp>& a) -{ - return Scalar_<_Tp>(saturate_cast<_Tp>(-a.val[0]), - saturate_cast<_Tp>(-a.val[1]), - saturate_cast<_Tp>(-a.val[2]), - saturate_cast<_Tp>(-a.val[3])); -} - - -template static inline -Scalar_<_Tp> operator * (const Scalar_<_Tp>& a, const Scalar_<_Tp>& b) -{ - return Scalar_<_Tp>(saturate_cast<_Tp>(a[0]*b[0] - a[1]*b[1] - a[2]*b[2] - a[3]*b[3]), - saturate_cast<_Tp>(a[0]*b[1] + a[1]*b[0] + a[2]*b[3] - a[3]*b[2]), - saturate_cast<_Tp>(a[0]*b[2] - a[1]*b[3] + a[2]*b[0] + a[3]*b[1]), - saturate_cast<_Tp>(a[0]*b[3] + a[1]*b[2] - a[2]*b[1] + a[3]*b[0])); -} - -template static inline -Scalar_<_Tp>& operator *= (Scalar_<_Tp>& a, const Scalar_<_Tp>& b) -{ - a = a * b; - return a; -} - -template static inline -Scalar_<_Tp> operator / (const Scalar_<_Tp>& a, _Tp alpha) -{ - return Scalar_<_Tp>(a.val[0] / alpha, - a.val[1] / alpha, - a.val[2] / alpha, - a.val[3] / alpha); -} - -template static inline -Scalar_ operator / (const Scalar_& a, float alpha) -{ - float s = 1 / alpha; - return Scalar_(a.val[0] * s, a.val[1] * s, a.val[2] * s, a.val[3] * s); -} - -template static inline -Scalar_ operator / (const Scalar_& a, double alpha) -{ - double s = 1 / alpha; - return Scalar_(a.val[0] * s, a.val[1] * s, a.val[2] * s, a.val[3] * s); -} - -template static inline -Scalar_<_Tp>& operator /= (Scalar_<_Tp>& a, _Tp alpha) -{ - a = a / alpha; - return a; -} - -template static inline -Scalar_<_Tp> operator / (_Tp a, const Scalar_<_Tp>& b) -{ - _Tp s = a / (b[0]*b[0] + b[1]*b[1] + b[2]*b[2] + b[3]*b[3]); - return b.conj() * s; -} - -template static inline -Scalar_<_Tp> operator / (const Scalar_<_Tp>& a, const Scalar_<_Tp>& b) -{ - return a * ((_Tp)1 / b); -} - -template static inline -Scalar_<_Tp>& operator /= (Scalar_<_Tp>& a, const Scalar_<_Tp>& b) -{ - a = a / b; - return a; -} - -template static inline -Scalar operator * (const Matx<_Tp, 4, 4>& a, const Scalar& b) -{ - Matx c((Matx)a, b, Matx_MatMulOp()); - return reinterpret_cast(c); -} - -template<> inline -Scalar operator * (const Matx& a, const Scalar& b) -{ - Matx c(a, b, Matx_MatMulOp()); - return reinterpret_cast(c); -} - - - -//////////////////////////////// KeyPoint /////////////////////////////// - -inline -KeyPoint::KeyPoint() - : pt(0,0), size(0), angle(-1), response(0), octave(0), class_id(-1) {} - -inline -KeyPoint::KeyPoint(Point2f _pt, float _size, float _angle, float _response, int _octave, int _class_id) - : pt(_pt), size(_size), angle(_angle), response(_response), octave(_octave), class_id(_class_id) {} - -inline -KeyPoint::KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id) - : pt(x, y), size(_size), angle(_angle), response(_response), octave(_octave), class_id(_class_id) {} - - - -///////////////////////////////// DMatch //////////////////////////////// - -inline -DMatch::DMatch() - : queryIdx(-1), trainIdx(-1), imgIdx(-1), distance(FLT_MAX) {} - -inline -DMatch::DMatch(int _queryIdx, int _trainIdx, float _distance) - : queryIdx(_queryIdx), trainIdx(_trainIdx), imgIdx(-1), distance(_distance) {} - -inline -DMatch::DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance) - : queryIdx(_queryIdx), trainIdx(_trainIdx), imgIdx(_imgIdx), distance(_distance) {} - -inline -bool DMatch::operator < (const DMatch &m) const -{ - return distance < m.distance; -} - - - -////////////////////////////// TermCriteria ///////////////////////////// - -inline -TermCriteria::TermCriteria() - : type(0), maxCount(0), epsilon(0) {} - -inline -TermCriteria::TermCriteria(int _type, int _maxCount, double _epsilon) - : type(_type), maxCount(_maxCount), epsilon(_epsilon) {} - -//! @endcond - -} // cv - -#endif //OPENCV_CORE_TYPES_HPP diff --git a/opencv/include/opencv2/core/types_c.h b/opencv/include/opencv2/core/types_c.h deleted file mode 100644 index 5f63eb8..0000000 --- a/opencv/include/opencv2/core/types_c.h +++ /dev/null @@ -1,2139 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_TYPES_H -#define OPENCV_CORE_TYPES_H - -#if !defined(__OPENCV_BUILD) && !defined(CV__DISABLE_C_API_CTORS) -#define CV__ENABLE_C_API_CTORS // enable C API ctors (must be removed) -#endif - -//#define CV__VALIDATE_UNUNITIALIZED_VARS 1 // C++11 & GCC only - -#ifdef __cplusplus - -#ifdef CV__VALIDATE_UNUNITIALIZED_VARS -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#define CV_STRUCT_INITIALIZER {0,} -#else -#if defined(__GNUC__) && __GNUC__ == 4 // GCC 4.x warns on "= {}" initialization, fixed in GCC 5.0 -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif -#define CV_STRUCT_INITIALIZER {} -#endif - -#else -#define CV_STRUCT_INITIALIZER {0} -#endif - - -#ifdef HAVE_IPL -# ifndef __IPL_H__ -# if defined _WIN32 -# include -# else -# include -# endif -# endif -#elif defined __IPL_H__ -# define HAVE_IPL -#endif - -#include "opencv2/core/cvdef.h" - -#ifndef SKIP_INCLUDES -#include -#include -#include -#include -#endif // SKIP_INCLUDES - -#if defined _WIN32 -# define CV_CDECL __cdecl -# define CV_STDCALL __stdcall -#else -# define CV_CDECL -# define CV_STDCALL -#endif - -#ifndef CV_DEFAULT -# ifdef __cplusplus -# define CV_DEFAULT(val) = val -# else -# define CV_DEFAULT(val) -# endif -#endif - -#ifndef CV_EXTERN_C_FUNCPTR -# ifdef __cplusplus -# define CV_EXTERN_C_FUNCPTR(x) extern "C" { typedef x; } -# else -# define CV_EXTERN_C_FUNCPTR(x) typedef x -# endif -#endif - -#ifndef CVAPI -# define CVAPI(rettype) CV_EXTERN_C CV_EXPORTS rettype CV_CDECL -#endif - -#ifndef CV_IMPL -# define CV_IMPL CV_EXTERN_C -#endif - -#ifdef __cplusplus -# include "opencv2/core.hpp" -#endif - -/** @addtogroup core_c - @{ -*/ - -/** @brief This is the "metatype" used *only* as a function parameter. - -It denotes that the function accepts arrays of multiple types, such as IplImage*, CvMat* or even -CvSeq* sometimes. The particular array type is determined at runtime by analyzing the first 4 -bytes of the header. In C++ interface the role of CvArr is played by InputArray and OutputArray. - */ -typedef void CvArr; - -typedef int CVStatus; - -/** @see cv::Error::Code */ -enum { - CV_StsOk= 0, /**< everything is ok */ - CV_StsBackTrace= -1, /**< pseudo error for back trace */ - CV_StsError= -2, /**< unknown /unspecified error */ - CV_StsInternal= -3, /**< internal error (bad state) */ - CV_StsNoMem= -4, /**< insufficient memory */ - CV_StsBadArg= -5, /**< function arg/param is bad */ - CV_StsBadFunc= -6, /**< unsupported function */ - CV_StsNoConv= -7, /**< iter. didn't converge */ - CV_StsAutoTrace= -8, /**< tracing */ - CV_HeaderIsNull= -9, /**< image header is NULL */ - CV_BadImageSize= -10, /**< image size is invalid */ - CV_BadOffset= -11, /**< offset is invalid */ - CV_BadDataPtr= -12, /**/ - CV_BadStep= -13, /**< image step is wrong, this may happen for a non-continuous matrix */ - CV_BadModelOrChSeq= -14, /**/ - CV_BadNumChannels= -15, /**< bad number of channels, for example, some functions accept only single channel matrices */ - CV_BadNumChannel1U= -16, /**/ - CV_BadDepth= -17, /**< input image depth is not supported by the function */ - CV_BadAlphaChannel= -18, /**/ - CV_BadOrder= -19, /**< number of dimensions is out of range */ - CV_BadOrigin= -20, /**< incorrect input origin */ - CV_BadAlign= -21, /**< incorrect input align */ - CV_BadCallBack= -22, /**/ - CV_BadTileSize= -23, /**/ - CV_BadCOI= -24, /**< input COI is not supported */ - CV_BadROISize= -25, /**< incorrect input roi */ - CV_MaskIsTiled= -26, /**/ - CV_StsNullPtr= -27, /**< null pointer */ - CV_StsVecLengthErr= -28, /**< incorrect vector length */ - CV_StsFilterStructContentErr= -29, /**< incorrect filter structure content */ - CV_StsKernelStructContentErr= -30, /**< incorrect transform kernel content */ - CV_StsFilterOffsetErr= -31, /**< incorrect filter offset value */ - CV_StsBadSize= -201, /**< the input/output structure size is incorrect */ - CV_StsDivByZero= -202, /**< division by zero */ - CV_StsInplaceNotSupported= -203, /**< in-place operation is not supported */ - CV_StsObjectNotFound= -204, /**< request can't be completed */ - CV_StsUnmatchedFormats= -205, /**< formats of input/output arrays differ */ - CV_StsBadFlag= -206, /**< flag is wrong or not supported */ - CV_StsBadPoint= -207, /**< bad CvPoint */ - CV_StsBadMask= -208, /**< bad format of mask (neither 8uC1 nor 8sC1)*/ - CV_StsUnmatchedSizes= -209, /**< sizes of input/output structures do not match */ - CV_StsUnsupportedFormat= -210, /**< the data format/type is not supported by the function*/ - CV_StsOutOfRange= -211, /**< some of parameters are out of range */ - CV_StsParseError= -212, /**< invalid syntax/structure of the parsed file */ - CV_StsNotImplemented= -213, /**< the requested function/feature is not implemented */ - CV_StsBadMemBlock= -214, /**< an allocated block has been corrupted */ - CV_StsAssert= -215, /**< assertion failed */ - CV_GpuNotSupported= -216, /**< no CUDA support */ - CV_GpuApiCallError= -217, /**< GPU API call error */ - CV_OpenGlNotSupported= -218, /**< no OpenGL support */ - CV_OpenGlApiCallError= -219, /**< OpenGL API call error */ - CV_OpenCLApiCallError= -220, /**< OpenCL API call error */ - CV_OpenCLDoubleNotSupported= -221, - CV_OpenCLInitError= -222, /**< OpenCL initialization error */ - CV_OpenCLNoAMDBlasFft= -223 -}; - -/****************************************************************************************\ -* Common macros and inline functions * -\****************************************************************************************/ - -#define CV_SWAP(a,b,t) ((t) = (a), (a) = (b), (b) = (t)) - -/** min & max without jumps */ -#define CV_IMIN(a, b) ((a) ^ (((a)^(b)) & (((a) < (b)) - 1))) - -#define CV_IMAX(a, b) ((a) ^ (((a)^(b)) & (((a) > (b)) - 1))) - -/** absolute value without jumps */ -#ifndef __cplusplus -# define CV_IABS(a) (((a) ^ ((a) < 0 ? -1 : 0)) - ((a) < 0 ? -1 : 0)) -#else -# define CV_IABS(a) abs(a) -#endif -#define CV_CMP(a,b) (((a) > (b)) - ((a) < (b))) -#define CV_SIGN(a) CV_CMP((a),0) - -#define cvInvSqrt(value) ((float)(1./sqrt(value))) -#define cvSqrt(value) ((float)sqrt(value)) - - -/*************** Random number generation *******************/ - -typedef uint64 CvRNG; - -#define CV_RNG_COEFF 4164903690U - -/** @brief Initializes a random number generator state. - -The function initializes a random number generator and returns the state. The pointer to the state -can be then passed to the cvRandInt, cvRandReal and cvRandArr functions. In the current -implementation a multiply-with-carry generator is used. -@param seed 64-bit value used to initiate a random sequence -@sa the C++ class RNG replaced CvRNG. - */ -CV_INLINE CvRNG cvRNG( int64 seed CV_DEFAULT(-1)) -{ - CvRNG rng = seed ? (uint64)seed : (uint64)(int64)-1; - return rng; -} - -/** @brief Returns a 32-bit unsigned integer and updates RNG. - -The function returns a uniformly-distributed random 32-bit unsigned integer and updates the RNG -state. It is similar to the rand() function from the C runtime library, except that OpenCV functions -always generates a 32-bit random number, regardless of the platform. -@param rng CvRNG state initialized by cvRNG. - */ -CV_INLINE unsigned cvRandInt( CvRNG* rng ) -{ - uint64 temp = *rng; - temp = (uint64)(unsigned)temp*CV_RNG_COEFF + (temp >> 32); - *rng = temp; - return (unsigned)temp; -} - -/** @brief Returns a floating-point random number and updates RNG. - -The function returns a uniformly-distributed random floating-point number between 0 and 1 (1 is not -included). -@param rng RNG state initialized by cvRNG - */ -CV_INLINE double cvRandReal( CvRNG* rng ) -{ - return cvRandInt(rng)*2.3283064365386962890625e-10 /* 2^-32 */; -} - -/****************************************************************************************\ -* Image type (IplImage) * -\****************************************************************************************/ - -#ifndef HAVE_IPL - -/* - * The following definitions (until #endif) - * is an extract from IPL headers. - * Copyright (c) 1995 Intel Corporation. - */ -#define IPL_DEPTH_SIGN 0x80000000 - -#define IPL_DEPTH_1U 1 -#define IPL_DEPTH_8U 8 -#define IPL_DEPTH_16U 16 -#define IPL_DEPTH_32F 32 - -#define IPL_DEPTH_8S (IPL_DEPTH_SIGN| 8) -#define IPL_DEPTH_16S (IPL_DEPTH_SIGN|16) -#define IPL_DEPTH_32S (IPL_DEPTH_SIGN|32) - -#define IPL_DATA_ORDER_PIXEL 0 -#define IPL_DATA_ORDER_PLANE 1 - -#define IPL_ORIGIN_TL 0 -#define IPL_ORIGIN_BL 1 - -#define IPL_ALIGN_4BYTES 4 -#define IPL_ALIGN_8BYTES 8 -#define IPL_ALIGN_16BYTES 16 -#define IPL_ALIGN_32BYTES 32 - -#define IPL_ALIGN_DWORD IPL_ALIGN_4BYTES -#define IPL_ALIGN_QWORD IPL_ALIGN_8BYTES - -#define IPL_BORDER_CONSTANT 0 -#define IPL_BORDER_REPLICATE 1 -#define IPL_BORDER_REFLECT 2 -#define IPL_BORDER_WRAP 3 - -#ifdef __cplusplus -typedef struct _IplImage IplImage; -CV_EXPORTS _IplImage cvIplImage(const cv::Mat& m); -#endif - -/** The IplImage is taken from the Intel Image Processing Library, in which the format is native. OpenCV -only supports a subset of possible IplImage formats, as outlined in the parameter list above. - -In addition to the above restrictions, OpenCV handles ROIs differently. OpenCV functions require -that the image size or ROI size of all source and destination images match exactly. On the other -hand, the Intel Image Processing Library processes the area of intersection between the source and -destination images (or ROIs), allowing them to vary independently. -*/ -typedef struct -_IplImage -{ - int nSize; /**< sizeof(IplImage) */ - int ID; /**< version (=0)*/ - int nChannels; /**< Most of OpenCV functions support 1,2,3 or 4 channels */ - int alphaChannel; /**< Ignored by OpenCV */ - int depth; /**< Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S, - IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported. */ - char colorModel[4]; /**< Ignored by OpenCV */ - char channelSeq[4]; /**< ditto */ - int dataOrder; /**< 0 - interleaved color channels, 1 - separate color channels. - cvCreateImage can only create interleaved images */ - int origin; /**< 0 - top-left origin, - 1 - bottom-left origin (Windows bitmaps style). */ - int align; /**< Alignment of image rows (4 or 8). - OpenCV ignores it and uses widthStep instead. */ - int width; /**< Image width in pixels. */ - int height; /**< Image height in pixels. */ - struct _IplROI *roi; /**< Image ROI. If NULL, the whole image is selected. */ - struct _IplImage *maskROI; /**< Must be NULL. */ - void *imageId; /**< " " */ - struct _IplTileInfo *tileInfo; /**< " " */ - int imageSize; /**< Image data size in bytes - (==image->height*image->widthStep - in case of interleaved data)*/ - char *imageData; /**< Pointer to aligned image data. */ - int widthStep; /**< Size of aligned image row in bytes. */ - int BorderMode[4]; /**< Ignored by OpenCV. */ - int BorderConst[4]; /**< Ditto. */ - char *imageDataOrigin; /**< Pointer to very origin of image data - (not necessarily aligned) - - needed for correct deallocation */ - -#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) - _IplImage() {} - _IplImage(const cv::Mat& m) { *this = cvIplImage(m); } -#endif -} -IplImage; - -CV_INLINE IplImage cvIplImage() -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - IplImage self = CV_STRUCT_INITIALIZER; self.nSize = sizeof(IplImage); return self; -#else - return _IplImage(); -#endif -} - -typedef struct _IplTileInfo IplTileInfo; - -typedef struct _IplROI -{ - int coi; /**< 0 - no COI (all channels are selected), 1 - 0th channel is selected ...*/ - int xOffset; - int yOffset; - int width; - int height; -} -IplROI; - -typedef struct _IplConvKernel -{ - int nCols; - int nRows; - int anchorX; - int anchorY; - int *values; - int nShiftR; -} -IplConvKernel; - -typedef struct _IplConvKernelFP -{ - int nCols; - int nRows; - int anchorX; - int anchorY; - float *values; -} -IplConvKernelFP; - -#define IPL_IMAGE_HEADER 1 -#define IPL_IMAGE_DATA 2 -#define IPL_IMAGE_ROI 4 - -#endif/*HAVE_IPL*/ - -/** extra border mode */ -#define IPL_BORDER_REFLECT_101 4 -#define IPL_BORDER_TRANSPARENT 5 - -#define IPL_IMAGE_MAGIC_VAL ((int)sizeof(IplImage)) -#define CV_TYPE_NAME_IMAGE "opencv-image" - -#define CV_IS_IMAGE_HDR(img) \ - ((img) != NULL && ((const IplImage*)(img))->nSize == sizeof(IplImage)) - -#define CV_IS_IMAGE(img) \ - (CV_IS_IMAGE_HDR(img) && ((IplImage*)img)->imageData != NULL) - -/** for storing double-precision - floating point data in IplImage's */ -#define IPL_DEPTH_64F 64 - -/** get reference to pixel at (col,row), - for multi-channel images (col) should be multiplied by number of channels */ -#define CV_IMAGE_ELEM( image, elemtype, row, col ) \ - (((elemtype*)((image)->imageData + (image)->widthStep*(row)))[(col)]) - -/****************************************************************************************\ -* Matrix type (CvMat) * -\****************************************************************************************/ - -#define CV_AUTO_STEP 0x7fffffff -#define CV_WHOLE_ARR cvSlice( 0, 0x3fffffff ) - -#define CV_MAGIC_MASK 0xFFFF0000 -#define CV_MAT_MAGIC_VAL 0x42420000 -#define CV_TYPE_NAME_MAT "opencv-matrix" - -#ifdef __cplusplus -typedef struct CvMat CvMat; -CV_INLINE CvMat cvMat(const cv::Mat& m); -#endif - -/** Matrix elements are stored row by row. Element (i, j) (i - 0-based row index, j - 0-based column -index) of a matrix can be retrieved or modified using CV_MAT_ELEM macro: - - uchar pixval = CV_MAT_ELEM(grayimg, uchar, i, j) - CV_MAT_ELEM(cameraMatrix, float, 0, 2) = image.width*0.5f; - -To access multiple-channel matrices, you can use -CV_MAT_ELEM(matrix, type, i, j\*nchannels + channel_idx). - -@deprecated CvMat is now obsolete; consider using Mat instead. - */ -typedef struct CvMat -{ - int type; - int step; - - /* for internal use only */ - int* refcount; - int hdr_refcount; - - union - { - uchar* ptr; - short* s; - int* i; - float* fl; - double* db; - } data; - -#ifdef __cplusplus - union - { - int rows; - int height; - }; - - union - { - int cols; - int width; - }; -#else - int rows; - int cols; -#endif - -#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) - CvMat() {} - CvMat(const cv::Mat& m) { *this = cvMat(m); } -#endif -} -CvMat; - - -#define CV_IS_MAT_HDR(mat) \ - ((mat) != NULL && \ - (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL && \ - ((const CvMat*)(mat))->cols > 0 && ((const CvMat*)(mat))->rows > 0) - -#define CV_IS_MAT_HDR_Z(mat) \ - ((mat) != NULL && \ - (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL && \ - ((const CvMat*)(mat))->cols >= 0 && ((const CvMat*)(mat))->rows >= 0) - -#define CV_IS_MAT(mat) \ - (CV_IS_MAT_HDR(mat) && ((const CvMat*)(mat))->data.ptr != NULL) - -#define CV_IS_MASK_ARR(mat) \ - (((mat)->type & (CV_MAT_TYPE_MASK & ~CV_8SC1)) == 0) - -#define CV_ARE_TYPES_EQ(mat1, mat2) \ - ((((mat1)->type ^ (mat2)->type) & CV_MAT_TYPE_MASK) == 0) - -#define CV_ARE_CNS_EQ(mat1, mat2) \ - ((((mat1)->type ^ (mat2)->type) & CV_MAT_CN_MASK) == 0) - -#define CV_ARE_DEPTHS_EQ(mat1, mat2) \ - ((((mat1)->type ^ (mat2)->type) & CV_MAT_DEPTH_MASK) == 0) - -#define CV_ARE_SIZES_EQ(mat1, mat2) \ - ((mat1)->rows == (mat2)->rows && (mat1)->cols == (mat2)->cols) - -#define CV_IS_MAT_CONST(mat) \ - (((mat)->rows|(mat)->cols) == 1) - -#define IPL2CV_DEPTH(depth) \ - ((((CV_8U)+(CV_16U<<4)+(CV_32F<<8)+(CV_64F<<16)+(CV_8S<<20)+ \ - (CV_16S<<24)+(CV_32S<<28)) >> ((((depth) & 0xF0) >> 2) + \ - (((depth) & IPL_DEPTH_SIGN) ? 20 : 0))) & 15) - -/** Inline constructor. No data is allocated internally!!! - * (Use together with cvCreateData, or use cvCreateMat instead to - * get a matrix with allocated data): - */ -CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL)) -{ - CvMat m; - - assert( (unsigned)CV_MAT_DEPTH(type) <= CV_64F ); - type = CV_MAT_TYPE(type); - m.type = CV_MAT_MAGIC_VAL | CV_MAT_CONT_FLAG | type; - m.cols = cols; - m.rows = rows; - m.step = m.cols*CV_ELEM_SIZE(type); - m.data.ptr = (uchar*)data; - m.refcount = NULL; - m.hdr_refcount = 0; - - return m; -} - -#ifdef __cplusplus - -CV_INLINE CvMat cvMat(const cv::Mat& m) -{ - CvMat self; - CV_DbgAssert(m.dims <= 2); - self = cvMat(m.rows, m.dims == 1 ? 1 : m.cols, m.type(), m.data); - self.step = (int)m.step[0]; - self.type = (self.type & ~cv::Mat::CONTINUOUS_FLAG) | (m.flags & cv::Mat::CONTINUOUS_FLAG); - return self; -} -CV_INLINE CvMat cvMat() -{ -#if !defined(CV__ENABLE_C_API_CTORS) - CvMat self = CV_STRUCT_INITIALIZER; return self; -#else - return CvMat(); -#endif -} -CV_INLINE CvMat cvMat(const CvMat& m) -{ -#if !defined(CV__ENABLE_C_API_CTORS) - CvMat self = CV_STRUCT_INITIALIZER; memcpy(&self, &m, sizeof(self)); return self; -#else - return CvMat(m); -#endif -} - -#endif // __cplusplus - - -#define CV_MAT_ELEM_PTR_FAST( mat, row, col, pix_size ) \ - (assert( (unsigned)(row) < (unsigned)(mat).rows && \ - (unsigned)(col) < (unsigned)(mat).cols ), \ - (mat).data.ptr + (size_t)(mat).step*(row) + (pix_size)*(col)) - -#define CV_MAT_ELEM_PTR( mat, row, col ) \ - CV_MAT_ELEM_PTR_FAST( mat, row, col, CV_ELEM_SIZE((mat).type) ) - -#define CV_MAT_ELEM( mat, elemtype, row, col ) \ - (*(elemtype*)CV_MAT_ELEM_PTR_FAST( mat, row, col, sizeof(elemtype))) - -/** @brief Returns the particular element of single-channel floating-point matrix. - -The function is a fast replacement for cvGetReal2D in the case of single-channel floating-point -matrices. It is faster because it is inline, it does fewer checks for array type and array element -type, and it checks for the row and column ranges only in debug mode. -@param mat Input matrix -@param row The zero-based index of row -@param col The zero-based index of column - */ -CV_INLINE double cvmGet( const CvMat* mat, int row, int col ) -{ - int type; - - type = CV_MAT_TYPE(mat->type); - assert( (unsigned)row < (unsigned)mat->rows && - (unsigned)col < (unsigned)mat->cols ); - - if( type == CV_32FC1 ) - return ((float*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col]; - else - { - assert( type == CV_64FC1 ); - return ((double*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col]; - } -} - -/** @brief Sets a specific element of a single-channel floating-point matrix. - -The function is a fast replacement for cvSetReal2D in the case of single-channel floating-point -matrices. It is faster because it is inline, it does fewer checks for array type and array element -type, and it checks for the row and column ranges only in debug mode. -@param mat The matrix -@param row The zero-based index of row -@param col The zero-based index of column -@param value The new value of the matrix element - */ -CV_INLINE void cvmSet( CvMat* mat, int row, int col, double value ) -{ - int type; - type = CV_MAT_TYPE(mat->type); - assert( (unsigned)row < (unsigned)mat->rows && - (unsigned)col < (unsigned)mat->cols ); - - if( type == CV_32FC1 ) - ((float*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col] = (float)value; - else - { - assert( type == CV_64FC1 ); - ((double*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col] = value; - } -} - - -CV_INLINE int cvIplDepth( int type ) -{ - int depth = CV_MAT_DEPTH(type); - return CV_ELEM_SIZE1(depth)*8 | (depth == CV_8S || depth == CV_16S || - depth == CV_32S ? IPL_DEPTH_SIGN : 0); -} - - -/****************************************************************************************\ -* Multi-dimensional dense array (CvMatND) * -\****************************************************************************************/ - -#define CV_MATND_MAGIC_VAL 0x42430000 -#define CV_TYPE_NAME_MATND "opencv-nd-matrix" - -#define CV_MAX_DIM 32 - -#ifdef __cplusplus -typedef struct CvMatND CvMatND; -CV_EXPORTS CvMatND cvMatND(const cv::Mat& m); -#endif - -/** - @deprecated consider using cv::Mat instead - */ -typedef struct -CvMatND -{ - int type; - int dims; - - int* refcount; - int hdr_refcount; - - union - { - uchar* ptr; - float* fl; - double* db; - int* i; - short* s; - } data; - - struct - { - int size; - int step; - } - dim[CV_MAX_DIM]; - -#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) - CvMatND() {} - CvMatND(const cv::Mat& m) { *this = cvMatND(m); } -#endif -} -CvMatND; - - -CV_INLINE CvMatND cvMatND() -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvMatND self = CV_STRUCT_INITIALIZER; return self; -#else - return CvMatND(); -#endif -} - -#define CV_IS_MATND_HDR(mat) \ - ((mat) != NULL && (((const CvMatND*)(mat))->type & CV_MAGIC_MASK) == CV_MATND_MAGIC_VAL) - -#define CV_IS_MATND(mat) \ - (CV_IS_MATND_HDR(mat) && ((const CvMatND*)(mat))->data.ptr != NULL) - - -/****************************************************************************************\ -* Multi-dimensional sparse array (CvSparseMat) * -\****************************************************************************************/ - -#define CV_SPARSE_MAT_MAGIC_VAL 0x42440000 -#define CV_TYPE_NAME_SPARSE_MAT "opencv-sparse-matrix" - -struct CvSet; - -typedef struct CvSparseMat -{ - int type; - int dims; - int* refcount; - int hdr_refcount; - - struct CvSet* heap; - void** hashtable; - int hashsize; - int valoffset; - int idxoffset; - int size[CV_MAX_DIM]; - -#ifdef __cplusplus - CV_EXPORTS void copyToSparseMat(cv::SparseMat& m) const; -#endif -} -CvSparseMat; - -#ifdef __cplusplus -CV_EXPORTS CvSparseMat* cvCreateSparseMat(const cv::SparseMat& m); -#endif - -#define CV_IS_SPARSE_MAT_HDR(mat) \ - ((mat) != NULL && \ - (((const CvSparseMat*)(mat))->type & CV_MAGIC_MASK) == CV_SPARSE_MAT_MAGIC_VAL) - -#define CV_IS_SPARSE_MAT(mat) \ - CV_IS_SPARSE_MAT_HDR(mat) - -/**************** iteration through a sparse array *****************/ - -typedef struct CvSparseNode -{ - unsigned hashval; - struct CvSparseNode* next; -} -CvSparseNode; - -typedef struct CvSparseMatIterator -{ - CvSparseMat* mat; - CvSparseNode* node; - int curidx; -} -CvSparseMatIterator; - -#define CV_NODE_VAL(mat,node) ((void*)((uchar*)(node) + (mat)->valoffset)) -#define CV_NODE_IDX(mat,node) ((int*)((uchar*)(node) + (mat)->idxoffset)) - -/****************************************************************************************\ -* Histogram * -\****************************************************************************************/ - -typedef int CvHistType; - -#define CV_HIST_MAGIC_VAL 0x42450000 -#define CV_HIST_UNIFORM_FLAG (1 << 10) - -/** indicates whether bin ranges are set already or not */ -#define CV_HIST_RANGES_FLAG (1 << 11) - -#define CV_HIST_ARRAY 0 -#define CV_HIST_SPARSE 1 -#define CV_HIST_TREE CV_HIST_SPARSE - -/** should be used as a parameter only, - it turns to CV_HIST_UNIFORM_FLAG of hist->type */ -#define CV_HIST_UNIFORM 1 - -typedef struct CvHistogram -{ - int type; - CvArr* bins; - float thresh[CV_MAX_DIM][2]; /**< For uniform histograms. */ - float** thresh2; /**< For non-uniform histograms. */ - CvMatND mat; /**< Embedded matrix header for array histograms. */ -} -CvHistogram; - -#define CV_IS_HIST( hist ) \ - ((hist) != NULL && \ - (((CvHistogram*)(hist))->type & CV_MAGIC_MASK) == CV_HIST_MAGIC_VAL && \ - (hist)->bins != NULL) - -#define CV_IS_UNIFORM_HIST( hist ) \ - (((hist)->type & CV_HIST_UNIFORM_FLAG) != 0) - -#define CV_IS_SPARSE_HIST( hist ) \ - CV_IS_SPARSE_MAT((hist)->bins) - -#define CV_HIST_HAS_RANGES( hist ) \ - (((hist)->type & CV_HIST_RANGES_FLAG) != 0) - -/****************************************************************************************\ -* Other supplementary data type definitions * -\****************************************************************************************/ - -/*************************************** CvRect *****************************************/ -/** @sa Rect_ */ -typedef struct CvRect -{ - int x; - int y; - int width; - int height; - -#ifdef CV__VALIDATE_UNUNITIALIZED_VARS - CvRect() __attribute__(( warning("Non-initialized variable") )) {}; - template CvRect(const std::initializer_list<_Tp> list) - { - CV_Assert(list.size() == 0 || list.size() == 4); - x = y = width = height = 0; - if (list.size() == 4) - { - x = list.begin()[0]; y = list.begin()[1]; width = list.begin()[2]; height = list.begin()[3]; - } - }; -#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) - CvRect(int _x = 0, int _y = 0, int w = 0, int h = 0): x(_x), y(_y), width(w), height(h) {} - template - CvRect(const cv::Rect_<_Tp>& r): x(cv::saturate_cast(r.x)), y(cv::saturate_cast(r.y)), width(cv::saturate_cast(r.width)), height(cv::saturate_cast(r.height)) {} -#endif -#ifdef __cplusplus - template - operator cv::Rect_<_Tp>() const { return cv::Rect_<_Tp>((_Tp)x, (_Tp)y, (_Tp)width, (_Tp)height); } -#endif -} -CvRect; - -/** constructs CvRect structure. */ -CV_INLINE CvRect cvRect( int x, int y, int width, int height ) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvRect r = {x, y, width, height}; -#else - CvRect r(x, y , width, height); -#endif - return r; -} -#ifdef __cplusplus -CV_INLINE CvRect cvRect(const cv::Rect& rc) { return cvRect(rc.x, rc.y, rc.width, rc.height); } -#endif - -CV_INLINE IplROI cvRectToROI( CvRect rect, int coi ) -{ - IplROI roi; - roi.xOffset = rect.x; - roi.yOffset = rect.y; - roi.width = rect.width; - roi.height = rect.height; - roi.coi = coi; - - return roi; -} - - -CV_INLINE CvRect cvROIToRect( IplROI roi ) -{ - return cvRect( roi.xOffset, roi.yOffset, roi.width, roi.height ); -} - -/*********************************** CvTermCriteria *************************************/ - -#define CV_TERMCRIT_ITER 1 -#define CV_TERMCRIT_NUMBER CV_TERMCRIT_ITER -#define CV_TERMCRIT_EPS 2 - -/** @sa TermCriteria - */ -typedef struct CvTermCriteria -{ - int type; /**< may be combination of - CV_TERMCRIT_ITER - CV_TERMCRIT_EPS */ - int max_iter; - double epsilon; -#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) - CvTermCriteria(int _type = 0, int _iter = 0, double _eps = 0) : type(_type), max_iter(_iter), epsilon(_eps) {} - CvTermCriteria(const cv::TermCriteria& t) : type(t.type), max_iter(t.maxCount), epsilon(t.epsilon) {} -#endif -#ifdef __cplusplus - operator cv::TermCriteria() const { return cv::TermCriteria(type, max_iter, epsilon); } -#endif -} -CvTermCriteria; - -CV_INLINE CvTermCriteria cvTermCriteria( int type, int max_iter, double epsilon ) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvTermCriteria t = { type, max_iter, (float)epsilon}; -#else - CvTermCriteria t(type, max_iter, epsilon); -#endif - return t; -} -#ifdef __cplusplus -CV_INLINE CvTermCriteria cvTermCriteria(const cv::TermCriteria& t) { return cvTermCriteria(t.type, t.maxCount, t.epsilon); } -#endif - - -/******************************* CvPoint and variants ***********************************/ - -typedef struct CvPoint -{ - int x; - int y; - -#ifdef CV__VALIDATE_UNUNITIALIZED_VARS - CvPoint() __attribute__(( warning("Non-initialized variable") )) {} - template CvPoint(const std::initializer_list<_Tp> list) - { - CV_Assert(list.size() == 0 || list.size() == 2); - x = y = 0; - if (list.size() == 2) - { - x = list.begin()[0]; y = list.begin()[1]; - } - }; -#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) - CvPoint(int _x = 0, int _y = 0): x(_x), y(_y) {} - template - CvPoint(const cv::Point_<_Tp>& pt): x((int)pt.x), y((int)pt.y) {} -#endif -#ifdef __cplusplus - template - operator cv::Point_<_Tp>() const { return cv::Point_<_Tp>(cv::saturate_cast<_Tp>(x), cv::saturate_cast<_Tp>(y)); } -#endif -} -CvPoint; - -/** constructs CvPoint structure. */ -CV_INLINE CvPoint cvPoint( int x, int y ) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvPoint p = {x, y}; -#else - CvPoint p(x, y); -#endif - return p; -} -#ifdef __cplusplus -CV_INLINE CvPoint cvPoint(const cv::Point& pt) { return cvPoint(pt.x, pt.y); } -#endif - -typedef struct CvPoint2D32f -{ - float x; - float y; - -#ifdef CV__VALIDATE_UNUNITIALIZED_VARS - CvPoint2D32f() __attribute__(( warning("Non-initialized variable") )) {} - template CvPoint2D32f(const std::initializer_list<_Tp> list) - { - CV_Assert(list.size() == 0 || list.size() == 2); - x = y = 0; - if (list.size() == 2) - { - x = list.begin()[0]; y = list.begin()[1]; - } - }; -#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) - CvPoint2D32f(float _x = 0, float _y = 0): x(_x), y(_y) {} - template - CvPoint2D32f(const cv::Point_<_Tp>& pt): x((float)pt.x), y((float)pt.y) {} -#endif -#ifdef __cplusplus - template - operator cv::Point_<_Tp>() const { return cv::Point_<_Tp>(cv::saturate_cast<_Tp>(x), cv::saturate_cast<_Tp>(y)); } -#endif -} -CvPoint2D32f; - -/** constructs CvPoint2D32f structure. */ -CV_INLINE CvPoint2D32f cvPoint2D32f( double x, double y ) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvPoint2D32f p = { (float)x, (float)y }; -#else - CvPoint2D32f p((float)x, (float)y); -#endif - return p; -} - -#ifdef __cplusplus -template -CvPoint2D32f cvPoint2D32f(const cv::Point_<_Tp>& pt) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvPoint2D32f p = { (float)pt.x, (float)pt.y }; -#else - CvPoint2D32f p((float)pt.x, (float)pt.y); -#endif - return p; -} -#endif - -/** converts CvPoint to CvPoint2D32f. */ -CV_INLINE CvPoint2D32f cvPointTo32f( CvPoint point ) -{ - return cvPoint2D32f( (float)point.x, (float)point.y ); -} - -/** converts CvPoint2D32f to CvPoint. */ -CV_INLINE CvPoint cvPointFrom32f( CvPoint2D32f point ) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvPoint ipt = { cvRound(point.x), cvRound(point.y) }; -#else - CvPoint ipt(cvRound(point.x), cvRound(point.y)); -#endif - return ipt; -} - - -typedef struct CvPoint3D32f -{ - float x; - float y; - float z; - -#ifdef CV__VALIDATE_UNUNITIALIZED_VARS - CvPoint3D32f() __attribute__(( warning("Non-initialized variable") )) {} - template CvPoint3D32f(const std::initializer_list<_Tp> list) - { - CV_Assert(list.size() == 0 || list.size() == 3); - x = y = z = 0; - if (list.size() == 3) - { - x = list.begin()[0]; y = list.begin()[1]; z = list.begin()[2]; - } - }; -#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) - CvPoint3D32f(float _x = 0, float _y = 0, float _z = 0): x(_x), y(_y), z(_z) {} - template - CvPoint3D32f(const cv::Point3_<_Tp>& pt): x((float)pt.x), y((float)pt.y), z((float)pt.z) {} -#endif -#ifdef __cplusplus - template - operator cv::Point3_<_Tp>() const { return cv::Point3_<_Tp>(cv::saturate_cast<_Tp>(x), cv::saturate_cast<_Tp>(y), cv::saturate_cast<_Tp>(z)); } -#endif -} -CvPoint3D32f; - -/** constructs CvPoint3D32f structure. */ -CV_INLINE CvPoint3D32f cvPoint3D32f( double x, double y, double z ) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvPoint3D32f p = { (float)x, (float)y, (float)z }; -#else - CvPoint3D32f p((float)x, (float)y, (float)z); -#endif - return p; -} - -#ifdef __cplusplus -template -CvPoint3D32f cvPoint3D32f(const cv::Point3_<_Tp>& pt) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvPoint3D32f p = { (float)pt.x, (float)pt.y, (float)pt.z }; -#else - CvPoint3D32f p((float)pt.x, (float)pt.y, (float)pt.z); -#endif - return p; -} -#endif - - -typedef struct CvPoint2D64f -{ - double x; - double y; -#ifdef CV__VALIDATE_UNUNITIALIZED_VARS - CvPoint2D64f() __attribute__(( warning("Non-initialized variable") )) {} - template CvPoint2D64f(const std::initializer_list<_Tp> list) - { - CV_Assert(list.size() == 0 || list.size() == 2); - x = y = 0; - if (list.size() == 2) - { - x = list.begin()[0]; y = list.begin()[1]; - } - }; -#endif -} -CvPoint2D64f; - -/** constructs CvPoint2D64f structure.*/ -CV_INLINE CvPoint2D64f cvPoint2D64f( double x, double y ) -{ - CvPoint2D64f p = { x, y }; - return p; -} - - -typedef struct CvPoint3D64f -{ - double x; - double y; - double z; -#ifdef CV__VALIDATE_UNUNITIALIZED_VARS - CvPoint3D64f() __attribute__(( warning("Non-initialized variable") )) {} - template CvPoint3D64f(const std::initializer_list<_Tp> list) - { - CV_Assert(list.size() == 0 || list.size() == 3); - x = y = z = 0; - if (list.size() == 3) - { - x = list.begin()[0]; y = list.begin()[1]; z = list.begin()[2]; - } - }; -#endif -} -CvPoint3D64f; - -/** constructs CvPoint3D64f structure. */ -CV_INLINE CvPoint3D64f cvPoint3D64f( double x, double y, double z ) -{ - CvPoint3D64f p = { x, y, z }; - return p; -} - - -/******************************** CvSize's & CvBox **************************************/ - -typedef struct CvSize -{ - int width; - int height; - -#ifdef CV__VALIDATE_UNUNITIALIZED_VARS - CvSize() __attribute__(( warning("Non-initialized variable") )) {} - template CvSize(const std::initializer_list<_Tp> list) - { - CV_Assert(list.size() == 0 || list.size() == 2); - width = 0; height = 0; - if (list.size() == 2) - { - width = list.begin()[0]; height = list.begin()[1]; - } - }; -#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) - CvSize(int w = 0, int h = 0): width(w), height(h) {} - template - CvSize(const cv::Size_<_Tp>& sz): width(cv::saturate_cast(sz.width)), height(cv::saturate_cast(sz.height)) {} -#endif -#ifdef __cplusplus - template - operator cv::Size_<_Tp>() const { return cv::Size_<_Tp>(cv::saturate_cast<_Tp>(width), cv::saturate_cast<_Tp>(height)); } -#endif -} -CvSize; - -/** constructs CvSize structure. */ -CV_INLINE CvSize cvSize( int width, int height ) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvSize s = { width, height }; -#else - CvSize s(width, height); -#endif - return s; -} - -#ifdef __cplusplus -CV_INLINE CvSize cvSize(const cv::Size& sz) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvSize s = { sz.width, sz.height }; -#else - CvSize s(sz.width, sz.height); -#endif - return s; -} -#endif - -typedef struct CvSize2D32f -{ - float width; - float height; - -#ifdef CV__VALIDATE_UNUNITIALIZED_VARS - CvSize2D32f() __attribute__(( warning("Non-initialized variable") )) {} - template CvSize2D32f(const std::initializer_list<_Tp> list) - { - CV_Assert(list.size() == 0 || list.size() == 2); - width = 0; height = 0; - if (list.size() == 2) - { - width = list.begin()[0]; height = list.begin()[1]; - } - }; -#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) - CvSize2D32f(float w = 0, float h = 0): width(w), height(h) {} - template - CvSize2D32f(const cv::Size_<_Tp>& sz): width(cv::saturate_cast(sz.width)), height(cv::saturate_cast(sz.height)) {} -#endif -#ifdef __cplusplus - template - operator cv::Size_<_Tp>() const { return cv::Size_<_Tp>(cv::saturate_cast<_Tp>(width), cv::saturate_cast<_Tp>(height)); } -#endif -} -CvSize2D32f; - -/** constructs CvSize2D32f structure. */ -CV_INLINE CvSize2D32f cvSize2D32f( double width, double height ) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvSize2D32f s = { (float)width, (float)height }; -#else - CvSize2D32f s((float)width, (float)height); -#endif - return s; -} -#ifdef __cplusplus -template -CvSize2D32f cvSize2D32f(const cv::Size_<_Tp>& sz) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvSize2D32f s = { (float)sz.width, (float)sz.height }; -#else - CvSize2D32f s((float)sz.width, (float)sz.height); -#endif - return s; -} -#endif - -/** @sa RotatedRect - */ -typedef struct CvBox2D -{ - CvPoint2D32f center; /**< Center of the box. */ - CvSize2D32f size; /**< Box width and length. */ - float angle; /**< Angle between the horizontal axis */ - /**< and the first side (i.e. length) in degrees */ - -#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) - CvBox2D(CvPoint2D32f c = CvPoint2D32f(), CvSize2D32f s = CvSize2D32f(), float a = 0) : center(c), size(s), angle(a) {} - CvBox2D(const cv::RotatedRect& rr) : center(rr.center), size(rr.size), angle(rr.angle) {} -#endif -#ifdef __cplusplus - operator cv::RotatedRect() const { return cv::RotatedRect(center, size, angle); } -#endif -} -CvBox2D; - - -#ifdef __cplusplus -CV_INLINE CvBox2D cvBox2D(CvPoint2D32f c = CvPoint2D32f(), CvSize2D32f s = CvSize2D32f(), float a = 0) -{ - CvBox2D self; - self.center = c; - self.size = s; - self.angle = a; - return self; -} -CV_INLINE CvBox2D cvBox2D(const cv::RotatedRect& rr) -{ - CvBox2D self; - self.center = cvPoint2D32f(rr.center); - self.size = cvSize2D32f(rr.size); - self.angle = rr.angle; - return self; -} -#endif - - -/** Line iterator state: */ -typedef struct CvLineIterator -{ - /** Pointer to the current point: */ - uchar* ptr; - - /* Bresenham algorithm state: */ - int err; - int plus_delta; - int minus_delta; - int plus_step; - int minus_step; -} -CvLineIterator; - - - -/************************************* CvSlice ******************************************/ -#define CV_WHOLE_SEQ_END_INDEX 0x3fffffff -#define CV_WHOLE_SEQ cvSlice(0, CV_WHOLE_SEQ_END_INDEX) - -typedef struct CvSlice -{ - int start_index, end_index; - -#ifdef CV__VALIDATE_UNUNITIALIZED_VARS - CvSlice() __attribute__(( warning("Non-initialized variable") )) {} - template CvSlice(const std::initializer_list<_Tp> list) - { - CV_Assert(list.size() == 0 || list.size() == 2); - start_index = end_index = 0; - if (list.size() == 2) - { - start_index = list.begin()[0]; end_index = list.begin()[1]; - } - }; -#endif -#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) && !defined(__CUDACC__) - CvSlice(int start = 0, int end = 0) : start_index(start), end_index(end) {} - CvSlice(const cv::Range& r) { *this = (r.start != INT_MIN && r.end != INT_MAX) ? CvSlice(r.start, r.end) : CvSlice(0, CV_WHOLE_SEQ_END_INDEX); } - operator cv::Range() const { return (start_index == 0 && end_index == CV_WHOLE_SEQ_END_INDEX ) ? cv::Range::all() : cv::Range(start_index, end_index); } -#endif -} -CvSlice; - -CV_INLINE CvSlice cvSlice( int start, int end ) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) && !defined(__CUDACC__)) - CvSlice slice = { start, end }; -#else - CvSlice slice(start, end); -#endif - return slice; -} - -#if defined(__cplusplus) -CV_INLINE CvSlice cvSlice(const cv::Range& r) -{ - CvSlice slice = (r.start != INT_MIN && r.end != INT_MAX) ? cvSlice(r.start, r.end) : cvSlice(0, CV_WHOLE_SEQ_END_INDEX); - return slice; -} -#endif - - -/************************************* CvScalar *****************************************/ -/** @sa Scalar_ - */ -typedef struct CvScalar -{ - double val[4]; - -#ifdef CV__VALIDATE_UNUNITIALIZED_VARS - CvScalar() __attribute__(( warning("Non-initialized variable") )) {} - CvScalar(const std::initializer_list list) - { - CV_Assert(list.size() == 0 || list.size() == 4); - val[0] = val[1] = val[2] = val[3] = 0; - if (list.size() == 4) - { - val[0] = list.begin()[0]; val[1] = list.begin()[1]; val[2] = list.begin()[2]; val[3] = list.begin()[3]; - } - }; -#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) - CvScalar() {} - CvScalar(double d0, double d1 = 0, double d2 = 0, double d3 = 0) { val[0] = d0; val[1] = d1; val[2] = d2; val[3] = d3; } - template - CvScalar(const cv::Scalar_<_Tp>& s) { val[0] = s.val[0]; val[1] = s.val[1]; val[2] = s.val[2]; val[3] = s.val[3]; } - template - CvScalar(const cv::Vec<_Tp, cn>& v) - { - int i; - for( i = 0; i < (cn < 4 ? cn : 4); i++ ) val[i] = v.val[i]; - for( ; i < 4; i++ ) val[i] = 0; - } -#endif -#ifdef __cplusplus - template - operator cv::Scalar_<_Tp>() const { return cv::Scalar_<_Tp>(cv::saturate_cast<_Tp>(val[0]), cv::saturate_cast<_Tp>(val[1]), cv::saturate_cast<_Tp>(val[2]), cv::saturate_cast<_Tp>(val[3])); } -#endif -} -CvScalar; - -CV_INLINE CvScalar cvScalar( double val0, double val1 CV_DEFAULT(0), - double val2 CV_DEFAULT(0), double val3 CV_DEFAULT(0)) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvScalar scalar = CV_STRUCT_INITIALIZER; -#else - CvScalar scalar; -#endif - scalar.val[0] = val0; scalar.val[1] = val1; - scalar.val[2] = val2; scalar.val[3] = val3; - return scalar; -} - -#ifdef __cplusplus -CV_INLINE CvScalar cvScalar() -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvScalar scalar = CV_STRUCT_INITIALIZER; -#else - CvScalar scalar; -#endif - scalar.val[0] = scalar.val[1] = scalar.val[2] = scalar.val[3] = 0; - return scalar; -} -CV_INLINE CvScalar cvScalar(const cv::Scalar& s) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvScalar scalar = CV_STRUCT_INITIALIZER; -#else - CvScalar scalar; -#endif - scalar.val[0] = s.val[0]; - scalar.val[1] = s.val[1]; - scalar.val[2] = s.val[2]; - scalar.val[3] = s.val[3]; - return scalar; -} -#endif - -CV_INLINE CvScalar cvRealScalar( double val0 ) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvScalar scalar = CV_STRUCT_INITIALIZER; -#else - CvScalar scalar; -#endif - scalar.val[0] = val0; - scalar.val[1] = scalar.val[2] = scalar.val[3] = 0; - return scalar; -} - -CV_INLINE CvScalar cvScalarAll( double val0123 ) -{ -#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)) - CvScalar scalar = CV_STRUCT_INITIALIZER; -#else - CvScalar scalar; -#endif - scalar.val[0] = val0123; - scalar.val[1] = val0123; - scalar.val[2] = val0123; - scalar.val[3] = val0123; - return scalar; -} - -/****************************************************************************************\ -* Dynamic Data structures * -\****************************************************************************************/ - -/******************************** Memory storage ****************************************/ - -typedef struct CvMemBlock -{ - struct CvMemBlock* prev; - struct CvMemBlock* next; -} -CvMemBlock; - -#define CV_STORAGE_MAGIC_VAL 0x42890000 - -typedef struct CvMemStorage -{ - int signature; - CvMemBlock* bottom; /**< First allocated block. */ - CvMemBlock* top; /**< Current memory block - top of the stack. */ - struct CvMemStorage* parent; /**< We get new blocks from parent as needed. */ - int block_size; /**< Block size. */ - int free_space; /**< Remaining free space in current block. */ -} -CvMemStorage; - -#define CV_IS_STORAGE(storage) \ - ((storage) != NULL && \ - (((CvMemStorage*)(storage))->signature & CV_MAGIC_MASK) == CV_STORAGE_MAGIC_VAL) - - -typedef struct CvMemStoragePos -{ - CvMemBlock* top; - int free_space; -} -CvMemStoragePos; - - -/*********************************** Sequence *******************************************/ - -typedef struct CvSeqBlock -{ - struct CvSeqBlock* prev; /**< Previous sequence block. */ - struct CvSeqBlock* next; /**< Next sequence block. */ - int start_index; /**< Index of the first element in the block + */ - /**< sequence->first->start_index. */ - int count; /**< Number of elements in the block. */ - schar* data; /**< Pointer to the first element of the block. */ -} -CvSeqBlock; - - -#define CV_TREE_NODE_FIELDS(node_type) \ - int flags; /**< Miscellaneous flags. */ \ - int header_size; /**< Size of sequence header. */ \ - struct node_type* h_prev; /**< Previous sequence. */ \ - struct node_type* h_next; /**< Next sequence. */ \ - struct node_type* v_prev; /**< 2nd previous sequence. */ \ - struct node_type* v_next /**< 2nd next sequence. */ - -/** - Read/Write sequence. - Elements can be dynamically inserted to or deleted from the sequence. -*/ -#define CV_SEQUENCE_FIELDS() \ - CV_TREE_NODE_FIELDS(CvSeq); \ - int total; /**< Total number of elements. */ \ - int elem_size; /**< Size of sequence element in bytes. */ \ - schar* block_max; /**< Maximal bound of the last block. */ \ - schar* ptr; /**< Current write pointer. */ \ - int delta_elems; /**< Grow seq this many at a time. */ \ - CvMemStorage* storage; /**< Where the seq is stored. */ \ - CvSeqBlock* free_blocks; /**< Free blocks list. */ \ - CvSeqBlock* first; /**< Pointer to the first sequence block. */ - -typedef struct CvSeq -{ - CV_SEQUENCE_FIELDS() -} -CvSeq; - -#define CV_TYPE_NAME_SEQ "opencv-sequence" -#define CV_TYPE_NAME_SEQ_TREE "opencv-sequence-tree" - -/*************************************** Set ********************************************/ -/** @brief Set - Order is not preserved. There can be gaps between sequence elements. - After the element has been inserted it stays in the same place all the time. - The MSB(most-significant or sign bit) of the first field (flags) is 0 iff the element exists. -*/ -#define CV_SET_ELEM_FIELDS(elem_type) \ - int flags; \ - struct elem_type* next_free; - -typedef struct CvSetElem -{ - CV_SET_ELEM_FIELDS(CvSetElem) -} -CvSetElem; - -#define CV_SET_FIELDS() \ - CV_SEQUENCE_FIELDS() \ - CvSetElem* free_elems; \ - int active_count; - -typedef struct CvSet -{ - CV_SET_FIELDS() -} -CvSet; - - -#define CV_SET_ELEM_IDX_MASK ((1 << 26) - 1) -#define CV_SET_ELEM_FREE_FLAG (1 << (sizeof(int)*8-1)) - -/** Checks whether the element pointed by ptr belongs to a set or not */ -#define CV_IS_SET_ELEM( ptr ) (((CvSetElem*)(ptr))->flags >= 0) - -/************************************* Graph ********************************************/ - -/** @name Graph - -We represent a graph as a set of vertices. Vertices contain their adjacency lists (more exactly, -pointers to first incoming or outcoming edge (or 0 if isolated vertex)). Edges are stored in -another set. There is a singly-linked list of incoming/outcoming edges for each vertex. - -Each edge consists of: - -- Two pointers to the starting and ending vertices (vtx[0] and vtx[1] respectively). - - A graph may be oriented or not. In the latter case, edges between vertex i to vertex j are not -distinguished during search operations. - -- Two pointers to next edges for the starting and ending vertices, where next[0] points to the -next edge in the vtx[0] adjacency list and next[1] points to the next edge in the vtx[1] -adjacency list. - -@see CvGraphEdge, CvGraphVtx, CvGraphVtx2D, CvGraph -@{ -*/ -#define CV_GRAPH_EDGE_FIELDS() \ - int flags; \ - float weight; \ - struct CvGraphEdge* next[2]; \ - struct CvGraphVtx* vtx[2]; - - -#define CV_GRAPH_VERTEX_FIELDS() \ - int flags; \ - struct CvGraphEdge* first; - - -typedef struct CvGraphEdge -{ - CV_GRAPH_EDGE_FIELDS() -} -CvGraphEdge; - -typedef struct CvGraphVtx -{ - CV_GRAPH_VERTEX_FIELDS() -} -CvGraphVtx; - -typedef struct CvGraphVtx2D -{ - CV_GRAPH_VERTEX_FIELDS() - CvPoint2D32f* ptr; -} -CvGraphVtx2D; - -/** - Graph is "derived" from the set (this is set a of vertices) - and includes another set (edges) -*/ -#define CV_GRAPH_FIELDS() \ - CV_SET_FIELDS() \ - CvSet* edges; - -typedef struct CvGraph -{ - CV_GRAPH_FIELDS() -} -CvGraph; - -#define CV_TYPE_NAME_GRAPH "opencv-graph" - -/** @} */ - -/*********************************** Chain/Contour *************************************/ - -typedef struct CvChain -{ - CV_SEQUENCE_FIELDS() - CvPoint origin; -} -CvChain; - -#define CV_CONTOUR_FIELDS() \ - CV_SEQUENCE_FIELDS() \ - CvRect rect; \ - int color; \ - int reserved[3]; - -typedef struct CvContour -{ - CV_CONTOUR_FIELDS() -} -CvContour; - -typedef CvContour CvPoint2DSeq; - -/****************************************************************************************\ -* Sequence types * -\****************************************************************************************/ - -#define CV_SEQ_MAGIC_VAL 0x42990000 - -#define CV_IS_SEQ(seq) \ - ((seq) != NULL && (((CvSeq*)(seq))->flags & CV_MAGIC_MASK) == CV_SEQ_MAGIC_VAL) - -#define CV_SET_MAGIC_VAL 0x42980000 -#define CV_IS_SET(set) \ - ((set) != NULL && (((CvSeq*)(set))->flags & CV_MAGIC_MASK) == CV_SET_MAGIC_VAL) - -#define CV_SEQ_ELTYPE_BITS 12 -#define CV_SEQ_ELTYPE_MASK ((1 << CV_SEQ_ELTYPE_BITS) - 1) - -#define CV_SEQ_ELTYPE_POINT CV_32SC2 /**< (x,y) */ -#define CV_SEQ_ELTYPE_CODE CV_8UC1 /**< freeman code: 0..7 */ -#define CV_SEQ_ELTYPE_GENERIC 0 -#define CV_SEQ_ELTYPE_PTR CV_USRTYPE1 -#define CV_SEQ_ELTYPE_PPOINT CV_SEQ_ELTYPE_PTR /**< &(x,y) */ -#define CV_SEQ_ELTYPE_INDEX CV_32SC1 /**< #(x,y) */ -#define CV_SEQ_ELTYPE_GRAPH_EDGE 0 /**< &next_o, &next_d, &vtx_o, &vtx_d */ -#define CV_SEQ_ELTYPE_GRAPH_VERTEX 0 /**< first_edge, &(x,y) */ -#define CV_SEQ_ELTYPE_TRIAN_ATR 0 /**< vertex of the binary tree */ -#define CV_SEQ_ELTYPE_CONNECTED_COMP 0 /**< connected component */ -#define CV_SEQ_ELTYPE_POINT3D CV_32FC3 /**< (x,y,z) */ - -#define CV_SEQ_KIND_BITS 2 -#define CV_SEQ_KIND_MASK (((1 << CV_SEQ_KIND_BITS) - 1)<flags & CV_SEQ_ELTYPE_MASK) -#define CV_SEQ_KIND( seq ) ((seq)->flags & CV_SEQ_KIND_MASK ) - -/** flag checking */ -#define CV_IS_SEQ_INDEX( seq ) ((CV_SEQ_ELTYPE(seq) == CV_SEQ_ELTYPE_INDEX) && \ - (CV_SEQ_KIND(seq) == CV_SEQ_KIND_GENERIC)) - -#define CV_IS_SEQ_CURVE( seq ) (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE) -#define CV_IS_SEQ_CLOSED( seq ) (((seq)->flags & CV_SEQ_FLAG_CLOSED) != 0) -#define CV_IS_SEQ_CONVEX( seq ) 0 -#define CV_IS_SEQ_HOLE( seq ) (((seq)->flags & CV_SEQ_FLAG_HOLE) != 0) -#define CV_IS_SEQ_SIMPLE( seq ) 1 - -/** type checking macros */ -#define CV_IS_SEQ_POINT_SET( seq ) \ - ((CV_SEQ_ELTYPE(seq) == CV_32SC2 || CV_SEQ_ELTYPE(seq) == CV_32FC2)) - -#define CV_IS_SEQ_POINT_SUBSET( seq ) \ - (CV_IS_SEQ_INDEX( seq ) || CV_SEQ_ELTYPE(seq) == CV_SEQ_ELTYPE_PPOINT) - -#define CV_IS_SEQ_POLYLINE( seq ) \ - (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE && CV_IS_SEQ_POINT_SET(seq)) - -#define CV_IS_SEQ_POLYGON( seq ) \ - (CV_IS_SEQ_POLYLINE(seq) && CV_IS_SEQ_CLOSED(seq)) - -#define CV_IS_SEQ_CHAIN( seq ) \ - (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE && (seq)->elem_size == 1) - -#define CV_IS_SEQ_CONTOUR( seq ) \ - (CV_IS_SEQ_CLOSED(seq) && (CV_IS_SEQ_POLYLINE(seq) || CV_IS_SEQ_CHAIN(seq))) - -#define CV_IS_SEQ_CHAIN_CONTOUR( seq ) \ - (CV_IS_SEQ_CHAIN( seq ) && CV_IS_SEQ_CLOSED( seq )) - -#define CV_IS_SEQ_POLYGON_TREE( seq ) \ - (CV_SEQ_ELTYPE (seq) == CV_SEQ_ELTYPE_TRIAN_ATR && \ - CV_SEQ_KIND( seq ) == CV_SEQ_KIND_BIN_TREE ) - -#define CV_IS_GRAPH( seq ) \ - (CV_IS_SET(seq) && CV_SEQ_KIND((CvSet*)(seq)) == CV_SEQ_KIND_GRAPH) - -#define CV_IS_GRAPH_ORIENTED( seq ) \ - (((seq)->flags & CV_GRAPH_FLAG_ORIENTED) != 0) - -#define CV_IS_SUBDIV2D( seq ) \ - (CV_IS_SET(seq) && CV_SEQ_KIND((CvSet*)(seq)) == CV_SEQ_KIND_SUBDIV2D) - -/****************************************************************************************/ -/* Sequence writer & reader */ -/****************************************************************************************/ - -#define CV_SEQ_WRITER_FIELDS() \ - int header_size; \ - CvSeq* seq; /**< the sequence written */ \ - CvSeqBlock* block; /**< current block */ \ - schar* ptr; /**< pointer to free space */ \ - schar* block_min; /**< pointer to the beginning of block*/\ - schar* block_max; /**< pointer to the end of block */ - -typedef struct CvSeqWriter -{ - CV_SEQ_WRITER_FIELDS() -} -CvSeqWriter; - - -#define CV_SEQ_READER_FIELDS() \ - int header_size; \ - CvSeq* seq; /**< sequence, beign read */ \ - CvSeqBlock* block; /**< current block */ \ - schar* ptr; /**< pointer to element be read next */ \ - schar* block_min; /**< pointer to the beginning of block */\ - schar* block_max; /**< pointer to the end of block */ \ - int delta_index;/**< = seq->first->start_index */ \ - schar* prev_elem; /**< pointer to previous element */ - -typedef struct CvSeqReader -{ - CV_SEQ_READER_FIELDS() -} -CvSeqReader; - -/****************************************************************************************/ -/* Operations on sequences */ -/****************************************************************************************/ - -#define CV_SEQ_ELEM( seq, elem_type, index ) \ -/** assert gives some guarantee that parameter is valid */ \ -( assert(sizeof((seq)->first[0]) == sizeof(CvSeqBlock) && \ - (seq)->elem_size == sizeof(elem_type)), \ - (elem_type*)((seq)->first && (unsigned)index < \ - (unsigned)((seq)->first->count) ? \ - (seq)->first->data + (index) * sizeof(elem_type) : \ - cvGetSeqElem( (CvSeq*)(seq), (index) ))) -#define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM( (seq), elem_type, (index) ) - -/** Add element to sequence: */ -#define CV_WRITE_SEQ_ELEM_VAR( elem_ptr, writer ) \ -{ \ - if( (writer).ptr >= (writer).block_max ) \ - { \ - cvCreateSeqBlock( &writer); \ - } \ - memcpy((writer).ptr, elem_ptr, (writer).seq->elem_size);\ - (writer).ptr += (writer).seq->elem_size; \ -} - -#define CV_WRITE_SEQ_ELEM( elem, writer ) \ -{ \ - assert( (writer).seq->elem_size == sizeof(elem)); \ - if( (writer).ptr >= (writer).block_max ) \ - { \ - cvCreateSeqBlock( &writer); \ - } \ - assert( (writer).ptr <= (writer).block_max - sizeof(elem));\ - memcpy((writer).ptr, &(elem), sizeof(elem)); \ - (writer).ptr += sizeof(elem); \ -} - - -/** Move reader position forward: */ -#define CV_NEXT_SEQ_ELEM( elem_size, reader ) \ -{ \ - if( ((reader).ptr += (elem_size)) >= (reader).block_max ) \ - { \ - cvChangeSeqBlock( &(reader), 1 ); \ - } \ -} - - -/** Move reader position backward: */ -#define CV_PREV_SEQ_ELEM( elem_size, reader ) \ -{ \ - if( ((reader).ptr -= (elem_size)) < (reader).block_min ) \ - { \ - cvChangeSeqBlock( &(reader), -1 ); \ - } \ -} - -/** Read element and move read position forward: */ -#define CV_READ_SEQ_ELEM( elem, reader ) \ -{ \ - assert( (reader).seq->elem_size == sizeof(elem)); \ - memcpy( &(elem), (reader).ptr, sizeof((elem))); \ - CV_NEXT_SEQ_ELEM( sizeof(elem), reader ) \ -} - -/** Read element and move read position backward: */ -#define CV_REV_READ_SEQ_ELEM( elem, reader ) \ -{ \ - assert( (reader).seq->elem_size == sizeof(elem)); \ - memcpy(&(elem), (reader).ptr, sizeof((elem))); \ - CV_PREV_SEQ_ELEM( sizeof(elem), reader ) \ -} - - -#define CV_READ_CHAIN_POINT( _pt, reader ) \ -{ \ - (_pt) = (reader).pt; \ - if( (reader).ptr ) \ - { \ - CV_READ_SEQ_ELEM( (reader).code, (reader)); \ - assert( ((reader).code & ~7) == 0 ); \ - (reader).pt.x += (reader).deltas[(int)(reader).code][0]; \ - (reader).pt.y += (reader).deltas[(int)(reader).code][1]; \ - } \ -} - -#define CV_CURRENT_POINT( reader ) (*((CvPoint*)((reader).ptr))) -#define CV_PREV_POINT( reader ) (*((CvPoint*)((reader).prev_elem))) - -#define CV_READ_EDGE( pt1, pt2, reader ) \ -{ \ - assert( sizeof(pt1) == sizeof(CvPoint) && \ - sizeof(pt2) == sizeof(CvPoint) && \ - reader.seq->elem_size == sizeof(CvPoint)); \ - (pt1) = CV_PREV_POINT( reader ); \ - (pt2) = CV_CURRENT_POINT( reader ); \ - (reader).prev_elem = (reader).ptr; \ - CV_NEXT_SEQ_ELEM( sizeof(CvPoint), (reader)); \ -} - -/************ Graph macros ************/ - -/** Return next graph edge for given vertex: */ -#define CV_NEXT_GRAPH_EDGE( edge, vertex ) \ - (assert((edge)->vtx[0] == (vertex) || (edge)->vtx[1] == (vertex)), \ - (edge)->next[(edge)->vtx[1] == (vertex)]) - - - -/****************************************************************************************\ -* Data structures for persistence (a.k.a serialization) functionality * -\****************************************************************************************/ - -/** "black box" file storage */ -typedef struct CvFileStorage CvFileStorage; - -/** Storage flags: */ -#define CV_STORAGE_READ 0 -#define CV_STORAGE_WRITE 1 -#define CV_STORAGE_WRITE_TEXT CV_STORAGE_WRITE -#define CV_STORAGE_WRITE_BINARY CV_STORAGE_WRITE -#define CV_STORAGE_APPEND 2 -#define CV_STORAGE_MEMORY 4 -#define CV_STORAGE_FORMAT_MASK (7<<3) -#define CV_STORAGE_FORMAT_AUTO 0 -#define CV_STORAGE_FORMAT_XML 8 -#define CV_STORAGE_FORMAT_YAML 16 -#define CV_STORAGE_FORMAT_JSON 24 -#define CV_STORAGE_BASE64 64 -#define CV_STORAGE_WRITE_BASE64 (CV_STORAGE_BASE64 | CV_STORAGE_WRITE) - -/** @brief List of attributes. : - -In the current implementation, attributes are used to pass extra parameters when writing user -objects (see cvWrite). XML attributes inside tags are not supported, aside from the object type -specification (type_id attribute). -@see cvAttrList, cvAttrValue - */ -typedef struct CvAttrList -{ - const char** attr; /**< NULL-terminated array of (attribute_name,attribute_value) pairs. */ - struct CvAttrList* next; /**< Pointer to next chunk of the attributes list. */ -} -CvAttrList; - -/** initializes CvAttrList structure */ -CV_INLINE CvAttrList cvAttrList( const char** attr CV_DEFAULT(NULL), - CvAttrList* next CV_DEFAULT(NULL) ) -{ - CvAttrList l; - l.attr = attr; - l.next = next; - - return l; -} - -struct CvTypeInfo; - -#define CV_NODE_NONE 0 -#define CV_NODE_INT 1 -#define CV_NODE_INTEGER CV_NODE_INT -#define CV_NODE_REAL 2 -#define CV_NODE_FLOAT CV_NODE_REAL -#define CV_NODE_STR 3 -#define CV_NODE_STRING CV_NODE_STR -#define CV_NODE_REF 4 /**< not used */ -#define CV_NODE_SEQ 5 -#define CV_NODE_MAP 6 -#define CV_NODE_TYPE_MASK 7 - -#define CV_NODE_TYPE(flags) ((flags) & CV_NODE_TYPE_MASK) - -/** file node flags */ -#define CV_NODE_FLOW 8 /**= CV_NODE_SEQ) -#define CV_NODE_IS_FLOW(flags) (((flags) & CV_NODE_FLOW) != 0) -#define CV_NODE_IS_EMPTY(flags) (((flags) & CV_NODE_EMPTY) != 0) -#define CV_NODE_IS_USER(flags) (((flags) & CV_NODE_USER) != 0) -#define CV_NODE_HAS_NAME(flags) (((flags) & CV_NODE_NAMED) != 0) - -#define CV_NODE_SEQ_SIMPLE 256 -#define CV_NODE_SEQ_IS_SIMPLE(seq) (((seq)->flags & CV_NODE_SEQ_SIMPLE) != 0) - -typedef struct CvString -{ - int len; - char* ptr; -} -CvString; - -/** All the keys (names) of elements in the read file storage - are stored in the hash to speed up the lookup operations: */ -typedef struct CvStringHashNode -{ - unsigned hashval; - CvString str; - struct CvStringHashNode* next; -} -CvStringHashNode; - -typedef struct CvGenericHash CvFileNodeHash; - -/** Basic element of the file storage - scalar or collection: */ -typedef struct CvFileNode -{ - int tag; - struct CvTypeInfo* info; /**< type information - (only for user-defined object, for others it is 0) */ - union - { - double f; /**< scalar floating-point number */ - int i; /**< scalar integer number */ - CvString str; /**< text string */ - CvSeq* seq; /**< sequence (ordered collection of file nodes) */ - CvFileNodeHash* map; /**< map (collection of named file nodes) */ - } data; -} -CvFileNode; - -#ifdef __cplusplus -extern "C" { -#endif -typedef int (CV_CDECL *CvIsInstanceFunc)( const void* struct_ptr ); -typedef void (CV_CDECL *CvReleaseFunc)( void** struct_dblptr ); -typedef void* (CV_CDECL *CvReadFunc)( CvFileStorage* storage, CvFileNode* node ); -typedef void (CV_CDECL *CvWriteFunc)( CvFileStorage* storage, const char* name, - const void* struct_ptr, CvAttrList attributes ); -typedef void* (CV_CDECL *CvCloneFunc)( const void* struct_ptr ); -#ifdef __cplusplus -} -#endif - -/** @brief Type information - -The structure contains information about one of the standard or user-defined types. Instances of the -type may or may not contain a pointer to the corresponding CvTypeInfo structure. In any case, there -is a way to find the type info structure for a given object using the cvTypeOf function. -Alternatively, type info can be found by type name using cvFindType, which is used when an object -is read from file storage. The user can register a new type with cvRegisterType that adds the type -information structure into the beginning of the type list. Thus, it is possible to create -specialized types from generic standard types and override the basic methods. - */ -typedef struct CvTypeInfo -{ - int flags; /**< not used */ - int header_size; /**< sizeof(CvTypeInfo) */ - struct CvTypeInfo* prev; /**< previous registered type in the list */ - struct CvTypeInfo* next; /**< next registered type in the list */ - const char* type_name; /**< type name, written to file storage */ - CvIsInstanceFunc is_instance; /**< checks if the passed object belongs to the type */ - CvReleaseFunc release; /**< releases object (memory etc.) */ - CvReadFunc read; /**< reads object from file storage */ - CvWriteFunc write; /**< writes object to file storage */ - CvCloneFunc clone; /**< creates a copy of the object */ -} -CvTypeInfo; - - -/**** System data types ******/ - -typedef struct CvPluginFuncInfo -{ - void** func_addr; - void* default_func_addr; - const char* func_names; - int search_modules; - int loaded_from; -} -CvPluginFuncInfo; - -typedef struct CvModuleInfo -{ - struct CvModuleInfo* next; - const char* name; - const char* version; - CvPluginFuncInfo* func_tab; -} -CvModuleInfo; - -/** @} */ - -#endif /*OPENCV_CORE_TYPES_H*/ - -/* End of file. */ diff --git a/opencv/include/opencv2/core/utility.hpp b/opencv/include/opencv2/core/utility.hpp deleted file mode 100644 index 7a7158f..0000000 --- a/opencv/include/opencv2/core/utility.hpp +++ /dev/null @@ -1,1358 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2015, Itseez Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_CORE_UTILITY_H -#define OPENCV_CORE_UTILITY_H - -#ifndef __cplusplus -# error utility.hpp header must be compiled as C++ -#endif - -#if defined(check) -# warning Detected Apple 'check' macro definition, it can cause build conflicts. Please, include this header before any Apple headers. -#endif - -#include "opencv2/core.hpp" -#include - -#ifdef CV_CXX11 -#include -#endif - -namespace cv -{ - -#ifdef CV_COLLECT_IMPL_DATA -CV_EXPORTS void setImpl(int flags); // set implementation flags and reset storage arrays -CV_EXPORTS void addImpl(int flag, const char* func = 0); // add implementation and function name to storage arrays -// Get stored implementation flags and functions names arrays -// Each implementation entry correspond to function name entry, so you can find which implementation was executed in which function -CV_EXPORTS int getImpl(std::vector &impl, std::vector &funName); - -CV_EXPORTS bool useCollection(); // return implementation collection state -CV_EXPORTS void setUseCollection(bool flag); // set implementation collection state - -#define CV_IMPL_PLAIN 0x01 // native CPU OpenCV implementation -#define CV_IMPL_OCL 0x02 // OpenCL implementation -#define CV_IMPL_IPP 0x04 // IPP implementation -#define CV_IMPL_MT 0x10 // multithreaded implementation - -#define CV_IMPL_ADD(impl) \ - if(cv::useCollection()) \ - { \ - cv::addImpl(impl, CV_Func); \ - } -#else -#define CV_IMPL_ADD(impl) -#endif - -//! @addtogroup core_utils -//! @{ - -/** @brief Automatically Allocated Buffer Class - - The class is used for temporary buffers in functions and methods. - If a temporary buffer is usually small (a few K's of memory), - but its size depends on the parameters, it makes sense to create a small - fixed-size array on stack and use it if it's large enough. If the required buffer size - is larger than the fixed size, another buffer of sufficient size is allocated dynamically - and released after the processing. Therefore, in typical cases, when the buffer size is small, - there is no overhead associated with malloc()/free(). - At the same time, there is no limit on the size of processed data. - - This is what AutoBuffer does. The template takes 2 parameters - type of the buffer elements and - the number of stack-allocated elements. Here is how the class is used: - - \code - void my_func(const cv::Mat& m) - { - cv::AutoBuffer buf(1000); // create automatic buffer containing 1000 floats - - buf.allocate(m.rows); // if m.rows <= 1000, the pre-allocated buffer is used, - // otherwise the buffer of "m.rows" floats will be allocated - // dynamically and deallocated in cv::AutoBuffer destructor - ... - } - \endcode -*/ -template class AutoBuffer -{ -public: - typedef _Tp value_type; - - //! the default constructor - AutoBuffer(); - //! constructor taking the real buffer size - explicit AutoBuffer(size_t _size); - - //! the copy constructor - AutoBuffer(const AutoBuffer<_Tp, fixed_size>& buf); - //! the assignment operator - AutoBuffer<_Tp, fixed_size>& operator = (const AutoBuffer<_Tp, fixed_size>& buf); - - //! destructor. calls deallocate() - ~AutoBuffer(); - - //! allocates the new buffer of size _size. if the _size is small enough, stack-allocated buffer is used - void allocate(size_t _size); - //! deallocates the buffer if it was dynamically allocated - void deallocate(); - //! resizes the buffer and preserves the content - void resize(size_t _size); - //! returns the current buffer size - size_t size() const; - //! returns pointer to the real buffer, stack-allocated or heap-allocated - inline _Tp* data() { return ptr; } - //! returns read-only pointer to the real buffer, stack-allocated or heap-allocated - inline const _Tp* data() const { return ptr; } - -#if !defined(OPENCV_DISABLE_DEPRECATED_COMPATIBILITY) // use to .data() calls instead - //! returns pointer to the real buffer, stack-allocated or heap-allocated - operator _Tp* () { return ptr; } - //! returns read-only pointer to the real buffer, stack-allocated or heap-allocated - operator const _Tp* () const { return ptr; } -#else - //! returns a reference to the element at specified location. No bounds checking is performed in Release builds. - inline _Tp& operator[] (size_t i) { CV_DbgCheckLT(i, sz, "out of range"); return ptr[i]; } - //! returns a reference to the element at specified location. No bounds checking is performed in Release builds. - inline const _Tp& operator[] (size_t i) const { CV_DbgCheckLT(i, sz, "out of range"); return ptr[i]; } -#endif - -protected: - //! pointer to the real buffer, can point to buf if the buffer is small enough - _Tp* ptr; - //! size of the real buffer - size_t sz; - //! pre-allocated buffer. At least 1 element to confirm C++ standard requirements - _Tp buf[(fixed_size > 0) ? fixed_size : 1]; -}; - -/** @brief Sets/resets the break-on-error mode. - -When the break-on-error mode is set, the default error handler issues a hardware exception, which -can make debugging more convenient. - -\return the previous state - */ -CV_EXPORTS bool setBreakOnError(bool flag); - -extern "C" typedef int (*ErrorCallback)( int status, const char* func_name, - const char* err_msg, const char* file_name, - int line, void* userdata ); - - -/** @brief Sets the new error handler and the optional user data. - - The function sets the new error handler, called from cv::error(). - - \param errCallback the new error handler. If NULL, the default error handler is used. - \param userdata the optional user data pointer, passed to the callback. - \param prevUserdata the optional output parameter where the previous user data pointer is stored - - \return the previous error handler -*/ -CV_EXPORTS ErrorCallback redirectError( ErrorCallback errCallback, void* userdata=0, void** prevUserdata=0); - -CV_EXPORTS String tempfile( const char* suffix = 0); -CV_EXPORTS void glob(String pattern, std::vector& result, bool recursive = false); - -/** @brief OpenCV will try to set the number of threads for the next parallel region. - -If threads == 0, OpenCV will disable threading optimizations and run all it's functions -sequentially. Passing threads \< 0 will reset threads number to system default. This function must -be called outside of parallel region. - -OpenCV will try to run its functions with specified threads number, but some behaviour differs from -framework: -- `TBB` - User-defined parallel constructions will run with the same threads number, if - another is not specified. If later on user creates his own scheduler, OpenCV will use it. -- `OpenMP` - No special defined behaviour. -- `Concurrency` - If threads == 1, OpenCV will disable threading optimizations and run its - functions sequentially. -- `GCD` - Supports only values \<= 0. -- `C=` - No special defined behaviour. -@param nthreads Number of threads used by OpenCV. -@sa getNumThreads, getThreadNum - */ -CV_EXPORTS_W void setNumThreads(int nthreads); - -/** @brief Returns the number of threads used by OpenCV for parallel regions. - -Always returns 1 if OpenCV is built without threading support. - -The exact meaning of return value depends on the threading framework used by OpenCV library: -- `TBB` - The number of threads, that OpenCV will try to use for parallel regions. If there is - any tbb::thread_scheduler_init in user code conflicting with OpenCV, then function returns - default number of threads used by TBB library. -- `OpenMP` - An upper bound on the number of threads that could be used to form a new team. -- `Concurrency` - The number of threads, that OpenCV will try to use for parallel regions. -- `GCD` - Unsupported; returns the GCD thread pool limit (512) for compatibility. -- `C=` - The number of threads, that OpenCV will try to use for parallel regions, if before - called setNumThreads with threads \> 0, otherwise returns the number of logical CPUs, - available for the process. -@sa setNumThreads, getThreadNum - */ -CV_EXPORTS_W int getNumThreads(); - -/** @brief Returns the index of the currently executed thread within the current parallel region. Always -returns 0 if called outside of parallel region. - -@deprecated Current implementation doesn't corresponding to this documentation. - -The exact meaning of the return value depends on the threading framework used by OpenCV library: -- `TBB` - Unsupported with current 4.1 TBB release. Maybe will be supported in future. -- `OpenMP` - The thread number, within the current team, of the calling thread. -- `Concurrency` - An ID for the virtual processor that the current context is executing on (0 - for master thread and unique number for others, but not necessary 1,2,3,...). -- `GCD` - System calling thread's ID. Never returns 0 inside parallel region. -- `C=` - The index of the current parallel task. -@sa setNumThreads, getNumThreads - */ -CV_EXPORTS_W int getThreadNum(); - -/** @brief Returns full configuration time cmake output. - -Returned value is raw cmake output including version control system revision, compiler version, -compiler flags, enabled modules and third party libraries, etc. Output format depends on target -architecture. - */ -CV_EXPORTS_W const String& getBuildInformation(); - -/** @brief Returns library version string - -For example "3.4.1-dev". - -@sa getMajorVersion, getMinorVersion, getRevisionVersion -*/ -CV_EXPORTS_W String getVersionString(); - -/** @brief Returns major library version */ -CV_EXPORTS_W int getVersionMajor(); - -/** @brief Returns minor library version */ -CV_EXPORTS_W int getVersionMinor(); - -/** @brief Returns revision field of the library version */ -CV_EXPORTS_W int getVersionRevision(); - -/** @brief Returns the number of ticks. - -The function returns the number of ticks after the certain event (for example, when the machine was -turned on). It can be used to initialize RNG or to measure a function execution time by reading the -tick count before and after the function call. -@sa getTickFrequency, TickMeter - */ -CV_EXPORTS_W int64 getTickCount(); - -/** @brief Returns the number of ticks per second. - -The function returns the number of ticks per second. That is, the following code computes the -execution time in seconds: -@code - double t = (double)getTickCount(); - // do something ... - t = ((double)getTickCount() - t)/getTickFrequency(); -@endcode -@sa getTickCount, TickMeter - */ -CV_EXPORTS_W double getTickFrequency(); - -/** @brief a Class to measure passing time. - -The class computes passing time by counting the number of ticks per second. That is, the following code computes the -execution time in seconds: -@code -TickMeter tm; -tm.start(); -// do something ... -tm.stop(); -std::cout << tm.getTimeSec(); -@endcode - -It is also possible to compute the average time over multiple runs: -@code -TickMeter tm; -for (int i = 0; i < 100; i++) -{ - tm.start(); - // do something ... - tm.stop(); -} -double average_time = tm.getTimeSec() / tm.getCounter(); -std::cout << "Average time in second per iteration is: " << average_time << std::endl; -@endcode -@sa getTickCount, getTickFrequency -*/ - -class CV_EXPORTS_W TickMeter -{ -public: - //! the default constructor - CV_WRAP TickMeter() - { - reset(); - } - - /** - starts counting ticks. - */ - CV_WRAP void start() - { - startTime = cv::getTickCount(); - } - - /** - stops counting ticks. - */ - CV_WRAP void stop() - { - int64 time = cv::getTickCount(); - if (startTime == 0) - return; - ++counter; - sumTime += (time - startTime); - startTime = 0; - } - - /** - returns counted ticks. - */ - CV_WRAP int64 getTimeTicks() const - { - return sumTime; - } - - /** - returns passed time in microseconds. - */ - CV_WRAP double getTimeMicro() const - { - return getTimeMilli()*1e3; - } - - /** - returns passed time in milliseconds. - */ - CV_WRAP double getTimeMilli() const - { - return getTimeSec()*1e3; - } - - /** - returns passed time in seconds. - */ - CV_WRAP double getTimeSec() const - { - return (double)getTimeTicks() / getTickFrequency(); - } - - /** - returns internal counter value. - */ - CV_WRAP int64 getCounter() const - { - return counter; - } - - /** - resets internal values. - */ - CV_WRAP void reset() - { - startTime = 0; - sumTime = 0; - counter = 0; - } - -private: - int64 counter; - int64 sumTime; - int64 startTime; -}; - -/** @brief output operator -@code -TickMeter tm; -tm.start(); -// do something ... -tm.stop(); -std::cout << tm; -@endcode -*/ - -static inline -std::ostream& operator << (std::ostream& out, const TickMeter& tm) -{ - return out << tm.getTimeSec() << "sec"; -} - -/** @brief Returns the number of CPU ticks. - -The function returns the current number of CPU ticks on some architectures (such as x86, x64, -PowerPC). On other platforms the function is equivalent to getTickCount. It can also be used for -very accurate time measurements, as well as for RNG initialization. Note that in case of multi-CPU -systems a thread, from which getCPUTickCount is called, can be suspended and resumed at another CPU -with its own counter. So, theoretically (and practically) the subsequent calls to the function do -not necessary return the monotonously increasing values. Also, since a modern CPU varies the CPU -frequency depending on the load, the number of CPU clocks spent in some code cannot be directly -converted to time units. Therefore, getTickCount is generally a preferable solution for measuring -execution time. - */ -CV_EXPORTS_W int64 getCPUTickCount(); - -/** @brief Returns true if the specified feature is supported by the host hardware. - -The function returns true if the host hardware supports the specified feature. When user calls -setUseOptimized(false), the subsequent calls to checkHardwareSupport() will return false until -setUseOptimized(true) is called. This way user can dynamically switch on and off the optimized code -in OpenCV. -@param feature The feature of interest, one of cv::CpuFeatures - */ -CV_EXPORTS_W bool checkHardwareSupport(int feature); - -/** @brief Returns feature name by ID - -Returns empty string if feature is not defined -*/ -CV_EXPORTS_W String getHardwareFeatureName(int feature); - -/** @brief Returns list of CPU features enabled during compilation. - -Returned value is a string containing space separated list of CPU features with following markers: - -- no markers - baseline features -- prefix `*` - features enabled in dispatcher -- suffix `?` - features enabled but not available in HW - -Example: `SSE SSE2 SSE3 *SSE4.1 *SSE4.2 *FP16 *AVX *AVX2 *AVX512-SKX?` -*/ -CV_EXPORTS std::string getCPUFeaturesLine(); - -/** @brief Returns the number of logical CPUs available for the process. - */ -CV_EXPORTS_W int getNumberOfCPUs(); - - -/** @brief Aligns a pointer to the specified number of bytes. - -The function returns the aligned pointer of the same type as the input pointer: -\f[\texttt{(_Tp*)(((size_t)ptr + n-1) & -n)}\f] -@param ptr Aligned pointer. -@param n Alignment size that must be a power of two. - */ -template static inline _Tp* alignPtr(_Tp* ptr, int n=(int)sizeof(_Tp)) -{ - CV_DbgAssert((n & (n - 1)) == 0); // n is a power of 2 - return (_Tp*)(((size_t)ptr + n-1) & -n); -} - -/** @brief Aligns a buffer size to the specified number of bytes. - -The function returns the minimum number that is greater than or equal to sz and is divisible by n : -\f[\texttt{(sz + n-1) & -n}\f] -@param sz Buffer size to align. -@param n Alignment size that must be a power of two. - */ -static inline size_t alignSize(size_t sz, int n) -{ - CV_DbgAssert((n & (n - 1)) == 0); // n is a power of 2 - return (sz + n-1) & -n; -} - -/** @brief Integer division with result round up. - -Use this function instead of `ceil((float)a / b)` expressions. - -@sa alignSize -*/ -static inline int divUp(int a, unsigned int b) -{ - CV_DbgAssert(a >= 0); - return (a + b - 1) / b; -} -/** @overload */ -static inline size_t divUp(size_t a, unsigned int b) -{ - return (a + b - 1) / b; -} - -/** @brief Round first value up to the nearest multiple of second value. - -Use this function instead of `ceil((float)a / b) * b` expressions. - -@sa divUp -*/ -static inline int roundUp(int a, unsigned int b) -{ - CV_DbgAssert(a >= 0); - return a + b - 1 - (a + b -1) % b; -} -/** @overload */ -static inline size_t roundUp(size_t a, unsigned int b) -{ - return a + b - 1 - (a + b - 1) % b; -} - -/** @brief Enables or disables the optimized code. - -The function can be used to dynamically turn on and off optimized dispatched code (code that uses SSE4.2, AVX/AVX2, -and other instructions on the platforms that support it). It sets a global flag that is further -checked by OpenCV functions. Since the flag is not checked in the inner OpenCV loops, it is only -safe to call the function on the very top level in your application where you can be sure that no -other OpenCV function is currently executed. - -By default, the optimized code is enabled unless you disable it in CMake. The current status can be -retrieved using useOptimized. -@param onoff The boolean flag specifying whether the optimized code should be used (onoff=true) -or not (onoff=false). - */ -CV_EXPORTS_W void setUseOptimized(bool onoff); - -/** @brief Returns the status of optimized code usage. - -The function returns true if the optimized code is enabled. Otherwise, it returns false. - */ -CV_EXPORTS_W bool useOptimized(); - -static inline size_t getElemSize(int type) { return (size_t)CV_ELEM_SIZE(type); } - -/////////////////////////////// Parallel Primitives ////////////////////////////////// - -/** @brief Base class for parallel data processors -*/ -class CV_EXPORTS ParallelLoopBody -{ -public: - virtual ~ParallelLoopBody(); - virtual void operator() (const Range& range) const = 0; -}; - -/** @brief Parallel data processor -*/ -CV_EXPORTS void parallel_for_(const Range& range, const ParallelLoopBody& body, double nstripes=-1.); - -#ifdef CV_CXX11 -class ParallelLoopBodyLambdaWrapper : public ParallelLoopBody -{ -private: - std::function m_functor; -public: - ParallelLoopBodyLambdaWrapper(std::function functor) : - m_functor(functor) - { } - - virtual void operator() (const cv::Range& range) const CV_OVERRIDE - { - m_functor(range); - } -}; - -inline void parallel_for_(const Range& range, std::function functor, double nstripes=-1.) -{ - parallel_for_(range, ParallelLoopBodyLambdaWrapper(functor), nstripes); -} -#endif - -/////////////////////////////// forEach method of cv::Mat //////////////////////////// -template inline -void Mat::forEach_impl(const Functor& operation) { - if (false) { - operation(*reinterpret_cast<_Tp*>(0), reinterpret_cast(0)); - // If your compiler fails in this line. - // Please check that your functor signature is - // (_Tp&, const int*) <- multi-dimensional - // or (_Tp&, void*) <- in case you don't need current idx. - } - - CV_Assert(this->total() / this->size[this->dims - 1] <= INT_MAX); - const int LINES = static_cast(this->total() / this->size[this->dims - 1]); - - class PixelOperationWrapper :public ParallelLoopBody - { - public: - PixelOperationWrapper(Mat_<_Tp>* const frame, const Functor& _operation) - : mat(frame), op(_operation) {} - virtual ~PixelOperationWrapper(){} - // ! Overloaded virtual operator - // convert range call to row call. - virtual void operator()(const Range &range) const CV_OVERRIDE - { - const int DIMS = mat->dims; - const int COLS = mat->size[DIMS - 1]; - if (DIMS <= 2) { - for (int row = range.start; row < range.end; ++row) { - this->rowCall2(row, COLS); - } - } else { - std::vector idx(DIMS); /// idx is modified in this->rowCall - idx[DIMS - 2] = range.start - 1; - - for (int line_num = range.start; line_num < range.end; ++line_num) { - idx[DIMS - 2]++; - for (int i = DIMS - 2; i >= 0; --i) { - if (idx[i] >= mat->size[i]) { - idx[i - 1] += idx[i] / mat->size[i]; - idx[i] %= mat->size[i]; - continue; // carry-over; - } - else { - break; - } - } - this->rowCall(&idx[0], COLS, DIMS); - } - } - } - private: - Mat_<_Tp>* const mat; - const Functor op; - // ! Call operator for each elements in this row. - inline void rowCall(int* const idx, const int COLS, const int DIMS) const { - int &col = idx[DIMS - 1]; - col = 0; - _Tp* pixel = &(mat->template at<_Tp>(idx)); - - while (col < COLS) { - op(*pixel, const_cast(idx)); - pixel++; col++; - } - col = 0; - } - // ! Call operator for each elements in this row. 2d mat special version. - inline void rowCall2(const int row, const int COLS) const { - union Index{ - int body[2]; - operator const int*() const { - return reinterpret_cast(this); - } - int& operator[](const int i) { - return body[i]; - } - } idx = {{row, 0}}; - // Special union is needed to avoid - // "error: array subscript is above array bounds [-Werror=array-bounds]" - // when call the functor `op` such that access idx[3]. - - _Tp* pixel = &(mat->template at<_Tp>(idx)); - const _Tp* const pixel_end = pixel + COLS; - while(pixel < pixel_end) { - op(*pixel++, static_cast(idx)); - idx[1]++; - } - } - PixelOperationWrapper& operator=(const PixelOperationWrapper &) { - CV_Assert(false); - // We can not remove this implementation because Visual Studio warning C4822. - return *this; - } - }; - - parallel_for_(cv::Range(0, LINES), PixelOperationWrapper(reinterpret_cast*>(this), operation)); -} - -/////////////////////////// Synchronization Primitives /////////////////////////////// - -class CV_EXPORTS Mutex -{ -public: - Mutex(); - ~Mutex(); - Mutex(const Mutex& m); - Mutex& operator = (const Mutex& m); - - void lock(); - bool trylock(); - void unlock(); - - struct Impl; -protected: - Impl* impl; -}; - -class CV_EXPORTS AutoLock -{ -public: - AutoLock(Mutex& m) : mutex(&m) { mutex->lock(); } - ~AutoLock() { mutex->unlock(); } -protected: - Mutex* mutex; -private: - AutoLock(const AutoLock&); - AutoLock& operator = (const AutoLock&); -}; - -// TLS interface -class CV_EXPORTS TLSDataContainer -{ -protected: - TLSDataContainer(); - virtual ~TLSDataContainer(); - - void gatherData(std::vector &data) const; -#if OPENCV_ABI_COMPATIBILITY > 300 - void* getData() const; - void release(); - -private: -#else - void release(); - -public: - void* getData() const; -#endif - virtual void* createDataInstance() const = 0; - virtual void deleteDataInstance(void* pData) const = 0; - - int key_; - -public: - void cleanup(); //! Release created TLS data container objects. It is similar to release() call, but it keeps TLS container valid. -}; - -// Main TLS data class -template -class TLSData : protected TLSDataContainer -{ -public: - inline TLSData() {} - inline ~TLSData() { release(); } // Release key and delete associated data - inline T* get() const { return (T*)getData(); } // Get data associated with key - inline T& getRef() const { T* ptr = (T*)getData(); CV_Assert(ptr); return *ptr; } // Get data associated with key - - // Get data from all threads - inline void gather(std::vector &data) const - { - std::vector &dataVoid = reinterpret_cast&>(data); - gatherData(dataVoid); - } - - inline void cleanup() { TLSDataContainer::cleanup(); } - -private: - virtual void* createDataInstance() const CV_OVERRIDE {return new T;} // Wrapper to allocate data by template - virtual void deleteDataInstance(void* pData) const CV_OVERRIDE {delete (T*)pData;} // Wrapper to release data by template - - // Disable TLS copy operations - TLSData(TLSData &) {} - TLSData& operator =(const TLSData &) {return *this;} -}; - -/** @brief Designed for command line parsing - -The sample below demonstrates how to use CommandLineParser: -@code - CommandLineParser parser(argc, argv, keys); - parser.about("Application name v1.0.0"); - - if (parser.has("help")) - { - parser.printMessage(); - return 0; - } - - int N = parser.get("N"); - double fps = parser.get("fps"); - String path = parser.get("path"); - - use_time_stamp = parser.has("timestamp"); - - String img1 = parser.get(0); - String img2 = parser.get(1); - - int repeat = parser.get(2); - - if (!parser.check()) - { - parser.printErrors(); - return 0; - } -@endcode - -### Keys syntax - -The keys parameter is a string containing several blocks, each one is enclosed in curly braces and -describes one argument. Each argument contains three parts separated by the `|` symbol: - --# argument names is a space-separated list of option synonyms (to mark argument as positional, prefix it with the `@` symbol) --# default value will be used if the argument was not provided (can be empty) --# help message (can be empty) - -For example: - -@code{.cpp} - const String keys = - "{help h usage ? | | print this message }" - "{@image1 | | image1 for compare }" - "{@image2 || image2 for compare }" - "{@repeat |1 | number }" - "{path |. | path to file }" - "{fps | -1.0 | fps for output video }" - "{N count |100 | count of objects }" - "{ts timestamp | | use time stamp }" - ; -} -@endcode - -Note that there are no default values for `help` and `timestamp` so we can check their presence using the `has()` method. -Arguments with default values are considered to be always present. Use the `get()` method in these cases to check their -actual value instead. - -String keys like `get("@image1")` return the empty string `""` by default - even with an empty default value. -Use the special `` default value to enforce that the returned string must not be empty. (like in `get("@image2")`) - -### Usage - -For the described keys: - -@code{.sh} - # Good call (3 positional parameters: image1, image2 and repeat; N is 200, ts is true) - $ ./app -N=200 1.png 2.jpg 19 -ts - - # Bad call - $ ./app -fps=aaa - ERRORS: - Parameter 'fps': can not convert: [aaa] to [double] -@endcode - */ -class CV_EXPORTS CommandLineParser -{ -public: - - /** @brief Constructor - - Initializes command line parser object - - @param argc number of command line arguments (from main()) - @param argv array of command line arguments (from main()) - @param keys string describing acceptable command line parameters (see class description for syntax) - */ - CommandLineParser(int argc, const char* const argv[], const String& keys); - - /** @brief Copy constructor */ - CommandLineParser(const CommandLineParser& parser); - - /** @brief Assignment operator */ - CommandLineParser& operator = (const CommandLineParser& parser); - - /** @brief Destructor */ - ~CommandLineParser(); - - /** @brief Returns application path - - This method returns the path to the executable from the command line (`argv[0]`). - - For example, if the application has been started with such a command: - @code{.sh} - $ ./bin/my-executable - @endcode - this method will return `./bin`. - */ - String getPathToApplication() const; - - /** @brief Access arguments by name - - Returns argument converted to selected type. If the argument is not known or can not be - converted to selected type, the error flag is set (can be checked with @ref check). - - For example, define: - @code{.cpp} - String keys = "{N count||}"; - @endcode - - Call: - @code{.sh} - $ ./my-app -N=20 - # or - $ ./my-app --count=20 - @endcode - - Access: - @code{.cpp} - int N = parser.get("N"); - @endcode - - @param name name of the argument - @param space_delete remove spaces from the left and right of the string - @tparam T the argument will be converted to this type if possible - - @note You can access positional arguments by their `@`-prefixed name: - @code{.cpp} - parser.get("@image"); - @endcode - */ - template - T get(const String& name, bool space_delete = true) const - { - T val = T(); - getByName(name, space_delete, ParamType::type, (void*)&val); - return val; - } - - /** @brief Access positional arguments by index - - Returns argument converted to selected type. Indexes are counted from zero. - - For example, define: - @code{.cpp} - String keys = "{@arg1||}{@arg2||}" - @endcode - - Call: - @code{.sh} - ./my-app abc qwe - @endcode - - Access arguments: - @code{.cpp} - String val_1 = parser.get(0); // returns "abc", arg1 - String val_2 = parser.get(1); // returns "qwe", arg2 - @endcode - - @param index index of the argument - @param space_delete remove spaces from the left and right of the string - @tparam T the argument will be converted to this type if possible - */ - template - T get(int index, bool space_delete = true) const - { - T val = T(); - getByIndex(index, space_delete, ParamType::type, (void*)&val); - return val; - } - - /** @brief Check if field was provided in the command line - - @param name argument name to check - */ - bool has(const String& name) const; - - /** @brief Check for parsing errors - - Returns false if error occurred while accessing the parameters (bad conversion, missing arguments, - etc.). Call @ref printErrors to print error messages list. - */ - bool check() const; - - /** @brief Set the about message - - The about message will be shown when @ref printMessage is called, right before arguments table. - */ - void about(const String& message); - - /** @brief Print help message - - This method will print standard help message containing the about message and arguments description. - - @sa about - */ - void printMessage() const; - - /** @brief Print list of errors occurred - - @sa check - */ - void printErrors() const; - -protected: - void getByName(const String& name, bool space_delete, int type, void* dst) const; - void getByIndex(int index, bool space_delete, int type, void* dst) const; - - struct Impl; - Impl* impl; -}; - -//! @} core_utils - -//! @cond IGNORED - -/////////////////////////////// AutoBuffer implementation //////////////////////////////////////// - -template inline -AutoBuffer<_Tp, fixed_size>::AutoBuffer() -{ - ptr = buf; - sz = fixed_size; -} - -template inline -AutoBuffer<_Tp, fixed_size>::AutoBuffer(size_t _size) -{ - ptr = buf; - sz = fixed_size; - allocate(_size); -} - -template inline -AutoBuffer<_Tp, fixed_size>::AutoBuffer(const AutoBuffer<_Tp, fixed_size>& abuf ) -{ - ptr = buf; - sz = fixed_size; - allocate(abuf.size()); - for( size_t i = 0; i < sz; i++ ) - ptr[i] = abuf.ptr[i]; -} - -template inline AutoBuffer<_Tp, fixed_size>& -AutoBuffer<_Tp, fixed_size>::operator = (const AutoBuffer<_Tp, fixed_size>& abuf) -{ - if( this != &abuf ) - { - deallocate(); - allocate(abuf.size()); - for( size_t i = 0; i < sz; i++ ) - ptr[i] = abuf.ptr[i]; - } - return *this; -} - -template inline -AutoBuffer<_Tp, fixed_size>::~AutoBuffer() -{ deallocate(); } - -template inline void -AutoBuffer<_Tp, fixed_size>::allocate(size_t _size) -{ - if(_size <= sz) - { - sz = _size; - return; - } - deallocate(); - sz = _size; - if(_size > fixed_size) - { - ptr = new _Tp[_size]; - } -} - -template inline void -AutoBuffer<_Tp, fixed_size>::deallocate() -{ - if( ptr != buf ) - { - delete[] ptr; - ptr = buf; - sz = fixed_size; - } -} - -template inline void -AutoBuffer<_Tp, fixed_size>::resize(size_t _size) -{ - if(_size <= sz) - { - sz = _size; - return; - } - size_t i, prevsize = sz, minsize = MIN(prevsize, _size); - _Tp* prevptr = ptr; - - ptr = _size > fixed_size ? new _Tp[_size] : buf; - sz = _size; - - if( ptr != prevptr ) - for( i = 0; i < minsize; i++ ) - ptr[i] = prevptr[i]; - for( i = prevsize; i < _size; i++ ) - ptr[i] = _Tp(); - - if( prevptr != buf ) - delete[] prevptr; -} - -template inline size_t -AutoBuffer<_Tp, fixed_size>::size() const -{ return sz; } - -template<> inline std::string CommandLineParser::get(int index, bool space_delete) const -{ - return get(index, space_delete); -} -template<> inline std::string CommandLineParser::get(const String& name, bool space_delete) const -{ - return get(name, space_delete); -} - -//! @endcond - - -// Basic Node class for tree building -template -class CV_EXPORTS Node -{ -public: - Node() - { - m_pParent = 0; - } - Node(OBJECT& payload) : m_payload(payload) - { - m_pParent = 0; - } - ~Node() - { - removeChilds(); - if (m_pParent) - { - int idx = m_pParent->findChild(this); - if (idx >= 0) - m_pParent->m_childs.erase(m_pParent->m_childs.begin() + idx); - } - } - - Node* findChild(OBJECT& payload) const - { - for(size_t i = 0; i < this->m_childs.size(); i++) - { - if(this->m_childs[i]->m_payload == payload) - return this->m_childs[i]; - } - return NULL; - } - - int findChild(Node *pNode) const - { - for (size_t i = 0; i < this->m_childs.size(); i++) - { - if(this->m_childs[i] == pNode) - return (int)i; - } - return -1; - } - - void addChild(Node *pNode) - { - if(!pNode) - return; - - CV_Assert(pNode->m_pParent == 0); - pNode->m_pParent = this; - this->m_childs.push_back(pNode); - } - - void removeChilds() - { - for(size_t i = 0; i < m_childs.size(); i++) - { - m_childs[i]->m_pParent = 0; // avoid excessive parent vector trimming - delete m_childs[i]; - } - m_childs.clear(); - } - - int getDepth() - { - int count = 0; - Node *pParent = m_pParent; - while(pParent) count++, pParent = pParent->m_pParent; - return count; - } - -public: - OBJECT m_payload; - Node* m_pParent; - std::vector*> m_childs; -}; - -// Instrumentation external interface -namespace instr -{ - -#if !defined OPENCV_ABI_CHECK - -enum TYPE -{ - TYPE_GENERAL = 0, // OpenCV API function, e.g. exported function - TYPE_MARKER, // Information marker - TYPE_WRAPPER, // Wrapper function for implementation - TYPE_FUN, // Simple function call -}; - -enum IMPL -{ - IMPL_PLAIN = 0, - IMPL_IPP, - IMPL_OPENCL, -}; - -struct NodeDataTls -{ - NodeDataTls() - { - m_ticksTotal = 0; - } - uint64 m_ticksTotal; -}; - -class CV_EXPORTS NodeData -{ -public: - NodeData(const char* funName = 0, const char* fileName = NULL, int lineNum = 0, void* retAddress = NULL, bool alwaysExpand = false, cv::instr::TYPE instrType = TYPE_GENERAL, cv::instr::IMPL implType = IMPL_PLAIN); - NodeData(NodeData &ref); - ~NodeData(); - NodeData& operator=(const NodeData&); - - cv::String m_funName; - cv::instr::TYPE m_instrType; - cv::instr::IMPL m_implType; - const char* m_fileName; - int m_lineNum; - void* m_retAddress; - bool m_alwaysExpand; - bool m_funError; - - volatile int m_counter; - volatile uint64 m_ticksTotal; - TLSData m_tls; - int m_threads; - - // No synchronization - double getTotalMs() const { return ((double)m_ticksTotal / cv::getTickFrequency()) * 1000; } - double getMeanMs() const { return (((double)m_ticksTotal/m_counter) / cv::getTickFrequency()) * 1000; } -}; -bool operator==(const NodeData& lhs, const NodeData& rhs); - -typedef Node InstrNode; - -CV_EXPORTS InstrNode* getTrace(); - -#endif // !defined OPENCV_ABI_CHECK - - -CV_EXPORTS bool useInstrumentation(); -CV_EXPORTS void setUseInstrumentation(bool flag); -CV_EXPORTS void resetTrace(); - -enum FLAGS -{ - FLAGS_NONE = 0, - FLAGS_MAPPING = 0x01, - FLAGS_EXPAND_SAME_NAMES = 0x02, -}; - -CV_EXPORTS void setFlags(FLAGS modeFlags); -static inline void setFlags(int modeFlags) { setFlags((FLAGS)modeFlags); } -CV_EXPORTS FLAGS getFlags(); - -} // namespace instr - - -namespace samples { - -//! @addtogroup core_utils_samples -// This section describes utility functions for OpenCV samples. -// -// @note Implementation of these utilities is not thread-safe. -// -//! @{ - -/** @brief Try to find requested data file - -Search directories: - -1. Directories passed via `addSamplesDataSearchPath()` -2. OPENCV_SAMPLES_DATA_PATH_HINT environment variable -3. OPENCV_SAMPLES_DATA_PATH environment variable - If parameter value is not empty and nothing is found then stop searching. -4. Detects build/install path based on: - a. current working directory (CWD) - b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage) -5. Scan `/{,data,samples/data}` directories if build directory is detected or the current directory is in source tree. -6. Scan `/share/OpenCV` directory if install directory is detected. - -@see cv::utils::findDataFile - -@param relative_path Relative path to data file -@param required Specify "file not found" handling. - If true, function prints information message and raises cv::Exception. - If false, function returns empty result -@param silentMode Disables messages -@return Returns path (absolute or relative to the current directory) or empty string if file is not found -*/ -CV_EXPORTS_W cv::String findFile(const cv::String& relative_path, bool required = true, bool silentMode = false); - -CV_EXPORTS_W cv::String findFileOrKeep(const cv::String& relative_path, bool silentMode = false); - -inline cv::String findFileOrKeep(const cv::String& relative_path, bool silentMode) -{ - cv::String res = findFile(relative_path, false, silentMode); - if (res.empty()) - return relative_path; - return res; -} - -/** @brief Override search data path by adding new search location - -Use this only to override default behavior -Passed paths are used in LIFO order. - -@param path Path to used samples data -*/ -CV_EXPORTS_W void addSamplesDataSearchPath(const cv::String& path); - -/** @brief Append samples search data sub directory - -General usage is to add OpenCV modules name (`/modules//samples/data` -> `/samples/data` + `modules//samples/data`). -Passed subdirectories are used in LIFO order. - -@param subdir samples data sub directory -*/ -CV_EXPORTS_W void addSamplesDataSearchSubDirectory(const cv::String& subdir); - -//! @} -} // namespace samples - -namespace utils { - -CV_EXPORTS int getThreadID(); - -} // namespace - -} //namespace cv - -#ifndef DISABLE_OPENCV_24_COMPATIBILITY -#include "opencv2/core/core_c.h" -#endif - -#endif //OPENCV_CORE_UTILITY_H diff --git a/opencv/include/opencv2/core/utils/filesystem.hpp b/opencv/include/opencv2/core/utils/filesystem.hpp deleted file mode 100644 index 00b0dd1..0000000 --- a/opencv/include/opencv2/core/utils/filesystem.hpp +++ /dev/null @@ -1,78 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -#ifndef OPENCV_UTILS_FILESYSTEM_HPP -#define OPENCV_UTILS_FILESYSTEM_HPP - -namespace cv { namespace utils { namespace fs { - - -CV_EXPORTS bool exists(const cv::String& path); -CV_EXPORTS bool isDirectory(const cv::String& path); - -CV_EXPORTS void remove_all(const cv::String& path); - - -CV_EXPORTS cv::String getcwd(); - -/** @brief Converts path p to a canonical absolute path - * Symlinks are processed if there is support for them on running platform. - * - * @param path input path. Target file/directory should exist. - */ -CV_EXPORTS cv::String canonical(const cv::String& path); - -/** Join path components */ -CV_EXPORTS cv::String join(const cv::String& base, const cv::String& path); - -/** - * Generate a list of all files that match the globbing pattern. - * - * Result entries are prefixed by base directory path. - * - * @param directory base directory - * @param pattern filter pattern (based on '*'/'?' symbols). Use empty string to disable filtering and return all results - * @param[out] result result of globing. - * @param recursive scan nested directories too - * @param includeDirectories include directories into results list - */ -CV_EXPORTS void glob(const cv::String& directory, const cv::String& pattern, - CV_OUT std::vector& result, - bool recursive = false, bool includeDirectories = false); - -/** - * Generate a list of all files that match the globbing pattern. - * - * @param directory base directory - * @param pattern filter pattern (based on '*'/'?' symbols). Use empty string to disable filtering and return all results - * @param[out] result globbing result with relative paths from base directory - * @param recursive scan nested directories too - * @param includeDirectories include directories into results list - */ -CV_EXPORTS void glob_relative(const cv::String& directory, const cv::String& pattern, - CV_OUT std::vector& result, - bool recursive = false, bool includeDirectories = false); - - -CV_EXPORTS bool createDirectory(const cv::String& path); -CV_EXPORTS bool createDirectories(const cv::String& path); - -#ifdef __OPENCV_BUILD -// TODO -//CV_EXPORTS cv::String getTempDirectory(); - -/** - * @brief Returns directory to store OpenCV cache files - * Create sub-directory in common OpenCV cache directory if it doesn't exist. - * @param sub_directory_name name of sub-directory. NULL or "" value asks to return root cache directory. - * @param configuration_name optional name of configuration parameter name which overrides default behavior. - * @return Path to cache directory. Returns empty string if cache directories support is not available. Returns "disabled" if cache disabled by user. - */ -CV_EXPORTS cv::String getCacheDirectory(const char* sub_directory_name, const char* configuration_name = NULL); - -#endif - -}}} // namespace - -#endif // OPENCV_UTILS_FILESYSTEM_HPP diff --git a/opencv/include/opencv2/core/utils/logger.defines.hpp b/opencv/include/opencv2/core/utils/logger.defines.hpp deleted file mode 100644 index b2dfc41..0000000 --- a/opencv/include/opencv2/core/utils/logger.defines.hpp +++ /dev/null @@ -1,22 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -#ifndef OPENCV_LOGGER_DEFINES_HPP -#define OPENCV_LOGGER_DEFINES_HPP - -//! @addtogroup core_logging -//! @{ - -// Supported logging levels and their semantic -#define CV_LOG_LEVEL_SILENT 0 //!< for using in setLogLevel() call -#define CV_LOG_LEVEL_FATAL 1 //!< Fatal (critical) error (unrecoverable internal error) -#define CV_LOG_LEVEL_ERROR 2 //!< Error message -#define CV_LOG_LEVEL_WARN 3 //!< Warning message -#define CV_LOG_LEVEL_INFO 4 //!< Info message -#define CV_LOG_LEVEL_DEBUG 5 //!< Debug message. Disabled in the "Release" build. -#define CV_LOG_LEVEL_VERBOSE 6 //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build. - -//! @} - -#endif // OPENCV_LOGGER_DEFINES_HPP diff --git a/opencv/include/opencv2/core/utils/logger.hpp b/opencv/include/opencv2/core/utils/logger.hpp deleted file mode 100644 index 47094f9..0000000 --- a/opencv/include/opencv2/core/utils/logger.hpp +++ /dev/null @@ -1,87 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -#ifndef OPENCV_LOGGER_HPP -#define OPENCV_LOGGER_HPP - -#include -#include -#include // INT_MAX - -#include "logger.defines.hpp" - -//! @addtogroup core_logging -// This section describes OpenCV logging utilities. -// -//! @{ - -namespace cv { -namespace utils { -namespace logging { - -//! Supported logging levels and their semantic -enum LogLevel { - LOG_LEVEL_SILENT = 0, //!< for using in setLogVevel() call - LOG_LEVEL_FATAL = 1, //!< Fatal (critical) error (unrecoverable internal error) - LOG_LEVEL_ERROR = 2, //!< Error message - LOG_LEVEL_WARNING = 3, //!< Warning message - LOG_LEVEL_INFO = 4, //!< Info message - LOG_LEVEL_DEBUG = 5, //!< Debug message. Disabled in the "Release" build. - LOG_LEVEL_VERBOSE = 6, //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build. -#ifndef CV_DOXYGEN - ENUM_LOG_LEVEL_FORCE_INT = INT_MAX -#endif -}; - -/** Set global logging level -@return previous logging level -*/ -CV_EXPORTS LogLevel setLogLevel(LogLevel logLevel); -/** Get global logging level */ -CV_EXPORTS LogLevel getLogLevel(); - -namespace internal { -/** Write log message */ -CV_EXPORTS void writeLogMessage(LogLevel logLevel, const char* message); -} // namespace - -/** - * \def CV_LOG_STRIP_LEVEL - * - * Define CV_LOG_STRIP_LEVEL=CV_LOG_LEVEL_[DEBUG|INFO|WARN|ERROR|FATAL|DISABLED] to compile out anything at that and before that logging level - */ -#ifndef CV_LOG_STRIP_LEVEL -# if defined NDEBUG -# define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_DEBUG -# else -# define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_VERBOSE -# endif -#endif - - -#define CV_LOG_FATAL(tag, ...) for(;;) { if (cv::utils::logging::getLogLevel() < cv::utils::logging::LOG_LEVEL_FATAL) break; std::stringstream ss; ss << __VA_ARGS__; cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LOG_LEVEL_FATAL, ss.str().c_str()); break; } -#define CV_LOG_ERROR(tag, ...) for(;;) { if (cv::utils::logging::getLogLevel() < cv::utils::logging::LOG_LEVEL_ERROR) break; std::stringstream ss; ss << __VA_ARGS__; cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LOG_LEVEL_ERROR, ss.str().c_str()); break; } -#define CV_LOG_WARNING(tag, ...) for(;;) { if (cv::utils::logging::getLogLevel() < cv::utils::logging::LOG_LEVEL_WARNING) break; std::stringstream ss; ss << __VA_ARGS__; cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LOG_LEVEL_WARNING, ss.str().c_str()); break; } -#if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_INFO -#define CV_LOG_INFO(tag, ...) -#else -#define CV_LOG_INFO(tag, ...) for(;;) { if (cv::utils::logging::getLogLevel() < cv::utils::logging::LOG_LEVEL_INFO) break; std::stringstream ss; ss << __VA_ARGS__; cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LOG_LEVEL_INFO, ss.str().c_str()); break; } -#endif -#if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_DEBUG -#define CV_LOG_DEBUG(tag, ...) -#else -#define CV_LOG_DEBUG(tag, ...) for(;;) { if (cv::utils::logging::getLogLevel() < cv::utils::logging::LOG_LEVEL_DEBUG) break; std::stringstream ss; ss << __VA_ARGS__; cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LOG_LEVEL_DEBUG, ss.str().c_str()); break; } -#endif -#if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_VERBOSE -#define CV_LOG_VERBOSE(tag, v, ...) -#else -#define CV_LOG_VERBOSE(tag, v, ...) for(;;) { if (cv::utils::logging::getLogLevel() < cv::utils::logging::LOG_LEVEL_VERBOSE) break; std::stringstream ss; ss << "[VERB" << v << ":" << cv::utils::getThreadID() << "] " << __VA_ARGS__; cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LOG_LEVEL_VERBOSE, ss.str().c_str()); break; } -#endif - - -}}} // namespace - -//! @} - -#endif // OPENCV_LOGGER_HPP diff --git a/opencv/include/opencv2/core/utils/trace.hpp b/opencv/include/opencv2/core/utils/trace.hpp deleted file mode 100644 index 858e973..0000000 --- a/opencv/include/opencv2/core/utils/trace.hpp +++ /dev/null @@ -1,254 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -#ifndef OPENCV_TRACE_HPP -#define OPENCV_TRACE_HPP - -#include - -//! @addtogroup core_logging -// This section describes OpenCV tracing utilities. -// -//! @{ - -namespace cv { -namespace utils { -namespace trace { - -//! Macro to trace function -#define CV_TRACE_FUNCTION() - -#define CV_TRACE_FUNCTION_SKIP_NESTED() - -//! Trace code scope. -//! @note Dynamic names are not supported in this macro (on stack or heap). Use string literals here only, like "initialize". -#define CV_TRACE_REGION(name_as_static_string_literal) -//! mark completed of the current opened region and create new one -//! @note Dynamic names are not supported in this macro (on stack or heap). Use string literals here only, like "step1". -#define CV_TRACE_REGION_NEXT(name_as_static_string_literal) - -//! Macro to trace argument value -#define CV_TRACE_ARG(arg_id) - -//! Macro to trace argument value (expanded version) -#define CV_TRACE_ARG_VALUE(arg_id, arg_name, value) - -//! @cond IGNORED -#define CV_TRACE_NS cv::utils::trace - -#if !defined(OPENCV_DISABLE_TRACE) && defined(__EMSCRIPTEN__) -#define OPENCV_DISABLE_TRACE 1 -#endif - -namespace details { - -#ifndef __OPENCV_TRACE -# if defined __OPENCV_BUILD && !defined __OPENCV_TESTS && !defined __OPENCV_APPS -# define __OPENCV_TRACE 1 -# else -# define __OPENCV_TRACE 0 -# endif -#endif - -#ifndef CV_TRACE_FILENAME -# define CV_TRACE_FILENAME __FILE__ -#endif - -#ifndef CV__TRACE_FUNCTION -# if defined _MSC_VER -# define CV__TRACE_FUNCTION __FUNCSIG__ -# elif defined __GNUC__ -# define CV__TRACE_FUNCTION __PRETTY_FUNCTION__ -# else -# define CV__TRACE_FUNCTION "" -# endif -#endif - -//! Thread-local instance (usually allocated on stack) -class CV_EXPORTS Region -{ -public: - struct LocationExtraData; - struct LocationStaticStorage - { - LocationExtraData** ppExtra; //< implementation specific data - const char* name; //< region name (function name or other custom name) - const char* filename; //< source code filename - int line; //< source code line - int flags; //< flags (implementation code path: Plain, IPP, OpenCL) - }; - - Region(const LocationStaticStorage& location); - inline ~Region() - { - if (implFlags != 0) - destroy(); - CV_DbgAssert(implFlags == 0); - CV_DbgAssert(pImpl == NULL); - } - - class Impl; - Impl* pImpl; // NULL if current region is not active - int implFlags; // see RegionFlag, 0 if region is ignored - - bool isActive() const { return pImpl != NULL; } - - void destroy(); -private: - Region(const Region&); // disabled - Region& operator= (const Region&); // disabled -}; - -//! Specify region flags -enum RegionLocationFlag { - REGION_FLAG_FUNCTION = (1 << 0), //< region is function (=1) / nested named region (=0) - REGION_FLAG_APP_CODE = (1 << 1), //< region is Application code (=1) / OpenCV library code (=0) - REGION_FLAG_SKIP_NESTED = (1 << 2), //< avoid processing of nested regions - - REGION_FLAG_IMPL_IPP = (1 << 16), //< region is part of IPP code path - REGION_FLAG_IMPL_OPENCL = (2 << 16), //< region is part of OpenCL code path - REGION_FLAG_IMPL_OPENVX = (3 << 16), //< region is part of OpenVX code path - - REGION_FLAG_IMPL_MASK = (15 << 16), - - REGION_FLAG_REGION_FORCE = (1 << 30), - REGION_FLAG_REGION_NEXT = (1 << 31), //< close previous region (see #CV_TRACE_REGION_NEXT macro) - - ENUM_REGION_FLAG_FORCE_INT = INT_MAX -}; - -struct CV_EXPORTS TraceArg { -public: - struct ExtraData; - ExtraData** ppExtra; - const char* name; - int flags; -}; -/** @brief Add meta information to current region (function) - * See CV_TRACE_ARG macro - * @param arg argument information structure (global static cache) - * @param value argument value (can by dynamic string literal in case of string, static allocation is not required) - */ -CV_EXPORTS void traceArg(const TraceArg& arg, const char* value); -//! @overload -CV_EXPORTS void traceArg(const TraceArg& arg, int value); -//! @overload -CV_EXPORTS void traceArg(const TraceArg& arg, int64 value); -//! @overload -CV_EXPORTS void traceArg(const TraceArg& arg, double value); - -#define CV__TRACE_LOCATION_VARNAME(loc_id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_trace_location_, loc_id), __LINE__) -#define CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_trace_location_extra_, loc_id) , __LINE__) - -#define CV__TRACE_DEFINE_LOCATION_(loc_id, name, flags) \ - static CV_TRACE_NS::details::Region::LocationExtraData* CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id) = 0; \ - static const CV_TRACE_NS::details::Region::LocationStaticStorage \ - CV__TRACE_LOCATION_VARNAME(loc_id) = { &(CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id)), name, CV_TRACE_FILENAME, __LINE__, flags}; - -#define CV__TRACE_DEFINE_LOCATION_FN(name, flags) CV__TRACE_DEFINE_LOCATION_(fn, name, ((flags) | CV_TRACE_NS::details::REGION_FLAG_FUNCTION)) - - -#define CV__TRACE_OPENCV_FUNCTION() \ - CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, 0); \ - const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn)); - -#define CV__TRACE_OPENCV_FUNCTION_NAME(name) \ - CV__TRACE_DEFINE_LOCATION_FN(name, 0); \ - const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn)); - -#define CV__TRACE_APP_FUNCTION() \ - CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \ - const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn)); - -#define CV__TRACE_APP_FUNCTION_NAME(name) \ - CV__TRACE_DEFINE_LOCATION_FN(name, CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \ - const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn)); - - -#define CV__TRACE_OPENCV_FUNCTION_SKIP_NESTED() \ - CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED); \ - const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn)); - -#define CV__TRACE_OPENCV_FUNCTION_NAME_SKIP_NESTED(name) \ - CV__TRACE_DEFINE_LOCATION_FN(name, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED); \ - const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn)); - -#define CV__TRACE_APP_FUNCTION_SKIP_NESTED() \ - CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED | CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \ - const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn)); - - -#define CV__TRACE_REGION_(name_as_static_string_literal, flags) \ - CV__TRACE_DEFINE_LOCATION_(region, name_as_static_string_literal, flags); \ - CV_TRACE_NS::details::Region CVAUX_CONCAT(__region_, __LINE__)(CV__TRACE_LOCATION_VARNAME(region)); - -#define CV__TRACE_REGION(name_as_static_string_literal) CV__TRACE_REGION_(name_as_static_string_literal, 0) -#define CV__TRACE_REGION_NEXT(name_as_static_string_literal) CV__TRACE_REGION_(name_as_static_string_literal, CV_TRACE_NS::details::REGION_FLAG_REGION_NEXT) - -#define CV__TRACE_ARG_VARNAME(arg_id) CVAUX_CONCAT(__cv_trace_arg_ ## arg_id, __LINE__) -#define CV__TRACE_ARG_EXTRA_VARNAME(arg_id) CVAUX_CONCAT(__cv_trace_arg_extra_ ## arg_id, __LINE__) - -#define CV__TRACE_DEFINE_ARG_(arg_id, name, flags) \ - static CV_TRACE_NS::details::TraceArg::ExtraData* CV__TRACE_ARG_EXTRA_VARNAME(arg_id) = 0; \ - static const CV_TRACE_NS::details::TraceArg \ - CV__TRACE_ARG_VARNAME(arg_id) = { &(CV__TRACE_ARG_EXTRA_VARNAME(arg_id)), name, flags }; - -#define CV__TRACE_ARG_VALUE(arg_id, arg_name, value) \ - CV__TRACE_DEFINE_ARG_(arg_id, arg_name, 0); \ - CV_TRACE_NS::details::traceArg((CV__TRACE_ARG_VARNAME(arg_id)), value); - -#define CV__TRACE_ARG(arg_id) CV_TRACE_ARG_VALUE(arg_id, #arg_id, (arg_id)) - -} // namespace - -#ifndef OPENCV_DISABLE_TRACE -#undef CV_TRACE_FUNCTION -#undef CV_TRACE_FUNCTION_SKIP_NESTED -#if __OPENCV_TRACE -#define CV_TRACE_FUNCTION CV__TRACE_OPENCV_FUNCTION -#define CV_TRACE_FUNCTION_SKIP_NESTED CV__TRACE_OPENCV_FUNCTION_SKIP_NESTED -#else -#define CV_TRACE_FUNCTION CV__TRACE_APP_FUNCTION -#define CV_TRACE_FUNCTION_SKIP_NESTED CV__TRACE_APP_FUNCTION_SKIP_NESTED -#endif - -#undef CV_TRACE_REGION -#define CV_TRACE_REGION CV__TRACE_REGION - -#undef CV_TRACE_REGION_NEXT -#define CV_TRACE_REGION_NEXT CV__TRACE_REGION_NEXT - -#undef CV_TRACE_ARG_VALUE -#define CV_TRACE_ARG_VALUE(arg_id, arg_name, value) \ - if (__region_fn.isActive()) \ - { \ - CV__TRACE_ARG_VALUE(arg_id, arg_name, value); \ - } - -#undef CV_TRACE_ARG -#define CV_TRACE_ARG CV__TRACE_ARG - -#endif // OPENCV_DISABLE_TRACE - -#ifdef OPENCV_TRACE_VERBOSE -#define CV_TRACE_FUNCTION_VERBOSE CV_TRACE_FUNCTION -#define CV_TRACE_REGION_VERBOSE CV_TRACE_REGION -#define CV_TRACE_REGION_NEXT_VERBOSE CV_TRACE_REGION_NEXT -#define CV_TRACE_ARG_VALUE_VERBOSE CV_TRACE_ARG_VALUE -#define CV_TRACE_ARG_VERBOSE CV_TRACE_ARG -#else -#define CV_TRACE_FUNCTION_VERBOSE(...) -#define CV_TRACE_REGION_VERBOSE(...) -#define CV_TRACE_REGION_NEXT_VERBOSE(...) -#define CV_TRACE_ARG_VALUE_VERBOSE(...) -#define CV_TRACE_ARG_VERBOSE(...) -#endif - -//! @endcond - -}}} // namespace - -//! @} - -#endif // OPENCV_TRACE_HPP diff --git a/opencv/include/opencv2/core/va_intel.hpp b/opencv/include/opencv2/core/va_intel.hpp deleted file mode 100644 index f665470..0000000 --- a/opencv/include/opencv2/core/va_intel.hpp +++ /dev/null @@ -1,78 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -// Copyright (C) 2015, Itseez, Inc., all rights reserved. -// Third party copyrights are property of their respective owners. - -#ifndef OPENCV_CORE_VA_INTEL_HPP -#define OPENCV_CORE_VA_INTEL_HPP - -#ifndef __cplusplus -# error va_intel.hpp header must be compiled as C++ -#endif - -#include "opencv2/core.hpp" -#include "ocl.hpp" - -#if defined(HAVE_VA) -# include "va/va.h" -#else // HAVE_VA -# if !defined(_VA_H_) - typedef void* VADisplay; - typedef unsigned int VASurfaceID; -# endif // !_VA_H_ -#endif // HAVE_VA - -namespace cv { namespace va_intel { - -/** @addtogroup core_va_intel -This section describes Intel VA-API/OpenCL (CL-VA) interoperability. - -To enable CL-VA interoperability support, configure OpenCV using CMake with WITH_VA_INTEL=ON . Currently VA-API is -supported on Linux only. You should also install Intel Media Server Studio (MSS) to use this feature. You may -have to specify the path(s) to MSS components for cmake in environment variables: - -- VA_INTEL_IOCL_ROOT for Intel OpenCL (default is "/opt/intel/opencl"). - -To use CL-VA interoperability you should first create VADisplay (libva), and then call initializeContextFromVA() -function to create OpenCL context and set up interoperability. -*/ -//! @{ - -/////////////////// CL-VA Interoperability Functions /////////////////// - -namespace ocl { -using namespace cv::ocl; - -// TODO static functions in the Context class -/** @brief Creates OpenCL context from VA. -@param display - VADisplay for which CL interop should be established. -@param tryInterop - try to set up for interoperability, if true; set up for use slow copy if false. -@return Returns reference to OpenCL Context - */ -CV_EXPORTS Context& initializeContextFromVA(VADisplay display, bool tryInterop = true); - -} // namespace cv::va_intel::ocl - -/** @brief Converts InputArray to VASurfaceID object. -@param display - VADisplay object. -@param src - source InputArray. -@param surface - destination VASurfaceID object. -@param size - size of image represented by VASurfaceID object. - */ -CV_EXPORTS void convertToVASurface(VADisplay display, InputArray src, VASurfaceID surface, Size size); - -/** @brief Converts VASurfaceID object to OutputArray. -@param display - VADisplay object. -@param surface - source VASurfaceID object. -@param size - size of image represented by VASurfaceID object. -@param dst - destination OutputArray. - */ -CV_EXPORTS void convertFromVASurface(VADisplay display, VASurfaceID surface, Size size, OutputArray dst); - -//! @} - -}} // namespace cv::va_intel - -#endif /* OPENCV_CORE_VA_INTEL_HPP */ diff --git a/opencv/include/opencv2/core/version.hpp b/opencv/include/opencv2/core/version.hpp deleted file mode 100644 index fe6df95..0000000 --- a/opencv/include/opencv2/core/version.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -#ifndef OPENCV_VERSION_HPP -#define OPENCV_VERSION_HPP - -#define CV_VERSION_MAJOR 3 -#define CV_VERSION_MINOR 4 -#define CV_VERSION_REVISION 6 -#define CV_VERSION_STATUS "" - -#define CVAUX_STR_EXP(__A) #__A -#define CVAUX_STR(__A) CVAUX_STR_EXP(__A) - -#define CVAUX_STRW_EXP(__A) L ## #__A -#define CVAUX_STRW(__A) CVAUX_STRW_EXP(__A) - -#define CV_VERSION CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) CV_VERSION_STATUS - -/* old style version constants*/ -#define CV_MAJOR_VERSION CV_VERSION_MAJOR -#define CV_MINOR_VERSION CV_VERSION_MINOR -#define CV_SUBMINOR_VERSION CV_VERSION_REVISION - -#endif // OPENCV_VERSION_HPP diff --git a/opencv/include/opencv2/core/vsx_utils.hpp b/opencv/include/opencv2/core/vsx_utils.hpp deleted file mode 100644 index 6e2baea..0000000 --- a/opencv/include/opencv2/core/vsx_utils.hpp +++ /dev/null @@ -1,1013 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html - -#ifndef OPENCV_HAL_VSX_UTILS_HPP -#define OPENCV_HAL_VSX_UTILS_HPP - -#include "opencv2/core/cvdef.h" - -#ifndef SKIP_INCLUDES -# include -#endif - -//! @addtogroup core_utils_vsx -//! @{ -#if CV_VSX - -#define __VSX_S16__(c, v) (c){v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v} -#define __VSX_S8__(c, v) (c){v, v, v, v, v, v, v, v} -#define __VSX_S4__(c, v) (c){v, v, v, v} -#define __VSX_S2__(c, v) (c){v, v} - -typedef __vector unsigned char vec_uchar16; -#define vec_uchar16_set(...) (vec_uchar16){__VA_ARGS__} -#define vec_uchar16_sp(c) (__VSX_S16__(vec_uchar16, (unsigned char)c)) -#define vec_uchar16_c(v) ((vec_uchar16)(v)) -#define vec_uchar16_z vec_uchar16_sp(0) - -typedef __vector signed char vec_char16; -#define vec_char16_set(...) (vec_char16){__VA_ARGS__} -#define vec_char16_sp(c) (__VSX_S16__(vec_char16, (signed char)c)) -#define vec_char16_c(v) ((vec_char16)(v)) -#define vec_char16_z vec_char16_sp(0) - -typedef __vector unsigned short vec_ushort8; -#define vec_ushort8_set(...) (vec_ushort8){__VA_ARGS__} -#define vec_ushort8_sp(c) (__VSX_S8__(vec_ushort8, (unsigned short)c)) -#define vec_ushort8_c(v) ((vec_ushort8)(v)) -#define vec_ushort8_z vec_ushort8_sp(0) - -typedef __vector signed short vec_short8; -#define vec_short8_set(...) (vec_short8){__VA_ARGS__} -#define vec_short8_sp(c) (__VSX_S8__(vec_short8, (signed short)c)) -#define vec_short8_c(v) ((vec_short8)(v)) -#define vec_short8_z vec_short8_sp(0) - -typedef __vector unsigned int vec_uint4; -#define vec_uint4_set(...) (vec_uint4){__VA_ARGS__} -#define vec_uint4_sp(c) (__VSX_S4__(vec_uint4, (unsigned int)c)) -#define vec_uint4_c(v) ((vec_uint4)(v)) -#define vec_uint4_z vec_uint4_sp(0) - -typedef __vector signed int vec_int4; -#define vec_int4_set(...) (vec_int4){__VA_ARGS__} -#define vec_int4_sp(c) (__VSX_S4__(vec_int4, (signed int)c)) -#define vec_int4_c(v) ((vec_int4)(v)) -#define vec_int4_z vec_int4_sp(0) - -typedef __vector float vec_float4; -#define vec_float4_set(...) (vec_float4){__VA_ARGS__} -#define vec_float4_sp(c) (__VSX_S4__(vec_float4, c)) -#define vec_float4_c(v) ((vec_float4)(v)) -#define vec_float4_z vec_float4_sp(0) - -typedef __vector unsigned long long vec_udword2; -#define vec_udword2_set(...) (vec_udword2){__VA_ARGS__} -#define vec_udword2_sp(c) (__VSX_S2__(vec_udword2, (unsigned long long)c)) -#define vec_udword2_c(v) ((vec_udword2)(v)) -#define vec_udword2_z vec_udword2_sp(0) - -typedef __vector signed long long vec_dword2; -#define vec_dword2_set(...) (vec_dword2){__VA_ARGS__} -#define vec_dword2_sp(c) (__VSX_S2__(vec_dword2, (signed long long)c)) -#define vec_dword2_c(v) ((vec_dword2)(v)) -#define vec_dword2_z vec_dword2_sp(0) - -typedef __vector double vec_double2; -#define vec_double2_set(...) (vec_double2){__VA_ARGS__} -#define vec_double2_c(v) ((vec_double2)(v)) -#define vec_double2_sp(c) (__VSX_S2__(vec_double2, c)) -#define vec_double2_z vec_double2_sp(0) - -#define vec_bchar16 __vector __bool char -#define vec_bchar16_set(...) (vec_bchar16){__VA_ARGS__} -#define vec_bchar16_c(v) ((vec_bchar16)(v)) - -#define vec_bshort8 __vector __bool short -#define vec_bshort8_set(...) (vec_bshort8){__VA_ARGS__} -#define vec_bshort8_c(v) ((vec_bshort8)(v)) - -#define vec_bint4 __vector __bool int -#define vec_bint4_set(...) (vec_bint4){__VA_ARGS__} -#define vec_bint4_c(v) ((vec_bint4)(v)) - -#define vec_bdword2 __vector __bool long long -#define vec_bdword2_set(...) (vec_bdword2){__VA_ARGS__} -#define vec_bdword2_c(v) ((vec_bdword2)(v)) - -#define VSX_FINLINE(tp) extern inline tp __attribute__((always_inline)) - -#define VSX_REDIRECT_1RG(rt, rg, fnm, fn2) \ -VSX_FINLINE(rt) fnm(const rg& a) { return fn2(a); } - -#define VSX_REDIRECT_2RG(rt, rg, fnm, fn2) \ -VSX_FINLINE(rt) fnm(const rg& a, const rg& b) { return fn2(a, b); } - -/* - * GCC VSX compatibility -**/ -#if defined(__GNUG__) && !defined(__clang__) - -// inline asm helper -#define VSX_IMPL_1RG(rt, rto, rg, rgo, opc, fnm) \ -VSX_FINLINE(rt) fnm(const rg& a) \ -{ rt rs; __asm__ __volatile__(#opc" %x0,%x1" : "="#rto (rs) : #rgo (a)); return rs; } - -#define VSX_IMPL_1VRG(rt, rg, opc, fnm) \ -VSX_FINLINE(rt) fnm(const rg& a) \ -{ rt rs; __asm__ __volatile__(#opc" %0,%1" : "=v" (rs) : "v" (a)); return rs; } - -#define VSX_IMPL_2VRG_F(rt, rg, fopc, fnm) \ -VSX_FINLINE(rt) fnm(const rg& a, const rg& b) \ -{ rt rs; __asm__ __volatile__(fopc : "=v" (rs) : "v" (a), "v" (b)); return rs; } - -#define VSX_IMPL_2VRG(rt, rg, opc, fnm) VSX_IMPL_2VRG_F(rt, rg, #opc" %0,%1,%2", fnm) - -#if __GNUG__ < 7 -// up to GCC 6 vec_mul only supports precisions and llong -# ifdef vec_mul -# undef vec_mul -# endif -/* - * there's no a direct instruction for supporting 8-bit, 16-bit multiplication in ISA 2.07, - * XLC Implement it by using instruction "multiply even", "multiply odd" and "permute" -**/ -# define VSX_IMPL_MULH(Tvec, cperm) \ - VSX_FINLINE(Tvec) vec_mul(const Tvec& a, const Tvec& b) \ - { \ - static const vec_uchar16 ev_od = {cperm}; \ - return vec_perm((Tvec)vec_mule(a, b), (Tvec)vec_mulo(a, b), ev_od); \ - } - #define VSX_IMPL_MULH_P16 0, 16, 2, 18, 4, 20, 6, 22, 8, 24, 10, 26, 12, 28, 14, 30 - VSX_IMPL_MULH(vec_char16, VSX_IMPL_MULH_P16) - VSX_IMPL_MULH(vec_uchar16, VSX_IMPL_MULH_P16) - #define VSX_IMPL_MULH_P8 0, 1, 16, 17, 4, 5, 20, 21, 8, 9, 24, 25, 12, 13, 28, 29 - VSX_IMPL_MULH(vec_short8, VSX_IMPL_MULH_P8) - VSX_IMPL_MULH(vec_ushort8, VSX_IMPL_MULH_P8) - // vmuluwm can be used for unsigned or signed integers, that's what they said - VSX_IMPL_2VRG(vec_int4, vec_int4, vmuluwm, vec_mul) - VSX_IMPL_2VRG(vec_uint4, vec_uint4, vmuluwm, vec_mul) - // redirect to GCC builtin vec_mul, since it already supports precisions and llong - VSX_REDIRECT_2RG(vec_float4, vec_float4, vec_mul, __builtin_vec_mul) - VSX_REDIRECT_2RG(vec_double2, vec_double2, vec_mul, __builtin_vec_mul) - VSX_REDIRECT_2RG(vec_dword2, vec_dword2, vec_mul, __builtin_vec_mul) - VSX_REDIRECT_2RG(vec_udword2, vec_udword2, vec_mul, __builtin_vec_mul) -#endif // __GNUG__ < 7 - -#if __GNUG__ < 6 -/* - * Instruction "compare greater than or equal" in ISA 2.07 only supports single - * and double precision. - * In XLC and new versions of GCC implement integers by using instruction "greater than" and NOR. -**/ -# ifdef vec_cmpge -# undef vec_cmpge -# endif -# ifdef vec_cmple -# undef vec_cmple -# endif -# define vec_cmple(a, b) vec_cmpge(b, a) -# define VSX_IMPL_CMPGE(rt, rg, opc, fnm) \ - VSX_IMPL_2VRG_F(rt, rg, #opc" %0,%2,%1\n\t xxlnor %x0,%x0,%x0", fnm) - - VSX_IMPL_CMPGE(vec_bchar16, vec_char16, vcmpgtsb, vec_cmpge) - VSX_IMPL_CMPGE(vec_bchar16, vec_uchar16, vcmpgtub, vec_cmpge) - VSX_IMPL_CMPGE(vec_bshort8, vec_short8, vcmpgtsh, vec_cmpge) - VSX_IMPL_CMPGE(vec_bshort8, vec_ushort8, vcmpgtuh, vec_cmpge) - VSX_IMPL_CMPGE(vec_bint4, vec_int4, vcmpgtsw, vec_cmpge) - VSX_IMPL_CMPGE(vec_bint4, vec_uint4, vcmpgtuw, vec_cmpge) - VSX_IMPL_CMPGE(vec_bdword2, vec_dword2, vcmpgtsd, vec_cmpge) - VSX_IMPL_CMPGE(vec_bdword2, vec_udword2, vcmpgtud, vec_cmpge) - -// redirect to GCC builtin cmpge, since it already supports precisions - VSX_REDIRECT_2RG(vec_bint4, vec_float4, vec_cmpge, __builtin_vec_cmpge) - VSX_REDIRECT_2RG(vec_bdword2, vec_double2, vec_cmpge, __builtin_vec_cmpge) - -// up to gcc5 vec_nor doesn't support bool long long -# undef vec_nor - template - VSX_REDIRECT_2RG(T, T, vec_nor, __builtin_vec_nor) - - VSX_FINLINE(vec_bdword2) vec_nor(const vec_bdword2& a, const vec_bdword2& b) - { return vec_bdword2_c(__builtin_vec_nor(vec_dword2_c(a), vec_dword2_c(b))); } - -// vec_packs doesn't support double words in gcc4 and old versions of gcc5 -# undef vec_packs - VSX_REDIRECT_2RG(vec_char16, vec_short8, vec_packs, __builtin_vec_packs) - VSX_REDIRECT_2RG(vec_uchar16, vec_ushort8, vec_packs, __builtin_vec_packs) - VSX_REDIRECT_2RG(vec_short8, vec_int4, vec_packs, __builtin_vec_packs) - VSX_REDIRECT_2RG(vec_ushort8, vec_uint4, vec_packs, __builtin_vec_packs) - - VSX_IMPL_2VRG_F(vec_int4, vec_dword2, "vpksdss %0,%2,%1", vec_packs) - VSX_IMPL_2VRG_F(vec_uint4, vec_udword2, "vpkudus %0,%2,%1", vec_packs) -#endif // __GNUG__ < 6 - -#if __GNUG__ < 5 -// vec_xxpermdi in gcc4 missing little-endian supports just like clang -# define vec_permi(a, b, c) vec_xxpermdi(b, a, (3 ^ (((c) & 1) << 1 | (c) >> 1))) -#else -# define vec_permi vec_xxpermdi -#endif // __GNUG__ < 5 - -// shift left double by word immediate -#ifndef vec_sldw -# define vec_sldw __builtin_vsx_xxsldwi -#endif - -// vector population count -VSX_IMPL_1VRG(vec_uchar16, vec_uchar16, vpopcntb, vec_popcntu) -VSX_IMPL_1VRG(vec_uchar16, vec_char16, vpopcntb, vec_popcntu) -VSX_IMPL_1VRG(vec_ushort8, vec_ushort8, vpopcnth, vec_popcntu) -VSX_IMPL_1VRG(vec_ushort8, vec_short8, vpopcnth, vec_popcntu) -VSX_IMPL_1VRG(vec_uint4, vec_uint4, vpopcntw, vec_popcntu) -VSX_IMPL_1VRG(vec_uint4, vec_int4, vpopcntw, vec_popcntu) -VSX_IMPL_1VRG(vec_udword2, vec_udword2, vpopcntd, vec_popcntu) -VSX_IMPL_1VRG(vec_udword2, vec_dword2, vpopcntd, vec_popcntu) - -// converts between single and double-precision -VSX_REDIRECT_1RG(vec_float4, vec_double2, vec_cvfo, __builtin_vsx_xvcvdpsp) -VSX_REDIRECT_1RG(vec_double2, vec_float4, vec_cvfo, __builtin_vsx_xvcvspdp) - -// converts word and doubleword to double-precision -#ifdef vec_ctd -# undef vec_ctd -#endif -VSX_IMPL_1RG(vec_double2, wd, vec_int4, wa, xvcvsxwdp, vec_ctdo) -VSX_IMPL_1RG(vec_double2, wd, vec_uint4, wa, xvcvuxwdp, vec_ctdo) -VSX_IMPL_1RG(vec_double2, wd, vec_dword2, wi, xvcvsxddp, vec_ctd) -VSX_IMPL_1RG(vec_double2, wd, vec_udword2, wi, xvcvuxddp, vec_ctd) - -// converts word and doubleword to single-precision -#undef vec_ctf -VSX_IMPL_1RG(vec_float4, wf, vec_int4, wa, xvcvsxwsp, vec_ctf) -VSX_IMPL_1RG(vec_float4, wf, vec_uint4, wa, xvcvuxwsp, vec_ctf) -VSX_IMPL_1RG(vec_float4, wf, vec_dword2, wi, xvcvsxdsp, vec_ctfo) -VSX_IMPL_1RG(vec_float4, wf, vec_udword2, wi, xvcvuxdsp, vec_ctfo) - -// converts single and double precision to signed word -#undef vec_cts -VSX_IMPL_1RG(vec_int4, wa, vec_double2, wd, xvcvdpsxws, vec_ctso) -VSX_IMPL_1RG(vec_int4, wa, vec_float4, wf, xvcvspsxws, vec_cts) - -// converts single and double precision to unsigned word -#undef vec_ctu -VSX_IMPL_1RG(vec_uint4, wa, vec_double2, wd, xvcvdpuxws, vec_ctuo) -VSX_IMPL_1RG(vec_uint4, wa, vec_float4, wf, xvcvspuxws, vec_ctu) - -// converts single and double precision to signed doubleword -#ifdef vec_ctsl -# undef vec_ctsl -#endif -VSX_IMPL_1RG(vec_dword2, wi, vec_double2, wd, xvcvdpsxds, vec_ctsl) -VSX_IMPL_1RG(vec_dword2, wi, vec_float4, wf, xvcvspsxds, vec_ctslo) - -// converts single and double precision to unsigned doubleword -#ifdef vec_ctul -# undef vec_ctul -#endif -VSX_IMPL_1RG(vec_udword2, wi, vec_double2, wd, xvcvdpuxds, vec_ctul) -VSX_IMPL_1RG(vec_udword2, wi, vec_float4, wf, xvcvspuxds, vec_ctulo) - -// just in case if GCC doesn't define it -#ifndef vec_xl -# define vec_xl vec_vsx_ld -# define vec_xst vec_vsx_st -#endif - -#endif // GCC VSX compatibility - -/* - * CLANG VSX compatibility -**/ -#if defined(__clang__) && !defined(__IBMCPP__) - -/* - * CLANG doesn't support %x in the inline asm template which fixes register number - * when using any of the register constraints wa, wd, wf - * - * For more explanation checkout PowerPC and IBM RS6000 in https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html - * Also there's already an open bug https://bugs.llvm.org/show_bug.cgi?id=31837 - * - * So we're not able to use inline asm and only use built-in functions that CLANG supports - * and use __builtin_convertvector if clang missng any of vector conversions built-in functions - * - * todo: clang asm template bug is fixed, need to reconsider the current workarounds. -*/ - -// convert vector helper -#define VSX_IMPL_CONVERT(rt, rg, fnm) \ -VSX_FINLINE(rt) fnm(const rg& a) { return __builtin_convertvector(a, rt); } - -#if __clang_major__ < 5 -// implement vec_permi in a dirty way -# define VSX_IMPL_CLANG_4_PERMI(Tvec) \ - VSX_FINLINE(Tvec) vec_permi(const Tvec& a, const Tvec& b, unsigned const char c) \ - { \ - switch (c) \ - { \ - case 0: \ - return vec_mergeh(a, b); \ - case 1: \ - return vec_mergel(vec_mergeh(a, a), b); \ - case 2: \ - return vec_mergeh(vec_mergel(a, a), b); \ - default: \ - return vec_mergel(a, b); \ - } \ - } - VSX_IMPL_CLANG_4_PERMI(vec_udword2) - VSX_IMPL_CLANG_4_PERMI(vec_dword2) - VSX_IMPL_CLANG_4_PERMI(vec_double2) - -// vec_xxsldwi is missing in clang 4 -# define vec_xxsldwi(a, b, c) vec_sld(a, b, (c) * 4) -#else -// vec_xxpermdi is missing little-endian supports in clang 4 just like gcc4 -# define vec_permi(a, b, c) vec_xxpermdi(b, a, (3 ^ (((c) & 1) << 1 | (c) >> 1))) -#endif // __clang_major__ < 5 - -// shift left double by word immediate -#ifndef vec_sldw -# define vec_sldw vec_xxsldwi -#endif - -// Implement vec_rsqrt since clang only supports vec_rsqrte -#ifndef vec_rsqrt - VSX_FINLINE(vec_float4) vec_rsqrt(const vec_float4& a) - { return vec_div(vec_float4_sp(1), vec_sqrt(a)); } - - VSX_FINLINE(vec_double2) vec_rsqrt(const vec_double2& a) - { return vec_div(vec_double2_sp(1), vec_sqrt(a)); } -#endif - -// vec_promote missing support for doubleword -VSX_FINLINE(vec_dword2) vec_promote(long long a, int b) -{ - vec_dword2 ret = vec_dword2_z; - ret[b & 1] = a; - return ret; -} - -VSX_FINLINE(vec_udword2) vec_promote(unsigned long long a, int b) -{ - vec_udword2 ret = vec_udword2_z; - ret[b & 1] = a; - return ret; -} - -// vec_popcnt should return unsigned but clang has different thought just like gcc in vec_vpopcnt -#define VSX_IMPL_POPCNTU(Tvec, Tvec2, ucast) \ -VSX_FINLINE(Tvec) vec_popcntu(const Tvec2& a) \ -{ return ucast(vec_popcnt(a)); } -VSX_IMPL_POPCNTU(vec_uchar16, vec_char16, vec_uchar16_c); -VSX_IMPL_POPCNTU(vec_ushort8, vec_short8, vec_ushort8_c); -VSX_IMPL_POPCNTU(vec_uint4, vec_int4, vec_uint4_c); -// redirect unsigned types -VSX_REDIRECT_1RG(vec_uchar16, vec_uchar16, vec_popcntu, vec_popcnt) -VSX_REDIRECT_1RG(vec_ushort8, vec_ushort8, vec_popcntu, vec_popcnt) -VSX_REDIRECT_1RG(vec_uint4, vec_uint4, vec_popcntu, vec_popcnt) - -// converts between single and double precision -VSX_REDIRECT_1RG(vec_float4, vec_double2, vec_cvfo, __builtin_vsx_xvcvdpsp) -VSX_REDIRECT_1RG(vec_double2, vec_float4, vec_cvfo, __builtin_vsx_xvcvspdp) - -// converts word and doubleword to double-precision -#ifdef vec_ctd -# undef vec_ctd -#endif -VSX_REDIRECT_1RG(vec_double2, vec_int4, vec_ctdo, __builtin_vsx_xvcvsxwdp) -VSX_REDIRECT_1RG(vec_double2, vec_uint4, vec_ctdo, __builtin_vsx_xvcvuxwdp) - -VSX_IMPL_CONVERT(vec_double2, vec_dword2, vec_ctd) -VSX_IMPL_CONVERT(vec_double2, vec_udword2, vec_ctd) - -// converts word and doubleword to single-precision -#if __clang_major__ > 4 -# undef vec_ctf -#endif -VSX_IMPL_CONVERT(vec_float4, vec_int4, vec_ctf) -VSX_IMPL_CONVERT(vec_float4, vec_uint4, vec_ctf) -VSX_REDIRECT_1RG(vec_float4, vec_dword2, vec_ctfo, __builtin_vsx_xvcvsxdsp) -VSX_REDIRECT_1RG(vec_float4, vec_udword2, vec_ctfo, __builtin_vsx_xvcvuxdsp) - -// converts single and double precision to signed word -#if __clang_major__ > 4 -# undef vec_cts -#endif -VSX_REDIRECT_1RG(vec_int4, vec_double2, vec_ctso, __builtin_vsx_xvcvdpsxws) -VSX_IMPL_CONVERT(vec_int4, vec_float4, vec_cts) - -// converts single and double precision to unsigned word -#if __clang_major__ > 4 -# undef vec_ctu -#endif -VSX_REDIRECT_1RG(vec_uint4, vec_double2, vec_ctuo, __builtin_vsx_xvcvdpuxws) -VSX_IMPL_CONVERT(vec_uint4, vec_float4, vec_ctu) - -// converts single and double precision to signed doubleword -#ifdef vec_ctsl -# undef vec_ctsl -#endif -VSX_IMPL_CONVERT(vec_dword2, vec_double2, vec_ctsl) -// __builtin_convertvector unable to convert, xvcvspsxds is missing on it -VSX_FINLINE(vec_dword2) vec_ctslo(const vec_float4& a) -{ return vec_ctsl(vec_cvfo(a)); } - -// converts single and double precision to unsigned doubleword -#ifdef vec_ctul -# undef vec_ctul -#endif -VSX_IMPL_CONVERT(vec_udword2, vec_double2, vec_ctul) -// __builtin_convertvector unable to convert, xvcvspuxds is missing on it -VSX_FINLINE(vec_udword2) vec_ctulo(const vec_float4& a) -{ return vec_ctul(vec_cvfo(a)); } - -#endif // CLANG VSX compatibility - -/* - * Common GCC, CLANG compatibility -**/ -#if defined(__GNUG__) && !defined(__IBMCPP__) - -#ifdef vec_cvf -# undef vec_cvf -#endif - -#define VSX_IMPL_CONV_EVEN_4_2(rt, rg, fnm, fn2) \ -VSX_FINLINE(rt) fnm(const rg& a) \ -{ return fn2(vec_sldw(a, a, 1)); } - -VSX_IMPL_CONV_EVEN_4_2(vec_double2, vec_float4, vec_cvf, vec_cvfo) -VSX_IMPL_CONV_EVEN_4_2(vec_double2, vec_int4, vec_ctd, vec_ctdo) -VSX_IMPL_CONV_EVEN_4_2(vec_double2, vec_uint4, vec_ctd, vec_ctdo) - -VSX_IMPL_CONV_EVEN_4_2(vec_dword2, vec_float4, vec_ctsl, vec_ctslo) -VSX_IMPL_CONV_EVEN_4_2(vec_udword2, vec_float4, vec_ctul, vec_ctulo) - -#define VSX_IMPL_CONV_EVEN_2_4(rt, rg, fnm, fn2) \ -VSX_FINLINE(rt) fnm(const rg& a) \ -{ \ - rt v4 = fn2(a); \ - return vec_sldw(v4, v4, 3); \ -} - -VSX_IMPL_CONV_EVEN_2_4(vec_float4, vec_double2, vec_cvf, vec_cvfo) -VSX_IMPL_CONV_EVEN_2_4(vec_float4, vec_dword2, vec_ctf, vec_ctfo) -VSX_IMPL_CONV_EVEN_2_4(vec_float4, vec_udword2, vec_ctf, vec_ctfo) - -VSX_IMPL_CONV_EVEN_2_4(vec_int4, vec_double2, vec_cts, vec_ctso) -VSX_IMPL_CONV_EVEN_2_4(vec_uint4, vec_double2, vec_ctu, vec_ctuo) - -// Only for Eigen! -/* - * changing behavior of conversion intrinsics for gcc has effect on Eigen - * so we redfine old behavior again only on gcc, clang -*/ -#if !defined(__clang__) || __clang_major__ > 4 - // ignoring second arg since Eigen only truncates toward zero -# define VSX_IMPL_CONV_2VARIANT(rt, rg, fnm, fn2) \ - VSX_FINLINE(rt) fnm(const rg& a, int only_truncate) \ - { \ - assert(only_truncate == 0); \ - CV_UNUSED(only_truncate); \ - return fn2(a); \ - } - VSX_IMPL_CONV_2VARIANT(vec_int4, vec_float4, vec_cts, vec_cts) - VSX_IMPL_CONV_2VARIANT(vec_float4, vec_int4, vec_ctf, vec_ctf) - // define vec_cts for converting double precision to signed doubleword - // which isn't combitable with xlc but its okay since Eigen only use it for gcc - VSX_IMPL_CONV_2VARIANT(vec_dword2, vec_double2, vec_cts, vec_ctsl) -#endif // Eigen - -#endif // Common GCC, CLANG compatibility - -/* - * XLC VSX compatibility -**/ -#if defined(__IBMCPP__) - -// vector population count -#define vec_popcntu vec_popcnt - -// overload and redirect with setting second arg to zero -// since we only support conversions without the second arg -#define VSX_IMPL_OVERLOAD_Z2(rt, rg, fnm) \ -VSX_FINLINE(rt) fnm(const rg& a) { return fnm(a, 0); } - -VSX_IMPL_OVERLOAD_Z2(vec_double2, vec_int4, vec_ctd) -VSX_IMPL_OVERLOAD_Z2(vec_double2, vec_uint4, vec_ctd) -VSX_IMPL_OVERLOAD_Z2(vec_double2, vec_dword2, vec_ctd) -VSX_IMPL_OVERLOAD_Z2(vec_double2, vec_udword2, vec_ctd) - -VSX_IMPL_OVERLOAD_Z2(vec_float4, vec_int4, vec_ctf) -VSX_IMPL_OVERLOAD_Z2(vec_float4, vec_uint4, vec_ctf) -VSX_IMPL_OVERLOAD_Z2(vec_float4, vec_dword2, vec_ctf) -VSX_IMPL_OVERLOAD_Z2(vec_float4, vec_udword2, vec_ctf) - -VSX_IMPL_OVERLOAD_Z2(vec_int4, vec_double2, vec_cts) -VSX_IMPL_OVERLOAD_Z2(vec_int4, vec_float4, vec_cts) - -VSX_IMPL_OVERLOAD_Z2(vec_uint4, vec_double2, vec_ctu) -VSX_IMPL_OVERLOAD_Z2(vec_uint4, vec_float4, vec_ctu) - -VSX_IMPL_OVERLOAD_Z2(vec_dword2, vec_double2, vec_ctsl) -VSX_IMPL_OVERLOAD_Z2(vec_dword2, vec_float4, vec_ctsl) - -VSX_IMPL_OVERLOAD_Z2(vec_udword2, vec_double2, vec_ctul) -VSX_IMPL_OVERLOAD_Z2(vec_udword2, vec_float4, vec_ctul) - -// fixme: implement conversions of odd-numbered elements in a dirty way -// since xlc doesn't support VSX registers operand in inline asm. -#define VSX_IMPL_CONV_ODD_4_2(rt, rg, fnm, fn2) \ -VSX_FINLINE(rt) fnm(const rg& a) { return fn2(vec_sldw(a, a, 3)); } - -VSX_IMPL_CONV_ODD_4_2(vec_double2, vec_float4, vec_cvfo, vec_cvf) -VSX_IMPL_CONV_ODD_4_2(vec_double2, vec_int4, vec_ctdo, vec_ctd) -VSX_IMPL_CONV_ODD_4_2(vec_double2, vec_uint4, vec_ctdo, vec_ctd) - -VSX_IMPL_CONV_ODD_4_2(vec_dword2, vec_float4, vec_ctslo, vec_ctsl) -VSX_IMPL_CONV_ODD_4_2(vec_udword2, vec_float4, vec_ctulo, vec_ctul) - -#define VSX_IMPL_CONV_ODD_2_4(rt, rg, fnm, fn2) \ -VSX_FINLINE(rt) fnm(const rg& a) \ -{ \ - rt v4 = fn2(a); \ - return vec_sldw(v4, v4, 1); \ -} - -VSX_IMPL_CONV_ODD_2_4(vec_float4, vec_double2, vec_cvfo, vec_cvf) -VSX_IMPL_CONV_ODD_2_4(vec_float4, vec_dword2, vec_ctfo, vec_ctf) -VSX_IMPL_CONV_ODD_2_4(vec_float4, vec_udword2, vec_ctfo, vec_ctf) - -VSX_IMPL_CONV_ODD_2_4(vec_int4, vec_double2, vec_ctso, vec_cts) -VSX_IMPL_CONV_ODD_2_4(vec_uint4, vec_double2, vec_ctuo, vec_ctu) - -#endif // XLC VSX compatibility - -// ignore GCC warning that caused by -Wunused-but-set-variable in rare cases -#if defined(__GNUG__) && !defined(__clang__) -# define VSX_UNUSED(Tvec) Tvec __attribute__((__unused__)) -#else // CLANG, XLC -# define VSX_UNUSED(Tvec) Tvec -#endif - -// gcc can find his way in casting log int and XLC, CLANG ambiguous -#if defined(__clang__) || defined(__IBMCPP__) - VSX_FINLINE(vec_udword2) vec_splats(uint64 v) - { return vec_splats((unsigned long long) v); } - - VSX_FINLINE(vec_dword2) vec_splats(int64 v) - { return vec_splats((long long) v); } - - VSX_FINLINE(vec_udword2) vec_promote(uint64 a, int b) - { return vec_promote((unsigned long long) a, b); } - - VSX_FINLINE(vec_dword2) vec_promote(int64 a, int b) - { return vec_promote((long long) a, b); } -#endif - -/* - * implement vsx_ld(offset, pointer), vsx_st(vector, offset, pointer) - * load and set using offset depend on the pointer type - * - * implement vsx_ldf(offset, pointer), vsx_stf(vector, offset, pointer) - * load and set using offset depend on fixed bytes size - * - * Note: In clang vec_xl and vec_xst fails to load unaligned addresses - * so we are using vec_vsx_ld, vec_vsx_st instead -*/ - -#if defined(__clang__) && !defined(__IBMCPP__) -# define vsx_ldf vec_vsx_ld -# define vsx_stf vec_vsx_st -#else // GCC , XLC -# define vsx_ldf vec_xl -# define vsx_stf vec_xst -#endif - -#define VSX_OFFSET(o, p) ((o) * sizeof(*(p))) -#define vsx_ld(o, p) vsx_ldf(VSX_OFFSET(o, p), p) -#define vsx_st(v, o, p) vsx_stf(v, VSX_OFFSET(o, p), p) - -/* - * implement vsx_ld2(offset, pointer), vsx_st2(vector, offset, pointer) to load and store double words - * In GCC vec_xl and vec_xst it maps to vec_vsx_ld, vec_vsx_st which doesn't support long long - * and in CLANG we are using vec_vsx_ld, vec_vsx_st because vec_xl, vec_xst fails to load unaligned addresses - * - * In XLC vec_xl and vec_xst fail to cast int64(long int) to long long -*/ -#if (defined(__GNUG__) || defined(__clang__)) && !defined(__IBMCPP__) - VSX_FINLINE(vec_udword2) vsx_ld2(long o, const uint64* p) - { return vec_udword2_c(vsx_ldf(VSX_OFFSET(o, p), (unsigned int*)p)); } - - VSX_FINLINE(vec_dword2) vsx_ld2(long o, const int64* p) - { return vec_dword2_c(vsx_ldf(VSX_OFFSET(o, p), (int*)p)); } - - VSX_FINLINE(void) vsx_st2(const vec_udword2& vec, long o, uint64* p) - { vsx_stf(vec_uint4_c(vec), VSX_OFFSET(o, p), (unsigned int*)p); } - - VSX_FINLINE(void) vsx_st2(const vec_dword2& vec, long o, int64* p) - { vsx_stf(vec_int4_c(vec), VSX_OFFSET(o, p), (int*)p); } -#else // XLC - VSX_FINLINE(vec_udword2) vsx_ld2(long o, const uint64* p) - { return vsx_ldf(VSX_OFFSET(o, p), (unsigned long long*)p); } - - VSX_FINLINE(vec_dword2) vsx_ld2(long o, const int64* p) - { return vsx_ldf(VSX_OFFSET(o, p), (long long*)p); } - - VSX_FINLINE(void) vsx_st2(const vec_udword2& vec, long o, uint64* p) - { vsx_stf(vec, VSX_OFFSET(o, p), (unsigned long long*)p); } - - VSX_FINLINE(void) vsx_st2(const vec_dword2& vec, long o, int64* p) - { vsx_stf(vec, VSX_OFFSET(o, p), (long long*)p); } -#endif - -// Store lower 8 byte -#define vec_st_l8(v, p) *((uint64*)(p)) = vec_extract(vec_udword2_c(v), 0) - -// Store higher 8 byte -#define vec_st_h8(v, p) *((uint64*)(p)) = vec_extract(vec_udword2_c(v), 1) - -// Load 64-bits of integer data to lower part -#define VSX_IMPL_LOAD_L8(Tvec, Tp) \ -VSX_FINLINE(Tvec) vec_ld_l8(const Tp *p) \ -{ return ((Tvec)vec_promote(*((uint64*)p), 0)); } - -VSX_IMPL_LOAD_L8(vec_uchar16, uchar) -VSX_IMPL_LOAD_L8(vec_char16, schar) -VSX_IMPL_LOAD_L8(vec_ushort8, ushort) -VSX_IMPL_LOAD_L8(vec_short8, short) -VSX_IMPL_LOAD_L8(vec_uint4, uint) -VSX_IMPL_LOAD_L8(vec_int4, int) -VSX_IMPL_LOAD_L8(vec_float4, float) -VSX_IMPL_LOAD_L8(vec_udword2, uint64) -VSX_IMPL_LOAD_L8(vec_dword2, int64) -VSX_IMPL_LOAD_L8(vec_double2, double) - -// logical not -#define vec_not(a) vec_nor(a, a) - -// power9 yaya -// not equal -#ifndef vec_cmpne -# define vec_cmpne(a, b) vec_not(vec_cmpeq(a, b)) -#endif - -// absolute difference -#ifndef vec_absd -# define vec_absd(a, b) vec_sub(vec_max(a, b), vec_min(a, b)) -#endif - -/* - * Implement vec_unpacklu and vec_unpackhu - * since vec_unpackl, vec_unpackh only support signed integers -**/ -#define VSX_IMPL_UNPACKU(rt, rg, zero) \ -VSX_FINLINE(rt) vec_unpacklu(const rg& a) \ -{ return (rt)(vec_mergel(a, zero)); } \ -VSX_FINLINE(rt) vec_unpackhu(const rg& a) \ -{ return (rt)(vec_mergeh(a, zero)); } - -VSX_IMPL_UNPACKU(vec_ushort8, vec_uchar16, vec_uchar16_z) -VSX_IMPL_UNPACKU(vec_uint4, vec_ushort8, vec_ushort8_z) -VSX_IMPL_UNPACKU(vec_udword2, vec_uint4, vec_uint4_z) - -/* - * Implement vec_mergesqe and vec_mergesqo - * Merges the sequence values of even and odd elements of two vectors -*/ -#define VSX_IMPL_PERM(rt, fnm, ...) \ -VSX_FINLINE(rt) fnm(const rt& a, const rt& b) \ -{ static const vec_uchar16 perm = {__VA_ARGS__}; return vec_perm(a, b, perm); } - -// 16 -#define perm16_mergesqe 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 -#define perm16_mergesqo 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 -VSX_IMPL_PERM(vec_uchar16, vec_mergesqe, perm16_mergesqe) -VSX_IMPL_PERM(vec_uchar16, vec_mergesqo, perm16_mergesqo) -VSX_IMPL_PERM(vec_char16, vec_mergesqe, perm16_mergesqe) -VSX_IMPL_PERM(vec_char16, vec_mergesqo, perm16_mergesqo) -// 8 -#define perm8_mergesqe 0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29 -#define perm8_mergesqo 2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 -VSX_IMPL_PERM(vec_ushort8, vec_mergesqe, perm8_mergesqe) -VSX_IMPL_PERM(vec_ushort8, vec_mergesqo, perm8_mergesqo) -VSX_IMPL_PERM(vec_short8, vec_mergesqe, perm8_mergesqe) -VSX_IMPL_PERM(vec_short8, vec_mergesqo, perm8_mergesqo) -// 4 -#define perm4_mergesqe 0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27 -#define perm4_mergesqo 4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31 -VSX_IMPL_PERM(vec_uint4, vec_mergesqe, perm4_mergesqe) -VSX_IMPL_PERM(vec_uint4, vec_mergesqo, perm4_mergesqo) -VSX_IMPL_PERM(vec_int4, vec_mergesqe, perm4_mergesqe) -VSX_IMPL_PERM(vec_int4, vec_mergesqo, perm4_mergesqo) -VSX_IMPL_PERM(vec_float4, vec_mergesqe, perm4_mergesqe) -VSX_IMPL_PERM(vec_float4, vec_mergesqo, perm4_mergesqo) -// 2 -VSX_REDIRECT_2RG(vec_double2, vec_double2, vec_mergesqe, vec_mergeh) -VSX_REDIRECT_2RG(vec_double2, vec_double2, vec_mergesqo, vec_mergel) -VSX_REDIRECT_2RG(vec_dword2, vec_dword2, vec_mergesqe, vec_mergeh) -VSX_REDIRECT_2RG(vec_dword2, vec_dword2, vec_mergesqo, vec_mergel) -VSX_REDIRECT_2RG(vec_udword2, vec_udword2, vec_mergesqe, vec_mergeh) -VSX_REDIRECT_2RG(vec_udword2, vec_udword2, vec_mergesqo, vec_mergel) - -/* - * Implement vec_mergesqh and vec_mergesql - * Merges the sequence most and least significant halves of two vectors -*/ -#define VSX_IMPL_MERGESQHL(Tvec) \ -VSX_FINLINE(Tvec) vec_mergesqh(const Tvec& a, const Tvec& b) \ -{ return (Tvec)vec_mergeh(vec_udword2_c(a), vec_udword2_c(b)); } \ -VSX_FINLINE(Tvec) vec_mergesql(const Tvec& a, const Tvec& b) \ -{ return (Tvec)vec_mergel(vec_udword2_c(a), vec_udword2_c(b)); } -VSX_IMPL_MERGESQHL(vec_uchar16) -VSX_IMPL_MERGESQHL(vec_char16) -VSX_IMPL_MERGESQHL(vec_ushort8) -VSX_IMPL_MERGESQHL(vec_short8) -VSX_IMPL_MERGESQHL(vec_uint4) -VSX_IMPL_MERGESQHL(vec_int4) -VSX_IMPL_MERGESQHL(vec_float4) -VSX_REDIRECT_2RG(vec_udword2, vec_udword2, vec_mergesqh, vec_mergeh) -VSX_REDIRECT_2RG(vec_udword2, vec_udword2, vec_mergesql, vec_mergel) -VSX_REDIRECT_2RG(vec_dword2, vec_dword2, vec_mergesqh, vec_mergeh) -VSX_REDIRECT_2RG(vec_dword2, vec_dword2, vec_mergesql, vec_mergel) -VSX_REDIRECT_2RG(vec_double2, vec_double2, vec_mergesqh, vec_mergeh) -VSX_REDIRECT_2RG(vec_double2, vec_double2, vec_mergesql, vec_mergel) - - -// 2 and 4 channels interleave for all types except 2 lanes -#define VSX_IMPL_ST_INTERLEAVE(Tp, Tvec) \ -VSX_FINLINE(void) vec_st_interleave(const Tvec& a, const Tvec& b, Tp* ptr) \ -{ \ - vsx_stf(vec_mergeh(a, b), 0, ptr); \ - vsx_stf(vec_mergel(a, b), 16, ptr); \ -} \ -VSX_FINLINE(void) vec_st_interleave(const Tvec& a, const Tvec& b, \ - const Tvec& c, const Tvec& d, Tp* ptr) \ -{ \ - Tvec ac = vec_mergeh(a, c); \ - Tvec bd = vec_mergeh(b, d); \ - vsx_stf(vec_mergeh(ac, bd), 0, ptr); \ - vsx_stf(vec_mergel(ac, bd), 16, ptr); \ - ac = vec_mergel(a, c); \ - bd = vec_mergel(b, d); \ - vsx_stf(vec_mergeh(ac, bd), 32, ptr); \ - vsx_stf(vec_mergel(ac, bd), 48, ptr); \ -} -VSX_IMPL_ST_INTERLEAVE(uchar, vec_uchar16) -VSX_IMPL_ST_INTERLEAVE(schar, vec_char16) -VSX_IMPL_ST_INTERLEAVE(ushort, vec_ushort8) -VSX_IMPL_ST_INTERLEAVE(short, vec_short8) -VSX_IMPL_ST_INTERLEAVE(uint, vec_uint4) -VSX_IMPL_ST_INTERLEAVE(int, vec_int4) -VSX_IMPL_ST_INTERLEAVE(float, vec_float4) - -// 2 and 4 channels deinterleave for 16 lanes -#define VSX_IMPL_ST_DINTERLEAVE_8(Tp, Tvec) \ -VSX_FINLINE(void) vec_ld_deinterleave(const Tp* ptr, Tvec& a, Tvec& b) \ -{ \ - Tvec v0 = vsx_ld(0, ptr); \ - Tvec v1 = vsx_ld(16, ptr); \ - a = vec_mergesqe(v0, v1); \ - b = vec_mergesqo(v0, v1); \ -} \ -VSX_FINLINE(void) vec_ld_deinterleave(const Tp* ptr, Tvec& a, Tvec& b, \ - Tvec& c, Tvec& d) \ -{ \ - Tvec v0 = vsx_ld(0, ptr); \ - Tvec v1 = vsx_ld(16, ptr); \ - Tvec v2 = vsx_ld(32, ptr); \ - Tvec v3 = vsx_ld(48, ptr); \ - Tvec m0 = vec_mergesqe(v0, v1); \ - Tvec m1 = vec_mergesqe(v2, v3); \ - a = vec_mergesqe(m0, m1); \ - c = vec_mergesqo(m0, m1); \ - m0 = vec_mergesqo(v0, v1); \ - m1 = vec_mergesqo(v2, v3); \ - b = vec_mergesqe(m0, m1); \ - d = vec_mergesqo(m0, m1); \ -} -VSX_IMPL_ST_DINTERLEAVE_8(uchar, vec_uchar16) -VSX_IMPL_ST_DINTERLEAVE_8(schar, vec_char16) - -// 2 and 4 channels deinterleave for 8 lanes -#define VSX_IMPL_ST_DINTERLEAVE_16(Tp, Tvec) \ -VSX_FINLINE(void) vec_ld_deinterleave(const Tp* ptr, Tvec& a, Tvec& b) \ -{ \ - Tvec v0 = vsx_ld(0, ptr); \ - Tvec v1 = vsx_ld(8, ptr); \ - a = vec_mergesqe(v0, v1); \ - b = vec_mergesqo(v0, v1); \ -} \ -VSX_FINLINE(void) vec_ld_deinterleave(const Tp* ptr, Tvec& a, Tvec& b, \ - Tvec& c, Tvec& d) \ -{ \ - Tvec v0 = vsx_ld(0, ptr); \ - Tvec v1 = vsx_ld(8, ptr); \ - Tvec m0 = vec_mergeh(v0, v1); \ - Tvec m1 = vec_mergel(v0, v1); \ - Tvec ab0 = vec_mergeh(m0, m1); \ - Tvec cd0 = vec_mergel(m0, m1); \ - v0 = vsx_ld(16, ptr); \ - v1 = vsx_ld(24, ptr); \ - m0 = vec_mergeh(v0, v1); \ - m1 = vec_mergel(v0, v1); \ - Tvec ab1 = vec_mergeh(m0, m1); \ - Tvec cd1 = vec_mergel(m0, m1); \ - a = vec_mergesqh(ab0, ab1); \ - b = vec_mergesql(ab0, ab1); \ - c = vec_mergesqh(cd0, cd1); \ - d = vec_mergesql(cd0, cd1); \ -} -VSX_IMPL_ST_DINTERLEAVE_16(ushort, vec_ushort8) -VSX_IMPL_ST_DINTERLEAVE_16(short, vec_short8) - -// 2 and 4 channels deinterleave for 4 lanes -#define VSX_IMPL_ST_DINTERLEAVE_32(Tp, Tvec) \ -VSX_FINLINE(void) vec_ld_deinterleave(const Tp* ptr, Tvec& a, Tvec& b) \ -{ \ - a = vsx_ld(0, ptr); \ - b = vsx_ld(4, ptr); \ - Tvec m0 = vec_mergeh(a, b); \ - Tvec m1 = vec_mergel(a, b); \ - a = vec_mergeh(m0, m1); \ - b = vec_mergel(m0, m1); \ -} \ -VSX_FINLINE(void) vec_ld_deinterleave(const Tp* ptr, Tvec& a, Tvec& b, \ - Tvec& c, Tvec& d) \ -{ \ - Tvec v0 = vsx_ld(0, ptr); \ - Tvec v1 = vsx_ld(4, ptr); \ - Tvec v2 = vsx_ld(8, ptr); \ - Tvec v3 = vsx_ld(12, ptr); \ - Tvec m0 = vec_mergeh(v0, v2); \ - Tvec m1 = vec_mergeh(v1, v3); \ - a = vec_mergeh(m0, m1); \ - b = vec_mergel(m0, m1); \ - m0 = vec_mergel(v0, v2); \ - m1 = vec_mergel(v1, v3); \ - c = vec_mergeh(m0, m1); \ - d = vec_mergel(m0, m1); \ -} -VSX_IMPL_ST_DINTERLEAVE_32(uint, vec_uint4) -VSX_IMPL_ST_DINTERLEAVE_32(int, vec_int4) -VSX_IMPL_ST_DINTERLEAVE_32(float, vec_float4) - -// 2 and 4 channels interleave and deinterleave for 2 lanes -#define VSX_IMPL_ST_D_INTERLEAVE_64(Tp, Tvec, ld_func, st_func) \ -VSX_FINLINE(void) vec_st_interleave(const Tvec& a, const Tvec& b, Tp* ptr) \ -{ \ - st_func(vec_mergeh(a, b), 0, ptr); \ - st_func(vec_mergel(a, b), 2, ptr); \ -} \ -VSX_FINLINE(void) vec_st_interleave(const Tvec& a, const Tvec& b, \ - const Tvec& c, const Tvec& d, Tp* ptr) \ -{ \ - st_func(vec_mergeh(a, b), 0, ptr); \ - st_func(vec_mergeh(c, d), 2, ptr); \ - st_func(vec_mergel(a, b), 4, ptr); \ - st_func(vec_mergel(c, d), 6, ptr); \ -} \ -VSX_FINLINE(void) vec_ld_deinterleave(const Tp* ptr, Tvec& a, Tvec& b) \ -{ \ - Tvec m0 = ld_func(0, ptr); \ - Tvec m1 = ld_func(2, ptr); \ - a = vec_mergeh(m0, m1); \ - b = vec_mergel(m0, m1); \ -} \ -VSX_FINLINE(void) vec_ld_deinterleave(const Tp* ptr, Tvec& a, Tvec& b, \ - Tvec& c, Tvec& d) \ -{ \ - Tvec v0 = ld_func(0, ptr); \ - Tvec v1 = ld_func(2, ptr); \ - Tvec v2 = ld_func(4, ptr); \ - Tvec v3 = ld_func(6, ptr); \ - a = vec_mergeh(v0, v2); \ - b = vec_mergel(v0, v2); \ - c = vec_mergeh(v1, v3); \ - d = vec_mergel(v1, v3); \ -} -VSX_IMPL_ST_D_INTERLEAVE_64(int64, vec_dword2, vsx_ld2, vsx_st2) -VSX_IMPL_ST_D_INTERLEAVE_64(uint64, vec_udword2, vsx_ld2, vsx_st2) -VSX_IMPL_ST_D_INTERLEAVE_64(double, vec_double2, vsx_ld, vsx_st) - -/* 3 channels */ -#define VSX_IMPL_ST_INTERLEAVE_3CH_16(Tp, Tvec) \ -VSX_FINLINE(void) vec_st_interleave(const Tvec& a, const Tvec& b, \ - const Tvec& c, Tp* ptr) \ -{ \ - static const vec_uchar16 a12 = {0, 16, 0, 1, 17, 0, 2, 18, 0, 3, 19, 0, 4, 20, 0, 5}; \ - static const vec_uchar16 a123 = {0, 1, 16, 3, 4, 17, 6, 7, 18, 9, 10, 19, 12, 13, 20, 15}; \ - vsx_st(vec_perm(vec_perm(a, b, a12), c, a123), 0, ptr); \ - static const vec_uchar16 b12 = {21, 0, 6, 22, 0, 7, 23, 0, 8, 24, 0, 9, 25, 0, 10, 26}; \ - static const vec_uchar16 b123 = {0, 21, 2, 3, 22, 5, 6, 23, 8, 9, 24, 11, 12, 25, 14, 15}; \ - vsx_st(vec_perm(vec_perm(a, b, b12), c, b123), 16, ptr); \ - static const vec_uchar16 c12 = {0, 11, 27, 0, 12, 28, 0, 13, 29, 0, 14, 30, 0, 15, 31, 0}; \ - static const vec_uchar16 c123 = {26, 1, 2, 27, 4, 5, 28, 7, 8, 29, 10, 11, 30, 13, 14, 31}; \ - vsx_st(vec_perm(vec_perm(a, b, c12), c, c123), 32, ptr); \ -} \ -VSX_FINLINE(void) vec_ld_deinterleave(const Tp* ptr, Tvec& a, Tvec& b, Tvec& c) \ -{ \ - Tvec v1 = vsx_ld(0, ptr); \ - Tvec v2 = vsx_ld(16, ptr); \ - Tvec v3 = vsx_ld(32, ptr); \ - static const vec_uchar16 a12_perm = {0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 0, 0, 0, 0, 0}; \ - static const vec_uchar16 a123_perm = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 17, 20, 23, 26, 29}; \ - a = vec_perm(vec_perm(v1, v2, a12_perm), v3, a123_perm); \ - static const vec_uchar16 b12_perm = {1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 0, 0, 0, 0, 0}; \ - static const vec_uchar16 b123_perm = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 18, 21, 24, 27, 30}; \ - b = vec_perm(vec_perm(v1, v2, b12_perm), v3, b123_perm); \ - static const vec_uchar16 c12_perm = {2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 0, 0, 0, 0, 0, 0}; \ - static const vec_uchar16 c123_perm = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 19, 22, 25, 28, 31}; \ - c = vec_perm(vec_perm(v1, v2, c12_perm), v3, c123_perm); \ -} -VSX_IMPL_ST_INTERLEAVE_3CH_16(uchar, vec_uchar16) -VSX_IMPL_ST_INTERLEAVE_3CH_16(schar, vec_char16) - -#define VSX_IMPL_ST_INTERLEAVE_3CH_8(Tp, Tvec) \ -VSX_FINLINE(void) vec_st_interleave(const Tvec& a, const Tvec& b, \ - const Tvec& c, Tp* ptr) \ -{ \ - static const vec_uchar16 a12 = {0, 1, 16, 17, 0, 0, 2, 3, 18, 19, 0, 0, 4, 5, 20, 21}; \ - static const vec_uchar16 a123 = {0, 1, 2, 3, 16, 17, 6, 7, 8, 9, 18, 19, 12, 13, 14, 15}; \ - vsx_st(vec_perm(vec_perm(a, b, a12), c, a123), 0, ptr); \ - static const vec_uchar16 b12 = {0, 0, 6, 7, 22, 23, 0, 0, 8, 9, 24, 25, 0, 0, 10, 11}; \ - static const vec_uchar16 b123 = {20, 21, 2, 3, 4, 5, 22, 23, 8, 9, 10, 11, 24, 25, 14, 15}; \ - vsx_st(vec_perm(vec_perm(a, b, b12), c, b123), 8, ptr); \ - static const vec_uchar16 c12 = {26, 27, 0, 0, 12, 13, 28, 29, 0, 0, 14, 15, 30, 31, 0, 0}; \ - static const vec_uchar16 c123 = {0, 1, 26, 27, 4, 5, 6, 7, 28, 29, 10, 11, 12, 13, 30, 31}; \ - vsx_st(vec_perm(vec_perm(a, b, c12), c, c123), 16, ptr); \ -} \ -VSX_FINLINE(void) vec_ld_deinterleave(const Tp* ptr, Tvec& a, Tvec& b, Tvec& c) \ -{ \ - Tvec v1 = vsx_ld(0, ptr); \ - Tvec v2 = vsx_ld(8, ptr); \ - Tvec v3 = vsx_ld(16, ptr); \ - static const vec_uchar16 a12_perm = {0, 1, 6, 7, 12, 13, 18, 19, 24, 25, 30, 31, 0, 0, 0, 0}; \ - static const vec_uchar16 a123_perm = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20, 21, 26, 27}; \ - a = vec_perm(vec_perm(v1, v2, a12_perm), v3, a123_perm); \ - static const vec_uchar16 b12_perm = {2, 3, 8, 9, 14, 15, 20, 21, 26, 27, 0, 0, 0, 0, 0, 0}; \ - static const vec_uchar16 b123_perm = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 17, 22, 23, 28, 29}; \ - b = vec_perm(vec_perm(v1, v2, b12_perm), v3, b123_perm); \ - static const vec_uchar16 c12_perm = {4, 5, 10, 11, 16, 17, 22, 23, 28, 29, 0, 0, 0, 0, 0, 0}; \ - static const vec_uchar16 c123_perm = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 18, 19, 24, 25, 30, 31}; \ - c = vec_perm(vec_perm(v1, v2, c12_perm), v3, c123_perm); \ -} -VSX_IMPL_ST_INTERLEAVE_3CH_8(ushort, vec_ushort8) -VSX_IMPL_ST_INTERLEAVE_3CH_8(short, vec_short8) - -#define VSX_IMPL_ST_INTERLEAVE_3CH_4(Tp, Tvec) \ -VSX_FINLINE(void) vec_st_interleave(const Tvec& a, const Tvec& b, \ - const Tvec& c, Tp* ptr) \ -{ \ - Tvec hbc = vec_mergeh(b, c); \ - static const vec_uchar16 ahbc = {0, 1, 2, 3, 16, 17, 18, 19, 20, 21, 22, 23, 4, 5, 6, 7}; \ - vsx_st(vec_perm(a, hbc, ahbc), 0, ptr); \ - Tvec lab = vec_mergel(a, b); \ - vsx_st(vec_sld(lab, hbc, 8), 4, ptr); \ - static const vec_uchar16 clab = {8, 9, 10, 11, 24, 25, 26, 27, 28, 29, 30, 31, 12, 13, 14, 15};\ - vsx_st(vec_perm(c, lab, clab), 8, ptr); \ -} \ -VSX_FINLINE(void) vec_ld_deinterleave(const Tp* ptr, Tvec& a, Tvec& b, Tvec& c) \ -{ \ - Tvec v1 = vsx_ld(0, ptr); \ - Tvec v2 = vsx_ld(4, ptr); \ - Tvec v3 = vsx_ld(8, ptr); \ - static const vec_uchar16 flp = {0, 1, 2, 3, 12, 13, 14, 15, 16, 17, 18, 19, 28, 29, 30, 31}; \ - a = vec_perm(v1, vec_sld(v3, v2, 8), flp); \ - static const vec_uchar16 flp2 = {28, 29, 30, 31, 0, 1, 2, 3, 12, 13, 14, 15, 16, 17, 18, 19}; \ - b = vec_perm(v2, vec_sld(v1, v3, 8), flp2); \ - c = vec_perm(vec_sld(v2, v1, 8), v3, flp); \ -} -VSX_IMPL_ST_INTERLEAVE_3CH_4(uint, vec_uint4) -VSX_IMPL_ST_INTERLEAVE_3CH_4(int, vec_int4) -VSX_IMPL_ST_INTERLEAVE_3CH_4(float, vec_float4) - -#define VSX_IMPL_ST_INTERLEAVE_3CH_2(Tp, Tvec, ld_func, st_func) \ -VSX_FINLINE(void) vec_st_interleave(const Tvec& a, const Tvec& b, \ - const Tvec& c, Tp* ptr) \ -{ \ - st_func(vec_mergeh(a, b), 0, ptr); \ - st_func(vec_permi(c, a, 1), 2, ptr); \ - st_func(vec_mergel(b, c), 4, ptr); \ -} \ -VSX_FINLINE(void) vec_ld_deinterleave(const Tp* ptr, Tvec& a, \ - Tvec& b, Tvec& c) \ -{ \ - Tvec v1 = ld_func(0, ptr); \ - Tvec v2 = ld_func(2, ptr); \ - Tvec v3 = ld_func(4, ptr); \ - a = vec_permi(v1, v2, 1); \ - b = vec_permi(v1, v3, 2); \ - c = vec_permi(v2, v3, 1); \ -} -VSX_IMPL_ST_INTERLEAVE_3CH_2(int64, vec_dword2, vsx_ld2, vsx_st2) -VSX_IMPL_ST_INTERLEAVE_3CH_2(uint64, vec_udword2, vsx_ld2, vsx_st2) -VSX_IMPL_ST_INTERLEAVE_3CH_2(double, vec_double2, vsx_ld, vsx_st) - -#endif // CV_VSX - -//! @} - -#endif // OPENCV_HAL_VSX_UTILS_HPP diff --git a/opencv/include/opencv2/core/wimage.hpp b/opencv/include/opencv2/core/wimage.hpp deleted file mode 100644 index c7b6efa..0000000 --- a/opencv/include/opencv2/core/wimage.hpp +++ /dev/null @@ -1,603 +0,0 @@ -/*M////////////////////////////////////////////////////////////////////////////// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to -// this license. If you do not agree to this license, do not download, -// install, copy or use the software. -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2008, Google, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of Intel Corporation or contributors may not be used to endorse -// or promote products derived from this software without specific -// prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" -// and any express or implied warranties, including, but not limited to, the -// implied warranties of merchantability and fitness for a particular purpose -// are disclaimed. In no event shall the Intel Corporation or contributors be -// liable for any direct, indirect, incidental, special, exemplary, or -// consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -///////////////////////////////////////////////////////////////////////////////// -//M*/ - -#ifndef OPENCV_CORE_WIMAGE_HPP -#define OPENCV_CORE_WIMAGE_HPP - -#include "opencv2/core/core_c.h" - -#ifdef __cplusplus - -namespace cv { - -//! @addtogroup core -//! @{ - -template class WImage; -template class WImageBuffer; -template class WImageView; - -template class WImageC; -template class WImageBufferC; -template class WImageViewC; - -// Commonly used typedefs. -typedef WImage WImage_b; -typedef WImageView WImageView_b; -typedef WImageBuffer WImageBuffer_b; - -typedef WImageC WImage1_b; -typedef WImageViewC WImageView1_b; -typedef WImageBufferC WImageBuffer1_b; - -typedef WImageC WImage3_b; -typedef WImageViewC WImageView3_b; -typedef WImageBufferC WImageBuffer3_b; - -typedef WImage WImage_f; -typedef WImageView WImageView_f; -typedef WImageBuffer WImageBuffer_f; - -typedef WImageC WImage1_f; -typedef WImageViewC WImageView1_f; -typedef WImageBufferC WImageBuffer1_f; - -typedef WImageC WImage3_f; -typedef WImageViewC WImageView3_f; -typedef WImageBufferC WImageBuffer3_f; - -// There isn't a standard for signed and unsigned short so be more -// explicit in the typename for these cases. -typedef WImage WImage_16s; -typedef WImageView WImageView_16s; -typedef WImageBuffer WImageBuffer_16s; - -typedef WImageC WImage1_16s; -typedef WImageViewC WImageView1_16s; -typedef WImageBufferC WImageBuffer1_16s; - -typedef WImageC WImage3_16s; -typedef WImageViewC WImageView3_16s; -typedef WImageBufferC WImageBuffer3_16s; - -typedef WImage WImage_16u; -typedef WImageView WImageView_16u; -typedef WImageBuffer WImageBuffer_16u; - -typedef WImageC WImage1_16u; -typedef WImageViewC WImageView1_16u; -typedef WImageBufferC WImageBuffer1_16u; - -typedef WImageC WImage3_16u; -typedef WImageViewC WImageView3_16u; -typedef WImageBufferC WImageBuffer3_16u; - -/** @brief Image class which provides a thin layer around an IplImage. - -The goals of the class design are: - - -# All the data has explicit ownership to avoid memory leaks - -# No hidden allocations or copies for performance. - -# Easy access to OpenCV methods (which will access IPP if available) - -# Can easily treat external data as an image - -# Easy to create images which are subsets of other images - -# Fast pixel access which can take advantage of number of channels if known at compile time. - -The WImage class is the image class which provides the data accessors. The 'W' comes from the fact -that it is also a wrapper around the popular but inconvenient IplImage class. A WImage can be -constructed either using a WImageBuffer class which allocates and frees the data, or using a -WImageView class which constructs a subimage or a view into external data. The view class does no -memory management. Each class actually has two versions, one when the number of channels is known -at compile time and one when it isn't. Using the one with the number of channels specified can -provide some compile time optimizations by using the fact that the number of channels is a -constant. - -We use the convention (c,r) to refer to column c and row r with (0,0) being the upper left corner. -This is similar to standard Euclidean coordinates with the first coordinate varying in the -horizontal direction and the second coordinate varying in the vertical direction. Thus (c,r) is -usually in the domain [0, width) X [0, height) - -Example usage: -@code -WImageBuffer3_b im(5,7); // Make a 5X7 3 channel image of type uchar -WImageView3_b sub_im(im, 2,2, 3,3); // 3X3 submatrix -vector vec(10, 3.0f); -WImageView1_f user_im(&vec[0], 2, 5); // 2X5 image w/ supplied data - -im.SetZero(); // same as cvSetZero(im.Ipl()) -*im(2, 3) = 15; // Modify the element at column 2, row 3 -MySetRand(&sub_im); - -// Copy the second row into the first. This can be done with no memory -// allocation and will use SSE if IPP is available. -int w = im.Width(); -im.View(0,0, w,1).CopyFrom(im.View(0,1, w,1)); - -// Doesn't care about source of data since using WImage -void MySetRand(WImage_b* im) { // Works with any number of channels -for (int r = 0; r < im->Height(); ++r) { - float* row = im->Row(r); - for (int c = 0; c < im->Width(); ++c) { - for (int ch = 0; ch < im->Channels(); ++ch, ++row) { - *row = uchar(rand() & 255); - } - } -} -} -@endcode - -Functions that are not part of the basic image allocation, viewing, and access should come from -OpenCV, except some useful functions that are not part of OpenCV can be found in wimage_util.h -*/ -template -class WImage -{ -public: - typedef T BaseType; - - // WImage is an abstract class with no other virtual methods so make the - // destructor virtual. - virtual ~WImage() = 0; - - // Accessors - IplImage* Ipl() {return image_; } - const IplImage* Ipl() const {return image_; } - T* ImageData() { return reinterpret_cast(image_->imageData); } - const T* ImageData() const { - return reinterpret_cast(image_->imageData); - } - - int Width() const {return image_->width; } - int Height() const {return image_->height; } - - // WidthStep is the number of bytes to go to the pixel with the next y coord - int WidthStep() const {return image_->widthStep; } - - int Channels() const {return image_->nChannels; } - int ChannelSize() const {return sizeof(T); } // number of bytes per channel - - // Number of bytes per pixel - int PixelSize() const {return Channels() * ChannelSize(); } - - // Return depth type (e.g. IPL_DEPTH_8U, IPL_DEPTH_32F) which is the number - // of bits per channel and with the signed bit set. - // This is known at compile time using specializations. - int Depth() const; - - inline const T* Row(int r) const { - return reinterpret_cast(image_->imageData + r*image_->widthStep); - } - - inline T* Row(int r) { - return reinterpret_cast(image_->imageData + r*image_->widthStep); - } - - // Pixel accessors which returns a pointer to the start of the channel - inline T* operator() (int c, int r) { - return reinterpret_cast(image_->imageData + r*image_->widthStep) + - c*Channels(); - } - - inline const T* operator() (int c, int r) const { - return reinterpret_cast(image_->imageData + r*image_->widthStep) + - c*Channels(); - } - - // Copy the contents from another image which is just a convenience to cvCopy - void CopyFrom(const WImage& src) { cvCopy(src.Ipl(), image_); } - - // Set contents to zero which is just a convenient to cvSetZero - void SetZero() { cvSetZero(image_); } - - // Construct a view into a region of this image - WImageView View(int c, int r, int width, int height); - -protected: - // Disallow copy and assignment - WImage(const WImage&); - void operator=(const WImage&); - - explicit WImage(IplImage* img) : image_(img) { - assert(!img || img->depth == Depth()); - } - - void SetIpl(IplImage* image) { - assert(!image || image->depth == Depth()); - image_ = image; - } - - IplImage* image_; -}; - - -/** Image class when both the pixel type and number of channels -are known at compile time. This wrapper will speed up some of the operations -like accessing individual pixels using the () operator. -*/ -template -class WImageC : public WImage -{ -public: - typedef typename WImage::BaseType BaseType; - enum { kChannels = C }; - - explicit WImageC(IplImage* img) : WImage(img) { - assert(!img || img->nChannels == Channels()); - } - - // Construct a view into a region of this image - WImageViewC View(int c, int r, int width, int height); - - // Copy the contents from another image which is just a convenience to cvCopy - void CopyFrom(const WImageC& src) { - cvCopy(src.Ipl(), WImage::image_); - } - - // WImageC is an abstract class with no other virtual methods so make the - // destructor virtual. - virtual ~WImageC() = 0; - - int Channels() const {return C; } - -protected: - // Disallow copy and assignment - WImageC(const WImageC&); - void operator=(const WImageC&); - - void SetIpl(IplImage* image) { - assert(!image || image->depth == WImage::Depth()); - WImage::SetIpl(image); - } -}; - -/** Image class which owns the data, so it can be allocated and is always -freed. It cannot be copied but can be explicitly cloned. -*/ -template -class WImageBuffer : public WImage -{ -public: - typedef typename WImage::BaseType BaseType; - - // Default constructor which creates an object that can be - WImageBuffer() : WImage(0) {} - - WImageBuffer(int width, int height, int nchannels) : WImage(0) { - Allocate(width, height, nchannels); - } - - // Constructor which takes ownership of a given IplImage so releases - // the image on destruction. - explicit WImageBuffer(IplImage* img) : WImage(img) {} - - // Allocate an image. Does nothing if current size is the same as - // the new size. - void Allocate(int width, int height, int nchannels); - - // Set the data to point to an image, releasing the old data - void SetIpl(IplImage* img) { - ReleaseImage(); - WImage::SetIpl(img); - } - - // Clone an image which reallocates the image if of a different dimension. - void CloneFrom(const WImage& src) { - Allocate(src.Width(), src.Height(), src.Channels()); - CopyFrom(src); - } - - ~WImageBuffer() { - ReleaseImage(); - } - - // Release the image if it isn't null. - void ReleaseImage() { - if (WImage::image_) { - IplImage* image = WImage::image_; - cvReleaseImage(&image); - WImage::SetIpl(0); - } - } - - bool IsNull() const {return WImage::image_ == NULL; } - -private: - // Disallow copy and assignment - WImageBuffer(const WImageBuffer&); - void operator=(const WImageBuffer&); -}; - -/** Like a WImageBuffer class but when the number of channels is known at compile time. -*/ -template -class WImageBufferC : public WImageC -{ -public: - typedef typename WImage::BaseType BaseType; - enum { kChannels = C }; - - // Default constructor which creates an object that can be - WImageBufferC() : WImageC(0) {} - - WImageBufferC(int width, int height) : WImageC(0) { - Allocate(width, height); - } - - // Constructor which takes ownership of a given IplImage so releases - // the image on destruction. - explicit WImageBufferC(IplImage* img) : WImageC(img) {} - - // Allocate an image. Does nothing if current size is the same as - // the new size. - void Allocate(int width, int height); - - // Set the data to point to an image, releasing the old data - void SetIpl(IplImage* img) { - ReleaseImage(); - WImageC::SetIpl(img); - } - - // Clone an image which reallocates the image if of a different dimension. - void CloneFrom(const WImageC& src) { - Allocate(src.Width(), src.Height()); - CopyFrom(src); - } - - ~WImageBufferC() { - ReleaseImage(); - } - - // Release the image if it isn't null. - void ReleaseImage() { - if (WImage::image_) { - IplImage* image = WImage::image_; - cvReleaseImage(&image); - WImageC::SetIpl(0); - } - } - - bool IsNull() const {return WImage::image_ == NULL; } - -private: - // Disallow copy and assignment - WImageBufferC(const WImageBufferC&); - void operator=(const WImageBufferC&); -}; - -/** View into an image class which allows treating a subimage as an image or treating external data -as an image -*/ -template class WImageView : public WImage -{ -public: - typedef typename WImage::BaseType BaseType; - - // Construct a subimage. No checks are done that the subimage lies - // completely inside the original image. - WImageView(WImage* img, int c, int r, int width, int height); - - // Refer to external data. - // If not given width_step assumed to be same as width. - WImageView(T* data, int width, int height, int channels, int width_step = -1); - - // Refer to external data. This does NOT take ownership - // of the supplied IplImage. - WImageView(IplImage* img) : WImage(img) {} - - // Copy constructor - WImageView(const WImage& img) : WImage(0) { - header_ = *(img.Ipl()); - WImage::SetIpl(&header_); - } - - WImageView& operator=(const WImage& img) { - header_ = *(img.Ipl()); - WImage::SetIpl(&header_); - return *this; - } - -protected: - IplImage header_; -}; - - -template -class WImageViewC : public WImageC -{ -public: - typedef typename WImage::BaseType BaseType; - enum { kChannels = C }; - - // Default constructor needed for vectors of views. - WImageViewC(); - - virtual ~WImageViewC() {} - - // Construct a subimage. No checks are done that the subimage lies - // completely inside the original image. - WImageViewC(WImageC* img, - int c, int r, int width, int height); - - // Refer to external data - WImageViewC(T* data, int width, int height, int width_step = -1); - - // Refer to external data. This does NOT take ownership - // of the supplied IplImage. - WImageViewC(IplImage* img) : WImageC(img) {} - - // Copy constructor which does a shallow copy to allow multiple views - // of same data. gcc-4.1.1 gets confused if both versions of - // the constructor and assignment operator are not provided. - WImageViewC(const WImageC& img) : WImageC(0) { - header_ = *(img.Ipl()); - WImageC::SetIpl(&header_); - } - WImageViewC(const WImageViewC& img) : WImageC(0) { - header_ = *(img.Ipl()); - WImageC::SetIpl(&header_); - } - - WImageViewC& operator=(const WImageC& img) { - header_ = *(img.Ipl()); - WImageC::SetIpl(&header_); - return *this; - } - WImageViewC& operator=(const WImageViewC& img) { - header_ = *(img.Ipl()); - WImageC::SetIpl(&header_); - return *this; - } - -protected: - IplImage header_; -}; - - -// Specializations for depth -template<> -inline int WImage::Depth() const {return IPL_DEPTH_8U; } -template<> -inline int WImage::Depth() const {return IPL_DEPTH_8S; } -template<> -inline int WImage::Depth() const {return IPL_DEPTH_16S; } -template<> -inline int WImage::Depth() const {return IPL_DEPTH_16U; } -template<> -inline int WImage::Depth() const {return IPL_DEPTH_32S; } -template<> -inline int WImage::Depth() const {return IPL_DEPTH_32F; } -template<> -inline int WImage::Depth() const {return IPL_DEPTH_64F; } - -template inline WImage::~WImage() {} -template inline WImageC::~WImageC() {} - -template -inline void WImageBuffer::Allocate(int width, int height, int nchannels) -{ - if (IsNull() || WImage::Width() != width || - WImage::Height() != height || WImage::Channels() != nchannels) { - ReleaseImage(); - WImage::image_ = cvCreateImage(cvSize(width, height), - WImage::Depth(), nchannels); - } -} - -template -inline void WImageBufferC::Allocate(int width, int height) -{ - if (IsNull() || WImage::Width() != width || WImage::Height() != height) { - ReleaseImage(); - WImageC::SetIpl(cvCreateImage(cvSize(width, height),WImage::Depth(), C)); - } -} - -template -WImageView::WImageView(WImage* img, int c, int r, int width, int height) - : WImage(0) -{ - header_ = *(img->Ipl()); - header_.imageData = reinterpret_cast((*img)(c, r)); - header_.width = width; - header_.height = height; - WImage::SetIpl(&header_); -} - -template -WImageView::WImageView(T* data, int width, int height, int nchannels, int width_step) - : WImage(0) -{ - cvInitImageHeader(&header_, cvSize(width, height), WImage::Depth(), nchannels); - header_.imageData = reinterpret_cast(data); - if (width_step > 0) { - header_.widthStep = width_step; - } - WImage::SetIpl(&header_); -} - -template -WImageViewC::WImageViewC(WImageC* img, int c, int r, int width, int height) - : WImageC(0) -{ - header_ = *(img->Ipl()); - header_.imageData = reinterpret_cast((*img)(c, r)); - header_.width = width; - header_.height = height; - WImageC::SetIpl(&header_); -} - -template -WImageViewC::WImageViewC() : WImageC(0) { - cvInitImageHeader(&header_, cvSize(0, 0), WImage::Depth(), C); - header_.imageData = reinterpret_cast(0); - WImageC::SetIpl(&header_); -} - -template -WImageViewC::WImageViewC(T* data, int width, int height, int width_step) - : WImageC(0) -{ - cvInitImageHeader(&header_, cvSize(width, height), WImage::Depth(), C); - header_.imageData = reinterpret_cast(data); - if (width_step > 0) { - header_.widthStep = width_step; - } - WImageC::SetIpl(&header_); -} - -// Construct a view into a region of an image -template -WImageView WImage::View(int c, int r, int width, int height) { - return WImageView(this, c, r, width, height); -} - -template -WImageViewC WImageC::View(int c, int r, int width, int height) { - return WImageViewC(this, c, r, width, height); -} - -//! @} core - -} // end of namespace - -#endif // __cplusplus - -#endif diff --git a/opencv/include/opencv2/cvconfig.h b/opencv/include/opencv2/cvconfig.h deleted file mode 100644 index 1c91916..0000000 --- a/opencv/include/opencv2/cvconfig.h +++ /dev/null @@ -1,251 +0,0 @@ -#ifndef OPENCV_CVCONFIG_H_INCLUDED -#define OPENCV_CVCONFIG_H_INCLUDED - -/* OpenCV compiled as static or dynamic libs */ -#define BUILD_SHARED_LIBS - -/* OpenCV intrinsics optimized code */ -#define CV_ENABLE_INTRINSICS - -/* OpenCV additional optimized code */ -/* #undef CV_DISABLE_OPTIMIZATION */ - -/* Compile for 'real' NVIDIA GPU architectures */ -#define CUDA_ARCH_BIN "" - -/* Create PTX or BIN for 1.0 compute capability */ -/* #undef CUDA_ARCH_BIN_OR_PTX_10 */ - -/* NVIDIA GPU features are used */ -#define CUDA_ARCH_FEATURES "" - -/* Compile for 'virtual' NVIDIA PTX architectures */ -#define CUDA_ARCH_PTX "" - -/* AVFoundation video libraries */ -/* #undef HAVE_AVFOUNDATION */ - -/* V4L capturing support */ -/* #undef HAVE_CAMV4L */ - -/* V4L2 capturing support */ -/* #undef HAVE_CAMV4L2 */ - -/* Carbon windowing environment */ -/* #undef HAVE_CARBON */ - -/* AMD's Basic Linear Algebra Subprograms Library*/ -/* #undef HAVE_CLAMDBLAS */ - -/* AMD's OpenCL Fast Fourier Transform Library*/ -/* #undef HAVE_CLAMDFFT */ - -/* Clp support */ -/* #undef HAVE_CLP */ - -/* Cocoa API */ -/* #undef HAVE_COCOA */ - -/* C= */ -/* #undef HAVE_CSTRIPES */ - -/* NVIDIA CUDA Basic Linear Algebra Subprograms (BLAS) API*/ -/* #undef HAVE_CUBLAS */ - -/* NVIDIA CUDA Runtime API*/ -/* #undef HAVE_CUDA */ - -/* NVIDIA CUDA Fast Fourier Transform (FFT) API*/ -/* #undef HAVE_CUFFT */ - -/* IEEE1394 capturing support */ -/* #undef HAVE_DC1394 */ - -/* IEEE1394 capturing support - libdc1394 v2.x */ -/* #undef HAVE_DC1394_2 */ - -/* DirectX */ -#define HAVE_DIRECTX -#define HAVE_DIRECTX_NV12 -#define HAVE_D3D11 -#define HAVE_D3D10 -#define HAVE_D3D9 - -/* DirectShow Video Capture library */ -#define HAVE_DSHOW - -/* Eigen Matrix & Linear Algebra Library */ -/* #undef HAVE_EIGEN */ - -/* FFMpeg video library */ -/* #undef HAVE_FFMPEG */ - -/* Geospatial Data Abstraction Library */ -/* #undef HAVE_GDAL */ - -/* GStreamer multimedia framework */ -/* #undef HAVE_GSTREAMER */ - -/* GTK+ 2.0 Thread support */ -/* #undef HAVE_GTHREAD */ - -/* GTK+ 2.x toolkit */ -/* #undef HAVE_GTK */ - -/* Halide support */ -/* #undef HAVE_HALIDE */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Intel Perceptual Computing SDK library */ -/* #undef HAVE_INTELPERC */ - -/* Intel Integrated Performance Primitives */ -/* #undef HAVE_IPP */ -/* #undef HAVE_IPP_ICV */ -/* #undef HAVE_IPP_IW */ -/* #undef HAVE_IPP_IW_LL */ - -/* JPEG-2000 codec */ -#define HAVE_JASPER - -/* IJG JPEG codec */ -#define HAVE_JPEG - -/* libpng/png.h needs to be included */ -/* #undef HAVE_LIBPNG_PNG_H */ - -/* GDCM DICOM codec */ -/* #undef HAVE_GDCM */ - -/* V4L/V4L2 capturing support via libv4l */ -/* #undef HAVE_LIBV4L */ - -/* Microsoft Media Foundation Capture library */ -#define HAVE_MSMF - -/* NVIDIA Video Decoding API*/ -/* #undef HAVE_NVCUVID */ - -/* NVIDIA Video Encoding API*/ -/* #undef HAVE_NVCUVENC */ - -/* OpenCL Support */ -#define HAVE_OPENCL -/* #undef HAVE_OPENCL_STATIC */ -/* #undef HAVE_OPENCL_SVM */ - -/* NVIDIA OpenCL D3D Extensions support */ -#define HAVE_OPENCL_D3D11_NV - -/* OpenEXR codec */ -#define HAVE_OPENEXR - -/* OpenGL support*/ -/* #undef HAVE_OPENGL */ - -/* OpenNI library */ -/* #undef HAVE_OPENNI */ - -/* OpenNI library */ -/* #undef HAVE_OPENNI2 */ - -/* PNG codec */ -#define HAVE_PNG - -/* Posix threads (pthreads) */ -/* #undef HAVE_PTHREAD */ - -/* parallel_for with pthreads */ -/* #undef HAVE_PTHREADS_PF */ - -/* Qt support */ -/* #undef HAVE_QT */ - -/* Qt OpenGL support */ -/* #undef HAVE_QT_OPENGL */ - -/* QuickTime video libraries */ -/* #undef HAVE_QUICKTIME */ - -/* QTKit video libraries */ -/* #undef HAVE_QTKIT */ - -/* Intel Threading Building Blocks */ -/* #undef HAVE_TBB */ - -/* TIFF codec */ -#define HAVE_TIFF - -/* Unicap video capture library */ -/* #undef HAVE_UNICAP */ - -/* Video for Windows support */ -/* #undef HAVE_VFW */ - -/* V4L2 capturing support in videoio.h */ -/* #undef HAVE_VIDEOIO */ - -/* Win32 UI */ -#define HAVE_WIN32UI - -/* XIMEA camera support */ -/* #undef HAVE_XIMEA */ - -/* Xine video library */ -/* #undef HAVE_XINE */ - -/* Define if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* gPhoto2 library */ -/* #undef HAVE_GPHOTO2 */ - -/* VA library (libva) */ -/* #undef HAVE_VA */ - -/* Intel VA-API/OpenCL */ -/* #undef HAVE_VA_INTEL */ - -/* Intel Media SDK */ -/* #undef HAVE_MFX */ - -/* Lapack */ -/* #undef HAVE_LAPACK */ - -/* Library was compiled with functions instrumentation */ -/* #undef ENABLE_INSTRUMENTATION */ - -/* OpenVX */ -/* #undef HAVE_OPENVX */ - -#if defined(HAVE_XINE) || \ - defined(HAVE_GSTREAMER) || \ - defined(HAVE_QUICKTIME) || \ - defined(HAVE_QTKIT) || \ - defined(HAVE_AVFOUNDATION) || \ - /*defined(HAVE_OPENNI) || too specialized */ \ - defined(HAVE_FFMPEG) || \ - defined(HAVE_MSMF) -#define HAVE_VIDEO_INPUT -#endif - -#if /*defined(HAVE_XINE) || */\ - defined(HAVE_GSTREAMER) || \ - defined(HAVE_QUICKTIME) || \ - defined(HAVE_QTKIT) || \ - defined(HAVE_AVFOUNDATION) || \ - defined(HAVE_FFMPEG) || \ - defined(HAVE_MSMF) -#define HAVE_VIDEO_OUTPUT -#endif - -/* OpenCV trace utilities */ -#define OPENCV_TRACE - -/* Library QR-code decoding */ -#define HAVE_QUIRC - -#endif // OPENCV_CVCONFIG_H_INCLUDED diff --git a/opencv/include/opencv2/dnn.hpp b/opencv/include/opencv2/dnn.hpp deleted file mode 100644 index 97f2fe3..0000000 --- a/opencv/include/opencv2/dnn.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_DNN_HPP -#define OPENCV_DNN_HPP - -// This is an umbrella header to include into you project. -// We are free to change headers layout in dnn subfolder, so please include -// this header for future compatibility - - -/** @defgroup dnn Deep Neural Network module - @{ - This module contains: - - API for new layers creation, layers are building bricks of neural networks; - - set of built-in most-useful Layers; - - API to construct and modify comprehensive neural networks from layers; - - functionality for loading serialized networks models from different frameworks. - - Functionality of this module is designed only for forward pass computations (i.e. network testing). - A network training is in principle not supported. - @} -*/ -/** @example samples/dnn/classification.cpp -Check @ref tutorial_dnn_googlenet "the corresponding tutorial" for more details -*/ -/** @example samples/dnn/colorization.cpp -*/ -/** @example samples/dnn/object_detection.cpp -Check @ref tutorial_dnn_yolo "the corresponding tutorial" for more details -*/ -/** @example samples/dnn/openpose.cpp -*/ -/** @example samples/dnn/segmentation.cpp -*/ -/** @example samples/dnn/text_detection.cpp -*/ -#include - -#endif /* OPENCV_DNN_HPP */ diff --git a/opencv/include/opencv2/dnn/all_layers.hpp b/opencv/include/opencv2/dnn/all_layers.hpp deleted file mode 100644 index c6fe6d0..0000000 --- a/opencv/include/opencv2/dnn/all_layers.hpp +++ /dev/null @@ -1,634 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_DNN_DNN_ALL_LAYERS_HPP -#define OPENCV_DNN_DNN_ALL_LAYERS_HPP -#include - -namespace cv { -namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN -//! @addtogroup dnn -//! @{ - -/** @defgroup dnnLayerList Partial List of Implemented Layers - @{ - This subsection of dnn module contains information about built-in layers and their descriptions. - - Classes listed here, in fact, provides C++ API for creating instances of built-in layers. - In addition to this way of layers instantiation, there is a more common factory API (see @ref dnnLayerFactory), it allows to create layers dynamically (by name) and register new ones. - You can use both API, but factory API is less convenient for native C++ programming and basically designed for use inside importers (see @ref readNetFromCaffe(), @ref readNetFromTorch(), @ref readNetFromTensorflow()). - - Built-in layers partially reproduce functionality of corresponding Caffe and Torch7 layers. - In particular, the following layers and Caffe importer were tested to reproduce Caffe functionality: - - Convolution - - Deconvolution - - Pooling - - InnerProduct - - TanH, ReLU, Sigmoid, BNLL, Power, AbsVal - - Softmax - - Reshape, Flatten, Slice, Split - - LRN - - MVN - - Dropout (since it does nothing on forward pass -)) -*/ - - class CV_EXPORTS BlankLayer : public Layer - { - public: - static Ptr create(const LayerParams ¶ms); - }; - - /** - * Constant layer produces the same data blob at an every forward pass. - */ - class CV_EXPORTS ConstLayer : public Layer - { - public: - static Ptr create(const LayerParams ¶ms); - }; - - //! LSTM recurrent layer - class CV_EXPORTS LSTMLayer : public Layer - { - public: - /** Creates instance of LSTM layer */ - static Ptr create(const LayerParams& params); - - /** @deprecated Use LayerParams::blobs instead. - @brief Set trained weights for LSTM layer. - - LSTM behavior on each step is defined by current input, previous output, previous cell state and learned weights. - - Let @f$x_t@f$ be current input, @f$h_t@f$ be current output, @f$c_t@f$ be current state. - Than current output and current cell state is computed as follows: - @f{eqnarray*}{ - h_t &= o_t \odot tanh(c_t), \\ - c_t &= f_t \odot c_{t-1} + i_t \odot g_t, \\ - @f} - where @f$\odot@f$ is per-element multiply operation and @f$i_t, f_t, o_t, g_t@f$ is internal gates that are computed using learned wights. - - Gates are computed as follows: - @f{eqnarray*}{ - i_t &= sigmoid&(W_{xi} x_t + W_{hi} h_{t-1} + b_i), \\ - f_t &= sigmoid&(W_{xf} x_t + W_{hf} h_{t-1} + b_f), \\ - o_t &= sigmoid&(W_{xo} x_t + W_{ho} h_{t-1} + b_o), \\ - g_t &= tanh &(W_{xg} x_t + W_{hg} h_{t-1} + b_g), \\ - @f} - where @f$W_{x?}@f$, @f$W_{h?}@f$ and @f$b_{?}@f$ are learned weights represented as matrices: - @f$W_{x?} \in R^{N_h \times N_x}@f$, @f$W_{h?} \in R^{N_h \times N_h}@f$, @f$b_? \in R^{N_h}@f$. - - For simplicity and performance purposes we use @f$ W_x = [W_{xi}; W_{xf}; W_{xo}, W_{xg}] @f$ - (i.e. @f$W_x@f$ is vertical concatenation of @f$ W_{x?} @f$), @f$ W_x \in R^{4N_h \times N_x} @f$. - The same for @f$ W_h = [W_{hi}; W_{hf}; W_{ho}, W_{hg}], W_h \in R^{4N_h \times N_h} @f$ - and for @f$ b = [b_i; b_f, b_o, b_g]@f$, @f$b \in R^{4N_h} @f$. - - @param Wh is matrix defining how previous output is transformed to internal gates (i.e. according to above mentioned notation is @f$ W_h @f$) - @param Wx is matrix defining how current input is transformed to internal gates (i.e. according to above mentioned notation is @f$ W_x @f$) - @param b is bias vector (i.e. according to above mentioned notation is @f$ b @f$) - */ - CV_DEPRECATED virtual void setWeights(const Mat &Wh, const Mat &Wx, const Mat &b) = 0; - - /** @brief Specifies shape of output blob which will be [[`T`], `N`] + @p outTailShape. - * @details If this parameter is empty or unset then @p outTailShape = [`Wh`.size(0)] will be used, - * where `Wh` is parameter from setWeights(). - */ - virtual void setOutShape(const MatShape &outTailShape = MatShape()) = 0; - - /** @deprecated Use flag `produce_cell_output` in LayerParams. - * @brief Specifies either interpret first dimension of input blob as timestamp dimenion either as sample. - * - * If flag is set to true then shape of input blob will be interpreted as [`T`, `N`, `[data dims]`] where `T` specifies number of timestamps, `N` is number of independent streams. - * In this case each forward() call will iterate through `T` timestamps and update layer's state `T` times. - * - * If flag is set to false then shape of input blob will be interpreted as [`N`, `[data dims]`]. - * In this case each forward() call will make one iteration and produce one timestamp with shape [`N`, `[out dims]`]. - */ - CV_DEPRECATED virtual void setUseTimstampsDim(bool use = true) = 0; - - /** @deprecated Use flag `use_timestamp_dim` in LayerParams. - * @brief If this flag is set to true then layer will produce @f$ c_t @f$ as second output. - * @details Shape of the second output is the same as first output. - */ - CV_DEPRECATED virtual void setProduceCellOutput(bool produce = false) = 0; - - /* In common case it use single input with @f$x_t@f$ values to compute output(s) @f$h_t@f$ (and @f$c_t@f$). - * @param input should contain packed values @f$x_t@f$ - * @param output contains computed outputs: @f$h_t@f$ (and @f$c_t@f$ if setProduceCellOutput() flag was set to true). - * - * If setUseTimstampsDim() is set to true then @p input[0] should has at least two dimensions with the following shape: [`T`, `N`, `[data dims]`], - * where `T` specifies number of timestamps, `N` is number of independent streams (i.e. @f$ x_{t_0 + t}^{stream} @f$ is stored inside @p input[0][t, stream, ...]). - * - * If setUseTimstampsDim() is set to false then @p input[0] should contain single timestamp, its shape should has form [`N`, `[data dims]`] with at least one dimension. - * (i.e. @f$ x_{t}^{stream} @f$ is stored inside @p input[0][stream, ...]). - */ - - int inputNameToIndex(String inputName) CV_OVERRIDE; - int outputNameToIndex(const String& outputName) CV_OVERRIDE; - }; - - /** @brief Classical recurrent layer - - Accepts two inputs @f$x_t@f$ and @f$h_{t-1}@f$ and compute two outputs @f$o_t@f$ and @f$h_t@f$. - - - input: should contain packed input @f$x_t@f$. - - output: should contain output @f$o_t@f$ (and @f$h_t@f$ if setProduceHiddenOutput() is set to true). - - input[0] should have shape [`T`, `N`, `data_dims`] where `T` and `N` is number of timestamps and number of independent samples of @f$x_t@f$ respectively. - - output[0] will have shape [`T`, `N`, @f$N_o@f$], where @f$N_o@f$ is number of rows in @f$ W_{xo} @f$ matrix. - - If setProduceHiddenOutput() is set to true then @p output[1] will contain a Mat with shape [`T`, `N`, @f$N_h@f$], where @f$N_h@f$ is number of rows in @f$ W_{hh} @f$ matrix. - */ - class CV_EXPORTS RNNLayer : public Layer - { - public: - /** Creates instance of RNNLayer */ - static Ptr create(const LayerParams& params); - - /** Setups learned weights. - - Recurrent-layer behavior on each step is defined by current input @f$ x_t @f$, previous state @f$ h_t @f$ and learned weights as follows: - @f{eqnarray*}{ - h_t &= tanh&(W_{hh} h_{t-1} + W_{xh} x_t + b_h), \\ - o_t &= tanh&(W_{ho} h_t + b_o), - @f} - - @param Wxh is @f$ W_{xh} @f$ matrix - @param bh is @f$ b_{h} @f$ vector - @param Whh is @f$ W_{hh} @f$ matrix - @param Who is @f$ W_{xo} @f$ matrix - @param bo is @f$ b_{o} @f$ vector - */ - virtual void setWeights(const Mat &Wxh, const Mat &bh, const Mat &Whh, const Mat &Who, const Mat &bo) = 0; - - /** @brief If this flag is set to true then layer will produce @f$ h_t @f$ as second output. - * @details Shape of the second output is the same as first output. - */ - virtual void setProduceHiddenOutput(bool produce = false) = 0; - - }; - - class CV_EXPORTS BaseConvolutionLayer : public Layer - { - public: - Size kernel, stride, pad, dilation, adjustPad; - String padMode; - int numOutput; - }; - - class CV_EXPORTS ConvolutionLayer : public BaseConvolutionLayer - { - public: - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS DeconvolutionLayer : public BaseConvolutionLayer - { - public: - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS LRNLayer : public Layer - { - public: - int type; - - int size; - float alpha, beta, bias; - bool normBySize; - - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS PoolingLayer : public Layer - { - public: - int type; - Size kernel, stride; - int pad_l, pad_t, pad_r, pad_b; - CV_DEPRECATED_EXTERNAL Size pad; - bool globalPooling; - bool computeMaxIdx; - String padMode; - bool ceilMode; - // If true for average pooling with padding, divide an every output region - // by a whole kernel area. Otherwise exclude zero padded values and divide - // by number of real values. - bool avePoolPaddedArea; - // ROIPooling parameters. - Size pooledSize; - float spatialScale; - // PSROIPooling parameters. - int psRoiOutChannels; - - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS SoftmaxLayer : public Layer - { - public: - bool logSoftMax; - - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS InnerProductLayer : public Layer - { - public: - int axis; - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS MVNLayer : public Layer - { - public: - float eps; - bool normVariance, acrossChannels; - - static Ptr create(const LayerParams& params); - }; - - /* Reshaping */ - - class CV_EXPORTS ReshapeLayer : public Layer - { - public: - MatShape newShapeDesc; - Range newShapeRange; - - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS FlattenLayer : public Layer - { - public: - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS ConcatLayer : public Layer - { - public: - int axis; - /** - * @brief Add zero padding in case of concatenation of blobs with different - * spatial sizes. - * - * Details: https://github.com/torch/nn/blob/master/doc/containers.md#depthconcat - */ - bool padding; - - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS SplitLayer : public Layer - { - public: - int outputsCount; //!< Number of copies that will be produced (is ignored when negative). - - static Ptr create(const LayerParams ¶ms); - }; - - /** - * Slice layer has several modes: - * 1. Caffe mode - * @param[in] axis Axis of split operation - * @param[in] slice_point Array of split points - * - * Number of output blobs equals to number of split points plus one. The - * first blob is a slice on input from 0 to @p slice_point[0] - 1 by @p axis, - * the second output blob is a slice of input from @p slice_point[0] to - * @p slice_point[1] - 1 by @p axis and the last output blob is a slice of - * input from @p slice_point[-1] up to the end of @p axis size. - * - * 2. TensorFlow mode - * @param begin Vector of start indices - * @param size Vector of sizes - * - * More convenient numpy-like slice. One and only output blob - * is a slice `input[begin[0]:begin[0]+size[0], begin[1]:begin[1]+size[1], ...]` - * - * 3. Torch mode - * @param axis Axis of split operation - * - * Split input blob on the equal parts by @p axis. - */ - class CV_EXPORTS SliceLayer : public Layer - { - public: - /** - * @brief Vector of slice ranges. - * - * The first dimension equals number of output blobs. - * Inner vector has slice ranges for the first number of input dimensions. - */ - std::vector > sliceRanges; - int axis; - - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS PermuteLayer : public Layer - { - public: - static Ptr create(const LayerParams& params); - }; - - /** - * Permute channels of 4-dimensional input blob. - * @param group Number of groups to split input channels and pick in turns - * into output blob. - * - * \f[ groupSize = \frac{number\ of\ channels}{group} \f] - * \f[ output(n, c, h, w) = input(n, groupSize \times (c \% group) + \lfloor \frac{c}{group} \rfloor, h, w) \f] - * Read more at https://arxiv.org/pdf/1707.01083.pdf - */ - class CV_EXPORTS ShuffleChannelLayer : public Layer - { - public: - static Ptr create(const LayerParams& params); - - int group; - }; - - /** - * @brief Adds extra values for specific axes. - * @param paddings Vector of paddings in format - * @code - * [ pad_before, pad_after, // [0]th dimension - * pad_before, pad_after, // [1]st dimension - * ... - * pad_before, pad_after ] // [n]th dimension - * @endcode - * that represents number of padded values at every dimension - * starting from the first one. The rest of dimensions won't - * be padded. - * @param value Value to be padded. Defaults to zero. - * @param type Padding type: 'constant', 'reflect' - * @param input_dims Torch's parameter. If @p input_dims is not equal to the - * actual input dimensionality then the `[0]th` dimension - * is considered as a batch dimension and @p paddings are shifted - * to a one dimension. Defaults to `-1` that means padding - * corresponding to @p paddings. - */ - class CV_EXPORTS PaddingLayer : public Layer - { - public: - static Ptr create(const LayerParams& params); - }; - - /* Activations */ - class CV_EXPORTS ActivationLayer : public Layer - { - public: - virtual void forwardSlice(const float* src, float* dst, int len, - size_t outPlaneSize, int cn0, int cn1) const = 0; - }; - - class CV_EXPORTS ReLULayer : public ActivationLayer - { - public: - float negativeSlope; - - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS ReLU6Layer : public ActivationLayer - { - public: - float minValue, maxValue; - - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS ChannelsPReLULayer : public ActivationLayer - { - public: - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS ELULayer : public ActivationLayer - { - public: - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS TanHLayer : public ActivationLayer - { - public: - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS SigmoidLayer : public ActivationLayer - { - public: - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS BNLLLayer : public ActivationLayer - { - public: - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS AbsLayer : public ActivationLayer - { - public: - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS PowerLayer : public ActivationLayer - { - public: - float power, scale, shift; - - static Ptr create(const LayerParams ¶ms); - }; - - /* Layers used in semantic segmentation */ - - class CV_EXPORTS CropLayer : public Layer - { - public: - int startAxis; - std::vector offset; - - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS EltwiseLayer : public Layer - { - public: - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS BatchNormLayer : public ActivationLayer - { - public: - bool hasWeights, hasBias; - float epsilon; - - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS MaxUnpoolLayer : public Layer - { - public: - Size poolKernel; - Size poolPad; - Size poolStride; - - static Ptr create(const LayerParams ¶ms); - }; - - class CV_EXPORTS ScaleLayer : public Layer - { - public: - bool hasBias; - int axis; - - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS ShiftLayer : public Layer - { - public: - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS PriorBoxLayer : public Layer - { - public: - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS ReorgLayer : public Layer - { - public: - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS RegionLayer : public Layer - { - public: - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS DetectionOutputLayer : public Layer - { - public: - static Ptr create(const LayerParams& params); - }; - - /** - * @brief \f$ L_p \f$ - normalization layer. - * @param p Normalization factor. The most common `p = 1` for \f$ L_1 \f$ - - * normalization or `p = 2` for \f$ L_2 \f$ - normalization or a custom one. - * @param eps Parameter \f$ \epsilon \f$ to prevent a division by zero. - * @param across_spatial If true, normalize an input across all non-batch dimensions. - * Otherwise normalize an every channel separately. - * - * Across spatial: - * @f[ - * norm = \sqrt[p]{\epsilon + \sum_{x, y, c} |src(x, y, c)|^p } \\ - * dst(x, y, c) = \frac{ src(x, y, c) }{norm} - * @f] - * - * Channel wise normalization: - * @f[ - * norm(c) = \sqrt[p]{\epsilon + \sum_{x, y} |src(x, y, c)|^p } \\ - * dst(x, y, c) = \frac{ src(x, y, c) }{norm(c)} - * @f] - * - * Where `x, y` - spatial coordinates, `c` - channel. - * - * An every sample in the batch is normalized separately. Optionally, - * output is scaled by the trained parameters. - */ - class CV_EXPORTS NormalizeBBoxLayer : public Layer - { - public: - float pnorm, epsilon; - CV_DEPRECATED_EXTERNAL bool acrossSpatial; - - static Ptr create(const LayerParams& params); - }; - - /** - * @brief Resize input 4-dimensional blob by nearest neighbor or bilinear strategy. - * - * Layer is used to support TensorFlow's resize_nearest_neighbor and resize_bilinear ops. - */ - class CV_EXPORTS ResizeLayer : public Layer - { - public: - static Ptr create(const LayerParams& params); - }; - - /** - * @brief Bilinear resize layer from https://github.com/cdmh/deeplab-public - * - * It differs from @ref ResizeLayer in output shape and resize scales computations. - */ - class CV_EXPORTS InterpLayer : public Layer - { - public: - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS ProposalLayer : public Layer - { - public: - static Ptr create(const LayerParams& params); - }; - - class CV_EXPORTS CropAndResizeLayer : public Layer - { - public: - static Ptr create(const LayerParams& params); - }; - -//! @} -//! @} -CV__DNN_EXPERIMENTAL_NS_END -} -} -#endif diff --git a/opencv/include/opencv2/dnn/dict.hpp b/opencv/include/opencv2/dnn/dict.hpp deleted file mode 100644 index 60c2aa5..0000000 --- a/opencv/include/opencv2/dnn/dict.hpp +++ /dev/null @@ -1,160 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#include -#include -#include - -#include - -#ifndef OPENCV_DNN_DNN_DICT_HPP -#define OPENCV_DNN_DNN_DICT_HPP - -namespace cv { -namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN -//! @addtogroup dnn -//! @{ - -/** @brief This struct stores the scalar value (or array) of one of the following type: double, cv::String or int64. - * @todo Maybe int64 is useless because double type exactly stores at least 2^52 integers. - */ -struct CV_EXPORTS_W DictValue -{ - DictValue(const DictValue &r); - DictValue(bool i) : type(Param::INT), pi(new AutoBuffer) { (*pi)[0] = i ? 1 : 0; } //!< Constructs integer scalar - DictValue(int64 i = 0) : type(Param::INT), pi(new AutoBuffer) { (*pi)[0] = i; } //!< Constructs integer scalar - CV_WRAP DictValue(int i) : type(Param::INT), pi(new AutoBuffer) { (*pi)[0] = i; } //!< Constructs integer scalar - DictValue(unsigned p) : type(Param::INT), pi(new AutoBuffer) { (*pi)[0] = p; } //!< Constructs integer scalar - CV_WRAP DictValue(double p) : type(Param::REAL), pd(new AutoBuffer) { (*pd)[0] = p; } //!< Constructs floating point scalar - CV_WRAP DictValue(const String &s) : type(Param::STRING), ps(new AutoBuffer) { (*ps)[0] = s; } //!< Constructs string scalar - DictValue(const char *s) : type(Param::STRING), ps(new AutoBuffer) { (*ps)[0] = s; } //!< @overload - - template - static DictValue arrayInt(TypeIter begin, int size); //!< Constructs integer array - template - static DictValue arrayReal(TypeIter begin, int size); //!< Constructs floating point array - template - static DictValue arrayString(TypeIter begin, int size); //!< Constructs array of strings - - template - T get(int idx = -1) const; //!< Tries to convert array element with specified index to requested type and returns its. - - int size() const; - - CV_WRAP bool isInt() const; - CV_WRAP bool isString() const; - CV_WRAP bool isReal() const; - - CV_WRAP int getIntValue(int idx = -1) const; - CV_WRAP double getRealValue(int idx = -1) const; - CV_WRAP String getStringValue(int idx = -1) const; - - DictValue &operator=(const DictValue &r); - - friend std::ostream &operator<<(std::ostream &stream, const DictValue &dictv); - - ~DictValue(); - -private: - - int type; - - union - { - AutoBuffer *pi; - AutoBuffer *pd; - AutoBuffer *ps; - void *pv; - }; - - DictValue(int _type, void *_p) : type(_type), pv(_p) {} - void release(); -}; - -/** @brief This class implements name-value dictionary, values are instances of DictValue. */ -class CV_EXPORTS Dict -{ - typedef std::map _Dict; - _Dict dict; - -public: - - //! Checks a presence of the @p key in the dictionary. - bool has(const String &key) const; - - //! If the @p key in the dictionary then returns pointer to its value, else returns NULL. - DictValue *ptr(const String &key); - - /** @overload */ - const DictValue *ptr(const String &key) const; - - //! If the @p key in the dictionary then returns its value, else an error will be generated. - const DictValue &get(const String &key) const; - - /** @overload */ - template - T get(const String &key) const; - - //! If the @p key in the dictionary then returns its value, else returns @p defaultValue. - template - T get(const String &key, const T &defaultValue) const; - - //! Sets new @p value for the @p key, or adds new key-value pair into the dictionary. - template - const T &set(const String &key, const T &value); - - //! Erase @p key from the dictionary. - void erase(const String &key); - - friend std::ostream &operator<<(std::ostream &stream, const Dict &dict); - - std::map::const_iterator begin() const; - - std::map::const_iterator end() const; -}; - -//! @} -CV__DNN_EXPERIMENTAL_NS_END -} -} - -#endif diff --git a/opencv/include/opencv2/dnn/dnn.hpp b/opencv/include/opencv2/dnn/dnn.hpp deleted file mode 100644 index 144fc11..0000000 --- a/opencv/include/opencv2/dnn/dnn.hpp +++ /dev/null @@ -1,973 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_DNN_DNN_HPP -#define OPENCV_DNN_DNN_HPP - -#include -#include - -#if !defined CV_DOXYGEN && !defined CV_DNN_DONT_ADD_EXPERIMENTAL_NS -#define CV__DNN_EXPERIMENTAL_NS_BEGIN namespace experimental_dnn_34_v11 { -#define CV__DNN_EXPERIMENTAL_NS_END } -namespace cv { namespace dnn { namespace experimental_dnn_34_v11 { } using namespace experimental_dnn_34_v11; }} -#else -#define CV__DNN_EXPERIMENTAL_NS_BEGIN -#define CV__DNN_EXPERIMENTAL_NS_END -#endif - -#include - -namespace cv { -namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN -//! @addtogroup dnn -//! @{ - - typedef std::vector MatShape; - - /** - * @brief Enum of computation backends supported by layers. - * @see Net::setPreferableBackend - */ - enum Backend - { - //! DNN_BACKEND_DEFAULT equals to DNN_BACKEND_INFERENCE_ENGINE if - //! OpenCV is built with Intel's Inference Engine library or - //! DNN_BACKEND_OPENCV otherwise. - DNN_BACKEND_DEFAULT, - DNN_BACKEND_HALIDE, - DNN_BACKEND_INFERENCE_ENGINE, - DNN_BACKEND_OPENCV - }; - - /** - * @brief Enum of target devices for computations. - * @see Net::setPreferableTarget - */ - enum Target - { - DNN_TARGET_CPU, - DNN_TARGET_OPENCL, - DNN_TARGET_OPENCL_FP16, - DNN_TARGET_MYRIAD, - //! FPGA device with CPU fallbacks using Inference Engine's Heterogeneous plugin. - DNN_TARGET_FPGA - }; - - CV_EXPORTS std::vector< std::pair > getAvailableBackends(); - CV_EXPORTS std::vector getAvailableTargets(Backend be); - - /** @brief This class provides all data needed to initialize layer. - * - * It includes dictionary with scalar params (which can be read by using Dict interface), - * blob params #blobs and optional meta information: #name and #type of layer instance. - */ - class CV_EXPORTS LayerParams : public Dict - { - public: - //TODO: Add ability to name blob params - std::vector blobs; //!< List of learned parameters stored as blobs. - - String name; //!< Name of the layer instance (optional, can be used internal purposes). - String type; //!< Type name which was used for creating layer by layer factory (optional). - }; - - /** - * @brief Derivatives of this class encapsulates functions of certain backends. - */ - class BackendNode - { - public: - BackendNode(int backendId); - - virtual ~BackendNode(); //!< Virtual destructor to make polymorphism. - - int backendId; //!< Backend identifier. - }; - - /** - * @brief Derivatives of this class wraps cv::Mat for different backends and targets. - */ - class BackendWrapper - { - public: - BackendWrapper(int backendId, int targetId); - - /** - * @brief Wrap cv::Mat for specific backend and target. - * @param[in] targetId Target identifier. - * @param[in] m cv::Mat for wrapping. - * - * Make CPU->GPU data transfer if it's require for the target. - */ - BackendWrapper(int targetId, const cv::Mat& m); - - /** - * @brief Make wrapper for reused cv::Mat. - * @param[in] base Wrapper of cv::Mat that will be reused. - * @param[in] shape Specific shape. - * - * Initialize wrapper from another one. It'll wrap the same host CPU - * memory and mustn't allocate memory on device(i.e. GPU). It might - * has different shape. Use in case of CPU memory reusing for reuse - * associated memory on device too. - */ - BackendWrapper(const Ptr& base, const MatShape& shape); - - virtual ~BackendWrapper(); //!< Virtual destructor to make polymorphism. - - /** - * @brief Transfer data to CPU host memory. - */ - virtual void copyToHost() = 0; - - /** - * @brief Indicate that an actual data is on CPU. - */ - virtual void setHostDirty() = 0; - - int backendId; //!< Backend identifier. - int targetId; //!< Target identifier. - }; - - class CV_EXPORTS ActivationLayer; - - /** @brief This interface class allows to build new Layers - are building blocks of networks. - * - * Each class, derived from Layer, must implement allocate() methods to declare own outputs and forward() to compute outputs. - * Also before using the new layer into networks you must register your layer by using one of @ref dnnLayerFactory "LayerFactory" macros. - */ - class CV_EXPORTS_W Layer : public Algorithm - { - public: - - //! List of learned parameters must be stored here to allow read them by using Net::getParam(). - CV_PROP_RW std::vector blobs; - - /** @brief Computes and sets internal parameters according to inputs, outputs and blobs. - * @deprecated Use Layer::finalize(InputArrayOfArrays, OutputArrayOfArrays) instead - * @param[in] input vector of already allocated input blobs - * @param[out] output vector of already allocated output blobs - * - * If this method is called after network has allocated all memory for input and output blobs - * and before inferencing. - */ - CV_DEPRECATED_EXTERNAL - virtual void finalize(const std::vector &input, std::vector &output); - - /** @brief Computes and sets internal parameters according to inputs, outputs and blobs. - * @param[in] inputs vector of already allocated input blobs - * @param[out] outputs vector of already allocated output blobs - * - * If this method is called after network has allocated all memory for input and output blobs - * and before inferencing. - */ - CV_WRAP virtual void finalize(InputArrayOfArrays inputs, OutputArrayOfArrays outputs); - - /** @brief Given the @p input blobs, computes the output @p blobs. - * @deprecated Use Layer::forward(InputArrayOfArrays, OutputArrayOfArrays, OutputArrayOfArrays) instead - * @param[in] input the input blobs. - * @param[out] output allocated output blobs, which will store results of the computation. - * @param[out] internals allocated internal blobs - */ - CV_DEPRECATED_EXTERNAL - virtual void forward(std::vector &input, std::vector &output, std::vector &internals); - - /** @brief Given the @p input blobs, computes the output @p blobs. - * @param[in] inputs the input blobs. - * @param[out] outputs allocated output blobs, which will store results of the computation. - * @param[out] internals allocated internal blobs - */ - virtual void forward(InputArrayOfArrays inputs, OutputArrayOfArrays outputs, OutputArrayOfArrays internals); - - /** @brief Given the @p input blobs, computes the output @p blobs. - * @param[in] inputs the input blobs. - * @param[out] outputs allocated output blobs, which will store results of the computation. - * @param[out] internals allocated internal blobs - */ - void forward_fallback(InputArrayOfArrays inputs, OutputArrayOfArrays outputs, OutputArrayOfArrays internals); - - /** @brief - * @overload - * @deprecated Use Layer::finalize(InputArrayOfArrays, OutputArrayOfArrays) instead - */ - CV_DEPRECATED_EXTERNAL - void finalize(const std::vector &inputs, CV_OUT std::vector &outputs); - - /** @brief - * @overload - * @deprecated Use Layer::finalize(InputArrayOfArrays, OutputArrayOfArrays) instead - */ - CV_DEPRECATED std::vector finalize(const std::vector &inputs); - - /** @brief Allocates layer and computes output. - * @deprecated This method will be removed in the future release. - */ - CV_DEPRECATED CV_WRAP void run(const std::vector &inputs, CV_OUT std::vector &outputs, - CV_IN_OUT std::vector &internals); - - /** @brief Returns index of input blob into the input array. - * @param inputName label of input blob - * - * Each layer input and output can be labeled to easily identify them using "%[.output_name]" notation. - * This method maps label of input blob to its index into input vector. - */ - virtual int inputNameToIndex(String inputName); - /** @brief Returns index of output blob in output array. - * @see inputNameToIndex() - */ - CV_WRAP virtual int outputNameToIndex(const String& outputName); - - /** - * @brief Ask layer if it support specific backend for doing computations. - * @param[in] backendId computation backend identifier. - * @see Backend - */ - virtual bool supportBackend(int backendId); - - /** - * @brief Returns Halide backend node. - * @param[in] inputs Input Halide buffers. - * @see BackendNode, BackendWrapper - * - * Input buffers should be exactly the same that will be used in forward invocations. - * Despite we can use Halide::ImageParam based on input shape only, - * it helps prevent some memory management issues (if something wrong, - * Halide tests will be failed). - */ - virtual Ptr initHalide(const std::vector > &inputs); - - virtual Ptr initInfEngine(const std::vector > &inputs); - - /** - * @brief Automatic Halide scheduling based on layer hyper-parameters. - * @param[in] node Backend node with Halide functions. - * @param[in] inputs Blobs that will be used in forward invocations. - * @param[in] outputs Blobs that will be used in forward invocations. - * @param[in] targetId Target identifier - * @see BackendNode, Target - * - * Layer don't use own Halide::Func members because we can have applied - * layers fusing. In this way the fused function should be scheduled. - */ - virtual void applyHalideScheduler(Ptr& node, - const std::vector &inputs, - const std::vector &outputs, - int targetId) const; - - /** - * @brief Implement layers fusing. - * @param[in] node Backend node of bottom layer. - * @see BackendNode - * - * Actual for graph-based backends. If layer attached successfully, - * returns non-empty cv::Ptr to node of the same backend. - * Fuse only over the last function. - */ - virtual Ptr tryAttach(const Ptr& node); - - /** - * @brief Tries to attach to the layer the subsequent activation layer, i.e. do the layer fusion in a partial case. - * @param[in] layer The subsequent activation layer. - * - * Returns true if the activation layer has been attached successfully. - */ - virtual bool setActivation(const Ptr& layer); - - /** - * @brief Try to fuse current layer with a next one - * @param[in] top Next layer to be fused. - * @returns True if fusion was performed. - */ - virtual bool tryFuse(Ptr& top); - - /** - * @brief Returns parameters of layers with channel-wise multiplication and addition. - * @param[out] scale Channel-wise multipliers. Total number of values should - * be equal to number of channels. - * @param[out] shift Channel-wise offsets. Total number of values should - * be equal to number of channels. - * - * Some layers can fuse their transformations with further layers. - * In example, convolution + batch normalization. This way base layer - * use weights from layer after it. Fused layer is skipped. - * By default, @p scale and @p shift are empty that means layer has no - * element-wise multiplications or additions. - */ - virtual void getScaleShift(Mat& scale, Mat& shift) const; - - /** - * @brief "Deattaches" all the layers, attached to particular layer. - */ - virtual void unsetAttached(); - - virtual bool getMemoryShapes(const std::vector &inputs, - const int requiredOutputs, - std::vector &outputs, - std::vector &internals) const; - virtual int64 getFLOPS(const std::vector &inputs, - const std::vector &outputs) const {CV_UNUSED(inputs); CV_UNUSED(outputs); return 0;} - - CV_PROP String name; //!< Name of the layer instance, can be used for logging or other internal purposes. - CV_PROP String type; //!< Type name which was used for creating layer by layer factory. - CV_PROP int preferableTarget; //!< prefer target for layer forwarding - - Layer(); - explicit Layer(const LayerParams ¶ms); //!< Initializes only #name, #type and #blobs fields. - void setParamsFrom(const LayerParams ¶ms); //!< Initializes only #name, #type and #blobs fields. - virtual ~Layer(); - }; - - /** @brief This class allows to create and manipulate comprehensive artificial neural networks. - * - * Neural network is presented as directed acyclic graph (DAG), where vertices are Layer instances, - * and edges specify relationships between layers inputs and outputs. - * - * Each network layer has unique integer id and unique string name inside its network. - * LayerId can store either layer name or layer id. - * - * This class supports reference counting of its instances, i. e. copies point to the same instance. - */ - class CV_EXPORTS_W_SIMPLE Net - { - public: - - CV_WRAP Net(); //!< Default constructor. - CV_WRAP ~Net(); //!< Destructor frees the net only if there aren't references to the net anymore. - - /** @brief Create a network from Intel's Model Optimizer intermediate representation. - * @param[in] xml XML configuration file with network's topology. - * @param[in] bin Binary file with trained weights. - * Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine - * backend. - */ - CV_WRAP static Net readFromModelOptimizer(const String& xml, const String& bin); - - /** Returns true if there are no layers in the network. */ - CV_WRAP bool empty() const; - - /** @brief Adds new layer to the net. - * @param name unique name of the adding layer. - * @param type typename of the adding layer (type must be registered in LayerRegister). - * @param params parameters which will be used to initialize the creating layer. - * @returns unique identifier of created layer, or -1 if a failure will happen. - */ - int addLayer(const String &name, const String &type, LayerParams ¶ms); - /** @brief Adds new layer and connects its first input to the first output of previously added layer. - * @see addLayer() - */ - int addLayerToPrev(const String &name, const String &type, LayerParams ¶ms); - - /** @brief Converts string name of the layer to the integer identifier. - * @returns id of the layer, or -1 if the layer wasn't found. - */ - CV_WRAP int getLayerId(const String &layer); - - CV_WRAP std::vector getLayerNames() const; - - /** @brief Container for strings and integers. */ - typedef DictValue LayerId; - - /** @brief Returns pointer to layer with specified id or name which the network use. */ - CV_WRAP Ptr getLayer(LayerId layerId); - - /** @brief Returns pointers to input layers of specific layer. */ - std::vector > getLayerInputs(LayerId layerId); // FIXIT: CV_WRAP - - /** @brief Connects output of the first layer to input of the second layer. - * @param outPin descriptor of the first layer output. - * @param inpPin descriptor of the second layer input. - * - * Descriptors have the following template <layer_name>[.input_number]: - * - the first part of the template layer_name is sting name of the added layer. - * If this part is empty then the network input pseudo layer will be used; - * - the second optional part of the template input_number - * is either number of the layer input, either label one. - * If this part is omitted then the first layer input will be used. - * - * @see setNetInputs(), Layer::inputNameToIndex(), Layer::outputNameToIndex() - */ - CV_WRAP void connect(String outPin, String inpPin); - - /** @brief Connects #@p outNum output of the first layer to #@p inNum input of the second layer. - * @param outLayerId identifier of the first layer - * @param outNum number of the first layer output - * @param inpLayerId identifier of the second layer - * @param inpNum number of the second layer input - */ - void connect(int outLayerId, int outNum, int inpLayerId, int inpNum); - - /** @brief Sets outputs names of the network input pseudo layer. - * - * Each net always has special own the network input pseudo layer with id=0. - * This layer stores the user blobs only and don't make any computations. - * In fact, this layer provides the only way to pass user data into the network. - * As any other layer, this layer can label its outputs and this function provides an easy way to do this. - */ - CV_WRAP void setInputsNames(const std::vector &inputBlobNames); - - /** @brief Runs forward pass to compute output of layer with name @p outputName. - * @param outputName name for layer which output is needed to get - * @return blob for first output of specified layer. - * @details By default runs forward pass for the whole network. - */ - CV_WRAP Mat forward(const String& outputName = String()); - - /** @brief Runs forward pass to compute output of layer with name @p outputName. - * @param outputBlobs contains all output blobs for specified layer. - * @param outputName name for layer which output is needed to get - * @details If @p outputName is empty, runs forward pass for the whole network. - */ - CV_WRAP void forward(OutputArrayOfArrays outputBlobs, const String& outputName = String()); - - /** @brief Runs forward pass to compute outputs of layers listed in @p outBlobNames. - * @param outputBlobs contains blobs for first outputs of specified layers. - * @param outBlobNames names for layers which outputs are needed to get - */ - CV_WRAP void forward(OutputArrayOfArrays outputBlobs, - const std::vector& outBlobNames); - - /** @brief Runs forward pass to compute outputs of layers listed in @p outBlobNames. - * @param outputBlobs contains all output blobs for each layer specified in @p outBlobNames. - * @param outBlobNames names for layers which outputs are needed to get - */ - CV_WRAP_AS(forwardAndRetrieve) void forward(CV_OUT std::vector >& outputBlobs, - const std::vector& outBlobNames); - - /** - * @brief Compile Halide layers. - * @param[in] scheduler Path to YAML file with scheduling directives. - * @see setPreferableBackend - * - * Schedule layers that support Halide backend. Then compile them for - * specific target. For layers that not represented in scheduling file - * or if no manual scheduling used at all, automatic scheduling will be applied. - */ - CV_WRAP void setHalideScheduler(const String& scheduler); - - /** - * @brief Ask network to use specific computation backend where it supported. - * @param[in] backendId backend identifier. - * @see Backend - * - * If OpenCV is compiled with Intel's Inference Engine library, DNN_BACKEND_DEFAULT - * means DNN_BACKEND_INFERENCE_ENGINE. Otherwise it equals to DNN_BACKEND_OPENCV. - */ - CV_WRAP void setPreferableBackend(int backendId); - - /** - * @brief Ask network to make computations on specific target device. - * @param[in] targetId target identifier. - * @see Target - * - * List of supported combinations backend / target: - * | | DNN_BACKEND_OPENCV | DNN_BACKEND_INFERENCE_ENGINE | DNN_BACKEND_HALIDE | - * |------------------------|--------------------|------------------------------|--------------------| - * | DNN_TARGET_CPU | + | + | + | - * | DNN_TARGET_OPENCL | + | + | + | - * | DNN_TARGET_OPENCL_FP16 | + | + | | - * | DNN_TARGET_MYRIAD | | + | | - * | DNN_TARGET_FPGA | | + | | - */ - CV_WRAP void setPreferableTarget(int targetId); - - /** @brief Sets the new input value for the network - * @param blob A new blob. Should have CV_32F or CV_8U depth. - * @param name A name of input layer. - * @param scalefactor An optional normalization scale. - * @param mean An optional mean subtraction values. - * @see connect(String, String) to know format of the descriptor. - * - * If scale or mean values are specified, a final input blob is computed - * as: - * \f[input(n,c,h,w) = scalefactor \times (blob(n,c,h,w) - mean_c)\f] - */ - CV_WRAP void setInput(InputArray blob, const String& name = "", - double scalefactor = 1.0, const Scalar& mean = Scalar()); - - /** @brief Sets the new value for the learned param of the layer. - * @param layer name or id of the layer. - * @param numParam index of the layer parameter in the Layer::blobs array. - * @param blob the new value. - * @see Layer::blobs - * @note If shape of the new blob differs from the previous shape, - * then the following forward pass may fail. - */ - CV_WRAP void setParam(LayerId layer, int numParam, const Mat &blob); - - /** @brief Returns parameter blob of the layer. - * @param layer name or id of the layer. - * @param numParam index of the layer parameter in the Layer::blobs array. - * @see Layer::blobs - */ - CV_WRAP Mat getParam(LayerId layer, int numParam = 0); - - /** @brief Returns indexes of layers with unconnected outputs. - */ - CV_WRAP std::vector getUnconnectedOutLayers() const; - - /** @brief Returns names of layers with unconnected outputs. - */ - CV_WRAP std::vector getUnconnectedOutLayersNames() const; - - /** @brief Returns input and output shapes for all layers in loaded model; - * preliminary inferencing isn't necessary. - * @param netInputShapes shapes for all input blobs in net input layer. - * @param layersIds output parameter for layer IDs. - * @param inLayersShapes output parameter for input layers shapes; - * order is the same as in layersIds - * @param outLayersShapes output parameter for output layers shapes; - * order is the same as in layersIds - */ - CV_WRAP void getLayersShapes(const std::vector& netInputShapes, - CV_OUT std::vector& layersIds, - CV_OUT std::vector >& inLayersShapes, - CV_OUT std::vector >& outLayersShapes) const; - - /** @overload */ - CV_WRAP void getLayersShapes(const MatShape& netInputShape, - CV_OUT std::vector& layersIds, - CV_OUT std::vector >& inLayersShapes, - CV_OUT std::vector >& outLayersShapes) const; - - /** @brief Returns input and output shapes for layer with specified - * id in loaded model; preliminary inferencing isn't necessary. - * @param netInputShape shape input blob in net input layer. - * @param layerId id for layer. - * @param inLayerShapes output parameter for input layers shapes; - * order is the same as in layersIds - * @param outLayerShapes output parameter for output layers shapes; - * order is the same as in layersIds - */ - void getLayerShapes(const MatShape& netInputShape, - const int layerId, - CV_OUT std::vector& inLayerShapes, - CV_OUT std::vector& outLayerShapes) const; // FIXIT: CV_WRAP - - /** @overload */ - void getLayerShapes(const std::vector& netInputShapes, - const int layerId, - CV_OUT std::vector& inLayerShapes, - CV_OUT std::vector& outLayerShapes) const; // FIXIT: CV_WRAP - - /** @brief Computes FLOP for whole loaded model with specified input shapes. - * @param netInputShapes vector of shapes for all net inputs. - * @returns computed FLOP. - */ - CV_WRAP int64 getFLOPS(const std::vector& netInputShapes) const; - /** @overload */ - CV_WRAP int64 getFLOPS(const MatShape& netInputShape) const; - /** @overload */ - CV_WRAP int64 getFLOPS(const int layerId, - const std::vector& netInputShapes) const; - /** @overload */ - CV_WRAP int64 getFLOPS(const int layerId, - const MatShape& netInputShape) const; - - /** @brief Returns list of types for layer used in model. - * @param layersTypes output parameter for returning types. - */ - CV_WRAP void getLayerTypes(CV_OUT std::vector& layersTypes) const; - - /** @brief Returns count of layers of specified type. - * @param layerType type. - * @returns count of layers - */ - CV_WRAP int getLayersCount(const String& layerType) const; - - /** @brief Computes bytes number which are required to store - * all weights and intermediate blobs for model. - * @param netInputShapes vector of shapes for all net inputs. - * @param weights output parameter to store resulting bytes for weights. - * @param blobs output parameter to store resulting bytes for intermediate blobs. - */ - void getMemoryConsumption(const std::vector& netInputShapes, - CV_OUT size_t& weights, CV_OUT size_t& blobs) const; // FIXIT: CV_WRAP - /** @overload */ - CV_WRAP void getMemoryConsumption(const MatShape& netInputShape, - CV_OUT size_t& weights, CV_OUT size_t& blobs) const; - /** @overload */ - CV_WRAP void getMemoryConsumption(const int layerId, - const std::vector& netInputShapes, - CV_OUT size_t& weights, CV_OUT size_t& blobs) const; - /** @overload */ - CV_WRAP void getMemoryConsumption(const int layerId, - const MatShape& netInputShape, - CV_OUT size_t& weights, CV_OUT size_t& blobs) const; - - /** @brief Computes bytes number which are required to store - * all weights and intermediate blobs for each layer. - * @param netInputShapes vector of shapes for all net inputs. - * @param layerIds output vector to save layer IDs. - * @param weights output parameter to store resulting bytes for weights. - * @param blobs output parameter to store resulting bytes for intermediate blobs. - */ - void getMemoryConsumption(const std::vector& netInputShapes, - CV_OUT std::vector& layerIds, - CV_OUT std::vector& weights, - CV_OUT std::vector& blobs) const; // FIXIT: CV_WRAP - /** @overload */ - void getMemoryConsumption(const MatShape& netInputShape, - CV_OUT std::vector& layerIds, - CV_OUT std::vector& weights, - CV_OUT std::vector& blobs) const; // FIXIT: CV_WRAP - - /** @brief Enables or disables layer fusion in the network. - * @param fusion true to enable the fusion, false to disable. The fusion is enabled by default. - */ - CV_WRAP void enableFusion(bool fusion); - - /** @brief Returns overall time for inference and timings (in ticks) for layers. - * Indexes in returned vector correspond to layers ids. Some layers can be fused with others, - * in this case zero ticks count will be return for that skipped layers. - * @param timings vector for tick timings for all layers. - * @return overall ticks for model inference. - */ - CV_WRAP int64 getPerfProfile(CV_OUT std::vector& timings); - - private: - struct Impl; - Ptr impl; - }; - - /** @brief Reads a network model stored in Darknet model files. - * @param cfgFile path to the .cfg file with text description of the network architecture. - * @param darknetModel path to the .weights file with learned network. - * @returns Network object that ready to do forward, throw an exception in failure cases. - * @returns Net object. - */ - CV_EXPORTS_W Net readNetFromDarknet(const String &cfgFile, const String &darknetModel = String()); - - /** @brief Reads a network model stored in Darknet model files. - * @param bufferCfg A buffer contains a content of .cfg file with text description of the network architecture. - * @param bufferModel A buffer contains a content of .weights file with learned network. - * @returns Net object. - */ - CV_EXPORTS_W Net readNetFromDarknet(const std::vector& bufferCfg, - const std::vector& bufferModel = std::vector()); - - /** @brief Reads a network model stored in Darknet model files. - * @param bufferCfg A buffer contains a content of .cfg file with text description of the network architecture. - * @param lenCfg Number of bytes to read from bufferCfg - * @param bufferModel A buffer contains a content of .weights file with learned network. - * @param lenModel Number of bytes to read from bufferModel - * @returns Net object. - */ - CV_EXPORTS Net readNetFromDarknet(const char *bufferCfg, size_t lenCfg, - const char *bufferModel = NULL, size_t lenModel = 0); - - /** @brief Reads a network model stored in Caffe framework's format. - * @param prototxt path to the .prototxt file with text description of the network architecture. - * @param caffeModel path to the .caffemodel file with learned network. - * @returns Net object. - */ - CV_EXPORTS_W Net readNetFromCaffe(const String &prototxt, const String &caffeModel = String()); - - /** @brief Reads a network model stored in Caffe model in memory. - * @param bufferProto buffer containing the content of the .prototxt file - * @param bufferModel buffer containing the content of the .caffemodel file - * @returns Net object. - */ - CV_EXPORTS_W Net readNetFromCaffe(const std::vector& bufferProto, - const std::vector& bufferModel = std::vector()); - - /** @brief Reads a network model stored in Caffe model in memory. - * @details This is an overloaded member function, provided for convenience. - * It differs from the above function only in what argument(s) it accepts. - * @param bufferProto buffer containing the content of the .prototxt file - * @param lenProto length of bufferProto - * @param bufferModel buffer containing the content of the .caffemodel file - * @param lenModel length of bufferModel - * @returns Net object. - */ - CV_EXPORTS Net readNetFromCaffe(const char *bufferProto, size_t lenProto, - const char *bufferModel = NULL, size_t lenModel = 0); - - /** @brief Reads a network model stored in TensorFlow framework's format. - * @param model path to the .pb file with binary protobuf description of the network architecture - * @param config path to the .pbtxt file that contains text graph definition in protobuf format. - * Resulting Net object is built by text graph using weights from a binary one that - * let us make it more flexible. - * @returns Net object. - */ - CV_EXPORTS_W Net readNetFromTensorflow(const String &model, const String &config = String()); - - /** @brief Reads a network model stored in TensorFlow framework's format. - * @param bufferModel buffer containing the content of the pb file - * @param bufferConfig buffer containing the content of the pbtxt file - * @returns Net object. - */ - CV_EXPORTS_W Net readNetFromTensorflow(const std::vector& bufferModel, - const std::vector& bufferConfig = std::vector()); - - /** @brief Reads a network model stored in TensorFlow framework's format. - * @details This is an overloaded member function, provided for convenience. - * It differs from the above function only in what argument(s) it accepts. - * @param bufferModel buffer containing the content of the pb file - * @param lenModel length of bufferModel - * @param bufferConfig buffer containing the content of the pbtxt file - * @param lenConfig length of bufferConfig - */ - CV_EXPORTS Net readNetFromTensorflow(const char *bufferModel, size_t lenModel, - const char *bufferConfig = NULL, size_t lenConfig = 0); - - /** - * @brief Reads a network model stored in Torch7 framework's format. - * @param model path to the file, dumped from Torch by using torch.save() function. - * @param isBinary specifies whether the network was serialized in ascii mode or binary. - * @param evaluate specifies testing phase of network. If true, it's similar to evaluate() method in Torch. - * @returns Net object. - * - * @note Ascii mode of Torch serializer is more preferable, because binary mode extensively use `long` type of C language, - * which has various bit-length on different systems. - * - * The loading file must contain serialized nn.Module object - * with importing network. Try to eliminate a custom objects from serialazing data to avoid importing errors. - * - * List of supported layers (i.e. object instances derived from Torch nn.Module class): - * - nn.Sequential - * - nn.Parallel - * - nn.Concat - * - nn.Linear - * - nn.SpatialConvolution - * - nn.SpatialMaxPooling, nn.SpatialAveragePooling - * - nn.ReLU, nn.TanH, nn.Sigmoid - * - nn.Reshape - * - nn.SoftMax, nn.LogSoftMax - * - * Also some equivalents of these classes from cunn, cudnn, and fbcunn may be successfully imported. - */ - CV_EXPORTS_W Net readNetFromTorch(const String &model, bool isBinary = true, bool evaluate = true); - - /** - * @brief Read deep learning network represented in one of the supported formats. - * @param[in] model Binary file contains trained weights. The following file - * extensions are expected for models from different frameworks: - * * `*.caffemodel` (Caffe, http://caffe.berkeleyvision.org/) - * * `*.pb` (TensorFlow, https://www.tensorflow.org/) - * * `*.t7` | `*.net` (Torch, http://torch.ch/) - * * `*.weights` (Darknet, https://pjreddie.com/darknet/) - * * `*.bin` (DLDT, https://software.intel.com/openvino-toolkit) - * @param[in] config Text file contains network configuration. It could be a - * file with the following extensions: - * * `*.prototxt` (Caffe, http://caffe.berkeleyvision.org/) - * * `*.pbtxt` (TensorFlow, https://www.tensorflow.org/) - * * `*.cfg` (Darknet, https://pjreddie.com/darknet/) - * * `*.xml` (DLDT, https://software.intel.com/openvino-toolkit) - * @param[in] framework Explicit framework name tag to determine a format. - * @returns Net object. - * - * This function automatically detects an origin framework of trained model - * and calls an appropriate function such @ref readNetFromCaffe, @ref readNetFromTensorflow, - * @ref readNetFromTorch or @ref readNetFromDarknet. An order of @p model and @p config - * arguments does not matter. - */ - CV_EXPORTS_W Net readNet(const String& model, const String& config = "", const String& framework = ""); - - /** - * @brief Read deep learning network represented in one of the supported formats. - * @details This is an overloaded member function, provided for convenience. - * It differs from the above function only in what argument(s) it accepts. - * @param[in] framework Name of origin framework. - * @param[in] bufferModel A buffer with a content of binary file with weights - * @param[in] bufferConfig A buffer with a content of text file contains network configuration. - * @returns Net object. - */ - CV_EXPORTS_W Net readNet(const String& framework, const std::vector& bufferModel, - const std::vector& bufferConfig = std::vector()); - - /** @brief Loads blob which was serialized as torch.Tensor object of Torch7 framework. - * @warning This function has the same limitations as readNetFromTorch(). - */ - CV_EXPORTS_W Mat readTorchBlob(const String &filename, bool isBinary = true); - - /** @brief Load a network from Intel's Model Optimizer intermediate representation. - * @param[in] xml XML configuration file with network's topology. - * @param[in] bin Binary file with trained weights. - * @returns Net object. - * Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine - * backend. - */ - CV_EXPORTS_W Net readNetFromModelOptimizer(const String &xml, const String &bin); - - /** @brief Reads a network model ONNX. - * @param onnxFile path to the .onnx file with text description of the network architecture. - * @returns Network object that ready to do forward, throw an exception in failure cases. - */ - CV_EXPORTS_W Net readNetFromONNX(const String &onnxFile); - - /** @brief Creates blob from .pb file. - * @param path to the .pb file with input tensor. - * @returns Mat. - */ - CV_EXPORTS_W Mat readTensorFromONNX(const String& path); - - /** @brief Creates 4-dimensional blob from image. Optionally resizes and crops @p image from center, - * subtract @p mean values, scales values by @p scalefactor, swap Blue and Red channels. - * @param image input image (with 1-, 3- or 4-channels). - * @param size spatial size for output image - * @param mean scalar with mean values which are subtracted from channels. Values are intended - * to be in (mean-R, mean-G, mean-B) order if @p image has BGR ordering and @p swapRB is true. - * @param scalefactor multiplier for @p image values. - * @param swapRB flag which indicates that swap first and last channels - * in 3-channel image is necessary. - * @param crop flag which indicates whether image will be cropped after resize or not - * @param ddepth Depth of output blob. Choose CV_32F or CV_8U. - * @details if @p crop is true, input image is resized so one side after resize is equal to corresponding - * dimension in @p size and another one is equal or larger. Then, crop from the center is performed. - * If @p crop is false, direct resize without cropping and preserving aspect ratio is performed. - * @returns 4-dimensional Mat with NCHW dimensions order. - */ - CV_EXPORTS_W Mat blobFromImage(InputArray image, double scalefactor=1.0, const Size& size = Size(), - const Scalar& mean = Scalar(), bool swapRB=false, bool crop=false, - int ddepth=CV_32F); - - /** @brief Creates 4-dimensional blob from image. - * @details This is an overloaded member function, provided for convenience. - * It differs from the above function only in what argument(s) it accepts. - */ - CV_EXPORTS void blobFromImage(InputArray image, OutputArray blob, double scalefactor=1.0, - const Size& size = Size(), const Scalar& mean = Scalar(), - bool swapRB=false, bool crop=false, int ddepth=CV_32F); - - - /** @brief Creates 4-dimensional blob from series of images. Optionally resizes and - * crops @p images from center, subtract @p mean values, scales values by @p scalefactor, - * swap Blue and Red channels. - * @param images input images (all with 1-, 3- or 4-channels). - * @param size spatial size for output image - * @param mean scalar with mean values which are subtracted from channels. Values are intended - * to be in (mean-R, mean-G, mean-B) order if @p image has BGR ordering and @p swapRB is true. - * @param scalefactor multiplier for @p images values. - * @param swapRB flag which indicates that swap first and last channels - * in 3-channel image is necessary. - * @param crop flag which indicates whether image will be cropped after resize or not - * @param ddepth Depth of output blob. Choose CV_32F or CV_8U. - * @details if @p crop is true, input image is resized so one side after resize is equal to corresponding - * dimension in @p size and another one is equal or larger. Then, crop from the center is performed. - * If @p crop is false, direct resize without cropping and preserving aspect ratio is performed. - * @returns 4-dimensional Mat with NCHW dimensions order. - */ - CV_EXPORTS_W Mat blobFromImages(InputArrayOfArrays images, double scalefactor=1.0, - Size size = Size(), const Scalar& mean = Scalar(), bool swapRB=false, bool crop=false, - int ddepth=CV_32F); - - /** @brief Creates 4-dimensional blob from series of images. - * @details This is an overloaded member function, provided for convenience. - * It differs from the above function only in what argument(s) it accepts. - */ - CV_EXPORTS void blobFromImages(InputArrayOfArrays images, OutputArray blob, - double scalefactor=1.0, Size size = Size(), - const Scalar& mean = Scalar(), bool swapRB=false, bool crop=false, - int ddepth=CV_32F); - - /** @brief Parse a 4D blob and output the images it contains as 2D arrays through a simpler data structure - * (std::vector). - * @param[in] blob_ 4 dimensional array (images, channels, height, width) in floating point precision (CV_32F) from - * which you would like to extract the images. - * @param[out] images_ array of 2D Mat containing the images extracted from the blob in floating point precision - * (CV_32F). They are non normalized neither mean added. The number of returned images equals the first dimension - * of the blob (batch size). Every image has a number of channels equals to the second dimension of the blob (depth). - */ - CV_EXPORTS_W void imagesFromBlob(const cv::Mat& blob_, OutputArrayOfArrays images_); - - /** @brief Convert all weights of Caffe network to half precision floating point. - * @param src Path to origin model from Caffe framework contains single - * precision floating point weights (usually has `.caffemodel` extension). - * @param dst Path to destination model with updated weights. - * @param layersTypes Set of layers types which parameters will be converted. - * By default, converts only Convolutional and Fully-Connected layers' - * weights. - * - * @note Shrinked model has no origin float32 weights so it can't be used - * in origin Caffe framework anymore. However the structure of data - * is taken from NVidia's Caffe fork: https://github.com/NVIDIA/caffe. - * So the resulting model may be used there. - */ - CV_EXPORTS_W void shrinkCaffeModel(const String& src, const String& dst, - const std::vector& layersTypes = std::vector()); - - /** @brief Create a text representation for a binary network stored in protocol buffer format. - * @param[in] model A path to binary network. - * @param[in] output A path to output text file to be created. - * - * @note To reduce output file size, trained weights are not included. - */ - CV_EXPORTS_W void writeTextGraph(const String& model, const String& output); - - /** @brief Performs non maximum suppression given boxes and corresponding scores. - - * @param bboxes a set of bounding boxes to apply NMS. - * @param scores a set of corresponding confidences. - * @param score_threshold a threshold used to filter boxes by score. - * @param nms_threshold a threshold used in non maximum suppression. - * @param indices the kept indices of bboxes after NMS. - * @param eta a coefficient in adaptive threshold formula: \f$nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\f$. - * @param top_k if `>0`, keep at most @p top_k picked indices. - */ - CV_EXPORTS_W void NMSBoxes(const std::vector& bboxes, const std::vector& scores, - const float score_threshold, const float nms_threshold, - CV_OUT std::vector& indices, - const float eta = 1.f, const int top_k = 0); - - CV_EXPORTS_W void NMSBoxes(const std::vector& bboxes, const std::vector& scores, - const float score_threshold, const float nms_threshold, - CV_OUT std::vector& indices, - const float eta = 1.f, const int top_k = 0); - - CV_EXPORTS_AS(NMSBoxesRotated) void NMSBoxes(const std::vector& bboxes, const std::vector& scores, - const float score_threshold, const float nms_threshold, - CV_OUT std::vector& indices, - const float eta = 1.f, const int top_k = 0); - -//! @} -CV__DNN_EXPERIMENTAL_NS_END -} -} - -#include -#include - -/// @deprecated Include this header directly from application. Automatic inclusion will be removed -#include - -#endif /* OPENCV_DNN_DNN_HPP */ diff --git a/opencv/include/opencv2/dnn/dnn.inl.hpp b/opencv/include/opencv2/dnn/dnn.inl.hpp deleted file mode 100644 index 17d4c20..0000000 --- a/opencv/include/opencv2/dnn/dnn.inl.hpp +++ /dev/null @@ -1,395 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_DNN_DNN_INL_HPP -#define OPENCV_DNN_DNN_INL_HPP - -#include - -namespace cv { -namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN - -template -DictValue DictValue::arrayInt(TypeIter begin, int size) -{ - DictValue res(Param::INT, new AutoBuffer(size)); - for (int j = 0; j < size; begin++, j++) - (*res.pi)[j] = *begin; - return res; -} - -template -DictValue DictValue::arrayReal(TypeIter begin, int size) -{ - DictValue res(Param::REAL, new AutoBuffer(size)); - for (int j = 0; j < size; begin++, j++) - (*res.pd)[j] = *begin; - return res; -} - -template -DictValue DictValue::arrayString(TypeIter begin, int size) -{ - DictValue res(Param::STRING, new AutoBuffer(size)); - for (int j = 0; j < size; begin++, j++) - (*res.ps)[j] = *begin; - return res; -} - -template<> -inline DictValue DictValue::get(int idx) const -{ - CV_Assert(idx == -1); - return *this; -} - -template<> -inline int64 DictValue::get(int idx) const -{ - CV_Assert((idx == -1 && size() == 1) || (idx >= 0 && idx < size())); - idx = (idx == -1) ? 0 : idx; - - if (type == Param::INT) - { - return (*pi)[idx]; - } - else if (type == Param::REAL) - { - double doubleValue = (*pd)[idx]; - - double fracpart, intpart; - fracpart = std::modf(doubleValue, &intpart); - CV_Assert(fracpart == 0.0); - - return (int64)doubleValue; - } - else if (type == Param::STRING) - { - return std::atoi((*ps)[idx].c_str()); - } - else - { - CV_Assert(isInt() || isReal() || isString()); - return 0; - } -} - -template<> -inline int DictValue::get(int idx) const -{ - return (int)get(idx); -} - -inline int DictValue::getIntValue(int idx) const -{ - return (int)get(idx); -} - -template<> -inline unsigned DictValue::get(int idx) const -{ - return (unsigned)get(idx); -} - -template<> -inline bool DictValue::get(int idx) const -{ - return (get(idx) != 0); -} - -template<> -inline double DictValue::get(int idx) const -{ - CV_Assert((idx == -1 && size() == 1) || (idx >= 0 && idx < size())); - idx = (idx == -1) ? 0 : idx; - - if (type == Param::REAL) - { - return (*pd)[idx]; - } - else if (type == Param::INT) - { - return (double)(*pi)[idx]; - } - else if (type == Param::STRING) - { - return std::atof((*ps)[idx].c_str()); - } - else - { - CV_Assert(isReal() || isInt() || isString()); - return 0; - } -} - -inline double DictValue::getRealValue(int idx) const -{ - return get(idx); -} - -template<> -inline float DictValue::get(int idx) const -{ - return (float)get(idx); -} - -template<> -inline String DictValue::get(int idx) const -{ - CV_Assert(isString()); - CV_Assert((idx == -1 && ps->size() == 1) || (idx >= 0 && idx < (int)ps->size())); - return (*ps)[(idx == -1) ? 0 : idx]; -} - - -inline String DictValue::getStringValue(int idx) const -{ - return get(idx); -} - -inline void DictValue::release() -{ - switch (type) - { - case Param::INT: - delete pi; - break; - case Param::STRING: - delete ps; - break; - case Param::REAL: - delete pd; - break; - } -} - -inline DictValue::~DictValue() -{ - release(); -} - -inline DictValue & DictValue::operator=(const DictValue &r) -{ - if (&r == this) - return *this; - - if (r.type == Param::INT) - { - AutoBuffer *tmp = new AutoBuffer(*r.pi); - release(); - pi = tmp; - } - else if (r.type == Param::STRING) - { - AutoBuffer *tmp = new AutoBuffer(*r.ps); - release(); - ps = tmp; - } - else if (r.type == Param::REAL) - { - AutoBuffer *tmp = new AutoBuffer(*r.pd); - release(); - pd = tmp; - } - - type = r.type; - - return *this; -} - -inline DictValue::DictValue(const DictValue &r) -{ - type = r.type; - - if (r.type == Param::INT) - pi = new AutoBuffer(*r.pi); - else if (r.type == Param::STRING) - ps = new AutoBuffer(*r.ps); - else if (r.type == Param::REAL) - pd = new AutoBuffer(*r.pd); -} - -inline bool DictValue::isString() const -{ - return (type == Param::STRING); -} - -inline bool DictValue::isInt() const -{ - return (type == Param::INT); -} - -inline bool DictValue::isReal() const -{ - return (type == Param::REAL || type == Param::INT); -} - -inline int DictValue::size() const -{ - switch (type) - { - case Param::INT: - return (int)pi->size(); - case Param::STRING: - return (int)ps->size(); - case Param::REAL: - return (int)pd->size(); - } -#ifdef __OPENCV_BUILD - CV_Error(Error::StsInternal, ""); -#else - CV_ErrorNoReturn(Error::StsInternal, ""); -#endif -} - -inline std::ostream &operator<<(std::ostream &stream, const DictValue &dictv) -{ - int i; - - if (dictv.isInt()) - { - for (i = 0; i < dictv.size() - 1; i++) - stream << dictv.get(i) << ", "; - stream << dictv.get(i); - } - else if (dictv.isReal()) - { - for (i = 0; i < dictv.size() - 1; i++) - stream << dictv.get(i) << ", "; - stream << dictv.get(i); - } - else if (dictv.isString()) - { - for (i = 0; i < dictv.size() - 1; i++) - stream << "\"" << dictv.get(i) << "\", "; - stream << dictv.get(i); - } - - return stream; -} - -///////////////////////////////////////////////////////////////// - -inline bool Dict::has(const String &key) const -{ - return dict.count(key) != 0; -} - -inline DictValue *Dict::ptr(const String &key) -{ - _Dict::iterator i = dict.find(key); - return (i == dict.end()) ? NULL : &i->second; -} - -inline const DictValue *Dict::ptr(const String &key) const -{ - _Dict::const_iterator i = dict.find(key); - return (i == dict.end()) ? NULL : &i->second; -} - -inline const DictValue &Dict::get(const String &key) const -{ - _Dict::const_iterator i = dict.find(key); - if (i == dict.end()) - CV_Error(Error::StsObjectNotFound, "Required argument \"" + key + "\" not found into dictionary"); - return i->second; -} - -template -inline T Dict::get(const String &key) const -{ - return this->get(key).get(); -} - -template -inline T Dict::get(const String &key, const T &defaultValue) const -{ - _Dict::const_iterator i = dict.find(key); - - if (i != dict.end()) - return i->second.get(); - else - return defaultValue; -} - -template -inline const T &Dict::set(const String &key, const T &value) -{ - _Dict::iterator i = dict.find(key); - - if (i != dict.end()) - i->second = DictValue(value); - else - dict.insert(std::make_pair(key, DictValue(value))); - - return value; -} - -inline void Dict::erase(const String &key) -{ - dict.erase(key); -} - -inline std::ostream &operator<<(std::ostream &stream, const Dict &dict) -{ - Dict::_Dict::const_iterator it; - for (it = dict.dict.begin(); it != dict.dict.end(); it++) - stream << it->first << " : " << it->second << "\n"; - - return stream; -} - -inline std::map::const_iterator Dict::begin() const -{ - return dict.begin(); -} - -inline std::map::const_iterator Dict::end() const -{ - return dict.end(); -} - -CV__DNN_EXPERIMENTAL_NS_END -} -} - -#endif diff --git a/opencv/include/opencv2/dnn/layer.details.hpp b/opencv/include/opencv2/dnn/layer.details.hpp deleted file mode 100644 index 619514e..0000000 --- a/opencv/include/opencv2/dnn/layer.details.hpp +++ /dev/null @@ -1,78 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. -// -#ifndef OPENCV_DNN_LAYER_DETAILS_HPP -#define OPENCV_DNN_LAYER_DETAILS_HPP - -#include - -namespace cv { -namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN - -/** @brief Registers layer constructor in runtime. -* @param type string, containing type name of the layer. -* @param constructorFunc pointer to the function of type LayerRegister::Constructor, which creates the layer. -* @details This macros must be placed inside the function code. -*/ -#define CV_DNN_REGISTER_LAYER_FUNC(type, constructorFunc) \ - cv::dnn::LayerFactory::registerLayer(#type, constructorFunc); - -/** @brief Registers layer class in runtime. - * @param type string, containing type name of the layer. - * @param class C++ class, derived from Layer. - * @details This macros must be placed inside the function code. - */ -#define CV_DNN_REGISTER_LAYER_CLASS(type, class) \ - cv::dnn::LayerFactory::registerLayer(#type, cv::dnn::details::_layerDynamicRegisterer); - -/** @brief Registers layer constructor on module load time. -* @param type string, containing type name of the layer. -* @param constructorFunc pointer to the function of type LayerRegister::Constructor, which creates the layer. -* @details This macros must be placed outside the function code. -*/ -#define CV_DNN_REGISTER_LAYER_FUNC_STATIC(type, constructorFunc) \ -static cv::dnn::details::_LayerStaticRegisterer __LayerStaticRegisterer_##type(#type, constructorFunc); - -/** @brief Registers layer class on module load time. - * @param type string, containing type name of the layer. - * @param class C++ class, derived from Layer. - * @details This macros must be placed outside the function code. - */ -#define CV_DNN_REGISTER_LAYER_CLASS_STATIC(type, class) \ -Ptr __LayerStaticRegisterer_func_##type(LayerParams ¶ms) \ - { return Ptr(new class(params)); } \ -static cv::dnn::details::_LayerStaticRegisterer __LayerStaticRegisterer_##type(#type, __LayerStaticRegisterer_func_##type); - -namespace details { - -template -Ptr _layerDynamicRegisterer(LayerParams ¶ms) -{ - return Ptr(LayerClass::create(params)); -} - -//allows automatically register created layer on module load time -class _LayerStaticRegisterer -{ - String type; -public: - - _LayerStaticRegisterer(const String &layerType, LayerFactory::Constructor layerConstructor) - { - this->type = layerType; - LayerFactory::registerLayer(layerType, layerConstructor); - } - - ~_LayerStaticRegisterer() - { - LayerFactory::unregisterLayer(type); - } -}; - -} // namespace -CV__DNN_EXPERIMENTAL_NS_END -}} // namespace - -#endif diff --git a/opencv/include/opencv2/dnn/layer.hpp b/opencv/include/opencv2/dnn/layer.hpp deleted file mode 100644 index c4712b8..0000000 --- a/opencv/include/opencv2/dnn/layer.hpp +++ /dev/null @@ -1,85 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_DNN_LAYER_HPP -#define OPENCV_DNN_LAYER_HPP -#include - -namespace cv { -namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN -//! @addtogroup dnn -//! @{ -//! -//! @defgroup dnnLayerFactory Utilities for New Layers Registration -//! @{ - -/** @brief %Layer factory allows to create instances of registered layers. */ -class CV_EXPORTS LayerFactory -{ -public: - - //! Each Layer class must provide this function to the factory - typedef Ptr(*Constructor)(LayerParams ¶ms); - - //! Registers the layer class with typename @p type and specified @p constructor. Thread-safe. - static void registerLayer(const String &type, Constructor constructor); - - //! Unregisters registered layer with specified type name. Thread-safe. - static void unregisterLayer(const String &type); - - /** @brief Creates instance of registered layer. - * @param type type name of creating layer. - * @param params parameters which will be used for layer initialization. - * @note Thread-safe. - */ - static Ptr createLayerInstance(const String &type, LayerParams& params); - -private: - LayerFactory(); -}; - -//! @} -//! @} -CV__DNN_EXPERIMENTAL_NS_END -} -} -#endif diff --git a/opencv/include/opencv2/dnn/shape_utils.hpp b/opencv/include/opencv2/dnn/shape_utils.hpp deleted file mode 100644 index b0ed3af..0000000 --- a/opencv/include/opencv2/dnn/shape_utils.hpp +++ /dev/null @@ -1,219 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_DNN_DNN_SHAPE_UTILS_HPP -#define OPENCV_DNN_DNN_SHAPE_UTILS_HPP - -#include -#include // CV_MAX_DIM -#include -#include -#include - -namespace cv { -namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN - -//Slicing - -struct _Range : public cv::Range -{ - _Range(const Range &r) : cv::Range(r) {} - _Range(int start_, int size_ = 1) : cv::Range(start_, start_ + size_) {} -}; - -static inline Mat slice(const Mat &m, const _Range &r0) -{ - Range ranges[CV_MAX_DIM]; - for (int i = 1; i < m.dims; i++) - ranges[i] = Range::all(); - ranges[0] = r0; - return m(&ranges[0]); -} - -static inline Mat slice(const Mat &m, const _Range &r0, const _Range &r1) -{ - CV_Assert(m.dims >= 2); - Range ranges[CV_MAX_DIM]; - for (int i = 2; i < m.dims; i++) - ranges[i] = Range::all(); - ranges[0] = r0; - ranges[1] = r1; - return m(&ranges[0]); -} - -static inline Mat slice(const Mat &m, const _Range &r0, const _Range &r1, const _Range &r2) -{ - CV_Assert(m.dims >= 3); - Range ranges[CV_MAX_DIM]; - for (int i = 3; i < m.dims; i++) - ranges[i] = Range::all(); - ranges[0] = r0; - ranges[1] = r1; - ranges[2] = r2; - return m(&ranges[0]); -} - -static inline Mat slice(const Mat &m, const _Range &r0, const _Range &r1, const _Range &r2, const _Range &r3) -{ - CV_Assert(m.dims >= 4); - Range ranges[CV_MAX_DIM]; - for (int i = 4; i < m.dims; i++) - ranges[i] = Range::all(); - ranges[0] = r0; - ranges[1] = r1; - ranges[2] = r2; - ranges[3] = r3; - return m(&ranges[0]); -} - -static inline Mat getPlane(const Mat &m, int n, int cn) -{ - CV_Assert(m.dims > 2); - int sz[CV_MAX_DIM]; - for(int i = 2; i < m.dims; i++) - { - sz[i-2] = m.size.p[i]; - } - return Mat(m.dims - 2, sz, m.type(), (void*)m.ptr(n, cn)); -} - -static inline MatShape shape(const int* dims, const int n) -{ - MatShape shape; - shape.assign(dims, dims + n); - return shape; -} - -static inline MatShape shape(const Mat& mat) -{ - return shape(mat.size.p, mat.dims); -} - -static inline MatShape shape(const MatSize& sz) -{ - return shape(sz.p, sz.dims()); -} - -static inline MatShape shape(const UMat& mat) -{ - return shape(mat.size.p, mat.dims); -} - -namespace {inline bool is_neg(int i) { return i < 0; }} - -static inline MatShape shape(int a0, int a1=-1, int a2=-1, int a3=-1) -{ - int dims[] = {a0, a1, a2, a3}; - MatShape s = shape(dims, 4); - s.erase(std::remove_if(s.begin(), s.end(), is_neg), s.end()); - return s; -} - -static inline int total(const MatShape& shape, int start = -1, int end = -1) -{ - if (start == -1) start = 0; - if (end == -1) end = (int)shape.size(); - - if (shape.empty()) - return 0; - - int elems = 1; - CV_Assert(start <= (int)shape.size() && end <= (int)shape.size() && - start <= end); - for(int i = start; i < end; i++) - { - elems *= shape[i]; - } - return elems; -} - -static inline MatShape concat(const MatShape& a, const MatShape& b) -{ - MatShape c = a; - c.insert(c.end(), b.begin(), b.end()); - - return c; -} - -static inline std::string toString(const MatShape& shape, const String& name = "") -{ - std::ostringstream ss; - if (!name.empty()) - ss << name << ' '; - ss << '['; - for(size_t i = 0, n = shape.size(); i < n; ++i) - ss << ' ' << shape[i]; - ss << " ]"; - return ss.str(); -} -static inline void print(const MatShape& shape, const String& name = "") -{ - std::cout << toString(shape, name) << std::endl; -} -static inline std::ostream& operator<<(std::ostream &out, const MatShape& shape) -{ - out << toString(shape); - return out; -} - -inline int clamp(int ax, int dims) -{ - return ax < 0 ? ax + dims : ax; -} - -inline int clamp(int ax, const MatShape& shape) -{ - return clamp(ax, (int)shape.size()); -} - -inline Range clamp(const Range& r, int axisSize) -{ - Range clamped(std::max(r.start, 0), - r.end > 0 ? std::min(r.end, axisSize) : axisSize + r.end + 1); - CV_Assert_N(clamped.start < clamped.end, clamped.end <= axisSize); - return clamped; -} - -CV__DNN_EXPERIMENTAL_NS_END -} -} -#endif diff --git a/opencv/include/opencv2/dnn/utils/inference_engine.hpp b/opencv/include/opencv2/dnn/utils/inference_engine.hpp deleted file mode 100644 index 0211096..0000000 --- a/opencv/include/opencv2/dnn/utils/inference_engine.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. -// -// Copyright (C) 2018-2019, Intel Corporation, all rights reserved. -// Third party copyrights are property of their respective owners. - -#ifndef OPENCV_DNN_UTILS_INF_ENGINE_HPP -#define OPENCV_DNN_UTILS_INF_ENGINE_HPP - -#include "../dnn.hpp" - -namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN - - -/** @brief Release a Myriad device (binded by OpenCV). - * - * Single Myriad device cannot be shared across multiple processes which uses - * Inference Engine's Myriad plugin. - */ -CV_EXPORTS_W void resetMyriadDevice(); - - -/* Values for 'OPENCV_DNN_IE_VPU_TYPE' parameter */ -#define CV_DNN_INFERENCE_ENGINE_VPU_TYPE_UNSPECIFIED "" -/// Intel(R) Movidius(TM) Neural Compute Stick, NCS (USB 03e7:2150), Myriad2 (https://software.intel.com/en-us/movidius-ncs) -#define CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_2 "Myriad2" -/// Intel(R) Neural Compute Stick 2, NCS2 (USB 03e7:2485), MyriadX (https://software.intel.com/ru-ru/neural-compute-stick) -#define CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X "MyriadX" - - -/** @brief Returns Inference Engine VPU type. - * - * See values of `CV_DNN_INFERENCE_ENGINE_VPU_TYPE_*` macros. - */ -CV_EXPORTS_W cv::String getInferenceEngineVPUType(); - - -CV__DNN_EXPERIMENTAL_NS_END -}} // namespace - -#endif // OPENCV_DNN_UTILS_INF_ENGINE_HPP diff --git a/opencv/include/opencv2/features2d.hpp b/opencv/include/opencv2/features2d.hpp deleted file mode 100644 index ee81ebe..0000000 --- a/opencv/include/opencv2/features2d.hpp +++ /dev/null @@ -1,1428 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_FEATURES_2D_HPP -#define OPENCV_FEATURES_2D_HPP - -#include "opencv2/opencv_modules.hpp" -#include "opencv2/core.hpp" - -#ifdef HAVE_OPENCV_FLANN -#include "opencv2/flann/miniflann.hpp" -#endif - -/** - @defgroup features2d 2D Features Framework - @{ - @defgroup features2d_main Feature Detection and Description - @defgroup features2d_match Descriptor Matchers - -Matchers of keypoint descriptors in OpenCV have wrappers with a common interface that enables you to -easily switch between different algorithms solving the same problem. This section is devoted to -matching descriptors that are represented as vectors in a multidimensional space. All objects that -implement vector descriptor matchers inherit the DescriptorMatcher interface. - -@note - - An example explaining keypoint matching can be found at - opencv_source_code/samples/cpp/descriptor_extractor_matcher.cpp - - An example on descriptor matching evaluation can be found at - opencv_source_code/samples/cpp/detector_descriptor_matcher_evaluation.cpp - - An example on one to many image matching can be found at - opencv_source_code/samples/cpp/matching_to_many_images.cpp - - @defgroup features2d_draw Drawing Function of Keypoints and Matches - @defgroup features2d_category Object Categorization - -This section describes approaches based on local 2D features and used to categorize objects. - -@note - - A complete Bag-Of-Words sample can be found at - opencv_source_code/samples/cpp/bagofwords_classification.cpp - - (Python) An example using the features2D framework to perform object categorization can be - found at opencv_source_code/samples/python/find_obj.py - - @} - */ - -namespace cv -{ - -//! @addtogroup features2d -//! @{ - -// //! writes vector of keypoints to the file storage -// CV_EXPORTS void write(FileStorage& fs, const String& name, const std::vector& keypoints); -// //! reads vector of keypoints from the specified file storage node -// CV_EXPORTS void read(const FileNode& node, CV_OUT std::vector& keypoints); - -/** @brief A class filters a vector of keypoints. - - Because now it is difficult to provide a convenient interface for all usage scenarios of the - keypoints filter class, it has only several needed by now static methods. - */ -class CV_EXPORTS KeyPointsFilter -{ -public: - KeyPointsFilter(){} - - /* - * Remove keypoints within borderPixels of an image edge. - */ - static void runByImageBorder( std::vector& keypoints, Size imageSize, int borderSize ); - /* - * Remove keypoints of sizes out of range. - */ - static void runByKeypointSize( std::vector& keypoints, float minSize, - float maxSize=FLT_MAX ); - /* - * Remove keypoints from some image by mask for pixels of this image. - */ - static void runByPixelsMask( std::vector& keypoints, const Mat& mask ); - /* - * Remove duplicated keypoints. - */ - static void removeDuplicated( std::vector& keypoints ); - /* - * Remove duplicated keypoints and sort the remaining keypoints - */ - static void removeDuplicatedSorted( std::vector& keypoints ); - - /* - * Retain the specified number of the best keypoints (according to the response) - */ - static void retainBest( std::vector& keypoints, int npoints ); -}; - - -/************************************ Base Classes ************************************/ - -/** @brief Abstract base class for 2D image feature detectors and descriptor extractors -*/ -#ifdef __EMSCRIPTEN__ -class CV_EXPORTS_W Feature2D : public Algorithm -#else -class CV_EXPORTS_W Feature2D : public virtual Algorithm -#endif -{ -public: - virtual ~Feature2D(); - - /** @brief Detects keypoints in an image (first variant) or image set (second variant). - - @param image Image. - @param keypoints The detected keypoints. In the second variant of the method keypoints[i] is a set - of keypoints detected in images[i] . - @param mask Mask specifying where to look for keypoints (optional). It must be a 8-bit integer - matrix with non-zero values in the region of interest. - */ - CV_WRAP virtual void detect( InputArray image, - CV_OUT std::vector& keypoints, - InputArray mask=noArray() ); - - /** @overload - @param images Image set. - @param keypoints The detected keypoints. In the second variant of the method keypoints[i] is a set - of keypoints detected in images[i] . - @param masks Masks for each input image specifying where to look for keypoints (optional). - masks[i] is a mask for images[i]. - */ - CV_WRAP virtual void detect( InputArrayOfArrays images, - CV_OUT std::vector >& keypoints, - InputArrayOfArrays masks=noArray() ); - - /** @brief Computes the descriptors for a set of keypoints detected in an image (first variant) or image set - (second variant). - - @param image Image. - @param keypoints Input collection of keypoints. Keypoints for which a descriptor cannot be - computed are removed. Sometimes new keypoints can be added, for example: SIFT duplicates keypoint - with several dominant orientations (for each orientation). - @param descriptors Computed descriptors. In the second variant of the method descriptors[i] are - descriptors computed for a keypoints[i]. Row j is the keypoints (or keypoints[i]) is the - descriptor for keypoint j-th keypoint. - */ - CV_WRAP virtual void compute( InputArray image, - CV_OUT CV_IN_OUT std::vector& keypoints, - OutputArray descriptors ); - - /** @overload - - @param images Image set. - @param keypoints Input collection of keypoints. Keypoints for which a descriptor cannot be - computed are removed. Sometimes new keypoints can be added, for example: SIFT duplicates keypoint - with several dominant orientations (for each orientation). - @param descriptors Computed descriptors. In the second variant of the method descriptors[i] are - descriptors computed for a keypoints[i]. Row j is the keypoints (or keypoints[i]) is the - descriptor for keypoint j-th keypoint. - */ - CV_WRAP virtual void compute( InputArrayOfArrays images, - CV_OUT CV_IN_OUT std::vector >& keypoints, - OutputArrayOfArrays descriptors ); - - /** Detects keypoints and computes the descriptors */ - CV_WRAP virtual void detectAndCompute( InputArray image, InputArray mask, - CV_OUT std::vector& keypoints, - OutputArray descriptors, - bool useProvidedKeypoints=false ); - - CV_WRAP virtual int descriptorSize() const; - CV_WRAP virtual int descriptorType() const; - CV_WRAP virtual int defaultNorm() const; - - CV_WRAP void write( const String& fileName ) const; - - CV_WRAP void read( const String& fileName ); - - virtual void write( FileStorage&) const CV_OVERRIDE; - - // see corresponding cv::Algorithm method - CV_WRAP virtual void read( const FileNode&) CV_OVERRIDE; - - //! Return true if detector object is empty - CV_WRAP virtual bool empty() const CV_OVERRIDE; - CV_WRAP virtual String getDefaultName() const CV_OVERRIDE; - - // see corresponding cv::Algorithm method - CV_WRAP inline void write(const Ptr& fs, const String& name = String()) const { Algorithm::write(fs, name); } -}; - -/** Feature detectors in OpenCV have wrappers with a common interface that enables you to easily switch -between different algorithms solving the same problem. All objects that implement keypoint detectors -inherit the FeatureDetector interface. */ -typedef Feature2D FeatureDetector; - -/** Extractors of keypoint descriptors in OpenCV have wrappers with a common interface that enables you -to easily switch between different algorithms solving the same problem. This section is devoted to -computing descriptors represented as vectors in a multidimensional space. All objects that implement -the vector descriptor extractors inherit the DescriptorExtractor interface. - */ -typedef Feature2D DescriptorExtractor; - -//! @addtogroup features2d_main -//! @{ - -/** @brief Class implementing the BRISK keypoint detector and descriptor extractor, described in @cite LCS11 . - */ -class CV_EXPORTS_W BRISK : public Feature2D -{ -public: - /** @brief The BRISK constructor - - @param thresh AGAST detection threshold score. - @param octaves detection octaves. Use 0 to do single scale. - @param patternScale apply this scale to the pattern used for sampling the neighbourhood of a - keypoint. - */ - CV_WRAP static Ptr create(int thresh=30, int octaves=3, float patternScale=1.0f); - - /** @brief The BRISK constructor for a custom pattern - - @param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for - keypoint scale 1). - @param numberList defines the number of sampling points on the sampling circle. Must be the same - size as radiusList.. - @param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint - scale 1). - @param dMin threshold for the long pairings used for orientation determination (in pixels for - keypoint scale 1). - @param indexChange index remapping of the bits. */ - CV_WRAP static Ptr create(const std::vector &radiusList, const std::vector &numberList, - float dMax=5.85f, float dMin=8.2f, const std::vector& indexChange=std::vector()); - - /** @brief The BRISK constructor for a custom pattern, detection threshold and octaves - - @param thresh AGAST detection threshold score. - @param octaves detection octaves. Use 0 to do single scale. - @param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for - keypoint scale 1). - @param numberList defines the number of sampling points on the sampling circle. Must be the same - size as radiusList.. - @param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint - scale 1). - @param dMin threshold for the long pairings used for orientation determination (in pixels for - keypoint scale 1). - @param indexChange index remapping of the bits. */ - CV_WRAP static Ptr create(int thresh, int octaves, const std::vector &radiusList, - const std::vector &numberList, float dMax=5.85f, float dMin=8.2f, - const std::vector& indexChange=std::vector()); - CV_WRAP virtual String getDefaultName() const CV_OVERRIDE; -}; - -/** @brief Class implementing the ORB (*oriented BRIEF*) keypoint detector and descriptor extractor - -described in @cite RRKB11 . The algorithm uses FAST in pyramids to detect stable keypoints, selects -the strongest features using FAST or Harris response, finds their orientation using first-order -moments and computes the descriptors using BRIEF (where the coordinates of random point pairs (or -k-tuples) are rotated according to the measured orientation). - */ -class CV_EXPORTS_W ORB : public Feature2D -{ -public: - enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 }; - - /** @brief The ORB constructor - - @param nfeatures The maximum number of features to retain. - @param scaleFactor Pyramid decimation ratio, greater than 1. scaleFactor==2 means the classical - pyramid, where each next level has 4x less pixels than the previous, but such a big scale factor - will degrade feature matching scores dramatically. On the other hand, too close to 1 scale factor - will mean that to cover certain scale range you will need more pyramid levels and so the speed - will suffer. - @param nlevels The number of pyramid levels. The smallest level will have linear size equal to - input_image_linear_size/pow(scaleFactor, nlevels - firstLevel). - @param edgeThreshold This is size of the border where the features are not detected. It should - roughly match the patchSize parameter. - @param firstLevel The level of pyramid to put source image to. Previous layers are filled - with upscaled source image. - @param WTA_K The number of points that produce each element of the oriented BRIEF descriptor. The - default value 2 means the BRIEF where we take a random point pair and compare their brightnesses, - so we get 0/1 response. Other possible values are 3 and 4. For example, 3 means that we take 3 - random points (of course, those point coordinates are random, but they are generated from the - pre-defined seed, so each element of BRIEF descriptor is computed deterministically from the pixel - rectangle), find point of maximum brightness and output index of the winner (0, 1 or 2). Such - output will occupy 2 bits, and therefore it will need a special variant of Hamming distance, - denoted as NORM_HAMMING2 (2 bits per bin). When WTA_K=4, we take 4 random points to compute each - bin (that will also occupy 2 bits with possible values 0, 1, 2 or 3). - @param scoreType The default HARRIS_SCORE means that Harris algorithm is used to rank features - (the score is written to KeyPoint::score and is used to retain best nfeatures features); - FAST_SCORE is alternative value of the parameter that produces slightly less stable keypoints, - but it is a little faster to compute. - @param patchSize size of the patch used by the oriented BRIEF descriptor. Of course, on smaller - pyramid layers the perceived image area covered by a feature will be larger. - @param fastThreshold - */ - CV_WRAP static Ptr create(int nfeatures=500, float scaleFactor=1.2f, int nlevels=8, int edgeThreshold=31, - int firstLevel=0, int WTA_K=2, int scoreType=ORB::HARRIS_SCORE, int patchSize=31, int fastThreshold=20); - - CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0; - CV_WRAP virtual int getMaxFeatures() const = 0; - - CV_WRAP virtual void setScaleFactor(double scaleFactor) = 0; - CV_WRAP virtual double getScaleFactor() const = 0; - - CV_WRAP virtual void setNLevels(int nlevels) = 0; - CV_WRAP virtual int getNLevels() const = 0; - - CV_WRAP virtual void setEdgeThreshold(int edgeThreshold) = 0; - CV_WRAP virtual int getEdgeThreshold() const = 0; - - CV_WRAP virtual void setFirstLevel(int firstLevel) = 0; - CV_WRAP virtual int getFirstLevel() const = 0; - - CV_WRAP virtual void setWTA_K(int wta_k) = 0; - CV_WRAP virtual int getWTA_K() const = 0; - - CV_WRAP virtual void setScoreType(int scoreType) = 0; - CV_WRAP virtual int getScoreType() const = 0; - - CV_WRAP virtual void setPatchSize(int patchSize) = 0; - CV_WRAP virtual int getPatchSize() const = 0; - - CV_WRAP virtual void setFastThreshold(int fastThreshold) = 0; - CV_WRAP virtual int getFastThreshold() const = 0; - CV_WRAP virtual String getDefaultName() const CV_OVERRIDE; -}; - -/** @brief Maximally stable extremal region extractor - -The class encapsulates all the parameters of the %MSER extraction algorithm (see [wiki -article](http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions)). - -- there are two different implementation of %MSER: one for grey image, one for color image - -- the grey image algorithm is taken from: @cite nister2008linear ; the paper claims to be faster -than union-find method; it actually get 1.5~2m/s on my centrino L7200 1.2GHz laptop. - -- the color image algorithm is taken from: @cite forssen2007maximally ; it should be much slower -than grey image method ( 3~4 times ); the chi_table.h file is taken directly from paper's source -code which is distributed under GPL. - -- (Python) A complete example showing the use of the %MSER detector can be found at samples/python/mser.py -*/ -class CV_EXPORTS_W MSER : public Feature2D -{ -public: - /** @brief Full consturctor for %MSER detector - - @param _delta it compares \f$(size_{i}-size_{i-delta})/size_{i-delta}\f$ - @param _min_area prune the area which smaller than minArea - @param _max_area prune the area which bigger than maxArea - @param _max_variation prune the area have similar size to its children - @param _min_diversity for color image, trace back to cut off mser with diversity less than min_diversity - @param _max_evolution for color image, the evolution steps - @param _area_threshold for color image, the area threshold to cause re-initialize - @param _min_margin for color image, ignore too small margin - @param _edge_blur_size for color image, the aperture size for edge blur - */ - CV_WRAP static Ptr create( int _delta=5, int _min_area=60, int _max_area=14400, - double _max_variation=0.25, double _min_diversity=.2, - int _max_evolution=200, double _area_threshold=1.01, - double _min_margin=0.003, int _edge_blur_size=5 ); - - /** @brief Detect %MSER regions - - @param image input image (8UC1, 8UC3 or 8UC4, must be greater or equal than 3x3) - @param msers resulting list of point sets - @param bboxes resulting bounding boxes - */ - CV_WRAP virtual void detectRegions( InputArray image, - CV_OUT std::vector >& msers, - CV_OUT std::vector& bboxes ) = 0; - - CV_WRAP virtual void setDelta(int delta) = 0; - CV_WRAP virtual int getDelta() const = 0; - - CV_WRAP virtual void setMinArea(int minArea) = 0; - CV_WRAP virtual int getMinArea() const = 0; - - CV_WRAP virtual void setMaxArea(int maxArea) = 0; - CV_WRAP virtual int getMaxArea() const = 0; - - CV_WRAP virtual void setPass2Only(bool f) = 0; - CV_WRAP virtual bool getPass2Only() const = 0; - CV_WRAP virtual String getDefaultName() const CV_OVERRIDE; -}; - -/** @overload */ -CV_EXPORTS void FAST( InputArray image, CV_OUT std::vector& keypoints, - int threshold, bool nonmaxSuppression=true ); - -/** @brief Detects corners using the FAST algorithm - -@param image grayscale image where keypoints (corners) are detected. -@param keypoints keypoints detected on the image. -@param threshold threshold on difference between intensity of the central pixel and pixels of a -circle around this pixel. -@param nonmaxSuppression if true, non-maximum suppression is applied to detected corners -(keypoints). -@param type one of the three neighborhoods as defined in the paper: -FastFeatureDetector::TYPE_9_16, FastFeatureDetector::TYPE_7_12, -FastFeatureDetector::TYPE_5_8 - -Detects corners using the FAST algorithm by @cite Rosten06 . - -@note In Python API, types are given as cv2.FAST_FEATURE_DETECTOR_TYPE_5_8, -cv2.FAST_FEATURE_DETECTOR_TYPE_7_12 and cv2.FAST_FEATURE_DETECTOR_TYPE_9_16. For corner -detection, use cv2.FAST.detect() method. - */ -CV_EXPORTS void FAST( InputArray image, CV_OUT std::vector& keypoints, - int threshold, bool nonmaxSuppression, int type ); - -//! @} features2d_main - -//! @addtogroup features2d_main -//! @{ - -/** @brief Wrapping class for feature detection using the FAST method. : - */ -class CV_EXPORTS_W FastFeatureDetector : public Feature2D -{ -public: - enum - { - TYPE_5_8 = 0, TYPE_7_12 = 1, TYPE_9_16 = 2, - THRESHOLD = 10000, NONMAX_SUPPRESSION=10001, FAST_N=10002, - }; - - CV_WRAP static Ptr create( int threshold=10, - bool nonmaxSuppression=true, - int type=FastFeatureDetector::TYPE_9_16 ); - - CV_WRAP virtual void setThreshold(int threshold) = 0; - CV_WRAP virtual int getThreshold() const = 0; - - CV_WRAP virtual void setNonmaxSuppression(bool f) = 0; - CV_WRAP virtual bool getNonmaxSuppression() const = 0; - - CV_WRAP virtual void setType(int type) = 0; - CV_WRAP virtual int getType() const = 0; - CV_WRAP virtual String getDefaultName() const CV_OVERRIDE; -}; - -/** @overload */ -CV_EXPORTS void AGAST( InputArray image, CV_OUT std::vector& keypoints, - int threshold, bool nonmaxSuppression=true ); - -/** @brief Detects corners using the AGAST algorithm - -@param image grayscale image where keypoints (corners) are detected. -@param keypoints keypoints detected on the image. -@param threshold threshold on difference between intensity of the central pixel and pixels of a -circle around this pixel. -@param nonmaxSuppression if true, non-maximum suppression is applied to detected corners -(keypoints). -@param type one of the four neighborhoods as defined in the paper: -AgastFeatureDetector::AGAST_5_8, AgastFeatureDetector::AGAST_7_12d, -AgastFeatureDetector::AGAST_7_12s, AgastFeatureDetector::OAST_9_16 - -For non-Intel platforms, there is a tree optimised variant of AGAST with same numerical results. -The 32-bit binary tree tables were generated automatically from original code using perl script. -The perl script and examples of tree generation are placed in features2d/doc folder. -Detects corners using the AGAST algorithm by @cite mair2010_agast . - - */ -CV_EXPORTS void AGAST( InputArray image, CV_OUT std::vector& keypoints, - int threshold, bool nonmaxSuppression, int type ); -//! @} features2d_main - -//! @addtogroup features2d_main -//! @{ - -/** @brief Wrapping class for feature detection using the AGAST method. : - */ -class CV_EXPORTS_W AgastFeatureDetector : public Feature2D -{ -public: - enum - { - AGAST_5_8 = 0, AGAST_7_12d = 1, AGAST_7_12s = 2, OAST_9_16 = 3, - THRESHOLD = 10000, NONMAX_SUPPRESSION = 10001, - }; - - CV_WRAP static Ptr create( int threshold=10, - bool nonmaxSuppression=true, - int type=AgastFeatureDetector::OAST_9_16 ); - - CV_WRAP virtual void setThreshold(int threshold) = 0; - CV_WRAP virtual int getThreshold() const = 0; - - CV_WRAP virtual void setNonmaxSuppression(bool f) = 0; - CV_WRAP virtual bool getNonmaxSuppression() const = 0; - - CV_WRAP virtual void setType(int type) = 0; - CV_WRAP virtual int getType() const = 0; - CV_WRAP virtual String getDefaultName() const CV_OVERRIDE; -}; - -/** @brief Wrapping class for feature detection using the goodFeaturesToTrack function. : - */ -class CV_EXPORTS_W GFTTDetector : public Feature2D -{ -public: - CV_WRAP static Ptr create( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1, - int blockSize=3, bool useHarrisDetector=false, double k=0.04 ); - CV_WRAP static Ptr create( int maxCorners, double qualityLevel, double minDistance, - int blockSize, int gradiantSize, bool useHarrisDetector=false, double k=0.04 ); - CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0; - CV_WRAP virtual int getMaxFeatures() const = 0; - - CV_WRAP virtual void setQualityLevel(double qlevel) = 0; - CV_WRAP virtual double getQualityLevel() const = 0; - - CV_WRAP virtual void setMinDistance(double minDistance) = 0; - CV_WRAP virtual double getMinDistance() const = 0; - - CV_WRAP virtual void setBlockSize(int blockSize) = 0; - CV_WRAP virtual int getBlockSize() const = 0; - - CV_WRAP virtual void setHarrisDetector(bool val) = 0; - CV_WRAP virtual bool getHarrisDetector() const = 0; - - CV_WRAP virtual void setK(double k) = 0; - CV_WRAP virtual double getK() const = 0; - CV_WRAP virtual String getDefaultName() const CV_OVERRIDE; -}; - -/** @brief Class for extracting blobs from an image. : - -The class implements a simple algorithm for extracting blobs from an image: - -1. Convert the source image to binary images by applying thresholding with several thresholds from - minThreshold (inclusive) to maxThreshold (exclusive) with distance thresholdStep between - neighboring thresholds. -2. Extract connected components from every binary image by findContours and calculate their - centers. -3. Group centers from several binary images by their coordinates. Close centers form one group that - corresponds to one blob, which is controlled by the minDistBetweenBlobs parameter. -4. From the groups, estimate final centers of blobs and their radiuses and return as locations and - sizes of keypoints. - -This class performs several filtrations of returned blobs. You should set filterBy\* to true/false -to turn on/off corresponding filtration. Available filtrations: - -- **By color**. This filter compares the intensity of a binary image at the center of a blob to -blobColor. If they differ, the blob is filtered out. Use blobColor = 0 to extract dark blobs -and blobColor = 255 to extract light blobs. -- **By area**. Extracted blobs have an area between minArea (inclusive) and maxArea (exclusive). -- **By circularity**. Extracted blobs have circularity -(\f$\frac{4*\pi*Area}{perimeter * perimeter}\f$) between minCircularity (inclusive) and -maxCircularity (exclusive). -- **By ratio of the minimum inertia to maximum inertia**. Extracted blobs have this ratio -between minInertiaRatio (inclusive) and maxInertiaRatio (exclusive). -- **By convexity**. Extracted blobs have convexity (area / area of blob convex hull) between -minConvexity (inclusive) and maxConvexity (exclusive). - -Default values of parameters are tuned to extract dark circular blobs. - */ -class CV_EXPORTS_W SimpleBlobDetector : public Feature2D -{ -public: - struct CV_EXPORTS_W_SIMPLE Params - { - CV_WRAP Params(); - CV_PROP_RW float thresholdStep; - CV_PROP_RW float minThreshold; - CV_PROP_RW float maxThreshold; - CV_PROP_RW size_t minRepeatability; - CV_PROP_RW float minDistBetweenBlobs; - - CV_PROP_RW bool filterByColor; - CV_PROP_RW uchar blobColor; - - CV_PROP_RW bool filterByArea; - CV_PROP_RW float minArea, maxArea; - - CV_PROP_RW bool filterByCircularity; - CV_PROP_RW float minCircularity, maxCircularity; - - CV_PROP_RW bool filterByInertia; - CV_PROP_RW float minInertiaRatio, maxInertiaRatio; - - CV_PROP_RW bool filterByConvexity; - CV_PROP_RW float minConvexity, maxConvexity; - - void read( const FileNode& fn ); - void write( FileStorage& fs ) const; - }; - - CV_WRAP static Ptr - create(const SimpleBlobDetector::Params ¶meters = SimpleBlobDetector::Params()); - CV_WRAP virtual String getDefaultName() const CV_OVERRIDE; -}; - -//! @} features2d_main - -//! @addtogroup features2d_main -//! @{ - -/** @brief Class implementing the KAZE keypoint detector and descriptor extractor, described in @cite ABD12 . - -@note AKAZE descriptor can only be used with KAZE or AKAZE keypoints .. [ABD12] KAZE Features. Pablo -F. Alcantarilla, Adrien Bartoli and Andrew J. Davison. In European Conference on Computer Vision -(ECCV), Fiorenze, Italy, October 2012. -*/ -class CV_EXPORTS_W KAZE : public Feature2D -{ -public: - enum - { - DIFF_PM_G1 = 0, - DIFF_PM_G2 = 1, - DIFF_WEICKERT = 2, - DIFF_CHARBONNIER = 3 - }; - - /** @brief The KAZE constructor - - @param extended Set to enable extraction of extended (128-byte) descriptor. - @param upright Set to enable use of upright descriptors (non rotation-invariant). - @param threshold Detector response threshold to accept point - @param nOctaves Maximum octave evolution of the image - @param nOctaveLayers Default number of sublevels per scale level - @param diffusivity Diffusivity type. DIFF_PM_G1, DIFF_PM_G2, DIFF_WEICKERT or - DIFF_CHARBONNIER - */ - CV_WRAP static Ptr create(bool extended=false, bool upright=false, - float threshold = 0.001f, - int nOctaves = 4, int nOctaveLayers = 4, - int diffusivity = KAZE::DIFF_PM_G2); - - CV_WRAP virtual void setExtended(bool extended) = 0; - CV_WRAP virtual bool getExtended() const = 0; - - CV_WRAP virtual void setUpright(bool upright) = 0; - CV_WRAP virtual bool getUpright() const = 0; - - CV_WRAP virtual void setThreshold(double threshold) = 0; - CV_WRAP virtual double getThreshold() const = 0; - - CV_WRAP virtual void setNOctaves(int octaves) = 0; - CV_WRAP virtual int getNOctaves() const = 0; - - CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0; - CV_WRAP virtual int getNOctaveLayers() const = 0; - - CV_WRAP virtual void setDiffusivity(int diff) = 0; - CV_WRAP virtual int getDiffusivity() const = 0; - CV_WRAP virtual String getDefaultName() const CV_OVERRIDE; -}; - -/** @brief Class implementing the AKAZE keypoint detector and descriptor extractor, described in @cite ANB13. - -@details AKAZE descriptors can only be used with KAZE or AKAZE keypoints. This class is thread-safe. - -@note When you need descriptors use Feature2D::detectAndCompute, which -provides better performance. When using Feature2D::detect followed by -Feature2D::compute scale space pyramid is computed twice. - -@note AKAZE implements T-API. When image is passed as UMat some parts of the algorithm -will use OpenCL. - -@note [ANB13] Fast Explicit Diffusion for Accelerated Features in Nonlinear -Scale Spaces. Pablo F. Alcantarilla, Jes煤s Nuevo and Adrien Bartoli. In -British Machine Vision Conference (BMVC), Bristol, UK, September 2013. - -*/ -class CV_EXPORTS_W AKAZE : public Feature2D -{ -public: - // AKAZE descriptor type - enum - { - DESCRIPTOR_KAZE_UPRIGHT = 2, ///< Upright descriptors, not invariant to rotation - DESCRIPTOR_KAZE = 3, - DESCRIPTOR_MLDB_UPRIGHT = 4, ///< Upright descriptors, not invariant to rotation - DESCRIPTOR_MLDB = 5 - }; - - /** @brief The AKAZE constructor - - @param descriptor_type Type of the extracted descriptor: DESCRIPTOR_KAZE, - DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT. - @param descriptor_size Size of the descriptor in bits. 0 -\> Full size - @param descriptor_channels Number of channels in the descriptor (1, 2, 3) - @param threshold Detector response threshold to accept point - @param nOctaves Maximum octave evolution of the image - @param nOctaveLayers Default number of sublevels per scale level - @param diffusivity Diffusivity type. DIFF_PM_G1, DIFF_PM_G2, DIFF_WEICKERT or - DIFF_CHARBONNIER - */ - CV_WRAP static Ptr create(int descriptor_type=AKAZE::DESCRIPTOR_MLDB, - int descriptor_size = 0, int descriptor_channels = 3, - float threshold = 0.001f, int nOctaves = 4, - int nOctaveLayers = 4, int diffusivity = KAZE::DIFF_PM_G2); - - CV_WRAP virtual void setDescriptorType(int dtype) = 0; - CV_WRAP virtual int getDescriptorType() const = 0; - - CV_WRAP virtual void setDescriptorSize(int dsize) = 0; - CV_WRAP virtual int getDescriptorSize() const = 0; - - CV_WRAP virtual void setDescriptorChannels(int dch) = 0; - CV_WRAP virtual int getDescriptorChannels() const = 0; - - CV_WRAP virtual void setThreshold(double threshold) = 0; - CV_WRAP virtual double getThreshold() const = 0; - - CV_WRAP virtual void setNOctaves(int octaves) = 0; - CV_WRAP virtual int getNOctaves() const = 0; - - CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0; - CV_WRAP virtual int getNOctaveLayers() const = 0; - - CV_WRAP virtual void setDiffusivity(int diff) = 0; - CV_WRAP virtual int getDiffusivity() const = 0; - CV_WRAP virtual String getDefaultName() const CV_OVERRIDE; -}; - -//! @} features2d_main - -/****************************************************************************************\ -* Distance * -\****************************************************************************************/ - -template -struct CV_EXPORTS Accumulator -{ - typedef T Type; -}; - -template<> struct Accumulator { typedef float Type; }; -template<> struct Accumulator { typedef float Type; }; -template<> struct Accumulator { typedef float Type; }; -template<> struct Accumulator { typedef float Type; }; - -/* - * Squared Euclidean distance functor - */ -template -struct CV_EXPORTS SL2 -{ - enum { normType = NORM_L2SQR }; - typedef T ValueType; - typedef typename Accumulator::Type ResultType; - - ResultType operator()( const T* a, const T* b, int size ) const - { - return normL2Sqr(a, b, size); - } -}; - -/* - * Euclidean distance functor - */ -template -struct L2 -{ - enum { normType = NORM_L2 }; - typedef T ValueType; - typedef typename Accumulator::Type ResultType; - - ResultType operator()( const T* a, const T* b, int size ) const - { - return (ResultType)std::sqrt((double)normL2Sqr(a, b, size)); - } -}; - -/* - * Manhattan distance (city block distance) functor - */ -template -struct L1 -{ - enum { normType = NORM_L1 }; - typedef T ValueType; - typedef typename Accumulator::Type ResultType; - - ResultType operator()( const T* a, const T* b, int size ) const - { - return normL1(a, b, size); - } -}; - -/****************************************************************************************\ -* DescriptorMatcher * -\****************************************************************************************/ - -//! @addtogroup features2d_match -//! @{ - -/** @brief Abstract base class for matching keypoint descriptors. - -It has two groups of match methods: for matching descriptors of an image with another image or with -an image set. - */ -class CV_EXPORTS_W DescriptorMatcher : public Algorithm -{ -public: - enum - { - FLANNBASED = 1, - BRUTEFORCE = 2, - BRUTEFORCE_L1 = 3, - BRUTEFORCE_HAMMING = 4, - BRUTEFORCE_HAMMINGLUT = 5, - BRUTEFORCE_SL2 = 6 - }; - virtual ~DescriptorMatcher(); - - /** @brief Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor - collection. - - If the collection is not empty, the new descriptors are added to existing train descriptors. - - @param descriptors Descriptors to add. Each descriptors[i] is a set of descriptors from the same - train image. - */ - CV_WRAP virtual void add( InputArrayOfArrays descriptors ); - - /** @brief Returns a constant link to the train descriptor collection trainDescCollection . - */ - CV_WRAP const std::vector& getTrainDescriptors() const; - - /** @brief Clears the train descriptor collections. - */ - CV_WRAP virtual void clear() CV_OVERRIDE; - - /** @brief Returns true if there are no train descriptors in the both collections. - */ - CV_WRAP virtual bool empty() const CV_OVERRIDE; - - /** @brief Returns true if the descriptor matcher supports masking permissible matches. - */ - CV_WRAP virtual bool isMaskSupported() const = 0; - - /** @brief Trains a descriptor matcher - - Trains a descriptor matcher (for example, the flann index). In all methods to match, the method - train() is run every time before matching. Some descriptor matchers (for example, BruteForceMatcher) - have an empty implementation of this method. Other matchers really train their inner structures (for - example, FlannBasedMatcher trains flann::Index ). - */ - CV_WRAP virtual void train(); - - /** @brief Finds the best match for each descriptor from a query set. - - @param queryDescriptors Query set of descriptors. - @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors - collection stored in the class object. - @param matches Matches. If a query descriptor is masked out in mask , no match is added for this - descriptor. So, matches size may be smaller than the query descriptors count. - @param mask Mask specifying permissible matches between an input query and train matrices of - descriptors. - - In the first variant of this method, the train descriptors are passed as an input argument. In the - second variant of the method, train descriptors collection that was set by DescriptorMatcher::add is - used. Optional mask (or masks) can be passed to specify which query and training descriptors can be - matched. Namely, queryDescriptors[i] can be matched with trainDescriptors[j] only if - mask.at\(i,j) is non-zero. - */ - CV_WRAP void match( InputArray queryDescriptors, InputArray trainDescriptors, - CV_OUT std::vector& matches, InputArray mask=noArray() ) const; - - /** @brief Finds the k best matches for each descriptor from a query set. - - @param queryDescriptors Query set of descriptors. - @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors - collection stored in the class object. - @param mask Mask specifying permissible matches between an input query and train matrices of - descriptors. - @param matches Matches. Each matches[i] is k or less matches for the same query descriptor. - @param k Count of best matches found per each query descriptor or less if a query descriptor has - less than k possible matches in total. - @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is - false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, - the matches vector does not contain matches for fully masked-out query descriptors. - - These extended variants of DescriptorMatcher::match methods find several best matches for each query - descriptor. The matches are returned in the distance increasing order. See DescriptorMatcher::match - for the details about query and train descriptors. - */ - CV_WRAP void knnMatch( InputArray queryDescriptors, InputArray trainDescriptors, - CV_OUT std::vector >& matches, int k, - InputArray mask=noArray(), bool compactResult=false ) const; - - /** @brief For each query descriptor, finds the training descriptors not farther than the specified distance. - - @param queryDescriptors Query set of descriptors. - @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors - collection stored in the class object. - @param matches Found matches. - @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is - false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, - the matches vector does not contain matches for fully masked-out query descriptors. - @param maxDistance Threshold for the distance between matched descriptors. Distance means here - metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured - in Pixels)! - @param mask Mask specifying permissible matches between an input query and train matrices of - descriptors. - - For each query descriptor, the methods find such training descriptors that the distance between the - query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches are - returned in the distance increasing order. - */ - CV_WRAP void radiusMatch( InputArray queryDescriptors, InputArray trainDescriptors, - CV_OUT std::vector >& matches, float maxDistance, - InputArray mask=noArray(), bool compactResult=false ) const; - - /** @overload - @param queryDescriptors Query set of descriptors. - @param matches Matches. If a query descriptor is masked out in mask , no match is added for this - descriptor. So, matches size may be smaller than the query descriptors count. - @param masks Set of masks. Each masks[i] specifies permissible matches between the input query - descriptors and stored train descriptors from the i-th image trainDescCollection[i]. - */ - CV_WRAP void match( InputArray queryDescriptors, CV_OUT std::vector& matches, - InputArrayOfArrays masks=noArray() ); - /** @overload - @param queryDescriptors Query set of descriptors. - @param matches Matches. Each matches[i] is k or less matches for the same query descriptor. - @param k Count of best matches found per each query descriptor or less if a query descriptor has - less than k possible matches in total. - @param masks Set of masks. Each masks[i] specifies permissible matches between the input query - descriptors and stored train descriptors from the i-th image trainDescCollection[i]. - @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is - false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, - the matches vector does not contain matches for fully masked-out query descriptors. - */ - CV_WRAP void knnMatch( InputArray queryDescriptors, CV_OUT std::vector >& matches, int k, - InputArrayOfArrays masks=noArray(), bool compactResult=false ); - /** @overload - @param queryDescriptors Query set of descriptors. - @param matches Found matches. - @param maxDistance Threshold for the distance between matched descriptors. Distance means here - metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured - in Pixels)! - @param masks Set of masks. Each masks[i] specifies permissible matches between the input query - descriptors and stored train descriptors from the i-th image trainDescCollection[i]. - @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is - false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, - the matches vector does not contain matches for fully masked-out query descriptors. - */ - CV_WRAP void radiusMatch( InputArray queryDescriptors, CV_OUT std::vector >& matches, float maxDistance, - InputArrayOfArrays masks=noArray(), bool compactResult=false ); - - - CV_WRAP void write( const String& fileName ) const - { - FileStorage fs(fileName, FileStorage::WRITE); - write(fs); - } - - CV_WRAP void read( const String& fileName ) - { - FileStorage fs(fileName, FileStorage::READ); - read(fs.root()); - } - // Reads matcher object from a file node - // see corresponding cv::Algorithm method - CV_WRAP virtual void read( const FileNode& ) CV_OVERRIDE; - // Writes matcher object to a file storage - virtual void write( FileStorage& ) const CV_OVERRIDE; - - /** @brief Clones the matcher. - - @param emptyTrainData If emptyTrainData is false, the method creates a deep copy of the object, - that is, copies both parameters and train data. If emptyTrainData is true, the method creates an - object copy with the current parameters but with empty train data. - */ - CV_WRAP virtual Ptr clone( bool emptyTrainData=false ) const = 0; - - /** @brief Creates a descriptor matcher of a given type with the default parameters (using default - constructor). - - @param descriptorMatcherType Descriptor matcher type. Now the following matcher types are - supported: - - `BruteForce` (it uses L2 ) - - `BruteForce-L1` - - `BruteForce-Hamming` - - `BruteForce-Hamming(2)` - - `FlannBased` - */ - CV_WRAP static Ptr create( const String& descriptorMatcherType ); - - CV_WRAP static Ptr create( int matcherType ); - - - // see corresponding cv::Algorithm method - CV_WRAP inline void write(const Ptr& fs, const String& name = String()) const { Algorithm::write(fs, name); } - -protected: - /** - * Class to work with descriptors from several images as with one merged matrix. - * It is used e.g. in FlannBasedMatcher. - */ - class CV_EXPORTS DescriptorCollection - { - public: - DescriptorCollection(); - DescriptorCollection( const DescriptorCollection& collection ); - virtual ~DescriptorCollection(); - - // Vector of matrices "descriptors" will be merged to one matrix "mergedDescriptors" here. - void set( const std::vector& descriptors ); - virtual void clear(); - - const Mat& getDescriptors() const; - const Mat getDescriptor( int imgIdx, int localDescIdx ) const; - const Mat getDescriptor( int globalDescIdx ) const; - void getLocalIdx( int globalDescIdx, int& imgIdx, int& localDescIdx ) const; - - int size() const; - - protected: - Mat mergedDescriptors; - std::vector startIdxs; - }; - - //! In fact the matching is implemented only by the following two methods. These methods suppose - //! that the class object has been trained already. Public match methods call these methods - //! after calling train(). - virtual void knnMatchImpl( InputArray queryDescriptors, std::vector >& matches, int k, - InputArrayOfArrays masks=noArray(), bool compactResult=false ) = 0; - virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector >& matches, float maxDistance, - InputArrayOfArrays masks=noArray(), bool compactResult=false ) = 0; - - static bool isPossibleMatch( InputArray mask, int queryIdx, int trainIdx ); - static bool isMaskedOut( InputArrayOfArrays masks, int queryIdx ); - - static Mat clone_op( Mat m ) { return m.clone(); } - void checkMasks( InputArrayOfArrays masks, int queryDescriptorsCount ) const; - - //! Collection of descriptors from train images. - std::vector trainDescCollection; - std::vector utrainDescCollection; -}; - -/** @brief Brute-force descriptor matcher. - -For each descriptor in the first set, this matcher finds the closest descriptor in the second set -by trying each one. This descriptor matcher supports masking permissible matches of descriptor -sets. - */ -class CV_EXPORTS_W BFMatcher : public DescriptorMatcher -{ -public: - /** @brief Brute-force matcher constructor (obsolete). Please use BFMatcher.create() - * - * - */ - CV_WRAP BFMatcher( int normType=NORM_L2, bool crossCheck=false ); - - virtual ~BFMatcher() {} - - virtual bool isMaskSupported() const CV_OVERRIDE { return true; } - - /** @brief Brute-force matcher create method. - @param normType One of NORM_L1, NORM_L2, NORM_HAMMING, NORM_HAMMING2. L1 and L2 norms are - preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be used with ORB, BRISK and - BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4 (see ORB::ORB constructor - description). - @param crossCheck If it is false, this is will be default BFMatcher behaviour when it finds the k - nearest neighbors for each query descriptor. If crossCheck==true, then the knnMatch() method with - k=1 will only return pairs (i,j) such that for i-th query descriptor the j-th descriptor in the - matcher's collection is the nearest and vice versa, i.e. the BFMatcher will only return consistent - pairs. Such technique usually produces best results with minimal number of outliers when there are - enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper. - */ - CV_WRAP static Ptr create( int normType=NORM_L2, bool crossCheck=false ) ; - - virtual Ptr clone( bool emptyTrainData=false ) const CV_OVERRIDE; -protected: - virtual void knnMatchImpl( InputArray queryDescriptors, std::vector >& matches, int k, - InputArrayOfArrays masks=noArray(), bool compactResult=false ) CV_OVERRIDE; - virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector >& matches, float maxDistance, - InputArrayOfArrays masks=noArray(), bool compactResult=false ) CV_OVERRIDE; - - int normType; - bool crossCheck; -}; - -#if defined(HAVE_OPENCV_FLANN) || defined(CV_DOXYGEN) - -/** @brief Flann-based descriptor matcher. - -This matcher trains cv::flann::Index on a train descriptor collection and calls its nearest search -methods to find the best matches. So, this matcher may be faster when matching a large train -collection than the brute force matcher. FlannBasedMatcher does not support masking permissible -matches of descriptor sets because flann::Index does not support this. : - */ -class CV_EXPORTS_W FlannBasedMatcher : public DescriptorMatcher -{ -public: - CV_WRAP FlannBasedMatcher( const Ptr& indexParams=makePtr(), - const Ptr& searchParams=makePtr() ); - - virtual void add( InputArrayOfArrays descriptors ) CV_OVERRIDE; - virtual void clear() CV_OVERRIDE; - - // Reads matcher object from a file node - virtual void read( const FileNode& ) CV_OVERRIDE; - // Writes matcher object to a file storage - virtual void write( FileStorage& ) const CV_OVERRIDE; - - virtual void train() CV_OVERRIDE; - virtual bool isMaskSupported() const CV_OVERRIDE; - - CV_WRAP static Ptr create(); - - virtual Ptr clone( bool emptyTrainData=false ) const CV_OVERRIDE; -protected: - static void convertToDMatches( const DescriptorCollection& descriptors, - const Mat& indices, const Mat& distances, - std::vector >& matches ); - - virtual void knnMatchImpl( InputArray queryDescriptors, std::vector >& matches, int k, - InputArrayOfArrays masks=noArray(), bool compactResult=false ) CV_OVERRIDE; - virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector >& matches, float maxDistance, - InputArrayOfArrays masks=noArray(), bool compactResult=false ) CV_OVERRIDE; - - Ptr indexParams; - Ptr searchParams; - Ptr flannIndex; - - DescriptorCollection mergedDescriptors; - int addedDescCount; -}; - -#endif - -//! @} features2d_match - -/****************************************************************************************\ -* Drawing functions * -\****************************************************************************************/ - -//! @addtogroup features2d_draw -//! @{ - -struct CV_EXPORTS DrawMatchesFlags -{ - enum{ DEFAULT = 0, //!< Output image matrix will be created (Mat::create), - //!< i.e. existing memory of output image may be reused. - //!< Two source image, matches and single keypoints will be drawn. - //!< For each keypoint only the center point will be drawn (without - //!< the circle around keypoint with keypoint size and orientation). - DRAW_OVER_OUTIMG = 1, //!< Output image matrix will not be created (Mat::create). - //!< Matches will be drawn on existing content of output image. - NOT_DRAW_SINGLE_POINTS = 2, //!< Single keypoints will not be drawn. - DRAW_RICH_KEYPOINTS = 4 //!< For each keypoint the circle around keypoint with keypoint size and - //!< orientation will be drawn. - }; -}; - -/** @brief Draws keypoints. - -@param image Source image. -@param keypoints Keypoints from the source image. -@param outImage Output image. Its content depends on the flags value defining what is drawn in the -output image. See possible flags bit values below. -@param color Color of keypoints. -@param flags Flags setting drawing features. Possible flags bit values are defined by -DrawMatchesFlags. See details above in drawMatches . - -@note -For Python API, flags are modified as cv2.DRAW_MATCHES_FLAGS_DEFAULT, -cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv2.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG, -cv2.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS - */ -CV_EXPORTS_W void drawKeypoints( InputArray image, const std::vector& keypoints, InputOutputArray outImage, - const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT ); - -/** @brief Draws the found matches of keypoints from two images. - -@param img1 First source image. -@param keypoints1 Keypoints from the first source image. -@param img2 Second source image. -@param keypoints2 Keypoints from the second source image. -@param matches1to2 Matches from the first image to the second one, which means that keypoints1[i] -has a corresponding point in keypoints2[matches[i]] . -@param outImg Output image. Its content depends on the flags value defining what is drawn in the -output image. See possible flags bit values below. -@param matchColor Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1) -, the color is generated randomly. -@param singlePointColor Color of single keypoints (circles), which means that keypoints do not -have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly. -@param matchesMask Mask determining which matches are drawn. If the mask is empty, all matches are -drawn. -@param flags Flags setting drawing features. Possible flags bit values are defined by -DrawMatchesFlags. - -This function draws matches of keypoints from two images in the output image. Match is a line -connecting two keypoints (circles). See cv::DrawMatchesFlags. - */ -CV_EXPORTS_W void drawMatches( InputArray img1, const std::vector& keypoints1, - InputArray img2, const std::vector& keypoints2, - const std::vector& matches1to2, InputOutputArray outImg, - const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), - const std::vector& matchesMask=std::vector(), int flags=DrawMatchesFlags::DEFAULT ); - -/** @overload */ -CV_EXPORTS_AS(drawMatchesKnn) void drawMatches( InputArray img1, const std::vector& keypoints1, - InputArray img2, const std::vector& keypoints2, - const std::vector >& matches1to2, InputOutputArray outImg, - const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), - const std::vector >& matchesMask=std::vector >(), int flags=DrawMatchesFlags::DEFAULT ); - -//! @} features2d_draw - -/****************************************************************************************\ -* Functions to evaluate the feature detectors and [generic] descriptor extractors * -\****************************************************************************************/ - -CV_EXPORTS void evaluateFeatureDetector( const Mat& img1, const Mat& img2, const Mat& H1to2, - std::vector* keypoints1, std::vector* keypoints2, - float& repeatability, int& correspCount, - const Ptr& fdetector=Ptr() ); - -CV_EXPORTS void computeRecallPrecisionCurve( const std::vector >& matches1to2, - const std::vector >& correctMatches1to2Mask, - std::vector& recallPrecisionCurve ); - -CV_EXPORTS float getRecall( const std::vector& recallPrecisionCurve, float l_precision ); -CV_EXPORTS int getNearestPoint( const std::vector& recallPrecisionCurve, float l_precision ); - -/****************************************************************************************\ -* Bag of visual words * -\****************************************************************************************/ - -//! @addtogroup features2d_category -//! @{ - -/** @brief Abstract base class for training the *bag of visual words* vocabulary from a set of descriptors. - -For details, see, for example, *Visual Categorization with Bags of Keypoints* by Gabriella Csurka, -Christopher R. Dance, Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. : - */ -class CV_EXPORTS_W BOWTrainer -{ -public: - BOWTrainer(); - virtual ~BOWTrainer(); - - /** @brief Adds descriptors to a training set. - - @param descriptors Descriptors to add to a training set. Each row of the descriptors matrix is a - descriptor. - - The training set is clustered using clustermethod to construct the vocabulary. - */ - CV_WRAP void add( const Mat& descriptors ); - - /** @brief Returns a training set of descriptors. - */ - CV_WRAP const std::vector& getDescriptors() const; - - /** @brief Returns the count of all descriptors stored in the training set. - */ - CV_WRAP int descriptorsCount() const; - - CV_WRAP virtual void clear(); - - /** @overload */ - CV_WRAP virtual Mat cluster() const = 0; - - /** @brief Clusters train descriptors. - - @param descriptors Descriptors to cluster. Each row of the descriptors matrix is a descriptor. - Descriptors are not added to the inner train descriptor set. - - The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first - variant of the method, train descriptors stored in the object are clustered. In the second variant, - input descriptors are clustered. - */ - CV_WRAP virtual Mat cluster( const Mat& descriptors ) const = 0; - -protected: - std::vector descriptors; - int size; -}; - -/** @brief kmeans -based class to train visual vocabulary using the *bag of visual words* approach. : - */ -class CV_EXPORTS_W BOWKMeansTrainer : public BOWTrainer -{ -public: - /** @brief The constructor. - - @see cv::kmeans - */ - CV_WRAP BOWKMeansTrainer( int clusterCount, const TermCriteria& termcrit=TermCriteria(), - int attempts=3, int flags=KMEANS_PP_CENTERS ); - virtual ~BOWKMeansTrainer(); - - // Returns trained vocabulary (i.e. cluster centers). - CV_WRAP virtual Mat cluster() const CV_OVERRIDE; - CV_WRAP virtual Mat cluster( const Mat& descriptors ) const CV_OVERRIDE; - -protected: - - int clusterCount; - TermCriteria termcrit; - int attempts; - int flags; -}; - -/** @brief Class to compute an image descriptor using the *bag of visual words*. - -Such a computation consists of the following steps: - -1. Compute descriptors for a given image and its keypoints set. -2. Find the nearest visual words from the vocabulary for each keypoint descriptor. -3. Compute the bag-of-words image descriptor as is a normalized histogram of vocabulary words -encountered in the image. The i-th bin of the histogram is a frequency of i-th word of the -vocabulary in the given image. - */ -class CV_EXPORTS_W BOWImgDescriptorExtractor -{ -public: - /** @brief The constructor. - - @param dextractor Descriptor extractor that is used to compute descriptors for an input image and - its keypoints. - @param dmatcher Descriptor matcher that is used to find the nearest word of the trained vocabulary - for each keypoint descriptor of the image. - */ - CV_WRAP BOWImgDescriptorExtractor( const Ptr& dextractor, - const Ptr& dmatcher ); - /** @overload */ - BOWImgDescriptorExtractor( const Ptr& dmatcher ); - virtual ~BOWImgDescriptorExtractor(); - - /** @brief Sets a visual vocabulary. - - @param vocabulary Vocabulary (can be trained using the inheritor of BOWTrainer ). Each row of the - vocabulary is a visual word (cluster center). - */ - CV_WRAP void setVocabulary( const Mat& vocabulary ); - - /** @brief Returns the set vocabulary. - */ - CV_WRAP const Mat& getVocabulary() const; - - /** @brief Computes an image descriptor using the set visual vocabulary. - - @param image Image, for which the descriptor is computed. - @param keypoints Keypoints detected in the input image. - @param imgDescriptor Computed output image descriptor. - @param pointIdxsOfClusters Indices of keypoints that belong to the cluster. This means that - pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary) - returned if it is non-zero. - @param descriptors Descriptors of the image keypoints that are returned if they are non-zero. - */ - void compute( InputArray image, std::vector& keypoints, OutputArray imgDescriptor, - std::vector >* pointIdxsOfClusters=0, Mat* descriptors=0 ); - /** @overload - @param keypointDescriptors Computed descriptors to match with vocabulary. - @param imgDescriptor Computed output image descriptor. - @param pointIdxsOfClusters Indices of keypoints that belong to the cluster. This means that - pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary) - returned if it is non-zero. - */ - void compute( InputArray keypointDescriptors, OutputArray imgDescriptor, - std::vector >* pointIdxsOfClusters=0 ); - // compute() is not constant because DescriptorMatcher::match is not constant - - CV_WRAP_AS(compute) void compute2( const Mat& image, std::vector& keypoints, CV_OUT Mat& imgDescriptor ) - { compute(image,keypoints,imgDescriptor); } - - /** @brief Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0. - */ - CV_WRAP int descriptorSize() const; - - /** @brief Returns an image descriptor type. - */ - CV_WRAP int descriptorType() const; - -protected: - Mat vocabulary; - Ptr dextractor; - Ptr dmatcher; -}; - -//! @} features2d_category - -//! @} features2d - -} /* namespace cv */ - -#endif diff --git a/opencv/include/opencv2/features2d/features2d.hpp b/opencv/include/opencv2/features2d/features2d.hpp deleted file mode 100644 index e81df0a..0000000 --- a/opencv/include/opencv2/features2d/features2d.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/features2d.hpp" diff --git a/opencv/include/opencv2/features2d/hal/interface.h b/opencv/include/opencv2/features2d/hal/interface.h deleted file mode 100644 index bcc6577..0000000 --- a/opencv/include/opencv2/features2d/hal/interface.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef OPENCV_FEATURE2D_HAL_INTERFACE_H -#define OPENCV_FEATURE2D_HAL_INTERFACE_H - -#include "opencv2/core/cvdef.h" -//! @addtogroup featrure2d_hal_interface -//! @{ - -//! @name Fast feature detector types -//! @sa cv::FastFeatureDetector -//! @{ -#define CV_HAL_TYPE_5_8 0 -#define CV_HAL_TYPE_7_12 1 -#define CV_HAL_TYPE_9_16 2 -//! @} - -//! @name Key point -//! @sa cv::KeyPoint -//! @{ -struct CV_EXPORTS cvhalKeyPoint -{ - float x; - float y; - float size; - float angle; - float response; - int octave; - int class_id; -}; -//! @} - -//! @} - -#endif diff --git a/opencv/include/opencv2/flann.hpp b/opencv/include/opencv2/flann.hpp deleted file mode 100644 index fec3d06..0000000 --- a/opencv/include/opencv2/flann.hpp +++ /dev/null @@ -1,594 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_FLANN_HPP -#define OPENCV_FLANN_HPP - -#include "opencv2/core.hpp" -#include "opencv2/flann/miniflann.hpp" -#include "opencv2/flann/flann_base.hpp" - -/** -@defgroup flann Clustering and Search in Multi-Dimensional Spaces - -This section documents OpenCV's interface to the FLANN library. FLANN (Fast Library for Approximate -Nearest Neighbors) is a library that contains a collection of algorithms optimized for fast nearest -neighbor search in large datasets and for high dimensional features. More information about FLANN -can be found in @cite Muja2009 . -*/ - -namespace cvflann -{ - CV_EXPORTS flann_distance_t flann_distance_type(); - CV_DEPRECATED CV_EXPORTS void set_distance_type(flann_distance_t distance_type, int order); -} - - -namespace cv -{ -namespace flann -{ - - -//! @addtogroup flann -//! @{ - -template struct CvType {}; -template <> struct CvType { static int type() { return CV_8U; } }; -template <> struct CvType { static int type() { return CV_8S; } }; -template <> struct CvType { static int type() { return CV_16U; } }; -template <> struct CvType { static int type() { return CV_16S; } }; -template <> struct CvType { static int type() { return CV_32S; } }; -template <> struct CvType { static int type() { return CV_32F; } }; -template <> struct CvType { static int type() { return CV_64F; } }; - - -// bring the flann parameters into this namespace -using ::cvflann::get_param; -using ::cvflann::print_params; - -// bring the flann distances into this namespace -using ::cvflann::L2_Simple; -using ::cvflann::L2; -using ::cvflann::L1; -using ::cvflann::MinkowskiDistance; -using ::cvflann::MaxDistance; -using ::cvflann::HammingLUT; -using ::cvflann::Hamming; -using ::cvflann::Hamming2; -using ::cvflann::HistIntersectionDistance; -using ::cvflann::HellingerDistance; -using ::cvflann::ChiSquareDistance; -using ::cvflann::KL_Divergence; - - -/** @brief The FLANN nearest neighbor index class. This class is templated with the type of elements for which -the index is built. - -`Distance` functor specifies the metric to be used to calculate the distance between two points. -There are several `Distance` functors that are readily available: - -@link cvflann::L2_Simple cv::flann::L2_Simple @endlink- Squared Euclidean distance functor. -This is the simpler, unrolled version. This is preferable for very low dimensionality data (eg 3D points) - -@link cvflann::L2 cv::flann::L2 @endlink- Squared Euclidean distance functor, optimized version. - -@link cvflann::L1 cv::flann::L1 @endlink - Manhattan distance functor, optimized version. - -@link cvflann::MinkowskiDistance cv::flann::MinkowskiDistance @endlink - The Minkowsky distance functor. -This is highly optimised with loop unrolling. -The computation of squared root at the end is omitted for efficiency. - -@link cvflann::MaxDistance cv::flann::MaxDistance @endlink - The max distance functor. It computes the -maximum distance between two vectors. This distance is not a valid kdtree distance, it's not -dimensionwise additive. - -@link cvflann::HammingLUT cv::flann::HammingLUT @endlink - %Hamming distance functor. It counts the bit -differences between two strings using a lookup table implementation. - -@link cvflann::Hamming cv::flann::Hamming @endlink - %Hamming distance functor. Population count is -performed using library calls, if available. Lookup table implementation is used as a fallback. - -@link cvflann::Hamming2 cv::flann::Hamming2 @endlink- %Hamming distance functor. Population count is -implemented in 12 arithmetic operations (one of which is multiplication). - -@link cvflann::HistIntersectionDistance cv::flann::HistIntersectionDistance @endlink - The histogram -intersection distance functor. - -@link cvflann::HellingerDistance cv::flann::HellingerDistance @endlink - The Hellinger distance functor. - -@link cvflann::ChiSquareDistance cv::flann::ChiSquareDistance @endlink - The chi-square distance functor. - -@link cvflann::KL_Divergence cv::flann::KL_Divergence @endlink - The Kullback-Leibler divergence functor. - -Although the provided implementations cover a vast range of cases, it is also possible to use -a custom implementation. The distance functor is a class whose `operator()` computes the distance -between two features. If the distance is also a kd-tree compatible distance, it should also provide an -`accum_dist()` method that computes the distance between individual feature dimensions. - -In addition to `operator()` and `accum_dist()`, a distance functor should also define the -`ElementType` and the `ResultType` as the types of the elements it operates on and the type of the -result it computes. If a distance functor can be used as a kd-tree distance (meaning that the full -distance between a pair of features can be accumulated from the partial distances between the -individual dimensions) a typedef `is_kdtree_distance` should be present inside the distance functor. -If the distance is not a kd-tree distance, but it's a distance in a vector space (the individual -dimensions of the elements it operates on can be accessed independently) a typedef -`is_vector_space_distance` should be defined inside the functor. If neither typedef is defined, the -distance is assumed to be a metric distance and will only be used with indexes operating on -generic metric distances. - */ -template -class GenericIndex -{ -public: - typedef typename Distance::ElementType ElementType; - typedef typename Distance::ResultType DistanceType; - - /** @brief Constructs a nearest neighbor search index for a given dataset. - - @param features Matrix of containing the features(points) to index. The size of the matrix is - num_features x feature_dimensionality and the data type of the elements in the matrix must - coincide with the type of the index. - @param params Structure containing the index parameters. The type of index that will be - constructed depends on the type of this parameter. See the description. - @param distance - - The method constructs a fast search structure from a set of features using the specified algorithm - with specified parameters, as defined by params. params is a reference to one of the following class - IndexParams descendants: - - - **LinearIndexParams** When passing an object of this type, the index will perform a linear, - brute-force search. : - @code - struct LinearIndexParams : public IndexParams - { - }; - @endcode - - **KDTreeIndexParams** When passing an object of this type the index constructed will consist of - a set of randomized kd-trees which will be searched in parallel. : - @code - struct KDTreeIndexParams : public IndexParams - { - KDTreeIndexParams( int trees = 4 ); - }; - @endcode - - **KMeansIndexParams** When passing an object of this type the index constructed will be a - hierarchical k-means tree. : - @code - struct KMeansIndexParams : public IndexParams - { - KMeansIndexParams( - int branching = 32, - int iterations = 11, - flann_centers_init_t centers_init = CENTERS_RANDOM, - float cb_index = 0.2 ); - }; - @endcode - - **CompositeIndexParams** When using a parameters object of this type the index created - combines the randomized kd-trees and the hierarchical k-means tree. : - @code - struct CompositeIndexParams : public IndexParams - { - CompositeIndexParams( - int trees = 4, - int branching = 32, - int iterations = 11, - flann_centers_init_t centers_init = CENTERS_RANDOM, - float cb_index = 0.2 ); - }; - @endcode - - **LshIndexParams** When using a parameters object of this type the index created uses - multi-probe LSH (by Multi-Probe LSH: Efficient Indexing for High-Dimensional Similarity Search - by Qin Lv, William Josephson, Zhe Wang, Moses Charikar, Kai Li., Proceedings of the 33rd - International Conference on Very Large Data Bases (VLDB). Vienna, Austria. September 2007) : - @code - struct LshIndexParams : public IndexParams - { - LshIndexParams( - unsigned int table_number, - unsigned int key_size, - unsigned int multi_probe_level ); - }; - @endcode - - **AutotunedIndexParams** When passing an object of this type the index created is - automatically tuned to offer the best performance, by choosing the optimal index type - (randomized kd-trees, hierarchical kmeans, linear) and parameters for the dataset provided. : - @code - struct AutotunedIndexParams : public IndexParams - { - AutotunedIndexParams( - float target_precision = 0.9, - float build_weight = 0.01, - float memory_weight = 0, - float sample_fraction = 0.1 ); - }; - @endcode - - **SavedIndexParams** This object type is used for loading a previously saved index from the - disk. : - @code - struct SavedIndexParams : public IndexParams - { - SavedIndexParams( String filename ); - }; - @endcode - */ - GenericIndex(const Mat& features, const ::cvflann::IndexParams& params, Distance distance = Distance()); - - ~GenericIndex(); - - /** @brief Performs a K-nearest neighbor search for a given query point using the index. - - @param query The query point - @param indices Vector that will contain the indices of the K-nearest neighbors found. It must have - at least knn size. - @param dists Vector that will contain the distances to the K-nearest neighbors found. It must have - at least knn size. - @param knn Number of nearest neighbors to search for. - @param params SearchParams - */ - void knnSearch(const std::vector& query, std::vector& indices, - std::vector& dists, int knn, const ::cvflann::SearchParams& params); - void knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& params); - - /** @brief Performs a radius nearest neighbor search for a given query point using the index. - - @param query The query point. - @param indices Vector that will contain the indices of the nearest neighbors found. - @param dists Vector that will contain the distances to the nearest neighbors found. It has the same - number of elements as indices. - @param radius The search radius. - @param params SearchParams - - This function returns the number of nearest neighbors found. - */ - int radiusSearch(const std::vector& query, std::vector& indices, - std::vector& dists, DistanceType radius, const ::cvflann::SearchParams& params); - int radiusSearch(const Mat& query, Mat& indices, Mat& dists, - DistanceType radius, const ::cvflann::SearchParams& params); - - void save(String filename) { nnIndex->save(filename); } - - int veclen() const { return nnIndex->veclen(); } - - int size() const { return nnIndex->size(); } - - ::cvflann::IndexParams getParameters() { return nnIndex->getParameters(); } - - CV_DEPRECATED const ::cvflann::IndexParams* getIndexParameters() { return nnIndex->getIndexParameters(); } - -private: - ::cvflann::Index* nnIndex; -}; - -//! @cond IGNORED - -#define FLANN_DISTANCE_CHECK \ - if ( ::cvflann::flann_distance_type() != cvflann::FLANN_DIST_L2) { \ - printf("[WARNING] You are using cv::flann::Index (or cv::flann::GenericIndex) and have also changed "\ - "the distance using cvflann::set_distance_type. This is no longer working as expected "\ - "(cv::flann::Index always uses L2). You should create the index templated on the distance, "\ - "for example for L1 distance use: GenericIndex< L1 > \n"); \ - } - - -template -GenericIndex::GenericIndex(const Mat& dataset, const ::cvflann::IndexParams& params, Distance distance) -{ - CV_Assert(dataset.type() == CvType::type()); - CV_Assert(dataset.isContinuous()); - ::cvflann::Matrix m_dataset((ElementType*)dataset.ptr(0), dataset.rows, dataset.cols); - - nnIndex = new ::cvflann::Index(m_dataset, params, distance); - - FLANN_DISTANCE_CHECK - - nnIndex->buildIndex(); -} - -template -GenericIndex::~GenericIndex() -{ - delete nnIndex; -} - -template -void GenericIndex::knnSearch(const std::vector& query, std::vector& indices, std::vector& dists, int knn, const ::cvflann::SearchParams& searchParams) -{ - ::cvflann::Matrix m_query((ElementType*)&query[0], 1, query.size()); - ::cvflann::Matrix m_indices(&indices[0], 1, indices.size()); - ::cvflann::Matrix m_dists(&dists[0], 1, dists.size()); - - FLANN_DISTANCE_CHECK - - nnIndex->knnSearch(m_query,m_indices,m_dists,knn,searchParams); -} - - -template -void GenericIndex::knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& searchParams) -{ - CV_Assert(queries.type() == CvType::type()); - CV_Assert(queries.isContinuous()); - ::cvflann::Matrix m_queries((ElementType*)queries.ptr(0), queries.rows, queries.cols); - - CV_Assert(indices.type() == CV_32S); - CV_Assert(indices.isContinuous()); - ::cvflann::Matrix m_indices((int*)indices.ptr(0), indices.rows, indices.cols); - - CV_Assert(dists.type() == CvType::type()); - CV_Assert(dists.isContinuous()); - ::cvflann::Matrix m_dists((DistanceType*)dists.ptr(0), dists.rows, dists.cols); - - FLANN_DISTANCE_CHECK - - nnIndex->knnSearch(m_queries,m_indices,m_dists,knn, searchParams); -} - -template -int GenericIndex::radiusSearch(const std::vector& query, std::vector& indices, std::vector& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams) -{ - ::cvflann::Matrix m_query((ElementType*)&query[0], 1, query.size()); - ::cvflann::Matrix m_indices(&indices[0], 1, indices.size()); - ::cvflann::Matrix m_dists(&dists[0], 1, dists.size()); - - FLANN_DISTANCE_CHECK - - return nnIndex->radiusSearch(m_query,m_indices,m_dists,radius,searchParams); -} - -template -int GenericIndex::radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams) -{ - CV_Assert(query.type() == CvType::type()); - CV_Assert(query.isContinuous()); - ::cvflann::Matrix m_query((ElementType*)query.ptr(0), query.rows, query.cols); - - CV_Assert(indices.type() == CV_32S); - CV_Assert(indices.isContinuous()); - ::cvflann::Matrix m_indices((int*)indices.ptr(0), indices.rows, indices.cols); - - CV_Assert(dists.type() == CvType::type()); - CV_Assert(dists.isContinuous()); - ::cvflann::Matrix m_dists((DistanceType*)dists.ptr(0), dists.rows, dists.cols); - - FLANN_DISTANCE_CHECK - - return nnIndex->radiusSearch(m_query,m_indices,m_dists,radius,searchParams); -} - -//! @endcond - -/** - * @deprecated Use GenericIndex class instead - */ -template -class Index_ -{ -public: - typedef typename L2::ElementType ElementType; - typedef typename L2::ResultType DistanceType; - - CV_DEPRECATED Index_(const Mat& dataset, const ::cvflann::IndexParams& params) - { - printf("[WARNING] The cv::flann::Index_ class is deperecated, use cv::flann::GenericIndex instead\n"); - - CV_Assert(dataset.type() == CvType::type()); - CV_Assert(dataset.isContinuous()); - ::cvflann::Matrix m_dataset((ElementType*)dataset.ptr(0), dataset.rows, dataset.cols); - - if ( ::cvflann::flann_distance_type() == cvflann::FLANN_DIST_L2 ) { - nnIndex_L1 = NULL; - nnIndex_L2 = new ::cvflann::Index< L2 >(m_dataset, params); - } - else if ( ::cvflann::flann_distance_type() == cvflann::FLANN_DIST_L1 ) { - nnIndex_L1 = new ::cvflann::Index< L1 >(m_dataset, params); - nnIndex_L2 = NULL; - } - else { - printf("[ERROR] cv::flann::Index_ only provides backwards compatibility for the L1 and L2 distances. " - "For other distance types you must use cv::flann::GenericIndex\n"); - CV_Assert(0); - } - if (nnIndex_L1) nnIndex_L1->buildIndex(); - if (nnIndex_L2) nnIndex_L2->buildIndex(); - } - CV_DEPRECATED ~Index_() - { - if (nnIndex_L1) delete nnIndex_L1; - if (nnIndex_L2) delete nnIndex_L2; - } - - CV_DEPRECATED void knnSearch(const std::vector& query, std::vector& indices, std::vector& dists, int knn, const ::cvflann::SearchParams& searchParams) - { - ::cvflann::Matrix m_query((ElementType*)&query[0], 1, query.size()); - ::cvflann::Matrix m_indices(&indices[0], 1, indices.size()); - ::cvflann::Matrix m_dists(&dists[0], 1, dists.size()); - - if (nnIndex_L1) nnIndex_L1->knnSearch(m_query,m_indices,m_dists,knn,searchParams); - if (nnIndex_L2) nnIndex_L2->knnSearch(m_query,m_indices,m_dists,knn,searchParams); - } - CV_DEPRECATED void knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& searchParams) - { - CV_Assert(queries.type() == CvType::type()); - CV_Assert(queries.isContinuous()); - ::cvflann::Matrix m_queries((ElementType*)queries.ptr(0), queries.rows, queries.cols); - - CV_Assert(indices.type() == CV_32S); - CV_Assert(indices.isContinuous()); - ::cvflann::Matrix m_indices((int*)indices.ptr(0), indices.rows, indices.cols); - - CV_Assert(dists.type() == CvType::type()); - CV_Assert(dists.isContinuous()); - ::cvflann::Matrix m_dists((DistanceType*)dists.ptr(0), dists.rows, dists.cols); - - if (nnIndex_L1) nnIndex_L1->knnSearch(m_queries,m_indices,m_dists,knn, searchParams); - if (nnIndex_L2) nnIndex_L2->knnSearch(m_queries,m_indices,m_dists,knn, searchParams); - } - - CV_DEPRECATED int radiusSearch(const std::vector& query, std::vector& indices, std::vector& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams) - { - ::cvflann::Matrix m_query((ElementType*)&query[0], 1, query.size()); - ::cvflann::Matrix m_indices(&indices[0], 1, indices.size()); - ::cvflann::Matrix m_dists(&dists[0], 1, dists.size()); - - if (nnIndex_L1) return nnIndex_L1->radiusSearch(m_query,m_indices,m_dists,radius,searchParams); - if (nnIndex_L2) return nnIndex_L2->radiusSearch(m_query,m_indices,m_dists,radius,searchParams); - } - - CV_DEPRECATED int radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams) - { - CV_Assert(query.type() == CvType::type()); - CV_Assert(query.isContinuous()); - ::cvflann::Matrix m_query((ElementType*)query.ptr(0), query.rows, query.cols); - - CV_Assert(indices.type() == CV_32S); - CV_Assert(indices.isContinuous()); - ::cvflann::Matrix m_indices((int*)indices.ptr(0), indices.rows, indices.cols); - - CV_Assert(dists.type() == CvType::type()); - CV_Assert(dists.isContinuous()); - ::cvflann::Matrix m_dists((DistanceType*)dists.ptr(0), dists.rows, dists.cols); - - if (nnIndex_L1) return nnIndex_L1->radiusSearch(m_query,m_indices,m_dists,radius,searchParams); - if (nnIndex_L2) return nnIndex_L2->radiusSearch(m_query,m_indices,m_dists,radius,searchParams); - } - - CV_DEPRECATED void save(String filename) - { - if (nnIndex_L1) nnIndex_L1->save(filename); - if (nnIndex_L2) nnIndex_L2->save(filename); - } - - CV_DEPRECATED int veclen() const - { - if (nnIndex_L1) return nnIndex_L1->veclen(); - if (nnIndex_L2) return nnIndex_L2->veclen(); - } - - CV_DEPRECATED int size() const - { - if (nnIndex_L1) return nnIndex_L1->size(); - if (nnIndex_L2) return nnIndex_L2->size(); - } - - CV_DEPRECATED ::cvflann::IndexParams getParameters() - { - if (nnIndex_L1) return nnIndex_L1->getParameters(); - if (nnIndex_L2) return nnIndex_L2->getParameters(); - - } - - CV_DEPRECATED const ::cvflann::IndexParams* getIndexParameters() - { - if (nnIndex_L1) return nnIndex_L1->getIndexParameters(); - if (nnIndex_L2) return nnIndex_L2->getIndexParameters(); - } - -private: - // providing backwards compatibility for L2 and L1 distances (most common) - ::cvflann::Index< L2 >* nnIndex_L2; - ::cvflann::Index< L1 >* nnIndex_L1; -}; - - -/** @brief Clusters features using hierarchical k-means algorithm. - -@param features The points to be clustered. The matrix must have elements of type -Distance::ElementType. -@param centers The centers of the clusters obtained. The matrix must have type -Distance::ResultType. The number of rows in this matrix represents the number of clusters desired, -however, because of the way the cut in the hierarchical tree is chosen, the number of clusters -computed will be the highest number of the form (branching-1)\*k+1 that's lower than the number of -clusters desired, where branching is the tree's branching factor (see description of the -KMeansIndexParams). -@param params Parameters used in the construction of the hierarchical k-means tree. -@param d Distance to be used for clustering. - -The method clusters the given feature vectors by constructing a hierarchical k-means tree and -choosing a cut in the tree that minimizes the cluster's variance. It returns the number of clusters -found. - */ -template -int hierarchicalClustering(const Mat& features, Mat& centers, const ::cvflann::KMeansIndexParams& params, - Distance d = Distance()) -{ - typedef typename Distance::ElementType ElementType; - typedef typename Distance::ResultType DistanceType; - - CV_Assert(features.type() == CvType::type()); - CV_Assert(features.isContinuous()); - ::cvflann::Matrix m_features((ElementType*)features.ptr(0), features.rows, features.cols); - - CV_Assert(centers.type() == CvType::type()); - CV_Assert(centers.isContinuous()); - ::cvflann::Matrix m_centers((DistanceType*)centers.ptr(0), centers.rows, centers.cols); - - return ::cvflann::hierarchicalClustering(m_features, m_centers, params, d); -} - -/** @deprecated -*/ -template -CV_DEPRECATED int hierarchicalClustering(const Mat& features, Mat& centers, const ::cvflann::KMeansIndexParams& params) -{ - printf("[WARNING] cv::flann::hierarchicalClustering is deprecated, use " - "cv::flann::hierarchicalClustering instead\n"); - - if ( ::cvflann::flann_distance_type() == cvflann::FLANN_DIST_L2 ) { - return hierarchicalClustering< L2 >(features, centers, params); - } - else if ( ::cvflann::flann_distance_type() == cvflann::FLANN_DIST_L1 ) { - return hierarchicalClustering< L1 >(features, centers, params); - } - else { - printf("[ERROR] cv::flann::hierarchicalClustering only provides backwards " - "compatibility for the L1 and L2 distances. " - "For other distance types you must use cv::flann::hierarchicalClustering\n"); - CV_Assert(0); - } -} - -//! @} flann - -} } // namespace cv::flann - -#endif diff --git a/opencv/include/opencv2/flann/all_indices.h b/opencv/include/opencv2/flann/all_indices.h deleted file mode 100644 index ff53fd8..0000000 --- a/opencv/include/opencv2/flann/all_indices.h +++ /dev/null @@ -1,155 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - - -#ifndef OPENCV_FLANN_ALL_INDICES_H_ -#define OPENCV_FLANN_ALL_INDICES_H_ - -#include "general.h" - -#include "nn_index.h" -#include "kdtree_index.h" -#include "kdtree_single_index.h" -#include "kmeans_index.h" -#include "composite_index.h" -#include "linear_index.h" -#include "hierarchical_clustering_index.h" -#include "lsh_index.h" -#include "autotuned_index.h" - - -namespace cvflann -{ - -template -struct index_creator -{ - static NNIndex* create(const Matrix& dataset, const IndexParams& params, const Distance& distance) - { - flann_algorithm_t index_type = get_param(params, "algorithm"); - - NNIndex* nnIndex; - switch (index_type) { - case FLANN_INDEX_LINEAR: - nnIndex = new LinearIndex(dataset, params, distance); - break; - case FLANN_INDEX_KDTREE_SINGLE: - nnIndex = new KDTreeSingleIndex(dataset, params, distance); - break; - case FLANN_INDEX_KDTREE: - nnIndex = new KDTreeIndex(dataset, params, distance); - break; - case FLANN_INDEX_KMEANS: - nnIndex = new KMeansIndex(dataset, params, distance); - break; - case FLANN_INDEX_COMPOSITE: - nnIndex = new CompositeIndex(dataset, params, distance); - break; - case FLANN_INDEX_AUTOTUNED: - nnIndex = new AutotunedIndex(dataset, params, distance); - break; - case FLANN_INDEX_HIERARCHICAL: - nnIndex = new HierarchicalClusteringIndex(dataset, params, distance); - break; - case FLANN_INDEX_LSH: - nnIndex = new LshIndex(dataset, params, distance); - break; - default: - throw FLANNException("Unknown index type"); - } - - return nnIndex; - } -}; - -template -struct index_creator -{ - static NNIndex* create(const Matrix& dataset, const IndexParams& params, const Distance& distance) - { - flann_algorithm_t index_type = get_param(params, "algorithm"); - - NNIndex* nnIndex; - switch (index_type) { - case FLANN_INDEX_LINEAR: - nnIndex = new LinearIndex(dataset, params, distance); - break; - case FLANN_INDEX_KMEANS: - nnIndex = new KMeansIndex(dataset, params, distance); - break; - case FLANN_INDEX_HIERARCHICAL: - nnIndex = new HierarchicalClusteringIndex(dataset, params, distance); - break; - case FLANN_INDEX_LSH: - nnIndex = new LshIndex(dataset, params, distance); - break; - default: - throw FLANNException("Unknown index type"); - } - - return nnIndex; - } -}; - -template -struct index_creator -{ - static NNIndex* create(const Matrix& dataset, const IndexParams& params, const Distance& distance) - { - flann_algorithm_t index_type = get_param(params, "algorithm"); - - NNIndex* nnIndex; - switch (index_type) { - case FLANN_INDEX_LINEAR: - nnIndex = new LinearIndex(dataset, params, distance); - break; - case FLANN_INDEX_HIERARCHICAL: - nnIndex = new HierarchicalClusteringIndex(dataset, params, distance); - break; - case FLANN_INDEX_LSH: - nnIndex = new LshIndex(dataset, params, distance); - break; - default: - throw FLANNException("Unknown index type"); - } - - return nnIndex; - } -}; - -template -NNIndex* create_index_by_type(const Matrix& dataset, const IndexParams& params, const Distance& distance) -{ - return index_creator::create(dataset, params,distance); -} - -} - -#endif /* OPENCV_FLANN_ALL_INDICES_H_ */ diff --git a/opencv/include/opencv2/flann/allocator.h b/opencv/include/opencv2/flann/allocator.h deleted file mode 100644 index f347f88..0000000 --- a/opencv/include/opencv2/flann/allocator.h +++ /dev/null @@ -1,192 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_ALLOCATOR_H_ -#define OPENCV_FLANN_ALLOCATOR_H_ - -#include -#include - - -namespace cvflann -{ - -/** - * Allocates (using C's malloc) a generic type T. - * - * Params: - * count = number of instances to allocate. - * Returns: pointer (of type T*) to memory buffer - */ -template -T* allocate(size_t count = 1) -{ - T* mem = (T*) ::malloc(sizeof(T)*count); - return mem; -} - - -/** - * Pooled storage allocator - * - * The following routines allow for the efficient allocation of storage in - * small chunks from a specified pool. Rather than allowing each structure - * to be freed individually, an entire pool of storage is freed at once. - * This method has two advantages over just using malloc() and free(). First, - * it is far more efficient for allocating small objects, as there is - * no overhead for remembering all the information needed to free each - * object or consolidating fragmented memory. Second, the decision about - * how long to keep an object is made at the time of allocation, and there - * is no need to track down all the objects to free them. - * - */ - -const size_t WORDSIZE=16; -const size_t BLOCKSIZE=8192; - -class PooledAllocator -{ - /* We maintain memory alignment to word boundaries by requiring that all - allocations be in multiples of the machine wordsize. */ - /* Size of machine word in bytes. Must be power of 2. */ - /* Minimum number of bytes requested at a time from the system. Must be multiple of WORDSIZE. */ - - - int remaining; /* Number of bytes left in current block of storage. */ - void* base; /* Pointer to base of current block of storage. */ - void* loc; /* Current location in block to next allocate memory. */ - int blocksize; - - -public: - int usedMemory; - int wastedMemory; - - /** - Default constructor. Initializes a new pool. - */ - PooledAllocator(int blockSize = BLOCKSIZE) - { - blocksize = blockSize; - remaining = 0; - base = NULL; - loc = NULL; - - usedMemory = 0; - wastedMemory = 0; - } - - /** - * Destructor. Frees all the memory allocated in this pool. - */ - ~PooledAllocator() - { - void* prev; - - while (base != NULL) { - prev = *((void**) base); /* Get pointer to prev block. */ - ::free(base); - base = prev; - } - } - - /** - * Returns a pointer to a piece of new memory of the given size in bytes - * allocated from the pool. - */ - void* allocateMemory(int size) - { - int blockSize; - - /* Round size up to a multiple of wordsize. The following expression - only works for WORDSIZE that is a power of 2, by masking last bits of - incremented size to zero. - */ - size = (size + (WORDSIZE - 1)) & ~(WORDSIZE - 1); - - /* Check whether a new block must be allocated. Note that the first word - of a block is reserved for a pointer to the previous block. - */ - if (size > remaining) { - - wastedMemory += remaining; - - /* Allocate new storage. */ - blockSize = (size + sizeof(void*) + (WORDSIZE-1) > BLOCKSIZE) ? - size + sizeof(void*) + (WORDSIZE-1) : BLOCKSIZE; - - // use the standard C malloc to allocate memory - void* m = ::malloc(blockSize); - if (!m) { - fprintf(stderr,"Failed to allocate memory.\n"); - return NULL; - } - - /* Fill first word of new block with pointer to previous block. */ - ((void**) m)[0] = base; - base = m; - - int shift = 0; - //int shift = (WORDSIZE - ( (((size_t)m) + sizeof(void*)) & (WORDSIZE-1))) & (WORDSIZE-1); - - remaining = blockSize - sizeof(void*) - shift; - loc = ((char*)m + sizeof(void*) + shift); - } - void* rloc = loc; - loc = (char*)loc + size; - remaining -= size; - - usedMemory += size; - - return rloc; - } - - /** - * Allocates (using this pool) a generic type T. - * - * Params: - * count = number of instances to allocate. - * Returns: pointer (of type T*) to memory buffer - */ - template - T* allocate(size_t count = 1) - { - T* mem = (T*) this->allocateMemory((int)(sizeof(T)*count)); - return mem; - } - -private: - PooledAllocator(const PooledAllocator &); // copy disabled - PooledAllocator& operator=(const PooledAllocator &); // assign disabled -}; - -} - -#endif //OPENCV_FLANN_ALLOCATOR_H_ diff --git a/opencv/include/opencv2/flann/any.h b/opencv/include/opencv2/flann/any.h deleted file mode 100644 index 5b57aa3..0000000 --- a/opencv/include/opencv2/flann/any.h +++ /dev/null @@ -1,330 +0,0 @@ -#ifndef OPENCV_FLANN_ANY_H_ -#define OPENCV_FLANN_ANY_H_ -/* - * (C) Copyright Christopher Diggins 2005-2011 - * (C) Copyright Pablo Aguilar 2005 - * (C) Copyright Kevlin Henney 2001 - * - * Distributed under the Boost Software License, Version 1.0. (See - * accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt - * - * Adapted for FLANN by Marius Muja - */ - -#include "defines.h" -#include -#include -#include - -namespace cvflann -{ - -namespace anyimpl -{ - -struct bad_any_cast -{ -}; - -struct empty_any -{ -}; - -inline std::ostream& operator <<(std::ostream& out, const empty_any&) -{ - out << "[empty_any]"; - return out; -} - -struct base_any_policy -{ - virtual void static_delete(void** x) = 0; - virtual void copy_from_value(void const* src, void** dest) = 0; - virtual void clone(void* const* src, void** dest) = 0; - virtual void move(void* const* src, void** dest) = 0; - virtual void* get_value(void** src) = 0; - virtual const void* get_value(void* const * src) = 0; - virtual ::size_t get_size() = 0; - virtual const std::type_info& type() = 0; - virtual void print(std::ostream& out, void* const* src) = 0; - virtual ~base_any_policy() {} -}; - -template -struct typed_base_any_policy : base_any_policy -{ - virtual ::size_t get_size() CV_OVERRIDE { return sizeof(T); } - virtual const std::type_info& type() CV_OVERRIDE { return typeid(T); } - -}; - -template -struct small_any_policy CV_FINAL : typed_base_any_policy -{ - virtual void static_delete(void**) CV_OVERRIDE { } - virtual void copy_from_value(void const* src, void** dest) CV_OVERRIDE - { - new (dest) T(* reinterpret_cast(src)); - } - virtual void clone(void* const* src, void** dest) CV_OVERRIDE { *dest = *src; } - virtual void move(void* const* src, void** dest) CV_OVERRIDE { *dest = *src; } - virtual void* get_value(void** src) CV_OVERRIDE { return reinterpret_cast(src); } - virtual const void* get_value(void* const * src) CV_OVERRIDE { return reinterpret_cast(src); } - virtual void print(std::ostream& out, void* const* src) CV_OVERRIDE { out << *reinterpret_cast(src); } -}; - -template -struct big_any_policy CV_FINAL : typed_base_any_policy -{ - virtual void static_delete(void** x) CV_OVERRIDE - { - if (* x) delete (* reinterpret_cast(x)); - *x = NULL; - } - virtual void copy_from_value(void const* src, void** dest) CV_OVERRIDE - { - *dest = new T(*reinterpret_cast(src)); - } - virtual void clone(void* const* src, void** dest) CV_OVERRIDE - { - *dest = new T(**reinterpret_cast(src)); - } - virtual void move(void* const* src, void** dest) CV_OVERRIDE - { - (*reinterpret_cast(dest))->~T(); - **reinterpret_cast(dest) = **reinterpret_cast(src); - } - virtual void* get_value(void** src) CV_OVERRIDE { return *src; } - virtual const void* get_value(void* const * src) CV_OVERRIDE { return *src; } - virtual void print(std::ostream& out, void* const* src) CV_OVERRIDE { out << *reinterpret_cast(*src); } -}; - -template<> inline void big_any_policy::print(std::ostream& out, void* const* src) -{ - out << int(*reinterpret_cast(*src)); -} - -template<> inline void big_any_policy::print(std::ostream& out, void* const* src) -{ - out << int(*reinterpret_cast(*src)); -} - -template<> inline void big_any_policy::print(std::ostream& out, void* const* src) -{ - out << (*reinterpret_cast(*src)).c_str(); -} - -template -struct choose_policy -{ - typedef big_any_policy type; -}; - -template -struct choose_policy -{ - typedef small_any_policy type; -}; - -struct any; - -/// Choosing the policy for an any type is illegal, but should never happen. -/// This is designed to throw a compiler error. -template<> -struct choose_policy -{ - typedef void type; -}; - -/// Specializations for small types. -#define SMALL_POLICY(TYPE) \ - template<> \ - struct choose_policy { typedef small_any_policy type; \ - } - -SMALL_POLICY(signed char); -SMALL_POLICY(unsigned char); -SMALL_POLICY(signed short); -SMALL_POLICY(unsigned short); -SMALL_POLICY(signed int); -SMALL_POLICY(unsigned int); -SMALL_POLICY(signed long); -SMALL_POLICY(unsigned long); -SMALL_POLICY(float); -SMALL_POLICY(bool); - -#undef SMALL_POLICY - -template -class SinglePolicy -{ - SinglePolicy(); - SinglePolicy(const SinglePolicy& other); - SinglePolicy& operator=(const SinglePolicy& other); - -public: - static base_any_policy* get_policy(); - -private: - static typename choose_policy::type policy; -}; - -template -typename choose_policy::type SinglePolicy::policy; - -/// This function will return a different policy for each type. -template -inline base_any_policy* SinglePolicy::get_policy() { return &policy; } - -} // namespace anyimpl - -struct any -{ -private: - // fields - anyimpl::base_any_policy* policy; - void* object; - -public: - /// Initializing constructor. - template - any(const T& x) - : policy(anyimpl::SinglePolicy::get_policy()), object(NULL) - { - assign(x); - } - - /// Empty constructor. - any() - : policy(anyimpl::SinglePolicy::get_policy()), object(NULL) - { } - - /// Special initializing constructor for string literals. - any(const char* x) - : policy(anyimpl::SinglePolicy::get_policy()), object(NULL) - { - assign(x); - } - - /// Copy constructor. - any(const any& x) - : policy(anyimpl::SinglePolicy::get_policy()), object(NULL) - { - assign(x); - } - - /// Destructor. - ~any() - { - policy->static_delete(&object); - } - - /// Assignment function from another any. - any& assign(const any& x) - { - reset(); - policy = x.policy; - policy->clone(&x.object, &object); - return *this; - } - - /// Assignment function. - template - any& assign(const T& x) - { - reset(); - policy = anyimpl::SinglePolicy::get_policy(); - policy->copy_from_value(&x, &object); - return *this; - } - - /// Assignment operator. - template - any& operator=(const T& x) - { - return assign(x); - } - - /// Assignment operator. Template-based version above doesn't work as expected. We need regular assignment operator here. - any& operator=(const any& x) - { - return assign(x); - } - - /// Assignment operator, specialed for literal strings. - /// They have types like const char [6] which don't work as expected. - any& operator=(const char* x) - { - return assign(x); - } - - /// Utility functions - any& swap(any& x) - { - std::swap(policy, x.policy); - std::swap(object, x.object); - return *this; - } - - /// Cast operator. You can only cast to the original type. - template - T& cast() - { - if (policy->type() != typeid(T)) throw anyimpl::bad_any_cast(); - T* r = reinterpret_cast(policy->get_value(&object)); - return *r; - } - - /// Cast operator. You can only cast to the original type. - template - const T& cast() const - { - if (policy->type() != typeid(T)) throw anyimpl::bad_any_cast(); - const T* r = reinterpret_cast(policy->get_value(&object)); - return *r; - } - - /// Returns true if the any contains no value. - bool empty() const - { - return policy->type() == typeid(anyimpl::empty_any); - } - - /// Frees any allocated memory, and sets the value to NULL. - void reset() - { - policy->static_delete(&object); - policy = anyimpl::SinglePolicy::get_policy(); - } - - /// Returns true if the two types are the same. - bool compatible(const any& x) const - { - return policy->type() == x.policy->type(); - } - - /// Returns if the type is compatible with the policy - template - bool has_type() - { - return policy->type() == typeid(T); - } - - const std::type_info& type() const - { - return policy->type(); - } - - friend std::ostream& operator <<(std::ostream& out, const any& any_val); -}; - -inline std::ostream& operator <<(std::ostream& out, const any& any_val) -{ - any_val.policy->print(out,&any_val.object); - return out; -} - -} - -#endif // OPENCV_FLANN_ANY_H_ diff --git a/opencv/include/opencv2/flann/autotuned_index.h b/opencv/include/opencv2/flann/autotuned_index.h deleted file mode 100644 index 2fbc6c9..0000000 --- a/opencv/include/opencv2/flann/autotuned_index.h +++ /dev/null @@ -1,591 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ -#ifndef OPENCV_FLANN_AUTOTUNED_INDEX_H_ -#define OPENCV_FLANN_AUTOTUNED_INDEX_H_ - -#include - -#include "general.h" -#include "nn_index.h" -#include "ground_truth.h" -#include "index_testing.h" -#include "sampling.h" -#include "kdtree_index.h" -#include "kdtree_single_index.h" -#include "kmeans_index.h" -#include "composite_index.h" -#include "linear_index.h" -#include "logger.h" - -namespace cvflann -{ - -template -NNIndex* create_index_by_type(const Matrix& dataset, const IndexParams& params, const Distance& distance); - - -struct AutotunedIndexParams : public IndexParams -{ - AutotunedIndexParams(float target_precision = 0.8, float build_weight = 0.01, float memory_weight = 0, float sample_fraction = 0.1) - { - (*this)["algorithm"] = FLANN_INDEX_AUTOTUNED; - // precision desired (used for autotuning, -1 otherwise) - (*this)["target_precision"] = target_precision; - // build tree time weighting factor - (*this)["build_weight"] = build_weight; - // index memory weighting factor - (*this)["memory_weight"] = memory_weight; - // what fraction of the dataset to use for autotuning - (*this)["sample_fraction"] = sample_fraction; - } -}; - - -template -class AutotunedIndex : public NNIndex -{ -public: - typedef typename Distance::ElementType ElementType; - typedef typename Distance::ResultType DistanceType; - - AutotunedIndex(const Matrix& inputData, const IndexParams& params = AutotunedIndexParams(), Distance d = Distance()) : - dataset_(inputData), distance_(d) - { - target_precision_ = get_param(params, "target_precision",0.8f); - build_weight_ = get_param(params,"build_weight", 0.01f); - memory_weight_ = get_param(params, "memory_weight", 0.0f); - sample_fraction_ = get_param(params,"sample_fraction", 0.1f); - bestIndex_ = NULL; - speedup_ = 0; - } - - AutotunedIndex(const AutotunedIndex&); - AutotunedIndex& operator=(const AutotunedIndex&); - - virtual ~AutotunedIndex() - { - if (bestIndex_ != NULL) { - delete bestIndex_; - bestIndex_ = NULL; - } - } - - /** - * Method responsible with building the index. - */ - virtual void buildIndex() CV_OVERRIDE - { - std::ostringstream stream; - bestParams_ = estimateBuildParams(); - print_params(bestParams_, stream); - Logger::info("----------------------------------------------------\n"); - Logger::info("Autotuned parameters:\n"); - Logger::info("%s", stream.str().c_str()); - Logger::info("----------------------------------------------------\n"); - - bestIndex_ = create_index_by_type(dataset_, bestParams_, distance_); - bestIndex_->buildIndex(); - speedup_ = estimateSearchParams(bestSearchParams_); - stream.str(std::string()); - print_params(bestSearchParams_, stream); - Logger::info("----------------------------------------------------\n"); - Logger::info("Search parameters:\n"); - Logger::info("%s", stream.str().c_str()); - Logger::info("----------------------------------------------------\n"); - } - - /** - * Saves the index to a stream - */ - virtual void saveIndex(FILE* stream) CV_OVERRIDE - { - save_value(stream, (int)bestIndex_->getType()); - bestIndex_->saveIndex(stream); - save_value(stream, get_param(bestSearchParams_, "checks")); - } - - /** - * Loads the index from a stream - */ - virtual void loadIndex(FILE* stream) CV_OVERRIDE - { - int index_type; - - load_value(stream, index_type); - IndexParams params; - params["algorithm"] = (flann_algorithm_t)index_type; - bestIndex_ = create_index_by_type(dataset_, params, distance_); - bestIndex_->loadIndex(stream); - int checks; - load_value(stream, checks); - bestSearchParams_["checks"] = checks; - } - - /** - * Method that searches for nearest-neighbors - */ - virtual void findNeighbors(ResultSet& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE - { - int checks = get_param(searchParams,"checks",FLANN_CHECKS_AUTOTUNED); - if (checks == FLANN_CHECKS_AUTOTUNED) { - bestIndex_->findNeighbors(result, vec, bestSearchParams_); - } - else { - bestIndex_->findNeighbors(result, vec, searchParams); - } - } - - - IndexParams getParameters() const CV_OVERRIDE - { - return bestIndex_->getParameters(); - } - - SearchParams getSearchParameters() const - { - return bestSearchParams_; - } - - float getSpeedup() const - { - return speedup_; - } - - - /** - * Number of features in this index. - */ - virtual size_t size() const CV_OVERRIDE - { - return bestIndex_->size(); - } - - /** - * The length of each vector in this index. - */ - virtual size_t veclen() const CV_OVERRIDE - { - return bestIndex_->veclen(); - } - - /** - * The amount of memory (in bytes) this index uses. - */ - virtual int usedMemory() const CV_OVERRIDE - { - return bestIndex_->usedMemory(); - } - - /** - * Algorithm name - */ - virtual flann_algorithm_t getType() const CV_OVERRIDE - { - return FLANN_INDEX_AUTOTUNED; - } - -private: - - struct CostData - { - float searchTimeCost; - float buildTimeCost; - float memoryCost; - float totalCost; - IndexParams params; - }; - - void evaluate_kmeans(CostData& cost) - { - StartStopTimer t; - int checks; - const int nn = 1; - - Logger::info("KMeansTree using params: max_iterations=%d, branching=%d\n", - get_param(cost.params,"iterations"), - get_param(cost.params,"branching")); - KMeansIndex kmeans(sampledDataset_, cost.params, distance_); - // measure index build time - t.start(); - kmeans.buildIndex(); - t.stop(); - float buildTime = (float)t.value; - - // measure search time - float searchTime = test_index_precision(kmeans, sampledDataset_, testDataset_, gt_matches_, target_precision_, checks, distance_, nn); - - float datasetMemory = float(sampledDataset_.rows * sampledDataset_.cols * sizeof(float)); - cost.memoryCost = (kmeans.usedMemory() + datasetMemory) / datasetMemory; - cost.searchTimeCost = searchTime; - cost.buildTimeCost = buildTime; - Logger::info("KMeansTree buildTime=%g, searchTime=%g, build_weight=%g\n", buildTime, searchTime, build_weight_); - } - - - void evaluate_kdtree(CostData& cost) - { - StartStopTimer t; - int checks; - const int nn = 1; - - Logger::info("KDTree using params: trees=%d\n", get_param(cost.params,"trees")); - KDTreeIndex kdtree(sampledDataset_, cost.params, distance_); - - t.start(); - kdtree.buildIndex(); - t.stop(); - float buildTime = (float)t.value; - - //measure search time - float searchTime = test_index_precision(kdtree, sampledDataset_, testDataset_, gt_matches_, target_precision_, checks, distance_, nn); - - float datasetMemory = float(sampledDataset_.rows * sampledDataset_.cols * sizeof(float)); - cost.memoryCost = (kdtree.usedMemory() + datasetMemory) / datasetMemory; - cost.searchTimeCost = searchTime; - cost.buildTimeCost = buildTime; - Logger::info("KDTree buildTime=%g, searchTime=%g\n", buildTime, searchTime); - } - - - // struct KMeansSimpleDownhillFunctor { - // - // Autotune& autotuner; - // KMeansSimpleDownhillFunctor(Autotune& autotuner_) : autotuner(autotuner_) {} - // - // float operator()(int* params) { - // - // float maxFloat = numeric_limits::max(); - // - // if (params[0]<2) return maxFloat; - // if (params[1]<0) return maxFloat; - // - // CostData c; - // c.params["algorithm"] = KMEANS; - // c.params["centers-init"] = CENTERS_RANDOM; - // c.params["branching"] = params[0]; - // c.params["max-iterations"] = params[1]; - // - // autotuner.evaluate_kmeans(c); - // - // return c.timeCost; - // - // } - // }; - // - // struct KDTreeSimpleDownhillFunctor { - // - // Autotune& autotuner; - // KDTreeSimpleDownhillFunctor(Autotune& autotuner_) : autotuner(autotuner_) {} - // - // float operator()(int* params) { - // float maxFloat = numeric_limits::max(); - // - // if (params[0]<1) return maxFloat; - // - // CostData c; - // c.params["algorithm"] = KDTREE; - // c.params["trees"] = params[0]; - // - // autotuner.evaluate_kdtree(c); - // - // return c.timeCost; - // - // } - // }; - - - - void optimizeKMeans(std::vector& costs) - { - Logger::info("KMEANS, Step 1: Exploring parameter space\n"); - - // explore kmeans parameters space using combinations of the parameters below - int maxIterations[] = { 1, 5, 10, 15 }; - int branchingFactors[] = { 16, 32, 64, 128, 256 }; - - int kmeansParamSpaceSize = FLANN_ARRAY_LEN(maxIterations) * FLANN_ARRAY_LEN(branchingFactors); - costs.reserve(costs.size() + kmeansParamSpaceSize); - - // evaluate kmeans for all parameter combinations - for (size_t i = 0; i < FLANN_ARRAY_LEN(maxIterations); ++i) { - for (size_t j = 0; j < FLANN_ARRAY_LEN(branchingFactors); ++j) { - CostData cost; - cost.params["algorithm"] = FLANN_INDEX_KMEANS; - cost.params["centers_init"] = FLANN_CENTERS_RANDOM; - cost.params["iterations"] = maxIterations[i]; - cost.params["branching"] = branchingFactors[j]; - - evaluate_kmeans(cost); - costs.push_back(cost); - } - } - - // Logger::info("KMEANS, Step 2: simplex-downhill optimization\n"); - // - // const int n = 2; - // // choose initial simplex points as the best parameters so far - // int kmeansNMPoints[n*(n+1)]; - // float kmeansVals[n+1]; - // for (int i=0;i& costs) - { - Logger::info("KD-TREE, Step 1: Exploring parameter space\n"); - - // explore kd-tree parameters space using the parameters below - int testTrees[] = { 1, 4, 8, 16, 32 }; - - // evaluate kdtree for all parameter combinations - for (size_t i = 0; i < FLANN_ARRAY_LEN(testTrees); ++i) { - CostData cost; - cost.params["algorithm"] = FLANN_INDEX_KDTREE; - cost.params["trees"] = testTrees[i]; - - evaluate_kdtree(cost); - costs.push_back(cost); - } - - // Logger::info("KD-TREE, Step 2: simplex-downhill optimization\n"); - // - // const int n = 1; - // // choose initial simplex points as the best parameters so far - // int kdtreeNMPoints[n*(n+1)]; - // float kdtreeVals[n+1]; - // for (int i=0;i costs; - - int sampleSize = int(sample_fraction_ * dataset_.rows); - int testSampleSize = std::min(sampleSize / 10, 1000); - - Logger::info("Entering autotuning, dataset size: %d, sampleSize: %d, testSampleSize: %d, target precision: %g\n", dataset_.rows, sampleSize, testSampleSize, target_precision_); - - // For a very small dataset, it makes no sense to build any fancy index, just - // use linear search - if (testSampleSize < 10) { - Logger::info("Choosing linear, dataset too small\n"); - return LinearIndexParams(); - } - - // We use a fraction of the original dataset to speedup the autotune algorithm - sampledDataset_ = random_sample(dataset_, sampleSize); - // We use a cross-validation approach, first we sample a testset from the dataset - testDataset_ = random_sample(sampledDataset_, testSampleSize, true); - - // We compute the ground truth using linear search - Logger::info("Computing ground truth... \n"); - gt_matches_ = Matrix(new int[testDataset_.rows], testDataset_.rows, 1); - StartStopTimer t; - t.start(); - compute_ground_truth(sampledDataset_, testDataset_, gt_matches_, 0, distance_); - t.stop(); - - CostData linear_cost; - linear_cost.searchTimeCost = (float)t.value; - linear_cost.buildTimeCost = 0; - linear_cost.memoryCost = 0; - linear_cost.params["algorithm"] = FLANN_INDEX_LINEAR; - - costs.push_back(linear_cost); - - // Start parameter autotune process - Logger::info("Autotuning parameters...\n"); - - optimizeKMeans(costs); - optimizeKDTree(costs); - - float bestTimeCost = costs[0].searchTimeCost; - for (size_t i = 0; i < costs.size(); ++i) { - float timeCost = costs[i].buildTimeCost * build_weight_ + costs[i].searchTimeCost; - if (timeCost < bestTimeCost) { - bestTimeCost = timeCost; - } - } - - float bestCost = costs[0].searchTimeCost / bestTimeCost; - IndexParams bestParams = costs[0].params; - if (bestTimeCost > 0) { - for (size_t i = 0; i < costs.size(); ++i) { - float crtCost = (costs[i].buildTimeCost * build_weight_ + costs[i].searchTimeCost) / bestTimeCost + - memory_weight_ * costs[i].memoryCost; - if (crtCost < bestCost) { - bestCost = crtCost; - bestParams = costs[i].params; - } - } - } - - delete[] gt_matches_.data; - delete[] testDataset_.data; - delete[] sampledDataset_.data; - - return bestParams; - } - - - - /** - * Estimates the search time parameters needed to get the desired precision. - * Precondition: the index is built - * Postcondition: the searchParams will have the optimum params set, also the speedup obtained over linear search. - */ - float estimateSearchParams(SearchParams& searchParams) - { - const int nn = 1; - const size_t SAMPLE_COUNT = 1000; - - assert(bestIndex_ != NULL); // must have a valid index - - float speedup = 0; - - int samples = (int)std::min(dataset_.rows / 10, SAMPLE_COUNT); - if (samples > 0) { - Matrix testDataset = random_sample(dataset_, samples); - - Logger::info("Computing ground truth\n"); - - // we need to compute the ground truth first - Matrix gt_matches(new int[testDataset.rows], testDataset.rows, 1); - StartStopTimer t; - t.start(); - compute_ground_truth(dataset_, testDataset, gt_matches, 1, distance_); - t.stop(); - float linear = (float)t.value; - - int checks; - Logger::info("Estimating number of checks\n"); - - float searchTime; - float cb_index; - if (bestIndex_->getType() == FLANN_INDEX_KMEANS) { - Logger::info("KMeans algorithm, estimating cluster border factor\n"); - KMeansIndex* kmeans = (KMeansIndex*)bestIndex_; - float bestSearchTime = -1; - float best_cb_index = -1; - int best_checks = -1; - for (cb_index = 0; cb_index < 1.1f; cb_index += 0.2f) { - kmeans->set_cb_index(cb_index); - searchTime = test_index_precision(*kmeans, dataset_, testDataset, gt_matches, target_precision_, checks, distance_, nn, 1); - if ((searchTime < bestSearchTime) || (bestSearchTime == -1)) { - bestSearchTime = searchTime; - best_cb_index = cb_index; - best_checks = checks; - } - } - searchTime = bestSearchTime; - cb_index = best_cb_index; - checks = best_checks; - - kmeans->set_cb_index(best_cb_index); - Logger::info("Optimum cb_index: %g\n", cb_index); - bestParams_["cb_index"] = cb_index; - } - else { - searchTime = test_index_precision(*bestIndex_, dataset_, testDataset, gt_matches, target_precision_, checks, distance_, nn, 1); - } - - Logger::info("Required number of checks: %d \n", checks); - searchParams["checks"] = checks; - - speedup = linear / searchTime; - - delete[] gt_matches.data; - delete[] testDataset.data; - } - - return speedup; - } - -private: - NNIndex* bestIndex_; - - IndexParams bestParams_; - SearchParams bestSearchParams_; - - Matrix sampledDataset_; - Matrix testDataset_; - Matrix gt_matches_; - - float speedup_; - - /** - * The dataset used by this index - */ - const Matrix dataset_; - - /** - * Index parameters - */ - float target_precision_; - float build_weight_; - float memory_weight_; - float sample_fraction_; - - Distance distance_; - - -}; -} - -#endif /* OPENCV_FLANN_AUTOTUNED_INDEX_H_ */ diff --git a/opencv/include/opencv2/flann/composite_index.h b/opencv/include/opencv2/flann/composite_index.h deleted file mode 100644 index 5e12a17..0000000 --- a/opencv/include/opencv2/flann/composite_index.h +++ /dev/null @@ -1,194 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_COMPOSITE_INDEX_H_ -#define OPENCV_FLANN_COMPOSITE_INDEX_H_ - -#include "general.h" -#include "nn_index.h" -#include "kdtree_index.h" -#include "kmeans_index.h" - -namespace cvflann -{ - -/** - * Index parameters for the CompositeIndex. - */ -struct CompositeIndexParams : public IndexParams -{ - CompositeIndexParams(int trees = 4, int branching = 32, int iterations = 11, - flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM, float cb_index = 0.2 ) - { - (*this)["algorithm"] = FLANN_INDEX_KMEANS; - // number of randomized trees to use (for kdtree) - (*this)["trees"] = trees; - // branching factor - (*this)["branching"] = branching; - // max iterations to perform in one kmeans clustering (kmeans tree) - (*this)["iterations"] = iterations; - // algorithm used for picking the initial cluster centers for kmeans tree - (*this)["centers_init"] = centers_init; - // cluster boundary index. Used when searching the kmeans tree - (*this)["cb_index"] = cb_index; - } -}; - - -/** - * This index builds a kd-tree index and a k-means index and performs nearest - * neighbour search both indexes. This gives a slight boost in search performance - * as some of the neighbours that are missed by one index are found by the other. - */ -template -class CompositeIndex : public NNIndex -{ -public: - typedef typename Distance::ElementType ElementType; - typedef typename Distance::ResultType DistanceType; - - /** - * Index constructor - * @param inputData dataset containing the points to index - * @param params Index parameters - * @param d Distance functor - * @return - */ - CompositeIndex(const Matrix& inputData, const IndexParams& params = CompositeIndexParams(), - Distance d = Distance()) : index_params_(params) - { - kdtree_index_ = new KDTreeIndex(inputData, params, d); - kmeans_index_ = new KMeansIndex(inputData, params, d); - - } - - CompositeIndex(const CompositeIndex&); - CompositeIndex& operator=(const CompositeIndex&); - - virtual ~CompositeIndex() - { - delete kdtree_index_; - delete kmeans_index_; - } - - /** - * @return The index type - */ - flann_algorithm_t getType() const CV_OVERRIDE - { - return FLANN_INDEX_COMPOSITE; - } - - /** - * @return Size of the index - */ - size_t size() const CV_OVERRIDE - { - return kdtree_index_->size(); - } - - /** - * \returns The dimensionality of the features in this index. - */ - size_t veclen() const CV_OVERRIDE - { - return kdtree_index_->veclen(); - } - - /** - * \returns The amount of memory (in bytes) used by the index. - */ - int usedMemory() const CV_OVERRIDE - { - return kmeans_index_->usedMemory() + kdtree_index_->usedMemory(); - } - - /** - * \brief Builds the index - */ - void buildIndex() CV_OVERRIDE - { - Logger::info("Building kmeans tree...\n"); - kmeans_index_->buildIndex(); - Logger::info("Building kdtree tree...\n"); - kdtree_index_->buildIndex(); - } - - /** - * \brief Saves the index to a stream - * \param stream The stream to save the index to - */ - void saveIndex(FILE* stream) CV_OVERRIDE - { - kmeans_index_->saveIndex(stream); - kdtree_index_->saveIndex(stream); - } - - /** - * \brief Loads the index from a stream - * \param stream The stream from which the index is loaded - */ - void loadIndex(FILE* stream) CV_OVERRIDE - { - kmeans_index_->loadIndex(stream); - kdtree_index_->loadIndex(stream); - } - - /** - * \returns The index parameters - */ - IndexParams getParameters() const CV_OVERRIDE - { - return index_params_; - } - - /** - * \brief Method that searches for nearest-neighbours - */ - void findNeighbors(ResultSet& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE - { - kmeans_index_->findNeighbors(result, vec, searchParams); - kdtree_index_->findNeighbors(result, vec, searchParams); - } - -private: - /** The k-means index */ - KMeansIndex* kmeans_index_; - - /** The kd-tree index */ - KDTreeIndex* kdtree_index_; - - /** The index parameters */ - const IndexParams index_params_; -}; - -} - -#endif //OPENCV_FLANN_COMPOSITE_INDEX_H_ diff --git a/opencv/include/opencv2/flann/config.h b/opencv/include/opencv2/flann/config.h deleted file mode 100644 index 56832fd..0000000 --- a/opencv/include/opencv2/flann/config.h +++ /dev/null @@ -1,38 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2011 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2011 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - - -#ifndef OPENCV_FLANN_CONFIG_H_ -#define OPENCV_FLANN_CONFIG_H_ - -#ifdef FLANN_VERSION_ -#undef FLANN_VERSION_ -#endif -#define FLANN_VERSION_ "1.6.10" - -#endif /* OPENCV_FLANN_CONFIG_H_ */ diff --git a/opencv/include/opencv2/flann/defines.h b/opencv/include/opencv2/flann/defines.h deleted file mode 100644 index 6fd53c2..0000000 --- a/opencv/include/opencv2/flann/defines.h +++ /dev/null @@ -1,164 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2011 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2011 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - - -#ifndef OPENCV_FLANN_DEFINES_H_ -#define OPENCV_FLANN_DEFINES_H_ - -#include "config.h" - -#ifdef FLANN_EXPORT -#undef FLANN_EXPORT -#endif -#ifdef _WIN32 -/* win32 dll export/import directives */ - #ifdef FLANN_EXPORTS - #define FLANN_EXPORT __declspec(dllexport) - #elif defined(FLANN_STATIC) - #define FLANN_EXPORT - #else - #define FLANN_EXPORT __declspec(dllimport) - #endif -#else -/* unix needs nothing */ - #define FLANN_EXPORT -#endif - - -#undef FLANN_PLATFORM_32_BIT -#undef FLANN_PLATFORM_64_BIT -#if defined __amd64__ || defined __x86_64__ || defined _WIN64 || defined _M_X64 -#define FLANN_PLATFORM_64_BIT -#else -#define FLANN_PLATFORM_32_BIT -#endif - - -#undef FLANN_ARRAY_LEN -#define FLANN_ARRAY_LEN(a) (sizeof(a)/sizeof(a[0])) - -namespace cvflann { - -/* Nearest neighbour index algorithms */ -enum flann_algorithm_t -{ - FLANN_INDEX_LINEAR = 0, - FLANN_INDEX_KDTREE = 1, - FLANN_INDEX_KMEANS = 2, - FLANN_INDEX_COMPOSITE = 3, - FLANN_INDEX_KDTREE_SINGLE = 4, - FLANN_INDEX_HIERARCHICAL = 5, - FLANN_INDEX_LSH = 6, - FLANN_INDEX_SAVED = 254, - FLANN_INDEX_AUTOTUNED = 255, - - // deprecated constants, should use the FLANN_INDEX_* ones instead - LINEAR = 0, - KDTREE = 1, - KMEANS = 2, - COMPOSITE = 3, - KDTREE_SINGLE = 4, - SAVED = 254, - AUTOTUNED = 255 -}; - - - -enum flann_centers_init_t -{ - FLANN_CENTERS_RANDOM = 0, - FLANN_CENTERS_GONZALES = 1, - FLANN_CENTERS_KMEANSPP = 2, - FLANN_CENTERS_GROUPWISE = 3, - - // deprecated constants, should use the FLANN_CENTERS_* ones instead - CENTERS_RANDOM = 0, - CENTERS_GONZALES = 1, - CENTERS_KMEANSPP = 2 -}; - -enum flann_log_level_t -{ - FLANN_LOG_NONE = 0, - FLANN_LOG_FATAL = 1, - FLANN_LOG_ERROR = 2, - FLANN_LOG_WARN = 3, - FLANN_LOG_INFO = 4 -}; - -enum flann_distance_t -{ - FLANN_DIST_EUCLIDEAN = 1, - FLANN_DIST_L2 = 1, - FLANN_DIST_MANHATTAN = 2, - FLANN_DIST_L1 = 2, - FLANN_DIST_MINKOWSKI = 3, - FLANN_DIST_MAX = 4, - FLANN_DIST_HIST_INTERSECT = 5, - FLANN_DIST_HELLINGER = 6, - FLANN_DIST_CHI_SQUARE = 7, - FLANN_DIST_CS = 7, - FLANN_DIST_KULLBACK_LEIBLER = 8, - FLANN_DIST_KL = 8, - FLANN_DIST_HAMMING = 9, - - // deprecated constants, should use the FLANN_DIST_* ones instead - EUCLIDEAN = 1, - MANHATTAN = 2, - MINKOWSKI = 3, - MAX_DIST = 4, - HIST_INTERSECT = 5, - HELLINGER = 6, - CS = 7, - KL = 8, - KULLBACK_LEIBLER = 8 -}; - -enum flann_datatype_t -{ - FLANN_INT8 = 0, - FLANN_INT16 = 1, - FLANN_INT32 = 2, - FLANN_INT64 = 3, - FLANN_UINT8 = 4, - FLANN_UINT16 = 5, - FLANN_UINT32 = 6, - FLANN_UINT64 = 7, - FLANN_FLOAT32 = 8, - FLANN_FLOAT64 = 9 -}; - -enum -{ - FLANN_CHECKS_UNLIMITED = -1, - FLANN_CHECKS_AUTOTUNED = -2 -}; - -} - -#endif /* OPENCV_FLANN_DEFINES_H_ */ diff --git a/opencv/include/opencv2/flann/dist.h b/opencv/include/opencv2/flann/dist.h deleted file mode 100644 index 2bb4fc9..0000000 --- a/opencv/include/opencv2/flann/dist.h +++ /dev/null @@ -1,904 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_DIST_H_ -#define OPENCV_FLANN_DIST_H_ - -#include -#include -#include -#ifdef _MSC_VER -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -#else -#include -#endif - -#include "defines.h" - -#if defined _WIN32 && defined(_M_ARM) -# include -#endif - -#if defined(__ARM_NEON__) && !defined(__CUDACC__) -# include "arm_neon.h" -#endif - -namespace cvflann -{ - -template -inline T abs(T x) { return (x<0) ? -x : x; } - -template<> -inline int abs(int x) { return ::abs(x); } - -template<> -inline float abs(float x) { return fabsf(x); } - -template<> -inline double abs(double x) { return fabs(x); } - -template -struct Accumulator { typedef T Type; }; -template<> -struct Accumulator { typedef float Type; }; -template<> -struct Accumulator { typedef float Type; }; -template<> -struct Accumulator { typedef float Type; }; -template<> -struct Accumulator { typedef float Type; }; -template<> -struct Accumulator { typedef float Type; }; -template<> -struct Accumulator { typedef float Type; }; - -#undef True -#undef False - -class True -{ -}; - -class False -{ -}; - - -/** - * Squared Euclidean distance functor. - * - * This is the simpler, unrolled version. This is preferable for - * very low dimensionality data (eg 3D points) - */ -template -struct L2_Simple -{ - typedef True is_kdtree_distance; - typedef True is_vector_space_distance; - - typedef T ElementType; - typedef typename Accumulator::Type ResultType; - - template - ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const - { - ResultType result = ResultType(); - ResultType diff; - for(size_t i = 0; i < size; ++i ) { - diff = *a++ - *b++; - result += diff*diff; - } - return result; - } - - template - inline ResultType accum_dist(const U& a, const V& b, int) const - { - return (a-b)*(a-b); - } -}; - - - -/** - * Squared Euclidean distance functor, optimized version - */ -template -struct L2 -{ - typedef True is_kdtree_distance; - typedef True is_vector_space_distance; - - typedef T ElementType; - typedef typename Accumulator::Type ResultType; - - /** - * Compute the squared Euclidean distance between two vectors. - * - * This is highly optimised, with loop unrolling, as it is one - * of the most expensive inner loops. - * - * The computation of squared root at the end is omitted for - * efficiency. - */ - template - ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const - { - ResultType result = ResultType(); - ResultType diff0, diff1, diff2, diff3; - Iterator1 last = a + size; - Iterator1 lastgroup = last - 3; - - /* Process 4 items with each loop for efficiency. */ - while (a < lastgroup) { - diff0 = (ResultType)(a[0] - b[0]); - diff1 = (ResultType)(a[1] - b[1]); - diff2 = (ResultType)(a[2] - b[2]); - diff3 = (ResultType)(a[3] - b[3]); - result += diff0 * diff0 + diff1 * diff1 + diff2 * diff2 + diff3 * diff3; - a += 4; - b += 4; - - if ((worst_dist>0)&&(result>worst_dist)) { - return result; - } - } - /* Process last 0-3 pixels. Not needed for standard vector lengths. */ - while (a < last) { - diff0 = (ResultType)(*a++ - *b++); - result += diff0 * diff0; - } - return result; - } - - /** - * Partial euclidean distance, using just one dimension. This is used by the - * kd-tree when computing partial distances while traversing the tree. - * - * Squared root is omitted for efficiency. - */ - template - inline ResultType accum_dist(const U& a, const V& b, int) const - { - return (a-b)*(a-b); - } -}; - - -/* - * Manhattan distance functor, optimized version - */ -template -struct L1 -{ - typedef True is_kdtree_distance; - typedef True is_vector_space_distance; - - typedef T ElementType; - typedef typename Accumulator::Type ResultType; - - /** - * Compute the Manhattan (L_1) distance between two vectors. - * - * This is highly optimised, with loop unrolling, as it is one - * of the most expensive inner loops. - */ - template - ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const - { - ResultType result = ResultType(); - ResultType diff0, diff1, diff2, diff3; - Iterator1 last = a + size; - Iterator1 lastgroup = last - 3; - - /* Process 4 items with each loop for efficiency. */ - while (a < lastgroup) { - diff0 = (ResultType)abs(a[0] - b[0]); - diff1 = (ResultType)abs(a[1] - b[1]); - diff2 = (ResultType)abs(a[2] - b[2]); - diff3 = (ResultType)abs(a[3] - b[3]); - result += diff0 + diff1 + diff2 + diff3; - a += 4; - b += 4; - - if ((worst_dist>0)&&(result>worst_dist)) { - return result; - } - } - /* Process last 0-3 pixels. Not needed for standard vector lengths. */ - while (a < last) { - diff0 = (ResultType)abs(*a++ - *b++); - result += diff0; - } - return result; - } - - /** - * Partial distance, used by the kd-tree. - */ - template - inline ResultType accum_dist(const U& a, const V& b, int) const - { - return abs(a-b); - } -}; - - - -template -struct MinkowskiDistance -{ - typedef True is_kdtree_distance; - typedef True is_vector_space_distance; - - typedef T ElementType; - typedef typename Accumulator::Type ResultType; - - int order; - - MinkowskiDistance(int order_) : order(order_) {} - - /** - * Compute the Minkowsky (L_p) distance between two vectors. - * - * This is highly optimised, with loop unrolling, as it is one - * of the most expensive inner loops. - * - * The computation of squared root at the end is omitted for - * efficiency. - */ - template - ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const - { - ResultType result = ResultType(); - ResultType diff0, diff1, diff2, diff3; - Iterator1 last = a + size; - Iterator1 lastgroup = last - 3; - - /* Process 4 items with each loop for efficiency. */ - while (a < lastgroup) { - diff0 = (ResultType)abs(a[0] - b[0]); - diff1 = (ResultType)abs(a[1] - b[1]); - diff2 = (ResultType)abs(a[2] - b[2]); - diff3 = (ResultType)abs(a[3] - b[3]); - result += pow(diff0,order) + pow(diff1,order) + pow(diff2,order) + pow(diff3,order); - a += 4; - b += 4; - - if ((worst_dist>0)&&(result>worst_dist)) { - return result; - } - } - /* Process last 0-3 pixels. Not needed for standard vector lengths. */ - while (a < last) { - diff0 = (ResultType)abs(*a++ - *b++); - result += pow(diff0,order); - } - return result; - } - - /** - * Partial distance, used by the kd-tree. - */ - template - inline ResultType accum_dist(const U& a, const V& b, int) const - { - return pow(static_cast(abs(a-b)),order); - } -}; - - - -template -struct MaxDistance -{ - typedef False is_kdtree_distance; - typedef True is_vector_space_distance; - - typedef T ElementType; - typedef typename Accumulator::Type ResultType; - - /** - * Compute the max distance (L_infinity) between two vectors. - * - * This distance is not a valid kdtree distance, it's not dimensionwise additive. - */ - template - ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const - { - ResultType result = ResultType(); - ResultType diff0, diff1, diff2, diff3; - Iterator1 last = a + size; - Iterator1 lastgroup = last - 3; - - /* Process 4 items with each loop for efficiency. */ - while (a < lastgroup) { - diff0 = abs(a[0] - b[0]); - diff1 = abs(a[1] - b[1]); - diff2 = abs(a[2] - b[2]); - diff3 = abs(a[3] - b[3]); - if (diff0>result) {result = diff0; } - if (diff1>result) {result = diff1; } - if (diff2>result) {result = diff2; } - if (diff3>result) {result = diff3; } - a += 4; - b += 4; - - if ((worst_dist>0)&&(result>worst_dist)) { - return result; - } - } - /* Process last 0-3 pixels. Not needed for standard vector lengths. */ - while (a < last) { - diff0 = abs(*a++ - *b++); - result = (diff0>result) ? diff0 : result; - } - return result; - } - - /* This distance functor is not dimension-wise additive, which - * makes it an invalid kd-tree distance, not implementing the accum_dist method */ - -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * Hamming distance functor - counts the bit differences between two strings - useful for the Brief descriptor - * bit count of A exclusive XOR'ed with B - */ -struct HammingLUT -{ - typedef False is_kdtree_distance; - typedef False is_vector_space_distance; - - typedef unsigned char ElementType; - typedef int ResultType; - - /** this will count the bits in a ^ b - */ - ResultType operator()(const unsigned char* a, const unsigned char* b, size_t size) const - { - static const uchar popCountTable[] = - { - 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 - }; - ResultType result = 0; - for (size_t i = 0; i < size; i++) { - result += popCountTable[a[i] ^ b[i]]; - } - return result; - } -}; - -/** - * Hamming distance functor (pop count between two binary vectors, i.e. xor them and count the number of bits set) - * That code was taken from brief.cpp in OpenCV - */ -template -struct Hamming -{ - typedef False is_kdtree_distance; - typedef False is_vector_space_distance; - - - typedef T ElementType; - typedef int ResultType; - - template - ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const - { - ResultType result = 0; -#if defined(__ARM_NEON__) && !defined(__CUDACC__) - { - uint32x4_t bits = vmovq_n_u32(0); - for (size_t i = 0; i < size; i += 16) { - uint8x16_t A_vec = vld1q_u8 (a + i); - uint8x16_t B_vec = vld1q_u8 (b + i); - uint8x16_t AxorB = veorq_u8 (A_vec, B_vec); - uint8x16_t bitsSet = vcntq_u8 (AxorB); - uint16x8_t bitSet8 = vpaddlq_u8 (bitsSet); - uint32x4_t bitSet4 = vpaddlq_u16 (bitSet8); - bits = vaddq_u32(bits, bitSet4); - } - uint64x2_t bitSet2 = vpaddlq_u32 (bits); - result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0); - result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2); - } -#elif __GNUC__ - { - //for portability just use unsigned long -- and use the __builtin_popcountll (see docs for __builtin_popcountll) - typedef unsigned long long pop_t; - const size_t modulo = size % sizeof(pop_t); - const pop_t* a2 = reinterpret_cast (a); - const pop_t* b2 = reinterpret_cast (b); - const pop_t* a2_end = a2 + (size / sizeof(pop_t)); - - for (; a2 != a2_end; ++a2, ++b2) result += __builtin_popcountll((*a2) ^ (*b2)); - - if (modulo) { - //in the case where size is not dividable by sizeof(size_t) - //need to mask off the bits at the end - pop_t a_final = 0, b_final = 0; - memcpy(&a_final, a2, modulo); - memcpy(&b_final, b2, modulo); - result += __builtin_popcountll(a_final ^ b_final); - } - } -#else // NO NEON and NOT GNUC - HammingLUT lut; - result = lut(reinterpret_cast (a), - reinterpret_cast (b), size); -#endif - return result; - } -}; - -template -struct Hamming2 -{ - typedef False is_kdtree_distance; - typedef False is_vector_space_distance; - - typedef T ElementType; - typedef int ResultType; - - /** This is popcount_3() from: - * http://en.wikipedia.org/wiki/Hamming_weight */ - unsigned int popcnt32(uint32_t n) const - { - n -= ((n >> 1) & 0x55555555); - n = (n & 0x33333333) + ((n >> 2) & 0x33333333); - return (((n + (n >> 4))& 0xF0F0F0F)* 0x1010101) >> 24; - } - -#ifdef FLANN_PLATFORM_64_BIT - unsigned int popcnt64(uint64_t n) const - { - n -= ((n >> 1) & 0x5555555555555555); - n = (n & 0x3333333333333333) + ((n >> 2) & 0x3333333333333333); - return (((n + (n >> 4))& 0x0f0f0f0f0f0f0f0f)* 0x0101010101010101) >> 56; - } -#endif - - template - ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const - { -#ifdef FLANN_PLATFORM_64_BIT - const uint64_t* pa = reinterpret_cast(a); - const uint64_t* pb = reinterpret_cast(b); - ResultType result = 0; - size /= (sizeof(uint64_t)/sizeof(unsigned char)); - for(size_t i = 0; i < size; ++i ) { - result += popcnt64(*pa ^ *pb); - ++pa; - ++pb; - } -#else - const uint32_t* pa = reinterpret_cast(a); - const uint32_t* pb = reinterpret_cast(b); - ResultType result = 0; - size /= (sizeof(uint32_t)/sizeof(unsigned char)); - for(size_t i = 0; i < size; ++i ) { - result += popcnt32(*pa ^ *pb); - ++pa; - ++pb; - } -#endif - return result; - } -}; - - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -template -struct HistIntersectionDistance -{ - typedef True is_kdtree_distance; - typedef True is_vector_space_distance; - - typedef T ElementType; - typedef typename Accumulator::Type ResultType; - - /** - * Compute the histogram intersection distance - */ - template - ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const - { - ResultType result = ResultType(); - ResultType min0, min1, min2, min3; - Iterator1 last = a + size; - Iterator1 lastgroup = last - 3; - - /* Process 4 items with each loop for efficiency. */ - while (a < lastgroup) { - min0 = (ResultType)(a[0] < b[0] ? a[0] : b[0]); - min1 = (ResultType)(a[1] < b[1] ? a[1] : b[1]); - min2 = (ResultType)(a[2] < b[2] ? a[2] : b[2]); - min3 = (ResultType)(a[3] < b[3] ? a[3] : b[3]); - result += min0 + min1 + min2 + min3; - a += 4; - b += 4; - if ((worst_dist>0)&&(result>worst_dist)) { - return result; - } - } - /* Process last 0-3 pixels. Not needed for standard vector lengths. */ - while (a < last) { - min0 = (ResultType)(*a < *b ? *a : *b); - result += min0; - ++a; - ++b; - } - return result; - } - - /** - * Partial distance, used by the kd-tree. - */ - template - inline ResultType accum_dist(const U& a, const V& b, int) const - { - return a -struct HellingerDistance -{ - typedef True is_kdtree_distance; - typedef True is_vector_space_distance; - - typedef T ElementType; - typedef typename Accumulator::Type ResultType; - - /** - * Compute the Hellinger distance - */ - template - ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const - { - ResultType result = ResultType(); - ResultType diff0, diff1, diff2, diff3; - Iterator1 last = a + size; - Iterator1 lastgroup = last - 3; - - /* Process 4 items with each loop for efficiency. */ - while (a < lastgroup) { - diff0 = sqrt(static_cast(a[0])) - sqrt(static_cast(b[0])); - diff1 = sqrt(static_cast(a[1])) - sqrt(static_cast(b[1])); - diff2 = sqrt(static_cast(a[2])) - sqrt(static_cast(b[2])); - diff3 = sqrt(static_cast(a[3])) - sqrt(static_cast(b[3])); - result += diff0 * diff0 + diff1 * diff1 + diff2 * diff2 + diff3 * diff3; - a += 4; - b += 4; - } - while (a < last) { - diff0 = sqrt(static_cast(*a++)) - sqrt(static_cast(*b++)); - result += diff0 * diff0; - } - return result; - } - - /** - * Partial distance, used by the kd-tree. - */ - template - inline ResultType accum_dist(const U& a, const V& b, int) const - { - ResultType diff = sqrt(static_cast(a)) - sqrt(static_cast(b)); - return diff * diff; - } -}; - - -template -struct ChiSquareDistance -{ - typedef True is_kdtree_distance; - typedef True is_vector_space_distance; - - typedef T ElementType; - typedef typename Accumulator::Type ResultType; - - /** - * Compute the chi-square distance - */ - template - ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const - { - ResultType result = ResultType(); - ResultType sum, diff; - Iterator1 last = a + size; - - while (a < last) { - sum = (ResultType)(*a + *b); - if (sum>0) { - diff = (ResultType)(*a - *b); - result += diff*diff/sum; - } - ++a; - ++b; - - if ((worst_dist>0)&&(result>worst_dist)) { - return result; - } - } - return result; - } - - /** - * Partial distance, used by the kd-tree. - */ - template - inline ResultType accum_dist(const U& a, const V& b, int) const - { - ResultType result = ResultType(); - ResultType sum, diff; - - sum = (ResultType)(a+b); - if (sum>0) { - diff = (ResultType)(a-b); - result = diff*diff/sum; - } - return result; - } -}; - - -template -struct KL_Divergence -{ - typedef True is_kdtree_distance; - typedef True is_vector_space_distance; - - typedef T ElementType; - typedef typename Accumulator::Type ResultType; - - /** - * Compute the Kullback-Leibler divergence - */ - template - ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const - { - ResultType result = ResultType(); - Iterator1 last = a + size; - - while (a < last) { - if (* b != 0) { - ResultType ratio = (ResultType)(*a / *b); - if (ratio>0) { - result += *a * log(ratio); - } - } - ++a; - ++b; - - if ((worst_dist>0)&&(result>worst_dist)) { - return result; - } - } - return result; - } - - /** - * Partial distance, used by the kd-tree. - */ - template - inline ResultType accum_dist(const U& a, const V& b, int) const - { - ResultType result = ResultType(); - if( *b != 0 ) { - ResultType ratio = (ResultType)(a / b); - if (ratio>0) { - result = a * log(ratio); - } - } - return result; - } -}; - - - -/* - * This is a "zero iterator". It basically behaves like a zero filled - * array to all algorithms that use arrays as iterators (STL style). - * It's useful when there's a need to compute the distance between feature - * and origin it and allows for better compiler optimisation than using a - * zero-filled array. - */ -template -struct ZeroIterator -{ - - T operator*() - { - return 0; - } - - T operator[](int) - { - return 0; - } - - const ZeroIterator& operator ++() - { - return *this; - } - - ZeroIterator operator ++(int) - { - return *this; - } - - ZeroIterator& operator+=(int) - { - return *this; - } - -}; - - -/* - * Depending on processed distances, some of them are already squared (e.g. L2) - * and some are not (e.g.Hamming). In KMeans++ for instance we want to be sure - * we are working on ^2 distances, thus following templates to ensure that. - */ -template -struct squareDistance -{ - typedef typename Distance::ResultType ResultType; - ResultType operator()( ResultType dist ) { return dist*dist; } -}; - - -template -struct squareDistance, ElementType> -{ - typedef typename L2_Simple::ResultType ResultType; - ResultType operator()( ResultType dist ) { return dist; } -}; - -template -struct squareDistance, ElementType> -{ - typedef typename L2::ResultType ResultType; - ResultType operator()( ResultType dist ) { return dist; } -}; - - -template -struct squareDistance, ElementType> -{ - typedef typename MinkowskiDistance::ResultType ResultType; - ResultType operator()( ResultType dist ) { return dist; } -}; - -template -struct squareDistance, ElementType> -{ - typedef typename HellingerDistance::ResultType ResultType; - ResultType operator()( ResultType dist ) { return dist; } -}; - -template -struct squareDistance, ElementType> -{ - typedef typename ChiSquareDistance::ResultType ResultType; - ResultType operator()( ResultType dist ) { return dist; } -}; - - -template -typename Distance::ResultType ensureSquareDistance( typename Distance::ResultType dist ) -{ - typedef typename Distance::ElementType ElementType; - - squareDistance dummy; - return dummy( dist ); -} - - -/* - * ...and a template to ensure the user that he will process the normal distance, - * and not squared distance, without losing processing time calling sqrt(ensureSquareDistance) - * that will result in doing actually sqrt(dist*dist) for L1 distance for instance. - */ -template -struct simpleDistance -{ - typedef typename Distance::ResultType ResultType; - ResultType operator()( ResultType dist ) { return dist; } -}; - - -template -struct simpleDistance, ElementType> -{ - typedef typename L2_Simple::ResultType ResultType; - ResultType operator()( ResultType dist ) { return sqrt(dist); } -}; - -template -struct simpleDistance, ElementType> -{ - typedef typename L2::ResultType ResultType; - ResultType operator()( ResultType dist ) { return sqrt(dist); } -}; - - -template -struct simpleDistance, ElementType> -{ - typedef typename MinkowskiDistance::ResultType ResultType; - ResultType operator()( ResultType dist ) { return sqrt(dist); } -}; - -template -struct simpleDistance, ElementType> -{ - typedef typename HellingerDistance::ResultType ResultType; - ResultType operator()( ResultType dist ) { return sqrt(dist); } -}; - -template -struct simpleDistance, ElementType> -{ - typedef typename ChiSquareDistance::ResultType ResultType; - ResultType operator()( ResultType dist ) { return sqrt(dist); } -}; - - -template -typename Distance::ResultType ensureSimpleDistance( typename Distance::ResultType dist ) -{ - typedef typename Distance::ElementType ElementType; - - simpleDistance dummy; - return dummy( dist ); -} - -} - -#endif //OPENCV_FLANN_DIST_H_ diff --git a/opencv/include/opencv2/flann/dummy.h b/opencv/include/opencv2/flann/dummy.h deleted file mode 100644 index d6837e5..0000000 --- a/opencv/include/opencv2/flann/dummy.h +++ /dev/null @@ -1,13 +0,0 @@ - -#ifndef OPENCV_FLANN_DUMMY_H_ -#define OPENCV_FLANN_DUMMY_H_ - -namespace cvflann -{ - -CV_DEPRECATED inline void dummyfunc() {} - -} - - -#endif /* OPENCV_FLANN_DUMMY_H_ */ diff --git a/opencv/include/opencv2/flann/dynamic_bitset.h b/opencv/include/opencv2/flann/dynamic_bitset.h deleted file mode 100644 index 923b658..0000000 --- a/opencv/include/opencv2/flann/dynamic_bitset.h +++ /dev/null @@ -1,159 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -/*********************************************************************** - * Author: Vincent Rabaud - *************************************************************************/ - -#ifndef OPENCV_FLANN_DYNAMIC_BITSET_H_ -#define OPENCV_FLANN_DYNAMIC_BITSET_H_ - -#ifndef FLANN_USE_BOOST -# define FLANN_USE_BOOST 0 -#endif -//#define FLANN_USE_BOOST 1 -#if FLANN_USE_BOOST -#include -typedef boost::dynamic_bitset<> DynamicBitset; -#else - -#include - -#include "dist.h" - -namespace cvflann { - -/** Class re-implementing the boost version of it - * This helps not depending on boost, it also does not do the bound checks - * and has a way to reset a block for speed - */ -class DynamicBitset -{ -public: - /** default constructor - */ - DynamicBitset() : size_(0) - { - } - - /** only constructor we use in our code - * @param sz the size of the bitset (in bits) - */ - DynamicBitset(size_t sz) - { - resize(sz); - reset(); - } - - /** Sets all the bits to 0 - */ - void clear() - { - std::fill(bitset_.begin(), bitset_.end(), 0); - } - - /** @brief checks if the bitset is empty - * @return true if the bitset is empty - */ - bool empty() const - { - return bitset_.empty(); - } - - /** set all the bits to 0 - */ - void reset() - { - std::fill(bitset_.begin(), bitset_.end(), 0); - } - - /** @brief set one bit to 0 - * @param index - */ - void reset(size_t index) - { - bitset_[index / cell_bit_size_] &= ~(size_t(1) << (index % cell_bit_size_)); - } - - /** @brief sets a specific bit to 0, and more bits too - * This function is useful when resetting a given set of bits so that the - * whole bitset ends up being 0: if that's the case, we don't care about setting - * other bits to 0 - * @param index - */ - void reset_block(size_t index) - { - bitset_[index / cell_bit_size_] = 0; - } - - /** resize the bitset so that it contains at least sz bits - * @param sz - */ - void resize(size_t sz) - { - size_ = sz; - bitset_.resize(sz / cell_bit_size_ + 1); - } - - /** set a bit to true - * @param index the index of the bit to set to 1 - */ - void set(size_t index) - { - bitset_[index / cell_bit_size_] |= size_t(1) << (index % cell_bit_size_); - } - - /** gives the number of contained bits - */ - size_t size() const - { - return size_; - } - - /** check if a bit is set - * @param index the index of the bit to check - * @return true if the bit is set - */ - bool test(size_t index) const - { - return (bitset_[index / cell_bit_size_] & (size_t(1) << (index % cell_bit_size_))) != 0; - } - -private: - std::vector bitset_; - size_t size_; - static const unsigned int cell_bit_size_ = CHAR_BIT * sizeof(size_t); -}; - -} // namespace cvflann - -#endif - -#endif // OPENCV_FLANN_DYNAMIC_BITSET_H_ diff --git a/opencv/include/opencv2/flann/flann.hpp b/opencv/include/opencv2/flann/flann.hpp deleted file mode 100644 index 227683f..0000000 --- a/opencv/include/opencv2/flann/flann.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/flann.hpp" diff --git a/opencv/include/opencv2/flann/flann_base.hpp b/opencv/include/opencv2/flann/flann_base.hpp deleted file mode 100644 index 0ffb857..0000000 --- a/opencv/include/opencv2/flann/flann_base.hpp +++ /dev/null @@ -1,295 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_BASE_HPP_ -#define OPENCV_FLANN_BASE_HPP_ - -#include -#include -#include - -#include "general.h" -#include "matrix.h" -#include "params.h" -#include "saving.h" - -#include "all_indices.h" - -namespace cvflann -{ - -/** - * Sets the log level used for all flann functions - * @param level Verbosity level - */ -inline void log_verbosity(int level) -{ - if (level >= 0) { - Logger::setLevel(level); - } -} - -/** - * (Deprecated) Index parameters for creating a saved index. - */ -struct SavedIndexParams : public IndexParams -{ - SavedIndexParams(cv::String filename) - { - (* this)["algorithm"] = FLANN_INDEX_SAVED; - (*this)["filename"] = filename; - } -}; - - -template -NNIndex* load_saved_index(const Matrix& dataset, const cv::String& filename, Distance distance) -{ - typedef typename Distance::ElementType ElementType; - - FILE* fin = fopen(filename.c_str(), "rb"); - if (fin == NULL) { - return NULL; - } - IndexHeader header = load_header(fin); - if (header.data_type != Datatype::type()) { - fclose(fin); - throw FLANNException("Datatype of saved index is different than of the one to be created."); - } - if ((size_t(header.rows) != dataset.rows)||(size_t(header.cols) != dataset.cols)) { - fclose(fin); - throw FLANNException("The index saved belongs to a different dataset"); - } - - IndexParams params; - params["algorithm"] = header.index_type; - NNIndex* nnIndex = create_index_by_type(dataset, params, distance); - nnIndex->loadIndex(fin); - fclose(fin); - - return nnIndex; -} - - -template -class Index : public NNIndex -{ -public: - typedef typename Distance::ElementType ElementType; - typedef typename Distance::ResultType DistanceType; - - Index(const Matrix& features, const IndexParams& params, Distance distance = Distance() ) - : index_params_(params) - { - flann_algorithm_t index_type = get_param(params,"algorithm"); - loaded_ = false; - - if (index_type == FLANN_INDEX_SAVED) { - nnIndex_ = load_saved_index(features, get_param(params,"filename"), distance); - loaded_ = true; - } - else { - nnIndex_ = create_index_by_type(features, params, distance); - } - } - - ~Index() - { - delete nnIndex_; - } - - /** - * Builds the index. - */ - void buildIndex() CV_OVERRIDE - { - if (!loaded_) { - nnIndex_->buildIndex(); - } - } - - void save(cv::String filename) - { - FILE* fout = fopen(filename.c_str(), "wb"); - if (fout == NULL) { - throw FLANNException("Cannot open file"); - } - save_header(fout, *nnIndex_); - saveIndex(fout); - fclose(fout); - } - - /** - * \brief Saves the index to a stream - * \param stream The stream to save the index to - */ - virtual void saveIndex(FILE* stream) CV_OVERRIDE - { - nnIndex_->saveIndex(stream); - } - - /** - * \brief Loads the index from a stream - * \param stream The stream from which the index is loaded - */ - virtual void loadIndex(FILE* stream) CV_OVERRIDE - { - nnIndex_->loadIndex(stream); - } - - /** - * \returns number of features in this index. - */ - size_t veclen() const CV_OVERRIDE - { - return nnIndex_->veclen(); - } - - /** - * \returns The dimensionality of the features in this index. - */ - size_t size() const CV_OVERRIDE - { - return nnIndex_->size(); - } - - /** - * \returns The index type (kdtree, kmeans,...) - */ - flann_algorithm_t getType() const CV_OVERRIDE - { - return nnIndex_->getType(); - } - - /** - * \returns The amount of memory (in bytes) used by the index. - */ - virtual int usedMemory() const CV_OVERRIDE - { - return nnIndex_->usedMemory(); - } - - - /** - * \returns The index parameters - */ - IndexParams getParameters() const CV_OVERRIDE - { - return nnIndex_->getParameters(); - } - - /** - * \brief Perform k-nearest neighbor search - * \param[in] queries The query points for which to find the nearest neighbors - * \param[out] indices The indices of the nearest neighbors found - * \param[out] dists Distances to the nearest neighbors found - * \param[in] knn Number of nearest neighbors to return - * \param[in] params Search parameters - */ - void knnSearch(const Matrix& queries, Matrix& indices, Matrix& dists, int knn, const SearchParams& params) CV_OVERRIDE - { - nnIndex_->knnSearch(queries, indices, dists, knn, params); - } - - /** - * \brief Perform radius search - * \param[in] query The query point - * \param[out] indices The indinces of the neighbors found within the given radius - * \param[out] dists The distances to the nearest neighbors found - * \param[in] radius The radius used for search - * \param[in] params Search parameters - * \returns Number of neighbors found - */ - int radiusSearch(const Matrix& query, Matrix& indices, Matrix& dists, float radius, const SearchParams& params) CV_OVERRIDE - { - return nnIndex_->radiusSearch(query, indices, dists, radius, params); - } - - /** - * \brief Method that searches for nearest-neighbours - */ - void findNeighbors(ResultSet& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE - { - nnIndex_->findNeighbors(result, vec, searchParams); - } - - /** - * \brief Returns actual index - */ - CV_DEPRECATED NNIndex* getIndex() - { - return nnIndex_; - } - - /** - * \brief Returns index parameters. - * \deprecated use getParameters() instead. - */ - CV_DEPRECATED const IndexParams* getIndexParameters() - { - return &index_params_; - } - -private: - /** Pointer to actual index class */ - NNIndex* nnIndex_; - /** Indices if the index was loaded from a file */ - bool loaded_; - /** Parameters passed to the index */ - IndexParams index_params_; - - Index(const Index &); // copy disabled - Index& operator=(const Index &); // assign disabled -}; - -/** - * Performs a hierarchical clustering of the points passed as argument and then takes a cut in the - * the clustering tree to return a flat clustering. - * @param[in] points Points to be clustered - * @param centers The computed cluster centres. Matrix should be preallocated and centers.rows is the - * number of clusters requested. - * @param params Clustering parameters (The same as for cvflann::KMeansIndex) - * @param d Distance to be used for clustering (eg: cvflann::L2) - * @return number of clusters computed (can be different than clusters.rows and is the highest number - * of the form (branching-1)*K+1 smaller than clusters.rows). - */ -template -int hierarchicalClustering(const Matrix& points, Matrix& centers, - const KMeansIndexParams& params, Distance d = Distance()) -{ - KMeansIndex kmeans(points, params, d); - kmeans.buildIndex(); - - int clusterNum = kmeans.getClusterCenters(centers); - return clusterNum; -} - -} -#endif /* OPENCV_FLANN_BASE_HPP_ */ diff --git a/opencv/include/opencv2/flann/general.h b/opencv/include/opencv2/flann/general.h deleted file mode 100644 index 9d5402a..0000000 --- a/opencv/include/opencv2/flann/general.h +++ /dev/null @@ -1,50 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_GENERAL_H_ -#define OPENCV_FLANN_GENERAL_H_ - -#include "opencv2/core.hpp" - -namespace cvflann -{ - -class FLANNException : public cv::Exception -{ -public: - FLANNException(const char* message) : cv::Exception(0, message, "", __FILE__, __LINE__) { } - - FLANNException(const cv::String& message) : cv::Exception(0, message, "", __FILE__, __LINE__) { } -}; - -} - - -#endif /* OPENCV_FLANN_GENERAL_H_ */ diff --git a/opencv/include/opencv2/flann/ground_truth.h b/opencv/include/opencv2/flann/ground_truth.h deleted file mode 100644 index fd8f3ae..0000000 --- a/opencv/include/opencv2/flann/ground_truth.h +++ /dev/null @@ -1,94 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_GROUND_TRUTH_H_ -#define OPENCV_FLANN_GROUND_TRUTH_H_ - -#include "dist.h" -#include "matrix.h" - - -namespace cvflann -{ - -template -void find_nearest(const Matrix& dataset, typename Distance::ElementType* query, int* matches, int nn, - int skip = 0, Distance distance = Distance()) -{ - typedef typename Distance::ResultType DistanceType; - int n = nn + skip; - - std::vector match(n); - std::vector dists(n); - - dists[0] = distance(dataset[0], query, dataset.cols); - match[0] = 0; - int dcnt = 1; - - for (size_t i=1; i=1 && dists[j] -void compute_ground_truth(const Matrix& dataset, const Matrix& testset, Matrix& matches, - int skip=0, Distance d = Distance()) -{ - for (size_t i=0; i(dataset, testset[i], matches[i], (int)matches.cols, skip, d); - } -} - - -} - -#endif //OPENCV_FLANN_GROUND_TRUTH_H_ diff --git a/opencv/include/opencv2/flann/hdf5.h b/opencv/include/opencv2/flann/hdf5.h deleted file mode 100644 index 80d23b9..0000000 --- a/opencv/include/opencv2/flann/hdf5.h +++ /dev/null @@ -1,231 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - - -#ifndef OPENCV_FLANN_HDF5_H_ -#define OPENCV_FLANN_HDF5_H_ - -#include - -#include "matrix.h" - - -namespace cvflann -{ - -namespace -{ - -template -hid_t get_hdf5_type() -{ - throw FLANNException("Unsupported type for IO operations"); -} - -template<> -hid_t get_hdf5_type() { return H5T_NATIVE_CHAR; } -template<> -hid_t get_hdf5_type() { return H5T_NATIVE_UCHAR; } -template<> -hid_t get_hdf5_type() { return H5T_NATIVE_SHORT; } -template<> -hid_t get_hdf5_type() { return H5T_NATIVE_USHORT; } -template<> -hid_t get_hdf5_type() { return H5T_NATIVE_INT; } -template<> -hid_t get_hdf5_type() { return H5T_NATIVE_UINT; } -template<> -hid_t get_hdf5_type() { return H5T_NATIVE_LONG; } -template<> -hid_t get_hdf5_type() { return H5T_NATIVE_ULONG; } -template<> -hid_t get_hdf5_type() { return H5T_NATIVE_FLOAT; } -template<> -hid_t get_hdf5_type() { return H5T_NATIVE_DOUBLE; } -} - - -#define CHECK_ERROR(x,y) if ((x)<0) throw FLANNException((y)); - -template -void save_to_file(const cvflann::Matrix& dataset, const String& filename, const String& name) -{ - -#if H5Eset_auto_vers == 2 - H5Eset_auto( H5E_DEFAULT, NULL, NULL ); -#else - H5Eset_auto( NULL, NULL ); -#endif - - herr_t status; - hid_t file_id; - file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, H5P_DEFAULT); - if (file_id < 0) { - file_id = H5Fcreate(filename.c_str(), H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT); - } - CHECK_ERROR(file_id,"Error creating hdf5 file."); - - hsize_t dimsf[2]; // dataset dimensions - dimsf[0] = dataset.rows; - dimsf[1] = dataset.cols; - - hid_t space_id = H5Screate_simple(2, dimsf, NULL); - hid_t memspace_id = H5Screate_simple(2, dimsf, NULL); - - hid_t dataset_id; -#if H5Dcreate_vers == 2 - dataset_id = H5Dcreate2(file_id, name.c_str(), get_hdf5_type(), space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); -#else - dataset_id = H5Dcreate(file_id, name.c_str(), get_hdf5_type(), space_id, H5P_DEFAULT); -#endif - - if (dataset_id<0) { -#if H5Dopen_vers == 2 - dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT); -#else - dataset_id = H5Dopen(file_id, name.c_str()); -#endif - } - CHECK_ERROR(dataset_id,"Error creating or opening dataset in file."); - - status = H5Dwrite(dataset_id, get_hdf5_type(), memspace_id, space_id, H5P_DEFAULT, dataset.data ); - CHECK_ERROR(status, "Error writing to dataset"); - - H5Sclose(memspace_id); - H5Sclose(space_id); - H5Dclose(dataset_id); - H5Fclose(file_id); - -} - - -template -void load_from_file(cvflann::Matrix& dataset, const String& filename, const String& name) -{ - herr_t status; - hid_t file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_ERROR(file_id,"Error opening hdf5 file."); - - hid_t dataset_id; -#if H5Dopen_vers == 2 - dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT); -#else - dataset_id = H5Dopen(file_id, name.c_str()); -#endif - CHECK_ERROR(dataset_id,"Error opening dataset in file."); - - hid_t space_id = H5Dget_space(dataset_id); - - hsize_t dims_out[2]; - H5Sget_simple_extent_dims(space_id, dims_out, NULL); - - dataset = cvflann::Matrix(new T[dims_out[0]*dims_out[1]], dims_out[0], dims_out[1]); - - status = H5Dread(dataset_id, get_hdf5_type(), H5S_ALL, H5S_ALL, H5P_DEFAULT, dataset[0]); - CHECK_ERROR(status, "Error reading dataset"); - - H5Sclose(space_id); - H5Dclose(dataset_id); - H5Fclose(file_id); -} - - -#ifdef HAVE_MPI - -namespace mpi -{ -/** - * Loads a the hyperslice corresponding to this processor from a hdf5 file. - * @param flann_dataset Dataset where the data is loaded - * @param filename HDF5 file name - * @param name Name of dataset inside file - */ -template -void load_from_file(cvflann::Matrix& dataset, const String& filename, const String& name) -{ - MPI_Comm comm = MPI_COMM_WORLD; - MPI_Info info = MPI_INFO_NULL; - - int mpi_size, mpi_rank; - MPI_Comm_size(comm, &mpi_size); - MPI_Comm_rank(comm, &mpi_rank); - - herr_t status; - - hid_t plist_id = H5Pcreate(H5P_FILE_ACCESS); - H5Pset_fapl_mpio(plist_id, comm, info); - hid_t file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, plist_id); - CHECK_ERROR(file_id,"Error opening hdf5 file."); - H5Pclose(plist_id); - hid_t dataset_id; -#if H5Dopen_vers == 2 - dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT); -#else - dataset_id = H5Dopen(file_id, name.c_str()); -#endif - CHECK_ERROR(dataset_id,"Error opening dataset in file."); - - hid_t space_id = H5Dget_space(dataset_id); - hsize_t dims[2]; - H5Sget_simple_extent_dims(space_id, dims, NULL); - - hsize_t count[2]; - hsize_t offset[2]; - - hsize_t item_cnt = dims[0]/mpi_size+(dims[0]%mpi_size==0 ? 0 : 1); - hsize_t cnt = (mpi_rank(), memspace_id, space_id, plist_id, dataset.data); - CHECK_ERROR(status, "Error reading dataset"); - - H5Pclose(plist_id); - H5Sclose(space_id); - H5Sclose(memspace_id); - H5Dclose(dataset_id); - H5Fclose(file_id); -} -} -#endif // HAVE_MPI -} // namespace cvflann::mpi - -#endif /* OPENCV_FLANN_HDF5_H_ */ diff --git a/opencv/include/opencv2/flann/heap.h b/opencv/include/opencv2/flann/heap.h deleted file mode 100644 index 92a6ea6..0000000 --- a/opencv/include/opencv2/flann/heap.h +++ /dev/null @@ -1,165 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_HEAP_H_ -#define OPENCV_FLANN_HEAP_H_ - -#include -#include - -namespace cvflann -{ - -/** - * Priority Queue Implementation - * - * The priority queue is implemented with a heap. A heap is a complete - * (full) binary tree in which each parent is less than both of its - * children, but the order of the children is unspecified. - */ -template -class Heap -{ - - /** - * Storage array for the heap. - * Type T must be comparable. - */ - std::vector heap; - int length; - - /** - * Number of element in the heap - */ - int count; - - - -public: - /** - * Constructor. - * - * Params: - * sz = heap size - */ - - Heap(int sz) - { - length = sz; - heap.reserve(length); - count = 0; - } - - /** - * - * Returns: heap size - */ - int size() - { - return count; - } - - /** - * Tests if the heap is empty - * - * Returns: true is heap empty, false otherwise - */ - bool empty() - { - return size()==0; - } - - /** - * Clears the heap. - */ - void clear() - { - heap.clear(); - count = 0; - } - - struct CompareT - { - bool operator()(const T& t_1, const T& t_2) const - { - return t_2 < t_1; - } - }; - - /** - * Insert a new element in the heap. - * - * We select the next empty leaf node, and then keep moving any larger - * parents down until the right location is found to store this element. - * - * Params: - * value = the new element to be inserted in the heap - */ - void insert(T value) - { - /* If heap is full, then return without adding this element. */ - if (count == length) { - return; - } - - heap.push_back(value); - static CompareT compareT; - std::push_heap(heap.begin(), heap.end(), compareT); - ++count; - } - - - - /** - * Returns the node of minimum value from the heap (top of the heap). - * - * Params: - * value = out parameter used to return the min element - * Returns: false if heap empty - */ - bool popMin(T& value) - { - if (count == 0) { - return false; - } - - value = heap[0]; - static CompareT compareT; - std::pop_heap(heap.begin(), heap.end(), compareT); - heap.pop_back(); - --count; - - return true; /* Return old last node. */ - } -}; - -} - -#endif //OPENCV_FLANN_HEAP_H_ diff --git a/opencv/include/opencv2/flann/hierarchical_clustering_index.h b/opencv/include/opencv2/flann/hierarchical_clustering_index.h deleted file mode 100644 index 2a947da..0000000 --- a/opencv/include/opencv2/flann/hierarchical_clustering_index.h +++ /dev/null @@ -1,848 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2011 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2011 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_HIERARCHICAL_CLUSTERING_INDEX_H_ -#define OPENCV_FLANN_HIERARCHICAL_CLUSTERING_INDEX_H_ - -#include -#include -#include -#include -#include - -#include "general.h" -#include "nn_index.h" -#include "dist.h" -#include "matrix.h" -#include "result_set.h" -#include "heap.h" -#include "allocator.h" -#include "random.h" -#include "saving.h" - - -namespace cvflann -{ - -struct HierarchicalClusteringIndexParams : public IndexParams -{ - HierarchicalClusteringIndexParams(int branching = 32, - flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM, - int trees = 4, int leaf_size = 100) - { - (*this)["algorithm"] = FLANN_INDEX_HIERARCHICAL; - // The branching factor used in the hierarchical clustering - (*this)["branching"] = branching; - // Algorithm used for picking the initial cluster centers - (*this)["centers_init"] = centers_init; - // number of parallel trees to build - (*this)["trees"] = trees; - // maximum leaf size - (*this)["leaf_size"] = leaf_size; - } -}; - - -/** - * Hierarchical index - * - * Contains a tree constructed through a hierarchical clustering - * and other information for indexing a set of points for nearest-neighbour matching. - */ -template -class HierarchicalClusteringIndex : public NNIndex -{ -public: - typedef typename Distance::ElementType ElementType; - typedef typename Distance::ResultType DistanceType; - -private: - - - typedef void (HierarchicalClusteringIndex::* centersAlgFunction)(int, int*, int, int*, int&); - - /** - * The function used for choosing the cluster centers. - */ - centersAlgFunction chooseCenters; - - - - /** - * Chooses the initial centers in the k-means clustering in a random manner. - * - * Params: - * k = number of centers - * vecs = the dataset of points - * indices = indices in the dataset - * indices_length = length of indices vector - * - */ - void chooseCentersRandom(int k, int* dsindices, int indices_length, int* centers, int& centers_length) - { - UniqueRandom r(indices_length); - - int index; - for (index=0; index=0 && rnd < n); - - centers[0] = dsindices[rnd]; - - int index; - for (index=1; indexbest_val) { - best_val = dist; - best_index = j; - } - } - if (best_index!=-1) { - centers[index] = dsindices[best_index]; - } - else { - break; - } - } - centers_length = index; - } - - - /** - * Chooses the initial centers in the k-means using the algorithm - * proposed in the KMeans++ paper: - * Arthur, David; Vassilvitskii, Sergei - k-means++: The Advantages of Careful Seeding - * - * Implementation of this function was converted from the one provided in Arthur's code. - * - * Params: - * k = number of centers - * vecs = the dataset of points - * indices = indices in the dataset - * Returns: - */ - void chooseCentersKMeanspp(int k, int* dsindices, int indices_length, int* centers, int& centers_length) - { - int n = indices_length; - - double currentPot = 0; - DistanceType* closestDistSq = new DistanceType[n]; - - // Choose one random center and set the closestDistSq values - int index = rand_int(n); - assert(index >=0 && index < n); - centers[0] = dsindices[index]; - - // Computing distance^2 will have the advantage of even higher probability further to pick new centers - // far from previous centers (and this complies to "k-means++: the advantages of careful seeding" article) - for (int i = 0; i < n; i++) { - closestDistSq[i] = distance(dataset[dsindices[i]], dataset[dsindices[index]], dataset.cols); - closestDistSq[i] = ensureSquareDistance( closestDistSq[i] ); - currentPot += closestDistSq[i]; - } - - - const int numLocalTries = 1; - - // Choose each center - int centerCount; - for (centerCount = 1; centerCount < k; centerCount++) { - - // Repeat several trials - double bestNewPot = -1; - int bestNewIndex = 0; - for (int localTrial = 0; localTrial < numLocalTries; localTrial++) { - - // Choose our center - have to be slightly careful to return a valid answer even accounting - // for possible rounding errors - double randVal = rand_double(currentPot); - for (index = 0; index < n-1; index++) { - if (randVal <= closestDistSq[index]) break; - else randVal -= closestDistSq[index]; - } - - // Compute the new potential - double newPot = 0; - for (int i = 0; i < n; i++) { - DistanceType dist = distance(dataset[dsindices[i]], dataset[dsindices[index]], dataset.cols); - newPot += std::min( ensureSquareDistance(dist), closestDistSq[i] ); - } - - // Store the best result - if ((bestNewPot < 0)||(newPot < bestNewPot)) { - bestNewPot = newPot; - bestNewIndex = index; - } - } - - // Add the appropriate center - centers[centerCount] = dsindices[bestNewIndex]; - currentPot = bestNewPot; - for (int i = 0; i < n; i++) { - DistanceType dist = distance(dataset[dsindices[i]], dataset[dsindices[bestNewIndex]], dataset.cols); - closestDistSq[i] = std::min( ensureSquareDistance(dist), closestDistSq[i] ); - } - } - - centers_length = centerCount; - - delete[] closestDistSq; - } - - - /** - * Chooses the initial centers in a way inspired by Gonzales (by Pierre-Emmanuel Viel): - * select the first point of the list as a candidate, then parse the points list. If another - * point is further than current candidate from the other centers, test if it is a good center - * of a local aggregation. If it is, replace current candidate by this point. And so on... - * - * Used with KMeansIndex that computes centers coordinates by averaging positions of clusters points, - * this doesn't make a real difference with previous methods. But used with HierarchicalClusteringIndex - * class that pick centers among existing points instead of computing the barycenters, there is a real - * improvement. - * - * Params: - * k = number of centers - * vecs = the dataset of points - * indices = indices in the dataset - * Returns: - */ - void GroupWiseCenterChooser(int k, int* dsindices, int indices_length, int* centers, int& centers_length) - { - const float kSpeedUpFactor = 1.3f; - - int n = indices_length; - - DistanceType* closestDistSq = new DistanceType[n]; - - // Choose one random center and set the closestDistSq values - int index = rand_int(n); - assert(index >=0 && index < n); - centers[0] = dsindices[index]; - - for (int i = 0; i < n; i++) { - closestDistSq[i] = distance(dataset[dsindices[i]], dataset[dsindices[index]], dataset.cols); - } - - - // Choose each center - int centerCount; - for (centerCount = 1; centerCount < k; centerCount++) { - - // Repeat several trials - double bestNewPot = -1; - int bestNewIndex = 0; - DistanceType furthest = 0; - for (index = 0; index < n; index++) { - - // We will test only the potential of the points further than current candidate - if( closestDistSq[index] > kSpeedUpFactor * (float)furthest ) { - - // Compute the new potential - double newPot = 0; - for (int i = 0; i < n; i++) { - newPot += std::min( distance(dataset[dsindices[i]], dataset[dsindices[index]], dataset.cols) - , closestDistSq[i] ); - } - - // Store the best result - if ((bestNewPot < 0)||(newPot <= bestNewPot)) { - bestNewPot = newPot; - bestNewIndex = index; - furthest = closestDistSq[index]; - } - } - } - - // Add the appropriate center - centers[centerCount] = dsindices[bestNewIndex]; - for (int i = 0; i < n; i++) { - closestDistSq[i] = std::min( distance(dataset[dsindices[i]], dataset[dsindices[bestNewIndex]], dataset.cols) - , closestDistSq[i] ); - } - } - - centers_length = centerCount; - - delete[] closestDistSq; - } - - -public: - - - /** - * Index constructor - * - * Params: - * inputData = dataset with the input features - * params = parameters passed to the hierarchical k-means algorithm - */ - HierarchicalClusteringIndex(const Matrix& inputData, const IndexParams& index_params = HierarchicalClusteringIndexParams(), - Distance d = Distance()) - : dataset(inputData), params(index_params), root(NULL), indices(NULL), distance(d) - { - memoryCounter = 0; - - size_ = dataset.rows; - veclen_ = dataset.cols; - - branching_ = get_param(params,"branching",32); - centers_init_ = get_param(params,"centers_init", FLANN_CENTERS_RANDOM); - trees_ = get_param(params,"trees",4); - leaf_size_ = get_param(params,"leaf_size",100); - - if (centers_init_==FLANN_CENTERS_RANDOM) { - chooseCenters = &HierarchicalClusteringIndex::chooseCentersRandom; - } - else if (centers_init_==FLANN_CENTERS_GONZALES) { - chooseCenters = &HierarchicalClusteringIndex::chooseCentersGonzales; - } - else if (centers_init_==FLANN_CENTERS_KMEANSPP) { - chooseCenters = &HierarchicalClusteringIndex::chooseCentersKMeanspp; - } - else if (centers_init_==FLANN_CENTERS_GROUPWISE) { - chooseCenters = &HierarchicalClusteringIndex::GroupWiseCenterChooser; - } - else { - throw FLANNException("Unknown algorithm for choosing initial centers."); - } - - trees_ = get_param(params,"trees",4); - root = new NodePtr[trees_]; - indices = new int*[trees_]; - - for (int i=0; i(); - computeClustering(root[i], indices[i], (int)size_, branching_,0); - } - } - - - flann_algorithm_t getType() const CV_OVERRIDE - { - return FLANN_INDEX_HIERARCHICAL; - } - - - void saveIndex(FILE* stream) CV_OVERRIDE - { - save_value(stream, branching_); - save_value(stream, trees_); - save_value(stream, centers_init_); - save_value(stream, leaf_size_); - save_value(stream, memoryCounter); - for (int i=0; i& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE - { - - int maxChecks = get_param(searchParams,"checks",32); - - // Priority queue storing intermediate branches in the best-bin-first search - Heap* heap = new Heap((int)size_); - - std::vector checked(size_,false); - int checks = 0; - for (int i=0; ipopMin(branch) && (checks BranchSt; - - - - void save_tree(FILE* stream, NodePtr node, int num) - { - save_value(stream, *node); - if (node->childs==NULL) { - int indices_offset = (int)(node->indices - indices[num]); - save_value(stream, indices_offset); - } - else { - for(int i=0; ichilds[i], num); - } - } - } - - - void load_tree(FILE* stream, NodePtr& node, int num) - { - node = pool.allocate(); - load_value(stream, *node); - if (node->childs==NULL) { - int indices_offset; - load_value(stream, indices_offset); - node->indices = indices[num] + indices_offset; - } - else { - node->childs = pool.allocate(branching_); - for(int i=0; ichilds[i], num); - } - } - } - - - - - void computeLabels(int* dsindices, int indices_length, int* centers, int centers_length, int* labels, DistanceType& cost) - { - cost = 0; - for (int i=0; inew_dist) { - labels[i] = j; - dist = new_dist; - } - } - cost += dist; - } - } - - /** - * The method responsible with actually doing the recursive hierarchical - * clustering - * - * Params: - * node = the node to cluster - * indices = indices of the points belonging to the current node - * branching = the branching factor to use in the clustering - * - * TODO: for 1-sized clusters don't store a cluster center (it's the same as the single cluster point) - */ - void computeClustering(NodePtr node, int* dsindices, int indices_length, int branching, int level) - { - node->size = indices_length; - node->level = level; - - if (indices_length < leaf_size_) { // leaf node - node->indices = dsindices; - std::sort(node->indices,node->indices+indices_length); - node->childs = NULL; - return; - } - - std::vector centers(branching); - std::vector labels(indices_length); - - int centers_length; - (this->*chooseCenters)(branching, dsindices, indices_length, ¢ers[0], centers_length); - - if (centers_lengthindices = dsindices; - std::sort(node->indices,node->indices+indices_length); - node->childs = NULL; - return; - } - - - // assign points to clusters - DistanceType cost; - computeLabels(dsindices, indices_length, ¢ers[0], centers_length, &labels[0], cost); - - node->childs = pool.allocate(branching); - int start = 0; - int end = start; - for (int i=0; ichilds[i] = pool.allocate(); - node->childs[i]->pivot = centers[i]; - node->childs[i]->indices = NULL; - computeClustering(node->childs[i],dsindices+start, end-start, branching, level+1); - start=end; - } - } - - - - /** - * Performs one descent in the hierarchical k-means tree. The branches not - * visited are stored in a priority queue. - * - * Params: - * node = node to explore - * result = container for the k-nearest neighbors found - * vec = query points - * checks = how many points in the dataset have been checked so far - * maxChecks = maximum dataset points to checks - */ - - - void findNN(NodePtr node, ResultSet& result, const ElementType* vec, int& checks, int maxChecks, - Heap* heap, std::vector& checked) - { - if (node->childs==NULL) { - if (checks>=maxChecks) { - if (result.full()) return; - } - for (int i=0; isize; ++i) { - int index = node->indices[i]; - if (!checked[index]) { - DistanceType dist = distance(dataset[index], vec, veclen_); - result.addPoint(dist, index); - checked[index] = true; - ++checks; - } - } - } - else { - DistanceType* domain_distances = new DistanceType[branching_]; - int best_index = 0; - domain_distances[best_index] = distance(vec, dataset[node->childs[best_index]->pivot], veclen_); - for (int i=1; ichilds[i]->pivot], veclen_); - if (domain_distances[i]insert(BranchSt(node->childs[i],domain_distances[i])); - } - } - delete[] domain_distances; - findNN(node->childs[best_index],result,vec, checks, maxChecks, heap, checked); - } - } - -private: - - - /** - * The dataset used by this index - */ - const Matrix dataset; - - /** - * Parameters used by this index - */ - IndexParams params; - - - /** - * Number of features in the dataset. - */ - size_t size_; - - /** - * Length of each feature. - */ - size_t veclen_; - - /** - * The root node in the tree. - */ - NodePtr* root; - - /** - * Array of indices to vectors in the dataset. - */ - int** indices; - - - /** - * The distance - */ - Distance distance; - - /** - * Pooled memory allocator. - * - * Using a pooled memory allocator is more efficient - * than allocating memory directly when there is a large - * number small of memory allocations. - */ - PooledAllocator pool; - - /** - * Memory occupied by the index. - */ - int memoryCounter; - - /** index parameters */ - int branching_; - int trees_; - flann_centers_init_t centers_init_; - int leaf_size_; - - -}; - -} - -#endif /* OPENCV_FLANN_HIERARCHICAL_CLUSTERING_INDEX_H_ */ diff --git a/opencv/include/opencv2/flann/index_testing.h b/opencv/include/opencv2/flann/index_testing.h deleted file mode 100644 index d764004..0000000 --- a/opencv/include/opencv2/flann/index_testing.h +++ /dev/null @@ -1,318 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_INDEX_TESTING_H_ -#define OPENCV_FLANN_INDEX_TESTING_H_ - -#include -#include -#include - -#include "matrix.h" -#include "nn_index.h" -#include "result_set.h" -#include "logger.h" -#include "timer.h" - - -namespace cvflann -{ - -inline int countCorrectMatches(int* neighbors, int* groundTruth, int n) -{ - int count = 0; - for (int i=0; i -typename Distance::ResultType computeDistanceRaport(const Matrix& inputData, typename Distance::ElementType* target, - int* neighbors, int* groundTruth, int veclen, int n, const Distance& distance) -{ - typedef typename Distance::ResultType DistanceType; - - DistanceType ret = 0; - for (int i=0; i -float search_with_ground_truth(NNIndex& index, const Matrix& inputData, - const Matrix& testData, const Matrix& matches, int nn, int checks, - float& time, typename Distance::ResultType& dist, const Distance& distance, int skipMatches) -{ - typedef typename Distance::ResultType DistanceType; - - if (matches.cols resultSet(nn+skipMatches); - SearchParams searchParams(checks); - - std::vector indices(nn+skipMatches); - std::vector dists(nn+skipMatches); - int* neighbors = &indices[skipMatches]; - - int correct = 0; - DistanceType distR = 0; - StartStopTimer t; - int repeats = 0; - while (t.value<0.2) { - repeats++; - t.start(); - correct = 0; - distR = 0; - for (size_t i = 0; i < testData.rows; i++) { - resultSet.init(&indices[0], &dists[0]); - index.findNeighbors(resultSet, testData[i], searchParams); - - correct += countCorrectMatches(neighbors,matches[i], nn); - distR += computeDistanceRaport(inputData, testData[i], neighbors, matches[i], (int)testData.cols, nn, distance); - } - t.stop(); - } - time = float(t.value/repeats); - - float precicion = (float)correct/(nn*testData.rows); - - dist = distR/(testData.rows*nn); - - Logger::info("%8d %10.4g %10.5g %10.5g %10.5g\n", - checks, precicion, time, 1000.0 * time / testData.rows, dist); - - return precicion; -} - - -template -float test_index_checks(NNIndex& index, const Matrix& inputData, - const Matrix& testData, const Matrix& matches, - int checks, float& precision, const Distance& distance, int nn = 1, int skipMatches = 0) -{ - typedef typename Distance::ResultType DistanceType; - - Logger::info(" Nodes Precision(%) Time(s) Time/vec(ms) Mean dist\n"); - Logger::info("---------------------------------------------------------\n"); - - float time = 0; - DistanceType dist = 0; - precision = search_with_ground_truth(index, inputData, testData, matches, nn, checks, time, dist, distance, skipMatches); - - return time; -} - -template -float test_index_precision(NNIndex& index, const Matrix& inputData, - const Matrix& testData, const Matrix& matches, - float precision, int& checks, const Distance& distance, int nn = 1, int skipMatches = 0) -{ - typedef typename Distance::ResultType DistanceType; - const float SEARCH_EPS = 0.001f; - - Logger::info(" Nodes Precision(%) Time(s) Time/vec(ms) Mean dist\n"); - Logger::info("---------------------------------------------------------\n"); - - int c2 = 1; - float p2; - int c1 = 1; - //float p1; - float time; - DistanceType dist; - - p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches); - - if (p2>precision) { - Logger::info("Got as close as I can\n"); - checks = c2; - return time; - } - - while (p2SEARCH_EPS) { - Logger::info("Start linear estimation\n"); - // after we got to values in the vecinity of the desired precision - // use linear approximation get a better estimation - - cx = (c1+c2)/2; - realPrecision = search_with_ground_truth(index, inputData, testData, matches, nn, cx, time, dist, distance, skipMatches); - while (fabs(realPrecision-precision)>SEARCH_EPS) { - - if (realPrecision -void test_index_precisions(NNIndex& index, const Matrix& inputData, - const Matrix& testData, const Matrix& matches, - float* precisions, int precisions_length, const Distance& distance, int nn = 1, int skipMatches = 0, float maxTime = 0) -{ - typedef typename Distance::ResultType DistanceType; - - const float SEARCH_EPS = 0.001; - - // make sure precisions array is sorted - std::sort(precisions, precisions+precisions_length); - - int pindex = 0; - float precision = precisions[pindex]; - - Logger::info(" Nodes Precision(%) Time(s) Time/vec(ms) Mean dist\n"); - Logger::info("---------------------------------------------------------\n"); - - int c2 = 1; - float p2; - - int c1 = 1; - float p1; - - float time; - DistanceType dist; - - p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches); - - // if precision for 1 run down the tree is already - // better then some of the requested precisions, then - // skip those - while (precisions[pindex] 0)&&(time > maxTime)&&(p2SEARCH_EPS) { - Logger::info("Start linear estimation\n"); - // after we got to values in the vecinity of the desired precision - // use linear approximation get a better estimation - - cx = (c1+c2)/2; - realPrecision = search_with_ground_truth(index, inputData, testData, matches, nn, cx, time, dist, distance, skipMatches); - while (fabs(realPrecision-precision)>SEARCH_EPS) { - - if (realPrecision -#include -#include -#include - -#include "general.h" -#include "nn_index.h" -#include "dynamic_bitset.h" -#include "matrix.h" -#include "result_set.h" -#include "heap.h" -#include "allocator.h" -#include "random.h" -#include "saving.h" - - -namespace cvflann -{ - -struct KDTreeIndexParams : public IndexParams -{ - KDTreeIndexParams(int trees = 4) - { - (*this)["algorithm"] = FLANN_INDEX_KDTREE; - (*this)["trees"] = trees; - } -}; - - -/** - * Randomized kd-tree index - * - * Contains the k-d trees and other information for indexing a set of points - * for nearest-neighbor matching. - */ -template -class KDTreeIndex : public NNIndex -{ -public: - typedef typename Distance::ElementType ElementType; - typedef typename Distance::ResultType DistanceType; - - - /** - * KDTree constructor - * - * Params: - * inputData = dataset with the input features - * params = parameters passed to the kdtree algorithm - */ - KDTreeIndex(const Matrix& inputData, const IndexParams& params = KDTreeIndexParams(), - Distance d = Distance() ) : - dataset_(inputData), index_params_(params), distance_(d) - { - size_ = dataset_.rows; - veclen_ = dataset_.cols; - - trees_ = get_param(index_params_,"trees",4); - tree_roots_ = new NodePtr[trees_]; - - // Create a permutable array of indices to the input vectors. - vind_.resize(size_); - for (size_t i = 0; i < size_; ++i) { - vind_[i] = int(i); - } - - mean_ = new DistanceType[veclen_]; - var_ = new DistanceType[veclen_]; - } - - - KDTreeIndex(const KDTreeIndex&); - KDTreeIndex& operator=(const KDTreeIndex&); - - /** - * Standard destructor - */ - ~KDTreeIndex() - { - if (tree_roots_!=NULL) { - delete[] tree_roots_; - } - delete[] mean_; - delete[] var_; - } - - /** - * Builds the index - */ - void buildIndex() CV_OVERRIDE - { - /* Construct the randomized trees. */ - for (int i = 0; i < trees_; i++) { - /* Randomize the order of vectors to allow for unbiased sampling. */ -#ifndef OPENCV_FLANN_USE_STD_RAND - cv::randShuffle(vind_); -#else - std::random_shuffle(vind_.begin(), vind_.end()); -#endif - - tree_roots_[i] = divideTree(&vind_[0], int(size_) ); - } - } - - - flann_algorithm_t getType() const CV_OVERRIDE - { - return FLANN_INDEX_KDTREE; - } - - - void saveIndex(FILE* stream) CV_OVERRIDE - { - save_value(stream, trees_); - for (int i=0; i& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE - { - int maxChecks = get_param(searchParams,"checks", 32); - float epsError = 1+get_param(searchParams,"eps",0.0f); - - if (maxChecks==FLANN_CHECKS_UNLIMITED) { - getExactNeighbors(result, vec, epsError); - } - else { - getNeighbors(result, vec, maxChecks, epsError); - } - } - - IndexParams getParameters() const CV_OVERRIDE - { - return index_params_; - } - -private: - - - /*--------------------- Internal Data Structures --------------------------*/ - struct Node - { - /** - * Dimension used for subdivision. - */ - int divfeat; - /** - * The values used for subdivision. - */ - DistanceType divval; - /** - * The child nodes. - */ - Node* child1, * child2; - }; - typedef Node* NodePtr; - typedef BranchStruct BranchSt; - typedef BranchSt* Branch; - - - - void save_tree(FILE* stream, NodePtr tree) - { - save_value(stream, *tree); - if (tree->child1!=NULL) { - save_tree(stream, tree->child1); - } - if (tree->child2!=NULL) { - save_tree(stream, tree->child2); - } - } - - - void load_tree(FILE* stream, NodePtr& tree) - { - tree = pool_.allocate(); - load_value(stream, *tree); - if (tree->child1!=NULL) { - load_tree(stream, tree->child1); - } - if (tree->child2!=NULL) { - load_tree(stream, tree->child2); - } - } - - - /** - * Create a tree node that subdivides the list of vecs from vind[first] - * to vind[last]. The routine is called recursively on each sublist. - * Place a pointer to this new tree node in the location pTree. - * - * Params: pTree = the new node to create - * first = index of the first vector - * last = index of the last vector - */ - NodePtr divideTree(int* ind, int count) - { - NodePtr node = pool_.allocate(); // allocate memory - - /* If too few exemplars remain, then make this a leaf node. */ - if ( count == 1) { - node->child1 = node->child2 = NULL; /* Mark as leaf node. */ - node->divfeat = *ind; /* Store index of this vec. */ - } - else { - int idx; - int cutfeat; - DistanceType cutval; - meanSplit(ind, count, idx, cutfeat, cutval); - - node->divfeat = cutfeat; - node->divval = cutval; - node->child1 = divideTree(ind, idx); - node->child2 = divideTree(ind+idx, count-idx); - } - - return node; - } - - - /** - * Choose which feature to use in order to subdivide this set of vectors. - * Make a random choice among those with the highest variance, and use - * its variance as the threshold value. - */ - void meanSplit(int* ind, int count, int& index, int& cutfeat, DistanceType& cutval) - { - memset(mean_,0,veclen_*sizeof(DistanceType)); - memset(var_,0,veclen_*sizeof(DistanceType)); - - /* Compute mean values. Only the first SAMPLE_MEAN values need to be - sampled to get a good estimate. - */ - int cnt = std::min((int)SAMPLE_MEAN+1, count); - for (int j = 0; j < cnt; ++j) { - ElementType* v = dataset_[ind[j]]; - for (size_t k=0; kcount/2) index = lim1; - else if (lim2 v[topind[num-1]])) { - /* Put this element at end of topind. */ - if (num < RAND_DIM) { - topind[num++] = i; /* Add to list. */ - } - else { - topind[num-1] = i; /* Replace last element. */ - } - /* Bubble end value down to right location by repeated swapping. */ - int j = num - 1; - while (j > 0 && v[topind[j]] > v[topind[j-1]]) { - std::swap(topind[j], topind[j-1]); - --j; - } - } - } - /* Select a random integer in range [0,num-1], and return that index. */ - int rnd = rand_int(num); - return (int)topind[rnd]; - } - - - /** - * Subdivide the list of points by a plane perpendicular on axe corresponding - * to the 'cutfeat' dimension at 'cutval' position. - * - * On return: - * dataset[ind[0..lim1-1]][cutfeat]cutval - */ - void planeSplit(int* ind, int count, int cutfeat, DistanceType cutval, int& lim1, int& lim2) - { - /* Move vector indices for left subtree to front of list. */ - int left = 0; - int right = count-1; - for (;; ) { - while (left<=right && dataset_[ind[left]][cutfeat]=cutval) --right; - if (left>right) break; - std::swap(ind[left], ind[right]); ++left; --right; - } - lim1 = left; - right = count-1; - for (;; ) { - while (left<=right && dataset_[ind[left]][cutfeat]<=cutval) ++left; - while (left<=right && dataset_[ind[right]][cutfeat]>cutval) --right; - if (left>right) break; - std::swap(ind[left], ind[right]); ++left; --right; - } - lim2 = left; - } - - /** - * Performs an exact nearest neighbor search. The exact search performs a full - * traversal of the tree. - */ - void getExactNeighbors(ResultSet& result, const ElementType* vec, float epsError) - { - // checkID -= 1; /* Set a different unique ID for each search. */ - - if (trees_ > 1) { - fprintf(stderr,"It doesn't make any sense to use more than one tree for exact search"); - } - if (trees_>0) { - searchLevelExact(result, vec, tree_roots_[0], 0.0, epsError); - } - assert(result.full()); - } - - /** - * Performs the approximate nearest-neighbor search. The search is approximate - * because the tree traversal is abandoned after a given number of descends in - * the tree. - */ - void getNeighbors(ResultSet& result, const ElementType* vec, int maxCheck, float epsError) - { - int i; - BranchSt branch; - - int checkCount = 0; - Heap* heap = new Heap((int)size_); - DynamicBitset checked(size_); - - /* Search once through each tree down to root. */ - for (i = 0; i < trees_; ++i) { - searchLevel(result, vec, tree_roots_[i], 0, checkCount, maxCheck, epsError, heap, checked); - } - - /* Keep searching other branches from heap until finished. */ - while ( heap->popMin(branch) && (checkCount < maxCheck || !result.full() )) { - searchLevel(result, vec, branch.node, branch.mindist, checkCount, maxCheck, epsError, heap, checked); - } - - delete heap; - - assert(result.full()); - } - - - /** - * Search starting from a given node of the tree. Based on any mismatches at - * higher levels, all exemplars below this level must have a distance of - * at least "mindistsq". - */ - void searchLevel(ResultSet& result_set, const ElementType* vec, NodePtr node, DistanceType mindist, int& checkCount, int maxCheck, - float epsError, Heap* heap, DynamicBitset& checked) - { - if (result_set.worstDist()child1 == NULL)&&(node->child2 == NULL)) { - /* Do not check same node more than once when searching multiple trees. - Once a vector is checked, we set its location in vind to the - current checkID. - */ - int index = node->divfeat; - if ( checked.test(index) || ((checkCount>=maxCheck)&& result_set.full()) ) return; - checked.set(index); - checkCount++; - - DistanceType dist = distance_(dataset_[index], vec, veclen_); - result_set.addPoint(dist,index); - - return; - } - - /* Which child branch should be taken first? */ - ElementType val = vec[node->divfeat]; - DistanceType diff = val - node->divval; - NodePtr bestChild = (diff < 0) ? node->child1 : node->child2; - NodePtr otherChild = (diff < 0) ? node->child2 : node->child1; - - /* Create a branch record for the branch not taken. Add distance - of this feature boundary (we don't attempt to correct for any - use of this feature in a parent node, which is unlikely to - happen and would have only a small effect). Don't bother - adding more branches to heap after halfway point, as cost of - adding exceeds their value. - */ - - DistanceType new_distsq = mindist + distance_.accum_dist(val, node->divval, node->divfeat); - // if (2 * checkCount < maxCheck || !result.full()) { - if ((new_distsq*epsError < result_set.worstDist())|| !result_set.full()) { - heap->insert( BranchSt(otherChild, new_distsq) ); - } - - /* Call recursively to search next level down. */ - searchLevel(result_set, vec, bestChild, mindist, checkCount, maxCheck, epsError, heap, checked); - } - - /** - * Performs an exact search in the tree starting from a node. - */ - void searchLevelExact(ResultSet& result_set, const ElementType* vec, const NodePtr node, DistanceType mindist, const float epsError) - { - /* If this is a leaf node, then do check and return. */ - if ((node->child1 == NULL)&&(node->child2 == NULL)) { - int index = node->divfeat; - DistanceType dist = distance_(dataset_[index], vec, veclen_); - result_set.addPoint(dist,index); - return; - } - - /* Which child branch should be taken first? */ - ElementType val = vec[node->divfeat]; - DistanceType diff = val - node->divval; - NodePtr bestChild = (diff < 0) ? node->child1 : node->child2; - NodePtr otherChild = (diff < 0) ? node->child2 : node->child1; - - /* Create a branch record for the branch not taken. Add distance - of this feature boundary (we don't attempt to correct for any - use of this feature in a parent node, which is unlikely to - happen and would have only a small effect). Don't bother - adding more branches to heap after halfway point, as cost of - adding exceeds their value. - */ - - DistanceType new_distsq = mindist + distance_.accum_dist(val, node->divval, node->divfeat); - - /* Call recursively to search next level down. */ - searchLevelExact(result_set, vec, bestChild, mindist, epsError); - - if (new_distsq*epsError<=result_set.worstDist()) { - searchLevelExact(result_set, vec, otherChild, new_distsq, epsError); - } - } - - -private: - - enum - { - /** - * To improve efficiency, only SAMPLE_MEAN random values are used to - * compute the mean and variance at each level when building a tree. - * A value of 100 seems to perform as well as using all values. - */ - SAMPLE_MEAN = 100, - /** - * Top random dimensions to consider - * - * When creating random trees, the dimension on which to subdivide is - * selected at random from among the top RAND_DIM dimensions with the - * highest variance. A value of 5 works well. - */ - RAND_DIM=5 - }; - - - /** - * Number of randomized trees that are used - */ - int trees_; - - /** - * Array of indices to vectors in the dataset. - */ - std::vector vind_; - - /** - * The dataset used by this index - */ - const Matrix dataset_; - - IndexParams index_params_; - - size_t size_; - size_t veclen_; - - - DistanceType* mean_; - DistanceType* var_; - - - /** - * Array of k-d trees used to find neighbours. - */ - NodePtr* tree_roots_; - - /** - * Pooled memory allocator. - * - * Using a pooled memory allocator is more efficient - * than allocating memory directly when there is a large - * number small of memory allocations. - */ - PooledAllocator pool_; - - Distance distance_; - - -}; // class KDTreeForest - -} - -#endif //OPENCV_FLANN_KDTREE_INDEX_H_ diff --git a/opencv/include/opencv2/flann/kdtree_single_index.h b/opencv/include/opencv2/flann/kdtree_single_index.h deleted file mode 100644 index 22a28d0..0000000 --- a/opencv/include/opencv2/flann/kdtree_single_index.h +++ /dev/null @@ -1,635 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_KDTREE_SINGLE_INDEX_H_ -#define OPENCV_FLANN_KDTREE_SINGLE_INDEX_H_ - -#include -#include -#include -#include - -#include "general.h" -#include "nn_index.h" -#include "matrix.h" -#include "result_set.h" -#include "heap.h" -#include "allocator.h" -#include "random.h" -#include "saving.h" - -namespace cvflann -{ - -struct KDTreeSingleIndexParams : public IndexParams -{ - KDTreeSingleIndexParams(int leaf_max_size = 10, bool reorder = true, int dim = -1) - { - (*this)["algorithm"] = FLANN_INDEX_KDTREE_SINGLE; - (*this)["leaf_max_size"] = leaf_max_size; - (*this)["reorder"] = reorder; - (*this)["dim"] = dim; - } -}; - - -/** - * Randomized kd-tree index - * - * Contains the k-d trees and other information for indexing a set of points - * for nearest-neighbor matching. - */ -template -class KDTreeSingleIndex : public NNIndex -{ -public: - typedef typename Distance::ElementType ElementType; - typedef typename Distance::ResultType DistanceType; - - - /** - * KDTree constructor - * - * Params: - * inputData = dataset with the input features - * params = parameters passed to the kdtree algorithm - */ - KDTreeSingleIndex(const Matrix& inputData, const IndexParams& params = KDTreeSingleIndexParams(), - Distance d = Distance() ) : - dataset_(inputData), index_params_(params), distance_(d) - { - size_ = dataset_.rows; - dim_ = dataset_.cols; - root_node_ = 0; - int dim_param = get_param(params,"dim",-1); - if (dim_param>0) dim_ = dim_param; - leaf_max_size_ = get_param(params,"leaf_max_size",10); - reorder_ = get_param(params,"reorder",true); - - // Create a permutable array of indices to the input vectors. - vind_.resize(size_); - for (size_t i = 0; i < size_; i++) { - vind_[i] = (int)i; - } - } - - KDTreeSingleIndex(const KDTreeSingleIndex&); - KDTreeSingleIndex& operator=(const KDTreeSingleIndex&); - - /** - * Standard destructor - */ - ~KDTreeSingleIndex() - { - if (reorder_) delete[] data_.data; - } - - /** - * Builds the index - */ - void buildIndex() CV_OVERRIDE - { - computeBoundingBox(root_bbox_); - root_node_ = divideTree(0, (int)size_, root_bbox_ ); // construct the tree - - if (reorder_) { - delete[] data_.data; - data_ = cvflann::Matrix(new ElementType[size_*dim_], size_, dim_); - for (size_t i=0; i& queries, Matrix& indices, Matrix& dists, int knn, const SearchParams& params) CV_OVERRIDE - { - assert(queries.cols == veclen()); - assert(indices.rows >= queries.rows); - assert(dists.rows >= queries.rows); - assert(int(indices.cols) >= knn); - assert(int(dists.cols) >= knn); - - KNNSimpleResultSet resultSet(knn); - for (size_t i = 0; i < queries.rows; i++) { - resultSet.init(indices[i], dists[i]); - findNeighbors(resultSet, queries[i], params); - } - } - - IndexParams getParameters() const CV_OVERRIDE - { - return index_params_; - } - - /** - * Find set of nearest neighbors to vec. Their indices are stored inside - * the result object. - * - * Params: - * result = the result object in which the indices of the nearest-neighbors are stored - * vec = the vector for which to search the nearest neighbors - * maxCheck = the maximum number of restarts (in a best-bin-first manner) - */ - void findNeighbors(ResultSet& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE - { - float epsError = 1+get_param(searchParams,"eps",0.0f); - - std::vector dists(dim_,0); - DistanceType distsq = computeInitialDistances(vec, dists); - searchLevel(result, vec, root_node_, distsq, dists, epsError); - } - -private: - - - /*--------------------- Internal Data Structures --------------------------*/ - struct Node - { - /** - * Indices of points in leaf node - */ - int left, right; - /** - * Dimension used for subdivision. - */ - int divfeat; - /** - * The values used for subdivision. - */ - DistanceType divlow, divhigh; - /** - * The child nodes. - */ - Node* child1, * child2; - }; - typedef Node* NodePtr; - - - struct Interval - { - DistanceType low, high; - }; - - typedef std::vector BoundingBox; - - typedef BranchStruct BranchSt; - typedef BranchSt* Branch; - - - - - void save_tree(FILE* stream, NodePtr tree) - { - save_value(stream, *tree); - if (tree->child1!=NULL) { - save_tree(stream, tree->child1); - } - if (tree->child2!=NULL) { - save_tree(stream, tree->child2); - } - } - - - void load_tree(FILE* stream, NodePtr& tree) - { - tree = pool_.allocate(); - load_value(stream, *tree); - if (tree->child1!=NULL) { - load_tree(stream, tree->child1); - } - if (tree->child2!=NULL) { - load_tree(stream, tree->child2); - } - } - - - void computeBoundingBox(BoundingBox& bbox) - { - bbox.resize(dim_); - for (size_t i=0; ibbox[i].high) bbox[i].high = (DistanceType)dataset_[k][i]; - } - } - } - - - /** - * Create a tree node that subdivides the list of vecs from vind[first] - * to vind[last]. The routine is called recursively on each sublist. - * Place a pointer to this new tree node in the location pTree. - * - * Params: pTree = the new node to create - * first = index of the first vector - * last = index of the last vector - */ - NodePtr divideTree(int left, int right, BoundingBox& bbox) - { - NodePtr node = pool_.allocate(); // allocate memory - - /* If too few exemplars remain, then make this a leaf node. */ - if ( (right-left) <= leaf_max_size_) { - node->child1 = node->child2 = NULL; /* Mark as leaf node. */ - node->left = left; - node->right = right; - - // compute bounding-box of leaf points - for (size_t i=0; idataset_[vind_[k]][i]) bbox[i].low=(DistanceType)dataset_[vind_[k]][i]; - if (bbox[i].highdivfeat = cutfeat; - - BoundingBox left_bbox(bbox); - left_bbox[cutfeat].high = cutval; - node->child1 = divideTree(left, left+idx, left_bbox); - - BoundingBox right_bbox(bbox); - right_bbox[cutfeat].low = cutval; - node->child2 = divideTree(left+idx, right, right_bbox); - - node->divlow = left_bbox[cutfeat].high; - node->divhigh = right_bbox[cutfeat].low; - - for (size_t i=0; imax_elem) max_elem = val; - } - } - - void middleSplit(int* ind, int count, int& index, int& cutfeat, DistanceType& cutval, const BoundingBox& bbox) - { - // find the largest span from the approximate bounding box - ElementType max_span = bbox[0].high-bbox[0].low; - cutfeat = 0; - cutval = (bbox[0].high+bbox[0].low)/2; - for (size_t i=1; imax_span) { - max_span = span; - cutfeat = i; - cutval = (bbox[i].high+bbox[i].low)/2; - } - } - - // compute exact span on the found dimension - ElementType min_elem, max_elem; - computeMinMax(ind, count, cutfeat, min_elem, max_elem); - cutval = (min_elem+max_elem)/2; - max_span = max_elem - min_elem; - - // check if a dimension of a largest span exists - size_t k = cutfeat; - for (size_t i=0; imax_span) { - computeMinMax(ind, count, i, min_elem, max_elem); - span = max_elem - min_elem; - if (span>max_span) { - max_span = span; - cutfeat = i; - cutval = (min_elem+max_elem)/2; - } - } - } - int lim1, lim2; - planeSplit(ind, count, cutfeat, cutval, lim1, lim2); - - if (lim1>count/2) index = lim1; - else if (lim2max_span) { - max_span = span; - } - } - DistanceType max_spread = -1; - cutfeat = 0; - for (size_t i=0; i(DistanceType)((1-EPS)*max_span)) { - ElementType min_elem, max_elem; - computeMinMax(ind, count, cutfeat, min_elem, max_elem); - DistanceType spread = (DistanceType)(max_elem-min_elem); - if (spread>max_spread) { - cutfeat = (int)i; - max_spread = spread; - } - } - } - // split in the middle - DistanceType split_val = (bbox[cutfeat].low+bbox[cutfeat].high)/2; - ElementType min_elem, max_elem; - computeMinMax(ind, count, cutfeat, min_elem, max_elem); - - if (split_valmax_elem) cutval = (DistanceType)max_elem; - else cutval = split_val; - - int lim1, lim2; - planeSplit(ind, count, cutfeat, cutval, lim1, lim2); - - if (lim1>count/2) index = lim1; - else if (lim2cutval - */ - void planeSplit(int* ind, int count, int cutfeat, DistanceType cutval, int& lim1, int& lim2) - { - /* Move vector indices for left subtree to front of list. */ - int left = 0; - int right = count-1; - for (;; ) { - while (left<=right && dataset_[ind[left]][cutfeat]=cutval) --right; - if (left>right) break; - std::swap(ind[left], ind[right]); ++left; --right; - } - /* If either list is empty, it means that all remaining features - * are identical. Split in the middle to maintain a balanced tree. - */ - lim1 = left; - right = count-1; - for (;; ) { - while (left<=right && dataset_[ind[left]][cutfeat]<=cutval) ++left; - while (left<=right && dataset_[ind[right]][cutfeat]>cutval) --right; - if (left>right) break; - std::swap(ind[left], ind[right]); ++left; --right; - } - lim2 = left; - } - - DistanceType computeInitialDistances(const ElementType* vec, std::vector& dists) - { - DistanceType distsq = 0.0; - - for (size_t i = 0; i < dim_; ++i) { - if (vec[i] < root_bbox_[i].low) { - dists[i] = distance_.accum_dist(vec[i], root_bbox_[i].low, (int)i); - distsq += dists[i]; - } - if (vec[i] > root_bbox_[i].high) { - dists[i] = distance_.accum_dist(vec[i], root_bbox_[i].high, (int)i); - distsq += dists[i]; - } - } - - return distsq; - } - - /** - * Performs an exact search in the tree starting from a node. - */ - void searchLevel(ResultSet& result_set, const ElementType* vec, const NodePtr node, DistanceType mindistsq, - std::vector& dists, const float epsError) - { - /* If this is a leaf node, then do check and return. */ - if ((node->child1 == NULL)&&(node->child2 == NULL)) { - DistanceType worst_dist = result_set.worstDist(); - for (int i=node->left; iright; ++i) { - int index = reorder_ ? i : vind_[i]; - DistanceType dist = distance_(vec, data_[index], dim_, worst_dist); - if (distdivfeat; - ElementType val = vec[idx]; - DistanceType diff1 = val - node->divlow; - DistanceType diff2 = val - node->divhigh; - - NodePtr bestChild; - NodePtr otherChild; - DistanceType cut_dist; - if ((diff1+diff2)<0) { - bestChild = node->child1; - otherChild = node->child2; - cut_dist = distance_.accum_dist(val, node->divhigh, idx); - } - else { - bestChild = node->child2; - otherChild = node->child1; - cut_dist = distance_.accum_dist( val, node->divlow, idx); - } - - /* Call recursively to search next level down. */ - searchLevel(result_set, vec, bestChild, mindistsq, dists, epsError); - - DistanceType dst = dists[idx]; - mindistsq = mindistsq + cut_dist - dst; - dists[idx] = cut_dist; - if (mindistsq*epsError<=result_set.worstDist()) { - searchLevel(result_set, vec, otherChild, mindistsq, dists, epsError); - } - dists[idx] = dst; - } - -private: - - /** - * The dataset used by this index - */ - const Matrix dataset_; - - IndexParams index_params_; - - int leaf_max_size_; - bool reorder_; - - - /** - * Array of indices to vectors in the dataset. - */ - std::vector vind_; - - Matrix data_; - - size_t size_; - size_t dim_; - - /** - * Array of k-d trees used to find neighbours. - */ - NodePtr root_node_; - - BoundingBox root_bbox_; - - /** - * Pooled memory allocator. - * - * Using a pooled memory allocator is more efficient - * than allocating memory directly when there is a large - * number small of memory allocations. - */ - PooledAllocator pool_; - - Distance distance_; -}; // class KDTree - -} - -#endif //OPENCV_FLANN_KDTREE_SINGLE_INDEX_H_ diff --git a/opencv/include/opencv2/flann/kmeans_index.h b/opencv/include/opencv2/flann/kmeans_index.h deleted file mode 100644 index fe91ddd..0000000 --- a/opencv/include/opencv2/flann/kmeans_index.h +++ /dev/null @@ -1,1172 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_KMEANS_INDEX_H_ -#define OPENCV_FLANN_KMEANS_INDEX_H_ - -#include -#include -#include -#include -#include - -#include "general.h" -#include "nn_index.h" -#include "dist.h" -#include "matrix.h" -#include "result_set.h" -#include "heap.h" -#include "allocator.h" -#include "random.h" -#include "saving.h" -#include "logger.h" - - -namespace cvflann -{ - -struct KMeansIndexParams : public IndexParams -{ - KMeansIndexParams(int branching = 32, int iterations = 11, - flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM, float cb_index = 0.2 ) - { - (*this)["algorithm"] = FLANN_INDEX_KMEANS; - // branching factor - (*this)["branching"] = branching; - // max iterations to perform in one kmeans clustering (kmeans tree) - (*this)["iterations"] = iterations; - // algorithm used for picking the initial cluster centers for kmeans tree - (*this)["centers_init"] = centers_init; - // cluster boundary index. Used when searching the kmeans tree - (*this)["cb_index"] = cb_index; - } -}; - - -/** - * Hierarchical kmeans index - * - * Contains a tree constructed through a hierarchical kmeans clustering - * and other information for indexing a set of points for nearest-neighbour matching. - */ -template -class KMeansIndex : public NNIndex -{ -public: - typedef typename Distance::ElementType ElementType; - typedef typename Distance::ResultType DistanceType; - - - - typedef void (KMeansIndex::* centersAlgFunction)(int, int*, int, int*, int&); - - /** - * The function used for choosing the cluster centers. - */ - centersAlgFunction chooseCenters; - - - - /** - * Chooses the initial centers in the k-means clustering in a random manner. - * - * Params: - * k = number of centers - * vecs = the dataset of points - * indices = indices in the dataset - * indices_length = length of indices vector - * - */ - void chooseCentersRandom(int k, int* indices, int indices_length, int* centers, int& centers_length) - { - UniqueRandom r(indices_length); - - int index; - for (index=0; index=0 && rnd < n); - - centers[0] = indices[rnd]; - - int index; - for (index=1; indexbest_val) { - best_val = dist; - best_index = j; - } - } - if (best_index!=-1) { - centers[index] = indices[best_index]; - } - else { - break; - } - } - centers_length = index; - } - - - /** - * Chooses the initial centers in the k-means using the algorithm - * proposed in the KMeans++ paper: - * Arthur, David; Vassilvitskii, Sergei - k-means++: The Advantages of Careful Seeding - * - * Implementation of this function was converted from the one provided in Arthur's code. - * - * Params: - * k = number of centers - * vecs = the dataset of points - * indices = indices in the dataset - * Returns: - */ - void chooseCentersKMeanspp(int k, int* indices, int indices_length, int* centers, int& centers_length) - { - int n = indices_length; - - double currentPot = 0; - DistanceType* closestDistSq = new DistanceType[n]; - - // Choose one random center and set the closestDistSq values - int index = rand_int(n); - assert(index >=0 && index < n); - centers[0] = indices[index]; - - for (int i = 0; i < n; i++) { - closestDistSq[i] = distance_(dataset_[indices[i]], dataset_[indices[index]], dataset_.cols); - closestDistSq[i] = ensureSquareDistance( closestDistSq[i] ); - currentPot += closestDistSq[i]; - } - - - const int numLocalTries = 1; - - // Choose each center - int centerCount; - for (centerCount = 1; centerCount < k; centerCount++) { - - // Repeat several trials - double bestNewPot = -1; - int bestNewIndex = -1; - for (int localTrial = 0; localTrial < numLocalTries; localTrial++) { - - // Choose our center - have to be slightly careful to return a valid answer even accounting - // for possible rounding errors - double randVal = rand_double(currentPot); - for (index = 0; index < n-1; index++) { - if (randVal <= closestDistSq[index]) break; - else randVal -= closestDistSq[index]; - } - - // Compute the new potential - double newPot = 0; - for (int i = 0; i < n; i++) { - DistanceType dist = distance_(dataset_[indices[i]], dataset_[indices[index]], dataset_.cols); - newPot += std::min( ensureSquareDistance(dist), closestDistSq[i] ); - } - - // Store the best result - if ((bestNewPot < 0)||(newPot < bestNewPot)) { - bestNewPot = newPot; - bestNewIndex = index; - } - } - - // Add the appropriate center - centers[centerCount] = indices[bestNewIndex]; - currentPot = bestNewPot; - for (int i = 0; i < n; i++) { - DistanceType dist = distance_(dataset_[indices[i]], dataset_[indices[bestNewIndex]], dataset_.cols); - closestDistSq[i] = std::min( ensureSquareDistance(dist), closestDistSq[i] ); - } - } - - centers_length = centerCount; - - delete[] closestDistSq; - } - - - -public: - - flann_algorithm_t getType() const CV_OVERRIDE - { - return FLANN_INDEX_KMEANS; - } - - class KMeansDistanceComputer : public cv::ParallelLoopBody - { - public: - KMeansDistanceComputer(Distance _distance, const Matrix& _dataset, - const int _branching, const int* _indices, const Matrix& _dcenters, const size_t _veclen, - std::vector &_new_centroids, std::vector &_sq_dists) - : distance(_distance) - , dataset(_dataset) - , branching(_branching) - , indices(_indices) - , dcenters(_dcenters) - , veclen(_veclen) - , new_centroids(_new_centroids) - , sq_dists(_sq_dists) - { - } - - void operator()(const cv::Range& range) const CV_OVERRIDE - { - const int begin = range.start; - const int end = range.end; - - for( int i = begin; inew_sq_dist) { - new_centroid = j; - sq_dist = new_sq_dist; - } - } - sq_dists[i] = sq_dist; - new_centroids[i] = new_centroid; - } - } - - private: - Distance distance; - const Matrix& dataset; - const int branching; - const int* indices; - const Matrix& dcenters; - const size_t veclen; - std::vector &new_centroids; - std::vector &sq_dists; - KMeansDistanceComputer& operator=( const KMeansDistanceComputer & ) { return *this; } - }; - - /** - * Index constructor - * - * Params: - * inputData = dataset with the input features - * params = parameters passed to the hierarchical k-means algorithm - */ - KMeansIndex(const Matrix& inputData, const IndexParams& params = KMeansIndexParams(), - Distance d = Distance()) - : dataset_(inputData), index_params_(params), root_(NULL), indices_(NULL), distance_(d) - { - memoryCounter_ = 0; - - size_ = dataset_.rows; - veclen_ = dataset_.cols; - - branching_ = get_param(params,"branching",32); - iterations_ = get_param(params,"iterations",11); - if (iterations_<0) { - iterations_ = (std::numeric_limits::max)(); - } - centers_init_ = get_param(params,"centers_init",FLANN_CENTERS_RANDOM); - - if (centers_init_==FLANN_CENTERS_RANDOM) { - chooseCenters = &KMeansIndex::chooseCentersRandom; - } - else if (centers_init_==FLANN_CENTERS_GONZALES) { - chooseCenters = &KMeansIndex::chooseCentersGonzales; - } - else if (centers_init_==FLANN_CENTERS_KMEANSPP) { - chooseCenters = &KMeansIndex::chooseCentersKMeanspp; - } - else { - throw FLANNException("Unknown algorithm for choosing initial centers."); - } - cb_index_ = 0.4f; - - } - - - KMeansIndex(const KMeansIndex&); - KMeansIndex& operator=(const KMeansIndex&); - - - /** - * Index destructor. - * - * Release the memory used by the index. - */ - virtual ~KMeansIndex() - { - if (root_ != NULL) { - free_centers(root_); - } - if (indices_!=NULL) { - delete[] indices_; - } - } - - /** - * Returns size of index. - */ - size_t size() const CV_OVERRIDE - { - return size_; - } - - /** - * Returns the length of an index feature. - */ - size_t veclen() const CV_OVERRIDE - { - return veclen_; - } - - - void set_cb_index( float index) - { - cb_index_ = index; - } - - /** - * Computes the inde memory usage - * Returns: memory used by the index - */ - int usedMemory() const CV_OVERRIDE - { - return pool_.usedMemory+pool_.wastedMemory+memoryCounter_; - } - - /** - * Builds the index - */ - void buildIndex() CV_OVERRIDE - { - if (branching_<2) { - throw FLANNException("Branching factor must be at least 2"); - } - - indices_ = new int[size_]; - for (size_t i=0; i(); - std::memset(root_, 0, sizeof(KMeansNode)); - - computeNodeStatistics(root_, indices_, (int)size_); - computeClustering(root_, indices_, (int)size_, branching_,0); - } - - - void saveIndex(FILE* stream) CV_OVERRIDE - { - save_value(stream, branching_); - save_value(stream, iterations_); - save_value(stream, memoryCounter_); - save_value(stream, cb_index_); - save_value(stream, *indices_, (int)size_); - - save_tree(stream, root_); - } - - - void loadIndex(FILE* stream) CV_OVERRIDE - { - load_value(stream, branching_); - load_value(stream, iterations_); - load_value(stream, memoryCounter_); - load_value(stream, cb_index_); - if (indices_!=NULL) { - delete[] indices_; - } - indices_ = new int[size_]; - load_value(stream, *indices_, size_); - - if (root_!=NULL) { - free_centers(root_); - } - load_tree(stream, root_); - - index_params_["algorithm"] = getType(); - index_params_["branching"] = branching_; - index_params_["iterations"] = iterations_; - index_params_["centers_init"] = centers_init_; - index_params_["cb_index"] = cb_index_; - - } - - - /** - * Find set of nearest neighbors to vec. Their indices are stored inside - * the result object. - * - * Params: - * result = the result object in which the indices of the nearest-neighbors are stored - * vec = the vector for which to search the nearest neighbors - * searchParams = parameters that influence the search algorithm (checks, cb_index) - */ - void findNeighbors(ResultSet& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE - { - - int maxChecks = get_param(searchParams,"checks",32); - - if (maxChecks==FLANN_CHECKS_UNLIMITED) { - findExactNN(root_, result, vec); - } - else { - // Priority queue storing intermediate branches in the best-bin-first search - Heap* heap = new Heap((int)size_); - - int checks = 0; - findNN(root_, result, vec, checks, maxChecks, heap); - - BranchSt branch; - while (heap->popMin(branch) && (checks& centers) - { - int numClusters = centers.rows; - if (numClusters<1) { - throw FLANNException("Number of clusters must be at least 1"); - } - - DistanceType variance; - KMeansNodePtr* clusters = new KMeansNodePtr[numClusters]; - - int clusterCount = getMinVarianceClusters(root_, clusters, numClusters, variance); - - Logger::info("Clusters requested: %d, returning %d\n",numClusters, clusterCount); - - for (int i=0; ipivot; - for (size_t j=0; j BranchSt; - - - - - void save_tree(FILE* stream, KMeansNodePtr node) - { - save_value(stream, *node); - save_value(stream, *(node->pivot), (int)veclen_); - if (node->childs==NULL) { - int indices_offset = (int)(node->indices - indices_); - save_value(stream, indices_offset); - } - else { - for(int i=0; ichilds[i]); - } - } - } - - - void load_tree(FILE* stream, KMeansNodePtr& node) - { - node = pool_.allocate(); - load_value(stream, *node); - node->pivot = new DistanceType[veclen_]; - load_value(stream, *(node->pivot), (int)veclen_); - if (node->childs==NULL) { - int indices_offset; - load_value(stream, indices_offset); - node->indices = indices_ + indices_offset; - } - else { - node->childs = pool_.allocate(branching_); - for(int i=0; ichilds[i]); - } - } - } - - - /** - * Helper function - */ - void free_centers(KMeansNodePtr node) - { - delete[] node->pivot; - if (node->childs!=NULL) { - for (int k=0; kchilds[k]); - } - } - } - - /** - * Computes the statistics of a node (mean, radius, variance). - * - * Params: - * node = the node to use - * indices = the indices of the points belonging to the node - */ - void computeNodeStatistics(KMeansNodePtr node, int* indices, int indices_length) - { - - DistanceType radius = 0; - DistanceType variance = 0; - DistanceType* mean = new DistanceType[veclen_]; - memoryCounter_ += int(veclen_*sizeof(DistanceType)); - - memset(mean,0,veclen_*sizeof(DistanceType)); - - for (size_t i=0; i(), veclen_); - } - for (size_t j=0; j(), veclen_); - - DistanceType tmp = 0; - for (int i=0; iradius) { - radius = tmp; - } - } - - node->variance = variance; - node->radius = radius; - node->pivot = mean; - } - - - /** - * The method responsible with actually doing the recursive hierarchical - * clustering - * - * Params: - * node = the node to cluster - * indices = indices of the points belonging to the current node - * branching = the branching factor to use in the clustering - * - * TODO: for 1-sized clusters don't store a cluster center (it's the same as the single cluster point) - */ - void computeClustering(KMeansNodePtr node, int* indices, int indices_length, int branching, int level) - { - node->size = indices_length; - node->level = level; - - if (indices_length < branching) { - node->indices = indices; - std::sort(node->indices,node->indices+indices_length); - node->childs = NULL; - return; - } - - cv::AutoBuffer centers_idx_buf(branching); - int* centers_idx = centers_idx_buf.data(); - int centers_length; - (this->*chooseCenters)(branching, indices, indices_length, centers_idx, centers_length); - - if (centers_lengthindices = indices; - std::sort(node->indices,node->indices+indices_length); - node->childs = NULL; - return; - } - - - cv::AutoBuffer dcenters_buf(branching*veclen_); - Matrix dcenters(dcenters_buf.data(), branching, veclen_); - for (int i=0; i radiuses(branching); - cv::AutoBuffer count_buf(branching); - int* count = count_buf.data(); - for (int i=0; i belongs_to_buf(indices_length); - int* belongs_to = belongs_to_buf.data(); - for (int i=0; inew_sq_dist) { - belongs_to[i] = j; - sq_dist = new_sq_dist; - } - } - if (sq_dist>radiuses[belongs_to[i]]) { - radiuses[belongs_to[i]] = sq_dist; - } - count[belongs_to[i]]++; - } - - bool converged = false; - int iteration = 0; - while (!converged && iteration new_centroids(indices_length); - std::vector sq_dists(indices_length); - - // reassign points to clusters - KMeansDistanceComputer invoker(distance_, dataset_, branching, indices, dcenters, veclen_, new_centroids, sq_dists); - parallel_for_(cv::Range(0, (int)indices_length), invoker); - - for (int i=0; i < (int)indices_length; ++i) { - DistanceType sq_dist(sq_dists[i]); - int new_centroid(new_centroids[i]); - if (sq_dist > radiuses[new_centroid]) { - radiuses[new_centroid] = sq_dist; - } - if (new_centroid != belongs_to[i]) { - count[belongs_to[i]]--; - count[new_centroid]++; - belongs_to[i] = new_centroid; - converged = false; - } - } - - for (int i=0; ichilds = pool_.allocate(branching); - int start = 0; - int end = start; - for (int c=0; c(), veclen_); - variance += d; - mean_radius += sqrt(d); - std::swap(indices[i],indices[end]); - std::swap(belongs_to[i],belongs_to[end]); - end++; - } - } - variance /= s; - mean_radius /= s; - variance -= distance_(centers[c], ZeroIterator(), veclen_); - - node->childs[c] = pool_.allocate(); - std::memset(node->childs[c], 0, sizeof(KMeansNode)); - node->childs[c]->radius = radiuses[c]; - node->childs[c]->pivot = centers[c]; - node->childs[c]->variance = variance; - node->childs[c]->mean_radius = mean_radius; - computeClustering(node->childs[c],indices+start, end-start, branching, level+1); - start=end; - } - - delete[] centers; - } - - - - /** - * Performs one descent in the hierarchical k-means tree. The branches not - * visited are stored in a priority queue. - * - * Params: - * node = node to explore - * result = container for the k-nearest neighbors found - * vec = query points - * checks = how many points in the dataset have been checked so far - * maxChecks = maximum dataset points to checks - */ - - - void findNN(KMeansNodePtr node, ResultSet& result, const ElementType* vec, int& checks, int maxChecks, - Heap* heap) - { - // Ignore those clusters that are too far away - { - DistanceType bsq = distance_(vec, node->pivot, veclen_); - DistanceType rsq = node->radius; - DistanceType wsq = result.worstDist(); - - DistanceType val = bsq-rsq-wsq; - DistanceType val2 = val*val-4*rsq*wsq; - - //if (val>0) { - if ((val>0)&&(val2>0)) { - return; - } - } - - if (node->childs==NULL) { - if (checks>=maxChecks) { - if (result.full()) return; - } - checks += node->size; - for (int i=0; isize; ++i) { - int index = node->indices[i]; - DistanceType dist = distance_(dataset_[index], vec, veclen_); - result.addPoint(dist, index); - } - } - else { - DistanceType* domain_distances = new DistanceType[branching_]; - int closest_center = exploreNodeBranches(node, vec, domain_distances, heap); - delete[] domain_distances; - findNN(node->childs[closest_center],result,vec, checks, maxChecks, heap); - } - } - - /** - * Helper function that computes the nearest childs of a node to a given query point. - * Params: - * node = the node - * q = the query point - * distances = array with the distances to each child node. - * Returns: - */ - int exploreNodeBranches(KMeansNodePtr node, const ElementType* q, DistanceType* domain_distances, Heap* heap) - { - - int best_index = 0; - domain_distances[best_index] = distance_(q, node->childs[best_index]->pivot, veclen_); - for (int i=1; ichilds[i]->pivot, veclen_); - if (domain_distances[i]childs[best_index]->pivot; - for (int i=0; ichilds[i]->variance; - - // float dist_to_border = getDistanceToBorder(node.childs[i].pivot,best_center,q); - // if (domain_distances[i]insert(BranchSt(node->childs[i],domain_distances[i])); - } - } - - return best_index; - } - - - /** - * Function the performs exact nearest neighbor search by traversing the entire tree. - */ - void findExactNN(KMeansNodePtr node, ResultSet& result, const ElementType* vec) - { - // Ignore those clusters that are too far away - { - DistanceType bsq = distance_(vec, node->pivot, veclen_); - DistanceType rsq = node->radius; - DistanceType wsq = result.worstDist(); - - DistanceType val = bsq-rsq-wsq; - DistanceType val2 = val*val-4*rsq*wsq; - - // if (val>0) { - if ((val>0)&&(val2>0)) { - return; - } - } - - - if (node->childs==NULL) { - for (int i=0; isize; ++i) { - int index = node->indices[i]; - DistanceType dist = distance_(dataset_[index], vec, veclen_); - result.addPoint(dist, index); - } - } - else { - int* sort_indices = new int[branching_]; - - getCenterOrdering(node, vec, sort_indices); - - for (int i=0; ichilds[sort_indices[i]],result,vec); - } - - delete[] sort_indices; - } - } - - - /** - * Helper function. - * - * I computes the order in which to traverse the child nodes of a particular node. - */ - void getCenterOrdering(KMeansNodePtr node, const ElementType* q, int* sort_indices) - { - DistanceType* domain_distances = new DistanceType[branching_]; - for (int i=0; ichilds[i]->pivot, veclen_); - - int j=0; - while (domain_distances[j]j; --k) { - domain_distances[k] = domain_distances[k-1]; - sort_indices[k] = sort_indices[k-1]; - } - domain_distances[j] = dist; - sort_indices[j] = i; - } - delete[] domain_distances; - } - - /** - * Method that computes the squared distance from the query point q - * from inside region with center c to the border between this - * region and the region with center p - */ - DistanceType getDistanceToBorder(DistanceType* p, DistanceType* c, DistanceType* q) - { - DistanceType sum = 0; - DistanceType sum2 = 0; - - for (int i=0; ivariance*root->size; - - while (clusterCount::max)(); - int splitIndex = -1; - - for (int i=0; ichilds != NULL) { - - DistanceType variance = meanVariance - clusters[i]->variance*clusters[i]->size; - - for (int j=0; jchilds[j]->variance*clusters[i]->childs[j]->size; - } - if (variance clusters_length) break; - - meanVariance = minVariance; - - // split node - KMeansNodePtr toSplit = clusters[splitIndex]; - clusters[splitIndex] = toSplit->childs[0]; - for (int i=1; ichilds[i]; - } - } - - varianceValue = meanVariance/root->size; - return clusterCount; - } - -private: - /** The branching factor used in the hierarchical k-means clustering */ - int branching_; - - /** Maximum number of iterations to use when performing k-means clustering */ - int iterations_; - - /** Algorithm for choosing the cluster centers */ - flann_centers_init_t centers_init_; - - /** - * Cluster border index. This is used in the tree search phase when determining - * the closest cluster to explore next. A zero value takes into account only - * the cluster centres, a value greater then zero also take into account the size - * of the cluster. - */ - float cb_index_; - - /** - * The dataset used by this index - */ - const Matrix dataset_; - - /** Index parameters */ - IndexParams index_params_; - - /** - * Number of features in the dataset. - */ - size_t size_; - - /** - * Length of each feature. - */ - size_t veclen_; - - /** - * The root node in the tree. - */ - KMeansNodePtr root_; - - /** - * Array of indices to vectors in the dataset. - */ - int* indices_; - - /** - * The distance - */ - Distance distance_; - - /** - * Pooled memory allocator. - */ - PooledAllocator pool_; - - /** - * Memory occupied by the index. - */ - int memoryCounter_; -}; - -} - -#endif //OPENCV_FLANN_KMEANS_INDEX_H_ diff --git a/opencv/include/opencv2/flann/linear_index.h b/opencv/include/opencv2/flann/linear_index.h deleted file mode 100644 index ca3f44d..0000000 --- a/opencv/include/opencv2/flann/linear_index.h +++ /dev/null @@ -1,132 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_LINEAR_INDEX_H_ -#define OPENCV_FLANN_LINEAR_INDEX_H_ - -#include "general.h" -#include "nn_index.h" - -namespace cvflann -{ - -struct LinearIndexParams : public IndexParams -{ - LinearIndexParams() - { - (* this)["algorithm"] = FLANN_INDEX_LINEAR; - } -}; - -template -class LinearIndex : public NNIndex -{ -public: - - typedef typename Distance::ElementType ElementType; - typedef typename Distance::ResultType DistanceType; - - - LinearIndex(const Matrix& inputData, const IndexParams& params = LinearIndexParams(), - Distance d = Distance()) : - dataset_(inputData), index_params_(params), distance_(d) - { - } - - LinearIndex(const LinearIndex&); - LinearIndex& operator=(const LinearIndex&); - - flann_algorithm_t getType() const CV_OVERRIDE - { - return FLANN_INDEX_LINEAR; - } - - - size_t size() const CV_OVERRIDE - { - return dataset_.rows; - } - - size_t veclen() const CV_OVERRIDE - { - return dataset_.cols; - } - - - int usedMemory() const CV_OVERRIDE - { - return 0; - } - - void buildIndex() CV_OVERRIDE - { - /* nothing to do here for linear search */ - } - - void saveIndex(FILE*) CV_OVERRIDE - { - /* nothing to do here for linear search */ - } - - - void loadIndex(FILE*) CV_OVERRIDE - { - /* nothing to do here for linear search */ - - index_params_["algorithm"] = getType(); - } - - void findNeighbors(ResultSet& resultSet, const ElementType* vec, const SearchParams& /*searchParams*/) CV_OVERRIDE - { - ElementType* data = dataset_.data; - for (size_t i = 0; i < dataset_.rows; ++i, data += dataset_.cols) { - DistanceType dist = distance_(data, vec, dataset_.cols); - resultSet.addPoint(dist, (int)i); - } - } - - IndexParams getParameters() const CV_OVERRIDE - { - return index_params_; - } - -private: - /** The dataset */ - const Matrix dataset_; - /** Index parameters */ - IndexParams index_params_; - /** Index distance */ - Distance distance_; - -}; - -} - -#endif // OPENCV_FLANN_LINEAR_INDEX_H_ diff --git a/opencv/include/opencv2/flann/logger.h b/opencv/include/opencv2/flann/logger.h deleted file mode 100644 index 32618db..0000000 --- a/opencv/include/opencv2/flann/logger.h +++ /dev/null @@ -1,135 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_LOGGER_H -#define OPENCV_FLANN_LOGGER_H - -#include -#include - -#include "defines.h" - - -namespace cvflann -{ - -class Logger -{ - Logger() : stream(stdout), logLevel(FLANN_LOG_WARN) {} - - ~Logger() - { - if ((stream!=NULL)&&(stream!=stdout)) { - fclose(stream); - } - } - - static Logger& instance() - { - static Logger logger; - return logger; - } - - void _setDestination(const char* name) - { - if (name==NULL) { - stream = stdout; - } - else { -#ifdef _MSC_VER - if (fopen_s(&stream, name, "w") != 0) - stream = NULL; -#else - stream = fopen(name,"w"); -#endif - if (stream == NULL) { - stream = stdout; - } - } - } - - int _log(int level, const char* fmt, va_list arglist) - { - if (level > logLevel ) return -1; - int ret = vfprintf(stream, fmt, arglist); - return ret; - } - -public: - /** - * Sets the logging level. All messages with lower priority will be ignored. - * @param level Logging level - */ - static void setLevel(int level) { instance().logLevel = level; } - - /** - * Sets the logging destination - * @param name Filename or NULL for console - */ - static void setDestination(const char* name) { instance()._setDestination(name); } - - /** - * Print log message - * @param level Log level - * @param fmt Message format - * @return - */ - static int log(int level, const char* fmt, ...) - { - va_list arglist; - va_start(arglist, fmt); - int ret = instance()._log(level,fmt,arglist); - va_end(arglist); - return ret; - } - -#define LOG_METHOD(NAME,LEVEL) \ - static int NAME(const char* fmt, ...) \ - { \ - va_list ap; \ - va_start(ap, fmt); \ - int ret = instance()._log(LEVEL, fmt, ap); \ - va_end(ap); \ - return ret; \ - } - - LOG_METHOD(fatal, FLANN_LOG_FATAL) - LOG_METHOD(error, FLANN_LOG_ERROR) - LOG_METHOD(warn, FLANN_LOG_WARN) - LOG_METHOD(info, FLANN_LOG_INFO) - -private: - FILE* stream; - int logLevel; -}; - -} - -#endif //OPENCV_FLANN_LOGGER_H diff --git a/opencv/include/opencv2/flann/lsh_index.h b/opencv/include/opencv2/flann/lsh_index.h deleted file mode 100644 index 42afe89..0000000 --- a/opencv/include/opencv2/flann/lsh_index.h +++ /dev/null @@ -1,392 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -/*********************************************************************** - * Author: Vincent Rabaud - *************************************************************************/ - -#ifndef OPENCV_FLANN_LSH_INDEX_H_ -#define OPENCV_FLANN_LSH_INDEX_H_ - -#include -#include -#include -#include -#include - -#include "general.h" -#include "nn_index.h" -#include "matrix.h" -#include "result_set.h" -#include "heap.h" -#include "lsh_table.h" -#include "allocator.h" -#include "random.h" -#include "saving.h" - -namespace cvflann -{ - -struct LshIndexParams : public IndexParams -{ - LshIndexParams(unsigned int table_number = 12, unsigned int key_size = 20, unsigned int multi_probe_level = 2) - { - (* this)["algorithm"] = FLANN_INDEX_LSH; - // The number of hash tables to use - (*this)["table_number"] = table_number; - // The length of the key in the hash tables - (*this)["key_size"] = key_size; - // Number of levels to use in multi-probe (0 for standard LSH) - (*this)["multi_probe_level"] = multi_probe_level; - } -}; - -/** - * Randomized kd-tree index - * - * Contains the k-d trees and other information for indexing a set of points - * for nearest-neighbor matching. - */ -template -class LshIndex : public NNIndex -{ -public: - typedef typename Distance::ElementType ElementType; - typedef typename Distance::ResultType DistanceType; - - /** Constructor - * @param input_data dataset with the input features - * @param params parameters passed to the LSH algorithm - * @param d the distance used - */ - LshIndex(const Matrix& input_data, const IndexParams& params = LshIndexParams(), - Distance d = Distance()) : - dataset_(input_data), index_params_(params), distance_(d) - { - // cv::flann::IndexParams sets integer params as 'int', so it is used with get_param - // in place of 'unsigned int' - table_number_ = (unsigned int)get_param(index_params_,"table_number",12); - key_size_ = (unsigned int)get_param(index_params_,"key_size",20); - multi_probe_level_ = (unsigned int)get_param(index_params_,"multi_probe_level",2); - - feature_size_ = (unsigned)dataset_.cols; - fill_xor_mask(0, key_size_, multi_probe_level_, xor_masks_); - } - - - LshIndex(const LshIndex&); - LshIndex& operator=(const LshIndex&); - - /** - * Builds the index - */ - void buildIndex() CV_OVERRIDE - { - tables_.resize(table_number_); - for (unsigned int i = 0; i < table_number_; ++i) { - lsh::LshTable& table = tables_[i]; - table = lsh::LshTable(feature_size_, key_size_); - - // Add the features to the table - table.add(dataset_); - } - } - - flann_algorithm_t getType() const CV_OVERRIDE - { - return FLANN_INDEX_LSH; - } - - - void saveIndex(FILE* stream) CV_OVERRIDE - { - save_value(stream,table_number_); - save_value(stream,key_size_); - save_value(stream,multi_probe_level_); - save_value(stream, dataset_); - } - - void loadIndex(FILE* stream) CV_OVERRIDE - { - load_value(stream, table_number_); - load_value(stream, key_size_); - load_value(stream, multi_probe_level_); - load_value(stream, dataset_); - // Building the index is so fast we can afford not storing it - buildIndex(); - - index_params_["algorithm"] = getType(); - index_params_["table_number"] = table_number_; - index_params_["key_size"] = key_size_; - index_params_["multi_probe_level"] = multi_probe_level_; - } - - /** - * Returns size of index. - */ - size_t size() const CV_OVERRIDE - { - return dataset_.rows; - } - - /** - * Returns the length of an index feature. - */ - size_t veclen() const CV_OVERRIDE - { - return feature_size_; - } - - /** - * Computes the index memory usage - * Returns: memory used by the index - */ - int usedMemory() const CV_OVERRIDE - { - return (int)(dataset_.rows * sizeof(int)); - } - - - IndexParams getParameters() const CV_OVERRIDE - { - return index_params_; - } - - /** - * \brief Perform k-nearest neighbor search - * \param[in] queries The query points for which to find the nearest neighbors - * \param[out] indices The indices of the nearest neighbors found - * \param[out] dists Distances to the nearest neighbors found - * \param[in] knn Number of nearest neighbors to return - * \param[in] params Search parameters - */ - virtual void knnSearch(const Matrix& queries, Matrix& indices, Matrix& dists, int knn, const SearchParams& params) CV_OVERRIDE - { - assert(queries.cols == veclen()); - assert(indices.rows >= queries.rows); - assert(dists.rows >= queries.rows); - assert(int(indices.cols) >= knn); - assert(int(dists.cols) >= knn); - - - KNNUniqueResultSet resultSet(knn); - for (size_t i = 0; i < queries.rows; i++) { - resultSet.clear(); - std::fill_n(indices[i], knn, -1); - std::fill_n(dists[i], knn, std::numeric_limits::max()); - findNeighbors(resultSet, queries[i], params); - if (get_param(params,"sorted",true)) resultSet.sortAndCopy(indices[i], dists[i], knn); - else resultSet.copy(indices[i], dists[i], knn); - } - } - - - /** - * Find set of nearest neighbors to vec. Their indices are stored inside - * the result object. - * - * Params: - * result = the result object in which the indices of the nearest-neighbors are stored - * vec = the vector for which to search the nearest neighbors - * maxCheck = the maximum number of restarts (in a best-bin-first manner) - */ - void findNeighbors(ResultSet& result, const ElementType* vec, const SearchParams& /*searchParams*/) CV_OVERRIDE - { - getNeighbors(vec, result); - } - -private: - /** Defines the comparator on score and index - */ - typedef std::pair ScoreIndexPair; - struct SortScoreIndexPairOnSecond - { - bool operator()(const ScoreIndexPair& left, const ScoreIndexPair& right) const - { - return left.second < right.second; - } - }; - - /** Fills the different xor masks to use when getting the neighbors in multi-probe LSH - * @param key the key we build neighbors from - * @param lowest_index the lowest index of the bit set - * @param level the multi-probe level we are at - * @param xor_masks all the xor mask - */ - void fill_xor_mask(lsh::BucketKey key, int lowest_index, unsigned int level, - std::vector& xor_masks) - { - xor_masks.push_back(key); - if (level == 0) return; - for (int index = lowest_index - 1; index >= 0; --index) { - // Create a new key - lsh::BucketKey new_key = key | (1 << index); - fill_xor_mask(new_key, index, level - 1, xor_masks); - } - } - - /** Performs the approximate nearest-neighbor search. - * @param vec the feature to analyze - * @param do_radius flag indicating if we check the radius too - * @param radius the radius if it is a radius search - * @param do_k flag indicating if we limit the number of nn - * @param k_nn the number of nearest neighbors - * @param checked_average used for debugging - */ - void getNeighbors(const ElementType* vec, bool /*do_radius*/, float radius, bool do_k, unsigned int k_nn, - float& /*checked_average*/) - { - static std::vector score_index_heap; - - if (do_k) { - unsigned int worst_score = std::numeric_limits::max(); - typename std::vector >::const_iterator table = tables_.begin(); - typename std::vector >::const_iterator table_end = tables_.end(); - for (; table != table_end; ++table) { - size_t key = table->getKey(vec); - std::vector::const_iterator xor_mask = xor_masks_.begin(); - std::vector::const_iterator xor_mask_end = xor_masks_.end(); - for (; xor_mask != xor_mask_end; ++xor_mask) { - size_t sub_key = key ^ (*xor_mask); - const lsh::Bucket* bucket = table->getBucketFromKey(sub_key); - if (bucket == 0) continue; - - // Go over each descriptor index - std::vector::const_iterator training_index = bucket->begin(); - std::vector::const_iterator last_training_index = bucket->end(); - DistanceType hamming_distance; - - // Process the rest of the candidates - for (; training_index < last_training_index; ++training_index) { - hamming_distance = distance_(vec, dataset_[*training_index], dataset_.cols); - - if (hamming_distance < worst_score) { - // Insert the new element - score_index_heap.push_back(ScoreIndexPair(hamming_distance, training_index)); - std::push_heap(score_index_heap.begin(), score_index_heap.end()); - - if (score_index_heap.size() > (unsigned int)k_nn) { - // Remove the highest distance value as we have too many elements - std::pop_heap(score_index_heap.begin(), score_index_heap.end()); - score_index_heap.pop_back(); - // Keep track of the worst score - worst_score = score_index_heap.front().first; - } - } - } - } - } - } - else { - typename std::vector >::const_iterator table = tables_.begin(); - typename std::vector >::const_iterator table_end = tables_.end(); - for (; table != table_end; ++table) { - size_t key = table->getKey(vec); - std::vector::const_iterator xor_mask = xor_masks_.begin(); - std::vector::const_iterator xor_mask_end = xor_masks_.end(); - for (; xor_mask != xor_mask_end; ++xor_mask) { - size_t sub_key = key ^ (*xor_mask); - const lsh::Bucket* bucket = table->getBucketFromKey(sub_key); - if (bucket == 0) continue; - - // Go over each descriptor index - std::vector::const_iterator training_index = bucket->begin(); - std::vector::const_iterator last_training_index = bucket->end(); - DistanceType hamming_distance; - - // Process the rest of the candidates - for (; training_index < last_training_index; ++training_index) { - // Compute the Hamming distance - hamming_distance = distance_(vec, dataset_[*training_index], dataset_.cols); - if (hamming_distance < radius) score_index_heap.push_back(ScoreIndexPair(hamming_distance, training_index)); - } - } - } - } - } - - /** Performs the approximate nearest-neighbor search. - * This is a slower version than the above as it uses the ResultSet - * @param vec the feature to analyze - */ - void getNeighbors(const ElementType* vec, ResultSet& result) - { - typename std::vector >::const_iterator table = tables_.begin(); - typename std::vector >::const_iterator table_end = tables_.end(); - for (; table != table_end; ++table) { - size_t key = table->getKey(vec); - std::vector::const_iterator xor_mask = xor_masks_.begin(); - std::vector::const_iterator xor_mask_end = xor_masks_.end(); - for (; xor_mask != xor_mask_end; ++xor_mask) { - size_t sub_key = key ^ (*xor_mask); - const lsh::Bucket* bucket = table->getBucketFromKey((lsh::BucketKey)sub_key); - if (bucket == 0) continue; - - // Go over each descriptor index - std::vector::const_iterator training_index = bucket->begin(); - std::vector::const_iterator last_training_index = bucket->end(); - DistanceType hamming_distance; - - // Process the rest of the candidates - for (; training_index < last_training_index; ++training_index) { - // Compute the Hamming distance - hamming_distance = distance_(vec, dataset_[*training_index], (int)dataset_.cols); - result.addPoint(hamming_distance, *training_index); - } - } - } - } - - /** The different hash tables */ - std::vector > tables_; - - /** The data the LSH tables where built from */ - Matrix dataset_; - - /** The size of the features (as ElementType[]) */ - unsigned int feature_size_; - - IndexParams index_params_; - - /** table number */ - unsigned int table_number_; - /** key size */ - unsigned int key_size_; - /** How far should we look for neighbors in multi-probe LSH */ - unsigned int multi_probe_level_; - - /** The XOR masks to apply to a key to get the neighboring buckets */ - std::vector xor_masks_; - - Distance distance_; -}; -} - -#endif //OPENCV_FLANN_LSH_INDEX_H_ diff --git a/opencv/include/opencv2/flann/lsh_table.h b/opencv/include/opencv2/flann/lsh_table.h deleted file mode 100644 index b07a9d5..0000000 --- a/opencv/include/opencv2/flann/lsh_table.h +++ /dev/null @@ -1,513 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -/*********************************************************************** - * Author: Vincent Rabaud - *************************************************************************/ - -#ifndef OPENCV_FLANN_LSH_TABLE_H_ -#define OPENCV_FLANN_LSH_TABLE_H_ - -#include -#include -#include -#include -// TODO as soon as we use C++0x, use the code in USE_UNORDERED_MAP -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -# define USE_UNORDERED_MAP 1 -#else -# define USE_UNORDERED_MAP 0 -#endif -#if USE_UNORDERED_MAP -#include -#else -#include -#endif -#include -#include - -#include "dynamic_bitset.h" -#include "matrix.h" - -namespace cvflann -{ - -namespace lsh -{ - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** What is stored in an LSH bucket - */ -typedef uint32_t FeatureIndex; -/** The id from which we can get a bucket back in an LSH table - */ -typedef unsigned int BucketKey; - -/** A bucket in an LSH table - */ -typedef std::vector Bucket; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** POD for stats about an LSH table - */ -struct LshStats -{ - std::vector bucket_sizes_; - size_t n_buckets_; - size_t bucket_size_mean_; - size_t bucket_size_median_; - size_t bucket_size_min_; - size_t bucket_size_max_; - size_t bucket_size_std_dev; - /** Each contained vector contains three value: beginning/end for interval, number of elements in the bin - */ - std::vector > size_histogram_; -}; - -/** Overload the << operator for LshStats - * @param out the streams - * @param stats the stats to display - * @return the streams - */ -inline std::ostream& operator <<(std::ostream& out, const LshStats& stats) -{ - int w = 20; - out << "Lsh Table Stats:\n" << std::setw(w) << std::setiosflags(std::ios::right) << "N buckets : " - << stats.n_buckets_ << "\n" << std::setw(w) << std::setiosflags(std::ios::right) << "mean size : " - << std::setiosflags(std::ios::left) << stats.bucket_size_mean_ << "\n" << std::setw(w) - << std::setiosflags(std::ios::right) << "median size : " << stats.bucket_size_median_ << "\n" << std::setw(w) - << std::setiosflags(std::ios::right) << "min size : " << std::setiosflags(std::ios::left) - << stats.bucket_size_min_ << "\n" << std::setw(w) << std::setiosflags(std::ios::right) << "max size : " - << std::setiosflags(std::ios::left) << stats.bucket_size_max_; - - // Display the histogram - out << std::endl << std::setw(w) << std::setiosflags(std::ios::right) << "histogram : " - << std::setiosflags(std::ios::left); - for (std::vector >::const_iterator iterator = stats.size_histogram_.begin(), end = - stats.size_histogram_.end(); iterator != end; ++iterator) out << (*iterator)[0] << "-" << (*iterator)[1] << ": " << (*iterator)[2] << ", "; - - return out; -} - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** Lsh hash table. As its key is a sub-feature, and as usually - * the size of it is pretty small, we keep it as a continuous memory array. - * The value is an index in the corpus of features (we keep it as an unsigned - * int for pure memory reasons, it could be a size_t) - */ -template -class LshTable -{ -public: - /** A container of all the feature indices. Optimized for space - */ -#if USE_UNORDERED_MAP - typedef std::unordered_map BucketsSpace; -#else - typedef std::map BucketsSpace; -#endif - - /** A container of all the feature indices. Optimized for speed - */ - typedef std::vector BucketsSpeed; - - /** Default constructor - */ - LshTable() - { - key_size_ = 0; - feature_size_ = 0; - speed_level_ = kArray; - } - - /** Default constructor - * Create the mask and allocate the memory - * @param feature_size is the size of the feature (considered as a ElementType[]) - * @param key_size is the number of bits that are turned on in the feature - */ - LshTable(unsigned int feature_size, unsigned int key_size) - { - feature_size_ = feature_size; - CV_UNUSED(key_size); - std::cerr << "LSH is not implemented for that type" << std::endl; - assert(0); - } - - /** Add a feature to the table - * @param value the value to store for that feature - * @param feature the feature itself - */ - void add(unsigned int value, const ElementType* feature) - { - // Add the value to the corresponding bucket - BucketKey key = (lsh::BucketKey)getKey(feature); - - switch (speed_level_) { - case kArray: - // That means we get the buckets from an array - buckets_speed_[key].push_back(value); - break; - case kBitsetHash: - // That means we can check the bitset for the presence of a key - key_bitset_.set(key); - buckets_space_[key].push_back(value); - break; - case kHash: - { - // That means we have to check for the hash table for the presence of a key - buckets_space_[key].push_back(value); - break; - } - } - } - - /** Add a set of features to the table - * @param dataset the values to store - */ - void add(Matrix dataset) - { -#if USE_UNORDERED_MAP - buckets_space_.rehash((buckets_space_.size() + dataset.rows) * 1.2); -#endif - // Add the features to the table - for (unsigned int i = 0; i < dataset.rows; ++i) add(i, dataset[i]); - // Now that the table is full, optimize it for speed/space - optimize(); - } - - /** Get a bucket given the key - * @param key - * @return - */ - inline const Bucket* getBucketFromKey(BucketKey key) const - { - // Generate other buckets - switch (speed_level_) { - case kArray: - // That means we get the buckets from an array - return &buckets_speed_[key]; - break; - case kBitsetHash: - // That means we can check the bitset for the presence of a key - if (key_bitset_.test(key)) return &buckets_space_.find(key)->second; - else return 0; - break; - case kHash: - { - // That means we have to check for the hash table for the presence of a key - BucketsSpace::const_iterator bucket_it, bucket_end = buckets_space_.end(); - bucket_it = buckets_space_.find(key); - // Stop here if that bucket does not exist - if (bucket_it == bucket_end) return 0; - else return &bucket_it->second; - break; - } - } - return 0; - } - - /** Compute the sub-signature of a feature - */ - size_t getKey(const ElementType* /*feature*/) const - { - std::cerr << "LSH is not implemented for that type" << std::endl; - assert(0); - return 1; - } - - /** Get statistics about the table - * @return - */ - LshStats getStats() const; - -private: - /** defines the speed fo the implementation - * kArray uses a vector for storing data - * kBitsetHash uses a hash map but checks for the validity of a key with a bitset - * kHash uses a hash map only - */ - enum SpeedLevel - { - kArray, kBitsetHash, kHash - }; - - /** Initialize some variables - */ - void initialize(size_t key_size) - { - const size_t key_size_lower_bound = 1; - //a value (size_t(1) << key_size) must fit the size_t type so key_size has to be strictly less than size of size_t - const size_t key_size_upper_bound = (std::min)(sizeof(BucketKey) * CHAR_BIT + 1, sizeof(size_t) * CHAR_BIT); - if (key_size < key_size_lower_bound || key_size >= key_size_upper_bound) - { - CV_Error(cv::Error::StsBadArg, cv::format("Invalid key_size (=%d). Valid values for your system are %d <= key_size < %d.", (int)key_size, (int)key_size_lower_bound, (int)key_size_upper_bound)); - } - - speed_level_ = kHash; - key_size_ = (unsigned)key_size; - } - - /** Optimize the table for speed/space - */ - void optimize() - { - // If we are already using the fast storage, no need to do anything - if (speed_level_ == kArray) return; - - // Use an array if it will be more than half full - if (buckets_space_.size() > ((size_t(1) << key_size_) / 2)) { - speed_level_ = kArray; - // Fill the array version of it - buckets_speed_.resize(size_t(1) << key_size_); - for (BucketsSpace::const_iterator key_bucket = buckets_space_.begin(); key_bucket != buckets_space_.end(); ++key_bucket) buckets_speed_[key_bucket->first] = key_bucket->second; - - // Empty the hash table - buckets_space_.clear(); - return; - } - - // If the bitset is going to use less than 10% of the RAM of the hash map (at least 1 size_t for the key and two - // for the vector) or less than 512MB (key_size_ <= 30) - if (((std::max(buckets_space_.size(), buckets_speed_.size()) * CHAR_BIT * 3 * sizeof(BucketKey)) / 10 - >= (size_t(1) << key_size_)) || (key_size_ <= 32)) { - speed_level_ = kBitsetHash; - key_bitset_.resize(size_t(1) << key_size_); - key_bitset_.reset(); - // Try with the BucketsSpace - for (BucketsSpace::const_iterator key_bucket = buckets_space_.begin(); key_bucket != buckets_space_.end(); ++key_bucket) key_bitset_.set(key_bucket->first); - } - else { - speed_level_ = kHash; - key_bitset_.clear(); - } - } - - /** The vector of all the buckets if they are held for speed - */ - BucketsSpeed buckets_speed_; - - /** The hash table of all the buckets in case we cannot use the speed version - */ - BucketsSpace buckets_space_; - - /** What is used to store the data */ - SpeedLevel speed_level_; - - /** If the subkey is small enough, it will keep track of which subkeys are set through that bitset - * That is just a speedup so that we don't look in the hash table (which can be mush slower that checking a bitset) - */ - DynamicBitset key_bitset_; - - /** The size of the sub-signature in bits - */ - unsigned int key_size_; - - unsigned int feature_size_; - - // Members only used for the unsigned char specialization - /** The mask to apply to a feature to get the hash key - * Only used in the unsigned char case - */ - std::vector mask_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Specialization for unsigned char - -template<> -inline LshTable::LshTable(unsigned int feature_size, unsigned int subsignature_size) -{ - feature_size_ = feature_size; - initialize(subsignature_size); - // Allocate the mask - mask_ = std::vector((feature_size * sizeof(char) + sizeof(size_t) - 1) / sizeof(size_t), 0); - - // A bit brutal but fast to code - std::vector indices(feature_size * CHAR_BIT); - for (size_t i = 0; i < feature_size * CHAR_BIT; ++i) indices[i] = (int)i; -#ifndef OPENCV_FLANN_USE_STD_RAND - cv::randShuffle(indices); -#else - std::random_shuffle(indices.begin(), indices.end()); -#endif - - // Generate a random set of order of subsignature_size_ bits - for (unsigned int i = 0; i < key_size_; ++i) { - size_t index = indices[i]; - - // Set that bit in the mask - size_t divisor = CHAR_BIT * sizeof(size_t); - size_t idx = index / divisor; //pick the right size_t index - mask_[idx] |= size_t(1) << (index % divisor); //use modulo to find the bit offset - } - - // Set to 1 if you want to display the mask for debug -#if 0 - { - size_t bcount = 0; - BOOST_FOREACH(size_t mask_block, mask_){ - out << std::setw(sizeof(size_t) * CHAR_BIT / 4) << std::setfill('0') << std::hex << mask_block - << std::endl; - bcount += __builtin_popcountll(mask_block); - } - out << "bit count : " << std::dec << bcount << std::endl; - out << "mask size : " << mask_.size() << std::endl; - return out; - } -#endif -} - -/** Return the Subsignature of a feature - * @param feature the feature to analyze - */ -template<> -inline size_t LshTable::getKey(const unsigned char* feature) const -{ - // no need to check if T is dividable by sizeof(size_t) like in the Hamming - // distance computation as we have a mask - // FIXIT: This is bad assumption, because we reading tail bytes after of the allocated features buffer - const size_t* feature_block_ptr = reinterpret_cast ((const void*)feature); - - // Figure out the subsignature of the feature - // Given the feature ABCDEF, and the mask 001011, the output will be - // 000CEF - size_t subsignature = 0; - size_t bit_index = 1; - - for (unsigned i = 0; i < feature_size_; i += sizeof(size_t)) { - // get the mask and signature blocks - size_t feature_block; - if (i <= feature_size_ - sizeof(size_t)) - { - feature_block = *feature_block_ptr; - } - else - { - size_t tmp = 0; - memcpy(&tmp, feature_block_ptr, feature_size_ - i); // preserve bytes order - feature_block = tmp; - } - size_t mask_block = mask_[i / sizeof(size_t)]; - while (mask_block) { - // Get the lowest set bit in the mask block - size_t lowest_bit = mask_block & (-(ptrdiff_t)mask_block); - // Add it to the current subsignature if necessary - subsignature += (feature_block & lowest_bit) ? bit_index : 0; - // Reset the bit in the mask block - mask_block ^= lowest_bit; - // increment the bit index for the subsignature - bit_index <<= 1; - } - // Check the next feature block - ++feature_block_ptr; - } - return subsignature; -} - -template<> -inline LshStats LshTable::getStats() const -{ - LshStats stats; - stats.bucket_size_mean_ = 0; - if ((buckets_speed_.empty()) && (buckets_space_.empty())) { - stats.n_buckets_ = 0; - stats.bucket_size_median_ = 0; - stats.bucket_size_min_ = 0; - stats.bucket_size_max_ = 0; - return stats; - } - - if (!buckets_speed_.empty()) { - for (BucketsSpeed::const_iterator pbucket = buckets_speed_.begin(); pbucket != buckets_speed_.end(); ++pbucket) { - stats.bucket_sizes_.push_back((lsh::FeatureIndex)pbucket->size()); - stats.bucket_size_mean_ += pbucket->size(); - } - stats.bucket_size_mean_ /= buckets_speed_.size(); - stats.n_buckets_ = buckets_speed_.size(); - } - else { - for (BucketsSpace::const_iterator x = buckets_space_.begin(); x != buckets_space_.end(); ++x) { - stats.bucket_sizes_.push_back((lsh::FeatureIndex)x->second.size()); - stats.bucket_size_mean_ += x->second.size(); - } - stats.bucket_size_mean_ /= buckets_space_.size(); - stats.n_buckets_ = buckets_space_.size(); - } - - std::sort(stats.bucket_sizes_.begin(), stats.bucket_sizes_.end()); - - // BOOST_FOREACH(int size, stats.bucket_sizes_) - // std::cout << size << " "; - // std::cout << std::endl; - stats.bucket_size_median_ = stats.bucket_sizes_[stats.bucket_sizes_.size() / 2]; - stats.bucket_size_min_ = stats.bucket_sizes_.front(); - stats.bucket_size_max_ = stats.bucket_sizes_.back(); - - // TODO compute mean and std - /*float mean, stddev; - stats.bucket_size_mean_ = mean; - stats.bucket_size_std_dev = stddev;*/ - - // Include a histogram of the buckets - unsigned int bin_start = 0; - unsigned int bin_end = 20; - bool is_new_bin = true; - for (std::vector::iterator iterator = stats.bucket_sizes_.begin(), end = stats.bucket_sizes_.end(); iterator - != end; ) - if (*iterator < bin_end) { - if (is_new_bin) { - stats.size_histogram_.push_back(std::vector(3, 0)); - stats.size_histogram_.back()[0] = bin_start; - stats.size_histogram_.back()[1] = bin_end - 1; - is_new_bin = false; - } - ++stats.size_histogram_.back()[2]; - ++iterator; - } - else { - bin_start += 20; - bin_end += 20; - is_new_bin = true; - } - - return stats; -} - -// End the two namespaces -} -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -#endif /* OPENCV_FLANN_LSH_TABLE_H_ */ diff --git a/opencv/include/opencv2/flann/matrix.h b/opencv/include/opencv2/flann/matrix.h deleted file mode 100644 index f6092d1..0000000 --- a/opencv/include/opencv2/flann/matrix.h +++ /dev/null @@ -1,116 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_DATASET_H_ -#define OPENCV_FLANN_DATASET_H_ - -#include - -#include "general.h" - -namespace cvflann -{ - -/** - * Class that implements a simple rectangular matrix stored in a memory buffer and - * provides convenient matrix-like access using the [] operators. - */ -template -class Matrix -{ -public: - typedef T type; - - size_t rows; - size_t cols; - size_t stride; - T* data; - - Matrix() : rows(0), cols(0), stride(0), data(NULL) - { - } - - Matrix(T* data_, size_t rows_, size_t cols_, size_t stride_ = 0) : - rows(rows_), cols(cols_), stride(stride_), data(data_) - { - if (stride==0) stride = cols; - } - - /** - * Convenience function for deallocating the storage data. - */ - CV_DEPRECATED void free() - { - fprintf(stderr, "The cvflann::Matrix::free() method is deprecated " - "and it does not do any memory deallocation any more. You are" - "responsible for deallocating the matrix memory (by doing" - "'delete[] matrix.data' for example)"); - } - - /** - * Operator that return a (pointer to a) row of the data. - */ - T* operator[](size_t index) const - { - return data+index*stride; - } -}; - - -class UntypedMatrix -{ -public: - size_t rows; - size_t cols; - void* data; - flann_datatype_t type; - - UntypedMatrix(void* data_, long rows_, long cols_) : - rows(rows_), cols(cols_), data(data_) - { - } - - ~UntypedMatrix() - { - } - - - template - Matrix as() - { - return Matrix((T*)data, rows, cols); - } -}; - - - -} - -#endif //OPENCV_FLANN_DATASET_H_ diff --git a/opencv/include/opencv2/flann/miniflann.hpp b/opencv/include/opencv2/flann/miniflann.hpp deleted file mode 100644 index bda2ed4..0000000 --- a/opencv/include/opencv2/flann/miniflann.hpp +++ /dev/null @@ -1,162 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_MINIFLANN_HPP -#define OPENCV_MINIFLANN_HPP - -#include "opencv2/core.hpp" -#include "opencv2/flann/defines.h" - -namespace cv -{ - -namespace flann -{ - -struct CV_EXPORTS IndexParams -{ - IndexParams(); - ~IndexParams(); - - String getString(const String& key, const String& defaultVal=String()) const; - int getInt(const String& key, int defaultVal=-1) const; - double getDouble(const String& key, double defaultVal=-1) const; - - void setString(const String& key, const String& value); - void setInt(const String& key, int value); - void setDouble(const String& key, double value); - void setFloat(const String& key, float value); - void setBool(const String& key, bool value); - void setAlgorithm(int value); - - void getAll(std::vector& names, - std::vector& types, - std::vector& strValues, - std::vector& numValues) const; - - void* params; - -private: - IndexParams(const IndexParams &); // copy disabled - IndexParams& operator=(const IndexParams &); // assign disabled -}; - -struct CV_EXPORTS KDTreeIndexParams : public IndexParams -{ - KDTreeIndexParams(int trees=4); -}; - -struct CV_EXPORTS LinearIndexParams : public IndexParams -{ - LinearIndexParams(); -}; - -struct CV_EXPORTS CompositeIndexParams : public IndexParams -{ - CompositeIndexParams(int trees = 4, int branching = 32, int iterations = 11, - cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, float cb_index = 0.2f ); -}; - -struct CV_EXPORTS AutotunedIndexParams : public IndexParams -{ - AutotunedIndexParams(float target_precision = 0.8f, float build_weight = 0.01f, - float memory_weight = 0, float sample_fraction = 0.1f); -}; - -struct CV_EXPORTS HierarchicalClusteringIndexParams : public IndexParams -{ - HierarchicalClusteringIndexParams(int branching = 32, - cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, int trees = 4, int leaf_size = 100 ); -}; - -struct CV_EXPORTS KMeansIndexParams : public IndexParams -{ - KMeansIndexParams(int branching = 32, int iterations = 11, - cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, float cb_index = 0.2f ); -}; - -struct CV_EXPORTS LshIndexParams : public IndexParams -{ - LshIndexParams(int table_number, int key_size, int multi_probe_level); -}; - -struct CV_EXPORTS SavedIndexParams : public IndexParams -{ - SavedIndexParams(const String& filename); -}; - -struct CV_EXPORTS SearchParams : public IndexParams -{ - SearchParams( int checks = 32, float eps = 0, bool sorted = true ); -}; - -class CV_EXPORTS_W Index -{ -public: - CV_WRAP Index(); - CV_WRAP Index(InputArray features, const IndexParams& params, cvflann::flann_distance_t distType=cvflann::FLANN_DIST_L2); - virtual ~Index(); - - CV_WRAP virtual void build(InputArray features, const IndexParams& params, cvflann::flann_distance_t distType=cvflann::FLANN_DIST_L2); - CV_WRAP virtual void knnSearch(InputArray query, OutputArray indices, - OutputArray dists, int knn, const SearchParams& params=SearchParams()); - - CV_WRAP virtual int radiusSearch(InputArray query, OutputArray indices, - OutputArray dists, double radius, int maxResults, - const SearchParams& params=SearchParams()); - - CV_WRAP virtual void save(const String& filename) const; - CV_WRAP virtual bool load(InputArray features, const String& filename); - CV_WRAP virtual void release(); - CV_WRAP cvflann::flann_distance_t getDistance() const; - CV_WRAP cvflann::flann_algorithm_t getAlgorithm() const; - -protected: - cvflann::flann_distance_t distType; - cvflann::flann_algorithm_t algo; - int featureType; - void* index; -}; - -} } // namespace cv::flann - -#endif diff --git a/opencv/include/opencv2/flann/nn_index.h b/opencv/include/opencv2/flann/nn_index.h deleted file mode 100644 index 381d4bc..0000000 --- a/opencv/include/opencv2/flann/nn_index.h +++ /dev/null @@ -1,177 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_NNINDEX_H -#define OPENCV_FLANN_NNINDEX_H - -#include "general.h" -#include "matrix.h" -#include "result_set.h" -#include "params.h" - -namespace cvflann -{ - -/** - * Nearest-neighbour index base class - */ -template -class NNIndex -{ - typedef typename Distance::ElementType ElementType; - typedef typename Distance::ResultType DistanceType; - -public: - - virtual ~NNIndex() {} - - /** - * \brief Builds the index - */ - virtual void buildIndex() = 0; - - /** - * \brief Perform k-nearest neighbor search - * \param[in] queries The query points for which to find the nearest neighbors - * \param[out] indices The indices of the nearest neighbors found - * \param[out] dists Distances to the nearest neighbors found - * \param[in] knn Number of nearest neighbors to return - * \param[in] params Search parameters - */ - virtual void knnSearch(const Matrix& queries, Matrix& indices, Matrix& dists, int knn, const SearchParams& params) - { - assert(queries.cols == veclen()); - assert(indices.rows >= queries.rows); - assert(dists.rows >= queries.rows); - assert(int(indices.cols) >= knn); - assert(int(dists.cols) >= knn); - -#if 0 - KNNResultSet resultSet(knn); - for (size_t i = 0; i < queries.rows; i++) { - resultSet.init(indices[i], dists[i]); - findNeighbors(resultSet, queries[i], params); - } -#else - KNNUniqueResultSet resultSet(knn); - for (size_t i = 0; i < queries.rows; i++) { - resultSet.clear(); - findNeighbors(resultSet, queries[i], params); - if (get_param(params,"sorted",true)) resultSet.sortAndCopy(indices[i], dists[i], knn); - else resultSet.copy(indices[i], dists[i], knn); - } -#endif - } - - /** - * \brief Perform radius search - * \param[in] query The query point - * \param[out] indices The indinces of the neighbors found within the given radius - * \param[out] dists The distances to the nearest neighbors found - * \param[in] radius The radius used for search - * \param[in] params Search parameters - * \returns Number of neighbors found - */ - virtual int radiusSearch(const Matrix& query, Matrix& indices, Matrix& dists, float radius, const SearchParams& params) - { - if (query.rows != 1) { - fprintf(stderr, "I can only search one feature at a time for range search\n"); - return -1; - } - assert(query.cols == veclen()); - assert(indices.cols == dists.cols); - - int n = 0; - int* indices_ptr = NULL; - DistanceType* dists_ptr = NULL; - if (indices.cols > 0) { - n = (int)indices.cols; - indices_ptr = indices[0]; - dists_ptr = dists[0]; - } - - RadiusUniqueResultSet resultSet((DistanceType)radius); - resultSet.clear(); - findNeighbors(resultSet, query[0], params); - if (n>0) { - if (get_param(params,"sorted",true)) resultSet.sortAndCopy(indices_ptr, dists_ptr, n); - else resultSet.copy(indices_ptr, dists_ptr, n); - } - - return (int)resultSet.size(); - } - - /** - * \brief Saves the index to a stream - * \param stream The stream to save the index to - */ - virtual void saveIndex(FILE* stream) = 0; - - /** - * \brief Loads the index from a stream - * \param stream The stream from which the index is loaded - */ - virtual void loadIndex(FILE* stream) = 0; - - /** - * \returns number of features in this index. - */ - virtual size_t size() const = 0; - - /** - * \returns The dimensionality of the features in this index. - */ - virtual size_t veclen() const = 0; - - /** - * \returns The amount of memory (in bytes) used by the index. - */ - virtual int usedMemory() const = 0; - - /** - * \returns The index type (kdtree, kmeans,...) - */ - virtual flann_algorithm_t getType() const = 0; - - /** - * \returns The index parameters - */ - virtual IndexParams getParameters() const = 0; - - - /** - * \brief Method that searches for nearest-neighbours - */ - virtual void findNeighbors(ResultSet& result, const ElementType* vec, const SearchParams& searchParams) = 0; -}; - -} - -#endif //OPENCV_FLANN_NNINDEX_H diff --git a/opencv/include/opencv2/flann/object_factory.h b/opencv/include/opencv2/flann/object_factory.h deleted file mode 100644 index 7f971c5..0000000 --- a/opencv/include/opencv2/flann/object_factory.h +++ /dev/null @@ -1,91 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_OBJECT_FACTORY_H_ -#define OPENCV_FLANN_OBJECT_FACTORY_H_ - -#include - -namespace cvflann -{ - -class CreatorNotFound -{ -}; - -template -class ObjectFactory -{ - typedef ObjectFactory ThisClass; - typedef std::map ObjectRegistry; - - // singleton class, private constructor - ObjectFactory() {} - -public: - - bool subscribe(UniqueIdType id, ObjectCreator creator) - { - if (object_registry.find(id) != object_registry.end()) return false; - - object_registry[id] = creator; - return true; - } - - bool unregister(UniqueIdType id) - { - return object_registry.erase(id) == 1; - } - - ObjectCreator create(UniqueIdType id) - { - typename ObjectRegistry::const_iterator iter = object_registry.find(id); - - if (iter == object_registry.end()) { - throw CreatorNotFound(); - } - - return iter->second; - } - - static ThisClass& instance() - { - static ThisClass the_factory; - return the_factory; - } -private: - ObjectRegistry object_registry; -}; - -} - -#endif /* OPENCV_FLANN_OBJECT_FACTORY_H_ */ diff --git a/opencv/include/opencv2/flann/params.h b/opencv/include/opencv2/flann/params.h deleted file mode 100644 index 95ef4cd..0000000 --- a/opencv/include/opencv2/flann/params.h +++ /dev/null @@ -1,99 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2011 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2011 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - - -#ifndef OPENCV_FLANN_PARAMS_H_ -#define OPENCV_FLANN_PARAMS_H_ - -#include "any.h" -#include "general.h" -#include -#include - - -namespace cvflann -{ - -typedef std::map IndexParams; - -struct SearchParams : public IndexParams -{ - SearchParams(int checks = 32, float eps = 0, bool sorted = true ) - { - // how many leafs to visit when searching for neighbours (-1 for unlimited) - (*this)["checks"] = checks; - // search for eps-approximate neighbours (default: 0) - (*this)["eps"] = eps; - // only for radius search, require neighbours sorted by distance (default: true) - (*this)["sorted"] = sorted; - } -}; - - -template -T get_param(const IndexParams& params, cv::String name, const T& default_value) -{ - IndexParams::const_iterator it = params.find(name); - if (it != params.end()) { - return it->second.cast(); - } - else { - return default_value; - } -} - -template -T get_param(const IndexParams& params, cv::String name) -{ - IndexParams::const_iterator it = params.find(name); - if (it != params.end()) { - return it->second.cast(); - } - else { - throw FLANNException(cv::String("Missing parameter '")+name+cv::String("' in the parameters given")); - } -} - -inline void print_params(const IndexParams& params, std::ostream& stream) -{ - IndexParams::const_iterator it; - - for(it=params.begin(); it!=params.end(); ++it) { - stream << it->first << " : " << it->second << std::endl; - } -} - -inline void print_params(const IndexParams& params) -{ - print_params(params, std::cout); -} - -} - - -#endif /* OPENCV_FLANN_PARAMS_H_ */ diff --git a/opencv/include/opencv2/flann/random.h b/opencv/include/opencv2/flann/random.h deleted file mode 100644 index d678474..0000000 --- a/opencv/include/opencv2/flann/random.h +++ /dev/null @@ -1,155 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_RANDOM_H -#define OPENCV_FLANN_RANDOM_H - -#include -#include -#include - -#include "general.h" - -namespace cvflann -{ - -inline int rand() -{ -#ifndef OPENCV_FLANN_USE_STD_RAND -# if INT_MAX == RAND_MAX - int v = cv::theRNG().next() & INT_MAX; -# else - int v = cv::theRNG().uniform(0, RAND_MAX + 1); -# endif -#else - int v = std::rand(); -#endif // OPENCV_FLANN_USE_STD_RAND - return v; -} - -/** - * Seeds the random number generator - * @param seed Random seed - */ -inline void seed_random(unsigned int seed) -{ -#ifndef OPENCV_FLANN_USE_STD_RAND - cv::theRNG() = cv::RNG(seed); -#else - std::srand(seed); -#endif -} - -/* - * Generates a random double value. - */ -/** - * Generates a random double value. - * @param high Upper limit - * @param low Lower limit - * @return Random double value - */ -inline double rand_double(double high = 1.0, double low = 0) -{ - return low + ((high-low) * (rand() / (RAND_MAX + 1.0))); -} - -/** - * Generates a random integer value. - * @param high Upper limit - * @param low Lower limit - * @return Random integer value - */ -inline int rand_int(int high = RAND_MAX, int low = 0) -{ - return low + (int) ( double(high-low) * (rand() / (RAND_MAX + 1.0))); -} - -/** - * Random number generator that returns a distinct number from - * the [0,n) interval each time. - */ -class UniqueRandom -{ - std::vector vals_; - int size_; - int counter_; - -public: - /** - * Constructor. - * @param n Size of the interval from which to generate - * @return - */ - UniqueRandom(int n) - { - init(n); - } - - /** - * Initializes the number generator. - * @param n the size of the interval from which to generate random numbers. - */ - void init(int n) - { - // create and initialize an array of size n - vals_.resize(n); - size_ = n; - for (int i = 0; i < size_; ++i) vals_[i] = i; - - // shuffle the elements in the array -#ifndef OPENCV_FLANN_USE_STD_RAND - cv::randShuffle(vals_); -#else - std::random_shuffle(vals_.begin(), vals_.end()); -#endif - - counter_ = 0; - } - - /** - * Return a distinct random integer in greater or equal to 0 and less - * than 'n' on each call. It should be called maximum 'n' times. - * Returns: a random integer - */ - int next() - { - if (counter_ == size_) { - return -1; - } - else { - return vals_[counter_++]; - } - } -}; - -} - -#endif //OPENCV_FLANN_RANDOM_H diff --git a/opencv/include/opencv2/flann/result_set.h b/opencv/include/opencv2/flann/result_set.h deleted file mode 100644 index 5c69ac2..0000000 --- a/opencv/include/opencv2/flann/result_set.h +++ /dev/null @@ -1,543 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_RESULTSET_H -#define OPENCV_FLANN_RESULTSET_H - -#include -#include -#include -#include -#include -#include - -namespace cvflann -{ - -/* This record represents a branch point when finding neighbors in - the tree. It contains a record of the minimum distance to the query - point, as well as the node at which the search resumes. - */ - -template -struct BranchStruct -{ - T node; /* Tree node at which search resumes */ - DistanceType mindist; /* Minimum distance to query for all nodes below. */ - - BranchStruct() {} - BranchStruct(const T& aNode, DistanceType dist) : node(aNode), mindist(dist) {} - - bool operator<(const BranchStruct& rhs) const - { - return mindist -class ResultSet -{ -public: - virtual ~ResultSet() {} - - virtual bool full() const = 0; - - virtual void addPoint(DistanceType dist, int index) = 0; - - virtual DistanceType worstDist() const = 0; - -}; - -/** - * KNNSimpleResultSet does not ensure that the element it holds are unique. - * Is used in those cases where the nearest neighbour algorithm used does not - * attempt to insert the same element multiple times. - */ -template -class KNNSimpleResultSet : public ResultSet -{ - int* indices; - DistanceType* dists; - int capacity; - int count; - DistanceType worst_distance_; - -public: - KNNSimpleResultSet(int capacity_) : capacity(capacity_), count(0) - { - } - - void init(int* indices_, DistanceType* dists_) - { - indices = indices_; - dists = dists_; - count = 0; - worst_distance_ = (std::numeric_limits::max)(); - dists[capacity-1] = worst_distance_; - } - - size_t size() const - { - return count; - } - - bool full() const CV_OVERRIDE - { - return count == capacity; - } - - - void addPoint(DistanceType dist, int index) CV_OVERRIDE - { - if (dist >= worst_distance_) return; - int i; - for (i=count; i>0; --i) { -#ifdef FLANN_FIRST_MATCH - if ( (dists[i-1]>dist) || ((dist==dists[i-1])&&(indices[i-1]>index)) ) -#else - if (dists[i-1]>dist) -#endif - { - if (i -class KNNResultSet : public ResultSet -{ - int* indices; - DistanceType* dists; - int capacity; - int count; - DistanceType worst_distance_; - -public: - KNNResultSet(int capacity_) : capacity(capacity_), count(0) - { - } - - void init(int* indices_, DistanceType* dists_) - { - indices = indices_; - dists = dists_; - count = 0; - worst_distance_ = (std::numeric_limits::max)(); - dists[capacity-1] = worst_distance_; - } - - size_t size() const - { - return count; - } - - bool full() const CV_OVERRIDE - { - return count == capacity; - } - - - void addPoint(DistanceType dist, int index) CV_OVERRIDE - { - if (dist >= worst_distance_) return; - int i; - for (i = count; i > 0; --i) { -#ifdef FLANN_FIRST_MATCH - if ( (dists[i-1]<=dist) && ((dist!=dists[i-1])||(indices[i-1]<=index)) ) -#else - if (dists[i-1]<=dist) -#endif - { - // Check for duplicate indices - int j = i - 1; - while ((j >= 0) && (dists[j] == dist)) { - if (indices[j] == index) { - return; - } - --j; - } - break; - } - } - - if (count < capacity) ++count; - for (int j = count-1; j > i; --j) { - dists[j] = dists[j-1]; - indices[j] = indices[j-1]; - } - dists[i] = dist; - indices[i] = index; - worst_distance_ = dists[capacity-1]; - } - - DistanceType worstDist() const CV_OVERRIDE - { - return worst_distance_; - } -}; - - -/** - * A result-set class used when performing a radius based search. - */ -template -class RadiusResultSet : public ResultSet -{ - DistanceType radius; - int* indices; - DistanceType* dists; - size_t capacity; - size_t count; - -public: - RadiusResultSet(DistanceType radius_, int* indices_, DistanceType* dists_, int capacity_) : - radius(radius_), indices(indices_), dists(dists_), capacity(capacity_) - { - init(); - } - - ~RadiusResultSet() - { - } - - void init() - { - count = 0; - } - - size_t size() const - { - return count; - } - - bool full() const - { - return true; - } - - void addPoint(DistanceType dist, int index) - { - if (dist0)&&(count < capacity)) { - dists[count] = dist; - indices[count] = index; - } - count++; - } - } - - DistanceType worstDist() const - { - return radius; - } - -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** Class that holds the k NN neighbors - * Faster than KNNResultSet as it uses a binary heap and does not maintain two arrays - */ -template -class UniqueResultSet : public ResultSet -{ -public: - struct DistIndex - { - DistIndex(DistanceType dist, unsigned int index) : - dist_(dist), index_(index) - { - } - bool operator<(const DistIndex dist_index) const - { - return (dist_ < dist_index.dist_) || ((dist_ == dist_index.dist_) && index_ < dist_index.index_); - } - DistanceType dist_; - unsigned int index_; - }; - - /** Default cosntructor */ - UniqueResultSet() : - is_full_(false), worst_distance_(std::numeric_limits::max()) - { - } - - /** Check the status of the set - * @return true if we have k NN - */ - inline bool full() const CV_OVERRIDE - { - return is_full_; - } - - /** Remove all elements in the set - */ - virtual void clear() = 0; - - /** Copy the set to two C arrays - * @param indices pointer to a C array of indices - * @param dist pointer to a C array of distances - * @param n_neighbors the number of neighbors to copy - */ - virtual void copy(int* indices, DistanceType* dist, int n_neighbors = -1) const - { - if (n_neighbors < 0) { - for (typename std::set::const_iterator dist_index = dist_indices_.begin(), dist_index_end = - dist_indices_.end(); dist_index != dist_index_end; ++dist_index, ++indices, ++dist) { - *indices = dist_index->index_; - *dist = dist_index->dist_; - } - } - else { - int i = 0; - for (typename std::set::const_iterator dist_index = dist_indices_.begin(), dist_index_end = - dist_indices_.end(); (dist_index != dist_index_end) && (i < n_neighbors); ++dist_index, ++indices, ++dist, ++i) { - *indices = dist_index->index_; - *dist = dist_index->dist_; - } - } - } - - /** Copy the set to two C arrays but sort it according to the distance first - * @param indices pointer to a C array of indices - * @param dist pointer to a C array of distances - * @param n_neighbors the number of neighbors to copy - */ - virtual void sortAndCopy(int* indices, DistanceType* dist, int n_neighbors = -1) const - { - copy(indices, dist, n_neighbors); - } - - /** The number of neighbors in the set - * @return - */ - size_t size() const - { - return dist_indices_.size(); - } - - /** The distance of the furthest neighbor - * If we don't have enough neighbors, it returns the max possible value - * @return - */ - inline DistanceType worstDist() const CV_OVERRIDE - { - return worst_distance_; - } -protected: - /** Flag to say if the set is full */ - bool is_full_; - - /** The worst distance found so far */ - DistanceType worst_distance_; - - /** The best candidates so far */ - std::set dist_indices_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** Class that holds the k NN neighbors - * Faster than KNNResultSet as it uses a binary heap and does not maintain two arrays - */ -template -class KNNUniqueResultSet : public UniqueResultSet -{ -public: - /** Constructor - * @param capacity the number of neighbors to store at max - */ - KNNUniqueResultSet(unsigned int capacity) : capacity_(capacity) - { - this->is_full_ = false; - this->clear(); - } - - /** Add a possible candidate to the best neighbors - * @param dist distance for that neighbor - * @param index index of that neighbor - */ - inline void addPoint(DistanceType dist, int index) CV_OVERRIDE - { - // Don't do anything if we are worse than the worst - if (dist >= worst_distance_) return; - dist_indices_.insert(DistIndex(dist, index)); - - if (is_full_) { - if (dist_indices_.size() > capacity_) { - dist_indices_.erase(*dist_indices_.rbegin()); - worst_distance_ = dist_indices_.rbegin()->dist_; - } - } - else if (dist_indices_.size() == capacity_) { - is_full_ = true; - worst_distance_ = dist_indices_.rbegin()->dist_; - } - } - - /** Remove all elements in the set - */ - void clear() CV_OVERRIDE - { - dist_indices_.clear(); - worst_distance_ = std::numeric_limits::max(); - is_full_ = false; - } - -protected: - typedef typename UniqueResultSet::DistIndex DistIndex; - using UniqueResultSet::is_full_; - using UniqueResultSet::worst_distance_; - using UniqueResultSet::dist_indices_; - - /** The number of neighbors to keep */ - unsigned int capacity_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** Class that holds the radius nearest neighbors - * It is more accurate than RadiusResult as it is not limited in the number of neighbors - */ -template -class RadiusUniqueResultSet : public UniqueResultSet -{ -public: - /** Constructor - * @param radius the maximum distance of a neighbor - */ - RadiusUniqueResultSet(DistanceType radius) : - radius_(radius) - { - is_full_ = true; - } - - /** Add a possible candidate to the best neighbors - * @param dist distance for that neighbor - * @param index index of that neighbor - */ - void addPoint(DistanceType dist, int index) CV_OVERRIDE - { - if (dist <= radius_) dist_indices_.insert(DistIndex(dist, index)); - } - - /** Remove all elements in the set - */ - inline void clear() CV_OVERRIDE - { - dist_indices_.clear(); - } - - - /** Check the status of the set - * @return alwys false - */ - inline bool full() const CV_OVERRIDE - { - return true; - } - - /** The distance of the furthest neighbor - * If we don't have enough neighbors, it returns the max possible value - * @return - */ - inline DistanceType worstDist() const CV_OVERRIDE - { - return radius_; - } -private: - typedef typename UniqueResultSet::DistIndex DistIndex; - using UniqueResultSet::dist_indices_; - using UniqueResultSet::is_full_; - - /** The furthest distance a neighbor can be */ - DistanceType radius_; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** Class that holds the k NN neighbors within a radius distance - */ -template -class KNNRadiusUniqueResultSet : public KNNUniqueResultSet -{ -public: - /** Constructor - * @param capacity the number of neighbors to store at max - * @param radius the maximum distance of a neighbor - */ - KNNRadiusUniqueResultSet(unsigned int capacity, DistanceType radius) - { - this->capacity_ = capacity; - this->radius_ = radius; - this->dist_indices_.reserve(capacity_); - this->clear(); - } - - /** Remove all elements in the set - */ - void clear() - { - dist_indices_.clear(); - worst_distance_ = radius_; - is_full_ = false; - } -private: - using KNNUniqueResultSet::dist_indices_; - using KNNUniqueResultSet::is_full_; - using KNNUniqueResultSet::worst_distance_; - - /** The maximum number of neighbors to consider */ - unsigned int capacity_; - - /** The maximum distance of a neighbor */ - DistanceType radius_; -}; -} - -#endif //OPENCV_FLANN_RESULTSET_H diff --git a/opencv/include/opencv2/flann/sampling.h b/opencv/include/opencv2/flann/sampling.h deleted file mode 100644 index 396f177..0000000 --- a/opencv/include/opencv2/flann/sampling.h +++ /dev/null @@ -1,81 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - - -#ifndef OPENCV_FLANN_SAMPLING_H_ -#define OPENCV_FLANN_SAMPLING_H_ - -#include "matrix.h" -#include "random.h" - -namespace cvflann -{ - -template -Matrix random_sample(Matrix& srcMatrix, long size, bool remove = false) -{ - Matrix newSet(new T[size * srcMatrix.cols], size,srcMatrix.cols); - - T* src,* dest; - for (long i=0; i -Matrix random_sample(const Matrix& srcMatrix, size_t size) -{ - UniqueRandom rand((int)srcMatrix.rows); - Matrix newSet(new T[size * srcMatrix.cols], size,srcMatrix.cols); - - T* src,* dest; - for (size_t i=0; i -#include - -#include "general.h" -#include "nn_index.h" - -#ifdef FLANN_SIGNATURE_ -#undef FLANN_SIGNATURE_ -#endif -#define FLANN_SIGNATURE_ "FLANN_INDEX" - -namespace cvflann -{ - -template -struct Datatype {}; -template<> -struct Datatype { static flann_datatype_t type() { return FLANN_INT8; } }; -template<> -struct Datatype { static flann_datatype_t type() { return FLANN_INT16; } }; -template<> -struct Datatype { static flann_datatype_t type() { return FLANN_INT32; } }; -template<> -struct Datatype { static flann_datatype_t type() { return FLANN_UINT8; } }; -template<> -struct Datatype { static flann_datatype_t type() { return FLANN_UINT16; } }; -template<> -struct Datatype { static flann_datatype_t type() { return FLANN_UINT32; } }; -template<> -struct Datatype { static flann_datatype_t type() { return FLANN_FLOAT32; } }; -template<> -struct Datatype { static flann_datatype_t type() { return FLANN_FLOAT64; } }; - - -/** - * Structure representing the index header. - */ -struct IndexHeader -{ - char signature[16]; - char version[16]; - flann_datatype_t data_type; - flann_algorithm_t index_type; - size_t rows; - size_t cols; -}; - -/** - * Saves index header to stream - * - * @param stream - Stream to save to - * @param index - The index to save - */ -template -void save_header(FILE* stream, const NNIndex& index) -{ - IndexHeader header; - memset(header.signature, 0, sizeof(header.signature)); - strcpy(header.signature, FLANN_SIGNATURE_); - memset(header.version, 0, sizeof(header.version)); - strcpy(header.version, FLANN_VERSION_); - header.data_type = Datatype::type(); - header.index_type = index.getType(); - header.rows = index.size(); - header.cols = index.veclen(); - - std::fwrite(&header, sizeof(header),1,stream); -} - - -/** - * - * @param stream - Stream to load from - * @return Index header - */ -inline IndexHeader load_header(FILE* stream) -{ - IndexHeader header; - size_t read_size = fread(&header,sizeof(header),1,stream); - - if (read_size!=(size_t)1) { - throw FLANNException("Invalid index file, cannot read"); - } - - if (strcmp(header.signature,FLANN_SIGNATURE_)!=0) { - throw FLANNException("Invalid index file, wrong signature"); - } - - return header; - -} - - -template -void save_value(FILE* stream, const T& value, size_t count = 1) -{ - fwrite(&value, sizeof(value),count, stream); -} - -template -void save_value(FILE* stream, const cvflann::Matrix& value) -{ - fwrite(&value, sizeof(value),1, stream); - fwrite(value.data, sizeof(T),value.rows*value.cols, stream); -} - -template -void save_value(FILE* stream, const std::vector& value) -{ - size_t size = value.size(); - fwrite(&size, sizeof(size_t), 1, stream); - fwrite(&value[0], sizeof(T), size, stream); -} - -template -void load_value(FILE* stream, T& value, size_t count = 1) -{ - size_t read_cnt = fread(&value, sizeof(value), count, stream); - if (read_cnt != count) { - throw FLANNException("Cannot read from file"); - } -} - -template -void load_value(FILE* stream, cvflann::Matrix& value) -{ - size_t read_cnt = fread(&value, sizeof(value), 1, stream); - if (read_cnt != 1) { - throw FLANNException("Cannot read from file"); - } - value.data = new T[value.rows*value.cols]; - read_cnt = fread(value.data, sizeof(T), value.rows*value.cols, stream); - if (read_cnt != (size_t)(value.rows*value.cols)) { - throw FLANNException("Cannot read from file"); - } -} - - -template -void load_value(FILE* stream, std::vector& value) -{ - size_t size; - size_t read_cnt = fread(&size, sizeof(size_t), 1, stream); - if (read_cnt!=1) { - throw FLANNException("Cannot read from file"); - } - value.resize(size); - read_cnt = fread(&value[0], sizeof(T), size, stream); - if (read_cnt != size) { - throw FLANNException("Cannot read from file"); - } -} - -} - -#endif /* OPENCV_FLANN_SAVING_H_ */ diff --git a/opencv/include/opencv2/flann/simplex_downhill.h b/opencv/include/opencv2/flann/simplex_downhill.h deleted file mode 100644 index 145901a..0000000 --- a/opencv/include/opencv2/flann/simplex_downhill.h +++ /dev/null @@ -1,186 +0,0 @@ -/*********************************************************************** - * Software License Agreement (BSD License) - * - * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. - * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. - * - * THE BSD LICENSE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *************************************************************************/ - -#ifndef OPENCV_FLANN_SIMPLEX_DOWNHILL_H_ -#define OPENCV_FLANN_SIMPLEX_DOWNHILL_H_ - -namespace cvflann -{ - -/** - Adds val to array vals (and point to array points) and keeping the arrays sorted by vals. - */ -template -void addValue(int pos, float val, float* vals, T* point, T* points, int n) -{ - vals[pos] = val; - for (int i=0; i0 && vals[j] -float optimizeSimplexDownhill(T* points, int n, F func, float* vals = NULL ) -{ - const int MAX_ITERATIONS = 10; - - assert(n>0); - - T* p_o = new T[n]; - T* p_r = new T[n]; - T* p_e = new T[n]; - - int alpha = 1; - - int iterations = 0; - - bool ownVals = false; - if (vals == NULL) { - ownVals = true; - vals = new float[n+1]; - for (int i=0; i MAX_ITERATIONS) break; - - // compute average of simplex points (except the highest point) - for (int j=0; j=vals[0])&&(val_r=vals[n]) { - for (int i=0; i -#include "opencv2/core.hpp" -#include "opencv2/core/utility.hpp" - -namespace cvflann -{ - -/** - * A start-stop timer class. - * - * Can be used to time portions of code. - */ -class StartStopTimer -{ - int64 startTime; - -public: - /** - * Value of the timer. - */ - double value; - - - /** - * Constructor. - */ - StartStopTimer() - { - reset(); - } - - /** - * Starts the timer. - */ - void start() - { - startTime = cv::getTickCount(); - } - - /** - * Stops the timer and updates timer value. - */ - void stop() - { - int64 stopTime = cv::getTickCount(); - value += ( (double)stopTime - startTime) / cv::getTickFrequency(); - } - - /** - * Resets the timer value to 0. - */ - void reset() - { - value = 0; - } - -}; - -} - -#endif // FLANN_TIMER_H diff --git a/opencv/include/opencv2/highgui.hpp b/opencv/include/opencv2/highgui.hpp deleted file mode 100644 index 994a1d1..0000000 --- a/opencv/include/opencv2/highgui.hpp +++ /dev/null @@ -1,845 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_HIGHGUI_HPP -#define OPENCV_HIGHGUI_HPP - -#include "opencv2/core.hpp" -#ifdef HAVE_OPENCV_IMGCODECS -#include "opencv2/imgcodecs.hpp" -#endif -#ifdef HAVE_OPENCV_VIDEOIO -#include "opencv2/videoio.hpp" -#endif - -/** -@defgroup highgui High-level GUI - -While OpenCV was designed for use in full-scale applications and can be used within functionally -rich UI frameworks (such as Qt\*, WinForms\*, or Cocoa\*) or without any UI at all, sometimes there -it is required to try functionality quickly and visualize the results. This is what the HighGUI -module has been designed for. - -It provides easy interface to: - -- Create and manipulate windows that can display images and "remember" their content (no need to - handle repaint events from OS). -- Add trackbars to the windows, handle simple mouse events as well as keyboard commands. - -@{ - @defgroup highgui_opengl OpenGL support - @defgroup highgui_qt Qt New Functions - - ![image](pics/qtgui.png) - - This figure explains new functionality implemented with Qt\* GUI. The new GUI provides a statusbar, - a toolbar, and a control panel. The control panel can have trackbars and buttonbars attached to it. - If you cannot see the control panel, press Ctrl+P or right-click any Qt window and select **Display - properties window**. - - - To attach a trackbar, the window name parameter must be NULL. - - - To attach a buttonbar, a button must be created. If the last bar attached to the control panel - is a buttonbar, the new button is added to the right of the last button. If the last bar - attached to the control panel is a trackbar, or the control panel is empty, a new buttonbar is - created. Then, a new button is attached to it. - - See below the example used to generate the figure: - @code - int main(int argc, char *argv[]) - { - - int value = 50; - int value2 = 0; - - - namedWindow("main1",WINDOW_NORMAL); - namedWindow("main2",WINDOW_AUTOSIZE | CV_GUI_NORMAL); - createTrackbar( "track1", "main1", &value, 255, NULL); - - String nameb1 = "button1"; - String nameb2 = "button2"; - - createButton(nameb1,callbackButton,&nameb1,QT_CHECKBOX,1); - createButton(nameb2,callbackButton,NULL,QT_CHECKBOX,0); - createTrackbar( "track2", NULL, &value2, 255, NULL); - createButton("button5",callbackButton1,NULL,QT_RADIOBOX,0); - createButton("button6",callbackButton2,NULL,QT_RADIOBOX,1); - - setMouseCallback( "main2",on_mouse,NULL ); - - Mat img1 = imread("files/flower.jpg"); - VideoCapture video; - video.open("files/hockey.avi"); - - Mat img2,img3; - - while( waitKey(33) != 27 ) - { - img1.convertTo(img2,-1,1,value); - video >> img3; - - imshow("main1",img2); - imshow("main2",img3); - } - - destroyAllWindows(); - - return 0; - } - @endcode - - - @defgroup highgui_winrt WinRT support - - This figure explains new functionality implemented with WinRT GUI. The new GUI provides an Image control, - and a slider panel. Slider panel holds trackbars attached to it. - - Sliders are attached below the image control. Every new slider is added below the previous one. - - See below the example used to generate the figure: - @code - void sample_app::MainPage::ShowWindow() - { - static cv::String windowName("sample"); - cv::winrt_initContainer(this->cvContainer); - cv::namedWindow(windowName); // not required - - cv::Mat image = cv::imread("Assets/sample.jpg"); - cv::Mat converted = cv::Mat(image.rows, image.cols, CV_8UC4); - cv::cvtColor(image, converted, COLOR_BGR2BGRA); - cv::imshow(windowName, converted); // this will create window if it hasn't been created before - - int state = 42; - cv::TrackbarCallback callback = [](int pos, void* userdata) - { - if (pos == 0) { - cv::destroyWindow(windowName); - } - }; - cv::TrackbarCallback callbackTwin = [](int pos, void* userdata) - { - if (pos >= 70) { - cv::destroyAllWindows(); - } - }; - cv::createTrackbar("Sample trackbar", windowName, &state, 100, callback); - cv::createTrackbar("Twin brother", windowName, &state, 100, callbackTwin); - } - @endcode - - @defgroup highgui_c C API -@} -*/ - -///////////////////////// graphical user interface ////////////////////////// -namespace cv -{ - -//! @addtogroup highgui -//! @{ - -//! Flags for cv::namedWindow -enum WindowFlags { - WINDOW_NORMAL = 0x00000000, //!< the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size. - WINDOW_AUTOSIZE = 0x00000001, //!< the user cannot resize the window, the size is constrainted by the image displayed. - WINDOW_OPENGL = 0x00001000, //!< window with opengl support. - - WINDOW_FULLSCREEN = 1, //!< change the window to fullscreen. - WINDOW_FREERATIO = 0x00000100, //!< the image expends as much as it can (no ratio constraint). - WINDOW_KEEPRATIO = 0x00000000, //!< the ratio of the image is respected. - WINDOW_GUI_EXPANDED=0x00000000, //!< status bar and tool bar - WINDOW_GUI_NORMAL = 0x00000010, //!< old fashious way - }; - -//! Flags for cv::setWindowProperty / cv::getWindowProperty -enum WindowPropertyFlags { - WND_PROP_FULLSCREEN = 0, //!< fullscreen property (can be WINDOW_NORMAL or WINDOW_FULLSCREEN). - WND_PROP_AUTOSIZE = 1, //!< autosize property (can be WINDOW_NORMAL or WINDOW_AUTOSIZE). - WND_PROP_ASPECT_RATIO = 2, //!< window's aspect ration (can be set to WINDOW_FREERATIO or WINDOW_KEEPRATIO). - WND_PROP_OPENGL = 3, //!< opengl support. - WND_PROP_VISIBLE = 4 //!< checks whether the window exists and is visible - }; - -//! Mouse Events see cv::MouseCallback -enum MouseEventTypes { - EVENT_MOUSEMOVE = 0, //!< indicates that the mouse pointer has moved over the window. - EVENT_LBUTTONDOWN = 1, //!< indicates that the left mouse button is pressed. - EVENT_RBUTTONDOWN = 2, //!< indicates that the right mouse button is pressed. - EVENT_MBUTTONDOWN = 3, //!< indicates that the middle mouse button is pressed. - EVENT_LBUTTONUP = 4, //!< indicates that left mouse button is released. - EVENT_RBUTTONUP = 5, //!< indicates that right mouse button is released. - EVENT_MBUTTONUP = 6, //!< indicates that middle mouse button is released. - EVENT_LBUTTONDBLCLK = 7, //!< indicates that left mouse button is double clicked. - EVENT_RBUTTONDBLCLK = 8, //!< indicates that right mouse button is double clicked. - EVENT_MBUTTONDBLCLK = 9, //!< indicates that middle mouse button is double clicked. - EVENT_MOUSEWHEEL = 10,//!< positive and negative values mean forward and backward scrolling, respectively. - EVENT_MOUSEHWHEEL = 11 //!< positive and negative values mean right and left scrolling, respectively. - }; - -//! Mouse Event Flags see cv::MouseCallback -enum MouseEventFlags { - EVENT_FLAG_LBUTTON = 1, //!< indicates that the left mouse button is down. - EVENT_FLAG_RBUTTON = 2, //!< indicates that the right mouse button is down. - EVENT_FLAG_MBUTTON = 4, //!< indicates that the middle mouse button is down. - EVENT_FLAG_CTRLKEY = 8, //!< indicates that CTRL Key is pressed. - EVENT_FLAG_SHIFTKEY = 16,//!< indicates that SHIFT Key is pressed. - EVENT_FLAG_ALTKEY = 32 //!< indicates that ALT Key is pressed. - }; - -//! Qt font weight -enum QtFontWeights { - QT_FONT_LIGHT = 25, //!< Weight of 25 - QT_FONT_NORMAL = 50, //!< Weight of 50 - QT_FONT_DEMIBOLD = 63, //!< Weight of 63 - QT_FONT_BOLD = 75, //!< Weight of 75 - QT_FONT_BLACK = 87 //!< Weight of 87 - }; - -//! Qt font style -enum QtFontStyles { - QT_STYLE_NORMAL = 0, //!< Normal font. - QT_STYLE_ITALIC = 1, //!< Italic font. - QT_STYLE_OBLIQUE = 2 //!< Oblique font. - }; - -//! Qt "button" type -enum QtButtonTypes { - QT_PUSH_BUTTON = 0, //!< Push button. - QT_CHECKBOX = 1, //!< Checkbox button. - QT_RADIOBOX = 2, //!< Radiobox button. - QT_NEW_BUTTONBAR = 1024 //!< Button should create a new buttonbar - }; - -/** @brief Callback function for mouse events. see cv::setMouseCallback -@param event one of the cv::MouseEventTypes constants. -@param x The x-coordinate of the mouse event. -@param y The y-coordinate of the mouse event. -@param flags one of the cv::MouseEventFlags constants. -@param userdata The optional parameter. - */ -typedef void (*MouseCallback)(int event, int x, int y, int flags, void* userdata); - -/** @brief Callback function for Trackbar see cv::createTrackbar -@param pos current position of the specified trackbar. -@param userdata The optional parameter. - */ -typedef void (*TrackbarCallback)(int pos, void* userdata); - -/** @brief Callback function defined to be called every frame. See cv::setOpenGlDrawCallback -@param userdata The optional parameter. - */ -typedef void (*OpenGlDrawCallback)(void* userdata); - -/** @brief Callback function for a button created by cv::createButton -@param state current state of the button. It could be -1 for a push button, 0 or 1 for a check/radio box button. -@param userdata The optional parameter. - */ -typedef void (*ButtonCallback)(int state, void* userdata); - -/** @brief Creates a window. - -The function namedWindow creates a window that can be used as a placeholder for images and -trackbars. Created windows are referred to by their names. - -If a window with the same name already exists, the function does nothing. - -You can call cv::destroyWindow or cv::destroyAllWindows to close the window and de-allocate any associated -memory usage. For a simple program, you do not really have to call these functions because all the -resources and windows of the application are closed automatically by the operating system upon exit. - -@note - -Qt backend supports additional flags: - - **WINDOW_NORMAL or WINDOW_AUTOSIZE:** WINDOW_NORMAL enables you to resize the - window, whereas WINDOW_AUTOSIZE adjusts automatically the window size to fit the - displayed image (see imshow ), and you cannot change the window size manually. - - **WINDOW_FREERATIO or WINDOW_KEEPRATIO:** WINDOW_FREERATIO adjusts the image - with no respect to its ratio, whereas WINDOW_KEEPRATIO keeps the image ratio. - - **WINDOW_GUI_NORMAL or WINDOW_GUI_EXPANDED:** WINDOW_GUI_NORMAL is the old way to draw the window - without statusbar and toolbar, whereas WINDOW_GUI_EXPANDED is a new enhanced GUI. -By default, flags == WINDOW_AUTOSIZE | WINDOW_KEEPRATIO | WINDOW_GUI_EXPANDED - -@param winname Name of the window in the window caption that may be used as a window identifier. -@param flags Flags of the window. The supported flags are: (cv::WindowFlags) - */ -CV_EXPORTS_W void namedWindow(const String& winname, int flags = WINDOW_AUTOSIZE); - -/** @brief Destroys the specified window. - -The function destroyWindow destroys the window with the given name. - -@param winname Name of the window to be destroyed. - */ -CV_EXPORTS_W void destroyWindow(const String& winname); - -/** @brief Destroys all of the HighGUI windows. - -The function destroyAllWindows destroys all of the opened HighGUI windows. - */ -CV_EXPORTS_W void destroyAllWindows(); - -CV_EXPORTS_W int startWindowThread(); - -/** @brief Similar to #waitKey, but returns full key code. - -@note - -Key code is implementation specific and depends on used backend: QT/GTK/Win32/etc - -*/ -CV_EXPORTS_W int waitKeyEx(int delay = 0); - -/** @brief Waits for a pressed key. - -The function waitKey waits for a key event infinitely (when \f$\texttt{delay}\leq 0\f$ ) or for delay -milliseconds, when it is positive. Since the OS has a minimum time between switching threads, the -function will not wait exactly delay ms, it will wait at least delay ms, depending on what else is -running on your computer at that time. It returns the code of the pressed key or -1 if no key was -pressed before the specified time had elapsed. - -@note - -This function is the only method in HighGUI that can fetch and handle events, so it needs to be -called periodically for normal event processing unless HighGUI is used within an environment that -takes care of event processing. - -@note - -The function only works if there is at least one HighGUI window created and the window is active. -If there are several HighGUI windows, any of them can be active. - -@param delay Delay in milliseconds. 0 is the special value that means "forever". - */ -CV_EXPORTS_W int waitKey(int delay = 0); - -/** @brief Displays an image in the specified window. - -The function imshow displays an image in the specified window. If the window was created with the -cv::WINDOW_AUTOSIZE flag, the image is shown with its original size, however it is still limited by the screen resolution. -Otherwise, the image is scaled to fit the window. The function may scale the image, depending on its depth: - -- If the image is 8-bit unsigned, it is displayed as is. -- If the image is 16-bit unsigned or 32-bit integer, the pixels are divided by 256. That is, the - value range [0,255\*256] is mapped to [0,255]. -- If the image is 32-bit or 64-bit floating-point, the pixel values are multiplied by 255. That is, the - value range [0,1] is mapped to [0,255]. - -If window was created with OpenGL support, cv::imshow also support ogl::Buffer , ogl::Texture2D and -cuda::GpuMat as input. - -If the window was not created before this function, it is assumed creating a window with cv::WINDOW_AUTOSIZE. - -If you need to show an image that is bigger than the screen resolution, you will need to call namedWindow("", WINDOW_NORMAL) before the imshow. - -@note This function should be followed by cv::waitKey function which displays the image for specified -milliseconds. Otherwise, it won't display the image. For example, **waitKey(0)** will display the window -infinitely until any keypress (it is suitable for image display). **waitKey(25)** will display a frame -for 25 ms, after which display will be automatically closed. (If you put it in a loop to read -videos, it will display the video frame-by-frame) - -@note - -[__Windows Backend Only__] Pressing Ctrl+C will copy the image to the clipboard. - -[__Windows Backend Only__] Pressing Ctrl+S will show a dialog to save the image. - -@param winname Name of the window. -@param mat Image to be shown. - */ -CV_EXPORTS_W void imshow(const String& winname, InputArray mat); - -/** @brief Resizes window to the specified size - -@note - -- The specified window size is for the image area. Toolbars are not counted. -- Only windows created without cv::WINDOW_AUTOSIZE flag can be resized. - -@param winname Window name. -@param width The new window width. -@param height The new window height. - */ -CV_EXPORTS_W void resizeWindow(const String& winname, int width, int height); - -/** @overload -@param winname Window name. -@param size The new window size. -*/ -CV_EXPORTS_W void resizeWindow(const String& winname, const cv::Size& size); - -/** @brief Moves window to the specified position - -@param winname Name of the window. -@param x The new x-coordinate of the window. -@param y The new y-coordinate of the window. - */ -CV_EXPORTS_W void moveWindow(const String& winname, int x, int y); - -/** @brief Changes parameters of a window dynamically. - -The function setWindowProperty enables changing properties of a window. - -@param winname Name of the window. -@param prop_id Window property to edit. The supported operation flags are: (cv::WindowPropertyFlags) -@param prop_value New value of the window property. The supported flags are: (cv::WindowFlags) - */ -CV_EXPORTS_W void setWindowProperty(const String& winname, int prop_id, double prop_value); - -/** @brief Updates window title -@param winname Name of the window. -@param title New title. -*/ -CV_EXPORTS_W void setWindowTitle(const String& winname, const String& title); - -/** @brief Provides parameters of a window. - -The function getWindowProperty returns properties of a window. - -@param winname Name of the window. -@param prop_id Window property to retrieve. The following operation flags are available: (cv::WindowPropertyFlags) - -@sa setWindowProperty - */ -CV_EXPORTS_W double getWindowProperty(const String& winname, int prop_id); - -/** @brief Provides rectangle of image in the window. - -The function getWindowImageRect returns the client screen coordinates, width and height of the image rendering area. - -@param winname Name of the window. - -@sa resizeWindow moveWindow - */ -CV_EXPORTS_W Rect getWindowImageRect(const String& winname); - -/** @example samples/cpp/create_mask.cpp -This program demonstrates using mouse events and how to make and use a mask image (black and white) . -*/ -/** @brief Sets mouse handler for the specified window - -@param winname Name of the window. -@param onMouse Callback function for mouse events. See OpenCV samples on how to specify and use the callback. -@param userdata The optional parameter passed to the callback. - */ -CV_EXPORTS void setMouseCallback(const String& winname, MouseCallback onMouse, void* userdata = 0); - -/** @brief Gets the mouse-wheel motion delta, when handling mouse-wheel events cv::EVENT_MOUSEWHEEL and -cv::EVENT_MOUSEHWHEEL. - -For regular mice with a scroll-wheel, delta will be a multiple of 120. The value 120 corresponds to -a one notch rotation of the wheel or the threshold for action to be taken and one such action should -occur for each delta. Some high-precision mice with higher-resolution freely-rotating wheels may -generate smaller values. - -For cv::EVENT_MOUSEWHEEL positive and negative values mean forward and backward scrolling, -respectively. For cv::EVENT_MOUSEHWHEEL, where available, positive and negative values mean right and -left scrolling, respectively. - -With the C API, the macro CV_GET_WHEEL_DELTA(flags) can be used alternatively. - -@note - -Mouse-wheel events are currently supported only on Windows. - -@param flags The mouse callback flags parameter. - */ -CV_EXPORTS int getMouseWheelDelta(int flags); - -/** @brief Selects ROI on the given image. -Function creates a window and allows user to select a ROI using mouse. -Controls: use `space` or `enter` to finish selection, use key `c` to cancel selection (function will return the zero cv::Rect). - -@param windowName name of the window where selection process will be shown. -@param img image to select a ROI. -@param showCrosshair if true crosshair of selection rectangle will be shown. -@param fromCenter if true center of selection will match initial mouse position. In opposite case a corner of -selection rectangle will correspont to the initial mouse position. -@return selected ROI or empty rect if selection canceled. - -@note The function sets it's own mouse callback for specified window using cv::setMouseCallback(windowName, ...). -After finish of work an empty callback will be set for the used window. - */ -CV_EXPORTS_W Rect selectROI(const String& windowName, InputArray img, bool showCrosshair = true, bool fromCenter = false); - -/** @overload - */ -CV_EXPORTS_W Rect selectROI(InputArray img, bool showCrosshair = true, bool fromCenter = false); - -/** @brief Selects ROIs on the given image. -Function creates a window and allows user to select a ROIs using mouse. -Controls: use `space` or `enter` to finish current selection and start a new one, -use `esc` to terminate multiple ROI selection process. - -@param windowName name of the window where selection process will be shown. -@param img image to select a ROI. -@param boundingBoxes selected ROIs. -@param showCrosshair if true crosshair of selection rectangle will be shown. -@param fromCenter if true center of selection will match initial mouse position. In opposite case a corner of -selection rectangle will correspont to the initial mouse position. - -@note The function sets it's own mouse callback for specified window using cv::setMouseCallback(windowName, ...). -After finish of work an empty callback will be set for the used window. - */ -CV_EXPORTS_W void selectROIs(const String& windowName, InputArray img, - CV_OUT std::vector& boundingBoxes, bool showCrosshair = true, bool fromCenter = false); - -/** @brief Creates a trackbar and attaches it to the specified window. - -The function createTrackbar creates a trackbar (a slider or range control) with the specified name -and range, assigns a variable value to be a position synchronized with the trackbar and specifies -the callback function onChange to be called on the trackbar position change. The created trackbar is -displayed in the specified window winname. - -@note - -[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar should be attached to the -control panel. - -Clicking the label of each trackbar enables editing the trackbar values manually. - -@param trackbarname Name of the created trackbar. -@param winname Name of the window that will be used as a parent of the created trackbar. -@param value Optional pointer to an integer variable whose value reflects the position of the -slider. Upon creation, the slider position is defined by this variable. -@param count Maximal position of the slider. The minimal position is always 0. -@param onChange Pointer to the function to be called every time the slider changes position. This -function should be prototyped as void Foo(int,void\*); , where the first parameter is the trackbar -position and the second parameter is the user data (see the next parameter). If the callback is -the NULL pointer, no callbacks are called, but only value is updated. -@param userdata User data that is passed as is to the callback. It can be used to handle trackbar -events without using global variables. - */ -CV_EXPORTS int createTrackbar(const String& trackbarname, const String& winname, - int* value, int count, - TrackbarCallback onChange = 0, - void* userdata = 0); - -/** @brief Returns the trackbar position. - -The function returns the current position of the specified trackbar. - -@note - -[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar is attached to the control -panel. - -@param trackbarname Name of the trackbar. -@param winname Name of the window that is the parent of the trackbar. - */ -CV_EXPORTS_W int getTrackbarPos(const String& trackbarname, const String& winname); - -/** @brief Sets the trackbar position. - -The function sets the position of the specified trackbar in the specified window. - -@note - -[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar is attached to the control -panel. - -@param trackbarname Name of the trackbar. -@param winname Name of the window that is the parent of trackbar. -@param pos New position. - */ -CV_EXPORTS_W void setTrackbarPos(const String& trackbarname, const String& winname, int pos); - -/** @brief Sets the trackbar maximum position. - -The function sets the maximum position of the specified trackbar in the specified window. - -@note - -[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar is attached to the control -panel. - -@param trackbarname Name of the trackbar. -@param winname Name of the window that is the parent of trackbar. -@param maxval New maximum position. - */ -CV_EXPORTS_W void setTrackbarMax(const String& trackbarname, const String& winname, int maxval); - -/** @brief Sets the trackbar minimum position. - -The function sets the minimum position of the specified trackbar in the specified window. - -@note - -[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar is attached to the control -panel. - -@param trackbarname Name of the trackbar. -@param winname Name of the window that is the parent of trackbar. -@param minval New minimum position. - */ -CV_EXPORTS_W void setTrackbarMin(const String& trackbarname, const String& winname, int minval); - -//! @addtogroup highgui_opengl OpenGL support -//! @{ - -/** @brief Displays OpenGL 2D texture in the specified window. - -@param winname Name of the window. -@param tex OpenGL 2D texture data. - */ -CV_EXPORTS void imshow(const String& winname, const ogl::Texture2D& tex); - -/** @brief Sets a callback function to be called to draw on top of displayed image. - -The function setOpenGlDrawCallback can be used to draw 3D data on the window. See the example of -callback function below: -@code - void on_opengl(void* param) - { - glLoadIdentity(); - - glTranslated(0.0, 0.0, -1.0); - - glRotatef( 55, 1, 0, 0 ); - glRotatef( 45, 0, 1, 0 ); - glRotatef( 0, 0, 0, 1 ); - - static const int coords[6][4][3] = { - { { +1, -1, -1 }, { -1, -1, -1 }, { -1, +1, -1 }, { +1, +1, -1 } }, - { { +1, +1, -1 }, { -1, +1, -1 }, { -1, +1, +1 }, { +1, +1, +1 } }, - { { +1, -1, +1 }, { +1, -1, -1 }, { +1, +1, -1 }, { +1, +1, +1 } }, - { { -1, -1, -1 }, { -1, -1, +1 }, { -1, +1, +1 }, { -1, +1, -1 } }, - { { +1, -1, +1 }, { -1, -1, +1 }, { -1, -1, -1 }, { +1, -1, -1 } }, - { { -1, -1, +1 }, { +1, -1, +1 }, { +1, +1, +1 }, { -1, +1, +1 } } - }; - - for (int i = 0; i < 6; ++i) { - glColor3ub( i*20, 100+i*10, i*42 ); - glBegin(GL_QUADS); - for (int j = 0; j < 4; ++j) { - glVertex3d(0.2 * coords[i][j][0], 0.2 * coords[i][j][1], 0.2 * coords[i][j][2]); - } - glEnd(); - } - } -@endcode - -@param winname Name of the window. -@param onOpenGlDraw Pointer to the function to be called every frame. This function should be -prototyped as void Foo(void\*) . -@param userdata Pointer passed to the callback function.(__Optional__) - */ -CV_EXPORTS void setOpenGlDrawCallback(const String& winname, OpenGlDrawCallback onOpenGlDraw, void* userdata = 0); - -/** @brief Sets the specified window as current OpenGL context. - -@param winname Name of the window. - */ -CV_EXPORTS void setOpenGlContext(const String& winname); - -/** @brief Force window to redraw its context and call draw callback ( See cv::setOpenGlDrawCallback ). - -@param winname Name of the window. - */ -CV_EXPORTS void updateWindow(const String& winname); - -//! @} highgui_opengl - -//! @addtogroup highgui_qt -//! @{ - -/** @brief QtFont available only for Qt. See cv::fontQt - */ -struct QtFont -{ - const char* nameFont; //!< Name of the font - Scalar color; //!< Color of the font. Scalar(blue_component, green_component, red_component[, alpha_component]) - int font_face; //!< See cv::QtFontStyles - const int* ascii; //!< font data and metrics - const int* greek; - const int* cyrillic; - float hscale, vscale; - float shear; //!< slope coefficient: 0 - normal, >0 - italic - int thickness; //!< See cv::QtFontWeights - float dx; //!< horizontal interval between letters - int line_type; //!< PointSize -}; - -/** @brief Creates the font to draw a text on an image. - -The function fontQt creates a cv::QtFont object. This cv::QtFont is not compatible with putText . - -A basic usage of this function is the following: : -@code - QtFont font = fontQt("Times"); - addText( img1, "Hello World !", Point(50,50), font); -@endcode - -@param nameFont Name of the font. The name should match the name of a system font (such as -*Times*). If the font is not found, a default one is used. -@param pointSize Size of the font. If not specified, equal zero or negative, the point size of the -font is set to a system-dependent default value. Generally, this is 12 points. -@param color Color of the font in BGRA where A = 255 is fully transparent. Use the macro CV_RGB -for simplicity. -@param weight Font weight. Available operation flags are : cv::QtFontWeights You can also specify a positive integer for better control. -@param style Font style. Available operation flags are : cv::QtFontStyles -@param spacing Spacing between characters. It can be negative or positive. - */ -CV_EXPORTS QtFont fontQt(const String& nameFont, int pointSize = -1, - Scalar color = Scalar::all(0), int weight = QT_FONT_NORMAL, - int style = QT_STYLE_NORMAL, int spacing = 0); - -/** @brief Draws a text on the image. - -The function addText draws *text* on the image *img* using a specific font *font* (see example cv::fontQt -) - -@param img 8-bit 3-channel image where the text should be drawn. -@param text Text to write on an image. -@param org Point(x,y) where the text should start on an image. -@param font Font to use to draw a text. - */ -CV_EXPORTS void addText( const Mat& img, const String& text, Point org, const QtFont& font); - -/** @brief Draws a text on the image. - -@param img 8-bit 3-channel image where the text should be drawn. -@param text Text to write on an image. -@param org Point(x,y) where the text should start on an image. -@param nameFont Name of the font. The name should match the name of a system font (such as -*Times*). If the font is not found, a default one is used. -@param pointSize Size of the font. If not specified, equal zero or negative, the point size of the -font is set to a system-dependent default value. Generally, this is 12 points. -@param color Color of the font in BGRA where A = 255 is fully transparent. -@param weight Font weight. Available operation flags are : cv::QtFontWeights You can also specify a positive integer for better control. -@param style Font style. Available operation flags are : cv::QtFontStyles -@param spacing Spacing between characters. It can be negative or positive. - */ -CV_EXPORTS_W void addText(const Mat& img, const String& text, Point org, const String& nameFont, int pointSize = -1, Scalar color = Scalar::all(0), - int weight = QT_FONT_NORMAL, int style = QT_STYLE_NORMAL, int spacing = 0); - -/** @brief Displays a text on a window image as an overlay for a specified duration. - -The function displayOverlay displays useful information/tips on top of the window for a certain -amount of time *delayms*. The function does not modify the image, displayed in the window, that is, -after the specified delay the original content of the window is restored. - -@param winname Name of the window. -@param text Overlay text to write on a window image. -@param delayms The period (in milliseconds), during which the overlay text is displayed. If this -function is called before the previous overlay text timed out, the timer is restarted and the text -is updated. If this value is zero, the text never disappears. - */ -CV_EXPORTS_W void displayOverlay(const String& winname, const String& text, int delayms = 0); - -/** @brief Displays a text on the window statusbar during the specified period of time. - -The function displayStatusBar displays useful information/tips on top of the window for a certain -amount of time *delayms* . This information is displayed on the window statusbar (the window must be -created with the CV_GUI_EXPANDED flags). - -@param winname Name of the window. -@param text Text to write on the window statusbar. -@param delayms Duration (in milliseconds) to display the text. If this function is called before -the previous text timed out, the timer is restarted and the text is updated. If this value is -zero, the text never disappears. - */ -CV_EXPORTS_W void displayStatusBar(const String& winname, const String& text, int delayms = 0); - -/** @brief Saves parameters of the specified window. - -The function saveWindowParameters saves size, location, flags, trackbars value, zoom and panning -location of the window windowName. - -@param windowName Name of the window. - */ -CV_EXPORTS void saveWindowParameters(const String& windowName); - -/** @brief Loads parameters of the specified window. - -The function loadWindowParameters loads size, location, flags, trackbars value, zoom and panning -location of the window windowName. - -@param windowName Name of the window. - */ -CV_EXPORTS void loadWindowParameters(const String& windowName); - -CV_EXPORTS int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]); - -CV_EXPORTS void stopLoop(); - -/** @brief Attaches a button to the control panel. - -The function createButton attaches a button to the control panel. Each button is added to a -buttonbar to the right of the last button. A new buttonbar is created if nothing was attached to the -control panel before, or if the last element attached to the control panel was a trackbar or if the -QT_NEW_BUTTONBAR flag is added to the type. - -See below various examples of the cv::createButton function call: : -@code - createButton(NULL,callbackButton);//create a push button "button 0", that will call callbackButton. - createButton("button2",callbackButton,NULL,QT_CHECKBOX,0); - createButton("button3",callbackButton,&value); - createButton("button5",callbackButton1,NULL,QT_RADIOBOX); - createButton("button6",callbackButton2,NULL,QT_PUSH_BUTTON,1); - createButton("button6",callbackButton2,NULL,QT_PUSH_BUTTON|QT_NEW_BUTTONBAR);// create a push button in a new row -@endcode - -@param bar_name Name of the button. -@param on_change Pointer to the function to be called every time the button changes its state. -This function should be prototyped as void Foo(int state,\*void); . *state* is the current state -of the button. It could be -1 for a push button, 0 or 1 for a check/radio box button. -@param userdata Pointer passed to the callback function. -@param type Optional type of the button. Available types are: (cv::QtButtonTypes) -@param initial_button_state Default state of the button. Use for checkbox and radiobox. Its -value could be 0 or 1. (__Optional__) -*/ -CV_EXPORTS int createButton( const String& bar_name, ButtonCallback on_change, - void* userdata = 0, int type = QT_PUSH_BUTTON, - bool initial_button_state = false); - -//! @} highgui_qt - -//! @} highgui - -} // cv - -#ifndef DISABLE_OPENCV_24_COMPATIBILITY -#include "opencv2/highgui/highgui_c.h" -#endif - -#endif diff --git a/opencv/include/opencv2/highgui/highgui.hpp b/opencv/include/opencv2/highgui/highgui.hpp deleted file mode 100644 index 160c9cf..0000000 --- a/opencv/include/opencv2/highgui/highgui.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/highgui.hpp" diff --git a/opencv/include/opencv2/highgui/highgui_c.h b/opencv/include/opencv2/highgui/highgui_c.h deleted file mode 100644 index 3541313..0000000 --- a/opencv/include/opencv2/highgui/highgui_c.h +++ /dev/null @@ -1,262 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// Intel License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000, Intel Corporation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of Intel Corporation may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_HIGHGUI_H -#define OPENCV_HIGHGUI_H - -#include "opencv2/core/core_c.h" -#include "opencv2/imgproc/imgproc_c.h" -#ifdef HAVE_OPENCV_IMGCODECS -#include "opencv2/imgcodecs/imgcodecs_c.h" -#endif -#ifdef HAVE_OPENCV_VIDEOIO -#include "opencv2/videoio/videoio_c.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** @addtogroup highgui_c - @{ - */ - -/****************************************************************************************\ -* Basic GUI functions * -\****************************************************************************************/ -//YV -//-----------New for Qt -/* For font */ -enum { CV_FONT_LIGHT = 25,//QFont::Light, - CV_FONT_NORMAL = 50,//QFont::Normal, - CV_FONT_DEMIBOLD = 63,//QFont::DemiBold, - CV_FONT_BOLD = 75,//QFont::Bold, - CV_FONT_BLACK = 87 //QFont::Black -}; - -enum { CV_STYLE_NORMAL = 0,//QFont::StyleNormal, - CV_STYLE_ITALIC = 1,//QFont::StyleItalic, - CV_STYLE_OBLIQUE = 2 //QFont::StyleOblique -}; -/* ---------*/ - -//for color cvScalar(blue_component, green_component, red_component[, alpha_component]) -//and alpha= 0 <-> 0xFF (not transparent <-> transparent) -CVAPI(CvFont) cvFontQt(const char* nameFont, int pointSize CV_DEFAULT(-1), CvScalar color CV_DEFAULT(cvScalarAll(0)), int weight CV_DEFAULT(CV_FONT_NORMAL), int style CV_DEFAULT(CV_STYLE_NORMAL), int spacing CV_DEFAULT(0)); - -CVAPI(void) cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont *arg2); - -CVAPI(void) cvDisplayOverlay(const char* name, const char* text, int delayms CV_DEFAULT(0)); -CVAPI(void) cvDisplayStatusBar(const char* name, const char* text, int delayms CV_DEFAULT(0)); - -CVAPI(void) cvSaveWindowParameters(const char* name); -CVAPI(void) cvLoadWindowParameters(const char* name); -CVAPI(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]); -CVAPI(void) cvStopLoop( void ); - -typedef void (CV_CDECL *CvButtonCallback)(int state, void* userdata); -enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1, CV_RADIOBOX = 2}; -CVAPI(int) cvCreateButton( const char* button_name CV_DEFAULT(NULL),CvButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL) , int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0)); -//---------------------- - - -/* this function is used to set some external parameters in case of X Window */ -CVAPI(int) cvInitSystem( int argc, char** argv ); - -CVAPI(int) cvStartWindowThread( void ); - -// --------- YV --------- -enum -{ - //These 3 flags are used by cvSet/GetWindowProperty - CV_WND_PROP_FULLSCREEN = 0, //to change/get window's fullscreen property - CV_WND_PROP_AUTOSIZE = 1, //to change/get window's autosize property - CV_WND_PROP_ASPECTRATIO= 2, //to change/get window's aspectratio property - CV_WND_PROP_OPENGL = 3, //to change/get window's opengl support - CV_WND_PROP_VISIBLE = 4, - - //These 2 flags are used by cvNamedWindow and cvSet/GetWindowProperty - CV_WINDOW_NORMAL = 0x00000000, //the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size - CV_WINDOW_AUTOSIZE = 0x00000001, //the user cannot resize the window, the size is constrainted by the image displayed - CV_WINDOW_OPENGL = 0x00001000, //window with opengl support - - //Those flags are only for Qt - CV_GUI_EXPANDED = 0x00000000, //status bar and tool bar - CV_GUI_NORMAL = 0x00000010, //old fashious way - - //These 3 flags are used by cvNamedWindow and cvSet/GetWindowProperty - CV_WINDOW_FULLSCREEN = 1,//change the window to fullscreen - CV_WINDOW_FREERATIO = 0x00000100,//the image expends as much as it can (no ratio constraint) - CV_WINDOW_KEEPRATIO = 0x00000000//the ration image is respected. -}; - -/* create window */ -CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOSIZE) ); - -/* Set and Get Property of the window */ -CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value); -CVAPI(double) cvGetWindowProperty(const char* name, int prop_id); - -#ifdef __cplusplus // FIXIT remove in OpenCV 4.0 -/* Get window image rectangle coordinates, width and height */ -CVAPI(cv::Rect)cvGetWindowImageRect(const char* name); -#endif - -/* display image within window (highgui windows remember their content) */ -CVAPI(void) cvShowImage( const char* name, const CvArr* image ); - -/* resize/move window */ -CVAPI(void) cvResizeWindow( const char* name, int width, int height ); -CVAPI(void) cvMoveWindow( const char* name, int x, int y ); - - -/* destroy window and all the trackers associated with it */ -CVAPI(void) cvDestroyWindow( const char* name ); - -CVAPI(void) cvDestroyAllWindows(void); - -/* get native window handle (HWND in case of Win32 and Widget in case of X Window) */ -CVAPI(void*) cvGetWindowHandle( const char* name ); - -/* get name of highgui window given its native handle */ -CVAPI(const char*) cvGetWindowName( void* window_handle ); - - -typedef void (CV_CDECL *CvTrackbarCallback)(int pos); - -/* create trackbar and display it on top of given window, set callback */ -CVAPI(int) cvCreateTrackbar( const char* trackbar_name, const char* window_name, - int* value, int count, CvTrackbarCallback on_change CV_DEFAULT(NULL)); - -typedef void (CV_CDECL *CvTrackbarCallback2)(int pos, void* userdata); - -CVAPI(int) cvCreateTrackbar2( const char* trackbar_name, const char* window_name, - int* value, int count, CvTrackbarCallback2 on_change, - void* userdata CV_DEFAULT(0)); - -/* retrieve or set trackbar position */ -CVAPI(int) cvGetTrackbarPos( const char* trackbar_name, const char* window_name ); -CVAPI(void) cvSetTrackbarPos( const char* trackbar_name, const char* window_name, int pos ); -CVAPI(void) cvSetTrackbarMax(const char* trackbar_name, const char* window_name, int maxval); -CVAPI(void) cvSetTrackbarMin(const char* trackbar_name, const char* window_name, int minval); - -enum -{ - CV_EVENT_MOUSEMOVE =0, - CV_EVENT_LBUTTONDOWN =1, - CV_EVENT_RBUTTONDOWN =2, - CV_EVENT_MBUTTONDOWN =3, - CV_EVENT_LBUTTONUP =4, - CV_EVENT_RBUTTONUP =5, - CV_EVENT_MBUTTONUP =6, - CV_EVENT_LBUTTONDBLCLK =7, - CV_EVENT_RBUTTONDBLCLK =8, - CV_EVENT_MBUTTONDBLCLK =9, - CV_EVENT_MOUSEWHEEL =10, - CV_EVENT_MOUSEHWHEEL =11 -}; - -enum -{ - CV_EVENT_FLAG_LBUTTON =1, - CV_EVENT_FLAG_RBUTTON =2, - CV_EVENT_FLAG_MBUTTON =4, - CV_EVENT_FLAG_CTRLKEY =8, - CV_EVENT_FLAG_SHIFTKEY =16, - CV_EVENT_FLAG_ALTKEY =32 -}; - - -#define CV_GET_WHEEL_DELTA(flags) ((short)((flags >> 16) & 0xffff)) // upper 16 bits - -typedef void (CV_CDECL *CvMouseCallback )(int event, int x, int y, int flags, void* param); - -/* assign callback for mouse events */ -CVAPI(void) cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse, - void* param CV_DEFAULT(NULL)); - -/* wait for key event infinitely (delay<=0) or for "delay" milliseconds */ -CVAPI(int) cvWaitKey(int delay CV_DEFAULT(0)); - -// OpenGL support - -typedef void (CV_CDECL *CvOpenGlDrawCallback)(void* userdata); -CVAPI(void) cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallback callback, void* userdata CV_DEFAULT(NULL)); - -CVAPI(void) cvSetOpenGlContext(const char* window_name); -CVAPI(void) cvUpdateWindow(const char* window_name); - - -/****************************************************************************************\ - -* Obsolete functions/synonyms * -\****************************************************************************************/ - -#define cvAddSearchPath(path) -#define cvvInitSystem cvInitSystem -#define cvvNamedWindow cvNamedWindow -#define cvvShowImage cvShowImage -#define cvvResizeWindow cvResizeWindow -#define cvvDestroyWindow cvDestroyWindow -#define cvvCreateTrackbar cvCreateTrackbar -#define cvvAddSearchPath cvAddSearchPath -#define cvvWaitKey(name) cvWaitKey(0) -#define cvvWaitKeyEx(name,delay) cvWaitKey(delay) -#define HG_AUTOSIZE CV_WINDOW_AUTOSIZE -#define set_preprocess_func cvSetPreprocessFuncWin32 -#define set_postprocess_func cvSetPostprocessFuncWin32 - -#if defined _WIN32 - -CVAPI(void) cvSetPreprocessFuncWin32_(const void* callback); -CVAPI(void) cvSetPostprocessFuncWin32_(const void* callback); -#define cvSetPreprocessFuncWin32(callback) cvSetPreprocessFuncWin32_((const void*)(callback)) -#define cvSetPostprocessFuncWin32(callback) cvSetPostprocessFuncWin32_((const void*)(callback)) - -#endif - -/** @} highgui_c */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/opencv/include/opencv2/imgcodecs.hpp b/opencv/include/opencv2/imgcodecs.hpp deleted file mode 100644 index ab75990..0000000 --- a/opencv/include/opencv2/imgcodecs.hpp +++ /dev/null @@ -1,260 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_IMGCODECS_HPP -#define OPENCV_IMGCODECS_HPP - -#include "opencv2/core.hpp" - -/** - @defgroup imgcodecs Image file reading and writing - @{ - @defgroup imgcodecs_c C API - @defgroup imgcodecs_ios iOS glue - @} -*/ - -//////////////////////////////// image codec //////////////////////////////// -namespace cv -{ - -//! @addtogroup imgcodecs -//! @{ - -//! Imread flags -enum ImreadModes { - IMREAD_UNCHANGED = -1, //!< If set, return the loaded image as is (with alpha channel, otherwise it gets cropped). - IMREAD_GRAYSCALE = 0, //!< If set, always convert image to the single channel grayscale image (codec internal conversion). - IMREAD_COLOR = 1, //!< If set, always convert image to the 3 channel BGR color image. - IMREAD_ANYDEPTH = 2, //!< If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit. - IMREAD_ANYCOLOR = 4, //!< If set, the image is read in any possible color format. - IMREAD_LOAD_GDAL = 8, //!< If set, use the gdal driver for loading the image. - IMREAD_REDUCED_GRAYSCALE_2 = 16, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/2. - IMREAD_REDUCED_COLOR_2 = 17, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/2. - IMREAD_REDUCED_GRAYSCALE_4 = 32, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/4. - IMREAD_REDUCED_COLOR_4 = 33, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/4. - IMREAD_REDUCED_GRAYSCALE_8 = 64, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/8. - IMREAD_REDUCED_COLOR_8 = 65, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/8. - IMREAD_IGNORE_ORIENTATION = 128 //!< If set, do not rotate the image according to EXIF's orientation flag. - }; - -//! Imwrite flags -enum ImwriteFlags { - IMWRITE_JPEG_QUALITY = 1, //!< For JPEG, it can be a quality from 0 to 100 (the higher is the better). Default value is 95. - IMWRITE_JPEG_PROGRESSIVE = 2, //!< Enable JPEG features, 0 or 1, default is False. - IMWRITE_JPEG_OPTIMIZE = 3, //!< Enable JPEG features, 0 or 1, default is False. - IMWRITE_JPEG_RST_INTERVAL = 4, //!< JPEG restart interval, 0 - 65535, default is 0 - no restart. - IMWRITE_JPEG_LUMA_QUALITY = 5, //!< Separate luma quality level, 0 - 100, default is 0 - don't use. - IMWRITE_JPEG_CHROMA_QUALITY = 6, //!< Separate chroma quality level, 0 - 100, default is 0 - don't use. - IMWRITE_PNG_COMPRESSION = 16, //!< For PNG, it can be the compression level from 0 to 9. A higher value means a smaller size and longer compression time. If specified, strategy is changed to IMWRITE_PNG_STRATEGY_DEFAULT (Z_DEFAULT_STRATEGY). Default value is 1 (best speed setting). - IMWRITE_PNG_STRATEGY = 17, //!< One of cv::ImwritePNGFlags, default is IMWRITE_PNG_STRATEGY_RLE. - IMWRITE_PNG_BILEVEL = 18, //!< Binary level PNG, 0 or 1, default is 0. - IMWRITE_PXM_BINARY = 32, //!< For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1. - IMWRITE_EXR_TYPE = (3 << 4) + 0, /* 48 */ //!< override EXR storage type (FLOAT (FP32) is default) - IMWRITE_WEBP_QUALITY = 64, //!< For WEBP, it can be a quality from 1 to 100 (the higher is the better). By default (without any parameter) and for quality above 100 the lossless compression is used. - IMWRITE_PAM_TUPLETYPE = 128,//!< For PAM, sets the TUPLETYPE field to the corresponding string value that is defined for the format - IMWRITE_TIFF_RESUNIT = 256,//!< For TIFF, use to specify which DPI resolution unit to set; see libtiff documentation for valid values. - IMWRITE_TIFF_XDPI = 257,//!< For TIFF, use to specify the X direction DPI. - IMWRITE_TIFF_YDPI = 258, //!< For TIFF, use to specify the Y direction DPI. - IMWRITE_TIFF_COMPRESSION = 259 //!< For TIFF, use to specify the image compression scheme. See libtiff for integer constants corresponding to compression formats. Note, for images whose depth is CV_32F, only libtiff's SGILOG compression scheme is used. For other supported depths, the compression scheme can be specified by this flag; LZW compression is the default. - }; - -enum ImwriteEXRTypeFlags { - /*IMWRITE_EXR_TYPE_UNIT = 0, //!< not supported */ - IMWRITE_EXR_TYPE_HALF = 1, //!< store as HALF (FP16) - IMWRITE_EXR_TYPE_FLOAT = 2 //!< store as FP32 (default) - }; - -//! Imwrite PNG specific flags used to tune the compression algorithm. -/** These flags will be modify the way of PNG image compression and will be passed to the underlying zlib processing stage. - -- The effect of IMWRITE_PNG_STRATEGY_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between IMWRITE_PNG_STRATEGY_DEFAULT and IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY. -- IMWRITE_PNG_STRATEGY_RLE is designed to be almost as fast as IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY, but give better compression for PNG image data. -- The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately. -- IMWRITE_PNG_STRATEGY_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications. -*/ -enum ImwritePNGFlags { - IMWRITE_PNG_STRATEGY_DEFAULT = 0, //!< Use this value for normal data. - IMWRITE_PNG_STRATEGY_FILTERED = 1, //!< Use this value for data produced by a filter (or predictor).Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better. - IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2, //!< Use this value to force Huffman encoding only (no string match). - IMWRITE_PNG_STRATEGY_RLE = 3, //!< Use this value to limit match distances to one (run-length encoding). - IMWRITE_PNG_STRATEGY_FIXED = 4 //!< Using this value prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications. - }; - -//! Imwrite PAM specific tupletype flags used to define the 'TUPETYPE' field of a PAM file. -enum ImwritePAMFlags { - IMWRITE_PAM_FORMAT_NULL = 0, - IMWRITE_PAM_FORMAT_BLACKANDWHITE = 1, - IMWRITE_PAM_FORMAT_GRAYSCALE = 2, - IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA = 3, - IMWRITE_PAM_FORMAT_RGB = 4, - IMWRITE_PAM_FORMAT_RGB_ALPHA = 5, - }; - -/** @brief Loads an image from a file. - -@anchor imread - -The function imread loads an image from the specified file and returns it. If the image cannot be -read (because of missing file, improper permissions, unsupported or invalid format), the function -returns an empty matrix ( Mat::data==NULL ). - -Currently, the following file formats are supported: - -- Windows bitmaps - \*.bmp, \*.dib (always supported) -- JPEG files - \*.jpeg, \*.jpg, \*.jpe (see the *Note* section) -- JPEG 2000 files - \*.jp2 (see the *Note* section) -- Portable Network Graphics - \*.png (see the *Note* section) -- WebP - \*.webp (see the *Note* section) -- Portable image format - \*.pbm, \*.pgm, \*.ppm \*.pxm, \*.pnm (always supported) -- Sun rasters - \*.sr, \*.ras (always supported) -- TIFF files - \*.tiff, \*.tif (see the *Note* section) -- OpenEXR Image files - \*.exr (see the *Note* section) -- Radiance HDR - \*.hdr, \*.pic (always supported) -- Raster and Vector geospatial data supported by GDAL (see the *Note* section) - -@note -- The function determines the type of an image by the content, not by the file extension. -- In the case of color images, the decoded images will have the channels stored in **B G R** order. -- When using IMREAD_GRAYSCALE, the codec's internal grayscale conversion will be used, if available. - Results may differ to the output of cvtColor() -- On Microsoft Windows\* OS and MacOSX\*, the codecs shipped with an OpenCV image (libjpeg, - libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs, - and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware - that currently these native image loaders give images with different pixel values because of - the color management embedded into MacOSX. -- On Linux\*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for - codecs supplied with an OS image. Install the relevant packages (do not forget the development - files, for example, "libjpeg-dev", in Debian\* and Ubuntu\*) to get the codec support or turn - on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake. -- In the case you set *WITH_GDAL* flag to true in CMake and @ref IMREAD_LOAD_GDAL to load the image, - then the [GDAL](http://www.gdal.org) driver will be used in order to decode the image, supporting - the following formats: [Raster](http://www.gdal.org/formats_list.html), - [Vector](http://www.gdal.org/ogr_formats.html). -- If EXIF information are embedded in the image file, the EXIF orientation will be taken into account - and thus the image will be rotated accordingly except if the flag @ref IMREAD_IGNORE_ORIENTATION is passed. -- By default number of pixels must be less than 2^30. Limit can be set using system - variable OPENCV_IO_MAX_IMAGE_PIXELS - -@param filename Name of file to be loaded. -@param flags Flag that can take values of cv::ImreadModes -*/ -CV_EXPORTS_W Mat imread( const String& filename, int flags = IMREAD_COLOR ); - -/** @brief Loads a multi-page image from a file. - -The function imreadmulti loads a multi-page image from the specified file into a vector of Mat objects. -@param filename Name of file to be loaded. -@param flags Flag that can take values of cv::ImreadModes, default with cv::IMREAD_ANYCOLOR. -@param mats A vector of Mat objects holding each page, if more than one. -@sa cv::imread -*/ -CV_EXPORTS_W bool imreadmulti(const String& filename, CV_OUT std::vector& mats, int flags = IMREAD_ANYCOLOR); - -/** @brief Saves an image to a specified file. - -The function imwrite saves the image to the specified file. The image format is chosen based on the -filename extension (see cv::imread for the list of extensions). In general, only 8-bit -single-channel or 3-channel (with 'BGR' channel order) images -can be saved using this function, with these exceptions: - -- 16-bit unsigned (CV_16U) images can be saved in the case of PNG, JPEG 2000, and TIFF formats -- 32-bit float (CV_32F) images can be saved in TIFF, OpenEXR, and Radiance HDR formats; 3-channel -(CV_32FC3) TIFF images will be saved using the LogLuv high dynamic range encoding (4 bytes per pixel) -- PNG images with an alpha channel can be saved using this function. To do this, create -8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels -should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535 (see the code sample below). - -If the format, depth or channel order is different, use -Mat::convertTo and cv::cvtColor to convert it before saving. Or, use the universal FileStorage I/O -functions to save the image to XML or YAML format. - -The sample below shows how to create a BGRA image and save it to a PNG file. It also demonstrates how to set custom -compression parameters: -@include snippets/imgcodecs_imwrite.cpp -@param filename Name of the file. -@param img Image to be saved. -@param params Format-specific parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) see cv::ImwriteFlags -*/ -CV_EXPORTS_W bool imwrite( const String& filename, InputArray img, - const std::vector& params = std::vector()); - -/** @brief Reads an image from a buffer in memory. - -The function imdecode reads an image from the specified buffer in the memory. If the buffer is too short or -contains invalid data, the function returns an empty matrix ( Mat::data==NULL ). - -See cv::imread for the list of supported formats and flags description. - -@note In the case of color images, the decoded images will have the channels stored in **B G R** order. -@param buf Input array or vector of bytes. -@param flags The same flags as in cv::imread, see cv::ImreadModes. -*/ -CV_EXPORTS_W Mat imdecode( InputArray buf, int flags ); - -/** @overload -@param buf -@param flags -@param dst The optional output placeholder for the decoded matrix. It can save the image -reallocations when the function is called repeatedly for images of the same size. -*/ -CV_EXPORTS Mat imdecode( InputArray buf, int flags, Mat* dst); - -/** @brief Encodes an image into a memory buffer. - -The function imencode compresses the image and stores it in the memory buffer that is resized to fit the -result. See cv::imwrite for the list of supported formats and flags description. - -@param ext File extension that defines the output format. -@param img Image to be written. -@param buf Output buffer resized to fit the compressed image. -@param params Format-specific parameters. See cv::imwrite and cv::ImwriteFlags. -*/ -CV_EXPORTS_W bool imencode( const String& ext, InputArray img, - CV_OUT std::vector& buf, - const std::vector& params = std::vector()); - -//! @} imgcodecs - -} // cv - -#endif //OPENCV_IMGCODECS_HPP diff --git a/opencv/include/opencv2/imgcodecs/imgcodecs.hpp b/opencv/include/opencv2/imgcodecs/imgcodecs.hpp deleted file mode 100644 index a3cd232..0000000 --- a/opencv/include/opencv2/imgcodecs/imgcodecs.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/imgcodecs.hpp" diff --git a/opencv/include/opencv2/imgcodecs/imgcodecs_c.h b/opencv/include/opencv2/imgcodecs/imgcodecs_c.h deleted file mode 100644 index c36dac3..0000000 --- a/opencv/include/opencv2/imgcodecs/imgcodecs_c.h +++ /dev/null @@ -1,149 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// Intel License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000, Intel Corporation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of Intel Corporation may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_IMGCODECS_H -#define OPENCV_IMGCODECS_H - -#include "opencv2/core/core_c.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** @addtogroup imgcodecs_c - @{ - */ - -enum -{ -/* 8bit, color or not */ - CV_LOAD_IMAGE_UNCHANGED =-1, -/* 8bit, gray */ - CV_LOAD_IMAGE_GRAYSCALE =0, -/* ?, color */ - CV_LOAD_IMAGE_COLOR =1, -/* any depth, ? */ - CV_LOAD_IMAGE_ANYDEPTH =2, -/* ?, any color */ - CV_LOAD_IMAGE_ANYCOLOR =4, -/* ?, no rotate */ - CV_LOAD_IMAGE_IGNORE_ORIENTATION =128 -}; - -/* load image from file - iscolor can be a combination of above flags where CV_LOAD_IMAGE_UNCHANGED - overrides the other flags - using CV_LOAD_IMAGE_ANYCOLOR alone is equivalent to CV_LOAD_IMAGE_UNCHANGED - unless CV_LOAD_IMAGE_ANYDEPTH is specified images are converted to 8bit -*/ -CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); -CVAPI(CvMat*) cvLoadImageM( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); - -enum -{ - CV_IMWRITE_JPEG_QUALITY =1, - CV_IMWRITE_JPEG_PROGRESSIVE =2, - CV_IMWRITE_JPEG_OPTIMIZE =3, - CV_IMWRITE_JPEG_RST_INTERVAL =4, - CV_IMWRITE_JPEG_LUMA_QUALITY =5, - CV_IMWRITE_JPEG_CHROMA_QUALITY =6, - CV_IMWRITE_PNG_COMPRESSION =16, - CV_IMWRITE_PNG_STRATEGY =17, - CV_IMWRITE_PNG_BILEVEL =18, - CV_IMWRITE_PNG_STRATEGY_DEFAULT =0, - CV_IMWRITE_PNG_STRATEGY_FILTERED =1, - CV_IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY =2, - CV_IMWRITE_PNG_STRATEGY_RLE =3, - CV_IMWRITE_PNG_STRATEGY_FIXED =4, - CV_IMWRITE_PXM_BINARY =32, - CV_IMWRITE_EXR_TYPE = 48, - CV_IMWRITE_WEBP_QUALITY =64, - CV_IMWRITE_PAM_TUPLETYPE = 128, - CV_IMWRITE_PAM_FORMAT_NULL = 0, - CV_IMWRITE_PAM_FORMAT_BLACKANDWHITE = 1, - CV_IMWRITE_PAM_FORMAT_GRAYSCALE = 2, - CV_IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA = 3, - CV_IMWRITE_PAM_FORMAT_RGB = 4, - CV_IMWRITE_PAM_FORMAT_RGB_ALPHA = 5, -}; - - - -/* save image to file */ -CVAPI(int) cvSaveImage( const char* filename, const CvArr* image, - const int* params CV_DEFAULT(0) ); - -/* decode image stored in the buffer */ -CVAPI(IplImage*) cvDecodeImage( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); -CVAPI(CvMat*) cvDecodeImageM( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); - -/* encode image and store the result as a byte vector (single-row 8uC1 matrix) */ -CVAPI(CvMat*) cvEncodeImage( const char* ext, const CvArr* image, - const int* params CV_DEFAULT(0) ); - -enum -{ - CV_CVTIMG_FLIP =1, - CV_CVTIMG_SWAP_RB =2 -}; - -/* utility function: convert one image to another with optional vertical flip */ -CVAPI(void) cvConvertImage( const CvArr* src, CvArr* dst, int flags CV_DEFAULT(0)); - -CVAPI(int) cvHaveImageReader(const char* filename); -CVAPI(int) cvHaveImageWriter(const char* filename); - - -/****************************************************************************************\ -* Obsolete functions/synonyms * -\****************************************************************************************/ - -#define cvvLoadImage(name) cvLoadImage((name),1) -#define cvvSaveImage cvSaveImage -#define cvvConvertImage cvConvertImage - -/** @} imgcodecs_c */ - -#ifdef __cplusplus -} -#endif - -#endif // OPENCV_IMGCODECS_H diff --git a/opencv/include/opencv2/imgcodecs/ios.h b/opencv/include/opencv2/imgcodecs/ios.h deleted file mode 100644 index a90c6d3..0000000 --- a/opencv/include/opencv2/imgcodecs/ios.h +++ /dev/null @@ -1,57 +0,0 @@ - -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#import -#import -#import -#import -#include "opencv2/core/core.hpp" - -//! @addtogroup imgcodecs_ios -//! @{ - -CV_EXPORTS UIImage* MatToUIImage(const cv::Mat& image); -CV_EXPORTS void UIImageToMat(const UIImage* image, - cv::Mat& m, bool alphaExist = false); - -//! @} diff --git a/opencv/include/opencv2/imgproc.hpp b/opencv/include/opencv2/imgproc.hpp deleted file mode 100644 index ab7d0e6..0000000 --- a/opencv/include/opencv2/imgproc.hpp +++ /dev/null @@ -1,4922 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_IMGPROC_HPP -#define OPENCV_IMGPROC_HPP - -#include "opencv2/core.hpp" - -/** - @defgroup imgproc Image Processing - -This module includes image-processing functions. - - @{ - @defgroup imgproc_filter Image Filtering - -Functions and classes described in this section are used to perform various linear or non-linear -filtering operations on 2D images (represented as Mat's). It means that for each pixel location -\f$(x,y)\f$ in the source image (normally, rectangular), its neighborhood is considered and used to -compute the response. In case of a linear filter, it is a weighted sum of pixel values. In case of -morphological operations, it is the minimum or maximum values, and so on. The computed response is -stored in the destination image at the same location \f$(x,y)\f$. It means that the output image -will be of the same size as the input image. Normally, the functions support multi-channel arrays, -in which case every channel is processed independently. Therefore, the output image will also have -the same number of channels as the input one. - -Another common feature of the functions and classes described in this section is that, unlike -simple arithmetic functions, they need to extrapolate values of some non-existing pixels. For -example, if you want to smooth an image using a Gaussian \f$3 \times 3\f$ filter, then, when -processing the left-most pixels in each row, you need pixels to the left of them, that is, outside -of the image. You can let these pixels be the same as the left-most image pixels ("replicated -border" extrapolation method), or assume that all the non-existing pixels are zeros ("constant -border" extrapolation method), and so on. OpenCV enables you to specify the extrapolation method. -For details, see #BorderTypes - -@anchor filter_depths -### Depth combinations -Input depth (src.depth()) | Output depth (ddepth) ---------------------------|---------------------- -CV_8U | -1/CV_16S/CV_32F/CV_64F -CV_16U/CV_16S | -1/CV_32F/CV_64F -CV_32F | -1/CV_32F/CV_64F -CV_64F | -1/CV_64F - -@note when ddepth=-1, the output image will have the same depth as the source. - - @defgroup imgproc_transform Geometric Image Transformations - -The functions in this section perform various geometrical transformations of 2D images. They do not -change the image content but deform the pixel grid and map this deformed grid to the destination -image. In fact, to avoid sampling artifacts, the mapping is done in the reverse order, from -destination to the source. That is, for each pixel \f$(x, y)\f$ of the destination image, the -functions compute coordinates of the corresponding "donor" pixel in the source image and copy the -pixel value: - -\f[\texttt{dst} (x,y)= \texttt{src} (f_x(x,y), f_y(x,y))\f] - -In case when you specify the forward mapping \f$\left: \texttt{src} \rightarrow -\texttt{dst}\f$, the OpenCV functions first compute the corresponding inverse mapping -\f$\left: \texttt{dst} \rightarrow \texttt{src}\f$ and then use the above formula. - -The actual implementations of the geometrical transformations, from the most generic remap and to -the simplest and the fastest resize, need to solve two main problems with the above formula: - -- Extrapolation of non-existing pixels. Similarly to the filtering functions described in the -previous section, for some \f$(x,y)\f$, either one of \f$f_x(x,y)\f$, or \f$f_y(x,y)\f$, or both -of them may fall outside of the image. In this case, an extrapolation method needs to be used. -OpenCV provides the same selection of extrapolation methods as in the filtering functions. In -addition, it provides the method #BORDER_TRANSPARENT. This means that the corresponding pixels in -the destination image will not be modified at all. - -- Interpolation of pixel values. Usually \f$f_x(x,y)\f$ and \f$f_y(x,y)\f$ are floating-point -numbers. This means that \f$\left\f$ can be either an affine or perspective -transformation, or radial lens distortion correction, and so on. So, a pixel value at fractional -coordinates needs to be retrieved. In the simplest case, the coordinates can be just rounded to the -nearest integer coordinates and the corresponding pixel can be used. This is called a -nearest-neighbor interpolation. However, a better result can be achieved by using more -sophisticated [interpolation methods](http://en.wikipedia.org/wiki/Multivariate_interpolation) , -where a polynomial function is fit into some neighborhood of the computed pixel \f$(f_x(x,y), -f_y(x,y))\f$, and then the value of the polynomial at \f$(f_x(x,y), f_y(x,y))\f$ is taken as the -interpolated pixel value. In OpenCV, you can choose between several interpolation methods. See -resize for details. - -@note The geometrical transformations do not work with `CV_8S` or `CV_32S` images. - - @defgroup imgproc_misc Miscellaneous Image Transformations - @defgroup imgproc_draw Drawing Functions - -Drawing functions work with matrices/images of arbitrary depth. The boundaries of the shapes can be -rendered with antialiasing (implemented only for 8-bit images for now). All the functions include -the parameter color that uses an RGB value (that may be constructed with the Scalar constructor ) -for color images and brightness for grayscale images. For color images, the channel ordering is -normally *Blue, Green, Red*. This is what imshow, imread, and imwrite expect. So, if you form a -color using the Scalar constructor, it should look like: - -\f[\texttt{Scalar} (blue \_ component, green \_ component, red \_ component[, alpha \_ component])\f] - -If you are using your own image rendering and I/O functions, you can use any channel ordering. The -drawing functions process each channel independently and do not depend on the channel order or even -on the used color space. The whole image can be converted from BGR to RGB or to a different color -space using cvtColor . - -If a drawn figure is partially or completely outside the image, the drawing functions clip it. Also, -many drawing functions can handle pixel coordinates specified with sub-pixel accuracy. This means -that the coordinates can be passed as fixed-point numbers encoded as integers. The number of -fractional bits is specified by the shift parameter and the real point coordinates are calculated as -\f$\texttt{Point}(x,y)\rightarrow\texttt{Point2f}(x*2^{-shift},y*2^{-shift})\f$ . This feature is -especially effective when rendering antialiased shapes. - -@note The functions do not support alpha-transparency when the target image is 4-channel. In this -case, the color[3] is simply copied to the repainted pixels. Thus, if you want to paint -semi-transparent shapes, you can paint them in a separate buffer and then blend it with the main -image. - - @defgroup imgproc_color_conversions Color Space Conversions - @defgroup imgproc_colormap ColorMaps in OpenCV - -The human perception isn't built for observing fine changes in grayscale images. Human eyes are more -sensitive to observing changes between colors, so you often need to recolor your grayscale images to -get a clue about them. OpenCV now comes with various colormaps to enhance the visualization in your -computer vision application. - -In OpenCV you only need applyColorMap to apply a colormap on a given image. The following sample -code reads the path to an image from command line, applies a Jet colormap on it and shows the -result: - -@include snippets/imgproc_applyColorMap.cpp - -@see #ColormapTypes - - @defgroup imgproc_subdiv2d Planar Subdivision - -The Subdiv2D class described in this section is used to perform various planar subdivision on -a set of 2D points (represented as vector of Point2f). OpenCV subdivides a plane into triangles -using the Delaunay's algorithm, which corresponds to the dual graph of the Voronoi diagram. -In the figure below, the Delaunay's triangulation is marked with black lines and the Voronoi -diagram with red lines. - -![Delaunay triangulation (black) and Voronoi (red)](pics/delaunay_voronoi.png) - -The subdivisions can be used for the 3D piece-wise transformation of a plane, morphing, fast -location of points on the plane, building special graphs (such as NNG,RNG), and so forth. - - @defgroup imgproc_hist Histograms - @defgroup imgproc_shape Structural Analysis and Shape Descriptors - @defgroup imgproc_motion Motion Analysis and Object Tracking - @defgroup imgproc_feature Feature Detection - @defgroup imgproc_object Object Detection - @defgroup imgproc_c C API - @defgroup imgproc_hal Hardware Acceleration Layer - @{ - @defgroup imgproc_hal_functions Functions - @defgroup imgproc_hal_interface Interface - @} - @} -*/ - -namespace cv -{ - -/** @addtogroup imgproc -@{ -*/ - -//! @addtogroup imgproc_filter -//! @{ - -//! type of morphological operation -enum MorphTypes{ - MORPH_ERODE = 0, //!< see #erode - MORPH_DILATE = 1, //!< see #dilate - MORPH_OPEN = 2, //!< an opening operation - //!< \f[\texttt{dst} = \mathrm{open} ( \texttt{src} , \texttt{element} )= \mathrm{dilate} ( \mathrm{erode} ( \texttt{src} , \texttt{element} ))\f] - MORPH_CLOSE = 3, //!< a closing operation - //!< \f[\texttt{dst} = \mathrm{close} ( \texttt{src} , \texttt{element} )= \mathrm{erode} ( \mathrm{dilate} ( \texttt{src} , \texttt{element} ))\f] - MORPH_GRADIENT = 4, //!< a morphological gradient - //!< \f[\texttt{dst} = \mathrm{morph\_grad} ( \texttt{src} , \texttt{element} )= \mathrm{dilate} ( \texttt{src} , \texttt{element} )- \mathrm{erode} ( \texttt{src} , \texttt{element} )\f] - MORPH_TOPHAT = 5, //!< "top hat" - //!< \f[\texttt{dst} = \mathrm{tophat} ( \texttt{src} , \texttt{element} )= \texttt{src} - \mathrm{open} ( \texttt{src} , \texttt{element} )\f] - MORPH_BLACKHAT = 6, //!< "black hat" - //!< \f[\texttt{dst} = \mathrm{blackhat} ( \texttt{src} , \texttt{element} )= \mathrm{close} ( \texttt{src} , \texttt{element} )- \texttt{src}\f] - MORPH_HITMISS = 7 //!< "hit or miss" - //!< .- Only supported for CV_8UC1 binary images. A tutorial can be found in the documentation -}; - -//! shape of the structuring element -enum MorphShapes { - MORPH_RECT = 0, //!< a rectangular structuring element: \f[E_{ij}=1\f] - MORPH_CROSS = 1, //!< a cross-shaped structuring element: - //!< \f[E_{ij} = \fork{1}{if i=\texttt{anchor.y} or j=\texttt{anchor.x}}{0}{otherwise}\f] - MORPH_ELLIPSE = 2 //!< an elliptic structuring element, that is, a filled ellipse inscribed - //!< into the rectangle Rect(0, 0, esize.width, 0.esize.height) -}; - -//! @} imgproc_filter - -//! @addtogroup imgproc_transform -//! @{ - -//! interpolation algorithm -enum InterpolationFlags{ - /** nearest neighbor interpolation */ - INTER_NEAREST = 0, - /** bilinear interpolation */ - INTER_LINEAR = 1, - /** bicubic interpolation */ - INTER_CUBIC = 2, - /** resampling using pixel area relation. It may be a preferred method for image decimation, as - it gives moire'-free results. But when the image is zoomed, it is similar to the INTER_NEAREST - method. */ - INTER_AREA = 3, - /** Lanczos interpolation over 8x8 neighborhood */ - INTER_LANCZOS4 = 4, - /** Bit exact bilinear interpolation */ - INTER_LINEAR_EXACT = 5, - /** mask for interpolation codes */ - INTER_MAX = 7, - /** flag, fills all of the destination image pixels. If some of them correspond to outliers in the - source image, they are set to zero */ - WARP_FILL_OUTLIERS = 8, - /** flag, inverse transformation - - For example, #linearPolar or #logPolar transforms: - - flag is __not__ set: \f$dst( \rho , \phi ) = src(x,y)\f$ - - flag is set: \f$dst(x,y) = src( \rho , \phi )\f$ - */ - WARP_INVERSE_MAP = 16 -}; - -/** \brief Specify the polar mapping mode -@sa warpPolar -*/ -enum WarpPolarMode -{ - WARP_POLAR_LINEAR = 0, ///< Remaps an image to/from polar space. - WARP_POLAR_LOG = 256 ///< Remaps an image to/from semilog-polar space. -}; - -enum InterpolationMasks { - INTER_BITS = 5, - INTER_BITS2 = INTER_BITS * 2, - INTER_TAB_SIZE = 1 << INTER_BITS, - INTER_TAB_SIZE2 = INTER_TAB_SIZE * INTER_TAB_SIZE - }; - -//! @} imgproc_transform - -//! @addtogroup imgproc_misc -//! @{ - -//! Distance types for Distance Transform and M-estimators -//! @see distanceTransform, fitLine -enum DistanceTypes { - DIST_USER = -1, //!< User defined distance - DIST_L1 = 1, //!< distance = |x1-x2| + |y1-y2| - DIST_L2 = 2, //!< the simple euclidean distance - DIST_C = 3, //!< distance = max(|x1-x2|,|y1-y2|) - DIST_L12 = 4, //!< L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) - DIST_FAIR = 5, //!< distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 - DIST_WELSCH = 6, //!< distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 - DIST_HUBER = 7 //!< distance = |x| \texttt{thresh}\)}{0}{otherwise}\f] - THRESH_BINARY_INV = 1, //!< \f[\texttt{dst} (x,y) = \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{maxval}}{otherwise}\f] - THRESH_TRUNC = 2, //!< \f[\texttt{dst} (x,y) = \fork{\texttt{threshold}}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f] - THRESH_TOZERO = 3, //!< \f[\texttt{dst} (x,y) = \fork{\texttt{src}(x,y)}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{0}{otherwise}\f] - THRESH_TOZERO_INV = 4, //!< \f[\texttt{dst} (x,y) = \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f] - THRESH_MASK = 7, - THRESH_OTSU = 8, //!< flag, use Otsu algorithm to choose the optimal threshold value - THRESH_TRIANGLE = 16 //!< flag, use Triangle algorithm to choose the optimal threshold value -}; - -//! adaptive threshold algorithm -//! @see adaptiveThreshold -enum AdaptiveThresholdTypes { - /** the threshold value \f$T(x,y)\f$ is a mean of the \f$\texttt{blockSize} \times - \texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$ minus C */ - ADAPTIVE_THRESH_MEAN_C = 0, - /** the threshold value \f$T(x, y)\f$ is a weighted sum (cross-correlation with a Gaussian - window) of the \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$ - minus C . The default sigma (standard deviation) is used for the specified blockSize . See - #getGaussianKernel*/ - ADAPTIVE_THRESH_GAUSSIAN_C = 1 -}; - -//! cv::undistort mode -enum UndistortTypes { - PROJ_SPHERICAL_ORTHO = 0, - PROJ_SPHERICAL_EQRECT = 1 - }; - -//! class of the pixel in GrabCut algorithm -enum GrabCutClasses { - GC_BGD = 0, //!< an obvious background pixels - GC_FGD = 1, //!< an obvious foreground (object) pixel - GC_PR_BGD = 2, //!< a possible background pixel - GC_PR_FGD = 3 //!< a possible foreground pixel -}; - -//! GrabCut algorithm flags -enum GrabCutModes { - /** The function initializes the state and the mask using the provided rectangle. After that it - runs iterCount iterations of the algorithm. */ - GC_INIT_WITH_RECT = 0, - /** The function initializes the state using the provided mask. Note that GC_INIT_WITH_RECT - and GC_INIT_WITH_MASK can be combined. Then, all the pixels outside of the ROI are - automatically initialized with GC_BGD .*/ - GC_INIT_WITH_MASK = 1, - /** The value means that the algorithm should just resume. */ - GC_EVAL = 2, - /** The value means that the algorithm should just run the grabCut algorithm (a single iteration) with the fixed model */ - GC_EVAL_FREEZE_MODEL = 3 -}; - -//! distanceTransform algorithm flags -enum DistanceTransformLabelTypes { - /** each connected component of zeros in src (as well as all the non-zero pixels closest to the - connected component) will be assigned the same label */ - DIST_LABEL_CCOMP = 0, - /** each zero pixel (and all the non-zero pixels closest to it) gets its own label. */ - DIST_LABEL_PIXEL = 1 -}; - -//! floodfill algorithm flags -enum FloodFillFlags { - /** If set, the difference between the current pixel and seed pixel is considered. Otherwise, - the difference between neighbor pixels is considered (that is, the range is floating). */ - FLOODFILL_FIXED_RANGE = 1 << 16, - /** If set, the function does not change the image ( newVal is ignored), and only fills the - mask with the value specified in bits 8-16 of flags as described above. This option only make - sense in function variants that have the mask parameter. */ - FLOODFILL_MASK_ONLY = 1 << 17 -}; - -//! @} imgproc_misc - -//! @addtogroup imgproc_shape -//! @{ - -//! connected components algorithm output formats -enum ConnectedComponentsTypes { - CC_STAT_LEFT = 0, //!< The leftmost (x) coordinate which is the inclusive start of the bounding - //!< box in the horizontal direction. - CC_STAT_TOP = 1, //!< The topmost (y) coordinate which is the inclusive start of the bounding - //!< box in the vertical direction. - CC_STAT_WIDTH = 2, //!< The horizontal size of the bounding box - CC_STAT_HEIGHT = 3, //!< The vertical size of the bounding box - CC_STAT_AREA = 4, //!< The total area (in pixels) of the connected component - CC_STAT_MAX = 5 -}; - -//! connected components algorithm -enum ConnectedComponentsAlgorithmsTypes { - CCL_WU = 0, //!< SAUF algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity - CCL_DEFAULT = -1, //!< BBDT algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity - CCL_GRANA = 1 //!< BBDT algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity -}; - -//! mode of the contour retrieval algorithm -enum RetrievalModes { - /** retrieves only the extreme outer contours. It sets `hierarchy[i][2]=hierarchy[i][3]=-1` for - all the contours. */ - RETR_EXTERNAL = 0, - /** retrieves all of the contours without establishing any hierarchical relationships. */ - RETR_LIST = 1, - /** retrieves all of the contours and organizes them into a two-level hierarchy. At the top - level, there are external boundaries of the components. At the second level, there are - boundaries of the holes. If there is another contour inside a hole of a connected component, it - is still put at the top level. */ - RETR_CCOMP = 2, - /** retrieves all of the contours and reconstructs a full hierarchy of nested contours.*/ - RETR_TREE = 3, - RETR_FLOODFILL = 4 //!< -}; - -//! the contour approximation algorithm -enum ContourApproximationModes { - /** stores absolutely all the contour points. That is, any 2 subsequent points (x1,y1) and - (x2,y2) of the contour will be either horizontal, vertical or diagonal neighbors, that is, - max(abs(x1-x2),abs(y2-y1))==1. */ - CHAIN_APPROX_NONE = 1, - /** compresses horizontal, vertical, and diagonal segments and leaves only their end points. - For example, an up-right rectangular contour is encoded with 4 points. */ - CHAIN_APPROX_SIMPLE = 2, - /** applies one of the flavors of the Teh-Chin chain approximation algorithm @cite TehChin89 */ - CHAIN_APPROX_TC89_L1 = 3, - /** applies one of the flavors of the Teh-Chin chain approximation algorithm @cite TehChin89 */ - CHAIN_APPROX_TC89_KCOS = 4 -}; - -/** @brief Shape matching methods - -\f$A\f$ denotes object1,\f$B\f$ denotes object2 - -\f$\begin{array}{l} m^A_i = \mathrm{sign} (h^A_i) \cdot \log{h^A_i} \\ m^B_i = \mathrm{sign} (h^B_i) \cdot \log{h^B_i} \end{array}\f$ - -and \f$h^A_i, h^B_i\f$ are the Hu moments of \f$A\f$ and \f$B\f$ , respectively. -*/ -enum ShapeMatchModes { - CONTOURS_MATCH_I1 =1, //!< \f[I_1(A,B) = \sum _{i=1...7} \left | \frac{1}{m^A_i} - \frac{1}{m^B_i} \right |\f] - CONTOURS_MATCH_I2 =2, //!< \f[I_2(A,B) = \sum _{i=1...7} \left | m^A_i - m^B_i \right |\f] - CONTOURS_MATCH_I3 =3 //!< \f[I_3(A,B) = \max _{i=1...7} \frac{ \left| m^A_i - m^B_i \right| }{ \left| m^A_i \right| }\f] -}; - -//! @} imgproc_shape - -//! @addtogroup imgproc_feature -//! @{ - -//! Variants of a Hough transform -enum HoughModes { - - /** classical or standard Hough transform. Every line is represented by two floating-point - numbers \f$(\rho, \theta)\f$ , where \f$\rho\f$ is a distance between (0,0) point and the line, - and \f$\theta\f$ is the angle between x-axis and the normal to the line. Thus, the matrix must - be (the created sequence will be) of CV_32FC2 type */ - HOUGH_STANDARD = 0, - /** probabilistic Hough transform (more efficient in case if the picture contains a few long - linear segments). It returns line segments rather than the whole line. Each segment is - represented by starting and ending points, and the matrix must be (the created sequence will - be) of the CV_32SC4 type. */ - HOUGH_PROBABILISTIC = 1, - /** multi-scale variant of the classical Hough transform. The lines are encoded the same way as - HOUGH_STANDARD. */ - HOUGH_MULTI_SCALE = 2, - HOUGH_GRADIENT = 3 //!< basically *21HT*, described in @cite Yuen90 -}; - -//! Variants of Line Segment %Detector -enum LineSegmentDetectorModes { - LSD_REFINE_NONE = 0, //!< No refinement applied - LSD_REFINE_STD = 1, //!< Standard refinement is applied. E.g. breaking arches into smaller straighter line approximations. - LSD_REFINE_ADV = 2 //!< Advanced refinement. Number of false alarms is calculated, lines are - //!< refined through increase of precision, decrement in size, etc. -}; - -//! @} imgproc_feature - -/** Histogram comparison methods - @ingroup imgproc_hist -*/ -enum HistCompMethods { - /** Correlation - \f[d(H_1,H_2) = \frac{\sum_I (H_1(I) - \bar{H_1}) (H_2(I) - \bar{H_2})}{\sqrt{\sum_I(H_1(I) - \bar{H_1})^2 \sum_I(H_2(I) - \bar{H_2})^2}}\f] - where - \f[\bar{H_k} = \frac{1}{N} \sum _J H_k(J)\f] - and \f$N\f$ is a total number of histogram bins. */ - HISTCMP_CORREL = 0, - /** Chi-Square - \f[d(H_1,H_2) = \sum _I \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)}\f] */ - HISTCMP_CHISQR = 1, - /** Intersection - \f[d(H_1,H_2) = \sum _I \min (H_1(I), H_2(I))\f] */ - HISTCMP_INTERSECT = 2, - /** Bhattacharyya distance - (In fact, OpenCV computes Hellinger distance, which is related to Bhattacharyya coefficient.) - \f[d(H_1,H_2) = \sqrt{1 - \frac{1}{\sqrt{\bar{H_1} \bar{H_2} N^2}} \sum_I \sqrt{H_1(I) \cdot H_2(I)}}\f] */ - HISTCMP_BHATTACHARYYA = 3, - HISTCMP_HELLINGER = HISTCMP_BHATTACHARYYA, //!< Synonym for HISTCMP_BHATTACHARYYA - /** Alternative Chi-Square - \f[d(H_1,H_2) = 2 * \sum _I \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)+H_2(I)}\f] - This alternative formula is regularly used for texture comparison. See e.g. @cite Puzicha1997 */ - HISTCMP_CHISQR_ALT = 4, - /** Kullback-Leibler divergence - \f[d(H_1,H_2) = \sum _I H_1(I) \log \left(\frac{H_1(I)}{H_2(I)}\right)\f] */ - HISTCMP_KL_DIV = 5 -}; - -/** the color conversion codes -@see @ref imgproc_color_conversions -@ingroup imgproc_color_conversions - */ -enum ColorConversionCodes { - COLOR_BGR2BGRA = 0, //!< add alpha channel to RGB or BGR image - COLOR_RGB2RGBA = COLOR_BGR2BGRA, - - COLOR_BGRA2BGR = 1, //!< remove alpha channel from RGB or BGR image - COLOR_RGBA2RGB = COLOR_BGRA2BGR, - - COLOR_BGR2RGBA = 2, //!< convert between RGB and BGR color spaces (with or without alpha channel) - COLOR_RGB2BGRA = COLOR_BGR2RGBA, - - COLOR_RGBA2BGR = 3, - COLOR_BGRA2RGB = COLOR_RGBA2BGR, - - COLOR_BGR2RGB = 4, - COLOR_RGB2BGR = COLOR_BGR2RGB, - - COLOR_BGRA2RGBA = 5, - COLOR_RGBA2BGRA = COLOR_BGRA2RGBA, - - COLOR_BGR2GRAY = 6, //!< convert between RGB/BGR and grayscale, @ref color_convert_rgb_gray "color conversions" - COLOR_RGB2GRAY = 7, - COLOR_GRAY2BGR = 8, - COLOR_GRAY2RGB = COLOR_GRAY2BGR, - COLOR_GRAY2BGRA = 9, - COLOR_GRAY2RGBA = COLOR_GRAY2BGRA, - COLOR_BGRA2GRAY = 10, - COLOR_RGBA2GRAY = 11, - - COLOR_BGR2BGR565 = 12, //!< convert between RGB/BGR and BGR565 (16-bit images) - COLOR_RGB2BGR565 = 13, - COLOR_BGR5652BGR = 14, - COLOR_BGR5652RGB = 15, - COLOR_BGRA2BGR565 = 16, - COLOR_RGBA2BGR565 = 17, - COLOR_BGR5652BGRA = 18, - COLOR_BGR5652RGBA = 19, - - COLOR_GRAY2BGR565 = 20, //!< convert between grayscale to BGR565 (16-bit images) - COLOR_BGR5652GRAY = 21, - - COLOR_BGR2BGR555 = 22, //!< convert between RGB/BGR and BGR555 (16-bit images) - COLOR_RGB2BGR555 = 23, - COLOR_BGR5552BGR = 24, - COLOR_BGR5552RGB = 25, - COLOR_BGRA2BGR555 = 26, - COLOR_RGBA2BGR555 = 27, - COLOR_BGR5552BGRA = 28, - COLOR_BGR5552RGBA = 29, - - COLOR_GRAY2BGR555 = 30, //!< convert between grayscale and BGR555 (16-bit images) - COLOR_BGR5552GRAY = 31, - - COLOR_BGR2XYZ = 32, //!< convert RGB/BGR to CIE XYZ, @ref color_convert_rgb_xyz "color conversions" - COLOR_RGB2XYZ = 33, - COLOR_XYZ2BGR = 34, - COLOR_XYZ2RGB = 35, - - COLOR_BGR2YCrCb = 36, //!< convert RGB/BGR to luma-chroma (aka YCC), @ref color_convert_rgb_ycrcb "color conversions" - COLOR_RGB2YCrCb = 37, - COLOR_YCrCb2BGR = 38, - COLOR_YCrCb2RGB = 39, - - COLOR_BGR2HSV = 40, //!< convert RGB/BGR to HSV (hue saturation value), @ref color_convert_rgb_hsv "color conversions" - COLOR_RGB2HSV = 41, - - COLOR_BGR2Lab = 44, //!< convert RGB/BGR to CIE Lab, @ref color_convert_rgb_lab "color conversions" - COLOR_RGB2Lab = 45, - - COLOR_BGR2Luv = 50, //!< convert RGB/BGR to CIE Luv, @ref color_convert_rgb_luv "color conversions" - COLOR_RGB2Luv = 51, - COLOR_BGR2HLS = 52, //!< convert RGB/BGR to HLS (hue lightness saturation), @ref color_convert_rgb_hls "color conversions" - COLOR_RGB2HLS = 53, - - COLOR_HSV2BGR = 54, //!< backward conversions to RGB/BGR - COLOR_HSV2RGB = 55, - - COLOR_Lab2BGR = 56, - COLOR_Lab2RGB = 57, - COLOR_Luv2BGR = 58, - COLOR_Luv2RGB = 59, - COLOR_HLS2BGR = 60, - COLOR_HLS2RGB = 61, - - COLOR_BGR2HSV_FULL = 66, - COLOR_RGB2HSV_FULL = 67, - COLOR_BGR2HLS_FULL = 68, - COLOR_RGB2HLS_FULL = 69, - - COLOR_HSV2BGR_FULL = 70, - COLOR_HSV2RGB_FULL = 71, - COLOR_HLS2BGR_FULL = 72, - COLOR_HLS2RGB_FULL = 73, - - COLOR_LBGR2Lab = 74, - COLOR_LRGB2Lab = 75, - COLOR_LBGR2Luv = 76, - COLOR_LRGB2Luv = 77, - - COLOR_Lab2LBGR = 78, - COLOR_Lab2LRGB = 79, - COLOR_Luv2LBGR = 80, - COLOR_Luv2LRGB = 81, - - COLOR_BGR2YUV = 82, //!< convert between RGB/BGR and YUV - COLOR_RGB2YUV = 83, - COLOR_YUV2BGR = 84, - COLOR_YUV2RGB = 85, - - //! YUV 4:2:0 family to RGB - COLOR_YUV2RGB_NV12 = 90, - COLOR_YUV2BGR_NV12 = 91, - COLOR_YUV2RGB_NV21 = 92, - COLOR_YUV2BGR_NV21 = 93, - COLOR_YUV420sp2RGB = COLOR_YUV2RGB_NV21, - COLOR_YUV420sp2BGR = COLOR_YUV2BGR_NV21, - - COLOR_YUV2RGBA_NV12 = 94, - COLOR_YUV2BGRA_NV12 = 95, - COLOR_YUV2RGBA_NV21 = 96, - COLOR_YUV2BGRA_NV21 = 97, - COLOR_YUV420sp2RGBA = COLOR_YUV2RGBA_NV21, - COLOR_YUV420sp2BGRA = COLOR_YUV2BGRA_NV21, - - COLOR_YUV2RGB_YV12 = 98, - COLOR_YUV2BGR_YV12 = 99, - COLOR_YUV2RGB_IYUV = 100, - COLOR_YUV2BGR_IYUV = 101, - COLOR_YUV2RGB_I420 = COLOR_YUV2RGB_IYUV, - COLOR_YUV2BGR_I420 = COLOR_YUV2BGR_IYUV, - COLOR_YUV420p2RGB = COLOR_YUV2RGB_YV12, - COLOR_YUV420p2BGR = COLOR_YUV2BGR_YV12, - - COLOR_YUV2RGBA_YV12 = 102, - COLOR_YUV2BGRA_YV12 = 103, - COLOR_YUV2RGBA_IYUV = 104, - COLOR_YUV2BGRA_IYUV = 105, - COLOR_YUV2RGBA_I420 = COLOR_YUV2RGBA_IYUV, - COLOR_YUV2BGRA_I420 = COLOR_YUV2BGRA_IYUV, - COLOR_YUV420p2RGBA = COLOR_YUV2RGBA_YV12, - COLOR_YUV420p2BGRA = COLOR_YUV2BGRA_YV12, - - COLOR_YUV2GRAY_420 = 106, - COLOR_YUV2GRAY_NV21 = COLOR_YUV2GRAY_420, - COLOR_YUV2GRAY_NV12 = COLOR_YUV2GRAY_420, - COLOR_YUV2GRAY_YV12 = COLOR_YUV2GRAY_420, - COLOR_YUV2GRAY_IYUV = COLOR_YUV2GRAY_420, - COLOR_YUV2GRAY_I420 = COLOR_YUV2GRAY_420, - COLOR_YUV420sp2GRAY = COLOR_YUV2GRAY_420, - COLOR_YUV420p2GRAY = COLOR_YUV2GRAY_420, - - //! YUV 4:2:2 family to RGB - COLOR_YUV2RGB_UYVY = 107, - COLOR_YUV2BGR_UYVY = 108, - //COLOR_YUV2RGB_VYUY = 109, - //COLOR_YUV2BGR_VYUY = 110, - COLOR_YUV2RGB_Y422 = COLOR_YUV2RGB_UYVY, - COLOR_YUV2BGR_Y422 = COLOR_YUV2BGR_UYVY, - COLOR_YUV2RGB_UYNV = COLOR_YUV2RGB_UYVY, - COLOR_YUV2BGR_UYNV = COLOR_YUV2BGR_UYVY, - - COLOR_YUV2RGBA_UYVY = 111, - COLOR_YUV2BGRA_UYVY = 112, - //COLOR_YUV2RGBA_VYUY = 113, - //COLOR_YUV2BGRA_VYUY = 114, - COLOR_YUV2RGBA_Y422 = COLOR_YUV2RGBA_UYVY, - COLOR_YUV2BGRA_Y422 = COLOR_YUV2BGRA_UYVY, - COLOR_YUV2RGBA_UYNV = COLOR_YUV2RGBA_UYVY, - COLOR_YUV2BGRA_UYNV = COLOR_YUV2BGRA_UYVY, - - COLOR_YUV2RGB_YUY2 = 115, - COLOR_YUV2BGR_YUY2 = 116, - COLOR_YUV2RGB_YVYU = 117, - COLOR_YUV2BGR_YVYU = 118, - COLOR_YUV2RGB_YUYV = COLOR_YUV2RGB_YUY2, - COLOR_YUV2BGR_YUYV = COLOR_YUV2BGR_YUY2, - COLOR_YUV2RGB_YUNV = COLOR_YUV2RGB_YUY2, - COLOR_YUV2BGR_YUNV = COLOR_YUV2BGR_YUY2, - - COLOR_YUV2RGBA_YUY2 = 119, - COLOR_YUV2BGRA_YUY2 = 120, - COLOR_YUV2RGBA_YVYU = 121, - COLOR_YUV2BGRA_YVYU = 122, - COLOR_YUV2RGBA_YUYV = COLOR_YUV2RGBA_YUY2, - COLOR_YUV2BGRA_YUYV = COLOR_YUV2BGRA_YUY2, - COLOR_YUV2RGBA_YUNV = COLOR_YUV2RGBA_YUY2, - COLOR_YUV2BGRA_YUNV = COLOR_YUV2BGRA_YUY2, - - COLOR_YUV2GRAY_UYVY = 123, - COLOR_YUV2GRAY_YUY2 = 124, - //CV_YUV2GRAY_VYUY = CV_YUV2GRAY_UYVY, - COLOR_YUV2GRAY_Y422 = COLOR_YUV2GRAY_UYVY, - COLOR_YUV2GRAY_UYNV = COLOR_YUV2GRAY_UYVY, - COLOR_YUV2GRAY_YVYU = COLOR_YUV2GRAY_YUY2, - COLOR_YUV2GRAY_YUYV = COLOR_YUV2GRAY_YUY2, - COLOR_YUV2GRAY_YUNV = COLOR_YUV2GRAY_YUY2, - - //! alpha premultiplication - COLOR_RGBA2mRGBA = 125, - COLOR_mRGBA2RGBA = 126, - - //! RGB to YUV 4:2:0 family - COLOR_RGB2YUV_I420 = 127, - COLOR_BGR2YUV_I420 = 128, - COLOR_RGB2YUV_IYUV = COLOR_RGB2YUV_I420, - COLOR_BGR2YUV_IYUV = COLOR_BGR2YUV_I420, - - COLOR_RGBA2YUV_I420 = 129, - COLOR_BGRA2YUV_I420 = 130, - COLOR_RGBA2YUV_IYUV = COLOR_RGBA2YUV_I420, - COLOR_BGRA2YUV_IYUV = COLOR_BGRA2YUV_I420, - COLOR_RGB2YUV_YV12 = 131, - COLOR_BGR2YUV_YV12 = 132, - COLOR_RGBA2YUV_YV12 = 133, - COLOR_BGRA2YUV_YV12 = 134, - - //! Demosaicing - COLOR_BayerBG2BGR = 46, - COLOR_BayerGB2BGR = 47, - COLOR_BayerRG2BGR = 48, - COLOR_BayerGR2BGR = 49, - - COLOR_BayerBG2RGB = COLOR_BayerRG2BGR, - COLOR_BayerGB2RGB = COLOR_BayerGR2BGR, - COLOR_BayerRG2RGB = COLOR_BayerBG2BGR, - COLOR_BayerGR2RGB = COLOR_BayerGB2BGR, - - COLOR_BayerBG2GRAY = 86, - COLOR_BayerGB2GRAY = 87, - COLOR_BayerRG2GRAY = 88, - COLOR_BayerGR2GRAY = 89, - - //! Demosaicing using Variable Number of Gradients - COLOR_BayerBG2BGR_VNG = 62, - COLOR_BayerGB2BGR_VNG = 63, - COLOR_BayerRG2BGR_VNG = 64, - COLOR_BayerGR2BGR_VNG = 65, - - COLOR_BayerBG2RGB_VNG = COLOR_BayerRG2BGR_VNG, - COLOR_BayerGB2RGB_VNG = COLOR_BayerGR2BGR_VNG, - COLOR_BayerRG2RGB_VNG = COLOR_BayerBG2BGR_VNG, - COLOR_BayerGR2RGB_VNG = COLOR_BayerGB2BGR_VNG, - - //! Edge-Aware Demosaicing - COLOR_BayerBG2BGR_EA = 135, - COLOR_BayerGB2BGR_EA = 136, - COLOR_BayerRG2BGR_EA = 137, - COLOR_BayerGR2BGR_EA = 138, - - COLOR_BayerBG2RGB_EA = COLOR_BayerRG2BGR_EA, - COLOR_BayerGB2RGB_EA = COLOR_BayerGR2BGR_EA, - COLOR_BayerRG2RGB_EA = COLOR_BayerBG2BGR_EA, - COLOR_BayerGR2RGB_EA = COLOR_BayerGB2BGR_EA, - - //! Demosaicing with alpha channel - COLOR_BayerBG2BGRA = 139, - COLOR_BayerGB2BGRA = 140, - COLOR_BayerRG2BGRA = 141, - COLOR_BayerGR2BGRA = 142, - - COLOR_BayerBG2RGBA = COLOR_BayerRG2BGRA, - COLOR_BayerGB2RGBA = COLOR_BayerGR2BGRA, - COLOR_BayerRG2RGBA = COLOR_BayerBG2BGRA, - COLOR_BayerGR2RGBA = COLOR_BayerGB2BGRA, - - COLOR_COLORCVT_MAX = 143 -}; - -//! @addtogroup imgproc_shape -//! @{ - -//! types of intersection between rectangles -enum RectanglesIntersectTypes { - INTERSECT_NONE = 0, //!< No intersection - INTERSECT_PARTIAL = 1, //!< There is a partial intersection - INTERSECT_FULL = 2 //!< One of the rectangle is fully enclosed in the other -}; - -/** @brief finds arbitrary template in the grayscale image using Generalized Hough Transform -*/ -class CV_EXPORTS GeneralizedHough : public Algorithm -{ -public: - //! set template to search - virtual void setTemplate(InputArray templ, Point templCenter = Point(-1, -1)) = 0; - virtual void setTemplate(InputArray edges, InputArray dx, InputArray dy, Point templCenter = Point(-1, -1)) = 0; - - //! find template on image - virtual void detect(InputArray image, OutputArray positions, OutputArray votes = noArray()) = 0; - virtual void detect(InputArray edges, InputArray dx, InputArray dy, OutputArray positions, OutputArray votes = noArray()) = 0; - - //! Canny low threshold. - virtual void setCannyLowThresh(int cannyLowThresh) = 0; - virtual int getCannyLowThresh() const = 0; - - //! Canny high threshold. - virtual void setCannyHighThresh(int cannyHighThresh) = 0; - virtual int getCannyHighThresh() const = 0; - - //! Minimum distance between the centers of the detected objects. - virtual void setMinDist(double minDist) = 0; - virtual double getMinDist() const = 0; - - //! Inverse ratio of the accumulator resolution to the image resolution. - virtual void setDp(double dp) = 0; - virtual double getDp() const = 0; - - //! Maximal size of inner buffers. - virtual void setMaxBufferSize(int maxBufferSize) = 0; - virtual int getMaxBufferSize() const = 0; -}; - -/** @brief finds arbitrary template in the grayscale image using Generalized Hough Transform - -Detects position only without translation and rotation @cite Ballard1981 . -*/ -class CV_EXPORTS GeneralizedHoughBallard : public GeneralizedHough -{ -public: - //! R-Table levels. - virtual void setLevels(int levels) = 0; - virtual int getLevels() const = 0; - - //! The accumulator threshold for the template centers at the detection stage. The smaller it is, the more false positions may be detected. - virtual void setVotesThreshold(int votesThreshold) = 0; - virtual int getVotesThreshold() const = 0; -}; - -/** @brief finds arbitrary template in the grayscale image using Generalized Hough Transform - -Detects position, translation and rotation @cite Guil1999 . -*/ -class CV_EXPORTS GeneralizedHoughGuil : public GeneralizedHough -{ -public: - //! Angle difference in degrees between two points in feature. - virtual void setXi(double xi) = 0; - virtual double getXi() const = 0; - - //! Feature table levels. - virtual void setLevels(int levels) = 0; - virtual int getLevels() const = 0; - - //! Maximal difference between angles that treated as equal. - virtual void setAngleEpsilon(double angleEpsilon) = 0; - virtual double getAngleEpsilon() const = 0; - - //! Minimal rotation angle to detect in degrees. - virtual void setMinAngle(double minAngle) = 0; - virtual double getMinAngle() const = 0; - - //! Maximal rotation angle to detect in degrees. - virtual void setMaxAngle(double maxAngle) = 0; - virtual double getMaxAngle() const = 0; - - //! Angle step in degrees. - virtual void setAngleStep(double angleStep) = 0; - virtual double getAngleStep() const = 0; - - //! Angle votes threshold. - virtual void setAngleThresh(int angleThresh) = 0; - virtual int getAngleThresh() const = 0; - - //! Minimal scale to detect. - virtual void setMinScale(double minScale) = 0; - virtual double getMinScale() const = 0; - - //! Maximal scale to detect. - virtual void setMaxScale(double maxScale) = 0; - virtual double getMaxScale() const = 0; - - //! Scale step. - virtual void setScaleStep(double scaleStep) = 0; - virtual double getScaleStep() const = 0; - - //! Scale votes threshold. - virtual void setScaleThresh(int scaleThresh) = 0; - virtual int getScaleThresh() const = 0; - - //! Position votes threshold. - virtual void setPosThresh(int posThresh) = 0; - virtual int getPosThresh() const = 0; -}; - -//! @} imgproc_shape - -//! @addtogroup imgproc_hist -//! @{ - -/** @brief Base class for Contrast Limited Adaptive Histogram Equalization. -*/ -class CV_EXPORTS_W CLAHE : public Algorithm -{ -public: - /** @brief Equalizes the histogram of a grayscale image using Contrast Limited Adaptive Histogram Equalization. - - @param src Source image of type CV_8UC1 or CV_16UC1. - @param dst Destination image. - */ - CV_WRAP virtual void apply(InputArray src, OutputArray dst) = 0; - - /** @brief Sets threshold for contrast limiting. - - @param clipLimit threshold value. - */ - CV_WRAP virtual void setClipLimit(double clipLimit) = 0; - - //! Returns threshold value for contrast limiting. - CV_WRAP virtual double getClipLimit() const = 0; - - /** @brief Sets size of grid for histogram equalization. Input image will be divided into - equally sized rectangular tiles. - - @param tileGridSize defines the number of tiles in row and column. - */ - CV_WRAP virtual void setTilesGridSize(Size tileGridSize) = 0; - - //!@brief Returns Size defines the number of tiles in row and column. - CV_WRAP virtual Size getTilesGridSize() const = 0; - - CV_WRAP virtual void collectGarbage() = 0; -}; - -//! @} imgproc_hist - -//! @addtogroup imgproc_subdiv2d -//! @{ - -class CV_EXPORTS_W Subdiv2D -{ -public: - /** Subdiv2D point location cases */ - enum { PTLOC_ERROR = -2, //!< Point location error - PTLOC_OUTSIDE_RECT = -1, //!< Point outside the subdivision bounding rect - PTLOC_INSIDE = 0, //!< Point inside some facet - PTLOC_VERTEX = 1, //!< Point coincides with one of the subdivision vertices - PTLOC_ON_EDGE = 2 //!< Point on some edge - }; - - /** Subdiv2D edge type navigation (see: getEdge()) */ - enum { NEXT_AROUND_ORG = 0x00, - NEXT_AROUND_DST = 0x22, - PREV_AROUND_ORG = 0x11, - PREV_AROUND_DST = 0x33, - NEXT_AROUND_LEFT = 0x13, - NEXT_AROUND_RIGHT = 0x31, - PREV_AROUND_LEFT = 0x20, - PREV_AROUND_RIGHT = 0x02 - }; - - /** creates an empty Subdiv2D object. - To create a new empty Delaunay subdivision you need to use the #initDelaunay function. - */ - CV_WRAP Subdiv2D(); - - /** @overload - - @param rect Rectangle that includes all of the 2D points that are to be added to the subdivision. - - The function creates an empty Delaunay subdivision where 2D points can be added using the function - insert() . All of the points to be added must be within the specified rectangle, otherwise a runtime - error is raised. - */ - CV_WRAP Subdiv2D(Rect rect); - - /** @brief Creates a new empty Delaunay subdivision - - @param rect Rectangle that includes all of the 2D points that are to be added to the subdivision. - - */ - CV_WRAP void initDelaunay(Rect rect); - - /** @brief Insert a single point into a Delaunay triangulation. - - @param pt Point to insert. - - The function inserts a single point into a subdivision and modifies the subdivision topology - appropriately. If a point with the same coordinates exists already, no new point is added. - @returns the ID of the point. - - @note If the point is outside of the triangulation specified rect a runtime error is raised. - */ - CV_WRAP int insert(Point2f pt); - - /** @brief Insert multiple points into a Delaunay triangulation. - - @param ptvec Points to insert. - - The function inserts a vector of points into a subdivision and modifies the subdivision topology - appropriately. - */ - CV_WRAP void insert(const std::vector& ptvec); - - /** @brief Returns the location of a point within a Delaunay triangulation. - - @param pt Point to locate. - @param edge Output edge that the point belongs to or is located to the right of it. - @param vertex Optional output vertex the input point coincides with. - - The function locates the input point within the subdivision and gives one of the triangle edges - or vertices. - - @returns an integer which specify one of the following five cases for point location: - - The point falls into some facet. The function returns #PTLOC_INSIDE and edge will contain one of - edges of the facet. - - The point falls onto the edge. The function returns #PTLOC_ON_EDGE and edge will contain this edge. - - The point coincides with one of the subdivision vertices. The function returns #PTLOC_VERTEX and - vertex will contain a pointer to the vertex. - - The point is outside the subdivision reference rectangle. The function returns #PTLOC_OUTSIDE_RECT - and no pointers are filled. - - One of input arguments is invalid. A runtime error is raised or, if silent or "parent" error - processing mode is selected, #PTLOC_ERROR is returned. - */ - CV_WRAP int locate(Point2f pt, CV_OUT int& edge, CV_OUT int& vertex); - - /** @brief Finds the subdivision vertex closest to the given point. - - @param pt Input point. - @param nearestPt Output subdivision vertex point. - - The function is another function that locates the input point within the subdivision. It finds the - subdivision vertex that is the closest to the input point. It is not necessarily one of vertices - of the facet containing the input point, though the facet (located using locate() ) is used as a - starting point. - - @returns vertex ID. - */ - CV_WRAP int findNearest(Point2f pt, CV_OUT Point2f* nearestPt = 0); - - /** @brief Returns a list of all edges. - - @param edgeList Output vector. - - The function gives each edge as a 4 numbers vector, where each two are one of the edge - vertices. i.e. org_x = v[0], org_y = v[1], dst_x = v[2], dst_y = v[3]. - */ - CV_WRAP void getEdgeList(CV_OUT std::vector& edgeList) const; - - /** @brief Returns a list of the leading edge ID connected to each triangle. - - @param leadingEdgeList Output vector. - - The function gives one edge ID for each triangle. - */ - CV_WRAP void getLeadingEdgeList(CV_OUT std::vector& leadingEdgeList) const; - - /** @brief Returns a list of all triangles. - - @param triangleList Output vector. - - The function gives each triangle as a 6 numbers vector, where each two are one of the triangle - vertices. i.e. p1_x = v[0], p1_y = v[1], p2_x = v[2], p2_y = v[3], p3_x = v[4], p3_y = v[5]. - */ - CV_WRAP void getTriangleList(CV_OUT std::vector& triangleList) const; - - /** @brief Returns a list of all Voroni facets. - - @param idx Vector of vertices IDs to consider. For all vertices you can pass empty vector. - @param facetList Output vector of the Voroni facets. - @param facetCenters Output vector of the Voroni facets center points. - - */ - CV_WRAP void getVoronoiFacetList(const std::vector& idx, CV_OUT std::vector >& facetList, - CV_OUT std::vector& facetCenters); - - /** @brief Returns vertex location from vertex ID. - - @param vertex vertex ID. - @param firstEdge Optional. The first edge ID which is connected to the vertex. - @returns vertex (x,y) - - */ - CV_WRAP Point2f getVertex(int vertex, CV_OUT int* firstEdge = 0) const; - - /** @brief Returns one of the edges related to the given edge. - - @param edge Subdivision edge ID. - @param nextEdgeType Parameter specifying which of the related edges to return. - The following values are possible: - - NEXT_AROUND_ORG next around the edge origin ( eOnext on the picture below if e is the input edge) - - NEXT_AROUND_DST next around the edge vertex ( eDnext ) - - PREV_AROUND_ORG previous around the edge origin (reversed eRnext ) - - PREV_AROUND_DST previous around the edge destination (reversed eLnext ) - - NEXT_AROUND_LEFT next around the left facet ( eLnext ) - - NEXT_AROUND_RIGHT next around the right facet ( eRnext ) - - PREV_AROUND_LEFT previous around the left facet (reversed eOnext ) - - PREV_AROUND_RIGHT previous around the right facet (reversed eDnext ) - - ![sample output](pics/quadedge.png) - - @returns edge ID related to the input edge. - */ - CV_WRAP int getEdge( int edge, int nextEdgeType ) const; - - /** @brief Returns next edge around the edge origin. - - @param edge Subdivision edge ID. - - @returns an integer which is next edge ID around the edge origin: eOnext on the - picture above if e is the input edge). - */ - CV_WRAP int nextEdge(int edge) const; - - /** @brief Returns another edge of the same quad-edge. - - @param edge Subdivision edge ID. - @param rotate Parameter specifying which of the edges of the same quad-edge as the input - one to return. The following values are possible: - - 0 - the input edge ( e on the picture below if e is the input edge) - - 1 - the rotated edge ( eRot ) - - 2 - the reversed edge (reversed e (in green)) - - 3 - the reversed rotated edge (reversed eRot (in green)) - - @returns one of the edges ID of the same quad-edge as the input edge. - */ - CV_WRAP int rotateEdge(int edge, int rotate) const; - CV_WRAP int symEdge(int edge) const; - - /** @brief Returns the edge origin. - - @param edge Subdivision edge ID. - @param orgpt Output vertex location. - - @returns vertex ID. - */ - CV_WRAP int edgeOrg(int edge, CV_OUT Point2f* orgpt = 0) const; - - /** @brief Returns the edge destination. - - @param edge Subdivision edge ID. - @param dstpt Output vertex location. - - @returns vertex ID. - */ - CV_WRAP int edgeDst(int edge, CV_OUT Point2f* dstpt = 0) const; - -protected: - int newEdge(); - void deleteEdge(int edge); - int newPoint(Point2f pt, bool isvirtual, int firstEdge = 0); - void deletePoint(int vtx); - void setEdgePoints( int edge, int orgPt, int dstPt ); - void splice( int edgeA, int edgeB ); - int connectEdges( int edgeA, int edgeB ); - void swapEdges( int edge ); - int isRightOf(Point2f pt, int edge) const; - void calcVoronoi(); - void clearVoronoi(); - void checkSubdiv() const; - - struct CV_EXPORTS Vertex - { - Vertex(); - Vertex(Point2f pt, bool _isvirtual, int _firstEdge=0); - bool isvirtual() const; - bool isfree() const; - - int firstEdge; - int type; - Point2f pt; - }; - - struct CV_EXPORTS QuadEdge - { - QuadEdge(); - QuadEdge(int edgeidx); - bool isfree() const; - - int next[4]; - int pt[4]; - }; - - //! All of the vertices - std::vector vtx; - //! All of the edges - std::vector qedges; - int freeQEdge; - int freePoint; - bool validGeometry; - - int recentEdge; - //! Top left corner of the bounding rect - Point2f topLeft; - //! Bottom right corner of the bounding rect - Point2f bottomRight; -}; - -//! @} imgproc_subdiv2d - -//! @addtogroup imgproc_feature -//! @{ - -/** @brief Line segment detector class - -following the algorithm described at @cite Rafael12 . - -@note Implementation has been removed due original code license conflict - -*/ -class CV_EXPORTS_W LineSegmentDetector : public Algorithm -{ -public: - - /** @brief Finds lines in the input image. - - This is the output of the default parameters of the algorithm on the above shown image. - - ![image](pics/building_lsd.png) - - @param _image A grayscale (CV_8UC1) input image. If only a roi needs to be selected, use: - `lsd_ptr-\>detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);` - @param _lines A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. Where - Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly - oriented depending on the gradient. - @param width Vector of widths of the regions, where the lines are found. E.g. Width of line. - @param prec Vector of precisions with which the lines are found. - @param nfa Vector containing number of false alarms in the line region, with precision of 10%. The - bigger the value, logarithmically better the detection. - - -1 corresponds to 10 mean false alarms - - 0 corresponds to 1 mean false alarm - - 1 corresponds to 0.1 mean false alarms - This vector will be calculated only when the objects type is #LSD_REFINE_ADV. - */ - CV_WRAP virtual void detect(InputArray _image, OutputArray _lines, - OutputArray width = noArray(), OutputArray prec = noArray(), - OutputArray nfa = noArray()) = 0; - - /** @brief Draws the line segments on a given image. - @param _image The image, where the lines will be drawn. Should be bigger or equal to the image, - where the lines were found. - @param lines A vector of the lines that needed to be drawn. - */ - CV_WRAP virtual void drawSegments(InputOutputArray _image, InputArray lines) = 0; - - /** @brief Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels. - - @param size The size of the image, where lines1 and lines2 were found. - @param lines1 The first group of lines that needs to be drawn. It is visualized in blue color. - @param lines2 The second group of lines. They visualized in red color. - @param _image Optional image, where the lines will be drawn. The image should be color(3-channel) - in order for lines1 and lines2 to be drawn in the above mentioned colors. - */ - CV_WRAP virtual int compareSegments(const Size& size, InputArray lines1, InputArray lines2, InputOutputArray _image = noArray()) = 0; - - virtual ~LineSegmentDetector() { } -}; - -/** @brief Creates a smart pointer to a LineSegmentDetector object and initializes it. - -The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want -to edit those, as to tailor it for their own application. - -@param _refine The way found lines will be refined, see #LineSegmentDetectorModes -@param _scale The scale of the image that will be used to find the lines. Range (0..1]. -@param _sigma_scale Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale. -@param _quant Bound to the quantization error on the gradient norm. -@param _ang_th Gradient angle tolerance in degrees. -@param _log_eps Detection threshold: -log10(NFA) \> log_eps. Used only when advance refinement -is chosen. -@param _density_th Minimal density of aligned region points in the enclosing rectangle. -@param _n_bins Number of bins in pseudo-ordering of gradient modulus. - -@note Implementation has been removed due original code license conflict - */ -CV_EXPORTS_W Ptr createLineSegmentDetector( - int _refine = LSD_REFINE_STD, double _scale = 0.8, - double _sigma_scale = 0.6, double _quant = 2.0, double _ang_th = 22.5, - double _log_eps = 0, double _density_th = 0.7, int _n_bins = 1024); - -//! @} imgproc_feature - -//! @addtogroup imgproc_filter -//! @{ - -/** @brief Returns Gaussian filter coefficients. - -The function computes and returns the \f$\texttt{ksize} \times 1\f$ matrix of Gaussian filter -coefficients: - -\f[G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},\f] - -where \f$i=0..\texttt{ksize}-1\f$ and \f$\alpha\f$ is the scale factor chosen so that \f$\sum_i G_i=1\f$. - -Two of such generated kernels can be passed to sepFilter2D. Those functions automatically recognize -smoothing kernels (a symmetrical kernel with sum of weights equal to 1) and handle them accordingly. -You may also use the higher-level GaussianBlur. -@param ksize Aperture size. It should be odd ( \f$\texttt{ksize} \mod 2 = 1\f$ ) and positive. -@param sigma Gaussian standard deviation. If it is non-positive, it is computed from ksize as -`sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8`. -@param ktype Type of filter coefficients. It can be CV_32F or CV_64F . -@sa sepFilter2D, getDerivKernels, getStructuringElement, GaussianBlur - */ -CV_EXPORTS_W Mat getGaussianKernel( int ksize, double sigma, int ktype = CV_64F ); - -/** @brief Returns filter coefficients for computing spatial image derivatives. - -The function computes and returns the filter coefficients for spatial image derivatives. When -`ksize=CV_SCHARR`, the Scharr \f$3 \times 3\f$ kernels are generated (see #Scharr). Otherwise, Sobel -kernels are generated (see #Sobel). The filters are normally passed to #sepFilter2D or to - -@param kx Output matrix of row filter coefficients. It has the type ktype . -@param ky Output matrix of column filter coefficients. It has the type ktype . -@param dx Derivative order in respect of x. -@param dy Derivative order in respect of y. -@param ksize Aperture size. It can be CV_SCHARR, 1, 3, 5, or 7. -@param normalize Flag indicating whether to normalize (scale down) the filter coefficients or not. -Theoretically, the coefficients should have the denominator \f$=2^{ksize*2-dx-dy-2}\f$. If you are -going to filter floating-point images, you are likely to use the normalized kernels. But if you -compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve -all the fractional bits, you may want to set normalize=false . -@param ktype Type of filter coefficients. It can be CV_32f or CV_64F . - */ -CV_EXPORTS_W void getDerivKernels( OutputArray kx, OutputArray ky, - int dx, int dy, int ksize, - bool normalize = false, int ktype = CV_32F ); - -/** @brief Returns Gabor filter coefficients. - -For more details about gabor filter equations and parameters, see: [Gabor -Filter](http://en.wikipedia.org/wiki/Gabor_filter). - -@param ksize Size of the filter returned. -@param sigma Standard deviation of the gaussian envelope. -@param theta Orientation of the normal to the parallel stripes of a Gabor function. -@param lambd Wavelength of the sinusoidal factor. -@param gamma Spatial aspect ratio. -@param psi Phase offset. -@param ktype Type of filter coefficients. It can be CV_32F or CV_64F . - */ -CV_EXPORTS_W Mat getGaborKernel( Size ksize, double sigma, double theta, double lambd, - double gamma, double psi = CV_PI*0.5, int ktype = CV_64F ); - -//! returns "magic" border value for erosion and dilation. It is automatically transformed to Scalar::all(-DBL_MAX) for dilation. -static inline Scalar morphologyDefaultBorderValue() { return Scalar::all(DBL_MAX); } - -/** @brief Returns a structuring element of the specified size and shape for morphological operations. - -The function constructs and returns the structuring element that can be further passed to #erode, -#dilate or #morphologyEx. But you can also construct an arbitrary binary mask yourself and use it as -the structuring element. - -@param shape Element shape that could be one of #MorphShapes -@param ksize Size of the structuring element. -@param anchor Anchor position within the element. The default value \f$(-1, -1)\f$ means that the -anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor -position. In other cases the anchor just regulates how much the result of the morphological -operation is shifted. - */ -CV_EXPORTS_W Mat getStructuringElement(int shape, Size ksize, Point anchor = Point(-1,-1)); - -/** @example samples/cpp/tutorial_code/ImgProc/Smoothing/Smoothing.cpp -Sample code for simple filters -![Sample screenshot](Smoothing_Tutorial_Result_Median_Filter.jpg) -Check @ref tutorial_gausian_median_blur_bilateral_filter "the corresponding tutorial" for more details - */ - -/** @brief Blurs an image using the median filter. - -The function smoothes an image using the median filter with the \f$\texttt{ksize} \times -\texttt{ksize}\f$ aperture. Each channel of a multi-channel image is processed independently. -In-place operation is supported. - -@note The median filter uses #BORDER_REPLICATE internally to cope with border pixels, see #BorderTypes - -@param src input 1-, 3-, or 4-channel image; when ksize is 3 or 5, the image depth should be -CV_8U, CV_16U, or CV_32F, for larger aperture sizes, it can only be CV_8U. -@param dst destination array of the same size and type as src. -@param ksize aperture linear size; it must be odd and greater than 1, for example: 3, 5, 7 ... -@sa bilateralFilter, blur, boxFilter, GaussianBlur - */ -CV_EXPORTS_W void medianBlur( InputArray src, OutputArray dst, int ksize ); - -/** @brief Blurs an image using a Gaussian filter. - -The function convolves the source image with the specified Gaussian kernel. In-place filtering is -supported. - -@param src input image; the image can have any number of channels, which are processed -independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. -@param dst output image of the same size and type as src. -@param ksize Gaussian kernel size. ksize.width and ksize.height can differ but they both must be -positive and odd. Or, they can be zero's and then they are computed from sigma. -@param sigmaX Gaussian kernel standard deviation in X direction. -@param sigmaY Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be -equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height, -respectively (see #getGaussianKernel for details); to fully control the result regardless of -possible future modifications of all this semantics, it is recommended to specify all of ksize, -sigmaX, and sigmaY. -@param borderType pixel extrapolation method, see #BorderTypes - -@sa sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlur - */ -CV_EXPORTS_W void GaussianBlur( InputArray src, OutputArray dst, Size ksize, - double sigmaX, double sigmaY = 0, - int borderType = BORDER_DEFAULT ); - -/** @brief Applies the bilateral filter to an image. - -The function applies bilateral filtering to the input image, as described in -http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html -bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is -very slow compared to most filters. - -_Sigma values_: For simplicity, you can set the 2 sigma values to be the same. If they are small (\< -10), the filter will not have much effect, whereas if they are large (\> 150), they will have a very -strong effect, making the image look "cartoonish". - -_Filter size_: Large filters (d \> 5) are very slow, so it is recommended to use d=5 for real-time -applications, and perhaps d=9 for offline applications that need heavy noise filtering. - -This filter does not work inplace. -@param src Source 8-bit or floating-point, 1-channel or 3-channel image. -@param dst Destination image of the same size and type as src . -@param d Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, -it is computed from sigmaSpace. -@param sigmaColor Filter sigma in the color space. A larger value of the parameter means that -farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting -in larger areas of semi-equal color. -@param sigmaSpace Filter sigma in the coordinate space. A larger value of the parameter means that -farther pixels will influence each other as long as their colors are close enough (see sigmaColor -). When d\>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is -proportional to sigmaSpace. -@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes - */ -CV_EXPORTS_W void bilateralFilter( InputArray src, OutputArray dst, int d, - double sigmaColor, double sigmaSpace, - int borderType = BORDER_DEFAULT ); - -/** @brief Blurs an image using the box filter. - -The function smooths an image using the kernel: - -\f[\texttt{K} = \alpha \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \end{bmatrix}\f] - -where - -\f[\alpha = \fork{\frac{1}{\texttt{ksize.width*ksize.height}}}{when \texttt{normalize=true}}{1}{otherwise}\f] - -Unnormalized box filter is useful for computing various integral characteristics over each pixel -neighborhood, such as covariance matrices of image derivatives (used in dense optical flow -algorithms, and so on). If you need to compute pixel sums over variable-size windows, use #integral. - -@param src input image. -@param dst output image of the same size and type as src. -@param ddepth the output image depth (-1 to use src.depth()). -@param ksize blurring kernel size. -@param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel -center. -@param normalize flag, specifying whether the kernel is normalized by its area or not. -@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes -@sa blur, bilateralFilter, GaussianBlur, medianBlur, integral - */ -CV_EXPORTS_W void boxFilter( InputArray src, OutputArray dst, int ddepth, - Size ksize, Point anchor = Point(-1,-1), - bool normalize = true, - int borderType = BORDER_DEFAULT ); - -/** @brief Calculates the normalized sum of squares of the pixel values overlapping the filter. - -For every pixel \f$ (x, y) \f$ in the source image, the function calculates the sum of squares of those neighboring -pixel values which overlap the filter placed over the pixel \f$ (x, y) \f$. - -The unnormalized square box filter can be useful in computing local image statistics such as the the local -variance and standard deviation around the neighborhood of a pixel. - -@param src input image -@param dst output image of the same size and type as _src -@param ddepth the output image depth (-1 to use src.depth()) -@param ksize kernel size -@param anchor kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel -center. -@param normalize flag, specifying whether the kernel is to be normalized by it's area or not. -@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes -@sa boxFilter -*/ -CV_EXPORTS_W void sqrBoxFilter( InputArray src, OutputArray dst, int ddepth, - Size ksize, Point anchor = Point(-1, -1), - bool normalize = true, - int borderType = BORDER_DEFAULT ); - -/** @brief Blurs an image using the normalized box filter. - -The function smooths an image using the kernel: - -\f[\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \end{bmatrix}\f] - -The call `blur(src, dst, ksize, anchor, borderType)` is equivalent to `boxFilter(src, dst, src.type(), -anchor, true, borderType)`. - -@param src input image; it can have any number of channels, which are processed independently, but -the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. -@param dst output image of the same size and type as src. -@param ksize blurring kernel size. -@param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel -center. -@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes -@sa boxFilter, bilateralFilter, GaussianBlur, medianBlur - */ -CV_EXPORTS_W void blur( InputArray src, OutputArray dst, - Size ksize, Point anchor = Point(-1,-1), - int borderType = BORDER_DEFAULT ); - -/** @brief Convolves an image with the kernel. - -The function applies an arbitrary linear filter to an image. In-place operation is supported. When -the aperture is partially outside the image, the function interpolates outlier pixel values -according to the specified border mode. - -The function does actually compute correlation, not the convolution: - -\f[\texttt{dst} (x,y) = \sum _{ \stackrel{0\leq x' < \texttt{kernel.cols},}{0\leq y' < \texttt{kernel.rows}} } \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\f] - -That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip -the kernel using #flip and set the new anchor to `(kernel.cols - anchor.x - 1, kernel.rows - -anchor.y - 1)`. - -The function uses the DFT-based algorithm in case of sufficiently large kernels (~`11 x 11` or -larger) and the direct algorithm for small kernels. - -@param src input image. -@param dst output image of the same size and the same number of channels as src. -@param ddepth desired depth of the destination image, see @ref filter_depths "combinations" -@param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point -matrix; if you want to apply different kernels to different channels, split the image into -separate color planes using split and process them individually. -@param anchor anchor of the kernel that indicates the relative position of a filtered point within -the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor -is at the kernel center. -@param delta optional value added to the filtered pixels before storing them in dst. -@param borderType pixel extrapolation method, see #BorderTypes -@sa sepFilter2D, dft, matchTemplate - */ -CV_EXPORTS_W void filter2D( InputArray src, OutputArray dst, int ddepth, - InputArray kernel, Point anchor = Point(-1,-1), - double delta = 0, int borderType = BORDER_DEFAULT ); - -/** @brief Applies a separable linear filter to an image. - -The function applies a separable linear filter to the image. That is, first, every row of src is -filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D -kernel kernelY. The final result shifted by delta is stored in dst . - -@param src Source image. -@param dst Destination image of the same size and the same number of channels as src . -@param ddepth Destination image depth, see @ref filter_depths "combinations" -@param kernelX Coefficients for filtering each row. -@param kernelY Coefficients for filtering each column. -@param anchor Anchor position within the kernel. The default value \f$(-1,-1)\f$ means that the anchor -is at the kernel center. -@param delta Value added to the filtered results before storing them. -@param borderType Pixel extrapolation method, see #BorderTypes -@sa filter2D, Sobel, GaussianBlur, boxFilter, blur - */ -CV_EXPORTS_W void sepFilter2D( InputArray src, OutputArray dst, int ddepth, - InputArray kernelX, InputArray kernelY, - Point anchor = Point(-1,-1), - double delta = 0, int borderType = BORDER_DEFAULT ); - -/** @example samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp -Sample code using Sobel and/or Scharr OpenCV functions to make a simple Edge Detector -![Sample screenshot](Sobel_Derivatives_Tutorial_Result.jpg) -Check @ref tutorial_sobel_derivatives "the corresponding tutorial" for more details -*/ - -/** @brief Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator. - -In all cases except one, the \f$\texttt{ksize} \times \texttt{ksize}\f$ separable kernel is used to -calculate the derivative. When \f$\texttt{ksize = 1}\f$, the \f$3 \times 1\f$ or \f$1 \times 3\f$ -kernel is used (that is, no Gaussian smoothing is done). `ksize = 1` can only be used for the first -or the second x- or y- derivatives. - -There is also the special value `ksize = #CV_SCHARR (-1)` that corresponds to the \f$3\times3\f$ Scharr -filter that may give more accurate results than the \f$3\times3\f$ Sobel. The Scharr aperture is - -\f[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\f] - -for the x-derivative, or transposed for the y-derivative. - -The function calculates an image derivative by convolving the image with the appropriate kernel: - -\f[\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\f] - -The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less -resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3) -or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first -case corresponds to a kernel of: - -\f[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\f] - -The second case corresponds to a kernel of: - -\f[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\f] - -@param src input image. -@param dst output image of the same size and the same number of channels as src . -@param ddepth output image depth, see @ref filter_depths "combinations"; in the case of - 8-bit input images it will result in truncated derivatives. -@param dx order of the derivative x. -@param dy order of the derivative y. -@param ksize size of the extended Sobel kernel; it must be 1, 3, 5, or 7. -@param scale optional scale factor for the computed derivative values; by default, no scaling is -applied (see #getDerivKernels for details). -@param delta optional delta value that is added to the results prior to storing them in dst. -@param borderType pixel extrapolation method, see #BorderTypes -@sa Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar - */ -CV_EXPORTS_W void Sobel( InputArray src, OutputArray dst, int ddepth, - int dx, int dy, int ksize = 3, - double scale = 1, double delta = 0, - int borderType = BORDER_DEFAULT ); - -/** @brief Calculates the first order image derivative in both x and y using a Sobel operator - -Equivalent to calling: - -@code -Sobel( src, dx, CV_16SC1, 1, 0, 3 ); -Sobel( src, dy, CV_16SC1, 0, 1, 3 ); -@endcode - -@param src input image. -@param dx output image with first-order derivative in x. -@param dy output image with first-order derivative in y. -@param ksize size of Sobel kernel. It must be 3. -@param borderType pixel extrapolation method, see #BorderTypes - -@sa Sobel - */ - -CV_EXPORTS_W void spatialGradient( InputArray src, OutputArray dx, - OutputArray dy, int ksize = 3, - int borderType = BORDER_DEFAULT ); - -/** @brief Calculates the first x- or y- image derivative using Scharr operator. - -The function computes the first x- or y- spatial image derivative using the Scharr operator. The -call - -\f[\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\f] - -is equivalent to - -\f[\texttt{Sobel(src, dst, ddepth, dx, dy, CV_SCHARR, scale, delta, borderType)} .\f] - -@param src input image. -@param dst output image of the same size and the same number of channels as src. -@param ddepth output image depth, see @ref filter_depths "combinations" -@param dx order of the derivative x. -@param dy order of the derivative y. -@param scale optional scale factor for the computed derivative values; by default, no scaling is -applied (see #getDerivKernels for details). -@param delta optional delta value that is added to the results prior to storing them in dst. -@param borderType pixel extrapolation method, see #BorderTypes -@sa cartToPolar - */ -CV_EXPORTS_W void Scharr( InputArray src, OutputArray dst, int ddepth, - int dx, int dy, double scale = 1, double delta = 0, - int borderType = BORDER_DEFAULT ); - -/** @example samples/cpp/laplace.cpp -An example using Laplace transformations for edge detection -*/ - -/** @brief Calculates the Laplacian of an image. - -The function calculates the Laplacian of the source image by adding up the second x and y -derivatives calculated using the Sobel operator: - -\f[\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\f] - -This is done when `ksize > 1`. When `ksize == 1`, the Laplacian is computed by filtering the image -with the following \f$3 \times 3\f$ aperture: - -\f[\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\f] - -@param src Source image. -@param dst Destination image of the same size and the same number of channels as src . -@param ddepth Desired depth of the destination image. -@param ksize Aperture size used to compute the second-derivative filters. See #getDerivKernels for -details. The size must be positive and odd. -@param scale Optional scale factor for the computed Laplacian values. By default, no scaling is -applied. See #getDerivKernels for details. -@param delta Optional delta value that is added to the results prior to storing them in dst . -@param borderType Pixel extrapolation method, see #BorderTypes -@sa Sobel, Scharr - */ -CV_EXPORTS_W void Laplacian( InputArray src, OutputArray dst, int ddepth, - int ksize = 1, double scale = 1, double delta = 0, - int borderType = BORDER_DEFAULT ); - -//! @} imgproc_filter - -//! @addtogroup imgproc_feature -//! @{ - -/** @example samples/cpp/edge.cpp -This program demonstrates usage of the Canny edge detector - -Check @ref tutorial_canny_detector "the corresponding tutorial" for more details -*/ - -/** @brief Finds edges in an image using the Canny algorithm @cite Canny86 . - -The function finds edges in the input image and marks them in the output map edges using the -Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The -largest value is used to find initial segments of strong edges. See - - -@param image 8-bit input image. -@param edges output edge map; single channels 8-bit image, which has the same size as image . -@param threshold1 first threshold for the hysteresis procedure. -@param threshold2 second threshold for the hysteresis procedure. -@param apertureSize aperture size for the Sobel operator. -@param L2gradient a flag, indicating whether a more accurate \f$L_2\f$ norm -\f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude ( -L2gradient=true ), or whether the default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough ( -L2gradient=false ). - */ -CV_EXPORTS_W void Canny( InputArray image, OutputArray edges, - double threshold1, double threshold2, - int apertureSize = 3, bool L2gradient = false ); - -/** \overload - -Finds edges in an image using the Canny algorithm with custom image gradient. - -@param dx 16-bit x derivative of input image (CV_16SC1 or CV_16SC3). -@param dy 16-bit y derivative of input image (same type as dx). -@param edges output edge map; single channels 8-bit image, which has the same size as image . -@param threshold1 first threshold for the hysteresis procedure. -@param threshold2 second threshold for the hysteresis procedure. -@param L2gradient a flag, indicating whether a more accurate \f$L_2\f$ norm -\f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude ( -L2gradient=true ), or whether the default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough ( -L2gradient=false ). - */ -CV_EXPORTS_W void Canny( InputArray dx, InputArray dy, - OutputArray edges, - double threshold1, double threshold2, - bool L2gradient = false ); - -/** @brief Calculates the minimal eigenvalue of gradient matrices for corner detection. - -The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal -eigenvalue of the covariance matrix of derivatives, that is, \f$\min(\lambda_1, \lambda_2)\f$ in terms -of the formulae in the cornerEigenValsAndVecs description. - -@param src Input single-channel 8-bit or floating-point image. -@param dst Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as -src . -@param blockSize Neighborhood size (see the details on #cornerEigenValsAndVecs ). -@param ksize Aperture parameter for the Sobel operator. -@param borderType Pixel extrapolation method. See #BorderTypes. - */ -CV_EXPORTS_W void cornerMinEigenVal( InputArray src, OutputArray dst, - int blockSize, int ksize = 3, - int borderType = BORDER_DEFAULT ); - -/** @brief Harris corner detector. - -The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and -cornerEigenValsAndVecs , for each pixel \f$(x, y)\f$ it calculates a \f$2\times2\f$ gradient covariance -matrix \f$M^{(x,y)}\f$ over a \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood. Then, it -computes the following characteristic: - -\f[\texttt{dst} (x,y) = \mathrm{det} M^{(x,y)} - k \cdot \left ( \mathrm{tr} M^{(x,y)} \right )^2\f] - -Corners in the image can be found as the local maxima of this response map. - -@param src Input single-channel 8-bit or floating-point image. -@param dst Image to store the Harris detector responses. It has the type CV_32FC1 and the same -size as src . -@param blockSize Neighborhood size (see the details on #cornerEigenValsAndVecs ). -@param ksize Aperture parameter for the Sobel operator. -@param k Harris detector free parameter. See the formula above. -@param borderType Pixel extrapolation method. See #BorderTypes. - */ -CV_EXPORTS_W void cornerHarris( InputArray src, OutputArray dst, int blockSize, - int ksize, double k, - int borderType = BORDER_DEFAULT ); - -/** @brief Calculates eigenvalues and eigenvectors of image blocks for corner detection. - -For every pixel \f$p\f$ , the function cornerEigenValsAndVecs considers a blockSize \f$\times\f$ blockSize -neighborhood \f$S(p)\f$ . It calculates the covariation matrix of derivatives over the neighborhood as: - -\f[M = \begin{bmatrix} \sum _{S(p)}(dI/dx)^2 & \sum _{S(p)}dI/dx dI/dy \\ \sum _{S(p)}dI/dx dI/dy & \sum _{S(p)}(dI/dy)^2 \end{bmatrix}\f] - -where the derivatives are computed using the Sobel operator. - -After that, it finds eigenvectors and eigenvalues of \f$M\f$ and stores them in the destination image as -\f$(\lambda_1, \lambda_2, x_1, y_1, x_2, y_2)\f$ where - -- \f$\lambda_1, \lambda_2\f$ are the non-sorted eigenvalues of \f$M\f$ -- \f$x_1, y_1\f$ are the eigenvectors corresponding to \f$\lambda_1\f$ -- \f$x_2, y_2\f$ are the eigenvectors corresponding to \f$\lambda_2\f$ - -The output of the function can be used for robust edge or corner detection. - -@param src Input single-channel 8-bit or floating-point image. -@param dst Image to store the results. It has the same size as src and the type CV_32FC(6) . -@param blockSize Neighborhood size (see details below). -@param ksize Aperture parameter for the Sobel operator. -@param borderType Pixel extrapolation method. See #BorderTypes. - -@sa cornerMinEigenVal, cornerHarris, preCornerDetect - */ -CV_EXPORTS_W void cornerEigenValsAndVecs( InputArray src, OutputArray dst, - int blockSize, int ksize, - int borderType = BORDER_DEFAULT ); - -/** @brief Calculates a feature map for corner detection. - -The function calculates the complex spatial derivative-based function of the source image - -\f[\texttt{dst} = (D_x \texttt{src} )^2 \cdot D_{yy} \texttt{src} + (D_y \texttt{src} )^2 \cdot D_{xx} \texttt{src} - 2 D_x \texttt{src} \cdot D_y \texttt{src} \cdot D_{xy} \texttt{src}\f] - -where \f$D_x\f$,\f$D_y\f$ are the first image derivatives, \f$D_{xx}\f$,\f$D_{yy}\f$ are the second image -derivatives, and \f$D_{xy}\f$ is the mixed derivative. - -The corners can be found as local maximums of the functions, as shown below: -@code - Mat corners, dilated_corners; - preCornerDetect(image, corners, 3); - // dilation with 3x3 rectangular structuring element - dilate(corners, dilated_corners, Mat(), 1); - Mat corner_mask = corners == dilated_corners; -@endcode - -@param src Source single-channel 8-bit of floating-point image. -@param dst Output image that has the type CV_32F and the same size as src . -@param ksize %Aperture size of the Sobel . -@param borderType Pixel extrapolation method. See #BorderTypes. - */ -CV_EXPORTS_W void preCornerDetect( InputArray src, OutputArray dst, int ksize, - int borderType = BORDER_DEFAULT ); - -/** @brief Refines the corner locations. - -The function iterates to find the sub-pixel accurate location of corners or radial saddle points, as -shown on the figure below. - -![image](pics/cornersubpix.png) - -Sub-pixel accurate corner locator is based on the observation that every vector from the center \f$q\f$ -to a point \f$p\f$ located within a neighborhood of \f$q\f$ is orthogonal to the image gradient at \f$p\f$ -subject to image and measurement noise. Consider the expression: - -\f[\epsilon _i = {DI_{p_i}}^T \cdot (q - p_i)\f] - -where \f${DI_{p_i}}\f$ is an image gradient at one of the points \f$p_i\f$ in a neighborhood of \f$q\f$ . The -value of \f$q\f$ is to be found so that \f$\epsilon_i\f$ is minimized. A system of equations may be set up -with \f$\epsilon_i\f$ set to zero: - -\f[\sum _i(DI_{p_i} \cdot {DI_{p_i}}^T) \cdot q - \sum _i(DI_{p_i} \cdot {DI_{p_i}}^T \cdot p_i)\f] - -where the gradients are summed within a neighborhood ("search window") of \f$q\f$ . Calling the first -gradient term \f$G\f$ and the second gradient term \f$b\f$ gives: - -\f[q = G^{-1} \cdot b\f] - -The algorithm sets the center of the neighborhood window at this new center \f$q\f$ and then iterates -until the center stays within a set threshold. - -@param image Input single-channel, 8-bit or float image. -@param corners Initial coordinates of the input corners and refined coordinates provided for -output. -@param winSize Half of the side length of the search window. For example, if winSize=Size(5,5) , -then a \f$(5*2+1) \times (5*2+1) = 11 \times 11\f$ search window is used. -@param zeroZone Half of the size of the dead region in the middle of the search zone over which -the summation in the formula below is not done. It is used sometimes to avoid possible -singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such -a size. -@param criteria Criteria for termination of the iterative process of corner refinement. That is, -the process of corner position refinement stops either after criteria.maxCount iterations or when -the corner position moves by less than criteria.epsilon on some iteration. - */ -CV_EXPORTS_W void cornerSubPix( InputArray image, InputOutputArray corners, - Size winSize, Size zeroZone, - TermCriteria criteria ); - -/** @brief Determines strong corners on an image. - -The function finds the most prominent corners in the image or in the specified image region, as -described in @cite Shi94 - -- Function calculates the corner quality measure at every source image pixel using the - #cornerMinEigenVal or #cornerHarris . -- Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are - retained). -- The corners with the minimal eigenvalue less than - \f$\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\f$ are rejected. -- The remaining corners are sorted by the quality measure in the descending order. -- Function throws away each corner for which there is a stronger corner at a distance less than - maxDistance. - -The function can be used to initialize a point-based tracker of an object. - -@note If the function is called with different values A and B of the parameter qualityLevel , and -A \> B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector -with qualityLevel=B . - -@param image Input 8-bit or floating-point 32-bit, single-channel image. -@param corners Output vector of detected corners. -@param maxCorners Maximum number of corners to return. If there are more corners than are found, -the strongest of them is returned. `maxCorners <= 0` implies that no limit on the maximum is set -and all detected corners are returned. -@param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The -parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue -(see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the -quality measure less than the product are rejected. For example, if the best corner has the -quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure -less than 15 are rejected. -@param minDistance Minimum possible Euclidean distance between the returned corners. -@param mask Optional region of interest. If the image is not empty (it needs to have the type -CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected. -@param blockSize Size of an average block for computing a derivative covariation matrix over each -pixel neighborhood. See cornerEigenValsAndVecs . -@param useHarrisDetector Parameter indicating whether to use a Harris detector (see #cornerHarris) -or #cornerMinEigenVal. -@param k Free parameter of the Harris detector. - -@sa cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform, - */ - -CV_EXPORTS_W void goodFeaturesToTrack( InputArray image, OutputArray corners, - int maxCorners, double qualityLevel, double minDistance, - InputArray mask = noArray(), int blockSize = 3, - bool useHarrisDetector = false, double k = 0.04 ); - -CV_EXPORTS_W void goodFeaturesToTrack( InputArray image, OutputArray corners, - int maxCorners, double qualityLevel, double minDistance, - InputArray mask, int blockSize, - int gradientSize, bool useHarrisDetector = false, - double k = 0.04 ); -/** @example samples/cpp/tutorial_code/ImgTrans/houghlines.cpp -An example using the Hough line detector -![Sample input image](Hough_Lines_Tutorial_Original_Image.jpg) ![Output image](Hough_Lines_Tutorial_Result.jpg) -*/ - -/** @brief Finds lines in a binary image using the standard Hough transform. - -The function implements the standard or standard multi-scale Hough transform algorithm for line -detection. See for a good explanation of Hough -transform. - -@param image 8-bit, single-channel binary source image. The image may be modified by the function. -@param lines Output vector of lines. Each line is represented by a 2 or 3 element vector -\f$(\rho, \theta)\f$ or \f$(\rho, \theta, \textrm{votes})\f$ . \f$\rho\f$ is the distance from the coordinate origin \f$(0,0)\f$ (top-left corner of -the image). \f$\theta\f$ is the line rotation angle in radians ( -\f$0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\f$ ). -\f$\textrm{votes}\f$ is the value of accumulator. -@param rho Distance resolution of the accumulator in pixels. -@param theta Angle resolution of the accumulator in radians. -@param threshold Accumulator threshold parameter. Only those lines are returned that get enough -votes ( \f$>\texttt{threshold}\f$ ). -@param srn For the multi-scale Hough transform, it is a divisor for the distance resolution rho . -The coarse accumulator distance resolution is rho and the accurate accumulator resolution is -rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these -parameters should be positive. -@param stn For the multi-scale Hough transform, it is a divisor for the distance resolution theta. -@param min_theta For standard and multi-scale Hough transform, minimum angle to check for lines. -Must fall between 0 and max_theta. -@param max_theta For standard and multi-scale Hough transform, maximum angle to check for lines. -Must fall between min_theta and CV_PI. - */ -CV_EXPORTS_W void HoughLines( InputArray image, OutputArray lines, - double rho, double theta, int threshold, - double srn = 0, double stn = 0, - double min_theta = 0, double max_theta = CV_PI ); - -/** @brief Finds line segments in a binary image using the probabilistic Hough transform. - -The function implements the probabilistic Hough transform algorithm for line detection, described -in @cite Matas00 - -See the line detection example below: -@include snippets/imgproc_HoughLinesP.cpp -This is a sample picture the function parameters have been tuned for: - -![image](pics/building.jpg) - -And this is the output of the above program in case of the probabilistic Hough transform: - -![image](pics/houghp.png) - -@param image 8-bit, single-channel binary source image. The image may be modified by the function. -@param lines Output vector of lines. Each line is represented by a 4-element vector -\f$(x_1, y_1, x_2, y_2)\f$ , where \f$(x_1,y_1)\f$ and \f$(x_2, y_2)\f$ are the ending points of each detected -line segment. -@param rho Distance resolution of the accumulator in pixels. -@param theta Angle resolution of the accumulator in radians. -@param threshold Accumulator threshold parameter. Only those lines are returned that get enough -votes ( \f$>\texttt{threshold}\f$ ). -@param minLineLength Minimum line length. Line segments shorter than that are rejected. -@param maxLineGap Maximum allowed gap between points on the same line to link them. - -@sa LineSegmentDetector - */ -CV_EXPORTS_W void HoughLinesP( InputArray image, OutputArray lines, - double rho, double theta, int threshold, - double minLineLength = 0, double maxLineGap = 0 ); - -/** @brief Finds lines in a set of points using the standard Hough transform. - -The function finds lines in a set of points using a modification of the Hough transform. -@include snippets/imgproc_HoughLinesPointSet.cpp -@param _point Input vector of points. Each vector must be encoded as a Point vector \f$(x,y)\f$. Type must be CV_32FC2 or CV_32SC2. -@param _lines Output vector of found lines. Each vector is encoded as a vector \f$(votes, rho, theta)\f$. -The larger the value of 'votes', the higher the reliability of the Hough line. -@param lines_max Max count of hough lines. -@param threshold Accumulator threshold parameter. Only those lines are returned that get enough -votes ( \f$>\texttt{threshold}\f$ ) -@param min_rho Minimum Distance value of the accumulator in pixels. -@param max_rho Maximum Distance value of the accumulator in pixels. -@param rho_step Distance resolution of the accumulator in pixels. -@param min_theta Minimum angle value of the accumulator in radians. -@param max_theta Maximum angle value of the accumulator in radians. -@param theta_step Angle resolution of the accumulator in radians. - */ -CV_EXPORTS_W void HoughLinesPointSet( InputArray _point, OutputArray _lines, int lines_max, int threshold, - double min_rho, double max_rho, double rho_step, - double min_theta, double max_theta, double theta_step ); - -/** @example samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp -An example using the Hough circle detector -*/ - -/** @brief Finds circles in a grayscale image using the Hough transform. - -The function finds circles in a grayscale image using a modification of the Hough transform. - -Example: : -@include snippets/imgproc_HoughLinesCircles.cpp - -@note Usually the function detects the centers of circles well. However, it may fail to find correct -radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if -you know it. Or, you may set maxRadius to a negative number to return centers only without radius -search, and find the correct radius using an additional procedure. - -@param image 8-bit, single-channel, grayscale input image. -@param circles Output vector of found circles. Each vector is encoded as 3 or 4 element -floating-point vector \f$(x, y, radius)\f$ or \f$(x, y, radius, votes)\f$ . -@param method Detection method, see #HoughModes. Currently, the only implemented method is #HOUGH_GRADIENT -@param dp Inverse ratio of the accumulator resolution to the image resolution. For example, if -dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has -half as big width and height. -@param minDist Minimum distance between the centers of the detected circles. If the parameter is -too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is -too large, some circles may be missed. -@param param1 First method-specific parameter. In case of #HOUGH_GRADIENT , it is the higher -threshold of the two passed to the Canny edge detector (the lower one is twice smaller). -@param param2 Second method-specific parameter. In case of #HOUGH_GRADIENT , it is the -accumulator threshold for the circle centers at the detection stage. The smaller it is, the more -false circles may be detected. Circles, corresponding to the larger accumulator values, will be -returned first. -@param minRadius Minimum circle radius. -@param maxRadius Maximum circle radius. If <= 0, uses the maximum image dimension. If < 0, returns -centers without finding the radius. - -@sa fitEllipse, minEnclosingCircle - */ -CV_EXPORTS_W void HoughCircles( InputArray image, OutputArray circles, - int method, double dp, double minDist, - double param1 = 100, double param2 = 100, - int minRadius = 0, int maxRadius = 0 ); - -//! @} imgproc_feature - -//! @addtogroup imgproc_filter -//! @{ - -/** @example samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp -Advanced morphology Transformations sample code -![Sample screenshot](Morphology_2_Tutorial_Result.jpg) -Check @ref tutorial_opening_closing_hats "the corresponding tutorial" for more details -*/ - -/** @brief Erodes an image by using a specific structuring element. - -The function erodes the source image using the specified structuring element that determines the -shape of a pixel neighborhood over which the minimum is taken: - -\f[\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] - -The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In -case of multi-channel images, each channel is processed independently. - -@param src input image; the number of channels can be arbitrary, but the depth should be one of -CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. -@param dst output image of the same size and type as src. -@param kernel structuring element used for erosion; if `element=Mat()`, a `3 x 3` rectangular -structuring element is used. Kernel can be created using #getStructuringElement. -@param anchor position of the anchor within the element; default value (-1, -1) means that the -anchor is at the element center. -@param iterations number of times erosion is applied. -@param borderType pixel extrapolation method, see #BorderTypes -@param borderValue border value in case of a constant border -@sa dilate, morphologyEx, getStructuringElement - */ -CV_EXPORTS_W void erode( InputArray src, OutputArray dst, InputArray kernel, - Point anchor = Point(-1,-1), int iterations = 1, - int borderType = BORDER_CONSTANT, - const Scalar& borderValue = morphologyDefaultBorderValue() ); - -/** @example samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp -Erosion and Dilation sample code -![Sample Screenshot-Erosion](Morphology_1_Tutorial_Erosion_Result.jpg)![Sample Screenshot-Dilation](Morphology_1_Tutorial_Dilation_Result.jpg) -Check @ref tutorial_erosion_dilatation "the corresponding tutorial" for more details -*/ - -/** @brief Dilates an image by using a specific structuring element. - -The function dilates the source image using the specified structuring element that determines the -shape of a pixel neighborhood over which the maximum is taken: -\f[\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] - -The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In -case of multi-channel images, each channel is processed independently. - -@param src input image; the number of channels can be arbitrary, but the depth should be one of -CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. -@param dst output image of the same size and type as src. -@param kernel structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular -structuring element is used. Kernel can be created using #getStructuringElement -@param anchor position of the anchor within the element; default value (-1, -1) means that the -anchor is at the element center. -@param iterations number of times dilation is applied. -@param borderType pixel extrapolation method, see #BorderTypes -@param borderValue border value in case of a constant border -@sa erode, morphologyEx, getStructuringElement - */ -CV_EXPORTS_W void dilate( InputArray src, OutputArray dst, InputArray kernel, - Point anchor = Point(-1,-1), int iterations = 1, - int borderType = BORDER_CONSTANT, - const Scalar& borderValue = morphologyDefaultBorderValue() ); - -/** @brief Performs advanced morphological transformations. - -The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as -basic operations. - -Any of the operations can be done in-place. In case of multi-channel images, each channel is -processed independently. - -@param src Source image. The number of channels can be arbitrary. The depth should be one of -CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. -@param dst Destination image of the same size and type as source image. -@param op Type of a morphological operation, see #MorphTypes -@param kernel Structuring element. It can be created using #getStructuringElement. -@param anchor Anchor position with the kernel. Negative values mean that the anchor is at the -kernel center. -@param iterations Number of times erosion and dilation are applied. -@param borderType Pixel extrapolation method, see #BorderTypes -@param borderValue Border value in case of a constant border. The default value has a special -meaning. -@sa dilate, erode, getStructuringElement -@note The number of iterations is the number of times erosion or dilatation operation will be applied. -For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply -successively: erode -> erode -> dilate -> dilate (and not erode -> dilate -> erode -> dilate). - */ -CV_EXPORTS_W void morphologyEx( InputArray src, OutputArray dst, - int op, InputArray kernel, - Point anchor = Point(-1,-1), int iterations = 1, - int borderType = BORDER_CONSTANT, - const Scalar& borderValue = morphologyDefaultBorderValue() ); - -//! @} imgproc_filter - -//! @addtogroup imgproc_transform -//! @{ - -/** @brief Resizes an image. - -The function resize resizes the image src down to or up to the specified size. Note that the -initial dst type or size are not taken into account. Instead, the size and type are derived from -the `src`,`dsize`,`fx`, and `fy`. If you want to resize src so that it fits the pre-created dst, -you may call the function as follows: -@code - // explicitly specify dsize=dst.size(); fx and fy will be computed from that. - resize(src, dst, dst.size(), 0, 0, interpolation); -@endcode -If you want to decimate the image by factor of 2 in each direction, you can call the function this -way: -@code - // specify fx and fy and let the function compute the destination image size. - resize(src, dst, Size(), 0.5, 0.5, interpolation); -@endcode -To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to -enlarge an image, it will generally look best with c#INTER_CUBIC (slow) or #INTER_LINEAR -(faster but still looks OK). - -@param src input image. -@param dst output image; it has the size dsize (when it is non-zero) or the size computed from -src.size(), fx, and fy; the type of dst is the same as of src. -@param dsize output image size; if it equals zero, it is computed as: - \f[\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\f] - Either dsize or both fx and fy must be non-zero. -@param fx scale factor along the horizontal axis; when it equals 0, it is computed as -\f[\texttt{(double)dsize.width/src.cols}\f] -@param fy scale factor along the vertical axis; when it equals 0, it is computed as -\f[\texttt{(double)dsize.height/src.rows}\f] -@param interpolation interpolation method, see #InterpolationFlags - -@sa warpAffine, warpPerspective, remap - */ -CV_EXPORTS_W void resize( InputArray src, OutputArray dst, - Size dsize, double fx = 0, double fy = 0, - int interpolation = INTER_LINEAR ); - -/** @brief Applies an affine transformation to an image. - -The function warpAffine transforms the source image using the specified matrix: - -\f[\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})\f] - -when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted -with #invertAffineTransform and then put in the formula above instead of M. The function cannot -operate in-place. - -@param src input image. -@param dst output image that has the size dsize and the same type as src . -@param M \f$2\times 3\f$ transformation matrix. -@param dsize size of the output image. -@param flags combination of interpolation methods (see #InterpolationFlags) and the optional -flag #WARP_INVERSE_MAP that means that M is the inverse transformation ( -\f$\texttt{dst}\rightarrow\texttt{src}\f$ ). -@param borderMode pixel extrapolation method (see #BorderTypes); when -borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to -the "outliers" in the source image are not modified by the function. -@param borderValue value used in case of a constant border; by default, it is 0. - -@sa warpPerspective, resize, remap, getRectSubPix, transform - */ -CV_EXPORTS_W void warpAffine( InputArray src, OutputArray dst, - InputArray M, Size dsize, - int flags = INTER_LINEAR, - int borderMode = BORDER_CONSTANT, - const Scalar& borderValue = Scalar()); - -/** @example samples/cpp/warpPerspective_demo.cpp -An example program shows using cv::findHomography and cv::warpPerspective for image warping -*/ - -/** @brief Applies a perspective transformation to an image. - -The function warpPerspective transforms the source image using the specified matrix: - -\f[\texttt{dst} (x,y) = \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} , - \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\f] - -when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert -and then put in the formula above instead of M. The function cannot operate in-place. - -@param src input image. -@param dst output image that has the size dsize and the same type as src . -@param M \f$3\times 3\f$ transformation matrix. -@param dsize size of the output image. -@param flags combination of interpolation methods (#INTER_LINEAR or #INTER_NEAREST) and the -optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation ( -\f$\texttt{dst}\rightarrow\texttt{src}\f$ ). -@param borderMode pixel extrapolation method (#BORDER_CONSTANT or #BORDER_REPLICATE). -@param borderValue value used in case of a constant border; by default, it equals 0. - -@sa warpAffine, resize, remap, getRectSubPix, perspectiveTransform - */ -CV_EXPORTS_W void warpPerspective( InputArray src, OutputArray dst, - InputArray M, Size dsize, - int flags = INTER_LINEAR, - int borderMode = BORDER_CONSTANT, - const Scalar& borderValue = Scalar()); - -/** @brief Applies a generic geometrical transformation to an image. - -The function remap transforms the source image using the specified map: - -\f[\texttt{dst} (x,y) = \texttt{src} (map_x(x,y),map_y(x,y))\f] - -where values of pixels with non-integer coordinates are computed using one of available -interpolation methods. \f$map_x\f$ and \f$map_y\f$ can be encoded as separate floating-point maps -in \f$map_1\f$ and \f$map_2\f$ respectively, or interleaved floating-point maps of \f$(x,y)\f$ in -\f$map_1\f$, or fixed-point maps created by using convertMaps. The reason you might want to -convert from floating to fixed-point representations of a map is that they can yield much faster -(\~2x) remapping operations. In the converted case, \f$map_1\f$ contains pairs (cvFloor(x), -cvFloor(y)) and \f$map_2\f$ contains indices in a table of interpolation coefficients. - -This function cannot operate in-place. - -@param src Source image. -@param dst Destination image. It has the same size as map1 and the same type as src . -@param map1 The first map of either (x,y) points or just x values having the type CV_16SC2 , -CV_32FC1, or CV_32FC2. See convertMaps for details on converting a floating point -representation to fixed-point for speed. -@param map2 The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map -if map1 is (x,y) points), respectively. -@param interpolation Interpolation method (see #InterpolationFlags). The method #INTER_AREA is -not supported by this function. -@param borderMode Pixel extrapolation method (see #BorderTypes). When -borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image that -corresponds to the "outliers" in the source image are not modified by the function. -@param borderValue Value used in case of a constant border. By default, it is 0. -@note -Due to current implementation limitations the size of an input and output images should be less than 32767x32767. - */ -CV_EXPORTS_W void remap( InputArray src, OutputArray dst, - InputArray map1, InputArray map2, - int interpolation, int borderMode = BORDER_CONSTANT, - const Scalar& borderValue = Scalar()); - -/** @brief Converts image transformation maps from one representation to another. - -The function converts a pair of maps for remap from one representation to another. The following -options ( (map1.type(), map2.type()) \f$\rightarrow\f$ (dstmap1.type(), dstmap2.type()) ) are -supported: - -- \f$\texttt{(CV_32FC1, CV_32FC1)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\f$. This is the -most frequently used conversion operation, in which the original floating-point maps (see remap ) -are converted to a more compact and much faster fixed-point representation. The first output array -contains the rounded coordinates and the second array (created only when nninterpolation=false ) -contains indices in the interpolation tables. - -- \f$\texttt{(CV_32FC2)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\f$. The same as above but -the original maps are stored in one 2-channel matrix. - -- Reverse conversion. Obviously, the reconstructed floating-point maps will not be exactly the same -as the originals. - -@param map1 The first input map of type CV_16SC2, CV_32FC1, or CV_32FC2 . -@param map2 The second input map of type CV_16UC1, CV_32FC1, or none (empty matrix), -respectively. -@param dstmap1 The first output map that has the type dstmap1type and the same size as src . -@param dstmap2 The second output map. -@param dstmap1type Type of the first output map that should be CV_16SC2, CV_32FC1, or -CV_32FC2 . -@param nninterpolation Flag indicating whether the fixed-point maps are used for the -nearest-neighbor or for a more complex interpolation. - -@sa remap, undistort, initUndistortRectifyMap - */ -CV_EXPORTS_W void convertMaps( InputArray map1, InputArray map2, - OutputArray dstmap1, OutputArray dstmap2, - int dstmap1type, bool nninterpolation = false ); - -/** @brief Calculates an affine matrix of 2D rotation. - -The function calculates the following matrix: - -\f[\begin{bmatrix} \alpha & \beta & (1- \alpha ) \cdot \texttt{center.x} - \beta \cdot \texttt{center.y} \\ - \beta & \alpha & \beta \cdot \texttt{center.x} + (1- \alpha ) \cdot \texttt{center.y} \end{bmatrix}\f] - -where - -\f[\begin{array}{l} \alpha = \texttt{scale} \cdot \cos \texttt{angle} , \\ \beta = \texttt{scale} \cdot \sin \texttt{angle} \end{array}\f] - -The transformation maps the rotation center to itself. If this is not the target, adjust the shift. - -@param center Center of the rotation in the source image. -@param angle Rotation angle in degrees. Positive values mean counter-clockwise rotation (the -coordinate origin is assumed to be the top-left corner). -@param scale Isotropic scale factor. - -@sa getAffineTransform, warpAffine, transform - */ -CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale ); - -//! returns 3x3 perspective transformation for the corresponding 4 point pairs. -CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] ); - -/** @brief Calculates an affine transform from three pairs of the corresponding points. - -The function calculates the \f$2 \times 3\f$ matrix of an affine transform so that: - -\f[\begin{bmatrix} x'_i \\ y'_i \end{bmatrix} = \texttt{map_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f] - -where - -\f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2\f] - -@param src Coordinates of triangle vertices in the source image. -@param dst Coordinates of the corresponding triangle vertices in the destination image. - -@sa warpAffine, transform - */ -CV_EXPORTS Mat getAffineTransform( const Point2f src[], const Point2f dst[] ); - -/** @brief Inverts an affine transformation. - -The function computes an inverse affine transformation represented by \f$2 \times 3\f$ matrix M: - -\f[\begin{bmatrix} a_{11} & a_{12} & b_1 \\ a_{21} & a_{22} & b_2 \end{bmatrix}\f] - -The result is also a \f$2 \times 3\f$ matrix of the same type as M. - -@param M Original affine transformation. -@param iM Output reverse affine transformation. - */ -CV_EXPORTS_W void invertAffineTransform( InputArray M, OutputArray iM ); - -/** @brief Calculates a perspective transform from four pairs of the corresponding points. - -The function calculates the \f$3 \times 3\f$ matrix of a perspective transform so that: - -\f[\begin{bmatrix} t_i x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f] - -where - -\f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\f] - -@param src Coordinates of quadrangle vertices in the source image. -@param dst Coordinates of the corresponding quadrangle vertices in the destination image. - -@sa findHomography, warpPerspective, perspectiveTransform - */ -CV_EXPORTS_W Mat getPerspectiveTransform( InputArray src, InputArray dst ); - -CV_EXPORTS_W Mat getAffineTransform( InputArray src, InputArray dst ); - -/** @brief Retrieves a pixel rectangle from an image with sub-pixel accuracy. - -The function getRectSubPix extracts pixels from src: - -\f[patch(x, y) = src(x + \texttt{center.x} - ( \texttt{dst.cols} -1)*0.5, y + \texttt{center.y} - ( \texttt{dst.rows} -1)*0.5)\f] - -where the values of the pixels at non-integer coordinates are retrieved using bilinear -interpolation. Every channel of multi-channel images is processed independently. Also -the image should be a single channel or three channel image. While the center of the -rectangle must be inside the image, parts of the rectangle may be outside. - -@param image Source image. -@param patchSize Size of the extracted patch. -@param center Floating point coordinates of the center of the extracted rectangle within the -source image. The center must be inside the image. -@param patch Extracted patch that has the size patchSize and the same number of channels as src . -@param patchType Depth of the extracted pixels. By default, they have the same depth as src . - -@sa warpAffine, warpPerspective - */ -CV_EXPORTS_W void getRectSubPix( InputArray image, Size patchSize, - Point2f center, OutputArray patch, int patchType = -1 ); - -/** @example samples/cpp/polar_transforms.cpp -An example using the cv::linearPolar and cv::logPolar operations -*/ - -/** @brief Remaps an image to semilog-polar coordinates space. - -@deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags+WARP_POLAR_LOG); - -@internal -Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image d)"): -\f[\begin{array}{l} - dst( \rho , \phi ) = src(x,y) \\ - dst.size() \leftarrow src.size() -\end{array}\f] - -where -\f[\begin{array}{l} - I = (dx,dy) = (x - center.x,y - center.y) \\ - \rho = M \cdot log_e(\texttt{magnitude} (I)) ,\\ - \phi = Kangle \cdot \texttt{angle} (I) \\ -\end{array}\f] - -and -\f[\begin{array}{l} - M = src.cols / log_e(maxRadius) \\ - Kangle = src.rows / 2\Pi \\ -\end{array}\f] - -The function emulates the human "foveal" vision and can be used for fast scale and -rotation-invariant template matching, for object tracking and so forth. -@param src Source image -@param dst Destination image. It will have same size and type as src. -@param center The transformation center; where the output precision is maximal -@param M Magnitude scale parameter. It determines the radius of the bounding circle to transform too. -@param flags A combination of interpolation methods, see #InterpolationFlags - -@note -- The function can not operate in-place. -- To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. - -@sa cv::linearPolar -@endinternal -*/ -CV_EXPORTS_W void logPolar( InputArray src, OutputArray dst, - Point2f center, double M, int flags ); - -/** @brief Remaps an image to polar coordinates space. - -@deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags) - -@internal -Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image c)"): -\f[\begin{array}{l} - dst( \rho , \phi ) = src(x,y) \\ - dst.size() \leftarrow src.size() -\end{array}\f] - -where -\f[\begin{array}{l} - I = (dx,dy) = (x - center.x,y - center.y) \\ - \rho = Kmag \cdot \texttt{magnitude} (I) ,\\ - \phi = angle \cdot \texttt{angle} (I) -\end{array}\f] - -and -\f[\begin{array}{l} - Kx = src.cols / maxRadius \\ - Ky = src.rows / 2\Pi -\end{array}\f] - - -@param src Source image -@param dst Destination image. It will have same size and type as src. -@param center The transformation center; -@param maxRadius The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too. -@param flags A combination of interpolation methods, see #InterpolationFlags - -@note -- The function can not operate in-place. -- To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. - -@sa cv::logPolar -@endinternal -*/ -CV_EXPORTS_W void linearPolar( InputArray src, OutputArray dst, - Point2f center, double maxRadius, int flags ); - - -/** \brief Remaps an image to polar or semilog-polar coordinates space - -@anchor polar_remaps_reference_image -![Polar remaps reference](pics/polar_remap_doc.png) - -Transform the source image using the following transformation: -\f[ -dst(\rho , \phi ) = src(x,y) -\f] - -where -\f[ -\begin{array}{l} -\vec{I} = (x - center.x, \;y - center.y) \\ -\phi = Kangle \cdot \texttt{angle} (\vec{I}) \\ -\rho = \left\{\begin{matrix} -Klin \cdot \texttt{magnitude} (\vec{I}) & default \\ -Klog \cdot log_e(\texttt{magnitude} (\vec{I})) & if \; semilog \\ -\end{matrix}\right. -\end{array} -\f] - -and -\f[ -\begin{array}{l} -Kangle = dsize.height / 2\Pi \\ -Klin = dsize.width / maxRadius \\ -Klog = dsize.width / log_e(maxRadius) \\ -\end{array} -\f] - - -\par Linear vs semilog mapping - -Polar mapping can be linear or semi-log. Add one of #WarpPolarMode to `flags` to specify the polar mapping mode. - -Linear is the default mode. - -The semilog mapping emulates the human "foveal" vision that permit very high acuity on the line of sight (central vision) -in contrast to peripheral vision where acuity is minor. - -\par Option on `dsize`: - -- if both values in `dsize <=0 ` (default), -the destination image will have (almost) same area of source bounding circle: -\f[\begin{array}{l} -dsize.area \leftarrow (maxRadius^2 \cdot \Pi) \\ -dsize.width = \texttt{cvRound}(maxRadius) \\ -dsize.height = \texttt{cvRound}(maxRadius \cdot \Pi) \\ -\end{array}\f] - - -- if only `dsize.height <= 0`, -the destination image area will be proportional to the bounding circle area but scaled by `Kx * Kx`: -\f[\begin{array}{l} -dsize.height = \texttt{cvRound}(dsize.width \cdot \Pi) \\ -\end{array} -\f] - -- if both values in `dsize > 0 `, -the destination image will have the given size therefore the area of the bounding circle will be scaled to `dsize`. - - -\par Reverse mapping - -You can get reverse mapping adding #WARP_INVERSE_MAP to `flags` -\snippet polar_transforms.cpp InverseMap - -In addiction, to calculate the original coordinate from a polar mapped coordinate \f$(rho, phi)->(x, y)\f$: -\snippet polar_transforms.cpp InverseCoordinate - -@param src Source image. -@param dst Destination image. It will have same type as src. -@param dsize The destination image size (see description for valid options). -@param center The transformation center. -@param maxRadius The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too. -@param flags A combination of interpolation methods, #InterpolationFlags + #WarpPolarMode. - - Add #WARP_POLAR_LINEAR to select linear polar mapping (default) - - Add #WARP_POLAR_LOG to select semilog polar mapping - - Add #WARP_INVERSE_MAP for reverse mapping. -@note -- The function can not operate in-place. -- To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. -- This function uses #remap. Due to current implementation limitations the size of an input and output images should be less than 32767x32767. - -@sa cv::remap -*/ -CV_EXPORTS_W void warpPolar(InputArray src, OutputArray dst, Size dsize, - Point2f center, double maxRadius, int flags); - - -//! @} imgproc_transform - -//! @addtogroup imgproc_misc -//! @{ - -/** @overload */ -CV_EXPORTS_W void integral( InputArray src, OutputArray sum, int sdepth = -1 ); - -/** @overload */ -CV_EXPORTS_AS(integral2) void integral( InputArray src, OutputArray sum, - OutputArray sqsum, int sdepth = -1, int sqdepth = -1 ); - -/** @brief Calculates the integral of an image. - -The function calculates one or more integral images for the source image as follows: - -\f[\texttt{sum} (X,Y) = \sum _{x - -Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed -with getOptimalDFTSize. - -The function performs the following equations: -- First it applies a Hanning window (see ) to each -image to remove possible edge effects. This window is cached until the array size changes to speed -up processing time. -- Next it computes the forward DFTs of each source array: -\f[\mathbf{G}_a = \mathcal{F}\{src_1\}, \; \mathbf{G}_b = \mathcal{F}\{src_2\}\f] -where \f$\mathcal{F}\f$ is the forward DFT. -- It then computes the cross-power spectrum of each frequency domain array: -\f[R = \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^*|}\f] -- Next the cross-correlation is converted back into the time domain via the inverse DFT: -\f[r = \mathcal{F}^{-1}\{R\}\f] -- Finally, it computes the peak location and computes a 5x5 weighted centroid around the peak to -achieve sub-pixel accuracy. -\f[(\Delta x, \Delta y) = \texttt{weightedCentroid} \{\arg \max_{(x, y)}\{r\}\}\f] -- If non-zero, the response parameter is computed as the sum of the elements of r within the 5x5 -centroid around the peak location. It is normalized to a maximum of 1 (meaning there is a single -peak) and will be smaller when there are multiple peaks. - -@param src1 Source floating point array (CV_32FC1 or CV_64FC1) -@param src2 Source floating point array (CV_32FC1 or CV_64FC1) -@param window Floating point array with windowing coefficients to reduce edge effects (optional). -@param response Signal power within the 5x5 centroid around the peak, between 0 and 1 (optional). -@returns detected phase shift (sub-pixel) between the two arrays. - -@sa dft, getOptimalDFTSize, idft, mulSpectrums createHanningWindow - */ -CV_EXPORTS_W Point2d phaseCorrelate(InputArray src1, InputArray src2, - InputArray window = noArray(), CV_OUT double* response = 0); - -/** @brief This function computes a Hanning window coefficients in two dimensions. - -See (http://en.wikipedia.org/wiki/Hann_function) and (http://en.wikipedia.org/wiki/Window_function) -for more information. - -An example is shown below: -@code - // create hanning window of size 100x100 and type CV_32F - Mat hann; - createHanningWindow(hann, Size(100, 100), CV_32F); -@endcode -@param dst Destination array to place Hann coefficients in -@param winSize The window size specifications (both width and height must be > 1) -@param type Created array type - */ -CV_EXPORTS_W void createHanningWindow(OutputArray dst, Size winSize, int type); - -//! @} imgproc_motion - -//! @addtogroup imgproc_misc -//! @{ - -/** @brief Applies a fixed-level threshold to each array element. - -The function applies fixed-level thresholding to a multiple-channel array. The function is typically -used to get a bi-level (binary) image out of a grayscale image ( #compare could be also used for -this purpose) or for removing a noise, that is, filtering out pixels with too small or too large -values. There are several types of thresholding supported by the function. They are determined by -type parameter. - -Also, the special values #THRESH_OTSU or #THRESH_TRIANGLE may be combined with one of the -above values. In these cases, the function determines the optimal threshold value using the Otsu's -or Triangle algorithm and uses it instead of the specified thresh. - -@note Currently, the Otsu's and Triangle methods are implemented only for 8-bit single-channel images. - -@param src input array (multiple-channel, 8-bit or 32-bit floating point). -@param dst output array of the same size and type and the same number of channels as src. -@param thresh threshold value. -@param maxval maximum value to use with the #THRESH_BINARY and #THRESH_BINARY_INV thresholding -types. -@param type thresholding type (see #ThresholdTypes). -@return the computed threshold value if Otsu's or Triangle methods used. - -@sa adaptiveThreshold, findContours, compare, min, max - */ -CV_EXPORTS_W double threshold( InputArray src, OutputArray dst, - double thresh, double maxval, int type ); - - -/** @brief Applies an adaptive threshold to an array. - -The function transforms a grayscale image to a binary image according to the formulae: -- **THRESH_BINARY** - \f[dst(x,y) = \fork{\texttt{maxValue}}{if \(src(x,y) > T(x,y)\)}{0}{otherwise}\f] -- **THRESH_BINARY_INV** - \f[dst(x,y) = \fork{0}{if \(src(x,y) > T(x,y)\)}{\texttt{maxValue}}{otherwise}\f] -where \f$T(x,y)\f$ is a threshold calculated individually for each pixel (see adaptiveMethod parameter). - -The function can process the image in-place. - -@param src Source 8-bit single-channel image. -@param dst Destination image of the same size and the same type as src. -@param maxValue Non-zero value assigned to the pixels for which the condition is satisfied -@param adaptiveMethod Adaptive thresholding algorithm to use, see #AdaptiveThresholdTypes. -The #BORDER_REPLICATE | #BORDER_ISOLATED is used to process boundaries. -@param thresholdType Thresholding type that must be either #THRESH_BINARY or #THRESH_BINARY_INV, -see #ThresholdTypes. -@param blockSize Size of a pixel neighborhood that is used to calculate a threshold value for the -pixel: 3, 5, 7, and so on. -@param C Constant subtracted from the mean or weighted mean (see the details below). Normally, it -is positive but may be zero or negative as well. - -@sa threshold, blur, GaussianBlur - */ -CV_EXPORTS_W void adaptiveThreshold( InputArray src, OutputArray dst, - double maxValue, int adaptiveMethod, - int thresholdType, int blockSize, double C ); - -//! @} imgproc_misc - -//! @addtogroup imgproc_filter -//! @{ - -/** @example samples/cpp/tutorial_code/ImgProc/Pyramids/Pyramids.cpp -An example using pyrDown and pyrUp functions -*/ - -/** @brief Blurs an image and downsamples it. - -By default, size of the output image is computed as `Size((src.cols+1)/2, (src.rows+1)/2)`, but in -any case, the following conditions should be satisfied: - -\f[\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\f] - -The function performs the downsampling step of the Gaussian pyramid construction. First, it -convolves the source image with the kernel: - -\f[\frac{1}{256} \begin{bmatrix} 1 & 4 & 6 & 4 & 1 \\ 4 & 16 & 24 & 16 & 4 \\ 6 & 24 & 36 & 24 & 6 \\ 4 & 16 & 24 & 16 & 4 \\ 1 & 4 & 6 & 4 & 1 \end{bmatrix}\f] - -Then, it downsamples the image by rejecting even rows and columns. - -@param src input image. -@param dst output image; it has the specified size and the same type as src. -@param dstsize size of the output image. -@param borderType Pixel extrapolation method, see #BorderTypes (#BORDER_CONSTANT isn't supported) - */ -CV_EXPORTS_W void pyrDown( InputArray src, OutputArray dst, - const Size& dstsize = Size(), int borderType = BORDER_DEFAULT ); - -/** @brief Upsamples an image and then blurs it. - -By default, size of the output image is computed as `Size(src.cols\*2, (src.rows\*2)`, but in any -case, the following conditions should be satisfied: - -\f[\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\f] - -The function performs the upsampling step of the Gaussian pyramid construction, though it can -actually be used to construct the Laplacian pyramid. First, it upsamples the source image by -injecting even zero rows and columns and then convolves the result with the same kernel as in -pyrDown multiplied by 4. - -@param src input image. -@param dst output image. It has the specified size and the same type as src . -@param dstsize size of the output image. -@param borderType Pixel extrapolation method, see #BorderTypes (only #BORDER_DEFAULT is supported) - */ -CV_EXPORTS_W void pyrUp( InputArray src, OutputArray dst, - const Size& dstsize = Size(), int borderType = BORDER_DEFAULT ); - -/** @brief Constructs the Gaussian pyramid for an image. - -The function constructs a vector of images and builds the Gaussian pyramid by recursively applying -pyrDown to the previously built pyramid layers, starting from `dst[0]==src`. - -@param src Source image. Check pyrDown for the list of supported types. -@param dst Destination vector of maxlevel+1 images of the same type as src. dst[0] will be the -same as src. dst[1] is the next pyramid layer, a smoothed and down-sized src, and so on. -@param maxlevel 0-based index of the last (the smallest) pyramid layer. It must be non-negative. -@param borderType Pixel extrapolation method, see #BorderTypes (#BORDER_CONSTANT isn't supported) - */ -CV_EXPORTS void buildPyramid( InputArray src, OutputArrayOfArrays dst, - int maxlevel, int borderType = BORDER_DEFAULT ); - -//! @} imgproc_filter - -//! @addtogroup imgproc_transform -//! @{ - -/** @brief Transforms an image to compensate for lens distortion. - -The function transforms an image to compensate radial and tangential lens distortion. - -The function is simply a combination of #initUndistortRectifyMap (with unity R ) and #remap -(with bilinear interpolation). See the former function for details of the transformation being -performed. - -Those pixels in the destination image, for which there is no correspondent pixels in the source -image, are filled with zeros (black color). - -A particular subset of the source image that will be visible in the corrected image can be regulated -by newCameraMatrix. You can use #getOptimalNewCameraMatrix to compute the appropriate -newCameraMatrix depending on your requirements. - -The camera matrix and the distortion parameters can be determined using #calibrateCamera. If -the resolution of images is different from the resolution used at the calibration stage, \f$f_x, -f_y, c_x\f$ and \f$c_y\f$ need to be scaled accordingly, while the distortion coefficients remain -the same. - -@param src Input (distorted) image. -@param dst Output (corrected) image that has the same size and type as src . -@param cameraMatrix Input camera matrix \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . -@param distCoeffs Input vector of distortion coefficients -\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ -of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed. -@param newCameraMatrix Camera matrix of the distorted image. By default, it is the same as -cameraMatrix but you may additionally scale and shift the result by using a different matrix. - */ -CV_EXPORTS_W void undistort( InputArray src, OutputArray dst, - InputArray cameraMatrix, - InputArray distCoeffs, - InputArray newCameraMatrix = noArray() ); - -/** @brief Computes the undistortion and rectification transformation map. - -The function computes the joint undistortion and rectification transformation and represents the -result in the form of maps for remap. The undistorted image looks like original, as if it is -captured with a camera using the camera matrix =newCameraMatrix and zero distortion. In case of a -monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by -#getOptimalNewCameraMatrix for a better control over scaling. In case of a stereo camera, -newCameraMatrix is normally set to P1 or P2 computed by #stereoRectify . - -Also, this new camera is oriented differently in the coordinate space, according to R. That, for -example, helps to align two heads of a stereo camera so that the epipolar lines on both images -become horizontal and have the same y- coordinate (in case of a horizontally aligned stereo camera). - -The function actually builds the maps for the inverse mapping algorithm that is used by remap. That -is, for each pixel \f$(u, v)\f$ in the destination (corrected and rectified) image, the function -computes the corresponding coordinates in the source image (that is, in the original image from -camera). The following process is applied: -\f[ -\begin{array}{l} -x \leftarrow (u - {c'}_x)/{f'}_x \\ -y \leftarrow (v - {c'}_y)/{f'}_y \\ -{[X\,Y\,W]} ^T \leftarrow R^{-1}*[x \, y \, 1]^T \\ -x' \leftarrow X/W \\ -y' \leftarrow Y/W \\ -r^2 \leftarrow x'^2 + y'^2 \\ -x'' \leftarrow x' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} -+ 2p_1 x' y' + p_2(r^2 + 2 x'^2) + s_1 r^2 + s_2 r^4\\ -y'' \leftarrow y' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} -+ p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' + s_3 r^2 + s_4 r^4 \\ -s\vecthree{x'''}{y'''}{1} = -\vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}((\tau_x, \tau_y)} -{0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)} -{0}{0}{1} R(\tau_x, \tau_y) \vecthree{x''}{y''}{1}\\ -map_x(u,v) \leftarrow x''' f_x + c_x \\ -map_y(u,v) \leftarrow y''' f_y + c_y -\end{array} -\f] -where \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ -are the distortion coefficients. - -In case of a stereo camera, this function is called twice: once for each camera head, after -stereoRectify, which in its turn is called after #stereoCalibrate. But if the stereo camera -was not calibrated, it is still possible to compute the rectification transformations directly from -the fundamental matrix using #stereoRectifyUncalibrated. For each camera, the function computes -homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D -space. R can be computed from H as -\f[\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}\f] -where cameraMatrix can be chosen arbitrarily. - -@param cameraMatrix Input camera matrix \f$A=\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . -@param distCoeffs Input vector of distortion coefficients -\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ -of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed. -@param R Optional rectification transformation in the object space (3x3 matrix). R1 or R2 , -computed by #stereoRectify can be passed here. If the matrix is empty, the identity transformation -is assumed. In cvInitUndistortMap R assumed to be an identity matrix. -@param newCameraMatrix New camera matrix \f$A'=\vecthreethree{f_x'}{0}{c_x'}{0}{f_y'}{c_y'}{0}{0}{1}\f$. -@param size Undistorted image size. -@param m1type Type of the first output map that can be CV_32FC1, CV_32FC2 or CV_16SC2, see #convertMaps -@param map1 The first output map. -@param map2 The second output map. - */ -CV_EXPORTS_W void initUndistortRectifyMap( InputArray cameraMatrix, InputArray distCoeffs, - InputArray R, InputArray newCameraMatrix, - Size size, int m1type, OutputArray map1, OutputArray map2 ); - -//! initializes maps for #remap for wide-angle -CV_EXPORTS_W float initWideAngleProjMap( InputArray cameraMatrix, InputArray distCoeffs, - Size imageSize, int destImageWidth, - int m1type, OutputArray map1, OutputArray map2, - int projType = PROJ_SPHERICAL_EQRECT, double alpha = 0); - -/** @brief Returns the default new camera matrix. - -The function returns the camera matrix that is either an exact copy of the input cameraMatrix (when -centerPrinicipalPoint=false ), or the modified one (when centerPrincipalPoint=true). - -In the latter case, the new camera matrix will be: - -\f[\begin{bmatrix} f_x && 0 && ( \texttt{imgSize.width} -1)*0.5 \\ 0 && f_y && ( \texttt{imgSize.height} -1)*0.5 \\ 0 && 0 && 1 \end{bmatrix} ,\f] - -where \f$f_x\f$ and \f$f_y\f$ are \f$(0,0)\f$ and \f$(1,1)\f$ elements of cameraMatrix, respectively. - -By default, the undistortion functions in OpenCV (see #initUndistortRectifyMap, #undistort) do not -move the principal point. However, when you work with stereo, it is important to move the principal -points in both views to the same y-coordinate (which is required by most of stereo correspondence -algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for -each view where the principal points are located at the center. - -@param cameraMatrix Input camera matrix. -@param imgsize Camera view image size in pixels. -@param centerPrincipalPoint Location of the principal point in the new camera matrix. The -parameter indicates whether this location should be at the image center or not. - */ -CV_EXPORTS_W Mat getDefaultNewCameraMatrix( InputArray cameraMatrix, Size imgsize = Size(), - bool centerPrincipalPoint = false ); - -/** @brief Computes the ideal point coordinates from the observed point coordinates. - -The function is similar to #undistort and #initUndistortRectifyMap but it operates on a -sparse set of points instead of a raster image. Also the function performs a reverse transformation -to projectPoints. In case of a 3D object, it does not reconstruct its 3D coordinates, but for a -planar object, it does, up to a translation vector, if the proper R is specified. - -For each observed point coordinate \f$(u, v)\f$ the function computes: -\f[ -\begin{array}{l} -x^{"} \leftarrow (u - c_x)/f_x \\ -y^{"} \leftarrow (v - c_y)/f_y \\ -(x',y') = undistort(x^{"},y^{"}, \texttt{distCoeffs}) \\ -{[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\ -x \leftarrow X/W \\ -y \leftarrow Y/W \\ -\text{only performed if P is specified:} \\ -u' \leftarrow x {f'}_x + {c'}_x \\ -v' \leftarrow y {f'}_y + {c'}_y -\end{array} -\f] - -where *undistort* is an approximate iterative algorithm that estimates the normalized original -point coordinates out of the normalized distorted point coordinates ("normalized" means that the -coordinates do not depend on the camera matrix). - -The function can be used for both a stereo camera head or a monocular camera (when R is empty). - -@param src Observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2). -@param dst Output ideal point coordinates after undistortion and reverse perspective -transformation. If matrix P is identity or omitted, dst will contain normalized point coordinates. -@param cameraMatrix Camera matrix \f$\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . -@param distCoeffs Input vector of distortion coefficients -\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ -of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed. -@param R Rectification transformation in the object space (3x3 matrix). R1 or R2 computed by -#stereoRectify can be passed here. If the matrix is empty, the identity transformation is used. -@param P New camera matrix (3x3) or new projection matrix (3x4) \f$\begin{bmatrix} {f'}_x & 0 & {c'}_x & t_x \\ 0 & {f'}_y & {c'}_y & t_y \\ 0 & 0 & 1 & t_z \end{bmatrix}\f$. P1 or P2 computed by -#stereoRectify can be passed here. If the matrix is empty, the identity new camera matrix is used. - */ -CV_EXPORTS_W void undistortPoints( InputArray src, OutputArray dst, - InputArray cameraMatrix, InputArray distCoeffs, - InputArray R = noArray(), InputArray P = noArray()); -/** @overload - @note Default version of #undistortPoints does 5 iterations to compute undistorted points. - - */ -CV_EXPORTS_AS(undistortPointsIter) void undistortPoints( InputArray src, OutputArray dst, - InputArray cameraMatrix, InputArray distCoeffs, - InputArray R, InputArray P, TermCriteria criteria); - -//! @} imgproc_transform - -//! @addtogroup imgproc_hist -//! @{ - -/** @example samples/cpp/demhist.cpp -An example for creating histograms of an image -*/ - -/** @brief Calculates a histogram of a set of arrays. - -The function cv::calcHist calculates the histogram of one or more arrays. The elements of a tuple used -to increment a histogram bin are taken from the corresponding input arrays at the same location. The -sample below shows how to compute a 2D Hue-Saturation histogram for a color image. : -@include snippets/imgproc_calcHist.cpp - -@param images Source arrays. They all should have the same depth, CV_8U, CV_16U or CV_32F , and the same -size. Each of them can have an arbitrary number of channels. -@param nimages Number of source images. -@param channels List of the dims channels used to compute the histogram. The first array channels -are numerated from 0 to images[0].channels()-1 , the second array channels are counted from -images[0].channels() to images[0].channels() + images[1].channels()-1, and so on. -@param mask Optional mask. If the matrix is not empty, it must be an 8-bit array of the same size -as images[i] . The non-zero mask elements mark the array elements counted in the histogram. -@param hist Output histogram, which is a dense or sparse dims -dimensional array. -@param dims Histogram dimensionality that must be positive and not greater than CV_MAX_DIMS -(equal to 32 in the current OpenCV version). -@param histSize Array of histogram sizes in each dimension. -@param ranges Array of the dims arrays of the histogram bin boundaries in each dimension. When the -histogram is uniform ( uniform =true), then for each dimension i it is enough to specify the lower -(inclusive) boundary \f$L_0\f$ of the 0-th histogram bin and the upper (exclusive) boundary -\f$U_{\texttt{histSize}[i]-1}\f$ for the last histogram bin histSize[i]-1 . That is, in case of a -uniform histogram each of ranges[i] is an array of 2 elements. When the histogram is not uniform ( -uniform=false ), then each of ranges[i] contains histSize[i]+1 elements: -\f$L_0, U_0=L_1, U_1=L_2, ..., U_{\texttt{histSize[i]}-2}=L_{\texttt{histSize[i]}-1}, U_{\texttt{histSize[i]}-1}\f$ -. The array elements, that are not between \f$L_0\f$ and \f$U_{\texttt{histSize[i]}-1}\f$ , are not -counted in the histogram. -@param uniform Flag indicating whether the histogram is uniform or not (see above). -@param accumulate Accumulation flag. If it is set, the histogram is not cleared in the beginning -when it is allocated. This feature enables you to compute a single histogram from several sets of -arrays, or to update the histogram in time. -*/ -CV_EXPORTS void calcHist( const Mat* images, int nimages, - const int* channels, InputArray mask, - OutputArray hist, int dims, const int* histSize, - const float** ranges, bool uniform = true, bool accumulate = false ); - -/** @overload - -this variant uses %SparseMat for output -*/ -CV_EXPORTS void calcHist( const Mat* images, int nimages, - const int* channels, InputArray mask, - SparseMat& hist, int dims, - const int* histSize, const float** ranges, - bool uniform = true, bool accumulate = false ); - -/** @overload */ -CV_EXPORTS_W void calcHist( InputArrayOfArrays images, - const std::vector& channels, - InputArray mask, OutputArray hist, - const std::vector& histSize, - const std::vector& ranges, - bool accumulate = false ); - -/** @brief Calculates the back projection of a histogram. - -The function cv::calcBackProject calculates the back project of the histogram. That is, similarly to -#calcHist , at each location (x, y) the function collects the values from the selected channels -in the input images and finds the corresponding histogram bin. But instead of incrementing it, the -function reads the bin value, scales it by scale , and stores in backProject(x,y) . In terms of -statistics, the function computes probability of each element value in respect with the empirical -probability distribution represented by the histogram. See how, for example, you can find and track -a bright-colored object in a scene: - -- Before tracking, show the object to the camera so that it covers almost the whole frame. -Calculate a hue histogram. The histogram may have strong maximums, corresponding to the dominant -colors in the object. - -- When tracking, calculate a back projection of a hue plane of each input video frame using that -pre-computed histogram. Threshold the back projection to suppress weak colors. It may also make -sense to suppress pixels with non-sufficient color saturation and too dark or too bright pixels. - -- Find connected components in the resulting picture and choose, for example, the largest -component. - -This is an approximate algorithm of the CamShift color object tracker. - -@param images Source arrays. They all should have the same depth, CV_8U, CV_16U or CV_32F , and the same -size. Each of them can have an arbitrary number of channels. -@param nimages Number of source images. -@param channels The list of channels used to compute the back projection. The number of channels -must match the histogram dimensionality. The first array channels are numerated from 0 to -images[0].channels()-1 , the second array channels are counted from images[0].channels() to -images[0].channels() + images[1].channels()-1, and so on. -@param hist Input histogram that can be dense or sparse. -@param backProject Destination back projection array that is a single-channel array of the same -size and depth as images[0] . -@param ranges Array of arrays of the histogram bin boundaries in each dimension. See #calcHist . -@param scale Optional scale factor for the output back projection. -@param uniform Flag indicating whether the histogram is uniform or not (see above). - -@sa calcHist, compareHist - */ -CV_EXPORTS void calcBackProject( const Mat* images, int nimages, - const int* channels, InputArray hist, - OutputArray backProject, const float** ranges, - double scale = 1, bool uniform = true ); - -/** @overload */ -CV_EXPORTS void calcBackProject( const Mat* images, int nimages, - const int* channels, const SparseMat& hist, - OutputArray backProject, const float** ranges, - double scale = 1, bool uniform = true ); - -/** @overload */ -CV_EXPORTS_W void calcBackProject( InputArrayOfArrays images, const std::vector& channels, - InputArray hist, OutputArray dst, - const std::vector& ranges, - double scale ); - -/** @brief Compares two histograms. - -The function cv::compareHist compares two dense or two sparse histograms using the specified method. - -The function returns \f$d(H_1, H_2)\f$ . - -While the function works well with 1-, 2-, 3-dimensional dense histograms, it may not be suitable -for high-dimensional sparse histograms. In such histograms, because of aliasing and sampling -problems, the coordinates of non-zero histogram bins can slightly shift. To compare such histograms -or more general sparse configurations of weighted points, consider using the #EMD function. - -@param H1 First compared histogram. -@param H2 Second compared histogram of the same size as H1 . -@param method Comparison method, see #HistCompMethods - */ -CV_EXPORTS_W double compareHist( InputArray H1, InputArray H2, int method ); - -/** @overload */ -CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int method ); - -/** @brief Equalizes the histogram of a grayscale image. - -The function equalizes the histogram of the input image using the following algorithm: - -- Calculate the histogram \f$H\f$ for src . -- Normalize the histogram so that the sum of histogram bins is 255. -- Compute the integral of the histogram: -\f[H'_i = \sum _{0 \le j < i} H(j)\f] -- Transform the image using \f$H'\f$ as a look-up table: \f$\texttt{dst}(x,y) = H'(\texttt{src}(x,y))\f$ - -The algorithm normalizes the brightness and increases the contrast of the image. - -@param src Source 8-bit single channel image. -@param dst Destination image of the same size and type as src . - */ -CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst ); - -/** @brief Creates a smart pointer to a cv::CLAHE class and initializes it. - -@param clipLimit Threshold for contrast limiting. -@param tileGridSize Size of grid for histogram equalization. Input image will be divided into -equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column. - */ -CV_EXPORTS_W Ptr createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8)); - -/** @brief Computes the "minimal work" distance between two weighted point configurations. - -The function computes the earth mover distance and/or a lower boundary of the distance between the -two weighted point configurations. One of the applications described in @cite RubnerSept98, -@cite Rubner2000 is multi-dimensional histogram comparison for image retrieval. EMD is a transportation -problem that is solved using some modification of a simplex algorithm, thus the complexity is -exponential in the worst case, though, on average it is much faster. In the case of a real metric -the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used -to determine roughly whether the two signatures are far enough so that they cannot relate to the -same object. - -@param signature1 First signature, a \f$\texttt{size1}\times \texttt{dims}+1\f$ floating-point matrix. -Each row stores the point weight followed by the point coordinates. The matrix is allowed to have -a single column (weights only) if the user-defined cost matrix is used. The weights must be -non-negative and have at least one non-zero value. -@param signature2 Second signature of the same format as signature1 , though the number of rows -may be different. The total weights may be different. In this case an extra "dummy" point is added -to either signature1 or signature2. The weights must be non-negative and have at least one non-zero -value. -@param distType Used metric. See #DistanceTypes. -@param cost User-defined \f$\texttt{size1}\times \texttt{size2}\f$ cost matrix. Also, if a cost matrix -is used, lower boundary lowerBound cannot be calculated because it needs a metric function. -@param lowerBound Optional input/output parameter: lower boundary of a distance between the two -signatures that is a distance between mass centers. The lower boundary may not be calculated if -the user-defined cost matrix is used, the total weights of point configurations are not equal, or -if the signatures consist of weights only (the signature matrices have a single column). You -**must** initialize \*lowerBound . If the calculated distance between mass centers is greater or -equal to \*lowerBound (it means that the signatures are far enough), the function does not -calculate EMD. In any case \*lowerBound is set to the calculated distance between mass centers on -return. Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound -should be set to 0. -@param flow Resultant \f$\texttt{size1} \times \texttt{size2}\f$ flow matrix: \f$\texttt{flow}_{i,j}\f$ is -a flow from \f$i\f$ -th point of signature1 to \f$j\f$ -th point of signature2 . - */ -CV_EXPORTS float EMD( InputArray signature1, InputArray signature2, - int distType, InputArray cost=noArray(), - float* lowerBound = 0, OutputArray flow = noArray() ); - -CV_EXPORTS_AS(EMD) float wrapperEMD( InputArray signature1, InputArray signature2, - int distType, InputArray cost=noArray(), - CV_IN_OUT Ptr lowerBound = Ptr(), OutputArray flow = noArray() ); - -//! @} imgproc_hist - -/** @example samples/cpp/watershed.cpp -An example using the watershed algorithm -*/ - -/** @brief Performs a marker-based image segmentation using the watershed algorithm. - -The function implements one of the variants of watershed, non-parametric marker-based segmentation -algorithm, described in @cite Meyer92 . - -Before passing the image to the function, you have to roughly outline the desired regions in the -image markers with positive (\>0) indices. So, every region is represented as one or more connected -components with the pixel values 1, 2, 3, and so on. Such markers can be retrieved from a binary -mask using #findContours and #drawContours (see the watershed.cpp demo). The markers are "seeds" of -the future image regions. All the other pixels in markers , whose relation to the outlined regions -is not known and should be defined by the algorithm, should be set to 0's. In the function output, -each pixel in markers is set to a value of the "seed" components or to -1 at boundaries between the -regions. - -@note Any two neighbor connected components are not necessarily separated by a watershed boundary -(-1's pixels); for example, they can touch each other in the initial marker image passed to the -function. - -@param image Input 8-bit 3-channel image. -@param markers Input/output 32-bit single-channel image (map) of markers. It should have the same -size as image . - -@sa findContours - -@ingroup imgproc_misc - */ -CV_EXPORTS_W void watershed( InputArray image, InputOutputArray markers ); - -//! @addtogroup imgproc_filter -//! @{ - -/** @brief Performs initial step of meanshift segmentation of an image. - -The function implements the filtering stage of meanshift segmentation, that is, the output of the -function is the filtered "posterized" image with color gradients and fine-grain texture flattened. -At every pixel (X,Y) of the input image (or down-sized input image, see below) the function executes -meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is -considered: - -\f[(x,y): X- \texttt{sp} \le x \le X+ \texttt{sp} , Y- \texttt{sp} \le y \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)|| \le \texttt{sr}\f] - -where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively -(though, the algorithm does not depend on the color space used, so any 3-component color space can -be used instead). Over the neighborhood the average spatial value (X',Y') and average color vector -(R',G',B') are found and they act as the neighborhood center on the next iteration: - -\f[(X,Y)~(X',Y'), (R,G,B)~(R',G',B').\f] - -After the iterations over, the color components of the initial pixel (that is, the pixel from where -the iterations started) are set to the final value (average color at the last iteration): - -\f[I(X,Y) <- (R*,G*,B*)\f] - -When maxLevel \> 0, the gaussian pyramid of maxLevel+1 levels is built, and the above procedure is -run on the smallest layer first. After that, the results are propagated to the larger layer and the -iterations are run again only on those pixels where the layer colors differ by more than sr from the -lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the -results will be actually different from the ones obtained by running the meanshift procedure on the -whole original image (i.e. when maxLevel==0). - -@param src The source 8-bit, 3-channel image. -@param dst The destination image of the same format and the same size as the source. -@param sp The spatial window radius. -@param sr The color window radius. -@param maxLevel Maximum level of the pyramid for the segmentation. -@param termcrit Termination criteria: when to stop meanshift iterations. - */ -CV_EXPORTS_W void pyrMeanShiftFiltering( InputArray src, OutputArray dst, - double sp, double sr, int maxLevel = 1, - TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) ); - -//! @} - -//! @addtogroup imgproc_misc -//! @{ - -/** @example samples/cpp/grabcut.cpp -An example using the GrabCut algorithm -![Sample Screenshot](grabcut_output1.jpg) -*/ - -/** @brief Runs the GrabCut algorithm. - -The function implements the [GrabCut image segmentation algorithm](http://en.wikipedia.org/wiki/GrabCut). - -@param img Input 8-bit 3-channel image. -@param mask Input/output 8-bit single-channel mask. The mask is initialized by the function when -mode is set to #GC_INIT_WITH_RECT. Its elements may have one of the #GrabCutClasses. -@param rect ROI containing a segmented object. The pixels outside of the ROI are marked as -"obvious background". The parameter is only used when mode==#GC_INIT_WITH_RECT . -@param bgdModel Temporary array for the background model. Do not modify it while you are -processing the same image. -@param fgdModel Temporary arrays for the foreground model. Do not modify it while you are -processing the same image. -@param iterCount Number of iterations the algorithm should make before returning the result. Note -that the result can be refined with further calls with mode==#GC_INIT_WITH_MASK or -mode==GC_EVAL . -@param mode Operation mode that could be one of the #GrabCutModes - */ -CV_EXPORTS_W void grabCut( InputArray img, InputOutputArray mask, Rect rect, - InputOutputArray bgdModel, InputOutputArray fgdModel, - int iterCount, int mode = GC_EVAL ); - -/** @example samples/cpp/distrans.cpp -An example on using the distance transform -*/ - -/** @brief Calculates the distance to the closest zero pixel for each pixel of the source image. - -The function cv::distanceTransform calculates the approximate or precise distance from every binary -image pixel to the nearest zero pixel. For zero image pixels, the distance will obviously be zero. - -When maskSize == #DIST_MASK_PRECISE and distanceType == #DIST_L2 , the function runs the -algorithm described in @cite Felzenszwalb04 . This algorithm is parallelized with the TBB library. - -In other cases, the algorithm @cite Borgefors86 is used. This means that for a pixel the function -finds the shortest path to the nearest zero pixel consisting of basic shifts: horizontal, vertical, -diagonal, or knight's move (the latest is available for a \f$5\times 5\f$ mask). The overall -distance is calculated as a sum of these basic distances. Since the distance function should be -symmetric, all of the horizontal and vertical shifts must have the same cost (denoted as a ), all -the diagonal shifts must have the same cost (denoted as `b`), and all knight's moves must have the -same cost (denoted as `c`). For the #DIST_C and #DIST_L1 types, the distance is calculated -precisely, whereas for #DIST_L2 (Euclidean distance) the distance can be calculated only with a -relative error (a \f$5\times 5\f$ mask gives more accurate results). For `a`,`b`, and `c`, OpenCV -uses the values suggested in the original paper: -- DIST_L1: `a = 1, b = 2` -- DIST_L2: - - `3 x 3`: `a=0.955, b=1.3693` - - `5 x 5`: `a=1, b=1.4, c=2.1969` -- DIST_C: `a = 1, b = 1` - -Typically, for a fast, coarse distance estimation #DIST_L2, a \f$3\times 3\f$ mask is used. For a -more accurate distance estimation #DIST_L2, a \f$5\times 5\f$ mask or the precise algorithm is used. -Note that both the precise and the approximate algorithms are linear on the number of pixels. - -This variant of the function does not only compute the minimum distance for each pixel \f$(x, y)\f$ -but also identifies the nearest connected component consisting of zero pixels -(labelType==#DIST_LABEL_CCOMP) or the nearest zero pixel (labelType==#DIST_LABEL_PIXEL). Index of the -component/pixel is stored in `labels(x, y)`. When labelType==#DIST_LABEL_CCOMP, the function -automatically finds connected components of zero pixels in the input image and marks them with -distinct labels. When labelType==#DIST_LABEL_CCOMP, the function scans through the input image and -marks all the zero pixels with distinct labels. - -In this mode, the complexity is still linear. That is, the function provides a very fast way to -compute the Voronoi diagram for a binary image. Currently, the second variant can use only the -approximate distance transform algorithm, i.e. maskSize=#DIST_MASK_PRECISE is not supported -yet. - -@param src 8-bit, single-channel (binary) source image. -@param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point, -single-channel image of the same size as src. -@param labels Output 2D array of labels (the discrete Voronoi diagram). It has the type -CV_32SC1 and the same size as src. -@param distanceType Type of distance, see #DistanceTypes -@param maskSize Size of the distance transform mask, see #DistanceTransformMasks. -#DIST_MASK_PRECISE is not supported by this variant. In case of the #DIST_L1 or #DIST_C distance type, -the parameter is forced to 3 because a \f$3\times 3\f$ mask gives the same result as \f$5\times -5\f$ or any larger aperture. -@param labelType Type of the label array to build, see #DistanceTransformLabelTypes. - */ -CV_EXPORTS_AS(distanceTransformWithLabels) void distanceTransform( InputArray src, OutputArray dst, - OutputArray labels, int distanceType, int maskSize, - int labelType = DIST_LABEL_CCOMP ); - -/** @overload -@param src 8-bit, single-channel (binary) source image. -@param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point, -single-channel image of the same size as src . -@param distanceType Type of distance, see #DistanceTypes -@param maskSize Size of the distance transform mask, see #DistanceTransformMasks. In case of the -#DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a \f$3\times 3\f$ mask gives -the same result as \f$5\times 5\f$ or any larger aperture. -@param dstType Type of output image. It can be CV_8U or CV_32F. Type CV_8U can be used only for -the first variant of the function and distanceType == #DIST_L1. -*/ -CV_EXPORTS_W void distanceTransform( InputArray src, OutputArray dst, - int distanceType, int maskSize, int dstType=CV_32F); - -/** @example samples/cpp/ffilldemo.cpp -An example using the FloodFill technique -*/ - -/** @overload - -variant without `mask` parameter -*/ -CV_EXPORTS int floodFill( InputOutputArray image, - Point seedPoint, Scalar newVal, CV_OUT Rect* rect = 0, - Scalar loDiff = Scalar(), Scalar upDiff = Scalar(), - int flags = 4 ); - -/** @brief Fills a connected component with the given color. - -The function cv::floodFill fills a connected component starting from the seed point with the specified -color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The -pixel at \f$(x,y)\f$ is considered to belong to the repainted domain if: - -- in case of a grayscale image and floating range -\f[\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} (x',y')+ \texttt{upDiff}\f] - - -- in case of a grayscale image and fixed range -\f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}\f] - - -- in case of a color image and floating range -\f[\texttt{src} (x',y')_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} (x',y')_r+ \texttt{upDiff} _r,\f] -\f[\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g\f] -and -\f[\texttt{src} (x',y')_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} (x',y')_b+ \texttt{upDiff} _b\f] - - -- in case of a color image and fixed range -\f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,\f] -\f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g\f] -and -\f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b\f] - - -where \f$src(x',y')\f$ is the value of one of pixel neighbors that is already known to belong to the -component. That is, to be added to the connected component, a color/brightness of the pixel should -be close enough to: -- Color/brightness of one of its neighbors that already belong to the connected component in case -of a floating range. -- Color/brightness of the seed point in case of a fixed range. - -Use these functions to either mark a connected component with the specified color in-place, or build -a mask and then extract the contour, or copy the region to another image, and so on. - -@param image Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the -function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See -the details below. -@param mask Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels -taller than image. Since this is both an input and output parameter, you must take responsibility -of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example, -an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the -mask corresponding to filled pixels in the image are set to 1 or to the a value specified in flags -as described below. Additionally, the function fills the border of the mask with ones to simplify -internal processing. It is therefore possible to use the same mask in multiple calls to the function -to make sure the filled areas do not overlap. -@param seedPoint Starting point. -@param newVal New value of the repainted domain pixels. -@param loDiff Maximal lower brightness/color difference between the currently observed pixel and -one of its neighbors belonging to the component, or a seed pixel being added to the component. -@param upDiff Maximal upper brightness/color difference between the currently observed pixel and -one of its neighbors belonging to the component, or a seed pixel being added to the component. -@param rect Optional output parameter set by the function to the minimum bounding rectangle of the -repainted domain. -@param flags Operation flags. The first 8 bits contain a connectivity value. The default value of -4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A -connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner) -will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill -the mask (the default value is 1). For example, 4 | ( 255 \<\< 8 ) will consider 4 nearest -neighbours and fill the mask with a value of 255. The following additional options occupy higher -bits and therefore may be further combined with the connectivity and mask fill values using -bit-wise or (|), see #FloodFillFlags. - -@note Since the mask is larger than the filled image, a pixel \f$(x, y)\f$ in image corresponds to the -pixel \f$(x+1, y+1)\f$ in the mask . - -@sa findContours - */ -CV_EXPORTS_W int floodFill( InputOutputArray image, InputOutputArray mask, - Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0, - Scalar loDiff = Scalar(), Scalar upDiff = Scalar(), - int flags = 4 ); - -//! Performs linear blending of two images: -//! \f[ \texttt{dst}(i,j) = \texttt{weights1}(i,j)*\texttt{src1}(i,j) + \texttt{weights2}(i,j)*\texttt{src2}(i,j) \f] -//! @param src1 It has a type of CV_8UC(n) or CV_32FC(n), where n is a positive integer. -//! @param src2 It has the same type and size as src1. -//! @param weights1 It has a type of CV_32FC1 and the same size with src1. -//! @param weights2 It has a type of CV_32FC1 and the same size with src1. -//! @param dst It is created if it does not have the same size and type with src1. -CV_EXPORTS void blendLinear(InputArray src1, InputArray src2, InputArray weights1, InputArray weights2, OutputArray dst); - -//! @} imgproc_misc - -//! @addtogroup imgproc_color_conversions -//! @{ - -/** @brief Converts an image from one color space to another. - -The function converts an input image from one color space to another. In case of a transformation -to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note -that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the -bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue -component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and -sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on. - -The conventional ranges for R, G, and B channel values are: -- 0 to 255 for CV_8U images -- 0 to 65535 for CV_16U images -- 0 to 1 for CV_32F images - -In case of linear transformations, the range does not matter. But in case of a non-linear -transformation, an input RGB image should be normalized to the proper value range to get the correct -results, for example, for RGB \f$\rightarrow\f$ L\*u\*v\* transformation. For example, if you have a -32-bit floating-point image directly converted from an 8-bit image without any scaling, then it will -have the 0..255 value range instead of 0..1 assumed by the function. So, before calling #cvtColor , -you need first to scale the image down: -@code - img *= 1./255; - cvtColor(img, img, COLOR_BGR2Luv); -@endcode -If you use #cvtColor with 8-bit images, the conversion will have some information lost. For many -applications, this will not be noticeable but it is recommended to use 32-bit images in applications -that need the full range of colors or that convert an image before an operation and then convert -back. - -If conversion adds the alpha channel, its value will set to the maximum of corresponding channel -range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F. - -@param src input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision -floating-point. -@param dst output image of the same size and depth as src. -@param code color space conversion code (see #ColorConversionCodes). -@param dstCn number of channels in the destination image; if the parameter is 0, the number of the -channels is derived automatically from src and code. - -@see @ref imgproc_color_conversions - */ -CV_EXPORTS_W void cvtColor( InputArray src, OutputArray dst, int code, int dstCn = 0 ); - -/** @brief Converts an image from one color space to another where the source image is -stored in two planes. - -This function only supports YUV420 to RGB conversion as of now. - -@param src1: 8-bit image (#CV_8U) of the Y plane. -@param src2: image containing interleaved U/V plane. -@param dst: output image. -@param code: Specifies the type of conversion. It can take any of the following values: -- #COLOR_YUV2BGR_NV12 -- #COLOR_YUV2RGB_NV12 -- #COLOR_YUV2BGRA_NV12 -- #COLOR_YUV2RGBA_NV12 -- #COLOR_YUV2BGR_NV21 -- #COLOR_YUV2RGB_NV21 -- #COLOR_YUV2BGRA_NV21 -- #COLOR_YUV2RGBA_NV21 -*/ -CV_EXPORTS_W void cvtColorTwoPlane( InputArray src1, InputArray src2, OutputArray dst, int code ); - -/** @brief main function for all demosaicing processes - -@param src input image: 8-bit unsigned or 16-bit unsigned. -@param dst output image of the same size and depth as src. -@param code Color space conversion code (see the description below). -@param dstCn number of channels in the destination image; if the parameter is 0, the number of the -channels is derived automatically from src and code. - -The function can do the following transformations: - -- Demosaicing using bilinear interpolation - - #COLOR_BayerBG2BGR , #COLOR_BayerGB2BGR , #COLOR_BayerRG2BGR , #COLOR_BayerGR2BGR - - #COLOR_BayerBG2GRAY , #COLOR_BayerGB2GRAY , #COLOR_BayerRG2GRAY , #COLOR_BayerGR2GRAY - -- Demosaicing using Variable Number of Gradients. - - #COLOR_BayerBG2BGR_VNG , #COLOR_BayerGB2BGR_VNG , #COLOR_BayerRG2BGR_VNG , #COLOR_BayerGR2BGR_VNG - -- Edge-Aware Demosaicing. - - #COLOR_BayerBG2BGR_EA , #COLOR_BayerGB2BGR_EA , #COLOR_BayerRG2BGR_EA , #COLOR_BayerGR2BGR_EA - -- Demosaicing with alpha channel - - #COLOR_BayerBG2BGRA , #COLOR_BayerGB2BGRA , #COLOR_BayerRG2BGRA , #COLOR_BayerGR2BGRA - -@sa cvtColor -*/ -CV_EXPORTS_W void demosaicing(InputArray src, OutputArray dst, int code, int dstCn = 0); - -//! @} imgproc_color_conversions - -//! @addtogroup imgproc_shape -//! @{ - -/** @brief Calculates all of the moments up to the third order of a polygon or rasterized shape. - -The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The -results are returned in the structure cv::Moments. - -@param array Raster image (single-channel, 8-bit or floating-point 2D array) or an array ( -\f$1 \times N\f$ or \f$N \times 1\f$ ) of 2D points (Point or Point2f ). -@param binaryImage If it is true, all non-zero image pixels are treated as 1's. The parameter is -used for images only. -@returns moments. - -@note Only applicable to contour moments calculations from Python bindings: Note that the numpy -type for the input array should be either np.int32 or np.float32. - -@sa contourArea, arcLength - */ -CV_EXPORTS_W Moments moments( InputArray array, bool binaryImage = false ); - -/** @brief Calculates seven Hu invariants. - -The function calculates seven Hu invariants (introduced in @cite Hu62; see also -) defined as: - -\f[\begin{array}{l} hu[0]= \eta _{20}+ \eta _{02} \\ hu[1]=( \eta _{20}- \eta _{02})^{2}+4 \eta _{11}^{2} \\ hu[2]=( \eta _{30}-3 \eta _{12})^{2}+ (3 \eta _{21}- \eta _{03})^{2} \\ hu[3]=( \eta _{30}+ \eta _{12})^{2}+ ( \eta _{21}+ \eta _{03})^{2} \\ hu[4]=( \eta _{30}-3 \eta _{12})( \eta _{30}+ \eta _{12})[( \eta _{30}+ \eta _{12})^{2}-3( \eta _{21}+ \eta _{03})^{2}]+(3 \eta _{21}- \eta _{03})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}] \\ hu[5]=( \eta _{20}- \eta _{02})[( \eta _{30}+ \eta _{12})^{2}- ( \eta _{21}+ \eta _{03})^{2}]+4 \eta _{11}( \eta _{30}+ \eta _{12})( \eta _{21}+ \eta _{03}) \\ hu[6]=(3 \eta _{21}- \eta _{03})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}]-( \eta _{30}-3 \eta _{12})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}] \\ \end{array}\f] - -where \f$\eta_{ji}\f$ stands for \f$\texttt{Moments::nu}_{ji}\f$ . - -These values are proved to be invariants to the image scale, rotation, and reflection except the -seventh one, whose sign is changed by reflection. This invariance is proved with the assumption of -infinite image resolution. In case of raster images, the computed Hu invariants for the original and -transformed images are a bit different. - -@param moments Input moments computed with moments . -@param hu Output Hu invariants. - -@sa matchShapes - */ -CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] ); - -/** @overload */ -CV_EXPORTS_W void HuMoments( const Moments& m, OutputArray hu ); - -//! @} imgproc_shape - -//! @addtogroup imgproc_object -//! @{ - -//! type of the template matching operation -enum TemplateMatchModes { - TM_SQDIFF = 0, //!< \f[R(x,y)= \sum _{x',y'} (T(x',y')-I(x+x',y+y'))^2\f] - TM_SQDIFF_NORMED = 1, //!< \f[R(x,y)= \frac{\sum_{x',y'} (T(x',y')-I(x+x',y+y'))^2}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}\f] - TM_CCORR = 2, //!< \f[R(x,y)= \sum _{x',y'} (T(x',y') \cdot I(x+x',y+y'))\f] - TM_CCORR_NORMED = 3, //!< \f[R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}\f] - TM_CCOEFF = 4, //!< \f[R(x,y)= \sum _{x',y'} (T'(x',y') \cdot I'(x+x',y+y'))\f] - //!< where - //!< \f[\begin{array}{l} T'(x',y')=T(x',y') - 1/(w \cdot h) \cdot \sum _{x'',y''} T(x'',y'') \\ I'(x+x',y+y')=I(x+x',y+y') - 1/(w \cdot h) \cdot \sum _{x'',y''} I(x+x'',y+y'') \end{array}\f] - TM_CCOEFF_NORMED = 5 //!< \f[R(x,y)= \frac{ \sum_{x',y'} (T'(x',y') \cdot I'(x+x',y+y')) }{ \sqrt{\sum_{x',y'}T'(x',y')^2 \cdot \sum_{x',y'} I'(x+x',y+y')^2} }\f] -}; - -/** @example samples/cpp/tutorial_code/Histograms_Matching/MatchTemplate_Demo.cpp -An example using Template Matching algorithm -*/ - -/** @brief Compares a template against overlapped image regions. - -The function slides through image , compares the overlapped patches of size \f$w \times h\f$ against -templ using the specified method and stores the comparison results in result . Here are the formulae -for the available comparison methods ( \f$I\f$ denotes image, \f$T\f$ template, \f$R\f$ result ). The summation -is done over template and/or the image patch: \f$x' = 0...w-1, y' = 0...h-1\f$ - -After the function finishes the comparison, the best matches can be found as global minimums (when -#TM_SQDIFF was used) or maximums (when #TM_CCORR or #TM_CCOEFF was used) using the -#minMaxLoc function. In case of a color image, template summation in the numerator and each sum in -the denominator is done over all of the channels and separate mean values are used for each channel. -That is, the function can take a color template and a color image. The result will still be a -single-channel image, which is easier to analyze. - -@param image Image where the search is running. It must be 8-bit or 32-bit floating-point. -@param templ Searched template. It must be not greater than the source image and have the same -data type. -@param result Map of comparison results. It must be single-channel 32-bit floating-point. If image -is \f$W \times H\f$ and templ is \f$w \times h\f$ , then result is \f$(W-w+1) \times (H-h+1)\f$ . -@param method Parameter specifying the comparison method, see #TemplateMatchModes -@param mask Mask of searched template. It must have the same datatype and size with templ. It is -not set by default. Currently, only the #TM_SQDIFF and #TM_CCORR_NORMED methods are supported. - */ -CV_EXPORTS_W void matchTemplate( InputArray image, InputArray templ, - OutputArray result, int method, InputArray mask = noArray() ); - -//! @} - -//! @addtogroup imgproc_shape -//! @{ - -/** @example samples/cpp/connected_components.cpp -This program demonstrates connected components and use of the trackbar -*/ - -/** @brief computes the connected components labeled image of boolean image - -image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 -represents the background label. ltype specifies the output label image type, an important -consideration based on the total number of labels or alternatively the total number of pixels in -the source image. ccltype specifies the connected components labeling algorithm to use, currently -Grana (BBDT) and Wu's (SAUF) algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes -for details. Note that SAUF algorithm forces a row major ordering of labels while BBDT does not. -This function uses parallel version of both Grana and Wu's algorithms if at least one allowed -parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs. - -@param image the 8-bit single-channel image to be labeled -@param labels destination labeled image -@param connectivity 8 or 4 for 8-way or 4-way connectivity respectively -@param ltype output image label type. Currently CV_32S and CV_16U are supported. -@param ccltype connected components algorithm type (see the #ConnectedComponentsAlgorithmsTypes). -*/ -CV_EXPORTS_AS(connectedComponentsWithAlgorithm) int connectedComponents(InputArray image, OutputArray labels, - int connectivity, int ltype, int ccltype); - - -/** @overload - -@param image the 8-bit single-channel image to be labeled -@param labels destination labeled image -@param connectivity 8 or 4 for 8-way or 4-way connectivity respectively -@param ltype output image label type. Currently CV_32S and CV_16U are supported. -*/ -CV_EXPORTS_W int connectedComponents(InputArray image, OutputArray labels, - int connectivity = 8, int ltype = CV_32S); - - -/** @brief computes the connected components labeled image of boolean image and also produces a statistics output for each label - -image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 -represents the background label. ltype specifies the output label image type, an important -consideration based on the total number of labels or alternatively the total number of pixels in -the source image. ccltype specifies the connected components labeling algorithm to use, currently -Grana's (BBDT) and Wu's (SAUF) algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes -for details. Note that SAUF algorithm forces a row major ordering of labels while BBDT does not. -This function uses parallel version of both Grana and Wu's algorithms (statistics included) if at least one allowed -parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs. - -@param image the 8-bit single-channel image to be labeled -@param labels destination labeled image -@param stats statistics output for each label, including the background label, see below for -available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of -#ConnectedComponentsTypes. The data type is CV_32S. -@param centroids centroid output for each label, including the background label. Centroids are -accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F. -@param connectivity 8 or 4 for 8-way or 4-way connectivity respectively -@param ltype output image label type. Currently CV_32S and CV_16U are supported. -@param ccltype connected components algorithm type (see #ConnectedComponentsAlgorithmsTypes). -*/ -CV_EXPORTS_AS(connectedComponentsWithStatsWithAlgorithm) int connectedComponentsWithStats(InputArray image, OutputArray labels, - OutputArray stats, OutputArray centroids, - int connectivity, int ltype, int ccltype); - -/** @overload -@param image the 8-bit single-channel image to be labeled -@param labels destination labeled image -@param stats statistics output for each label, including the background label, see below for -available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of -#ConnectedComponentsTypes. The data type is CV_32S. -@param centroids centroid output for each label, including the background label. Centroids are -accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F. -@param connectivity 8 or 4 for 8-way or 4-way connectivity respectively -@param ltype output image label type. Currently CV_32S and CV_16U are supported. -*/ -CV_EXPORTS_W int connectedComponentsWithStats(InputArray image, OutputArray labels, - OutputArray stats, OutputArray centroids, - int connectivity = 8, int ltype = CV_32S); - - -/** @brief Finds contours in a binary image. - -The function retrieves contours from the binary image using the algorithm @cite Suzuki85 . The contours -are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the -OpenCV sample directory. -@note Since opencv 3.2 source image is not modified by this function. - -@param image Source, an 8-bit single-channel image. Non-zero pixels are treated as 1's. Zero -pixels remain 0's, so the image is treated as binary . You can use #compare, #inRange, #threshold , -#adaptiveThreshold, #Canny, and others to create a binary image out of a grayscale or color one. -If mode equals to #RETR_CCOMP or #RETR_FLOODFILL, the input can also be a 32-bit integer image of labels (CV_32SC1). -@param contours Detected contours. Each contour is stored as a vector of points (e.g. -std::vector >). -@param hierarchy Optional output vector (e.g. std::vector), containing information about the image topology. It has -as many elements as the number of contours. For each i-th contour contours[i], the elements -hierarchy[i][0] , hierarchy[i][1] , hierarchy[i][2] , and hierarchy[i][3] are set to 0-based indices -in contours of the next and previous contours at the same hierarchical level, the first child -contour and the parent contour, respectively. If for the contour i there are no next, previous, -parent, or nested contours, the corresponding elements of hierarchy[i] will be negative. -@param mode Contour retrieval mode, see #RetrievalModes -@param method Contour approximation method, see #ContourApproximationModes -@param offset Optional offset by which every contour point is shifted. This is useful if the -contours are extracted from the image ROI and then they should be analyzed in the whole image -context. - */ -CV_EXPORTS_W void findContours( InputOutputArray image, OutputArrayOfArrays contours, - OutputArray hierarchy, int mode, - int method, Point offset = Point()); - -/** @overload */ -CV_EXPORTS void findContours( InputOutputArray image, OutputArrayOfArrays contours, - int mode, int method, Point offset = Point()); - -/** @example samples/cpp/squares.cpp -A program using pyramid scaling, Canny, contours and contour simplification to find -squares in a list of images (pic1-6.png). Returns sequence of squares detected on the image. -*/ - -/** @example samples/tapi/squares.cpp -A program using pyramid scaling, Canny, contours and contour simplification to find -squares in the input image. -*/ - -/** @brief Approximates a polygonal curve(s) with the specified precision. - -The function cv::approxPolyDP approximates a curve or a polygon with another curve/polygon with less -vertices so that the distance between them is less or equal to the specified precision. It uses the -Douglas-Peucker algorithm - -@param curve Input vector of a 2D point stored in std::vector or Mat -@param approxCurve Result of the approximation. The type should match the type of the input curve. -@param epsilon Parameter specifying the approximation accuracy. This is the maximum distance -between the original curve and its approximation. -@param closed If true, the approximated curve is closed (its first and last vertices are -connected). Otherwise, it is not closed. - */ -CV_EXPORTS_W void approxPolyDP( InputArray curve, - OutputArray approxCurve, - double epsilon, bool closed ); - -/** @brief Calculates a contour perimeter or a curve length. - -The function computes a curve length or a closed contour perimeter. - -@param curve Input vector of 2D points, stored in std::vector or Mat. -@param closed Flag indicating whether the curve is closed or not. - */ -CV_EXPORTS_W double arcLength( InputArray curve, bool closed ); - -/** @brief Calculates the up-right bounding rectangle of a point set or non-zero pixels of gray-scale image. - -The function calculates and returns the minimal up-right bounding rectangle for the specified point set or -non-zero pixels of gray-scale image. - -@param array Input gray-scale image or 2D point set, stored in std::vector or Mat. - */ -CV_EXPORTS_W Rect boundingRect( InputArray array ); - -/** @brief Calculates a contour area. - -The function computes a contour area. Similarly to moments , the area is computed using the Green -formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using -#drawContours or #fillPoly , can be different. Also, the function will most certainly give a wrong -results for contours with self-intersections. - -Example: -@code - vector contour; - contour.push_back(Point2f(0, 0)); - contour.push_back(Point2f(10, 0)); - contour.push_back(Point2f(10, 10)); - contour.push_back(Point2f(5, 4)); - - double area0 = contourArea(contour); - vector approx; - approxPolyDP(contour, approx, 5, true); - double area1 = contourArea(approx); - - cout << "area0 =" << area0 << endl << - "area1 =" << area1 << endl << - "approx poly vertices" << approx.size() << endl; -@endcode -@param contour Input vector of 2D points (contour vertices), stored in std::vector or Mat. -@param oriented Oriented area flag. If it is true, the function returns a signed area value, -depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can -determine orientation of a contour by taking the sign of an area. By default, the parameter is -false, which means that the absolute value is returned. - */ -CV_EXPORTS_W double contourArea( InputArray contour, bool oriented = false ); - -/** @brief Finds a rotated rectangle of the minimum area enclosing the input 2D point set. - -The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a -specified point set. Developer should keep in mind that the returned RotatedRect can contain negative -indices when data is close to the containing Mat element boundary. - -@param points Input vector of 2D points, stored in std::vector\<\> or Mat - */ -CV_EXPORTS_W RotatedRect minAreaRect( InputArray points ); - -/** @brief Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle. - -The function finds the four vertices of a rotated rectangle. This function is useful to draw the -rectangle. In C++, instead of using this function, you can directly use RotatedRect::points method. Please -visit the @ref tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information. - -@param box The input rotated rectangle. It may be the output of -@param points The output array of four vertices of rectangles. - */ -CV_EXPORTS_W void boxPoints(RotatedRect box, OutputArray points); - -/** @brief Finds a circle of the minimum area enclosing a 2D point set. - -The function finds the minimal enclosing circle of a 2D point set using an iterative algorithm. - -@param points Input vector of 2D points, stored in std::vector\<\> or Mat -@param center Output center of the circle. -@param radius Output radius of the circle. - */ -CV_EXPORTS_W void minEnclosingCircle( InputArray points, - CV_OUT Point2f& center, CV_OUT float& radius ); - -/** @example samples/cpp/minarea.cpp -*/ - -/** @brief Finds a triangle of minimum area enclosing a 2D point set and returns its area. - -The function finds a triangle of minimum area enclosing the given set of 2D points and returns its -area. The output for a given 2D point set is shown in the image below. 2D points are depicted in -*red* and the enclosing triangle in *yellow*. - -![Sample output of the minimum enclosing triangle function](pics/minenclosingtriangle.png) - -The implementation of the algorithm is based on O'Rourke's @cite ORourke86 and Klee and Laskowski's -@cite KleeLaskowski85 papers. O'Rourke provides a \f$\theta(n)\f$ algorithm for finding the minimal -enclosing triangle of a 2D convex polygon with n vertices. Since the #minEnclosingTriangle function -takes a 2D point set as input an additional preprocessing step of computing the convex hull of the -2D point set is required. The complexity of the #convexHull function is \f$O(n log(n))\f$ which is higher -than \f$\theta(n)\f$. Thus the overall complexity of the function is \f$O(n log(n))\f$. - -@param points Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector\<\> or Mat -@param triangle Output vector of three 2D points defining the vertices of the triangle. The depth -of the OutputArray must be CV_32F. - */ -CV_EXPORTS_W double minEnclosingTriangle( InputArray points, CV_OUT OutputArray triangle ); - -/** @brief Compares two shapes. - -The function compares two shapes. All three implemented methods use the Hu invariants (see #HuMoments) - -@param contour1 First contour or grayscale image. -@param contour2 Second contour or grayscale image. -@param method Comparison method, see #ShapeMatchModes -@param parameter Method-specific parameter (not supported now). - */ -CV_EXPORTS_W double matchShapes( InputArray contour1, InputArray contour2, - int method, double parameter ); - -/** @example samples/cpp/convexhull.cpp -An example using the convexHull functionality -*/ - -/** @brief Finds the convex hull of a point set. - -The function cv::convexHull finds the convex hull of a 2D point set using the Sklansky's algorithm @cite Sklansky82 -that has *O(N logN)* complexity in the current implementation. - -@param points Input 2D point set, stored in std::vector or Mat. -@param hull Output convex hull. It is either an integer vector of indices or vector of points. In -the first case, the hull elements are 0-based indices of the convex hull points in the original -array (since the set of convex hull points is a subset of the original point set). In the second -case, hull elements are the convex hull points themselves. -@param clockwise Orientation flag. If it is true, the output convex hull is oriented clockwise. -Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing -to the right, and its Y axis pointing upwards. -@param returnPoints Operation flag. In case of a matrix, when the flag is true, the function -returns convex hull points. Otherwise, it returns indices of the convex hull points. When the -output array is std::vector, the flag is ignored, and the output depends on the type of the -vector: std::vector\ implies returnPoints=false, std::vector\ implies -returnPoints=true. - -@note `points` and `hull` should be different arrays, inplace processing isn't supported. - -Check @ref tutorial_hull "the corresponding tutorial" for more details. - -useful links: - -https://www.learnopencv.com/convex-hull-using-opencv-in-python-and-c/ - */ -CV_EXPORTS_W void convexHull( InputArray points, OutputArray hull, - bool clockwise = false, bool returnPoints = true ); - -/** @brief Finds the convexity defects of a contour. - -The figure below displays convexity defects of a hand contour: - -![image](pics/defects.png) - -@param contour Input contour. -@param convexhull Convex hull obtained using convexHull that should contain indices of the contour -points that make the hull. -@param convexityDefects The output vector of convexity defects. In C++ and the new Python/Java -interface each convexity defect is represented as 4-element integer vector (a.k.a. #Vec4i): -(start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices -in the original contour of the convexity defect beginning, end and the farthest point, and -fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the -farthest contour point and the hull. That is, to get the floating-point value of the depth will be -fixpt_depth/256.0. - */ -CV_EXPORTS_W void convexityDefects( InputArray contour, InputArray convexhull, OutputArray convexityDefects ); - -/** @brief Tests a contour convexity. - -The function tests whether the input contour is convex or not. The contour must be simple, that is, -without self-intersections. Otherwise, the function output is undefined. - -@param contour Input vector of 2D points, stored in std::vector\<\> or Mat - */ -CV_EXPORTS_W bool isContourConvex( InputArray contour ); - -//! finds intersection of two convex polygons -CV_EXPORTS_W float intersectConvexConvex( InputArray _p1, InputArray _p2, - OutputArray _p12, bool handleNested = true ); - -/** @example samples/cpp/fitellipse.cpp -An example using the fitEllipse technique -*/ - -/** @brief Fits an ellipse around a set of 2D points. - -The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of -all. It returns the rotated rectangle in which the ellipse is inscribed. The first algorithm described by @cite Fitzgibbon95 -is used. Developer should keep in mind that it is possible that the returned -ellipse/rotatedRect data contains negative indices, due to the data points being close to the -border of the containing Mat element. - -@param points Input 2D point set, stored in std::vector\<\> or Mat - */ -CV_EXPORTS_W RotatedRect fitEllipse( InputArray points ); - -/** @brief Fits an ellipse around a set of 2D points. - - The function calculates the ellipse that fits a set of 2D points. - It returns the rotated rectangle in which the ellipse is inscribed. - The Approximate Mean Square (AMS) proposed by @cite Taubin1991 is used. - - For an ellipse, this basis set is \f$ \chi= \left(x^2, x y, y^2, x, y, 1\right) \f$, - which is a set of six free coefficients \f$ A^T=\left\{A_{\text{xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\} \f$. - However, to specify an ellipse, all that is needed is five numbers; the major and minor axes lengths \f$ (a,b) \f$, - the position \f$ (x_0,y_0) \f$, and the orientation \f$ \theta \f$. This is because the basis set includes lines, - quadratics, parabolic and hyperbolic functions as well as elliptical functions as possible fits. - If the fit is found to be a parabolic or hyperbolic function then the standard #fitEllipse method is used. - The AMS method restricts the fit to parabolic, hyperbolic and elliptical curves - by imposing the condition that \f$ A^T ( D_x^T D_x + D_y^T D_y) A = 1 \f$ where - the matrices \f$ Dx \f$ and \f$ Dy \f$ are the partial derivatives of the design matrix \f$ D \f$ with - respect to x and y. The matrices are formed row by row applying the following to - each of the points in the set: - \f{align*}{ - D(i,:)&=\left\{x_i^2, x_i y_i, y_i^2, x_i, y_i, 1\right\} & - D_x(i,:)&=\left\{2 x_i,y_i,0,1,0,0\right\} & - D_y(i,:)&=\left\{0,x_i,2 y_i,0,1,0\right\} - \f} - The AMS method minimizes the cost function - \f{equation*}{ - \epsilon ^2=\frac{ A^T D^T D A }{ A^T (D_x^T D_x + D_y^T D_y) A^T } - \f} - - The minimum cost is found by solving the generalized eigenvalue problem. - - \f{equation*}{ - D^T D A = \lambda \left( D_x^T D_x + D_y^T D_y\right) A - \f} - - @param points Input 2D point set, stored in std::vector\<\> or Mat - */ -CV_EXPORTS_W RotatedRect fitEllipseAMS( InputArray points ); - - -/** @brief Fits an ellipse around a set of 2D points. - - The function calculates the ellipse that fits a set of 2D points. - It returns the rotated rectangle in which the ellipse is inscribed. - The Direct least square (Direct) method by @cite Fitzgibbon1999 is used. - - For an ellipse, this basis set is \f$ \chi= \left(x^2, x y, y^2, x, y, 1\right) \f$, - which is a set of six free coefficients \f$ A^T=\left\{A_{\text{xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\} \f$. - However, to specify an ellipse, all that is needed is five numbers; the major and minor axes lengths \f$ (a,b) \f$, - the position \f$ (x_0,y_0) \f$, and the orientation \f$ \theta \f$. This is because the basis set includes lines, - quadratics, parabolic and hyperbolic functions as well as elliptical functions as possible fits. - The Direct method confines the fit to ellipses by ensuring that \f$ 4 A_{xx} A_{yy}- A_{xy}^2 > 0 \f$. - The condition imposed is that \f$ 4 A_{xx} A_{yy}- A_{xy}^2=1 \f$ which satisfies the inequality - and as the coefficients can be arbitrarily scaled is not overly restrictive. - - \f{equation*}{ - \epsilon ^2= A^T D^T D A \quad \text{with} \quad A^T C A =1 \quad \text{and} \quad C=\left(\begin{matrix} - 0 & 0 & 2 & 0 & 0 & 0 \\ - 0 & -1 & 0 & 0 & 0 & 0 \\ - 2 & 0 & 0 & 0 & 0 & 0 \\ - 0 & 0 & 0 & 0 & 0 & 0 \\ - 0 & 0 & 0 & 0 & 0 & 0 \\ - 0 & 0 & 0 & 0 & 0 & 0 - \end{matrix} \right) - \f} - - The minimum cost is found by solving the generalized eigenvalue problem. - - \f{equation*}{ - D^T D A = \lambda \left( C\right) A - \f} - - The system produces only one positive eigenvalue \f$ \lambda\f$ which is chosen as the solution - with its eigenvector \f$\mathbf{u}\f$. These are used to find the coefficients - - \f{equation*}{ - A = \sqrt{\frac{1}{\mathbf{u}^T C \mathbf{u}}} \mathbf{u} - \f} - The scaling factor guarantees that \f$A^T C A =1\f$. - - @param points Input 2D point set, stored in std::vector\<\> or Mat - */ -CV_EXPORTS_W RotatedRect fitEllipseDirect( InputArray points ); - -/** @brief Fits a line to a 2D or 3D point set. - -The function fitLine fits a line to a 2D or 3D point set by minimizing \f$\sum_i \rho(r_i)\f$ where -\f$r_i\f$ is a distance between the \f$i^{th}\f$ point, the line and \f$\rho(r)\f$ is a distance function, one -of the following: -- DIST_L2 -\f[\rho (r) = r^2/2 \quad \text{(the simplest and the fastest least-squares method)}\f] -- DIST_L1 -\f[\rho (r) = r\f] -- DIST_L12 -\f[\rho (r) = 2 \cdot ( \sqrt{1 + \frac{r^2}{2}} - 1)\f] -- DIST_FAIR -\f[\rho \left (r \right ) = C^2 \cdot \left ( \frac{r}{C} - \log{\left(1 + \frac{r}{C}\right)} \right ) \quad \text{where} \quad C=1.3998\f] -- DIST_WELSCH -\f[\rho \left (r \right ) = \frac{C^2}{2} \cdot \left ( 1 - \exp{\left(-\left(\frac{r}{C}\right)^2\right)} \right ) \quad \text{where} \quad C=2.9846\f] -- DIST_HUBER -\f[\rho (r) = \fork{r^2/2}{if \(r < C\)}{C \cdot (r-C/2)}{otherwise} \quad \text{where} \quad C=1.345\f] - -The algorithm is based on the M-estimator ( ) technique -that iteratively fits the line using the weighted least-squares algorithm. After each iteration the -weights \f$w_i\f$ are adjusted to be inversely proportional to \f$\rho(r_i)\f$ . - -@param points Input vector of 2D or 3D points, stored in std::vector\<\> or Mat. -@param line Output line parameters. In case of 2D fitting, it should be a vector of 4 elements -(like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and -(x0, y0) is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like -Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line -and (x0, y0, z0) is a point on the line. -@param distType Distance used by the M-estimator, see #DistanceTypes -@param param Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value -is chosen. -@param reps Sufficient accuracy for the radius (distance between the coordinate origin and the line). -@param aeps Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps. - */ -CV_EXPORTS_W void fitLine( InputArray points, OutputArray line, int distType, - double param, double reps, double aeps ); - -/** @brief Performs a point-in-contour test. - -The function determines whether the point is inside a contour, outside, or lies on an edge (or -coincides with a vertex). It returns positive (inside), negative (outside), or zero (on an edge) -value, correspondingly. When measureDist=false , the return value is +1, -1, and 0, respectively. -Otherwise, the return value is a signed distance between the point and the nearest contour edge. - -See below a sample output of the function where each image pixel is tested against the contour: - -![sample output](pics/pointpolygon.png) - -@param contour Input contour. -@param pt Point tested against the contour. -@param measureDist If true, the function estimates the signed distance from the point to the -nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not. - */ -CV_EXPORTS_W double pointPolygonTest( InputArray contour, Point2f pt, bool measureDist ); - -/** @brief Finds out if there is any intersection between two rotated rectangles. - -If there is then the vertices of the intersecting region are returned as well. - -Below are some examples of intersection configurations. The hatched pattern indicates the -intersecting region and the red vertices are returned by the function. - -![intersection examples](pics/intersection.png) - -@param rect1 First rectangle -@param rect2 Second rectangle -@param intersectingRegion The output array of the vertices of the intersecting region. It returns -at most 8 vertices. Stored as std::vector\ or cv::Mat as Mx1 of type CV_32FC2. -@returns One of #RectanglesIntersectTypes - */ -CV_EXPORTS_W int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, OutputArray intersectingRegion ); - -/** @brief Creates a smart pointer to a cv::GeneralizedHoughBallard class and initializes it. -*/ -CV_EXPORTS Ptr createGeneralizedHoughBallard(); - -/** @brief Creates a smart pointer to a cv::GeneralizedHoughGuil class and initializes it. -*/ -CV_EXPORTS Ptr createGeneralizedHoughGuil(); - -//! @} imgproc_shape - -//! @addtogroup imgproc_colormap -//! @{ - -//! GNU Octave/MATLAB equivalent colormaps -enum ColormapTypes -{ - COLORMAP_AUTUMN = 0, //!< ![autumn](pics/colormaps/colorscale_autumn.jpg) - COLORMAP_BONE = 1, //!< ![bone](pics/colormaps/colorscale_bone.jpg) - COLORMAP_JET = 2, //!< ![jet](pics/colormaps/colorscale_jet.jpg) - COLORMAP_WINTER = 3, //!< ![winter](pics/colormaps/colorscale_winter.jpg) - COLORMAP_RAINBOW = 4, //!< ![rainbow](pics/colormaps/colorscale_rainbow.jpg) - COLORMAP_OCEAN = 5, //!< ![ocean](pics/colormaps/colorscale_ocean.jpg) - COLORMAP_SUMMER = 6, //!< ![summer](pics/colormaps/colorscale_summer.jpg) - COLORMAP_SPRING = 7, //!< ![spring](pics/colormaps/colorscale_spring.jpg) - COLORMAP_COOL = 8, //!< ![cool](pics/colormaps/colorscale_cool.jpg) - COLORMAP_HSV = 9, //!< ![HSV](pics/colormaps/colorscale_hsv.jpg) - COLORMAP_PINK = 10, //!< ![pink](pics/colormaps/colorscale_pink.jpg) - COLORMAP_HOT = 11, //!< ![hot](pics/colormaps/colorscale_hot.jpg) - COLORMAP_PARULA = 12, //!< ![parula](pics/colormaps/colorscale_parula.jpg) - COLORMAP_MAGMA = 13, //!< ![magma](pics/colormaps/colorscale_magma.jpg) - COLORMAP_INFERNO = 14, //!< ![inferno](pics/colormaps/colorscale_inferno.jpg) - COLORMAP_PLASMA = 15, //!< ![plasma](pics/colormaps/colorscale_plasma.jpg) - COLORMAP_VIRIDIS = 16, //!< ![viridis](pics/colormaps/colorscale_viridis.jpg) - COLORMAP_CIVIDIS = 17, //!< ![cividis](pics/colormaps/colorscale_cividis.jpg) - COLORMAP_TWILIGHT = 18, //!< ![twilight](pics/colormaps/colorscale_twilight.jpg) - COLORMAP_TWILIGHT_SHIFTED = 19 //!< ![twilight shifted](pics/colormaps/colorscale_twilight_shifted.jpg) -}; - -/** @example samples/cpp/falsecolor.cpp -An example using applyColorMap function -*/ - -/** @brief Applies a GNU Octave/MATLAB equivalent colormap on a given image. - -@param src The source image, grayscale or colored of type CV_8UC1 or CV_8UC3. -@param dst The result is the colormapped source image. Note: Mat::create is called on dst. -@param colormap The colormap to apply, see #ColormapTypes -*/ -CV_EXPORTS_W void applyColorMap(InputArray src, OutputArray dst, int colormap); - -/** @brief Applies a user colormap on a given image. - -@param src The source image, grayscale or colored of type CV_8UC1 or CV_8UC3. -@param dst The result is the colormapped source image. Note: Mat::create is called on dst. -@param userColor The colormap to apply of type CV_8UC1 or CV_8UC3 and size 256 -*/ -CV_EXPORTS_W void applyColorMap(InputArray src, OutputArray dst, InputArray userColor); - -//! @} imgproc_colormap - -//! @addtogroup imgproc_draw -//! @{ - - -/** OpenCV color channel order is BGR[A] */ -#define CV_RGB(r, g, b) cv::Scalar((b), (g), (r), 0) - -/** @brief Draws a line segment connecting two points. - -The function line draws the line segment between pt1 and pt2 points in the image. The line is -clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected -or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased -lines are drawn using Gaussian filtering. - -@param img Image. -@param pt1 First point of the line segment. -@param pt2 Second point of the line segment. -@param color Line color. -@param thickness Line thickness. -@param lineType Type of the line. See #LineTypes. -@param shift Number of fractional bits in the point coordinates. - */ -CV_EXPORTS_W void line(InputOutputArray img, Point pt1, Point pt2, const Scalar& color, - int thickness = 1, int lineType = LINE_8, int shift = 0); - -/** @brief Draws a arrow segment pointing from the first point to the second one. - -The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line. - -@param img Image. -@param pt1 The point the arrow starts from. -@param pt2 The point the arrow points to. -@param color Line color. -@param thickness Line thickness. -@param line_type Type of the line. See #LineTypes -@param shift Number of fractional bits in the point coordinates. -@param tipLength The length of the arrow tip in relation to the arrow length - */ -CV_EXPORTS_W void arrowedLine(InputOutputArray img, Point pt1, Point pt2, const Scalar& color, - int thickness=1, int line_type=8, int shift=0, double tipLength=0.1); - -/** @brief Draws a simple, thick, or filled up-right rectangle. - -The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners -are pt1 and pt2. - -@param img Image. -@param pt1 Vertex of the rectangle. -@param pt2 Vertex of the rectangle opposite to pt1 . -@param color Rectangle color or brightness (grayscale image). -@param thickness Thickness of lines that make up the rectangle. Negative values, like #FILLED, -mean that the function has to draw a filled rectangle. -@param lineType Type of the line. See #LineTypes -@param shift Number of fractional bits in the point coordinates. - */ -CV_EXPORTS_W void rectangle(InputOutputArray img, Point pt1, Point pt2, - const Scalar& color, int thickness = 1, - int lineType = LINE_8, int shift = 0); - -/** @overload - -use `rec` parameter as alternative specification of the drawn rectangle: `r.tl() and -r.br()-Point(1,1)` are opposite corners -*/ -CV_EXPORTS void rectangle(CV_IN_OUT Mat& img, Rect rec, - const Scalar& color, int thickness = 1, - int lineType = LINE_8, int shift = 0); - -/** @example samples/cpp/tutorial_code/ImgProc/basic_drawing/Drawing_2.cpp -An example using drawing functions -*/ - -/** @brief Draws a circle. - -The function cv::circle draws a simple or filled circle with a given center and radius. -@param img Image where the circle is drawn. -@param center Center of the circle. -@param radius Radius of the circle. -@param color Circle color. -@param thickness Thickness of the circle outline, if positive. Negative values, like #FILLED, -mean that a filled circle is to be drawn. -@param lineType Type of the circle boundary. See #LineTypes -@param shift Number of fractional bits in the coordinates of the center and in the radius value. - */ -CV_EXPORTS_W void circle(InputOutputArray img, Point center, int radius, - const Scalar& color, int thickness = 1, - int lineType = LINE_8, int shift = 0); - -/** @brief Draws a simple or thick elliptic arc or fills an ellipse sector. - -The function cv::ellipse with more parameters draws an ellipse outline, a filled ellipse, an elliptic -arc, or a filled ellipse sector. The drawing code uses general parametric form. -A piecewise-linear curve is used to approximate the elliptic arc -boundary. If you need more control of the ellipse rendering, you can retrieve the curve using -#ellipse2Poly and then render it with #polylines or fill it with #fillPoly. If you use the first -variant of the function and want to draw the whole ellipse, not an arc, pass `startAngle=0` and -`endAngle=360`. If `startAngle` is greater than `endAngle`, they are swapped. The figure below explains -the meaning of the parameters to draw the blue arc. - -![Parameters of Elliptic Arc](pics/ellipse.svg) - -@param img Image. -@param center Center of the ellipse. -@param axes Half of the size of the ellipse main axes. -@param angle Ellipse rotation angle in degrees. -@param startAngle Starting angle of the elliptic arc in degrees. -@param endAngle Ending angle of the elliptic arc in degrees. -@param color Ellipse color. -@param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that -a filled ellipse sector is to be drawn. -@param lineType Type of the ellipse boundary. See #LineTypes -@param shift Number of fractional bits in the coordinates of the center and values of axes. - */ -CV_EXPORTS_W void ellipse(InputOutputArray img, Point center, Size axes, - double angle, double startAngle, double endAngle, - const Scalar& color, int thickness = 1, - int lineType = LINE_8, int shift = 0); - -/** @overload -@param img Image. -@param box Alternative ellipse representation via RotatedRect. This means that the function draws -an ellipse inscribed in the rotated rectangle. -@param color Ellipse color. -@param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that -a filled ellipse sector is to be drawn. -@param lineType Type of the ellipse boundary. See #LineTypes -*/ -CV_EXPORTS_W void ellipse(InputOutputArray img, const RotatedRect& box, const Scalar& color, - int thickness = 1, int lineType = LINE_8); - -/* ----------------------------------------------------------------------------------------- */ -/* ADDING A SET OF PREDEFINED MARKERS WHICH COULD BE USED TO HIGHLIGHT POSITIONS IN AN IMAGE */ -/* ----------------------------------------------------------------------------------------- */ - -//! Possible set of marker types used for the cv::drawMarker function -enum MarkerTypes -{ - MARKER_CROSS = 0, //!< A crosshair marker shape - MARKER_TILTED_CROSS = 1, //!< A 45 degree tilted crosshair marker shape - MARKER_STAR = 2, //!< A star marker shape, combination of cross and tilted cross - MARKER_DIAMOND = 3, //!< A diamond marker shape - MARKER_SQUARE = 4, //!< A square marker shape - MARKER_TRIANGLE_UP = 5, //!< An upwards pointing triangle marker shape - MARKER_TRIANGLE_DOWN = 6 //!< A downwards pointing triangle marker shape -}; - -/** @brief Draws a marker on a predefined position in an image. - -The function cv::drawMarker draws a marker on a given position in the image. For the moment several -marker types are supported, see #MarkerTypes for more information. - -@param img Image. -@param position The point where the crosshair is positioned. -@param color Line color. -@param markerType The specific type of marker you want to use, see #MarkerTypes -@param thickness Line thickness. -@param line_type Type of the line, See #LineTypes -@param markerSize The length of the marker axis [default = 20 pixels] - */ -CV_EXPORTS_W void drawMarker(CV_IN_OUT Mat& img, Point position, const Scalar& color, - int markerType = MARKER_CROSS, int markerSize=20, int thickness=1, - int line_type=8); - -/* ----------------------------------------------------------------------------------------- */ -/* END OF MARKER SECTION */ -/* ----------------------------------------------------------------------------------------- */ - -/** @overload */ -CV_EXPORTS void fillConvexPoly(Mat& img, const Point* pts, int npts, - const Scalar& color, int lineType = LINE_8, - int shift = 0); - -/** @brief Fills a convex polygon. - -The function cv::fillConvexPoly draws a filled convex polygon. This function is much faster than the -function #fillPoly . It can fill not only convex polygons but any monotonic polygon without -self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line) -twice at the most (though, its top-most and/or the bottom edge could be horizontal). - -@param img Image. -@param points Polygon vertices. -@param color Polygon color. -@param lineType Type of the polygon boundaries. See #LineTypes -@param shift Number of fractional bits in the vertex coordinates. - */ -CV_EXPORTS_W void fillConvexPoly(InputOutputArray img, InputArray points, - const Scalar& color, int lineType = LINE_8, - int shift = 0); - -/** @overload */ -CV_EXPORTS void fillPoly(Mat& img, const Point** pts, - const int* npts, int ncontours, - const Scalar& color, int lineType = LINE_8, int shift = 0, - Point offset = Point() ); - -/** @example samples/cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp -An example using drawing functions -Check @ref tutorial_random_generator_and_text "the corresponding tutorial" for more details -*/ - -/** @brief Fills the area bounded by one or more polygons. - -The function cv::fillPoly fills an area bounded by several polygonal contours. The function can fill -complex areas, for example, areas with holes, contours with self-intersections (some of their -parts), and so forth. - -@param img Image. -@param pts Array of polygons where each polygon is represented as an array of points. -@param color Polygon color. -@param lineType Type of the polygon boundaries. See #LineTypes -@param shift Number of fractional bits in the vertex coordinates. -@param offset Optional offset of all points of the contours. - */ -CV_EXPORTS_W void fillPoly(InputOutputArray img, InputArrayOfArrays pts, - const Scalar& color, int lineType = LINE_8, int shift = 0, - Point offset = Point() ); - -/** @overload */ -CV_EXPORTS void polylines(Mat& img, const Point* const* pts, const int* npts, - int ncontours, bool isClosed, const Scalar& color, - int thickness = 1, int lineType = LINE_8, int shift = 0 ); - -/** @brief Draws several polygonal curves. - -@param img Image. -@param pts Array of polygonal curves. -@param isClosed Flag indicating whether the drawn polylines are closed or not. If they are closed, -the function draws a line from the last vertex of each curve to its first vertex. -@param color Polyline color. -@param thickness Thickness of the polyline edges. -@param lineType Type of the line segments. See #LineTypes -@param shift Number of fractional bits in the vertex coordinates. - -The function cv::polylines draws one or more polygonal curves. - */ -CV_EXPORTS_W void polylines(InputOutputArray img, InputArrayOfArrays pts, - bool isClosed, const Scalar& color, - int thickness = 1, int lineType = LINE_8, int shift = 0 ); - -/** @example samples/cpp/contours2.cpp -An example program illustrates the use of cv::findContours and cv::drawContours -\image html WindowsQtContoursOutput.png "Screenshot of the program" -*/ - -/** @example samples/cpp/segment_objects.cpp -An example using drawContours to clean up a background segmentation result -*/ - -/** @brief Draws contours outlines or filled contours. - -The function draws contour outlines in the image if \f$\texttt{thickness} \ge 0\f$ or fills the area -bounded by the contours if \f$\texttt{thickness}<0\f$ . The example below shows how to retrieve -connected components from the binary image and label them: : -@include snippets/imgproc_drawContours.cpp - -@param image Destination image. -@param contours All the input contours. Each contour is stored as a point vector. -@param contourIdx Parameter indicating a contour to draw. If it is negative, all the contours are drawn. -@param color Color of the contours. -@param thickness Thickness of lines the contours are drawn with. If it is negative (for example, -thickness=#FILLED ), the contour interiors are drawn. -@param lineType Line connectivity. See #LineTypes -@param hierarchy Optional information about hierarchy. It is only needed if you want to draw only -some of the contours (see maxLevel ). -@param maxLevel Maximal level for drawn contours. If it is 0, only the specified contour is drawn. -If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function -draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This -parameter is only taken into account when there is hierarchy available. -@param offset Optional contour shift parameter. Shift all the drawn contours by the specified -\f$\texttt{offset}=(dx,dy)\f$ . -@note When thickness=#FILLED, the function is designed to handle connected components with holes correctly -even when no hierarchy date is provided. This is done by analyzing all the outlines together -using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved -contours. In order to solve this problem, you need to call #drawContours separately for each sub-group -of contours, or iterate over the collection using contourIdx parameter. - */ -CV_EXPORTS_W void drawContours( InputOutputArray image, InputArrayOfArrays contours, - int contourIdx, const Scalar& color, - int thickness = 1, int lineType = LINE_8, - InputArray hierarchy = noArray(), - int maxLevel = INT_MAX, Point offset = Point() ); - -/** @brief Clips the line against the image rectangle. - -The function cv::clipLine calculates a part of the line segment that is entirely within the specified -rectangle. it returns false if the line segment is completely outside the rectangle. Otherwise, -it returns true . -@param imgSize Image size. The image rectangle is Rect(0, 0, imgSize.width, imgSize.height) . -@param pt1 First line point. -@param pt2 Second line point. - */ -CV_EXPORTS bool clipLine(Size imgSize, CV_IN_OUT Point& pt1, CV_IN_OUT Point& pt2); - -/** @overload -@param imgSize Image size. The image rectangle is Rect(0, 0, imgSize.width, imgSize.height) . -@param pt1 First line point. -@param pt2 Second line point. -*/ -CV_EXPORTS bool clipLine(Size2l imgSize, CV_IN_OUT Point2l& pt1, CV_IN_OUT Point2l& pt2); - -/** @overload -@param imgRect Image rectangle. -@param pt1 First line point. -@param pt2 Second line point. -*/ -CV_EXPORTS_W bool clipLine(Rect imgRect, CV_OUT CV_IN_OUT Point& pt1, CV_OUT CV_IN_OUT Point& pt2); - -/** @brief Approximates an elliptic arc with a polyline. - -The function ellipse2Poly computes the vertices of a polyline that approximates the specified -elliptic arc. It is used by #ellipse. If `arcStart` is greater than `arcEnd`, they are swapped. - -@param center Center of the arc. -@param axes Half of the size of the ellipse main axes. See #ellipse for details. -@param angle Rotation angle of the ellipse in degrees. See #ellipse for details. -@param arcStart Starting angle of the elliptic arc in degrees. -@param arcEnd Ending angle of the elliptic arc in degrees. -@param delta Angle between the subsequent polyline vertices. It defines the approximation -accuracy. -@param pts Output vector of polyline vertices. - */ -CV_EXPORTS_W void ellipse2Poly( Point center, Size axes, int angle, - int arcStart, int arcEnd, int delta, - CV_OUT std::vector& pts ); - -/** @overload -@param center Center of the arc. -@param axes Half of the size of the ellipse main axes. See #ellipse for details. -@param angle Rotation angle of the ellipse in degrees. See #ellipse for details. -@param arcStart Starting angle of the elliptic arc in degrees. -@param arcEnd Ending angle of the elliptic arc in degrees. -@param delta Angle between the subsequent polyline vertices. It defines the approximation accuracy. -@param pts Output vector of polyline vertices. -*/ -CV_EXPORTS void ellipse2Poly(Point2d center, Size2d axes, int angle, - int arcStart, int arcEnd, int delta, - CV_OUT std::vector& pts); - -/** @brief Draws a text string. - -The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered -using the specified font are replaced by question marks. See #getTextSize for a text rendering code -example. - -@param img Image. -@param text Text string to be drawn. -@param org Bottom-left corner of the text string in the image. -@param fontFace Font type, see #HersheyFonts. -@param fontScale Font scale factor that is multiplied by the font-specific base size. -@param color Text color. -@param thickness Thickness of the lines used to draw a text. -@param lineType Line type. See #LineTypes -@param bottomLeftOrigin When true, the image data origin is at the bottom-left corner. Otherwise, -it is at the top-left corner. - */ -CV_EXPORTS_W void putText( InputOutputArray img, const String& text, Point org, - int fontFace, double fontScale, Scalar color, - int thickness = 1, int lineType = LINE_8, - bool bottomLeftOrigin = false ); - -/** @brief Calculates the width and height of a text string. - -The function cv::getTextSize calculates and returns the size of a box that contains the specified text. -That is, the following code renders some text, the tight box surrounding it, and the baseline: : -@code - String text = "Funny text inside the box"; - int fontFace = FONT_HERSHEY_SCRIPT_SIMPLEX; - double fontScale = 2; - int thickness = 3; - - Mat img(600, 800, CV_8UC3, Scalar::all(0)); - - int baseline=0; - Size textSize = getTextSize(text, fontFace, - fontScale, thickness, &baseline); - baseline += thickness; - - // center the text - Point textOrg((img.cols - textSize.width)/2, - (img.rows + textSize.height)/2); - - // draw the box - rectangle(img, textOrg + Point(0, baseline), - textOrg + Point(textSize.width, -textSize.height), - Scalar(0,0,255)); - // ... and the baseline first - line(img, textOrg + Point(0, thickness), - textOrg + Point(textSize.width, thickness), - Scalar(0, 0, 255)); - - // then put the text itself - putText(img, text, textOrg, fontFace, fontScale, - Scalar::all(255), thickness, 8); -@endcode - -@param text Input text string. -@param fontFace Font to use, see #HersheyFonts. -@param fontScale Font scale factor that is multiplied by the font-specific base size. -@param thickness Thickness of lines used to render the text. See #putText for details. -@param[out] baseLine y-coordinate of the baseline relative to the bottom-most text -point. -@return The size of a box that contains the specified text. - -@see putText - */ -CV_EXPORTS_W Size getTextSize(const String& text, int fontFace, - double fontScale, int thickness, - CV_OUT int* baseLine); - - -/** @brief Calculates the font-specific size to use to achieve a given height in pixels. - -@param fontFace Font to use, see cv::HersheyFonts. -@param pixelHeight Pixel height to compute the fontScale for -@param thickness Thickness of lines used to render the text.See putText for details. -@return The fontSize to use for cv::putText - -@see cv::putText -*/ -CV_EXPORTS_W double getFontScaleFromHeight(const int fontFace, - const int pixelHeight, - const int thickness = 1); - -/** @brief Line iterator - -The class is used to iterate over all the pixels on the raster line -segment connecting two specified points. - -The class LineIterator is used to get each pixel of a raster line. It -can be treated as versatile implementation of the Bresenham algorithm -where you can stop at each pixel and do some extra processing, for -example, grab pixel values along the line or draw a line with an effect -(for example, with XOR operation). - -The number of pixels along the line is stored in LineIterator::count. -The method LineIterator::pos returns the current position in the image: - -@code{.cpp} -// grabs pixels along the line (pt1, pt2) -// from 8-bit 3-channel image to the buffer -LineIterator it(img, pt1, pt2, 8); -LineIterator it2 = it; -vector buf(it.count); - -for(int i = 0; i < it.count; i++, ++it) - buf[i] = *(const Vec3b*)*it; - -// alternative way of iterating through the line -for(int i = 0; i < it2.count; i++, ++it2) -{ - Vec3b val = img.at(it2.pos()); - CV_Assert(buf[i] == val); -} -@endcode -*/ -class CV_EXPORTS LineIterator -{ -public: - /** @brief initializes the iterator - - creates iterators for the line connecting pt1 and pt2 - the line will be clipped on the image boundaries - the line is 8-connected or 4-connected - If leftToRight=true, then the iteration is always done - from the left-most point to the right most, - not to depend on the ordering of pt1 and pt2 parameters - */ - LineIterator( const Mat& img, Point pt1, Point pt2, - int connectivity = 8, bool leftToRight = false ); - /** @brief returns pointer to the current pixel - */ - uchar* operator *(); - /** @brief prefix increment operator (++it). shifts iterator to the next pixel - */ - LineIterator& operator ++(); - /** @brief postfix increment operator (it++). shifts iterator to the next pixel - */ - LineIterator operator ++(int); - /** @brief returns coordinates of the current pixel - */ - Point pos() const; - - uchar* ptr; - const uchar* ptr0; - int step, elemSize; - int err, count; - int minusDelta, plusDelta; - int minusStep, plusStep; -}; - -//! @cond IGNORED - -// === LineIterator implementation === - -inline -uchar* LineIterator::operator *() -{ - return ptr; -} - -inline -LineIterator& LineIterator::operator ++() -{ - int mask = err < 0 ? -1 : 0; - err += minusDelta + (plusDelta & mask); - ptr += minusStep + (plusStep & mask); - return *this; -} - -inline -LineIterator LineIterator::operator ++(int) -{ - LineIterator it = *this; - ++(*this); - return it; -} - -inline -Point LineIterator::pos() const -{ - Point p; - p.y = (int)((ptr - ptr0)/step); - p.x = (int)(((ptr - ptr0) - p.y*step)/elemSize); - return p; -} - -//! @endcond - -//! @} imgproc_draw - -//! @} imgproc - -} // cv - -#ifndef DISABLE_OPENCV_24_COMPATIBILITY -#include "opencv2/imgproc/imgproc_c.h" -#endif - -#endif diff --git a/opencv/include/opencv2/imgproc/detail/distortion_model.hpp b/opencv/include/opencv2/imgproc/detail/distortion_model.hpp deleted file mode 100644 index a9c3dde..0000000 --- a/opencv/include/opencv2/imgproc/detail/distortion_model.hpp +++ /dev/null @@ -1,123 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_IMGPROC_DETAIL_DISTORTION_MODEL_HPP -#define OPENCV_IMGPROC_DETAIL_DISTORTION_MODEL_HPP - -//! @cond IGNORED - -namespace cv { namespace detail { -/** -Computes the matrix for the projection onto a tilted image sensor -\param tauX angular parameter rotation around x-axis -\param tauY angular parameter rotation around y-axis -\param matTilt if not NULL returns the matrix -\f[ -\vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}((\tau_x, \tau_y)} -{0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)} -{0}{0}{1} R(\tau_x, \tau_y) -\f] -where -\f[ -R(\tau_x, \tau_y) = -\vecthreethree{\cos(\tau_y)}{0}{-\sin(\tau_y)}{0}{1}{0}{\sin(\tau_y)}{0}{\cos(\tau_y)} -\vecthreethree{1}{0}{0}{0}{\cos(\tau_x)}{\sin(\tau_x)}{0}{-\sin(\tau_x)}{\cos(\tau_x)} = -\vecthreethree{\cos(\tau_y)}{\sin(\tau_y)\sin(\tau_x)}{-\sin(\tau_y)\cos(\tau_x)} -{0}{\cos(\tau_x)}{\sin(\tau_x)} -{\sin(\tau_y)}{-\cos(\tau_y)\sin(\tau_x)}{\cos(\tau_y)\cos(\tau_x)}. -\f] -\param dMatTiltdTauX if not NULL it returns the derivative of matTilt with -respect to \f$\tau_x\f$. -\param dMatTiltdTauY if not NULL it returns the derivative of matTilt with -respect to \f$\tau_y\f$. -\param invMatTilt if not NULL it returns the inverse of matTilt -**/ -template -void computeTiltProjectionMatrix(FLOAT tauX, - FLOAT tauY, - Matx* matTilt = 0, - Matx* dMatTiltdTauX = 0, - Matx* dMatTiltdTauY = 0, - Matx* invMatTilt = 0) -{ - FLOAT cTauX = cos(tauX); - FLOAT sTauX = sin(tauX); - FLOAT cTauY = cos(tauY); - FLOAT sTauY = sin(tauY); - Matx matRotX = Matx(1,0,0,0,cTauX,sTauX,0,-sTauX,cTauX); - Matx matRotY = Matx(cTauY,0,-sTauY,0,1,0,sTauY,0,cTauY); - Matx matRotXY = matRotY * matRotX; - Matx matProjZ = Matx(matRotXY(2,2),0,-matRotXY(0,2),0,matRotXY(2,2),-matRotXY(1,2),0,0,1); - if (matTilt) - { - // Matrix for trapezoidal distortion of tilted image sensor - *matTilt = matProjZ * matRotXY; - } - if (dMatTiltdTauX) - { - // Derivative with respect to tauX - Matx dMatRotXYdTauX = matRotY * Matx(0,0,0,0,-sTauX,cTauX,0,-cTauX,-sTauX); - Matx dMatProjZdTauX = Matx(dMatRotXYdTauX(2,2),0,-dMatRotXYdTauX(0,2), - 0,dMatRotXYdTauX(2,2),-dMatRotXYdTauX(1,2),0,0,0); - *dMatTiltdTauX = (matProjZ * dMatRotXYdTauX) + (dMatProjZdTauX * matRotXY); - } - if (dMatTiltdTauY) - { - // Derivative with respect to tauY - Matx dMatRotXYdTauY = Matx(-sTauY,0,-cTauY,0,0,0,cTauY,0,-sTauY) * matRotX; - Matx dMatProjZdTauY = Matx(dMatRotXYdTauY(2,2),0,-dMatRotXYdTauY(0,2), - 0,dMatRotXYdTauY(2,2),-dMatRotXYdTauY(1,2),0,0,0); - *dMatTiltdTauY = (matProjZ * dMatRotXYdTauY) + (dMatProjZdTauY * matRotXY); - } - if (invMatTilt) - { - FLOAT inv = 1./matRotXY(2,2); - Matx invMatProjZ = Matx(inv,0,inv*matRotXY(0,2),0,inv,inv*matRotXY(1,2),0,0,1); - *invMatTilt = matRotXY.t()*invMatProjZ; - } -} -}} // namespace detail, cv - - -//! @endcond - -#endif // OPENCV_IMGPROC_DETAIL_DISTORTION_MODEL_HPP diff --git a/opencv/include/opencv2/imgproc/hal/hal.hpp b/opencv/include/opencv2/imgproc/hal/hal.hpp deleted file mode 100644 index a435fd6..0000000 --- a/opencv/include/opencv2/imgproc/hal/hal.hpp +++ /dev/null @@ -1,241 +0,0 @@ -#ifndef CV_IMGPROC_HAL_HPP -#define CV_IMGPROC_HAL_HPP - -#include "opencv2/core/cvdef.h" -#include "opencv2/core/cvstd.hpp" -#include "opencv2/core/hal/interface.h" - -namespace cv { namespace hal { - -//! @addtogroup imgproc_hal_functions -//! @{ - -//--------------------------- -//! @cond IGNORED - -struct CV_EXPORTS Filter2D -{ - CV_DEPRECATED static Ptr create(uchar * , size_t , int , - int , int , - int , int , - int , int , - int , double , - int , int , - bool , bool ); - virtual void apply(uchar * , size_t , - uchar * , size_t , - int , int , - int , int , - int , int ) = 0; - virtual ~Filter2D() {} -}; - -struct CV_EXPORTS SepFilter2D -{ - CV_DEPRECATED static Ptr create(int , int , int , - uchar * , int , - uchar * , int , - int , int , - double , int ); - virtual void apply(uchar * , size_t , - uchar * , size_t , - int , int , - int , int , - int , int ) = 0; - virtual ~SepFilter2D() {} -}; - - -struct CV_EXPORTS Morph -{ - CV_DEPRECATED static Ptr create(int , int , int , int , int , - int , uchar * , size_t , - int , int , - int , int , - int , const double *, - int , bool , bool ); - virtual void apply(uchar * , size_t , uchar * , size_t , int , int , - int , int , int , int , - int , int , int , int ) = 0; - virtual ~Morph() {} -}; - -//! @endcond -//--------------------------- - -CV_EXPORTS void filter2D(int stype, int dtype, int kernel_type, - uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int full_width, int full_height, - int offset_x, int offset_y, - uchar * kernel_data, size_t kernel_step, - int kernel_width, int kernel_height, - int anchor_x, int anchor_y, - double delta, int borderType, - bool isSubmatrix); - -CV_EXPORTS void sepFilter2D(int stype, int dtype, int ktype, - uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int full_width, int full_height, - int offset_x, int offset_y, - uchar * kernelx_data, int kernelx_len, - uchar * kernely_data, int kernely_len, - int anchor_x, int anchor_y, - double delta, int borderType); - -CV_EXPORTS void morph(int op, int src_type, int dst_type, - uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int roi_width, int roi_height, int roi_x, int roi_y, - int roi_width2, int roi_height2, int roi_x2, int roi_y2, - int kernel_type, uchar * kernel_data, size_t kernel_step, - int kernel_width, int kernel_height, int anchor_x, int anchor_y, - int borderType, const double borderValue[4], - int iterations, bool isSubmatrix); - - -CV_EXPORTS void resize(int src_type, - const uchar * src_data, size_t src_step, int src_width, int src_height, - uchar * dst_data, size_t dst_step, int dst_width, int dst_height, - double inv_scale_x, double inv_scale_y, int interpolation); - -CV_EXPORTS void warpAffine(int src_type, - const uchar * src_data, size_t src_step, int src_width, int src_height, - uchar * dst_data, size_t dst_step, int dst_width, int dst_height, - const double M[6], int interpolation, int borderType, const double borderValue[4]); - -CV_EXPORTS void warpPerspectve(int src_type, - const uchar * src_data, size_t src_step, int src_width, int src_height, - uchar * dst_data, size_t dst_step, int dst_width, int dst_height, - const double M[9], int interpolation, int borderType, const double borderValue[4]); - -CV_EXPORTS void cvtBGRtoBGR(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int depth, int scn, int dcn, bool swapBlue); - -CV_EXPORTS void cvtBGRtoBGR5x5(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int scn, bool swapBlue, int greenBits); - -CV_EXPORTS void cvtBGR5x5toBGR(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int dcn, bool swapBlue, int greenBits); - -CV_EXPORTS void cvtBGRtoGray(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int depth, int scn, bool swapBlue); - -CV_EXPORTS void cvtGraytoBGR(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int depth, int dcn); - -CV_EXPORTS void cvtBGR5x5toGray(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int greenBits); - -CV_EXPORTS void cvtGraytoBGR5x5(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int greenBits); -CV_EXPORTS void cvtBGRtoYUV(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int depth, int scn, bool swapBlue, bool isCbCr); - -CV_EXPORTS void cvtYUVtoBGR(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int depth, int dcn, bool swapBlue, bool isCbCr); - -CV_EXPORTS void cvtBGRtoXYZ(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int depth, int scn, bool swapBlue); - -CV_EXPORTS void cvtXYZtoBGR(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int depth, int dcn, bool swapBlue); - -CV_EXPORTS void cvtBGRtoHSV(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int depth, int scn, bool swapBlue, bool isFullRange, bool isHSV); - -CV_EXPORTS void cvtHSVtoBGR(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int depth, int dcn, bool swapBlue, bool isFullRange, bool isHSV); - -CV_EXPORTS void cvtBGRtoLab(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int depth, int scn, bool swapBlue, bool isLab, bool srgb); - -CV_EXPORTS void cvtLabtoBGR(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int depth, int dcn, bool swapBlue, bool isLab, bool srgb); - -CV_EXPORTS void cvtTwoPlaneYUVtoBGR(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int dst_width, int dst_height, - int dcn, bool swapBlue, int uIdx); - -//! Separate Y and UV planes -CV_EXPORTS void cvtTwoPlaneYUVtoBGR(const uchar * y_data, const uchar * uv_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int dst_width, int dst_height, - int dcn, bool swapBlue, int uIdx); - -CV_EXPORTS void cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int dst_width, int dst_height, - int dcn, bool swapBlue, int uIdx); - -CV_EXPORTS void cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int scn, bool swapBlue, int uIdx); - -//! Separate Y and UV planes -CV_EXPORTS void cvtBGRtoTwoPlaneYUV(const uchar * src_data, size_t src_step, - uchar * y_data, uchar * uv_data, size_t dst_step, - int width, int height, - int scn, bool swapBlue, int uIdx); - -CV_EXPORTS void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height, - int dcn, bool swapBlue, int uIdx, int ycn); - -CV_EXPORTS void cvtRGBAtoMultipliedRGBA(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height); - -CV_EXPORTS void cvtMultipliedRGBAtoRGBA(const uchar * src_data, size_t src_step, - uchar * dst_data, size_t dst_step, - int width, int height); - -CV_EXPORTS void integral(int depth, int sdepth, int sqdepth, - const uchar* src, size_t srcstep, - uchar* sum, size_t sumstep, - uchar* sqsum, size_t sqsumstep, - uchar* tilted, size_t tstep, - int width, int height, int cn); - -//! @} - -}} - -#endif // CV_IMGPROC_HAL_HPP diff --git a/opencv/include/opencv2/imgproc/hal/interface.h b/opencv/include/opencv2/imgproc/hal/interface.h deleted file mode 100644 index f8dbcfe..0000000 --- a/opencv/include/opencv2/imgproc/hal/interface.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef OPENCV_IMGPROC_HAL_INTERFACE_H -#define OPENCV_IMGPROC_HAL_INTERFACE_H - -//! @addtogroup imgproc_hal_interface -//! @{ - -//! @name Interpolation modes -//! @sa cv::InterpolationFlags -//! @{ -#define CV_HAL_INTER_NEAREST 0 -#define CV_HAL_INTER_LINEAR 1 -#define CV_HAL_INTER_CUBIC 2 -#define CV_HAL_INTER_AREA 3 -#define CV_HAL_INTER_LANCZOS4 4 -//! @} - -//! @name Morphology operations -//! @sa cv::MorphTypes -//! @{ -#define CV_HAL_MORPH_ERODE 0 -#define CV_HAL_MORPH_DILATE 1 -//! @} - -//! @name Threshold types -//! @sa cv::ThresholdTypes -//! @{ -#define CV_HAL_THRESH_BINARY 0 -#define CV_HAL_THRESH_BINARY_INV 1 -#define CV_HAL_THRESH_TRUNC 2 -#define CV_HAL_THRESH_TOZERO 3 -#define CV_HAL_THRESH_TOZERO_INV 4 -#define CV_HAL_THRESH_MASK 7 -#define CV_HAL_THRESH_OTSU 8 -#define CV_HAL_THRESH_TRIANGLE 16 -//! @} - -//! @name Adaptive threshold algorithm -//! @sa cv::AdaptiveThresholdTypes -//! @{ -#define CV_HAL_ADAPTIVE_THRESH_MEAN_C 0 -#define CV_HAL_ADAPTIVE_THRESH_GAUSSIAN_C 1 -//! @} - -//! @} - -#endif diff --git a/opencv/include/opencv2/imgproc/imgproc.hpp b/opencv/include/opencv2/imgproc/imgproc.hpp deleted file mode 100644 index 4175bd0..0000000 --- a/opencv/include/opencv2/imgproc/imgproc.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/imgproc.hpp" diff --git a/opencv/include/opencv2/imgproc/imgproc_c.h b/opencv/include/opencv2/imgproc/imgproc_c.h deleted file mode 100644 index cec0f36..0000000 --- a/opencv/include/opencv2/imgproc/imgproc_c.h +++ /dev/null @@ -1,1210 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_IMGPROC_IMGPROC_C_H -#define OPENCV_IMGPROC_IMGPROC_C_H - -#include "opencv2/imgproc/types_c.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup imgproc_c -@{ -*/ - -/*********************** Background statistics accumulation *****************************/ - -/** @brief Adds image to accumulator -@see cv::accumulate -*/ -CVAPI(void) cvAcc( const CvArr* image, CvArr* sum, - const CvArr* mask CV_DEFAULT(NULL) ); - -/** @brief Adds squared image to accumulator -@see cv::accumulateSquare -*/ -CVAPI(void) cvSquareAcc( const CvArr* image, CvArr* sqsum, - const CvArr* mask CV_DEFAULT(NULL) ); - -/** @brief Adds a product of two images to accumulator -@see cv::accumulateProduct -*/ -CVAPI(void) cvMultiplyAcc( const CvArr* image1, const CvArr* image2, CvArr* acc, - const CvArr* mask CV_DEFAULT(NULL) ); - -/** @brief Adds image to accumulator with weights: acc = acc*(1-alpha) + image*alpha -@see cv::accumulateWeighted -*/ -CVAPI(void) cvRunningAvg( const CvArr* image, CvArr* acc, double alpha, - const CvArr* mask CV_DEFAULT(NULL) ); - -/****************************************************************************************\ -* Image Processing * -\****************************************************************************************/ - -/** Copies source 2D array inside of the larger destination array and - makes a border of the specified type (IPL_BORDER_*) around the copied area. */ -CVAPI(void) cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset, - int bordertype, CvScalar value CV_DEFAULT(cvScalarAll(0))); - -/** @brief Smooths the image in one of several ways. - -@param src The source image -@param dst The destination image -@param smoothtype Type of the smoothing, see SmoothMethod_c -@param size1 The first parameter of the smoothing operation, the aperture width. Must be a -positive odd number (1, 3, 5, ...) -@param size2 The second parameter of the smoothing operation, the aperture height. Ignored by -CV_MEDIAN and CV_BILATERAL methods. In the case of simple scaled/non-scaled and Gaussian blur if -size2 is zero, it is set to size1. Otherwise it must be a positive odd number. -@param sigma1 In the case of a Gaussian parameter this parameter may specify Gaussian \f$\sigma\f$ -(standard deviation). If it is zero, it is calculated from the kernel size: -\f[\sigma = 0.3 (n/2 - 1) + 0.8 \quad \text{where} \quad n= \begin{array}{l l} \mbox{\texttt{size1} for horizontal kernel} \\ \mbox{\texttt{size2} for vertical kernel} \end{array}\f] -Using standard sigma for small kernels ( \f$3\times 3\f$ to \f$7\times 7\f$ ) gives better speed. If -sigma1 is not zero, while size1 and size2 are zeros, the kernel size is calculated from the -sigma (to provide accurate enough operation). -@param sigma2 additional parameter for bilateral filtering - -@see cv::GaussianBlur, cv::blur, cv::medianBlur, cv::bilateralFilter. - */ -CVAPI(void) cvSmooth( const CvArr* src, CvArr* dst, - int smoothtype CV_DEFAULT(CV_GAUSSIAN), - int size1 CV_DEFAULT(3), - int size2 CV_DEFAULT(0), - double sigma1 CV_DEFAULT(0), - double sigma2 CV_DEFAULT(0)); - -/** @brief Convolves an image with the kernel. - -@param src input image. -@param dst output image of the same size and the same number of channels as src. -@param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point -matrix; if you want to apply different kernels to different channels, split the image into -separate color planes using split and process them individually. -@param anchor anchor of the kernel that indicates the relative position of a filtered point within -the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor -is at the kernel center. - -@see cv::filter2D - */ -CVAPI(void) cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel, - CvPoint anchor CV_DEFAULT(cvPoint(-1,-1))); - -/** @brief Finds integral image: SUM(X,Y) = sum(x \texttt{hist1}(I)\)}{\frac{\texttt{hist2}(I) \cdot \texttt{scale}}{\texttt{hist1}(I)}}{if \(\texttt{hist1}(I) \ne 0\) and \(\texttt{hist2}(I) \le \texttt{hist1}(I)\)}\f] - -@param hist1 First histogram (the divisor). -@param hist2 Second histogram. -@param dst_hist Destination histogram. -@param scale Scale factor for the destination histogram. - */ -CVAPI(void) cvCalcProbDensity( const CvHistogram* hist1, const CvHistogram* hist2, - CvHistogram* dst_hist, double scale CV_DEFAULT(255) ); - -/** @brief equalizes histogram of 8-bit single-channel image -@see cv::equalizeHist -*/ -CVAPI(void) cvEqualizeHist( const CvArr* src, CvArr* dst ); - - -/** @brief Applies distance transform to binary image -@see cv::distanceTransform -*/ -CVAPI(void) cvDistTransform( const CvArr* src, CvArr* dst, - int distance_type CV_DEFAULT(CV_DIST_L2), - int mask_size CV_DEFAULT(3), - const float* mask CV_DEFAULT(NULL), - CvArr* labels CV_DEFAULT(NULL), - int labelType CV_DEFAULT(CV_DIST_LABEL_CCOMP)); - - -/** @brief Applies fixed-level threshold to grayscale image. - - This is a basic operation applied before retrieving contours -@see cv::threshold -*/ -CVAPI(double) cvThreshold( const CvArr* src, CvArr* dst, - double threshold, double max_value, - int threshold_type ); - -/** @brief Applies adaptive threshold to grayscale image. - - The two parameters for methods CV_ADAPTIVE_THRESH_MEAN_C and - CV_ADAPTIVE_THRESH_GAUSSIAN_C are: - neighborhood size (3, 5, 7 etc.), - and a constant subtracted from mean (...,-3,-2,-1,0,1,2,3,...) -@see cv::adaptiveThreshold -*/ -CVAPI(void) cvAdaptiveThreshold( const CvArr* src, CvArr* dst, double max_value, - int adaptive_method CV_DEFAULT(CV_ADAPTIVE_THRESH_MEAN_C), - int threshold_type CV_DEFAULT(CV_THRESH_BINARY), - int block_size CV_DEFAULT(3), - double param1 CV_DEFAULT(5)); - -/** @brief Fills the connected component until the color difference gets large enough -@see cv::floodFill -*/ -CVAPI(void) cvFloodFill( CvArr* image, CvPoint seed_point, - CvScalar new_val, CvScalar lo_diff CV_DEFAULT(cvScalarAll(0)), - CvScalar up_diff CV_DEFAULT(cvScalarAll(0)), - CvConnectedComp* comp CV_DEFAULT(NULL), - int flags CV_DEFAULT(4), - CvArr* mask CV_DEFAULT(NULL)); - -/****************************************************************************************\ -* Feature detection * -\****************************************************************************************/ - -/** @brief Runs canny edge detector -@see cv::Canny -*/ -CVAPI(void) cvCanny( const CvArr* image, CvArr* edges, double threshold1, - double threshold2, int aperture_size CV_DEFAULT(3) ); - -/** @brief Calculates constraint image for corner detection - - Dx^2 * Dyy + Dxx * Dy^2 - 2 * Dx * Dy * Dxy. - Applying threshold to the result gives coordinates of corners -@see cv::preCornerDetect -*/ -CVAPI(void) cvPreCornerDetect( const CvArr* image, CvArr* corners, - int aperture_size CV_DEFAULT(3) ); - -/** @brief Calculates eigen values and vectors of 2x2 - gradient covariation matrix at every image pixel -@see cv::cornerEigenValsAndVecs -*/ -CVAPI(void) cvCornerEigenValsAndVecs( const CvArr* image, CvArr* eigenvv, - int block_size, int aperture_size CV_DEFAULT(3) ); - -/** @brief Calculates minimal eigenvalue for 2x2 gradient covariation matrix at - every image pixel -@see cv::cornerMinEigenVal -*/ -CVAPI(void) cvCornerMinEigenVal( const CvArr* image, CvArr* eigenval, - int block_size, int aperture_size CV_DEFAULT(3) ); - -/** @brief Harris corner detector: - - Calculates det(M) - k*(trace(M)^2), where M is 2x2 gradient covariation matrix for each pixel -@see cv::cornerHarris -*/ -CVAPI(void) cvCornerHarris( const CvArr* image, CvArr* harris_response, - int block_size, int aperture_size CV_DEFAULT(3), - double k CV_DEFAULT(0.04) ); - -/** @brief Adjust corner position using some sort of gradient search -@see cv::cornerSubPix -*/ -CVAPI(void) cvFindCornerSubPix( const CvArr* image, CvPoint2D32f* corners, - int count, CvSize win, CvSize zero_zone, - CvTermCriteria criteria ); - -/** @brief Finds a sparse set of points within the selected region - that seem to be easy to track -@see cv::goodFeaturesToTrack -*/ -CVAPI(void) cvGoodFeaturesToTrack( const CvArr* image, CvArr* eig_image, - CvArr* temp_image, CvPoint2D32f* corners, - int* corner_count, double quality_level, - double min_distance, - const CvArr* mask CV_DEFAULT(NULL), - int block_size CV_DEFAULT(3), - int use_harris CV_DEFAULT(0), - double k CV_DEFAULT(0.04) ); - -/** @brief Finds lines on binary image using one of several methods. - - line_storage is either memory storage or 1 x _max number of lines_ CvMat, its - number of columns is changed by the function. - method is one of CV_HOUGH_*; - rho, theta and threshold are used for each of those methods; - param1 ~ line length, param2 ~ line gap - for probabilistic, - param1 ~ srn, param2 ~ stn - for multi-scale -@see cv::HoughLines -*/ -CVAPI(CvSeq*) cvHoughLines2( CvArr* image, void* line_storage, int method, - double rho, double theta, int threshold, - double param1 CV_DEFAULT(0), double param2 CV_DEFAULT(0), - double min_theta CV_DEFAULT(0), double max_theta CV_DEFAULT(CV_PI)); - -/** @brief Finds circles in the image -@see cv::HoughCircles -*/ -CVAPI(CvSeq*) cvHoughCircles( CvArr* image, void* circle_storage, - int method, double dp, double min_dist, - double param1 CV_DEFAULT(100), - double param2 CV_DEFAULT(100), - int min_radius CV_DEFAULT(0), - int max_radius CV_DEFAULT(0)); - -/** @brief Fits a line into set of 2d or 3d points in a robust way (M-estimator technique) -@see cv::fitLine -*/ -CVAPI(void) cvFitLine( const CvArr* points, int dist_type, double param, - double reps, double aeps, float* line ); - -/****************************************************************************************\ -* Drawing * -\****************************************************************************************/ - -/****************************************************************************************\ -* Drawing functions work with images/matrices of arbitrary type. * -* For color images the channel order is BGR[A] * -* Antialiasing is supported only for 8-bit image now. * -* All the functions include parameter color that means rgb value (that may be * -* constructed with CV_RGB macro) for color images and brightness * -* for grayscale images. * -* If a drawn figure is partially or completely outside of the image, it is clipped.* -\****************************************************************************************/ - -#define CV_FILLED -1 - -#define CV_AA 16 - -/** @brief Draws 4-connected, 8-connected or antialiased line segment connecting two points -@see cv::line -*/ -CVAPI(void) cvLine( CvArr* img, CvPoint pt1, CvPoint pt2, - CvScalar color, int thickness CV_DEFAULT(1), - int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) ); - -/** @brief Draws a rectangle given two opposite corners of the rectangle (pt1 & pt2) - - if thickness<0 (e.g. thickness == CV_FILLED), the filled box is drawn -@see cv::rectangle -*/ -CVAPI(void) cvRectangle( CvArr* img, CvPoint pt1, CvPoint pt2, - CvScalar color, int thickness CV_DEFAULT(1), - int line_type CV_DEFAULT(8), - int shift CV_DEFAULT(0)); - -/** @brief Draws a rectangle specified by a CvRect structure -@see cv::rectangle -*/ -CVAPI(void) cvRectangleR( CvArr* img, CvRect r, - CvScalar color, int thickness CV_DEFAULT(1), - int line_type CV_DEFAULT(8), - int shift CV_DEFAULT(0)); - - -/** @brief Draws a circle with specified center and radius. - - Thickness works in the same way as with cvRectangle -@see cv::circle -*/ -CVAPI(void) cvCircle( CvArr* img, CvPoint center, int radius, - CvScalar color, int thickness CV_DEFAULT(1), - int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0)); - -/** @brief Draws ellipse outline, filled ellipse, elliptic arc or filled elliptic sector - - depending on _thickness_, _start_angle_ and _end_angle_ parameters. The resultant figure - is rotated by _angle_. All the angles are in degrees -@see cv::ellipse -*/ -CVAPI(void) cvEllipse( CvArr* img, CvPoint center, CvSize axes, - double angle, double start_angle, double end_angle, - CvScalar color, int thickness CV_DEFAULT(1), - int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0)); - -CV_INLINE void cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color, - int thickness CV_DEFAULT(1), - int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) ) -{ - CvSize axes = cvSize( - cvRound(box.size.width*0.5), - cvRound(box.size.height*0.5) - ); - - cvEllipse( img, cvPointFrom32f( box.center ), axes, box.angle, - 0, 360, color, thickness, line_type, shift ); -} - -/** @brief Fills convex or monotonous polygon. -@see cv::fillConvexPoly -*/ -CVAPI(void) cvFillConvexPoly( CvArr* img, const CvPoint* pts, int npts, CvScalar color, - int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0)); - -/** @brief Fills an area bounded by one or more arbitrary polygons -@see cv::fillPoly -*/ -CVAPI(void) cvFillPoly( CvArr* img, CvPoint** pts, const int* npts, - int contours, CvScalar color, - int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) ); - -/** @brief Draws one or more polygonal curves -@see cv::polylines -*/ -CVAPI(void) cvPolyLine( CvArr* img, CvPoint** pts, const int* npts, int contours, - int is_closed, CvScalar color, int thickness CV_DEFAULT(1), - int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) ); - -#define cvDrawRect cvRectangle -#define cvDrawLine cvLine -#define cvDrawCircle cvCircle -#define cvDrawEllipse cvEllipse -#define cvDrawPolyLine cvPolyLine - -/** @brief Clips the line segment connecting *pt1 and *pt2 - by the rectangular window - - (0<=xptr will point to pt1 (or pt2, see left_to_right description) location in -the image. Returns the number of pixels on the line between the ending points. -@see cv::LineIterator -*/ -CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2, - CvLineIterator* line_iterator, - int connectivity CV_DEFAULT(8), - int left_to_right CV_DEFAULT(0)); - -#define CV_NEXT_LINE_POINT( line_iterator ) \ -{ \ - int _line_iterator_mask = (line_iterator).err < 0 ? -1 : 0; \ - (line_iterator).err += (line_iterator).minus_delta + \ - ((line_iterator).plus_delta & _line_iterator_mask); \ - (line_iterator).ptr += (line_iterator).minus_step + \ - ((line_iterator).plus_step & _line_iterator_mask); \ -} - - -#define CV_FONT_HERSHEY_SIMPLEX 0 -#define CV_FONT_HERSHEY_PLAIN 1 -#define CV_FONT_HERSHEY_DUPLEX 2 -#define CV_FONT_HERSHEY_COMPLEX 3 -#define CV_FONT_HERSHEY_TRIPLEX 4 -#define CV_FONT_HERSHEY_COMPLEX_SMALL 5 -#define CV_FONT_HERSHEY_SCRIPT_SIMPLEX 6 -#define CV_FONT_HERSHEY_SCRIPT_COMPLEX 7 - -#define CV_FONT_ITALIC 16 - -#define CV_FONT_VECTOR0 CV_FONT_HERSHEY_SIMPLEX - - -/** Font structure */ -typedef struct CvFont -{ - const char* nameFont; //Qt:nameFont - CvScalar color; //Qt:ColorFont -> cvScalar(blue_component, green_component, red_component[, alpha_component]) - int font_face; //Qt: bool italic /** =CV_FONT_* */ - const int* ascii; //!< font data and metrics - const int* greek; - const int* cyrillic; - float hscale, vscale; - float shear; //!< slope coefficient: 0 - normal, >0 - italic - int thickness; //!< Qt: weight /** letters thickness */ - float dx; //!< horizontal interval between letters - int line_type; //!< Qt: PointSize -} -CvFont; - -/** @brief Initializes font structure (OpenCV 1.x API). - -The function initializes the font structure that can be passed to text rendering functions. - -@param font Pointer to the font structure initialized by the function -@param font_face Font name identifier. See cv::HersheyFonts and corresponding old CV_* identifiers. -@param hscale Horizontal scale. If equal to 1.0f , the characters have the original width -depending on the font type. If equal to 0.5f , the characters are of half the original width. -@param vscale Vertical scale. If equal to 1.0f , the characters have the original height depending -on the font type. If equal to 0.5f , the characters are of half the original height. -@param shear Approximate tangent of the character slope relative to the vertical line. A zero -value means a non-italic font, 1.0f means about a 45 degree slope, etc. -@param thickness Thickness of the text strokes -@param line_type Type of the strokes, see line description - -@sa cvPutText - */ -CVAPI(void) cvInitFont( CvFont* font, int font_face, - double hscale, double vscale, - double shear CV_DEFAULT(0), - int thickness CV_DEFAULT(1), - int line_type CV_DEFAULT(8)); - -CV_INLINE CvFont cvFont( double scale, int thickness CV_DEFAULT(1) ) -{ - CvFont font; - cvInitFont( &font, CV_FONT_HERSHEY_PLAIN, scale, scale, 0, thickness, CV_AA ); - return font; -} - -/** @brief Renders text stroke with specified font and color at specified location. - CvFont should be initialized with cvInitFont -@see cvInitFont, cvGetTextSize, cvFont, cv::putText -*/ -CVAPI(void) cvPutText( CvArr* img, const char* text, CvPoint org, - const CvFont* font, CvScalar color ); - -/** @brief Calculates bounding box of text stroke (useful for alignment) -@see cv::getTextSize -*/ -CVAPI(void) cvGetTextSize( const char* text_string, const CvFont* font, - CvSize* text_size, int* baseline ); - -/** @brief Unpacks color value - -if arrtype is CV_8UC?, _color_ is treated as packed color value, otherwise the first channels -(depending on arrtype) of destination scalar are set to the same value = _color_ -*/ -CVAPI(CvScalar) cvColorToScalar( double packed_color, int arrtype ); - -/** @brief Returns the polygon points which make up the given ellipse. - -The ellipse is define by the box of size 'axes' rotated 'angle' around the 'center'. A partial -sweep of the ellipse arc can be done by spcifying arc_start and arc_end to be something other than -0 and 360, respectively. The input array 'pts' must be large enough to hold the result. The total -number of points stored into 'pts' is returned by this function. -@see cv::ellipse2Poly -*/ -CVAPI(int) cvEllipse2Poly( CvPoint center, CvSize axes, - int angle, int arc_start, int arc_end, CvPoint * pts, int delta ); - -/** @brief Draws contour outlines or filled interiors on the image -@see cv::drawContours -*/ -CVAPI(void) cvDrawContours( CvArr *img, CvSeq* contour, - CvScalar external_color, CvScalar hole_color, - int max_level, int thickness CV_DEFAULT(1), - int line_type CV_DEFAULT(8), - CvPoint offset CV_DEFAULT(cvPoint(0,0))); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/opencv/include/opencv2/imgproc/types_c.h b/opencv/include/opencv2/imgproc/types_c.h deleted file mode 100644 index d3e55f5..0000000 --- a/opencv/include/opencv2/imgproc/types_c.h +++ /dev/null @@ -1,659 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_IMGPROC_TYPES_C_H -#define OPENCV_IMGPROC_TYPES_C_H - -#include "opencv2/core/core_c.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup imgproc_c - @{ -*/ - -/** Connected component structure */ -typedef struct CvConnectedComp -{ - double area; /** DBL_EPSILON ? 1./std::sqrt(am00) : 0; - } - operator cv::Moments() const - { - return cv::Moments(m00, m10, m01, m20, m11, m02, m30, m21, m12, m03); - } -#endif -} -CvMoments; - -#ifdef __cplusplus -} // extern "C" - -CV_INLINE CvMoments cvMoments() -{ -#if !defined(CV__ENABLE_C_API_CTORS) - CvMoments self = CV_STRUCT_INITIALIZER; return self; -#else - return CvMoments(); -#endif -} - -CV_INLINE CvMoments cvMoments(const cv::Moments& m) -{ -#if !defined(CV__ENABLE_C_API_CTORS) - double am00 = std::abs(m.m00); - CvMoments self = { - m.m00, m.m10, m.m01, m.m20, m.m11, m.m02, m.m30, m.m21, m.m12, m.m03, - m.mu20, m.mu11, m.mu02, m.mu30, m.mu21, m.mu12, m.mu03, - am00 > DBL_EPSILON ? 1./std::sqrt(am00) : 0 - }; - return self; -#else - return CvMoments(m); -#endif -} - -extern "C" { -#endif // __cplusplus - -/** Hu invariants */ -typedef struct CvHuMoments -{ - double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /**< Hu invariants */ -} -CvHuMoments; - -/** Template matching methods */ -enum -{ - CV_TM_SQDIFF =0, - CV_TM_SQDIFF_NORMED =1, - CV_TM_CCORR =2, - CV_TM_CCORR_NORMED =3, - CV_TM_CCOEFF =4, - CV_TM_CCOEFF_NORMED =5 -}; - -typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* user_param ); - -/** Contour retrieval modes */ -enum -{ - CV_RETR_EXTERNAL=0, - CV_RETR_LIST=1, - CV_RETR_CCOMP=2, - CV_RETR_TREE=3, - CV_RETR_FLOODFILL=4 -}; - -/** Contour approximation methods */ -enum -{ - CV_CHAIN_CODE=0, - CV_CHAIN_APPROX_NONE=1, - CV_CHAIN_APPROX_SIMPLE=2, - CV_CHAIN_APPROX_TC89_L1=3, - CV_CHAIN_APPROX_TC89_KCOS=4, - CV_LINK_RUNS=5 -}; - -/* -Internal structure that is used for sequential retrieving contours from the image. -It supports both hierarchical and plane variants of Suzuki algorithm. -*/ -typedef struct _CvContourScanner* CvContourScanner; - -/** Freeman chain reader state */ -typedef struct CvChainPtReader -{ - CV_SEQ_READER_FIELDS() - char code; - CvPoint pt; - schar deltas[8][2]; -} -CvChainPtReader; - -/** initializes 8-element array for fast access to 3x3 neighborhood of a pixel */ -#define CV_INIT_3X3_DELTAS( deltas, step, nch ) \ - ((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \ - (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch), \ - (deltas)[4] = -(nch), (deltas)[5] = (step) - (nch), \ - (deltas)[6] = (step), (deltas)[7] = (step) + (nch)) - - -/** Contour approximation algorithms */ -enum -{ - CV_POLY_APPROX_DP = 0 -}; - -/** Shape matching methods */ -enum -{ - CV_CONTOURS_MATCH_I1 =1, //!< \f[I_1(A,B) = \sum _{i=1...7} \left | \frac{1}{m^A_i} - \frac{1}{m^B_i} \right |\f] - CV_CONTOURS_MATCH_I2 =2, //!< \f[I_2(A,B) = \sum _{i=1...7} \left | m^A_i - m^B_i \right |\f] - CV_CONTOURS_MATCH_I3 =3 //!< \f[I_3(A,B) = \max _{i=1...7} \frac{ \left| m^A_i - m^B_i \right| }{ \left| m^A_i \right| }\f] -}; - -/** Shape orientation */ -enum -{ - CV_CLOCKWISE =1, - CV_COUNTER_CLOCKWISE =2 -}; - - -/** Convexity defect */ -typedef struct CvConvexityDefect -{ - CvPoint* start; /**< point of the contour where the defect begins */ - CvPoint* end; /**< point of the contour where the defect ends */ - CvPoint* depth_point; /**< the farthest from the convex hull point within the defect */ - float depth; /**< distance between the farthest point and the convex hull */ -} CvConvexityDefect; - - -/** Histogram comparison methods */ -enum -{ - CV_COMP_CORREL =0, - CV_COMP_CHISQR =1, - CV_COMP_INTERSECT =2, - CV_COMP_BHATTACHARYYA =3, - CV_COMP_HELLINGER =CV_COMP_BHATTACHARYYA, - CV_COMP_CHISQR_ALT =4, - CV_COMP_KL_DIV =5 -}; - -/** Mask size for distance transform */ -enum -{ - CV_DIST_MASK_3 =3, - CV_DIST_MASK_5 =5, - CV_DIST_MASK_PRECISE =0 -}; - -/** Content of output label array: connected components or pixels */ -enum -{ - CV_DIST_LABEL_CCOMP = 0, - CV_DIST_LABEL_PIXEL = 1 -}; - -/** Distance types for Distance Transform and M-estimators */ -enum -{ - CV_DIST_USER =-1, /**< User defined distance */ - CV_DIST_L1 =1, /**< distance = |x1-x2| + |y1-y2| */ - CV_DIST_L2 =2, /**< the simple euclidean distance */ - CV_DIST_C =3, /**< distance = max(|x1-x2|,|y1-y2|) */ - CV_DIST_L12 =4, /**< L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */ - CV_DIST_FAIR =5, /**< distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */ - CV_DIST_WELSCH =6, /**< distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */ - CV_DIST_HUBER =7 /**< distance = |x| threshold ? max_value : 0 */ - CV_THRESH_BINARY_INV =1, /**< value = value > threshold ? 0 : max_value */ - CV_THRESH_TRUNC =2, /**< value = value > threshold ? threshold : value */ - CV_THRESH_TOZERO =3, /**< value = value > threshold ? value : 0 */ - CV_THRESH_TOZERO_INV =4, /**< value = value > threshold ? 0 : value */ - CV_THRESH_MASK =7, - CV_THRESH_OTSU =8, /**< use Otsu algorithm to choose the optimal threshold value; - combine the flag with one of the above CV_THRESH_* values */ - CV_THRESH_TRIANGLE =16 /**< use Triangle algorithm to choose the optimal threshold value; - combine the flag with one of the above CV_THRESH_* values, but not - with CV_THRESH_OTSU */ -}; - -/** Adaptive threshold methods */ -enum -{ - CV_ADAPTIVE_THRESH_MEAN_C =0, - CV_ADAPTIVE_THRESH_GAUSSIAN_C =1 -}; - -/** FloodFill flags */ -enum -{ - CV_FLOODFILL_FIXED_RANGE =(1 << 16), - CV_FLOODFILL_MASK_ONLY =(1 << 17) -}; - - -/** Canny edge detector flags */ -enum -{ - CV_CANNY_L2_GRADIENT =(1 << 31) -}; - -/** Variants of a Hough transform */ -enum -{ - CV_HOUGH_STANDARD =0, - CV_HOUGH_PROBABILISTIC =1, - CV_HOUGH_MULTI_SCALE =2, - CV_HOUGH_GRADIENT =3 -}; - - -/* Fast search data structures */ -struct CvFeatureTree; -struct CvLSH; -struct CvLSHOperations; - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/opencv/include/opencv2/ml.hpp b/opencv/include/opencv2/ml.hpp deleted file mode 100644 index 5348206..0000000 --- a/opencv/include/opencv2/ml.hpp +++ /dev/null @@ -1,1972 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000, Intel Corporation, all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Copyright (C) 2014, Itseez Inc, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_ML_HPP -#define OPENCV_ML_HPP - -#ifdef __cplusplus -# include "opencv2/core.hpp" -#endif - -#ifdef __cplusplus - -#include -#include -#include - -/** - @defgroup ml Machine Learning - - The Machine Learning Library (MLL) is a set of classes and functions for statistical - classification, regression, and clustering of data. - - Most of the classification and regression algorithms are implemented as C++ classes. As the - algorithms have different sets of features (like an ability to handle missing measurements or - categorical input variables), there is a little common ground between the classes. This common - ground is defined by the class cv::ml::StatModel that all the other ML classes are derived from. - - See detailed overview here: @ref ml_intro. - */ - -namespace cv -{ - -namespace ml -{ - -//! @addtogroup ml -//! @{ - -/** @brief Variable types */ -enum VariableTypes -{ - VAR_NUMERICAL =0, //!< same as VAR_ORDERED - VAR_ORDERED =0, //!< ordered variables - VAR_CATEGORICAL =1 //!< categorical variables -}; - -/** @brief %Error types */ -enum ErrorTypes -{ - TEST_ERROR = 0, - TRAIN_ERROR = 1 -}; - -/** @brief Sample types */ -enum SampleTypes -{ - ROW_SAMPLE = 0, //!< each training sample is a row of samples - COL_SAMPLE = 1 //!< each training sample occupies a column of samples -}; - -/** @brief The structure represents the logarithmic grid range of statmodel parameters. - -It is used for optimizing statmodel accuracy by varying model parameters, the accuracy estimate -being computed by cross-validation. - */ -class CV_EXPORTS_W ParamGrid -{ -public: - /** @brief Default constructor */ - ParamGrid(); - /** @brief Constructor with parameters */ - ParamGrid(double _minVal, double _maxVal, double _logStep); - - CV_PROP_RW double minVal; //!< Minimum value of the statmodel parameter. Default value is 0. - CV_PROP_RW double maxVal; //!< Maximum value of the statmodel parameter. Default value is 0. - /** @brief Logarithmic step for iterating the statmodel parameter. - - The grid determines the following iteration sequence of the statmodel parameter values: - \f[(minVal, minVal*step, minVal*{step}^2, \dots, minVal*{logStep}^n),\f] - where \f$n\f$ is the maximal index satisfying - \f[\texttt{minVal} * \texttt{logStep} ^n < \texttt{maxVal}\f] - The grid is logarithmic, so logStep must always be greater than 1. Default value is 1. - */ - CV_PROP_RW double logStep; - - /** @brief Creates a ParamGrid Ptr that can be given to the %SVM::trainAuto method - - @param minVal minimum value of the parameter grid - @param maxVal maximum value of the parameter grid - @param logstep Logarithmic step for iterating the statmodel parameter - */ - CV_WRAP static Ptr create(double minVal=0., double maxVal=0., double logstep=1.); -}; - -/** @brief Class encapsulating training data. - -Please note that the class only specifies the interface of training data, but not implementation. -All the statistical model classes in _ml_ module accepts Ptr\ as parameter. In other -words, you can create your own class derived from TrainData and pass smart pointer to the instance -of this class into StatModel::train. - -@sa @ref ml_intro_data - */ -class CV_EXPORTS_W TrainData -{ -public: - static inline float missingValue() { return FLT_MAX; } - virtual ~TrainData(); - - CV_WRAP virtual int getLayout() const = 0; - CV_WRAP virtual int getNTrainSamples() const = 0; - CV_WRAP virtual int getNTestSamples() const = 0; - CV_WRAP virtual int getNSamples() const = 0; - CV_WRAP virtual int getNVars() const = 0; - CV_WRAP virtual int getNAllVars() const = 0; - - CV_WRAP virtual void getSample(InputArray varIdx, int sidx, float* buf) const = 0; - CV_WRAP virtual Mat getSamples() const = 0; - CV_WRAP virtual Mat getMissing() const = 0; - - /** @brief Returns matrix of train samples - - @param layout The requested layout. If it's different from the initial one, the matrix is - transposed. See ml::SampleTypes. - @param compressSamples if true, the function returns only the training samples (specified by - sampleIdx) - @param compressVars if true, the function returns the shorter training samples, containing only - the active variables. - - In current implementation the function tries to avoid physical data copying and returns the - matrix stored inside TrainData (unless the transposition or compression is needed). - */ - CV_WRAP virtual Mat getTrainSamples(int layout=ROW_SAMPLE, - bool compressSamples=true, - bool compressVars=true) const = 0; - - /** @brief Returns the vector of responses - - The function returns ordered or the original categorical responses. Usually it's used in - regression algorithms. - */ - CV_WRAP virtual Mat getTrainResponses() const = 0; - - /** @brief Returns the vector of normalized categorical responses - - The function returns vector of responses. Each response is integer from `0` to `-1`. The actual label value can be retrieved then from the class label vector, see - TrainData::getClassLabels. - */ - CV_WRAP virtual Mat getTrainNormCatResponses() const = 0; - CV_WRAP virtual Mat getTestResponses() const = 0; - CV_WRAP virtual Mat getTestNormCatResponses() const = 0; - CV_WRAP virtual Mat getResponses() const = 0; - CV_WRAP virtual Mat getNormCatResponses() const = 0; - CV_WRAP virtual Mat getSampleWeights() const = 0; - CV_WRAP virtual Mat getTrainSampleWeights() const = 0; - CV_WRAP virtual Mat getTestSampleWeights() const = 0; - CV_WRAP virtual Mat getVarIdx() const = 0; - CV_WRAP virtual Mat getVarType() const = 0; - CV_WRAP Mat getVarSymbolFlags() const; - CV_WRAP virtual int getResponseType() const = 0; - CV_WRAP virtual Mat getTrainSampleIdx() const = 0; - CV_WRAP virtual Mat getTestSampleIdx() const = 0; - CV_WRAP virtual void getValues(int vi, InputArray sidx, float* values) const = 0; - virtual void getNormCatValues(int vi, InputArray sidx, int* values) const = 0; - CV_WRAP virtual Mat getDefaultSubstValues() const = 0; - - CV_WRAP virtual int getCatCount(int vi) const = 0; - - /** @brief Returns the vector of class labels - - The function returns vector of unique labels occurred in the responses. - */ - CV_WRAP virtual Mat getClassLabels() const = 0; - - CV_WRAP virtual Mat getCatOfs() const = 0; - CV_WRAP virtual Mat getCatMap() const = 0; - - /** @brief Splits the training data into the training and test parts - @sa TrainData::setTrainTestSplitRatio - */ - CV_WRAP virtual void setTrainTestSplit(int count, bool shuffle=true) = 0; - - /** @brief Splits the training data into the training and test parts - - The function selects a subset of specified relative size and then returns it as the training - set. If the function is not called, all the data is used for training. Please, note that for - each of TrainData::getTrain\* there is corresponding TrainData::getTest\*, so that the test - subset can be retrieved and processed as well. - @sa TrainData::setTrainTestSplit - */ - CV_WRAP virtual void setTrainTestSplitRatio(double ratio, bool shuffle=true) = 0; - CV_WRAP virtual void shuffleTrainTest() = 0; - - /** @brief Returns matrix of test samples */ - CV_WRAP Mat getTestSamples() const; - - /** @brief Returns vector of symbolic names captured in loadFromCSV() */ - CV_WRAP void getNames(std::vector& names) const; - - /** @brief Extract from 1D vector elements specified by passed indexes. - @param vec input vector (supported types: CV_32S, CV_32F, CV_64F) - @param idx 1D index vector - */ - static CV_WRAP Mat getSubVector(const Mat& vec, const Mat& idx); - - /** @brief Extract from matrix rows/cols specified by passed indexes. - @param matrix input matrix (supported types: CV_32S, CV_32F, CV_64F) - @param idx 1D index vector - @param layout specifies to extract rows (cv::ml::ROW_SAMPLES) or to extract columns (cv::ml::COL_SAMPLES) - */ - static CV_WRAP Mat getSubMatrix(const Mat& matrix, const Mat& idx, int layout); - - /** @brief Reads the dataset from a .csv file and returns the ready-to-use training data. - - @param filename The input file name - @param headerLineCount The number of lines in the beginning to skip; besides the header, the - function also skips empty lines and lines staring with `#` - @param responseStartIdx Index of the first output variable. If -1, the function considers the - last variable as the response - @param responseEndIdx Index of the last output variable + 1. If -1, then there is single - response variable at responseStartIdx. - @param varTypeSpec The optional text string that specifies the variables' types. It has the - format `ord[n1-n2,n3,n4-n5,...]cat[n6,n7-n8,...]`. That is, variables from `n1 to n2` - (inclusive range), `n3`, `n4 to n5` ... are considered ordered and `n6`, `n7 to n8` ... are - considered as categorical. The range `[n1..n2] + [n3] + [n4..n5] + ... + [n6] + [n7..n8]` - should cover all the variables. If varTypeSpec is not specified, then algorithm uses the - following rules: - - all input variables are considered ordered by default. If some column contains has non- - numerical values, e.g. 'apple', 'pear', 'apple', 'apple', 'mango', the corresponding - variable is considered categorical. - - if there are several output variables, they are all considered as ordered. Error is - reported when non-numerical values are used. - - if there is a single output variable, then if its values are non-numerical or are all - integers, then it's considered categorical. Otherwise, it's considered ordered. - @param delimiter The character used to separate values in each line. - @param missch The character used to specify missing measurements. It should not be a digit. - Although it's a non-numerical value, it surely does not affect the decision of whether the - variable ordered or categorical. - @note If the dataset only contains input variables and no responses, use responseStartIdx = -2 - and responseEndIdx = 0. The output variables vector will just contain zeros. - */ - static Ptr loadFromCSV(const String& filename, - int headerLineCount, - int responseStartIdx=-1, - int responseEndIdx=-1, - const String& varTypeSpec=String(), - char delimiter=',', - char missch='?'); - - /** @brief Creates training data from in-memory arrays. - - @param samples matrix of samples. It should have CV_32F type. - @param layout see ml::SampleTypes. - @param responses matrix of responses. If the responses are scalar, they should be stored as a - single row or as a single column. The matrix should have type CV_32F or CV_32S (in the - former case the responses are considered as ordered by default; in the latter case - as - categorical) - @param varIdx vector specifying which variables to use for training. It can be an integer vector - (CV_32S) containing 0-based variable indices or byte vector (CV_8U) containing a mask of - active variables. - @param sampleIdx vector specifying which samples to use for training. It can be an integer - vector (CV_32S) containing 0-based sample indices or byte vector (CV_8U) containing a mask - of training samples. - @param sampleWeights optional vector with weights for each sample. It should have CV_32F type. - @param varType optional vector of type CV_8U and size ` + - `, containing types of each input and output variable. See - ml::VariableTypes. - */ - CV_WRAP static Ptr create(InputArray samples, int layout, InputArray responses, - InputArray varIdx=noArray(), InputArray sampleIdx=noArray(), - InputArray sampleWeights=noArray(), InputArray varType=noArray()); -}; - -/** @brief Base class for statistical models in OpenCV ML. - */ -class CV_EXPORTS_W StatModel : public Algorithm -{ -public: - /** Predict options */ - enum Flags { - UPDATE_MODEL = 1, - RAW_OUTPUT=1, //!< makes the method return the raw results (the sum), not the class label - COMPRESSED_INPUT=2, - PREPROCESSED_INPUT=4 - }; - - /** @brief Returns the number of variables in training samples */ - CV_WRAP virtual int getVarCount() const = 0; - - CV_WRAP virtual bool empty() const CV_OVERRIDE; - - /** @brief Returns true if the model is trained */ - CV_WRAP virtual bool isTrained() const = 0; - /** @brief Returns true if the model is classifier */ - CV_WRAP virtual bool isClassifier() const = 0; - - /** @brief Trains the statistical model - - @param trainData training data that can be loaded from file using TrainData::loadFromCSV or - created with TrainData::create. - @param flags optional flags, depending on the model. Some of the models can be updated with the - new training samples, not completely overwritten (such as NormalBayesClassifier or ANN_MLP). - */ - CV_WRAP virtual bool train( const Ptr& trainData, int flags=0 ); - - /** @brief Trains the statistical model - - @param samples training samples - @param layout See ml::SampleTypes. - @param responses vector of responses associated with the training samples. - */ - CV_WRAP virtual bool train( InputArray samples, int layout, InputArray responses ); - - /** @brief Computes error on the training or test dataset - - @param data the training data - @param test if true, the error is computed over the test subset of the data, otherwise it's - computed over the training subset of the data. Please note that if you loaded a completely - different dataset to evaluate already trained classifier, you will probably want not to set - the test subset at all with TrainData::setTrainTestSplitRatio and specify test=false, so - that the error is computed for the whole new set. Yes, this sounds a bit confusing. - @param resp the optional output responses. - - The method uses StatModel::predict to compute the error. For regression models the error is - computed as RMS, for classifiers - as a percent of missclassified samples (0%-100%). - */ - CV_WRAP virtual float calcError( const Ptr& data, bool test, OutputArray resp ) const; - - /** @brief Predicts response(s) for the provided sample(s) - - @param samples The input samples, floating-point matrix - @param results The optional output matrix of results. - @param flags The optional flags, model-dependent. See cv::ml::StatModel::Flags. - */ - CV_WRAP virtual float predict( InputArray samples, OutputArray results=noArray(), int flags=0 ) const = 0; - - /** @brief Create and train model with default parameters - - The class must implement static `create()` method with no parameters or with all default parameter values - */ - template static Ptr<_Tp> train(const Ptr& data, int flags=0) - { - Ptr<_Tp> model = _Tp::create(); - return !model.empty() && model->train(data, flags) ? model : Ptr<_Tp>(); - } -}; - -/****************************************************************************************\ -* Normal Bayes Classifier * -\****************************************************************************************/ - -/** @brief Bayes classifier for normally distributed data. - -@sa @ref ml_intro_bayes - */ -class CV_EXPORTS_W NormalBayesClassifier : public StatModel -{ -public: - /** @brief Predicts the response for sample(s). - - The method estimates the most probable classes for input vectors. Input vectors (one or more) - are stored as rows of the matrix inputs. In case of multiple input vectors, there should be one - output vector outputs. The predicted class for a single input vector is returned by the method. - The vector outputProbs contains the output probabilities corresponding to each element of - result. - */ - CV_WRAP virtual float predictProb( InputArray inputs, OutputArray outputs, - OutputArray outputProbs, int flags=0 ) const = 0; - - /** Creates empty model - Use StatModel::train to train the model after creation. */ - CV_WRAP static Ptr create(); - - /** @brief Loads and creates a serialized NormalBayesClassifier from a file - * - * Use NormalBayesClassifier::save to serialize and store an NormalBayesClassifier to disk. - * Load the NormalBayesClassifier from this file again, by calling this function with the path to the file. - * Optionally specify the node for the file containing the classifier - * - * @param filepath path to serialized NormalBayesClassifier - * @param nodeName name of node containing the classifier - */ - CV_WRAP static Ptr load(const String& filepath , const String& nodeName = String()); -}; - -/****************************************************************************************\ -* K-Nearest Neighbour Classifier * -\****************************************************************************************/ - -/** @brief The class implements K-Nearest Neighbors model - -@sa @ref ml_intro_knn - */ -class CV_EXPORTS_W KNearest : public StatModel -{ -public: - - /** Default number of neighbors to use in predict method. */ - /** @see setDefaultK */ - CV_WRAP virtual int getDefaultK() const = 0; - /** @copybrief getDefaultK @see getDefaultK */ - CV_WRAP virtual void setDefaultK(int val) = 0; - - /** Whether classification or regression model should be trained. */ - /** @see setIsClassifier */ - CV_WRAP virtual bool getIsClassifier() const = 0; - /** @copybrief getIsClassifier @see getIsClassifier */ - CV_WRAP virtual void setIsClassifier(bool val) = 0; - - /** Parameter for KDTree implementation. */ - /** @see setEmax */ - CV_WRAP virtual int getEmax() const = 0; - /** @copybrief getEmax @see getEmax */ - CV_WRAP virtual void setEmax(int val) = 0; - - /** %Algorithm type, one of KNearest::Types. */ - /** @see setAlgorithmType */ - CV_WRAP virtual int getAlgorithmType() const = 0; - /** @copybrief getAlgorithmType @see getAlgorithmType */ - CV_WRAP virtual void setAlgorithmType(int val) = 0; - - /** @brief Finds the neighbors and predicts responses for input vectors. - - @param samples Input samples stored by rows. It is a single-precision floating-point matrix of - ` * k` size. - @param k Number of used nearest neighbors. Should be greater than 1. - @param results Vector with results of prediction (regression or classification) for each input - sample. It is a single-precision floating-point vector with `` elements. - @param neighborResponses Optional output values for corresponding neighbors. It is a single- - precision floating-point matrix of ` * k` size. - @param dist Optional output distances from the input vectors to the corresponding neighbors. It - is a single-precision floating-point matrix of ` * k` size. - - For each input vector (a row of the matrix samples), the method finds the k nearest neighbors. - In case of regression, the predicted result is a mean value of the particular vector's neighbor - responses. In case of classification, the class is determined by voting. - - For each input vector, the neighbors are sorted by their distances to the vector. - - In case of C++ interface you can use output pointers to empty matrices and the function will - allocate memory itself. - - If only a single input vector is passed, all output matrices are optional and the predicted - value is returned by the method. - - The function is parallelized with the TBB library. - */ - CV_WRAP virtual float findNearest( InputArray samples, int k, - OutputArray results, - OutputArray neighborResponses=noArray(), - OutputArray dist=noArray() ) const = 0; - - /** @brief Implementations of KNearest algorithm - */ - enum Types - { - BRUTE_FORCE=1, - KDTREE=2 - }; - - /** @brief Creates the empty model - - The static method creates empty %KNearest classifier. It should be then trained using StatModel::train method. - */ - CV_WRAP static Ptr create(); -}; - -/****************************************************************************************\ -* Support Vector Machines * -\****************************************************************************************/ - -/** @brief Support Vector Machines. - -@sa @ref ml_intro_svm - */ -class CV_EXPORTS_W SVM : public StatModel -{ -public: - - class CV_EXPORTS Kernel : public Algorithm - { - public: - virtual int getType() const = 0; - virtual void calc( int vcount, int n, const float* vecs, const float* another, float* results ) = 0; - }; - - /** Type of a %SVM formulation. - See SVM::Types. Default value is SVM::C_SVC. */ - /** @see setType */ - CV_WRAP virtual int getType() const = 0; - /** @copybrief getType @see getType */ - CV_WRAP virtual void setType(int val) = 0; - - /** Parameter \f$\gamma\f$ of a kernel function. - For SVM::POLY, SVM::RBF, SVM::SIGMOID or SVM::CHI2. Default value is 1. */ - /** @see setGamma */ - CV_WRAP virtual double getGamma() const = 0; - /** @copybrief getGamma @see getGamma */ - CV_WRAP virtual void setGamma(double val) = 0; - - /** Parameter _coef0_ of a kernel function. - For SVM::POLY or SVM::SIGMOID. Default value is 0.*/ - /** @see setCoef0 */ - CV_WRAP virtual double getCoef0() const = 0; - /** @copybrief getCoef0 @see getCoef0 */ - CV_WRAP virtual void setCoef0(double val) = 0; - - /** Parameter _degree_ of a kernel function. - For SVM::POLY. Default value is 0. */ - /** @see setDegree */ - CV_WRAP virtual double getDegree() const = 0; - /** @copybrief getDegree @see getDegree */ - CV_WRAP virtual void setDegree(double val) = 0; - - /** Parameter _C_ of a %SVM optimization problem. - For SVM::C_SVC, SVM::EPS_SVR or SVM::NU_SVR. Default value is 0. */ - /** @see setC */ - CV_WRAP virtual double getC() const = 0; - /** @copybrief getC @see getC */ - CV_WRAP virtual void setC(double val) = 0; - - /** Parameter \f$\nu\f$ of a %SVM optimization problem. - For SVM::NU_SVC, SVM::ONE_CLASS or SVM::NU_SVR. Default value is 0. */ - /** @see setNu */ - CV_WRAP virtual double getNu() const = 0; - /** @copybrief getNu @see getNu */ - CV_WRAP virtual void setNu(double val) = 0; - - /** Parameter \f$\epsilon\f$ of a %SVM optimization problem. - For SVM::EPS_SVR. Default value is 0. */ - /** @see setP */ - CV_WRAP virtual double getP() const = 0; - /** @copybrief getP @see getP */ - CV_WRAP virtual void setP(double val) = 0; - - /** Optional weights in the SVM::C_SVC problem, assigned to particular classes. - They are multiplied by _C_ so the parameter _C_ of class _i_ becomes `classWeights(i) * C`. Thus - these weights affect the misclassification penalty for different classes. The larger weight, - the larger penalty on misclassification of data from the corresponding class. Default value is - empty Mat. */ - /** @see setClassWeights */ - CV_WRAP virtual cv::Mat getClassWeights() const = 0; - /** @copybrief getClassWeights @see getClassWeights */ - CV_WRAP virtual void setClassWeights(const cv::Mat &val) = 0; - - /** Termination criteria of the iterative %SVM training procedure which solves a partial - case of constrained quadratic optimization problem. - You can specify tolerance and/or the maximum number of iterations. Default value is - `TermCriteria( TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, FLT_EPSILON )`; */ - /** @see setTermCriteria */ - CV_WRAP virtual cv::TermCriteria getTermCriteria() const = 0; - /** @copybrief getTermCriteria @see getTermCriteria */ - CV_WRAP virtual void setTermCriteria(const cv::TermCriteria &val) = 0; - - /** Type of a %SVM kernel. - See SVM::KernelTypes. Default value is SVM::RBF. */ - CV_WRAP virtual int getKernelType() const = 0; - - /** Initialize with one of predefined kernels. - See SVM::KernelTypes. */ - CV_WRAP virtual void setKernel(int kernelType) = 0; - - /** Initialize with custom kernel. - See SVM::Kernel class for implementation details */ - virtual void setCustomKernel(const Ptr &_kernel) = 0; - - //! %SVM type - enum Types { - /** C-Support Vector Classification. n-class classification (n \f$\geq\f$ 2), allows - imperfect separation of classes with penalty multiplier C for outliers. */ - C_SVC=100, - /** \f$\nu\f$-Support Vector Classification. n-class classification with possible - imperfect separation. Parameter \f$\nu\f$ (in the range 0..1, the larger the value, the smoother - the decision boundary) is used instead of C. */ - NU_SVC=101, - /** Distribution Estimation (One-class %SVM). All the training data are from - the same class, %SVM builds a boundary that separates the class from the rest of the feature - space. */ - ONE_CLASS=102, - /** \f$\epsilon\f$-Support Vector Regression. The distance between feature vectors - from the training set and the fitting hyper-plane must be less than p. For outliers the - penalty multiplier C is used. */ - EPS_SVR=103, - /** \f$\nu\f$-Support Vector Regression. \f$\nu\f$ is used instead of p. - See @cite LibSVM for details. */ - NU_SVR=104 - }; - - /** @brief %SVM kernel type - - A comparison of different kernels on the following 2D test case with four classes. Four - SVM::C_SVC SVMs have been trained (one against rest) with auto_train. Evaluation on three - different kernels (SVM::CHI2, SVM::INTER, SVM::RBF). The color depicts the class with max score. - Bright means max-score \> 0, dark means max-score \< 0. - ![image](pics/SVM_Comparison.png) - */ - enum KernelTypes { - /** Returned by SVM::getKernelType in case when custom kernel has been set */ - CUSTOM=-1, - /** Linear kernel. No mapping is done, linear discrimination (or regression) is - done in the original feature space. It is the fastest option. \f$K(x_i, x_j) = x_i^T x_j\f$. */ - LINEAR=0, - /** Polynomial kernel: - \f$K(x_i, x_j) = (\gamma x_i^T x_j + coef0)^{degree}, \gamma > 0\f$. */ - POLY=1, - /** Radial basis function (RBF), a good choice in most cases. - \f$K(x_i, x_j) = e^{-\gamma ||x_i - x_j||^2}, \gamma > 0\f$. */ - RBF=2, - /** Sigmoid kernel: \f$K(x_i, x_j) = \tanh(\gamma x_i^T x_j + coef0)\f$. */ - SIGMOID=3, - /** Exponential Chi2 kernel, similar to the RBF kernel: - \f$K(x_i, x_j) = e^{-\gamma \chi^2(x_i,x_j)}, \chi^2(x_i,x_j) = (x_i-x_j)^2/(x_i+x_j), \gamma > 0\f$. */ - CHI2=4, - /** Histogram intersection kernel. A fast kernel. \f$K(x_i, x_j) = min(x_i,x_j)\f$. */ - INTER=5 - }; - - //! %SVM params type - enum ParamTypes { - C=0, - GAMMA=1, - P=2, - NU=3, - COEF=4, - DEGREE=5 - }; - - /** @brief Trains an %SVM with optimal parameters. - - @param data the training data that can be constructed using TrainData::create or - TrainData::loadFromCSV. - @param kFold Cross-validation parameter. The training set is divided into kFold subsets. One - subset is used to test the model, the others form the train set. So, the %SVM algorithm is - executed kFold times. - @param Cgrid grid for C - @param gammaGrid grid for gamma - @param pGrid grid for p - @param nuGrid grid for nu - @param coeffGrid grid for coeff - @param degreeGrid grid for degree - @param balanced If true and the problem is 2-class classification then the method creates more - balanced cross-validation subsets that is proportions between classes in subsets are close - to such proportion in the whole train dataset. - - The method trains the %SVM model automatically by choosing the optimal parameters C, gamma, p, - nu, coef0, degree. Parameters are considered optimal when the cross-validation - estimate of the test set error is minimal. - - If there is no need to optimize a parameter, the corresponding grid step should be set to any - value less than or equal to 1. For example, to avoid optimization in gamma, set `gammaGrid.step - = 0`, `gammaGrid.minVal`, `gamma_grid.maxVal` as arbitrary numbers. In this case, the value - `Gamma` is taken for gamma. - - And, finally, if the optimization in a parameter is required but the corresponding grid is - unknown, you may call the function SVM::getDefaultGrid. To generate a grid, for example, for - gamma, call `SVM::getDefaultGrid(SVM::GAMMA)`. - - This function works for the classification (SVM::C_SVC or SVM::NU_SVC) as well as for the - regression (SVM::EPS_SVR or SVM::NU_SVR). If it is SVM::ONE_CLASS, no optimization is made and - the usual %SVM with parameters specified in params is executed. - */ - virtual bool trainAuto( const Ptr& data, int kFold = 10, - ParamGrid Cgrid = getDefaultGrid(C), - ParamGrid gammaGrid = getDefaultGrid(GAMMA), - ParamGrid pGrid = getDefaultGrid(P), - ParamGrid nuGrid = getDefaultGrid(NU), - ParamGrid coeffGrid = getDefaultGrid(COEF), - ParamGrid degreeGrid = getDefaultGrid(DEGREE), - bool balanced=false) = 0; - - /** @brief Trains an %SVM with optimal parameters - - @param samples training samples - @param layout See ml::SampleTypes. - @param responses vector of responses associated with the training samples. - @param kFold Cross-validation parameter. The training set is divided into kFold subsets. One - subset is used to test the model, the others form the train set. So, the %SVM algorithm is - @param Cgrid grid for C - @param gammaGrid grid for gamma - @param pGrid grid for p - @param nuGrid grid for nu - @param coeffGrid grid for coeff - @param degreeGrid grid for degree - @param balanced If true and the problem is 2-class classification then the method creates more - balanced cross-validation subsets that is proportions between classes in subsets are close - to such proportion in the whole train dataset. - - The method trains the %SVM model automatically by choosing the optimal parameters C, gamma, p, - nu, coef0, degree. Parameters are considered optimal when the cross-validation - estimate of the test set error is minimal. - - This function only makes use of SVM::getDefaultGrid for parameter optimization and thus only - offers rudimentary parameter options. - - This function works for the classification (SVM::C_SVC or SVM::NU_SVC) as well as for the - regression (SVM::EPS_SVR or SVM::NU_SVR). If it is SVM::ONE_CLASS, no optimization is made and - the usual %SVM with parameters specified in params is executed. - */ - CV_WRAP bool trainAuto(InputArray samples, - int layout, - InputArray responses, - int kFold = 10, - Ptr Cgrid = SVM::getDefaultGridPtr(SVM::C), - Ptr gammaGrid = SVM::getDefaultGridPtr(SVM::GAMMA), - Ptr pGrid = SVM::getDefaultGridPtr(SVM::P), - Ptr nuGrid = SVM::getDefaultGridPtr(SVM::NU), - Ptr coeffGrid = SVM::getDefaultGridPtr(SVM::COEF), - Ptr degreeGrid = SVM::getDefaultGridPtr(SVM::DEGREE), - bool balanced=false); - - /** @brief Retrieves all the support vectors - - The method returns all the support vectors as a floating-point matrix, where support vectors are - stored as matrix rows. - */ - CV_WRAP virtual Mat getSupportVectors() const = 0; - - /** @brief Retrieves all the uncompressed support vectors of a linear %SVM - - The method returns all the uncompressed support vectors of a linear %SVM that the compressed - support vector, used for prediction, was derived from. They are returned in a floating-point - matrix, where the support vectors are stored as matrix rows. - */ - CV_WRAP Mat getUncompressedSupportVectors() const; - - /** @brief Retrieves the decision function - - @param i the index of the decision function. If the problem solved is regression, 1-class or - 2-class classification, then there will be just one decision function and the index should - always be 0. Otherwise, in the case of N-class classification, there will be \f$N(N-1)/2\f$ - decision functions. - @param alpha the optional output vector for weights, corresponding to different support vectors. - In the case of linear %SVM all the alpha's will be 1's. - @param svidx the optional output vector of indices of support vectors within the matrix of - support vectors (which can be retrieved by SVM::getSupportVectors). In the case of linear - %SVM each decision function consists of a single "compressed" support vector. - - The method returns rho parameter of the decision function, a scalar subtracted from the weighted - sum of kernel responses. - */ - CV_WRAP virtual double getDecisionFunction(int i, OutputArray alpha, OutputArray svidx) const = 0; - - /** @brief Generates a grid for %SVM parameters. - - @param param_id %SVM parameters IDs that must be one of the SVM::ParamTypes. The grid is - generated for the parameter with this ID. - - The function generates a grid for the specified parameter of the %SVM algorithm. The grid may be - passed to the function SVM::trainAuto. - */ - static ParamGrid getDefaultGrid( int param_id ); - - /** @brief Generates a grid for %SVM parameters. - - @param param_id %SVM parameters IDs that must be one of the SVM::ParamTypes. The grid is - generated for the parameter with this ID. - - The function generates a grid pointer for the specified parameter of the %SVM algorithm. - The grid may be passed to the function SVM::trainAuto. - */ - CV_WRAP static Ptr getDefaultGridPtr( int param_id ); - - /** Creates empty model. - Use StatModel::train to train the model. Since %SVM has several parameters, you may want to - find the best parameters for your problem, it can be done with SVM::trainAuto. */ - CV_WRAP static Ptr create(); - - /** @brief Loads and creates a serialized svm from a file - * - * Use SVM::save to serialize and store an SVM to disk. - * Load the SVM from this file again, by calling this function with the path to the file. - * - * @param filepath path to serialized svm - */ - CV_WRAP static Ptr load(const String& filepath); -}; - -/****************************************************************************************\ -* Expectation - Maximization * -\****************************************************************************************/ - -/** @brief The class implements the Expectation Maximization algorithm. - -@sa @ref ml_intro_em - */ -class CV_EXPORTS_W EM : public StatModel -{ -public: - //! Type of covariation matrices - enum Types { - /** A scaled identity matrix \f$\mu_k * I\f$. There is the only - parameter \f$\mu_k\f$ to be estimated for each matrix. The option may be used in special cases, - when the constraint is relevant, or as a first step in the optimization (for example in case - when the data is preprocessed with PCA). The results of such preliminary estimation may be - passed again to the optimization procedure, this time with - covMatType=EM::COV_MAT_DIAGONAL. */ - COV_MAT_SPHERICAL=0, - /** A diagonal matrix with positive diagonal elements. The number of - free parameters is d for each matrix. This is most commonly used option yielding good - estimation results. */ - COV_MAT_DIAGONAL=1, - /** A symmetric positively defined matrix. The number of free - parameters in each matrix is about \f$d^2/2\f$. It is not recommended to use this option, unless - there is pretty accurate initial estimation of the parameters and/or a huge number of - training samples. */ - COV_MAT_GENERIC=2, - COV_MAT_DEFAULT=COV_MAT_DIAGONAL - }; - - //! Default parameters - enum {DEFAULT_NCLUSTERS=5, DEFAULT_MAX_ITERS=100}; - - //! The initial step - enum {START_E_STEP=1, START_M_STEP=2, START_AUTO_STEP=0}; - - /** The number of mixture components in the Gaussian mixture model. - Default value of the parameter is EM::DEFAULT_NCLUSTERS=5. Some of %EM implementation could - determine the optimal number of mixtures within a specified value range, but that is not the - case in ML yet. */ - /** @see setClustersNumber */ - CV_WRAP virtual int getClustersNumber() const = 0; - /** @copybrief getClustersNumber @see getClustersNumber */ - CV_WRAP virtual void setClustersNumber(int val) = 0; - - /** Constraint on covariance matrices which defines type of matrices. - See EM::Types. */ - /** @see setCovarianceMatrixType */ - CV_WRAP virtual int getCovarianceMatrixType() const = 0; - /** @copybrief getCovarianceMatrixType @see getCovarianceMatrixType */ - CV_WRAP virtual void setCovarianceMatrixType(int val) = 0; - - /** The termination criteria of the %EM algorithm. - The %EM algorithm can be terminated by the number of iterations termCrit.maxCount (number of - M-steps) or when relative change of likelihood logarithm is less than termCrit.epsilon. Default - maximum number of iterations is EM::DEFAULT_MAX_ITERS=100. */ - /** @see setTermCriteria */ - CV_WRAP virtual TermCriteria getTermCriteria() const = 0; - /** @copybrief getTermCriteria @see getTermCriteria */ - CV_WRAP virtual void setTermCriteria(const TermCriteria &val) = 0; - - /** @brief Returns weights of the mixtures - - Returns vector with the number of elements equal to the number of mixtures. - */ - CV_WRAP virtual Mat getWeights() const = 0; - /** @brief Returns the cluster centers (means of the Gaussian mixture) - - Returns matrix with the number of rows equal to the number of mixtures and number of columns - equal to the space dimensionality. - */ - CV_WRAP virtual Mat getMeans() const = 0; - /** @brief Returns covariation matrices - - Returns vector of covariation matrices. Number of matrices is the number of gaussian mixtures, - each matrix is a square floating-point matrix NxN, where N is the space dimensionality. - */ - CV_WRAP virtual void getCovs(CV_OUT std::vector& covs) const = 0; - - /** @brief Returns posterior probabilities for the provided samples - - @param samples The input samples, floating-point matrix - @param results The optional output \f$ nSamples \times nClusters\f$ matrix of results. It contains - posterior probabilities for each sample from the input - @param flags This parameter will be ignored - */ - CV_WRAP virtual float predict( InputArray samples, OutputArray results=noArray(), int flags=0 ) const CV_OVERRIDE = 0; - - /** @brief Returns a likelihood logarithm value and an index of the most probable mixture component - for the given sample. - - @param sample A sample for classification. It should be a one-channel matrix of - \f$1 \times dims\f$ or \f$dims \times 1\f$ size. - @param probs Optional output matrix that contains posterior probabilities of each component - given the sample. It has \f$1 \times nclusters\f$ size and CV_64FC1 type. - - The method returns a two-element double vector. Zero element is a likelihood logarithm value for - the sample. First element is an index of the most probable mixture component for the given - sample. - */ - CV_WRAP virtual Vec2d predict2(InputArray sample, OutputArray probs) const = 0; - - /** @brief Estimate the Gaussian mixture parameters from a samples set. - - This variation starts with Expectation step. Initial values of the model parameters will be - estimated by the k-means algorithm. - - Unlike many of the ML models, %EM is an unsupervised learning algorithm and it does not take - responses (class labels or function values) as input. Instead, it computes the *Maximum - Likelihood Estimate* of the Gaussian mixture parameters from an input sample set, stores all the - parameters inside the structure: \f$p_{i,k}\f$ in probs, \f$a_k\f$ in means , \f$S_k\f$ in - covs[k], \f$\pi_k\f$ in weights , and optionally computes the output "class label" for each - sample: \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most - probable mixture component for each sample). - - The trained model can be used further for prediction, just like any other classifier. The - trained model is similar to the NormalBayesClassifier. - - @param samples Samples from which the Gaussian mixture model will be estimated. It should be a - one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type - it will be converted to the inner matrix of such type for the further computing. - @param logLikelihoods The optional output matrix that contains a likelihood logarithm value for - each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type. - @param labels The optional output "class label" for each sample: - \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable - mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type. - @param probs The optional output matrix that contains posterior probabilities of each Gaussian - mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and - CV_64FC1 type. - */ - CV_WRAP virtual bool trainEM(InputArray samples, - OutputArray logLikelihoods=noArray(), - OutputArray labels=noArray(), - OutputArray probs=noArray()) = 0; - - /** @brief Estimate the Gaussian mixture parameters from a samples set. - - This variation starts with Expectation step. You need to provide initial means \f$a_k\f$ of - mixture components. Optionally you can pass initial weights \f$\pi_k\f$ and covariance matrices - \f$S_k\f$ of mixture components. - - @param samples Samples from which the Gaussian mixture model will be estimated. It should be a - one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type - it will be converted to the inner matrix of such type for the further computing. - @param means0 Initial means \f$a_k\f$ of mixture components. It is a one-channel matrix of - \f$nclusters \times dims\f$ size. If the matrix does not have CV_64F type it will be - converted to the inner matrix of such type for the further computing. - @param covs0 The vector of initial covariance matrices \f$S_k\f$ of mixture components. Each of - covariance matrices is a one-channel matrix of \f$dims \times dims\f$ size. If the matrices - do not have CV_64F type they will be converted to the inner matrices of such type for the - further computing. - @param weights0 Initial weights \f$\pi_k\f$ of mixture components. It should be a one-channel - floating-point matrix with \f$1 \times nclusters\f$ or \f$nclusters \times 1\f$ size. - @param logLikelihoods The optional output matrix that contains a likelihood logarithm value for - each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type. - @param labels The optional output "class label" for each sample: - \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable - mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type. - @param probs The optional output matrix that contains posterior probabilities of each Gaussian - mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and - CV_64FC1 type. - */ - CV_WRAP virtual bool trainE(InputArray samples, InputArray means0, - InputArray covs0=noArray(), - InputArray weights0=noArray(), - OutputArray logLikelihoods=noArray(), - OutputArray labels=noArray(), - OutputArray probs=noArray()) = 0; - - /** @brief Estimate the Gaussian mixture parameters from a samples set. - - This variation starts with Maximization step. You need to provide initial probabilities - \f$p_{i,k}\f$ to use this option. - - @param samples Samples from which the Gaussian mixture model will be estimated. It should be a - one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type - it will be converted to the inner matrix of such type for the further computing. - @param probs0 - @param logLikelihoods The optional output matrix that contains a likelihood logarithm value for - each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type. - @param labels The optional output "class label" for each sample: - \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable - mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type. - @param probs The optional output matrix that contains posterior probabilities of each Gaussian - mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and - CV_64FC1 type. - */ - CV_WRAP virtual bool trainM(InputArray samples, InputArray probs0, - OutputArray logLikelihoods=noArray(), - OutputArray labels=noArray(), - OutputArray probs=noArray()) = 0; - - /** Creates empty %EM model. - The model should be trained then using StatModel::train(traindata, flags) method. Alternatively, you - can use one of the EM::train\* methods or load it from file using Algorithm::load\(filename). - */ - CV_WRAP static Ptr create(); - - /** @brief Loads and creates a serialized EM from a file - * - * Use EM::save to serialize and store an EM to disk. - * Load the EM from this file again, by calling this function with the path to the file. - * Optionally specify the node for the file containing the classifier - * - * @param filepath path to serialized EM - * @param nodeName name of node containing the classifier - */ - CV_WRAP static Ptr load(const String& filepath , const String& nodeName = String()); -}; - -/****************************************************************************************\ -* Decision Tree * -\****************************************************************************************/ - -/** @brief The class represents a single decision tree or a collection of decision trees. - -The current public interface of the class allows user to train only a single decision tree, however -the class is capable of storing multiple decision trees and using them for prediction (by summing -responses or using a voting schemes), and the derived from DTrees classes (such as RTrees and Boost) -use this capability to implement decision tree ensembles. - -@sa @ref ml_intro_trees -*/ -class CV_EXPORTS_W DTrees : public StatModel -{ -public: - /** Predict options */ - enum Flags { PREDICT_AUTO=0, PREDICT_SUM=(1<<8), PREDICT_MAX_VOTE=(2<<8), PREDICT_MASK=(3<<8) }; - - /** Cluster possible values of a categorical variable into K\<=maxCategories clusters to - find a suboptimal split. - If a discrete variable, on which the training procedure tries to make a split, takes more than - maxCategories values, the precise best subset estimation may take a very long time because the - algorithm is exponential. Instead, many decision trees engines (including our implementation) - try to find sub-optimal split in this case by clustering all the samples into maxCategories - clusters that is some categories are merged together. The clustering is applied only in n \> - 2-class classification problems for categorical variables with N \> max_categories possible - values. In case of regression and 2-class classification the optimal split can be found - efficiently without employing clustering, thus the parameter is not used in these cases. - Default value is 10.*/ - /** @see setMaxCategories */ - CV_WRAP virtual int getMaxCategories() const = 0; - /** @copybrief getMaxCategories @see getMaxCategories */ - CV_WRAP virtual void setMaxCategories(int val) = 0; - - /** The maximum possible depth of the tree. - That is the training algorithms attempts to split a node while its depth is less than maxDepth. - The root node has zero depth. The actual depth may be smaller if the other termination criteria - are met (see the outline of the training procedure @ref ml_intro_trees "here"), and/or if the - tree is pruned. Default value is INT_MAX.*/ - /** @see setMaxDepth */ - CV_WRAP virtual int getMaxDepth() const = 0; - /** @copybrief getMaxDepth @see getMaxDepth */ - CV_WRAP virtual void setMaxDepth(int val) = 0; - - /** If the number of samples in a node is less than this parameter then the node will not be split. - - Default value is 10.*/ - /** @see setMinSampleCount */ - CV_WRAP virtual int getMinSampleCount() const = 0; - /** @copybrief getMinSampleCount @see getMinSampleCount */ - CV_WRAP virtual void setMinSampleCount(int val) = 0; - - /** If CVFolds \> 1 then algorithms prunes the built decision tree using K-fold - cross-validation procedure where K is equal to CVFolds. - Default value is 10.*/ - /** @see setCVFolds */ - CV_WRAP virtual int getCVFolds() const = 0; - /** @copybrief getCVFolds @see getCVFolds */ - CV_WRAP virtual void setCVFolds(int val) = 0; - - /** If true then surrogate splits will be built. - These splits allow to work with missing data and compute variable importance correctly. - Default value is false. - @note currently it's not implemented.*/ - /** @see setUseSurrogates */ - CV_WRAP virtual bool getUseSurrogates() const = 0; - /** @copybrief getUseSurrogates @see getUseSurrogates */ - CV_WRAP virtual void setUseSurrogates(bool val) = 0; - - /** If true then a pruning will be harsher. - This will make a tree more compact and more resistant to the training data noise but a bit less - accurate. Default value is true.*/ - /** @see setUse1SERule */ - CV_WRAP virtual bool getUse1SERule() const = 0; - /** @copybrief getUse1SERule @see getUse1SERule */ - CV_WRAP virtual void setUse1SERule(bool val) = 0; - - /** If true then pruned branches are physically removed from the tree. - Otherwise they are retained and it is possible to get results from the original unpruned (or - pruned less aggressively) tree. Default value is true.*/ - /** @see setTruncatePrunedTree */ - CV_WRAP virtual bool getTruncatePrunedTree() const = 0; - /** @copybrief getTruncatePrunedTree @see getTruncatePrunedTree */ - CV_WRAP virtual void setTruncatePrunedTree(bool val) = 0; - - /** Termination criteria for regression trees. - If all absolute differences between an estimated value in a node and values of train samples - in this node are less than this parameter then the node will not be split further. Default - value is 0.01f*/ - /** @see setRegressionAccuracy */ - CV_WRAP virtual float getRegressionAccuracy() const = 0; - /** @copybrief getRegressionAccuracy @see getRegressionAccuracy */ - CV_WRAP virtual void setRegressionAccuracy(float val) = 0; - - /** @brief The array of a priori class probabilities, sorted by the class label value. - - The parameter can be used to tune the decision tree preferences toward a certain class. For - example, if you want to detect some rare anomaly occurrence, the training base will likely - contain much more normal cases than anomalies, so a very good classification performance - will be achieved just by considering every case as normal. To avoid this, the priors can be - specified, where the anomaly probability is artificially increased (up to 0.5 or even - greater), so the weight of the misclassified anomalies becomes much bigger, and the tree is - adjusted properly. - - You can also think about this parameter as weights of prediction categories which determine - relative weights that you give to misclassification. That is, if the weight of the first - category is 1 and the weight of the second category is 10, then each mistake in predicting - the second category is equivalent to making 10 mistakes in predicting the first category. - Default value is empty Mat.*/ - /** @see setPriors */ - CV_WRAP virtual cv::Mat getPriors() const = 0; - /** @copybrief getPriors @see getPriors */ - CV_WRAP virtual void setPriors(const cv::Mat &val) = 0; - - /** @brief The class represents a decision tree node. - */ - class CV_EXPORTS Node - { - public: - Node(); - double value; //!< Value at the node: a class label in case of classification or estimated - //!< function value in case of regression. - int classIdx; //!< Class index normalized to 0..class_count-1 range and assigned to the - //!< node. It is used internally in classification trees and tree ensembles. - int parent; //!< Index of the parent node - int left; //!< Index of the left child node - int right; //!< Index of right child node - int defaultDir; //!< Default direction where to go (-1: left or +1: right). It helps in the - //!< case of missing values. - int split; //!< Index of the first split - }; - - /** @brief The class represents split in a decision tree. - */ - class CV_EXPORTS Split - { - public: - Split(); - int varIdx; //!< Index of variable on which the split is created. - bool inversed; //!< If true, then the inverse split rule is used (i.e. left and right - //!< branches are exchanged in the rule expressions below). - float quality; //!< The split quality, a positive number. It is used to choose the best split. - int next; //!< Index of the next split in the list of splits for the node - float c; /**< The threshold value in case of split on an ordered variable. - The rule is: - @code{.none} - if var_value < c - then next_node <- left - else next_node <- right - @endcode */ - int subsetOfs; /**< Offset of the bitset used by the split on a categorical variable. - The rule is: - @code{.none} - if bitset[var_value] == 1 - then next_node <- left - else next_node <- right - @endcode */ - }; - - /** @brief Returns indices of root nodes - */ - virtual const std::vector& getRoots() const = 0; - /** @brief Returns all the nodes - - all the node indices are indices in the returned vector - */ - virtual const std::vector& getNodes() const = 0; - /** @brief Returns all the splits - - all the split indices are indices in the returned vector - */ - virtual const std::vector& getSplits() const = 0; - /** @brief Returns all the bitsets for categorical splits - - Split::subsetOfs is an offset in the returned vector - */ - virtual const std::vector& getSubsets() const = 0; - - /** @brief Creates the empty model - - The static method creates empty decision tree with the specified parameters. It should be then - trained using train method (see StatModel::train). Alternatively, you can load the model from - file using Algorithm::load\(filename). - */ - CV_WRAP static Ptr create(); - - /** @brief Loads and creates a serialized DTrees from a file - * - * Use DTree::save to serialize and store an DTree to disk. - * Load the DTree from this file again, by calling this function with the path to the file. - * Optionally specify the node for the file containing the classifier - * - * @param filepath path to serialized DTree - * @param nodeName name of node containing the classifier - */ - CV_WRAP static Ptr load(const String& filepath , const String& nodeName = String()); -}; - -/****************************************************************************************\ -* Random Trees Classifier * -\****************************************************************************************/ - -/** @brief The class implements the random forest predictor. - -@sa @ref ml_intro_rtrees - */ -class CV_EXPORTS_W RTrees : public DTrees -{ -public: - - /** If true then variable importance will be calculated and then it can be retrieved by RTrees::getVarImportance. - Default value is false.*/ - /** @see setCalculateVarImportance */ - CV_WRAP virtual bool getCalculateVarImportance() const = 0; - /** @copybrief getCalculateVarImportance @see getCalculateVarImportance */ - CV_WRAP virtual void setCalculateVarImportance(bool val) = 0; - - /** The size of the randomly selected subset of features at each tree node and that are used - to find the best split(s). - If you set it to 0 then the size will be set to the square root of the total number of - features. Default value is 0.*/ - /** @see setActiveVarCount */ - CV_WRAP virtual int getActiveVarCount() const = 0; - /** @copybrief getActiveVarCount @see getActiveVarCount */ - CV_WRAP virtual void setActiveVarCount(int val) = 0; - - /** The termination criteria that specifies when the training algorithm stops. - Either when the specified number of trees is trained and added to the ensemble or when - sufficient accuracy (measured as OOB error) is achieved. Typically the more trees you have the - better the accuracy. However, the improvement in accuracy generally diminishes and asymptotes - pass a certain number of trees. Also to keep in mind, the number of tree increases the - prediction time linearly. Default value is TermCriteria(TermCriteria::MAX_ITERS + - TermCriteria::EPS, 50, 0.1)*/ - /** @see setTermCriteria */ - CV_WRAP virtual TermCriteria getTermCriteria() const = 0; - /** @copybrief getTermCriteria @see getTermCriteria */ - CV_WRAP virtual void setTermCriteria(const TermCriteria &val) = 0; - - /** Returns the variable importance array. - The method returns the variable importance vector, computed at the training stage when - CalculateVarImportance is set to true. If this flag was set to false, the empty matrix is - returned. - */ - CV_WRAP virtual Mat getVarImportance() const = 0; - - /** Returns the result of each individual tree in the forest. - In case the model is a regression problem, the method will return each of the trees' - results for each of the sample cases. If the model is a classifier, it will return - a Mat with samples + 1 rows, where the first row gives the class number and the - following rows return the votes each class had for each sample. - @param samples Array containing the samples for which votes will be calculated. - @param results Array where the result of the calculation will be written. - @param flags Flags for defining the type of RTrees. - */ - CV_WRAP void getVotes(InputArray samples, OutputArray results, int flags) const; - - /** Creates the empty model. - Use StatModel::train to train the model, StatModel::train to create and train the model, - Algorithm::load to load the pre-trained model. - */ - CV_WRAP static Ptr create(); - - /** @brief Loads and creates a serialized RTree from a file - * - * Use RTree::save to serialize and store an RTree to disk. - * Load the RTree from this file again, by calling this function with the path to the file. - * Optionally specify the node for the file containing the classifier - * - * @param filepath path to serialized RTree - * @param nodeName name of node containing the classifier - */ - CV_WRAP static Ptr load(const String& filepath , const String& nodeName = String()); -}; - -/****************************************************************************************\ -* Boosted tree classifier * -\****************************************************************************************/ - -/** @brief Boosted tree classifier derived from DTrees - -@sa @ref ml_intro_boost - */ -class CV_EXPORTS_W Boost : public DTrees -{ -public: - /** Type of the boosting algorithm. - See Boost::Types. Default value is Boost::REAL. */ - /** @see setBoostType */ - CV_WRAP virtual int getBoostType() const = 0; - /** @copybrief getBoostType @see getBoostType */ - CV_WRAP virtual void setBoostType(int val) = 0; - - /** The number of weak classifiers. - Default value is 100. */ - /** @see setWeakCount */ - CV_WRAP virtual int getWeakCount() const = 0; - /** @copybrief getWeakCount @see getWeakCount */ - CV_WRAP virtual void setWeakCount(int val) = 0; - - /** A threshold between 0 and 1 used to save computational time. - Samples with summary weight \f$\leq 1 - weight_trim_rate\f$ do not participate in the *next* - iteration of training. Set this parameter to 0 to turn off this functionality. Default value is 0.95.*/ - /** @see setWeightTrimRate */ - CV_WRAP virtual double getWeightTrimRate() const = 0; - /** @copybrief getWeightTrimRate @see getWeightTrimRate */ - CV_WRAP virtual void setWeightTrimRate(double val) = 0; - - /** Boosting type. - Gentle AdaBoost and Real AdaBoost are often the preferable choices. */ - enum Types { - DISCRETE=0, //!< Discrete AdaBoost. - REAL=1, //!< Real AdaBoost. It is a technique that utilizes confidence-rated predictions - //!< and works well with categorical data. - LOGIT=2, //!< LogitBoost. It can produce good regression fits. - GENTLE=3 //!< Gentle AdaBoost. It puts less weight on outlier data points and for that - //!(filename) to load the pre-trained model. */ - CV_WRAP static Ptr create(); - - /** @brief Loads and creates a serialized Boost from a file - * - * Use Boost::save to serialize and store an RTree to disk. - * Load the Boost from this file again, by calling this function with the path to the file. - * Optionally specify the node for the file containing the classifier - * - * @param filepath path to serialized Boost - * @param nodeName name of node containing the classifier - */ - CV_WRAP static Ptr load(const String& filepath , const String& nodeName = String()); -}; - -/****************************************************************************************\ -* Gradient Boosted Trees * -\****************************************************************************************/ - -/*class CV_EXPORTS_W GBTrees : public DTrees -{ -public: - struct CV_EXPORTS_W_MAP Params : public DTrees::Params - { - CV_PROP_RW int weakCount; - CV_PROP_RW int lossFunctionType; - CV_PROP_RW float subsamplePortion; - CV_PROP_RW float shrinkage; - - Params(); - Params( int lossFunctionType, int weakCount, float shrinkage, - float subsamplePortion, int maxDepth, bool useSurrogates ); - }; - - enum {SQUARED_LOSS=0, ABSOLUTE_LOSS, HUBER_LOSS=3, DEVIANCE_LOSS}; - - virtual void setK(int k) = 0; - - virtual float predictSerial( InputArray samples, - OutputArray weakResponses, int flags) const = 0; - - static Ptr create(const Params& p); -};*/ - -/****************************************************************************************\ -* Artificial Neural Networks (ANN) * -\****************************************************************************************/ - -/////////////////////////////////// Multi-Layer Perceptrons ////////////////////////////// - -/** @brief Artificial Neural Networks - Multi-Layer Perceptrons. - -Unlike many other models in ML that are constructed and trained at once, in the MLP model these -steps are separated. First, a network with the specified topology is created using the non-default -constructor or the method ANN_MLP::create. All the weights are set to zeros. Then, the network is -trained using a set of input and output vectors. The training procedure can be repeated more than -once, that is, the weights can be adjusted based on the new training data. - -Additional flags for StatModel::train are available: ANN_MLP::TrainFlags. - -@sa @ref ml_intro_ann - */ -class CV_EXPORTS_W ANN_MLP : public StatModel -{ -public: - /** Available training methods */ - enum TrainingMethods { - BACKPROP=0, //!< The back-propagation algorithm. - RPROP = 1, //!< The RPROP algorithm. See @cite RPROP93 for details. - ANNEAL = 2 //!< The simulated annealing algorithm. See @cite Kirkpatrick83 for details. - }; - - /** Sets training method and common parameters. - @param method Default value is ANN_MLP::RPROP. See ANN_MLP::TrainingMethods. - @param param1 passed to setRpropDW0 for ANN_MLP::RPROP and to setBackpropWeightScale for ANN_MLP::BACKPROP and to initialT for ANN_MLP::ANNEAL. - @param param2 passed to setRpropDWMin for ANN_MLP::RPROP and to setBackpropMomentumScale for ANN_MLP::BACKPROP and to finalT for ANN_MLP::ANNEAL. - */ - CV_WRAP virtual void setTrainMethod(int method, double param1 = 0, double param2 = 0) = 0; - - /** Returns current training method */ - CV_WRAP virtual int getTrainMethod() const = 0; - - /** Initialize the activation function for each neuron. - Currently the default and the only fully supported activation function is ANN_MLP::SIGMOID_SYM. - @param type The type of activation function. See ANN_MLP::ActivationFunctions. - @param param1 The first parameter of the activation function, \f$\alpha\f$. Default value is 0. - @param param2 The second parameter of the activation function, \f$\beta\f$. Default value is 0. - */ - CV_WRAP virtual void setActivationFunction(int type, double param1 = 0, double param2 = 0) = 0; - - /** Integer vector specifying the number of neurons in each layer including the input and output layers. - The very first element specifies the number of elements in the input layer. - The last element - number of elements in the output layer. Default value is empty Mat. - @sa getLayerSizes */ - CV_WRAP virtual void setLayerSizes(InputArray _layer_sizes) = 0; - - /** Integer vector specifying the number of neurons in each layer including the input and output layers. - The very first element specifies the number of elements in the input layer. - The last element - number of elements in the output layer. - @sa setLayerSizes */ - CV_WRAP virtual cv::Mat getLayerSizes() const = 0; - - /** Termination criteria of the training algorithm. - You can specify the maximum number of iterations (maxCount) and/or how much the error could - change between the iterations to make the algorithm continue (epsilon). Default value is - TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, 0.01).*/ - /** @see setTermCriteria */ - CV_WRAP virtual TermCriteria getTermCriteria() const = 0; - /** @copybrief getTermCriteria @see getTermCriteria */ - CV_WRAP virtual void setTermCriteria(TermCriteria val) = 0; - - /** BPROP: Strength of the weight gradient term. - The recommended value is about 0.1. Default value is 0.1.*/ - /** @see setBackpropWeightScale */ - CV_WRAP virtual double getBackpropWeightScale() const = 0; - /** @copybrief getBackpropWeightScale @see getBackpropWeightScale */ - CV_WRAP virtual void setBackpropWeightScale(double val) = 0; - - /** BPROP: Strength of the momentum term (the difference between weights on the 2 previous iterations). - This parameter provides some inertia to smooth the random fluctuations of the weights. It can - vary from 0 (the feature is disabled) to 1 and beyond. The value 0.1 or so is good enough. - Default value is 0.1.*/ - /** @see setBackpropMomentumScale */ - CV_WRAP virtual double getBackpropMomentumScale() const = 0; - /** @copybrief getBackpropMomentumScale @see getBackpropMomentumScale */ - CV_WRAP virtual void setBackpropMomentumScale(double val) = 0; - - /** RPROP: Initial value \f$\Delta_0\f$ of update-values \f$\Delta_{ij}\f$. - Default value is 0.1.*/ - /** @see setRpropDW0 */ - CV_WRAP virtual double getRpropDW0() const = 0; - /** @copybrief getRpropDW0 @see getRpropDW0 */ - CV_WRAP virtual void setRpropDW0(double val) = 0; - - /** RPROP: Increase factor \f$\eta^+\f$. - It must be \>1. Default value is 1.2.*/ - /** @see setRpropDWPlus */ - CV_WRAP virtual double getRpropDWPlus() const = 0; - /** @copybrief getRpropDWPlus @see getRpropDWPlus */ - CV_WRAP virtual void setRpropDWPlus(double val) = 0; - - /** RPROP: Decrease factor \f$\eta^-\f$. - It must be \<1. Default value is 0.5.*/ - /** @see setRpropDWMinus */ - CV_WRAP virtual double getRpropDWMinus() const = 0; - /** @copybrief getRpropDWMinus @see getRpropDWMinus */ - CV_WRAP virtual void setRpropDWMinus(double val) = 0; - - /** RPROP: Update-values lower limit \f$\Delta_{min}\f$. - It must be positive. Default value is FLT_EPSILON.*/ - /** @see setRpropDWMin */ - CV_WRAP virtual double getRpropDWMin() const = 0; - /** @copybrief getRpropDWMin @see getRpropDWMin */ - CV_WRAP virtual void setRpropDWMin(double val) = 0; - - /** RPROP: Update-values upper limit \f$\Delta_{max}\f$. - It must be \>1. Default value is 50.*/ - /** @see setRpropDWMax */ - CV_WRAP virtual double getRpropDWMax() const = 0; - /** @copybrief getRpropDWMax @see getRpropDWMax */ - CV_WRAP virtual void setRpropDWMax(double val) = 0; - - /** ANNEAL: Update initial temperature. - It must be \>=0. Default value is 10.*/ - /** @see setAnnealInitialT */ - CV_WRAP double getAnnealInitialT() const; - /** @copybrief getAnnealInitialT @see getAnnealInitialT */ - CV_WRAP void setAnnealInitialT(double val); - - /** ANNEAL: Update final temperature. - It must be \>=0 and less than initialT. Default value is 0.1.*/ - /** @see setAnnealFinalT */ - CV_WRAP double getAnnealFinalT() const; - /** @copybrief getAnnealFinalT @see getAnnealFinalT */ - CV_WRAP void setAnnealFinalT(double val); - - /** ANNEAL: Update cooling ratio. - It must be \>0 and less than 1. Default value is 0.95.*/ - /** @see setAnnealCoolingRatio */ - CV_WRAP double getAnnealCoolingRatio() const; - /** @copybrief getAnnealCoolingRatio @see getAnnealCoolingRatio */ - CV_WRAP void setAnnealCoolingRatio(double val); - - /** ANNEAL: Update iteration per step. - It must be \>0 . Default value is 10.*/ - /** @see setAnnealItePerStep */ - CV_WRAP int getAnnealItePerStep() const; - /** @copybrief getAnnealItePerStep @see getAnnealItePerStep */ - CV_WRAP void setAnnealItePerStep(int val); - - /** @brief Set/initialize anneal RNG */ - void setAnnealEnergyRNG(const RNG& rng); - - /** possible activation functions */ - enum ActivationFunctions { - /** Identity function: \f$f(x)=x\f$ */ - IDENTITY = 0, - /** Symmetrical sigmoid: \f$f(x)=\beta*(1-e^{-\alpha x})/(1+e^{-\alpha x})\f$ - @note - If you are using the default sigmoid activation function with the default parameter values - fparam1=0 and fparam2=0 then the function used is y = 1.7159\*tanh(2/3 \* x), so the output - will range from [-1.7159, 1.7159], instead of [0,1].*/ - SIGMOID_SYM = 1, - /** Gaussian function: \f$f(x)=\beta e^{-\alpha x*x}\f$ */ - GAUSSIAN = 2, - /** ReLU function: \f$f(x)=max(0,x)\f$ */ - RELU = 3, - /** Leaky ReLU function: for x>0 \f$f(x)=x \f$ and x<=0 \f$f(x)=\alpha x \f$*/ - LEAKYRELU= 4 - }; - - /** Train options */ - enum TrainFlags { - /** Update the network weights, rather than compute them from scratch. In the latter case - the weights are initialized using the Nguyen-Widrow algorithm. */ - UPDATE_WEIGHTS = 1, - /** Do not normalize the input vectors. If this flag is not set, the training algorithm - normalizes each input feature independently, shifting its mean value to 0 and making the - standard deviation equal to 1. If the network is assumed to be updated frequently, the new - training data could be much different from original one. In this case, you should take care - of proper normalization. */ - NO_INPUT_SCALE = 2, - /** Do not normalize the output vectors. If the flag is not set, the training algorithm - normalizes each output feature independently, by transforming it to the certain range - depending on the used activation function. */ - NO_OUTPUT_SCALE = 4 - }; - - CV_WRAP virtual Mat getWeights(int layerIdx) const = 0; - - /** @brief Creates empty model - - Use StatModel::train to train the model, Algorithm::load\(filename) to load the pre-trained model. - Note that the train method has optional flags: ANN_MLP::TrainFlags. - */ - CV_WRAP static Ptr create(); - - /** @brief Loads and creates a serialized ANN from a file - * - * Use ANN::save to serialize and store an ANN to disk. - * Load the ANN from this file again, by calling this function with the path to the file. - * - * @param filepath path to serialized ANN - */ - CV_WRAP static Ptr load(const String& filepath); - -}; - -/****************************************************************************************\ -* Logistic Regression * -\****************************************************************************************/ - -/** @brief Implements Logistic Regression classifier. - -@sa @ref ml_intro_lr - */ -class CV_EXPORTS_W LogisticRegression : public StatModel -{ -public: - - /** Learning rate. */ - /** @see setLearningRate */ - CV_WRAP virtual double getLearningRate() const = 0; - /** @copybrief getLearningRate @see getLearningRate */ - CV_WRAP virtual void setLearningRate(double val) = 0; - - /** Number of iterations. */ - /** @see setIterations */ - CV_WRAP virtual int getIterations() const = 0; - /** @copybrief getIterations @see getIterations */ - CV_WRAP virtual void setIterations(int val) = 0; - - /** Kind of regularization to be applied. See LogisticRegression::RegKinds. */ - /** @see setRegularization */ - CV_WRAP virtual int getRegularization() const = 0; - /** @copybrief getRegularization @see getRegularization */ - CV_WRAP virtual void setRegularization(int val) = 0; - - /** Kind of training method used. See LogisticRegression::Methods. */ - /** @see setTrainMethod */ - CV_WRAP virtual int getTrainMethod() const = 0; - /** @copybrief getTrainMethod @see getTrainMethod */ - CV_WRAP virtual void setTrainMethod(int val) = 0; - - /** Specifies the number of training samples taken in each step of Mini-Batch Gradient - Descent. Will only be used if using LogisticRegression::MINI_BATCH training algorithm. It - has to take values less than the total number of training samples. */ - /** @see setMiniBatchSize */ - CV_WRAP virtual int getMiniBatchSize() const = 0; - /** @copybrief getMiniBatchSize @see getMiniBatchSize */ - CV_WRAP virtual void setMiniBatchSize(int val) = 0; - - /** Termination criteria of the algorithm. */ - /** @see setTermCriteria */ - CV_WRAP virtual TermCriteria getTermCriteria() const = 0; - /** @copybrief getTermCriteria @see getTermCriteria */ - CV_WRAP virtual void setTermCriteria(TermCriteria val) = 0; - - //! Regularization kinds - enum RegKinds { - REG_DISABLE = -1, //!< Regularization disabled - REG_L1 = 0, //!< %L1 norm - REG_L2 = 1 //!< %L2 norm - }; - - //! Training methods - enum Methods { - BATCH = 0, - MINI_BATCH = 1 //!< Set MiniBatchSize to a positive integer when using this method. - }; - - /** @brief Predicts responses for input samples and returns a float type. - - @param samples The input data for the prediction algorithm. Matrix [m x n], where each row - contains variables (features) of one object being classified. Should have data type CV_32F. - @param results Predicted labels as a column matrix of type CV_32S. - @param flags Not used. - */ - CV_WRAP virtual float predict( InputArray samples, OutputArray results=noArray(), int flags=0 ) const CV_OVERRIDE = 0; - - /** @brief This function returns the trained parameters arranged across rows. - - For a two class classifcation problem, it returns a row matrix. It returns learnt parameters of - the Logistic Regression as a matrix of type CV_32F. - */ - CV_WRAP virtual Mat get_learnt_thetas() const = 0; - - /** @brief Creates empty model. - - Creates Logistic Regression model with parameters given. - */ - CV_WRAP static Ptr create(); - - /** @brief Loads and creates a serialized LogisticRegression from a file - * - * Use LogisticRegression::save to serialize and store an LogisticRegression to disk. - * Load the LogisticRegression from this file again, by calling this function with the path to the file. - * Optionally specify the node for the file containing the classifier - * - * @param filepath path to serialized LogisticRegression - * @param nodeName name of node containing the classifier - */ - CV_WRAP static Ptr load(const String& filepath , const String& nodeName = String()); -}; - - -/****************************************************************************************\ -* Stochastic Gradient Descent SVM Classifier * -\****************************************************************************************/ - -/*! -@brief Stochastic Gradient Descent SVM classifier - -SVMSGD provides a fast and easy-to-use implementation of the SVM classifier using the Stochastic Gradient Descent approach, -as presented in @cite bottou2010large. - -The classifier has following parameters: -- model type, -- margin type, -- margin regularization (\f$\lambda\f$), -- initial step size (\f$\gamma_0\f$), -- step decreasing power (\f$c\f$), -- and termination criteria. - -The model type may have one of the following values: \ref SGD and \ref ASGD. - -- \ref SGD is the classic version of SVMSGD classifier: every next step is calculated by the formula - \f[w_{t+1} = w_t - \gamma(t) \frac{dQ_i}{dw} |_{w = w_t}\f] - where - - \f$w_t\f$ is the weights vector for decision function at step \f$t\f$, - - \f$\gamma(t)\f$ is the step size of model parameters at the iteration \f$t\f$, it is decreased on each step by the formula - \f$\gamma(t) = \gamma_0 (1 + \lambda \gamma_0 t) ^ {-c}\f$ - - \f$Q_i\f$ is the target functional from SVM task for sample with number \f$i\f$, this sample is chosen stochastically on each step of the algorithm. - -- \ref ASGD is Average Stochastic Gradient Descent SVM Classifier. ASGD classifier averages weights vector on each step of algorithm by the formula -\f$\widehat{w}_{t+1} = \frac{t}{1+t}\widehat{w}_{t} + \frac{1}{1+t}w_{t+1}\f$ - -The recommended model type is ASGD (following @cite bottou2010large). - -The margin type may have one of the following values: \ref SOFT_MARGIN or \ref HARD_MARGIN. - -- You should use \ref HARD_MARGIN type, if you have linearly separable sets. -- You should use \ref SOFT_MARGIN type, if you have non-linearly separable sets or sets with outliers. -- In the general case (if you know nothing about linear separability of your sets), use SOFT_MARGIN. - -The other parameters may be described as follows: -- Margin regularization parameter is responsible for weights decreasing at each step and for the strength of restrictions on outliers - (the less the parameter, the less probability that an outlier will be ignored). - Recommended value for SGD model is 0.0001, for ASGD model is 0.00001. - -- Initial step size parameter is the initial value for the step size \f$\gamma(t)\f$. - You will have to find the best initial step for your problem. - -- Step decreasing power is the power parameter for \f$\gamma(t)\f$ decreasing by the formula, mentioned above. - Recommended value for SGD model is 1, for ASGD model is 0.75. - -- Termination criteria can be TermCriteria::COUNT, TermCriteria::EPS or TermCriteria::COUNT + TermCriteria::EPS. - You will have to find the best termination criteria for your problem. - -Note that the parameters margin regularization, initial step size, and step decreasing power should be positive. - -To use SVMSGD algorithm do as follows: - -- first, create the SVMSGD object. The algoorithm will set optimal parameters by default, but you can set your own parameters via functions setSvmsgdType(), - setMarginType(), setMarginRegularization(), setInitialStepSize(), and setStepDecreasingPower(). - -- then the SVM model can be trained using the train features and the correspondent labels by the method train(). - -- after that, the label of a new feature vector can be predicted using the method predict(). - -@code -// Create empty object -cv::Ptr svmsgd = SVMSGD::create(); - -// Train the Stochastic Gradient Descent SVM -svmsgd->train(trainData); - -// Predict labels for the new samples -svmsgd->predict(samples, responses); -@endcode - -*/ - -class CV_EXPORTS_W SVMSGD : public cv::ml::StatModel -{ -public: - - /** SVMSGD type. - ASGD is often the preferable choice. */ - enum SvmsgdType - { - SGD, //!< Stochastic Gradient Descent - ASGD //!< Average Stochastic Gradient Descent - }; - - /** Margin type.*/ - enum MarginType - { - SOFT_MARGIN, //!< General case, suits to the case of non-linearly separable sets, allows outliers. - HARD_MARGIN //!< More accurate for the case of linearly separable sets. - }; - - /** - * @return the weights of the trained model (decision function f(x) = weights * x + shift). - */ - CV_WRAP virtual Mat getWeights() = 0; - - /** - * @return the shift of the trained model (decision function f(x) = weights * x + shift). - */ - CV_WRAP virtual float getShift() = 0; - - /** @brief Creates empty model. - * Use StatModel::train to train the model. Since %SVMSGD has several parameters, you may want to - * find the best parameters for your problem or use setOptimalParameters() to set some default parameters. - */ - CV_WRAP static Ptr create(); - - /** @brief Loads and creates a serialized SVMSGD from a file - * - * Use SVMSGD::save to serialize and store an SVMSGD to disk. - * Load the SVMSGD from this file again, by calling this function with the path to the file. - * Optionally specify the node for the file containing the classifier - * - * @param filepath path to serialized SVMSGD - * @param nodeName name of node containing the classifier - */ - CV_WRAP static Ptr load(const String& filepath , const String& nodeName = String()); - - /** @brief Function sets optimal parameters values for chosen SVM SGD model. - * @param svmsgdType is the type of SVMSGD classifier. - * @param marginType is the type of margin constraint. - */ - CV_WRAP virtual void setOptimalParameters(int svmsgdType = SVMSGD::ASGD, int marginType = SVMSGD::SOFT_MARGIN) = 0; - - /** @brief %Algorithm type, one of SVMSGD::SvmsgdType. */ - /** @see setSvmsgdType */ - CV_WRAP virtual int getSvmsgdType() const = 0; - /** @copybrief getSvmsgdType @see getSvmsgdType */ - CV_WRAP virtual void setSvmsgdType(int svmsgdType) = 0; - - /** @brief %Margin type, one of SVMSGD::MarginType. */ - /** @see setMarginType */ - CV_WRAP virtual int getMarginType() const = 0; - /** @copybrief getMarginType @see getMarginType */ - CV_WRAP virtual void setMarginType(int marginType) = 0; - - /** @brief Parameter marginRegularization of a %SVMSGD optimization problem. */ - /** @see setMarginRegularization */ - CV_WRAP virtual float getMarginRegularization() const = 0; - /** @copybrief getMarginRegularization @see getMarginRegularization */ - CV_WRAP virtual void setMarginRegularization(float marginRegularization) = 0; - - /** @brief Parameter initialStepSize of a %SVMSGD optimization problem. */ - /** @see setInitialStepSize */ - CV_WRAP virtual float getInitialStepSize() const = 0; - /** @copybrief getInitialStepSize @see getInitialStepSize */ - CV_WRAP virtual void setInitialStepSize(float InitialStepSize) = 0; - - /** @brief Parameter stepDecreasingPower of a %SVMSGD optimization problem. */ - /** @see setStepDecreasingPower */ - CV_WRAP virtual float getStepDecreasingPower() const = 0; - /** @copybrief getStepDecreasingPower @see getStepDecreasingPower */ - CV_WRAP virtual void setStepDecreasingPower(float stepDecreasingPower) = 0; - - /** @brief Termination criteria of the training algorithm. - You can specify the maximum number of iterations (maxCount) and/or how much the error could - change between the iterations to make the algorithm continue (epsilon).*/ - /** @see setTermCriteria */ - CV_WRAP virtual TermCriteria getTermCriteria() const = 0; - /** @copybrief getTermCriteria @see getTermCriteria */ - CV_WRAP virtual void setTermCriteria(const cv::TermCriteria &val) = 0; -}; - - -/****************************************************************************************\ -* Auxiliary functions declarations * -\****************************************************************************************/ - -/** @brief Generates _sample_ from multivariate normal distribution - -@param mean an average row vector -@param cov symmetric covariation matrix -@param nsamples returned samples count -@param samples returned samples array -*/ -CV_EXPORTS void randMVNormal( InputArray mean, InputArray cov, int nsamples, OutputArray samples); - -/** @brief Creates test set */ -CV_EXPORTS void createConcentricSpheresTestSet( int nsamples, int nfeatures, int nclasses, - OutputArray samples, OutputArray responses); - -/** @brief Artificial Neural Networks - Multi-Layer Perceptrons. - -@sa @ref ml_intro_ann -*/ -class CV_EXPORTS_W ANN_MLP_ANNEAL : public ANN_MLP -{ -public: - /** @see setAnnealInitialT */ - CV_WRAP virtual double getAnnealInitialT() const = 0; - /** @copybrief getAnnealInitialT @see getAnnealInitialT */ - CV_WRAP virtual void setAnnealInitialT(double val) = 0; - - /** ANNEAL: Update final temperature. - It must be \>=0 and less than initialT. Default value is 0.1.*/ - /** @see setAnnealFinalT */ - CV_WRAP virtual double getAnnealFinalT() const = 0; - /** @copybrief getAnnealFinalT @see getAnnealFinalT */ - CV_WRAP virtual void setAnnealFinalT(double val) = 0; - - /** ANNEAL: Update cooling ratio. - It must be \>0 and less than 1. Default value is 0.95.*/ - /** @see setAnnealCoolingRatio */ - CV_WRAP virtual double getAnnealCoolingRatio() const = 0; - /** @copybrief getAnnealCoolingRatio @see getAnnealCoolingRatio */ - CV_WRAP virtual void setAnnealCoolingRatio(double val) = 0; - - /** ANNEAL: Update iteration per step. - It must be \>0 . Default value is 10.*/ - /** @see setAnnealItePerStep */ - CV_WRAP virtual int getAnnealItePerStep() const = 0; - /** @copybrief getAnnealItePerStep @see getAnnealItePerStep */ - CV_WRAP virtual void setAnnealItePerStep(int val) = 0; - - /** @brief Set/initialize anneal RNG */ - virtual void setAnnealEnergyRNG(const RNG& rng) = 0; -}; - - -/****************************************************************************************\ -* Simulated annealing solver * -\****************************************************************************************/ - -#ifdef CV_DOXYGEN -/** @brief This class declares example interface for system state used in simulated annealing optimization algorithm. - -@note This class is not defined in C++ code and can't be use directly - you need your own implementation with the same methods. -*/ -struct SimulatedAnnealingSolverSystem -{ - /** Give energy value for a state of system.*/ - double energy() const; - /** Function which change the state of system (random perturbation).*/ - void changeState(); - /** Function to reverse to the previous state. Can be called once only after changeState(). */ - void reverseState(); -}; -#endif // CV_DOXYGEN - -/** @brief The class implements simulated annealing for optimization. - -@cite Kirkpatrick83 for details - -@param solverSystem optimization system (see SimulatedAnnealingSolverSystem) -@param initialTemperature initial temperature -@param finalTemperature final temperature -@param coolingRatio temperature step multiplies -@param iterationsPerStep number of iterations per temperature changing step -@param lastTemperature optional output for last used temperature -@param rngEnergy specify custom random numbers generator (cv::theRNG() by default) -*/ -template -int simulatedAnnealingSolver(SimulatedAnnealingSolverSystem& solverSystem, - double initialTemperature, double finalTemperature, double coolingRatio, - size_t iterationsPerStep, - CV_OUT double* lastTemperature = NULL, - cv::RNG& rngEnergy = cv::theRNG() -); - -//! @} ml - -} -} - -#include - -#endif // __cplusplus -#endif // OPENCV_ML_HPP - -/* End of file. */ diff --git a/opencv/include/opencv2/ml/ml.hpp b/opencv/include/opencv2/ml/ml.hpp deleted file mode 100644 index f6f9cd8..0000000 --- a/opencv/include/opencv2/ml/ml.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/ml.hpp" diff --git a/opencv/include/opencv2/ml/ml.inl.hpp b/opencv/include/opencv2/ml/ml.inl.hpp deleted file mode 100644 index dc9c783..0000000 --- a/opencv/include/opencv2/ml/ml.inl.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -#ifndef OPENCV_ML_INL_HPP -#define OPENCV_ML_INL_HPP - -namespace cv { namespace ml { - -// declared in ml.hpp -template -int simulatedAnnealingSolver(SimulatedAnnealingSolverSystem& solverSystem, - double initialTemperature, double finalTemperature, double coolingRatio, - size_t iterationsPerStep, - CV_OUT double* lastTemperature, - cv::RNG& rngEnergy -) -{ - CV_Assert(finalTemperature > 0); - CV_Assert(initialTemperature > finalTemperature); - CV_Assert(iterationsPerStep > 0); - CV_Assert(coolingRatio < 1.0f); - double Ti = initialTemperature; - double previousEnergy = solverSystem.energy(); - int exchange = 0; - while (Ti > finalTemperature) - { - for (size_t i = 0; i < iterationsPerStep; i++) - { - solverSystem.changeState(); - double newEnergy = solverSystem.energy(); - if (newEnergy < previousEnergy) - { - previousEnergy = newEnergy; - exchange++; - } - else - { - double r = rngEnergy.uniform(0.0, 1.0); - if (r < std::exp(-(newEnergy - previousEnergy) / Ti)) - { - previousEnergy = newEnergy; - exchange++; - } - else - { - solverSystem.reverseState(); - } - } - } - Ti *= coolingRatio; - } - if (lastTemperature) - *lastTemperature = Ti; - return exchange; -} - -}} //namespace - -#endif // OPENCV_ML_INL_HPP diff --git a/opencv/include/opencv2/objdetect.hpp b/opencv/include/opencv2/objdetect.hpp deleted file mode 100644 index cc9c4e1..0000000 --- a/opencv/include/opencv2/objdetect.hpp +++ /dev/null @@ -1,743 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OBJDETECT_HPP -#define OPENCV_OBJDETECT_HPP - -#include "opencv2/core.hpp" - -/** -@defgroup objdetect Object Detection - -Haar Feature-based Cascade Classifier for Object Detection ----------------------------------------------------------- - -The object detector described below has been initially proposed by Paul Viola @cite Viola01 and -improved by Rainer Lienhart @cite Lienhart02 . - -First, a classifier (namely a *cascade of boosted classifiers working with haar-like features*) is -trained with a few hundred sample views of a particular object (i.e., a face or a car), called -positive examples, that are scaled to the same size (say, 20x20), and negative examples - arbitrary -images of the same size. - -After a classifier is trained, it can be applied to a region of interest (of the same size as used -during the training) in an input image. The classifier outputs a "1" if the region is likely to show -the object (i.e., face/car), and "0" otherwise. To search for the object in the whole image one can -move the search window across the image and check every location using the classifier. The -classifier is designed so that it can be easily "resized" in order to be able to find the objects of -interest at different sizes, which is more efficient than resizing the image itself. So, to find an -object of an unknown size in the image the scan procedure should be done several times at different -scales. - -The word "cascade" in the classifier name means that the resultant classifier consists of several -simpler classifiers (*stages*) that are applied subsequently to a region of interest until at some -stage the candidate is rejected or all the stages are passed. The word "boosted" means that the -classifiers at every stage of the cascade are complex themselves and they are built out of basic -classifiers using one of four different boosting techniques (weighted voting). Currently Discrete -Adaboost, Real Adaboost, Gentle Adaboost and Logitboost are supported. The basic classifiers are -decision-tree classifiers with at least 2 leaves. Haar-like features are the input to the basic -classifiers, and are calculated as described below. The current algorithm uses the following -Haar-like features: - -![image](pics/haarfeatures.png) - -The feature used in a particular classifier is specified by its shape (1a, 2b etc.), position within -the region of interest and the scale (this scale is not the same as the scale used at the detection -stage, though these two scales are multiplied). For example, in the case of the third line feature -(2c) the response is calculated as the difference between the sum of image pixels under the -rectangle covering the whole feature (including the two white stripes and the black stripe in the -middle) and the sum of the image pixels under the black stripe multiplied by 3 in order to -compensate for the differences in the size of areas. The sums of pixel values over a rectangular -regions are calculated rapidly using integral images (see below and the integral description). - -To see the object detector at work, have a look at the facedetect demo: - - -The following reference is for the detection part only. There is a separate application called -opencv_traincascade that can train a cascade of boosted classifiers from a set of samples. - -@note In the new C++ interface it is also possible to use LBP (local binary pattern) features in -addition to Haar-like features. .. [Viola01] Paul Viola and Michael J. Jones. Rapid Object Detection -using a Boosted Cascade of Simple Features. IEEE CVPR, 2001. The paper is available online at - - -@{ - @defgroup objdetect_c C API -@} - */ - -typedef struct CvHaarClassifierCascade CvHaarClassifierCascade; - -namespace cv -{ - -//! @addtogroup objdetect -//! @{ - -///////////////////////////// Object Detection //////////////////////////// - -//! class for grouping object candidates, detected by Cascade Classifier, HOG etc. -//! instance of the class is to be passed to cv::partition (see cxoperations.hpp) -class CV_EXPORTS SimilarRects -{ -public: - SimilarRects(double _eps) : eps(_eps) {} - inline bool operator()(const Rect& r1, const Rect& r2) const - { - double delta = eps * ((std::min)(r1.width, r2.width) + (std::min)(r1.height, r2.height)) * 0.5; - return std::abs(r1.x - r2.x) <= delta && - std::abs(r1.y - r2.y) <= delta && - std::abs(r1.x + r1.width - r2.x - r2.width) <= delta && - std::abs(r1.y + r1.height - r2.y - r2.height) <= delta; - } - double eps; -}; - -/** @brief Groups the object candidate rectangles. - -@param rectList Input/output vector of rectangles. Output vector includes retained and grouped -rectangles. (The Python list is not modified in place.) -@param groupThreshold Minimum possible number of rectangles minus 1. The threshold is used in a -group of rectangles to retain it. -@param eps Relative difference between sides of the rectangles to merge them into a group. - -The function is a wrapper for the generic function partition . It clusters all the input rectangles -using the rectangle equivalence criteria that combines rectangles with similar sizes and similar -locations. The similarity is defined by eps. When eps=0 , no clustering is done at all. If -\f$\texttt{eps}\rightarrow +\inf\f$ , all the rectangles are put in one cluster. Then, the small -clusters containing less than or equal to groupThreshold rectangles are rejected. In each other -cluster, the average rectangle is computed and put into the output rectangle list. - */ -CV_EXPORTS void groupRectangles(std::vector& rectList, int groupThreshold, double eps = 0.2); -/** @overload */ -CV_EXPORTS_W void groupRectangles(CV_IN_OUT std::vector& rectList, CV_OUT std::vector& weights, - int groupThreshold, double eps = 0.2); -/** @overload */ -CV_EXPORTS void groupRectangles(std::vector& rectList, int groupThreshold, - double eps, std::vector* weights, std::vector* levelWeights ); -/** @overload */ -CV_EXPORTS void groupRectangles(std::vector& rectList, std::vector& rejectLevels, - std::vector& levelWeights, int groupThreshold, double eps = 0.2); -/** @overload */ -CV_EXPORTS void groupRectangles_meanshift(std::vector& rectList, std::vector& foundWeights, - std::vector& foundScales, - double detectThreshold = 0.0, Size winDetSize = Size(64, 128)); - -template<> CV_EXPORTS void DefaultDeleter::operator ()(CvHaarClassifierCascade* obj) const; - -enum { CASCADE_DO_CANNY_PRUNING = 1, - CASCADE_SCALE_IMAGE = 2, - CASCADE_FIND_BIGGEST_OBJECT = 4, - CASCADE_DO_ROUGH_SEARCH = 8 - }; - -class CV_EXPORTS_W BaseCascadeClassifier : public Algorithm -{ -public: - virtual ~BaseCascadeClassifier(); - virtual bool empty() const CV_OVERRIDE = 0; - virtual bool load( const String& filename ) = 0; - virtual void detectMultiScale( InputArray image, - CV_OUT std::vector& objects, - double scaleFactor, - int minNeighbors, int flags, - Size minSize, Size maxSize ) = 0; - - virtual void detectMultiScale( InputArray image, - CV_OUT std::vector& objects, - CV_OUT std::vector& numDetections, - double scaleFactor, - int minNeighbors, int flags, - Size minSize, Size maxSize ) = 0; - - virtual void detectMultiScale( InputArray image, - CV_OUT std::vector& objects, - CV_OUT std::vector& rejectLevels, - CV_OUT std::vector& levelWeights, - double scaleFactor, - int minNeighbors, int flags, - Size minSize, Size maxSize, - bool outputRejectLevels ) = 0; - - virtual bool isOldFormatCascade() const = 0; - virtual Size getOriginalWindowSize() const = 0; - virtual int getFeatureType() const = 0; - virtual void* getOldCascade() = 0; - - class CV_EXPORTS MaskGenerator - { - public: - virtual ~MaskGenerator() {} - virtual Mat generateMask(const Mat& src)=0; - virtual void initializeMask(const Mat& /*src*/) { } - }; - virtual void setMaskGenerator(const Ptr& maskGenerator) = 0; - virtual Ptr getMaskGenerator() = 0; -}; - -/** @example samples/cpp/facedetect.cpp -This program demonstrates usage of the Cascade classifier class -\image html Cascade_Classifier_Tutorial_Result_Haar.jpg "Sample screenshot" width=321 height=254 -*/ -/** @brief Cascade classifier class for object detection. - */ -class CV_EXPORTS_W CascadeClassifier -{ -public: - CV_WRAP CascadeClassifier(); - /** @brief Loads a classifier from a file. - - @param filename Name of the file from which the classifier is loaded. - */ - CV_WRAP CascadeClassifier(const String& filename); - ~CascadeClassifier(); - /** @brief Checks whether the classifier has been loaded. - */ - CV_WRAP bool empty() const; - /** @brief Loads a classifier from a file. - - @param filename Name of the file from which the classifier is loaded. The file may contain an old - HAAR classifier trained by the haartraining application or a new cascade classifier trained by the - traincascade application. - */ - CV_WRAP bool load( const String& filename ); - /** @brief Reads a classifier from a FileStorage node. - - @note The file may contain a new cascade classifier (trained traincascade application) only. - */ - CV_WRAP bool read( const FileNode& node ); - - /** @brief Detects objects of different sizes in the input image. The detected objects are returned as a list - of rectangles. - - @param image Matrix of the type CV_8U containing an image where objects are detected. - @param objects Vector of rectangles where each rectangle contains the detected object, the - rectangles may be partially outside the original image. - @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. - @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have - to retain it. - @param flags Parameter with the same meaning for an old cascade as in the function - cvHaarDetectObjects. It is not used for a new cascade. - @param minSize Minimum possible object size. Objects smaller than that are ignored. - @param maxSize Maximum possible object size. Objects larger than that are ignored. If `maxSize == minSize` model is evaluated on single scale. - - The function is parallelized with the TBB library. - - @note - - (Python) A face detection example using cascade classifiers can be found at - opencv_source_code/samples/python/facedetect.py - */ - CV_WRAP void detectMultiScale( InputArray image, - CV_OUT std::vector& objects, - double scaleFactor = 1.1, - int minNeighbors = 3, int flags = 0, - Size minSize = Size(), - Size maxSize = Size() ); - - /** @overload - @param image Matrix of the type CV_8U containing an image where objects are detected. - @param objects Vector of rectangles where each rectangle contains the detected object, the - rectangles may be partially outside the original image. - @param numDetections Vector of detection numbers for the corresponding objects. An object's number - of detections is the number of neighboring positively classified rectangles that were joined - together to form the object. - @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. - @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have - to retain it. - @param flags Parameter with the same meaning for an old cascade as in the function - cvHaarDetectObjects. It is not used for a new cascade. - @param minSize Minimum possible object size. Objects smaller than that are ignored. - @param maxSize Maximum possible object size. Objects larger than that are ignored. If `maxSize == minSize` model is evaluated on single scale. - */ - CV_WRAP_AS(detectMultiScale2) void detectMultiScale( InputArray image, - CV_OUT std::vector& objects, - CV_OUT std::vector& numDetections, - double scaleFactor=1.1, - int minNeighbors=3, int flags=0, - Size minSize=Size(), - Size maxSize=Size() ); - - /** @overload - This function allows you to retrieve the final stage decision certainty of classification. - For this, one needs to set `outputRejectLevels` on true and provide the `rejectLevels` and `levelWeights` parameter. - For each resulting detection, `levelWeights` will then contain the certainty of classification at the final stage. - This value can then be used to separate strong from weaker classifications. - - A code sample on how to use it efficiently can be found below: - @code - Mat img; - vector weights; - vector levels; - vector detections; - CascadeClassifier model("/path/to/your/model.xml"); - model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); - cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; - @endcode - */ - CV_WRAP_AS(detectMultiScale3) void detectMultiScale( InputArray image, - CV_OUT std::vector& objects, - CV_OUT std::vector& rejectLevels, - CV_OUT std::vector& levelWeights, - double scaleFactor = 1.1, - int minNeighbors = 3, int flags = 0, - Size minSize = Size(), - Size maxSize = Size(), - bool outputRejectLevels = false ); - - CV_WRAP bool isOldFormatCascade() const; - CV_WRAP Size getOriginalWindowSize() const; - CV_WRAP int getFeatureType() const; - void* getOldCascade(); - - CV_WRAP static bool convert(const String& oldcascade, const String& newcascade); - - void setMaskGenerator(const Ptr& maskGenerator); - Ptr getMaskGenerator(); - - Ptr cc; -}; - -CV_EXPORTS Ptr createFaceDetectionMaskGenerator(); - -//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector ////////////// - -//! struct for detection region of interest (ROI) -struct DetectionROI -{ - //! scale(size) of the bounding box - double scale; - //! set of requested locations to be evaluated - std::vector locations; - //! vector that will contain confidence values for each location - std::vector confidences; -}; - -/**@brief Implementation of HOG (Histogram of Oriented Gradients) descriptor and object detector. - -the HOG descriptor algorithm introduced by Navneet Dalal and Bill Triggs @cite Dalal2005 . - -useful links: - -https://hal.inria.fr/inria-00548512/document/ - -https://en.wikipedia.org/wiki/Histogram_of_oriented_gradients - -https://software.intel.com/en-us/ipp-dev-reference-histogram-of-oriented-gradients-hog-descriptor - -http://www.learnopencv.com/histogram-of-oriented-gradients - -http://www.learnopencv.com/handwritten-digits-classification-an-opencv-c-python-tutorial - - */ -struct CV_EXPORTS_W HOGDescriptor -{ -public: - enum { L2Hys = 0 //!< Default histogramNormType - }; - enum { DEFAULT_NLEVELS = 64 //!< Default nlevels value. - }; - /**@brief Creates the HOG descriptor and detector with default params. - - aqual to HOGDescriptor(Size(64,128), Size(16,16), Size(8,8), Size(8,8), 9, 1 ) - */ - CV_WRAP HOGDescriptor() : winSize(64,128), blockSize(16,16), blockStride(8,8), - cellSize(8,8), nbins(9), derivAperture(1), winSigma(-1), - histogramNormType(HOGDescriptor::L2Hys), L2HysThreshold(0.2), gammaCorrection(true), - free_coef(-1.f), nlevels(HOGDescriptor::DEFAULT_NLEVELS), signedGradient(false) - {} - - /** @overload - @param _winSize sets winSize with given value. - @param _blockSize sets blockSize with given value. - @param _blockStride sets blockStride with given value. - @param _cellSize sets cellSize with given value. - @param _nbins sets nbins with given value. - @param _derivAperture sets derivAperture with given value. - @param _winSigma sets winSigma with given value. - @param _histogramNormType sets histogramNormType with given value. - @param _L2HysThreshold sets L2HysThreshold with given value. - @param _gammaCorrection sets gammaCorrection with given value. - @param _nlevels sets nlevels with given value. - @param _signedGradient sets signedGradient with given value. - */ - CV_WRAP HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, - Size _cellSize, int _nbins, int _derivAperture=1, double _winSigma=-1, - int _histogramNormType=HOGDescriptor::L2Hys, - double _L2HysThreshold=0.2, bool _gammaCorrection=false, - int _nlevels=HOGDescriptor::DEFAULT_NLEVELS, bool _signedGradient=false) - : winSize(_winSize), blockSize(_blockSize), blockStride(_blockStride), cellSize(_cellSize), - nbins(_nbins), derivAperture(_derivAperture), winSigma(_winSigma), - histogramNormType(_histogramNormType), L2HysThreshold(_L2HysThreshold), - gammaCorrection(_gammaCorrection), free_coef(-1.f), nlevels(_nlevels), signedGradient(_signedGradient) - {} - - /** @overload - @param filename the file name containing HOGDescriptor properties and coefficients of the trained classifier - */ - CV_WRAP HOGDescriptor(const String& filename) - { - load(filename); - } - - /** @overload - @param d the HOGDescriptor which cloned to create a new one. - */ - HOGDescriptor(const HOGDescriptor& d) - { - d.copyTo(*this); - } - - /**@brief Default destructor. - */ - virtual ~HOGDescriptor() {} - - /**@brief Returns the number of coefficients required for the classification. - */ - CV_WRAP size_t getDescriptorSize() const; - - /** @brief Checks if detector size equal to descriptor size. - */ - CV_WRAP bool checkDetectorSize() const; - - /** @brief Returns winSigma value - */ - CV_WRAP double getWinSigma() const; - - /**@example samples/cpp/peopledetect.cpp - */ - /**@brief Sets coefficients for the linear SVM classifier. - @param _svmdetector coefficients for the linear SVM classifier. - */ - CV_WRAP virtual void setSVMDetector(InputArray _svmdetector); - - /** @brief Reads HOGDescriptor parameters from a file node. - @param fn File node - */ - virtual bool read(FileNode& fn); - - /** @brief Stores HOGDescriptor parameters in a file storage. - @param fs File storage - @param objname Object name - */ - virtual void write(FileStorage& fs, const String& objname) const; - - /** @brief loads coefficients for the linear SVM classifier from a file - @param filename Name of the file to read. - @param objname The optional name of the node to read (if empty, the first top-level node will be used). - */ - CV_WRAP virtual bool load(const String& filename, const String& objname = String()); - - /** @brief saves coefficients for the linear SVM classifier to a file - @param filename File name - @param objname Object name - */ - CV_WRAP virtual void save(const String& filename, const String& objname = String()) const; - - /** @brief clones the HOGDescriptor - @param c cloned HOGDescriptor - */ - virtual void copyTo(HOGDescriptor& c) const; - - /**@example samples/cpp/train_HOG.cpp - */ - /** @brief Computes HOG descriptors of given image. - @param img Matrix of the type CV_8U containing an image where HOG features will be calculated. - @param descriptors Matrix of the type CV_32F - @param winStride Window stride. It must be a multiple of block stride. - @param padding Padding - @param locations Vector of Point - */ - CV_WRAP virtual void compute(InputArray img, - CV_OUT std::vector& descriptors, - Size winStride = Size(), Size padding = Size(), - const std::vector& locations = std::vector()) const; - - /** @brief Performs object detection without a multi-scale window. - @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected. - @param foundLocations Vector of point where each point contains left-top corner point of detected object boundaries. - @param weights Vector that will contain confidence values for each detected object. - @param hitThreshold Threshold for the distance between features and SVM classifying plane. - Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient). - But if the free coefficient is omitted (which is allowed), you can specify it manually here. - @param winStride Window stride. It must be a multiple of block stride. - @param padding Padding - @param searchLocations Vector of Point includes set of requested locations to be evaluated. - */ - CV_WRAP virtual void detect(const Mat& img, CV_OUT std::vector& foundLocations, - CV_OUT std::vector& weights, - double hitThreshold = 0, Size winStride = Size(), - Size padding = Size(), - const std::vector& searchLocations = std::vector()) const; - - /** @brief Performs object detection without a multi-scale window. - @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected. - @param foundLocations Vector of point where each point contains left-top corner point of detected object boundaries. - @param hitThreshold Threshold for the distance between features and SVM classifying plane. - Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient). - But if the free coefficient is omitted (which is allowed), you can specify it manually here. - @param winStride Window stride. It must be a multiple of block stride. - @param padding Padding - @param searchLocations Vector of Point includes locations to search. - */ - virtual void detect(const Mat& img, CV_OUT std::vector& foundLocations, - double hitThreshold = 0, Size winStride = Size(), - Size padding = Size(), - const std::vector& searchLocations=std::vector()) const; - - /** @brief Detects objects of different sizes in the input image. The detected objects are returned as a list - of rectangles. - @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected. - @param foundLocations Vector of rectangles where each rectangle contains the detected object. - @param foundWeights Vector that will contain confidence values for each detected object. - @param hitThreshold Threshold for the distance between features and SVM classifying plane. - Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient). - But if the free coefficient is omitted (which is allowed), you can specify it manually here. - @param winStride Window stride. It must be a multiple of block stride. - @param padding Padding - @param scale Coefficient of the detection window increase. - @param finalThreshold Final threshold - @param useMeanshiftGrouping indicates grouping algorithm - */ - CV_WRAP virtual void detectMultiScale(InputArray img, CV_OUT std::vector& foundLocations, - CV_OUT std::vector& foundWeights, double hitThreshold = 0, - Size winStride = Size(), Size padding = Size(), double scale = 1.05, - double finalThreshold = 2.0,bool useMeanshiftGrouping = false) const; - - /** @brief Detects objects of different sizes in the input image. The detected objects are returned as a list - of rectangles. - @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected. - @param foundLocations Vector of rectangles where each rectangle contains the detected object. - @param hitThreshold Threshold for the distance between features and SVM classifying plane. - Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient). - But if the free coefficient is omitted (which is allowed), you can specify it manually here. - @param winStride Window stride. It must be a multiple of block stride. - @param padding Padding - @param scale Coefficient of the detection window increase. - @param finalThreshold Final threshold - @param useMeanshiftGrouping indicates grouping algorithm - */ - virtual void detectMultiScale(InputArray img, CV_OUT std::vector& foundLocations, - double hitThreshold = 0, Size winStride = Size(), - Size padding = Size(), double scale = 1.05, - double finalThreshold = 2.0, bool useMeanshiftGrouping = false) const; - - /** @brief Computes gradients and quantized gradient orientations. - @param img Matrix contains the image to be computed - @param grad Matrix of type CV_32FC2 contains computed gradients - @param angleOfs Matrix of type CV_8UC2 contains quantized gradient orientations - @param paddingTL Padding from top-left - @param paddingBR Padding from bottom-right - */ - CV_WRAP virtual void computeGradient(const Mat& img, CV_OUT Mat& grad, CV_OUT Mat& angleOfs, - Size paddingTL = Size(), Size paddingBR = Size()) const; - - /** @brief Returns coefficients of the classifier trained for people detection (for 64x128 windows). - */ - CV_WRAP static std::vector getDefaultPeopleDetector(); - - /**@example samples/tapi/hog.cpp - */ - /** @brief Returns coefficients of the classifier trained for people detection (for 48x96 windows). - */ - CV_WRAP static std::vector getDaimlerPeopleDetector(); - - //! Detection window size. Align to block size and block stride. Default value is Size(64,128). - CV_PROP Size winSize; - - //! Block size in pixels. Align to cell size. Default value is Size(16,16). - CV_PROP Size blockSize; - - //! Block stride. It must be a multiple of cell size. Default value is Size(8,8). - CV_PROP Size blockStride; - - //! Cell size. Default value is Size(8,8). - CV_PROP Size cellSize; - - //! Number of bins used in the calculation of histogram of gradients. Default value is 9. - CV_PROP int nbins; - - //! not documented - CV_PROP int derivAperture; - - //! Gaussian smoothing window parameter. - CV_PROP double winSigma; - - //! histogramNormType - CV_PROP int histogramNormType; - - //! L2-Hys normalization method shrinkage. - CV_PROP double L2HysThreshold; - - //! Flag to specify whether the gamma correction preprocessing is required or not. - CV_PROP bool gammaCorrection; - - //! coefficients for the linear SVM classifier. - CV_PROP std::vector svmDetector; - - //! coefficients for the linear SVM classifier used when OpenCL is enabled - UMat oclSvmDetector; - - //! not documented - float free_coef; - - //! Maximum number of detection window increases. Default value is 64 - CV_PROP int nlevels; - - //! Indicates signed gradient will be used or not - CV_PROP bool signedGradient; - - /** @brief evaluate specified ROI and return confidence value for each location - @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected. - @param locations Vector of Point - @param foundLocations Vector of Point where each Point is detected object's top-left point. - @param confidences confidences - @param hitThreshold Threshold for the distance between features and SVM classifying plane. Usually - it is 0 and should be specified in the detector coefficients (as the last free coefficient). But if - the free coefficient is omitted (which is allowed), you can specify it manually here - @param winStride winStride - @param padding padding - */ - virtual void detectROI(const cv::Mat& img, const std::vector &locations, - CV_OUT std::vector& foundLocations, CV_OUT std::vector& confidences, - double hitThreshold = 0, cv::Size winStride = Size(), - cv::Size padding = Size()) const; - - /** @brief evaluate specified ROI and return confidence value for each location in multiple scales - @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected. - @param foundLocations Vector of rectangles where each rectangle contains the detected object. - @param locations Vector of DetectionROI - @param hitThreshold Threshold for the distance between features and SVM classifying plane. Usually it is 0 and should be specified - in the detector coefficients (as the last free coefficient). But if the free coefficient is omitted (which is allowed), you can specify it manually here. - @param groupThreshold Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it. - */ - virtual void detectMultiScaleROI(const cv::Mat& img, - CV_OUT std::vector& foundLocations, - std::vector& locations, - double hitThreshold = 0, - int groupThreshold = 0) const; - - /** @brief read/parse Dalal's alt model file - @param modelfile Path of Dalal's alt model file. - */ - void readALTModel(String modelfile); - - /** @brief Groups the object candidate rectangles. - @param rectList Input/output vector of rectangles. Output vector includes retained and grouped rectangles. (The Python list is not modified in place.) - @param weights Input/output vector of weights of rectangles. Output vector includes weights of retained and grouped rectangles. (The Python list is not modified in place.) - @param groupThreshold Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it. - @param eps Relative difference between sides of the rectangles to merge them into a group. - */ - void groupRectangles(std::vector& rectList, std::vector& weights, int groupThreshold, double eps) const; -}; - -class CV_EXPORTS_W QRCodeDetector -{ -public: - CV_WRAP QRCodeDetector(); - ~QRCodeDetector(); - - /** @brief sets the epsilon used during the horizontal scan of QR code stop marker detection. - @param epsX Epsilon neighborhood, which allows you to determine the horizontal pattern - of the scheme 1:1:3:1:1 according to QR code standard. - */ - CV_WRAP void setEpsX(double epsX); - /** @brief sets the epsilon used during the vertical scan of QR code stop marker detection. - @param epsY Epsilon neighborhood, which allows you to determine the vertical pattern - of the scheme 1:1:3:1:1 according to QR code standard. - */ - CV_WRAP void setEpsY(double epsY); - - /** @brief Detects QR code in image and returns the quadrangle containing the code. - @param img grayscale or color (BGR) image containing (or not) QR code. - @param points Output vector of vertices of the minimum-area quadrangle containing the code. - */ - CV_WRAP bool detect(InputArray img, OutputArray points) const; - - /** @brief Decodes QR code in image once it's found by the detect() method. - Returns UTF8-encoded output string or empty string if the code cannot be decoded. - - @param img grayscale or color (BGR) image containing QR code. - @param points Quadrangle vertices found by detect() method (or some other algorithm). - @param straight_qrcode The optional output image containing rectified and binarized QR code - */ - CV_WRAP cv::String decode(InputArray img, InputArray points, OutputArray straight_qrcode = noArray()); - - /** @brief Both detects and decodes QR code - - @param img grayscale or color (BGR) image containing QR code. - @param points opiotnal output array of vertices of the found QR code quadrangle. Will be empty if not found. - @param straight_qrcode The optional output image containing rectified and binarized QR code - */ - CV_WRAP cv::String detectAndDecode(InputArray img, OutputArray points=noArray(), - OutputArray straight_qrcode = noArray()); -protected: - struct Impl; - Ptr p; -}; - -/** @brief Detect QR code in image and return minimum area of quadrangle that describes QR code. - @param in Matrix of the type CV_8UC1 containing an image where QR code are detected. - @param points Output vector of vertices of a quadrangle of minimal area that describes QR code. - @param eps_x Epsilon neighborhood, which allows you to determine the horizontal pattern of the scheme 1:1:3:1:1 according to QR code standard. - @param eps_y Epsilon neighborhood, which allows you to determine the vertical pattern of the scheme 1:1:3:1:1 according to QR code standard. - */ -CV_EXPORTS bool detectQRCode(InputArray in, std::vector &points, double eps_x = 0.2, double eps_y = 0.1); - -/** @brief Decode QR code in image and return text that is encrypted in QR code. - @param in Matrix of the type CV_8UC1 containing an image where QR code are detected. - @param points Input vector of vertices of a quadrangle of minimal area that describes QR code. - @param decoded_info String information that is encrypted in QR code. - @param straight_qrcode Matrix of the type CV_8UC1 containing an binary straight QR code. - */ -CV_EXPORTS bool decodeQRCode(InputArray in, InputArray points, std::string &decoded_info, OutputArray straight_qrcode = noArray()); - -//! @} objdetect -} - -#include "opencv2/objdetect/detection_based_tracker.hpp" - -#ifndef DISABLE_OPENCV_24_COMPATIBILITY -#include "opencv2/objdetect/objdetect_c.h" -#endif - -#endif diff --git a/opencv/include/opencv2/objdetect/detection_based_tracker.hpp b/opencv/include/opencv2/objdetect/detection_based_tracker.hpp deleted file mode 100644 index 07dd587..0000000 --- a/opencv/include/opencv2/objdetect/detection_based_tracker.hpp +++ /dev/null @@ -1,227 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OBJDETECT_DBT_HPP -#define OPENCV_OBJDETECT_DBT_HPP - -#include - -// After this condition removal update blacklist for bindings: modules/python/common.cmake -#if defined(__linux__) || defined(LINUX) || defined(__APPLE__) || defined(__ANDROID__) || \ - defined(CV_CXX11) - -#include - -namespace cv -{ - -//! @addtogroup objdetect -//! @{ - -class CV_EXPORTS DetectionBasedTracker -{ - public: - struct CV_EXPORTS Parameters - { - int maxTrackLifetime; - int minDetectionPeriod; //the minimal time between run of the big object detector (on the whole frame) in ms (1000 mean 1 sec), default=0 - - Parameters(); - }; - - class IDetector - { - public: - IDetector(): - minObjSize(96, 96), - maxObjSize(INT_MAX, INT_MAX), - minNeighbours(2), - scaleFactor(1.1f) - {} - - virtual void detect(const cv::Mat& image, std::vector& objects) = 0; - - void setMinObjectSize(const cv::Size& min) - { - minObjSize = min; - } - void setMaxObjectSize(const cv::Size& max) - { - maxObjSize = max; - } - cv::Size getMinObjectSize() const - { - return minObjSize; - } - cv::Size getMaxObjectSize() const - { - return maxObjSize; - } - float getScaleFactor() - { - return scaleFactor; - } - void setScaleFactor(float value) - { - scaleFactor = value; - } - int getMinNeighbours() - { - return minNeighbours; - } - void setMinNeighbours(int value) - { - minNeighbours = value; - } - virtual ~IDetector() {} - - protected: - cv::Size minObjSize; - cv::Size maxObjSize; - int minNeighbours; - float scaleFactor; - }; - - DetectionBasedTracker(cv::Ptr mainDetector, cv::Ptr trackingDetector, const Parameters& params); - virtual ~DetectionBasedTracker(); - - virtual bool run(); - virtual void stop(); - virtual void resetTracking(); - - virtual void process(const cv::Mat& imageGray); - - bool setParameters(const Parameters& params); - const Parameters& getParameters() const; - - - typedef std::pair Object; - virtual void getObjects(std::vector& result) const; - virtual void getObjects(std::vector& result) const; - - enum ObjectStatus - { - DETECTED_NOT_SHOWN_YET, - DETECTED, - DETECTED_TEMPORARY_LOST, - WRONG_OBJECT - }; - struct ExtObject - { - int id; - cv::Rect location; - ObjectStatus status; - ExtObject(int _id, cv::Rect _location, ObjectStatus _status) - :id(_id), location(_location), status(_status) - { - } - }; - virtual void getObjects(std::vector& result) const; - - - virtual int addObject(const cv::Rect& location); //returns id of the new object - - protected: - class SeparateDetectionWork; - cv::Ptr separateDetectionWork; - friend void* workcycleObjectDetectorFunction(void* p); - - struct InnerParameters - { - int numLastPositionsToTrack; - int numStepsToWaitBeforeFirstShow; - int numStepsToTrackWithoutDetectingIfObjectHasNotBeenShown; - int numStepsToShowWithoutDetecting; - - float coeffTrackingWindowSize; - float coeffObjectSizeToTrack; - float coeffObjectSpeedUsingInPrediction; - - InnerParameters(); - }; - Parameters parameters; - InnerParameters innerParameters; - - struct TrackedObject - { - typedef std::vector PositionsVector; - - PositionsVector lastPositions; - - int numDetectedFrames; - int numFramesNotDetected; - int id; - - TrackedObject(const cv::Rect& rect):numDetectedFrames(1), numFramesNotDetected(0) - { - lastPositions.push_back(rect); - id=getNextId(); - }; - - static int getNextId() - { - static int _id=0; - return _id++; - } - }; - - int numTrackedSteps; - std::vector trackedObjects; - - std::vector weightsPositionsSmoothing; - std::vector weightsSizesSmoothing; - - cv::Ptr cascadeForTracking; - - void updateTrackedObjects(const std::vector& detectedObjects); - cv::Rect calcTrackedObjectPositionToShow(int i) const; - cv::Rect calcTrackedObjectPositionToShow(int i, ObjectStatus& status) const; - void detectInRegion(const cv::Mat& img, const cv::Rect& r, std::vector& detectedObjectsInRegions); -}; - -//! @} objdetect - -} //end of cv namespace -#endif - -#endif diff --git a/opencv/include/opencv2/objdetect/objdetect.hpp b/opencv/include/opencv2/objdetect/objdetect.hpp deleted file mode 100644 index 3ee284f..0000000 --- a/opencv/include/opencv2/objdetect/objdetect.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/objdetect.hpp" diff --git a/opencv/include/opencv2/objdetect/objdetect_c.h b/opencv/include/opencv2/objdetect/objdetect_c.h deleted file mode 100644 index 67dc2f4..0000000 --- a/opencv/include/opencv2/objdetect/objdetect_c.h +++ /dev/null @@ -1,166 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_OBJDETECT_C_H -#define OPENCV_OBJDETECT_C_H - -#include "opencv2/core/core_c.h" - -#ifdef __cplusplus -#include -#include - -extern "C" { -#endif - -/** @addtogroup objdetect_c - @{ - */ - -/****************************************************************************************\ -* Haar-like Object Detection functions * -\****************************************************************************************/ - -#define CV_HAAR_MAGIC_VAL 0x42500000 -#define CV_TYPE_NAME_HAAR "opencv-haar-classifier" - -#define CV_IS_HAAR_CLASSIFIER( haar ) \ - ((haar) != NULL && \ - (((const CvHaarClassifierCascade*)(haar))->flags & CV_MAGIC_MASK)==CV_HAAR_MAGIC_VAL) - -#define CV_HAAR_FEATURE_MAX 3 -#define CV_HAAR_STAGE_MAX 1000 - -typedef struct CvHaarFeature -{ - int tilted; - struct - { - CvRect r; - float weight; - } rect[CV_HAAR_FEATURE_MAX]; -} CvHaarFeature; - -typedef struct CvHaarClassifier -{ - int count; - CvHaarFeature* haar_feature; - float* threshold; - int* left; - int* right; - float* alpha; -} CvHaarClassifier; - -typedef struct CvHaarStageClassifier -{ - int count; - float threshold; - CvHaarClassifier* classifier; - - int next; - int child; - int parent; -} CvHaarStageClassifier; - -typedef struct CvHidHaarClassifierCascade CvHidHaarClassifierCascade; - -typedef struct CvHaarClassifierCascade -{ - int flags; - int count; - CvSize orig_window_size; - CvSize real_window_size; - double scale; - CvHaarStageClassifier* stage_classifier; - CvHidHaarClassifierCascade* hid_cascade; -} CvHaarClassifierCascade; - -typedef struct CvAvgComp -{ - CvRect rect; - int neighbors; -} CvAvgComp; - -/* Loads haar classifier cascade from a directory. - It is obsolete: convert your cascade to xml and use cvLoad instead */ -CVAPI(CvHaarClassifierCascade*) cvLoadHaarClassifierCascade( - const char* directory, CvSize orig_window_size); - -CVAPI(void) cvReleaseHaarClassifierCascade( CvHaarClassifierCascade** cascade ); - -#define CV_HAAR_DO_CANNY_PRUNING 1 -#define CV_HAAR_SCALE_IMAGE 2 -#define CV_HAAR_FIND_BIGGEST_OBJECT 4 -#define CV_HAAR_DO_ROUGH_SEARCH 8 - -CVAPI(CvSeq*) cvHaarDetectObjects( const CvArr* image, - CvHaarClassifierCascade* cascade, CvMemStorage* storage, - double scale_factor CV_DEFAULT(1.1), - int min_neighbors CV_DEFAULT(3), int flags CV_DEFAULT(0), - CvSize min_size CV_DEFAULT(cvSize(0,0)), CvSize max_size CV_DEFAULT(cvSize(0,0))); - -/* sets images for haar classifier cascade */ -CVAPI(void) cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* cascade, - const CvArr* sum, const CvArr* sqsum, - const CvArr* tilted_sum, double scale ); - -/* runs the cascade on the specified window */ -CVAPI(int) cvRunHaarClassifierCascade( const CvHaarClassifierCascade* cascade, - CvPoint pt, int start_stage CV_DEFAULT(0)); - -/** @} objdetect_c */ - -#ifdef __cplusplus -} - -CV_EXPORTS CvSeq* cvHaarDetectObjectsForROC( const CvArr* image, - CvHaarClassifierCascade* cascade, CvMemStorage* storage, - std::vector& rejectLevels, std::vector& levelWeightds, - double scale_factor = 1.1, - int min_neighbors = 3, int flags = 0, - CvSize min_size = cvSize(0, 0), CvSize max_size = cvSize(0, 0), - bool outputRejectLevels = false ); - -#endif - -#endif /* OPENCV_OBJDETECT_C_H */ diff --git a/opencv/include/opencv2/opencv.hpp b/opencv/include/opencv2/opencv.hpp deleted file mode 100644 index 4048158..0000000 --- a/opencv/include/opencv2/opencv.hpp +++ /dev/null @@ -1,139 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2010, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_ALL_HPP -#define OPENCV_ALL_HPP - -// File that defines what modules where included during the build of OpenCV -// These are purely the defines of the correct HAVE_OPENCV_modulename values -#include "opencv2/opencv_modules.hpp" - -// Then the list of defines is checked to include the correct headers -// Core library is always included --> without no OpenCV functionality available -#include "opencv2/core.hpp" - -// Then the optional modules are checked -#ifdef HAVE_OPENCV_CALIB3D -#include "opencv2/calib3d.hpp" -#endif -#ifdef HAVE_OPENCV_FEATURES2D -#include "opencv2/features2d.hpp" -#endif -#ifdef HAVE_OPENCV_DNN -#include "opencv2/dnn.hpp" -#endif -#ifdef HAVE_OPENCV_FLANN -#include "opencv2/flann.hpp" -#endif -#ifdef HAVE_OPENCV_HIGHGUI -#include "opencv2/highgui.hpp" -#endif -#ifdef HAVE_OPENCV_IMGCODECS -#include "opencv2/imgcodecs.hpp" -#endif -#ifdef HAVE_OPENCV_IMGPROC -#include "opencv2/imgproc.hpp" -#endif -#ifdef HAVE_OPENCV_ML -#include "opencv2/ml.hpp" -#endif -#ifdef HAVE_OPENCV_OBJDETECT -#include "opencv2/objdetect.hpp" -#endif -#ifdef HAVE_OPENCV_PHOTO -#include "opencv2/photo.hpp" -#endif -#ifdef HAVE_OPENCV_SHAPE -#include "opencv2/shape.hpp" -#endif -#ifdef HAVE_OPENCV_STITCHING -#include "opencv2/stitching.hpp" -#endif -#ifdef HAVE_OPENCV_SUPERRES -#include "opencv2/superres.hpp" -#endif -#ifdef HAVE_OPENCV_VIDEO -#include "opencv2/video.hpp" -#endif -#ifdef HAVE_OPENCV_VIDEOIO -#include "opencv2/videoio.hpp" -#endif -#ifdef HAVE_OPENCV_VIDEOSTAB -#include "opencv2/videostab.hpp" -#endif -#ifdef HAVE_OPENCV_VIZ -#include "opencv2/viz.hpp" -#endif - -// Finally CUDA specific entries are checked and added -#ifdef HAVE_OPENCV_CUDAARITHM -#include "opencv2/cudaarithm.hpp" -#endif -#ifdef HAVE_OPENCV_CUDABGSEGM -#include "opencv2/cudabgsegm.hpp" -#endif -#ifdef HAVE_OPENCV_CUDACODEC -#include "opencv2/cudacodec.hpp" -#endif -#ifdef HAVE_OPENCV_CUDAFEATURES2D -#include "opencv2/cudafeatures2d.hpp" -#endif -#ifdef HAVE_OPENCV_CUDAFILTERS -#include "opencv2/cudafilters.hpp" -#endif -#ifdef HAVE_OPENCV_CUDAIMGPROC -#include "opencv2/cudaimgproc.hpp" -#endif -#ifdef HAVE_OPENCV_CUDAOBJDETECT -#include "opencv2/cudaobjdetect.hpp" -#endif -#ifdef HAVE_OPENCV_CUDAOPTFLOW -#include "opencv2/cudaoptflow.hpp" -#endif -#ifdef HAVE_OPENCV_CUDASTEREO -#include "opencv2/cudastereo.hpp" -#endif -#ifdef HAVE_OPENCV_CUDAWARPING -#include "opencv2/cudawarping.hpp" -#endif - -#endif diff --git a/opencv/include/opencv2/opencv_modules.hpp b/opencv/include/opencv2/opencv_modules.hpp deleted file mode 100644 index e14f3ec..0000000 --- a/opencv/include/opencv2/opencv_modules.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * ** File generated automatically, do not modify ** - * - * This file defines the list of modules available in current build configuration - * - * -*/ - -// This definition means that OpenCV is built with enabled non-free code. -// For example, patented algorithms for non-profit/non-commercial use only. -/* #undef OPENCV_ENABLE_NONFREE */ - -#define HAVE_OPENCV_CALIB3D -#define HAVE_OPENCV_CORE -#define HAVE_OPENCV_DNN -#define HAVE_OPENCV_FEATURES2D -#define HAVE_OPENCV_FLANN -#define HAVE_OPENCV_HIGHGUI -#define HAVE_OPENCV_IMGCODECS -#define HAVE_OPENCV_IMGPROC -#define HAVE_OPENCV_ML -#define HAVE_OPENCV_OBJDETECT -#define HAVE_OPENCV_PHOTO -#define HAVE_OPENCV_SHAPE -#define HAVE_OPENCV_STITCHING -#define HAVE_OPENCV_SUPERRES -#define HAVE_OPENCV_VIDEO -#define HAVE_OPENCV_VIDEOIO -#define HAVE_OPENCV_VIDEOSTAB - - diff --git a/opencv/include/opencv2/photo.hpp b/opencv/include/opencv2/photo.hpp deleted file mode 100644 index 8b0652a..0000000 --- a/opencv/include/opencv2/photo.hpp +++ /dev/null @@ -1,860 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2008-2012, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_PHOTO_HPP -#define OPENCV_PHOTO_HPP - -#include "opencv2/core.hpp" -#include "opencv2/imgproc.hpp" - -/** -@defgroup photo Computational Photography - -This module includes photo processing algorithms -@{ - @defgroup photo_inpaint Inpainting - @defgroup photo_denoise Denoising - @defgroup photo_hdr HDR imaging - -This section describes high dynamic range imaging algorithms namely tonemapping, exposure alignment, -camera calibration with multiple exposures and exposure fusion. - - @defgroup photo_decolor Contrast Preserving Decolorization - -Useful links: - -http://www.cse.cuhk.edu.hk/leojia/projects/color2gray/index.html - - @defgroup photo_clone Seamless Cloning - -Useful links: - -https://www.learnopencv.com/seamless-cloning-using-opencv-python-cpp - - @defgroup photo_render Non-Photorealistic Rendering - -Useful links: - -http://www.inf.ufrgs.br/~eslgastal/DomainTransform - -https://www.learnopencv.com/non-photorealistic-rendering-using-opencv-python-c/ -@} - */ - -namespace cv -{ - -//! @addtogroup photo -//! @{ - -//! @addtogroup photo_inpaint -//! @{ -//! the inpainting algorithm -enum -{ - INPAINT_NS = 0, //!< Use Navier-Stokes based method - INPAINT_TELEA = 1 //!< Use the algorithm proposed by Alexandru Telea @cite Telea04 -}; - -/** @brief Restores the selected region in an image using the region neighborhood. - -@param src Input 8-bit, 16-bit unsigned or 32-bit float 1-channel or 8-bit 3-channel image. -@param inpaintMask Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that -needs to be inpainted. -@param dst Output image with the same size and type as src . -@param inpaintRadius Radius of a circular neighborhood of each point inpainted that is considered -by the algorithm. -@param flags Inpainting method that could be cv::INPAINT_NS or cv::INPAINT_TELEA - -The function reconstructs the selected image area from the pixel near the area boundary. The -function may be used to remove dust and scratches from a scanned photo, or to remove undesirable -objects from still images or video. See for more details. - -@note - - An example using the inpainting technique can be found at - opencv_source_code/samples/cpp/inpaint.cpp - - (Python) An example using the inpainting technique can be found at - opencv_source_code/samples/python/inpaint.py - */ -CV_EXPORTS_W void inpaint( InputArray src, InputArray inpaintMask, - OutputArray dst, double inpaintRadius, int flags ); - -//! @} photo_inpaint - -//! @addtogroup photo_denoise -//! @{ - -/** @brief Perform image denoising using Non-local Means Denoising algorithm - with several computational -optimizations. Noise expected to be a gaussian white noise - -@param src Input 8-bit 1-channel, 2-channel, 3-channel or 4-channel image. -@param dst Output image with the same size and type as src . -@param templateWindowSize Size in pixels of the template patch that is used to compute weights. -Should be odd. Recommended value 7 pixels -@param searchWindowSize Size in pixels of the window that is used to compute weighted average for -given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater -denoising time. Recommended value 21 pixels -@param h Parameter regulating filter strength. Big h value perfectly removes noise but also -removes image details, smaller h value preserves details but also preserves some noise - -This function expected to be applied to grayscale images. For colored images look at -fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored -image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting -image to CIELAB colorspace and then separately denoise L and AB components with different h -parameter. - */ -CV_EXPORTS_W void fastNlMeansDenoising( InputArray src, OutputArray dst, float h = 3, - int templateWindowSize = 7, int searchWindowSize = 21); - -/** @brief Perform image denoising using Non-local Means Denoising algorithm - with several computational -optimizations. Noise expected to be a gaussian white noise - -@param src Input 8-bit or 16-bit (only with NORM_L1) 1-channel, -2-channel, 3-channel or 4-channel image. -@param dst Output image with the same size and type as src . -@param templateWindowSize Size in pixels of the template patch that is used to compute weights. -Should be odd. Recommended value 7 pixels -@param searchWindowSize Size in pixels of the window that is used to compute weighted average for -given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater -denoising time. Recommended value 21 pixels -@param h Array of parameters regulating filter strength, either one -parameter applied to all channels or one per channel in dst. Big h value -perfectly removes noise but also removes image details, smaller h -value preserves details but also preserves some noise -@param normType Type of norm used for weight calculation. Can be either NORM_L2 or NORM_L1 - -This function expected to be applied to grayscale images. For colored images look at -fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored -image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting -image to CIELAB colorspace and then separately denoise L and AB components with different h -parameter. - */ -CV_EXPORTS_W void fastNlMeansDenoising( InputArray src, OutputArray dst, - const std::vector& h, - int templateWindowSize = 7, int searchWindowSize = 21, - int normType = NORM_L2); - -/** @brief Modification of fastNlMeansDenoising function for colored images - -@param src Input 8-bit 3-channel image. -@param dst Output image with the same size and type as src . -@param templateWindowSize Size in pixels of the template patch that is used to compute weights. -Should be odd. Recommended value 7 pixels -@param searchWindowSize Size in pixels of the window that is used to compute weighted average for -given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater -denoising time. Recommended value 21 pixels -@param h Parameter regulating filter strength for luminance component. Bigger h value perfectly -removes noise but also removes image details, smaller h value preserves details but also preserves -some noise -@param hColor The same as h but for color components. For most images value equals 10 -will be enough to remove colored noise and do not distort colors - -The function converts image to CIELAB colorspace and then separately denoise L and AB components -with given h parameters using fastNlMeansDenoising function. - */ -CV_EXPORTS_W void fastNlMeansDenoisingColored( InputArray src, OutputArray dst, - float h = 3, float hColor = 3, - int templateWindowSize = 7, int searchWindowSize = 21); - -/** @brief Modification of fastNlMeansDenoising function for images sequence where consecutive images have been -captured in small period of time. For example video. This version of the function is for grayscale -images or for manual manipulation with colorspaces. For more details see - - -@param srcImgs Input 8-bit 1-channel, 2-channel, 3-channel or -4-channel images sequence. All images should have the same type and -size. -@param imgToDenoiseIndex Target image to denoise index in srcImgs sequence -@param temporalWindowSize Number of surrounding images to use for target image denoising. Should -be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to -imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise -srcImgs[imgToDenoiseIndex] image. -@param dst Output image with the same size and type as srcImgs images. -@param templateWindowSize Size in pixels of the template patch that is used to compute weights. -Should be odd. Recommended value 7 pixels -@param searchWindowSize Size in pixels of the window that is used to compute weighted average for -given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater -denoising time. Recommended value 21 pixels -@param h Parameter regulating filter strength. Bigger h value -perfectly removes noise but also removes image details, smaller h -value preserves details but also preserves some noise - */ -CV_EXPORTS_W void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst, - int imgToDenoiseIndex, int temporalWindowSize, - float h = 3, int templateWindowSize = 7, int searchWindowSize = 21); - -/** @brief Modification of fastNlMeansDenoising function for images sequence where consecutive images have been -captured in small period of time. For example video. This version of the function is for grayscale -images or for manual manipulation with colorspaces. For more details see - - -@param srcImgs Input 8-bit or 16-bit (only with NORM_L1) 1-channel, -2-channel, 3-channel or 4-channel images sequence. All images should -have the same type and size. -@param imgToDenoiseIndex Target image to denoise index in srcImgs sequence -@param temporalWindowSize Number of surrounding images to use for target image denoising. Should -be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to -imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise -srcImgs[imgToDenoiseIndex] image. -@param dst Output image with the same size and type as srcImgs images. -@param templateWindowSize Size in pixels of the template patch that is used to compute weights. -Should be odd. Recommended value 7 pixels -@param searchWindowSize Size in pixels of the window that is used to compute weighted average for -given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater -denoising time. Recommended value 21 pixels -@param h Array of parameters regulating filter strength, either one -parameter applied to all channels or one per channel in dst. Big h value -perfectly removes noise but also removes image details, smaller h -value preserves details but also preserves some noise -@param normType Type of norm used for weight calculation. Can be either NORM_L2 or NORM_L1 - */ -CV_EXPORTS_W void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst, - int imgToDenoiseIndex, int temporalWindowSize, - const std::vector& h, - int templateWindowSize = 7, int searchWindowSize = 21, - int normType = NORM_L2); - -/** @brief Modification of fastNlMeansDenoisingMulti function for colored images sequences - -@param srcImgs Input 8-bit 3-channel images sequence. All images should have the same type and -size. -@param imgToDenoiseIndex Target image to denoise index in srcImgs sequence -@param temporalWindowSize Number of surrounding images to use for target image denoising. Should -be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to -imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise -srcImgs[imgToDenoiseIndex] image. -@param dst Output image with the same size and type as srcImgs images. -@param templateWindowSize Size in pixels of the template patch that is used to compute weights. -Should be odd. Recommended value 7 pixels -@param searchWindowSize Size in pixels of the window that is used to compute weighted average for -given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater -denoising time. Recommended value 21 pixels -@param h Parameter regulating filter strength for luminance component. Bigger h value perfectly -removes noise but also removes image details, smaller h value preserves details but also preserves -some noise. -@param hColor The same as h but for color components. - -The function converts images to CIELAB colorspace and then separately denoise L and AB components -with given h parameters using fastNlMeansDenoisingMulti function. - */ -CV_EXPORTS_W void fastNlMeansDenoisingColoredMulti( InputArrayOfArrays srcImgs, OutputArray dst, - int imgToDenoiseIndex, int temporalWindowSize, - float h = 3, float hColor = 3, - int templateWindowSize = 7, int searchWindowSize = 21); - -/** @brief Primal-dual algorithm is an algorithm for solving special types of variational problems (that is, -finding a function to minimize some functional). As the image denoising, in particular, may be seen -as the variational problem, primal-dual algorithm then can be used to perform denoising and this is -exactly what is implemented. - -It should be noted, that this implementation was taken from the July 2013 blog entry -@cite MA13 , which also contained (slightly more general) ready-to-use source code on Python. -Subsequently, that code was rewritten on C++ with the usage of openCV by Vadim Pisarevsky at the end -of July 2013 and finally it was slightly adapted by later authors. - -Although the thorough discussion and justification of the algorithm involved may be found in -@cite ChambolleEtAl, it might make sense to skim over it here, following @cite MA13 . To begin -with, we consider the 1-byte gray-level images as the functions from the rectangular domain of -pixels (it may be seen as set -\f$\left\{(x,y)\in\mathbb{N}\times\mathbb{N}\mid 1\leq x\leq n,\;1\leq y\leq m\right\}\f$ for some -\f$m,\;n\in\mathbb{N}\f$) into \f$\{0,1,\dots,255\}\f$. We shall denote the noised images as \f$f_i\f$ and with -this view, given some image \f$x\f$ of the same size, we may measure how bad it is by the formula - -\f[\left\|\left\|\nabla x\right\|\right\| + \lambda\sum_i\left\|\left\|x-f_i\right\|\right\|\f] - -\f$\|\|\cdot\|\|\f$ here denotes \f$L_2\f$-norm and as you see, the first addend states that we want our -image to be smooth (ideally, having zero gradient, thus being constant) and the second states that -we want our result to be close to the observations we've got. If we treat \f$x\f$ as a function, this is -exactly the functional what we seek to minimize and here the Primal-Dual algorithm comes into play. - -@param observations This array should contain one or more noised versions of the image that is to -be restored. -@param result Here the denoised image will be stored. There is no need to do pre-allocation of -storage space, as it will be automatically allocated, if necessary. -@param lambda Corresponds to \f$\lambda\f$ in the formulas above. As it is enlarged, the smooth -(blurred) images are treated more favorably than detailed (but maybe more noised) ones. Roughly -speaking, as it becomes smaller, the result will be more blur but more sever outliers will be -removed. -@param niters Number of iterations that the algorithm will run. Of course, as more iterations as -better, but it is hard to quantitatively refine this statement, so just use the default and -increase it if the results are poor. - */ -CV_EXPORTS_W void denoise_TVL1(const std::vector& observations,Mat& result, double lambda=1.0, int niters=30); - -//! @} photo_denoise - -//! @addtogroup photo_hdr -//! @{ - -enum { LDR_SIZE = 256 }; - -/** @brief Base class for tonemapping algorithms - tools that are used to map HDR image to 8-bit range. - */ -class CV_EXPORTS_W Tonemap : public Algorithm -{ -public: - /** @brief Tonemaps image - - @param src source image - CV_32FC3 Mat (float 32 bits 3 channels) - @param dst destination image - CV_32FC3 Mat with values in [0, 1] range - */ - CV_WRAP virtual void process(InputArray src, OutputArray dst) = 0; - - CV_WRAP virtual float getGamma() const = 0; - CV_WRAP virtual void setGamma(float gamma) = 0; -}; - -/** @brief Creates simple linear mapper with gamma correction - -@param gamma positive value for gamma correction. Gamma value of 1.0 implies no correction, gamma -equal to 2.2f is suitable for most displays. -Generally gamma \> 1 brightens the image and gamma \< 1 darkens it. - */ -CV_EXPORTS_W Ptr createTonemap(float gamma = 1.0f); - -/** @brief Adaptive logarithmic mapping is a fast global tonemapping algorithm that scales the image in -logarithmic domain. - -Since it's a global operator the same function is applied to all the pixels, it is controlled by the -bias parameter. - -Optional saturation enhancement is possible as described in @cite FL02 . - -For more information see @cite DM03 . - */ -class CV_EXPORTS_W TonemapDrago : public Tonemap -{ -public: - - CV_WRAP virtual float getSaturation() const = 0; - CV_WRAP virtual void setSaturation(float saturation) = 0; - - CV_WRAP virtual float getBias() const = 0; - CV_WRAP virtual void setBias(float bias) = 0; -}; - -/** @brief Creates TonemapDrago object - -@param gamma gamma value for gamma correction. See createTonemap -@param saturation positive saturation enhancement value. 1.0 preserves saturation, values greater -than 1 increase saturation and values less than 1 decrease it. -@param bias value for bias function in [0, 1] range. Values from 0.7 to 0.9 usually give best -results, default value is 0.85. - */ -CV_EXPORTS_W Ptr createTonemapDrago(float gamma = 1.0f, float saturation = 1.0f, float bias = 0.85f); - - -/** @brief This is a global tonemapping operator that models human visual system. - -Mapping function is controlled by adaptation parameter, that is computed using light adaptation and -color adaptation. - -For more information see @cite RD05 . - */ -class CV_EXPORTS_W TonemapReinhard : public Tonemap -{ -public: - CV_WRAP virtual float getIntensity() const = 0; - CV_WRAP virtual void setIntensity(float intensity) = 0; - - CV_WRAP virtual float getLightAdaptation() const = 0; - CV_WRAP virtual void setLightAdaptation(float light_adapt) = 0; - - CV_WRAP virtual float getColorAdaptation() const = 0; - CV_WRAP virtual void setColorAdaptation(float color_adapt) = 0; -}; - -/** @brief Creates TonemapReinhard object - -@param gamma gamma value for gamma correction. See createTonemap -@param intensity result intensity in [-8, 8] range. Greater intensity produces brighter results. -@param light_adapt light adaptation in [0, 1] range. If 1 adaptation is based only on pixel -value, if 0 it's global, otherwise it's a weighted mean of this two cases. -@param color_adapt chromatic adaptation in [0, 1] range. If 1 channels are treated independently, -if 0 adaptation level is the same for each channel. - */ -CV_EXPORTS_W Ptr -createTonemapReinhard(float gamma = 1.0f, float intensity = 0.0f, float light_adapt = 1.0f, float color_adapt = 0.0f); - -/** @brief This algorithm transforms image to contrast using gradients on all levels of gaussian pyramid, -transforms contrast values to HVS response and scales the response. After this the image is -reconstructed from new contrast values. - -For more information see @cite MM06 . - */ -class CV_EXPORTS_W TonemapMantiuk : public Tonemap -{ -public: - CV_WRAP virtual float getScale() const = 0; - CV_WRAP virtual void setScale(float scale) = 0; - - CV_WRAP virtual float getSaturation() const = 0; - CV_WRAP virtual void setSaturation(float saturation) = 0; -}; - -/** @brief Creates TonemapMantiuk object - -@param gamma gamma value for gamma correction. See createTonemap -@param scale contrast scale factor. HVS response is multiplied by this parameter, thus compressing -dynamic range. Values from 0.6 to 0.9 produce best results. -@param saturation saturation enhancement value. See createTonemapDrago - */ -CV_EXPORTS_W Ptr -createTonemapMantiuk(float gamma = 1.0f, float scale = 0.7f, float saturation = 1.0f); - -/** @brief The base class for algorithms that align images of the same scene with different exposures - */ -class CV_EXPORTS_W AlignExposures : public Algorithm -{ -public: - /** @brief Aligns images - - @param src vector of input images - @param dst vector of aligned images - @param times vector of exposure time values for each image - @param response 256x1 matrix with inverse camera response function for each pixel value, it should - have the same number of channels as images. - */ - CV_WRAP virtual void process(InputArrayOfArrays src, std::vector& dst, - InputArray times, InputArray response) = 0; -}; - -/** @brief This algorithm converts images to median threshold bitmaps (1 for pixels brighter than median -luminance and 0 otherwise) and than aligns the resulting bitmaps using bit operations. - -It is invariant to exposure, so exposure values and camera response are not necessary. - -In this implementation new image regions are filled with zeros. - -For more information see @cite GW03 . - */ -class CV_EXPORTS_W AlignMTB : public AlignExposures -{ -public: - CV_WRAP virtual void process(InputArrayOfArrays src, std::vector& dst, - InputArray times, InputArray response) CV_OVERRIDE = 0; - - /** @brief Short version of process, that doesn't take extra arguments. - - @param src vector of input images - @param dst vector of aligned images - */ - CV_WRAP virtual void process(InputArrayOfArrays src, std::vector& dst) = 0; - - /** @brief Calculates shift between two images, i. e. how to shift the second image to correspond it with the - first. - - @param img0 first image - @param img1 second image - */ - CV_WRAP virtual Point calculateShift(InputArray img0, InputArray img1) = 0; - /** @brief Helper function, that shift Mat filling new regions with zeros. - - @param src input image - @param dst result image - @param shift shift value - */ - CV_WRAP virtual void shiftMat(InputArray src, OutputArray dst, const Point shift) = 0; - /** @brief Computes median threshold and exclude bitmaps of given image. - - @param img input image - @param tb median threshold bitmap - @param eb exclude bitmap - */ - CV_WRAP virtual void computeBitmaps(InputArray img, OutputArray tb, OutputArray eb) = 0; - - CV_WRAP virtual int getMaxBits() const = 0; - CV_WRAP virtual void setMaxBits(int max_bits) = 0; - - CV_WRAP virtual int getExcludeRange() const = 0; - CV_WRAP virtual void setExcludeRange(int exclude_range) = 0; - - CV_WRAP virtual bool getCut() const = 0; - CV_WRAP virtual void setCut(bool value) = 0; -}; - -/** @brief Creates AlignMTB object - -@param max_bits logarithm to the base 2 of maximal shift in each dimension. Values of 5 and 6 are -usually good enough (31 and 63 pixels shift respectively). -@param exclude_range range for exclusion bitmap that is constructed to suppress noise around the -median value. -@param cut if true cuts images, otherwise fills the new regions with zeros. - */ -CV_EXPORTS_W Ptr createAlignMTB(int max_bits = 6, int exclude_range = 4, bool cut = true); - -/** @brief The base class for camera response calibration algorithms. - */ -class CV_EXPORTS_W CalibrateCRF : public Algorithm -{ -public: - /** @brief Recovers inverse camera response. - - @param src vector of input images - @param dst 256x1 matrix with inverse camera response function - @param times vector of exposure time values for each image - */ - CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0; -}; - -/** @brief Inverse camera response function is extracted for each brightness value by minimizing an objective -function as linear system. Objective function is constructed using pixel values on the same position -in all images, extra term is added to make the result smoother. - -For more information see @cite DM97 . - */ -class CV_EXPORTS_W CalibrateDebevec : public CalibrateCRF -{ -public: - CV_WRAP virtual float getLambda() const = 0; - CV_WRAP virtual void setLambda(float lambda) = 0; - - CV_WRAP virtual int getSamples() const = 0; - CV_WRAP virtual void setSamples(int samples) = 0; - - CV_WRAP virtual bool getRandom() const = 0; - CV_WRAP virtual void setRandom(bool random) = 0; -}; - -/** @brief Creates CalibrateDebevec object - -@param samples number of pixel locations to use -@param lambda smoothness term weight. Greater values produce smoother results, but can alter the -response. -@param random if true sample pixel locations are chosen at random, otherwise they form a -rectangular grid. - */ -CV_EXPORTS_W Ptr createCalibrateDebevec(int samples = 70, float lambda = 10.0f, bool random = false); - -/** @brief Inverse camera response function is extracted for each brightness value by minimizing an objective -function as linear system. This algorithm uses all image pixels. - -For more information see @cite RB99 . - */ -class CV_EXPORTS_W CalibrateRobertson : public CalibrateCRF -{ -public: - CV_WRAP virtual int getMaxIter() const = 0; - CV_WRAP virtual void setMaxIter(int max_iter) = 0; - - CV_WRAP virtual float getThreshold() const = 0; - CV_WRAP virtual void setThreshold(float threshold) = 0; - - CV_WRAP virtual Mat getRadiance() const = 0; -}; - -/** @brief Creates CalibrateRobertson object - -@param max_iter maximal number of Gauss-Seidel solver iterations. -@param threshold target difference between results of two successive steps of the minimization. - */ -CV_EXPORTS_W Ptr createCalibrateRobertson(int max_iter = 30, float threshold = 0.01f); - -/** @brief The base class algorithms that can merge exposure sequence to a single image. - */ -class CV_EXPORTS_W MergeExposures : public Algorithm -{ -public: - /** @brief Merges images. - - @param src vector of input images - @param dst result image - @param times vector of exposure time values for each image - @param response 256x1 matrix with inverse camera response function for each pixel value, it should - have the same number of channels as images. - */ - CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, - InputArray times, InputArray response) = 0; -}; - -/** @brief The resulting HDR image is calculated as weighted average of the exposures considering exposure -values and camera response. - -For more information see @cite DM97 . - */ -class CV_EXPORTS_W MergeDebevec : public MergeExposures -{ -public: - CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, - InputArray times, InputArray response) CV_OVERRIDE = 0; - CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0; -}; - -/** @brief Creates MergeDebevec object - */ -CV_EXPORTS_W Ptr createMergeDebevec(); - -/** @brief Pixels are weighted using contrast, saturation and well-exposedness measures, than images are -combined using laplacian pyramids. - -The resulting image weight is constructed as weighted average of contrast, saturation and -well-exposedness measures. - -The resulting image doesn't require tonemapping and can be converted to 8-bit image by multiplying -by 255, but it's recommended to apply gamma correction and/or linear tonemapping. - -For more information see @cite MK07 . - */ -class CV_EXPORTS_W MergeMertens : public MergeExposures -{ -public: - CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, - InputArray times, InputArray response) CV_OVERRIDE = 0; - /** @brief Short version of process, that doesn't take extra arguments. - - @param src vector of input images - @param dst result image - */ - CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst) = 0; - - CV_WRAP virtual float getContrastWeight() const = 0; - CV_WRAP virtual void setContrastWeight(float contrast_weiht) = 0; - - CV_WRAP virtual float getSaturationWeight() const = 0; - CV_WRAP virtual void setSaturationWeight(float saturation_weight) = 0; - - CV_WRAP virtual float getExposureWeight() const = 0; - CV_WRAP virtual void setExposureWeight(float exposure_weight) = 0; -}; - -/** @brief Creates MergeMertens object - -@param contrast_weight contrast measure weight. See MergeMertens. -@param saturation_weight saturation measure weight -@param exposure_weight well-exposedness measure weight - */ -CV_EXPORTS_W Ptr -createMergeMertens(float contrast_weight = 1.0f, float saturation_weight = 1.0f, float exposure_weight = 0.0f); - -/** @brief The resulting HDR image is calculated as weighted average of the exposures considering exposure -values and camera response. - -For more information see @cite RB99 . - */ -class CV_EXPORTS_W MergeRobertson : public MergeExposures -{ -public: - CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, - InputArray times, InputArray response) CV_OVERRIDE = 0; - CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0; -}; - -/** @brief Creates MergeRobertson object - */ -CV_EXPORTS_W Ptr createMergeRobertson(); - -//! @} photo_hdr - -//! @addtogroup photo_decolor -//! @{ - -/** @brief Transforms a color image to a grayscale image. It is a basic tool in digital printing, stylized -black-and-white photograph rendering, and in many single channel image processing applications -@cite CL12 . - -@param src Input 8-bit 3-channel image. -@param grayscale Output 8-bit 1-channel image. -@param color_boost Output 8-bit 3-channel image. - -This function is to be applied on color images. - */ -CV_EXPORTS_W void decolor( InputArray src, OutputArray grayscale, OutputArray color_boost); - -//! @} photo_decolor - -//! @addtogroup photo_clone -//! @{ - - -//! seamlessClone algorithm flags -enum -{ - /** The power of the method is fully expressed when inserting objects with complex outlines into a new background*/ - NORMAL_CLONE = 1, - /** The classic method, color-based selection and alpha masking might be time consuming and often leaves an undesirable - halo. Seamless cloning, even averaged with the original image, is not effective. Mixed seamless cloning based on a loose selection proves effective.*/ - MIXED_CLONE = 2, - /** Monochrome transfer allows the user to easily replace certain features of one object by alternative features.*/ - MONOCHROME_TRANSFER = 3}; - - -/** @example samples/cpp/tutorial_code/photo/seamless_cloning/cloning_demo.cpp -An example using seamlessClone function -*/ -/** @brief Image editing tasks concern either global changes (color/intensity corrections, filters, -deformations) or local changes concerned to a selection. Here we are interested in achieving local -changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless -manner. The extent of the changes ranges from slight distortions to complete replacement by novel -content @cite PM03 . - -@param src Input 8-bit 3-channel image. -@param dst Input 8-bit 3-channel image. -@param mask Input 8-bit 1 or 3-channel image. -@param p Point in dst image where object is placed. -@param blend Output image with the same size and type as dst. -@param flags Cloning method that could be cv::NORMAL_CLONE, cv::MIXED_CLONE or cv::MONOCHROME_TRANSFER - */ -CV_EXPORTS_W void seamlessClone( InputArray src, InputArray dst, InputArray mask, Point p, - OutputArray blend, int flags); - -/** @brief Given an original color image, two differently colored versions of this image can be mixed -seamlessly. - -@param src Input 8-bit 3-channel image. -@param mask Input 8-bit 1 or 3-channel image. -@param dst Output image with the same size and type as src . -@param red_mul R-channel multiply factor. -@param green_mul G-channel multiply factor. -@param blue_mul B-channel multiply factor. - -Multiplication factor is between .5 to 2.5. - */ -CV_EXPORTS_W void colorChange(InputArray src, InputArray mask, OutputArray dst, float red_mul = 1.0f, - float green_mul = 1.0f, float blue_mul = 1.0f); - -/** @brief Applying an appropriate non-linear transformation to the gradient field inside the selection and -then integrating back with a Poisson solver, modifies locally the apparent illumination of an image. - -@param src Input 8-bit 3-channel image. -@param mask Input 8-bit 1 or 3-channel image. -@param dst Output image with the same size and type as src. -@param alpha Value ranges between 0-2. -@param beta Value ranges between 0-2. - -This is useful to highlight under-exposed foreground objects or to reduce specular reflections. - */ -CV_EXPORTS_W void illuminationChange(InputArray src, InputArray mask, OutputArray dst, - float alpha = 0.2f, float beta = 0.4f); - -/** @brief By retaining only the gradients at edge locations, before integrating with the Poisson solver, one -washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge %Detector is used. - -@param src Input 8-bit 3-channel image. -@param mask Input 8-bit 1 or 3-channel image. -@param dst Output image with the same size and type as src. -@param low_threshold %Range from 0 to 100. -@param high_threshold Value \> 100. -@param kernel_size The size of the Sobel kernel to be used. - -@note -The algorithm assumes that the color of the source image is close to that of the destination. This -assumption means that when the colors don't match, the source image color gets tinted toward the -color of the destination image. - */ -CV_EXPORTS_W void textureFlattening(InputArray src, InputArray mask, OutputArray dst, - float low_threshold = 30, float high_threshold = 45, - int kernel_size = 3); - -//! @} photo_clone - -//! @addtogroup photo_render -//! @{ - -//! Edge preserving filters -enum -{ - RECURS_FILTER = 1, //!< Recursive Filtering - NORMCONV_FILTER = 2 //!< Normalized Convolution Filtering -}; - -/** @brief Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing -filters are used in many different applications @cite EM11 . - -@param src Input 8-bit 3-channel image. -@param dst Output 8-bit 3-channel image. -@param flags Edge preserving filters: cv::RECURS_FILTER or cv::NORMCONV_FILTER -@param sigma_s %Range between 0 to 200. -@param sigma_r %Range between 0 to 1. - */ -CV_EXPORTS_W void edgePreservingFilter(InputArray src, OutputArray dst, int flags = 1, - float sigma_s = 60, float sigma_r = 0.4f); - -/** @brief This filter enhances the details of a particular image. - -@param src Input 8-bit 3-channel image. -@param dst Output image with the same size and type as src. -@param sigma_s %Range between 0 to 200. -@param sigma_r %Range between 0 to 1. - */ -CV_EXPORTS_W void detailEnhance(InputArray src, OutputArray dst, float sigma_s = 10, - float sigma_r = 0.15f); - -/** @example samples/cpp/tutorial_code/photo/non_photorealistic_rendering/npr_demo.cpp -An example using non-photorealistic line drawing functions -*/ -/** @brief Pencil-like non-photorealistic line drawing - -@param src Input 8-bit 3-channel image. -@param dst1 Output 8-bit 1-channel image. -@param dst2 Output image with the same size and type as src. -@param sigma_s %Range between 0 to 200. -@param sigma_r %Range between 0 to 1. -@param shade_factor %Range between 0 to 0.1. - */ -CV_EXPORTS_W void pencilSketch(InputArray src, OutputArray dst1, OutputArray dst2, - float sigma_s = 60, float sigma_r = 0.07f, float shade_factor = 0.02f); - -/** @brief Stylization aims to produce digital imagery with a wide variety of effects not focused on -photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low -contrast while preserving, or enhancing, high-contrast features. - -@param src Input 8-bit 3-channel image. -@param dst Output image with the same size and type as src. -@param sigma_s %Range between 0 to 200. -@param sigma_r %Range between 0 to 1. - */ -CV_EXPORTS_W void stylization(InputArray src, OutputArray dst, float sigma_s = 60, - float sigma_r = 0.45f); - -//! @} photo_render - -//! @} photo - -} // cv - -#ifndef DISABLE_OPENCV_24_COMPATIBILITY -#include "opencv2/photo/photo_c.h" -#endif - -#endif diff --git a/opencv/include/opencv2/photo/cuda.hpp b/opencv/include/opencv2/photo/cuda.hpp deleted file mode 100644 index a2f3816..0000000 --- a/opencv/include/opencv2/photo/cuda.hpp +++ /dev/null @@ -1,132 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2008-2012, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_PHOTO_CUDA_HPP -#define OPENCV_PHOTO_CUDA_HPP - -#include "opencv2/core/cuda.hpp" - -namespace cv { namespace cuda { - -//! @addtogroup photo_denoise -//! @{ - -/** @brief Performs pure non local means denoising without any simplification, and thus it is not fast. - -@param src Source image. Supports only CV_8UC1, CV_8UC2 and CV_8UC3. -@param dst Destination image. -@param h Filter sigma regulating filter strength for color. -@param search_window Size of search window. -@param block_size Size of block used for computing weights. -@param borderMode Border type. See borderInterpolate for details. BORDER_REFLECT101 , -BORDER_REPLICATE , BORDER_CONSTANT , BORDER_REFLECT and BORDER_WRAP are supported for now. -@param stream Stream for the asynchronous version. - -@sa - fastNlMeansDenoising - */ -CV_EXPORTS void nonLocalMeans(InputArray src, OutputArray dst, - float h, - int search_window = 21, - int block_size = 7, - int borderMode = BORDER_DEFAULT, - Stream& stream = Stream::Null()); - -/** @brief Perform image denoising using Non-local Means Denoising algorithm - with several computational -optimizations. Noise expected to be a gaussian white noise - -@param src Input 8-bit 1-channel, 2-channel or 3-channel image. -@param dst Output image with the same size and type as src . -@param h Parameter regulating filter strength. Big h value perfectly removes noise but also -removes image details, smaller h value preserves details but also preserves some noise -@param search_window Size in pixels of the window that is used to compute weighted average for -given pixel. Should be odd. Affect performance linearly: greater search_window - greater -denoising time. Recommended value 21 pixels -@param block_size Size in pixels of the template patch that is used to compute weights. Should be -odd. Recommended value 7 pixels -@param stream Stream for the asynchronous invocations. - -This function expected to be applied to grayscale images. For colored images look at -FastNonLocalMeansDenoising::labMethod. - -@sa - fastNlMeansDenoising - */ -CV_EXPORTS void fastNlMeansDenoising(InputArray src, OutputArray dst, - float h, - int search_window = 21, - int block_size = 7, - Stream& stream = Stream::Null()); - -/** @brief Modification of fastNlMeansDenoising function for colored images - -@param src Input 8-bit 3-channel image. -@param dst Output image with the same size and type as src . -@param h_luminance Parameter regulating filter strength. Big h value perfectly removes noise but -also removes image details, smaller h value preserves details but also preserves some noise -@param photo_render float The same as h but for color components. For most images value equals 10 will be -enough to remove colored noise and do not distort colors -@param search_window Size in pixels of the window that is used to compute weighted average for -given pixel. Should be odd. Affect performance linearly: greater search_window - greater -denoising time. Recommended value 21 pixels -@param block_size Size in pixels of the template patch that is used to compute weights. Should be -odd. Recommended value 7 pixels -@param stream Stream for the asynchronous invocations. - -The function converts image to CIELAB colorspace and then separately denoise L and AB components -with given h parameters using FastNonLocalMeansDenoising::simpleMethod function. - -@sa - fastNlMeansDenoisingColored - */ -CV_EXPORTS void fastNlMeansDenoisingColored(InputArray src, OutputArray dst, - float h_luminance, float photo_render, - int search_window = 21, - int block_size = 7, - Stream& stream = Stream::Null()); - -//! @} photo - -}} // namespace cv { namespace cuda { - -#endif /* OPENCV_PHOTO_CUDA_HPP */ diff --git a/opencv/include/opencv2/photo/photo.hpp b/opencv/include/opencv2/photo/photo.hpp deleted file mode 100644 index 8af5e9f..0000000 --- a/opencv/include/opencv2/photo/photo.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/photo.hpp" diff --git a/opencv/include/opencv2/photo/photo_c.h b/opencv/include/opencv2/photo/photo_c.h deleted file mode 100644 index cd623c1..0000000 --- a/opencv/include/opencv2/photo/photo_c.h +++ /dev/null @@ -1,74 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2008-2012, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_PHOTO_C_H -#define OPENCV_PHOTO_C_H - -#include "opencv2/core/core_c.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup photo_c - @{ - */ - -/* Inpainting algorithms */ -enum InpaintingModes -{ - CV_INPAINT_NS =0, - CV_INPAINT_TELEA =1 -}; - - -/* Inpaints the selected region in the image */ -CVAPI(void) cvInpaint( const CvArr* src, const CvArr* inpaint_mask, - CvArr* dst, double inpaintRange, int flags ); - -/** @} */ - -#ifdef __cplusplus -} //extern "C" -#endif - -#endif //OPENCV_PHOTO_C_H diff --git a/opencv/include/opencv2/shape.hpp b/opencv/include/opencv2/shape.hpp deleted file mode 100644 index f302b6b..0000000 --- a/opencv/include/opencv2/shape.hpp +++ /dev/null @@ -1,57 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2012, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_SHAPE_HPP -#define OPENCV_SHAPE_HPP - -#include "opencv2/shape/emdL1.hpp" -#include "opencv2/shape/shape_transformer.hpp" -#include "opencv2/shape/hist_cost.hpp" -#include "opencv2/shape/shape_distance.hpp" - -/** - @defgroup shape Shape Distance and Matching - */ - -#endif - -/* End of file. */ diff --git a/opencv/include/opencv2/shape/emdL1.hpp b/opencv/include/opencv2/shape/emdL1.hpp deleted file mode 100644 index a15d68c..0000000 --- a/opencv/include/opencv2/shape/emdL1.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2012, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_EMD_L1_HPP -#define OPENCV_EMD_L1_HPP - -#include "opencv2/core.hpp" - -namespace cv -{ -/****************************************************************************************\ -* EMDL1 Function * -\****************************************************************************************/ - -//! @addtogroup shape -//! @{ - -/** @brief Computes the "minimal work" distance between two weighted point configurations base on the papers -"EMD-L1: An efficient and Robust Algorithm for comparing histogram-based descriptors", by Haibin -Ling and Kazunori Okuda; and "The Earth Mover's Distance is the Mallows Distance: Some Insights from -Statistics", by Elizaveta Levina and Peter Bickel. - -@param signature1 First signature, a single column floating-point matrix. Each row is the value of -the histogram in each bin. -@param signature2 Second signature of the same format and size as signature1. - */ -CV_EXPORTS float EMDL1(InputArray signature1, InputArray signature2); - -//! @} - -}//namespace cv - -#endif diff --git a/opencv/include/opencv2/shape/hist_cost.hpp b/opencv/include/opencv2/shape/hist_cost.hpp deleted file mode 100644 index 21d0d68..0000000 --- a/opencv/include/opencv2/shape/hist_cost.hpp +++ /dev/null @@ -1,111 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_HIST_COST_HPP -#define OPENCV_HIST_COST_HPP - -#include "opencv2/imgproc.hpp" - -namespace cv -{ - -//! @addtogroup shape -//! @{ - -/** @brief Abstract base class for histogram cost algorithms. - */ -class CV_EXPORTS_W HistogramCostExtractor : public Algorithm -{ -public: - CV_WRAP virtual void buildCostMatrix(InputArray descriptors1, InputArray descriptors2, OutputArray costMatrix) = 0; - - CV_WRAP virtual void setNDummies(int nDummies) = 0; - CV_WRAP virtual int getNDummies() const = 0; - - CV_WRAP virtual void setDefaultCost(float defaultCost) = 0; - CV_WRAP virtual float getDefaultCost() const = 0; -}; - -/** @brief A norm based cost extraction. : - */ -class CV_EXPORTS_W NormHistogramCostExtractor : public HistogramCostExtractor -{ -public: - CV_WRAP virtual void setNormFlag(int flag) = 0; - CV_WRAP virtual int getNormFlag() const = 0; -}; - -CV_EXPORTS_W Ptr - createNormHistogramCostExtractor(int flag=DIST_L2, int nDummies=25, float defaultCost=0.2f); - -/** @brief An EMD based cost extraction. : - */ -class CV_EXPORTS_W EMDHistogramCostExtractor : public HistogramCostExtractor -{ -public: - CV_WRAP virtual void setNormFlag(int flag) = 0; - CV_WRAP virtual int getNormFlag() const = 0; -}; - -CV_EXPORTS_W Ptr - createEMDHistogramCostExtractor(int flag=DIST_L2, int nDummies=25, float defaultCost=0.2f); - -/** @brief An Chi based cost extraction. : - */ -class CV_EXPORTS_W ChiHistogramCostExtractor : public HistogramCostExtractor -{}; - -CV_EXPORTS_W Ptr createChiHistogramCostExtractor(int nDummies=25, float defaultCost=0.2f); - -/** @brief An EMD-L1 based cost extraction. : - */ -class CV_EXPORTS_W EMDL1HistogramCostExtractor : public HistogramCostExtractor -{}; - -CV_EXPORTS_W Ptr - createEMDL1HistogramCostExtractor(int nDummies=25, float defaultCost=0.2f); - -//! @} - -} // cv -#endif diff --git a/opencv/include/opencv2/shape/shape.hpp b/opencv/include/opencv2/shape/shape.hpp deleted file mode 100644 index 5c4da3c..0000000 --- a/opencv/include/opencv2/shape/shape.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/shape.hpp" diff --git a/opencv/include/opencv2/shape/shape_distance.hpp b/opencv/include/opencv2/shape/shape_distance.hpp deleted file mode 100644 index 725b56a..0000000 --- a/opencv/include/opencv2/shape/shape_distance.hpp +++ /dev/null @@ -1,227 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_SHAPE_SHAPE_DISTANCE_HPP -#define OPENCV_SHAPE_SHAPE_DISTANCE_HPP -#include "opencv2/core.hpp" -#include "opencv2/shape/hist_cost.hpp" -#include "opencv2/shape/shape_transformer.hpp" - -namespace cv -{ - -//! @addtogroup shape -//! @{ - -/** @example samples/cpp/shape_example.cpp -An example using shape distance algorithm -*/ -/** @brief Abstract base class for shape distance algorithms. - */ -class CV_EXPORTS_W ShapeDistanceExtractor : public Algorithm -{ -public: - /** @brief Compute the shape distance between two shapes defined by its contours. - - @param contour1 Contour defining first shape. - @param contour2 Contour defining second shape. - */ - CV_WRAP virtual float computeDistance(InputArray contour1, InputArray contour2) = 0; -}; - -/***********************************************************************************/ -/***********************************************************************************/ -/***********************************************************************************/ -/** @brief Implementation of the Shape Context descriptor and matching algorithm - -proposed by Belongie et al. in "Shape Matching and Object Recognition Using Shape Contexts" (PAMI -2002). This implementation is packaged in a generic scheme, in order to allow you the -implementation of the common variations of the original pipeline. -*/ -class CV_EXPORTS_W ShapeContextDistanceExtractor : public ShapeDistanceExtractor -{ -public: - /** @brief Establish the number of angular bins for the Shape Context Descriptor used in the shape matching - pipeline. - - @param nAngularBins The number of angular bins in the shape context descriptor. - */ - CV_WRAP virtual void setAngularBins(int nAngularBins) = 0; - CV_WRAP virtual int getAngularBins() const = 0; - - /** @brief Establish the number of radial bins for the Shape Context Descriptor used in the shape matching - pipeline. - - @param nRadialBins The number of radial bins in the shape context descriptor. - */ - CV_WRAP virtual void setRadialBins(int nRadialBins) = 0; - CV_WRAP virtual int getRadialBins() const = 0; - - /** @brief Set the inner radius of the shape context descriptor. - - @param innerRadius The value of the inner radius. - */ - CV_WRAP virtual void setInnerRadius(float innerRadius) = 0; - CV_WRAP virtual float getInnerRadius() const = 0; - - /** @brief Set the outer radius of the shape context descriptor. - - @param outerRadius The value of the outer radius. - */ - CV_WRAP virtual void setOuterRadius(float outerRadius) = 0; - CV_WRAP virtual float getOuterRadius() const = 0; - - CV_WRAP virtual void setRotationInvariant(bool rotationInvariant) = 0; - CV_WRAP virtual bool getRotationInvariant() const = 0; - - /** @brief Set the weight of the shape context distance in the final value of the shape distance. The shape - context distance between two shapes is defined as the symmetric sum of shape context matching costs - over best matching points. The final value of the shape distance is a user-defined linear - combination of the shape context distance, an image appearance distance, and a bending energy. - - @param shapeContextWeight The weight of the shape context distance in the final distance value. - */ - CV_WRAP virtual void setShapeContextWeight(float shapeContextWeight) = 0; - CV_WRAP virtual float getShapeContextWeight() const = 0; - - /** @brief Set the weight of the Image Appearance cost in the final value of the shape distance. The image - appearance cost is defined as the sum of squared brightness differences in Gaussian windows around - corresponding image points. The final value of the shape distance is a user-defined linear - combination of the shape context distance, an image appearance distance, and a bending energy. If - this value is set to a number different from 0, is mandatory to set the images that correspond to - each shape. - - @param imageAppearanceWeight The weight of the appearance cost in the final distance value. - */ - CV_WRAP virtual void setImageAppearanceWeight(float imageAppearanceWeight) = 0; - CV_WRAP virtual float getImageAppearanceWeight() const = 0; - - /** @brief Set the weight of the Bending Energy in the final value of the shape distance. The bending energy - definition depends on what transformation is being used to align the shapes. The final value of the - shape distance is a user-defined linear combination of the shape context distance, an image - appearance distance, and a bending energy. - - @param bendingEnergyWeight The weight of the Bending Energy in the final distance value. - */ - CV_WRAP virtual void setBendingEnergyWeight(float bendingEnergyWeight) = 0; - CV_WRAP virtual float getBendingEnergyWeight() const = 0; - - /** @brief Set the images that correspond to each shape. This images are used in the calculation of the Image - Appearance cost. - - @param image1 Image corresponding to the shape defined by contours1. - @param image2 Image corresponding to the shape defined by contours2. - */ - CV_WRAP virtual void setImages(InputArray image1, InputArray image2) = 0; - CV_WRAP virtual void getImages(OutputArray image1, OutputArray image2) const = 0; - - CV_WRAP virtual void setIterations(int iterations) = 0; - CV_WRAP virtual int getIterations() const = 0; - - /** @brief Set the algorithm used for building the shape context descriptor cost matrix. - - @param comparer Smart pointer to a HistogramCostExtractor, an algorithm that defines the cost - matrix between descriptors. - */ - CV_WRAP virtual void setCostExtractor(Ptr comparer) = 0; - CV_WRAP virtual Ptr getCostExtractor() const = 0; - - /** @brief Set the value of the standard deviation for the Gaussian window for the image appearance cost. - - @param sigma Standard Deviation. - */ - CV_WRAP virtual void setStdDev(float sigma) = 0; - CV_WRAP virtual float getStdDev() const = 0; - - /** @brief Set the algorithm used for aligning the shapes. - - @param transformer Smart pointer to a ShapeTransformer, an algorithm that defines the aligning - transformation. - */ - CV_WRAP virtual void setTransformAlgorithm(Ptr transformer) = 0; - CV_WRAP virtual Ptr getTransformAlgorithm() const = 0; -}; - -/* Complete constructor */ -CV_EXPORTS_W Ptr - createShapeContextDistanceExtractor(int nAngularBins=12, int nRadialBins=4, - float innerRadius=0.2f, float outerRadius=2, int iterations=3, - const Ptr &comparer = createChiHistogramCostExtractor(), - const Ptr &transformer = createThinPlateSplineShapeTransformer()); - -/***********************************************************************************/ -/***********************************************************************************/ -/***********************************************************************************/ -/** @brief A simple Hausdorff distance measure between shapes defined by contours - -according to the paper "Comparing Images using the Hausdorff distance." by D.P. Huttenlocher, G.A. -Klanderman, and W.J. Rucklidge. (PAMI 1993). : - */ -class CV_EXPORTS_W HausdorffDistanceExtractor : public ShapeDistanceExtractor -{ -public: - /** @brief Set the norm used to compute the Hausdorff value between two shapes. It can be L1 or L2 norm. - - @param distanceFlag Flag indicating which norm is used to compute the Hausdorff distance - (NORM_L1, NORM_L2). - */ - CV_WRAP virtual void setDistanceFlag(int distanceFlag) = 0; - CV_WRAP virtual int getDistanceFlag() const = 0; - - /** @brief This method sets the rank proportion (or fractional value) that establish the Kth ranked value of - the partial Hausdorff distance. Experimentally had been shown that 0.6 is a good value to compare - shapes. - - @param rankProportion fractional value (between 0 and 1). - */ - CV_WRAP virtual void setRankProportion(float rankProportion) = 0; - CV_WRAP virtual float getRankProportion() const = 0; -}; - -/* Constructor */ -CV_EXPORTS_W Ptr createHausdorffDistanceExtractor(int distanceFlag=cv::NORM_L2, float rankProp=0.6f); - -//! @} - -} // cv -#endif diff --git a/opencv/include/opencv2/shape/shape_transformer.hpp b/opencv/include/opencv2/shape/shape_transformer.hpp deleted file mode 100644 index 3c3ce20..0000000 --- a/opencv/include/opencv2/shape/shape_transformer.hpp +++ /dev/null @@ -1,132 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_SHAPE_SHAPE_TRANSFORM_HPP -#define OPENCV_SHAPE_SHAPE_TRANSFORM_HPP -#include -#include "opencv2/core.hpp" -#include "opencv2/imgproc.hpp" - -namespace cv -{ - -//! @addtogroup shape -//! @{ - -/** @brief Abstract base class for shape transformation algorithms. - */ -class CV_EXPORTS_W ShapeTransformer : public Algorithm -{ -public: - /** @brief Estimate the transformation parameters of the current transformer algorithm, based on point matches. - - @param transformingShape Contour defining first shape. - @param targetShape Contour defining second shape (Target). - @param matches Standard vector of Matches between points. - */ - CV_WRAP virtual void estimateTransformation(InputArray transformingShape, InputArray targetShape, - std::vector& matches) = 0; - - /** @brief Apply a transformation, given a pre-estimated transformation parameters. - - @param input Contour (set of points) to apply the transformation. - @param output Output contour. - */ - CV_WRAP virtual float applyTransformation(InputArray input, OutputArray output=noArray()) = 0; - - /** @brief Apply a transformation, given a pre-estimated transformation parameters, to an Image. - - @param transformingImage Input image. - @param output Output image. - @param flags Image interpolation method. - @param borderMode border style. - @param borderValue border value. - */ - CV_WRAP virtual void warpImage(InputArray transformingImage, OutputArray output, - int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, - const Scalar& borderValue=Scalar()) const = 0; -}; - -/***********************************************************************************/ -/***********************************************************************************/ - -/** @brief Definition of the transformation - -occupied in the paper "Principal Warps: Thin-Plate Splines and Decomposition of Deformations", by -F.L. Bookstein (PAMI 1989). : - */ -class CV_EXPORTS_W ThinPlateSplineShapeTransformer : public ShapeTransformer -{ -public: - /** @brief Set the regularization parameter for relaxing the exact interpolation requirements of the TPS - algorithm. - - @param beta value of the regularization parameter. - */ - CV_WRAP virtual void setRegularizationParameter(double beta) = 0; - CV_WRAP virtual double getRegularizationParameter() const = 0; -}; - -/** Complete constructor */ -CV_EXPORTS_W Ptr - createThinPlateSplineShapeTransformer(double regularizationParameter=0); - -/***********************************************************************************/ -/***********************************************************************************/ - -/** @brief Wrapper class for the OpenCV Affine Transformation algorithm. : - */ -class CV_EXPORTS_W AffineTransformer : public ShapeTransformer -{ -public: - CV_WRAP virtual void setFullAffine(bool fullAffine) = 0; - CV_WRAP virtual bool getFullAffine() const = 0; -}; - -/** Complete constructor */ -CV_EXPORTS_W Ptr createAffineTransformer(bool fullAffine); - -//! @} - -} // cv -#endif diff --git a/opencv/include/opencv2/stitching.hpp b/opencv/include/opencv2/stitching.hpp deleted file mode 100644 index 07e1b5f..0000000 --- a/opencv/include/opencv2/stitching.hpp +++ /dev/null @@ -1,329 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_STITCHER_HPP -#define OPENCV_STITCHING_STITCHER_HPP - -#include "opencv2/core.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/stitching/warpers.hpp" -#include "opencv2/stitching/detail/matchers.hpp" -#include "opencv2/stitching/detail/motion_estimators.hpp" -#include "opencv2/stitching/detail/exposure_compensate.hpp" -#include "opencv2/stitching/detail/seam_finders.hpp" -#include "opencv2/stitching/detail/blenders.hpp" -#include "opencv2/stitching/detail/camera.hpp" - - -#if defined(Status) -# warning Detected X11 'Status' macro definition, it can cause build conflicts. Please, include this header before any X11 headers. -#endif - - -/** -@defgroup stitching Images stitching - -This figure illustrates the stitching module pipeline implemented in the Stitcher class. Using that -class it's possible to configure/remove some steps, i.e. adjust the stitching pipeline according to -the particular needs. All building blocks from the pipeline are available in the detail namespace, -one can combine and use them separately. - -The implemented stitching pipeline is very similar to the one proposed in @cite BL07 . - -![stitching pipeline](StitchingPipeline.jpg) - -Camera models -------------- - -There are currently 2 camera models implemented in stitching pipeline. - -- _Homography model_ expecting perspective transformations between images - implemented in @ref cv::detail::BestOf2NearestMatcher cv::detail::HomographyBasedEstimator - cv::detail::BundleAdjusterReproj cv::detail::BundleAdjusterRay -- _Affine model_ expecting affine transformation with 6 DOF or 4 DOF implemented in - @ref cv::detail::AffineBestOf2NearestMatcher cv::detail::AffineBasedEstimator - cv::detail::BundleAdjusterAffine cv::detail::BundleAdjusterAffinePartial cv::AffineWarper - -Homography model is useful for creating photo panoramas captured by camera, -while affine-based model can be used to stitch scans and object captured by -specialized devices. Use @ref cv::Stitcher::create to get preconfigured pipeline for one -of those models. - -@note -Certain detailed settings of @ref cv::Stitcher might not make sense. Especially -you should not mix classes implementing affine model and classes implementing -Homography model, as they work with different transformations. - -@{ - @defgroup stitching_match Features Finding and Images Matching - @defgroup stitching_rotation Rotation Estimation - @defgroup stitching_autocalib Autocalibration - @defgroup stitching_warp Images Warping - @defgroup stitching_seam Seam Estimation - @defgroup stitching_exposure Exposure Compensation - @defgroup stitching_blend Image Blenders -@} - */ - -namespace cv { - -//! @addtogroup stitching -//! @{ - -/** @example samples/cpp/stitching.cpp -A basic example on image stitching -*/ - -/** @example samples/cpp/stitching_detailed.cpp -A detailed example on image stitching -*/ - -/** @brief High level image stitcher. - -It's possible to use this class without being aware of the entire stitching pipeline. However, to -be able to achieve higher stitching stability and quality of the final images at least being -familiar with the theory is recommended. - -@note - - A basic example on image stitching can be found at - opencv_source_code/samples/cpp/stitching.cpp - - A detailed example on image stitching can be found at - opencv_source_code/samples/cpp/stitching_detailed.cpp - */ -class CV_EXPORTS_W Stitcher -{ -public: - enum { ORIG_RESOL = -1 }; - enum Status - { - OK = 0, - ERR_NEED_MORE_IMGS = 1, - ERR_HOMOGRAPHY_EST_FAIL = 2, - ERR_CAMERA_PARAMS_ADJUST_FAIL = 3 - }; - enum Mode - { - /** Mode for creating photo panoramas. Expects images under perspective - transformation and projects resulting pano to sphere. - - @sa detail::BestOf2NearestMatcher SphericalWarper - */ - PANORAMA = 0, - /** Mode for composing scans. Expects images under affine transformation does - not compensate exposure by default. - - @sa detail::AffineBestOf2NearestMatcher AffineWarper - */ - SCANS = 1, - - }; - - // Stitcher() {} - /** @brief Creates a stitcher with the default parameters. - - @param try_use_gpu Flag indicating whether GPU should be used whenever it's possible. - @return Stitcher class instance. - */ - static Stitcher createDefault(bool try_use_gpu = false); - /** @brief Creates a Stitcher configured in one of the stitching modes. - - @param mode Scenario for stitcher operation. This is usually determined by source of images - to stitch and their transformation. Default parameters will be chosen for operation in given - scenario. - @param try_use_gpu Flag indicating whether GPU should be used whenever it's possible. - @return Stitcher class instance. - */ - static Ptr create(Mode mode = PANORAMA, bool try_use_gpu = false); - - CV_WRAP double registrationResol() const { return registr_resol_; } - CV_WRAP void setRegistrationResol(double resol_mpx) { registr_resol_ = resol_mpx; } - - CV_WRAP double seamEstimationResol() const { return seam_est_resol_; } - CV_WRAP void setSeamEstimationResol(double resol_mpx) { seam_est_resol_ = resol_mpx; } - - CV_WRAP double compositingResol() const { return compose_resol_; } - CV_WRAP void setCompositingResol(double resol_mpx) { compose_resol_ = resol_mpx; } - - CV_WRAP double panoConfidenceThresh() const { return conf_thresh_; } - CV_WRAP void setPanoConfidenceThresh(double conf_thresh) { conf_thresh_ = conf_thresh; } - - CV_WRAP bool waveCorrection() const { return do_wave_correct_; } - CV_WRAP void setWaveCorrection(bool flag) { do_wave_correct_ = flag; } - - detail::WaveCorrectKind waveCorrectKind() const { return wave_correct_kind_; } - void setWaveCorrectKind(detail::WaveCorrectKind kind) { wave_correct_kind_ = kind; } - - Ptr featuresFinder() { return features_finder_; } - const Ptr featuresFinder() const { return features_finder_; } - void setFeaturesFinder(Ptr features_finder) - { features_finder_ = features_finder; } - - Ptr featuresMatcher() { return features_matcher_; } - const Ptr featuresMatcher() const { return features_matcher_; } - void setFeaturesMatcher(Ptr features_matcher) - { features_matcher_ = features_matcher; } - - const cv::UMat& matchingMask() const { return matching_mask_; } - void setMatchingMask(const cv::UMat &mask) - { - CV_Assert(mask.type() == CV_8U && mask.cols == mask.rows); - matching_mask_ = mask.clone(); - } - - Ptr bundleAdjuster() { return bundle_adjuster_; } - const Ptr bundleAdjuster() const { return bundle_adjuster_; } - void setBundleAdjuster(Ptr bundle_adjuster) - { bundle_adjuster_ = bundle_adjuster; } - - /* TODO OpenCV ABI 4.x - Ptr estimator() { return estimator_; } - const Ptr estimator() const { return estimator_; } - void setEstimator(Ptr estimator) - { estimator_ = estimator; } - */ - - Ptr warper() { return warper_; } - const Ptr warper() const { return warper_; } - void setWarper(Ptr creator) { warper_ = creator; } - - Ptr exposureCompensator() { return exposure_comp_; } - const Ptr exposureCompensator() const { return exposure_comp_; } - void setExposureCompensator(Ptr exposure_comp) - { exposure_comp_ = exposure_comp; } - - Ptr seamFinder() { return seam_finder_; } - const Ptr seamFinder() const { return seam_finder_; } - void setSeamFinder(Ptr seam_finder) { seam_finder_ = seam_finder; } - - Ptr blender() { return blender_; } - const Ptr blender() const { return blender_; } - void setBlender(Ptr b) { blender_ = b; } - - /** @overload */ - CV_WRAP Status estimateTransform(InputArrayOfArrays images); - /** @brief These functions try to match the given images and to estimate rotations of each camera. - - @note Use the functions only if you're aware of the stitching pipeline, otherwise use - Stitcher::stitch. - - @param images Input images. - @param rois Region of interest rectangles. - @return Status code. - */ - Status estimateTransform(InputArrayOfArrays images, const std::vector > &rois); - - /** @overload */ - CV_WRAP Status composePanorama(OutputArray pano); - /** @brief These functions try to compose the given images (or images stored internally from the other function - calls) into the final pano under the assumption that the image transformations were estimated - before. - - @note Use the functions only if you're aware of the stitching pipeline, otherwise use - Stitcher::stitch. - - @param images Input images. - @param pano Final pano. - @return Status code. - */ - Status composePanorama(InputArrayOfArrays images, OutputArray pano); - - /** @overload */ - CV_WRAP Status stitch(InputArrayOfArrays images, OutputArray pano); - /** @brief These functions try to stitch the given images. - - @param images Input images. - @param rois Region of interest rectangles. - @param pano Final pano. - @return Status code. - */ - Status stitch(InputArrayOfArrays images, const std::vector > &rois, OutputArray pano); - - std::vector component() const { return indices_; } - std::vector cameras() const { return cameras_; } - CV_WRAP double workScale() const { return work_scale_; } - -private: - //Stitcher() {} - - Status matchImages(); - Status estimateCameraParams(); - - double registr_resol_; - double seam_est_resol_; - double compose_resol_; - double conf_thresh_; - Ptr features_finder_; - Ptr features_matcher_; - cv::UMat matching_mask_; - Ptr bundle_adjuster_; - /* TODO OpenCV ABI 4.x - Ptr estimator_; - */ - bool do_wave_correct_; - detail::WaveCorrectKind wave_correct_kind_; - Ptr warper_; - Ptr exposure_comp_; - Ptr seam_finder_; - Ptr blender_; - - std::vector imgs_; - std::vector > rois_; - std::vector full_img_sizes_; - std::vector features_; - std::vector pairwise_matches_; - std::vector seam_est_imgs_; - std::vector indices_; - std::vector cameras_; - double work_scale_; - double seam_scale_; - double seam_work_aspect_; - double warped_image_scale_; -}; - -CV_EXPORTS_W Ptr createStitcher(bool try_use_gpu = false); -CV_EXPORTS_W Ptr createStitcherScans(bool try_use_gpu = false); - -//! @} stitching - -} // namespace cv - -#endif // OPENCV_STITCHING_STITCHER_HPP diff --git a/opencv/include/opencv2/stitching/detail/autocalib.hpp b/opencv/include/opencv2/stitching/detail/autocalib.hpp deleted file mode 100644 index 19705e2..0000000 --- a/opencv/include/opencv2/stitching/detail/autocalib.hpp +++ /dev/null @@ -1,86 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_AUTOCALIB_HPP -#define OPENCV_STITCHING_AUTOCALIB_HPP - -#include "opencv2/core.hpp" -#include "matchers.hpp" - -namespace cv { -namespace detail { - -//! @addtogroup stitching_autocalib -//! @{ - -/** @brief Tries to estimate focal lengths from the given homography under the assumption that the camera -undergoes rotations around its centre only. - -@param H Homography. -@param f0 Estimated focal length along X axis. -@param f1 Estimated focal length along Y axis. -@param f0_ok True, if f0 was estimated successfully, false otherwise. -@param f1_ok True, if f1 was estimated successfully, false otherwise. - -See "Construction of Panoramic Image Mosaics with Global and Local Alignment" -by Heung-Yeung Shum and Richard Szeliski. - */ -void CV_EXPORTS focalsFromHomography(const Mat &H, double &f0, double &f1, bool &f0_ok, bool &f1_ok); - -/** @brief Estimates focal lengths for each given camera. - -@param features Features of images. -@param pairwise_matches Matches between all image pairs. -@param focals Estimated focal lengths for each camera. - */ -void CV_EXPORTS estimateFocal(const std::vector &features, - const std::vector &pairwise_matches, - std::vector &focals); - -bool CV_EXPORTS calibrateRotatingCamera(const std::vector &Hs, Mat &K); - -//! @} stitching_autocalib - -} // namespace detail -} // namespace cv - -#endif // OPENCV_STITCHING_AUTOCALIB_HPP diff --git a/opencv/include/opencv2/stitching/detail/blenders.hpp b/opencv/include/opencv2/stitching/detail/blenders.hpp deleted file mode 100644 index 542f1e4..0000000 --- a/opencv/include/opencv2/stitching/detail/blenders.hpp +++ /dev/null @@ -1,184 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_BLENDERS_HPP -#define OPENCV_STITCHING_BLENDERS_HPP - -#if defined(NO) -# warning Detected Apple 'NO' macro definition, it can cause build conflicts. Please, include this header before any Apple headers. -#endif - -#include "opencv2/core.hpp" -#include "opencv2/core/cuda.hpp" - -namespace cv { -namespace detail { - -//! @addtogroup stitching_blend -//! @{ - -/** @brief Base class for all blenders. - -Simple blender which puts one image over another -*/ -class CV_EXPORTS Blender -{ -public: - virtual ~Blender() {} - - enum { NO, FEATHER, MULTI_BAND }; - static Ptr createDefault(int type, bool try_gpu = false); - - /** @brief Prepares the blender for blending. - - @param corners Source images top-left corners - @param sizes Source image sizes - */ - void prepare(const std::vector &corners, const std::vector &sizes); - /** @overload */ - virtual void prepare(Rect dst_roi); - /** @brief Processes the image. - - @param img Source image - @param mask Source image mask - @param tl Source image top-left corners - */ - virtual void feed(InputArray img, InputArray mask, Point tl); - /** @brief Blends and returns the final pano. - - @param dst Final pano - @param dst_mask Final pano mask - */ - virtual void blend(InputOutputArray dst, InputOutputArray dst_mask); - -protected: - UMat dst_, dst_mask_; - Rect dst_roi_; -}; - -/** @brief Simple blender which mixes images at its borders. - */ -class CV_EXPORTS FeatherBlender : public Blender -{ -public: - FeatherBlender(float sharpness = 0.02f); - - float sharpness() const { return sharpness_; } - void setSharpness(float val) { sharpness_ = val; } - - void prepare(Rect dst_roi) CV_OVERRIDE; - void feed(InputArray img, InputArray mask, Point tl) CV_OVERRIDE; - void blend(InputOutputArray dst, InputOutputArray dst_mask) CV_OVERRIDE; - - //! Creates weight maps for fixed set of source images by their masks and top-left corners. - //! Final image can be obtained by simple weighting of the source images. - Rect createWeightMaps(const std::vector &masks, const std::vector &corners, - std::vector &weight_maps); - -private: - float sharpness_; - UMat weight_map_; - UMat dst_weight_map_; -}; - -inline FeatherBlender::FeatherBlender(float _sharpness) { setSharpness(_sharpness); } - -/** @brief Blender which uses multi-band blending algorithm (see @cite BA83). - */ -class CV_EXPORTS MultiBandBlender : public Blender -{ -public: - MultiBandBlender(int try_gpu = false, int num_bands = 5, int weight_type = CV_32F); - - int numBands() const { return actual_num_bands_; } - void setNumBands(int val) { actual_num_bands_ = val; } - - void prepare(Rect dst_roi) CV_OVERRIDE; - void feed(InputArray img, InputArray mask, Point tl) CV_OVERRIDE; - void blend(InputOutputArray dst, InputOutputArray dst_mask) CV_OVERRIDE; - -private: - int actual_num_bands_, num_bands_; - std::vector dst_pyr_laplace_; - std::vector dst_band_weights_; - Rect dst_roi_final_; - bool can_use_gpu_; - int weight_type_; //CV_32F or CV_16S -#if defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) - std::vector gpu_dst_pyr_laplace_; - std::vector gpu_dst_band_weights_; - std::vector gpu_tl_points_; - std::vector gpu_imgs_with_border_; - std::vector > gpu_weight_pyr_gauss_vec_; - std::vector > gpu_src_pyr_laplace_vec_; - std::vector > gpu_ups_; - cuda::GpuMat gpu_dst_mask_; - cuda::GpuMat gpu_mask_; - cuda::GpuMat gpu_img_; - cuda::GpuMat gpu_weight_map_; - cuda::GpuMat gpu_add_mask_; - int gpu_feed_idx_; - bool gpu_initialized_; -#endif -}; - - -////////////////////////////////////////////////////////////////////////////// -// Auxiliary functions - -void CV_EXPORTS normalizeUsingWeightMap(InputArray weight, InputOutputArray src); - -void CV_EXPORTS createWeightMap(InputArray mask, float sharpness, InputOutputArray weight); - -void CV_EXPORTS createLaplacePyr(InputArray img, int num_levels, std::vector& pyr); -void CV_EXPORTS createLaplacePyrGpu(InputArray img, int num_levels, std::vector& pyr); - -// Restores source image -void CV_EXPORTS restoreImageFromLaplacePyr(std::vector& pyr); -void CV_EXPORTS restoreImageFromLaplacePyrGpu(std::vector& pyr); - -//! @} - -} // namespace detail -} // namespace cv - -#endif // OPENCV_STITCHING_BLENDERS_HPP diff --git a/opencv/include/opencv2/stitching/detail/camera.hpp b/opencv/include/opencv2/stitching/detail/camera.hpp deleted file mode 100644 index 07c6b5b..0000000 --- a/opencv/include/opencv2/stitching/detail/camera.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_CAMERA_HPP -#define OPENCV_STITCHING_CAMERA_HPP - -#include "opencv2/core.hpp" - -namespace cv { -namespace detail { - -//! @addtogroup stitching -//! @{ - -/** @brief Describes camera parameters. - -@note Translation is assumed to be zero during the whole stitching pipeline. : - */ -struct CV_EXPORTS CameraParams -{ - CameraParams(); - CameraParams(const CameraParams& other); - CameraParams& operator =(const CameraParams& other); - Mat K() const; - - double focal; // Focal length - double aspect; // Aspect ratio - double ppx; // Principal point X - double ppy; // Principal point Y - Mat R; // Rotation - Mat t; // Translation -}; - -//! @} - -} // namespace detail -} // namespace cv - -#endif // #ifndef OPENCV_STITCHING_CAMERA_HPP diff --git a/opencv/include/opencv2/stitching/detail/exposure_compensate.hpp b/opencv/include/opencv2/stitching/detail/exposure_compensate.hpp deleted file mode 100644 index 6c99407..0000000 --- a/opencv/include/opencv2/stitching/detail/exposure_compensate.hpp +++ /dev/null @@ -1,136 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP -#define OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP - -#if defined(NO) -# warning Detected Apple 'NO' macro definition, it can cause build conflicts. Please, include this header before any Apple headers. -#endif - -#include "opencv2/core.hpp" - -namespace cv { -namespace detail { - -//! @addtogroup stitching_exposure -//! @{ - -/** @brief Base class for all exposure compensators. - */ -class CV_EXPORTS ExposureCompensator -{ -public: - virtual ~ExposureCompensator() {} - - enum { NO, GAIN, GAIN_BLOCKS }; - static Ptr createDefault(int type); - - /** - @param corners Source image top-left corners - @param images Source images - @param masks Image masks to update (second value in pair specifies the value which should be used - to detect where image is) - */ - void feed(const std::vector &corners, const std::vector &images, - const std::vector &masks); - /** @overload */ - virtual void feed(const std::vector &corners, const std::vector &images, - const std::vector > &masks) = 0; - /** @brief Compensate exposure in the specified image. - - @param index Image index - @param corner Image top-left corner - @param image Image to process - @param mask Image mask - */ - virtual void apply(int index, Point corner, InputOutputArray image, InputArray mask) = 0; -}; - -/** @brief Stub exposure compensator which does nothing. - */ -class CV_EXPORTS NoExposureCompensator : public ExposureCompensator -{ -public: - void feed(const std::vector &/*corners*/, const std::vector &/*images*/, - const std::vector > &/*masks*/) CV_OVERRIDE { } - void apply(int /*index*/, Point /*corner*/, InputOutputArray /*image*/, InputArray /*mask*/) CV_OVERRIDE { } -}; - -/** @brief Exposure compensator which tries to remove exposure related artifacts by adjusting image -intensities, see @cite BL07 and @cite WJ10 for details. - */ -class CV_EXPORTS GainCompensator : public ExposureCompensator -{ -public: - void feed(const std::vector &corners, const std::vector &images, - const std::vector > &masks) CV_OVERRIDE; - void apply(int index, Point corner, InputOutputArray image, InputArray mask) CV_OVERRIDE; - std::vector gains() const; - -private: - Mat_ gains_; -}; - -/** @brief Exposure compensator which tries to remove exposure related artifacts by adjusting image block -intensities, see @cite UES01 for details. - */ -class CV_EXPORTS BlocksGainCompensator : public ExposureCompensator -{ -public: - BlocksGainCompensator(int bl_width = 32, int bl_height = 32) - : bl_width_(bl_width), bl_height_(bl_height) {} - void feed(const std::vector &corners, const std::vector &images, - const std::vector > &masks) CV_OVERRIDE; - void apply(int index, Point corner, InputOutputArray image, InputArray mask) CV_OVERRIDE; - -private: - int bl_width_, bl_height_; - std::vector gain_maps_; -}; - -//! @} - -} // namespace detail -} // namespace cv - -#endif // OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP diff --git a/opencv/include/opencv2/stitching/detail/matchers.hpp b/opencv/include/opencv2/stitching/detail/matchers.hpp deleted file mode 100644 index 25c0f2a..0000000 --- a/opencv/include/opencv2/stitching/detail/matchers.hpp +++ /dev/null @@ -1,370 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_MATCHERS_HPP -#define OPENCV_STITCHING_MATCHERS_HPP - -#include "opencv2/core.hpp" -#include "opencv2/features2d.hpp" - -#include "opencv2/opencv_modules.hpp" - -#ifdef HAVE_OPENCV_XFEATURES2D -# include "opencv2/xfeatures2d/cuda.hpp" -#endif - -namespace cv { -namespace detail { - -//! @addtogroup stitching_match -//! @{ - -/** @brief Structure containing image keypoints and descriptors. */ -struct CV_EXPORTS ImageFeatures -{ - int img_idx; - Size img_size; - std::vector keypoints; - UMat descriptors; -}; - -/** @brief Feature finders base class */ -class CV_EXPORTS FeaturesFinder -{ -public: - virtual ~FeaturesFinder() {} - /** @overload */ - void operator ()(InputArray image, ImageFeatures &features); - /** @brief Finds features in the given image. - - @param image Source image - @param features Found features - @param rois Regions of interest - - @sa detail::ImageFeatures, Rect_ - */ - void operator ()(InputArray image, ImageFeatures &features, const std::vector &rois); - /** @brief Finds features in the given images in parallel. - - @param images Source images - @param features Found features for each image - @param rois Regions of interest for each image - - @sa detail::ImageFeatures, Rect_ - */ - void operator ()(InputArrayOfArrays images, std::vector &features, - const std::vector > &rois); - /** @overload */ - void operator ()(InputArrayOfArrays images, std::vector &features); - /** @brief Frees unused memory allocated before if there is any. */ - virtual void collectGarbage() {} - - /* TODO OpenCV ABI 4.x - reimplement this as public method similar to FeaturesMatcher and remove private function hack - @return True, if it's possible to use the same finder instance in parallel, false otherwise - bool isThreadSafe() const { return is_thread_safe_; } - */ - -protected: - /** @brief This method must implement features finding logic in order to make the wrappers - detail::FeaturesFinder::operator()_ work. - - @param image Source image - @param features Found features - - @sa detail::ImageFeatures */ - virtual void find(InputArray image, ImageFeatures &features) = 0; - /** @brief uses dynamic_cast to determine thread-safety - @return True, if it's possible to use the same finder instance in parallel, false otherwise - */ - bool isThreadSafe() const; -}; - -/** @brief SURF features finder. - -@sa detail::FeaturesFinder, SURF -*/ -class CV_EXPORTS SurfFeaturesFinder : public FeaturesFinder -{ -public: - SurfFeaturesFinder(double hess_thresh = 300., int num_octaves = 3, int num_layers = 4, - int num_octaves_descr = /*4*/3, int num_layers_descr = /*2*/4); - -private: - void find(InputArray image, ImageFeatures &features) CV_OVERRIDE; - - Ptr detector_; - Ptr extractor_; - Ptr surf; -}; - - -/** @brief SIFT features finder. - -@sa detail::FeaturesFinder, SIFT -*/ -class CV_EXPORTS SiftFeaturesFinder : public FeaturesFinder -{ -public: - SiftFeaturesFinder(); - -private: - void find(InputArray image, ImageFeatures &features) CV_OVERRIDE; - Ptr sift; -}; - -/** @brief ORB features finder. : - -@sa detail::FeaturesFinder, ORB -*/ -class CV_EXPORTS OrbFeaturesFinder : public FeaturesFinder -{ -public: - OrbFeaturesFinder(Size _grid_size = Size(3,1), int nfeatures=1500, float scaleFactor=1.3f, int nlevels=5); - -private: - void find(InputArray image, ImageFeatures &features) CV_OVERRIDE; - - Ptr orb; - Size grid_size; -}; - -/** @brief AKAZE features finder. : - -@sa detail::FeaturesFinder, AKAZE -*/ -class CV_EXPORTS AKAZEFeaturesFinder : public detail::FeaturesFinder -{ -public: - AKAZEFeaturesFinder(int descriptor_type = AKAZE::DESCRIPTOR_MLDB, - int descriptor_size = 0, - int descriptor_channels = 3, - float threshold = 0.001f, - int nOctaves = 4, - int nOctaveLayers = 4, - int diffusivity = KAZE::DIFF_PM_G2); - -private: - void find(InputArray image, ImageFeatures &features) CV_OVERRIDE; - - Ptr akaze; -}; - -#ifdef HAVE_OPENCV_XFEATURES2D -class CV_EXPORTS SurfFeaturesFinderGpu : public FeaturesFinder -{ -public: - SurfFeaturesFinderGpu(double hess_thresh = 300., int num_octaves = 3, int num_layers = 4, - int num_octaves_descr = 4, int num_layers_descr = 2); - - void collectGarbage() CV_OVERRIDE; - -private: - void find(InputArray image, ImageFeatures &features) CV_OVERRIDE; - - cuda::GpuMat image_; - cuda::GpuMat gray_image_; - cuda::SURF_CUDA surf_; - cuda::GpuMat keypoints_; - cuda::GpuMat descriptors_; - int num_octaves_, num_layers_; - int num_octaves_descr_, num_layers_descr_; -}; -#endif - -/** @brief Structure containing information about matches between two images. - -It's assumed that there is a transformation between those images. Transformation may be -homography or affine transformation based on selected matcher. - -@sa detail::FeaturesMatcher -*/ -struct CV_EXPORTS MatchesInfo -{ - MatchesInfo(); - MatchesInfo(const MatchesInfo &other); - MatchesInfo& operator =(const MatchesInfo &other); - - int src_img_idx, dst_img_idx; //!< Images indices (optional) - std::vector matches; - std::vector inliers_mask; //!< Geometrically consistent matches mask - int num_inliers; //!< Number of geometrically consistent matches - Mat H; //!< Estimated transformation - double confidence; //!< Confidence two images are from the same panorama -}; - -/** @brief Feature matchers base class. */ -class CV_EXPORTS FeaturesMatcher -{ -public: - virtual ~FeaturesMatcher() {} - - /** @overload - @param features1 First image features - @param features2 Second image features - @param matches_info Found matches - */ - void operator ()(const ImageFeatures &features1, const ImageFeatures &features2, - MatchesInfo& matches_info) { match(features1, features2, matches_info); } - - /** @brief Performs images matching. - - @param features Features of the source images - @param pairwise_matches Found pairwise matches - @param mask Mask indicating which image pairs must be matched - - The function is parallelized with the TBB library. - - @sa detail::MatchesInfo - */ - void operator ()(const std::vector &features, std::vector &pairwise_matches, - const cv::UMat &mask = cv::UMat()); - - /** @return True, if it's possible to use the same matcher instance in parallel, false otherwise - */ - bool isThreadSafe() const { return is_thread_safe_; } - - /** @brief Frees unused memory allocated before if there is any. - */ - virtual void collectGarbage() {} - -protected: - FeaturesMatcher(bool is_thread_safe = false) : is_thread_safe_(is_thread_safe) {} - - /** @brief This method must implement matching logic in order to make the wrappers - detail::FeaturesMatcher::operator()_ work. - - @param features1 first image features - @param features2 second image features - @param matches_info found matches - */ - virtual void match(const ImageFeatures &features1, const ImageFeatures &features2, - MatchesInfo& matches_info) = 0; - - bool is_thread_safe_; -}; - -/** @brief Features matcher which finds two best matches for each feature and leaves the best one only if the -ratio between descriptor distances is greater than the threshold match_conf - -@sa detail::FeaturesMatcher - */ -class CV_EXPORTS BestOf2NearestMatcher : public FeaturesMatcher -{ -public: - /** @brief Constructs a "best of 2 nearest" matcher. - - @param try_use_gpu Should try to use GPU or not - @param match_conf Match distances ration threshold - @param num_matches_thresh1 Minimum number of matches required for the 2D projective transform - estimation used in the inliers classification step - @param num_matches_thresh2 Minimum number of matches required for the 2D projective transform - re-estimation on inliers - */ - BestOf2NearestMatcher(bool try_use_gpu = false, float match_conf = 0.3f, int num_matches_thresh1 = 6, - int num_matches_thresh2 = 6); - - void collectGarbage() CV_OVERRIDE; - -protected: - void match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo &matches_info) CV_OVERRIDE; - - int num_matches_thresh1_; - int num_matches_thresh2_; - Ptr impl_; -}; - -class CV_EXPORTS BestOf2NearestRangeMatcher : public BestOf2NearestMatcher -{ -public: - BestOf2NearestRangeMatcher(int range_width = 5, bool try_use_gpu = false, float match_conf = 0.3f, - int num_matches_thresh1 = 6, int num_matches_thresh2 = 6); - - void operator ()(const std::vector &features, std::vector &pairwise_matches, - const cv::UMat &mask = cv::UMat()); - - -protected: - int range_width_; -}; - -/** @brief Features matcher similar to cv::detail::BestOf2NearestMatcher which -finds two best matches for each feature and leaves the best one only if the -ratio between descriptor distances is greater than the threshold match_conf. - -Unlike cv::detail::BestOf2NearestMatcher this matcher uses affine -transformation (affine trasformation estimate will be placed in matches_info). - -@sa cv::detail::FeaturesMatcher cv::detail::BestOf2NearestMatcher - */ -class CV_EXPORTS AffineBestOf2NearestMatcher : public BestOf2NearestMatcher -{ -public: - /** @brief Constructs a "best of 2 nearest" matcher that expects affine trasformation - between images - - @param full_affine whether to use full affine transformation with 6 degress of freedom or reduced - transformation with 4 degrees of freedom using only rotation, translation and uniform scaling - @param try_use_gpu Should try to use GPU or not - @param match_conf Match distances ration threshold - @param num_matches_thresh1 Minimum number of matches required for the 2D affine transform - estimation used in the inliers classification step - - @sa cv::estimateAffine2D cv::estimateAffinePartial2D - */ - AffineBestOf2NearestMatcher(bool full_affine = false, bool try_use_gpu = false, - float match_conf = 0.3f, int num_matches_thresh1 = 6) : - BestOf2NearestMatcher(try_use_gpu, match_conf, num_matches_thresh1, num_matches_thresh1), - full_affine_(full_affine) {} - -protected: - void match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo &matches_info) CV_OVERRIDE; - - bool full_affine_; -}; - -//! @} stitching_match - -} // namespace detail -} // namespace cv - -#endif // OPENCV_STITCHING_MATCHERS_HPP diff --git a/opencv/include/opencv2/stitching/detail/motion_estimators.hpp b/opencv/include/opencv2/stitching/detail/motion_estimators.hpp deleted file mode 100644 index 40f12c3..0000000 --- a/opencv/include/opencv2/stitching/detail/motion_estimators.hpp +++ /dev/null @@ -1,359 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_MOTION_ESTIMATORS_HPP -#define OPENCV_STITCHING_MOTION_ESTIMATORS_HPP - -#include "opencv2/core.hpp" -#include "matchers.hpp" -#include "util.hpp" -#include "camera.hpp" - -namespace cv { -namespace detail { - -//! @addtogroup stitching_rotation -//! @{ - -/** @brief Rotation estimator base class. - -It takes features of all images, pairwise matches between all images and estimates rotations of all -cameras. - -@note The coordinate system origin is implementation-dependent, but you can always normalize the -rotations in respect to the first camera, for instance. : - */ -class CV_EXPORTS Estimator -{ -public: - virtual ~Estimator() {} - - /** @brief Estimates camera parameters. - - @param features Features of images - @param pairwise_matches Pairwise matches of images - @param cameras Estimated camera parameters - @return True in case of success, false otherwise - */ - bool operator ()(const std::vector &features, - const std::vector &pairwise_matches, - std::vector &cameras) - { return estimate(features, pairwise_matches, cameras); } - -protected: - /** @brief This method must implement camera parameters estimation logic in order to make the wrapper - detail::Estimator::operator()_ work. - - @param features Features of images - @param pairwise_matches Pairwise matches of images - @param cameras Estimated camera parameters - @return True in case of success, false otherwise - */ - virtual bool estimate(const std::vector &features, - const std::vector &pairwise_matches, - std::vector &cameras) = 0; -}; - -/** @brief Homography based rotation estimator. - */ -class CV_EXPORTS HomographyBasedEstimator : public Estimator -{ -public: - HomographyBasedEstimator(bool is_focals_estimated = false) - : is_focals_estimated_(is_focals_estimated) {} - -private: - virtual bool estimate(const std::vector &features, - const std::vector &pairwise_matches, - std::vector &cameras) CV_OVERRIDE; - - bool is_focals_estimated_; -}; - -/** @brief Affine transformation based estimator. - -This estimator uses pairwise transformations estimated by matcher to estimate -final transformation for each camera. - -@sa cv::detail::HomographyBasedEstimator - */ -class CV_EXPORTS AffineBasedEstimator : public Estimator -{ -private: - virtual bool estimate(const std::vector &features, - const std::vector &pairwise_matches, - std::vector &cameras) CV_OVERRIDE; -}; - -/** @brief Base class for all camera parameters refinement methods. - */ -class CV_EXPORTS BundleAdjusterBase : public Estimator -{ -public: - const Mat refinementMask() const { return refinement_mask_.clone(); } - void setRefinementMask(const Mat &mask) - { - CV_Assert(mask.type() == CV_8U && mask.size() == Size(3, 3)); - refinement_mask_ = mask.clone(); - } - - double confThresh() const { return conf_thresh_; } - void setConfThresh(double conf_thresh) { conf_thresh_ = conf_thresh; } - - TermCriteria termCriteria() { return term_criteria_; } - void setTermCriteria(const TermCriteria& term_criteria) { term_criteria_ = term_criteria; } - -protected: - /** @brief Construct a bundle adjuster base instance. - - @param num_params_per_cam Number of parameters per camera - @param num_errs_per_measurement Number of error terms (components) per match - */ - BundleAdjusterBase(int num_params_per_cam, int num_errs_per_measurement) - : num_images_(0), total_num_matches_(0), - num_params_per_cam_(num_params_per_cam), - num_errs_per_measurement_(num_errs_per_measurement), - features_(0), pairwise_matches_(0), conf_thresh_(0) - { - setRefinementMask(Mat::ones(3, 3, CV_8U)); - setConfThresh(1.); - setTermCriteria(TermCriteria(TermCriteria::EPS + TermCriteria::COUNT, 1000, DBL_EPSILON)); - } - - // Runs bundle adjustment - virtual bool estimate(const std::vector &features, - const std::vector &pairwise_matches, - std::vector &cameras) CV_OVERRIDE; - - /** @brief Sets initial camera parameter to refine. - - @param cameras Camera parameters - */ - virtual void setUpInitialCameraParams(const std::vector &cameras) = 0; - /** @brief Gets the refined camera parameters. - - @param cameras Refined camera parameters - */ - virtual void obtainRefinedCameraParams(std::vector &cameras) const = 0; - /** @brief Calculates error vector. - - @param err Error column-vector of length total_num_matches \* num_errs_per_measurement - */ - virtual void calcError(Mat &err) = 0; - /** @brief Calculates the cost function jacobian. - - @param jac Jacobian matrix of dimensions - (total_num_matches \* num_errs_per_measurement) x (num_images \* num_params_per_cam) - */ - virtual void calcJacobian(Mat &jac) = 0; - - // 3x3 8U mask, where 0 means don't refine respective parameter, != 0 means refine - Mat refinement_mask_; - - int num_images_; - int total_num_matches_; - - int num_params_per_cam_; - int num_errs_per_measurement_; - - const ImageFeatures *features_; - const MatchesInfo *pairwise_matches_; - - // Threshold to filter out poorly matched image pairs - double conf_thresh_; - - //Levenberg-Marquardt algorithm termination criteria - TermCriteria term_criteria_; - - // Camera parameters matrix (CV_64F) - Mat cam_params_; - - // Connected images pairs - std::vector > edges_; -}; - - -/** @brief Stub bundle adjuster that does nothing. - */ -class CV_EXPORTS NoBundleAdjuster : public BundleAdjusterBase -{ -public: - NoBundleAdjuster() : BundleAdjusterBase(0, 0) {} - -private: - bool estimate(const std::vector &, const std::vector &, - std::vector &) CV_OVERRIDE - { - return true; - } - void setUpInitialCameraParams(const std::vector &) CV_OVERRIDE {} - void obtainRefinedCameraParams(std::vector &) const CV_OVERRIDE {} - void calcError(Mat &) CV_OVERRIDE {} - void calcJacobian(Mat &) CV_OVERRIDE {} -}; - - -/** @brief Implementation of the camera parameters refinement algorithm which minimizes sum of the reprojection -error squares - -It can estimate focal length, aspect ratio, principal point. -You can affect only on them via the refinement mask. - */ -class CV_EXPORTS BundleAdjusterReproj : public BundleAdjusterBase -{ -public: - BundleAdjusterReproj() : BundleAdjusterBase(7, 2) {} - -private: - void setUpInitialCameraParams(const std::vector &cameras) CV_OVERRIDE; - void obtainRefinedCameraParams(std::vector &cameras) const CV_OVERRIDE; - void calcError(Mat &err) CV_OVERRIDE; - void calcJacobian(Mat &jac) CV_OVERRIDE; - - Mat err1_, err2_; -}; - - -/** @brief Implementation of the camera parameters refinement algorithm which minimizes sum of the distances -between the rays passing through the camera center and a feature. : - -It can estimate focal length. It ignores the refinement mask for now. - */ -class CV_EXPORTS BundleAdjusterRay : public BundleAdjusterBase -{ -public: - BundleAdjusterRay() : BundleAdjusterBase(4, 3) {} - -private: - void setUpInitialCameraParams(const std::vector &cameras) CV_OVERRIDE; - void obtainRefinedCameraParams(std::vector &cameras) const CV_OVERRIDE; - void calcError(Mat &err) CV_OVERRIDE; - void calcJacobian(Mat &jac) CV_OVERRIDE; - - Mat err1_, err2_; -}; - - -/** @brief Bundle adjuster that expects affine transformation -represented in homogeneous coordinates in R for each camera param. Implements -camera parameters refinement algorithm which minimizes sum of the reprojection -error squares - -It estimates all transformation parameters. Refinement mask is ignored. - -@sa AffineBasedEstimator AffineBestOf2NearestMatcher BundleAdjusterAffinePartial - */ -class CV_EXPORTS BundleAdjusterAffine : public BundleAdjusterBase -{ -public: - BundleAdjusterAffine() : BundleAdjusterBase(6, 2) {} - -private: - void setUpInitialCameraParams(const std::vector &cameras) CV_OVERRIDE; - void obtainRefinedCameraParams(std::vector &cameras) const CV_OVERRIDE; - void calcError(Mat &err) CV_OVERRIDE; - void calcJacobian(Mat &jac) CV_OVERRIDE; - - Mat err1_, err2_; -}; - - -/** @brief Bundle adjuster that expects affine transformation with 4 DOF -represented in homogeneous coordinates in R for each camera param. Implements -camera parameters refinement algorithm which minimizes sum of the reprojection -error squares - -It estimates all transformation parameters. Refinement mask is ignored. - -@sa AffineBasedEstimator AffineBestOf2NearestMatcher BundleAdjusterAffine - */ -class CV_EXPORTS BundleAdjusterAffinePartial : public BundleAdjusterBase -{ -public: - BundleAdjusterAffinePartial() : BundleAdjusterBase(4, 2) {} - -private: - void setUpInitialCameraParams(const std::vector &cameras) CV_OVERRIDE; - void obtainRefinedCameraParams(std::vector &cameras) const CV_OVERRIDE; - void calcError(Mat &err) CV_OVERRIDE; - void calcJacobian(Mat &jac) CV_OVERRIDE; - - Mat err1_, err2_; -}; - - -enum WaveCorrectKind -{ - WAVE_CORRECT_HORIZ, - WAVE_CORRECT_VERT -}; - -/** @brief Tries to make panorama more horizontal (or vertical). - -@param rmats Camera rotation matrices. -@param kind Correction kind, see detail::WaveCorrectKind. - */ -void CV_EXPORTS waveCorrect(std::vector &rmats, WaveCorrectKind kind); - - -////////////////////////////////////////////////////////////////////////////// -// Auxiliary functions - -// Returns matches graph representation in DOT language -String CV_EXPORTS matchesGraphAsString(std::vector &pathes, std::vector &pairwise_matches, - float conf_threshold); - -std::vector CV_EXPORTS leaveBiggestComponent( - std::vector &features, - std::vector &pairwise_matches, - float conf_threshold); - -void CV_EXPORTS findMaxSpanningTree( - int num_images, const std::vector &pairwise_matches, - Graph &span_tree, std::vector ¢ers); - -//! @} stitching_rotation - -} // namespace detail -} // namespace cv - -#endif // OPENCV_STITCHING_MOTION_ESTIMATORS_HPP diff --git a/opencv/include/opencv2/stitching/detail/seam_finders.hpp b/opencv/include/opencv2/stitching/detail/seam_finders.hpp deleted file mode 100644 index 904f0ec..0000000 --- a/opencv/include/opencv2/stitching/detail/seam_finders.hpp +++ /dev/null @@ -1,285 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_SEAM_FINDERS_HPP -#define OPENCV_STITCHING_SEAM_FINDERS_HPP - -#include -#include "opencv2/core.hpp" -#include "opencv2/opencv_modules.hpp" - -namespace cv { -namespace detail { - -//! @addtogroup stitching_seam -//! @{ - -/** @brief Base class for a seam estimator. - */ -class CV_EXPORTS SeamFinder -{ -public: - virtual ~SeamFinder() {} - /** @brief Estimates seams. - - @param src Source images - @param corners Source image top-left corners - @param masks Source image masks to update - */ - virtual void find(const std::vector &src, const std::vector &corners, - std::vector &masks) = 0; -}; - -/** @brief Stub seam estimator which does nothing. - */ -class CV_EXPORTS NoSeamFinder : public SeamFinder -{ -public: - void find(const std::vector&, const std::vector&, std::vector&) CV_OVERRIDE {} -}; - -/** @brief Base class for all pairwise seam estimators. - */ -class CV_EXPORTS PairwiseSeamFinder : public SeamFinder -{ -public: - virtual void find(const std::vector &src, const std::vector &corners, - std::vector &masks) CV_OVERRIDE; - -protected: - void run(); - /** @brief Resolves masks intersection of two specified images in the given ROI. - - @param first First image index - @param second Second image index - @param roi Region of interest - */ - virtual void findInPair(size_t first, size_t second, Rect roi) = 0; - - std::vector images_; - std::vector sizes_; - std::vector corners_; - std::vector masks_; -}; - -/** @brief Voronoi diagram-based seam estimator. - */ -class CV_EXPORTS VoronoiSeamFinder : public PairwiseSeamFinder -{ -public: - virtual void find(const std::vector &src, const std::vector &corners, - std::vector &masks) CV_OVERRIDE; - virtual void find(const std::vector &size, const std::vector &corners, - std::vector &masks); -private: - void findInPair(size_t first, size_t second, Rect roi) CV_OVERRIDE; -}; - - -class CV_EXPORTS DpSeamFinder : public SeamFinder -{ -public: - enum CostFunction { COLOR, COLOR_GRAD }; - - DpSeamFinder(CostFunction costFunc = COLOR); - - CostFunction costFunction() const { return costFunc_; } - void setCostFunction(CostFunction val) { costFunc_ = val; } - - virtual void find(const std::vector &src, const std::vector &corners, - std::vector &masks) CV_OVERRIDE; - -private: - enum ComponentState - { - FIRST = 1, SECOND = 2, INTERS = 4, - INTERS_FIRST = INTERS | FIRST, - INTERS_SECOND = INTERS | SECOND - }; - - class ImagePairLess - { - public: - ImagePairLess(const std::vector &images, const std::vector &corners) - : src_(&images[0]), corners_(&corners[0]) {} - - bool operator() (const std::pair &l, const std::pair &r) const - { - Point c1 = corners_[l.first] + Point(src_[l.first].cols / 2, src_[l.first].rows / 2); - Point c2 = corners_[l.second] + Point(src_[l.second].cols / 2, src_[l.second].rows / 2); - int d1 = (c1 - c2).dot(c1 - c2); - - c1 = corners_[r.first] + Point(src_[r.first].cols / 2, src_[r.first].rows / 2); - c2 = corners_[r.second] + Point(src_[r.second].cols / 2, src_[r.second].rows / 2); - int d2 = (c1 - c2).dot(c1 - c2); - - return d1 < d2; - } - - private: - const Mat *src_; - const Point *corners_; - }; - - class ClosePoints - { - public: - ClosePoints(int minDist) : minDist_(minDist) {} - - bool operator() (const Point &p1, const Point &p2) const - { - int dist2 = (p1.x-p2.x) * (p1.x-p2.x) + (p1.y-p2.y) * (p1.y-p2.y); - return dist2 < minDist_ * minDist_; - } - - private: - int minDist_; - }; - - void process( - const Mat &image1, const Mat &image2, Point tl1, Point tl2, Mat &mask1, Mat &mask2); - - void findComponents(); - - void findEdges(); - - void resolveConflicts( - const Mat &image1, const Mat &image2, Point tl1, Point tl2, Mat &mask1, Mat &mask2); - - void computeGradients(const Mat &image1, const Mat &image2); - - bool hasOnlyOneNeighbor(int comp); - - bool closeToContour(int y, int x, const Mat_ &contourMask); - - bool getSeamTips(int comp1, int comp2, Point &p1, Point &p2); - - void computeCosts( - const Mat &image1, const Mat &image2, Point tl1, Point tl2, - int comp, Mat_ &costV, Mat_ &costH); - - bool estimateSeam( - const Mat &image1, const Mat &image2, Point tl1, Point tl2, int comp, - Point p1, Point p2, std::vector &seam, bool &isHorizontal); - - void updateLabelsUsingSeam( - int comp1, int comp2, const std::vector &seam, bool isHorizontalSeam); - - CostFunction costFunc_; - - // processing images pair data - Point unionTl_, unionBr_; - Size unionSize_; - Mat_ mask1_, mask2_; - Mat_ contour1mask_, contour2mask_; - Mat_ gradx1_, grady1_; - Mat_ gradx2_, grady2_; - - // components data - int ncomps_; - Mat_ labels_; - std::vector states_; - std::vector tls_, brs_; - std::vector > contours_; - std::set > edges_; -}; - -/** @brief Base class for all minimum graph-cut-based seam estimators. - */ -class CV_EXPORTS GraphCutSeamFinderBase -{ -public: - enum CostType { COST_COLOR, COST_COLOR_GRAD }; -}; - -/** @brief Minimum graph cut-based seam estimator. See details in @cite V03 . - */ -class CV_EXPORTS GraphCutSeamFinder : public GraphCutSeamFinderBase, public SeamFinder -{ -public: - GraphCutSeamFinder(int cost_type = COST_COLOR_GRAD, float terminal_cost = 10000.f, - float bad_region_penalty = 1000.f); - - ~GraphCutSeamFinder(); - - void find(const std::vector &src, const std::vector &corners, - std::vector &masks) CV_OVERRIDE; - -private: - // To avoid GCGraph dependency - class Impl; - Ptr impl_; -}; - - -#ifdef HAVE_OPENCV_CUDALEGACY -class CV_EXPORTS GraphCutSeamFinderGpu : public GraphCutSeamFinderBase, public PairwiseSeamFinder -{ -public: - GraphCutSeamFinderGpu(int cost_type = COST_COLOR_GRAD, float terminal_cost = 10000.f, - float bad_region_penalty = 1000.f) - : cost_type_(cost_type), terminal_cost_(terminal_cost), - bad_region_penalty_(bad_region_penalty) {} - - void find(const std::vector &src, const std::vector &corners, - std::vector &masks) CV_OVERRIDE; - void findInPair(size_t first, size_t second, Rect roi) CV_OVERRIDE; - -private: - void setGraphWeightsColor(const cv::Mat &img1, const cv::Mat &img2, const cv::Mat &mask1, const cv::Mat &mask2, - cv::Mat &terminals, cv::Mat &leftT, cv::Mat &rightT, cv::Mat &top, cv::Mat &bottom); - void setGraphWeightsColorGrad(const cv::Mat &img1, const cv::Mat &img2, const cv::Mat &dx1, const cv::Mat &dx2, - const cv::Mat &dy1, const cv::Mat &dy2, const cv::Mat &mask1, const cv::Mat &mask2, - cv::Mat &terminals, cv::Mat &leftT, cv::Mat &rightT, cv::Mat &top, cv::Mat &bottom); - std::vector dx_, dy_; - int cost_type_; - float terminal_cost_; - float bad_region_penalty_; -}; -#endif - -//! @} - -} // namespace detail -} // namespace cv - -#endif // OPENCV_STITCHING_SEAM_FINDERS_HPP diff --git a/opencv/include/opencv2/stitching/detail/timelapsers.hpp b/opencv/include/opencv2/stitching/detail/timelapsers.hpp deleted file mode 100644 index 74d797e..0000000 --- a/opencv/include/opencv2/stitching/detail/timelapsers.hpp +++ /dev/null @@ -1,91 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - - -#ifndef OPENCV_STITCHING_TIMELAPSERS_HPP -#define OPENCV_STITCHING_TIMELAPSERS_HPP - -#include "opencv2/core.hpp" - -namespace cv { -namespace detail { - -//! @addtogroup stitching -//! @{ - -// Base Timelapser class, takes a sequence of images, applies appropriate shift, stores result in dst_. - -class CV_EXPORTS Timelapser -{ -public: - - enum {AS_IS, CROP}; - - virtual ~Timelapser() {} - - static Ptr createDefault(int type); - - virtual void initialize(const std::vector &corners, const std::vector &sizes); - virtual void process(InputArray img, InputArray mask, Point tl); - virtual const UMat& getDst() {return dst_;} - -protected: - - virtual bool test_point(Point pt); - - UMat dst_; - Rect dst_roi_; -}; - - -class CV_EXPORTS TimelapserCrop : public Timelapser -{ -public: - virtual void initialize(const std::vector &corners, const std::vector &sizes) CV_OVERRIDE; -}; - -//! @} - -} // namespace detail -} // namespace cv - -#endif // OPENCV_STITCHING_TIMELAPSERS_HPP diff --git a/opencv/include/opencv2/stitching/detail/util.hpp b/opencv/include/opencv2/stitching/detail/util.hpp deleted file mode 100644 index 78301b8..0000000 --- a/opencv/include/opencv2/stitching/detail/util.hpp +++ /dev/null @@ -1,121 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_UTIL_HPP -#define OPENCV_STITCHING_UTIL_HPP - -#include -#include "opencv2/core.hpp" - -namespace cv { -namespace detail { - -//! @addtogroup stitching -//! @{ - -class CV_EXPORTS DisjointSets -{ -public: - DisjointSets(int elem_count = 0) { createOneElemSets(elem_count); } - - void createOneElemSets(int elem_count); - int findSetByElem(int elem); - int mergeSets(int set1, int set2); - - std::vector parent; - std::vector size; - -private: - std::vector rank_; -}; - - -struct CV_EXPORTS GraphEdge -{ - GraphEdge(int from, int to, float weight); - bool operator <(const GraphEdge& other) const { return weight < other.weight; } - bool operator >(const GraphEdge& other) const { return weight > other.weight; } - - int from, to; - float weight; -}; - -inline GraphEdge::GraphEdge(int _from, int _to, float _weight) : from(_from), to(_to), weight(_weight) {} - - -class CV_EXPORTS Graph -{ -public: - Graph(int num_vertices = 0) { create(num_vertices); } - void create(int num_vertices) { edges_.assign(num_vertices, std::list()); } - int numVertices() const { return static_cast(edges_.size()); } - void addEdge(int from, int to, float weight); - template B forEach(B body) const; - template B walkBreadthFirst(int from, B body) const; - -private: - std::vector< std::list > edges_; -}; - - -////////////////////////////////////////////////////////////////////////////// -// Auxiliary functions - -CV_EXPORTS bool overlapRoi(Point tl1, Point tl2, Size sz1, Size sz2, Rect &roi); -CV_EXPORTS Rect resultRoi(const std::vector &corners, const std::vector &images); -CV_EXPORTS Rect resultRoi(const std::vector &corners, const std::vector &sizes); -CV_EXPORTS Rect resultRoiIntersection(const std::vector &corners, const std::vector &sizes); -CV_EXPORTS Point resultTl(const std::vector &corners); - -// Returns random 'count' element subset of the {0,1,...,size-1} set -CV_EXPORTS void selectRandomSubset(int count, int size, std::vector &subset); - -CV_EXPORTS int& stitchingLogLevel(); - -//! @} - -} // namespace detail -} // namespace cv - -#include "util_inl.hpp" - -#endif // OPENCV_STITCHING_UTIL_HPP diff --git a/opencv/include/opencv2/stitching/detail/util_inl.hpp b/opencv/include/opencv2/stitching/detail/util_inl.hpp deleted file mode 100644 index dafab8b..0000000 --- a/opencv/include/opencv2/stitching/detail/util_inl.hpp +++ /dev/null @@ -1,131 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_UTIL_INL_HPP -#define OPENCV_STITCHING_UTIL_INL_HPP - -#include -#include "opencv2/core.hpp" -#include "util.hpp" // Make your IDE see declarations - -//! @cond IGNORED - -namespace cv { -namespace detail { - -template -B Graph::forEach(B body) const -{ - for (int i = 0; i < numVertices(); ++i) - { - std::list::const_iterator edge = edges_[i].begin(); - for (; edge != edges_[i].end(); ++edge) - body(*edge); - } - return body; -} - - -template -B Graph::walkBreadthFirst(int from, B body) const -{ - std::vector was(numVertices(), false); - std::queue vertices; - - was[from] = true; - vertices.push(from); - - while (!vertices.empty()) - { - int vertex = vertices.front(); - vertices.pop(); - - std::list::const_iterator edge = edges_[vertex].begin(); - for (; edge != edges_[vertex].end(); ++edge) - { - if (!was[edge->to]) - { - body(*edge); - was[edge->to] = true; - vertices.push(edge->to); - } - } - } - - return body; -} - - -////////////////////////////////////////////////////////////////////////////// -// Some auxiliary math functions - -static inline -float normL2(const Point3f& a) -{ - return a.x * a.x + a.y * a.y + a.z * a.z; -} - - -static inline -float normL2(const Point3f& a, const Point3f& b) -{ - return normL2(a - b); -} - - -static inline -double normL2sq(const Mat &r) -{ - return r.dot(r); -} - - -static inline int sqr(int x) { return x * x; } -static inline float sqr(float x) { return x * x; } -static inline double sqr(double x) { return x * x; } - -} // namespace detail -} // namespace cv - -//! @endcond - -#endif // OPENCV_STITCHING_UTIL_INL_HPP diff --git a/opencv/include/opencv2/stitching/detail/warpers.hpp b/opencv/include/opencv2/stitching/detail/warpers.hpp deleted file mode 100644 index 1b05651..0000000 --- a/opencv/include/opencv2/stitching/detail/warpers.hpp +++ /dev/null @@ -1,616 +0,0 @@ - /*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_WARPERS_HPP -#define OPENCV_STITCHING_WARPERS_HPP - -#include "opencv2/core.hpp" -#include "opencv2/core/cuda.hpp" -#include "opencv2/imgproc.hpp" -#include "opencv2/opencv_modules.hpp" - -namespace cv { -namespace detail { - -//! @addtogroup stitching_warp -//! @{ - -/** @brief Rotation-only model image warper interface. - */ -class CV_EXPORTS RotationWarper -{ -public: - virtual ~RotationWarper() {} - - /** @brief Projects the image point. - - @param pt Source point - @param K Camera intrinsic parameters - @param R Camera rotation matrix - @return Projected point - */ - virtual Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) = 0; - - /** @brief Builds the projection maps according to the given camera data. - - @param src_size Source image size - @param K Camera intrinsic parameters - @param R Camera rotation matrix - @param xmap Projection map for the x axis - @param ymap Projection map for the y axis - @return Projected image minimum bounding box - */ - virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) = 0; - - /** @brief Projects the image. - - @param src Source image - @param K Camera intrinsic parameters - @param R Camera rotation matrix - @param interp_mode Interpolation mode - @param border_mode Border extrapolation mode - @param dst Projected image - @return Project image top-left corner - */ - virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, - OutputArray dst) = 0; - - /** @brief Projects the image backward. - - @param src Projected image - @param K Camera intrinsic parameters - @param R Camera rotation matrix - @param interp_mode Interpolation mode - @param border_mode Border extrapolation mode - @param dst_size Backward-projected image size - @param dst Backward-projected image - */ - virtual void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, - Size dst_size, OutputArray dst) = 0; - - /** - @param src_size Source image bounding box - @param K Camera intrinsic parameters - @param R Camera rotation matrix - @return Projected image minimum bounding box - */ - virtual Rect warpRoi(Size src_size, InputArray K, InputArray R) = 0; - - virtual float getScale() const { return 1.f; } - virtual void setScale(float) {} -}; - -/** @brief Base class for warping logic implementation. - */ -struct CV_EXPORTS ProjectorBase -{ - void setCameraParams(InputArray K = Mat::eye(3, 3, CV_32F), - InputArray R = Mat::eye(3, 3, CV_32F), - InputArray T = Mat::zeros(3, 1, CV_32F)); - - float scale; - float k[9]; - float rinv[9]; - float r_kinv[9]; - float k_rinv[9]; - float t[3]; -}; - -/** @brief Base class for rotation-based warper using a detail::ProjectorBase_ derived class. - */ -template -class CV_EXPORTS_TEMPLATE RotationWarperBase : public RotationWarper -{ -public: - Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE; - - Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE; - - Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, - OutputArray dst) CV_OVERRIDE; - - void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, - Size dst_size, OutputArray dst) CV_OVERRIDE; - - Rect warpRoi(Size src_size, InputArray K, InputArray R) CV_OVERRIDE; - - float getScale() const CV_OVERRIDE{ return projector_.scale; } - void setScale(float val) CV_OVERRIDE { projector_.scale = val; } - -protected: - - // Detects ROI of the destination image. It's correct for any projection. - virtual void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br); - - // Detects ROI of the destination image by walking over image border. - // Correctness for any projection isn't guaranteed. - void detectResultRoiByBorder(Size src_size, Point &dst_tl, Point &dst_br); - - P projector_; -}; - - -struct CV_EXPORTS PlaneProjector : ProjectorBase -{ - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - -/** @brief Warper that maps an image onto the z = 1 plane. - */ -class CV_EXPORTS PlaneWarper : public RotationWarperBase -{ -public: - /** @brief Construct an instance of the plane warper class. - - @param scale Projected image scale multiplier - */ - PlaneWarper(float scale = 1.f) { projector_.scale = scale; } - - Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE; - Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R, InputArray T); - - virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap); - Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE; - - Point warp(InputArray src, InputArray K, InputArray R, - int interp_mode, int border_mode, OutputArray dst) CV_OVERRIDE; - virtual Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode, - OutputArray dst); - - Rect warpRoi(Size src_size, InputArray K, InputArray R) CV_OVERRIDE; - Rect warpRoi(Size src_size, InputArray K, InputArray R, InputArray T); - -protected: - void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE; -}; - - -/** @brief Affine warper that uses rotations and translations - - Uses affine transformation in homogeneous coordinates to represent both rotation and - translation in camera rotation matrix. - */ -class CV_EXPORTS AffineWarper : public PlaneWarper -{ -public: - /** @brief Construct an instance of the affine warper class. - - @param scale Projected image scale multiplier - */ - AffineWarper(float scale = 1.f) : PlaneWarper(scale) {} - - Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE; - Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE; - Point warp(InputArray src, InputArray K, InputArray R, - int interp_mode, int border_mode, OutputArray dst) CV_OVERRIDE; - Rect warpRoi(Size src_size, InputArray K, InputArray R) CV_OVERRIDE; - -protected: - /** @brief Extracts rotation and translation matrices from matrix H representing - affine transformation in homogeneous coordinates - */ - void getRTfromHomogeneous(InputArray H, Mat &R, Mat &T); -}; - - -struct CV_EXPORTS SphericalProjector : ProjectorBase -{ - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -/** @brief Warper that maps an image onto the unit sphere located at the origin. - - Projects image onto unit sphere with origin at (0, 0, 0) and radius scale, measured in pixels. - A 360 panorama would therefore have a resulting width of 2 * scale * PI pixels. - Poles are located at (0, -1, 0) and (0, 1, 0) points. -*/ -class CV_EXPORTS SphericalWarper : public RotationWarperBase -{ -public: - /** @brief Construct an instance of the spherical warper class. - - @param scale Radius of the projected sphere, in pixels. An image spanning the - whole sphere will have a width of 2 * scale * PI pixels. - */ - SphericalWarper(float scale) { projector_.scale = scale; } - - Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE; - Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst) CV_OVERRIDE; -protected: - void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE; -}; - - -struct CV_EXPORTS CylindricalProjector : ProjectorBase -{ - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -/** @brief Warper that maps an image onto the x\*x + z\*z = 1 cylinder. - */ -class CV_EXPORTS CylindricalWarper : public RotationWarperBase -{ -public: - /** @brief Construct an instance of the cylindrical warper class. - - @param scale Projected image scale multiplier - */ - CylindricalWarper(float scale) { projector_.scale = scale; } - - Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE; - Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst) CV_OVERRIDE; -protected: - void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE - { - RotationWarperBase::detectResultRoiByBorder(src_size, dst_tl, dst_br); - } -}; - - -struct CV_EXPORTS FisheyeProjector : ProjectorBase -{ - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -class CV_EXPORTS FisheyeWarper : public RotationWarperBase -{ -public: - FisheyeWarper(float scale) { projector_.scale = scale; } -}; - - -struct CV_EXPORTS StereographicProjector : ProjectorBase -{ - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -class CV_EXPORTS StereographicWarper : public RotationWarperBase -{ -public: - StereographicWarper(float scale) { projector_.scale = scale; } -}; - - -struct CV_EXPORTS CompressedRectilinearProjector : ProjectorBase -{ - float a, b; - - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -class CV_EXPORTS CompressedRectilinearWarper : public RotationWarperBase -{ -public: - CompressedRectilinearWarper(float scale, float A = 1, float B = 1) - { - projector_.a = A; - projector_.b = B; - projector_.scale = scale; - } -}; - - -struct CV_EXPORTS CompressedRectilinearPortraitProjector : ProjectorBase -{ - float a, b; - - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -class CV_EXPORTS CompressedRectilinearPortraitWarper : public RotationWarperBase -{ -public: - CompressedRectilinearPortraitWarper(float scale, float A = 1, float B = 1) - { - projector_.a = A; - projector_.b = B; - projector_.scale = scale; - } -}; - - -struct CV_EXPORTS PaniniProjector : ProjectorBase -{ - float a, b; - - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -class CV_EXPORTS PaniniWarper : public RotationWarperBase -{ -public: - PaniniWarper(float scale, float A = 1, float B = 1) - { - projector_.a = A; - projector_.b = B; - projector_.scale = scale; - } -}; - - -struct CV_EXPORTS PaniniPortraitProjector : ProjectorBase -{ - float a, b; - - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -class CV_EXPORTS PaniniPortraitWarper : public RotationWarperBase -{ -public: - PaniniPortraitWarper(float scale, float A = 1, float B = 1) - { - projector_.a = A; - projector_.b = B; - projector_.scale = scale; - } - -}; - - -struct CV_EXPORTS MercatorProjector : ProjectorBase -{ - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -class CV_EXPORTS MercatorWarper : public RotationWarperBase -{ -public: - MercatorWarper(float scale) { projector_.scale = scale; } -}; - - -struct CV_EXPORTS TransverseMercatorProjector : ProjectorBase -{ - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -class CV_EXPORTS TransverseMercatorWarper : public RotationWarperBase -{ -public: - TransverseMercatorWarper(float scale) { projector_.scale = scale; } -}; - - -class CV_EXPORTS PlaneWarperGpu : public PlaneWarper -{ -public: - PlaneWarperGpu(float scale = 1.f) : PlaneWarper(scale) {} - - Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE - { - Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_); - d_xmap_.download(xmap); - d_ymap_.download(ymap); - return result; - } - - Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap) CV_OVERRIDE - { - Rect result = buildMaps(src_size, K, R, T, d_xmap_, d_ymap_); - d_xmap_.download(xmap); - d_ymap_.download(ymap); - return result; - } - - Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, - OutputArray dst) CV_OVERRIDE - { - d_src_.upload(src); - Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_); - d_dst_.download(dst); - return result; - } - - Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode, - OutputArray dst) CV_OVERRIDE - { - d_src_.upload(src); - Point result = warp(d_src_, K, R, T, interp_mode, border_mode, d_dst_); - d_dst_.download(dst); - return result; - } - - Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap); - - Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, cuda::GpuMat & xmap, cuda::GpuMat & ymap); - - Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode, - cuda::GpuMat & dst); - - Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode, - cuda::GpuMat & dst); - -private: - cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_; -}; - - -class CV_EXPORTS SphericalWarperGpu : public SphericalWarper -{ -public: - SphericalWarperGpu(float scale) : SphericalWarper(scale) {} - - Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE - { - Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_); - d_xmap_.download(xmap); - d_ymap_.download(ymap); - return result; - } - - Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, - OutputArray dst) CV_OVERRIDE - { - d_src_.upload(src); - Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_); - d_dst_.download(dst); - return result; - } - - Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap); - - Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode, - cuda::GpuMat & dst); - -private: - cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_; -}; - - -class CV_EXPORTS CylindricalWarperGpu : public CylindricalWarper -{ -public: - CylindricalWarperGpu(float scale) : CylindricalWarper(scale) {} - - Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE - { - Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_); - d_xmap_.download(xmap); - d_ymap_.download(ymap); - return result; - } - - Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, - OutputArray dst) CV_OVERRIDE - { - d_src_.upload(src); - Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_); - d_dst_.download(dst); - return result; - } - - Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap); - - Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode, - cuda::GpuMat & dst); - -private: - cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_; -}; - - -struct CV_EXPORTS SphericalPortraitProjector : ProjectorBase -{ - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -// Projects image onto unit sphere with origin at (0, 0, 0). -// Poles are located NOT at (0, -1, 0) and (0, 1, 0) points, BUT at (1, 0, 0) and (-1, 0, 0) points. -class CV_EXPORTS SphericalPortraitWarper : public RotationWarperBase -{ -public: - SphericalPortraitWarper(float scale) { projector_.scale = scale; } - -protected: - void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE; -}; - -struct CV_EXPORTS CylindricalPortraitProjector : ProjectorBase -{ - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -class CV_EXPORTS CylindricalPortraitWarper : public RotationWarperBase -{ -public: - CylindricalPortraitWarper(float scale) { projector_.scale = scale; } - -protected: - void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE - { - RotationWarperBase::detectResultRoiByBorder(src_size, dst_tl, dst_br); - } -}; - -struct CV_EXPORTS PlanePortraitProjector : ProjectorBase -{ - void mapForward(float x, float y, float &u, float &v); - void mapBackward(float u, float v, float &x, float &y); -}; - - -class CV_EXPORTS PlanePortraitWarper : public RotationWarperBase -{ -public: - PlanePortraitWarper(float scale) { projector_.scale = scale; } - -protected: - void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) CV_OVERRIDE - { - RotationWarperBase::detectResultRoiByBorder(src_size, dst_tl, dst_br); - } -}; - -//! @} stitching_warp - -} // namespace detail -} // namespace cv - -#include "warpers_inl.hpp" - -#endif // OPENCV_STITCHING_WARPERS_HPP diff --git a/opencv/include/opencv2/stitching/detail/warpers_inl.hpp b/opencv/include/opencv2/stitching/detail/warpers_inl.hpp deleted file mode 100644 index f4a19d9..0000000 --- a/opencv/include/opencv2/stitching/detail/warpers_inl.hpp +++ /dev/null @@ -1,774 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_WARPERS_INL_HPP -#define OPENCV_STITCHING_WARPERS_INL_HPP - -#include "opencv2/core.hpp" -#include "warpers.hpp" // Make your IDE see declarations -#include - -//! @cond IGNORED - -namespace cv { -namespace detail { - -template -Point2f RotationWarperBase

::warpPoint(const Point2f &pt, InputArray K, InputArray R) -{ - projector_.setCameraParams(K, R); - Point2f uv; - projector_.mapForward(pt.x, pt.y, uv.x, uv.y); - return uv; -} - - -template -Rect RotationWarperBase

::buildMaps(Size src_size, InputArray K, InputArray R, OutputArray _xmap, OutputArray _ymap) -{ - projector_.setCameraParams(K, R); - - Point dst_tl, dst_br; - detectResultRoi(src_size, dst_tl, dst_br); - - _xmap.create(dst_br.y - dst_tl.y + 1, dst_br.x - dst_tl.x + 1, CV_32F); - _ymap.create(dst_br.y - dst_tl.y + 1, dst_br.x - dst_tl.x + 1, CV_32F); - - Mat xmap = _xmap.getMat(), ymap = _ymap.getMat(); - - float x, y; - for (int v = dst_tl.y; v <= dst_br.y; ++v) - { - for (int u = dst_tl.x; u <= dst_br.x; ++u) - { - projector_.mapBackward(static_cast(u), static_cast(v), x, y); - xmap.at(v - dst_tl.y, u - dst_tl.x) = x; - ymap.at(v - dst_tl.y, u - dst_tl.x) = y; - } - } - - return Rect(dst_tl, dst_br); -} - - -template -Point RotationWarperBase

::warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, - OutputArray dst) -{ - UMat xmap, ymap; - Rect dst_roi = buildMaps(src.size(), K, R, xmap, ymap); - - dst.create(dst_roi.height + 1, dst_roi.width + 1, src.type()); - remap(src, dst, xmap, ymap, interp_mode, border_mode); - - return dst_roi.tl(); -} - - -template -void RotationWarperBase

::warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, - Size dst_size, OutputArray dst) -{ - projector_.setCameraParams(K, R); - - Point src_tl, src_br; - detectResultRoi(dst_size, src_tl, src_br); - - Size size = src.size(); - CV_Assert(src_br.x - src_tl.x + 1 == size.width && src_br.y - src_tl.y + 1 == size.height); - - Mat xmap(dst_size, CV_32F); - Mat ymap(dst_size, CV_32F); - - float u, v; - for (int y = 0; y < dst_size.height; ++y) - { - for (int x = 0; x < dst_size.width; ++x) - { - projector_.mapForward(static_cast(x), static_cast(y), u, v); - xmap.at(y, x) = u - src_tl.x; - ymap.at(y, x) = v - src_tl.y; - } - } - - dst.create(dst_size, src.type()); - remap(src, dst, xmap, ymap, interp_mode, border_mode); -} - - -template -Rect RotationWarperBase

::warpRoi(Size src_size, InputArray K, InputArray R) -{ - projector_.setCameraParams(K, R); - - Point dst_tl, dst_br; - detectResultRoi(src_size, dst_tl, dst_br); - - return Rect(dst_tl, Point(dst_br.x + 1, dst_br.y + 1)); -} - - -template -void RotationWarperBase

::detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br) -{ - float tl_uf = (std::numeric_limits::max)(); - float tl_vf = (std::numeric_limits::max)(); - float br_uf = -(std::numeric_limits::max)(); - float br_vf = -(std::numeric_limits::max)(); - - float u, v; - for (int y = 0; y < src_size.height; ++y) - { - for (int x = 0; x < src_size.width; ++x) - { - projector_.mapForward(static_cast(x), static_cast(y), u, v); - tl_uf = (std::min)(tl_uf, u); tl_vf = (std::min)(tl_vf, v); - br_uf = (std::max)(br_uf, u); br_vf = (std::max)(br_vf, v); - } - } - - dst_tl.x = static_cast(tl_uf); - dst_tl.y = static_cast(tl_vf); - dst_br.x = static_cast(br_uf); - dst_br.y = static_cast(br_vf); -} - - -template -void RotationWarperBase

::detectResultRoiByBorder(Size src_size, Point &dst_tl, Point &dst_br) -{ - float tl_uf = (std::numeric_limits::max)(); - float tl_vf = (std::numeric_limits::max)(); - float br_uf = -(std::numeric_limits::max)(); - float br_vf = -(std::numeric_limits::max)(); - - float u, v; - for (float x = 0; x < src_size.width; ++x) - { - projector_.mapForward(static_cast(x), 0, u, v); - tl_uf = (std::min)(tl_uf, u); tl_vf = (std::min)(tl_vf, v); - br_uf = (std::max)(br_uf, u); br_vf = (std::max)(br_vf, v); - - projector_.mapForward(static_cast(x), static_cast(src_size.height - 1), u, v); - tl_uf = (std::min)(tl_uf, u); tl_vf = (std::min)(tl_vf, v); - br_uf = (std::max)(br_uf, u); br_vf = (std::max)(br_vf, v); - } - for (int y = 0; y < src_size.height; ++y) - { - projector_.mapForward(0, static_cast(y), u, v); - tl_uf = (std::min)(tl_uf, u); tl_vf = (std::min)(tl_vf, v); - br_uf = (std::max)(br_uf, u); br_vf = (std::max)(br_vf, v); - - projector_.mapForward(static_cast(src_size.width - 1), static_cast(y), u, v); - tl_uf = (std::min)(tl_uf, u); tl_vf = (std::min)(tl_vf, v); - br_uf = (std::max)(br_uf, u); br_vf = (std::max)(br_vf, v); - } - - dst_tl.x = static_cast(tl_uf); - dst_tl.y = static_cast(tl_vf); - dst_br.x = static_cast(br_uf); - dst_br.y = static_cast(br_vf); -} - - -inline -void PlaneProjector::mapForward(float x, float y, float &u, float &v) -{ - float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - x_ = t[0] + x_ / z_ * (1 - t[2]); - y_ = t[1] + y_ / z_ * (1 - t[2]); - - u = scale * x_; - v = scale * y_; -} - - -inline -void PlaneProjector::mapBackward(float u, float v, float &x, float &y) -{ - u = u / scale - t[0]; - v = v / scale - t[1]; - - float z; - x = k_rinv[0] * u + k_rinv[1] * v + k_rinv[2] * (1 - t[2]); - y = k_rinv[3] * u + k_rinv[4] * v + k_rinv[5] * (1 - t[2]); - z = k_rinv[6] * u + k_rinv[7] * v + k_rinv[8] * (1 - t[2]); - - x /= z; - y /= z; -} - - -inline -void SphericalProjector::mapForward(float x, float y, float &u, float &v) -{ - float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - u = scale * atan2f(x_, z_); - float w = y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_); - v = scale * (static_cast(CV_PI) - acosf(w == w ? w : 0)); -} - - -inline -void SphericalProjector::mapBackward(float u, float v, float &x, float &y) -{ - u /= scale; - v /= scale; - - float sinv = sinf(static_cast(CV_PI) - v); - float x_ = sinv * sinf(u); - float y_ = cosf(static_cast(CV_PI) - v); - float z_ = sinv * cosf(u); - - float z; - x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_; - y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_; - z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_; - - if (z > 0) { x /= z; y /= z; } - else x = y = -1; -} - - -inline -void CylindricalProjector::mapForward(float x, float y, float &u, float &v) -{ - float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - u = scale * atan2f(x_, z_); - v = scale * y_ / sqrtf(x_ * x_ + z_ * z_); -} - - -inline -void CylindricalProjector::mapBackward(float u, float v, float &x, float &y) -{ - u /= scale; - v /= scale; - - float x_ = sinf(u); - float y_ = v; - float z_ = cosf(u); - - float z; - x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_; - y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_; - z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_; - - if (z > 0) { x /= z; y /= z; } - else x = y = -1; -} - -inline -void FisheyeProjector::mapForward(float x, float y, float &u, float &v) -{ - float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - float u_ = atan2f(x_, z_); - float v_ = (float)CV_PI - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_)); - - u = scale * v_ * cosf(u_); - v = scale * v_ * sinf(u_); -} - -inline -void FisheyeProjector::mapBackward(float u, float v, float &x, float &y) -{ - u /= scale; - v /= scale; - - float u_ = atan2f(v, u); - float v_ = sqrtf(u*u + v*v); - - float sinv = sinf((float)CV_PI - v_); - float x_ = sinv * sinf(u_); - float y_ = cosf((float)CV_PI - v_); - float z_ = sinv * cosf(u_); - - float z; - x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_; - y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_; - z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_; - - if (z > 0) { x /= z; y /= z; } - else x = y = -1; -} - -inline -void StereographicProjector::mapForward(float x, float y, float &u, float &v) -{ - float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - float u_ = atan2f(x_, z_); - float v_ = (float)CV_PI - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_)); - - float r = sinf(v_) / (1 - cosf(v_)); - - u = scale * r * cos(u_); - v = scale * r * sin(u_); -} - -inline -void StereographicProjector::mapBackward(float u, float v, float &x, float &y) -{ - u /= scale; - v /= scale; - - float u_ = atan2f(v, u); - float r = sqrtf(u*u + v*v); - float v_ = 2 * atanf(1.f / r); - - float sinv = sinf((float)CV_PI - v_); - float x_ = sinv * sinf(u_); - float y_ = cosf((float)CV_PI - v_); - float z_ = sinv * cosf(u_); - - float z; - x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_; - y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_; - z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_; - - if (z > 0) { x /= z; y /= z; } - else x = y = -1; -} - -inline -void CompressedRectilinearProjector::mapForward(float x, float y, float &u, float &v) -{ - float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - float u_ = atan2f(x_, z_); - float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_)); - - u = scale * a * tanf(u_ / a); - v = scale * b * tanf(v_) / cosf(u_); -} - -inline -void CompressedRectilinearProjector::mapBackward(float u, float v, float &x, float &y) -{ - u /= scale; - v /= scale; - - float aatg = a * atanf(u / a); - float u_ = aatg; - float v_ = atanf(v * cosf(aatg) / b); - - float cosv = cosf(v_); - float x_ = cosv * sinf(u_); - float y_ = sinf(v_); - float z_ = cosv * cosf(u_); - - float z; - x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_; - y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_; - z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_; - - if (z > 0) { x /= z; y /= z; } - else x = y = -1; -} - -inline -void CompressedRectilinearPortraitProjector::mapForward(float x, float y, float &u, float &v) -{ - float y_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float x_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - float u_ = atan2f(x_, z_); - float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_)); - - u = - scale * a * tanf(u_ / a); - v = scale * b * tanf(v_) / cosf(u_); -} - -inline -void CompressedRectilinearPortraitProjector::mapBackward(float u, float v, float &x, float &y) -{ - u /= - scale; - v /= scale; - - float aatg = a * atanf(u / a); - float u_ = aatg; - float v_ = atanf(v * cosf( aatg ) / b); - - float cosv = cosf(v_); - float y_ = cosv * sinf(u_); - float x_ = sinf(v_); - float z_ = cosv * cosf(u_); - - float z; - x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_; - y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_; - z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_; - - if (z > 0) { x /= z; y /= z; } - else x = y = -1; -} - -inline -void PaniniProjector::mapForward(float x, float y, float &u, float &v) -{ - float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - float u_ = atan2f(x_, z_); - float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_)); - - float tg = a * tanf(u_ / a); - u = scale * tg; - - float sinu = sinf(u_); - if ( fabs(sinu) < 1E-7 ) - v = scale * b * tanf(v_); - else - v = scale * b * tg * tanf(v_) / sinu; -} - -inline -void PaniniProjector::mapBackward(float u, float v, float &x, float &y) -{ - u /= scale; - v /= scale; - - float lamda = a * atanf(u / a); - float u_ = lamda; - - float v_; - if ( fabs(lamda) > 1E-7) - v_ = atanf(v * sinf(lamda) / (b * a * tanf(lamda / a))); - else - v_ = atanf(v / b); - - float cosv = cosf(v_); - float x_ = cosv * sinf(u_); - float y_ = sinf(v_); - float z_ = cosv * cosf(u_); - - float z; - x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_; - y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_; - z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_; - - if (z > 0) { x /= z; y /= z; } - else x = y = -1; -} - -inline -void PaniniPortraitProjector::mapForward(float x, float y, float &u, float &v) -{ - float y_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float x_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - float u_ = atan2f(x_, z_); - float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_)); - - float tg = a * tanf(u_ / a); - u = - scale * tg; - - float sinu = sinf( u_ ); - if ( fabs(sinu) < 1E-7 ) - v = scale * b * tanf(v_); - else - v = scale * b * tg * tanf(v_) / sinu; -} - -inline -void PaniniPortraitProjector::mapBackward(float u, float v, float &x, float &y) -{ - u /= - scale; - v /= scale; - - float lamda = a * atanf(u / a); - float u_ = lamda; - - float v_; - if ( fabs(lamda) > 1E-7) - v_ = atanf(v * sinf(lamda) / (b * a * tanf(lamda/a))); - else - v_ = atanf(v / b); - - float cosv = cosf(v_); - float y_ = cosv * sinf(u_); - float x_ = sinf(v_); - float z_ = cosv * cosf(u_); - - float z; - x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_; - y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_; - z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_; - - if (z > 0) { x /= z; y /= z; } - else x = y = -1; -} - -inline -void MercatorProjector::mapForward(float x, float y, float &u, float &v) -{ - float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - float u_ = atan2f(x_, z_); - float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_)); - - u = scale * u_; - v = scale * logf( tanf( (float)(CV_PI/4) + v_/2 ) ); -} - -inline -void MercatorProjector::mapBackward(float u, float v, float &x, float &y) -{ - u /= scale; - v /= scale; - - float v_ = atanf( sinhf(v) ); - float u_ = u; - - float cosv = cosf(v_); - float x_ = cosv * sinf(u_); - float y_ = sinf(v_); - float z_ = cosv * cosf(u_); - - float z; - x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_; - y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_; - z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_; - - if (z > 0) { x /= z; y /= z; } - else x = y = -1; -} - -inline -void TransverseMercatorProjector::mapForward(float x, float y, float &u, float &v) -{ - float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - float u_ = atan2f(x_, z_); - float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_)); - - float B = cosf(v_) * sinf(u_); - - u = scale / 2 * logf( (1+B) / (1-B) ); - v = scale * atan2f(tanf(v_), cosf(u_)); -} - -inline -void TransverseMercatorProjector::mapBackward(float u, float v, float &x, float &y) -{ - u /= scale; - v /= scale; - - float v_ = asinf( sinf(v) / coshf(u) ); - float u_ = atan2f( sinhf(u), cos(v) ); - - float cosv = cosf(v_); - float x_ = cosv * sinf(u_); - float y_ = sinf(v_); - float z_ = cosv * cosf(u_); - - float z; - x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_; - y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_; - z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_; - - if (z > 0) { x /= z; y /= z; } - else x = y = -1; -} - -inline -void SphericalPortraitProjector::mapForward(float x, float y, float &u0, float &v0) -{ - float x0_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float y0_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - float x_ = y0_; - float y_ = x0_; - float u, v; - - u = scale * atan2f(x_, z_); - v = scale * (static_cast(CV_PI) - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_))); - - u0 = -u;//v; - v0 = v;//u; -} - - -inline -void SphericalPortraitProjector::mapBackward(float u0, float v0, float &x, float &y) -{ - float u, v; - u = -u0;//v0; - v = v0;//u0; - - u /= scale; - v /= scale; - - float sinv = sinf(static_cast(CV_PI) - v); - float x0_ = sinv * sinf(u); - float y0_ = cosf(static_cast(CV_PI) - v); - float z_ = sinv * cosf(u); - - float x_ = y0_; - float y_ = x0_; - - float z; - x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_; - y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_; - z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_; - - if (z > 0) { x /= z; y /= z; } - else x = y = -1; -} - -inline -void CylindricalPortraitProjector::mapForward(float x, float y, float &u0, float &v0) -{ - float x0_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float y0_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - float x_ = y0_; - float y_ = x0_; - float u, v; - - u = scale * atan2f(x_, z_); - v = scale * y_ / sqrtf(x_ * x_ + z_ * z_); - - u0 = -u;//v; - v0 = v;//u; -} - - -inline -void CylindricalPortraitProjector::mapBackward(float u0, float v0, float &x, float &y) -{ - float u, v; - u = -u0;//v0; - v = v0;//u0; - - u /= scale; - v /= scale; - - float x0_ = sinf(u); - float y0_ = v; - float z_ = cosf(u); - - float x_ = y0_; - float y_ = x0_; - - float z; - x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_; - y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_; - z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_; - - if (z > 0) { x /= z; y /= z; } - else x = y = -1; -} - -inline -void PlanePortraitProjector::mapForward(float x, float y, float &u0, float &v0) -{ - float x0_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2]; - float y0_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5]; - float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8]; - - float x_ = y0_; - float y_ = x0_; - - x_ = t[0] + x_ / z_ * (1 - t[2]); - y_ = t[1] + y_ / z_ * (1 - t[2]); - - float u,v; - u = scale * x_; - v = scale * y_; - - u0 = -u; - v0 = v; -} - - -inline -void PlanePortraitProjector::mapBackward(float u0, float v0, float &x, float &y) -{ - float u, v; - u = -u0; - v = v0; - - u = u / scale - t[0]; - v = v / scale - t[1]; - - float z; - x = k_rinv[0] * v + k_rinv[1] * u + k_rinv[2] * (1 - t[2]); - y = k_rinv[3] * v + k_rinv[4] * u + k_rinv[5] * (1 - t[2]); - z = k_rinv[6] * v + k_rinv[7] * u + k_rinv[8] * (1 - t[2]); - - x /= z; - y /= z; -} - - -} // namespace detail -} // namespace cv - -//! @endcond - -#endif // OPENCV_STITCHING_WARPERS_INL_HPP diff --git a/opencv/include/opencv2/stitching/warpers.hpp b/opencv/include/opencv2/stitching/warpers.hpp deleted file mode 100644 index cf7699c..0000000 --- a/opencv/include/opencv2/stitching/warpers.hpp +++ /dev/null @@ -1,192 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_STITCHING_WARPER_CREATORS_HPP -#define OPENCV_STITCHING_WARPER_CREATORS_HPP - -#include "opencv2/stitching/detail/warpers.hpp" - -namespace cv { - -//! @addtogroup stitching_warp -//! @{ - -/** @brief Image warper factories base class. - */ -class WarperCreator -{ -public: - virtual ~WarperCreator() {} - virtual Ptr create(float scale) const = 0; -}; - -/** @brief Plane warper factory class. - @sa detail::PlaneWarper - */ -class PlaneWarper : public WarperCreator -{ -public: - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale); } -}; - -/** @brief Affine warper factory class. - @sa detail::AffineWarper - */ -class AffineWarper : public WarperCreator -{ -public: - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale); } -}; - -/** @brief Cylindrical warper factory class. -@sa detail::CylindricalWarper -*/ -class CylindricalWarper: public WarperCreator -{ -public: - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale); } -}; - -/** @brief Spherical warper factory class */ -class SphericalWarper: public WarperCreator -{ -public: - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale); } -}; - -class FisheyeWarper : public WarperCreator -{ -public: - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale); } -}; - -class StereographicWarper: public WarperCreator -{ -public: - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale); } -}; - -class CompressedRectilinearWarper: public WarperCreator -{ - float a, b; -public: - CompressedRectilinearWarper(float A = 1, float B = 1) - { - a = A; b = B; - } - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale, a, b); } -}; - -class CompressedRectilinearPortraitWarper: public WarperCreator -{ - float a, b; -public: - CompressedRectilinearPortraitWarper(float A = 1, float B = 1) - { - a = A; b = B; - } - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale, a, b); } -}; - -class PaniniWarper: public WarperCreator -{ - float a, b; -public: - PaniniWarper(float A = 1, float B = 1) - { - a = A; b = B; - } - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale, a, b); } -}; - -class PaniniPortraitWarper: public WarperCreator -{ - float a, b; -public: - PaniniPortraitWarper(float A = 1, float B = 1) - { - a = A; b = B; - } - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale, a, b); } -}; - -class MercatorWarper: public WarperCreator -{ -public: - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale); } -}; - -class TransverseMercatorWarper: public WarperCreator -{ -public: - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale); } -}; - - - -#ifdef HAVE_OPENCV_CUDAWARPING -class PlaneWarperGpu: public WarperCreator -{ -public: - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale); } -}; - - -class CylindricalWarperGpu: public WarperCreator -{ -public: - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale); } -}; - - -class SphericalWarperGpu: public WarperCreator -{ -public: - Ptr create(float scale) const CV_OVERRIDE { return makePtr(scale); } -}; -#endif - -//! @} stitching_warp - -} // namespace cv - -#endif // OPENCV_STITCHING_WARPER_CREATORS_HPP diff --git a/opencv/include/opencv2/superres.hpp b/opencv/include/opencv2/superres.hpp deleted file mode 100644 index 16c11ac..0000000 --- a/opencv/include/opencv2/superres.hpp +++ /dev/null @@ -1,207 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_SUPERRES_HPP -#define OPENCV_SUPERRES_HPP - -#include "opencv2/core.hpp" -#include "opencv2/superres/optical_flow.hpp" - -/** - @defgroup superres Super Resolution - -The Super Resolution module contains a set of functions and classes that can be used to solve the -problem of resolution enhancement. There are a few methods implemented, most of them are described in -the papers @cite Farsiu03 and @cite Mitzel09 . - - */ - -namespace cv -{ - namespace superres - { - -//! @addtogroup superres -//! @{ - - class CV_EXPORTS FrameSource - { - public: - virtual ~FrameSource(); - - virtual void nextFrame(OutputArray frame) = 0; - virtual void reset() = 0; - }; - - CV_EXPORTS Ptr createFrameSource_Empty(); - - CV_EXPORTS Ptr createFrameSource_Video(const String& fileName); - CV_EXPORTS Ptr createFrameSource_Video_CUDA(const String& fileName); - - CV_EXPORTS Ptr createFrameSource_Camera(int deviceId = 0); - - /** @brief Base class for Super Resolution algorithms. - - The class is only used to define the common interface for the whole family of Super Resolution - algorithms. - */ - class CV_EXPORTS SuperResolution : public cv::Algorithm, public FrameSource - { - public: - /** @brief Set input frame source for Super Resolution algorithm. - - @param frameSource Input frame source - */ - void setInput(const Ptr& frameSource); - - /** @brief Process next frame from input and return output result. - - @param frame Output result - */ - void nextFrame(OutputArray frame) CV_OVERRIDE; - void reset() CV_OVERRIDE; - - /** @brief Clear all inner buffers. - */ - virtual void collectGarbage(); - - //! @brief Scale factor - /** @see setScale */ - virtual int getScale() const = 0; - /** @copybrief getScale @see getScale */ - virtual void setScale(int val) = 0; - - //! @brief Iterations count - /** @see setIterations */ - virtual int getIterations() const = 0; - /** @copybrief getIterations @see getIterations */ - virtual void setIterations(int val) = 0; - - //! @brief Asymptotic value of steepest descent method - /** @see setTau */ - virtual double getTau() const = 0; - /** @copybrief getTau @see getTau */ - virtual void setTau(double val) = 0; - - //! @brief Weight parameter to balance data term and smoothness term - /** @see setLabmda */ - virtual double getLabmda() const = 0; - /** @copybrief getLabmda @see getLabmda */ - virtual void setLabmda(double val) = 0; - - //! @brief Parameter of spacial distribution in Bilateral-TV - /** @see setAlpha */ - virtual double getAlpha() const = 0; - /** @copybrief getAlpha @see getAlpha */ - virtual void setAlpha(double val) = 0; - - //! @brief Kernel size of Bilateral-TV filter - /** @see setKernelSize */ - virtual int getKernelSize() const = 0; - /** @copybrief getKernelSize @see getKernelSize */ - virtual void setKernelSize(int val) = 0; - - //! @brief Gaussian blur kernel size - /** @see setBlurKernelSize */ - virtual int getBlurKernelSize() const = 0; - /** @copybrief getBlurKernelSize @see getBlurKernelSize */ - virtual void setBlurKernelSize(int val) = 0; - - //! @brief Gaussian blur sigma - /** @see setBlurSigma */ - virtual double getBlurSigma() const = 0; - /** @copybrief getBlurSigma @see getBlurSigma */ - virtual void setBlurSigma(double val) = 0; - - //! @brief Radius of the temporal search area - /** @see setTemporalAreaRadius */ - virtual int getTemporalAreaRadius() const = 0; - /** @copybrief getTemporalAreaRadius @see getTemporalAreaRadius */ - virtual void setTemporalAreaRadius(int val) = 0; - - //! @brief Dense optical flow algorithm - /** @see setOpticalFlow */ - virtual Ptr getOpticalFlow() const = 0; - /** @copybrief getOpticalFlow @see getOpticalFlow */ - virtual void setOpticalFlow(const Ptr &val) = 0; - - protected: - SuperResolution(); - - virtual void initImpl(Ptr& frameSource) = 0; - virtual void processImpl(Ptr& frameSource, OutputArray output) = 0; - - bool isUmat_; - - private: - Ptr frameSource_; - bool firstCall_; - }; - - /** @brief Create Bilateral TV-L1 Super Resolution. - - This class implements Super Resolution algorithm described in the papers @cite Farsiu03 and - @cite Mitzel09 . - - Here are important members of the class that control the algorithm, which you can set after - constructing the class instance: - - - **int scale** Scale factor. - - **int iterations** Iteration count. - - **double tau** Asymptotic value of steepest descent method. - - **double lambda** Weight parameter to balance data term and smoothness term. - - **double alpha** Parameter of spacial distribution in Bilateral-TV. - - **int btvKernelSize** Kernel size of Bilateral-TV filter. - - **int blurKernelSize** Gaussian blur kernel size. - - **double blurSigma** Gaussian blur sigma. - - **int temporalAreaRadius** Radius of the temporal search area. - - **Ptr\ opticalFlow** Dense optical flow algorithm. - */ - CV_EXPORTS Ptr createSuperResolution_BTVL1(); - CV_EXPORTS Ptr createSuperResolution_BTVL1_CUDA(); - -//! @} superres - - } -} - -#endif // OPENCV_SUPERRES_HPP diff --git a/opencv/include/opencv2/superres/optical_flow.hpp b/opencv/include/opencv2/superres/optical_flow.hpp deleted file mode 100644 index 07e7ca9..0000000 --- a/opencv/include/opencv2/superres/optical_flow.hpp +++ /dev/null @@ -1,203 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_SUPERRES_OPTICAL_FLOW_HPP -#define OPENCV_SUPERRES_OPTICAL_FLOW_HPP - -#include "opencv2/core.hpp" - -namespace cv -{ - namespace superres - { - -//! @addtogroup superres -//! @{ - - class CV_EXPORTS DenseOpticalFlowExt : public cv::Algorithm - { - public: - virtual void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2 = noArray()) = 0; - virtual void collectGarbage() = 0; - }; - - - class CV_EXPORTS FarnebackOpticalFlow : public virtual DenseOpticalFlowExt - { - public: - /** @see setPyrScale */ - virtual double getPyrScale() const = 0; - /** @copybrief getPyrScale @see getPyrScale */ - virtual void setPyrScale(double val) = 0; - /** @see setLevelsNumber */ - virtual int getLevelsNumber() const = 0; - /** @copybrief getLevelsNumber @see getLevelsNumber */ - virtual void setLevelsNumber(int val) = 0; - /** @see setWindowSize */ - virtual int getWindowSize() const = 0; - /** @copybrief getWindowSize @see getWindowSize */ - virtual void setWindowSize(int val) = 0; - /** @see setIterations */ - virtual int getIterations() const = 0; - /** @copybrief getIterations @see getIterations */ - virtual void setIterations(int val) = 0; - /** @see setPolyN */ - virtual int getPolyN() const = 0; - /** @copybrief getPolyN @see getPolyN */ - virtual void setPolyN(int val) = 0; - /** @see setPolySigma */ - virtual double getPolySigma() const = 0; - /** @copybrief getPolySigma @see getPolySigma */ - virtual void setPolySigma(double val) = 0; - /** @see setFlags */ - virtual int getFlags() const = 0; - /** @copybrief getFlags @see getFlags */ - virtual void setFlags(int val) = 0; - }; - CV_EXPORTS Ptr createOptFlow_Farneback(); - CV_EXPORTS Ptr createOptFlow_Farneback_CUDA(); - - -// CV_EXPORTS Ptr createOptFlow_Simple(); - - - class CV_EXPORTS DualTVL1OpticalFlow : public virtual DenseOpticalFlowExt - { - public: - /** @see setTau */ - virtual double getTau() const = 0; - /** @copybrief getTau @see getTau */ - virtual void setTau(double val) = 0; - /** @see setLambda */ - virtual double getLambda() const = 0; - /** @copybrief getLambda @see getLambda */ - virtual void setLambda(double val) = 0; - /** @see setTheta */ - virtual double getTheta() const = 0; - /** @copybrief getTheta @see getTheta */ - virtual void setTheta(double val) = 0; - /** @see setScalesNumber */ - virtual int getScalesNumber() const = 0; - /** @copybrief getScalesNumber @see getScalesNumber */ - virtual void setScalesNumber(int val) = 0; - /** @see setWarpingsNumber */ - virtual int getWarpingsNumber() const = 0; - /** @copybrief getWarpingsNumber @see getWarpingsNumber */ - virtual void setWarpingsNumber(int val) = 0; - /** @see setEpsilon */ - virtual double getEpsilon() const = 0; - /** @copybrief getEpsilon @see getEpsilon */ - virtual void setEpsilon(double val) = 0; - /** @see setIterations */ - virtual int getIterations() const = 0; - /** @copybrief getIterations @see getIterations */ - virtual void setIterations(int val) = 0; - /** @see setUseInitialFlow */ - virtual bool getUseInitialFlow() const = 0; - /** @copybrief getUseInitialFlow @see getUseInitialFlow */ - virtual void setUseInitialFlow(bool val) = 0; - }; - CV_EXPORTS Ptr createOptFlow_DualTVL1(); - CV_EXPORTS Ptr createOptFlow_DualTVL1_CUDA(); - - - class CV_EXPORTS BroxOpticalFlow : public virtual DenseOpticalFlowExt - { - public: - //! @brief Flow smoothness - /** @see setAlpha */ - virtual double getAlpha() const = 0; - /** @copybrief getAlpha @see getAlpha */ - virtual void setAlpha(double val) = 0; - //! @brief Gradient constancy importance - /** @see setGamma */ - virtual double getGamma() const = 0; - /** @copybrief getGamma @see getGamma */ - virtual void setGamma(double val) = 0; - //! @brief Pyramid scale factor - /** @see setScaleFactor */ - virtual double getScaleFactor() const = 0; - /** @copybrief getScaleFactor @see getScaleFactor */ - virtual void setScaleFactor(double val) = 0; - //! @brief Number of lagged non-linearity iterations (inner loop) - /** @see setInnerIterations */ - virtual int getInnerIterations() const = 0; - /** @copybrief getInnerIterations @see getInnerIterations */ - virtual void setInnerIterations(int val) = 0; - //! @brief Number of warping iterations (number of pyramid levels) - /** @see setOuterIterations */ - virtual int getOuterIterations() const = 0; - /** @copybrief getOuterIterations @see getOuterIterations */ - virtual void setOuterIterations(int val) = 0; - //! @brief Number of linear system solver iterations - /** @see setSolverIterations */ - virtual int getSolverIterations() const = 0; - /** @copybrief getSolverIterations @see getSolverIterations */ - virtual void setSolverIterations(int val) = 0; - }; - CV_EXPORTS Ptr createOptFlow_Brox_CUDA(); - - - class PyrLKOpticalFlow : public virtual DenseOpticalFlowExt - { - public: - /** @see setWindowSize */ - virtual int getWindowSize() const = 0; - /** @copybrief getWindowSize @see getWindowSize */ - virtual void setWindowSize(int val) = 0; - /** @see setMaxLevel */ - virtual int getMaxLevel() const = 0; - /** @copybrief getMaxLevel @see getMaxLevel */ - virtual void setMaxLevel(int val) = 0; - /** @see setIterations */ - virtual int getIterations() const = 0; - /** @copybrief getIterations @see getIterations */ - virtual void setIterations(int val) = 0; - }; - CV_EXPORTS Ptr createOptFlow_PyrLK_CUDA(); - -//! @} - - } -} - -#endif // OPENCV_SUPERRES_OPTICAL_FLOW_HPP diff --git a/opencv/include/opencv2/video.hpp b/opencv/include/opencv2/video.hpp deleted file mode 100644 index aa644a9..0000000 --- a/opencv/include/opencv2/video.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEO_HPP -#define OPENCV_VIDEO_HPP - -/** - @defgroup video Video Analysis - @{ - @defgroup video_motion Motion Analysis - @defgroup video_track Object Tracking - @defgroup video_c C API - @} -*/ - -#include "opencv2/video/tracking.hpp" -#include "opencv2/video/background_segm.hpp" - -#ifndef DISABLE_OPENCV_24_COMPATIBILITY -#include "opencv2/video/tracking_c.h" -#endif - -#endif //OPENCV_VIDEO_HPP diff --git a/opencv/include/opencv2/video/background_segm.hpp b/opencv/include/opencv2/video/background_segm.hpp deleted file mode 100644 index e1dfa15..0000000 --- a/opencv/include/opencv2/video/background_segm.hpp +++ /dev/null @@ -1,317 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_BACKGROUND_SEGM_HPP -#define OPENCV_BACKGROUND_SEGM_HPP - -#include "opencv2/core.hpp" - -namespace cv -{ - -//! @addtogroup video_motion -//! @{ - -/** @brief Base class for background/foreground segmentation. : - -The class is only used to define the common interface for the whole family of background/foreground -segmentation algorithms. - */ -class CV_EXPORTS_W BackgroundSubtractor : public Algorithm -{ -public: - /** @brief Computes a foreground mask. - - @param image Next video frame. - @param fgmask The output foreground mask as an 8-bit binary image. - @param learningRate The value between 0 and 1 that indicates how fast the background model is - learnt. Negative parameter value makes the algorithm to use some automatically chosen learning - rate. 0 means that the background model is not updated at all, 1 means that the background model - is completely reinitialized from the last frame. - */ - CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) = 0; - - /** @brief Computes a background image. - - @param backgroundImage The output background image. - - @note Sometimes the background image can be very blurry, as it contain the average background - statistics. - */ - CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const = 0; -}; - - -/** @brief Gaussian Mixture-based Background/Foreground Segmentation Algorithm. - -The class implements the Gaussian mixture model background subtraction described in @cite Zivkovic2004 -and @cite Zivkovic2006 . - */ -class CV_EXPORTS_W BackgroundSubtractorMOG2 : public BackgroundSubtractor -{ -public: - /** @brief Returns the number of last frames that affect the background model - */ - CV_WRAP virtual int getHistory() const = 0; - /** @brief Sets the number of last frames that affect the background model - */ - CV_WRAP virtual void setHistory(int history) = 0; - - /** @brief Returns the number of gaussian components in the background model - */ - CV_WRAP virtual int getNMixtures() const = 0; - /** @brief Sets the number of gaussian components in the background model. - - The model needs to be reinitalized to reserve memory. - */ - CV_WRAP virtual void setNMixtures(int nmixtures) = 0;//needs reinitialization! - - /** @brief Returns the "background ratio" parameter of the algorithm - - If a foreground pixel keeps semi-constant value for about backgroundRatio\*history frames, it's - considered background and added to the model as a center of a new component. It corresponds to TB - parameter in the paper. - */ - CV_WRAP virtual double getBackgroundRatio() const = 0; - /** @brief Sets the "background ratio" parameter of the algorithm - */ - CV_WRAP virtual void setBackgroundRatio(double ratio) = 0; - - /** @brief Returns the variance threshold for the pixel-model match - - The main threshold on the squared Mahalanobis distance to decide if the sample is well described by - the background model or not. Related to Cthr from the paper. - */ - CV_WRAP virtual double getVarThreshold() const = 0; - /** @brief Sets the variance threshold for the pixel-model match - */ - CV_WRAP virtual void setVarThreshold(double varThreshold) = 0; - - /** @brief Returns the variance threshold for the pixel-model match used for new mixture component generation - - Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the - existing components (corresponds to Tg in the paper). If a pixel is not close to any component, it - is considered foreground or added as a new component. 3 sigma =\> Tg=3\*3=9 is default. A smaller Tg - value generates more components. A higher Tg value may result in a small number of components but - they can grow too large. - */ - CV_WRAP virtual double getVarThresholdGen() const = 0; - /** @brief Sets the variance threshold for the pixel-model match used for new mixture component generation - */ - CV_WRAP virtual void setVarThresholdGen(double varThresholdGen) = 0; - - /** @brief Returns the initial variance of each gaussian component - */ - CV_WRAP virtual double getVarInit() const = 0; - /** @brief Sets the initial variance of each gaussian component - */ - CV_WRAP virtual void setVarInit(double varInit) = 0; - - CV_WRAP virtual double getVarMin() const = 0; - CV_WRAP virtual void setVarMin(double varMin) = 0; - - CV_WRAP virtual double getVarMax() const = 0; - CV_WRAP virtual void setVarMax(double varMax) = 0; - - /** @brief Returns the complexity reduction threshold - - This parameter defines the number of samples needed to accept to prove the component exists. CT=0.05 - is a default value for all the samples. By setting CT=0 you get an algorithm very similar to the - standard Stauffer&Grimson algorithm. - */ - CV_WRAP virtual double getComplexityReductionThreshold() const = 0; - /** @brief Sets the complexity reduction threshold - */ - CV_WRAP virtual void setComplexityReductionThreshold(double ct) = 0; - - /** @brief Returns the shadow detection flag - - If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorMOG2 for - details. - */ - CV_WRAP virtual bool getDetectShadows() const = 0; - /** @brief Enables or disables shadow detection - */ - CV_WRAP virtual void setDetectShadows(bool detectShadows) = 0; - - /** @brief Returns the shadow value - - Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0 - in the mask always means background, 255 means foreground. - */ - CV_WRAP virtual int getShadowValue() const = 0; - /** @brief Sets the shadow value - */ - CV_WRAP virtual void setShadowValue(int value) = 0; - - /** @brief Returns the shadow threshold - - A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in - the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel - is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara, - *Detecting Moving Shadows...*, IEEE PAMI,2003. - */ - CV_WRAP virtual double getShadowThreshold() const = 0; - /** @brief Sets the shadow threshold - */ - CV_WRAP virtual void setShadowThreshold(double threshold) = 0; - - /** @brief Computes a foreground mask. - - @param image Next video frame. Floating point frame will be used without scaling and should be in range \f$[0,255]\f$. - @param fgmask The output foreground mask as an 8-bit binary image. - @param learningRate The value between 0 and 1 that indicates how fast the background model is - learnt. Negative parameter value makes the algorithm to use some automatically chosen learning - rate. 0 means that the background model is not updated at all, 1 means that the background model - is completely reinitialized from the last frame. - */ - CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE = 0; -}; - -/** @brief Creates MOG2 Background Subtractor - -@param history Length of the history. -@param varThreshold Threshold on the squared Mahalanobis distance between the pixel and the model -to decide whether a pixel is well described by the background model. This parameter does not -affect the background update. -@param detectShadows If true, the algorithm will detect shadows and mark them. It decreases the -speed a bit, so if you do not need this feature, set the parameter to false. - */ -CV_EXPORTS_W Ptr - createBackgroundSubtractorMOG2(int history=500, double varThreshold=16, - bool detectShadows=true); - -/** @brief K-nearest neighbours - based Background/Foreground Segmentation Algorithm. - -The class implements the K-nearest neighbours background subtraction described in @cite Zivkovic2006 . -Very efficient if number of foreground pixels is low. - */ -class CV_EXPORTS_W BackgroundSubtractorKNN : public BackgroundSubtractor -{ -public: - /** @brief Returns the number of last frames that affect the background model - */ - CV_WRAP virtual int getHistory() const = 0; - /** @brief Sets the number of last frames that affect the background model - */ - CV_WRAP virtual void setHistory(int history) = 0; - - /** @brief Returns the number of data samples in the background model - */ - CV_WRAP virtual int getNSamples() const = 0; - /** @brief Sets the number of data samples in the background model. - - The model needs to be reinitalized to reserve memory. - */ - CV_WRAP virtual void setNSamples(int _nN) = 0;//needs reinitialization! - - /** @brief Returns the threshold on the squared distance between the pixel and the sample - - The threshold on the squared distance between the pixel and the sample to decide whether a pixel is - close to a data sample. - */ - CV_WRAP virtual double getDist2Threshold() const = 0; - /** @brief Sets the threshold on the squared distance - */ - CV_WRAP virtual void setDist2Threshold(double _dist2Threshold) = 0; - - /** @brief Returns the number of neighbours, the k in the kNN. - - K is the number of samples that need to be within dist2Threshold in order to decide that that - pixel is matching the kNN background model. - */ - CV_WRAP virtual int getkNNSamples() const = 0; - /** @brief Sets the k in the kNN. How many nearest neighbours need to match. - */ - CV_WRAP virtual void setkNNSamples(int _nkNN) = 0; - - /** @brief Returns the shadow detection flag - - If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for - details. - */ - CV_WRAP virtual bool getDetectShadows() const = 0; - /** @brief Enables or disables shadow detection - */ - CV_WRAP virtual void setDetectShadows(bool detectShadows) = 0; - - /** @brief Returns the shadow value - - Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0 - in the mask always means background, 255 means foreground. - */ - CV_WRAP virtual int getShadowValue() const = 0; - /** @brief Sets the shadow value - */ - CV_WRAP virtual void setShadowValue(int value) = 0; - - /** @brief Returns the shadow threshold - - A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in - the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel - is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara, - *Detecting Moving Shadows...*, IEEE PAMI,2003. - */ - CV_WRAP virtual double getShadowThreshold() const = 0; - /** @brief Sets the shadow threshold - */ - CV_WRAP virtual void setShadowThreshold(double threshold) = 0; -}; - -/** @brief Creates KNN Background Subtractor - -@param history Length of the history. -@param dist2Threshold Threshold on the squared distance between the pixel and the sample to decide -whether a pixel is close to that sample. This parameter does not affect the background update. -@param detectShadows If true, the algorithm will detect shadows and mark them. It decreases the -speed a bit, so if you do not need this feature, set the parameter to false. - */ -CV_EXPORTS_W Ptr - createBackgroundSubtractorKNN(int history=500, double dist2Threshold=400.0, - bool detectShadows=true); - -//! @} video_motion - -} // cv - -#endif diff --git a/opencv/include/opencv2/video/tracking.hpp b/opencv/include/opencv2/video/tracking.hpp deleted file mode 100644 index e8566fa..0000000 --- a/opencv/include/opencv2/video/tracking.hpp +++ /dev/null @@ -1,654 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_TRACKING_HPP -#define OPENCV_TRACKING_HPP - -#include "opencv2/core.hpp" -#include "opencv2/imgproc.hpp" - -namespace cv -{ - -//! @addtogroup video_track -//! @{ - -enum { OPTFLOW_USE_INITIAL_FLOW = 4, - OPTFLOW_LK_GET_MIN_EIGENVALS = 8, - OPTFLOW_FARNEBACK_GAUSSIAN = 256 - }; - -/** @brief Finds an object center, size, and orientation. - -@param probImage Back projection of the object histogram. See calcBackProject. -@param window Initial search window. -@param criteria Stop criteria for the underlying meanShift. -returns -(in old interfaces) Number of iterations CAMSHIFT took to converge -The function implements the CAMSHIFT object tracking algorithm @cite Bradski98 . First, it finds an -object center using meanShift and then adjusts the window size and finds the optimal rotation. The -function returns the rotated rectangle structure that includes the object position, size, and -orientation. The next position of the search window can be obtained with RotatedRect::boundingRect() - -See the OpenCV sample camshiftdemo.c that tracks colored objects. - -@note -- (Python) A sample explaining the camshift tracking algorithm can be found at - opencv_source_code/samples/python/camshift.py - */ -CV_EXPORTS_W RotatedRect CamShift( InputArray probImage, CV_IN_OUT Rect& window, - TermCriteria criteria ); -/** @example samples/cpp/camshiftdemo.cpp -An example using the mean-shift tracking algorithm -*/ - -/** @brief Finds an object on a back projection image. - -@param probImage Back projection of the object histogram. See calcBackProject for details. -@param window Initial search window. -@param criteria Stop criteria for the iterative search algorithm. -returns -: Number of iterations CAMSHIFT took to converge. -The function implements the iterative object search algorithm. It takes the input back projection of -an object and the initial position. The mass center in window of the back projection image is -computed and the search window center shifts to the mass center. The procedure is repeated until the -specified number of iterations criteria.maxCount is done or until the window center shifts by less -than criteria.epsilon. The algorithm is used inside CamShift and, unlike CamShift , the search -window size or orientation do not change during the search. You can simply pass the output of -calcBackProject to this function. But better results can be obtained if you pre-filter the back -projection and remove the noise. For example, you can do this by retrieving connected components -with findContours , throwing away contours with small area ( contourArea ), and rendering the -remaining contours with drawContours. - - */ -CV_EXPORTS_W int meanShift( InputArray probImage, CV_IN_OUT Rect& window, TermCriteria criteria ); - -/** @brief Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK. - -@param img 8-bit input image. -@param pyramid output pyramid. -@param winSize window size of optical flow algorithm. Must be not less than winSize argument of -calcOpticalFlowPyrLK. It is needed to calculate required padding for pyramid levels. -@param maxLevel 0-based maximal pyramid level number. -@param withDerivatives set to precompute gradients for the every pyramid level. If pyramid is -constructed without the gradients then calcOpticalFlowPyrLK will calculate them internally. -@param pyrBorder the border mode for pyramid layers. -@param derivBorder the border mode for gradients. -@param tryReuseInputImage put ROI of input image into the pyramid if possible. You can pass false -to force data copying. -@return number of levels in constructed pyramid. Can be less than maxLevel. - */ -CV_EXPORTS_W int buildOpticalFlowPyramid( InputArray img, OutputArrayOfArrays pyramid, - Size winSize, int maxLevel, bool withDerivatives = true, - int pyrBorder = BORDER_REFLECT_101, - int derivBorder = BORDER_CONSTANT, - bool tryReuseInputImage = true ); - -/** @example samples/cpp/lkdemo.cpp -An example using the Lucas-Kanade optical flow algorithm -*/ - -/** @brief Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with -pyramids. - -@param prevImg first 8-bit input image or pyramid constructed by buildOpticalFlowPyramid. -@param nextImg second input image or pyramid of the same size and the same type as prevImg. -@param prevPts vector of 2D points for which the flow needs to be found; point coordinates must be -single-precision floating-point numbers. -@param nextPts output vector of 2D points (with single-precision floating-point coordinates) -containing the calculated new positions of input features in the second image; when -OPTFLOW_USE_INITIAL_FLOW flag is passed, the vector must have the same size as in the input. -@param status output status vector (of unsigned chars); each element of the vector is set to 1 if -the flow for the corresponding features has been found, otherwise, it is set to 0. -@param err output vector of errors; each element of the vector is set to an error for the -corresponding feature, type of the error measure can be set in flags parameter; if the flow wasn't -found then the error is not defined (use the status parameter to find such cases). -@param winSize size of the search window at each pyramid level. -@param maxLevel 0-based maximal pyramid level number; if set to 0, pyramids are not used (single -level), if set to 1, two levels are used, and so on; if pyramids are passed to input then -algorithm will use as many levels as pyramids have but no more than maxLevel. -@param criteria parameter, specifying the termination criteria of the iterative search algorithm -(after the specified maximum number of iterations criteria.maxCount or when the search window -moves by less than criteria.epsilon. -@param flags operation flags: - - **OPTFLOW_USE_INITIAL_FLOW** uses initial estimations, stored in nextPts; if the flag is - not set, then prevPts is copied to nextPts and is considered the initial estimate. - - **OPTFLOW_LK_GET_MIN_EIGENVALS** use minimum eigen values as an error measure (see - minEigThreshold description); if the flag is not set, then L1 distance between patches - around the original and a moved point, divided by number of pixels in a window, is used as a - error measure. -@param minEigThreshold the algorithm calculates the minimum eigen value of a 2x2 normal matrix of -optical flow equations (this matrix is called a spatial gradient matrix in @cite Bouguet00), divided -by number of pixels in a window; if this value is less than minEigThreshold, then a corresponding -feature is filtered out and its flow is not processed, so it allows to remove bad points and get a -performance boost. - -The function implements a sparse iterative version of the Lucas-Kanade optical flow in pyramids. See -@cite Bouguet00 . The function is parallelized with the TBB library. - -@note - -- An example using the Lucas-Kanade optical flow algorithm can be found at - opencv_source_code/samples/cpp/lkdemo.cpp -- (Python) An example using the Lucas-Kanade optical flow algorithm can be found at - opencv_source_code/samples/python/lk_track.py -- (Python) An example using the Lucas-Kanade tracker for homography matching can be found at - opencv_source_code/samples/python/lk_homography.py - */ -CV_EXPORTS_W void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg, - InputArray prevPts, InputOutputArray nextPts, - OutputArray status, OutputArray err, - Size winSize = Size(21,21), int maxLevel = 3, - TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01), - int flags = 0, double minEigThreshold = 1e-4 ); - -/** @brief Computes a dense optical flow using the Gunnar Farneback's algorithm. - -@param prev first 8-bit single-channel input image. -@param next second input image of the same size and the same type as prev. -@param flow computed flow image that has the same size as prev and type CV_32FC2. -@param pyr_scale parameter, specifying the image scale (\<1) to build pyramids for each image; -pyr_scale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous -one. -@param levels number of pyramid layers including the initial image; levels=1 means that no extra -layers are created and only the original images are used. -@param winsize averaging window size; larger values increase the algorithm robustness to image -noise and give more chances for fast motion detection, but yield more blurred motion field. -@param iterations number of iterations the algorithm does at each pyramid level. -@param poly_n size of the pixel neighborhood used to find polynomial expansion in each pixel; -larger values mean that the image will be approximated with smoother surfaces, yielding more -robust algorithm and more blurred motion field, typically poly_n =5 or 7. -@param poly_sigma standard deviation of the Gaussian that is used to smooth derivatives used as a -basis for the polynomial expansion; for poly_n=5, you can set poly_sigma=1.1, for poly_n=7, a -good value would be poly_sigma=1.5. -@param flags operation flags that can be a combination of the following: - - **OPTFLOW_USE_INITIAL_FLOW** uses the input flow as an initial flow approximation. - - **OPTFLOW_FARNEBACK_GAUSSIAN** uses the Gaussian \f$\texttt{winsize}\times\texttt{winsize}\f$ - filter instead of a box filter of the same size for optical flow estimation; usually, this - option gives z more accurate flow than with a box filter, at the cost of lower speed; - normally, winsize for a Gaussian window should be set to a larger value to achieve the same - level of robustness. - -The function finds an optical flow for each prev pixel using the @cite Farneback2003 algorithm so that - -\f[\texttt{prev} (y,x) \sim \texttt{next} ( y + \texttt{flow} (y,x)[1], x + \texttt{flow} (y,x)[0])\f] - -@note - -- An example using the optical flow algorithm described by Gunnar Farneback can be found at - opencv_source_code/samples/cpp/fback.cpp -- (Python) An example using the optical flow algorithm described by Gunnar Farneback can be - found at opencv_source_code/samples/python/opt_flow.py - */ -CV_EXPORTS_W void calcOpticalFlowFarneback( InputArray prev, InputArray next, InputOutputArray flow, - double pyr_scale, int levels, int winsize, - int iterations, int poly_n, double poly_sigma, - int flags ); - -/** @brief Computes an optimal affine transformation between two 2D point sets. - -@param src First input 2D point set stored in std::vector or Mat, or an image stored in Mat. -@param dst Second input 2D point set of the same size and the same type as A, or another image. -@param fullAffine If true, the function finds an optimal affine transformation with no additional -restrictions (6 degrees of freedom). Otherwise, the class of transformations to choose from is -limited to combinations of translation, rotation, and uniform scaling (4 degrees of freedom). - -The function finds an optimal affine transform *[A|b]* (a 2 x 3 floating-point matrix) that -approximates best the affine transformation between: - -* Two point sets -* Two raster images. In this case, the function first finds some features in the src image and - finds the corresponding features in dst image. After that, the problem is reduced to the first - case. -In case of point sets, the problem is formulated as follows: you need to find a 2x2 matrix *A* and -2x1 vector *b* so that: - -\f[[A^*|b^*] = arg \min _{[A|b]} \sum _i \| \texttt{dst}[i] - A { \texttt{src}[i]}^T - b \| ^2\f] -where src[i] and dst[i] are the i-th points in src and dst, respectively -\f$[A|b]\f$ can be either arbitrary (when fullAffine=true ) or have a form of -\f[\begin{bmatrix} a_{11} & a_{12} & b_1 \\ -a_{12} & a_{11} & b_2 \end{bmatrix}\f] -when fullAffine=false. - -@sa -estimateAffine2D, estimateAffinePartial2D, getAffineTransform, getPerspectiveTransform, findHomography - */ -CV_EXPORTS_W Mat estimateRigidTransform( InputArray src, InputArray dst, bool fullAffine); -CV_EXPORTS_W Mat estimateRigidTransform( InputArray src, InputArray dst, bool fullAffine, int ransacMaxIters, double ransacGoodRatio, - int ransacSize0); - - -enum -{ - MOTION_TRANSLATION = 0, - MOTION_EUCLIDEAN = 1, - MOTION_AFFINE = 2, - MOTION_HOMOGRAPHY = 3 -}; - -/** @brief Computes the Enhanced Correlation Coefficient value between two images @cite EP08 . - -@param templateImage single-channel template image; CV_8U or CV_32F array. -@param inputImage single-channel input image to be warped to provide an image similar to - templateImage, same type as templateImage. -@param inputMask An optional mask to indicate valid values of inputImage. - -@sa -findTransformECC - */ - -CV_EXPORTS_W double computeECC(InputArray templateImage, InputArray inputImage, InputArray inputMask = noArray()); - -/** @example samples/cpp/image_alignment.cpp -An example using the image alignment ECC algorithm -*/ - -/** @brief Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 . - -@param templateImage single-channel template image; CV_8U or CV_32F array. -@param inputImage single-channel input image which should be warped with the final warpMatrix in -order to provide an image similar to templateImage, same type as templateImage. -@param warpMatrix floating-point \f$2\times 3\f$ or \f$3\times 3\f$ mapping matrix (warp). -@param motionType parameter, specifying the type of motion: - - **MOTION_TRANSLATION** sets a translational motion model; warpMatrix is \f$2\times 3\f$ with - the first \f$2\times 2\f$ part being the unity matrix and the rest two parameters being - estimated. - - **MOTION_EUCLIDEAN** sets a Euclidean (rigid) transformation as motion model; three - parameters are estimated; warpMatrix is \f$2\times 3\f$. - - **MOTION_AFFINE** sets an affine motion model (DEFAULT); six parameters are estimated; - warpMatrix is \f$2\times 3\f$. - - **MOTION_HOMOGRAPHY** sets a homography as a motion model; eight parameters are - estimated;\`warpMatrix\` is \f$3\times 3\f$. -@param criteria parameter, specifying the termination criteria of the ECC algorithm; -criteria.epsilon defines the threshold of the increment in the correlation coefficient between two -iterations (a negative criteria.epsilon makes criteria.maxcount the only termination criterion). -Default values are shown in the declaration above. -@param inputMask An optional mask to indicate valid values of inputImage. -@param gaussFiltSize An optional value indicating size of gaussian blur filter; (DEFAULT: 5) - -The function estimates the optimum transformation (warpMatrix) with respect to ECC criterion -(@cite EP08), that is - -\f[\texttt{warpMatrix} = \texttt{warpMatrix} = \arg\max_{W} \texttt{ECC}(\texttt{templateImage}(x,y),\texttt{inputImage}(x',y'))\f] - -where - -\f[\begin{bmatrix} x' \\ y' \end{bmatrix} = W \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}\f] - -(the equation holds with homogeneous coordinates for homography). It returns the final enhanced -correlation coefficient, that is the correlation coefficient between the template image and the -final warped input image. When a \f$3\times 3\f$ matrix is given with motionType =0, 1 or 2, the third -row is ignored. - -Unlike findHomography and estimateRigidTransform, the function findTransformECC implements an -area-based alignment that builds on intensity similarities. In essence, the function updates the -initial transformation that roughly aligns the images. If this information is missing, the identity -warp (unity matrix) is used as an initialization. Note that if images undergo strong -displacements/rotations, an initial transformation that roughly aligns the images is necessary -(e.g., a simple euclidean/similarity transform that allows for the images showing the same image -content approximately). Use inverse warping in the second image to take an image close to the first -one, i.e. use the flag WARP_INVERSE_MAP with warpAffine or warpPerspective. See also the OpenCV -sample image_alignment.cpp that demonstrates the use of the function. Note that the function throws -an exception if algorithm does not converges. - -@sa -computeECC, estimateAffine2D, estimateAffinePartial2D, findHomography - */ -CV_EXPORTS_W double findTransformECC( InputArray templateImage, InputArray inputImage, - InputOutputArray warpMatrix, int motionType, - TermCriteria criteria, - InputArray inputMask, int gaussFiltSize); - -/** @overload */ -CV_EXPORTS -double findTransformECC(InputArray templateImage, InputArray inputImage, - InputOutputArray warpMatrix, int motionType = MOTION_AFFINE, - TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 50, 0.001), - InputArray inputMask = noArray()); - -/** @example samples/cpp/kalman.cpp -An example using the standard Kalman filter -*/ - -/** @brief Kalman filter class. - -The class implements a standard Kalman filter , -@cite Welch95 . However, you can modify transitionMatrix, controlMatrix, and measurementMatrix to get -an extended Kalman filter functionality. -@note In C API when CvKalman\* kalmanFilter structure is not needed anymore, it should be released -with cvReleaseKalman(&kalmanFilter) - */ -class CV_EXPORTS_W KalmanFilter -{ -public: - CV_WRAP KalmanFilter(); - /** @overload - @param dynamParams Dimensionality of the state. - @param measureParams Dimensionality of the measurement. - @param controlParams Dimensionality of the control vector. - @param type Type of the created matrices that should be CV_32F or CV_64F. - */ - CV_WRAP KalmanFilter( int dynamParams, int measureParams, int controlParams = 0, int type = CV_32F ); - - /** @brief Re-initializes Kalman filter. The previous content is destroyed. - - @param dynamParams Dimensionality of the state. - @param measureParams Dimensionality of the measurement. - @param controlParams Dimensionality of the control vector. - @param type Type of the created matrices that should be CV_32F or CV_64F. - */ - void init( int dynamParams, int measureParams, int controlParams = 0, int type = CV_32F ); - - /** @brief Computes a predicted state. - - @param control The optional input control - */ - CV_WRAP const Mat& predict( const Mat& control = Mat() ); - - /** @brief Updates the predicted state from the measurement. - - @param measurement The measured system parameters - */ - CV_WRAP const Mat& correct( const Mat& measurement ); - - CV_PROP_RW Mat statePre; //!< predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k) - CV_PROP_RW Mat statePost; //!< corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k)) - CV_PROP_RW Mat transitionMatrix; //!< state transition matrix (A) - CV_PROP_RW Mat controlMatrix; //!< control matrix (B) (not used if there is no control) - CV_PROP_RW Mat measurementMatrix; //!< measurement matrix (H) - CV_PROP_RW Mat processNoiseCov; //!< process noise covariance matrix (Q) - CV_PROP_RW Mat measurementNoiseCov;//!< measurement noise covariance matrix (R) - CV_PROP_RW Mat errorCovPre; //!< priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/ - CV_PROP_RW Mat gain; //!< Kalman gain matrix (K(k)): K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R) - CV_PROP_RW Mat errorCovPost; //!< posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k) - - // temporary matrices - Mat temp1; - Mat temp2; - Mat temp3; - Mat temp4; - Mat temp5; -}; - - -class CV_EXPORTS_W DenseOpticalFlow : public Algorithm -{ -public: - /** @brief Calculates an optical flow. - - @param I0 first 8-bit single-channel input image. - @param I1 second input image of the same size and the same type as prev. - @param flow computed flow image that has the same size as prev and type CV_32FC2. - */ - CV_WRAP virtual void calc( InputArray I0, InputArray I1, InputOutputArray flow ) = 0; - /** @brief Releases all inner buffers. - */ - CV_WRAP virtual void collectGarbage() = 0; -}; - -/** @brief Base interface for sparse optical flow algorithms. - */ -class CV_EXPORTS_W SparseOpticalFlow : public Algorithm -{ -public: - /** @brief Calculates a sparse optical flow. - - @param prevImg First input image. - @param nextImg Second input image of the same size and the same type as prevImg. - @param prevPts Vector of 2D points for which the flow needs to be found. - @param nextPts Output vector of 2D points containing the calculated new positions of input features in the second image. - @param status Output status vector. Each element of the vector is set to 1 if the - flow for the corresponding features has been found. Otherwise, it is set to 0. - @param err Optional output vector that contains error response for each point (inverse confidence). - */ - CV_WRAP virtual void calc(InputArray prevImg, InputArray nextImg, - InputArray prevPts, InputOutputArray nextPts, - OutputArray status, - OutputArray err = cv::noArray()) = 0; -}; - -/** @brief "Dual TV L1" Optical Flow Algorithm. - -The class implements the "Dual TV L1" optical flow algorithm described in @cite Zach2007 and -@cite Javier2012 . -Here are important members of the class that control the algorithm, which you can set after -constructing the class instance: - -- member double tau - Time step of the numerical scheme. - -- member double lambda - Weight parameter for the data term, attachment parameter. This is the most relevant - parameter, which determines the smoothness of the output. The smaller this parameter is, - the smoother the solutions we obtain. It depends on the range of motions of the images, so - its value should be adapted to each image sequence. - -- member double theta - Weight parameter for (u - v)\^2, tightness parameter. It serves as a link between the - attachment and the regularization terms. In theory, it should have a small value in order - to maintain both parts in correspondence. The method is stable for a large range of values - of this parameter. - -- member int nscales - Number of scales used to create the pyramid of images. - -- member int warps - Number of warpings per scale. Represents the number of times that I1(x+u0) and grad( - I1(x+u0) ) are computed per scale. This is a parameter that assures the stability of the - method. It also affects the running time, so it is a compromise between speed and - accuracy. - -- member double epsilon - Stopping criterion threshold used in the numerical scheme, which is a trade-off between - precision and running time. A small value will yield more accurate solutions at the - expense of a slower convergence. - -- member int iterations - Stopping criterion iterations number used in the numerical scheme. - -C. Zach, T. Pock and H. Bischof, "A Duality Based Approach for Realtime TV-L1 Optical Flow". -Javier Sanchez, Enric Meinhardt-Llopis and Gabriele Facciolo. "TV-L1 Optical Flow Estimation". -*/ -class CV_EXPORTS_W DualTVL1OpticalFlow : public DenseOpticalFlow -{ -public: - //! @brief Time step of the numerical scheme - /** @see setTau */ - CV_WRAP virtual double getTau() const = 0; - /** @copybrief getTau @see getTau */ - CV_WRAP virtual void setTau(double val) = 0; - //! @brief Weight parameter for the data term, attachment parameter - /** @see setLambda */ - CV_WRAP virtual double getLambda() const = 0; - /** @copybrief getLambda @see getLambda */ - CV_WRAP virtual void setLambda(double val) = 0; - //! @brief Weight parameter for (u - v)^2, tightness parameter - /** @see setTheta */ - CV_WRAP virtual double getTheta() const = 0; - /** @copybrief getTheta @see getTheta */ - CV_WRAP virtual void setTheta(double val) = 0; - //! @brief coefficient for additional illumination variation term - /** @see setGamma */ - CV_WRAP virtual double getGamma() const = 0; - /** @copybrief getGamma @see getGamma */ - CV_WRAP virtual void setGamma(double val) = 0; - //! @brief Number of scales used to create the pyramid of images - /** @see setScalesNumber */ - CV_WRAP virtual int getScalesNumber() const = 0; - /** @copybrief getScalesNumber @see getScalesNumber */ - CV_WRAP virtual void setScalesNumber(int val) = 0; - //! @brief Number of warpings per scale - /** @see setWarpingsNumber */ - CV_WRAP virtual int getWarpingsNumber() const = 0; - /** @copybrief getWarpingsNumber @see getWarpingsNumber */ - CV_WRAP virtual void setWarpingsNumber(int val) = 0; - //! @brief Stopping criterion threshold used in the numerical scheme, which is a trade-off between precision and running time - /** @see setEpsilon */ - CV_WRAP virtual double getEpsilon() const = 0; - /** @copybrief getEpsilon @see getEpsilon */ - CV_WRAP virtual void setEpsilon(double val) = 0; - //! @brief Inner iterations (between outlier filtering) used in the numerical scheme - /** @see setInnerIterations */ - CV_WRAP virtual int getInnerIterations() const = 0; - /** @copybrief getInnerIterations @see getInnerIterations */ - CV_WRAP virtual void setInnerIterations(int val) = 0; - //! @brief Outer iterations (number of inner loops) used in the numerical scheme - /** @see setOuterIterations */ - CV_WRAP virtual int getOuterIterations() const = 0; - /** @copybrief getOuterIterations @see getOuterIterations */ - CV_WRAP virtual void setOuterIterations(int val) = 0; - //! @brief Use initial flow - /** @see setUseInitialFlow */ - CV_WRAP virtual bool getUseInitialFlow() const = 0; - /** @copybrief getUseInitialFlow @see getUseInitialFlow */ - CV_WRAP virtual void setUseInitialFlow(bool val) = 0; - //! @brief Step between scales (<1) - /** @see setScaleStep */ - CV_WRAP virtual double getScaleStep() const = 0; - /** @copybrief getScaleStep @see getScaleStep */ - CV_WRAP virtual void setScaleStep(double val) = 0; - //! @brief Median filter kernel size (1 = no filter) (3 or 5) - /** @see setMedianFiltering */ - CV_WRAP virtual int getMedianFiltering() const = 0; - /** @copybrief getMedianFiltering @see getMedianFiltering */ - CV_WRAP virtual void setMedianFiltering(int val) = 0; - - /** @brief Creates instance of cv::DualTVL1OpticalFlow*/ - CV_WRAP static Ptr create( - double tau = 0.25, - double lambda = 0.15, - double theta = 0.3, - int nscales = 5, - int warps = 5, - double epsilon = 0.01, - int innnerIterations = 30, - int outerIterations = 10, - double scaleStep = 0.8, - double gamma = 0.0, - int medianFiltering = 5, - bool useInitialFlow = false); -}; - -/** @brief Creates instance of cv::DenseOpticalFlow -*/ -CV_EXPORTS_W Ptr createOptFlow_DualTVL1(); - -/** @brief Class computing a dense optical flow using the Gunnar Farneback's algorithm. - */ -class CV_EXPORTS_W FarnebackOpticalFlow : public DenseOpticalFlow -{ -public: - CV_WRAP virtual int getNumLevels() const = 0; - CV_WRAP virtual void setNumLevels(int numLevels) = 0; - - CV_WRAP virtual double getPyrScale() const = 0; - CV_WRAP virtual void setPyrScale(double pyrScale) = 0; - - CV_WRAP virtual bool getFastPyramids() const = 0; - CV_WRAP virtual void setFastPyramids(bool fastPyramids) = 0; - - CV_WRAP virtual int getWinSize() const = 0; - CV_WRAP virtual void setWinSize(int winSize) = 0; - - CV_WRAP virtual int getNumIters() const = 0; - CV_WRAP virtual void setNumIters(int numIters) = 0; - - CV_WRAP virtual int getPolyN() const = 0; - CV_WRAP virtual void setPolyN(int polyN) = 0; - - CV_WRAP virtual double getPolySigma() const = 0; - CV_WRAP virtual void setPolySigma(double polySigma) = 0; - - CV_WRAP virtual int getFlags() const = 0; - CV_WRAP virtual void setFlags(int flags) = 0; - - CV_WRAP static Ptr create( - int numLevels = 5, - double pyrScale = 0.5, - bool fastPyramids = false, - int winSize = 13, - int numIters = 10, - int polyN = 5, - double polySigma = 1.1, - int flags = 0); -}; - - -/** @brief Class used for calculating a sparse optical flow. - -The class can calculate an optical flow for a sparse feature set using the -iterative Lucas-Kanade method with pyramids. - -@sa calcOpticalFlowPyrLK - -*/ -class CV_EXPORTS_W SparsePyrLKOpticalFlow : public SparseOpticalFlow -{ -public: - CV_WRAP virtual Size getWinSize() const = 0; - CV_WRAP virtual void setWinSize(Size winSize) = 0; - - CV_WRAP virtual int getMaxLevel() const = 0; - CV_WRAP virtual void setMaxLevel(int maxLevel) = 0; - - CV_WRAP virtual TermCriteria getTermCriteria() const = 0; - CV_WRAP virtual void setTermCriteria(TermCriteria& crit) = 0; - - CV_WRAP virtual int getFlags() const = 0; - CV_WRAP virtual void setFlags(int flags) = 0; - - CV_WRAP virtual double getMinEigThreshold() const = 0; - CV_WRAP virtual void setMinEigThreshold(double minEigThreshold) = 0; - - CV_WRAP static Ptr create( - Size winSize = Size(21, 21), - int maxLevel = 3, TermCriteria crit = - TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01), - int flags = 0, - double minEigThreshold = 1e-4); -}; - -//! @} video_track - -} // cv - -#endif diff --git a/opencv/include/opencv2/video/tracking_c.h b/opencv/include/opencv2/video/tracking_c.h deleted file mode 100644 index 3e32fbd..0000000 --- a/opencv/include/opencv2/video/tracking_c.h +++ /dev/null @@ -1,232 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_TRACKING_C_H -#define OPENCV_TRACKING_C_H - -#include "opencv2/imgproc/types_c.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup video_c - @{ -*/ - -/****************************************************************************************\ -* Motion Analysis * -\****************************************************************************************/ - -/************************************ optical flow ***************************************/ - -#define CV_LKFLOW_PYR_A_READY 1 -#define CV_LKFLOW_PYR_B_READY 2 -#define CV_LKFLOW_INITIAL_GUESSES 4 -#define CV_LKFLOW_GET_MIN_EIGENVALS 8 - -/* It is Lucas & Kanade method, modified to use pyramids. - Also it does several iterations to get optical flow for - every point at every pyramid level. - Calculates optical flow between two images for certain set of points (i.e. - it is a "sparse" optical flow, which is opposite to the previous 3 methods) */ -CVAPI(void) cvCalcOpticalFlowPyrLK( const CvArr* prev, const CvArr* curr, - CvArr* prev_pyr, CvArr* curr_pyr, - const CvPoint2D32f* prev_features, - CvPoint2D32f* curr_features, - int count, - CvSize win_size, - int level, - char* status, - float* track_error, - CvTermCriteria criteria, - int flags ); - - -/* Modification of a previous sparse optical flow algorithm to calculate - affine flow */ -CVAPI(void) cvCalcAffineFlowPyrLK( const CvArr* prev, const CvArr* curr, - CvArr* prev_pyr, CvArr* curr_pyr, - const CvPoint2D32f* prev_features, - CvPoint2D32f* curr_features, - float* matrices, int count, - CvSize win_size, int level, - char* status, float* track_error, - CvTermCriteria criteria, int flags ); - -/* Estimate rigid transformation between 2 images or 2 point sets */ -CVAPI(int) cvEstimateRigidTransform( const CvArr* A, const CvArr* B, - CvMat* M, int full_affine ); - -/* Estimate optical flow for each pixel using the two-frame G. Farneback algorithm */ -CVAPI(void) cvCalcOpticalFlowFarneback( const CvArr* prev, const CvArr* next, - CvArr* flow, double pyr_scale, int levels, - int winsize, int iterations, int poly_n, - double poly_sigma, int flags ); - -/********************************* motion templates *************************************/ - -/****************************************************************************************\ -* All the motion template functions work only with single channel images. * -* Silhouette image must have depth IPL_DEPTH_8U or IPL_DEPTH_8S * -* Motion history image must have depth IPL_DEPTH_32F, * -* Gradient mask - IPL_DEPTH_8U or IPL_DEPTH_8S, * -* Motion orientation image - IPL_DEPTH_32F * -* Segmentation mask - IPL_DEPTH_32F * -* All the angles are in degrees, all the times are in milliseconds * -\****************************************************************************************/ - -/* Updates motion history image given motion silhouette */ -CVAPI(void) cvUpdateMotionHistory( const CvArr* silhouette, CvArr* mhi, - double timestamp, double duration ); - -/* Calculates gradient of the motion history image and fills - a mask indicating where the gradient is valid */ -CVAPI(void) cvCalcMotionGradient( const CvArr* mhi, CvArr* mask, CvArr* orientation, - double delta1, double delta2, - int aperture_size CV_DEFAULT(3)); - -/* Calculates average motion direction within a selected motion region - (region can be selected by setting ROIs and/or by composing a valid gradient mask - with the region mask) */ -CVAPI(double) cvCalcGlobalOrientation( const CvArr* orientation, const CvArr* mask, - const CvArr* mhi, double timestamp, - double duration ); - -/* Splits a motion history image into a few parts corresponding to separate independent motions - (e.g. left hand, right hand) */ -CVAPI(CvSeq*) cvSegmentMotion( const CvArr* mhi, CvArr* seg_mask, - CvMemStorage* storage, - double timestamp, double seg_thresh ); - -/****************************************************************************************\ -* Tracking * -\****************************************************************************************/ - -/* Implements CAMSHIFT algorithm - determines object position, size and orientation - from the object histogram back project (extension of meanshift) */ -CVAPI(int) cvCamShift( const CvArr* prob_image, CvRect window, - CvTermCriteria criteria, CvConnectedComp* comp, - CvBox2D* box CV_DEFAULT(NULL) ); - -/* Implements MeanShift algorithm - determines object position - from the object histogram back project */ -CVAPI(int) cvMeanShift( const CvArr* prob_image, CvRect window, - CvTermCriteria criteria, CvConnectedComp* comp ); - -/* -standard Kalman filter (in G. Welch' and G. Bishop's notation): - - x(k)=A*x(k-1)+B*u(k)+w(k) p(w)~N(0,Q) - z(k)=H*x(k)+v(k), p(v)~N(0,R) -*/ -typedef struct CvKalman -{ - int MP; /* number of measurement vector dimensions */ - int DP; /* number of state vector dimensions */ - int CP; /* number of control vector dimensions */ - - /* backward compatibility fields */ -#if 1 - float* PosterState; /* =state_pre->data.fl */ - float* PriorState; /* =state_post->data.fl */ - float* DynamMatr; /* =transition_matrix->data.fl */ - float* MeasurementMatr; /* =measurement_matrix->data.fl */ - float* MNCovariance; /* =measurement_noise_cov->data.fl */ - float* PNCovariance; /* =process_noise_cov->data.fl */ - float* KalmGainMatr; /* =gain->data.fl */ - float* PriorErrorCovariance;/* =error_cov_pre->data.fl */ - float* PosterErrorCovariance;/* =error_cov_post->data.fl */ - float* Temp1; /* temp1->data.fl */ - float* Temp2; /* temp2->data.fl */ -#endif - - CvMat* state_pre; /* predicted state (x'(k)): - x(k)=A*x(k-1)+B*u(k) */ - CvMat* state_post; /* corrected state (x(k)): - x(k)=x'(k)+K(k)*(z(k)-H*x'(k)) */ - CvMat* transition_matrix; /* state transition matrix (A) */ - CvMat* control_matrix; /* control matrix (B) - (it is not used if there is no control)*/ - CvMat* measurement_matrix; /* measurement matrix (H) */ - CvMat* process_noise_cov; /* process noise covariance matrix (Q) */ - CvMat* measurement_noise_cov; /* measurement noise covariance matrix (R) */ - CvMat* error_cov_pre; /* priori error estimate covariance matrix (P'(k)): - P'(k)=A*P(k-1)*At + Q)*/ - CvMat* gain; /* Kalman gain matrix (K(k)): - K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)*/ - CvMat* error_cov_post; /* posteriori error estimate covariance matrix (P(k)): - P(k)=(I-K(k)*H)*P'(k) */ - CvMat* temp1; /* temporary matrices */ - CvMat* temp2; - CvMat* temp3; - CvMat* temp4; - CvMat* temp5; -} CvKalman; - -/* Creates Kalman filter and sets A, B, Q, R and state to some initial values */ -CVAPI(CvKalman*) cvCreateKalman( int dynam_params, int measure_params, - int control_params CV_DEFAULT(0)); - -/* Releases Kalman filter state */ -CVAPI(void) cvReleaseKalman( CvKalman** kalman); - -/* Updates Kalman filter by time (predicts future state of the system) */ -CVAPI(const CvMat*) cvKalmanPredict( CvKalman* kalman, - const CvMat* control CV_DEFAULT(NULL)); - -/* Updates Kalman filter by measurement - (corrects state of the system and internal matrices) */ -CVAPI(const CvMat*) cvKalmanCorrect( CvKalman* kalman, const CvMat* measurement ); - -#define cvKalmanUpdateByTime cvKalmanPredict -#define cvKalmanUpdateByMeasurement cvKalmanCorrect - -/** @} video_c */ - -#ifdef __cplusplus -} // extern "C" -#endif - - -#endif // OPENCV_TRACKING_C_H diff --git a/opencv/include/opencv2/video/video.hpp b/opencv/include/opencv2/video/video.hpp deleted file mode 100644 index 8267b85..0000000 --- a/opencv/include/opencv2/video/video.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/video.hpp" diff --git a/opencv/include/opencv2/videoio.hpp b/opencv/include/opencv2/videoio.hpp deleted file mode 100644 index cc639d6..0000000 --- a/opencv/include/opencv2/videoio.hpp +++ /dev/null @@ -1,992 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOIO_HPP -#define OPENCV_VIDEOIO_HPP - -#include "opencv2/core.hpp" - -/** - @defgroup videoio Video I/O - - @brief Read and write video or images sequence with OpenCV - - ### See also: - - @ref videoio_overview - - Tutorials: @ref tutorial_table_of_content_videoio - @{ - @defgroup videoio_flags_base Flags for video I/O - @defgroup videoio_flags_others Additional flags for video I/O API backends - @defgroup videoio_c C API for video I/O - @defgroup videoio_ios iOS glue for video I/O - @defgroup videoio_winrt WinRT glue for video I/O - @defgroup videoio_registry Query I/O API backends registry - @} -*/ - -////////////////////////////////// video io ///////////////////////////////// - -typedef struct CvCapture CvCapture; -typedef struct CvVideoWriter CvVideoWriter; - -namespace cv -{ - -//! @addtogroup videoio -//! @{ - -//! @addtogroup videoio_flags_base -//! @{ - - -/** @brief %VideoCapture API backends identifier. - -Select preferred API for a capture object. -To be used in the VideoCapture::VideoCapture() constructor or VideoCapture::open() - -@note Backends are available only if they have been built with your OpenCV binaries. -See @ref videoio_overview for more information. -*/ -enum VideoCaptureAPIs { - CAP_ANY = 0, //!< Auto detect == 0 - CAP_VFW = 200, //!< Video For Windows (platform native) - CAP_V4L = 200, //!< V4L/V4L2 capturing support via libv4l - CAP_V4L2 = CAP_V4L, //!< Same as CAP_V4L - CAP_FIREWIRE = 300, //!< IEEE 1394 drivers - CAP_FIREWARE = CAP_FIREWIRE, //!< Same as CAP_FIREWIRE - CAP_IEEE1394 = CAP_FIREWIRE, //!< Same as CAP_FIREWIRE - CAP_DC1394 = CAP_FIREWIRE, //!< Same as CAP_FIREWIRE - CAP_CMU1394 = CAP_FIREWIRE, //!< Same as CAP_FIREWIRE - CAP_QT = 500, //!< QuickTime - CAP_UNICAP = 600, //!< Unicap drivers - CAP_DSHOW = 700, //!< DirectShow (via videoInput) - CAP_PVAPI = 800, //!< PvAPI, Prosilica GigE SDK - CAP_OPENNI = 900, //!< OpenNI (for Kinect) - CAP_OPENNI_ASUS = 910, //!< OpenNI (for Asus Xtion) - CAP_ANDROID = 1000, //!< Android - not used - CAP_XIAPI = 1100, //!< XIMEA Camera API - CAP_AVFOUNDATION = 1200, //!< AVFoundation framework for iOS (OS X Lion will have the same API) - CAP_GIGANETIX = 1300, //!< Smartek Giganetix GigEVisionSDK - CAP_MSMF = 1400, //!< Microsoft Media Foundation (via videoInput) - CAP_WINRT = 1410, //!< Microsoft Windows Runtime using Media Foundation - CAP_INTELPERC = 1500, //!< Intel Perceptual Computing SDK - CAP_OPENNI2 = 1600, //!< OpenNI2 (for Kinect) - CAP_OPENNI2_ASUS = 1610, //!< OpenNI2 (for Asus Xtion and Occipital Structure sensors) - CAP_GPHOTO2 = 1700, //!< gPhoto2 connection - CAP_GSTREAMER = 1800, //!< GStreamer - CAP_FFMPEG = 1900, //!< Open and record video file or stream using the FFMPEG library - CAP_IMAGES = 2000, //!< OpenCV Image Sequence (e.g. img_%02d.jpg) - CAP_ARAVIS = 2100, //!< Aravis SDK - CAP_OPENCV_MJPEG = 2200, //!< Built-in OpenCV MotionJPEG codec - CAP_INTEL_MFX = 2300, //!< Intel MediaSDK - CAP_XINE = 2400, //!< XINE engine (Linux) - }; - -/** @brief %VideoCapture generic properties identifier. - - Reading / writing properties involves many layers. Some unexpected result might happens along this chain. - Effective behaviour depends from device hardware, driver and API Backend. - @sa videoio_flags_others, VideoCapture::get(), VideoCapture::set() -*/ -enum VideoCaptureProperties { - CAP_PROP_POS_MSEC =0, //!< Current position of the video file in milliseconds. - CAP_PROP_POS_FRAMES =1, //!< 0-based index of the frame to be decoded/captured next. - CAP_PROP_POS_AVI_RATIO =2, //!< Relative position of the video file: 0=start of the film, 1=end of the film. - CAP_PROP_FRAME_WIDTH =3, //!< Width of the frames in the video stream. - CAP_PROP_FRAME_HEIGHT =4, //!< Height of the frames in the video stream. - CAP_PROP_FPS =5, //!< Frame rate. - CAP_PROP_FOURCC =6, //!< 4-character code of codec. see VideoWriter::fourcc . - CAP_PROP_FRAME_COUNT =7, //!< Number of frames in the video file. - CAP_PROP_FORMAT =8, //!< Format of the %Mat objects returned by VideoCapture::retrieve(). - CAP_PROP_MODE =9, //!< Backend-specific value indicating the current capture mode. - CAP_PROP_BRIGHTNESS =10, //!< Brightness of the image (only for those cameras that support). - CAP_PROP_CONTRAST =11, //!< Contrast of the image (only for cameras). - CAP_PROP_SATURATION =12, //!< Saturation of the image (only for cameras). - CAP_PROP_HUE =13, //!< Hue of the image (only for cameras). - CAP_PROP_GAIN =14, //!< Gain of the image (only for those cameras that support). - CAP_PROP_EXPOSURE =15, //!< Exposure (only for those cameras that support). - CAP_PROP_CONVERT_RGB =16, //!< Boolean flags indicating whether images should be converted to RGB. - CAP_PROP_WHITE_BALANCE_BLUE_U =17, //!< Currently unsupported. - CAP_PROP_RECTIFICATION =18, //!< Rectification flag for stereo cameras (note: only supported by DC1394 v 2.x backend currently). - CAP_PROP_MONOCHROME =19, - CAP_PROP_SHARPNESS =20, - CAP_PROP_AUTO_EXPOSURE =21, //!< DC1394: exposure control done by camera, user can adjust reference level using this feature. - CAP_PROP_GAMMA =22, - CAP_PROP_TEMPERATURE =23, - CAP_PROP_TRIGGER =24, - CAP_PROP_TRIGGER_DELAY =25, - CAP_PROP_WHITE_BALANCE_RED_V =26, - CAP_PROP_ZOOM =27, - CAP_PROP_FOCUS =28, - CAP_PROP_GUID =29, - CAP_PROP_ISO_SPEED =30, - CAP_PROP_BACKLIGHT =32, - CAP_PROP_PAN =33, - CAP_PROP_TILT =34, - CAP_PROP_ROLL =35, - CAP_PROP_IRIS =36, - CAP_PROP_SETTINGS =37, //!< Pop up video/camera filter dialog (note: only supported by DSHOW backend currently. The property value is ignored) - CAP_PROP_BUFFERSIZE =38, - CAP_PROP_AUTOFOCUS =39, - CAP_PROP_SAR_NUM =40, //!< Sample aspect ratio: num/den (num) - CAP_PROP_SAR_DEN =41, //!< Sample aspect ratio: num/den (den) - CAP_PROP_BACKEND =42, //!< Current backend (enum VideoCaptureAPIs). Read-only property - CAP_PROP_CHANNEL =43, //!< Video input or Channel Number (only for those cameras that support) - CAP_PROP_AUTO_WB =44, //!< enable/ disable auto white-balance - CAP_PROP_WB_TEMPERATURE=45, //!< white-balance color temperature -#ifndef CV_DOXYGEN - CV__CAP_PROP_LATEST -#endif - }; - - -/** @brief Generic camera output modes identifier. -@note Currently, these are supported through the libv4l backend only. -*/ -enum VideoCaptureModes { - CAP_MODE_BGR = 0, //!< BGR24 (default) - CAP_MODE_RGB = 1, //!< RGB24 - CAP_MODE_GRAY = 2, //!< Y8 - CAP_MODE_YUYV = 3 //!< YUYV - }; - -/** @brief %VideoWriter generic properties identifier. - @sa VideoWriter::get(), VideoWriter::set() -*/ -enum VideoWriterProperties { - VIDEOWRITER_PROP_QUALITY = 1, //!< Current quality (0..100%) of the encoded videostream. Can be adjusted dynamically in some codecs. - VIDEOWRITER_PROP_FRAMEBYTES = 2, //!< (Read-only): Size of just encoded video frame. Note that the encoding order may be different from representation order. - VIDEOWRITER_PROP_NSTRIPES = 3 //!< Number of stripes for parallel encoding. -1 for auto detection. -}; - -//! @} videoio_flags_base - -//! @addtogroup videoio_flags_others -//! @{ - -/** @name IEEE 1394 drivers - @{ -*/ - -/** @brief Modes of the IEEE 1394 controlling registers -(can be: auto, manual, auto single push, absolute Latter allowed with any other mode) -every feature can have only one mode turned on at a time -*/ -enum { CAP_PROP_DC1394_OFF = -4, //!< turn the feature off (not controlled manually nor automatically). - CAP_PROP_DC1394_MODE_MANUAL = -3, //!< set automatically when a value of the feature is set by the user. - CAP_PROP_DC1394_MODE_AUTO = -2, - CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1, - CAP_PROP_DC1394_MAX = 31 - }; - -//! @} IEEE 1394 drivers - -/** @name OpenNI (for Kinect) - @{ -*/ - -//! OpenNI map generators -enum { CAP_OPENNI_DEPTH_GENERATOR = 1 << 31, - CAP_OPENNI_IMAGE_GENERATOR = 1 << 30, - CAP_OPENNI_IR_GENERATOR = 1 << 29, - CAP_OPENNI_GENERATORS_MASK = CAP_OPENNI_DEPTH_GENERATOR + CAP_OPENNI_IMAGE_GENERATOR + CAP_OPENNI_IR_GENERATOR - }; - -//! Properties of cameras available through OpenNI backend -enum { CAP_PROP_OPENNI_OUTPUT_MODE = 100, - CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101, //!< In mm - CAP_PROP_OPENNI_BASELINE = 102, //!< In mm - CAP_PROP_OPENNI_FOCAL_LENGTH = 103, //!< In pixels - CAP_PROP_OPENNI_REGISTRATION = 104, //!< Flag that synchronizes the remapping depth map to image map - //!< by changing depth generator's view point (if the flag is "on") or - //!< sets this view point to its normal one (if the flag is "off"). - CAP_PROP_OPENNI_REGISTRATION_ON = CAP_PROP_OPENNI_REGISTRATION, - CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105, - CAP_PROP_OPENNI_MAX_BUFFER_SIZE = 106, - CAP_PROP_OPENNI_CIRCLE_BUFFER = 107, - CAP_PROP_OPENNI_MAX_TIME_DURATION = 108, - CAP_PROP_OPENNI_GENERATOR_PRESENT = 109, - CAP_PROP_OPENNI2_SYNC = 110, - CAP_PROP_OPENNI2_MIRROR = 111 - }; - -//! OpenNI shortcuts -enum { CAP_OPENNI_IMAGE_GENERATOR_PRESENT = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT, - CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_OUTPUT_MODE, - CAP_OPENNI_DEPTH_GENERATOR_PRESENT = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT, - CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_BASELINE, - CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_FOCAL_LENGTH, - CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_REGISTRATION, - CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION, - CAP_OPENNI_IR_GENERATOR_PRESENT = CAP_OPENNI_IR_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT, - }; - -//! OpenNI data given from depth generator -enum { CAP_OPENNI_DEPTH_MAP = 0, //!< Depth values in mm (CV_16UC1) - CAP_OPENNI_POINT_CLOUD_MAP = 1, //!< XYZ in meters (CV_32FC3) - CAP_OPENNI_DISPARITY_MAP = 2, //!< Disparity in pixels (CV_8UC1) - CAP_OPENNI_DISPARITY_MAP_32F = 3, //!< Disparity in pixels (CV_32FC1) - CAP_OPENNI_VALID_DEPTH_MASK = 4, //!< CV_8UC1 - - CAP_OPENNI_BGR_IMAGE = 5, //!< Data given from RGB image generator - CAP_OPENNI_GRAY_IMAGE = 6, //!< Data given from RGB image generator - - CAP_OPENNI_IR_IMAGE = 7 //!< Data given from IR image generator - }; - -//! Supported output modes of OpenNI image generator -enum { CAP_OPENNI_VGA_30HZ = 0, - CAP_OPENNI_SXGA_15HZ = 1, - CAP_OPENNI_SXGA_30HZ = 2, - CAP_OPENNI_QVGA_30HZ = 3, - CAP_OPENNI_QVGA_60HZ = 4 - }; - -//! @} OpenNI - -/** @name GStreamer - @{ -*/ - -enum { CAP_PROP_GSTREAMER_QUEUE_LENGTH = 200 //!< Default is 1 - }; - -//! @} GStreamer - -/** @name PvAPI, Prosilica GigE SDK - @{ -*/ - -//! PVAPI -enum { CAP_PROP_PVAPI_MULTICASTIP = 300, //!< IP for enable multicast master mode. 0 for disable multicast. - CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301, //!< FrameStartTriggerMode: Determines how a frame is initiated. - CAP_PROP_PVAPI_DECIMATIONHORIZONTAL = 302, //!< Horizontal sub-sampling of the image. - CAP_PROP_PVAPI_DECIMATIONVERTICAL = 303, //!< Vertical sub-sampling of the image. - CAP_PROP_PVAPI_BINNINGX = 304, //!< Horizontal binning factor. - CAP_PROP_PVAPI_BINNINGY = 305, //!< Vertical binning factor. - CAP_PROP_PVAPI_PIXELFORMAT = 306 //!< Pixel format. - }; - -//! PVAPI: FrameStartTriggerMode -enum { CAP_PVAPI_FSTRIGMODE_FREERUN = 0, //!< Freerun - CAP_PVAPI_FSTRIGMODE_SYNCIN1 = 1, //!< SyncIn1 - CAP_PVAPI_FSTRIGMODE_SYNCIN2 = 2, //!< SyncIn2 - CAP_PVAPI_FSTRIGMODE_FIXEDRATE = 3, //!< FixedRate - CAP_PVAPI_FSTRIGMODE_SOFTWARE = 4 //!< Software - }; - -//! PVAPI: DecimationHorizontal, DecimationVertical -enum { CAP_PVAPI_DECIMATION_OFF = 1, //!< Off - CAP_PVAPI_DECIMATION_2OUTOF4 = 2, //!< 2 out of 4 decimation - CAP_PVAPI_DECIMATION_2OUTOF8 = 4, //!< 2 out of 8 decimation - CAP_PVAPI_DECIMATION_2OUTOF16 = 8 //!< 2 out of 16 decimation - }; - -//! PVAPI: PixelFormat -enum { CAP_PVAPI_PIXELFORMAT_MONO8 = 1, //!< Mono8 - CAP_PVAPI_PIXELFORMAT_MONO16 = 2, //!< Mono16 - CAP_PVAPI_PIXELFORMAT_BAYER8 = 3, //!< Bayer8 - CAP_PVAPI_PIXELFORMAT_BAYER16 = 4, //!< Bayer16 - CAP_PVAPI_PIXELFORMAT_RGB24 = 5, //!< Rgb24 - CAP_PVAPI_PIXELFORMAT_BGR24 = 6, //!< Bgr24 - CAP_PVAPI_PIXELFORMAT_RGBA32 = 7, //!< Rgba32 - CAP_PVAPI_PIXELFORMAT_BGRA32 = 8, //!< Bgra32 - }; - -//! @} PvAPI - -/** @name XIMEA Camera API - @{ -*/ - -//! Properties of cameras available through XIMEA SDK backend -enum { CAP_PROP_XI_DOWNSAMPLING = 400, //!< Change image resolution by binning or skipping. - CAP_PROP_XI_DATA_FORMAT = 401, //!< Output data format. - CAP_PROP_XI_OFFSET_X = 402, //!< Horizontal offset from the origin to the area of interest (in pixels). - CAP_PROP_XI_OFFSET_Y = 403, //!< Vertical offset from the origin to the area of interest (in pixels). - CAP_PROP_XI_TRG_SOURCE = 404, //!< Defines source of trigger. - CAP_PROP_XI_TRG_SOFTWARE = 405, //!< Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. - CAP_PROP_XI_GPI_SELECTOR = 406, //!< Selects general purpose input. - CAP_PROP_XI_GPI_MODE = 407, //!< Set general purpose input mode. - CAP_PROP_XI_GPI_LEVEL = 408, //!< Get general purpose level. - CAP_PROP_XI_GPO_SELECTOR = 409, //!< Selects general purpose output. - CAP_PROP_XI_GPO_MODE = 410, //!< Set general purpose output mode. - CAP_PROP_XI_LED_SELECTOR = 411, //!< Selects camera signalling LED. - CAP_PROP_XI_LED_MODE = 412, //!< Define camera signalling LED functionality. - CAP_PROP_XI_MANUAL_WB = 413, //!< Calculates White Balance(must be called during acquisition). - CAP_PROP_XI_AUTO_WB = 414, //!< Automatic white balance. - CAP_PROP_XI_AEAG = 415, //!< Automatic exposure/gain. - CAP_PROP_XI_EXP_PRIORITY = 416, //!< Exposure priority (0.5 - exposure 50%, gain 50%). - CAP_PROP_XI_AE_MAX_LIMIT = 417, //!< Maximum limit of exposure in AEAG procedure. - CAP_PROP_XI_AG_MAX_LIMIT = 418, //!< Maximum limit of gain in AEAG procedure. - CAP_PROP_XI_AEAG_LEVEL = 419, //!< Average intensity of output signal AEAG should achieve(in %). - CAP_PROP_XI_TIMEOUT = 420, //!< Image capture timeout in milliseconds. - CAP_PROP_XI_EXPOSURE = 421, //!< Exposure time in microseconds. - CAP_PROP_XI_EXPOSURE_BURST_COUNT = 422, //!< Sets the number of times of exposure in one frame. - CAP_PROP_XI_GAIN_SELECTOR = 423, //!< Gain selector for parameter Gain allows to select different type of gains. - CAP_PROP_XI_GAIN = 424, //!< Gain in dB. - CAP_PROP_XI_DOWNSAMPLING_TYPE = 426, //!< Change image downsampling type. - CAP_PROP_XI_BINNING_SELECTOR = 427, //!< Binning engine selector. - CAP_PROP_XI_BINNING_VERTICAL = 428, //!< Vertical Binning - number of vertical photo-sensitive cells to combine together. - CAP_PROP_XI_BINNING_HORIZONTAL = 429, //!< Horizontal Binning - number of horizontal photo-sensitive cells to combine together. - CAP_PROP_XI_BINNING_PATTERN = 430, //!< Binning pattern type. - CAP_PROP_XI_DECIMATION_SELECTOR = 431, //!< Decimation engine selector. - CAP_PROP_XI_DECIMATION_VERTICAL = 432, //!< Vertical Decimation - vertical sub-sampling of the image - reduces the vertical resolution of the image by the specified vertical decimation factor. - CAP_PROP_XI_DECIMATION_HORIZONTAL = 433, //!< Horizontal Decimation - horizontal sub-sampling of the image - reduces the horizontal resolution of the image by the specified vertical decimation factor. - CAP_PROP_XI_DECIMATION_PATTERN = 434, //!< Decimation pattern type. - CAP_PROP_XI_TEST_PATTERN_GENERATOR_SELECTOR = 587, //!< Selects which test pattern generator is controlled by the TestPattern feature. - CAP_PROP_XI_TEST_PATTERN = 588, //!< Selects which test pattern type is generated by the selected generator. - CAP_PROP_XI_IMAGE_DATA_FORMAT = 435, //!< Output data format. - CAP_PROP_XI_SHUTTER_TYPE = 436, //!< Change sensor shutter type(CMOS sensor). - CAP_PROP_XI_SENSOR_TAPS = 437, //!< Number of taps. - CAP_PROP_XI_AEAG_ROI_OFFSET_X = 439, //!< Automatic exposure/gain ROI offset X. - CAP_PROP_XI_AEAG_ROI_OFFSET_Y = 440, //!< Automatic exposure/gain ROI offset Y. - CAP_PROP_XI_AEAG_ROI_WIDTH = 441, //!< Automatic exposure/gain ROI Width. - CAP_PROP_XI_AEAG_ROI_HEIGHT = 442, //!< Automatic exposure/gain ROI Height. - CAP_PROP_XI_BPC = 445, //!< Correction of bad pixels. - CAP_PROP_XI_WB_KR = 448, //!< White balance red coefficient. - CAP_PROP_XI_WB_KG = 449, //!< White balance green coefficient. - CAP_PROP_XI_WB_KB = 450, //!< White balance blue coefficient. - CAP_PROP_XI_WIDTH = 451, //!< Width of the Image provided by the device (in pixels). - CAP_PROP_XI_HEIGHT = 452, //!< Height of the Image provided by the device (in pixels). - CAP_PROP_XI_REGION_SELECTOR = 589, //!< Selects Region in Multiple ROI which parameters are set by width, height, ... ,region mode. - CAP_PROP_XI_REGION_MODE = 595, //!< Activates/deactivates Region selected by Region Selector. - CAP_PROP_XI_LIMIT_BANDWIDTH = 459, //!< Set/get bandwidth(datarate)(in Megabits). - CAP_PROP_XI_SENSOR_DATA_BIT_DEPTH = 460, //!< Sensor output data bit depth. - CAP_PROP_XI_OUTPUT_DATA_BIT_DEPTH = 461, //!< Device output data bit depth. - CAP_PROP_XI_IMAGE_DATA_BIT_DEPTH = 462, //!< bitdepth of data returned by function xiGetImage. - CAP_PROP_XI_OUTPUT_DATA_PACKING = 463, //!< Device output data packing (or grouping) enabled. Packing could be enabled if output_data_bit_depth > 8 and packing capability is available. - CAP_PROP_XI_OUTPUT_DATA_PACKING_TYPE = 464, //!< Data packing type. Some cameras supports only specific packing type. - CAP_PROP_XI_IS_COOLED = 465, //!< Returns 1 for cameras that support cooling. - CAP_PROP_XI_COOLING = 466, //!< Start camera cooling. - CAP_PROP_XI_TARGET_TEMP = 467, //!< Set sensor target temperature for cooling. - CAP_PROP_XI_CHIP_TEMP = 468, //!< Camera sensor temperature. - CAP_PROP_XI_HOUS_TEMP = 469, //!< Camera housing temperature. - CAP_PROP_XI_HOUS_BACK_SIDE_TEMP = 590, //!< Camera housing back side temperature. - CAP_PROP_XI_SENSOR_BOARD_TEMP = 596, //!< Camera sensor board temperature. - CAP_PROP_XI_CMS = 470, //!< Mode of color management system. - CAP_PROP_XI_APPLY_CMS = 471, //!< Enable applying of CMS profiles to xiGetImage (see XI_PRM_INPUT_CMS_PROFILE, XI_PRM_OUTPUT_CMS_PROFILE). - CAP_PROP_XI_IMAGE_IS_COLOR = 474, //!< Returns 1 for color cameras. - CAP_PROP_XI_COLOR_FILTER_ARRAY = 475, //!< Returns color filter array type of RAW data. - CAP_PROP_XI_GAMMAY = 476, //!< Luminosity gamma. - CAP_PROP_XI_GAMMAC = 477, //!< Chromaticity gamma. - CAP_PROP_XI_SHARPNESS = 478, //!< Sharpness Strength. - CAP_PROP_XI_CC_MATRIX_00 = 479, //!< Color Correction Matrix element [0][0]. - CAP_PROP_XI_CC_MATRIX_01 = 480, //!< Color Correction Matrix element [0][1]. - CAP_PROP_XI_CC_MATRIX_02 = 481, //!< Color Correction Matrix element [0][2]. - CAP_PROP_XI_CC_MATRIX_03 = 482, //!< Color Correction Matrix element [0][3]. - CAP_PROP_XI_CC_MATRIX_10 = 483, //!< Color Correction Matrix element [1][0]. - CAP_PROP_XI_CC_MATRIX_11 = 484, //!< Color Correction Matrix element [1][1]. - CAP_PROP_XI_CC_MATRIX_12 = 485, //!< Color Correction Matrix element [1][2]. - CAP_PROP_XI_CC_MATRIX_13 = 486, //!< Color Correction Matrix element [1][3]. - CAP_PROP_XI_CC_MATRIX_20 = 487, //!< Color Correction Matrix element [2][0]. - CAP_PROP_XI_CC_MATRIX_21 = 488, //!< Color Correction Matrix element [2][1]. - CAP_PROP_XI_CC_MATRIX_22 = 489, //!< Color Correction Matrix element [2][2]. - CAP_PROP_XI_CC_MATRIX_23 = 490, //!< Color Correction Matrix element [2][3]. - CAP_PROP_XI_CC_MATRIX_30 = 491, //!< Color Correction Matrix element [3][0]. - CAP_PROP_XI_CC_MATRIX_31 = 492, //!< Color Correction Matrix element [3][1]. - CAP_PROP_XI_CC_MATRIX_32 = 493, //!< Color Correction Matrix element [3][2]. - CAP_PROP_XI_CC_MATRIX_33 = 494, //!< Color Correction Matrix element [3][3]. - CAP_PROP_XI_DEFAULT_CC_MATRIX = 495, //!< Set default Color Correction Matrix. - CAP_PROP_XI_TRG_SELECTOR = 498, //!< Selects the type of trigger. - CAP_PROP_XI_ACQ_FRAME_BURST_COUNT = 499, //!< Sets number of frames acquired by burst. This burst is used only if trigger is set to FrameBurstStart. - CAP_PROP_XI_DEBOUNCE_EN = 507, //!< Enable/Disable debounce to selected GPI. - CAP_PROP_XI_DEBOUNCE_T0 = 508, //!< Debounce time (x * 10us). - CAP_PROP_XI_DEBOUNCE_T1 = 509, //!< Debounce time (x * 10us). - CAP_PROP_XI_DEBOUNCE_POL = 510, //!< Debounce polarity (pol = 1 t0 - falling edge, t1 - rising edge). - CAP_PROP_XI_LENS_MODE = 511, //!< Status of lens control interface. This shall be set to XI_ON before any Lens operations. - CAP_PROP_XI_LENS_APERTURE_VALUE = 512, //!< Current lens aperture value in stops. Examples: 2.8, 4, 5.6, 8, 11. - CAP_PROP_XI_LENS_FOCUS_MOVEMENT_VALUE = 513, //!< Lens current focus movement value to be used by XI_PRM_LENS_FOCUS_MOVE in motor steps. - CAP_PROP_XI_LENS_FOCUS_MOVE = 514, //!< Moves lens focus motor by steps set in XI_PRM_LENS_FOCUS_MOVEMENT_VALUE. - CAP_PROP_XI_LENS_FOCUS_DISTANCE = 515, //!< Lens focus distance in cm. - CAP_PROP_XI_LENS_FOCAL_LENGTH = 516, //!< Lens focal distance in mm. - CAP_PROP_XI_LENS_FEATURE_SELECTOR = 517, //!< Selects the current feature which is accessible by XI_PRM_LENS_FEATURE. - CAP_PROP_XI_LENS_FEATURE = 518, //!< Allows access to lens feature value currently selected by XI_PRM_LENS_FEATURE_SELECTOR. - CAP_PROP_XI_DEVICE_MODEL_ID = 521, //!< Returns device model id. - CAP_PROP_XI_DEVICE_SN = 522, //!< Returns device serial number. - CAP_PROP_XI_IMAGE_DATA_FORMAT_RGB32_ALPHA = 529, //!< The alpha channel of RGB32 output image format. - CAP_PROP_XI_IMAGE_PAYLOAD_SIZE = 530, //!< Buffer size in bytes sufficient for output image returned by xiGetImage. - CAP_PROP_XI_TRANSPORT_PIXEL_FORMAT = 531, //!< Current format of pixels on transport layer. - CAP_PROP_XI_SENSOR_CLOCK_FREQ_HZ = 532, //!< Sensor clock frequency in Hz. - CAP_PROP_XI_SENSOR_CLOCK_FREQ_INDEX = 533, //!< Sensor clock frequency index. Sensor with selected frequencies have possibility to set the frequency only by this index. - CAP_PROP_XI_SENSOR_OUTPUT_CHANNEL_COUNT = 534, //!< Number of output channels from sensor used for data transfer. - CAP_PROP_XI_FRAMERATE = 535, //!< Define framerate in Hz. - CAP_PROP_XI_COUNTER_SELECTOR = 536, //!< Select counter. - CAP_PROP_XI_COUNTER_VALUE = 537, //!< Counter status. - CAP_PROP_XI_ACQ_TIMING_MODE = 538, //!< Type of sensor frames timing. - CAP_PROP_XI_AVAILABLE_BANDWIDTH = 539, //!< Calculate and returns available interface bandwidth(int Megabits). - CAP_PROP_XI_BUFFER_POLICY = 540, //!< Data move policy. - CAP_PROP_XI_LUT_EN = 541, //!< Activates LUT. - CAP_PROP_XI_LUT_INDEX = 542, //!< Control the index (offset) of the coefficient to access in the LUT. - CAP_PROP_XI_LUT_VALUE = 543, //!< Value at entry LUTIndex of the LUT. - CAP_PROP_XI_TRG_DELAY = 544, //!< Specifies the delay in microseconds (us) to apply after the trigger reception before activating it. - CAP_PROP_XI_TS_RST_MODE = 545, //!< Defines how time stamp reset engine will be armed. - CAP_PROP_XI_TS_RST_SOURCE = 546, //!< Defines which source will be used for timestamp reset. Writing this parameter will trigger settings of engine (arming). - CAP_PROP_XI_IS_DEVICE_EXIST = 547, //!< Returns 1 if camera connected and works properly. - CAP_PROP_XI_ACQ_BUFFER_SIZE = 548, //!< Acquisition buffer size in buffer_size_unit. Default bytes. - CAP_PROP_XI_ACQ_BUFFER_SIZE_UNIT = 549, //!< Acquisition buffer size unit in bytes. Default 1. E.g. Value 1024 means that buffer_size is in KiBytes. - CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_SIZE = 550, //!< Acquisition transport buffer size in bytes. - CAP_PROP_XI_BUFFERS_QUEUE_SIZE = 551, //!< Queue of field/frame buffers. - CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_COMMIT = 552, //!< Number of buffers to commit to low level. - CAP_PROP_XI_RECENT_FRAME = 553, //!< GetImage returns most recent frame. - CAP_PROP_XI_DEVICE_RESET = 554, //!< Resets the camera to default state. - CAP_PROP_XI_COLUMN_FPN_CORRECTION = 555, //!< Correction of column FPN. - CAP_PROP_XI_ROW_FPN_CORRECTION = 591, //!< Correction of row FPN. - CAP_PROP_XI_SENSOR_MODE = 558, //!< Current sensor mode. Allows to select sensor mode by one integer. Setting of this parameter affects: image dimensions and downsampling. - CAP_PROP_XI_HDR = 559, //!< Enable High Dynamic Range feature. - CAP_PROP_XI_HDR_KNEEPOINT_COUNT = 560, //!< The number of kneepoints in the PWLR. - CAP_PROP_XI_HDR_T1 = 561, //!< Position of first kneepoint(in % of XI_PRM_EXPOSURE). - CAP_PROP_XI_HDR_T2 = 562, //!< Position of second kneepoint (in % of XI_PRM_EXPOSURE). - CAP_PROP_XI_KNEEPOINT1 = 563, //!< Value of first kneepoint (% of sensor saturation). - CAP_PROP_XI_KNEEPOINT2 = 564, //!< Value of second kneepoint (% of sensor saturation). - CAP_PROP_XI_IMAGE_BLACK_LEVEL = 565, //!< Last image black level counts. Can be used for Offline processing to recall it. - CAP_PROP_XI_HW_REVISION = 571, //!< Returns hardware revision number. - CAP_PROP_XI_DEBUG_LEVEL = 572, //!< Set debug level. - CAP_PROP_XI_AUTO_BANDWIDTH_CALCULATION = 573, //!< Automatic bandwidth calculation. - CAP_PROP_XI_FFS_FILE_ID = 594, //!< File number. - CAP_PROP_XI_FFS_FILE_SIZE = 580, //!< Size of file. - CAP_PROP_XI_FREE_FFS_SIZE = 581, //!< Size of free camera FFS. - CAP_PROP_XI_USED_FFS_SIZE = 582, //!< Size of used camera FFS. - CAP_PROP_XI_FFS_ACCESS_KEY = 583, //!< Setting of key enables file operations on some cameras. - CAP_PROP_XI_SENSOR_FEATURE_SELECTOR = 585, //!< Selects the current feature which is accessible by XI_PRM_SENSOR_FEATURE_VALUE. - CAP_PROP_XI_SENSOR_FEATURE_VALUE = 586, //!< Allows access to sensor feature value currently selected by XI_PRM_SENSOR_FEATURE_SELECTOR. - }; - -//! @} XIMEA - -/** @name AVFoundation framework for iOS - OS X Lion will have the same API - @{ -*/ - -//! Properties of cameras available through AVFOUNDATION backend -enum { CAP_PROP_IOS_DEVICE_FOCUS = 9001, - CAP_PROP_IOS_DEVICE_EXPOSURE = 9002, - CAP_PROP_IOS_DEVICE_FLASH = 9003, - CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004, - CAP_PROP_IOS_DEVICE_TORCH = 9005 - }; - -/** @name Smartek Giganetix GigEVisionSDK - @{ -*/ - -//! Properties of cameras available through Smartek Giganetix Ethernet Vision backend -/* --- Vladimir Litvinenko (litvinenko.vladimir@gmail.com) --- */ -enum { CAP_PROP_GIGA_FRAME_OFFSET_X = 10001, - CAP_PROP_GIGA_FRAME_OFFSET_Y = 10002, - CAP_PROP_GIGA_FRAME_WIDTH_MAX = 10003, - CAP_PROP_GIGA_FRAME_HEIGH_MAX = 10004, - CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005, - CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006 - }; - -//! @} Smartek - -/** @name Intel Perceptual Computing SDK - @{ -*/ -enum { CAP_PROP_INTELPERC_PROFILE_COUNT = 11001, - CAP_PROP_INTELPERC_PROFILE_IDX = 11002, - CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE = 11003, - CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE = 11004, - CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD = 11005, - CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ = 11006, - CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT = 11007 - }; - -//! Intel Perceptual Streams -enum { CAP_INTELPERC_DEPTH_GENERATOR = 1 << 29, - CAP_INTELPERC_IMAGE_GENERATOR = 1 << 28, - CAP_INTELPERC_GENERATORS_MASK = CAP_INTELPERC_DEPTH_GENERATOR + CAP_INTELPERC_IMAGE_GENERATOR - }; - -enum { CAP_INTELPERC_DEPTH_MAP = 0, //!< Each pixel is a 16-bit integer. The value indicates the distance from an object to the camera's XY plane or the Cartesian depth. - CAP_INTELPERC_UVDEPTH_MAP = 1, //!< Each pixel contains two 32-bit floating point values in the range of 0-1, representing the mapping of depth coordinates to the color coordinates. - CAP_INTELPERC_IR_MAP = 2, //!< Each pixel is a 16-bit integer. The value indicates the intensity of the reflected laser beam. - CAP_INTELPERC_IMAGE = 3 - }; - -//! @} Intel Perceptual - -/** @name gPhoto2 connection - @{ -*/ - -/** @brief gPhoto2 properties - -If `propertyId` is less than 0 then work on widget with that __additive inversed__ camera setting ID -Get IDs by using CAP_PROP_GPHOTO2_WIDGET_ENUMERATE. -@see CvCaptureCAM_GPHOTO2 for more info -*/ -enum { CAP_PROP_GPHOTO2_PREVIEW = 17001, //!< Capture only preview from liveview mode. - CAP_PROP_GPHOTO2_WIDGET_ENUMERATE = 17002, //!< Readonly, returns (const char *). - CAP_PROP_GPHOTO2_RELOAD_CONFIG = 17003, //!< Trigger, only by set. Reload camera settings. - CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE = 17004, //!< Reload all settings on set. - CAP_PROP_GPHOTO2_COLLECT_MSGS = 17005, //!< Collect messages with details. - CAP_PROP_GPHOTO2_FLUSH_MSGS = 17006, //!< Readonly, returns (const char *). - CAP_PROP_SPEED = 17007, //!< Exposure speed. Can be readonly, depends on camera program. - CAP_PROP_APERTURE = 17008, //!< Aperture. Can be readonly, depends on camera program. - CAP_PROP_EXPOSUREPROGRAM = 17009, //!< Camera exposure program. - CAP_PROP_VIEWFINDER = 17010 //!< Enter liveview mode. - }; - -//! @} gPhoto2 - - -/** @name Images backend - @{ -*/ - -/** @brief Images backend properties - -*/ -enum { CAP_PROP_IMAGES_BASE = 18000, - CAP_PROP_IMAGES_LAST = 19000 // excluding - }; - -//! @} Images - -//! @} videoio_flags_others - - -class IVideoCapture; - -/** @brief Class for video capturing from video files, image sequences or cameras. - -The class provides C++ API for capturing video from cameras or for reading video files and image sequences. - -Here is how the class can be used: -@include samples/cpp/videocapture_basic.cpp - -@note In @ref videoio_c "C API" the black-box structure `CvCapture` is used instead of %VideoCapture. -@note -- (C++) A basic sample on using the %VideoCapture interface can be found at - `OPENCV_SOURCE_CODE/samples/cpp/videocapture_starter.cpp` -- (Python) A basic sample on using the %VideoCapture interface can be found at - `OPENCV_SOURCE_CODE/samples/python/video.py` -- (Python) A multi threaded video processing sample can be found at - `OPENCV_SOURCE_CODE/samples/python/video_threaded.py` -- (Python) %VideoCapture sample showcasing some features of the Video4Linux2 backend - `OPENCV_SOURCE_CODE/samples/python/video_v4l2.py` - */ -class CV_EXPORTS_W VideoCapture -{ -public: - /** @brief Default constructor - @note In @ref videoio_c "C API", when you finished working with video, release CvCapture structure with - cvReleaseCapture(), or use Ptr\ that calls cvReleaseCapture() automatically in the - destructor. - */ - CV_WRAP VideoCapture(); - - /** @overload - @brief Open video file or a capturing device or a IP video stream for video capturing - - Same as VideoCapture(const String& filename, int apiPreference) but using default Capture API backends - */ - CV_WRAP VideoCapture(const String& filename); - - /** @overload - @brief Open video file or a capturing device or a IP video stream for video capturing with API Preference - - @param filename it can be: - - name of video file (eg. `video.avi`) - - or image sequence (eg. `img_%02d.jpg`, which will read samples like `img_00.jpg, img_01.jpg, img_02.jpg, ...`) - - or URL of video stream (eg. `protocol://host:port/script_name?script_params|auth`). - Note that each video stream or IP camera feed has its own URL scheme. Please refer to the - documentation of source stream to know the right URL. - @param apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader - implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW. - @sa The list of supported API backends cv::VideoCaptureAPIs - */ - CV_WRAP VideoCapture(const String& filename, int apiPreference); - - /** @overload - @brief Open a camera for video capturing - - @param index camera_id + domain_offset (CAP_*) id of the video capturing device to open. To open default camera using default backend just pass 0. - Use a `domain_offset` to enforce a specific reader implementation if multiple are available like cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW. - e.g. to open Camera 1 using the MS Media Foundation API use `index = 1 + cv::CAP_MSMF` - - @sa The list of supported API backends cv::VideoCaptureAPIs - */ - CV_WRAP VideoCapture(int index); - - /** @overload - @brief Opens a camera for video capturing - - @param index id of the video capturing device to open. To open default camera using default backend just pass 0. - (to backward compatibility usage of camera_id + domain_offset (CAP_*) is valid when apiPreference is CAP_ANY) - @param apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader - implementation if multiple are available: e.g. cv::CAP_DSHOW or cv::CAP_MSMF or cv::CAP_V4L2. - - @sa The list of supported API backends cv::VideoCaptureAPIs - */ - CV_WRAP VideoCapture(int index, int apiPreference); - - /** @brief Default destructor - - The method first calls VideoCapture::release to close the already opened file or camera. - */ - virtual ~VideoCapture(); - - /** @brief Open video file or a capturing device or a IP video stream for video capturing - - @overload - - Parameters are same as the constructor VideoCapture(const String& filename) - @return `true` if the file has been successfully opened - - The method first calls VideoCapture::release to close the already opened file or camera. - */ - CV_WRAP virtual bool open(const String& filename); - - /** @brief Open a camera for video capturing - - @overload - - Parameters are same as the constructor VideoCapture(int index) - @return `true` if the camera has been successfully opened. - - The method first calls VideoCapture::release to close the already opened file or camera. - */ - CV_WRAP virtual bool open(int index); - - /** @brief Open a camera for video capturing - - @overload - - Parameters are similar as the constructor VideoCapture(int index),except it takes an additional argument apiPreference. - Definitely, is same as open(int index) where `index=cameraNum + apiPreference` - @return `true` if the camera has been successfully opened. - */ - CV_WRAP bool open(int cameraNum, int apiPreference); - - /** @brief Returns true if video capturing has been initialized already. - - If the previous call to VideoCapture constructor or VideoCapture::open() succeeded, the method returns - true. - */ - CV_WRAP virtual bool isOpened() const; - - /** @brief Closes video file or capturing device. - - The method is automatically called by subsequent VideoCapture::open and by VideoCapture - destructor. - - The C function also deallocates memory and clears \*capture pointer. - */ - CV_WRAP virtual void release(); - - /** @brief Grabs the next frame from video file or capturing device. - - @return `true` (non-zero) in the case of success. - - The method/function grabs the next frame from video file or camera and returns true (non-zero) in - the case of success. - - The primary use of the function is in multi-camera environments, especially when the cameras do not - have hardware synchronization. That is, you call VideoCapture::grab() for each camera and after that - call the slower method VideoCapture::retrieve() to decode and get frame from each camera. This way - the overhead on demosaicing or motion jpeg decompression etc. is eliminated and the retrieved frames - from different cameras will be closer in time. - - Also, when a connected camera is multi-head (for example, a stereo camera or a Kinect device), the - correct way of retrieving data from it is to call VideoCapture::grab() first and then call - VideoCapture::retrieve() one or more times with different values of the channel parameter. - - @ref tutorial_kinect_openni - */ - CV_WRAP virtual bool grab(); - - /** @brief Decodes and returns the grabbed video frame. - - @param [out] image the video frame is returned here. If no frames has been grabbed the image will be empty. - @param flag it could be a frame index or a driver specific flag - @return `false` if no frames has been grabbed - - The method decodes and returns the just grabbed frame. If no frames has been grabbed - (camera has been disconnected, or there are no more frames in video file), the method returns false - and the function returns an empty image (with %cv::Mat, test it with Mat::empty()). - - @sa read() - - @note In @ref videoio_c "C API", functions cvRetrieveFrame() and cv.RetrieveFrame() return image stored inside the video - capturing structure. It is not allowed to modify or release the image! You can copy the frame using - cvCloneImage and then do whatever you want with the copy. - */ - CV_WRAP virtual bool retrieve(OutputArray image, int flag = 0); - - /** @brief Stream operator to read the next video frame. - @sa read() - */ - virtual VideoCapture& operator >> (CV_OUT Mat& image); - - /** @overload - @sa read() - */ - virtual VideoCapture& operator >> (CV_OUT UMat& image); - - /** @brief Grabs, decodes and returns the next video frame. - - @param [out] image the video frame is returned here. If no frames has been grabbed the image will be empty. - @return `false` if no frames has been grabbed - - The method/function combines VideoCapture::grab() and VideoCapture::retrieve() in one call. This is the - most convenient method for reading video files or capturing data from decode and returns the just - grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more - frames in video file), the method returns false and the function returns empty image (with %cv::Mat, test it with Mat::empty()). - - @note In @ref videoio_c "C API", functions cvRetrieveFrame() and cv.RetrieveFrame() return image stored inside the video - capturing structure. It is not allowed to modify or release the image! You can copy the frame using - cvCloneImage and then do whatever you want with the copy. - */ - CV_WRAP virtual bool read(OutputArray image); - - /** @brief Sets a property in the VideoCapture. - - @param propId Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...) - or one from @ref videoio_flags_others - @param value Value of the property. - @return `true` if the property is supported by backend used by the VideoCapture instance. - @note Even if it returns `true` this doesn't ensure that the property - value has been accepted by the capture device. See note in VideoCapture::get() - */ - CV_WRAP virtual bool set(int propId, double value); - - /** @brief Returns the specified VideoCapture property - - @param propId Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...) - or one from @ref videoio_flags_others - @return Value for the specified property. Value 0 is returned when querying a property that is - not supported by the backend used by the VideoCapture instance. - - @note Reading / writing properties involves many layers. Some unexpected result might happens - along this chain. - @code {.txt} - `VideoCapture -> API Backend -> Operating System -> Device Driver -> Device Hardware` - @endcode - The returned value might be different from what really used by the device or it could be encoded - using device dependent rules (eg. steps or percentage). Effective behaviour depends from device - driver and API Backend - - */ - CV_WRAP virtual double get(int propId) const; - - /** @brief Open video file or a capturing device or a IP video stream for video capturing with API Preference - - @overload - - Parameters are same as the constructor VideoCapture(const String& filename, int apiPreference) - @return `true` if the file has been successfully opened - - The method first calls VideoCapture::release to close the already opened file or camera. - */ - CV_WRAP virtual bool open(const String& filename, int apiPreference); - - /** @brief Returns used backend API name - - @note Stream should be opened. - */ - CV_WRAP String getBackendName() const; - -protected: - Ptr cap; - Ptr icap; -}; - -class IVideoWriter; - -/** @example samples/cpp/tutorial_code/videoio/video-write/video-write.cpp -Check @ref tutorial_video_write "the corresponding tutorial" for more details -*/ - -/** @example samples/cpp/videowriter_basic.cpp -An example using VideoCapture and VideoWriter class -*/ - -/** @brief Video writer class. - -The class provides C++ API for writing video files or image sequences. -*/ -class CV_EXPORTS_W VideoWriter -{ -public: - /** @brief Default constructors - - The constructors/functions initialize video writers. - - On Linux FFMPEG is used to write videos; - - On Windows FFMPEG or VFW is used; - - On MacOSX QTKit is used. - */ - CV_WRAP VideoWriter(); - - /** @overload - @param filename Name of the output video file. - @param fourcc 4-character code of codec used to compress the frames. For example, - VideoWriter::fourcc('P','I','M','1') is a MPEG-1 codec, VideoWriter::fourcc('M','J','P','G') is a - motion-jpeg codec etc. List of codes can be obtained at [Video Codecs by - FOURCC](http://www.fourcc.org/codecs.php) page. FFMPEG backend with MP4 container natively uses - other values as fourcc code: see [ObjectType](http://www.mp4ra.org/codecs.html), - so you may receive a warning message from OpenCV about fourcc code conversion. - @param fps Framerate of the created video stream. - @param frameSize Size of the video frames. - @param isColor If it is not zero, the encoder will expect and encode color frames, otherwise it - will work with grayscale frames (the flag is currently supported on Windows only). - - @b Tips: - - With some backends `fourcc=-1` pops up the codec selection dialog from the system. - - To save image sequence use a proper filename (eg. `img_%02d.jpg`) and `fourcc=0` - OR `fps=0`. Use uncompressed image format (eg. `img_%02d.BMP`) to save raw frames. - - Most codecs are lossy. If you want lossless video file you need to use a lossless codecs - (eg. FFMPEG FFV1, Huffman HFYU, Lagarith LAGS, etc...) - - If FFMPEG is enabled, using `codec=0; fps=0;` you can create an uncompressed (raw) video file. - */ - CV_WRAP VideoWriter(const String& filename, int fourcc, double fps, - Size frameSize, bool isColor = true); - - /** @overload - The `apiPreference` parameter allows to specify API backends to use. Can be used to enforce a specific reader implementation - if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_GSTREAMER. - */ - CV_WRAP VideoWriter(const String& filename, int apiPreference, int fourcc, double fps, - Size frameSize, bool isColor = true); - - /** @brief Default destructor - - The method first calls VideoWriter::release to close the already opened file. - */ - virtual ~VideoWriter(); - - /** @brief Initializes or reinitializes video writer. - - The method opens video writer. Parameters are the same as in the constructor - VideoWriter::VideoWriter. - @return `true` if video writer has been successfully initialized - - The method first calls VideoWriter::release to close the already opened file. - */ - CV_WRAP virtual bool open(const String& filename, int fourcc, double fps, - Size frameSize, bool isColor = true); - - /** @overload - */ - CV_WRAP bool open(const String& filename, int apiPreference, int fourcc, double fps, - Size frameSize, bool isColor = true); - - /** @brief Returns true if video writer has been successfully initialized. - */ - CV_WRAP virtual bool isOpened() const; - - /** @brief Closes the video writer. - - The method is automatically called by subsequent VideoWriter::open and by the VideoWriter - destructor. - */ - CV_WRAP virtual void release(); - - /** @brief Stream operator to write the next video frame. - @sa write - */ - virtual VideoWriter& operator << (const Mat& image); - - /** @brief Writes the next video frame - - @param image The written frame. In general, color images are expected in BGR format. - - The function/method writes the specified image to video file. It must have the same size as has - been specified when opening the video writer. - */ - CV_WRAP virtual void write(const Mat& image); - - /** @brief Sets a property in the VideoWriter. - - @param propId Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY) - or one of @ref videoio_flags_others - - @param value Value of the property. - @return `true` if the property is supported by the backend used by the VideoWriter instance. - */ - CV_WRAP virtual bool set(int propId, double value); - - /** @brief Returns the specified VideoWriter property - - @param propId Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY) - or one of @ref videoio_flags_others - - @return Value for the specified property. Value 0 is returned when querying a property that is - not supported by the backend used by the VideoWriter instance. - */ - CV_WRAP virtual double get(int propId) const; - - /** @brief Concatenates 4 chars to a fourcc code - - @return a fourcc code - - This static method constructs the fourcc code of the codec to be used in the constructor - VideoWriter::VideoWriter or VideoWriter::open. - */ - CV_WRAP static int fourcc(char c1, char c2, char c3, char c4); - - /** @brief Returns used backend API name - - @note Stream should be opened. - */ - CV_WRAP String getBackendName() const; - -protected: - Ptr writer; - Ptr iwriter; - - static Ptr create(const String& filename, int fourcc, double fps, - Size frameSize, bool isColor = true); -}; - -template<> CV_EXPORTS void DefaultDeleter::operator ()(CvCapture* obj) const; -template<> CV_EXPORTS void DefaultDeleter::operator ()(CvVideoWriter* obj) const; - -//! @} videoio - -} // cv - -#endif //OPENCV_VIDEOIO_HPP diff --git a/opencv/include/opencv2/videoio/cap_ios.h b/opencv/include/opencv2/videoio/cap_ios.h deleted file mode 100644 index 207ad46..0000000 --- a/opencv/include/opencv2/videoio/cap_ios.h +++ /dev/null @@ -1,150 +0,0 @@ -/* For iOS video I/O - * by Eduard Feicho on 29/07/12 - * Copyright 2012. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#import -#import -#import -#import -#include "opencv2/core.hpp" - -//! @addtogroup videoio_ios -//! @{ - -/////////////////////////////////////// CvAbstractCamera ///////////////////////////////////// - -@class CvAbstractCamera; - -CV_EXPORTS @interface CvAbstractCamera : NSObject -{ - UIDeviceOrientation currentDeviceOrientation; - - BOOL cameraAvailable; -} - -@property (nonatomic, strong) AVCaptureSession* captureSession; -@property (nonatomic, strong) AVCaptureConnection* videoCaptureConnection; - -@property (nonatomic, readonly) BOOL running; -@property (nonatomic, readonly) BOOL captureSessionLoaded; - -@property (nonatomic, assign) int defaultFPS; -@property (nonatomic, readonly) AVCaptureVideoPreviewLayer *captureVideoPreviewLayer; -@property (nonatomic, assign) AVCaptureDevicePosition defaultAVCaptureDevicePosition; -@property (nonatomic, assign) AVCaptureVideoOrientation defaultAVCaptureVideoOrientation; -@property (nonatomic, assign) BOOL useAVCaptureVideoPreviewLayer; -@property (nonatomic, strong) NSString *const defaultAVCaptureSessionPreset; - -@property (nonatomic, assign) int imageWidth; -@property (nonatomic, assign) int imageHeight; - -@property (nonatomic, strong) UIView* parentView; - -- CV_UNUSED(start); -- CV_UNUSED(stop); -- CV_UNUSED(switchCameras); - -- (id)initWithParentView:(UIView*)parent; - -- CV_UNUSED(createCaptureOutput); -- CV_UNUSED(createVideoPreviewLayer); -- CV_UNUSED(updateOrientation); - -- CV_UNUSED(lockFocus); -- CV_UNUSED(unlockFocus); -- CV_UNUSED(lockExposure); -- CV_UNUSED(unlockExposure); -- CV_UNUSED(lockBalance); -- CV_UNUSED(unlockBalance); - -@end - -///////////////////////////////// CvVideoCamera /////////////////////////////////////////// - -@class CvVideoCamera; - -CV_EXPORTS @protocol CvVideoCameraDelegate - -#ifdef __cplusplus -// delegate method for processing image frames -- (void)processImage:(cv::Mat&)image; -#endif - -@end - -CV_EXPORTS @interface CvVideoCamera : CvAbstractCamera -{ - AVCaptureVideoDataOutput *videoDataOutput; - - dispatch_queue_t videoDataOutputQueue; - CALayer *customPreviewLayer; - - CMTime lastSampleTime; - -} - -@property (nonatomic, weak) id delegate; -@property (nonatomic, assign) BOOL grayscaleMode; - -@property (nonatomic, assign) BOOL recordVideo; -@property (nonatomic, assign) BOOL rotateVideo; -@property (nonatomic, strong) AVAssetWriterInput* recordAssetWriterInput; -@property (nonatomic, strong) AVAssetWriterInputPixelBufferAdaptor* recordPixelBufferAdaptor; -@property (nonatomic, strong) AVAssetWriter* recordAssetWriter; - -- (void)adjustLayoutToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; -- CV_UNUSED(layoutPreviewLayer); -- CV_UNUSED(saveVideo); -- (NSURL *)videoFileURL; -- (NSString *)videoFileString; - - -@end - -///////////////////////////////// CvPhotoCamera /////////////////////////////////////////// - -@class CvPhotoCamera; - -CV_EXPORTS @protocol CvPhotoCameraDelegate - -- (void)photoCamera:(CvPhotoCamera*)photoCamera capturedImage:(UIImage *)image; -- (void)photoCameraCancel:(CvPhotoCamera*)photoCamera; - -@end - -CV_EXPORTS @interface CvPhotoCamera : CvAbstractCamera -{ - AVCaptureStillImageOutput *stillImageOutput; -} - -@property (nonatomic, weak) id delegate; - -- CV_UNUSED(takePicture); - -@end - -//! @} videoio_ios diff --git a/opencv/include/opencv2/videoio/registry.hpp b/opencv/include/opencv2/videoio/registry.hpp deleted file mode 100644 index 7404c68..0000000 --- a/opencv/include/opencv2/videoio/registry.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// This file is part of OpenCV project. -// It is subject to the license terms in the LICENSE file found in the top-level directory -// of this distribution and at http://opencv.org/license.html. - -#ifndef OPENCV_VIDEOIO_REGISTRY_HPP -#define OPENCV_VIDEOIO_REGISTRY_HPP - -#include - -namespace cv { namespace videoio_registry { -/** @addtogroup videoio_registry -This section contains API description how to query/configure available Video I/O backends. - -Runtime configuration options: -- enable debug mode: `OPENCV_VIDEOIO_DEBUG=1` -- change backend priority: `OPENCV_VIDEOIO_PRIORITY_=9999` -- disable backend: `OPENCV_VIDEOIO_PRIORITY_=0` -- specify list of backends with high priority (>100000): `OPENCV_VIDEOIO_PRIORITY_LIST=FFMPEG,GSTREAMER` - -@{ - */ - - -/** @brief Returns backend API name or "unknown" -@param api backend ID (#VideoCaptureAPIs) -*/ -CV_EXPORTS_W cv::String getBackendName(VideoCaptureAPIs api); - -/** @brief Returns list of all builtin backends */ -CV_EXPORTS_W std::vector getBackends(); - -/** @brief Returns list of available backends which works via `cv::VideoCapture(int index)` */ -CV_EXPORTS_W std::vector getCameraBackends(); - -/** @brief Returns list of available backends which works via `cv::VideoCapture(filename)` */ -CV_EXPORTS_W std::vector getStreamBackends(); - -/** @brief Returns list of available backends which works via `cv::VideoWriter()` */ -CV_EXPORTS_W std::vector getWriterBackends(); - -//! @} -}} // namespace - -#endif // OPENCV_VIDEOIO_REGISTRY_HPP diff --git a/opencv/include/opencv2/videoio/videoio.hpp b/opencv/include/opencv2/videoio/videoio.hpp deleted file mode 100644 index ec84cf7..0000000 --- a/opencv/include/opencv2/videoio/videoio.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Copyright (C) 2013, OpenCV Foundation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifdef __OPENCV_BUILD -#error this is a compatibility header which should not be used inside the OpenCV library -#endif - -#include "opencv2/videoio.hpp" diff --git a/opencv/include/opencv2/videoio/videoio_c.h b/opencv/include/opencv2/videoio/videoio_c.h deleted file mode 100644 index 32f6ec7..0000000 --- a/opencv/include/opencv2/videoio/videoio_c.h +++ /dev/null @@ -1,587 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// Intel License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000, Intel Corporation, all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of Intel Corporation may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOIO_H -#define OPENCV_VIDEOIO_H - -#include "opencv2/core/core_c.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - @addtogroup videoio_c - @{ -*/ - -/****************************************************************************************\ -* Working with Video Files and Cameras * -\****************************************************************************************/ - -/** @brief "black box" capture structure - -In C++ use cv::VideoCapture -*/ -typedef struct CvCapture CvCapture; - -/** @brief start capturing frames from video file -*/ -CVAPI(CvCapture*) cvCreateFileCapture( const char* filename ); - -/** @brief start capturing frames from video file. allows specifying a preferred API to use -*/ -CVAPI(CvCapture*) cvCreateFileCaptureWithPreference( const char* filename , int apiPreference); - -enum -{ - CV_CAP_ANY =0, // autodetect - - CV_CAP_MIL =100, // MIL proprietary drivers - - CV_CAP_VFW =200, // platform native - CV_CAP_V4L =200, - CV_CAP_V4L2 =200, - - CV_CAP_FIREWARE =300, // IEEE 1394 drivers - CV_CAP_FIREWIRE =300, - CV_CAP_IEEE1394 =300, - CV_CAP_DC1394 =300, - CV_CAP_CMU1394 =300, - - CV_CAP_STEREO =400, // TYZX proprietary drivers - CV_CAP_TYZX =400, - CV_TYZX_LEFT =400, - CV_TYZX_RIGHT =401, - CV_TYZX_COLOR =402, - CV_TYZX_Z =403, - - CV_CAP_QT =500, // QuickTime - - CV_CAP_UNICAP =600, // Unicap drivers - - CV_CAP_DSHOW =700, // DirectShow (via videoInput) - CV_CAP_MSMF =1400, // Microsoft Media Foundation (via videoInput) - - CV_CAP_PVAPI =800, // PvAPI, Prosilica GigE SDK - - CV_CAP_OPENNI =900, // OpenNI (for Kinect) - CV_CAP_OPENNI_ASUS =910, // OpenNI (for Asus Xtion) - - CV_CAP_ANDROID =1000, // Android - not used - CV_CAP_ANDROID_BACK =CV_CAP_ANDROID+99, // Android back camera - not used - CV_CAP_ANDROID_FRONT =CV_CAP_ANDROID+98, // Android front camera - not used - - CV_CAP_XIAPI =1100, // XIMEA Camera API - - CV_CAP_AVFOUNDATION = 1200, // AVFoundation framework for iOS (OS X Lion will have the same API) - - CV_CAP_GIGANETIX = 1300, // Smartek Giganetix GigEVisionSDK - - CV_CAP_INTELPERC = 1500, // Intel Perceptual Computing - - CV_CAP_OPENNI2 = 1600, // OpenNI2 (for Kinect) - CV_CAP_GPHOTO2 = 1700, - CV_CAP_GSTREAMER = 1800, // GStreamer - CV_CAP_FFMPEG = 1900, // FFMPEG - CV_CAP_IMAGES = 2000, // OpenCV Image Sequence (e.g. img_%02d.jpg) - - CV_CAP_ARAVIS = 2100 // Aravis GigE SDK -}; - -/** @brief start capturing frames from camera: index = camera_index + domain_offset (CV_CAP_*) -*/ -CVAPI(CvCapture*) cvCreateCameraCapture( int index ); - -/** @brief grab a frame, return 1 on success, 0 on fail. - - this function is thought to be fast -*/ -CVAPI(int) cvGrabFrame( CvCapture* capture ); - -/** @brief get the frame grabbed with cvGrabFrame(..) - - This function may apply some frame processing like - frame decompression, flipping etc. - @warning !!!DO NOT RELEASE or MODIFY the retrieved frame!!! -*/ -CVAPI(IplImage*) cvRetrieveFrame( CvCapture* capture, int streamIdx CV_DEFAULT(0) ); - -/** @brief Just a combination of cvGrabFrame and cvRetrieveFrame - - @warning !!!DO NOT RELEASE or MODIFY the retrieved frame!!! -*/ -CVAPI(IplImage*) cvQueryFrame( CvCapture* capture ); - -/** @brief stop capturing/reading and free resources -*/ -CVAPI(void) cvReleaseCapture( CvCapture** capture ); - -enum -{ - // modes of the controlling registers (can be: auto, manual, auto single push, absolute Latter allowed with any other mode) - // every feature can have only one mode turned on at a time - CV_CAP_PROP_DC1394_OFF = -4, //turn the feature off (not controlled manually nor automatically) - CV_CAP_PROP_DC1394_MODE_MANUAL = -3, //set automatically when a value of the feature is set by the user - CV_CAP_PROP_DC1394_MODE_AUTO = -2, - CV_CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1, - CV_CAP_PROP_POS_MSEC =0, - CV_CAP_PROP_POS_FRAMES =1, - CV_CAP_PROP_POS_AVI_RATIO =2, - CV_CAP_PROP_FRAME_WIDTH =3, - CV_CAP_PROP_FRAME_HEIGHT =4, - CV_CAP_PROP_FPS =5, - CV_CAP_PROP_FOURCC =6, - CV_CAP_PROP_FRAME_COUNT =7, - CV_CAP_PROP_FORMAT =8, - CV_CAP_PROP_MODE =9, - CV_CAP_PROP_BRIGHTNESS =10, - CV_CAP_PROP_CONTRAST =11, - CV_CAP_PROP_SATURATION =12, - CV_CAP_PROP_HUE =13, - CV_CAP_PROP_GAIN =14, - CV_CAP_PROP_EXPOSURE =15, - CV_CAP_PROP_CONVERT_RGB =16, - CV_CAP_PROP_WHITE_BALANCE_BLUE_U =17, - CV_CAP_PROP_RECTIFICATION =18, - CV_CAP_PROP_MONOCHROME =19, - CV_CAP_PROP_SHARPNESS =20, - CV_CAP_PROP_AUTO_EXPOSURE =21, // exposure control done by camera, - // user can adjust reference level - // using this feature - CV_CAP_PROP_GAMMA =22, - CV_CAP_PROP_TEMPERATURE =23, - CV_CAP_PROP_TRIGGER =24, - CV_CAP_PROP_TRIGGER_DELAY =25, - CV_CAP_PROP_WHITE_BALANCE_RED_V =26, - CV_CAP_PROP_ZOOM =27, - CV_CAP_PROP_FOCUS =28, - CV_CAP_PROP_GUID =29, - CV_CAP_PROP_ISO_SPEED =30, - CV_CAP_PROP_MAX_DC1394 =31, - CV_CAP_PROP_BACKLIGHT =32, - CV_CAP_PROP_PAN =33, - CV_CAP_PROP_TILT =34, - CV_CAP_PROP_ROLL =35, - CV_CAP_PROP_IRIS =36, - CV_CAP_PROP_SETTINGS =37, - CV_CAP_PROP_BUFFERSIZE =38, - CV_CAP_PROP_AUTOFOCUS =39, - CV_CAP_PROP_SAR_NUM =40, - CV_CAP_PROP_SAR_DEN =41, - - CV_CAP_PROP_AUTOGRAB =1024, // property for videoio class CvCapture_Android only - CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING=1025, // readonly, tricky property, returns cpnst char* indeed - CV_CAP_PROP_PREVIEW_FORMAT=1026, // readonly, tricky property, returns cpnst char* indeed - - // OpenNI map generators - CV_CAP_OPENNI_DEPTH_GENERATOR = 1 << 31, - CV_CAP_OPENNI_IMAGE_GENERATOR = 1 << 30, - CV_CAP_OPENNI_IR_GENERATOR = 1 << 29, - CV_CAP_OPENNI_GENERATORS_MASK = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_OPENNI_IR_GENERATOR, - - // Properties of cameras available through OpenNI interfaces - CV_CAP_PROP_OPENNI_OUTPUT_MODE = 100, - CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101, // in mm - CV_CAP_PROP_OPENNI_BASELINE = 102, // in mm - CV_CAP_PROP_OPENNI_FOCAL_LENGTH = 103, // in pixels - CV_CAP_PROP_OPENNI_REGISTRATION = 104, // flag - CV_CAP_PROP_OPENNI_REGISTRATION_ON = CV_CAP_PROP_OPENNI_REGISTRATION, // flag that synchronizes the remapping depth map to image map - // by changing depth generator's view point (if the flag is "on") or - // sets this view point to its normal one (if the flag is "off"). - CV_CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105, - CV_CAP_PROP_OPENNI_MAX_BUFFER_SIZE = 106, - CV_CAP_PROP_OPENNI_CIRCLE_BUFFER = 107, - CV_CAP_PROP_OPENNI_MAX_TIME_DURATION = 108, - - CV_CAP_PROP_OPENNI_GENERATOR_PRESENT = 109, - CV_CAP_PROP_OPENNI2_SYNC = 110, - CV_CAP_PROP_OPENNI2_MIRROR = 111, - - CV_CAP_OPENNI_IMAGE_GENERATOR_PRESENT = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT, - CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_OUTPUT_MODE, - CV_CAP_OPENNI_DEPTH_GENERATOR_PRESENT = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT, - CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_BASELINE, - CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_FOCAL_LENGTH, - CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_REGISTRATION, - CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION, - CV_CAP_OPENNI_IR_GENERATOR_PRESENT = CV_CAP_OPENNI_IR_GENERATOR + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT, - - // Properties of cameras available through GStreamer interface - CV_CAP_GSTREAMER_QUEUE_LENGTH = 200, // default is 1 - - // PVAPI - CV_CAP_PROP_PVAPI_MULTICASTIP = 300, // ip for anable multicast master mode. 0 for disable multicast - CV_CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301, // FrameStartTriggerMode: Determines how a frame is initiated - CV_CAP_PROP_PVAPI_DECIMATIONHORIZONTAL = 302, // Horizontal sub-sampling of the image - CV_CAP_PROP_PVAPI_DECIMATIONVERTICAL = 303, // Vertical sub-sampling of the image - CV_CAP_PROP_PVAPI_BINNINGX = 304, // Horizontal binning factor - CV_CAP_PROP_PVAPI_BINNINGY = 305, // Vertical binning factor - CV_CAP_PROP_PVAPI_PIXELFORMAT = 306, // Pixel format - - // Properties of cameras available through XIMEA SDK interface - CV_CAP_PROP_XI_DOWNSAMPLING = 400, // Change image resolution by binning or skipping. - CV_CAP_PROP_XI_DATA_FORMAT = 401, // Output data format. - CV_CAP_PROP_XI_OFFSET_X = 402, // Horizontal offset from the origin to the area of interest (in pixels). - CV_CAP_PROP_XI_OFFSET_Y = 403, // Vertical offset from the origin to the area of interest (in pixels). - CV_CAP_PROP_XI_TRG_SOURCE = 404, // Defines source of trigger. - CV_CAP_PROP_XI_TRG_SOFTWARE = 405, // Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. - CV_CAP_PROP_XI_GPI_SELECTOR = 406, // Selects general purpose input - CV_CAP_PROP_XI_GPI_MODE = 407, // Set general purpose input mode - CV_CAP_PROP_XI_GPI_LEVEL = 408, // Get general purpose level - CV_CAP_PROP_XI_GPO_SELECTOR = 409, // Selects general purpose output - CV_CAP_PROP_XI_GPO_MODE = 410, // Set general purpose output mode - CV_CAP_PROP_XI_LED_SELECTOR = 411, // Selects camera signalling LED - CV_CAP_PROP_XI_LED_MODE = 412, // Define camera signalling LED functionality - CV_CAP_PROP_XI_MANUAL_WB = 413, // Calculates White Balance(must be called during acquisition) - CV_CAP_PROP_XI_AUTO_WB = 414, // Automatic white balance - CV_CAP_PROP_XI_AEAG = 415, // Automatic exposure/gain - CV_CAP_PROP_XI_EXP_PRIORITY = 416, // Exposure priority (0.5 - exposure 50%, gain 50%). - CV_CAP_PROP_XI_AE_MAX_LIMIT = 417, // Maximum limit of exposure in AEAG procedure - CV_CAP_PROP_XI_AG_MAX_LIMIT = 418, // Maximum limit of gain in AEAG procedure - CV_CAP_PROP_XI_AEAG_LEVEL = 419, // Average intensity of output signal AEAG should achieve(in %) - CV_CAP_PROP_XI_TIMEOUT = 420, // Image capture timeout in milliseconds - CV_CAP_PROP_XI_EXPOSURE = 421, // Exposure time in microseconds - CV_CAP_PROP_XI_EXPOSURE_BURST_COUNT = 422, // Sets the number of times of exposure in one frame. - CV_CAP_PROP_XI_GAIN_SELECTOR = 423, // Gain selector for parameter Gain allows to select different type of gains. - CV_CAP_PROP_XI_GAIN = 424, // Gain in dB - CV_CAP_PROP_XI_DOWNSAMPLING_TYPE = 426, // Change image downsampling type. - CV_CAP_PROP_XI_BINNING_SELECTOR = 427, // Binning engine selector. - CV_CAP_PROP_XI_BINNING_VERTICAL = 428, // Vertical Binning - number of vertical photo-sensitive cells to combine together. - CV_CAP_PROP_XI_BINNING_HORIZONTAL = 429, // Horizontal Binning - number of horizontal photo-sensitive cells to combine together. - CV_CAP_PROP_XI_BINNING_PATTERN = 430, // Binning pattern type. - CV_CAP_PROP_XI_DECIMATION_SELECTOR = 431, // Decimation engine selector. - CV_CAP_PROP_XI_DECIMATION_VERTICAL = 432, // Vertical Decimation - vertical sub-sampling of the image - reduces the vertical resolution of the image by the specified vertical decimation factor. - CV_CAP_PROP_XI_DECIMATION_HORIZONTAL = 433, // Horizontal Decimation - horizontal sub-sampling of the image - reduces the horizontal resolution of the image by the specified vertical decimation factor. - CV_CAP_PROP_XI_DECIMATION_PATTERN = 434, // Decimation pattern type. - CV_CAP_PROP_XI_TEST_PATTERN_GENERATOR_SELECTOR = 587, // Selects which test pattern generator is controlled by the TestPattern feature. - CV_CAP_PROP_XI_TEST_PATTERN = 588, // Selects which test pattern type is generated by the selected generator. - CV_CAP_PROP_XI_IMAGE_DATA_FORMAT = 435, // Output data format. - CV_CAP_PROP_XI_SHUTTER_TYPE = 436, // Change sensor shutter type(CMOS sensor). - CV_CAP_PROP_XI_SENSOR_TAPS = 437, // Number of taps - CV_CAP_PROP_XI_AEAG_ROI_OFFSET_X = 439, // Automatic exposure/gain ROI offset X - CV_CAP_PROP_XI_AEAG_ROI_OFFSET_Y = 440, // Automatic exposure/gain ROI offset Y - CV_CAP_PROP_XI_AEAG_ROI_WIDTH = 441, // Automatic exposure/gain ROI Width - CV_CAP_PROP_XI_AEAG_ROI_HEIGHT = 442, // Automatic exposure/gain ROI Height - CV_CAP_PROP_XI_BPC = 445, // Correction of bad pixels - CV_CAP_PROP_XI_WB_KR = 448, // White balance red coefficient - CV_CAP_PROP_XI_WB_KG = 449, // White balance green coefficient - CV_CAP_PROP_XI_WB_KB = 450, // White balance blue coefficient - CV_CAP_PROP_XI_WIDTH = 451, // Width of the Image provided by the device (in pixels). - CV_CAP_PROP_XI_HEIGHT = 452, // Height of the Image provided by the device (in pixels). - CV_CAP_PROP_XI_REGION_SELECTOR = 589, // Selects Region in Multiple ROI which parameters are set by width, height, ... ,region mode - CV_CAP_PROP_XI_REGION_MODE = 595, // Activates/deactivates Region selected by Region Selector - CV_CAP_PROP_XI_LIMIT_BANDWIDTH = 459, // Set/get bandwidth(datarate)(in Megabits) - CV_CAP_PROP_XI_SENSOR_DATA_BIT_DEPTH = 460, // Sensor output data bit depth. - CV_CAP_PROP_XI_OUTPUT_DATA_BIT_DEPTH = 461, // Device output data bit depth. - CV_CAP_PROP_XI_IMAGE_DATA_BIT_DEPTH = 462, // bitdepth of data returned by function xiGetImage - CV_CAP_PROP_XI_OUTPUT_DATA_PACKING = 463, // Device output data packing (or grouping) enabled. Packing could be enabled if output_data_bit_depth > 8 and packing capability is available. - CV_CAP_PROP_XI_OUTPUT_DATA_PACKING_TYPE = 464, // Data packing type. Some cameras supports only specific packing type. - CV_CAP_PROP_XI_IS_COOLED = 465, // Returns 1 for cameras that support cooling. - CV_CAP_PROP_XI_COOLING = 466, // Start camera cooling. - CV_CAP_PROP_XI_TARGET_TEMP = 467, // Set sensor target temperature for cooling. - CV_CAP_PROP_XI_CHIP_TEMP = 468, // Camera sensor temperature - CV_CAP_PROP_XI_HOUS_TEMP = 469, // Camera housing tepmerature - CV_CAP_PROP_XI_HOUS_BACK_SIDE_TEMP = 590, // Camera housing back side tepmerature - CV_CAP_PROP_XI_SENSOR_BOARD_TEMP = 596, // Camera sensor board temperature - CV_CAP_PROP_XI_CMS = 470, // Mode of color management system. - CV_CAP_PROP_XI_APPLY_CMS = 471, // Enable applying of CMS profiles to xiGetImage (see XI_PRM_INPUT_CMS_PROFILE, XI_PRM_OUTPUT_CMS_PROFILE). - CV_CAP_PROP_XI_IMAGE_IS_COLOR = 474, // Returns 1 for color cameras. - CV_CAP_PROP_XI_COLOR_FILTER_ARRAY = 475, // Returns color filter array type of RAW data. - CV_CAP_PROP_XI_GAMMAY = 476, // Luminosity gamma - CV_CAP_PROP_XI_GAMMAC = 477, // Chromaticity gamma - CV_CAP_PROP_XI_SHARPNESS = 478, // Sharpness Strength - CV_CAP_PROP_XI_CC_MATRIX_00 = 479, // Color Correction Matrix element [0][0] - CV_CAP_PROP_XI_CC_MATRIX_01 = 480, // Color Correction Matrix element [0][1] - CV_CAP_PROP_XI_CC_MATRIX_02 = 481, // Color Correction Matrix element [0][2] - CV_CAP_PROP_XI_CC_MATRIX_03 = 482, // Color Correction Matrix element [0][3] - CV_CAP_PROP_XI_CC_MATRIX_10 = 483, // Color Correction Matrix element [1][0] - CV_CAP_PROP_XI_CC_MATRIX_11 = 484, // Color Correction Matrix element [1][1] - CV_CAP_PROP_XI_CC_MATRIX_12 = 485, // Color Correction Matrix element [1][2] - CV_CAP_PROP_XI_CC_MATRIX_13 = 486, // Color Correction Matrix element [1][3] - CV_CAP_PROP_XI_CC_MATRIX_20 = 487, // Color Correction Matrix element [2][0] - CV_CAP_PROP_XI_CC_MATRIX_21 = 488, // Color Correction Matrix element [2][1] - CV_CAP_PROP_XI_CC_MATRIX_22 = 489, // Color Correction Matrix element [2][2] - CV_CAP_PROP_XI_CC_MATRIX_23 = 490, // Color Correction Matrix element [2][3] - CV_CAP_PROP_XI_CC_MATRIX_30 = 491, // Color Correction Matrix element [3][0] - CV_CAP_PROP_XI_CC_MATRIX_31 = 492, // Color Correction Matrix element [3][1] - CV_CAP_PROP_XI_CC_MATRIX_32 = 493, // Color Correction Matrix element [3][2] - CV_CAP_PROP_XI_CC_MATRIX_33 = 494, // Color Correction Matrix element [3][3] - CV_CAP_PROP_XI_DEFAULT_CC_MATRIX = 495, // Set default Color Correction Matrix - CV_CAP_PROP_XI_TRG_SELECTOR = 498, // Selects the type of trigger. - CV_CAP_PROP_XI_ACQ_FRAME_BURST_COUNT = 499, // Sets number of frames acquired by burst. This burst is used only if trigger is set to FrameBurstStart - CV_CAP_PROP_XI_DEBOUNCE_EN = 507, // Enable/Disable debounce to selected GPI - CV_CAP_PROP_XI_DEBOUNCE_T0 = 508, // Debounce time (x * 10us) - CV_CAP_PROP_XI_DEBOUNCE_T1 = 509, // Debounce time (x * 10us) - CV_CAP_PROP_XI_DEBOUNCE_POL = 510, // Debounce polarity (pol = 1 t0 - falling edge, t1 - rising edge) - CV_CAP_PROP_XI_LENS_MODE = 511, // Status of lens control interface. This shall be set to XI_ON before any Lens operations. - CV_CAP_PROP_XI_LENS_APERTURE_VALUE = 512, // Current lens aperture value in stops. Examples: 2.8, 4, 5.6, 8, 11 - CV_CAP_PROP_XI_LENS_FOCUS_MOVEMENT_VALUE = 513, // Lens current focus movement value to be used by XI_PRM_LENS_FOCUS_MOVE in motor steps. - CV_CAP_PROP_XI_LENS_FOCUS_MOVE = 514, // Moves lens focus motor by steps set in XI_PRM_LENS_FOCUS_MOVEMENT_VALUE. - CV_CAP_PROP_XI_LENS_FOCUS_DISTANCE = 515, // Lens focus distance in cm. - CV_CAP_PROP_XI_LENS_FOCAL_LENGTH = 516, // Lens focal distance in mm. - CV_CAP_PROP_XI_LENS_FEATURE_SELECTOR = 517, // Selects the current feature which is accessible by XI_PRM_LENS_FEATURE. - CV_CAP_PROP_XI_LENS_FEATURE = 518, // Allows access to lens feature value currently selected by XI_PRM_LENS_FEATURE_SELECTOR. - CV_CAP_PROP_XI_DEVICE_MODEL_ID = 521, // Return device model id - CV_CAP_PROP_XI_DEVICE_SN = 522, // Return device serial number - CV_CAP_PROP_XI_IMAGE_DATA_FORMAT_RGB32_ALPHA = 529, // The alpha channel of RGB32 output image format. - CV_CAP_PROP_XI_IMAGE_PAYLOAD_SIZE = 530, // Buffer size in bytes sufficient for output image returned by xiGetImage - CV_CAP_PROP_XI_TRANSPORT_PIXEL_FORMAT = 531, // Current format of pixels on transport layer. - CV_CAP_PROP_XI_SENSOR_CLOCK_FREQ_HZ = 532, // Sensor clock frequency in Hz. - CV_CAP_PROP_XI_SENSOR_CLOCK_FREQ_INDEX = 533, // Sensor clock frequency index. Sensor with selected frequencies have possibility to set the frequency only by this index. - CV_CAP_PROP_XI_SENSOR_OUTPUT_CHANNEL_COUNT = 534, // Number of output channels from sensor used for data transfer. - CV_CAP_PROP_XI_FRAMERATE = 535, // Define framerate in Hz - CV_CAP_PROP_XI_COUNTER_SELECTOR = 536, // Select counter - CV_CAP_PROP_XI_COUNTER_VALUE = 537, // Counter status - CV_CAP_PROP_XI_ACQ_TIMING_MODE = 538, // Type of sensor frames timing. - CV_CAP_PROP_XI_AVAILABLE_BANDWIDTH = 539, // Calculate and return available interface bandwidth(int Megabits) - CV_CAP_PROP_XI_BUFFER_POLICY = 540, // Data move policy - CV_CAP_PROP_XI_LUT_EN = 541, // Activates LUT. - CV_CAP_PROP_XI_LUT_INDEX = 542, // Control the index (offset) of the coefficient to access in the LUT. - CV_CAP_PROP_XI_LUT_VALUE = 543, // Value at entry LUTIndex of the LUT - CV_CAP_PROP_XI_TRG_DELAY = 544, // Specifies the delay in microseconds (us) to apply after the trigger reception before activating it. - CV_CAP_PROP_XI_TS_RST_MODE = 545, // Defines how time stamp reset engine will be armed - CV_CAP_PROP_XI_TS_RST_SOURCE = 546, // Defines which source will be used for timestamp reset. Writing this parameter will trigger settings of engine (arming) - CV_CAP_PROP_XI_IS_DEVICE_EXIST = 547, // Returns 1 if camera connected and works properly. - CV_CAP_PROP_XI_ACQ_BUFFER_SIZE = 548, // Acquisition buffer size in buffer_size_unit. Default bytes. - CV_CAP_PROP_XI_ACQ_BUFFER_SIZE_UNIT = 549, // Acquisition buffer size unit in bytes. Default 1. E.g. Value 1024 means that buffer_size is in KiBytes - CV_CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_SIZE = 550, // Acquisition transport buffer size in bytes - CV_CAP_PROP_XI_BUFFERS_QUEUE_SIZE = 551, // Queue of field/frame buffers - CV_CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_COMMIT = 552, // Number of buffers to commit to low level - CV_CAP_PROP_XI_RECENT_FRAME = 553, // GetImage returns most recent frame - CV_CAP_PROP_XI_DEVICE_RESET = 554, // Resets the camera to default state. - CV_CAP_PROP_XI_COLUMN_FPN_CORRECTION = 555, // Correction of column FPN - CV_CAP_PROP_XI_ROW_FPN_CORRECTION = 591, // Correction of row FPN - CV_CAP_PROP_XI_SENSOR_MODE = 558, // Current sensor mode. Allows to select sensor mode by one integer. Setting of this parameter affects: image dimensions and downsampling. - CV_CAP_PROP_XI_HDR = 559, // Enable High Dynamic Range feature. - CV_CAP_PROP_XI_HDR_KNEEPOINT_COUNT = 560, // The number of kneepoints in the PWLR. - CV_CAP_PROP_XI_HDR_T1 = 561, // position of first kneepoint(in % of XI_PRM_EXPOSURE) - CV_CAP_PROP_XI_HDR_T2 = 562, // position of second kneepoint (in % of XI_PRM_EXPOSURE) - CV_CAP_PROP_XI_KNEEPOINT1 = 563, // value of first kneepoint (% of sensor saturation) - CV_CAP_PROP_XI_KNEEPOINT2 = 564, // value of second kneepoint (% of sensor saturation) - CV_CAP_PROP_XI_IMAGE_BLACK_LEVEL = 565, // Last image black level counts. Can be used for Offline processing to recall it. - CV_CAP_PROP_XI_HW_REVISION = 571, // Returns hardware revision number. - CV_CAP_PROP_XI_DEBUG_LEVEL = 572, // Set debug level - CV_CAP_PROP_XI_AUTO_BANDWIDTH_CALCULATION = 573, // Automatic bandwidth calculation, - CV_CAP_PROP_XI_FFS_FILE_ID = 594, // File number. - CV_CAP_PROP_XI_FFS_FILE_SIZE = 580, // Size of file. - CV_CAP_PROP_XI_FREE_FFS_SIZE = 581, // Size of free camera FFS. - CV_CAP_PROP_XI_USED_FFS_SIZE = 582, // Size of used camera FFS. - CV_CAP_PROP_XI_FFS_ACCESS_KEY = 583, // Setting of key enables file operations on some cameras. - CV_CAP_PROP_XI_SENSOR_FEATURE_SELECTOR = 585, // Selects the current feature which is accessible by XI_PRM_SENSOR_FEATURE_VALUE. - CV_CAP_PROP_XI_SENSOR_FEATURE_VALUE = 586, // Allows access to sensor feature value currently selected by XI_PRM_SENSOR_FEATURE_SELECTOR. - - - // Properties for Android cameras - CV_CAP_PROP_ANDROID_FLASH_MODE = 8001, - CV_CAP_PROP_ANDROID_FOCUS_MODE = 8002, - CV_CAP_PROP_ANDROID_WHITE_BALANCE = 8003, - CV_CAP_PROP_ANDROID_ANTIBANDING = 8004, - CV_CAP_PROP_ANDROID_FOCAL_LENGTH = 8005, - CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_NEAR = 8006, - CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_OPTIMAL = 8007, - CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_FAR = 8008, - CV_CAP_PROP_ANDROID_EXPOSE_LOCK = 8009, - CV_CAP_PROP_ANDROID_WHITEBALANCE_LOCK = 8010, - - // Properties of cameras available through AVFOUNDATION interface - CV_CAP_PROP_IOS_DEVICE_FOCUS = 9001, - CV_CAP_PROP_IOS_DEVICE_EXPOSURE = 9002, - CV_CAP_PROP_IOS_DEVICE_FLASH = 9003, - CV_CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004, - CV_CAP_PROP_IOS_DEVICE_TORCH = 9005, - - // Properties of cameras available through Smartek Giganetix Ethernet Vision interface - /* --- Vladimir Litvinenko (litvinenko.vladimir@gmail.com) --- */ - CV_CAP_PROP_GIGA_FRAME_OFFSET_X = 10001, - CV_CAP_PROP_GIGA_FRAME_OFFSET_Y = 10002, - CV_CAP_PROP_GIGA_FRAME_WIDTH_MAX = 10003, - CV_CAP_PROP_GIGA_FRAME_HEIGH_MAX = 10004, - CV_CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005, - CV_CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006, - - CV_CAP_PROP_INTELPERC_PROFILE_COUNT = 11001, - CV_CAP_PROP_INTELPERC_PROFILE_IDX = 11002, - CV_CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE = 11003, - CV_CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE = 11004, - CV_CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD = 11005, - CV_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ = 11006, - CV_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT = 11007, - - // Intel PerC streams - CV_CAP_INTELPERC_DEPTH_GENERATOR = 1 << 29, - CV_CAP_INTELPERC_IMAGE_GENERATOR = 1 << 28, - CV_CAP_INTELPERC_GENERATORS_MASK = CV_CAP_INTELPERC_DEPTH_GENERATOR + CV_CAP_INTELPERC_IMAGE_GENERATOR -}; - -// Generic camera output modes. -// Currently, these are supported through the libv4l interface only. -enum -{ - CV_CAP_MODE_BGR = 0, // BGR24 (default) - CV_CAP_MODE_RGB = 1, // RGB24 - CV_CAP_MODE_GRAY = 2, // Y8 - CV_CAP_MODE_YUYV = 3 // YUYV -}; - -enum -{ - // Data given from depth generator. - CV_CAP_OPENNI_DEPTH_MAP = 0, // Depth values in mm (CV_16UC1) - CV_CAP_OPENNI_POINT_CLOUD_MAP = 1, // XYZ in meters (CV_32FC3) - CV_CAP_OPENNI_DISPARITY_MAP = 2, // Disparity in pixels (CV_8UC1) - CV_CAP_OPENNI_DISPARITY_MAP_32F = 3, // Disparity in pixels (CV_32FC1) - CV_CAP_OPENNI_VALID_DEPTH_MASK = 4, // CV_8UC1 - - // Data given from RGB image generator. - CV_CAP_OPENNI_BGR_IMAGE = 5, - CV_CAP_OPENNI_GRAY_IMAGE = 6, - - // Data given from IR image generator. - CV_CAP_OPENNI_IR_IMAGE = 7 -}; - -// Supported output modes of OpenNI image generator -enum -{ - CV_CAP_OPENNI_VGA_30HZ = 0, - CV_CAP_OPENNI_SXGA_15HZ = 1, - CV_CAP_OPENNI_SXGA_30HZ = 2, - CV_CAP_OPENNI_QVGA_30HZ = 3, - CV_CAP_OPENNI_QVGA_60HZ = 4 -}; - -enum -{ - CV_CAP_INTELPERC_DEPTH_MAP = 0, // Each pixel is a 16-bit integer. The value indicates the distance from an object to the camera's XY plane or the Cartesian depth. - CV_CAP_INTELPERC_UVDEPTH_MAP = 1, // Each pixel contains two 32-bit floating point values in the range of 0-1, representing the mapping of depth coordinates to the color coordinates. - CV_CAP_INTELPERC_IR_MAP = 2, // Each pixel is a 16-bit integer. The value indicates the intensity of the reflected laser beam. - CV_CAP_INTELPERC_IMAGE = 3 -}; - -// gPhoto2 properties, if propertyId is less than 0 then work on widget with that __additive inversed__ camera setting ID -// Get IDs by using CAP_PROP_GPHOTO2_WIDGET_ENUMERATE. -// @see CvCaptureCAM_GPHOTO2 for more info -enum -{ - CV_CAP_PROP_GPHOTO2_PREVIEW = 17001, // Capture only preview from liveview mode. - CV_CAP_PROP_GPHOTO2_WIDGET_ENUMERATE = 17002, // Readonly, returns (const char *). - CV_CAP_PROP_GPHOTO2_RELOAD_CONFIG = 17003, // Trigger, only by set. Reload camera settings. - CV_CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE = 17004, // Reload all settings on set. - CV_CAP_PROP_GPHOTO2_COLLECT_MSGS = 17005, // Collect messages with details. - CV_CAP_PROP_GPHOTO2_FLUSH_MSGS = 17006, // Readonly, returns (const char *). - CV_CAP_PROP_SPEED = 17007, // Exposure speed. Can be readonly, depends on camera program. - CV_CAP_PROP_APERTURE = 17008, // Aperture. Can be readonly, depends on camera program. - CV_CAP_PROP_EXPOSUREPROGRAM = 17009, // Camera exposure program. - CV_CAP_PROP_VIEWFINDER = 17010 // Enter liveview mode. -}; - -/** @brief retrieve capture properties -*/ -CVAPI(double) cvGetCaptureProperty( CvCapture* capture, int property_id ); -/** @brief set capture properties -*/ -CVAPI(int) cvSetCaptureProperty( CvCapture* capture, int property_id, double value ); - -/** @brief Return the type of the capturer (eg, ::CV_CAP_VFW, ::CV_CAP_UNICAP) - -It is unknown if created with ::CV_CAP_ANY -*/ -CVAPI(int) cvGetCaptureDomain( CvCapture* capture); - -/** @brief "black box" video file writer structure - -In C++ use cv::VideoWriter -*/ -typedef struct CvVideoWriter CvVideoWriter; - -//! Macro to construct the fourcc code of the codec. Same as CV_FOURCC() -#define CV_FOURCC_MACRO(c1, c2, c3, c4) (((c1) & 255) + (((c2) & 255) << 8) + (((c3) & 255) << 16) + (((c4) & 255) << 24)) - -/** @brief Constructs the fourcc code of the codec function - -Simply call it with 4 chars fourcc code like `CV_FOURCC('I', 'Y', 'U', 'V')` - -List of codes can be obtained at [Video Codecs by FOURCC](http://www.fourcc.org/codecs.php) page. -FFMPEG backend with MP4 container natively uses other values as fourcc code: -see [ObjectType](http://www.mp4ra.org/codecs.html). -*/ -CV_INLINE int CV_FOURCC(char c1, char c2, char c3, char c4) -{ - return CV_FOURCC_MACRO(c1, c2, c3, c4); -} - -//! (Windows only) Open Codec Selection Dialog -#define CV_FOURCC_PROMPT -1 -//! (Linux only) Use default codec for specified filename -#define CV_FOURCC_DEFAULT CV_FOURCC('I', 'Y', 'U', 'V') - -/** @brief initialize video file writer -*/ -CVAPI(CvVideoWriter*) cvCreateVideoWriter( const char* filename, int fourcc, - double fps, CvSize frame_size, - int is_color CV_DEFAULT(1)); - -/** @brief write frame to video file -*/ -CVAPI(int) cvWriteFrame( CvVideoWriter* writer, const IplImage* image ); - -/** @brief close video file writer -*/ -CVAPI(void) cvReleaseVideoWriter( CvVideoWriter** writer ); - -// *************************************************************************************** -//! @name Obsolete functions/synonyms -//! @{ -#define cvCaptureFromCAM cvCreateCameraCapture //!< @deprecated use cvCreateCameraCapture() instead -#define cvCaptureFromFile cvCreateFileCapture //!< @deprecated use cvCreateFileCapture() instead -#define cvCaptureFromAVI cvCaptureFromFile //!< @deprecated use cvCreateFileCapture() instead -#define cvCreateAVIWriter cvCreateVideoWriter //!< @deprecated use cvCreateVideoWriter() instead -#define cvWriteToAVI cvWriteFrame //!< @deprecated use cvWriteFrame() instead -//! @} Obsolete... - -//! @} videoio_c - -#ifdef __cplusplus -} -#endif - -#endif //OPENCV_VIDEOIO_H diff --git a/opencv/include/opencv2/videostab.hpp b/opencv/include/opencv2/videostab.hpp deleted file mode 100644 index ca3f5ad..0000000 --- a/opencv/include/opencv2/videostab.hpp +++ /dev/null @@ -1,81 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_HPP -#define OPENCV_VIDEOSTAB_HPP - -/** - @defgroup videostab Video Stabilization - -The video stabilization module contains a set of functions and classes that can be used to solve the -problem of video stabilization. There are a few methods implemented, most of them are described in -the papers @cite OF06 and @cite G11 . However, there are some extensions and deviations from the original -paper methods. - -### References - - 1. "Full-Frame Video Stabilization with Motion Inpainting" - Yasuyuki Matsushita, Eyal Ofek, Weina Ge, Xiaoou Tang, Senior Member, and Heung-Yeung Shum - 2. "Auto-Directed Video Stabilization with Robust L1 Optimal Camera Paths" - Matthias Grundmann, Vivek Kwatra, Irfan Essa - - @{ - @defgroup videostab_motion Global Motion Estimation - -The video stabilization module contains a set of functions and classes for global motion estimation -between point clouds or between images. In the last case features are extracted and matched -internally. For the sake of convenience the motion estimation functions are wrapped into classes. -Both the functions and the classes are available. - - @defgroup videostab_marching Fast Marching Method - -The Fast Marching Method @cite Telea04 is used in of the video stabilization routines to do motion and -color inpainting. The method is implemented is a flexible way and it's made public for other users. - - @} - -*/ - -#include "opencv2/videostab/stabilizer.hpp" -#include "opencv2/videostab/ring_buffer.hpp" - -#endif diff --git a/opencv/include/opencv2/videostab/deblurring.hpp b/opencv/include/opencv2/videostab/deblurring.hpp deleted file mode 100644 index c665640..0000000 --- a/opencv/include/opencv2/videostab/deblurring.hpp +++ /dev/null @@ -1,116 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_DEBLURRING_HPP -#define OPENCV_VIDEOSTAB_DEBLURRING_HPP - -#include -#include "opencv2/core.hpp" - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab -//! @{ - -CV_EXPORTS float calcBlurriness(const Mat &frame); - -class CV_EXPORTS DeblurerBase -{ -public: - DeblurerBase() : radius_(0), frames_(0), motions_(0), blurrinessRates_(0) {} - - virtual ~DeblurerBase() {} - - virtual void setRadius(int val) { radius_ = val; } - virtual int radius() const { return radius_; } - - virtual void deblur(int idx, Mat &frame) = 0; - - - // data from stabilizer - - virtual void setFrames(const std::vector &val) { frames_ = &val; } - virtual const std::vector& frames() const { return *frames_; } - - virtual void setMotions(const std::vector &val) { motions_ = &val; } - virtual const std::vector& motions() const { return *motions_; } - - virtual void setBlurrinessRates(const std::vector &val) { blurrinessRates_ = &val; } - virtual const std::vector& blurrinessRates() const { return *blurrinessRates_; } - -protected: - int radius_; - const std::vector *frames_; - const std::vector *motions_; - const std::vector *blurrinessRates_; -}; - -class CV_EXPORTS NullDeblurer : public DeblurerBase -{ -public: - virtual void deblur(int /*idx*/, Mat &/*frame*/) CV_OVERRIDE {} -}; - -class CV_EXPORTS WeightingDeblurer : public DeblurerBase -{ -public: - WeightingDeblurer(); - - void setSensitivity(float val) { sensitivity_ = val; } - float sensitivity() const { return sensitivity_; } - - virtual void deblur(int idx, Mat &frame) CV_OVERRIDE; - -private: - float sensitivity_; - Mat_ bSum_, gSum_, rSum_, wSum_; -}; - -//! @} - -} // namespace videostab -} // namespace cv - -#endif diff --git a/opencv/include/opencv2/videostab/fast_marching.hpp b/opencv/include/opencv2/videostab/fast_marching.hpp deleted file mode 100644 index 43f8e4a..0000000 --- a/opencv/include/opencv2/videostab/fast_marching.hpp +++ /dev/null @@ -1,121 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_FAST_MARCHING_HPP -#define OPENCV_VIDEOSTAB_FAST_MARCHING_HPP - -#include -#include -#include -#include "opencv2/core.hpp" - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab_marching -//! @{ - -/** @brief Describes the Fast Marching Method implementation. - - See http://iwi.eldoc.ub.rug.nl/FILES/root/2004/JGraphToolsTelea/2004JGraphToolsTelea.pdf - */ -class CV_EXPORTS FastMarchingMethod -{ -public: - FastMarchingMethod() : inf_(1e6f), size_(0) {} - - /** @brief Template method that runs the Fast Marching Method. - - @param mask Image mask. 0 value indicates that the pixel value must be inpainted, 255 indicates - that the pixel value is known, other values aren't acceptable. - @param inpaint Inpainting functor that overloads void operator ()(int x, int y). - @return Inpainting functor. - */ - template - Inpaint run(const Mat &mask, Inpaint inpaint); - - /** - @return Distance map that's created during working of the method. - */ - Mat distanceMap() const { return dist_; } - -private: - enum { INSIDE = 0, BAND = 1, KNOWN = 255 }; - - struct DXY - { - float dist; - int x, y; - - DXY() : dist(0), x(0), y(0) {} - DXY(float _dist, int _x, int _y) : dist(_dist), x(_x), y(_y) {} - bool operator <(const DXY &dxy) const { return dist < dxy.dist; } - }; - - float solve(int x1, int y1, int x2, int y2) const; - int& indexOf(const DXY &dxy) { return index_(dxy.y, dxy.x); } - - void heapUp(int idx); - void heapDown(int idx); - void heapAdd(const DXY &dxy); - void heapRemoveMin(); - - float inf_; - - cv::Mat_ flag_; // flag map - cv::Mat_ dist_; // distance map - - cv::Mat_ index_; // index of point in the narrow band - std::vector narrowBand_; // narrow band heap - int size_; // narrow band size -}; - -//! @} - -} // namespace videostab -} // namespace cv - -#include "fast_marching_inl.hpp" - -#endif diff --git a/opencv/include/opencv2/videostab/fast_marching_inl.hpp b/opencv/include/opencv2/videostab/fast_marching_inl.hpp deleted file mode 100644 index fdd488a..0000000 --- a/opencv/include/opencv2/videostab/fast_marching_inl.hpp +++ /dev/null @@ -1,165 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_FAST_MARCHING_INL_HPP -#define OPENCV_VIDEOSTAB_FAST_MARCHING_INL_HPP - -#include "opencv2/videostab/fast_marching.hpp" - -namespace cv -{ -namespace videostab -{ - -template -Inpaint FastMarchingMethod::run(const cv::Mat &mask, Inpaint inpaint) -{ - using namespace cv; - - CV_Assert(mask.type() == CV_8U); - - static const int lut[4][2] = {{-1,0}, {0,-1}, {1,0}, {0,1}}; - - mask.copyTo(flag_); - flag_.create(mask.size()); - dist_.create(mask.size()); - index_.create(mask.size()); - narrowBand_.clear(); - size_ = 0; - - // init - for (int y = 0; y < flag_.rows; ++y) - { - for (int x = 0; x < flag_.cols; ++x) - { - if (flag_(y,x) == KNOWN) - dist_(y,x) = 0.f; - else - { - int n = 0; - int nunknown = 0; - - for (int i = 0; i < 4; ++i) - { - int xn = x + lut[i][0]; - int yn = y + lut[i][1]; - - if (xn >= 0 && xn < flag_.cols && yn >= 0 && yn < flag_.rows) - { - n++; - if (flag_(yn,xn) != KNOWN) - nunknown++; - } - } - - if (n>0 && nunknown == n) - { - dist_(y,x) = inf_; - flag_(y,x) = INSIDE; - } - else - { - dist_(y,x) = 0.f; - flag_(y,x) = BAND; - inpaint(x, y); - - narrowBand_.push_back(DXY(0.f,x,y)); - index_(y,x) = size_++; - } - } - } - } - - // make heap - for (int i = size_/2-1; i >= 0; --i) - heapDown(i); - - // main cycle - while (size_ > 0) - { - int x = narrowBand_[0].x; - int y = narrowBand_[0].y; - heapRemoveMin(); - - flag_(y,x) = KNOWN; - for (int n = 0; n < 4; ++n) - { - int xn = x + lut[n][0]; - int yn = y + lut[n][1]; - - if (xn >= 0 && xn < flag_.cols && yn >= 0 && yn < flag_.rows && flag_(yn,xn) != KNOWN) - { - dist_(yn,xn) = std::min(std::min(solve(xn-1, yn, xn, yn-1), solve(xn+1, yn, xn, yn-1)), - std::min(solve(xn-1, yn, xn, yn+1), solve(xn+1, yn, xn, yn+1))); - - if (flag_(yn,xn) == INSIDE) - { - flag_(yn,xn) = BAND; - inpaint(xn, yn); - heapAdd(DXY(dist_(yn,xn),xn,yn)); - } - else - { - int i = index_(yn,xn); - if (dist_(yn,xn) < narrowBand_[i].dist) - { - narrowBand_[i].dist = dist_(yn,xn); - heapUp(i); - } - // works better if it's commented out - /*else if (dist(yn,xn) > narrowBand[i].dist) - { - narrowBand[i].dist = dist(yn,xn); - heapDown(i); - }*/ - } - } - } - } - - return inpaint; -} - -} // namespace videostab -} // namespace cv - -#endif diff --git a/opencv/include/opencv2/videostab/frame_source.hpp b/opencv/include/opencv2/videostab/frame_source.hpp deleted file mode 100644 index 171c637..0000000 --- a/opencv/include/opencv2/videostab/frame_source.hpp +++ /dev/null @@ -1,94 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_FRAME_SOURCE_HPP -#define OPENCV_VIDEOSTAB_FRAME_SOURCE_HPP - -#include -#include "opencv2/core.hpp" - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab -//! @{ - -class CV_EXPORTS IFrameSource -{ -public: - virtual ~IFrameSource() {} - virtual void reset() = 0; - virtual Mat nextFrame() = 0; -}; - -class CV_EXPORTS NullFrameSource : public IFrameSource -{ -public: - virtual void reset() CV_OVERRIDE {} - virtual Mat nextFrame() CV_OVERRIDE { return Mat(); } -}; - -class CV_EXPORTS VideoFileSource : public IFrameSource -{ -public: - VideoFileSource(const String &path, bool volatileFrame = false); - - virtual void reset() CV_OVERRIDE; - virtual Mat nextFrame() CV_OVERRIDE; - - int width(); - int height(); - int count(); - double fps(); - -private: - Ptr impl; -}; - -//! @} - -} // namespace videostab -} // namespace cv - -#endif diff --git a/opencv/include/opencv2/videostab/global_motion.hpp b/opencv/include/opencv2/videostab/global_motion.hpp deleted file mode 100644 index fedca2c..0000000 --- a/opencv/include/opencv2/videostab/global_motion.hpp +++ /dev/null @@ -1,300 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_GLOBAL_MOTION_HPP -#define OPENCV_VIDEOSTAB_GLOBAL_MOTION_HPP - -#include -#include -#include "opencv2/core.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/opencv_modules.hpp" -#include "opencv2/videostab/optical_flow.hpp" -#include "opencv2/videostab/motion_core.hpp" -#include "opencv2/videostab/outlier_rejection.hpp" - -#ifdef HAVE_OPENCV_CUDAIMGPROC -# include "opencv2/cudaimgproc.hpp" -#endif - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab_motion -//! @{ - -/** @brief Estimates best global motion between two 2D point clouds in the least-squares sense. - -@note Works in-place and changes input point arrays. - -@param points0 Source set of 2D points (32F). -@param points1 Destination set of 2D points (32F). -@param model Motion model (up to MM_AFFINE). -@param rmse Final root-mean-square error. -@return 3x3 2D transformation matrix (32F). - */ -CV_EXPORTS Mat estimateGlobalMotionLeastSquares( - InputOutputArray points0, InputOutputArray points1, int model = MM_AFFINE, - float *rmse = 0); - -/** @brief Estimates best global motion between two 2D point clouds robustly (using RANSAC method). - -@param points0 Source set of 2D points (32F). -@param points1 Destination set of 2D points (32F). -@param model Motion model. See cv::videostab::MotionModel. -@param params RANSAC method parameters. See videostab::RansacParams. -@param rmse Final root-mean-square error. -@param ninliers Final number of inliers. - */ -CV_EXPORTS Mat estimateGlobalMotionRansac( - InputArray points0, InputArray points1, int model = MM_AFFINE, - const RansacParams ¶ms = RansacParams::default2dMotion(MM_AFFINE), - float *rmse = 0, int *ninliers = 0); - -/** @brief Base class for all global motion estimation methods. - */ -class CV_EXPORTS MotionEstimatorBase -{ -public: - virtual ~MotionEstimatorBase() {} - - /** @brief Sets motion model. - - @param val Motion model. See cv::videostab::MotionModel. - */ - virtual void setMotionModel(MotionModel val) { motionModel_ = val; } - - /** - @return Motion model. See cv::videostab::MotionModel. - */ - virtual MotionModel motionModel() const { return motionModel_; } - - /** @brief Estimates global motion between two 2D point clouds. - - @param points0 Source set of 2D points (32F). - @param points1 Destination set of 2D points (32F). - @param ok Indicates whether motion was estimated successfully. - @return 3x3 2D transformation matrix (32F). - */ - virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0) = 0; - -protected: - MotionEstimatorBase(MotionModel model) { setMotionModel(model); } - -private: - MotionModel motionModel_; -}; - -/** @brief Describes a robust RANSAC-based global 2D motion estimation method which minimizes L2 error. - */ -class CV_EXPORTS MotionEstimatorRansacL2 : public MotionEstimatorBase -{ -public: - MotionEstimatorRansacL2(MotionModel model = MM_AFFINE); - - void setRansacParams(const RansacParams &val) { ransacParams_ = val; } - RansacParams ransacParams() const { return ransacParams_; } - - void setMinInlierRatio(float val) { minInlierRatio_ = val; } - float minInlierRatio() const { return minInlierRatio_; } - - virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0) CV_OVERRIDE; - -private: - RansacParams ransacParams_; - float minInlierRatio_; -}; - -/** @brief Describes a global 2D motion estimation method which minimizes L1 error. - -@note To be able to use this method you must build OpenCV with CLP library support. : - */ -class CV_EXPORTS MotionEstimatorL1 : public MotionEstimatorBase -{ -public: - MotionEstimatorL1(MotionModel model = MM_AFFINE); - - virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0) CV_OVERRIDE; - -private: - std::vector obj_, collb_, colub_; - std::vector elems_, rowlb_, rowub_; - std::vector rows_, cols_; - - void set(int row, int col, double coef) - { - rows_.push_back(row); - cols_.push_back(col); - elems_.push_back(coef); - } -}; - -/** @brief Base class for global 2D motion estimation methods which take frames as input. - */ -class CV_EXPORTS ImageMotionEstimatorBase -{ -public: - virtual ~ImageMotionEstimatorBase() {} - - virtual void setMotionModel(MotionModel val) { motionModel_ = val; } - virtual MotionModel motionModel() const { return motionModel_; } - - virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0) = 0; - -protected: - ImageMotionEstimatorBase(MotionModel model) { setMotionModel(model); } - -private: - MotionModel motionModel_; -}; - -class CV_EXPORTS FromFileMotionReader : public ImageMotionEstimatorBase -{ -public: - FromFileMotionReader(const String &path); - - virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0) CV_OVERRIDE; - -private: - std::ifstream file_; -}; - -class CV_EXPORTS ToFileMotionWriter : public ImageMotionEstimatorBase -{ -public: - ToFileMotionWriter(const String &path, Ptr estimator); - - virtual void setMotionModel(MotionModel val) CV_OVERRIDE { motionEstimator_->setMotionModel(val); } - virtual MotionModel motionModel() const CV_OVERRIDE { return motionEstimator_->motionModel(); } - - virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0) CV_OVERRIDE; - -private: - std::ofstream file_; - Ptr motionEstimator_; -}; - -/** @brief Describes a global 2D motion estimation method which uses keypoints detection and optical flow for -matching. - */ -class CV_EXPORTS KeypointBasedMotionEstimator : public ImageMotionEstimatorBase -{ -public: - KeypointBasedMotionEstimator(Ptr estimator); - - virtual void setMotionModel(MotionModel val) CV_OVERRIDE { motionEstimator_->setMotionModel(val); } - virtual MotionModel motionModel() const CV_OVERRIDE { return motionEstimator_->motionModel(); } - - void setDetector(Ptr val) { detector_ = val; } - Ptr detector() const { return detector_; } - - void setOpticalFlowEstimator(Ptr val) { optFlowEstimator_ = val; } - Ptr opticalFlowEstimator() const { return optFlowEstimator_; } - - void setOutlierRejector(Ptr val) { outlierRejector_ = val; } - Ptr outlierRejector() const { return outlierRejector_; } - - virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0) CV_OVERRIDE; - Mat estimate(InputArray frame0, InputArray frame1, bool *ok = 0); - -private: - Ptr motionEstimator_; - Ptr detector_; - Ptr optFlowEstimator_; - Ptr outlierRejector_; - - std::vector status_; - std::vector keypointsPrev_; - std::vector pointsPrev_, points_; - std::vector pointsPrevGood_, pointsGood_; -}; - -#if defined(HAVE_OPENCV_CUDAIMGPROC) && defined(HAVE_OPENCV_CUDAOPTFLOW) - -class CV_EXPORTS KeypointBasedMotionEstimatorGpu : public ImageMotionEstimatorBase -{ -public: - KeypointBasedMotionEstimatorGpu(Ptr estimator); - - virtual void setMotionModel(MotionModel val) CV_OVERRIDE { motionEstimator_->setMotionModel(val); } - virtual MotionModel motionModel() const CV_OVERRIDE { return motionEstimator_->motionModel(); } - - void setOutlierRejector(Ptr val) { outlierRejector_ = val; } - Ptr outlierRejector() const { return outlierRejector_; } - - virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0) CV_OVERRIDE; - Mat estimate(const cuda::GpuMat &frame0, const cuda::GpuMat &frame1, bool *ok = 0); - -private: - Ptr motionEstimator_; - Ptr detector_; - SparsePyrLkOptFlowEstimatorGpu optFlowEstimator_; - Ptr outlierRejector_; - - cuda::GpuMat frame0_, grayFrame0_, frame1_; - cuda::GpuMat pointsPrev_, points_; - cuda::GpuMat status_; - - Mat hostPointsPrev_, hostPoints_; - std::vector hostPointsPrevTmp_, hostPointsTmp_; - std::vector rejectionStatus_; -}; - -#endif // defined(HAVE_OPENCV_CUDAIMGPROC) && defined(HAVE_OPENCV_CUDAOPTFLOW) - -/** @brief Computes motion between two frames assuming that all the intermediate motions are known. - -@param from Source frame index. -@param to Destination frame index. -@param motions Pair-wise motions. motions[i] denotes motion from the frame i to the frame i+1 -@return Motion from the Source frame to the Destination frame. - */ -CV_EXPORTS Mat getMotion(int from, int to, const std::vector &motions); - -//! @} - -} // namespace videostab -} // namespace cv - -#endif diff --git a/opencv/include/opencv2/videostab/inpainting.hpp b/opencv/include/opencv2/videostab/inpainting.hpp deleted file mode 100644 index 9c123f0..0000000 --- a/opencv/include/opencv2/videostab/inpainting.hpp +++ /dev/null @@ -1,212 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_INPAINTINT_HPP -#define OPENCV_VIDEOSTAB_INPAINTINT_HPP - -#include -#include "opencv2/core.hpp" -#include "opencv2/videostab/optical_flow.hpp" -#include "opencv2/videostab/fast_marching.hpp" -#include "opencv2/videostab/global_motion.hpp" -#include "opencv2/photo.hpp" - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab -//! @{ - -class CV_EXPORTS InpainterBase -{ -public: - InpainterBase() - : radius_(0), motionModel_(MM_UNKNOWN), frames_(0), motions_(0), - stabilizedFrames_(0), stabilizationMotions_(0) {} - - virtual ~InpainterBase() {} - - virtual void setRadius(int val) { radius_ = val; } - virtual int radius() const { return radius_; } - - virtual void setMotionModel(MotionModel val) { motionModel_ = val; } - virtual MotionModel motionModel() const { return motionModel_; } - - virtual void inpaint(int idx, Mat &frame, Mat &mask) = 0; - - - // data from stabilizer - - virtual void setFrames(const std::vector &val) { frames_ = &val; } - virtual const std::vector& frames() const { return *frames_; } - - virtual void setMotions(const std::vector &val) { motions_ = &val; } - virtual const std::vector& motions() const { return *motions_; } - - virtual void setStabilizedFrames(const std::vector &val) { stabilizedFrames_ = &val; } - virtual const std::vector& stabilizedFrames() const { return *stabilizedFrames_; } - - virtual void setStabilizationMotions(const std::vector &val) { stabilizationMotions_ = &val; } - virtual const std::vector& stabilizationMotions() const { return *stabilizationMotions_; } - -protected: - int radius_; - MotionModel motionModel_; - const std::vector *frames_; - const std::vector *motions_; - const std::vector *stabilizedFrames_; - const std::vector *stabilizationMotions_; -}; - -class CV_EXPORTS NullInpainter : public InpainterBase -{ -public: - virtual void inpaint(int /*idx*/, Mat &/*frame*/, Mat &/*mask*/) CV_OVERRIDE {} -}; - -class CV_EXPORTS InpaintingPipeline : public InpainterBase -{ -public: - void pushBack(Ptr inpainter) { inpainters_.push_back(inpainter); } - bool empty() const { return inpainters_.empty(); } - - virtual void setRadius(int val) CV_OVERRIDE; - virtual void setMotionModel(MotionModel val) CV_OVERRIDE; - virtual void setFrames(const std::vector &val) CV_OVERRIDE; - virtual void setMotions(const std::vector &val) CV_OVERRIDE; - virtual void setStabilizedFrames(const std::vector &val) CV_OVERRIDE; - virtual void setStabilizationMotions(const std::vector &val) CV_OVERRIDE; - - virtual void inpaint(int idx, Mat &frame, Mat &mask) CV_OVERRIDE; - -private: - std::vector > inpainters_; -}; - -class CV_EXPORTS ConsistentMosaicInpainter : public InpainterBase -{ -public: - ConsistentMosaicInpainter(); - - void setStdevThresh(float val) { stdevThresh_ = val; } - float stdevThresh() const { return stdevThresh_; } - - virtual void inpaint(int idx, Mat &frame, Mat &mask) CV_OVERRIDE; - -private: - float stdevThresh_; -}; - -class CV_EXPORTS MotionInpainter : public InpainterBase -{ -public: - MotionInpainter(); - - void setOptFlowEstimator(Ptr val) { optFlowEstimator_ = val; } - Ptr optFlowEstimator() const { return optFlowEstimator_; } - - void setFlowErrorThreshold(float val) { flowErrorThreshold_ = val; } - float flowErrorThreshold() const { return flowErrorThreshold_; } - - void setDistThreshold(float val) { distThresh_ = val; } - float distThresh() const { return distThresh_; } - - void setBorderMode(int val) { borderMode_ = val; } - int borderMode() const { return borderMode_; } - - virtual void inpaint(int idx, Mat &frame, Mat &mask) CV_OVERRIDE; - -private: - FastMarchingMethod fmm_; - Ptr optFlowEstimator_; - float flowErrorThreshold_; - float distThresh_; - int borderMode_; - - Mat frame1_, transformedFrame1_; - Mat_ grayFrame_, transformedGrayFrame1_; - Mat_ mask1_, transformedMask1_; - Mat_ flowX_, flowY_, flowErrors_; - Mat_ flowMask_; -}; - -class CV_EXPORTS ColorAverageInpainter : public InpainterBase -{ -public: - virtual void inpaint(int idx, Mat &frame, Mat &mask) CV_OVERRIDE; - -private: - FastMarchingMethod fmm_; -}; - -class CV_EXPORTS ColorInpainter : public InpainterBase -{ -public: - ColorInpainter(int method = INPAINT_TELEA, double radius = 2.); - - virtual void inpaint(int idx, Mat &frame, Mat &mask) CV_OVERRIDE; - -private: - int method_; - double radius_; - Mat invMask_; -}; - -inline ColorInpainter::ColorInpainter(int _method, double _radius) - : method_(_method), radius_(_radius) {} - -CV_EXPORTS void calcFlowMask( - const Mat &flowX, const Mat &flowY, const Mat &errors, float maxError, - const Mat &mask0, const Mat &mask1, Mat &flowMask); - -CV_EXPORTS void completeFrameAccordingToFlow( - const Mat &flowMask, const Mat &flowX, const Mat &flowY, const Mat &frame1, const Mat &mask1, - float distThresh, Mat& frame0, Mat &mask0); - -//! @} - -} // namespace videostab -} // namespace cv - -#endif diff --git a/opencv/include/opencv2/videostab/log.hpp b/opencv/include/opencv2/videostab/log.hpp deleted file mode 100644 index 73e7049..0000000 --- a/opencv/include/opencv2/videostab/log.hpp +++ /dev/null @@ -1,80 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_LOG_HPP -#define OPENCV_VIDEOSTAB_LOG_HPP - -#include "opencv2/core.hpp" - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab -//! @{ - -class CV_EXPORTS ILog -{ -public: - virtual ~ILog() {} - virtual void print(const char *format, ...) = 0; -}; - -class CV_EXPORTS NullLog : public ILog -{ -public: - virtual void print(const char * /*format*/, ...) CV_OVERRIDE {} -}; - -class CV_EXPORTS LogToStdout : public ILog -{ -public: - virtual void print(const char *format, ...) CV_OVERRIDE; -}; - -//! @} - -} // namespace videostab -} // namespace cv - -#endif diff --git a/opencv/include/opencv2/videostab/motion_core.hpp b/opencv/include/opencv2/videostab/motion_core.hpp deleted file mode 100644 index 4525cc7..0000000 --- a/opencv/include/opencv2/videostab/motion_core.hpp +++ /dev/null @@ -1,129 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_MOTION_CORE_HPP -#define OPENCV_VIDEOSTAB_MOTION_CORE_HPP - -#include -#include "opencv2/core.hpp" - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab_motion -//! @{ - -/** @brief Describes motion model between two point clouds. - */ -enum MotionModel -{ - MM_TRANSLATION = 0, - MM_TRANSLATION_AND_SCALE = 1, - MM_ROTATION = 2, - MM_RIGID = 3, - MM_SIMILARITY = 4, - MM_AFFINE = 5, - MM_HOMOGRAPHY = 6, - MM_UNKNOWN = 7 -}; - -/** @brief Describes RANSAC method parameters. - */ -struct CV_EXPORTS RansacParams -{ - int size; //!< subset size - float thresh; //!< max error to classify as inlier - float eps; //!< max outliers ratio - float prob; //!< probability of success - - RansacParams() : size(0), thresh(0), eps(0), prob(0) {} - /** @brief Constructor - @param size Subset size. - @param thresh Maximum re-projection error value to classify as inlier. - @param eps Maximum ratio of incorrect correspondences. - @param prob Required success probability. - */ - RansacParams(int size, float thresh, float eps, float prob); - - /** - @return Number of iterations that'll be performed by RANSAC method. - */ - int niters() const - { - return static_cast( - std::ceil(std::log(1 - prob) / std::log(1 - std::pow(1 - eps, size)))); - } - - /** - @param model Motion model. See cv::videostab::MotionModel. - @return Default RANSAC method parameters for the given motion model. - */ - static RansacParams default2dMotion(MotionModel model) - { - CV_Assert(model < MM_UNKNOWN); - if (model == MM_TRANSLATION) - return RansacParams(1, 0.5f, 0.5f, 0.99f); - if (model == MM_TRANSLATION_AND_SCALE) - return RansacParams(2, 0.5f, 0.5f, 0.99f); - if (model == MM_ROTATION) - return RansacParams(1, 0.5f, 0.5f, 0.99f); - if (model == MM_RIGID) - return RansacParams(2, 0.5f, 0.5f, 0.99f); - if (model == MM_SIMILARITY) - return RansacParams(2, 0.5f, 0.5f, 0.99f); - if (model == MM_AFFINE) - return RansacParams(3, 0.5f, 0.5f, 0.99f); - return RansacParams(4, 0.5f, 0.5f, 0.99f); - } -}; - -inline RansacParams::RansacParams(int _size, float _thresh, float _eps, float _prob) - : size(_size), thresh(_thresh), eps(_eps), prob(_prob) {} - -//! @} - -} // namespace videostab -} // namespace cv - -#endif diff --git a/opencv/include/opencv2/videostab/motion_stabilizing.hpp b/opencv/include/opencv2/videostab/motion_stabilizing.hpp deleted file mode 100644 index c50095b..0000000 --- a/opencv/include/opencv2/videostab/motion_stabilizing.hpp +++ /dev/null @@ -1,174 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_MOTION_STABILIZING_HPP -#define OPENCV_VIDEOSTAB_MOTION_STABILIZING_HPP - -#include -#include -#include "opencv2/core.hpp" -#include "opencv2/videostab/global_motion.hpp" - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab_motion -//! @{ - -class CV_EXPORTS IMotionStabilizer -{ -public: - virtual ~IMotionStabilizer() {} - - //! assumes that [0, size-1) is in or equals to [range.first, range.second) - virtual void stabilize( - int size, const std::vector &motions, std::pair range, - Mat *stabilizationMotions) = 0; -}; - -class CV_EXPORTS MotionStabilizationPipeline : public IMotionStabilizer -{ -public: - void pushBack(Ptr stabilizer) { stabilizers_.push_back(stabilizer); } - bool empty() const { return stabilizers_.empty(); } - - virtual void stabilize( - int size, const std::vector &motions, std::pair range, - Mat *stabilizationMotions) CV_OVERRIDE; - -private: - std::vector > stabilizers_; -}; - -class CV_EXPORTS MotionFilterBase : public IMotionStabilizer -{ -public: - virtual ~MotionFilterBase() {} - - virtual Mat stabilize( - int idx, const std::vector &motions, std::pair range) = 0; - - virtual void stabilize( - int size, const std::vector &motions, std::pair range, - Mat *stabilizationMotions) CV_OVERRIDE; -}; - -class CV_EXPORTS GaussianMotionFilter : public MotionFilterBase -{ -public: - GaussianMotionFilter(int radius = 15, float stdev = -1.f); - - void setParams(int radius, float stdev = -1.f); - int radius() const { return radius_; } - float stdev() const { return stdev_; } - - virtual Mat stabilize( - int idx, const std::vector &motions, std::pair range) CV_OVERRIDE; - -private: - int radius_; - float stdev_; - std::vector weight_; -}; - -inline GaussianMotionFilter::GaussianMotionFilter(int _radius, float _stdev) { setParams(_radius, _stdev); } - -class CV_EXPORTS LpMotionStabilizer : public IMotionStabilizer -{ -public: - LpMotionStabilizer(MotionModel model = MM_SIMILARITY); - - void setMotionModel(MotionModel val) { model_ = val; } - MotionModel motionModel() const { return model_; } - - void setFrameSize(Size val) { frameSize_ = val; } - Size frameSize() const { return frameSize_; } - - void setTrimRatio(float val) { trimRatio_ = val; } - float trimRatio() const { return trimRatio_; } - - void setWeight1(float val) { w1_ = val; } - float weight1() const { return w1_; } - - void setWeight2(float val) { w2_ = val; } - float weight2() const { return w2_; } - - void setWeight3(float val) { w3_ = val; } - float weight3() const { return w3_; } - - void setWeight4(float val) { w4_ = val; } - float weight4() const { return w4_; } - - virtual void stabilize( - int size, const std::vector &motions, std::pair range, - Mat *stabilizationMotions) CV_OVERRIDE; - -private: - MotionModel model_; - Size frameSize_; - float trimRatio_; - float w1_, w2_, w3_, w4_; - - std::vector obj_, collb_, colub_; - std::vector rows_, cols_; - std::vector elems_, rowlb_, rowub_; - - void set(int row, int col, double coef) - { - rows_.push_back(row); - cols_.push_back(col); - elems_.push_back(coef); - } -}; - -CV_EXPORTS Mat ensureInclusionConstraint(const Mat &M, Size size, float trimRatio); - -CV_EXPORTS float estimateOptimalTrimRatio(const Mat &M, Size size); - -//! @} - -} // namespace videostab -} // namespace - -#endif diff --git a/opencv/include/opencv2/videostab/optical_flow.hpp b/opencv/include/opencv2/videostab/optical_flow.hpp deleted file mode 100644 index 5e06941..0000000 --- a/opencv/include/opencv2/videostab/optical_flow.hpp +++ /dev/null @@ -1,150 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_OPTICAL_FLOW_HPP -#define OPENCV_VIDEOSTAB_OPTICAL_FLOW_HPP - -#include "opencv2/core.hpp" -#include "opencv2/opencv_modules.hpp" - -#ifdef HAVE_OPENCV_CUDAOPTFLOW - #include "opencv2/cudaoptflow.hpp" -#endif - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab -//! @{ - -class CV_EXPORTS ISparseOptFlowEstimator -{ -public: - virtual ~ISparseOptFlowEstimator() {} - virtual void run( - InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1, - OutputArray status, OutputArray errors) = 0; -}; - -class CV_EXPORTS IDenseOptFlowEstimator -{ -public: - virtual ~IDenseOptFlowEstimator() {} - virtual void run( - InputArray frame0, InputArray frame1, InputOutputArray flowX, InputOutputArray flowY, - OutputArray errors) = 0; -}; - -class CV_EXPORTS PyrLkOptFlowEstimatorBase -{ -public: - PyrLkOptFlowEstimatorBase() { setWinSize(Size(21, 21)); setMaxLevel(3); } - - virtual void setWinSize(Size val) { winSize_ = val; } - virtual Size winSize() const { return winSize_; } - - virtual void setMaxLevel(int val) { maxLevel_ = val; } - virtual int maxLevel() const { return maxLevel_; } - virtual ~PyrLkOptFlowEstimatorBase() {} - -protected: - Size winSize_; - int maxLevel_; -}; - -class CV_EXPORTS SparsePyrLkOptFlowEstimator - : public PyrLkOptFlowEstimatorBase, public ISparseOptFlowEstimator -{ -public: - virtual void run( - InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1, - OutputArray status, OutputArray errors) CV_OVERRIDE; -}; - -#ifdef HAVE_OPENCV_CUDAOPTFLOW - -class CV_EXPORTS SparsePyrLkOptFlowEstimatorGpu - : public PyrLkOptFlowEstimatorBase, public ISparseOptFlowEstimator -{ -public: - SparsePyrLkOptFlowEstimatorGpu(); - - virtual void run( - InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1, - OutputArray status, OutputArray errors) CV_OVERRIDE; - - void run(const cuda::GpuMat &frame0, const cuda::GpuMat &frame1, const cuda::GpuMat &points0, cuda::GpuMat &points1, - cuda::GpuMat &status, cuda::GpuMat &errors); - - void run(const cuda::GpuMat &frame0, const cuda::GpuMat &frame1, const cuda::GpuMat &points0, cuda::GpuMat &points1, - cuda::GpuMat &status); - -private: - Ptr optFlowEstimator_; - cuda::GpuMat frame0_, frame1_, points0_, points1_, status_, errors_; -}; - -class CV_EXPORTS DensePyrLkOptFlowEstimatorGpu - : public PyrLkOptFlowEstimatorBase, public IDenseOptFlowEstimator -{ -public: - DensePyrLkOptFlowEstimatorGpu(); - - virtual void run( - InputArray frame0, InputArray frame1, InputOutputArray flowX, InputOutputArray flowY, - OutputArray errors) CV_OVERRIDE; - -private: - Ptr optFlowEstimator_; - cuda::GpuMat frame0_, frame1_, flowX_, flowY_, errors_; -}; - -#endif - -//! @} - -} // namespace videostab -} // namespace cv - -#endif diff --git a/opencv/include/opencv2/videostab/outlier_rejection.hpp b/opencv/include/opencv2/videostab/outlier_rejection.hpp deleted file mode 100644 index 1d29896..0000000 --- a/opencv/include/opencv2/videostab/outlier_rejection.hpp +++ /dev/null @@ -1,101 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_OUTLIER_REJECTION_HPP -#define OPENCV_VIDEOSTAB_OUTLIER_REJECTION_HPP - -#include -#include "opencv2/core.hpp" -#include "opencv2/videostab/motion_core.hpp" - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab -//! @{ - -class CV_EXPORTS IOutlierRejector -{ -public: - virtual ~IOutlierRejector() {} - - virtual void process( - Size frameSize, InputArray points0, InputArray points1, OutputArray mask) = 0; -}; - -class CV_EXPORTS NullOutlierRejector : public IOutlierRejector -{ -public: - virtual void process( - Size frameSize, InputArray points0, InputArray points1, OutputArray mask) CV_OVERRIDE; -}; - -class CV_EXPORTS TranslationBasedLocalOutlierRejector : public IOutlierRejector -{ -public: - TranslationBasedLocalOutlierRejector(); - - void setCellSize(Size val) { cellSize_ = val; } - Size cellSize() const { return cellSize_; } - - void setRansacParams(RansacParams val) { ransacParams_ = val; } - RansacParams ransacParams() const { return ransacParams_; } - - virtual void process( - Size frameSize, InputArray points0, InputArray points1, OutputArray mask) CV_OVERRIDE; - -private: - Size cellSize_; - RansacParams ransacParams_; - - typedef std::vector Cell; - std::vector grid_; -}; - -//! @} - -} // namespace videostab -} // namespace cv - -#endif diff --git a/opencv/include/opencv2/videostab/ring_buffer.hpp b/opencv/include/opencv2/videostab/ring_buffer.hpp deleted file mode 100644 index 55d5244..0000000 --- a/opencv/include/opencv2/videostab/ring_buffer.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_RING_BUFFER_HPP -#define OPENCV_VIDEOSTAB_RING_BUFFER_HPP - -#include -#include "opencv2/imgproc.hpp" - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab -//! @{ - -template inline T& at(int idx, std::vector &items) -{ - return items[cv::borderInterpolate(idx, static_cast(items.size()), cv::BORDER_WRAP)]; -} - -template inline const T& at(int idx, const std::vector &items) -{ - return items[cv::borderInterpolate(idx, static_cast(items.size()), cv::BORDER_WRAP)]; -} - -//! @} - -} // namespace videostab -} // namespace cv - -#endif diff --git a/opencv/include/opencv2/videostab/stabilizer.hpp b/opencv/include/opencv2/videostab/stabilizer.hpp deleted file mode 100644 index 634a0aa..0000000 --- a/opencv/include/opencv2/videostab/stabilizer.hpp +++ /dev/null @@ -1,200 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_STABILIZER_HPP -#define OPENCV_VIDEOSTAB_STABILIZER_HPP - -#include -#include -#include "opencv2/core.hpp" -#include "opencv2/imgproc.hpp" -#include "opencv2/videostab/global_motion.hpp" -#include "opencv2/videostab/motion_stabilizing.hpp" -#include "opencv2/videostab/frame_source.hpp" -#include "opencv2/videostab/log.hpp" -#include "opencv2/videostab/inpainting.hpp" -#include "opencv2/videostab/deblurring.hpp" -#include "opencv2/videostab/wobble_suppression.hpp" - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab -//! @{ - -class CV_EXPORTS StabilizerBase -{ -public: - virtual ~StabilizerBase() {} - - void setLog(Ptr ilog) { log_ = ilog; } - Ptr log() const { return log_; } - - void setRadius(int val) { radius_ = val; } - int radius() const { return radius_; } - - void setFrameSource(Ptr val) { frameSource_ = val; } - Ptr frameSource() const { return frameSource_; } - - void setMotionEstimator(Ptr val) { motionEstimator_ = val; } - Ptr motionEstimator() const { return motionEstimator_; } - - void setDeblurer(Ptr val) { deblurer_ = val; } - Ptr deblurrer() const { return deblurer_; } - - void setTrimRatio(float val) { trimRatio_ = val; } - float trimRatio() const { return trimRatio_; } - - void setCorrectionForInclusion(bool val) { doCorrectionForInclusion_ = val; } - bool doCorrectionForInclusion() const { return doCorrectionForInclusion_; } - - void setBorderMode(int val) { borderMode_ = val; } - int borderMode() const { return borderMode_; } - - void setInpainter(Ptr val) { inpainter_ = val; } - Ptr inpainter() const { return inpainter_; } - -protected: - StabilizerBase(); - - void reset(); - Mat nextStabilizedFrame(); - bool doOneIteration(); - virtual void setUp(const Mat &firstFrame); - virtual Mat estimateMotion() = 0; - virtual Mat estimateStabilizationMotion() = 0; - void stabilizeFrame(); - virtual Mat postProcessFrame(const Mat &frame); - void logProcessingTime(); - - Ptr log_; - Ptr frameSource_; - Ptr motionEstimator_; - Ptr deblurer_; - Ptr inpainter_; - int radius_; - float trimRatio_; - bool doCorrectionForInclusion_; - int borderMode_; - - Size frameSize_; - Mat frameMask_; - int curPos_; - int curStabilizedPos_; - bool doDeblurring_; - Mat preProcessedFrame_; - bool doInpainting_; - Mat inpaintingMask_; - Mat finalFrame_; - std::vector frames_; - std::vector motions_; // motions_[i] is the motion from i-th to i+1-th frame - std::vector blurrinessRates_; - std::vector stabilizedFrames_; - std::vector stabilizedMasks_; - std::vector stabilizationMotions_; - clock_t processingStartTime_; -}; - -class CV_EXPORTS OnePassStabilizer : public StabilizerBase, public IFrameSource -{ -public: - OnePassStabilizer(); - - void setMotionFilter(Ptr val) { motionFilter_ = val; } - Ptr motionFilter() const { return motionFilter_; } - - virtual void reset() CV_OVERRIDE; - virtual Mat nextFrame() CV_OVERRIDE { return nextStabilizedFrame(); } - -protected: - virtual void setUp(const Mat &firstFrame) CV_OVERRIDE; - virtual Mat estimateMotion() CV_OVERRIDE; - virtual Mat estimateStabilizationMotion() CV_OVERRIDE; - virtual Mat postProcessFrame(const Mat &frame) CV_OVERRIDE; - - Ptr motionFilter_; -}; - -class CV_EXPORTS TwoPassStabilizer : public StabilizerBase, public IFrameSource -{ -public: - TwoPassStabilizer(); - - void setMotionStabilizer(Ptr val) { motionStabilizer_ = val; } - Ptr motionStabilizer() const { return motionStabilizer_; } - - void setWobbleSuppressor(Ptr val) { wobbleSuppressor_ = val; } - Ptr wobbleSuppressor() const { return wobbleSuppressor_; } - - void setEstimateTrimRatio(bool val) { mustEstTrimRatio_ = val; } - bool mustEstimateTrimaRatio() const { return mustEstTrimRatio_; } - - virtual void reset() CV_OVERRIDE; - virtual Mat nextFrame() CV_OVERRIDE; - -protected: - void runPrePassIfNecessary(); - - virtual void setUp(const Mat &firstFrame) CV_OVERRIDE; - virtual Mat estimateMotion() CV_OVERRIDE; - virtual Mat estimateStabilizationMotion() CV_OVERRIDE; - virtual Mat postProcessFrame(const Mat &frame) CV_OVERRIDE; - - Ptr motionStabilizer_; - Ptr wobbleSuppressor_; - bool mustEstTrimRatio_; - - int frameCount_; - bool isPrePassDone_; - bool doWobbleSuppression_; - std::vector motions2_; - Mat suppressedFrame_; -}; - -//! @} - -} // namespace videostab -} // namespace cv - -#endif diff --git a/opencv/include/opencv2/videostab/wobble_suppression.hpp b/opencv/include/opencv2/videostab/wobble_suppression.hpp deleted file mode 100644 index d60ae6d..0000000 --- a/opencv/include/opencv2/videostab/wobble_suppression.hpp +++ /dev/null @@ -1,140 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef OPENCV_VIDEOSTAB_WOBBLE_SUPPRESSION_HPP -#define OPENCV_VIDEOSTAB_WOBBLE_SUPPRESSION_HPP - -#include -#include "opencv2/core.hpp" -#include "opencv2/core/cuda.hpp" -#include "opencv2/videostab/global_motion.hpp" -#include "opencv2/videostab/log.hpp" - -namespace cv -{ -namespace videostab -{ - -//! @addtogroup videostab -//! @{ - -class CV_EXPORTS WobbleSuppressorBase -{ -public: - WobbleSuppressorBase(); - - virtual ~WobbleSuppressorBase() {} - - void setMotionEstimator(Ptr val) { motionEstimator_ = val; } - Ptr motionEstimator() const { return motionEstimator_; } - - virtual void suppress(int idx, const Mat &frame, Mat &result) = 0; - - - // data from stabilizer - - virtual void setFrameCount(int val) { frameCount_ = val; } - virtual int frameCount() const { return frameCount_; } - - virtual void setMotions(const std::vector &val) { motions_ = &val; } - virtual const std::vector& motions() const { return *motions_; } - - virtual void setMotions2(const std::vector &val) { motions2_ = &val; } - virtual const std::vector& motions2() const { return *motions2_; } - - virtual void setStabilizationMotions(const std::vector &val) { stabilizationMotions_ = &val; } - virtual const std::vector& stabilizationMotions() const { return *stabilizationMotions_; } - -protected: - Ptr motionEstimator_; - int frameCount_; - const std::vector *motions_; - const std::vector *motions2_; - const std::vector *stabilizationMotions_; -}; - -class CV_EXPORTS NullWobbleSuppressor : public WobbleSuppressorBase -{ -public: - virtual void suppress(int idx, const Mat &frame, Mat &result) CV_OVERRIDE; -}; - -class CV_EXPORTS MoreAccurateMotionWobbleSuppressorBase : public WobbleSuppressorBase -{ -public: - virtual void setPeriod(int val) { period_ = val; } - virtual int period() const { return period_; } - -protected: - MoreAccurateMotionWobbleSuppressorBase() { setPeriod(30); } - - int period_; -}; - -class CV_EXPORTS MoreAccurateMotionWobbleSuppressor : public MoreAccurateMotionWobbleSuppressorBase -{ -public: - virtual void suppress(int idx, const Mat &frame, Mat &result) CV_OVERRIDE; - -private: - Mat_ mapx_, mapy_; -}; - -#if defined(HAVE_OPENCV_CUDAWARPING) -class CV_EXPORTS MoreAccurateMotionWobbleSuppressorGpu : public MoreAccurateMotionWobbleSuppressorBase -{ -public: - void suppress(int idx, const cuda::GpuMat &frame, cuda::GpuMat &result); - virtual void suppress(int idx, const Mat &frame, Mat &result) CV_OVERRIDE; - -private: - cuda::GpuMat frameDevice_, resultDevice_; - cuda::GpuMat mapx_, mapy_; -}; -#endif - -//! @} - -} // namespace videostab -} // namespace cv - -#endif diff --git a/opencv/x64/bin/opencv_world346.dll b/opencv/x64/bin/opencv_world346.dll deleted file mode 100644 index 140a892..0000000 Binary files a/opencv/x64/bin/opencv_world346.dll and /dev/null differ diff --git a/opencv/x64/bin/opencv_world346d.dll b/opencv/x64/bin/opencv_world346d.dll deleted file mode 100644 index 8b0ad74..0000000 Binary files a/opencv/x64/bin/opencv_world346d.dll and /dev/null differ diff --git a/opencv/x64/lib/opencv_world346.lib b/opencv/x64/lib/opencv_world346.lib deleted file mode 100644 index 6457e94..0000000 Binary files a/opencv/x64/lib/opencv_world346.lib and /dev/null differ diff --git a/opencv/x64/lib/opencv_world346d.lib b/opencv/x64/lib/opencv_world346d.lib deleted file mode 100644 index 9eb4dea..0000000 Binary files a/opencv/x64/lib/opencv_world346d.lib and /dev/null differ diff --git a/opencv/x86/bin/opencv_world346.dll b/opencv/x86/bin/opencv_world346.dll deleted file mode 100644 index 2b0a2c6..0000000 Binary files a/opencv/x86/bin/opencv_world346.dll and /dev/null differ diff --git a/opencv/x86/bin/opencv_world346d.dll b/opencv/x86/bin/opencv_world346d.dll deleted file mode 100644 index a6d6fe5..0000000 Binary files a/opencv/x86/bin/opencv_world346d.dll and /dev/null differ diff --git a/opencv/x86/lib/opencv_world346.lib b/opencv/x86/lib/opencv_world346.lib deleted file mode 100644 index fe64404..0000000 Binary files a/opencv/x86/lib/opencv_world346.lib and /dev/null differ diff --git a/opencv/x86/lib/opencv_world346d.lib b/opencv/x86/lib/opencv_world346d.lib deleted file mode 100644 index c6828e4..0000000 Binary files a/opencv/x86/lib/opencv_world346d.lib and /dev/null differ diff --git a/pub/ddk/1394.h b/pub/ddk/1394.h deleted file mode 100644 index 4dce7ee..0000000 --- a/pub/ddk/1394.h +++ /dev/null @@ -1,2229 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - 1394.h - -Abstract: - - Definitions for 1394 drivers. - -Environment: - - Kernel mode only - ---*/ - -#ifndef _1394_H_ -#define _1394_H_ - -#if (_MSC_VER >= 1020) -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#if(NTDDI_VERSION >= NTDDI_WINXP) - -#define BUS1394_DDI_MAJOR_VERSION 3 -#define BUS1394_DDI_MINOR_VERSION 0 - -#define BUS1394_CURRENT_DDI_VERSION BUS1394_DDI_MAJOR_VERSION - -#endif - -// -// 1394 Additional NT DDK definitions. -// - -#define RCODE ULONG - -#define BASE_DEVICE_NAME L"\\Device\\1394BUS" -#define BASE_SYMBOLIC_LINK_NAME L"\\DosDevices\\1394BUS" - -// -// 1394 Node Address format. -// - -typedef struct _NODE_ADDRESS { - USHORT NA_Node_Number:6; // Bits 10-15 - USHORT NA_Bus_Number:10; // Bits 0-9 -} NODE_ADDRESS, *PNODE_ADDRESS; - -// -// 1394 Address Offset format (48 bit addressing). -// - -typedef struct _ADDRESS_OFFSET { - USHORT Off_High; - ULONG Off_Low; -} ADDRESS_OFFSET, *PADDRESS_OFFSET; - -// -// 1394 I/O Address format. -// - -typedef struct _IO_ADDRESS { - NODE_ADDRESS IA_Destination_ID; - ADDRESS_OFFSET IA_Destination_Offset; -} IO_ADDRESS, *PIO_ADDRESS; - -// -// 1394 Allocated Address Range format. -// - -typedef struct _ADDRESS_RANGE { - USHORT AR_Off_High; - USHORT AR_Length; - ULONG AR_Off_Low; -} ADDRESS_RANGE, *PADDRESS_RANGE; - -// -// 1394 Self ID packet format. -// - -typedef struct _SELF_ID { - ULONG SID_Phys_ID:6; // Byte 0 - Bits 0-5 - ULONG SID_Packet_ID:2; // Byte 0 - Bits 6-7 - ULONG SID_Gap_Count:6; // Byte 1 - Bits 0-5 - ULONG SID_Link_Active:1; // Byte 1 - Bit 6 - ULONG SID_Zero:1; // Byte 1 - Bit 7 - ULONG SID_Power_Class:3; // Byte 2 - Bits 0-2 - ULONG SID_Contender:1; // Byte 2 - Bit 3 - ULONG SID_Delay:2; // Byte 2 - Bits 4-5 - ULONG SID_Speed:2; // Byte 2 - Bits 6-7 - ULONG SID_More_Packets:1; // Byte 3 - Bit 0 - ULONG SID_Initiated_Rst:1; // Byte 3 - Bit 1 - ULONG SID_Port3:2; // Byte 3 - Bits 2-3 - ULONG SID_Port2:2; // Byte 3 - Bits 4-5 - ULONG SID_Port1:2; // Byte 3 - Bits 6-7 -} SELF_ID, *PSELF_ID; - -// -// Additional 1394 Self ID packet format (only used when More bit is on). -// - -typedef struct _SELF_ID_MORE { - ULONG SID_Phys_ID:6; // Byte 0 - Bits 0-5 - ULONG SID_Packet_ID:2; // Byte 0 - Bits 6-7 - ULONG SID_PortA:2; // Byte 1 - Bits 0-1 - ULONG SID_Reserved2:2; // Byte 1 - Bits 2-3 - ULONG SID_Sequence:3; // Byte 1 - Bits 4-6 - ULONG SID_One:1; // Byte 1 - Bit 7 - ULONG SID_PortE:2; // Byte 2 - Bits 0-1 - ULONG SID_PortD:2; // Byte 2 - Bits 2-3 - ULONG SID_PortC:2; // Byte 2 - Bits 4-5 - ULONG SID_PortB:2; // Byte 2 - Bits 6-7 - ULONG SID_More_Packets:1; // Byte 3 - Bit 0 - ULONG SID_Reserved3:1; // Byte 3 - Bit 1 - ULONG SID_PortH:2; // Byte 3 - Bits 2-3 - ULONG SID_PortG:2; // Byte 3 - Bits 4-5 - ULONG SID_PortF:2; // Byte 3 - Bits 6-7 -} SELF_ID_MORE, *PSELF_ID_MORE; - -// -// 1394 Phy Configuration packet format. -// - -typedef struct _PHY_CONFIGURATION_PACKET { - ULONG PCP_Phys_ID:6; // Byte 0 - Bits 0-5 - ULONG PCP_Packet_ID:2; // Byte 0 - Bits 6-7 - ULONG PCP_Gap_Count:6; // Byte 1 - Bits 0-5 - ULONG PCP_Set_Gap_Count:1; // Byte 1 - Bit 6 - ULONG PCP_Force_Root:1; // Byte 1 - Bit 7 - ULONG PCP_Reserved1:8; // Byte 2 - Bits 0-7 - ULONG PCP_Reserved2:8; // Byte 3 - Bits 0-7 - ULONG PCP_Inverse; // Inverse quadlet -} PHY_CONFIGURATION_PACKET, *PPHY_CONFIGURATION_PACKET; - -// -// 1394 Asynchronous packet format. -// - -typedef struct _ASYNC_PACKET { - USHORT AP_Priority:4; // Bits 0-3 1st quadlet - USHORT AP_tCode:4; // Bits 4-7 - USHORT AP_rt:2; // Bits 8-9 - USHORT AP_tLabel:6; // Bits 10-15 - NODE_ADDRESS AP_Destination_ID; // Bits 16-31 - union { // 2nd quadlet - struct { - USHORT AP_Reserved:12; // Bits 0-11 - USHORT AP_Rcode:4; // Bits 12-15 - } Response; - USHORT AP_Offset_High; // Bits 0-15 - } u; - NODE_ADDRESS AP_Source_ID; // Bits 16-31 - ULONG AP_Offset_Low; // Bits 0-31 3rd quadlet - union { // 4th quadlet - struct { - USHORT AP_Extended_tCode; // Bits 0-15 - USHORT AP_Data_Length; // Bits 16-31 - } Block; - ULONG AP_Quadlet_Data; // Bits 0-31 - } u1; - -} ASYNC_PACKET, *PASYNC_PACKET; - -// -// 1394 Isochronous packet header. -// - -typedef struct _ISOCH_HEADER { - ULONG IH_Sy:4; // Bits 0-3 - ULONG IH_tCode:4; // Bits 4-7 - ULONG IH_Channel:6; // Bits 8-13 - ULONG IH_Tag:2; // Bits 14-15 - ULONG IH_Data_Length:16; // Bits 16-31 -} ISOCH_HEADER, *PISOCH_HEADER; - -// -// 1394 Speed Map format. -// - -typedef struct _SPEED_MAP { - USHORT SPD_Length; // number of quadlets in map - USHORT SPD_CRC; // 16 bit CRC defined by 1212 - ULONG SPD_Generation; // Generation number - UCHAR SPD_Speed_Code[4032]; -} SPEED_MAP, *PSPEED_MAP; - -// -// 1394 Topology Map format. -// - -typedef struct _TOPOLOGY_MAP { - USHORT TOP_Length; // number of quadlets in map - USHORT TOP_CRC; // 16 bit CRC defined by 1212 - ULONG TOP_Generation; // Generation number - USHORT TOP_Node_Count; // Node count - USHORT TOP_Self_ID_Count; // Number of Self IDs - SELF_ID TOP_Self_ID_Array[1]; // Array of Self IDs -} TOPOLOGY_MAP, *PTOPOLOGY_MAP; - -// -// 1394 Config Rom Definitions. -// - -typedef struct _CONFIG_ROM { - - ULONG CR_Info; // 0x0 - ULONG CR_Signiture; // 0x4 // bus info block - ULONG CR_BusInfoBlockCaps; // 0x8 // " - ULONG CR_Node_UniqueID[2]; // 0xC // " - ULONG CR_Root_Info; // 0x14 - - // - // The rest is the root directory which has variable definition and length. - // - -} CONFIG_ROM, *PCONFIG_ROM; - -// -// 1394 Textual Leaf format. -// - -typedef struct _TEXTUAL_LEAF { - USHORT TL_CRC; // using 1994 CRC algorithm - USHORT TL_Length; // length of leaf in quads - ULONG TL_Spec_Id; // vendor defined - ULONG TL_Language_Id; // language Id - UCHAR TL_Data; // variable length data -} TEXTUAL_LEAF, *PTEXTUAL_LEAF; - -// -// 1394 Cycle Time format. -// - -typedef struct _CYCLE_TIME { - ULONG CL_CycleOffset:12; // Bits 0-11 - ULONG CL_CycleCount:13; // Bits 12-24 - ULONG CL_SecondCount:7; // Bits 25-31 -} CYCLE_TIME, *PCYCLE_TIME; - -// -// Definition of an Address Mapping FIFO element. -// - -typedef struct _ADDRESS_FIFO { - SLIST_ENTRY FifoList; // Singly linked list - PMDL FifoMdl; // Mdl for this FIFO element -} ADDRESS_FIFO, *PADDRESS_FIFO; - -// -// Information block the bus driver passes to the higher device drivers -// when the notification handler is called. -// - -typedef struct _NOTIFICATION_INFO_W2K { - PMDL Mdl; // Supplied by device driver - ULONG ulOffset; // Where in buffer - ULONG nLength; // How big is the operation - ULONG fulNotificationOptions; // Which option occurred - PVOID Context; // Device driver supplied - PADDRESS_FIFO Fifo; // FIFO that completed - PVOID RequestPacket; // Pointer to request packet - PMDL ResponseMdl; // Pointer to response MDL - PVOID * ResponsePacket; // Pointer to pointer to response packet - PULONG ResponseLength; // Pointer to length of response - PKEVENT * ResponseEvent; // Event to be signaled -} NOTIFICATION_INFO_W2K, *PNOTIFICATION_INFO_W2K; - -typedef struct _NOTIFICATION_INFO_WXP { - PMDL Mdl; // Supplied by device driver - ULONG ulOffset; // Where in buffer - ULONG nLength; // How big is the operation - ULONG fulNotificationOptions; // Which option occurred - PVOID Context; // Device driver supplied - PADDRESS_FIFO Fifo; // FIFO that completed - PVOID RequestPacket; // Pointer to request packet - PMDL ResponseMdl; // Pointer to response MDL - PVOID * ResponsePacket; // Pointer to pointer to response packet - PULONG ResponseLength; // Pointer to length of response - PKEVENT * ResponseEvent; // Event to be signaled - RCODE ResponseCode; // RCode to be returned for request -} NOTIFICATION_INFO_WXP, *PNOTIFICATION_INFO_WXP; - -#if(NTDDI_VERSION < NTDDI_WINXP) -typedef NOTIFICATION_INFO_W2K NOTIFICATION_INFO, *PNOTIFICATION_INFO; -#else -typedef NOTIFICATION_INFO_WXP NOTIFICATION_INFO, *PNOTIFICATION_INFO; -#endif - -#if(NTDDI_VERSION >= NTDDI_WIN7) - -// -// The size of the bus info block in bytes. -// - -#define BUS_INFO_BLOCK_SIZE 16 - -// -// Config Rom Header. -// - -typedef struct _CONFIG_ROM_HEADER { - ULONG Crc:16; - ULONG CrcLength:8; - ULONG InfoLength:8; -} CONFIG_ROM_HEADER, *PCONFIG_ROM_HEADER; - -// -// Config Rom Bus Information Capabilities. -// - -typedef struct _BUS_INFO_CAPABILITIES { - ULONG LinkSpeed:3; - ULONG Reserved0:1; - ULONG Generation:4; - ULONG MaxRom:2; - ULONG Reserved1:2; - ULONG MaxRec:4; - ULONG CycleClockAccuracy:8; - ULONG Reserved2:3; - ULONG PowerManagementCapable:1; - ULONG BusManagerCapable:1; - ULONG IsochCapable:1; - ULONG CycleMasterCapable:1; - ULONG IsochResourceManagerCapable:1; -} BUS_INFO_CAPABILITIES, *PBUS_INFO_CAPABILITIES; - -// -// Config Rom Bus Information Ids -// - -typedef struct _BUS_INFO_IDS { - ULONG ChipIdHigh:8; - ULONG NodeVendorId:24; -} BUS_INFO_IDS, *PBUS_INFO_IDS; - -// -// Directory Header. -// - -typedef struct _DIRECTORY_HEADER { - ULONG Crc:16; - ULONG Length:16; -} DIRECTORY_HEADER, *PDIRECTORY_HEADER; - -// -// Directory Entry. -// - -typedef struct _DIRECTORY_ENTRY { - ULONG Value:24; - ULONG KeyId:6; - ULONG KeyType:2; -} DIRECTORY_ENTRY, *PDIRECTORY_ENTRY; - -// -// Leaf Format. -// - -typedef struct _LEAF_FORMAT { - ULONG SpecifierId:24; - ULONG DescriptorType:8; -} LEAF_FORMAT, *PLEAF_FORMAT; - -// -// Textual Leaf Format. -// - -typedef struct _TEXTUAL_LEAF_FORMAT { - ULONG Language:16; - ULONG CharacterSet:12; - ULONG Width:4; -} TEXTUAL_LEAF_FORMAT, *PTEXTUAL_LEAF_FORMAT; - -// -// Directory Entries. -// - -typedef union _DIRECTORY_ENTRIES { - ULONG Quadlet; - DIRECTORY_HEADER Header; - DIRECTORY_ENTRY Entry; - LEAF_FORMAT LeafFormat; - TEXTUAL_LEAF_FORMAT TextualLeafFormat; -} DIRECTORY_ENTRIES, *PDIRECTORY_ENTRIES; - -// -// 1394 Config Rom. -// - -typedef struct _CROM { - - CONFIG_ROM_HEADER ConfigRomHeader; // @ 400 - - ULONG Signature; // @ 404 - - BUS_INFO_CAPABILITIES BusInfoCaps; // @ 408 - - BUS_INFO_IDS BusInfoIds; // @ 40C - - ULONG ChipIdLow; // @ 410 - - DIRECTORY_HEADER RootDirectoryHeader; // @ 414 - - DIRECTORY_ENTRIES Entries[250]; // @ 418 ... - -} CROM, *PCROM; - -#endif - -// -// Various definitions. -// - -#if(NTDDI_VERSION >= NTDDI_WINXP) -#include -DEFINE_GUID( BUS1394_CLASS_GUID, 0x6BDD1FC1, 0x810F, 0x11d0, 0xBE, 0xC7, 0x08, 0x00, 0x2B, 0xE2, 0x09, 0x2F); -#endif - -#define IOCTL_1394_CLASS CTL_CODE( \ - FILE_DEVICE_UNKNOWN, \ - 0x87, \ - METHOD_IN_DIRECT, \ - FILE_ANY_ACCESS \ - ) - -// -// 1394 Transaction codes. -// - -#define TCODE_WRITE_REQUEST_QUADLET 0 -#define TCODE_WRITE_REQUEST_BLOCK 1 -#define TCODE_WRITE_RESPONSE 2 -#define TCODE_RESERVED1 3 -#define TCODE_READ_REQUEST_QUADLET 4 -#define TCODE_READ_REQUEST_BLOCK 5 -#define TCODE_READ_RESPONSE_QUADLET 6 -#define TCODE_READ_RESPONSE_BLOCK 7 -#define TCODE_CYCLE_START 8 -#define TCODE_LOCK_REQUEST 9 -#define TCODE_ISOCH_DATA_BLOCK 10 -#define TCODE_LOCK_RESPONSE 11 -#define TCODE_RESERVED2 12 -#define TCODE_RESERVED3 13 -#define TCODE_PHY_PACKET 14 -#define TCODE_SELFID 14 -#define TCODE_RESERVED4 15 - -#define TCODE_REQUEST_BLOCK_MASK 1 -#define TCODE_RESPONSE_MASK 2 - -// -// 1394 Extended Transaction codes. -// - -#define EXT_TCODE_RESERVED0 0 -#define EXT_TCODE_MASK_SWAP 1 -#define EXT_TCODE_COMPARE_SWAP 2 -#define EXT_TCODE_FETCH_ADD 3 -#define EXT_TCODE_LITTLE_ADD 4 -#define EXT_TCODE_BOUNDED_ADD 5 -#define EXT_TCODE_WRAP_ADD 6 - -// -// 1394 Acknowledgement codes. -// - -#define ACODE_RESERVED_0 0 -#define ACODE_ACK_COMPLETE 1 -#define ACODE_ACK_PENDING 2 -#define ACODE_RESERVED_3 3 -#define ACODE_ACK_BUSY_X 4 -#define ACODE_ACK_BUSY_A 5 -#define ACODE_ACK_BUSY_B 6 -#define ACODE_RESERVED_7 7 -#define ACODE_RESERVED_8 8 -#define ACODE_RESERVED_9 9 -#define ACODE_RESERVED_10 10 -#define ACODE_ACK_TARDY 11 -#define ACODE_RESERVED_12 12 -#define ACODE_ACK_DATA_ERROR 13 -#define ACODE_ACK_TYPE_ERROR 14 -#define ACODE_RESERVED_15 15 - -// -// 1394 Ack code to NT status mask (to be OR'd in when completing IRPs). -// - -#define ACODE_STATUS_MASK ((NTSTATUS)0xC0120070L) - -// -// 1394 Response codes. -// - -#define RCODE_RESPONSE_COMPLETE 0 -#define RCODE_RESERVED1 1 -#define RCODE_RESERVED2 2 -#define RCODE_RESERVED3 3 -#define RCODE_CONFLICT_ERROR 4 -#define RCODE_DATA_ERROR 5 -#define RCODE_TYPE_ERROR 6 -#define RCODE_ADDRESS_ERROR 7 -#define RCODE_TIMED_OUT 15 - -// -// 1394 Response code to NT status mask (to be OR'd in when completing IRPs). -// - -#define RCODE_STATUS_MASK ((NTSTATUS)0xC0120080L) - -#if(NTDDI_VERSION < NTDDI_WINXP) -#define STATUS_INVALID_GENERATION ((NTSTATUS)0xC0128090L) -#else -#define STATUS_INVALID_GENERATION ((NTSTATUS)0xC0120090L) -#endif - -// -// 1394 Speed codes. -// - -#define SCODE_100_RATE 0 -#define SCODE_200_RATE 1 -#define SCODE_400_RATE 2 -#define SCODE_800_RATE 3 -#define SCODE_1600_RATE 4 -#define SCODE_3200_RATE 5 - -// -// 1394 Self ID definitions. -// - -#define SELF_ID_CONNECTED_TO_CHILD 3 -#define SELF_ID_CONNECTED_TO_PARENT 2 -#define SELF_ID_NOT_CONNECTED 1 -#define SELF_ID_NOT_PRESENT 0 - -// -// 1394 Self ID Power Class definitions. -// - -#define POWER_CLASS_NOT_NEED_NOT_REPEAT 0 -#define POWER_CLASS_SELF_POWER_PROVIDE_15W 1 -#define POWER_CLASS_SELF_POWER_PROVIDE_30W 2 -#define POWER_CLASS_SELF_POWER_PROVIDE_45W 3 -#define POWER_CLASS_MAYBE_POWERED_UPTO_1W 4 -#define POWER_CLASS_IS_POWERED_UPTO_1W_NEEDS_2W 5 -#define POWER_CLASS_IS_POWERED_UPTO_1W_NEEDS_5W 6 -#define POWER_CLASS_IS_POWERED_UPTO_1W_NEEDS_9W 7 - -// -// 1394 Phy Packet Ids. -// - -#define PHY_PACKET_ID_CONFIGURATION 0 -#define PHY_PACKET_ID_LINK_ON 1 -#define PHY_PACKET_ID_SELF_ID 2 - -// -// Various Interesting 1394 IEEE 1212 locations. -// - -#define INITIAL_REGISTER_SPACE_HI 0xffff -#define INITIAL_REGISTER_SPACE_LO 0xf0000000 -#define STATE_CLEAR_LOCATION 0x000 -#define STATE_SET_LOCATION 0x004 -#define NODE_IDS_LOCATION 0x008 -#define RESET_START_LOCATION 0x00C -#define SPLIT_TIMEOUT_HI_LOCATION 0x018 -#define SPLIT_TIMEOUT_LO_LOCATION 0x01C -#define INTERRUPT_TARGET_LOCATION 0x050 -#define INTERRUPT_MASK_LOCATION 0x054 -#define CYCLE_TIME_LOCATION 0x200 -#define BUS_TIME_LOCATION 0x204 -#define POWER_FAIL_IMMINENT_LOCATION 0x208 -#define POWER_SOURCE_LOCATION 0x20C -#define BUSY_TIMEOUT_LOCATION 0x210 -#define BUS_MANAGER_ID_LOCATION 0x21C -#define BANDWIDTH_AVAILABLE_LOCATION 0x220 -#define CHANNELS_AVAILABLE_LOCATION 0x224 -#define NETWORK_CHANNELS_LOCATION 0x234 -#define CONFIG_ROM_LOCATION 0x400 -#define TOPOLOGY_MAP_LOCATION 0x1000 -#define SPEED_MAP_LOCATION 0x2000 - -// -// 1394 Configuration key values and masks. -// - -#define CONFIG_ROM_KEY_MASK 0x000000ff -#define CONFIG_ROM_OFFSET_MASK 0xffffff00 -#define MODULE_VENDOR_ID_KEY_SIGNATURE 0x03 -#define NODE_CAPABILITIES_KEY_SIGNATURE 0x0c -#define SPEC_ID_KEY_SIGNATURE 0x12 -#define SOFTWARE_VERSION_KEY_SIGNATURE 0x13 -#define MODEL_ID_KEY_SIGNATURE 0x17 -#define EXTENDED_SPECIFIER_ID_KEY_SIGNATURE 0x1C -#define EXTENDED_KEY_SIGNATURE 0x1D -#define EXTENDED_DATA_KEY_SIGNATURE 0x1E - -#define COMMAND_BASE_KEY_SIGNATURE 0x40 -#define VENDOR_KEY_SIGNATURE 0x81 -#define TEXTUAL_LEAF_INDIRECT_KEY_SIGNATURE 0x81 - -#define MODEL_KEY_SIGNATURE 0x82 -#define UNIT_DIRECTORY_KEY_SIGNATURE 0xd1 -#define UNIT_DEP_DIR_KEY_SIGNATURE 0xd4 - -// -// IEEE 1212-2001 Key Type Definitions. -// - -#define IEEE1212_KEY_TYPE_IMMEDIATE 0 -#define IEEE1212_KEY_TYPE_OFFSET 1 -#define IEEE1212_KEY_TYPE_LEAF 2 -#define IEEE1212_KEY_TYPE_DIRECTORY 3 - -// -// IEEE 1212-2001 Key Id Definitions. -// - -#define IEEE1212_KEY_ID_DESCRIPTOR 0x01 -#define IEEE1212_KEY_ID_VENDOR 0x03 -#define IEEE1212_KEY_ID_UNIT 0x11 -#define IEEE1212_KEY_ID_SPECIFIER_ID 0x12 -#define IEEE1212_KEY_ID_VERSION 0x13 -#define IEEE1212_KEY_ID_DEPENDENT_INFO 0x14 -#define IEEE1212_KEY_ID_MODEL 0x17 -#define IEEE1212_KEY_ID_EXTENDED_KEY_SPEC_ID 0x1C -#define IEEE1212_KEY_ID_EXTENDED_KEY 0x1D -#define IEEE1212_KEY_ID_EXTENDED_DATA 0x1E - -// -// 1394 Async Data Payload Sizes. -// - -#define ASYNC_PAYLOAD_100_RATE 512 -#define ASYNC_PAYLOAD_200_RATE 1024 -#define ASYNC_PAYLOAD_400_RATE 2048 -#define ASYNC_PAYLOAD_800_RATE 4096 -#define ASYNC_PAYLOAD_1600_RATE 4096 -#define ASYNC_PAYLOAD_3200_RATE 4096 - - -// -// 1394 Isoch Data Payload Sizes. -// - -#define ISOCH_PAYLOAD_100_RATE 1024 -#define ISOCH_PAYLOAD_200_RATE 2048 -#define ISOCH_PAYLOAD_400_RATE 4096 -#define ISOCH_PAYLOAD_800_RATE 8192 -#define ISOCH_PAYLOAD_1600_RATE 16384 -#define ISOCH_PAYLOAD_3200_RATE 32768 - -// -// Various definitions. -// - -#define S100_BW_UNITS_PER_QUADLET 19 -#define S200_BW_UNITS_PER_QUADLET 9 -#define S400_BW_UNITS_PER_QUADLET 4 -#define S800_BW_UNITS_PER_QUADLET 2 -#define S1600_BW_UNITS_PER_QUADLET 1 - -#define INITIAL_BANDWIDTH_UNITS 4915 // Initial bandwidth units - -#define MAX_REC_100_RATE 0x08 -#define MAX_REC_200_RATE 0x09 -#define MAX_REC_400_RATE 0x0a - -#define LOCAL_BUS 0x3ff -#define MAX_LOCAL_NODES 64 -#define SELFID_PACKET_SIGNITURE 2 -#define NOMINAL_CYCLE_TIME 125 // Microseconds -#define NO_BUS_MANAGER 0x3f - -#define CONFIG_ROM_SIGNATURE 0x31333934 - -// -// IRB function number definitions. -// - -#define REQUEST_ASYNC_READ 0 -#define REQUEST_ASYNC_WRITE 1 -#define REQUEST_ASYNC_LOCK 2 -#define REQUEST_ISOCH_ALLOCATE_BANDWIDTH 3 -#define REQUEST_ISOCH_ALLOCATE_CHANNEL 4 -#define REQUEST_ISOCH_ALLOCATE_RESOURCES 5 -#define REQUEST_ISOCH_ATTACH_BUFFERS 6 -#define REQUEST_ISOCH_DETACH_BUFFERS 7 -#define REQUEST_ISOCH_FREE_BANDWIDTH 8 -#define REQUEST_ISOCH_FREE_CHANNEL 9 -#define REQUEST_ISOCH_FREE_RESOURCES 10 -#define REQUEST_ISOCH_LISTEN 11 -#define REQUEST_ISOCH_STOP 12 -#define REQUEST_ISOCH_TALK 13 -#define REQUEST_ISOCH_QUERY_CYCLE_TIME 14 -#define REQUEST_ISOCH_QUERY_RESOURCES 15 -#define REQUEST_ISOCH_SET_CHANNEL_BANDWIDTH 16 -#define REQUEST_ALLOCATE_ADDRESS_RANGE 17 -#define REQUEST_FREE_ADDRESS_RANGE 18 -#define REQUEST_GET_LOCAL_HOST_INFO 19 -#define REQUEST_GET_ADDR_FROM_DEVICE_OBJECT 20 -#define REQUEST_CONTROL 21 -#define REQUEST_GET_SPEED_BETWEEN_DEVICES 22 -#define REQUEST_SET_DEVICE_XMIT_PROPERTIES 23 -#define REQUEST_GET_CONFIGURATION_INFO 24 -#define REQUEST_BUS_RESET 25 -#define REQUEST_GET_GENERATION_COUNT 26 -#define REQUEST_SEND_PHY_CONFIG_PACKET 27 -#define REQUEST_GET_SPEED_TOPOLOGY_MAPS 28 -#define REQUEST_BUS_RESET_NOTIFICATION 29 -#define REQUEST_ASYNC_STREAM 30 -#define REQUEST_SET_LOCAL_HOST_PROPERTIES 31 - -#if(NTDDI_VERSION >= NTDDI_WINXP) -#define REQUEST_ISOCH_MODIFY_STREAM_PROPERTIES 32 -#endif - -#if(NTDDI_VERSION >= NTDDI_WIN7) -#define REQUEST_SEND_PHY_PACKET 33 -#define REQUEST_RECEIVE_PHY_PACKETS 34 -#define REQUEST_GET_CONFIG_ROM 35 -#endif - -typedef -__drv_requiresIRQL(DISPATCH_LEVEL) -void -(*PBUS_NOTIFICATION_ROUTINE) ( - __in PNOTIFICATION_INFO NotificationInfo - ); - -typedef -__drv_requiresIRQL(DISPATCH_LEVEL) -void -(*PBUS_ISOCH_DESCRIPTOR_ROUTINE) ( - __in PVOID Context1, - __in PVOID Context2 - ); - -#if(NTDDI_VERSION >= NTDDI_WIN7) - -typedef struct _BUS_RESET_DATA { - PVOID ResetContext; - ULONG GenerationCount; - NODE_ADDRESS DeviceNodeId; - NODE_ADDRESS LocalNodeId; - UCHAR SpeedToNode; -} BUS_RESET_DATA, *PBUS_RESET_DATA; - -#endif - -typedef -__drv_requiresIRQL(DISPATCH_LEVEL) -void -(*PBUS_BUS_RESET_NOTIFICATION)( - __in PVOID Context - ); - -// -// Definition of Isoch Descriptor. -// - -typedef struct _ISOCH_DESCRIPTOR { - - // - // Flags (used in synchronization). - // - - ULONG fulFlags; - - // - // Mdl pointing to buffer. - // - - PMDL Mdl; - - // - // Length of combined buffer(s) as represented by the Mdl. - // - - ULONG ulLength; - - // - // Payload size of each Isoch packet to be used in this descriptor. - // - - ULONG nMaxBytesPerFrame; - - // - // Synchronization field; equivalent to Sy in the Isoch packet. - // - - ULONG ulSynch; - - // - // Synchronization field; equivalent to Tag in the Isoch packet. - // - - ULONG ulTag; - - // - // Cycle time field; returns time to be sent/received or when finished. - // - - CYCLE_TIME CycleTime; - - // - // Callback routine (if any) to be called when this descriptor completes. - // - - PBUS_ISOCH_DESCRIPTOR_ROUTINE Callback; - - // - // First context (if any) parameter to be passed when doing callbacks. - // - - PVOID Context1; - - // - // Second context (if any) parameter to be passed when doing callbacks. - // - - PVOID Context2; - - // - // Holds the final status of this descriptor. - // - - NTSTATUS status; - - // - // Reserved for the device driver who submitted this descriptor to - // stomp in. - // - - ULONG_PTR DeviceReserved[8]; - - // - // Reserved for the bus driver to stomp in. - // - - ULONG_PTR BusReserved[8]; - - // - // Reserved for the port driver to stomp in. - // - - ULONG_PTR PortReserved[16]; - -} ISOCH_DESCRIPTOR, *PISOCH_DESCRIPTOR; - -// -// Definition of header element for scatter/gather support. -// - -typedef struct _IEEE1394_SCATTER_GATHER_HEADER{ - - USHORT HeaderLength; - USHORT DataLength; - UCHAR HeaderData; - -} IEEE1394_SCATTER_GATHER_HEADER, *PIEEE1394_SCATTER_GATHER_HEADER; - -// -// Fields necessary in order for the 1394 stack to carry out an -// AsyncRead request. -// - -typedef struct _IRB_REQ_ASYNC_READ { - IO_ADDRESS DestinationAddress; // Address to read from - ULONG nNumberOfBytesToRead; // Bytes to read - ULONG nBlockSize; // Block size of read - ULONG fulFlags; // Flags pertinent to read - PMDL Mdl; // Destination buffer - ULONG ulGeneration; // Generation as known by driver - UCHAR chPriority; // Priority to send - UCHAR nSpeed; // Speed at which to send - UCHAR tCode; // Type of Read to do - UCHAR Reserved; // Used to determine medium delay - ULONG ElapsedTime; // Only valid for flag ASYNC_FLAGS_PING - // units in nano secs.. -} IRB_REQ_ASYNC_READ; - -// -// Fields necessary in order for the 1394 stack to carry out an -// AsyncWrite request. -// - -typedef struct _IRB_REQ_ASYNC_WRITE { - IO_ADDRESS DestinationAddress; // Address to write to - ULONG nNumberOfBytesToWrite; // Bytes to write - ULONG nBlockSize; // Block size of write - ULONG fulFlags; // Flags pertinent to write - PMDL Mdl; // Destination buffer - ULONG ulGeneration; // Generation as known by driver - UCHAR chPriority; // Priority to send - UCHAR nSpeed; // Speed at which to send - UCHAR tCode; // Type of Write to do - UCHAR Reserved; // Reserved for future use - ULONG ElapsedTime; // Only valid for flag ASYNC_FLAGS_PING -} IRB_REQ_ASYNC_WRITE; - -// -// Fields necessary in order for the 1394 stack to carry out an -// AsyncLock request. -// - -typedef struct _IRB_REQ_ASYNC_LOCK { - IO_ADDRESS DestinationAddress; // Address to lock to - ULONG nNumberOfArgBytes; // Bytes in Arguments - ULONG nNumberOfDataBytes; // Bytes in DataValues - ULONG fulTransactionType; // Lock transaction type - ULONG fulFlags; // Flags pertinent to lock - ULONG Arguments[2]; // Arguments used in Lock - ULONG DataValues[2]; // Data values - PVOID pBuffer; // Destination buffer (virtual address) - ULONG ulGeneration; // Generation as known by driver - UCHAR chPriority; // Priority to send - UCHAR nSpeed; // Speed at which to send - UCHAR tCode; // Type of Lock to do - UCHAR Reserved; // Reserved for future use -} IRB_REQ_ASYNC_LOCK; - -// -// Fields necessary in order for the Bus driver to carry out an -// IsochAllocateBandwidth request. -// - -typedef struct _IRB_REQ_ISOCH_ALLOCATE_BANDWIDTH { - ULONG nMaxBytesPerFrameRequested; // Bytes per Isoch frame - ULONG fulSpeed; // Speed flags - HANDLE hBandwidth; // bandwidth handle returned - ULONG BytesPerFrameAvailable; // Available bytes per frame - ULONG SpeedSelected; // Speed to be used - ULONG nBandwidthUnitsRequired; // pre-calculated value -} IRB_REQ_ISOCH_ALLOCATE_BANDWIDTH; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochAllocateChannel request. -// - -typedef struct _IRB_REQ_ISOCH_ALLOCATE_CHANNEL { - ULONG nRequestedChannel; // Need a specific channel - ULONG Channel; // Returned channel - LARGE_INTEGER ChannelsAvailable; // Channels available -} IRB_REQ_ISOCH_ALLOCATE_CHANNEL; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochAllocateResources request -// Instructions: -// Receive alloc: -// fulSpeed - should be the max speed the tx side is expected to stream -// The payload size in nMaxBytesPerFram cannot exceed the max payload for -// for this speed. -// fulFlags - For receive, wtih the standard header stripped, the field should -// be = (RESOURCE_USED_IN_LISTEN | RESOURCES_STRIP_ADDITIONAL_QUADLETS) -// Also nQuadletsToStrip = 1 -// For no stripping set nQuadsTostrip to 0 and dont specify the stripping flag. -// nMaxBytesPerframe - If not stripping it should include the 8 bytes for header/trailer -// expected to be recieved for each packet. -// nNumberOfBuffer - see below -// nMaxBufferSize - This should be always such mode(nMaxBufferSize,nMaxBytesPerFrame) == 0 -// (integer product of number of bytes per packet). -// nQuadletsTostrip - If stripping only one quadlet (standrd iso header) this is set to 1 -// if zero, the isoch header will be included AND the trailer. So 8 bytes extra will be recieved -// hResource - see below -// - -typedef struct _IRB_REQ_ISOCH_ALLOCATE_RESOURCES_W2K { - ULONG fulSpeed; // Speed flags - ULONG fulFlags; // Flags - ULONG nChannel; // Channel to be used - ULONG nMaxBytesPerFrame; // Expected size of Isoch frame - ULONG nNumberOfBuffers; // Number of buffer(s) that will be attached - ULONG nMaxBufferSize; // Max size of buffer(s) - ULONG nQuadletsToStrip; // Number striped from start of every packet - HANDLE hResource; // handle to Resource -} IRB_REQ_ISOCH_ALLOCATE_RESOURCES_W2K; - -typedef struct _IRB_REQ_ISOCH_ALLOCATE_RESOURCES_WXP { - ULONG fulSpeed; // Speed flags - ULONG fulFlags; // Flags - ULONG nChannel; // Channel to be used - ULONG nMaxBytesPerFrame; // Expected size of Isoch frame - ULONG nNumberOfBuffers; // Number of buffer(s) that will be attached - ULONG nMaxBufferSize; // Max size of buffer(s) - ULONG nQuadletsToStrip; // Number striped from start of every packet - HANDLE hResource; // handle to Resource - ULARGE_INTEGER ChannelMask; // channel mask for multi-channel recv -} IRB_REQ_ISOCH_ALLOCATE_RESOURCES_WXP; - -#if(NTDDI_VERSION < NTDDI_WINXP) -typedef IRB_REQ_ISOCH_ALLOCATE_RESOURCES_W2K IRB_REQ_ISOCH_ALLOCATE_RESOURCES; -#else -typedef IRB_REQ_ISOCH_ALLOCATE_RESOURCES_WXP IRB_REQ_ISOCH_ALLOCATE_RESOURCES; -#endif - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochAttachBuffers request. -// Note that pIsochDescriptor->UlLength must be an integer product of -// pIsochDescriptor->nBytesMaxPerFrame. -// - -typedef struct _IRB_REQ_ISOCH_ATTACH_BUFFERS { - HANDLE hResource; // Resource handle - ULONG nNumberOfDescriptors; // Number to attach - PISOCH_DESCRIPTOR pIsochDescriptor; // Pointer to start of Isoch descriptors -} IRB_REQ_ISOCH_ATTACH_BUFFERS; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochDetachBuffers request. -// - -typedef struct _IRB_REQ_ISOCH_DETACH_BUFFERS { - HANDLE hResource; // Resource handle - ULONG nNumberOfDescriptors; // Number to detach - PISOCH_DESCRIPTOR pIsochDescriptor; // Pointer to Isoch descriptors -} IRB_REQ_ISOCH_DETACH_BUFFERS; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochFreeBandwidth request. -// - -typedef struct _IRB_REQ_ISOCH_FREE_BANDWIDTH { - HANDLE hBandwidth; // Bandwidth handle to release - ULONG nMaxBytesPerFrameRequested; // Bytes per Isoch frame - ULONG fulSpeed; // Speed flags - ULONG BytesPerFrameAvailable; // this is not used - ULONG SpeedSelected; // this is not used - ULONG nBandwidthUnitsRequired; // pre-calculated value -} IRB_REQ_ISOCH_FREE_BANDWIDTH; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochFreeChannel request. -// - -typedef struct _IRB_REQ_ISOCH_FREE_CHANNEL { - ULONG nChannel; // Channel to release -} IRB_REQ_ISOCH_FREE_CHANNEL; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochFreeResources request. -// - -typedef struct _IRB_REQ_ISOCH_FREE_RESOURCES { - HANDLE hResource; // Resource handle -} IRB_REQ_ISOCH_FREE_RESOURCES; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochListen request. -// - -typedef struct _IRB_REQ_ISOCH_LISTEN { - HANDLE hResource; // Resource handle to listen on - ULONG fulFlags; // Flags - CYCLE_TIME StartTime; // Cycle time to start -} IRB_REQ_ISOCH_LISTEN; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochQueryCurrentCycleTime request. -// - -typedef struct _IRB_REQ_ISOCH_QUERY_CURRENT_CYCLE_TIME { - CYCLE_TIME CycleTime; // Current cycle time returned -} IRB_REQ_ISOCH_QUERY_CURRENT_CYCLE_TIME; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochQueryResources request. -// - -typedef struct _IRB_REQ_ISOCH_QUERY_RESOURCES { - ULONG fulSpeed; // Speed flags - ULONG BytesPerFrameAvailable; // Per Isoch Frame - LARGE_INTEGER ChannelsAvailable; // Available channels -} IRB_REQ_ISOCH_QUERY_RESOURCES; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochSetChannelBandwidth request. -// - -typedef struct _IRB_REQ_ISOCH_SET_CHANNEL_BANDWIDTH { - HANDLE hBandwidth; // Bandwidth handle - ULONG nMaxBytesPerFrame; // bytes per Isoch frame - ULONG nBandwidthUnitsRequired; // pre-calculated value -} IRB_REQ_ISOCH_SET_CHANNEL_BANDWIDTH; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochStop request. -// - -typedef struct _IRB_REQ_ISOCH_STOP { - HANDLE hResource; // Resource handle to stop on - ULONG fulFlags; // Flags -} IRB_REQ_ISOCH_STOP; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochTalk request. -// - -typedef struct _IRB_REQ_ISOCH_TALK { - HANDLE hResource; // Resource handle to talk on - ULONG fulFlags; // Flags - CYCLE_TIME StartTime; // Cycle time to start -} IRB_REQ_ISOCH_TALK; - -// -// Fields necessary in order for the Bus driver to carry out a -// IsochModifyStreamProperties request. -// This request is used to dynamicaly change the properties of an allocated -// resource, without the need to free and re-allocate the resource. -// The resource must NOT be streaming when this is issued. The caller should -// issue an ISOCH_STOP first and then an isoch start. Also no buffer can be -// pending after the ISOCH_STOP and before this call is made. -// - -typedef struct _IRB_REQ_ISOCH_MODIFY_STREAM_PROPERTIES { - HANDLE hResource; // Resource handle - ULARGE_INTEGER ChannelMask; // New channels to tx/rx on - ULONG fulSpeed; // New speed -} IRB_REQ_ISOCH_MODIFY_STREAM_PROPERTIES; - -// -// Fields necessary in order for the 1394 stack to carry out an -// AllocateAddressRange request. -// Note: -// if the allocation is specified with no notification options and no RequiredOffset -// the returned address will ALWAYS be a physical address (on ohci). -// As a result these rules apply: -// Allocation - If Callback and Context is specified, since no notification is used -// the callback will be used to notify the caller that the allocation is complete. -// This way the issuer of the alloc doe snot have have to block but instead his callback -// routine will be called asynchronously when this is complete -// The caller must create this irb as usual but instead use the physical mapping routine -// provided by the por driver, in order to usee this request. If it uses IoCallDriver -// the caller cannot specif Context/Callback for a physical address, and he/she has to block. -// - -typedef struct _IRB_REQ_ALLOCATE_ADDRESS_RANGE { - PMDL Mdl; // Address to map to 1394 space - ULONG fulFlags; // Flags for this operation - ULONG nLength; // Length of 1394 space desired - ULONG MaxSegmentSize; // Maximum segment size for a single address element - ULONG fulAccessType; // Desired access: R, W, L - ULONG fulNotificationOptions; // Notify options on Async access - PVOID Callback; // Pointer to callback routine - PVOID Context; // Pointer to driver supplied data - ADDRESS_OFFSET Required1394Offset; // Offset that must be returned - PSLIST_HEADER FifoSListHead; // Pointer to SList FIFO head - PKSPIN_LOCK FifoSpinLock; // Pointer to SList Spin Lock - ULONG AddressesReturned; // Number of addresses returned - PADDRESS_RANGE p1394AddressRange; // Pointer to returned 1394 Address Ranges - HANDLE hAddressRange; // Handle to address range - PVOID DeviceExtension; // Device Extension who created this mapping -} IRB_REQ_ALLOCATE_ADDRESS_RANGE; - -// -// Fields necessary in order for the 1394 stack to carry out a -// FreeAddressRange request. -// - -typedef struct _IRB_REQ_FREE_ADDRESS_RANGE { - ULONG nAddressesToFree; // Number of Addresses to free - PADDRESS_RANGE p1394AddressRange; // Array of 1394 Address Ranges to Free - PHANDLE pAddressRange; // Array of Handles to address range - PVOID DeviceExtension; // Device Extension who created this mapping -} IRB_REQ_FREE_ADDRESS_RANGE; - -// -// Fields necessary in order for the Bus driver to carry out a -// GetLocalHostInformation request. -// All levels ans structures are descrived below. -// - -typedef struct _IRB_REQ_GET_LOCAL_HOST_INFORMATION { - ULONG nLevel; // level of info requested - PVOID Information; // returned information -} IRB_REQ_GET_LOCAL_HOST_INFORMATION; - -// -// Fields necessary in order for the Bus driver to carry out a -// Get1394AddressFromDeviceObject request. -// - -typedef struct _IRB_REQ_GET_1394_ADDRESS_FROM_DEVICE_OBJECT { - ULONG fulFlags; // Flags - NODE_ADDRESS NodeAddress; // Returned Node address -} IRB_REQ_GET_1394_ADDRESS_FROM_DEVICE_OBJECT; - -// -// Fields necessary in order for the Bus driver to carry out a -// Control request. -// - -typedef struct _IRB_REQ_CONTROL { - ULONG ulIoControlCode; // Control code - PMDL pInBuffer; // Input buffer - ULONG ulInBufferLength; // Input buffer length - PMDL pOutBuffer; // Output buffer - ULONG ulOutBufferLength; // Output buffer length - ULONG BytesReturned; // Bytes returned -} IRB_REQ_CONTROL; - -// -// Fields necessary in order for the Bus driver to carry out a -// GetMaxSpeedBetweenDevices request. -// - -typedef struct _IRB_REQ_GET_MAX_SPEED_BETWEEN_DEVICES { - ULONG fulFlags; // Flags - ULONG ulNumberOfDestinations; // Number of destinations - PDEVICE_OBJECT hDestinationDeviceObjects[64]; // Destinations - ULONG fulSpeed; // Max speed returned -} IRB_REQ_GET_MAX_SPEED_BETWEEN_DEVICES; - -// -// Fields necessary in order for the Bus driver to carry out a -// SetDeviceXmitProperties request. -// - -typedef struct _IRB_REQ_SET_DEVICE_XMIT_PROPERTIES { - ULONG fulSpeed; // Speed - ULONG fulPriority; // Priority -} IRB_REQ_SET_DEVICE_XMIT_PROPERTIES; - -// -// Fields necessary in order for the Bus driver to carry out a -// SetPortProperties request. -// - -typedef struct _IRB_REQ_SET_LOCAL_HOST_PROPERTIES { - ULONG nLevel; - PVOID Information; -} IRB_REQ_SET_LOCAL_HOST_PROPERTIES; - -// -// Fields necessary in order for the Bus driver to carry out a -// GetConfigurationInformation request. -// - -typedef struct _IRB_REQ_GET_CONFIGURATION_INFORMATION { - PCONFIG_ROM ConfigRom; // Pointer to config rom - ULONG UnitDirectoryBufferSize; - PVOID UnitDirectory; // Pointer to unit directory - IO_ADDRESS UnitDirectoryLocation; // Starting Location of Unit Directory - ULONG UnitDependentDirectoryBufferSize; - PVOID UnitDependentDirectory; - IO_ADDRESS UnitDependentDirectoryLocation; - ULONG VendorLeafBufferSize; // Size available to get vendor leafs - PTEXTUAL_LEAF VendorLeaf; // Pointer to vendor leafs - ULONG ModelLeafBufferSize; // Size available to get model leafs - PTEXTUAL_LEAF ModelLeaf; // Pointer to model leafs - -} IRB_REQ_GET_CONFIGURATION_INFORMATION; - -#if(NTDDI_VERSION >= NTDDI_WIN7) - -// -// Fields necessary in order for the Bus driver to carry out a -// GetConfigRom request. -// - -typedef struct _IRB_REQ_GET_CONFIG_ROM { - ULONG GenerationCount; - PCROM ConfigRom; - ULONG UnitDirectoryIndex; - ULONG UnitDependentDirectoryIndex; - ULONG VendorLeafIndex; - ULONG ModelLeafIndex; -} IRB_REQ_GET_CONFIG_ROM; - -#endif - -// -// Fields necessary in order for the Bus driver to carry out a -// BusReset request. -// - -typedef struct _IRB_REQ_BUS_RESET { - ULONG fulFlags; // Flags for Bus Reset -} IRB_REQ_BUS_RESET; - -// -// Fields necessary in order for the Bus driver to carry out a -// GetGenerationCount request. -// - -typedef struct _IRB_REQ_GET_GENERATION_COUNT { - ULONG GenerationCount; // generation count -} IRB_REQ_GET_GENERATION_COUNT; - -// -// Fields necessary in order for the Bus driver to carry out a -// SendPhyConfigurationPacket request. -// - -typedef struct _IRB_REQ_SEND_PHY_CONFIGURATION_PACKET { - PHY_CONFIGURATION_PACKET PhyConfigurationPacket; // Phy packet -} IRB_REQ_SEND_PHY_CONFIGURATION_PACKET; - -#if(NTDDI_VERSION >= NTDDI_WIN7) - -// -// Fields necessary in order to send a phy packet. -// - -typedef struct _IRB_REQ_SEND_PHY_PACKET { - ULONG Flags; - ULONG GenerationCount; - ULARGE_INTEGER PhyPacket; -} IRB_REQ_SEND_PHY_PACKET; - -// -// Parameters used for register phy packet notification. -// - -#define REGISTER_PHY_PACKET_NOTIFICATION 0x00000001 -#define DEREGISTER_PHY_PACKET_NOTIFICATION 0x00000002 - -typedef -__drv_requiresIRQL(DISPATCH_LEVEL) -void -(*PBUS_PHY_PACKET_NOTIFICATION)( - __in PVOID Context, - __in ULONG GenerationCount, - __in ULARGE_INTEGER PhyPacket - ); - -// -// Fields necessary in order to receive phy packets. -// - -typedef struct _IRB_RECEIVE_PHY_PACKETS { - ULONG Flags; - PBUS_PHY_PACKET_NOTIFICATION PhyPacketRoutine; - PVOID PhyPacketContext; -} IRB_REQ_RECEIVE_PHY_PACKETS; - -#endif - -// -// Fields necessary in order for the Bus driver to carry out a -// GetSpeedTopologyMaps request. -// The topology map and speed map are in big endian. -// - -typedef struct _IRB_REQ_GET_SPEED_TOPOLOGY_MAPS { - PSPEED_MAP SpeedMap; - PTOPOLOGY_MAP TopologyMap; -} IRB_REQ_GET_SPEED_TOPOLOGY_MAPS; - -// -// Fields necessary in order for the Bus driver to carry out a -// BusResetNotification request. -// This is the suggested method for a client driver on top of 1394bus, to get notified -// about 1394 bus resets. The client register by using this IRB, in its START_DEVICE -// routine and de-registers using the same IRB (but different flags) in its REMOVE routine -// This notification will ONLY be issued if after the bus reset, the target device is -// STILL present on the bus. This way the caller does not have to verify its existence. -// - -typedef struct _IRB_REQ_BUS_RESET_NOTIFICATION { - ULONG fulFlags; - PBUS_BUS_RESET_NOTIFICATION ResetRoutine; - PVOID ResetContext; -} IRB_REQ_BUS_RESET_NOTIFICATION; - -// -// Fields necessary in order for the Bus driver to carry out a -// AsyncStream request. -// - -typedef struct _IRB_REQ_ASYNC_STREAM { - ULONG nNumberOfBytesToStream; // Bytes to stream - ULONG fulFlags; // Flags pertinent to stream - PMDL Mdl; // Source buffer - ULONG ulTag; // Tag - ULONG nChannel; // Channel - ULONG ulSynch; // Sy - ULONG Reserved; // Reserved for future use - UCHAR nSpeed; -} IRB_REQ_ASYNC_STREAM; - -// -// IEEE 1394 Request Block definition (IRB). IRBs are the basis of how other -// device drivers communicate with the 1394 Bus driver. -// - -#define IRB_BUS_RESERVED_SZ 8 -#define IRB_PORT_RESERVED_SZ 8 - -typedef struct _IRB { - - // - // Holds the zero based Function number that corresponds to the request - // that device drivers are asking the 1394 Bus driver to carry out. - // - - ULONG FunctionNumber; - - // - // Holds Flags that may be unique to this particular operation. - // - - ULONG Flags; - - // - // Reserved for internal bus driver use and/or future expansion. - // - - ULONG_PTR BusReserved[IRB_BUS_RESERVED_SZ]; - - // - // Reserved for internal port driver usage. - // - - ULONG_PTR PortReserved[IRB_PORT_RESERVED_SZ]; - - // - // Holds the structures used in performing the various 1394 APIs. - // - - union { - - IRB_REQ_ASYNC_READ AsyncRead; - IRB_REQ_ASYNC_WRITE AsyncWrite; - IRB_REQ_ASYNC_LOCK AsyncLock; - IRB_REQ_ISOCH_ALLOCATE_BANDWIDTH IsochAllocateBandwidth; - IRB_REQ_ISOCH_ALLOCATE_CHANNEL IsochAllocateChannel; - IRB_REQ_ISOCH_ALLOCATE_RESOURCES IsochAllocateResources; - IRB_REQ_ISOCH_ATTACH_BUFFERS IsochAttachBuffers; - IRB_REQ_ISOCH_DETACH_BUFFERS IsochDetachBuffers; - IRB_REQ_ISOCH_FREE_BANDWIDTH IsochFreeBandwidth; - IRB_REQ_ISOCH_FREE_CHANNEL IsochFreeChannel; - IRB_REQ_ISOCH_FREE_RESOURCES IsochFreeResources; - IRB_REQ_ISOCH_LISTEN IsochListen; - IRB_REQ_ISOCH_QUERY_CURRENT_CYCLE_TIME IsochQueryCurrentCycleTime; - IRB_REQ_ISOCH_QUERY_RESOURCES IsochQueryResources; - IRB_REQ_ISOCH_SET_CHANNEL_BANDWIDTH IsochSetChannelBandwidth; - IRB_REQ_ISOCH_STOP IsochStop; - IRB_REQ_ISOCH_TALK IsochTalk; -#if(NTDDI_VERSION >= NTDDI_WINXP) - IRB_REQ_ISOCH_MODIFY_STREAM_PROPERTIES IsochModifyStreamProperties; -#endif - IRB_REQ_ALLOCATE_ADDRESS_RANGE AllocateAddressRange; - IRB_REQ_FREE_ADDRESS_RANGE FreeAddressRange; - IRB_REQ_GET_LOCAL_HOST_INFORMATION GetLocalHostInformation; - IRB_REQ_GET_1394_ADDRESS_FROM_DEVICE_OBJECT Get1394AddressFromDeviceObject; - IRB_REQ_CONTROL Control; - IRB_REQ_GET_MAX_SPEED_BETWEEN_DEVICES GetMaxSpeedBetweenDevices; - IRB_REQ_SET_DEVICE_XMIT_PROPERTIES SetDeviceXmitProperties; - IRB_REQ_SET_LOCAL_HOST_PROPERTIES SetLocalHostProperties; - IRB_REQ_GET_CONFIGURATION_INFORMATION GetConfigurationInformation; -#if(NTDDI_VERSION >= NTDDI_WIN7) - IRB_REQ_GET_CONFIG_ROM GetConfigRom; -#endif - IRB_REQ_BUS_RESET BusReset; - IRB_REQ_GET_GENERATION_COUNT GetGenerationCount; - IRB_REQ_SEND_PHY_CONFIGURATION_PACKET SendPhyConfigurationPacket; -#if(NTDDI_VERSION >= NTDDI_WIN7) - IRB_REQ_SEND_PHY_PACKET SendPhyPacket; - IRB_REQ_RECEIVE_PHY_PACKETS ReceivePhyPackets; -#endif - IRB_REQ_GET_SPEED_TOPOLOGY_MAPS GetSpeedTopologyMaps; - IRB_REQ_BUS_RESET_NOTIFICATION BusResetNotification; - IRB_REQ_ASYNC_STREAM AsyncStream; - - } u; - -} IRB, *PIRB; - -// -// Irb flags specified for isoch bandwidth allocations. -// - -#define IRB_FLAG_USE_PRE_CALCULATED_VALUE 1 -#define IRB_FLAG_ALLOW_REMOTE_FREE 2 - -// -// Flags for the SetPortProperties request. -// - -#define SET_LOCAL_HOST_PROPERTIES_NO_CYCLE_STARTS 0x00000001 -#if(NTDDI_VERSION >= NTDDI_WINXP) -#define SET_LOCAL_HOST_PROPERTIES_CYCLE_START_CONTROL 0x00000001 -#endif -#define SET_LOCAL_HOST_PROPERTIES_GAP_COUNT 0x00000002 -#define SET_LOCAL_HOST_PROPERTIES_MODIFY_CROM 0x00000003 -#if(NTDDI_VERSION >= NTDDI_WINXP) -#define SET_LOCAL_HOST_PROPERTIES_MAX_PAYLOAD 0x00000004 -#endif -#if(NTDDI_VERSION >= NTDDI_VISTA) -#define SET_LOCAL_HOST_PROPERTIES_DEBUG_ENTRY 0x00000005 -#endif - -// -// Definitions of the structures that correspond to the Host info levels. -// - -#if(NTDDI_VERSION >= NTDDI_WINXP) -typedef struct _SET_LOCAL_HOST_PROPS1 { - ULONG fulFlags; -} SET_LOCAL_HOST_PROPS1, *PSET_LOCAL_HOST_PROPS1; -#endif - -typedef struct _SET_LOCAL_HOST_PROPS2 { - ULONG GapCountLowerBound; -} SET_LOCAL_HOST_PROPS2, *PSET_LOCAL_HOST_PROPS2; - -// -// Definition for appending a properly formated Config Rom subsection, to -// the core config rom exposed by the PC. -// The first element of the submitted buffer must be a unit directory and any -// offset to other leafs/dir following it, must be indirect offsets from the -// beginning of the submitted buffer. -// The bus driver will then add a pointer to this unit dir, in our root directory. -// The entire supplied buffer must be in big endian with CRCs pre-calculated. -// If a driver fails to remove its added crom data, when it gets removed, the bus driver -// will do so automatically, restoring the crom image prior to this modification. -// - -typedef struct _SET_LOCAL_HOST_PROPS3 { - - ULONG fulFlags; - HANDLE hCromData; - ULONG nLength; - PMDL Mdl; - -} SET_LOCAL_HOST_PROPS3, *PSET_LOCAL_HOST_PROPS3; - -// -// Params for setting max payload size to less than the port driver -// default to assuage ill-behaved legacy devices. Valid values -// for the MaxAsyncPayloadRequested field are those corresponding -// to the ASYNC_PAYLOAD_###_RATE constants and zero (which will -// restore the port driver default values). On successful completion -// of this request the MaxAsyncPayloadResult will contain the -// updated max async payload value in use. -// -// On successful completion of this request it is the caller's -// responsibility to request a bus reset in order to propagate -// these new values to other device stacks. -// -// Failure to restore default port driver values as appropriate -// (e.g. on legacy device removal) may result in degraded bus -// performance. -// - -#if(NTDDI_VERSION >= NTDDI_WINXP) -typedef struct _SET_LOCAL_HOST_PROPS4 { - ULONG MaxAsyncPayloadRequested; - ULONG MaxAsyncPayloadResult; -} SET_LOCAL_HOST_PROPS4, *PSET_LOCAL_HOST_PROPS4; -#endif - -// -// This is used to set the extended key value that is -// used for 1394 debug. - -#if(NTDDI_VERSION >= NTDDI_VISTA) -typedef struct _SET_LOCAL_HOST_PROPS5 { - ULONG DebugAddress; -} SET_LOCAL_HOST_PROPS5, *PSET_LOCAL_HOST_PROPS5; -#endif - -// -// Definition of Flags for SET_LOCAL_HOST_PROPERTIES_MODIFY_CROM. -// - -#define SLHP_FLAG_ADD_CROM_DATA 0x01 -#define SLHP_FLAG_REMOVE_CROM_DATA 0x02 - -// -// Definition of fulFlags in Async Read/Write/Lock requests. -// - -#define ASYNC_FLAGS_NONINCREMENTING 0x00000001 - -// -// Flag instucts the port driver to NOT take an int for checking the status -// of this transaction. Always return success. -// - -#define ASYNC_FLAGS_NO_STATUS 0x00000002 - -// -// If this flag is set the read packet is going to be used as a PING packet also. -// we are going to determine, in units of micro secs, the delay -// between Tx of the async packet and reception of ACK_PENDING or ACK_COMPLETE. -// - -#define ASYNC_FLAGS_PING 0x00000004 - -// -// When this flag is set, the bus driver will use 63 as the node id, so this message -// is broadcast to all nodes. -// - -#define ASYNC_FLAGS_BROADCAST 0x00000008 - -// -// Definition of fulAccessType for AllocateAddressRange. -// - -#define ACCESS_FLAGS_TYPE_READ 1 -#define ACCESS_FLAGS_TYPE_WRITE 2 -#define ACCESS_FLAGS_TYPE_LOCK 4 -#define ACCESS_FLAGS_TYPE_BROADCAST 8 - -// -// Definition of fulNotificationOptions for AllocateAddressRange. -// - -#define NOTIFY_FLAGS_NEVER 0 -#define NOTIFY_FLAGS_AFTER_READ 1 -#define NOTIFY_FLAGS_AFTER_WRITE 2 -#define NOTIFY_FLAGS_AFTER_LOCK 4 - -// -// Definitions of Speed flags used throughout 1394 Bus APIs. -// - -#define SPEED_FLAGS_100 0x01 -#define SPEED_FLAGS_200 0x02 -#define SPEED_FLAGS_400 0x04 -#define SPEED_FLAGS_800 0x08 -#define SPEED_FLAGS_1600 0x10 -#define SPEED_FLAGS_3200 0x20 -#define SPEED_FLAGS_FASTEST 0x80000000 - -// -// Definitions of Channel flags. -// - -#define ISOCH_ANY_CHANNEL 0xffffffff -#define ISOCH_MAX_CHANNEL 63 - -// -// Definitions of Bus Reset flags (used when Bus driver asks Port driver -// to perform a bus reset). -// - -#define BUS_RESET_FLAGS_PERFORM_RESET 1 -#define BUS_RESET_FLAGS_FORCE_ROOT 2 - -// -// Definitions of Lock transaction types. -// - -#define LOCK_TRANSACTION_MASK_SWAP 1 -#define LOCK_TRANSACTION_COMPARE_SWAP 2 -#define LOCK_TRANSACTION_FETCH_ADD 3 -#define LOCK_TRANSACTION_LITTLE_ADD 4 -#define LOCK_TRANSACTION_BOUNDED_ADD 5 -#define LOCK_TRANSACTION_WRAP_ADD 6 - - -// -// Definitions of Isoch Allocate Resources flags. -// - -#define RESOURCE_USED_IN_LISTENING 0x00000001 -#define RESOURCE_USED_IN_TALKING 0x00000002 -#define RESOURCE_BUFFERS_CIRCULAR 0x00000004 -#define RESOURCE_STRIP_ADDITIONAL_QUADLETS 0x00000008 -#define RESOURCE_TIME_STAMP_ON_COMPLETION 0x00000010 -#define RESOURCE_SYNCH_ON_TIME 0x00000020 -#define RESOURCE_USE_PACKET_BASED 0x00000040 -#define RESOURCE_VARIABLE_ISOCH_PAYLOAD 0x00000080 -#define RESOURCE_USE_MULTICHANNEL 0x00000100 - -// -// Definitions of Isoch Descriptor flags. -// - -#define DESCRIPTOR_SYNCH_ON_SY 0x00000001 -#define DESCRIPTOR_SYNCH_ON_TAG 0x00000002 -#define DESCRIPTOR_SYNCH_ON_TIME 0x00000004 -#define DESCRIPTOR_USE_SY_TAG_IN_FIRST 0x00000008 -#define DESCRIPTOR_TIME_STAMP_ON_COMPLETION 0x00000010 -#define DESCRIPTOR_PRIORITY_TIME_DELIVERY 0x00000020 -#define DESCRIPTOR_HEADER_SCATTER_GATHER 0x00000040 -#define DESCRIPTOR_SYNCH_ON_ALL_TAGS 0x00000080 - -// -// Definitions of Isoch synchronization flags. -// - -#define SYNCH_ON_SY DESCRIPTOR_SYNCH_ON_SY -#define SYNCH_ON_TAG DESCRIPTOR_SYNCH_ON_TAG -#define SYNCH_ON_TIME DESCRIPTOR_SYNCH_ON_TIME - -// -// Definitions of levels of Host controller information. -// - -#define GET_HOST_UNIQUE_ID 1 -#define GET_HOST_CAPABILITIES 2 -#define GET_POWER_SUPPLIED 3 -#define GET_PHYS_ADDR_ROUTINE 4 -#define GET_HOST_CONFIG_ROM 5 -#define GET_HOST_CSR_CONTENTS 6 -#define GET_HOST_DMA_CAPABILITIES 7 -#if(NTDDI_VERSION >= NTDDI_WIN7) -#define GET_HOST_DDI_VERSION 8 -#endif - -// -// Definitions of the structures that correspond to the Host info levels. -// - -typedef struct _GET_LOCAL_HOST_INFO1 { - LARGE_INTEGER UniqueId; -} GET_LOCAL_HOST_INFO1, *PGET_LOCAL_HOST_INFO1; - -typedef struct _GET_LOCAL_HOST_INFO2 { - ULONG HostCapabilities; - ULONG MaxAsyncReadRequest; - ULONG MaxAsyncWriteRequest; -} GET_LOCAL_HOST_INFO2, *PGET_LOCAL_HOST_INFO2; - -typedef struct _GET_LOCAL_HOST_INFO3 { - ULONG deciWattsSupplied; - ULONG Voltage; // x10 -> +3.3 == 33 - // +5.0 == 50,+12.0 == 120 - // etc. -} GET_LOCAL_HOST_INFO3, *PGET_LOCAL_HOST_INFO3; - -// l -// Physical mapping routine. -// - -typedef -__checkReturn -__drv_requiresIRQL(DISPATCH_LEVEL) -NTSTATUS -(*PPORT_PHYS_ADDR_ROUTINE) ( - __in PVOID Context, - __inout PIRB Irb - ); - -// -// Callback from Physical Mapping routine, indicating its done. -// - -typedef -__drv_requiresIRQL(DISPATCH_LEVEL) -void -(*PPORT_ALLOC_COMPLETE_NOTIFICATION) ( - __in PVOID Context - ); - -typedef struct _GET_LOCAL_HOST_INFO4 { - PPORT_PHYS_ADDR_ROUTINE PhysAddrMappingRoutine; - PVOID Context; -} GET_LOCAL_HOST_INFO4, *PGET_LOCAL_HOST_INFO4; - -// -// The caller can set ConfigRomLength to zero, issue the request, which will -// be failed with STATUS_INVALID_BUFFER_SIZE and the ConfigRomLength will be set -// by the port driver to the proper length. The caller can then re-issue the request -// after it has allocated a buffer for the configrom with the correct length. -// Same is true for the GET_LOCAL_HOST_INFO6 call. -// - -typedef struct _GET_LOCAL_HOST_INFO5 { - PVOID ConfigRom; - ULONG ConfigRomLength; -} GET_LOCAL_HOST_INFO5, *PGET_LOCAL_HOST_INFO5; - -typedef struct _GET_LOCAL_HOST_INFO6 { - ADDRESS_OFFSET CsrBaseAddress; - ULONG CsrDataLength; - PVOID CsrDataBuffer; -} GET_LOCAL_HOST_INFO6, *PGET_LOCAL_HOST_INFO6; - -typedef struct _GET_LOCAL_HOST_INFO7_W2K { - ULONG HostDmaCapabilities; - ULARGE_INTEGER MaxDmaBufferSize; - ULONG MaxOutstandingXmitRequests; - ULONG MaxOutstandingXmitResponses; -} GET_LOCAL_HOST_INFO7_W2K, *PGET_LOCAL_HOST_INFO7_W2K; - -typedef struct _GET_LOCAL_HOST_INFO7_WXP { - ULONG HostDmaCapabilities; - ULARGE_INTEGER MaxDmaBufferSize; -} GET_LOCAL_HOST_INFO7_WXP, *PGET_LOCAL_HOST_INFO7_WXP; - -#if(NTDDI_VERSION < NTDDI_WINXP) -typedef GET_LOCAL_HOST_INFO7_W2K GET_LOCAL_HOST_INFO7, *PGET_LOCAL_HOST_INFO7; -#else -typedef GET_LOCAL_HOST_INFO7_WXP GET_LOCAL_HOST_INFO7, *PGET_LOCAL_HOST_INFO7; -#endif - -#if(NTDDI_VERSION >= NTDDI_WIN7) - -typedef struct _GET_LOCAL_HOST_INFO8 { - USHORT MajorVersion; - USHORT MinorVersion; -} GET_LOCAL_HOST_INFO8, *PGET_LOCAL_HOST_INFO8; - -#endif - -// -// Definitions of capabilities in Host info level 2. -// - -#define HOST_INFO_PACKET_BASED 0x00000001 -#define HOST_INFO_STREAM_BASED 0x00000002 -#define HOST_INFO_SUPPORTS_ISOCH_STRIPPING 0x00000004 -#define HOST_INFO_SUPPORTS_START_ON_CYCLE 0x00000008 -#define HOST_INFO_SUPPORTS_RETURNING_ISO_HDR 0x00000010 -#define HOST_INFO_SUPPORTS_ISO_HDR_INSERTION 0x00000020 -#if(NTDDI_VERSION < NTDDI_WINXP) -#define HOST_INFO_SUPPORTS_DV_CIP_STRIPPING 0x00000040 -#else -#define HOST_INFO_SUPPORTS_ISO_DUAL_BUFFER_RX 0x00000040 -#define HOST_INFO_DMA_DOUBLE_BUFFERING_ENABLED 0x00000080 -#endif - -// -// Definitions of flags for GetMaxSpeedBetweenDevices and -// Get1394AddressFromDeviceObject. -// - -#define USE_LOCAL_NODE 1 -#define USE_SCODE_SPEED 0x00000002 - -// -// Definitions of flags for IndicationFlags in INDICATION_INFO struct. -// - -#define BUS_RESPONSE_IS_RAW 1 - -// -// Definition of flags for BusResetNotification Irb. -// - -#define REGISTER_NOTIFICATION_ROUTINE 1 -#define DEREGISTER_NOTIFICATION_ROUTINE 2 -#if(NTDDI_VERSION >= NTDDI_WIN7) -#define EXTENDED_NOTIFICATION_ROUTINE 0x00000004 -#endif - -// -// Definition of flags for AllocateAddressRange Irb. -// - -#if(NTDDI_VERSION < NTDDI_WINXP) -#define BIG_ENDIAN_ADDRESS_RANGE 1 -#else -#define ALLOCATE_ADDRESS_FLAGS_USE_BIG_ENDIAN 1 -#define ALLOCATE_ADDRESS_FLAGS_USE_COMMON_BUFFER 2 -#endif - -// -// Definitions below are included for legacy support. -// - -#define IRP_MN_BUS_RESET 0x87 - -#define DEVICE_EXTENSION_TAG 0xdeadbeef -#define VIRTUAL_DEVICE_EXTENSION_TAG 0xdeafbeef - -#define PORT_EXTENSION_TAG 0xdeafcafe -#define BUS_EXTENSION_TAG 0xabacadab -#define ISOCH_RESOURCE_TAG 0xbabeface -#define BANDWIDTH_ALLOCATE_TAG 0xfeedbead - -#define SPEED_MAP_LENGTH 0x3f1 - -// -// 1394A Network channels register format. -// - -typedef struct _NETWORK_CHANNELS { - ULONG NC_Channel:6; // bits 0-5 - ULONG NC_Reserved:18; // bits 6-23 - ULONG NC_Npm_ID:6; // bits 24-29 - ULONG NC_Valid:1; // bit 30 - ULONG NC_One:1; // bit 31 -} NETWORK_CHANNELSR, *PNETWORK_CHANNELS; - -// -// These guys are meant to be called from a ring 3 app. -// Call through the port device object. -// - -#define IOCTL_1394_TOGGLE_ENUM_TEST_ON CTL_CODE( \ - FILE_DEVICE_UNKNOWN, \ - 0x88, \ - METHOD_BUFFERED, \ - FILE_ANY_ACCESS \ - ) - -#define IOCTL_1394_TOGGLE_ENUM_TEST_OFF CTL_CODE( \ - FILE_DEVICE_UNKNOWN, \ - 0x89, \ - METHOD_BUFFERED, \ - FILE_ANY_ACCESS \ - ) - -// -// 1394 ByteSwap definitions. -// - -#if(NTDDI_VERSION < NTDDI_WINXP) -#if defined(_X86_) - -ULONG static __inline -bswap(ULONG value) -{ - __asm mov eax, value - __asm bswap eax -} -#else -#define bswap(value) RtlUlongByteSwap(value) -#endif - -#define bswapw(value) ( (((USHORT) (value)) & 0x00ff) << 8 | \ - (((USHORT) (value)) & 0xff00) >> 8) - -#else -#define bswap(value) RtlUlongByteSwap(value) -#define bswapw(value) RtlUshortByteSwap(value) -#endif - -// -// These are definitions that are only used internally to 1394. -// - -#define MAX_SUFFIX_SIZE 4*sizeof(WCHAR) - -// -// Definition of minidriver capability bits. -// - -// -// Specifies port driver has no special capabilities. -// - -#define PORT_SUPPORTS_NOTHING 0 - -// -// Specifies port driver implements the core 1394 CSRs internally. These -// may be implemented in software/hardware. When this bit is ON, all -// local read/write requests to the core CSRs are passed down to the -// port driver, and the 1394 Bus driver does not issue "listens" for -// the virtual CSR locations. If this bit is OFF, the 1394 Bus driver -// mimicks the core 1394 CSRs. The core CSRs are defined as -// Bandwidth Units, Channels Available and the entire 1k of ConfigROM. -// - -#define PORT_SUPPORTS_CSRS 1 - -// -// Specifies port driver implements large Async Read/Write requests. -// If this bit is ON, the 1394 Bus driver will NOT chop up Async requests -// based on speed constraints (i.e. 512 bytes at 100Mbps, 1024 bytes at -// 200Mbps, etc.). Otherwise the 1394 Bus driver WILL chop up large -// requests into speed constrained sizes before handing them to the port -// driver. -// - -#define PORT_SUPPORTS_LARGE_ASYNC 2 - -// -// Specifies port driver indicates packet headers to the bus driver in the -// native format of the bus driver (as defined by the structs in this file. -// If this capability bit is turned on, the bus driver will not need to byte -// swap headers to get the packet headers in the right format before acting -// on them. This bit is used on indication or reception of packets only, as -// the bus driver doesn't try to assemble packet headers on transmission. -// - -#define PORT_SUPPORTS_NATIVE_ENDIAN 4 - -#if(NTDDI_VERSION >= NTDDI_WINXP) -// -// if present port driver supports WMI. -// - -#define PORT_SUPPORTS_WMI 8 -#endif - -// -// Definitions of Bus Reset informative states. -// - -#define BUS_RESET_BEGINNING 0x00000001 -#define BUS_RESET_FINISHED 0x00000002 -#define BUS_RESET_LOCAL_NODE_IS_ROOT 0x00000004 -#define BUS_RESET_LOCAL_NODE_IS_ISOCH_MANAGER 0x00000008 -#define BUS_RESET_LOCAL_NODE_IS_BUS_MANAGER 0x00000010 -#define BUS_RESET_SELFID_ENUMERATION_ERROR 0x00000020 -#define BUS_RESET_STORM_ERROR 0x00000040 -#define BUS_RESET_ABSENT_ON_POWER_UP 0x00000080 -#define BUS_RESET_UNOPTIMIZED_TOPOLOGY 0x00000100 - - -// -// Device Extension common to all nodes that the 1394 Bus driver -// created when it enumerated the bus and found a new unique node. -// - -typedef struct _NODE_DEVICE_EXTENSION { - - // - // Holds Tag to determine if this is really a "Node" Device Extension. - // - - ULONG Tag; - - // - // Holds the flag as to whether or not we've read the configuration - // information out of this device. - // - - BOOLEAN bConfigurationInformationValid; - - // - // Holds the Configuration Rom for this device. Multi-functional - // devices (i.e. many units) will share this same Config Rom - // structure, but they are represented as a different Device Object. - // This is not the entire Config Rom, but does contain the root directory - // as well as everything in front of it. - // - - PCONFIG_ROM ConfigRom; - - // - // Holds the length of the UnitDirectory pointer. - // - - ULONG UnitDirectoryLength; - - // - // Holds the Unit Directory for this device. Even on multi-functional - // devices (i.e. many units) this should be unique to each Device Object. - // - - PVOID UnitDirectory; - - // - // Holds the Unit Directory location for this device. Only the lower 48 - // bits are valid in this IO_ADDRESS. Useful for computing offsets from - // within the UnitDirectory as all offsets are relative. - // - - IO_ADDRESS UnitDirectoryLocation; - - // - // Holds the length of the UnitDependentDirectory pointer. - // - - ULONG UnitDependentDirectoryLength; - - // - // Holds the Unit Dependent directory for this device. - // - - PVOID UnitDependentDirectory; - - // - // Holds the Unit Dependent Directory location for this device. Only the - // lower 48 bits are valid in this IO_ADDRESS. Useful for computing - // offsets from within the UnitDependentDirectory as offsets are relative. - // - - IO_ADDRESS UnitDependentDirectoryLocation; - - // - // Holds the length of the VendorLeaf pointer. - // - - ULONG VendorLeafLength; - - // - // Holds the pointer to the Vendor Leaf information - // - - PTEXTUAL_LEAF VendorLeaf; - - // - // Holds the length of the VendorLeaf pointer. - // - - ULONG ModelLeafLength; - - // - // Holds the pointer to the Model Leaf information. - // - - PTEXTUAL_LEAF ModelLeaf; - - // - // Holds the 1394 10 bit BusId / 6 bit NodeId structure. - // - - NODE_ADDRESS NodeAddress; - - // - // Holds the speed to be used in reaching this device. - // - - UCHAR Speed; - - // - // Holds the priority at which to send packets. - // - - UCHAR Priority; - - // - // Holds the Irp used to notify this device object about events. - // - - PIRP Irp; - - // - // Holds the Device Object that this Device Extension hangs off of. - // - - PDEVICE_OBJECT DeviceObject; - - // - // Holds the Port Device Object that this Device hangs off of. - // - - PDEVICE_OBJECT PortDeviceObject; - - // - // Holds the pointer to corresponding information about this deivce - // in the bus driver's head. - // - - PVOID DeviceInformation; - - // - // Holds the pointer to the bus reset notification routine (if any). - // - - PBUS_BUS_RESET_NOTIFICATION ResetRoutine; - - // - // Holds the pointer to the context the client wanted when bus reset occurs. - // - - PVOID ResetContext; - -} NODE_DEVICE_EXTENSION, *PNODE_DEVICE_EXTENSION; - -// -// Definition of Bandwidth allocation structure. -// - -typedef struct _BANDWIDTH_ALLOCATION { - - // - // Holds the list of allocation entries. - // - - LIST_ENTRY AllocationList; - - // - // Holds the tag of this structure. - // - - ULONG Tag; - - // - // Holds the Bandwidth units that this allocation owns. - // - - ULONG OwnedUnits; - - // - // Holds the speed at which this bandwidth was allocated. - // - - ULONG fulSpeed; - - // - // Holds whether or not this was a local or remote allocation. - // - - BOOLEAN bRemoteAllocation; - - // - // Holds the generation of the bus when this bandwidth was secured. - // - - ULONG Generation; - - // - // Holds the owner of this allocation. - // - - PNODE_DEVICE_EXTENSION DeviceExtension; - -} BANDWIDTH_ALLOCATION, *PBANDWIDTH_ALLOCATION; - - -#ifdef __cplusplus -} -#endif - -#endif // _1394_H_ - diff --git a/pub/ddk/61883.h b/pub/ddk/61883.h deleted file mode 100644 index e53eca3..0000000 --- a/pub/ddk/61883.h +++ /dev/null @@ -1,1101 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - 61883.h - -Abstract: - - The public header for clients of the 61883 Class. - -Author: - - WGJ - PSB - ---*/ - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -// -// Class GUID -// -// {7EBEFBC0-3200-11d2-B4C2-00A0C9697D07} -DEFINE_GUID(GUID_61883_CLASS, 0x7ebefbc0, 0x3200, 0x11d2, 0xb4, 0xc2, 0x0, 0xa0, 0xc9, 0x69, 0x7d, 0x7); - -// -// IOCTL Definitions -// -#define IOCTL_61883_CLASS CTL_CODE( \ - FILE_DEVICE_UNKNOWN, \ - 0x91, \ - METHOD_IN_DIRECT, \ - FILE_ANY_ACCESS \ - ) - - -// -// Current 61883 DDI Version -// -#if (NTDDI_VERSION >= NTDDI_VISTA) - -#define CURRENT_61883_DDI_VERSION 0x4 - -#elif ((NTDDI_VERSION >= NTDDI_WINS03SP1) || \ - ((NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WINS03))) - -#define CURRENT_61883_DDI_VERSION 0x3 - -#elif (NTDDI_VERSION >= NTDDI_WINXP) - -#define CURRENT_61883_DDI_VERSION 0x2 - -#endif // NTDDI_VERSION - -// -// INIT_61883_HEADER Macro -// -#define INIT_61883_HEADER( Av61883, Request ) \ - (Av61883)->Function = Request; \ - (Av61883)->Version = CURRENT_61883_DDI_VERSION; - -// -// 61883 I/O Request Functions -// -enum { - - Av61883_GetUnitInfo, - Av61883_SetUnitInfo, - - Av61883_SetPlug, - Av61883_GetPlugHandle, - Av61883_GetPlugState, - Av61883_Connect, - Av61883_Disconnect, - - Av61883_AttachFrame, - Av61883_CancelFrame, - Av61883_Talk, - Av61883_Listen, - Av61883_Stop, - - Av61883_SendFcpRequest, - Av61883_GetFcpResponse, - - Av61883_GetFcpRequest, - Av61883_SendFcpResponse, - - Av61883_SetFcpNotify, - - Av61883_CreatePlug, - Av61883_DeletePlug, - - Av61883_BusResetNotify, - Av61883_BusReset, - - Av61883_SetUnitDirectory, - - Av61883_MonitorPlugs, - - Av61883_MAX -}; - -// -// Plug States -// -#define CMP_PLUG_STATE_IDLE 0 -#define CMP_PLUG_STATE_READY 1 -#define CMP_PLUG_STATE_SUSPENDED 2 -#define CMP_PLUG_STATE_ACTIVE 3 - -// -// Connect Speeds (not the same as 1394 speed flags!!) -// -#define CMP_SPEED_S100 0x00 -#define CMP_SPEED_S200 0x01 -#define CMP_SPEED_S400 0x02 - -// -// CIP Frame Flags -// -#define CIP_VALIDATE_FIRST_SOURCE 0x00000001 -#define CIP_VALIDATE_ALL_SOURCE 0x00000002 -#define CIP_STRIP_SOURCE_HEADER 0x00000004 -#define CIP_USE_SOURCE_HEADER_TIMESTAMP 0x00000008 -#define CIP_DV_STYLE_SYT 0x00000010 -#define CIP_AUDIO_STYLE_SYT 0x00000020 -#define CIP_RESET_FRAME_ON_DISCONTINUITY 0x00000040 -#if (NTDDI_VERSION >= NTDDI_VISTA) -#define CIP_DTCP_ISOCH_HEADER 0x00000080 -#endif - -// -// CIP Status Codes -// -#define CIP_STATUS_SUCCESS 0x00000000 -#define CIP_STATUS_CORRUPT_FRAME 0x00000001 -#define CIP_STATUS_FIRST_FRAME 0x00000002 - -#if (NTDDI_VERSION >= NTDDI_VISTA) -#define CIP_STATUS_EVEN_BIT 0x00000010 -#define CIP_STATUS_ODD_BIT 0x00000020 - -#define CIP_STATUS_EMI_COPY_FREE 0x00000100 -#define CIP_STATUS_EMI_NO_MORE_COPIES 0x00000200 -#define CIP_STATUS_EMI_COPY_ONE_GENERATION 0x00000400 -#define CIP_STATUS_EMI_COPY_NEVER 0x00000800 -#endif - -// -// CIP Talk Flags -// -#define CIP_TALK_USE_SPH_TIMESTAMP 0x00000001 -#define CIP_TALK_DOUBLE_BUFFER 0x00000002 -#if ((NTDDI_VERSION >= NTDDI_WINS03SP1) || \ - ((NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WINS03))) -#define CIP_TALK_BLOCKING_MODE 0x00000004 -#endif // NTDDI_VERSION - -// -// Plug Location -// -typedef enum { - CMP_PlugLocal = 0, - CMP_PlugRemote -} CMP_PLUG_LOCATION; - -// -// Plug Type -// -typedef enum { - CMP_PlugOut = 0, // oPCR - CMP_PlugIn // iPCR -} CMP_PLUG_TYPE; - -// -// Connect Type -// -typedef enum { - CMP_Broadcast = 0, - CMP_PointToPoint -} CMP_CONNECT_TYPE; - -typedef struct _OPCR { - ULONG Payload:10; - ULONG OverheadID:4; - ULONG DataRate:2; - ULONG Channel:6; - ULONG Reserved:2; - ULONG PPCCounter:6; - ULONG BCCCounter:1; - ULONG OnLine:1; -} OPCR, *POPCR; - -typedef struct _IPCR { - ULONG Reserved0:16; - ULONG Channel:6; - ULONG Reserved1:2; - ULONG PPCCounter:6; - ULONG BCCCounter:1; - ULONG OnLine:1; -} IPCR, *PIPCR; - -typedef struct _AV_PCR { - union { - OPCR oPCR; - IPCR iPCR; - ULONG ulongData; - }; -} AV_PCR, *PAV_PCR; - -// -// Client Request Structures -// - -// -// Local or Device Unit Info -// -#define RETRIEVE_DEVICE_UNIT_INFO 0x00000000 // Retrieve Info from Device -#define RETRIEVE_LOCAL_UNIT_INFO 0x00000001 // Retrieve Info from Local Node - -// -// DiagLevel's used for controlling various behavior -// -#define DIAGLEVEL_NONE 0x00000000 // Nothing. -#define DIAGLEVEL_IGNORE_OPLUG 0x00000001 // Will not program the oPCR -#define DIAGLEVEL_IGNORE_IPLUG 0x00000002 // Will not program the iPCR -#define DIAGLEVEL_SET_CHANNEL_63 0x00000004 // Resets channel to 63 when oPCR/iPCR is disconnected -#define DIAGLEVEL_IPCR_IGNORE_FREE 0x00000008 // Will not free isoch resources when iPCR is disconnected - // and local oPCR is not specified -#define DIAGLEVEL_HIDE_OPLUG 0x00000010 // Hides the oMPR & oPCR in an exclusive address range -#define DIAGLEVEL_IPCR_ALWAYS_ALLOC 0x00000020 // Will always allocate when connecting to iPCR with no - // oPCR specified, regardless if iPCR has existing connection -#define DIAGLEVEL_SPECIFY_BLOCKSIZE 0x00000040 // This flag is specified when we detect an invalid max_rec or - // want to specify the block size. If this flag is set, all async - // transactions will be transmitted upto 512 byte blocks (S100) - -// -// GetUnitInfo nLevel's -// -#define GET_UNIT_INFO_IDS 0x00000001 // Retrieves IDs of Unit -#define GET_UNIT_INFO_CAPABILITIES 0x00000002 // Retrieves Capabilities of Unit -#define GET_UNIT_INFO_ISOCH_PARAMS 0x00000003 // Retrieves parameters for isoch -#define GET_UNIT_BUS_GENERATION_NODE 0x00000004 // Retrieves current generation/node -#define GET_UNIT_DDI_VERSION 0x00000005 // Retrieves 61883 DDI Version -#define GET_UNIT_DIAG_LEVEL 0x00000006 // Retrieves the currently set DiagLevel flags - -// -// Hardware Flags -// -#define AV_HOST_DMA_DOUBLE_BUFFERING_ENABLED 0x00000001 - -typedef struct _GET_UNIT_IDS { - - // - // UniqueID - // - OUT LARGE_INTEGER UniqueID; - - // - // VendorID - // - OUT ULONG VendorID; - - // - // ModelID - // - OUT ULONG ModelID; - - // - // VendorText Length - // - OUT ULONG ulVendorLength; - - // - // VendorText String - // - OUT PWSTR VendorText; - - // - // ModelText Length - // - OUT ULONG ulModelLength; - - // - // ModelText String - // - OUT PWSTR ModelText; - - // - // UnitModelID - // - OUT ULONG UnitModelID; - - // - // UnitModelText Length - // - OUT ULONG ulUnitModelLength; - - // - // UnitModelText String - // - OUT PWSTR UnitModelText; - -} GET_UNIT_IDS, *PGET_UNIT_IDS; - -typedef struct _GET_UNIT_CAPABILITIES { - - // - // Number of Output Plugs supported by device - // - OUT ULONG NumOutputPlugs; - - // - // Number of Input Plugs supported by device - // - OUT ULONG NumInputPlugs; - - // - // MaxDataRate - // - OUT ULONG MaxDataRate; - - // - // CTS Flags - // - OUT ULONG CTSFlags; - - // - // Hardware Flags - // - OUT ULONG HardwareFlags; - -} GET_UNIT_CAPABILITIES, *PGET_UNIT_CAPABILITIES; - -// -// UnitIsochParams -// -typedef struct _UNIT_ISOCH_PARAMS { - - IN OUT ULONG RX_NumPackets; - - IN OUT ULONG RX_NumDescriptors; - - IN OUT ULONG TX_NumPackets; - - IN OUT ULONG TX_NumDescriptors; - -} UNIT_ISOCH_PARAMS, *PUNIT_ISOCH_PARAMS; - -// -// Unit Generation/Node Info -// -typedef struct _BUS_GENERATION_NODE { - - OUT ULONG GenerationCount; - - OUT NODE_ADDRESS LocalNodeAddress; - - OUT NODE_ADDRESS DeviceNodeAddress; - -} BUS_GENERATION_NODE, *PBUS_GENERATION_NODE; - -// -// Unit DDI Version -// -typedef struct _UNIT_DDI_VERSION { - - OUT ULONG Version; - -} UNIT_DDI_VERSION, *PUNIT_DDI_VERSION; - -// -// UnitDiagLevel -// -typedef struct _UNIT_DIAG_LEVEL { - - IN ULONG DiagLevel; - -} UNIT_DIAG_LEVEL, *PUNIT_DIAG_LEVEL; - -// -// GetUnitInfo -// -typedef struct _GET_UNIT_INFO { - - IN ULONG nLevel; - - IN OUT PVOID Information; - -} GET_UNIT_INFO, *PGET_UNIT_INFO; - -// -// SetUnitInfo nLevel's -// -#define SET_UNIT_INFO_DIAG_LEVEL 0x00000001 // Sets the diag level for 61883 -#define SET_UNIT_INFO_ISOCH_PARAMS 0x00000002 // Sets the parameters for isoch -#define SET_CMP_ADDRESS_RANGE_TYPE 0x00000003 // Sets the type of CMP address range - -// -// CMP Address Range Type -// -#define CMP_ADDRESS_TYPE_GLOBAL 0x00000001 // Global CMP for this instance - default -#define CMP_ADDRESS_TYPE_EXCLUSIVE 0x00000002 // Exclusive CMP for this instance - -// -// SetCmpAddressRange -// -typedef struct _SET_CMP_ADDRESS_TYPE { - - IN ULONG Type; - -} SET_CMP_ADDRESS_TYPE, *PSET_CMP_ADDRESS_TYPE; - -// -// SetUnitInfo -// -typedef struct _SET_UNIT_INFO { - - IN ULONG nLevel; - - IN OUT PVOID Information; - -} SET_UNIT_INFO, *PSET_UNIT_INFO; - -// -// GetPlugHandle -// -typedef struct _CMP_GET_PLUG_HANDLE { - - // - // Requested Plug Number - // - IN ULONG PlugNum; - - // - // Requested Plug Type - // - IN CMP_PLUG_TYPE Type; - - // - // Returned Plug Handle - // - OUT HANDLE hPlug; - -} CMP_GET_PLUG_HANDLE, *PCMP_GET_PLUG_HANDLE; - -// -// GetPlugState -// -typedef struct _CMP_GET_PLUG_STATE { - - // - // Plug Handle - // - IN HANDLE hPlug; - - // - // Current State - // - OUT ULONG State; - - // - // Current Data Rate - // - OUT ULONG DataRate; - - // - // Current Payload Size - // - OUT ULONG Payload; - - // - // Number of Broadcast Connections - // - OUT ULONG BC_Connections; - - // - // Number of Point to Point Connections - // - OUT ULONG PP_Connections; - -} CMP_GET_PLUG_STATE, *PCMP_GET_PLUG_STATE; - -#if ((NTDDI_VERSION >= NTDDI_WINS03SP1) || \ - ((NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WINS03))) -// -// CipDataFormat definitions for BlockPeriod/BlockPeriodRemainder -// - -// 61883-2,3,5 - DVCR - 525-60 system -#define CDF_DVCR_525_60_BLOCK_PERIOD 3280 -#define CDF_DVCR_525_60_BLOCK_PERIOD_REMAINDER 76800000 - -// 61883-2,3,5 - DVCR - 625-50 system -#define CDF_DVCR_625_50_BLOCK_PERIOD 3276 -#define CDF_DVCR_625_50_BLOCK_PERIOD_REMAINDER 800000000 -#endif // NTDDI_VERSION - -// -// CipDataFormat -// -typedef struct _CIP_DATA_FORMAT_VER3 { - - // - // FMT and FDF either known, or discovered - // via AV/C command - // - UCHAR FMT; - UCHAR FDF_hi; - UCHAR FDF_mid; - UCHAR FDF_lo; - - // - // SPH as defined by IEC-61883 - // - BOOLEAN bHeader; - - // - // QPC as defined by IEC-61883 - // - UCHAR Padding; - - // - // DBS as defined by IEC-61883 - // - UCHAR BlockSize; - - // - // FN as defined by IEC-61883 - // - UCHAR Fraction; - - // - // The number of 1394 ticks to send a data block - // - IN ULONG BlockPeriod; - - // - // The remainder of 1394 ticks to send a data block - // - IN ULONG BlockPeriodRemainder; - - // - // Number of BlocksPerPacket - used for blocking mode only - // - IN ULONG BlocksPerPacket; - -} CIP_DATA_FORMAT_VER3, *PCIP_DATA_FORMAT_VER3; - -// CIP Data Format - located in CMP_CONNECT_VER2 -typedef struct _CIP_DATA_FORMAT_VER2 { - UCHAR FMT; - UCHAR FDF_hi; - UCHAR FDF_mid; - UCHAR FDF_lo; - BOOLEAN bHeader; - UCHAR Padding; - UCHAR BlockSize; - UCHAR Fraction; - IN ULONG BlockPeriod; -} CIP_DATA_FORMAT_VER2, *PCIP_DATA_FORMAT_VER2; - -// -// Connect -// -typedef struct _CMP_CONNECT_VER3 { - - // - // Output Plug Handle - // - IN HANDLE hOutputPlug; - - // - // Input Plug Handle - // - IN HANDLE hInputPlug; - - // - // Requested Connect Type - // - IN CMP_CONNECT_TYPE Type; - - // - // Requested Data Format - TX Only - // - IN CIP_DATA_FORMAT_VER3 Format; - - // - // Returned Connect Handle - // - OUT HANDLE hConnect; - -} CMP_CONNECT_VER3, *PCMP_CONNECT_VER3; - -// CMP Connect Request Structure -typedef struct _CMP_CONNECT_VER2 { - IN HANDLE hOutputPlug; - IN HANDLE hInputPlug; - IN CMP_CONNECT_TYPE Type; - IN CIP_DATA_FORMAT_VER2 Format; - OUT HANDLE hConnect; -} CMP_CONNECT_VER2, *PCMP_CONNECT_VER2; - -#if ((NTDDI_VERSION >= NTDDI_WINS03SP1) || \ - ((NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WINS03))) - -typedef CIP_DATA_FORMAT_VER3 CIP_DATA_FORMAT, *PCIP_DATA_FORMAT; -typedef CMP_CONNECT_VER3 CMP_CONNECT, *PCMP_CONNECT; - -#elif - -typedef CIP_DATA_FORMAT_VER2 CIP_DATA_FORMAT, *PCIP_DATA_FORMAT; -typedef CMP_CONNECT_VER2 CMP_CONNECT, *PCMP_CONNECT; - -#endif // NTDDI_VERSION - -// -// Disconnect -// -typedef struct _CMP_DISCONNECT { - - // - // Connect Handle to Disconnect - // - IN HANDLE hConnect; - -} CMP_DISCONNECT, *PCMP_DISCONNECT; - -// -// CIP Frame typedef -// -typedef struct _CIP_FRAME CIP_FRAME, *PCIP_FRAME; - -// -// ValidateInfo Struct. returned on pfnValidate. -// -typedef struct _CIP_VALIDATE_INFO { - - // - // Connection Handle - // - HANDLE hConnect; - - // - // Validate Context - // - PVOID Context; - - // - // TimeStamp for current source packet - // - CYCLE_TIME TimeStamp; - - // - // Packet offset for current source packet - // - PUCHAR Packet; - -} CIP_VALIDATE_INFO, *PCIP_VALIDATE_INFO; - -// -// NotifyInfo Struct. returned on pfnNotify -// -typedef struct _CIP_NOTIFY_INFO { - - // - // Connection Handle - // - HANDLE hConnect; - - // - // Notify Context - // - PVOID Context; - - // - // Frame - // - PCIP_FRAME Frame; - -} CIP_NOTIFY_INFO, *PCIP_NOTIFY_INFO; - -// -// Validate & Notify Routines -// -typedef -__checkReturn -__drv_requiresIRQL(DISPATCH_LEVEL) -ULONG -(*PCIP_VALIDATE_ROUTINE) ( - __in PCIP_VALIDATE_INFO ValidateInfo - ); - -typedef -__checkReturn -__drv_requiresIRQL(DISPATCH_LEVEL) -ULONG -(*PCIP_NOTIFY_ROUTINE) ( - __in PCIP_NOTIFY_INFO NotifyInfo - ); - -// -// CIP Frame Struct -// -struct _CIP_FRAME { - - union { - IN PVOID Reserved; - IN PVOID pNext; - }; - - IN ULONG Flags; - - IN PCIP_VALIDATE_ROUTINE pfnValidate; - - IN PVOID ValidateContext; - - IN PCIP_NOTIFY_ROUTINE pfnNotify; - - IN PVOID NotifyContext; - - OUT CYCLE_TIME Timestamp; - - OUT ULONG Status; - - IN OUT PUCHAR Packet; - - OUT ULONG CompletedBytes; - -}; - -// -// CIP Attach Frame Structure -// -typedef struct _CIP_ATTACH_FRAME { - - HANDLE hConnect; - - ULONG FrameLength; - - ULONG SourceLength; - - PCIP_FRAME Frame; - -} CIP_ATTACH_FRAME, *PCIP_ATTACH_FRAME; - -// -// CIP Cancel Frame Structure -// -typedef struct _CIP_CANCEL_FRAME { - - IN HANDLE hConnect; - - IN PCIP_FRAME Frame; - -} CIP_CANCEL_FRAME, *PCIP_CANCEL_FRAME; - -// -// CIP Talk Structure -// -typedef struct _CIP_TALK { - - // - // Connect Handle - // - IN HANDLE hConnect; - -} CIP_TALK, *PCIP_TALK; - -// -// CIP Listen Structure -// -typedef struct _CIP_LISTEN { - - // - // Connect Handle - // - IN HANDLE hConnect; - -} CIP_LISTEN, *PCIP_LISTEN; - -// -// CIP Stop Structure -// -typedef struct _CIP_STOP { - - // - // Connect Handle - // - IN HANDLE hConnect; - -} CIP_STOP, *PCIP_STOP; - -// -// FCP Frame Format -// -typedef struct _FCP_FRAME { - UCHAR ctype:4; - UCHAR cts:4; - UCHAR payload[511]; -} FCP_FRAME, *PFCP_FRAME; - -// Legacy FCP structs -typedef struct _FCP_SEND_REQUEST FCP_REQUEST, *PFCP_REQUEST; -typedef struct _FCP_GET_RESPONSE FCP_RESPONSE, *PFCP_RESPONSE; - -// -// FCP Send Request Structure -// -typedef struct _FCP_SEND_REQUEST { - IN NODE_ADDRESS NodeAddress; - IN ULONG Length; - IN PFCP_FRAME Frame; -} FCP_SEND_REQUEST, *PFCP_SEND_REQUEST; - -// -// FCP Get Response Structure -// -typedef struct _FCP_GET_RESPONSE { - OUT NODE_ADDRESS NodeAddress; - IN OUT ULONG Length; - IN OUT PFCP_FRAME Frame; -} FCP_GET_RESPONSE, *PFCP_GET_RESPONSE; - -// -// FCP Get Request Structure -// -typedef struct _FCP_GET_REQUEST { - OUT NODE_ADDRESS NodeAddress; - IN OUT ULONG Length; - IN OUT PFCP_FRAME Frame; -} FCP_GET_REQUEST, *PFCP_GET_REQUEST; - -// -// FCP Send Response Structure -// -typedef struct _FCP_SEND_RESPONSE { - IN NODE_ADDRESS NodeAddress; - IN ULONG Length; - IN PFCP_FRAME Frame; -} FCP_SEND_RESPONSE, *PFCP_SEND_RESPONSE; - -// -// Set FCP Notify Flags -// -#define DEREGISTER_FCP_NOTIFY 0x00000000 - -#define REGISTER_FCP_RESPONSE_NOTIFY 0x00000001 -#define REGISTER_FCP_REQUEST_NOTIFY 0x00000002 - -// -// Set FCP Notify Structure -// -typedef struct _SET_FCP_NOTIFY { - - // - // Flags - // - IN ULONG Flags; - - // - // Node Address - // - IN NODE_ADDRESS NodeAddress; - -} SET_FCP_NOTIFY, *PSET_FCP_NOTIFY; - -// -// Plug Notify Routine -// -typedef struct _CMP_NOTIFY_INFO { - - HANDLE hPlug; - - AV_PCR Pcr; - - PVOID Context; - -} CMP_NOTIFY_INFO, *PCMP_NOTIFY_INFO; - -// -// Plug Notify Routine -// -typedef -__drv_requiresIRQL(DISPATCH_LEVEL) -void -(*PCMP_NOTIFY_ROUTINE) ( - __in PCMP_NOTIFY_INFO NotifyInfo - ); - -// -// CreatePlug -// -typedef struct _CMP_CREATE_PLUG { - - // Type of plug to create - IN CMP_PLUG_TYPE PlugType; - - // PCR Settings - IN AV_PCR Pcr; - - // Notification Routine for Register - IN PCMP_NOTIFY_ROUTINE pfnNotify; - - // Notification Context - IN PVOID Context; - - // Plug Number - OUT ULONG PlugNum; - - // Plug Handle - OUT HANDLE hPlug; - -} CMP_CREATE_PLUG, *PCMP_CREATE_PLUG; - -// -// DeletePlug -// -typedef struct _CMP_DELETE_PLUG { - - // Plug Handle - IN HANDLE hPlug; - -} CMP_DELETE_PLUG, *PCMP_DELETE_PLUG; - -// -// SetPlug -// -typedef struct _CMP_SET_PLUG { - - // Plug Handle - IN HANDLE hPlug; - - // PCR Settings - IN AV_PCR Pcr; - -} CMP_SET_PLUG, *PCMP_SET_PLUG; - -// -// Bus Reset Notify Routine -// -typedef -__drv_requiresIRQL(DISPATCH_LEVEL) -void -(*PBUS_RESET_ROUTINE) ( - __in PVOID Context, - __in PBUS_GENERATION_NODE BusResetInfo - ); - -#define REGISTER_BUS_RESET_NOTIFY 0x1 -#define DEREGISTER_BUS_RESET_NOTIFY 0x2 - -// -// BusResetNotify -// -typedef struct _BUS_RESET_NOTIFY { - - IN ULONG Flags; - - IN PBUS_RESET_ROUTINE pfnNotify; - - IN PVOID Context; - -} BUS_RESET_NOTIFY, *PBUS_RESET_NOTIFY; - -// -// Flags for Av61883_SetUnitDirectory -// -#define ADD_UNIT_DIRECTORY_ENTRY 0x1 -#define REMOVE_UNIT_DIRECTORY_ENTRY 0x2 -#define ISSUE_BUS_RESET_AFTER_MODIFY 0x4 - -// -// Set Unit Directory -// -typedef struct _SET_UNIT_DIRECTORY { - - IN ULONG Flags; - - IN ULONG UnitSpecId; - - IN ULONG UnitSwVersion; - - IN OUT HANDLE hCromEntry; - -} SET_UNIT_DIRECTORY, *PSET_UNIT_DIRECTORY; - -// -// States for Monitoring Plugs -// -#define MONITOR_STATE_CREATED 0x00000001 // Plug Created -#define MONITOR_STATE_REMOVED 0x00000002 // Plug Removed -#define MONITOR_STATE_UPDATED 0x00000004 // Plug Contents Updated - -// -// Monitor Plugs Notify Routine -// -typedef struct _CMP_MONITOR_INFO { - - ULONG State; - - ULONG PlugNum; - - ULONG PlugType; - - AV_PCR Pcr; - - PVOID Context; - -} CMP_MONITOR_INFO, *PCMP_MONITOR_INFO; - -typedef -__drv_requiresIRQL(DISPATCH_LEVEL) -void -(*PCMP_MONITOR_ROUTINE) ( - __in PCMP_MONITOR_INFO MonitorInfo - ); - -// -// Flags for Av61883_MonitorPlugs -// -#define REGISTER_MONITOR_PLUG_NOTIFY 0x1 -#define DEREGISTER_MONITOR_PLUG_NOTIFY 0x2 - -// -// MonitorPlugs (Local only) -// -typedef struct _CMP_MONITOR_PLUGS { - - IN ULONG Flags; - - IN PCMP_MONITOR_ROUTINE pfnNotify; - - IN PVOID Context; - -} CMP_MONITOR_PLUGS, *PCMP_MONITOR_PLUGS; - -// -// Av61883 Struct -// -typedef struct _AV_61883_REQUEST { - - // - // Requested Function - // - ULONG Function; - - // - // Selected DDI Version - // - ULONG Version; - - // - // Flags - // - ULONG Flags; - - union { - - GET_UNIT_INFO GetUnitInfo; - SET_UNIT_INFO SetUnitInfo; - - CMP_GET_PLUG_HANDLE GetPlugHandle; - CMP_GET_PLUG_STATE GetPlugState; - CMP_CONNECT Connect; - CMP_DISCONNECT Disconnect; - - CIP_ATTACH_FRAME AttachFrame; - CIP_CANCEL_FRAME CancelFrame; - CIP_TALK Talk; - CIP_LISTEN Listen; - CIP_STOP Stop; - - FCP_REQUEST Request; // Legacy - FCP_RESPONSE Response; // Legacy - - FCP_SEND_REQUEST SendRequest; - FCP_GET_RESPONSE GetResponse; - - FCP_GET_REQUEST GetRequest; - FCP_SEND_RESPONSE SendResponse; - - SET_FCP_NOTIFY SetFcpNotify; - - CMP_CREATE_PLUG CreatePlug; - CMP_DELETE_PLUG DeletePlug; - CMP_SET_PLUG SetPlug; - - BUS_RESET_NOTIFY BusResetNotify; - - SET_UNIT_DIRECTORY SetUnitDirectory; - - CMP_MONITOR_PLUGS MonitorPlugs; - }; -} AV_61883_REQUEST, *PAV_61883_REQUEST; - -#endif // NTDDI_VERSION >= NTDDI_WINXP - - diff --git a/pub/ddk/ExDispid.h b/pub/ddk/ExDispid.h deleted file mode 100644 index 5e850a0..0000000 --- a/pub/ddk/ExDispid.h +++ /dev/null @@ -1,170 +0,0 @@ -#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_ - diff --git a/pub/ddk/SCardErr.h b/pub/ddk/SCardErr.h deleted file mode 100644 index e3a67f8..0000000 --- a/pub/ddk/SCardErr.h +++ /dev/null @@ -1,655 +0,0 @@ -/* - 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 - diff --git a/pub/ddk/USBProtocolDefs.h b/pub/ddk/USBProtocolDefs.h deleted file mode 100644 index 7b3366c..0000000 --- a/pub/ddk/USBProtocolDefs.h +++ /dev/null @@ -1,886 +0,0 @@ -/*++ - -Copyright (c) 2005 Microsoft Corporation - -Module Name: - - USBProtocolDefs.h - -Abstract: - - USB protocol definitions - -Author: - ---*/ -#ifndef _USBPROTOCOLDEFS_H_ -#define _USBPROTOCOLDEFS_H_ - -#include - - -// 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 - - - -#endif //_USBPROTOCOLDEFS_H_ - diff --git a/pub/ddk/accctrl.h b/pub/ddk/accctrl.h deleted file mode 100644 index e32d237..0000000 --- a/pub/ddk/accctrl.h +++ /dev/null @@ -1,802 +0,0 @@ -/*+------------------------------------------------------------------- - - 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 -#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__ */ - diff --git a/pub/ddk/acpiioct.h b/pub/ddk/acpiioct.h deleted file mode 100644 index ec84af8..0000000 --- a/pub/ddk/acpiioct.h +++ /dev/null @@ -1,253 +0,0 @@ -/*++ - -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 - diff --git a/pub/ddk/amtvuids.h b/pub/ddk/amtvuids.h deleted file mode 100644 index ebcb62b..0000000 --- a/pub/ddk/amtvuids.h +++ /dev/null @@ -1,68 +0,0 @@ -//==========================================================================; -// -// 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); - - diff --git a/pub/ddk/anchorsyncdeviceservice.h b/pub/ddk/anchorsyncdeviceservice.h deleted file mode 100644 index 9547fd7..0000000 --- a/pub/ddk/anchorsyncdeviceservice.h +++ /dev/null @@ -1,316 +0,0 @@ -/* - * AnchorSyncDeviceService.h - * - * Contains definitions for the Anchor Sync Device Service - * - * Copyright (c) Microsoft Corporation, All Rights Reserved. - * - */ - -#ifndef _ANCHORSYNCSERVICE_H_ -#define _ANCHORSYNCSERVICE_H_ - -#include -#include - -/*****************************************************************************/ -/* 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_ */ - - - diff --git a/pub/ddk/ata.h b/pub/ddk/ata.h deleted file mode 100644 index 30b5f62..0000000 --- a/pub/ddk/ata.h +++ /dev/null @@ -1,695 +0,0 @@ - -/*++ - -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 - diff --git a/pub/ddk/atm.h b/pub/ddk/atm.h deleted file mode 100644 index 22a7f14..0000000 --- a/pub/ddk/atm.h +++ /dev/null @@ -1,785 +0,0 @@ -/*++ - -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_ - - diff --git a/pub/ddk/aux_klib.h b/pub/ddk/aux_klib.h deleted file mode 100644 index 144e861..0000000 --- a/pub/ddk/aux_klib.h +++ /dev/null @@ -1,104 +0,0 @@ -/*++ - -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 -#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 - diff --git a/pub/ddk/avc.h b/pub/ddk/avc.h deleted file mode 100644 index 186c8a5..0000000 --- a/pub/ddk/avc.h +++ /dev/null @@ -1,397 +0,0 @@ -/*++ - -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 - -// 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 - -#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 - -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 - -#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 - diff --git a/pub/ddk/avcstrm.h b/pub/ddk/avcstrm.h deleted file mode 100644 index f50b245..0000000 --- a/pub/ddk/avcstrm.h +++ /dev/null @@ -1,551 +0,0 @@ -/*++ - -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 - diff --git a/pub/ddk/backpack.h b/pub/ddk/backpack.h deleted file mode 100644 index c06d3bf..0000000 --- a/pub/ddk/backpack.h +++ /dev/null @@ -1,189 +0,0 @@ -/*++ - -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_ */ - diff --git a/pub/ddk/bdasup.h b/pub/ddk/bdasup.h deleted file mode 100644 index d32d075..0000000 --- a/pub/ddk/bdasup.h +++ /dev/null @@ -1,696 +0,0 @@ -//==========================================================================; -// -// 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) - - diff --git a/pub/ddk/bridgedeviceservice.h b/pub/ddk/bridgedeviceservice.h deleted file mode 100644 index 30c41ee..0000000 --- a/pub/ddk/bridgedeviceservice.h +++ /dev/null @@ -1,1999 +0,0 @@ -/* - * BridgeDeviceService.h - * - * Contains declaration of Services PKEYs to support classic MTP-style - * formats and generic/media object properties. - * - * Copyright (c) Microsoft Corporation, All Rights Reserved - */ - -#ifndef _BRIDGEDEVICESERVICE_H_ -#define _BRIDGEDEVICESERVICE_H_ - -/*****************************************************************************/ -/* MTP Format Codes for Generic and Media Types */ -/*****************************************************************************/ - - -/* FORMAT_Undefined - * - * MTP Format: Undefined (0x3000) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_Undefined, - 0x30000000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_Undefined L"Undefined" - - -/* FORMAT_Association - * - * MTP Format: Association (0x3001) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_Association, - 0x30010000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_Association L"Association" - - -/* FORMAT_DeviceScript - * - * MTP Format: Device model-specific script (0x3002) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_DeviceScript, - 0x30020000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_DeviceScript L"DeviceScript" - - -/* FORMAT_DeviceExecutable - * - * MTP Format: Device model-specific executable (0x3003) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_DeviceExecutable, - 0x30030000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_DeviceExecutable L"DeviceExecutable" - - -/* FORMAT_TextDocument - * - * MTP Format: Text file (0x3004) - * Suggested MIME Type: text/plain - */ - -DEFINE_DEVSVCGUID(FORMAT_TextDocument, - 0x30040000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_TextDocument L"TextDocument" - - -/* FORMAT_HTMLDocument - * - * MTP Format: HTML file (0x3005) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_HTMLDocument, - 0x30050000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_HTMLDocument L"HTMLDocument" - - -/* FORMAT_DPOFDocument - * - * MTP Format: Digital Print Order Format file (0x3006) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_DPOFDocument, - 0x30060000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_DPOFDocument L"DPOFDocument" - - -/* FORMAT_AIFFFile - * - * MTP Format: AIFF file (0x3007) - * Suggested MIME Type: audio/aiff - */ - -DEFINE_DEVSVCGUID(FORMAT_AIFFFile, - 0x30070000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AIFFFile L"AIFFFile" - - -/* FORMAT_WAVFile - * - * MTP Format: WAV file (0x3008) - * Suggested MIME Type: audio/wav - */ - -DEFINE_DEVSVCGUID(FORMAT_WAVFile, - 0x30080000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_WAVFile L"WAVFile" - - -/* FORMAT_MP3File - * - * MTP Format: MP3 file (0x3009) - * Suggested MIME Type: audio/mpeg - */ - -DEFINE_DEVSVCGUID(FORMAT_MP3File, - 0x30090000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_MP3File L"MP3File" - - -/* FORMAT_AVIFile - * - * MTP Format: AVI file (0x300A) - * Suggested MIME Type: video/avi - */ - -DEFINE_DEVSVCGUID(FORMAT_AVIFile, - 0x300A0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AVIFile L"AVIFile" - - -/* FORMAT_MPEGFile - * - * MTP Format: MPEG file (0x300B) - * Suggested MIME Type: video/mpeg - */ - -DEFINE_DEVSVCGUID(FORMAT_MPEGFile, - 0x300B0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_MPEGFile L"MPEGFile" - - -/* FORMAT_ASFFile - * - * MTP Format: ASF File (0x300C) - * Suggested MIME Type: audio/asf - */ - -DEFINE_DEVSVCGUID(FORMAT_ASFFile, - 0x300C0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_ASFFile L"ASFFile" - - -/* FORMAT_UnknownImage - * - * MTP Format: Unknown Image (0x3800) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_UnknownImage, - 0x38000000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_UnknownImage L"UnknownImage" - - -/* FORMAT_EXIFImage - * - * MTP Format: EXIF/JPEG file (0x3801) - * Suggested MIME Type: image/jpeg - */ - -DEFINE_DEVSVCGUID(FORMAT_EXIFImage, - 0x38010000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_EXIFImage L"EXIFImage" - - -/* FORMAT_TIFFEPImage - * - * MTP Format: TIFF/EP (Electronic Photography) file (0x3802) - * Suggested MIME Type: image/tif - */ - -DEFINE_DEVSVCGUID(FORMAT_TIFFEPImage, - 0x38020000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_TIFFEPImage L"TIFFEPImage" - - -/* FORMAT_FlashPixImage - * - * MTP Format: Structured Storage Image Format (0x3803) - * Suggested MIME Type: image/fpx - */ - -DEFINE_DEVSVCGUID(FORMAT_FlashPixImage, - 0x38030000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_FlashPixImage L"FlashPixImage" - - -/* FORMAT_BMPImage - * - * MTP Format: Microsoft Windows Bitmap file (0x3804) - * Suggested MIME Type: image/bmp - */ - -DEFINE_DEVSVCGUID(FORMAT_BMPImage, - 0x38040000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_BMPImage L"BMPImage" - - -/* FORMAT_CIFFImage - * - * MTP Format: Canon Camera Image File format (0x3805) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_CIFFImage, - 0x38050000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_CIFFImage L"CIFFImage" - - -/* FORMAT_GIFImage - * - * MTP Format: Graphics Interchange Format (0x3807) - * Suggested MIME Type: image/gif - */ - -DEFINE_DEVSVCGUID(FORMAT_GIFImage, - 0x38070000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_GIFImage L"GIFImage" - - -/* FORMAT_JFIFImage - * - * MTP Format: JPEF File Interchange Format (0x3808) - * Suggested MIME Type: image/jfif - */ - -DEFINE_DEVSVCGUID(FORMAT_JFIFImage, - 0x38080000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_JFIFImage L"JFIFImage" - - -/* FORMAT_PCDImage - * - * MTP Format: PhotoCD Image Pac (0x3809) - * Suggested MIME Type: image/pcd - */ - -DEFINE_DEVSVCGUID(FORMAT_PCDImage, - 0x38090000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_PCDImage L"PCDImage" - - -/* FORMAT_PICTImage - * - * MTP Format: Quickdraw Image Format (0x380A) - * Suggested MIME Type: image/pict - */ - -DEFINE_DEVSVCGUID(FORMAT_PICTImage, - 0x380A0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_PICTImage L"PICTImage" - - -/* FORMAT_PNGImage - * - * MTP Format: Portable Network Graphics (0x380B) - * Suggested MIME Type: image/png - */ - -DEFINE_DEVSVCGUID(FORMAT_PNGImage, - 0x380B0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_PNGImage L"PNGImage" - - -/* FORMAT_TIFFImage - * - * MTP Format: TIFF File (0x380D) - * Suggested MIME Type: image/tif - */ - -DEFINE_DEVSVCGUID(FORMAT_TIFFImage, - 0x380D0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_TIFFImage L"TIFFImage" - - -/* FORMAT_TIFFITImage - * - * MTP Format: TIFF/IT (Graphics Arts) file (0x380E) - * Suggested MIME Type: image/tif - */ - -DEFINE_DEVSVCGUID(FORMAT_TIFFITImage, - 0x380E0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_TIFFITImage L"TIFFITImage" - - -/* FORMAT_JP2Image - * - * MTP Format: JPEG2000 Baseline File Format (0x380F) - * Suggested MIME Type: image/jp2 - */ - -DEFINE_DEVSVCGUID(FORMAT_JP2Image, - 0x380F0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_JP2Image L"JP2Image" - - -/* FORMAT_JPXImage - * - * MTP Format: JPEG2000 Extended File Format (0x3810) - * Suggested MIME Type: image/jp2 - */ - -DEFINE_DEVSVCGUID(FORMAT_JPXImage, - 0x38100000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_JPXImage L"JPXImage" - - -/* FORMAT_FirmwareFile - * - * MTP Format: Firmware (0xB802) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_FirmwareFile, - 0xB8020000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_FirmwareFile L"FirmwareFile" - - -/* FORMAT_HDPhotoImage - * - * MTP Format: HD Photo (Windows Media Photo) file (0xB881) - * Suggested MIME Type: image/vnd.ms-photo - */ - -DEFINE_DEVSVCGUID(FORMAT_HDPhotoImage, - 0xB8810000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_HDPhotoImage L"HDPhotoImage" - - -/* FORMAT_UndefinedAudio - * - * MTP Format: Undefined Audio (0xB900) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_UndefinedAudio, - 0xB9000000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_UndefinedAudio L"UndefinedAudio" - - -/* FORMAT_WMAFile - * - * MTP Format: WMA file (0xB901) - * Suggested MIME Type: audio/x-ms-wma - */ - -DEFINE_DEVSVCGUID(FORMAT_WMAFile, - 0xB9010000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_WMAFile L"WMAFile" - - -/* FORMAT_OGGFile - * - * MTP Format: OGG file (0xB902) - * Suggested MIME Type: audio/x-ogg - */ - -DEFINE_DEVSVCGUID(FORMAT_OGGFile, - 0xB9020000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_OGGFile L"OGGFile" - - -/* FORMAT_AACFile - * - * MTP Format: AAC file (0xB903) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AACFile, - 0xB9030000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AACFile L"AACFile" - - -/* FORMAT_AudibleFile - * - * MTP Format: Audible file (0xB904) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AudibleFile, - 0xB9040000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AudibleFile L"AudibleFile" - - -/* FORMAT_FLACFile - * - * MTP Format: FLAC file (0xB906) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_FLACFile, - 0xB9060000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_FLACFile L"FLACFile" - - -/* FORMAT_UndefinedVideo - * - * MTP Format: Undefined Video (0xB980) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_UndefinedVideo, - 0xB9890000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_UndefinedVideo L"UndefinedVideo" - - -/* FORMAT_WMVFile - * - * MTP Format: WMV file (0xB981) - * Suggested MIME Type: video/x-ms-wmv - */ - -DEFINE_DEVSVCGUID(FORMAT_WMVFile, - 0xB9810000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_WMVFile L"WMVFile" - - -/* FORMAT_MPEG4File - * - * MTP Format: MPEG-4 Video file (0xB982) - * Suggested MIME Type: video/mp4v-es - */ - -DEFINE_DEVSVCGUID(FORMAT_MPEG4File, - 0xB9820000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_MPEG4File L"MPEG4File" - - -/* FORMAT_MPEG2File - * - * MTP Format: MPEG-2 Video file (0xB983) - * Suggested MIME Type: video/mpeg - */ - -DEFINE_DEVSVCGUID(FORMAT_MPEG2File, - 0xB9830000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_MPEG2File L"MPEG2File" - - -/* FORMAT_3GPPFile - * - * MTP Format: 3GPP Video file (0xB984) - * Suggested MIME Type: video/3gpp - */ - -DEFINE_DEVSVCGUID(FORMAT_3GPPFile, - 0xB9840000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_3GPPFile L"3GPPFile" - - -/* FORMAT_UndefinedCollection - * - * MTP Format: Undefined Collection (0xBA00) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_UndefinedCollection, - 0xBA060000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_UndefinedCollection L"UndefinedCollection" - - -/* FORMAT_AbstractMultimediaAlbum - * - * MTP Format: Abstract Multimedia Album (0xBA01) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractMultimediaAlbum, - 0xBA010000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AbstractMultimediaAlbum L"AbstractMultimediaAlbum" - - -/* FORMAT_AbstractImageAlbum - * - * MTP Format: Abstract Image Album (0xBA02) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractImageAlbum, - 0xBA020000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AbstractImageAlbum L"AbstractImageAlbum" - - -/* FORMAT_AbstractAudioAlbum - * - * MTP Format: Abstract Audio Album (0xBA03) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractAudioAlbum, - 0xBA030000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AbstractAudioAlbum L"AbstractAudioAlbum" - - -/* FORMAT_AbstractVideoAlbum - * - * MTP Format: Abstract Video Album (0xBA04) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractVideoAlbum, - 0xBA040000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AbstractVideoAlbum L"AbstractVideoAlbum" - - -/* FORMAT_AbstractAudioVideoAlbum - * - * MTP Format: Abstract Audio & Video Playlist (0xBA05) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractAudioVideoAlbum, - 0xBA050000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AbstractAudioVideoAlbum L"AbstractAudioVideoAlbum" - - -/* FORMAT_AbstractChapteredProduction - * - * MTP Format: Abstract Chaptered Production (0xBA08) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractChapteredProduction, - 0xBA080000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AbstractChapteredProduction L"AbstractChapteredProduction" - - -/* FORMAT_AbstractAudioPlaylist - * - * MTP Format: Abstract Audio Playlist (0xBA09) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractAudioPlaylist, - 0xBA090000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AbstractAudioPlaylist L"AbstractAudioPlaylist" - - -/* FORMAT_AbstractVideoPlaylist - * - * MTP Format: Abstract Video Playlist (0xBA0A) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractVideoPlaylist, - 0xBA0A0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AbstractVideoPlaylist L"AbstractVideoPlaylist" - - -/* FORMAT_AbstractMediacast - * - * MTP Format: Abstract Mediacast (0xBA0B) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractMediacast, - 0xBA0B0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AbstractMediacast L"AbstractMediacast" - - -/* FORMAT_WPLPlaylist - * - * MTP Format: WPL Playlist (0xBA10) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_WPLPlaylist, - 0xBA100000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_WPLPlaylist L"WPLPlaylist" - - -/* FORMAT_M3UPlaylist - * - * MTP Format: M3U Playlist (0xBA11) - * Suggested MIME Type: audio/mpeg-url - */ - -DEFINE_DEVSVCGUID(FORMAT_M3UPlaylist, - 0xBA110000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_M3UPlaylist L"M3UPlaylist" - - -/* FORMAT_MPLPlaylist - * - * MTP Format: MPL Playlist (0xBA12) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_MPLPlaylist, - 0xBA120000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_MPLPlaylist L"MPLPlaylist" - - -/* FORMAT_ASXPlaylist - * - * MTP Format: ASX Playlist (0xBA13) - * Suggested MIME Type: video/x-ms-asf - */ - -DEFINE_DEVSVCGUID(FORMAT_ASXPlaylist, - 0xBA130000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_ASXPlaylist L"ASXPlaylist" - - -/* FORMAT_PSLPlaylist - * - * MTP Format: PLS Playlist (0xBA14) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_PSLPlaylist, - 0xBA140000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_PSLPlaylist L"PSLPlaylist" - - -/* FORMAT_UndefinedDocument - * - * MTP Format: Undefined Document (0xBA80) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_UndefinedDocument, - 0xBA800000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_UndefinedDocument L"UndefinedDocument" - - -/* FORMAT_AbstractDocument - * - * MTP Format: Abstract Document (0xBA81) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractDocument, - 0xBA810000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AbstractDocument L"AbstractDocument" - - -/* FORMAT_XMLDocument - * - * MTP Format: XML Document (0xBA82) - * Suggested MIME Type: text/xml - */ - -DEFINE_DEVSVCGUID(FORMAT_XMLDocument, - 0xBA820000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_XMLDocument L"XMLDocument" - - -/* FORMAT_WordDocument - * - * MTP Format: Microsoft Word Document (0xBA83) - * Suggested MIME Type: application/msword - */ - -DEFINE_DEVSVCGUID(FORMAT_WordDocument, - 0xBA830000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_WordDocument L"WordDocument" - - -/* FORMAT_MHTDocument - * - * MTP Format: MHT Compiled HTML Document (0xBA84) - * Suggested MIME Type: message/rfc822 - */ - -DEFINE_DEVSVCGUID(FORMAT_MHTDocument, - 0xBA840000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_MHTDocument L"MHTDocument" - - -/* FORMAT_ExcelDocument - * - * MTP Format: Microsoft Excel Document (0xBA85) - * Suggested MIME Type: application/msexcel - */ - -DEFINE_DEVSVCGUID(FORMAT_ExcelDocument, - 0xBA850000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_ExcelDocument L"ExcelDocument" - - -/* FORMAT_PowerPointDocument - * - * MTP Format: Microsoft PowerPoint Document (0xBA86) - * Suggested MIME Type: application/mspowerpoint - */ - -DEFINE_DEVSVCGUID(FORMAT_PowerPointDocument, - 0xBA860000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_PowerPointDocument L"PowerPointDocument" - - -/*****************************************************************************/ -/* MTP Object Property Codes for Generic and Media Types */ -/*****************************************************************************/ - -/* GenericObj.ObjectID - * - * MTP Property: () - * Type: UInt128 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_ObjectID, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 2); - -#define NAME_GenericObj_ObjectID L"ObjectID" - - -/* GenericObj.StorageID - * - * MTP Property: Storage ID (0xDC01) - * Type: UInt32 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_StorageID, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 23); - -#define NAME_GenericObj_StorageID L"StorageID" - - -/* GenericObj.ObjectFormat - * - * MTP Property: Object Format (0xDC02) - * Type: UInt16 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_ObjectFormat, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 6); - -#define NAME_GenericObj_ObjectFormat L"ObjectFormat" - - -/* GenericObj.ProtectionStatus - * - * MTP Property: Protection Status (0xDC03) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_ProtectionStatus, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 26); - -#define NAME_GenericObj_ProtectionStatus L"ProtectionStatus" - - -/* GenericObj.ObjectSize - * - * MTP Property: Object Size (0xDC04) - * Type: UInt64 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_ObjectSize, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 11); - -#define NAME_GenericObj_ObjectSize L"ObjectSize" - - -/* GenericObj.AssociationType - * - * MTP Property: Association Type (0xDC05) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_AssociationType, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 32); - -#define NAME_GenericObj_AssociationType L"AssociationType" - - -/* GenericObj.AssociationDesc - * - * MTP Property: Association Desc (0xDC06) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_AssociationDesc, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 33); - -#define NAME_GenericObj_AssociationDesc L"AssociationDesc" - - -/* GenericObj.ObjectFileName - * - * MTP Property: Object File Name (0xDC07) - * Type: String - * Form: None/RegEx - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_ObjectFileName, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 12); - -#define NAME_GenericObj_ObjectFileName L"ObjectFileName" - - -/* GenericObj.DateCreated - * - * MTP Property: Date Created (0xDC08) - * Type: String - * Form: DateTime - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_DateCreated, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 39); - -#define NAME_GenericObj_DateCreated L"DateCreated" - - -/* GenericObj.DateModified - * - * MTP Property: Date Modified (0xDC09) - * Type: String - * Form: DateTime - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_DateModified, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 40); - -#define NAME_GenericObj_DateModified L"DateModified" - - -/* GenericObj.Keywords - * - * MTP Property: Keywords (0xDC0A) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_Keywords, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 15); - -#define NAME_GenericObj_Keywords L"Keywords" - - -/* GenericObj.ParentID - * - * MTP Property: Parent Object (0xDC0B) - * Type: UInt32 - * Form: ObjectID - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_ParentID, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 3); - -#define NAME_GenericObj_ParentID L"ParentID" - - -/* GenericObj.AllowedFolderContents - * - * MTP Property: Allowed Folder Contents (0xDC0C) - * Type: AUInt16 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_AllowedFolderContents, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 34); - -#define NAME_GenericObj_AllowedFolderContents L"AllowedFolderContents" - - -/* GenericObj.Hidden - * - * MTP Property: Hidden (0xDC0D) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_Hidden, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 28); - -#define NAME_GenericObj_Hidden L"Hidden" - - -/* GenericObj.SystemObject - * - * MTP Property: System Object (0xDC0E) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_SystemObject, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 29); - -#define NAME_GenericObj_SystemObject L"SystemObject" - - -/* GenericObj.PersistentUID - * - * MTP Property: Persistent Unique Object ID (0xDC41) - * Type: UInt128 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_PersistentUID, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 5); - -#define NAME_GenericObj_PersistentUID L"PersistentUID" - - -/* GenericObj.SyncID - * - * MTP Property: Sync ID (0xDC42) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_SyncID, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 16); - -#define NAME_GenericObj_SyncID L"SyncID" - - -/* GenericObj.PropertyBag - * - * MTP Property: Property Bag (0xDC43) - * Type: AUInt16 - * Form: LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_PropertyBag, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 35); - -#define NAME_GenericObj_PropertyBag L"PropertyBag" - - -/* GenericObj.Name - * - * MTP Property: Name (0xDC44) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_Name, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 4); - -#define NAME_GenericObj_Name L"Name" - - -/* MediaObj.Artist - * - * MTP Property: Artist (0xDC46) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Artist, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 24); - -#define NAME_MediaObj_Artist L"Artist" - - -/* GenericObj.DateAuthored - * - * MTP Property: Date Authored (0xDC47) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_DateAuthored, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 41); - -#define NAME_GenericObj_DateAuthored L"DateAuthored" - - -/* GenericObj.Description - * - * MTP Property: Description (0xDC48) - * Type: AUInt16 - * Form: LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_Description, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 45); - -#define NAME_GenericObj_Description L"Description" - - -/* GenericObj.LanguageLocale - * - * MTP Property: Language Locale (0xDC4A) - * Type: String - * Form: RegEx - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_LanguageLocale, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 27); - -#define NAME_GenericObj_LanguageLocale L"LanguageLocale" - - -/* GenericObj.Copyright - * - * MTP Property: Copyright Information (0xDC4B) - * Type: AUInt16 - * Form: LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_Copyright, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 38); - -#define NAME_GenericObj_Copyright L"Copyright" - - -/* VideoObj.Source - * - * MTP Property: Source (0xDC4C) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_VideoObj_Source, - 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A, - 4); - -#define NAME_VideoObj_Source L"Source" - - -/* MediaObj.GeographicOrigin - * - * MTP Property: Origin Location (0xDC4D) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_GeographicOrigin, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 40); - -#define NAME_MediaObj_GeographicOrigin L"GeographicOrigin" - - -/* GenericObj.DateAdded - * - * MTP Property: Date Added (0xDC4E) - * Type: String - * Form: DateTime - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_DateAdded, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 36); - -#define NAME_GenericObj_DateAdded L"DateAdded" - - -/* GenericObj.NonConsumable - * - * MTP Property: Non-Consumable (0xDC4F) - * Type: UInt8 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_NonConsumable, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 30); - -#define NAME_GenericObj_NonConsumable L"NonConsumable" - - -/* GenericObj.Corrupt - * - * MTP Property: Corrupt (0xDC50) - * Type: UInt8 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_Corrupt, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 37); - -#define NAME_GenericObj_Corrupt L"Corrupt" - - -/* MediaObj.Width - * - * MTP Property: Width (0xDC87) - * Type: UInt32 - * Form: Range - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Width, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 22); - -#define NAME_MediaObj_Width L"Width" - - -/* MediaObj.Height - * - * MTP Property: Height (0xDC88) - * Type: UInt32 - * Form: Range - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Height, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 23); - -#define NAME_MediaObj_Height L"Height" - - -/* MediaObj.Duration - * - * MTP Property: Duration (0xDC89) - * Type: UInt32 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Duration, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 19); - -#define NAME_MediaObj_Duration L"Duration" - - -/* MediaObj.UserRating - * - * MTP Property: Rating (0xDC8A) - * Type: UInt16 - * Form: Range - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_UserRating, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 17); - -#define NAME_MediaObj_UserRating L"UserRating" - - -/* MediaObj.Track - * - * MTP Property: Track (0xDC8B) - * Type: UInt16 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Track, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 43); - -#define NAME_MediaObj_Track L"Track" - - -/* MediaObj.Genre - * - * MTP Property: Genre (0xDC8C) - * Type: String - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Genre, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 32); - -#define NAME_MediaObj_Genre L"Genre" - - -/* MediaObj.Credits - * - * MTP Property: Credits (0xDC8D) - * Type: AUInt16 - * Form: LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Credits, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 47); - -#define NAME_MediaObj_Credits L"Credits" - - -/* AudioObj.Lyrics - * - * MTP Property: Lyrics (0xDC8E) - * Type: AUInt16 - * Form: LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_AudioObj_Lyrics, - 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6, - 6); - -#define NAME_AudioObj_Lyrics L"Lyrics" - - -/* MediaObj.SubscriptionContentID - * - * MTP Property: Subscription Content ID (0xDC8F) - * Type: String - * Form: RegEx - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_SubscriptionContentID, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 5); - -#define NAME_MediaObj_SubscriptionContentID L"SubscriptionContentID" - - -/* MediaObj.Producer - * - * MTP Property: Produced By (0xDC90) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Producer, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 45); - -#define NAME_MediaObj_Producer L"Producer" - - -/* MediaObj.UseCount - * - * MTP Property: Use Count (0xDC91) - * Type: UInt32 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_UseCount, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 6); - -#define NAME_MediaObj_UseCount L"UseCount" - - -/* MediaObj.SkipCount - * - * MTP Property: Skip Count (0xDC92) - * Type: UInt32 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_SkipCount, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 7); - -#define NAME_MediaObj_SkipCount L"SkipCount" - - -/* GenericObj.DateAccessed - * - * MTP Property: Last Accessed (0xDC93) - * Type: String - * Form: DateTime - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_DateAccessed, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 42); - -#define NAME_GenericObj_DateAccessed L"DateAccessed" - - -/* MediaObj.ParentalRating - * - * MTP Property: Parental Rating (0xDC94) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_ParentalRating, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 9); - -#define NAME_MediaObj_ParentalRating L"ParentalRating" - - -/* MediaObj.MediaType - * - * MTP Property: Meta Genre (0xDC95) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_MediaType, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 10); - -#define NAME_MediaObj_MediaType L"MediaType" - - -/* MediaObj.Composer - * - * MTP Property: Composer (0xDC96) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Composer, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 11); - -#define NAME_MediaObj_Composer L"Composer" - - -/* MediaObj.EffectiveRating - * - * MTP Property: Effective Rating (0xDC97) - * Type: UInt16 - * Form: Range - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_EffectiveRating, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 12); - -#define NAME_MediaObj_EffectiveRating L"EffectiveRating" - - -/* MediaObj.Subtitle - * - * MTP Property: Subtitle (0xDC98) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Subtitle, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 13); - -#define NAME_MediaObj_Subtitle L"Subtitle" - - -/* MediaObj.DateOriginalRelease - * - * MTP Property: Original Release Date (0xDC99) - * Type: String - * Form: DateTime - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_DateOriginalRelease, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 41); - -#define NAME_MediaObj_DateOriginalRelease L"DateOriginalRelease" - - -/* MediaObj.AlbumName - * - * MTP Property: Album Name (0xDC9A) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_AlbumName, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 42); - -#define NAME_MediaObj_AlbumName L"AlbumName" - - -/* MediaObj.AlbumArtist - * - * MTP Property: Album Artist (0xDC9B) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_AlbumArtist, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 25); - -#define NAME_MediaObj_AlbumArtist L"AlbumArtist" - - -/* MediaObj.Mood - * - * MTP Property: Mood (0xDC9C) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Mood, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 44); - -#define NAME_MediaObj_Mood L"Mood" - - -/* GenericObj.DRMStatus - * - * MTP Property: DRM Status (0xDC9D) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_DRMStatus, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 31); - -#define NAME_GenericObj_DRMStatus L"DRMStatus" - - -/* GenericObj.SubDescription - * - * MTP Property: Sub Description (0xDC9E) - * Type: AUInt16 - * Form: LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_SubDescription, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 46); - -#define NAME_GenericObj_SubDescription L"SubDescription" - - -/* ImageObj.IsCropped - * - * MTP Property: Is Cropped (0xDCD1) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_ImageObj_IsCropped, - 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB, - 4); - -#define NAME_ImageObj_IsCropped L"IsCropped" - - -/* ImageObj.IsColorCorrected - * - * MTP Property: Is Colour Corrected (0xDCD2) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_ImageObj_IsColorCorrected, - 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB, - 5); - -#define NAME_ImageObj_IsColorCorrected L"IsColorCorrected" - - -/* ImageObj.ImageBitDepth - * - * MTP Property: Image Bit Depth (0xDCD3) - * Type: UInt32 - * Form: Range/Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_ImageObj_ImageBitDepth, - 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB, - 3); - -#define NAME_ImageObj_ImageBitDepth L"ImageBitDepth" - - -/* ImageObj.Aperature - * - * MTP Property: Fnumber (0xDCD4) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_ImageObj_Aperature, - 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB, - 6); - -#define NAME_ImageObj_Aperature L"Aperature" - - -/* ImageObj.Exposure - * - * MTP Property: Exposure Time (0xDCD5) - * Type: UInt32 - * Form: Range/Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_ImageObj_Exposure, - 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB, - 7); - -#define NAME_ImageObj_Exposure L"Exposure" - - -/* ImageObj.ISOSpeed - * - * MTP Property: Exposure Index (0xDCD6) - * Type: UInt16 - * Form: Range/Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_ImageObj_ISOSpeed, - 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB, - 8); - -#define NAME_ImageObj_ISOSpeed L"ISOSpeed" - - -/* MediaObj.Owner - * - * MTP Property: Owner (0xDD5D) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Owner, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 26); - -#define NAME_MediaObj_Owner L"Owner" - - -/* MediaObj.Editor - * - * MTP Property: Editor (0xDD5E) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_Editor, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 27); - -#define NAME_MediaObj_Editor L"Editor" - - -/* MediaObj.WebMaster - * - * MTP Property: WebMaster (0xDD5F) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_WebMaster, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 28); - -#define NAME_MediaObj_WebMaster L"WebMaster" - - -/* MediaObj.URLSource - * - * MTP Property: URL Source (0xDD60) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_URLSource, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 29); - -#define NAME_MediaObj_URLSource L"URLSource" - - -/* MediaObj.URLLink - * - * MTP Property: URL Destination (0xDD61) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_URLLink, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 30); - -#define NAME_MediaObj_URLLink L"URLLink" - - -/* MediaObj.BookmarkTime - * - * MTP Property: Time Bookmark (0xDD62) - * Type: UInt32 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_BookmarkTime, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 33); - -#define NAME_MediaObj_BookmarkTime L"BookmarkTime" - - -/* MediaObj.BookmarkObject - * - * MTP Property: Object Bookmark (0xDD63) - * Type: UInt32 - * Form: ObjectID - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_BookmarkObject, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 34); - -#define NAME_MediaObj_BookmarkObject L"BookmarkObject" - - -/* MediaObj.BookmarkByte - * - * MTP Property: Byte Bookmark (0xDD64) - * Type: UInt64 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_BookmarkByte, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 36); - -#define NAME_MediaObj_BookmarkByte L"BookmarkByte" - - -/* GenericObj.DateRevised - * - * MTP Property: Last Build Date (0xDD70) - * Type: String - * Form: DateTime - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_DateRevised, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 43); - -#define NAME_GenericObj_DateRevised L"DateRevised" - - -/* GenericObj.TimeToLive - * - * MTP Property: Time To Live (0xDD71) - * Type: UInt64 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_TimeToLive, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 44); - -#define NAME_GenericObj_TimeToLive L"TimeToLive" - - -/* MediaObj.MediaUID - * - * MTP Property: Media GUID (0xDD72) - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_MediaUID, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 38); - -#define NAME_MediaObj_MediaUID L"MediaUID" - - -/* MediaObj.TotalBitRate - * - * MTP Property: Total Bit Rate (0xDE91) - * Type: UInt32 - * Form: Range/Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_TotalBitRate, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 2); - -#define NAME_MediaObj_TotalBitRate L"TotalBitRate" - - -/* MediaObj.BitRateType - * - * MTP Property: Bit Rate Type (0xDE92) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_BitRateType, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 3); - -#define NAME_MediaObj_BitRateType L"BitRateType" - - -/* MediaObj.SampleRate - * - * MTP Property: Sample Rate (0xDE93) - * Type: UInt32 - * Form: Range/Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_SampleRate, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 15); - -#define NAME_MediaObj_SampleRate L"SampleRate" - - -/* AudioObj.Channels - * - * MTP Property: Number of Channels (0xDE94) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_AudioObj_Channels, - 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6, - 10); - -#define NAME_AudioObj_Channels L"Channels" - - -/* AudioObj.AudioBitDepth - * - * MTP Property: Audio Bit Depth (0xDE95) - * Type: UInt32 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_AudioObj_AudioBitDepth, - 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6, - 12); - -#define NAME_AudioObj_AudioBitDepth L"AudioBitDepth" - - -/* AudioObj.AudioBlockAlignment - * - * MTP Property: Audio Block Alignment (0xDE96) - * Type: UInt32 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_AudioObj_AudioBlockAlignment, - 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6, - 13); - -#define NAME_AudioObj_AudioBlockAlignment L"AudioBlockAlignment" - - -/* VideoObj.ScanType - * - * MTP Property: Video Scan Type (0xDE97) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_VideoObj_ScanType, - 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A, - 12); - -#define NAME_VideoObj_ScanType L"ScanType" - - -/* AudioObj.AudioFormatCode - * - * MTP Property: Audio WAVE Codec (0xDE99) - * Type: UInt32 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_AudioObj_AudioFormatCode, - 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6, - 11); - -#define NAME_AudioObj_AudioFormatCode L"AudioFormatCode" - - -/* AudioObj.AudioBitRate - * - * MTP Property: Audio Bit Rate (0xDE9A) - * Type: UInt32 - * Form: Range/Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_AudioObj_AudioBitRate, - 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6, - 9); - -#define NAME_AudioObj_AudioBitRate L"AudioBitRate" - - -/* VideoObj.VideoFormatCode - * - * MTP Property: Video FourCC Codec (0xDE9B) - * Type: UInt32 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_VideoObj_VideoFormatCode, - 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A, - 14); - -#define NAME_VideoObj_VideoFormatCode L"VideoFormatCode" - - -/* VideoObj.VideoBitRate - * - * MTP Property: Video Bit Rate (0xDE9C) - * Type: UInt32 - * Form: Range/Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_VideoObj_VideoBitRate, - 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A, - 13); - -#define NAME_VideoObj_VideoBitRate L"VideoBitRate" - - -/* VideoObj.VideoFrameRate - * - * MTP Property: Frames Per Thousand Seconds (0xDE9D) - * Type: UInt32 - * Form: Range/Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_VideoObj_VideoFrameRate, - 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A, - 15); - -#define NAME_VideoObj_VideoFrameRate L"VideoFrameRate" - - -/* VideoObj.KeyFrameDistance - * - * MTP Property: Key Frame Distance (0xDE9E) - * Type: UInt32 - * Form: Range - */ - -DEFINE_DEVSVCPROPKEY(PKEY_VideoObj_KeyFrameDistance, - 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A, - 10); - -#define NAME_VideoObj_KeyFrameDistance L"KeyFrameDistance" - - -/* MediaObj.BufferSize - * - * MTP Property: Buffer Size (0xDE9F) - * Type: UInt32 - * Form: Range - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_BufferSize, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 46); - -#define NAME_MediaObj_BufferSize L"BufferSize" - - -/* MediaObj.EncodingQuality - * - * MTP Property: Encoding Quality (0xDEA0) - * Type: UInt32 - * Form: Range - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_EncodingQuality, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 48); - -#define NAME_MediaObj_EncodingQuality L"EncodingQuality" - - -/* MediaObj.EncodingProfile - * - * MTP Property: Encoding Profile (0xDEA1) - * Type: String - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MediaObj_EncodingProfile, - 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8, - 21); - -#define NAME_MediaObj_EncodingProfile L"EncodingProfile" - - -/* GenericObj.ReferenceParentID - * - * This write only property is used when creating object references to help - * hint the responder implementation to the parent item that this object will - * be associated with. - * - * Type: UInt32 - * Form: ObjectID - */ - -DEFINE_DEVSVCPROPKEY(PKEY_GenericObj_ReferenceParentID, - 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, - 47); - -#define NAME_GenericObj_ReferenceParentID L"ReferenceParentID" - -#endif /* _BRIDGEDEVICESERVICE_H_ */ - diff --git a/pub/ddk/bthddi.h b/pub/ddk/bthddi.h deleted file mode 100644 index ee797a4..0000000 --- a/pub/ddk/bthddi.h +++ /dev/null @@ -1,2025 +0,0 @@ -/*++ - -Copyright (c) 2000 Microsoft Corporation - -Module Name: - - BTHDDI.H - -Abstract: - - Public structures common to the BTHPORT and BTH client device drivers - -Environment: - - Kernel & user mode - -Revision History: - - --*/ - -#ifndef __BTHDDI_H__ -#define __BTHDDI_H__ - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4201) // nameless struct/union - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// -// DEFINES -// - -// BTHPORT BRB header context size. -#define BTHPORT_CONTEXT_SIZE (4) - -#define BTHPORT_RESERVED_FIELD_SIZE (2) - - -//////////////////////// NOTES /////////////////////////////////////////////// -// 1) BRB Clients need to send IRP_MJ_INTERNAL_DEVICE_CONTROL to -// the BTH Port driver with IOCTL_INTERNAL_BTH_SUBMIT_BRB Device I/O code. -// In addition, the client driver needs to pass a BRB pointer in Argument1 -// of IRP stack location. -// 2) Client drivers can submit data buffers of either type MDL, or PVOID -// buffer but not both. -// 3) Client drivers need to QI the bus driver before they can submit any BRB. -// This is necessary in order to provide the event callback entry points. -// Optional event handlers are designated as such with [O] in the -// BTHPORT_INTERFACE structure below. -///////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// Possible error codes returned by the bus driver. -// -// STATUS_PENDING : Request is queued for execution. -// -// STATUS_SUCCESS: Request completed successfully. -// -// STATUS_INSUFFICIENT_RESOURCES: request failed due to lack of resources. -// -// STATUS_UNSUCCESSFUL: Request did not complte successfully. -// -// STATUS_CANCELLED: BRB/IRP was cancelled . -// -// STATUS_INVALID_PARAMETER: sumbitted BRB has invalid paramters. -// -// STATUS_INVALID_DEVICE_REQUEST: undefined request. -// -// STATUS_PROTOCOL_UNREACHBLE: remote device did not accept the -// l2cap connection with the specified PSM. -// -// STATUS_DEVICE_CONFIGURATION_ERROR: remote device did not -// agree to L2cap default configuration parameters and/or MTU size. -// -// STATUS_DEVICE_NOT_EXIST: Radio is not available. -// -// STATUS_BUFFER_TOO_SMALL: client submitted buffer is too small. -// -// The following Bluetooth error codes will be mapped to NTSTATUS code: - -/* -BTHSTATUS: NTSTATUS: - -BTH_ERROR_SUCCESS STATUS_SUCCESS -BTH_ERROR_NO_CONNECTION STATUS_INVALID_HANDLE -BTH_ERROR_HARDWARE_FAILURE STATUS_ADAPTER_HARDWARE_ERROR -BTH_ERROR_PAGE_TIMEOUT STATUS_TIMEOUT -BTH_ERROR_AUTHENTICATION_FAILURE STATUS_MUTUAL_AUTHENTICATION_FAILED -BTH_ERROR_KEY_MISSING STATUS_NO_USER_SESSION_KEY -BTH_ERROR_MEMORY_FULL STATUS_INSUFFICIENT_RESOURCES -BTH_ERROR_CONNECTION_TIMEOUT STATUS_LINK_TIMEOUT -BTH_ERROR_MAX_NUMBER_OF_CONNECTIONS STATUS_CONNECTION_COUNT_LIMIT -BTH_ERROR_MAX_NUMBER_OF_SCO_CONNECTIONS STATUS_CONNECTION_COUNT_LIMIT -BTH_ERROR_ACL_CONNECTION_ALREADY_EXISTS STATUS_CONNECTION_IN_USE -BTH_ERROR_COMMAND_DISALLOWED STATUS_INVALID_PARAMETER -BTH_ERROR_HOST_REJECTED_LIMITED_RESOURCES STATUS_INSUFFICIENT_RESOURCES -BTH_ERROR_HOST_REJECTED_SECURITY_REASONS STATUS_CONNECTION_REFUSED -BTH_ERROR_HOST_REJECTED_PERSONAL_DEVICE STATUS_CONNECTION_REFUSED -BTH_ERROR_HOST_TIMEOUT STATUS_TIMEOUT -BTH_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER STATUS_INVALID_PARAMETER -BTH_ERROR_INVALID_HCI_PARAMETER STATUS_INVALID_PARAMETER -BTH_ERROR_REMOTE_USER_ENDED_CONNECTION STATUS_REMOTE_DISCONNECT -BTH_ERROR_REMOTE_LOW_RESOURCES STATUS_REMOTE_RESOURCES -BTH_ERROR_REMOTE_POWERING_OFF STATUS_REMOTE_RESOURCES -BTH_ERROR_LOCAL_HOST_TERMINATED_CONNECTION STATUS_CONNECTION_DISCONNECTED -BTH_ERROR_PAIRING_NOT_ALLOWED STATUS_MUTUAL_AUTHENTICATION_FAILED -BTH_ERROR_UNSUPPORTED_REMOTE_FEATURE STATUS_ADAPTER_HARDWARE_ERROR -BTH_ERROR_UNSPECIFIED_ERROR STATUS_ADAPTER_HARDWARE_ERROR -BTH_ERROR_ROLE_CHANGE_NOT_ALLOWED STATUS_INVALID_PARAMETER - - */ - - - -// -// version for QI, encoded in binary encoded decimal, ie 1.0 -// -#define BTHDDI_ENUMERATOR_INTERFACE_VERSION_FOR_QI (0x0200) -#define BTHDDI_PROFILE_DRIVER_INTERFACE_VERSION_FOR_QI (0x0200) - -// -// Create - enumerate the PDO, the device is in range -// Remove - remove the PDO, the device is in range -// Destroy - force remove the PDO, the user no longer wants to use this -// protocol / service -// -typedef enum _ENUMERATOR_ACTION { - ENUMERATOR_ACTION_CREATE = 0, - ENUMERATOR_ACTION_REMOVE, - ENUMERATOR_ACTION_DESTROY, - ENUMERATOR_ACTION_MAX, -} ENUMERATOR_ACTION, *PENUMERATOR_ACTION; - -typedef enum _ENUMERATOR_TYPE { - ENUMERATOR_TYPE_PROTOCOL = 0, - ENUMERATOR_TYPE_SERVICE, - ENUMERATOR_TYPE_MAX, -} ENUMERATOR_TYPE, *PENUMERATOR_TYPE; - -// -// BTH_ENUMERATOR_INFO Flags -// - -#define BTH_ENUMERATORFL_INCOMING 0x00000001 -#define BTH_ENUMERATORFL_OUTGOING 0x00000002 -#define BTH_ENUMERATORFL_REENUM 0x00000004 - -typedef struct _BTH_ENUMERATOR_INFO { - // - // Type of connection being requested - // - ENUMERATOR_TYPE EnumeratorType; - - // - // Action to take - // - ENUMERATOR_ACTION Action; - - // - // Psm being connected to if this is an L2CAP connect request, RFCOMM - // DLCI if this is an RFCOMM connection request. - // - ULONG Port; - - // - // Flags - // - - ULONG Flags; - - // - // Protocol / Service UUID for the enumeration action - // - GUID Guid; - - // - // Instance ID of the Protocol / Service for BTH_ENUMERATORFL_INCOMING - // - ULONG InstanceId; - - // - // Instance ID str of the Protocol / Service for BTH_ENUMERATORFL_OUTGOING - // - - WCHAR InstanceIdStr[BTH_MAX_SERVICE_NAME_SIZE]; - - // - // Vendor ID, retrieved from DI SDP record - // - USHORT Vid; - - // - // Product ID, retrieved from DI SDP record - // - USHORT Pid; - - // - // Manufacturer, retrieved from DI SDP record - // - USHORT Mfg; - - // - // Local radio manufacturer, retreived via HCI Command - // - USHORT LocalMfg; - - - // - // Vendor ID type, retrieved from DI SDP record - // - USHORT VidType; - - // - // Service Name (Used for local services) - // - WCHAR ServiceName[BTH_MAX_SERVICE_NAME_SIZE]; - - // - // Identifier used for remote services. - // - CHAR SdpPriLangServiceName[BTH_MAX_SERVICE_NAME_SIZE]; - - // - // Device string passed down on BTH_UPDATE ADD - // - WCHAR DeviceString[BTH_MAX_SERVICE_NAME_SIZE]; - -} BTH_ENUMERATOR_INFO, *PBTH_ENUMERATOR_INFO; - - - -typedef PVOID L2CAP_CHANNEL_HANDLE; - -typedef PVOID L2CAP_SERVER_HANDLE; - -typedef PVOID SCO_SERVER_HANDLE; - -// -// BRB types.. -// - -/*++ -////////////////////////// HCI GENERAL COMMANDS //////////////////////////// - BRB_HCI_INQUIRY - trigger radio to issue an hci inquiry cmd. - BRB_HCI_CANCEL_INQUIRY - Cancel inquiry cmd. - BRB_HCI_GET_DEVICE_LIST - return a list of device info blkd entries. - BRB_HCI_GET_LOCAL_BD_ADDR - return BTH_ADDR of local radio. - BRB_HCI_GET_SIGNAL_PARAMETERS - return RSSI and transmit power level info - for local radio. - BRB_HCI_UNKNOWN_CMD - -////////////////////////////// HCI SCO COMMANDS //////////////////////////// - BRB_SCO_OPEN, - for isochronous requests - BRB_SCO_CLOSE, - close an isoch connection. - BRB_SCO_READ, - read data from Isoch channel - BRB_SCO_WRITE, - write data to isoch channel - -////////////////////////////// L2CAP COMMANDS ///////////////////////////// - BRB_L2CA_CONNECT_REQ, - used for L2cap connection request.. - BRB_L2CA_CONNECT_RSP, - L2cap server's response to connection request. - BRB_L2CA_DISCONNECT_REQ, - to disconnect an established l2cap connection. - BRB_L2CA_CONFIG_REQ, - Configure L2cap connection for QoS, etc.. - BRB_L2CA_ACL_TRANSFER, - read or write ACL data - -////////////////////////////// Register and Deregister PSM values ///////// - BRB_REGISTER_PSM, - Register a PSM value - BRB_UNREGISTER_PSM, - Unregister a PSM value - - --*/ - -#ifndef BRBTYPE -typedef enum _BRB_TYPE { - BRB_HCI_GET_LOCAL_BD_ADDR = 0x0001, - BRB_L2CA_REGISTER_SERVER = 0x0100, - BRB_L2CA_UNREGISTER_SERVER = 0x0101, - BRB_L2CA_OPEN_CHANNEL = 0x0102, - BRB_L2CA_OPEN_CHANNEL_RESPONSE = 0x0103, - BRB_L2CA_CLOSE_CHANNEL = 0x0104, - BRB_L2CA_ACL_TRANSFER = 0x0105, - BRB_L2CA_UPDATE_CHANNEL = 0x0106, - BRB_L2CA_PING = 0x0107, - BRB_L2CA_INFO_REQUEST = 0x0108, - BRB_REGISTER_PSM = 0x0109, - BRB_UNREGISTER_PSM = 0x010a, - BRB_SCO_REGISTER_SERVER = 0x0200, - BRB_SCO_UNREGISTER_SERVER = 0x0201, - BRB_SCO_OPEN_CHANNEL = 0x0202, - BRB_SCO_OPEN_CHANNEL_RESPONSE = 0x0203, - BRB_SCO_CLOSE_CHANNEL = 0x0204, - BRB_SCO_TRANSFER = 0x0205, - BRB_SCO_GET_CHANNEL_INFO = 0x0207, - BRB_SCO_GET_SYSTEM_INFO = 0x0209, - BRB_SCO_FLUSH_CHANNEL = 0x020a, - BRB_ACL_GET_MODE = 0x0300, - BRB_ACL_ENTER_ACTIVE_MODE = 0x0301, - BRB_STORED_LINK_KEY = 0x0310, - BRB_GET_DEVICE_INTERFACE_STRING = 0x0320, -} BRB_TYPE; -#endif - -typedef enum _BRB_VERSION { - // - BLUETOOTH_V1 = 0, // Brb was created by Version 1.x code - // (i.e. ExAllocatePool) - // - - // - BLUETOOTH_V2 // Brb was crated by Version 2.0 (or later) - // code by BthAllocateBrb. This implies Brb is - // referenced counted -} BRB_VERSION; - - -// -// BRB HEADER -// -typedef struct _BRB_HEADER { - // - // [IN] Used to enqueue BRBs. This field is to be used by the current owner - // of the BRB. For instance, once the BRB has been sent to BTHPORT, - // the client driver may not use this field since BTHPORT may use it - // to enqueue the BRB. - // - LIST_ENTRY ListEntry; - - // - // [IN] Size of the BRB including this header - // - ULONG Length; - - // - // [PRIVATE] BRB Version - // 0 ==> Bluetooth 1.x version - // >0 ==> Bluetooth 2.x version or later, filled in by - // BthCreateBrb - // - USHORT Version; // BRB_VERSION - - // - // [IN] BRB request type. - // - USHORT Type; // BRB_TYPE - - - // - // [PRIVATE] Internal flags for use by BTHPORT - // - ULONG BthportFlags; - - // - // [OUT] BRB completion status - // - NTSTATUS Status; - - // - // [OUT] BRB completion BtStatus - // - BTHSTATUS BtStatus; - - // - // [PRIVATE] for internal use by BTHPORT only. - // - PVOID Context[BTHPORT_CONTEXT_SIZE]; - - // - // for use by client drivers, BTHPORT will never touch these fields. - // - PVOID ClientContext[BTHPORT_CONTEXT_SIZE]; - - // - // opaque reserved fields - // - ULONG Reserved[BTHPORT_RESERVED_FIELD_SIZE]; - -} BRB_HEADER; - - - -typedef struct _L2CAP_CONFIG_RANGE { - USHORT Min; - USHORT Max; -} L2CAP_CONFIG_RANGE, *PL2CAP_CONFIG_RANGE; - -typedef struct _L2CAP_CONFIG_VALUE_RANGE { - USHORT Min; - USHORT Preferred; - USHORT Max; -} L2CAP_CONFIG_VALUE_RANGE, *PL2CAP_CONFIG_VALUE_RANGE; - -// -// Needs packing to match exact spec size -// -#include -typedef struct _L2CAP_FLOWSPEC { - // - // Reserved. Must be zero. - // - UCHAR Flags; - - // - // L2CAP_FLOW_SERVICE_TYPE_XXX value - // - UCHAR ServiceType; - - // - // Bytes/sec - // - ULONG TokenRate; - - // - // Bytes - // - ULONG TokenBucketSize; - - // - // Bytes/sec - // - ULONG PeakBandwidth; - - // - // Microsoeonds - // - ULONG Latency; - - // - // Microseconds - // - ULONG DelayVariation; - -} L2CAP_FLOWSPEC, *PL2CAP_FLOWSPEC; -#include - - -// -// Use the DynamicBuffer field -// -#define CO_DYNAMIC (0x0001) - -// -// Use the FixedBuffer field -// -#define CO_FIXED (0x0002) - -// -// The option is unknown. Used during config request validation callback, not -// a valid flag when submitting options to bthport. -// -#define CO_UNKNOWN (0x0004) - -#define VALID_CO_FLAGS (CO_DYNAMIC | CO_FIXED) - -#define IS_CO_TYPE_HINT(type) (((type) & 0x80) == 0x80) -#define IS_CO_TYPE_REQUIRED(type) (((type) & 0x80) == 0x00) - -typedef UCHAR CO_TYPE, *PCO_TYPE; -typedef UCHAR CO_LENGTH, *PCO_LENGTH; -typedef USHORT CO_MTU, *PCO_MTU; -typedef USHORT CO_FLUSHTO, *PCO_FLUSHTO; - -#include -// -// Config Option (CO) header -// -typedef struct _CO_HEADER { - // - // Type of vendor-specific option. can be either an option or a hint. - // - CO_TYPE Type; - - // - // Size of the vendor-specific option. - // - CO_LENGTH Length; - -} CO_HEADER; -#include - -// -// HCI connection handle. -// -typedef USHORT CONNECTION_HANDLE, *PCONNECTION_HANDLE; - -// -// HCI SCO Requests -// -typedef PVOID SCO_CHANNEL_HANDLE, *PSCO_CHANNEL_HANDLE; - -// -// SCO retransmission effort. -// -typedef enum _SCO_RETRANSMISSION_EFFORT { - SCO_RETRANSMISSION_NONE = 0x00, - SCO_RETRANSMISSION_MIN1_POWER = 0x01, - SCO_RETRANSMISSION_MIN1_QUALITY = 0x02, - SCO_RETRANSMISSION_DONT_CARE = 0xFF -} SCO_RETRANSMISSION_EFFORT, *PSCO_RETRANSMISSION_EFFORT; - -// -// SCO voice setting. -// -#define SCO_VS_IN_CODING_MASK (0x0300) -#define SCO_VS_IN_CODING_LINEAR (0x0000) -#define SCO_VS_IN_CODING_MULAW (0x0100) -#define SCO_VS_IN_CODING_ALAW (0x0200) - -#define SCO_VS_IN_DATA_FORMAT_MASK (0x00C0) -#define SCO_VS_IN_DATA_FORMAT_1C (0x0000) -#define SCO_VS_IN_DATA_FORMAT_2C (0x0040) -#define SCO_VS_IN_DATA_FORMAT_SM (0x0080) -#define SCO_VS_IN_DATA_FORMAT_US (0x00C0) - -#define SCO_VS_IN_SAMPLE_SIZE_MASK (0x0020) -#define SCO_VS_IN_SAMPLE_SIZE_8BIT (0x0000) -#define SCO_VS_IN_SAMPLE_SIZE_16BIT (0x0020) - -#define SCO_VS_PCM_BIT_POS_MASK (0x001C) - -#define SCO_VS_AIR_CODING_FORMAT_MASK (0x0003) -#define SCO_VS_AIR_CODING_FORMAT_CVSD (0x0000) -#define SCO_VS_AIR_CODING_FORMAT_MULAW (0x0001) -#define SCO_VS_AIR_CODING_FORMAT_ALAW (0x0002) -#define SCO_VS_AIR_CODING_DATA (0x0003) - -#define SCO_VS_SETTING_DEFAULT (0x0060) // bits 0,1 vendor specific. - -// -// SCO link types. -// -typedef enum _SCO_LINK_TYPE { - ScoLinkType = 0x00, - eScoLinkType = 0x02, -} SCO_LINK_TYPE, *PSCO_LINK_TYPE; - -// -// SCO packet types. -// -#define SCO_HV1 (0x0001) -#define SCO_HV2 (0x0002) -#define SCO_HV3 (0x0004) -#define SCO_EV3 (0x0008) -#define SCO_EV4 (0x0010) -#define SCO_EV5 (0x0020) -#define SCO_PKT_ALL (0x003F) - -// -// Valid SCO channel flags in OpenChannel/OpenChannel response. -// -#define SCO_CF_LINK_AUTHENTICATED (0x00020000) -#define SCO_CF_LINK_ENCRYPTED (0x00040000) -#define SCO_CF_LINK_SUPPRESS_PIN (0x00080000) - -// -// Notify the client when a remote disconnect occurs -// -#define SCO_CALLBACK_DISCONNECT (0x00000001) - -// -// Valid SCO connection indications in OpenChannel/OpenChannel response. -// -#define SCO_VALID_CALLBACK_FLAGS (SCO_CALLBACK_DISCONNECT) - -// -// SCO callback notification codes. -// -typedef enum _SCO_INDICATION_CODE { - ScoIndicationAddReference = 0, // Connection indication - ScoIndicationReleaseReference, // Connection indication - ScoIndicationRemoteConnect, // Connectionless indication - ScoIndicationRemoteDisconnect, // Connection indication -} SCO_INDICATION_CODE, *PSCO_INDICATION_CODE; - -// -// Reasons why a SCO channel has been disconnected -// -typedef enum _SCO_DISCONNECT_REASON { - ScoHciDisconnect = 0, - ScoDisconnectRequest, - ScoRadioPoweredDown, - ScoHardwareRemoval, -} SCO_DISCONNECT_REASON, *PSCO_DISCONNECT_REASON; - -// -// SCO callback parameters. -// -typedef struct _SCO_INDICATION_PARAMETERS { - - // [IN] SCO connection handle. - SCO_CHANNEL_HANDLE ConnectionHandle; - - // [IN] Bluetooth address of remote device. - BTH_ADDR BtAddress; - - union { - // - // ScoIndicationRemoteConnect - // - struct { - struct { - // [IN] Type of link (SCO or ESCO). - SCO_LINK_TYPE LinkType; - } Request; - } Connect; - - // - // ScoIndicationRemoteDisconnect - // - struct { - // [IN] Reason why the remote device disconnected. - SCO_DISCONNECT_REASON Reason; - - // [OUT] TRUE to let caller close the connection. - BOOLEAN CloseNow; - } Disconnect; - - } Parameters; - -} SCO_INDICATION_PARAMETERS, *PSCO_INDICATION_PARAMETERS; - -// -// SCO callback prototype. -// -typedef -void -(*PFNSCO_INDICATION_CALLBACK)( - IN PVOID Context, - IN SCO_INDICATION_CODE Indication, - IN PSCO_INDICATION_PARAMETERS Parameters - ); - -// -// Valid SCO 'connectionless indications' in service interface. -// -#define SCO_INDICATION_SCO_REQUEST (0x00000001) -#define SCO_INDICATION_ESCO_REQUEST (0x00000002) - -#define SCO_INDICATION_VALID_FLAGS (SCO_INDICATION_SCO_REQUEST | \ - SCO_INDICATION_ESCO_REQUEST) - -struct _BRB_SCO_REGISTER_SERVER { - // BRB header - BRB_HEADER Hdr; - - BTH_ADDR BtAddress; - - // - // Reserved for future use (set to 0). - // - ULONG Reserved; - - // - // [IN] Combination of SCO_INDICATION_Xxx flags. - // - ULONG IndicationFlags; - PFNSCO_INDICATION_CALLBACK IndicationCallback; - PVOID IndicationCallbackContext; - - // - // [IN] Object to be passed to ObReferenceObject, ObDereferenceObject. - // The client provides this ReferenceObject in such a way that the port - // driver can take a reference on the client driver for as long as - // it has the opportunity to call the IndicationCallback function pointer. The client - // driver can have its reference released by calling the RemoveIndicationCallback - // routine. - // - PVOID ReferenceObject; - - // - // [OUT] Set by BTHPORT upon a successful set of the server interface. The - // client should send a BRB_SCO_REGISTER_SERVER when it - // no longer wants to receive remote connect indications (ie, when it - // receives a PNP rmeove for instance). The client should pass back - // the ServerHandle as part of the BRB_SCO_REGISTER_SERVER - // structure. - // - OUT SCO_SERVER_HANDLE ServerHandle; - - -}; - -struct _BRB_SCO_UNREGISTER_SERVER { - // BRB header - BRB_HEADER Hdr; - - BTH_ADDR BtAddress; - PVOID ServerHandle; -}; - -// -//Connect response signal Result values -// -#define SCO_CONNECT_RSP_RESPONSE_SUCCESS (0x00) -#define SCO_CONNECT_RSP_RESPONSE_NO_RESOURCES (0x0D) -#define SCO_CONNECT_RSP_RESPONSE_SECURITY_BLOCK (0x0E) -#define SCO_CONNECT_RSP_RESPONSE_BAD_BD_ADDR (0x0F) - -// -// This request will open an SCO connection on a physical link. -// -struct _BRB_SCO_OPEN_CHANNEL { - // BRB header - BRB_HEADER Hdr; - - // [IN] Bluetooth address of target device - BTH_ADDR BtAddress; - - // [IN] Transmit bandwidth in (bytes/sec). - ULONG TransmitBandwidth; - - // [IN] Receive bandwidth in (bytes/sec). - ULONG ReceiveBandwidth; - - // [IN] Max in air delay before discarding the packet (msec). - USHORT MaxLatency; - - // [IN] HV1 | HV2 | HV3 | EV3 | EV4 | EV5 (See SCO_HV1 etc.) - USHORT PacketType; - - // [IN] Content format. (See SCO_VS_Xxx defines). - USHORT ContentFormat; - - // [IN] Set to zero. - USHORT Reserved; - - // [IN] Retransmission effort - SCO_RETRANSMISSION_EFFORT RetransmissionEffort; - - // [IN] Combination of SCO_CF_XXX flags - ULONG ChannelFlags; - - // [IN] Combo of SCO_CALLBACK_Xxx flags - ULONG CallbackFlags; - - // [IN] Callback supplied by client - PFNSCO_INDICATION_CALLBACK Callback; - - // [IN] Context passed to callback - PVOID CallbackContext; - - // [IN] Object to be passed to ObReferenceObject, ObDereferenceObject - PVOID ReferenceObject; - - // - // [IN/OUT] handle used to ID the connection upon a successful connect. - // When sending a BRB_SCO_OPEN_CHANNEL, this will be filled in when the BRB - // complets. When sending a BRB_SCO_OPEN_CHANNEL_RESPONSE, this must be - // filled in by the server before sending down the BRB. The value assigned - // should be SCO_INDICATION_PARAMETERS::ConnectionHandle which was passed - // in during ScoIndicationRemoteConnect. - // - SCO_CHANNEL_HANDLE ChannelHandle; - - // - // [IN] Used only with BRB_SCO_OPEN_CHANNEL_RESPONSE. One of the - // SCO_CONNECT_RSP_RESPONSE_Xxx values is used. - // - UCHAR Response; -}; - -// -// This request will close an SCO connection on a physical link. -// -struct _BRB_SCO_CLOSE_CHANNEL { - // BRB header - BRB_HEADER Hdr; - - // [IN] Address of the remote device - BTH_ADDR BtAddress; - - // [IN] SCO Connection handle to be provided to BTHPORT. - SCO_CHANNEL_HANDLE ChannelHandle; -}; - -// -// This request will flush the 'in' and/or 'out' channel's pipe. -// -struct _BRB_SCO_FLUSH_CHANNEL { - // BRB header - BRB_HEADER Hdr; - - // [IN] Address of the remote device - BTH_ADDR BtAddress; - - // [IN] SCO Connection handle to be provided to BTHPORT. - SCO_CHANNEL_HANDLE ChannelHandle; - - // [IN] Combination of SCO_FLUSH_XXX flags. - ULONG FlushFlags; -}; - -// SCO write pipe. -#define SCO_FLUSH_DIRECTION_OUT (0x00000001) - -// SCO read pipe. -#define SCO_FLUSH_DIRECTION_IN (0x00000002) - -// -// Baseband channel settings. -// -typedef struct _BASEBAND_CHANNEL_INFO { - // - // Time between two consecutive eSCO instants measured in slots. Must be - // 0 for SCO links. - // - UCHAR Transmission_Interval; - - // - // The size of the retransmission windows measured in slots. Must be 0 - // for SCO links. - // - UCHAR Retransmission_Window; - - // - // Air mode data format: - // 0x00 - MU-LAW LOG - // 0x01 - A-LAW LOG - // 0x02 - CVSD - // 0x03 - Transparent Data - // 0x04 - 0xFF - Reserved. - // - UCHAR AirMode; - - // - // Length in bytes of the eSCO payload in the receiver direction. Must be - // 0 for SCO links. - // - USHORT Rx_Packet_Length; - - // - // Length in bytes of the eSCO payload in the transmit direction. Must be - // 0 for SCO links. - // - USHORT Tx_Packet_Length; -}BASEBAND_CHANNEL_INFO, *PBASEBAND_CHANNEL_INFO; - -// -// This request will return the channel settings. -// -struct _BRB_SCO_GET_CHANNEL_INFO { - // BRB header - BRB_HEADER Hdr; - - // [IN] Bluetooth address of target device - BTH_ADDR BtAddress; - - // [IN] SCO Connection handle to be provided to BTHPORT. - SCO_CHANNEL_HANDLE ChannelHandle; - - // [OUT] Generic informational flags (See SCO_INFO_Xxx defines). - ULONG InfoFlags; - - // [OUT] Transmit bandwidth in (bytes/sec). - ULONG TransmitBandwidth; - - // [OUT] Receive bandwidth in (bytes/sec). - ULONG ReceiveBandwidth; - - // [OUT] Max in air delay before discarding the packet (msec). - USHORT MaxLatency; - - // [OUT] HV1 | HV2 | HV3 | EV3 | EV4 | EV5 (See SCO_HV1 etc.) - USHORT PacketType; - - // [OUT] Content format. (See SCO_VS_Xxx defines). - USHORT ContentFormat; - - // [OUT] Set to zero. - USHORT Reserved; - - // [OUT] Retransmission effort - SCO_RETRANSMISSION_EFFORT RetransmissionEffort; - - // [OUT] Combination of SCO_CF_XXX flags - ULONG ChannelFlags; - - // [OUT] HCI connection handle. - CONNECTION_HANDLE HciConnectionHandle; - - // [OUT] HCI link type. - SCO_LINK_TYPE LinkType; - - // [OUT] Baseband channel info. This info is only available for links - // established using the 1.2 Bluetooth Synchronous Commands (see InfoFlags - // for more info). - BASEBAND_CHANNEL_INFO BasebandInfo; -}; - -// -// Get channel informational flags. -// -#define SCO_INFO_BASEBAND_AVAILABLE (0x00000001) - -// -// This request will sumbit a data buffer by the client to be filled from the -// open SCO channel associated with the connection handle. The client driver -// can provide either an MDL ptr or PVOID ptr but not both. BufferSize -// parameter will be updated upon completion of this request to reflect the -// total bytes read. -// -struct _BRB_SCO_TRANSFER { - // BRB header - BRB_HEADER Hdr; - - // [IN] Address of the remote device - BTH_ADDR BtAddress; - - // [IN] SCO Connection handle to be provided to BTHPORT. - SCO_CHANNEL_HANDLE ChannelHandle; - - // [IN] Combination of SCO_TRANSFER_XXX flags. - ULONG TransferFlags; - - // [IN/OUT] Length of buffer in bytes. - ULONG BufferSize; - - // [IN] buffer ptr. should be NULL if BufferMDL is used. - PVOID Buffer; - - // [IN] MDL buffer ptr. should be NULL if Buffer id used. - PMDL BufferMDL; - - // [OUT] additional info about the data. - ULONGLONG DataTag; -}; - -// SCO write -#define SCO_TRANSFER_DIRECTION_OUT (0x00000000) - -// SCO read -#define SCO_TRANSFER_DIRECTION_IN (0x00000001) - -// -// This request will return system wide SCO information. -// -struct _BRB_SCO_GET_SYSTEM_INFO { - // BRB header - BRB_HEADER Hdr; - - // [OUT] SCO features. (See SCO_FEATURE_Xxx defines). - ULONG Features; - - // [OUT] Maximum number of active SCO connections. - // Set to -1 if no limit or unknown. - ULONG MaxChannels; - - // [OUT] Minimum transfer in msec x request. - // Set to -1 if variable or unknown. - ULONG TransferUnit; - - // [OUT] Supported (e)SCO packet types. (See SCO_HV1 etc.). - USHORT PacketTypes; - - // [OUT] Supported data formats. (See SCO_DATA_FORMAT_Xxx defines). - USHORT DataFormats; - - // [OUT] Reserved for future use. - ULONG Reserved; -}; - -// -// Supported SCO features. -// -#define SCO_FEATURE_SCO_LINKS (0x00000001) -#define SCO_FEATURE_ESCO_LINKS (0x00000002) -#define SCO_FEATURE_STREAM_OFFSET_DATA_TAG (0x00000010) - -// -// Supported data formats (voice encodings). -// -#define SCO_DATA_FORMAT_MU_LAW_LOG (0x0001) -#define SCO_DATA_FORMAT_A_LAW_LOG (0x0002) -#define SCO_DATA_FORMAT_CVSD (0x0004) -#define SCO_DATA_FORMAT_TRANSPARENT (0x0008) -#define SCO_DATA_FORMAT_ALL (0x000F) - -// -// L2CAP specific data types -// - -// -// FLOWSPEC related constants -// -// No traffic will be transmitted in the specified direction. -// -#define L2CAP_FLOW_SERVICE_TYPE_NOTRAFFIC (0) - -// -// Default value, and indicates reasonable efforts -// -#define L2CAP_FLOW_SERVICE_TYPE_BESTEFFORT (1) - -// -// Guarantees ability to transmit data at token rate. -// -#define L2CAP_FLOW_SERVICE_TYPE_GUARANTEED (2) - - - -// -// connect response signal Result & Status values -// -#define CONNECT_RSP_RESULT_SUCCESS (0x0) -#define CONNECT_RSP_RESULT_PENDING (0x1) -#define CONNECT_RSP_RESULT_PSM_NEG (0x2) -#define CONNECT_RSP_RESULT_SECURITY_BLOCK (0x3) -#define CONNECT_RSP_RESULT_NO_RESOURCES (0x4) - -// -// Only valid if CONNECT_RSP_RESULT_PENDING is specified -// -#define CONNECT_RSP_STATUS_NO_INFORMATION (0x00) -#define CONNECT_RSP_STATUS_AUTHENTICATION_PENDING (0x01) -#define CONNECT_RSP_STATUS_AUTHORIZATION_PENDING (0x02) - -// -// Config signal response codes -// -#define CONFIG_STATUS_SUCCESS (0) -#define CONFIG_STATUS_INVALID_PARAMETER (1) -#define CONFIG_STATUS_REJECT (2) -#define CONFIG_STATUS_UNKNOWN_OPTION (3) -#define CONFIG_STATUS_DISCONNECT (0xFFF) - -// -// Min, max, and default L2cap Signal MTU. -// - -// -// Min, max, default, no retransmit and infinite FlushTO values -// -#define L2CAP_MIN_FLUSHTO (1) -#define L2CAP_MAX_FLUSHTO (0xFFFF) -#define L2CAP_DEFAULT_FLUSHTO (L2CAP_MAX_FLUSHTO) - -#define L2CAP_NO_REXMIT_FLUSHTO (L2CAP_MIN_FLUSHTO) -#define L2CAP_INFINITE_FLUSHTO (L2CAP_MAX_FLUSHTO) - - -// -// Specify which fields contain data. -// -// In the case of OUT parameters where the flag is not set for a particular -// value, the default will be requested. If the default is rejected by the -// remote host, the suggested value (by the remote host) will be used. -// -// In the case of IN parameters where the flag is not set for a particular -// value, the remote's request value will be accepted. -// -// Link timeout is a local option and is not negotiated across the air. -// -// QOS is specified for the outbound config request -// -#define CFG_MTU (0x00000001) -#define CFG_FLUSHTO (0x00000002) -#define CFG_QOS (0x00000004) -#define CFG_EXTRA (0x00000008) - -#define CFG_LINKTO (0x00000010) -#define CFG_QOS_LOCAL (0x00000020) - -// -// Indicates the desired role in the connection -// -#define CF_ROLE_EITHER (0x00000000) -#define CF_ROLE_SLAVE (0x00000001) -#define CF_ROLE_MASTER (0x00000002) -#define CF_ROLE_MASK (CF_ROLE_EITHER | \ - CF_ROLE_SLAVE | \ - CF_ROLE_MASTER) - -// -// Indicates requirenments on the HCI channel. Encryption requires -// authentication. -// -#define CF_LINK_NOTHING (0x00010000) -#define CF_LINK_AUTHENTICATED (0x00020000) -#define CF_LINK_ENCRYPTED (0x00040000) -#define CF_LINK_SUPPRESS_PIN (0x00080000) - -#define CF_QUEUE_KEEP_OLD (0x00000020) -#define CF_QUEUE_KEEP_NEW (0x00000040) -#define CF_QUEUE_MASK (CF_QUEUE_KEEP_OLD | CF_QUEUE_KEEP_NEW) - -// -// Notify the client when a remote disconnect occurs -// -#define CALLBACK_DISCONNECT (0x00000001) - -// -// Involve the client when the remote host sends a config request with a QOS -// value. If this flag is not set and the remote host either specifies a QOS -// parameter in a config request or rejects the local host's request for QOS, -// then the channel is disconnected. -// -#define CALLBACK_CONFIG_QOS (0x00000002) - -// -// If specified, the callback will be called when remote host rejects an extra -// config option. -// -// If unspecified and the remote host rejects the config request due to an extra -// config option, the connection will be closed. -// -#define CALLBACK_CONFIG_EXTRA_OUT (0x00000004) - -// -// If specified, the callback will be called when the remote host's config -// request contains extra options. -// -// If unspecified, the extra config options will be rejected as unknown options. -// -#define CALLBACK_CONFIG_EXTRA_IN (0x00000008) - -// -// Client will allow reconfig of the channel. If this flag is not specified, -// any reconfig is rejected and the channel is torn down. -// -#define CALLBACK_RECONFIG (0x00000010) - -// -// Client wants to be involved in master / slave role switching -// -#define CALLBACK_ROLE_CHANGE (0x00000020) - -// -// Client wants to be notified when an incoming L2CAP packet has been received -// -#define CALLBACK_RECV_PACKET (0x00000040) - - -typedef struct _INDICATION_PARAMETERS *PINDICATION_PARAMETERS; -typedef enum _INDICATION_CODE INDICATION_CODE; - - -typedef -void -(*PFNBTHPORT_INDICATION_CALLBACK)( - IN PVOID Context, - IN INDICATION_CODE Indication, - IN PINDICATION_PARAMETERS Parameters - ); - - -// -// Full description of config option header and associated data -// -typedef struct _L2CAP_CONFIG_OPTION { - // - // Header - // - CO_HEADER Header; - - // - // Valid if Flags == CO_DYNAMIC - // - VOID UNALIGNED *DynamicBuffer; - - // - // Valid if Flags == CO_FIXED - // - UCHAR FixedBuffer[4]; - - // - // Combo of CO_XXX flags - // - USHORT Flags; - -} L2CAP_CONFIG_OPTION, *PL2CAP_CONFIG_OPTION; - - - -typedef struct _CHANNEL_CONFIG_PARAMETERS { - // - // Combination of CFG_XXX flags - // - ULONG Flags; - - // - // MTU for the direction - // - CO_MTU Mtu; - - // - // Flush timeout for the direction - // - CO_FLUSHTO FlushTO; - - // - // Number of elements in the ExtraOptions array - // - ULONG NumExtraOptions; - - // - // Array of extra options - // - PL2CAP_CONFIG_OPTION ExtraOptions; - - // - // QOS for the direction - // - L2CAP_FLOWSPEC Flow; - -} CHANNEL_CONFIG_PARAMETERS, *PCHANNEL_CONFIG_PARAMETERS; - -typedef struct _CHANNEL_CONFIG_RESULTS { - // - // Channel parameters for the given direction of the channel - // - CHANNEL_CONFIG_PARAMETERS Params; - - // - // Amout of buffer required to retrieve the current extra options - // for the given direction - // - ULONG ExtraOptionsBufferSize; - -} CHANNEL_CONFIG_RESULTS, *PCHANNEL_CONFIG_RESULTS; - -typedef enum _INDICATION_CODE { - IndicationAddReference = 0, - IndicationReleaseReference, - IndicationRemoteConnect, - IndicationRemoteDisconnect, - IndicationRemoteConfigRequest, - IndicationRemoteConfigResponse, - IndicationFreeExtraOptions, - IndicationRecvPacket, - IndicationPairDevice, - IndicationUnpairDevice, - IndicationUnpersonalizeDevice, -} INDICATION_CODE, *PINDICATION_CODE; - -// -// Reasons why a channel has been disconnected -// -typedef enum _L2CAP_DISCONNECT_REASON { - HciDisconnect = 0, - L2capDisconnectRequest, - RadioPoweredDown, - HardwareRemoval, -} L2CAP_DISCONNECT_REASON; - - -typedef struct _INDICATION_PARAMETERS { - - L2CAP_CHANNEL_HANDLE ConnectionHandle; - - IN BTH_ADDR BtAddress; - - union { - - // - // IndicationConnect - // - struct { - struct { - OUT USHORT PSM; - } Request; - } Connect; - - struct { - // - // The currently agreed upon parameters for the channel. Only valid - // if the channel was previously open and is now in config. - // - CHANNEL_CONFIG_PARAMETERS CurrentParams; - - // - // The parameters passed from the remote host for config request - // - CHANNEL_CONFIG_PARAMETERS RequestedParams; - - // - // In Response != CONFIG_STATUS_SUCCESS, then this parameter will - // contain the parameters that are appropriate for the response - // code. ResponseParams::Flags controls which parameters are sent - // across the wire. - // - // If CFG_EXTRA is set, the client will be called back with - // IndicationFreeExtraOptions after the options are no longer - // needed. - // - CHANNEL_CONFIG_PARAMETERS ResponseParams; - - // - // A CONFIG_STATUS_XXX value - // - USHORT Response; - - } ConfigRequest; - - struct { - // - // The currently agreed upon parameters for the channel. Only valid - // if the channel was previously open and is now in config. - // - CHANNEL_CONFIG_PARAMETERS CurrentParams; - - // - // The parameters that were sent across the wire previously - // - CHANNEL_CONFIG_PARAMETERS RequestedParams; - - // - // The parameters that were rejected by the remote host - // - CHANNEL_CONFIG_PARAMETERS RejectedParams; - - PCO_TYPE UnknownTypes; - - ULONG NumUnknownTypes; - - CHANNEL_CONFIG_PARAMETERS NewRequestParams; - - // - // Will be either CONFIG_STATUS_UNKNOWN_OPTION or - // CONFIG_STATUS_INVALID_PARAMETER. Upon return from the call, - // if the value is CONFIG_STATUS_SUCCESS, NewRequestParams are sent - // across the wire, otherwise the connection is torn down. - // - USHORT Response; - - } ConfigResponse; - - struct { - ULONG NumExtraOptions; - - // - // Array of extra options - // - PL2CAP_CONFIG_OPTION ExtraOptions; - } FreeExtraOptions; - - struct { - L2CAP_DISCONNECT_REASON Reason; - BOOLEAN CloseNow; - } Disconnect; - - struct { - ULONG PacketLength; - ULONG TotalQueueLength; - } RecvPacket; - - } Parameters; - -} INDICATION_PARAMETERS, *PINDICATION_PARAMETERS; - -// -// Caller wants to know about the device being unpaired -// -#define INDICATION_PAIR_DEVICE (0x00000001) -#define INDICATION_UNPAIR_DEVICE (0x00000002) -#define INDICATION_UNPERSONALIZE_DEVICE (0x00000004) - - -struct _BRB_L2CA_REGISTER_SERVER { - - // - // Common BRB header - // - BRB_HEADER Hdr; - - BTH_ADDR BtAddress; - USHORT PSM; - ULONG IndicationFlags; - PFNBTHPORT_INDICATION_CALLBACK IndicationCallback; - PVOID IndicationCallbackContext; - - // - // Object to be passed to ObReferenceObject, ObDereferenceObject. - // The client provides this ReferenceObject in such a way that the port - // driver can take a reference on the client driver for as long as - // it has the opportunity to call the IndicationCallback function pointer. The client - // driver can have its reference released by calling the RemoveIndicationCallback - // routine. - // - PVOID ReferenceObject; - - // - // [OUT] Set by BTHPORT upon a successful set of the server interface. The - // client should send a BRB_L2CA_UNREGISTER_SERVER when it - // no longer wants to receive remote connect indications (ie, when it - // receives a PNP rmeove for instance). The client should pass back - // the ServerHandle as part of the BRB_L2CA_UNREGISTER_SERVER - // structure. - // - OUT L2CAP_SERVER_HANDLE ServerHandle; -}; - -struct _BRB_L2CA_UNREGISTER_SERVER { - - // - // Common BRB header - // - BRB_HEADER Hdr; - - BTH_ADDR BtAddress; - PVOID ServerHandle; - USHORT Psm; -}; - -struct _BRB_L2CA_OPEN_CHANNEL { - // - // Common BRB header - // - BRB_HEADER Hdr; - - // - // [IN/OUT] handle used to ID the connection upon a successful connect. - // When sending a BRB_L2CA_OPEN_CHANNEL, this will be filled in when the BRB - // complets. When sending a BRB_L2CA_OPEN_CHANNEL_RESPONSE, this must be - // filled in by the server before sending down the BRB. The value assigned - // should be INDICATION_PARAMETERS::ConnectionHandle which was passed in - // during IndicationRemoteConnect. - // - L2CAP_CHANNEL_HANDLE ChannelHandle; - - union { - struct { - // - // [IN] Used only with BRB_L2CA_OPEN_CHANNEL_RESPONSE. One of the - // CONNECT_RSP_RESULT_Xxx values is used. - // - // [OUT] If the BRB returns with a status of - // STATUS_REQUEST_NOT_ACCEPTED, then Response will contain the - // negative response from the remote host. - // - USHORT Response; - - // - // [IN] if Response is equal to CONNECT_RSP_RESULT_PENDING, then - // this field is valid. One of the CONNECT_RSP_STATUS_XXX values - // is used. - // - USHORT ResponseStatus; - }; - - // - // [IN] Used only with BRB_L2CA_OPEN_CHANNEL. Channel the connection - // is intended for. - // - USHORT Psm; - }; - - // - // [IN] Combination of CF_XXX flags - // - ULONG ChannelFlags; - - // - // [IN] Address of the device the connection is intended for - // - BTH_ADDR BtAddress; - - // - // Parameters specifying outbound request to remote host - // - struct { - // - // Combination of CFG_XXX flags - // - ULONG Flags; - - // - // Range for MTU - // - L2CAP_CONFIG_VALUE_RANGE Mtu; - - // - // Range for Flush timeout - // - L2CAP_CONFIG_VALUE_RANGE FlushTO; - - // - // QOS data structure - // - L2CAP_FLOWSPEC Flow; - - // - // LM Link timeout - // - USHORT LinkTO; - - // - // How many elements are in the ExtraOptions array - // - ULONG NumExtraOptions; - - // - // Array of extra options - // - PL2CAP_CONFIG_OPTION ExtraOptions; - - struct { - // - // Must be L2CAP_FLOW_SERVICE_TYPE_GUARANTEED - // - UCHAR ServiceType; - - // - // Latency in microseconds - // - ULONG Latency; - } LocalQos; - } ConfigOut; - - // - // Parameters specifying how to validate inbound requests - // - struct { - // - // Combination of CFG_XXX flags - // - ULONG Flags; - - // - // Range for MTU - // - L2CAP_CONFIG_VALUE_RANGE Mtu; - - // - // Range for Flush timeout - // - L2CAP_CONFIG_RANGE FlushTO; - - } ConfigIn; - - // - // Combo of CALLBACK_Xxx flags - // - ULONG CallbackFlags; - - // - // Callback supplied by client - // - PFNBTHPORT_INDICATION_CALLBACK Callback; - - // - // Context passed to callback - // - PVOID CallbackContext; - - // - // Object to be passed to ObReferenceObject, ObDereferenceObject. - // If a callback is requested, this parameter is not optional. - // - PVOID ReferenceObject; - - // - // [OUT] Configuration parameters for the outbound direction. - // - CHANNEL_CONFIG_RESULTS OutResults; - - // - // [OUT] Configuration parametesr ofr the inbound direction - // - CHANNEL_CONFIG_RESULTS InResults; - - UCHAR IncomingQueueDepth; -}; - -// -// This request will close the L2cap connection specified by the connection -// handle. -// -struct _BRB_L2CA_CLOSE_CHANNEL { - // - // BRB header - // - BRB_HEADER Hdr; - - // - // [IN] Address of the remote device - // - BTH_ADDR BtAddress; - - // - // [IN] L2cap connection handle provided by port - // - L2CAP_CHANNEL_HANDLE ChannelHandle; -}; - -// -// This request will sumbit a data buffer by the client to be filled/transmitted -// from/to the open channel associated with the ChannelHandle. -// -// The client driver can provide either an MDL ptr or PVOID pointer. The -// BufferSize parameter will be updated upon completion of this request to -// reflect the total bytes read if BTHPORT_SHORT_TRANSFER_OK flag was set. -// Otherwise the port driver will return an error. -// - - -// -// ACL write -// -#define ACL_TRANSFER_DIRECTION_OUT (0x00000000) - -// -// ACl read -// -#define ACL_TRANSFER_DIRECTION_IN (0x00000001) - -// -// Set for L2cap read BRB if the received buffer from remote device is less -// than the submitted buffer size. -// -#define ACL_SHORT_TRANSFER_OK (0x00000002) - -// -// Set if the client desires to have the read timeout after a period of time. -// -#define ACL_TRANSFER_TIMEOUT (0x00000004) - - -struct _BRB_L2CA_ACL_TRANSFER { - // BRB header - BRB_HEADER Hdr; - - // - // [IN] Address of the remote device - // - BTH_ADDR BtAddress; - - // - // [IN] L2cap connection handle provided by port - // - L2CAP_CHANNEL_HANDLE ChannelHandle; - - // - // [IN] Combination of ACL_TRANSFER_XXX and ACL_SHORT_TRANSFER_OK flags. - // - ULONG TransferFlags; - - // - // [IN/OUT] Length of buffer in bytes. - // - ULONG BufferSize; - - // - // [IN] buffer ptr. should be NULL if BufferMDL is used. - // - PVOID Buffer; - - // - // [IN] MDL buffer ptr. should be NULL if Buffer id used. - // - PMDL BufferMDL; - - // - // [IN] time in milliseconds before read is cancelled with any data - // consumed so far - // - LONGLONG Timeout; - - // - // [OUT] how much buffer remains if there is buffer underrun - // - ULONG RemainingBufferSize; -}; - -// -// HCI GENERAL Requests -// - -// -// This request will return the address of the local radio -// -struct _BRB_GET_LOCAL_BD_ADDR { - // BRB header - BRB_HEADER Hdr; - - // - // Address of local radio. - // - BTH_ADDR BtAddress; -}; - -struct _BRB_GET_DEVICE_INTERFACE_STRING { - // - // BRB header - // - BRB_HEADER Hdr; - - // - // Pointer to the buffer that will contain the string - // - PWCHAR DeviceInterfaceString; - - // - // IN Length in *bytes* of the string - // - - // OUT if length is too small, STATUS_MORE_ENTRIES is returned and - // this field contains the required number of bytes - // - // upon success, the number of bytes copied. - // - ULONG DeviceInterfaceStringCbLength; -}; - -struct _BRB_L2CA_PING { - // - // BRB header - // - BRB_HEADER Hdr; - - // - // [IN] Device that the ping is sent to - // - BTH_ADDR BtAddress; - - // [IN] lenth and data to send in the PING signal - UCHAR PingRequestLength; - UCHAR PingRequestData[MAX_L2CAP_PING_DATA_LENGTH]; - - // [OUT] length and data that the remote device responded with - UCHAR PingResponseLength; - UCHAR PingResponseData[MAX_L2CAP_PING_DATA_LENGTH]; -}; - -struct _BRB_L2CA_UPDATE_CHANNEL { - // - // BRB header - // - BRB_HEADER Hdr; - - // - // [IN] Address of the remote device - // - BTH_ADDR BtAddress; - - // - // [IN] L2cap connection handle provided by port - // - L2CAP_CHANNEL_HANDLE ChannelHandle; - - // - // The new flags that are required for the channel - // - ULONG NewChannelFlags; - - // - // If the BRB fails, this will indicate which NewChannelFlags BTHPORT was - // not able to honor. - // - ULONG FailedChannelFlags; -}; - - -/*++ - -Description: - -Send this BRB to register or unregister dynamic PSM values. Clients can -indicate their preference for a PSM value by specifying the PSM value in -_BRB_PSM.Psm. If the client has no preference, set _BRB_PSM.Psm to 0, and then -bthport will assign next avaliable PSM. On successful completion of the BRB, -_BRB_PSM.Psm will contain the assigned PSM value. - -Return value: - -STATUS_SUCCESS -STATUS_INVALID_BUFFER_SIZE BrbSize is invalid -STATUS_INVALID_PARAMETER PSM not in dynamic range -STATUS_INSUFFICIENT_RESOURCES alloc failed -STATUS_INVALID_CID Client owns this PSM -STATUS_ALREADY_COMMITTED PSM not avaliable -STATUS_CONNECTION_IN_USE PSM in use, cannot unregister - - --*/ - -struct _BRB_PSM { - // - // BRB header - // - BRB_HEADER Hdr; - - // - // The PSM that the client wants to register for - // - USHORT Psm; -}; - -// -// List of possible states of the ACL. -// -typedef enum _ACL_MODE { - ACL_MODE_ACTIVE = 0x0, // Defined in Blutooth Specification - ACL_MODE_HOLD = 0x1, // Defined in Blutooth Specification - ACL_MODE_SNIFF = 0x2, // Defined in Blutooth Specification - ACL_MODE_PARK = 0x3, // Defined in Blutooth Specification - ACL_MODE_ENTER_ACTIVE = 0x4, // About to enter Active mode. - ACL_MODE_ENTER_HOLD = 0x5, // About to enter Hold mode. - ACL_MODE_ENTER_SNIFF = 0x6, // About to enter Sniff mode. - ACL_MODE_ENTER_PARK = 0x7, // About to enter Park mode. - ACL_DISCONNECTED = 0x8, // Disconnected or sent Disconnect. -} ACL_MODE; - -// -// BRB to get the ACL mode for the specified remote device. -// -struct _BRB_ACL_GET_MODE { - // - // BRB header. - // - BRB_HEADER Hdr; - - // - // [IN] Address of the remote device. - // - BTH_ADDR BtAddress; - - // - // [OUT] The ACL mode. - // - ACL_MODE AclMode; -}; - -// -// BRB to put the specified ACL into active mode. -// This BRB will fail if: -// (1) the connection is disconnected or is about to be disconnected. -// (2) the connection is in 'hold' mode. -// -struct _BRB_ACL_ENTER_ACTIVE_MODE { - // - // BRB header. - // - BRB_HEADER Hdr; - - // - // [IN] Address of the remote device. - // - BTH_ADDR BtAddress; -}; - -#ifndef BRBTYPE - -// -// Bluetooth Request Block -// -typedef struct _BRB { - union { - struct _BRB_HEADER BrbHeader; - struct _BRB_GET_DEVICE_INTERFACE_STRING BrbGetDeviceInterfaceString; - struct _BRB_L2CA_REGISTER_SERVER BrbL2caRegisterServer; - struct _BRB_L2CA_UNREGISTER_SERVER BrbL2caUnregisterServer; - struct _BRB_L2CA_OPEN_CHANNEL BrbL2caOpenChannel; - struct _BRB_L2CA_CLOSE_CHANNEL BrbL2caCloseChannel; - struct _BRB_L2CA_PING BrbL2caPing; - struct _BRB_L2CA_ACL_TRANSFER BrbL2caAclTransfer; - struct _BRB_GET_LOCAL_BD_ADDR BrbGetLocalBdAddress; - struct _BRB_PSM BrbPsm; - struct _BRB_L2CA_UPDATE_CHANNEL BrbL2caUpdateChannel; - struct _BRB_SCO_REGISTER_SERVER BrbScoRegisterServer; - struct _BRB_SCO_UNREGISTER_SERVER BrbScoUnregisterServer; - struct _BRB_SCO_OPEN_CHANNEL BrbScoOpenChannel; - struct _BRB_SCO_CLOSE_CHANNEL BrbScoCloseChannel; - struct _BRB_SCO_FLUSH_CHANNEL BrbScoFlushChannel; - struct _BRB_SCO_TRANSFER BrbScoTransfer; - struct _BRB_SCO_GET_CHANNEL_INFO BrbScoGetChannelInfo; - struct _BRB_SCO_GET_SYSTEM_INFO BrbScoGetSystemInfo; - struct _BRB_ACL_GET_MODE BrbAclGetMode; - struct _BRB_ACL_ENTER_ACTIVE_MODE BrbAclEnterActiveMode; - }; -} BRB, *PBRB; - -// -// BthAllocateBrb -// -// Purpose: -// Allocates a Brb of a given type -// -// Returns: -// Brb pointer or NULL if the system is out of memory -// -// Note this function is not exported on 1.x bluetooth versions -// -__drv_sameIRQL -__checkReturn -__drv_when(return!=0, __drv_allocatesMem(Mem)) -typedef -PBRB -(*PFNBTH_ALLOCATE_BRB)( - __in BRB_TYPE brbType, - __in ULONG tag); - - -// -// BthFreeBrb -// -// Purpose: -// Free a Brb -// -// Returns: -// Nothing -// -// Note this function is not exported on 1.x bluetooth versions -// -__drv_sameIRQL -typedef -VOID -(*PFNBTH_FREE_BRB)( - __in __drv_freesMem(Mem) PBRB pBrb); - -// -// BthInitializeBrb -// -// Purpose: -// This is used to Initialize stack allocated Brbs. -// -// Returns: -// Nothing -// -// Note this function is not exported on 1.x bluetooth versions -// -__drv_sameIRQL -typedef -VOID -(*PFNBTH_INITIALIZE_BRB)( - __inout PBRB pBrb, - __in BRB_TYPE brbType); - -// -// BthReuseBrb -// -// Purpose: -// This function is use to reinitialize brb for -// reuse. -// -// Returns: -// Nothing -// -// Note this function is not exported on 1.x bluetooth versions -// -__drv_sameIRQL -typedef -VOID -(*PFNBTH_REUSE_BRB)( - __inout PBRB pBrb, - __in BRB_TYPE brbType); - -// -// IsBluetoothVersionAvailable -// -// Purpose: -// Indicate if the installed Bluetooth binary set supports -// the requested version -// -// Returns: -// TRUE if the installed bluetooth binaries support the given -// Major & Minor versions -// -// Note this function is not exported on 1.x bluetooth versions -// -__drv_sameIRQL -__checkReturn -typedef -BOOLEAN -(* PFNBTH_IS_BLUETOOTH_VERSION_AVAILABLE)(__in UCHAR MajorVersion, __in UCHAR MinorVersion); - -// -// Bluetooth QI Profile driver interface -// -// -// Profile drivers should register with this QI in order to get function pointers -// for allocating and freeing Brb. All Brb should be allocated or Initialized using -// these utilities. -// -// MajorFunction = IRP_MJ_PNP; -// MinorFunction = IRP_MN_QUERY_INTERFACE; -// -// {94A59AA8-4383-4286-AA4F-34A160F40004} -// DEFINE_GUID(GUID_BTHDDI_PROFILE_DRIVER_INTERFACE, -// 0x94a59aa8, 0x4383, 0x4286, 0xaa, 0x4f, 0x34, 0xa1, 0x60, -// 0xf4, 0x0, 0x4); -// -// -// The QUERY_INTERFACE Irp will provide the profile driver a set of function -// pointers for Brb allocation/frees and to verify if a Bluetooth version is available. -// -// Note this function is not exported on 1.x bluetooth versions -// -typedef struct _BTH_PROFILE_DRIVER_INTERFACE { - INTERFACE Interface; - // - // Use this function to allocate Brb - // - OUT PFNBTH_ALLOCATE_BRB BthAllocateBrb; - - // - // Use this function to free Brb allocated with BthAllocateBrb - // - OUT PFNBTH_FREE_BRB BthFreeBrb; - - // - // Use this function to initialize stack allocated Brbs - // - OUT PFNBTH_INITIALIZE_BRB BthInitializeBrb; - - // - // Use this function to reinitialize Brb for reuse - // - OUT PFNBTH_REUSE_BRB BthReuseBrb; - - // - // Indicates if the installed Bluetooth binary set supports the requested version - // - OUT PFNBTH_IS_BLUETOOTH_VERSION_AVAILABLE IsBluetoothVersionAvailable; -}BTH_PROFILE_DRIVER_INTERFACE, *PBTH_PROFILE_DRIVER_INTERFACE; - -#endif - -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4201) -#endif - -#endif // __BTHDDI_H__ - diff --git a/pub/ddk/bthguid.h b/pub/ddk/bthguid.h deleted file mode 100644 index afce682..0000000 --- a/pub/ddk/bthguid.h +++ /dev/null @@ -1,18 +0,0 @@ -#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__ - diff --git a/pub/ddk/bthioctl.h b/pub/ddk/bthioctl.h deleted file mode 100644 index eafc212..0000000 --- a/pub/ddk/bthioctl.h +++ /dev/null @@ -1,609 +0,0 @@ -/**************************************************************************** - -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 - -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 - -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4201) -#endif - - -#endif // __BTHIOCTL_H__ - diff --git a/pub/ddk/bthref.h b/pub/ddk/bthref.h deleted file mode 100644 index b331f63..0000000 --- a/pub/ddk/bthref.h +++ /dev/null @@ -1,49 +0,0 @@ -/*++ - -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__ - - diff --git a/pub/ddk/bthsdpddi.h b/pub/ddk/bthsdpddi.h deleted file mode 100644 index 2620921..0000000 --- a/pub/ddk/bthsdpddi.h +++ /dev/null @@ -1,266 +0,0 @@ -#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__ - diff --git a/pub/ddk/buffring.h b/pub/ddk/buffring.h deleted file mode 100644 index 64e0f1b..0000000 --- a/pub/ddk/buffring.h +++ /dev/null @@ -1,166 +0,0 @@ -/*++ 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__ - diff --git a/pub/ddk/calendardeviceservice.h b/pub/ddk/calendardeviceservice.h deleted file mode 100644 index 1170537..0000000 --- a/pub/ddk/calendardeviceservice.h +++ /dev/null @@ -1,291 +0,0 @@ -/* - * CalendarDeviceService.h - * - * Contains declarations for the Calendar Device Service - * - * Copyright (c) Microsoft Corporation, All Rights Reserved. - * - */ - -#ifndef _CALENDARDEVICESERVICE_H_ -#define _CALENDARDEVICESERVICE_H_ - -#include -#include -#include - - -/*****************************************************************************/ -/* 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_ */ - - diff --git a/pub/ddk/cifs.h b/pub/ddk/cifs.h deleted file mode 100644 index e39567d..0000000 --- a/pub/ddk/cifs.h +++ /dev/null @@ -1,6340 +0,0 @@ -/*++ - -Copyright (c) 1989 - 1999 Microsoft Corporation - -Module Name: - - cifs.h - -Abstract: - - This module defines structures and constants for the Common Internet File System - commands, request and response protocol. - - ---*/ - -#ifndef _CIFS_ -#define _CIFS_ - - -// -// The server has 16 bits available to it in each 32-bit status code. -// See \nt\sdk\inc\ntstatus.h for a description of the use of the -// high 16 bits of the status. -// -// The layout of the bits is: -// -// 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| Facility--Server | Class | Code | -// +---+-+-------------------------+-------+-----------------------+ -// -// Class values: -// 0 - a server-specific error code, not put directly on the wire. -// 1 - SMB error class DOS. This includes those OS/2 errors -// that share code values and meanings with the SMB protocol. -// 2 - SMB error class SERVER. -// 3 - SMB error class HARDWARE. -// 4 - other SMB error classes -// 5-E - undefined -// F - an OS/2-specific error. If the client is OS/2, then the -// SMB error class is set to DOS and the code is set to -// the actual OS/2 error code contained in the Code field. -// -// The meaning of the Code field depends on the Class value. If the -// class is 00, then the code value is arbitrary. For other classes, -// the code is the actual code of the error in the SMB or OS/2 -// protocols. -// - -#define SRV_STATUS_FACILITY_CODE 0x00980000L -#define SRV_SRV_STATUS (0xC0000000L | SRV_STATUS_FACILITY_CODE) -#define SRV_DOS_STATUS (0xC0001000L | SRV_STATUS_FACILITY_CODE) -#define SRV_SERVER_STATUS (0xC0002000L | SRV_STATUS_FACILITY_CODE) -#define SRV_HARDWARE_STATUS (0xC0003000L | SRV_STATUS_FACILITY_CODE) -#define SRV_WIN32_STATUS (0xC000E000L | SRV_STATUS_FACILITY_CODE) -#define SRV_OS2_STATUS (0xC000F000L | SRV_STATUS_FACILITY_CODE) - -//++ -// -// BOOLEAN -// SmbIsSrvStatus ( -// IN NTSTATUS Status -// ) -// -// Routine Description: -// -// Macro to determine whether a status code is one defined by the -// server (has the server facility code). -// -// Arguments: -// -// Status - the status code to check. -// -// Return Value: -// -// BOOLEAN - TRUE if the facility code is the servers, FALSE -// otherwise. -// -//-- - -#define SrvIsSrvStatus(Status) \ - ( ((Status) & 0x1FFF0000) == SRV_STATUS_FACILITY_CODE ? TRUE : FALSE ) - -//++ -// -// UCHAR -// SmbErrorClass ( -// IN NTSTATUS Status -// ) -// -// Routine Description: -// -// This macro extracts the error class field from a server status -// code. -// -// Arguments: -// -// Status - the status code from which to get the error class. -// -// Return Value: -// -// UCHAR - the server error class of the status code. -// -//-- - -#define SrvErrorClass(Status) ((UCHAR)( ((Status) & 0x0000F000) >> 12 )) - -//++ -// -// UCHAR -// SmbErrorCode ( -// IN NTSTATUS Status -// ) -// -// Routine Description: -// -// This macro extracts the error code field from a server status -// code. -// -// Arguments: -// -// Status - the status code from which to get the error code. -// -// Return Value: -// -// UCHAR - the server error code of the status code. -// -//-- - -#define SrvErrorCode(Status) ((USHORT)( (Status) & 0xFFF) ) - -// -// Status codes unique to the server. These error codes are used -// internally only. -// - -#define STATUS_ENDPOINT_CLOSED (SRV_SRV_STATUS | 0x01) -#define STATUS_DISCONNECTED (SRV_SRV_STATUS | 0x02) -#define STATUS_SERVER_ALREADY_STARTED (SRV_SRV_STATUS | 0x04) -#define STATUS_SERVER_NOT_STARTED (SRV_SRV_STATUS | 0x05) -#define STATUS_OPLOCK_BREAK_UNDERWAY (SRV_SRV_STATUS | 0x06) -#define STATUS_NONEXISTENT_NET_NAME (SRV_SRV_STATUS | 0x08) - -// -// Error codes that exist in both the SMB protocol and OS/2 but not NT. -// Note that all SMB DOS-class error codes are defined in OS/2. -// - -#define STATUS_OS2_INVALID_FUNCTION (SRV_DOS_STATUS | ERROR_INVALID_FUNCTION) -#define STATUS_OS2_TOO_MANY_OPEN_FILES \ - (SRV_DOS_STATUS | ERROR_TOO_MANY_OPEN_FILES) -#define STATUS_OS2_INVALID_ACCESS (SRV_DOS_STATUS | ERROR_INVALID_ACCESS) - -// -// SMB SERVER-class error codes that lack an NT or OS/2 equivalent. -// - -#define STATUS_INVALID_SMB (SRV_SERVER_STATUS | SMB_ERR_ERROR) -#define STATUS_SMB_BAD_NET_NAME (SRV_SERVER_STATUS | SMB_ERR_BAD_NET_NAME) -#define STATUS_SMB_BAD_TID (SRV_SERVER_STATUS | SMB_ERR_BAD_TID) -#define STATUS_SMB_BAD_UID (SRV_SERVER_STATUS | SMB_ERR_BAD_UID) -#define STATUS_SMB_TOO_MANY_UIDS (SRV_SERVER_STATUS | SMB_ERR_TOO_MANY_UIDS) -#define STATUS_SMB_USE_MPX (SRV_SERVER_STATUS | SMB_ERR_USE_MPX) -#define STATUS_SMB_USE_STANDARD (SRV_SERVER_STATUS | SMB_ERR_USE_STANDARD) -#define STATUS_SMB_CONTINUE_MPX (SRV_SERVER_STATUS | SMB_ERR_CONTINUE_MPX) -#define STATUS_SMB_BAD_COMMAND (SRV_SERVER_STATUS | SMB_ERR_BAD_COMMAND) -#define STATUS_SMB_NO_SUPPORT (SRV_SERVER_STATUS | SMB_ERR_NO_SUPPORT_INTERNAL) - -// *** because SMB_ERR_NO_SUPPORT uses 16 bits, but we have only 12 bits -// available for error codes, it must be special-cased in the code. - -// -// SMB HARDWARE-class error codes that lack an NT or OS/2 equivalent. -// - -#define STATUS_SMB_DATA (SRV_HARDWARE_STATUS | SMB_ERR_DATA) - -// -// OS/2 error codes that lack an NT or SMB equivalent. -// - -#include - -#define STATUS_OS2_INVALID_LEVEL \ - (NTSTATUS)(SRV_OS2_STATUS | ERROR_INVALID_LEVEL) - -#define STATUS_OS2_EA_LIST_INCONSISTENT \ - (NTSTATUS)(SRV_OS2_STATUS | ERROR_EA_LIST_INCONSISTENT) - -#define STATUS_OS2_NEGATIVE_SEEK \ - (NTSTATUS)(SRV_OS2_STATUS | ERROR_NEGATIVE_SEEK) - -#define STATUS_OS2_NO_MORE_SIDS \ - (NTSTATUS)(SRV_OS2_STATUS | ERROR_NO_MORE_SEARCH_HANDLES) - -#define STATUS_OS2_EAS_DIDNT_FIT \ - (NTSTATUS)(SRV_OS2_STATUS | ERROR_EAS_DIDNT_FIT) - -#define STATUS_OS2_EA_ACCESS_DENIED \ - (NTSTATUS)(SRV_OS2_STATUS | ERROR_EA_ACCESS_DENIED) - -#define STATUS_OS2_CANCEL_VIOLATION \ - (NTSTATUS)(SRV_OS2_STATUS | ERROR_CANCEL_VIOLATION) - -#define STATUS_OS2_ATOMIC_LOCKS_NOT_SUPPORTED \ - (NTSTATUS)(SRV_OS2_STATUS | ERROR_ATOMIC_LOCKS_NOT_SUPPORTED) - -#define STATUS_OS2_CANNOT_COPY \ - (NTSTATUS)(SRV_OS2_STATUS | ERROR_CANNOT_COPY) - - -// -// SMBDBG determines whether the get/put macros are instead defined as -// function calls. (This is used to more reliablyfind char/short/long -// mismatches). -// - -#ifndef SMBDBG -#define SMBDBG 0 -#endif - -// -// SMBDBG1 determines whether the names of short and long fields in SMB -// structures have an extra character appended. This is used to ensure -// that these fields are only accessed via the get/put macros. SMBDBG1 -// must be disabled when SMBDBG is enabled. -// - -#ifndef SMBDBG1 -#define SMBDBG1 0 -#endif - -#if SMBDBG && SMBDBG1 -#undef SMBDBG1 -#define SMBDBG1 0 -#endif - -// -// If __unaligned support is available, or if we're compiling for a -// machine that handles unaligned accesses in hardware, then define -// SMB_USE_UNALIGNED as 1 (TRUE). Otherwise, define it as 0 (FALSE). -// If SMB_USE_UNALIGNED is FALSE, then the macros below use byte -// accesses to build up word and longword accesses to unaligned fields. -// -// Currently, the machines we build for all have SMB_USE_UNALIGNED as -// TRUE. x86 supports unaligned accesses in hardware, while the MIPS -// compiler supports the __unaligned keyword. -// -// Note that if SMB_USE_UNALIGNED is predefined, we use that definition. -// Also, if SMB_NO_UNALIGNED is defined as TRUE, it forces -// SMB_USE_ALIGNED off. This allows us to force, for testing purposes, -// use of byte accesses in the macros. -// - -#ifndef SMB_NO_UNALIGNED -#define SMB_NO_UNALIGNED 0 -#endif - -#ifndef SMB_USE_UNALIGNED -#if SMB_NO_UNALIGNED -#define SMB_USE_UNALIGNED 0 -#else -#define SMB_USE_UNALIGNED 1 -#endif -#endif - -// -// ntdef.h defines UNALIGNED as "__unaligned" or "", depending on -// whether we're building for MIPS or x86, respectively. Because we -// want to be able to disable use of __unaligned, we define -// SMB_UNALIGNED as "UNALIGNED" or "", depending on whether -// SMB_USE_UNALIGNED is TRUE or FALSE, respectively. -// - -#if SMB_USE_UNALIGNED -#define SMB_UNALIGNED UNALIGNED -#else -#define SMB_UNALIGNED -#endif - -// -// For ease of use, we define types for unaligned pointers to shorts -// and longs in SMBs. Note that "PUSHORT UNALIGNED" doesn't work. -// - -typedef unsigned short SMB_UNALIGNED *PSMB_USHORT; -typedef unsigned long SMB_UNALIGNED *PSMB_ULONG; - -// -// Macros for renaming short and long SMB fields. -// - -#if SMBDBG1 - -#define _USHORT( field ) USHORT field ## S -#define _ULONG( field ) ULONG field ## L - -#else - -#define _USHORT( field ) USHORT field -#define _ULONG( field ) ULONG field - -#endif - -// -// Force misalignment of the following structures -// - -#ifndef NO_PACKING -#include -#endif // ndef NO_PACKING - - -// -// The SMB_DIALECT type corresponds to the different SMB dialects -// that the server can speak. Associated with it is the DialectStrings[] -// array that holds information about the ASCIIZ strings that are passed -// in the Negotiate SMB.s -// -// These are listed in order from highest preference to lowest preference. -// The assigned numbers correspond to the array SrvClientTypes[] in the -// server module srvdata.c. -// - -typedef enum _SMB_DIALECT { - - - SmbDialectNtLanMan, // NT LAN Man - SmbDialectLanMan21, // OS/2 Lanman 2.1 - SmbDialectDosLanMan21, // DOS Lanman 2.1 - SmbDialectLanMan20, // OS/2 1.2 LanMan 2.0 - SmbDialectDosLanMan20, // DOS LanMan 2.0 - SmbDialectLanMan10, // 1st version of full LanMan extensions - SmbDialectMsNet30, // Larger subset of LanMan extensions - SmbDialectMsNet103, // Limited subset of LanMan extensions - SmbDialectPcLan10, // Alternate original protocol - SmbDialectPcNet10, // Original protocol - SmbDialectIllegal, - -} SMB_DIALECT, *PSMB_DIALECT; - -#define FIRST_DIALECT SmbDialectNtLanMan - -#define FIRST_DIALECT_EMULATED SmbDialectNtLanMan - -#define LAST_DIALECT SmbDialectIllegal -#define IS_DOS_DIALECT(dialect) \ - ( (BOOLEAN)( (dialect) == SmbDialectDosLanMan21 || \ - (dialect) == SmbDialectDosLanMan20 || \ - (dialect) > SmbDialectLanMan10 ) ) -#define IS_OS2_DIALECT(dialect) ( (BOOLEAN)!IS_DOS_DIALECT(dialect) ) - -#define IS_NT_DIALECT(dialect) (dialect) == SmbDialectNtLanMan - -#define DIALECT_HONORS_UID(dialect) \ - ( (BOOLEAN)(dialect <= SmbDialectDosLanMan20 ) ) - - -// -// Date and time structures that conform to MS-DOS standard used in -// some SMBs. -// -// !!! These structures are not portable--they depend on a little-endian -// machine (TwoSeconds in lowest bits, etc.) -// - -typedef union _SMB_DATE { - USHORT Ushort; - struct { - USHORT Day : 5; - USHORT Month : 4; - USHORT Year : 7; - } Struct; -} SMB_DATE; -typedef SMB_DATE SMB_UNALIGNED *PSMB_DATE; - -typedef union _SMB_TIME { - USHORT Ushort; - struct { - USHORT TwoSeconds : 5; - USHORT Minutes : 6; - USHORT Hours : 5; - } Struct; -} SMB_TIME; -typedef SMB_TIME SMB_UNALIGNED *PSMB_TIME; - - -// -// The SMB_FIND_BUFFER and SMB_FIND_BUFFER2 structures are used in the -// Transaction2 Find protocols to return files matching the requested -// specifications. They are identical except for the EaSize field -// in SMB_FIND_BUFFER2. -// - -typedef struct _SMB_FIND_BUFFER { - SMB_DATE CreationDate; - SMB_TIME CreationTime; - SMB_DATE LastAccessDate; - SMB_TIME LastAccessTime; - SMB_DATE LastWriteDate; - SMB_TIME LastWriteTime; - _ULONG( DataSize ); - _ULONG( AllocationSize ); - _USHORT( Attributes ); - UCHAR FileNameLength; - CHAR FileName[1]; -} SMB_FIND_BUFFER; -typedef SMB_FIND_BUFFER SMB_UNALIGNED *PSMB_FIND_BUFFER; - -typedef struct _SMB_FIND_BUFFER2 { - SMB_DATE CreationDate; - SMB_TIME CreationTime; - SMB_DATE LastAccessDate; - SMB_TIME LastAccessTime; - SMB_DATE LastWriteDate; - SMB_TIME LastWriteTime; - _ULONG( DataSize ); - _ULONG( AllocationSize ); - _USHORT( Attributes ); - _ULONG( EaSize ); // this field intentionally misaligned! - UCHAR FileNameLength; - CHAR FileName[1]; -} SMB_FIND_BUFFER2; -typedef SMB_FIND_BUFFER2 SMB_UNALIGNED *PSMB_FIND_BUFFER2; - - -// -// The following structures are used in OS/2 1.2 for extended attributes -// (EAs). OS/2 2.0 uses the same structures as NT. See the OS/2 -// Programmer's Reference, Volume 4, Chapter 4 for more information. -// -// The FEA structure holds a single EA's name and value and is the -// equivalent ofthe NT structure FILE_FULL_EA_INFORMATION. -// - -typedef struct _FEA { - UCHAR fEA; - UCHAR cbName; - _USHORT( cbValue ); -} FEA; -typedef FEA SMB_UNALIGNED *PFEA; - -// -// The only legal bit in fEA is FEA_NEEDEA. -// - -#define FEA_NEEDEA 0x80 - -// -// The FEALIST structure holds the names and values of multiple EAs -// NT has no direct equivalent but rather strings together -// FILE_FULL_EA_INFORMATION structures. -// - -typedef struct _FEALIST { - _ULONG( cbList ); - FEA list[1]; -} FEALIST; -typedef FEALIST SMB_UNALIGNED *PFEALIST; - -// -// The GEA structure holds the name of a single EA. It is used to -// request the value of that EA in OS/2 API functions. The NT -// equivalent is FILE_GET_EA_INFORMATION. -// - -typedef struct _GEA { - UCHAR cbName; - CHAR szName[1]; -} GEA; -typedef GEA SMB_UNALIGNED *PGEA; - -// -// The GEALIST structure holds the names of multiple EAs. NT has no -// direct equivalent but rather strings together FILE_GET_EA_INFORMATION -// structures. -// - -typedef struct _GEALIST { - _ULONG( cbList ); - GEA list[1]; -} GEALIST; -typedef GEALIST SMB_UNALIGNED *PGEALIST; - -// -// The EAOP structure holds EA information needed by API calls. It has -// no NT equivalent. -// - -typedef struct _EAOP { - PGEALIST fpGEAList; - PFEALIST fpFEAList; - ULONG oError; -} EAOP; -typedef EAOP SMB_UNALIGNED *PEAOP; - -// -// FSALLOCATE contains information about a disk returned by -// SrvSmbQueryFsInfo. -// - -typedef struct _FSALLOCATE { - _ULONG( idFileSystem ); - _ULONG( cSectorUnit ); - _ULONG( cUnit ); - _ULONG( cUnitAvail ); - _USHORT( cbSector ); -} FSALLOCATE, *PFSALLOCATE; // *** NOT SMB_UNALIGNED! - -// -// VOLUMELABEL contains information about a volume label returned by -// SrvSmbQueryFsInformation. -// - -typedef struct _VOLUMELABEL { - UCHAR cch; - CHAR szVolLabel[12]; -} VOLUMELABEL, *PVOLUMELABEL; // *** NOT SMB_UNALIGNED! - -// -// FSINFO holds information about a volume returned by -// SrvSmbQueryFsInformation. -// - -typedef struct _FSINFO { - _ULONG( ulVsn ); - VOLUMELABEL vol; -} FSINFO, *PFSINFO; // *** NOT SMB_UNALIGNED! - -// -// File types (returned by OpenAndX and Transact2_Open) -// FileTypeIPC is a private definition for the NT redirector and -// is not in the smb protocol. -// - -typedef enum _FILE_TYPE { - FileTypeDisk = 0, - FileTypeByteModePipe = 1, - FileTypeMessageModePipe = 2, - FileTypePrinter = 3, - FileTypeCommDevice = 4, - FileTypeIPC = 0xFFFE, - FileTypeUnknown = 0xFFFF -} FILE_TYPE; - -// -// Turn structure packing back off -// - -#ifndef NO_PACKING -#include -#endif // ndef NO_PACKING - - -// -// PVOID -// ALIGN_SMB_WSTR( -// IN PVOID Pointer -// ) -// -// Routine description: -// -// This macro aligns the input pointer to the next 2-byte boundary. -// Used to align Unicode strings in SMBs. -// -// Arguments: -// -// Pointer - A pointer -// -// Return Value: -// -// PVOID - Pointer aligned to next 2-byte boundary. -// - -#define ALIGN_SMB_WSTR( Pointer ) \ - (PVOID)( ((ULONG_PTR)(Pointer) + 1) & ~1 ) - -// -// Macro to find the size of an SMB parameter block. This macro takes -// as input the type of a parameter block and a byte count. It finds -// the offset of the Buffer field, which appears at the end of all -// parameter blocks, and adds the byte count to find the total size. -// The type of the returned offset is USHORT. -// -// Note that this macro does NOT pad to a word or longword boundary. -// - -#define SIZEOF_SMB_PARAMS(type,byteCount) \ - (USHORT)( (ULONG_PTR)&((type *)0)->Buffer[0] + (byteCount) ) - -// -// Macro to find the next location after an SMB parameter block. This -// macro takes as input the address of the current parameter block, its -// type, and a byte count. It finds the address of the Buffer field, -// which appears at the end of all parameter blocks, and adds the byte -// count to find the next available location. The type of the returned -// pointer is PVOID. -// -// The byte count is passed in even though it is available through -// base->ByteCount. The reason for this is that this number will be a -// compile-time constant in most cases, so the resulting code will be -// simpler and faster. -// -// !!! This macro does not round to a longword boundary when packing -// is turned off. Pre-LM 2.0 DOS redirectors cannot handle having -// too much data sent to them; the exact amount must be sent. -// We may want to make this macro such that the first location -// AFTER the returned value (WordCount field of the SMB) is aligned, -// since most of the fields are misaligned USHORTs. This would -// result in a minor performance win on the 386 and other CISC -// machines. -// - -#ifndef NO_PACKING - -#define NEXT_LOCATION(base,type,byteCount) \ - (PVOID)( (ULONG_PTR)( (PUCHAR)( &((type *)(base))->Buffer[0] ) ) + \ - (byteCount) ) - -#else - -#define NEXT_LOCATION(base,type,byteCount) \ - (PVOID)(( (ULONG_PTR)( (PUCHAR)( &((type *)(base))->Buffer[0] ) ) + \ - (byteCount) + 3) & ~3) - -#endif - -// -// Macro to find the offset of a followon command to an and X command. -// This offset is the number of bytes from the start of the SMB header -// to where the followon command's parameters should start. -// - -#define GET_ANDX_OFFSET(header,params,type,byteCount) \ - (USHORT)( (PCHAR)(params) - (PCHAR)(header) + \ - SIZEOF_SMB_PARAMS( type,(byteCount) ) ) - -// -// The following are macros to assist in converting OS/2 1.2 EAs to -// NT style and vice-versa. -// - -//++ -// -// ULONG -// SmbGetNtSizeOfFea ( -// IN PFEA Fea -// ) -// -// Routine Description: -// -// This macro gets the size that would be required to hold the FEA -// in NT format. The length is padded to account for the fact that -// each FILE_FULL_EA_INFORMATION structure must start on a -// longword boundary. -// -// Arguments: -// -// Fea - a pointer to the OS/2 1.2 FEA structure to evaluate. -// -// Return Value: -// -// ULONG - number of bytes the FEA would require in NT format. -// -//-- - -// -// The +1 is for the zero terminator on the name, the +3 is for padding. -// - -#define SmbGetNtSizeOfFea( Fea ) \ - (ULONG)(( FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName[0]) + \ - (Fea)->cbName + 1 + SmbGetUshort( &(Fea)->cbValue ) + \ - 3 ) & ~3 ) - -//++ -// -// ULONG -// SmbGetNtSizeOfGea ( -// IN PFEA Gea -// ) -// -// Routine Description: -// -// This macro gets the size that would be required to hold the GEA -// in NT format. The length is padded to account for the fact that -// each FILE_FULL_EA_INFORMATION structure must start on a -// longword boundary. -// -// Arguments: -// -// Gea - a pointer to the OS/2 1.2 GEA structure to evaluate. -// -// Return Value: -// -// ULONG - number of bytes the GEA would require in NT format. -// -//-- - -// -// The +1 is for the zero terminator on the name, the +3 is for padding. -// - -#define SmbGetNtSizeOfGea( Gea ) \ - (ULONG)(( FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName[0]) + \ - (Gea)->cbName + 1 + 3 ) & ~3 ) - -//++ -// -// ULONG -// SmbGetOs2SizeOfNtFullEa ( -// IN PFILE_FULL_EA_INFORMATION NtFullEa; -// ) -// -// Routine Description: -// -// This macro gets the size a FILE_FULL_EA_INFORMATION structure would -// require to be represented in a OS/2 1.2 style FEA. -// -// Arguments: -// -// NtFullEa - a pointer to the NT FILE_FULL_EA_INFORMATION structure -// to evaluate. -// -// Return Value: -// -// ULONG - number of bytes requires for the FEA. -// -//-- - -#define SmbGetOs2SizeOfNtFullEa( NtFullEa ) \ - (ULONG)( sizeof(FEA) + (NtFullEa)->EaNameLength + 1 + \ - (NtFullEa)->EaValueLength ) - -//++ -// -// ULONG -// SmbGetOs2SizeOfNtGetEa ( -// IN PFILE_GET_EA_INFORMATION NtGetEa; -// ) -// -// Routine Description: -// -// This macro gets the size a FILE_GET_EA_INFORMATION structure would -// require to be represented in a OS/2 1.2 style GEA. -// -// Arguments: -// -// NtGetEa - a pointer to the NT FILE_GET_EA_INFORMATION structure -// to evaluate. -// -// Return Value: -// -// ULONG - number of bytes requires for the GEA. -// -//-- - -// -// The zero terminator on the name is accounted for by the szName[0] -// field in the GEA definition. -// - -#define SmbGetOs2SizeOfNtGetEa( NtGetEa ) \ - (ULONG)( sizeof(GEA) + (NtGetEa)->EaNameLength ) - - -/* - -Inclusion of SMB request/response structures in this file is -conditionalized in the following way: - - If INCLUDE_SMB_ALL is defined, all of the structures are defined. - - Otherwise, the following names, if defined, cause inclusion of the - corresponding SMB categories: - - INCLUDE_SMB_ADMIN Administrative requests: - PROCESS_EXIT - NEGOTIATE - SESSION_SETUP_ANDX - LOGOFF_ANDX - - INCLUDE_SMB_TREE Tree connect requests: - TREE_CONNECT - TREE_DISCONNECT - TREE_CONNECT_ANDX - - INCLUDE_SMB_DIRECTORY Directory-related requests: - CREATE_DIRECTORY - DELETE_DIRECTORY - CHECK_DIRECTORY - - INCLUDE_SMB_OPEN_CLOSE File open and close requests: - OPEN - CREATE - CLOSE - CREATE_TEMPORARY - CREATE_NEW - OPEN_ANDX - CLOSE_AND_TREE_DISC - - INCLUDE_SMB_READ_WRITE Read and write requests: - READ - WRITE - SEEK - LOCK_AND_READ - WRITE_AND_UNLOCK - WRITE_AND_CLOSE - READ_ANDX - WRITE_ANDX - - - INCLUDE_SMB_FILE_CONTROL File control requests: - FLUSH - DELETE - RENAME - COPY - MOVE - - INCLUDE_SMB_QUERY_SET File query/set requests: - QUERY_INFORMATION - SET_INFORMATION - QUERY_INFORMATION2 - SET_INFORMATION2 - QUERY_PATH_INFORMATION - SET_PATH_INFORMATION - QUERY_FILE_INFORMATION - SET_FILE_INFORMATION - - INCLUDE_SMB_LOCK Lock requests (not LOCK_AND_READ) - LOCK_BYTE_RANGE - UNLOCK_BYTE_RANGE - LOCKING_ANDX - - INCLUDE_SMB_RAW Raw read/write requests: - READ_RAW - WRITE_RAW - - INCLUDE_SMB_MPX Multiplexed requests: - READ_MPX - WRITE_MPX - - INCLUDE_SMB_SEARCH Search requests: - FIND_CLOSE2 - FIND_NOTIFY_CLOSE - SEARCH - FIND - FIND_UNIQUE - FIND_CLOSE - - INCLUDE_SMB_TRANSACTION Transaction and IOCTL requests: - TRANSACTION - IOCTL - TRANSACTION2 - NTTRANSACTION - - INCLUDE_SMB_PRINT Printer requests: - OPEN_PRINT_FILE - WRITE_PRINT_FILE - CLOSE_PRINT_FILE - GET_PRINT_QUEUE - - INCLUDE_SMB_MESSAGE Message requests: - SEND_MESSAGE - SEND_BROADCAST_MESSAGE - FORWARD_USER_NAME - CANCEL_FORWARD - GET_MACHINE_NAME - SEND_START_MB_MESSAGE - SEND_END_MB_MESSAGE - SEND_TEXT_MB_MESSAGE - - INCLUDE_SMB_MISC Miscellaneous requests: - QUERY_INFORMATION_SRV - ECHO - QUERY_INFORMATION_DISK -*/ - -#ifdef INCLUDE_SMB_ALL - -#define INCLUDE_SMB_ADMIN -#define INCLUDE_SMB_TREE -#define INCLUDE_SMB_DIRECTORY -#define INCLUDE_SMB_OPEN_CLOSE -#define INCLUDE_SMB_FILE_CONTROL -#define INCLUDE_SMB_READ_WRITE -#define INCLUDE_SMB_LOCK -#define INCLUDE_SMB_RAW -#define INCLUDE_SMB_MPX -#define INCLUDE_SMB_QUERY_SET -#define INCLUDE_SMB_SEARCH -#define INCLUDE_SMB_TRANSACTION -#define INCLUDE_SMB_PRINT -#define INCLUDE_SMB_MESSAGE -#define INCLUDE_SMB_MISC - -#endif // def INCLUDE_SMB_ALL - - -// -// Force misalignment of the following structures -// - -#ifndef NO_PACKING -#include -#endif // ndef NO_PACKING - -// -// SMB servers listen on two NETBIOS addresses to facilitate connections. The -// first one is a name formulated from the computer name by padding it with -// a number of blanks ( upto NETBIOS_NAME_LEN ). This name is registered and -// resolved using the NETBIOS name registration/resolution mechanism. They also -// register under a second name *SMBSERVER which is not a valuid netbios name -// but provides a name which can be used in NETBT session setup. This eliminates -// the need for querying the remote adapter status to obtain the name. -// - -#define SMBSERVER_LOCAL_ENDPOINT_NAME "*SMBSERVER " - -// -// SMB Command code definitions: -// - -// *** Start of SMB commands -#define SMB_COM_CREATE_DIRECTORY (UCHAR)0x00 -#define SMB_COM_DELETE_DIRECTORY (UCHAR)0x01 -#define SMB_COM_OPEN (UCHAR)0x02 -#define SMB_COM_CREATE (UCHAR)0x03 -#define SMB_COM_CLOSE (UCHAR)0x04 -#define SMB_COM_FLUSH (UCHAR)0x05 -#define SMB_COM_DELETE (UCHAR)0x06 -#define SMB_COM_RENAME (UCHAR)0x07 -#define SMB_COM_QUERY_INFORMATION (UCHAR)0x08 -#define SMB_COM_SET_INFORMATION (UCHAR)0x09 -#define SMB_COM_READ (UCHAR)0x0A -#define SMB_COM_WRITE (UCHAR)0x0B -#define SMB_COM_LOCK_BYTE_RANGE (UCHAR)0x0C -#define SMB_COM_UNLOCK_BYTE_RANGE (UCHAR)0x0D -#define SMB_COM_CREATE_TEMPORARY (UCHAR)0x0E -#define SMB_COM_CREATE_NEW (UCHAR)0x0F -#define SMB_COM_CHECK_DIRECTORY (UCHAR)0x10 -#define SMB_COM_PROCESS_EXIT (UCHAR)0x11 -#define SMB_COM_SEEK (UCHAR)0x12 -#define SMB_COM_LOCK_AND_READ (UCHAR)0x13 -#define SMB_COM_WRITE_AND_UNLOCK (UCHAR)0x14 -#define SMB_COM_READ_RAW (UCHAR)0x1A -#define SMB_COM_READ_MPX (UCHAR)0x1B -#define SMB_COM_READ_MPX_SECONDARY (UCHAR)0x1C // server to redir only -#define SMB_COM_WRITE_RAW (UCHAR)0x1D -#define SMB_COM_WRITE_MPX (UCHAR)0x1E -#define SMB_COM_WRITE_MPX_SECONDARY (UCHAR)0x1F -#define SMB_COM_WRITE_COMPLETE (UCHAR)0x20 // server to redir only -#define SMB_COM_QUERY_INFORMATION_SRV (UCHAR)0x21 -#define SMB_COM_SET_INFORMATION2 (UCHAR)0x22 -#define SMB_COM_QUERY_INFORMATION2 (UCHAR)0x23 -#define SMB_COM_LOCKING_ANDX (UCHAR)0x24 -#define SMB_COM_TRANSACTION (UCHAR)0x25 -#define SMB_COM_TRANSACTION_SECONDARY (UCHAR)0x26 -#define SMB_COM_IOCTL (UCHAR)0x27 -#define SMB_COM_IOCTL_SECONDARY (UCHAR)0x28 -#define SMB_COM_COPY (UCHAR)0x29 -#define SMB_COM_MOVE (UCHAR)0x2A -#define SMB_COM_ECHO (UCHAR)0x2B -#define SMB_COM_WRITE_AND_CLOSE (UCHAR)0x2C -#define SMB_COM_OPEN_ANDX (UCHAR)0x2D -#define SMB_COM_READ_ANDX (UCHAR)0x2E -#define SMB_COM_WRITE_ANDX (UCHAR)0x2F -#define SMB_COM_CLOSE_AND_TREE_DISC (UCHAR)0x31 -#define SMB_COM_TRANSACTION2 (UCHAR)0x32 -#define SMB_COM_TRANSACTION2_SECONDARY (UCHAR)0x33 -#define SMB_COM_FIND_CLOSE2 (UCHAR)0x34 -#define SMB_COM_FIND_NOTIFY_CLOSE (UCHAR)0x35 -#define SMB_COM_TREE_CONNECT (UCHAR)0x70 -#define SMB_COM_TREE_DISCONNECT (UCHAR)0x71 -#define SMB_COM_NEGOTIATE (UCHAR)0x72 -#define SMB_COM_SESSION_SETUP_ANDX (UCHAR)0x73 -#define SMB_COM_LOGOFF_ANDX (UCHAR)0x74 -#define SMB_COM_TREE_CONNECT_ANDX (UCHAR)0x75 -#define SMB_COM_QUERY_INFORMATION_DISK (UCHAR)0x80 -#define SMB_COM_SEARCH (UCHAR)0x81 -#define SMB_COM_FIND (UCHAR)0x82 -#define SMB_COM_FIND_UNIQUE (UCHAR)0x83 -#define SMB_COM_FIND_CLOSE (UCHAR)0x84 -#define SMB_COM_NT_TRANSACT (UCHAR)0xA0 -#define SMB_COM_NT_TRANSACT_SECONDARY (UCHAR)0xA1 -#define SMB_COM_NT_CREATE_ANDX (UCHAR)0xA2 -#define SMB_COM_NT_CANCEL (UCHAR)0xA4 -#define SMB_COM_NT_RENAME (UCHAR)0xA5 -#define SMB_COM_OPEN_PRINT_FILE (UCHAR)0xC0 -#define SMB_COM_WRITE_PRINT_FILE (UCHAR)0xC1 -#define SMB_COM_CLOSE_PRINT_FILE (UCHAR)0xC2 -#define SMB_COM_GET_PRINT_QUEUE (UCHAR)0xC3 -#define SMB_COM_SEND_MESSAGE (UCHAR)0xD0 -#define SMB_COM_SEND_BROADCAST_MESSAGE (UCHAR)0xD1 -#define SMB_COM_FORWARD_USER_NAME (UCHAR)0xD2 -#define SMB_COM_CANCEL_FORWARD (UCHAR)0xD3 -#define SMB_COM_GET_MACHINE_NAME (UCHAR)0xD4 -#define SMB_COM_SEND_START_MB_MESSAGE (UCHAR)0xD5 -#define SMB_COM_SEND_END_MB_MESSAGE (UCHAR)0xD6 -#define SMB_COM_SEND_TEXT_MB_MESSAGE (UCHAR)0xD7 -// *** End of SMB commands - -#define SMB_COM_NO_ANDX_COMMAND (UCHAR)0xFF - - -// -// Header for SMBs, see #4 page 10 -// -// *** Note that we do NOT define PSMB_HEADER as SMB_UNALIGNED! This is -// done on the assumption that the SMB header, at least, will always -// be properly aligned. If you need to access an unaligned header, -// declare the pointer as SMB_UNALIGNED *SMB_HEADER. -// - -#define SMB_SECURITY_SIGNATURE_LENGTH 8 - -typedef struct _SMB_HEADER { - UCHAR Protocol[4]; // Contains 0xFF,'SMB' - UCHAR Command; // Command code - UCHAR ErrorClass; // Error class - UCHAR Reserved; // Reserved for future use - _USHORT( Error ); // Error code - UCHAR Flags; // Flags - _USHORT( Flags2 ); // More flags - union { - _USHORT( Reserved2 )[6]; // Reserved for future use - struct { - _USHORT( PidHigh ); // High part of PID (NT Create And X) - union { - struct { - _ULONG( Key ); // Encryption key (IPX) - _USHORT( Sid ); // Session ID (IPX) - _USHORT( SequenceNumber ); // Sequence number (IPX) - _USHORT( Gid ); // Group ID (unused?) - }; - UCHAR SecuritySignature[SMB_SECURITY_SIGNATURE_LENGTH]; - // Client must send the correct Signature - // for this SMB to be accepted. - }; - }; - }; - _USHORT( Tid ); // Authenticated user/group - _USHORT( Pid ); // Caller's process id - _USHORT( Uid ); // Unauthenticated user id - _USHORT( Mid ); // multiplex id -#ifdef NO_PACKING // *** - _USHORT( Kludge ); // *** make sure parameter structs -#endif // *** are longword aligned -} SMB_HEADER; -typedef SMB_HEADER *PSMB_HEADER; - -typedef struct _NT_SMB_HEADER { - UCHAR Protocol[4]; // Contains 0xFF,'SMB' - UCHAR Command; // Command code - union { - struct { - UCHAR ErrorClass; // Error class - UCHAR Reserved; // Reserved for future use - _USHORT( Error ); // Error code - } DosError; - ULONG NtStatus; // NT-style 32-bit error code - } Status; - UCHAR Flags; // Flags - _USHORT( Flags2 ); // More flags - union { - _USHORT( Reserved2 )[6]; // Reserved for future use - struct { - _USHORT( PidHigh ); // High part of PID (NT Create And X) - union { - struct { - _ULONG( Key ); // Encryption key (IPX) - _USHORT( Sid ); // Session ID (IPX) - _USHORT( SequenceNumber ); // Sequence number (IPX) - _USHORT( Gid ); // Group ID (unused?) - }; - UCHAR SecuritySignature[SMB_SECURITY_SIGNATURE_LENGTH]; - // Client must send the correct Signature - // for this SMB to be accepted. - }; - }; - }; - _USHORT( Tid ); // Authenticated user/group - _USHORT( Pid ); // Caller's process id - _USHORT( Uid ); // Unauthenticated user id - _USHORT( Mid ); // multiplex id -#ifdef NO_PACKING // *** - _USHORT( Kludge ); // *** make sure parameter structs -#endif // *** are longword aligned -} NT_SMB_HEADER; -typedef NT_SMB_HEADER *PNT_SMB_HEADER; - -// -// The SMB header, protocol field, as a long. -// - -#define SMB_HEADER_PROTOCOL (0xFF + ('S' << 8) + ('M' << 16) + ('B' << 24)) - -// -// Minimum parameter structure that can be returned. Used in returning -// error SMBs. -// -// *** Note that this structure does NOT have a Buffer field! -// - -typedef struct _SMB_PARAMS { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of bytes that follow; min = 0 -} SMB_PARAMS; -typedef SMB_PARAMS SMB_UNALIGNED *PSMB_PARAMS; - -// -// Generic header for AndX commands. -// - -typedef struct _GENERIC_ANDX { - UCHAR WordCount; // Count of parameter words - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved - _USHORT( AndXOffset ); // Offset (from SMB header start) -} GENERIC_ANDX; -typedef GENERIC_ANDX SMB_UNALIGNED *PGENERIC_ANDX; - - -#ifdef INCLUDE_SMB_MESSAGE - -// -// Cancel Forward SMB, see #1 page 35 -// Function is SrvSmbCancelForward() -// SMB_COM_CANCEL_FORWARD 0xD3 -// - -typedef struct _REQ_CANCEL_FORWARD { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR ForwardedName[]; // Forwarded name -} REQ_CANCEL_FORWARD; -typedef REQ_CANCEL_FORWARD SMB_UNALIGNED *PREQ_CANCEL_FORWARD; - -typedef struct _RESP_CANCEL_FORWARD { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_CANCEL_FORWARD; -typedef RESP_CANCEL_FORWARD SMB_UNALIGNED *PRESP_CANCEL_FORWARD; - -#endif // def INCLUDE_SMB_MESSAGE - -#ifdef INCLUDE_SMB_DIRECTORY - -// -// Check Directory SMB, see #1 page 23 -// Function is SrvSmbCheckDirectory() -// SMB_COM_CHECK_DIRECTORY 0x10 -// - -typedef struct _REQ_CHECK_DIRECTORY { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR DirectoryPath[]; // Directory path -} REQ_CHECK_DIRECTORY; -typedef REQ_CHECK_DIRECTORY SMB_UNALIGNED *PREQ_CHECK_DIRECTORY; - -typedef struct _RESP_CHECK_DIRECTORY { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_CHECK_DIRECTORY; -typedef RESP_CHECK_DIRECTORY SMB_UNALIGNED *PRESP_CHECK_DIRECTORY; - -#endif // def INCLUDE_SMB_DIRECTORY - -#ifdef INCLUDE_SMB_OPEN_CLOSE - -// -// Close SMB, see #1 page 10 -// Function is SrvSmbClose() -// SMB_COM_CLOSE 0x04 -// - -typedef struct _REQ_CLOSE { - UCHAR WordCount; // Count of parameter words = 3 - _USHORT( Fid ); // File handle - _ULONG( LastWriteTimeInSeconds ); // Time of last write, low and high - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_CLOSE; -typedef REQ_CLOSE SMB_UNALIGNED *PREQ_CLOSE; - -typedef struct _RESP_CLOSE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_CLOSE; -typedef RESP_CLOSE SMB_UNALIGNED *PRESP_CLOSE; - -#endif // def INCLUDE_SMB_OPEN_CLOSE - -#ifdef INCLUDE_SMB_OPEN_CLOSE - -// -// Close and Tree Disconnect SMB, see #? page ?? -// Function is SrvSmbCloseAndTreeDisc -// SMB_COM_CLOSE_AND_TREE_DISC 0x31 -// - -typedef struct _REQ_CLOSE_AND_TREE_DISC { - UCHAR WordCount; // Count of parameter words - _USHORT( Fid ); // File handle - _ULONG( LastWriteTimeInSeconds ); - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_CLOSE_AND_TREE_DISC; -typedef REQ_CLOSE_AND_TREE_DISC SMB_UNALIGNED *PREQ_CLOSE_AND_TREE_DISC; - -typedef struct _RESP_CLOSE_AND_TREE_DISC { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_CLOSE_AND_TREE_DISC; -typedef RESP_CLOSE_AND_TREE_DISC SMB_UNALIGNED *PRESP_CLOSE_AND_TREE_DISC; - -#endif // def INCLUDE_SMB_OPEN_CLOSE - -#ifdef INCLUDE_SMB_PRINT - -// -// Close Print Spool File SMB, see #1 page 29 -// Function is SrvSmbClosePrintSpoolFile() -// SMB_COM_CLOSE_PRINT_FILE 0xC2 -// - -typedef struct _REQ_CLOSE_PRINT_FILE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Fid ); // File handle - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_CLOSE_PRINT_FILE; -typedef REQ_CLOSE_PRINT_FILE SMB_UNALIGNED *PREQ_CLOSE_PRINT_FILE; - -typedef struct _RESP_CLOSE_PRINT_FILE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_CLOSE_PRINT_FILE; -typedef RESP_CLOSE_PRINT_FILE SMB_UNALIGNED *PRESP_CLOSE_PRINT_FILE; - -#endif // def INCLUDE_SMB_PRINT - -#ifdef INCLUDE_SMB_FILE_CONTROL - -// -// Copy SMB, see #2 page 23 -// Function is SrvSmbCopy() -// SMB_COM_COPY 0x29 -// - -typedef struct _REQ_COPY { - UCHAR WordCount; // Count of parameter words = 3 - _USHORT( Tid2 ); // Second (target) path TID - _USHORT( OpenFunction ); // What to do if target file exists - _USHORT( Flags ); // Flags to control copy operation: - // bit 0 - target must be a file - // bit 1 - target must ba a dir. - // bit 2 - copy target mode: - // 0 = binary, 1 = ASCII - // bit 3 - copy source mode: - // 0 = binary, 1 = ASCII - // bit 4 - verify all writes - // bit 5 - tree copy - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR SourceFileName[]; // pathname of source file - //UCHAR TargetFileName[]; // pathname of target file -} REQ_COPY; -typedef REQ_COPY SMB_UNALIGNED *PREQ_COPY; - -typedef struct _RESP_COPY { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Count ); // Number of files copied - _USHORT( ByteCount ); // Count of data bytes; min = 0 - UCHAR Buffer[1]; // ASCIIZ pathname of file with error -} RESP_COPY; -typedef RESP_COPY SMB_UNALIGNED *PRESP_COPY; - -#endif // def INCLUDE_SMB_FILE_CONTROL - -#ifdef INCLUDE_SMB_OPEN_CLOSE - -// -// Create SMB, see #1 page 9 -// Create New SMB, see #1 page 23 -// Function is SrvSmbCreate() -// SMB_COM_CREATE 0x03 -// SMB_COM_CREATE_NEW 0x0F -// - -typedef struct _REQ_CREATE { - UCHAR WordCount; // Count of parameter words = 3 - _USHORT( FileAttributes ); // New file attributes - _ULONG( CreationTimeInSeconds ); // Creation time - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR FileName[]; // File name -} REQ_CREATE; -typedef REQ_CREATE SMB_UNALIGNED *PREQ_CREATE; - -typedef struct _RESP_CREATE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Fid ); // File handle - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_CREATE; -typedef RESP_CREATE SMB_UNALIGNED *PRESP_CREATE; - -#endif // def INCLUDE_SMB_OPEN_CLOSE - -#ifdef INCLUDE_SMB_DIRECTORY - -// -// Create Directory SMB, see #1 page 14 -// Function is SrvSmbCreateDirectory -// SMB_COM_CREATE_DIRECTORY 0x00 -// - -typedef struct _REQ_CREATE_DIRECTORY { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR DirectoryName[]; // Directory name -} REQ_CREATE_DIRECTORY; -typedef REQ_CREATE_DIRECTORY SMB_UNALIGNED *PREQ_CREATE_DIRECTORY; - -typedef struct _RESP_CREATE_DIRECTORY { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_CREATE_DIRECTORY; -typedef RESP_CREATE_DIRECTORY SMB_UNALIGNED *PRESP_CREATE_DIRECTORY; - -#endif // def INCLUDE_SMB_DIRECTORY - -#ifdef INCLUDE_SMB_OPEN_CLOSE - -// -// Create Temporary SMB, see #1 page 21 -// Function is SrvSmbCreateTemporary() -// SMB_COM_CREATE_TEMPORARY 0x0E -// - -typedef struct _REQ_CREATE_TEMPORARY { - UCHAR WordCount; // Count of parameter words = 3 - _USHORT( FileAttributes ); - _ULONG( CreationTimeInSeconds ); - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR DirectoryName[]; // Directory name -} REQ_CREATE_TEMPORARY; -typedef REQ_CREATE_TEMPORARY SMB_UNALIGNED *PREQ_CREATE_TEMPORARY; - -typedef struct _RESP_CREATE_TEMPORARY { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Fid ); // File handle - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR FileName[]; // File name -} RESP_CREATE_TEMPORARY; -typedef RESP_CREATE_TEMPORARY SMB_UNALIGNED *PRESP_CREATE_TEMPORARY; - -#endif // def INCLUDE_SMB_OPEN_CLOSE - -#ifdef INCLUDE_SMB_FILE_CONTROL - -// -// Delete SMB, see #1 page 16 -// Function is SrvSmbDelete() -// SMB_COM_DELETE 0x06 -// - -typedef struct _REQ_DELETE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( SearchAttributes ); - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR FileName[]; // File name -} REQ_DELETE; -typedef REQ_DELETE SMB_UNALIGNED *PREQ_DELETE; - -typedef struct _RESP_DELETE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_DELETE; -typedef RESP_DELETE SMB_UNALIGNED *PRESP_DELETE; - -#endif // def INCLUDE_SMB_FILE_CONTROL - -#ifdef INCLUDE_SMB_DIRECTORY - -// -// Delete Directory SMB, see #1 page 15 -// Function is SrvSmbDeleteDirectory() -// SMB_COM_DELETE_DIRECTORY 0x01 -// - -typedef struct _REQ_DELETE_DIRECTORY { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR DirectoryName[]; // Directory name -} REQ_DELETE_DIRECTORY; -typedef REQ_DELETE_DIRECTORY SMB_UNALIGNED *PREQ_DELETE_DIRECTORY; - -typedef struct _RESP_DELETE_DIRECTORY { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_DELETE_DIRECTORY; -typedef RESP_DELETE_DIRECTORY SMB_UNALIGNED *PRESP_DELETE_DIRECTORY; - -#endif // def INCLUDE_SMB_DIRECTORY - -#ifdef INCLUDE_SMB_MISC - -// -// Echo SMB, see #2 page 25 -// Function is SrvSmbEcho() -// SMB_COM_ECHO 0x2B -// - -typedef struct _REQ_ECHO { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( EchoCount ); // Number of times to echo data back - _USHORT( ByteCount ); // Count of data bytes; min = 4 - UCHAR Buffer[1]; // Data to echo -} REQ_ECHO; -typedef REQ_ECHO SMB_UNALIGNED *PREQ_ECHO; - -typedef struct _RESP_ECHO { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( SequenceNumber ); // Sequence number of this echo - _USHORT( ByteCount ); // Count of data bytes; min = 4 - UCHAR Buffer[1]; // Echoed data -} RESP_ECHO; -typedef RESP_ECHO SMB_UNALIGNED *PRESP_ECHO; - -#endif // def INCLUDE_SMB_MISC - -#ifdef INCLUDE_SMB_SEARCH - -// -// Find Close2 SMB, see #3 page 54 -// Function is SrvFindClose2() -// SMB_COM_FIND_CLOSE2 0x34 -// - -typedef struct _REQ_FIND_CLOSE2 { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Sid ); // Find handle - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_FIND_CLOSE2; -typedef REQ_FIND_CLOSE2 SMB_UNALIGNED *PREQ_FIND_CLOSE2; - -typedef struct _RESP_FIND_CLOSE2 { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_FIND_CLOSE2; -typedef RESP_FIND_CLOSE2 SMB_UNALIGNED *PRESP_FIND_CLOSE2; - -#endif // def INCLUDE_SMB_SEARCH - -#ifdef INCLUDE_SMB_SEARCH - -// -// Find Notify Close SMB, see #3 page 53 -// Function is SrvSmbFindNotifyClose() -// SMB_COM_FIND_NOTIFY_CLOSE 0x35 -// - -typedef struct _REQ_FIND_NOTIFY_CLOSE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Handle ); // Find notify handle - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_FIND_NOTIFY_CLOSE; -typedef REQ_FIND_NOTIFY_CLOSE SMB_UNALIGNED *PREQ_FIND_NOTIFY_CLOSE; - -typedef struct _RESP_FIND_NOTIFY_CLOSE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_FIND_NOTIFY_CLOSE; -typedef RESP_FIND_NOTIFY_CLOSE SMB_UNALIGNED *PRESP_FIND_NOTIFY_CLOSE; - -#endif // def INCLUDE_SMB_SEARCH - -#ifdef INCLUDE_SMB_FILE_CONTROL - -// -// Flush SMB, see #1 page 11 -// Function is SrvSmbFlush() -// SMB_COM_FLUSH 0x05 -// - -typedef struct _REQ_FLUSH { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Fid ); // File handle - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_FLUSH; -typedef REQ_FLUSH SMB_UNALIGNED *PREQ_FLUSH; - -typedef struct _RESP_FLUSH { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_FLUSH; -typedef RESP_FLUSH SMB_UNALIGNED *PRESP_FLUSH; - -#endif // def INCLUDE_SMB_FILE_CONTROL - -#ifdef INCLUDE_SMB_MESSAGE - -// -// Forward User Name SMB, see #1 page 34 -// Function is SrvSmbForwardUserName() -// SMB_COM_FORWARD_USER_NAME 0xD2 -// - -typedef struct _REQ_FORWARD_USER_NAME { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR ForwardedName[]; // Forwarded name -} REQ_FORWARD_USER_NAME; -typedef REQ_FORWARD_USER_NAME SMB_UNALIGNED *PREQ_FORWARD_USER_NAME; - -typedef struct _RESP_FORWARD_USER_NAME { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_FORWARD_USER_NAME; -typedef RESP_FORWARD_USER_NAME SMB_UNALIGNED *PRESP_FORWARD_USER_NAME; - -#endif // def INCLUDE_SMB_MESSAGE - -#ifdef INCLUDE_SMB_MESSAGE - -// -// Get Machine Name SMB, see #1 page 35 -// Function is SrvSmbGetMachineName() -// SMB_COM_GET_MACHINE_NAME 0xD4 -// - -typedef struct _REQ_GET_MACHINE_NAME { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_GET_MACHINE_NAME; -typedef REQ_GET_MACHINE_NAME SMB_UNALIGNED *PREQ_GET_MACHINE_NAME; - -typedef struct _RESP_GET_MACHINE_NAME { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR MachineName[]; // Machine name -} RESP_GET_MACHINE_NAME; -typedef RESP_GET_MACHINE_NAME SMB_UNALIGNED *PRESP_GET_MACHINE_NAME; - -#endif // def INCLUDE_SMB_MESSAGE - -#ifdef INCLUDE_SMB_PRINT - -// -// Get Print Queue SMB, see #1 page 29 -// Function is SrvSmbGetPrintQueue() -// SMB_COM_GET_PRINT_QUEUE 0xC3 -// - -typedef struct _REQ_GET_PRINT_QUEUE { - UCHAR WordCount; // Count of parameter words = 2 - _USHORT( MaxCount ); // Max number of entries to return - _USHORT( StartIndex ); // First queue entry to return - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_GET_PRINT_QUEUE; -typedef REQ_GET_PRINT_QUEUE SMB_UNALIGNED *PREQ_GET_PRINT_QUEUE; - -typedef struct _RESP_GET_PRINT_QUEUE { - UCHAR WordCount; // Count of parameter words = 2 - _USHORT( Count ); // Number of entries returned - _USHORT( RestartIndex ); // Index of entry after last returned - _USHORT( ByteCount ); // Count of data bytes; min = 3 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x01 -- Data block - //USHORT DataLength; // Length of data - //UCHAR Data[]; // Queue elements -} RESP_GET_PRINT_QUEUE; -typedef RESP_GET_PRINT_QUEUE SMB_UNALIGNED *PRESP_GET_PRINT_QUEUE; - -#endif // def INCLUDE_SMB_PRINT - -#ifdef INCLUDE_SMB_TRANSACTION - -// -// Ioctl SMB, see #2 page 39 -// Function is SrvSmbIoctl() -// SMB_COM_IOCTL 0x27 -// SMB_COM_IOCTL_SECONDARY 0x28 -// - -typedef struct _REQ_IOCTL { - UCHAR WordCount; // Count of parameter words = 14 - _USHORT( Fid ); // File handle - _USHORT( Category ); // Device category - _USHORT( Function ); // Device function - _USHORT( TotalParameterCount ); // Total parameter bytes being sent - _USHORT( TotalDataCount ); // Total data bytes being sent - _USHORT( MaxParameterCount ); // Max parameter bytes to return - _USHORT( MaxDataCount ); // Max data bytes to return - _ULONG( Timeout ); - _USHORT( Reserved ); - _USHORT( ParameterCount ); // Parameter bytes sent this buffer - _USHORT( ParameterOffset ); // Offset (from header start) to params - _USHORT( DataCount ); // Data bytes sent this buffer - _USHORT( DataOffset ); // Offset (from header start) to data - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount) - //UCHAR Pad1[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data bytes (# = DataCount) -} REQ_IOCTL; -typedef REQ_IOCTL SMB_UNALIGNED *PREQ_IOCTL; - -typedef struct _RESP_IOCTL_INTERIM { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_IOCTL_INTERIM; -typedef RESP_IOCTL_INTERIM SMB_UNALIGNED *PRESP_IOCTL_INTERIM; - -typedef struct _REQ_IOCTL_SECONDARY { - UCHAR WordCount; // Count of parameter words = 8 - _USHORT( TotalParameterCount ); // Total parameter bytes being sent - _USHORT( TotalDataCount ); // Total data bytes being sent - _USHORT( ParameterCount ); // Parameter bytes sent this buffer - _USHORT( ParameterOffset ); // Offset (from header start) to params - _USHORT( ParameterDisplacement ); // Displacement of these param bytes - _USHORT( DataCount ); // Data bytes sent this buffer - _USHORT( DataOffset ); // Offset (from header start) to data - _USHORT( DataDisplacement ); // Displacement of these data bytes - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount) - //UCHAR Pad1[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data bytes (# = DataCount) -} REQ_IOCTL_SECONDARY; -typedef REQ_IOCTL_SECONDARY SMB_UNALIGNED *PREQ_IOCTL_SECONDARY; - -typedef struct _RESP_IOCTL { - UCHAR WordCount; // Count of parameter words = 8 - _USHORT( TotalParameterCount ); // Total parameter bytes being sent - _USHORT( TotalDataCount ); // Total data bytes being sent - _USHORT( ParameterCount ); // Parameter bytes sent this buffer - _USHORT( ParameterOffset ); // Offset (from header start) to params - _USHORT( ParameterDisplacement ); // Displacement of these param bytes - _USHORT( DataCount ); // Data bytes sent this buffer - _USHORT( DataOffset ); // Offset (from header start) to data - _USHORT( DataDisplacement ); // Displacement of these data bytes - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount) - //UCHAR Pad1[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data bytes (# = DataCount) -} RESP_IOCTL; -typedef RESP_IOCTL SMB_UNALIGNED *PRESP_IOCTL; - -#endif // def INCLUDE_SMB_TRANSACTION - -#ifdef INCLUDE_SMB_LOCK - -// -// Lock Byte Range SMB, see #1 page 20 -// Function is SrvSmbLockByteRange() -// SMB_COM_LOCK_BYTE_RANGE 0x0C -// - -typedef struct _REQ_LOCK_BYTE_RANGE { - UCHAR WordCount; // Count of parameter words = 5 - _USHORT( Fid ); // File handle - _ULONG( Count ); // Count of bytes to lock - _ULONG( Offset ); // Offset from start of file - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_LOCK_BYTE_RANGE; -typedef REQ_LOCK_BYTE_RANGE SMB_UNALIGNED *PREQ_LOCK_BYTE_RANGE; - -typedef struct _RESP_LOCK_BYTE_RANGE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_LOCK_BYTE_RANGE; -typedef RESP_LOCK_BYTE_RANGE SMB_UNALIGNED *PRESP_LOCK_BYTE_RANGE; - -#endif // def INCLUDE_SMB_LOCK - -#ifdef INCLUDE_SMB_LOCK - -// -// Locking and X SMB, see #2 page 46 -// Function is SrvLockingAndX() -// SMB_COM_LOCKING_ANDX 0x24 -// - -typedef struct _REQ_LOCKING_ANDX { - UCHAR WordCount; // Count of parameter words = 8 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( Fid ); // File handle - - // - // When NT protocol is not negotiated the OplockLevel field is - // omitted, and LockType field is a full word. Since the upper - // bits of LockType are never used, this definition works for - // all protocols. - // - - UCHAR( LockType ); // Locking mode: - // bit 0: 0 = lock out all access - // 1 = read OK while locked - // bit 1: 1 = 1 user total file unlock - UCHAR( OplockLevel ); // The new oplock level - _ULONG( Timeout ); - _USHORT( NumberOfUnlocks ); // Num. unlock range structs following - _USHORT( NumberOfLocks ); // Num. lock range structs following - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //LOCKING_ANDX_RANGE Unlocks[]; // Unlock ranges - //LOCKING_ANDX_RANGE Locks[]; // Lock ranges -} REQ_LOCKING_ANDX; -typedef REQ_LOCKING_ANDX SMB_UNALIGNED *PREQ_LOCKING_ANDX; - -#define LOCKING_ANDX_SHARED_LOCK 0x01 -#define LOCKING_ANDX_OPLOCK_RELEASE 0x02 -#define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04 -#define LOCKING_ANDX_CANCEL_LOCK 0x08 -#define LOCKING_ANDX_LARGE_FILES 0x10 - -#define OPLOCK_BROKEN_TO_NONE 0 -#define OPLOCK_BROKEN_TO_II 1 - -typedef struct _LOCKING_ANDX_RANGE { - _USHORT( Pid ); // PID of process "owning" lock - _ULONG( Offset ); // Ofset to bytes to [un]lock - _ULONG( Length ); // Number of bytes to [un]lock -} LOCKING_ANDX_RANGE; -typedef LOCKING_ANDX_RANGE SMB_UNALIGNED *PLOCKING_ANDX_RANGE; - -typedef struct _NT_LOCKING_ANDX_RANGE { - _USHORT( Pid ); // PID of process "owning" lock - _USHORT( Pad ); // Pad to DWORD align (mbz) - _ULONG( OffsetHigh ); // Ofset to bytes to [un]lock (high) - _ULONG( OffsetLow ); // Ofset to bytes to [un]lock (low) - _ULONG( LengthHigh ); // Number of bytes to [un]lock (high) - _ULONG( LengthLow ); // Number of bytes to [un]lock (low) -} NTLOCKING_ANDX_RANGE; -typedef NTLOCKING_ANDX_RANGE SMB_UNALIGNED *PNTLOCKING_ANDX_RANGE; - // -typedef struct _RESP_LOCKING_ANDX { - UCHAR WordCount; // Count of parameter words = 2 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_LOCKING_ANDX; -typedef RESP_LOCKING_ANDX SMB_UNALIGNED *PRESP_LOCKING_ANDX; - -#define LOCK_BROKEN_SIZE 51 // # of bytes in lock broken notify - -#endif // def INCLUDE_SMB_LOCK - -#ifdef INCLUDE_SMB_ADMIN - -// -// Logoff and X SMB, see #3, page 55 -// SMB_COM_LOGOFF_ANDX 0x74 -// - -typedef struct _REQ_LOGOFF_ANDX { - UCHAR WordCount; // Count of parameter words = 2 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_LOGOFF_ANDX; -typedef REQ_LOGOFF_ANDX SMB_UNALIGNED *PREQ_LOGOFF_ANDX; - -typedef struct _RESP_LOGOFF_ANDX { - UCHAR WordCount; // Count of parameter words = 2 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_LOGOFF_ANDX; -typedef RESP_LOGOFF_ANDX SMB_UNALIGNED *PRESP_LOGOFF_ANDX; - -#endif // def INCLUDE_SMB_ADMIN - -#ifdef INCLUDE_SMB_FILE_CONTROL - -// -// Move SMB, see #2 page 49 -// Funcion is SrvSmbMove() -// SMB_COM_MOVE 0x2A -// - -typedef struct _REQ_MOVE { - UCHAR WordCount; // Count of parameter words = 3 - _USHORT( Tid2 ); // Second (target) file id - _USHORT( OpenFunction ); // what to do if target file exists - _USHORT( Flags ); // Flags to control move operations: - // 0 - target must be a file - // 1 - target must be a directory - // 2 - reserved (must be 0) - // 3 - reserved (must be 0) - // 4 - verify all writes - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR OldFileName[]; // Old file name - //UCHAR NewFileName[]; // New file name -} REQ_MOVE; -typedef REQ_MOVE SMB_UNALIGNED *PREQ_MOVE; - -typedef struct _RESP_MOVE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Count ); // Number of files moved - _USHORT( ByteCount ); // Count of data bytes; min = 0 - UCHAR Buffer[1]; // Pathname of file where error occurred -} RESP_MOVE; -typedef RESP_MOVE SMB_UNALIGNED *PRESP_MOVE; - -#endif // def INCLUDE_SMB_FILE_CONTROL - -#ifdef INCLUDE_SMB_ADMIN - -// -// Negotiate SMB's for Net 1 and Net 3, see #1 page 25 and #2 page 20 -// Function is SrvSmbNegotiate() -// SMB_COM_NEGOTIATE 0x72 -// - -typedef struct _REQ_NEGOTIATE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //struct { - // UCHAR BufferFormat; // 0x02 -- Dialect - // UCHAR DialectName[]; // ASCIIZ - //} Dialects[]; -} REQ_NEGOTIATE; -typedef REQ_NEGOTIATE *PREQ_NEGOTIATE; // *** NOT SMB_UNALIGNED! - -typedef struct _RESP_NEGOTIATE { - UCHAR WordCount; // Count of parameter words = 13 - _USHORT( DialectIndex ); // Index of selected dialect - _USHORT( SecurityMode ); // Security mode: - // bit 0: 0 = share, 1 = user - // bit 1: 1 = encrypt passwords - // bit 2: 1 = SMB security signatures enabled - // bit 3: 1 = SMB security signatures required - _USHORT( MaxBufferSize ); // Max transmit buffer size - _USHORT( MaxMpxCount ); // Max pending multiplexed requests - _USHORT( MaxNumberVcs ); // Max VCs between client and server - _USHORT( RawMode ); // Raw modes supported: - // bit 0: 1 = Read Raw supported - // bit 1: 1 = Write Raw supported - _ULONG( SessionKey ); - SMB_TIME ServerTime; // Current time at server - SMB_DATE ServerDate; // Current date at server - _USHORT( ServerTimeZone ); // Current time zone at server - _USHORT( EncryptionKeyLength ); // MBZ if this is not LM2.1 - _USHORT( Reserved ); // MBZ - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Password encryption key - //UCHAR EncryptionKey[]; // The challenge encryption key - //UCHAR PrimaryDomain[]; // The server's primary domain (2.1 only) -} RESP_NEGOTIATE; -typedef RESP_NEGOTIATE *PRESP_NEGOTIATE; // *** NOT SMB_UNALIGNED! - -// Macros for SecurityMode field, above -#define NEGOTIATE_USER_SECURITY 0x01 -#define NEGOTIATE_ENCRYPT_PASSWORDS 0x02 -#define NEGOTIATE_SECURITY_SIGNATURES_ENABLED 0x04 -#define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED 0x08 - -// Macros for RawMode field, above -#define NEGOTIATE_READ_RAW_SUPPORTED 1 -#define NEGOTIATE_WRITE_RAW_SUPPORTED 2 - -typedef struct _RESP_OLD_NEGOTIATE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( DialectIndex ); // Index of selected dialect - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_OLD_NEGOTIATE; -typedef RESP_OLD_NEGOTIATE *PRESP_OLD_NEGOTIATE; // *** NOT SMB_UNALIGNED! - -typedef struct _RESP_NT_NEGOTIATE { - UCHAR WordCount; // Count of parameter words = 17 - _USHORT( DialectIndex ); // Index of selected dialect - UCHAR( SecurityMode ); // Security mode: - // bit 0: 0 = share, 1 = user - // bit 1: 1 = encrypt passwords - // bit 2: 1 = SMB sequence numbers enabled - // bit 3: 1 = SMB sequence numbers required - _USHORT( MaxMpxCount ); // Max pending multiplexed requests - _USHORT( MaxNumberVcs ); // Max VCs between client and server - _ULONG( MaxBufferSize ); // Max transmit buffer size - _ULONG( MaxRawSize ); // Maximum raw buffer size - _ULONG( SessionKey ); - _ULONG( Capabilities ); // Server capabilities - _ULONG( SystemTimeLow ); // System (UTC) time of the server (low). - _ULONG( SystemTimeHigh ); // System (UTC) time of the server (high). - _USHORT( ServerTimeZone ); // Time zone of server (min from UTC) - UCHAR( EncryptionKeyLength ); // Length of encryption key. - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Password encryption key - //UCHAR EncryptionKey[]; // The challenge encryption key - //UCHAR OemDomainName[]; // The name of the domain (in OEM chars) -} RESP_NT_NEGOTIATE; -typedef RESP_NT_NEGOTIATE *PRESP_NT_NEGOTIATE; // *** NOT SMB_UNALIGNED! - -#endif // def INCLUDE_SMB_ADMIN - -// -// Server / workstation capabilities -// N.B. Most messages use a ULONG for this, so there are many more -// bits available. -// - -#define CAP_RAW_MODE 0x0001 -#define CAP_MPX_MODE 0x0002 -#define CAP_UNICODE 0x0004 -#define CAP_LARGE_FILES 0x0008 -#define CAP_NT_SMBS 0x0010 -#define CAP_RPC_REMOTE_APIS 0x0020 -#define CAP_NT_STATUS 0x0040 -#define CAP_LEVEL_II_OPLOCKS 0x0080 -#define CAP_LOCK_AND_READ 0x0100 -#define CAP_NT_FIND 0x0200 -#define CAP_DFS 0x1000 // This server is DFS aware -#define CAP_INFOLEVEL_PASSTHRU 0x2000 // NT information level requests can pass through -#define CAP_LARGE_READX 0x4000 // Server supports oversized READ&X on files -#define CAP_LARGE_WRITEX 0x8000 - -#ifdef INCLUDE_SMB_OPEN_CLOSE - -// -// Open SMB, see #1, page 7 -// Function is SrvSmbOpen() -// SMB_COM_OPEN 0x02 -// - -typedef struct _REQ_OPEN { - UCHAR WordCount; // Count of parameter words = 2 - _USHORT( DesiredAccess ); // Mode - read/write/share - _USHORT( SearchAttributes ); - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR FileName[]; // File name -} REQ_OPEN; -typedef REQ_OPEN SMB_UNALIGNED *PREQ_OPEN; - -typedef struct _RESP_OPEN { - UCHAR WordCount; // Count of parameter words = 7 - _USHORT( Fid ); // File handle - _USHORT( FileAttributes ); - _ULONG( LastWriteTimeInSeconds ); - _ULONG( DataSize ); // File size - _USHORT( GrantedAccess ); // Access allowed - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_OPEN; -typedef RESP_OPEN SMB_UNALIGNED *PRESP_OPEN; - -#endif // def INCLUDE_SMB_OPEN_CLOSE - -#ifdef INCLUDE_SMB_OPEN_CLOSE - -// -// Open and X SMB, see #2 page 51 -// Function is SrvOpenAndX() -// SMB_COM_OPEN_ANDX 0x2D -// - -typedef struct _REQ_OPEN_ANDX { - UCHAR WordCount; // Count of parameter words = 15 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( Flags ); // Additional information: bit set- - // 0 - return additional info - // 1 - set single user total file lock - // 2 - server notifies consumer of - // actions which may change file - // 4 - return extended response - _USHORT( DesiredAccess ); // File open mode - _USHORT( SearchAttributes ); - _USHORT( FileAttributes ); - _ULONG( CreationTimeInSeconds ); - _USHORT( OpenFunction ); - _ULONG( AllocationSize ); // Bytes to reserve on create or truncate - _ULONG( Timeout ); // Max milliseconds to wait for resource - _ULONG( Reserved ); // Reserved (must be 0) - _USHORT( ByteCount ); // Count of data bytes; min = 1 - UCHAR Buffer[1]; // File name -} REQ_OPEN_ANDX; -typedef REQ_OPEN_ANDX SMB_UNALIGNED *PREQ_OPEN_ANDX; - -typedef struct _RESP_OPEN_ANDX { - UCHAR WordCount; // Count of parameter words = 15 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( Fid ); // File handle - _USHORT( FileAttributes ); - _ULONG( LastWriteTimeInSeconds ); - _ULONG( DataSize ); // Current file size - _USHORT( GrantedAccess ); // Access permissions actually allowed - _USHORT( FileType ); - _USHORT( DeviceState ); // state of IPC device (e.g. pipe) - _USHORT( Action ); // Action taken - _ULONG( ServerFid ); // Server unique file id - _USHORT( Reserved ); // Reserved (must be 0) - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_OPEN_ANDX; -typedef RESP_OPEN_ANDX SMB_UNALIGNED *PRESP_OPEN_ANDX; - -typedef struct _REQ_NT_CREATE_ANDX { - UCHAR WordCount; // Count of parameter words = 24 - UCHAR AndXCommand; // Secondary command; 0xFF = None - UCHAR AndXReserved; // MBZ - _USHORT( AndXOffset ); // Offset to next command wordcount - UCHAR Reserved; // MBZ - _USHORT( NameLength ); // Length of Name[] in bytes - _ULONG( Flags ); // Create flags - _ULONG( RootDirectoryFid ); // If non-zero, open is relative to this directory - ACCESS_MASK DesiredAccess; // NT access desired - LARGE_INTEGER AllocationSize; // Initial allocation size - _ULONG( FileAttributes ); // File attributes for creation - _ULONG( ShareAccess ); // Type of share access - _ULONG( CreateDisposition ); // Action to take if file exists or not - _ULONG( CreateOptions ); // Options to use if creating a file - _ULONG( ImpersonationLevel ); // Security QOS information - UCHAR SecurityFlags; // Security QOS information - _USHORT( ByteCount ); // Length of byte parameters - UCHAR Buffer[1]; - //UCHAR Name[]; // File to open or create -} REQ_NT_CREATE_ANDX; -typedef REQ_NT_CREATE_ANDX SMB_UNALIGNED *PREQ_NT_CREATE_ANDX; - -// Flag bit for Security flags - -#define SMB_SECURITY_DYNAMIC_TRACKING 0x01 -#define SMB_SECURITY_EFFECTIVE_ONLY 0x02 - -typedef struct _RESP_NT_CREATE_ANDX { - UCHAR WordCount; // Count of parameter words = 26 - UCHAR AndXCommand; // Secondary command; 0xFF = None - UCHAR AndXReserved; // MBZ - _USHORT( AndXOffset ); // Offset to next command wordcount - UCHAR OplockLevel; // The oplock level granted - _USHORT( Fid ); // The file ID - _ULONG( CreateAction ); // The action taken - TIME CreationTime; // The time the file was created - TIME LastAccessTime; // The time the file was accessed - TIME LastWriteTime; // The time the file was last written - TIME ChangeTime; // The time the file was last changed - _ULONG( FileAttributes ); // The file attributes - LARGE_INTEGER AllocationSize; // The number of byes allocated - LARGE_INTEGER EndOfFile; // The end of file offset - _USHORT( FileType ); - union { - _USHORT( DeviceState ); // state of IPC device (e.g. pipe) - _USHORT( FileStatusFlags ); // if a file or directory. See below. - }; - BOOLEAN Directory; // TRUE if this is a directory - _USHORT( ByteCount ); // = 0 - UCHAR Buffer[1]; -} RESP_NT_CREATE_ANDX; -typedef RESP_NT_CREATE_ANDX SMB_UNALIGNED *PRESP_NT_CREATE_ANDX; - -// -// Values for FileStatusFlags, if the opened resource is a file or directory -// -#define SMB_FSF_NO_EAS 0x0001 // file/dir has no extended attributes -#define SMB_FSF_NO_SUBSTREAMS 0x0002 // file/dir has no substreams -#define SMB_FSF_NO_REPARSETAG 0x0004 // file/dir is not a reparse point - - -#define SMB_OPLOCK_LEVEL_NONE 0 -#define SMB_OPLOCK_LEVEL_EXCLUSIVE 1 -#define SMB_OPLOCK_LEVEL_BATCH 2 -#define SMB_OPLOCK_LEVEL_II 3 - -#endif // def INCLUDE_SMB_OPEN_CLOSE - -#ifdef INCLUDE_SMB_PRINT - -// -// Open Print File SMB, see #1 page 27 -// Function is SrvSmbOpenPrintFile() -// SMB_COM_OPEN_PRINT_FILE 0xC0 -// - -typedef struct _REQ_OPEN_PRINT_FILE { - UCHAR WordCount; // Count of parameter words = 2 - _USHORT( SetupLength ); // Length of printer setup data - _USHORT( Mode ); // 0 = Text mode (DOS expands TABs) - // 1 = Graphics mode - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR IdentifierString[]; // Identifier string -} REQ_OPEN_PRINT_FILE; -typedef REQ_OPEN_PRINT_FILE SMB_UNALIGNED *PREQ_OPEN_PRINT_FILE; - -typedef struct _RESP_OPEN_PRINT_FILE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Fid ); // File handle - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_OPEN_PRINT_FILE; -typedef RESP_OPEN_PRINT_FILE SMB_UNALIGNED *PRESP_OPEN_PRINT_FILE; - -#endif // def INCLUDE_SMB_PRINT - -#ifdef INCLUDE_SMB_ADMIN - -// -// Process Exit SMB, see #1 page 22 -// Function is SrvSmbProcessExit() -// SMB_COM_PROCESS_EXIT 0x11 -// - -typedef struct _REQ_PROCESS_EXIT { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_PROCESS_EXIT; -typedef REQ_PROCESS_EXIT SMB_UNALIGNED *PREQ_PROCESS_EXIT; - -typedef struct _RESP_PROCESS_EXIT { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_PROCESS_EXIT; -typedef RESP_PROCESS_EXIT SMB_UNALIGNED *PRESP_PROCESS_EXIT; - -#endif // def INCLUDE_SMB_ADMIN - -#ifdef INCLUDE_SMB_QUERY_SET - -// -// Query Information SMB, see #1 page 18 -// Function is SrvSmbQueryInformation() -// SMB_COM_QUERY_INFORMATION 0x08 -// - -typedef struct _REQ_QUERY_INFORMATION { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR FileName[]; // File name -} REQ_QUERY_INFORMATION; -typedef REQ_QUERY_INFORMATION SMB_UNALIGNED *PREQ_QUERY_INFORMATION; - -typedef struct _RESP_QUERY_INFORMATION { - UCHAR WordCount; // Count of parameter words = 10 - _USHORT( FileAttributes ); - _ULONG( LastWriteTimeInSeconds ); - _ULONG( FileSize ); // File size - _USHORT( Reserved )[5]; // Reserved (must be 0) - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_QUERY_INFORMATION; -typedef RESP_QUERY_INFORMATION SMB_UNALIGNED *PRESP_QUERY_INFORMATION; - -#endif // def INCLUDE_SMB_QUERY_SET - -#ifdef INCLUDE_SMB_QUERY_SET - -// -// Query Information2 SMB, see #2 page 37 -// Function is SrvSmbQueryInformation2() -// SMB_COM_QUERY_INFORMATION2 0x23 -// - -typedef struct _REQ_QUERY_INFORMATION2 { - UCHAR WordCount; // Count of parameter words = 2 - _USHORT( Fid ); // File handle - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_QUERY_INFORMATION2; -typedef REQ_QUERY_INFORMATION2 SMB_UNALIGNED *PREQ_QUERY_INFORMATION2; - -typedef struct _RESP_QUERY_INFORMATION2 { - UCHAR WordCount; // Count of parameter words = 11 - SMB_DATE CreationDate; - SMB_TIME CreationTime; - SMB_DATE LastAccessDate; - SMB_TIME LastAccessTime; - SMB_DATE LastWriteDate; - SMB_TIME LastWriteTime; - _ULONG( FileDataSize ); // File end of data - _ULONG( FileAllocationSize ); // File allocation size - _USHORT( FileAttributes ); - _USHORT( ByteCount ); // Count of data bytes; min = 0 - UCHAR Buffer[1]; // Reserved buffer -} RESP_QUERY_INFORMATION2; -typedef RESP_QUERY_INFORMATION2 SMB_UNALIGNED *PRESP_QUERY_INFORMATION2; - -#endif // def INCLUDE_SMB_QUERY_SET - -#ifdef INCLUDE_SMB_MISC - -// -// Query Information Disk SMB, see #1 page 24 -// Function is SrvSmbQueryInformationDisk() -// SMB_COM_QUERY_INFORMATION_DISK 0x80 -// - -typedef struct _REQ_QUERY_INFORMATION_DISK { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_QUERY_INFORMATION_DISK; -typedef REQ_QUERY_INFORMATION_DISK SMB_UNALIGNED *PREQ_QUERY_INFORMATION_DISK; - -typedef struct _RESP_QUERY_INFORMATION_DISK { - UCHAR WordCount; // Count of parameter words = 5 - _USHORT( TotalUnits ); // Total allocation units per server - _USHORT( BlocksPerUnit ); // Blocks per allocation unit - _USHORT( BlockSize ); // Block size (in bytes) - _USHORT( FreeUnits ); // Number of free units - _USHORT( Reserved ); // Reserved (media identification code) - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_QUERY_INFORMATION_DISK; -typedef RESP_QUERY_INFORMATION_DISK SMB_UNALIGNED *PRESP_QUERY_INFORMATION_DISK; - -#endif // def INCLUDE_SMB_MISC - -#ifdef INCLUDE_SMB_MISC - -// -// Query Server Information SMB, see #? page ?? -// Function is SrvSmbQueryInformationServer -// SMB_COM_QUERY_INFORMATION_SRV 0x21 -// - -typedef struct _REQ_QUERY_INFORMATION_SRV { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Mode ); - _USHORT( ByteCount ); // Count of data bytes; min = - UCHAR Buffer[1]; // -} REQ_QUERY_INFORMATION_SRV; -typedef REQ_QUERY_INFORMATION_SRV SMB_UNALIGNED *PREQ_QUERY_INFORMATION_SRV; - -typedef struct _RESP_QUERY_INFORMATION_SRV { - UCHAR WordCount; // Count of parameter words = 20 - _ULONG( smb_fsid ); - _ULONG( BlocksPerUnit ); - _ULONG( smb_aunits ); - _ULONG( smb_fau ); - _USHORT( BlockSize ); - SMB_DATE smb_vldate; - SMB_TIME smb_vltime; - UCHAR smb_vllen; - UCHAR Reserved; // Reserved (must be 0) - _USHORT( SecurityMode ); - _USHORT( BlockMode ); - _ULONG( Services ); - _USHORT( MaxTransmitSize ); - _USHORT( MaxMpxCount ); - _USHORT( MaxNumberVcs ); - SMB_TIME ServerTime; - SMB_DATE ServerDate; - _USHORT( ServerTimeZone ); - _ULONG( Reserved2 ); - _USHORT( ByteCount ); // Count of data bytes; min = - UCHAR Buffer[1]; // -} RESP_QUERY_INFORMATION_SRV; -typedef RESP_QUERY_INFORMATION_SRV SMB_UNALIGNED *PRESP_QUERY_INFORMATION_SRV; - -#endif // def INCLUDE_SMB_MISC - -#ifdef INCLUDE_SMB_READ_WRITE - -// -// Read SMB, see #1 page 12 -// Lock and Read SMB, see #2 page 44 -// SMB_COM_READ 0x0A, Function is SrvSmbRead -// SMB_COM_LOCK_AND_READ 0x13, Function is SrvSmbLockAndRead -// - -typedef struct _REQ_READ { - UCHAR WordCount; // Count of parameter words = 5 - _USHORT( Fid ); // File handle - _USHORT( Count ); // Count of bytes being requested - _ULONG( Offset ); // Offset in file of first byte to read - _USHORT( Remaining ); // Estimate of bytes to read if nonzero - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_READ; -typedef REQ_READ SMB_UNALIGNED *PREQ_READ; - -// -// *** Warning: the following structure is defined the way it is to -// ensure longword alignment of the data buffer. (This only matters -// when packing is disabled; when packing is turned on, the right -// thing happens no matter what.) -// - -typedef struct _RESP_READ { - UCHAR WordCount; // Count of parameter words = 5 - _USHORT( Count ); // Count of bytes actually returned - _USHORT( Reserved )[4]; // Reserved (must be 0) - _USHORT( ByteCount ); // Count of data bytes - //UCHAR Buffer[1]; // Buffer containing: - UCHAR BufferFormat; // 0x01 -- Data block - _USHORT( DataLength ); // Length of data - ULONG Buffer[1]; // Data -} RESP_READ; -typedef RESP_READ SMB_UNALIGNED *PRESP_READ; - -#endif // def INCLUDE_SMB_READ_WRITE - -#ifdef INCLUDE_SMB_READ_WRITE - -// -// Read and X SMB, see #2 page 56 -// Function is SrvSmbReadAndX() -// SMB_COM_READ_ANDX 0x2E -// - -typedef struct _REQ_READ_ANDX { - UCHAR WordCount; // Count of parameter words = 10 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( Fid ); // File handle - _ULONG( Offset ); // Offset in file to begin read - _USHORT( MaxCount ); // Max number of bytes to return - _USHORT( MinCount ); // Min number of bytes to return - _ULONG( Timeout ); - _USHORT( Remaining ); // Bytes remaining to satisfy request - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_READ_ANDX; -typedef REQ_READ_ANDX SMB_UNALIGNED *PREQ_READ_ANDX; - -typedef struct _REQ_NT_READ_ANDX { - UCHAR WordCount; // Count of parameter words = 12 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( Fid ); // File handle - _ULONG( Offset ); // Offset in file to begin read - _USHORT( MaxCount ); // Max number of bytes to return - _USHORT( MinCount ); // Min number of bytes to return - union { - _ULONG( Timeout ); - _USHORT( MaxCountHigh ); // upper 16 bits of MaxCount if NT request - }; - _USHORT( Remaining ); // Bytes remaining to satisfy request - _ULONG( OffsetHigh ); // Used for NT Protocol only - // Upper 32 bits of offset - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_NT_READ_ANDX; -typedef REQ_NT_READ_ANDX SMB_UNALIGNED *PREQ_NT_READ_ANDX; - -typedef struct _RESP_READ_ANDX { - UCHAR WordCount; // Count of parameter words = 12 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( Remaining ); // Bytes remaining to be read - _USHORT( DataCompactionMode ); - _USHORT( Reserved ); // Reserved (must be 0) - _USHORT( DataLength ); // Number of data bytes (min = 0) - _USHORT( DataOffset ); // Offset (from header start) to data - union { - _USHORT( Reserved2 ); // Reserved (must be 0) - _USHORT( DataLengthHigh ); // upper 16 bits of DataLength if NT request - }; - _ULONG( Reserved3 )[2]; // Reserved (must be 0) - _USHORT( ByteCount ); // Count of data bytes. Inaccurate if we - // are doing large Read&X's! - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data (size = DataLength) -} RESP_READ_ANDX; -typedef RESP_READ_ANDX SMB_UNALIGNED *PRESP_READ_ANDX; - -#endif // def INCLUDE_SMB_READ_WRITE - -#ifdef INCLUDE_SMB_MPX - -// -// Read Block Multiplexed SMB, see #2 page 58 -// Function is SrvSmbReadMpx() -// SMB_COM_READ_MPX 0x1B -// SMB_COM_READ_MPX_SECONDARY 0x1C -// - -typedef struct _REQ_READ_MPX { - UCHAR WordCount; // Count of parameter words = 8 - _USHORT( Fid ); // File handle - _ULONG( Offset ); // Offset in file to begin read - _USHORT( MaxCount ); // Max bytes to return (max 65535) - _USHORT( MinCount ); // Min bytes to return (normally 0) - _ULONG( Timeout ); - _USHORT( Reserved ); - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_READ_MPX; -typedef REQ_READ_MPX SMB_UNALIGNED *PREQ_READ_MPX; - -typedef struct _RESP_READ_MPX { - UCHAR WordCount; // Count of parameter words = 8 - _ULONG( Offset ); // Offset in file where data read - _USHORT( Count ); // Total bytes being returned - _USHORT( Remaining ); // Bytes remaining to be read (pipe/dev) - _USHORT( DataCompactionMode ); - _USHORT( Reserved ); - _USHORT( DataLength ); // Number of data bytes this buffer - _USHORT( DataOffset ); // Offset (from header start) to data - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data (size = DataLength) -} RESP_READ_MPX; -typedef RESP_READ_MPX SMB_UNALIGNED *PRESP_READ_MPX; - -#endif // def INCLUDE_SMB_MPX - -#ifdef INCLUDE_SMB_RAW - -// -// Read Block Raw SMB, see #2 page 61 -// Function is SrvSmbReadRaw() -// SMB_COM_READ_RAW 0x1A -// - -typedef struct _REQ_READ_RAW { - UCHAR WordCount; // Count of parameter words = 8 - _USHORT( Fid ); // File handle - _ULONG( Offset ); // Offset in file to begin read - _USHORT( MaxCount ); // Max bytes to return (max 65535) - _USHORT( MinCount ); // Min bytes to return (normally 0) - _ULONG( Timeout ); - _USHORT( Reserved ); - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_READ_RAW; -typedef REQ_READ_RAW SMB_UNALIGNED *PREQ_READ_RAW; - -typedef struct _REQ_NT_READ_RAW { - UCHAR WordCount; // Count of parameter words = 10 - _USHORT( Fid ); // File handle - _ULONG( Offset ); // Offset in file to begin read - _USHORT( MaxCount ); // Max bytes to return (max 65535) - _USHORT( MinCount ); // Min bytes to return (normally 0) - _ULONG( Timeout ); - _USHORT( Reserved ); - _ULONG( OffsetHigh ); // Used for NT Protocol only - // Upper 32 bits of offset - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_NT_READ_RAW; -typedef REQ_NT_READ_RAW SMB_UNALIGNED *PREQ_NT_READ_RAW; - -// No response params for raw read--the response is the raw data. - -#endif // def INCLUDE_SMB_RAW - -#ifdef INCLUDE_SMB_FILE_CONTROL - -// -// Rename SMB, see #1 page 17 -// Function is SrvSmbRename() -// SMB_COM_RENAME 0x07 -// - -typedef struct _REQ_RENAME { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( SearchAttributes ); - _USHORT( ByteCount ); // Count of data bytes; min = 4 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat1; // 0x04 -- ASCII - //UCHAR OldFileName[]; // Old file name - //UCHAR BufferFormat2; // 0x04 -- ASCII - //UCHAR NewFileName[]; // New file name -} REQ_RENAME; -typedef REQ_RENAME SMB_UNALIGNED *PREQ_RENAME; - - -// -// Extended NT rename SMB -// Function is SrvSmbRename() -// SMB_COM_NT_RENAME 0xA5 -// - -typedef struct _REQ_NTRENAME { - UCHAR WordCount; // Count of parameter words = 4 - _USHORT( SearchAttributes ); - _USHORT( InformationLevel ); - _ULONG( ClusterCount ); - _USHORT( ByteCount ); // Count of data bytes; min = 4 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat1; // 0x04 -- ASCII - //UCHAR OldFileName[]; // Old file name - //UCHAR BufferFormat2; // 0x04 -- ASCII - //UCHAR NewFileName[]; // New file name -} REQ_NTRENAME; -typedef REQ_NTRENAME SMB_UNALIGNED *PREQ_NTRENAME; - -typedef struct _RESP_RENAME { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_RENAME; -typedef RESP_RENAME SMB_UNALIGNED *PRESP_RENAME; - -#endif // def INCLUDE_SMB_FILE_CONTROL - -#ifdef INCLUDE_SMB_SEARCH - -// -// Search SMBs. One structure is common for both the core Search and the -// LAN Manager 1.0 Find First/Next/Close. -// -// Function is SrvSmbSearch() -// -// Search, see #1 page 26 -// SMB_COM_SEARCH 0x81 -// FindFirst and FindNext, see #2 page 27 -// SMB_COM_FIND 0x82 -// FindUnique, see #2 page 33 -// SMB_COM_FIND_UNIQUE 0x83 -// FindClose, see #2 page 31 -// SMB_COM_FIND_CLOSE 0x84 -// - -typedef struct _REQ_SEARCH { - UCHAR WordCount; // Count of parameter words = 2 - _USHORT( MaxCount ); // Number of dir. entries to return - _USHORT( SearchAttributes ); - _USHORT( ByteCount ); // Count of data bytes; min = 5 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat1; // 0x04 -- ASCII - //UCHAR FileName[]; // File name, may be null - //UCHAR BufferFormat2; // 0x05 -- Variable block - //USHORT ResumeKeyLength; // Length of resume key, may be 0 - //UCHAR SearchStatus[]; // Resume key -} REQ_SEARCH; -typedef REQ_SEARCH SMB_UNALIGNED *PREQ_SEARCH; - -typedef struct _RESP_SEARCH { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Count ); // Number of entries returned - _USHORT( ByteCount ); // Count of data bytes; min = 3 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x05 -- Variable block - //USHORT DataLength; // Length of data - //UCHAR Data[]; // Data -} RESP_SEARCH; -typedef RESP_SEARCH SMB_UNALIGNED *PRESP_SEARCH; - -// -// These two structures are use to return information in the Search SMBs. -// SMB_DIRECTORY_INFORMATION is used to return information about a file -// that was found. In addition to the usual information about the file, -// each of these structures contains an SMB_RESUME_KEY, which is used to -// continue or rewind a search. -// -// These structures must be packed, so turn on packing if it isn't -// already on. -// - -#ifdef NO_PACKING -#include -#endif // def NO_PACKING - -typedef struct _SMB_RESUME_KEY { - UCHAR Reserved; // bit 7 - comsumer use - // bits 5,6 - system use (must preserve) - // bits 0-4 - server use (must preserve) - UCHAR FileName[11]; - UCHAR Sid; // Uniquely identifies Find through Close - _ULONG( FileIndex ); // Reserved for server use - UCHAR Consumer[4]; // Reserved for comsumer use -} SMB_RESUME_KEY; -typedef SMB_RESUME_KEY SMB_UNALIGNED *PSMB_RESUME_KEY; - -typedef struct _SMB_DIRECTORY_INFORMATION { - SMB_RESUME_KEY ResumeKey; - UCHAR FileAttributes; - SMB_TIME LastWriteTime; - SMB_DATE LastWriteDate; - _ULONG( FileSize ); - UCHAR FileName[13]; // ASCII, space-filled null terminated -} SMB_DIRECTORY_INFORMATION; -typedef SMB_DIRECTORY_INFORMATION SMB_UNALIGNED *PSMB_DIRECTORY_INFORMATION; - -#ifdef NO_PACKING -#include -#endif // def NO_PACKING - -#endif // def INCLUDE_SMB_SEARCH - -#ifdef INCLUDE_SMB_READ_WRITE - -// -// Seek SMB, see #1 page 14 -// Function is SrvSmbSeek -// SMB_COM_SEEK 0x12 -// - -typedef struct _REQ_SEEK { - UCHAR WordCount; // Count of parameter words = 4 - _USHORT( Fid ); // File handle - _USHORT( Mode ); // Seek mode: - // 0 = from start of file - // 1 = from current position - // 2 = from end of file - _ULONG( Offset ); // Relative offset - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_SEEK; -typedef REQ_SEEK SMB_UNALIGNED *PREQ_SEEK; - -typedef struct _RESP_SEEK { - UCHAR WordCount; // Count of parameter words = 2 - _ULONG( Offset ); // Offset from start of file - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_SEEK; -typedef RESP_SEEK SMB_UNALIGNED *PRESP_SEEK; - -#endif // def INCLUDE_SMB_READ_WRITE - -#ifdef INCLUDE_SMB_MESSAGE - -// -// Send Broadcast Message SMB, see #1 page 32 -// Function is SrvSmbSendBroadcastMessage() -// SMB_COM_SEND_BROADCAST_MESSAGE 0xD1 -// - -typedef struct _REQ_SEND_BROADCAST_MESSAGE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes; min = 8 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat1; // 0x04 -- ASCII - //UCHAR OriginatorName[]; // Originator name (max = 15) - //UCHAR BufferFormat2; // 0x04 -- ASCII - //UCHAR DestinationName[]; // "*" - //UCHAR BufferFormat3; // 0x01 -- Data block - //USHORT DataLength; // Length of message; max = 128 - //UCHAR Data[]; // Message -} REQ_SEND_BROADCAST_MESSAGE; -typedef REQ_SEND_BROADCAST_MESSAGE SMB_UNALIGNED *PREQ_SEND_BROADCAST_MESSAGE; - -// No response for Send Broadcast Message - -#endif // def INCLUDE_SMB_MESSAGE - -#ifdef INCLUDE_SMB_MESSAGE - -// -// Send End of Multi-block Message SMB, see #1 page 33 -// Function is SrvSmbSendEndMbMessage() -// SMB_COM_SEND_END_MB_MESSAGE 0xD6 -// - -typedef struct _REQ_SEND_END_MB_MESSAGE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( MessageGroupId ); - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_SEND_END_MB_MESSAGE; -typedef REQ_SEND_END_MB_MESSAGE SMB_UNALIGNED *PREQ_SEND_END_MB_MESSAGE; - -typedef struct _RESP_SEND_END_MB_MESSAGE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_SEND_END_MB_MESSAGE; -typedef RESP_SEND_END_MB_MESSAGE SMB_UNALIGNED *PRESP_SEND_END_MB_MESSAGE; - -#endif // def INCLUDE_SMB_MESSAGE - -#ifdef INCLUDE_SMB_MESSAGE - -// -// Send Single Block Message SMB, see #1 page 31 -// Function is SrvSmbSendMessage() -// SMB_COM_SEND_MESSAGE 0xD0 -// - -typedef struct _REQ_SEND_MESSAGE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes; min = 7 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat1; // 0x04 -- ASCII - //UCHAR OriginatorName[]; // Originator name (max = 15) - //UCHAR BufferFormat2; // 0x04 -- ASCII - //UCHAR DestinationName[]; // Destination name (max = 15) - //UCHAR BufferFormat3; // 0x01 -- Data block - //USHORT DataLength; // Length of message; max = 128 - //UCHAR Data[]; // Message -} REQ_SEND_MESSAGE; -typedef REQ_SEND_MESSAGE SMB_UNALIGNED *PREQ_SEND_MESSAGE; - -typedef struct _RESP_SEND_MESSAGE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_SEND_MESSAGE; -typedef RESP_SEND_MESSAGE SMB_UNALIGNED *PRESP_SEND_MESSAGE; - -#endif // def INCLUDE_SMB_MESSAGE - -#ifdef INCLUDE_SMB_MESSAGE - -// -// Send Start of Multi-block Message SMB, see #1 page 32 -// Function is SrvSmbSendStartMbMessage() -// SMB_COM_SEND_START_MB_MESSAGE 0xD5 -// - -typedef struct _REQ_SEND_START_MB_MESSAGE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes; min = 0 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat1; // 0x04 -- ASCII - //UCHAR OriginatorName[]; // Originator name (max = 15) - //UCHAR BufferFormat2; // 0x04 -- ASCII - //UCHAR DestinationName[]; // Destination name (max = 15) -} REQ_SEND_START_MB_MESSAGE; -typedef REQ_SEND_START_MB_MESSAGE SMB_UNALIGNED *PREQ_SEND_START_MB_MESSAGE; - -typedef struct _RESP_SEND_START_MB_MESSAGE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( MessageGroupId ); - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_SEND_START_MB_MESSAGE; -typedef RESP_SEND_START_MB_MESSAGE SMB_UNALIGNED *PSEND_START_MB_MESSAGE; - -#endif // def INCLUDE_SMB_MESSAGE - -#ifdef INCLUDE_SMB_MESSAGE - -// -// Send Text of Multi-block Message SMB, see #1 page 33 -// Function is SrvSmbSendTextMbMessage() -// SMB_COM_SEND_TEXT_MB_MESSAGE 0xD7 -// - -typedef struct _REQ_SEND_TEXT_MB_MESSAGE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( MessageGroupId ); - _USHORT( ByteCount ); // Count of data bytes; min = 3 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x01 -- Data block - //USHORT DataLength; // Length of message; max = 128 - //UCHAR Data[]; // Message -} REQ_SEND_TEXT_MB_MESSAGE; -typedef REQ_SEND_TEXT_MB_MESSAGE SMB_UNALIGNED *PREQ_SEND_TEXT_MB_MESSAGE; - -typedef struct _RESP_SEND_TEXT_MB_MESSAGE { - UCHAR WordCount; // Count of aprameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_SEND_TEXT_MB_MESSAGE; -typedef RESP_SEND_TEXT_MB_MESSAGE SMB_UNALIGNED *PRESP_SEND_TEXT_MB_MESSAGE; - -#endif // def INCLUDE_SMB_MESSAGE - -#ifdef INCLUDE_SMB_ADMIN - -// -// Session Setup and X SMB, see #2 page 63 and #3 page 10 -// Function is SrvSmbSessionSetupAndX() -// SMB_COM_SESSION_SETUP_ANDX 0x73 -// - -typedef struct _REQ_SESSION_SETUP_ANDX { - UCHAR WordCount; // Count of parameter words = 10 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( MaxBufferSize ); // Consumer's maximum buffer size - _USHORT( MaxMpxCount ); // Actual maximum multiplexed pending requests - _USHORT( VcNumber ); // 0 = first (only), nonzero=additional VC number - _ULONG( SessionKey ); // Session key (valid iff VcNumber != 0) - _USHORT( PasswordLength ); // Account password size - _ULONG( Reserved ); - _USHORT( ByteCount ); // Count of data bytes; min = 0 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR AccountPassword[]; // Account Password - //UCHAR AccountName[]; // Account Name - //UCHAR PrimaryDomain[]; // Client's primary domain - //UCHAR NativeOS[]; // Client's native operating system - //UCHAR NativeLanMan[]; // Client's native LAN Manager type -} REQ_SESSION_SETUP_ANDX; -typedef REQ_SESSION_SETUP_ANDX SMB_UNALIGNED *PREQ_SESSION_SETUP_ANDX; - -typedef struct _REQ_NT_SESSION_SETUP_ANDX { - UCHAR WordCount; // Count of parameter words = 13 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( MaxBufferSize ); // Consumer's maximum buffer size - _USHORT( MaxMpxCount ); // Actual maximum multiplexed pending requests - _USHORT( VcNumber ); // 0 = first (only), nonzero=additional VC number - _ULONG( SessionKey ); // Session key (valid iff VcNumber != 0) - _USHORT( CaseInsensitivePasswordLength ); // Account password size, ANSI - _USHORT( CaseSensitivePasswordLength ); // Account password size, Unicode - _ULONG( Reserved); - _ULONG( Capabilities ); // Client capabilities - _USHORT( ByteCount ); // Count of data bytes; min = 0 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR CaseInsensitivePassword[]; // Account Password, ANSI - //UCHAR CaseSensitivePassword[]; // Account Password, Unicode - //UCHAR AccountName[]; // Account Name - //UCHAR PrimaryDomain[]; // Client's primary domain - //UCHAR NativeOS[]; // Client's native operating system - //UCHAR NativeLanMan[]; // Client's native LAN Manager type -} REQ_NT_SESSION_SETUP_ANDX; -typedef REQ_NT_SESSION_SETUP_ANDX SMB_UNALIGNED *PREQ_NT_SESSION_SETUP_ANDX; - -// -// Action flags in the response -// -#define SMB_SETUP_GUEST 0x0001 // Session setup as a guest -#define SMB_SETUP_USE_LANMAN_KEY 0x0002 // Use the Lan Manager setup key. - -typedef struct _RESP_SESSION_SETUP_ANDX { - UCHAR WordCount; // Count of parameter words = 3 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( Action ); // Request mode: - // bit0 = logged in as GUEST - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR NativeOS[]; // Server's native operating system - //UCHAR NativeLanMan[]; // Server's native LAN Manager type - //UCHAR PrimaryDomain[]; // Server's primary domain -} RESP_SESSION_SETUP_ANDX; -typedef RESP_SESSION_SETUP_ANDX SMB_UNALIGNED *PRESP_SESSION_SETUP_ANDX; - -#endif // def INCLUDE_SMB_ADMIN - -#ifdef INCLUDE_SMB_QUERY_SET - -// -// Set Information SMB, see #1 page 19 -// Function is SrvSmbSetInformation() -// SMB_COM_SET_INFORMATION 0x09 -// - -typedef struct _REQ_SET_INFORMATION { - UCHAR WordCount; // Count of parameter words = 8 - _USHORT( FileAttributes ); - _ULONG( LastWriteTimeInSeconds ); - _USHORT( Reserved )[5]; // Reserved (must be 0) - _USHORT( ByteCount ); // Count of data bytes; min = 2 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x04 -- ASCII - //UCHAR FileName[]; // File name -} REQ_SET_INFORMATION; -typedef REQ_SET_INFORMATION SMB_UNALIGNED *PREQ_SET_INFORMATION; - -typedef struct _RESP_SET_INFORMATION { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_SET_INFORMATION; -typedef RESP_SET_INFORMATION SMB_UNALIGNED *PRESP_SET_INFORMATION; - -#endif // def INCLUDE_SMB_QUERY_SET - -#ifdef INCLUDE_SMB_QUERY_SET - -// -// Set Information2 SMB, see #2 page 66 -// Function is SrvSmbSetInformation2 -// SMB_COM_SET_INFORMATION2 0x22 -// - -typedef struct _REQ_SET_INFORMATION2 { - UCHAR WordCount; // Count of parameter words = 7 - _USHORT( Fid ); // File handle - SMB_DATE CreationDate; - SMB_TIME CreationTime; - SMB_DATE LastAccessDate; - SMB_TIME LastAccessTime; - SMB_DATE LastWriteDate; - SMB_TIME LastWriteTime; - _USHORT( ByteCount ); // Count of data bytes; min = 0 - UCHAR Buffer[1]; // Reserved buffer -} REQ_SET_INFORMATION2; -typedef REQ_SET_INFORMATION2 SMB_UNALIGNED *PREQ_SET_INFORMATION2; - -typedef struct _RESP_SET_INFORMATION2 { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_SET_INFORMATION2; -typedef RESP_SET_INFORMATION2 SMB_UNALIGNED *PRESP_SET_INFORMATION2; - -#endif // def INCLUDE_SMB_QUERY_SET - -#ifdef INCLUDE_SMB_TRANSACTION - -// -// Transaction and Transaction2 SMBs, see #2 page 68 and #3 page 13 -// Function is SrvSmbTransaction() -// SMB_COM_TRANSACTION 0x25 -// SMB_COM_TRANSACTION_SECONDARY 0x26 -// SMB_COM_TRANSACTION2 0x32 -// SMB_COM_TRANSACTION2_SECONDARY 0x33 -// -// Structures for specific transaction types are defined in smbtrans.h. -// -// *** The Transaction2 secondary request format includes a USHORT Fid -// field that we ignore. We can do this because the Fid field -// occurs at the end of the word parameters part of the request, and -// because the rest of the request (parameter and data bytes) is -// pointed by offset fields occurring prior to the Fid field. (The -// Fid field was added to speed up dispatching in the OS/2 server, -// in which different worker processes handle each Fid. The NT -// server has only one process.) -// - -typedef struct _REQ_TRANSACTION { - UCHAR WordCount; // Count of parameter words; value = (14 + SetupCount) - _USHORT( TotalParameterCount ); // Total parameter bytes being sent - _USHORT( TotalDataCount ); // Total data bytes being sent - _USHORT( MaxParameterCount ); // Max parameter bytes to return - _USHORT( MaxDataCount ); // Max data bytes to return - UCHAR MaxSetupCount; // Max setup words to return - UCHAR Reserved; - _USHORT( Flags ); // Additional information: - // bit 0 - also disconnect TID in Tid - // bit 1 - one-way transacion (no resp) - _ULONG( Timeout ); - _USHORT( Reserved2 ); - _USHORT( ParameterCount ); // Parameter bytes sent this buffer - _USHORT( ParameterOffset ); // Offset (from header start) to params - _USHORT( DataCount ); // Data bytes sent this buffer - _USHORT( DataOffset ); // Offset (from header start) to data - UCHAR SetupCount; // Count of setup words - UCHAR Reserved3; // Reserved (pad above to word) - UCHAR Buffer[1]; // Buffer containing: - //USHORT Setup[]; // Setup words (# = SetupWordCount) - //USHORT ByteCount; // Count of data bytes - //UCHAR Name[]; // Name of transaction (NULL if Transact2) - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount) - //UCHAR Pad1[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data bytes (# = DataCount) -} REQ_TRANSACTION; -typedef REQ_TRANSACTION SMB_UNALIGNED *PREQ_TRANSACTION; - -#define SMB_TRANSACTION_DISCONNECT 1 -#define SMB_TRANSACTION_NO_RESPONSE 2 -#define SMB_TRANSACTION_RECONNECTING 4 -#define SMB_TRANSACTION_DFSFILE 8 - -typedef struct _RESP_TRANSACTION_INTERIM { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_TRANSACTION_INTERIM; -typedef RESP_TRANSACTION_INTERIM SMB_UNALIGNED *PRESP_TRANSACTION_INTERIM; - -typedef struct _REQ_TRANSACTION_SECONDARY { - UCHAR WordCount; // Count of parameter words = 8 - _USHORT( TotalParameterCount ); // Total parameter bytes being sent - _USHORT( TotalDataCount ); // Total data bytes being sent - _USHORT( ParameterCount ); // Parameter bytes sent this buffer - _USHORT( ParameterOffset ); // Offset (from header start) to params - _USHORT( ParameterDisplacement ); // Displacement of these param bytes - _USHORT( DataCount ); // Data bytes sent this buffer - _USHORT( DataOffset ); // Offset (from header start) to data - _USHORT( DataDisplacement ); // Displacement of these data bytes - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount) - //UCHAR Pad1[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data bytes (# = DataCount) -} REQ_TRANSACTION_SECONDARY; -typedef REQ_TRANSACTION_SECONDARY SMB_UNALIGNED *PREQ_TRANSACTION_SECONDARY; - -typedef struct _RESP_TRANSACTION { - UCHAR WordCount; // Count of data bytes; value = 10 + SetupCount - _USHORT( TotalParameterCount ); // Total parameter bytes being sent - _USHORT( TotalDataCount ); // Total data bytes being sent - _USHORT( Reserved ); - _USHORT( ParameterCount ); // Parameter bytes sent this buffer - _USHORT( ParameterOffset ); // Offset (from header start) to params - _USHORT( ParameterDisplacement ); // Displacement of these param bytes - _USHORT( DataCount ); // Data bytes sent this buffer - _USHORT( DataOffset ); // Offset (from header start) to data - _USHORT( DataDisplacement ); // Displacement of these data bytes - UCHAR SetupCount; // Count of setup words - UCHAR Reserved2; // Reserved (pad above to word) - UCHAR Buffer[1]; // Buffer containing: - //USHORT Setup[]; // Setup words (# = SetupWordCount) - //USHORT ByteCount; // Count of data bytes - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount) - //UCHAR Pad1[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data bytes (# = DataCount) -} RESP_TRANSACTION; -typedef RESP_TRANSACTION SMB_UNALIGNED *PRESP_TRANSACTION; - -typedef struct _REQ_NT_TRANSACTION { - UCHAR WordCount; // Count of parameter words; value = (19 + SetupCount) - UCHAR MaxSetupCount; // Max setup words to return - _USHORT( Flags ); // Currently unused - _ULONG( TotalParameterCount ); // Total parameter bytes being sent - _ULONG( TotalDataCount ); // Total data bytes being sent - _ULONG( MaxParameterCount ); // Max parameter bytes to return - _ULONG( MaxDataCount ); // Max data bytes to return - _ULONG( ParameterCount ); // Parameter bytes sent this buffer - _ULONG( ParameterOffset ); // Offset (from header start) to params - _ULONG( DataCount ); // Data bytes sent this buffer - _ULONG( DataOffset ); // Offset (from header start) to data - UCHAR SetupCount; // Count of setup words - _USHORT( Function ); // The transaction function code - UCHAR Buffer[1]; - //USHORT Setup[]; // Setup words (# = SetupWordCount) - //USHORT ByteCount; // Count of data bytes - //UCHAR Pad1[]; // Pad to LONG - //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount) - //UCHAR Pad2[]; // Pad to LONG - //UCHAR Data[]; // Data bytes (# = DataCount) -} REQ_NT_TRANSACTION; -typedef REQ_NT_TRANSACTION SMB_UNALIGNED *PREQ_NT_TRANSACTION; - -#define SMB_TRANSACTION_DISCONNECT 1 -#define SMB_TRANSACTION_NO_RESPONSE 2 - -typedef struct _RESP_NT_TRANSACTION_INTERIM { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; -} RESP_NT_TRANSACTION_INTERIM; -typedef RESP_NT_TRANSACTION_INTERIM SMB_UNALIGNED *PRESP_NT_TRANSACTION_INTERIM; - -typedef struct _REQ_NT_TRANSACTION_SECONDARY { - UCHAR WordCount; // Count of parameter words = 18 - UCHAR Reserved1; // MBZ - _USHORT( Reserved2 ); // MBZ - _ULONG( TotalParameterCount ); // Total parameter bytes being sent - _ULONG( TotalDataCount ); // Total data bytes being sent - _ULONG( ParameterCount ); // Parameter bytes sent this buffer - _ULONG( ParameterOffset ); // Offset (from header start) to params - _ULONG( ParameterDisplacement ); // Displacement of these param bytes - _ULONG( DataCount ); // Data bytes sent this buffer - _ULONG( DataOffset ); // Offset (from header start) to data - _ULONG( DataDisplacement ); // Displacement of these data bytes - UCHAR Reserved3; - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; - //UCHAR Pad1[]; // Pad to LONG - //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount) - //UCHAR Pad2[]; // Pad to LONG - //UCHAR Data[]; // Data bytes (# = DataCount) -} REQ_NT_TRANSACTION_SECONDARY; -typedef REQ_NT_TRANSACTION_SECONDARY SMB_UNALIGNED *PREQ_NT_TRANSACTION_SECONDARY; - -typedef struct _RESP_NT_TRANSACTION { - UCHAR WordCount; // Count of data bytes; value = 18 + SetupCount - UCHAR Reserved1; - _USHORT( Reserved2 ); - _ULONG( TotalParameterCount ); // Total parameter bytes being sent - _ULONG( TotalDataCount ); // Total data bytes being sent - _ULONG( ParameterCount ); // Parameter bytes sent this buffer - _ULONG( ParameterOffset ); // Offset (from header start) to params - _ULONG( ParameterDisplacement ); // Displacement of these param bytes - _ULONG( DataCount ); // Data bytes sent this buffer - _ULONG( DataOffset ); // Offset (from header start) to data - _ULONG( DataDisplacement ); // Displacement of these data bytes - UCHAR SetupCount; // Count of setup words - UCHAR Buffer[1]; - //USHORT Setup[]; // Setup words (# = SetupWordCount) - //USHORT ByteCount; // Count of data bytes - //UCHAR Pad1[]; // Pad to LONG - //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount) - //UCHAR Pad2[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data bytes (# = DataCount) -} RESP_NT_TRANSACTION; -typedef RESP_NT_TRANSACTION SMB_UNALIGNED *PRESP_NT_TRANSACTION; - -#endif // def INCLUDE_SMB_TRANSACTION - -#ifdef INCLUDE_SMB_TREE - -// -// Tree Connect SMB, see #1, page 6 -// Function is SrvSmbTreeConnect() -// SMB_COM_TREE_CONNECT 0x70 -// - -typedef struct _REQ_TREE_CONNECT { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes; min = 4 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat1; // 0x04 -- ASCII - //UCHAR Path[]; // Server name and share name - //UCHAR BufferFormat2; // 0x04 -- ASCII - //UCHAR Password[]; // Password - //UCHAR BufferFormat3; // 0x04 -- ASCII - //UCHAR Service[]; // Service name -} REQ_TREE_CONNECT; -typedef REQ_TREE_CONNECT SMB_UNALIGNED *PREQ_TREE_CONNECT; - -typedef struct _RESP_TREE_CONNECT { - UCHAR WordCount; // Count of parameter words = 2 - _USHORT( MaxBufferSize ); // Max size message the server handles - _USHORT( Tid ); // Tree ID - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_TREE_CONNECT; -typedef RESP_TREE_CONNECT SMB_UNALIGNED *PRESP_TREE_CONNECT; - -#endif // def INCLUDE_SMB_TREE - -#ifdef INCLUDE_SMB_TREE - -// -// Tree Connect and X SMB, see #2, page 88 -// Function is SrvSmbTreeConnectAndX() -// SMB_COM_TREE_CONNECT_ANDX 0x75 -// -// TREE_CONNECT_ANDX flags - -#define TREE_CONNECT_ANDX_DISCONNECT_TID (0x1) -// #define TREE_CONNECT_ANDX_W95 (0x2) -- W95 sets this flag. Don't know why. - -typedef struct _REQ_TREE_CONNECT_ANDX { - UCHAR WordCount; // Count of parameter words = 4 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( Flags ); // Additional information - // bit 0 set = disconnect Tid - // bit 7 set = extended response - _USHORT( PasswordLength ); // Length of Password[] - _USHORT( ByteCount ); // Count of data bytes; min = 3 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Password[]; // Password - //UCHAR Path[]; // Server name and share name - //UCHAR Service[]; // Service name -} REQ_TREE_CONNECT_ANDX; -typedef REQ_TREE_CONNECT_ANDX SMB_UNALIGNED *PREQ_TREE_CONNECT_ANDX; - -typedef struct _RESP_TREE_CONNECT_ANDX { - UCHAR WordCount; // Count of parameter words = 2 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( ByteCount ); // Count of data bytes; min = 3 - UCHAR Buffer[1]; // Service type connected to -} RESP_TREE_CONNECT_ANDX; -typedef RESP_TREE_CONNECT_ANDX SMB_UNALIGNED *PRESP_TREE_CONNECT_ANDX; - -// -// The response for clients that are LAN Manager 2.1 or better. -// - -typedef struct _RESP_21_TREE_CONNECT_ANDX { - UCHAR WordCount; // Count of parameter words = 3 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( OptionalSupport ); // Optional support bits - _USHORT( ByteCount ); // Count of data bytes; min = 3 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Service[]; // Service type connected to - //UCHAR NativeFileSystem[]; // Native file system for this tree -} RESP_21_TREE_CONNECT_ANDX; -typedef RESP_21_TREE_CONNECT_ANDX SMB_UNALIGNED *PRESP_21_TREE_CONNECT_ANDX; - -// -// Optional Support bit definitions -// -#define SMB_SUPPORT_SEARCH_BITS 0x0001 -#define SMB_SHARE_IS_IN_DFS 0x0002 - -#endif // def INCLUDE_SMB_TREE - -#ifdef INCLUDE_SMB_TREE - -// -// Tree Disconnect SMB, see #1 page 7 -// Function is SrvSmbTreeDisconnect() -// SMB_COM_TREE_DISCONNECT 0x71 -// - -typedef struct _REQ_TREE_DISCONNECT { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_TREE_DISCONNECT; -typedef REQ_TREE_DISCONNECT SMB_UNALIGNED *PREQ_TREE_DISCONNECT; - -typedef struct _RESP_TREE_DISCONNECT { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_TREE_DISCONNECT; -typedef RESP_TREE_DISCONNECT SMB_UNALIGNED *PRESP_TREE_DISCONNECT; - -#endif // def INCLUDE_SMB_TREE - -#ifdef INCLUDE_SMB_LOCK - -// -// Unlock Byte Range SMB, see #1 page 20 -// Function is SrvSmbUnlockByteRange() -// SMB_COM_UNLOCK_BYTE_RANGE 0x0D -// - -typedef struct _REQ_UNLOCK_BYTE_RANGE { - UCHAR WordCount; // Count of parameter words = 5 - _USHORT( Fid ); // File handle - _ULONG( Count ); // Count of bytes to unlock - _ULONG( Offset ); // Offset from start of file - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} REQ_UNLOCK_BYTE_RANGE; -typedef REQ_UNLOCK_BYTE_RANGE SMB_UNALIGNED *PREQ_UNLOCK_BYTE_RANGE; - -typedef struct _RESP_UNLOCK_BYTE_RANGE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_UNLOCK_BYTE_RANGE; -typedef RESP_UNLOCK_BYTE_RANGE SMB_UNALIGNED *PRESP_UNLOCK_BYTE_RANGE; - -#endif // def INCLUDE_SMB_LOCK - -#ifdef INCLUDE_SMB_READ_WRITE - -// -// Write SMB, see #1 page 12 -// Write and Unlock SMB, see #2 page 92 -// Function is SrvSmbWrite() -// SMB_COM_WRITE 0x0B -// SMB_COM_WRITE_AND_UNLOCK 0x14 -// - -// -// *** Warning: the following structure is defined the way it is to -// ensure longword alignment of the data buffer. (This only matters -// when packing is disabled; when packing is turned on, the right -// thing happens no matter what.) -// - -typedef struct _REQ_WRITE { - UCHAR WordCount; // Count of parameter words = 5 - _USHORT( Fid ); // File handle - _USHORT( Count ); // Number of bytes to be written - _ULONG( Offset ); // Offset in file to begin write - _USHORT( Remaining ); // Bytes remaining to satisfy request - _USHORT( ByteCount ); // Count of data bytes - //UCHAR Buffer[1]; // Buffer containing: - UCHAR BufferFormat; // 0x01 -- Data block - _USHORT( DataLength ); // Length of data - ULONG Buffer[1]; // Data -} REQ_WRITE; -typedef REQ_WRITE SMB_UNALIGNED *PREQ_WRITE; - -typedef struct _RESP_WRITE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Count ); // Count of bytes actually written - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_WRITE; -typedef RESP_WRITE SMB_UNALIGNED *PRESP_WRITE; - -#endif // def INCLUDE_SMB_READ_WRITE - -#ifdef INCLUDE_SMB_READ_WRITE - -// -// Write and Close SMB, see #2 page 90 -// Function is SrvSmbWriteAndClose() -// SMB_COM_WRITE_AND_CLOSE 0x2C -// - -// -// The Write and Close parameters can be 6 words long or 12 words long, -// depending on whether it's supposed to look like a Write SMB or a -// Write and X SMB. So we define two different structures here. -// -// *** Warning: the following structures are defined the way they are to -// ensure longword alignment of the data buffer. (This only matters -// when packing is disabled; when packing is turned on, the right -// thing happens no matter what.) -// - -typedef struct _REQ_WRITE_AND_CLOSE { - UCHAR WordCount; // Count of parameter words = 6 - _USHORT( Fid ); // File handle - _USHORT( Count ); // Number of bytes to write - _ULONG( Offset ); // Offset in file of first byte to write - _ULONG( LastWriteTimeInSeconds ); // Time of last write - _USHORT( ByteCount ); // 1 (for pad) + value of Count - UCHAR Pad; // To force to doubleword boundary - ULONG Buffer[1]; // Data -} REQ_WRITE_AND_CLOSE; -typedef REQ_WRITE_AND_CLOSE SMB_UNALIGNED *PREQ_WRITE_AND_CLOSE; - -typedef struct _REQ_WRITE_AND_CLOSE_LONG { - UCHAR WordCount; // Count of parameter words = 12 - _USHORT( Fid ); // File handle - _USHORT( Count ); // Number of bytes to write - _ULONG( Offset ); // Offset in file of first byte to write - _ULONG( LastWriteTimeInSeconds ); // Time of last write - _ULONG( Reserved )[3]; // Reserved, must be 0 - _USHORT( ByteCount ); // 1 (for pad) + value of Count - UCHAR Pad; // To force to doubleword boundary - ULONG Buffer[1]; // Data -} REQ_WRITE_AND_CLOSE_LONG; -typedef REQ_WRITE_AND_CLOSE_LONG SMB_UNALIGNED *PREQ_WRITE_AND_CLOSE_LONG; - -typedef struct _RESP_WRITE_AND_CLOSE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Count ); // Count of bytes actually written - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_WRITE_AND_CLOSE; -typedef RESP_WRITE_AND_CLOSE SMB_UNALIGNED *PRESP_WRITE_AND_CLOSE; - -#endif // def INCLUDE_SMB_READ_WRITE - -#ifdef INCLUDE_SMB_READ_WRITE - -// -// Write and X SMB, see #2 page 94 -// Function is SrvSmbWriteAndX() -// SMB_COM_WRITE_ANDX 0x2F -// - -typedef struct _REQ_WRITE_ANDX { - UCHAR WordCount; // Count of parameter words = 12 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( Fid ); // File handle - _ULONG( Offset ); // Offset in file to begin write - _ULONG( Timeout ); - _USHORT( WriteMode ); // Write mode: - // 0 - write through - // 1 - return Remaining - // 2 - use WriteRawNamedPipe (n. pipes) - // 3 - "this is the start of the msg" - _USHORT( Remaining ); // Bytes remaining to satisfy request - _USHORT( Reserved ); - _USHORT( DataLength ); // Number of data bytes in buffer (>=0) - _USHORT( DataOffset ); // Offset to data bytes - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data (# = DataLength) -} REQ_WRITE_ANDX; -typedef REQ_WRITE_ANDX SMB_UNALIGNED *PREQ_WRITE_ANDX; - -typedef struct _REQ_NT_WRITE_ANDX { - UCHAR WordCount; // Count of parameter words = 14 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( Fid ); // File handle - _ULONG( Offset ); // Offset in file to begin write - _ULONG( Timeout ); - _USHORT( WriteMode ); // Write mode: - // 0 - write through - // 1 - return Remaining - // 2 - use WriteRawNamedPipe (n. pipes) - // 3 - "this is the start of the msg" - _USHORT( Remaining ); // Bytes remaining to satisfy request - _USHORT( DataLengthHigh ); - _USHORT( DataLength ); // Number of data bytes in buffer (>=0) - _USHORT( DataOffset ); // Offset to data bytes - _ULONG( OffsetHigh ); // Used for NT Protocol only - // Upper 32 bits of offset - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data (# = DataLength) -} REQ_NT_WRITE_ANDX; -typedef REQ_NT_WRITE_ANDX SMB_UNALIGNED *PREQ_NT_WRITE_ANDX; - -typedef struct _RESP_WRITE_ANDX { - UCHAR WordCount; // Count of parameter words = 6 - UCHAR AndXCommand; // Secondary (X) command; 0xFF = none - UCHAR AndXReserved; // Reserved (must be 0) - _USHORT( AndXOffset ); // Offset to next command WordCount - _USHORT( Count ); // Number of bytes written - _USHORT( Remaining ); // Bytes remaining to be read (pipe/dev) - union { - _ULONG( Reserved ); - _USHORT( CountHigh ); // if large write&x - }; - _USHORT( ByteCount ); // Count of data bytes. Inaccurate if - // large writes - UCHAR Buffer[1]; // empty -} RESP_WRITE_ANDX; -typedef RESP_WRITE_ANDX SMB_UNALIGNED *PRESP_WRITE_ANDX; - -#endif // def INCLUDE_SMB_READ_WRITE - -#ifdef INCLUDE_SMB_MPX - -// -// Write Block Multiplexed SMB, see #2 page 97 -// Function is SrvSmbWriteMpx() -// SMB_COM_WRITE_MPX 0x1E -// SMB_COM_WRITE_MPX_SECONDARY 0x1F -// SMB_COM_WRITE_MPX_COMPLETE 0x20 -// - -typedef struct _REQ_WRITE_MPX { - UCHAR WordCount; // Count of parameter words = 12 - _USHORT( Fid ); // File handle - _USHORT( Count ); // Total bytes, including this buffer - _USHORT( Reserved ); - _ULONG( Offset ); // Offset in file to begin write - _ULONG( Timeout ); - _USHORT( WriteMode ); // Write mode: - // bit 0 - complete write to disk and - // send final result response - // bit 1 - return Remaining (pipe/dev) - // bit 7 - IPX datagram mode - union { - struct { - _USHORT( DataCompactionMode ); - _USHORT( Reserved2 ); - } ; - _ULONG( Mask ); // IPX datagram mode mask - } ; - _USHORT( DataLength ); // Number of data bytes this buffer - _USHORT( DataOffset ); // Offset (from header start) to data - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data (# = DataLength) -} REQ_WRITE_MPX; -typedef REQ_WRITE_MPX SMB_UNALIGNED *PREQ_WRITE_MPX; - -typedef struct _RESP_WRITE_MPX_INTERIM { // First response - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Remaining ); // Bytes ramaining to be read (pipe/dev) - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_WRITE_MPX_INTERIM; -typedef RESP_WRITE_MPX_INTERIM SMB_UNALIGNED *PRESP_WRITE_MPX_INTERIM; - -typedef struct _RESP_WRITE_MPX_DATAGRAM { // Response to sequenced request - UCHAR WordCount; // Count of parameter words = 2 - _ULONG( Mask ); // OR of all masks received - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_WRITE_MPX_DATAGRAM; -typedef RESP_WRITE_MPX_DATAGRAM SMB_UNALIGNED *PRESP_WRITE_MPX_DATAGRAM; - -// Secondary request format, 0 to N of these. - -typedef struct _REQ_WRITE_MPX_SECONDARY { - UCHAR WordCount; // Count of parameter words = 8 - _USHORT( Fid ); // File handle - _USHORT( Count ); // Total bytes to be sent - _ULONG( Offset ); // Offset in file to begin write - _ULONG( Reserved ); - _USHORT( DataLength ); // Number of data bytes this buffer - _USHORT( DataOffset ); // Offset (from header start) to data - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data (# = DataLength) -} REQ_WRITE_MPX_SECONDARY; -typedef REQ_WRITE_MPX_SECONDARY SMB_UNALIGNED *PREQ_WRITE_MPX_SECONDARY; - -#endif // def INCLUDE_SMB_MPX - -#ifndef INCLUDE_SMB_WRITE_COMPLETE -#ifdef INCLUDE_SMB_MPX -#define INCLUDE_SMB_WRITE_COMPLETE -#else -#ifdef INCLUDE_SMB_RAW -#define INCLUDE_SMB_WRITE_COMPLETE -#endif -#endif -#endif - -#ifdef INCLUDE_SMB_WRITE_COMPLETE - -// -// The following structure is used as the final response to both Write -// Block Multiplexed and Write Block Raw. -// - -typedef struct _RESP_WRITE_COMPLETE { // Final response; command is - // SMB_COM_WRITE_COMPLETE - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Count ); // Total number of bytes written - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_WRITE_COMPLETE; -typedef RESP_WRITE_COMPLETE SMB_UNALIGNED *PRESP_WRITE_COMPLETE; - -#endif // def INCLUDE_SMB_WRITE_COMPLETE - -#ifdef INCLUDE_SMB_READ_WRITE - -// -// Write Print File SMB, see #1 page 29 -// Function is SrvSmbWritePrintFile() -// SMB_COM_WRITE_PRINT_FILE 0xC1 -// - -typedef struct _REQ_WRITE_PRINT_FILE { - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Fid ); // File handle - _USHORT( ByteCount ); // Count of data bytes; min = 4 - UCHAR Buffer[1]; // Buffer containing: - //UCHAR BufferFormat; // 0x01 -- Data block - //USHORT DataLength; // Length of data - //UCHAR Data[]; // Data -} REQ_WRITE_PRINT_FILE; -typedef REQ_WRITE_PRINT_FILE SMB_UNALIGNED *PREQ_WRITE_PRINT_FILE; - -typedef struct _RESP_WRITE_PRINT_FILE { - UCHAR WordCount; // Count of parameter words = 0 - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_WRITE_PRINT_FILE; -typedef RESP_WRITE_PRINT_FILE SMB_UNALIGNED *PRESP_WRITE_PRINT_FILE; - -#endif // def INCLUDE_SMB_READ_WRITE - -#ifdef INCLUDE_SMB_RAW - -// -// Write Block Raw SMB, see #2 page 100 -// Function is SrvSmbWriteRaw() -// SMB_COM_WRITE_RAW 0x1D -// - -typedef struct _REQ_WRITE_RAW { - UCHAR WordCount; // Count of parameter words = 12 - _USHORT( Fid ); // File handle - _USHORT( Count ); // Total bytes, including this buffer - _USHORT( Reserved ); - _ULONG( Offset ); // Offset in file to begin write - _ULONG( Timeout ); - _USHORT( WriteMode ); // Write mode: - // bit 0 - complete write to disk and - // send final result response - // bit 1 - return Remaining (pipe/dev) - // (see WriteAndX for #defines) - _ULONG( Reserved2 ); - _USHORT( DataLength ); // Number of data bytes this buffer - _USHORT( DataOffset ); // Offset (from header start) to data - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data (# = DataLength) -} REQ_WRITE_RAW; -typedef REQ_WRITE_RAW SMB_UNALIGNED *PREQ_WRITE_RAW; - -typedef struct _REQ_NT_WRITE_RAW { - UCHAR WordCount; // Count of parameter words = 14 - _USHORT( Fid ); // File handle - _USHORT( Count ); // Total bytes, including this buffer - _USHORT( Reserved ); - _ULONG( Offset ); // Offset in file to begin write - _ULONG( Timeout ); - _USHORT( WriteMode ); // Write mode: - // bit 0 - complete write to disk and - // send final result response - // bit 1 - return Remaining (pipe/dev) - // (see WriteAndX for #defines) - _ULONG( Reserved2 ); - _USHORT( DataLength ); // Number of data bytes this buffer - _USHORT( DataOffset ); // Offset (from header start) to data - _ULONG( OffsetHigh ); // Used for NT Protocol only - // Upper 32 bits of offset - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR Pad[]; // Pad to SHORT or LONG - //UCHAR Data[]; // Data (# = DataLength) -} REQ_NT_WRITE_RAW; -typedef REQ_NT_WRITE_RAW SMB_UNALIGNED *PREQ_NT_WRITE_RAW; - -typedef struct _RESP_WRITE_RAW_INTERIM { // First response - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Remaining ); // Bytes remaining to be read (pipe/dev) - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_WRITE_RAW_INTERIM; -typedef RESP_WRITE_RAW_INTERIM SMB_UNALIGNED *PRESP_WRITE_RAW_INTERIM; - -typedef struct _RESP_WRITE_RAW_SECONDARY { // Second (final) response - UCHAR WordCount; // Count of parameter words = 1 - _USHORT( Count ); // Total number of bytes written - _USHORT( ByteCount ); // Count of data bytes = 0 - UCHAR Buffer[1]; // empty -} RESP_WRITE_RAW_SECONDARY; -typedef RESP_WRITE_RAW_SECONDARY SMB_UNALIGNED *PRESP_WRITE_RAW_SECONDARY; - -typedef struct _REQ_103_WRITE_RAW { - UCHAR WordCount; // Count of parameter words - _USHORT( Fid ); // File handle - _USHORT( Count ); - _USHORT( Reserved ); - _ULONG( Offset ); - _ULONG( Timeout ); - _USHORT( WriteMode ); - _ULONG( Reserved2 ); - _USHORT( ByteCount ); // Count of data bytes; min = - UCHAR Buffer[1]; // -} REQ_103_WRITE_RAW; -typedef REQ_103_WRITE_RAW SMB_UNALIGNED *PREQ_103_WRITE_RAW; - -typedef struct _RESP_103_WRITE_RAW { - UCHAR WordCount; // Count of parameter words - _USHORT( ByteCount ); // Count of data bytes; min = - UCHAR Buffer[1]; // -} RESP_103_WRITE_RAW; -typedef RESP_103_WRITE_RAW SMB_UNALIGNED *PRESP_103_WRITE_RAW; - -#endif // def INCLUDE_SMB_RAW - -typedef struct _REQ_NT_CANCEL { - UCHAR WordCount; // = 0 - _USHORT( ByteCount ); // = 0 - UCHAR Buffer[1]; -} REQ_NT_CANCEL; -typedef REQ_NT_CANCEL SMB_UNALIGNED *PREQ_NT_CANCEL; - -typedef struct _RESP_NT_CANCEL { - UCHAR WordCount; // = 0 - _USHORT( ByteCount ); // = 0 - UCHAR Buffer[1]; -} RESP_NT_CANCEL; -typedef RESP_NT_CANCEL SMB_UNALIGNED *PRESP_NT_CANCEL; - -// -// File open modes -// - -#define SMB_ACCESS_READ_ONLY 0 -#define SMB_ACCESS_WRITE_ONLY 1 -#define SMB_ACCESS_READ_WRITE 2 -#define SMB_ACCESS_EXECUTE 3 - -// -// Open flags -// - -#define SMB_OPEN_QUERY_INFORMATION 0x01 -#define SMB_OPEN_OPLOCK 0x02 -#define SMB_OPEN_OPBATCH 0x04 -#define SMB_OPEN_QUERY_EA_LENGTH 0x08 -#define SMB_OPEN_EXTENDED_RESPONSE 0x10 - -// -// NT open manifests -// - -#define NT_CREATE_REQUEST_OPLOCK 0x02 -#define NT_CREATE_REQUEST_OPBATCH 0x04 -#define NT_CREATE_OPEN_TARGET_DIR 0x08 - - -#define Added 0 -#define Removed 1 -#define Modified 2 -#define RenamedOldName 3 -#define RenamedNewName 4 - -// -// Lockrange for use with OS/2 DosFileLocks call -// - -// *** Where is this used? - -//typedef struct lockrange { -// ULONG offset; -// ULONG range; -// }; - -//#define LOCK 0x1 -//#define UNLOCK 0x2 - -// -// Data buffer format codes, from the core protocol. -// - -#define SMB_FORMAT_DATA 1 -#define SMB_FORMAT_DIALECT 2 -#define SMB_FORMAT_PATHNAME 3 -#define SMB_FORMAT_ASCII 4 -#define SMB_FORMAT_VARIABLE 5 - -// -// WriteMode flags -// - -#define SMB_WMODE_WRITE_THROUGH 0x0001 // complete write before responding -#define SMB_WMODE_SET_REMAINING 0x0002 // returning amt remaining in pipe -#define SMB_WMODE_WRITE_RAW_NAMED_PIPE 0x0004 // write named pipe in raw mode -#define SMB_WMODE_START_OF_MESSAGE 0x0008 // start of pipe message -#define SMB_WMODE_DATAGRAM 0x0080 // start of pipe message - -// -// Various SMB flags: -// - -// -// If the server supports LockAndRead and WriteAndUnlock, it sets this -// bit the Negotiate response. -// - -#define SMB_FLAGS_LOCK_AND_READ_OK 0x01 - -// -// When on, the consumer guarantees that there is a receive buffer posted -// such that a "Send.No.Ack" can be used by the server to respond to -// the consumer's request. -// - -#define SMB_FLAGS_SEND_NO_ACK 0x2 - -// -// This is part of the Flags field of every SMB header. If this bit -// is set, then all pathnames in the SMB should be treated as case- -// insensitive. -// - -#define SMB_FLAGS_CASE_INSENSITIVE 0x8 - -// -// When on in session setup, this bit indicates that all paths sent to -// the server are already in OS/2 canonicalized format. -// - -#define SMB_FLAGS_CANONICALIZED_PATHS 0x10 - -// -// When on in a open file request SMBs (open, create, openX, etc.) this -// bit indicates a request for an oplock on the file. When on in the -// response, this bit indicates that the oplock was granted. -// - -#define SMB_FLAGS_OPLOCK 0x20 - -// -// When on, this bit indicates that the server should notify the client -// on any request that could cause the file to be changed. If not set, -// the server only notifies the client on other open requests on the -// file. -// - -#define SMB_FLAGS_OPLOCK_NOTIFY_ANY 0x40 - -// -// This bit indicates that the SMB is being sent from server to redir. -// - -#define SMB_FLAGS_SERVER_TO_REDIR 0x80 - -// -// Valid bits for Flags on an incoming SMB -// - -#define INCOMING_SMB_FLAGS \ - (SMB_FLAGS_LOCK_AND_READ_OK | \ - SMB_FLAGS_SEND_NO_ACK | \ - SMB_FLAGS_CASE_INSENSITIVE | \ - SMB_FLAGS_CANONICALIZED_PATHS | \ - SMB_FLAGS_OPLOCK_NOTIFY_ANY | \ - SMB_FLAGS_OPLOCK) - -// -// Names for bits in Flags2 field of SMB header that indicate what the -// client app is aware of. -// - -#define SMB_FLAGS2_KNOWS_LONG_NAMES 0x0001 -#define SMB_FLAGS2_KNOWS_EAS 0x0002 -#define SMB_FLAGS2_SMB_SECURITY_SIGNATURE 0x0004 -#define SMB_FLAGS2_IS_LONG_NAME 0x0040 -#define SMB_FLAGS2_DFS 0x1000 -#define SMB_FLAGS2_PAGING_IO 0x2000 -#define SMB_FLAGS2_NT_STATUS 0x4000 -#define SMB_FLAGS2_UNICODE 0x8000 - -// -// Valid bits for Flags2 on an incoming SMB -// - -#define INCOMING_SMB_FLAGS2 \ - (SMB_FLAGS2_KNOWS_LONG_NAMES | \ - SMB_FLAGS2_KNOWS_EAS | \ - SMB_FLAGS2_DFS | \ - SMB_FLAGS2_PAGING_IO | \ - SMB_FLAGS2_IS_LONG_NAME | \ - SMB_FLAGS2_NT_STATUS | \ - SMB_FLAGS2_UNICODE ) - -// -// The SMB open function determines what action should be taken depending -// on the existence or lack thereof of files used in the operation. It -// has the following mapping: -// -// 1111 1 -// 5432 1098 7654 3210 -// rrrr rrrr rrrC rrOO -// -// where: -// -// O - Open (action to be taken if the target file exists) -// 0 - Fail -// 1 - Open or Append file -// 2 - Truncate file -// -// C - Create (action to be taken if the target file does not exist) -// 0 - Fail -// 1 - Create file -// - -#define SMB_OFUN_OPEN_MASK 0x3 -#define SMB_OFUN_CREATE_MASK 0x10 - -#define SMB_OFUN_OPEN_FAIL 0 -#define SMB_OFUN_OPEN_APPEND 1 -#define SMB_OFUN_OPEN_OPEN 1 -#define SMB_OFUN_OPEN_TRUNCATE 2 - -#define SMB_OFUN_CREATE_FAIL 0x00 -#define SMB_OFUN_CREATE_CREATE 0x10 - -//++ -// -// BOOLEAN -// SmbOfunCreate( -// IN USHORT SmbOpenFunction -// ) -// -//-- - -#define SmbOfunCreate(SmbOpenFunction) \ - (BOOLEAN)((SmbOpenFunction & SMB_OFUN_CREATE_MASK) == SMB_OFUN_CREATE_CREATE) - -//++ -// -// BOOLEAN -// SmbOfunAppend( -// IN USHORT SmbOpenFunction -// ) -// -//-- - -#define SmbOfunAppend(SmbOpenFunction) \ - (BOOLEAN)((SmbOpenFunction & SMB_OFUN_OPEN_MASK) == SMB_OFUN_OPEN_APPEND) - -//++ -// -// BOOLEAN -// SmbOfunTruncate( -// IN USHORT SmbOpenFunction -// ) -// -//-- - -#define SmbOfunTruncate(SmbOpenFunction) \ - (BOOLEAN)((SmbOpenFunction & SMB_OFUN_OPEN_MASK) == SMB_OFUN_OPEN_TRUNCATE) - -// -// The desired access mode passed in Open and Open and X has the following -// mapping: -// -// 1111 11 -// 5432 1098 7654 3210 -// rWrC rLLL rSSS rAAA -// -// where: -// -// W - Write through mode. No read ahead or write behind allowed on -// this file or device. When protocol is returned, data is expected -// to be on the disk or device. -// -// S - Sharing mode: -// 0 - Compatibility mode (as in core open) -// 1 - Deny read/write/execute (exclusive) -// 2 - Deny write -// 3 - Deny read/execute -// 4 - Deny none -// -// A - Access mode -// 0 - Open for reading -// 1 - Open for writing -// 2 - Open for reading and writing -// 3 - Open for execute -// -// rSSSrAAA = 11111111 (hex FF) indicates FCB open (as in core protocol) -// -// C - Cache mode -// 0 - Normal file -// 1 - Do not cache this file -// -// L - Locality of reference -// 0 - Locality of reference is unknown -// 1 - Mainly sequential access -// 2 - Mainly random access -// 3 - Random access with some locality -// 4 to 7 - Currently undefined -// - - -#define SMB_DA_SHARE_MASK 0x70 -#define SMB_DA_ACCESS_MASK 0x07 -#define SMB_DA_FCB_MASK (UCHAR)0xFF - -#define SMB_DA_ACCESS_READ 0x00 -#define SMB_DA_ACCESS_WRITE 0x01 -#define SMB_DA_ACCESS_READ_WRITE 0x02 -#define SMB_DA_ACCESS_EXECUTE 0x03 - -#define SMB_DA_SHARE_COMPATIBILITY 0x00 -#define SMB_DA_SHARE_EXCLUSIVE 0x10 -#define SMB_DA_SHARE_DENY_WRITE 0x20 -#define SMB_DA_SHARE_DENY_READ 0x30 -#define SMB_DA_SHARE_DENY_NONE 0x40 - -#define SMB_DA_FCB (UCHAR)0xFF - -#define SMB_CACHE_NORMAL 0x0000 -#define SMB_DO_NOT_CACHE 0x1000 - -#define SMB_LR_UNKNOWN 0x0000 -#define SMB_LR_SEQUENTIAL 0x0100 -#define SMB_LR_RANDOM 0x0200 -#define SMB_LR_RANDOM_WITH_LOCALITY 0x0300 -#define SMB_LR_MASK 0x0F00 - -#define SMB_DA_WRITE_THROUGH 0x4000 - -// -// The Action field of OpenAndX has the following format: -// -// 1111 11 -// 5432 1098 7654 3210 -// Lrrr rrrr rrrr rrOO -// -// where: -// -// L - Opportunistic lock. 1 if lock granted, else 0. -// -// O - Open action: -// 1 - The file existed and was opened -// 2 - The file did not exist but was created -// 3 - The file existed and was truncated -// - -#define SMB_OACT_OPENED 0x01 -#define SMB_OACT_CREATED 0x02 -#define SMB_OACT_TRUNCATED 0x03 - -#define SMB_OACT_OPLOCK 0x8000 - -// -// These flags are passed in the Flags field of the copy and extended rename -// SMBs. -// - -// -// If set, the target must be a file or directory. -// - -#define SMB_TARGET_IS_FILE 0x1 -#define SMB_TARGET_IS_DIRECTORY 0x2 - -// -// The copy mode--if set, ASCII copying should be done, otherwise binary. -// - -#define SMB_COPY_TARGET_ASCII 0x4 -#define SMB_COPY_SOURCE_ASCII 0x8 - -#define SMB_COPY_TREE 0x20 - -// -// If set, verify all writes. -// - -#define SMB_VERIFY_WRITES - -// -// Define file attribute bits as used in the SMB protocol. The specific -// bit positions are, for the most part, identical to those used in NT. -// However, NT does not define Volume and Directory bits. It also has -// an explicit Normal bit; this bit is implied in SMB attributes by -// Hidden, System, and Directory being off. -// - -#define SMB_FILE_ATTRIBUTE_READONLY 0x01 -#define SMB_FILE_ATTRIBUTE_HIDDEN 0x02 -#define SMB_FILE_ATTRIBUTE_SYSTEM 0x04 -#define SMB_FILE_ATTRIBUTE_VOLUME 0x08 -#define SMB_FILE_ATTRIBUTE_DIRECTORY 0x10 -#define SMB_FILE_ATTRIBUTE_ARCHIVE 0x20 - -// -// Share type strings are passed in SMBs to indicate what type of shared -// resource is being or has been connected to. -// - -#define SHARE_TYPE_NAME_DISK "A:" -#define SHARE_TYPE_NAME_PIPE "IPC" -#define SHARE_TYPE_NAME_COMM "COMM" -#define SHARE_TYPE_NAME_PRINT "LPT1:" -#define SHARE_TYPE_NAME_WILD "?????" - -// -// SMB Error codes: -// - -// -// Success Class: -// - -#define SMB_ERR_SUCCESS (UCHAR)0x00 - -// -// DOS Error Class: -// - -#define SMB_ERR_CLASS_DOS (UCHAR)0x01 - -#define SMB_ERR_BAD_FUNCTION 1 // Invalid function -#define SMB_ERR_BAD_FILE 2 // File not found -#define SMB_ERR_BAD_PATH 3 // Invalid directory -#define SMB_ERR_NO_FIDS 4 // Too many open files -#define SMB_ERR_ACCESS_DENIED 5 // Access not allowed for req. func. -#define SMB_ERR_BAD_FID 6 // Invalid file handle -#define SMB_ERR_BAD_MCB 7 // Memory control blocks destroyed -#define SMB_ERR_INSUFFICIENT_MEMORY 8 // For the desired function -#define SMB_ERR_BAD_MEMORY 9 // Invalid memory block address -#define SMB_ERR_BAD_ENVIRONMENT 10 // Invalid environment -#define SMB_ERR_BAD_FORMAT 11 // Invalid format -#define SMB_ERR_BAD_ACCESS 12 // Invalid open mode -#define SMB_ERR_BAD_DATA 13 // Invalid data (only from IOCTL) -#define SMB_ERR_RESERVED 14 -#define SMB_ERR_BAD_DRIVE 15 // Invalid drive specified -#define SMB_ERR_CURRENT_DIRECTORY 16 // Attempted to remove currect directory -#define SMB_ERR_DIFFERENT_DEVICE 17 // Not the same device -#define SMB_ERR_NO_FILES 18 // File search can't find more files -#define SMB_ERR_BAD_SHARE 32 // An open conflicts with FIDs on file -#define SMB_ERR_LOCK 33 // Conflict with existing lock -#define SMB_ERR_FILE_EXISTS 80 // Tried to overwrite existing file -#define SMB_ERR_BAD_PIPE 230 // Invalie pipe -#define SMB_ERR_PIPE_BUSY 231 // All instances of the pipe are busy -#define SMB_ERR_PIPE_CLOSING 232 // Pipe close in progress -#define SMB_ERR_PIPE_NOT_CONNECTED 233 // No process on other end of pipe -#define SMB_ERR_MORE_DATA 234 // There is more data to return - -// -// SERVER Error Class: -// - -#define SMB_ERR_CLASS_SERVER (UCHAR)0x02 - -#define SMB_ERR_ERROR 1 // Non-specific error code -#define SMB_ERR_BAD_PASSWORD 2 // Bad name/password pair -#define SMB_ERR_BAD_TYPE 3 // Reserved -#define SMB_ERR_ACCESS 4 // Requester lacks necessary access -#define SMB_ERR_BAD_TID 5 // Invalid TID -#define SMB_ERR_BAD_NET_NAME 6 // Invalid network name in tree connect -#define SMB_ERR_BAD_DEVICE 7 // Invalid device request -#define SMB_ERR_QUEUE_FULL 49 // Print queue full--returned print file -#define SMB_ERR_QUEUE_TOO_BIG 50 // Print queue full--no space -#define SMB_ERR_QUEUE_EOF 51 // EOF on print queue dump -#define SMB_ERR_BAD_PRINT_FID 52 // Invalid print file FID -#define SMB_ERR_BAD_SMB_COMMAND 64 // SMB command not recognized -#define SMB_ERR_SERVER_ERROR 65 // Internal server error -#define SMB_ERR_FILE_SPECS 67 // FID and pathname were incompatible -#define SMB_ERR_RESERVED2 68 -#define SMB_ERR_BAD_PERMITS 69 // Access permissions invalid -#define SMB_ERR_RESERVED3 70 -#define SMB_ERR_BAD_ATTRIBUTE_MODE 71 // Invalid attribute mode specified -#define SMB_ERR_SERVER_PAUSED 81 // Server is paused -#define SMB_ERR_MESSAGE_OFF 82 // Server not receiving messages -#define SMB_ERR_NO_ROOM 83 // No room for buffer message -#define SMB_ERR_TOO_MANY_NAMES 87 // Too many remote user names -#define SMB_ERR_TIMEOUT 88 // Operation was timed out -#define SMB_ERR_NO_RESOURCE 89 // No resources available for request -#define SMB_ERR_TOO_MANY_UIDS 90 // Too many UIDs active in session -#define SMB_ERR_BAD_UID 91 // UID not known as a valid UID -#define SMB_ERR_INVALID_NAME 123 // Invalid name returned from FAT. -#define SMB_ERR_INVALID_NAME_RANGE 206 // Non 8.3 name passed to FAT (or non 255 name to HPFS) -#define SMB_ERR_USE_MPX 250 // Can't support Raw; use MPX -#define SMB_ERR_USE_STANDARD 251 // Can't support Raw, use standard r/w -#define SMB_ERR_CONTINUE_MPX 252 // Reserved -#define SMB_ERR_RESERVED4 253 -#define SMB_ERR_RESERVED5 254 -#define SMB_ERR_NO_SUPPORT_INTERNAL 255 // Internal code for NO_SUPPORT-- - // allows codes to be stored in a byte -#define SMB_ERR_NO_SUPPORT (USHORT)0xFFFF // Function not supported - -// -// HARDWARE Error Class: -// - -#define SMB_ERR_CLASS_HARDWARE (UCHAR)0x03 - -#define SMB_ERR_NO_WRITE 19 // Write attempted to write-prot. disk -#define SMB_ERR_BAD_UNIT 20 // Unknown unit -#define SMB_ERR_DRIVE_NOT_READY 21 // Disk drive not ready -#define SMB_ERR_BAD_COMMAND 22 // Unknown command -#define SMB_ERR_DATA 23 // Data error (CRC) -#define SMB_ERR_BAD_REQUEST 24 // Bad request structure length -#define SMB_ERR_SEEK 25 // Seek error -#define SMB_ERR_BAD_MEDIA 26 // Unknown media type -#define SMB_ERR_BAD_SECTOR 27 // Sector not found -#define SMB_ERR_NO_PAPER 28 // Printer out of paper -#define SMB_ERR_WRITE_FAULT 29 // Write fault -#define SMB_ERR_READ_FAULT 30 // Read fault -#define SMB_ERR_GENERAL 31 // General failure -#define SMB_ERR_LOCK_CONFLICT 33 // Lock conflicts with existing lock -#define SMB_ERR_WRONG_DISK 34 // Wrong disk was found in a drive -#define SMB_ERR_FCB_UNAVAILABLE 35 // No FCBs available to process request -#define SMB_ERR_SHARE_BUFFER_EXCEEDED 36 -#define SMB_ERR_DISK_FULL 39 // !!! Undocumented, but in LM2.0 - -// -// Other Error Classes: -// - -#define SMB_ERR_CLASS_XOS (UCHAR)0x04 // Reserved for XENIX -#define SMB_ERR_CLASS_RMX1 (UCHAR)0xE1 // Reserved for iRMX -#define SMB_ERR_CLASS_RMX2 (UCHAR)0xE2 // Reserved for iRMX -#define SMB_ERR_CLASS_RMX3 (UCHAR)0xE3 // Reserved for iRMX -#define SMB_ERR_CLASS_COMMAND (UCHAR)0xFF // Command was not in the SMB format - - -// -// Turn structure packing back off -// - -#ifndef NO_PACKING -#include -#endif // ndef NO_PACKING - -// Old (LanMan 1.2) and new (NT) field names: -// (Undocumented fields have corresponding structure in parenthesis) -// smb_access Access -// smb_action Action -// smb_adate AccessDate -// smb_allocsize AllocationSize -// smb_aname AccountName -// smb_apasslen PasswordSize -// smb_apasswd AccountPassword -// smb_atime AccessTime -// smb_attr Attribute -// smb_attribute Attribute -// smb_aunits (RESP_QUERY_INFORMATION_SERVER) -// smb_bcc BufferSize -// smb_blkmode BlockMode -// smb_blksize BlockSize -// smb_blksperunit BlocksPerUnit -// smb_bpu BlocksPerUnit -// smb_bs BlockSize -// smb_bufsize MaxBufferSize -// smb_buf[1] Buffer[1] -// smb_bytes[*] Bytes[*] -// smb_cat Category -// smb_cct FilesCopied -// smb_cdate CreateDate -// smb_cert CertificateOffset -// smb_com Command -// smb_com2 AndXCommand -// smb_count Count -// smb_count_left Remaining -// smb_cryptkey[*] CryptKey -// smb_ctime CreateTime -// smb_datablock DataBlock -// smb_datalen DataSize -// smb_datasize DataSize -// smb_data[*] Data[*] -// smb_dcmode DataCompactMode -// smb_dev DeviceName -// smb_doff DataOffset -// smb_drcnt DataCount -// smb_drdisp DataDisplacement -// smb_droff DataOffset -// smb_dscnt DataCount -// smb_dsdisp DataDisplacement -// smb_dsize DataSize -// smb_dsoff DataOffset -// smb_encrypt EncryptKey -// smb_encryptlen EncryptKeySize -// smb_encryptoff EncryptKeyOffset -// smb_eos EndOfSearch -// smb_err Error -// smb_errmsg[1] ErrorMessage[1] -// smb_fau (RESP_QUERY_INFORMATION_SERVER) -// smb_fid Fid -// smb_fileid ServerFid -// smb_flag Flag -// smb_flag2 Flag2 -// smb_flags Flag -// smb_flg Flag -// smb_freeunits FreeUnits -// smb_fsid (RESP_QUERY_INFORMATION_SERVER) -// smb_fsize FileSize -// smb_fun Function -// smb_gid Gid -// smb_handle Handle -// smb_ident1 Identifier -// smb_idf[4] Protocol[4] -// smb_index Index -// smb_info Info -// smb_left Remaining -// smb_len SetupLength -// smb_locknum NumberOfLocks -// smb_lockrng[*] LockRange -// smb_locktype LockType -// smb_lpid OwnerPid -// smb_maxbytes MaxBytes -// smb_maxcnt MaxCount -// smb_maxcount MaxCount -// smb_maxmux (RESP_NEGOTIATE) -// smb_maxvcs MaxNumberVcs -// smb_maxxmitsz MaxTransmitSize -// smb_maxxmt MaxTransmitSize -// smb_mdate ModificationDate -// smb_mdrcnt MaxDataCount -// smb_mid Mid -// smb_mincnt MinCount -// smb_mode Mode -// smb_mprcnt MaxParameterCount -// smb_mpxmax MaxMpxCount -// smb_msrcnt MaxSetupCount -// smb_mtime ModificationTime -// smb_name[*] Name[*] -// smb_off2 AndXOffset -// smb_offset Offset -// smb_ofun OpenFunction -// smb_pad Pad -// smb_pad1[] Pad1 -// smb_pad[] Pad[] -// smb_param[*] Parameter[*] -// smb_path ServerName -// smb_pathname PathName -// smb_pid Pid -// smb_prcnt ParameterCount -// smb_prdisp ParameterDisplacement -// smb_proff ParameterCount -// smb_pscnt ParameterCount -// smb_psdisp ParameterDisplacement -// smb_psoff ParameterOffset -// smb_range LockLength or UnlockLength -// smb_rcls ErrorClass -// smb_reh ReservedH -// smb_reh2 ReservedH2 -// smb_remaining Remaining -// smb_remcnt Remaining -// smb_res1 Reserved -// smb_res2 Reserved2 -// smb_res3 Reserved3 -// smb_res4 Reserved4 -// smb_res5 Reserved5 -// smb_reserved Reserved -// smb_restart Restart -// smb_resumekey ResumeKey -// smb_res[5] Reserved[] -// smb_reverb ReverbCount -// smb_rsvd Reserved -// smb_rsvd1 Reserved -// smb_rsvd2 Reserved2 -// smb_rsvd3 Reserved3 -// smb_rsvd4 Reserved4 -// smb_sattr SearchAttribute -// smb_secmode SecurityMode -// smb_seq SequenceNumber -// smb_services Services -// smb_sesskey SessionKey -// smb_setup[*] Setup[*] -// smb_size Size -// smb_spasslen ServerPasswordSize -// smb_spasswd ServerPassword -// smb_srv_date ServerDate -// smb_srv_time ServerTime -// smb_srv_tzone ServerTimeZone -// smb_start StartIndex -// smb_state DeviceState -// smb_suwcnt SetupWordCount -// smb_su_class SetupClass -// smb_su_com SetupCommand -// smb_su_handle SetupFid -// smb_su_opcode SetupOpcode -// smb_su_priority SetupPriority -// smb_tcount Count -// smb_tdis TreeDisconnect -// smb_tdrcnt TotalDataCount -// smb_tdscnt TotalDataCount -// smb_tid Tid -// smb_tid2 Tid2 -// smb_time Time -// smb_timeout Timeout -// smb_totalunits TotalUnits -// smb_tprcnt TotalParameterCount -// smb_tpscnt TotalParameterCount -// smb_type FileType -// smb_uid Uid -// smb_unlkrng[*] UnlockRange -// smb_unlocknum NumberOfUnlocks -// smb_vblen DataLength -// smb_vcnum VcNumber -// smb_vldate (RESP_QUERY_INFORMATION_SERVER) -// smb_vllen (RESP_QUERY_INFORMATION_SERVER) -// smb_vltime (RESP_QUERY_INFORMATION_SERVER) -// smb_vwv[1] Param -// smb_wct WordCount -// smb_wmode WriteMode -// smb_xchain EncryptChainOffset - - -// -// Force misalignment of the following structures -// - -#ifndef NO_PACKING -#include -#endif // ndef NO_PACKING - - -// -// Named pipe function codes -// - -#define TRANS_SET_NMPIPE_STATE 0x01 -#define TRANS_RAW_READ_NMPIPE 0x11 -#define TRANS_QUERY_NMPIPE_STATE 0x21 -#define TRANS_QUERY_NMPIPE_INFO 0x22 -#define TRANS_PEEK_NMPIPE 0x23 -#define TRANS_TRANSACT_NMPIPE 0x26 -#define TRANS_RAW_WRITE_NMPIPE 0x31 -#define TRANS_READ_NMPIPE 0x36 -#define TRANS_WRITE_NMPIPE 0x37 -#define TRANS_WAIT_NMPIPE 0x53 -#define TRANS_CALL_NMPIPE 0x54 - -// -// Mailslot function code -// - -#define TRANS_MAILSLOT_WRITE 0x01 - -// -// Transaction2 function codes -// - -#define TRANS2_OPEN2 0x00 -#define TRANS2_FIND_FIRST2 0x01 -#define TRANS2_FIND_NEXT2 0x02 -#define TRANS2_QUERY_FS_INFORMATION 0x03 -#define TRANS2_SET_FS_INFORMATION 0x04 -#define TRANS2_QUERY_PATH_INFORMATION 0x05 -#define TRANS2_SET_PATH_INFORMATION 0x06 -#define TRANS2_QUERY_FILE_INFORMATION 0x07 -#define TRANS2_SET_FILE_INFORMATION 0x08 -#define TRANS2_FSCTL 0x09 -#define TRANS2_IOCTL2 0x0A -#define TRANS2_FIND_NOTIFY_FIRST 0x0B -#define TRANS2_FIND_NOTIFY_NEXT 0x0C -#define TRANS2_CREATE_DIRECTORY 0x0D -#define TRANS2_SESSION_SETUP 0x0E -#define TRANS2_QUERY_FS_INFORMATION_FID 0x0F -#define TRANS2_GET_DFS_REFERRAL 0x10 -#define TRANS2_REPORT_DFS_INCONSISTENCY 0x11 - -#define TRANS2_MAX_FUNCTION 0x11 - -// -// Nt Transaction function codes -// - -#define NT_TRANSACT_MIN_FUNCTION 1 - -#define NT_TRANSACT_CREATE 1 -#define NT_TRANSACT_IOCTL 2 -#define NT_TRANSACT_SET_SECURITY_DESC 3 -#define NT_TRANSACT_NOTIFY_CHANGE 4 -#define NT_TRANSACT_RENAME 5 -#define NT_TRANSACT_QUERY_SECURITY_DESC 6 -#define NT_TRANSACT_QUERY_QUOTA 7 -#define NT_TRANSACT_SET_QUOTA 8 - -#define NT_TRANSACT_MAX_FUNCTION 8 - -// -// File information levels -// - -#define SMB_INFO_STANDARD 1 -#define SMB_INFO_QUERY_EA_SIZE 2 -#define SMB_INFO_SET_EAS 2 -#define SMB_INFO_QUERY_EAS_FROM_LIST 3 -#define SMB_INFO_QUERY_ALL_EAS 4 // undocumented but supported -#define SMB_INFO_QUERY_FULL_NAME 5 // never sent by redir -#define SMB_INFO_IS_NAME_VALID 6 -#define SMB_INFO_PASSTHROUGH 1000 // any info above here is a simple pass-through - -// -// NT extension to file info levels -// - -#define SMB_QUERY_FILE_BASIC_INFO 0x101 -#define SMB_QUERY_FILE_STANDARD_INFO 0x102 -#define SMB_QUERY_FILE_EA_INFO 0x103 -#define SMB_QUERY_FILE_NAME_INFO 0x104 -#define SMB_QUERY_FILE_ALLOCATION_INFO 0x105 -#define SMB_QUERY_FILE_END_OF_FILEINFO 0x106 -#define SMB_QUERY_FILE_ALL_INFO 0x107 -#define SMB_QUERY_FILE_ALT_NAME_INFO 0x108 -#define SMB_QUERY_FILE_STREAM_INFO 0x109 -#define SMB_QUERY_FILE_COMPRESSION_INFO 0x10B - -#define SMB_SET_FILE_BASIC_INFO 0x101 -#define SMB_SET_FILE_DISPOSITION_INFO 0x102 -#define SMB_SET_FILE_ALLOCATION_INFO 0x103 -#define SMB_SET_FILE_END_OF_FILE_INFO 0x104 - -#define SMB_QUERY_FS_LABEL_INFO 0x101 -#define SMB_QUERY_FS_VOLUME_INFO 0x102 -#define SMB_QUERY_FS_SIZE_INFO 0x103 -#define SMB_QUERY_FS_DEVICE_INFO 0x104 -#define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 -#define SMB_QUERY_FS_QUOTA_INFO 0x106 // unused? -#define SMB_QUERY_FS_CONTROL_INFO 0x107 - -// -// Volume information levels. -// - -#define SMB_INFO_ALLOCATION 1 -#define SMB_INFO_VOLUME 2 - -// -// Rename2 information levels. -// - -#define SMB_NT_RENAME_MOVE_CLUSTER_INFO 0x102 -#define SMB_NT_RENAME_SET_LINK_INFO 0x103 -#define SMB_NT_RENAME_RENAME_FILE 0x104 // Server internal -#define SMB_NT_RENAME_MOVE_FILE 0x105 // Server internal - -// -// Protocol for NtQueryQuotaInformationFile -// -typedef struct { - _USHORT( Fid ); // FID of target - UCHAR ReturnSingleEntry; // Indicates that only a single entry should be returned - // rather than filling the buffer with as - // many entries as possible. - UCHAR RestartScan; // Indicates whether the scan of the quota information - // is to be restarted from the beginning. - _ULONG ( SidListLength ); // Supplies the length of the SID list if present - _ULONG ( StartSidLength ); // Supplies an optional SID that indicates that the returned - // information is to start with an entry other - // than the first. This parameter is ignored if a - // SidList is given - _ULONG( StartSidOffset); // Supplies the offset of Start Sid in the buffer -} REQ_NT_QUERY_FS_QUOTA_INFO, *PREQ_NT_QUERY_FS_QUOTA_INFO; -// -// Desciptor response -// -// Data Bytes: The Quota Information -// -typedef struct { - _ULONG ( Length ); -} RESP_NT_QUERY_FS_QUOTA_INFO, *PRESP_NT_QUERY_FS_QUOTA_INFO; - -// -// Protocol for NtSetQuotaInformationFile -// -typedef struct { - _USHORT( Fid ); // FID of target -} REQ_NT_SET_FS_QUOTA_INFO, *PREQ_NT_SET_FS_QUOTA_INFO; -// -// Response: -// -// Setup words: None. -// Parameter Bytes: None. -// Data Bytes: None. -// - - -// -// Dfs Transactions -// - -// -// Request for Referral. -// -typedef struct { - USHORT MaxReferralLevel; // Latest version of referral understood - UCHAR RequestFileName[1]; // Dfs name for which referral is sought -} REQ_GET_DFS_REFERRAL; -typedef REQ_GET_DFS_REFERRAL SMB_UNALIGNED *PREQ_GET_DFS_REFERRAL; - -// -// The format of an individual referral contains version and length information -// allowing the client to skip referrals it does not understand. -// -// !! All referral elements must have VersionNumber and Size as the first 2 elements !! -// - -typedef struct { - USHORT VersionNumber; // == 1 - USHORT Size; // Size of this whole element - USHORT ServerType; // Type of server: 0 == Don't know, 1 == SMB, 2 == Netware - struct { - USHORT StripPath : 1; // Strip off PathConsumed characters from front of - // DfsPathName prior to submitting name to UncShareName - }; - WCHAR ShareName[1]; // The server+share name go right here. NULL terminated. -} DFS_REFERRAL_V1; -typedef DFS_REFERRAL_V1 SMB_UNALIGNED *PDFS_REFERRAL_V1; - -typedef struct { - USHORT VersionNumber; // == 2 - USHORT Size; // Size of this whole element - USHORT ServerType; // Type of server: 0 == Don't know, 1 == SMB, 2 == Netware - struct { - USHORT StripPath : 1; // Strip off PathConsumed characters from front of - // DfsPathName prior to submitting name to UncShareName - }; - ULONG Proximity; // Hint of transport cost - ULONG TimeToLive; // In number of seconds - USHORT DfsPathOffset; // Offset from beginning of this element to Path to access - USHORT DfsAlternatePathOffset; // Offset from beginning of this element to 8.3 path - USHORT NetworkAddressOffset; // Offset from beginning of this element to Network path -} DFS_REFERRAL_V2; -typedef DFS_REFERRAL_V2 SMB_UNALIGNED *PDFS_REFERRAL_V2; - -typedef struct { - USHORT VersionNumber; // == 3 - USHORT Size; // Size of this whole element - USHORT ServerType; // Type of server: 0 == Don't know, 1 == SMB, 2 == Netware - struct { - USHORT StripPath : 1; // Strip off PathConsumed characters from front of - // DfsPathName prior to submitting name to UncShareName - USHORT NameListReferral : 1; // This referral contains an expanded name list - }; - ULONG TimeToLive; // In number of seconds - union { - struct { - USHORT DfsPathOffset; // Offset from beginning of this element to Path to access - USHORT DfsAlternatePathOffset; // Offset from beginning of this element to 8.3 path - USHORT NetworkAddressOffset; // Offset from beginning of this element to Network path - GUID ServiceSiteGuid; // The guid for the site - }; - struct { - USHORT SpecialNameOffset; // Offset from this element to the special name string - USHORT NumberOfExpandedNames; // Number of expanded names - USHORT ExpandedNameOffset; // Offset from this element to the expanded name list - }; - }; -} DFS_REFERRAL_V3; -typedef DFS_REFERRAL_V3 SMB_UNALIGNED *PDFS_REFERRAL_V3; - -typedef struct { - USHORT PathConsumed; // Number of WCHARs consumed in DfsPathName - USHORT NumberOfReferrals; // Number of referrals contained here - struct { - ULONG ReferralServers : 1; // Elements in Referrals[] are referral servers - ULONG StorageServers : 1; // Elements in Referrals[] are storage servers - }; - union { // The vector of referrals - DFS_REFERRAL_V1 v1; - DFS_REFERRAL_V2 v2; - DFS_REFERRAL_V3 v3; - } Referrals[1]; // [ NumberOfReferrals ] - - // - // WCHAR StringBuffer[]; // Used by DFS_REFERRAL_V2 - // - -} RESP_GET_DFS_REFERRAL; -typedef RESP_GET_DFS_REFERRAL SMB_UNALIGNED *PRESP_GET_DFS_REFERRAL; - -// -// During Dfs operations, a client may discover a knowledge inconsistency in the Dfs. -// The parameter portion of the TRANS2_REPORT_DFS_INCONSISTENCY SMB is -// encoded in this way -// - -typedef struct { - UCHAR RequestFileName[1]; // Dfs name for which inconsistency is being reported - union { - DFS_REFERRAL_V1 v1; // The single referral thought to be in error - } Referral; -} REQ_REPORT_DFS_INCONSISTENCY; -typedef REQ_REPORT_DFS_INCONSISTENCY SMB_UNALIGNED *PREQ_REPORT_DFS_INCONSISTENCY; - -typedef struct _REQ_QUERY_FS_INFORMATION_FID { - _USHORT( InformationLevel ); - _USHORT( Fid ); -} REQ_QUERY_FS_INFORMATION_FID; -typedef REQ_QUERY_FS_INFORMATION_FID SMB_UNALIGNED *PREQ_QUERY_FS_INFORMATION_FID; - -// -// The client also needs to send to this server the referral which it believes to be -// in error. The data part of this transaction contains the errant referral(s), encoded -// as above in the DFS_REFERRAL_* structures. -// - -// -// Find First, information levels -// - -#define SMB_FIND_FILE_DIRECTORY_INFO 0x101 -#define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 -#define SMB_FIND_FILE_NAMES_INFO 0x103 -#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104 - -#ifdef INCLUDE_SMB_DIRECTORY - -// -// CreateDirectory2 function code os Transaction2 SMB, see #3 page 51 -// Function is SrvSmbCreateDirectory2() -// TRANS2_CREATE_DIRECTORY 0x0D -// - -typedef struct _REQ_CREATE_DIRECTORY2 { - _ULONG( Reserved ); // Reserved--must be zero - UCHAR Buffer[1]; // Directory name to create -} REQ_CREATE_DIRECTORY2; -typedef REQ_CREATE_DIRECTORY2 SMB_UNALIGNED *PREQ_CREATE_DIRECTORY2; - -// Data bytes for CreateDirectory2 request are the extended attributes for the -// created file. - -typedef struct _RESP_CREATE_DIRECTORY2 { - _USHORT( EaErrorOffset ); // Offset into FEAList of first error - // which occurred while setting EAs -} RESP_CREATE_DIRECTORY2; -typedef RESP_CREATE_DIRECTORY2 SMB_UNALIGNED *PRESP_CREATE_DIRECTORY2; - -#endif // def INCLUDE_SMB_DIRECTORY - -#ifdef INCLUDE_SMB_SEARCH - -// -// FindFirst2 function code of Transaction2 SMB, see #3 page 22 -// Function is SrvSmbFindFirst2() -// TRANS2_FIND_FIRST2 0x01 -// - -typedef struct _REQ_FIND_FIRST2 { - _USHORT( SearchAttributes ); - _USHORT( SearchCount ); // Maximum number of entries to return - _USHORT( Flags ); // Additional information: bit set- - // 0 - close search after this request - // 1 - close search if end reached - // 2 - return resume keys - _USHORT( InformationLevel ); - _ULONG(SearchStorageType); - UCHAR Buffer[1]; // File name -} REQ_FIND_FIRST2; -typedef REQ_FIND_FIRST2 SMB_UNALIGNED *PREQ_FIND_FIRST2; - -// Data bytes for Find First2 request are a list of extended attributes -// to retrieve (a GEAList), if InformationLevel is QUERY_EAS_FROM_LIST. - -typedef struct _RESP_FIND_FIRST2 { - _USHORT( Sid ); // Search handle - _USHORT( SearchCount ); // Number of entries returned - _USHORT( EndOfSearch ); // Was last entry returned? - _USHORT( EaErrorOffset ); // Offset into EA list if EA error - _USHORT( LastNameOffset ); // Offset into data to file name of - // last entry, if server needs it - // to resume search; else 0 -} RESP_FIND_FIRST2; -typedef RESP_FIND_FIRST2 SMB_UNALIGNED *PRESP_FIND_FIRST2; - -// Data bytes for Find First2 response are level-dependent information -// about the matching files. If bit 2 in the request parameters was -// set, each entry is preceded by a four-byte resume key. - -// -// FindNext2 function code of Transaction2 SMB, see #3 page 26 -// Function is SrvSmbFindNext2() -// TRANS2_FIND_NEXT2 0x02 -// - -typedef struct _REQ_FIND_NEXT2 { - _USHORT( Sid ); // Search handle - _USHORT( SearchCount ); // Maximum number of entries to return - _USHORT( InformationLevel ); - _ULONG( ResumeKey ); // Value returned by previous find - _USHORT( Flags ); // Additional information: bit set- - // 0 - close search after this request - // 1 - close search if end reached - // 2 - return resume keys - // 3 - resume/continue, NOT rewind - UCHAR Buffer[1]; // Resume file name -} REQ_FIND_NEXT2; -typedef REQ_FIND_NEXT2 SMB_UNALIGNED *PREQ_FIND_NEXT2; - -// Data bytes for Find Next2 request are a list of extended attributes -// to retrieve, if InformationLevel is QUERY_EAS_FROM_LIST. - -typedef struct _RESP_FIND_NEXT2 { - _USHORT( SearchCount ); // Number of entries returned - _USHORT( EndOfSearch ); // Was last entry returned? - _USHORT( EaErrorOffset ); // Offset into EA list if EA error - _USHORT( LastNameOffset ); // Offset into data to file name of - // last entry, if server needs it - // to resume search; else 0 -} RESP_FIND_NEXT2; -typedef RESP_FIND_NEXT2 SMB_UNALIGNED *PRESP_FIND_NEXT2; - -// Data bytes for Find Next2 response are level-dependent information -// about the matching files. If bit 2 in the request parameters was -// set, each entry is preceded by a four-byte resume key. - -// -// Flags for REQ_FIND_FIRST2.Flags -// - -#define SMB_FIND_CLOSE_AFTER_REQUEST 0x01 -#define SMB_FIND_CLOSE_AT_EOS 0x02 -#define SMB_FIND_RETURN_RESUME_KEYS 0x04 -#define SMB_FIND_CONTINUE_FROM_LAST 0x08 -#define SMB_FIND_WITH_BACKUP_INTENT 0x10 - -#endif // def INCLUDE_SMB_SEARCH - -#ifdef INCLUDE_SMB_OPEN_CLOSE - -// -// Open2 function code of Transaction2 SMB, see #3 page 19 -// Function is SrvSmbOpen2() -// TRANS2_OPEN2 0x00 -// -// *** Note that the REQ_OPEN2 and RESP_OPEN2 structures closely -// resemble the REQ_OPEN_ANDX and RESP_OPEN_ANDX structures. -// - -typedef struct _REQ_OPEN2 { - _USHORT( Flags ); // Additional information: bit set- - // 0 - return additional info - // 1 - set single user total file lock - // 2 - server notifies consumer of - // actions which may change file - // 3 - return total length of EAs - _USHORT( DesiredAccess ); // File open mode - _USHORT( SearchAttributes ); // *** ignored - _USHORT( FileAttributes ); - _ULONG( CreationTimeInSeconds ); - _USHORT( OpenFunction ); - _ULONG( AllocationSize ); // Bytes to reserve on create or truncate - _USHORT( Reserved )[5]; // Pad through OpenAndX's Timeout, - // Reserved, and ByteCount - UCHAR Buffer[1]; // File name -} REQ_OPEN2; -typedef REQ_OPEN2 SMB_UNALIGNED *PREQ_OPEN2; - -// Data bytes for Open2 request are the extended attributes for the -// created file. - -typedef struct _RESP_OPEN2 { - _USHORT( Fid ); // File handle - _USHORT( FileAttributes ); - _ULONG( CreationTimeInSeconds ); - _ULONG( DataSize ); // Current file size - _USHORT( GrantedAccess ); // Access permissions actually allowed - _USHORT( FileType ); - _USHORT( DeviceState ); // state of IPC device (e.g. pipe) - _USHORT( Action ); // Action taken - _ULONG( ServerFid ); // Server unique file id - _USHORT( EaErrorOffset ); // Offset into EA list if EA error - _ULONG( EaLength ); // Total EA length for opened file -} RESP_OPEN2; -typedef RESP_OPEN2 SMB_UNALIGNED *PRESP_OPEN2; - -// The Open2 response has no data bytes. - - -#endif // def INCLUDE_SMB_OPEN_CLOSE - -#ifdef INCLUDE_SMB_MISC - -// -// QueryFsInformation function code of Transaction2 SMB, see #3 page 30 -// Function is SrvSmbQueryFsInformation() -// TRANS2_QUERY_FS_INFORMATION 0x03 -// - -typedef struct _REQ_QUERY_FS_INFORMATION { - _USHORT( InformationLevel ); -} REQ_QUERY_FS_INFORMATION; -typedef REQ_QUERY_FS_INFORMATION SMB_UNALIGNED *PREQ_QUERY_FS_INFORMATION; - -// No data bytes for Query FS Information request. - -//typedef struct _RESP_QUERY_FS_INFORMATION { -//} RESP_QUERY_FS_INFORMATION; -//typedef RESP_QUERY_FS_INFORMATION SMB_UNALIGNED *PRESP_QUERY_FS_INFORMATION; - -// Data bytes for Query FS Information response are level-dependent -// information about the specified volume. - -// -// SetFSInformation function code of Transaction2 SMB, see #3 page 31 -// Function is SrvSmbSetFSInformation() -// TRANS2_SET_PATH_INFORMATION 0x04 -// - -typedef struct _REQ_SET_FS_INFORMATION { - _USHORT( Fid ); - _USHORT( InformationLevel ); -} REQ_SET_FS_INFORMATION; -typedef REQ_SET_FS_INFORMATION SMB_UNALIGNED *PREQ_SET_FS_INFORMATION; - -// Data bytes for Set FS Information request are level-dependant -// information about the specified volume. - -//typedef struct _RESP_SET_FS_INFORMATION { -//} RESP_SET_FS_INFORMATION; -//typedef RESP_SET_FS_INFORMATION SMB_UNALIGNED *PRESP_SET_FS_INFORMATION; - -// The Set FS Information response has no data bytes. - -#endif // def INCLUDE_SMB_MISC - -#ifdef INCLUDE_SMB_QUERY_SET - -// -// QueryPathInformation function code of Transaction2 SMB, see #3 page 33 -// Function is SrvSmbQueryPathInformation() -// TRANS2_QUERY_PATH_INFORMATION 0x05 -// - -typedef struct _REQ_QUERY_PATH_INFORMATION { - _USHORT( InformationLevel ); - _ULONG( Reserved ); // Must be zero - UCHAR Buffer[1]; // File name -} REQ_QUERY_PATH_INFORMATION; -typedef REQ_QUERY_PATH_INFORMATION SMB_UNALIGNED *PREQ_QUERY_PATH_INFORMATION; - -// Data bytes for Query Path Information request are a list of extended -// attributes to retrieve, if InformationLevel is QUERY_EAS_FROM_LIST. - -typedef struct _RESP_QUERY_PATH_INFORMATION { - _USHORT( EaErrorOffset ); // Offset into EA list if EA error -} RESP_QUERY_PATH_INFORMATION; -typedef RESP_QUERY_PATH_INFORMATION SMB_UNALIGNED *PRESP_QUERY_PATH_INFORMATION; - -// Data bytes for Query Path Information response are level-dependent -// information about the specified path/file. - -// -// SetPathInformation function code of Transaction2 SMB, see #3 page 35 -// Function is SrvSmbSetPathInformation() -// TRANS2_SET_PATH_INFORMATION 0x06 -// - -typedef struct _REQ_SET_PATH_INFORMATION { - _USHORT( InformationLevel ); - _ULONG( Reserved ); // Must be zero - UCHAR Buffer[1]; // File name -} REQ_SET_PATH_INFORMATION; -typedef REQ_SET_PATH_INFORMATION SMB_UNALIGNED *PREQ_SET_PATH_INFORMATION; - -// Data bytes for Set Path Information request are either file information -// and attributes or a list of extended attributes for the file. - -typedef struct _RESP_SET_PATH_INFORMATION { - _USHORT( EaErrorOffset ); // Offset into EA list if EA error -} RESP_SET_PATH_INFORMATION; -typedef RESP_SET_PATH_INFORMATION SMB_UNALIGNED *PRESP_SET_PATH_INFORMATION; - -// The Set Path Information response has no data bytes. - -// -// QueryFileInformation function code of Transaction2 SMB, see #3 page 37 -// Function is SrvSmbQueryFileInformation() -// TRANS2_QUERY_FILE_INFORMATION 0x07 -// - -typedef struct _REQ_QUERY_FILE_INFORMATION { - _USHORT( Fid ); // File handle - _USHORT( InformationLevel ); -} REQ_QUERY_FILE_INFORMATION; -typedef REQ_QUERY_FILE_INFORMATION SMB_UNALIGNED *PREQ_QUERY_FILE_INFORMATION; - -// Data bytes for Query File Information request are a list of extended -// attributes to retrieve, if InformationLevel is QUERY_EAS_FROM_LIST. - -typedef struct _RESP_QUERY_FILE_INFORMATION { - _USHORT( EaErrorOffset ); // Offset into EA list if EA error -} RESP_QUERY_FILE_INFORMATION; -typedef RESP_QUERY_FILE_INFORMATION SMB_UNALIGNED *PRESP_QUERY_FILE_INFORMATION; - -// Data bytes for Query File Information response are level-dependent -// information about the specified path/file. - -// -// SetFileInformation function code of Transaction2 SMB, see #3 page 39 -// Function is SrvSmbSetFileInformation() -// TRANS2_SET_FILE_INFORMATION 0x08 -// - -typedef struct _REQ_SET_FILE_INFORMATION { - _USHORT( Fid ); // File handle - _USHORT( InformationLevel ); - _USHORT( Flags ); // File I/O control flags: bit set- - // 4 - write through - // 5 - no cache -} REQ_SET_FILE_INFORMATION; -typedef REQ_SET_FILE_INFORMATION SMB_UNALIGNED *PREQ_SET_FILE_INFORMATION; - -// Data bytes for Set File Information request are either file information -// and attributes or a list of extended attributes for the file. - -typedef struct _RESP_SET_FILE_INFORMATION { - _USHORT( EaErrorOffset ); // Offset into EA list if EA error -} RESP_SET_FILE_INFORMATION; -typedef RESP_SET_FILE_INFORMATION SMB_UNALIGNED *PRESP_SET_FILE_INFORMATION; - -// The Set File Information response has no data bytes. - -#endif // def INCLUDE_SMB_QUERY_SET - -// -// Opcodes for Mailslot transactions. Not all filled in at present. -// WARNING ... the info here on mailslots (opcode and smb struct) -// is duplicated in net/h/mslotsmb.h -// - -#define MS_WRITE_OPCODE 1 - -typedef struct _SMB_TRANSACT_MAILSLOT { - UCHAR WordCount; // Count of data bytes; value = 17 - _USHORT( TotalParameterCount ); // Total parameter bytes being sent - _USHORT( TotalDataCount ); // Total data bytes being sent - _USHORT( MaxParameterCount ); // Max parameter bytes to return - _USHORT( MaxDataCount ); // Max data bytes to return - UCHAR MaxSetupCount; // Max setup words to return - UCHAR Reserved; - _USHORT( Flags ); // Additional information: - // bit 0 - unused - // bit 1 - one-way transacion (no resp) - _ULONG( Timeout ); - _USHORT( Reserved1 ); - _USHORT( ParameterCount ); // Parameter bytes sent this buffer - _USHORT( ParameterOffset ); // Offset (from header start) to params - _USHORT( DataCount ); // Data bytes sent this buffer - _USHORT( DataOffset ); // Offset (from header start) to data - UCHAR SetupWordCount; // = 3 - UCHAR Reserved2; // Reserved (pad above to word) - _USHORT( Opcode ); // 1 -- Write Mailslot - _USHORT( Priority ); // Priority of transaction - _USHORT( Class ); // Class: 1 = reliable, 2 = unreliable - _USHORT( ByteCount ); // Count of data bytes - UCHAR Buffer[1]; // Buffer containing: - //UCHAR MailslotName[]; // "\MAILSLOT\0" - //UCHAR Pad[] // Pad to SHORT or LONG - //UCHAR Data[]; // Data to write to mailslot -} SMB_TRANSACT_MAILSLOT; -typedef SMB_TRANSACT_MAILSLOT SMB_UNALIGNED *PSMB_TRANSACT_MAILSLOT; - -typedef struct _SMB_TRANSACT_NAMED_PIPE { - UCHAR WordCount; // Count of data bytes; value = 16 - _USHORT( TotalParameterCount ); // Total parameter bytes being sent - _USHORT( TotalDataCount ); // Total data bytes being sent - _USHORT( MaxParameterCount ); // Max parameter bytes to return - _USHORT( MaxDataCount ); // Max data bytes to return - UCHAR MaxSetupCount; // Max setup words to return - UCHAR Reserved; - _USHORT( Flags ); // Additional information: - // bit 0 - also disconnect TID in Tid - // bit 1 - one-way transacion (no resp) - _ULONG( Timeout ); - _USHORT( Reserved1 ); - _USHORT( ParameterCount ); - // Buffer containing: - //UCHAR PipeName[]; // "\PIPE\0" - //UCHAR Pad[] // Pad to SHORT or LONG - //UCHAR Param[]; // Parameter bytes (# = ParameterCount) - //UCHAR Pad1[] // Pad to SHORT or LONG - //UCHAR Data[]; // Data bytes (# = DataCount) -} SMB_TRANSACT_NAMED_PIPE; -typedef SMB_TRANSACT_NAMED_PIPE SMB_UNALIGNED *PSMB_TRANSACT_NAMED_PIPE; - - -// -// Transaction - QueryInformationNamedPipe, Level 1, output data format -// - -typedef struct _NAMED_PIPE_INFORMATION_1 { - _USHORT( OutputBufferSize ); - _USHORT( InputBufferSize ); - UCHAR MaximumInstances; - UCHAR CurrentInstances; - UCHAR PipeNameLength; - UCHAR PipeName[1]; -} NAMED_PIPE_INFORMATION_1; -typedef NAMED_PIPE_INFORMATION_1 SMB_UNALIGNED *PNAMED_PIPE_INFORMATION_1; - -// -// Transaction - PeekNamedPipe, output format -// - -typedef struct _RESP_PEEK_NMPIPE { - _USHORT( ReadDataAvailable ); - _USHORT( MessageLength ); - _USHORT( NamedPipeState ); - //UCHAR Pad[]; - //UCHAR Data[]; -} RESP_PEEK_NMPIPE; -typedef RESP_PEEK_NMPIPE SMB_UNALIGNED *PRESP_PEEK_NMPIPE; - -// -// Define SMB pipe handle state bits used by Query/SetNamedPipeHandleState -// -// These number are the bit location of the fields in the handle state. -// - -#define PIPE_COMPLETION_MODE_BITS 15 -#define PIPE_PIPE_END_BITS 14 -#define PIPE_PIPE_TYPE_BITS 10 -#define PIPE_READ_MODE_BITS 8 -#define PIPE_MAXIMUM_INSTANCES_BITS 0 - -/* DosPeekNmPipe() pipe states */ - -#define PIPE_STATE_DISCONNECTED 0x0001 -#define PIPE_STATE_LISTENING 0x0002 -#define PIPE_STATE_CONNECTED 0x0003 -#define PIPE_STATE_CLOSING 0x0004 - -/* DosCreateNPipe and DosQueryNPHState state */ - -#define SMB_PIPE_READMODE_BYTE 0x0000 -#define SMB_PIPE_READMODE_MESSAGE 0x0100 -#define SMB_PIPE_TYPE_BYTE 0x0000 -#define SMB_PIPE_TYPE_MESSAGE 0x0400 -#define SMB_PIPE_END_CLIENT 0x0000 -#define SMB_PIPE_END_SERVER 0x4000 -#define SMB_PIPE_WAIT 0x0000 -#define SMB_PIPE_NOWAIT 0x8000 -#define SMB_PIPE_UNLIMITED_INSTANCES 0x00FF - - -// -// Pipe name string for conversion between SMB and NT formats. -// - -#define SMB_PIPE_PREFIX "\\PIPE" -#define UNICODE_SMB_PIPE_PREFIX L"\\PIPE" -#define CANONICAL_PIPE_PREFIX "PIPE\\" -#define NT_PIPE_PREFIX L"\\Device\\NamedPipe" - -#define SMB_PIPE_PREFIX_LENGTH (sizeof(SMB_PIPE_PREFIX) - 1) -#define UNICODE_SMB_PIPE_PREFIX_LENGTH \ - (sizeof(UNICODE_SMB_PIPE_PREFIX) - sizeof(WCHAR)) -#define CANONICAL_PIPE_PREFIX_LENGTH (sizeof(CANONICAL_PIPE_PREFIX) - 1) -#define NT_PIPE_PREFIX_LENGTH (sizeof(NT_PIPE_PREFIX) - sizeof(WCHAR)) - -// -// Mailslot name strings. -// - -#define SMB_MAILSLOT_PREFIX "\\MAILSLOT" -#define UNICODE_SMB_MAILSLOT_PREFIX L"\\MAILSLOT" - -#define SMB_MAILSLOT_PREFIX_LENGTH (sizeof(SMB_MAILSLOT_PREFIX) - 1) -#define UNICODE_SMB_MAILSLOT_PREFIX_LENGTH \ - (sizeof(UNICODE_SMB_MAILSLOT_PREFIX) - sizeof(WCHAR)) - -// -// NT Transaction subfunctions -// - -#ifdef INCLUDE_SMB_OPEN_CLOSE - -typedef struct _REQ_CREATE_WITH_SD_OR_EA { - _ULONG( Flags ); // Creation flags - _ULONG( RootDirectoryFid ); // Optional directory for relative open - ACCESS_MASK DesiredAccess; // Desired access (NT format) - LARGE_INTEGER AllocationSize; // The initial allocation size in bytes - _ULONG( FileAttributes ); // The file attributes - _ULONG( ShareAccess ); // The share access - _ULONG( CreateDisposition ); // Action to take if file exists or not - _ULONG( CreateOptions ); // Options for creating a new file - _ULONG( SecurityDescriptorLength );// Length of SD in bytes - _ULONG( EaLength ); // Length of EA in bytes - _ULONG( NameLength ); // Length of name in characters - _ULONG( ImpersonationLevel ); // Security QOS information - UCHAR SecurityFlags; // Security QOS information - UCHAR Buffer[1]; - //UCHAR Name[]; // The name of the file (not NUL terminated) -} REQ_CREATE_WITH_SD_OR_EA; -typedef REQ_CREATE_WITH_SD_OR_EA SMB_UNALIGNED *PREQ_CREATE_WITH_SD_OR_EA; - -// -// Data format: -// UCHAR SecurityDesciptor[]; -// UCHAR Pad1[]; // Pad to LONG -// UCHAR EaList[]; -// - -typedef struct _RESP_CREATE_WITH_SD_OR_EA { - UCHAR OplockLevel; // The oplock level granted - UCHAR Reserved; - _USHORT( Fid ); // The file ID - _ULONG( CreateAction ); // The action taken - _ULONG( EaErrorOffset ); // Offset of the EA error - TIME CreationTime; // The time the file was created - TIME LastAccessTime; // The time the file was accessed - TIME LastWriteTime; // The time the file was last written - TIME ChangeTime; // The time the file was last changed - _ULONG( FileAttributes ); // The file attributes - LARGE_INTEGER AllocationSize; // The number of byes allocated - LARGE_INTEGER EndOfFile; // The end of file offset - _USHORT( FileType ); - _USHORT( DeviceState ); // state of IPC device (e.g. pipe) - BOOLEAN Directory; // TRUE if this is a directory -} RESP_CREATE_WITH_SD_OR_EA; -typedef RESP_CREATE_WITH_SD_OR_EA SMB_UNALIGNED *PRESP_CREATE_WITH_SD_OR_EA; - -// No data bytes for the response - - -#endif // INCLUDE_SMB_OPEN_CLOSE - -// -// Setup words for NT I/O control request -// - -typedef struct _REQ_NT_IO_CONTROL { - _ULONG( FunctionCode ); - _USHORT( Fid ); - BOOLEAN IsFsctl; - UCHAR IsFlags; -} REQ_NT_IO_CONTROL; -typedef REQ_NT_IO_CONTROL SMB_UNALIGNED *PREQ_NT_IO_CONTROL; - -// -// Request parameter bytes - The first buffer -// Request data bytes - The second buffer -// - -// -// NT I/O Control response: -// -// Setup Words: None. -// Parameter Bytes: First buffer. -// Data Bytes: Second buffer. -// - -// -// NT Notify directory change -// - -// Request Setup Words - -typedef struct _REQ_NOTIFY_CHANGE { - _ULONG( CompletionFilter ); // Specifies operation to monitor - _USHORT( Fid ); // Fid of directory to monitor - BOOLEAN WatchTree; // TRUE = watch all subdirectories too - UCHAR Reserved; // MBZ -} REQ_NOTIFY_CHANGE; -typedef REQ_NOTIFY_CHANGE SMB_UNALIGNED *PREQ_NOTIFY_CHANGE; - -// -// Request parameter bytes: None -// Request data bytes: None -// - -// -// NT Notify directory change response -// -// Setup words: None. -// Parameter bytes: The change data buffer. -// Data bytes: None. -// - -// -// NT Set Security Descriptor request -// -// Setup words: REQ_SET_SECURITY_DESCIPTOR. -// Parameter Bytes: None. -// Data Bytes: The Security Descriptor data. -// - -typedef struct _REQ_SET_SECURITY_DESCRIPTOR { - _USHORT( Fid ); // FID of target - _USHORT( Reserved ); // MBZ - _ULONG( SecurityInformation ); // Fields of SD that to set -} REQ_SET_SECURITY_DESCRIPTOR; -typedef REQ_SET_SECURITY_DESCRIPTOR SMB_UNALIGNED *PREQ_SET_SECURITY_DESCRIPTOR; - -// -// NT Set Security Desciptor response -// -// Setup words: None. -// Parameter Bytes: None. -// Data Bytes: None. -// - -// -// NT Query Security Descriptor request -// -// Setup words: None. -// Parameter Bytes: REQ_QUERY_SECURITY_DESCRIPTOR. -// Data Bytes: None. -// - -typedef struct _REQ_QUERY_SECURITY_DESCRIPTOR { - _USHORT( Fid ); // FID of target - _USHORT( Reserved ); // MBZ - _ULONG( SecurityInformation ); // Fields of SD that to query -} REQ_QUERY_SECURITY_DESCRIPTOR; -typedef REQ_QUERY_SECURITY_DESCRIPTOR SMB_UNALIGNED *PREQ_QUERY_SECURITY_DESCRIPTOR; - -// -// NT Query Security Desciptor response -// -// Parameter bytes: RESP_QUERY_SECURITY_DESCRIPTOR -// Data Bytes: The Security Descriptor data. -// - -typedef struct _RESP_QUERY_SECURITY_DESCRIPTOR { - _ULONG( LengthNeeded ); // Size of data buffer required for SD -} RESP_QUERY_SECURITY_DESCRIPTOR; -typedef RESP_QUERY_SECURITY_DESCRIPTOR SMB_UNALIGNED *PRESP_QUERY_SECURITY_DESCRIPTOR; - -// -// NT Rename file -// -// Setup words: None -// Parameters bytes: REQ_NT_RENAME -// Data bytes: None -// - -typedef struct _REQ_NT_RENAME { - _USHORT( Fid ); // FID of file to rename - _USHORT( RenameFlags ); // defined below - UCHAR NewName[]; // New file name. -} REQ_NT_RENAME; -typedef REQ_NT_RENAME SMB_UNALIGNED *PREQ_NT_RENAME; - -// -// Rename flags defined -// - -#define SMB_RENAME_REPLACE_IF_EXISTS 1 - -// -// Turn structure packing back off -// - -#ifndef NO_PACKING -#include -#endif // ndef NO_PACKING - -// -// The following macros store and retrieve USHORTS and ULONGS from -// potentially unaligned addresses, avoiding alignment faults. They -// would best be written as inline assembly code. -// -// The macros are designed to be used for accessing SMB fields. Such -// fields are always stored in little-endian byte order, so these macros -// do byte swapping when compiled for a big-endian machine. -// -// !!! Not yet. -// - -#if !SMBDBG - -#define BYTE_0_MASK 0xFF - -#define BYTE_0(Value) (UCHAR)( (Value) & BYTE_0_MASK) -#define BYTE_1(Value) (UCHAR)( ((Value) >> 8) & BYTE_0_MASK) -#define BYTE_2(Value) (UCHAR)( ((Value) >> 16) & BYTE_0_MASK) -#define BYTE_3(Value) (UCHAR)( ((Value) >> 24) & BYTE_0_MASK) - -#endif - -//++ -// -// USHORT -// SmbGetUshort ( -// IN PSMB_USHORT SrcAddress -// ) -// -// Routine Description: -// -// This macro retrieves a USHORT value from the possibly misaligned -// source address, avoiding alignment faults. -// -// Arguments: -// -// SrcAddress - where to retrieve USHORT value from -// -// Return Value: -// -// USHORT - the value retrieved. The target must be aligned. -// -//-- - -#if !SMBDBG - -#if !SMBDBG1 -#if SMB_USE_UNALIGNED -#define SmbGetUshort(SrcAddress) *(PSMB_USHORT)(SrcAddress) -#else -#define SmbGetUshort(SrcAddress) (USHORT)( \ - ( ( (PUCHAR)(SrcAddress) )[0] ) | \ - ( ( (PUCHAR)(SrcAddress) )[1] << 8 ) \ - ) -#endif -#else -#define SmbGetUshort(SrcAddress) (USHORT)( \ - ( ( (PUCHAR)(SrcAddress ## S) )[0] ) | \ - ( ( (PUCHAR)(SrcAddress ## S) )[1] << 8 ) \ - ) -#endif - -#else - -USHORT -SmbGetUshort ( - IN PSMB_USHORT SrcAddress - ); - -#endif - -//++ -// -// USHORT -// SmbGetAlignedUshort ( -// IN PUSHORT SrcAddress -// ) -// -// Routine Description: -// -// This macro retrieves a USHORT value from the source address, -// correcting for the endian characteristics of the server if -// necessary. -// -// Arguments: -// -// SrcAddress - where to retrieve USHORT value from; must be aligned. -// -// Return Value: -// -// USHORT - the value retrieved. The target must be aligned. -// -//-- - -#if !SMBDBG - -#if !SMBDBG1 -#define SmbGetAlignedUshort(SrcAddress) *(SrcAddress) -#else -#define SmbGetAlignedUshort(SrcAddress) *(SrcAddress ## S) -#endif - -#else - -USHORT -SmbGetAlignedUshort ( - IN PUSHORT SrcAddress - ); - -#endif - -//++ -// -// VOID -// SmbPutUshort ( -// OUT PSMB_USHORT DestAddress, -// IN USHORT Value -// ) -// -// Routine Description: -// -// This macro stores a USHORT value at the possibly misaligned -// destination address, avoiding alignment faults. -// -// Arguments: -// -// DestAddress - where to store USHORT value. Address may be -// misaligned. -// -// Value - USHORT to store. Value must be a constant or an aligned -// field. -// -// Return Value: -// -// None. -// -//-- - -#if !SMBDBG - -#if !SMBDBG1 -#if SMB_USE_UNALIGNED -#define SmbPutUshort(SrcAddress, Value) \ - *(PSMB_USHORT)(SrcAddress) = (Value) -#else -#define SmbPutUshort(DestAddress,Value) { \ - ( (PUCHAR)(DestAddress) )[0] = BYTE_0(Value); \ - ( (PUCHAR)(DestAddress) )[1] = BYTE_1(Value); \ - } -#endif -#else -#define SmbPutUshort(DestAddress,Value) { \ - ( (PUCHAR)(DestAddress ## S) )[0] = BYTE_0(Value); \ - ( (PUCHAR)(DestAddress ## S) )[1] = BYTE_1(Value); \ - } -#endif - -#else - -VOID -SmbPutUshort ( - OUT PSMB_USHORT DestAddress, - IN USHORT Value - ); - -#endif - -//++ -// -// VOID -// SmbPutAlignedUshort ( -// OUT PUSHORT DestAddres, -// IN USHORT Value -// ) -// -// Routine Description: -// -// This macro stores a USHORT value from the source address, -// correcting for the endian characteristics of the server if -// necessary. -// -// Arguments: -// -// DestAddress - where to store USHORT value. Address may not be -// misaligned. -// -// Value - USHORT to store. Value must be a constant or an aligned -// field. -// -// Return Value: -// -// None. -// -//-- - -#if !SMBDBG - -#if !SMBDBG1 -#define SmbPutAlignedUshort(DestAddress,Value) *(DestAddress) = (Value) -#else -#define SmbPutAlignedUshort(DestAddress,Value) *(DestAddress ## S) = (Value) -#endif - -#else - -VOID -SmbPutAlignedUshort ( - OUT PUSHORT DestAddress, - IN USHORT Value - ); - -#endif - -//++ -// -// VOID -// SmbMoveUshort ( -// OUT PSMB_USHORT DestAddress -// IN PSMB_USHORT SrcAddress -// ) -// -// Routine Description: -// -// This macro moves a USHORT value from the possibly misaligned -// source address to the possibly misaligned destination address, -// avoiding alignment faults. -// -// Arguments: -// -// DestAddress - where to store USHORT value -// -// SrcAddress - where to retrieve USHORT value from -// -// Return Value: -// -// None. -// -//-- - -#if !SMBDBG - -#if !SMBDBG1 -#if SMB_USE_UNALIGNED -#define SmbMoveUshort(DestAddress, SrcAddress) \ - *(PSMB_USHORT)(DestAddress) = *(PSMB_USHORT)(SrcAddress) -#else -#define SmbMoveUshort(DestAddress,SrcAddress) { \ - ( (PUCHAR)(DestAddress) )[0] = ( (PUCHAR)(SrcAddress) )[0]; \ - ( (PUCHAR)(DestAddress) )[1] = ( (PUCHAR)(SrcAddress) )[1]; \ - } -#endif -#else -#define SmbMoveUshort(DestAddress,SrcAddress) { \ - ( (PUCHAR)(DestAddress ## S) )[0] = ( (PUCHAR)(SrcAddress ## S) )[0]; \ - ( (PUCHAR)(DestAddress ## S) )[1] = ( (PUCHAR)(SrcAddress ## S) )[1]; \ - } -#endif - -#else - -VOID -SmbMoveUshort ( - OUT PSMB_USHORT DestAddress, - IN PSMB_USHORT SrcAddress - ); - -#endif - -//++ -// -// ULONG -// SmbGetUlong ( -// IN PSMB_ULONG SrcAddress -// ) -// -// Routine Description: -// -// This macro retrieves a ULONG value from the possibly misaligned -// source address, avoiding alignment faults. -// -// Arguments: -// -// SrcAddress - where to retrieve ULONG value from -// -// Return Value: -// -// ULONG - the value retrieved. The target must be aligned. -// -//-- - -#if !SMBDBG - -#if !SMBDBG1 -#if SMB_USE_UNALIGNED -#define SmbGetUlong(SrcAddress) *(PSMB_ULONG)(SrcAddress) -#else -#define SmbGetUlong(SrcAddress) (ULONG)( \ - ( ( (PUCHAR)(SrcAddress) )[0] ) | \ - ( ( (PUCHAR)(SrcAddress) )[1] << 8 ) | \ - ( ( (PUCHAR)(SrcAddress) )[2] << 16 ) | \ - ( ( (PUCHAR)(SrcAddress) )[3] << 24 ) \ - ) -#endif -#else -#define SmbGetUlong(SrcAddress) (ULONG)( \ - ( ( (PUCHAR)(SrcAddress ## L) )[0] ) | \ - ( ( (PUCHAR)(SrcAddress ## L) )[1] << 8 ) | \ - ( ( (PUCHAR)(SrcAddress ## L) )[2] << 16 ) | \ - ( ( (PUCHAR)(SrcAddress ## L) )[3] << 24 ) \ - ) -#endif - -#else - -ULONG -SmbGetUlong ( - IN PSMB_ULONG SrcAddress - ); - -#endif - -//++ -// -// USHORT -// SmbGetAlignedUlong ( -// IN PULONG SrcAddress -// ) -// -// Routine Description: -// -// This macro retrieves a ULONG value from the source address, -// correcting for the endian characteristics of the server if -// necessary. -// -// Arguments: -// -// SrcAddress - where to retrieve ULONG value from; must be aligned. -// -// Return Value: -// -// ULONG - the value retrieved. The target must be aligned. -// -//-- - -#if !SMBDBG - -#if !SMBDBG1 -#define SmbGetAlignedUlong(SrcAddress) *(SrcAddress) -#else -#define SmbGetAlignedUlong(SrcAddress) *(SrcAddress ## L) -#endif - -#else - -ULONG -SmbGetAlignedUlong ( - IN PULONG SrcAddress - ); - -#endif - -//++ -// -// VOID -// SmbPutUlong ( -// OUT PSMB_ULONG DestAddress, -// IN ULONG Value -// ) -// -// Routine Description: -// -// This macro stores a ULONG value at the possibly misaligned -// destination address, avoiding alignment faults. -// -// Arguments: -// -// DestAddress - where to store ULONG value -// -// Value - ULONG to store. Value must be a constant or an aligned -// field. -// -// Return Value: -// -// None. -// -//-- - -#if !SMBDBG - -#if !SMBDBG1 -#if SMB_USE_UNALIGNED -#define SmbPutUlong(SrcAddress, Value) *(PSMB_ULONG)(SrcAddress) = Value -#else -#define SmbPutUlong(DestAddress,Value) { \ - ( (PUCHAR)(DestAddress) )[0] = BYTE_0(Value); \ - ( (PUCHAR)(DestAddress) )[1] = BYTE_1(Value); \ - ( (PUCHAR)(DestAddress) )[2] = BYTE_2(Value); \ - ( (PUCHAR)(DestAddress) )[3] = BYTE_3(Value); \ - } -#endif -#else -#define SmbPutUlong(DestAddress,Value) { \ - ( (PUCHAR)(DestAddress ## L) )[0] = BYTE_0(Value); \ - ( (PUCHAR)(DestAddress ## L) )[1] = BYTE_1(Value); \ - ( (PUCHAR)(DestAddress ## L) )[2] = BYTE_2(Value); \ - ( (PUCHAR)(DestAddress ## L) )[3] = BYTE_3(Value); \ - } -#endif - -#else - -VOID -SmbPutUlong ( - OUT PSMB_ULONG DestAddress, - IN ULONG Value - ); - -#endif - -//++ -// -// VOID -// SmbPutAlignedUlong ( -// OUT PULONG DestAddres, -// IN ULONG Value -// ) -// -// Routine Description: -// -// This macro stores a ULONG value from the source address, -// correcting for the endian characteristics of the server if -// necessary. -// -// Arguments: -// -// DestAddress - where to store ULONG value. Address may not be -// misaligned. -// -// Value - ULONG to store. Value must be a constant or an aligned -// field. -// -// Return Value: -// -// None. -// -//-- - -#if !SMBDBG - -#if !SMBDBG1 -#define SmbPutAlignedUlong(DestAddress,Value) *(DestAddress) = (Value) -#else -#define SmbPutAlignedUlong(DestAddress,Value) *(DestAddress ## L) = (Value) -#endif - -#else - -VOID -SmbPutAlignedUlong ( - OUT PULONG DestAddress, - IN ULONG Value - ); - -#endif - -//++ -// -// VOID -// SmbMoveUlong ( -// OUT PSMB_ULONG DestAddress, -// IN PSMB_ULONG SrcAddress -// ) -// -// Routine Description: -// -// This macro moves a ULONG value from the possibly misaligned -// source address to the possible misaligned destination address, -// avoiding alignment faults. -// -// Arguments: -// -// DestAddress - where to store ULONG value -// -// SrcAddress - where to retrieve ULONG value from -// -// Return Value: -// -// None. -// -//-- - -#if !SMBDBG - -#if !SMBDBG1 -#if SMB_USE_UNALIGNED -#define SmbMoveUlong(DestAddress,SrcAddress) \ - *(PSMB_ULONG)(DestAddress) = *(PSMB_ULONG)(SrcAddress) -#else -#define SmbMoveUlong(DestAddress,SrcAddress) { \ - ( (PUCHAR)(DestAddress) )[0] = ( (PUCHAR)(SrcAddress) )[0]; \ - ( (PUCHAR)(DestAddress) )[1] = ( (PUCHAR)(SrcAddress) )[1]; \ - ( (PUCHAR)(DestAddress) )[2] = ( (PUCHAR)(SrcAddress) )[2]; \ - ( (PUCHAR)(DestAddress) )[3] = ( (PUCHAR)(SrcAddress) )[3]; \ - } -#endif -#else -#define SmbMoveUlong(DestAddress,SrcAddress) { \ - ( (PUCHAR)(DestAddress ## L) )[0] = ( (PUCHAR)(SrcAddress ## L) )[0]; \ - ( (PUCHAR)(DestAddress ## L) )[1] = ( (PUCHAR)(SrcAddress ## L) )[1]; \ - ( (PUCHAR)(DestAddress ## L) )[2] = ( (PUCHAR)(SrcAddress ## L) )[2]; \ - ( (PUCHAR)(DestAddress ## L) )[3] = ( (PUCHAR)(SrcAddress ## L) )[3]; \ - } -#endif - -#else - -VOID -SmbMoveUlong ( - OUT PSMB_ULONG DestAddress, - IN PSMB_ULONG SrcAddress - ); - -#endif - -//++ -// -// VOID -// SmbPutDate ( -// OUT PSMB_DATE DestAddress, -// IN SMB_DATE Value -// ) -// -// Routine Description: -// -// This macro stores an SMB_DATE value at the possibly misaligned -// destination address, avoiding alignment faults. This macro -// is different from SmbPutUshort in order to be able to handle -// funny bitfield / big-endian interactions. -// -// Arguments: -// -// DestAddress - where to store SMB_DATE value -// -// Value - SMB_DATE to store. Value must be a constant or an -// aligned field. -// -// Return Value: -// -// None. -// -//-- - -#if !SMBDBG - -#if SMB_USE_UNALIGNED -#define SmbPutDate(DestAddress,Value) (DestAddress)->Ushort = (Value).Ushort -#else -#define SmbPutDate(DestAddress,Value) { \ - ( (PUCHAR)&(DestAddress)->Ushort )[0] = BYTE_0((Value).Ushort); \ - ( (PUCHAR)&(DestAddress)->Ushort )[1] = BYTE_1((Value).Ushort); \ - } -#endif - -#else - -VOID -SmbPutDate ( - OUT PSMB_DATE DestAddress, - IN SMB_DATE Value - ); - -#endif - -//++ -// -// VOID -// SmbMoveDate ( -// OUT PSMB_DATE DestAddress, -// IN PSMB_DATE SrcAddress -// ) -// -// Routine Description: -// -// This macro copies an SMB_DATE value from the possibly misaligned -// source address, avoiding alignment faults. This macro is -// different from SmbGetUshort in order to be able to handle funny -// bitfield / big-endian interactions. -// -// Note that there is no SmbGetDate because of the way SMB_DATE is -// defined. It is a union containing a USHORT and a bitfield -// struct. The caller of an SmbGetDate macro would have to -// explicitly use one part of the union. -// -// Arguments: -// -// DestAddress - where to store SMB_DATE value. MUST BE ALIGNED! -// -// SrcAddress - where to retrieve SMB_DATE value from -// -// Return Value: -// -// None. -// -//-- - -#if !SMBDBG - -#if SMB_USE_UNALIGNED -#define SmbMoveDate(DestAddress,SrcAddress) \ - (DestAddress)->Ushort = (SrcAddress)->Ushort -#else -#define SmbMoveDate(DestAddress,SrcAddress) \ - (DestAddress)->Ushort = \ - ( ( (PUCHAR)&(SrcAddress)->Ushort )[0] ) | \ - ( ( (PUCHAR)&(SrcAddress)->Ushort )[1] << 8 ) -#endif - -#else - -VOID -SmbMoveDate ( - OUT PSMB_DATE DestAddress, - IN PSMB_DATE SrcAddress - ); - -#endif - -//++ -// -// VOID -// SmbZeroDate ( -// IN PSMB_DATE Date -// ) -// -// Routine Description: -// -// This macro zeroes a possibly misaligned SMB_DATE field. -// -// Arguments: -// -// Date - Pointer to SMB_DATE field to zero. -// -// Return Value: -// -// None. -// -//-- - -#if !SMBDBG - -#if SMB_USE_UNALIGNED -#define SmbZeroDate(Date) (Date)->Ushort = 0 -#else -#define SmbZeroDate(Date) { \ - ( (PUCHAR)&(Date)->Ushort )[0] = 0; \ - ( (PUCHAR)&(Date)->Ushort )[1] = 0; \ - } -#endif - -#else - -VOID -SmbZeroDate ( - IN PSMB_DATE Date - ); - -#endif - -//++ -// -// BOOLEAN -// SmbIsDateZero ( -// IN PSMB_DATE Date -// ) -// -// Routine Description: -// -// This macro returns TRUE if the supplied SMB_DATE value is zero. -// -// Arguments: -// -// Date - Pointer to SMB_DATE value to check. MUST BE ALIGNED! -// -// Return Value: -// -// BOOLEAN - TRUE if Date is zero, else FALSE. -// -//-- - -#if !SMBDBG - -#define SmbIsDateZero(Date) ( (Date)->Ushort == 0 ) - -#else - -BOOLEAN -SmbIsDateZero ( - IN PSMB_DATE Date - ); - -#endif - -//++ -// -// VOID -// SmbPutTime ( -// OUT PSMB_TIME DestAddress, -// IN SMB_TIME Value -// ) -// -// Routine Description: -// -// This macro stores an SMB_TIME value at the possibly misaligned -// destination address, avoiding alignment faults. This macro -// is different from SmbPutUshort in order to be able to handle -// funny bitfield / big-endian interactions. -// -// Arguments: -// -// DestAddress - where to store SMB_TIME value -// -// Value - SMB_TIME to store. Value must be a constant or an -// aligned field. -// -// Return Value: -// -// None. -// -//-- - -#if !SMBDBG - -#if SMB_USE_UNALIGNED -#define SmbPutTime(DestAddress,Value) (DestAddress)->Ushort = (Value).Ushort -#else -#define SmbPutTime(DestAddress,Value) { \ - ( (PUCHAR)&(DestAddress)->Ushort )[0] = BYTE_0((Value).Ushort); \ - ( (PUCHAR)&(DestAddress)->Ushort )[1] = BYTE_1((Value).Ushort); \ - } -#endif - -#else - -VOID -SmbPutTime ( - OUT PSMB_TIME DestAddress, - IN SMB_TIME Value - ); - -#endif - -//++ -// -// VOID -// SmbMoveTime ( -// OUT PSMB_TIME DestAddress, -// IN PSMB_TIME SrcAddress -// ) -// -// Routine Description: -// -// This macro copies an SMB_TIME value from the possibly -// misaligned source address, avoiding alignment faults. This macro -// is different from SmbGetUshort in order to be able to handle -// funny bitfield / big-endian interactions. -// -// Note that there is no SmbGetTime because of the way SMB_TIME is -// defined. It is a union containing a USHORT and a bitfield -// struct. The caller of an SmbGetTime macro would have to -// explicitly use one part of the union. -// -// Arguments: -// -// DestAddress - where to store SMB_TIME value. MUST BE ALIGNED! -// -// SrcAddress - where to retrieve SMB_TIME value from -// -// Return Value: -// -// None. -// -//-- - -#if !SMBDBG - -#if SMB_USE_UNALIGNED -#define SmbMoveTime(DestAddress,SrcAddress) \ - (DestAddress)->Ushort = (SrcAddress)->Ushort -#else -#define SmbMoveTime(DestAddress,SrcAddress) \ - (DestAddress)->Ushort = \ - ( ( (PUCHAR)&(SrcAddress)->Ushort )[0] ) | \ - ( ( (PUCHAR)&(SrcAddress)->Ushort )[1] << 8 ) -#endif - -#else - -VOID -SmbMoveTime ( - OUT PSMB_TIME DestAddress, - IN PSMB_TIME SrcAddress - ); - -#endif - -//++ -// -// VOID -// SmbZeroTime ( -// IN PSMB_TIME Time -// ) -// -// Routine Description: -// -// This macro zeroes a possibly misaligned SMB_TIME field. -// -// Arguments: -// -// Time - Pointer to SMB_TIME field to zero. -// -// Return Value: -// -// None. -// -//-- - -#if !SMBDBG - -#if SMB_USE_UNALIGNED -#define SmbZeroTime(Time) (Time)->Ushort = 0 -#else -#define SmbZeroTime(Time) { \ - ( (PUCHAR)&(Time)->Ushort )[0] = 0; \ - ( (PUCHAR)&(Time)->Ushort )[1] = 0; \ - } -#endif - -#else - -VOID -SmbZeroTime ( - IN PSMB_TIME Time - ); - -#endif - -//++ -// -// BOOLEAN -// SmbIsTimeZero ( -// IN PSMB_TIME Time -// ) -// -// Routine Description: -// -// This macro returns TRUE if the supplied SMB_TIME value is zero. -// -// Arguments: -// -// Time - Pointer to SMB_TIME value to check. Must be aligned and -// in native format! -// -// Return Value: -// -// BOOLEAN - TRUE if Time is zero, else FALSE. -// -//-- - -#if !SMBDBG - -#define SmbIsTimeZero(Time) ( (Time)->Ushort == 0 ) - -#else - -BOOLEAN -SmbIsTimeZero ( - IN PSMB_TIME Time - ); - -#endif - - -// -// -// Define protocol names -// -// - - -// -// PCNET1 is the original SMB protocol (CORE). -// - -#define PCNET1 "PC NETWORK PROGRAM 1.0" - -// -// Some versions of the original MSNET defined this as an alternate -// to the core protocol name -// - -#define PCLAN1 "PCLAN1.0" - -// -// This is used for the MS-NET 1.03 product. It defines Lock&Read, -// Write&Unlock, and a special version of raw read and raw write. -// -#define MSNET103 "MICROSOFT NETWORKS 1.03" - -// -// This is the DOS Lanman 1.0 specific protocol. It is equivilant -// to the LANMAN 1.0 protocol, except the server is required to -// map errors from the OS/2 error to an appropriate DOS error. -// -#define MSNET30 "MICROSOFT NETWORKS 3.0" - -// -// This is the first version of the full LANMAN 1.0 protocol, defined in -// the SMB FILE SHARING PROTOCOL EXTENSIONS VERSION 2.0 document. -// - -#define LANMAN10 "LANMAN1.0" - -// -// This is the first version of the full LANMAN 2.0 protocol, defined in -// the SMB FILE SHARING PROTOCOL EXTENSIONS VERSION 3.0 document. Note -// that the name is an interim protocol definition. This is for -// interoperability with IBM LAN SERVER 1.2 -// - -#define LANMAN12 "LM1.2X002" - -// -// This is the dos equivilant of the LANMAN12 protocol. It is identical -// to the LANMAN12 protocol, but the server will perform error mapping -// to appropriate DOS errors. -// -#define DOSLANMAN12 "DOS LM1.2X002" /* DOS equivalant of above. Final - * string will be "DOS LANMAN2.0" */ - -// -// Strings for LANMAN 2.1. -// -#define LANMAN21 "LANMAN2.1" -#define DOSLANMAN21 "DOS LANMAN2.1" - -// -// !!! Do not set to final protcol string until the spec -// is cast in stone. -// -// The SMB protocol designed for NT. This has special SMBs -// which duplicate the NT semantics. -// -#define NTLANMAN "NT LM 0.12" - - -// -// The XENIXCORE dialect is a bit special. It is identical to core, -// except user passwords are not to be uppercased before being shipped -// to the server -// -#define XENIXCORE "XENIX CORE" - - -// -// Windows for Workgroups V1.0 -// -#define WFW10 "Windows for Workgroups 3.1a" - - -#define PCNET1_SZ 22 -#define PCLAN1_SZ 8 - -#define MSNET103_SZ 23 -#define MSNET30_SZ 22 - -#define LANMAN10_SZ 9 -#define LANMAN12_SZ 9 - -#define DOSLANMAN12_SZ 13 - - - -/* - * Defines and data for Negotiate Protocol - */ -#define PC1 0 -#define PC2 1 -#define LM1 2 -#define MS30 3 -#define MS103 4 -#define LM12 5 -#define DOSLM12 6 - - -/* Protocol indexes definition. */ -#define PCLAN 1 /* PC Lan 1.0 & MS Lan 1.03 */ -#define MSNT30 2 /* MS Net 3.0 redirector */ -#define DOSLM20 3 /* Dos LAN Manager 2.0 */ -#define LANMAN 4 /* Lanman redirector */ -#define LANMAN20 5 /* Lan Manager 2.0 */ - -// -// Protocol specific path constraints. -// - -#define MAXIMUM_PATHLEN_LANMAN12 260 -#define MAXIMUM_PATHLEN_CORE 128 - -#define MAXIMUM_COMPONENT_LANMAN12 254 -#define MAXIMUM_COMPONENT_CORE 8+1+3 // 8.3 filenames. - - - -#endif // _CIFS_ - - diff --git a/pub/ddk/classpnp.h b/pub/ddk/classpnp.h deleted file mode 100644 index 96e64dd..0000000 --- a/pub/ddk/classpnp.h +++ /dev/null @@ -1,3306 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - classpnp.h - -Abstract: - - These are the structures and defines that are used in the - SCSI class drivers. - ---*/ - -#ifndef _CLASS_ -#define _CLASS_ - -#include -#include -#include -#include -#include "ntddstor.h" - -#include - -#include - -#if defined DebugPrint - #undef DebugPrint -#endif - -#ifdef TRY - #undef TRY -#endif -#ifdef LEAVE - #undef LEAVE -#endif -#ifdef FINALLY - #undef FINALLY -#endif - -#define TRY -#define LEAVE goto __tryLabel; -#define FINALLY __tryLabel: - -// #define ALLOCATE_SRB_FROM_POOL - -// -// describes the well-known bit masks for ClassDebug, and describes the bits -// to enable in the debugger to view just those messages. ClassDebugExternalX -// are reserved for third-party components' debugging use. Anything above -// 16 will only be printed if the lower two bytes of ClassDebug are higher -// than the given level (no masking will be available). -// - -typedef enum _CLASS_DEBUG_LEVEL { - ClassDebugError = 0, // always printed - ClassDebugWarning = 1, // set bit 0x00010000 in ClassDebug - ClassDebugTrace = 2, // set bit 0x00020000 in ClassDebug - ClassDebugInfo = 3, // set bit 0x00040000 in ClassDebug -#if 0 - ClassDebug Internal = 4, // set bit 0x00080000 in ClassDebug - - ClassDebug Internal = 5, // set bit 0x00100000 in ClassDebug - ClassDebug Internal = 6, // set bit 0x00200000 in ClassDebug - ClassDebug Internal = 7, // set bit 0x00400000 in ClassDebug -#endif // 0 - ClassDebugMediaLocks = 8, // set bit 0x00800000 in ClassDebug - - ClassDebugMCN = 9, // set bit 0x01000000 in ClassDebug - ClassDebugDelayedRetry = 10, // set bit 0x02000000 in ClassDebug - ClassDebugSenseInfo = 11, // set bit 0x04000000 in ClassDebug - ClassDebugRemoveLock = 12, // set bit 0x08000000 in ClassDebug - - ClassDebugExternal4 = 13, // set bit 0x10000000 in ClassDebug - ClassDebugExternal3 = 14, // set bit 0x20000000 in ClassDebug - ClassDebugExternal2 = 15, // set bit 0x40000000 in ClassDebug - ClassDebugExternal1 = 16 // set bit 0x80000000 in ClassDebug -} CLASS_DEBUG_LEVEL, *PCLASS_DEBUG_LEVEL; - -#if DBG - -#define DebugPrint(x) ClassDebugPrint x - -#else - -#define DebugPrint(x) - -#endif // DBG - -#define DEBUG_BUFFER_LENGTH 256 - -// -// Define our private SRB flags. The high nibble of the flag field is -// reserved for class drivers's private use. -// - -// -// Used to indicate that this request shouldn't invoke any power type operations -// like spinning up the drive. -// - -#define SRB_CLASS_FLAGS_LOW_PRIORITY 0x10000000 - -// -// Used to indicate that the completion routine should not free the srb. -// - -#define SRB_CLASS_FLAGS_PERSISTANT 0x20000000 - -// -// Used to indicate that an SRB is the result of a paging operation. -// - -#define SRB_CLASS_FLAGS_PAGING 0x40000000 - -// -// Used to indicate the completion routine should free the MDL. -// - -#define SRB_CLASS_FLAGS_FREE_MDL 0x80000000 - -// -// Random macros which should probably be in the system header files -// somewhere. -// - -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define min(a,b) (((a) < (b)) ? (a) : (b)) - -// -// Bit Flag Macros -// - -#define SET_FLAG(Flags, Bit) ((Flags) |= (Bit)) -#define CLEAR_FLAG(Flags, Bit) ((Flags) &= ~(Bit)) -#define TEST_FLAG(Flags, Bit) (((Flags) & (Bit)) != 0) - -// -// neat little hacks to count number of bits set efficiently -// -__inline ULONG CountOfSetBitsUChar(UCHAR _X) -{ ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline ULONG CountOfSetBitsULong(ULONG _X) -{ ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline ULONG CountOfSetBitsULong32(ULONG32 _X) -{ ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline ULONG CountOfSetBitsULong64(ULONG64 _X) -{ ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline ULONG CountOfSetBitsUlongPtr(ULONG_PTR _X) -{ ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } - - -// -// Helper macros to verify data types and cleanup the code. -// - -#define ASSERT_FDO(x) \ - ASSERT(((PCOMMON_DEVICE_EXTENSION) (x)->DeviceExtension)->IsFdo) - -#define ASSERT_PDO(x) \ - ASSERT(!(((PCOMMON_DEVICE_EXTENSION) (x)->DeviceExtension)->IsFdo)) - -#define IS_CLEANUP_REQUEST(majorFunction) \ - ((majorFunction == IRP_MJ_CLOSE) || \ - (majorFunction == IRP_MJ_CLEANUP) || \ - (majorFunction == IRP_MJ_SHUTDOWN)) - -#define DO_MCD(fdoExtension) \ - (((fdoExtension)->MediaChangeDetectionInfo != NULL) && \ - ((fdoExtension)->MediaChangeDetectionInfo->MediaChangeDetectionDisableCount == 0)) - -#define IS_SCSIOP_READ(opCode) \ - ((opCode == SCSIOP_READ6) || \ - (opCode == SCSIOP_READ) || \ - (opCode == SCSIOP_READ12) || \ - (opCode == SCSIOP_READ16)) - -#define IS_SCSIOP_WRITE(opCode) \ - ((opCode == SCSIOP_WRITE6) || \ - (opCode == SCSIOP_WRITE) || \ - (opCode == SCSIOP_WRITE12) || \ - (opCode == SCSIOP_WRITE16)) - -#define IS_SCSIOP_READWRITE(opCode) (IS_SCSIOP_READ(opCode) || IS_SCSIOP_WRITE(opCode)) - -#define ADJUST_FUA_FLAG(fdoExt) { \ - if (TEST_FLAG(fdoExt->DeviceFlags, DEV_WRITE_CACHE) && \ - !TEST_FLAG(fdoExt->DeviceFlags, DEV_POWER_PROTECTED) && \ - !TEST_FLAG(fdoExt->ScanForSpecialFlags, CLASS_SPECIAL_FUA_NOT_SUPPORTED) ) { \ - fdoExt->CdbForceUnitAccess = TRUE; \ - } else { \ - fdoExt->CdbForceUnitAccess = FALSE; \ - } \ -} - -#define FREE_POOL(_PoolPtr) \ - if (_PoolPtr != NULL) { \ - ExFreePool(_PoolPtr); \ - _PoolPtr = NULL; \ - } - -#ifdef POOL_TAGGING -#undef ExAllocatePool -#undef ExAllocatePoolWithQuota -#define ExAllocatePool(a,b) ExAllocatePoolWithTag(a,b,'nUcS') -//#define ExAllocatePool(a,b) #assert(0) -#define ExAllocatePoolWithQuota(a,b) ExAllocatePoolWithQuotaTag(a,b,'nUcS') -#endif - -#define CLASS_TAG_AUTORUN_DISABLE 'ALcS' -#define CLASS_TAG_FILE_OBJECT_EXTENSION 'FLcS' -#define CLASS_TAG_MEDIA_CHANGE_DETECTION 'MLcS' -#define CLASS_TAG_MOUNT 'mLcS' -#define CLASS_TAG_RELEASE_QUEUE 'qLcS' -#define CLASS_TAG_POWER 'WLcS' -#define CLASS_TAG_WMI 'wLcS' -#define CLASS_TAG_FAILURE_PREDICT 'fLcS' -#define CLASS_TAG_DEVICE_CONTROL 'OIcS' -#define CLASS_TAG_MODE_DATA 'oLcS' -#define CLASS_TAG_MULTIPATH 'mPcS' - -#define MAXIMUM_RETRIES 4 - -#define CLASS_DRIVER_EXTENSION_KEY ((PVOID) ClassInitialize) - -struct _CLASS_INIT_DATA; -typedef struct _CLASS_INIT_DATA - CLASS_INIT_DATA, - *PCLASS_INIT_DATA; - -// -// our first attempt at keeping private data actually private.... -// - -struct _CLASS_PRIVATE_FDO_DATA; -typedef struct _CLASS_PRIVATE_FDO_DATA - CLASS_PRIVATE_FDO_DATA, - *PCLASS_PRIVATE_FDO_DATA; - -struct _CLASS_PRIVATE_PDO_DATA; -typedef struct _CLASS_PRIVATE_PDO_DATA - CLASS_PRIVATE_PDO_DATA, - *PCLASS_PRIVATE_PDO_DATA; - -struct _CLASS_PRIVATE_COMMON_DATA; -typedef struct _CLASS_PRIVATE_COMMON_DATA - CLASS_PRIVATE_COMMON_DATA, - *PCLASS_PRIVATE_COMMON_DATA; - -// -// Possible values for the IsRemoved flag -// - -#define NO_REMOVE 0 -#define REMOVE_PENDING 1 -#define REMOVE_COMPLETE 2 - - -#define ClassAcquireRemoveLock(devobj, tag) \ - ClassAcquireRemoveLockEx(devobj, tag, __FILE__, __LINE__) - -// -// Define start unit timeout to be 4 minutes. -// - -#define START_UNIT_TIMEOUT (60 * 4) - -// -// Define media change test time to be 1 second for quicker response - -#define MEDIA_CHANGE_DEFAULT_TIME 1 - -// -// Used to detect the loss of the autorun irp. -// - -#define MEDIA_CHANGE_TIMEOUT_TIME 300 - -// -// Define the various states that media can be in for autorun. -// -typedef enum _MEDIA_CHANGE_DETECTION_STATE { - MediaUnknown, - MediaPresent, - MediaNotPresent, - MediaUnavailable // e.g. cd-r media undergoing burn -} MEDIA_CHANGE_DETECTION_STATE, *PMEDIA_CHANGE_DETECTION_STATE; - - -struct _MEDIA_CHANGE_DETECTION_INFO; -typedef struct _MEDIA_CHANGE_DETECTION_INFO - MEDIA_CHANGE_DETECTION_INFO, *PMEDIA_CHANGE_DETECTION_INFO; - -// -// Structures for maintaining a dictionary list (list of objects -// referenced by a key value) -// - -struct _DICTIONARY_HEADER; -typedef struct _DICTIONARY_HEADER DICTIONARY_HEADER, *PDICTIONARY_HEADER; - -typedef struct _DICTIONARY { - ULONGLONG Signature; - PDICTIONARY_HEADER List; - KSPIN_LOCK SpinLock; -} DICTIONARY, *PDICTIONARY; - - -// -// structures to simplify matching devices, ids, and hacks required for -// these ids. -// - -typedef struct _CLASSPNP_SCAN_FOR_SPECIAL_INFO { - - // - // * NULL pointers indicates that no match is required. - // * empty string will only match an empty string. non-existant strings - // in the device descriptor are considered empty strings for this match. - // (ie. "" will only match "") - // * all other strings will do partial matches, based upon - // string provided (ie. "hi" will match "hitazen" and "higazui") - // * array must end with all three PCHARs being set to NULL. - // - - PCHAR VendorId; - PCHAR ProductId; - PCHAR ProductRevision; - - // - // marked as a ULONG_PTR to allow use as either a ptr to a data block - // or 32 bits worth of flags. (64 bits on 64 bit systems) no longer a - // const so that it may be dynamically built. - // - - ULONG_PTR Data; - -} CLASSPNP_SCAN_FOR_SPECIAL_INFO, *PCLASSPNP_SCAN_FOR_SPECIAL_INFO; - - - - -#ifdef ALLOCATE_SRB_FROM_POOL - -#define ClasspAllocateSrb(ext) - ExAllocatePoolWithTag(NonPagedPool, \ - sizeof(SCSI_REQUEST_BLOCK), \ - 'sBRS') - -#define ClasspFreeSrb(ext, srb) ExFreePool((srb)); - -#else - -#define ClasspAllocateSrb(ext) \ - ExAllocateFromNPagedLookasideList( \ - &((ext)->CommonExtension.SrbLookasideList)) - -#define ClasspFreeSrb(ext, srb) \ - ExFreeToNPagedLookasideList( \ - &((ext)->CommonExtension.SrbLookasideList), \ - (srb)) - -#endif - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_ERROR() - -Routine Description: - - This routine is a callback into the driver to handle errors. The queue - shall not be unfrozen when this error handler is called, even though the - SRB flags may mark the queue as having been frozen due to this SRB. - -Irql: - - This routine will be called at KIRQL <= DISPATCH_LEVEL - -Arguments: - - DeviceObject is the device object the error occurred on. - - Srb is the Srb that was being processed when the error occurred. - - Status may be overwritten by the routine if it decides that the error - was benign, or otherwise wishes to change the returned status code - for this command - - Retry may be overwritten to specify that this command should or should - not be retried (if the callee supports retrying commands) - -Return Value: - - status - ---*/ - -__drv_maxIRQL(DISPATCH_LEVEL) -typedef -VOID -(*PCLASS_ERROR) ( - __in PDEVICE_OBJECT DeviceObject, - __in PSCSI_REQUEST_BLOCK Srb, - __out NTSTATUS *Status, - __inout BOOLEAN *Retry - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_ADD_DEVICE() - -Routine Description: - - This routine is a callback into the driver to create and initialize a new - FDO for the corresponding PDO. It may perform property queries on the PDO - but cannot do any media access operations. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DriverObject is the class driver object this callback is registered for. - - PDO is the physical device object being added to. - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_ADD_DEVICE) ( - __in PDRIVER_OBJECT DriverObject, - __in PDEVICE_OBJECT Pdo - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -CLASS_POWER_DEVICE() - -Routine Description: - - This routine is a callback into the driver to handle power up and - power down requests. Most drivers can set this to ClassPowerHandler, - which will send a STOP_UNIT on powerdown, and a START_UNIT on powerup. - ClassMinimalPowerHandler() may also be used to do nothing for power - operations (except succeed them). Please see the DDK for proper handling - of IRP_MN_DEVICE_USAGE_NOTIFICATION for details regarding interaction - of paging device notifications and the IRQL at which this routine will - be called. - -Irql: - - This routine will be called at PASSIVE_LEVEL if DO_POWER_PAGABLE is set. - This code should NOT be pagable to prevent race conditions during the - setting and clearing of the DO_POWER_PAGABLE bit. - -Arguments: - - DeviceObject is the device that has the pending power request - - Irp is the power irp that needs to be handled - -Return Value: - - status - ---*/ -typedef -NTSTATUS -(*PCLASS_POWER_DEVICE) ( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -/*++//////////////////////////////////////////////////////////////////////////// - -CLASS_START_DEVICE() - -Routine Description: - - This routine is a callback into the driver to initialize the FDO or PDO for - all requests, typically due to a IRP_MN_START_DEVICE. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the device object being started - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_START_DEVICE) ( - __in PDEVICE_OBJECT DeviceObject - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -CLASS_STOP_DEVICE() - -Routine Description: - - This routine is a callback into the driver to stop the device. - For the storage stack, unless there are known issues, this routine - need only return. All queueing shall be handled by the lower device - drivers. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the device object being stopped/query stopped. - - Type is the IRP_MN_ type that must be handled. - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_STOP_DEVICE) ( - __in PDEVICE_OBJECT DeviceObject, - __in UCHAR Type - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -CLASS_INIT_DEVICE() - -Routine Description: - - This routine is a callback into the driver to do one-time initialization - of new device objects. It shall be called exactly once per device object, - and it shall be called prior to CLASS_START_DEVICE() routine. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the device object to be initialized - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_INIT_DEVICE) ( - __in PDEVICE_OBJECT DeviceObject - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -CLASS_ENUM_DEVICE() - -Routine Description: - - This routine is a callback into the driver to update the list of PDOs for - a given FDO. See DISK.SYS's DiskEnumerateDevice for an example of use. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the FDO which is being enumerated. - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_ENUM_DEVICE) ( - __in PDEVICE_OBJECT DeviceObject - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_READ_WRITE() - -Routine Description: - - This routine is a callback into the driver to verify READ and WRITE irps. - If the READ or WRITE request is failed, this routine shall set the Irp's - IoStatus.Status to the returned error code and the IoStatus.Information - field as appropriate for the given error. - -Irql: - - This routine will be called at KIRQL <= DISPATCH_LEVEL - -Arguments: - - DeviceObject is the device object being read from or written to - - Irp is the read or write request being processed - -Return Value: - - status - ---*/ -__drv_maxIRQL(DISPATCH_LEVEL) -typedef -NTSTATUS -(*PCLASS_READ_WRITE) ( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_DEVICE_CONTROL() - -Routine Description: - - This routine is a callback into the driver to - -Irql: - - This routine will only be called at PASSIVE_LEVEL for storage IOCTLs. - The code must therefore not be paged, but may call paged code for those - ioctls which have been defined to be sent at PASSIVE_LEVEL, such as the - storage IOCTLS. Otherwise KIRQL <= DISPATCH_LEVEL. - -Arguments: - - DeviceObject is the device object the IOCTL may be for - - Irp is the IOCTL request currently being processed - -Return Value: - - status - ---*/ -__drv_maxIRQL(DISPATCH_LEVEL) -typedef -NTSTATUS -(*PCLASS_DEVICE_CONTROL) ( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_SHUTDOWN_FLUSH() - -Routine Description: - - This routine is a callback into the driver to handle shutdown and flush - irps. These are sent by the system before it actually shuts down or when - the file system does a flush. - - This routine may synchronize the device's media / cache and ensure the - device is not locked if the system is in the process of shutting down. - -Irql: - - This routine will be called at KIRQL <= DISPATCH_LEVEL - -Arguments: - - DeviceObject is the device object that needs to be flushed - - Irp is the shutdown or flush request currently being processed - -Return Value: - - status - ---*/ -__drv_maxIRQL(DISPATCH_LEVEL) -typedef -NTSTATUS -(*PCLASS_SHUTDOWN_FLUSH) ( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_CREATE_CLOSE() - -Routine Description: - - This routine is a callback into the driver when the device is opened or - closed. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject that is handling the request - - Irp is the create or close request currently being processed - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_CREATE_CLOSE) ( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_QUERY_ID() - -Routine Description: - - This routine generates the PNP id's for the device's enumerated PDOs. - If the specified ID is one that cannot be generated, then the return - status shall be STATUS_NOT_IMPLEMENTED so that classpnp shall not - handle the request. This routine shall allocate the buffer in the unicode - string "IdString" upon success; it is the caller's responsibility to free - this buffer when it is done. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the PDO to generate an ID for - - IdType is the type of ID to be generated - - UnicodeIdString is the string to place the results into - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_QUERY_ID) ( - __in PDEVICE_OBJECT DeviceObject, - __in BUS_QUERY_ID_TYPE IdType, - __in PUNICODE_STRING IdString - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_REMOVE_DEVICE() - -Routine Description: - - This routine is a callback into the driver to release any resources the - device may have allocated for the device object. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the device object being removed/query removed/etc. - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_REMOVE_DEVICE) ( - __in PDEVICE_OBJECT DeviceObject, - __in UCHAR Type - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_UNLOAD() - -Routine Description: - - This routine is a callback into the driver to unload itself. It must free - any resources allocated in the DriverEntry portion of the driver. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - X - - Irp is the IOCTL request currently being processed - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -VOID -(*PCLASS_UNLOAD) ( - __in PDRIVER_OBJECT DriverObject - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_QUERY_PNP_CAPABILITIES() - -Routine Description: - - ISSUE-2000/02/18-henrygab - description required - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - PhysicalDeviceObject is the PDO for which this query shall occur - - Capabilities is a structure that shall be modified by this routine - to report the device's capabilities. - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_QUERY_PNP_CAPABILITIES) ( - __in PDEVICE_OBJECT PhysicalDeviceObject, - __in PDEVICE_CAPABILITIES Capabilities - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_TICK() - -Routine Description: - - This routine is a callback into the driver that is called once per second. - -Irql: - - This routine will be called at DISPATCH_LEVEL - -Arguments: - - DeviceObject is the device object for which the timer has fired - -Return Value: - - status - ---*/ -__drv_requiresIRQL(DISPATCH_LEVEL) -typedef -VOID -(*PCLASS_TICK) ( - __in PDEVICE_OBJECT DeviceObject - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_QUERY_WMI_REGINFO_EX() - -Routine Description: - - This routine is a callback into the driver to retrieve information about - the guids being registered. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the device whose registration information is needed - - *RegFlags returns with a set of flags that describe the guids being - registered for this device. If the device wants enable and disable - collection callbacks before receiving queries for the registered - guids then it should return the WMIREG_FLAG_EXPENSIVE flag. Also the - returned flags may specify WMIREG_FLAG_INSTANCE_PDO in which case - the instance name is determined from the PDO associated with the - device object. Note that the PDO must have an associated devnode. If - WMIREG_FLAG_INSTANCE_PDO is not set then Name must return a unique - name for the device. - - Name returns with the instance name for the guids if - WMIREG_FLAG_INSTANCE_PDO is not set in the returned *RegFlags. The - caller will call ExFreePool with the buffer returned. - - MofResourceName returns filled with a static string that contains - the name of the MOF resource attached to the drivers image. The - caller does not free the buffer as it is expected that the - caller will use RtlInitializeUnicodeString to populate it. - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_QUERY_WMI_REGINFO_EX) ( - __in PDEVICE_OBJECT DeviceObject, - __out ULONG *RegFlags, - __out PUNICODE_STRING Name, - __out PUNICODE_STRING MofResouceName - ); - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_QUERY_WMI_REGINFO() - -Routine Description: - - This routine is a callback into the driver to retrieve information about - the guids being registered. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the device whose registration information is needed - - *RegFlags returns with a set of flags that describe the guids being - registered for this device. If the device wants enable and disable - collection callbacks before receiving queries for the registered - guids then it should return the WMIREG_FLAG_EXPENSIVE flag. Also the - returned flags may specify WMIREG_FLAG_INSTANCE_PDO in which case - the instance name is determined from the PDO associated with the - device object. Note that the PDO must have an associated devnode. If - WMIREG_FLAG_INSTANCE_PDO is not set then Name must return a unique - name for the device. - - Name returns with the instance name for the guids if - WMIREG_FLAG_INSTANCE_PDO is not set in the returned *RegFlags. The - caller will call ExFreePool with the buffer returned. - - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_QUERY_WMI_REGINFO) ( - __in PDEVICE_OBJECT DeviceObject, - __out ULONG *RegFlags, - __out PUNICODE_STRING Name - ); - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_QUERY_WMI_DATABLOCK() - -Routine Description: - - This routine is a callback into the driver to query for the contents of - a data block. When the driver has finished filling the data block it - must call ClassWmiCompleteRequest to complete the irp. The driver can - return STATUS_PENDING if the irp cannot be completed immediately. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the device whose data block is being queried - - Irp is the Irp that makes this request - - GuidIndex is the index into the list of guids provided when the - device registered - - BufferAvail on has the maximum size available to write the data - block. - - Buffer on return is filled with the returned data block - - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_QUERY_WMI_DATABLOCK) ( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __in ULONG GuidIndex, - __in ULONG BufferAvail, - __out_bcount(BufferAvail) PUCHAR Buffer - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_SET_WMI_DATABLOCK() - -Routine Description: - - This routine is a callback into the driver to query for the contents of - a data block. When the driver has finished filling the data block it - must call ClassWmiCompleteRequest to complete the irp. The driver can - return STATUS_PENDING if the irp cannot be completed immediately. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the device whose data block is being queried - - Irp is the Irp that makes this request - - GuidIndex is the index into the list of guids provided when the - device registered - - BufferSize has the size of the data block passed - - Buffer has the new values for the data block - - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_SET_WMI_DATABLOCK) ( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __in ULONG GuidIndex, - __in ULONG BufferSize, - __in_bcount(BufferSize) PUCHAR Buffer - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_SET_WMI_DATAITEM() - -Routine Description: - - This routine is a callback into the driver to query for the contents of - a data block. When the driver has finished filling the data block it - must call ClassWmiCompleteRequest to complete the irp. The driver can - return STATUS_PENDING if the irp cannot be completed immediately. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the device whose data block is being queried - - Irp is the Irp that makes this request - - GuidIndex is the index into the list of guids provided when the - device registered - - DataItemId has the id of the data item being set - - BufferSize has the size of the data item passed - - Buffer has the new values for the data item - - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_SET_WMI_DATAITEM) ( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __in ULONG GuidIndex, - __in ULONG DataItemId, - __in ULONG BufferSize, - __in_bcount(BufferSize) PUCHAR Buffer - ); - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_EXECUTE_WMI_METHOD() - -Routine Description: - - This routine is a callback into the driver to execute a method. When the - driver has finished filling the data block it must call - ClassWmiCompleteRequest to complete the irp. The driver can - return STATUS_PENDING if the irp cannot be completed immediately. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the device whose data block is being queried - - Irp is the Irp that makes this request - - GuidIndex is the index into the list of guids provided when the - device registered - - MethodId has the id of the method being called - - InBufferSize has the size of the data block passed in as the input to - the method. - - OutBufferSize on entry has the maximum size available to write the - returned data block. - - Buffer is filled with the returned data block - - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_EXECUTE_WMI_METHOD) ( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __in ULONG GuidIndex, - __in ULONG MethodId, - __in ULONG InBufferSize, - __in ULONG OutBufferSize, - __in_xcount(max(InBufferSize, OutBufferSize)) PUCHAR Buffer - ); - - - -// -// used by PCLASS_WMI_FUNCTION_CONTROL -// -typedef enum { - EventGeneration, - DataBlockCollection -} CLASSENABLEDISABLEFUNCTION; - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_WMI_FUNCTION_CONTROL() - -Routine Description: - - This routine is a callback into the driver to enabled or disable event - generation or data block collection. A device should only expect a - single enable when the first event or data consumer enables events or - data collection and a single disable when the last event or data - consumer disables events or data collection. Data blocks will only - receive collection enable/disable if they were registered as requiring - it. - -Irql: - - This routine will be called at PASSIVE_LEVEL. - Its code may be safely paged. - -Arguments: - - DeviceObject is the device whose data block is being queried - - GuidIndex is the index into the list of guids provided when the - device registered - - Function specifies which functionality is being enabled or disabled - - Enable is TRUE then the function is being enabled else disabled - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -NTSTATUS -(*PCLASS_WMI_FUNCTION_CONTROL) ( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __in ULONG GuidIndex, - __in CLASSENABLEDISABLEFUNCTION Function, - __in BOOLEAN Enable - ); - -/*++//////////////////////////////////////////////////////////////////////////// - - This structure defines the history kept for a given transfer packet. - It includes a srb status/sense data structure that is always either valid - or zero-filled for the full 18 bytes, time sent/completed, and how long - the retry delay was requested to be. - ---*/ -typedef struct _SRB_HISTORY_ITEM { - LARGE_INTEGER TickCountSent; // 0x00..0x07 - LARGE_INTEGER TickCountCompleted; // 0x08..0x0F - ULONG MillisecondsDelayOnRetry; // 0x10..0x13 - SENSE_DATA NormalizedSenseData; // 0x14..0x25 (0x12 bytes) - UCHAR SrbStatus; // 0x26 - UCHAR ClassDriverUse; // 0x27 -- one byte free (alignment) -} SRB_HISTORY_ITEM, *PSRB_HISTORY_ITEM; - -typedef struct _SRB_HISTORY { - ULONG_PTR ClassDriverUse[4]; // for the class driver to use as they please - __field_range(1,30000) - ULONG TotalHistoryCount; - __field_range(0,TotalHistoryCount) - ULONG UsedHistoryCount; - __field_ecount_part(TotalHistoryCount, UsedHistoryCount) - SRB_HISTORY_ITEM History[1]; -} SRB_HISTORY, *PSRB_HISTORY; - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_INTERPRET_SENSE_INFO() - -Routine Description: - - This routine is a callback into the driver to perform interpretation of the - errors that may have occurred during an SRB transfer. It closely matches the - API set of ClassInterpretSenseInfo, with modifications to allow for a history - of why the request was previously retried (and when), and changes the retry - interval from being in seconds to being in milliseconds. Finally, use of this - extended API removes all retry logic from classpnp for these requests. Thus, - the provided routine must return FALSE when it determines the number of times - the request should be retried has been exceeded. - -Irql: - - This routine will be called at KIRQL <= DISPATCH_LEVEL - -NOTE: - - Although it is not illegal to have both a PCLASS_INTERPRET_SENSE_INFO() and - a PCLASS_ERROR() routine, the PCLASS_ERROR() function will only be called - if the class driver (as part of its PCLASS_INTERPRET_SENSE_INFO() routine) - calls into the legacy ClassInterpretSenseInfo(). - -Arguments: - - -Return Value: - - TRUE if the request should be retried - FALSE if the request should be failed - ---*/ - -// NOTE: Start with a smaller 100 second maximum, due to current assert in CLASSPNP -// 0x0000 00C9'2A69 C000 (864,000,000,000) is 24 hours in 100ns units -// 0x0000 0000'3B9A CA00 ( 1,000,000,000) is 100 seconds in 100ns units -#define MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS (0x3B9ACA00) - -__drv_maxIRQL(DISPATCH_LEVEL) -typedef -BOOLEAN -(*PCLASS_INTERPRET_SENSE_INFO) ( - __in PDEVICE_OBJECT Fdo, - __in_opt PIRP OriginalRequest, // not always the same as in SRB - __in PSCSI_REQUEST_BLOCK Srb, - __in UCHAR MajorFunctionCode, - __in ULONG IoDeviceCode, - __in ULONG PreviousRetryCount, - // const except for bits explicitly set aside for class driver to update - __in_opt SRB_HISTORY * RequestHistory, - __out NTSTATUS * Status, - __out __range(0,MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) - LONGLONG * RetryIn100nsUnits - ); - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_COMPRESS_HISTORY_DATA() - -Routine Description: - - This routine is a callback into the driver to perform "compression" of the - history data that is saved during retry of SRBs. The function will only be - called when the history array is full (UsedHistoryCount == TotalHistoryCount). - This function must reduce the overall UsedHistoryCount by at least one - element (and update the UsedHistoryCount field appropriately). - . that may have occurred during an SRB transfer. It closely matches the - API set of ClassInterpretSenseInfo, with modifications to allow for a history - of why the request was previously retried (and when), and changes the retry - interval from being in seconds to being in milliseconds. Finally, use of this - extended API removes all retry logic from classpnp for these requests. Thus, - the provided routine must return FALSE when it determines the number of times - the request should be retried has been exceeded. - -Irql: - - This routine will be called at KIRQL <= DISPATCH_LEVEL - -NOTE: - - Although it is not illegal to have both a PCLASS_INTERPRET_SENSE_INFO() and - a PCLASS_ERROR() routine, the PCLASS_ERROR() function will only be called - if the class driver (as part of its PCLASS_INTERPRET_SENSE_INFO() routine) - calls into the legacy ClassInterpretSenseInfo(). - -Arguments: - - ---*/ -__drv_maxIRQL(DISPATCH_LEVEL) -typedef -VOID -(*PCLASS_COMPRESS_RETRY_HISTORY_DATA) ( - __in PDEVICE_OBJECT DeviceObject, - __inout PSRB_HISTORY RequestHistory - ); - -// -// Restricted - May only append to this structure for backwards compatibility -// -typedef struct { - GUID Guid; // Guid to registered - ULONG InstanceCount; // Count of Instances of Datablock - ULONG Flags; // Additional flags (see WMIREGINFO in wmistr.h) -} GUIDREGINFO, *PGUIDREGINFO; - - -// -// Restricted - May only append to this structure for backwards compatibility -// -typedef struct _CLASS_WMI_INFO { - ULONG GuidCount; - PGUIDREGINFO GuidRegInfo; - - PCLASS_QUERY_WMI_REGINFO ClassQueryWmiRegInfo; - PCLASS_QUERY_WMI_DATABLOCK ClassQueryWmiDataBlock; - PCLASS_SET_WMI_DATABLOCK ClassSetWmiDataBlock; - PCLASS_SET_WMI_DATAITEM ClassSetWmiDataItem; - PCLASS_EXECUTE_WMI_METHOD ClassExecuteWmiMethod; - PCLASS_WMI_FUNCTION_CONTROL ClassWmiFunctionControl; -} CLASS_WMI_INFO, *PCLASS_WMI_INFO; - - -// -// Restricted - May only append to this structure for backwards compatibility -// -typedef struct _CLASS_DEV_INFO { - - // - // Bytes needed by the class driver - // for it's extension. - // If this is zero, the driver does not expect to have any PDO's - // - - ULONG DeviceExtensionSize; - - DEVICE_TYPE DeviceType; - - UCHAR StackSize; - - // - // Device Characteristics flags - // eg.: - // - // FILE_REMOVABLE_MEDIA - // FILE_READ_ONLY_DEVICE - // FILE_FLOPPY_DISKETTE - // FILE_WRITE_ONCE_MEDIA - // FILE_REMOTE_DEVICE - // FILE_DEVICE_IS_MOUNTED - // FILE_VIRTUAL_VOLUME - // - - ULONG DeviceCharacteristics; - - PCLASS_ERROR ClassError; - PCLASS_READ_WRITE ClassReadWriteVerification; - PCLASS_DEVICE_CONTROL ClassDeviceControl; - PCLASS_SHUTDOWN_FLUSH ClassShutdownFlush; - PCLASS_CREATE_CLOSE ClassCreateClose; - - PCLASS_INIT_DEVICE ClassInitDevice; - PCLASS_START_DEVICE ClassStartDevice; - PCLASS_POWER_DEVICE ClassPowerDevice; - PCLASS_STOP_DEVICE ClassStopDevice; - PCLASS_REMOVE_DEVICE ClassRemoveDevice; - - PCLASS_QUERY_PNP_CAPABILITIES ClassQueryPnpCapabilities; - - // - // Registered Data Block info for wmi - // - CLASS_WMI_INFO ClassWmiInfo; - -} CLASS_DEV_INFO, *PCLASS_DEV_INFO; - -// -// Restricted - May only append to this structure for backwards compatibility -// -struct _CLASS_INIT_DATA { - - // - // This structure size - version checking. - // - - ULONG InitializationDataSize; - - // - // Specific init data for functional and physical device objects. - // - - CLASS_DEV_INFO FdoData; - CLASS_DEV_INFO PdoData; - - // - // Device-specific driver routines - // - - PCLASS_ADD_DEVICE ClassAddDevice; - PCLASS_ENUM_DEVICE ClassEnumerateDevice; - - PCLASS_QUERY_ID ClassQueryId; - - PDRIVER_STARTIO ClassStartIo; - PCLASS_UNLOAD ClassUnload; - - PCLASS_TICK ClassTick; -}; - -// -// this is a private structure, but must be kept here -// to properly compile size of FUNCTIONAL_DEVICE_EXTENSION -// -typedef struct _FILE_OBJECT_EXTENSION { - PFILE_OBJECT FileObject; - PDEVICE_OBJECT DeviceObject; - ULONG LockCount; - ULONG McnDisableCount; -} FILE_OBJECT_EXTENSION, *PFILE_OBJECT_EXTENSION; - -typedef struct _CLASS_WORKING_SET -{ - __field_range(sizeof(CLASS_WORKING_SET),sizeof(CLASS_WORKING_SET)) - ULONG Size; // Must be sizeof(CLASS_WORKING_SET) - - __field_range(0,2048) // NOTE: This range can be made larger more easily than it can be reduced - ULONG XferPacketsWorkingSetMaximum; - __field_range(0,2048) - ULONG XferPacketsWorkingSetMinimum; -} CLASS_WORKING_SET, *PCLASS_WORKING_SET; -#define CLASS_WORKING_SET_MAXIMUM 2048 - -typedef struct _CLASS_INTERPRET_SENSE_INFO2 -{ - __field_range(sizeof(CLASS_INTERPRET_SENSE_INFO),sizeof(CLASS_INTERPRET_SENSE_INFO)) - ULONG Size; // Must be sizeof(CLASS_INTERPRET_SENSE_INFO) - - __field_range(1,30000) - ULONG HistoryCount; // The number of SRB_HISTORY units that will be used - - __callback PCLASS_COMPRESS_RETRY_HISTORY_DATA Compress; - __callback PCLASS_INTERPRET_SENSE_INFO Interpret; - -} CLASS_INTERPRET_SENSE_INFO2, *PCLASS_INTERPRET_SENSE_INFO2; -// A compile-time check of the 30,000 limit not overflowing ULONG size... -// Note that it is not expected that a release (FRE) driver will normally -// have such a large history, instead using the compression function. -#define CLASS_INTERPRET_SENSE_INFO2_MAXIMUM_HISTORY_COUNT 30000 -C_ASSERT( (MAXULONG - sizeof(SRB_HISTORY)) / 30000 >= sizeof(SRB_HISTORY_ITEM) ); - - -// -// Restricted - May only append to this structure for backwards compatibility -// -typedef struct _CLASS_DRIVER_EXTENSION { - - UNICODE_STRING RegistryPath; - - CLASS_INIT_DATA InitData; - - ULONG DeviceCount; - -#if (NTDDI_VERSION >= NTDDI_WINXP) - PCLASS_QUERY_WMI_REGINFO_EX ClassFdoQueryWmiRegInfoEx; - PCLASS_QUERY_WMI_REGINFO_EX ClassPdoQueryWmiRegInfoEx; -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) - REGHANDLE EtwHandle; - - PDRIVER_DISPATCH DeviceMajorFunctionTable[IRP_MJ_MAXIMUM_FUNCTION + 1]; - PDRIVER_DISPATCH MpDeviceMajorFunctionTable[IRP_MJ_MAXIMUM_FUNCTION + 1]; - - // - // Support for cdrom class drivers to extend - // the interpret sense information routine - // and retry history per-packet. Need to - // setup during DriverEntry, so must be placed here. - // - PCLASS_INTERPRET_SENSE_INFO2 InterpretSenseInfo; - - // - // Support for overriding the min/max number - // of packets to keep allocated. Need to - // setup during DriverEntry, so must be placed here. - // - PCLASS_WORKING_SET WorkingSet; - -#endif - -} CLASS_DRIVER_EXTENSION, *PCLASS_DRIVER_EXTENSION; - -typedef struct _COMMON_DEVICE_EXTENSION COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION; -typedef struct _FUNCTIONAL_DEVICE_EXTENSION FUNCTIONAL_DEVICE_EXTENSION, *PFUNCTIONAL_DEVICE_EXTENSION; -typedef struct _PHYSICAL_DEVICE_EXTENSION PHYSICAL_DEVICE_EXTENSION, *PPHYSICAL_DEVICE_EXTENSION; - -// -// Restricted - May only append to this structure for backwards compatibility -// -typedef struct _COMMON_DEVICE_EXTENSION { - - // - // Version control field - // - // Note - this MUST be the first thing in the device extension - // for any class driver using classpnp or a later version. - // - - ULONG Version; - - // - // Back pointer to device object - // - // NOTE - this MUST be the second field in the common device extension. - // Users of this structure will include it in a union with the DeviceObject - // pointer so they can reference this with a bit of syntactic sugar. - // - - PDEVICE_OBJECT DeviceObject; - - // - // Pointer to lower device object - send all requests through this - // - - PDEVICE_OBJECT LowerDeviceObject; - - // - // Pointer to the partition zero device extension. - // There are several flags stored there that pdo - // routines need to access - // - - PFUNCTIONAL_DEVICE_EXTENSION PartitionZeroExtension; - - // - // Pointer to the initialization data for this driver. This is more - // efficient than constantly getting the driver extension. - // - - PCLASS_DRIVER_EXTENSION DriverExtension; - - // - // INTERLOCKED counter of the number of requests/function calls outstanding - // which will need to use this device object. When this count goes to - // zero the RemoveEvent will be set. - // - // This variable is only manipulated by ClassIncrementRemoveLock and - // ClassDecrementRemoveLock. - // - - LONG RemoveLock; - - // - // This event will be signalled when it is safe to remove the device object - // - - KEVENT RemoveEvent; - - // - // The spinlock and the list are only used in checked builds to track - // who has acquired the remove lock. Free systems will leave these - // initialized to ff - // - - KSPIN_LOCK RemoveTrackingSpinlock; - - PVOID RemoveTrackingList; - - LONG RemoveTrackingUntrackedCount; - - // - // Pointer to the driver specific data area - // - - PVOID DriverData; - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4214) // bit field types other than int -#pragma warning(disable:4201) // nameless struct/union - - // - // Flag indicates whether this device object is - // an FDO or a PDO - // - - struct { - BOOLEAN IsFdo : 1; - BOOLEAN IsInitialized : 1; - - // - // Flag indicating whether the lookaside listhead for srbs has been - // initialized. - // - - BOOLEAN IsSrbLookasideListInitialized : 1; - }; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - - // - // Contains the IRP_MN_CODE of the last state-changing pnp irps we - // recieved (XXX_STOP, XXX_REMOVE, START, etc...). Used in concert - // with IsRemoved. - // - - UCHAR PreviousState; - UCHAR CurrentState; - - // - // interlocked flag indicating that the device has been removed. - // - - ULONG IsRemoved; - - // - // The name of the object - // - UNICODE_STRING DeviceName; - - // - // The next child device (or if this is an FDO, the first child device). - // - - PPHYSICAL_DEVICE_EXTENSION ChildList; - - // - // Number of the partition or -1L if not partitionable. - // - - ULONG PartitionNumber; - - // - // Length of partition in bytes - // - - LARGE_INTEGER PartitionLength; - - // - // Number of bytes before start of partition - // - - LARGE_INTEGER StartingOffset; - - // - // Dev-Info structure for this type of device object - // Contains call-out routines for the class driver. - // - - PCLASS_DEV_INFO DevInfo; - - // - // Count of page files going through this device object - // and event to synchronize them with. - // - - ULONG PagingPathCount; - ULONG DumpPathCount; - ULONG HibernationPathCount; - KEVENT PathCountEvent; - -#ifndef ALLOCATE_SRB_FROM_POOL - // - // Lookaside listhead for srbs. - // - - NPAGED_LOOKASIDE_LIST SrbLookasideList; -#endif - - // - // Interface name string returned by IoRegisterDeviceInterface. - // - - UNICODE_STRING MountedDeviceInterfaceName; - - - // - // Registered Data Block info for wmi - // - ULONG GuidCount; - PGUIDREGINFO GuidRegInfo; - - // - // File object dictionary for this device object. Extensions are stored - // in here rather than off the actual file object. - // - - DICTIONARY FileObjectDictionary; - - // - // The following will be in the released product as reserved. - // Leave these at the end of the structure. - // - -#if (NTDDI_VERSION >= NTDDI_WINXP) - PCLASS_PRIVATE_COMMON_DATA PrivateCommonData; -#else - ULONG_PTR Reserved1; -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) - // - // Pointer to the dispatch table for this object - // - - PDRIVER_DISPATCH *DispatchTable; -#else - ULONG_PTR Reserved2; -#endif - - ULONG_PTR Reserved3; - ULONG_PTR Reserved4; - -} COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION; - -typedef enum { - FailurePredictionNone = 0, // No failure detection polling needed - FailurePredictionIoctl, // Do failure detection via IOCTL - FailurePredictionSmart, // Do failure detection via SMART - FailurePredictionSense // Do failure detection via sense data -} FAILURE_PREDICTION_METHOD, *PFAILURE_PREDICTION_METHOD; - -// -// Default failure prediction polling interval is every hour -// - -#define DEFAULT_FAILURE_PREDICTION_PERIOD 60 * 60 * 1 - -// -// The failure prediction structure is internal to classpnp - drivers do not -// need to know what it contains. -// - -struct _FAILURE_PREDICTION_INFO; -typedef struct _FAILURE_PREDICTION_INFO *PFAILURE_PREDICTION_INFO; - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4214) // bit field types other than int - -// -// this is to allow for common code to handle -// every option. -// - -typedef struct _CLASS_POWER_OPTIONS { - ULONG PowerDown : 1; - ULONG LockQueue : 1; - ULONG HandleSpinDown : 1; - ULONG HandleSpinUp : 1; - ULONG Reserved : 27; -} CLASS_POWER_OPTIONS, *PCLASS_POWER_OPTIONS; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - -// -// this is a private structure, but must be kept here -// to properly compile size of FUNCTIONAL_DEVICE_EXTENSION -// -typedef enum { - PowerDownDeviceInitial, - PowerDownDeviceLocked, - PowerDownDeviceStopped, - PowerDownDeviceOff, - PowerDownDeviceUnlocked -} CLASS_POWER_DOWN_STATE; - -// -// same as above, but with an extra state for whistler -// should be ok to change the above structure, but that -// would break someone somewhere who ignore the PRIVATE -// nature of the structure. -// - -typedef enum { - PowerDownDeviceInitial2, - PowerDownDeviceLocked2, - PowerDownDeviceFlushed2, - PowerDownDeviceStopped2, - PowerDownDeviceOff2, - PowerDownDeviceUnlocked2 -} CLASS_POWER_DOWN_STATE2; - -// -// this is a private enum, but must be kept here -// to properly compile size of FUNCTIONAL_DEVICE_EXTENSION -// -typedef enum { - PowerUpDeviceInitial, - PowerUpDeviceLocked, - PowerUpDeviceOn, - PowerUpDeviceStarted, - PowerUpDeviceUnlocked -} CLASS_POWER_UP_STATE; - -// -// this is a private structure, but must be kept here -// to properly compile size of FUNCTIONAL_DEVICE_EXTENSION -// -typedef struct _CLASS_POWER_CONTEXT { - - union { - CLASS_POWER_DOWN_STATE PowerDown; - CLASS_POWER_DOWN_STATE2 PowerDown2; // whistler - CLASS_POWER_UP_STATE PowerUp; - } PowerChangeState; - - CLASS_POWER_OPTIONS Options; - - BOOLEAN InUse; - BOOLEAN QueueLocked; - - NTSTATUS FinalStatus; - - ULONG RetryCount; - ULONG RetryInterval; - - PIO_COMPLETION_ROUTINE CompletionRoutine; - PDEVICE_OBJECT DeviceObject; - PIRP Irp; - - SCSI_REQUEST_BLOCK Srb; - -} CLASS_POWER_CONTEXT, *PCLASS_POWER_CONTEXT; - -// -// Restricted - May only append to this structure for backwards compatibility -// -typedef struct _FUNCTIONAL_DEVICE_EXTENSION { - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4201) // nameless struct/union - - // - // Common device extension header - // - - union { - struct { - ULONG Version; - PDEVICE_OBJECT DeviceObject; - }; - COMMON_DEVICE_EXTENSION CommonExtension; - }; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - - // - // Pointer to the physical device object we attached to - use this - // for Pnp calls which need a PDO - // - - PDEVICE_OBJECT LowerPdo; - - // - // Device capabilities - // - - PSTORAGE_DEVICE_DESCRIPTOR DeviceDescriptor; - - // - // SCSI port driver capabilities - // - - PSTORAGE_ADAPTER_DESCRIPTOR AdapterDescriptor; - - // - // Current Power state of the device - // - - DEVICE_POWER_STATE DevicePowerState; - - // - // DM Driver for IDE drives hack (ie. OnTrack) - // Bytes to skew all requests - // - - ULONG DMByteSkew; - - // - // DM Driver for IDE drives hack (ie. OnTrack) - // Sectors to skew all requests. - // - - ULONG DMSkew; - - // - // DM Driver for IDE drives hack (ie. OnTrack) - // Flag to indicate whether DM driver has been located on an IDE drive. - // - - BOOLEAN DMActive; - - // - // Buffer for drive parameters returned in IO device control. - // - - DISK_GEOMETRY DiskGeometry; - - // - // Request Sense Buffer - // - - PSENSE_DATA SenseData; - - // - // Request timeout in seconds; - // - - ULONG TimeOutValue; - - // - // System device number - // - - ULONG DeviceNumber; - - // - // Add default Srb Flags. - // - - ULONG SrbFlags; - - // - // Total number of SCSI protocol errors on the device. - // - - ULONG ErrorCount; - - // - // Lock count for removable media. - // - - LONG LockCount; - LONG ProtectedLockCount; - LONG InternalLockCount; - - KEVENT EjectSynchronizationEvent; - - // - // Values for the flags are below. - // - - USHORT DeviceFlags; - - // - // Log2 of sector size - // - - UCHAR SectorShift; - - // - // Flags to optimize CDB handling. - // - -#if (NTDDI_VERSION >= NTDDI_VISTA) - UCHAR CdbForceUnitAccess; -#else - UCHAR ReservedByte; -#endif - - // - // Indicates that the necessary data structures for media change - // detection have been initialized. - // - - PMEDIA_CHANGE_DETECTION_INFO MediaChangeDetectionInfo; - - PKEVENT Unused1; - HANDLE Unused2; - - // - // File system context. Used for kernel-mode requests to disable autorun. - // - - FILE_OBJECT_EXTENSION KernelModeMcnContext; - - // - // Count of media changes. This field is only valid for the root partition - // (ie. if PhysicalDevice == NULL). - // - - ULONG MediaChangeCount; - - // - // Storage for a handle to the directory the PDO's are placed in - // - - HANDLE DeviceDirectory; - - // - // Storage for a release queue request. - // - - KSPIN_LOCK ReleaseQueueSpinLock; - - PIRP ReleaseQueueIrp; - - SCSI_REQUEST_BLOCK ReleaseQueueSrb; - - BOOLEAN ReleaseQueueNeeded; - - BOOLEAN ReleaseQueueInProgress; - - BOOLEAN ReleaseQueueIrpFromPool; - // - // Failure detection storage - // - - BOOLEAN FailurePredicted; - - ULONG FailureReason; - PFAILURE_PREDICTION_INFO FailurePredictionInfo; - - BOOLEAN PowerDownInProgress; - - // - // Interlock for ensuring we don't recurse during enumeration. - // - - ULONG EnumerationInterlock; - - // - // Synchronization object for manipulating the child list. - // - - KEVENT ChildLock; - - // - // The thread which currently owns the ChildLock. This is used to - // avoid recursive acquisition. - // - - PKTHREAD ChildLockOwner; - - // - // The number of times this event has been acquired. - // - - ULONG ChildLockAcquisitionCount; - - // - // Flags for special behaviour required by - // different hardware, such as never spinning down - // or disabling advanced features such as write cache - // - - ULONG ScanForSpecialFlags; - - // - // For delayed retry of power requests at DPC level - // - - KDPC PowerRetryDpc; - KTIMER PowerRetryTimer; - - // - // Context structure for power operations. Since we can only have - // one D irp at any time in the stack we don't need to worry about - // allocating multiple of these structures. - // - - CLASS_POWER_CONTEXT PowerContext; - -#if (NTDDI_VERSION <= NTDDI_WIN2K) - -#if (SPVER(NTDDI_VERSION) < 2)) - - ULONG_PTR Reserved1; - ULONG_PTR Reserved2; - ULONG_PTR Reserved3; - ULONG_PTR Reserved4; - -#else - - // - // Indicates the number of successfully completed - // requests, if error throttling has been applied. - // - ULONG CompletionSuccessCount; - - // - // When too many errors occur and features are turned off - // the old SrbFlags are saved here, so that if the condition - // is fixed, we can restore them to their proper state. - // - ULONG SavedSrbFlags; - - // - // Once recovery has been initiated, cache the old error count value. - // If new errors occur, go back to the feature set as was earlier used. - // - ULONG SavedErrorCount; - - // - // For future expandability - // leave these at the end of the structure. - // - - ULONG_PTR Reserved1; -#endif - -#else - - // - // Hold new private data that only classpnp should modify - // in this structure. - // - - PCLASS_PRIVATE_FDO_DATA PrivateFdoData; - - // - // For future expandability - // leave these at the end of the structure. - // - - ULONG_PTR Reserved2; - ULONG_PTR Reserved3; - ULONG_PTR Reserved4; -#endif - -} FUNCTIONAL_DEVICE_EXTENSION, *PFUNCTIONAL_DEVICE_EXTENSION; - -// -// The following CLASS_SPECIAL_ flags are set in ScanForSpecialFlags -// in the FdoExtension -// - -// Never Spin Up/Down the drive (may not handle properly) -#define CLASS_SPECIAL_DISABLE_SPIN_DOWN 0x00000001 -#define CLASS_SPECIAL_DISABLE_SPIN_UP 0x00000002 - -// Don't bother to lock the queue when powering down -// (used mostly to send a quick stop to a cdrom to abort audio playback) -#define CLASS_SPECIAL_NO_QUEUE_LOCK 0x00000008 - -// Disable write cache due to known bugs -#define CLASS_SPECIAL_DISABLE_WRITE_CACHE 0x00000010 - -// -// Special interpretation of "device not ready / cause not reportable" for -// devices which don't tell us they need to be spun up manually after they -// spin themselves down behind our back. -// -// The down side of this is that if the drive chooses to report -// "device not ready / cause not reportable" to mean "no media in device" -// or any other error which really does require user intervention NT will -// waste a large amount of time trying to spin up a disk which can't be spun -// up. -// - -#define CLASS_SPECIAL_CAUSE_NOT_REPORTABLE_HACK 0x00000020 - -#if ((NTDDI_VERSION == NTDDI_WIN2KSP3) || (OSVER(NTDDI_VERSION) == NTDDI_WINXP)) -// Disabling the write cache is not supported on this device -#define CLASS_SPECIAL_DISABLE_WRITE_CACHE_NOT_SUPPORTED 0x00000040 // Obsolete -#endif -#define CLASS_SPECIAL_MODIFY_CACHE_UNSUCCESSFUL 0x00000040 -#define CLASS_SPECIAL_FUA_NOT_SUPPORTED 0x00000080 - -#define CLASS_SPECIAL_VALID_MASK 0x000000FB -#define CLASS_SPECIAL_RESERVED (~CLASS_SPECIAL_VALID_MASK) - - -// -// Restricted - May only append to this structure for backwards compatibility -// -typedef struct _PHYSICAL_DEVICE_EXTENSION { - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4201) // nameless struct/union - - // - // Common extension data - // - - union { - struct { - ULONG Version; - PDEVICE_OBJECT DeviceObject; - }; - COMMON_DEVICE_EXTENSION CommonExtension; - }; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - - // - // Indicates that the pdo no longer physically exits. - // - - BOOLEAN IsMissing; - - // - // Indicates that the PDO has been handed out to the PNP system. - // - - BOOLEAN IsEnumerated; - - // - // Hold new private data that only classpnp should modify - // in this structure. - // - -#if (NTDDI_VERSION >= NTDDI_WINXP) - PCLASS_PRIVATE_PDO_DATA PrivatePdoData; -#else - ULONG_PTR Reserved1; -#endif - - // - // for future expandability - // leave these at the end of the structure. - // - - ULONG_PTR Reserved2; - ULONG_PTR Reserved3; - ULONG_PTR Reserved4; - -} PHYSICAL_DEVICE_EXTENSION, *PPHYSICAL_DEVICE_EXTENSION; - -// -// Indicates that the device has write caching enabled. -// - -#define DEV_WRITE_CACHE 0x00000001 - -// -// Build SCSI 1 or SCSI 2 CDBs -// - -#define DEV_USE_SCSI1 0x00000002 - -// -// Indicates whether is is safe to send StartUnit commands -// to this device. It will only be off for some removeable devices. -// - -#define DEV_SAFE_START_UNIT 0x00000004 - -// -// Indicates whether it is unsafe to send SCSIOP_MECHANISM_STATUS commands to -// this device. Some devices don't like these 12 byte commands -// - -#define DEV_NO_12BYTE_CDB 0x00000008 - -// -// Indicates that the device is connected to a backup power supply -// and hence write-through and synch cache requests may be ignored -// - -#define DEV_POWER_PROTECTED 0x00000010 - -// -// Indicates that the device supports 16 byte CDBs -// - -#define DEV_USE_16BYTE_CDB 0x00000020 - - -// -// Define context structure for asynchronous completions. -// - -typedef struct _COMPLETION_CONTEXT { - PDEVICE_OBJECT DeviceObject; - SCSI_REQUEST_BLOCK Srb; -}COMPLETION_CONTEXT, *PCOMPLETION_CONTEXT; - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -SCSIPORT_API -ULONG -ClassInitialize( - __in PVOID Argument1, - __in PVOID Argument2, - __in PCLASS_INIT_DATA InitializationData - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ - -// -// List of the GUIDs supported by ClassInitializeEx() and the structure -// type used for the data parameter for that GUID. -// -// {00E34B11-2444-4745-A53D-620100CD82F7} == CLASS_QUERY_WMI_REGINFO_EX_LIST -// {509a8c5f-71d7-48f6-821e-173c49bf2f18} == CLASS_INTERPRET_SENSE_INFO2 - -#define GUID_CLASSPNP_QUERY_REGINFOEX { 0x00e34b11, 0x2444, 0x4745, { 0xa5, 0x3d, 0x62, 0x01, 0x00, 0xcd, 0x82, 0xf7 } } -#define GUID_CLASSPNP_SENSEINFO2 { 0x509a8c5f, 0x71d7, 0x48f6, { 0x82, 0x1e, 0x17, 0x3c, 0x49, 0xbf, 0x2f, 0x18 } } -#define GUID_CLASSPNP_WORKING_SET { 0x105701b0, 0x9e9b, 0x47cb, { 0x97, 0x80, 0x81, 0x19, 0x8a, 0xf7, 0xb5, 0x24 } } - -// -// The structure specifies callbacks that are used instead of the -// PCLASS_QUERY_WMI_REGINFO callbacks. -// -typedef struct _CLASS_QUERY_WMI_REGINFO_EX_LIST -{ - ULONG Size; // Should be sizeof(CLASS_QUERY_REGINFO_EX_LIST) - - __callback PCLASS_QUERY_WMI_REGINFO_EX ClassFdoQueryWmiRegInfoEx; - __callback PCLASS_QUERY_WMI_REGINFO_EX ClassPdoQueryWmiRegInfoEx; - -} CLASS_QUERY_WMI_REGINFO_EX_LIST, *PCLASS_QUERY_WMI_REGINFO_EX_LIST; - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -SCSIPORT_API -ULONG -ClassInitializeEx( - __in PDRIVER_OBJECT DriverObject, - __in LPGUID Guid, - __in PVOID Data - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -__drv_valueIs(<0;==0) -SCSIPORT_API -NTSTATUS -ClassCreateDeviceObject( - __in PDRIVER_OBJECT DriverObject, - __in_z PCCHAR ObjectNameBuffer, - __in PDEVICE_OBJECT LowerDeviceObject, - __in BOOLEAN IsFdo, - __out - __drv_out_deref( - __drv_allocatesMem(Mem) - __drv_aliasesMem - __on_failure(__null)) - PDEVICE_OBJECT *DeviceObject - ); - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__checkReturn -SCSIPORT_API -NTSTATUS -ClassReadDriveCapacity( - __in PDEVICE_OBJECT DeviceObject - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -VOID -ClassReleaseQueue( - __in PDEVICE_OBJECT DeviceObject - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -VOID -ClassSplitRequest( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __in ULONG MaximumBytes - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -NTSTATUS -ClassDeviceControl( - __in PDEVICE_OBJECT DeviceObject, - __inout PIRP Irp - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -IO_COMPLETION_ROUTINE ClassIoComplete; - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -IO_COMPLETION_ROUTINE ClassIoCompleteAssociated; - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -BOOLEAN -ClassInterpretSenseInfo( - __in PDEVICE_OBJECT DeviceObject, - __in PSCSI_REQUEST_BLOCK Srb, - __in UCHAR MajorFunctionCode, - __in ULONG IoDeviceCode, - __in ULONG RetryCount, - __out NTSTATUS *Status, - __out_opt __range(0,100) ULONG *RetryInterval - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -VOID -ClassSendDeviceIoControlSynchronous( - __in ULONG IoControlCode, - __in PDEVICE_OBJECT TargetDeviceObject, - __inout_xcount_opt(max(InputBufferLength, OutputBufferLength)) PVOID Buffer, - __in ULONG InputBufferLength, - __in ULONG OutputBufferLength, - __in BOOLEAN InternalDeviceIoControl, - __out PIO_STATUS_BLOCK IoStatus - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -NTSTATUS -ClassSendIrpSynchronous( - __in PDEVICE_OBJECT TargetDeviceObject, - __in PIRP Irp - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -NTSTATUS -ClassForwardIrpSynchronous( - __in PCOMMON_DEVICE_EXTENSION CommonExtension, - __in PIRP Irp - ); - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -NTSTATUS -ClassSendSrbSynchronous( - __in PDEVICE_OBJECT DeviceObject, - __inout PSCSI_REQUEST_BLOCK Srb, - __in_bcount_opt(BufferLength) PVOID BufferAddress, - __in ULONG BufferLength, - __in BOOLEAN WriteToDevice - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -NTSTATUS -ClassSendSrbAsynchronous( - __in PDEVICE_OBJECT DeviceObject, - __inout PSCSI_REQUEST_BLOCK Srb, - __in PIRP Irp, - __in_bcount_opt(BufferLength) __drv_aliasesMem PVOID BufferAddress, - __in ULONG BufferLength, - __in BOOLEAN WriteToDevice - ); - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -NTSTATUS -ClassBuildRequest( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -ULONG -ClassModeSense( - __in PDEVICE_OBJECT DeviceObject, - __in_bcount(Length) PCHAR ModeSenseBuffer, - __in ULONG Length, - __in UCHAR PageMode - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -PVOID -ClassFindModePage( - __in_bcount(Length) PCHAR ModeSenseBuffer, - __in ULONG Length, - __in UCHAR PageMode, - __in BOOLEAN Use6Byte - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -NTSTATUS -ClassClaimDevice( - __in PDEVICE_OBJECT LowerDeviceObject, - __in BOOLEAN Release - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -__drv_dispatchType(IRP_MJ_SCSI) -DRIVER_DISPATCH ClassInternalIoControl; - -/*++ - -Internal function - described in classpnp\utils.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -VOID -ClassInitializeSrbLookasideList( - __inout PCOMMON_DEVICE_EXTENSION CommonExtension, - __in ULONG NumberElements - ); - -/*++ - -Internal function - described in classpnp\utils.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -VOID -ClassDeleteSrbLookasideList( - __inout PCOMMON_DEVICE_EXTENSION CommonExtension - ); - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -ULONG -ClassQueryTimeOutRegistryValue( - __in PDEVICE_OBJECT DeviceObject - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -NTSTATUS -ClassGetDescriptor( - __in PDEVICE_OBJECT DeviceObject, - __in PSTORAGE_PROPERTY_ID PropertyId, - __deref_out PVOID *Descriptor - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -VOID -ClassInvalidateBusRelations( - __in PDEVICE_OBJECT Fdo - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -VOID -ClassMarkChildrenMissing( - __in PFUNCTIONAL_DEVICE_EXTENSION Fdo - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -BOOLEAN -ClassMarkChildMissing( - __in PPHYSICAL_DEVICE_EXTENSION PdoExtension, - __in BOOLEAN AcquireChildLock - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -VOID -ClassDebugPrint( - __in CLASS_DEBUG_LEVEL DebugPrintLevel, - __in_z PCCHAR DebugMessage, - ... - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__drv_aliasesMem -__drv_maxIRQL(DISPATCH_LEVEL) -SCSIPORT_API -PCLASS_DRIVER_EXTENSION -ClassGetDriverExtension( - __in PDRIVER_OBJECT DriverObject - ); - - -/*++ - -Internal function - described in classpnp\lock.c in ddk sources - ---*/ -SCSIPORT_API -VOID -ClassCompleteRequest( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __in CCHAR PriorityBoost - ); - - -/*++ - -Internal function - described in classpnp\lock.c in ddk sources - ---*/ -SCSIPORT_API -VOID -ClassReleaseRemoveLock( - __in PDEVICE_OBJECT DeviceObject, - PIRP Tag - ); - - -/*++ - -Internal function - described in classpnp\lock.c in ddk sources - ---*/ -SCSIPORT_API -ULONG -ClassAcquireRemoveLockEx( - __in PDEVICE_OBJECT DeviceObject, - PVOID Tag, - __in PCSTR File, - __in ULONG Line - ); - - - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -VOID -ClassUpdateInformationInRegistry( - __in PDEVICE_OBJECT Fdo, - __in PCHAR DeviceName, - __in ULONG DeviceNumber, - __in_bcount_opt(InquiryDataLength) PINQUIRYDATA InquiryData, - __in ULONG InquiryDataLength - ); - - -/*++ - -Internal function - described in classpnp\classwmi.c in ddk sources - ---*/ -SCSIPORT_API -NTSTATUS -ClassWmiCompleteRequest( - __in PDEVICE_OBJECT DeviceObject, - __inout PIRP Irp, - __in NTSTATUS Status, - __in ULONG BufferUsed, - __in CCHAR PriorityBoost - ); - - -/*++ - -Internal function - described in classpnp\classwmi.c in ddk sources - ---*/ -__drv_maxIRQL(DISPATCH_LEVEL) -SCSIPORT_API -NTSTATUS -ClassWmiFireEvent( - __in PDEVICE_OBJECT DeviceObject, - __in LPGUID Guid, - __in ULONG InstanceIndex, - __in ULONG EventDataSize, - __in_bcount(EventDataSize) PVOID EventData - ); - - -/*++ - -Internal function - described in classpnp\autorun.c in ddk sources - ---*/ -SCSIPORT_API -VOID -ClassResetMediaChangeTimer( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension - ); - - -/*++ - -Internal function - described in classpnp\autorun.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -VOID -ClassInitializeMediaChangeDetection( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, - __in PUCHAR EventPrefix - ); - - -/*++ - -Internal function - described in classpnp\autorun.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -NTSTATUS -ClassInitializeTestUnitPolling( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, - __in BOOLEAN AllowDriveToSleep - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -PVPB -ClassGetVpb( - __in PDEVICE_OBJECT DeviceObject - ); - - -/*++ - -Internal function - described in classpnp\power.c in ddk sources - ---*/ -__control_entrypoint(DeviceDriver) -SCSIPORT_API -NTSTATUS -ClassSpinDownPowerHandler( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - - -/*++ - -Internal function - described in classpnp\power.c in ddk sources - ---*/ -NTSTATUS -ClassStopUnitPowerHandler( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - - -/*++ - -Internal function - described in classpnp\autorun.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -ClassSetFailurePredictionPoll( - __inout PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, - __in FAILURE_PREDICTION_METHOD FailurePredictionMethod, - __in ULONG PollingPeriod - ); - - -/*++ - -Internal function - described in classpnp\autorun.c in ddk sources - ---*/ -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -ClassNotifyFailurePredicted( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, - __in_bcount(BufferSize) PUCHAR Buffer, - __in ULONG BufferSize, - __in BOOLEAN LogError, - __in ULONG UniqueErrorValue, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -VOID -ClassAcquireChildLock( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -VOID -ClassReleaseChildLock( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -IO_COMPLETION_ROUTINE ClassSignalCompletion; - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -VOID -ClassSendStartUnit( - __in PDEVICE_OBJECT DeviceObject - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -NTSTATUS -ClassRemoveDevice( - __in PDEVICE_OBJECT DeviceObject, - __in UCHAR RemoveType - ); - - -/*++ - -Internal function - described in classpnp\class.c in ddk sources - ---*/ -SCSIPORT_API -IO_COMPLETION_ROUTINE ClassAsynchronousCompletion; - - -/*++ - -Internal function - described in classpnp\autorun.c in ddk sources - ---*/ -SCSIPORT_API -VOID -ClassCheckMediaState( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension - ); - - -/*++ - -Internal function - described in classpnp\autorun.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -VOID -ClassSetMediaChangeState( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, - __in MEDIA_CHANGE_DETECTION_STATE State, - __in BOOLEAN Wait - ); - - -/*++ - -Internal function - described in classpnp\autorun.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -VOID -ClassEnableMediaChangeDetection( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension - ); - - -/*++ - -Internal function - described in classpnp\autorun.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -VOID -ClassDisableMediaChangeDetection( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension - ); - - -/*++ - -Internal function - described in classpnp\autorun.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -VOID -ClassCleanupMediaChangeDetection( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension - ); - - -/*++ - -Internal function - described in classpnp\utils.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -VOID -ClassGetDeviceParameter( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, - __in_opt PWSTR SubkeyName, - __in PWSTR ParameterName, - __inout PULONG ParameterValue - ); - - -/*++ - -Internal function - described in classpnp\utils.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -ClassSetDeviceParameter( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, - __in_opt PWSTR SubkeyName, - __in PWSTR ParameterName, - __in ULONG ParameterValue - ); - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -/*++ - -Internal function - described in classpnp\create.c in ddk sources - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -PFILE_OBJECT_EXTENSION -ClassGetFsContext( - __in PCOMMON_DEVICE_EXTENSION CommonExtension, - __in PFILE_OBJECT FileObject - ); - -/*++ - -Internal function - described in classpnp\autorun.c in ddk sources - ---*/ -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -ClassSendNotification( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, - __in const GUID * Guid, - __in ULONG ExtraDataSize, - __in_bcount_opt(ExtraDataSize) PVOID ExtraData - ); - -#endif - -// -// could be #define, but this allows typechecking -// - -__inline -BOOLEAN -PORT_ALLOCATED_SENSE( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, - __in PSCSI_REQUEST_BLOCK Srb - ) -{ - return ((BOOLEAN)((TEST_FLAG(Srb->SrbFlags, SRB_FLAGS_PORT_DRIVER_ALLOCSENSE) && - TEST_FLAG(Srb->SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER)) && - (Srb->SenseInfoBuffer != FdoExtension->SenseData)) - ); -} - -__inline -VOID -FREE_PORT_ALLOCATED_SENSE_BUFFER( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, - __in PSCSI_REQUEST_BLOCK Srb - ) -{ - ASSERT(TEST_FLAG(Srb->SrbFlags, SRB_FLAGS_PORT_DRIVER_ALLOCSENSE)); - ASSERT(TEST_FLAG(Srb->SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER)); - ASSERT(Srb->SenseInfoBuffer != FdoExtension->SenseData); - - ExFreePool(Srb->SenseInfoBuffer); - Srb->SenseInfoBuffer = FdoExtension->SenseData; - Srb->SenseInfoBufferLength = SENSE_BUFFER_SIZE; // should be variable? - CLEAR_FLAG(Srb->SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER); - return; -} - - - -/*++//////////////////////////////////////////////////////////////////////////// - -PCLASS_SCAN_FOR_SPECIAL_HANDLER() - -Routine Description: - - This routine is a callback into the driver to set device-specific - flags based upon matches made to the device's inquiry data. Drivers - register for this callback using ClassRegisterScanForSpecial(). - -Irql: - - This routine will be called at KIRQL == PASSIVE_LEVEL - -Arguments: - - DeviceObject is the device object the error occurred on. - - Srb is the Srb that was being processed when the error occurred. - - Status may be overwritten by the routine if it decides that the error - was benign, or otherwise wishes to change the returned status code - for this command - - Retry may be overwritten to specify that this command should or should - not be retried (if the callee supports retrying commands) - -Return Value: - - status - ---*/ -__drv_maxIRQL(PASSIVE_LEVEL) -typedef -VOID -(*PCLASS_SCAN_FOR_SPECIAL_HANDLER) ( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, - __in ULONG_PTR Data - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VOID -ClassScanForSpecial( - __in PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, - __in CLASSPNP_SCAN_FOR_SPECIAL_INFO DeviceList[], - __in PCLASS_SCAN_FOR_SPECIAL_HANDLER Function - ); - -#endif /* _CLASS_ */ - diff --git a/pub/ddk/clfs.h b/pub/ddk/clfs.h deleted file mode 100644 index eccabab..0000000 --- a/pub/ddk/clfs.h +++ /dev/null @@ -1,1294 +0,0 @@ -/*============================================================================= - - Copyright (c) 1998 Microsoft Corporation - - Module Name: - - clfs.h - - Abstract: - - Header file containing all publicly defined data structures for the - common log file system. - - Author: - - Dexter Bradshaw [DexterB] 09-Dec-1998 - - - Revision History: - -=============================================================================*/ - -// begin_wdm -#ifndef _CLFS_PUBLIC_H_ -#define _CLFS_PUBLIC_H_ -// end_wdm - -#ifdef CLFS_KERNEL_MODE - -// begin_wdm -#define CLFSUSER_API -// end_wdm - -#else - -#include - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// PFILE -// -// Define PFILE to be a pointer to _iobuf * -// - -typedef FILE *PFILE, **PPFILE; -typedef DWORD CLFSSTATUS; - -# ifdef __CLFSUSER_EXPORTS__ -# define CLFSUSER_API -# else -# define CLFSUSER_API __declspec(dllimport) -# endif /* __CLFSUSER_EXPORTS__ */ - -# define ClfsLsnEqual LsnEqual -# define ClfsLsnLess LsnLess -# define ClfsLsnGreater LsnGreater -# define ClfsLsnNull LsnNull -# define ClfsLsnCreate LsnCreate -# define ClfsLsnContainer LsnContainer -# define ClfsLsnBlockOffset LsnBlockOffset -# define ClfsLsnRecordSequence LsnRecordSequence -# define ClfsLsnInvalid LsnInvalid -# define ClfsLsnIncrement LsnIncrement - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#endif /* CLFS_KERNEL_MODE */ - -// begin_wdm - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) - -// -// FILE_ATTRIBUTE_DEDICATED is defined as FILE_ATTRIBUTE_TEMPORARY. -// - -#define FILE_ATTRIBUTE_DEDICATED FILE_ATTRIBUTE_TEMPORARY - -// -// Container name and container size extended attribute entry names. -// - -#define EA_CONTAINER_NAME "ContainerName" -#define EA_CONTAINER_SIZE "ContainerSize" - -// -// Base log file name 3-letter extension. -// - -#define CLFS_BASELOG_EXTENSION L".blf" - -// -// Common log file system public flags and constants. -// - -#define CLFS_FLAG_NO_FLAGS 0x00000000 // No flags. -#define CLFS_FLAG_FORCE_APPEND 0x00000001 // Flag to force an append to log queue -#define CLFS_FLAG_FORCE_FLUSH 0x00000002 // Flag to force a log flush -#define CLFS_FLAG_USE_RESERVATION 0x00000004 // Flag to charge a data append to reservation -#define CLFS_FLAG_REENTRANT_FILE_SYSTEM 0x00000008 // Kernel mode create flag indicating a re-entrant file system. -#define CLFS_FLAG_NON_REENTRANT_FILTER 0x00000010 // Kernel mode create flag indicating non-reentrant filter. -#define CLFS_FLAG_REENTRANT_FILTER 0x00000020 // Kernel mode create flag indicating reentrant filter. -#define CLFS_FLAG_IGNORE_SHARE_ACCESS 0x00000040 // Kernel mode create flag indicating IO_IGNORE_SHARE_ACCESS_CHECK semantics. -#define CLFS_FLAG_READ_IN_PROGRESS 0x00000080 // Flag indicating read in progress and not completed. -#define CLFS_FLAG_MINIFILTER_LEVEL 0x00000100 // Kernel mode create flag indicating mini-filter target. -#define CLFS_FLAG_HIDDEN_SYSTEM_LOG 0x00000200 // Kernel mode create flag indicating the log and containers should be marked hidden & system. - - -// -// Flag indicating all CLFS I/O will be targeted to an intermediate level of the I/O stack -// - -#define CLFS_FLAG_FILTER_INTERMEDIATE_LEVEL CLFS_FLAG_NON_REENTRANT_FILTER - -// -// Flag indicating all CLFS I/O will be targeted to the top level of the I/O stack -// - -#define CLFS_FLAG_FILTER_TOP_LEVEL CLFS_FLAG_REENTRANT_FILTER - -// -// CLFS_CONTAINER_INDEX -// -// Index into the container table. -// - -typedef ULONG CLFS_CONTAINER_ID; -typedef CLFS_CONTAINER_ID *PCLFS_CONTAINER_ID; -typedef CLFS_CONTAINER_ID **PPCLFS_CONTAINER_ID; - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#ifdef __CLFS_PRIVATE_LSN__ - -#include - -#else - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) - -// -// CLS_LSN -// - -typedef struct _CLS_LSN -{ - - ULONGLONG Internal; - -} CLS_LSN, *PCLS_LSN, **PPCLS_LSN; - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#endif /* __CLFS_PRIVATE_LSN__ */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) - -// -// Alias CLS prefixed types with CLFS prefixes. -// - -typedef CLS_LSN CLFS_LSN; -typedef CLFS_LSN *PCLFS_LSN, **PPCLFS_LSN; - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -// end_wdm - -// -// Definition of special LSN's: CLFS_LSN_INVALID and CLFS_LSN_NULL. Note that -// [CLFS_LSN_NULL, CLFS_LSN_INVALID) define the only valid LSN range. LSN values -// are strictly monotonic increasing. -// -#ifdef CLFS_KERNEL_MODE - -#if defined __CLFS_SUPPORT_LIBRARY__ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -extern const CLFS_LSN CLFS_LSN_INVALID; -extern const CLFS_LSN CLFS_LSN_NULL; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#elif defined __CLFSUSER_EXPORTS__ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -extern __declspec(dllexport) const CLFS_LSN CLFS_LSN_INVALID; -extern __declspec(dllexport) const CLFS_LSN CLFS_LSN_NULL; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -# else - -// begin_wdm -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -extern __declspec(dllimport) const CLFS_LSN CLFS_LSN_INVALID; -extern __declspec(dllimport) const CLFS_LSN CLFS_LSN_NULL; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ -// end_wdm - -# endif /* __CLFSUSER_EXPORTS__ */ - -#else - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -extern CLFSUSER_API const CLFS_LSN CLFS_LSN_INVALID; -extern CLFSUSER_API const CLFS_LSN CLFS_LSN_NULL; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#endif /* CLFS_KERNEL_MODE */ - -// begin_wdm - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) - -// -// CLS_RECORD_TYPE -// -// Definition of record types. -// - -#ifdef __cplusplus - -const UCHAR ClfsNullRecord = 0x00; // Null record type. -const UCHAR ClfsDataRecord = 0x01; // Client data record. -const UCHAR ClfsRestartRecord = 0x02; // Restart record. - - -// Valid client records are restart and data records. - -const UCHAR ClfsClientRecord = 0x03; - -#else - -#define ClfsNullRecord 0x00 // Null record type. -#define ClfsDataRecord 0x01 // Client data record. -#define ClfsRestartRecord 0x02 // Restart record. - - -// Valid client records are restart and data records. - -#define ClfsClientRecord (ClfsDataRecord|ClfsRestartRecord) - -#endif /* _cplusplus */ - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Log container path prefix indicating the log container's location is -// actually a stream inside of the BLF. -// - -#ifdef _cplusplus - -const LPCWSTR CLFS_CONTAINER_STREAM_PREFIX = L"%BLF%:" - -#else - -#define CLFS_CONTAINER_STREAM_PREFIX L"%BLF%:" - -#endif /* _cplusplus */ - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Log container path prefix indicating the log container's location is -// relative to the base log file (BLF) and not an absolute path. -// Paths which do not being with said prefix are absolute paths. -// - -#ifdef _cplusplus - -const LPCWSTR CLFS_CONTAINER_RELATIVE_PREFIX = L"%BLF%\\" - -#else - -#define CLFS_CONTAINER_RELATIVE_PREFIX L"%BLF%\\" - -#endif /* _cplusplus */ - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Alias CLS prefix with CLFS prefixes. -// - -typedef UCHAR CLS_RECORD_TYPE, *PCLS_RECORD_TYPE, **PPCLS_RECORD_TYPE; -typedef CLS_RECORD_TYPE CLFS_RECORD_TYPE, *PCLFS_RECORD_TYPE, **PPCLFS_RECORD_TYPE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLS_CONTEXT_MODE -// -// The context mode specifies the dirction and access methods used to scan the -// log file. -// - -typedef enum _CLS_CONTEXT_MODE -{ - ClsContextNone = 0x00, - ClsContextUndoNext, - ClsContextPrevious, - ClsContextForward - -} CLS_CONTEXT_MODE, *PCLS_CONTEXT_MODE, **PPCLS_CONTEXT_MODE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef enum _CLFS_CONTEXT_MODE -{ - ClfsContextNone = 0x00, - ClfsContextUndoNext, - ClfsContextPrevious, - ClfsContextForward - -} CLFS_CONTEXT_MODE, *PCLFS_CONTEXT_MODE, **PPCLFS_CONTEXT_MODE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFSD_NODE_ID -// -// Common log file system node identifier. Every CLFS file system -// structure has a node identity and type. The node type is a signature -// field while the size is used in for consistency checking. -// - -typedef struct _CLFS_NODE_ID -{ - ULONG cType; // CLFS node type. - ULONG cbNode; // CLFS node size. - -} CLFS_NODE_ID, *PCLFS_NODE_ID; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLS_WRITE_ENTRY -// -// Write entry specifying the contents of a user buffer and length that are -// marshalled in the space reservation and append interface of the CLS API. -// - -typedef struct _CLS_WRITE_ENTRY -{ - PVOID Buffer; - ULONG ByteLength; -} CLS_WRITE_ENTRY, *PCLS_WRITE_ENTRY, **PPCLS_WRITE_ENTRY; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef CLS_WRITE_ENTRY CLFS_WRITE_ENTRY; -typedef CLFS_WRITE_ENTRY *PCLFS_WRITE_ENTRY, **PPCLFS_WRITE_ENTRY; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_LOG_ID -// -// A log identifier is a GUID that describes uniquely a physical log file. -// - -typedef GUID CLFS_LOG_ID; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_INFORMATION -// -// Logical log file information structure describing either virtual or physical log -// file data, depending on the type of information queried. -// - -typedef struct _CLS_INFORMATION -{ - LONGLONG TotalAvailable; // Total log data space available. - LONGLONG CurrentAvailable; // Useable space in the log file. - LONGLONG TotalReservation; // Space reserved for UNDO's (aggregate for physical log) - ULONGLONG BaseFileSize; // Size of the base log file. - ULONGLONG ContainerSize; // Uniform size of log containers. - ULONG TotalContainers; // Total number of containers. - ULONG FreeContainers; // Number of containers not in active log. - ULONG TotalClients; // Total number of clients. - ULONG Attributes; // Log file attributes. - ULONG FlushThreshold; // Log file flush threshold. - ULONG SectorSize; // Underlying container sector size. - CLS_LSN MinArchiveTailLsn; // Marks the global archive tail. - CLS_LSN BaseLsn; // Start of the active log region. - CLS_LSN LastFlushedLsn; // Last flushed LSN in active log. - CLS_LSN LastLsn; // End of active log region. - CLS_LSN RestartLsn; // Location of restart record. - GUID Identity; // Unique identifier for the log. -} CLS_INFORMATION, *PCLS_INFORMATION, *PPCLS_INFORMATION; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Alias CLS prefixes with CLS prefixes. -// - -typedef CLS_INFORMATION CLFS_INFORMATION; -typedef CLFS_INFORMATION *PCLFS_INFORMATION, *PPCLFS_INFORMATION; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ -/* -// -// CLFS_CLIENT_INFORMATION -// -// The client information structure maintains client-based log metadata. -// - -typedef struct _CLS_CLIENT_INFORMATION -{ - CLS_INFORMATION ClfsInfo; // Contains base log file information. - ULONG ClientAttributes; // Virtual log file attributes. - LONGLONG ClientUndoCommitment; // Max. undo commitment for client. - CLS_LSN ClientArchiveTailLsn; // Marks the client archive tail. - CLS_LSN ClientBaseLsn; // Min. client LSN in active log region. - CLS_LSN ClientLastLsn; // Max. client LSN in active log region. - CLS_LSN ClientRestartLsn; // Location of restart record. - -} CLS_CLIENT_INFORMATION, *PCLS_CLIENT_INFORMATION, **PPCLS_CLIENT_INFORMATION; - -// -// Alias CLS prefixes with CLS prefixes. -// - -typedef CLS_CLIENT_INFORMATION CLFS_CLIENT_INFORMATION; -typedef CLFS_CLIENT_INFORMATION *PCLFS_CLIENT_INFORMATION, *PPCLFS_CLIENT_INFORMATION; -*/ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_LOG_NAME_INFORMATION -// -// The client information structure stores the name of a log. It is used -// to communicate ClfsLogNameInformation and ClfsLogPhysicalNameInformation. -// - -typedef struct _CLFS_LOG_NAME_INFORMATION -{ - - USHORT NameLengthInBytes; - WCHAR Name[1]; - -} CLFS_LOG_NAME_INFORMATION, *PCLFS_LOG_NAME_INFORMATION, **PPCLFS_LOG_NAME_INFORMATION; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_STREAM_ID_INFORMATION -// -// The client information structure provides a permanent identifier unique -// to the log for the stream in question. -// - -typedef struct _CLFS_STREAM_ID_INFORMATION -{ - - UCHAR StreamIdentifier; - -} CLFS_STREAM_ID_INFORMATION, *PCLFS_STREAM_ID_INFORMATION, **PPCLFS_STREAM_ID_INFORMATION; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_VISTA) || (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN) -// -// CLFS_PHYSICAL_LSN_INFORMATION -// -// An information structure that describes a virtual:physical LSN pairing -// for the stream identified in the structure. -// -#pragma pack(push,8) -typedef struct _CLFS_PHYSICAL_LSN_INFORMATION -{ - UCHAR StreamIdentifier; - CLFS_LSN VirtualLsn; - CLFS_LSN PhysicalLsn; - -} CLFS_PHYSICAL_LSN_INFORMATION, *PCLFS_PHYSICAL_LSN_INFORMATION; -#pragma pack(pop) -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLS_CONTAINER_STATE -// -// At any point in time a container could be inactive or unitialized, active, -// pending deletion from the list of free containers, pending archival, or -// pending deletion while waiting to be archived. -// - -typedef UINT32 CLS_CONTAINER_STATE, *PCLS_CONTAINER_STATE, *PPCLS_CONTAINER_STATE; -typedef CLS_CONTAINER_STATE CLFS_CONTAINER_STATE, *PCLFS_CONTAINER_STATE, *PPCLFS_CONTAINER_STATE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#ifdef __cplusplus - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -const CLFS_CONTAINER_STATE ClsContainerInitializing = 0x01; -const CLFS_CONTAINER_STATE ClsContainerInactive = 0x02; -const CLFS_CONTAINER_STATE ClsContainerActive = 0x04; -const CLFS_CONTAINER_STATE ClsContainerActivePendingDelete = 0x08; -const CLFS_CONTAINER_STATE ClsContainerPendingArchive = 0x10; -const CLFS_CONTAINER_STATE ClsContainerPendingArchiveAndDelete = 0x20; - -const CLFS_CONTAINER_STATE ClfsContainerInitializing = 0x01; -const CLFS_CONTAINER_STATE ClfsContainerInactive = 0x02; -const CLFS_CONTAINER_STATE ClfsContainerActive = 0x04; -const CLFS_CONTAINER_STATE ClfsContainerActivePendingDelete = 0x08; -const CLFS_CONTAINER_STATE ClfsContainerPendingArchive = 0x10; -const CLFS_CONTAINER_STATE ClfsContainerPendingArchiveAndDelete= 0x20; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#else - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -#define ClsContainerInitializing 0x01 -#define ClsContainerInactive 0x02 -#define ClsContainerActive 0x04 -#define ClsContainerActivePendingDelete 0x08 -#define ClsContainerPendingArchive 0x10 -#define ClsContainerPendingArchiveAndDelete 0x20 - -#define ClfsContainerInitializing 0x01 -#define ClfsContainerInactive 0x02 -#define ClfsContainerActive 0x04 -#define ClfsContainerActivePendingDelete 0x08 -#define ClfsContainerPendingArchive 0x10 -#define ClfsContainerPendingArchiveAndDelete 0x20 -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#endif /* __cplusplus */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_MAX_CONTAINER_INFO -// -// The maximum length, in bytes, of the FileName field in the CLFS -// container information structure. -// - -#ifdef __cplusplus - -const ULONG CLFS_MAX_CONTAINER_INFO = (256); - -#else - -#define CLFS_MAX_CONTAINER_INFO (256) - -#endif /* __cplusplus */ - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLS_CONTAINER_INFORMATION -// -// This structure defines a container descriptor. The descriptor specifies the -// container's creation and access times, size, file system name, file system -// attributes, state, minimum, and maximum LSNs. -// - -typedef struct _CLS_CONTAINER_INFORMATION -{ - ULONG FileAttributes; // File system attribute flag. - ULONGLONG CreationTime; // File creation time. - ULONGLONG LastAccessTime; // Last time container was read/written. - ULONGLONG LastWriteTime; // Last time container was written. - LONGLONG ContainerSize; // Size of container in bytes. - ULONG FileNameActualLength; // Length of the actual file name. - ULONG FileNameLength; // Length of file name in buffer - WCHAR FileName [CLFS_MAX_CONTAINER_INFO];// File system name for container. - CLFS_CONTAINER_STATE State; // Current state of the container. - CLFS_CONTAINER_ID PhysicalContainerId; // Physical container identifier. - CLFS_CONTAINER_ID LogicalContainerId; // Logical container identifier. - -} CLS_CONTAINER_INFORMATION, *PCLS_CONTAINER_INFORMATION, **PPCLS_CONTAINER_INFORMATION; - -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef CLS_CONTAINER_INFORMATION CLFS_CONTAINER_INFORMATION; -typedef CLFS_CONTAINER_INFORMATION *PCLFS_CONTAINER_INFORMATION, **PPCLFS_CONTAINER_INFORMATION; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_LOG_INFORMATION_CLASS -// -// The information class specifies the kind of information a caller -// wishes to query or set on a log file. -// - -typedef enum _CLS_LOG_INFORMATION_CLASS -{ - - ClfsLogBasicInformation = 0x00, // For virtual or physical logs, indicates the respective basic information. - ClfsLogBasicInformationPhysical, // Always indicates physical log basic information. - ClfsLogPhysicalNameInformation, // Always indicates physical name information. - ClfsLogStreamIdentifierInformation, // Virtual/physical log agnostic. -#if (NTDDI_VERSION >= NTDDI_VISTA) || (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN) - ClfsLogSystemMarkingInformation, // Count of system marking references. - ClfsLogPhysicalLsnInformation // Maps virtual LSNs to physical LSNs; only valid for physical logs. -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -} CLS_LOG_INFORMATION_CLASS, *PCLS_LOG_INFORMATION_CLASS, **PPCLS_LOG_INFORMATION_CLASS; - -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef CLS_LOG_INFORMATION_CLASS CLFS_LOG_INFORMATION_CLASS; -typedef CLFS_LOG_INFORMATION_CLASS *PCLFS_LOG_INFORMATION_CLASS, **PPCLFS_LOG_INFORMATION_CLASS; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLS_IOSTATS_CLASS -// -// Enumerated type defining the class of I/O statistics. -// - -typedef enum _CLS_IOSTATS_CLASS -{ - ClsIoStatsDefault = 0x0000, - ClsIoStatsMax = 0xFFFF - -} CLS_IOSTATS_CLASS, *PCLS_IOSTATS_CLASS, **PPCLS_IOSTATS_CLASS; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_IOSTATS_CLASS -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef enum _CLFS_IOSTATS_CLASS -{ - ClfsIoStatsDefault = 0x0000, - ClfsIoStatsMax = 0xFFFF - -} CLFS_IOSTATS_CLASS, *PCLFS_IOSTATS_CLASS, **PPCLFS_IOSTATS_CLASS; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLS_IO_STATISTICS -// -// This structure defines I/O performance counters particular to a log file. It consists -// of a header followed by the I/O statistics counters. The header is being ignored for -// now. -// - -typedef struct _CLS_IO_STATISTICS_HEADER -{ - UCHAR ubMajorVersion; // Major version of the statistics buffer. - UCHAR ubMinorVersion; // Minor version of the statistics buffer. - CLFS_IOSTATS_CLASS eStatsClass; // I/O statistics class. - USHORT cbLength; // Length of the statistics buffer. - ULONG coffData; // Offset of statistics counters. - -} CLS_IO_STATISTICS_HEADER, *PCLS_IO_STATISTICS_HEADER, **PPCLS_IO_STATISTICS_HEADER; - -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef CLS_IO_STATISTICS_HEADER CLFS_IO_STATISTICS_HEADER; -typedef CLFS_IO_STATISTICS_HEADER *PCLFS_IO_STATISTICS_HEADER, **PPCLFS_IO_STATISTICS_HEADER; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -typedef struct _CLS_IO_STATISTICS -{ - CLS_IO_STATISTICS_HEADER hdrIoStats; // Statistics buffer header. - ULONGLONG cFlush; // Flush count. - ULONGLONG cbFlush; // Cumulative number of bytes flushed. - ULONGLONG cMetaFlush; // Metadata flush count. - ULONGLONG cbMetaFlush; // Cumulative number of metadata bytes flushed. - -} CLS_IO_STATISTICS, *PCLS_IO_STATISTICS, **PPCLS_IO_STATISTICS; - -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef CLS_IO_STATISTICS CLFS_IO_STATISTICS; -typedef CLFS_IO_STATISTICS *PCLFS_IO_STATISTICS, **PPCLFS_IO_STATISTICS; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_SCAN_MODE -// -// Container scan mode flags. -// - -#ifdef __cplusplus - -const UCHAR CLFS_SCAN_INIT = 0x01; -const UCHAR CLFS_SCAN_FORWARD = 0x02; -const UCHAR CLFS_SCAN_BACKWARD = 0x04; -const UCHAR CLFS_SCAN_CLOSE = 0x08; -const UCHAR CLFS_SCAN_INITIALIZED = 0x10; -const UCHAR CLFS_SCAN_BUFFERED = 0x20; - -#else - -#define CLFS_SCAN_INIT 0x01 -#define CLFS_SCAN_FORWARD 0x02 -#define CLFS_SCAN_BACKWARD 0x04 -#define CLFS_SCAN_CLOSE 0x08 -#define CLFS_SCAN_INITIALIZED 0x10 -#define CLFS_SCAN_BUFFERED 0x20 - -#endif - -typedef UCHAR CLFS_SCAN_MODE, *PCLFS_SCAN_MODE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -// end_wdm - -#ifdef CLFS_KERNEL_MODE - -// begin_wdm -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) - -// -// CLFS_SCAN_CONTEXT -// -// Container scan context for scanning all containers in a given physical log -// file. -// - -// -// The log file object wraps an NT file object and the size of the structure. -// The log file object may be modified in the near future and there should be no -// dependencies on the size of the structure itself. -// - -typedef FILE_OBJECT LOG_FILE_OBJECT, *PLOG_FILE_OBJECT, **PPLOG_FILE_OBJECT; - -#if defined(_MSC_VER) -#if (_MSC_VER >= 1200) -#pragma warning(push) -#pragma warning(disable:4324) // structure padded due to __declspec(align()) -#endif -#endif - -typedef struct _CLS_SCAN_CONTEXT -{ - CLFS_NODE_ID cidNode; - PLOG_FILE_OBJECT plfoLog; - __declspec(align(8)) ULONG cIndex; - __declspec(align(8)) ULONG cContainers; - __declspec(align(8)) ULONG cContainersReturned; - __declspec(align(8)) CLFS_SCAN_MODE eScanMode; - __declspec(align(8)) PCLS_CONTAINER_INFORMATION pinfoContainer; - -} CLS_SCAN_CONTEXT, *PCLS_SCAN_CONTEXT, **PPCLS_SCAN_CONTEXT; - -#if defined(_MSC_VER) -#if (_MSC_VER >= 1200) -#pragma warning(pop) -#endif -#endif - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -// end_wdm - -#else - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -typedef struct _CLS_SCAN_CONTEXT -{ - CLFS_NODE_ID cidNode; - HANDLE hLog; - __declspec(align(8)) ULONG cIndex; - __declspec(align(8)) ULONG cContainers; - __declspec(align(8)) ULONG cContainersReturned; - __declspec(align(8)) CLFS_SCAN_MODE eScanMode; - __declspec(align(8)) PCLS_CONTAINER_INFORMATION pinfoContainer; - -} CLS_SCAN_CONTEXT, *PCLS_SCAN_CONTEXT, **PPCLS_SCAN_CONTEXT; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#endif /* CLFS_KERNEL_MODE */ - -// begin_wdm - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef CLS_SCAN_CONTEXT CLFS_SCAN_CONTEXT; -typedef CLFS_SCAN_CONTEXT *PCLFS_SCAN_CONTEXT, **PPCLFS_SCAN_CONTEXT; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_ARCHIVE_DESCRIPTOR -// -// Log archive descriptors describe the set of discrete but logically -// contiguous disk extents comprising a snapshot of the active log when -// preparing for archival. Log archive descriptors specify enough information -// for log archive clients directly access the relevant contents of containers -// for archiving and restoring a snapshot of the log. -// - -typedef struct _CLS_ARCHIVE_DESCRIPTOR -{ - ULONGLONG coffLow; - ULONGLONG coffHigh; - CLS_CONTAINER_INFORMATION infoContainer; - -} CLS_ARCHIVE_DESCRIPTOR, *PCLS_ARCHIVE_DESCRIPTOR, **PPCLS_ARCHIVE_DESCRIPTOR; - -// -// Alias CLS prefixes with CLFS prefixes. -// - -typedef CLS_ARCHIVE_DESCRIPTOR CLFS_ARCHIVE_DESCRIPTOR; -typedef CLFS_ARCHIVE_DESCRIPTOR *PCLFS_ARCHIVE_DESCRIPTOR, **PPCLFS_ARCHIVE_DESCRIPTOR; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_ALLOCATION_ROUTINE -// -// Allocate a blocks for marshalled reads or writes -// - -typedef PVOID (* CLFS_BLOCK_ALLOCATION) (ULONG cbBufferLength, PVOID pvUserContext); - -// -// CLFS_DEALLOCATION_ROUTINE -// -// Deallocate buffers allocated by the CLFS_ALLOCATION_ROUTINE. -// - -typedef void (* CLFS_BLOCK_DEALLOCATION) (PVOID pvBuffer, PVOID pvUserContext); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_LOG_ARCHIVE_MODE -// -// Describes the archive support behavior for the log. -// - -typedef enum _CLFS_LOG_ARCHIVE_MODE -{ - - ClfsLogArchiveEnabled = 0x01, - ClfsLogArchiveDisabled = 0x02 - -} CLFS_LOG_ARCHIVE_MODE, *PCLFS_LOG_ARCHIVE_MODE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -//----------------------------------------------------------------------------- -// LSN OPERATORS -//----------------------------------------------------------------------------- - -#ifdef __cplusplus -extern "C" -{ -#endif - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnEqual -// -// Method Description: -// -// Check for the equivalence of LSNs. -// -// Arguments: -// -// plsn1 -- first LSN comparator -// plsn2 -- second LSN comparator -// -// -// Return Value: -// -// TRUE if LSN values are equivalent and FALSE otherwise. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API BOOLEAN NTAPI -ClfsLsnEqual -( - __in const CLFS_LSN* plsn1, - __in const CLFS_LSN* plsn2 -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnLess -// -// Method Description: -// -// Check if LSN1 is less than LSN2. -// -// Arguments: -// -// plsn1 -- first LSN comparator -// plsn2 -- second LSN comparator -// -// -// Return Value: -// -// TRUE if LSN1 is less than LSN2 and FALSE otherwise. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API BOOLEAN NTAPI -ClfsLsnLess -( - __in const CLFS_LSN* plsn1, - __in const CLFS_LSN* plsn2 -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnGreater -// -// Method Description: -// -// Check if LSN1 is greater than LSN2. -// -// Arguments: -// -// plsn1 -- first LSN comparator -// plsn2 -- second LSN comparator -// -// -// Return Value: -// -// TRUE if LSN1 is greater than LSN2 and FALSE otherwise. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API BOOLEAN NTAPI -ClfsLsnGreater -( - __in const CLFS_LSN* plsn1, - __in const CLFS_LSN* plsn2 -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnNull (Inline) -// -// Method Description: -// -// Check whether or not an LSN is CLFS_LSN_NULL. -// -// Arguments: -// -// plsn -- reference to LSN tested against the NULL value. -// -// -// Return Value: -// -// TRUE if and only if an LSN is equivalent to CLFS_LSN_NULL. -// LSNs with the value CLFS_LSN_INVALID will return FALSE. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API BOOLEAN NTAPI -ClfsLsnNull -( - __in const CLFS_LSN* plsn -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnContainer (Inline) -// -// Routine Description: -// -// Extract the container identifier from the LSN. -// -// Arguments: -// -// plsn -- get block offset from this LSN -// -// Return Value: -// -// Returns the container identifier for the LSN. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API CLFS_CONTAINER_ID NTAPI -ClfsLsnContainer -( - __in const CLFS_LSN* plsn -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnCreate (Inline) -// -// Routine Description: -// -// Create an LSN given a log identifier, a container identifier, a block -// offset and a bucket identifier. Caller must test for invalid LSN after -// making this call. -// -// Arguments: -// -// cidContainer -- container identifier -// offBlock -- block offset -// cRecord -- ordinal number of the record in block -// -// Return Value: -// -// Returns a valid LSN if successful, otherwise it returns -// CLFS_LSN_INVALID -// -//----------------------------------------------------------------------------- - -CLFSUSER_API CLFS_LSN NTAPI -ClfsLsnCreate -( - __in CLFS_CONTAINER_ID cidContainer, - __in ULONG offBlock, - __in ULONG cRecord -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnBlockOffset (Inline) -// -// Routine Description: -// -// Extract the block offset from the LSN. -// -// Arguments: -// -// plsn -- get block offset from this LSN -// -// Return Value: -// -// Returns the block offset for the LSN. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API ULONG NTAPI -ClfsLsnBlockOffset -( - __in const CLFS_LSN* plsn -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnRecordSequence (Inline) -// -// Routine Description: -// -// Extract the bucket identifier from the LSN. -// -// Arguments: -// -// plsn -- get block offset from this LSN -// -// Return Value: -// -// Returns the bucket identifier for the LSN. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API ULONG NTAPI -ClfsLsnRecordSequence -( - __in const CLFS_LSN* plsn -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnInvalid -// -// Method Description: -// -// Check whether or not an LSN is CLFS_LSN_INVALID. -// -// Arguments: -// -// plsn -- reference to LSN tested against CLFS_LSN_INVALID. -// -// -// Return Value: -// -// TRUE if and only if an LSN is equivalent to CLFS_LSN_INVALID. -// LSNs with the value CLFS_LSN_NULL will return FALSE. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API BOOLEAN NTAPI -ClfsLsnInvalid -( - __in const CLFS_LSN* plsn -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnIncrement -// -// Method Description: -// -// Increment and LSN by 1 -// -// Arguments: -// -// plsn -- LSN to be incremented. -// -// -// Return Value: -// -// A valid LSN next in sequence to the input LSN, if successful. -// Otherwise, this function returns CLFS_LSN_INVALID. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API CLFS_LSN NTAPI -ClfsLsnIncrement (__in PCLFS_LSN plsn); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus - -#ifdef CLFS_OPERATORS - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// LSN arithmetic increment operator. -// - -inline CLFS_LSN -operator++ -( - __inout CLFS_LSN& refLsn -) -{ - // - // Prefix increment operator. - // - - refLsn = ClfsLsnIncrement (&refLsn); - return refLsn; -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// BOOLEAN LSN operators. -// - -inline BOOLEAN -operator< -( - __in const CLFS_LSN& refLsn1, - __in const CLFS_LSN& refLsn2 -) -{ - return (ClfsLsnLess ((PCLFS_LSN) &refLsn1, (PCLFS_LSN) &refLsn2)); -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -inline BOOLEAN -operator> -( - __in const CLFS_LSN& refLsn1, - __in const CLFS_LSN& refLsn2 -) -{ - return (ClfsLsnGreater ((PCLFS_LSN) &refLsn1, (PCLFS_LSN) &refLsn2)); -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -inline BOOLEAN -operator== -( - __in const CLFS_LSN& refLsn1, - __in const CLFS_LSN& refLsn2 -) -{ - return (ClfsLsnEqual ((PCLFS_LSN) &refLsn1, (PCLFS_LSN) &refLsn2)); -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -inline BOOLEAN -operator!= -( - __in const CLFS_LSN& refLsn1, - __in const CLFS_LSN& refLsn2 -) -{ - return (!ClfsLsnEqual ((PCLFS_LSN) &refLsn1, (PCLFS_LSN) &refLsn2)); -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -inline BOOLEAN -operator<= -( - __in const CLFS_LSN& refLsn1, - __in const CLFS_LSN& refLsn2 -) -{ - return (!ClfsLsnGreater ((PCLFS_LSN) &refLsn1, (PCLFS_LSN) &refLsn2)); -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -inline BOOLEAN -operator>= -( - __in const CLFS_LSN& refLsn1, - __in const CLFS_LSN& refLsn2 -) -{ - return (!ClfsLsnLess ((PCLFS_LSN) &refLsn1, (PCLFS_LSN) &refLsn2)); -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#endif /* CLFS_OPERATORS */ - -#endif /* __cplusplus */ - -#endif /* _CLFS_PUBLIC_H_ */ -// end_wdm - -//----------------------------------------------------------------------------- -// END OF FILE -//----------------------------------------------------------------------------- - diff --git a/pub/ddk/clfslsn.h b/pub/ddk/clfslsn.h deleted file mode 100644 index c6d6b63..0000000 --- a/pub/ddk/clfslsn.h +++ /dev/null @@ -1,88 +0,0 @@ -/*============================================================================= - - 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 - diff --git a/pub/ddk/clfsmsg.h b/pub/ddk/clfsmsg.h deleted file mode 100644 index a055fa7..0000000 --- a/pub/ddk/clfsmsg.h +++ /dev/null @@ -1,164 +0,0 @@ - -/*============================================================================= - - 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 -//----------------------------------------------------------------------------- - diff --git a/pub/ddk/cloneviewhelper.h b/pub/ddk/cloneviewhelper.h deleted file mode 100644 index a73c8b3..0000000 --- a/pub/ddk/cloneviewhelper.h +++ /dev/null @@ -1,409 +0,0 @@ - - -/* 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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#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 - - - diff --git a/pub/ddk/cloneviewhelper.idl b/pub/ddk/cloneviewhelper.idl deleted file mode 100644 index ae4d6c4..0000000 --- a/pub/ddk/cloneviewhelper.idl +++ /dev/null @@ -1,103 +0,0 @@ -// 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(); -}; - diff --git a/pub/ddk/codecapi.h b/pub/ddk/codecapi.h deleted file mode 100644 index ca70835..0000000 --- a/pub/ddk/codecapi.h +++ /dev/null @@ -1,1940 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - codecapi.h - -Abstract: - - CodecAPI Definitions. - ---*/ - -#ifndef __CODECAPI_H -#define __CODECAPI_H - -#ifdef UUID_GEN - #define DEFINE_CODECAPI_GUID( name, guidstr, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11 ) \ - OUR_GUID_ENTRY( CODECAPI_##name, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11 ) -#else - #if !defined(_KS_) - #error KS.H must be included before codecapi.H - #endif // !defined(_KS_) - -/* Ideally we would like: - #define DEFINE_CODECAPI_GUID( name, guidstr, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11 ) \ - #define STATIC_CODECAPI_##name 0x##g1, 0x##g2, 0x##g3, 0x##g4, 0x##g5, 0x##g6, 0x##g7, 0x##g8, 0x##g9, 0x##g10, 0x##g11 - DEFINE_GUIDSTRUCT( guidstr, CODECAPI_##name ) - #define CODECAPI_##name DEFINE_GUIDNAMED( CODECAPI_##name ) - Unfortunately you can't invoke multiple defines from a single statement -*/ - #define DEFINE_CODECAPI_GUID( name, guidstr, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11 ) DEFINE_GUIDSTRUCT( guidstr, CODECAPI_##name ); - #define DEFINE_CODECAPI_GUIDNAMED( name ) DEFINE_GUIDNAMED( CODECAPI_##name ) -#endif - -// Windows CodecAPI Properties - -// Legend for the -// Reference VariantType VariantField -// UINT8 VT_UI1 bVal -// UINT16 VT_UI2 uiVal -// UINT32 VT_UI4 ulVal -// UINT64 VT_UI8 ullVal -// INT8 VT_I1 eVal -// INT16 VT_I2 iVal -// INT32 VT_I4 lVal -// INT64 VT_I8 llVal -// BOOL VT_BOOL boolVal -// GUID VT_BSTR bstrVal (guid string) -// UINT32/UNINT32 VT_UI8 ullVal (ratio) - -// { Static definitions - #define STATIC_CODECAPI_AVEncCommonFormatConstraint 0x57cbb9b8, 0x116f, 0x4951, 0xb4, 0x0c, 0xc2, 0xa0, 0x35, 0xed, 0x8f, 0x17 - #define STATIC_CODECAPI_GUID_AVEncCommonFormatUnSpecified 0xaf46a35a, 0x6024, 0x4525, 0xa4, 0x8a, 0x09, 0x4b, 0x97, 0xf5, 0xb3, 0xc2 - #define STATIC_CODECAPI_GUID_AVEncCommonFormatDVD_V 0xcc9598c4, 0xe7fe, 0x451d, 0xb1, 0xca, 0x76, 0x1b, 0xc8, 0x40, 0xb7, 0xf3 - #define STATIC_CODECAPI_GUID_AVEncCommonFormatDVD_DashVR 0xe55199d6, 0x044c, 0x4dae, 0xa4, 0x88, 0x53, 0x1e, 0xd3, 0x06, 0x23, 0x5b - #define STATIC_CODECAPI_GUID_AVEncCommonFormatDVD_PlusVR 0xe74c6f2e, 0xec37, 0x478d, 0x9a, 0xf4, 0xa5, 0xe1, 0x35, 0xb6, 0x27, 0x1c - #define STATIC_CODECAPI_GUID_AVEncCommonFormatVCD 0x95035bf7, 0x9d90, 0x40ff, 0xad, 0x5c, 0x5c, 0xf8, 0xcf, 0x71, 0xca, 0x1d - #define STATIC_CODECAPI_GUID_AVEncCommonFormatSVCD 0x51d85818, 0x8220, 0x448c, 0x80, 0x66, 0xd6, 0x9b, 0xed, 0x16, 0xc9, 0xad - #define STATIC_CODECAPI_GUID_AVEncCommonFormatATSC 0x8d7b897c, 0xa019, 0x4670, 0xaa, 0x76, 0x2e, 0xdc, 0xac, 0x7a, 0xc2, 0x96 - #define STATIC_CODECAPI_GUID_AVEncCommonFormatDVB 0x71830d8f, 0x6c33, 0x430d, 0x84, 0x4b, 0xc2, 0x70, 0x5b, 0xaa, 0xe6, 0xdb - #define STATIC_CODECAPI_GUID_AVEncCommonFormatMP3 0x349733cd, 0xeb08, 0x4dc2, 0x81, 0x97, 0xe4, 0x98, 0x35, 0xef, 0x82, 0x8b - #define STATIC_CODECAPI_GUID_AVEncCommonFormatHighMAT 0x1eabe760, 0xfb2b, 0x4928, 0x90, 0xd1, 0x78, 0xdb, 0x88, 0xee, 0xe8, 0x89 - #define STATIC_CODECAPI_GUID_AVEncCommonFormatHighMPV 0xa2d25db8, 0xb8f9, 0x42c2, 0x8b, 0xc7, 0x0b, 0x93, 0xcf, 0x60, 0x47, 0x88 - #define STATIC_CODECAPI_AVEncCodecType 0x08af4ac1, 0xf3f2, 0x4c74, 0x9d, 0xcf, 0x37, 0xf2, 0xec, 0x79, 0xf8, 0x26 - #define STATIC_CODECAPI_GUID_AVEncMPEG1Video 0xc8dafefe, 0xda1e, 0x4774, 0xb2, 0x7d, 0x11, 0x83, 0x0c, 0x16, 0xb1, 0xfe - #define STATIC_CODECAPI_GUID_AVEncMPEG2Video 0x046dc19a, 0x6677, 0x4aaa, 0xa3, 0x1d, 0xc1, 0xab, 0x71, 0x6f, 0x45, 0x60 - #define STATIC_CODECAPI_GUID_AVEncMPEG1Audio 0xd4dd1362, 0xcd4a, 0x4cd6, 0x81, 0x38, 0xb9, 0x4d, 0xb4, 0x54, 0x2b, 0x04 - #define STATIC_CODECAPI_GUID_AVEncMPEG2Audio 0xee4cbb1f, 0x9c3f, 0x4770, 0x92, 0xb5, 0xfc, 0xb7, 0xc2, 0xa8, 0xd3, 0x81 - #define STATIC_CODECAPI_GUID_AVEncWMV 0x4e0fef9b, 0x1d43, 0x41bd, 0xb8, 0xbd, 0x4d, 0x7b, 0xf7, 0x45, 0x7a, 0x2a - #define STATIC_CODECAPI_GUID_AVEndMPEG4Video 0xdd37b12a, 0x9503, 0x4f8b, 0xb8, 0xd0, 0x32, 0x4a, 0x00, 0xc0, 0xa1, 0xcf - #define STATIC_CODECAPI_GUID_AVEncH264Video 0x95044eab, 0x31b3, 0x47de, 0x8e, 0x75, 0x38, 0xa4, 0x2b, 0xb0, 0x3e, 0x28 - #define STATIC_CODECAPI_GUID_AVEncDV 0x09b769c7, 0x3329, 0x44fb, 0x89, 0x54, 0xfa, 0x30, 0x93, 0x7d, 0x3d, 0x5a - #define STATIC_CODECAPI_GUID_AVEncWMAPro 0x1955f90c, 0x33f7, 0x4a68, 0xab, 0x81, 0x53, 0xf5, 0x65, 0x71, 0x25, 0xc4 - #define STATIC_CODECAPI_GUID_AVEncWMALossless 0x55ca7265, 0x23d8, 0x4761, 0x90, 0x31, 0xb7, 0x4f, 0xbe, 0x12, 0xf4, 0xc1 - #define STATIC_CODECAPI_GUID_AVEncWMAVoice 0x13ed18cb, 0x50e8, 0x4276, 0xa2, 0x88, 0xa6, 0xaa, 0x22, 0x83, 0x82, 0xd9 - #define STATIC_CODECAPI_GUID_AVEncDolbyDigitalPro 0xf5be76cc, 0x0ff8, 0x40eb, 0x9c, 0xb1, 0xbb, 0xa9, 0x40, 0x04, 0xd4, 0x4f - #define STATIC_CODECAPI_GUID_AVEncDolbyDigitalConsumer 0xc1a7bf6c, 0x0059, 0x4bfa, 0x94, 0xef, 0xef, 0x74, 0x7a, 0x76, 0x8d, 0x52 - #define STATIC_CODECAPI_GUID_AVEncDolbyDigitalPlus 0x698d1b80, 0xf7dd, 0x415c, 0x97, 0x1c, 0x42, 0x49, 0x2a, 0x20, 0x56, 0xc6 - #define STATIC_CODECAPI_GUID_AVEncDTSHD 0x2052e630, 0x469d, 0x4bfb, 0x80, 0xca, 0x1d, 0x65, 0x6e, 0x7e, 0x91, 0x8f - #define STATIC_CODECAPI_GUID_AVEncDTS 0x45fbcaa2, 0x5e6e, 0x4ab0, 0x88, 0x93, 0x59, 0x03, 0xbe, 0xe9, 0x3a, 0xcf - #define STATIC_CODECAPI_GUID_AVEncMLP 0x05f73e29, 0xf0d1, 0x431e, 0xa4, 0x1c, 0xa4, 0x74, 0x32, 0xec, 0x5a, 0x66 - #define STATIC_CODECAPI_GUID_AVEncPCM 0x844be7f4, 0x26cf, 0x4779, 0xb3, 0x86, 0xcc, 0x05, 0xd1, 0x87, 0x99, 0x0c - #define STATIC_CODECAPI_GUID_AVEncSDDS 0x1dc1b82f, 0x11c8, 0x4c71, 0xb7, 0xb6, 0xee, 0x3e, 0xb9, 0xbc, 0x2b, 0x94 - #define STATIC_CODECAPI_AVEncCommonRateControlMode 0x1c0608e9, 0x370c, 0x4710, 0x8a, 0x58, 0xcb, 0x61, 0x81, 0xc4, 0x24, 0x23 - #define STATIC_CODECAPI_AVEncCommonLowLatency 0x9d3ecd55, 0x89e8, 0x490a, 0x97, 0x0a, 0x0c, 0x95, 0x48, 0xd5, 0xa5, 0x6e - #define STATIC_CODECAPI_AVEncCommonMultipassMode 0x22533d4c, 0x47e1, 0x41b5, 0x93, 0x52, 0xa2, 0xb7, 0x78, 0x0e, 0x7a, 0xc4 - #define STATIC_CODECAPI_AVEncCommonPassStart 0x6a67739f, 0x4eb5, 0x4385, 0x99, 0x28, 0xf2, 0x76, 0xa9, 0x39, 0xef, 0x95 - #define STATIC_CODECAPI_AVEncCommonPassEnd 0x0e3d01bc, 0xc85c, 0x467d, 0x8b, 0x60, 0xc4, 0x10, 0x12, 0xee, 0x3b, 0xf6 - #define STATIC_CODECAPI_AVEncCommonRealTime 0x143a0ff6, 0xa131, 0x43da, 0xb8, 0x1e, 0x98, 0xfb, 0xb8, 0xec, 0x37, 0x8e - #define STATIC_CODECAPI_AVEncCommonQuality 0xfcbf57a3, 0x7ea5, 0x4b0c, 0x96, 0x44, 0x69, 0xb4, 0x0c, 0x39, 0xc3, 0x91 - #define STATIC_CODECAPI_AVEncCommonQualityVsSpeed 0x98332df8, 0x03cd, 0x476b, 0x89, 0xfa, 0x3f, 0x9e, 0x44, 0x2d, 0xec, 0x9f - #define STATIC_CODECAPI_AVEncCommonMeanBitRate 0xf7222374, 0x2144, 0x4815, 0xb5, 0x50, 0xa3, 0x7f, 0x8e, 0x12, 0xee, 0x52 - #define STATIC_CODECAPI_AVEncCommonMeanBitRateInterval 0xbfaa2f0c, 0xcb82, 0x4bc0, 0x84, 0x74, 0xf0, 0x6a, 0x8a, 0x0d, 0x02, 0x58 - #define STATIC_CODECAPI_AVEncCommonMaxBitRate 0x9651eae4, 0x39b9, 0x4ebf, 0x85, 0xef, 0xd7, 0xf4, 0x44, 0xec, 0x74, 0x65 - #define STATIC_CODECAPI_AVEncCommonMinBitRate 0x101405b2, 0x2083, 0x4034, 0xa8, 0x06, 0xef, 0xbe, 0xdd, 0xd7, 0xc9, 0xff - #define STATIC_CODECAPI_AVEncCommonBufferSize 0x0db96574, 0xb6a4, 0x4c8b, 0x81, 0x06, 0x37, 0x73, 0xde, 0x03, 0x10, 0xcd - #define STATIC_CODECAPI_AVEncCommonBufferInLevel 0xd9c5c8db, 0xfc74, 0x4064, 0x94, 0xe9, 0xcd, 0x19, 0xf9, 0x47, 0xed, 0x45 - #define STATIC_CODECAPI_AVEncCommonBufferOutLevel 0xccae7f49, 0xd0bc, 0x4e3d, 0xa5, 0x7e, 0xfb, 0x57, 0x40, 0x14, 0x00, 0x69 - #define STATIC_CODECAPI_AVEncCommonStreamEndHandling 0x6aad30af, 0x6ba8, 0x4ccc, 0x8f, 0xca, 0x18, 0xd1, 0x9b, 0xea, 0xeb, 0x1c - #define STATIC_CODECAPI_AVEncStatCommonCompletedPasses 0x3e5de533, 0x9df7, 0x438c, 0x85, 0x4f, 0x9f, 0x7d, 0xd3, 0x68, 0x3d, 0x34 - #define STATIC_CODECAPI_AVEncVideoOutputFrameRate 0xea85e7c3, 0x9567, 0x4d99, 0x87, 0xc4, 0x02, 0xc1, 0xc2, 0x78, 0xca, 0x7c - #define STATIC_CODECAPI_AVEncVideoOutputFrameRateConversion 0x8c068bf4, 0x369a, 0x4ba3, 0x82, 0xfd, 0xb2, 0x51, 0x8f, 0xb3, 0x39, 0x6e - #define STATIC_CODECAPI_AVEncVideoPixelAspectRatio 0x3cdc718f, 0xb3e9, 0x4eb6, 0xa5, 0x7f, 0xcf, 0x1f, 0x1b, 0x32, 0x1b, 0x87 - #define STATIC_CODECAPI_AVEncVideoForceSourceScanType 0x1ef2065f, 0x058a, 0x4765, 0xa4, 0xfc, 0x8a, 0x86, 0x4c, 0x10, 0x30, 0x12 - #define STATIC_CODECAPI_AVEncVideoNoOfFieldsToEncode 0x61e4bbe2, 0x4ee0, 0x40e7, 0x80, 0xab, 0x51, 0xdd, 0xee, 0xbe, 0x62, 0x91 - #define STATIC_CODECAPI_AVEncVideoNoOfFieldsToSkip 0xa97e1240, 0x1427, 0x4c16, 0xa7, 0xf7, 0x3d, 0xcf, 0xd8, 0xba, 0x4c, 0xc5 - #define STATIC_CODECAPI_AVEncVideoEncodeDimension 0x1074df28, 0x7e0f, 0x47a4, 0xa4, 0x53, 0xcd, 0xd7, 0x38, 0x70, 0xf5, 0xce - #define STATIC_CODECAPI_AVEncVideoEncodeOffsetOrigin 0x6bc098fe, 0xa71a, 0x4454, 0x85, 0x2e, 0x4d, 0x2d, 0xde, 0xb2, 0xcd, 0x24 - #define STATIC_CODECAPI_AVEncVideoDisplayDimension 0xde053668, 0xf4ec, 0x47a9, 0x86, 0xd0, 0x83, 0x67, 0x70, 0xf0, 0xc1, 0xd5 - #define STATIC_CODECAPI_AVEncVideoOutputScanType 0x460b5576, 0x842e, 0x49ab, 0xa6, 0x2d, 0xb3, 0x6f, 0x73, 0x12, 0xc9, 0xdb - #define STATIC_CODECAPI_AVEncVideoInverseTelecineEnable 0x2ea9098b, 0xe76d, 0x4ccd, 0xa0, 0x30, 0xd3, 0xb8, 0x89, 0xc1, 0xb6, 0x4c - #define STATIC_CODECAPI_AVEncVideoInverseTelecineThreshold 0x40247d84, 0xe895, 0x497f, 0xb4, 0x4c, 0xb7, 0x45, 0x60, 0xac, 0xfe, 0x27 - #define STATIC_CODECAPI_AVEncVideoSourceFilmContent 0x1791c64b, 0xccfc, 0x4827, 0xa0, 0xed, 0x25, 0x57, 0x79, 0x3b, 0x2b, 0x1c - #define STATIC_CODECAPI_AVEncVideoSourceIsBW 0x42ffc49b, 0x1812, 0x4fdc, 0x8d, 0x24, 0x70, 0x54, 0xc5, 0x21, 0xe6, 0xeb - #define STATIC_CODECAPI_AVEncVideoFieldSwap 0xfefd7569, 0x4e0a, 0x49f2, 0x9f, 0x2b, 0x36, 0x0e, 0xa4, 0x8c, 0x19, 0xa2 - #define STATIC_CODECAPI_AVEncVideoInputChromaResolution 0xbb0cec33, 0x16f1, 0x47b0, 0x8a, 0x88, 0x37, 0x81, 0x5b, 0xee, 0x17, 0x39 - #define STATIC_CODECAPI_AVEncVideoOutputChromaResolution 0x6097b4c9, 0x7c1d, 0x4e64, 0xbf, 0xcc, 0x9e, 0x97, 0x65, 0x31, 0x8a, 0xe7 - #define STATIC_CODECAPI_AVEncVideoInputChromaSubsampling 0xa8e73a39, 0x4435, 0x4ec3, 0xa6, 0xea, 0x98, 0x30, 0x0f, 0x4b, 0x36, 0xf7 - #define STATIC_CODECAPI_AVEncVideoOutputChromaSubsampling 0xfa561c6c, 0x7d17, 0x44f0, 0x83, 0xc9, 0x32, 0xed, 0x12, 0xe9, 0x63, 0x43 - #define STATIC_CODECAPI_AVEncVideoInputColorPrimaries 0xc24d783f, 0x7ce6, 0x4278, 0x90, 0xab, 0x28, 0xa4, 0xf1, 0xe5, 0xf8, 0x6c - #define STATIC_CODECAPI_AVEncVideoOutputColorPrimaries 0xbe95907c, 0x9d04, 0x4921, 0x89, 0x85, 0xa6, 0xd6, 0xd8, 0x7d, 0x1a, 0x6c - #define STATIC_CODECAPI_AVEncVideoInputColorTransferFunction 0x8c056111, 0xa9c3, 0x4b08, 0xa0, 0xa0, 0xce, 0x13, 0xf8, 0xa2, 0x7c, 0x75 - #define STATIC_CODECAPI_AVEncVideoOutputColorTransferFunction 0x4a7f884a, 0xea11, 0x460d, 0xbf, 0x57, 0xb8, 0x8b, 0xc7, 0x59, 0x00, 0xde - #define STATIC_CODECAPI_AVEncVideoInputColorTransferMatrix 0x52ed68b9, 0x72d5, 0x4089, 0x95, 0x8d, 0xf5, 0x40, 0x5d, 0x55, 0x08, 0x1c - #define STATIC_CODECAPI_AVEncVideoOutputColorTransferMatrix 0xa9b90444, 0xaf40, 0x4310, 0x8f, 0xbe, 0xed, 0x6d, 0x93, 0x3f, 0x89, 0x2b - #define STATIC_CODECAPI_AVEncVideoInputColorLighting 0x46a99549, 0x0015, 0x4a45, 0x9c, 0x30, 0x1d, 0x5c, 0xfa, 0x25, 0x83, 0x16 - #define STATIC_CODECAPI_AVEncVideoOutputColorLighting 0x0e5aaac6, 0xace6, 0x4c5c, 0x99, 0x8e, 0x1a, 0x8c, 0x9c, 0x6c, 0x0f, 0x89 - #define STATIC_CODECAPI_AVEncVideoInputColorNominalRange 0x16cf25c6, 0xa2a6, 0x48e9, 0xae, 0x80, 0x21, 0xae, 0xc4, 0x1d, 0x42, 0x7e - #define STATIC_CODECAPI_AVEncVideoOutputColorNominalRange 0x972835ed, 0x87b5, 0x4e95, 0x95, 0x00, 0xc7, 0x39, 0x58, 0x56, 0x6e, 0x54 - #define STATIC_CODECAPI_AVEncInputVideoSystem 0xbede146d, 0xb616, 0x4dc7, 0x92, 0xb2, 0xf5, 0xd9, 0xfa, 0x92, 0x98, 0xf7 - #define STATIC_CODECAPI_AVEncVideoHeaderDropFrame 0x6ed9e124, 0x7925, 0x43fe, 0x97, 0x1b, 0xe0, 0x19, 0xf6, 0x22, 0x22, 0xb4 - #define STATIC_CODECAPI_AVEncVideoHeaderHours 0x2acc7702, 0xe2da, 0x4158, 0xbf, 0x9b, 0x88, 0x88, 0x01, 0x29, 0xd7, 0x40 - #define STATIC_CODECAPI_AVEncVideoHeaderMinutes 0xdc1a99ce, 0x0307, 0x408b, 0x88, 0x0b, 0xb8, 0x34, 0x8e, 0xe8, 0xca, 0x7f - #define STATIC_CODECAPI_AVEncVideoHeaderSeconds 0x4a2e1a05, 0xa780, 0x4f58, 0x81, 0x20, 0x9a, 0x44, 0x9d, 0x69, 0x65, 0x6b - #define STATIC_CODECAPI_AVEncVideoHeaderFrames 0xafd5f567, 0x5c1b, 0x4adc, 0xbd, 0xaf, 0x73, 0x56, 0x10, 0x38, 0x14, 0x36 - #define STATIC_CODECAPI_AVEncVideoDefaultUpperFieldDominant 0x810167c4, 0x0bc1, 0x47ca, 0x8f, 0xc2, 0x57, 0x05, 0x5a, 0x14, 0x74, 0xa5 - #define STATIC_CODECAPI_AVEncVideoCBRMotionTradeoff 0x0d49451e, 0x18d5, 0x4367, 0xa4, 0xef, 0x32, 0x40, 0xdf, 0x16, 0x93, 0xc4 - #define STATIC_CODECAPI_AVEncVideoCodedVideoAccessUnitSize 0xb4b10c15, 0x14a7, 0x4ce8, 0xb1, 0x73, 0xdc, 0x90, 0xa0, 0xb4, 0xfc, 0xdb - #define STATIC_CODECAPI_AVEncVideoMaxKeyframeDistance 0x2987123a, 0xba93, 0x4704, 0xb4, 0x89, 0xec, 0x1e, 0x5f, 0x25, 0x29, 0x2c - - #define STATIC_CODECAPI_AVEncMuxOutputStreamType 0xcedd9e8f, 0x34d3, 0x44db, 0xa1, 0xd8, 0xf8, 0x15, 0x20, 0x25, 0x4f, 0x3e - - #define STATIC_CODECAPI_AVEncStatVideoOutputFrameRate 0xbe747849, 0x9ab4, 0x4a63, 0x98, 0xfe, 0xf1, 0x43, 0xf0, 0x4f, 0x8e, 0xe9 - #define STATIC_CODECAPI_AVEncStatVideoCodedFrames 0xd47f8d61, 0x6f5a, 0x4a26, 0xbb, 0x9f, 0xcd, 0x95, 0x18, 0x46, 0x2b, 0xcd - #define STATIC_CODECAPI_AVEncStatVideoTotalFrames 0xfdaa9916, 0x119a, 0x4222, 0x9a, 0xd6, 0x3f, 0x7c, 0xab, 0x99, 0xcc, 0x8b - #define STATIC_CODECAPI_AVEncAudioIntervalToEncode 0x866e4b4d, 0x725a, 0x467c, 0xbb, 0x01, 0xb4, 0x96, 0xb2, 0x3b, 0x25, 0xf9 - #define STATIC_CODECAPI_AVEncAudioIntervalToSkip 0x88c15f94, 0xc38c, 0x4796, 0xa9, 0xe8, 0x96, 0xe9, 0x67, 0x98, 0x3f, 0x26 - #define STATIC_CODECAPI_AVEncAudioDualMono 0x3648126b, 0xa3e8, 0x4329, 0x9b, 0x3a, 0x5c, 0xe5, 0x66, 0xa4, 0x3b, 0xd3 - #define STATIC_CODECAPI_AVEncAudioMeanBitRate 0x921295bb, 0x4fca, 0x4679, 0xaa, 0xb8, 0x9e, 0x2a, 0x1d, 0x75, 0x33, 0x84 - - #define STATIC_CODECAPI_AVEncAudioMapDestChannel0 0xbc5d0b60, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel1 0xbc5d0b61, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel2 0xbc5d0b62, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel3 0xbc5d0b63, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel4 0xbc5d0b64, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel5 0xbc5d0b65, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel6 0xbc5d0b66, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel7 0xbc5d0b67, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel8 0xbc5d0b68, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel9 0xbc5d0b69, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel10 0xbc5d0b6a, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel11 0xbc5d0b6b, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel12 0xbc5d0b6c, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel13 0xbc5d0b6d, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel14 0xbc5d0b6e, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - #define STATIC_CODECAPI_AVEncAudioMapDestChannel15 0xbc5d0b6f, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d - - #define STATIC_CODECAPI_AVEncAudioInputContent 0x3e226c2b, 0x60b9, 0x4a39, 0xb0, 0x0b, 0xa7, 0xb4, 0x0f, 0x70, 0xd5, 0x66 - #define STATIC_CODECAPI_AVEncStatAudioPeakPCMValue 0xdce7fd34, 0xdc00, 0x4c16, 0x82, 0x1b, 0x35, 0xd9, 0xeb, 0x00, 0xfb, 0x1a - #define STATIC_CODECAPI_AVEncStatAudioAveragePCMValue 0x979272f8, 0xd17f, 0x4e32, 0xbb, 0x73, 0x4e, 0x73, 0x1c, 0x68, 0xba, 0x2d - #define STATIC_CODECAPI_AVEncStatAudioAverageBPS 0xca6724db, 0x7059, 0x4351, 0x8b, 0x43, 0xf8, 0x21, 0x98, 0x82, 0x6a, 0x14 - #define STATIC_CODECAPI_AVEncStatAverageBPS 0xca6724db, 0x7059, 0x4351, 0x8b, 0x43, 0xf8, 0x21, 0x98, 0x82, 0x6a, 0x14 - #define STATIC_CODECAPI_AVEncStatHardwareProcessorUtilitization 0x995dc027, 0xcb95, 0x49e6, 0xb9, 0x1b, 0x59, 0x67, 0x75, 0x3c, 0xdc, 0xb8 - #define STATIC_CODECAPI_AVEncStatHardwareBandwidthUtilitization 0x0124ba9b, 0xdc41, 0x4826, 0xb4, 0x5f, 0x18, 0xac, 0x01, 0xb3, 0xd5, 0xa8 - #define STATIC_CODECAPI_AVEncMPVGOPSize 0x95f31b26, 0x95a4, 0x41aa, 0x93, 0x03, 0x24, 0x6a, 0x7f, 0xc6, 0xee, 0xf1 - #define STATIC_CODECAPI_AVEncMPVGOPOpen 0xb1d5d4a6, 0x3300, 0x49b1, 0xae, 0x61, 0xa0, 0x99, 0x37, 0xab, 0x0e, 0x49 - #define STATIC_CODECAPI_AVEncMPVDefaultBPictureCount 0x8d390aac, 0xdc5c, 0x4200, 0xb5, 0x7f, 0x81, 0x4d, 0x04, 0xba, 0xba, 0xb2 - #define STATIC_CODECAPI_AVEncMPVProfile 0xdabb534a, 0x1d99, 0x4284, 0x97, 0x5a, 0xd9, 0x0e, 0x22, 0x39, 0xba, 0xa1 - #define STATIC_CODECAPI_AVEncMPVLevel 0x6ee40c40, 0xa60c, 0x41ef, 0x8f, 0x50, 0x37, 0xc2, 0x24, 0x9e, 0x2c, 0xb3 - #define STATIC_CODECAPI_AVEncMPVFrameFieldMode 0xacb5de96, 0x7b93, 0x4c2f, 0x88, 0x25, 0xb0, 0x29, 0x5f, 0xa9, 0x3b, 0xf4 - #define STATIC_CODECAPI_AVEncMPVAddSeqEndCode 0xa823178f, 0x57df, 0x4c7a, 0xb8, 0xfd, 0xe5, 0xec, 0x88, 0x87, 0x70, 0x8d - #define STATIC_CODECAPI_AVEncMPVGOPSInSeq 0x993410d4, 0x2691, 0x4192, 0x99, 0x78, 0x98, 0xdc, 0x26, 0x03, 0x66, 0x9f - #define STATIC_CODECAPI_AVEncMPVUseConcealmentMotionVectors 0xec770cf3, 0x6908, 0x4b4b, 0xaa, 0x30, 0x7f, 0xb9, 0x86, 0x21, 0x4f, 0xea - #define STATIC_CODECAPI_AVEncMPVSceneDetection 0x552799f1, 0xdb4c, 0x405b, 0x8a, 0x3a, 0xc9, 0x3f, 0x2d, 0x06, 0x74, 0xdc - #define STATIC_CODECAPI_AVEncMPVGenerateHeaderSeqExt 0xd5e78611, 0x082d, 0x4e6b, 0x98, 0xaf, 0x0f, 0x51, 0xab, 0x13, 0x92, 0x22 - #define STATIC_CODECAPI_AVEncMPVGenerateHeaderSeqDispExt 0x6437aa6f, 0x5a3c, 0x4de9, 0x8a, 0x16, 0x53, 0xd9, 0xc4, 0xad, 0x32, 0x6f - #define STATIC_CODECAPI_AVEncMPVGenerateHeaderPicExt 0x1b8464ab, 0x944f, 0x45f0, 0xb7, 0x4e, 0x3a, 0x58, 0xda, 0xd1, 0x1f, 0x37 - #define STATIC_CODECAPI_AVEncMPVGenerateHeaderPicDispExt 0xc6412f84, 0xc03f, 0x4f40, 0xa0, 0x0c, 0x42, 0x93, 0xdf, 0x83, 0x95, 0xbb - #define STATIC_CODECAPI_AVEncMPVGenerateHeaderSeqScaleExt 0x0722d62f, 0xdd59, 0x4a86, 0x9c, 0xd5, 0x64, 0x4f, 0x8e, 0x26, 0x53, 0xd8 - #define STATIC_CODECAPI_AVEncMPVScanPattern 0x7f8a478e, 0x7bbb, 0x4ae2, 0xb2, 0xfc, 0x96, 0xd1, 0x7f, 0xc4, 0xa2, 0xd6 - #define STATIC_CODECAPI_AVEncMPVIntraDCPrecision 0xa0116151, 0xcbc8, 0x4af3, 0x97, 0xdc, 0xd0, 0x0c, 0xce, 0xb8, 0x2d, 0x79 - #define STATIC_CODECAPI_AVEncMPVQScaleType 0x2b79ebb7, 0xf484, 0x4af7, 0xbb, 0x58, 0xa2, 0xa1, 0x88, 0xc5, 0xcb, 0xbe - #define STATIC_CODECAPI_AVEncMPVIntraVLCTable 0xa2b83ff5, 0x1a99, 0x405a, 0xaf, 0x95, 0xc5, 0x99, 0x7d, 0x55, 0x8d, 0x3a - #define STATIC_CODECAPI_AVEncMPVQuantMatrixIntra 0x9bea04f3, 0x6621, 0x442c, 0x8b, 0xa1, 0x3a, 0xc3, 0x78, 0x97, 0x96, 0x98 - #define STATIC_CODECAPI_AVEncMPVQuantMatrixNonIntra 0x87f441d8, 0x0997, 0x4beb, 0xa0, 0x8e, 0x85, 0x73, 0xd4, 0x09, 0xcf, 0x75 - #define STATIC_CODECAPI_AVEncMPVQuantMatrixChromaIntra 0x9eb9ecd4, 0x018d, 0x4ffd, 0x8f, 0x2d, 0x39, 0xe4, 0x9f, 0x07, 0xb1, 0x7a - #define STATIC_CODECAPI_AVEncMPVQuantMatrixChromaNonIntra 0x1415b6b1, 0x362a, 0x4338, 0xba, 0x9a, 0x1e, 0xf5, 0x87, 0x03, 0xc0, 0x5b - #define STATIC_CODECAPI_AVEncMPALayer 0x9d377230, 0xf91b, 0x453d, 0x9c, 0xe0, 0x78, 0x44, 0x54, 0x14, 0xc2, 0x2d - #define STATIC_CODECAPI_AVEncMPACodingMode 0xb16ade03, 0x4b93, 0x43d7, 0xa5, 0x50, 0x90, 0xb4, 0xfe, 0x22, 0x45, 0x37 - #define STATIC_CODECAPI_AVEncDDService 0xd2e1bec7, 0x5172, 0x4d2a, 0xa5, 0x0e, 0x2f, 0x3b, 0x82, 0xb1, 0xdd, 0xf8 - #define STATIC_CODECAPI_AVEncDDDialogNormalization 0xd7055acf, 0xf125, 0x437d, 0xa7, 0x04, 0x79, 0xc7, 0x9f, 0x04, 0x04, 0xa8 - #define STATIC_CODECAPI_AVEncDDCentreDownMixLevel 0xe285072c, 0xc958, 0x4a81, 0xaf, 0xd2, 0xe5, 0xe0, 0xda, 0xf1, 0xb1, 0x48 - #define STATIC_CODECAPI_AVEncDDSurroundDownMixLevel 0x7b20d6e5, 0x0bcf, 0x4273, 0xa4, 0x87, 0x50, 0x6b, 0x04, 0x79, 0x97, 0xe9 - #define STATIC_CODECAPI_AVEncDDProductionInfoExists 0xb0b7fe5f, 0xb6ab, 0x4f40, 0x96, 0x4d, 0x8d, 0x91, 0xf1, 0x7c, 0x19, 0xe8 - #define STATIC_CODECAPI_AVEncDDProductionRoomType 0xdad7ad60, 0x23d8, 0x4ab7, 0xa2, 0x84, 0x55, 0x69, 0x86, 0xd8, 0xa6, 0xfe - #define STATIC_CODECAPI_AVEncDDProductionMixLevel 0x301d103a, 0xcbf9, 0x4776, 0x88, 0x99, 0x7c, 0x15, 0xb4, 0x61, 0xab, 0x26 - #define STATIC_CODECAPI_AVEncDDCopyright 0x8694f076, 0xcd75, 0x481d, 0xa5, 0xc6, 0xa9, 0x04, 0xdc, 0xc8, 0x28, 0xf0 - #define STATIC_CODECAPI_AVEncDDOriginalBitstream 0x966ae800, 0x5bd3, 0x4ff9, 0x95, 0xb9, 0xd3, 0x05, 0x66, 0x27, 0x38, 0x56 - #define STATIC_CODECAPI_AVEncDDDigitalDeemphasis 0xe024a2c2, 0x947c, 0x45ac, 0x87, 0xd8, 0xf1, 0x03, 0x0c, 0x5c, 0x00, 0x82 - #define STATIC_CODECAPI_AVEncDDDCHighPassFilter 0x9565239f, 0x861c, 0x4ac8, 0xbf, 0xda, 0xe0, 0x0c, 0xb4, 0xdb, 0x85, 0x48 - #define STATIC_CODECAPI_AVEncDDChannelBWLowPassFilter 0xe197821d, 0xd2e7, 0x43e2, 0xad, 0x2c, 0x00, 0x58, 0x2f, 0x51, 0x85, 0x45 - #define STATIC_CODECAPI_AVEncDDLFELowPassFilter 0xd3b80f6f, 0x9d15, 0x45e5, 0x91, 0xbe, 0x01, 0x9c, 0x3f, 0xab, 0x1f, 0x01 - #define STATIC_CODECAPI_AVEncDDSurround90DegreeePhaseShift 0x25ecec9d, 0x3553, 0x42c0, 0xbb, 0x56, 0xd2, 0x57, 0x92, 0x10, 0x4f, 0x80 - #define STATIC_CODECAPI_AVEncDDSurround3dBAttenuation 0x4d43b99d, 0x31e2, 0x48b9, 0xbf, 0x2e, 0x5c, 0xbf, 0x1a, 0x57, 0x27, 0x84 - #define STATIC_CODECAPI_AVEncDDDynamicRangeCompressionControl 0xcfc2ff6d, 0x79b8, 0x4b8d, 0xa8, 0xaa, 0xa0, 0xc9, 0xbd, 0x1c, 0x29, 0x40 - #define STATIC_CODECAPI_AVEncDDRFPreEmphasisFilter 0x21af44c0, 0x244e, 0x4f3d, 0xa2, 0xcc, 0x3d, 0x30, 0x68, 0xb2, 0xe7, 0x3f - #define STATIC_CODECAPI_AVEncDDSurroundExMode 0x91607cee, 0xdbdd, 0x4eb6, 0xbc, 0xa2, 0xaa, 0xdf, 0xaf, 0xa3, 0xdd, 0x68 - #define STATIC_CODECAPI_AVEncDDPreferredStereoDownMixMode 0x7f4e6b31, 0x9185, 0x403d, 0xb0, 0xa2, 0x76, 0x37, 0x43, 0xe6, 0xf0, 0x63 - #define STATIC_CODECAPI_AVEncDDLtRtCenterMixLvl_x10 0xdca128a2, 0x491f, 0x4600, 0xb2, 0xda, 0x76, 0xe3, 0x34, 0x4b, 0x41, 0x97 - #define STATIC_CODECAPI_AVEncDDLtRtSurroundMixLvl_x10 0x212246c7, 0x3d2c, 0x4dfa, 0xbc, 0x21, 0x65, 0x2a, 0x90, 0x98, 0x69, 0x0d - #define STATIC_CODECAPI_AVEncDDLoRoCenterMixLvl_x10 0x1cfba222, 0x25b3, 0x4bf4, 0x9b, 0xfd, 0xe7, 0x11, 0x12, 0x67, 0x85, 0x8c - #define STATIC_CODECAPI_AVEncDDLoRoSurroundMixLvl_x10 0xe725cff6, 0xeb56, 0x40c7, 0x84, 0x50, 0x2b, 0x93, 0x67, 0xe9, 0x15, 0x55 - #define STATIC_CODECAPI_AVEncDDAtoDConverterType 0x719f9612, 0x81a1, 0x47e0, 0x9a, 0x05, 0xd9, 0x4a, 0xd5, 0xfc, 0xa9, 0x48 - #define STATIC_CODECAPI_AVEncDDHeadphoneMode 0x4052dbec, 0x52f5, 0x42f5, 0x9b, 0x00, 0xd1, 0x34, 0xb1, 0x34, 0x1b, 0x9d - #define STATIC_CODECAPI_AVEncWMVKeyFrameDistance 0x5569055e, 0xe268, 0x4771, 0xb8, 0x3e, 0x95, 0x55, 0xea, 0x28, 0xae, 0xd3 - #define STATIC_CODECAPI_AVEncWMVInterlacedEncoding 0xe3d00f8a, 0xc6f5, 0x4e14, 0xa5, 0x88, 0x0e, 0xc8, 0x7a, 0x72, 0x6f, 0x9b - #define STATIC_CODECAPI_AVEncWMVDecoderComplexity 0xf32c0dab, 0xf3cb, 0x4217, 0xb7, 0x9f, 0x87, 0x62, 0x76, 0x8b, 0x5f, 0x67 - #define STATIC_CODECAPI_AVEncWMVKeyFrameBufferLevelMarker 0x51ff1115, 0x33ac, 0x426c, 0xa1, 0xb1, 0x09, 0x32, 0x1b, 0xdf, 0x96, 0xb4 - #define STATIC_CODECAPI_AVEncWMVProduceDummyFrames 0xd669d001, 0x183c, 0x42e3, 0xa3, 0xca, 0x2f, 0x45, 0x86, 0xd2, 0x39, 0x6c - #define STATIC_CODECAPI_AVEncStatWMVCBAvg 0x6aa6229f, 0xd602, 0x4b9d, 0xb6, 0x8c, 0xc1, 0xad, 0x78, 0x88, 0x4b, 0xef - #define STATIC_CODECAPI_AVEncStatWMVCBMax 0xe976bef8, 0x00fe, 0x44b4, 0xb6, 0x25, 0x8f, 0x23, 0x8b, 0xc0, 0x34, 0x99 - #define STATIC_CODECAPI_AVEncStatWMVDecoderComplexityProfile 0x89e69fc3, 0x0f9b, 0x436c, 0x97, 0x4a, 0xdf, 0x82, 0x12, 0x27, 0xc9, 0x0d - #define STATIC_CODECAPI_AVEncStatMPVSkippedEmptyFrames 0x32195fd3, 0x590d, 0x4812, 0xa7, 0xed, 0x6d, 0x63, 0x9a, 0x1f, 0x97, 0x11 - #define STATIC_CODECAPI_AVEncMP12PktzSTDBuffer 0x0b751bd0, 0x819e, 0x478c, 0x94, 0x35, 0x75, 0x20, 0x89, 0x26, 0xb3, 0x77 - #define STATIC_CODECAPI_AVEncMP12PktzStreamID 0xc834d038, 0xf5e8, 0x4408, 0x9b, 0x60, 0x88, 0xf3, 0x64, 0x93, 0xfe, 0xdf - #define STATIC_CODECAPI_AVEncMP12PktzInitialPTS 0x2a4f2065, 0x9a63, 0x4d20, 0xae, 0x22, 0x0a, 0x1b, 0xc8, 0x96, 0xa3, 0x15 - #define STATIC_CODECAPI_AVEncMP12PktzPacketSize 0xab71347a, 0x1332, 0x4dde, 0xa0, 0xe5, 0xcc, 0xf7, 0xda, 0x8a, 0x0f, 0x22 - #define STATIC_CODECAPI_AVEncMP12PktzCopyright 0xc8f4b0c1, 0x094c, 0x43c7, 0x8e, 0x68, 0xa5, 0x95, 0x40, 0x5a, 0x6e, 0xf8 - #define STATIC_CODECAPI_AVEncMP12PktzOriginal 0x6b178416, 0x31b9, 0x4964, 0x94, 0xcb, 0x6b, 0xff, 0x86, 0x6c, 0xdf, 0x83 - #define STATIC_CODECAPI_AVEncMP12MuxPacketOverhead 0xe40bd720, 0x3955, 0x4453, 0xac, 0xf9, 0xb7, 0x91, 0x32, 0xa3, 0x8f, 0xa0 - #define STATIC_CODECAPI_AVEncMP12MuxNumStreams 0xf7164a41, 0xdced, 0x4659, 0xa8, 0xf2, 0xfb, 0x69, 0x3f, 0x2a, 0x4c, 0xd0 - #define STATIC_CODECAPI_AVEncMP12MuxEarliestPTS 0x157232b6, 0xf809, 0x474e, 0x94, 0x64, 0xa7, 0xf9, 0x30, 0x14, 0xa8, 0x17 - #define STATIC_CODECAPI_AVEncMP12MuxLargestPacketSize 0x35ceb711, 0xf461, 0x4b92, 0xa4, 0xef, 0x17, 0xb6, 0x84, 0x1e, 0xd2, 0x54 - #define STATIC_CODECAPI_AVEncMP12MuxInitialSCR 0x3433ad21, 0x1b91, 0x4a0b, 0xb1, 0x90, 0x2b, 0x77, 0x06, 0x3b, 0x63, 0xa4 - #define STATIC_CODECAPI_AVEncMP12MuxMuxRate 0xee047c72, 0x4bdb, 0x4a9d, 0x8e, 0x21, 0x41, 0x92, 0x6c, 0x82, 0x3d, 0xa7 - #define STATIC_CODECAPI_AVEncMP12MuxPackSize 0xf916053a, 0x1ce8, 0x4faf, 0xaa, 0x0b, 0xba, 0x31, 0xc8, 0x00, 0x34, 0xb8 - #define STATIC_CODECAPI_AVEncMP12MuxSysSTDBufferBound 0x35746903, 0xb545, 0x43e7, 0xbb, 0x35, 0xc5, 0xe0, 0xa7, 0xd5, 0x09, 0x3c - #define STATIC_CODECAPI_AVEncMP12MuxSysRateBound 0x05f0428a, 0xee30, 0x489d, 0xae, 0x28, 0x20, 0x5c, 0x72, 0x44, 0x67, 0x10 - #define STATIC_CODECAPI_AVEncMP12MuxTargetPacketizer 0xd862212a, 0x2015, 0x45dd, 0x9a, 0x32, 0x1b, 0x3a, 0xa8, 0x82, 0x05, 0xa0 - #define STATIC_CODECAPI_AVEncMP12MuxSysFixed 0xcefb987e, 0x894f, 0x452e, 0x8f, 0x89, 0xa4, 0xef, 0x8c, 0xec, 0x06, 0x3a - #define STATIC_CODECAPI_AVEncMP12MuxSysCSPS 0x7952ff45, 0x9c0d, 0x4822, 0xbc, 0x82, 0x8a, 0xd7, 0x72, 0xe0, 0x29, 0x93 - #define STATIC_CODECAPI_AVEncMP12MuxSysVideoLock 0xb8296408, 0x2430, 0x4d37, 0xa2, 0xa1, 0x95, 0xb3, 0xe4, 0x35, 0xa9, 0x1d - #define STATIC_CODECAPI_AVEncMP12MuxSysAudioLock 0x0fbb5752, 0x1d43, 0x47bf, 0xbd, 0x79, 0xf2, 0x29, 0x3d, 0x8c, 0xe3, 0x37 - #define STATIC_CODECAPI_AVEncMP12MuxDVDNavPacks 0xc7607ced, 0x8cf1, 0x4a99, 0x83, 0xa1, 0xee, 0x54, 0x61, 0xbe, 0x35, 0x74 - - #define STATIC_CODECAPI_AVEncMPACopyright 0xa6ae762a, 0xd0a9, 0x4454, 0xb8, 0xef, 0xf2, 0xdb, 0xee, 0xfd, 0xd3, 0xbd - #define STATIC_CODECAPI_AVEncMPAOriginalBitstream 0x3cfb7855, 0x9cc9, 0x47ff, 0xb8, 0x29, 0xb3, 0x67, 0x86, 0xc9, 0x23, 0x46 - #define STATIC_CODECAPI_AVEncMPAEnableRedundancyProtection 0x5e54b09e, 0xb2e7, 0x4973, 0xa8, 0x9b, 0x0b, 0x36, 0x50, 0xa3, 0xbe, 0xda - #define STATIC_CODECAPI_AVEncMPAPrivateUserBit 0xafa505ce, 0xc1e3, 0x4e3d, 0x85, 0x1b, 0x61, 0xb7, 0x00, 0xe5, 0xe6, 0xcc - #define STATIC_CODECAPI_AVEncMPAEmphasisType 0x2d59fcda, 0xbf4e, 0x4ed6, 0xb5, 0xdf, 0x5b, 0x03, 0xb3, 0x6b, 0x0a, 0x1f - - - #define STATIC_CODECAPI_AVDecCommonMeanBitRate 0x59488217, 0x007a, 0x4f7a, 0x8e, 0x41, 0x5c, 0x48, 0xb1, 0xea, 0xc5, 0xc6 - #define STATIC_CODECAPI_AVDecCommonMeanBitRateInterval 0x0ee437c6, 0x38a7, 0x4c5c, 0x94, 0x4c, 0x68, 0xab, 0x42, 0x11, 0x6b, 0x85 - #define STATIC_CODECAPI_AVDecCommonInputFormat 0xe5005239, 0xbd89, 0x4be3, 0x9c, 0x0f, 0x5d, 0xde, 0x31, 0x79, 0x88, 0xcc - #define STATIC_CODECAPI_AVDecCommonOutputFormat 0x3c790028, 0xc0ce, 0x4256, 0xb1, 0xa2, 0x1b, 0x0f, 0xc8, 0xb1, 0xdc, 0xdc - - #define STATIC_CODECAPI_GUID_AVDecAudioOutputFormat_PCM_Stereo_MatrixEncoded 0x696e1d30, 0x548f, 0x4036, 0x82, 0x5f, 0x70, 0x26, 0xc6, 0x00, 0x11, 0xbd - #define STATIC_CODECAPI_GUID_AVDecAudioOutputFormat_PCM 0x696e1d31, 0x548f, 0x4036, 0x82, 0x5f, 0x70, 0x26, 0xc6, 0x00, 0x11, 0xbd - #define STATIC_CODECAPI_GUID_AVDecAudioOutputFormat_SPDIF_PCM 0x696e1d32, 0x548f, 0x4036, 0x82, 0x5f, 0x70, 0x26, 0xc6, 0x00, 0x11, 0xbd - #define STATIC_CODECAPI_GUID_AVDecAudioOutputFormat_SPDIF_Bitstream 0x696e1d33, 0x548f, 0x4036, 0x82, 0x5f, 0x70, 0x26, 0xc6, 0x00, 0x11, 0xbd - #define STATIC_CODECAPI_GUID_AVDecAudioOutputFormat_PCM_Headphones 0x696e1d34, 0x548f, 0x4036, 0x82, 0x5f, 0x70, 0x26, 0xc6, 0x00, 0x11, 0xbd - #define STATIC_CODECAPI_GUID_AVDecAudioOutputFormat_PCM_Stereo_Auto 0x696e1d35, 0x548f, 0x4036, 0x82, 0x5f, 0x70, 0x26, 0xc6, 0x00, 0x11, 0xbd - - #define STATIC_CODECAPI_AVDecVideoImageSize 0x5ee5747c, 0x6801, 0x4cab, 0xaa, 0xf1, 0x62, 0x48, 0xfa, 0x84, 0x1b, 0xa4 - #define STATIC_CODECAPI_AVDecVideoInputScanType 0x38477e1f, 0x0ea7, 0x42cd, 0x8c, 0xd1, 0x13, 0x0c, 0xed, 0x57, 0xc5, 0x80 - #define STATIC_CODECAPI_AVDecVideoPixelAspectRatio 0xb0cf8245, 0xf32d, 0x41df, 0xb0, 0x2c, 0x87, 0xbd, 0x30, 0x4d, 0x12, 0xab - #define STATIC_CODECAPI_AVDecVideoAcceleration_MPEG2 0xf7db8a2e, 0x4f48, 0x4ee8, 0xae, 0x31, 0x8b, 0x6e, 0xbe, 0x55, 0x8a, 0xe2 - #define STATIC_CODECAPI_AVDecVideoAcceleration_H264 0xf7db8a2f, 0x4f48, 0x4ee8, 0xae, 0x31, 0x8b, 0x6e, 0xbe, 0x55, 0x8a, 0xe2 - #define STATIC_CODECAPI_AVDecVideoAcceleration_VC1 0xf7db8a30, 0x4f48, 0x4ee8, 0xae, 0x31, 0x8b, 0x6e, 0xbe, 0x55, 0x8a, 0xe2 - #define STATIC_CODECAPI_AVDecVideoProcDeinterlaceCSC 0xf7db8a31, 0x4f48, 0x4ee8, 0xae, 0x31, 0x8b, 0x6e, 0xbe, 0x55, 0x8a, 0xe2 - - #define STATIC_CODECAPI_AVDecVideoThumbnailGenerationMode 0x2efd8eee, 0x1150, 0x4328, 0x9c, 0xf5, 0x66, 0xdc, 0xe9, 0x33, 0xfc, 0xf4 - #define STATIC_CODECAPI_AVDecVideoDropPicWithMissingRef 0xf8226383, 0x14c2, 0x4567, 0x97, 0x34, 0x50, 0x4, 0xe9, 0x6f, 0xf8, 0x87 - #define STATIC_CODECAPI_AVDecVideoSoftwareDeinterlaceMode 0x0c08d1ce, 0x9ced, 0x4540, 0xba, 0xe3, 0xce, 0xb3, 0x80, 0x14, 0x11, 0x09 - #define STATIC_CODECAPI_AVDecVideoFastDecodeMode 0x6b529f7d, 0xd3b1, 0x49c6, 0xa9, 0x99, 0x9e, 0xc6, 0x91, 0x1b, 0xed, 0xbf - #define STATIC_CODECAPI_AVDecVideoH264ErrorConcealment 0xececace8, 0x3436, 0x462c, 0x92, 0x94, 0xcd, 0x7b, 0xac, 0xd7, 0x58, 0xa9 - #define STATIC_CODECAPI_AVDecVideoMPEG2ErrorConcealment 0x9d2bfe18, 0x728d, 0x48d2, 0xb3, 0x58, 0xbc, 0x7e, 0x43, 0x6c, 0x66, 0x74 - #define STATIC_CODECAPI_AVDecVideoCodecType 0x434528e5, 0x21f0, 0x46b6, 0xb6, 0x2c, 0x9b, 0x1b, 0x6b, 0x65, 0x8c, 0xd1 - #define STATIC_CODECAPI_AVDecVideoDXVAMode 0xf758f09e, 0x7337, 0x4ae7, 0x83, 0x87, 0x73, 0xdc, 0x2d, 0x54, 0xe6, 0x7d - #define STATIC_CODECAPI_AVDecVideoDXVABusEncryption 0x42153c8b, 0xfd0b, 0x4765, 0xa4, 0x62, 0xdd, 0xd9, 0xe8, 0xbc, 0xc3, 0x88 - #define STATIC_CODECAPI_AVDecVideoSWPowerLevel 0xfb5d2347, 0x4dd8, 0x4509, 0xae, 0xd0, 0xdb, 0x5f, 0xa9, 0xaa, 0x93, 0xf4 - - #define STATIC_CODECAPI_GUID_AVDecAudioInputWMA 0xc95e8dcf, 0x4058, 0x4204, 0x8c, 0x42, 0xcb, 0x24, 0xd9, 0x1e, 0x4b, 0x9b - #define STATIC_CODECAPI_GUID_AVDecAudioInputWMAPro 0x0128b7c7, 0xda72, 0x4fe3, 0xbe, 0xf8, 0x5c, 0x52, 0xe3, 0x55, 0x77, 0x04 - #define STATIC_CODECAPI_GUID_AVDecAudioInputDolby 0x8e4228a0, 0xf000, 0x4e0b, 0x8f, 0x54, 0xab, 0x8d, 0x24, 0xad, 0x61, 0xa2 - #define STATIC_CODECAPI_GUID_AVDecAudioInputDTS 0x600bc0ca, 0x6a1f, 0x4e91, 0xb2, 0x41, 0x1b, 0xbe, 0xb1, 0xcb, 0x19, 0xe0 - #define STATIC_CODECAPI_GUID_AVDecAudioInputPCM 0xf2421da5, 0xbbb4, 0x4cd5, 0xa9, 0x96, 0x93, 0x3c, 0x6b, 0x5d, 0x13, 0x47 - #define STATIC_CODECAPI_GUID_AVDecAudioInputMPEG 0x91106f36, 0x02c5, 0x4f75, 0x97, 0x19, 0x3b, 0x7a, 0xbf, 0x75, 0xe1, 0xf6 - #define STATIC_CODECAPI_GUID_AVDecAudioInputAAC 0x97df7828, 0xb94a, 0x47e2, 0xa4, 0xbc, 0x51, 0x19, 0x4d, 0xb2, 0x2a, 0x4d - #define STATIC_CODECAPI_GUID_AVDecAudioInputHEAAC 0x16efb4aa, 0x330e, 0x4f5c, 0x98, 0xa8, 0xcf, 0x6a, 0xc5, 0x5c, 0xbe, 0x60 - #define STATIC_CODECAPI_GUID_AVDecAudioInputDolbyDigitalPlus 0x0803e185, 0x8f5d, 0x47f5, 0x99, 0x08, 0x19, 0xa5, 0xbb, 0xc9, 0xfe, 0x34 - - #define STATIC_CODECAPI_AVDecAACDownmixMode 0x01274475, 0xf6bb, 0x4017, 0xb0, 0x84, 0x81, 0xa7, 0x63, 0xc9, 0x42, 0xd4 - #define STATIC_CODECAPI_AVDecHEAACDynamicRangeControl 0x287c8abe, 0x69a4, 0x4d39, 0x80, 0x80, 0xd3, 0xd9, 0x71, 0x21, 0x78, 0xa0 - - #define STATIC_CODECAPI_AVDecAudioDualMono 0x4a52cda8, 0x30f8, 0x4216, 0xbe, 0x0f, 0xba, 0x0b, 0x20, 0x25, 0x92, 0x1d - #define STATIC_CODECAPI_AVDecAudioDualMonoReproMode 0xa5106186, 0xcc94, 0x4bc9, 0x8c, 0xd9, 0xaa, 0x2f, 0x61, 0xf6, 0x80, 0x7e - - #define STATIC_CODECAPI_AVAudioChannelCount 0x1d3583c4, 0x1583, 0x474e, 0xb7, 0x1a, 0x5e, 0xe4, 0x63, 0xc1, 0x98, 0xe4 - #define STATIC_CODECAPI_AVAudioChannelConfig 0x17f89cb3, 0xc38d, 0x4368, 0x9e, 0xde, 0x63, 0xb9, 0x4d, 0x17, 0x7f, 0x9f - #define STATIC_CODECAPI_AVAudioSampleRate 0x971d2723, 0x1acb, 0x42e7, 0x85, 0x5c, 0x52, 0x0a, 0x4b, 0x70, 0xa5, 0xf2 - - #define STATIC_CODECAPI_AVDDSurroundMode 0x99f2f386, 0x98d1, 0x4452, 0xa1, 0x63, 0xab, 0xc7, 0x8a, 0x6e, 0xb7, 0x70 - #define STATIC_CODECAPI_AVDecDDOperationalMode 0xd6d6c6d1, 0x064e, 0x4fdd, 0xa4, 0x0e, 0x3e, 0xcb, 0xfc, 0xb7, 0xeb, 0xd0 - #define STATIC_CODECAPI_AVDecDDMatrixDecodingMode 0xddc811a5, 0x04ed, 0x4bf3, 0xa0, 0xca, 0xd0, 0x04, 0x49, 0xf9, 0x35, 0x5f - #define STATIC_CODECAPI_AVDecDDDynamicRangeScaleHigh 0x50196c21, 0x1f33, 0x4af5, 0xb2, 0x96, 0x11, 0x42, 0x6d, 0x6c, 0x87, 0x89 - #define STATIC_CODECAPI_AVDecDDDynamicRangeScaleLow 0x044e62e4, 0x11a5, 0x42d5, 0xa3, 0xb2, 0x3b, 0xb2, 0xc7, 0xc2, 0xd7, 0xcf - - #define STATIC_CODECAPI_AVDSPLoudnessEqualization 0x8afd1a15, 0x1812, 0x4cbf, 0x93, 0x19, 0x43, 0x3a, 0x5b, 0x2a, 0x3b, 0x27 - #define STATIC_CODECAPI_AVDSPSpeakerFill 0x5612bca1, 0x56da, 0x4582, 0x8d, 0xa1, 0xca, 0x80, 0x90, 0xf9, 0x27, 0x68 - - #define STATIC_CODECAPI_AVPriorityControl 0x54ba3dc8, 0xbdde, 0x4329, 0xb1, 0x87, 0x20, 0x18, 0xbc, 0x5c, 0x2b, 0xa1 - #define STATIC_CODECAPI_AVRealtimeControl 0x6f440632, 0xc4ad, 0x4bf7, 0x9e, 0x52, 0x45, 0x69, 0x42, 0xb4, 0x54, 0xb0 - -// end of static definitions } - -// -// Common Parameters -// - -// AVEncCommonFormatConstraint (GUID) - -DEFINE_CODECAPI_GUID( AVEncCommonFormatConstraint, "57cbb9b8-116f-4951-b40c-c2a035ed8f17", 0x57cbb9b8, 0x116f, 0x4951, 0xb4, 0x0c, 0xc2, 0xa0, 0x35, 0xed, 0x8f, 0x17 ) - -DEFINE_CODECAPI_GUID( GUID_AVEncCommonFormatUnSpecified, "af46a35a-6024-4525-a48a-094b97f5b3c2", 0xaf46a35a, 0x6024, 0x4525, 0xa4, 0x8a, 0x09, 0x4b, 0x97, 0xf5, 0xb3, 0xc2 ) -DEFINE_CODECAPI_GUID( GUID_AVEncCommonFormatDVD_V, "cc9598c4-e7fe-451d-b1ca-761bc840b7f3", 0xcc9598c4, 0xe7fe, 0x451d, 0xb1, 0xca, 0x76, 0x1b, 0xc8, 0x40, 0xb7, 0xf3 ) -DEFINE_CODECAPI_GUID( GUID_AVEncCommonFormatDVD_DashVR, "e55199d6-044c-4dae-a488-531ed306235b", 0xe55199d6, 0x044c, 0x4dae, 0xa4, 0x88, 0x53, 0x1e, 0xd3, 0x06, 0x23, 0x5b ) -DEFINE_CODECAPI_GUID( GUID_AVEncCommonFormatDVD_PlusVR, "e74c6f2e-ec37-478d-9af4-a5e135b6271c", 0xe74c6f2e, 0xec37, 0x478d, 0x9a, 0xf4, 0xa5, 0xe1, 0x35, 0xb6, 0x27, 0x1c ) -DEFINE_CODECAPI_GUID( GUID_AVEncCommonFormatVCD, "95035bf7-9d90-40ff-ad5c-5cf8cf71ca1d", 0x95035bf7, 0x9d90, 0x40ff, 0xad, 0x5c, 0x5c, 0xf8, 0xcf, 0x71, 0xca, 0x1d ) -DEFINE_CODECAPI_GUID( GUID_AVEncCommonFormatSVCD, "51d85818-8220-448c-8066-d69bed16c9ad", 0x51d85818, 0x8220, 0x448c, 0x80, 0x66, 0xd6, 0x9b, 0xed, 0x16, 0xc9, 0xad ) -DEFINE_CODECAPI_GUID( GUID_AVEncCommonFormatATSC, "8d7b897c-a019-4670-aa76-2edcac7ac296", 0x8d7b897c, 0xa019, 0x4670, 0xaa, 0x76, 0x2e, 0xdc, 0xac, 0x7a, 0xc2, 0x96 ) -DEFINE_CODECAPI_GUID( GUID_AVEncCommonFormatDVB, "71830d8f-6c33-430d-844b-c2705baae6db", 0x71830d8f, 0x6c33, 0x430d, 0x84, 0x4b, 0xc2, 0x70, 0x5b, 0xaa, 0xe6, 0xdb ) -DEFINE_CODECAPI_GUID( GUID_AVEncCommonFormatMP3, "349733cd-eb08-4dc2-8197-e49835ef828b", 0x349733cd, 0xeb08, 0x4dc2, 0x81, 0x97, 0xe4, 0x98, 0x35, 0xef, 0x82, 0x8b ) -DEFINE_CODECAPI_GUID( GUID_AVEncCommonFormatHighMAT, "1eabe760-fb2b-4928-90d1-78db88eee889", 0x1eabe760, 0xfb2b, 0x4928, 0x90, 0xd1, 0x78, 0xdb, 0x88, 0xee, 0xe8, 0x89 ) -DEFINE_CODECAPI_GUID( GUID_AVEncCommonFormatHighMPV, "a2d25db8-b8f9-42c2-8bc7-0b93cf604788", 0xa2d25db8, 0xb8f9, 0x42c2, 0x8b, 0xc7, 0x0b, 0x93, 0xcf, 0x60, 0x47, 0x88 ) - -// AVEncCodecType (GUID) -DEFINE_CODECAPI_GUID( AVEncCodecType, "08af4ac1-f3f2-4c74-9dcf-37f2ec79f826", 0x08af4ac1, 0xf3f2, 0x4c74, 0x9d, 0xcf, 0x37, 0xf2, 0xec, 0x79, 0xf8, 0x26 ) - -DEFINE_CODECAPI_GUID( GUID_AVEncMPEG1Video, "c8dafefe-da1e-4774-b27d-11830c16b1fe", 0xc8dafefe, 0xda1e, 0x4774, 0xb2, 0x7d, 0x11, 0x83, 0x0c, 0x16, 0xb1, 0xfe ) -DEFINE_CODECAPI_GUID( GUID_AVEncMPEG2Video, "046dc19a-6677-4aaa-a31d-c1ab716f4560", 0x046dc19a, 0x6677, 0x4aaa, 0xa3, 0x1d, 0xc1, 0xab, 0x71, 0x6f, 0x45, 0x60 ) -DEFINE_CODECAPI_GUID( GUID_AVEncMPEG1Audio, "d4dd1362-cd4a-4cd6-8138-b94db4542b04", 0xd4dd1362, 0xcd4a, 0x4cd6, 0x81, 0x38, 0xb9, 0x4d, 0xb4, 0x54, 0x2b, 0x04 ) -DEFINE_CODECAPI_GUID( GUID_AVEncMPEG2Audio, "ee4cbb1f-9c3f-4770-92b5-fcb7c2a8d381", 0xee4cbb1f, 0x9c3f, 0x4770, 0x92, 0xb5, 0xfc, 0xb7, 0xc2, 0xa8, 0xd3, 0x81 ) -DEFINE_CODECAPI_GUID( GUID_AVEncWMV, "4e0fef9b-1d43-41bd-b8bd-4d7bf7457a2a", 0x4e0fef9b, 0x1d43, 0x41bd, 0xb8, 0xbd, 0x4d, 0x7b, 0xf7, 0x45, 0x7a, 0x2a ) -DEFINE_CODECAPI_GUID( GUID_AVEndMPEG4Video, "dd37b12a-9503-4f8b-b8d0-324a00c0a1cf", 0xdd37b12a, 0x9503, 0x4f8b, 0xb8, 0xd0, 0x32, 0x4a, 0x00, 0xc0, 0xa1, 0xcf ) -DEFINE_CODECAPI_GUID( GUID_AVEncH264Video, "95044eab-31b3-47de-8e75-38a42bb03e28", 0x95044eab, 0x31b3, 0x47de, 0x8e, 0x75, 0x38, 0xa4, 0x2b, 0xb0, 0x3e, 0x28 ) -DEFINE_CODECAPI_GUID( GUID_AVEncDV, "09b769c7-3329-44fb-8954-fa30937d3d5a", 0x09b769c7, 0x3329, 0x44fb, 0x89, 0x54, 0xfa, 0x30, 0x93, 0x7d, 0x3d, 0x5a ) -DEFINE_CODECAPI_GUID( GUID_AVEncWMAPro, "1955f90c-33f7-4a68-ab81-53f5657125c4", 0x1955f90c, 0x33f7, 0x4a68, 0xab, 0x81, 0x53, 0xf5, 0x65, 0x71, 0x25, 0xc4 ) -DEFINE_CODECAPI_GUID( GUID_AVEncWMALossless, "55ca7265-23d8-4761-9031-b74fbe12f4c1", 0x55ca7265, 0x23d8, 0x4761, 0x90, 0x31, 0xb7, 0x4f, 0xbe, 0x12, 0xf4, 0xc1 ) -DEFINE_CODECAPI_GUID( GUID_AVEncWMAVoice, "13ed18cb-50e8-4276-a288-a6aa228382d9", 0x13ed18cb, 0x50e8, 0x4276, 0xa2, 0x88, 0xa6, 0xaa, 0x22, 0x83, 0x82, 0xd9 ) -DEFINE_CODECAPI_GUID( GUID_AVEncDolbyDigitalPro, "f5be76cc-0ff8-40eb-9cb1-bba94004d44f", 0xf5be76cc, 0x0ff8, 0x40eb, 0x9c, 0xb1, 0xbb, 0xa9, 0x40, 0x04, 0xd4, 0x4f ) -DEFINE_CODECAPI_GUID( GUID_AVEncDolbyDigitalConsumer, "c1a7bf6c-0059-4bfa-94ef-ef747a768d52", 0xc1a7bf6c, 0x0059, 0x4bfa, 0x94, 0xef, 0xef, 0x74, 0x7a, 0x76, 0x8d, 0x52 ) -DEFINE_CODECAPI_GUID( GUID_AVEncDolbyDigitalPlus, "698d1b80-f7dd-415c-971c-42492a2056c6", 0x698d1b80, 0xf7dd, 0x415c, 0x97, 0x1c, 0x42, 0x49, 0x2a, 0x20, 0x56, 0xc6 ) -DEFINE_CODECAPI_GUID( GUID_AVEncDTSHD, "2052e630-469d-4bfb-80ca-1d656e7e918f", 0x2052e630, 0x469d, 0x4bfb, 0x80, 0xca, 0x1d, 0x65, 0x6e, 0x7e, 0x91, 0x8f ) -DEFINE_CODECAPI_GUID( GUID_AVEncDTS, "45fbcaa2-5e6e-4ab0-8893-5903bee93acf", 0x45fbcaa2, 0x5e6e, 0x4ab0, 0x88, 0x93, 0x59, 0x03, 0xbe, 0xe9, 0x3a, 0xcf ) -DEFINE_CODECAPI_GUID( GUID_AVEncMLP, "05f73e29-f0d1-431e-a41c-a47432ec5a66", 0x05f73e29, 0xf0d1, 0x431e, 0xa4, 0x1c, 0xa4, 0x74, 0x32, 0xec, 0x5a, 0x66 ) -DEFINE_CODECAPI_GUID( GUID_AVEncPCM, "844be7f4-26cf-4779-b386-cc05d187990c", 0x844be7f4, 0x26cf, 0x4779, 0xb3, 0x86, 0xcc, 0x05, 0xd1, 0x87, 0x99, 0x0c ) -DEFINE_CODECAPI_GUID( GUID_AVEncSDDS, "1dc1b82f-11c8-4c71-b7b6-ee3eb9bc2b94", 0x1dc1b82f, 0x11c8, 0x4c71, 0xb7, 0xb6, 0xee, 0x3e, 0xb9, 0xbc, 0x2b, 0x94 ) - - - - -// AVEncCommonRateControlMode (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonRateControlMode, "1c0608e9-370c-4710-8a58-cb6181c42423", 0x1c0608e9, 0x370c, 0x4710, 0x8a, 0x58, 0xcb, 0x61, 0x81, 0xc4, 0x24, 0x23 ) - -enum eAVEncCommonRateControlMode -{ - eAVEncCommonRateControlMode_CBR = 0, - eAVEncCommonRateControlMode_PeakConstrainedVBR = 1, - eAVEncCommonRateControlMode_UnconstrainedVBR = 2, - eAVEncCommonRateControlMode_Quality = 3 -}; - -// AVEncCommonLowLatency (BOOL) -DEFINE_CODECAPI_GUID( AVEncCommonLowLatency, "9d3ecd55-89e8-490a-970a-0c9548d5a56e", 0x9d3ecd55, 0x89e8, 0x490a, 0x97, 0x0a, 0x0c, 0x95, 0x48, 0xd5, 0xa5, 0x6e ) - -// AVEncCommonMultipassMode (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonMultipassMode, "22533d4c-47e1-41b5-9352-a2b7780e7ac4", 0x22533d4c, 0x47e1, 0x41b5, 0x93, 0x52, 0xa2, 0xb7, 0x78, 0x0e, 0x7a, 0xc4 ) - -// AVEncCommonPassStart (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonPassStart, "6a67739f-4eb5-4385-9928-f276a939ef95", 0x6a67739f, 0x4eb5, 0x4385, 0x99, 0x28, 0xf2, 0x76, 0xa9, 0x39, 0xef, 0x95 ) - -// AVEncCommonPassEnd (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonPassEnd, "0e3d01bc-c85c-467d-8b60-c41012ee3bf6", 0x0e3d01bc, 0xc85c, 0x467d, 0x8b, 0x60, 0xc4, 0x10, 0x12, 0xee, 0x3b, 0xf6 ) - -// AVEncCommonRealTime (BOOL) -DEFINE_CODECAPI_GUID( AVEncCommonRealTime, "143a0ff6-a131-43da-b81e-98fbb8ec378e", 0x143a0ff6, 0xa131, 0x43da, 0xb8, 0x1e, 0x98, 0xfb, 0xb8, 0xec, 0x37, 0x8e ) - -// AVEncCommonQuality (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonQuality, "fcbf57a3-7ea5-4b0c-9644-69b40c39c391", 0xfcbf57a3, 0x7ea5, 0x4b0c, 0x96, 0x44, 0x69, 0xb4, 0x0c, 0x39, 0xc3, 0x91 ) - -// AVEncCommonQualityVsSpeed (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonQualityVsSpeed, "98332df8-03cd-476b-89fa-3f9e442dec9f", 0x98332df8, 0x03cd, 0x476b, 0x89, 0xfa, 0x3f, 0x9e, 0x44, 0x2d, 0xec, 0x9f ) - -// AVEncCommonMeanBitRate (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonMeanBitRate, "f7222374-2144-4815-b550-a37f8e12ee52", 0xf7222374, 0x2144, 0x4815, 0xb5, 0x50, 0xa3, 0x7f, 0x8e, 0x12, 0xee, 0x52 ) - -// AVEncCommonMeanBitRateInterval (UINT64) -DEFINE_CODECAPI_GUID( AVEncCommonMeanBitRateInterval, "bfaa2f0c-cb82-4bc0-8474-f06a8a0d0258", 0xbfaa2f0c, 0xcb82, 0x4bc0, 0x84, 0x74, 0xf0, 0x6a, 0x8a, 0x0d, 0x02, 0x58 ) - -// AVEncCommonMaxBitRate (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonMaxBitRate, "9651eae4-39b9-4ebf-85ef-d7f444ec7465", 0x9651eae4, 0x39b9, 0x4ebf, 0x85, 0xef, 0xd7, 0xf4, 0x44, 0xec, 0x74, 0x65 ) - -// AVEncCommonMinBitRate (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonMinBitRate, "101405b2-2083-4034-a806-efbeddd7c9ff", 0x101405b2, 0x2083, 0x4034, 0xa8, 0x06, 0xef, 0xbe, 0xdd, 0xd7, 0xc9, 0xff ) - -// AVEncCommonBufferSize (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonBufferSize, "0db96574-b6a4-4c8b-8106-3773de0310cd", 0x0db96574, 0xb6a4, 0x4c8b, 0x81, 0x06, 0x37, 0x73, 0xde, 0x03, 0x10, 0xcd ) - -// AVEncCommonBufferInLevel (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonBufferInLevel, "d9c5c8db-fc74-4064-94e9-cd19f947ed45", 0xd9c5c8db, 0xfc74, 0x4064, 0x94, 0xe9, 0xcd, 0x19, 0xf9, 0x47, 0xed, 0x45 ) - -// AVEncCommonBufferOutLevel (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonBufferOutLevel, "ccae7f49-d0bc-4e3d-a57e-fb5740140069", 0xccae7f49, 0xd0bc, 0x4e3d, 0xa5, 0x7e, 0xfb, 0x57, 0x40, 0x14, 0x00, 0x69 ) - -// AVEncCommonStreamEndHandling (UINT32) -DEFINE_CODECAPI_GUID( AVEncCommonStreamEndHandling, "6aad30af-6ba8-4ccc-8fca-18d19beaeb1c", 0x6aad30af, 0x6ba8, 0x4ccc, 0x8f, 0xca, 0x18, 0xd1, 0x9b, 0xea, 0xeb, 0x1c ) - -enum eAVEncCommonStreamEndHandling -{ - eAVEncCommonStreamEndHandling_DiscardPartial = 0, - eAVEncCommonStreamEndHandling_EnsureComplete = 1 -}; - -// -// Common Post Encode Statistical Parameters -// - -// AVEncStatCommonCompletedPasses (UINT32) -DEFINE_CODECAPI_GUID( AVEncStatCommonCompletedPasses, "3e5de533-9df7-438c-854f-9f7dd3683d34", 0x3e5de533, 0x9df7, 0x438c, 0x85, 0x4f, 0x9f, 0x7d, 0xd3, 0x68, 0x3d, 0x34 ) - -// -// Common Video Parameters -// - -// AVEncVideoOutputFrameRate (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoOutputFrameRate, "ea85e7c3-9567-4d99-87c4-02c1c278ca7c", 0xea85e7c3, 0x9567, 0x4d99, 0x87, 0xc4, 0x02, 0xc1, 0xc2, 0x78, 0xca, 0x7c ) - -// AVEncVideoOutputFrameRateConversion (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoOutputFrameRateConversion, "8c068bf4-369a-4ba3-82fd-b2518fb3396e", 0x8c068bf4, 0x369a, 0x4ba3, 0x82, 0xfd, 0xb2, 0x51, 0x8f, 0xb3, 0x39, 0x6e ) - -enum eAVEncVideoOutputFrameRateConversion -{ - eAVEncVideoOutputFrameRateConversion_Disable = 0, - eAVEncVideoOutputFrameRateConversion_Enable = 1, - eAVEncVideoOutputFrameRateConversion_Alias = 2 -}; - -// AVEncVideoPixelAspectRatio (UINT32 as UINT16/UNIT16) <---- You have WORD in the doc -DEFINE_CODECAPI_GUID( AVEncVideoPixelAspectRatio, "3cdc718f-b3e9-4eb6-a57f-cf1f1b321b87", 0x3cdc718f, 0xb3e9, 0x4eb6, 0xa5, 0x7f, 0xcf, 0x1f, 0x1b, 0x32, 0x1b, 0x87 ) - -// AVDecVideoAcceleration_MPEG2 (UINT32) -DEFINE_CODECAPI_GUID( AVDecVideoAcceleration_MPEG2, "f7db8a2e-4f48-4ee8-ae31-8b6ebe558ae2", 0xf7db8a2e, 0x4f48, 0x4ee8, 0xae, 0x31, 0x8b, 0x6e, 0xbe, 0x55, 0x8a, 0xe2 ) -DEFINE_CODECAPI_GUID( AVDecVideoAcceleration_H264, "f7db8a2f-4f48-4ee8-ae31-8b6ebe558ae2", 0xf7db8a2f, 0x4f48, 0x4ee8, 0xae, 0x31, 0x8b, 0x6e, 0xbe, 0x55, 0x8a, 0xe2 ) -DEFINE_CODECAPI_GUID( AVDecVideoAcceleration_VC1, "f7db8a30-4f48-4ee8-ae31-8b6ebe558ae2", 0xf7db8a30, 0x4f48, 0x4ee8, 0xae, 0x31, 0x8b, 0x6e, 0xbe, 0x55, 0x8a, 0xe2 ) - -// AVDecVideoProcDeinterlaceCSC (UINT32) -DEFINE_CODECAPI_GUID( AVDecVideoProcDeinterlaceCSC, "f7db8a31-4f48-4ee8-ae31-8b6ebe558ae2", 0xf7db8a31, 0x4f48, 0x4ee8, 0xae, 0x31, 0x8b, 0x6e, 0xbe, 0x55, 0x8a, 0xe2 ) - - -// AVDecVideoThumbnailGenerationMode (BOOL) -// Related to video thumbnail generation. -// Video decoders can have special configurations for fast thumbnail generation. -// For example: -// - They can use only one decoding thread so that multiple instances can be used at the same time. -// - They can also decode I frames only. -DEFINE_CODECAPI_GUID( AVDecVideoThumbnailGenerationMode, "2EFD8EEE-1150-4328-9CF5-66DCE933FCF4", 0x2efd8eee, 0x1150, 0x4328, 0x9c, 0xf5, 0x66, 0xdc, 0xe9, 0x33, 0xfc, 0xf4) - -// AVDecVideoDropPicWithMissingRef (BOOL) -// Related to Video decoding mode of whether to drop pictures with missing references. -// For DVD playback, we may want to do so to avoid bad blocking. For Digital TV, we may -// want to decode all pictures no matter what. -DEFINE_CODECAPI_GUID( AVDecVideoDropPicWithMissingRef, "F8226383-14C2-4567-9734-5004E96FF887", 0xf8226383, 0x14c2, 0x4567, 0x97, 0x34, 0x50, 0x4, 0xe9, 0x6f, 0xf8, 0x87) - - -// AVDecSoftwareVideoDeinterlaceMode (UINT32) -DEFINE_CODECAPI_GUID( AVDecVideoSoftwareDeinterlaceMode, "0c08d1ce-9ced-4540-bae3-ceb380141109", 0x0c08d1ce, 0x9ced, 0x4540, 0xba, 0xe3, 0xce, 0xb3, 0x80, 0x14, 0x11, 0x09); - -enum eAVDecVideoSoftwareDeinterlaceMode -{ - eAVDecVideoSoftwareDeinterlaceMode_NoDeinterlacing = 0, // do not use software deinterlace - eAVDecVideoSoftwareDeinterlaceMode_ProgressiveDeinterlacing = 1, // Use progressive deinterlace - eAVDecVideoSoftwareDeinterlaceMode_BOBDeinterlacing = 2, // BOB deinterlacing - eAVDecVideoSoftwareDeinterlaceMode_SmartBOBDeinterlacing = 3 // Smart BOB deinterlacing -}; - -// AVDecVideoFastDecodeMode (UINT32) -// 0: normal decoding -// 1-32 : Where 32 is fastest decoding. Any value between (and including) 1 to 32 is valid -DEFINE_CODECAPI_GUID( AVDecVideoFastDecodeMode, "6B529F7D-D3B1-49c6-A999-9EC6911BEDBF", 0x6b529f7d, 0xd3b1, 0x49c6, 0xa9, 0x99, 0x9e, 0xc6, 0x91, 0x1b, 0xed, 0xbf); - -enum eAVFastDecodeMode -{ - eVideoDecodeCompliant = 0, - eVideoDecodeOptimalLF = 1, // Optimal Loop Filter - eVideoDecodeDisableLF = 2, // Disable Loop Filter - eVideoDecodeFastest = 32, -}; - -// AVDecVideoH264ErrorConcealment (UINT32) -// Related to Video decoding mode of whether to conceal pictures with corruptions. -// For DVD playback, we may not want to do so to avoid unnecessary computation. For Digital TV, we may -// want to perform error concealment. -DEFINE_CODECAPI_GUID( AVDecVideoH264ErrorConcealment, "ECECACE8-3436-462c-9294-CD7BACD758A9", 0xececace8, 0x3436, 0x462c, 0x92, 0x94, 0xcd, 0x7b, 0xac, 0xd7, 0x58, 0xa9) - -enum eAVDecVideoH264ErrorConcealment -{ - eErrorConcealmentTypeDrop = 0, // ERR_CONCEALMENT_TYPE_DROP - eErrorConcealmentTypeBasic = 1, // ERR_CONCEALMENT_TYPE_BASIC (the default, and good mode used most of the time) - eErrorConcealmentTypeAdvanced = 2, // ERR_CONCEALMENT_TYPE_ADVANCED - eErrorConcealmentTypeDXVASetBlack = 3, // ERR_CONCEALMENT_TYPE_DXVA_SET_BLACK -}; - - -// AVDecVideoMPEG2ErrorConcealment (UINT32) -// Related to Video decoding mode of whether to conceal pictures with corruptions. -// For DVD playback, we may not want to do so to avoid unnecessary computation. For Digital TV, we may -// want to perform error concealment. -DEFINE_CODECAPI_GUID( AVDecVideoMPEG2ErrorConcealment, "9D2BFE18-728D-48d2-B358-BC7E436C6674", 0x9d2bfe18, 0x728d, 0x48d2, 0xb3, 0x58, 0xbc, 0x7e, 0x43, 0x6c, 0x66, 0x74) - -enum eAVDecVideoMPEG2ErrorConcealment -{ - eErrorConcealmentOff = 0, // - eErrorConcealmentOn = 1, // the default and good mode used most of the time -}; - - -// CODECAPI_AVDecVideoCodecType (UINT32) -DEFINE_CODECAPI_GUID(AVDecVideoCodecType, "434528E5-21F0-46b6-B62C-9B1B6B658CD1", 0x434528e5, 0x21f0, 0x46b6, 0xb6, 0x2c, 0x9b, 0x1b, 0x6b, 0x65, 0x8c, 0xd1); - -enum eAVDecVideoCodecType -{ - eAVDecVideoCodecType_NOTPLAYING = 0, - eAVDecVideoCodecType_MPEG2 = 1, - eAVDecVideoCodecType_H264 = 2 -}; - -// CODECAPI_AVDecVideoDXVAMode (UINT32) -DEFINE_CODECAPI_GUID(AVDecVideoDXVAMode, "F758F09E-7337-4ae7-8387-73DC2D54E67D", 0xf758f09e, 0x7337, 0x4ae7, 0x83, 0x87, 0x73, 0xdc, 0x2d, 0x54, 0xe6, 0x7d); - -enum eAVDecVideoDXVAMode -{ - eAVDecVideoDXVAMode_NOTPLAYING = 0, - eAVDecVideoDXVAMode_SW = 1, - eAVDecVideoDXVAMode_MC = 2, - eAVDecVideoDXVAMode_IDCT = 3, - eAVDecVideoDXVAMode_VLD = 4 -}; - - - -// CODECAPI_AVDecVideoDXVABusEncryption (UINT32) -DEFINE_CODECAPI_GUID(AVDecVideoDXVABusEncryption, "42153C8B-FD0B-4765-A462-DDD9E8BCC388", 0x42153c8b, 0xfd0b, 0x4765, 0xa4, 0x62, 0xdd, 0xd9, 0xe8, 0xbc, 0xc3, 0x88); - -enum eAVDecVideoDXVABusEncryption -{ - eAVDecVideoDXVABusEncryption_NONE = 0, - eAVDecVideoDXVABusEncryption_PRIVATE = 1, - eAVDecVideoDXVABusEncryption_AES = 2 -}; - - -// AVEncVideoForceSourceScanType (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoForceSourceScanType, "1ef2065f-058a-4765-a4fc-8a864c103012", 0x1ef2065f, 0x058a, 0x4765, 0xa4, 0xfc, 0x8a, 0x86, 0x4c, 0x10, 0x30, 0x12 ) -enum eAVEncVideoSourceScanType -{ - eAVEncVideoSourceScan_Automatic = 0, - eAVEncVideoSourceScan_Interlaced = 1, - eAVEncVideoSourceScan_Progressive = 2 -}; - -// AVEncVideoNoOfFieldsToEncode (UINT64) -DEFINE_CODECAPI_GUID( AVEncVideoNoOfFieldsToEncode, "61e4bbe2-4ee0-40e7-80ab-51ddeebe6291", 0x61e4bbe2, 0x4ee0, 0x40e7, 0x80, 0xab, 0x51, 0xdd, 0xee, 0xbe, 0x62, 0x91 ) - -// AVEncVideoNoOfFieldsToSkip (UINT64) -DEFINE_CODECAPI_GUID( AVEncVideoNoOfFieldsToSkip, "a97e1240-1427-4c16-a7f7-3dcfd8ba4cc5", 0xa97e1240, 0x1427, 0x4c16, 0xa7, 0xf7, 0x3d, 0xcf, 0xd8, 0xba, 0x4c, 0xc5 ) - -// AVEncVideoEncodeDimension (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoEncodeDimension, "1074df28-7e0f-47a4-a453-cdd73870f5ce", 0x1074df28, 0x7e0f, 0x47a4, 0xa4, 0x53, 0xcd, 0xd7, 0x38, 0x70, 0xf5, 0xce ) - -// AVEncVideoEncodeOffsetOrigin (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoEncodeOffsetOrigin, "6bc098fe-a71a-4454-852e-4d2ddeb2cd24", 0x6bc098fe, 0xa71a, 0x4454, 0x85, 0x2e, 0x4d, 0x2d, 0xde, 0xb2, 0xcd, 0x24 ) - -// AVEncVideoDisplayDimension (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoDisplayDimension, "de053668-f4ec-47a9-86d0-836770f0c1d5", 0xde053668, 0xf4ec, 0x47a9, 0x86, 0xd0, 0x83, 0x67, 0x70, 0xf0, 0xc1, 0xd5 ) - -// AVEncVideoOutputScanType (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoOutputScanType, "460b5576-842e-49ab-a62d-b36f7312c9db", 0x460b5576, 0x842e, 0x49ab, 0xa6, 0x2d, 0xb3, 0x6f, 0x73, 0x12, 0xc9, 0xdb ) -enum eAVEncVideoOutputScanType -{ - eAVEncVideoOutputScan_Progressive = 0, - eAVEncVideoOutputScan_Interlaced = 1, - eAVEncVideoOutputScan_SameAsInput = 2, - eAVEncVideoOutputScan_Automatic = 3 -}; - -// AVEncVideoInverseTelecineEnable (BOOL) -DEFINE_CODECAPI_GUID( AVEncVideoInverseTelecineEnable, "2ea9098b-e76d-4ccd-a030-d3b889c1b64c", 0x2ea9098b, 0xe76d, 0x4ccd, 0xa0, 0x30, 0xd3, 0xb8, 0x89, 0xc1, 0xb6, 0x4c ) - -// AVEncVideoInverseTelecineThreshold (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoInverseTelecineThreshold, "40247d84-e895-497f-b44c-b74560acfe27", 0x40247d84, 0xe895, 0x497f, 0xb4, 0x4c, 0xb7, 0x45, 0x60, 0xac, 0xfe, 0x27 ) - -// AVEncVideoSourceFilmContent (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoSourceFilmContent, "1791c64b-ccfc-4827-a0ed-2557793b2b1c", 0x1791c64b, 0xccfc, 0x4827, 0xa0, 0xed, 0x25, 0x57, 0x79, 0x3b, 0x2b, 0x1c ) - -enum eAVEncVideoFilmContent -{ - eAVEncVideoFilmContent_VideoOnly = 0, - eAVEncVideoFilmContent_FilmOnly = 1, - eAVEncVideoFilmContent_Mixed = 2 -}; - -// AVEncVideoSourceIsBW (BOOL) -DEFINE_CODECAPI_GUID( AVEncVideoSourceIsBW, "42ffc49b-1812-4fdc-8d24-7054c521e6eb", 0x42ffc49b, 0x1812, 0x4fdc, 0x8d, 0x24, 0x70, 0x54, 0xc5, 0x21, 0xe6, 0xeb ) - -// AVEncVideoFieldSwap (BOOL) -DEFINE_CODECAPI_GUID( AVEncVideoFieldSwap, "fefd7569-4e0a-49f2-9f2b-360ea48c19a2", 0xfefd7569, 0x4e0a, 0x49f2, 0x9f, 0x2b, 0x36, 0x0e, 0xa4, 0x8c, 0x19, 0xa2 ) - -// AVEncVideoInputChromaResolution (UINT32) -// AVEncVideoOutputChromaSubsamplingFormat (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoInputChromaResolution, "bb0cec33-16f1-47b0-8a88-37815bee1739", 0xbb0cec33, 0x16f1, 0x47b0, 0x8a, 0x88, 0x37, 0x81, 0x5b, 0xee, 0x17, 0x39 ) -DEFINE_CODECAPI_GUID( AVEncVideoOutputChromaResolution, "6097b4c9-7c1d-4e64-bfcc-9e9765318ae7", 0x6097b4c9, 0x7c1d, 0x4e64, 0xbf, 0xcc, 0x9e, 0x97, 0x65, 0x31, 0x8a, 0xe7 ) - -enum eAVEncVideoChromaResolution -{ - eAVEncVideoChromaResolution_SameAsSource =0 , - eAVEncVideoChromaResolution_444 = 1, - eAVEncVideoChromaResolution_422 = 2, - eAVEncVideoChromaResolution_420 = 3, - eAVEncVideoChromaResolution_411 = 4 -}; - -// AVEncVideoInputChromaSubsampling (UINT32) -// AVEncVideoOutputChromaSubsampling (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoInputChromaSubsampling, "a8e73a39-4435-4ec3-a6ea-98300f4b36f7", 0xa8e73a39, 0x4435, 0x4ec3, 0xa6, 0xea, 0x98, 0x30, 0x0f, 0x4b, 0x36, 0xf7 ) -DEFINE_CODECAPI_GUID( AVEncVideoOutputChromaSubsampling, "fa561c6c-7d17-44f0-83c9-32ed12e96343", 0xfa561c6c, 0x7d17, 0x44f0, 0x83, 0xc9, 0x32, 0xed, 0x12, 0xe9, 0x63, 0x43 ) - -enum eAVEncVideoChromaSubsampling -{ - eAVEncVideoChromaSubsamplingFormat_SameAsSource = 0, - eAVEncVideoChromaSubsamplingFormat_ProgressiveChroma = 0x8, - eAVEncVideoChromaSubsamplingFormat_Horizontally_Cosited = 0x4, - eAVEncVideoChromaSubsamplingFormat_Vertically_Cosited = 0x2, - eAVEncVideoChromaSubsamplingFormat_Vertically_AlignedChromaPlanes = 0x1, -}; - -// AVEncVideoInputColorPrimaries (UINT32) -// AVEncVideoOutputColorPrimaries (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoInputColorPrimaries, "c24d783f-7ce6-4278-90ab-28a4f1e5f86c", 0xc24d783f, 0x7ce6, 0x4278, 0x90, 0xab, 0x28, 0xa4, 0xf1, 0xe5, 0xf8, 0x6c ) -DEFINE_CODECAPI_GUID( AVEncVideoOutputColorPrimaries, "be95907c-9d04-4921-8985-a6d6d87d1a6c", 0xbe95907c, 0x9d04, 0x4921, 0x89, 0x85, 0xa6, 0xd6, 0xd8, 0x7d, 0x1a, 0x6c ) - -enum eAVEncVideoColorPrimaries -{ - eAVEncVideoColorPrimaries_SameAsSource = 0, - eAVEncVideoColorPrimaries_Reserved = 1, - eAVEncVideoColorPrimaries_BT709 = 2, - eAVEncVideoColorPrimaries_BT470_2_SysM = 3, - eAVEncVideoColorPrimaries_BT470_2_SysBG = 4, - eAVEncVideoColorPrimaries_SMPTE170M = 5, - eAVEncVideoColorPrimaries_SMPTE240M = 6, - eAVEncVideoColorPrimaries_EBU3231 = 7, - eAVEncVideoColorPrimaries_SMPTE_C = 8 -}; - -// AVEncVideoInputColorTransferFunction (UINT32) -// AVEncVideoOutputColorTransferFunction (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoInputColorTransferFunction, "8c056111-a9c3-4b08-a0a0-ce13f8a27c75", 0x8c056111, 0xa9c3, 0x4b08, 0xa0, 0xa0, 0xce, 0x13, 0xf8, 0xa2, 0x7c, 0x75 ) -DEFINE_CODECAPI_GUID( AVEncVideoOutputColorTransferFunction, "4a7f884a-ea11-460d-bf57-b88bc75900de", 0x4a7f884a, 0xea11, 0x460d, 0xbf, 0x57, 0xb8, 0x8b, 0xc7, 0x59, 0x00, 0xde ) - -enum eAVEncVideoColorTransferFunction -{ - eAVEncVideoColorTransferFunction_SameAsSource = 0, - eAVEncVideoColorTransferFunction_10 = 1, // (Linear, scRGB) - eAVEncVideoColorTransferFunction_18 = 2, - eAVEncVideoColorTransferFunction_20 = 3, - eAVEncVideoColorTransferFunction_22 = 4, // (BT470-2 SysM) - eAVEncVideoColorTransferFunction_22_709 = 5, // (BT709, SMPTE296M, SMPTE170M, BT470, SMPTE274M, BT.1361) - eAVEncVideoColorTransferFunction_22_240M = 6, // (SMPTE240M, interim 274M) - eAVEncVideoColorTransferFunction_22_8bit_sRGB = 7, // (sRGB) - eAVEncVideoColorTransferFunction_28 = 8 -}; - -// AVEncVideoInputColorTransferMatrix (UINT32) -// AVEncVideoOutputColorTransferMatrix (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoInputColorTransferMatrix, "52ed68b9-72d5-4089-958d-f5405d55081c", 0x52ed68b9, 0x72d5, 0x4089, 0x95, 0x8d, 0xf5, 0x40, 0x5d, 0x55, 0x08, 0x1c ) -DEFINE_CODECAPI_GUID( AVEncVideoOutputColorTransferMatrix , "a9b90444-af40-4310-8fbe-ed6d933f892b", 0xa9b90444, 0xaf40, 0x4310, 0x8f, 0xbe, 0xed, 0x6d, 0x93, 0x3f, 0x89, 0x2b ) - - -enum eAVEncVideoColorTransferMatrix -{ - eAVEncVideoColorTransferMatrix_SameAsSource = 0, - eAVEncVideoColorTransferMatrix_BT709 = 1, - eAVEncVideoColorTransferMatrix_BT601 = 2, // (601, BT470-2 B,B, 170M) - eAVEncVideoColorTransferMatrix_SMPTE240M = 3 -}; - -// AVEncVideoInputColorLighting (UINT32) -// AVEncVideoOutputColorLighting (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoInputColorLighting, "46a99549-0015-4a45-9c30-1d5cfa258316", 0x46a99549, 0x0015, 0x4a45, 0x9c, 0x30, 0x1d, 0x5c, 0xfa, 0x25, 0x83, 0x16 ) -DEFINE_CODECAPI_GUID( AVEncVideoOutputColorLighting , "0e5aaac6-ace6-4c5c-998e-1a8c9c6c0f89", 0x0e5aaac6, 0xace6, 0x4c5c, 0x99, 0x8e, 0x1a, 0x8c, 0x9c, 0x6c, 0x0f, 0x89 ) - -enum eAVEncVideoColorLighting -{ - eAVEncVideoColorLighting_SameAsSource = 0, - eAVEncVideoColorLighting_Unknown = 1, - eAVEncVideoColorLighting_Bright = 2, - eAVEncVideoColorLighting_Office = 3, - eAVEncVideoColorLighting_Dim = 4, - eAVEncVideoColorLighting_Dark = 5 -}; - -// AVEncVideoInputColorNominalRange (UINT32) -// AVEncVideoOutputColorNominalRange (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoInputColorNominalRange, "16cf25c6-a2a6-48e9-ae80-21aec41d427e", 0x16cf25c6, 0xa2a6, 0x48e9, 0xae, 0x80, 0x21, 0xae, 0xc4, 0x1d, 0x42, 0x7e ) -DEFINE_CODECAPI_GUID( AVEncVideoOutputColorNominalRange , "972835ed-87b5-4e95-9500-c73958566e54", 0x972835ed, 0x87b5, 0x4e95, 0x95, 0x00, 0xc7, 0x39, 0x58, 0x56, 0x6e, 0x54 ) - -enum eAVEncVideoColorNominalRange -{ - eAVEncVideoColorNominalRange_SameAsSource = 0, - eAVEncVideoColorNominalRange_0_255 = 1, // (8 bit: 0..255, 10 bit: 0..1023) - eAVEncVideoColorNominalRange_16_235 = 2, // (16..235, 64..940 (16*4...235*4) - eAVEncVideoColorNominalRange_48_208 = 3 // (48..208) -}; - -// AVEncInputVideoSystem (UINT32) -DEFINE_CODECAPI_GUID( AVEncInputVideoSystem, "bede146d-b616-4dc7-92b2-f5d9fa9298f7", 0xbede146d, 0xb616, 0x4dc7, 0x92, 0xb2, 0xf5, 0xd9, 0xfa, 0x92, 0x98, 0xf7 ) - -enum eAVEncInputVideoSystem -{ - eAVEncInputVideoSystem_Unspecified = 0, - eAVEncInputVideoSystem_PAL = 1, - eAVEncInputVideoSystem_NTSC = 2, - eAVEncInputVideoSystem_SECAM = 3, - eAVEncInputVideoSystem_MAC = 4, - eAVEncInputVideoSystem_HDV = 5, - eAVEncInputVideoSystem_Component = 6 -}; - -// AVEncVideoHeaderDropFrame (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoHeaderDropFrame, "6ed9e124-7925-43fe-971b-e019f62222b4", 0x6ed9e124, 0x7925, 0x43fe, 0x97, 0x1b, 0xe0, 0x19, 0xf6, 0x22, 0x22, 0xb4 ) - -// AVEncVideoHeaderHours (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoHeaderHours, "2acc7702-e2da-4158-bf9b-88880129d740", 0x2acc7702, 0xe2da, 0x4158, 0xbf, 0x9b, 0x88, 0x88, 0x01, 0x29, 0xd7, 0x40 ) - -// AVEncVideoHeaderMinutes (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoHeaderMinutes, "dc1a99ce-0307-408b-880b-b8348ee8ca7f", 0xdc1a99ce, 0x0307, 0x408b, 0x88, 0x0b, 0xb8, 0x34, 0x8e, 0xe8, 0xca, 0x7f ) - -// AVEncVideoHeaderSeconds (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoHeaderSeconds, "4a2e1a05-a780-4f58-8120-9a449d69656b", 0x4a2e1a05, 0xa780, 0x4f58, 0x81, 0x20, 0x9a, 0x44, 0x9d, 0x69, 0x65, 0x6b ) - -// AVEncVideoHeaderFrames (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoHeaderFrames, "afd5f567-5c1b-4adc-bdaf-735610381436", 0xafd5f567, 0x5c1b, 0x4adc, 0xbd, 0xaf, 0x73, 0x56, 0x10, 0x38, 0x14, 0x36 ) - -// AVEncVideoDefaultUpperFieldDominant (BOOL) -DEFINE_CODECAPI_GUID( AVEncVideoDefaultUpperFieldDominant, "810167c4-0bc1-47ca-8fc2-57055a1474a5", 0x810167c4, 0x0bc1, 0x47ca, 0x8f, 0xc2, 0x57, 0x05, 0x5a, 0x14, 0x74, 0xa5 ) - -// AVEncVideoCBRMotionTradeoff (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoCBRMotionTradeoff, "0d49451e-18d5-4367-a4ef-3240df1693c4", 0x0d49451e, 0x18d5, 0x4367, 0xa4, 0xef, 0x32, 0x40, 0xdf, 0x16, 0x93, 0xc4 ) - -// AVEncVideoCodedVideoAccessUnitSize (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoCodedVideoAccessUnitSize, "b4b10c15-14a7-4ce8-b173-dc90a0b4fcdb", 0xb4b10c15, 0x14a7, 0x4ce8, 0xb1, 0x73, 0xdc, 0x90, 0xa0, 0xb4, 0xfc, 0xdb ) - -// AVEncVideoMaxKeyframeDistance (UINT32) -DEFINE_CODECAPI_GUID( AVEncVideoMaxKeyframeDistance, "2987123a-ba93-4704-b489-ec1e5f25292c", 0x2987123a, 0xba93, 0x4704, 0xb4, 0x89, 0xec, 0x1e, 0x5f, 0x25, 0x29, 0x2c ) - - -// -// Audio/Video Mux -// - -// AVEncMuxOutputStreamType (UINT32) -DEFINE_CODECAPI_GUID( AVEncMuxOutputStreamType, "CEDD9E8F-34D3-44db-A1D8-F81520254F3E", 0xcedd9e8f, 0x34d3, 0x44db, 0xa1, 0xd8, 0xf8, 0x15, 0x20, 0x25, 0x4f, 0x3e) - -enum eAVEncMuxOutput -{ - eAVEncMuxOutputAuto = 0, // Decision is made automatically be the mux (elementary stream, program stream or transport stream) - eAVEncMuxOutputPS = 1, // Program stream - eAVEncMuxOutputTS = 2 // Transport stream -}; - - -// -// Common Post-Encode Video Statistical Parameters -// - -// AVEncStatVideoOutputFrameRate (UINT32/UINT32) -DEFINE_CODECAPI_GUID( AVEncStatVideoOutputFrameRate, "be747849-9ab4-4a63-98fe-f143f04f8ee9", 0xbe747849, 0x9ab4, 0x4a63, 0x98, 0xfe, 0xf1, 0x43, 0xf0, 0x4f, 0x8e, 0xe9 ) - -// AVEncStatVideoCodedFrames (UINT32) -DEFINE_CODECAPI_GUID( AVEncStatVideoCodedFrames, "d47f8d61-6f5a-4a26-bb9f-cd9518462bcd", 0xd47f8d61, 0x6f5a, 0x4a26, 0xbb, 0x9f, 0xcd, 0x95, 0x18, 0x46, 0x2b, 0xcd ) - -// AVEncStatVideoTotalFrames (UINT32) -DEFINE_CODECAPI_GUID( AVEncStatVideoTotalFrames, "fdaa9916-119a-4222-9ad6-3f7cab99cc8b", 0xfdaa9916, 0x119a, 0x4222, 0x9a, 0xd6, 0x3f, 0x7c, 0xab, 0x99, 0xcc, 0x8b ) - -// -// Common Audio Parameters -// - -// AVEncAudioIntervalToEncode (UINT64) -DEFINE_CODECAPI_GUID( AVEncAudioIntervalToEncode, "866e4b4d-725a-467c-bb01-b496b23b25f9", 0x866e4b4d, 0x725a, 0x467c, 0xbb, 0x01, 0xb4, 0x96, 0xb2, 0x3b, 0x25, 0xf9 ) - -// AVEncAudioIntervalToSkip (UINT64) -DEFINE_CODECAPI_GUID( AVEncAudioIntervalToSkip, "88c15f94-c38c-4796-a9e8-96e967983f26", 0x88c15f94, 0xc38c, 0x4796, 0xa9, 0xe8, 0x96, 0xe9, 0x67, 0x98, 0x3f, 0x26 ) - -// AVEncAudioDualMono (UINT32) - Read/Write -// Some audio encoders can encode 2 channel input as "dual mono". Use this -// property to set the appropriate field in the bitstream header to indicate that the -// 2 channel bitstream is or isn't dual mono. -// For encoding MPEG audio, use the DualChannel option in AVEncMPACodingMode instead -DEFINE_CODECAPI_GUID( AVEncAudioDualMono, "3648126b-a3e8-4329-9b3a-5ce566a43bd3", 0x3648126b, 0xa3e8, 0x4329, 0x9b, 0x3a, 0x5c, 0xe5, 0x66, 0xa4, 0x3b, 0xd3 ) - -enum eAVEncAudioDualMono -{ - eAVEncAudioDualMono_SameAsInput = 0, // As indicated by input media type - eAVEncAudioDualMono_Off = 1, // 2-ch output bitstream should not be dual mono - eAVEncAudioDualMono_On = 2 // 2-ch output bitstream should be dual mono -}; - -// AVEncAudioMeanBitRate (UINT32) - Read/Write - Used to specify audio bitrate (in bits per second) when the encoder is instantiated as an audio+video encoder. -DEFINE_CODECAPI_GUID( AVEncAudioMeanBitRate, "921295bb-4fca-4679-aab8-9e2a1d753384", 0x921295bb, 0x4fca, 0x4679, 0xaa, 0xb8, 0x9e, 0x2a, 0x1d, 0x75, 0x33, 0x84 ) - -// AVEncAudioMapDestChannel0..15 (UINT32) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel0, "bc5d0b60-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b60, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel1, "bc5d0b61-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b61, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel2, "bc5d0b62-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b62, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel3, "bc5d0b63-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b63, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel4, "bc5d0b64-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b64, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel5, "bc5d0b65-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b65, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel6, "bc5d0b66-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b66, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel7, "bc5d0b67-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b67, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel8, "bc5d0b68-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b68, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel9, "bc5d0b69-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b69, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel10, "bc5d0b6a-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b6a, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel11, "bc5d0b6b-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b6b, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel12, "bc5d0b6c-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b6c, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel13, "bc5d0b6d-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b6d, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel14, "bc5d0b6e-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b6e, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) -DEFINE_CODECAPI_GUID( AVEncAudioMapDestChannel15, "bc5d0b6f-df6a-4e16-9803-b82007a30c8d", 0xbc5d0b6f, 0xdf6a, 0x4e16, 0x98, 0x03, 0xb8, 0x20, 0x07, 0xa3, 0x0c, 0x8d ) - -// AVEncAudioInputContent (UINT32) <---- You have ENUM in the doc -DEFINE_CODECAPI_GUID( AVEncAudioInputContent, "3e226c2b-60b9-4a39-b00b-a7b40f70d566", 0x3e226c2b, 0x60b9, 0x4a39, 0xb0, 0x0b, 0xa7, 0xb4, 0x0f, 0x70, 0xd5, 0x66 ) - -enum eAVEncAudioInputContent -{ - AVEncAudioInputContent_Unknown =0, - AVEncAudioInputContent_Voice = 1, - AVEncAudioInputContent_Music = 2 -}; - -// -// Common Post-Encode Audio Statistical Parameters -// - -// AVEncStatAudioPeakPCMValue (UINT32) -DEFINE_CODECAPI_GUID( AVEncStatAudioPeakPCMValue, "dce7fd34-dc00-4c16-821b-35d9eb00fb1a", 0xdce7fd34, 0xdc00, 0x4c16, 0x82, 0x1b, 0x35, 0xd9, 0xeb, 0x00, 0xfb, 0x1a ) - -// AVEncStatAudioAveragePCMValue (UINT32) -DEFINE_CODECAPI_GUID( AVEncStatAudioAveragePCMValue, "979272f8-d17f-4e32-bb73-4e731c68ba2d", 0x979272f8, 0xd17f, 0x4e32, 0xbb, 0x73, 0x4e, 0x73, 0x1c, 0x68, 0xba, 0x2d ) - -// AVEncStatAverageBPS (UINT32) -DEFINE_CODECAPI_GUID( AVEncStatAudioAverageBPS, "ca6724db-7059-4351-8b43-f82198826a14", 0xca6724db, 0x7059, 0x4351, 0x8b, 0x43, 0xf8, 0x21, 0x98, 0x82, 0x6a, 0x14 ) -DEFINE_CODECAPI_GUID( AVEncStatAverageBPS, "ca6724db-7059-4351-8b43-f82198826a14", 0xca6724db, 0x7059, 0x4351, 0x8b, 0x43, 0xf8, 0x21, 0x98, 0x82, 0x6a, 0x14 ) - -// AVEncStatHardwareProcessorUtilitization (UINT32) -// HW usage % x 1000 -DEFINE_CODECAPI_GUID( AVEncStatHardwareProcessorUtilitization, "995dc027-cb95-49e6-b91b-5967753cdcb8", 0x995dc027, 0xcb95, 0x49e6, 0xb9, 0x1b, 0x59, 0x67, 0x75, 0x3c, 0xdc, 0xb8 ) - -// AVEncStatHardwareBandwidthUtilitization (UINT32) -// HW usage % x 1000 -DEFINE_CODECAPI_GUID( AVEncStatHardwareBandwidthUtilitization, "0124ba9b-dc41-4826-b45f-18ac01b3d5a8", 0x0124ba9b, 0xdc41, 0x4826, 0xb4, 0x5f, 0x18, 0xac, 0x01, 0xb3, 0xd5, 0xa8 ) - -// -// MPEG Video Encoding Interface -// - -// -// MPV Encoder Specific Parameters -// - -// AVEncMPVGOPSize (UINT32) -DEFINE_CODECAPI_GUID( AVEncMPVGOPSize, "95f31b26-95a4-41aa-9303-246a7fc6eef1", 0x95f31b26, 0x95a4, 0x41aa, 0x93, 0x03, 0x24, 0x6a, 0x7f, 0xc6, 0xee, 0xf1 ) - -// AVEncMPVGOPOpen (BOOL) -DEFINE_CODECAPI_GUID( AVEncMPVGOPOpen, "b1d5d4a6-3300-49b1-ae61-a09937ab0e49", 0xb1d5d4a6, 0x3300, 0x49b1, 0xae, 0x61, 0xa0, 0x99, 0x37, 0xab, 0x0e, 0x49 ) - -// AVEncMPVDefaultBPictureCount (UINT32) -DEFINE_CODECAPI_GUID( AVEncMPVDefaultBPictureCount, "8d390aac-dc5c-4200-b57f-814d04babab2", 0x8d390aac, 0xdc5c, 0x4200, 0xb5, 0x7f, 0x81, 0x4d, 0x04, 0xba, 0xba, 0xb2 ) - -// AVEncMPVProfile (UINT32) <---- You have GUID in the doc -DEFINE_CODECAPI_GUID( AVEncMPVProfile, "dabb534a-1d99-4284-975a-d90e2239baa1", 0xdabb534a, 0x1d99, 0x4284, 0x97, 0x5a, 0xd9, 0x0e, 0x22, 0x39, 0xba, 0xa1 ) - -enum eAVEncMPVProfile -{ - eAVEncMPVProfile_unknown = 0, - eAVEncMPVProfile_Simple = 1, - eAVEncMPVProfile_Main = 2, - eAVEncMPVProfile_High = 3, - eAVEncMPVProfile_422 = 4, -}; - -// AVEncMPVLevel (UINT32) <---- You have GUID in the doc -DEFINE_CODECAPI_GUID( AVEncMPVLevel, "6ee40c40-a60c-41ef-8f50-37c2249e2cb3", 0x6ee40c40, 0xa60c, 0x41ef, 0x8f, 0x50, 0x37, 0xc2, 0x24, 0x9e, 0x2c, 0xb3 ) - -enum eAVEncMPVLevel -{ - eAVEncMPVLevel_Low = 1, - eAVEncMPVLevel_Main = 2, - eAVEncMPVLevel_High1440 = 3, - eAVEncMPVLevel_High = 4, -}; - - -enum eAVEncH264VProfile -{ - eAVEncH264VProfile_unknown = 0, - eAVEncH264VProfile_Simple = 66, - eAVEncH264VProfile_Base = 66, - eAVEncH264VProfile_Main = 77, - eAVEncH264VProfile_High = 100, - eAVEncH264VProfile_422 = 122, - eAVEncH264VProfile_High10 = 110, - eAVEncH264VProfile_444 = 144, - eAVEncH264VProfile_Extended = 88 -}; - -#define AVENC_H264V_LEVELCOUNT 16 -#define AVENC_H264V_MAX_MBBITS 3200 //Only applies to Baseline, Main, Extended profiles - -enum eAVEncH264VLevel -{ - eAVEncH264VLevel1 = 10, - eAVEncH264VLevel1_b = 11, - eAVEncH264VLevel1_1 = 11, - eAVEncH264VLevel1_2 = 12, - eAVEncH264VLevel1_3 = 13, - eAVEncH264VLevel2 = 20, - eAVEncH264VLevel2_1 = 21, - eAVEncH264VLevel2_2 = 22, - eAVEncH264VLevel3 = 30, - eAVEncH264VLevel3_1 = 31, - eAVEncH264VLevel3_2 = 32, - eAVEncH264VLevel4 = 40, - eAVEncH264VLevel4_1 = 41, - eAVEncH264VLevel4_2 = 42, - eAVEncH264VLevel5 = 50, - eAVEncH264VLevel5_1 = 51 -}; - -// AVEncMPVFrameFieldMode (UINT32) -DEFINE_CODECAPI_GUID( AVEncMPVFrameFieldMode, "acb5de96-7b93-4c2f-8825-b0295fa93bf4", 0xacb5de96, 0x7b93, 0x4c2f, 0x88, 0x25, 0xb0, 0x29, 0x5f, 0xa9, 0x3b, 0xf4 ) - -enum eAVEncMPVFrameFieldMode -{ - eAVEncMPVFrameFieldMode_FieldMode = 0, - eAVEncMPVFrameFieldMode_FrameMode = 1 -}; - -// -// Advanced MPV Encoder Specific Parameters -// - -// AVEncMPVAddSeqEndCode (BOOL) -DEFINE_CODECAPI_GUID( AVEncMPVAddSeqEndCode, "a823178f-57df-4c7a-b8fd-e5ec8887708d", 0xa823178f, 0x57df, 0x4c7a, 0xb8, 0xfd, 0xe5, 0xec, 0x88, 0x87, 0x70, 0x8d ) - -// AVEncMPVGOPSInSeq (UINT32) -DEFINE_CODECAPI_GUID( AVEncMPVGOPSInSeq, "993410d4-2691-4192-9978-98dc2603669f", 0x993410d4, 0x2691, 0x4192, 0x99, 0x78, 0x98, 0xdc, 0x26, 0x03, 0x66, 0x9f ) - -// AVEncMPVUseConcealmentMotionVectors (BOOL) -DEFINE_CODECAPI_GUID( AVEncMPVUseConcealmentMotionVectors, "ec770cf3-6908-4b4b-aa30-7fb986214fea", 0xec770cf3, 0x6908, 0x4b4b, 0xaa, 0x30, 0x7f, 0xb9, 0x86, 0x21, 0x4f, 0xea ) - -// AVEncMPVSceneDetection (UINT32) -DEFINE_CODECAPI_GUID( AVEncMPVSceneDetection, "552799f1-db4c-405b-8a3a-c93f2d0674dc", 0x552799f1, 0xdb4c, 0x405b, 0x8a, 0x3a, 0xc9, 0x3f, 0x2d, 0x06, 0x74, 0xdc ) - -enum eAVEncMPVSceneDetection -{ - eAVEncMPVSceneDetection_None = 0, - eAVEncMPVSceneDetection_InsertIPicture = 1, - eAVEncMPVSceneDetection_StartNewGOP = 2, - eAVEncMPVSceneDetection_StartNewLocatableGOP = 3 -}; - -// AVEncMPVGenerateHeaderSeqExt (BOOL) -DEFINE_CODECAPI_GUID( AVEncMPVGenerateHeaderSeqExt, "d5e78611-082d-4e6b-98af-0f51ab139222", 0xd5e78611, 0x082d, 0x4e6b, 0x98, 0xaf, 0x0f, 0x51, 0xab, 0x13, 0x92, 0x22 ) - -// AVEncMPVGenerateHeaderSeqDispExt (BOOL) -DEFINE_CODECAPI_GUID( AVEncMPVGenerateHeaderSeqDispExt, "6437aa6f-5a3c-4de9-8a16-53d9c4ad326f", 0x6437aa6f, 0x5a3c, 0x4de9, 0x8a, 0x16, 0x53, 0xd9, 0xc4, 0xad, 0x32, 0x6f ) - -// AVEncMPVGenerateHeaderPicExt (BOOL) -DEFINE_CODECAPI_GUID( AVEncMPVGenerateHeaderPicExt, "1b8464ab-944f-45f0-b74e-3a58dad11f37", 0x1b8464ab, 0x944f, 0x45f0, 0xb7, 0x4e, 0x3a, 0x58, 0xda, 0xd1, 0x1f, 0x37 ) - -// AVEncMPVGenerateHeaderPicDispExt (BOOL) -DEFINE_CODECAPI_GUID( AVEncMPVGenerateHeaderPicDispExt, "c6412f84-c03f-4f40-a00c-4293df8395bb", 0xc6412f84, 0xc03f, 0x4f40, 0xa0, 0x0c, 0x42, 0x93, 0xdf, 0x83, 0x95, 0xbb ) - -// AVEncMPVGenerateHeaderSeqScaleExt (BOOL) -DEFINE_CODECAPI_GUID( AVEncMPVGenerateHeaderSeqScaleExt, "0722d62f-dd59-4a86-9cd5-644f8e2653d8", 0x0722d62f, 0xdd59, 0x4a86, 0x9c, 0xd5, 0x64, 0x4f, 0x8e, 0x26, 0x53, 0xd8 ) - -// AVEncMPVScanPattern (UINT32) -DEFINE_CODECAPI_GUID( AVEncMPVScanPattern, "7f8a478e-7bbb-4ae2-b2fc-96d17fc4a2d6", 0x7f8a478e, 0x7bbb, 0x4ae2, 0xb2, 0xfc, 0x96, 0xd1, 0x7f, 0xc4, 0xa2, 0xd6 ) - -enum eAVEncMPVScanPattern -{ - eAVEncMPVScanPattern_Auto = 0, - eAVEncMPVScanPattern_ZigZagScan = 1, - eAVEncMPVScanPattern_AlternateScan = 2 -}; - -// AVEncMPVIntraDCPrecision (UINT32) -DEFINE_CODECAPI_GUID( AVEncMPVIntraDCPrecision, "a0116151-cbc8-4af3-97dc-d00cceb82d79", 0xa0116151, 0xcbc8, 0x4af3, 0x97, 0xdc, 0xd0, 0x0c, 0xce, 0xb8, 0x2d, 0x79 ) - -// AVEncMPVQScaleType (UINT32) -DEFINE_CODECAPI_GUID( AVEncMPVQScaleType, "2b79ebb7-f484-4af7-bb58-a2a188c5cbbe", 0x2b79ebb7, 0xf484, 0x4af7, 0xbb, 0x58, 0xa2, 0xa1, 0x88, 0xc5, 0xcb, 0xbe ) - -enum eAVEncMPVQScaleType -{ - eAVEncMPVQScaleType_Auto = 0, - eAVEncMPVQScaleType_Linear = 1, - eAVEncMPVQScaleType_NonLinear = 2 -}; - -// AVEncMPVIntraVLCTable (UINT32) -DEFINE_CODECAPI_GUID( AVEncMPVIntraVLCTable, "a2b83ff5-1a99-405a-af95-c5997d558d3a", 0xa2b83ff5, 0x1a99, 0x405a, 0xaf, 0x95, 0xc5, 0x99, 0x7d, 0x55, 0x8d, 0x3a ) - -enum eAVEncMPVIntraVLCTable -{ - eAVEncMPVIntraVLCTable_Auto = 0, - eAVEncMPVIntraVLCTable_MPEG1 = 1, - eAVEncMPVIntraVLCTable_Alternate = 2 -}; - -// AVEncMPVQuantMatrixIntra (BYTE[64] encoded as a string of 128 hex digits) -DEFINE_CODECAPI_GUID( AVEncMPVQuantMatrixIntra, "9bea04f3-6621-442c-8ba1-3ac378979698", 0x9bea04f3, 0x6621, 0x442c, 0x8b, 0xa1, 0x3a, 0xc3, 0x78, 0x97, 0x96, 0x98 ) - -// AVEncMPVQuantMatrixNonIntra (BYTE[64] encoded as a string of 128 hex digits) -DEFINE_CODECAPI_GUID( AVEncMPVQuantMatrixNonIntra, "87f441d8-0997-4beb-a08e-8573d409cf75", 0x87f441d8, 0x0997, 0x4beb, 0xa0, 0x8e, 0x85, 0x73, 0xd4, 0x09, 0xcf, 0x75 ) - -// AVEncMPVQuantMatrixChromaIntra (BYTE[64] encoded as a string of 128 hex digits) -DEFINE_CODECAPI_GUID( AVEncMPVQuantMatrixChromaIntra, "9eb9ecd4-018d-4ffd-8f2d-39e49f07b17a", 0x9eb9ecd4, 0x018d, 0x4ffd, 0x8f, 0x2d, 0x39, 0xe4, 0x9f, 0x07, 0xb1, 0x7a ) - -// AVEncMPVQuantMatrixChromaNonIntra (BYTE[64] encoded as a string of 128 hex digits) -DEFINE_CODECAPI_GUID( AVEncMPVQuantMatrixChromaNonIntra, "1415b6b1-362a-4338-ba9a-1ef58703c05b", 0x1415b6b1, 0x362a, 0x4338, 0xba, 0x9a, 0x1e, 0xf5, 0x87, 0x03, 0xc0, 0x5b ) - -// -// MPEG1 Audio Encoding Interface -// - -// -// MPEG1 Audio Specific Parameters -// - -// AVEncMPALayer (UINT) -DEFINE_CODECAPI_GUID( AVEncMPALayer, "9d377230-f91b-453d-9ce0-78445414c22d", 0x9d377230, 0xf91b, 0x453d, 0x9c, 0xe0, 0x78, 0x44, 0x54, 0x14, 0xc2, 0x2d ) - -enum eAVEncMPALayer -{ - eAVEncMPALayer_1 = 1, - eAVEncMPALayer_2 = 2, - eAVEncMPALayer_3 = 3 -}; - -// AVEncMPACodingMode (UINT) -DEFINE_CODECAPI_GUID( AVEncMPACodingMode, "b16ade03-4b93-43d7-a550-90b4fe224537", 0xb16ade03, 0x4b93, 0x43d7, 0xa5, 0x50, 0x90, 0xb4, 0xfe, 0x22, 0x45, 0x37 ) - -enum eAVEncMPACodingMode -{ - eAVEncMPACodingMode_Mono = 0, - eAVEncMPACodingMode_Stereo = 1, - eAVEncMPACodingMode_DualChannel = 2, - eAVEncMPACodingMode_JointStereo = 3, - eAVEncMPACodingMode_Surround = 4 -}; - -// AVEncMPACopyright (BOOL) - default state to encode into the stream (may be overridden by input) -// 1 (true) - copyright protected -// 0 (false) - not copyright protected -DEFINE_CODECAPI_GUID( AVEncMPACopyright, "a6ae762a-d0a9-4454-b8ef-f2dbeefdd3bd", 0xa6ae762a, 0xd0a9, 0x4454, 0xb8, 0xef, 0xf2, 0xdb, 0xee, 0xfd, 0xd3, 0xbd ) - -// AVEncMPAOriginalBitstream (BOOL) - default value to encode into the stream (may be overridden by input) -// 1 (true) - for original bitstream -// 0 (false) - for copy bitstream -DEFINE_CODECAPI_GUID( AVEncMPAOriginalBitstream, "3cfb7855-9cc9-47ff-b829-b36786c92346", 0x3cfb7855, 0x9cc9, 0x47ff, 0xb8, 0x29, 0xb3, 0x67, 0x86, 0xc9, 0x23, 0x46 ) - -// AVEncMPAEnableRedundancyProtection (BOOL) -// 1 (true) - Redundancy should be added to facilitate error detection and concealment (CRC) -// 0 (false) - No redundancy should be added -DEFINE_CODECAPI_GUID( AVEncMPAEnableRedundancyProtection, "5e54b09e-b2e7-4973-a89b-0b3650a3beda", 0x5e54b09e, 0xb2e7, 0x4973, 0xa8, 0x9b, 0x0b, 0x36, 0x50, 0xa3, 0xbe, 0xda ) - -// AVEncMPAPrivateUserBit (UINT) - User data bit value to encode in the stream -DEFINE_CODECAPI_GUID( AVEncMPAPrivateUserBit, "afa505ce-c1e3-4e3d-851b-61b700e5e6cc", 0xafa505ce, 0xc1e3, 0x4e3d, 0x85, 0x1b, 0x61, 0xb7, 0x00, 0xe5, 0xe6, 0xcc ) - -// AVEncMPAEmphasisType (UINT) -// Indicates type of de-emphasis filter to be used -DEFINE_CODECAPI_GUID( AVEncMPAEmphasisType, "2d59fcda-bf4e-4ed6-b5df-5b03b36b0a1f", 0x2d59fcda, 0xbf4e, 0x4ed6, 0xb5, 0xdf, 0x5b, 0x03, 0xb3, 0x6b, 0x0a, 0x1f ) - -enum eAVEncMPAEmphasisType -{ - eAVEncMPAEmphasisType_None = 0, - eAVEncMPAEmphasisType_50_15 = 1, - eAVEncMPAEmphasisType_Reserved = 2, - eAVEncMPAEmphasisType_CCITT_J17 = 3, -}; - -// -// Dolby Digital(TM) Audio Encoding Interface -// - -// -// Dolby Digital(TM) Audio Specific Parameters -// - -// AVEncDDService (UINT) -DEFINE_CODECAPI_GUID( AVEncDDService, "d2e1bec7-5172-4d2a-a50e-2f3b82b1ddf8", 0xd2e1bec7, 0x5172, 0x4d2a, 0xa5, 0x0e, 0x2f, 0x3b, 0x82, 0xb1, 0xdd, 0xf8 ) - -enum eAVEncDDService -{ - eAVEncDDService_CM = 0, // (Main Service: Complete Main) - eAVEncDDService_ME = 1, // (Main Service: Music and Effects (ME)) - eAVEncDDService_VI = 2, // (Associated Service: Visually-Impaired (VI) - eAVEncDDService_HI = 3, // (Associated Service: Hearing-Impaired (HI)) - eAVEncDDService_D = 4, // (Associated Service: Dialog (D)) - eAVEncDDService_C = 5, // (Associated Service: Commentary (C)) - eAVEncDDService_E = 6, // (Associated Service: Emergency (E)) - eAVEncDDService_VO = 7 // (Associated Service: Voice Over (VO) / Karaoke) -}; - -// AVEncDDDialogNormalization (UINT32) -DEFINE_CODECAPI_GUID( AVEncDDDialogNormalization, "d7055acf-f125-437d-a704-79c79f0404a8", 0xd7055acf, 0xf125, 0x437d, 0xa7, 0x04, 0x79, 0xc7, 0x9f, 0x04, 0x04, 0xa8 ) - -// AVEncDDCentreDownMixLevel (UINT32) -DEFINE_CODECAPI_GUID( AVEncDDCentreDownMixLevel, "e285072c-c958-4a81-afd2-e5e0daf1b148", 0xe285072c, 0xc958, 0x4a81, 0xaf, 0xd2, 0xe5, 0xe0, 0xda, 0xf1, 0xb1, 0x48 ) - -// AVEncDDSurroundDownMixLevel (UINT32) -DEFINE_CODECAPI_GUID( AVEncDDSurroundDownMixLevel, "7b20d6e5-0bcf-4273-a487-506b047997e9", 0x7b20d6e5, 0x0bcf, 0x4273, 0xa4, 0x87, 0x50, 0x6b, 0x04, 0x79, 0x97, 0xe9 ) - -// AVEncDDProductionInfoExists (BOOL) -DEFINE_CODECAPI_GUID( AVEncDDProductionInfoExists, "b0b7fe5f-b6ab-4f40-964d-8d91f17c19e8", 0xb0b7fe5f, 0xb6ab, 0x4f40, 0x96, 0x4d, 0x8d, 0x91, 0xf1, 0x7c, 0x19, 0xe8 ) - -// AVEncDDProductionRoomType (UINT32) -DEFINE_CODECAPI_GUID( AVEncDDProductionRoomType, "dad7ad60-23d8-4ab7-a284-556986d8a6fe", 0xdad7ad60, 0x23d8, 0x4ab7, 0xa2, 0x84, 0x55, 0x69, 0x86, 0xd8, 0xa6, 0xfe ) - -enum eAVEncDDProductionRoomType -{ - eAVEncDDProductionRoomType_NotIndicated = 0, - eAVEncDDProductionRoomType_Large = 1, - eAVEncDDProductionRoomType_Small = 2 -}; - -// AVEncDDProductionMixLevel (UINT32) -DEFINE_CODECAPI_GUID( AVEncDDProductionMixLevel, "301d103a-cbf9-4776-8899-7c15b461ab26", 0x301d103a, 0xcbf9, 0x4776, 0x88, 0x99, 0x7c, 0x15, 0xb4, 0x61, 0xab, 0x26 ) - -// AVEncDDCopyright (BOOL) -DEFINE_CODECAPI_GUID( AVEncDDCopyright, "8694f076-cd75-481d-a5c6-a904dcc828f0", 0x8694f076, 0xcd75, 0x481d, 0xa5, 0xc6, 0xa9, 0x04, 0xdc, 0xc8, 0x28, 0xf0 ) - -// AVEncDDOriginalBitstream (BOOL) -DEFINE_CODECAPI_GUID( AVEncDDOriginalBitstream, "966ae800-5bd3-4ff9-95b9-d30566273856", 0x966ae800, 0x5bd3, 0x4ff9, 0x95, 0xb9, 0xd3, 0x05, 0x66, 0x27, 0x38, 0x56 ) - -// AVEncDDDigitalDeemphasis (BOOL) -DEFINE_CODECAPI_GUID( AVEncDDDigitalDeemphasis, "e024a2c2-947c-45ac-87d8-f1030c5c0082", 0xe024a2c2, 0x947c, 0x45ac, 0x87, 0xd8, 0xf1, 0x03, 0x0c, 0x5c, 0x00, 0x82 ) - -// AVEncDDDCHighPassFilter (BOOL) -DEFINE_CODECAPI_GUID( AVEncDDDCHighPassFilter, "9565239f-861c-4ac8-bfda-e00cb4db8548", 0x9565239f, 0x861c, 0x4ac8, 0xbf, 0xda, 0xe0, 0x0c, 0xb4, 0xdb, 0x85, 0x48 ) - -// AVEncDDChannelBWLowPassFilter (BOOL) -DEFINE_CODECAPI_GUID( AVEncDDChannelBWLowPassFilter, "e197821d-d2e7-43e2-ad2c-00582f518545", 0xe197821d, 0xd2e7, 0x43e2, 0xad, 0x2c, 0x00, 0x58, 0x2f, 0x51, 0x85, 0x45 ) - -// AVEncDDLFELowPassFilter (BOOL) -DEFINE_CODECAPI_GUID( AVEncDDLFELowPassFilter, "d3b80f6f-9d15-45e5-91be-019c3fab1f01", 0xd3b80f6f, 0x9d15, 0x45e5, 0x91, 0xbe, 0x01, 0x9c, 0x3f, 0xab, 0x1f, 0x01 ) - -// AVEncDDSurround90DegreeePhaseShift (BOOL) -DEFINE_CODECAPI_GUID( AVEncDDSurround90DegreeePhaseShift, "25ecec9d-3553-42c0-bb56-d25792104f80", 0x25ecec9d, 0x3553, 0x42c0, 0xbb, 0x56, 0xd2, 0x57, 0x92, 0x10, 0x4f, 0x80 ) - -// AVEncDDSurround3dBAttenuation (BOOL) -DEFINE_CODECAPI_GUID( AVEncDDSurround3dBAttenuation, "4d43b99d-31e2-48b9-bf2e-5cbf1a572784", 0x4d43b99d, 0x31e2, 0x48b9, 0xbf, 0x2e, 0x5c, 0xbf, 0x1a, 0x57, 0x27, 0x84 ) - -// AVEncDDDynamicRangeCompressionControl (UINT32) -DEFINE_CODECAPI_GUID( AVEncDDDynamicRangeCompressionControl, "cfc2ff6d-79b8-4b8d-a8aa-a0c9bd1c2940", 0xcfc2ff6d, 0x79b8, 0x4b8d, 0xa8, 0xaa, 0xa0, 0xc9, 0xbd, 0x1c, 0x29, 0x40 ) - -enum eAVEncDDDynamicRangeCompressionControl -{ - eAVEncDDDynamicRangeCompressionControl_None = 0, - eAVEncDDDynamicRangeCompressionControl_FilmStandard = 1, - eAVEncDDDynamicRangeCompressionControl_FilmLight = 2, - eAVEncDDDynamicRangeCompressionControl_MusicStandard = 3, - eAVEncDDDynamicRangeCompressionControl_MusicLight = 4, - eAVEncDDDynamicRangeCompressionControl_Speech = 5 -}; - -// AVEncDDRFPreEmphasisFilter (BOOL) -DEFINE_CODECAPI_GUID( AVEncDDRFPreEmphasisFilter, "21af44c0-244e-4f3d-a2cc-3d3068b2e73f", 0x21af44c0, 0x244e, 0x4f3d, 0xa2, 0xcc, 0x3d, 0x30, 0x68, 0xb2, 0xe7, 0x3f ) - -// AVEncDDSurroundExMode (UINT32) -DEFINE_CODECAPI_GUID( AVEncDDSurroundExMode, "91607cee-dbdd-4eb6-bca2-aadfafa3dd68", 0x91607cee, 0xdbdd, 0x4eb6, 0xbc, 0xa2, 0xaa, 0xdf, 0xaf, 0xa3, 0xdd, 0x68 ) - -enum eAVEncDDSurroundExMode -{ - eAVEncDDSurroundExMode_NotIndicated = 0, - eAVEncDDSurroundExMode_No = 1, - eAVEncDDSurroundExMode_Yes = 2 -}; - -// AVEncDDPreferredStereoDownMixMode (UINT32) -DEFINE_CODECAPI_GUID( AVEncDDPreferredStereoDownMixMode, "7f4e6b31-9185-403d-b0a2-763743e6f063", 0x7f4e6b31, 0x9185, 0x403d, 0xb0, 0xa2, 0x76, 0x37, 0x43, 0xe6, 0xf0, 0x63 ) - -enum eAVEncDDPreferredStereoDownMixMode -{ - eAVEncDDPreferredStereoDownMixMode_LtRt = 0, - eAVEncDDPreferredStereoDownMixMode_LoRo = 1 -}; - -// AVEncDDLtRtCenterMixLvl_x10 (INT32) -DEFINE_CODECAPI_GUID( AVEncDDLtRtCenterMixLvl_x10, "dca128a2-491f-4600-b2da-76e3344b4197", 0xdca128a2, 0x491f, 0x4600, 0xb2, 0xda, 0x76, 0xe3, 0x34, 0x4b, 0x41, 0x97 ) - -// AVEncDDLtRtSurroundMixLvl_x10 (INT32) -DEFINE_CODECAPI_GUID( AVEncDDLtRtSurroundMixLvl_x10, "212246c7-3d2c-4dfa-bc21-652a9098690d", 0x212246c7, 0x3d2c, 0x4dfa, 0xbc, 0x21, 0x65, 0x2a, 0x90, 0x98, 0x69, 0x0d ) - -// AVEncDDLoRoCenterMixLvl (INT32) -DEFINE_CODECAPI_GUID( AVEncDDLoRoCenterMixLvl_x10, "1cfba222-25b3-4bf4-9bfd-e7111267858c", 0x1cfba222, 0x25b3, 0x4bf4, 0x9b, 0xfd, 0xe7, 0x11, 0x12, 0x67, 0x85, 0x8c ) - -// AVEncDDLoRoSurroundMixLvl_x10 (INT32) -DEFINE_CODECAPI_GUID( AVEncDDLoRoSurroundMixLvl_x10, "e725cff6-eb56-40c7-8450-2b9367e91555", 0xe725cff6, 0xeb56, 0x40c7, 0x84, 0x50, 0x2b, 0x93, 0x67, 0xe9, 0x15, 0x55 ) - -// AVEncDDAtoDConverterType (UINT32) -DEFINE_CODECAPI_GUID( AVEncDDAtoDConverterType, "719f9612-81a1-47e0-9a05-d94ad5fca948", 0x719f9612, 0x81a1, 0x47e0, 0x9a, 0x05, 0xd9, 0x4a, 0xd5, 0xfc, 0xa9, 0x48 ) - -enum eAVEncDDAtoDConverterType -{ - eAVEncDDAtoDConverterType_Standard = 0, - eAVEncDDAtoDConverterType_HDCD = 1 -}; - -// AVEncDDHeadphoneMode (UINT32) -DEFINE_CODECAPI_GUID( AVEncDDHeadphoneMode, "4052dbec-52f5-42f5-9b00-d134b1341b9d", 0x4052dbec, 0x52f5, 0x42f5, 0x9b, 0x00, 0xd1, 0x34, 0xb1, 0x34, 0x1b, 0x9d ) - -enum eAVEncDDHeadphoneMode -{ - eAVEncDDHeadphoneMode_NotIndicated = 0, - eAVEncDDHeadphoneMode_NotEncoded = 1, - eAVEncDDHeadphoneMode_Encoded = 2 -}; - -// -// WMV Video Encoding Interface -// - -// -// WMV Video Specific Parameters -// - -// AVEncWMVKeyFrameDistance (UINT32) -DEFINE_CODECAPI_GUID( AVEncWMVKeyFrameDistance, "5569055e-e268-4771-b83e-9555ea28aed3", 0x5569055e, 0xe268, 0x4771, 0xb8, 0x3e, 0x95, 0x55, 0xea, 0x28, 0xae, 0xd3 ) - -// AVEncWMVInterlacedEncoding (UINT32) -DEFINE_CODECAPI_GUID( AVEncWMVInterlacedEncoding, "e3d00f8a-c6f5-4e14-a588-0ec87a726f9b", 0xe3d00f8a, 0xc6f5, 0x4e14, 0xa5, 0x88, 0x0e, 0xc8, 0x7a, 0x72, 0x6f, 0x9b ) - -// AVEncWMVDecoderComplexity (UINT32) -DEFINE_CODECAPI_GUID( AVEncWMVDecoderComplexity, "f32c0dab-f3cb-4217-b79f-8762768b5f67", 0xf32c0dab, 0xf3cb, 0x4217, 0xb7, 0x9f, 0x87, 0x62, 0x76, 0x8b, 0x5f, 0x67 ) - -// AVEncWMVHasKeyFrameBufferLevelMarker (BOOL) -DEFINE_CODECAPI_GUID( AVEncWMVKeyFrameBufferLevelMarker, "51ff1115-33ac-426c-a1b1-09321bdf96b4", 0x51ff1115, 0x33ac, 0x426c, 0xa1, 0xb1, 0x09, 0x32, 0x1b, 0xdf, 0x96, 0xb4 ) - -// AVEncWMVProduceDummyFrames (UINT32) -DEFINE_CODECAPI_GUID( AVEncWMVProduceDummyFrames, "d669d001-183c-42e3-a3ca-2f4586d2396c", 0xd669d001, 0x183c, 0x42e3, 0xa3, 0xca, 0x2f, 0x45, 0x86, 0xd2, 0x39, 0x6c ) - -// -// WMV Post-Encode Statistical Parameters -// - -// AVEncStatWMVCBAvg (UINT32/UINT32) -DEFINE_CODECAPI_GUID( AVEncStatWMVCBAvg, "6aa6229f-d602-4b9d-b68c-c1ad78884bef", 0x6aa6229f, 0xd602, 0x4b9d, 0xb6, 0x8c, 0xc1, 0xad, 0x78, 0x88, 0x4b, 0xef ) - -// AVEncStatWMVCBMax (UINT32/UINT32) -DEFINE_CODECAPI_GUID( AVEncStatWMVCBMax, "e976bef8-00fe-44b4-b625-8f238bc03499", 0xe976bef8, 0x00fe, 0x44b4, 0xb6, 0x25, 0x8f, 0x23, 0x8b, 0xc0, 0x34, 0x99 ) - -// AVEncStatWMVDecoderComplexityProfile (UINT32) -DEFINE_CODECAPI_GUID( AVEncStatWMVDecoderComplexityProfile, "89e69fc3-0f9b-436c-974a-df821227c90d", 0x89e69fc3, 0x0f9b, 0x436c, 0x97, 0x4a, 0xdf, 0x82, 0x12, 0x27, 0xc9, 0x0d ) - -// AVEncStatMPVSkippedEmptyFrames (UINT32) -DEFINE_CODECAPI_GUID( AVEncStatMPVSkippedEmptyFrames, "32195fd3-590d-4812-a7ed-6d639a1f9711", 0x32195fd3, 0x590d, 0x4812, 0xa7, 0xed, 0x6d, 0x63, 0x9a, 0x1f, 0x97, 0x11 ) - -// -// MPEG1/2 Multiplexer Interfaces -// - -// -// MPEG1/2 Packetizer Interface -// - -// Shared with Mux: -// AVEncMP12MuxEarliestPTS (UINT32) -// AVEncMP12MuxLargestPacketSize (UINT32) -// AVEncMP12MuxSysSTDBufferBound (UINT32) - -// AVEncMP12PktzSTDBuffer (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12PktzSTDBuffer, "0b751bd0-819e-478c-9435-75208926b377", 0x0b751bd0, 0x819e, 0x478c, 0x94, 0x35, 0x75, 0x20, 0x89, 0x26, 0xb3, 0x77 ) - -// AVEncMP12PktzStreamID (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12PktzStreamID, "c834d038-f5e8-4408-9b60-88f36493fedf", 0xc834d038, 0xf5e8, 0x4408, 0x9b, 0x60, 0x88, 0xf3, 0x64, 0x93, 0xfe, 0xdf ) - -// AVEncMP12PktzInitialPTS (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12PktzInitialPTS, "2a4f2065-9a63-4d20-ae22-0a1bc896a315", 0x2a4f2065, 0x9a63, 0x4d20, 0xae, 0x22, 0x0a, 0x1b, 0xc8, 0x96, 0xa3, 0x15 ) - -// AVEncMP12PktzPacketSize (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12PktzPacketSize, "ab71347a-1332-4dde-a0e5-ccf7da8a0f22", 0xab71347a, 0x1332, 0x4dde, 0xa0, 0xe5, 0xcc, 0xf7, 0xda, 0x8a, 0x0f, 0x22 ) - -// AVEncMP12PktzCopyright (BOOL) -DEFINE_CODECAPI_GUID( AVEncMP12PktzCopyright, "c8f4b0c1-094c-43c7-8e68-a595405a6ef8", 0xc8f4b0c1, 0x094c, 0x43c7, 0x8e, 0x68, 0xa5, 0x95, 0x40, 0x5a, 0x6e, 0xf8 ) - -// AVEncMP12PktzOriginal (BOOL) -DEFINE_CODECAPI_GUID( AVEncMP12PktzOriginal, "6b178416-31b9-4964-94cb-6bff866cdf83", 0x6b178416, 0x31b9, 0x4964, 0x94, 0xcb, 0x6b, 0xff, 0x86, 0x6c, 0xdf, 0x83 ) - -// -// MPEG1/2 Multiplexer Interface -// - -// AVEncMP12MuxPacketOverhead (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12MuxPacketOverhead, "e40bd720-3955-4453-acf9-b79132a38fa0", 0xe40bd720, 0x3955, 0x4453, 0xac, 0xf9, 0xb7, 0x91, 0x32, 0xa3, 0x8f, 0xa0 ) - -// AVEncMP12MuxNumStreams (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12MuxNumStreams, "f7164a41-dced-4659-a8f2-fb693f2a4cd0", 0xf7164a41, 0xdced, 0x4659, 0xa8, 0xf2, 0xfb, 0x69, 0x3f, 0x2a, 0x4c, 0xd0 ) - -// AVEncMP12MuxEarliestPTS (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12MuxEarliestPTS, "157232b6-f809-474e-9464-a7f93014a817", 0x157232b6, 0xf809, 0x474e, 0x94, 0x64, 0xa7, 0xf9, 0x30, 0x14, 0xa8, 0x17 ) - -// AVEncMP12MuxLargestPacketSize (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12MuxLargestPacketSize, "35ceb711-f461-4b92-a4ef-17b6841ed254", 0x35ceb711, 0xf461, 0x4b92, 0xa4, 0xef, 0x17, 0xb6, 0x84, 0x1e, 0xd2, 0x54 ) - -// AVEncMP12MuxInitialSCR (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12MuxInitialSCR, "3433ad21-1b91-4a0b-b190-2b77063b63a4", 0x3433ad21, 0x1b91, 0x4a0b, 0xb1, 0x90, 0x2b, 0x77, 0x06, 0x3b, 0x63, 0xa4 ) - -// AVEncMP12MuxMuxRate (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12MuxMuxRate, "ee047c72-4bdb-4a9d-8e21-41926c823da7", 0xee047c72, 0x4bdb, 0x4a9d, 0x8e, 0x21, 0x41, 0x92, 0x6c, 0x82, 0x3d, 0xa7 ) - -// AVEncMP12MuxPackSize (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12MuxPackSize, "f916053a-1ce8-4faf-aa0b-ba31c80034b8", 0xf916053a, 0x1ce8, 0x4faf, 0xaa, 0x0b, 0xba, 0x31, 0xc8, 0x00, 0x34, 0xb8 ) - -// AVEncMP12MuxSysSTDBufferBound (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12MuxSysSTDBufferBound, "35746903-b545-43e7-bb35-c5e0a7d5093c", 0x35746903, 0xb545, 0x43e7, 0xbb, 0x35, 0xc5, 0xe0, 0xa7, 0xd5, 0x09, 0x3c ) - -// AVEncMP12MuxSysRateBound (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12MuxSysRateBound, "05f0428a-ee30-489d-ae28-205c72446710", 0x05f0428a, 0xee30, 0x489d, 0xae, 0x28, 0x20, 0x5c, 0x72, 0x44, 0x67, 0x10 ) - -// AVEncMP12MuxTargetPacketizer (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12MuxTargetPacketizer, "d862212a-2015-45dd-9a32-1b3aa88205a0", 0xd862212a, 0x2015, 0x45dd, 0x9a, 0x32, 0x1b, 0x3a, 0xa8, 0x82, 0x05, 0xa0 ) - -// AVEncMP12MuxSysFixed (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12MuxSysFixed, "cefb987e-894f-452e-8f89-a4ef8cec063a", 0xcefb987e, 0x894f, 0x452e, 0x8f, 0x89, 0xa4, 0xef, 0x8c, 0xec, 0x06, 0x3a ) - -// AVEncMP12MuxSysCSPS (UINT32) -DEFINE_CODECAPI_GUID( AVEncMP12MuxSysCSPS, "7952ff45-9c0d-4822-bc82-8ad772e02993", 0x7952ff45, 0x9c0d, 0x4822, 0xbc, 0x82, 0x8a, 0xd7, 0x72, 0xe0, 0x29, 0x93 ) - -// AVEncMP12MuxSysVideoLock (BOOL) -DEFINE_CODECAPI_GUID( AVEncMP12MuxSysVideoLock, "b8296408-2430-4d37-a2a1-95b3e435a91d", 0xb8296408, 0x2430, 0x4d37, 0xa2, 0xa1, 0x95, 0xb3, 0xe4, 0x35, 0xa9, 0x1d ) - -// AVEncMP12MuxSysAudioLock (BOOL) -DEFINE_CODECAPI_GUID( AVEncMP12MuxSysAudioLock, "0fbb5752-1d43-47bf-bd79-f2293d8ce337", 0x0fbb5752, 0x1d43, 0x47bf, 0xbd, 0x79, 0xf2, 0x29, 0x3d, 0x8c, 0xe3, 0x37 ) - -// AVEncMP12MuxDVDNavPacks (BOOL) -DEFINE_CODECAPI_GUID( AVEncMP12MuxDVDNavPacks, "c7607ced-8cf1-4a99-83a1-ee5461be3574", 0xc7607ced, 0x8cf1, 0x4a99, 0x83, 0xa1, 0xee, 0x54, 0x61, 0xbe, 0x35, 0x74 ) - -// -// Decoding Interface -// - - -// format values are GUIDs as VARIANT BSTRs -DEFINE_CODECAPI_GUID( AVDecCommonInputFormat, "E5005239-BD89-4be3-9C0F-5DDE317988CC", 0xe5005239, 0xbd89, 0x4be3, 0x9c, 0x0f, 0x5d, 0xde, 0x31, 0x79, 0x88, 0xcc) -DEFINE_CODECAPI_GUID( AVDecCommonOutputFormat, "3c790028-c0ce-4256-b1a2-1b0fc8b1dcdc", 0x3c790028, 0xc0ce, 0x4256, 0xb1, 0xa2, 0x1b, 0x0f, 0xc8, 0xb1, 0xdc, 0xdc) - -// AVDecCommonMeanBitRate - Mean bitrate in mbits/sec (UINT32) -DEFINE_CODECAPI_GUID( AVDecCommonMeanBitRate, "59488217-007A-4f7a-8E41-5C48B1EAC5C6", 0x59488217, 0x007a, 0x4f7a, 0x8e, 0x41, 0x5c, 0x48, 0xb1, 0xea, 0xc5, 0xc6) -// AVDecCommonMeanBitRateInterval - Mean bitrate interval (in 100ns) (UINT64) -DEFINE_CODECAPI_GUID( AVDecCommonMeanBitRateInterval, "0EE437C6-38A7-4c5c-944C-68AB42116B85", 0x0ee437c6, 0x38a7, 0x4c5c, 0x94, 0x4c, 0x68, 0xab, 0x42, 0x11, 0x6b, 0x85) - -// -// Audio Decoding Interface -// - -// Value GUIDS -// The following 6 GUIDs are values of the AVDecCommonOutputFormat property -// -// Stereo PCM output using matrix-encoded stereo down mix (aka Lt/Rt) -DEFINE_CODECAPI_GUID( GUID_AVDecAudioOutputFormat_PCM_Stereo_MatrixEncoded, "696E1D30-548F-4036-825F-7026C60011BD", 0x696e1d30, 0x548f, 0x4036, 0x82, 0x5f, 0x70, 0x26, 0xc6, 0x00, 0x11, 0xbd) -// -// Regular PCM output (any number of channels) -DEFINE_CODECAPI_GUID( GUID_AVDecAudioOutputFormat_PCM, "696E1D31-548F-4036-825F-7026C60011BD", 0x696e1d31, 0x548f, 0x4036, 0x82, 0x5f, 0x70, 0x26, 0xc6, 0x00, 0x11, 0xbd) -// -// SPDIF PCM (IEC 60958) stereo output. Type of stereo down mix should -// be specified by the application. -DEFINE_CODECAPI_GUID( GUID_AVDecAudioOutputFormat_SPDIF_PCM, "696E1D32-548F-4036-825F-7026C60011BD", 0x696e1d32, 0x548f, 0x4036, 0x82, 0x5f, 0x70, 0x26, 0xc6, 0x00, 0x11, 0xbd) -// -// SPDIF bitstream (IEC 61937) output, such as AC3, MPEG or DTS. -DEFINE_CODECAPI_GUID( GUID_AVDecAudioOutputFormat_SPDIF_Bitstream, "696E1D33-548F-4036-825F-7026C60011BD", 0x696e1d33, 0x548f, 0x4036, 0x82, 0x5f, 0x70, 0x26, 0xc6, 0x00, 0x11, 0xbd) -// -// Stereo PCM output using regular stereo down mix (aka Lo/Ro) -DEFINE_CODECAPI_GUID( GUID_AVDecAudioOutputFormat_PCM_Headphones, "696E1D34-548F-4036-825F-7026C60011BD", 0x696e1d34, 0x548f, 0x4036, 0x82, 0x5f, 0x70, 0x26, 0xc6, 0x00, 0x11, 0xbd) - -// Stereo PCM output using automatic selection of stereo down mix -// mode (Lo/Ro or Lt/Rt). Use this when the input stream includes -// information about the preferred downmix mode (such as Annex D of AC3). -// Default down mix mode should be specified by the application. -DEFINE_CODECAPI_GUID( GUID_AVDecAudioOutputFormat_PCM_Stereo_Auto, "696E1D35-548F-4036-825F-7026C60011BD", 0x696e1d35, 0x548f, 0x4036, 0x82, 0x5f, 0x70, 0x26, 0xc6, 0x00, 0x11, 0xbd) - -// -// Video Decoder properties -// - -// AVDecVideoImageSize (UINT32) - High UINT16 width, low UINT16 height -DEFINE_CODECAPI_GUID( AVDecVideoImageSize, "5EE5747C-6801-4cab-AAF1-6248FA841BA4", 0x5ee5747c, 0x6801, 0x4cab, 0xaa, 0xf1, 0x62, 0x48, 0xfa, 0x84, 0x1b, 0xa4) - -// AVDecVideoPixelAspectRatio (UINT32 as UINT16/UNIT16) - High UINT16 width, low UINT16 height -DEFINE_CODECAPI_GUID( AVDecVideoPixelAspectRatio, "B0CF8245-F32D-41df-B02C-87BD304D12AB", 0xb0cf8245, 0xf32d, 0x41df, 0xb0, 0x2c, 0x87, 0xbd, 0x30, 0x4d, 0x12, 0xab) - -// AVDecVideoInputScanType (UINT32) -DEFINE_CODECAPI_GUID( AVDecVideoInputScanType, "38477E1F-0EA7-42cd-8CD1-130CED57C580", 0x38477e1f, 0x0ea7, 0x42cd, 0x8c, 0xd1, 0x13, 0x0c, 0xed, 0x57, 0xc5, 0x80) -enum eAVDecVideoInputScanType -{ - eAVDecVideoInputScan_Unknown = 0, - eAVDecVideoInputScan_Progressive = 1, - eAVDecVideoInputScan_Interlaced_UpperFieldFirst = 2, - eAVDecVideoInputScan_Interlaced_LowerFieldFirst = 3 -}; - - -// AVDecVideoSWPowerLevel (UINT32) -// Related to video decoder software power saving level in MPEG4 Part 2, VC1 and H264. -// "SW Power Level" will take a range from 0 to 100 to indicate the current power saving level. 0 - Optimize for battery life, 50 - balanced, 100 - Optimize for video quality. -DEFINE_CODECAPI_GUID( AVDecVideoSWPowerLevel, "FB5D2347-4DD8-4509-AED0-DB5FA9AA93F4", 0xfb5d2347, 0x4dd8, 0x4509, 0xae, 0xd0, 0xdb, 0x5f, 0xa9, 0xaa, 0x93, 0xf4) - -enum eAVDecVideoSWPowerLevel -{ - eAVDecVideoSWPowerLevel_BatteryLife = 0, - eAVDecVideoSWPowerLevel_Balanced = 50, - eAVDecVideoSWPowerLevel_VideoQuality = 100 -}; - -// -// Audio Decoder properties -// - - -DEFINE_CODECAPI_GUID( GUID_AVDecAudioInputWMA, "C95E8DCF-4058-4204-8C42-CB24D91E4B9B", 0xc95e8dcf, 0x4058, 0x4204, 0x8c, 0x42, 0xcb, 0x24, 0xd9, 0x1e, 0x4b, 0x9b) -DEFINE_CODECAPI_GUID( GUID_AVDecAudioInputWMAPro, "0128B7C7-DA72-4fe3-BEF8-5C52E3557704", 0x0128b7c7, 0xda72, 0x4fe3, 0xbe, 0xf8, 0x5c, 0x52, 0xe3, 0x55, 0x77, 0x04) -DEFINE_CODECAPI_GUID( GUID_AVDecAudioInputDolby, "8E4228A0-F000-4e0b-8F54-AB8D24AD61A2", 0x8e4228a0, 0xf000, 0x4e0b, 0x8f, 0x54, 0xab, 0x8d, 0x24, 0xad, 0x61, 0xa2) -DEFINE_CODECAPI_GUID( GUID_AVDecAudioInputDTS, "600BC0CA-6A1F-4e91-B241-1BBEB1CB19E0", 0x600bc0ca, 0x6a1f, 0x4e91, 0xb2, 0x41, 0x1b, 0xbe, 0xb1, 0xcb, 0x19, 0xe0) -DEFINE_CODECAPI_GUID( GUID_AVDecAudioInputPCM, "F2421DA5-BBB4-4cd5-A996-933C6B5D1347", 0xf2421da5, 0xbbb4, 0x4cd5, 0xa9, 0x96, 0x93, 0x3c, 0x6b, 0x5d, 0x13, 0x47) -DEFINE_CODECAPI_GUID( GUID_AVDecAudioInputMPEG, "91106F36-02C5-4f75-9719-3B7ABF75E1F6", 0x91106f36, 0x02c5, 0x4f75, 0x97, 0x19, 0x3b, 0x7a, 0xbf, 0x75, 0xe1, 0xf6) -DEFINE_CODECAPI_GUID( GUID_AVDecAudioInputAAC, "97DF7828-B94A-47e2-A4BC-51194DB22A4D", 0x97df7828, 0xb94a, 0x47e2, 0xa4, 0xbc, 0x51, 0x19, 0x4d, 0xb2, 0x2a, 0x4d) -DEFINE_CODECAPI_GUID( GUID_AVDecAudioInputHEAAC, "16EFB4AA-330E-4f5c-98A8-CF6AC55CBE60", 0x16efb4aa, 0x330e, 0x4f5c, 0x98, 0xa8, 0xcf, 0x6a, 0xc5, 0x5c, 0xbe, 0x60) -DEFINE_CODECAPI_GUID( GUID_AVDecAudioInputDolbyDigitalPlus, "0803E185-8F5D-47f5-9908-19A5BBC9FE34", 0x0803e185, 0x8f5d, 0x47f5, 0x99, 0x08, 0x19, 0xa5, 0xbb, 0xc9, 0xfe, 0x34) - -// AVDecAACDownmixMode (UINT32) -// AAC/HE-AAC Decoder uses standard ISO/IEC MPEG-2/MPEG-4 stereo downmix equations or uses -// non-standard downmix. An example of a non standard downmix would be the one defined by ARIB document STD-B21 version 4.4. -DEFINE_CODECAPI_GUID( AVDecAACDownmixMode,"01274475-F6BB-4017-B084-81A763C942D4", 0x1274475, 0xf6bb, 0x4017, 0xb0, 0x84, 0x81, 0xa7, 0x63, 0xc9, 0x42, 0xd4) - -enum eAVDecAACDownmixMode -{ - eAVDecAACUseISODownmix = 0, - eAVDecAACUseARIBDownmix = 1 -}; - -// AVDecHEAACDynamicRangeControl (UINT32) -// Set this property on an AAC/HE-AAC decoder to select whether Dynamic Range Control (DRC) should be applied or not. -// If DRC is ON and the AAC/HE-AAC stream includes extension payload of type EXT_DYNAMIC_RANGE, DRC will be applied. -DEFINE_CODECAPI_GUID( AVDecHEAACDynamicRangeControl, "287C8ABE-69A4-4d39-8080-D3D9712178A0", 0x287c8abe, 0x69a4, 0x4d39, 0x80, 0x80, 0xd3, 0xd9, 0x71, 0x21, 0x78, 0xa0); - -enum eAVDecHEAACDynamicRangeControl -{ - eAVDecHEAACDynamicRangeControl_OFF = 0, - eAVDecHEAACDynamicRangeControl_ON = 1 -}; - - -// AVDecAudioDualMono (UINT32) - Read only -// The input bitstream header might have a field indicating whether the 2-ch bitstream -// is dual mono or not. Use this property to read this field. -// If it's dual mono, the application can set AVDecAudioDualMonoReproMode to determine -// one of 4 reproduction modes -DEFINE_CODECAPI_GUID( AVDecAudioDualMono,"4a52cda8-30f8-4216-be0f-ba0b2025921d", 0x4a52cda8, 0x30f8, 0x4216, 0xbe, 0x0f, 0xba, 0x0b, 0x20, 0x25, 0x92, 0x1d ) - -enum eAVDecAudioDualMono -{ - eAVDecAudioDualMono_IsNotDualMono = 0, // 2-ch bitstream input is not dual mono - eAVDecAudioDualMono_IsDualMono = 1, // 2-ch bitstream input is dual mono - eAVDecAudioDualMono_UnSpecified = 2 // There is no indication in the bitstream -}; - -// AVDecAudioDualMonoReproMode (UINT32) -// Reproduction modes for programs containing two independent mono channels (Ch1 & Ch2). -// In case of 2-ch input, the decoder should get AVDecAudioDualMono to check if the input -// is regular stereo or dual mono. If dual mono, the application can ask the user to set the playback -// mode by setting AVDecAudioDualReproMonoMode. If output is not stereo, use AVDecDDMatrixDecodingMode or -// equivalent. -DEFINE_CODECAPI_GUID( AVDecAudioDualMonoReproMode,"a5106186-cc94-4bc9-8cd9-aa2f61f6807e", 0xa5106186, 0xcc94, 0x4bc9, 0x8c, 0xd9, 0xaa, 0x2f, 0x61, 0xf6, 0x80, 0x7e ) - -enum eAVDecAudioDualMonoReproMode -{ - eAVDecAudioDualMonoReproMode_STEREO = 0, // Ch1+Ch2 for mono output, (Ch1 left, Ch2 right) for stereo output - eAVDecAudioDualMonoReproMode_LEFT_MONO = 1, // Ch1 for mono output, (Ch1 left, Ch1 right) for stereo output - eAVDecAudioDualMonoReproMode_RIGHT_MONO = 2, // Ch2 for mono output, (Ch2 left, Ch2 right) for stereo output - eAVDecAudioDualMonoReproMode_MIX_MONO = 3, // Ch1+Ch2 for mono output, (Ch1+Ch2 left, Ch1+Ch2 right) for stereo output -}; - -// -// Audio Common Properties -// - -// AVAudioChannelCount (UINT32) -// Total number of audio channels, including LFE if it exists. -DEFINE_CODECAPI_GUID( AVAudioChannelCount, "1d3583c4-1583-474e-b71a-5ee463c198e4", 0x1d3583c4, 0x1583, 0x474e, 0xb7, 0x1a, 0x5e, 0xe4, 0x63, 0xc1, 0x98, 0xe4 ) - -// AVAudioChannelConfig (UINT32) -// A bit-wise OR of any number of enum values specified by eAVAudioChannelConfig -DEFINE_CODECAPI_GUID( AVAudioChannelConfig, "17f89cb3-c38d-4368-9ede-63b94d177f9f", 0x17f89cb3, 0xc38d, 0x4368, 0x9e, 0xde, 0x63, 0xb9, 0x4d, 0x17, 0x7f, 0x9f ) - -// Enumerated values for AVAudioChannelConfig are identical -// to the speaker positions defined in ksmedia.h and used -// in WAVE_FORMAT_EXTENSIBLE. Configurations for 5.1 and -// 7.1 channels should be identical to KSAUDIO_SPEAKER_5POINT1_SURROUND -// and KSAUDIO_SPEAKER_7POINT1_SURROUND in ksmedia.h. This means: -// 5.1 ch -> LOW_FREQUENCY | FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | SIDE_LEFT | SIDE_RIGHT -// 7.1 ch -> LOW_FREQUENCY | FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | SIDE_LEFT | SIDE_RIGHT | BACK_LEFT | BACK_RIGHT -// -enum eAVAudioChannelConfig -{ - eAVAudioChannelConfig_FRONT_LEFT = 0x1, - eAVAudioChannelConfig_FRONT_RIGHT = 0x2, - eAVAudioChannelConfig_FRONT_CENTER = 0x4, - eAVAudioChannelConfig_LOW_FREQUENCY = 0x8, // aka LFE - eAVAudioChannelConfig_BACK_LEFT = 0x10, - eAVAudioChannelConfig_BACK_RIGHT = 0x20, - eAVAudioChannelConfig_FRONT_LEFT_OF_CENTER = 0x40, - eAVAudioChannelConfig_FRONT_RIGHT_OF_CENTER = 0x80, - eAVAudioChannelConfig_BACK_CENTER = 0x100, // aka Mono Surround - eAVAudioChannelConfig_SIDE_LEFT = 0x200, // aka Left Surround - eAVAudioChannelConfig_SIDE_RIGHT = 0x400, // aka Right Surround - eAVAudioChannelConfig_TOP_CENTER = 0x800, - eAVAudioChannelConfig_TOP_FRONT_LEFT = 0x1000, - eAVAudioChannelConfig_TOP_FRONT_CENTER = 0x2000, - eAVAudioChannelConfig_TOP_FRONT_RIGHT = 0x4000, - eAVAudioChannelConfig_TOP_BACK_LEFT = 0x8000, - eAVAudioChannelConfig_TOP_BACK_CENTER = 0x10000, - eAVAudioChannelConfig_TOP_BACK_RIGHT = 0x20000 -}; - -// AVAudioSampleRate (UINT32) -// In samples per second (Hz) -DEFINE_CODECAPI_GUID( AVAudioSampleRate, "971d2723-1acb-42e7-855c-520a4b70a5f2", 0x971d2723, 0x1acb, 0x42e7, 0x85, 0x5c, 0x52, 0x0a, 0x4b, 0x70, 0xa5, 0xf2 ) - -// -// Dolby Digital(TM) Audio Specific Parameters -// - -// AVDDSurroundMode (UINT32) common to encoder/decoder -DEFINE_CODECAPI_GUID( AVDDSurroundMode, "99f2f386-98d1-4452-a163-abc78a6eb770", 0x99f2f386, 0x98d1, 0x4452, 0xa1, 0x63, 0xab, 0xc7, 0x8a, 0x6e, 0xb7, 0x70 ) - -enum eAVDDSurroundMode -{ - eAVDDSurroundMode_NotIndicated = 0, - eAVDDSurroundMode_No = 1, - eAVDDSurroundMode_Yes = 2 -}; - -// AVDecDDOperationalMode (UINT32) -DEFINE_CODECAPI_GUID( AVDecDDOperationalMode,"d6d6c6d1-064e-4fdd-a40e-3ecbfcb7ebd0", 0xd6d6c6d1, 0x064e, 0x4fdd, 0xa4, 0x0e, 0x3e, 0xcb, 0xfc, 0xb7, 0xeb, 0xd0 ) - -enum eAVDecDDOperationalMode -{ - eAVDecDDOperationalMode_NONE = 0, - eAVDecDDOperationalMode_LINE = 1,// Dialnorm enabled, dialogue at -31dBFS, dynrng used, high/low scaling allowed - eAVDecDDOperationalMode_RF = 2,// Dialnorm enabled, dialogue at -20dBFS, dynrng & compr used, high/low scaling NOT allowed (always fully compressed) - eAVDecDDOperationalMode_CUSTOM0 = 3,// Analog dialnorm (dialogue normalization not part of the decoder) - eAVDecDDOperationalMode_CUSTOM1 = 4 // Digital dialnorm (dialogue normalization is part of the decoder) -}; - -// AVDecDDMatrixDecodingMode(UINT32) -// A ProLogic decoder has a built-in auto-detection feature. When the Dolby Digital decoder -// is set to the 6-channel output configuration and it is fed a 2/0 bit stream to decode, it can -// do one of the following: -// a) decode the bit stream and output it on the two front channels (eAVDecDDMatrixDecodingMode_OFF), -// b) decode the bit stream followed by ProLogic decoding to create 6-channels (eAVDecDDMatrixDecodingMode_ON). -// c) the decoder will look at the Surround bit ("dsurmod") in the bit stream to determine whether -// apply ProLogic decoding or not (eAVDecDDMatrixDecodingMode_AUTO). -DEFINE_CODECAPI_GUID( AVDecDDMatrixDecodingMode,"ddc811a5-04ed-4bf3-a0ca-d00449f9355f", 0xddc811a5, 0x04ed, 0x4bf3, 0xa0, 0xca, 0xd0, 0x04, 0x49, 0xf9, 0x35, 0x5f ) - -enum eAVDecDDMatrixDecodingMode -{ - eAVDecDDMatrixDecodingMode_OFF = 0, - eAVDecDDMatrixDecodingMode_ON = 1, - eAVDecDDMatrixDecodingMode_AUTO = 2 -}; - -// AVDecDDDynamicRangeScaleHigh (UINT32) -// Indicates what fraction of the dynamic range compression -// to apply. Relevant for negative values of dynrng only. -// Linear range 0-100, where: -// 0 - No dynamic range compression (preserve full dynamic range) -// 100 - Apply full dynamic range compression -DEFINE_CODECAPI_GUID( AVDecDDDynamicRangeScaleHigh,"50196c21-1f33-4af5-b296-11426d6c8789", 0x50196c21, 0x1f33, 0x4af5, 0xb2, 0x96, 0x11, 0x42, 0x6d, 0x6c, 0x87, 0x89 ) - - -// AVDecDDDynamicRangeScaleLow (UINT32) -// Indicates what fraction of the dynamic range compression -// to apply. Relevant for positive values of dynrng only. -// Linear range 0-100, where: -// 0 - No dynamic range compression (preserve full dynamic range) -// 100 - Apply full dynamic range compression -DEFINE_CODECAPI_GUID( AVDecDDDynamicRangeScaleLow,"044e62e4-11a5-42d5-a3b2-3bb2c7c2d7cf", 0x044e62e4, 0x11a5, 0x42d5, 0xa3, 0xb2, 0x3b, 0xb2, 0xc7, 0xc2, 0xd7, 0xcf ) - -// AVDSPLoudnessEqualization (UINT32) -// Related to audio digital signal processing (DSP). -// Apply "Loudness Equalization" to the audio stream, so users will not have to adjust volume control when audio stream changes. -DEFINE_CODECAPI_GUID( AVDSPLoudnessEqualization,"8AFD1A15-1812-4cbf-9319-433A5B2A3B27", 0x8afd1a15, 0x1812, 0x4cbf, 0x93, 0x19, 0x43, 0x3a, 0x5b, 0x2a, 0x3b, 0x27) - -enum eAVDSPLoudnessEqualization -{ - eAVDSPLoudnessEqualization_OFF = 0, - eAVDSPLoudnessEqualization_ON = 1, - eAVDSPLoudnessEqualization_AUTO = 2 -}; - -// AVDSPSpeakerFill (UINT32) -// Related to audio digital signal processing (DSP). -// "Speaker Fill" will take a mono or stereo audio stream and convert it to a multi channel (e.g. 5.1) audio stream. -DEFINE_CODECAPI_GUID( AVDSPSpeakerFill, "5612BCA1-56DA-4582-8DA1-CA8090F92768", 0x5612bca1, 0x56da, 0x4582, 0x8d, 0xa1, 0xca, 0x80, 0x90, 0xf9, 0x27, 0x68) - -enum eAVDSPSpeakerFill -{ - eAVDSPSpeakerFill_OFF = 0, - eAVDSPSpeakerFill_ON = 1, - eAVDSPSpeakerFill_AUTO = 2 -}; - -// AVPriorityControl (UINT32) -// Indicates the task priority when not realtime (0..15) -// Linear range 0-15, where: -// 0 - idle -// 15 - Highest -DEFINE_CODECAPI_GUID( AVPriorityControl,"54ba3dc8-bdde-4329-b187-2018bc5c2ba1", 0x54ba3dc8, 0xbdde, 0x4329, 0xb1, 0x87, 0x20, 0x18, 0xbc, 0x5c, 0x2b, 0xa1 ) - -// AVRealtimeControl (UINT32) -// Indicates the task is realtime or not -// Linear range 0-1, where: -// 0 - no realtime -// 1 - realtime -DEFINE_CODECAPI_GUID( AVRealtimeControl,"6f440632-c4ad-4bf7-9e52-456942b454b0", 0x6f440632, 0xc4ad, 0x4bf7, 0x9e, 0x52, 0x45, 0x69, 0x42, 0xb4, 0x54, 0xb0 ) - -#ifndef UUID_GEN -// { GUID refs - #define CODECAPI_AVEncCommonFormatConstraint DEFINE_CODECAPI_GUIDNAMED( AVEncCommonFormatConstraint ) - #define CODECAPI_GUID_AVEncCommonFormatUnSpecified DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncCommonFormatUnSpecified ) - #define CODECAPI_GUID_AVEncCommonFormatDVD_V DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncCommonFormatDVD_V ) - #define CODECAPI_GUID_AVEncCommonFormatDVD_DashVR DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncCommonFormatDVD_DashVR ) - #define CODECAPI_GUID_AVEncCommonFormatDVD_PlusVR DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncCommonFormatDVD_PlusVR ) - #define CODECAPI_GUID_AVEncCommonFormatVCD DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncCommonFormatVCD ) - #define CODECAPI_GUID_AVEncCommonFormatSVCD DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncCommonFormatSVCD ) - #define CODECAPI_GUID_AVEncCommonFormatATSC DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncCommonFormatATSC ) - #define CODECAPI_GUID_AVEncCommonFormatDVB DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncCommonFormatDVB ) - #define CODECAPI_GUID_AVEncCommonFormatMP3 DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncCommonFormatMP3 ) - #define CODECAPI_GUID_AVEncCommonFormatHighMAT DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncCommonFormatHighMAT ) - #define CODECAPI_GUID_AVEncCommonFormatHighMPV DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncCommonFormatHighMPV ) - #define CODECAPI_AVEncCodecType DEFINE_CODECAPI_GUIDNAMED( AVEncCodecType ) - #define CODECAPI_GUID_AVEncMPEG1Video DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncMPEG1Video ) - #define CODECAPI_GUID_AVEncMPEG2Video DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncMPEG2Video ) - #define CODECAPI_GUID_AVEncMPEG1Audio DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncMPEG1Audio ) - #define CODECAPI_GUID_AVEncMPEG2Audio DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncMPEG2Audio ) - #define CODECAPI_GUID_AVEncWMV DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncWMV ) - #define CODECAPI_GUID_AVEndMPEG4Video DEFINE_CODECAPI_GUIDNAMED( GUID_AVEndMPEG4Video ) - #define CODECAPI_GUID_AVEncH264Video DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncH264Video ) - #define CODECAPI_GUID_AVEncDV DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncDV ) - #define CODECAPI_GUID_AVEncWMAPro DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncWMAPro ) - #define CODECAPI_GUID_AVEncWMALossless DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncWMALossless ) - #define CODECAPI_GUID_AVEncWMAVoice DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncWMAVoice ) - #define CODECAPI_GUID_AVEncDolbyDigitalPro DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncDolbyDigitalPro ) - #define CODECAPI_GUID_AVEncDolbyDigitalConsumer DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncDolbyDigitalConsumer ) - #define CODECAPI_GUID_AVEncDolbyDigitalPlus DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncDolbyDigitalPlus ) - #define CODECAPI_GUID_AVEncDTSHD DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncDTSHD ) - #define CODECAPI_GUID_AVEncDTS DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncDTS ) - #define CODECAPI_GUID_AVEncMLP DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncMLP ) - #define CODECAPI_GUID_AVEncPCM DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncPCM ) - #define CODECAPI_GUID_AVEncSDDS DEFINE_CODECAPI_GUIDNAMED( GUID_AVEncSDDS ) - #define CODECAPI_AVEncCommonRateControlMode DEFINE_CODECAPI_GUIDNAMED( AVEncCommonRateControlMode ) - #define CODECAPI_AVEncCommonLowLatency DEFINE_CODECAPI_GUIDNAMED( AVEncCommonLowLatency ) - #define CODECAPI_AVEncCommonMultipassMode DEFINE_CODECAPI_GUIDNAMED( AVEncCommonMultipassMode ) - #define CODECAPI_AVEncCommonPassStart DEFINE_CODECAPI_GUIDNAMED( AVEncCommonPassStart ) - #define CODECAPI_AVEncCommonPassEnd DEFINE_CODECAPI_GUIDNAMED( AVEncCommonPassEnd ) - #define CODECAPI_AVEncCommonRealTime DEFINE_CODECAPI_GUIDNAMED( AVEncCommonRealTime ) - #define CODECAPI_AVEncCommonQuality DEFINE_CODECAPI_GUIDNAMED( AVEncCommonQuality ) - #define CODECAPI_AVEncCommonQualityVsSpeed DEFINE_CODECAPI_GUIDNAMED( AVEncCommonQualityVsSpeed ) - #define CODECAPI_AVEncCommonMeanBitRate DEFINE_CODECAPI_GUIDNAMED( AVEncCommonMeanBitRate ) - #define CODECAPI_AVEncCommonMeanBitRateInterval DEFINE_CODECAPI_GUIDNAMED( AVEncCommonMeanBitRateInterval ) - #define CODECAPI_AVEncCommonMaxBitRate DEFINE_CODECAPI_GUIDNAMED( AVEncCommonMaxBitRate ) - #define CODECAPI_AVEncCommonMinBitRate DEFINE_CODECAPI_GUIDNAMED( AVEncCommonMinBitRate ) - #define CODECAPI_AVEncCommonBufferSize DEFINE_CODECAPI_GUIDNAMED( AVEncCommonBufferSize ) - #define CODECAPI_AVEncCommonBufferInLevel DEFINE_CODECAPI_GUIDNAMED( AVEncCommonBufferInLevel ) - #define CODECAPI_AVEncCommonBufferOutLevel DEFINE_CODECAPI_GUIDNAMED( AVEncCommonBufferOutLevel ) - #define CODECAPI_AVEncCommonStreamEndHandling DEFINE_CODECAPI_GUIDNAMED( AVEncCommonStreamEndHandling ) - #define CODECAPI_AVEncStatCommonCompletedPasses DEFINE_CODECAPI_GUIDNAMED( AVEncStatCommonCompletedPasses ) - #define CODECAPI_AVEncVideoOutputFrameRate DEFINE_CODECAPI_GUIDNAMED( AVEncVideoOutputFrameRate ) - #define CODECAPI_AVEncVideoOutputFrameRateConversion DEFINE_CODECAPI_GUIDNAMED( AVEncVideoOutputFrameRateConversion ) - #define CODECAPI_AVEncVideoPixelAspectRatio DEFINE_CODECAPI_GUIDNAMED( AVEncVideoPixelAspectRatio ) - #define CODECAPI_AVDecVideoAcceleration_MPEG2 DEFINE_CODECAPI_GUIDNAMED( AVDecVideoAcceleration_MPEG2 ) - #define CODECAPI_AVDecVideoAcceleration_H264 DEFINE_CODECAPI_GUIDNAMED( AVDecVideoAcceleration_H264 ) - #define CODECAPI_AVDecVideoAcceleration_VC1 DEFINE_CODECAPI_GUIDNAMED( AVDecVideoAcceleration_VC1 ) - #define CODECAPI_AVDecVideoProcDeinterlaceCSC DEFINE_CODECAPI_GUIDNAMED( AVDecVideoProcDeinterlaceCSC ) - #define CODECAPI_AVEncVideoForceSourceScanType DEFINE_CODECAPI_GUIDNAMED( AVEncVideoForceSourceScanType ) - #define CODECAPI_AVEncVideoNoOfFieldsToEncode DEFINE_CODECAPI_GUIDNAMED( AVEncVideoNoOfFieldsToEncode ) - #define CODECAPI_AVEncVideoNoOfFieldsToSkip DEFINE_CODECAPI_GUIDNAMED( AVEncVideoNoOfFieldsToSkip ) - #define CODECAPI_AVEncVideoEncodeDimension DEFINE_CODECAPI_GUIDNAMED( AVEncVideoEncodeDimension ) - #define CODECAPI_AVEncVideoEncodeOffsetOrigin DEFINE_CODECAPI_GUIDNAMED( AVEncVideoEncodeOffsetOrigin ) - #define CODECAPI_AVEncVideoDisplayDimension DEFINE_CODECAPI_GUIDNAMED( AVEncVideoDisplayDimension ) - #define CODECAPI_AVEncVideoOutputScanType DEFINE_CODECAPI_GUIDNAMED( AVEncVideoOutputScanType ) - #define CODECAPI_AVEncVideoInverseTelecineEnable DEFINE_CODECAPI_GUIDNAMED( AVEncVideoInverseTelecineEnable ) - #define CODECAPI_AVEncVideoInverseTelecineThreshold DEFINE_CODECAPI_GUIDNAMED( AVEncVideoInverseTelecineThreshold ) - #define CODECAPI_AVEncVideoSourceFilmContent DEFINE_CODECAPI_GUIDNAMED( AVEncVideoSourceFilmContent ) - #define CODECAPI_AVEncVideoSourceIsBW DEFINE_CODECAPI_GUIDNAMED( AVEncVideoSourceIsBW ) - #define CODECAPI_AVEncVideoFieldSwap DEFINE_CODECAPI_GUIDNAMED( AVEncVideoFieldSwap ) - #define CODECAPI_AVEncVideoInputChromaResolution DEFINE_CODECAPI_GUIDNAMED( AVEncVideoInputChromaResolution ) - #define CODECAPI_AVEncVideoOutputChromaResolution DEFINE_CODECAPI_GUIDNAMED( AVEncVideoOutputChromaResolution ) - #define CODECAPI_AVEncVideoInputChromaSubsampling DEFINE_CODECAPI_GUIDNAMED( AVEncVideoInputChromaSubsampling ) - #define CODECAPI_AVEncVideoOutputChromaSubsampling DEFINE_CODECAPI_GUIDNAMED( AVEncVideoOutputChromaSubsampling ) - #define CODECAPI_AVEncVideoInputColorPrimaries DEFINE_CODECAPI_GUIDNAMED( AVEncVideoInputColorPrimaries ) - #define CODECAPI_AVEncVideoOutputColorPrimaries DEFINE_CODECAPI_GUIDNAMED( AVEncVideoOutputColorPrimaries ) - #define CODECAPI_AVEncVideoInputColorTransferFunction DEFINE_CODECAPI_GUIDNAMED( AVEncVideoInputColorTransferFunction ) - #define CODECAPI_AVEncVideoOutputColorTransferFunction DEFINE_CODECAPI_GUIDNAMED( AVEncVideoOutputColorTransferFunction ) - #define CODECAPI_AVEncVideoInputColorTransferMatrix DEFINE_CODECAPI_GUIDNAMED( AVEncVideoInputColorTransferMatrix ) - #define CODECAPI_AVEncVideoOutputColorTransferMatrix DEFINE_CODECAPI_GUIDNAMED( AVEncVideoOutputColorTransferMatrix ) - #define CODECAPI_AVEncVideoInputColorLighting DEFINE_CODECAPI_GUIDNAMED( AVEncVideoInputColorLighting ) - #define CODECAPI_AVEncVideoOutputColorLighting DEFINE_CODECAPI_GUIDNAMED( AVEncVideoOutputColorLighting ) - #define CODECAPI_AVEncVideoInputColorNominalRange DEFINE_CODECAPI_GUIDNAMED( AVEncVideoInputColorNominalRange ) - #define CODECAPI_AVEncVideoOutputColorNominalRange DEFINE_CODECAPI_GUIDNAMED( AVEncVideoOutputColorNominalRange ) - #define CODECAPI_AVEncInputVideoSystem DEFINE_CODECAPI_GUIDNAMED( AVEncInputVideoSystem ) - #define CODECAPI_AVEncVideoHeaderDropFrame DEFINE_CODECAPI_GUIDNAMED( AVEncVideoHeaderDropFrame ) - #define CODECAPI_AVEncVideoHeaderHours DEFINE_CODECAPI_GUIDNAMED( AVEncVideoHeaderHours ) - #define CODECAPI_AVEncVideoHeaderMinutes DEFINE_CODECAPI_GUIDNAMED( AVEncVideoHeaderMinutes ) - #define CODECAPI_AVEncVideoHeaderSeconds DEFINE_CODECAPI_GUIDNAMED( AVEncVideoHeaderSeconds ) - #define CODECAPI_AVEncVideoHeaderFrames DEFINE_CODECAPI_GUIDNAMED( AVEncVideoHeaderFrames ) - #define CODECAPI_AVEncVideoDefaultUpperFieldDominant DEFINE_CODECAPI_GUIDNAMED( AVEncVideoDefaultUpperFieldDominant ) - #define CODECAPI_AVEncVideoCBRMotionTradeoff DEFINE_CODECAPI_GUIDNAMED( AVEncVideoCBRMotionTradeoff ) - #define CODECAPI_AVEncVideoCodedVideoAccessUnitSize DEFINE_CODECAPI_GUIDNAMED( AVEncVideoCodedVideoAccessUnitSize ) - #define CODECAPI_AVEncVideoMaxKeyframeDistance DEFINE_CODECAPI_GUIDNAMED( AVEncVideoMaxKeyframeDistance ) - - #define CODECAPI_AVEncMuxOutputStreamType DEFINE_CODECAPI_GUIDNAMED( AVEncMuxOutputStreamType ) - - #define CODECAPI_AVEncStatVideoOutputFrameRate DEFINE_CODECAPI_GUIDNAMED( AVEncStatVideoOutputFrameRate ) - #define CODECAPI_AVEncStatVideoCodedFrames DEFINE_CODECAPI_GUIDNAMED( AVEncStatVideoCodedFrames ) - #define CODECAPI_AVEncStatVideoTotalFrames DEFINE_CODECAPI_GUIDNAMED( AVEncStatVideoTotalFrames ) - #define CODECAPI_AVEncAudioIntervalToEncode DEFINE_CODECAPI_GUIDNAMED( AVEncAudioIntervalToEncode ) - #define CODECAPI_AVEncAudioIntervalToSkip DEFINE_CODECAPI_GUIDNAMED( AVEncAudioIntervalToSkip ) - #define CODECAPI_AVEncAudioDualMono DEFINE_CODECAPI_GUIDNAMED( AVEncAudioDualMono ) - #define CODECAPI_AVEncAudioMeanBitRate DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMeanBitRate ) - - #define CODECAPI_AVEncAudioMapDestChannel0 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel0 ) - #define CODECAPI_AVEncAudioMapDestChannel1 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel1 ) - #define CODECAPI_AVEncAudioMapDestChannel2 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel2 ) - #define CODECAPI_AVEncAudioMapDestChannel3 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel3 ) - #define CODECAPI_AVEncAudioMapDestChannel4 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel4 ) - #define CODECAPI_AVEncAudioMapDestChannel5 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel5 ) - #define CODECAPI_AVEncAudioMapDestChannel6 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel6 ) - #define CODECAPI_AVEncAudioMapDestChannel7 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel7 ) - #define CODECAPI_AVEncAudioMapDestChannel8 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel8 ) - #define CODECAPI_AVEncAudioMapDestChannel9 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel9 ) - #define CODECAPI_AVEncAudioMapDestChannel10 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel10 ) - #define CODECAPI_AVEncAudioMapDestChannel11 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel11 ) - #define CODECAPI_AVEncAudioMapDestChannel12 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel12 ) - #define CODECAPI_AVEncAudioMapDestChannel13 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel13 ) - #define CODECAPI_AVEncAudioMapDestChannel14 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel14 ) - #define CODECAPI_AVEncAudioMapDestChannel15 DEFINE_CODECAPI_GUIDNAMED( AVEncAudioMapDestChannel15 ) - - #define CODECAPI_AVEncAudioInputContent DEFINE_CODECAPI_GUIDNAMED( AVEncAudioInputContent ) - #define CODECAPI_AVEncStatAudioPeakPCMValue DEFINE_CODECAPI_GUIDNAMED( AVEncStatAudioPeakPCMValue ) - #define CODECAPI_AVEncStatAudioAveragePCMValue DEFINE_CODECAPI_GUIDNAMED( AVEncStatAudioAveragePCMValue ) - #define CODECAPI_AVEncStatAudioAverageBPS DEFINE_CODECAPI_GUIDNAMED( AVEncStatAudioAverageBPS ) - #define CODECAPI_AVEncStatAverageBPS DEFINE_CODECAPI_GUIDNAMED( AVEncStatAverageBPS ) - #define CODECAPI_AVEncStatHardwareProcessorUtilitization DEFINE_CODECAPI_GUIDNAMED( AVEncStatHardwareProcessorUtilitization ) - #define CODECAPI_AVEncStatBandwidthProcessorUtilitization DEFINE_CODECAPI_GUIDNAMED( AVEncStatHardwareBandwidthUtilitization ) - #define CODECAPI_AVEncMPVGOPSize DEFINE_CODECAPI_GUIDNAMED( AVEncMPVGOPSize ) - #define CODECAPI_AVEncMPVGOPOpen DEFINE_CODECAPI_GUIDNAMED( AVEncMPVGOPOpen ) - #define CODECAPI_AVEncMPVDefaultBPictureCount DEFINE_CODECAPI_GUIDNAMED( AVEncMPVDefaultBPictureCount ) - #define CODECAPI_AVEncMPVProfile DEFINE_CODECAPI_GUIDNAMED( AVEncMPVProfile ) - #define CODECAPI_AVEncMPVLevel DEFINE_CODECAPI_GUIDNAMED( AVEncMPVLevel ) - #define CODECAPI_AVEncMPVFrameFieldMode DEFINE_CODECAPI_GUIDNAMED( AVEncMPVFrameFieldMode ) - #define CODECAPI_AVEncMPVAddSeqEndCode DEFINE_CODECAPI_GUIDNAMED( AVEncMPVAddSeqEndCode ) - #define CODECAPI_AVEncMPVGOPSInSeq DEFINE_CODECAPI_GUIDNAMED( AVEncMPVGOPSInSeq ) - #define CODECAPI_AVEncMPVUseConcealmentMotionVectors DEFINE_CODECAPI_GUIDNAMED( AVEncMPVUseConcealmentMotionVectors ) - #define CODECAPI_AVEncMPVSceneDetection DEFINE_CODECAPI_GUIDNAMED( AVEncMPVSceneDetection ) - #define CODECAPI_AVEncMPVGenerateHeaderSeqExt DEFINE_CODECAPI_GUIDNAMED( AVEncMPVGenerateHeaderSeqExt ) - #define CODECAPI_AVEncMPVGenerateHeaderSeqDispExt DEFINE_CODECAPI_GUIDNAMED( AVEncMPVGenerateHeaderSeqDispExt ) - #define CODECAPI_AVEncMPVGenerateHeaderPicExt DEFINE_CODECAPI_GUIDNAMED( AVEncMPVGenerateHeaderPicExt ) - #define CODECAPI_AVEncMPVGenerateHeaderPicDispExt DEFINE_CODECAPI_GUIDNAMED( AVEncMPVGenerateHeaderPicDispExt ) - #define CODECAPI_AVEncMPVGenerateHeaderSeqScaleExt DEFINE_CODECAPI_GUIDNAMED( AVEncMPVGenerateHeaderSeqScaleExt ) - #define CODECAPI_AVEncMPVScanPattern DEFINE_CODECAPI_GUIDNAMED( AVEncMPVScanPattern ) - #define CODECAPI_AVEncMPVIntraDCPrecision DEFINE_CODECAPI_GUIDNAMED( AVEncMPVIntraDCPrecision ) - #define CODECAPI_AVEncMPVQScaleType DEFINE_CODECAPI_GUIDNAMED( AVEncMPVQScaleType ) - #define CODECAPI_AVEncMPVIntraVLCTable DEFINE_CODECAPI_GUIDNAMED( AVEncMPVIntraVLCTable ) - #define CODECAPI_AVEncMPVQuantMatrixIntra DEFINE_CODECAPI_GUIDNAMED( AVEncMPVQuantMatrixIntra ) - #define CODECAPI_AVEncMPVQuantMatrixNonIntra DEFINE_CODECAPI_GUIDNAMED( AVEncMPVQuantMatrixNonIntra ) - #define CODECAPI_AVEncMPVQuantMatrixChromaIntra DEFINE_CODECAPI_GUIDNAMED( AVEncMPVQuantMatrixChromaIntra ) - #define CODECAPI_AVEncMPVQuantMatrixChromaNonIntra DEFINE_CODECAPI_GUIDNAMED( AVEncMPVQuantMatrixChromaNonIntra ) - #define CODECAPI_AVEncMPALayer DEFINE_CODECAPI_GUIDNAMED( AVEncMPALayer ) - #define CODECAPI_AVEncMPACodingMode DEFINE_CODECAPI_GUIDNAMED( AVEncMPACodingMode ) - #define CODECAPI_AVEncDDService DEFINE_CODECAPI_GUIDNAMED( AVEncDDService ) - #define CODECAPI_AVEncDDDialogNormalization DEFINE_CODECAPI_GUIDNAMED( AVEncDDDialogNormalization ) - #define CODECAPI_AVEncDDCentreDownMixLevel DEFINE_CODECAPI_GUIDNAMED( AVEncDDCentreDownMixLevel ) - #define CODECAPI_AVEncDDSurroundDownMixLevel DEFINE_CODECAPI_GUIDNAMED( AVEncDDSurroundDownMixLevel ) - #define CODECAPI_AVEncDDProductionInfoExists DEFINE_CODECAPI_GUIDNAMED( AVEncDDProductionInfoExists ) - #define CODECAPI_AVEncDDProductionRoomType DEFINE_CODECAPI_GUIDNAMED( AVEncDDProductionRoomType ) - #define CODECAPI_AVEncDDProductionMixLevel DEFINE_CODECAPI_GUIDNAMED( AVEncDDProductionMixLevel ) - #define CODECAPI_AVEncDDCopyright DEFINE_CODECAPI_GUIDNAMED( AVEncDDCopyright ) - #define CODECAPI_AVEncDDOriginalBitstream DEFINE_CODECAPI_GUIDNAMED( AVEncDDOriginalBitstream ) - #define CODECAPI_AVEncDDDigitalDeemphasis DEFINE_CODECAPI_GUIDNAMED( AVEncDDDigitalDeemphasis ) - #define CODECAPI_AVEncDDDCHighPassFilter DEFINE_CODECAPI_GUIDNAMED( AVEncDDDCHighPassFilter ) - #define CODECAPI_AVEncDDChannelBWLowPassFilter DEFINE_CODECAPI_GUIDNAMED( AVEncDDChannelBWLowPassFilter ) - #define CODECAPI_AVEncDDLFELowPassFilter DEFINE_CODECAPI_GUIDNAMED( AVEncDDLFELowPassFilter ) - #define CODECAPI_AVEncDDSurround90DegreeePhaseShift DEFINE_CODECAPI_GUIDNAMED( AVEncDDSurround90DegreeePhaseShift ) - #define CODECAPI_AVEncDDSurround3dBAttenuation DEFINE_CODECAPI_GUIDNAMED( AVEncDDSurround3dBAttenuation ) - #define CODECAPI_AVEncDDDynamicRangeCompressionControl DEFINE_CODECAPI_GUIDNAMED( AVEncDDDynamicRangeCompressionControl ) - #define CODECAPI_AVEncDDRFPreEmphasisFilter DEFINE_CODECAPI_GUIDNAMED( AVEncDDRFPreEmphasisFilter ) - #define CODECAPI_AVEncDDSurroundExMode DEFINE_CODECAPI_GUIDNAMED( AVEncDDSurroundExMode ) - #define CODECAPI_AVEncDDPreferredStereoDownMixMode DEFINE_CODECAPI_GUIDNAMED( AVEncDDPreferredStereoDownMixMode ) - #define CODECAPI_AVEncDDLtRtCenterMixLvl_x10 DEFINE_CODECAPI_GUIDNAMED( AVEncDDLtRtCenterMixLvl_x10 ) - #define CODECAPI_AVEncDDLtRtSurroundMixLvl_x10 DEFINE_CODECAPI_GUIDNAMED( AVEncDDLtRtSurroundMixLvl_x10 ) - #define CODECAPI_AVEncDDLoRoCenterMixLvl_x10 DEFINE_CODECAPI_GUIDNAMED( AVEncDDLoRoCenterMixLvl_x10 ) - #define CODECAPI_AVEncDDLoRoSurroundMixLvl_x10 DEFINE_CODECAPI_GUIDNAMED( AVEncDDLoRoSurroundMixLvl_x10 ) - #define CODECAPI_AVEncDDAtoDConverterType DEFINE_CODECAPI_GUIDNAMED( AVEncDDAtoDConverterType ) - #define CODECAPI_AVEncDDHeadphoneMode DEFINE_CODECAPI_GUIDNAMED( AVEncDDHeadphoneMode ) - #define CODECAPI_AVEncWMVKeyFrameDistance DEFINE_CODECAPI_GUIDNAMED( AVEncWMVKeyFrameDistance ) - #define CODECAPI_AVEncWMVInterlacedEncoding DEFINE_CODECAPI_GUIDNAMED( AVEncWMVInterlacedEncoding ) - #define CODECAPI_AVEncWMVDecoderComplexity DEFINE_CODECAPI_GUIDNAMED( AVEncWMVDecoderComplexity ) - #define CODECAPI_AVEncWMVKeyFrameBufferLevelMarker DEFINE_CODECAPI_GUIDNAMED( AVEncWMVKeyFrameBufferLevelMarker ) - #define CODECAPI_AVEncWMVProduceDummyFrames DEFINE_CODECAPI_GUIDNAMED( AVEncWMVProduceDummyFrames ) - #define CODECAPI_AVEncStatWMVCBAvg DEFINE_CODECAPI_GUIDNAMED( AVEncStatWMVCBAvg ) - #define CODECAPI_AVEncStatWMVCBMax DEFINE_CODECAPI_GUIDNAMED( AVEncStatWMVCBMax ) - #define CODECAPI_AVEncStatWMVDecoderComplexityProfile DEFINE_CODECAPI_GUIDNAMED( AVEncStatWMVDecoderComplexityProfile ) - #define CODECAPI_AVEncStatMPVSkippedEmptyFrames DEFINE_CODECAPI_GUIDNAMED( AVEncStatMPVSkippedEmptyFrames ) - #define CODECAPI_AVEncMP12PktzSTDBuffer DEFINE_CODECAPI_GUIDNAMED( AVEncMP12PktzSTDBuffer ) - #define CODECAPI_AVEncMP12PktzStreamID DEFINE_CODECAPI_GUIDNAMED( AVEncMP12PktzStreamID ) - #define CODECAPI_AVEncMP12PktzInitialPTS DEFINE_CODECAPI_GUIDNAMED( AVEncMP12PktzInitialPTS ) - #define CODECAPI_AVEncMP12PktzPacketSize DEFINE_CODECAPI_GUIDNAMED( AVEncMP12PktzPacketSize ) - #define CODECAPI_AVEncMP12PktzCopyright DEFINE_CODECAPI_GUIDNAMED( AVEncMP12PktzCopyright ) - #define CODECAPI_AVEncMP12PktzOriginal DEFINE_CODECAPI_GUIDNAMED( AVEncMP12PktzOriginal ) - #define CODECAPI_AVEncMP12MuxPacketOverhead DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxPacketOverhead ) - #define CODECAPI_AVEncMP12MuxNumStreams DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxNumStreams ) - #define CODECAPI_AVEncMP12MuxEarliestPTS DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxEarliestPTS ) - #define CODECAPI_AVEncMP12MuxLargestPacketSize DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxLargestPacketSize ) - #define CODECAPI_AVEncMP12MuxInitialSCR DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxInitialSCR ) - #define CODECAPI_AVEncMP12MuxMuxRate DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxMuxRate ) - #define CODECAPI_AVEncMP12MuxPackSize DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxPackSize ) - #define CODECAPI_AVEncMP12MuxSysSTDBufferBound DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxSysSTDBufferBound ) - #define CODECAPI_AVEncMP12MuxSysRateBound DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxSysRateBound ) - #define CODECAPI_AVEncMP12MuxTargetPacketizer DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxTargetPacketizer ) - #define CODECAPI_AVEncMP12MuxSysFixed DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxSysFixed ) - #define CODECAPI_AVEncMP12MuxSysCSPS DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxSysCSPS ) - #define CODECAPI_AVEncMP12MuxSysVideoLock DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxSysVideoLock ) - #define CODECAPI_AVEncMP12MuxSysAudioLock DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxSysAudioLock ) - #define CODECAPI_AVEncMP12MuxDVDNavPacks DEFINE_CODECAPI_GUIDNAMED( AVEncMP12MuxDVDNavPacks ) - - #define CODECAPI_AVEncMPACopyright DEFINE_CODECAPI_GUIDNAMED( AVEncMPACopyright ) - #define CODECAPI_AVEncMPAOriginalBitstream DEFINE_CODECAPI_GUIDNAMED( AVEncMPAOriginalBitstream ) - #define CODECAPI_AVEncMPAEnableRedundancyProtection DEFINE_CODECAPI_GUIDNAMED( AVEncMPAEnableRedundancyProtection ) - #define CODECAPI_AVEncMPAPrivateUserBit DEFINE_CODECAPI_GUIDNAMED( AVEncMPAPrivateUserBit ) - #define CODECAPI_AVEncMPAEmphasisType DEFINE_CODECAPI_GUIDNAMED( AVEncMPAEmphasisType ) - - #define CODECAPI_AVDecCommonOutputFormat DEFINE_CODECAPI_GUIDNAMED( AVDecCommonOutputFormat ) - #define CODECAPI_AVDecCommonInputFormat DEFINE_CODECAPI_GUIDNAMED( AVDecCommonInputFormat ) - #define CODECAPI_AVDecCommonMeanBitRate DEFINE_CODECAPI_GUIDNAMED( AVDecCommonMeanBitRate ) - #define CODECAPI_AVDecCommonMeanBitRateInterval DEFINE_CODECAPI_GUIDNAMED( AVDecCommonMeanBitRateInterval ) - - #define CODECAPI_GUID_AVDecAudioOutputFormat_PCM_Stereo_MatrixEncoded DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioOutputFormat_PCM_Stereo_MatrixEncoded ) - #define CODECAPI_GUID_AVDecAudioOutputFormat_PCM DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioOutputFormat_PCM ) - #define CODECAPI_GUID_AVDecAudioOutputFormat_SPDIF_PCM DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioOutputFormat_SPDIF_PCM ) - #define CODECAPI_GUID_AVDecAudioOutputFormat_SPDIF_Bitstream DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioOutputFormat_SPDIF_Bitstream ) - #define CODECAPI_GUID_AVDecAudioOutputFormat_PCM_Headphones DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioOutputFormat_PCM_Headphones ) - #define CODECAPI_GUID_AVDecAudioOutputFormat_PCM_Stereo_Auto DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioOutputFormat_PCM_Stereo_Auto ) - - #define CODECAPI_AVDecVideoImageSize DEFINE_CODECAPI_GUIDNAMED( AVDecVideoImageSize ) - #define CODECAPI_AVDecVideoInputScanType DEFINE_CODECAPI_GUIDNAMED( AVDecVideoInputScanType ) - #define CODECAPI_AVDecVideoPixelAspectRatio DEFINE_CODECAPI_GUIDNAMED( AVDecVideoPixelAspectRatio ) - - #define CODECAPI_AVDecVideoThumbnailGenerationMode DEFINE_CODECAPI_GUIDNAMED( AVDecVideoThumbnailGenerationMode ) - #define CODECAPI_AVDecVideoDropPicWithMissingRef DEFINE_CODECAPI_GUIDNAMED( AVDecVideoDropPicWithMissingRef ) - #define CODECAPI_AVDecVideoSoftwareDeinterlaceMode DEFINE_CODECAPI_GUIDNAMED( AVDecVideoSoftwareDeinterlaceMode ) - #define CODECAPI_AVDecVideoFastDecodeMode DEFINE_CODECAPI_GUIDNAMED( AVDecVideoFastDecodeMode ) - #define CODECAPI_AVDecVideoH264ErrorConcealment DEFINE_CODECAPI_GUIDNAMED( AVDecVideoH264ErrorConcealment ) - #define CODECAPI_AVDecVideoMPEG2ErrorConcealment DEFINE_CODECAPI_GUIDNAMED( AVDecVideoMPEG2ErrorConcealment ) - #define CODECAPI_AVDecVideoCodecType DEFINE_CODECAPI_GUIDNAMED( AVDecVideoCodecType ) - #define CODECAPI_AVDecVideoDXVAMode DEFINE_CODECAPI_GUIDNAMED( AVDecVideoDXVAMode ) - #define CODECAPI_AVDecVideoDXVABusEncryption DEFINE_CODECAPI_GUIDNAMED( AVDecVideoDXVABusEncryption ) - #define CODECAPI_AVDecVideoSWPowerLevel DEFINE_CODECAPI_GUIDNAMED( AVDecVideoSWPowerLevel ) - - #define CODECAPI_GUID_AVDecAudioInputWMA DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioInputWMA ) - #define CODECAPI_GUID_AVDecAudioInputWMAPro DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioInputWMAPro ) - #define CODECAPI_GUID_AVDecAudioInputDolby DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioInputDolby ) - #define CODECAPI_GUID_AVDecAudioInputDTS DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioInputDTS ) - #define CODECAPI_GUID_AVDecAudioInputPCM DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioInputPCM ) - #define CODECAPI_GUID_AVDecAudioInputMPEG DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioInputMPEG ) - #define CODECAPI_GUID_AVDecAudioInputAAC DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioInputAAC ) - #define CODECAPI_GUID_AVDecAudioInputHEAAC DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioInputHEAAC ) - #define CODECAPI_GUID_AVDecAudioInputDolbyDigitalPlus DEFINE_CODECAPI_GUIDNAMED( GUID_AVDecAudioInputDolbyDigitalPlus ) - - #define CODECAPI_AVDecAACDownmixMode DEFINE_CODECAPI_GUIDNAMED( AVDecAACDownmixMode ) - #define CODECAPI_AVDecHEAACDynamicRangeControl DEFINE_CODECAPI_GUIDNAMED( AVDecHEAACDynamicRangeControl ) - - #define CODECAPI_AVDecAudioDualMono DEFINE_CODECAPI_GUIDNAMED( AVDecAudioDualMono) - #define CODECAPI_AVDecAudioDualMonoReproMode DEFINE_CODECAPI_GUIDNAMED( AVDecAudioDualMonoReproMode ) - - #define CODECAPI_AVAudioChannelCount DEFINE_CODECAPI_GUIDNAMED( AVAudioChannelCount ) - #define CODECAPI_AVAudioChannelConfig DEFINE_CODECAPI_GUIDNAMED( AVAudioChannelConfig ) - #define CODECAPI_AVAudioSampleRate DEFINE_CODECAPI_GUIDNAMED( AVAudioSampleRate ) - - #define CODECAPI_AVDDSurroundMode DEFINE_CODECAPI_GUIDNAMED( AVDDSurroundMode ) - #define CODECAPI_AVDecDDOperationalMode DEFINE_CODECAPI_GUIDNAMED( AVDecDDOperationalMode ) - #define CODECAPI_AVDecDDMatrixDecodingMode DEFINE_CODECAPI_GUIDNAMED( AVDecDDMatrixDecodingMode ) - #define CODECAPI_AVDecDDDynamicRangeScaleHigh DEFINE_CODECAPI_GUIDNAMED( AVDecDDDynamicRangeScaleHigh ) - #define CODECAPI_AVDecDDDynamicRangeScaleLow DEFINE_CODECAPI_GUIDNAMED( AVDecDDDynamicRangeScaleLow ) - - #define CODECAPI_AVDSPLoudnessEqualization DEFINE_CODECAPI_GUIDNAMED( AVDSPLoudnessEqualization ) - #define CODECAPI_AVDSPSpeakerFill DEFINE_CODECAPI_GUIDNAMED( AVDSPSpeakerFill ) - - #define CODECAPI_AVPriorityControl DEFINE_CODECAPI_GUIDNAMED( AVPriorityControl ) - #define CODECAPI_AVRealtimeControl DEFINE_CODECAPI_GUIDNAMED( AVRealtimeControl ) -#endif - - -#endif // !defined(_CODECAPI_) - - - diff --git a/pub/ddk/contactdeviceservice.h b/pub/ddk/contactdeviceservice.h deleted file mode 100644 index e79650d..0000000 --- a/pub/ddk/contactdeviceservice.h +++ /dev/null @@ -1,937 +0,0 @@ -/* - * ContactDeviceService.h - * - * Contains declarations for the Contact Device Service - * - * Copyright (c) Microsoft Corporation, All Rights Reserved. - * - */ - -#ifndef _CONTACTDEVICESERVICE_H_ -#define _CONTACTDEVICESERVICE_H_ - -#include -#include - -/*****************************************************************************/ -/* 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_ */ - - diff --git a/pub/ddk/csq.h b/pub/ddk/csq.h deleted file mode 100644 index 846bc80..0000000 --- a/pub/ddk/csq.h +++ /dev/null @@ -1,310 +0,0 @@ -/*++ - -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 - - - diff --git a/pub/ddk/d3dhal.h b/pub/ddk/d3dhal.h deleted file mode 100644 index 26b3aec..0000000 --- a/pub/ddk/d3dhal.h +++ /dev/null @@ -1,2763 +0,0 @@ -/*==========================================================================; - * - * Copyright (C) Microsoft Corporation. All Rights Reserved. - * - * File: d3dhal.h - * Content: Direct3D HAL include file - * - ***************************************************************************/ - -#ifndef _D3DHAL_H_ -#define _D3DHAL_H_ -#include "ddraw.h" -#include "d3dtypes.h" -#include "d3dcaps.h" -#include "d3d.h" -#if(DIRECT3D_VERSION >= 0x0900 ) -#include "d3d9.h" -#include "dxva9typ.h" -#else -#include "d3d8.h" -#endif - -struct _D3DHAL_CALLBACKS; -typedef struct _D3DHAL_CALLBACKS D3DHAL_CALLBACKS, *LPD3DHAL_CALLBACKS; - -struct _D3DHAL_CALLBACKS2; -typedef struct _D3DHAL_CALLBACKS2 D3DHAL_CALLBACKS2, *LPD3DHAL_CALLBACKS2; - -struct _D3DHAL_CALLBACKS3; -typedef struct _D3DHAL_CALLBACKS3 D3DHAL_CALLBACKS3, *LPD3DHAL_CALLBACKS3; - -typedef struct _DDRAWI_DIRECTDRAW_GBL FAR *LPDDRAWI_DIRECTDRAW_GBL; -typedef struct _DDRAWI_DIRECTDRAW_LCL FAR *LPDDRAWI_DIRECTDRAW_LCL; -struct _DDRAWI_DDRAWSURFACE_LCL; -typedef struct _DDRAWI_DDRAWSURFACE_LCL FAR *LPDDRAWI_DDRAWSURFACE_LCL; - -/* - * If the HAL driver does not implement clipping, it must reserve at least - * this much space at the end of the LocalVertexBuffer for use by the HEL - * clipping. I.e. the vertex buffer contain dwNumVertices+dwNumClipVertices - * vertices. No extra space is needed by the HEL clipping in the - * LocalHVertexBuffer. - */ -#define D3DHAL_NUMCLIPVERTICES 20 - -/* - * These are a few special internal renderstates etc. that would - * logically be in d3dtypes.h, but that file is external, so they are - * here. - */ -#define D3DTSS_MAX_DX6 ((D3DTEXTURESTAGESTATETYPE)24) -#define D3DTSS_MAX_DX7 ((D3DTEXTURESTAGESTATETYPE)29) -#define D3DTSS_MAX_DX8 ((D3DTEXTURESTAGESTATETYPE)29) -#define D3DTSS_MAX_DX9 ((D3DTEXTURESTAGESTATETYPE)33) - -#if( DIRECT3D_VERSION >= 0x0900 ) -#define D3DTSS_MAX D3DTSS_MAX_DX9 -#elif( DIRECT3D_VERSION >= 0x0800 ) -#define D3DTSS_MAX D3DTSS_MAX_DX8 -#elif( DIRECT3D_VERSION >= 0x0700 ) -#define D3DTSS_MAX D3DTSS_MAX_DX7 -#else -#define D3DTSS_MAX D3DTSS_MAX_DX6 -#endif - -/* - * If DX8 driver wants to support pre-DX8 applications, it should use these - * definitions for pre-DX8 world matrices -*/ -#define D3DTRANSFORMSTATE_WORLD_DX7 1 -#define D3DTRANSFORMSTATE_WORLD1_DX7 4 -#define D3DTRANSFORMSTATE_WORLD2_DX7 5 -#define D3DTRANSFORMSTATE_WORLD3_DX7 6 - -/* - * Generally needed maximum state structure sizes. Note that the copy of - * these in refrasti.hpp must be kept in sync with these. - */ -#define D3DHAL_MAX_RSTATES_DX6 (256) -#define D3DHAL_MAX_RSTATES_DX7 (256) -#define D3DHAL_MAX_RSTATES_DX8 (256) -#define D3DHAL_MAX_RSTATES_DX9 (256) - -#if( DIRECT3D_VERSION >= 0x0900 ) -#define D3DHAL_MAX_RSTATES D3DHAL_MAX_RSTATES_DX9 -#elif( DIRECT3D_VERSION >= 0x0800 ) -#define D3DHAL_MAX_RSTATES D3DHAL_MAX_RSTATES_DX8 -#elif( DIRECT3D_VERSION >= 0x0700 ) -#define D3DHAL_MAX_RSTATES D3DHAL_MAX_RSTATES_DX7 -#else -#define D3DHAL_MAX_RSTATES D3DHAL_MAX_RSTATES_DX6 -#endif - -#define D3D_MAXRENDERSTATES ((D3DRENDERSTATETYPE)D3DHAL_MAX_RSTATES) - -/* Last state offset for combined render state and texture stage array + 1 */ -#define D3DHAL_MAX_RSTATES_AND_STAGES \ - (D3DHAL_TSS_RENDERSTATEBASE + \ - D3DHAL_TSS_MAXSTAGES * D3DHAL_TSS_STATESPERSTAGE) -/* Last texture state ID */ -#define D3DHAL_MAX_TEXTURESTATES (13) -/* Last texture state ID + 1 */ -#define D3DHAL_TEXTURESTATEBUF_SIZE (D3DHAL_MAX_TEXTURESTATES+1) - -/* - * If no dwNumVertices is given, this is what will be used. - */ -#define D3DHAL_DEFAULT_TL_NUM ((32 * 1024) / sizeof (D3DTLVERTEX)) -#define D3DHAL_DEFAULT_H_NUM ((32 * 1024) / sizeof (D3DHVERTEX)) - -/* - * Description for a device. - * This is used to describe a device that is to be created or to query - * the current device. - * - * For DX5 and subsequent runtimes, D3DDEVICEDESC is a user-visible - * structure that is not seen by the device drivers. The runtime - * stitches a D3DDEVICEDESC together using the D3DDEVICEDESC_V1 - * embedded in the GLOBALDRIVERDATA and the extended caps queried - * from the driver using GetDriverInfo. - */ - -typedef struct _D3DDeviceDesc_V1 { - DWORD dwSize; /* Size of D3DDEVICEDESC structure */ - DWORD dwFlags; /* Indicates which fields have valid data */ - D3DCOLORMODEL dcmColorModel; /* Color model of device */ - DWORD dwDevCaps; /* Capabilities of device */ - D3DTRANSFORMCAPS dtcTransformCaps; /* Capabilities of transform */ - BOOL bClipping; /* Device can do 3D clipping */ - D3DLIGHTINGCAPS dlcLightingCaps; /* Capabilities of lighting */ - D3DPRIMCAPS dpcLineCaps; - D3DPRIMCAPS dpcTriCaps; - DWORD dwDeviceRenderBitDepth; /* One of DDBD_16, etc.. */ - DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */ - DWORD dwMaxBufferSize; /* Maximum execute buffer size */ - DWORD dwMaxVertexCount; /* Maximum vertex count */ -} D3DDEVICEDESC_V1, *LPD3DDEVICEDESC_V1; - -#define D3DDEVICEDESCSIZE_V1 (sizeof(D3DDEVICEDESC_V1)) - -/* - * This is equivalent to the D3DDEVICEDESC understood by DX5, available only - * from DX6. It is the same as D3DDEVICEDESC structure in DX5. - * D3DDEVICEDESC is still the user-visible structure that is not seen by the - * device drivers. The runtime stitches a D3DDEVICEDESC together using the - * D3DDEVICEDESC_V1 embedded in the GLOBALDRIVERDATA and the extended caps - * queried from the driver using GetDriverInfo. - */ - -typedef struct _D3DDeviceDesc_V2 { - DWORD dwSize; /* Size of D3DDEVICEDESC structure */ - DWORD dwFlags; /* Indicates which fields have valid data */ - D3DCOLORMODEL dcmColorModel; /* Color model of device */ - DWORD dwDevCaps; /* Capabilities of device */ - D3DTRANSFORMCAPS dtcTransformCaps; /* Capabilities of transform */ - BOOL bClipping; /* Device can do 3D clipping */ - D3DLIGHTINGCAPS dlcLightingCaps; /* Capabilities of lighting */ - D3DPRIMCAPS dpcLineCaps; - D3DPRIMCAPS dpcTriCaps; - DWORD dwDeviceRenderBitDepth; /* One of DDBD_16, etc.. */ - DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */ - DWORD dwMaxBufferSize; /* Maximum execute buffer size */ - DWORD dwMaxVertexCount; /* Maximum vertex count */ - - DWORD dwMinTextureWidth, dwMinTextureHeight; - DWORD dwMaxTextureWidth, dwMaxTextureHeight; - DWORD dwMinStippleWidth, dwMaxStippleWidth; - DWORD dwMinStippleHeight, dwMaxStippleHeight; - -} D3DDEVICEDESC_V2, *LPD3DDEVICEDESC_V2; - -#define D3DDEVICEDESCSIZE_V2 (sizeof(D3DDEVICEDESC_V2)) - -#if(DIRECT3D_VERSION >= 0x0700) -/* - * This is equivalent to the D3DDEVICEDESC understood by DX6, available only - * from DX6. It is the same as D3DDEVICEDESC structure in DX6. - * D3DDEVICEDESC is still the user-visible structure that is not seen by the - * device drivers. The runtime stitches a D3DDEVICEDESC together using the - * D3DDEVICEDESC_V1 embedded in the GLOBALDRIVERDATA and the extended caps - * queried from the driver using GetDriverInfo. - */ - -typedef struct _D3DDeviceDesc_V3 { - DWORD dwSize; /* Size of D3DDEVICEDESC structure */ - DWORD dwFlags; /* Indicates which fields have valid data */ - D3DCOLORMODEL dcmColorModel; /* Color model of device */ - DWORD dwDevCaps; /* Capabilities of device */ - D3DTRANSFORMCAPS dtcTransformCaps; /* Capabilities of transform */ - BOOL bClipping; /* Device can do 3D clipping */ - D3DLIGHTINGCAPS dlcLightingCaps; /* Capabilities of lighting */ - D3DPRIMCAPS dpcLineCaps; - D3DPRIMCAPS dpcTriCaps; - DWORD dwDeviceRenderBitDepth; /* One of DDBD_16, etc.. */ - DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */ - DWORD dwMaxBufferSize; /* Maximum execute buffer size */ - DWORD dwMaxVertexCount; /* Maximum vertex count */ - - DWORD dwMinTextureWidth, dwMinTextureHeight; - DWORD dwMaxTextureWidth, dwMaxTextureHeight; - DWORD dwMinStippleWidth, dwMaxStippleWidth; - DWORD dwMinStippleHeight, dwMaxStippleHeight; - - DWORD dwMaxTextureRepeat; - DWORD dwMaxTextureAspectRatio; - DWORD dwMaxAnisotropy; - D3DVALUE dvGuardBandLeft; - D3DVALUE dvGuardBandTop; - D3DVALUE dvGuardBandRight; - D3DVALUE dvGuardBandBottom; - D3DVALUE dvExtentsAdjust; - DWORD dwStencilCaps; - DWORD dwFVFCaps; /* low 4 bits: 0 implies TLVERTEX only, 1..8 imply FVF aware */ - DWORD dwTextureOpCaps; - WORD wMaxTextureBlendStages; - WORD wMaxSimultaneousTextures; -} D3DDEVICEDESC_V3, *LPD3DDEVICEDESC_V3; - -#define D3DDEVICEDESCSIZE_V3 (sizeof(D3DDEVICEDESC_V3)) -#endif /* DIRECT3D_VERSION >= 0x0700 */ - -/* -------------------------------------------------------------- - * Instantiated by the HAL driver on driver connection. - */ -typedef struct _D3DHAL_GLOBALDRIVERDATA { - DWORD dwSize; // Size of this structure - D3DDEVICEDESC_V1 hwCaps; // Capabilities of the hardware - DWORD dwNumVertices; // see following comment - DWORD dwNumClipVertices; // see following comment - DWORD dwNumTextureFormats; // Number of texture formats - LPDDSURFACEDESC lpTextureFormats; // Pointer to texture formats -} D3DHAL_GLOBALDRIVERDATA; - -typedef D3DHAL_GLOBALDRIVERDATA *LPD3DHAL_GLOBALDRIVERDATA; - -#define D3DHAL_GLOBALDRIVERDATASIZE (sizeof(D3DHAL_GLOBALDRIVERDATA)) - -#if(DIRECT3D_VERSION >= 0x0700) -/* -------------------------------------------------------------- - * Extended caps introduced with DX5 and queried with - * GetDriverInfo (GUID_D3DExtendedCaps). - */ -typedef struct _D3DHAL_D3DDX6EXTENDEDCAPS { - DWORD dwSize; // Size of this structure - - DWORD dwMinTextureWidth, dwMaxTextureWidth; - DWORD dwMinTextureHeight, dwMaxTextureHeight; - DWORD dwMinStippleWidth, dwMaxStippleWidth; - DWORD dwMinStippleHeight, dwMaxStippleHeight; - - /* fields added for DX6 */ - DWORD dwMaxTextureRepeat; - DWORD dwMaxTextureAspectRatio; - DWORD dwMaxAnisotropy; - D3DVALUE dvGuardBandLeft; - D3DVALUE dvGuardBandTop; - D3DVALUE dvGuardBandRight; - D3DVALUE dvGuardBandBottom; - D3DVALUE dvExtentsAdjust; - DWORD dwStencilCaps; - DWORD dwFVFCaps; /* low 4 bits: 0 implies TLVERTEX only, 1..8 imply FVF aware */ - DWORD dwTextureOpCaps; - WORD wMaxTextureBlendStages; - WORD wMaxSimultaneousTextures; - -} D3DHAL_D3DDX6EXTENDEDCAPS; -#endif /* DIRECT3D_VERSION >= 0x0700 */ - -/* -------------------------------------------------------------- - * Extended caps introduced with DX5 and queried with - * GetDriverInfo (GUID_D3DExtendedCaps). - */ -typedef struct _D3DHAL_D3DEXTENDEDCAPS { - DWORD dwSize; // Size of this structure - - DWORD dwMinTextureWidth, dwMaxTextureWidth; - DWORD dwMinTextureHeight, dwMaxTextureHeight; - DWORD dwMinStippleWidth, dwMaxStippleWidth; - DWORD dwMinStippleHeight, dwMaxStippleHeight; - - /* fields added for DX6 */ - DWORD dwMaxTextureRepeat; - DWORD dwMaxTextureAspectRatio; - DWORD dwMaxAnisotropy; - D3DVALUE dvGuardBandLeft; - D3DVALUE dvGuardBandTop; - D3DVALUE dvGuardBandRight; - D3DVALUE dvGuardBandBottom; - D3DVALUE dvExtentsAdjust; - DWORD dwStencilCaps; - DWORD dwFVFCaps; /* low 4 bits: 0 implies TLVERTEX only, 1..8 imply FVF aware */ - DWORD dwTextureOpCaps; - WORD wMaxTextureBlendStages; - WORD wMaxSimultaneousTextures; - -#if(DIRECT3D_VERSION >= 0x0700) - /* fields added for DX7 */ - DWORD dwMaxActiveLights; - D3DVALUE dvMaxVertexW; - - WORD wMaxUserClipPlanes; - WORD wMaxVertexBlendMatrices; - - DWORD dwVertexProcessingCaps; - - DWORD dwReserved1; - DWORD dwReserved2; - DWORD dwReserved3; - DWORD dwReserved4; -#endif /* DIRECT3D_VERSION >= 0x0700 */ -} D3DHAL_D3DEXTENDEDCAPS; - -typedef D3DHAL_D3DEXTENDEDCAPS *LPD3DHAL_D3DEXTENDEDCAPS; -#define D3DHAL_D3DEXTENDEDCAPSSIZE (sizeof(D3DHAL_D3DEXTENDEDCAPS)) - -#if(DIRECT3D_VERSION >= 0x0700) -typedef D3DHAL_D3DDX6EXTENDEDCAPS *LPD3DHAL_D3DDX6EXTENDEDCAPS; -#define D3DHAL_D3DDX6EXTENDEDCAPSSIZE (sizeof(D3DHAL_D3DDX6EXTENDEDCAPS)) -#endif /* DIRECT3D_VERSION >= 0x0700 */ - -#if(DIRECT3D_VERSION >= 0x0900) -typedef struct _D3DCAPS8 -{ - /* Device Info */ - D3DDEVTYPE DeviceType; - UINT AdapterOrdinal; - - /* Caps from DX7 Draw */ - DWORD Caps; - DWORD Caps2; - DWORD Caps3; - DWORD PresentationIntervals; - - /* Cursor Caps */ - DWORD CursorCaps; - - /* 3D Device Caps */ - DWORD DevCaps; - - DWORD PrimitiveMiscCaps; - DWORD RasterCaps; - DWORD ZCmpCaps; - DWORD SrcBlendCaps; - DWORD DestBlendCaps; - DWORD AlphaCmpCaps; - DWORD ShadeCaps; - DWORD TextureCaps; - DWORD TextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture8's - DWORD CubeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DCubeTexture8's - DWORD VolumeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DVolumeTexture8's - DWORD TextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DTexture8's - DWORD VolumeTextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DVolumeTexture8's - - DWORD LineCaps; // D3DLINECAPS - - DWORD MaxTextureWidth, MaxTextureHeight; - DWORD MaxVolumeExtent; - - DWORD MaxTextureRepeat; - DWORD MaxTextureAspectRatio; - DWORD MaxAnisotropy; - float MaxVertexW; - - float GuardBandLeft; - float GuardBandTop; - float GuardBandRight; - float GuardBandBottom; - - float ExtentsAdjust; - DWORD StencilCaps; - - DWORD FVFCaps; - DWORD TextureOpCaps; - DWORD MaxTextureBlendStages; - DWORD MaxSimultaneousTextures; - - DWORD VertexProcessingCaps; - DWORD MaxActiveLights; - DWORD MaxUserClipPlanes; - DWORD MaxVertexBlendMatrices; - DWORD MaxVertexBlendMatrixIndex; - - float MaxPointSize; - - DWORD MaxPrimitiveCount; // max number of primitives per DrawPrimitive call - DWORD MaxVertexIndex; - DWORD MaxStreams; - DWORD MaxStreamStride; // max stride for SetStreamSource - - DWORD VertexShaderVersion; - DWORD MaxVertexShaderConst; // number of vertex shader constant registers - - DWORD PixelShaderVersion; - float MaxPixelShaderValue; // max value of pixel shader arithmetic component -} D3DCAPS8; - -typedef D3DLIGHT9 D3DLIGHT8; -typedef D3DMATERIAL9 D3DMATERIAL8; -typedef D3DVIEWPORT9 D3DVIEWPORT8; -#define D3DRS_EDGEANTIALIAS D3DRS_RESERVED0 -#ifndef D3DPRASTERCAPS_ANTIALIASEDGES -#define D3DPRASTERCAPS_ANTIALIASEDGES D3DPRASTERCAPS_RESERVED0 -#endif /* D3DPRASTERCAPS_ANTIALIASEDGES */ -#ifndef D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE -#define D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE 0x00800000L -#endif /* D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE */ -#ifndef D3DPRASTERCAPS_PAT -#define D3DPRASTERCAPS_PAT 0x00000008L // equal to D3DPRASTERCAPS_RESERVED2 -#endif - - -// This cap should not be used in DX9+ drivers -// -#ifndef D3DVTXPCAPS_NO_VSDT_UBYTE4 -#define D3DVTXPCAPS_NO_VSDT_UBYTE4 0x00000080L /* device does not support D3DVSDT_UBYTE4 */ -#endif - -// These are old filter caps that have been retired. -#define D3DTEXF_FLATCUBIC 4 -#define D3DTEXF_GAUSSIANCUBIC 5 - -// These are line related states and caps that have been retired -typedef struct _D3DLINEPATTERN { - WORD wRepeatFactor; - WORD wLinePattern; -} D3DLINEPATTERN; - -#define D3DPMISCCAPS_LINEPATTERNREP 0x00000004L - -#endif /* DIRECT3D_VERSION >= 0x0900 */ - -/* -------------------------------------------------------------- - * Argument to the HAL functions. - * - * !!! When this structure is changed, D3DHAL_CONTEXTCREATEDATA in - * windows\published\ntgdistr.h also must be changed to be the same size !!! - * - */ - -typedef struct _D3DHAL_CONTEXTCREATEDATA -{ - union - { - LPDDRAWI_DIRECTDRAW_GBL lpDDGbl; // in: Driver struct (legacy) - LPDDRAWI_DIRECTDRAW_LCL lpDDLcl; // in: For DX7 driver onwards - }; - - union - { - LPDIRECTDRAWSURFACE lpDDS; // in: Surface to be used as target - LPDDRAWI_DDRAWSURFACE_LCL lpDDSLcl; // For DX7 onwards - }; - - union - { - LPDIRECTDRAWSURFACE lpDDSZ; // in: Surface to be used as Z - LPDDRAWI_DDRAWSURFACE_LCL lpDDSZLcl; // For DX7 onwards - }; - - union - { - DWORD dwPID; // in: Current process id - ULONG_PTR dwrstates; // Must be larger enough to hold a pointer as - // we can return a pointer in this field - }; - ULONG_PTR dwhContext; // out: Context handle - HRESULT ddrval; // out: Return value -} D3DHAL_CONTEXTCREATEDATA; -typedef D3DHAL_CONTEXTCREATEDATA *LPD3DHAL_CONTEXTCREATEDATA; - -typedef struct _D3DHAL_CONTEXTDESTROYDATA -{ - ULONG_PTR dwhContext; // in: Context handle - HRESULT ddrval; // out: Return value -} D3DHAL_CONTEXTDESTROYDATA; -typedef D3DHAL_CONTEXTDESTROYDATA *LPD3DHAL_CONTEXTDESTROYDATA; - -typedef struct _D3DHAL_CONTEXTDESTROYALLDATA -{ - DWORD dwPID; // in: Process id to destroy contexts for - HRESULT ddrval; // out: Return value -} D3DHAL_CONTEXTDESTROYALLDATA; -typedef D3DHAL_CONTEXTDESTROYALLDATA *LPD3DHAL_CONTEXTDESTROYALLDATA; - -typedef struct _D3DHAL_SCENECAPTUREDATA -{ - ULONG_PTR dwhContext; // in: Context handle - DWORD dwFlag; // in: Indicates beginning or end - HRESULT ddrval; // out: Return value -} D3DHAL_SCENECAPTUREDATA; -typedef D3DHAL_SCENECAPTUREDATA *LPD3DHAL_SCENECAPTUREDATA; - -typedef struct _D3DHAL_RENDERSTATEDATA -{ - ULONG_PTR dwhContext; // in: Context handle - DWORD dwOffset; // in: Where to find states in buffer - DWORD dwCount; // in: How many states to process - LPDIRECTDRAWSURFACE lpExeBuf; // in: Execute buffer containing data - HRESULT ddrval; // out: Return value -} D3DHAL_RENDERSTATEDATA; -typedef D3DHAL_RENDERSTATEDATA *LPD3DHAL_RENDERSTATEDATA; - -typedef struct _D3DHAL_RENDERPRIMITIVEDATA -{ - ULONG_PTR dwhContext; // in: Context handle - DWORD dwOffset; // in: Where to find primitive data in buffer - DWORD dwStatus; // in/out: Condition branch status - LPDIRECTDRAWSURFACE lpExeBuf; // in: Execute buffer containing data - DWORD dwTLOffset; // in: Byte offset in lpTLBuf for start of vertex data - LPDIRECTDRAWSURFACE lpTLBuf; // in: Execute buffer containing TLVertex data - D3DINSTRUCTION diInstruction; // in: Primitive instruction - HRESULT ddrval; // out: Return value -} D3DHAL_RENDERPRIMITIVEDATA; -typedef D3DHAL_RENDERPRIMITIVEDATA *LPD3DHAL_RENDERPRIMITIVEDATA; - -typedef struct _D3DHAL_TEXTURECREATEDATA -{ - ULONG_PTR dwhContext; // in: Context handle - LPDIRECTDRAWSURFACE lpDDS; // in: Pointer to surface object - DWORD dwHandle; // out: Handle to texture - HRESULT ddrval; // out: Return value -} D3DHAL_TEXTURECREATEDATA; -typedef D3DHAL_TEXTURECREATEDATA *LPD3DHAL_TEXTURECREATEDATA; - -typedef struct _D3DHAL_TEXTUREDESTROYDATA -{ - ULONG_PTR dwhContext; // in: Context handle - DWORD dwHandle; // in: Handle to texture - HRESULT ddrval; // out: Return value -} D3DHAL_TEXTUREDESTROYDATA; -typedef D3DHAL_TEXTUREDESTROYDATA *LPD3DHAL_TEXTUREDESTROYDATA; - -typedef struct _D3DHAL_TEXTURESWAPDATA -{ - ULONG_PTR dwhContext; // in: Context handle - DWORD dwHandle1; // in: Handle to texture 1 - DWORD dwHandle2; // in: Handle to texture 2 - HRESULT ddrval; // out: Return value -} D3DHAL_TEXTURESWAPDATA; -typedef D3DHAL_TEXTURESWAPDATA *LPD3DHAL_TEXTURESWAPDATA; - -typedef struct _D3DHAL_TEXTUREGETSURFDATA -{ - ULONG_PTR dwhContext; // in: Context handle - ULONG_PTR lpDDS; // out: Pointer to surface object - DWORD dwHandle; // in: Handle to texture - HRESULT ddrval; // out: Return value -} D3DHAL_TEXTUREGETSURFDATA; -typedef D3DHAL_TEXTUREGETSURFDATA *LPD3DHAL_TEXTUREGETSURFDATA; - -typedef struct _D3DHAL_GETSTATEDATA -{ - ULONG_PTR dwhContext; // in: Context handle - DWORD dwWhich; // in: Transform, lighting or render? - D3DSTATE ddState; // in/out: State. - HRESULT ddrval; // out: Return value -} D3DHAL_GETSTATEDATA; -typedef D3DHAL_GETSTATEDATA *LPD3DHAL_GETSTATEDATA; - - -/* -------------------------------------------------------------- - * Direct3D HAL Table. - * Instantiated by the HAL driver on connection. - * - * Calls take the form of: - * retcode = HalCall(HalCallData* lpData); - */ - -typedef DWORD (__stdcall *LPD3DHAL_CONTEXTCREATECB) (LPD3DHAL_CONTEXTCREATEDATA); -typedef DWORD (__stdcall *LPD3DHAL_CONTEXTDESTROYCB) (LPD3DHAL_CONTEXTDESTROYDATA); -typedef DWORD (__stdcall *LPD3DHAL_CONTEXTDESTROYALLCB) (LPD3DHAL_CONTEXTDESTROYALLDATA); -typedef DWORD (__stdcall *LPD3DHAL_SCENECAPTURECB) (LPD3DHAL_SCENECAPTUREDATA); -typedef DWORD (__stdcall *LPD3DHAL_RENDERSTATECB) (LPD3DHAL_RENDERSTATEDATA); -typedef DWORD (__stdcall *LPD3DHAL_RENDERPRIMITIVECB) (LPD3DHAL_RENDERPRIMITIVEDATA); -typedef DWORD (__stdcall *LPD3DHAL_TEXTURECREATECB) (LPD3DHAL_TEXTURECREATEDATA); -typedef DWORD (__stdcall *LPD3DHAL_TEXTUREDESTROYCB) (LPD3DHAL_TEXTUREDESTROYDATA); -typedef DWORD (__stdcall *LPD3DHAL_TEXTURESWAPCB) (LPD3DHAL_TEXTURESWAPDATA); -typedef DWORD (__stdcall *LPD3DHAL_TEXTUREGETSURFCB) (LPD3DHAL_TEXTUREGETSURFDATA); -typedef DWORD (__stdcall *LPD3DHAL_GETSTATECB) (LPD3DHAL_GETSTATEDATA); - - -/* - * Regarding dwNumVertices, specify 0 if you are relying on the HEL to do - * everything and you do not need the resultant TLVertex buffer to reside - * in device memory. - * The HAL driver will be asked to allocate dwNumVertices + dwNumClipVertices - * in the case described above. - */ - -typedef struct _D3DHAL_CALLBACKS -{ - DWORD dwSize; - - // Device context - LPD3DHAL_CONTEXTCREATECB ContextCreate; - LPD3DHAL_CONTEXTDESTROYCB ContextDestroy; - LPD3DHAL_CONTEXTDESTROYALLCB ContextDestroyAll; - - // Scene Capture - LPD3DHAL_SCENECAPTURECB SceneCapture; - - LPVOID lpReserved10; // Must be zero - LPVOID lpReserved11; // Must be zero - - // Execution - LPD3DHAL_RENDERSTATECB RenderState; - LPD3DHAL_RENDERPRIMITIVECB RenderPrimitive; - - DWORD dwReserved; // Must be zero - - // Textures - LPD3DHAL_TEXTURECREATECB TextureCreate; - LPD3DHAL_TEXTUREDESTROYCB TextureDestroy; - LPD3DHAL_TEXTURESWAPCB TextureSwap; - LPD3DHAL_TEXTUREGETSURFCB TextureGetSurf; - - LPVOID lpReserved12; // Must be zero - LPVOID lpReserved13; // Must be zero - LPVOID lpReserved14; // Must be zero - LPVOID lpReserved15; // Must be zero - LPVOID lpReserved16; // Must be zero - LPVOID lpReserved17; // Must be zero - LPVOID lpReserved18; // Must be zero - LPVOID lpReserved19; // Must be zero - LPVOID lpReserved20; // Must be zero - LPVOID lpReserved21; // Must be zero - - // Pipeline state - LPD3DHAL_GETSTATECB GetState; - - DWORD dwReserved0; // Must be zero - DWORD dwReserved1; // Must be zero - DWORD dwReserved2; // Must be zero - DWORD dwReserved3; // Must be zero - DWORD dwReserved4; // Must be zero - DWORD dwReserved5; // Must be zero - DWORD dwReserved6; // Must be zero - DWORD dwReserved7; // Must be zero - DWORD dwReserved8; // Must be zero - DWORD dwReserved9; // Must be zero - -} D3DHAL_CALLBACKS; -typedef D3DHAL_CALLBACKS *LPD3DHAL_CALLBACKS; - -#define D3DHAL_SIZE_V1 sizeof( D3DHAL_CALLBACKS ) - - -typedef struct _D3DHAL_SETRENDERTARGETDATA -{ - ULONG_PTR dwhContext; // in: Context handle - union - { - LPDIRECTDRAWSURFACE lpDDS; // in: new render target - LPDDRAWI_DDRAWSURFACE_LCL lpDDSLcl; - }; - - union - { - LPDIRECTDRAWSURFACE lpDDSZ; // in: new Z buffer - LPDDRAWI_DDRAWSURFACE_LCL lpDDSZLcl; - }; - - HRESULT ddrval; // out: Return value -} D3DHAL_SETRENDERTARGETDATA; -typedef D3DHAL_SETRENDERTARGETDATA FAR *LPD3DHAL_SETRENDERTARGETDATA; - -// This bit is the same as D3DCLEAR_RESERVED0 in d3d8types.h -// When set it means that driver has to cull rects against current viewport. -// The bit is set only for pure devices -// -#define D3DCLEAR_COMPUTERECTS 0x00000008l - -typedef struct _D3DHAL_CLEARDATA -{ - ULONG_PTR dwhContext; // in: Context handle - - // dwFlags can contain D3DCLEAR_TARGET or D3DCLEAR_ZBUFFER - DWORD dwFlags; // in: surfaces to clear - - DWORD dwFillColor; // in: Color value for rtarget - DWORD dwFillDepth; // in: Depth value for Z buffer - - LPD3DRECT lpRects; // in: Rectangles to clear - DWORD dwNumRects; // in: Number of rectangles - - HRESULT ddrval; // out: Return value -} D3DHAL_CLEARDATA; -typedef D3DHAL_CLEARDATA FAR *LPD3DHAL_CLEARDATA; - -typedef struct _D3DHAL_DRAWONEPRIMITIVEDATA -{ - ULONG_PTR dwhContext; // in: Context handle - - DWORD dwFlags; // in: flags - - D3DPRIMITIVETYPE PrimitiveType; // in: type of primitive to draw - union{ - D3DVERTEXTYPE VertexType; // in: type of vertices - DWORD dwFVFControl; // in: FVF control DWORD - }; - LPVOID lpvVertices; // in: pointer to vertices - DWORD dwNumVertices; // in: number of vertices - - DWORD dwReserved; // in: reserved - - HRESULT ddrval; // out: Return value - -} D3DHAL_DRAWONEPRIMITIVEDATA; -typedef D3DHAL_DRAWONEPRIMITIVEDATA *LPD3DHAL_DRAWONEPRIMITIVEDATA; - - -typedef struct _D3DHAL_DRAWONEINDEXEDPRIMITIVEDATA -{ - ULONG_PTR dwhContext; // in: Context handle - - DWORD dwFlags; // in: flags word - - // Primitive and vertex type - D3DPRIMITIVETYPE PrimitiveType; // in: primitive type - union{ - D3DVERTEXTYPE VertexType; // in: vertex type - DWORD dwFVFControl; // in: FVF control DWORD - }; - - // Vertices - LPVOID lpvVertices; // in: vertex data - DWORD dwNumVertices; // in: vertex count - - // Indices - LPWORD lpwIndices; // in: index data - DWORD dwNumIndices; // in: index count - - HRESULT ddrval; // out: Return value -} D3DHAL_DRAWONEINDEXEDPRIMITIVEDATA; -typedef D3DHAL_DRAWONEINDEXEDPRIMITIVEDATA *LPD3DHAL_DRAWONEINDEXEDPRIMITIVEDATA; - - -typedef struct _D3DHAL_DRAWPRIMCOUNTS -{ - WORD wNumStateChanges; - WORD wPrimitiveType; - WORD wVertexType; - WORD wNumVertices; -} D3DHAL_DRAWPRIMCOUNTS, *LPD3DHAL_DRAWPRIMCOUNTS; - -typedef struct _D3DHAL_DRAWPRIMITIVESDATA -{ - ULONG_PTR dwhContext; // in: Context handle - - DWORD dwFlags; - - // - // Data block: - // - // Consists of interleaved D3DHAL_DRAWPRIMCOUNTS, state change pairs, - // and primitive drawing commands. - // - // D3DHAL_DRAWPRIMCOUNTS: gives number of state change pairs and - // the information on the primitive to draw. - // wPrimitiveType is of type D3DPRIMITIVETYPE. Drivers - // must support all 7 of the primitive types specified - // in the DrawPrimitive API. - // Currently, wVertexType will always be D3DVT_TLVERTEX. - // If the wNumVertices member is 0, then the driver should - // return after doing the state changing. This is the - // terminator for the command stream. - // state change pairs: DWORD pairs specify the state changes that - // the driver should effect before drawing the primitive. - // wNumStateChanges can be 0, in which case the next primitive - // should be drawn without any state changes in between. - // If present, the state change pairs are NOT aligned, they - // immediately follow the PRIMCOUNTS structure. - // vertex data (if any): is 32-byte aligned. - // - // If a primcounts structure follows (i.e. if wNumVertices was nonzero - // in the previous one), then it will immediately follow the state - // changes or vertex data with no alignment padding. - // - - LPVOID lpvData; - - DWORD dwFVFControl; // in: FVF control DWORD - - HRESULT ddrval; // out: Return value -} D3DHAL_DRAWPRIMITIVESDATA; -typedef D3DHAL_DRAWPRIMITIVESDATA *LPD3DHAL_DRAWPRIMITIVESDATA; - -typedef DWORD (CALLBACK *LPD3DHAL_SETRENDERTARGETCB) (LPD3DHAL_SETRENDERTARGETDATA); -typedef DWORD (CALLBACK *LPD3DHAL_CLEARCB) (LPD3DHAL_CLEARDATA); -typedef DWORD (CALLBACK *LPD3DHAL_DRAWONEPRIMITIVECB) (LPD3DHAL_DRAWONEPRIMITIVEDATA); -typedef DWORD (CALLBACK *LPD3DHAL_DRAWONEINDEXEDPRIMITIVECB) (LPD3DHAL_DRAWONEINDEXEDPRIMITIVEDATA); -typedef DWORD (CALLBACK *LPD3DHAL_DRAWPRIMITIVESCB) (LPD3DHAL_DRAWPRIMITIVESDATA); - -typedef struct _D3DHAL_CALLBACKS2 -{ - DWORD dwSize; // size of struct - DWORD dwFlags; // flags for callbacks - LPD3DHAL_SETRENDERTARGETCB SetRenderTarget; - LPD3DHAL_CLEARCB Clear; - LPD3DHAL_DRAWONEPRIMITIVECB DrawOnePrimitive; - LPD3DHAL_DRAWONEINDEXEDPRIMITIVECB DrawOneIndexedPrimitive; - LPD3DHAL_DRAWPRIMITIVESCB DrawPrimitives; -} D3DHAL_CALLBACKS2; -typedef D3DHAL_CALLBACKS2 *LPD3DHAL_CALLBACKS2; - -#define D3DHAL_CALLBACKS2SIZE sizeof(D3DHAL_CALLBACKS2) - -#define D3DHAL2_CB32_SETRENDERTARGET 0x00000001L -#define D3DHAL2_CB32_CLEAR 0x00000002L -#define D3DHAL2_CB32_DRAWONEPRIMITIVE 0x00000004L -#define D3DHAL2_CB32_DRAWONEINDEXEDPRIMITIVE 0x00000008L -#define D3DHAL2_CB32_DRAWPRIMITIVES 0x00000010L - -/* -------------------------------------------------------------- - * D3DCallbacks3 - queried with GetDriverInfo (GUID_D3DCallbacks3). - * - * Clear2 - enables stencil clears (exposed to the API in - * IDirect3DViewport3::Clear2 - * ValidateTextureStageState - evaluates the context's current state (including - * multitexture) and returns an error if the hardware cannot - * accelerate the current state vector. - * DrawPrimitives2 - Renders primitives, and changes device state specified - * in the command buffer. - * - * Multitexture-aware drivers must implement both ValidateTextureStageState. - */ - -typedef struct _D3DHAL_CLEAR2DATA -{ - ULONG_PTR dwhContext; // in: Context handle - - // dwFlags can contain D3DCLEAR_TARGET, D3DCLEAR_ZBUFFER, and/or D3DCLEAR_STENCIL - DWORD dwFlags; // in: surfaces to clear - - DWORD dwFillColor; // in: Color value for rtarget - D3DVALUE dvFillDepth; // in: Depth value for Z buffer (0.0-1.0) - DWORD dwFillStencil; // in: value used to clear stencil buffer - - LPD3DRECT lpRects; // in: Rectangles to clear - DWORD dwNumRects; // in: Number of rectangles - - HRESULT ddrval; // out: Return value -} D3DHAL_CLEAR2DATA; -typedef D3DHAL_CLEAR2DATA FAR *LPD3DHAL_CLEAR2DATA; - -typedef struct _D3DHAL_VALIDATETEXTURESTAGESTATEDATA -{ - ULONG_PTR dwhContext; // in: Context handle - DWORD dwFlags; // in: Flags, currently set to 0 - ULONG_PTR dwReserved; // - DWORD dwNumPasses; // out: Number of passes the hardware - // can perform the operation in - HRESULT ddrval; // out: return value -} D3DHAL_VALIDATETEXTURESTAGESTATEDATA; -typedef D3DHAL_VALIDATETEXTURESTAGESTATEDATA *LPD3DHAL_VALIDATETEXTURESTAGESTATEDATA; - -//----------------------------------------------------------------------------- -// DrawPrimitives2 DDI -//----------------------------------------------------------------------------- - -// -// Command structure for vertex buffer rendering -// - -typedef struct _D3DHAL_DP2COMMAND -{ - BYTE bCommand; // vertex command - BYTE bReserved; - union - { - WORD wPrimitiveCount; // primitive count for unconnected primitives - WORD wStateCount; // count of render states to follow - }; -} D3DHAL_DP2COMMAND, *LPD3DHAL_DP2COMMAND; - -// -// DrawPrimitives2 commands: -// - -typedef enum _D3DHAL_DP2OPERATION -{ - D3DDP2OP_POINTS = 1, - D3DDP2OP_INDEXEDLINELIST = 2, - D3DDP2OP_INDEXEDTRIANGLELIST = 3, - D3DDP2OP_RENDERSTATE = 8, - D3DDP2OP_LINELIST = 15, - D3DDP2OP_LINESTRIP = 16, - D3DDP2OP_INDEXEDLINESTRIP = 17, - D3DDP2OP_TRIANGLELIST = 18, - D3DDP2OP_TRIANGLESTRIP = 19, - D3DDP2OP_INDEXEDTRIANGLESTRIP = 20, - D3DDP2OP_TRIANGLEFAN = 21, - D3DDP2OP_INDEXEDTRIANGLEFAN = 22, - D3DDP2OP_TRIANGLEFAN_IMM = 23, - D3DDP2OP_LINELIST_IMM = 24, - D3DDP2OP_TEXTURESTAGESTATE = 25, // Has edge flags and called from Execute - D3DDP2OP_INDEXEDTRIANGLELIST2 = 26, - D3DDP2OP_INDEXEDLINELIST2 = 27, - D3DDP2OP_VIEWPORTINFO = 28, - D3DDP2OP_WINFO = 29, -// two below are for pre-DX7 interface apps running DX7 driver - D3DDP2OP_SETPALETTE = 30, - D3DDP2OP_UPDATEPALETTE = 31, -#if(DIRECT3D_VERSION >= 0x0700) - // New for DX7 - D3DDP2OP_ZRANGE = 32, - D3DDP2OP_SETMATERIAL = 33, - D3DDP2OP_SETLIGHT = 34, - D3DDP2OP_CREATELIGHT = 35, - D3DDP2OP_SETTRANSFORM = 36, - D3DDP2OP_TEXBLT = 38, - D3DDP2OP_STATESET = 39, - D3DDP2OP_SETPRIORITY = 40, -#endif /* DIRECT3D_VERSION >= 0x0700 */ - D3DDP2OP_SETRENDERTARGET = 41, - D3DDP2OP_CLEAR = 42, -#if(DIRECT3D_VERSION >= 0x0700) - D3DDP2OP_SETTEXLOD = 43, - D3DDP2OP_SETCLIPPLANE = 44, -#endif /* DIRECT3D_VERSION >= 0x0700 */ -#if(DIRECT3D_VERSION >= 0x0800) - D3DDP2OP_CREATEVERTEXSHADER = 45, - D3DDP2OP_DELETEVERTEXSHADER = 46, - D3DDP2OP_SETVERTEXSHADER = 47, - D3DDP2OP_SETVERTEXSHADERCONST = 48, - D3DDP2OP_SETSTREAMSOURCE = 49, - D3DDP2OP_SETSTREAMSOURCEUM = 50, - D3DDP2OP_SETINDICES = 51, - D3DDP2OP_DRAWPRIMITIVE = 52, - D3DDP2OP_DRAWINDEXEDPRIMITIVE = 53, - D3DDP2OP_CREATEPIXELSHADER = 54, - D3DDP2OP_DELETEPIXELSHADER = 55, - D3DDP2OP_SETPIXELSHADER = 56, - D3DDP2OP_SETPIXELSHADERCONST = 57, - D3DDP2OP_CLIPPEDTRIANGLEFAN = 58, - D3DDP2OP_DRAWPRIMITIVE2 = 59, - D3DDP2OP_DRAWINDEXEDPRIMITIVE2= 60, - D3DDP2OP_DRAWRECTPATCH = 61, - D3DDP2OP_DRAWTRIPATCH = 62, - D3DDP2OP_VOLUMEBLT = 63, - D3DDP2OP_BUFFERBLT = 64, - D3DDP2OP_MULTIPLYTRANSFORM = 65, - D3DDP2OP_ADDDIRTYRECT = 66, - D3DDP2OP_ADDDIRTYBOX = 67, -#endif /* DIRECT3D_VERSION >= 0x0800 */ -#if(DIRECT3D_VERSION >= 0x0900) - D3DDP2OP_CREATEVERTEXSHADERDECL = 71, - D3DDP2OP_DELETEVERTEXSHADERDECL = 72, - D3DDP2OP_SETVERTEXSHADERDECL = 73, - D3DDP2OP_CREATEVERTEXSHADERFUNC = 74, - D3DDP2OP_DELETEVERTEXSHADERFUNC = 75, - D3DDP2OP_SETVERTEXSHADERFUNC = 76, - D3DDP2OP_SETVERTEXSHADERCONSTI = 77, - D3DDP2OP_SETSCISSORRECT = 79, - D3DDP2OP_SETSTREAMSOURCE2 = 80, - D3DDP2OP_BLT = 81, - D3DDP2OP_COLORFILL = 82, - D3DDP2OP_SETVERTEXSHADERCONSTB = 83, - D3DDP2OP_CREATEQUERY = 84, - D3DDP2OP_SETRENDERTARGET2 = 85, - D3DDP2OP_SETDEPTHSTENCIL = 86, - D3DDP2OP_RESPONSECONTINUE = 87, /* Can come only from driver */ - D3DDP2OP_RESPONSEQUERY = 88, /* Can come only from driver */ - D3DDP2OP_GENERATEMIPSUBLEVELS = 89, - D3DDP2OP_DELETEQUERY = 90, - D3DDP2OP_ISSUEQUERY = 91, - D3DDP2OP_SETPIXELSHADERCONSTI = 93, - D3DDP2OP_SETPIXELSHADERCONSTB = 94, - D3DDP2OP_SETSTREAMSOURCEFREQ = 95, - D3DDP2OP_SURFACEBLT = 96, - D3DDP2OP_SETCONVOLUTIONKERNELMONO = 97, - D3DDP2OP_COMPOSERECTS = 98, -#endif /* DIRECT3D_VERSION >= 0x0900 */ - -} D3DHAL_DP2OPERATION; - -// -// DrawPrimitives2 point primitives -// - -typedef struct _D3DHAL_DP2POINTS -{ - WORD wCount; - WORD wVStart; -} D3DHAL_DP2POINTS, *LPD3DHAL_DP2POINTS; - -// -// DrawPrimitives2 line primitives -// - -typedef struct _D3DHAL_DP2STARTVERTEX -{ - WORD wVStart; -} D3DHAL_DP2STARTVERTEX, *LPD3DHAL_DP2STARTVERTEX; - -typedef struct _D3DHAL_DP2LINELIST -{ - WORD wVStart; -} D3DHAL_DP2LINELIST, *LPD3DHAL_DP2LINELIST; - -typedef struct _D3DHAL_DP2INDEXEDLINELIST -{ - WORD wV1; - WORD wV2; -} D3DHAL_DP2INDEXEDLINELIST, *LPD3DHAL_DP2INDEXEDLINELIST; - -typedef struct _D3DHAL_DP2LINESTRIP -{ - WORD wVStart; -} D3DHAL_DP2LINESTRIP, *LPD3DHAL_DP2LINESTRIP; - -typedef struct _D3DHAL_DP2INDEXEDLINESTRIP -{ - WORD wV[2]; -} D3DHAL_DP2INDEXEDLINESTRIP, *LPD3DHAL_DP2INDEXEDLINESTRIP; - -// -// DrawPrimitives2 triangle primitives -// - -typedef struct _D3DHAL_DP2TRIANGLELIST -{ - WORD wVStart; -} D3DHAL_DP2TRIANGLELIST, *LPD3DHAL_DP2TRIANGLELIST; - -typedef struct _D3DHAL_DP2INDEXEDTRIANGLELIST -{ - WORD wV1; - WORD wV2; - WORD wV3; - WORD wFlags; -} D3DHAL_DP2INDEXEDTRIANGLELIST, *LPD3DHAL_DP2INDEXEDTRIANGLELIST; - -typedef struct _D3DHAL_DP2INDEXEDTRIANGLELIST2 -{ - WORD wV1; - WORD wV2; - WORD wV3; -} D3DHAL_DP2INDEXEDTRIANGLELIST2, *LPD3DHAL_DP2INDEXEDTRIANGLELIST2; - -typedef struct _D3DHAL_DP2TRIANGLESTRIP -{ - WORD wVStart; -} D3DHAL_DP2TRIANGLESTRIP, *LPD3DHAL_DP2TRIANGLESTRIP; - -typedef struct _D3DHAL_DP2INDEXEDTRIANGLESTRIP -{ - WORD wV[3]; -} D3DHAL_DP2INDEXEDTRIANGLESTRIP, *LPD3DHAL_DP2INDEXEDTRIANGLESTRIP; - -typedef struct _D3DHAL_DP2TRIANGLEFAN -{ - WORD wVStart; -} D3DHAL_DP2TRIANGLEFAN, *LPD3DHAL_DP2TRIANGLEFAN; - -typedef struct _D3DHAL_DP2INDEXEDTRIANGLEFAN -{ - WORD wV[3]; -} D3DHAL_DP2INDEXEDTRIANGLEFAN, *LPD3DHAL_DP2INDEXEDTRIANGLEFAN; - -typedef struct _D3DHAL_DP2TRIANGLEFAN_IMM -{ - DWORD dwEdgeFlags; -} D3DHAL_DP2TRIANGLEFAN_IMM; - -typedef D3DHAL_DP2TRIANGLEFAN_IMM *LPD3DHAL_DP2TRIANGLEFAN_IMM; - -// -// DrawPrimitives2 Renderstate changes -// - -typedef struct _D3DHAL_DP2RENDERSTATE -{ - D3DRENDERSTATETYPE RenderState; - union - { - D3DVALUE dvState; - DWORD dwState; - }; -} D3DHAL_DP2RENDERSTATE; -typedef D3DHAL_DP2RENDERSTATE * LPD3DHAL_DP2RENDERSTATE; - -typedef struct _D3DHAL_DP2TEXTURESTAGESTATE -{ - WORD wStage; - WORD TSState; - DWORD dwValue; -} D3DHAL_DP2TEXTURESTAGESTATE; -typedef D3DHAL_DP2TEXTURESTAGESTATE *LPD3DHAL_DP2TEXTURESTAGESTATE; - -typedef struct _D3DHAL_DP2VIEWPORTINFO -{ - DWORD dwX; - DWORD dwY; - DWORD dwWidth; - DWORD dwHeight; -} D3DHAL_DP2VIEWPORTINFO; -typedef D3DHAL_DP2VIEWPORTINFO *LPD3DHAL_DP2VIEWPORTINFO; - -typedef struct _D3DHAL_DP2WINFO -{ - D3DVALUE dvWNear; - D3DVALUE dvWFar; -} D3DHAL_DP2WINFO; -typedef D3DHAL_DP2WINFO *LPD3DHAL_DP2WINFO; - -typedef struct _D3DHAL_DP2SETPALETTE -{ - DWORD dwPaletteHandle; - DWORD dwPaletteFlags; - DWORD dwSurfaceHandle; -} D3DHAL_DP2SETPALETTE; -typedef D3DHAL_DP2SETPALETTE *LPD3DHAL_DP2SETPALETTE; - -typedef struct _D3DHAL_DP2UPDATEPALETTE -{ - DWORD dwPaletteHandle; - WORD wStartIndex; - WORD wNumEntries; -} D3DHAL_DP2UPDATEPALETTE; -typedef D3DHAL_DP2UPDATEPALETTE *LPD3DHAL_DP2UPDATEPALETTE; - -typedef struct _D3DHAL_DP2SETRENDERTARGET -{ - DWORD hRenderTarget; - DWORD hZBuffer; -} D3DHAL_DP2SETRENDERTARGET; -typedef D3DHAL_DP2SETRENDERTARGET *LPD3DHAL_DP2SETRENDERTARGET; - -#if(DIRECT3D_VERSION >= 0x0700) -// Values for dwOperations in the D3DHAL_DP2STATESET -#define D3DHAL_STATESETBEGIN 0 -#define D3DHAL_STATESETEND 1 -#define D3DHAL_STATESETDELETE 2 -#define D3DHAL_STATESETEXECUTE 3 -#define D3DHAL_STATESETCAPTURE 4 -#endif /* DIRECT3D_VERSION >= 0x0700 */ -#if(DIRECT3D_VERSION >= 0x0800) -#define D3DHAL_STATESETCREATE 5 -#endif /* DIRECT3D_VERSION >= 0x0800 */ -#if(DIRECT3D_VERSION >= 0x0700) - -typedef struct _D3DHAL_DP2STATESET -{ - DWORD dwOperation; - DWORD dwParam; // State set handle passed with D3DHAL_STATESETBEGIN, - // D3DHAL_STATESETEXECUTE, D3DHAL_STATESETDELETE - // D3DHAL_STATESETCAPTURE - D3DSTATEBLOCKTYPE sbType; // Type use with D3DHAL_STATESETBEGIN/END -} D3DHAL_DP2STATESET; -typedef D3DHAL_DP2STATESET *LPD3DHAL_DP2STATESET; -// -// T&L Hal specific stuff -// -typedef struct _D3DHAL_DP2ZRANGE -{ - D3DVALUE dvMinZ; - D3DVALUE dvMaxZ; -} D3DHAL_DP2ZRANGE; -typedef D3DHAL_DP2ZRANGE *LPD3DHAL_DP2ZRANGE; - -typedef D3DMATERIAL7 D3DHAL_DP2SETMATERIAL, *LPD3DHAL_DP2SETMATERIAL; - -// Values for dwDataType in D3DHAL_DP2SETLIGHT -#define D3DHAL_SETLIGHT_ENABLE 0 -#define D3DHAL_SETLIGHT_DISABLE 1 -// If this is set, light data will be passed in after the -// D3DLIGHT7 structure -#define D3DHAL_SETLIGHT_DATA 2 - -typedef struct _D3DHAL_DP2SETLIGHT -{ - DWORD dwIndex; - DWORD dwDataType; -} D3DHAL_DP2SETLIGHT; -typedef D3DHAL_DP2SETLIGHT *LPD3DHAL_DP2SETLIGHT; - -typedef struct _D3DHAL_DP2SETCLIPPLANE -{ - DWORD dwIndex; - D3DVALUE plane[4]; -} D3DHAL_DP2SETCLIPPLANE; -typedef D3DHAL_DP2SETCLIPPLANE *LPD3DHAL_DP2SETCLIPPLANE; - -typedef struct _D3DHAL_DP2CREATELIGHT -{ - DWORD dwIndex; -} D3DHAL_DP2CREATELIGHT; -typedef D3DHAL_DP2CREATELIGHT *LPD3DHAL_DP2CREATELIGHT; - -typedef struct _D3DHAL_DP2SETTRANSFORM -{ - D3DTRANSFORMSTATETYPE xfrmType; - D3DMATRIX matrix; -} D3DHAL_DP2SETTRANSFORM; -typedef D3DHAL_DP2SETTRANSFORM *LPD3DHAL_DP2SETTRANSFORM; - -typedef struct _D3DHAL_DP2MULTIPLYTRANSFORM -{ - D3DTRANSFORMSTATETYPE xfrmType; - D3DMATRIX matrix; -} D3DHAL_DP2MULTIPLYTRANSFORM; -typedef D3DHAL_DP2MULTIPLYTRANSFORM *LPD3DHAL_DP2MULTIPLYTRANSFORM; - -typedef struct _D3DHAL_DP2EXT -{ - DWORD dwExtToken; - DWORD dwSize; -} D3DHAL_DP2EXT; -typedef D3DHAL_DP2EXT *LPD3DHAL_DP2EXT; - -typedef struct _D3DHAL_DP2TEXBLT -{ - DWORD dwDDDestSurface;// dest surface - DWORD dwDDSrcSurface; // src surface - POINT pDest; - RECTL rSrc; // src rect - DWORD dwFlags; // blt flags -} D3DHAL_DP2TEXBLT; -typedef D3DHAL_DP2TEXBLT *LPD3DHAL_DP2TEXBLT; - -typedef struct _D3DHAL_DP2SETPRIORITY -{ - DWORD dwDDSurface; - DWORD dwPriority; -} D3DHAL_DP2SETPRIORITY; -typedef D3DHAL_DP2SETPRIORITY *LPD3DHAL_DP2SETPRIORITY; -#endif /* DIRECT3D_VERSION >= 0x0700 */ - -typedef struct _D3DHAL_DP2CLEAR -{ - // dwFlags can contain D3DCLEAR_TARGET, D3DCLEAR_ZBUFFER, and/or D3DCLEAR_STENCIL - DWORD dwFlags; // in: surfaces to clear - DWORD dwFillColor; // in: Color value for rtarget - D3DVALUE dvFillDepth; // in: Depth value for Z buffer (0.0-1.0) - DWORD dwFillStencil; // in: value used to clear stencil buffer - RECT Rects[1]; // in: Rectangles to clear -} D3DHAL_DP2CLEAR; -typedef D3DHAL_DP2CLEAR *LPD3DHAL_DP2CLEAR; - - -#if(DIRECT3D_VERSION >= 0x0700) -typedef struct _D3DHAL_DP2SETTEXLOD -{ - DWORD dwDDSurface; - DWORD dwLOD; -} D3DHAL_DP2SETTEXLOD; -typedef D3DHAL_DP2SETTEXLOD *LPD3DHAL_DP2SETTEXLOD; -#endif /* DIRECT3D_VERSION >= 0x0700 */ - -#if(DIRECT3D_VERSION >= 0x0800) - -// Used by SetVertexShader, DeleteVertexShader -// SetVertexShaderDecl, DeleteVertexShaderDecl, -// SetVertexShaderFunc, DeleteVertexShaderFunc -typedef struct _D3DHAL_DP2VERTEXSHADER -{ - // Vertex shader handle. - // The handle could be 0, meaning that the current vertex shader is invalid - // (not set). When driver recieves handle 0, it should invalidate all - // streams pointer -#endif /* DIRECT3D_VERSION >= 0x0800 */ -#if(DIRECT3D_VERSION >= 0x0900) - // When SetVertexShaderDecl is used, the dwHandle could be a legacy FVF - // handle or a DX9 declaration handle. Bit 0 is set for DX9 declaration. - // - // When SetVertexShaderFunc is used and dwHandle is zero, this means fixed - // function pipeline -#endif /* DIRECT3D_VERSION >= 0x0900 */ -#if(DIRECT3D_VERSION >= 0x0800) - DWORD dwHandle; -} D3DHAL_DP2VERTEXSHADER; -typedef D3DHAL_DP2VERTEXSHADER *LPD3DHAL_DP2VERTEXSHADER; - -typedef struct _D3DHAL_DP2CREATEVERTEXSHADER -{ - DWORD dwHandle; // Shader handle - DWORD dwDeclSize; // Shader declaration size in bytes - DWORD dwCodeSize; // Shader code size in bytes - // Declaration follows - // Shader code follows -} D3DHAL_DP2CREATEVERTEXSHADER; -typedef D3DHAL_DP2CREATEVERTEXSHADER *LPD3DHAL_DP2CREATEVERTEXSHADER; - -// Used with all types of vertex shader constants -typedef struct _D3DHAL_DP2SETVERTEXSHADERCONST -{ - DWORD dwRegister; // Const register to start copying - DWORD dwCount; // Number of 4-float vectors to copy for D3DDP2OP_SETVERTEXSHADERCONST - // Number of 4-integer vectors to copy for D3DDP2OP_SETVERTEXSHADERCONSTI - // Number of BOOL values to copy for D3DDP2OP_SETVERTEXSHADERCONSTB - // Data follows -} D3DHAL_DP2SETVERTEXSHADERCONST; -typedef D3DHAL_DP2SETVERTEXSHADERCONST *LPD3DHAL_DP2SETVERTEXSHADERCONST; - -typedef struct _D3DHAL_DP2SETSTREAMSOURCE -{ - DWORD dwStream; // Stream index, starting from zero - DWORD dwVBHandle; // Vertex buffer handle - DWORD dwStride; // Vertex size in bytes -} D3DHAL_DP2SETSTREAMSOURCE; -typedef D3DHAL_DP2SETSTREAMSOURCE *LPD3DHAL_DP2SETSTREAMSOURCE; - -typedef struct _D3DHAL_DP2SETSTREAMSOURCEUM -{ - DWORD dwStream; // Stream index, starting from zero - DWORD dwStride; // Vertex size in bytes -} D3DHAL_DP2SETSTREAMSOURCEUM; -typedef D3DHAL_DP2SETSTREAMSOURCEUM *LPD3DHAL_DP2SETSTREAMSOURCEUM; - -typedef struct _D3DHAL_DP2SETINDICES -{ - DWORD dwVBHandle; // Index buffer handle - DWORD dwStride; // Index size in bytes (2 or 4) -} D3DHAL_DP2SETINDICES; -typedef D3DHAL_DP2SETINDICES *LPD3DHAL_DP2SETINDICES; - -typedef struct _D3DHAL_DP2DRAWPRIMITIVE -{ - D3DPRIMITIVETYPE primType; - DWORD VStart; - DWORD PrimitiveCount; -} D3DHAL_DP2DRAWPRIMITIVE; -typedef D3DHAL_DP2DRAWPRIMITIVE *LPD3DHAL_DP2DRAWPRIMITIVE; - -typedef struct _D3DHAL_DP2DRAWINDEXEDPRIMITIVE -{ - D3DPRIMITIVETYPE primType; - INT BaseVertexIndex; // Vertex which corresponds to index 0 - DWORD MinIndex; // Min vertex index in the vertex buffer - DWORD NumVertices; // Number of vertices starting from MinIndex - DWORD StartIndex; // Start index in the index buffer - DWORD PrimitiveCount; -} D3DHAL_DP2DRAWINDEXEDPRIMITIVE; -typedef D3DHAL_DP2DRAWINDEXEDPRIMITIVE *LPD3DHAL_DP2DRAWINDEXEDPRIMITIVE; - -typedef struct _D3DHAL_CLIPPEDTRIANGLEFAN -{ - DWORD FirstVertexOffset; // Offset in bytes in the current stream 0 - DWORD dwEdgeFlags; - DWORD PrimitiveCount; -} D3DHAL_CLIPPEDTRIANGLEFAN; -typedef D3DHAL_CLIPPEDTRIANGLEFAN *LPD3DHAL_CLIPPEDTRIANGLEFAN; - -typedef struct _D3DHAL_DP2DRAWPRIMITIVE2 -{ - D3DPRIMITIVETYPE primType; - DWORD FirstVertexOffset; // Offset in bytes in the stream 0 - DWORD PrimitiveCount; -} D3DHAL_DP2DRAWPRIMITIVE2; -typedef D3DHAL_DP2DRAWPRIMITIVE2 *LPD3DHAL_DP2DRAWPRIMITIVE2; - -typedef struct _D3DHAL_DP2DRAWINDEXEDPRIMITIVE2 -{ - D3DPRIMITIVETYPE primType; - INT BaseVertexOffset; // Stream 0 offset of the vertex which - // corresponds to index 0. This offset could be - // negative, but when an index is added to the - // offset the result is positive - DWORD MinIndex; // Min vertex index in the vertex buffer - DWORD NumVertices; // Number of vertices starting from MinIndex - DWORD StartIndexOffset; // Offset of the start index in the index buffer - DWORD PrimitiveCount; // Number of triangles (points, lines) -} D3DHAL_DP2DRAWINDEXEDPRIMITIVE2; -typedef D3DHAL_DP2DRAWINDEXEDPRIMITIVE2 *LPD3DHAL_DP2DRAWINDEXEDPRIMITIVE2; - -// Used by SetPixelShader and DeletePixelShader -typedef struct _D3DHAL_DP2PIXELSHADER -{ - // Pixel shader handle. - // The handle could be 0, meaning that the current pixel shader is invalid - // (not set). - DWORD dwHandle; -} D3DHAL_DP2PIXELSHADER; -typedef D3DHAL_DP2PIXELSHADER *LPD3DHAL_DP2PIXELSHADER; - -typedef struct _D3DHAL_DP2CREATEPIXELSHADER -{ - DWORD dwHandle; // Shader handle - DWORD dwCodeSize; // Shader code size in bytes - // Shader code follows -} D3DHAL_DP2CREATEPIXELSHADER; -typedef D3DHAL_DP2CREATEPIXELSHADER *LPD3DHAL_DP2CREATEPIXELSHADER; - -typedef struct _D3DHAL_DP2SETPIXELSHADERCONST -{ - DWORD dwRegister; // Const register to start copying - DWORD dwCount; // Number of 4-float vectors to copy for D3DDP2OP_SETPIXELSHADERCONST - // Number of 4-integer vectors to copy for D3DDP2OP_SETPIXELSHADERCONSTI - // Number of BOOL values to copy for D3DDP2OP_SETPIXELSHADERCONSTB - // Data follows -} D3DHAL_DP2SETPIXELSHADERCONST; -typedef D3DHAL_DP2SETPIXELSHADERCONST *LPD3DHAL_DP2SETPIXELSHADERCONST; - -// Flags that can be supplied to DRAWRECTPATCH and DRAWTRIPATCH -#define RTPATCHFLAG_HASSEGS 0x00000001L -#define RTPATCHFLAG_HASINFO 0x00000002L - -typedef struct _D3DHAL_DP2DRAWRECTPATCH -{ - DWORD Handle; - DWORD Flags; - // Optionally followed by D3DFLOAT[4] NumSegments and/or D3DRECTPATCH_INFO -} D3DHAL_DP2DRAWRECTPATCH; -typedef D3DHAL_DP2DRAWRECTPATCH *LPD3DHAL_DP2DRAWRECTPATCH; - -typedef struct _D3DHAL_DP2DRAWTRIPATCH -{ - DWORD Handle; - DWORD Flags; - // Optionally followed by D3DFLOAT[3] NumSegments and/or D3DTRIPATCH_INFO -} D3DHAL_DP2DRAWTRIPATCH; -typedef D3DHAL_DP2DRAWTRIPATCH *LPD3DHAL_DP2DRAWTRIPATCH; - -typedef struct _D3DHAL_DP2VOLUMEBLT -{ - DWORD dwDDDestSurface;// dest surface - DWORD dwDDSrcSurface; // src surface - DWORD dwDestX; // dest X (width) - DWORD dwDestY; // dest Y (height) - DWORD dwDestZ; // dest Z (depth) - D3DBOX srcBox; // src box - DWORD dwFlags; // blt flags -} D3DHAL_DP2VOLUMEBLT; -typedef D3DHAL_DP2VOLUMEBLT *LPD3DHAL_DP2VOLUMEBLT; - -typedef struct _D3DHAL_DP2BUFFERBLT -{ - DWORD dwDDDestSurface; // dest surface - DWORD dwDDSrcSurface; // src surface - DWORD dwOffset; // Offset in the dest surface (in BYTES) - D3DRANGE rSrc; // src range - DWORD dwFlags; // blt flags -} D3DHAL_DP2BUFFERBLT; -typedef D3DHAL_DP2BUFFERBLT *LPD3DHAL_DP2BUFFERBLT; - -typedef struct _D3DHAL_DP2ADDDIRTYRECT -{ - DWORD dwSurface; // Driver managed surface - RECTL rDirtyArea; // Area marked dirty -} D3DHAL_DP2ADDDIRTYRECT; -typedef D3DHAL_DP2ADDDIRTYRECT *LPD3DHAL_DP2ADDDIRTYRECT; - -typedef struct _D3DHAL_DP2ADDDIRTYBOX -{ - DWORD dwSurface; // Driver managed volume - D3DBOX DirtyBox; // Box marked dirty -} D3DHAL_DP2ADDDIRTYBOX; -typedef D3DHAL_DP2ADDDIRTYBOX *LPD3DHAL_DP2ADDDIRTYBOX; - -#endif /* DIRECT3D_VERSION >= 0x0800 */ - -#if(DIRECT3D_VERSION >= 0x0900) - -typedef struct _D3DHAL_DP2CREATEVERTEXSHADERDECL -{ - DWORD dwHandle; // Shader function handle - DWORD dwNumVertexElements; // Number of vertex elements - // D3DVERTEXELEMENT9 VertexElements[]; Vertex elements follow -} D3DHAL_DP2CREATEVERTEXSHADERDECL ; -typedef D3DHAL_DP2CREATEVERTEXSHADERDECL *LPD3DHAL_DP2CREATEVERTEXSHADERDECL; - -typedef struct _D3DHAL_DP2CREATEVERTEXSHADERFUNC -{ - DWORD dwHandle; // Shader function handle - DWORD dwSize; // Shader function size in bytes - // Shader declaration follows -} D3DHAL_DP2CREATEVERTEXSHADERFUNC ; -typedef D3DHAL_DP2CREATEVERTEXSHADERFUNC *LPD3DHAL_DP2CREATEVERTEXSHADERFUNC; - -typedef struct _D3DHAL_DP2SETSTREAMSOURCE2 -{ - DWORD dwStream; // Stream index, starting from zero - DWORD dwVBHandle; // Vertex buffer handle - DWORD dwOffset; // Offset of the first vertex size in bytes - DWORD dwStride; // Vertex size in bytes -} D3DHAL_DP2SETSTREAMSOURCE2; -typedef D3DHAL_DP2SETSTREAMSOURCE2 *LPD3DHAL_DP2SETSTREAMSOURCE2; - -typedef struct _D3DHAL_DP2SETSTREAMSOURCEFREQ -{ - DWORD dwStream; // Stream index, starting from zero - DWORD dwDivider; // Stream source divider -} D3DHAL_DP2SETSTREAMSOURCEFREQ; -typedef D3DHAL_DP2SETSTREAMSOURCEFREQ *LPD3DHAL_DP2SETSTREAMSOURCEFREQ; - -#define D3DHAL_ROW_WEIGHTS 1 -#define D3DHAL_COL_WEIGHTS 2 -typedef struct _D3DHAL_DP2SETCONVOLUTIONKERNELMONO -{ - DWORD dwWidth; // Kernel width - DWORD dwHeight; // Kernel height - DWORD dwFlags; - // If dwFlags & D3DHAL_ROW_WEIGHTS, then width floats follow. Otherwise row weights are 1.0. - // If dwFlags & D3DHAL_COL_WEIGHTS, then height floats follow. Otherwise column weights are 1.0. -} D3DHAL_DP2SETCONVOLUTIONKERNELMONO; -typedef D3DHAL_DP2SETCONVOLUTIONKERNELMONO *LPD3DHAL_DP2SETCONVOLUTIONKERNELMONO; - -typedef struct _D3DHAL_DP2COMPOSERECTS -{ - DWORD SrcSurfaceHandle; - DWORD DstSurfaceHandle; - DWORD SrcRectDescsVBHandle; - UINT NumRects; - DWORD DstRectDescsVBHandle; - D3DCOMPOSERECTSOP Operation; - INT XOffset; - INT YOffset; -} D3DHAL_DP2COMPOSERECTS; -typedef D3DHAL_DP2COMPOSERECTS *LPD3DHAL_DP2COMPOSERECTS; - -typedef RECT D3DHAL_DP2SETSCISSORRECT; -typedef D3DHAL_DP2SETSCISSORRECT *LPD3DHAL_DP2SETSCISSORRECT; - -typedef struct _D3DHAL_DP2BLT -{ - DWORD dwSource; // Source surface - RECTL rSource; // Source rectangle - DWORD dwSourceMipLevel; // Miplevel of lightweight surface - DWORD dwDest; // Dest surface - RECTL rDest; // Dest rectangle - DWORD dwDestMipLevel; // Miplevel of lightweight surface - DWORD Flags; // Can be DP2BLT_POINT, DP2BLT_LINEAR -} D3DHAL_DP2BLT; -typedef D3DHAL_DP2BLT *LPD3DHAL_DP2BLT; - -#define DP2BLT_POINT 0x00000001L -#define DP2BLT_LINEAR 0x00000002L - -typedef struct _D3DHAL_DP2COLORFILL -{ - DWORD dwSurface; // Surface getting filled - RECTL rRect; // Surface dimensions to fill - D3DCOLOR Color; // A8R8G8B8 fill color -} D3DHAL_DP2COLORFILL; -typedef D3DHAL_DP2COLORFILL *LPD3DHAL_DP2COLORFILL; - -typedef struct _D3DHAL_DP2SURFACEBLT -{ - DWORD dwSource; // Source surface - RECTL rSource; // Source rectangle - DWORD dwSourceMipLevel; // Miplevel of lightweight surface - DWORD dwDest; // Dest surface - RECTL rDest; // Dest rectangle - DWORD dwDestMipLevel; // Miplevel of lightweight surface - DWORD Flags; // No flags currently defined -} D3DHAL_DP2SURFACEBLT; -typedef D3DHAL_DP2SURFACEBLT *LPD3DHAL_DP2SURFACEBLT; - -typedef D3DHAL_DP2SETVERTEXSHADERCONST D3DHAL_DP2SETVERTEXSHADERCONSTI; -typedef D3DHAL_DP2SETVERTEXSHADERCONST *LPD3DHAL_DP2SETVERTEXSHADERCONSTI; -typedef D3DHAL_DP2SETVERTEXSHADERCONST D3DHAL_DP2SETVERTEXSHADERCONSTB; -typedef D3DHAL_DP2SETVERTEXSHADERCONSTB *LPD3DHAL_DP2SETVERTEXSHADERCONSTB; - -typedef D3DHAL_DP2SETPIXELSHADERCONST D3DHAL_DP2SETPIXELSHADERCONSTI; -typedef D3DHAL_DP2SETPIXELSHADERCONST *LPD3DHAL_DP2SETPIXELSHADERCONSTI; -typedef D3DHAL_DP2SETPIXELSHADERCONST D3DHAL_DP2SETPIXELSHADERCONSTB; -typedef D3DHAL_DP2SETPIXELSHADERCONSTB *LPD3DHAL_DP2SETPIXELSHADERCONSTB; - -typedef struct _D3DHAL_DP2CREATEQUERY -{ - DWORD dwQueryID; - D3DQUERYTYPE QueryType; -} D3DHAL_DP2CREATEQUERY; -typedef D3DHAL_DP2CREATEQUERY *LPD3DHAL_DP2CREATEQUERY; - -typedef struct _D3DHAL_DP2DELETEQUERY -{ - DWORD dwQueryID; -} D3DHAL_DP2DELETEQUERY; -typedef D3DHAL_DP2DELETEQUERY *LPD3DHAL_DP2DELETEQUERY; - -typedef struct _D3DHAL_DP2ISSUEQUERY -{ - DWORD dwQueryID; - DWORD dwFlags; -} D3DHAL_DP2ISSUEQUERY; -typedef D3DHAL_DP2ISSUEQUERY *LPD3DHAL_DP2ISSUEQUERY; - -typedef struct _D3DHAL_DP2SETRENDERTARGET2 -{ - DWORD RTIndex; - DWORD hRenderTarget; -} D3DHAL_DP2SETRENDERTARGET2; -typedef D3DHAL_DP2SETRENDERTARGET2 *LPD3DHAL_DP2SETRENDERTARGET2; - -typedef struct _D3DHAL_DP2SETDEPTHSTENCIL -{ - DWORD hZBuffer; -} D3DHAL_DP2SETDEPTHSTENCIL; -typedef D3DHAL_DP2SETDEPTHSTENCIL *LPD3DHAL_DP2SETDEPTHSTENCIL; - -typedef struct _D3DHAL_DP2GENERATEMIPSUBLEVELS -{ - DWORD hSurface; - D3DTEXTUREFILTERTYPE Filter; -} D3DHAL_DP2GENERATEMIPSUBLEVELS; -typedef D3DHAL_DP2GENERATEMIPSUBLEVELS *LPD3DHAL_DP2GENERATEMIPSUBLEVELS; - -// -// Command structure for driver responses: -// - -typedef struct _D3DHAL_DP2RESPONSE -{ - BYTE bCommand; /* response/ command id */ - BYTE bReserved; - WORD wStateCount; /* count of responses to follow */ - DWORD dwTotalSize; /* total size of response (including the DP2REPONSE struct) to enable skipping over. */ -} D3DHAL_DP2RESPONSE, *LPD3DHAL_DP2RESPONSE; - -/* Begin Responses */ -typedef struct _D3DHAL_DP2RESPONSEQUERY -{ - DWORD dwQueryID; - DWORD dwSize; -} D3DHAL_DP2RESPONSEQUERY; -typedef D3DHAL_DP2RESPONSEQUERY *LPD3DHAL_DP2RESPONSEQUERY; -/* End Responses */ - -#endif /* DIRECT3D_VERSION >= 0x0900 */ - -typedef struct _D3DHAL_DRAWPRIMITIVES2DATA { - ULONG_PTR dwhContext; // in: Context handle - DWORD dwFlags; // in: flags - DWORD dwVertexType; // in: vertex type - LPDDRAWI_DDRAWSURFACE_LCL lpDDCommands; // in: vertex buffer command data - DWORD dwCommandOffset; // in: offset to start of vertex buffer commands - DWORD dwCommandLength; // in: number of bytes of command data - union - { // based on D3DHALDP2_USERMEMVERTICES flag - LPDDRAWI_DDRAWSURFACE_LCL lpDDVertex;// in: surface containing vertex data - LPVOID lpVertices; // in: User mode pointer to vertices - }; - DWORD dwVertexOffset; // in: offset to start of vertex data - DWORD dwVertexLength; // in: number of vertices of vertex data - DWORD dwReqVertexBufSize; // in: number of bytes required for the next vertex buffer - DWORD dwReqCommandBufSize; // in: number of bytes required for the next commnand buffer - LPDWORD lpdwRStates; // in: Pointer to the array where render states are updated - union - { - DWORD dwVertexSize; // in: Size of each vertex in bytes - HRESULT ddrval; // out: return value - }; - DWORD dwErrorOffset; // out: offset in lpDDCommands to - // first D3DHAL_COMMAND not handled -} D3DHAL_DRAWPRIMITIVES2DATA; -typedef D3DHAL_DRAWPRIMITIVES2DATA *LPD3DHAL_DRAWPRIMITIVES2DATA; - -// Macros to access shader binary code -#define D3DSI_GETREGNUM(token) (token & D3DSP_REGNUM_MASK) -#define D3DSI_GETOPCODE(command) (command & D3DSI_OPCODE_MASK) -#define D3DSI_GETWRITEMASK(token) (token & D3DSP_WRITEMASK_ALL) -#define D3DVS_GETSWIZZLECOMP(source, component) (source >> ((component << 1) + 16) & 0x3) -#define D3DVS_GETSWIZZLE(token) (token & D3DVS_SWIZZLE_MASK) -#define D3DVS_GETSRCMODIFIER(token) (token & D3DSP_SRCMOD_MASK) -#define D3DVS_GETADDRESSMODE(token) (token & D3DVS_ADDRESSMODE_MASK) - -#if(DIRECT3D_VERSION < 0x0900) - -#define D3DSI_GETREGTYPE(token) ((D3DSHADER_PARAM_REGISTER_TYPE)(token & D3DSP_REGTYPE_MASK)) - -#else - -#define D3DSI_GETREGTYPE(token) ((D3DSHADER_PARAM_REGISTER_TYPE)(((token & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) | \ - ((token & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2))) -#define D3DSI_GETUSAGE(token) ((token & D3DSP_DCL_USAGE_MASK) >> D3DSP_DCL_USAGE_SHIFT) -#define D3DSI_GETUSAGEINDEX(token) ((token & D3DSP_DCL_USAGEINDEX_MASK) >> D3DSP_DCL_USAGEINDEX_SHIFT) -#define D3DSI_GETINSTLENGTH(token) ((token & D3DSI_INSTLENGTH_MASK) >> D3DSI_INSTLENGTH_SHIFT) -#define D3DSI_GETCOMPARISON(token) ((D3DSHADER_COMPARISON)((token & D3DSHADER_COMPARISON_MASK) >> D3DSHADER_COMPARISON_SHIFT)) -#define D3DSI_GETREGISTERPROPERTIES(token) (token & D3DSP_REGISTERPROPERTIES_MASK) -#define D3DSI_GETTEXTURETYPE(token) (token & D3DSP_TEXTURETYPE_MASK) -#define D3DSI_GETDSTMODIFIER(token) (token & D3DSP_DSTMOD_MASK) -#define D3DSI_GETSWIZZLECOMP(source, component) (source >> ((component << 1) + 16) & 0x3) -#define D3DSI_GETSWIZZLE(token) (token & D3DVS_SWIZZLE_MASK) -#define D3DSI_GETSRCMODIFIER(token) (token & D3DSP_SRCMOD_MASK) -#define D3DSI_GETADDRESSMODE(token) (token & D3DVS_ADDRESSMODE_MASK) - -#ifdef __cplusplus -// This gets regtype, and also maps D3DSPR_CONSTn to D3DSPR_CONST (for easier parsing) -inline D3DSHADER_PARAM_REGISTER_TYPE D3DSI_GETREGTYPE_RESOLVING_CONSTANTS(DWORD token) -{ - D3DSHADER_PARAM_REGISTER_TYPE RegType = D3DSI_GETREGTYPE(token); - switch(RegType) - { - case D3DSPR_CONST4: - case D3DSPR_CONST3: - case D3DSPR_CONST2: - return D3DSPR_CONST; - default: - return RegType; - } -} - -// The inline function below retrieves register number for an opcode, -// taking into account that: if the type is a -// D3DSPR_CONSTn, the register number needs to be remapped. -// -// D3DSPR_CONST is for c0-c2047 -// D3DSPR_CONST2 is for c2048-c4095 -// D3DSPR_CONST3 is for c4096-c6143 -// D3DSPR_CONST4 is for c6144-c8191 -// -// For example if the instruction token specifies type D3DSPR_CONST4, reg# 3, -// the register number retrieved is 6147. -// For other register types, the register number is just returned unchanged. -inline UINT D3DSI_GETREGNUM_RESOLVING_CONSTANTS(DWORD token) -{ - D3DSHADER_PARAM_REGISTER_TYPE RegType = D3DSI_GETREGTYPE(token); - UINT RegNum = D3DSI_GETREGNUM(token); - switch(RegType) - { - case D3DSPR_CONST4: - return RegNum + 6144; - case D3DSPR_CONST3: - return RegNum + 4096; - case D3DSPR_CONST2: - return RegNum + 2048; - default: - return RegNum; - } -} -#endif // __cplusplus - -#endif - -// Indicates that the lpVertices field in the DrawPrimitives2 data is -// valid, i.e. user allocated memory. -#define D3DHALDP2_USERMEMVERTICES 0x00000001L -// Indicates that the command buffer and vertex buffer are a system memory execute buffer -// resulting from the use of the Execute buffer API. -#define D3DHALDP2_EXECUTEBUFFER 0x00000002L -// The swap flags indicate if it is OK for the driver to swap the submitted buffers with new -// buffers and asyncronously work on the submitted buffers. -#define D3DHALDP2_SWAPVERTEXBUFFER 0x00000004L -#define D3DHALDP2_SWAPCOMMANDBUFFER 0x00000008L -// The requested flags are present if the new buffers which the driver can allocate need to be -// of atleast a given size. If any of these flags are set, the corresponding dwReq* field in -// D3DHAL_DRAWPRIMITIVES2DATA will also be set with the requested size in bytes. -#define D3DHALDP2_REQVERTEXBUFSIZE 0x00000010L -#define D3DHALDP2_REQCOMMANDBUFSIZE 0x00000020L -// These flags are set by the driver upon return from DrawPrimitives2 indicating if the new -// buffers are not in system memory. -#define D3DHALDP2_VIDMEMVERTEXBUF 0x00000040L -#define D3DHALDP2_VIDMEMCOMMANDBUF 0x00000080L - -// Used by the driver to ask runtime to parse the execute buffer -#define D3DERR_COMMAND_UNPARSED MAKE_DDHRESULT(3000) - -typedef DWORD (CALLBACK *LPD3DHAL_CLEAR2CB) (LPD3DHAL_CLEAR2DATA); -typedef DWORD (CALLBACK *LPD3DHAL_VALIDATETEXTURESTAGESTATECB)(LPD3DHAL_VALIDATETEXTURESTAGESTATEDATA); -typedef DWORD (CALLBACK *LPD3DHAL_DRAWPRIMITIVES2CB) (LPD3DHAL_DRAWPRIMITIVES2DATA); - -typedef struct _D3DHAL_CALLBACKS3 -{ - DWORD dwSize; // size of struct - DWORD dwFlags; // flags for callbacks - LPD3DHAL_CLEAR2CB Clear2; - LPVOID lpvReserved; - LPD3DHAL_VALIDATETEXTURESTAGESTATECB ValidateTextureStageState; - LPD3DHAL_DRAWPRIMITIVES2CB DrawPrimitives2; -} D3DHAL_CALLBACKS3; -typedef D3DHAL_CALLBACKS3 *LPD3DHAL_CALLBACKS3; -#define D3DHAL_CALLBACKS3SIZE sizeof(D3DHAL_CALLBACKS3) - -// bit definitions for D3DHAL -#define D3DHAL3_CB32_CLEAR2 0x00000001L -#define D3DHAL3_CB32_RESERVED 0x00000002L -#define D3DHAL3_CB32_VALIDATETEXTURESTAGESTATE 0x00000004L -#define D3DHAL3_CB32_DRAWPRIMITIVES2 0x00000008L - -/* -------------------------------------------------------------- - * Texture stage renderstate mapping definitions. - * - * 256 renderstate slots [256, 511] are reserved for texture processing - * stage controls, which provides for 8 texture processing stages each - * with 32 DWORD controls. - * - * The renderstates within each stage are indexed by the - * D3DTEXTURESTAGESTATETYPE enumerants by adding the appropriate - * enumerant to the base for a given texture stage. - * - * Note, "state overrides" bias the renderstate by 256, so the two - * ranges overlap. Overrides are enabled for exebufs only, so all - * this means is that Texture3 cannot be used with exebufs. - */ - -/* - * Base of all texture stage state values in renderstate array. - */ -#define D3DHAL_TSS_RENDERSTATEBASE 256UL - -/* - * Maximum number of stages allowed. - */ -#define D3DHAL_TSS_MAXSTAGES 8 - -/* - * Number of state DWORDS per stage. - */ -#define D3DHAL_TSS_STATESPERSTAGE 64 - -/* - * Texture handle's offset into the 32-DWORD cascade state vector - */ -#define D3DTSS_TEXTUREMAP 0 - - -#if(DIRECT3D_VERSION >= 0x0900) -/* -------------------------------------------------------------- - * Texture sampler renderstate. - * - * D3DSAMPLERSTATETYPE (D3DSAMP_*) sampler states exist to - * separate sampler state from the rest of the D3DTSS_* states. - * D3DSAMP_* states are only visible at the API level; - * the runtime simply maps these to D3DTSS_* for drivers. - * - */ - -/* - * Maximum number of texture samplers allowed. - * - * If this number gets bigger than 32, some retooling - * will be needed, as DWORD bitfields are used all over the place. - */ -#define D3DHAL_SAMPLER_MAXSAMP 16 - -/* - * Maximum number of samplers in vertex shaders (must be power of 2) - */ -#define D3DHAL_SAMPLER_MAXVERTEXSAMP 4 - -/* - * Number of state DWORDS per sampler. - */ -#define D3DHAL_SAMPLER_STATESPERSAMP D3DSAMP_MAX - - -/* - * D3DTSS_* states that have been removed from the D3DTEXTURESTAGESTATETYPE - * and turned into the D3DSAMP_* enum D3DTEXTURESAMPLERTYPE. - * These defines allow D3DSAMP_* to be mapped to D3DTSS_* through the DDI - * so that drivers can simply understand D3DTSS_* and do not have to know - * about D3DSAMP_* at all. - * These defines are now labelled as D3DTSS_RESERVEDn in the public - * header definition of D3DTEXTURESTAGESTATETYPE. - */ -#define D3DTSS_ADDRESSU ((D3DTEXTURESTAGESTATETYPE)13) -#define D3DTSS_ADDRESSV ((D3DTEXTURESTAGESTATETYPE)14) -#define D3DTSS_BORDERCOLOR ((D3DTEXTURESTAGESTATETYPE)15) -#define D3DTSS_MAGFILTER ((D3DTEXTURESTAGESTATETYPE)16) -#define D3DTSS_MINFILTER ((D3DTEXTURESTAGESTATETYPE)17) -#define D3DTSS_MIPFILTER ((D3DTEXTURESTAGESTATETYPE)18) -#define D3DTSS_MIPMAPLODBIAS ((D3DTEXTURESTAGESTATETYPE)19) -#define D3DTSS_MAXMIPLEVEL ((D3DTEXTURESTAGESTATETYPE)20) -#define D3DTSS_MAXANISOTROPY ((D3DTEXTURESTAGESTATETYPE)21) -#define D3DTSS_ADDRESSW ((D3DTEXTURESTAGESTATETYPE)25) -#define D3DTSS_SRGBTEXTURE ((D3DTEXTURESTAGESTATETYPE)29) -#define D3DTSS_ELEMENTINDEX ((D3DTEXTURESTAGESTATETYPE)30) -#define D3DTSS_DMAPOFFSET ((D3DTEXTURESTAGESTATETYPE)31) - -// These renderstates were retired in DX8: -#ifndef D3DRS_SOFTWAREVERTEXPROCESSING -#define D3DRS_SOFTWAREVERTEXPROCESSING ((D3DRENDERSTATETYPE)153) -#endif - -// These renderstates were retired in DX9: -#ifndef D3DRS_PATCHSEGMENTS -#define D3DRS_LINEPATTERN ((D3DRENDERSTATETYPE)10) -#define D3DRS_ZVISIBLE ((D3DRENDERSTATETYPE)30) -#define D3DRS_PATCHSEGMENTS ((D3DRENDERSTATETYPE)164) -#endif - -#endif /* DIRECT3D_VERSION >= 0x0900 */ - -/* -------------------------------------------------------------- - * Flags for the data parameters. - */ - -/* - * SceneCapture() - * This is used as an indication to the driver that a scene is about to - * start or end, and that it should capture data if required. - */ -#define D3DHAL_SCENE_CAPTURE_START 0x00000000L -#define D3DHAL_SCENE_CAPTURE_END 0x00000001L - -/* - * Execute() - */ - -/* - * Use the instruction stream starting at dwOffset. - */ -#define D3DHAL_EXECUTE_NORMAL 0x00000000L - -/* - * Use the optional instruction override (diInstruction) and return - * after completion. dwOffset is the offset to the first primitive. - */ -#define D3DHAL_EXECUTE_OVERRIDE 0x00000001L - -/* - * GetState() - * The driver will get passed a flag in dwWhich specifying which module - * the state must come from. The driver then fills in ulArg[1] with the - * appropriate value depending on the state type given in ddState. - */ - -/* - * The following are used to get the state of a particular stage of the - * pipeline. - */ -#define D3DHALSTATE_GET_TRANSFORM 0x00000001L -#define D3DHALSTATE_GET_LIGHT 0x00000002L -#define D3DHALSTATE_GET_RENDER 0x00000004L - - -/* -------------------------------------------------------------- - * Return values from HAL functions. - */ - -/* - * The context passed in was bad. - */ -#define D3DHAL_CONTEXT_BAD 0x000000200L - -/* - * No more contexts left. - */ -#define D3DHAL_OUTOFCONTEXTS 0x000000201L - -/* - * Execute() and ExecuteClipped() - */ - -/* - * Executed to completion via early out. - * (e.g. totally clipped) - */ -#define D3DHAL_EXECUTE_ABORT 0x00000210L - -/* - * An unhandled instruction code was found (e.g. D3DOP_TRANSFORM). - * The dwOffset parameter must be set to the offset of the unhandled - * instruction. - * - * Only valid from Execute() - */ -#define D3DHAL_EXECUTE_UNHANDLED 0x00000211L - -// typedef for the Callback that the drivers can use to parse unknown commands -// passed to them via the DrawPrimitives2 callback. The driver obtains this -// callback thru a GetDriverInfo call with GUID_D3DParseUnknownCommandCallback -// made by ddraw somewhere around the initialization time. -typedef HRESULT (CALLBACK *PFND3DPARSEUNKNOWNCOMMAND) (LPVOID lpvCommands, - LPVOID *lplpvReturnedCommand); - - -/* - * DDI only renderstates. - */ -#define D3DRENDERSTATE_EVICTMANAGEDTEXTURES 61 // DDI render state only to Evict textures -#define D3DRENDERSTATE_SCENECAPTURE 62 // DDI only to replace SceneCapture -#define D3DRS_DELETERTPATCH 169 // DDI only to delete high order patch -#define D3DRS_MAXVERTEXSHADERINST ((D3DRENDERSTATETYPE)196) // DDI only: vs_3_0+ num instructions to execute. -#define D3DRS_MAXPIXELSHADERINST ((D3DRENDERSTATETYPE)197) // DDI only: ps_3_0+ num instructions to execute. -#define D3DRS_ZBIAS ((D3DRENDERSTATETYPE)47) // replaced by depthbias - -// Default values for D3DRS_MAXVERTEXSHADERINST and D3DRS_MAXPIXELSHADERINST -#define D3DINFINITEINSTRUCTIONS 0xffffffff - -//----------------------------------------------------------------------------- -// -// DirectX 8.0's new driver info querying mechanism. -// -// How to handle the new driver info query mechanism. -// -// DirectX 8.0 utilizes an extension to GetDriverInfo() to query for -// additional information from the driver. Currently this mechanism is only -// used for querying for DX8 style D3D caps but it may be used for other -// information over time. -// -// This extension to GetDriverInfo takes the form of a GetDriverInfo call -// with the GUID GUID_GetDriverInfo2. When a GetDriverInfo call with this -// GUID is received by the driver the driver must check the data passed -// in the lpvData field of the DD_GETDRIVERINFODATA data structure to see -// what information is being requested. -// -// It is important to note that the GUID GUID_GetDriverInfo2 is, in fact, -// the same as the GUID_DDStereoMode. If you driver doesn't handle -// GUID_DDStereoMode this is not an issue. However, if you wish your driver -// to handle GUID_DDStereoMode as well as GUID_GetDriverInfo2 special action -// must be taken. When a call tp GetDriverInfo with the GUID -// GUID_GetDriverInfo2/GUID_DDStereoMode is made the runtime sets the -// dwHeight field of the DD_STEREOMODE structure to the special value -// D3DGDI2_MAGIC. In this way you can determine when the request is a -// stereo mode call or a GetDriverInfo2 call. The dwHeight field of -// DD_STEREOMODE corresponds to the dwMagic field of the -// DD_GETDRIVERINFO2DATA structure. -// -// The dwExpectedSize field of the DD_GETDRIVERINFODATA structure is not -// used by when a GetDriverInfo2 request is being made and should be -// ignored. The actual expected size of the data is found in the -// dwExpectedSize of the DD_GETDRIVERINFO2DATA structure. -// -// Once the driver has determined that this is a call to -// GetDriverInfo2 it must then determine the type of information being -// requested by the runtime. This type is contained in the dwType field -// of the DD_GETDRIVERINFO2DATA data structure. -// -// Finally, once the driver knows this is a GetDriverInfo2 request of a -// particular type it can copy the requested data into the data buffer. -// It is important to note that the lpvData field of the DD_GETDRIVERINFODATA -// data structure points to data buffer in which to copy your data. lpvData -// also points to the DD_GETDRIVERINFO2DATA structure. This means that the -// data returned by the driver will overwrite the DD_GETDRIVERINFO2DATA -// structure and, hence, the DD_GETDRIVERINFO2DATA structure occupies the -// first few DWORDs of the buffer. -// -// The following code fragment demonstrates how to handle GetDriverInfo2. -// -// 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 (((DD_GETDRIVERINFO2DATA*)(lpData->lpvData))->dwMagic == D3DGDI2_MAGIC) -// { -// // Yes, its a call to GetDriverInfo2, fetch the -// // DD_GETDRIVERINFO2DATA data structure. -// DD_GETDRIVERINFO2DATA* pgdi2 = lpData->lpvData; -// 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. -// lpData->dwActualSize = 0; -// lpData->ddRVal = DDERR_CURRENTLYNOTAVAIL; -// return DDHAL_DRIVER_HANDLED; -// } -// } -// else -// { -// // It must be a call a request for stereo mode support. -// // Fetch the stereo mode data -// DD_STEREOMODE* pStereoMode = lpData->lpvData; -// 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 -// -//----------------------------------------------------------------------------- - -// -// The data structure which is passed to the driver when GetDriverInfo is -// called with a GUID of GUID_GetDriverInfo2. -// -// NOTE: Although the fields listed below are all read only this data -// structure is actually the first four DWORDs of the data buffer into -// which the driver writes the requested infomation. As such, these fields -// (and the entire data structure) are overwritten by the data returned by -// the driver. -// -typedef struct _DD_GETDRIVERINFO2DATA -{ - DWORD dwReserved; // Reserved Field. - // Driver should not read or write this field. - - DWORD dwMagic; // Magic Number. Has the value D3DGDI2_MAGIC if - // this is a GetDriverInfo2 call. Otherwise - // this structure is, in fact, a DD_STEREOMODE - // call. - // Driver should only read this field. - - DWORD dwType; // Type of information requested. This field - // contains one of the DDGDI2_TYPE_ #defines - // listed below. - // Driver should only read (not write) this - // field. - - DWORD dwExpectedSize; // Expected size of the information requested. - // Driver should only read (not write) this - // field. - - // The remainder of the data buffer (beyond the first four DWORDs) - // follows here. -} DD_GETDRIVERINFO2DATA; - -// -// IMPORTANT NOTE: This GUID has exactly the same value as GUID_DDStereoMode -// and as such you must be very careful when using it. If your driver needs -// to handle both GetDriverInfo2 and DDStereoMode it must have a single -// check for the shared GUID and then distinguish between which use of that -// GUID is being requested. -// -#define GUID_GetDriverInfo2 (GUID_DDStereoMode) - -// -// Magic value used to determine whether a GetDriverInfo call with the -// GUID GUID_GetDriverInfo2/GUID_DDStereoMode is a GetDriverInfo2 request -// or a query about stereo capabilities. This magic number is stored in -// the dwHeight field of the DD_STEREOMODE data structure. -// -#define D3DGDI2_MAGIC (0xFFFFFFFFul) - -// -// The types of information which can be requested from the driver via -// GetDriverInfo2. -// - -#define D3DGDI2_TYPE_GETD3DCAPS8 (0x00000001ul) // Return the D3DCAPS8 data -#define D3DGDI2_TYPE_GETFORMATCOUNT (0x00000002ul) // Return the number of supported formats -#define D3DGDI2_TYPE_GETFORMAT (0x00000003ul) // Return a particular format -#define D3DGDI2_TYPE_DXVERSION (0x00000004ul) // Notify driver of current DX Version -#define D3DGDI2_TYPE_GETD3DCAPS9 (0x00000010ul) // Return the D3DCAPS9 data -#define D3DGDI2_TYPE_GETEXTENDEDMODECOUNT (0x00000011ul) // Return the number of supported extended mode -#define D3DGDI2_TYPE_GETEXTENDEDMODE (0x00000012ul) // Return a particular extended mode -#define D3DGDI2_TYPE_GETADAPTERGROUP (0x00000013ul) // Return a adapter group information -#define D3DGDI2_TYPE_GETMULTISAMPLEQUALITYLEVELS (0x00000016ul) // Return the number of multisample quality levels -#define D3DGDI2_TYPE_DEFERRED_AGP_AWARE (0x00000018ul) // Runtime is aware of deferred AGP frees, and will send following (NT only) -#define D3DGDI2_TYPE_FREE_DEFERRED_AGP (0x00000019ul) // Free any deferred-freed AGP allocations for this process (NT only) -#define D3DGDI2_TYPE_DEFER_AGP_FREES (0x00000020ul) // Start defering AGP frees for this process -#define D3DGDI2_TYPE_GETD3DQUERYCOUNT (0x00000021ul) // Return the number of supported queries -#define D3DGDI2_TYPE_GETD3DQUERY (0x00000022ul) // Return supported query -#define D3DGDI2_TYPE_GETDDIVERSION (0x00000023ul) // Return DX9_DDI_VERSION - -// -// This data structure is returned by the driver in response to a -// GetDriverInfo2 query with the type D3DGDI2_TYPE_GETFORMATCOUNT. It simply -// gives the number of surface formats supported by the driver. Currently this -// structure consists of a single member giving the number of supported -// surface formats. -// -typedef struct _DD_GETFORMATCOUNTDATA -{ - DD_GETDRIVERINFO2DATA gdi2; // [in/out] GetDriverInfo2 data - DWORD dwFormatCount; // [out] Number of supported surface formats - DWORD dwReserved; // Reserved -} DD_GETFORMATCOUNTDATA; - -// -// This data structure is used to request a specific surface format from the -// driver. It is guaranteed that the requested format will be greater than or -// equal to zero and less that the format count reported by the driver from -// the preceeding D3DGDI2_TYPE_GETFORMATCOUNT request. -// -typedef struct _DD_GETFORMATDATA -{ - DD_GETDRIVERINFO2DATA gdi2; // [in/out] GetDriverInfo2 data - DWORD dwFormatIndex; // [in] The format to return - DDPIXELFORMAT format; // [out] The actual format -} DD_GETFORMATDATA; - -// -// This data structure is used to notify drivers about the DirectX version -// number. This is the value that is denoted as DD_RUNTIME_VERSION in the -// DDK headers. -// -typedef struct _DD_DXVERSION -{ - DD_GETDRIVERINFO2DATA gdi2; // [in/out] GetDriverInfo2 data - DWORD dwDXVersion; // [in] The Version of DX - DWORD dwReserved; // Reserved -} DD_DXVERSION; - -// Informs driver that runtime will send a notification after last outstanding AGP -// lock has been released. -typedef struct _DD_DEFERRED_AGP_AWARE_DATA -{ - DD_GETDRIVERINFO2DATA gdi2; // [in/out] GetDriverInfo2 data -} DD_DEFERRED_AGP_AWARE_DATA; - -// Notification that the last AGP lock has been released. Driver can free all deferred AGP -// allocations for this process. -typedef struct _DD_FREE_DEFERRED_AGP_DATA -{ - DD_GETDRIVERINFO2DATA gdi2; // [in/out] GetDriverInfo2 data - DWORD dwProcessId; // [in] Process ID for whom to free deferred AGP -} DD_FREE_DEFERRED_AGP_DATA; - -#if(DIRECT3D_VERSION >= 0x0900) -// -// This data structure is returned by the driver in response to a -// GetDriverInfo2 query with the type D3DGDI2_TYPE_GETEXTENDEDMODECOUNT. It simply -// gives the number of extended video modes supported by the driver. Currently this -// structure consists of a single member giving the number of supported extended -// video modes. -// -typedef struct _DD_GETEXTENDEDMODECOUNTDATA -{ - DD_GETDRIVERINFO2DATA gdi2; // [in/out] GetDriverInfo2 data - DWORD dwModeCount; // [out] Number of supported extended video modes - DWORD dwReserved; // Reserved -} DD_GETEXTENDEDMODECOUNTDATA; - -// -// This data structure is used to request a specific extended video mode from the -// driver. It is guaranteed that the requested format will be greater than or -// equal to zero and less that the format count reported by the driver from -// the preceeding D3DGDI2_TYPE_GETEXTENDEDMODECOUNT request. -// -typedef struct _DD_GETEXTENDEDMODEDATA -{ - DD_GETDRIVERINFO2DATA gdi2; // [in/out] GetDriverInfo2 data - DWORD dwModeIndex; // [in] The format to return - D3DDISPLAYMODE mode; // [out] The actual format -} DD_GETEXTENDEDMODEDATA; - -// -// This data structure is used to request a adapter group information from the driver. -// A adapter group is a set of adapters which share video hardware (like video memory, -// 3D accelerator). Thus it is mainly for DualView video adapter. Direct3D runtime -// will share surface resources (like texture, vertex buffers) across adapters within -// a adapter group upon application's request. -// -typedef struct _DD_GETADAPTERGROUPDATA -{ - DD_GETDRIVERINFO2DATA gdi2; // [in/out] GetDriverInfo2 data - ULONG_PTR ulUniqueAdapterGroupId; // [out] The unique id of adapter group that this adapter belonging to - DWORD dwReserved1; // Reserved, must be 0 - DWORD dwReserved2; // Reserved, must be 0 -} DD_GETADAPTERGROUPDATA; - -typedef struct _DD_MULTISAMPLEQUALITYLEVELSDATA -{ - DD_GETDRIVERINFO2DATA gdi2; //[in/out] GetDriverInfo2 data - D3DFORMAT Format; //[in] Format of multi-sampled render-target - BOOL bFlip : 1; //[in] FALSE means blt-style resolution - D3DMULTISAMPLE_TYPE MSType : 31; //[in] - DWORD QualityLevels; //[out] -} DD_MULTISAMPLEQUALITYLEVELSDATA; - -typedef struct _DD_GETD3DQUERYCOUNTDATA -{ - DD_GETDRIVERINFO2DATA gdi2; // [in/out] GetDriverInfo2 data - DWORD dwNumQueries; // [out] Number of queries -} DD_GETD3DQUERYCOUNTDATA; - -typedef struct _DD_GETD3DQUERYDATA -{ - DD_GETDRIVERINFO2DATA gdi2; // [in/out] GetDriverInfo2 data - union - { - DWORD dwQueryIndex; // [in] Index of cap - D3DQUERYTYPE QueryType; // [out] Query cap - }; -} DD_GETD3DQUERYDATA; - -typedef struct _DD_GETDDIVERSIONDATA -{ - DD_GETDRIVERINFO2DATA gdi2; // [in/out] GetDriverInfo2 data - DWORD dwDXVersion; // [in] DX version (9 for DX9, etc.) - DWORD dwDDIVersion; // [out] DX9_DDI_VERSION -} DD_GETDDIVERSIONDATA; - -#define DX9_DDI_VERSION 4 - -#endif /* DIRECT3D_VERSION >= 0x0900 */ - -#if(DIRECT3D_VERSION >= 0x0900) - -// GetDriverState IDs - D3DDEVINFO structures used for query mechanism in public headers - -#define D3DDEVINFOID_VCACHE 4 /* Used with D3DDEVINFOID_VCACHE */ - -// This was eliminated in DX9 but was exposed in DX8.1 so the drivers still need it -#define D3DFMT_W11V11U10 (D3DFORMAT)65 - -#endif /* DIRECT3D_VERSION >= 0x0900 */ - -// New Caps that are not API visible that the driver exposes. -#define D3DDEVCAPS_HWVERTEXBUFFER 0x02000000L /* Device supports Driver Allocated Vertex Buffers*/ -#define D3DDEVCAPS_HWINDEXBUFFER 0x04000000L /* Device supports Driver Allocated Index Buffers*/ -#define D3DDEVCAPS_SUBVOLUMELOCK 0x08000000L /* Device supports locking a part of volume texture*/ -#ifndef D3DPMISCCAPS_FOGINFVF -#define D3DPMISCCAPS_FOGINFVF 0x00002000L /* Device supports separate fog value in the FVF */ -#endif -#ifndef D3DFVF_FOG -#define D3DFVF_FOG 0x00002000L /* There is a separate fog value in the FVF vertex */ -#endif - -// -// This stuff is not API visible but should be DDI visible. -// Should be in Sync with d3d8types.h -// -#define D3DFMT_D32 (D3DFORMAT)71 -#define D3DFMT_S1D15 (D3DFORMAT)72 -#define D3DFMT_D15S1 (D3DFORMAT)73 -#define D3DFMT_S8D24 (D3DFORMAT)74 -#define D3DFMT_D24S8 (D3DFORMAT)75 -#define D3DFMT_X8D24 (D3DFORMAT)76 -#define D3DFMT_D24X8 (D3DFORMAT)77 -#define D3DFMT_X4S4D24 (D3DFORMAT)78 -#define D3DFMT_D24X4S4 (D3DFORMAT)79 - - -//-------------- Vertex shader defines -------------------------------- -// Vertex Shader register limits. D3D device must provide at least -// specified number of registers - -// This one was used by DX8 only. -#define D3DVS_MAXINSTRUCTIONCOUNT_V1_1 128 - -// Max number of labels in a shader -#define D3DVS_LABEL_MAX_V3_0 2048 - -// Max number of output texture coordinates -#define D3DVS_TCRDOUTREG_MAX_V1_1 8 -#define D3DVS_TCRDOUTREG_MAX_V2_0 8 -#define D3DVS_TCRDOUTREG_MAX_V2_1 8 -#define D3DVS_OUTPUTREG_MAX_V3_0 12 -#define D3DVS_OUTPUTREG_MAX_SW_DX9 16 - -// Max number of output registers -#define D3DVS_OUTPUTREG_MAX_V3_0 12 - -// Max number of output attributes (colors) -#define D3DVS_ATTROUTREG_MAX_V1_1 2 -#define D3DVS_ATTROUTREG_MAX_V2_0 2 -#define D3DVS_ATTROUTREG_MAX_V2_1 2 - -// Max number of input registers -#define D3DVS_INPUTREG_MAX_V1_1 16 -#define D3DVS_INPUTREG_MAX_V2_0 16 -#define D3DVS_INPUTREG_MAX_V2_1 16 -#define D3DVS_INPUTREG_MAX_V3_0 16 - -// Max number of temp registers -#define D3DVS_TEMPREG_MAX_V1_1 12 -#define D3DVS_TEMPREG_MAX_V2_0 12 -#define D3DVS_TEMPREG_MAX_V2_1 32 -#define D3DVS_TEMPREG_MAX_V3_0 32 - -// Max number of constant float vector registers -#define D3DVS_CONSTREG_MAX_V1_1 96 -#define D3DVS_CONSTREG_MAX_V2_0 8192 -#define D3DVS_CONSTREG_MAX_V2_1 8192 -#define D3DVS_CONSTREG_MAX_V3_0 8192 - -#define D3DVS_CONSTINTREG_MAX_SW_DX9 2048 - -// Max number of integer constant registers -#define D3DVS_CONSTINTREG_MAX_V2_0 16 -#define D3DVS_CONSTINTREG_MAX_V2_1 16 -#define D3DVS_CONSTINTREG_MAX_V3_0 16 - -#define D3DVS_CONSTBOOLREG_MAX_SW_DX9 2048 - -// Max number of BOOL constant registers -#define D3DVS_CONSTBOOLREG_MAX_V2_0 16 -#define D3DVS_CONSTBOOLREG_MAX_V2_1 16 -#define D3DVS_CONSTBOOLREG_MAX_V3_0 16 - -// Max number of vector address registers -#define D3DVS_ADDRREG_MAX_V1_1 1 -#define D3DVS_ADDRREG_MAX_V2_0 1 -#define D3DVS_ADDRREG_MAX_V2_1 1 -#define D3DVS_ADDRREG_MAX_V3_0 1 - -// Max absolute value of the loop step -#define D3DVS_MAXLOOPSTEP_V2_0 128 -#define D3DVS_MAXLOOPSTEP_V2_1 128 -#define D3DVS_MAXLOOPSTEP_V3_0 128 - -// Max absolute value of the loop initial valuep -#define D3DVS_MAXLOOPINITVALUE_V2_0 255 -#define D3DVS_MAXLOOPINITVALUE_V2_1 255 -#define D3DVS_MAXLOOPINITVALUE_V3_0 255 - -// Max loop interation count -#define D3DVS_MAXLOOPITERATIONCOUNT_V2_0 255 -#define D3DVS_MAXLOOPITERATIONCOUNT_V2_1 255 -#define D3DVS_MAXLOOPITERATIONCOUNT_V3_0 255 - -// Number of PREDICATE registers -#define D3DVS_PREDICATE_MAX_V2_1 1 -#define D3DVS_PREDICATE_MAX_V3_0 1 - -//---------------- End vertex shader defines ------------------------------- - - -//---------------- Pixel shader defines ------------------------------------ -// Pixel Shader register limits. D3D device must provide at least -// specified number of registers - -// Number of INPUT registers based on shader version -#define D3DPS_INPUTREG_MAX_V1_1 2 -#define D3DPS_INPUTREG_MAX_V1_2 2 -#define D3DPS_INPUTREG_MAX_V1_3 2 -#define D3DPS_INPUTREG_MAX_V1_4 2 -#define D3DPS_INPUTREG_MAX_V2_0 2 -#define D3DPS_INPUTREG_MAX_V2_1 2 -#define D3DPS_INPUTREG_MAX_V3_0 10 -#define D3DPS_INPUTREG_MAX_SW_DX9 14 - -// Number of TEMP registers based on shader version -#define D3DPS_TEMPREG_MAX_V1_1 2 -#define D3DPS_TEMPREG_MAX_V1_2 2 -#define D3DPS_TEMPREG_MAX_V1_3 2 -#define D3DPS_TEMPREG_MAX_V1_4 6 -#define D3DPS_TEMPREG_MAX_V2_0 12 -#define D3DPS_TEMPREG_MAX_V2_1 32 -#define D3DPS_TEMPREG_MAX_V3_0 32 - -// Number of TEXTURE registers based on shader version -#define D3DPS_TEXTUREREG_MAX_V1_1 4 -#define D3DPS_TEXTUREREG_MAX_V1_2 4 -#define D3DPS_TEXTUREREG_MAX_V1_3 4 -#define D3DPS_TEXTUREREG_MAX_V1_4 6 -#define D3DPS_TEXTUREREG_MAX_V2_0 8 -#define D3DPS_TEXTUREREG_MAX_V2_1 8 -#define D3DPS_TEXTUREREG_MAX_V3_0 0 - -// Number of COLOROUT registers based on shader version -#define D3DPS_COLOROUT_MAX_V2_0 4 -#define D3DPS_COLOROUT_MAX_V2_1 4 -#define D3DPS_COLOROUT_MAX_V3_0 4 - -// Number of PREDICATE registers based on shader version -#define D3DPS_PREDICATE_MAX_V2_1 1 -#define D3DPS_PREDICATE_MAX_V3_0 1 - -// Number of FLOAT constants based on shader version -#define D3DPS_CONSTREG_MAX_V1_1 8 -#define D3DPS_CONSTREG_MAX_V1_2 8 -#define D3DPS_CONSTREG_MAX_V1_3 8 -#define D3DPS_CONSTREG_MAX_V1_4 8 -#define D3DPS_CONSTREG_MAX_V2_0 32 -#define D3DPS_CONSTREG_MAX_V2_1 32 -#define D3DPS_CONSTREG_MAX_V3_0 224 -#define D3DPS_CONSTREG_MAX_SW_DX9 8192 - -// Max number of pixel shader hardware BOOL constant registers -#define D3DPS_CONSTBOOLREG_MAX_V2_1 16 -#define D3DPS_CONSTBOOLREG_MAX_V3_0 16 -#define D3DPS_CONSTBOOLREG_MAX_SW_DX9 2048 - -// Max number of pixel shader hardware INTEGER constant registers -#define D3DPS_CONSTINTREG_MAX_V2_1 16 -#define D3DPS_CONSTINTREG_MAX_V3_0 16 -#define D3DPS_CONSTINTREG_MAX_SW_DX9 2048 - -// Max absolute value for loop step -#define D3DPS_MAXLOOPSTEP_V2_1 128 -#define D3DPS_MAXLOOPSTEP_V3_0 128 - -// Max absolute value for loop initial value -#define D3DPS_MAXLOOPINITVALUE_V2_1 255 -#define D3DPS_MAXLOOPINITVALUE_V3_0 255 - -// Max loop interation count -#define D3DPS_MAXLOOPITERATIONCOUNT_V2_1 255 -#define D3DPS_MAXLOOPITERATIONCOUNT_V3_0 255 - -//---------------- End pixel shader defines ------------------------------- - -// Pixel Shader DX8 register limits. D3D device will have at most these -// specified number of registers -// -#define D3DPS_INPUTREG_MAX_DX8 8 -#define D3DPS_TEMPREG_MAX_DX8 8 -#define D3DPS_CONSTREG_MAX_DX8 8 -#define D3DPS_TEXTUREREG_MAX_DX8 8 - -#if(DIRECT3D_VERSION >= 0x0900) - -// bit declarations for _Type fields -#define D3DVSDT_FLOAT1 0x00 // 1D float expanded to (value, 0., 0., 1.) -#define D3DVSDT_FLOAT2 0x01 // 2D float expanded to (value, value, 0., 1.) -#define D3DVSDT_FLOAT3 0x02 // 3D float expanded to (value, value, value, 1.) -#define D3DVSDT_FLOAT4 0x03 // 4D float -#define D3DVSDT_D3DCOLOR 0x04 // 4D packed unsigned bytes mapped to 0. to 1. range - // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) -#define D3DVSDT_UBYTE4 0x05 // 4D unsigned byte -#define D3DVSDT_SHORT2 0x06 // 2D signed short expanded to (value, value, 0., 1.) -#define D3DVSDT_SHORT4 0x07 // 4D signed short - -#define D3DVSDE_POSITION 0 -#define D3DVSDE_BLENDWEIGHT 1 -#define D3DVSDE_BLENDINDICES 2 -#define D3DVSDE_NORMAL 3 -#define D3DVSDE_PSIZE 4 -#define D3DVSDE_DIFFUSE 5 -#define D3DVSDE_SPECULAR 6 -#define D3DVSDE_TEXCOORD0 7 -#define D3DVSDE_TEXCOORD1 8 -#define D3DVSDE_TEXCOORD2 9 -#define D3DVSDE_TEXCOORD3 10 -#define D3DVSDE_TEXCOORD4 11 -#define D3DVSDE_TEXCOORD5 12 -#define D3DVSDE_TEXCOORD6 13 -#define D3DVSDE_TEXCOORD7 14 -#define D3DVSDE_POSITION2 15 -#define D3DVSDE_NORMAL2 16 - -/* DX8 style vertex declaration - -Vertex Shader Declaration - -The declaration portion of a vertex shader defines the static external -interface of the shader. The information in the declaration includes: - -- Assignments of vertex shader input registers to data streams. These -assignments bind a specific vertex register to a single component within a -vertex stream. A vertex stream element is identified by a byte offset -within the stream and a type. The type specifies the arithmetic data type -plus the dimensionality (1, 2, 3, or 4 values). Stream data which is -less than 4 values are always expanded out to 4 values with zero or more -0.F values and one 1.F value. - -- Assignment of vertex shader input registers to implicit data from the -primitive tessellator. This controls the loading of vertex data which is -not loaded from a stream, but rather is generated during primitive -tessellation prior to the vertex shader. - -- Loading data into the constant memory at the time a shader is set as the -current shader. Each token specifies values for one or more contiguous 4 -DWORD constant registers. This allows the shader to update an arbitrary -subset of the constant memory, overwriting the device state (which -contains the current values of the constant memory). Note that these -values can be subsequently overwritten (between DrawPrimitive calls) -during the time a shader is bound to a device via the -SetVertexShaderConstant method. - - -Declaration arrays are single-dimensional arrays of DWORDs composed of -multiple tokens each of which is one or more DWORDs. The single-DWORD -token value 0xFFFFFFFF is a special token used to indicate the end of the -declaration array. The single DWORD token value 0x00000000 is a NOP token -with is ignored during the declaration parsing. Note that 0x00000000 is a -valid value for DWORDs following the first DWORD for multiple word tokens. - -[31:29] TokenType - 0x0 - NOP (requires all DWORD bits to be zero) - 0x1 - stream selector - 0x2 - stream data definition (map to vertex input memory) - 0x3 - vertex input memory from tessellator - 0x4 - constant memory from shader - 0x5 - extension - 0x6 - reserved - 0x7 - end-of-array (requires all DWORD bits to be 1) - -NOP Token (single DWORD token) - [31:29] 0x0 - [28:00] 0x0 - -Stream Selector (single DWORD token) - [31:29] 0x1 - [28] indicates whether this is a tessellator stream - [27:04] 0x0 - [03:00] stream selector (0..15) - -Stream Data Definition (single DWORD token) - Vertex Input Register Load - [31:29] 0x2 - [28] 0x0 - [27:20] 0x0 - [19:16] type (dimensionality and data type) - [15:04] 0x0 - [03:00] vertex register address (0..15) - Data Skip (no register load) - [31:29] 0x2 - [28] 0x1 - [27:20] 0x0 - [19:16] count of DWORDS to skip over (0..15) - [15:00] 0x0 - Vertex Input Memory from Tessellator Data (single DWORD token) - [31:29] 0x3 - [28] indicates whether data is normals or u/v - [27:24] 0x0 - [23:20] vertex register address (0..15) - [19:16] type (dimensionality) - [15:04] 0x0 - [03:00] vertex register address (0..15) - -Constant Memory from Shader (multiple DWORD token) - [31:29] 0x4 - [28:25] count of 4*DWORD constants to load (0..15) - [24:07] 0x0 - [06:00] constant memory address (0..95) - -Extension Token (single or multiple DWORD token) - [31:29] 0x5 - [28:24] count of additional DWORDs in token (0..31) - [23:00] extension-specific information - -End-of-array token (single DWORD token) - [31:29] 0x7 - [28:00] 0x1fffffff - -The stream selector token must be immediately followed by a contiguous set of stream data definition tokens. This token sequence fully defines that stream, including the set of elements within the stream, the order in which the elements appear, the type of each element, and the vertex register into which to load an element. -Streams are allowed to include data which is not loaded into a vertex register, thus allowing data which is not used for this shader to exist in the vertex stream. This skipped data is defined only by a count of DWORDs to skip over, since the type information is irrelevant. -The token sequence: -Stream Select: stream=0 -Stream Data Definition (Load): type=FLOAT3; register=3 -Stream Data Definition (Load): type=FLOAT3; register=4 -Stream Data Definition (Skip): count=2 -Stream Data Definition (Load): type=FLOAT2; register=7 - -defines stream zero to consist of 4 elements, 3 of which are loaded into registers and the fourth skipped over. Register 3 is loaded with the first three DWORDs in each vertex interpreted as FLOAT data. Register 4 is loaded with the 4th, 5th, and 6th DWORDs interpreted as FLOAT data. The next two DWORDs (7th and 8th) are skipped over and not loaded into any vertex input register. Register 7 is loaded with the 9th and 10th DWORDS interpreted as FLOAT data. -Placing of tokens other than NOPs between the Stream Selector and Stream Data Definition tokens is disallowed. - -*/ - -#ifndef __COMMONHALDEFINES -#define __COMMONHALDEFINES - -typedef enum _D3DVSD_TOKENTYPE -{ - D3DVSD_TOKEN_NOP = 0, // NOP or extension - D3DVSD_TOKEN_STREAM, // stream selector - D3DVSD_TOKEN_STREAMDATA, // stream data definition (map to vertex input memory) - D3DVSD_TOKEN_TESSELLATOR, // vertex input memory from tessellator - D3DVSD_TOKEN_CONSTMEM, // constant memory from shader - D3DVSD_TOKEN_EXT, // extension - D3DVSD_TOKEN_END = 7, // end-of-array (requires all DWORD bits to be 1) - D3DVSD_FORCE_DWORD = 0x7fffffff,// force 32-bit size enum -} D3DVSD_TOKENTYPE; -#endif __COMMONHALDEFINES - -#define D3DVSD_TOKENTYPESHIFT 29 -#define D3DVSD_TOKENTYPEMASK (7 << D3DVSD_TOKENTYPESHIFT) - -#define D3DVSD_STREAMNUMBERSHIFT 0 -#define D3DVSD_STREAMNUMBERMASK (0xF << D3DVSD_STREAMNUMBERSHIFT) - -#define D3DVSD_DATALOADTYPESHIFT 28 -#define D3DVSD_DATALOADTYPEMASK (0x1 << D3DVSD_DATALOADTYPESHIFT) - -#define D3DVSD_DATATYPESHIFT 16 -#define D3DVSD_DATATYPEMASK (0xF << D3DVSD_DATATYPESHIFT) - -#define D3DVSD_SKIPCOUNTSHIFT 16 -#define D3DVSD_SKIPCOUNTMASK (0xF << D3DVSD_SKIPCOUNTSHIFT) - -#define D3DVSD_VERTEXREGSHIFT 0 -#define D3DVSD_VERTEXREGMASK (0x1F << D3DVSD_VERTEXREGSHIFT) - -#define D3DVSD_VERTEXREGINSHIFT 20 -#define D3DVSD_VERTEXREGINMASK (0xF << D3DVSD_VERTEXREGINSHIFT) - -#define D3DVSD_CONSTCOUNTSHIFT 25 -#define D3DVSD_CONSTCOUNTMASK (0xF << D3DVSD_CONSTCOUNTSHIFT) - -#define D3DVSD_CONSTADDRESSSHIFT 0 -#define D3DVSD_CONSTADDRESSMASK (0x7F << D3DVSD_CONSTADDRESSSHIFT) - -#define D3DVSD_CONSTRSSHIFT 16 -#define D3DVSD_CONSTRSMASK (0x1FFF << D3DVSD_CONSTRSSHIFT) - -#define D3DVSD_EXTCOUNTSHIFT 24 -#define D3DVSD_EXTCOUNTMASK (0x1F << D3DVSD_EXTCOUNTSHIFT) - -#define D3DVSD_EXTINFOSHIFT 0 -#define D3DVSD_EXTINFOMASK (0xFFFFFF << D3DVSD_EXTINFOSHIFT) - -#define D3DVSD_MAKETOKENTYPE(tokenType) ((tokenType << D3DVSD_TOKENTYPESHIFT) & D3DVSD_TOKENTYPEMASK) - -// macros for generation of CreateVertexShader Declaration token array - -// Set current stream -// _StreamNumber [0..(MaxStreams-1)] stream to get data from -// -#define D3DVSD_STREAM( _StreamNumber ) \ - (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (_StreamNumber)) - -// Set tessellator stream -// -#define D3DVSD_STREAMTESSSHIFT 28 -#define D3DVSD_STREAMTESSMASK (1 << D3DVSD_STREAMTESSSHIFT) -#define D3DVSD_STREAM_TESS( ) \ - (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (D3DVSD_STREAMTESSMASK)) - -// bind single vertex register to vertex element from vertex stream -// -// _VertexRegister [0..15] address of the vertex register -// _Type [D3DVSDT_*] dimensionality and arithmetic data type - -#define D3DVSD_REG( _VertexRegister, _Type ) \ - (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | \ - ((_Type) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) - -// Skip _DWORDCount DWORDs in vertex -// -#define D3DVSD_SKIP( _DWORDCount ) \ - (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | 0x10000000 | \ - ((_DWORDCount) << D3DVSD_SKIPCOUNTSHIFT)) - -// load data into vertex shader constant memory -// -// _ConstantAddress [0..95] - address of constant array to begin filling data -// _Count [0..15] - number of constant vectors to load (4 DWORDs each) -// followed by 4*_Count DWORDS of data -// -#define D3DVSD_CONST( _ConstantAddress, _Count ) \ - (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) | \ - ((_Count) << D3DVSD_CONSTCOUNTSHIFT) | (_ConstantAddress)) - -// enable tessellator generated normals -// -// _VertexRegisterIn [0..15] address of vertex register whose input stream -// will be used in normal computation -// _VertexRegisterOut [0..15] address of vertex register to output the normal to -// -#define D3DVSD_TESSNORMAL( _VertexRegisterIn, _VertexRegisterOut ) \ - (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | \ - ((_VertexRegisterIn) << D3DVSD_VERTEXREGINSHIFT) | \ - ((0x02) << D3DVSD_DATATYPESHIFT) | (_VertexRegisterOut)) - -// enable tessellator generated surface parameters -// -// _VertexRegister [0..15] address of vertex register to output parameters -// -#define D3DVSD_TESSUV( _VertexRegister ) \ - (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | 0x10000000 | \ - ((0x01) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) - -// Generates END token -// -#define D3DVSD_END() 0xFFFFFFFF - -// Generates NOP token -#define D3DVSD_NOP() 0x00000000 - -#endif /* DIRECT3D_VERSION >= 0x0900 */ - -#endif /* _D3DHAL_H */ - - diff --git a/pub/ddk/d3dhalex.h b/pub/ddk/d3dhalex.h deleted file mode 100644 index 17c9cc0..0000000 --- a/pub/ddk/d3dhalex.h +++ /dev/null @@ -1,113 +0,0 @@ -#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 */ - - diff --git a/pub/ddk/d3dkmdt.h b/pub/ddk/d3dkmdt.h deleted file mode 100644 index 15fa8f5..0000000 --- a/pub/ddk/d3dkmdt.h +++ /dev/null @@ -1,1524 +0,0 @@ -/******************************Module*Header**********************************\ -* -* Module Name: d3dkmdt.h -* -* Content: Longhorn Display Driver Model (LDDM) kernel mode -* data type definitions -* -* Copyright (c) 2004 Microsoft Corporation. All rights reserved. -\*****************************************************************************/ -#ifndef _D3DKMDT_H -#define _D3DKMDT_H - -#if !defined(_D3DKMDDI_H_) && \ - !defined(_DXGDMM_H_) && \ - !defined(_VIDPRIV_H_) && \ - !defined(_DISPMPRT_H_) && \ - !defined(_DMM_DIAG_H_) && \ - !defined(_D3DKMTHK_H_) - #error This header should not be included directly! -#endif - -#include -#include - -#pragma warning(push) -#pragma warning(disable:4201) // anonymous unions warning - -// -// 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) - -// -// Hardcoded overlay count -// -#define D3DKMDT_MAX_OVERLAYS_BITCOUNT 2 -#define D3DKMDT_MAX_OVERLAYS (1 << D3DKMDT_MAX_OVERLAYS_BITCOUNT) - - -//////////////////// VidPN management DDI handles ///////////////////////////////////////////////////////// -DECLARE_HANDLE(D3DKMDT_HVIDPN); -DECLARE_HANDLE(D3DKMDT_HVIDEOPRESENTSOURCESET); -DECLARE_HANDLE(D3DKMDT_HVIDEOPRESENTTARGETSET); -DECLARE_HANDLE(D3DKMDT_HVIDPNTOPOLOGY); -DECLARE_HANDLE(D3DKMDT_HVIDPNSOURCEMODESET); -DECLARE_HANDLE(D3DKMDT_HVIDPNTARGETMODESET); -DECLARE_HANDLE(D3DKMDT_HMONITORSOURCEMODESET); -DECLARE_HANDLE(D3DKMDT_HMONITORFREQUENCYRANGESET); -DECLARE_HANDLE(D3DKMDT_HMONITORDESCRIPTORSET); - -// Alias VOID* to make LDDM kernel mode interface prototypes using adapter handles self-explanatory. -typedef VOID* D3DKMDT_ADAPTER; - - - -//////////////////// VidPN management DDI constants ///////////////////////////////////////////////////////// - -// Special values representing that given variable has not been initialized to a valid value intended -// to catch development time errors. A valid parameter should never have this value. -#define D3DKMDT_DIMENSION_UNINITIALIZED (UINT)(~0) -#define D3DKMDT_FREQUENCY_UNINITIALIZED (UINT)(~0) - -// Special values representing that given parameter is not-specified. -// A parameter having this value should be ignored. -#define D3DKMDT_DIMENSION_NOTSPECIFIED (UINT)(~1) -#define D3DKMDT_FREQUENCY_NOTSPECIFIED (UINT)(~1) - - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Video mode standard descriptor type, listing standards that are explicitly supported by Windows. -// -// Remarks: This enum specifies based on which standard the video signal timing parameters should be computed. -// Note that NTSC, PAL, and SECAM mode variants are treated as individual groups to avoid complicating -// the DDI with the notion of "sub-standard" (because they don't differ from each other in the parameters -// used to describe the video signal in the DDI and the parameters that they do differ in are of no -// interest to us in DMM). -// -typedef enum _D3DKMDT_VIDEO_SIGNAL_STANDARD -{ - D3DKMDT_VSS_UNINITIALIZED = 0, - - // VESA standards - D3DKMDT_VSS_VESA_DMT = 1, // See VESA Display Monitor Timings specification - D3DKMDT_VSS_VESA_GTF = 2, // See VESA Generalized Timing Formula standard - D3DKMDT_VSS_VESA_CVT = 3, // See VESA Coordinated Video Timings standard - - // De-facto standards - D3DKMDT_VSS_IBM = 4, - D3DKMDT_VSS_APPLE = 5, - - // Legacy STV standards W x H{i|p} @ ( VR / HR ) - D3DKMDT_VSS_NTSC_M = 6, // 720 x 525i @ (59.94 [Hz] / 15,734.27[Hz]) - D3DKMDT_VSS_NTSC_J = 7, // 720 x 525i @ (59.94 [Hz] / 15,734.27[Hz]) - D3DKMDT_VSS_NTSC_443 = 8, // 720 x 525i @ (59.94 [Hz] / 15,734.27[Hz]) - D3DKMDT_VSS_PAL_B = 9, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_PAL_B1 = 10, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_PAL_G = 11, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_PAL_H = 12, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_PAL_I = 13, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_PAL_D = 14, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_PAL_N = 15, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_PAL_NC = 16, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_SECAM_B = 17, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_SECAM_D = 18, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_SECAM_G = 19, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_SECAM_H = 20, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_SECAM_K = 21, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_SECAM_K1 = 22, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_SECAM_L = 23, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_SECAM_L1 = 24, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - - // CEA/EIA standards - D3DKMDT_VSS_EIA_861 = 25, - D3DKMDT_VSS_EIA_861A = 26, - D3DKMDT_VSS_EIA_861B = 27, - - // More legacy STV standards - D3DKMDT_VSS_PAL_K = 28, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_PAL_K1 = 29, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_PAL_L = 30, // 720 x 625i @ (50 [Hz] / 15,625 [Hz]) - D3DKMDT_VSS_PAL_M = 31, // 720 x 525i @ (59.94 [Hz] / 15,734 [Hz]) - - D3DKMDT_VSS_OTHER = 255 -} -D3DKMDT_VIDEO_SIGNAL_STANDARD; - - - -//////////////////// Video present sources ////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Video present source descriptor type. -// -typedef struct _D3DKMDT_VIDEO_PRESENT_SOURCE -{ - // Unique ID used to reference the respective video present source by the miniport and the OS. - D3DDDI_VIDEO_PRESENT_SOURCE_ID Id; - - // Other video present source descriptor properties go here. - DWORD dwReserved; -} -D3DKMDT_VIDEO_PRESENT_SOURCE; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: VidPN source mode enumeration type descriptor type. -// -// Remarks: This type is used to specify whether a VidPN source mode is a graphics or a text mode -// (see VIDEO_PRESENT_SOURCE_MODE for more details). -// -typedef enum _D3DKMDT_VIDPN_SOURCE_MODE_TYPE -{ - D3DKMDT_RMT_UNINITIALIZED = 0, - D3DKMDT_RMT_GRAPHICS = 1, - D3DKMDT_RMT_TEXT = 2 -} -D3DKMDT_VIDPN_SOURCE_MODE_TYPE; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Pixel value access mode descriptor type. -// -// Remarks: Use Direct to represent VidPN source modes with colors stored directly in the primary surface. -// Use PresetPalette to represent VidPN source modes with colors' indices stored in the primary -// surface and actual color values stored in a palette specific to the video card, that must -// be queried from the video miniport. -// Use SettablePalette to represent VidPN source modes with colors' indices stored in the primary -// surface and actual color values stored in a settable palette that can be dynamically set on -// the video card, by specifying it to the video miniport. -// -typedef enum _D3DKMDT_PIXEL_VALUE_ACCESS_MODE -{ - D3DKMDT_PVAM_UNINITIALIZED = 0, - D3DKMDT_PVAM_DIRECT = 1, - D3DKMDT_PVAM_PRESETPALETTE = 2, - D3DKMDT_PVAM_SETTABLEPALETTE = 3, -} -D3DKMDT_PIXEL_VALUE_ACCESS_MODE; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Descriptor type of the color basis with respect to which the pixels' colors are expanded, -// or conversely, based on which the color values are synthesized. -// -// Remarks: The commonly used color bases in graphics industry are RGB, which has the basis (red, green, blue), -// as well as YPbPr and YCbCr, which have scaled variants of basis: -// (1, blue-1, red-1)*intensity(red,green,blue). -// Tri-stimulus linear RGB is well suited for real-time rendering, since most filtering algorithms -// use tri-stimulus values to approximate light's spectral transformations caused by its interaction -// with the environment, primarily due to the fact that there is a linear relationship between the -// perceived light level and the light's spectral intensity. Ideally, all processing of video content -// (i.e. scaling, filtering, etc) should be performed in a linear RGB space. -// Y'PbPr spaces store data using a nonlinear curve which is approximately the inverse of a gamma -// 2.2 curve (i.e. x^0.45). This allows more precision to be stored in darker intensities where the -// human eye is more sensitive. -// sRGB (more accurately, sR'G'B') stores light intensities relative to a gamma curve. -// scRGB stores linear values and requires much higher precision to represent the same perceptually -// similar signal. -// The light-intensity based YPbPr and YCbCr is better suited for persistence of pre-rendered content, -// such as video streaming. This is due to the fact that a human visual system is more responsive to -// small differences in photons' intensity rather than frequency (i.e. perceived color), and, hence, -// a light-intensity based color expansion over a finite dynamic range, yields a better perceptual -// image quality for the human eye than a tri-stimulus based color expansion in that same range -// (e.g non-linear Y8Cb8Cr8 appears slightly better than R8G8B8 and is comparable to R9G9B9). -// To represent monochrome modes, use Intensity. Grayscale imaging is heavily used in medical imaging. -// Note: the apostrophe notation Y'PbPr is used to remind you that you are working with non-linear data. -// -typedef enum _D3DKMDT_COLOR_BASIS -{ - D3DKMDT_CB_UNINITIALIZED = 0, - D3DKMDT_CB_INTENSITY = 1, - D3DKMDT_CB_SRGB = 2, - D3DKMDT_CB_SCRGB = 3, - D3DKMDT_CB_YCBCR = 4, - D3DKMDT_CB_YPBPR = 5, -} -D3DKMDT_COLOR_BASIS; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Descriptor type of the color coefficients dynamic range, whose linear combination with the -// respective color basis produces final pixel values. -// -// Remarks: Examples include (5,6,5,0) for R5G6B5, (8,8,8,8) for R8G8B8A8, and (24, 0, 0, 0) for 24-bit -// grayscale pixel encoding format. -// NOTE: Currently this is only used for target modes, none of which has the 4th channel (e.g. alpha). -// We are keeping the 4th field for extensibility purpose to avoid miniport interface revision -// if 4-channel video interfaces became available between display adapter and monitor. -// -typedef struct _D3DKMDT_COLOR_COEFF_DYNAMIC_RANGES -{ - UINT FirstChannel; - UINT SecondChannel; - UINT ThirdChannel; - UINT FourthChannel; -} -D3DKMDT_COLOR_COEFF_DYNAMIC_RANGES; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: 2D region descriptor type. -// -// Remarks: We define our own rather than reusing SIZE type to avoid dependency on SDK headers. -// -typedef struct _D3DKMDT_2DREGION -{ - UINT cx; - UINT cy; -} -D3DKMDT_2DREGION; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: 2D offset descriptor type. -// -// Remarks: We define our own rather than reusing SIZE type to avoid dependency on SDK headers. -// -typedef D3DKMDT_2DREGION D3DKMDT_2DOFFSET; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Graphics video present source mode descriptor type. -// -// Remarks: Graphics video present source mode is the dominantly used subtype of the video present source -// modes (other being the text video present source mode). -// Note that whenever video present source mode's visible size, -// VIDEO_PRESENT_SOURCE_MODE.GRAPHICS_RENDERING_FORMAT.sizeVisible is not equal to the respective -// video mode's visible size, VIDEO_PRESENT_TARGET_MODE.sizeVisible, h/w scaling is undertaken by -// the video output codec. -// -// Miniport is free to support any D3D pixel format for its graphics modes that is meaningful -// as a primary surface pixel format. No validation for an appropriately used pixel format shall be -// done in kernel-mode. If this turns out to be a problem, WHQL can enforce a certain list of pixel -// formats from user-mode. -// -// This descriptor does NOT include pixel value sub-channel bit masks since: -// 1. Primary goal of such descriptors is to allow application developers to write extensible code -// that can leverage future pixel formats. -// 2. As it stands, however, historically numerous application developers have failed to properly -// implement generic pixel value decoding algorithms and pixel value sub-channel bit masks were -// dropped in DX8. -// 3. Main idea: it's best to force application developers to test every scenario they claim to -// support by making them use look-up tables that map D3D pixel format enums into pixel value -// sub-channel bit masks. -// 4. To facilitate application development, it would make sense to ship a helper user-mode library -// that does the enum-to-bitmask mapping for the application developers. They would still need -// to code their application against existing pixel value formats but not maintain look-up tables, -// for every application. -// 5. Need for pixel value sub-channel bitmasks exposure is further reduced by the fact that they are -// only truly useful for linear surface formats with well defined integer RGB encoded pixel values. -// i. When surface format has a non-linear pixel layout -// (i.e. VIDEO_PRESENT_SOURCE.VidPSContentLayout = VPSCL_Linear), -// knowledge of pixel value sub-channel bitmasks will not help the developer to know how to -// access each pixel in the surface. -// ii. Most four-CC formats (e.g. NVT4/NVT5) fall into this category and one should test against -// every format to be supported by the application, because most of them imply texture layouts -// that aren't easily described. -// iii. Also the bitmasks won't work for floating point pixel formats. -// -typedef struct _D3DKMDT_GRAPHICS_RENDERING_FORMAT -{ - // Size of the primary surface required for this VidPN source mode. - D3DKMDT_2DREGION PrimSurfSize; - - // Size of the visible part of the primary surface, used for panned modes including zoom modes. - D3DKMDT_2DREGION VisibleRegionSize; - - // Number of bytes between the start of one scan line and the next. - DWORD Stride; - - // Pixel format type - D3DDDIFORMAT PixelFormat; - - // Color basis with respect to which rendering client encodes pixel values. - D3DKMDT_COLOR_BASIS ColorBasis; - - // Access mode for the pixel value information. - D3DKMDT_PIXEL_VALUE_ACCESS_MODE PixelValueAccessMode; -} -D3DKMDT_GRAPHICS_RENDERING_FORMAT; - - -typedef enum _D3DKMDT_TEXT_RENDERING_FORMAT -{ - D3DKMDT_TRF_UNINITIALIZED = 0 -} -D3DKMDT_TEXT_RENDERING_FORMAT; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Video present source mode ID type. -typedef UINT D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID; - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: VidPN source mode descriptor type. -// -// Remarks: VidPN source (rendering) mode is the mode of operation of a given video present source and determines -// the format of this source's primary surface to which the graphics subsystem is rendering -// the visual image to be presented to the user, and from which the video output codec is reading -// the visual image content to be converted into a respective video mode signal. -// -typedef struct _D3DKMDT_VIDPN_SOURCE_MODE -{ - D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID Id; - - // Specifies whether the mode is a graphics or a text rendering mode. - D3DKMDT_VIDPN_SOURCE_MODE_TYPE Type; - - union - { - // Descriptor of the graphics rendering mode (valid only if Type==D3DKMDT_RMT_GRAPHICS). - D3DKMDT_GRAPHICS_RENDERING_FORMAT Graphics; - - // Descriptor of the text rendering mode (valid only if Type==D3DKMDT_RMT_TEXT). - D3DKMDT_TEXT_RENDERING_FORMAT Text; - } - Format; -} -D3DKMDT_VIDPN_SOURCE_MODE; - - - -//////////////////////// Video present targets/////////////////////////////////////////////////////////////// - - -// NOTE: Child device (e.g. video output) HPD awareness is used to represent the level of external -// device (e.g. monitor) connectivity sensed by a display adapter. Child device can either be -// always connected to an external device (e.g. integrated LCD in a mobile system) or have: -// 1. No HPD-awareness iff miniport is *not* aware of external device arrivals/departures -// whether through interrupts or polling, -// 2. Polled HPD-awareness iff miniport can not asynchronously notify the OS about external -// device arrivals/departures, but OS can sporadically poll for its presence, and of a -// monitor, causing visual artifacts on each poll. -// 3. Interruptible HPD-awareness iff miniport can asynchronously notify the OS about -// external device arrivals/departures. -typedef enum _DXGK_CHILD_DEVICE_HPD_AWARENESS { - HpdAwarenessUninitialized = 0, - HpdAwarenessAlwaysConnected = 1, - HpdAwarenessNone = 2, - HpdAwarenessPolled = 3, - HpdAwarenessInterruptible = 4 -} DXGK_CHILD_DEVICE_HPD_AWARENESS, *PDXGK_CHILD_DEVICE_HPD_AWARENESS; - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Monitor orientation descriptor type. -// -typedef enum _D3DKMDT_MONITOR_ORIENTATION -{ - D3DKMDT_MO_UNINITIALIZED = 0, - D3DKMDT_MO_0DEG = 1, - D3DKMDT_MO_90DEG = 2, - D3DKMDT_MO_180DEG = 3, - D3DKMDT_MO_270DEG = 4 -} -D3DKMDT_MONITOR_ORIENTATION; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Video output technology descriptor type. -// -// Remarks: Video output technology is used to determine the hard-coded list of video modes supported -// by the monitor, when monitor descriptor is not available. -// -typedef enum _D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY -{ - D3DKMDT_VOT_UNINITIALIZED = -2, - D3DKMDT_VOT_OTHER = -1, - D3DKMDT_VOT_HD15 = 0, - D3DKMDT_VOT_SVIDEO = 1, - D3DKMDT_VOT_COMPOSITE_VIDEO = 2, - D3DKMDT_VOT_COMPONENT_VIDEO = 3, - D3DKMDT_VOT_DVI = 4, - D3DKMDT_VOT_HDMI = 5, - D3DKMDT_VOT_LVDS = 6, - D3DKMDT_VOT_D_JPN = 8, - D3DKMDT_VOT_SDI = 9, - D3DKMDT_VOT_DISPLAYPORT_EXTERNAL = 10, - D3DKMDT_VOT_DISPLAYPORT_EMBEDDED = 11, - D3DKMDT_VOT_UDI_EXTERNAL = 12, - D3DKMDT_VOT_UDI_EMBEDDED = 13, - D3DKMDT_VOT_SDTVDONGLE = 14, - D3DKMDT_VOT_INTERNAL = 0x80000000, - - // Remove when DDI is unlocked. - D3DKMDT_VOT_SVIDEO_4PIN = D3DKMDT_VOT_SVIDEO, - D3DKMDT_VOT_SVIDEO_7PIN = D3DKMDT_VOT_SVIDEO, - D3DKMDT_VOT_RF = D3DKMDT_VOT_COMPOSITE_VIDEO, - D3DKMDT_VOT_RCA_3COMPONENT = D3DKMDT_VOT_COMPONENT_VIDEO, - D3DKMDT_VOT_BNC = D3DKMDT_VOT_COMPONENT_VIDEO, -} -D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Monitor orientation awareness descriptor type. -// -typedef enum _D3DKMDT_MONITOR_ORIENTATION_AWARENESS -{ - D3DKMDT_MOA_UNINITIALIZED = 0, - D3DKMDT_MOA_NONE = 1, - D3DKMDT_MOA_POLLED = 2, - D3DKMDT_MOA_INTERRUPTIBLE = 3 -} -D3DKMDT_MONITOR_ORIENTATION_AWARENESS; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Video present target descriptor type. -// -typedef struct _D3DKMDT_VIDEO_PRESENT_TARGET -{ - // Unique ID used to reference the respective video present target by the miniport and the OS. - D3DDDI_VIDEO_PRESENT_TARGET_ID Id; - - // Type of the video output technology (see D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY for more details). - D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY VideoOutputTechnology; - - // Type of the video output's HPD awareness (see D3DKMDT_VIDEO_OUTPUT_HPD_AWARENESS for more details). - DXGK_CHILD_DEVICE_HPD_AWARENESS VideoOutputHpdAwareness; - - D3DKMDT_MONITOR_ORIENTATION_AWARENESS MonitorOrientationAwareness; - - // NOTE: On monitor arrival, OS will leave monitor mode set empty for monitors connected to video outputs - // supporting SDTV modes, expecting miniport to populate modes it wants to expose for that monitor. - // - // NOTE: This predicate is also used when selecting video output for presentation on a TV via - // APIs that don't support explicit specification of monitors/video outputs (e.g. VIDEOPARAMETERS). - // - // Predicate specifying whether corresponding video output supports SDTV modes. - BOOLEAN SupportsSdtvModes; -} -D3DKMDT_VIDEO_PRESENT_TARGET; - - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Video present target mode GTF compliance descriptor type. -typedef enum _D3DKMDT_GTFCOMPLIANCE -{ - D3DKMDT_GTF_UNINITIALIZED = 0, - D3DKMDT_GTF_COMPLIANT = 1, - D3DKMDT_GTF_NOTCOMPLIANT = 2 -} -D3DKMDT_GTFCOMPLIANCE; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: VidPN target mode preference descriptor type. -typedef enum _D3DKMDT_MODE_PREFERENCE -{ - D3DKMDT_MP_UNINITIALIZED = 0, - D3DKMDT_MP_PREFERRED = 1, - D3DKMDT_MP_NOTPREFERRED = 2, -} -D3DKMDT_MODE_PREFERENCE; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Video signal info descriptor type. -// -// Remarks: Video signal info is the mode of operation of a given video output that's driving a connected -// moitor and is driven by an internal video output codec. -// Note that this descriptor supersedes subset of the XDDM's VIDEO_MODE_INFORMATION structure -// related to video mode. In XDDM, both video and rendering modes were described in this struct. -// LDDM separates these two notions, and hence their descriptors. -// The video standard field, vidStandard, should be used for video mode comparisons, when it's -// set to a well-defined video standard. Note that most of the standard modes do not comply with -// the VESA GTF frequency constraints. -// -// If color basis of the target mode does not correspond to that of the source mode, appropriate -// color conversion is performed by the respective video output codec. -// -typedef struct _D3DKMDT_VIDEO_SIGNAL_INFO -{ - // Video mode standard this mode is defined by (if any). - D3DKMDT_VIDEO_SIGNAL_STANDARD VideoStandard; - - // Video signal's size in pixels (i.e. HTotal & VTotal). - D3DKMDT_2DREGION TotalSize; - - // Presented image's size in active pixels (i.e. HActive & VActive). - D3DKMDT_2DREGION ActiveSize; - - // Vertical refresh frequency (in Hz). - D3DDDI_RATIONAL VSyncFreq; - - // Horizontal refresh frequency (in Hz). - D3DDDI_RATIONAL HSyncFreq; - - // Pixel clock rate (in Hz). - SIZE_T PixelRate; - - // Scan line ordering (e.g. progressive, interlaced). - D3DDDI_VIDEO_SIGNAL_SCANLINE_ORDERING ScanLineOrdering; -} -D3DKMDT_VIDEO_SIGNAL_INFO; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Video present target mode ID type. -typedef UINT D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Video present target mode descriptor type. -typedef struct _D3DKMDT_VIDPN_TARGET_MODE -{ - // Identifier unique within the set this mode is part of. - D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID Id; - - // Video signal parameters. - D3DKMDT_VIDEO_SIGNAL_INFO VideoSignalInfo; - - // Predicate specifying whether this mode is preferred by the adapter given the mode pinned on - // the source of the respective present path. - D3DKMDT_MODE_PREFERENCE Preference; -} -D3DKMDT_VIDPN_TARGET_MODE; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: VESA Display ID detailed timing type I. - -#pragma pack(push, 1) -#define DISPLAYID_DETAILED_TIMING_TYPE_I_SIZE 20 - -// Enum specifying monitor's aspect ratio (see DISPLAYID_DETAILED_TIMING_TYPE_I.AspectRatio) -enum _DISPLAYID_DETAILED_TIMING_TYPE_I_ASPECT_RATIO -{ - DIDDT1_AspectRatio_1x1 = 0, // 000 = 1:1 - DIDDT1_AspectRatio_5x4 = 1, // 001 = 5:4 - DIDDT1_AspectRatio_4x3 = 2, // 010 = 4:3 - DIDDT1_AspectRatio_15x9 = 3, // 011 = 15:9 - DIDDT1_AspectRatio_16x9 = 4, // 100 = 16:9 - DIDDT1_AspectRatio_16x10 = 5, // 101 = 16:10 -}; - -enum _DISPLAYID_DETAILED_TIMING_TYPE_I_SCANNING_MODE -{ - DIDDT1_Progressive = 0, // 0 = Progressive mode - DIDDT1_Interlaced = 1, // 1 = Interlaced mode -}; - -enum _DISPLAYID_DETAILED_TIMING_TYPE_I_STEREO_MODE -{ - DIDDT1_Monoscopic = 0, // 00 = Monoscopic (no stereo) mode - DIDDT1_Stereo = 1, // 01 = Stereo mode - DIDDT1_Dependent = 2, // 10 = Stereo mode despends on user action -}; - -enum _DISPLAYID_DETAILED_TIMING_TYPE_I_SYNC_POLARITY -{ - DIDDT1_Sync_Positive = 0, - DIDDT1_Sync_Negative = 1, -}; - -typedef struct _DISPLAYID_DETAILED_TIMING_TYPE_I -{ - struct - { - ULONG PixelClock : 24; // Pixel clock / 10000 - ULONG AspectRatio : 3; // Aspect ratio - ULONG Reserved : 1; - ULONG ScanningType : 1; // Frame scanning type - ULONG StereoMode : 2; // 3D stereo mode - ULONG PreferredTiming : 1; // preferred timing - }; - - USHORT HorizontalActivePixels; // Horizontal active image pixel number - USHORT HorizontalBlankPixels; // Horizontal blank pixel number - struct - { - USHORT HorizontalFrontPorch : 15; // Horizontal offset (front porch) pixel number - USHORT HorizontalSyncPolarity : 1; // Horizontal sync polarity - }; - USHORT HorizontalSyncWidth; // Horizontal sync pixel number - - USHORT VerticalActiveLines; // Number of lines of vertical active image - USHORT VerticalBlankLines; // Number of lines of vertical blank - struct - { - USHORT VerticalFrontPorch : 15; // Number of lines of vertical offset (front porch) - USHORT VerticalSyncPolarity : 1; // Vertical sync polarity - }; - USHORT VerticalSyncWidth; // Number of lines of vertical sync -}DISPLAYID_DETAILED_TIMING_TYPE_I; - -C_ASSERT(sizeof(DISPLAYID_DETAILED_TIMING_TYPE_I) == DISPLAYID_DETAILED_TIMING_TYPE_I_SIZE); - -#pragma pack(pop) - -typedef struct _DXGK_TARGETMODE_DETAIL_TIMING -{ - // Video standard this detail timing comes from. - D3DKMDT_VIDEO_SIGNAL_STANDARD VideoStandard; - - // ID of this detail timing in VideoStandard. - UINT TimingId; - - // Detail timing. - DISPLAYID_DETAILED_TIMING_TYPE_I DetailTiming; -}DXGK_TARGETMODE_DETAIL_TIMING; - - -// Structure of hardware capability -typedef struct _D3DKMDT_VIDPN_HW_CAPABILITY -{ - UINT DriverRotation : 1; - UINT DriverScaling : 1; - UINT DriverCloning : 1; - UINT DriverColorConvert : 1; - UINT DriverLinkedAdapaterOutput : 1; - UINT DriverRemoteDisplay : 1; - UINT Reserved : 26; -} -D3DKMDT_VIDPN_HW_CAPABILITY; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Video present target mode ID type. -typedef UINT D3DKMDT_MONITOR_SOURCE_MODE_ID; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Monitor capability origin type. -typedef enum _D3DKMDT_MONITOR_CAPABILITIES_ORIGIN -{ - D3DKMDT_MCO_UNINITIALIZED = 0, // mode information is coming from the: - D3DKMDT_MCO_DEFAULTMONITORPROFILE = 1, // + default monitor profile. - D3DKMDT_MCO_MONITORDESCRIPTOR = 2, // + monitor's descriptor. - D3DKMDT_MCO_MONITORDESCRIPTOR_REGISTRYOVERRIDE = 3, // + registry override of the monitor descriptor. - D3DKMDT_MCO_SPECIFICCAP_REGISTRYOVERRIDE = 4, // + registry override of a specific capability. - D3DKMDT_MCO_DRIVER = 5, // + display adapter driver. -} -D3DKMDT_MONITOR_CAPABILITIES_ORIGIN; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Monitor timing type. -typedef enum _D3DKMDT_MONITOR_TIMING_TYPE -{ - D3DKMDT_MTT_UNINITIALIZED = 0, // mode timing information is coming from: - D3DKMDT_MTT_ESTABLISHED = 1, // + established timings block. - D3DKMDT_MTT_STANDARD = 2, // + standard timings block. - D3DKMDT_MTT_EXTRASTANDARD = 3, // + extra standard timings block. - D3DKMDT_MTT_DETAILED = 4, // + detailed timings block. - D3DKMDT_MTT_DEFAULTMONITORPROFILE = 5, // + default monitor profile. - D3DKMDT_MTT_DRIVER = 6, // + display adapter driver. -} -D3DKMDT_MONITOR_TIMING_TYPE; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Video present target mode descriptor type. -typedef struct _D3DKMDT_MONITOR_SOURCE_MODE -{ - // Identifier unique within the set this mode is part of. - D3DKMDT_MONITOR_SOURCE_MODE_ID Id; - - // Video signal parameters. - D3DKMDT_VIDEO_SIGNAL_INFO VideoSignalInfo; - - // Color basis with respect to which monitor is presenting the pixels sampled from the video signal. - D3DKMDT_COLOR_BASIS ColorBasis; - - // Supported dynamic range of each of the pixel color bases' coefficients by the monitor's - // presentational technology - e.g. for a DFP LCD with 12-bit bit-depth, this might be (4, 4, 4, 0). - D3DKMDT_COLOR_COEFF_DYNAMIC_RANGES ColorCoeffDynamicRanges; - - // Origins of the monitor source mode information. - D3DKMDT_MONITOR_CAPABILITIES_ORIGIN Origin; - - // Predicate specifying whether this mode is preferred by the monitor connected to the respective video output. - D3DKMDT_MODE_PREFERENCE Preference; -} -D3DKMDT_MONITOR_SOURCE_MODE; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Frequency range type. -typedef struct _D3DKMDT_FREQUENCY_RANGE -{ - // Minimum vertical refresh frequency (in Hz) supported by the monitor. - D3DDDI_RATIONAL MinVSyncFreq; - - // Maximum vertical refresh frequency (in Hz) supported by the monitor. - D3DDDI_RATIONAL MaxVSyncFreq; - - // Minimum horizontal refresh frequency (in Hz) supported by the monitor. - D3DDDI_RATIONAL MinHSyncFreq; - - // Maximum horizontal refresh frequency (in Hz) supported by the monitor. - D3DDDI_RATIONAL MaxHSyncFreq; -} -D3DKMDT_FREQUENCY_RANGE; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Monitor frequency range constraint type. -typedef enum _D3DKMDT_MONITOR_FREQUENCY_RANGE_CONSTRAINT -{ - D3DKMDT_MFRC_UNINITIALIZED = 0, - D3DKMDT_MFRC_ACTIVESIZE = 1, - D3DKMDT_MFRC_MAXPIXELRATE = 2 -} -D3DKMDT_MONITOR_FREQUENCY_RANGE_CONSTRAINT; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Monitor frequency range type. -typedef struct _D3DKMDT_MONITOR_FREQUENCY_RANGE -{ - // Origins of the monitor frequency range information. - D3DKMDT_MONITOR_CAPABILITIES_ORIGIN Origin; - - // Frequency range limits. - D3DKMDT_FREQUENCY_RANGE RangeLimits; - - // Type of the frequency range constraint. - D3DKMDT_MONITOR_FREQUENCY_RANGE_CONSTRAINT ConstraintType; - - // Constraint under which this frequency range is supported. - union - { - // Active region size this frequency range applies to. - D3DKMDT_2DREGION ActiveSize; - - // Maximum pixel clock rate (in Hz) to which this pixel rate applies. - SIZE_T MaxPixelRate; - - } Constraint; -} -D3DKMDT_MONITOR_FREQUENCY_RANGE; - - - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// VidPN present paths - -// VidPN present path index used during enumeration of paths satisfying certain criteria -// (e.g. originating from the same source). -typedef SIZE_T D3DKMDT_VIDPN_PRESENT_PATH_INDEX; - -// Purpose: VidPN present path scaling type. -typedef enum _D3DKMDT_VIDPN_PRESENT_PATH_SCALING -{ - D3DKMDT_VPPS_UNINITIALIZED = 0, - - // For the following transformation, spatial resolutions must be equal on both the source and the target. - - // Source content is not modified in any way. - D3DKMDT_VPPS_IDENTITY = 1, - - // For the following three transformations, spatial resolution of the source differs from that of the target. - - // Source content is centered on the target. - D3DKMDT_VPPS_CENTERED = 2, - - // Source content is scaled to fit the target, no aspect ratio preserving. - D3DKMDT_VPPS_STRETCHED = 3, - - // Source content is scaled to fit the target. Aspect ratio preserving. - D3DKMDT_VPPS_ASPECTRATIOCENTEREDMAX = 4, - - // Scaling that cannot be described by any other D3DKMDT_VPPS_XXX value - D3DKMDT_VPPS_CUSTOM = 5, - - - // Reserved for internal OS use - D3DKMDT_VPPS_RESERVED1 = 253, - - // Source content scaling mode is not pinned. - D3DKMDT_VPPS_UNPINNED = 254, - - // OS does not specify the scaling mode, and miniport should decide based on its own settings. - D3DKMDT_VPPS_NOTSPECIFIED = 255 -} -D3DKMDT_VIDPN_PRESENT_PATH_SCALING; - - -// Purpose: VidPN present path rotation type. -typedef enum _D3DKMDT_VIDPN_PRESENT_PATH_ROTATION -{ - D3DKMDT_VPPR_UNINITIALIZED = 0, - - // Source content is not modified in any way. - D3DKMDT_VPPR_IDENTITY = 1, - - // Source content is rotated 90 degrees. - D3DKMDT_VPPR_ROTATE90 = 2, - - // Source content is rotated 180 degrees. - D3DKMDT_VPPR_ROTATE180 = 3, - - // Source content is rotated 270 degrees. - D3DKMDT_VPPR_ROTATE270 = 4, - - // Source content rotation setting is not pinned. - D3DKMDT_VPPR_UNPINNED = 254, - - // OS does not specify the rotation mode, and miniport should decide based on its own settings. - D3DKMDT_VPPR_NOTSPECIFIED = 255 -} -D3DKMDT_VIDPN_PRESENT_PATH_ROTATION; - -#define D3DKMDT_SCALING_SUPPORT_MASK 0x1f; - -// Purpose: Specifies what scaling modes are supported given current path configuration. -typedef struct _D3DKMDT_VIDPN_PRESENT_PATH_SCALING_SUPPORT -{ - UINT Identity : 1; - UINT Centered : 1; - UINT Stretched : 1; - UINT AspectRatioCenteredMax : 1; - UINT Custom : 1; -} D3DKMDT_VIDPN_PRESENT_PATH_SCALING_SUPPORT; - -#define D3DKMDT_ROTATION_SUPPORT_MASK 0xf; - -// Purpose: Specifies what rotation modes are supported given current path configuration. -typedef struct _D3DKMDT_VIDPN_PRESENT_PATH_ROTATION_SUPPORT -{ - UINT Identity : 1; - UINT Rotate90 : 1; - UINT Rotate180 : 1; - UINT Rotate270 : 1; -} D3DKMDT_VIDPN_PRESENT_PATH_ROTATION_SUPPORT; - -// Purpose: Combines all the transformation related fields into one structure. -typedef struct _D3DKMDT_VIDPN_PRESENT_PATH_TRANSFORMATION -{ - // Scaling applied to the content presented on this video present path. - D3DKMDT_VIDPN_PRESENT_PATH_SCALING Scaling; - - // Scaling support given the currently pinned modes. - D3DKMDT_VIDPN_PRESENT_PATH_SCALING_SUPPORT ScalingSupport; - - // Rotation applied to the content presented on this video present path. - D3DKMDT_VIDPN_PRESENT_PATH_ROTATION Rotation; - - // Rotation support given the currently pinned modes. - D3DKMDT_VIDPN_PRESENT_PATH_ROTATION_SUPPORT RotationSupport; -} D3DKMDT_VIDPN_PRESENT_PATH_TRANSFORMATION; - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: VidPN present path importance ordinal type. -// -// Note: Higher order importance ordinals can be used (upto 255), but only the first 10 have been explicitly named. -// -typedef enum _D3DKMDT_VIDPN_PRESENT_PATH_IMPORTANCE -{ - D3DKMDT_VPPI_UNINITIALIZED = 0, - D3DKMDT_VPPI_PRIMARY = 1, - D3DKMDT_VPPI_SECONDARY = 2, - D3DKMDT_VPPI_TERTIARY = 3, - D3DKMDT_VPPI_QUATERNARY = 4, - D3DKMDT_VPPI_QUINARY = 5, - D3DKMDT_VPPI_SENARY = 6, - D3DKMDT_VPPI_SEPTENARY = 7, - D3DKMDT_VPPI_OCTONARY = 8, - D3DKMDT_VPPI_NONARY = 9, - D3DKMDT_VPPI_DENARY = 10, -} -D3DKMDT_VIDPN_PRESENT_PATH_IMPORTANCE; - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: VidPN present path content ordinal type. -// -// Indicates whether the content being displayed is video or graphics. -// -typedef enum _D3DKMDT_VIDPN_PRESENT_PATH_CONTENT -{ - D3DKMDT_VPPC_UNINITIALIZED = 0, - - // Miniport should optimize presentation of the present path for graphics content. - D3DKMDT_VPPC_GRAPHICS = 1, - - // Miniport should optimize presentation of the present path for video content. - D3DKMDT_VPPC_VIDEO = 2, - - // OS does not specify the content type, and miniport should decide based on its own settings. - D3DKMDT_VPPC_NOTSPECIFIED = 255 -} -D3DKMDT_VIDPN_PRESENT_PATH_CONTENT; - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: VidPN present path macrovision information. -// -// Contains macrovision caps and controls. -// -typedef enum _D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_TYPE -{ - D3DKMDT_VPPMT_UNINITIALIZED = 0, - - D3DKMDT_VPPMT_NOPROTECTION = 1, - - D3DKMDT_VPPMT_MACROVISION_APSTRIGGER = 2, - - D3DKMDT_VPPMT_MACROVISION_FULLSUPPORT = 3, - -} -D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_TYPE; - -typedef struct _D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_SUPPORT -{ - UINT NoProtection : 1; - UINT MacroVisionApsTrigger : 1; - UINT MacroVisionFull : 1; - UINT Reserved : 29; -} -D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_SUPPORT; - -#define D3DKMDT_MACROVISION_OEMCOPYPROTECTION_SIZE 256 - -typedef struct _D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION -{ - // Macrovision controls. - D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_TYPE CopyProtectionType; - UINT APSTriggerBits; - BYTE OEMCopyProtection[D3DKMDT_MACROVISION_OEMCOPYPROTECTION_SIZE]; - - // Level of available copy protection support. - D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_SUPPORT CopyProtectionSupport; -} D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION; - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: VidPN present path gamma ramp descriptor type. -// -typedef struct _D3DKMDT_GAMMA_RAMP -{ - D3DDDI_GAMMARAMP_TYPE Type; - SIZE_T DataSize; - - // If (Type == D3DDDI_GAMMARAMP_DEFAULT), (DataSize == 0) and (Data.pFormatOther == NULL ) - union - { - D3DDDI_GAMMA_RAMP_RGB256x3x16* pRgb256x3x16; // Type == D3DDDI_GAMMARAMP_RGB256x3x16. - D3DDDI_GAMMA_RAMP_DXGI_1* pDxgi1; // Type == D3DDDI_GAMMARAMP_DXGI_1. - VOID* pRaw; - } - Data; -} -D3DKMDT_GAMMA_RAMP; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Video present target to source mapping. -// -// Remarks: This type is used to describe a mapping from a single video present target to a single -// video present source in a VidPN topology. -// -typedef struct _D3DKMDT_VIDPN_PRESENT_PATH -{ - D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; - - D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; - - // Video present path importance ordinal (e.g. path presenting the primary view may have higher - // importance set on it in order to guarantee that it gets the best source/target mode sets). - D3DKMDT_VIDPN_PRESENT_PATH_IMPORTANCE ImportanceOrdinal; - - // Contains all the transformation related fields. - D3DKMDT_VIDPN_PRESENT_PATH_TRANSFORMATION ContentTransformation; - - // Storing deltas for visible/active pixels mapping rather than visible pixels' - // size & offset has the added benefit of ideal/default state being zeros. - - // Monitor screen's offset of visible pixels' top-left corner from - // video signal's active pixels top-left corner. - // Note: Default = (0,0). - D3DKMDT_2DOFFSET VisibleFromActiveTLOffset; - - // Monitor screen's offset of visible pixels' bottom-right corner from - // video signal's active pixels bottom-right corner. - // Note: Default = (0,0). - D3DKMDT_2DOFFSET VisibleFromActiveBROffset; - - // Video signal color basis with respect to which video output codec encodes the pixels from the respective - // source's primary surface (e.g. on HDMI this can be either RGB or YCbCr). - D3DKMDT_COLOR_BASIS VidPnTargetColorBasis; - - // Supported dynamic range of each of the color bases' coefficients by the video output codec's output - // E.g. With a DAC scaning out A2R10G10B10 primary surface at R8G8B8 color resolution, this would be (8,8,8,0), - D3DKMDT_COLOR_COEFF_DYNAMIC_RANGES VidPnTargetColorCoeffDynamicRanges; - - // Indicates the content being diplayed. The driver can use this to determine whether the flicker filter - // and overscan should be enabled or disabled. - D3DKMDT_VIDPN_PRESENT_PATH_CONTENT Content; - - // Contains all the copy protection related fields. - D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION CopyProtection; - - // A lookup table (LUT) used to compensate intensity of presented content for the color response of the monitor - // connected to present path's target. - D3DKMDT_GAMMA_RAMP GammaRamp; -} -D3DKMDT_VIDPN_PRESENT_PATH; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Specifies whether to ignore monitor connectivity checks or enforce them. -// -typedef enum _D3DKMDT_MONITOR_CONNECTIVITY_CHECKS -{ - D3DKMDT_MCC_UNINITIALIZED = 0, - D3DKMDT_MCC_IGNORE = 1, - D3DKMDT_MCC_ENFORCE = 2 -} -D3DKMDT_MONITOR_CONNECTIVITY_CHECKS; - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Purpose: Type of the owner whose mode set does not change during an enumeration. -// -// Remarks: When OS pins/unpins a mode in one of VidPN's mode sets, the only mode set that is guaranteed to -// stay the same is the mode set whose mode was pinned/unpinned. Enumeration pivot lets the OS -// specify to the miniport which mode set it should not update (because this mode set could not have -// been invalidated as a result of the change the OS made to the VidPN. -// -typedef enum _D3DKMDT_ENUMCOFUNCMODALITY_PIVOT_TYPE -{ - D3DKMDT_EPT_UNINITIALIZED, - D3DKMDT_EPT_VIDPNSOURCE, - D3DKMDT_EPT_VIDPNTARGET, - D3DKMDT_EPT_SCALING, - D3DKMDT_EPT_ROTATION, - D3DKMDT_EPT_NOPIVOT -} -D3DKMDT_ENUMCOFUNCMODALITY_PIVOT_TYPE; - -// -// Monitor descriptor related types. -// - -typedef UINT D3DKMDT_MONITOR_DESCRIPTOR_ID; - -typedef enum _D3DKMDT_MONITOR_DESCRIPTOR_TYPE -{ - D3DKMDT_MDT_UNINITIALIZED = 0, - D3DKMDT_MDT_VESA_EDID_V1_BASEBLOCK = 1, - D3DKMDT_MDT_VESA_EDID_V1_BLOCKMAP = 2, - D3DKMDT_MDT_OTHER = 255 -} -D3DKMDT_MONITOR_DESCRIPTOR_TYPE; - -typedef struct _D3DKMDT_MONITOR_DESCRIPTOR -{ - D3DKMDT_MONITOR_DESCRIPTOR_ID Id; - D3DKMDT_MONITOR_DESCRIPTOR_TYPE Type; - SIZE_T DataSize; - VOID* pData; - D3DKMDT_MONITOR_CAPABILITIES_ORIGIN Origin; -} -D3DKMDT_MONITOR_DESCRIPTOR; - - -typedef enum _D3DKMDT_STANDARDALLOCATION_TYPE -{ - D3DKMDT_STANDARDALLOCATION_SHAREDPRIMARYSURFACE = 1, - D3DKMDT_STANDARDALLOCATION_SHADOWSURFACE = 2, - D3DKMDT_STANDARDALLOCATION_STAGINGSURFACE = 3, - D3DKMDT_STANDARDALLOCATION_GDISURFACE = 4, -} D3DKMDT_STANDARDALLOCATION_TYPE; - -typedef struct _D3DKMDT_SHAREDPRIMARYSURFACEDATA -{ - UINT Width; - UINT Height; - D3DDDIFORMAT Format; - D3DDDI_RATIONAL RefreshRate; - D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; -} D3DKMDT_SHAREDPRIMARYSURFACEDATA; - -typedef struct _D3DKMDT_SHADOWSURFACEDATA -{ - UINT Width; - UINT Height; - D3DDDIFORMAT Format; - UINT Pitch; //out: Driver must return Pitch as this allocation will be lockabale -} D3DKMDT_SHADOWSURFACEDATA; - -//Staging Surface is a surface created potentially -//during present when a direct Blt to primary is -//not possible in cases like multimon or sprites. -//This surface is always in the format of D3DDDIFMT_X8R8G8B8 - -typedef struct _D3DKMDT_STAGINGSURFACEDATA -{ - UINT Width; //in: Width of the staging buffer - UINT Height; //in: Height of the staging buffer - UINT Pitch; //out: Driver must return Pitch as this allocation will be lockabale -} D3DKMDT_STAGINGSURFACEDATA; - -typedef struct _D3DKMDT_GDISURFACEFLAGS -{ - UINT Value; -} D3DKMDT_GDISURFACEFLAGS; - -typedef enum _D3DKMDT_GDISURFACETYPE -{ - D3DKMDT_GDISURFACE_INVALID = 0, - D3DKMDT_GDISURFACE_TEXTURE = 1, - D3DKMDT_GDISURFACE_STAGING_CPUVISIBLE = 2, - D3DKMDT_GDISURFACE_STAGING = 3, - D3DKMDT_GDISURFACE_LOOKUPTABLE = 4, - D3DKMDT_GDISURFACE_EXISTINGSYSMEM = 5, -} D3DKMDT_GDISURFACETYPE; - -typedef struct _D3DKMDT_GDISURFACEDATA -{ - UINT Width; - UINT Height; - D3DDDIFORMAT Format; - D3DKMDT_GDISURFACETYPE Type; - D3DKMDT_GDISURFACEFLAGS Flags; - UINT Pitch; // out: The driver must return pitch if allocation is CPU visible -} D3DKMDT_GDISURFACEDATA; - -typedef struct _D3DKMDT_PALETTEDATA -{ - BYTE Red; - BYTE Green; - BYTE Blue; - BYTE Unused; -} D3DKMDT_PALETTEDATA; - -// -//Red - Bits to be put in the Red portion of the color registers. -// -//Green - Bits to be put in the Green portion of the color registers. -// -//Blue - Bits to be put in the Blue portion of the color registers. -// - -typedef struct _DXGKARG_SETPALETTE -{ - D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; - UINT FirstEntry; - UINT NumEntries; - D3DKMDT_PALETTEDATA* pLookupTable; -} DXGKARG_SETPALETTE; - -// -//NumEntries - Number of entries in the LookupTable of color values. -// -//FirstEntry - Location in the device palette to which the first entry in the -// LookupTable of colors should be copied to. The other entries in the -// LookupTable should be copied sequentially, from this starting point into -// the device's palette. -// -//pLookupTable - Array of color entries to copy into the device's color -// registers/palette. The color entries can be accessed as a genric 32 bit -// value or as Red/Green/Blue/Unused fields. -// - - -//////////////////// I2C //////////////////////////////////////////////////////////////////////////////////// - -#define DXGKMDT_I2C_NO_FLAGS 0 -#define DXGKMDT_I2C_DEVICE_TRANSMITS_DATA_LENGTH 1 - -//////////////////// OPM (Output Protection Manager) //////////////////////////////////////////////////////// - -#pragma pack( push, 1 ) - -#define DXGKMDT_OPM_OMAC_SIZE 16 -#define DXGKMDT_OPM_128_BIT_RANDOM_NUMBER_SIZE 16 -#define DXGKMDT_OPM_ENCRYPTED_PARAMETERS_SIZE 256 -#define DXGKMDT_OPM_CONFIGURE_SETTING_DATA_SIZE 4056 -#define DXGKMDT_OPM_GET_INFORMATION_PARAMETERS_SIZE 4056 -#define DXGKMDT_OPM_REQUESTED_INFORMATION_SIZE 4076 -#define DXGKMDT_OPM_HDCP_KEY_SELECTION_VECTOR_SIZE 5 -#define DXGKMDT_OPM_PROTECTION_TYPE_SIZE 4 - -DEFINE_GUID(DXGKMDT_OPM_GET_CURRENT_HDCP_SRM_VERSION, 0x99c5ceff, 0x5f1d, 0x4879, 0x81, 0xc1, 0xc5, 0x24, 0x43, 0xc9, 0x48, 0x2b); -DEFINE_GUID(DXGKMDT_OPM_GET_CONNECTED_HDCP_DEVICE_INFORMATION, 0x0db59d74, 0xa992, 0x492e, 0xa0, 0xbd, 0xc2, 0x3f, 0xda, 0x56, 0x4e, 0x00); -DEFINE_GUID(DXGKMDT_OPM_GET_CONNECTOR_TYPE, 0x81d0bfd5, 0x6afe, 0x48c2, 0x99, 0xc0, 0x95, 0xa0, 0x8f, 0x97, 0xc5, 0xda); -DEFINE_GUID(DXGKMDT_OPM_GET_SUPPORTED_PROTECTION_TYPES, 0x38f2a801, 0x9a6c, 0x48bb, 0x91, 0x07, 0xb6, 0x69, 0x6e, 0x6f, 0x17, 0x97); -DEFINE_GUID(DXGKMDT_OPM_GET_VIRTUAL_PROTECTION_LEVEL, 0xb2075857, 0x3eda, 0x4d5d, 0x88, 0xdb, 0x74, 0x8f, 0x8c, 0x1a, 0x05, 0x49); -DEFINE_GUID(DXGKMDT_OPM_GET_ACTUAL_PROTECTION_LEVEL, 0x1957210a, 0x7766, 0x452a, 0xb9, 0x9a, 0xd2, 0x7a, 0xed, 0x54, 0xf0, 0x3a); -DEFINE_GUID(DXGKMDT_OPM_GET_ACTUAL_OUTPUT_FORMAT, 0xd7bf1ba3, 0xad13, 0x4f8e, 0xaf, 0x98, 0x0d, 0xcb, 0x3c, 0xa2, 0x04, 0xcc); -DEFINE_GUID(DXGKMDT_OPM_GET_ADAPTER_BUS_TYPE, 0xc6f4d673, 0x6174, 0x4184, 0x8e, 0x35, 0xf6, 0xdb, 0x52, 0x0, 0xbc, 0xba); -DEFINE_GUID(DXGKMDT_OPM_GET_ACP_AND_CGMSA_SIGNALING, 0x6629a591, 0x3b79, 0x4cf3, 0x92, 0x4a, 0x11, 0xe8, 0xe7, 0x81, 0x16, 0x71); -DEFINE_GUID(DXGKMDT_OPM_GET_OUTPUT_ID, 0x72cb6df3, 0x244f, 0x40ce, 0xb0, 0x9e, 0x20, 0x50, 0x6a, 0xf6, 0x30, 0x2f); -DEFINE_GUID(DXGKMDT_OPM_GET_DVI_CHARACTERISTICS, 0xa470b3bb, 0x5dd7, 0x4172, 0x83, 0x9c, 0x3d, 0x37, 0x76, 0xe0, 0xeb, 0xf5); -DEFINE_GUID(DXGKMDT_OPM_SET_PROTECTION_LEVEL, 0x9bb9327c, 0x4eb5, 0x4727, 0x9f, 0x00, 0xb4, 0x2b, 0x09, 0x19, 0xc0, 0xda); -DEFINE_GUID(DXGKMDT_OPM_SET_ACP_AND_CGMSA_SIGNALING, 0x09a631a5, 0xd684, 0x4c60, 0x8e, 0x4d, 0xd3, 0xbb, 0x0f, 0x0b, 0xe3, 0xee); -DEFINE_GUID(DXGKMDT_OPM_SET_HDCP_SRM, 0x8b5ef5d1, 0xc30d, 0x44ff, 0x84, 0xa5, 0xea, 0x71, 0xdc, 0xe7, 0x8f, 0x13); -DEFINE_GUID(DXGKMDT_OPM_SET_PROTECTION_LEVEL_ACCORDING_TO_CSS_DVD, 0x39ce333e, 0x4cc0, 0x44ae, 0xbf, 0xcc, 0xda, 0x50, 0xb5, 0xf8, 0x2e, 0x72); - -typedef enum _DXGKMDT_CERTIFICATE_TYPE -{ - DXGKMDT_OPM_CERTIFICATE = 0, - DXGKMDT_COPP_CERTIFICATE = 1, - DXGKMDT_UAB_CERTIFICATE = 2, - DXGKMDT_FORCE_ULONG = 0xFFFFFFFF -} DXGKMDT_CERTIFICATE_TYPE; - -typedef enum _DXGKMDT_OPM_VIDEO_OUTPUT_SEMANTICS -{ - DXGKMDT_OPM_VOS_COPP_SEMANTICS = 0, - DXGKMDT_OPM_VOS_OPM_SEMANTICS = 1 -} DXGKMDT_OPM_VIDEO_OUTPUT_SEMANTICS; - -typedef enum _DXGKMDT_DPCP_PROTECTION_LEVEL -{ - DXGKMDT_OPM_DPCP_OFF = 0, - DXGKMDT_OPM_DPCP_ON = 1, - DXGKMDT_OPM_DPCP_FORCE_ULONG = 0x7fffffff - -} DXGKMDT_OPM_DPCP_PROTECTION_LEVEL; - -typedef enum _DXGKMDT_OPM_HDCP_FLAG -{ - DXGKMDT_OPM_HDCP_FLAG_NONE = 0x00, - DXGKMDT_OPM_HDCP_FLAG_REPEATER = 0x01 -} DXGKMDT_OPM_HDCP_FLAG; - -typedef enum _DXGKMDT_OPM_STATUS -{ - DXGKMDT_OPM_STATUS_NORMAL = 0x00, - DXGKMDT_OPM_STATUS_LINK_LOST = 0x01, - DXGKMDT_OPM_STATUS_RENEGOTIATION_REQUIRED = 0x02, - DXGKMDT_OPM_STATUS_TAMPERING_DETECTED = 0x04, - DXGKMDT_OPM_STATUS_REVOKED_HDCP_DEVICE_ATTACHED = 0x08 -} DXGKMDT_OPM_STATUS; - -// NUAE stands for Non-User Accessible Enclosure -typedef enum _DXGKMDT_OPM_BUS_TYPE_AND_IMPLEMENTATION -{ - DXGKMDT_OPM_BUS_TYPE_OTHER = 0x00000000, - DXGKMDT_OPM_BUS_TYPE_PCI = 0x00000001, - DXGKMDT_OPM_BUS_TYPE_PCIX = 0x00000002, - DXGKMDT_OPM_BUS_TYPE_PCIEXPRESS = 0x00000003, - DXGKMDT_OPM_BUS_TYPE_AGP = 0x00000004, - DXGKMDT_OPM_BUS_IMPLEMENTATION_MODIFIER_INSIDE_OF_CHIPSET = 0x00010000, - DXGKMDT_OPM_BUS_IMPLEMENTATION_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP = 0x00020000, - DXGKMDT_OPM_BUS_IMPLEMENTATION_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET = 0x00030000, - DXGKMDT_OPM_BUS_IMPLEMENTATION_MODIFIER_DAUGHTER_BOARD_CONNECTOR = 0x00040000, - DXGKMDT_OPM_BUS_IMPLEMENTATION_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE = 0x00050000, - DXGKMDT_OPM_BUS_IMPLEMENTATION_MODIFIER_NON_STANDARD = 0x80000000, - DXGKMDT_OPM_COPP_COMPATIBLE_BUS_TYPE_INTEGRATED = 0x80000000 -} DXGKMDT_OPM_BUS_TYPE_AND_IMPLEMENTATION; - -typedef enum _DXGKMDT_OPM_HDCP_PROTECTION_LEVEL -{ - DXGKMDT_OPM_HDCP_OFF = 0, - DXGKMDT_OPM_HDCP_ON = 1, - DXGKMDT_OPM_HDCP_FORCE_ULONG = 0x7fffffff -} DXGKMDT_OPM_HDCP_PROTECTION_LEVEL; - -typedef enum _DXGKMDT_OPM_CGMSA -{ - DXGKMDT_OPM_CGMSA_OFF = 0, - DXGKMDT_OPM_CGMSA_COPY_FREELY = 1, - DXGKMDT_OPM_CGMSA_COPY_NO_MORE = 2, - DXGKMDT_OPM_CGMSA_COPY_ONE_GENERATION = 3, - DXGKMDT_OPM_CGMSA_COPY_NEVER = 4, - DXGKMDT_OPM_REDISTRIBUTION_CONTROL_REQUIRED = 0x08, -} DXGKMDT_OPM_CGMSA; - -typedef enum _DXGKMDT_OPM_ACP_PROTECTION_LEVEL -{ - DXGKMDT_OPM_ACP_OFF = 0, - DXGKMDT_OPM_ACP_LEVEL_ONE = 1, - DXGKMDT_OPM_ACP_LEVEL_TWO = 2, - DXGKMDT_OPM_ACP_LEVEL_THREE = 3, - DXGKMDT_OPM_ACP_FORCE_ULONG = 0x7fffffff -} DXGKMDT_OPM_ACP_PROTECTION_LEVEL; - -typedef enum _DXGKMDT_OPM_PROTECTION_TYPE -{ - DXGKMDT_OPM_PROTECTION_TYPE_OTHER = 0x80000000, - DXGKMDT_OPM_PROTECTION_TYPE_NONE = 0x00000000, - DXGKMDT_OPM_PROTECTION_TYPE_COPP_COMPATIBLE_HDCP = 0x00000001, - DXGKMDT_OPM_PROTECTION_TYPE_ACP = 0x00000002, - DXGKMDT_OPM_PROTECTION_TYPE_CGMSA = 0x00000004, - DXGKMDT_OPM_PROTECTION_TYPE_HDCP = 0x00000008, - DXGKMDT_OPM_PROTECTION_TYPE_DPCP = 0x00000010, - DXGKMDT_OPM_PROTECTION_TYPE_MASK = 0x8000001F -} DXGKMDT_OPM_PROTECTION_TYPE; - -typedef enum _DXGKMDT_OPM_PROTECTION_STANDARD -{ - DXGKMDT_OPM_PROTECTION_STANDARD_OTHER = 0x80000000, - DXGKMDT_OPM_PROTECTION_STANDARD_NONE = 0x00000000, - DXGKMDT_OPM_PROTECTION_STANDARD_IEC61880_525I = 0x00000001, - DXGKMDT_OPM_PROTECTION_STANDARD_IEC61880_2_525I = 0x00000002, - DXGKMDT_OPM_PROTECTION_STANDARD_IEC62375_625P = 0x00000004, - DXGKMDT_OPM_PROTECTION_STANDARD_EIA608B_525 = 0x00000008, - DXGKMDT_OPM_PROTECTION_STANDARD_EN300294_625I = 0x00000010, - DXGKMDT_OPM_PROTECTION_STANDARD_CEA805A_TYPEA_525P = 0x00000020, - DXGKMDT_OPM_PROTECTION_STANDARD_CEA805A_TYPEA_750P = 0x00000040, - DXGKMDT_OPM_PROTECTION_STANDARD_CEA805A_TYPEA_1125I = 0x00000080, - DXGKMDT_OPM_PROTECTION_STANDARD_CEA805A_TYPEB_525P = 0x00000100, - DXGKMDT_OPM_PROTECTION_STANDARD_CEA805A_TYPEB_750P = 0x00000200, - DXGKMDT_OPM_PROTECTION_STANDARD_CEA805A_TYPEB_1125I = 0x00000400, - DXGKMDT_OPM_PROTECTION_STANDARD_ARIBTRB15_525I = 0x00000800, - DXGKMDT_OPM_PROTECTION_STANDARD_ARIBTRB15_525P = 0x00001000, - DXGKMDT_OPM_PROTECTION_STANDARD_ARIBTRB15_750P = 0x00002000, - DXGKMDT_OPM_PROTECTION_STANDARD_ARIBTRB15_1125I = 0x00004000, -} DXGKMDT_OPM_PROTECTION_STANDARD; - -typedef enum _DXGKMDT_OPM_IMAGE_ASPECT_RATIO_EN300294 -{ - DXGKMDT_OPM_ASPECT_RATIO_EN300294_FULL_FORMAT_4_BY_3 = 0, - DXGKMDT_OPM_ASPECT_RATIO_EN300294_BOX_14_BY_9_CENTER = 1, - DXGKMDT_OPM_ASPECT_RATIO_EN300294_BOX_14_BY_9_TOP = 2, - DXGKMDT_OPM_ASPECT_RATIO_EN300294_BOX_16_BY_9_CENTER = 3, - DXGKMDT_OPM_ASPECT_RATIO_EN300294_BOX_16_BY_9_TOP = 4, - DXGKMDT_OPM_ASPECT_RATIO_EN300294_BOX_GT_16_BY_9_CENTER = 5, - DXGKMDT_OPM_ASPECT_RATIO_EN300294_FULL_FORMAT_4_BY_3_PROTECTED_CENTER = 6, - DXGKMDT_OPM_ASPECT_RATIO_EN300294_FULL_FORMAT_16_BY_9_ANAMORPHIC = 7, - DXGKMDT_OPM_ASPECT_RATIO_FORCE_ULONG = 0x7FFFFFFF -} DXGKMDT_OPM_IMAGE_ASPECT_RATIO_EN300294; - -typedef enum _DXGKMDT_OPM_INTERLEAVE_FORMAT -{ - DXGKMDT_OPM_INTERLEAVE_FORMAT_OTHER = 0, - DXGKMDT_OPM_INTERLEAVE_FORMAT_PROGRESSIVE = 2, - DXGKMDT_OPM_INTERLEAVE_FORMAT_INTERLEAVED_EVEN_FIRST = 3, - DXGKMDT_OPM_INTERLEAVE_FORMAT_INTERLEAVED_ODD_FIRST = 4, - DXGKMDT_OPM_INTERLEAVE_FORMAT_FORCE_ULONG = 0xFFFFFFFF - -} DXGKMDT_OPM_INTERLEAVE_FORMAT; - -typedef enum _DXGKDT_OPM_DVI_CHARACTERISTICS -{ - DXGKMDT_OPM_DVI_CHARACTERISTIC_1_0 = 1, - DXGKMDT_OPM_DVI_CHARACTERISTIC_1_1_OR_ABOVE = 2, - DXGKMDT_OPM_DVI_CHARACTERISTICS_FORCE_ULONG = 0xFFFFFFFF -} DXGKDT_OPM_DVI_CHARACTERISTICS; - -typedef struct _DXGKMDT_OPM_RANDOM_NUMBER -{ - BYTE abRandomNumber[DXGKMDT_OPM_128_BIT_RANDOM_NUMBER_SIZE]; -} DXGKMDT_OPM_RANDOM_NUMBER, *PDXGKMDT_OPM_RANDOM_NUMBER; - -typedef struct _DXGKMDT_OPM_OMAC -{ - BYTE abOMAC[DXGKMDT_OPM_OMAC_SIZE]; -} DXGKMDT_OPM_OMAC, *PDXGKMDT_OPM_OMAC; - -typedef struct _DXGKMDT_OPM_ENCRYPTED_PARAMETERS -{ - BYTE abEncryptedParameters[DXGKMDT_OPM_ENCRYPTED_PARAMETERS_SIZE]; -} DXGKMDT_OPM_ENCRYPTED_PARAMETERS, *PDXGKMDT_OPM_ENCRYPTED_PARAMETERS; - -typedef struct _DXGKMDT_OPM_GET_INFO_PARAMETERS -{ - DXGKMDT_OPM_OMAC omac; - DXGKMDT_OPM_RANDOM_NUMBER rnRandomNumber; - GUID guidInformation; - ULONG ulSequenceNumber; - ULONG cbParametersSize; - BYTE abParameters[DXGKMDT_OPM_GET_INFORMATION_PARAMETERS_SIZE]; -} DXGKMDT_OPM_GET_INFO_PARAMETERS, *PDXGKMDT_OPM_GET_INFO_PARAMETERS; - -typedef struct _DXGKMDT_OPM_COPP_COMPATIBLE_GET_INFO_PARAMETERS -{ - DXGKMDT_OPM_RANDOM_NUMBER rnRandomNumber; - GUID guidInformation; - ULONG ulSequenceNumber; - ULONG cbParametersSize; - BYTE abParameters[DXGKMDT_OPM_GET_INFORMATION_PARAMETERS_SIZE]; -} DXGKMDT_OPM_COPP_COMPATIBLE_GET_INFO_PARAMETERS, *PDXGKMDT_OPM_COPP_COMPATIBLE_GET_INFO_PARAMETERS; - -typedef struct _DXGKMDT_OPM_HDCP_KEY_SELECTION_VECTOR -{ - BYTE abKeySelectionVector[DXGKMDT_OPM_HDCP_KEY_SELECTION_VECTOR_SIZE]; -} DXGKMDT_OPM_HDCP_KEY_SELECTION_VECTOR; - -typedef struct _DXGKMDT_OPM_CONNECTED_HDCP_DEVICE_INFORMATION -{ - DXGKMDT_OPM_RANDOM_NUMBER rnRandomNumber; - ULONG ulStatusFlags; - ULONG ulHDCPFlags; - DXGKMDT_OPM_HDCP_KEY_SELECTION_VECTOR ksvB; - BYTE Reserved[11]; - BYTE Reserved2[16]; - BYTE Reserved3[16]; -} DXGKMDT_OPM_CONNECTED_HDCP_DEVICE_INFORMATION; - -typedef struct _DXGKMDT_OPM_REQUESTED_INFORMATION -{ - DXGKMDT_OPM_OMAC omac; - ULONG cbRequestedInformationSize; - BYTE abRequestedInformation[DXGKMDT_OPM_REQUESTED_INFORMATION_SIZE]; -} DXGKMDT_OPM_REQUESTED_INFORMATION, *PDXGKMDT_OPM_REQUESTED_INFORMATION; - -typedef struct _DXGKMDT_OPM_STANDARD_INFORMATION -{ - DXGKMDT_OPM_RANDOM_NUMBER rnRandomNumber; - ULONG ulStatusFlags; - ULONG ulInformation; - ULONG ulReserved; - ULONG ulReserved2; -} DXGKMDT_OPM_STANDARD_INFORMATION; - -typedef struct _DXGKMDT_OPM_ACTUAL_OUTPUT_FORMAT -{ - DXGKMDT_OPM_RANDOM_NUMBER rnRandomNumber; - ULONG ulStatusFlags; - ULONG ulDisplayWidth; - ULONG ulDisplayHeight; - DXGKMDT_OPM_INTERLEAVE_FORMAT ifInterleaveFormat; - ULONG d3dFormat; - ULONG ulFrequencyNumerator; - ULONG ulFrequencyDenominator; -} DXGKMDT_OPM_ACTUAL_OUTPUT_FORMAT; - -typedef struct _DXGKMDT_OPM_ACP_AND_CGMSA_SIGNALING -{ - DXGKMDT_OPM_RANDOM_NUMBER rnRandomNumber; - ULONG ulStatusFlags; - ULONG ulAvailableTVProtectionStandards; - ULONG ulActiveTVProtectionStandard; - ULONG ulReserved; - ULONG ulAspectRatioValidMask1; - ULONG ulAspectRatioData1; - ULONG ulAspectRatioValidMask2; - ULONG ulAspectRatioData2; - ULONG ulAspectRatioValidMask3; - ULONG ulAspectRatioData3; - ULONG ulReserved2[4]; - ULONG ulReserved3[4]; -} DXGKMDT_OPM_ACP_AND_CGMSA_SIGNALING; - -typedef struct _DXGKMDT_OPM_OUTPUT_ID -{ - DXGKMDT_OPM_RANDOM_NUMBER rnRandomNumber; - ULONG ulStatusFlags; - UINT64 OutputId; -} DXGKMDT_OPM_OUTPUT_ID; - -typedef struct _DXGKMDT_OPM_CONFIGURE_PARAMETERS -{ - DXGKMDT_OPM_OMAC omac; - GUID guidSetting; - ULONG ulSequenceNumber; - ULONG cbParametersSize; - BYTE abParameters[DXGKMDT_OPM_CONFIGURE_SETTING_DATA_SIZE]; -} DXGKMDT_OPM_CONFIGURE_PARAMETERS, *PDXGKMDT_OPM_CONFIGURE_PARAMETERS; - -typedef struct _DXGKMDT_OPM_SET_PROTECTION_LEVEL_PARAMETERS -{ - ULONG ulProtectionType; - ULONG ulProtectionLevel; - ULONG Reserved; - ULONG Reserved2; -} DXGKMDT_OPM_SET_PROTECTION_LEVEL_PARAMETERS; - -typedef struct _DXGKMDT_OPM_SET_ACP_AND_CGMSA_SIGNALING_PARAMETERS -{ - ULONG ulNewTVProtectionStandard; - ULONG ulAspectRatioChangeMask1; - ULONG ulAspectRatioData1; - ULONG ulAspectRatioChangeMask2; - ULONG ulAspectRatioData2; - ULONG ulAspectRatioChangeMask3; - ULONG ulAspectRatioData3; - ULONG ulReserved[4]; - ULONG ulReserved2[4]; - ULONG ulReserved3; -} DXGKMDT_OPM_SET_ACP_AND_CGMSA_SIGNALING_PARAMETERS; - -typedef struct _DXGKMDT_OPM_SET_HDCP_SRM_PARAMETERS -{ - ULONG ulSRMVersion; -} DXGKMDT_OPM_SET_HDCP_SRM_PARAMETERS; - -#pragma pack( pop ) - -#endif // (NTDDI_VERSION >= NTDDI_LONGHORN) || defined(D3DKMDT_SPECIAL_MULTIPLATFORM_TOOL) - -#pragma warning(pop) - -#endif /* _D3DKMDT_H */ - - diff --git a/pub/ddk/d3dukmdt.h b/pub/ddk/d3dukmdt.h deleted file mode 100644 index 45dac92..0000000 --- a/pub/ddk/d3dukmdt.h +++ /dev/null @@ -1,758 +0,0 @@ -/******************************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_ */ - - diff --git a/pub/ddk/d3dvec.inl b/pub/ddk/d3dvec.inl deleted file mode 100644 index 332e435..0000000 --- a/pub/ddk/d3dvec.inl +++ /dev/null @@ -1,256 +0,0 @@ - -/****************************************************************** - * * - * D3DVec.inl * - * * - * Float-valued 3D vector class for Direct3D. * - * * - * Copyright (c) Microsoft Corp. All rights reserved. * - * * - ******************************************************************/ - -#include - -// ===================================== -// 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; -} - - diff --git a/pub/ddk/d4drvif.h b/pub/ddk/d4drvif.h deleted file mode 100644 index b07e3a3..0000000 --- a/pub/ddk/d4drvif.h +++ /dev/null @@ -1,155 +0,0 @@ -/*++ - -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 - diff --git a/pub/ddk/d4iface.h b/pub/ddk/d4iface.h deleted file mode 100644 index 26fbb8d..0000000 --- a/pub/ddk/d4iface.h +++ /dev/null @@ -1,101 +0,0 @@ -/*++ - -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 - diff --git a/pub/ddk/dciddi.h b/pub/ddk/dciddi.h deleted file mode 100644 index b597f6f..0000000 --- a/pub/ddk/dciddi.h +++ /dev/null @@ -1,288 +0,0 @@ -/******************************************************************* - * - * 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 - diff --git a/pub/ddk/dciman.h b/pub/ddk/dciman.h deleted file mode 100644 index 0313d6a..0000000 --- a/pub/ddk/dciman.h +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** - - 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 - diff --git a/pub/ddk/dderror.h b/pub/ddk/dderror.h deleted file mode 100644 index 737ebc9..0000000 --- a/pub/ddk/dderror.h +++ /dev/null @@ -1,47 +0,0 @@ - -/*++ 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_ */ - - diff --git a/pub/ddk/deviceservices.h b/pub/ddk/deviceservices.h deleted file mode 100644 index 8ee05bd..0000000 --- a/pub/ddk/deviceservices.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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_ */ - - diff --git a/pub/ddk/dispmprt.h b/pub/ddk/dispmprt.h deleted file mode 100644 index b1b1859..0000000 --- a/pub/ddk/dispmprt.h +++ /dev/null @@ -1,1480 +0,0 @@ -/*++ - -Copyright (c) 2004 Microsoft Corporation - -Module Name: - - dispmprt.h - -Abstract: - - This header contain the new Display Loader APIs. - - ---*/ - -#ifndef _DISPMPRT_H_ -#define _DISPMPRT_H_ - -#pragma warning(push) -#pragma warning(disable:4115) // named type definition in parentheses -#pragma warning(disable:4201) // nameless struct/union -#pragma warning(disable:4214) // bit field types other than int - -#ifndef _ACPIIOCT_H_ -#include -#endif - -// -// Old includes which are only kept for now for compatibility -// - -#ifndef _NTOSP_ -#define _NTOSP_ - -// -// Structures used by the kernel drivers to describe which ports must be -// hooked out directly from the V86 emulator to the driver. -// - -typedef enum _EMULATOR_PORT_ACCESS_TYPE { - Uchar, - Ushort, - Ulong -} EMULATOR_PORT_ACCESS_TYPE, *PEMULATOR_PORT_ACCESS_TYPE; - -typedef struct _EMULATOR_ACCESS_ENTRY { - ULONG BasePort; - ULONG NumConsecutivePorts; - EMULATOR_PORT_ACCESS_TYPE AccessType; - UCHAR AccessMode; - UCHAR StringSupport; - PVOID Routine; -} EMULATOR_ACCESS_ENTRY, *PEMULATOR_ACCESS_ENTRY; - -#endif - -// -// Graphics support routines. -// - -typedef -VOID -(*PBANKED_SECTION_ROUTINE) ( - IN ULONG ReadBank, - IN ULONG WriteBank, - IN PVOID Context - ); - -// -// Exclude some items from video.h -// - -#define _NTOSDEF_ - -#include -#include - -// -// Define types used in d3dukmdt.h, included via d3dkmdt.h that are not defined in this scope. -// - -typedef unsigned int UINT; -typedef unsigned long DWORD; -typedef unsigned char BYTE; - -#include -#include -#include - -#define DlDebugPrintEx(arg) DlDebugPrint arg - -// -// ** New definitions ********************************************************* -// - -// -// Available only for Vista (LONGHORN) and later -// -#if (NTDDI_VERSION >= NTDDI_LONGHORN) - -// -// Define ACPI event IDs -// - -#define ACPI_NOTIFY_DOCK_EVENT 0x77 -#define ACPI_NOTIFY_PANEL_SWITCH 0x80 -#define ACPI_NOTIFY_DEVICE_HOTPLUG 0x81 -#define ACPI_NOTIFY_CYCLE_DISPLAY_HOTKEY 0x82 -#define ACPI_NOTIFY_NEXT_DISPLAY_HOTKEY 0x83 -#define ACPI_NOTIFY_PREV_DISPLAY_HOTKEY 0x84 -#define ACPI_NOTIFY_CYCLE_BRIGHTNESS_HOTKEY 0x85 -#define ACPI_NOTIFY_INC_BRIGHTNESS_HOTKEY 0x86 -#define ACPI_NOTIFY_DEC_BRIGHTNESS_HOTKEY 0x87 -#define ACPI_NOTIFY_ZERO_BRIGHTNESS_HOTKEY 0x88 -#define ACPI_NOTIFY_VIDEO_WAKEUP 0x90 - -// -// ACPI argument definitions -// - -#define ACPI_ARG_ENABLE_SWITCH_EVENT 0x0 -#define ACPI_ARG_ENABLE_AUTO_SWITCH 0x1 -#define ACPI_ARG_DISABLE_SWITCH_EVENT 0x2 -#define ACPI_ARG_ENABLE_AUTO_LCD_BRIGHTNESS 0x0 -#define ACPI_ARG_DISABLE_AUTO_LCD_BRIGHTNESS 0x4 - -// -// ACPI methods for the adapter -// - -#define ACPI_METHOD_DISPLAY_DOS (ULONG)('SOD_') -#define ACPI_METHOD_DISPLAY_DOD (ULONG)('DOD_') -#define ACPI_METHOD_DISPLAY_ROM (ULONG)('MOR_') -#define ACPI_METHOD_DISPLAY_GPD (ULONG)('DPG_') -#define ACPI_METHOD_DISPLAY_SPD (ULONG)('DPS_') -#define ACPI_METHOD_DISPLAY_VPO (ULONG)('OPV_') - -// -// ACPI methods for children -// - -#define ACPI_METHOD_OUTPUT_ADR (ULONG)('RDA_') -#define ACPI_METHOD_OUTPUT_BCL (ULONG)('LCB_') -#define ACPI_METHOD_OUTPUT_BCM (ULONG)('MCB_') -#define ACPI_METHOD_OUTPUT_DDC (ULONG)('CDD_') -#define ACPI_METHOD_OUTPUT_DCS (ULONG)('SCD_') -#define ACPI_METHOD_OUTPUT_DGS (ULONG)('SGD_') -#define ACPI_METHOD_OUTPUT_DSS (ULONG)('SSD_') - -// -// ACPI Flags -// - -#define DXGK_ACPI_POLL_DISPLAY_CHILDREN 0x00000001 -#define DXGK_ACPI_CHANGE_DISPLAY_MODE 0x00000002 -#define DXGK_ACPI_CHANGE_DISPLAY_TOPOLOGY 0x00000004 - -// -// Exclude adapter access flags. -// - -#define DXGK_EXCLUDE_EVICT_ALL 0x00000001 -#define DXGK_EXCLUDE_CALL_SYNCHRONOUS 0x00000002 -#define DXGK_EXCLUDE_BRIDGE_ACCESS 0x00000004 - -// -// Max of 50 characters per string. -// - -#define DXGK_MAX_STRING_LEN 50 -#define DXGK_MAX_REG_SZ_LEN DXGK_MAX_STRING_LEN + 1 - -// -// Supported device space types. -// - -#define DXGK_WHICHSPACE_CONFIG PCI_WHICHSPACE_CONFIG -#define DXGK_WHICHSPACE_ROM PCI_WHICHSPACE_ROM -#define DXGK_WHICHSPACE_MCH 0x80000000 -#define DXGK_WHICHSPACE_BRIDGE 0x80000001 - -// -// Linked display adapter support. -// - -typedef struct _LINKED_DEVICE { - ULONG ChainUid; - ULONG NumberOfLinksInChain; - BOOLEAN LeadLink; -} LINKED_DEVICE, *PLINKED_DEVICE; - -// -// Type of ACPI notification event. -// - -typedef enum _DXGK_EVENT_TYPE { - DxgkUndefinedEvent, - DxgkAcpiEvent, - DxgkPowerStateEvent, - DxgkDockingEvent -} DXGK_EVENT_TYPE, *PDXGK_EVENT_TYPE; - -typedef struct _DXGK_VIDEO_OUTPUT_CAPABILITIES { - D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY InterfaceTechnology; - D3DKMDT_MONITOR_ORIENTATION_AWARENESS MonitorOrientationAwareness; - BOOLEAN SupportsSdtvModes; -} DXGK_VIDEO_OUTPUT_CAPABILITIES, *PDXGK_VIDEO_OUTPUT_CAPABILITIES; - - -typedef struct _DXGK_CHILD_CAPABILITIES { - - union - { - // - // If (CHILD_DESCRIPTOR::ChildDeviceType == TypeVideoOutput) - // - - DXGK_VIDEO_OUTPUT_CAPABILITIES VideoOutput; - - // - // If (CHILD_DESCRIPTOR::ChildDeviceType == TypeOther) - // - - struct - { - UINT MustBeZero; - } - Other; - } Type; - - DXGK_CHILD_DEVICE_HPD_AWARENESS HpdAwareness; -} DXGK_CHILD_CAPABILITIES, *PDXGK_CHILD_CAPABILITIES; - -typedef enum _DXGK_CHILD_DEVICE_TYPE { - TypeUninitialized, - TypeVideoOutput, - TypeOther -} DXGK_CHILD_DEVICE_TYPE, *PDXGK_CHILD_DEVICE_TYPE; - -// -// Child descriptor structure returned to us from the miniport -// -// NOTE: If (ChildDeviceType==TypeVideoOutput) then (ChildUid == video present target ID) -// - -typedef struct _DXGK_CHILD_DESCRIPTOR { - DXGK_CHILD_DEVICE_TYPE ChildDeviceType; - DXGK_CHILD_CAPABILITIES ChildCapabilities; - ULONG AcpiUid; - ULONG ChildUid; -} DXGK_CHILD_DESCRIPTOR, *PDXGK_CHILD_DESCRIPTOR; - -typedef struct _DXGK_DEVICE_DESCRIPTOR { - ULONG DescriptorOffset; - ULONG DescriptorLength; - PVOID DescriptorBuffer; -} DXGK_DEVICE_DESCRIPTOR, *PDXGK_DEVICE_DESCRIPTOR; - -typedef struct _DXGK_GENERIC_DESCRIPTOR { - WCHAR HardwareId[DXGK_MAX_REG_SZ_LEN]; - WCHAR InstanceId[DXGK_MAX_REG_SZ_LEN]; - WCHAR CompatibleId[DXGK_MAX_REG_SZ_LEN]; - WCHAR DeviceText[DXGK_MAX_REG_SZ_LEN]; -} DXGK_GENERIC_DESCRIPTOR, *PDXGK_GENERIC_DESCRIPTOR; - -// -// Types of status that the miniport can report back to us -// - -typedef enum _DXGK_CHILD_STATUS_TYPE{ - StatusUninitialized, - StatusConnection, - StatusRotation -} DXGK_CHILD_STATUS_TYPE, *PDXGK_CHILD_STATUS_TYPE; - -// -// Child Status structure which can be queried directly or -// indicated up by the miniport -// - -typedef struct _DXGK_CHILD_STATUS { - DXGK_CHILD_STATUS_TYPE Type; - ULONG ChildUid; - union { - struct { - BOOLEAN Connected; - } HotPlug; - struct { - UCHAR Angle; - } Rotation; - }; -} DXGK_CHILD_STATUS, *PDXGK_CHILD_STATUS; - -// -// DxgkCbExcludeAdapterAccess callback. -// - -typedef -VOID -(*DXGKDDI_PROTECTED_CALLBACK)( - IN CONST PVOID MiniportDeviceContext, - IN PVOID ProtectedCallbackContext, - IN NTSTATUS ProtectionStatus - ); - -// -// GUID_DEVINTERFACE_I2C {2564AA4F-DDDB-4495-B497-6AD4A84163D7} -// - -DEFINE_GUID(GUID_DEVINTERFACE_I2C, 0x2564AA4F, 0xDDDB, 0x4495, 0xB4, 0x97, 0x6A, 0xD4, 0xA8, 0x41, 0x63, 0xD7); - -// -// GUID_DEVINTERFACE_OPM {BF4672DE-6B4E-4BE4-A325-68A91EA49C09} -// - -DEFINE_GUID(GUID_DEVINTERFACE_OPM, 0xBF4672DE, 0x6B4E, 0x4BE4, 0xA3, 0x25, 0x68, 0xA9, 0x1E, 0xA4, 0x9C, 0x09); - -// -// GUID_DEVINTERFACE_BRIGHTNESS {FDE5BBA4-B3F9-46FB-BDAA-0728CE3100B4} -// - -DEFINE_GUID( GUID_DEVINTERFACE_BRIGHTNESS, 0xFDE5BBA4, 0xB3F9, 0x46FB, 0xBD, 0xAA, 0x07, 0x28, 0xCE, 0x31, 0x00, 0xB4); - -// -// I2C Interface queried from the miniport. -// - -#define DXGK_I2C_INTERFACE_VERSION_1 0x01 - -typedef -NTSTATUS -(*DXGKDDI_I2C_TRANSMIT_DATA_TO_DISPLAY)( - IN PVOID MiniportDeviceContext, - IN D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, - IN ULONG SevenBitI2CAddress, - IN ULONG DataLength, - IN CONST PVOID Data - ); - -typedef -NTSTATUS -(*DXGKDDI_I2C_RECEIVE_DATA_FROM_DISPLAY)( - IN PVOID MiniportDeviceContext, - IN D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, - IN ULONG SevenBitI2CAddress, - IN ULONG Flags, - IN ULONG DataLength, - OUT PVOID Data - ); - -typedef struct _DXGK_I2C_INTERFACE { - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - DXGKDDI_I2C_TRANSMIT_DATA_TO_DISPLAY DxgkDdiI2CTransmitDataToDisplay; - DXGKDDI_I2C_RECEIVE_DATA_FROM_DISPLAY DxgkDdiI2CReceiveDataFromDisplay; -} DXGK_I2C_INTERFACE, *PDXGK_I2C_INTERFACE; - -// -// OPM Interface from the miniport. -// - -#define DXGK_OPM_INTERFACE_VERSION_1 0x01 - -typedef -NTSTATUS -(*DXGKDDI_OPM_GET_CERTIFICATE_SIZE)( - IN PVOID MiniportDeviceContext, - IN DXGKMDT_CERTIFICATE_TYPE CertificateType, - OUT PULONG CertificateSize - ); - -typedef -NTSTATUS -(*DXGKDDI_OPM_GET_CERTIFICATE)( - IN PVOID MiniportDeviceContext, - IN DXGKMDT_CERTIFICATE_TYPE CertificateType, - IN ULONG CertificateSize, - OUT PVOID CertificateBuffer - ); - -typedef -NTSTATUS -(*DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT)( - IN PVOID MiniportDeviceContext, - IN D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, - IN DXGKMDT_OPM_VIDEO_OUTPUT_SEMANTICS NewVideoOutputSemantics, - OUT PHANDLE NewProtectedOutputHandle - ); - -typedef -NTSTATUS -(*DXGKDDI_OPM_GET_RANDOM_NUMBER)( - IN PVOID MiniportDeviceContext, - IN HANDLE ProtectedOutputHandle, - OUT PDXGKMDT_OPM_RANDOM_NUMBER RandomNumber - ); - -typedef -NTSTATUS -(*DXGKDDI_OPM_SET_SIGNING_KEY_AND_SEQUENCE_NUMBERS)( - IN PVOID MiniportDeviceContext, - IN HANDLE ProtectedOutputHandle, - IN CONST PDXGKMDT_OPM_ENCRYPTED_PARAMETERS EncryptedParameters - ); - -typedef -NTSTATUS -(*DXGKDDI_OPM_GET_INFORMATION)( - IN PVOID MiniportDeviceContext, - IN HANDLE ProtectedOutputHandle, - IN CONST PDXGKMDT_OPM_GET_INFO_PARAMETERS Parameters, - OUT PDXGKMDT_OPM_REQUESTED_INFORMATION RequestedInformation - ); - -typedef -NTSTATUS -(*DXGKDDI_OPM_GET_COPP_COMPATIBLE_INFORMATION)( - IN PVOID MiniportDeviceContext, - IN HANDLE ProtectedOutputHandle, - IN CONST PDXGKMDT_OPM_COPP_COMPATIBLE_GET_INFO_PARAMETERS Parameters, - OUT PDXGKMDT_OPM_REQUESTED_INFORMATION RequestedInformation - ); - -typedef -NTSTATUS -(*DXGKDDI_OPM_CONFIGURE_PROTECTED_OUTPUT)( - IN PVOID MiniportDeviceContext, - IN HANDLE ProtectedOutputHandle, - IN CONST PDXGKMDT_OPM_CONFIGURE_PARAMETERS Parameters, - IN ULONG AdditionalParametersSize, - IN CONST PVOID AdditionalParameters - ); - -typedef -NTSTATUS -(*DXGKDDI_OPM_DESTROY_PROTECTED_OUTPUT)( - IN PVOID MiniportDeviceContext, - IN HANDLE ProtectedOutputHandle - ); - -typedef struct _DXGK_OPM_INTERFACE { - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - DXGKDDI_OPM_GET_CERTIFICATE_SIZE DxgkDdiOPMGetCertificateSize; - DXGKDDI_OPM_GET_CERTIFICATE DxgkDdiOPMGetCertificate; - DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT DxgkDdiOPMCreateProtectedOutput; - DXGKDDI_OPM_GET_RANDOM_NUMBER DxgkDdiOPMGetRandomNumber; - DXGKDDI_OPM_SET_SIGNING_KEY_AND_SEQUENCE_NUMBERS DxgkDdiOPMSetSigningKeyAndSequenceNumbers; - DXGKDDI_OPM_GET_INFORMATION DxgkDdiOPMGetInformation; - DXGKDDI_OPM_GET_COPP_COMPATIBLE_INFORMATION DxgkDdiOPMGetCOPPCompatibleInformation; - DXGKDDI_OPM_CONFIGURE_PROTECTED_OUTPUT DxgkDdiOPMConfigureProtectedOutput; - DXGKDDI_OPM_DESTROY_PROTECTED_OUTPUT DxgkDdiOPMDestroyProtectedOutput; -} DXGK_OPM_INTERFACE, *PDXGK_OPM_INTERFACE; - - -#define DXGK_BRIGHTNESS_INTERFACE_VERSION_1 0x01 - -typedef -NTSTATUS -(*DXGK_BRIGHTNESS_GET_POSSIBLE)( - IN PVOID Context, - IN ULONG BufferSize, - OUT PUCHAR LevelCount, - OUT PUCHAR BrightnessLevels - ); - -typedef -NTSTATUS -(*DXGK_BRIGHTNESS_SET)( - IN PVOID Context, - IN UCHAR Brightness - ); - -typedef -NTSTATUS -(*DXGK_BRIGHTNESS_GET)( - IN PVOID Context, - IN PUCHAR Brightness - ); - -typedef struct -{ - IN USHORT Size; - IN USHORT Version; - OUT PVOID Context; - OUT PINTERFACE_REFERENCE InterfaceReference; - OUT PINTERFACE_DEREFERENCE InterfaceDereference; - OUT DXGK_BRIGHTNESS_GET_POSSIBLE GetPossibleBrightness; - OUT DXGK_BRIGHTNESS_SET SetBrightness; - OUT DXGK_BRIGHTNESS_GET GetBrightness; -} DXGK_BRIGHTNESS_INTERFACE, *PDXGK_BRIGHTNESS_INTERFACE; - -// -// Services exported by DxgkCbQueryServices() -// - -typedef enum -{ - DxgkServicesAgp, - DxgkServicesDebugReport, - DxgkServicesTimedOperation -} DXGK_SERVICES; - -// -// AGP Services -// - -#define DXGK_AGP_INTERFACE_VERSION_1 0x01 - -#define DXGK_AGPCOMMAND_AGP1X 0x00001 -#define DXGK_AGPCOMMAND_AGP2X 0x00002 -#define DXGK_AGPCOMMAND_AGP4X 0x00004 -#define DXGK_AGPCOMMAND_AGP8X 0x00008 -#define DXGK_AGPCOMMAND_DISABLE_SBA 0x10000 -#define DXGK_AGPCOMMAND_DISABLE_FW 0x20000 - -typedef -NTSTATUS -(APIENTRY *DXGKCB_AGP_ALLOCATE_POOL)( - IN HANDLE Context, - IN ULONG AllocationSize, - IN MEMORY_CACHING_TYPE CacheType, - OUT PPHYSICAL_ADDRESS PhysicalAddress, - OUT PVOID *VirtualAddress - ); - -typedef -NTSTATUS -(APIENTRY *DXGKCB_AGP_FREE_POOL)( - IN HANDLE Context, - IN PVOID VirtualAddress - ); - -typedef -NTSTATUS -(APIENTRY *DXGKCB_AGP_SET_COMMAND)( - IN HANDLE Context, - IN ULONG Command - ); - -typedef struct _DXGK_AGP_INTERFACE { - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - DXGKCB_AGP_ALLOCATE_POOL AgpAllocatePool; - DXGKCB_AGP_FREE_POOL AgpFreePool; - DXGKCB_AGP_SET_COMMAND AgpSetCommand; -} DXGK_AGP_INTERFACE, *PDXGK_AGP_INTERFACE; - -// -// Debug Report API -// - -DECLARE_HANDLE(DXGK_DEBUG_REPORT_HANDLE); -#define DXGK_DEBUG_REPORT_INTERFACE_VERSION_1 0x01 -#define DXGK_DEBUG_REPORT_MAX_SIZE 0xF800 - -typedef struct _DXGK_DEBUG_REPORT_INTERFACE -{ - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - DXGK_DEBUG_REPORT_HANDLE - (*DbgReportCreate)( - IN HANDLE DeviceHandle, - IN ULONG ulCode, - IN ULONG_PTR ulpArg1, - IN ULONG_PTR ulpArg2, - IN ULONG_PTR ulpArg3, - IN ULONG_PTR ulpArg4 - ); - - BOOLEAN - (*DbgReportSecondaryData)( - IN OUT DXGK_DEBUG_REPORT_HANDLE hReport, - IN __in_bcount(ulDataSize) PVOID pvData, - IN ULONG ulDataSize - ); - - VOID - (*DbgReportComplete)( - IN OUT DXGK_DEBUG_REPORT_HANDLE hReport - ); -} DXGK_DEBUG_REPORT_INTERFACE, *PDXGK_DEBUG_REPORT_INTERFACE; - -// -// Timed Operation API -// - -#define DXGK_TIMED_OPERATION_INTERFACE_VERSION_1 0x01 -#define DXGK_TIMED_OPERATION_TIMEOUT_MAX_SECONDS 5 - -typedef struct _DXGK_TIMED_OPERATION -{ - USHORT Size; - ULONG_PTR OwnerTag; - BOOLEAN OsHandled; - BOOLEAN TimeoutTriggered; - LARGE_INTEGER Timeout; - LARGE_INTEGER StartTick; -} DXGK_TIMED_OPERATION, *PDXGK_TIMED_OPERATION; - -typedef struct _DXGK_TIMED_OPERATION_INTERFACE -{ - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - NTSTATUS - (*TimedOperationStart)( - OUT DXGK_TIMED_OPERATION* Op, - IN const LARGE_INTEGER* Timeout, - IN BOOLEAN OsHandled - ); - - NTSTATUS - (*TimedOperationDelay)( - IN OUT DXGK_TIMED_OPERATION* Op, - IN KPROCESSOR_MODE WaitMode, - IN BOOLEAN Alertable, - IN const LARGE_INTEGER* Interval OPTIONAL - ); - - NTSTATUS - (*TimedOperationWaitForSingleObject)( - IN OUT DXGK_TIMED_OPERATION* Op, - IN PVOID Object, - IN KWAIT_REASON WaitReason, - IN KPROCESSOR_MODE WaitMode, - IN BOOLEAN Alertable, - IN const LARGE_INTEGER* Timeout OPTIONAL - ); -} DXGK_TIMED_OPERATION_INTERFACE, *PDXGK_TIMED_OPERATION_INTERFACE; - -typedef enum { - DockStateUnsupported = 0, - DockStateUnDocked = 1, - DockStateDocked = 2, - DockStateUnknown = 3, -} DOCKING_STATE; - -// -// Device Information Structure to provide OS provided data -// structures to the miniport -// - -typedef struct _DXGK_DEVICE_INFO { - PVOID MiniportDeviceContext; - PDEVICE_OBJECT PhysicalDeviceObject; - UNICODE_STRING DeviceRegistryPath; - PCM_RESOURCE_LIST TranslatedResourceList; - LARGE_INTEGER SystemMemorySize; - PHYSICAL_ADDRESS HighestPhysicalAddress; - PHYSICAL_ADDRESS AgpApertureBase; - SIZE_T AgpApertureSize; - DOCKING_STATE DockingState; -} DXGK_DEVICE_INFO, *PDXGK_DEVICE_INFO; - -// -// DxgKrnl interface -// - -#define DXGK_ACPI_PASS_ARGS_TO_CHILDREN 'araP' - - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -NTSTATUS -(APIENTRY *DXGKCB_EVAL_ACPI_METHOD)( - IN HANDLE DeviceHandle, - IN ULONG DeviceUid, - IN PACPI_EVAL_INPUT_BUFFER_COMPLEX AcpiInputBuffer, - IN ULONG AcpiInputSize, - IN OUT PACPI_EVAL_OUTPUT_BUFFER AcpiOutputBuffer, - IN ULONG AcpiOutputSize - ); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -NTSTATUS -(APIENTRY *DXGKCB_GET_DEVICE_INFORMATION)( - IN HANDLE DeviceHandle, - OUT PDXGK_DEVICE_INFO DeviceInfo - ); - -typedef -NTSTATUS -(APIENTRY *DXGKCB_INDICATE_CHILD_STATUS)( - IN HANDLE DeviceHandle, - IN PDXGK_CHILD_STATUS ChildStatus - ); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -NTSTATUS -(APIENTRY *DXGKCB_MAP_MEMORY)( - IN HANDLE DeviceHandle, - IN PHYSICAL_ADDRESS TranslatedAddress, - IN ULONG Length, - IN BOOLEAN InIoSpace, - IN BOOLEAN MapToUserMode, - IN MEMORY_CACHING_TYPE CacheType, - OUT PVOID *VirtualAddress - ); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -NTSTATUS -(APIENTRY *DXGKCB_QUERY_SERVICES)( - IN HANDLE DeviceHandle, - IN DXGK_SERVICES ServicesType, - IN OUT PINTERFACE Interface - ); - -typedef -BOOLEAN -(APIENTRY *DXGKCB_QUEUE_DPC)( - IN HANDLE DeviceHandle - ); - -typedef -NTSTATUS -(APIENTRY *DXGKCB_READ_DEVICE_SPACE)( - IN HANDLE DeviceHandle, - IN ULONG DataType, - IN PVOID Buffer, - IN ULONG Offset, - IN ULONG Length, - OUT PULONG BytesRead - ); - -typedef -NTSTATUS -(APIENTRY *DXGKCB_SYNCHRONIZE_EXECUTION)( - IN HANDLE DeviceHandle, - IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, - IN PVOID Context, - IN ULONG MessageNumber, - OUT PBOOLEAN ReturnValue - ); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -NTSTATUS -(APIENTRY *DXGKCB_UNMAP_MEMORY)( - IN HANDLE DeviceHandle, - IN PVOID VirtualAddress - ); - -typedef -NTSTATUS -(APIENTRY *DXGKCB_WRITE_DEVICE_SPACE)( - IN HANDLE DeviceHandle, - IN ULONG DataType, - IN PVOID Buffer, - IN ULONG Offset, - IN ULONG Length, - OUT PULONG BytesWritten - ); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -NTSTATUS -(APIENTRY *DXGKCB_IS_DEVICE_PRESENT)( - IN HANDLE DeviceHandle, - IN PPCI_DEVICE_PRESENCE_PARAMETERS DevicePresenceParameters, - OUT PBOOLEAN DevicePresent - ); - -typedef -VOID -(APIENTRY *DXGKCB_LOG_ETW_EVENT)( - IN CONST LPCGUID EventGuid, - IN UCHAR Type, - IN USHORT EventBufferSize, - IN PVOID EventBuffer - ); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -NTSTATUS -(APIENTRY *DXGKCB_EXCLUDE_ADAPTER_ACCESS)( - IN HANDLE DeviceHandle, - IN ULONG Attributes, - IN DXGKDDI_PROTECTED_CALLBACK DxgkProtectedCallback, - IN PVOID ProtectedCallbackContext - ); - -typedef struct _DXGK_START_INFO { - ULONG RequiredDmaQueueEntry; - GUID AdapterGuid; -} DXGK_START_INFO, *PDXGK_START_INFO; - - -typedef struct _DXGKRNL_INTERFACE { - ULONG Size; - ULONG Version; - HANDLE DeviceHandle; - - DXGKCB_EVAL_ACPI_METHOD DxgkCbEvalAcpiMethod; - DXGKCB_GET_DEVICE_INFORMATION DxgkCbGetDeviceInformation; - DXGKCB_INDICATE_CHILD_STATUS DxgkCbIndicateChildStatus; - DXGKCB_MAP_MEMORY DxgkCbMapMemory; - DXGKCB_QUEUE_DPC DxgkCbQueueDpc; - DXGKCB_QUERY_SERVICES DxgkCbQueryServices; - DXGKCB_READ_DEVICE_SPACE DxgkCbReadDeviceSpace; - DXGKCB_SYNCHRONIZE_EXECUTION DxgkCbSynchronizeExecution; - DXGKCB_UNMAP_MEMORY DxgkCbUnmapMemory; - DXGKCB_WRITE_DEVICE_SPACE DxgkCbWriteDeviceSpace; - DXGKCB_IS_DEVICE_PRESENT DxgkCbIsDevicePresent; - - DXGKCB_GETHANDLEDATA DxgkCbGetHandleData; - DXGKCB_GETHANDLEPARENT DxgkCbGetHandleParent; - DXGKCB_ENUMHANDLECHILDREN DxgkCbEnumHandleChildren; - DXGKCB_NOTIFY_INTERRUPT DxgkCbNotifyInterrupt; - DXGKCB_NOTIFY_DPC DxgkCbNotifyDpc; - DXGKCB_QUERYVIDPNINTERFACE DxgkCbQueryVidPnInterface; - DXGKCB_QUERYMONITORINTERFACE DxgkCbQueryMonitorInterface; - DXGKCB_GETCAPTUREADDRESS DxgkCbGetCaptureAddress; - - DXGKCB_LOG_ETW_EVENT DxgkCbLogEtwEvent; - - DXGKCB_EXCLUDE_ADAPTER_ACCESS DxgkCbExcludeAdapterAccess; -} DXGKRNL_INTERFACE, *PDXGKRNL_INTERFACE; - -// -// Kernel Mode Driver Interface -// - -// -// Define parameter types for SAL-annotated DDI parameters. These are used by -// the DDI function name typedefs. They are not needed in a driver's DDI function -// definitions, and should not be used in driver code. -// -// Naming convention: Concatenate all SAL annotations, an underscore, other modifiers -// such as CONST, and the type of the parameter, and use uppercase -// only. -// -typedef __in CONST PDEVICE_OBJECT IN_CONST_PDEVICE_OBJECT; -typedef __inout PLINKED_DEVICE INOUT_PLINKED_DEVICE; -typedef __inout PDXGK_CHILD_DESCRIPTOR INOUT_PDXGK_CHILD_DESCRIPTOR; -typedef __in PDXGK_CHILD_STATUS IN_PDXGK_CHILD_STATUS; -typedef __inout PDXGK_DEVICE_DESCRIPTOR INOUT_PDXGK_DEVICE_DESCRIPTOR; -typedef __in DXGK_EVENT_TYPE IN_DXGK_EVENT_TYPE; -typedef __in PDXGK_START_INFO IN_PDXGK_START_INFO; -typedef __in PDXGKRNL_INTERFACE IN_PDXGKRNL_INTERFACE; -typedef __in PQUERY_INTERFACE IN_PQUERY_INTERFACE; -typedef __in PVIDEO_REQUEST_PACKET IN_PVIDEO_REQUEST_PACKET; - -// -// Function name typedefs -// - -typedef - __checkReturn -NTSTATUS -DXGKDDI_ADD_DEVICE( - IN_CONST_PDEVICE_OBJECT PhysicalDeviceObject, - OUT_PPVOID MiniportDeviceContext - ); - -typedef - __checkReturn -NTSTATUS -DXGKDDI_START_DEVICE( - IN_CONST_PVOID MiniportDeviceContext, - IN_PDXGK_START_INFO DxgkStartInfo, - IN_PDXGKRNL_INTERFACE DxgkInterface, - OUT_PULONG NumberOfVideoPresentSources, - OUT_PULONG NumberOfChildren - ); - -typedef - __checkReturn -NTSTATUS -DXGKDDI_STOP_DEVICE( - IN_CONST_PVOID MiniportDeviceContext - ); - -typedef - __checkReturn -NTSTATUS -DXGKDDI_REMOVE_DEVICE( - IN_CONST_PVOID MiniportDeviceContext - ); - -typedef - __checkReturn -NTSTATUS -DXGKDDI_DISPATCH_IO_REQUEST( - IN_CONST_PVOID MiniportDeviceContext, - IN_ULONG VidPnSourceId, - IN_PVIDEO_REQUEST_PACKET VideoRequestPacket - ); - -typedef - __checkReturn -NTSTATUS -DXGKDDI_QUERY_CHILD_RELATIONS( - IN_CONST_PVOID MiniportDeviceContext, - INOUT_PDXGK_CHILD_DESCRIPTOR ChildRelations, - IN_ULONG ChildRelationsSize - ); - -typedef - __checkReturn -NTSTATUS -DXGKDDI_QUERY_CHILD_STATUS( - IN_CONST_PVOID MiniportDeviceContext, - IN_PDXGK_CHILD_STATUS ChildStatus, - IN_BOOLEAN NonDestructiveOnly - ); - -typedef - __checkReturn -BOOLEAN -DXGKDDI_INTERRUPT_ROUTINE( - IN_CONST_PVOID MiniportDeviceContext, - IN_ULONG MessageNumber - ); - -typedef -VOID -DXGKDDI_DPC_ROUTINE( - IN_CONST_PVOID MiniportDeviceContext - ); - -typedef - __checkReturn -NTSTATUS -DXGKDDI_QUERY_DEVICE_DESCRIPTOR( - IN_CONST_PVOID MiniportDeviceContext, - IN_ULONG ChildUid, - INOUT_PDXGK_DEVICE_DESCRIPTOR DeviceDescriptor - ); - -typedef - __checkReturn -NTSTATUS -DXGKDDI_SET_POWER_STATE( - IN_CONST_PVOID MiniportDeviceContext, - IN_ULONG DeviceUid, - IN_DEVICE_POWER_STATE DevicePowerState, - IN_POWER_ACTION ActionType - ); - -typedef - __checkReturn -NTSTATUS -DXGKDDI_NOTIFY_ACPI_EVENT( - IN_CONST_PVOID MiniportDeviceContext, - IN_DXGK_EVENT_TYPE EventType, - IN_ULONG Event, - IN_PVOID Argument, - OUT_PULONG AcpiFlags - ); - -typedef -VOID -DXGKDDI_RESET_DEVICE( - IN_CONST_PVOID MiniportDeviceContext - ); - -typedef -VOID -DXGKDDI_UNLOAD( - VOID - ); - -typedef - __checkReturn -NTSTATUS -DXGKDDI_QUERY_INTERFACE( - IN_CONST_PVOID MiniportDeviceContext, - IN_PQUERY_INTERFACE QueryInterface - ); - -typedef -VOID -DXGKDDI_CONTROL_ETW_LOGGING( - IN_BOOLEAN Enable, - IN_ULONG Flags, - IN_UCHAR Level - ); - -typedef - __checkReturn -NTSTATUS -DXGKDDI_LINK_DEVICE( - IN_CONST_PDEVICE_OBJECT PhysicalDeviceObject, - IN_CONST_PVOID MiniportDeviceContext, - INOUT_PLINKED_DEVICE LinkedDevice - ); - -// -// Function pointer typedefs -// - -typedef DXGKDDI_ADD_DEVICE *PDXGKDDI_ADD_DEVICE; -typedef DXGKDDI_START_DEVICE *PDXGKDDI_START_DEVICE; -typedef DXGKDDI_STOP_DEVICE *PDXGKDDI_STOP_DEVICE; -typedef DXGKDDI_REMOVE_DEVICE *PDXGKDDI_REMOVE_DEVICE; -typedef DXGKDDI_DISPATCH_IO_REQUEST *PDXGKDDI_DISPATCH_IO_REQUEST; -typedef DXGKDDI_QUERY_CHILD_RELATIONS *PDXGKDDI_QUERY_CHILD_RELATIONS; -typedef DXGKDDI_QUERY_CHILD_STATUS *PDXGKDDI_QUERY_CHILD_STATUS; -typedef DXGKDDI_INTERRUPT_ROUTINE *PDXGKDDI_INTERRUPT_ROUTINE; -typedef DXGKDDI_DPC_ROUTINE *PDXGKDDI_DPC_ROUTINE; -typedef DXGKDDI_QUERY_DEVICE_DESCRIPTOR *PDXGKDDI_QUERY_DEVICE_DESCRIPTOR; -typedef DXGKDDI_SET_POWER_STATE *PDXGKDDI_SET_POWER_STATE; -typedef DXGKDDI_NOTIFY_ACPI_EVENT *PDXGKDDI_NOTIFY_ACPI_EVENT; -typedef DXGKDDI_RESET_DEVICE *PDXGKDDI_RESET_DEVICE; -typedef DXGKDDI_UNLOAD *PDXGKDDI_UNLOAD; -typedef DXGKDDI_QUERY_INTERFACE *PDXGKDDI_QUERY_INTERFACE; -typedef DXGKDDI_CONTROL_ETW_LOGGING *PDXGKDDI_CONTROL_ETW_LOGGING; -typedef DXGKDDI_LINK_DEVICE *PDXGKDDI_LINK_DEVICE; - -// -// Driver initialization data structure -// - -typedef struct _DRIVER_INITIALIZATION_DATA { - ULONG Version; - PDXGKDDI_ADD_DEVICE DxgkDdiAddDevice; - PDXGKDDI_START_DEVICE DxgkDdiStartDevice; - PDXGKDDI_STOP_DEVICE DxgkDdiStopDevice; - PDXGKDDI_REMOVE_DEVICE DxgkDdiRemoveDevice; - PDXGKDDI_DISPATCH_IO_REQUEST DxgkDdiDispatchIoRequest; - PDXGKDDI_INTERRUPT_ROUTINE DxgkDdiInterruptRoutine; - PDXGKDDI_DPC_ROUTINE DxgkDdiDpcRoutine; - PDXGKDDI_QUERY_CHILD_RELATIONS DxgkDdiQueryChildRelations; - PDXGKDDI_QUERY_CHILD_STATUS DxgkDdiQueryChildStatus; - PDXGKDDI_QUERY_DEVICE_DESCRIPTOR DxgkDdiQueryDeviceDescriptor; - PDXGKDDI_SET_POWER_STATE DxgkDdiSetPowerState; - PDXGKDDI_NOTIFY_ACPI_EVENT DxgkDdiNotifyAcpiEvent; - PDXGKDDI_RESET_DEVICE DxgkDdiResetDevice; - PDXGKDDI_UNLOAD DxgkDdiUnload; - PDXGKDDI_QUERY_INTERFACE DxgkDdiQueryInterface; - PDXGKDDI_CONTROL_ETW_LOGGING DxgkDdiControlEtwLogging; - - PDXGKDDI_QUERYADAPTERINFO DxgkDdiQueryAdapterInfo; - PDXGKDDI_CREATEDEVICE DxgkDdiCreateDevice; - PDXGKDDI_CREATEALLOCATION DxgkDdiCreateAllocation; - PDXGKDDI_DESTROYALLOCATION DxgkDdiDestroyAllocation; - PDXGKDDI_DESCRIBEALLOCATION DxgkDdiDescribeAllocation; - PDXGKDDI_GETSTANDARDALLOCATIONDRIVERDATA DxgkDdiGetStandardAllocationDriverData; - PDXGKDDI_ACQUIRESWIZZLINGRANGE DxgkDdiAcquireSwizzlingRange; - PDXGKDDI_RELEASESWIZZLINGRANGE DxgkDdiReleaseSwizzlingRange; - PDXGKDDI_PATCH DxgkDdiPatch; - PDXGKDDI_SUBMITCOMMAND DxgkDdiSubmitCommand; - PDXGKDDI_PREEMPTCOMMAND DxgkDdiPreemptCommand; - PDXGKDDI_BUILDPAGINGBUFFER DxgkDdiBuildPagingBuffer; - PDXGKDDI_SETPALETTE DxgkDdiSetPalette; - PDXGKDDI_SETPOINTERPOSITION DxgkDdiSetPointerPosition; - PDXGKDDI_SETPOINTERSHAPE DxgkDdiSetPointerShape; - PDXGKDDI_RESETFROMTIMEOUT DxgkDdiResetFromTimeout; - PDXGKDDI_RESTARTFROMTIMEOUT DxgkDdiRestartFromTimeout; - PDXGKDDI_ESCAPE DxgkDdiEscape; - PDXGKDDI_COLLECTDBGINFO DxgkDdiCollectDbgInfo; - PDXGKDDI_QUERYCURRENTFENCE DxgkDdiQueryCurrentFence; - PDXGKDDI_ISSUPPORTEDVIDPN DxgkDdiIsSupportedVidPn; - PDXGKDDI_RECOMMENDFUNCTIONALVIDPN DxgkDdiRecommendFunctionalVidPn; - PDXGKDDI_ENUMVIDPNCOFUNCMODALITY DxgkDdiEnumVidPnCofuncModality; - PDXGKDDI_SETVIDPNSOURCEADDRESS DxgkDdiSetVidPnSourceAddress; - PDXGKDDI_SETVIDPNSOURCEVISIBILITY DxgkDdiSetVidPnSourceVisibility; - PDXGKDDI_COMMITVIDPN DxgkDdiCommitVidPn; - PDXGKDDI_UPDATEACTIVEVIDPNPRESENTPATH DxgkDdiUpdateActiveVidPnPresentPath; - PDXGKDDI_RECOMMENDMONITORMODES DxgkDdiRecommendMonitorModes; - PDXGKDDI_RECOMMENDVIDPNTOPOLOGY DxgkDdiRecommendVidPnTopology; - PDXGKDDI_GETSCANLINE DxgkDdiGetScanLine; - PDXGKDDI_STOPCAPTURE DxgkDdiStopCapture; - PDXGKDDI_CONTROLINTERRUPT DxgkDdiControlInterrupt; - PDXGKDDI_CREATEOVERLAY DxgkDdiCreateOverlay; - - // - // Device functions - // - - PDXGKDDI_DESTROYDEVICE DxgkDdiDestroyDevice; - PDXGKDDI_OPENALLOCATIONINFO DxgkDdiOpenAllocation; - PDXGKDDI_CLOSEALLOCATION DxgkDdiCloseAllocation; - PDXGKDDI_RENDER DxgkDdiRender; - PDXGKDDI_PRESENT DxgkDdiPresent; - - // - // Overlay functions - // - - PDXGKDDI_UPDATEOVERLAY DxgkDdiUpdateOverlay; - PDXGKDDI_FLIPOVERLAY DxgkDdiFlipOverlay; - PDXGKDDI_DESTROYOVERLAY DxgkDdiDestroyOverlay; - - // - // Context supports. - // - - PDXGKDDI_CREATECONTEXT DxgkDdiCreateContext; - PDXGKDDI_DESTROYCONTEXT DxgkDdiDestroyContext; - - // - // Linked Display Adapter support. - // - - PDXGKDDI_LINK_DEVICE DxgkDdiLinkDevice; - PDXGKDDI_SETDISPLAYPRIVATEDRIVERFORMAT DxgkDdiSetDisplayPrivateDriverFormat; - -#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) - // - // Extended for WDDM 2.0 - // - PDXGKDDI_DESCRIBEPAGETABLE DxgkDdiDescribePageTable; - PDXGKDDI_UPDATEPAGETABLE DxgkDdiUpdatePageTable; - PDXGKDDI_UPDATEPAGEDIRECTORY DxgkDdiUpdatePageDirectory; - PDXGKDDI_MOVEPAGEDIRECTORY DxgkDdiMovePageDirectory; - - PDXGKDDI_SUBMITRENDER DxgkDdiSubmitRender; - PDXGKDDI_CREATEALLOCATION2 DxgkDdiCreateAllocation2; - - // - // GDI acceleration. Extended for WDDM 1.0 - // - PDXGKDDI_RENDER DxgkDdiRenderKm; - - // - // New DMM DDIs for CCD support - // - VOID* Reserved; - PDXGKDDI_QUERYVIDPNHWCAPABILITY DxgkDdiQueryVidPnHWCapability; - -#endif // DXGKDDI_INTERFACE_VERSION - -} DRIVER_INITIALIZATION_DATA, *PDRIVER_INITIALIZATION_DATA; - -// -// *** Displib definitions **************************************************** -// - -typedef enum _DEBUG_LEVEL { - DlDebugError, - DlDebugWarning, - DlDebugTrace, - DlDebugInfo -} DEBUG_LEVEL; - -// -// Functions exported by DispLib -// - -NTSTATUS -DxgkInitialize( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath, - IN PDRIVER_INITIALIZATION_DATA DriverInitializationData - ); - -PVOID -DlAllocateCommonBuffer( - IN PVOID DeviceHandle, - IN PVP_DMA_ADAPTER DlpDmaAdapter, - IN ULONG DesiredLength, - OUT PPHYSICAL_ADDRESS LogicalAddress, - IN BOOLEAN CacheEnabled, - OUT PVOID Reserved - ); - -PVOID -DlAllocatePool( - IN PVOID DeviceHandle, - IN VP_POOL_TYPE PoolType, - IN SIZE_T NumberOfBytes, - IN ULONG Tag - ); - -VOID -DlClearEvent( - IN PVOID DeviceHandle, - IN PEVENT pEvent - ); - -VP_STATUS -DlCreateEvent( - IN PVOID DeviceHandle, - IN ULONG EventFlag, - PVOID Unused, - OUT PEVENT *ppEvent - ); - -VOID -DlDebugPrint( - IN DEBUG_LEVEL DebugPrintLevel, - IN __in PCHAR DebugMessage, - ... - ); - -VP_STATUS -DlDeleteEvent( - IN PVOID DeviceHandle, - IN PEVENT pEvent - ); - -VP_STATUS -DlEnumerateChildren( - IN PVOID DeviceHandle, - IN PVOID Reserved - ); - -VOID -DlFreeDeviceBase( - IN PVOID DeviceHandle, - IN PVOID MappedAddress - ); - -VOID -DlFreePool( - IN PVOID DeviceHandle, - IN PVOID Ptr - ); - -NTSTATUS -DlGetAccessRanges( - PVOID DeviceHandle, - ULONG NumRequestedResources, - PIO_RESOURCE_DESCRIPTOR RequestedResources OPTIONAL, - ULONG NumAccessRanges, - PVIDEO_ACCESS_RANGE AccessRanges, - PVOID VendorId, - PVOID DeviceId, - PULONG Slot - ); - -PVOID -DlGetAssociatedDeviceExtension( - IN PVOID DeviceObject - ); - -PVOID -DlGetDeviceBase( - IN PVOID DeviceHandle, - IN PHYSICAL_ADDRESS IoAddress, - IN ULONG NumberOfUchars, - IN UCHAR InIoSpace - ); - -PVP_DMA_ADAPTER -DlGetDmaAdapter( - IN PVOID DeviceHandle, - IN PVP_DEVICE_DESCRIPTION DlpDeviceDescription - ); - -VP_STATUS -DlGetRegistryParameters( - IN PVOID DeviceHandle, - IN __in PWSTR ParameterName, - IN UCHAR IsParameterFileName, - IN PMINIPORT_GET_REGISTRY_ROUTINE CallbackRoutine, - IN PVOID Context - ); - -__allocator -PVOID -DlGetRomImage( - IN PVOID DeviceHandle, - IN PVOID Unused1, - IN ULONG Unused2, - IN ULONG Length - ); - -VP_STATUS -DlGetVersion( - IN PVOID DeviceHandle, - OUT PVPOSVERSIONINFO pDlpOsVersionInfo - ); - -PVOID -DlLockBuffer( - IN PVOID DeviceHandle, - IN PVOID BaseAddress, - IN ULONG Length, - IN VP_LOCK_OPERATION Operation - ); - -VOID -DlLogError( - IN PVOID DeviceHandle, - IN PVIDEO_REQUEST_PACKET Vrp OPTIONAL, - IN VP_STATUS ErrorCode, - IN ULONG UniqueId - ); - -VP_STATUS -DlMapMemory( - IN PVOID DeviceHandle, - IN PHYSICAL_ADDRESS TranslatedAddress, - IN OUT PULONG Length, - IN PULONG InIoSpace, - IN OUT PVOID *VirtualAddress - ); - -LONGLONG -DlQueryPerformanceCounter( - IN PVOID pDeviceHandle, - OUT PLONGLONG pllPerformanceFrequency OPTIONAL - ); - -VOID -DlReleaseCommonBuffer( - IN PVOID DeviceHandle, - IN PVP_DMA_ADAPTER DlpDmaAdapter, - IN ULONG Length, - IN PHYSICAL_ADDRESS LogicalAddress, - IN PVOID VirtualAddress, - IN BOOLEAN CacheEnabled - ); - -BOOLEAN -DlScanRom( - IN PVOID DeviceHandle, - IN PUCHAR RomBase, - IN ULONG RomLength, - IN PUCHAR String - ); - -LONG -DlSetEvent( - IN PVOID DeviceHandle, - IN PEVENT pEvent - ); - -VP_STATUS -DlSetRegistryParameters( - IN PVOID DeviceHandle, - IN __in PWSTR ValueName, - IN __in_bcount(ValueLength) PVOID ValueData, - IN ULONG ValueLength - ); - -VP_STATUS -DlSetTrappedEmulatorPorts( - IN PVOID DeviceHandle, - IN ULONG NumAccessRanges, - IN PVIDEO_ACCESS_RANGE AccessRange - ); - -VOID -DlStopTimer( - PVOID DeviceHandle - ); - -VOID -DlUnlockBuffer( - IN PVOID DeviceHandle, - IN PVOID Mdl - ); - -VP_STATUS -DlVerifyAccessRanges( - PVOID DeviceHandle, - ULONG NumAccessRanges, - PVIDEO_ACCESS_RANGE AccessRanges - ); - -VP_STATUS -DlWaitForSingleObject( - IN PVOID DeviceHandle, - IN PVOID pEvent, - IN PLARGE_INTEGER Timeout - ); - -VP_STATUS -DlDisableInterrupt( - IN PVOID DeviceHandle - ); - -VP_STATUS -DlEnableInterrupt( - IN PVOID DeviceHandle - ); - -NTSTATUS -DlEvalAcpiMethod( - IN HANDLE DeviceHandle, - IN ULONG DeviceUid, - IN PACPI_EVAL_INPUT_BUFFER_COMPLEX AcpiInputBuffer, - IN ULONG AcpiInputSize, - IN OUT PACPI_EVAL_OUTPUT_BUFFER AcpiOutputBuffer, - IN ULONG AcpiOutputSize - ); - -NTSTATUS -DlGetDeviceInformation( - IN PVOID DeviceHandle, - OUT PDXGK_DEVICE_INFO DeviceInfo - ); - -NTSTATUS -DlIndicateChildStatus( - IN PVOID DeviceHandle, - IN PDXGK_CHILD_STATUS ChildStatus - ); - -NTSTATUS -DlMapMemoryEx( - IN PVOID DeviceHandle, - IN PHYSICAL_ADDRESS TranslatedAddress, - IN OUT PULONG Length, - IN PULONG InIoSpace, - IN HANDLE ProcessHandle, - IN OUT PVOID *VirtualAddress, - IN BOOLEAN MapToUserMode - ); - -NTSTATUS -DlQueryServices( - IN PVOID DeviceHandle, - IN VIDEO_PORT_SERVICES ServicesType, - IN OUT PINTERFACE Interface - ); - -BOOLEAN -DlQueueDpc( - IN PVOID DeviceHandle - ); - -ULONG -DlReadDeviceSpace( - IN PVOID DeviceHandle, - IN ULONG DataType, - IN ULONG SlotNumber, - IN PVOID Buffer, - IN ULONG Offset, - IN ULONG Length - ); - -ULONG -DlSetBusData( - IN PVOID DeviceHandle, - IN ULONG BusDataType, - IN ULONG SlotNumber, - IN PVOID Buffer, - IN ULONG Offset, - IN ULONG Length - ); - -BOOLEAN -DlSynchronizeExecution( - PVOID DeviceHandle, - VIDEO_SYNCHRONIZE_PRIORITY Priority, - PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine, - PVOID Context, - ULONG MessageNumber - ); - -NTSTATUS -DlUnmapMemory( - PVOID DeviceHandle, - PVOID VirtualAddress, - HANDLE ProcessHandle - ); - -#endif // (NTDDI_VERSION >= NTDDI_LONGHORN) - -#pragma warning(pop) - -#endif // _DISPMPRT_H_ - diff --git a/pub/ddk/dmusicks.h b/pub/ddk/dmusicks.h deleted file mode 100644 index b30a3c3..0000000 --- a/pub/ddk/dmusicks.h +++ /dev/null @@ -1,449 +0,0 @@ -/*************************************************************************** -* * -* DMusicKS.h -- This module defines the the DirectMusic WDM interface. * -* * -* Copyright (c) Microsoft Corp. All rights reserved. * -* * -***************************************************************************/ - -#ifndef _DMUSICKS_ -#define _DMUSICKS_ - -#include - -#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_ */ - diff --git a/pub/ddk/dmusics.h b/pub/ddk/dmusics.h deleted file mode 100644 index e9fafe6..0000000 --- a/pub/ddk/dmusics.h +++ /dev/null @@ -1,207 +0,0 @@ -/************************************************************************ -* * -* 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 - diff --git a/pub/ddk/dmusprop.h b/pub/ddk/dmusprop.h deleted file mode 100644 index 47ddd9d..0000000 --- a/pub/ddk/dmusprop.h +++ /dev/null @@ -1,263 +0,0 @@ -/*************************************************************************** -* * -* 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_ */ - - - diff --git a/pub/ddk/driverspecs.h b/pub/ddk/driverspecs.h deleted file mode 100644 index 4df36d9..0000000 --- a/pub/ddk/driverspecs.h +++ /dev/null @@ -1,847 +0,0 @@ -/*****************************************************************************\ -* * -* DriverSpecs.h - markers for documenting the semantics of driver APIs * -* See also * -* * -* 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 -#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 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() - // - // The function being annotated will return each of the specified values - // during simulation. The items in the list are , - // 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 - diff --git a/pub/ddk/drivinit.h b/pub/ddk/drivinit.h deleted file mode 100644 index aea12c0..0000000 --- a/pub/ddk/drivinit.h +++ /dev/null @@ -1,12 +0,0 @@ -//+--------------------------------------------------------------------------- -// -// Microsoft Windows -// Copyright (C) Microsoft Corporation, 1992-1999. -// -// File: drivinit.h -// -//---------------------------------------------------------------------------- - -// All items moved to wingdi.h - - diff --git a/pub/ddk/drmk.h b/pub/ddk/drmk.h deleted file mode 100644 index 9c88ef3..0000000 --- a/pub/ddk/drmk.h +++ /dev/null @@ -1,199 +0,0 @@ -#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 - - diff --git a/pub/ddk/dsfhrmports.h b/pub/ddk/dsfhrmports.h deleted file mode 100644 index 8b13789..0000000 --- a/pub/ddk/dsfhrmports.h +++ /dev/null @@ -1 +0,0 @@ - diff --git a/pub/ddk/dsfif.h b/pub/ddk/dsfif.h deleted file mode 100644 index 3805e0f..0000000 --- a/pub/ddk/dsfif.h +++ /dev/null @@ -1,5513 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for dsfif.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - - -#ifndef __dsfif_h__ -#define __dsfif_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IDSFResourceList_FWD_DEFINED__ -#define __IDSFResourceList_FWD_DEFINED__ -typedef interface IDSFResourceList IDSFResourceList; -#endif /* __IDSFResourceList_FWD_DEFINED__ */ - - -#ifndef __IDSFFullResourceDescriptor_FWD_DEFINED__ -#define __IDSFFullResourceDescriptor_FWD_DEFINED__ -typedef interface IDSFFullResourceDescriptor IDSFFullResourceDescriptor; -#endif /* __IDSFFullResourceDescriptor_FWD_DEFINED__ */ - - -#ifndef __IDSFDevice_FWD_DEFINED__ -#define __IDSFDevice_FWD_DEFINED__ -typedef interface IDSFDevice IDSFDevice; -#endif /* __IDSFDevice_FWD_DEFINED__ */ - - -#ifndef __IDSFDeviceCaps_FWD_DEFINED__ -#define __IDSFDeviceCaps_FWD_DEFINED__ -typedef interface IDSFDeviceCaps IDSFDeviceCaps; -#endif /* __IDSFDeviceCaps_FWD_DEFINED__ */ - - -#ifndef __IDSFDeviceEvents_FWD_DEFINED__ -#define __IDSFDeviceEvents_FWD_DEFINED__ -typedef interface IDSFDeviceEvents IDSFDeviceEvents; -#endif /* __IDSFDeviceEvents_FWD_DEFINED__ */ - - -#ifndef __IDSF_FWD_DEFINED__ -#define __IDSF_FWD_DEFINED__ -typedef interface IDSF IDSF; -#endif /* __IDSF_FWD_DEFINED__ */ - - -#ifndef __IDSFDevices_FWD_DEFINED__ -#define __IDSFDevices_FWD_DEFINED__ -typedef interface IDSFDevices IDSFDevices; -#endif /* __IDSFDevices_FWD_DEFINED__ */ - - -#ifndef __IDSFLog_FWD_DEFINED__ -#define __IDSFLog_FWD_DEFINED__ -typedef interface IDSFLog IDSFLog; -#endif /* __IDSFLog_FWD_DEFINED__ */ - - -#ifndef __IDSFVersion_FWD_DEFINED__ -#define __IDSFVersion_FWD_DEFINED__ -typedef interface IDSFVersion IDSFVersion; -#endif /* __IDSFVersion_FWD_DEFINED__ */ - - -#ifndef __IDSFPropertyBag_FWD_DEFINED__ -#define __IDSFPropertyBag_FWD_DEFINED__ -typedef interface IDSFPropertyBag IDSFPropertyBag; -#endif /* __IDSFPropertyBag_FWD_DEFINED__ */ - - -#ifndef __IDSFBus_FWD_DEFINED__ -#define __IDSFBus_FWD_DEFINED__ -typedef interface IDSFBus IDSFBus; -#endif /* __IDSFBus_FWD_DEFINED__ */ - - -#ifndef __IDSFPartialResourceDescriptor_FWD_DEFINED__ -#define __IDSFPartialResourceDescriptor_FWD_DEFINED__ -typedef interface IDSFPartialResourceDescriptor IDSFPartialResourceDescriptor; -#endif /* __IDSFPartialResourceDescriptor_FWD_DEFINED__ */ - - -#ifndef __DSFPartialResourceDescriptor_FWD_DEFINED__ -#define __DSFPartialResourceDescriptor_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFPartialResourceDescriptor DSFPartialResourceDescriptor; -#else -typedef struct DSFPartialResourceDescriptor DSFPartialResourceDescriptor; -#endif /* __cplusplus */ - -#endif /* __DSFPartialResourceDescriptor_FWD_DEFINED__ */ - - -#ifndef __IDSFPartialResourceList_FWD_DEFINED__ -#define __IDSFPartialResourceList_FWD_DEFINED__ -typedef interface IDSFPartialResourceList IDSFPartialResourceList; -#endif /* __IDSFPartialResourceList_FWD_DEFINED__ */ - - -#ifndef __DSFPartialResourceList_FWD_DEFINED__ -#define __DSFPartialResourceList_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFPartialResourceList DSFPartialResourceList; -#else -typedef struct DSFPartialResourceList DSFPartialResourceList; -#endif /* __cplusplus */ - -#endif /* __DSFPartialResourceList_FWD_DEFINED__ */ - - -#ifndef __DSFFullResourceDescriptor_FWD_DEFINED__ -#define __DSFFullResourceDescriptor_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFFullResourceDescriptor DSFFullResourceDescriptor; -#else -typedef struct DSFFullResourceDescriptor DSFFullResourceDescriptor; -#endif /* __cplusplus */ - -#endif /* __DSFFullResourceDescriptor_FWD_DEFINED__ */ - - -#ifndef __DSFResourceList_FWD_DEFINED__ -#define __DSFResourceList_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFResourceList DSFResourceList; -#else -typedef struct DSFResourceList DSFResourceList; -#endif /* __cplusplus */ - -#endif /* __DSFResourceList_FWD_DEFINED__ */ - - -#ifndef __IDSFResDescPort_FWD_DEFINED__ -#define __IDSFResDescPort_FWD_DEFINED__ -typedef interface IDSFResDescPort IDSFResDescPort; -#endif /* __IDSFResDescPort_FWD_DEFINED__ */ - - -#ifndef __DSFResDescPort_FWD_DEFINED__ -#define __DSFResDescPort_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFResDescPort DSFResDescPort; -#else -typedef struct DSFResDescPort DSFResDescPort; -#endif /* __cplusplus */ - -#endif /* __DSFResDescPort_FWD_DEFINED__ */ - - -#ifndef __IDSFResDescDevSpecific_FWD_DEFINED__ -#define __IDSFResDescDevSpecific_FWD_DEFINED__ -typedef interface IDSFResDescDevSpecific IDSFResDescDevSpecific; -#endif /* __IDSFResDescDevSpecific_FWD_DEFINED__ */ - - -#ifndef __DSFResDescDevSpecific_FWD_DEFINED__ -#define __DSFResDescDevSpecific_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFResDescDevSpecific DSFResDescDevSpecific; -#else -typedef struct DSFResDescDevSpecific DSFResDescDevSpecific; -#endif /* __cplusplus */ - -#endif /* __DSFResDescDevSpecific_FWD_DEFINED__ */ - - -#ifndef __IDSFResDescDevPrivate_FWD_DEFINED__ -#define __IDSFResDescDevPrivate_FWD_DEFINED__ -typedef interface IDSFResDescDevPrivate IDSFResDescDevPrivate; -#endif /* __IDSFResDescDevPrivate_FWD_DEFINED__ */ - - -#ifndef __DSFResDescDevPrivate_FWD_DEFINED__ -#define __DSFResDescDevPrivate_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFResDescDevPrivate DSFResDescDevPrivate; -#else -typedef struct DSFResDescDevPrivate DSFResDescDevPrivate; -#endif /* __cplusplus */ - -#endif /* __DSFResDescDevPrivate_FWD_DEFINED__ */ - - -#ifndef __IDSFResDescInterrupt_FWD_DEFINED__ -#define __IDSFResDescInterrupt_FWD_DEFINED__ -typedef interface IDSFResDescInterrupt IDSFResDescInterrupt; -#endif /* __IDSFResDescInterrupt_FWD_DEFINED__ */ - - -#ifndef __DSFResDescInterrupt_FWD_DEFINED__ -#define __DSFResDescInterrupt_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFResDescInterrupt DSFResDescInterrupt; -#else -typedef struct DSFResDescInterrupt DSFResDescInterrupt; -#endif /* __cplusplus */ - -#endif /* __DSFResDescInterrupt_FWD_DEFINED__ */ - - -#ifndef __IDSFResDescMemory_FWD_DEFINED__ -#define __IDSFResDescMemory_FWD_DEFINED__ -typedef interface IDSFResDescMemory IDSFResDescMemory; -#endif /* __IDSFResDescMemory_FWD_DEFINED__ */ - - -#ifndef __DSFResDescMemory_FWD_DEFINED__ -#define __DSFResDescMemory_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFResDescMemory DSFResDescMemory; -#else -typedef struct DSFResDescMemory DSFResDescMemory; -#endif /* __cplusplus */ - -#endif /* __DSFResDescMemory_FWD_DEFINED__ */ - - -#ifndef __IDSFResDescDMA_FWD_DEFINED__ -#define __IDSFResDescDMA_FWD_DEFINED__ -typedef interface IDSFResDescDMA IDSFResDescDMA; -#endif /* __IDSFResDescDMA_FWD_DEFINED__ */ - - -#ifndef __DSFResDescDMA_FWD_DEFINED__ -#define __DSFResDescDMA_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFResDescDMA DSFResDescDMA; -#else -typedef struct DSFResDescDMA DSFResDescDMA; -#endif /* __cplusplus */ - -#endif /* __DSFResDescDMA_FWD_DEFINED__ */ - - -#ifndef __IDSFSystemDevice_FWD_DEFINED__ -#define __IDSFSystemDevice_FWD_DEFINED__ -typedef interface IDSFSystemDevice IDSFSystemDevice; -#endif /* __IDSFSystemDevice_FWD_DEFINED__ */ - - -#ifndef __DSFSystemDevice_FWD_DEFINED__ -#define __DSFSystemDevice_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFSystemDevice DSFSystemDevice; -#else -typedef struct DSFSystemDevice DSFSystemDevice; -#endif /* __cplusplus */ - -#endif /* __DSFSystemDevice_FWD_DEFINED__ */ - - -#ifndef __DSFDevice_FWD_DEFINED__ -#define __DSFDevice_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFDevice DSFDevice; -#else -typedef struct DSFDevice DSFDevice; -#endif /* __cplusplus */ - -#endif /* __DSFDevice_FWD_DEFINED__ */ - - -#ifndef __DSF_FWD_DEFINED__ -#define __DSF_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSF DSF; -#else -typedef struct DSF DSF; -#endif /* __cplusplus */ - -#endif /* __DSF_FWD_DEFINED__ */ - - -#ifndef __DSFDevices_FWD_DEFINED__ -#define __DSFDevices_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFDevices DSFDevices; -#else -typedef struct DSFDevices DSFDevices; -#endif /* __cplusplus */ - -#endif /* __DSFDevices_FWD_DEFINED__ */ - - -#ifndef __DSFDeviceCaps_FWD_DEFINED__ -#define __DSFDeviceCaps_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFDeviceCaps DSFDeviceCaps; -#else -typedef struct DSFDeviceCaps DSFDeviceCaps; -#endif /* __cplusplus */ - -#endif /* __DSFDeviceCaps_FWD_DEFINED__ */ - - -#ifndef __DSFLog_FWD_DEFINED__ -#define __DSFLog_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFLog DSFLog; -#else -typedef struct DSFLog DSFLog; -#endif /* __cplusplus */ - -#endif /* __DSFLog_FWD_DEFINED__ */ - - -#ifndef __DSFVersion_FWD_DEFINED__ -#define __DSFVersion_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFVersion DSFVersion; -#else -typedef struct DSFVersion DSFVersion; -#endif /* __cplusplus */ - -#endif /* __DSFVersion_FWD_DEFINED__ */ - - -#ifndef __DSFPropertyBag_FWD_DEFINED__ -#define __DSFPropertyBag_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFPropertyBag DSFPropertyBag; -#else -typedef struct DSFPropertyBag DSFPropertyBag; -#endif /* __cplusplus */ - -#endif /* __DSFPropertyBag_FWD_DEFINED__ */ - - -#ifndef __IDSFDebug_FWD_DEFINED__ -#define __IDSFDebug_FWD_DEFINED__ -typedef interface IDSFDebug IDSFDebug; -#endif /* __IDSFDebug_FWD_DEFINED__ */ - - -#ifndef __DSFDebug_FWD_DEFINED__ -#define __DSFDebug_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFDebug DSFDebug; -#else -typedef struct DSFDebug DSFDebug; -#endif /* __cplusplus */ - -#endif /* __DSFDebug_FWD_DEFINED__ */ - - -#ifndef __DSFBus_FWD_DEFINED__ -#define __DSFBus_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DSFBus DSFBus; -#else -typedef struct DSFBus DSFBus; -#endif /* __cplusplus */ - -#endif /* __DSFBus_FWD_DEFINED__ */ - - -#ifndef __IDSFPersist_FWD_DEFINED__ -#define __IDSFPersist_FWD_DEFINED__ -typedef interface IDSFPersist IDSFPersist; -#endif /* __IDSFPersist_FWD_DEFINED__ */ - - -#ifdef __cplusplus -extern "C"{ -#endif - - - -#ifndef __DSF_LIBRARY_DEFINED__ -#define __DSF_LIBRARY_DEFINED__ - -/* library DSF */ -/* [helpstringcontext][helpcontext][helpstring][helpstringdll][helpfile][version][lcid][uuid] */ - - - - - - - - - - - - - - - - - - - - - - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("993417C7-E892-4F80-9295-1321623DD50D") -enum DSFSystemPowerState - { DSFPowerSystemUnspecified = 0, - DSFPowerSystemWorking = 1, - DSFPowerSystemSleeping1 = 2, - DSFPowerSystemSleeping2 = 3, - DSFPowerSystemSleeping3 = 4, - DSFPowerSystemHibernate = 5, - DSFPowerSystemShutdown = 6 - } DSFSystemPowerState; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("7B8AD659-B4EF-48C4-A189-9637BD56F086") -enum DSFDevicePowerState - { DSFPowerDeviceUnspecified = 0, - DSFPowerDeviceD0 = 1, - DSFPowerDeviceD1 = 2, - DSFPowerDeviceD2 = 3, - DSFPowerDeviceD3 = 4 - } DSFDevicePowerState; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("C936205A-C69B-45E4-8D19-6BE3CAC15E11") -enum DSFBitOp - { DSFBitOff = 0, - DSFBitOn = 1, - DSFBitToggle = 2 - } DSFBitOp; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("52CAB7A6-B8AC-474D-AB38-05A4AAF21FE7") -enum DSFOpMode - { DSFCapture = 0, - DSFSimulate = 1, - DSFCaptureAndSimulate = 2 - } DSFOpMode; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("7D4BA3AD-960C-4A3B-A6CC-3677AD9E0EDE") -enum DSFResourceType - { DSFResourceTypeNull = 0, - DSFResourceTypePort = 1, - DSFResourceTypeInterrupt = 2, - DSFResourceTypeMemory = 3, - DSFResourceTypeDma = 4, - DSFResourceTypeDeviceSpecific = 5, - DSFResourceTypeBusNumber = 6, - DSFResourceTypeNonArbitrated = 128, - DSFResourceTypeConfigData = 128, - DSFResourceTypeDevicePrivate = 129, - DSFResourceTypePcCardConfig = 130, - DSFResourceTypeMfCardConfig = 131, - DSFResourceTypeConfigurationSpace = 132, - DSFResourceTypeAcpi = 133, - DSFResourceTypePci = 134 - } DSFResourceType; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("D503F600-4EDD-4B7C-A676-0B50BDAED69E") -enum DSFShareDisposition - { DSFShareDispositionUndetermined = 0, - DSFShareDispositionDeviceExclusive = 1, - DSFShareDispositionDriverExclusive = 2, - DSFShareDispositionShared = 3 - } DSFShareDisposition; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("6FA31433-AA14-4EF7-8FBA-A91F326BA32B") -enum DSFInterfaceType - { DSFInterfaceTypeUndefined = -1, - DSFInterfaceTypeInternal = 0, - DSFInterfaceTypeIsa = 1, - DSFInterfaceTypeEisa = 2, - DSFInterfaceTypeMicroChannel = 3, - DSFInterfaceTypeTurboChannel = 4, - DSFInterfaceTypePCIBus = 5, - DSFInterfaceTypeVMEBus = 6, - DSFInterfaceTypeNuBus = 7, - DSFInterfaceTypePCMCIABus = 8, - DSFInterfaceTypeCBus = 9, - DSFInterfaceTypeMPIBus = 10, - DSFInterfaceTypeMPSABus = 11, - DSFInterfaceTypeProcessorInternal = 12, - DSFInterfaceTypeInternalPowerBus = 13, - DSFInterfaceTypePNPISABus = 14, - DSFInterfaceTypePNPBus = 15 - } DSFInterfaceType; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("78201517-0b6c-4208-b003-2f396640e5bc") -enum DSFStateType - { DSFDefaultStateType = 0 - } DSFStateType; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("86b50daf-5bb2-43f3-a9ca-e5bf444d9523") -enum DSFFlagType - { DSFDebugFlags = 0, - DSFLogFlags = 1, - DSFStdOutFlags = 2 - } DSFFlagType; - -#define DSFVersionMajor ( 1 ) - -#define DSFVersionMinor ( 0 ) - - -EXTERN_C const IID LIBID_DSF; - -#ifndef __IDSFResourceList_INTERFACE_DEFINED__ -#define __IDSFResourceList_INTERFACE_DEFINED__ - -/* interface IDSFResourceList */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFResourceList; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("418E0FF4-25F9-459A-B92B-6B3294E7135C") - IDSFResourceList : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Count( - /* [retval][out] */ __RPC__out long *plCount) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Item( - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt DSFFullResourceDescriptor **ppDSFFullResourceDescriptor) = 0; - - virtual /* [hidden][propget][id] */ HRESULT __stdcall get__NewEnum( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Add( - /* [in] */ __RPC__in DSFFullResourceDescriptor *pDSFFullResourceDescriptor, - /* [optional][in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Remove( - /* [in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Clear( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFResourceListVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFResourceList * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFResourceList * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFResourceList * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFResourceList * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFResourceList * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFResourceList * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFResourceList * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Count )( - __RPC__in IDSFResourceList * This, - /* [retval][out] */ __RPC__out long *plCount); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Item )( - __RPC__in IDSFResourceList * This, - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt DSFFullResourceDescriptor **ppDSFFullResourceDescriptor); - - /* [hidden][propget][id] */ HRESULT ( __stdcall *get__NewEnum )( - __RPC__in IDSFResourceList * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Add )( - __RPC__in IDSFResourceList * This, - /* [in] */ __RPC__in DSFFullResourceDescriptor *pDSFFullResourceDescriptor, - /* [optional][in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Remove )( - __RPC__in IDSFResourceList * This, - /* [in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Clear )( - __RPC__in IDSFResourceList * This); - - END_INTERFACE - } IDSFResourceListVtbl; - - interface IDSFResourceList - { - CONST_VTBL struct IDSFResourceListVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFResourceList_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFResourceList_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFResourceList_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFResourceList_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFResourceList_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFResourceList_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFResourceList_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFResourceList_get_Count(This,plCount) \ - ( (This)->lpVtbl -> get_Count(This,plCount) ) - -#define IDSFResourceList_get_Item(This,Index,ppDSFFullResourceDescriptor) \ - ( (This)->lpVtbl -> get_Item(This,Index,ppDSFFullResourceDescriptor) ) - -#define IDSFResourceList_get__NewEnum(This,ppunkEnum) \ - ( (This)->lpVtbl -> get__NewEnum(This,ppunkEnum) ) - -#define IDSFResourceList_Add(This,pDSFFullResourceDescriptor,Index) \ - ( (This)->lpVtbl -> Add(This,pDSFFullResourceDescriptor,Index) ) - -#define IDSFResourceList_Remove(This,Index) \ - ( (This)->lpVtbl -> Remove(This,Index) ) - -#define IDSFResourceList_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFResourceList_INTERFACE_DEFINED__ */ - - -#ifndef __IDSFFullResourceDescriptor_INTERFACE_DEFINED__ -#define __IDSFFullResourceDescriptor_INTERFACE_DEFINED__ - -/* interface IDSFFullResourceDescriptor */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFFullResourceDescriptor; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E466F6A1-269F-4E18-94E6-7D2F02779417") - IDSFFullResourceDescriptor : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_InterfaceType( - /* [retval][out] */ __RPC__out DSFInterfaceType *pType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_InterfaceType( - /* [in] */ DSFInterfaceType Type) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_BusNumber( - /* [retval][out] */ __RPC__out long *plBusNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_BusNumber( - /* [in] */ long lBusNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_PartialResourceList( - /* [retval][out] */ __RPC__deref_out_opt DSFPartialResourceList **ppDSFPartialResourceList) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFFullResourceDescriptorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFFullResourceDescriptor * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFFullResourceDescriptor * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFFullResourceDescriptor * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFFullResourceDescriptor * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFFullResourceDescriptor * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFFullResourceDescriptor * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFFullResourceDescriptor * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_InterfaceType )( - __RPC__in IDSFFullResourceDescriptor * This, - /* [retval][out] */ __RPC__out DSFInterfaceType *pType); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_InterfaceType )( - __RPC__in IDSFFullResourceDescriptor * This, - /* [in] */ DSFInterfaceType Type); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_BusNumber )( - __RPC__in IDSFFullResourceDescriptor * This, - /* [retval][out] */ __RPC__out long *plBusNumber); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_BusNumber )( - __RPC__in IDSFFullResourceDescriptor * This, - /* [in] */ long lBusNumber); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_PartialResourceList )( - __RPC__in IDSFFullResourceDescriptor * This, - /* [retval][out] */ __RPC__deref_out_opt DSFPartialResourceList **ppDSFPartialResourceList); - - END_INTERFACE - } IDSFFullResourceDescriptorVtbl; - - interface IDSFFullResourceDescriptor - { - CONST_VTBL struct IDSFFullResourceDescriptorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFFullResourceDescriptor_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFFullResourceDescriptor_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFFullResourceDescriptor_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFFullResourceDescriptor_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFFullResourceDescriptor_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFFullResourceDescriptor_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFFullResourceDescriptor_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFFullResourceDescriptor_get_InterfaceType(This,pType) \ - ( (This)->lpVtbl -> get_InterfaceType(This,pType) ) - -#define IDSFFullResourceDescriptor_put_InterfaceType(This,Type) \ - ( (This)->lpVtbl -> put_InterfaceType(This,Type) ) - -#define IDSFFullResourceDescriptor_get_BusNumber(This,plBusNumber) \ - ( (This)->lpVtbl -> get_BusNumber(This,plBusNumber) ) - -#define IDSFFullResourceDescriptor_put_BusNumber(This,lBusNumber) \ - ( (This)->lpVtbl -> put_BusNumber(This,lBusNumber) ) - -#define IDSFFullResourceDescriptor_get_PartialResourceList(This,ppDSFPartialResourceList) \ - ( (This)->lpVtbl -> get_PartialResourceList(This,ppDSFPartialResourceList) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFFullResourceDescriptor_INTERFACE_DEFINED__ */ - - -#ifndef __IDSFDevice_INTERFACE_DEFINED__ -#define __IDSFDevice_INTERFACE_DEFINED__ - -/* interface IDSFDevice */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFDevice; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E3B2A057-2A23-4ABE-8188-9FB655131823") - IDSFDevice : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Children( - /* [retval][out] */ __RPC__deref_out_opt DSFDevices **ppDSFDevices) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Enabled( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEnabled) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Enabled( - /* [in] */ VARIANT_BOOL fvarEnabled) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Guid( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrGuid) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Guid( - /* [in] */ __RPC__in BSTR bstrGuid) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall HasObject( - /* [in] */ __RPC__in BSTR CLSID, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pvBool) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Hrm( - /* [in] */ DSFResourceType ResType, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkHrm) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Inserted( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarInserted) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Inserted( - /* [in] */ VARIANT_BOOL fvarInserted) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Name( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Name( - /* [in] */ __RPC__in BSTR bstrName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Next( - /* [retval][out] */ __RPC__deref_out_opt DSFDevice **ppDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Next( - /* [in] */ __RPC__in DSFDevice *pDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT __stdcall putref_Next( - /* [in] */ __RPC__in DSFDevice *pDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Object( - /* [in] */ __RPC__in BSTR GUID, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkObject) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Object( - /* [in] */ __RPC__in BSTR GUID, - /* [in] */ __RPC__in_opt IUnknown *punkObject) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT __stdcall putref_Object( - /* [in] */ __RPC__in BSTR GUID, - /* [in] */ __RPC__in_opt IUnknown *punkObject) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_OpMode( - /* [retval][out] */ __RPC__out DSFOpMode *pMode) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_OpMode( - /* [in] */ DSFOpMode Mode) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Parent( - /* [retval][out] */ __RPC__deref_out_opt DSFDevice **ppDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Parent( - /* [in] */ __RPC__in DSFDevice *pDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT __stdcall putref_Parent( - /* [in] */ __RPC__in DSFDevice *pDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Persistent( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarPersistent) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Persistent( - /* [in] */ VARIANT_BOOL fvarPersistent) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_State( - /* [retval][out] */ __RPC__out long *plState) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_SystemDevice( - /* [retval][out] */ __RPC__deref_out_opt IDSFSystemDevice **ppSystemDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall SetStateBit( - /* [in] */ long Bit, - /* [in] */ DSFBitOp BitOp) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall StartFaultInjection( - /* [in] */ DSFResourceType ResType, - /* [in] */ VARIANT Params, - /* [retval][out] */ __RPC__out VARIANT *pvarContext) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall StopFaultInjection( - /* [in] */ DSFResourceType ResType, - /* [in] */ VARIANT Context) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFDeviceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFDevice * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFDevice * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFDevice * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFDevice * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFDevice * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFDevice * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFDevice * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Children )( - __RPC__in IDSFDevice * This, - /* [retval][out] */ __RPC__deref_out_opt DSFDevices **ppDSFDevices); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Enabled )( - __RPC__in IDSFDevice * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEnabled); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Enabled )( - __RPC__in IDSFDevice * This, - /* [in] */ VARIANT_BOOL fvarEnabled); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Guid )( - __RPC__in IDSFDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrGuid); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Guid )( - __RPC__in IDSFDevice * This, - /* [in] */ __RPC__in BSTR bstrGuid); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *HasObject )( - __RPC__in IDSFDevice * This, - /* [in] */ __RPC__in BSTR CLSID, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pvBool); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Hrm )( - __RPC__in IDSFDevice * This, - /* [in] */ DSFResourceType ResType, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkHrm); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Inserted )( - __RPC__in IDSFDevice * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarInserted); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Inserted )( - __RPC__in IDSFDevice * This, - /* [in] */ VARIANT_BOOL fvarInserted); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Name )( - __RPC__in IDSFDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrName); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Name )( - __RPC__in IDSFDevice * This, - /* [in] */ __RPC__in BSTR bstrName); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Next )( - __RPC__in IDSFDevice * This, - /* [retval][out] */ __RPC__deref_out_opt DSFDevice **ppDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Next )( - __RPC__in IDSFDevice * This, - /* [in] */ __RPC__in DSFDevice *pDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT ( __stdcall *putref_Next )( - __RPC__in IDSFDevice * This, - /* [in] */ __RPC__in DSFDevice *pDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Object )( - __RPC__in IDSFDevice * This, - /* [in] */ __RPC__in BSTR GUID, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkObject); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Object )( - __RPC__in IDSFDevice * This, - /* [in] */ __RPC__in BSTR GUID, - /* [in] */ __RPC__in_opt IUnknown *punkObject); - - /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT ( __stdcall *putref_Object )( - __RPC__in IDSFDevice * This, - /* [in] */ __RPC__in BSTR GUID, - /* [in] */ __RPC__in_opt IUnknown *punkObject); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_OpMode )( - __RPC__in IDSFDevice * This, - /* [retval][out] */ __RPC__out DSFOpMode *pMode); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_OpMode )( - __RPC__in IDSFDevice * This, - /* [in] */ DSFOpMode Mode); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Parent )( - __RPC__in IDSFDevice * This, - /* [retval][out] */ __RPC__deref_out_opt DSFDevice **ppDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Parent )( - __RPC__in IDSFDevice * This, - /* [in] */ __RPC__in DSFDevice *pDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT ( __stdcall *putref_Parent )( - __RPC__in IDSFDevice * This, - /* [in] */ __RPC__in DSFDevice *pDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Persistent )( - __RPC__in IDSFDevice * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarPersistent); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Persistent )( - __RPC__in IDSFDevice * This, - /* [in] */ VARIANT_BOOL fvarPersistent); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_State )( - __RPC__in IDSFDevice * This, - /* [retval][out] */ __RPC__out long *plState); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_SystemDevice )( - __RPC__in IDSFDevice * This, - /* [retval][out] */ __RPC__deref_out_opt IDSFSystemDevice **ppSystemDevice); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *SetStateBit )( - __RPC__in IDSFDevice * This, - /* [in] */ long Bit, - /* [in] */ DSFBitOp BitOp); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *StartFaultInjection )( - __RPC__in IDSFDevice * This, - /* [in] */ DSFResourceType ResType, - /* [in] */ VARIANT Params, - /* [retval][out] */ __RPC__out VARIANT *pvarContext); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *StopFaultInjection )( - __RPC__in IDSFDevice * This, - /* [in] */ DSFResourceType ResType, - /* [in] */ VARIANT Context); - - END_INTERFACE - } IDSFDeviceVtbl; - - interface IDSFDevice - { - CONST_VTBL struct IDSFDeviceVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFDevice_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFDevice_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFDevice_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFDevice_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFDevice_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFDevice_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFDevice_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFDevice_get_Children(This,ppDSFDevices) \ - ( (This)->lpVtbl -> get_Children(This,ppDSFDevices) ) - -#define IDSFDevice_get_Enabled(This,pfvarEnabled) \ - ( (This)->lpVtbl -> get_Enabled(This,pfvarEnabled) ) - -#define IDSFDevice_put_Enabled(This,fvarEnabled) \ - ( (This)->lpVtbl -> put_Enabled(This,fvarEnabled) ) - -#define IDSFDevice_get_Guid(This,pbstrGuid) \ - ( (This)->lpVtbl -> get_Guid(This,pbstrGuid) ) - -#define IDSFDevice_put_Guid(This,bstrGuid) \ - ( (This)->lpVtbl -> put_Guid(This,bstrGuid) ) - -#define IDSFDevice_HasObject(This,CLSID,pvBool) \ - ( (This)->lpVtbl -> HasObject(This,CLSID,pvBool) ) - -#define IDSFDevice_get_Hrm(This,ResType,ppunkHrm) \ - ( (This)->lpVtbl -> get_Hrm(This,ResType,ppunkHrm) ) - -#define IDSFDevice_get_Inserted(This,pfvarInserted) \ - ( (This)->lpVtbl -> get_Inserted(This,pfvarInserted) ) - -#define IDSFDevice_put_Inserted(This,fvarInserted) \ - ( (This)->lpVtbl -> put_Inserted(This,fvarInserted) ) - -#define IDSFDevice_get_Name(This,pbstrName) \ - ( (This)->lpVtbl -> get_Name(This,pbstrName) ) - -#define IDSFDevice_put_Name(This,bstrName) \ - ( (This)->lpVtbl -> put_Name(This,bstrName) ) - -#define IDSFDevice_get_Next(This,ppDSFDevice) \ - ( (This)->lpVtbl -> get_Next(This,ppDSFDevice) ) - -#define IDSFDevice_put_Next(This,pDSFDevice) \ - ( (This)->lpVtbl -> put_Next(This,pDSFDevice) ) - -#define IDSFDevice_putref_Next(This,pDSFDevice) \ - ( (This)->lpVtbl -> putref_Next(This,pDSFDevice) ) - -#define IDSFDevice_get_Object(This,GUID,ppunkObject) \ - ( (This)->lpVtbl -> get_Object(This,GUID,ppunkObject) ) - -#define IDSFDevice_put_Object(This,GUID,punkObject) \ - ( (This)->lpVtbl -> put_Object(This,GUID,punkObject) ) - -#define IDSFDevice_putref_Object(This,GUID,punkObject) \ - ( (This)->lpVtbl -> putref_Object(This,GUID,punkObject) ) - -#define IDSFDevice_get_OpMode(This,pMode) \ - ( (This)->lpVtbl -> get_OpMode(This,pMode) ) - -#define IDSFDevice_put_OpMode(This,Mode) \ - ( (This)->lpVtbl -> put_OpMode(This,Mode) ) - -#define IDSFDevice_get_Parent(This,ppDSFDevice) \ - ( (This)->lpVtbl -> get_Parent(This,ppDSFDevice) ) - -#define IDSFDevice_put_Parent(This,pDSFDevice) \ - ( (This)->lpVtbl -> put_Parent(This,pDSFDevice) ) - -#define IDSFDevice_putref_Parent(This,pDSFDevice) \ - ( (This)->lpVtbl -> putref_Parent(This,pDSFDevice) ) - -#define IDSFDevice_get_Persistent(This,pfvarPersistent) \ - ( (This)->lpVtbl -> get_Persistent(This,pfvarPersistent) ) - -#define IDSFDevice_put_Persistent(This,fvarPersistent) \ - ( (This)->lpVtbl -> put_Persistent(This,fvarPersistent) ) - -#define IDSFDevice_get_State(This,plState) \ - ( (This)->lpVtbl -> get_State(This,plState) ) - -#define IDSFDevice_get_SystemDevice(This,ppSystemDevice) \ - ( (This)->lpVtbl -> get_SystemDevice(This,ppSystemDevice) ) - -#define IDSFDevice_SetStateBit(This,Bit,BitOp) \ - ( (This)->lpVtbl -> SetStateBit(This,Bit,BitOp) ) - -#define IDSFDevice_StartFaultInjection(This,ResType,Params,pvarContext) \ - ( (This)->lpVtbl -> StartFaultInjection(This,ResType,Params,pvarContext) ) - -#define IDSFDevice_StopFaultInjection(This,ResType,Context) \ - ( (This)->lpVtbl -> StopFaultInjection(This,ResType,Context) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFDevice_INTERFACE_DEFINED__ */ - - -#ifndef __IDSFDeviceCaps_INTERFACE_DEFINED__ -#define __IDSFDeviceCaps_INTERFACE_DEFINED__ - -/* interface IDSFDeviceCaps */ -/* [object][helpstringcontext][helpcontext][helpstring][nonextensible][uuid] */ - - -EXTERN_C const IID IID_IDSFDeviceCaps; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("766705D3-5109-460D-80B5-30D97B17D867") - IDSFDeviceCaps : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Version( - /* [retval][out] */ __RPC__out short *psVersion) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Version( - /* [in] */ short sVersion) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceD1( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarDeviceD1) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceD1( - /* [in] */ VARIANT_BOOL fvarDeviceD1) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceD2( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarDeviceD2) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceD2( - /* [in] */ VARIANT_BOOL fvarDeviceD2) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_LockSupported( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarLockSupported) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_LockSupported( - /* [in] */ VARIANT_BOOL fvarLockSupported) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_EjectSupported( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEjectSupported) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_EjectSupported( - /* [in] */ VARIANT_BOOL fvarEjectSupported) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Removable( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarRemovable) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Removable( - /* [in] */ VARIANT_BOOL fvarRemovable) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DockDevice( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarDockDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DockDevice( - /* [in] */ VARIANT_BOOL fvarDockDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_UniqueID( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarUniqueID) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_UniqueID( - /* [in] */ VARIANT_BOOL fvarUniqueID) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_SilentInstall( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarSilentInstall) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_SilentInstall( - /* [in] */ VARIANT_BOOL fvarSilentInstall) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_RawDeviceOK( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarRawDeviceOK) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_RawDeviceOK( - /* [in] */ VARIANT_BOOL fvarRawDeviceOK) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_SurpriseRemovalOK( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarSurpriseRemovalOK) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_SurpriseRemovalOK( - /* [in] */ VARIANT_BOOL fvarSurpriseRemovalOK) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_WakeFromD0( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWakeFromD0) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_WakeFromD0( - /* [in] */ VARIANT_BOOL fvarWakeFromD0) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_WakeFromD1( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWakeFromD1) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_WakeFromD1( - /* [in] */ VARIANT_BOOL fvarWakeFromD1) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_WakeFromD2( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWakeFromD2) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_WakeFromD2( - /* [in] */ VARIANT_BOOL fvarWakeFromD2) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_WakeFromD3( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWakeFromD3) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_WakeFromD3( - /* [in] */ VARIANT_BOOL fvarWakeFromD3) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_HardwareDisabled( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarHardwareDisabled) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_HardwareDisabled( - /* [in] */ VARIANT_BOOL fvarHardwareDisabled) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_NonDynamic( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarNonDynamic) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_NonDynamic( - /* [in] */ VARIANT_BOOL fvarNonDynamic) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_WarmEjectSupported( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWarmEjectSupported) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_WarmEjectSupported( - /* [in] */ VARIANT_BOOL fvarWarmEjectSupported) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_NoDisplayInUI( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarNoDisplayInUI) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_NoDisplayInUI( - /* [in] */ VARIANT_BOOL fvarNoDisplayInUI) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Reserved( - /* [retval][out] */ __RPC__out short *psReserved) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Reserved( - /* [in] */ short sReserved) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Address( - /* [retval][out] */ __RPC__out long *plAddress) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Address( - /* [in] */ long lAddress) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_UINumber( - /* [retval][out] */ __RPC__out long *plUINumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_UINumber( - /* [in] */ long lUINumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceState( - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaDeviceState) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceState( - /* [in] */ __RPC__in SAFEARRAY * psaDeviceState) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_SystemWake( - /* [retval][out] */ __RPC__out DSFSystemPowerState *pPowerState) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_SystemWake( - /* [in] */ DSFSystemPowerState PowerState) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceWake( - /* [retval][out] */ __RPC__out DSFDevicePowerState *pPowerState) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceWake( - /* [in] */ DSFDevicePowerState PowerState) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_D1Latency( - /* [retval][out] */ __RPC__out long *plD1Latency) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_D1Latency( - /* [in] */ long lD1Latency) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_D2Latency( - /* [retval][out] */ __RPC__out long *plD2Latency) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_D2Latency( - /* [in] */ long lD2Latency) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_D3Latency( - /* [retval][out] */ __RPC__out long *plD3Latency) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_D3Latency( - /* [in] */ long lD3Latency) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFDeviceCapsVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFDeviceCaps * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFDeviceCaps * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFDeviceCaps * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFDeviceCaps * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Version )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out short *psVersion); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Version )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ short sVersion); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceD1 )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarDeviceD1); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceD1 )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarDeviceD1); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceD2 )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarDeviceD2); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceD2 )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarDeviceD2); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_LockSupported )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarLockSupported); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_LockSupported )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarLockSupported); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_EjectSupported )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEjectSupported); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_EjectSupported )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarEjectSupported); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Removable )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarRemovable); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Removable )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarRemovable); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DockDevice )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarDockDevice); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DockDevice )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarDockDevice); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_UniqueID )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarUniqueID); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_UniqueID )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarUniqueID); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_SilentInstall )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarSilentInstall); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_SilentInstall )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarSilentInstall); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_RawDeviceOK )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarRawDeviceOK); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_RawDeviceOK )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarRawDeviceOK); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_SurpriseRemovalOK )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarSurpriseRemovalOK); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_SurpriseRemovalOK )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarSurpriseRemovalOK); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_WakeFromD0 )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWakeFromD0); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_WakeFromD0 )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarWakeFromD0); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_WakeFromD1 )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWakeFromD1); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_WakeFromD1 )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarWakeFromD1); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_WakeFromD2 )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWakeFromD2); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_WakeFromD2 )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarWakeFromD2); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_WakeFromD3 )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWakeFromD3); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_WakeFromD3 )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarWakeFromD3); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_HardwareDisabled )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarHardwareDisabled); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_HardwareDisabled )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarHardwareDisabled); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_NonDynamic )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarNonDynamic); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_NonDynamic )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarNonDynamic); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_WarmEjectSupported )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWarmEjectSupported); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_WarmEjectSupported )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarWarmEjectSupported); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_NoDisplayInUI )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarNoDisplayInUI); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_NoDisplayInUI )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ VARIANT_BOOL fvarNoDisplayInUI); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Reserved )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out short *psReserved); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Reserved )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ short sReserved); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Address )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out long *plAddress); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Address )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ long lAddress); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_UINumber )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out long *plUINumber); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_UINumber )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ long lUINumber); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceState )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaDeviceState); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceState )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ __RPC__in SAFEARRAY * psaDeviceState); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_SystemWake )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out DSFSystemPowerState *pPowerState); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_SystemWake )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ DSFSystemPowerState PowerState); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceWake )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out DSFDevicePowerState *pPowerState); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceWake )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ DSFDevicePowerState PowerState); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_D1Latency )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out long *plD1Latency); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_D1Latency )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ long lD1Latency); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_D2Latency )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out long *plD2Latency); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_D2Latency )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ long lD2Latency); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_D3Latency )( - __RPC__in IDSFDeviceCaps * This, - /* [retval][out] */ __RPC__out long *plD3Latency); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_D3Latency )( - __RPC__in IDSFDeviceCaps * This, - /* [in] */ long lD3Latency); - - END_INTERFACE - } IDSFDeviceCapsVtbl; - - interface IDSFDeviceCaps - { - CONST_VTBL struct IDSFDeviceCapsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFDeviceCaps_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFDeviceCaps_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFDeviceCaps_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFDeviceCaps_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFDeviceCaps_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFDeviceCaps_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFDeviceCaps_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFDeviceCaps_get_Version(This,psVersion) \ - ( (This)->lpVtbl -> get_Version(This,psVersion) ) - -#define IDSFDeviceCaps_put_Version(This,sVersion) \ - ( (This)->lpVtbl -> put_Version(This,sVersion) ) - -#define IDSFDeviceCaps_get_DeviceD1(This,pfvarDeviceD1) \ - ( (This)->lpVtbl -> get_DeviceD1(This,pfvarDeviceD1) ) - -#define IDSFDeviceCaps_put_DeviceD1(This,fvarDeviceD1) \ - ( (This)->lpVtbl -> put_DeviceD1(This,fvarDeviceD1) ) - -#define IDSFDeviceCaps_get_DeviceD2(This,pfvarDeviceD2) \ - ( (This)->lpVtbl -> get_DeviceD2(This,pfvarDeviceD2) ) - -#define IDSFDeviceCaps_put_DeviceD2(This,fvarDeviceD2) \ - ( (This)->lpVtbl -> put_DeviceD2(This,fvarDeviceD2) ) - -#define IDSFDeviceCaps_get_LockSupported(This,pfvarLockSupported) \ - ( (This)->lpVtbl -> get_LockSupported(This,pfvarLockSupported) ) - -#define IDSFDeviceCaps_put_LockSupported(This,fvarLockSupported) \ - ( (This)->lpVtbl -> put_LockSupported(This,fvarLockSupported) ) - -#define IDSFDeviceCaps_get_EjectSupported(This,pfvarEjectSupported) \ - ( (This)->lpVtbl -> get_EjectSupported(This,pfvarEjectSupported) ) - -#define IDSFDeviceCaps_put_EjectSupported(This,fvarEjectSupported) \ - ( (This)->lpVtbl -> put_EjectSupported(This,fvarEjectSupported) ) - -#define IDSFDeviceCaps_get_Removable(This,pfvarRemovable) \ - ( (This)->lpVtbl -> get_Removable(This,pfvarRemovable) ) - -#define IDSFDeviceCaps_put_Removable(This,fvarRemovable) \ - ( (This)->lpVtbl -> put_Removable(This,fvarRemovable) ) - -#define IDSFDeviceCaps_get_DockDevice(This,pfvarDockDevice) \ - ( (This)->lpVtbl -> get_DockDevice(This,pfvarDockDevice) ) - -#define IDSFDeviceCaps_put_DockDevice(This,fvarDockDevice) \ - ( (This)->lpVtbl -> put_DockDevice(This,fvarDockDevice) ) - -#define IDSFDeviceCaps_get_UniqueID(This,pfvarUniqueID) \ - ( (This)->lpVtbl -> get_UniqueID(This,pfvarUniqueID) ) - -#define IDSFDeviceCaps_put_UniqueID(This,fvarUniqueID) \ - ( (This)->lpVtbl -> put_UniqueID(This,fvarUniqueID) ) - -#define IDSFDeviceCaps_get_SilentInstall(This,pfvarSilentInstall) \ - ( (This)->lpVtbl -> get_SilentInstall(This,pfvarSilentInstall) ) - -#define IDSFDeviceCaps_put_SilentInstall(This,fvarSilentInstall) \ - ( (This)->lpVtbl -> put_SilentInstall(This,fvarSilentInstall) ) - -#define IDSFDeviceCaps_get_RawDeviceOK(This,pfvarRawDeviceOK) \ - ( (This)->lpVtbl -> get_RawDeviceOK(This,pfvarRawDeviceOK) ) - -#define IDSFDeviceCaps_put_RawDeviceOK(This,fvarRawDeviceOK) \ - ( (This)->lpVtbl -> put_RawDeviceOK(This,fvarRawDeviceOK) ) - -#define IDSFDeviceCaps_get_SurpriseRemovalOK(This,pfvarSurpriseRemovalOK) \ - ( (This)->lpVtbl -> get_SurpriseRemovalOK(This,pfvarSurpriseRemovalOK) ) - -#define IDSFDeviceCaps_put_SurpriseRemovalOK(This,fvarSurpriseRemovalOK) \ - ( (This)->lpVtbl -> put_SurpriseRemovalOK(This,fvarSurpriseRemovalOK) ) - -#define IDSFDeviceCaps_get_WakeFromD0(This,pfvarWakeFromD0) \ - ( (This)->lpVtbl -> get_WakeFromD0(This,pfvarWakeFromD0) ) - -#define IDSFDeviceCaps_put_WakeFromD0(This,fvarWakeFromD0) \ - ( (This)->lpVtbl -> put_WakeFromD0(This,fvarWakeFromD0) ) - -#define IDSFDeviceCaps_get_WakeFromD1(This,pfvarWakeFromD1) \ - ( (This)->lpVtbl -> get_WakeFromD1(This,pfvarWakeFromD1) ) - -#define IDSFDeviceCaps_put_WakeFromD1(This,fvarWakeFromD1) \ - ( (This)->lpVtbl -> put_WakeFromD1(This,fvarWakeFromD1) ) - -#define IDSFDeviceCaps_get_WakeFromD2(This,pfvarWakeFromD2) \ - ( (This)->lpVtbl -> get_WakeFromD2(This,pfvarWakeFromD2) ) - -#define IDSFDeviceCaps_put_WakeFromD2(This,fvarWakeFromD2) \ - ( (This)->lpVtbl -> put_WakeFromD2(This,fvarWakeFromD2) ) - -#define IDSFDeviceCaps_get_WakeFromD3(This,pfvarWakeFromD3) \ - ( (This)->lpVtbl -> get_WakeFromD3(This,pfvarWakeFromD3) ) - -#define IDSFDeviceCaps_put_WakeFromD3(This,fvarWakeFromD3) \ - ( (This)->lpVtbl -> put_WakeFromD3(This,fvarWakeFromD3) ) - -#define IDSFDeviceCaps_get_HardwareDisabled(This,pfvarHardwareDisabled) \ - ( (This)->lpVtbl -> get_HardwareDisabled(This,pfvarHardwareDisabled) ) - -#define IDSFDeviceCaps_put_HardwareDisabled(This,fvarHardwareDisabled) \ - ( (This)->lpVtbl -> put_HardwareDisabled(This,fvarHardwareDisabled) ) - -#define IDSFDeviceCaps_get_NonDynamic(This,pfvarNonDynamic) \ - ( (This)->lpVtbl -> get_NonDynamic(This,pfvarNonDynamic) ) - -#define IDSFDeviceCaps_put_NonDynamic(This,fvarNonDynamic) \ - ( (This)->lpVtbl -> put_NonDynamic(This,fvarNonDynamic) ) - -#define IDSFDeviceCaps_get_WarmEjectSupported(This,pfvarWarmEjectSupported) \ - ( (This)->lpVtbl -> get_WarmEjectSupported(This,pfvarWarmEjectSupported) ) - -#define IDSFDeviceCaps_put_WarmEjectSupported(This,fvarWarmEjectSupported) \ - ( (This)->lpVtbl -> put_WarmEjectSupported(This,fvarWarmEjectSupported) ) - -#define IDSFDeviceCaps_get_NoDisplayInUI(This,pfvarNoDisplayInUI) \ - ( (This)->lpVtbl -> get_NoDisplayInUI(This,pfvarNoDisplayInUI) ) - -#define IDSFDeviceCaps_put_NoDisplayInUI(This,fvarNoDisplayInUI) \ - ( (This)->lpVtbl -> put_NoDisplayInUI(This,fvarNoDisplayInUI) ) - -#define IDSFDeviceCaps_get_Reserved(This,psReserved) \ - ( (This)->lpVtbl -> get_Reserved(This,psReserved) ) - -#define IDSFDeviceCaps_put_Reserved(This,sReserved) \ - ( (This)->lpVtbl -> put_Reserved(This,sReserved) ) - -#define IDSFDeviceCaps_get_Address(This,plAddress) \ - ( (This)->lpVtbl -> get_Address(This,plAddress) ) - -#define IDSFDeviceCaps_put_Address(This,lAddress) \ - ( (This)->lpVtbl -> put_Address(This,lAddress) ) - -#define IDSFDeviceCaps_get_UINumber(This,plUINumber) \ - ( (This)->lpVtbl -> get_UINumber(This,plUINumber) ) - -#define IDSFDeviceCaps_put_UINumber(This,lUINumber) \ - ( (This)->lpVtbl -> put_UINumber(This,lUINumber) ) - -#define IDSFDeviceCaps_get_DeviceState(This,ppsaDeviceState) \ - ( (This)->lpVtbl -> get_DeviceState(This,ppsaDeviceState) ) - -#define IDSFDeviceCaps_put_DeviceState(This,psaDeviceState) \ - ( (This)->lpVtbl -> put_DeviceState(This,psaDeviceState) ) - -#define IDSFDeviceCaps_get_SystemWake(This,pPowerState) \ - ( (This)->lpVtbl -> get_SystemWake(This,pPowerState) ) - -#define IDSFDeviceCaps_put_SystemWake(This,PowerState) \ - ( (This)->lpVtbl -> put_SystemWake(This,PowerState) ) - -#define IDSFDeviceCaps_get_DeviceWake(This,pPowerState) \ - ( (This)->lpVtbl -> get_DeviceWake(This,pPowerState) ) - -#define IDSFDeviceCaps_put_DeviceWake(This,PowerState) \ - ( (This)->lpVtbl -> put_DeviceWake(This,PowerState) ) - -#define IDSFDeviceCaps_get_D1Latency(This,plD1Latency) \ - ( (This)->lpVtbl -> get_D1Latency(This,plD1Latency) ) - -#define IDSFDeviceCaps_put_D1Latency(This,lD1Latency) \ - ( (This)->lpVtbl -> put_D1Latency(This,lD1Latency) ) - -#define IDSFDeviceCaps_get_D2Latency(This,plD2Latency) \ - ( (This)->lpVtbl -> get_D2Latency(This,plD2Latency) ) - -#define IDSFDeviceCaps_put_D2Latency(This,lD2Latency) \ - ( (This)->lpVtbl -> put_D2Latency(This,lD2Latency) ) - -#define IDSFDeviceCaps_get_D3Latency(This,plD3Latency) \ - ( (This)->lpVtbl -> get_D3Latency(This,plD3Latency) ) - -#define IDSFDeviceCaps_put_D3Latency(This,lD3Latency) \ - ( (This)->lpVtbl -> put_D3Latency(This,lD3Latency) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFDeviceCaps_INTERFACE_DEFINED__ */ - - -#ifndef __IDSFDeviceEvents_INTERFACE_DEFINED__ -#define __IDSFDeviceEvents_INTERFACE_DEFINED__ - -/* interface IDSFDeviceEvents */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFDeviceEvents; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("3E706BA6-2C8F-4441-8931-1ACEB318112F") - IDSFDeviceEvents : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Disabled( void) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Enabled( void) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Inserted( void) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall OpModeChange( - /* [in] */ DSFOpMode NewOpMode) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Removed( void) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall ResourcesSet( void) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall StartFaultInjection( - /* [in] */ DSFResourceType ResType, - /* [in] */ VARIANT Params, - /* [retval][out] */ __RPC__out VARIANT *pvarContext) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall StopFaultInjection( - /* [in] */ DSFResourceType ResType, - /* [in] */ VARIANT Context) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall StateChange( - /* [in] */ long Bit, - /* [in] */ short Value, - /* [in] */ long NewState) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFDeviceEventsVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFDeviceEvents * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFDeviceEvents * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFDeviceEvents * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFDeviceEvents * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFDeviceEvents * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFDeviceEvents * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFDeviceEvents * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Disabled )( - __RPC__in IDSFDeviceEvents * This); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Enabled )( - __RPC__in IDSFDeviceEvents * This); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Inserted )( - __RPC__in IDSFDeviceEvents * This); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *OpModeChange )( - __RPC__in IDSFDeviceEvents * This, - /* [in] */ DSFOpMode NewOpMode); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Removed )( - __RPC__in IDSFDeviceEvents * This); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *ResourcesSet )( - __RPC__in IDSFDeviceEvents * This); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *StartFaultInjection )( - __RPC__in IDSFDeviceEvents * This, - /* [in] */ DSFResourceType ResType, - /* [in] */ VARIANT Params, - /* [retval][out] */ __RPC__out VARIANT *pvarContext); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *StopFaultInjection )( - __RPC__in IDSFDeviceEvents * This, - /* [in] */ DSFResourceType ResType, - /* [in] */ VARIANT Context); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *StateChange )( - __RPC__in IDSFDeviceEvents * This, - /* [in] */ long Bit, - /* [in] */ short Value, - /* [in] */ long NewState); - - END_INTERFACE - } IDSFDeviceEventsVtbl; - - interface IDSFDeviceEvents - { - CONST_VTBL struct IDSFDeviceEventsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFDeviceEvents_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFDeviceEvents_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFDeviceEvents_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFDeviceEvents_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFDeviceEvents_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFDeviceEvents_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFDeviceEvents_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFDeviceEvents_Disabled(This) \ - ( (This)->lpVtbl -> Disabled(This) ) - -#define IDSFDeviceEvents_Enabled(This) \ - ( (This)->lpVtbl -> Enabled(This) ) - -#define IDSFDeviceEvents_Inserted(This) \ - ( (This)->lpVtbl -> Inserted(This) ) - -#define IDSFDeviceEvents_OpModeChange(This,NewOpMode) \ - ( (This)->lpVtbl -> OpModeChange(This,NewOpMode) ) - -#define IDSFDeviceEvents_Removed(This) \ - ( (This)->lpVtbl -> Removed(This) ) - -#define IDSFDeviceEvents_ResourcesSet(This) \ - ( (This)->lpVtbl -> ResourcesSet(This) ) - -#define IDSFDeviceEvents_StartFaultInjection(This,ResType,Params,pvarContext) \ - ( (This)->lpVtbl -> StartFaultInjection(This,ResType,Params,pvarContext) ) - -#define IDSFDeviceEvents_StopFaultInjection(This,ResType,Context) \ - ( (This)->lpVtbl -> StopFaultInjection(This,ResType,Context) ) - -#define IDSFDeviceEvents_StateChange(This,Bit,Value,NewState) \ - ( (This)->lpVtbl -> StateChange(This,Bit,Value,NewState) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFDeviceEvents_INTERFACE_DEFINED__ */ - - -#ifndef __IDSF_INTERFACE_DEFINED__ -#define __IDSF_INTERFACE_DEFINED__ - -/* interface IDSF */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSF; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("959B9C1D-5644-4835-8297-F435B3FA80DD") - IDSF : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Devices( - /* [retval][out] */ __RPC__deref_out_opt DSFDevices **ppDSFDevices) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Log( - /* [retval][out] */ __RPC__deref_out_opt DSFLog **ppDSFLog) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Version( - /* [retval][out] */ __RPC__deref_out_opt DSFVersion **ppDSFVersion) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall CreateDevice( - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in BSTR bstrInstanceID, - /* [in] */ VARIANT HardwareIDs, - /* [in] */ VARIANT CompatibleIDs, - /* [in] */ __RPC__in DSFResourceList *RawResources, - /* [in] */ __RPC__in DSFResourceList *XlatedResources, - /* [in] */ __RPC__in DSFDeviceCaps *DeviceCapabilities, - /* [retval][out] */ __RPC__deref_out_opt DSFDevice **ppDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall WriteState( - /* [in] */ DSFStateType Type, - /* [in] */ __RPC__in BSTR Guid, - /* [in] */ __RPC__in DSFPropertyBag *pDSFPropertyBag) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall ReadState( - /* [in] */ DSFStateType Type, - /* [in] */ __RPC__in BSTR Guid, - /* [retval][out] */ __RPC__deref_out_opt DSFPropertyBag **ppDSFPropertyBag) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall DeleteState( - /* [in] */ DSFStateType Type, - /* [in] */ __RPC__in BSTR Guid) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall SetDriverFlags( - /* [in] */ __RPC__in BSTR DriverGuid, - /* [in] */ DSFFlagType FlagType, - /* [in] */ unsigned long Flags) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall EnableDriverLogging( - /* [in] */ __RPC__in BSTR DriverGuid, - /* [in] */ VARIANT_BOOL Enable) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall HotPlug( - /* [in] */ __RPC__in DSFDevice *pDSFDevice, - /* [in] */ __RPC__in BSTR bstrBus, - /* [retval][out] */ __RPC__deref_out_opt IDSFBus **ppiDSFBus) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSF * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSF * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSF * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSF * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSF * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSF * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSF * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Devices )( - __RPC__in IDSF * This, - /* [retval][out] */ __RPC__deref_out_opt DSFDevices **ppDSFDevices); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Log )( - __RPC__in IDSF * This, - /* [retval][out] */ __RPC__deref_out_opt DSFLog **ppDSFLog); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Version )( - __RPC__in IDSF * This, - /* [retval][out] */ __RPC__deref_out_opt DSFVersion **ppDSFVersion); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *CreateDevice )( - __RPC__in IDSF * This, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in BSTR bstrInstanceID, - /* [in] */ VARIANT HardwareIDs, - /* [in] */ VARIANT CompatibleIDs, - /* [in] */ __RPC__in DSFResourceList *RawResources, - /* [in] */ __RPC__in DSFResourceList *XlatedResources, - /* [in] */ __RPC__in DSFDeviceCaps *DeviceCapabilities, - /* [retval][out] */ __RPC__deref_out_opt DSFDevice **ppDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *WriteState )( - __RPC__in IDSF * This, - /* [in] */ DSFStateType Type, - /* [in] */ __RPC__in BSTR Guid, - /* [in] */ __RPC__in DSFPropertyBag *pDSFPropertyBag); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *ReadState )( - __RPC__in IDSF * This, - /* [in] */ DSFStateType Type, - /* [in] */ __RPC__in BSTR Guid, - /* [retval][out] */ __RPC__deref_out_opt DSFPropertyBag **ppDSFPropertyBag); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *DeleteState )( - __RPC__in IDSF * This, - /* [in] */ DSFStateType Type, - /* [in] */ __RPC__in BSTR Guid); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *SetDriverFlags )( - __RPC__in IDSF * This, - /* [in] */ __RPC__in BSTR DriverGuid, - /* [in] */ DSFFlagType FlagType, - /* [in] */ unsigned long Flags); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *EnableDriverLogging )( - __RPC__in IDSF * This, - /* [in] */ __RPC__in BSTR DriverGuid, - /* [in] */ VARIANT_BOOL Enable); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *HotPlug )( - __RPC__in IDSF * This, - /* [in] */ __RPC__in DSFDevice *pDSFDevice, - /* [in] */ __RPC__in BSTR bstrBus, - /* [retval][out] */ __RPC__deref_out_opt IDSFBus **ppiDSFBus); - - END_INTERFACE - } IDSFVtbl; - - interface IDSF - { - CONST_VTBL struct IDSFVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSF_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSF_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSF_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSF_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSF_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSF_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSF_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSF_get_Devices(This,ppDSFDevices) \ - ( (This)->lpVtbl -> get_Devices(This,ppDSFDevices) ) - -#define IDSF_get_Log(This,ppDSFLog) \ - ( (This)->lpVtbl -> get_Log(This,ppDSFLog) ) - -#define IDSF_get_Version(This,ppDSFVersion) \ - ( (This)->lpVtbl -> get_Version(This,ppDSFVersion) ) - -#define IDSF_CreateDevice(This,bstrDeviceID,bstrInstanceID,HardwareIDs,CompatibleIDs,RawResources,XlatedResources,DeviceCapabilities,ppDSFDevice) \ - ( (This)->lpVtbl -> CreateDevice(This,bstrDeviceID,bstrInstanceID,HardwareIDs,CompatibleIDs,RawResources,XlatedResources,DeviceCapabilities,ppDSFDevice) ) - -#define IDSF_WriteState(This,Type,Guid,pDSFPropertyBag) \ - ( (This)->lpVtbl -> WriteState(This,Type,Guid,pDSFPropertyBag) ) - -#define IDSF_ReadState(This,Type,Guid,ppDSFPropertyBag) \ - ( (This)->lpVtbl -> ReadState(This,Type,Guid,ppDSFPropertyBag) ) - -#define IDSF_DeleteState(This,Type,Guid) \ - ( (This)->lpVtbl -> DeleteState(This,Type,Guid) ) - -#define IDSF_SetDriverFlags(This,DriverGuid,FlagType,Flags) \ - ( (This)->lpVtbl -> SetDriverFlags(This,DriverGuid,FlagType,Flags) ) - -#define IDSF_EnableDriverLogging(This,DriverGuid,Enable) \ - ( (This)->lpVtbl -> EnableDriverLogging(This,DriverGuid,Enable) ) - -#define IDSF_HotPlug(This,pDSFDevice,bstrBus,ppiDSFBus) \ - ( (This)->lpVtbl -> HotPlug(This,pDSFDevice,bstrBus,ppiDSFBus) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSF_INTERFACE_DEFINED__ */ - - -#ifndef __IDSFDevices_INTERFACE_DEFINED__ -#define __IDSFDevices_INTERFACE_DEFINED__ - -/* interface IDSFDevices */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFDevices; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E75FB264-EA8A-4167-892B-F6F315249518") - IDSFDevices : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Count( - /* [retval][out] */ __RPC__out long *plCount) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Item( - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt DSFDevice **ppDSFDevice) = 0; - - virtual /* [hidden][propget][id] */ HRESULT __stdcall get__NewEnum( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Refresh( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFDevicesVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFDevices * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFDevices * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFDevices * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFDevices * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFDevices * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFDevices * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFDevices * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Count )( - __RPC__in IDSFDevices * This, - /* [retval][out] */ __RPC__out long *plCount); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Item )( - __RPC__in IDSFDevices * This, - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt DSFDevice **ppDSFDevice); - - /* [hidden][propget][id] */ HRESULT ( __stdcall *get__NewEnum )( - __RPC__in IDSFDevices * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Refresh )( - __RPC__in IDSFDevices * This); - - END_INTERFACE - } IDSFDevicesVtbl; - - interface IDSFDevices - { - CONST_VTBL struct IDSFDevicesVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFDevices_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFDevices_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFDevices_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFDevices_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFDevices_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFDevices_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFDevices_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFDevices_get_Count(This,plCount) \ - ( (This)->lpVtbl -> get_Count(This,plCount) ) - -#define IDSFDevices_get_Item(This,Index,ppDSFDevice) \ - ( (This)->lpVtbl -> get_Item(This,Index,ppDSFDevice) ) - -#define IDSFDevices_get__NewEnum(This,ppunkEnum) \ - ( (This)->lpVtbl -> get__NewEnum(This,ppunkEnum) ) - -#define IDSFDevices_Refresh(This) \ - ( (This)->lpVtbl -> Refresh(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFDevices_INTERFACE_DEFINED__ */ - - -#ifndef __IDSFLog_INTERFACE_DEFINED__ -#define __IDSFLog_INTERFACE_DEFINED__ - -/* interface IDSFLog */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFLog; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("B7902A6F-4CC1-4ABE-8E7A-6EFF79BBBACA") - IDSFLog : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Write( - /* [in] */ __RPC__in BSTR Text) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Enabled( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEnabled) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Enabled( - /* [in] */ VARIANT_BOOL fvarEnabled) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFLogVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFLog * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFLog * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFLog * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFLog * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFLog * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFLog * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFLog * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Write )( - __RPC__in IDSFLog * This, - /* [in] */ __RPC__in BSTR Text); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Enabled )( - __RPC__in IDSFLog * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEnabled); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Enabled )( - __RPC__in IDSFLog * This, - /* [in] */ VARIANT_BOOL fvarEnabled); - - END_INTERFACE - } IDSFLogVtbl; - - interface IDSFLog - { - CONST_VTBL struct IDSFLogVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFLog_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFLog_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFLog_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFLog_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFLog_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFLog_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFLog_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFLog_Write(This,Text) \ - ( (This)->lpVtbl -> Write(This,Text) ) - -#define IDSFLog_get_Enabled(This,pfvarEnabled) \ - ( (This)->lpVtbl -> get_Enabled(This,pfvarEnabled) ) - -#define IDSFLog_put_Enabled(This,fvarEnabled) \ - ( (This)->lpVtbl -> put_Enabled(This,fvarEnabled) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFLog_INTERFACE_DEFINED__ */ - - -#ifndef __IDSFVersion_INTERFACE_DEFINED__ -#define __IDSFVersion_INTERFACE_DEFINED__ - -/* interface IDSFVersion */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFVersion; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("F65DF1DA-32B4-411A-B989-1B43B5C428F2") - IDSFVersion : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Major( - /* [retval][out] */ __RPC__out long *plMajor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Minor( - /* [retval][out] */ __RPC__out long *plMinor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_OSMajor( - /* [retval][out] */ __RPC__out long *plOSMajor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_OSMinor( - /* [retval][out] */ __RPC__out long *plOSMinor) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFVersionVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFVersion * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFVersion * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFVersion * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFVersion * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFVersion * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFVersion * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFVersion * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Major )( - __RPC__in IDSFVersion * This, - /* [retval][out] */ __RPC__out long *plMajor); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Minor )( - __RPC__in IDSFVersion * This, - /* [retval][out] */ __RPC__out long *plMinor); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_OSMajor )( - __RPC__in IDSFVersion * This, - /* [retval][out] */ __RPC__out long *plOSMajor); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_OSMinor )( - __RPC__in IDSFVersion * This, - /* [retval][out] */ __RPC__out long *plOSMinor); - - END_INTERFACE - } IDSFVersionVtbl; - - interface IDSFVersion - { - CONST_VTBL struct IDSFVersionVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFVersion_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFVersion_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFVersion_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFVersion_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFVersion_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFVersion_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFVersion_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFVersion_get_Major(This,plMajor) \ - ( (This)->lpVtbl -> get_Major(This,plMajor) ) - -#define IDSFVersion_get_Minor(This,plMinor) \ - ( (This)->lpVtbl -> get_Minor(This,plMinor) ) - -#define IDSFVersion_get_OSMajor(This,plOSMajor) \ - ( (This)->lpVtbl -> get_OSMajor(This,plOSMajor) ) - -#define IDSFVersion_get_OSMinor(This,plOSMinor) \ - ( (This)->lpVtbl -> get_OSMinor(This,plOSMinor) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFVersion_INTERFACE_DEFINED__ */ - - -#ifndef __IDSFPropertyBag_INTERFACE_DEFINED__ -#define __IDSFPropertyBag_INTERFACE_DEFINED__ - -/* interface IDSFPropertyBag */ -/* [object][helpstringcontext][helpcontext][helpstring][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFPropertyBag; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("ac2ed126-da20-48db-817c-61689122d1e0") - IDSFPropertyBag : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Write( - /* [in] */ __RPC__in BSTR Name, - /* [in] */ VARIANT Value) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Read( - /* [in] */ __RPC__in BSTR Name, - /* [retval][out] */ __RPC__out VARIANT *Value) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Remove( - /* [in] */ __RPC__in BSTR Name) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Clear( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFPropertyBagVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFPropertyBag * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFPropertyBag * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFPropertyBag * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFPropertyBag * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFPropertyBag * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFPropertyBag * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFPropertyBag * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Write )( - __RPC__in IDSFPropertyBag * This, - /* [in] */ __RPC__in BSTR Name, - /* [in] */ VARIANT Value); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Read )( - __RPC__in IDSFPropertyBag * This, - /* [in] */ __RPC__in BSTR Name, - /* [retval][out] */ __RPC__out VARIANT *Value); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Remove )( - __RPC__in IDSFPropertyBag * This, - /* [in] */ __RPC__in BSTR Name); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Clear )( - __RPC__in IDSFPropertyBag * This); - - END_INTERFACE - } IDSFPropertyBagVtbl; - - interface IDSFPropertyBag - { - CONST_VTBL struct IDSFPropertyBagVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFPropertyBag_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFPropertyBag_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFPropertyBag_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFPropertyBag_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFPropertyBag_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFPropertyBag_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFPropertyBag_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFPropertyBag_Write(This,Name,Value) \ - ( (This)->lpVtbl -> Write(This,Name,Value) ) - -#define IDSFPropertyBag_Read(This,Name,Value) \ - ( (This)->lpVtbl -> Read(This,Name,Value) ) - -#define IDSFPropertyBag_Remove(This,Name) \ - ( (This)->lpVtbl -> Remove(This,Name) ) - -#define IDSFPropertyBag_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFPropertyBag_INTERFACE_DEFINED__ */ - - -#ifndef __IDSFBus_INTERFACE_DEFINED__ -#define __IDSFBus_INTERFACE_DEFINED__ - -/* interface IDSFBus */ -/* [object][helpstringcontext][helpcontext][helpstring][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFBus; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E927C266-5364-449E-AE52-D6A782AFDA9C") - IDSFBus : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Name( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_GUID( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrGuid) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall HotPlug( - /* [in] */ __RPC__in DSFDevice *pDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Unplug( - /* [in] */ __RPC__in DSFDevice *pDSFDevice) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFBusVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFBus * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFBus * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFBus * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFBus * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFBus * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFBus * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFBus * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Name )( - __RPC__in IDSFBus * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrName); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_GUID )( - __RPC__in IDSFBus * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrGuid); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *HotPlug )( - __RPC__in IDSFBus * This, - /* [in] */ __RPC__in DSFDevice *pDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Unplug )( - __RPC__in IDSFBus * This, - /* [in] */ __RPC__in DSFDevice *pDSFDevice); - - END_INTERFACE - } IDSFBusVtbl; - - interface IDSFBus - { - CONST_VTBL struct IDSFBusVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFBus_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFBus_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFBus_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFBus_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFBus_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFBus_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFBus_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFBus_get_Name(This,pbstrName) \ - ( (This)->lpVtbl -> get_Name(This,pbstrName) ) - -#define IDSFBus_get_GUID(This,pbstrGuid) \ - ( (This)->lpVtbl -> get_GUID(This,pbstrGuid) ) - -#define IDSFBus_HotPlug(This,pDSFDevice) \ - ( (This)->lpVtbl -> HotPlug(This,pDSFDevice) ) - -#define IDSFBus_Unplug(This,pDSFDevice) \ - ( (This)->lpVtbl -> Unplug(This,pDSFDevice) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFBus_INTERFACE_DEFINED__ */ - - -#ifndef __IDSFPartialResourceDescriptor_INTERFACE_DEFINED__ -#define __IDSFPartialResourceDescriptor_INTERFACE_DEFINED__ - -/* interface IDSFPartialResourceDescriptor */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFPartialResourceDescriptor; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("227948DE-4F1F-4689-8D9F-ED044417C5A9") - IDSFPartialResourceDescriptor : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Type( - /* [retval][out] */ __RPC__out DSFResourceType *pType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Type( - /* [in] */ DSFResourceType ResType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_ShareDisposition( - /* [retval][out] */ __RPC__out DSFShareDisposition *pShareType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_ShareDisposition( - /* [in] */ DSFShareDisposition ShareType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Flags( - /* [retval][out] */ __RPC__out short *psFlags) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Flags( - /* [in] */ short sFlags) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Descriptor( - /* [retval][out] */ __RPC__deref_out_opt IDispatch **ppdispDescriptor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Descriptor( - /* [in] */ __RPC__in_opt IDispatch *pdispDescriptor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_HRM( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkHRM) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_HRM( - /* [in] */ __RPC__in_opt IUnknown *punkHRM) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFPartialResourceDescriptorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFPartialResourceDescriptor * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFPartialResourceDescriptor * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFPartialResourceDescriptor * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Type )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [retval][out] */ __RPC__out DSFResourceType *pType); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Type )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [in] */ DSFResourceType ResType); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_ShareDisposition )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [retval][out] */ __RPC__out DSFShareDisposition *pShareType); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_ShareDisposition )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [in] */ DSFShareDisposition ShareType); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Flags )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [retval][out] */ __RPC__out short *psFlags); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Flags )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [in] */ short sFlags); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Descriptor )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [retval][out] */ __RPC__deref_out_opt IDispatch **ppdispDescriptor); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Descriptor )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [in] */ __RPC__in_opt IDispatch *pdispDescriptor); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_HRM )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkHRM); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_HRM )( - __RPC__in IDSFPartialResourceDescriptor * This, - /* [in] */ __RPC__in_opt IUnknown *punkHRM); - - END_INTERFACE - } IDSFPartialResourceDescriptorVtbl; - - interface IDSFPartialResourceDescriptor - { - CONST_VTBL struct IDSFPartialResourceDescriptorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFPartialResourceDescriptor_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFPartialResourceDescriptor_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFPartialResourceDescriptor_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFPartialResourceDescriptor_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFPartialResourceDescriptor_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFPartialResourceDescriptor_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFPartialResourceDescriptor_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFPartialResourceDescriptor_get_Type(This,pType) \ - ( (This)->lpVtbl -> get_Type(This,pType) ) - -#define IDSFPartialResourceDescriptor_put_Type(This,ResType) \ - ( (This)->lpVtbl -> put_Type(This,ResType) ) - -#define IDSFPartialResourceDescriptor_get_ShareDisposition(This,pShareType) \ - ( (This)->lpVtbl -> get_ShareDisposition(This,pShareType) ) - -#define IDSFPartialResourceDescriptor_put_ShareDisposition(This,ShareType) \ - ( (This)->lpVtbl -> put_ShareDisposition(This,ShareType) ) - -#define IDSFPartialResourceDescriptor_get_Flags(This,psFlags) \ - ( (This)->lpVtbl -> get_Flags(This,psFlags) ) - -#define IDSFPartialResourceDescriptor_put_Flags(This,sFlags) \ - ( (This)->lpVtbl -> put_Flags(This,sFlags) ) - -#define IDSFPartialResourceDescriptor_get_Descriptor(This,ppdispDescriptor) \ - ( (This)->lpVtbl -> get_Descriptor(This,ppdispDescriptor) ) - -#define IDSFPartialResourceDescriptor_put_Descriptor(This,pdispDescriptor) \ - ( (This)->lpVtbl -> put_Descriptor(This,pdispDescriptor) ) - -#define IDSFPartialResourceDescriptor_get_HRM(This,ppunkHRM) \ - ( (This)->lpVtbl -> get_HRM(This,ppunkHRM) ) - -#define IDSFPartialResourceDescriptor_put_HRM(This,punkHRM) \ - ( (This)->lpVtbl -> put_HRM(This,punkHRM) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFPartialResourceDescriptor_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_DSFPartialResourceDescriptor; - -#ifdef __cplusplus - -class DECLSPEC_UUID("7E3FC012-1DB1-4135-AAAA-7FA6ED1CF620") -DSFPartialResourceDescriptor; -#endif - -#ifndef __IDSFPartialResourceList_INTERFACE_DEFINED__ -#define __IDSFPartialResourceList_INTERFACE_DEFINED__ - -/* interface IDSFPartialResourceList */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFPartialResourceList; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C388EB82-EA52-4459-84D9-69B7E9846EC0") - IDSFPartialResourceList : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Version( - /* [retval][out] */ __RPC__out short *psVersion) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Version( - /* [in] */ short sVersion) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Revision( - /* [retval][out] */ __RPC__out short *psRevision) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Revision( - /* [in] */ short sRevision) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Count( - /* [retval][out] */ __RPC__out long *plCount) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Item( - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt DSFPartialResourceDescriptor **ppDSFPartialResourceDescriptor) = 0; - - virtual /* [hidden][propget][id] */ HRESULT __stdcall get__NewEnum( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Add( - /* [in] */ __RPC__in DSFPartialResourceDescriptor *pDSFPartialResourceDescriptor, - /* [optional][in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Remove( - /* [in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Clear( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFPartialResourceListVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFPartialResourceList * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFPartialResourceList * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFPartialResourceList * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFPartialResourceList * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFPartialResourceList * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFPartialResourceList * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFPartialResourceList * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Version )( - __RPC__in IDSFPartialResourceList * This, - /* [retval][out] */ __RPC__out short *psVersion); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Version )( - __RPC__in IDSFPartialResourceList * This, - /* [in] */ short sVersion); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Revision )( - __RPC__in IDSFPartialResourceList * This, - /* [retval][out] */ __RPC__out short *psRevision); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Revision )( - __RPC__in IDSFPartialResourceList * This, - /* [in] */ short sRevision); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Count )( - __RPC__in IDSFPartialResourceList * This, - /* [retval][out] */ __RPC__out long *plCount); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Item )( - __RPC__in IDSFPartialResourceList * This, - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt DSFPartialResourceDescriptor **ppDSFPartialResourceDescriptor); - - /* [hidden][propget][id] */ HRESULT ( __stdcall *get__NewEnum )( - __RPC__in IDSFPartialResourceList * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Add )( - __RPC__in IDSFPartialResourceList * This, - /* [in] */ __RPC__in DSFPartialResourceDescriptor *pDSFPartialResourceDescriptor, - /* [optional][in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Remove )( - __RPC__in IDSFPartialResourceList * This, - /* [in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Clear )( - __RPC__in IDSFPartialResourceList * This); - - END_INTERFACE - } IDSFPartialResourceListVtbl; - - interface IDSFPartialResourceList - { - CONST_VTBL struct IDSFPartialResourceListVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFPartialResourceList_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFPartialResourceList_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFPartialResourceList_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFPartialResourceList_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFPartialResourceList_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFPartialResourceList_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFPartialResourceList_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFPartialResourceList_get_Version(This,psVersion) \ - ( (This)->lpVtbl -> get_Version(This,psVersion) ) - -#define IDSFPartialResourceList_put_Version(This,sVersion) \ - ( (This)->lpVtbl -> put_Version(This,sVersion) ) - -#define IDSFPartialResourceList_get_Revision(This,psRevision) \ - ( (This)->lpVtbl -> get_Revision(This,psRevision) ) - -#define IDSFPartialResourceList_put_Revision(This,sRevision) \ - ( (This)->lpVtbl -> put_Revision(This,sRevision) ) - -#define IDSFPartialResourceList_get_Count(This,plCount) \ - ( (This)->lpVtbl -> get_Count(This,plCount) ) - -#define IDSFPartialResourceList_get_Item(This,Index,ppDSFPartialResourceDescriptor) \ - ( (This)->lpVtbl -> get_Item(This,Index,ppDSFPartialResourceDescriptor) ) - -#define IDSFPartialResourceList_get__NewEnum(This,ppunkEnum) \ - ( (This)->lpVtbl -> get__NewEnum(This,ppunkEnum) ) - -#define IDSFPartialResourceList_Add(This,pDSFPartialResourceDescriptor,Index) \ - ( (This)->lpVtbl -> Add(This,pDSFPartialResourceDescriptor,Index) ) - -#define IDSFPartialResourceList_Remove(This,Index) \ - ( (This)->lpVtbl -> Remove(This,Index) ) - -#define IDSFPartialResourceList_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFPartialResourceList_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_DSFPartialResourceList; - -#ifdef __cplusplus - -class DECLSPEC_UUID("DC1C8B82-254C-4AD9-8CE0-CA477FC56DB1") -DSFPartialResourceList; -#endif - -EXTERN_C const CLSID CLSID_DSFFullResourceDescriptor; - -#ifdef __cplusplus - -class DECLSPEC_UUID("CECFEC54-035C-4103-B64F-A200AB9F32C2") -DSFFullResourceDescriptor; -#endif - -EXTERN_C const CLSID CLSID_DSFResourceList; - -#ifdef __cplusplus - -class DECLSPEC_UUID("3596C463-2D1E-40B7-8DC7-7BB32F9E2DC4") -DSFResourceList; -#endif - -#ifndef __IDSFResDescPort_INTERFACE_DEFINED__ -#define __IDSFResDescPort_INTERFACE_DEFINED__ - -/* interface IDSFResDescPort */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFResDescPort; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("82850DB2-0F99-4529-9F6E-6C1273C6027C") - IDSFResDescPort : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_StartLow( - /* [retval][out] */ __RPC__out long *plStartLow) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_StartLow( - /* [in] */ long lStartLow) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_StartHigh( - /* [retval][out] */ __RPC__out long *plStartHigh) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_StartHigh( - /* [in] */ long lStartHigh) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Length( - /* [retval][out] */ __RPC__out long *plLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Length( - /* [in] */ long lLength) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFResDescPortVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFResDescPort * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFResDescPort * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFResDescPort * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFResDescPort * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFResDescPort * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFResDescPort * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFResDescPort * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_StartLow )( - __RPC__in IDSFResDescPort * This, - /* [retval][out] */ __RPC__out long *plStartLow); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_StartLow )( - __RPC__in IDSFResDescPort * This, - /* [in] */ long lStartLow); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_StartHigh )( - __RPC__in IDSFResDescPort * This, - /* [retval][out] */ __RPC__out long *plStartHigh); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_StartHigh )( - __RPC__in IDSFResDescPort * This, - /* [in] */ long lStartHigh); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Length )( - __RPC__in IDSFResDescPort * This, - /* [retval][out] */ __RPC__out long *plLength); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Length )( - __RPC__in IDSFResDescPort * This, - /* [in] */ long lLength); - - END_INTERFACE - } IDSFResDescPortVtbl; - - interface IDSFResDescPort - { - CONST_VTBL struct IDSFResDescPortVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFResDescPort_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFResDescPort_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFResDescPort_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFResDescPort_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFResDescPort_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFResDescPort_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFResDescPort_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFResDescPort_get_StartLow(This,plStartLow) \ - ( (This)->lpVtbl -> get_StartLow(This,plStartLow) ) - -#define IDSFResDescPort_put_StartLow(This,lStartLow) \ - ( (This)->lpVtbl -> put_StartLow(This,lStartLow) ) - -#define IDSFResDescPort_get_StartHigh(This,plStartHigh) \ - ( (This)->lpVtbl -> get_StartHigh(This,plStartHigh) ) - -#define IDSFResDescPort_put_StartHigh(This,lStartHigh) \ - ( (This)->lpVtbl -> put_StartHigh(This,lStartHigh) ) - -#define IDSFResDescPort_get_Length(This,plLength) \ - ( (This)->lpVtbl -> get_Length(This,plLength) ) - -#define IDSFResDescPort_put_Length(This,lLength) \ - ( (This)->lpVtbl -> put_Length(This,lLength) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFResDescPort_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_DSFResDescPort; - -#ifdef __cplusplus - -class DECLSPEC_UUID("680D2930-B314-4B4F-87F0-14E8ECB1982F") -DSFResDescPort; -#endif - -#ifndef __IDSFResDescDevSpecific_INTERFACE_DEFINED__ -#define __IDSFResDescDevSpecific_INTERFACE_DEFINED__ - -/* interface IDSFResDescDevSpecific */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFResDescDevSpecific; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("914D27BF-0AB4-44c2-873D-84D163B39DD5") - IDSFResDescDevSpecific : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DataSize( - /* [retval][out] */ __RPC__out long *plDataSize) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DataSize( - /* [in] */ long lDataSize) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Reserved1( - /* [retval][out] */ __RPC__out long *plReserved1) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Reserved1( - /* [in] */ long lReserved1) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Reserved2( - /* [retval][out] */ __RPC__out long *plReserved2) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Reserved2( - /* [in] */ long lReserved2) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFResDescDevSpecificVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFResDescDevSpecific * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFResDescDevSpecific * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFResDescDevSpecific * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFResDescDevSpecific * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFResDescDevSpecific * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFResDescDevSpecific * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFResDescDevSpecific * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DataSize )( - __RPC__in IDSFResDescDevSpecific * This, - /* [retval][out] */ __RPC__out long *plDataSize); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DataSize )( - __RPC__in IDSFResDescDevSpecific * This, - /* [in] */ long lDataSize); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Reserved1 )( - __RPC__in IDSFResDescDevSpecific * This, - /* [retval][out] */ __RPC__out long *plReserved1); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Reserved1 )( - __RPC__in IDSFResDescDevSpecific * This, - /* [in] */ long lReserved1); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Reserved2 )( - __RPC__in IDSFResDescDevSpecific * This, - /* [retval][out] */ __RPC__out long *plReserved2); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Reserved2 )( - __RPC__in IDSFResDescDevSpecific * This, - /* [in] */ long lReserved2); - - END_INTERFACE - } IDSFResDescDevSpecificVtbl; - - interface IDSFResDescDevSpecific - { - CONST_VTBL struct IDSFResDescDevSpecificVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFResDescDevSpecific_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFResDescDevSpecific_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFResDescDevSpecific_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFResDescDevSpecific_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFResDescDevSpecific_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFResDescDevSpecific_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFResDescDevSpecific_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFResDescDevSpecific_get_DataSize(This,plDataSize) \ - ( (This)->lpVtbl -> get_DataSize(This,plDataSize) ) - -#define IDSFResDescDevSpecific_put_DataSize(This,lDataSize) \ - ( (This)->lpVtbl -> put_DataSize(This,lDataSize) ) - -#define IDSFResDescDevSpecific_get_Reserved1(This,plReserved1) \ - ( (This)->lpVtbl -> get_Reserved1(This,plReserved1) ) - -#define IDSFResDescDevSpecific_put_Reserved1(This,lReserved1) \ - ( (This)->lpVtbl -> put_Reserved1(This,lReserved1) ) - -#define IDSFResDescDevSpecific_get_Reserved2(This,plReserved2) \ - ( (This)->lpVtbl -> get_Reserved2(This,plReserved2) ) - -#define IDSFResDescDevSpecific_put_Reserved2(This,lReserved2) \ - ( (This)->lpVtbl -> put_Reserved2(This,lReserved2) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFResDescDevSpecific_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_DSFResDescDevSpecific; - -#ifdef __cplusplus - -class DECLSPEC_UUID("75679715-3926-4211-A5A6-6A333023D5BA") -DSFResDescDevSpecific; -#endif - -#ifndef __IDSFResDescDevPrivate_INTERFACE_DEFINED__ -#define __IDSFResDescDevPrivate_INTERFACE_DEFINED__ - -/* interface IDSFResDescDevPrivate */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFResDescDevPrivate; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C455E6E1-F93D-47bd-9042-95B7AB0A7D2B") - IDSFResDescDevPrivate : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Data0( - /* [retval][out] */ __RPC__out long *plData0) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Data0( - /* [in] */ long lData0) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Data1( - /* [retval][out] */ __RPC__out long *plData1) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Data1( - /* [in] */ long lData1) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Data2( - /* [retval][out] */ __RPC__out long *plData2) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Data2( - /* [in] */ long lData2) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFResDescDevPrivateVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFResDescDevPrivate * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFResDescDevPrivate * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFResDescDevPrivate * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFResDescDevPrivate * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFResDescDevPrivate * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFResDescDevPrivate * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFResDescDevPrivate * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Data0 )( - __RPC__in IDSFResDescDevPrivate * This, - /* [retval][out] */ __RPC__out long *plData0); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Data0 )( - __RPC__in IDSFResDescDevPrivate * This, - /* [in] */ long lData0); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Data1 )( - __RPC__in IDSFResDescDevPrivate * This, - /* [retval][out] */ __RPC__out long *plData1); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Data1 )( - __RPC__in IDSFResDescDevPrivate * This, - /* [in] */ long lData1); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Data2 )( - __RPC__in IDSFResDescDevPrivate * This, - /* [retval][out] */ __RPC__out long *plData2); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Data2 )( - __RPC__in IDSFResDescDevPrivate * This, - /* [in] */ long lData2); - - END_INTERFACE - } IDSFResDescDevPrivateVtbl; - - interface IDSFResDescDevPrivate - { - CONST_VTBL struct IDSFResDescDevPrivateVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFResDescDevPrivate_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFResDescDevPrivate_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFResDescDevPrivate_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFResDescDevPrivate_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFResDescDevPrivate_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFResDescDevPrivate_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFResDescDevPrivate_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFResDescDevPrivate_get_Data0(This,plData0) \ - ( (This)->lpVtbl -> get_Data0(This,plData0) ) - -#define IDSFResDescDevPrivate_put_Data0(This,lData0) \ - ( (This)->lpVtbl -> put_Data0(This,lData0) ) - -#define IDSFResDescDevPrivate_get_Data1(This,plData1) \ - ( (This)->lpVtbl -> get_Data1(This,plData1) ) - -#define IDSFResDescDevPrivate_put_Data1(This,lData1) \ - ( (This)->lpVtbl -> put_Data1(This,lData1) ) - -#define IDSFResDescDevPrivate_get_Data2(This,plData2) \ - ( (This)->lpVtbl -> get_Data2(This,plData2) ) - -#define IDSFResDescDevPrivate_put_Data2(This,lData2) \ - ( (This)->lpVtbl -> put_Data2(This,lData2) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFResDescDevPrivate_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_DSFResDescDevPrivate; - -#ifdef __cplusplus - -class DECLSPEC_UUID("F03EAE50-D772-4125-82E7-087B91ADF213") -DSFResDescDevPrivate; -#endif - -#ifndef __IDSFResDescInterrupt_INTERFACE_DEFINED__ -#define __IDSFResDescInterrupt_INTERFACE_DEFINED__ - -/* interface IDSFResDescInterrupt */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFResDescInterrupt; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("20F6EF07-E851-464A-B1BC-549B941682B0") - IDSFResDescInterrupt : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Level( - /* [retval][out] */ __RPC__out long *plLevel) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Level( - /* [in] */ long lLevel) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Vector( - /* [retval][out] */ __RPC__out long *plVector) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Vector( - /* [in] */ long lVector) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Affinity( - /* [retval][out] */ __RPC__out long *plAffinity) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Affinity( - /* [in] */ long lAffinity) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFResDescInterruptVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFResDescInterrupt * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFResDescInterrupt * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFResDescInterrupt * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFResDescInterrupt * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFResDescInterrupt * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFResDescInterrupt * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFResDescInterrupt * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Level )( - __RPC__in IDSFResDescInterrupt * This, - /* [retval][out] */ __RPC__out long *plLevel); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Level )( - __RPC__in IDSFResDescInterrupt * This, - /* [in] */ long lLevel); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Vector )( - __RPC__in IDSFResDescInterrupt * This, - /* [retval][out] */ __RPC__out long *plVector); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Vector )( - __RPC__in IDSFResDescInterrupt * This, - /* [in] */ long lVector); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Affinity )( - __RPC__in IDSFResDescInterrupt * This, - /* [retval][out] */ __RPC__out long *plAffinity); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Affinity )( - __RPC__in IDSFResDescInterrupt * This, - /* [in] */ long lAffinity); - - END_INTERFACE - } IDSFResDescInterruptVtbl; - - interface IDSFResDescInterrupt - { - CONST_VTBL struct IDSFResDescInterruptVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFResDescInterrupt_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFResDescInterrupt_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFResDescInterrupt_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFResDescInterrupt_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFResDescInterrupt_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFResDescInterrupt_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFResDescInterrupt_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFResDescInterrupt_get_Level(This,plLevel) \ - ( (This)->lpVtbl -> get_Level(This,plLevel) ) - -#define IDSFResDescInterrupt_put_Level(This,lLevel) \ - ( (This)->lpVtbl -> put_Level(This,lLevel) ) - -#define IDSFResDescInterrupt_get_Vector(This,plVector) \ - ( (This)->lpVtbl -> get_Vector(This,plVector) ) - -#define IDSFResDescInterrupt_put_Vector(This,lVector) \ - ( (This)->lpVtbl -> put_Vector(This,lVector) ) - -#define IDSFResDescInterrupt_get_Affinity(This,plAffinity) \ - ( (This)->lpVtbl -> get_Affinity(This,plAffinity) ) - -#define IDSFResDescInterrupt_put_Affinity(This,lAffinity) \ - ( (This)->lpVtbl -> put_Affinity(This,lAffinity) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFResDescInterrupt_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_DSFResDescInterrupt; - -#ifdef __cplusplus - -class DECLSPEC_UUID("B68DF23C-9DB6-4C0A-B927-94F0AFE080C4") -DSFResDescInterrupt; -#endif - -#ifndef __IDSFResDescMemory_INTERFACE_DEFINED__ -#define __IDSFResDescMemory_INTERFACE_DEFINED__ - -/* interface IDSFResDescMemory */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFResDescMemory; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("48ADC411-19EE-4E06-9772-882B487BB8C0") - IDSFResDescMemory : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_StartLow( - /* [retval][out] */ __RPC__out long *plStartLow) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_StartLow( - /* [in] */ long lStartLow) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_StartHigh( - /* [retval][out] */ __RPC__out long *plStartHigh) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_StartHigh( - /* [in] */ long lStartHigh) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Length( - /* [retval][out] */ __RPC__out long *plLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Length( - /* [in] */ long lLength) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFResDescMemoryVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFResDescMemory * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFResDescMemory * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFResDescMemory * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFResDescMemory * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFResDescMemory * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFResDescMemory * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFResDescMemory * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_StartLow )( - __RPC__in IDSFResDescMemory * This, - /* [retval][out] */ __RPC__out long *plStartLow); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_StartLow )( - __RPC__in IDSFResDescMemory * This, - /* [in] */ long lStartLow); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_StartHigh )( - __RPC__in IDSFResDescMemory * This, - /* [retval][out] */ __RPC__out long *plStartHigh); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_StartHigh )( - __RPC__in IDSFResDescMemory * This, - /* [in] */ long lStartHigh); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Length )( - __RPC__in IDSFResDescMemory * This, - /* [retval][out] */ __RPC__out long *plLength); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Length )( - __RPC__in IDSFResDescMemory * This, - /* [in] */ long lLength); - - END_INTERFACE - } IDSFResDescMemoryVtbl; - - interface IDSFResDescMemory - { - CONST_VTBL struct IDSFResDescMemoryVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFResDescMemory_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFResDescMemory_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFResDescMemory_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFResDescMemory_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFResDescMemory_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFResDescMemory_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFResDescMemory_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFResDescMemory_get_StartLow(This,plStartLow) \ - ( (This)->lpVtbl -> get_StartLow(This,plStartLow) ) - -#define IDSFResDescMemory_put_StartLow(This,lStartLow) \ - ( (This)->lpVtbl -> put_StartLow(This,lStartLow) ) - -#define IDSFResDescMemory_get_StartHigh(This,plStartHigh) \ - ( (This)->lpVtbl -> get_StartHigh(This,plStartHigh) ) - -#define IDSFResDescMemory_put_StartHigh(This,lStartHigh) \ - ( (This)->lpVtbl -> put_StartHigh(This,lStartHigh) ) - -#define IDSFResDescMemory_get_Length(This,plLength) \ - ( (This)->lpVtbl -> get_Length(This,plLength) ) - -#define IDSFResDescMemory_put_Length(This,lLength) \ - ( (This)->lpVtbl -> put_Length(This,lLength) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFResDescMemory_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_DSFResDescMemory; - -#ifdef __cplusplus - -class DECLSPEC_UUID("FDB94131-E0D2-41E7-A43F-72258F098281") -DSFResDescMemory; -#endif - -#ifndef __IDSFResDescDMA_INTERFACE_DEFINED__ -#define __IDSFResDescDMA_INTERFACE_DEFINED__ - -/* interface IDSFResDescDMA */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFResDescDMA; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9DA9B4D3-C73F-42B8-8CA2-0E5E3FF7198E") - IDSFResDescDMA : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Channel( - /* [retval][out] */ __RPC__out long *plChannel) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Channel( - /* [in] */ long lChannel) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Port( - /* [retval][out] */ __RPC__out long *plPort) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Port( - /* [in] */ long lPort) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Reserved( - /* [retval][out] */ __RPC__out long *plReserved) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Reserved( - /* [in] */ long lReserved) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFResDescDMAVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFResDescDMA * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFResDescDMA * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFResDescDMA * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFResDescDMA * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFResDescDMA * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFResDescDMA * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFResDescDMA * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Channel )( - __RPC__in IDSFResDescDMA * This, - /* [retval][out] */ __RPC__out long *plChannel); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Channel )( - __RPC__in IDSFResDescDMA * This, - /* [in] */ long lChannel); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Port )( - __RPC__in IDSFResDescDMA * This, - /* [retval][out] */ __RPC__out long *plPort); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Port )( - __RPC__in IDSFResDescDMA * This, - /* [in] */ long lPort); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Reserved )( - __RPC__in IDSFResDescDMA * This, - /* [retval][out] */ __RPC__out long *plReserved); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Reserved )( - __RPC__in IDSFResDescDMA * This, - /* [in] */ long lReserved); - - END_INTERFACE - } IDSFResDescDMAVtbl; - - interface IDSFResDescDMA - { - CONST_VTBL struct IDSFResDescDMAVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFResDescDMA_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFResDescDMA_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFResDescDMA_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFResDescDMA_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFResDescDMA_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFResDescDMA_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFResDescDMA_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFResDescDMA_get_Channel(This,plChannel) \ - ( (This)->lpVtbl -> get_Channel(This,plChannel) ) - -#define IDSFResDescDMA_put_Channel(This,lChannel) \ - ( (This)->lpVtbl -> put_Channel(This,lChannel) ) - -#define IDSFResDescDMA_get_Port(This,plPort) \ - ( (This)->lpVtbl -> get_Port(This,plPort) ) - -#define IDSFResDescDMA_put_Port(This,lPort) \ - ( (This)->lpVtbl -> put_Port(This,lPort) ) - -#define IDSFResDescDMA_get_Reserved(This,plReserved) \ - ( (This)->lpVtbl -> get_Reserved(This,plReserved) ) - -#define IDSFResDescDMA_put_Reserved(This,lReserved) \ - ( (This)->lpVtbl -> put_Reserved(This,lReserved) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFResDescDMA_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_DSFResDescDMA; - -#ifdef __cplusplus - -class DECLSPEC_UUID("449D593F-EFE0-414E-A5D8-2333B223090E") -DSFResDescDMA; -#endif - -#ifndef __IDSFSystemDevice_INTERFACE_DEFINED__ -#define __IDSFSystemDevice_INTERFACE_DEFINED__ - -/* interface IDSFSystemDevice */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_IDSFSystemDevice; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("8041F860-55E4-4709-A96C-FA51EBC8F895") - IDSFSystemDevice : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Address( - /* [retval][out] */ __RPC__out long *plAddress) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Address( - /* [in] */ long lAddress) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_BusNumber( - /* [retval][out] */ __RPC__out long *plBusNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_BusNumber( - /* [in] */ long lBusNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_BusTypeGUID( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrGUID) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_BusTypeGUID( - /* [in] */ __RPC__in BSTR bstrGUID) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Capabilities( - /* [retval][out] */ __RPC__deref_out_opt DSFDeviceCaps **ppDSFDeviceCaps) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Capabilities( - /* [in] */ __RPC__in DSFDeviceCaps *pDSFDeviceCaps) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT __stdcall putref_Capabilities( - /* [in] */ __RPC__in DSFDeviceCaps *pDSFDeviceCaps) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_ClassGUID( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrGUID) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_ClassGUID( - /* [in] */ __RPC__in BSTR bstrGUID) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_ClassName( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_ClassName( - /* [in] */ __RPC__in BSTR bstrName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_CompatibleIDs( - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaIDs) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_CompatibleIDs( - /* [in] */ __RPC__in SAFEARRAY * psaIDs) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceDescription( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrDescription) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceDescription( - /* [in] */ __RPC__in BSTR bstrDescription) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceID( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrID) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceID( - /* [in] */ __RPC__in BSTR bstrID) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DriverKeyName( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrKeyName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DriverKeyName( - /* [in] */ __RPC__in BSTR bstrKeyName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_EnumeratorName( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_EnumeratorName( - /* [in] */ __RPC__in BSTR bstrName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_FriendlyName( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_FriendlyName( - /* [in] */ __RPC__in BSTR bstrName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_HardwareIDs( - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaIDs) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_HardwareIDs( - /* [in] */ __RPC__in SAFEARRAY * psaIDs) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_InstanceID( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrID) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_InstanceID( - /* [in] */ __RPC__in BSTR bstrID) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_LegacyBusType( - /* [retval][out] */ __RPC__out DSFInterfaceType *pBusType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_LegacyBusType( - /* [in] */ DSFInterfaceType BusType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_LocationInfo( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrInfo) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_LocationInfo( - /* [in] */ __RPC__in BSTR bstrInfo) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Manufacturer( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Manufacturer( - /* [in] */ __RPC__in BSTR bstrName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_PDOName( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrPDOName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_PDOName( - /* [in] */ __RPC__in BSTR bstrPDOName) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_RawResources( - /* [retval][out] */ __RPC__deref_out_opt DSFResourceList **ppDSFResourceList) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_RawResources( - /* [in] */ __RPC__in DSFResourceList *pDSFResourceList) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT __stdcall putref_RawResources( - /* [in] */ __RPC__in DSFResourceList *pDSFResourceList) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_UINumber( - /* [retval][out] */ __RPC__out long *plNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_UINumber( - /* [in] */ long lNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_XlatedResources( - /* [retval][out] */ __RPC__deref_out_opt DSFResourceList **ppDSFResourceList) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_XlatedResources( - /* [in] */ __RPC__in DSFResourceList *pDSFResourceList) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT __stdcall putref_XlatedResources( - /* [in] */ __RPC__in DSFResourceList *pDSFResourceList) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFSystemDeviceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFSystemDevice * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFSystemDevice * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDSFSystemDevice * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDSFSystemDevice * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Address )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__out long *plAddress); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Address )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ long lAddress); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_BusNumber )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__out long *plBusNumber); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_BusNumber )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ long lBusNumber); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_BusTypeGUID )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrGUID); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_BusTypeGUID )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in BSTR bstrGUID); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Capabilities )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt DSFDeviceCaps **ppDSFDeviceCaps); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Capabilities )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in DSFDeviceCaps *pDSFDeviceCaps); - - /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT ( __stdcall *putref_Capabilities )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in DSFDeviceCaps *pDSFDeviceCaps); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_ClassGUID )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrGUID); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_ClassGUID )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in BSTR bstrGUID); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_ClassName )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrName); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_ClassName )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in BSTR bstrName); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_CompatibleIDs )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaIDs); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_CompatibleIDs )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in SAFEARRAY * psaIDs); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceDescription )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrDescription); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceDescription )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in BSTR bstrDescription); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceID )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrID); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceID )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in BSTR bstrID); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DriverKeyName )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrKeyName); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DriverKeyName )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in BSTR bstrKeyName); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_EnumeratorName )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrName); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_EnumeratorName )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in BSTR bstrName); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_FriendlyName )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrName); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_FriendlyName )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in BSTR bstrName); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_HardwareIDs )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaIDs); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_HardwareIDs )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in SAFEARRAY * psaIDs); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_InstanceID )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrID); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_InstanceID )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in BSTR bstrID); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_LegacyBusType )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__out DSFInterfaceType *pBusType); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_LegacyBusType )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ DSFInterfaceType BusType); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_LocationInfo )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrInfo); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_LocationInfo )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in BSTR bstrInfo); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Manufacturer )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrName); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Manufacturer )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in BSTR bstrName); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_PDOName )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrPDOName); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_PDOName )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in BSTR bstrPDOName); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_RawResources )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt DSFResourceList **ppDSFResourceList); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_RawResources )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in DSFResourceList *pDSFResourceList); - - /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT ( __stdcall *putref_RawResources )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in DSFResourceList *pDSFResourceList); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_UINumber )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__out long *plNumber); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_UINumber )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ long lNumber); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_XlatedResources )( - __RPC__in IDSFSystemDevice * This, - /* [retval][out] */ __RPC__deref_out_opt DSFResourceList **ppDSFResourceList); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_XlatedResources )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in DSFResourceList *pDSFResourceList); - - /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT ( __stdcall *putref_XlatedResources )( - __RPC__in IDSFSystemDevice * This, - /* [in] */ __RPC__in DSFResourceList *pDSFResourceList); - - END_INTERFACE - } IDSFSystemDeviceVtbl; - - interface IDSFSystemDevice - { - CONST_VTBL struct IDSFSystemDeviceVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFSystemDevice_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFSystemDevice_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFSystemDevice_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFSystemDevice_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDSFSystemDevice_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDSFSystemDevice_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDSFSystemDevice_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDSFSystemDevice_get_Address(This,plAddress) \ - ( (This)->lpVtbl -> get_Address(This,plAddress) ) - -#define IDSFSystemDevice_put_Address(This,lAddress) \ - ( (This)->lpVtbl -> put_Address(This,lAddress) ) - -#define IDSFSystemDevice_get_BusNumber(This,plBusNumber) \ - ( (This)->lpVtbl -> get_BusNumber(This,plBusNumber) ) - -#define IDSFSystemDevice_put_BusNumber(This,lBusNumber) \ - ( (This)->lpVtbl -> put_BusNumber(This,lBusNumber) ) - -#define IDSFSystemDevice_get_BusTypeGUID(This,pbstrGUID) \ - ( (This)->lpVtbl -> get_BusTypeGUID(This,pbstrGUID) ) - -#define IDSFSystemDevice_put_BusTypeGUID(This,bstrGUID) \ - ( (This)->lpVtbl -> put_BusTypeGUID(This,bstrGUID) ) - -#define IDSFSystemDevice_get_Capabilities(This,ppDSFDeviceCaps) \ - ( (This)->lpVtbl -> get_Capabilities(This,ppDSFDeviceCaps) ) - -#define IDSFSystemDevice_put_Capabilities(This,pDSFDeviceCaps) \ - ( (This)->lpVtbl -> put_Capabilities(This,pDSFDeviceCaps) ) - -#define IDSFSystemDevice_putref_Capabilities(This,pDSFDeviceCaps) \ - ( (This)->lpVtbl -> putref_Capabilities(This,pDSFDeviceCaps) ) - -#define IDSFSystemDevice_get_ClassGUID(This,pbstrGUID) \ - ( (This)->lpVtbl -> get_ClassGUID(This,pbstrGUID) ) - -#define IDSFSystemDevice_put_ClassGUID(This,bstrGUID) \ - ( (This)->lpVtbl -> put_ClassGUID(This,bstrGUID) ) - -#define IDSFSystemDevice_get_ClassName(This,pbstrName) \ - ( (This)->lpVtbl -> get_ClassName(This,pbstrName) ) - -#define IDSFSystemDevice_put_ClassName(This,bstrName) \ - ( (This)->lpVtbl -> put_ClassName(This,bstrName) ) - -#define IDSFSystemDevice_get_CompatibleIDs(This,ppsaIDs) \ - ( (This)->lpVtbl -> get_CompatibleIDs(This,ppsaIDs) ) - -#define IDSFSystemDevice_put_CompatibleIDs(This,psaIDs) \ - ( (This)->lpVtbl -> put_CompatibleIDs(This,psaIDs) ) - -#define IDSFSystemDevice_get_DeviceDescription(This,pbstrDescription) \ - ( (This)->lpVtbl -> get_DeviceDescription(This,pbstrDescription) ) - -#define IDSFSystemDevice_put_DeviceDescription(This,bstrDescription) \ - ( (This)->lpVtbl -> put_DeviceDescription(This,bstrDescription) ) - -#define IDSFSystemDevice_get_DeviceID(This,pbstrID) \ - ( (This)->lpVtbl -> get_DeviceID(This,pbstrID) ) - -#define IDSFSystemDevice_put_DeviceID(This,bstrID) \ - ( (This)->lpVtbl -> put_DeviceID(This,bstrID) ) - -#define IDSFSystemDevice_get_DriverKeyName(This,pbstrKeyName) \ - ( (This)->lpVtbl -> get_DriverKeyName(This,pbstrKeyName) ) - -#define IDSFSystemDevice_put_DriverKeyName(This,bstrKeyName) \ - ( (This)->lpVtbl -> put_DriverKeyName(This,bstrKeyName) ) - -#define IDSFSystemDevice_get_EnumeratorName(This,pbstrName) \ - ( (This)->lpVtbl -> get_EnumeratorName(This,pbstrName) ) - -#define IDSFSystemDevice_put_EnumeratorName(This,bstrName) \ - ( (This)->lpVtbl -> put_EnumeratorName(This,bstrName) ) - -#define IDSFSystemDevice_get_FriendlyName(This,pbstrName) \ - ( (This)->lpVtbl -> get_FriendlyName(This,pbstrName) ) - -#define IDSFSystemDevice_put_FriendlyName(This,bstrName) \ - ( (This)->lpVtbl -> put_FriendlyName(This,bstrName) ) - -#define IDSFSystemDevice_get_HardwareIDs(This,ppsaIDs) \ - ( (This)->lpVtbl -> get_HardwareIDs(This,ppsaIDs) ) - -#define IDSFSystemDevice_put_HardwareIDs(This,psaIDs) \ - ( (This)->lpVtbl -> put_HardwareIDs(This,psaIDs) ) - -#define IDSFSystemDevice_get_InstanceID(This,pbstrID) \ - ( (This)->lpVtbl -> get_InstanceID(This,pbstrID) ) - -#define IDSFSystemDevice_put_InstanceID(This,bstrID) \ - ( (This)->lpVtbl -> put_InstanceID(This,bstrID) ) - -#define IDSFSystemDevice_get_LegacyBusType(This,pBusType) \ - ( (This)->lpVtbl -> get_LegacyBusType(This,pBusType) ) - -#define IDSFSystemDevice_put_LegacyBusType(This,BusType) \ - ( (This)->lpVtbl -> put_LegacyBusType(This,BusType) ) - -#define IDSFSystemDevice_get_LocationInfo(This,pbstrInfo) \ - ( (This)->lpVtbl -> get_LocationInfo(This,pbstrInfo) ) - -#define IDSFSystemDevice_put_LocationInfo(This,bstrInfo) \ - ( (This)->lpVtbl -> put_LocationInfo(This,bstrInfo) ) - -#define IDSFSystemDevice_get_Manufacturer(This,pbstrName) \ - ( (This)->lpVtbl -> get_Manufacturer(This,pbstrName) ) - -#define IDSFSystemDevice_put_Manufacturer(This,bstrName) \ - ( (This)->lpVtbl -> put_Manufacturer(This,bstrName) ) - -#define IDSFSystemDevice_get_PDOName(This,pbstrPDOName) \ - ( (This)->lpVtbl -> get_PDOName(This,pbstrPDOName) ) - -#define IDSFSystemDevice_put_PDOName(This,bstrPDOName) \ - ( (This)->lpVtbl -> put_PDOName(This,bstrPDOName) ) - -#define IDSFSystemDevice_get_RawResources(This,ppDSFResourceList) \ - ( (This)->lpVtbl -> get_RawResources(This,ppDSFResourceList) ) - -#define IDSFSystemDevice_put_RawResources(This,pDSFResourceList) \ - ( (This)->lpVtbl -> put_RawResources(This,pDSFResourceList) ) - -#define IDSFSystemDevice_putref_RawResources(This,pDSFResourceList) \ - ( (This)->lpVtbl -> putref_RawResources(This,pDSFResourceList) ) - -#define IDSFSystemDevice_get_UINumber(This,plNumber) \ - ( (This)->lpVtbl -> get_UINumber(This,plNumber) ) - -#define IDSFSystemDevice_put_UINumber(This,lNumber) \ - ( (This)->lpVtbl -> put_UINumber(This,lNumber) ) - -#define IDSFSystemDevice_get_XlatedResources(This,ppDSFResourceList) \ - ( (This)->lpVtbl -> get_XlatedResources(This,ppDSFResourceList) ) - -#define IDSFSystemDevice_put_XlatedResources(This,pDSFResourceList) \ - ( (This)->lpVtbl -> put_XlatedResources(This,pDSFResourceList) ) - -#define IDSFSystemDevice_putref_XlatedResources(This,pDSFResourceList) \ - ( (This)->lpVtbl -> putref_XlatedResources(This,pDSFResourceList) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFSystemDevice_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_DSFSystemDevice; - -#ifdef __cplusplus - -class DECLSPEC_UUID("1AE675C7-9C3D-429c-94C9-137A00246470") -DSFSystemDevice; -#endif - -EXTERN_C const CLSID CLSID_DSFDevice; - -#ifdef __cplusplus - -class DECLSPEC_UUID("8B6626F7-F57B-4C47-AE2F-4813FB4D40D6") -DSFDevice; -#endif - -EXTERN_C const CLSID CLSID_DSF; - -#ifdef __cplusplus - -class DECLSPEC_UUID("44DD6DC0-6427-4C02-8D5C-1179C50C65D7") -DSF; -#endif - -EXTERN_C const CLSID CLSID_DSFDevices; - -#ifdef __cplusplus - -class DECLSPEC_UUID("60FA4E76-ED77-4458-ABCF-56E23113FE61") -DSFDevices; -#endif - -EXTERN_C const CLSID CLSID_DSFDeviceCaps; - -#ifdef __cplusplus - -class DECLSPEC_UUID("26FF1048-7125-45F8-ACA8-F13C5E883ED1") -DSFDeviceCaps; -#endif - -EXTERN_C const CLSID CLSID_DSFLog; - -#ifdef __cplusplus - -class DECLSPEC_UUID("A880A214-56A0-426A-844A-7AACCF7C3641") -DSFLog; -#endif - -EXTERN_C const CLSID CLSID_DSFVersion; - -#ifdef __cplusplus - -class DECLSPEC_UUID("9B89C450-8E7C-4B02-B4A0-B581A9999B47") -DSFVersion; -#endif - -EXTERN_C const CLSID CLSID_DSFPropertyBag; - -#ifdef __cplusplus - -class DECLSPEC_UUID("c283c5ec-4ba5-46ec-9efc-e9f1bffe7c70") -DSFPropertyBag; -#endif - -#ifndef __IDSFDebug_INTERFACE_DEFINED__ -#define __IDSFDebug_INTERFACE_DEFINED__ - -/* interface IDSFDebug */ -/* [object][helpstringcontext][helpcontext][helpstring][uuid] */ - - -EXTERN_C const IID IID_IDSFDebug; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("69b999b5-1f70-418b-83ac-900a289a07f9") - IDSFDebug : public IUnknown - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring] */ HRESULT __stdcall SetObjectFlags( - /* [in] */ DSFFlagType FlagType, - /* [in] */ unsigned long Flags) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFDebugVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFDebug * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFDebug * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFDebug * This); - - /* [helpstringcontext][helpcontext][helpstring] */ HRESULT ( __stdcall *SetObjectFlags )( - __RPC__in IDSFDebug * This, - /* [in] */ DSFFlagType FlagType, - /* [in] */ unsigned long Flags); - - END_INTERFACE - } IDSFDebugVtbl; - - interface IDSFDebug - { - CONST_VTBL struct IDSFDebugVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFDebug_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFDebug_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFDebug_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFDebug_SetObjectFlags(This,FlagType,Flags) \ - ( (This)->lpVtbl -> SetObjectFlags(This,FlagType,Flags) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFDebug_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_DSFDebug; - -#ifdef __cplusplus - -class DECLSPEC_UUID("f6d08a7f-ef55-406b-be39-2fe6f613ef3d") -DSFDebug; -#endif - -EXTERN_C const CLSID CLSID_DSFBus; - -#ifdef __cplusplus - -class DECLSPEC_UUID("0DEF0513-18CE-4AA4-8C7C-70D37206B4F7") -DSFBus; -#endif - -#ifndef __IDSFPersist_INTERFACE_DEFINED__ -#define __IDSFPersist_INTERFACE_DEFINED__ - -/* interface IDSFPersist */ -/* [object][helpstringcontext][helpcontext][helpstring][uuid] */ - - -EXTERN_C const IID IID_IDSFPersist; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("66CBAEEA-2F16-4685-AC93-71CC713E6A6A") - IDSFPersist : public IUnknown - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring] */ HRESULT __stdcall get_DSFDevice( - /* [retval][out] */ __RPC__deref_out_opt IDSFDevice **ppiDSFDevice) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDSFPersistVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDSFPersist * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDSFPersist * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDSFPersist * This); - - /* [helpstringcontext][helpcontext][helpstring] */ HRESULT ( __stdcall *get_DSFDevice )( - __RPC__in IDSFPersist * This, - /* [retval][out] */ __RPC__deref_out_opt IDSFDevice **ppiDSFDevice); - - END_INTERFACE - } IDSFPersistVtbl; - - interface IDSFPersist - { - CONST_VTBL struct IDSFPersistVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDSFPersist_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDSFPersist_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDSFPersist_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDSFPersist_get_DSFDevice(This,ppiDSFDevice) \ - ( (This)->lpVtbl -> get_DSFDevice(This,ppiDSFDevice) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDSFPersist_INTERFACE_DEFINED__ */ - -#endif /* __DSF_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/dsm.h b/pub/ddk/dsm.h deleted file mode 100644 index 29ee8e2..0000000 --- a/pub/ddk/dsm.h +++ /dev/null @@ -1,1612 +0,0 @@ -/*++ - -Copyright (c) 1999 - 2001 Microsoft Corporation - -Module Name: - - dsm.h - -Abstract: - - This file defines the interface between Multipath Device-Specific drivers and the - Main Multipath driver. - -Author: - -Notes: - -Revision History: - ---*/ - -#ifndef _DSM_H_ -#define _DSM_H_ - -#include -#include -#include -#include -#include -#include -#include - -#pragma warning(disable:4201) // bit field types - -// -// List of DSM Identifiers passed to several -// of the dsm entry-points. -// -typedef struct _DSM_IDS { - - // - // Number of ID's in the List. - // - ULONG Count; - - // - // Array of DsmIdentiifiers - // - PVOID IdList[1]; -} DSM_IDS, *PDSM_IDS; - -#if (NTDDI_VERSION >= NTDDI_WS08) // For Server 2008 and later. -// -// Structures for SCSI pass through and SCSI pass through direct. -// -// IA64 requires 8-byte alignment for pointers, -// but the IA64 NT kernel expects 16-byte alignment -// -#ifdef _WIN64 - #define PTRALIGN DECLSPEC_ALIGN(16) -#else - #define PTRALIGN DECLSPEC_ALIGN(4) -#endif - -#define SPTWB_SENSE_LENGTH 32 -#define SPTWB_DATA_LENGTH 512 - -typedef struct _SCSI_PASS_THROUGH_WITH_BUFFERS { - SCSI_PASS_THROUGH ScsiPassThrough; - PTRALIGN UCHAR SenseInfoBuffer[SPTWB_SENSE_LENGTH]; - PTRALIGN UCHAR DataBuffer[SPTWB_DATA_LENGTH]; -} SCSI_PASS_THROUGH_WITH_BUFFERS, *PSCSI_PASS_THROUGH_WITH_BUFFERS; - -typedef struct _SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER { - SCSI_PASS_THROUGH_DIRECT ScsiPassThroughDirect; - PTRALIGN UCHAR SenseInfoBuffer[SPTWB_SENSE_LENGTH]; -} SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, *PSCSI_PASS_THROUGH_DIRECT_WITH_BUFFER; - -#endif // (NTDDI_VERSION >= NTDDI_WS08) - -// -// Identification and initialization routines (other than DSM registration with MPCTL.sys) -// -typedef -NTSTATUS -(*DSM_INQUIRE_DRIVER) ( - __in IN PVOID DsmContext, - __in IN PDEVICE_OBJECT TargetDevice, - __in IN PDEVICE_OBJECT PortFdo, - __in IN PSTORAGE_DEVICE_DESCRIPTOR Descriptor, - __in IN PSTORAGE_DEVICE_ID_DESCRIPTOR DeviceIdList, - __out OUT PVOID *DsmIdentifier - ); -/*++ - -Routine Description: - - This routine is used to determine if TargetDevice belongs to the DSM. - If the device is owned by the driver, then DsmIdentifier will be updated with a - DSM-derived value. - -Arguments: - - DsmContext - Context value given to the multipath driver during registration. - TargetDevice - DeviceObject for the child device. - PortFdo - The Port driver FDO on which TargetDevice resides. - Descriptor - Pointer the device descriptor corresponding to TargetDevice. Rehash of inquiry - data, plus serial number information (if applicable). - DeviceIdList - VPD Page 0x83 information. - DsmIdentifier - Pointer to be filled in by the DSM on success. - -Return Value: - - STATUS_SUCCESS and a DsmIdentifier if the DSM supports this device. - Otherwise a NULL Identifier and the appropriate NTSTATUS value (SUCCESS or other). - ---*/ - -typedef -BOOLEAN -(*DSM_COMPARE_DEVICES) ( - __in IN PVOID DsmContext, - __in IN PVOID DsmId1, - __in IN PVOID DsmId2 - ); -/*++ - -Routine Description: - - This routine is called to determine if the device ids represent the same underlying - physical device. - Additional ids (more than 2) can be tested by repeatedly calling this function. - It is the DSM responsibility to keep the necessary information to identify the device(s). - -Arguments: - - DsmContext - Context value given to the multipath driver during registration. - DsmId1/2 - Identifers returned from DMS_INQUIRE_DRIVER. - -Return Value: - - TRUE if DsmIds correspond to the same underlying device. - ---*/ - -// -// This controller is active. -// -#define DSM_CONTROLLER_ACTIVE 0x00000001 -// -// This controller is a stand-by controller. -// -#define DSM_CONTROLLER_STANDBY 0x00000002 -// -// This controller has failed. -// -#define DSM_CONTROLLER_FAILED 0x00000003 -// -// There are no controllers (JBOD, for example) -// -#define DSM_CONTROLLER_NO_CNTRL 0x00000004 - -typedef struct _CONTROLLER_IDS { - - // - // Defined in ntddstor.h - // - STORAGE_IDENTIFIER_CODE_SET Type; - - // - // Length, in bytes, or the 'Serial Number'. - // - ULONG Length; - UCHAR SerialNumber[32]; -} CONTROLLER_IDS, *PCONTROLLER_IDS; - -typedef struct _CONTROLLER_INFO { - // - // The device object of the controller. - // Retrieved by DsmGetAssociatedDevices. - // - PDEVICE_OBJECT DeviceObject; - - // - // Ascii/Binary identifier. WWN, for example. - // - CONTROLLER_IDS Identifier; - - // - // Controller state. See above. - // - ULONG State; -} CONTROLLER_INFO, *PCONTROLLER_INFO; - -// -// Informs the DSM that ControllerInfo must be allocated. -// -#define DSM_CNTRL_FLAGS_ALLOCATE 0x00000001 - -// -// ControllerInfo is valid. The DSM should update 'State'. -// -#define DSM_CNTRL_FLAGS_CHECK_STATE 0x00000002 - -// -// Possible future expansion. -// -#define DSM_CNTRL_FLAGS_RESERVED 0xFFFFFFFC - -typedef -NTSTATUS -(*DSM_GET_CONTROLLER_INFO) ( - __in IN PVOID DsmContext, - __in IN PVOID DsmId, - __in IN ULONG Flags, - __inout IN OUT PCONTROLLER_INFO *ControllerInfo - ); -/*++ - -Routine Description: - - This routine is used to get information about the controller that the device - corresponding to DsmId in on. - The Dsm shall allocate the necessary memory for the buffer (mpio has the responsibility - to free it) and fill in the information. - If the DSM controls hardware that uses no controllers, set State to NO_CNTRL. - This information is used mainly by whatever WMI admin. utilities want if. - - This routine will be called initially after SetDeviceInfo, but also to retrieve - the controller's state when an WMI request is received, after a fail-over/fail-back, etc. - -Arguments: - - DsmContext - Context value given to the multipath driver during registration. - DsmId - Identifer returned from DMS_INQUIRE_DRIVER. - Flags - Bitfield of modifiers. If ALLOCATE is not set, ControllerInfo will have - a valid buffer for the DSM to operate on. - ControllerInfo - Pointer for the DSM to place the allocated controller info - pertaining to DsmId - - -Return Value: - - NTSTATUS - ---*/ - - -typedef -PUCHAR -(*DSM_DEVICE_SERIAL_NUMBER) ( - __in IN PVOID DsmContext, - __in IN PVOID DsmId - ); -/*++ - -Routine Description: - - This OPTIONAL routine is used to retrieve a serial number for the device represented - by DsmId. It is only called when the device doesn't support VPD pages 0x80 or 0x83. - The buffer returned should be a null-terminated ascii string. MPIO is responsible for - freeing this buffer and the DSM should not assume it's valid anytime after returning. - -Arguments: - - DsmContext - Context value given to the multipath driver during registration. - DsmId - Value returned from DMSInquireDriver. - -Return Value: - - Serial number string. - ---*/ - -typedef -NTSTATUS -(*DSM_SET_DEVICE_INFO) ( - __in IN PVOID DsmContext, - __in IN PDEVICE_OBJECT TargetObject, - __in IN PVOID DsmId, - __inout IN OUT PVOID *PathId - ); -/*++ - -Routine Description: - - This routine associates a returned DsmId to the controlling MPDisk PDO - the targetObject for DSM-initiated requests, and to a Path (given by PathId). - The Path ID is a unique per-path value and will be the same value for ALL devices that - are on the same physical path. - -Arguments: - - DsmContext - Context value given to the multipath driver during registration. - TargetObject - The D.O. to which DSM-initiated requests should be sent. - This is the Filter D.O. over the port PDO. - DsmId - Value returned from DMSInquireDriver. - PathId - Id that represents the path. The value passed in may be used as is, or the DSM - optionally can update it if it requires additional state info to be kept. - - -Return Value: - - DSM should return SUCCESS. Other errors may be returned in event of failed - allocations, etc. These other errors are fatal. - ---*/ - -typedef -BOOLEAN -(*DSM_IS_PATH_ACTIVE) ( - __in IN PVOID DsmContext, - __in IN PVOID PathId, - __in IN PVOID DsmId - ); -/*++ - -Routine Description: - - This routine is used to determine whether the path to DsmId is active - (ie. able to handle requests without a failover). - NOTE: This is used by the main module to determine load balance groups. If multiple - paths are active to the same device then it is considered that requests can be - submitted freely to ALL active paths, though the DSM is the determinator for path - selection. - - In addition, after a failover, the path validity will be queried. If the path error - was transitory and the DSM feels that the path is good, then this request will be - re-issued to determine it's ACTIVE/PASSIVE state. - -Arguments: - - DsmContext - Context value given to the multipath driver during registration. - PathId - Value set in SetDeviceInfo - DsmId - Device Identifier returned from DsmInquire. - -Return Value: - - TRUE - if path is active. Otherwise, FALSE. - ---*/ - - - -// -// Error Handling, Failover and recovery routines. -// -// When a fatal error occurs, the Path is invalidated and a new one -// selected. -// After the fail-over is complete, mpctl will invoke the DSM's Recovery routine -// (if one is specified). Once the error has been dealt with, the DSM should notify -// mpctl of the success of the operation. -// PathVerify will be called with each DsmId that was on the path. -// If this is successful, ReenablePath is invoked to allow the DSM any final preperations -// before considering the path normal. -// IsActive is called to build the load-balance associations. -// -#define DSM_FATAL_ERROR 0x80000000 -#define DSM_RETRY_DONT_DECREMENT 0x00008000 -#define DSM_ADMIN_FO 0x40000000 -#define DSM_FATAL_ERROR_OEM_MASK 0x0000FFFF -#define DSM_FATAL_ERROR_RESERVED 0x3FFF0000 - -typedef -ULONG -(*DSM_INTERPRET_ERROR) ( - __in IN PVOID DsmContext, - __in IN PVOID DsmId, - __in IN PSCSI_REQUEST_BLOCK Srb, - __inout IN OUT PNTSTATUS Status, - __out OUT PBOOLEAN Retry - ); -/*++ - -Routine Description: - - This routine informs the DSM that Srb has an error indicated with Srb->SrbStatus and/or Status. - IF Srb->SrbFlags & SRB_FLAGS_AUTOSENSE_VALID is set, sense data will be available. - - The DSM should examine these, carry out any vendor-unique activities and update Retry and Status - (if applicable). A determination should be made whether these errors constitute a fail over. - Setting the high-bit of the return value indicates a fatal error. The DSM may additionally - set any of the bits in the lower USHORT to facilitate information passing between this and - the InvalidatePath routine. - The Multipath driver (mpctl) will not override these return values. - -Arguments: - - DsmId - Identifers returned from DMS_INQUIRE_DRIVER. - Srb - The Srb with an error. - Status - NTSTATUS of the operation. Can be updated. - Retry - Allows the DSM to indicate whether to retry the IO. - -Return Value: - - Setting DSM_FATAL_ERROR indicates a fatal error. DSM-specific info. can be kept in - the lower WORD, which will be passed to InvalidatePath. - ---*/ - -typedef -ULONG -(*DSM_INTERPRET_ERROR_EX) ( - __in IN PVOID DsmContext, - __in IN PVOID DsmId, - __in IN PSCSI_REQUEST_BLOCK Srb, - __inout IN OUT PNTSTATUS Status, - __out OUT PBOOLEAN Retry, - __out OUT PLONG RetryInterval, - ... - ); -/*++ - -Routine Description: - - This routine informs the DSM that Srb has an error indicated with Srb->SrbStatus and/or Status. - IF Srb->SrbFlags & SRB_FLAGS_AUTOSENSE_VALID is set, sense data will be available. - - The DSM should examine these, carry out any vendor-unique activities and update Retry and Status - (if applicable). A determination should be made whether these errors constitute a fail over. - Setting the high-bit of the return value indicates a fatal error. The DSM may additionally - set any of the bits in the lower USHORT to facilitate information passing between this and - the InvalidatePath routine. - The Multipath driver (mpctl) will not override these return values. - -Arguments: - - DsmId - Identifers returned from DMS_INQUIRE_DRIVER. - Srb - The Srb with an error. - Status - NTSTATUS of the operation. Can be updated. - Retry - Allows the DSM to indicate whether to retry the IO. - RetryInterval - Lets DSM specify (in seconds) when this specific I/O should be - retried. Use MAXLONG to use the default retry interval. - Use zero to retry immediately. MPIO will set to MAXLONG - before calling the DSM. - -Return Value: - - Setting DSM_FATAL_ERROR indicates a fatal error. DSM-specific info. can be kept in - the lower WORD, which will be passed to InvalidatePath. - ---*/ - - -typedef -NTSTATUS -(*DSM_INVALIDATE_PATH) ( - __in IN PVOID DsmContext, - __in IN ULONG ErrorMask, - __in IN PVOID PathId, - __inout IN OUT PVOID *NewPathId - ); -/*++ - -Routine Description: - - This routine invalidates the given path and assigns the devices to the new path. - NewPath is set to either an existing path or if all paths are dead, NULL. - -Arguments: - - DsmContext - Context value given to the multipath driver during registration. - ErrorMask - Value returned from InterpretError. - PathId - The failing path. - NewPathId - Pointer to the new path. - -Return Value: - - NTSTATUS of the operation. - ---*/ - -typedef -NTSTATUS -(*DSM_PATH_VERIFY) ( - __in IN PVOID DsmContext, - __in IN PVOID DsmId, - __in IN PVOID PathId - ); -/*++ - -Routine Description: - - This routine is polled at a configurable interval and is used to determine the - health of the device indicated by DsmId on PathId. The DSM makes the determination of - validity using supplied library functions, or by issuing vendor-unique commands. - - After a fail-over condition has been dealt with, this is used as part of the fail-back - mechanism. - -Arguments: - - DsmContext - Context value given to the multipath driver during registration. - DsmId - Value returned from DMSInquireDriver. - PathId - Value set in SetPathId. - -Return Value: - - NTSTATUS ---*/ - - -// -// PERMANENT indicates that SuggestedPath should be the device's preferred path. -// PENDING_REMOVAL indicates that the path is about to go away. -// OEM_MASK values specific to the DSM -// RESERVED future expansion -// ADMIN_REQUEST indicates that the request originated from some user-mode utility. -// -#define DSM_MOVE_PERMANENT 0x00000001 -#define DSM_MOVE_PENDING_REMOVAL 0x00000002 -#define DSM_MOVE_OEM_MASK 0x0000FF00 -#define DSM_MOVE_RESERVED 0x7FFF0000 -#define DSM_MOVE_ADMIN_REQUEST 0x80000000 - -typedef -NTSTATUS -(*DSM_MOVE_DEVICE) ( - __in IN PVOID DsmContext, - __in IN PDSM_IDS DsmIds, - __in IN PVOID MPIOPath, - __in IN PVOID SuggestedPath, - __in IN ULONG Flags - ); -/*++ - -Routine Description: - - This routine is invoked (usually) in response to an administrative request. - The DSM will associate the Device described by DsmId to the SuggestedPath, or may - select another available. As this request will usually be followed by an adapter - removal, or can be used to set-up static load-balancing. - -Arguments: - - DsmContext - Context value given to the multipath driver during registration. - DsmIds - The collection of DSM IDs that pertain to the MPDisk. - MPIOPath - The original path value passed to SetDeviceInfo. - SuggestedPath - The path which should become the active path. - Flags - Bitmask indicating the intent of the move. - -Return Value: - - NTSTATUS - STATUS_SUCCESS, some error status if there are no good alternate paths. - ---*/ - -typedef -NTSTATUS -(*DSM_REMOVE_PENDING) ( - __in IN PVOID DsmContext, - __in IN PVOID DsmId - ); -/*++ - -Routine Description: - - This routine indicates that the device represented by DsmId will be removed, though - due to outstanding I/Os or other conditions, it can't be removed immediately. - The DSM_ID list passed to other functions will no longer contain DsmId, so internal - structures should be updated accordingly. - -Arguments: - - DsmContext - Context value given to the multipath driver during registration. - DsmId - Value referring to the failed device. - -Return Value: - - NTSTATUS of the operation. - ---*/ - - -typedef -NTSTATUS -(*DSM_REMOVE_DEVICE) ( - __in IN PVOID DsmContext, - __in IN PVOID DsmId, - __in IN PVOID PathId - ); -/*++ - -Routine Description: - - This routine indicates that the main path has determined or been notified that thedevice - has failed and should be removed from PathId. - -Arguments: - - DsmContext - Context value given to the multipath driver during registration. - DsmId - Value referring to the failed device. - PathId - The path on which the Device lives. - -Return Value: - - NTSTATUS of the operation. - ---*/ - -typedef -NTSTATUS -(*DSM_REMOVE_PATH) ( - __in IN PVOID DsmContext, - __in IN PVOID PathId - ); -/*++ - -Routine Description: - - This routine indicates that the path is no longer valid, and that the DSM should update - it's internal state appropriately (tear down the structure, free allocations, ...). - It is the responsibility of mpctl.sys to have already removed the devices (via RemoveDevice) - that are attached to this path. - -Arguments: - - DsmContext - Context value given to the multipath driver during registration. - PathId - The path to remove. - -Return Value: - - NTSTATUS of the operation. - ---*/ - -#define DSM_BROADCAST 0x00000001 -#define DSM_WILL_HANDLE 0x00000002 -#define DSM_PATH_SET 0x00000003 -#define DSM_ERROR 0x00000004 - -// -// IOCTL handling routines. -// -typedef -ULONG -(*DSM_CATEGORIZE_REQUEST) ( - __in IN PVOID DsmContext, - __in IN PDSM_IDS DsmIds, - __in IN PIRP Irp, - __in IN PSCSI_REQUEST_BLOCK Srb, - __in IN PVOID CurrentPath, - __deref_out_opt OUT PVOID *PathId, - __out OUT NTSTATUS *Status - ); -/*++ - -Routine Description: - - The routine is called when a request other than R/W is being handled. - The DSM indicates whether the request should be handled by it's DsmBroadcastRequest, - DsmSrbDeviceControl, or that the PathID indicated should be used. - -Arguments: - - DsmIds - The collection of DSM IDs that pertain to the MPDisk. - Irp - The Irp containing Srb. - Srb - Scsi request block - CurrentPath - Path to which last request was sent - PathId - Updated to the PathId where the request should be sent if return value - is DSM_PATH_SET. - Status - Storage for status in the event that DSM_ERROR is returned. - -Return Value: - - DSM_BROADCAST - If BroadcastRequest should be used. - DSM_WILL_HANDLE - If SrbDeviceControl should be used. - DSM_PATH_SET - If the Srb should just be sent to PathId - DSM_ERROR - Indicates that an error occurred where by the request can't be handled. - Status is updated, along with Srb->SrbStatus. - ---*/ - -typedef -NTSTATUS -(*DSM_BROADCAST_SRB) ( - __in IN PVOID DsmContext, - __in IN PDSM_IDS DsmIds, - __in IN PIRP Irp, - __in IN PSCSI_REQUEST_BLOCK Srb, - __in IN PKEVENT Event - ); -/*++ - -Routine Description: - - This routine is called when the DSM has indicated that Srb should be sent to the device - down all paths. The DSM will update IoStatus information and status, but not complete the - request. - -Arguments: - - DsmIds - The collection of DSM IDs that pertain to the MPDisk. - Irp - Irp containing SRB. - Srb - Scsi request block - Event - DSM sets this once all sub-requests have completed and the original request's - IoStatus has been setup. - -Return Value: - - NTSTATUS of the operation. - ---*/ - - -typedef -NTSTATUS -(*DSM_SRB_DEVICE_CONTROL) ( - __in IN PVOID DsmContext, - __in IN PDSM_IDS DsmIds, - __in IN PIRP Irp, - __in IN PSCSI_REQUEST_BLOCK Srb, - __in IN PKEVENT Event - ); -/*++ - -Routine Description: - - This routine is called when the DSM has indicated that it wants to handle it internally - (via CATEGORIZE_REQUEST). - It should set IoStatus (Status and Information) and the Event, but not complete the request. - -Arguments: - - DsmIds - The collection of DSM IDs that pertain to the MPDISK. - Irp - Irp containing SRB. - Srb - Scsi request block - Event - Event to be set when the DSM is finished if DsmHandled is TRUE - -Return Value: - - NTSTATUS of the request. - ---*/ - -typedef -VOID -(*DSM_COMPLETION_ROUTINE) ( - __in IN PVOID DsmId, - __in IN PIRP Irp, - __in IN PSCSI_REQUEST_BLOCK Srb, - __in IN PVOID DsmContext - ); -/*++ - -Routine Description: - - This routine is called from mpio's completion routine for those requests that - the DSM has indicated that it wants a completion routine (set via SET_COMPLETION). - -Arguments: - - DsmIds - The collection of DSM IDs that pertain to the MPDISK. - Irp - Irp containing SRB. - Srb - Scsi request block - DsmContext - DSM supplied value. - -Return Value: - - NONE - ---*/ - - -typedef struct _DSM_COMPLETION_INFO { - - // - // Routine to be invoked on request completion. - // - DSM_COMPLETION_ROUTINE DsmCompletionRoutine; - - // - // Context to be supplied. - // - PVOID DsmContext; - -} DSM_COMPLETION_INFO, *PDSM_COMPLETION_INFO; - -typedef -VOID -(*DSM_SET_COMPLETION) ( - __in IN PVOID DsmContext, - __in IN PVOID DsmId, - __in IN PIRP Irp, - __in IN PSCSI_REQUEST_BLOCK Srb, - __inout IN OUT PDSM_COMPLETION_INFO DsmCompletion - ); -/*++ - -Routine Description: - - This routine is called before the actual submission of a request, but after the categorisation - of the I/O. This will be called only for those requests not handled by the DSM directly: - Read/Write - Other requests not handled by SrbControl or Broadcast - The DSM can supply a completion routine and context which will be invoked when the - request completion is being handled. It is not necessary to set completions on any or all - requests. - -Arguments: - DsmId - Identifer that was indicated when the request was categorized (or be LBGetPath) - Irp - Irp containing Srb. - Srb - The request - DsmCompletion - Completion info structure to be filled out by DSM. - - -Return Value: - - None - ---*/ - -#define NUMA_MAX_WEIGHT 10 - -typedef -PVOID -(*DSM_LB_GET_PATH) ( - __in IN PVOID DsmContext, - __in IN PSCSI_REQUEST_BLOCK Srb, - __in IN PDSM_IDS DsmList, - __in IN PVOID CurrentPath, - __out OUT NTSTATUS *Status - ); -/*++ - -Routine Description: - - This routine is called once per I/O and gives the DSM the ability to indicate - to which path the request should be submitted. If the DSM returns a Path that was - not active, this constitutes a Fail-over condition. - -Arguments: - - Srb - The request that needs to be submitted - DsmList - Ids of the devices that make up the multipath group. - CurrentPath - Path to which last request was sent - Status - Storage for an error status, if returning NULL path. - -Return Value: - - PathId to where the request should be sent. NULL if all current paths are failed. - ---*/ - -// -// WMI structs, defines, routines. -// - -// DSM Type 1 - -typedef -NTSTATUS -(*DSM_QUERY_DATABLOCK) ( - __in IN PVOID DsmContext, - __in IN PIRP Irp, - __in IN ULONG GuidIndex, - __in IN ULONG InstanceIndex, - __in IN ULONG InstanceCount, - __inout IN OUT PULONG InstanceLengthArray, - __in IN ULONG BufferAvail, - __out OUT PUCHAR Buffer, - __out OUT PULONG DsmDataLength - ); - -typedef -NTSTATUS -(*DSM_SET_DATABLOCK) ( - __in IN PVOID DsmContext, - __in IN PIRP Irp, - __in IN ULONG GuidIndex, - __in IN ULONG InstanceIndex, - __in IN ULONG BufferSize, - __in IN PUCHAR Buffer - ); - -typedef -NTSTATUS -(*DSM_EXECUTE_METHOD) ( - __in IN PVOID DsmContext, - __in IN PIRP Irp, - __in IN ULONG GuidIndex, - __in IN ULONG InstanceIndex, - __in IN ULONG MethodId, - __in IN ULONG InBufferSize, - __in IN PULONG OutBufferSize, - __inout IN OUT PUCHAR Buffer - ); - -typedef -NTSTATUS -(*DSM_FUNCTION_CONTROL) ( - __in IN PVOID DsmContext, - __in IN PIRP Irp, - __in IN ULONG GuidIndex, - __in IN WMIENABLEDISABLECONTROL Function, - __in IN BOOLEAN Enable - ); - -// DSM Type 2 and newer. - -typedef -NTSTATUS -(*DSM_QUERY_DATABLOCK_EX) ( - __in IN PVOID DsmContext, - __in IN PDSM_IDS DsmIds, - __in IN PIRP Irp, - __in IN ULONG GuidIndex, - __in IN ULONG InstanceIndex, - __in IN ULONG InstanceCount, - __inout IN OUT PULONG InstanceLengthArray, - __in IN ULONG BufferAvail, - __out OUT PUCHAR Buffer, - __out OUT PULONG DsmDataLength, - ... - ); - -typedef -NTSTATUS -(*DSM_SET_DATABLOCK_EX) ( - __in IN PVOID DsmContext, - __in IN PDSM_IDS DsmIds, - __in IN PIRP Irp, - __in IN ULONG GuidIndex, - __in IN ULONG InstanceIndex, - __in IN ULONG BufferSize, - __in IN PUCHAR Buffer, - ... - ); - -typedef -NTSTATUS -(*DSM_EXECUTE_METHOD_EX) ( - __in IN PVOID DsmContext, - __in IN PDSM_IDS DsmIds, - __in IN PIRP Irp, - __in IN ULONG GuidIndex, - __in IN ULONG InstanceIndex, - __in IN ULONG MethodId, - __in IN ULONG InBufferSize, - __in IN PULONG OutBufferSize, - __inout IN OUT PUCHAR Buffer, - ... - ); - -typedef -NTSTATUS -(*DSM_FUNCTION_CONTROL_EX) ( - __in IN PVOID DsmContext, - __in IN PDSM_IDS DsmIds, - __in IN PIRP Irp, - __in IN ULONG GuidIndex, - __in IN WMIENABLEDISABLECONTROL Function, - __in IN BOOLEAN Enable, - ... - ); - -typedef struct _DSM_WMILIB_CONTEXT { - ULONG GuidCount; - PWMIGUIDREGINFO GuidList; - UNICODE_STRING RegistryPath; - UNICODE_STRING MofResourceName; - union { - DSM_QUERY_DATABLOCK QueryWmiDataBlock; - DSM_QUERY_DATABLOCK_EX QueryWmiDataBlockEx; - }; - union { - DSM_SET_DATABLOCK SetWmiDataBlock; - DSM_SET_DATABLOCK_EX SetWmiDataBlockEx; - }; - union { - DSM_EXECUTE_METHOD ExecuteWmiMethod; - DSM_EXECUTE_METHOD_EX ExecuteWmiMethodEx; - }; - union { - DSM_FUNCTION_CONTROL WmiFunctionControl; - DSM_FUNCTION_CONTROL_EX WmiFunctionControlEx; - }; -} DSM_WMILIB_CONTEXT, *PDSM_WMILIB_CONTEXT; - - -// -// Unload routine. -// -typedef -NTSTATUS -(*DSM_UNLOAD) ( - __in IN PVOID DsmContext - ); -/*++ - -Routine Description: - - This routine is called when the main module requires the DSM to be unloaded - (ie. prior to the main module unload). - -Arguments: - - DsmContext - Context value passed to DsmInitialize() - -Return Value: - - NTSTATUS - Had best be STATUS_SUCCESS; - ---*/ - - - -// -// Registration routines. -// -// Called in the DSM's DriverEntry. -// The DSM will register with the main module by filling in the following structure -// and sending the REGISTER IOCTL -// - -// -// DsmTypeUnknown == mustn't be used. -// DsmType1 == first version -// DsmType2 == indicates that DSM uses InterpretErrorEx() and handles WMI calls with -// DSM_IDS passed in as extra parameter -// DsmType3 == indicates that DSM handles the case where its completion routine can be called with NULL DsmId -// DsmType4 == indicates that DSM provides version info -// DsmType5 == indicates that DSM provides additional DSM-centric (global) WMI classes (not used if Server 2008 or earlier) -// DsmType6 == not used -// - -#if (NTDDI_VERSION >= NTDDI_WIN7) // For Server 2008 R2 and later. - -typedef enum _DSM_TYPE { - DsmTypeUnknown = 0, - DsmType1, - DsmType2, - DsmType3, - DsmType4, - DsmType5, - DsmType6 -} DSM_TYPE, *PDSM_TYPE; - -#else // For Server 2008 and earlier. - -typedef enum _DSM_TYPE { - DsmTypeUnknown = 0, - DsmType1, - DsmType2, - DsmType3, - DsmType4, - DsmType5 -} DSM_TYPE, *PDSM_TYPE; - -#endif - -typedef struct _DSM_VERSION_INFO { - ULONG MajorVersion; - ULONG MinorVersion; - ULONG ProductBuild; - ULONG QfeNumber; -} DSM_VERSION_INFO, *PDSM_VERSION_INFO; - -typedef struct _DSM_INIT_DATA { - - // - // Size, in bytes. - // - ULONG InitDataSize; - - // - // DSM entry points. - // - DSM_INQUIRE_DRIVER DsmInquireDriver; - DSM_COMPARE_DEVICES DsmCompareDevices; - DSM_DEVICE_SERIAL_NUMBER DsmDeviceSerialNumber; - DSM_GET_CONTROLLER_INFO DsmGetControllerInfo; - DSM_SET_DEVICE_INFO DsmSetDeviceInfo; - DSM_IS_PATH_ACTIVE DsmIsPathActive; - DSM_PATH_VERIFY DsmPathVerify; - DSM_INVALIDATE_PATH DsmInvalidatePath; - DSM_MOVE_DEVICE DsmMoveDevice; - DSM_REMOVE_PENDING DsmRemovePending; - DSM_REMOVE_DEVICE DsmRemoveDevice; - DSM_REMOVE_PATH DsmRemovePath; - DSM_SRB_DEVICE_CONTROL DsmSrbDeviceControl; - DSM_LB_GET_PATH DsmLBGetPath; - union { - DSM_INTERPRET_ERROR DsmInterpretError; - DSM_INTERPRET_ERROR_EX DsmInterpretErrorEx; - }; - DSM_UNLOAD DsmUnload; - DSM_SET_COMPLETION DsmSetCompletion; - DSM_CATEGORIZE_REQUEST DsmCategorizeRequest; - DSM_BROADCAST_SRB DsmBroadcastSrb; - - // - // Wmi entry point and guid information. - // - DSM_WMILIB_CONTEXT DsmWmiInfo; - - // - // Context value. - // - PVOID DsmContext; - - // - // DriverObject for the DSM. - // - PDRIVER_OBJECT DriverObject; - - // - // Friendly name for the DSM. - // - UNICODE_STRING DisplayName; - - // - // Reserved. - // - ULONG Reserved; - - // - // Version 2 starts here... - // - - DSM_TYPE DsmType; - - // - // Version 4 starts here... - // - - DSM_VERSION_INFO DsmVersion; - -#if (NTDDI_VERSION >= NTDDI_WIN7) // For Server 2008 R2 and later. - // - // Version 5 starts here... - // - - // - // Wmi entry point and guid information for DSM-centric classes. - // - DSM_WMILIB_CONTEXT DsmWmiGlobalInfo; -#endif - -} DSM_INIT_DATA, *PDSM_INIT_DATA; - - -#define DSM_INIT_DATA_TYPE_1_SIZE (RTL_SIZEOF_THROUGH_FIELD(DSM_INIT_DATA, Reserved)) -#define DSM_INIT_DATA_TYPE_2_SIZE (RTL_SIZEOF_THROUGH_FIELD(DSM_INIT_DATA, DsmType)) -#define DSM_INIT_DATA_TYPE_3_SIZE DSM_INIT_DATA_TYPE_2_SIZE - -#if (NTDDI_VERSION >= NTDDI_WIN7) // For Server 2008 R2 and later. - -#define DSM_INIT_DATA_TYPE_4_SIZE (RTL_SIZEOF_THROUGH_FIELD(DSM_INIT_DATA, DsmVersion)) -#define DSM_INIT_DATA_TYPE_5_SIZE (sizeof(DSM_INIT_DATA)) - -#else // For Server 2008 and earlier. - -#define DSM_INIT_DATA_TYPE_4_SIZE (sizeof(DSM_INIT_DATA)) - -#endif - - -typedef struct _MPIO_VERSION_INFO { - ULONG MajorVersion; - ULONG MinorVersion; - ULONG ProductBuild; - ULONG QfeNumber; -} MPIO_VERSION_INFO, *PMPIO_VERSION_INFO; - - -// -// Output structure for the registration. The DSM needs to keep this value for certain -// routines such as DsmNotification and DsmGetTargetObject. -// -typedef struct _DSM_MPIO_CONTEXT { - PVOID MPIOContext; -} DSM_MPIO_CONTEXT, *PDSM_MPIO_CONTEXT; - - -// -// Input structure for deregistration. -// -typedef struct _DSM_DEREGISTER_DATA { - - // - // Size in bytes - // - ULONG DeregisterDataSize; - - // - // Context value. - // - PVOID DsmContext; - - // - // DriverObject for the DSM. - // - PDRIVER_OBJECT DriverObject; - - // - // MPIO context that was passed back to DSM at registration time - // - PDSM_MPIO_CONTEXT MpioContext; - -} DSM_DEREGISTER_DATA, *PDSM_DEREGISTER_DATA; - - -#define MPIO_DSM ((ULONG) 'dsm') - -// -// IOCTL sent by the DSM to pass entry point info to the MultiPath Control driver. -// Passed in structure defined above (DSM_INIT_DATA). -// -#define IOCTL_MPDSM_REGISTER CTL_CODE (MPIO_DSM, 0x01, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) - -// -// IOCTL sent by the DSM to deregister from the MultiPath Control driver. -// Passed in structure defined above (DSM_DEREGISTER_DATA). -// -#define IOCTL_MPDSM_DEREGISTER CTL_CODE (MPIO_DSM, 0x02, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) - - -// -// DSM library routines. -// -VOID -DsmSendDeviceIoControlSynchronous( - __in IN ULONG IoControlCode, - __in IN PDEVICE_OBJECT TargetDeviceObject, - __in_opt IN PVOID InputBuffer OPTIONAL, - __inout_opt IN OUT PVOID OutputBuffer OPTIONAL, - __in IN ULONG InputBufferLength, - __in IN ULONG OutputBufferLength, - __in IN BOOLEAN InternalDeviceIoControl, - __out OUT PIO_STATUS_BLOCK IoStatus - ); - -/*++ - -Routine Description: - - This routine is used by the DSM to send IoDeviceControls. - Buffer must be of the appropriate size to encapsulate both input and output. - This routine handles errors/retries. - -Arguments: - - IoControlCode - The DeviceIoControl code. - TargetDevice - DeviceObject to which the request should be sent. - Buffer - The input/output buffer for the request. - InputBufferLength - Length of the input parameters buffer. - OutputBufferLength - Length of the output buffer - InternalDeviceIoControl - Indicates whether the IOCTL is marked as Internal or public. - IoStatus - IO STATUS BLOCK to receive the final status/information fields. - -Return Value: - - NONE - ---*/ - - -NTSTATUS -DsmSendPassThroughDirect( - __in IN PDEVICE_OBJECT DeviceObject, - __in IN PSCSI_PASS_THROUGH_DIRECT ScsiPassThrough, - __in IN ULONG InputBufferLength, - __in IN ULONG OutputBufferLength - ); -/*++ - -Routine Description: - - This routine will send the requested ScsiPassThrough as 'Direct'. - -Arguments: - - DeviceObject - Target of the request. - ScsiPassThrough - A fully initialised ScsiPassThrough struct. - InputBufferLength - Length, in bytes, of the Input buffer. - OutputBufferLength - Length, in bytes, of the output buffer. - -Return Value: - - The interpreted status of the request or SUCCESS. - ---*/ - - -NTSTATUS -DsmGetScsiAddress( - __in IN PDEVICE_OBJECT DeviceObject, - __deref_out OUT PSCSI_ADDRESS *ScsiAddress - ); -/*++ - -Routine Description: - - This routine will return the scsi_address (Port, Path, TargetId, LUN) of DeviceObject. - The buffer for the Address will be allocated and it is the responsibility of the caller - to free it. - -Arguments: - - DeviceObject - The DO of which the address is needed. - ScsiAddress - Location where the address struct. will be placed. - -Return Value: - - SUCCESS, INSUFFICIENT_RESOURCES, NO_SUCH_DEVICE - ---*/ - - -PDSM_IDS -DsmGetAssociatedDevice( - __in IN PVOID MPIOContext, - __in IN PDEVICE_OBJECT PortFdo, - __in IN UCHAR DeviceType - ); -/*++ - -Routine Description: - - If the DSM needs to acquire information from other devices (such as a controller), this - routine can be used to get a list of the PDO's associated with PortFdo. - -Arguments: - - PortFdo - Port driver FDO passed to InquireDriver. - DeviceType - Indicates the SCSI DeviceType to return. - -Return Value: - - Pointer to a DSM_ID structure, where IdList entries are PDEVICE_OBJECT. It is the - reponsibility of the DSM to free the buffer. - ---*/ - - -NTSTATUS -DsmReleaseQueue( - __in IN PDEVICE_OBJECT TargetDevice - ); -/*++ - -Routine Description: - - In the event that a DSM-originated request freezes the queue (SRB_STATUS_QUEUE_FROZEN), this - must be used to un-freeze the queue. - DSM's must check the SRB_STATUS_XXX values upon request completion for those requests that - they sent. - -Arguments: - - TargetDevice - DeviceObject to which the release queue should be sent. - -Return Value: - - Status of of the ReleaseQueue IOCTL. - ---*/ - - -NTSTATUS -DsmSendTUR( - __in IN PDEVICE_OBJECT TargetDevice - ); -/*++ - -Routine Description: - - Sends a Test Unit Ready to TargetDevice. - -Arguments: - - TargetDevice - DeviceObject to which the TUR should be sent. - -Return Value: - - Status of of the TUR. - ---*/ - -NTSTATUS -DsmSendRequest( - __in IN PVOID MPIOContext, - __in IN PDEVICE_OBJECT TargetDevice, - __in IN PIRP Irp, - __in IN PVOID DsmId - ); -/*++ - -Routine Description: - - This routine is used by the DSM to send it's OOB, Broadcast, or any other DSM built requests - to TargetDevice. Not to be used for Irps sent to the DSM by the MPIO driver. Using this - routine allows MPIO to maintain the necessary state info so that Power and PnP requests - can be handled correctly. - -Arguments: - - MPIOContext - Value given to dsm during init. - TargetDevice - DeviceObject to which Irp should be sent. - Irp - The request to send. - DsmId - DSM value referring to the port PDO. - -Return Value: - - Status of IoCallDriver or an error status if one is detected. - ---*/ - -VOID -DsmCompleteRequest( - __in IN PVOID MPIOContext, - __in IN PVOID DsmId - ); -/*++ - -Routine Description: - - This routine is used by the DSM on completion of a request sent via DsmSendRequest. This - notifies MPIO that the request is no longer outstanding and to release any references that - were being held. - - NOTE: This should NOT be called if DsmSendRequest returned any error status values. If an - error was returned, SendRequest did any clean-up necessary. - -Arguments: - - MPIOContext - The Context value (FDO) given to the DSM during init. - DsmId - The DSM ID associated with DeviceObject. - -Return Value: - - NONE - ---*/ - -ULONG -DsmGetSystemWeight( - __in IN PVOID MPIOContext, - __in IN PIRP Irp, - __in IN PVOID PathId - ); -/*++ - -Routine Description: - - This routine is used by the DSM to determine the cost associated with issuing the - request to PathId for the system. For example, cross node accesses on a NUMA system. - -Arguments: - - MPIOContext - Value given to the DSM during initialization. - Irp - The request to send. - PathId - One of the PathId values for the MPDisk. (SetDeviceInfo). - -Return Value: - - Relative system cost of issuing Irp to PathId. (ULONG)-1 indicates this Path is - unreachable. - ---*/ - - -PDEVICE_OBJECT -DsmGetPDO( - __in IN PVOID MPIOContext, - __in IN PDEVICE_OBJECT DeviceObject - ); -/*++ - -Routine Description: - - This routine is used by the DSM to retrieve the PDO for an adapter FDO. - The DeviceObject passed in must be the PortFdo supplied to InquireDriver. - -Arguments: - - MPIOContext - Value given to the DSM during initialization. - DeviceObject - The PortFDO that the PDO is needed. - -Return Value: - - The PDO or NULL. ---*/ - - -typedef enum _DSM_NOTIFICATION_TYPE { - DeviceFailure, - PathFailure, - PathOnLine, - ThrottleIO, - ResumeIO, - SetCurrentPath, - ThrottleIO_V2, - ResumeIO_V2, - SetCurrentPath_V2, - MaxDsmNotificationType -} DSM_NOTIFICATION_TYPE, *PDSM_NOTIFICATION_TYPE; - - -VOID -DsmNotification( - __in IN PVOID MPIOContext, - __in IN DSM_NOTIFICATION_TYPE NotificationType, - ... - ); -/*++ - -Routine Description: - - This routine is called by the DSM to inform mpctl of certain events such as - Device/Path failure, Device/Path coming back online after a failure, WMI Events, or TBD.... - -Arguments: - - MPIOContext - Value given to the DSM during initialization. - NotificationType - Specifies the type of notification. - Additional Parameters depend on NotificationType - DeviceFailure - DsmId (PVOID) - PathFailure - PathId (PVOID) - PathOnLine - PathId (PVOID) - ThrottleIO - DsmId (PVOID) - ResumeIO - DsmId (PVOID) - SetCurrentPath - PathId (PVOID), DsmId (PVOID) - ThrottleIO_V2 - DsmId (PVOID), Reserved1 (BOOLEAN), Status (PNTSTATUS), Reserved (LONG) - ResumeIO_V2 - DsmId (PVOID), Categorize (BOOLEAN), Status (PNTSTATUS), Reserved (LONG) - If Categorize is TRUE, then throttled requests will be presented - to DSM's LBGetPath or CategorizeRequest (as appropriate) - Reserved must be passed in as 0 - SetCurrentPath_V2 - PathId (PVOID), DsmId (PVOID), Status (PNTSTATUS), Reserved (LONG) - -Return Value: - - None - ---*/ - - -NTSTATUS -DsmWriteEvent( - __in IN PVOID MPIOContext, - __in IN PWSTR ComponentName, - __in IN PWSTR EventDescription, - __in IN ULONG Severity - ); -/*++ - -Routine Description: - - The will cause a WMI Event to be fired, containing the Paramter information as - the event data. - -Arguments: - - MpctlContext - Value given to the DSM during initialization. - ComponentName - Name of the object effected. - EventDescription - Description of the event. - Severity - Lower is worse. - -Return Value: - - None - ---*/ - -NTSTATUS -DsmGetVersion( - __inout IN OUT PMPIO_VERSION_INFO MpioVersion, - __in IN ULONG MpioVersionSize - ); -/*++ - -Routine Description: - - This routine will return the version of multipath drivers installed. - -Arguments: - - MpioVersion - pointer to version structure. - MpioVersionSize - byte size of input structure. - -Return Value: - - NTSTATUS - ---*/ - -PVOID -DsmGetContextFromSrb( - __in IN PSCSI_REQUEST_BLOCK Srb - ); -/*++ - -Routine Description: - - This routine will return the DSM-supplied per-request context associated with - Srb. This routine can only be called after DsmSetCompletion and must be in the context - of one of the DSM's exported functions. - -Arguments: - - Srb - The SCSI_REQUEST_BLOCK to which the DSM-supplied context is associated. - -Return Value: - - The context or NULL. - ---*/ - - -#endif // _DSM_H_ - diff --git a/pub/ddk/dxapi.h b/pub/ddk/dxapi.h deleted file mode 100644 index a2d8a2b..0000000 --- a/pub/ddk/dxapi.h +++ /dev/null @@ -1,37 +0,0 @@ -/*++ - -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( -); - diff --git a/pub/ddk/dxva9typ.h b/pub/ddk/dxva9typ.h deleted file mode 100644 index 26fe5ec..0000000 --- a/pub/ddk/dxva9typ.h +++ /dev/null @@ -1,1001 +0,0 @@ -/*==========================================================================; - * - * Copyright (C) Microsoft Corporation. All Rights Reserved. - * - * File: dxva9typ.h - * Content: Direct3D include file - * - ****************************************************************************/ - -#ifndef _DXVA9TYP_H_ -#define _DXVA9TYP_H_ - -#ifndef DIRECT3D_VERSION -#define DIRECT3D_VERSION 0x0900 -#endif //DIRECT3D_VERSION - -// include this file content only if compiling for DX9 interfaces -#if(DIRECT3D_VERSION >= 0x0900) - - -#include - -#define COM_NO_WINDOWS_H -#include - -#include - -#ifdef __DIRECTX_VA_COPP_ONLY -#define __DIRECTX_VA_DECODER__ -#define __DIRECTX_VA_PROCAMPCONTROL__ -#define __DIRECTX_VA_DEINTERLACE__ -#endif - -#ifndef DXVABit -#define DXVABit(__x) (1 << __x) -#endif - - -// ------------------------------------------------------------------------- -// -// The definitions that follow describe the DirectX Video Acceleration -// decoding interface. -// This interface is accessable via the IAMVideoAccelerator interface. -// -// ------------------------------------------------------------------------- -// -#ifndef __DIRECTX_VA_DECODER__ -#define __DIRECTX_VA_DECODER__ - -/* AYUV sample for 16-entry YUV palette or graphic surface */ - -typedef struct _DXVA_AYUVsample2 { - BYTE bCrValue; - BYTE bCbValue; - BYTE bY_Value; - BYTE bSampleAlpha8; -} DXVA_AYUVsample2, *LPDXVA_AYUVsample2; - -DEFINE_GUID(DXVAp_ModeMPEG2_A, 0x1b81be0A, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); -DEFINE_GUID(DXVAp_ModeMPEG2_C, 0x1b81be0C, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); -DEFINE_GUID(DXVAp_NoEncrypt, 0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); - -#pragma pack(push, BeforeDXVApacking, 1) - -typedef struct _DXVA_BufferDescription { - DWORD dwTypeIndex; - DWORD dwBufferIndex; - DWORD dwDataOffset; - DWORD dwDataSize; - DWORD dwFirstMBaddress; - DWORD dwNumMBsInBuffer; - DWORD dwWidth; - DWORD dwHeight; - DWORD dwStride; - DWORD dwReservedBits; -} DXVA_BufferDescription, *LPDXVA_BufferDescription; - -typedef DWORD DXVA_ConfigQueryOrReplyFunc, *LPDXVA_ConfigQueryOrReplyFunc; - -#define DXVA_QUERYORREPLYFUNCFLAG_DECODER_PROBE_QUERY 0xFFFFF1 -#define DXVA_QUERYORREPLYFUNCFLAG_DECODER_LOCK_QUERY 0xFFFFF5 -#define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_OK_COPY 0xFFFFF8 -#define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_OK_PLUS 0xFFFFF9 -#define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_LOCK_OK_COPY 0xFFFFFC -#define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_FALSE_PLUS 0xFFFFFB -#define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_LOCK_FALSE_PLUS 0xFFFFFF - -#define DXVA_PICTURE_DECODE_BUFFER 1 -#define DXVA_MACROBLOCK_CONTROL_BUFFER 2 -#define DXVA_RESIDUAL_DIFFERENCE_BUFFER 3 -#define DXVA_DEBLOCKING_CONTROL_BUFFER 4 -#define DXVA_INVERSE_QUANTIZATION_MATRIX_BUFFER 5 -#define DXVA_SLICE_CONTROL_BUFFER 6 -#define DXVA_BITSTREAM_DATA_BUFFER 7 -#define DXVA_AYUV_BUFFER 8 -#define DXVA_IA44_SURFACE_BUFFER 9 -#define DXVA_DPXD_SURFACE_BUFFER 10 -#define DXVA_HIGHLIGHT_BUFFER 11 -#define DXVA_DCCMD_SURFACE_BUFFER 12 -#define DXVA_ALPHA_BLEND_COMBINATION_BUFFER 13 -#define DXVA_PICTURE_RESAMPLE_BUFFER 14 -#define DXVA_READ_BACK_BUFFER 15 - -typedef struct _DXVA_ConfigPictureDecode { - - // Operation Indicated - DXVA_ConfigQueryOrReplyFunc dwFunction; - - // Alignment - DWORD dwReservedBits[3]; - - // Encryption GUIDs - GUID guidConfigBitstreamEncryption; - GUID guidConfigMBcontrolEncryption; - GUID guidConfigResidDiffEncryption; - - // Bitstream Processing Indicator - BYTE bConfigBitstreamRaw; - - // Macroblock Control Config - BYTE bConfigMBcontrolRasterOrder; - - // Host Resid Diff Config - BYTE bConfigResidDiffHost; - BYTE bConfigSpatialResid8; - BYTE bConfigResid8Subtraction; - BYTE bConfigSpatialHost8or9Clipping; - BYTE bConfigSpatialResidInterleaved; - BYTE bConfigIntraResidUnsigned; - - // Accelerator Resid Diff Config - BYTE bConfigResidDiffAccelerator; - BYTE bConfigHostInverseScan; - BYTE bConfigSpecificIDCT; - BYTE bConfig4GroupedCoefs; -} DXVA_ConfigPictureDecode, *LPDXVA_ConfigPictureDecode; - -typedef struct _DXVA_PictureParameters { - - WORD wDecodedPictureIndex; - WORD wDeblockedPictureIndex; - - WORD wForwardRefPictureIndex; - WORD wBackwardRefPictureIndex; - - WORD wPicWidthInMBminus1; - WORD wPicHeightInMBminus1; - - BYTE bMacroblockWidthMinus1; - BYTE bMacroblockHeightMinus1; - - BYTE bBlockWidthMinus1; - BYTE bBlockHeightMinus1; - - BYTE bBPPminus1; - - BYTE bPicStructure; - BYTE bSecondField; - BYTE bPicIntra; - BYTE bPicBackwardPrediction; - - BYTE bBidirectionalAveragingMode; - BYTE bMVprecisionAndChromaRelation; - BYTE bChromaFormat; - - BYTE bPicScanFixed; - BYTE bPicScanMethod; - BYTE bPicReadbackRequests; - - BYTE bRcontrol; - BYTE bPicSpatialResid8; - BYTE bPicOverflowBlocks; - BYTE bPicExtrapolation; - - BYTE bPicDeblocked; - BYTE bPicDeblockConfined; - BYTE bPic4MVallowed; - BYTE bPicOBMC; - BYTE bPicBinPB; - BYTE bMV_RPS; - - BYTE bReservedBits; - - WORD wBitstreamFcodes; - WORD wBitstreamPCEelements; - BYTE bBitstreamConcealmentNeed; - BYTE bBitstreamConcealmentMethod; - -} DXVA_PictureParameters, *LPDXVA_PictureParameters; - -#pragma pack(pop, BeforeDXVApacking) - -#endif /* __DIRECTX_VA_DECODER__ */ - - -#ifndef __DIRECTX_VA_DECODER9__ -#define __DIRECTX_VA_DECODER9__ -// ------------------------------------------------------------------------- -// Decoding data types used with RenderMoComp -// ------------------------------------------------------------------------- -// - -typedef struct _DXVAUncompDataInfo -{ - DWORD UncompWidth; /* Width of uncompressed data */ - DWORD UncompHeight; /* Height of uncompressed data */ - D3DFORMAT UncompFormat; /* Format of uncompressed data */ -} DXVAUncompDataInfo; - -typedef struct _DXVACompBufferInfo -{ - DWORD NumCompBuffers; /* Number of buffers reqd for compressed data */ - DWORD WidthToCreate; /* Width of surface to create */ - DWORD HeightToCreate; /* Height of surface to create */ - DWORD BytesToAllocate; /* Total number of bytes used by each surface */ - DWORD Usage; /* Usage used to create the compressed buffer */ - D3DPOOL Pool; /* Pool where the compressed buffer belongs */ - D3DFORMAT Format; /* Format used to create the compressed buffer */ -} DXVACompBufferInfo; - -typedef struct _DXVABufferInfo -{ - VOID* pCompSurface; /* Pointer to buffer containing compressed data */ - DWORD DataOffset; /* Offset of relevant data from the beginning of buffer */ - DWORD DataSize; /* Size of relevant data */ -} DXVABufferInfo; - -#endif /* __DIRECTX_VA_DECODER9__ */ - - -// ------------------------------------------------------------------------- -// -// D3DFORMAT describes a pixel memory layout, DXVA sample format contains -// additional information that describes how the pixels should be interpreted. -// -// DXVA Extended color data - occupies the SampleFormat DWORD -// data fields. -// ------------------------------------------------------------------------- -#ifndef __DIRECTX_VA_SAMPLEFORMAT__ -#define __DIRECTX_VA_SAMPLEFORMAT__ - -typedef enum _DXVA_SampleFormat { - DXVA_SampleFormatMask = 0xFF, // 8 bits used for DXVA Sample format - DXVA_SampleUnknown = 0, - DXVA_SamplePreviousFrame = 1, - DXVA_SampleProgressiveFrame = 2, - DXVA_SampleFieldInterleavedEvenFirst = 3, - DXVA_SampleFieldInterleavedOddFirst = 4, - DXVA_SampleFieldSingleEven = 5, - DXVA_SampleFieldSingleOdd = 6, - DXVA_SampleSubStream = 7 -} DXVA_SampleFormat; - -#define DXVA_ExtractSampleFormat(_sf) ((_sf) & (DXVA_SampleFormatMask)) - -#define DXVA_ExtractExtColorData(_sf, _Mask, _Shift) \ - (((_sf) & (_Mask)) >> (_Shift)) - -#define DXVABitMask(__n) (~((~0) << __n)) -#define DXVA_ExtColorData_ShiftBase 8 -#define DXVAColorMask(__bits,__base) (DXVABitMask(__bits) << (__base)) - -typedef enum _DXVA_VideoTransferFunction -{ - DXVA_VideoTransFuncShift = (DXVA_ExtColorData_ShiftBase + 19), - DXVA_VideoTransFuncMask = DXVAColorMask(5, DXVA_VideoTransFuncShift), - - DXVA_VideoTransFunc_Unknown = 0, - DXVA_VideoTransFunc_10 = 1, - DXVA_VideoTransFunc_18 = 2, - DXVA_VideoTransFunc_20 = 3, - DXVA_VideoTransFunc_22 = 4, - DXVA_VideoTransFunc_22_709 = 5, - DXVA_VideoTransFunc_22_240M = 6, - DXVA_VideoTransFunc_22_8bit_sRGB = 7, - DXVA_VideoTransFunc_28 = 8 -} DXVA_VideoTransferFunction; - -typedef enum _DXVA_VideoPrimaries -{ - DXVA_VideoPrimariesShift = (DXVA_ExtColorData_ShiftBase + 14), - DXVA_VideoPrimariesMask = DXVAColorMask(5, DXVA_VideoPrimariesShift), - - DXVA_VideoPrimaries_Unknown = 0, - DXVA_VideoPrimaries_reserved = 1, - DXVA_VideoPrimaries_BT709 = 2, - DXVA_VideoPrimaries_BT470_2_SysM = 3, - DXVA_VideoPrimaries_BT470_2_SysBG = 4, - DXVA_VideoPrimaries_SMPTE170M = 5, - DXVA_VideoPrimaries_SMPTE240M = 6, - DXVA_VideoPrimaries_EBU3213 = 7, - DXVA_VideoPrimaries_SMPTE_C = 8 -} DXVA_VideoPrimaries; - -typedef enum _DXVA_VideoLighting -{ - DXVA_VideoLightingShift = (DXVA_ExtColorData_ShiftBase + 10), - DXVA_VideoLightingMask = DXVAColorMask(4, DXVA_VideoLightingShift), - - DXVA_VideoLighting_Unknown = 0, - DXVA_VideoLighting_bright = 1, - DXVA_VideoLighting_office = 2, - DXVA_VideoLighting_dim = 3, - DXVA_VideoLighting_dark = 4 -} DXVA_VideoLighting; - -typedef enum _DXVA_VideoTransferMatrix -{ - DXVA_VideoTransferMatrixShift = (DXVA_ExtColorData_ShiftBase + 7), - DXVA_VideoTransferMatrixMask = DXVAColorMask(3, DXVA_VideoTransferMatrixShift), - - DXVA_VideoTransferMatrix_Unknown = 0, - DXVA_VideoTransferMatrix_BT709 = 1, - DXVA_VideoTransferMatrix_BT601 = 2, - DXVA_VideoTransferMatrix_SMPTE240M = 3 -} DXVA_VideoTransferMatrix; - -typedef enum _DXVA_NominalRange -{ - DXVA_NominalRangeShift = (DXVA_ExtColorData_ShiftBase + 4), - DXVA_NominalRangeMask = DXVAColorMask(3, DXVA_NominalRangeShift), - - DXVA_NominalRange_Unknown = 0, - DXVA_NominalRange_Normal = 1, - DXVA_NominalRange_Wide = 2, - - DXVA_NominalRange_0_255 = 1, - DXVA_NominalRange_16_235 = 2, - DXVA_NominalRange_48_208 = 3 -} DXVA_NominalRange; - -typedef enum _DXVA_VideoChromaSubsampling -{ - DXVA_VideoChromaSubsamplingShift = (DXVA_ExtColorData_ShiftBase + 0), - DXVA_VideoChromaSubsamplingMask = DXVAColorMask(4, DXVA_VideoChromaSubsamplingShift), - - DXVA_VideoChromaSubsampling_Unknown = 0, - DXVA_VideoChromaSubsampling_ProgressiveChroma = 0x8, - DXVA_VideoChromaSubsampling_Horizontally_Cosited = 0x4, - DXVA_VideoChromaSubsampling_Vertically_Cosited = 0x2, - DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes = 0x1, - // 4:2:0 variations - DXVA_VideoChromaSubsampling_MPEG2 = DXVA_VideoChromaSubsampling_Horizontally_Cosited | - DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes, - - DXVA_VideoChromaSubsampling_MPEG1 = DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes, - - DXVA_VideoChromaSubsampling_DV_PAL = DXVA_VideoChromaSubsampling_Horizontally_Cosited | - DXVA_VideoChromaSubsampling_Vertically_Cosited, - // 4:4:4, 4:2:2, 4:1:1 - DXVA_VideoChromaSubsampling_Cosited = DXVA_VideoChromaSubsampling_Horizontally_Cosited | - DXVA_VideoChromaSubsampling_Vertically_Cosited | - DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes, - -} DXVA_VideoChromaSubsampling; - -typedef struct _DXVA_ExtendedFormat -{ - UINT SampleFormat : 8; // See DXVA_SampleFormat - UINT VideoChromaSubsampling : 4; // See DXVA_VideoChromaSubSampling - DXVA_NominalRange NominalRange : 3; // See DXVA_NominalRange - DXVA_VideoTransferMatrix VideoTransferMatrix : 3; // See DXVA_VideoTransferMatrix - DXVA_VideoLighting VideoLighting : 4; // See DXVA_VideoLighting - DXVA_VideoPrimaries VideoPrimaries : 5; // See DXVA_VideoPrimaries - DXVA_VideoTransferFunction VideoTransferFunction : 5; // See DXVA_VideoTransferFunction -} DXVA_ExtendedFormat; - -#endif /* __DIRECTX_VA_SAMPLEFORMAT__ */ - - -// ------------------------------------------------------------------------- -// -// The definitions that follow describe the video de-interlace interface -// between the VMR and the graphics device driver. This interface is not -// accessable via the IAMVideoAccelerator interface. -// -// ------------------------------------------------------------------------- -// -#ifndef __DIRECTX_VA_DEINTERLACE__ -#define __DIRECTX_VA_DEINTERLACE__ - -#ifndef REFERENCE_TME - typedef LONGLONG REFERENCE_TIME; -#endif - -DEFINE_GUID(DXVAp_DeinterlaceBobDevice, 0x335aa36e,0x7884,0x43a4,0x9c,0x91,0x7f,0x87,0xfa,0xf3,0xe3,0x7e); -DEFINE_GUID(DXVAp_DeinterlaceContainerDevice, 0x0e85cb93,0x3046,0x4ff0,0xae,0xcc,0xd5,0x8c,0xb5,0xf0,0x35,0xfd); - -#define DXVA_DeinterlaceBobDevice DXVAp_DeinterlaceBobDevice -#define DXVA_DeinterlaceContainerDevice DXVAp_DeinterlaceContainerDevice - -#if (DIRECT3D_VERSION < 0x0800) || !defined(DIRECT3D_VERSION) -typedef DWORD D3DFORMAT; -enum { - D3DPOOL_DEFAULT = 0, - D3DPOOL_MANAGED = 1, - D3DPOOL_SYSTEMMEM = 2, - D3DPOOL_SCRATCH = 3, - D3DPOOL_LOCALVIDMEM = 4, - D3DPOOL_NONLOCALVIDMEM = 5, - D3DPOOL_FORCE_DWORD = 0x7fffffff -}; -#endif - -// ------------------------------------------------------------------------- -// data structures shared by User mode and Kernel mode. -// ------------------------------------------------------------------------- -// - -typedef struct _DXVA_Frequency { - DWORD Numerator; - DWORD Denominator; -} DXVA_Frequency; - -typedef struct _DXVA_VideoDesc { - DWORD Size; - DWORD SampleWidth; - DWORD SampleHeight; - DWORD SampleFormat; // also contains extend color data - D3DFORMAT d3dFormat; - DXVA_Frequency InputSampleFreq; - DXVA_Frequency OutputFrameFreq; -} DXVA_VideoDesc, *LPDXVA_VideoDesc; - -typedef enum _DXVA_VideoProcessCaps { - DXVA_VideoProcess_None = 0x0000, - DXVA_VideoProcess_YUV2RGB = 0x0001, - DXVA_VideoProcess_StretchX = 0x0002, - DXVA_VideoProcess_StretchY = 0x0004, - DXVA_VideoProcess_AlphaBlend = 0x0008, - DXVA_VideoProcess_SubRects = 0x0010, - DXVA_VideoProcess_SubStreams = 0x0020, - DXVA_VideoProcess_SubStreamsExtended = 0x0040, - DXVA_VideoProcess_YUV2RGBExtended = 0x0080, - DXVA_VideoProcess_AlphaBlendExtended = 0x0100 -} DXVA_VideoProcessCaps; - -typedef enum _DXVA_DeinterlaceTech { - - // the algorithm is unknown or proprietary - DXVA_DeinterlaceTech_Unknown = 0x0000, - - // the algorithm creates the missing lines by repeating - // the line either above or below it - this method will look very jaggy and - // isn't recommended - DXVA_DeinterlaceTech_BOBLineReplicate = 0x0001, - - // The algorithm creates the missing lines by vertically stretching each - // video field by a factor of two by averaging two lines - DXVA_DeinterlaceTech_BOBVerticalStretch = 0x0002, - - // or using a [-1, 9, 9, -1]/16 filter across four lines. - DXVA_DeinterlaceTech_BOBVerticalStretch4Tap = 0x0100, - - // the pixels in the missing line are recreated by a median filtering operation - DXVA_DeinterlaceTech_MedianFiltering = 0x0004, - - // the pixels in the missing line are recreated by an edge filter. - // In this process, spatial directional filters are applied to determine - // the orientation of edges in the picture content, and missing - // pixels are created by filtering along (rather than across) the - // detected edges. - DXVA_DeinterlaceTech_EdgeFiltering = 0x0010, - - // the pixels in the missing line are recreated by switching on a field by - // field basis between using either spatial or temporal interpolation - // depending on the amount of motion. - DXVA_DeinterlaceTech_FieldAdaptive = 0x0020, - - // the pixels in the missing line are recreated by switching on a pixel by pixel - // basis between using either spatial or temporal interpolation depending on - // the amount of motion.. - DXVA_DeinterlaceTech_PixelAdaptive = 0x0040, - - // Motion Vector Steering identifies objects within a sequence of video - // fields. The missing pixels are recreated after first aligning the - // movement axes of the individual objects in the scene to make them - // parallel with the time axis. - DXVA_DeinterlaceTech_MotionVectorSteered = 0x0080 - -} DXVA_DeinterlaceTech; - -typedef struct _DXVA_VideoSample { - REFERENCE_TIME rtStart; - REFERENCE_TIME rtEnd; - DXVA_SampleFormat SampleFormat; // only lower 8 bits used - VOID* lpDDSSrcSurface; -} DXVA_VideoSample, *LPDXVA_VideoSample; - -// ------------------------------------------------------------------------- -// DeinterlaceBltEx declarations -// ------------------------------------------------------------------------- -// - -typedef enum _DXVA_SampleFlags { - DXVA_SampleFlagsMask = DXVABit(3)|DXVABit(2)|DXVABit(1)|DXVABit(0), - - DXVA_SampleFlag_Palette_Changed = 0x0001, - DXVA_SampleFlag_SrcRect_Changed = 0x0002, - DXVA_SampleFlag_DstRect_Changed = 0x0004, - DXVA_SampleFlag_ColorData_Changed = 0x0008, -} DXVA_SampleFlags; - -typedef enum _DXVA_DestinationFlags { - DXVA_DestinationFlagMask = DXVABit(3)|DXVABit(2)|DXVABit(1)|DXVABit(0), - - DXVA_DestinationFlag_Background_Changed = 0x0001, - DXVA_DestinationFlag_TargetRect_Changed = 0x0002, - DXVA_DestinationFlag_ColorData_Changed = 0x0004, - DXVA_DestinationFlag_Alpha_Changed = 0x0008 -} DXVA_DestinationFlags; - -typedef struct _DXVA_VideoSample2 { -#ifdef _WIN64 - DWORD Size; - DWORD Reserved; -#endif - REFERENCE_TIME rtStart; - REFERENCE_TIME rtEnd; - DWORD SampleFormat; // cast to DXVA_ExtendedFormat, or use Extract macros - DWORD SampleFlags; - VOID* lpDDSSrcSurface; - RECT rcSrc; - RECT rcDst; - DXVA_AYUVsample2 Palette[16]; -} DXVA_VideoSample2, *LPDXVA_VideoSample2; - -typedef struct _DXVA_DeinterlaceCaps { - DWORD Size; - DWORD NumPreviousOutputFrames; - DWORD InputPool; - DWORD NumForwardRefSamples; - DWORD NumBackwardRefSamples; - D3DFORMAT d3dOutputFormat; - DXVA_VideoProcessCaps VideoProcessingCaps; - DXVA_DeinterlaceTech DeinterlaceTechnology; -} DXVA_DeinterlaceCaps, *LPDXVA_DeinterlaceCaps; - -// ------------------------------------------------------------------------- -// Data types used with RenderMoComp in kernel mode -// ------------------------------------------------------------------------- -// - -// Function codes for RenderMoComp - -#define MAX_DEINTERLACE_SURFACES 32 - -#ifdef _WIN64 -// -// These structures are used for thunking 32 bit DeinterlaceBltEx calls on -// 64 bit drivers. -// -typedef struct _DXVA_VideoSample32 { - REFERENCE_TIME rtStart; - REFERENCE_TIME rtEnd; - DWORD SampleFormat; - DWORD SampleFlags; - DWORD lpDDSSrcSurface; // 32 bit pointer size - RECT rcSrc; - RECT rcDst; - DXVA_AYUVsample2 Palette[16]; - // DWORD Pad; - // 4 bytes of padding added by the compiler to align the struct to 8 bytes. -} DXVA_VideoSample32; - -typedef struct _DXVA_DeinterlaceBltEx32 { - DWORD Size; - DXVA_AYUVsample2 BackgroundColor; - RECT rcTarget; - REFERENCE_TIME rtTarget; - DWORD NumSourceSurfaces; - FLOAT Alpha; - DXVA_VideoSample32 Source[MAX_DEINTERLACE_SURFACES]; - DWORD DestinationFormat; - DWORD DestinationFlags; -} DXVA_DeinterlaceBltEx32; -#endif - -typedef struct _DXVA_DeinterlaceBlt { - DWORD Size; - DWORD Reserved; - REFERENCE_TIME rtTarget; - RECT DstRect; - RECT SrcRect; - DWORD NumSourceSurfaces; - FLOAT Alpha; - DXVA_VideoSample Source[MAX_DEINTERLACE_SURFACES]; -} DXVA_DeinterlaceBlt; - -#define DXVA_DeinterlaceBltFnCode 0x01 -// lpInput => DXVA_DeinterlaceBlt* -// lpOuput => NULL /* not currently used */ - -typedef struct _DXVA_DeinterlaceBltEx { - DWORD Size; - DXVA_AYUVsample2 BackgroundColor; - RECT rcTarget; - REFERENCE_TIME rtTarget; - DWORD NumSourceSurfaces; - FLOAT Alpha; - DXVA_VideoSample2 Source[MAX_DEINTERLACE_SURFACES]; - DWORD DestinationFormat; - DWORD DestinationFlags; -} DXVA_DeinterlaceBltEx; - -#define DXVA_DeinterlaceBltExFnCode 0x02 -// lpInput => DXVA_DeinterlaceBltEx* -// lpOuput => NULL /* not currently used */ - -#define MAX_DEINTERLACE_DEVICE_GUIDS 32 -typedef struct _DXVA_DeinterlaceQueryAvailableModes { - DWORD Size; - DWORD NumGuids; - GUID Guids[MAX_DEINTERLACE_DEVICE_GUIDS]; -} DXVA_DeinterlaceQueryAvailableModes; - -#define DXVA_DeinterlaceQueryAvailableModesFnCode 0x01 -// lpInput => DXVA_VideoDesc* -// lpOuput => DXVA_DeinterlaceQueryAvailableModes* - -typedef struct _DXVA_DeinterlaceQueryModeCaps { - DWORD Size; - GUID Guid; - DXVA_VideoDesc VideoDesc; -} DXVA_DeinterlaceQueryModeCaps; - -#define DXVA_DeinterlaceQueryModeCapsFnCode 0x02 -// lpInput => DXVA_DeinterlaceQueryModeCaps* -// lpOuput => DXVA_DeinterlaceCaps* - -#endif /* __DIRECTX_VA_DEINTERLACE__ */ - -// ------------------------------------------------------------------------- -// -// The definitions that follow describe the video ProcAmp interface -// between the VMR and the graphics device driver. This interface is not -// accessable via the IAMVideoAccelerator interface. -// -// ------------------------------------------------------------------------- -// -#ifndef __DIRECTX_VA_PROCAMPCONTROL__ -#define __DIRECTX_VA_PROCAMPCONTROL__ - -DEFINE_GUID(DXVA_ProcAmpControlDevice, - 0x9f200913,0x2ffd,0x4056,0x9f,0x1e,0xe1,0xb5,0x08,0xf2,0x2d,0xcf); - -typedef enum _DXVA_ProcAmpControlProp { - DXVA_ProcAmp_None = 0x0000, - DXVA_ProcAmp_Brightness = 0x0001, - DXVA_ProcAmp_Contrast = 0x0002, - DXVA_ProcAmp_Hue = 0x0004, - DXVA_ProcAmp_Saturation = 0x0008 -} DXVA_ProcAmpControlProp; - -typedef struct _DXVA_ProcAmpControlCaps { - DWORD Size; - DWORD InputPool; - D3DFORMAT d3dOutputFormat; - DWORD ProcAmpControlProps;// see DXVA_ProcAmpControlProp - DWORD VideoProcessingCaps;// see DXVA_VideoProcessCaps -} DXVA_ProcAmpControlCaps, *LPDXVA_ProcAmpControlCaps; - -#define DXVA_ProcAmpControlQueryCapsFnCode 0x03 -// lpInput => DXVA_VideoDesc* -// lpOuput => DXVA_ProcAmpControlCaps* - -typedef struct _DXVA_ProcAmpControlQueryRange { - DWORD Size; - DXVA_ProcAmpControlProp ProcAmpControlProp; - DXVA_VideoDesc VideoDesc; -} DXVA_ProcAmpControlQueryRange, *LPDXVA_ProcAmpControlQueryRange; - -typedef struct _DXVA_VideoPropertyRange { - FLOAT MinValue; - FLOAT MaxValue; - FLOAT DefaultValue; - FLOAT StepSize; -} DXVA_VideoPropertyRange, *LPDXVA_VideoPropertyRange; - -#define DXVA_ProcAmpControlQueryRangeFnCode 0x04 -// lpInput => DXVA_ProcAmpControlQueryRange* -// lpOuput => DXVA_VideoPropertyRange* - -typedef struct _DXVA_ProcAmpControlBlt { - DWORD Size; - RECT DstRect; - RECT SrcRect; - FLOAT Alpha; - FLOAT Brightness; - FLOAT Contrast; - FLOAT Hue; - FLOAT Saturation; -} DXVA_ProcAmpControlBlt; - -#define DXVA_ProcAmpControlBltFnCode 0x01 -// lpInput => DXVA_ProcAmpControlBlt* -// lpOuput => NULL /* not currently used */ - -#endif /* __DIRECTX_VA_PROCAMPCONTROL__ */ - -// ------------------------------------------------------------------------- -// -// The definitions that follow describe the Certified Output Protection -// Protocol between the VMR and the graphics device driver. This interface -// is not accessable via the IAMVideoAccelerator interface. -// -// ------------------------------------------------------------------------- -// -#ifndef __DIRECTX_VA_CERTOUTPUTPROTECT__ -#define __DIRECTX_VA_CERTOUTPUTPROTECT__ - -DEFINE_GUID(DXVA_COPPDevice, - 0xd2457add,0x8999,0x45ed,0x8a,0x8a,0xd1,0xaa,0x04,0x7b,0xa4,0xd5); - -// ------------------------------------------------------------------------- -// COPPGetCertificateLength -// ------------------------------------------------------------------------- -#define DXVA_COPPGetCertificateLengthFnCode 0x01 -// lpInput => NULL -// lpOuput => DWORD* - -// ------------------------------------------------------------------------- -// COPPKeyExchange -// ------------------------------------------------------------------------- -#define DXVA_COPPKeyExchangeFnCode 0x02 -// lpInputData => NULL -// lpOuputData => GUID* - -// ------------------------------------------------------------------------- -// COPPSequenceStart -// ------------------------------------------------------------------------- -typedef struct _DXVA_COPPSignature { - UCHAR Signature[256]; -} DXVA_COPPSignature, *LPDXVA_COPPSignature; - -#define DXVA_COPPSequenceStartFnCode 0x03 -// lpInputData => DXVA_COPPSignature* -// lpOuputData => NULL - -// ------------------------------------------------------------------------- -// COPPCommand -// ------------------------------------------------------------------------- -typedef struct _DXVA_COPPCommand { - GUID macKDI; // 16 bytes - GUID guidCommandID; // 16 bytes - ULONG dwSequence; // 4 bytes - ULONG cbSizeData; // 4 bytes - UCHAR CommandData[4056]; // 4056 bytes (4056+4+4+16+16 = 4096) -} DXVA_COPPCommand, *LPDXVA_COPPCommand; - -#define DXVA_COPPCommandFnCode 0x04 -// lpInputData => DXVA_COPPCommand* -// lpOuputData => NULL - -DEFINE_GUID(DXVA_COPPSetProtectionLevel, - 0x9bb9327c,0x4eb5,0x4727,0x9f,0x00,0xb4,0x2b,0x09,0x19,0xc0,0xda); - -typedef struct _DXVA_COPPSetProtectionLevelCmdData { - ULONG ProtType; - ULONG ProtLevel; - ULONG ExtendedInfoChangeMask; - ULONG ExtendedInfoData; -} DXVA_COPPSetProtectionLevelCmdData; - -// Set the HDCP protection level - (0 - 1 DWORD, 4 bytes) - -typedef enum _COPP_HDCP_Protection_Level { - COPP_HDCP_Level0 = 0, - COPP_HDCP_LevelMin = COPP_HDCP_Level0, - COPP_HDCP_Level1 = 1, - COPP_HDCP_LevelMax = COPP_HDCP_Level1, - COPP_HDCP_ForceDWORD = 0x7fffffff -} COPP_HDCP_Protection_Level; - -typedef enum _COPP_CGMSA_Protection_Level { - COPP_CGMSA_Disabled = 0, - COPP_CGMSA_LevelMin = COPP_CGMSA_Disabled, - COPP_CGMSA_CopyFreely = 1, - COPP_CGMSA_CopyNoMore = 2, - COPP_CGMSA_CopyOneGeneration = 3, - COPP_CGMSA_CopyNever = 4, - COPP_CGMSA_RedistributionControlRequired = 0x08, - COPP_CGMSA_LevelMax = (COPP_CGMSA_RedistributionControlRequired + COPP_CGMSA_CopyNever), - COPP_CGMSA_ForceDWORD = 0x7fffffff -} COPP_CGMSA_Protection_Level; - -typedef enum _COPP_ACP_Protection_Level { - COPP_ACP_Level0 = 0, - COPP_ACP_LevelMin = COPP_ACP_Level0, - COPP_ACP_Level1 = 1, - COPP_ACP_Level2 = 2, - COPP_ACP_Level3 = 3, - COPP_ACP_LevelMax = COPP_ACP_Level3, - COPP_ACP_ForceDWORD = 0x7fffffff -} COPP_ACP_Protection_Level; - -#define COPP_NoProtectionLevelAvailable -1 -#define COPP_DefaultProtectionLevel 0 - -// -// Bit flags of possible protection types. Note that it is possible to apply -// different protection settings to a single connector. -// -enum { - COPP_ProtectionType_Unknown = 0x80000000, - COPP_ProtectionType_None = 0x00000000, - COPP_ProtectionType_HDCP = 0x00000001, - COPP_ProtectionType_ACP = 0x00000002, - COPP_ProtectionType_CGMSA = 0x00000004, - COPP_ProtectionType_Mask = 0x80000007, - COPP_ProtectionType_Reserved = 0x7FFFFFF8 -}; - -DEFINE_GUID(DXVA_COPPSetSignaling, - 0x9a631a5, 0xd684, 0x4c60, 0x8e, 0x4d, 0xd3, 0xbb, 0xf, 0xb, 0xe3, 0xee); - -typedef struct _DXVA_COPPSetSignalingCmdData { - ULONG ActiveTVProtectionStandard; // See COPP_TVProtectionStandard - ULONG AspectRatioChangeMask1; - ULONG AspectRatioData1; // See COPP_ImageAspectRatio_EN300294 for ETSI EN 300 294 values - ULONG AspectRatioChangeMask2; - ULONG AspectRatioData2; - ULONG AspectRatioChangeMask3; - ULONG AspectRatioData3; - ULONG ExtendedInfoChangeMask[4]; - ULONG ExtendedInfoData[4]; - ULONG Reserved; -} DXVA_COPPSetSignalingCmdData; - -// Add format enum and data enum -typedef enum _COPP_TVProtectionStandard { - COPP_ProtectionStandard_Unknown = 0x80000000, - COPP_ProtectionStandard_None = 0x00000000, - COPP_ProtectionStandard_IEC61880_525i = 0x00000001, - COPP_ProtectionStandard_IEC61880_2_525i = 0x00000002, - COPP_ProtectionStandard_IEC62375_625p = 0x00000004, - COPP_ProtectionStandard_EIA608B_525 = 0x00000008, - COPP_ProtectionStandard_EN300294_625i = 0x00000010, - COPP_ProtectionStandard_CEA805A_TypeA_525p = 0x00000020, - COPP_ProtectionStandard_CEA805A_TypeA_750p = 0x00000040, - COPP_ProtectionStandard_CEA805A_TypeA_1125i = 0x00000080, - COPP_ProtectionStandard_CEA805A_TypeB_525p = 0x00000100, - COPP_ProtectionStandard_CEA805A_TypeB_750p = 0x00000200, - COPP_ProtectionStandard_CEA805A_TypeB_1125i = 0x00000400, - COPP_ProtectionStandard_ARIBTRB15_525i = 0x00000800, - COPP_ProtectionStandard_ARIBTRB15_525p = 0x00001000, - COPP_ProtectionStandard_ARIBTRB15_750p = 0x00002000, - COPP_ProtectionStandard_ARIBTRB15_1125i = 0x00004000, - COPP_ProtectionStandard_Mask = 0x80007FFF, - COPP_ProtectionStandard_Reserved = 0x7FFF8000 -} COPP_TVProtectionStandard; - -#define COPP_ImageAspectRatio_EN300294_Mask 0x00000007 - -typedef enum _COPP_ImageAspectRatio_EN300294 { - COPP_AspectRatio_EN300294_FullFormat4by3 = 0, - COPP_AspectRatio_EN300294_Box14by9Center = 1, - COPP_AspectRatio_EN300294_Box14by9Top = 2, - COPP_AspectRatio_EN300294_Box16by9Center = 3, - COPP_AspectRatio_EN300294_Box16by9Top = 4, - COPP_AspectRatio_EN300294_BoxGT16by9Center = 5, - COPP_AspectRatio_EN300294_FullFormat4by3ProtectedCenter = 6, - COPP_AspectRatio_EN300294_FullFormat16by9Anamorphic = 7, - COPP_AspectRatio_ForceDWORD = 0x7fffffff -} COPP_ImageAspectRatio_EN300294; - -// ------------------------------------------------------------------------- -// COPPQueryStatus -// ------------------------------------------------------------------------- -typedef struct _DXVA_COPPStatusInput { - GUID rApp; // 16 bytes - GUID guidStatusRequestID;// 16 bytes - ULONG dwSequence; // 4 bytes - ULONG cbSizeData; // 4 bytes - UCHAR StatusData[4056]; // 4056 bytes (4056+4+4+16+16 = 4096) -} DXVA_COPPStatusInput, *LPDXVA_COPPStatusInput; - -typedef struct _DXVA_COPPStatusOutput { - GUID macKDI; // 16 bytes - ULONG cbSizeData; // 4 bytes - UCHAR COPPStatus[4076]; // 4076 bytes (4076+16+4 = 4096) -} DXVA_COPPStatusOutput, *LPDXVA_COPPStatusOutput; - -typedef enum _COPP_StatusFlags { - COPP_StatusNormal = 0x00, - COPP_LinkLost = 0x01, - COPP_RenegotiationRequired = 0x02, - COPP_StatusFlagsReserved = 0xFFFFFFFC -} COPP_StatusFlags; - -typedef struct _DXVA_COPPStatusData { - GUID rApp; - ULONG dwFlags; // See COPP_StatusFlags above - ULONG dwData; - ULONG ExtendedInfoValidMask; - ULONG ExtendedInfoData; -} DXVA_COPPStatusData; - -typedef struct _DXVA_COPPStatusDisplayData { - GUID rApp; - ULONG dwFlags; // See COPP_StatusFlags above - ULONG DisplayWidth; - ULONG DisplayHeight; - ULONG Format; // also contains extended color data - ULONG d3dFormat; - ULONG FreqNumerator; - ULONG FreqDenominator; -} DXVA_COPPStatusDisplayData; - -typedef enum _COPP_StatusHDCPFlags { - COPP_HDCPRepeater = 0x01, - COPP_HDCPFlagsReserved = 0xFFFFFFFE -} COPP_StatusHDCPFlags; - -typedef struct _DXVA_COPPStatusHDCPKeyData { - GUID rApp; - ULONG dwFlags; // See COPP_StatusFlags above - ULONG dwHDCPFlags; // See COPP_StatusHDCPFlags above - GUID BKey; // Lower 40 bits - GUID Reserved1; - GUID Reserved2; -} DXVA_COPPStatusHDCPKeyData; - -#define DXVA_COPPQueryStatusFnCode 0x05 -// lpInputData => DXVA_COPPStatusInput* -// lpOuputData => DXVA_COPPStatusOutput* - -// -// Status GUID and enumerations -// -DEFINE_GUID(DXVA_COPPQueryConnectorType, - 0x81d0bfd5,0x6afe,0x48c2,0x99,0xc0,0x95,0xa0,0x8f,0x97,0xc5,0xda); - -typedef enum _COPP_ConnectorType { - COPP_ConnectorType_Unknown = -1, - COPP_ConnectorType_VGA = 0, - COPP_ConnectorType_SVideo = 1, - COPP_ConnectorType_CompositeVideo = 2, - COPP_ConnectorType_ComponentVideo = 3, - COPP_ConnectorType_DVI = 4, - COPP_ConnectorType_HDMI = 5, - COPP_ConnectorType_LVDS = 6, - COPP_ConnectorType_TMDS = 7, - COPP_ConnectorType_D_JPN = 8, - COPP_ConnectorType_Internal = 0x80000000, // can be combined with the other connector types - COPP_ConnectorType_ForceDWORD = 0x7fffffff /* force 32-bit size enum */ -} COPP_ConnectorType; - -DEFINE_GUID(DXVA_COPPQueryProtectionType, - 0x38f2a801,0x9a6c,0x48bb,0x91,0x07,0xb6,0x69,0x6e,0x6f,0x17,0x97); - -DEFINE_GUID(DXVA_COPPQueryLocalProtectionLevel, - 0xb2075857,0x3eda,0x4d5d,0x88,0xdb,0x74,0x8f,0x8c,0x1a,0x05,0x49); - -DEFINE_GUID(DXVA_COPPQueryGlobalProtectionLevel, - 0x1957210a,0x7766,0x452a,0xb9,0x9a,0xd2,0x7a,0xed,0x54,0xf0,0x3a); - -DEFINE_GUID(DXVA_COPPQueryDisplayData, - 0xd7bf1ba3,0xad13,0x4f8e,0xaf,0x98,0x0d,0xcb,0x3c,0xa2,0x04,0xcc); - -DEFINE_GUID(DXVA_COPPQueryHDCPKeyData, - 0xdb59d74, 0xa992, 0x492e, 0xa0, 0xbd, 0xc2, 0x3f, 0xda, 0x56, 0x4e, 0x0); - -DEFINE_GUID(DXVA_COPPQueryBusData, - 0xc6f4d673, 0x6174, 0x4184, 0x8e, 0x35, 0xf6, 0xdb, 0x52, 0x0, 0xbc, 0xba); - -typedef enum _COPP_BusType { - COPP_BusType_Unknown = 0, - COPP_BusType_PCI = 1, - COPP_BusType_PCIX = 2, - COPP_BusType_PCIExpress = 3, - COPP_BusType_AGP = 4, - COPP_BusType_Integrated = 0x80000000, // can be combined with the other bus types - COPP_BusType_ForceDWORD = 0x7fffffff /* force 32-bit size enum */ -} COPP_BusType; - -DEFINE_GUID(DXVA_COPPQuerySignaling, - 0x6629a591, 0x3b79, 0x4cf3, 0x92, 0x4a, 0x11, 0xe8, 0xe7, 0x81, 0x16, 0x71); - -typedef struct _DXVA_COPPStatusSignalingCmdData { - GUID rApp; - ULONG dwFlags; // See COPP_StatusFlags above - ULONG AvailableTVProtectionStandards; // See COPP_TVProtectionStandard - ULONG ActiveTVProtectionStandard; // See COPP_TVProtectionStandard - ULONG TVType; - ULONG AspectRatioValidMask1; - ULONG AspectRatioData1; // See COPP_AspectRatio_EN300294 for ETSI EN 300 294 values - ULONG AspectRatioValidMask2; - ULONG AspectRatioData2; - ULONG AspectRatioValidMask3; - ULONG AspectRatioData3; - ULONG ExtendedInfoValidMask[4]; - ULONG ExtendedInfoData[4]; -} DXVA_COPPStatusSignalingCmdData; - -#endif /* __DIRECTX_VA_CERTOUTPUTPROTECT__ */ - -#endif /* (DIRECT3D_VERSION >= 0x0900) */ -#endif /* _DXVA9TYP_H_ */ - - diff --git a/pub/ddk/fcb.h b/pub/ddk/fcb.h deleted file mode 100644 index defb0c5..0000000 --- a/pub/ddk/fcb.h +++ /dev/null @@ -1,1599 +0,0 @@ -/*++ - -Copyright (c) 1994 Microsoft Corporation - -Module Name: - - Fcb.h - -Abstract: - - This module defines File Control Block data structures, by which we mean: - - 1) File Control Blocks (FCB) - 2) File Object Extensions (FOXB) - 3) Net Roots (NET_ROOT) - 4) ServerSide Open Context (SRV_OPEN) - 5) Server Call Context (SRV_CALL) - 6) View of Net Roots (V_NET_ROOT) - - The more complete description follows the prototypes. - -Author: ---*/ - -#ifndef _FCB_STRUCTS_DEFINED_ -#define _FCB_STRUCTS_DEFINED_ - -#include "fcbtable.h" -#include "buffring.h" - -typedef NODE_TYPE_CODE TYPE_OF_OPEN; - -struct _FCB_INIT_PACKET; -typedef struct _FCB_INIT_PACKET *PFCB_INIT_PACKET; - - -/* ----------------------------------------------------------- - There are six important data structures in the wrapper that are shared with the - various mini redirectors. These data structures come in two flavours -- the - mini redirector flavour which contains only those fields that can be manipulated - by the mini redirector and the RDBSS flavour defined here. The mini redirector - flavour carries the prefix MRX_. - - The six data structures are SRV_CALL,NET_ROOT,V_NET_ROOT,FCB,SRV_OPEN and FOBX - respectively. - - The global view of these structures is the following (information on each of the - data structures follows the locking description ) - - L O C K I N G <------- - - There are two levels of lookup tables used: a global table for srvcalls - and netroots and a table-per-netroot for fcbs. This allows directory - operations on different netroots to be almost completely noninterfering - (once the connections are established). Directory operations on the - same netroot do intefere slightly. The following table describes what - locks you need: - - OPERATION DATATYPE LOCK REQUIRED - - create/finalize srvcall/(v)netroot exclusive on netnametablelock - ref/deref/lookup srvcall/(v)netroot shared on netnametablelock (at least) - - create/finalize fcb/srvopen/fobx exclusive on netroot->fcbtablelock - ref/deref/lookup fcb/srvopen/fobx shared on netroot->fcbtablelock - - Note that manipulations on srvopens and fobxs require the same lock as - fcbs....this is simply a memory saving idea. It would be - straightforward to add another resource at the fcb level to remove this; - a set of sharted resources could be used to decrease the probability of - collision to an acceptably low level. - - R E F C O U N T S <--------------- - - Each of the structures is reference counted. The counts are the - following: - - refcount(srvcall) = number of netroots pointing to srvcall + DYNAMIC - refcount(netroot) = number of fcbs pointing to netroot + DYNAMIC - refcount(fcb) = number of fcbs pointing to netroot + DYNAMIC - refcount(srvopen) = number of fcbs pointing to netroot + DYNAMIC - refcount(fobx) = DYNAMIC - - In each case, dynamic refers to the number of callers that have - referenced the structure without dereferencing it. The static part of - the refcount is maintained by the routines themselves; for example, - CreateNetRoot increments the refcount for the associated srvcall. - Reference and Successful Lookups increment the reference counts; - dereference decrements the count. Creates set the reference counts to 1, - - If you require both locks (like FinalizeNetFcb), you take the fcblock - first AND THEN the global table lock. obviously, you release in the - opposite order. - -----------------------------------*/ - -// -// SRV_CALL -// -// A global list of the SRV_CALL structures is maintained in the global -// data. Each SrvCall structure has stuff that is unique to a srv_call. -// Now, the rx doesn't know what this stuff is except for -// -// 0) signature and refcount -// a) a name and associated table stuff -// b) a list of associated NET_ROOTs -// c) a set of timing parameters that control how often the subrx wants -// to be called by the rx in different circumstances (i.e. idle timouts) -// d) the minirdr id -// . -// . -// z) whatever additional storage is request by the minirdr (or creator of the block). -// -// In fact, the Unicode name of the structure is carried in the structure itself -// at the end. The extra space begins at the end of the known stuff so that a -// mini redirector can just refer to his extra space using the context fields - -// These flags are not visible to the mini redirectors. - -#define SRVCALL_FLAG_NO_CONNECTION_ALLOWED (0x10000) -#define SRVCALL_FLAG_NO_WRITES_ALLOWED (0x20000) -#define SRVCALL_FLAG_NO_DELETES_ALLOWED (0x40000) - -#ifdef __cplusplus -typedef struct _SRV_CALL : public MRX_SRV_CALL { -#else // !__cplusplus -typedef struct _SRV_CALL { - - // - // The portion of SRV_CALL visible to mini redirectors. - // - - union { - MRX_SRV_CALL; - struct { - MRX_NORMAL_NODE_HEADER spacer; - }; - }; -#endif // __cplusplus - - // - // The finalization of a SRV_CALL instance consists of two parts, - // destroying the association with all NET_ROOTS etc and freeing the - // memory. There can be a delay between these two and this field - // prevents thefirst step from being duplicated. - // - - BOOLEAN UpperFinalizationDone; - - // - // Name and Prefixtable entry for name lookups - // - - RX_PREFIX_ENTRY PrefixEntry; - - // - // Current condition of the SRV_CALL, i.e., good/bad/in transition - // - - RX_BLOCK_CONDITION Condition; - - ULONG SerialNumberForEnum; - - // - // Number of delayed close files - // - - __volatile LONG NumberOfCloseDelayedFiles; - - // - // List of Contexts which are waiting for the SRV_CALL transitioning - // to be completed before resumption of processing. This typically - // happens when concurrent requests are directed at a server. One of - // these requests initiates the construction while the other requests - // are queued. - // - - LIST_ENTRY TransitionWaitList; - - // - // List Entry to thread together all the SRV_CALL instances marked - // for garbage collection/scavenging. - // - - LIST_ENTRY ScavengerFinalizationList; - - // - // Synchronization context for coordinating the purge operations on the - // files opened at this server. - // - - PURGE_SYNCHRONIZATION_CONTEXT PurgeSyncronizationContext; - - // - // The Buffering manager for coordinating/processing the buffering state - // change requests of the files opened at the server. - // - - RX_BUFFERING_MANAGER BufferingManager; -} SRV_CALL, *PSRV_CALL; - -// -// A NET_ROOT contains -// 0) signature and refcount -// a) a name and associated table stuff -// b) backpointer to the SRV_CALL structure -// c) size information for the various substructures -// d) a lookuptable of FCB structures -// . -// . -// z) whatever additional storage is request by the minirdr (or creator of the block). -// -// A NET_ROOT is what the rx wants to deal with.....not a server. -// Accordingly, the rx calls down to open a netroot and the subrx is -// responsible for opening a server and calling up to put the right -// structures. -// - -#define NETROOT_FLAG_ENCLOSED_ALLOCATED ( 0x00010000 ) -#define NETROOT_FLAG_DEVICE_NETROOT ( 0x00020000 ) -#define NETROOT_FLAG_FINALIZATION_IN_PROGRESS ( 0x00040000 ) -#define NETROOT_FLAG_NAME_ALREADY_REMOVED ( 0x00080000 ) - -#define NETROOT_INIT_KEY (0) - -#ifdef __cplusplus -typedef struct _NET_ROOT : public MRX_NET_ROOT { -#else // !__cplusplus -typedef struct _NET_ROOT { - - // - // The porion of NET_ROOT instance visible to mini redirectors. - // - - union { - MRX_NET_ROOT; - struct { - MRX_NORMAL_NODE_HEADER spacer; - PSRV_CALL SrvCall; - }; - }; -#endif // __cplusplus - - // - // The finalization of a NET_ROOT instance consists of two parts, - // destroying the association with all V_NET_ROOTS etc and freeing the - // memory. There can be a delay between these two and this field - // prevents thefirst step from being duplicated. - // - - BOOLEAN UpperFinalizationDone; - - // - // Current condition of the NET_ROOT, i.e., good/bad/in transition - // - - RX_BLOCK_CONDITION Condition; - - // - // List of Contexts which are waiting for the NET_ROOT transitioning - // to be completed before resumption of processing. This typically - // happens when concurrent requests are directed at a server. One of - // these requests initiates the construction while the other requests - // are queued. - // - - LIST_ENTRY TransitionWaitList; - - // - // List Entry to thread together all the NET_ROOT instances marked - // for garbage collection/scavenging. - // - - LIST_ENTRY ScavengerFinalizationList; - - // - // Synchronization context for coordinating the purge operations on the - // files opened for this NET_ROOt - // - - PURGE_SYNCHRONIZATION_CONTEXT PurgeSyncronizationContext; - - // - // The default V_NET_ROOT instance to be used on this NET_ROOT - // - - PV_NET_ROOT DefaultVNetRoot; - - // - // list of V_NET_ROOTs associated with the NET_ROOT - // - - LIST_ENTRY VirtualNetRoots; - - // - // the count of V_NET_ROOT instances associated with the NET_ROOT - // - - ULONG NumberOfVirtualNetRoots; - - ULONG SerialNumberForEnum; - - // - // NET_ROOT name and prefix table entry - // - - RX_PREFIX_ENTRY PrefixEntry; - - // - // the FCB's associated with this NET_ROOT - // - - RX_FCB_TABLE FcbTable; -} NET_ROOT, *PNET_ROOT; - -// -// A V_NETROOT contains -// 0) signature and refcount -// a) ptr to netroot and links. -// b) name info for table lookup (prefix) -// c) name for a prefix to be added to whatever name you see. this is for simulating a netroot -// mapped not at the root of the actual netroot. -// - -#ifdef __cplusplus -typedef struct _V_NET_ROOT : public MRX_V_NET_ROOT { -#else // !__cplusplus -typedef struct _V_NET_ROOT { - - // - // the portion of V_NET_ROOT visible to mini redirectors - // - - union { - MRX_V_NET_ROOT; - struct { - MRX_NORMAL_NODE_HEADER spacer; - PNET_ROOT NetRoot; - }; - }; -#endif // __cplusplus - - // - // The finalization of a V_NET_ROOT instance consists of two parts, - // destroying the association with all FCBs etc and freeing the - // memory. There can be a delay between these two and this field - // prevents thefirst step from being duplicated. - // - - BOOLEAN UpperFinalizationDone; - - BOOLEAN ConnectionFinalizationDone; - - // - // Current condition of the V_NET_ROOT, i.e., good/bad/in transition - // - - RX_BLOCK_CONDITION Condition; - - // - // Additional reference for the Delete FSCTL. This field is long as - // opposed to a BOOLEAN eventhough it can have only one of two values - // 0 or 1. This enables the usage of interlocked instructions - // - - __volatile LONG AdditionalReferenceForDeleteFsctlTaken; - - // - // Prefix table entry and V_NET_ROOT name ( prefix table entry is inserted - // in the RxNetNameTable) - // - - RX_PREFIX_ENTRY PrefixEntry; - - // - // this name is prepended to all fcbs (not currently used) - // - - UNICODE_STRING NamePrefix; - - // - // amount of bytes required to get past the netroot - // - - ULONG PrefixOffsetInBytes; - - // - // List entry to wire the V_NET_ROOT instance into a list of V_NET_ROOTS - // maintained in the NET_ROOT - // - - LIST_ENTRY NetRootListEntry; - - ULONG SerialNumberForEnum; - - // - // List of Contexts which are waiting for the NET_ROOT transitioning - // to be completed before resumption of processing. This typically - // happens when concurrent requests are directed at a server. One of - // these requests initiates the construction while the other requests - // are queued. - // - - LIST_ENTRY TransitionWaitList; - - // - // List Entry to thread together all the V_NET_ROOT instances marked - // for garbage collection/scavenging. - // - - LIST_ENTRY ScavengerFinalizationList; -} V_NET_ROOT, *PV_NET_ROOT; - -#define FILESIZE_LOCK_DISABLED(x) - -// -// An FCB contains -// 0) FSRTL_COMMON_HEADER -// 1) a reference count -// a) a name and associated table stuff -// b) backpointer to the NET_ROOT structure -// c) a list of SRV_OPEN structures -// d) device object -// e) dispatch table (not yet) -// . -// . -// z) whatever additional storage is request by the minirdr (or creator of the block). -// -// The FCB is pointed to by the FsContext Field in the file object. The -// rule is that all the guys sharing an FCB are talking about the same -// file. (unfortuantely, SMB servers are implemented today in such a way -// that names are aliased so that two different names could be the same -// actual file.....sigh!) The Fcb is the focal point of file -// operations...since operations on the same FCB are actually on the same -// file, synchronization is based on the Fcb rather than some higher level -// (the levels described so far are lower, i.e. farther from the user). -// Again, we will provide for colocation of FCB/SRV_OPEN/FOBX to improve -// paging behaviour. We don't colocate the FCB and NET_ROOT because the -// NET_ROOTs are not paged but FCBs usually are (i.e. unless they are -// paging files). -// -// The Fcb record corresponds to every open file and directory and is is split up into -// two portions a non paged part, i.e., an instance allocated in non paged pool and -// a paged part. The former is the NON_PAGED_FCB and the later is referred to as FCB. -// The FCB conatins a pointer to the corresponding NON_PAGED_FCB part. A backpointer -// is maintained from the NON_PAGED_FCB to the FCB for debugging purposes in debug builds -// - -typedef struct _NON_PAGED_FCB { - - // - // Struct type and size for debugging/tracking - // - - NODE_TYPE_CODE NodeTypeCode; - NODE_BYTE_SIZE NodeByteSize; - - // - // The following field contains a record of special pointers used by - // MM and Cache to manipluate section objects. Note that the values - // are set outside of the file system. However the file system on an - // open/create will set the file object's SectionObject field to point - // to this field - // - - SECTION_OBJECT_POINTERS SectionObjectPointers; - - // - // This resource is used in the common fsrtl routines....allocated here for - // space locality. - // - - ERESOURCE HeaderResource; - - // - // This resource is also used in the common fsrtl routines....allocated here for - // space locality. - // - - ERESOURCE PagingIoResource; - -#ifdef USE_FILESIZE_LOCK - - // - // This mutex protect the filesize during read/write - // - - FAST_MUTEX FileSizeLock; - -#endif - - // - // The list of contexts whose processing has been suspended pending the state - // transition of the FCB. - // - - LIST_ENTRY TransitionWaitList; - - // - // This context is non-zero only if the file currently has asynchronous - // non-cached valid data length extending writes. It allows - // synchronization between pending writes and other operations. - // - - ULONG OutstandingAsyncWrites; - - // - // This event is set when OutstandingAsyncWrites transitions to zero. - // - - PKEVENT OutstandingAsyncEvent; - - KEVENT TheActualEvent; - - // - // The mechanism for the mini redirectors to store additional information - // - - PVOID MiniRdrContext[2]; - - // - // This is the mutex that is inserted into the FCB_ADVANCED_HEADER - // FastMutex field - // - - FAST_MUTEX AdvancedFcbHeaderMutex; - - // - // This resource is used to protect the buffered locks list - // - ERESOURCE BufferedLocksResource; - -#if DBG - PFCB FcbBackPointer; -#endif - -} NON_PAGED_FCB, *PNON_PAGED_FCB; - -typedef enum _FCB_CONDITION { - FcbGood = 1, - FcbBad, - FcbNeedsToBeVerified -} FCB_CONDITION; - -// -// A enumerated type distinguishing the varios contexts under which the FCB resource -// is accquired. -// - -typedef enum _RX_FCBTRACKER_CASES { - - RX_FCBTRACKER_CASE_NORMAL, - RX_FCBTRACKER_CASE_NULLCONTEXT, - RX_FCBTRACKER_CASE_CBS_CONTEXT, - RX_FCBTRACKER_CASE_CBS_WAIT_CONTEXT, - RX_FCBTRACKER_CASE_MAXIMUM - -} RX_FCBTRACKER_CASES; - -typedef struct _FCB_LOCK { - - struct _FCB_LOCK *Next; - LARGE_INTEGER Length; - LARGE_INTEGER BytesOffset; - ULONG Key; - BOOLEAN ExclusiveLock; - -} FCB_LOCK, *PFCB_LOCK; - -typedef struct _FCB_BUFFERED_LOCKS { - - struct _FCB_LOCK *List; - __volatile ULONG PendingLockOps; - PERESOURCE Resource; - -} FCB_BUFFERED_LOCKS, *PFCB_BUFFERED_LOCKS; - - -#ifdef __cplusplus -typedef struct _FCB : public MRX_FCB { -#else // !__cplusplus -typedef struct _FCB { - - // - // Entries are reference counted. ordinarily this would be at the beginning but - // in the case of FCB's it will follows the common header and fixed part - // - - union { - MRX_FCB; - struct { - FSRTL_ADVANCED_FCB_HEADER spacer; - PNET_ROOT NetRoot; - }; - }; -#endif // !__cplusplus - - // - // VNetroot for this FCB, if any - // - - PV_NET_ROOT VNetRoot; - - // - // Structure for fields that must be in non-paged pool. - // - - PNON_PAGED_FCB NonPaged; - - // - // List Entry to thread together all the FCB instances marked - // for garbage collection/scavenging. - // - - LIST_ENTRY ScavengerFinalizationList; - - // - // The resource accquisition mechanism gives preference to buffering state change - // processing over other requests. Therefor when a buffering state change is - // indicated all subsequent requests are shunted off to wait on a buffering state - // change completion event. This enables the actual buffering state change processing - // to complete in a timely fashion. - // - - PKEVENT pBufferingStateChangeCompletedEvent; - - // - // Number of contexts awaiting buffering state change processing completion - // - - LONG NumberOfBufferingStateChangeWaiters; - - // - // the name in the table is always a suffix of the name as viewed by the mini - // redirector. the string in the prefix entry is the name in the table.... - // the "alreadyprefixedname: points to the whole name. - // - - RX_FCB_TABLE_ENTRY FcbTableEntry; - - // - // the name alongwith the MRX_NET_ROOT prefix, i.e. fully qualified name - // - - UNICODE_STRING PrivateAlreadyPrefixedName; - - // - // Indicates that the V_NET_ROOT related processing on finalization is complete - // - - BOOLEAN UpperFinalizationDone; - - // - // the present state of the FCB, good/bad/in transition - // - - RX_BLOCK_CONDITION Condition; - - // - // Pointer to the private dispatch table, if any. - // - - PRX_FSD_DISPATCH_VECTOR PrivateDispatchVector; - - // - // the device object that owns this fcb - // - - PRDBSS_DEVICE_OBJECT RxDeviceObject; - - PMINIRDR_DISPATCH MRxDispatch; - - // - // private fast dispatch table, if any. This allows lwio to add it's own hooks - // - - PFAST_IO_DISPATCH MRxFastIoDispatch; - - // - // Whenever a FCB instance is created a correpsonding SRV_OPEN and FOBX instance - // is also created. More than one SRV_OPEN can be associated with a given FCB and - // more than one FOBX is associated with a given SRV_OPEN. In a majority of the - // cases the number of SRV_OPENs associated with an FCB is one and the number of - // FOBX associated with a given SRV_OPEN is 1. In order to improve the spatial - // locality and the paging behaviour in such cases the allocation for the - // FCB also involves an allocation for the SRV_OPEN and FOBX. - // - - // - // set initially to the internally allocated srv_open - // - - PSRV_OPEN InternalSrvOpen; - - // - // set to internal fobx until allocated - // - - PFOBX InternalFobx; - - // - // the shared access for each time this file/directory is opened. - // - - SHARE_ACCESS ShareAccess; - SHARE_ACCESS ShareAccessPerSrvOpens; - - // - // this information is returned when the file is opened. ..might as well - // cache it so that so that tandard info query can be handled on the client - // side - // - - ULONG NumberOfLinks; - - // - // Cache these entries..... speeds up RxFastQueryBasicInfo(). - // - - LARGE_INTEGER CreationTime; - LARGE_INTEGER LastAccessTime; - LARGE_INTEGER LastWriteTime; - LARGE_INTEGER LastChangeTime; - - // - // used to check by mini redirs in order to decide whether to update the FCB - // - - ULONG ulFileSizeVersion; - - // - // The following field is used by the filelock module - // to maintain current byte range locking information. - // - - FILE_LOCK FileLock; - - // - // do this wierdly so that I can call stuff be the inner or outer names - // - - union { -#ifndef __cplusplus - LOWIO_PER_FCB_INFO; -#endif // __cplusplus - LOWIO_PER_FCB_INFO LowIoPerFcbInfo; - }; - -#ifdef USE_FILESIZE_LOCK - PFAST_MUTEX FileSizeLock; -#endif - - // - // The following field is used to verify that the Ea's for a file - // have not changed between calls to query for Ea's. It is compared - // with a similar field in a Fobx. - // - // IMPORTANT!! **** DO NOT MOVE THIS FIELD **** - // - // The slack space in the union above is computed from - // the field offset of the EaModificationCount. - // - - ULONG EaModificationCount; - - FCB_BUFFERED_LOCKS BufferedLocks; - -#if DBG - PNON_PAGED_FCB CopyOfNonPaged; // copy of NonPaged so we can zap the real pointer and still find it -#endif -#ifdef RDBSS_TRACKER - ULONG FcbAcquires[RX_FCBTRACKER_CASE_MAXIMUM]; // there are four types - ULONG FcbReleases[RX_FCBTRACKER_CASE_MAXIMUM]; -#else -#error tracker must be defined -#endif - - PCHAR PagingIoResourceFile; - ULONG PagingIoResourceLine; - -} FCB, *PFCB; - -// -// Here are the Fcb state fields. -// - -#define FCB_STATE_SRVOPEN_USED ( 0x80000000 ) -#define FCB_STATE_FOBX_USED ( 0x40000000 ) -#define FCB_STATE_ADDEDBACKSLASH ( 0x20000000 ) -#define FCB_STATE_NAME_ALREADY_REMOVED ( 0x10000000 ) -#define FCB_STATE_WRITECACHING_ENABLED ( 0x08000000 ) -#define FCB_STATE_WRITEBUFFERING_ENABLED ( 0x04000000 ) -#define FCB_STATE_READCACHING_ENABLED ( 0x02000000 ) -#define FCB_STATE_READBUFFERING_ENABLED ( 0x01000000 ) -#define FCB_STATE_OPENSHARING_ENABLED ( 0x00800000 ) -#define FCB_STATE_COLLAPSING_ENABLED ( 0x00400000 ) -#define FCB_STATE_LOCK_BUFFERING_ENABLED ( 0x00200000 ) -#define FCB_STATE_FILESIZECACHEING_ENABLED ( 0x00100000 ) -#define FCB_STATE_FILETIMECACHEING_ENABLED ( 0x00080000 ) -#define FCB_STATE_TIME_AND_SIZE_ALREADY_SET ( 0x00040000 ) -#define FCB_STATE_SPECIAL_PATH ( 0x00020000 ) -#define FCB_STATE_FILE_IS_SHADOWED ( 0x00010000 ) -#define FCB_STATE_FILE_IS_DISK_COMPRESSED ( 0x00008000 ) -#define FCB_STATE_FILE_IS_BUF_COMPRESSED ( 0x00004000 ) -#define FCB_STATE_BUFFERSTATE_CHANGING ( 0x00002000 ) -#define FCB_STATE_FAKEFCB ( 0x00001000 ) -#define FCB_STATE_DELAY_CLOSE ( 0x00000800 ) -#define FCB_STATE_READAHEAD_DEFERRED ( 0x00000100 ) -#define FCB_STATE_ORPHANED ( 0x00000080 ) -#define FCB_STATE_BUFFERING_STATE_CHANGE_PENDING ( 0x00000040 ) -#define FCB_STATE_TEMPORARY ( 0x00000020 ) -#define FCB_STATE_DISABLE_LOCAL_BUFFERING ( 0x00000010 ) -#define FCB_STATE_LWIO_ENABLED ( 0x00000008 ) -#define FCB_STATE_PAGING_FILE ( 0x00000004 ) -#define FCB_STATE_TRUNCATE_ON_CLOSE ( 0x00000002 ) -#define FCB_STATE_DELETE_ON_CLOSE ( 0x00000001 ) - -#define FCB_STATE_BUFFERING_STATE_MASK \ - (( FCB_STATE_WRITECACHING_ENABLED \ - | FCB_STATE_WRITEBUFFERING_ENABLED \ - | FCB_STATE_READCACHING_ENABLED \ - | FCB_STATE_READBUFFERING_ENABLED \ - | FCB_STATE_OPENSHARING_ENABLED \ - | FCB_STATE_COLLAPSING_ENABLED \ - | FCB_STATE_LOCK_BUFFERING_ENABLED \ - | FCB_STATE_FILESIZECACHEING_ENABLED \ - | FCB_STATE_FILETIMECACHEING_ENABLED )) -// -// This is the MAX recursive resource limit. -// - -#define MAX_FCB_ASYNC_ACQUIRE (0xf000) - -typedef struct _FCB_INIT_PACKET { - PULONG pAttributes; // in the fcb this is DirentRxFlags; - PULONG pNumLinks; // in the fcb this is NumberOfLinks; - PLARGE_INTEGER pCreationTime; // these fields are the same as for the Fcb - PLARGE_INTEGER pLastAccessTime; - PLARGE_INTEGER pLastWriteTime; - PLARGE_INTEGER pLastChangeTime; - PLARGE_INTEGER pAllocationSize; // common header fields - PLARGE_INTEGER pFileSize; - PLARGE_INTEGER pValidDataLength; -} FCB_INIT_PACKET; - -// -// A SRV_OPEN contains -// 0) signature and refcount -// a) backpointer to the FCB -// b) backpointer to the NET_ROOT //maybe -// c) a list of FOXB structures -// d) access rights and collapsability status -// . -// . -// z) whatever additional storage is request by the minirdr (or creator of the block). -// -// The SRV_OPEN points to a structure describing a spevific open on the -// server; multiple file objects and fileobject extensions (FOBXs) can -// share the same srvopen if the access rights are correct. For example, -// this would be where the FID is stored for SMBs. A list of these hangs -// from the FCB. Similarly, all fileobject extensionss that share the same -// serverside open are listed together here. Also here is information -// about whether a new open of this FCB can share this serverside open -// context; obviously the guys that pass the test on the list. -// - -// -// The SRVOPEN flags are split into two groups, i.e., visible to mini rdrs and invisible to mini rdrs. -// The visible ones are defined above and the definitions for the invisible ones can be found -// in fcb.h. The convention that has been adopted is that the lower 16 flags will be visible -// to the mini rdr and the upper 16 flags will be reserved for the wrapper. This needs to be -// enforced in defining new flags. -// - -#define SRVOPEN_FLAG_ENCLOSED_ALLOCATED (0x10000) -#define SRVOPEN_FLAG_FOBX_USED (0x20000) -#define SRVOPEN_FLAG_SHAREACCESS_UPDATED (0x40000) - -#ifdef __cplusplus -typedef struct _SRV_OPEN : public MRX_SRV_OPEN { -#else // !__cplusplus -typedef struct _SRV_OPEN { - - // - // the portion of SRV_OPEN visible to all the mini redirectors. - // - - union { - MRX_SRV_OPEN; - struct { - MRX_NORMAL_NODE_HEADER spacer; - - // - // the Fcb and VNetRoot for this srv_open - // - - PFCB Fcb; - PV_NET_ROOT VNetRoot; - }; - }; -#endif // !__cplusplus - - BOOLEAN UpperFinalizationDone; - - // - // the current condition of the SRV_OPEN, good/bad/in transition - // - - RX_BLOCK_CONDITION Condition; - - // - // Buffering state manager token - // - - __volatile LONG BufferingToken; - - // - // List Entry to thread together all the FCB instances marked - // for garbage collection/scavenging. - // - - LIST_ENTRY ScavengerFinalizationList; - - // - // The list of contexts whose processing has been suspended pending the state - // transition of the SRV_OPEN. - // - - LIST_ENTRY TransitionWaitList; - - // - // List Head for the list of FOBXs associated with this SRV_OPEN - // - - LIST_ENTRY FobxList; - - // - // The colocated instance of FOBX that is allocated whenever a SRV_OPEN - // instance is allocated. - // - - PFOBX InternalFobx; - - // - // the data structure for maintaining the mapping between the key - // associated with the SRV_OPEN instance by the mini redirector and - // the SRV_OPEN instance - // - - union { - LIST_ENTRY SrvOpenKeyList; - ULONG SequenceNumber; - }; - NTSTATUS OpenStatus; -} SRV_OPEN, *PSRV_OPEN; - -#define RxWriteCachingAllowed(FCB,SRVOPEN) \ - (FlagOn( (FCB)->FcbState, FCB_STATE_WRITECACHING_ENABLED ) && \ - !FlagOn( (SRVOPEN)->Flags, SRVOPEN_FLAG_DONTUSE_WRITE_CACHING )) - -#define SRVOPEN_INIT_KEY (0) - -// -// A FOBX contains -// 0) signature and refcount -// a) backpointer to the FCB -// b) backpointer to the SRV_OPEN -// c) context information about this open -// ... -// z) whatever additional storage is request by the minirdr (or creator of the block). -// -// The FOBX points to the "fileobject extension", i.e. all the stuff that -// is per fileobject is not stored there because the IO system provides -// fixed size filesystem objects (not a dig BTW, that's just the decision). -// The FOBX for any file object is referenced by the FsContext2 field in -// the fileobject. Even tho the FOBX is ordinarily a terminus in the -// structure, it is currently refcounted anyway. - -// The FOBX flags are split into two groups, i.e., visible to mini rdrs and invisible to mini rdrs. -// The visible ones are defined above and the definitions for the invisible ones can be found -// in fcb.h. The convention that has been adopted is that the lower 16 flags will be visible -// to the mini rdr and the upper 16 flags will be reserved for the wrapper. This needs to be -// enforced in defining new flags. -// - -#define FOBX_FLAG_MATCH_ALL (0x10000) - -// -// This tells us whether we allocated buffers to hold search templates. -// - -#define FOBX_FLAG_FREE_UNICODE (0x20000) - -// -// These flags prevents cleanup from updating the modify time, etc. -// - -#define FOBX_FLAG_USER_SET_LAST_WRITE (0x40000) -#define FOBX_FLAG_USER_SET_LAST_ACCESS (0x80000) -#define FOBX_FLAG_USER_SET_CREATION (0x100000) -#define FOBX_FLAG_USER_SET_LAST_CHANGE (0x200000) - -// -// This bit says the file object associated with this Fobx was opened for -// read only access. -// - -#define FOBX_FLAG_READ_ONLY (0x400000) - -// -// the delete on close flag is used to track a file object that was opened with delete-on-close; -// when this object is closed, we copy the bit to the fcb and make it global -// - -#define FOBX_FLAG_DELETE_ON_CLOSE (0x800000) - -// -// this bits is used by minirdrs that do not have NT semantics. for example, the smbmini has -// to close a file before it can try a rename or delete. after the operation, we prevent people from -// getting back in. -// - -#define FOBX_FLAG_SRVOPEN_CLOSED (0x1000000) - -// -// this bit is used to tell whether the original name was a UNC name so that -// we can return the name the same way -// - -#define FOBX_FLAG_UNC_NAME (0x2000000) - -// -// this flag tells if this fobx is allocated as part of a larger structure -// - -#define FOBX_FLAG_ENCLOSED_ALLOCATED (0x4000000) - -// -// this flag specfies if the FOBX was included in the count of dormant -// files against the server. -// - -#define FOBX_FLAG_MARKED_AS_DORMANT (0x8000000) - -// -// this flag notes down the fact that some writes have been issued on this FOBX -// this is used to issue flushes on close -// - -#define FOBX_FLAG_WRITES_ISSUED (0x10000000) - -#ifdef __cplusplus -typedef struct _FOBX : public MRX_FOBX { -#else // !__cplusplus -typedef struct _FOBX { - // - // the portion of FOBX visible to the mini redirectors - // - - union { - MRX_FOBX; - struct { - MRX_NORMAL_NODE_HEADER spacer; - PSRV_OPEN SrvOpen; - }; - }; -#endif // __cplusplus - - // - // a serial number....it wraps but not often - // - - __volatile ULONG FobxSerialNumber; - - // - // list entry to wire the FOBX to the list of FOBXs maintained in - // the associated SRV_OPEN - // - - LIST_ENTRY FobxQLinks; - - // - // list entry to gather all the FOBX instance marked for garbage collection - // scavenging - // - - LIST_ENTRY ScavengerFinalizationList; - - // - // list entry to thread together all the FOBXs which have a pending close - // operation. - // - - LIST_ENTRY ClosePendingList; - - LARGE_INTEGER CloseTime; - - BOOLEAN UpperFinalizationDone; - BOOLEAN ContainsWildCards; - BOOLEAN fOpenCountDecremented; - - // - // Parameters depending on the type of file opened, pipe/file etc. - // - - union { - - struct { - - union { -#ifndef __cplusplus - MRX_PIPE_HANDLE_INFORMATION; -#endif // __cplusplus - MRX_PIPE_HANDLE_INFORMATION PipeHandleInformation; - }; - - LARGE_INTEGER CollectDataTime; - ULONG CollectDataSize; - THROTTLING_STATE ThrottlingState; // for peek and read om msgmodepipes - - // - // these serialization Qs must be together - // and read must be the first - // - - LIST_ENTRY ReadSerializationQueue; - LIST_ENTRY WriteSerializationQueue; - } NamedPipe; - - struct { - RXVBO PredictedReadOffset; - RXVBO PredictedWriteOffset; - THROTTLING_STATE LockThrottlingState; // for locks - LARGE_INTEGER LastLockOffset; - LARGE_INTEGER LastLockRange; - } DiskFile; - } Specific; - - // - // Only required for finalization. - // We do not take a reference on the RxDeviceObject when copied from the FCB, - // as the FCB holds a reference, and FCB finalization will happen only after - // FOBX finalization. - // - - PRDBSS_DEVICE_OBJECT RxDeviceObject; - -} FOBX, *PFOBX; - - -#define FOBX_NUMBER_OF_SERIALIZATION_QUEUES 2 - -// -// The RDBSS wrapper relies upon ref. counting to mark the instances of -// various data structures. The following macros implement a debugging -// mechanism to track/log the reference counts associated with various -// data structures. A fine grained control to monitor each data structure -// separately is provided. Each of these can be further controlled to either -// print the tracking info or log it. -// - -#define RDBSS_REF_TRACK_SRVCALL (0x00000001) -#define RDBSS_REF_TRACK_NETROOT (0x00000002) -#define RDBSS_REF_TRACK_VNETROOT (0x00000004) -#define RDBSS_REF_TRACK_NETFOBX (0x00000008) -#define RDBSS_REF_TRACK_NETFCB (0x00000010) -#define RDBSS_REF_TRACK_SRVOPEN (0x00000020) - -#define RX_LOG_REF_TRACKING (0x80000000) -#define RX_PRINT_REF_TRACKING (0x40000000) - -// -// The reference count tracking mechanism is activated by setting the following -// variable to the appropriate value defined above. -// - -extern ULONG RdbssReferenceTracingValue; - -// -// Macros for tracking the line number and the file of each reference and -// derefernce on the data structure. on Non DBG builds they are defined as -// NOTHING. For each data structure the appropriate reference/dereference -// macro is defined, These should be used instead of raw manipulation of -// the reference counts. -// - -VOID -RxpTrackReference ( - __in ULONG TraceType, - __in PCSTR FileName, - __in ULONG Line, - __in PVOID Instance - ); - -BOOLEAN -RxpTrackDereference ( - __in ULONG TraceType, - __in PCSTR FileName, - __in ULONG Line, - __in PVOID Instance - ); - -#define REF_TRACING_ON(TraceMask) (TraceMask & RdbssReferenceTracingValue) -#define PRINT_REF_COUNT(TYPE,Count) \ - if (REF_TRACING_ON( RDBSS_REF_TRACK_ ## TYPE ) && \ - (RdbssReferenceTracingValue & RX_PRINT_REF_TRACKING)) { \ - DbgPrint("%ld\n",Count); \ - } - -#define RxReferenceSrvCallAtDpc(SrvCall) \ - RxpTrackReference( RDBSS_REF_TRACK_SRVCALL, __FILE__, __LINE__, SrvCall ); \ - ASSERT( SrvCall->NodeReferenceCount > 1 ); \ - InterlockedIncrement( &SrvCall->NodeReferenceCount ) - -#define RxReferenceSrvCall(SrvCall) \ - RxpTrackReference( RDBSS_REF_TRACK_SRVCALL, __FILE__, __LINE__, SrvCall ); \ - RxReference( SrvCall ) - -#define RxDereferenceSrvCall(SrvCall,LockHoldingState) \ - RxpTrackDereference( RDBSS_REF_TRACK_SRVCALL, __FILE__, __LINE__, SrvCall ); \ - RxDereference(SrvCall, LockHoldingState ) - -#define RxReferenceNetRoot(NetRoot) \ - RxpTrackReference( RDBSS_REF_TRACK_NETROOT, __FILE__, __LINE__, NetRoot ); \ - RxReference( NetRoot ) - -#define RxDereferenceNetRoot( NetRoot, LockHoldingState ) \ - RxpTrackDereference( RDBSS_REF_TRACK_NETROOT, __FILE__, __LINE__, NetRoot );\ - RxDereference( NetRoot, LockHoldingState ) - -#define RxReferenceVNetRoot(VNetRoot) \ - RxpTrackReference( RDBSS_REF_TRACK_VNETROOT, __FILE__, __LINE__, VNetRoot );\ - RxReference( VNetRoot ) - -#define RxDereferenceVNetRoot( VNetRoot, LockHoldingState ) \ - RxpTrackDereference( RDBSS_REF_TRACK_VNETROOT, __FILE__, __LINE__, VNetRoot ); \ - RxDereference( VNetRoot, LockHoldingState ) - -#define RxReferenceNetFobx(Fobx) \ - RxpTrackReference( RDBSS_REF_TRACK_NETFOBX, __FILE__, __LINE__, Fobx ); \ - RxReference( Fobx ) - -#define RxDereferenceNetFobx(Fobx,LockHoldingState) \ - RxpTrackDereference( RDBSS_REF_TRACK_NETFOBX, __FILE__, __LINE__, Fobx ); \ - RxDereference( Fobx, LockHoldingState ) - -#define RxReferenceSrvOpen(SrvOpen) \ - RxpTrackReference( RDBSS_REF_TRACK_SRVOPEN, __FILE__, __LINE__, SrvOpen ); \ - RxReference( SrvOpen ) - -#define RxDereferenceSrvOpen( SrvOpen, LockHoldingState ) \ - RxpTrackDereference( RDBSS_REF_TRACK_SRVOPEN, __FILE__, __LINE__, SrvOpen); \ - RxDereference( SrvOpen, LockHoldingState ) - -#define RxReferenceNetFcb(Fcb) \ - (RxpTrackReference( RDBSS_REF_TRACK_NETFCB, __FILE__, __LINE__, Fcb ), \ - RxpReferenceNetFcb( Fcb )) - -// -// the following macros manipulate the reference count and also return the -// status of the final derefence or finalize call. This results in the usage -// of the , operator. -// - -#define RxDereferenceNetFcb(Fcb) ( \ - ((LONG)RxpTrackDereference( RDBSS_REF_TRACK_NETFCB, __FILE__, __LINE__, Fcb )), \ - RxpDereferenceNetFcb( Fcb )) - -#define RxDereferenceAndFinalizeNetFcb(Fcb,RxContext,RecursiveFinalize,ForceFinalize) ( \ - RxpTrackDereference( RDBSS_REF_TRACK_NETFCB, __FILE__, __LINE__, Fcb ), \ - RxpDereferenceAndFinalizeNetFcb( Fcb, RxContext, RecursiveFinalize, ForceFinalize )) \ - -// -// Check for structure alignment errors -// - -VOID -RxCheckFcbStructuresForAlignment( - VOID - ); - - -// -// SRV_CALL related routines. -// - -PSRV_CALL -RxCreateSrvCall ( - IN PRX_CONTEXT RxContext, - IN PUNICODE_STRING Name, - IN PUNICODE_STRING InnerNamePrefix OPTIONAL, - IN PRX_CONNECTION_ID RxConnectionId - ); - - -#define RxWaitForStableSrvCall(SRVCALL,RXCONTEXT) { \ - RxDbgTrace( 0, Dbg, ("RxWaitForStableSrvCall -- %lx\n",(SRVCALL)) ); \ - RxWaitForStableCondition( &(SRVCALL)->Condition, &(SRVCALL)->TransitionWaitList, (RXCONTEXT), NULL); \ - } - -#define RxWaitForStableSrvCall_Async(SRVCALL,RXCONTEXT,PNTSTATUS) { \ - RxDbgTrace( 0, Dbg, ("RxWaitForStableSrvCall -- %lx\n",(SRVCALL)) ); \ - RxWaitForStableCondition( &(SRVCALL)->Condition, &(SRVCALL)->TransitionWaitList, (RXCONTEXT), (PNTSTATUS) ); \ - } - -#define RxTransitionSrvCall(SRVCALL,CONDITION) \ - RxDbgTrace( 0, Dbg, ("RxTransitionSrvCall -- %lx Condition -- %ld\n",(SRVCALL),(CONDITION)) ); \ - RxUpdateCondition( (CONDITION), &(SRVCALL)->Condition, &(SRVCALL)->TransitionWaitList ) - -BOOLEAN -RxFinalizeSrvCall ( - OUT PSRV_CALL ThisSrvCall, - IN BOOLEAN ForceFinalize - ); - -// -// NET_ROOT related routines. -// - -PNET_ROOT -RxCreateNetRoot ( - IN PSRV_CALL SrvCall, - IN PUNICODE_STRING Name, - IN ULONG NetRootFlags, - IN PRX_CONNECTION_ID OPTIONAL RxConnectionId - ); - -VOID -RxFinishNetRootInitialization ( - IN OUT PNET_ROOT ThisNetRoot, - IN PMINIRDR_DISPATCH Dispatch, - IN PUNICODE_STRING InnerNamePrefix, - IN ULONG FcbSize, - IN ULONG SrvOpenSize, - IN ULONG FobxSize, - IN ULONG NetRootFlags - ); - - -#define RxWaitForStableNetRoot(NETROOT,RXCONTEXT) \ - RxDbgTrace(0, Dbg, ("RxWaitForStableNetRoot -- %lx\n",(NETROOT))); \ - RxWaitForStableCondition(&(NETROOT)->Condition,&(NETROOT)->TransitionWaitList,(RXCONTEXT),NULL) - -#define RxTransitionNetRoot(NETROOT,CONDITION) \ - RxDbgTrace(0, Dbg, ("RxTransitionNetRoot -- %lx Condition -- %ld\n",(NETROOT),(CONDITION))); \ - RxUpdateCondition((CONDITION),&(NETROOT)->Condition,&(NETROOT)->TransitionWaitList) - -BOOLEAN -RxFinalizeNetRoot ( - OUT PNET_ROOT ThisNetRoot, - IN BOOLEAN RecursiveFinalize, - IN BOOLEAN ForceFinalize - ); - -// -// V_NET_ROOT related routines -// - -NTSTATUS -RxInitializeVNetRootParameters ( - PRX_CONTEXT RxContext, - OUT LUID *LogonId, - OUT PULONG SessionId, - OUT PUNICODE_STRING *UserNamePtr, - OUT PUNICODE_STRING *UserDomainNamePtr, - OUT PUNICODE_STRING *PasswordPtr, - OUT PULONG Flags - ); - -VOID -RxUninitializeVNetRootParameters ( - IN PUNICODE_STRING UserName, - IN PUNICODE_STRING UserDomainName, - IN PUNICODE_STRING Password, - OUT PULONG Flags - ); - -PV_NET_ROOT -RxCreateVNetRoot ( - IN PRX_CONTEXT RxContext, - IN PNET_ROOT NetRoot, - IN PUNICODE_STRING CanonicalName, - IN PUNICODE_STRING LocalNetRootName, - IN PUNICODE_STRING FilePath, - IN PRX_CONNECTION_ID RxConnectionId - ); - -BOOLEAN -RxFinalizeVNetRoot ( - OUT PV_NET_ROOT ThisVNetRoot, - IN BOOLEAN RecursiveFinalize, - IN BOOLEAN ForceFinalize - ); - -#define RxWaitForStableVNetRoot(VNETROOT,RXCONTEXT) \ - RxDbgTrace( 0, Dbg, ("RxWaitForStableVNetRoot -- %lx\n",(VNETROOT)) ); \ - RxWaitForStableCondition( &(VNETROOT)->Condition, &(VNETROOT)->TransitionWaitList, (RXCONTEXT), NULL ) - -#define RxTransitionVNetRoot(VNETROOT,CONDITION) \ - RxDbgTrace( 0, Dbg, ("RxTransitionVNetRoot -- %lx Condition -- %ld\n", (VNETROOT), (CONDITION)) ); \ - RxUpdateCondition( (CONDITION), &(VNETROOT)->Condition, &(VNETROOT)->TransitionWaitList ) - -#ifdef USE_FILESIZE_LOCK - -// -// FCB related routines. -// - -#define RxAcquireFileSizeLock(PFCB) { \ - ExAcquireFastMutex( (PFCB)->Specific.Fcb.FileSizeLock ); \ -} -#define RxReleaseFileSizeLock(PFCB) { \ - ExReleaseFastMutex((PFCB)->Specific.Fcb.FileSizeLock); \ -} - -#endif - -VOID -RxSetFileSizeWithLock ( - IN OUT PFCB Fcb, - IN PLONGLONG FileSize - ); - -VOID -RxGetFileSizeWithLock ( - IN PFCB Fcb, - OUT PLONGLONG FileSize - ); - -PFCB -RxCreateNetFcb ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp, - IN PV_NET_ROOT VNetRoot, - IN PUNICODE_STRING Name - ); - -#define RxWaitForStableNetFcb(FCB,RXCONTEXT) \ - RxDbgTrace( 0, Dbg, ("RxWaitForStableNetFcb -- %lx\n",(FCB))); \ - RxWaitForStableCondition( &(FCB)->Condition, &(FCB)->NonPaged->TransitionWaitList, (RXCONTEXT), NULL ) - -#define RxTransitionNetFcb(FCB,CONDITION) \ - RxDbgTrace( 0, Dbg, ("RxTransitionNetFcb -- %lx Condition -- %ld\n",(FCB),(CONDITION))); \ - RxUpdateCondition( (CONDITION), &(FCB)->Condition, &(FCB)->NonPaged->TransitionWaitList ) - - -#define RxFormInitPacket(IP,I1,I1a,I2,I3,I4a,I4b,I5,I6,I7) (\ - IP.pAttributes = I1, \ - IP.pNumLinks = I1a, \ - IP.pCreationTime = I2, \ - IP.pLastAccessTime = I3, \ - IP.pLastWriteTime = I4a, \ - IP.pLastChangeTime = I4b, \ - IP.pAllocationSize = I5, \ - IP.pFileSize = I6, \ - IP.pValidDataLength = I7, \ - &IP) - -#if DBG -#define ASSERT_CORRECT_FCB_STRUCTURE_DBG_ONLY(___thisfcb) {\ - ASSERT( ___thisfcb->NonPaged == ___thisfcb->CopyOfNonPaged ); \ - ASSERT( ___thisfcb->NonPaged->FcbBackPointer == ___thisfcb ); \ - } -#else -#define ASSERT_CORRECT_FCB_STRUCTURE_DBG_ONLY(___thisfcb) -#endif - -#define ASSERT_CORRECT_FCB_STRUCTURE(THIS_FCB__) { \ - ASSERT( NodeTypeIsFcb(THIS_FCB__)); \ - ASSERT( THIS_FCB__->NonPaged != NULL ); \ - ASSERT( NodeType(THIS_FCB__->NonPaged) == RDBSS_NTC_NONPAGED_FCB); \ - ASSERT_CORRECT_FCB_STRUCTURE_DBG_ONLY(THIS_FCB__) \ - } - -RX_FILE_TYPE -RxInferFileType ( - IN PRX_CONTEXT RxContext - ); - -VOID -RxFinishFcbInitialization ( - IN OUT PMRX_FCB Fcb, - IN RX_FILE_TYPE FileType, - IN PFCB_INIT_PACKET InitPacket OPTIONAL - ); - -#define RxWaitForStableSrvOpen(SRVOPEN,RXCONTEXT) \ - RxDbgTrace( 0, Dbg, ("RxWaitForStableFcb -- %lx\n",(SRVOPEN)) ); \ - RxWaitForStableCondition( &(SRVOPEN)->Condition, &(SRVOPEN)->TransitionWaitList, (RXCONTEXT), NULL ) - -#define RxTransitionSrvOpen(SRVOPEN,CONDITION) \ - RxDbgTrace( 0, Dbg, ("RxTransitionSrvOpen -- %lx Condition -- %ld\n",(SRVOPEN),(CONDITION)) ); \ - RxUpdateCondition( (CONDITION), &(SRVOPEN)->Condition, &(SRVOPEN)->TransitionWaitList ) - -VOID -RxRemoveNameNetFcb ( - OUT PFCB ThisFcb - ); - -LONG -RxpReferenceNetFcb ( - PFCB Fcb - ); - -LONG -RxpDereferenceNetFcb ( - PFCB Fcb - ); - -BOOLEAN -RxpDereferenceAndFinalizeNetFcb ( - OUT PFCB ThisFcb, - IN PRX_CONTEXT RxContext, - IN BOOLEAN RecursiveFinalize, - IN BOOLEAN ForceFinalize - ); - -#if DBG -extern BOOLEAN RxLoudFcbOpsOnExes; -BOOLEAN -RxLoudFcbMsg( - PUCHAR msg, - PUNICODE_STRING Name - ); -#else -#define RxLoudFcbMsg(a,b) (FALSE) -#endif - - -// -// SRV_OPEN related methods -// - -PSRV_OPEN -RxCreateSrvOpen ( - IN PV_NET_ROOT VNetRoot, - IN OUT PFCB Fcb - ); - -VOID -RxTransitionSrvOpenState ( - OUT PSRV_OPEN ThisSrvOpen, - IN RX_BLOCK_CONDITION Condition - ); - -BOOLEAN -RxFinalizeSrvOpen ( - OUT PSRV_OPEN ThisSrvOpen, - IN BOOLEAN RecursiveFinalize, - IN BOOLEAN ForceFinalize - ); - -#if 0 -#else -INLINE -PUNICODE_STRING -GET_ALREADY_PREFIXED_NAME ( - PMRX_SRV_OPEN SrvOpen, - PMRX_FCB Fcb) -{ - PFCB ThisFcb = (PFCB)Fcb; - -#if DBG - if (SrvOpen != NULL ) { - ASSERT( NodeType( SrvOpen ) == RDBSS_NTC_SRVOPEN ); - ASSERT( ThisFcb != NULL ); - ASSERT( NodeTypeIsFcb( Fcb) ); - ASSERT( SrvOpen->pFcb == Fcb ); - ASSERT( SrvOpen->pAlreadyPrefixedName == &ThisFcb->PrivateAlreadyPrefixedName ); - } -#endif - - return( &ThisFcb->PrivateAlreadyPrefixedName); -} -#endif - -#define GET_ALREADY_PREFIXED_NAME_FROM_CONTEXT(Rxcontext) \ - (GET_ALREADY_PREFIXED_NAME( (Rxcontext)->pRelevantSrvOpen, (Rxcontext)->pFcb )) - -// -// FOBX related routines -// - -PMRX_FOBX -RxCreateNetFobx ( - OUT PRX_CONTEXT RxContext, - IN PMRX_SRV_OPEN MrxSrvOpen - ); - -BOOLEAN -RxFinalizeNetFobx ( - OUT PFOBX ThisFobx, - IN BOOLEAN RecursiveFinalize, - IN BOOLEAN ForceFinalize - ); - -#endif // _FCB_STRUCTS_DEFINED_ - - diff --git a/pub/ddk/fcbtable.h b/pub/ddk/fcbtable.h deleted file mode 100644 index 084f418..0000000 --- a/pub/ddk/fcbtable.h +++ /dev/null @@ -1,153 +0,0 @@ -/*++ - -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 - diff --git a/pub/ddk/filterpipeline.h b/pub/ddk/filterpipeline.h deleted file mode 100644 index 12341ec..0000000 --- a/pub/ddk/filterpipeline.h +++ /dev/null @@ -1,3130 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for filterpipeline.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __filterpipeline_h__ -#define __filterpipeline_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IPrintReadStream_FWD_DEFINED__ -#define __IPrintReadStream_FWD_DEFINED__ -typedef interface IPrintReadStream IPrintReadStream; -#endif /* __IPrintReadStream_FWD_DEFINED__ */ - - -#ifndef __IPrintWriteStream_FWD_DEFINED__ -#define __IPrintWriteStream_FWD_DEFINED__ -typedef interface IPrintWriteStream IPrintWriteStream; -#endif /* __IPrintWriteStream_FWD_DEFINED__ */ - - -#ifndef __IPrintWriteStreamFlush_FWD_DEFINED__ -#define __IPrintWriteStreamFlush_FWD_DEFINED__ -typedef interface IPrintWriteStreamFlush IPrintWriteStreamFlush; -#endif /* __IPrintWriteStreamFlush_FWD_DEFINED__ */ - - -#ifndef __IInterFilterCommunicator_FWD_DEFINED__ -#define __IInterFilterCommunicator_FWD_DEFINED__ -typedef interface IInterFilterCommunicator IInterFilterCommunicator; -#endif /* __IInterFilterCommunicator_FWD_DEFINED__ */ - - -#ifndef __IPrintPipelineManagerControl_FWD_DEFINED__ -#define __IPrintPipelineManagerControl_FWD_DEFINED__ -typedef interface IPrintPipelineManagerControl IPrintPipelineManagerControl; -#endif /* __IPrintPipelineManagerControl_FWD_DEFINED__ */ - - -#ifndef __IPrintPipelinePropertyBag_FWD_DEFINED__ -#define __IPrintPipelinePropertyBag_FWD_DEFINED__ -typedef interface IPrintPipelinePropertyBag IPrintPipelinePropertyBag; -#endif /* __IPrintPipelinePropertyBag_FWD_DEFINED__ */ - - -#ifndef __IPrintPipelineProgressReport_FWD_DEFINED__ -#define __IPrintPipelineProgressReport_FWD_DEFINED__ -typedef interface IPrintPipelineProgressReport IPrintPipelineProgressReport; -#endif /* __IPrintPipelineProgressReport_FWD_DEFINED__ */ - - -#ifndef __IPrintClassObjectFactory_FWD_DEFINED__ -#define __IPrintClassObjectFactory_FWD_DEFINED__ -typedef interface IPrintClassObjectFactory IPrintClassObjectFactory; -#endif /* __IPrintClassObjectFactory_FWD_DEFINED__ */ - - -#ifndef __IPrintPipelineFilter_FWD_DEFINED__ -#define __IPrintPipelineFilter_FWD_DEFINED__ -typedef interface IPrintPipelineFilter IPrintPipelineFilter; -#endif /* __IPrintPipelineFilter_FWD_DEFINED__ */ - - -#ifndef __IXpsDocumentProvider_FWD_DEFINED__ -#define __IXpsDocumentProvider_FWD_DEFINED__ -typedef interface IXpsDocumentProvider IXpsDocumentProvider; -#endif /* __IXpsDocumentProvider_FWD_DEFINED__ */ - - -#ifndef __IXpsDocumentConsumer_FWD_DEFINED__ -#define __IXpsDocumentConsumer_FWD_DEFINED__ -typedef interface IXpsDocumentConsumer IXpsDocumentConsumer; -#endif /* __IXpsDocumentConsumer_FWD_DEFINED__ */ - - -#ifndef __IXpsDocument_FWD_DEFINED__ -#define __IXpsDocument_FWD_DEFINED__ -typedef interface IXpsDocument IXpsDocument; -#endif /* __IXpsDocument_FWD_DEFINED__ */ - - -#ifndef __IFixedDocumentSequence_FWD_DEFINED__ -#define __IFixedDocumentSequence_FWD_DEFINED__ -typedef interface IFixedDocumentSequence IFixedDocumentSequence; -#endif /* __IFixedDocumentSequence_FWD_DEFINED__ */ - - -#ifndef __IFixedDocument_FWD_DEFINED__ -#define __IFixedDocument_FWD_DEFINED__ -typedef interface IFixedDocument IFixedDocument; -#endif /* __IFixedDocument_FWD_DEFINED__ */ - - -#ifndef __IPartBase_FWD_DEFINED__ -#define __IPartBase_FWD_DEFINED__ -typedef interface IPartBase IPartBase; -#endif /* __IPartBase_FWD_DEFINED__ */ - - -#ifndef __IFixedPage_FWD_DEFINED__ -#define __IFixedPage_FWD_DEFINED__ -typedef interface IFixedPage IFixedPage; -#endif /* __IFixedPage_FWD_DEFINED__ */ - - -#ifndef __IPartImage_FWD_DEFINED__ -#define __IPartImage_FWD_DEFINED__ -typedef interface IPartImage IPartImage; -#endif /* __IPartImage_FWD_DEFINED__ */ - - -#ifndef __IPartFont_FWD_DEFINED__ -#define __IPartFont_FWD_DEFINED__ -typedef interface IPartFont IPartFont; -#endif /* __IPartFont_FWD_DEFINED__ */ - - -#ifndef __IPartFont2_FWD_DEFINED__ -#define __IPartFont2_FWD_DEFINED__ -typedef interface IPartFont2 IPartFont2; -#endif /* __IPartFont2_FWD_DEFINED__ */ - - -#ifndef __IPartThumbnail_FWD_DEFINED__ -#define __IPartThumbnail_FWD_DEFINED__ -typedef interface IPartThumbnail IPartThumbnail; -#endif /* __IPartThumbnail_FWD_DEFINED__ */ - - -#ifndef __IPartPrintTicket_FWD_DEFINED__ -#define __IPartPrintTicket_FWD_DEFINED__ -typedef interface IPartPrintTicket IPartPrintTicket; -#endif /* __IPartPrintTicket_FWD_DEFINED__ */ - - -#ifndef __IPartColorProfile_FWD_DEFINED__ -#define __IPartColorProfile_FWD_DEFINED__ -typedef interface IPartColorProfile IPartColorProfile; -#endif /* __IPartColorProfile_FWD_DEFINED__ */ - - -#ifndef __IPartResourceDictionary_FWD_DEFINED__ -#define __IPartResourceDictionary_FWD_DEFINED__ -typedef interface IPartResourceDictionary IPartResourceDictionary; -#endif /* __IPartResourceDictionary_FWD_DEFINED__ */ - - -#ifndef __IXpsPartIterator_FWD_DEFINED__ -#define __IXpsPartIterator_FWD_DEFINED__ -typedef interface IXpsPartIterator IXpsPartIterator; -#endif /* __IXpsPartIterator_FWD_DEFINED__ */ - - -#ifndef __IPrintReadStreamFactory_FWD_DEFINED__ -#define __IPrintReadStreamFactory_FWD_DEFINED__ -typedef interface IPrintReadStreamFactory IPrintReadStreamFactory; -#endif /* __IPrintReadStreamFactory_FWD_DEFINED__ */ - - -#ifndef __IPartDiscardControl_FWD_DEFINED__ -#define __IPartDiscardControl_FWD_DEFINED__ -typedef interface IPartDiscardControl IPartDiscardControl; -#endif /* __IPartDiscardControl_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" -#include "imgerror.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_filterpipeline_0000_0000 */ -/* [local] */ - -//+------------------------------------------------------------------------- -// -// Microsoft Windows -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//-------------------------------------------------------------------------- -#define E_ELEMENT_NOT_FOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND) -#define XPS_FP_PRINTER_NAME L"PrinterName" -#define XPS_FP_PROGRESS_REPORT L"ProgressReport" -#define XPS_FP_PRINTER_HANDLE L"PrinterHandle" -#define XPS_FP_USER_PRINT_TICKET L"PerUserPrintTicket" -#define XPS_FP_USER_TOKEN L"UserSecurityToken" -#define XPS_FP_JOB_ID L"PrintJobId" -#define XPS_FP_PRINT_CLASS_FACTORY L"PrintClassFactory" -#define XPS_FP_OUTPUT_FILE L"PrintOutputFileName" - - - - - - - - - - - - - - - - - - - - - - -typedef /* [public][public][public] */ -enum __MIDL___MIDL_itf_filterpipeline_0000_0000_0001 - { Compression_NotCompressed = 0, - Compression_Normal = ( Compression_NotCompressed + 1 ) , - Compression_Small = ( Compression_Normal + 1 ) , - Compression_Fast = ( Compression_Small + 1 ) - } EXpsCompressionOptions; - -typedef /* [public][public][public] */ -enum __MIDL___MIDL_itf_filterpipeline_0000_0000_0002 - { Font_Normal = 0, - Font_Obfusticate = ( Font_Normal + 1 ) - } EXpsFontOptions; - -typedef /* [public][public] */ -enum __MIDL___MIDL_itf_filterpipeline_0000_0000_0003 - { XpsJob_DocumentSequenceAdded = 0, - XpsJob_FixedDocumentAdded = ( XpsJob_DocumentSequenceAdded + 1 ) , - XpsJob_FixedPageAdded = ( XpsJob_FixedDocumentAdded + 1 ) - } EXpsJobConsumption; - -typedef /* [public][public] */ -enum __MIDL___MIDL_itf_filterpipeline_0000_0000_0004 - { Xps_Restricted_Font_Installable = 0, - Xps_Restricted_Font_NoEmbedding = 0x2, - Xps_Restricted_Font_PreviewPrint = 0x4, - Xps_Restricted_Font_Editable = 0x8 - } EXpsFontRestriction; - - - -extern RPC_IF_HANDLE __MIDL_itf_filterpipeline_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_filterpipeline_0000_0000_v0_0_s_ifspec; - -#ifndef __IPrintReadStream_INTERFACE_DEFINED__ -#define __IPrintReadStream_INTERFACE_DEFINED__ - -/* interface IPrintReadStream */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPrintReadStream; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4d47a67c-66cc-4430-850e-daf466fe5bc4") - IPrintReadStream : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Seek( - /* [annotation][in] */ - __in LONGLONG dlibMove, - /* [annotation][in] */ - __in DWORD dwOrigin, - /* [annotation][out] */ - __out ULONGLONG *plibNewPosition) = 0; - - virtual HRESULT STDMETHODCALLTYPE ReadBytes( - /* [annotation][length_is][size_is][out] */ - __out_bcount_part(cbRequested, *pcbRead) void *pvBuffer, - /* [annotation][in] */ - __in ULONG cbRequested, - /* [annotation][out] */ - __out ULONG *pcbRead, - /* [annotation][out] */ - __out BOOL *pbEndOfFile) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPrintReadStreamVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPrintReadStream * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPrintReadStream * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPrintReadStream * This); - - HRESULT ( STDMETHODCALLTYPE *Seek )( - IPrintReadStream * This, - /* [annotation][in] */ - __in LONGLONG dlibMove, - /* [annotation][in] */ - __in DWORD dwOrigin, - /* [annotation][out] */ - __out ULONGLONG *plibNewPosition); - - HRESULT ( STDMETHODCALLTYPE *ReadBytes )( - IPrintReadStream * This, - /* [annotation][length_is][size_is][out] */ - __out_bcount_part(cbRequested, *pcbRead) void *pvBuffer, - /* [annotation][in] */ - __in ULONG cbRequested, - /* [annotation][out] */ - __out ULONG *pcbRead, - /* [annotation][out] */ - __out BOOL *pbEndOfFile); - - END_INTERFACE - } IPrintReadStreamVtbl; - - interface IPrintReadStream - { - CONST_VTBL struct IPrintReadStreamVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPrintReadStream_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPrintReadStream_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPrintReadStream_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPrintReadStream_Seek(This,dlibMove,dwOrigin,plibNewPosition) \ - ( (This)->lpVtbl -> Seek(This,dlibMove,dwOrigin,plibNewPosition) ) - -#define IPrintReadStream_ReadBytes(This,pvBuffer,cbRequested,pcbRead,pbEndOfFile) \ - ( (This)->lpVtbl -> ReadBytes(This,pvBuffer,cbRequested,pcbRead,pbEndOfFile) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPrintReadStream_INTERFACE_DEFINED__ */ - - -#ifndef __IPrintWriteStream_INTERFACE_DEFINED__ -#define __IPrintWriteStream_INTERFACE_DEFINED__ - -/* interface IPrintWriteStream */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPrintWriteStream; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("65bb7f1b-371e-4571-8ac7-912f510c1a38") - IPrintWriteStream : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE WriteBytes( - /* [annotation][size_is][in] */ - __in_bcount(cbBuffer) const void *pvBuffer, - /* [annotation][in] */ - __in ULONG cbBuffer, - /* [annotation][out] */ - __out ULONG *pcbWritten) = 0; - - virtual void STDMETHODCALLTYPE Close( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPrintWriteStreamVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPrintWriteStream * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPrintWriteStream * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPrintWriteStream * This); - - HRESULT ( STDMETHODCALLTYPE *WriteBytes )( - IPrintWriteStream * This, - /* [annotation][size_is][in] */ - __in_bcount(cbBuffer) const void *pvBuffer, - /* [annotation][in] */ - __in ULONG cbBuffer, - /* [annotation][out] */ - __out ULONG *pcbWritten); - - void ( STDMETHODCALLTYPE *Close )( - IPrintWriteStream * This); - - END_INTERFACE - } IPrintWriteStreamVtbl; - - interface IPrintWriteStream - { - CONST_VTBL struct IPrintWriteStreamVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPrintWriteStream_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPrintWriteStream_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPrintWriteStream_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPrintWriteStream_WriteBytes(This,pvBuffer,cbBuffer,pcbWritten) \ - ( (This)->lpVtbl -> WriteBytes(This,pvBuffer,cbBuffer,pcbWritten) ) - -#define IPrintWriteStream_Close(This) \ - ( (This)->lpVtbl -> Close(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPrintWriteStream_INTERFACE_DEFINED__ */ - - -#ifndef __IPrintWriteStreamFlush_INTERFACE_DEFINED__ -#define __IPrintWriteStreamFlush_INTERFACE_DEFINED__ - -/* interface IPrintWriteStreamFlush */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPrintWriteStreamFlush; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("07d11ff8-1753-4873-b749-6cdaf068e4c3") - IPrintWriteStreamFlush : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE FlushData( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPrintWriteStreamFlushVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPrintWriteStreamFlush * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPrintWriteStreamFlush * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPrintWriteStreamFlush * This); - - HRESULT ( STDMETHODCALLTYPE *FlushData )( - IPrintWriteStreamFlush * This); - - END_INTERFACE - } IPrintWriteStreamFlushVtbl; - - interface IPrintWriteStreamFlush - { - CONST_VTBL struct IPrintWriteStreamFlushVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPrintWriteStreamFlush_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPrintWriteStreamFlush_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPrintWriteStreamFlush_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPrintWriteStreamFlush_FlushData(This) \ - ( (This)->lpVtbl -> FlushData(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPrintWriteStreamFlush_INTERFACE_DEFINED__ */ - - -#ifndef __IInterFilterCommunicator_INTERFACE_DEFINED__ -#define __IInterFilterCommunicator_INTERFACE_DEFINED__ - -/* interface IInterFilterCommunicator */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IInterFilterCommunicator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4daf1e69-81fd-462d-940f-8cd3ddf56fca") - IInterFilterCommunicator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE RequestReader( - /* [annotation][out] */ - __out void **ppIReader) = 0; - - virtual HRESULT STDMETHODCALLTYPE RequestWriter( - /* [annotation][out] */ - __out void **ppIWriter) = 0; - - }; - -#else /* C style interface */ - - typedef struct IInterFilterCommunicatorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IInterFilterCommunicator * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IInterFilterCommunicator * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IInterFilterCommunicator * This); - - HRESULT ( STDMETHODCALLTYPE *RequestReader )( - IInterFilterCommunicator * This, - /* [annotation][out] */ - __out void **ppIReader); - - HRESULT ( STDMETHODCALLTYPE *RequestWriter )( - IInterFilterCommunicator * This, - /* [annotation][out] */ - __out void **ppIWriter); - - END_INTERFACE - } IInterFilterCommunicatorVtbl; - - interface IInterFilterCommunicator - { - CONST_VTBL struct IInterFilterCommunicatorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IInterFilterCommunicator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IInterFilterCommunicator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IInterFilterCommunicator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IInterFilterCommunicator_RequestReader(This,ppIReader) \ - ( (This)->lpVtbl -> RequestReader(This,ppIReader) ) - -#define IInterFilterCommunicator_RequestWriter(This,ppIWriter) \ - ( (This)->lpVtbl -> RequestWriter(This,ppIWriter) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IInterFilterCommunicator_INTERFACE_DEFINED__ */ - - -#ifndef __IPrintPipelineManagerControl_INTERFACE_DEFINED__ -#define __IPrintPipelineManagerControl_INTERFACE_DEFINED__ - -/* interface IPrintPipelineManagerControl */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPrintPipelineManagerControl; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("aa3e4910-5889-4681-91ef-823ad4ed4e44") - IPrintPipelineManagerControl : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE RequestShutdown( - /* [annotation][in] */ - __in HRESULT hrReason, - /* [annotation][in] */ - __in IImgErrorInfo *pReason) = 0; - - virtual HRESULT STDMETHODCALLTYPE FilterFinished( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPrintPipelineManagerControlVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPrintPipelineManagerControl * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPrintPipelineManagerControl * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPrintPipelineManagerControl * This); - - HRESULT ( STDMETHODCALLTYPE *RequestShutdown )( - IPrintPipelineManagerControl * This, - /* [annotation][in] */ - __in HRESULT hrReason, - /* [annotation][in] */ - __in IImgErrorInfo *pReason); - - HRESULT ( STDMETHODCALLTYPE *FilterFinished )( - IPrintPipelineManagerControl * This); - - END_INTERFACE - } IPrintPipelineManagerControlVtbl; - - interface IPrintPipelineManagerControl - { - CONST_VTBL struct IPrintPipelineManagerControlVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPrintPipelineManagerControl_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPrintPipelineManagerControl_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPrintPipelineManagerControl_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPrintPipelineManagerControl_RequestShutdown(This,hrReason,pReason) \ - ( (This)->lpVtbl -> RequestShutdown(This,hrReason,pReason) ) - -#define IPrintPipelineManagerControl_FilterFinished(This) \ - ( (This)->lpVtbl -> FilterFinished(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPrintPipelineManagerControl_INTERFACE_DEFINED__ */ - - -#ifndef __IPrintPipelinePropertyBag_INTERFACE_DEFINED__ -#define __IPrintPipelinePropertyBag_INTERFACE_DEFINED__ - -/* interface IPrintPipelinePropertyBag */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPrintPipelinePropertyBag; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("8b8c99dc-7892-4a95-8a04-57422e9fbb47") - IPrintPipelinePropertyBag : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE AddProperty( - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pszName, - /* [annotation][in] */ - __in const VARIANT *pVar) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetProperty( - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pszName, - /* [annotation][out] */ - __out VARIANT *pVar) = 0; - - virtual BOOL STDMETHODCALLTYPE DeleteProperty( - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pszName) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPrintPipelinePropertyBagVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPrintPipelinePropertyBag * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPrintPipelinePropertyBag * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPrintPipelinePropertyBag * This); - - HRESULT ( STDMETHODCALLTYPE *AddProperty )( - IPrintPipelinePropertyBag * This, - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pszName, - /* [annotation][in] */ - __in const VARIANT *pVar); - - HRESULT ( STDMETHODCALLTYPE *GetProperty )( - IPrintPipelinePropertyBag * This, - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pszName, - /* [annotation][out] */ - __out VARIANT *pVar); - - BOOL ( STDMETHODCALLTYPE *DeleteProperty )( - IPrintPipelinePropertyBag * This, - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pszName); - - END_INTERFACE - } IPrintPipelinePropertyBagVtbl; - - interface IPrintPipelinePropertyBag - { - CONST_VTBL struct IPrintPipelinePropertyBagVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPrintPipelinePropertyBag_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPrintPipelinePropertyBag_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPrintPipelinePropertyBag_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPrintPipelinePropertyBag_AddProperty(This,pszName,pVar) \ - ( (This)->lpVtbl -> AddProperty(This,pszName,pVar) ) - -#define IPrintPipelinePropertyBag_GetProperty(This,pszName,pVar) \ - ( (This)->lpVtbl -> GetProperty(This,pszName,pVar) ) - -#define IPrintPipelinePropertyBag_DeleteProperty(This,pszName) \ - ( (This)->lpVtbl -> DeleteProperty(This,pszName) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPrintPipelinePropertyBag_INTERFACE_DEFINED__ */ - - -#ifndef __IPrintPipelineProgressReport_INTERFACE_DEFINED__ -#define __IPrintPipelineProgressReport_INTERFACE_DEFINED__ - -/* interface IPrintPipelineProgressReport */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPrintPipelineProgressReport; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("edc12c7c-ed40-4ea5-96a6-5e4397497a61") - IPrintPipelineProgressReport : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ReportProgress( - /* [annotation][in] */ - __in EXpsJobConsumption update) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPrintPipelineProgressReportVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPrintPipelineProgressReport * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPrintPipelineProgressReport * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPrintPipelineProgressReport * This); - - HRESULT ( STDMETHODCALLTYPE *ReportProgress )( - IPrintPipelineProgressReport * This, - /* [annotation][in] */ - __in EXpsJobConsumption update); - - END_INTERFACE - } IPrintPipelineProgressReportVtbl; - - interface IPrintPipelineProgressReport - { - CONST_VTBL struct IPrintPipelineProgressReportVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPrintPipelineProgressReport_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPrintPipelineProgressReport_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPrintPipelineProgressReport_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPrintPipelineProgressReport_ReportProgress(This,update) \ - ( (This)->lpVtbl -> ReportProgress(This,update) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPrintPipelineProgressReport_INTERFACE_DEFINED__ */ - - -#ifndef __IPrintClassObjectFactory_INTERFACE_DEFINED__ -#define __IPrintClassObjectFactory_INTERFACE_DEFINED__ - -/* interface IPrintClassObjectFactory */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPrintClassObjectFactory; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9af593dd-9b02-48a8-9bad-69ace423f88b") - IPrintClassObjectFactory : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetPrintClassObject( - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pszPrinterName, - /* [annotation][in] */ - __in REFIID riid, - /* [annotation][iid_is][out] */ - __deref_out void **ppNewObject) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPrintClassObjectFactoryVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPrintClassObjectFactory * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPrintClassObjectFactory * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPrintClassObjectFactory * This); - - HRESULT ( STDMETHODCALLTYPE *GetPrintClassObject )( - IPrintClassObjectFactory * This, - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pszPrinterName, - /* [annotation][in] */ - __in REFIID riid, - /* [annotation][iid_is][out] */ - __deref_out void **ppNewObject); - - END_INTERFACE - } IPrintClassObjectFactoryVtbl; - - interface IPrintClassObjectFactory - { - CONST_VTBL struct IPrintClassObjectFactoryVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPrintClassObjectFactory_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPrintClassObjectFactory_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPrintClassObjectFactory_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPrintClassObjectFactory_GetPrintClassObject(This,pszPrinterName,riid,ppNewObject) \ - ( (This)->lpVtbl -> GetPrintClassObject(This,pszPrinterName,riid,ppNewObject) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPrintClassObjectFactory_INTERFACE_DEFINED__ */ - - -#ifndef __IPrintPipelineFilter_INTERFACE_DEFINED__ -#define __IPrintPipelineFilter_INTERFACE_DEFINED__ - -/* interface IPrintPipelineFilter */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPrintPipelineFilter; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("cdb62fc0-8bed-434e-86fb-a2cae55f19ea") - IPrintPipelineFilter : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE InitializeFilter( - /* [annotation][in] */ - __in IInterFilterCommunicator *pINegotiation, - /* [annotation][in] */ - __in IPrintPipelinePropertyBag *pIPropertyBag, - /* [annotation][in] */ - __in IPrintPipelineManagerControl *pIPipelineControl) = 0; - - virtual HRESULT STDMETHODCALLTYPE ShutdownOperation( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartOperation( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPrintPipelineFilterVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPrintPipelineFilter * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPrintPipelineFilter * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPrintPipelineFilter * This); - - HRESULT ( STDMETHODCALLTYPE *InitializeFilter )( - IPrintPipelineFilter * This, - /* [annotation][in] */ - __in IInterFilterCommunicator *pINegotiation, - /* [annotation][in] */ - __in IPrintPipelinePropertyBag *pIPropertyBag, - /* [annotation][in] */ - __in IPrintPipelineManagerControl *pIPipelineControl); - - HRESULT ( STDMETHODCALLTYPE *ShutdownOperation )( - IPrintPipelineFilter * This); - - HRESULT ( STDMETHODCALLTYPE *StartOperation )( - IPrintPipelineFilter * This); - - END_INTERFACE - } IPrintPipelineFilterVtbl; - - interface IPrintPipelineFilter - { - CONST_VTBL struct IPrintPipelineFilterVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPrintPipelineFilter_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPrintPipelineFilter_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPrintPipelineFilter_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPrintPipelineFilter_InitializeFilter(This,pINegotiation,pIPropertyBag,pIPipelineControl) \ - ( (This)->lpVtbl -> InitializeFilter(This,pINegotiation,pIPropertyBag,pIPipelineControl) ) - -#define IPrintPipelineFilter_ShutdownOperation(This) \ - ( (This)->lpVtbl -> ShutdownOperation(This) ) - -#define IPrintPipelineFilter_StartOperation(This) \ - ( (This)->lpVtbl -> StartOperation(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPrintPipelineFilter_INTERFACE_DEFINED__ */ - - -#ifndef __IXpsDocumentProvider_INTERFACE_DEFINED__ -#define __IXpsDocumentProvider_INTERFACE_DEFINED__ - -/* interface IXpsDocumentProvider */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IXpsDocumentProvider; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("b8cf8530-5562-47c4-ab67-b1f69ecf961e") - IXpsDocumentProvider : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetXpsPart( - /* [annotation][out] */ - __deref_out IUnknown **ppIXpsPart) = 0; - - }; - -#else /* C style interface */ - - typedef struct IXpsDocumentProviderVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IXpsDocumentProvider * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IXpsDocumentProvider * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IXpsDocumentProvider * This); - - HRESULT ( STDMETHODCALLTYPE *GetXpsPart )( - IXpsDocumentProvider * This, - /* [annotation][out] */ - __deref_out IUnknown **ppIXpsPart); - - END_INTERFACE - } IXpsDocumentProviderVtbl; - - interface IXpsDocumentProvider - { - CONST_VTBL struct IXpsDocumentProviderVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IXpsDocumentProvider_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IXpsDocumentProvider_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IXpsDocumentProvider_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IXpsDocumentProvider_GetXpsPart(This,ppIXpsPart) \ - ( (This)->lpVtbl -> GetXpsPart(This,ppIXpsPart) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IXpsDocumentProvider_INTERFACE_DEFINED__ */ - - -#ifndef __IXpsDocumentConsumer_INTERFACE_DEFINED__ -#define __IXpsDocumentConsumer_INTERFACE_DEFINED__ - -/* interface IXpsDocumentConsumer */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IXpsDocumentConsumer; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4368d8a2-4181-4a9f-b295-3d9a38bb9ba0") - IXpsDocumentConsumer : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SendXpsUnknown( - /* [annotation][in] */ - __in IUnknown *pUnknown) = 0; - - virtual HRESULT STDMETHODCALLTYPE SendXpsDocument( - /* [annotation][in] */ - __in IXpsDocument *pIXpsDocument) = 0; - - virtual HRESULT STDMETHODCALLTYPE SendFixedDocumentSequence( - /* [annotation][in] */ - __in IFixedDocumentSequence *pIFixedDocumentSequence) = 0; - - virtual HRESULT STDMETHODCALLTYPE SendFixedDocument( - /* [annotation][in] */ - __in IFixedDocument *pIFixedDocument) = 0; - - virtual HRESULT STDMETHODCALLTYPE SendFixedPage( - /* [annotation][in] */ - __in IFixedPage *pIFixedPage) = 0; - - virtual HRESULT STDMETHODCALLTYPE CloseSender( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNewEmptyPart( - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *uri, - /* [annotation][in] */ - __in REFIID riid, - /* [annotation][iid_is][out] */ - __deref_out void **ppNewObject, - /* [annotation][out] */ - __deref_out IPrintWriteStream **ppWriteStream) = 0; - - }; - -#else /* C style interface */ - - typedef struct IXpsDocumentConsumerVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IXpsDocumentConsumer * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IXpsDocumentConsumer * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IXpsDocumentConsumer * This); - - HRESULT ( STDMETHODCALLTYPE *SendXpsUnknown )( - IXpsDocumentConsumer * This, - /* [annotation][in] */ - __in IUnknown *pUnknown); - - HRESULT ( STDMETHODCALLTYPE *SendXpsDocument )( - IXpsDocumentConsumer * This, - /* [annotation][in] */ - __in IXpsDocument *pIXpsDocument); - - HRESULT ( STDMETHODCALLTYPE *SendFixedDocumentSequence )( - IXpsDocumentConsumer * This, - /* [annotation][in] */ - __in IFixedDocumentSequence *pIFixedDocumentSequence); - - HRESULT ( STDMETHODCALLTYPE *SendFixedDocument )( - IXpsDocumentConsumer * This, - /* [annotation][in] */ - __in IFixedDocument *pIFixedDocument); - - HRESULT ( STDMETHODCALLTYPE *SendFixedPage )( - IXpsDocumentConsumer * This, - /* [annotation][in] */ - __in IFixedPage *pIFixedPage); - - HRESULT ( STDMETHODCALLTYPE *CloseSender )( - IXpsDocumentConsumer * This); - - HRESULT ( STDMETHODCALLTYPE *GetNewEmptyPart )( - IXpsDocumentConsumer * This, - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *uri, - /* [annotation][in] */ - __in REFIID riid, - /* [annotation][iid_is][out] */ - __deref_out void **ppNewObject, - /* [annotation][out] */ - __deref_out IPrintWriteStream **ppWriteStream); - - END_INTERFACE - } IXpsDocumentConsumerVtbl; - - interface IXpsDocumentConsumer - { - CONST_VTBL struct IXpsDocumentConsumerVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IXpsDocumentConsumer_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IXpsDocumentConsumer_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IXpsDocumentConsumer_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IXpsDocumentConsumer_SendXpsUnknown(This,pUnknown) \ - ( (This)->lpVtbl -> SendXpsUnknown(This,pUnknown) ) - -#define IXpsDocumentConsumer_SendXpsDocument(This,pIXpsDocument) \ - ( (This)->lpVtbl -> SendXpsDocument(This,pIXpsDocument) ) - -#define IXpsDocumentConsumer_SendFixedDocumentSequence(This,pIFixedDocumentSequence) \ - ( (This)->lpVtbl -> SendFixedDocumentSequence(This,pIFixedDocumentSequence) ) - -#define IXpsDocumentConsumer_SendFixedDocument(This,pIFixedDocument) \ - ( (This)->lpVtbl -> SendFixedDocument(This,pIFixedDocument) ) - -#define IXpsDocumentConsumer_SendFixedPage(This,pIFixedPage) \ - ( (This)->lpVtbl -> SendFixedPage(This,pIFixedPage) ) - -#define IXpsDocumentConsumer_CloseSender(This) \ - ( (This)->lpVtbl -> CloseSender(This) ) - -#define IXpsDocumentConsumer_GetNewEmptyPart(This,uri,riid,ppNewObject,ppWriteStream) \ - ( (This)->lpVtbl -> GetNewEmptyPart(This,uri,riid,ppNewObject,ppWriteStream) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IXpsDocumentConsumer_INTERFACE_DEFINED__ */ - - -#ifndef __IXpsDocument_INTERFACE_DEFINED__ -#define __IXpsDocument_INTERFACE_DEFINED__ - -/* interface IXpsDocument */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IXpsDocument; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("e8d907db-62a9-4a95-abe7-e01763dd30f8") - IXpsDocument : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetThumbnail( - /* [annotation][out] */ - __deref_out IPartThumbnail **ppThumbnail) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetThumbnail( - /* [annotation][in] */ - __in IPartThumbnail *pThumbnail) = 0; - - }; - -#else /* C style interface */ - - typedef struct IXpsDocumentVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IXpsDocument * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IXpsDocument * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IXpsDocument * This); - - HRESULT ( STDMETHODCALLTYPE *GetThumbnail )( - IXpsDocument * This, - /* [annotation][out] */ - __deref_out IPartThumbnail **ppThumbnail); - - HRESULT ( STDMETHODCALLTYPE *SetThumbnail )( - IXpsDocument * This, - /* [annotation][in] */ - __in IPartThumbnail *pThumbnail); - - END_INTERFACE - } IXpsDocumentVtbl; - - interface IXpsDocument - { - CONST_VTBL struct IXpsDocumentVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IXpsDocument_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IXpsDocument_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IXpsDocument_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IXpsDocument_GetThumbnail(This,ppThumbnail) \ - ( (This)->lpVtbl -> GetThumbnail(This,ppThumbnail) ) - -#define IXpsDocument_SetThumbnail(This,pThumbnail) \ - ( (This)->lpVtbl -> SetThumbnail(This,pThumbnail) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IXpsDocument_INTERFACE_DEFINED__ */ - - -#ifndef __IFixedDocumentSequence_INTERFACE_DEFINED__ -#define __IFixedDocumentSequence_INTERFACE_DEFINED__ - -/* interface IFixedDocumentSequence */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IFixedDocumentSequence; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("8028d181-2c32-4249-8493-1bfb22045574") - IFixedDocumentSequence : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetUri( - /* [annotation][out] */ - __out BSTR *uri) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPrintTicket( - /* [annotation][out] */ - __deref_out IPartPrintTicket **ppPrintTicket) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPrintTicket( - /* [annotation][in] */ - __in IPartPrintTicket *pPrintTicket) = 0; - - }; - -#else /* C style interface */ - - typedef struct IFixedDocumentSequenceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IFixedDocumentSequence * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IFixedDocumentSequence * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IFixedDocumentSequence * This); - - HRESULT ( STDMETHODCALLTYPE *GetUri )( - IFixedDocumentSequence * This, - /* [annotation][out] */ - __out BSTR *uri); - - HRESULT ( STDMETHODCALLTYPE *GetPrintTicket )( - IFixedDocumentSequence * This, - /* [annotation][out] */ - __deref_out IPartPrintTicket **ppPrintTicket); - - HRESULT ( STDMETHODCALLTYPE *SetPrintTicket )( - IFixedDocumentSequence * This, - /* [annotation][in] */ - __in IPartPrintTicket *pPrintTicket); - - END_INTERFACE - } IFixedDocumentSequenceVtbl; - - interface IFixedDocumentSequence - { - CONST_VTBL struct IFixedDocumentSequenceVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IFixedDocumentSequence_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IFixedDocumentSequence_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IFixedDocumentSequence_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IFixedDocumentSequence_GetUri(This,uri) \ - ( (This)->lpVtbl -> GetUri(This,uri) ) - -#define IFixedDocumentSequence_GetPrintTicket(This,ppPrintTicket) \ - ( (This)->lpVtbl -> GetPrintTicket(This,ppPrintTicket) ) - -#define IFixedDocumentSequence_SetPrintTicket(This,pPrintTicket) \ - ( (This)->lpVtbl -> SetPrintTicket(This,pPrintTicket) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IFixedDocumentSequence_INTERFACE_DEFINED__ */ - - -#ifndef __IFixedDocument_INTERFACE_DEFINED__ -#define __IFixedDocument_INTERFACE_DEFINED__ - -/* interface IFixedDocument */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IFixedDocument; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("f222ca9f-9968-4db9-81bd-abaebf15f93f") - IFixedDocument : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetUri( - /* [annotation][out] */ - __out BSTR *uri) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPrintTicket( - /* [annotation][out] */ - __deref_out IPartPrintTicket **ppPrintTicket) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPrintTicket( - /* [annotation][in] */ - __in IPartPrintTicket *pPrintTicket) = 0; - - }; - -#else /* C style interface */ - - typedef struct IFixedDocumentVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IFixedDocument * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IFixedDocument * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IFixedDocument * This); - - HRESULT ( STDMETHODCALLTYPE *GetUri )( - IFixedDocument * This, - /* [annotation][out] */ - __out BSTR *uri); - - HRESULT ( STDMETHODCALLTYPE *GetPrintTicket )( - IFixedDocument * This, - /* [annotation][out] */ - __deref_out IPartPrintTicket **ppPrintTicket); - - HRESULT ( STDMETHODCALLTYPE *SetPrintTicket )( - IFixedDocument * This, - /* [annotation][in] */ - __in IPartPrintTicket *pPrintTicket); - - END_INTERFACE - } IFixedDocumentVtbl; - - interface IFixedDocument - { - CONST_VTBL struct IFixedDocumentVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IFixedDocument_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IFixedDocument_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IFixedDocument_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IFixedDocument_GetUri(This,uri) \ - ( (This)->lpVtbl -> GetUri(This,uri) ) - -#define IFixedDocument_GetPrintTicket(This,ppPrintTicket) \ - ( (This)->lpVtbl -> GetPrintTicket(This,ppPrintTicket) ) - -#define IFixedDocument_SetPrintTicket(This,pPrintTicket) \ - ( (This)->lpVtbl -> SetPrintTicket(This,pPrintTicket) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IFixedDocument_INTERFACE_DEFINED__ */ - - -#ifndef __IPartBase_INTERFACE_DEFINED__ -#define __IPartBase_INTERFACE_DEFINED__ - -/* interface IPartBase */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPartBase; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("36d51e28-369e-43ba-a666-9540c62c3f58") - IPartBase : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetUri( - /* [annotation][out] */ - __out BSTR *uri) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStream( - /* [annotation][out] */ - __deref_out IPrintReadStream **ppStream) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPartCompression( - /* [annotation][out] */ - __out EXpsCompressionOptions *pCompression) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPartCompression( - /* [annotation][in] */ - __in EXpsCompressionOptions compression) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPartBaseVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPartBase * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPartBase * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPartBase * This); - - HRESULT ( STDMETHODCALLTYPE *GetUri )( - IPartBase * This, - /* [annotation][out] */ - __out BSTR *uri); - - HRESULT ( STDMETHODCALLTYPE *GetStream )( - IPartBase * This, - /* [annotation][out] */ - __deref_out IPrintReadStream **ppStream); - - HRESULT ( STDMETHODCALLTYPE *GetPartCompression )( - IPartBase * This, - /* [annotation][out] */ - __out EXpsCompressionOptions *pCompression); - - HRESULT ( STDMETHODCALLTYPE *SetPartCompression )( - IPartBase * This, - /* [annotation][in] */ - __in EXpsCompressionOptions compression); - - END_INTERFACE - } IPartBaseVtbl; - - interface IPartBase - { - CONST_VTBL struct IPartBaseVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPartBase_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPartBase_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPartBase_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPartBase_GetUri(This,uri) \ - ( (This)->lpVtbl -> GetUri(This,uri) ) - -#define IPartBase_GetStream(This,ppStream) \ - ( (This)->lpVtbl -> GetStream(This,ppStream) ) - -#define IPartBase_GetPartCompression(This,pCompression) \ - ( (This)->lpVtbl -> GetPartCompression(This,pCompression) ) - -#define IPartBase_SetPartCompression(This,compression) \ - ( (This)->lpVtbl -> SetPartCompression(This,compression) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPartBase_INTERFACE_DEFINED__ */ - - -#ifndef __IFixedPage_INTERFACE_DEFINED__ -#define __IFixedPage_INTERFACE_DEFINED__ - -/* interface IFixedPage */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IFixedPage; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("3d9f6448-7e95-4cb5-94fb-0180c2883a57") - IFixedPage : public IPartBase - { - public: - virtual HRESULT STDMETHODCALLTYPE GetPrintTicket( - /* [annotation][out] */ - __deref_out IPartPrintTicket **ppPrintTicket) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPagePart( - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *uri, - /* [annotation][out] */ - __deref_out IUnknown **ppUnk) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetWriteStream( - /* [annotation][out] */ - __deref_out IPrintWriteStream **ppWriteStream) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPrintTicket( - /* [annotation][in] */ - __in IPartPrintTicket *ppPrintTicket) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPagePart( - /* [annotation][in] */ - __in IUnknown *pUnk) = 0; - - virtual HRESULT STDMETHODCALLTYPE DeleteResource( - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *uri) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetXpsPartIterator( - /* [annotation][out] */ - __deref_out IXpsPartIterator **pXpsPartIt) = 0; - - }; - -#else /* C style interface */ - - typedef struct IFixedPageVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IFixedPage * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IFixedPage * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IFixedPage * This); - - HRESULT ( STDMETHODCALLTYPE *GetUri )( - IFixedPage * This, - /* [annotation][out] */ - __out BSTR *uri); - - HRESULT ( STDMETHODCALLTYPE *GetStream )( - IFixedPage * This, - /* [annotation][out] */ - __deref_out IPrintReadStream **ppStream); - - HRESULT ( STDMETHODCALLTYPE *GetPartCompression )( - IFixedPage * This, - /* [annotation][out] */ - __out EXpsCompressionOptions *pCompression); - - HRESULT ( STDMETHODCALLTYPE *SetPartCompression )( - IFixedPage * This, - /* [annotation][in] */ - __in EXpsCompressionOptions compression); - - HRESULT ( STDMETHODCALLTYPE *GetPrintTicket )( - IFixedPage * This, - /* [annotation][out] */ - __deref_out IPartPrintTicket **ppPrintTicket); - - HRESULT ( STDMETHODCALLTYPE *GetPagePart )( - IFixedPage * This, - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *uri, - /* [annotation][out] */ - __deref_out IUnknown **ppUnk); - - HRESULT ( STDMETHODCALLTYPE *GetWriteStream )( - IFixedPage * This, - /* [annotation][out] */ - __deref_out IPrintWriteStream **ppWriteStream); - - HRESULT ( STDMETHODCALLTYPE *SetPrintTicket )( - IFixedPage * This, - /* [annotation][in] */ - __in IPartPrintTicket *ppPrintTicket); - - HRESULT ( STDMETHODCALLTYPE *SetPagePart )( - IFixedPage * This, - /* [annotation][in] */ - __in IUnknown *pUnk); - - HRESULT ( STDMETHODCALLTYPE *DeleteResource )( - IFixedPage * This, - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *uri); - - HRESULT ( STDMETHODCALLTYPE *GetXpsPartIterator )( - IFixedPage * This, - /* [annotation][out] */ - __deref_out IXpsPartIterator **pXpsPartIt); - - END_INTERFACE - } IFixedPageVtbl; - - interface IFixedPage - { - CONST_VTBL struct IFixedPageVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IFixedPage_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IFixedPage_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IFixedPage_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IFixedPage_GetUri(This,uri) \ - ( (This)->lpVtbl -> GetUri(This,uri) ) - -#define IFixedPage_GetStream(This,ppStream) \ - ( (This)->lpVtbl -> GetStream(This,ppStream) ) - -#define IFixedPage_GetPartCompression(This,pCompression) \ - ( (This)->lpVtbl -> GetPartCompression(This,pCompression) ) - -#define IFixedPage_SetPartCompression(This,compression) \ - ( (This)->lpVtbl -> SetPartCompression(This,compression) ) - - -#define IFixedPage_GetPrintTicket(This,ppPrintTicket) \ - ( (This)->lpVtbl -> GetPrintTicket(This,ppPrintTicket) ) - -#define IFixedPage_GetPagePart(This,uri,ppUnk) \ - ( (This)->lpVtbl -> GetPagePart(This,uri,ppUnk) ) - -#define IFixedPage_GetWriteStream(This,ppWriteStream) \ - ( (This)->lpVtbl -> GetWriteStream(This,ppWriteStream) ) - -#define IFixedPage_SetPrintTicket(This,ppPrintTicket) \ - ( (This)->lpVtbl -> SetPrintTicket(This,ppPrintTicket) ) - -#define IFixedPage_SetPagePart(This,pUnk) \ - ( (This)->lpVtbl -> SetPagePart(This,pUnk) ) - -#define IFixedPage_DeleteResource(This,uri) \ - ( (This)->lpVtbl -> DeleteResource(This,uri) ) - -#define IFixedPage_GetXpsPartIterator(This,pXpsPartIt) \ - ( (This)->lpVtbl -> GetXpsPartIterator(This,pXpsPartIt) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IFixedPage_INTERFACE_DEFINED__ */ - - -#ifndef __IPartImage_INTERFACE_DEFINED__ -#define __IPartImage_INTERFACE_DEFINED__ - -/* interface IPartImage */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPartImage; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("725f2e3c-401a-4705-9de0-fe6f1353b87f") - IPartImage : public IPartBase - { - public: - virtual HRESULT STDMETHODCALLTYPE GetImageProperties( - /* [annotation][out] */ - __out BSTR *pContentType) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetImageContent( - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pContentType) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPartImageVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPartImage * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPartImage * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPartImage * This); - - HRESULT ( STDMETHODCALLTYPE *GetUri )( - IPartImage * This, - /* [annotation][out] */ - __out BSTR *uri); - - HRESULT ( STDMETHODCALLTYPE *GetStream )( - IPartImage * This, - /* [annotation][out] */ - __deref_out IPrintReadStream **ppStream); - - HRESULT ( STDMETHODCALLTYPE *GetPartCompression )( - IPartImage * This, - /* [annotation][out] */ - __out EXpsCompressionOptions *pCompression); - - HRESULT ( STDMETHODCALLTYPE *SetPartCompression )( - IPartImage * This, - /* [annotation][in] */ - __in EXpsCompressionOptions compression); - - HRESULT ( STDMETHODCALLTYPE *GetImageProperties )( - IPartImage * This, - /* [annotation][out] */ - __out BSTR *pContentType); - - HRESULT ( STDMETHODCALLTYPE *SetImageContent )( - IPartImage * This, - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pContentType); - - END_INTERFACE - } IPartImageVtbl; - - interface IPartImage - { - CONST_VTBL struct IPartImageVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPartImage_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPartImage_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPartImage_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPartImage_GetUri(This,uri) \ - ( (This)->lpVtbl -> GetUri(This,uri) ) - -#define IPartImage_GetStream(This,ppStream) \ - ( (This)->lpVtbl -> GetStream(This,ppStream) ) - -#define IPartImage_GetPartCompression(This,pCompression) \ - ( (This)->lpVtbl -> GetPartCompression(This,pCompression) ) - -#define IPartImage_SetPartCompression(This,compression) \ - ( (This)->lpVtbl -> SetPartCompression(This,compression) ) - - -#define IPartImage_GetImageProperties(This,pContentType) \ - ( (This)->lpVtbl -> GetImageProperties(This,pContentType) ) - -#define IPartImage_SetImageContent(This,pContentType) \ - ( (This)->lpVtbl -> SetImageContent(This,pContentType) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPartImage_INTERFACE_DEFINED__ */ - - -#ifndef __IPartFont_INTERFACE_DEFINED__ -#define __IPartFont_INTERFACE_DEFINED__ - -/* interface IPartFont */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPartFont; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("e07fe0ab-1124-43d0-a865-e8ffb6a3ea82") - IPartFont : public IPartBase - { - public: - virtual HRESULT STDMETHODCALLTYPE GetFontProperties( - /* [annotation][out] */ - __out BSTR *pContentType, - /* [annotation][out] */ - __out EXpsFontOptions *pFontOptions) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFontContent( - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pContentType) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFontOptions( - /* [annotation][in] */ - __in EXpsFontOptions options) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPartFontVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPartFont * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPartFont * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPartFont * This); - - HRESULT ( STDMETHODCALLTYPE *GetUri )( - IPartFont * This, - /* [annotation][out] */ - __out BSTR *uri); - - HRESULT ( STDMETHODCALLTYPE *GetStream )( - IPartFont * This, - /* [annotation][out] */ - __deref_out IPrintReadStream **ppStream); - - HRESULT ( STDMETHODCALLTYPE *GetPartCompression )( - IPartFont * This, - /* [annotation][out] */ - __out EXpsCompressionOptions *pCompression); - - HRESULT ( STDMETHODCALLTYPE *SetPartCompression )( - IPartFont * This, - /* [annotation][in] */ - __in EXpsCompressionOptions compression); - - HRESULT ( STDMETHODCALLTYPE *GetFontProperties )( - IPartFont * This, - /* [annotation][out] */ - __out BSTR *pContentType, - /* [annotation][out] */ - __out EXpsFontOptions *pFontOptions); - - HRESULT ( STDMETHODCALLTYPE *SetFontContent )( - IPartFont * This, - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pContentType); - - HRESULT ( STDMETHODCALLTYPE *SetFontOptions )( - IPartFont * This, - /* [annotation][in] */ - __in EXpsFontOptions options); - - END_INTERFACE - } IPartFontVtbl; - - interface IPartFont - { - CONST_VTBL struct IPartFontVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPartFont_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPartFont_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPartFont_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPartFont_GetUri(This,uri) \ - ( (This)->lpVtbl -> GetUri(This,uri) ) - -#define IPartFont_GetStream(This,ppStream) \ - ( (This)->lpVtbl -> GetStream(This,ppStream) ) - -#define IPartFont_GetPartCompression(This,pCompression) \ - ( (This)->lpVtbl -> GetPartCompression(This,pCompression) ) - -#define IPartFont_SetPartCompression(This,compression) \ - ( (This)->lpVtbl -> SetPartCompression(This,compression) ) - - -#define IPartFont_GetFontProperties(This,pContentType,pFontOptions) \ - ( (This)->lpVtbl -> GetFontProperties(This,pContentType,pFontOptions) ) - -#define IPartFont_SetFontContent(This,pContentType) \ - ( (This)->lpVtbl -> SetFontContent(This,pContentType) ) - -#define IPartFont_SetFontOptions(This,options) \ - ( (This)->lpVtbl -> SetFontOptions(This,options) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPartFont_INTERFACE_DEFINED__ */ - - -#ifndef __IPartFont2_INTERFACE_DEFINED__ -#define __IPartFont2_INTERFACE_DEFINED__ - -/* interface IPartFont2 */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPartFont2; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("511e025f-d6cb-43be-bf65-63fe88515a39") - IPartFont2 : public IPartFont - { - public: - virtual HRESULT STDMETHODCALLTYPE GetFontRestriction( - /* [annotation][out] */ - __out EXpsFontRestriction *pRestriction) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPartFont2Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPartFont2 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPartFont2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPartFont2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetUri )( - IPartFont2 * This, - /* [annotation][out] */ - __out BSTR *uri); - - HRESULT ( STDMETHODCALLTYPE *GetStream )( - IPartFont2 * This, - /* [annotation][out] */ - __deref_out IPrintReadStream **ppStream); - - HRESULT ( STDMETHODCALLTYPE *GetPartCompression )( - IPartFont2 * This, - /* [annotation][out] */ - __out EXpsCompressionOptions *pCompression); - - HRESULT ( STDMETHODCALLTYPE *SetPartCompression )( - IPartFont2 * This, - /* [annotation][in] */ - __in EXpsCompressionOptions compression); - - HRESULT ( STDMETHODCALLTYPE *GetFontProperties )( - IPartFont2 * This, - /* [annotation][out] */ - __out BSTR *pContentType, - /* [annotation][out] */ - __out EXpsFontOptions *pFontOptions); - - HRESULT ( STDMETHODCALLTYPE *SetFontContent )( - IPartFont2 * This, - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pContentType); - - HRESULT ( STDMETHODCALLTYPE *SetFontOptions )( - IPartFont2 * This, - /* [annotation][in] */ - __in EXpsFontOptions options); - - HRESULT ( STDMETHODCALLTYPE *GetFontRestriction )( - IPartFont2 * This, - /* [annotation][out] */ - __out EXpsFontRestriction *pRestriction); - - END_INTERFACE - } IPartFont2Vtbl; - - interface IPartFont2 - { - CONST_VTBL struct IPartFont2Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPartFont2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPartFont2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPartFont2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPartFont2_GetUri(This,uri) \ - ( (This)->lpVtbl -> GetUri(This,uri) ) - -#define IPartFont2_GetStream(This,ppStream) \ - ( (This)->lpVtbl -> GetStream(This,ppStream) ) - -#define IPartFont2_GetPartCompression(This,pCompression) \ - ( (This)->lpVtbl -> GetPartCompression(This,pCompression) ) - -#define IPartFont2_SetPartCompression(This,compression) \ - ( (This)->lpVtbl -> SetPartCompression(This,compression) ) - - -#define IPartFont2_GetFontProperties(This,pContentType,pFontOptions) \ - ( (This)->lpVtbl -> GetFontProperties(This,pContentType,pFontOptions) ) - -#define IPartFont2_SetFontContent(This,pContentType) \ - ( (This)->lpVtbl -> SetFontContent(This,pContentType) ) - -#define IPartFont2_SetFontOptions(This,options) \ - ( (This)->lpVtbl -> SetFontOptions(This,options) ) - - -#define IPartFont2_GetFontRestriction(This,pRestriction) \ - ( (This)->lpVtbl -> GetFontRestriction(This,pRestriction) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPartFont2_INTERFACE_DEFINED__ */ - - -#ifndef __IPartThumbnail_INTERFACE_DEFINED__ -#define __IPartThumbnail_INTERFACE_DEFINED__ - -/* interface IPartThumbnail */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPartThumbnail; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("027ed1c9-ba39-4cc5-aa55-7ec3a0de171a") - IPartThumbnail : public IPartBase - { - public: - virtual HRESULT STDMETHODCALLTYPE GetThumbnailProperties( - /* [annotation][out] */ - __out BSTR *pContentType) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetThumbnailContent( - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pContentType) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPartThumbnailVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPartThumbnail * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPartThumbnail * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPartThumbnail * This); - - HRESULT ( STDMETHODCALLTYPE *GetUri )( - IPartThumbnail * This, - /* [annotation][out] */ - __out BSTR *uri); - - HRESULT ( STDMETHODCALLTYPE *GetStream )( - IPartThumbnail * This, - /* [annotation][out] */ - __deref_out IPrintReadStream **ppStream); - - HRESULT ( STDMETHODCALLTYPE *GetPartCompression )( - IPartThumbnail * This, - /* [annotation][out] */ - __out EXpsCompressionOptions *pCompression); - - HRESULT ( STDMETHODCALLTYPE *SetPartCompression )( - IPartThumbnail * This, - /* [annotation][in] */ - __in EXpsCompressionOptions compression); - - HRESULT ( STDMETHODCALLTYPE *GetThumbnailProperties )( - IPartThumbnail * This, - /* [annotation][out] */ - __out BSTR *pContentType); - - HRESULT ( STDMETHODCALLTYPE *SetThumbnailContent )( - IPartThumbnail * This, - /* [annotation][string][in] */ - __in __nullterminated const wchar_t *pContentType); - - END_INTERFACE - } IPartThumbnailVtbl; - - interface IPartThumbnail - { - CONST_VTBL struct IPartThumbnailVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPartThumbnail_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPartThumbnail_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPartThumbnail_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPartThumbnail_GetUri(This,uri) \ - ( (This)->lpVtbl -> GetUri(This,uri) ) - -#define IPartThumbnail_GetStream(This,ppStream) \ - ( (This)->lpVtbl -> GetStream(This,ppStream) ) - -#define IPartThumbnail_GetPartCompression(This,pCompression) \ - ( (This)->lpVtbl -> GetPartCompression(This,pCompression) ) - -#define IPartThumbnail_SetPartCompression(This,compression) \ - ( (This)->lpVtbl -> SetPartCompression(This,compression) ) - - -#define IPartThumbnail_GetThumbnailProperties(This,pContentType) \ - ( (This)->lpVtbl -> GetThumbnailProperties(This,pContentType) ) - -#define IPartThumbnail_SetThumbnailContent(This,pContentType) \ - ( (This)->lpVtbl -> SetThumbnailContent(This,pContentType) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPartThumbnail_INTERFACE_DEFINED__ */ - - -#ifndef __IPartPrintTicket_INTERFACE_DEFINED__ -#define __IPartPrintTicket_INTERFACE_DEFINED__ - -/* interface IPartPrintTicket */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPartPrintTicket; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4a0f50f6-f9a2-41f0-99e7-5ae955be8e9e") - IPartPrintTicket : public IPartBase - { - public: - }; - -#else /* C style interface */ - - typedef struct IPartPrintTicketVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPartPrintTicket * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPartPrintTicket * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPartPrintTicket * This); - - HRESULT ( STDMETHODCALLTYPE *GetUri )( - IPartPrintTicket * This, - /* [annotation][out] */ - __out BSTR *uri); - - HRESULT ( STDMETHODCALLTYPE *GetStream )( - IPartPrintTicket * This, - /* [annotation][out] */ - __deref_out IPrintReadStream **ppStream); - - HRESULT ( STDMETHODCALLTYPE *GetPartCompression )( - IPartPrintTicket * This, - /* [annotation][out] */ - __out EXpsCompressionOptions *pCompression); - - HRESULT ( STDMETHODCALLTYPE *SetPartCompression )( - IPartPrintTicket * This, - /* [annotation][in] */ - __in EXpsCompressionOptions compression); - - END_INTERFACE - } IPartPrintTicketVtbl; - - interface IPartPrintTicket - { - CONST_VTBL struct IPartPrintTicketVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPartPrintTicket_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPartPrintTicket_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPartPrintTicket_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPartPrintTicket_GetUri(This,uri) \ - ( (This)->lpVtbl -> GetUri(This,uri) ) - -#define IPartPrintTicket_GetStream(This,ppStream) \ - ( (This)->lpVtbl -> GetStream(This,ppStream) ) - -#define IPartPrintTicket_GetPartCompression(This,pCompression) \ - ( (This)->lpVtbl -> GetPartCompression(This,pCompression) ) - -#define IPartPrintTicket_SetPartCompression(This,compression) \ - ( (This)->lpVtbl -> SetPartCompression(This,compression) ) - - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPartPrintTicket_INTERFACE_DEFINED__ */ - - -#ifndef __IPartColorProfile_INTERFACE_DEFINED__ -#define __IPartColorProfile_INTERFACE_DEFINED__ - -/* interface IPartColorProfile */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPartColorProfile; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("63cca95b-7d18-4762-b15e-98658693d24a") - IPartColorProfile : public IPartBase - { - public: - }; - -#else /* C style interface */ - - typedef struct IPartColorProfileVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPartColorProfile * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPartColorProfile * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPartColorProfile * This); - - HRESULT ( STDMETHODCALLTYPE *GetUri )( - IPartColorProfile * This, - /* [annotation][out] */ - __out BSTR *uri); - - HRESULT ( STDMETHODCALLTYPE *GetStream )( - IPartColorProfile * This, - /* [annotation][out] */ - __deref_out IPrintReadStream **ppStream); - - HRESULT ( STDMETHODCALLTYPE *GetPartCompression )( - IPartColorProfile * This, - /* [annotation][out] */ - __out EXpsCompressionOptions *pCompression); - - HRESULT ( STDMETHODCALLTYPE *SetPartCompression )( - IPartColorProfile * This, - /* [annotation][in] */ - __in EXpsCompressionOptions compression); - - END_INTERFACE - } IPartColorProfileVtbl; - - interface IPartColorProfile - { - CONST_VTBL struct IPartColorProfileVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPartColorProfile_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPartColorProfile_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPartColorProfile_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPartColorProfile_GetUri(This,uri) \ - ( (This)->lpVtbl -> GetUri(This,uri) ) - -#define IPartColorProfile_GetStream(This,ppStream) \ - ( (This)->lpVtbl -> GetStream(This,ppStream) ) - -#define IPartColorProfile_GetPartCompression(This,pCompression) \ - ( (This)->lpVtbl -> GetPartCompression(This,pCompression) ) - -#define IPartColorProfile_SetPartCompression(This,compression) \ - ( (This)->lpVtbl -> SetPartCompression(This,compression) ) - - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPartColorProfile_INTERFACE_DEFINED__ */ - - -#ifndef __IPartResourceDictionary_INTERFACE_DEFINED__ -#define __IPartResourceDictionary_INTERFACE_DEFINED__ - -/* interface IPartResourceDictionary */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPartResourceDictionary; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("16cfce6d-e744-4fb3-b474-f1d54f024a01") - IPartResourceDictionary : public IPartBase - { - public: - }; - -#else /* C style interface */ - - typedef struct IPartResourceDictionaryVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPartResourceDictionary * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPartResourceDictionary * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPartResourceDictionary * This); - - HRESULT ( STDMETHODCALLTYPE *GetUri )( - IPartResourceDictionary * This, - /* [annotation][out] */ - __out BSTR *uri); - - HRESULT ( STDMETHODCALLTYPE *GetStream )( - IPartResourceDictionary * This, - /* [annotation][out] */ - __deref_out IPrintReadStream **ppStream); - - HRESULT ( STDMETHODCALLTYPE *GetPartCompression )( - IPartResourceDictionary * This, - /* [annotation][out] */ - __out EXpsCompressionOptions *pCompression); - - HRESULT ( STDMETHODCALLTYPE *SetPartCompression )( - IPartResourceDictionary * This, - /* [annotation][in] */ - __in EXpsCompressionOptions compression); - - END_INTERFACE - } IPartResourceDictionaryVtbl; - - interface IPartResourceDictionary - { - CONST_VTBL struct IPartResourceDictionaryVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPartResourceDictionary_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPartResourceDictionary_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPartResourceDictionary_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPartResourceDictionary_GetUri(This,uri) \ - ( (This)->lpVtbl -> GetUri(This,uri) ) - -#define IPartResourceDictionary_GetStream(This,ppStream) \ - ( (This)->lpVtbl -> GetStream(This,ppStream) ) - -#define IPartResourceDictionary_GetPartCompression(This,pCompression) \ - ( (This)->lpVtbl -> GetPartCompression(This,pCompression) ) - -#define IPartResourceDictionary_SetPartCompression(This,compression) \ - ( (This)->lpVtbl -> SetPartCompression(This,compression) ) - - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPartResourceDictionary_INTERFACE_DEFINED__ */ - - -#ifndef __IXpsPartIterator_INTERFACE_DEFINED__ -#define __IXpsPartIterator_INTERFACE_DEFINED__ - -/* interface IXpsPartIterator */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IXpsPartIterator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("0021d3cd-af6f-42ab-9999-14bc82a62d2e") - IXpsPartIterator : public IUnknown - { - public: - virtual void STDMETHODCALLTYPE Reset( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Current( - /* [annotation][out] */ - __out BSTR *pUri, - /* [annotation][out] */ - __deref_out IUnknown **ppXpsPart) = 0; - - virtual BOOL STDMETHODCALLTYPE IsDone( void) = 0; - - virtual void STDMETHODCALLTYPE Next( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IXpsPartIteratorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IXpsPartIterator * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IXpsPartIterator * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IXpsPartIterator * This); - - void ( STDMETHODCALLTYPE *Reset )( - IXpsPartIterator * This); - - HRESULT ( STDMETHODCALLTYPE *Current )( - IXpsPartIterator * This, - /* [annotation][out] */ - __out BSTR *pUri, - /* [annotation][out] */ - __deref_out IUnknown **ppXpsPart); - - BOOL ( STDMETHODCALLTYPE *IsDone )( - IXpsPartIterator * This); - - void ( STDMETHODCALLTYPE *Next )( - IXpsPartIterator * This); - - END_INTERFACE - } IXpsPartIteratorVtbl; - - interface IXpsPartIterator - { - CONST_VTBL struct IXpsPartIteratorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IXpsPartIterator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IXpsPartIterator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IXpsPartIterator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IXpsPartIterator_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IXpsPartIterator_Current(This,pUri,ppXpsPart) \ - ( (This)->lpVtbl -> Current(This,pUri,ppXpsPart) ) - -#define IXpsPartIterator_IsDone(This) \ - ( (This)->lpVtbl -> IsDone(This) ) - -#define IXpsPartIterator_Next(This) \ - ( (This)->lpVtbl -> Next(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IXpsPartIterator_INTERFACE_DEFINED__ */ - - -#ifndef __IPrintReadStreamFactory_INTERFACE_DEFINED__ -#define __IPrintReadStreamFactory_INTERFACE_DEFINED__ - -/* interface IPrintReadStreamFactory */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPrintReadStreamFactory; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("acb971e3-df8d-4fc2-bee6-0609d15f3cf9") - IPrintReadStreamFactory : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetStream( - /* [annotation][out] */ - __deref_out IPrintReadStream **ppStream) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPrintReadStreamFactoryVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPrintReadStreamFactory * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPrintReadStreamFactory * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPrintReadStreamFactory * This); - - HRESULT ( STDMETHODCALLTYPE *GetStream )( - IPrintReadStreamFactory * This, - /* [annotation][out] */ - __deref_out IPrintReadStream **ppStream); - - END_INTERFACE - } IPrintReadStreamFactoryVtbl; - - interface IPrintReadStreamFactory - { - CONST_VTBL struct IPrintReadStreamFactoryVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPrintReadStreamFactory_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPrintReadStreamFactory_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPrintReadStreamFactory_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPrintReadStreamFactory_GetStream(This,ppStream) \ - ( (This)->lpVtbl -> GetStream(This,ppStream) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPrintReadStreamFactory_INTERFACE_DEFINED__ */ - - -#ifndef __IPartDiscardControl_INTERFACE_DEFINED__ -#define __IPartDiscardControl_INTERFACE_DEFINED__ - -/* interface IPartDiscardControl */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IPartDiscardControl; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("cc350c00-095b-42a5-bf0f-c8780edadb3c") - IPartDiscardControl : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetDiscardProperties( - /* [annotation][out] */ - __out BSTR *uriSentinelPage, - /* [annotation][out] */ - __out BSTR *uriPartToDiscard) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPartDiscardControlVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IPartDiscardControl * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IPartDiscardControl * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IPartDiscardControl * This); - - HRESULT ( STDMETHODCALLTYPE *GetDiscardProperties )( - IPartDiscardControl * This, - /* [annotation][out] */ - __out BSTR *uriSentinelPage, - /* [annotation][out] */ - __out BSTR *uriPartToDiscard); - - END_INTERFACE - } IPartDiscardControlVtbl; - - interface IPartDiscardControl - { - CONST_VTBL struct IPartDiscardControlVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPartDiscardControl_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPartDiscardControl_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPartDiscardControl_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPartDiscardControl_GetDiscardProperties(This,uriSentinelPage,uriPartToDiscard) \ - ( (This)->lpVtbl -> GetDiscardProperties(This,uriSentinelPage,uriPartToDiscard) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPartDiscardControl_INTERFACE_DEFINED__ */ - - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/filterpipelineutil.h b/pub/ddk/filterpipelineutil.h deleted file mode 100644 index 5cbd568..0000000 --- a/pub/ddk/filterpipelineutil.h +++ /dev/null @@ -1,246 +0,0 @@ -//+------------------------------------------------------------------------- -// -// 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(this); - } - else if (riid == IID_IUnknown) - { - *ppv = static_cast(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(this); - } - else if (riid == IID_IUnknown) - { - *ppv = static_cast(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_ - diff --git a/pub/ddk/fltKernel.h b/pub/ddk/fltKernel.h deleted file mode 100644 index 3e494be..0000000 --- a/pub/ddk/fltKernel.h +++ /dev/null @@ -1,5212 +0,0 @@ -/*++ - -Copyright (c) 1989-2002 Microsoft Corporation - -Module Name: - - fltKernel.h - -Abstract: - - This contains all of the global definitions for mini-filters. - -Environment: - - Kernel mode - ---*/ - -#ifndef __FLTKERNEL__ -#define __FLTKERNEL__ - -#ifdef __cplusplus -extern "C" { -#endif - -// -// IMPORTANT!!!!! -// -// This is how FltMgr was released (from oldest to newest) -// xpsp2, srv03 SP1, w2k sp4+URP, 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 -#include -#include - -#if FLT_MGR_BASELINE - -/////////////////////////////////////////////////////////////////////////////// -// -// Miscellaneous macros useful for Filter Manager & mini-filters -// -/////////////////////////////////////////////////////////////////////////////// - -// -// Handy macros for doing pointer arithmetic -// - -#define Add2Ptr(P,I) ((PVOID)((PUCHAR)(P) + (I))) -#define PtrOffset(B,O) ((ULONG)((ULONG_PTR)(O) - (ULONG_PTR)(B))) - -// -// This macro takes a length & rounds it up to a multiple of the alignment -// Alignment is given as a power of 2 -// - -#define ROUND_TO_SIZE(_length, _alignment) \ - ((((ULONG_PTR)(_length)) + ((_alignment)-1)) & ~(ULONG_PTR) ((_alignment) - 1)) - -// -// Checks if 1st argument is aligned on given power of 2 boundary specified -// by 2nd argument -// - -#define IS_ALIGNED(_pointer, _alignment) \ - ((((ULONG_PTR) (_pointer)) & ((_alignment) - 1)) == 0) - -/////////////////////////////////////////////////////////////////////////////// -// -// FltMgr Operation Definitions -// -/////////////////////////////////////////////////////////////////////////////// - -// -// Along with the existing IRP_MJ_xxxx definitions (0 - 0x1b) in NTIFS.H, -// this defines all of the operation IDs that can be sent to a mini-filter. -// - -#define IRP_MJ_ACQUIRE_FOR_SECTION_SYNCHRONIZATION ((UCHAR)-1) -#define IRP_MJ_RELEASE_FOR_SECTION_SYNCHRONIZATION ((UCHAR)-2) -#define IRP_MJ_ACQUIRE_FOR_MOD_WRITE ((UCHAR)-3) -#define IRP_MJ_RELEASE_FOR_MOD_WRITE ((UCHAR)-4) -#define IRP_MJ_ACQUIRE_FOR_CC_FLUSH ((UCHAR)-5) -#define IRP_MJ_RELEASE_FOR_CC_FLUSH ((UCHAR)-6) - - -// -// Leave space for additional FS_FILTER codes here -// - -#define IRP_MJ_FAST_IO_CHECK_IF_POSSIBLE ((UCHAR)-13) -#define IRP_MJ_NETWORK_QUERY_OPEN ((UCHAR)-14) -#define IRP_MJ_MDL_READ ((UCHAR)-15) -#define IRP_MJ_MDL_READ_COMPLETE ((UCHAR)-16) -#define IRP_MJ_PREPARE_MDL_WRITE ((UCHAR)-17) -#define IRP_MJ_MDL_WRITE_COMPLETE ((UCHAR)-18) -#define IRP_MJ_VOLUME_MOUNT ((UCHAR)-19) -#define IRP_MJ_VOLUME_DISMOUNT ((UCHAR)-20) - - -#define FLT_INTERNAL_OPERATION_COUNT 22 - -// -// Not currently implemented -// - -/* -#define IRP_MJ_READ_COMPRESSED ((UCHAR)-xx) -#define IRP_MJ_WRITE_COMPRESSED ((UCHAR)-xx) -#define IRP_MJ_MDL_READ_COMPLETE_REQUEST ((UCHAR)-xx) -#define IRP_MJ_MDL_WRITE_COMPLETE_COMPRESSED ((UCHAR)-xx) -*/ - -// -// Marks the end of the operation list for registration -// - -#define IRP_MJ_OPERATION_END ((UCHAR)0x80) - - -/////////////////////////////////////////////////////////////////////////////// -// -// Basic Filter data types -// -/////////////////////////////////////////////////////////////////////////////// - -typedef struct _FLT_FILTER *PFLT_FILTER; -typedef struct _FLT_VOLUME *PFLT_VOLUME; -typedef struct _FLT_INSTANCE *PFLT_INSTANCE; -typedef struct _FLT_PORT *PFLT_PORT; - -typedef PVOID PFLT_CONTEXT; -#define NULL_CONTEXT ((PFLT_CONTEXT)NULL) //EMPTY context - -#if !FLT_MGR_LONGHORN -// -// For non-longhorn environments we need to define this structure since -// it is used elsewhere. In longhorn and later it is part of ntifs.h -// - -typedef struct _KTRANSACTION *PKTRANSACTION; - -#endif // !FLT_MGR_LONGHORN - - - -/////////////////////////////////////////////////////////////////////////////// -// -// This defines the standard parameter block that is passed to every -// callback. -// -/////////////////////////////////////////////////////////////////////////////// - -#if !defined(_AMD64_) && !defined(_IA64_) -#include "pshpack4.h" -#endif - -#if _MSC_VER >= 1200 -#pragma warning(push) -#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union -#endif - -typedef union _FLT_PARAMETERS { - - // - // IRP_MJ_CREATE - // - - struct { - PIO_SECURITY_CONTEXT SecurityContext; - - // - // The low 24 bits contains CreateOptions flag values. - // The high 8 bits contains the CreateDisposition values. - // - - ULONG Options; - - USHORT POINTER_ALIGNMENT FileAttributes; - USHORT ShareAccess; - ULONG POINTER_ALIGNMENT EaLength; - - PVOID EaBuffer; //Not in IO_STACK_LOCATION parameters list - LARGE_INTEGER AllocationSize; //Not in IO_STACK_LOCATION parameters list - } Create; - - // - // IRP_MJ_CREATE_NAMED_PIPE - // - // Notice that the fields in the following parameter structure must - // match those for the create structure other than the last longword. - // This is so that no distinctions need be made by the I/O system's - // parse routine other than for the last longword. - // - - struct { - PIO_SECURITY_CONTEXT SecurityContext; - ULONG Options; - USHORT POINTER_ALIGNMENT Reserved; - USHORT ShareAccess; - PVOID Parameters; // PNAMED_PIPE_CREATE_PARAMETERS - } CreatePipe; - - // - // IRP_MJ_CREATE_MAILSLOT - // - // Notice that the fields in the following parameter structure must - // match those for the create structure other than the last longword. - // This is so that no distinctions need be made by the I/O system's - // parse routine other than for the last longword. - // - - struct { - PIO_SECURITY_CONTEXT SecurityContext; - ULONG Options; - USHORT POINTER_ALIGNMENT Reserved; - USHORT ShareAccess; - PVOID Parameters; // PMAILSLOT_CREATE_PARAMETERS - } CreateMailslot; - - // - // IRP_MJ_READ - // - - struct { - ULONG Length; //Length of transfer - ULONG POINTER_ALIGNMENT Key; - LARGE_INTEGER ByteOffset; //Offset to read from - - PVOID ReadBuffer; //Not in IO_STACK_LOCATION parameters list - PMDL MdlAddress; //Mdl address for the buffer (maybe NULL) - } Read; - - // - // IRP_MJ_WRITE - // - - struct { - ULONG Length; //Length of transfer - ULONG POINTER_ALIGNMENT Key; - LARGE_INTEGER ByteOffset; //Offset to write to - - PVOID WriteBuffer; //Not in IO_STACK_LOCATION parameters list - PMDL MdlAddress; //Mdl address for the buffer (maybe NULL) - } Write; - - // - // IRP_MJ_QUERY_INFORMATION - // - - struct { - ULONG Length; //Length of buffer - FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass; //Class of information to query - - PVOID InfoBuffer; //Not in IO_STACK_LOCATION parameters list - } QueryFileInformation; - - // - // IRP_MJ_SET_INFORMATION - // - - struct { - ULONG Length; - FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass; - PFILE_OBJECT ParentOfTarget; - union { - struct { - BOOLEAN ReplaceIfExists; - BOOLEAN AdvanceOnly; - }; - ULONG ClusterCount; - HANDLE DeleteHandle; - }; - - PVOID InfoBuffer; //Not in IO_STACK_LOCATION parameters list - } SetFileInformation; - - // - // IRP_MJ_QUERY_EA - // - - struct { - ULONG Length; - PVOID EaList; - ULONG EaListLength; - ULONG POINTER_ALIGNMENT EaIndex; - - PVOID EaBuffer; //Not in IO_STACK_LOCATION parameters list - PMDL MdlAddress; //Mdl address for the buffer (maybe NULL) - } QueryEa; - - // - // IRP_MJ_SET_EA - // - - struct { - ULONG Length; - - PVOID EaBuffer; //Not in IO_STACK_LOCATION parameters list - PMDL MdlAddress; //Mdl address for the buffer (maybe NULL) - } SetEa; - - // - // IRP_MJ_QUERY_VOLUME_INFORMATION - // - - struct { - ULONG Length; - FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass; - - PVOID VolumeBuffer; //Not in IO_STACK_LOCATION parameters list - } QueryVolumeInformation; - - // - // IRP_MJ_SET_VOLUME_INFORMATION - // - - struct { - ULONG Length; - FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass; - - PVOID VolumeBuffer; //Not in IO_STACK_LOCATION parameters list - } SetVolumeInformation; - - // - // IRP_MJ_DIRECTORY_CONTROL - // - - union { - - // - // IRP_MN_QUERY_DIRECTORY or IRP_MN_QUERY_OLE_DIRECTORY - // - - struct { - ULONG Length; - PUNICODE_STRING FileName; - FILE_INFORMATION_CLASS FileInformationClass; - ULONG POINTER_ALIGNMENT FileIndex; - - PVOID DirectoryBuffer; //Not in IO_STACK_LOCATION parameters list - PMDL MdlAddress; //Mdl address for the buffer (maybe NULL) - } QueryDirectory; - - // - // IRP_MN_NOTIFY_CHANGE_DIRECTORY - // - - struct { - ULONG Length; - ULONG POINTER_ALIGNMENT CompletionFilter; - - // - // These spares ensure that the offset of DirectoryBuffer is - // exactly the same as that for QueryDirectory minor code. This - // needs to be the same because filter manager code makes the assumption - // they are the same - // - - ULONG POINTER_ALIGNMENT Spare1; - ULONG POINTER_ALIGNMENT Spare2; - - PVOID DirectoryBuffer; //Not in IO_STACK_LOCATION parameters list - PMDL MdlAddress; //Mdl address for the buffer (maybe NULL) - } NotifyDirectory; - - } DirectoryControl; - - // - // IRP_MJ_FILE_SYSTEM_CONTROL - // - // Note that the user's output buffer is stored in the UserBuffer field - // and the user's input buffer is stored in the SystemBuffer field. - // - - union { - - // - // IRP_MN_VERIFY_VOLUME - // - - struct { - PVPB Vpb; - PDEVICE_OBJECT DeviceObject; - } VerifyVolume; - - // - // IRP_MN_KERNEL_CALL and IRP_MN_USER_FS_REQUEST - // The parameters are broken out into 3 separate unions based on the - // method of the FSCTL Drivers should use the method-appropriate - // union for accessing parameters - // - - struct { - ULONG OutputBufferLength; - ULONG POINTER_ALIGNMENT InputBufferLength; - ULONG POINTER_ALIGNMENT FsControlCode; - } Common; - - // - // METHOD_NEITHER Fsctl parameters - // - - struct { - ULONG OutputBufferLength; - ULONG POINTER_ALIGNMENT InputBufferLength; - ULONG POINTER_ALIGNMENT FsControlCode; - - // - // Type3InputBuffer: name changed from IO_STACK_LOCATION parameters - // Note for this mothod, both input & output buffers are 'raw', - // i.e. unbuffered, and should be treated with caution ( either - // probed & captured before access, or use try-except to enclose - // access to the buffer) - // - - PVOID InputBuffer; - PVOID OutputBuffer; - - // - // Mdl address for the output buffer (maybe NULL) - // - - PMDL OutputMdlAddress; - } Neither; - - // - // METHOD_BUFFERED Fsctl parameters - // - - struct { - ULONG OutputBufferLength; - ULONG POINTER_ALIGNMENT InputBufferLength; - ULONG POINTER_ALIGNMENT FsControlCode; - - // - // For method buffered, this buffer is used both for input and - // output - // - - PVOID SystemBuffer; - - } Buffered; - - // - // METHOD_IN_DIRECT/METHOD_OUT_DIRECT Fsctl parameters - // - - struct { - ULONG OutputBufferLength; - ULONG POINTER_ALIGNMENT InputBufferLength; - ULONG POINTER_ALIGNMENT FsControlCode; - - // - // Note the input buffer is already captured & buffered here - so - // can be safely accessed from kernel mode. The output buffer is - // locked down - so also safe to access, however the OutputBuffer - // pointer is the user virtual address, so if the driver wishes to - // access the buffer in a different process context than that of - // the original i/o - it will have to obtain the system address - // from the MDL - // - - PVOID InputSystemBuffer; - - // - // User virtual address of output buffer - // - - PVOID OutputBuffer; - - // - // Mdl address for the locked down output buffer (should be - // non-NULL) - // - - PMDL OutputMdlAddress; - } Direct; - - } FileSystemControl; - - // - // IRP_MJ_DEVICE_CONTROL or IRP_MJ_INTERNAL_DEVICE_CONTROL - // - - union { - - struct { - ULONG OutputBufferLength; - ULONG POINTER_ALIGNMENT InputBufferLength; - ULONG POINTER_ALIGNMENT IoControlCode; - } Common; - - // - // The parameters are broken out into 3 separate unions based on the - // method of the IOCTL. Drivers should use the method-appropriate - // union for accessing parameters. - // - - // - // METHOD_NEITHER Ioctl parameters for IRP path - // - - struct { - ULONG OutputBufferLength; - ULONG POINTER_ALIGNMENT InputBufferLength; - ULONG POINTER_ALIGNMENT IoControlCode; - - // - // Type3InputBuffer: name changed from IO_STACK_LOCATION parameters - // Note for this mothod, both input & output buffers are 'raw', - // i.e. unbuffered, and should be treated with caution ( either - // probed & captured before access, or use try-except to enclose - // access to the buffer) - // - - PVOID InputBuffer; - PVOID OutputBuffer; - - // - // Mdl address for the output buffer (maybe NULL) - // - - PMDL OutputMdlAddress; - } Neither; - - // - // METHOD_BUFFERED Ioctl parameters for IRP path - // - - struct { - ULONG OutputBufferLength; - ULONG POINTER_ALIGNMENT InputBufferLength; - ULONG POINTER_ALIGNMENT IoControlCode; - - // - // For method buffered, this buffer is used both for input and - // output - // - - PVOID SystemBuffer; - - } Buffered; - - // - // METHOD_IN_DIRECT/METHOD_OUT_DIRECT Ioctl parameters - // - - struct { - ULONG OutputBufferLength; - ULONG POINTER_ALIGNMENT InputBufferLength; - ULONG POINTER_ALIGNMENT IoControlCode; - - // - // Note the input buffer is already captured & buffered here - so - // can be safely accessed from kernel mode. The output buffer is - // locked down - so also safe to access, however the OutputBuffer - // pointer is the user virtual address, so if the driver wishes to - // access the buffer in a different process context than that of - // the original i/o - it will have to obtain the system address - // from the MDL - // - - PVOID InputSystemBuffer; - - // - // User virtual address of output buffer - // - - PVOID OutputBuffer; - - // - // Mdl address for the locked down output buffer (should be non-NULL) - // - - PMDL OutputMdlAddress; - } Direct; - - // - // Regardless of method, if the CALLBACK_DATA represents a fast i/o - // device IOCTL, this structure must be used to access the parameters - // - - struct { - ULONG OutputBufferLength; - ULONG POINTER_ALIGNMENT InputBufferLength; - ULONG POINTER_ALIGNMENT IoControlCode; - - // - // Both buffers are 'raw', i.e. unbuffered - // - - PVOID InputBuffer; - PVOID OutputBuffer; - - } FastIo; - - } DeviceIoControl; - - // - // IRP_MJ_LOCK_CONTROL - // - - struct { - PLARGE_INTEGER Length; - ULONG POINTER_ALIGNMENT Key; - LARGE_INTEGER ByteOffset; - - PEPROCESS ProcessId; // Only meaningful for FastIo locking operations. - BOOLEAN FailImmediately; // Only meaningful for FastIo locking operations. - BOOLEAN ExclusiveLock; // Only meaningful for FastIo locking operations. - } LockControl; - - // - // IRP_MJ_QUERY_SECURITY - // - - struct { - SECURITY_INFORMATION SecurityInformation; - ULONG POINTER_ALIGNMENT Length; - - PVOID SecurityBuffer; //Not in IO_STACK_LOCATION parameters list - PMDL MdlAddress; //Mdl address for the buffer (maybe NULL) - } QuerySecurity; - - // - // IRP_MJ_SET_SECURITY - // - - struct { - SECURITY_INFORMATION SecurityInformation; - PSECURITY_DESCRIPTOR SecurityDescriptor; - } SetSecurity; - - // - // IRP_MJ_SYSTEM_CONTROL - // - - struct { - ULONG_PTR ProviderId; - PVOID DataPath; - ULONG BufferSize; - PVOID Buffer; - } WMI; - - // - // IRP_MJ_QUERY_QUOTA - // - - struct { - ULONG Length; - PSID StartSid; - PFILE_GET_QUOTA_INFORMATION SidList; - ULONG SidListLength; - - PVOID QuotaBuffer; //Not in IO_STACK_LOCATION parameters list - PMDL MdlAddress; //Mdl address for the buffer (maybe NULL) - } QueryQuota; - - // - // IRP_MJ_SET_QUOTA - // - - struct { - ULONG Length; - - PVOID QuotaBuffer; //Not in IO_STACK_LOCATION parameters list - PMDL MdlAddress; //Mdl address for the buffer (maybe NULL) - } SetQuota; - - // - // IRP_MJ_PNP - // - - union { - - // - // IRP_MN_START_DEVICE - // - - struct { - PCM_RESOURCE_LIST AllocatedResources; - PCM_RESOURCE_LIST AllocatedResourcesTranslated; - } StartDevice; - - // - // IRP_MN_QUERY_DEVICE_RELATIONS - // - - struct { - DEVICE_RELATION_TYPE Type; - } QueryDeviceRelations; - - // - // IRP_MN_QUERY_INTERFACE - // - - struct { - CONST GUID *InterfaceType; - USHORT Size; - USHORT Version; - PINTERFACE Interface; - PVOID InterfaceSpecificData; - } QueryInterface; - - // - // IRP_MN_QUERY_CAPABILITIES - // - - struct { - PDEVICE_CAPABILITIES Capabilities; - } DeviceCapabilities; - - // - // IRP_MN_FILTER_RESOURCE_REQUIREMENTS - // - - struct { - PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList; - } FilterResourceRequirements; - - // - // IRP_MN_READ_CONFIG and IRP_MN_WRITE_CONFIG - // - - struct { - ULONG WhichSpace; - PVOID Buffer; - ULONG Offset; - ULONG POINTER_ALIGNMENT Length; - } ReadWriteConfig; - - // - // IRP_MN_SET_LOCK - // - - struct { - BOOLEAN Lock; - } SetLock; - - // - // IRP_MN_QUERY_ID - // - - struct { - BUS_QUERY_ID_TYPE IdType; - } QueryId; - - // - // IRP_MN_QUERY_DEVICE_TEXT - // - - struct { - DEVICE_TEXT_TYPE DeviceTextType; - LCID POINTER_ALIGNMENT LocaleId; - } QueryDeviceText; - - // - // IRP_MN_DEVICE_USAGE_NOTIFICATION - // - - struct { - BOOLEAN InPath; - BOOLEAN Reserved[3]; - DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type; - } UsageNotification; - - } Pnp; - - // - // ***** Start of Emulated IRP definitions - // - - // - // IRP_MJ_ACQUIRE_FOR_SECTION_SYNCHRONIZATION - // - - struct { - FS_FILTER_SECTION_SYNC_TYPE SyncType; - ULONG PageProtection; - } AcquireForSectionSynchronization; - - // - // IRP_MJ_ACQUIRE_FOR_MOD_WRITE - // - - struct { - PLARGE_INTEGER EndingOffset; - PERESOURCE *ResourceToRelease; - } AcquireForModifiedPageWriter; - - // - // IRP_MJ_RELEASE_FOR_MOD_WRITE - // - - struct { - PERESOURCE ResourceToRelease; - } ReleaseForModifiedPageWriter; - - - // - // FAST_IO_CHECK_IF_POSSIBLE - // - - struct { - LARGE_INTEGER FileOffset; - ULONG Length; - ULONG POINTER_ALIGNMENT LockKey; - BOOLEAN POINTER_ALIGNMENT CheckForReadOperation; - } FastIoCheckIfPossible; - - // - // IRP_MJ_NETWORK_QUERY_OPEN - // - - struct { - PIRP Irp; - PFILE_NETWORK_OPEN_INFORMATION NetworkInformation; - } NetworkQueryOpen; - - // - // IRP_MJ_MDL_READ - // - - struct { - LARGE_INTEGER FileOffset; - ULONG POINTER_ALIGNMENT Length; - ULONG POINTER_ALIGNMENT Key; - PMDL *MdlChain; - } MdlRead; - - // - // IRP_MJ_MDL_READ_COMPLETE - // - - struct { - PMDL MdlChain; - } MdlReadComplete; - - // - // IRP_MJ_PREPARE_MDL_WRITE - // - - struct { - LARGE_INTEGER FileOffset; - ULONG POINTER_ALIGNMENT Length; - ULONG POINTER_ALIGNMENT Key; - PMDL *MdlChain; - } PrepareMdlWrite; - - // - // IRP_MJ_MDL_WRITE_COMPLETE - // - - struct { - LARGE_INTEGER FileOffset; - PMDL MdlChain; - } MdlWriteComplete; - - // - // IRP_MJ_VOLUME_MOUNT - // - - struct { - ULONG DeviceType; - } MountVolume; - - - // - // Others - driver-specific - // - - struct { - PVOID Argument1; - PVOID Argument2; - PVOID Argument3; - PVOID Argument4; - PVOID Argument5; - LARGE_INTEGER Argument6; - } Others; - -} FLT_PARAMETERS, *PFLT_PARAMETERS; - -#if !defined(_AMD64_) && !defined(_IA64_) -#include "poppack.h" -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// -// CALLBACK DATA definition -// -/////////////////////////////////////////////////////////////////////////////// - -// -// Changeable portion of the callback data. Any of the parameters in this -// structure that are passed in via CallbackData->Px, can be changed by -// a mini-filter. However if filter changes ANY of the parameters in this -// structure, it needs to issue FltSetCallbackDataDirty() on the -// callback-data or the changes will not be honored & unpredictable failures -// may occur. -// - -typedef struct _FLT_IO_PARAMETER_BLOCK { - - - // - // Fields from IRP - // Flags - - ULONG IrpFlags; - - // - // Major/minor functions from IRP - // - - UCHAR MajorFunction; - UCHAR MinorFunction; - - // - // The flags associated with operations. - // The IO_STACK_LOCATION.Flags field in the old model (SL_* flags) - // - - UCHAR OperationFlags; - - // - // For alignment - // - - UCHAR Reserved; - - - // - // The FileObject that is the target for this - // IO operation. - // - - PFILE_OBJECT TargetFileObject; - - // - // Instance that i/o is directed to - // - - PFLT_INSTANCE TargetInstance; - - // - // Normalized parameters for the operation - // - - FLT_PARAMETERS Parameters; - -} FLT_IO_PARAMETER_BLOCK, *PFLT_IO_PARAMETER_BLOCK; - - -// -// Flag Bit definitions for the Flags variable of FLT_CALLBACK_DATA -// - -typedef ULONG FLT_CALLBACK_DATA_FLAGS; - - // - // Flags passed to mini-filters - // - - // - // This mask designates the flags that describe the the type of i/o - // and parameters - // - #define FLTFL_CALLBACK_DATA_REISSUE_MASK 0x0000FFFF - - // - // The below 3 flags are mutually exclusive. - // i.e. only ONE and exacly one hould be set for the callback data. - // Once set they should never change - // - #define FLTFL_CALLBACK_DATA_IRP_OPERATION 0x00000001 // Set for Irp operations - #define FLTFL_CALLBACK_DATA_FAST_IO_OPERATION 0x00000002 // Set for Fast Io operations - #define FLTFL_CALLBACK_DATA_FS_FILTER_OPERATION 0x00000004 // Set for Fs Filter operations - // - // In principle this flag can be set for any operation. Once set it shouldn't change - // - #define FLTFL_CALLBACK_DATA_SYSTEM_BUFFER 0x00000008 // Set if the buffer passed in for the i/o was a system buffer - - - - // - // Below flags are relevant only for IRP-based i/o - i.e. only - // if FLTFL_CALLBACK_DATA_IRP_OPERATION was set. If the i/o was reissued - // both flags will necessarily be set - // - #define FLTFL_CALLBACK_DATA_GENERATED_IO 0x00010000 // Set if this is I/O generated by a mini-filter - #define FLTFL_CALLBACK_DATA_REISSUED_IO 0x00020000 // Set if this I/O was reissued - - // - // Below 2 flags are set only for post-callbacks. - // - #define FLTFL_CALLBACK_DATA_DRAINING_IO 0x00040000 // set if this operation is being drained. If set, - #define FLTFL_CALLBACK_DATA_POST_OPERATION 0x00080000 // Set if this is a POST operation - - // - // This flag can only be set by Filter Manager, only for an IRP based operation - // and only for a post callback. When set, it specifies that a lower level driver - // allocated a buffer for AssociatedIrp.SystemBuffer in which the data for - // the operation will be returned to the IO manager. Filters need to know this - // because when they were called in the PRE operation AssociatedIrp.SystemBuffer - // was null and as such their buffer is set to UserBuffer and they have no way of - // getting the real data from SystemBuffer. Check the IRP_DEALLOCATE_BUFFER flag for - // more details on how this is used by file systems. - // - - #define FLTFL_CALLBACK_DATA_NEW_SYSTEM_BUFFER 0x00100000 - - // - // Flags set by mini-filters: these are set by the minifilters and may be reset - // by filter manager. - // - #define FLTFL_CALLBACK_DATA_DIRTY 0x80000000 // Set by caller if parameters were changed - - - -#if FLT_MGR_WIN7 - -// -// CallbackData allocation flags. -// - -typedef ULONG FLT_ALLOCATE_CALLBACK_DATA_FLAGS; - - // - // Normaly only the IrpCtrl is allocated and the other members - // that might be needed are allocated at the time when they are needed. - // This flag allows the user to preallocate all other structures that - // are needed thus avoiding a potential allocation failure at a later - // time. Useful when a filter wants to save a callbackdata to use in - // case it needs to perform IO under low memory conditions. - // - - #define FLT_ALLOCATE_CALLBACK_DATA_PREALLOCATE_ALL_MEMORY 0x00000001 - -#endif //FLT_MGR_WIN7 - -// -// This defines the standard information passed to a mini-filter for -// every operation callback. -// - -typedef struct _FLT_CALLBACK_DATA { - - // - // Flags - // - - FLT_CALLBACK_DATA_FLAGS Flags; - - // - // Thread that initiated this operation. - // - - PETHREAD CONST Thread; - - // - // Pointer to the changeable i/o parameters - // - - PFLT_IO_PARAMETER_BLOCK CONST Iopb; - - // - // For pre-op calls: if filter returns STATUS_IO_COMPLETE, then it should - // set the return i/o status here. For post-operation calls, this is set - // by filter-manager indicating the completed i/o status. - // - - IO_STATUS_BLOCK IoStatus; - - - struct _FLT_TAG_DATA_BUFFER *TagData; - - union { - struct { - - // - // Queue links if the FltMgr queue is used to - // pend the callback - // - - LIST_ENTRY QueueLinks; - - // - // Additional context - // - - PVOID QueueContext[2]; - }; - - // - // The following are available to filters to use - // in whatever manner desired if not using the filter manager - // queues. - // NOTE: These fields are only valid while the filter is - // processing this operation which is inside the operation - // callback or while the operation is pended. - // - - PVOID FilterContext[4]; - }; - - // - // Original requester mode of caller - // - - KPROCESSOR_MODE RequestorMode; - -} FLT_CALLBACK_DATA, *PFLT_CALLBACK_DATA; - - -// -// Routines to manipulate callback data dirty state -// - -VOID -FLTAPI -FltSetCallbackDataDirty( - __inout PFLT_CALLBACK_DATA Data - ); - -VOID -FLTAPI -FltClearCallbackDataDirty( - __inout PFLT_CALLBACK_DATA Data - ); - -BOOLEAN -FLTAPI -FltIsCallbackDataDirty( - __in PFLT_CALLBACK_DATA Data - ); - - -// -// These used to be macros and our now routines. This was done for greater -// flexibility in the future. I have kept the macros around for compatibility -// with existing filters. -// - -#define FLT_SET_CALLBACK_DATA_DIRTY(Data) FltSetCallbackDataDirty(Data) -#define FLT_CLEAR_CALLBACK_DATA_DIRTY(Data) FltClearCallbackDataDirty(Data) -#define FLT_IS_CALLBACK_DATA_DIRTY(Data) FltIsCallbackDataDirty(Data) - -// -// These just check the kind of operation for the CallbackData -// All of them take callback data as the parameter -// - -#define FLT_IS_IRP_OPERATION(Data) (FlagOn( (Data)->Flags, FLTFL_CALLBACK_DATA_IRP_OPERATION )) -#define FLT_IS_FASTIO_OPERATION(Data) (FlagOn( (Data)->Flags, FLTFL_CALLBACK_DATA_FAST_IO_OPERATION )) -#define FLT_IS_FS_FILTER_OPERATION(Data) (FlagOn( (Data)->Flags, FLTFL_CALLBACK_DATA_FS_FILTER_OPERATION )) - -// -// Bunch of other miscellaneous i/o characteristics -// - -#define FLT_IS_REISSUED_IO(Data) (FlagOn( (Data)->Flags, FLTFL_CALLBACK_DATA_REISSUED_IO )) - -// -// This test only is useful for IRP operations to check if the passed in buffer is a system buffer -// - -#define FLT_IS_SYSTEM_BUFFER(Data) (FlagOn( (Data)->Flags, FLTFL_CALLBACK_DATA_SYSTEM_BUFFER )) - - -/////////////////////////////////////////////////////////////////////////////// -// -// Context Definitions -// -/////////////////////////////////////////////////////////////////////////////// - -// -// Definitions for the types of contexts that are available. -// - -typedef USHORT FLT_CONTEXT_TYPE; - - #define FLT_VOLUME_CONTEXT 0x0001 - #define FLT_INSTANCE_CONTEXT 0x0002 - #define FLT_FILE_CONTEXT 0x0004 - #define FLT_STREAM_CONTEXT 0x0008 - #define FLT_STREAMHANDLE_CONTEXT 0x0010 - #define FLT_TRANSACTION_CONTEXT 0x0020 - - #define FLT_CONTEXT_END 0xffff - -// -// Definition for ALL contexts -// - -#define FLT_ALL_CONTEXTS (FLT_VOLUME_CONTEXT | \ - FLT_INSTANCE_CONTEXT | \ - FLT_FILE_CONTEXT | \ - FLT_STREAM_CONTEXT | \ - FLT_STREAMHANDLE_CONTEXT |\ - FLT_TRANSACTION_CONTEXT) - -// -// This structure is passed to a filter's pre/post operation callback -// routines and defines all of the handles associated with the given -// operation. -// - -typedef struct _FLT_RELATED_OBJECTS { - - USHORT CONST Size; - USHORT CONST TransactionContext; //TxF mini-version - PFLT_FILTER CONST Filter; - PFLT_VOLUME CONST Volume; - PFLT_INSTANCE CONST Instance; - PFILE_OBJECT CONST FileObject; - PKTRANSACTION CONST Transaction; - -} FLT_RELATED_OBJECTS, *PFLT_RELATED_OBJECTS; - -typedef CONST struct _FLT_RELATED_OBJECTS *PCFLT_RELATED_OBJECTS; - -// -// Structure used by a filter to get/release multiple contexts at once. -// - -typedef struct _FLT_RELATED_CONTEXTS { - - PFLT_CONTEXT VolumeContext; - PFLT_CONTEXT InstanceContext; - PFLT_CONTEXT FileContext; - PFLT_CONTEXT StreamContext; - PFLT_CONTEXT StreamHandleContext; - PFLT_CONTEXT TransactionContext; - -} FLT_RELATED_CONTEXTS, *PFLT_RELATED_CONTEXTS; - -// -// Prototype for Context Cleanup routine. This routine is called by the -// filterManager when it has determined it is time to free a context. -// The called filter should cleanup any allocated memory they have inside -// this context structure. FLTMGR will free the context upon return. -// - -typedef VOID -(FLTAPI *PFLT_CONTEXT_CLEANUP_CALLBACK) ( - __in PFLT_CONTEXT Context, - __in FLT_CONTEXT_TYPE ContextType - ); - -// -// Function prototypes for Allocation and Free callbacks that may be used by -// advanced filters that want to manage context allocation directly. -// -// NOTE: Most filters do not need to use this feature since the default -// mechanism built into FltMgr does this efficiently. -// - -typedef PVOID -(FLTAPI *PFLT_CONTEXT_ALLOCATE_CALLBACK)( - __in POOL_TYPE PoolType, - __in SIZE_T Size, - __in FLT_CONTEXT_TYPE ContextType - ); - -typedef VOID -(FLTAPI *PFLT_CONTEXT_FREE_CALLBACK)( - __in PVOID Pool, - __in FLT_CONTEXT_TYPE ContextType - ); - -// -// Defines context registration flags -// - -typedef USHORT FLT_CONTEXT_REGISTRATION_FLAGS; - - // - // By default, the FltMgr matches exactly a given context allocation - // request with a size specified at context registration time. If - // this flag is specified, then the FltMgr will use a given registered - // size definition if the requested size is <= to it. Note that the - // FltMgr sorts multiple size definions into ascending order. - // - // This flag is ignored on entries with FLT_VARIABLE_SIZED_CONTEXTS - // specified or Alloc/Free routines specified - // - - #define FLTFL_CONTEXT_REGISTRATION_NO_EXACT_SIZE_MATCH 0x0001 - - -// -// When this value is used in the "Size" field of the FLT_CONTEXT_REGISTRATION -// structure, then this registered context entry has no explicit size. -// When allocation requests are made, FltMgr directly allocates and frees -// the memory from pool. -// -// For a given context and pool type, only one entry may have this value. -// This may be included with multiple explicitly sized entries. This will -// always be sorted to the end of the list. -// - -#define FLT_VARIABLE_SIZED_CONTEXTS ((SIZE_T)-1) - -// -// An array of this structure is used for registering the different kinds of -// contexts used by this mini-filter. -// -// At least one of these records must be speicifed to allocate a context of a -// given type. -// - -typedef struct _FLT_CONTEXT_REGISTRATION { - - // - // Identifies the type of this context - // - - FLT_CONTEXT_TYPE ContextType; - - // - // Local flags - // - - FLT_CONTEXT_REGISTRATION_FLAGS Flags; - - // - // Routine to call to cleanup the context before it is deleted. - // This may be NULL if not cleanup is needed. - // - - PFLT_CONTEXT_CLEANUP_CALLBACK ContextCleanupCallback; - - // - // Defines the size & pool tag the mini-filter wants for the given context. - // FLT_VARIABLE_SIZED_CONTEXTS may be specified for the size if variable - // sized contexts are used. A size of zero is valid. If an empty pooltag - // value is specified, the FLTMGR will use a context type specific tag. - // - // If an explicit size is specified, the FLTMGR internally optimizes the - // allocation of that entry. - // - // NOTE: These fields are ignored if Allocate & Free routines are - // specifed. - // - - SIZE_T Size; - ULONG PoolTag; - - // - // Specifies the ALLOCATE and FREE routines that should be used - // when allocating a context for this mini-filter. - // - // NOTE: The above size & PoolTag fields are ignored when these routines - // are defined. - // - - PFLT_CONTEXT_ALLOCATE_CALLBACK ContextAllocateCallback; - PFLT_CONTEXT_FREE_CALLBACK ContextFreeCallback; - - // - // Reserved for future expansion - // - - PVOID Reserved1; - -} FLT_CONTEXT_REGISTRATION, *PFLT_CONTEXT_REGISTRATION; - -typedef const FLT_CONTEXT_REGISTRATION *PCFLT_CONTEXT_REGISTRATION; - - -/////////////////////////////////////////////////////////////////////////////// -// -// Known File System Types -// -/////////////////////////////////////////////////////////////////////////////// - -// -// The enum FLT_FILESYSTEM_TYPE has been moved to FltUserStructures.h -// so it can be referenced by both user mode and kernel mode components -// - - -/////////////////////////////////////////////////////////////////////////////// -// -// Instance attach/detach callback definitions -// -/////////////////////////////////////////////////////////////////////////////// - -// -// ******** Instance setup ******** -// - -// -// Flags identifying why the given instance attach callback routine was -// called. More then one bit may be set. -// - -typedef ULONG FLT_INSTANCE_SETUP_FLAGS; - - // - // If set, this is an automatic instance attachment notification. These - // occur when the filter is first loaded for all existing volumes, and - // when a new volume is mounted. - // - - #define FLTFL_INSTANCE_SETUP_AUTOMATIC_ATTACHMENT 0x00000001 - - // - // If set, this is a manual instance attachment request via FilterAttach - // (user mode) or FltAttachVolume. - // - - #define FLTFL_INSTANCE_SETUP_MANUAL_ATTACHMENT 0x00000002 - - // - // If set, this is an automatic instance notification for a volume that - // has just been mounted in the system. - // - - #define FLTFL_INSTANCE_SETUP_NEWLY_MOUNTED_VOLUME 0x00000004 - -#if FLT_MGR_LONGHORN - // - // If set, this volume is not currently attached to a storage stack. - // This usually means the volume is dismounted but it does not always - // mean that. There are scnearios with certain file systems (fat & cdfs - // being some) where a volume can become reattached after it has detached. - // This flag is only set in Longhorn or later. - // - - #define FLTFL_INSTANCE_SETUP_DETACHED_VOLUME 0x00000008 - -#endif // FLT_MGR_LONGHORN - - -// -// This is called whenever a new instance is being created. This gives the -// filter the opportunity to decide if they want to attach to the given -// volume or not. -// -// A SUCCESS return value will cause the instance to be attached to the given -// volume. A WARNING or ERROR return value will cause the instance to NOT be -// attached to the given volume. Following are reasonable sample return -// values: -// STATUS_SUCCESS -// STATUS_FLT_DO_NOT_ATTACH -// -// If no callback is defined the given instance will be attached. -// - -typedef NTSTATUS -(FLTAPI *PFLT_INSTANCE_SETUP_CALLBACK) ( - __in PCFLT_RELATED_OBJECTS FltObjects, - __in FLT_INSTANCE_SETUP_FLAGS Flags, - __in DEVICE_TYPE VolumeDeviceType, - __in FLT_FILESYSTEM_TYPE VolumeFilesystemType - ); - - -// -// ******** Instance Query Detach ******** -// - -// -// Flags identifying why the given instance query detach callback routine was -// called. More then one bit may be set. -// - -typedef ULONG FLT_INSTANCE_QUERY_TEARDOWN_FLAGS; - - // - // No flags currently defined - // - -// -// This is called whenever a manual detachment request is made for the given -// instance. This is not called for mandatory detachment requests (like -// filter unload or volume dismount). This gives the filter the opportunity -// to decide if they want to detach from the given volume or not. -// -// A SUCCESS return value will cause the instance to be detached from the -// given volume. A WARNING or ERROR return value will cause the instance to -// NOT be detached from the given volume. Following are reasonable sample -// return values: -// STATUS_SUCCESS -// STATUS_FLT_DO_NOT_DETACH -// -// If no callback is defined the given instance will NOT be detached. -// - -typedef NTSTATUS -(FLTAPI *PFLT_INSTANCE_QUERY_TEARDOWN_CALLBACK) ( - __in PCFLT_RELATED_OBJECTS FltObjects, - __in FLT_INSTANCE_QUERY_TEARDOWN_FLAGS Flags - ); - - -// -// ******** Instance teardown ******** -// - -// -// Flag identifying why the given instance detach callback routine was called. -// More then one bit may be set. -// - -typedef ULONG FLT_INSTANCE_TEARDOWN_FLAGS; - - // - // If set, this is a manual instance detach request via FilterDetach - // (user mode) or FltDetachVolume (kernel mode). - // - - #define FLTFL_INSTANCE_TEARDOWN_MANUAL 0x00000001 - - // - // If set, the filter is being unloaded. - // - - #define FLTFL_INSTANCE_TEARDOWN_FILTER_UNLOAD 0x00000002 - - // - // If set, the filter is being unloaded. - // - - #define FLTFL_INSTANCE_TEARDOWN_MANDATORY_FILTER_UNLOAD 0x00000004 - - // - // If set, the volume is being dismounted. - // - - #define FLTFL_INSTANCE_TEARDOWN_VOLUME_DISMOUNT 0x00000008 - - // - // If set, an error occurred while doing instance setup (like running - // out of memory). - // - - #define FLTFL_INSTANCE_TEARDOWN_INTERNAL_ERROR 0x00000010 - - -// -// This is the prototype for two different teardown callback routines. -// -// The TEARDOWN_START routine is called at the beginning of teardown process. -// There may still be operation callbacks in progress. This is called to give -// the filter the oppertunity to do the following things: -// - Restart any pended operations -// - Set state so that minimual processing will be performed on future -// operation callbacks. -// - Unregister from other OS callback APIs -// - -// -// The TEARDOWN_COMPLETE routine is called after teardown has been finished. -// The system guarentees that all existing callbacks have been completed -// before this routine is called. This is called to give the filter the -// oppertunity to: -// - Close any open files. -// - do other instance state cleanup. -// - -typedef VOID -(FLTAPI *PFLT_INSTANCE_TEARDOWN_CALLBACK) ( - __in PCFLT_RELATED_OBJECTS FltObjects, - __in FLT_INSTANCE_TEARDOWN_FLAGS Reason - ); - -////////////////////////////////////////////////////////////////////////////// -// -// Pre/Post Operation Callback definitions -// -/////////////////////////////////////////////////////////////////////////////// - -// -// Values returned from the pre-operation callback routine defining what -// to do next. -// - -typedef enum _FLT_PREOP_CALLBACK_STATUS { - - FLT_PREOP_SUCCESS_WITH_CALLBACK, - FLT_PREOP_SUCCESS_NO_CALLBACK, - FLT_PREOP_PENDING, - FLT_PREOP_DISALLOW_FASTIO, - FLT_PREOP_COMPLETE, - FLT_PREOP_SYNCHRONIZE - - -} FLT_PREOP_CALLBACK_STATUS, *PFLT_PREOP_CALLBACK_STATUS; - -// -// Pre-operation callback prototype. -// - -typedef FLT_PREOP_CALLBACK_STATUS -(FLTAPI *PFLT_PRE_OPERATION_CALLBACK) ( - __inout PFLT_CALLBACK_DATA Data, - __in PCFLT_RELATED_OBJECTS FltObjects, - __deref_out_opt PVOID *CompletionContext - ); - - -// -// Values returned from the post-operation callback routine defining what -// to od next. -// - -typedef enum _FLT_POSTOP_CALLBACK_STATUS { - - FLT_POSTOP_FINISHED_PROCESSING, - FLT_POSTOP_MORE_PROCESSING_REQUIRED - -} FLT_POSTOP_CALLBACK_STATUS, *PFLT_POSTOP_CALLBACK_STATUS; - -// -// Flag BITS sent to the post-operation callback routine -// - -typedef ULONG FLT_POST_OPERATION_FLAGS; - - // - // If set, this instance is being detached and this post-operation - // routine has been called for cleanup processing (drained). Since this - // instance is going away, you should perform a minimum of operations - // while processing this completion. - // - - #define FLTFL_POST_OPERATION_DRAINING 0x00000001 - -// -// Post-operation callback prototype -// - -typedef FLT_POSTOP_CALLBACK_STATUS -(FLTAPI *PFLT_POST_OPERATION_CALLBACK) ( - __inout PFLT_CALLBACK_DATA Data, - __in PCFLT_RELATED_OBJECTS FltObjects, - __in_opt PVOID CompletionContext, - __in FLT_POST_OPERATION_FLAGS Flags - ); - -// -// Post operation callbacks may be called at DPC level. This routine may be -// used to transfer completion processing to a "safe" IRQL level. This -// routine will determine if it is safe to call the "SafePostCallback" now -// or if it must post the request to a worker thread. If posting to a worker -// thread is needed it determines it is safe to do so (some operations can -// not be posted like paging IO). -// - -__checkReturn -BOOLEAN -FLTAPI -FltDoCompletionProcessingWhenSafe( - __in PFLT_CALLBACK_DATA Data, - __in PCFLT_RELATED_OBJECTS FltObjects, - __in_opt PVOID CompletionContext, - __in FLT_POST_OPERATION_FLAGS Flags, - __in PFLT_POST_OPERATION_CALLBACK SafePostCallback, - __out PFLT_POSTOP_CALLBACK_STATUS RetPostOperationStatus - ); - -// -// Defines current operation callback flags. -// - -typedef ULONG FLT_OPERATION_REGISTRATION_FLAGS; - - // - // If set, the filter's callbacks for this operation will not be called, - // if it's a paging i/o operation. This flag is relevant only for IRP-based - // operations & ignored for non-IRP operations - // - - #define FLTFL_OPERATION_REGISTRATION_SKIP_PAGING_IO 0x00000001 - - // - // If set read/write operations that are not non-cached will be skipped: - // i.e. the mini-filters callback for this operation will be bypassed. - // This flag is relevant only for IRP_MJ_READ & IRP_MJ_WRITE - // This of course implies that fast i/o reads and writes will be skipped, - // since those imply cached i/o by default - // - - #define FLTFL_OPERATION_REGISTRATION_SKIP_CACHED_IO 0x00000002 - - // - // If set all operations that are not issued on a DASD (volume) handle will be skipped: - // i.e. the mini-filters callback for this operation will be bypassed. - // This flag is relevant for all operations - // - - #define FLTFL_OPERATION_REGISTRATION_SKIP_NON_DASD_IO 0x00000004 - - -// -// Structure used for registering operation callback routines -// - -typedef struct _FLT_OPERATION_REGISTRATION { - - UCHAR MajorFunction; - FLT_OPERATION_REGISTRATION_FLAGS Flags; - PFLT_PRE_OPERATION_CALLBACK PreOperation; - PFLT_POST_OPERATION_CALLBACK PostOperation; - - PVOID Reserved1; - -} FLT_OPERATION_REGISTRATION, *PFLT_OPERATION_REGISTRATION; - - -/////////////////////////////////////////////////////////////////////////////// -// -// This defines structures and flags for reparse point tag notifications -// that a filter uses to register. -// -/////////////////////////////////////////////////////////////////////////////// - -typedef struct _FLT_TAG_DATA_BUFFER { - ULONG FileTag; - USHORT TagDataLength; - USHORT UnparsedNameLength; - union { - struct { - USHORT SubstituteNameOffset; - USHORT SubstituteNameLength; - USHORT PrintNameOffset; - USHORT PrintNameLength; - ULONG Flags; - WCHAR PathBuffer[1]; - } SymbolicLinkReparseBuffer; - - struct { - USHORT SubstituteNameOffset; - USHORT SubstituteNameLength; - USHORT PrintNameOffset; - USHORT PrintNameLength; - WCHAR PathBuffer[1]; - } MountPointReparseBuffer; - - struct { - UCHAR DataBuffer[1]; - } GenericReparseBuffer; - - // - // Used for non-Microsoft reparse points - // - - struct { - GUID TagGuid; - UCHAR DataBuffer[1]; - } GenericGUIDReparseBuffer; - }; -} FLT_TAG_DATA_BUFFER, *PFLT_TAG_DATA_BUFFER; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - -#define FLT_TAG_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(FLT_TAG_DATA_BUFFER, GenericReparseBuffer) - - - -/////////////////////////////////////////////////////////////////////////////// -// -// Filter Unload Definitions -// -/////////////////////////////////////////////////////////////////////////////// - -typedef ULONG FLT_FILTER_UNLOAD_FLAGS; - - // - // If set, the OS has requested to unload this filter and the operation - // can not be failed. - // - - #define FLTFL_FILTER_UNLOAD_MANDATORY 0x00000001 - - -// -// Callback to notify a filter it is being unloaded. If the filter returns -// a SUCCESS code, then the filter is unloaded. If a WARNING or ERROR -// code is returned then the filter is not unloaded. If not callback is -// defined the filter will not be unloaded. -// - -typedef NTSTATUS -(FLTAPI *PFLT_FILTER_UNLOAD_CALLBACK) ( - FLT_FILTER_UNLOAD_FLAGS Flags - ); - -///////////////////////////////////////////////////////////////////////// -// -// Routines and structures for Name Providing Filter (filters that modify -// names in the namespace). -// -//////////////////////////////////////////////////////////////////////// - -// -// The FLT_NAME_CONTROL structure is used to efficiently manage a name buffer -// as a name is generated by a filter that modifies the namespace. -// -// The filter should never free or try to replace the buffer in the Name -// UNICODE_STRING directly. It should call FltNameControlCheckAndGrow to -// varify that the buffer is large enough for more data to be added and grow -// the buffer as needed. -// - -typedef struct _FLT_NAME_CONTROL { - - // - // The unicode string where the name should be set. - // - - UNICODE_STRING Name; - -} FLT_NAME_CONTROL, *PFLT_NAME_CONTROL; - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltCheckAndGrowNameControl ( - __inout PFLT_NAME_CONTROL NameCtrl, - __in USHORT NewSize - ); - -// -// Define this hear for the PFLT_GENERATE_FILE_NAME signature. This is defined -// again later at the point where the flags are defined. -// - -typedef ULONG FLT_FILE_NAME_OPTIONS; - -typedef NTSTATUS -(FLTAPI *PFLT_GENERATE_FILE_NAME) ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __in_opt PFLT_CALLBACK_DATA CallbackData, - __in FLT_FILE_NAME_OPTIONS NameOptions, - __out PBOOLEAN CacheFileNameInformation, - __out PFLT_NAME_CONTROL FileName - ); - -typedef ULONG FLT_NORMALIZE_NAME_FLAGS; - -// -// Normalize name flags -// - - #define FLTFL_NORMALIZE_NAME_CASE_SENSITIVE 0x01 - #define FLTFL_NORMALIZE_NAME_DESTINATION_FILE_NAME 0x02 - -typedef NTSTATUS -(FLTAPI *PFLT_NORMALIZE_NAME_COMPONENT) ( - __in PFLT_INSTANCE Instance, - __in PCUNICODE_STRING ParentDirectory, - __in USHORT VolumeNameLength, - __in PCUNICODE_STRING Component, - __out_bcount(ExpandComponentNameLength) PFILE_NAMES_INFORMATION ExpandComponentName, - __in ULONG ExpandComponentNameLength, - __in FLT_NORMALIZE_NAME_FLAGS Flags, - __deref_inout_opt PVOID *NormalizationContext - ); - -typedef NTSTATUS -(FLTAPI *PFLT_NORMALIZE_NAME_COMPONENT_EX) ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __in PCUNICODE_STRING ParentDirectory, - __in USHORT VolumeNameLength, - __in PCUNICODE_STRING Component, - __out_bcount(ExpandComponentNameLength) PFILE_NAMES_INFORMATION ExpandComponentName, - __in ULONG ExpandComponentNameLength, - __in FLT_NORMALIZE_NAME_FLAGS Flags, - __deref_inout_opt PVOID *NormalizationContext - ); - -typedef VOID -(FLTAPI *PFLT_NORMALIZE_CONTEXT_CLEANUP) ( - __in_opt PVOID *NormalizationContext - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltPurgeFileNameInformationCache ( - __in PFLT_INSTANCE Instance, - __in_opt PFILE_OBJECT FileObject - ); - -/////////////////////////////////////////////////////////////////////////////// -// -// Transaction callback definitions -// -/////////////////////////////////////////////////////////////////////////////// - -#if FLT_MGR_LONGHORN - -typedef NTSTATUS -(FLTAPI *PFLT_TRANSACTION_NOTIFICATION_CALLBACK) ( - __in PCFLT_RELATED_OBJECTS FltObjects, - __in PFLT_CONTEXT TransactionContext, - __in ULONG NotificationMask - ); - -#endif // FLT_MGR_LONGHORN - - -////////////////////////////////////////////////////////////////////////////// -// -// This structure is used at registration time to define what callbacks -// this driver wishes to receive. -// -/////////////////////////////////////////////////////////////////////////////// - -// -// This defines the MAJOR/MINOR version number to be passed in at registration -// time. The filter manager uses this number to validate / process the -// parameters passed in. Note that the minor version number can change and -// you will still be able to register. If the major version number changes -// then the filter will no longer load. -// - -// -// Registration version for XP SP2 and W2K3 SP1 -// - -#define FLT_REGISTRATION_VERSION_0200 0x0200 - -// -// Registration version for Vista Beta 2 -// (adds PFLT_TRANSACTION_NOTIFICATION_CALLBACK) -// - -#define FLT_REGISTRATION_VERSION_0201 0x0201 - -// -// Registration version for Vista RTM -// (adds PFLT_NORMALIZE_NAME_COMPONENT_EX) -// - -#define FLT_REGISTRATION_VERSION_0202 0x0202 - -// -// NOTE: You should always pass in this defined value (do not explicitly -// specify older values) - -#if FLT_MGR_LONGHORN - #define FLT_REGISTRATION_VERSION FLT_REGISTRATION_VERSION_0202 // Current version is 2.02 -#else - #define FLT_REGISTRATION_VERSION FLT_REGISTRATION_VERSION_0200 // Current version is 2.00 -#endif - -// -// Defines current registration flags -// - -typedef ULONG FLT_REGISTRATION_FLAGS; - - // - // If set, this filter does not support a service stop request. This is - // is how the OS unloads drivers. - // - - #define FLTFL_REGISTRATION_DO_NOT_SUPPORT_SERVICE_STOP 0x00000001 - -// -// Registration structure -// - -typedef struct _FLT_REGISTRATION { - - // - // The size, in bytes, of this registration structure. - // - - USHORT Size; - USHORT Version; - - // - // Flag values - // - - FLT_REGISTRATION_FLAGS Flags; - - // - // Variable length array of routines that are used to manage contexts in - // the system. - // - - CONST FLT_CONTEXT_REGISTRATION *ContextRegistration; - - // - // Variable length array of routines used for processing pre- and post- - // file system operations. - // - - CONST FLT_OPERATION_REGISTRATION *OperationRegistration; - - // - // This is called before a filter is unloaded. If an ERROR or WARNING - // status is returned then the filter is NOT unloaded. A mandatory unload - // can not be failed. - // - // If a NULL is specified for this routine, then the filter can never be - // unloaded. - // - - PFLT_FILTER_UNLOAD_CALLBACK FilterUnloadCallback; - - // - // This is called to see if a filter would like to attach an instance - // to the given volume. If an ERROR or WARNING status is returned, an - // attachment is not made. - // - // If a NULL is specified for this routine, the attachment is always made. - // - - PFLT_INSTANCE_SETUP_CALLBACK InstanceSetupCallback; - - // - // This is called to see if the filter wants to detach from the given - // volume. This is only called for manual detach requests. If an - // ERROR or WARNING status is returned, the filter is not detached. - // - // If a NULL is specified for this routine, then instances can never be - // manually detached. - // - - PFLT_INSTANCE_QUERY_TEARDOWN_CALLBACK InstanceQueryTeardownCallback; - - // - // This is called at the start of a filter detaching from a volume. - // - // It is OK for this field to be NULL. - // - - PFLT_INSTANCE_TEARDOWN_CALLBACK InstanceTeardownStartCallback; - - // - // This is called at the end of a filter detaching from a volume. All - // outstanding operations have been completed by the time this routine - // is called. - // - // It is OK for this field to be NULL. - // - - PFLT_INSTANCE_TEARDOWN_CALLBACK InstanceTeardownCompleteCallback; - - // - // The following callbacks are provided by a filter only if it is - // interested in modifying the name space. - // - // If NULL is specified for these callbacks, it is assumed that the - // filter would not affect the name being requested. - // - - PFLT_GENERATE_FILE_NAME GenerateFileNameCallback; - - PFLT_NORMALIZE_NAME_COMPONENT NormalizeNameComponentCallback; - - PFLT_NORMALIZE_CONTEXT_CLEANUP NormalizeContextCleanupCallback; - - // - // The PFLT_NORMALIZE_NAME_COMPONENT_EX callback is also a name - // provider callback. It is not included here along with the - // other name provider callbacks to take care of the registration - // structure versioning issues. - // - -#if FLT_MGR_LONGHORN - - // - // This is called for transaction notifications received from the KTM - // when a filter has enlisted on that transaction. - // - - PFLT_TRANSACTION_NOTIFICATION_CALLBACK TransactionNotificationCallback; - - // - // This is the extended normalize name component callback - // If a mini-filter provides this callback, then this callback - // will be used as opposed to using PFLT_NORMALIZE_NAME_COMPONENT - // - // The PFLT_NORMALIZE_NAME_COMPONENT_EX provides an extra parameter - // (PFILE_OBJECT) in addition to the parameters provided to - // PFLT_NORMALIZE_NAME_COMPONENT. A mini-filter may use this parameter - // to get to additional information like the TXN_PARAMETER_BLOCK. - // - // A mini-filter that has no use for the additional parameter may - // only provide a PFLT_NORMALIZE_NAME_COMPONENT callback. - // - // A mini-filter may provide both a PFLT_NORMALIZE_NAME_COMPONENT - // callback and a PFLT_NORMALIZE_NAME_COMPONENT_EX callback. The - // PFLT_NORMALIZE_NAME_COMPONENT_EX callback will be used by fltmgr - // versions that understand this callback (Vista RTM and beyond) - // and PFLT_NORMALIZE_NAME_COMPONENT callback will be used by fltmgr - // versions that do not understand the PFLT_NORMALIZE_NAME_COMPONENT_EX - // callback (prior to Vista RTM). This allows the same mini-filter - // binary to run with all versions of fltmgr. - // - - PFLT_NORMALIZE_NAME_COMPONENT_EX NormalizeNameComponentExCallback; - -#endif // FLT_MGR_LONGHORN - -} FLT_REGISTRATION, *PFLT_REGISTRATION; - - - -/////////////////////////////////////////////////////////////////////////////// -// -// Callback routine for async i/o operations -// -/////////////////////////////////////////////////////////////////////////////// - -typedef VOID -(FLTAPI *PFLT_COMPLETED_ASYNC_IO_CALLBACK)( - __in PFLT_CALLBACK_DATA CallbackData, - __in PFLT_CONTEXT Context - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Flags that can be specified in Flt* APIs to indicate the nature of the -// i/o operation -// -// FltReadFile/FltWriteFile will accept these flags for example -// -/////////////////////////////////////////////////////////////////////////////// - -typedef ULONG FLT_IO_OPERATION_FLAGS; - - // - // If set, the given read/write request will be non-cached. - // - - #define FLTFL_IO_OPERATION_NON_CACHED 0x00000001 - - // - // If set, the given read/write request will have the - // IRP_PAGING_IO flag set - // - - #define FLTFL_IO_OPERATION_PAGING 0x00000002 - - // - // If set, the given read/write request will not update the - // file object's current byte offset. - // - - #define FLTFL_IO_OPERATION_DO_NOT_UPDATE_BYTE_OFFSET 0x00000004 - -#if FLT_MGR_LONGHORN - // - // If set, the given read/write request will have the - // IRP_SYNCHRONOUS_PAGING_IO flag set - // - - #define FLTFL_IO_OPERATION_SYNCHRONOUS_PAGING 0x00000008 - -#endif // FLT_MGR_LONGHORN - - -/////////////////////////////////////////////////////////////////////////////// -// -// These routines are used to register/unregister all callback routines for a -// give file system mini-filter driver. -// -/////////////////////////////////////////////////////////////////////////////// - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltRegisterFilter ( - __in PDRIVER_OBJECT Driver, - __in CONST FLT_REGISTRATION *Registration, - __deref_out PFLT_FILTER *RetFilter - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltUnregisterFilter ( - __in PFLT_FILTER Filter - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltStartFiltering ( - __in PFLT_FILTER Filter - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -PVOID -FLTAPI -FltGetRoutineAddress ( - __in PCSTR FltMgrRoutineName - ); - -/////////////////////////////////////////////////////////////////////////////// -// -// Pending support routines -// -/////////////////////////////////////////////////////////////////////////////// - - -__drv_when(CallbackStatus==FLT_PREOP_COMPLETE, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(CallbackStatus!=FLT_PREOP_COMPLETE, __drv_maxIRQL(APC_LEVEL)) -VOID -FLTAPI -FltCompletePendedPreOperation ( - __in PFLT_CALLBACK_DATA CallbackData, - __in FLT_PREOP_CALLBACK_STATUS CallbackStatus, - __in_opt PVOID Context - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -FLTAPI -FltCompletePendedPostOperation ( - __in PFLT_CALLBACK_DATA CallbackData - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines for requesting operation status. This is used to get the result -// returned by IoCallDriver for operations where STATUS_PENDING is treated -// as a success code. This occurs with oplocks and directory change -// notifications -// -/////////////////////////////////////////////////////////////////////////////// - -typedef VOID -(FLTAPI *PFLT_GET_OPERATION_STATUS_CALLBACK)( - __in PCFLT_RELATED_OBJECTS FltObjects, - __in PFLT_IO_PARAMETER_BLOCK IopbSnapshot, - __in NTSTATUS OperationStatus, - __in_opt PVOID RequesterContext - ); - - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltRequestOperationStatusCallback( - __in PFLT_CALLBACK_DATA Data, - __in PFLT_GET_OPERATION_STATUS_CALLBACK CallbackRoutine, - __in_opt PVOID RequesterContext - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Memory support routines -// -/////////////////////////////////////////////////////////////////////////////// - - -__drv_when((PoolType==NonPagedPool), __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when((PoolType!=NonPagedPool), __drv_maxIRQL(APC_LEVEL)) -PVOID -FLTAPI -FltAllocatePoolAlignedWithTag ( - __in PFLT_INSTANCE Instance, - __in POOL_TYPE PoolType, - __in SIZE_T NumberOfBytes, - __in ULONG Tag - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -FLTAPI -FltFreePoolAlignedWithTag ( - __in PFLT_INSTANCE Instance, - __in PVOID Buffer, - __in ULONG Tag - ); - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines for getting file, directory and volume names. -// -/////////////////////////////////////////////////////////////////////////////// - -// -// The FLT_FILE_NAME_OPTIONS is a ULONG that gets broken down into three -// sections: -// bits 0-7: enumeration representing the file name formats available -// bits 8-15: enumeration representing the querying methods available -// bits 16-23: Currently unused -// bits 24-31: Flags -// - -typedef ULONG FLT_FILE_NAME_OPTIONS; - -// -// Name format options -// - -#define FLT_VALID_FILE_NAME_FORMATS 0x000000ff - - #define FLT_FILE_NAME_NORMALIZED 0x01 - #define FLT_FILE_NAME_OPENED 0x02 - #define FLT_FILE_NAME_SHORT 0x03 - -#define FltGetFileNameFormat( _NameOptions ) \ - ((_NameOptions) & FLT_VALID_FILE_NAME_FORMATS) - -// -// Name query methods. -// - -#define FLT_VALID_FILE_NAME_QUERY_METHODS 0x0000ff00 - - // - // In the default mode, if it is safe to query the file system, - // the Filter Manager try to retrieve the name from the cache first, and, - // if a name is not found, the name will be generated by querying the file - // system. - // - #define FLT_FILE_NAME_QUERY_DEFAULT 0x0100 - - // - // Query the Filter Manager's name cache for the name, but don't try - // to query the file system if the name is not in the cache. - // - #define FLT_FILE_NAME_QUERY_CACHE_ONLY 0x0200 - - // - // Only query the file system for the name, bypassing the Filter Manager's - // name cache completely. Any name retrieved will not be cached. - // - #define FLT_FILE_NAME_QUERY_FILESYSTEM_ONLY 0x0300 - - // - // Query the Filter Manager's name cache, but if the name is not - // found try to query the file system if it is safe to do so. - // - #define FLT_FILE_NAME_QUERY_ALWAYS_ALLOW_CACHE_LOOKUP 0x0400 - -#define FltGetFileNameQueryMethod( _NameOptions ) \ - ((_NameOptions) & FLT_VALID_FILE_NAME_QUERY_METHODS) - -// -// File name option flags -// - -#define FLT_VALID_FILE_NAME_FLAGS 0xff000000 - - // - // This flag is to be used by name provider filters to specify that a name - // query request they are making should be redirected to their filter rather - // than being satified by the name providers lower in the stack. - // - #define FLT_FILE_NAME_REQUEST_FROM_CURRENT_PROVIDER 0x01000000 - - // - // This flag denotes that the name retrieved from this query should not - // be cached. This is used by name providers as they perform intermediate - // queries to generate a name. - // - #define FLT_FILE_NAME_DO_NOT_CACHE 0x02000000 - -#if FLT_MGR_AFTER_XPSP2 - - // - // This flag denotes that it is safe to query the name in post-CREATE if - // STATUS_REPARSE was returned. To ensure the name returned is valid, - // the call must know that the FileObject->FileName was not changed before - // STATUS_REPARSE was returned. - // - #define FLT_FILE_NAME_ALLOW_QUERY_ON_REPARSE 0x04000000 - -#endif - -// -// The flags are used to tell the file name routines which types of names -// you would like parsed from the full name. They are also used to specify -// which names have been filled in for a given FLT_FILE_NAME_INFORMATION -// structure. -// - -typedef USHORT FLT_FILE_NAME_PARSED_FLAGS; - - #define FLTFL_FILE_NAME_PARSED_FINAL_COMPONENT 0x0001 - #define FLTFL_FILE_NAME_PARSED_EXTENSION 0x0002 - #define FLTFL_FILE_NAME_PARSED_STREAM 0x0004 - #define FLTFL_FILE_NAME_PARSED_PARENT_DIR 0x0008 - -// -// This structure holds the different types of name information that -// can be given for a file. The NamesParsed field will have the -// appropriate flags set to denote which names are filled in inside -// the structure. -// - -typedef struct _FLT_FILE_NAME_INFORMATION { - - USHORT Size; - - // - // For each bit that is set in the NamesParsed flags field, the - // corresponding substring from Name has been appropriately - // parsed into one of the unicode strings below. - // - - FLT_FILE_NAME_PARSED_FLAGS NamesParsed; - - // - // The name format that this FLT_FILE_NAME_INFORMATION structure - // represents. - // - - FLT_FILE_NAME_OPTIONS Format; - - // - // For normalized and opened names, this name contains the version of - // name in the following format: - // - // [Volume name][Full path to file][File name][Stream Name] - // - // For example, the above components would map to this example name as - // follows: - // - // \Device\HarddiskVolume1\Documents and Settings\MyUser\My Documents\Test Results.txt:stream1 - // - // [Volume name] = "\Device\HarddiskVolume1" - // [Full path to file] = "\Documents and Settings\MyUser\My Documents\" - // [File name] = "Test Results.txt" - // [Stream name] = ":stream1" - // - // For short names, only the short name for the final name component is - // returned in the Name unicode string. Therefore, if you requested - // the short name of the file object representing an open on the file: - // - // \Device\HarddiskVolume1\Documents and Settings\MyUser\My Documents\Test Results.txt - // - // The name returned in Name will be at most 8 characters followed by a '.' - // then at most 3 more characters, like: - // - // testre~1.txt - // - - UNICODE_STRING Name; - - // - // The Volume is only filled in for name requested in normalized and opened - // formats. - // - - UNICODE_STRING Volume; - - // - // The share component of the file name requested. This will only be - // set for normalized and opened name formats on files that opened across - // redirectors. For local files, this string will always be 0 length. - // - - UNICODE_STRING Share; - - // - // To exemplify what each of the following substrings refer to, let's - // look again at the first example string from above: - // - // \Device\HarddiskVolume1\Documents and Settings\MyUser\My Documents\Test Results.txt:stream1 - // - // Extension = "txt" - // Stream = ":stream1" - // FinalComponent = "Test Results.txt:stream1" - // ParentDir = "\Documents and Settings\MyUser\My Documents\" - // - - // - // This can be parsed from a normalized, opened, or short name. - // - - UNICODE_STRING Extension; - - // - // The following parse formats are only available for normalized and - // opened name formats, but not short names. - // - - UNICODE_STRING Stream; - UNICODE_STRING FinalComponent; - UNICODE_STRING ParentDir; - -} FLT_FILE_NAME_INFORMATION, *PFLT_FILE_NAME_INFORMATION; - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetFileNameInformation ( - __in PFLT_CALLBACK_DATA CallbackData, - __in FLT_FILE_NAME_OPTIONS NameOptions, - __deref_out PFLT_FILE_NAME_INFORMATION *FileNameInformation - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetFileNameInformationUnsafe ( - __in PFILE_OBJECT FileObject, - __in_opt PFLT_INSTANCE Instance, - __in FLT_FILE_NAME_OPTIONS NameOptions, - __deref_out PFLT_FILE_NAME_INFORMATION *FileNameInformation - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltReleaseFileNameInformation ( - __in PFLT_FILE_NAME_INFORMATION FileNameInformation - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltReferenceFileNameInformation ( - __in PFLT_FILE_NAME_INFORMATION FileNameInformation - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltParseFileName ( - __in PCUNICODE_STRING FileName, - __inout_opt PUNICODE_STRING Extension, - __inout_opt PUNICODE_STRING Stream, - __inout_opt PUNICODE_STRING FinalComponent - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltParseFileNameInformation ( - __inout PFLT_FILE_NAME_INFORMATION FileNameInformation - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetTunneledName ( - __in PFLT_CALLBACK_DATA CallbackData, - __in PFLT_FILE_NAME_INFORMATION FileNameInformation, - __deref_out_opt PFLT_FILE_NAME_INFORMATION *RetTunneledFileNameInformation - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetVolumeName ( - __in PFLT_VOLUME Volume, - __inout_opt PUNICODE_STRING VolumeName, - __out_opt PULONG BufferSizeNeeded - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetDestinationFileNameInformation ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __in_opt HANDLE RootDirectory, - __in_bcount(FileNameLength) PWSTR FileName, - __in ULONG FileNameLength, - __in FLT_FILE_NAME_OPTIONS NameOptions, - __deref_out PFLT_FILE_NAME_INFORMATION *RetFileNameInformation - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltIsDirectory ( - __in PFILE_OBJECT FileObject, - __in PFLT_INSTANCE Instance, - __out PBOOLEAN IsDirectory - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines for loading and unloading Filters -// -/////////////////////////////////////////////////////////////////////////////// - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltLoadFilter ( - __in PCUNICODE_STRING FilterName - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltUnloadFilter ( - __in PCUNICODE_STRING FilterName - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltAttachVolume ( - __inout PFLT_FILTER Filter, - __inout PFLT_VOLUME Volume, - __in_opt PCUNICODE_STRING InstanceName, - __deref_opt_out_opt PFLT_INSTANCE *RetInstance - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltAttachVolumeAtAltitude ( - __inout PFLT_FILTER Filter, - __inout PFLT_VOLUME Volume, - __in PCUNICODE_STRING Altitude, - __in_opt PCUNICODE_STRING InstanceName, - __deref_opt_out_opt PFLT_INSTANCE *RetInstance - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltDetachVolume ( - __inout PFLT_FILTER Filter, - __inout PFLT_VOLUME Volume, - __in_opt PCUNICODE_STRING InstanceName - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines for initiating I/O from within a filter. -// -/////////////////////////////////////////////////////////////////////////////// - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltAllocateCallbackData ( - __in PFLT_INSTANCE Instance, - __in_opt PFILE_OBJECT FileObject, - __deref_out PFLT_CALLBACK_DATA *RetNewCallbackData - ); - -#if FLT_MGR_WIN7 - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltAllocateCallbackDataEx ( - __in PFLT_INSTANCE Instance, - __in_opt PFILE_OBJECT FileObject, - __in FLT_ALLOCATE_CALLBACK_DATA_FLAGS Flags, - __deref_out PFLT_CALLBACK_DATA *RetNewCallbackData - ); - -#endif //FLT_MGR_WIN7 - - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -FLTAPI -FltFreeCallbackData( - __in PFLT_CALLBACK_DATA CallbackData - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltReuseCallbackData ( - __inout PFLT_CALLBACK_DATA CallbackData - ); - -__drv_when(FlagOn(CallbackData->Iopb.IrpFlags, IRP_PAGING_IO), __drv_maxIRQL(APC_LEVEL)) -__drv_when(!FlagOn(CallbackData->Iopb.IrpFlags, IRP_PAGING_IO), __drv_maxIRQL(PASSIVE_LEVEL)) -VOID -FLTAPI -FltPerformSynchronousIo ( - __inout PFLT_CALLBACK_DATA CallbackData - ); - - -__checkReturn -__drv_when( FlagOn(CallbackData->Iopb.IrpFlags, IRP_PAGING_IO), __drv_maxIRQL(APC_LEVEL)) -__drv_when( !FlagOn(CallbackData->Iopb.IrpFlags, IRP_PAGING_IO), __drv_maxIRQL(PASSIVE_LEVEL)) -NTSTATUS -FLTAPI -FltPerformAsynchronousIo ( - __inout PFLT_CALLBACK_DATA CallbackData, - __in PFLT_COMPLETED_ASYNC_IO_CALLBACK CallbackRoutine, - __in PVOID CallbackContext - ); - - -#if FLT_MGR_LONGHORN - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltCreateFileEx2 ( - __in PFLT_FILTER Filter, - __in_opt PFLT_INSTANCE Instance, - __out PHANDLE FileHandle, - __deref_opt_out PFILE_OBJECT *FileObject, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_opt PLARGE_INTEGER AllocationSize, - __in ULONG FileAttributes, - __in ULONG ShareAccess, - __in ULONG CreateDisposition, - __in ULONG CreateOptions, - __in_bcount_opt(EaLength) PVOID EaBuffer, - __in ULONG EaLength, - __in ULONG Flags, - __in_opt PIO_DRIVER_CREATE_CONTEXT DriverContext - ); - -#endif - -#if FLT_MGR_AFTER_XPSP2 - -// -// Old version, please use the Ex2 version of this API when possible -// - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltCreateFileEx ( - __in PFLT_FILTER Filter, - __in_opt PFLT_INSTANCE Instance, - __out PHANDLE FileHandle, - __deref_opt_out PFILE_OBJECT *FileObject, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_opt PLARGE_INTEGER AllocationSize, - __in ULONG FileAttributes, - __in ULONG ShareAccess, - __in ULONG CreateDisposition, - __in ULONG CreateOptions, - __in_bcount_opt(EaLength) PVOID EaBuffer, - __in ULONG EaLength, - __in ULONG Flags - ); - -#endif - -// -// Old version, please use the Ex2 version of this API when possible -// - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltCreateFile ( - __in PFLT_FILTER Filter, - __in_opt PFLT_INSTANCE Instance, - __out PHANDLE FileHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_opt PLARGE_INTEGER AllocationSize, - __in ULONG FileAttributes, - __in ULONG ShareAccess, - __in ULONG CreateDisposition, - __in ULONG CreateOptions, - __in_bcount_opt(EaLength)PVOID EaBuffer, - __in ULONG EaLength, - __in ULONG Flags - ); - -#if FLT_MGR_AFTER_XPSP2 - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltOpenVolume ( - __in PFLT_INSTANCE Instance, - __out PHANDLE VolumeHandle, - __deref_opt_out PFILE_OBJECT *VolumeFileObject - ); - -#endif - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when((Flags|FLTFL_IO_OPERATION_PAGING|FLTFL_IO_OPERATION_SYNCHRONOUS_PAGING),__drv_maxIRQL(APC_LEVEL)) -NTSTATUS -FLTAPI -FltReadFile ( - __in PFLT_INSTANCE InitiatingInstance, - __in PFILE_OBJECT FileObject, - __in_opt PLARGE_INTEGER ByteOffset, - __in ULONG Length, - __out_bcount_part(Length,*BytesRead) PVOID Buffer, - __in FLT_IO_OPERATION_FLAGS Flags, - __out_opt PULONG BytesRead, - __in_opt PFLT_COMPLETED_ASYNC_IO_CALLBACK CallbackRoutine, - __in_opt PVOID CallbackContext - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltTagFile ( - __in PFLT_INSTANCE InitiatingInstance, - __in PFILE_OBJECT FileObject, - __in ULONG FileTag, - __in_opt GUID *Guid, - __in_bcount(DataBufferLength) PVOID DataBuffer, - __in USHORT DataBufferLength - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltUntagFile( - __in PFLT_INSTANCE InitiatingInstance, - __in PFILE_OBJECT FileObject, - __in ULONG FileTag, - __in_opt GUID *Guid - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when((Flags|FLTFL_IO_OPERATION_PAGING|FLTFL_IO_OPERATION_SYNCHRONOUS_PAGING),__drv_maxIRQL(APC_LEVEL)) -NTSTATUS -FLTAPI -FltWriteFile ( - __in PFLT_INSTANCE InitiatingInstance, - __in PFILE_OBJECT FileObject, - __in_opt PLARGE_INTEGER ByteOffset, - __in ULONG Length, - __in_bcount(Length) PVOID Buffer, - __in FLT_IO_OPERATION_FLAGS Flags, - __out_opt PULONG BytesWritten, - __in_opt PFLT_COMPLETED_ASYNC_IO_CALLBACK CallbackRoutine, - __in_opt PVOID CallbackContext - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltQueryInformationFile ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __out_bcount_part(Length,*LengthReturned) PVOID FileInformation, - __in ULONG Length, - __in FILE_INFORMATION_CLASS FileInformationClass, - __out_opt PULONG LengthReturned - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltSetInformationFile ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __in_bcount(Length) PVOID FileInformation, - __in ULONG Length, - __in FILE_INFORMATION_CLASS FileInformationClass - ); - -#if FLT_MGR_LONGHORN - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltQueryDirectoryFile ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __out_bcount(Length) PVOID FileInformation, - __in ULONG Length, - __in FILE_INFORMATION_CLASS FileInformationClass, - __in BOOLEAN ReturnSingleEntry, - __in_opt PUNICODE_STRING FileName, - __in BOOLEAN RestartScan, - __out_opt PULONG LengthReturned - ); - -#endif - -#if FLT_MGR_AFTER_XPSP2 - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltQueryEaFile( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __out_bcount_part(Length,*LengthReturned) PVOID ReturnedEaData, - __in ULONG Length, - __in BOOLEAN ReturnSingleEntry, - __in_bcount_opt(EaListLength) PVOID EaList, - __in ULONG EaListLength, - __in_opt PULONG EaIndex, - __in BOOLEAN RestartScan, - __out_opt PULONG LengthReturned - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltSetEaFile( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __in_bcount(Length) PVOID EaBuffer, - __in ULONG Length - ); - -#endif - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltQueryVolumeInformationFile ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __out_bcount_part(Length,*LengthReturned) PVOID FsInformation, - __in ULONG Length, - __in FS_INFORMATION_CLASS FsInformationClass, - __out_opt PULONG LengthReturned - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltQuerySecurityObject ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __in SECURITY_INFORMATION SecurityInformation, - __inout_bcount_opt(Length) PSECURITY_DESCRIPTOR SecurityDescriptor, - __in ULONG Length, - __out_opt PULONG LengthNeeded - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltSetSecurityObject ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __in SECURITY_INFORMATION SecurityInformation, - __in PSECURITY_DESCRIPTOR SecurityDescriptor - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltFlushBuffers ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltFsControlFile ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __in ULONG FsControlCode, - __in_bcount_opt(InputBufferLength) PVOID InputBuffer, - __in ULONG InputBufferLength, - __out_bcount_part_opt(OutputBufferLength,*LengthReturned) PVOID OutputBuffer, - __in ULONG OutputBufferLength, - __out_opt PULONG LengthReturned - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltDeviceIoControlFile ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __in ULONG IoControlCode, - __in_bcount_opt(InputBufferLength) PVOID InputBuffer, - __in ULONG InputBufferLength, - __out_bcount_part_opt(OutputBufferLength,*LengthReturned) PVOID OutputBuffer, - __in ULONG OutputBufferLength, - __out_opt PULONG LengthReturned - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when((Flags|FLTFL_IO_OPERATION_PAGING|FLTFL_IO_OPERATION_SYNCHRONOUS_PAGING),__drv_maxIRQL(APC_LEVEL)) -VOID -FLTAPI -FltReissueSynchronousIo ( - __in PFLT_INSTANCE InitiatingInstance, - __in PFLT_CALLBACK_DATA CallbackData - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltClose( - __in HANDLE FileHandle - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VOID -FLTAPI -FltCancelFileOpen ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltCreateSystemVolumeInformationFolder ( - __in PFLT_INSTANCE Instance - ); - -/////////////////////////////////////////////////////////////////////////////// -// -// CONTEXT routines -// -/////////////////////////////////////////////////////////////////////////////// - -// -// Returns TRUE if the given file object supports the given type of context. -// FALSE otherwise. -// - -#if FLT_MGR_LONGHORN - -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltSupportsFileContextsEx ( - __in PFILE_OBJECT FileObject, - __in_opt PFLT_INSTANCE Instance - ); - -#endif - -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltSupportsFileContexts ( - __in PFILE_OBJECT FileObject - ); - -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltSupportsStreamContexts ( - __in PFILE_OBJECT FileObject - ); - -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltSupportsStreamHandleContexts ( - __in PFILE_OBJECT FileObject - ); - - -// -// Called to allocate a context. All context must be allocated via -// this routine. -// - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltAllocateContext ( - __in PFLT_FILTER Filter, - __in FLT_CONTEXT_TYPE ContextType, - __in SIZE_T ContextSize, - __in POOL_TYPE PoolType, - __deref_out_bcount(ContextSize) PFLT_CONTEXT *ReturnedContext - ); - -// -// Get and release multiple contexts -// - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltGetContexts ( - __in PCFLT_RELATED_OBJECTS FltObjects, - __in FLT_CONTEXT_TYPE DesiredContexts, - __out PFLT_RELATED_CONTEXTS Contexts - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltReleaseContexts ( - __in PFLT_RELATED_CONTEXTS Contexts - ); - - -// -// State values for the SetContext routines -// - -typedef enum _FLT_SET_CONTEXT_OPERATION { - - // - // If a context already exists, replace with the given context. - // Return the old context. - // - - FLT_SET_CONTEXT_REPLACE_IF_EXISTS, - - // - // If a context already exists, keep the old context and return an - // error status. Return the old context (yes, we really do want to - // return the old context, the caller already has the new context). - // The context returned must later be released. - // - - FLT_SET_CONTEXT_KEEP_IF_EXISTS - -} FLT_SET_CONTEXT_OPERATION, *PFLT_SET_CONTEXT_OPERATION; - -// -// Routines for setting a context on a given object. Once a context has -// been set, it can not be freed except in the free context callback -// routine. -// - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltSetVolumeContext ( - __in PFLT_VOLUME Volume, - __in FLT_SET_CONTEXT_OPERATION Operation, - __in PFLT_CONTEXT NewContext, - __deref_opt_out_opt PFLT_CONTEXT *OldContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltSetInstanceContext ( - __in PFLT_INSTANCE Instance, - __in FLT_SET_CONTEXT_OPERATION Operation, - __in PFLT_CONTEXT NewContext, - __deref_opt_out_opt PFLT_CONTEXT *OldContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltSetFileContext ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __in FLT_SET_CONTEXT_OPERATION Operation, - __in PFLT_CONTEXT NewContext, - __deref_opt_out_opt PFLT_CONTEXT *OldContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltSetStreamContext ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __in FLT_SET_CONTEXT_OPERATION Operation, - __in PFLT_CONTEXT NewContext, - __deref_opt_out_opt PFLT_CONTEXT *OldContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltSetStreamHandleContext ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __in FLT_SET_CONTEXT_OPERATION Operation, - __in PFLT_CONTEXT NewContext, - __deref_opt_out_opt PFLT_CONTEXT *OldContext - ); - -#if FLT_MGR_LONGHORN - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltSetTransactionContext ( - __in PFLT_INSTANCE Instance, - __in PKTRANSACTION Transaction, - __in FLT_SET_CONTEXT_OPERATION Operation, - __in PFLT_CONTEXT NewContext, - __deref_opt_out PFLT_CONTEXT *OldContext - ); - -#endif // FLT_MGR_LONGHORN - -// -// Routines for deleting a context on a given object. -// - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltDeleteContext ( - __in PFLT_CONTEXT Context - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltDeleteVolumeContext ( - __in PFLT_FILTER Filter, - __in PFLT_VOLUME Volume, - __deref_opt_out_opt PFLT_CONTEXT *OldContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltDeleteInstanceContext ( - __in PFLT_INSTANCE Instance, - __deref_opt_out_opt PFLT_CONTEXT *OldContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltDeleteFileContext ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __deref_opt_out_opt PFLT_CONTEXT *OldContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltDeleteStreamContext ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __deref_opt_out_opt PFLT_CONTEXT *OldContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltDeleteStreamHandleContext ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __deref_opt_out_opt PFLT_CONTEXT *OldContext - ); - - -#if FLT_MGR_LONGHORN - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltDeleteTransactionContext ( - __in PFLT_INSTANCE Instance, - __in PKTRANSACTION Transaction, - __deref_opt_out PFLT_CONTEXT *OldContext - ); - -#endif // FLT_MGR_LONGHORN - -// -// Routines for getting/releasing contexts. Any time a filter gets a context, -// a corresponding release must be called. -// - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetVolumeContext ( - __in PFLT_FILTER Filter, - __in PFLT_VOLUME Volume, - __deref_out PFLT_CONTEXT *Context - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetInstanceContext ( - __in PFLT_INSTANCE Instance, - __deref_out PFLT_CONTEXT *Context - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetFileContext ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __deref_out PFLT_CONTEXT *Context - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetStreamContext ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __deref_out PFLT_CONTEXT *Context - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetStreamHandleContext ( - __in PFLT_INSTANCE Instance, - __in PFILE_OBJECT FileObject, - __deref_out PFLT_CONTEXT *Context - ); - -#if FLT_MGR_LONGHORN - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetTransactionContext ( - __in PFLT_INSTANCE Instance, - __in PKTRANSACTION Transaction, - __deref_out PFLT_CONTEXT *Context - ); - -#endif // FLT_MGR_LONGHORN - -// -// This adds a reference to the given context structure. The added reference -// must be explicitly removed by a call to FltReleaseContext. -// - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -FLTAPI -FltReferenceContext ( - __in PFLT_CONTEXT Context - ); - -// -// Routine to release contexts -// - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -FLTAPI -FltReleaseContext ( - __in PFLT_CONTEXT Context - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines for getting handles to Filters, Instances, -// and Volumes. -// -/////////////////////////////////////////////////////////////////////////////// - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetFilterFromName ( - __in PCUNICODE_STRING FilterName, - __deref_out PFLT_FILTER *RetFilter - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltGetVolumeFromName ( - __in PFLT_FILTER Filter, - __in PCUNICODE_STRING VolumeName, - __deref_out PFLT_VOLUME *RetVolume - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetVolumeInstanceFromName ( - __in_opt PFLT_FILTER Filter, - __in PFLT_VOLUME Volume, - __in_opt PCUNICODE_STRING InstanceName, - __deref_out PFLT_INSTANCE *RetInstance - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetVolumeFromInstance ( - __in PFLT_INSTANCE Instance, - __deref_out PFLT_VOLUME *RetVolume - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetFilterFromInstance ( - __in PFLT_INSTANCE Instance, - __deref_out PFLT_FILTER *RetFilter - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetVolumeFromFileObject ( - __in PFLT_FILTER Filter, - __in PFILE_OBJECT FileObject, - __deref_out PFLT_VOLUME *RetVolume - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetVolumeFromDeviceObject ( - __in PFLT_FILTER Filter, - __in PDEVICE_OBJECT DeviceObject, - __deref_out PFLT_VOLUME *RetVolume - ); - -#if FLT_MGR_LONGHORN - -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltIsFltMgrVolumeDeviceObject( - __in PDEVICE_OBJECT DeviceObject - ); - -#endif - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltGetDeviceObject ( - __in PFLT_VOLUME Volume, - __deref_out PDEVICE_OBJECT *DeviceObject - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltGetDiskDeviceObject( - __in PFLT_VOLUME Volume, - __deref_out PDEVICE_OBJECT *DiskDeviceObject - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetLowerInstance ( - __in PFLT_INSTANCE CurrentInstance, - __deref_out PFLT_INSTANCE *LowerInstance - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetUpperInstance ( - __in PFLT_INSTANCE CurrentInstance, - __deref_out PFLT_INSTANCE *UpperInstance - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetTopInstance ( - __in PFLT_VOLUME Volume, - __deref_out PFLT_INSTANCE *Instance - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetBottomInstance ( - __in PFLT_VOLUME Volume, - __deref_out PFLT_INSTANCE *Instance - ); - -LONG -FLTAPI -FltCompareInstanceAltitudes ( - __in PFLT_INSTANCE Instance1, - __in PFLT_INSTANCE Instance2 - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines for getting information on Filters and Filter Instances. -// -/////////////////////////////////////////////////////////////////////////////// - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetFilterInformation ( - __in PFLT_FILTER Filter, - __in FILTER_INFORMATION_CLASS InformationClass, - __out_bcount_part_opt(BufferSize, *BytesReturned) PVOID Buffer, - __in ULONG BufferSize, - __out PULONG BytesReturned - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetInstanceInformation ( - __in PFLT_INSTANCE Instance, - __in INSTANCE_INFORMATION_CLASS InformationClass, - __out_bcount_part_opt(BufferSize,*BytesReturned) PVOID Buffer, - __in ULONG BufferSize, - __out PULONG BytesReturned - ); - -#if FLT_MGR_LONGHORN - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetVolumeInformation ( - __in PFLT_VOLUME Volume, - __in FILTER_VOLUME_INFORMATION_CLASS InformationClass, - __out_bcount_part_opt(BufferSize,*BytesReturned) PVOID Buffer, - __in ULONG BufferSize, - __out PULONG BytesReturned - ); - -#endif // FLT_MGR_LONGHORN - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines for getting information about Volumes. -// -/////////////////////////////////////////////////////////////////////////////// - -typedef struct _FLT_VOLUME_PROPERTIES { - - // - // The possible DeviceTypes are defined in NTIFS.H and begin with - // FILE_DEVICE_ - // - - DEVICE_TYPE DeviceType; - - // - // The possible DeviceCharacteristics flags are defined in NTIFS.H. - // Potential values are: - // FILE_REMOVABLE_MEDIA - // FILE_READ_ONLY_DEVICE - // FILE_FLOPPY_DISKETTE - // FILE_WRITE_ONCE_MEDIA - // FILE_REMOTE_DEVICE - // FILE_DEVICE_IS_MOUNTED - // FILE_VIRTUAL_VOLUME - // FILE_AUTOGENERATED_DEVICE_NAME - // FILE_DEVICE_SECURE_OPEN - // - - ULONG DeviceCharacteristics; - - // - // The possible DeviceObjectFlags are define in NTIFS.H. All potential - // values begin with DO_. - // - - ULONG DeviceObjectFlags; - - ULONG AlignmentRequirement; - - USHORT SectorSize; - - USHORT Reserved0; - - // - // The name of the file system driver associated with this device. - // - // The buffer for this unicode string is contiguous with this structure and - // does not need to be initialized before calling FltGetVolumeProperties. - // - - UNICODE_STRING FileSystemDriverName; - - // - // The name of the file system device associated with this device. - // - // The buffer for this unicode string is contiguous with this structure and - // does not need to be initialized before calling FltGetVolumeProperties. - // - - UNICODE_STRING FileSystemDeviceName; - - // - // The name of the real device object associated with this device. This - // is empty for network file systems. - // - // The buffer for this unicode string is contiguous with this structure and - // does not need to be initialized before calling FltGetVolumeProperties. - // - - UNICODE_STRING RealDeviceName; - -} FLT_VOLUME_PROPERTIES, *PFLT_VOLUME_PROPERTIES; - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetVolumeProperties ( - __in PFLT_VOLUME Volume, - __out_bcount_part_opt(VolumePropertiesLength,*LengthReturned) PFLT_VOLUME_PROPERTIES VolumeProperties, - __in ULONG VolumePropertiesLength, - __out PULONG LengthReturned - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltIsVolumeWritable ( - __in PVOID FltObject, - __out PBOOLEAN IsWritable - ); - -#if FLT_MGR_LONGHORN - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetFileSystemType ( - __in PVOID FltObject, - __out PFLT_FILESYSTEM_TYPE FileSystemType - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltIsVolumeSnapshot ( - __in PVOID FltObject, - __out PBOOLEAN IsSnapshotVolume - ); - -#endif // FLT_MGR_LONGHORN - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltGetVolumeGuidName ( - __in PFLT_VOLUME Volume, - __out PUNICODE_STRING VolumeGuidName, - __out_opt PULONG BufferSizeNeeded - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltQueryVolumeInformation( - __in PFLT_INSTANCE Instance, - __out PIO_STATUS_BLOCK Iosb, - __out_bcount(Length) PVOID FsInformation, - __in ULONG Length, - __in FS_INFORMATION_CLASS FsInformationClass - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltSetVolumeInformation( - __in PFLT_INSTANCE Instance, - __out PIO_STATUS_BLOCK Iosb, - __out_bcount(Length) PVOID FsInformation, - __in ULONG Length, - __in FS_INFORMATION_CLASS FsInformationClass - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines for enumerating Filter information, Instance informations and -// Filter Instances in the system. -// -/////////////////////////////////////////////////////////////////////////////// - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltEnumerateFilters ( - __out_ecount_part_opt(FilterListSize,*NumberFiltersReturned) PFLT_FILTER *FilterList, - __in ULONG FilterListSize, - __out PULONG NumberFiltersReturned - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltEnumerateVolumes ( - __in PFLT_FILTER Filter, - __out_ecount_part_opt(VolumeListSize,*NumberVolumesReturned) PFLT_VOLUME *VolumeList, - __in ULONG VolumeListSize, - __out PULONG NumberVolumesReturned - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltEnumerateInstances ( - __in_opt PFLT_VOLUME Volume, - __in_opt PFLT_FILTER Filter, - __out_ecount_part_opt(InstanceListSize,*NumberInstancesReturned) PFLT_INSTANCE *InstanceList, - __in ULONG InstanceListSize, - __out PULONG NumberInstancesReturned - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltEnumerateFilterInformation ( - __in ULONG Index, - __in FILTER_INFORMATION_CLASS InformationClass, - __out_bcount_part_opt(BufferSize,*BytesReturned) PVOID Buffer, - __in ULONG BufferSize, - __out PULONG BytesReturned - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltEnumerateInstanceInformationByFilter ( - __in PFLT_FILTER Filter, - __in ULONG Index, - __in INSTANCE_INFORMATION_CLASS InformationClass, - __out_bcount_part_opt(BufferSize,*BytesReturned) PVOID Buffer, - __in ULONG BufferSize, - __out PULONG BytesReturned - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltEnumerateInstanceInformationByVolume ( - __in PFLT_VOLUME Volume, - __in ULONG Index, - __in INSTANCE_INFORMATION_CLASS InformationClass, - __out_bcount_part_opt(BufferSize,*BytesReturned) PVOID Buffer, - __in ULONG BufferSize, - __out PULONG BytesReturned - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltEnumerateVolumeInformation ( - __in PFLT_FILTER Filter, - __in ULONG Index, - __in FILTER_VOLUME_INFORMATION_CLASS InformationClass, - __out_bcount_part_opt(BufferSize,*BytesReturned) PVOID Buffer, - __in ULONG BufferSize, - __out PULONG BytesReturned - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines for referencing and closing FLT_VOLUMEs, FLT_INSTANCEs, and -// FLT_FILTERs. -// -/////////////////////////////////////////////////////////////////////////////// - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltObjectReference ( - __inout PVOID FltObject - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -FLTAPI -FltObjectDereference ( - __inout PVOID FltObject - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines & defs for sending messages from a filter to a user-mode component. -// -/////////////////////////////////////////////////////////////////////////////// - -// -// Access masks for filter communication ports -// - -#define FLT_PORT_CONNECT 0x0001 -#define FLT_PORT_ALL_ACCESS (FLT_PORT_CONNECT | STANDARD_RIGHTS_ALL) - -// -// Callback to notify a filter it has received a message from a user App -// - -typedef NTSTATUS -(FLTAPI *PFLT_MESSAGE_NOTIFY) ( - __in_opt PVOID PortCookie, - __in_bcount_opt(InputBufferLength) PVOID InputBuffer, - __in ULONG InputBufferLength, - __out_bcount_part_opt(OutputBufferLength,*ReturnOutputBufferLength) PVOID OutputBuffer, - __in ULONG OutputBufferLength, - __out PULONG ReturnOutputBufferLength - ); - -// -// Callback to notify a filter when a new connection to a port is established -// - -typedef NTSTATUS -(FLTAPI *PFLT_CONNECT_NOTIFY) ( - __in PFLT_PORT ClientPort, - __in_opt PVOID ServerPortCookie, - __in_bcount_opt(SizeOfContext) PVOID ConnectionContext, - __in ULONG SizeOfContext, - __deref_out_opt PVOID *ConnectionPortCookie - ); - -// -// Callback to notify a filter when a connection to a port is being torn down -// - -typedef VOID -(FLTAPI *PFLT_DISCONNECT_NOTIFY) ( - __in_opt PVOID ConnectionCookie - ); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltCreateCommunicationPort ( - __in PFLT_FILTER Filter, - __deref_out PFLT_PORT *ServerPort, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt PVOID ServerPortCookie, - __in PFLT_CONNECT_NOTIFY ConnectNotifyCallback, - __in PFLT_DISCONNECT_NOTIFY DisconnectNotifyCallback, - __in_opt PFLT_MESSAGE_NOTIFY MessageNotifyCallback, - __in LONG MaxConnections - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VOID -FLTAPI -FltCloseCommunicationPort ( - __in PFLT_PORT ServerPort - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VOID -FLTAPI -FltCloseClientPort ( - __in PFLT_FILTER Filter, - __deref_out PFLT_PORT *ClientPort - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltSendMessage ( - __in PFLT_FILTER Filter, - __deref_in PFLT_PORT *ClientPort, - __in_bcount(SenderBufferLength) PVOID SenderBuffer, - __in ULONG SenderBufferLength, - __out_bcount_opt(*ReplyLength) PVOID ReplyBuffer, - __inout_opt PULONG ReplyLength, - __in_opt PLARGE_INTEGER Timeout - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltBuildDefaultSecurityDescriptor( - __deref_out PSECURITY_DESCRIPTOR *SecurityDescriptor, - __in ACCESS_MASK DesiredAccess - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltFreeSecurityDescriptor( - __in PSECURITY_DESCRIPTOR SecurityDescriptor - ); - -/////////////////////////////////////////////////////////////////////////////// -// -// Plain cancel support. Note that using callback data queues and -// setting the cancel routine manually is not supported -// -/////////////////////////////////////////////////////////////////////////////// - -typedef VOID -(FLTAPI *PFLT_COMPLETE_CANCELED_CALLBACK) ( - __in PFLT_CALLBACK_DATA CallbackData -); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -BOOLEAN -FLTAPI -FltCancelIo( - __in PFLT_CALLBACK_DATA CallbackData - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltSetCancelCompletion ( - __in PFLT_CALLBACK_DATA CallbackData, - __in PFLT_COMPLETE_CANCELED_CALLBACK CanceledCallback - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltClearCancelCompletion( - __in PFLT_CALLBACK_DATA CallbackData - ); - -BOOLEAN -FLTAPI -FltIsIoCanceled( - __in PFLT_CALLBACK_DATA CallbackData - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Workqueue wrappers -// -/////////////////////////////////////////////////////////////////////////////// - -typedef struct _FLT_DEFERRED_IO_WORKITEM *PFLT_DEFERRED_IO_WORKITEM; -typedef struct _FLT_GENERIC_WORKITEM *PFLT_GENERIC_WORKITEM; - -typedef VOID -(FLTAPI *PFLT_DEFERRED_IO_WORKITEM_ROUTINE) ( - __in PFLT_DEFERRED_IO_WORKITEM FltWorkItem, - __in PFLT_CALLBACK_DATA CallbackData, - __in_opt PVOID Context - ); - -typedef VOID -(FLTAPI *PFLT_GENERIC_WORKITEM_ROUTINE) ( - __in PFLT_GENERIC_WORKITEM FltWorkItem, - __in PVOID FltObject, - __in_opt PVOID Context - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -PFLT_DEFERRED_IO_WORKITEM -FLTAPI -FltAllocateDeferredIoWorkItem( - VOID - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -FLTAPI -FltFreeDeferredIoWorkItem ( - __in PFLT_DEFERRED_IO_WORKITEM FltWorkItem - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -PFLT_GENERIC_WORKITEM -FLTAPI -FltAllocateGenericWorkItem( - VOID - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -FLTAPI -FltFreeGenericWorkItem ( - __in PFLT_GENERIC_WORKITEM FltWorkItem - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltQueueDeferredIoWorkItem ( - __in PFLT_DEFERRED_IO_WORKITEM FltWorkItem, - __in PFLT_CALLBACK_DATA Data, - __in PFLT_DEFERRED_IO_WORKITEM_ROUTINE WorkerRoutine, - __in WORK_QUEUE_TYPE QueueType, - __in PVOID Context - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltQueueGenericWorkItem ( - __in PFLT_GENERIC_WORKITEM FltWorkItem, - __in PVOID FltObject, - __in PFLT_GENERIC_WORKITEM_ROUTINE WorkerRoutine, - __in WORK_QUEUE_TYPE QueueType, - __in_opt PVOID Context - ); - - - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines for decoding params, locking data buffers etc. -// -/////////////////////////////////////////////////////////////////////////////// - - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltLockUserBuffer( - __in PFLT_CALLBACK_DATA CallbackData - ); - -NTSTATUS -FLTAPI -FltDecodeParameters( - __in PFLT_CALLBACK_DATA CallbackData, - __deref_opt_out PMDL **MdlAddressPointer, - __deref_opt_out_bcount(**Length) PVOID **Buffer, - __deref_opt_out PULONG *Length, - __out_opt LOCK_OPERATION *DesiredAccess - ); - -PMDL -FASTCALL -FltGetSwappedBufferMdlAddress( - __in PFLT_CALLBACK_DATA CallbackData - ); - -VOID -FASTCALL -FltRetainSwappedBufferMdlAddress( - __in PFLT_CALLBACK_DATA CallbackData - ); - -#if FLT_MGR_WIN7 - -__checkReturn -__drv_maxIRQL(DPC_LEVEL) -PVOID -FLTAPI -FltGetNewSystemBufferAddress( - __in PFLT_CALLBACK_DATA CallbackData - ); - -#endif // FLT_MGR_WIN7 - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines for accessing cancel-safe queue abstraction provided by -// filter manager -// -/////////////////////////////////////////////////////////////////////////////// - -// -// The cancel safe queue is not exposed in the w2k DDK headers, so we -// define what is neccesary here. -// - -typedef IO_CSQ_IRP_CONTEXT FLT_CALLBACK_DATA_QUEUE_IO_CONTEXT, *PFLT_CALLBACK_DATA_QUEUE_IO_CONTEXT; - -// -// Forward define callback data queue -// - -typedef struct _FLT_CALLBACK_DATA_QUEUE FLT_CALLBACK_DATA_QUEUE, *PFLT_CALLBACK_DATA_QUEUE; - -// -// Routines that insert/remove callback data's -// - -typedef NTSTATUS -(FLTAPI *PFLT_CALLBACK_DATA_QUEUE_INSERT_IO)( - __inout PFLT_CALLBACK_DATA_QUEUE Cbdq, - __in PFLT_CALLBACK_DATA Cbd, - __in_opt PVOID InsertContext - ); - -typedef VOID -(FLTAPI *PFLT_CALLBACK_DATA_QUEUE_REMOVE_IO)( - __inout PFLT_CALLBACK_DATA_QUEUE Cbdq, - __in PFLT_CALLBACK_DATA Cbd - ); - -// -// Retrieves the next callback data from the queue. NULL if none are left. -// If Cbd is NULL, returns the entry at the head of the queue. Does not remove -// Cbd from queue. -// - -typedef PFLT_CALLBACK_DATA -(FLTAPI *PFLT_CALLBACK_DATA_QUEUE_PEEK_NEXT_IO)( - __in PFLT_CALLBACK_DATA_QUEUE Cbdq, - __in_opt PFLT_CALLBACK_DATA Cbd, - __in_opt PVOID PeekContext - ); - -// -// Lock routine that protects the cancel safe queue -// - -typedef VOID -(FLTAPI *PFLT_CALLBACK_DATA_QUEUE_ACQUIRE)( - __inout PFLT_CALLBACK_DATA_QUEUE Cbdq, - __out PKIRQL Irql - ); - -typedef VOID -(FLTAPI *PFLT_CALLBACK_DATA_QUEUE_RELEASE)( - __inout PFLT_CALLBACK_DATA_QUEUE Cbdq, - __in KIRQL Irql - ); - -// -// Cancel routine callback for queued callback data's -// - -typedef VOID -(FLTAPI *PFLT_CALLBACK_DATA_QUEUE_COMPLETE_CANCELED_IO)( - __inout PFLT_CALLBACK_DATA_QUEUE Cbdq, - __inout PFLT_CALLBACK_DATA Cbd - ); - - -typedef enum _FLT_CALLBACK_DATA_QUEUE_FLAGS FLT_CALLBACK_DATA_QUEUE_FLAGS; -// -// Following structure is opaque to filters, but allocated by them. -// - -typedef struct _FLT_CALLBACK_DATA_QUEUE { - - // - // Embedded IRP cancel queue: this is opaque to minifilters - // - - IO_CSQ Csq; - - // - // Flags .. These are private to filter manager - // - - FLT_CALLBACK_DATA_QUEUE_FLAGS Flags; - - // - // Instance that is using this queue - // - - PFLT_INSTANCE Instance; - - // - // Cancel-safe queue callbacks - // - - PFLT_CALLBACK_DATA_QUEUE_INSERT_IO InsertIo; - PFLT_CALLBACK_DATA_QUEUE_REMOVE_IO RemoveIo; - PFLT_CALLBACK_DATA_QUEUE_PEEK_NEXT_IO PeekNextIo; - PFLT_CALLBACK_DATA_QUEUE_ACQUIRE Acquire; - PFLT_CALLBACK_DATA_QUEUE_RELEASE Release; - PFLT_CALLBACK_DATA_QUEUE_COMPLETE_CANCELED_IO CompleteCanceledIo; - - -} FLT_CALLBACK_DATA_QUEUE, *PFLT_CALLBACK_DATA_QUEUE; - - -NTSTATUS -FLTAPI -FltCbdqInitialize( - __in PFLT_INSTANCE Instance, - __inout PFLT_CALLBACK_DATA_QUEUE Cbdq, - __in PFLT_CALLBACK_DATA_QUEUE_INSERT_IO CbdqInsertIo, - __in PFLT_CALLBACK_DATA_QUEUE_REMOVE_IO CbdqRemoveIo, - __in PFLT_CALLBACK_DATA_QUEUE_PEEK_NEXT_IO CbdqPeekNextIo, - __in PFLT_CALLBACK_DATA_QUEUE_ACQUIRE CbdqAcquire, - __in PFLT_CALLBACK_DATA_QUEUE_RELEASE CbdqRelease, - __in PFLT_CALLBACK_DATA_QUEUE_COMPLETE_CANCELED_IO CbdqCompleteCanceledIo - ); - -VOID -FLTAPI -FltCbdqEnable( - __inout PFLT_CALLBACK_DATA_QUEUE Cbdq - ); - -VOID -FLTAPI -FltCbdqDisable( - __inout PFLT_CALLBACK_DATA_QUEUE Cbdq - ); - -__checkReturn -NTSTATUS -FLTAPI -FltCbdqInsertIo( - __inout PFLT_CALLBACK_DATA_QUEUE Cbdq, - __in PFLT_CALLBACK_DATA Cbd, - __in_opt PFLT_CALLBACK_DATA_QUEUE_IO_CONTEXT Context, - __in_opt PVOID InsertContext - ); - -__checkReturn -PFLT_CALLBACK_DATA -FLTAPI -FltCbdqRemoveIo( - __inout PFLT_CALLBACK_DATA_QUEUE Cbdq, - __in PFLT_CALLBACK_DATA_QUEUE_IO_CONTEXT Context - ); - -__checkReturn -PFLT_CALLBACK_DATA -FLTAPI -FltCbdqRemoveNextIo( - __inout PFLT_CALLBACK_DATA_QUEUE Cbdq, - __in_opt PVOID PeekContext - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines and callbacks for handling oplocks provided by filter manager -// -/////////////////////////////////////////////////////////////////////////////// - -typedef -VOID -(FLTAPI *PFLTOPLOCK_WAIT_COMPLETE_ROUTINE) ( - __in PFLT_CALLBACK_DATA CallbackData, - __in_opt PVOID Context - ); - -typedef -VOID -(FLTAPI *PFLTOPLOCK_PREPOST_CALLBACKDATA_ROUTINE) ( - __in PFLT_CALLBACK_DATA CallbackData, - __in_opt PVOID Context - ); - -// -// Oplock support routines. -// - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltInitializeOplock ( - __out POPLOCK Oplock - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltUninitializeOplock ( - __in POPLOCK Oplock - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -FLT_PREOP_CALLBACK_STATUS -FLTAPI -FltOplockFsctrl ( - __in POPLOCK Oplock, - __in PFLT_CALLBACK_DATA CallbackData, - __in ULONG OpenCount - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -FLT_PREOP_CALLBACK_STATUS -FLTAPI -FltCheckOplock ( - __in POPLOCK Oplock, - __in PFLT_CALLBACK_DATA CallbackData, - __in_opt PVOID Context, - __in_opt PFLTOPLOCK_WAIT_COMPLETE_ROUTINE WaitCompletionRoutine, - __in_opt PFLTOPLOCK_PREPOST_CALLBACKDATA_ROUTINE PrePostCallbackDataRoutine - ); - -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltOplockIsFastIoPossible ( - __in POPLOCK Oplock - ); - -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltCurrentBatchOplock ( - __in POPLOCK Oplock - ); - -#if FLT_MGR_WIN7 - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -FLT_PREOP_CALLBACK_STATUS -FLTAPI -FltCheckOplockEx ( - __in POPLOCK Oplock, - __in PFLT_CALLBACK_DATA CallbackData, - __in ULONG Flags, - __in_opt PVOID Context, - __in_opt PFLTOPLOCK_WAIT_COMPLETE_ROUTINE WaitCompletionRoutine, - __in_opt PFLTOPLOCK_PREPOST_CALLBACKDATA_ROUTINE PrePostCallbackDataRoutine - ); - -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltCurrentOplock ( - __in POPLOCK Oplock - ); - -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltCurrentOplockH ( - __in POPLOCK Oplock - ); - -__drv_maxIRQL(APC_LEVEL) -FLT_PREOP_CALLBACK_STATUS -FLTAPI -FltOplockBreakH ( - __in POPLOCK Oplock, - __in PFLT_CALLBACK_DATA CallbackData, - __in ULONG Flags, - __in_opt PVOID Context, - __in_opt PFLTOPLOCK_WAIT_COMPLETE_ROUTINE WaitCompletionRoutine, - __in_opt PFLTOPLOCK_PREPOST_CALLBACKDATA_ROUTINE PrePostCallbackDataRoutine - ); - -__drv_maxIRQL(APC_LEVEL) -FLT_PREOP_CALLBACK_STATUS -FLTAPI -FltOplockBreakToNone ( - __in POPLOCK Oplock, - __in PFLT_CALLBACK_DATA CallbackData, - __in_opt PVOID Context, - __in_opt PFLTOPLOCK_WAIT_COMPLETE_ROUTINE WaitCompletionRoutine, - __in_opt PFLTOPLOCK_PREPOST_CALLBACKDATA_ROUTINE PrePostCallbackDataRoutine - ); - -__drv_maxIRQL(APC_LEVEL) -FLT_PREOP_CALLBACK_STATUS -FLTAPI -FltOplockBreakToNoneEx ( - __in POPLOCK Oplock, - __in PFLT_CALLBACK_DATA CallbackData, - __in ULONG Flags, - __in_opt PVOID Context, - __in_opt PFLTOPLOCK_WAIT_COMPLETE_ROUTINE WaitCompletionRoutine, - __in_opt PFLTOPLOCK_PREPOST_CALLBACKDATA_ROUTINE PrePostCallbackDataRoutine - ); - -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltOplockIsSharedRequest ( - __in PFLT_CALLBACK_DATA CallbackData - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -FLT_PREOP_CALLBACK_STATUS -FLTAPI -FltOplockFsctrlEx ( - __in POPLOCK Oplock, - __in PFLT_CALLBACK_DATA CallbackData, - __in ULONG OpenCount, - __in ULONG Flags - ); - -BOOLEAN -FLTAPI -FltOplockKeysEqual ( - __in_opt PFILE_OBJECT Fo1, - __in_opt PFILE_OBJECT Fo2 - ); - -#endif // FLT_MGR_WIN7 - -/////////////////////////////////////////////////////////////////////////////// -// -// Routines and callbacks for handling file lock support provided by filter manager -// -/////////////////////////////////////////////////////////////////////////////// - -typedef -NTSTATUS -(*PFLT_COMPLETE_LOCK_CALLBACK_DATA_ROUTINE) ( - __in_opt PVOID Context, - __in PFLT_CALLBACK_DATA CallbackData - ); - -VOID -FLTAPI -FltInitializeFileLock ( - __out PFILE_LOCK FileLock - ); - -VOID -FLTAPI -FltUninitializeFileLock ( - __in PFILE_LOCK FileLock - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -PFILE_LOCK -FLTAPI -FltAllocateFileLock ( - __in_opt PFLT_COMPLETE_LOCK_CALLBACK_DATA_ROUTINE CompleteLockCallbackDataRoutine, - __in_opt PUNLOCK_ROUTINE UnlockRoutine - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltFreeFileLock ( - __in PFILE_LOCK FileLock - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -FLT_PREOP_CALLBACK_STATUS -FLTAPI -FltProcessFileLock ( - __in PFILE_LOCK FileLock, - __in PFLT_CALLBACK_DATA CallbackData, - __in_opt PVOID Context - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltCheckLockForReadAccess ( - __in PFILE_LOCK FileLock, - __in PFLT_CALLBACK_DATA CallbackData - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltCheckLockForWriteAccess ( - __in PFILE_LOCK FileLock, - __in PFLT_CALLBACK_DATA CallbackData - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Locking Primitives -// -/////////////////////////////////////////////////////////////////////////////// - -// -// EResource APIs which do proper wrapping of KeEnterCriticalRegion and -// KeExitCriticalRegion to disable APCs (except Special Kernel APCs) while -// the lock is held -// -// Use ExInitializeResourceLite() to init the resource -// Use ExDeleteResourceLite() to delete the resource -// - -__drv_acquiresCriticalRegion -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltAcquireResourceExclusive( - __inout __deref __drv_neverHold(ResourceLite) - __deref __drv_acquiresResource(ResourceLite) - PERESOURCE Resource - ); - -__drv_acquiresCriticalRegion -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltAcquireResourceShared( - __inout __deref __drv_neverHold(ResourceLite) - __deref __drv_acquiresResource(ResourceLite) - PERESOURCE Resource - ); - -__drv_mustHoldCriticalRegion -__drv_releasesCriticalRegion -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -FLTAPI -FltReleaseResource( - __inout __deref __drv_releasesExclusiveResource(ResourceLite) PERESOURCE Resource - ); - - -// -// PUSHLOCK APIs which do proper wrapping of KeEnterCriticalRegion and -// KeExitCriticalRegion to disable APCs (except Special Kernel APCs) while -// the lock is held -// - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltInitializePushLock( - __out PEX_PUSH_LOCK PushLock - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltDeletePushLock( - __in PEX_PUSH_LOCK PushLock - ); - -__drv_acquiresCriticalRegion -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltAcquirePushLockExclusive( - __inout __deref __drv_acquiresExclusiveResource(ExPushLockType) - PEX_PUSH_LOCK PushLock - ); - -__drv_acquiresCriticalRegion -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltAcquirePushLockShared( - __inout __deref __drv_acquiresExclusiveResource(ExPushLockType) - PEX_PUSH_LOCK PushLock - ); - -__drv_mustHoldCriticalRegion -__drv_releasesCriticalRegion -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltReleasePushLock( - __inout __deref __drv_releasesExclusiveResource(ExPushLockType) - PEX_PUSH_LOCK PushLock - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Synchronization support routines -// -/////////////////////////////////////////////////////////////////////////////// - -#if FLT_MGR_LONGHORN - -__checkReturn -__drv_when(((CallbackData!=NULL) && FLT_IS_IRP_OPERATION(CallbackData)), __drv_maxIRQL(PASSIVE_LEVEL)) -__drv_when((!((CallbackData!=NULL) && FLT_IS_IRP_OPERATION(CallbackData))), __drv_maxIRQL(APC_LEVEL)) -NTSTATUS -FLTAPI -FltCancellableWaitForSingleObject( - __in PVOID Object, - __in_opt PLARGE_INTEGER Timeout, - __in_opt PFLT_CALLBACK_DATA CallbackData - ); - -__checkReturn -__drv_when(((CallbackData!=NULL) && FLT_IS_IRP_OPERATION(CallbackData)), __drv_maxIRQL(PASSIVE_LEVEL)) -__drv_when((!((CallbackData!=NULL) && FLT_IS_IRP_OPERATION(CallbackData))), __drv_maxIRQL(APC_LEVEL)) -NTSTATUS -FLTAPI -FltCancellableWaitForMultipleObjects( - __in ULONG Count, - __in_ecount(Count) PVOID ObjectArray[], - __in WAIT_TYPE WaitType, - __in_opt PLARGE_INTEGER Timeout, - __in_opt PKWAIT_BLOCK WaitBlockArray, - __in PFLT_CALLBACK_DATA CallbackData - ); - -#endif // FLT_MGR_LONGHORN - - -/////////////////////////////////////////////////////////////////////////////// -// -// General support routines -// -/////////////////////////////////////////////////////////////////////////////// - - -BOOLEAN -FLTAPI -FltIsOperationSynchronous ( - __in PFLT_CALLBACK_DATA CallbackData - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -BOOLEAN -FLTAPI -FltIs32bitProcess ( - __in_opt PFLT_CALLBACK_DATA CallbackData - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -PEPROCESS -FLTAPI -FltGetRequestorProcess ( - __in PFLT_CALLBACK_DATA CallbackData - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -ULONG -FLTAPI -FltGetRequestorProcessId ( - __in PFLT_CALLBACK_DATA CallbackData - ); - -#if FLT_MGR_LONGHORN - -__drv_maxIRQL(DISPATCH_LEVEL) -HANDLE -FLTAPI -FltGetRequestorProcessIdEx ( - __in PFLT_CALLBACK_DATA CallbackData - ); - -#endif // FLT_MGR_LONGHORN - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltNotifyFilterChangeDirectory ( - __inout PNOTIFY_SYNC NotifySync, - __inout PLIST_ENTRY NotifyList, - __in PVOID FsContext, - __in PSTRING FullDirectoryName, - __in BOOLEAN WatchTree, - __in BOOLEAN IgnoreBuffer, - __in ULONG CompletionFilter, - __in PFLT_CALLBACK_DATA NotifyCallbackData, - __in_opt PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback, - __in_opt PSECURITY_SUBJECT_CONTEXT SubjectContext, - __in_opt PFILTER_REPORT_CHANGE FilterCallback - ); - -#if FLT_MGR_WIN7 - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetRequestorSessionId( - __in PFLT_CALLBACK_DATA CallbackData, - __out PULONG SessionId - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltAdjustDeviceStackSizeForIoRedirection( - __in PFLT_INSTANCE SourceInstance, - __in PFLT_INSTANCE TargetInstance, - __out_opt PBOOLEAN SourceDeviceStackSizeModified - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltIsIoRedirectionAllowed( - __in PFLT_INSTANCE SourceInstance, - __in PFLT_INSTANCE TargetInstance, - __out PBOOLEAN RedirectionAllowed - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltIsIoRedirectionAllowedForOperation( - __in PFLT_CALLBACK_DATA Data, - __in PFLT_INSTANCE TargetInstance, - __out PBOOLEAN RedirectionAllowedThisIo, - __out_opt PBOOLEAN RedirectionAllowedAllIo - ); - - -#endif // FLT_MGR_WIN7 - - -/////////////////////////////////////////////////////////////////////////////// -// -// Transaction (TxF) support routines -// -/////////////////////////////////////////////////////////////////////////////// - -#if FLT_MGR_LONGHORN - -// -// Select ALL transaction notification values -// - -#define FLT_MAX_TRANSACTION_NOTIFICATIONS \ - (TRANSACTION_NOTIFY_PREPREPARE | \ - TRANSACTION_NOTIFY_PREPARE | \ - TRANSACTION_NOTIFY_COMMIT | \ - TRANSACTION_NOTIFY_ROLLBACK | \ - TRANSACTION_NOTIFY_COMMIT_FINALIZE) - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltEnlistInTransaction ( - __in PFLT_INSTANCE Instance, - __in PKTRANSACTION Transaction, - __in PFLT_CONTEXT TransactionContext, - __in NOTIFICATION_MASK NotificationMask - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltRollbackEnlistment ( - __in PFLT_INSTANCE Instance, - __in PKTRANSACTION Transaction, - __in_opt PFLT_CONTEXT TransactionContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltPrePrepareComplete ( - __in PFLT_INSTANCE Instance, - __in PKTRANSACTION Transaction, - __in_opt PFLT_CONTEXT TransactionContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltPrepareComplete ( - __in PFLT_INSTANCE Instance, - __in PKTRANSACTION Transaction, - __in_opt PFLT_CONTEXT TransactionContext - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltCommitComplete ( - __in PFLT_INSTANCE Instance, - __in PKTRANSACTION Transaction, - __in_opt PFLT_CONTEXT TransactionContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltCommitFinalizeComplete ( - __in PFLT_INSTANCE Instance, - __in PKTRANSACTION Transaction, - __in_opt PFLT_CONTEXT TransactionContext - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FLTAPI -FltRollbackComplete ( - __in PFLT_INSTANCE Instance, - __in PKTRANSACTION Transaction, - __in_opt PFLT_CONTEXT TransactionContext - ); - -// -// Some Kernel routines related to ECP manipulation -// ZwCreateTransactionManager -// ZwCreateResourceManager -// TmEnableCallbacks -// IoGetTransactionParameterBlock -// TmCreateEnlistment -// TmPrePrepareComplete -// TmPrepareComplete -// TmCommitComplete -// TmRollbackComplete -// TmRollbackEnlistment -// - -#endif // FLT_MGR_LONGHORN - - - -/////////////////////////////////////////////////////////////////////////////// -// -// Extra Create Parameter (ECP) support routines -// -/////////////////////////////////////////////////////////////////////////////// - -#if FLT_MGR_LONGHORN - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltAllocateExtraCreateParameterList ( - __in PFLT_FILTER Filter, - __in FSRTL_ALLOCATE_ECPLIST_FLAGS Flags, - __deref_out PECP_LIST *EcpList - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltAllocateExtraCreateParameter ( - __in PFLT_FILTER Filter, - __in LPCGUID EcpType, - __in_bound ULONG SizeOfContext, - __in FSRTL_ALLOCATE_ECP_FLAGS Flags, - __in_opt PFSRTL_EXTRA_CREATE_PARAMETER_CLEANUP_CALLBACK CleanupCallback, - __in ULONG PoolTag, - __deref_out PVOID *EcpContext - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltInitExtraCreateParameterLookasideList ( - __in PFLT_FILTER Filter, - __inout PVOID Lookaside, - __in FSRTL_ECP_LOOKASIDE_FLAGS Flags, - __in SIZE_T Size, - __in ULONG Tag - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltDeleteExtraCreateParameterLookasideList ( - __in PFLT_FILTER Filter, - __inout PVOID Lookaside, - __in FSRTL_ECP_LOOKASIDE_FLAGS Flags - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltAllocateExtraCreateParameterFromLookasideList ( - __in PFLT_FILTER Filter, - __in LPCGUID EcpType, - __in ULONG SizeOfContext, - __in FSRTL_ALLOCATE_ECP_FLAGS Flags, - __in_opt PFSRTL_EXTRA_CREATE_PARAMETER_CLEANUP_CALLBACK CleanupCallback, - __inout PVOID LookasideList, - __deref_out PVOID *EcpContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltInsertExtraCreateParameter ( - __in PFLT_FILTER Filter, - __inout PECP_LIST EcpList, - __inout PVOID EcpContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltFindExtraCreateParameter ( - __in PFLT_FILTER Filter, - __in PECP_LIST EcpList, - __in LPCGUID EcpType, - __deref_opt_out PVOID *EcpContext, - __out_opt ULONG *EcpContextSize - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltRemoveExtraCreateParameter ( - __in PFLT_FILTER Filter, - __inout PECP_LIST EcpList, - __in LPCGUID EcpType, - __deref_out PVOID *EcpContext, - __out_opt ULONG *EcpContextSize - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltFreeExtraCreateParameterList ( - __in PFLT_FILTER Filter, - __in PECP_LIST EcpList - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltFreeExtraCreateParameter ( - __in PFLT_FILTER Filter, - __in PVOID EcpContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetEcpListFromCallbackData ( - __in PFLT_FILTER Filter, - __in PFLT_CALLBACK_DATA CallbackData, - __deref_out_opt PECP_LIST *EcpList - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltSetEcpListIntoCallbackData ( - __in PFLT_FILTER Filter, - __in PFLT_CALLBACK_DATA CallbackData, - __in PECP_LIST EcpList - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FLTAPI -FltGetNextExtraCreateParameter ( - __in PFLT_FILTER Filter, - __in PECP_LIST EcpList, - __in_opt PVOID CurrentEcpContext, - __out_opt LPGUID NextEcpType, - __deref_opt_out PVOID *NextEcpContext, - __out_opt ULONG *NextEcpContextSize - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -FLTAPI -FltAcknowledgeEcp ( - __in PFLT_FILTER Filter, - __in PVOID EcpContext - ); - -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltIsEcpAcknowledged ( - __in PFLT_FILTER Filter, - __in PVOID EcpContext - ); - -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FLTAPI -FltIsEcpFromUserMode ( - __in PFLT_FILTER Filter, - __in PVOID EcpContext - ); - -// -// Some Kernel routines related to ECP manipulation -// -// FsRtlAllocateExtraCreateParameterList -// FsRtlFreeExtraCreateParameterList -// FsRtlAllocateExtraCreateParameter -// FsRtlFreeExtraCreateParameter -// FsRtlInitExtraCreateParameterLookasideList -// FsRtlDeleteExtraCreateParameterLookasideList -// FsRtlAllocateExtraCreateParameterFromLookasideList -// FsRtlInsertExtraCreateParameter -// FsRtlRemoveExtraCreateParameter -// FsRtlGetEcpListFromIrp -// FsRtlSetEcpListIntoIrp -// FsRtlGetNextExtraCreateParameter -// FsRtlAcknowledgeEcp -// FsRtlIsEcpAcknowledged -// FsRtlIsEcpFromUserMode -// - -#endif // FLT_MGR_LONGHORN - - -/////////////////////////////////////////////////////////////////////////////// -// -// IoPriorityHint support routines -// -/////////////////////////////////////////////////////////////////////////////// - -#if FLT_MGR_LONGHORN - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltRetrieveIoPriorityInfo ( - __in_opt PFLT_CALLBACK_DATA Data, - __in_opt PFILE_OBJECT FileObject, - __in_opt PETHREAD Thread, - __inout PIO_PRIORITY_INFO PriorityInfo - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltApplyPriorityInfoThread( - __in PIO_PRIORITY_INFO InputPriorityInfo, - __out_opt PIO_PRIORITY_INFO OutputPriorityInfo, - __in PETHREAD Thread - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -IO_PRIORITY_HINT -FLTAPI -FltGetIoPriorityHint ( - __in PFLT_CALLBACK_DATA Data - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -IO_PRIORITY_HINT -FLTAPI -FltGetIoPriorityHintFromCallbackData ( - __in PFLT_CALLBACK_DATA Data - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltSetIoPriorityHintIntoCallbackData ( - __in PFLT_CALLBACK_DATA Data, - __in IO_PRIORITY_HINT PriorityHint - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -IO_PRIORITY_HINT -FLTAPI -FltGetIoPriorityHintFromFileObject ( - __in PFILE_OBJECT FileObject - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltSetIoPriorityHintIntoFileObject ( - __in PFILE_OBJECT FileObject, - __in IO_PRIORITY_HINT PriorityHint - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -IO_PRIORITY_HINT -FLTAPI -FltGetIoPriorityHintFromThread ( - __in PETHREAD Thread - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -FLTAPI -FltSetIoPriorityHintIntoThread ( - __in PETHREAD Thread, - __in IO_PRIORITY_HINT PriorityHint - ); - -// -// Some Kernel routines related to IoPriorityHint manipulation -// -// IoInitializePriorityInfo -// IoSetIoPriorityHint -// IoGetIoPriorityHint -// ZwSetInformationFile (FileIoPriorityHintInformation class) -// ZwQueryInformationFile (FileIoPriorityHintInformation class) -// - -#endif // FLT_MGR_LONGHORN - - -/////////////////////////////////////////////////////////////////////////////// -// -// Debug support routines -// -/////////////////////////////////////////////////////////////////////////////// - -PCHAR -FLTAPI -FltGetIrpName ( - __in UCHAR IrpMajorCode - ); - - -/////////////////////////////////////////////////////////////////////////////// -// -// End of MAIN conditional compilation variables -// -/////////////////////////////////////////////////////////////////////////////// - -#else -# pragma message("You are building for a target that does not have FilterManager Support!") -#endif // FLT_MGR_BASELINE - -#ifdef __cplusplus -} // Balance extern "C" above -#endif - -#endif //__FLTKERNEL__ - diff --git a/pub/ddk/fltUser.h b/pub/ddk/fltUser.h deleted file mode 100644 index dd30c38..0000000 --- a/pub/ddk/fltUser.h +++ /dev/null @@ -1,420 +0,0 @@ -/*++ - -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 - -#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__ */ - diff --git a/pub/ddk/fltUserStructures.h b/pub/ddk/fltUserStructures.h deleted file mode 100644 index c7874f0..0000000 --- a/pub/ddk/fltUserStructures.h +++ /dev/null @@ -1,601 +0,0 @@ -/*++ - -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__ */ - diff --git a/pub/ddk/fltWinError.h b/pub/ddk/fltWinError.h deleted file mode 100644 index acda2e8..0000000 --- a/pub/ddk/fltWinError.h +++ /dev/null @@ -1,383 +0,0 @@ -/*++ 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_ - diff --git a/pub/ddk/fltsafe.h b/pub/ddk/fltsafe.h deleted file mode 100644 index d12be90..0000000 --- a/pub/ddk/fltsafe.h +++ /dev/null @@ -1,30 +0,0 @@ -#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 - diff --git a/pub/ddk/fullenumsyncdeviceservice.h b/pub/ddk/fullenumsyncdeviceservice.h deleted file mode 100644 index ff14721..0000000 --- a/pub/ddk/fullenumsyncdeviceservice.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * 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 -#include - -/*****************************************************************************/ -/* 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_ */ - - diff --git a/pub/ddk/hbaapi.h b/pub/ddk/hbaapi.h deleted file mode 100644 index f9b5a4b..0000000 --- a/pub/ddk/hbaapi.h +++ /dev/null @@ -1,1561 +0,0 @@ -//*************************************************************************** -// -// hbaapi.h -// -// Module: Windows HBA API implmentation -// -// This header is consistent with www.t11.org SM-HBA Draft July 2006 -// -// Purpose: Contains HBA api header -// -// Copyright (c) 2001 Microsoft Corporation -// -//*************************************************************************** - -#ifndef HBAAPI_H -#define HBAAPI_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define SM_HBA_API // include SM-HBA specific functions - -#include - -#ifdef _HBAAPIP_ -#define HBA_API __cdecl -#else -#define HBA_API DECLSPEC_IMPORT __cdecl -#endif - -#define HBA_VERSION 2 - -typedef ULONGLONG HBA_UINT64; -typedef LONGLONG HBA_INT64; -typedef ULONG HBA_UINT32; -typedef USHORT HBA_UINT16; -typedef UCHAR HBA_UINT8; -typedef signed char HBA_INT8; - -typedef HBA_UINT32 HBA_HANDLE; - -typedef HBA_UINT32 HBA_STATUS; - -#define HBA_STATUS_OK 0 - -#define HBA_STATUS_ERROR 1 /* Error */ -#define HBA_STATUS_ERROR_NOT_SUPPORTED 2 /* Function not supported.*/ -#define HBA_STATUS_ERROR_INVALID_HANDLE 3 /* invalid handle */ -#define HBA_STATUS_ERROR_ARG 4 /* Bad argument */ -#define HBA_STATUS_ERROR_ILLEGAL_WWN 5 /* WWN not recognized */ -#define HBA_STATUS_ERROR_ILLEGAL_INDEX 6 /* Index not recognized */ -#define HBA_STATUS_ERROR_MORE_DATA 7 /* Larger buffer required */ - -/* Information has changed since the last call to HBA_RefreshInformation */ -#define HBA_STATUS_ERROR_STALE_DATA 8 - -/* SCSI Check Condition reported*/ -#define HBA_STATUS_SCSI_CHECK_CONDITION 9 - -/* Adapter busy or reserved, retry may be effective*/ -#define HBA_STATUS_ERROR_BUSY 10 - -/* Request timed out, retry may be effective */ -#define HBA_STATUS_ERROR_TRY_AGAIN 11 - -/* Referenced HBA has been removed or deactivated */ -#define HBA_STATUS_ERROR_UNAVAILABLE 12 - -/* The requested ELS was rejected by the local adapter */ -#define HBA_STATUS_ERROR_ELS_REJECT 13 - -/* The specified LUN is not provided by the specified adapter */ -#define HBA_STATUS_ERROR_INVALID_LUN 14 - -/* An incompatibility has been detected among the library and driver modules */ -/* invoked which will cause one or more functions in the highest version */ -/* that all support to operate incorrectly. */ -/* The differing function sets of software modules implementing different */ -/* versions of the HBA API specification does not in itself constitute an */ -/* incompatibility. */ -/* Known interoperability bugs among supposedly compatible versions */ -/* should be reported as incompatibilities, */ -/* but not all such interoperability bugs may be known. */ -/* This value may be returned by any function which calls a */ -/* Vendor Specific Library, and by HBA_LoadLibrary and HBA_GetAdapterName. */ - -#define HBA_STATUS_ERROR_INCOMPATIBLE 15 - - -/* Multiple adapters have a matching WWN. */ -/* This could occur if the NodeWWN of multiple adapters is identical. */ -#define HBA_STATUS_ERROR_AMBIGUOUS_WWN 16 - -/* A persistent binding request included a bad local SCSI bus number */ -#define HBA_STATUS_ERROR_LOCAL_BUS 17 - -/* A persistent binding request included a bad local SCSI target number */ -#define HBA_STATUS_ERROR_LOCAL_TARGET 18 - -/* A persistent binding request included a bad local SCSI logical unit number */ -#define HBA_STATUS_ERROR_LOCAL_LUN 19 - -/* A persistent binding set request included */ -/* a local SCSI ID that was already bound */ -#define HBA_STATUS_ERROR_LOCAL_SCSIID_BOUND 20 - -/* A persistent binding request included a bad or unlocatable FCP Target FCID */ -#define HBA_STATUS_ERROR_TARGET_FCID 21 - -/* A persistent binding request included a bad FCP Target Node WWN */ -#define HBA_STATUS_ERROR_TARGET_NODE_WWN 22 - -/* A persistent binding request included a bad FCP Target Port WWN */ -#define HBA_STATUS_ERROR_TARGET_PORT_WWN 23 - -/* A persistent binding request included */ -/* an FCP Logical Unit Number not defined by the identified Target*/ -#define HBA_STATUS_ERROR_TARGET_LUN 24 - -/* A persistent binding request included */ -/* an undefined or otherwise inaccessible Logical Unit Unique Identifier */ -#define HBA_STATUS_ERROR_TARGET_LUID 25 - -/* A persistent binding remove request included */ -/* a binding which did not match a binding established by the specified port */ -#define HBA_STATUS_ERROR_NO_SUCH_BINDING 26 - -/* A SCSI command was requested to an Nx_Port that was not a SCSI Target Port */ -#define HBA_STATUS_ERROR_NOT_A_TARGET 27 - -/* A request was made concerning an unsupported FC-4 protocol */ -#define HBA_STATUS_ERROR_UNSUPPORTED_FC4 28 - -/* A request was made to enable unimplemented capabilities for a port */ -#define HBA_STATUS_ERROR_INCAPABLE 29 - -/* A SCSI function was rejected to prevent causing */ -/* a SCSI overlapped command condition (see SAM-3) */ -#define HBA_STATUS_ERROR_TARGET_BUSY 30 - -/* A call was made to HBA_FreeLibrary when no library was loaded */ -#define HBA_STATUS_ERROR_NOT_LOADED 31 - -/* A call was made to HBA_LoadLibrary when a library was already loaded */ -#define HBA_STATUS_ERROR_ALREADY_LOADED 32 - -/* The Address Identifier specified in a call to HBA_SendRNIDV2 */ -/* violates access control rules for that call */ -#define HBA_STATUS_ERROR_ILLEGAL_FCID 33 - -#define HBA_STATUS_ERROR_NOT_ASCSIDEVICE 34 - -#define HBA_STATUS_ERROR_INVALID_PROTOCOL_TYPE 35 - -#define HBA_STATUS_ERROR_BAD_EVENT_TYPE 36 - - -typedef HBA_UINT8 HBA_BOOLEAN; /* Use this for a single true/false flag */ - -typedef HBA_UINT32 HBA_PORTTYPE; - -#define HBA_PORTTYPE_UNKNOWN 1 /* Unknown */ -#define HBA_PORTTYPE_OTHER 2 /* Other */ -#define HBA_PORTTYPE_NOTPRESENT 3 /* Not present */ -#define HBA_PORTTYPE_NPORT 5 /* Fabric */ -#define HBA_PORTTYPE_NLPORT 6 /* Public Loop */ -#define HBA_PORTTYPE_FLPORT 7 /* Fabric on a Loop */ -#define HBA_PORTTYPE_FPORT 8 /* Fabric Port */ -#define HBA_PORTTYPE_EPORT 9 /* Fabric expansion port */ // obsolete? -#define HBA_PORTTYPE_GPORT 10 /* Generic Fabric Port */ // obsolete? -#define HBA_PORTTYPE_LPORT 20 /* Private Loop */ -#define HBA_PORTTYPE_PTP 21 /* Point to Point */ -#define HBA_PORTTYPE_SASDEVICE 30 /* SAS (SSP or STP) */ -#define HBA_PORTTYPE_SATADEVICE 31 /* SATA Device, i.e. Direct Attach SATA */ -#define HBA_PORTTYPE_SASEXPANDER 32 /* SAS Expander */ - -typedef HBA_UINT32 HBA_PORTSTATE; -#define HBA_PORTSTATE_UNKNOWN 1 /* Unknown */ -#define HBA_PORTSTATE_ONLINE 2 /* Operational */ -#define HBA_PORTSTATE_OFFLINE 3 /* User Offline */ -#define HBA_PORTSTATE_BYPASSED 4 /* Bypassed */ -#define HBA_PORTSTATE_DIAGNOSTICS 5 /* In diagnostics mode */ -#define HBA_PORTSTATE_LINKDOWN 6 /* Link Down */ -#define HBA_PORTSTATE_ERROR 7 /* Port Error */ -#define HBA_PORTSTATE_LOOPBACK 8 /* Loopback */ -#define HBA_PORTSTATE_DEGRADED 9 /* Degraded, but Operational mode */ - -typedef HBA_UINT32 HBA_PORTSPEED; -typedef HBA_UINT32 HBA_FCPHYSPEED, HBA_SASPHYSPEED, HBA_PHYSPEED; - -#define HBA_PORTSPEED_UNKNOWN 0 /* Unknown - transceiver incapable */ - /* of reporting */ -#define HBA_PORTSPEED_1GBIT 1 /* 1 GBit/sec */ -#define HBA_PORTSPEED_2GBIT 2 /* 2 GBit/sec */ -#define HBA_PORTSPEED_10GBIT 4 /* 10 GBit/sec */ -#define HBA_PORTSPEED_4GBIT 8 /* 4 GBit/sec */ - - -#define HBA_FCSPEED_UNKNOWN 0 /* Unknown - transceiver incapable */ - /* of reporting */ -#define HBA_FCPHYSPEED_8GBIT 16 /* 8 GBit/sec */ -#define HBA_FCPHYSPEED_16GBIT 32 /* 16 GBit/sec */ - -#define HBA_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */ - - -typedef HBA_UINT8 HBA_FCPHYTYPE; - -#define HBA_FCPHYTYPE_UNKNOWN 1 /* Unknown Phy type */ -#define HBA_FCPHYTYPE_OPTICAL 2 /* Optical Phy */ -#define HBA_FCPHYTYPE_COPPER 4 /* Copper Phy */ - - -#define HBA_SASSTATE_UNKNOWN 0x00 /* Phy is enabled. Speed is unknown */ -#define HBA_SASSTATE_DISABLED 0x01 /* Phy is disabled. */ - -#define HBA_SASSTATE_FAILED 0x02 /* Phy is enabled. But failed speed */ - /* negotiation. */ - -#define HBA_SASSTATE_SATASPINUP 0x03 /* Phy is enabled. Detected a SATA */ - /* device and entered the SATA Spinup */ - /* hold state */ - -#define HBA_SASSTATE_SATAPORTSEL 0x04 /* The phy is attached to a */ - /* Port Selector (see SATA-2.5). */ - -#define HBA_SASSPEED_1_5GBIT 0x08 /* 1.5 GBit/sec */ -#define HBA_SASSPEED_3GBIT 0x09 /* 3 GBit/sec */ - - -typedef struct HBA_wwn { - HBA_UINT8 wwn[8]; -} HBA_WWN, *PHBA_WWN; - - -typedef struct SMHBA_FC_Phy { - HBA_FCPHYSPEED PhySupportSpeed; /* PhySupportedSpeed */ - HBA_FCPHYSPEED PhySpeed; /* PhySpeed */ - HBA_FCPHYTYPE PhyType; - HBA_UINT32 MaxFrameSize; /* MaxFrameSize */ -} SMHBA_FC_PHY, *PSMHBA_FC_PHY; - -typedef struct SMHBA_SAS_Phy { - HBA_UINT8 PhyIdentifier; - HBA_SASPHYSPEED NegotiatedLinkRate; - HBA_SASPHYSPEED ProgrammedMinLinkRate; - HBA_SASPHYSPEED HardwareMinLinkRate; - HBA_SASPHYSPEED ProgrammedMaxLinkRate; - HBA_SASPHYSPEED HardwareMaxLinkRate; - HBA_WWN domainPortWWN; -} SMHBA_SAS_PHY, *PSMHBA_SAS_PHY; - - - -typedef HBA_UINT32 HBA_COS; - -typedef struct HBA_fc4types { - HBA_UINT8 bits[32]; /* See FC-4 TYPEs - Format in FC-GS-4 */ -} HBA_FC4TYPES, *PHBA_FC4TYPES; - -typedef struct HBA_ipaddress { - int ipversion; // see enumerations in RNID - union - { - unsigned char ipv4address[4]; - unsigned char ipv6address[16]; - } ipaddress; -} HBA_IPADDRESS, *PHBA_IPADDRESS; - -typedef struct HBA_AdapterAttributes { - char Manufacturer[64]; - char SerialNumber[64]; - char Model[256]; - char ModelDescription[256]; - HBA_WWN NodeWWN; - char NodeSymbolicName[256]; /* From GS-2 */ - char HardwareVersion[256]; /* Vendor use */ - char DriverVersion[256]; /* Vendor use */ - char OptionROMVersion[256]; /* Vendor use - i.e. hardware boot ROM*/ - char FirmwareVersion[256]; /* Vendor use */ - HBA_UINT32 VendorSpecificID; /* Vendor specific */ - HBA_UINT32 NumberOfPorts; - char DriverName[256]; /* Binary path and/or name of driver file. */ -} HBA_ADAPTERATTRIBUTES, *PHBA_ADAPTERATTRIBUTES; - - -typedef struct SMHBA_AdapterAttributes { - char Manufacturer[64]; - char SerialNumber[64]; - char Model[256]; - char ModelDescription[256]; - char HardwareVersion[256]; - char DriverVersion[256]; - char OptionROMVersion[256]; - char FirmwareVersion[256]; - HBA_UINT32 VendorSpecificID; - char DriverName[256]; - char HBASymbolicName[256]; - char RedundantOptionROMVersion[256]; - char RedundantFirmwareVersion[256]; -} SMHBA_ADAPTERATTRIBUTES, *PSMHBA_ADAPTERATTRIBUTES; - - -typedef struct HBA_PortAttributes { - HBA_WWN NodeWWN; - HBA_WWN PortWWN; - HBA_UINT32 PortFcId; - HBA_PORTTYPE PortType; /*PTP, Fabric, etc. */ - HBA_PORTSTATE PortState; - HBA_COS PortSupportedClassofService; - HBA_FC4TYPES PortSupportedFc4Types; - HBA_FC4TYPES PortActiveFc4Types; - char PortSymbolicName[256]; - char OSDeviceName[256]; - HBA_PORTSPEED PortSupportedSpeed; - HBA_PORTSPEED PortSpeed; - HBA_UINT32 PortMaxFrameSize; - HBA_WWN FabricName; - HBA_UINT32 NumberofDiscoveredPorts; -} HBA_PORTATTRIBUTES, *PHBA_PORTATTRIBUTES; - - -typedef HBA_UINT32 HBA_SASPORTPROTOCOL; - -#define HBA_SASPORTPROTOCOL_SSP 1 /* Serial Attached SCSI Port */ -#define HBA_SASPORTPROTOCOL_STP 2 /* Serial ATA Tunneling Protocol Port */ -#define HBA_SASPORTPROTOCOL_SMP 4 /* Serial Management Protocol Port */ -#define HBA_SASPORTPROTOCOL_SATA 8 /* SATA Device, Direct Attached or */ - /* anywhere in the domain */ - - -typedef struct SMHBA_FC_Port { - HBA_WWN NodeWWN; - HBA_WWN PortWWN; - HBA_UINT32 FcId; - HBA_COS PortSupportedClassofService; - HBA_FC4TYPES PortSupportedFc4Types; - HBA_FC4TYPES PortActiveFc4Types; - HBA_WWN FabricName; - char PortSymbolicName[256]; - HBA_UINT32 NumberofDiscoveredPorts; - HBA_UINT8 NumberofPhys; -} SMHBA_FC_PORT, *PSMHBA_FC_PORT; - -typedef struct SMHBA_SAS_Port { - HBA_SASPORTPROTOCOL PortProtocol; - HBA_WWN LocalSASAddress; - HBA_WWN AttachedSASAddress; - HBA_UINT32 NumberofDiscoveredPorts; - HBA_UINT32 NumberofPhys; -} SMHBA_SAS_PORT, *PSMHBA_SAS_PORT; - -typedef union SMHBA_Port { - SMHBA_FC_PORT *FCPort; - SMHBA_SAS_PORT *SASPort; -} SMHBA_PORT, *PSMHBA_PORT; - -typedef struct SMHBA_PortAttributes { - HBA_PORTTYPE PortType; - HBA_PORTSTATE PortState; - char OSDeviceName[256]; - SMHBA_PORT PortSpecificAttribute; -} SMHBA_PORTATTRIBUTES, *PSMHBA_PORTATTRIBUTES; - - -/* Statistical counters for FC-0, FC-1 and FC-2 */ - -typedef struct HBA_PortStatistics { - HBA_INT64 SecondsSinceLastReset; - HBA_INT64 TxFrames; - HBA_INT64 TxWords; - HBA_INT64 RxFrames; - HBA_INT64 RxWords; - HBA_INT64 LIPCount; - HBA_INT64 NOSCount; - HBA_INT64 ErrorFrames; - HBA_INT64 DumpedFrames; - HBA_INT64 LinkFailureCount; - HBA_INT64 LossOfSyncCount; - HBA_INT64 LossOfSignalCount; - HBA_INT64 PrimitiveSeqProtocolErrCount; - HBA_INT64 InvalidTxWordCount; - HBA_INT64 InvalidCRCCount; -} HBA_PORTSTATISTICS, *PHBA_PORTSTATISTICS; - - -/* Statistical counters for FC-4 protocols */ - -typedef struct HBA_FC4Statistics { - HBA_INT64 InputRequests; - HBA_INT64 OutputRequests; - HBA_INT64 ControlRequests; - HBA_INT64 InputMegabytes; - HBA_INT64 OutputMegabytes; -} HBA_FC4STATISTICS, *PHBA_FC4STATISTICS; - - -/* Statistical counters for FC-4, SSP, STP, SMP protocols */ - -typedef struct SMHBA_ProtocolStatistics { - HBA_INT64 SecondsSinceLastReset; - HBA_INT64 InputRequests; - HBA_INT64 OutputRequests; - HBA_INT64 ControlRequests; - HBA_INT64 InputMegabytes; - HBA_INT64 OutputMegabytes; -} SMHBA_PROTOCOLSTATISTICS, *PSMHBA_PROTOCOLSTATISTICS; - - -typedef struct SMHBA_SASPhyStatistics { - HBA_INT64 SecondsSinceLastReset; - HBA_INT64 TxFrames; - HBA_INT64 TxWords; - HBA_INT64 RxFrames; - HBA_INT64 RxWords; - HBA_INT64 InvalidDwordCount; - HBA_INT64 RunningDisparityErrorCount; - HBA_INT64 LossofDwordSyncCount; - HBA_INT64 PhyResetProblemCount; -} SMHBA_SASPHYSTATISTICS, *PSMHBA_SASPHYSTATISTICS; - - -/* Statistical counters for FC-0, FC-1, and FC-2 */ - -typedef HBA_PORTSTATISTICS SMHBA_FCPHYSTATISTICS, *PSMHBA_FCPHYSTATISTICS; - -typedef union SMHBA_PhyStatistics { - SMHBA_SASPHYSTATISTICS *SASPhyStatistics; - SMHBA_FCPHYSTATISTICS *FCPhyStatistics; -} SMHBA_PHYSTATISTICS, *PSMHBA_PHYSTATISTICS; - - - -/* HBA_FCPBINDINGTYPE was used in Rev 1.0. Add TO_OTHER for older calls to - indicate other binding types for HBA_GetPersistentBinding. To support - multiple types a new flag has been created to allow for multiple bindings - supported */ - -typedef enum HBA_fcpbindingtype { TO_D_ID, TO_WWN, TO_OTHER } HBA_FCPBINDINGTYPE; - - -/* A bit mask of Rev 2.0 persistent binding capabilities */ - -typedef HBA_UINT32 HBA_BIND_CAPABILITY; - -/* The following are bit flags indicating persistent binding capabilities */ - -#define HBA_CAN_BIND_TO_D_ID 0x0001 -#define HBA_CAN_BIND_TO_WWPN 0x0002 -#define HBA_CAN_BIND_TO_WWNN 0x0004 -#define HBA_CAN_BIND_TO_LUID 0x0008 -#define HBA_CAN_BIND_ANY_LUNS 0x0400 -#define HBA_CAN_BIND_TARGETS 0x0800 -#define HBA_CAN_BIND_AUTOMAP 0x1000 -#define HBA_CAN_BIND_CONFIGURED 0x2000 - -/* A bit mask of Rev 2.0 persistent binding setting types */ - -typedef HBA_UINT32 HBA_BIND_TYPE; - -/* The following are bit flags indicating persistent binding setting types */ - -#define HBA_BIND_TO_D_ID 0x0001 -#define HBA_BIND_TO_WWPN 0x0002 -#define HBA_BIND_TO_WWNN 0x0004 -#define HBA_BIND_TO_LUID 0x0008 -#define HBA_BIND_TARGETS 0x0800 - -typedef struct HBA_LUID { - char buffer[256]; -} HBA_LUID, *PHBA_LUID; - -typedef struct HBA_ScsiId { - char OSDeviceName[256]; /* \device\ScsiPort3 */ - HBA_UINT32 ScsiBusNumber; /* Bus on the HBA */ - HBA_UINT32 ScsiTargetNumber; /* SCSI Target ID to OS */ - HBA_UINT32 ScsiOSLun; -} HBA_SCSIID, *PHBA_SCSIID; - -typedef struct HBA_FcpId { - HBA_UINT32 FcId; - HBA_WWN NodeWWN; - HBA_WWN PortWWN; - HBA_UINT64 FcpLun; -} HBA_FCPID, *PHBA_FCPID; - -typedef struct HBA_FcpScsiEntry { - HBA_SCSIID ScsiId; - HBA_FCPID FcpId; -} HBA_FCPSCSIENTRY, *PHBA_FCPSCSIENTRY; - -typedef struct HBA_FcpScsiEntryV2 { - HBA_SCSIID ScsiId; - HBA_FCPID FcpId; - HBA_LUID LUID; -} HBA_FCPSCSIENTRYV2, *PHBA_FCPSCSIENTRYV2; - -typedef struct HBA_FCPTargetMapping { - HBA_UINT32 NumberOfEntries; - HBA_FCPSCSIENTRY entry[1]; /* Variable length array containing mappings*/ -} HBA_FCPTARGETMAPPING, *PHBA_FCPTARGETMAPPING; - -typedef struct HBA_FCPTargetMappingV2 { - HBA_UINT32 NumberOfEntries; - HBA_FCPSCSIENTRYV2 entry[1]; /* Variable length array containing mappings*/ -} HBA_FCPTARGETMAPPINGV2, *PHBA_FCPTARGETMAPPINGV2; - - -typedef struct HBA_FCPBindingEntry { - HBA_FCPBINDINGTYPE type; - HBA_SCSIID ScsiId; - HBA_FCPID FcpId; - HBA_UINT32 FcId; -} HBA_FCPBINDINGENTRY, *PHBA_FCPBINDINGENTRY; - -typedef struct HBA_FCPBinding { - HBA_UINT32 NumberOfEntries; - HBA_FCPBINDINGENTRY entry[1]; /* Variable length array */ -} HBA_FCPBINDING, *PHBA_FCPBINDING; - -typedef struct HBA_FCPBindingEntry2 { - HBA_BIND_TYPE type; - HBA_SCSIID ScsiId; - HBA_FCPID FcpId; - HBA_LUID LUID; - HBA_STATUS Status; -} HBA_FCPBINDINGENTRY2, *PHBA_FCPBINDINGENTRY2; - -typedef struct HBA_FCPBinding2 { - HBA_UINT32 NumberOfEntries; - HBA_FCPBINDINGENTRY2 entry[1]; /* Variable length array */ -} HBA_FCPBINDING2, *PHBA_FCPBINDING2; - - -typedef HBA_UINT32 SMHBA_BIND_CAPABILITY; - -#define SMHBA_CAN_BIND_TO_WWPN 0x0001 -#define SMHBA_CAN_BIND_TO_LUID 0x0002 -#define SMHBA_CAN_BIND_ANY_LUNS 0x0400 -#define SMHBA_CAN_BIND_AUTOMAP 0x0800 - -typedef HBA_UINT32 SMHBA_BIND_TYPE; - -#define SMHBA_BIND_TO_WWPN 0x0001 -#define SMHBA_BIND_TO_LUID 0x0002 - -typedef struct SMHBA_ScsiId { - char OSDeviceName[256]; - HBA_UINT32 ScsiBusNumber; - HBA_UINT32 ScsiTargetNumber; - HBA_UINT32 ScsiOSLun; -} SMHBA_SCSIID, *PSMHBA_SCSIID; - -typedef struct SMHBA_LUID { - char buffer[256]; -} SMHBA_LUID, *PSMHBA_LUID; - -typedef HBA_UINT64 HBA_SCSILUN; - -typedef struct SMHBA_SCSILUN { - HBA_UINT8 lun[8]; -} SMHBA_SCSILUN; - -typedef struct SMHBA_PORTLUN { - HBA_WWN PortWWN; - HBA_WWN domainPortWWN; - HBA_SCSILUN TargetLun; -} SMHBA_PORTLUN, *PSMHBA_PORTLUN; - -typedef struct SMHBA_ScsiEntry { - SMHBA_SCSIID ScsiId; - SMHBA_PORTLUN PortLun; - SMHBA_LUID LUID; -} SMHBA_SCSIENTRY, *PSMHBA_SCSIENTRY; - -typedef struct SMHBA_TargetMapping { - HBA_UINT32 NumberOfEntries; - SMHBA_SCSIENTRY entry[1]; /* Variable length array containing mappings*/ -} SMHBA_TARGETMAPPING, *PSMHBA_TARGETMAPPING; - -typedef struct SMHBA_BindingEntry { - SMHBA_BIND_TYPE type; - SMHBA_SCSIID ScsiId; - SMHBA_PORTLUN PortLun; - SMHBA_LUID LUID; - HBA_STATUS Status; -} SMHBA_BINDINGENTRY, *PSMHBA_BINDINGENTRY; - -typedef struct SMHBA_Binding { - HBA_UINT32 NumberOfEntries; - SMHBA_BINDINGENTRY entry[1]; /* Variable length array */ -} SMHBA_BINDING, *PSMHBA_BINDING; - - -typedef enum HBA_wwntype { NODE_WWN, PORT_WWN } HBA_WWNTYPE; - -typedef struct HBA_MgmtInfo { - HBA_WWN wwn; - HBA_UINT32 unittype; - HBA_UINT32 PortId; - HBA_UINT32 NumberOfAttachedNodes; - HBA_UINT16 IPVersion; - HBA_UINT16 UDPPort; - HBA_UINT8 IPAddress[16]; - HBA_UINT16 reserved; - HBA_UINT16 TopologyDiscoveryFlags; -} HBA_MGMTINFO, *PHBA_MGMTINFO; - -#define HBA_EVENT_LIP_OCCURRED 1 -#define HBA_EVENT_LINK_UP 2 -#define HBA_EVENT_LINK_DOWN 3 -#define HBA_EVENT_LIP_RESET_OCCURRED 4 -#define HBA_EVENT_RSCN 5 -#define HBA_EVENT_PROPRIETARY 0xFFFF - -typedef struct HBA_Link_EventInfo { - HBA_UINT32 PortFcId; /* Port which this event occurred */ - HBA_UINT32 Reserved[3]; -} HBA_LINK_EVENTINFO, *PHBA_LINK_EVENTINFO; - -typedef struct HBA_RSCN_EventInfo { - HBA_UINT32 PortFcId; /* Port which this event occurred */ - HBA_UINT32 NPortPage; /* Reference FC-FS for RSCN ELS "Affected N-Port Pages"*/ - HBA_UINT32 Reserved[2]; -} HBA_RSCN_EVENTINFO, *PHBA_RSCN_EVENTINFO; - -typedef struct HBA_Pty_EventInfo { - HBA_UINT32 PtyData[4]; /* Proprietary data */ -} HBA_PTY_EVENTINFO, *PHBA_PTY_EVENTINFO; - -typedef struct HBA_EventInfo { - HBA_UINT32 EventCode; - union { - HBA_LINK_EVENTINFO Link_EventInfo; - HBA_RSCN_EVENTINFO RSCN_EventInfo; - HBA_PTY_EVENTINFO Pty_EventInfo; - } Event; -} HBA_EVENTINFO, *PHBA_EVENTINFO; - -typedef PVOID PHBA_ENTRYPOINTS; -typedef PVOID PHBA_ENTRYPOINTSV2; -typedef PVOID PSMHBA_ENTRYPOINTS; - -HBA_STATUS HBA_API HBA_RegisterLibrary(PHBA_ENTRYPOINTS entrypoints); -HBA_STATUS HBA_API HBA_RegisterLibraryV2(PHBA_ENTRYPOINTSV2 entrypoints); - - -HBA_UINT32 HBA_API HBA_GetVersion(); -HBA_STATUS HBA_API HBA_LoadLibrary(); -HBA_STATUS HBA_API HBA_FreeLibrary(); - - -HBA_UINT32 HBA_API HBA_GetNumberOfAdapters(); - -HBA_STATUS HBA_API -HBA_GetAdapterName( - __in HBA_UINT32 AdapterIndex, - __inout_ecount(MAX_NAME) PCHAR AdapterName - ); - -HBA_HANDLE HBA_API -HBA_OpenAdapter( - __in PSTR AdapterName - ); - -void HBA_API -HBA_CloseAdapter( - IN HBA_HANDLE handle - ); - -HBA_STATUS HBA_API -HBA_GetAdapterAttributes( - IN HBA_HANDLE Handle, - OUT HBA_ADAPTERATTRIBUTES *HbaAttributes - ); - -HBA_STATUS HBA_API -HBA_GetAdapterPortAttributes( - IN HBA_HANDLE Handle, - IN HBA_UINT32 PortIndex, - OUT HBA_PORTATTRIBUTES *PortAttributes - ); - - -HBA_STATUS HBA_API -HBA_GetPortStatistics( - IN HBA_HANDLE Handle, - IN HBA_UINT32 PortIndex, - OUT HBA_PORTSTATISTICS *PortStatistics - ); - -HBA_STATUS HBA_API -HBA_GetDiscoveredPortAttributes( - IN HBA_HANDLE Handle, - IN HBA_UINT32 PortIndex, - IN HBA_UINT32 DiscoveredPortIndex, - OUT HBA_PORTATTRIBUTES *PortAttributes - ); - -HBA_STATUS HBA_API -HBA_GetPortAttributesByWWN( - IN HBA_HANDLE Handle, - IN HBA_WWN PortWWN, - OUT HBA_PORTATTRIBUTES *PortAttributes - ); - - -HBA_STATUS HBA_API -HBA_SendCTPassThru( - IN HBA_HANDLE Handle, - IN void *pReqBuffer, - IN HBA_UINT32 ReqBufferSize, - OUT void *pRspBuffer, - IN HBA_UINT32 RspBufferSize - ); - -HBA_STATUS HBA_API -HBA_GetEventBuffer( - IN HBA_HANDLE Handle, - OUT PHBA_EVENTINFO EventBuffer, - IN OUT HBA_UINT32 *EventCount - ); - -HBA_STATUS HBA_API -HBA_SetRNIDMgmtInfo( - IN HBA_HANDLE Handle, - IN HBA_MGMTINFO *pInfo - ); - -HBA_STATUS HBA_API -HBA_GetRNIDMgmtInfo( - IN HBA_HANDLE Handle, - OUT HBA_MGMTINFO *pInfo - ); - -HBA_STATUS HBA_API -HBA_SendRNID( - IN HBA_HANDLE Handle, - IN HBA_WWN Wwn, - IN HBA_WWNTYPE WnnType, - OUT void *pRspBuffer, - IN OUT HBA_UINT32 *RspBufferSize - ); - -HBA_STATUS HBA_API -HBA_GetFcpTargetMapping( - IN HBA_HANDLE Handle, - IN OUT PHBA_FCPTARGETMAPPING Mapping - ); - -HBA_STATUS HBA_API -HBA_GetFcpPersistentBinding( - IN HBA_HANDLE Handle, - IN OUT PHBA_FCPBINDING Binding - ); - -HBA_STATUS HBA_API -HBA_SendScsiInquiry( - IN HBA_HANDLE Handle, - IN HBA_WWN PortWWN, - IN HBA_UINT64 FcLUN, - IN HBA_UINT8 EVPD, - IN HBA_UINT32 PageCode, - OUT void *pRspBuffer, - IN HBA_UINT32 RspBufferSize, - OUT void *pSenseBuffer, - IN HBA_UINT32 SenseBufferSize - ); - -HBA_STATUS HBA_API -HBA_SendReportLUNs( - IN HBA_HANDLE Handle, - IN HBA_WWN PortWWN, - OUT void *pRspBuffer, - IN HBA_UINT32 RspBufferSize, - OUT void *pSenseBuffer, - IN HBA_UINT32 SenseBufferSize - ); - -HBA_STATUS HBA_API -HBA_SendReadCapacity( - IN HBA_HANDLE Handle, - IN HBA_WWN PortWWN, - IN HBA_UINT64 FcLUN, - OUT void *pRspBuffer, - IN HBA_UINT32 RspBufferSize, - OUT void *pSenseBuffer, - IN HBA_UINT32 SenseBufferSize - ); - -void HBA_API -HBA_RefreshInformation( - IN HBA_HANDLE Handle - ); - -void HBA_API -HBA_ResetStatistics( - IN HBA_HANDLE Handle, - IN HBA_UINT32 PortIndex - ); - - -typedef void *HBA_CALLBACKHANDLE; - -typedef HBA_CALLBACKHANDLE *PHBA_CALLBACKHANDLE; - -/* Adapter Level Events */ -#define HBA_EVENT_ADAPTER_UNKNOWN 0x100 -#define HBA_EVENT_ADAPTER_ADD 0x101 -#define HBA_EVENT_ADAPTER_REMOVE 0x102 -#define HBA_EVENT_ADAPTER_CHANGE 0x103 - -/* Port Level Events */ -#define HBA_EVENT_PORT_UNKNOWN 0x200 -#define HBA_EVENT_PORT_OFFLINE 0x201 -#define HBA_EVENT_PORT_ONLINE 0x202 -#define HBA_EVENT_PORT_NEW_TARGETS 0x203 -#define HBA_EVENT_PORT_FABRIC 0x204 -#define HBA_EVENT_PORT_BROADCAST_CHANGE 0x205 -#define HBA_EVENT_PORT_BROADCAST_D24_0 0x206 -#define HBA_EVENT_PORT_BROADCAST_D27_4 0x207 -#define HBA_EVENT_PORT_BROADCAST_SES 0x208 -#define HBA_EVENT_PORT_BROADCAST_D01_4 0x209 -#define HBA_EVENT_PORT_BROADCAST_D04_7 0x20a -#define HBA_EVENT_PORT_BROADCAST_D16_7 0x20b -#define HBA_EVENT_PORT_BROADCAST_D29_7 0x20c -#define HBA_EVENT_PORT_ALL 0x2ff - -/* Port Statistics Events */ -#define HBA_EVENT_PORT_STAT_THRESHOLD 0x301 -#define HBA_EVENT_PORT_STAT_GROWTH 0x302 - -/* Phy Statistics Events */ -#define HBA_EVENT_PHY_STAT_THRESHOLD 0x351 -#define HBA_EVENT_PHY_STAT_GROWTH 0x352 - -/* Target Level Events */ -#define HBA_EVENT_TARGET_UNKNOWN 0x400 -#define HBA_EVENT_TARGET_OFFLINE 0x401 -#define HBA_EVENT_TARGET_ONLINE 0x402 -#define HBA_EVENT_TARGET_REMOVED 0x403 - -/* Fabric Link Events */ -#define HBA_EVENT_LINK_UNKNOWN 0x500 -#define HBA_EVENT_LINK_INCIDENT 0x501 - -HBA_STATUS HBA_API -HBA_RemoveCallback( - IN HBA_CALLBACKHANDLE callbackHandle - ); - -HBA_STATUS HBA_API -HBA_RegisterForAdapterAddEvents( - IN void (*callback) (void *pData, HBA_WWN PortWWN, HBA_UINT32 eventType), - IN void *pUserData, - OUT HBA_CALLBACKHANDLE *pCallbackHandle - ); - -HBA_STATUS HBA_API -HBA_RegisterForAdapterEvents( - IN void (*callback) (void *pData, HBA_WWN PortWWN, HBA_UINT32 eventType), - IN void *pUserData, - IN HBA_HANDLE Handle, - OUT HBA_CALLBACKHANDLE *pCallbackHandle - ); - -HBA_STATUS HBA_API -HBA_RegisterForAdapterPortEvents( - IN void (*callback) (void *pData, - HBA_WWN PortWWN, - HBA_UINT32 eventType, - HBA_UINT32 fabricPortID), - IN void *UserData, - IN HBA_HANDLE Handle, - IN HBA_WWN PortWWN, - OUT HBA_CALLBACKHANDLE *pCallbackHandle - ); - -HBA_STATUS HBA_API -HBA_RegisterForAdapterPortStatEvents( - IN void (*callback)(void *pData, - HBA_WWN PortWWN, - HBA_UINT32 eventType), - IN void *pUserData, - IN HBA_HANDLE Handle, - IN HBA_WWN PortWWN, - IN HBA_PORTSTATISTICS stats, - IN HBA_UINT32 statType, - OUT HBA_CALLBACKHANDLE *pCallbackHandle - ); - -HBA_STATUS HBA_API -HBA_RegisterForTargetEvents( - IN void (*callback)(void *pData, - HBA_WWN hbaPortWWN, - HBA_WWN discoveredPortWWN, - HBA_UINT32 eventType), - IN void *pUserData, - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DiscoveredPortWWN, - OUT HBA_CALLBACKHANDLE *pCallbackHandle, - IN HBA_UINT32 AllTargets - ); - -HBA_STATUS HBA_API -HBA_RegisterForLinkEvents( - IN void (*callback)(void *data, HBA_WWN adapterWWN, HBA_UINT32 eventType, - void *pRLIRBuffer, HBA_UINT32 RLIRBufferSize), - IN void *userData, - IN void *pRLIRBuffer, - IN HBA_UINT32 RLIRBufferSize, - IN HBA_HANDLE Handle, - OUT HBA_CALLBACKHANDLE *pCallbackHandle - ); - - -HBA_STATUS HBA_API -HBA_OpenAdapterByWWN( - OUT HBA_HANDLE *HbaHandle, - IN HBA_WWN Wwn - ); - -void HBA_API -HBA_RefreshAdapterConfiguration( - ); - -HBA_STATUS HBA_API -HBA_SendCTPassThruV2( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN void *pReqBuffer, - IN HBA_UINT32 ReqBufferSize, - OUT void *pRspBuffer, - IN OUT HBA_UINT32 *pRspBufferSize - ); - -HBA_STATUS HBA_API -HBA_SendRNIDV2( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DestWWN, - IN HBA_UINT32 DestFCID, - IN HBA_UINT32 NodeIdDataFormat, - OUT void *pRspBuffer, - IN OUT HBA_UINT32 *pRspBufferSize - ); - -HBA_STATUS HBA_API -HBA_SendRPL( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN Agent_wwn, - IN HBA_UINT32 Agent_domain, - IN HBA_UINT32 PortIndex, - OUT void *pRspBuffer, - IN OUT HBA_UINT32 *pRspBufferSize - ); - -HBA_STATUS HBA_API -HBA_SendRPS( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN Agent_wwn, - IN HBA_UINT32 Agent_domain, - IN HBA_WWN Object_wwn, - IN HBA_UINT32 Object_port_number, - OUT void *pRspBuffer, - IN OUT HBA_UINT32 *pRspBufferSize - ); - -HBA_STATUS HBA_API -HBA_SendSRL( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN Wwn, - IN HBA_UINT32 Domain, - OUT void *pRspBuffer, - IN OUT HBA_UINT32 *pRspBufferSize - ); - -HBA_STATUS HBA_API -HBA_SendLIRR( - IN HBA_HANDLE Handle, - IN HBA_WWN SourceWWN, - IN HBA_WWN DestWWN, - IN HBA_UINT8 Function, - IN HBA_UINT8 Type, - OUT void *pRspBuffer, - IN OUT HBA_UINT32 *pRspBufferSize - ); - -HBA_STATUS HBA_API -HBA_SendRLS( - IN HBA_HANDLE HbaHandle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DestWWN, - OUT void *pRspBuffer, - IN OUT HBA_UINT32 *pRspBufferSize - ); - - -HBA_STATUS HBA_API -HBA_GetFC4Statistics( - IN HBA_HANDLE Handle, - IN HBA_WWN PortWWN, - IN HBA_UINT8 FC4type, - OUT HBA_FC4STATISTICS *Statistics - ); - -HBA_STATUS HBA_API -HBA_GetFCPStatistics( - IN HBA_HANDLE Handle, - IN const HBA_SCSIID *Lunit, - OUT HBA_FC4STATISTICS *Statistics - ); - - - -typedef struct HBA_LibraryAttributes { - HBA_BOOLEAN final; - char LibPath[256]; - char VName[256]; - char VVersion[256]; - struct tm build_date; -} HBA_LIBRARYATTRIBUTES, *PHBA_LIBRARYATTRIBUTES; - -typedef struct SMHBA_LibraryAttributes { - char LibPath[256]; - char VName[256]; - char VVersion[256]; - struct { - int tm_mday; /* day of the month - [1,31] */ - int tm_mon; /* months since January - [0,11] */ - int tm_year; /* years since 1900 */ - } build_date; -} SMHBA_LIBRARYATTRIBUTES, *PSMHBA_LIBRARYATTRIBUTES; - - -HBA_UINT32 HBA_API -HBA_GetWrapperLibraryAttributes( - OUT HBA_LIBRARYATTRIBUTES *Attributes - ); - -HBA_UINT32 HBA_API -HBA_GetVendorLibraryAttributes( - IN HBA_UINT32 AdapterIndex, - OUT HBA_LIBRARYATTRIBUTES *Attributes - ); - - -HBA_STATUS HBA_API -HBA_ScsiReadCapacityV2( - IN HBA_HANDLE HbaHandle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DiscoveredPortWWN, - IN HBA_UINT64 FcLUN, - OUT void *pRespBuffer, - IN OUT HBA_UINT32 *pRespBufferSize, - OUT HBA_UINT8 *pScsiStatus, - OUT void *pSenseBuffer, - IN OUT HBA_UINT32 *pSenseBufferSize - ); - -HBA_STATUS HBA_API -HBA_ScsiReportLUNsV2( - IN HBA_HANDLE Hbahandle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DiscoveredPortWWN, - OUT void *pRespBuffer, - IN OUT HBA_UINT32 *pRespBufferSize, - OUT HBA_UINT8 *pScsiStatus, - OUT void *pSenseBuffer, - IN OUT HBA_UINT32 *pSenseBufferSize - ); - -HBA_STATUS HBA_API -HBA_ScsiInquiryV2 ( - IN HBA_HANDLE HbaHandle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DiscoveredPortWWN, - IN HBA_UINT64 FcLUN, - IN HBA_UINT8 CDB_Byte1, - IN HBA_UINT8 CDB_Byte2, - OUT void *pRespBuffer, - IN OUT HBA_UINT32 *pRespBufferSize, - OUT HBA_UINT8 *pScsiStatus, - OUT void *pSenseBuffer, - IN OUT HBA_UINT32 *pSenseBufferSize - ); - - -HBA_STATUS HBA_API -HBA_GetFcpTargetMappingV2( - IN HBA_HANDLE HbaHandle, - IN HBA_WWN HbaPortWWN, - IN OUT HBA_FCPTARGETMAPPINGV2 *Mapping - ); - -HBA_STATUS HBA_API -HBA_GetBindingCapability( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - OUT HBA_BIND_CAPABILITY *Flags - ); - -HBA_STATUS HBA_API -HBA_GetBindingSupport( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - OUT HBA_BIND_CAPABILITY *Flags - ); - -HBA_STATUS HBA_API -HBA_SetBindingSupport( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_BIND_CAPABILITY Flags - ); - - -HBA_STATUS HBA_API -HBA_GetPersistentBindingV2( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN OUT PHBA_FCPBINDING2 Binding - ); - -HBA_STATUS HBA_API -HBA_SetPersistentBindingV2( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN PHBA_FCPBINDING2 Binding - ); - -HBA_STATUS HBA_API -HBA_RemovePersistentBinding( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN PHBA_FCPBINDING2 Binding - ); - -HBA_STATUS HBA_API -HBA_RemoveAllPersistentBindings( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN - ); - - -#if 0 - -// -// stubs for unsupported SB functions -// - -typedef PVOID PHBA_SBTARGETMAPPING; - -typedef struct HBA_SBDevId { - char OSDeviceName[256]; -} HBA_SBDEVID, *PHBA_SBDEVID; - - -typedef struct HBA_Ned { - HBA_UINT32 NEDWord0; - HBA_UINT32 NelId[7]; -} HBA_NED, *PHBA_NED; - -typedef struct HBA_DeviceSelfDesc { - HBA_NED TokenNED; - HBA_NED DeviceNED; -} HBA_DEVICESELFDESC, *PHBA_DEVICESELFDESC; - -typedef PVOID PHBA_SBSTATISTICS; - -typedef struct HBA_SBDskCapacity { - HBA_INT32 SCSIFormatLBA; /* SCSI Read Capacity Format */ - HBA_INT32 SCSIFormatBlkLen; /* SCSI Read Capacity Format */ - HBA_INT32 SBDskNumberOfCylinders; /* cyls */ - HBA_INT32 SBDskTracksPerCylinder; /* tracks per cyl */ - HBA_INT32 SBDskMaxUsableTrackLen; /* usable track capcacity */ -} HBA_SBDSKCAPACITY, *PHBA_SBDSKCAPACITY; - - -HBA_STATUS HBA_API -HBA_GetSBTargetMapping( - IN HBA_HANDLE HbaHandle, - IN HBA_WWN HbaPortWWN, - OUT PHBA_SBTARGETMAPPING Mapping - ); - -HBA_STATUS HBA_API -HBA_GetSBStatistics( - IN HBA_HANDLE HbaHandle, - IN const HBA_SBDEVID *Device, - OUT PHBA_SBSTATISTICS Statistics - ); - -HBA_STATUS HBA_API -HBA_SBDskGetCapacity( - IN HBA_DEVICESELFDESC DeviceSelfDesc, - OUT PHBA_SBDSKCAPACITY PSbDskCapacity - ); - -#endif - -#ifdef SM_HBA_API - -// -// SM-HBA Library Control Functions -// - -#define SMHBA_VERSION 1 - -HBA_UINT32 HBA_API SMHBA_GetVersion(); -HBA_STATUS HBA_API SMHBA_RegisterLibrary(PSMHBA_ENTRYPOINTS entrypoints); - -HBA_UINT32 HBA_API -SMHBA_GetWrapperLibraryAttributes( - OUT SMHBA_LIBRARYATTRIBUTES *Attributes - ); - -HBA_UINT32 HBA_API -SMHBA_GetVendorLibraryAttributes( - IN HBA_UINT32 AdapterIndex, - OUT SMHBA_LIBRARYATTRIBUTES *Attributes - ); - - -// -// SM-HBA Adapter, FC_Port and SAS_Port Information Functions -// - -HBA_STATUS HBA_API -SMHBA_GetProtocolStatistics( - IN HBA_HANDLE Handle, - IN HBA_UINT32 PortIndex, - IN HBA_UINT32 ProtocolType, - OUT SMHBA_PROTOCOLSTATISTICS *ProtocolStatistics - ); - -HBA_STATUS HBA_API -SMHBA_GetNumberOfPorts( - IN HBA_HANDLE Handle, - OUT HBA_UINT32 *NumberOfPorts - ); - -HBA_STATUS HBA_API -SMHBA_GetAdapterAttributes( - IN HBA_HANDLE Handle, - OUT SMHBA_ADAPTERATTRIBUTES *AdapterAttributes - ); - -HBA_STATUS HBA_API -SMHBA_GetPhyStatistics( - IN HBA_HANDLE Handle, - IN HBA_UINT32 PortIndex, - IN HBA_UINT32 PhyIndex, - OUT SMHBA_PHYSTATISTICS *PhyStatistics - ); - -HBA_STATUS HBA_API -SMHBA_GetDiscoveredPortAttributes( - IN HBA_HANDLE Handle, - IN HBA_UINT32 PortIndex, - IN HBA_UINT32 DiscoveredPortIndex, - OUT SMHBA_PORTATTRIBUTES *PortAttributes - ); - -HBA_STATUS HBA_API -SMHBA_GetPortAttributesByWWN( - IN HBA_HANDLE Handle, - IN HBA_WWN PortWWN, - IN HBA_WWN DomainPortWWN, - OUT SMHBA_PORTATTRIBUTES *PortAttributes - ); - -HBA_STATUS HBA_API -SMHBA_GetPortType( - IN HBA_HANDLE Handle, - IN HBA_UINT32 PortIndex, - OUT HBA_PORTTYPE *PortType - ); - -HBA_STATUS HBA_API -SMHBA_GetAdapterPortAttributes( - IN HBA_HANDLE Handle, - IN HBA_UINT32 PortIndex, - OUT SMHBA_PORTATTRIBUTES *PortAttributes - ); - -HBA_STATUS HBA_API -SMHBA_GetFCPhyAttributes( - IN HBA_HANDLE Handle, - IN HBA_UINT32 PortIndex, - IN HBA_UINT32 PhyIndex, - OUT SMHBA_FC_PHY *PhyType - ); - -HBA_STATUS HBA_API -SMHBA_GetSASPhyAttributes( - IN HBA_HANDLE Handle, - IN HBA_UINT32 PortIndex, - IN HBA_UINT32 PhyIndex, - OUT SMHBA_SAS_PHY *PhyType - ); - -// -// SM-HBA Target Information Functions -// - -HBA_STATUS HBA_API -SMHBA_GetLUNStatistics( - IN HBA_HANDLE Handle, - IN const HBA_SCSIID *Lunit, - OUT SMHBA_PROTOCOLSTATISTICS *ProtocolStatistics - ); - -HBA_STATUS HBA_API -SMHBA_GetTargetMapping( - IN HBA_HANDLE HbaHandle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DomainPortWWN, - IN OUT SMHBA_TARGETMAPPING *Mapping - ); - -HBA_STATUS HBA_API -SMHBA_GetBindingCapability( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DomainPortWWN, - OUT SMHBA_BIND_CAPABILITY *Flags - ); - -HBA_STATUS HBA_API -SMHBA_GetBindingSupport( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DomainPortWWN, - OUT SMHBA_BIND_CAPABILITY *Flags - ); - -HBA_STATUS HBA_API -SMHBA_SetBindingSupport( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DomainPortWWN, - IN SMHBA_BIND_CAPABILITY Flags - ); - -HBA_STATUS HBA_API -SMHBA_GetPersistentBinding( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DomainPortWWN, - IN OUT SMHBA_BINDING *Binding - ); - -HBA_STATUS HBA_API -SMHBA_SetPersistentBinding( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DomainPortWWN, - IN OUT SMHBA_BINDING *Binding - ); - -HBA_STATUS HBA_API -SMHBA_RemovePersistentBinding( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DomainPortWWN, - IN const SMHBA_BINDING *Binding - ); - -HBA_STATUS HBA_API -SMHBA_RemoveAllPersistentBindings( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DomainPortWWN - ); - -// -// SCSI Information Functions -// - -HBA_STATUS HBA_API -SMHBA_ScsiInquiry( - IN HBA_HANDLE HbaHandle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DiscoveredPortWWN, - IN HBA_WWN DomainPortWWN, - IN HBA_SCSILUN SmhbaLUN, - IN HBA_UINT8 CDB_Byte1, - IN HBA_UINT8 CDB_Byte2, - OUT void *pRespBuffer, - IN OUT HBA_UINT32 *pRespBufferSize, - OUT HBA_UINT8 *pScsiStatus, - OUT void *pSenseBuffer, - IN OUT HBA_UINT32 *pSenseBufferSize - ); - -HBA_STATUS HBA_API -SMHBA_ScsiReportLuns( - IN HBA_HANDLE Hbahandle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DiscoveredPortWWN, - IN HBA_WWN DomainPortWWN, - OUT void *pRespBuffer, - IN OUT HBA_UINT32 *pRespBufferSize, - OUT HBA_UINT8 *pScsiStatus, - OUT void *pSenseBuffer, - IN OUT HBA_UINT32 *pSenseBufferSize - ); - -HBA_STATUS HBA_API -SMHBA_ScsiReadCapacity( - IN HBA_HANDLE HbaHandle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DiscoveredPortWWN, - IN HBA_WWN DomainPortWWN, - IN HBA_SCSILUN SmhbaLUN, - OUT void *pRespBuffer, - IN OUT HBA_UINT32 *pRespBufferSize, - OUT HBA_UINT8 *pScsiStatus, - OUT void *pSenseBuffer, - IN OUT HBA_UINT32 *pSenseBufferSize - ); - -// -// Fabric and Domain Management Functions -// - -// new FC specific - -HBA_STATUS HBA_API -SMHBA_SendTEST( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DestWWN, - IN HBA_UINT32 DestFCID, - IN void *ReqBuffer, - IN HBA_UINT32 ReqBufferSize - ); - -// new FC specific - -HBA_STATUS HBA_API -SMHBA_SendECHO( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DestWWN, - IN HBA_UINT32 DestFCID, - IN void *ReqBuffer, - IN HBA_UINT32 ReqBufferSize, - OUT void *RspBuffer, - IN OUT HBA_UINT32 *RspBufferSize - ); - -// new SAS specific - -HBA_STATUS HBA_API -SMHBA_SendSMPPassThru( - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DestPortWWN, - IN HBA_WWN DomainPortWWN, - IN void *ReqBuffer, - IN HBA_UINT32 ReqBufferSize, - OUT void *RspBuffer, - IN OUT HBA_UINT32 *RspBufferSize - ); - - -// -// Event Handling Functions -// - - -HBA_STATUS HBA_API -SMHBA_RegisterForAdapterAddEvents( - IN void (*callback)(void *pData, HBA_WWN PortWWN, HBA_UINT32 eventType), - IN void *pUserData, - OUT HBA_CALLBACKHANDLE *pCallbackHandle - ); - -HBA_STATUS HBA_API -SMHBA_RegisterForAdapterEvents( - IN void (*callback)(void *pData, HBA_WWN PortWWN, HBA_UINT32 eventType), - IN void *pUserData, - IN HBA_HANDLE Handle, - OUT HBA_CALLBACKHANDLE *pCallbackHandle - ); - -HBA_STATUS HBA_API -SMHBA_RegisterForAdapterPortEvents( - IN void (*callback)(void *pData, - HBA_WWN PortWWN, - HBA_UINT32 eventType, - HBA_UINT32 fabricPortID), - IN void *pUserData, - IN HBA_HANDLE Handle, - IN HBA_WWN PortWWN, - IN HBA_UINT32 SpecificEventType, - OUT HBA_CALLBACKHANDLE *pCallbackHandle - ); - -HBA_STATUS HBA_API -SMHBA_RegisterForAdapterPortStatEvents( - IN void (*callback)(void *pData, - HBA_WWN PortWWN, - HBA_UINT32 ProtocolType, - HBA_UINT32 EventType), - IN void *pUserData, - IN HBA_HANDLE Handle, - IN HBA_WWN PortWWN, - IN HBA_UINT32 ProtocolType, - IN SMHBA_PROTOCOLSTATISTICS Stats, - IN HBA_UINT32 StatType, - OUT HBA_CALLBACKHANDLE *pCallbackHandle - ); - -HBA_STATUS HBA_API -SMHBA_RegisterForAdapterPhyStatEvents( - IN void (*callback)(void *pData, - HBA_WWN PortWWN, - HBA_UINT32 PhyIndex, - HBA_UINT32 EventType), - IN void *pUserData, - IN HBA_HANDLE Handle, - IN HBA_WWN PortWWN, - IN HBA_UINT32 PhyIndex, - IN SMHBA_PHYSTATISTICS Stats, - IN HBA_UINT32 StatType, - OUT HBA_CALLBACKHANDLE *pCallbackHandle - ); - -HBA_STATUS HBA_API -SMHBA_RegisterForTargetEvents( - IN void (*callback)(void *pData, - HBA_WWN HbaPortWWN, - HBA_WWN DiscoveredPortWWN, - HBA_WWN DomainPortWWN, - HBA_UINT32 EventType), - IN void *pUserData, - IN HBA_HANDLE Handle, - IN HBA_WWN HbaPortWWN, - IN HBA_WWN DiscoveredPortWWN, - IN HBA_WWN DomainPortWWN, - OUT HBA_CALLBACKHANDLE *pCallbackHandle, - IN HBA_UINT32 AllTargets - ); - -#endif // _SM_HBA_API_ - -#ifdef __cplusplus -}; -#endif - -#endif // HBAAPI_H - - diff --git a/pub/ddk/hbapiwmi.h b/pub/ddk/hbapiwmi.h deleted file mode 100644 index d5a2a06..0000000 --- a/pub/ddk/hbapiwmi.h +++ /dev/null @@ -1,4369 +0,0 @@ -#ifndef _hbapiwmi_h_ -#define _hbapiwmi_h_ - -// MSFC_HBAPortStatistics - MSFC_HBAPortStatistics - - -//*************************************************************************** -// -// hbapiwmi.h -// -// Module: WDM classes to expose HBA api data from drivers -// -// Purpose: Contains WDM classes that specify the HBA data to be exposed -// via the HBA api set. -// -// NOTE: This file contains information that is based upon: -// SM-HBA Version 1.0 and FC-HBA 2.18 specification. -// -// Please specify which WMI interfaces the provider will implement by -// defining MS_SM_HBA_API or MSFC_HBA_API before including this file. -// That is: -// -// #define MS_SM_HBA_API -// #include -// -// - or - -// -// #define MSFC_HBA_API -// #include -// -// -// Copyright (c) 2001 Microsoft Corporation -// -//*************************************************************************** - - -#define MSFC_HBAPortStatisticsGuid \ - { 0x3ce7904f,0x459f,0x480d, { 0x9a,0x3c,0x01,0x3e,0xde,0x3b,0xdd,0xe8 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_HBAPortStatistics_GUID, \ - 0x3ce7904f,0x459f,0x480d,0x9a,0x3c,0x01,0x3e,0xde,0x3b,0xdd,0xe8); -#endif - - -typedef struct _MSFC_HBAPortStatistics -{ - // - LONGLONG SecondsSinceLastReset; - #define MSFC_HBAPortStatistics_SecondsSinceLastReset_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_SecondsSinceLastReset_ID 1 - - // - LONGLONG TxFrames; - #define MSFC_HBAPortStatistics_TxFrames_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_TxFrames_ID 2 - - // - LONGLONG TxWords; - #define MSFC_HBAPortStatistics_TxWords_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_TxWords_ID 3 - - // - LONGLONG RxFrames; - #define MSFC_HBAPortStatistics_RxFrames_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_RxFrames_ID 4 - - // - LONGLONG RxWords; - #define MSFC_HBAPortStatistics_RxWords_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_RxWords_ID 5 - - // - LONGLONG LIPCount; - #define MSFC_HBAPortStatistics_LIPCount_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_LIPCount_ID 6 - - // - LONGLONG NOSCount; - #define MSFC_HBAPortStatistics_NOSCount_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_NOSCount_ID 7 - - // - LONGLONG ErrorFrames; - #define MSFC_HBAPortStatistics_ErrorFrames_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_ErrorFrames_ID 8 - - // - LONGLONG DumpedFrames; - #define MSFC_HBAPortStatistics_DumpedFrames_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_DumpedFrames_ID 9 - - // - LONGLONG LinkFailureCount; - #define MSFC_HBAPortStatistics_LinkFailureCount_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_LinkFailureCount_ID 10 - - // - LONGLONG LossOfSyncCount; - #define MSFC_HBAPortStatistics_LossOfSyncCount_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_LossOfSyncCount_ID 11 - - // - LONGLONG LossOfSignalCount; - #define MSFC_HBAPortStatistics_LossOfSignalCount_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_LossOfSignalCount_ID 12 - - // - LONGLONG PrimitiveSeqProtocolErrCount; - #define MSFC_HBAPortStatistics_PrimitiveSeqProtocolErrCount_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_PrimitiveSeqProtocolErrCount_ID 13 - - // - LONGLONG InvalidTxWordCount; - #define MSFC_HBAPortStatistics_InvalidTxWordCount_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_InvalidTxWordCount_ID 14 - - // - LONGLONG InvalidCRCCount; - #define MSFC_HBAPortStatistics_InvalidCRCCount_SIZE sizeof(LONGLONG) - #define MSFC_HBAPortStatistics_InvalidCRCCount_ID 15 - -} MSFC_HBAPortStatistics, *PMSFC_HBAPortStatistics; - -#define MSFC_HBAPortStatistics_SIZE (FIELD_OFFSET(MSFC_HBAPortStatistics, InvalidCRCCount) + MSFC_HBAPortStatistics_InvalidCRCCount_SIZE) - -// HBAFC3MgmtInfo - HBAFC3MgmtInfo -#define HBAFC3MgmtInfoGuid \ - { 0x5966a24f,0x6aa5,0x418e, { 0xb7,0x5c,0x2f,0x21,0x4d,0xfb,0x4b,0x18 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(HBAFC3MgmtInfo_GUID, \ - 0x5966a24f,0x6aa5,0x418e,0xb7,0x5c,0x2f,0x21,0x4d,0xfb,0x4b,0x18); -#endif - - -typedef struct _HBAFC3MgmtInfo -{ - // - ULONGLONG UniqueAdapterId; - #define HBAFC3MgmtInfo_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define HBAFC3MgmtInfo_UniqueAdapterId_ID 1 - - // - UCHAR wwn[8]; - #define HBAFC3MgmtInfo_wwn_SIZE sizeof(UCHAR[8]) - #define HBAFC3MgmtInfo_wwn_ID 2 - - // - ULONG unittype; - #define HBAFC3MgmtInfo_unittype_SIZE sizeof(ULONG) - #define HBAFC3MgmtInfo_unittype_ID 3 - - // - ULONG PortId; - #define HBAFC3MgmtInfo_PortId_SIZE sizeof(ULONG) - #define HBAFC3MgmtInfo_PortId_ID 4 - - // - ULONG NumberOfAttachedNodes; - #define HBAFC3MgmtInfo_NumberOfAttachedNodes_SIZE sizeof(ULONG) - #define HBAFC3MgmtInfo_NumberOfAttachedNodes_ID 5 - - // - USHORT IPVersion; - #define HBAFC3MgmtInfo_IPVersion_SIZE sizeof(USHORT) - #define HBAFC3MgmtInfo_IPVersion_ID 6 - - // - USHORT UDPPort; - #define HBAFC3MgmtInfo_UDPPort_SIZE sizeof(USHORT) - #define HBAFC3MgmtInfo_UDPPort_ID 7 - - // - UCHAR IPAddress[16]; - #define HBAFC3MgmtInfo_IPAddress_SIZE sizeof(UCHAR[16]) - #define HBAFC3MgmtInfo_IPAddress_ID 8 - - // - USHORT reserved; - #define HBAFC3MgmtInfo_reserved_SIZE sizeof(USHORT) - #define HBAFC3MgmtInfo_reserved_ID 9 - - // - USHORT TopologyDiscoveryFlags; - #define HBAFC3MgmtInfo_TopologyDiscoveryFlags_SIZE sizeof(USHORT) - #define HBAFC3MgmtInfo_TopologyDiscoveryFlags_ID 10 - - // - ULONG reserved1; - #define HBAFC3MgmtInfo_reserved1_SIZE sizeof(ULONG) - #define HBAFC3MgmtInfo_reserved1_ID 11 - -} HBAFC3MgmtInfo, *PHBAFC3MgmtInfo; - -#define HBAFC3MgmtInfo_SIZE (FIELD_OFFSET(HBAFC3MgmtInfo, reserved1) + HBAFC3MgmtInfo_reserved1_SIZE) - -// HBAScsiID - HBAScsiID -#define HBAScsiIDGuid \ - { 0xa76f5058,0xb1f0,0x4622, { 0x9e,0x88,0x5c,0xc4,0x1e,0x34,0x45,0x4a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(HBAScsiID_GUID, \ - 0xa76f5058,0xb1f0,0x4622,0x9e,0x88,0x5c,0xc4,0x1e,0x34,0x45,0x4a); -#endif - - -typedef struct _HBAScsiID -{ - // - ULONG ScsiBusNumber; - #define HBAScsiID_ScsiBusNumber_SIZE sizeof(ULONG) - #define HBAScsiID_ScsiBusNumber_ID 1 - - // - ULONG ScsiTargetNumber; - #define HBAScsiID_ScsiTargetNumber_SIZE sizeof(ULONG) - #define HBAScsiID_ScsiTargetNumber_ID 2 - - // - ULONG ScsiOSLun; - #define HBAScsiID_ScsiOSLun_SIZE sizeof(ULONG) - #define HBAScsiID_ScsiOSLun_ID 3 - - - - //****************************************************************** - // - // This used to be a string type, but we made this a fixed length - // array so the WmiSizeIs() will work correctly for structs that - // contain this type. - // Please note that this should still be treated as a string. - // The first uint16 must hold the length of string (in bytes). - // - //****************************************************************** - - - // - USHORT OSDeviceName[257]; - #define HBAScsiID_OSDeviceName_SIZE sizeof(USHORT[257]) - #define HBAScsiID_OSDeviceName_ID 4 - -} HBAScsiID, *PHBAScsiID; - -#define HBAScsiID_SIZE (FIELD_OFFSET(HBAScsiID, OSDeviceName) + HBAScsiID_OSDeviceName_SIZE) - -// MSFC_LinkEvent - MSFC_LinkEvent - - - - -// -// Event types. -// -// These match the definitions in hbaapi.h and must be kept in sync. -// - /* Adapter Level Events */ -#define HBA_EVENT_ADAPTER_UNKNOWN 0x100 -#define HBA_EVENT_ADAPTER_ADD 0x101 -#define HBA_EVENT_ADAPTER_REMOVE 0x102 -#define HBA_EVENT_ADAPTER_CHANGE 0x103 - - /* Port Level Events */ -#define HBA_EVENT_PORT_UNKNOWN 0x200 -#define HBA_EVENT_PORT_OFFLINE 0x201 -#define HBA_EVENT_PORT_ONLINE 0x202 -#define HBA_EVENT_PORT_NEW_TARGETS 0x203 -#define HBA_EVENT_PORT_FABRIC 0x204 -#define HBA_EVENT_PORT_BROADCAST_CHANGE 0x205 -#define HBA_EVENT_PORT_BROADCAST_D24_0 0x206 -#define HBA_EVENT_PORT_BROADCAST_D27_4 0x207 -#define HBA_EVENT_PORT_BROADCAST_SES 0x208 -#define HBA_EVENT_PORT_BROADCAST_D01_4 0x209 -#define HBA_EVENT_PORT_BROADCAST_D04_7 0x20a -#define HBA_EVENT_PORT_BROADCAST_D16_7 0x20b -#define HBA_EVENT_PORT_BROADCAST_D29_7 0x20c -#define HBA_EVENT_PORT_ALL 0x2ff - - /* Port Statistics Events */ -#define HBA_EVENT_PORT_STAT_THRESHOLD 0x301 -#define HBA_EVENT_PORT_STAT_GROWTH 0x302 - -/* Phy Statistics Events */ -#define HBA_EVENT_PHY_STAT_THRESHOLD 0x351 -#define HBA_EVENT_PHY_STAT_GROWTH 0x352 - - /* Target Level Events */ -#define HBA_EVENT_TARGET_UNKNOWN 0x400 -#define HBA_EVENT_TARGET_OFFLINE 0x401 -#define HBA_EVENT_TARGET_ONLINE 0x402 -#define HBA_EVENT_TARGET_REMOVED 0x403 - - /* Fabric Link Events */ -#define HBA_EVENT_LINK_UNKNOWN 0x500 -#define HBA_EVENT_LINK_INCIDENT 0x501 - -#define MSFC_LinkEventGuid \ - { 0xc66015ee,0x014b,0x498a, { 0x94,0x51,0x99,0xfe,0xad,0x0a,0xb4,0x51 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_LinkEvent_GUID, \ - 0xc66015ee,0x014b,0x498a,0x94,0x51,0x99,0xfe,0xad,0x0a,0xb4,0x51); -#endif - - -typedef struct _MSFC_LinkEvent -{ - // - ULONG EventType; - #define MSFC_LinkEvent_EventType_SIZE sizeof(ULONG) - #define MSFC_LinkEvent_EventType_ID 1 - - // - UCHAR AdapterWWN[8]; - #define MSFC_LinkEvent_AdapterWWN_SIZE sizeof(UCHAR[8]) - #define MSFC_LinkEvent_AdapterWWN_ID 2 - - // - ULONG RLIRBufferSize; - #define MSFC_LinkEvent_RLIRBufferSize_SIZE sizeof(ULONG) - #define MSFC_LinkEvent_RLIRBufferSize_ID 3 - - // - UCHAR RLIRBuffer[1]; - #define MSFC_LinkEvent_RLIRBuffer_ID 4 - -} MSFC_LinkEvent, *PMSFC_LinkEvent; - -// MSFC_FCAdapterHBAAttributes - MSFC_FCAdapterHBAAttributes - - -#ifndef MS_SM_HBA_API -#ifndef MSFC_HBA_API -// -// if neither defined then default to MSFC -// -#define MSFC_HBA_API -#endif -#endif - - -#ifdef MSFC_HBA_API - -#define MSFC_FCAdapterHBAAttributesGuid \ - { 0xf8f3ea26,0xab2c,0x4593, { 0x8b,0x84,0xc5,0x64,0x28,0xe6,0xbe,0xdb } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_FCAdapterHBAAttributes_GUID, \ - 0xf8f3ea26,0xab2c,0x4593,0x8b,0x84,0xc5,0x64,0x28,0xe6,0xbe,0xdb); -#endif - - -typedef struct _MSFC_FCAdapterHBAAttributes -{ - // - ULONGLONG UniqueAdapterId; - #define MSFC_FCAdapterHBAAttributes_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSFC_FCAdapterHBAAttributes_UniqueAdapterId_ID 1 - - // - ULONG HBAStatus; - #define MSFC_FCAdapterHBAAttributes_HBAStatus_SIZE sizeof(ULONG) - #define MSFC_FCAdapterHBAAttributes_HBAStatus_ID 2 - - // - UCHAR NodeWWN[8]; - #define MSFC_FCAdapterHBAAttributes_NodeWWN_SIZE sizeof(UCHAR[8]) - #define MSFC_FCAdapterHBAAttributes_NodeWWN_ID 3 - - // - ULONG VendorSpecificID; - #define MSFC_FCAdapterHBAAttributes_VendorSpecificID_SIZE sizeof(ULONG) - #define MSFC_FCAdapterHBAAttributes_VendorSpecificID_ID 4 - - // - ULONG NumberOfPorts; - #define MSFC_FCAdapterHBAAttributes_NumberOfPorts_SIZE sizeof(ULONG) - #define MSFC_FCAdapterHBAAttributes_NumberOfPorts_ID 5 - - - - //****************************************************************** - // - // The string type is variable length (up to MaxLen). - // Each string starts with a ushort that holds the strings length - // (in bytes) followed by the WCHARs that make up the string. - // - //****************************************************************** - - - // - WCHAR Manufacturer[64 + 1]; - #define MSFC_FCAdapterHBAAttributes_Manufacturer_ID 6 - - // - WCHAR SerialNumber[64 + 1]; - #define MSFC_FCAdapterHBAAttributes_SerialNumber_ID 7 - - // - WCHAR Model[256 + 1]; - #define MSFC_FCAdapterHBAAttributes_Model_ID 8 - - // - WCHAR ModelDescription[256 + 1]; - #define MSFC_FCAdapterHBAAttributes_ModelDescription_ID 9 - - // - WCHAR NodeSymbolicName[256 + 1]; - #define MSFC_FCAdapterHBAAttributes_NodeSymbolicName_ID 10 - - // - WCHAR HardwareVersion[256 + 1]; - #define MSFC_FCAdapterHBAAttributes_HardwareVersion_ID 11 - - // - WCHAR DriverVersion[256 + 1]; - #define MSFC_FCAdapterHBAAttributes_DriverVersion_ID 12 - - // - WCHAR OptionROMVersion[256 + 1]; - #define MSFC_FCAdapterHBAAttributes_OptionROMVersion_ID 13 - - // - WCHAR FirmwareVersion[256 + 1]; - #define MSFC_FCAdapterHBAAttributes_FirmwareVersion_ID 14 - - // - WCHAR DriverName[256 + 1]; - #define MSFC_FCAdapterHBAAttributes_DriverName_ID 15 - - // - WCHAR MfgDomain[256 + 1]; - #define MSFC_FCAdapterHBAAttributes_MfgDomain_ID 16 - -} MSFC_FCAdapterHBAAttributes, *PMSFC_FCAdapterHBAAttributes; - -// MSFC_HBAPortAttributesResults - MSFC_HBAPortAttributesResults -#define MSFC_HBAPortAttributesResultsGuid \ - { 0xa76bd4e3,0x9961,0x4d9b, { 0xb6,0xbe,0x86,0xe6,0x98,0x26,0x0f,0x68 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_HBAPortAttributesResults_GUID, \ - 0xa76bd4e3,0x9961,0x4d9b,0xb6,0xbe,0x86,0xe6,0x98,0x26,0x0f,0x68); -#endif - - -typedef struct _MSFC_HBAPortAttributesResults -{ - // - UCHAR NodeWWN[8]; - #define MSFC_HBAPortAttributesResults_NodeWWN_SIZE sizeof(UCHAR[8]) - #define MSFC_HBAPortAttributesResults_NodeWWN_ID 1 - - // - UCHAR PortWWN[8]; - #define MSFC_HBAPortAttributesResults_PortWWN_SIZE sizeof(UCHAR[8]) - #define MSFC_HBAPortAttributesResults_PortWWN_ID 2 - - // - ULONG PortFcId; - #define MSFC_HBAPortAttributesResults_PortFcId_SIZE sizeof(ULONG) - #define MSFC_HBAPortAttributesResults_PortFcId_ID 3 - - // - ULONG PortType; - #define MSFC_HBAPortAttributesResults_PortType_SIZE sizeof(ULONG) - #define MSFC_HBAPortAttributesResults_PortType_ID 4 - - // - ULONG PortState; - #define MSFC_HBAPortAttributesResults_PortState_SIZE sizeof(ULONG) - #define MSFC_HBAPortAttributesResults_PortState_ID 5 - - // - ULONG PortSupportedClassofService; - #define MSFC_HBAPortAttributesResults_PortSupportedClassofService_SIZE sizeof(ULONG) - #define MSFC_HBAPortAttributesResults_PortSupportedClassofService_ID 6 - - // - UCHAR PortSupportedFc4Types[32]; - #define MSFC_HBAPortAttributesResults_PortSupportedFc4Types_SIZE sizeof(UCHAR[32]) - #define MSFC_HBAPortAttributesResults_PortSupportedFc4Types_ID 7 - - // - UCHAR PortActiveFc4Types[32]; - #define MSFC_HBAPortAttributesResults_PortActiveFc4Types_SIZE sizeof(UCHAR[32]) - #define MSFC_HBAPortAttributesResults_PortActiveFc4Types_ID 8 - - // - ULONG PortSupportedSpeed; - #define MSFC_HBAPortAttributesResults_PortSupportedSpeed_SIZE sizeof(ULONG) - #define MSFC_HBAPortAttributesResults_PortSupportedSpeed_ID 9 - - // - ULONG PortSpeed; - #define MSFC_HBAPortAttributesResults_PortSpeed_SIZE sizeof(ULONG) - #define MSFC_HBAPortAttributesResults_PortSpeed_ID 10 - - // - ULONG PortMaxFrameSize; - #define MSFC_HBAPortAttributesResults_PortMaxFrameSize_SIZE sizeof(ULONG) - #define MSFC_HBAPortAttributesResults_PortMaxFrameSize_ID 11 - - // - UCHAR FabricName[8]; - #define MSFC_HBAPortAttributesResults_FabricName_SIZE sizeof(UCHAR[8]) - #define MSFC_HBAPortAttributesResults_FabricName_ID 12 - - // - ULONG NumberofDiscoveredPorts; - #define MSFC_HBAPortAttributesResults_NumberofDiscoveredPorts_SIZE sizeof(ULONG) - #define MSFC_HBAPortAttributesResults_NumberofDiscoveredPorts_ID 13 - -} MSFC_HBAPortAttributesResults, *PMSFC_HBAPortAttributesResults; - -#define MSFC_HBAPortAttributesResults_SIZE (FIELD_OFFSET(MSFC_HBAPortAttributesResults, NumberofDiscoveredPorts) + MSFC_HBAPortAttributesResults_NumberofDiscoveredPorts_SIZE) - -// MSFC_FibrePortHBAAttributes - MSFC_FibrePortHBAAttributes -#define MSFC_FibrePortHBAAttributesGuid \ - { 0x61b397fd,0xf5ae,0x4950, { 0x97,0x58,0x0e,0xe5,0x98,0xe3,0xc6,0xe6 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_FibrePortHBAAttributes_GUID, \ - 0x61b397fd,0xf5ae,0x4950,0x97,0x58,0x0e,0xe5,0x98,0xe3,0xc6,0xe6); -#endif - - -typedef struct _MSFC_FibrePortHBAAttributes -{ - // - ULONGLONG UniquePortId; - #define MSFC_FibrePortHBAAttributes_UniquePortId_SIZE sizeof(ULONGLONG) - #define MSFC_FibrePortHBAAttributes_UniquePortId_ID 1 - - // - ULONG HBAStatus; - #define MSFC_FibrePortHBAAttributes_HBAStatus_SIZE sizeof(ULONG) - #define MSFC_FibrePortHBAAttributes_HBAStatus_ID 2 - - // - MSFC_HBAPortAttributesResults Attributes; - #define MSFC_FibrePortHBAAttributes_Attributes_SIZE sizeof(MSFC_HBAPortAttributesResults) - #define MSFC_FibrePortHBAAttributes_Attributes_ID 3 - -} MSFC_FibrePortHBAAttributes, *PMSFC_FibrePortHBAAttributes; - -#define MSFC_FibrePortHBAAttributes_SIZE (FIELD_OFFSET(MSFC_FibrePortHBAAttributes, Attributes) + MSFC_FibrePortHBAAttributes_Attributes_SIZE) - -// MSFC_FibrePortHBAStatistics - MSFC_FibrePortHBAStatistics -#define MSFC_FibrePortHBAStatisticsGuid \ - { 0x27efaba4,0x362a,0x4f20, { 0x92,0x0b,0xed,0x66,0xe2,0x80,0xfc,0xf5 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_FibrePortHBAStatistics_GUID, \ - 0x27efaba4,0x362a,0x4f20,0x92,0x0b,0xed,0x66,0xe2,0x80,0xfc,0xf5); -#endif - - -typedef struct _MSFC_FibrePortHBAStatistics -{ - // - ULONGLONG UniquePortId; - #define MSFC_FibrePortHBAStatistics_UniquePortId_SIZE sizeof(ULONGLONG) - #define MSFC_FibrePortHBAStatistics_UniquePortId_ID 1 - - // - ULONG HBAStatus; - #define MSFC_FibrePortHBAStatistics_HBAStatus_SIZE sizeof(ULONG) - #define MSFC_FibrePortHBAStatistics_HBAStatus_ID 2 - - // - MSFC_HBAPortStatistics Statistics; - #define MSFC_FibrePortHBAStatistics_Statistics_SIZE sizeof(MSFC_HBAPortStatistics) - #define MSFC_FibrePortHBAStatistics_Statistics_ID 3 - -} MSFC_FibrePortHBAStatistics, *PMSFC_FibrePortHBAStatistics; - -#define MSFC_FibrePortHBAStatistics_SIZE (FIELD_OFFSET(MSFC_FibrePortHBAStatistics, Statistics) + MSFC_FibrePortHBAStatistics_Statistics_SIZE) - -// MSFC_FibrePortHBAMethods - MSFC_FibrePortHBAMethods -#define MSFC_FibrePortHBAMethodsGuid \ - { 0xe693553e,0xedf6,0x4d57, { 0xbf,0x08,0xef,0xca,0xae,0x1a,0x2e,0x1c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_FibrePortHBAMethods_GUID, \ - 0xe693553e,0xedf6,0x4d57,0xbf,0x08,0xef,0xca,0xae,0x1a,0x2e,0x1c); -#endif - -// -// Method id definitions for MSFC_FibrePortHBAMethods -#define ResetStatistics 1 - -// MSFC_FC4STATISTICS - MSFC_FC4STATISTICS -#define MSFC_FC4STATISTICSGuid \ - { 0xca8e7fe6,0xb85e,0x497f, { 0x88,0x58,0x9b,0x5d,0x93,0xa6,0x6f,0xe1 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_FC4STATISTICS_GUID, \ - 0xca8e7fe6,0xb85e,0x497f,0x88,0x58,0x9b,0x5d,0x93,0xa6,0x6f,0xe1); -#endif - - -typedef struct _MSFC_FC4STATISTICS -{ - // - ULONGLONG InputRequests; - #define MSFC_FC4STATISTICS_InputRequests_SIZE sizeof(ULONGLONG) - #define MSFC_FC4STATISTICS_InputRequests_ID 1 - - // - ULONGLONG OutputRequests; - #define MSFC_FC4STATISTICS_OutputRequests_SIZE sizeof(ULONGLONG) - #define MSFC_FC4STATISTICS_OutputRequests_ID 2 - - // - ULONGLONG ControlRequests; - #define MSFC_FC4STATISTICS_ControlRequests_SIZE sizeof(ULONGLONG) - #define MSFC_FC4STATISTICS_ControlRequests_ID 3 - - // - ULONGLONG InputMegabytes; - #define MSFC_FC4STATISTICS_InputMegabytes_SIZE sizeof(ULONGLONG) - #define MSFC_FC4STATISTICS_InputMegabytes_ID 4 - - // - ULONGLONG OutputMegabytes; - #define MSFC_FC4STATISTICS_OutputMegabytes_SIZE sizeof(ULONGLONG) - #define MSFC_FC4STATISTICS_OutputMegabytes_ID 5 - -} MSFC_FC4STATISTICS, *PMSFC_FC4STATISTICS; - -#define MSFC_FC4STATISTICS_SIZE (FIELD_OFFSET(MSFC_FC4STATISTICS, OutputMegabytes) + MSFC_FC4STATISTICS_OutputMegabytes_SIZE) - -// MSFC_EventBuffer - MSFC_EventBuffer -#define MSFC_EventBufferGuid \ - { 0x623f4588,0xcf01,0x4f0e, { 0xb1,0x97,0xab,0xbe,0xe5,0xe0,0xcf,0xf3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_EventBuffer_GUID, \ - 0x623f4588,0xcf01,0x4f0e,0xb1,0x97,0xab,0xbe,0xe5,0xe0,0xcf,0xf3); -#endif - - -typedef struct _MSFC_EventBuffer -{ - // - ULONG EventType; - #define MSFC_EventBuffer_EventType_SIZE sizeof(ULONG) - #define MSFC_EventBuffer_EventType_ID 1 - - // - ULONG EventInfo[4]; - #define MSFC_EventBuffer_EventInfo_SIZE sizeof(ULONG[4]) - #define MSFC_EventBuffer_EventInfo_ID 2 - -} MSFC_EventBuffer, *PMSFC_EventBuffer; - -#define MSFC_EventBuffer_SIZE (FIELD_OFFSET(MSFC_EventBuffer, EventInfo) + MSFC_EventBuffer_EventInfo_SIZE) - -// MSFC_HBAAdapterMethods - MSFC_HBAAdapterMethods -#define MSFC_HBAAdapterMethodsGuid \ - { 0xdf87d4ed,0x4612,0x4d12, { 0x85,0xfb,0x83,0x57,0x4e,0xc3,0x4b,0x7c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_HBAAdapterMethods_GUID, \ - 0xdf87d4ed,0x4612,0x4d12,0x85,0xfb,0x83,0x57,0x4e,0xc3,0x4b,0x7c); -#endif - -// -// Method id definitions for MSFC_HBAAdapterMethods -#define GetDiscoveredPortAttributes 1 -typedef struct _GetDiscoveredPortAttributes_IN -{ - // - ULONG PortIndex; - #define GetDiscoveredPortAttributes_IN_PortIndex_SIZE sizeof(ULONG) - #define GetDiscoveredPortAttributes_IN_PortIndex_ID 1 - - // - ULONG DiscoveredPortIndex; - #define GetDiscoveredPortAttributes_IN_DiscoveredPortIndex_SIZE sizeof(ULONG) - #define GetDiscoveredPortAttributes_IN_DiscoveredPortIndex_ID 2 - -} GetDiscoveredPortAttributes_IN, *PGetDiscoveredPortAttributes_IN; - -#define GetDiscoveredPortAttributes_IN_SIZE (FIELD_OFFSET(GetDiscoveredPortAttributes_IN, DiscoveredPortIndex) + GetDiscoveredPortAttributes_IN_DiscoveredPortIndex_SIZE) - -typedef struct _GetDiscoveredPortAttributes_OUT -{ - // - ULONG HBAStatus; - #define GetDiscoveredPortAttributes_OUT_HBAStatus_SIZE sizeof(ULONG) - #define GetDiscoveredPortAttributes_OUT_HBAStatus_ID 3 - - // - MSFC_HBAPortAttributesResults PortAttributes; - #define GetDiscoveredPortAttributes_OUT_PortAttributes_SIZE sizeof(MSFC_HBAPortAttributesResults) - #define GetDiscoveredPortAttributes_OUT_PortAttributes_ID 4 - -} GetDiscoveredPortAttributes_OUT, *PGetDiscoveredPortAttributes_OUT; - -#define GetDiscoveredPortAttributes_OUT_SIZE (FIELD_OFFSET(GetDiscoveredPortAttributes_OUT, PortAttributes) + GetDiscoveredPortAttributes_OUT_PortAttributes_SIZE) - -#define GetPortAttributesByWWN 2 -typedef struct _GetPortAttributesByWWN_IN -{ - // - UCHAR wwn[8]; - #define GetPortAttributesByWWN_IN_wwn_SIZE sizeof(UCHAR[8]) - #define GetPortAttributesByWWN_IN_wwn_ID 1 - -} GetPortAttributesByWWN_IN, *PGetPortAttributesByWWN_IN; - -#define GetPortAttributesByWWN_IN_SIZE (FIELD_OFFSET(GetPortAttributesByWWN_IN, wwn) + GetPortAttributesByWWN_IN_wwn_SIZE) - -typedef struct _GetPortAttributesByWWN_OUT -{ - // - ULONG HBAStatus; - #define GetPortAttributesByWWN_OUT_HBAStatus_SIZE sizeof(ULONG) - #define GetPortAttributesByWWN_OUT_HBAStatus_ID 2 - - // - MSFC_HBAPortAttributesResults PortAttributes; - #define GetPortAttributesByWWN_OUT_PortAttributes_SIZE sizeof(MSFC_HBAPortAttributesResults) - #define GetPortAttributesByWWN_OUT_PortAttributes_ID 3 - -} GetPortAttributesByWWN_OUT, *PGetPortAttributesByWWN_OUT; - -#define GetPortAttributesByWWN_OUT_SIZE (FIELD_OFFSET(GetPortAttributesByWWN_OUT, PortAttributes) + GetPortAttributesByWWN_OUT_PortAttributes_SIZE) - -#define RefreshInformation 3 -#define SendCTPassThru 4 -typedef struct _SendCTPassThru_IN -{ - // - UCHAR PortWWN[8]; - #define SendCTPassThru_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define SendCTPassThru_IN_PortWWN_ID 1 - - // - ULONG RequestBufferCount; - #define SendCTPassThru_IN_RequestBufferCount_SIZE sizeof(ULONG) - #define SendCTPassThru_IN_RequestBufferCount_ID 2 - - // - UCHAR RequestBuffer[1]; - #define SendCTPassThru_IN_RequestBuffer_ID 3 - -} SendCTPassThru_IN, *PSendCTPassThru_IN; - -typedef struct _SendCTPassThru_OUT -{ - // - ULONG HBAStatus; - #define SendCTPassThru_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SendCTPassThru_OUT_HBAStatus_ID 4 - - // - ULONG TotalResponseBufferCount; - #define SendCTPassThru_OUT_TotalResponseBufferCount_SIZE sizeof(ULONG) - #define SendCTPassThru_OUT_TotalResponseBufferCount_ID 5 - - // - ULONG ActualResponseBufferCount; - #define SendCTPassThru_OUT_ActualResponseBufferCount_SIZE sizeof(ULONG) - #define SendCTPassThru_OUT_ActualResponseBufferCount_ID 6 - - -#define SendCTPassThru_OUT_ResponseBuffer_SIZE_HINT 768 - - // - UCHAR ResponseBuffer[1]; - #define SendCTPassThru_OUT_ResponseBuffer_ID 7 - -} SendCTPassThru_OUT, *PSendCTPassThru_OUT; - -#define SendRNID 5 -typedef struct _SendRNID_IN -{ - // - UCHAR wwn[8]; - #define SendRNID_IN_wwn_SIZE sizeof(UCHAR[8]) - #define SendRNID_IN_wwn_ID 1 - - // - ULONG wwntype; - #define SendRNID_IN_wwntype_SIZE sizeof(ULONG) - #define SendRNID_IN_wwntype_ID 2 - -} SendRNID_IN, *PSendRNID_IN; - -#define SendRNID_IN_SIZE (FIELD_OFFSET(SendRNID_IN, wwntype) + SendRNID_IN_wwntype_SIZE) - -typedef struct _SendRNID_OUT -{ - // - ULONG HBAStatus; - #define SendRNID_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SendRNID_OUT_HBAStatus_ID 3 - - // - ULONG ResponseBufferCount; - #define SendRNID_OUT_ResponseBufferCount_SIZE sizeof(ULONG) - #define SendRNID_OUT_ResponseBufferCount_ID 4 - - -#define SendRNID_OUT_ResponseBuffer_SIZE_HINT 76 - - // - UCHAR ResponseBuffer[1]; - #define SendRNID_OUT_ResponseBuffer_ID 5 - -} SendRNID_OUT, *PSendRNID_OUT; - -#define SendRNIDV2 6 -typedef struct _SendRNIDV2_IN -{ - // - UCHAR PortWWN[8]; - #define SendRNIDV2_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define SendRNIDV2_IN_PortWWN_ID 1 - - // - UCHAR DestWWN[8]; - #define SendRNIDV2_IN_DestWWN_SIZE sizeof(UCHAR[8]) - #define SendRNIDV2_IN_DestWWN_ID 2 - - // - ULONG DestFCID; - #define SendRNIDV2_IN_DestFCID_SIZE sizeof(ULONG) - #define SendRNIDV2_IN_DestFCID_ID 3 - - // - ULONG NodeIdDataFormat; - #define SendRNIDV2_IN_NodeIdDataFormat_SIZE sizeof(ULONG) - #define SendRNIDV2_IN_NodeIdDataFormat_ID 4 - -} SendRNIDV2_IN, *PSendRNIDV2_IN; - -#define SendRNIDV2_IN_SIZE (FIELD_OFFSET(SendRNIDV2_IN, NodeIdDataFormat) + SendRNIDV2_IN_NodeIdDataFormat_SIZE) - -typedef struct _SendRNIDV2_OUT -{ - // - ULONG HBAStatus; - #define SendRNIDV2_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SendRNIDV2_OUT_HBAStatus_ID 5 - - // - ULONG TotalRspBufferSize; - #define SendRNIDV2_OUT_TotalRspBufferSize_SIZE sizeof(ULONG) - #define SendRNIDV2_OUT_TotalRspBufferSize_ID 6 - - // - ULONG ActualRspBufferSize; - #define SendRNIDV2_OUT_ActualRspBufferSize_SIZE sizeof(ULONG) - #define SendRNIDV2_OUT_ActualRspBufferSize_ID 7 - - -#define SendRNIDV2_OUT_RspBuffer_SIZE_HINT 76 - - // - UCHAR RspBuffer[1]; - #define SendRNIDV2_OUT_RspBuffer_ID 8 - -} SendRNIDV2_OUT, *PSendRNIDV2_OUT; - -#define GetFC3MgmtInfo 7 -typedef struct _GetFC3MgmtInfo_OUT -{ - // - ULONG HBAStatus; - #define GetFC3MgmtInfo_OUT_HBAStatus_SIZE sizeof(ULONG) - #define GetFC3MgmtInfo_OUT_HBAStatus_ID 1 - - // - HBAFC3MgmtInfo MgmtInfo; - #define GetFC3MgmtInfo_OUT_MgmtInfo_SIZE sizeof(HBAFC3MgmtInfo) - #define GetFC3MgmtInfo_OUT_MgmtInfo_ID 2 - -} GetFC3MgmtInfo_OUT, *PGetFC3MgmtInfo_OUT; - -#define GetFC3MgmtInfo_OUT_SIZE (FIELD_OFFSET(GetFC3MgmtInfo_OUT, MgmtInfo) + GetFC3MgmtInfo_OUT_MgmtInfo_SIZE) - -#define SetFC3MgmtInfo 8 -typedef struct _SetFC3MgmtInfo_IN -{ - // - HBAFC3MgmtInfo MgmtInfo; - #define SetFC3MgmtInfo_IN_MgmtInfo_SIZE sizeof(HBAFC3MgmtInfo) - #define SetFC3MgmtInfo_IN_MgmtInfo_ID 1 - -} SetFC3MgmtInfo_IN, *PSetFC3MgmtInfo_IN; - -#define SetFC3MgmtInfo_IN_SIZE (FIELD_OFFSET(SetFC3MgmtInfo_IN, MgmtInfo) + SetFC3MgmtInfo_IN_MgmtInfo_SIZE) - -typedef struct _SetFC3MgmtInfo_OUT -{ - // - ULONG HBAStatus; - #define SetFC3MgmtInfo_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SetFC3MgmtInfo_OUT_HBAStatus_ID 2 - -} SetFC3MgmtInfo_OUT, *PSetFC3MgmtInfo_OUT; - -#define SetFC3MgmtInfo_OUT_SIZE (FIELD_OFFSET(SetFC3MgmtInfo_OUT, HBAStatus) + SetFC3MgmtInfo_OUT_HBAStatus_SIZE) - -#define SendRPL 9 -typedef struct _SendRPL_IN -{ - // - UCHAR PortWWN[8]; - #define SendRPL_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define SendRPL_IN_PortWWN_ID 1 - - // - UCHAR AgentWWN[8]; - #define SendRPL_IN_AgentWWN_SIZE sizeof(UCHAR[8]) - #define SendRPL_IN_AgentWWN_ID 2 - - // - ULONG agent_domain; - #define SendRPL_IN_agent_domain_SIZE sizeof(ULONG) - #define SendRPL_IN_agent_domain_ID 3 - - // - ULONG portIndex; - #define SendRPL_IN_portIndex_SIZE sizeof(ULONG) - #define SendRPL_IN_portIndex_ID 4 - -} SendRPL_IN, *PSendRPL_IN; - -#define SendRPL_IN_SIZE (FIELD_OFFSET(SendRPL_IN, portIndex) + SendRPL_IN_portIndex_SIZE) - -typedef struct _SendRPL_OUT -{ - // - ULONG HBAStatus; - #define SendRPL_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SendRPL_OUT_HBAStatus_ID 5 - - // - ULONG TotalRspBufferSize; - #define SendRPL_OUT_TotalRspBufferSize_SIZE sizeof(ULONG) - #define SendRPL_OUT_TotalRspBufferSize_ID 6 - - // - ULONG ActualRspBufferSize; - #define SendRPL_OUT_ActualRspBufferSize_SIZE sizeof(ULONG) - #define SendRPL_OUT_ActualRspBufferSize_ID 7 - - -#define SendRPL_OUT_RspBuffer_SIZE_HINT 28 // 12+16*n - - // - UCHAR RspBuffer[1]; - #define SendRPL_OUT_RspBuffer_ID 8 - -} SendRPL_OUT, *PSendRPL_OUT; - -#define SendRPS 10 -typedef struct _SendRPS_IN -{ - // - UCHAR PortWWN[8]; - #define SendRPS_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define SendRPS_IN_PortWWN_ID 1 - - // - UCHAR AgentWWN[8]; - #define SendRPS_IN_AgentWWN_SIZE sizeof(UCHAR[8]) - #define SendRPS_IN_AgentWWN_ID 2 - - // - UCHAR ObjectWWN[8]; - #define SendRPS_IN_ObjectWWN_SIZE sizeof(UCHAR[8]) - #define SendRPS_IN_ObjectWWN_ID 3 - - // - ULONG AgentDomain; - #define SendRPS_IN_AgentDomain_SIZE sizeof(ULONG) - #define SendRPS_IN_AgentDomain_ID 4 - - // - ULONG ObjectPortNumber; - #define SendRPS_IN_ObjectPortNumber_SIZE sizeof(ULONG) - #define SendRPS_IN_ObjectPortNumber_ID 5 - -} SendRPS_IN, *PSendRPS_IN; - -#define SendRPS_IN_SIZE (FIELD_OFFSET(SendRPS_IN, ObjectPortNumber) + SendRPS_IN_ObjectPortNumber_SIZE) - -typedef struct _SendRPS_OUT -{ - // - ULONG HBAStatus; - #define SendRPS_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SendRPS_OUT_HBAStatus_ID 6 - - // - ULONG TotalRspBufferSize; - #define SendRPS_OUT_TotalRspBufferSize_SIZE sizeof(ULONG) - #define SendRPS_OUT_TotalRspBufferSize_ID 7 - - // - ULONG ActualRspBufferSize; - #define SendRPS_OUT_ActualRspBufferSize_SIZE sizeof(ULONG) - #define SendRPS_OUT_ActualRspBufferSize_ID 8 - - -#define SendRPS_OUT_RspBuffer_SIZE_HINT 64 - - // - UCHAR RspBuffer[1]; - #define SendRPS_OUT_RspBuffer_ID 9 - -} SendRPS_OUT, *PSendRPS_OUT; - -#define SendSRL 11 -typedef struct _SendSRL_IN -{ - // - UCHAR PortWWN[8]; - #define SendSRL_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define SendSRL_IN_PortWWN_ID 1 - - // - UCHAR WWN[8]; - #define SendSRL_IN_WWN_SIZE sizeof(UCHAR[8]) - #define SendSRL_IN_WWN_ID 2 - - // - ULONG Domain; - #define SendSRL_IN_Domain_SIZE sizeof(ULONG) - #define SendSRL_IN_Domain_ID 3 - -} SendSRL_IN, *PSendSRL_IN; - -#define SendSRL_IN_SIZE (FIELD_OFFSET(SendSRL_IN, Domain) + SendSRL_IN_Domain_SIZE) - -typedef struct _SendSRL_OUT -{ - // - ULONG HBAStatus; - #define SendSRL_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SendSRL_OUT_HBAStatus_ID 4 - - // - ULONG TotalRspBufferSize; - #define SendSRL_OUT_TotalRspBufferSize_SIZE sizeof(ULONG) - #define SendSRL_OUT_TotalRspBufferSize_ID 5 - - // - ULONG ActualRspBufferSize; - #define SendSRL_OUT_ActualRspBufferSize_SIZE sizeof(ULONG) - #define SendSRL_OUT_ActualRspBufferSize_ID 6 - - -#define SendSRL_OUT_RspBuffer_SIZE_HINT 8 - - // - UCHAR RspBuffer[1]; - #define SendSRL_OUT_RspBuffer_ID 7 - -} SendSRL_OUT, *PSendSRL_OUT; - -#define SendLIRR 12 -typedef struct _SendLIRR_IN -{ - // - UCHAR SourceWWN[8]; - #define SendLIRR_IN_SourceWWN_SIZE sizeof(UCHAR[8]) - #define SendLIRR_IN_SourceWWN_ID 1 - - // - UCHAR DestWWN[8]; - #define SendLIRR_IN_DestWWN_SIZE sizeof(UCHAR[8]) - #define SendLIRR_IN_DestWWN_ID 2 - - // - UCHAR Function; - #define SendLIRR_IN_Function_SIZE sizeof(UCHAR) - #define SendLIRR_IN_Function_ID 3 - - // - UCHAR Type; - #define SendLIRR_IN_Type_SIZE sizeof(UCHAR) - #define SendLIRR_IN_Type_ID 4 - -} SendLIRR_IN, *PSendLIRR_IN; - -#define SendLIRR_IN_SIZE (FIELD_OFFSET(SendLIRR_IN, Type) + SendLIRR_IN_Type_SIZE) - -typedef struct _SendLIRR_OUT -{ - // - ULONG HBAStatus; - #define SendLIRR_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SendLIRR_OUT_HBAStatus_ID 5 - - // - ULONG TotalRspBufferSize; - #define SendLIRR_OUT_TotalRspBufferSize_SIZE sizeof(ULONG) - #define SendLIRR_OUT_TotalRspBufferSize_ID 6 - - // - ULONG ActualRspBufferSize; - #define SendLIRR_OUT_ActualRspBufferSize_SIZE sizeof(ULONG) - #define SendLIRR_OUT_ActualRspBufferSize_ID 7 - - -#define SendLIRR_OUT_RspBuffer_SIZE_HINT 8 - - // - UCHAR RspBuffer[1]; - #define SendLIRR_OUT_RspBuffer_ID 8 - -} SendLIRR_OUT, *PSendLIRR_OUT; - -#define GetFC4Statistics 13 -typedef struct _GetFC4Statistics_IN -{ - // - UCHAR PortWWN[8]; - #define GetFC4Statistics_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define GetFC4Statistics_IN_PortWWN_ID 1 - - // - UCHAR FC4Type; - #define GetFC4Statistics_IN_FC4Type_SIZE sizeof(UCHAR) - #define GetFC4Statistics_IN_FC4Type_ID 2 - -} GetFC4Statistics_IN, *PGetFC4Statistics_IN; - -#define GetFC4Statistics_IN_SIZE (FIELD_OFFSET(GetFC4Statistics_IN, FC4Type) + GetFC4Statistics_IN_FC4Type_SIZE) - -typedef struct _GetFC4Statistics_OUT -{ - // - ULONG HBAStatus; - #define GetFC4Statistics_OUT_HBAStatus_SIZE sizeof(ULONG) - #define GetFC4Statistics_OUT_HBAStatus_ID 3 - - // - MSFC_FC4STATISTICS FC4Statistics; - #define GetFC4Statistics_OUT_FC4Statistics_SIZE sizeof(MSFC_FC4STATISTICS) - #define GetFC4Statistics_OUT_FC4Statistics_ID 4 - -} GetFC4Statistics_OUT, *PGetFC4Statistics_OUT; - -#define GetFC4Statistics_OUT_SIZE (FIELD_OFFSET(GetFC4Statistics_OUT, FC4Statistics) + GetFC4Statistics_OUT_FC4Statistics_SIZE) - -#define GetFCPStatistics 14 -typedef struct _GetFCPStatistics_IN -{ - // - HBAScsiID ScsiId; - #define GetFCPStatistics_IN_ScsiId_SIZE sizeof(HBAScsiID) - #define GetFCPStatistics_IN_ScsiId_ID 1 - -} GetFCPStatistics_IN, *PGetFCPStatistics_IN; - -#define GetFCPStatistics_IN_SIZE (FIELD_OFFSET(GetFCPStatistics_IN, ScsiId) + GetFCPStatistics_IN_ScsiId_SIZE) - -typedef struct _GetFCPStatistics_OUT -{ - // - ULONG HBAStatus; - #define GetFCPStatistics_OUT_HBAStatus_SIZE sizeof(ULONG) - #define GetFCPStatistics_OUT_HBAStatus_ID 2 - - // - MSFC_FC4STATISTICS FC4Statistics; - #define GetFCPStatistics_OUT_FC4Statistics_SIZE sizeof(MSFC_FC4STATISTICS) - #define GetFCPStatistics_OUT_FC4Statistics_ID 3 - -} GetFCPStatistics_OUT, *PGetFCPStatistics_OUT; - -#define GetFCPStatistics_OUT_SIZE (FIELD_OFFSET(GetFCPStatistics_OUT, FC4Statistics) + GetFCPStatistics_OUT_FC4Statistics_SIZE) - -#define ScsiInquiry 15 -typedef struct _ScsiInquiry_IN -{ - // - UCHAR Cdb[6]; - #define ScsiInquiry_IN_Cdb_SIZE sizeof(UCHAR[6]) - #define ScsiInquiry_IN_Cdb_ID 1 - - // - UCHAR HbaPortWWN[8]; - #define ScsiInquiry_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define ScsiInquiry_IN_HbaPortWWN_ID 2 - - // - UCHAR DiscoveredPortWWN[8]; - #define ScsiInquiry_IN_DiscoveredPortWWN_SIZE sizeof(UCHAR[8]) - #define ScsiInquiry_IN_DiscoveredPortWWN_ID 3 - - // - ULONGLONG FcLun; - #define ScsiInquiry_IN_FcLun_SIZE sizeof(ULONGLONG) - #define ScsiInquiry_IN_FcLun_ID 4 - -} ScsiInquiry_IN, *PScsiInquiry_IN; - -#define ScsiInquiry_IN_SIZE (FIELD_OFFSET(ScsiInquiry_IN, FcLun) + ScsiInquiry_IN_FcLun_SIZE) - -typedef struct _ScsiInquiry_OUT -{ - // - ULONG HBAStatus; - #define ScsiInquiry_OUT_HBAStatus_SIZE sizeof(ULONG) - #define ScsiInquiry_OUT_HBAStatus_ID 5 - - // - ULONG ResponseBufferSize; - #define ScsiInquiry_OUT_ResponseBufferSize_SIZE sizeof(ULONG) - #define ScsiInquiry_OUT_ResponseBufferSize_ID 6 - - // - ULONG SenseBufferSize; - #define ScsiInquiry_OUT_SenseBufferSize_SIZE sizeof(ULONG) - #define ScsiInquiry_OUT_SenseBufferSize_ID 7 - - // - UCHAR ScsiStatus; - #define ScsiInquiry_OUT_ScsiStatus_SIZE sizeof(UCHAR) - #define ScsiInquiry_OUT_ScsiStatus_ID 8 - - -#define ScsiInquiry_OUT_ResponseBuffer_SIZE_HINT 96 - - // - UCHAR ResponseBuffer[1]; - #define ScsiInquiry_OUT_ResponseBuffer_ID 9 - - // -// UCHAR SenseBuffer[1]; - #define ScsiInquiry_OUT_SenseBuffer_ID 10 - -} ScsiInquiry_OUT, *PScsiInquiry_OUT; - -#define ScsiReadCapacity 16 -typedef struct _ScsiReadCapacity_IN -{ - // - UCHAR Cdb[10]; - #define ScsiReadCapacity_IN_Cdb_SIZE sizeof(UCHAR[10]) - #define ScsiReadCapacity_IN_Cdb_ID 1 - - // - UCHAR HbaPortWWN[8]; - #define ScsiReadCapacity_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define ScsiReadCapacity_IN_HbaPortWWN_ID 2 - - // - UCHAR DiscoveredPortWWN[8]; - #define ScsiReadCapacity_IN_DiscoveredPortWWN_SIZE sizeof(UCHAR[8]) - #define ScsiReadCapacity_IN_DiscoveredPortWWN_ID 3 - - // - ULONGLONG FcLun; - #define ScsiReadCapacity_IN_FcLun_SIZE sizeof(ULONGLONG) - #define ScsiReadCapacity_IN_FcLun_ID 4 - -} ScsiReadCapacity_IN, *PScsiReadCapacity_IN; - -#define ScsiReadCapacity_IN_SIZE (FIELD_OFFSET(ScsiReadCapacity_IN, FcLun) + ScsiReadCapacity_IN_FcLun_SIZE) - -typedef struct _ScsiReadCapacity_OUT -{ - // - ULONG HBAStatus; - #define ScsiReadCapacity_OUT_HBAStatus_SIZE sizeof(ULONG) - #define ScsiReadCapacity_OUT_HBAStatus_ID 5 - - // - ULONG ResponseBufferSize; - #define ScsiReadCapacity_OUT_ResponseBufferSize_SIZE sizeof(ULONG) - #define ScsiReadCapacity_OUT_ResponseBufferSize_ID 6 - - // - ULONG SenseBufferSize; - #define ScsiReadCapacity_OUT_SenseBufferSize_SIZE sizeof(ULONG) - #define ScsiReadCapacity_OUT_SenseBufferSize_ID 7 - - // - UCHAR ScsiStatus; - #define ScsiReadCapacity_OUT_ScsiStatus_SIZE sizeof(UCHAR) - #define ScsiReadCapacity_OUT_ScsiStatus_ID 8 - - -#define ScsiReadCapacity_OUT_ResponseBuffer_SIZE_HINT 16 - - // - UCHAR ResponseBuffer[1]; - #define ScsiReadCapacity_OUT_ResponseBuffer_ID 9 - - // -// UCHAR SenseBuffer[1]; - #define ScsiReadCapacity_OUT_SenseBuffer_ID 10 - -} ScsiReadCapacity_OUT, *PScsiReadCapacity_OUT; - -#define ScsiReportLuns 17 -typedef struct _ScsiReportLuns_IN -{ - // - UCHAR Cdb[12]; - #define ScsiReportLuns_IN_Cdb_SIZE sizeof(UCHAR[12]) - #define ScsiReportLuns_IN_Cdb_ID 1 - - // - UCHAR HbaPortWWN[8]; - #define ScsiReportLuns_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define ScsiReportLuns_IN_HbaPortWWN_ID 2 - - // - UCHAR DiscoveredPortWWN[8]; - #define ScsiReportLuns_IN_DiscoveredPortWWN_SIZE sizeof(UCHAR[8]) - #define ScsiReportLuns_IN_DiscoveredPortWWN_ID 3 - -} ScsiReportLuns_IN, *PScsiReportLuns_IN; - -#define ScsiReportLuns_IN_SIZE (FIELD_OFFSET(ScsiReportLuns_IN, DiscoveredPortWWN) + ScsiReportLuns_IN_DiscoveredPortWWN_SIZE) - -typedef struct _ScsiReportLuns_OUT -{ - // - ULONG HBAStatus; - #define ScsiReportLuns_OUT_HBAStatus_SIZE sizeof(ULONG) - #define ScsiReportLuns_OUT_HBAStatus_ID 4 - - // - ULONG ResponseBufferSize; - #define ScsiReportLuns_OUT_ResponseBufferSize_SIZE sizeof(ULONG) - #define ScsiReportLuns_OUT_ResponseBufferSize_ID 5 - - // - ULONG SenseBufferSize; - #define ScsiReportLuns_OUT_SenseBufferSize_SIZE sizeof(ULONG) - #define ScsiReportLuns_OUT_SenseBufferSize_ID 6 - - // - UCHAR ScsiStatus; - #define ScsiReportLuns_OUT_ScsiStatus_SIZE sizeof(UCHAR) - #define ScsiReportLuns_OUT_ScsiStatus_ID 7 - - -#define ScsiReportLuns_OUT_ResponseBuffer_SIZE_HINT 16 // 8+8*number_of_luns - - // - UCHAR ResponseBuffer[1]; - #define ScsiReportLuns_OUT_ResponseBuffer_ID 8 - - // -// UCHAR SenseBuffer[1]; - #define ScsiReportLuns_OUT_SenseBuffer_ID 9 - -} ScsiReportLuns_OUT, *PScsiReportLuns_OUT; - -#define GetEventBuffer 18 -typedef struct _GetEventBuffer_OUT -{ - // - ULONG HBAStatus; - #define GetEventBuffer_OUT_HBAStatus_SIZE sizeof(ULONG) - #define GetEventBuffer_OUT_HBAStatus_ID 1 - - // - ULONG EventCount; - #define GetEventBuffer_OUT_EventCount_SIZE sizeof(ULONG) - #define GetEventBuffer_OUT_EventCount_ID 2 - - // - MSFC_EventBuffer Events[1]; - #define GetEventBuffer_OUT_Events_ID 3 - -} GetEventBuffer_OUT, *PGetEventBuffer_OUT; - -#define SendRLS 19 -typedef struct _SendRLS_IN -{ - // - UCHAR PortWWN[8]; - #define SendRLS_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define SendRLS_IN_PortWWN_ID 1 - - // - UCHAR DestWWN[8]; - #define SendRLS_IN_DestWWN_SIZE sizeof(UCHAR[8]) - #define SendRLS_IN_DestWWN_ID 2 - -} SendRLS_IN, *PSendRLS_IN; - -#define SendRLS_IN_SIZE (FIELD_OFFSET(SendRLS_IN, DestWWN) + SendRLS_IN_DestWWN_SIZE) - -typedef struct _SendRLS_OUT -{ - // - ULONG HBAStatus; - #define SendRLS_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SendRLS_OUT_HBAStatus_ID 3 - - // - ULONG TotalRspBufferSize; - #define SendRLS_OUT_TotalRspBufferSize_SIZE sizeof(ULONG) - #define SendRLS_OUT_TotalRspBufferSize_ID 4 - - // - ULONG ActualRspBufferSize; - #define SendRLS_OUT_ActualRspBufferSize_SIZE sizeof(ULONG) - #define SendRLS_OUT_ActualRspBufferSize_ID 5 - - -#define SendRLS_OUT_RspBuffer_SIZE_HINT 28 - - // - UCHAR RspBuffer[1]; - #define SendRLS_OUT_RspBuffer_ID 6 - -} SendRLS_OUT, *PSendRLS_OUT; - - -// HBAFCPID - HBAFCPID -#define HBAFCPIDGuid \ - { 0xff02bc96,0x7fb0,0x4bac, { 0x8f,0x97,0xc7,0x1e,0x49,0x5f,0xa6,0x98 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(HBAFCPID_GUID, \ - 0xff02bc96,0x7fb0,0x4bac,0x8f,0x97,0xc7,0x1e,0x49,0x5f,0xa6,0x98); -#endif - - -typedef struct _HBAFCPID -{ - // - ULONG Fcid; - #define HBAFCPID_Fcid_SIZE sizeof(ULONG) - #define HBAFCPID_Fcid_ID 1 - - // - UCHAR NodeWWN[8]; - #define HBAFCPID_NodeWWN_SIZE sizeof(UCHAR[8]) - #define HBAFCPID_NodeWWN_ID 2 - - // - UCHAR PortWWN[8]; - #define HBAFCPID_PortWWN_SIZE sizeof(UCHAR[8]) - #define HBAFCPID_PortWWN_ID 3 - - // - ULONGLONG FcpLun; - #define HBAFCPID_FcpLun_SIZE sizeof(ULONGLONG) - #define HBAFCPID_FcpLun_ID 4 - -} HBAFCPID, *PHBAFCPID; - -#define HBAFCPID_SIZE (FIELD_OFFSET(HBAFCPID, FcpLun) + HBAFCPID_FcpLun_SIZE) - -// HBAFCPScsiEntry - HBAFCPScsiEntry -#define HBAFCPScsiEntryGuid \ - { 0x77ca1248,0x1505,0x4221, { 0x8e,0xb6,0xbb,0xb6,0xec,0x77,0x1a,0x87 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(HBAFCPScsiEntry_GUID, \ - 0x77ca1248,0x1505,0x4221,0x8e,0xb6,0xbb,0xb6,0xec,0x77,0x1a,0x87); -#endif - - -typedef struct _HBAFCPScsiEntry -{ - // - HBAFCPID FCPId; - #define HBAFCPScsiEntry_FCPId_SIZE sizeof(HBAFCPID) - #define HBAFCPScsiEntry_FCPId_ID 1 - - // - UCHAR Luid[256]; - #define HBAFCPScsiEntry_Luid_SIZE sizeof(UCHAR[256]) - #define HBAFCPScsiEntry_Luid_ID 2 - - // - HBAScsiID ScsiId; - #define HBAFCPScsiEntry_ScsiId_SIZE sizeof(HBAScsiID) - #define HBAFCPScsiEntry_ScsiId_ID 3 - -} HBAFCPScsiEntry, *PHBAFCPScsiEntry; - -#define HBAFCPScsiEntry_SIZE (FIELD_OFFSET(HBAFCPScsiEntry, ScsiId) + HBAFCPScsiEntry_ScsiId_SIZE) - -// HBAFCPBindingEntry - HBAFCPBindingEntry -#define HBAFCPBindingEntryGuid \ - { 0xfceff8b7,0x9d6b,0x4115, { 0x84,0x22,0x05,0x99,0x24,0x51,0xa6,0x29 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(HBAFCPBindingEntry_GUID, \ - 0xfceff8b7,0x9d6b,0x4115,0x84,0x22,0x05,0x99,0x24,0x51,0xa6,0x29); -#endif - - -typedef struct _HBAFCPBindingEntry -{ - // - ULONG Type; - #define HBAFCPBindingEntry_Type_SIZE sizeof(ULONG) - #define HBAFCPBindingEntry_Type_ID 1 - - // - HBAFCPID FCPId; - #define HBAFCPBindingEntry_FCPId_SIZE sizeof(HBAFCPID) - #define HBAFCPBindingEntry_FCPId_ID 2 - - // - HBAScsiID ScsiId; - #define HBAFCPBindingEntry_ScsiId_SIZE sizeof(HBAScsiID) - #define HBAFCPBindingEntry_ScsiId_ID 3 - -} HBAFCPBindingEntry, *PHBAFCPBindingEntry; - -#define HBAFCPBindingEntry_SIZE (FIELD_OFFSET(HBAFCPBindingEntry, ScsiId) + HBAFCPBindingEntry_ScsiId_SIZE) - -// HBAFCPBindingEntry2 - HBAFCPBindingEntry2 -#define HBAFCPBindingEntry2Guid \ - { 0x3a1e7679,0x4b1f,0x4f31, { 0xa8,0xae,0xfe,0x92,0x78,0x73,0x09,0x24 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(HBAFCPBindingEntry2_GUID, \ - 0x3a1e7679,0x4b1f,0x4f31,0xa8,0xae,0xfe,0x92,0x78,0x73,0x09,0x24); -#endif - - -typedef struct _HBAFCPBindingEntry2 -{ - // - ULONG Type; - #define HBAFCPBindingEntry2_Type_SIZE sizeof(ULONG) - #define HBAFCPBindingEntry2_Type_ID 1 - - // - HBAFCPID FCPId; - #define HBAFCPBindingEntry2_FCPId_SIZE sizeof(HBAFCPID) - #define HBAFCPBindingEntry2_FCPId_ID 2 - - // - UCHAR Luid[256]; - #define HBAFCPBindingEntry2_Luid_SIZE sizeof(UCHAR[256]) - #define HBAFCPBindingEntry2_Luid_ID 3 - - // - HBAScsiID ScsiId; - #define HBAFCPBindingEntry2_ScsiId_SIZE sizeof(HBAScsiID) - #define HBAFCPBindingEntry2_ScsiId_ID 4 - -} HBAFCPBindingEntry2, *PHBAFCPBindingEntry2; - -#define HBAFCPBindingEntry2_SIZE (FIELD_OFFSET(HBAFCPBindingEntry2, ScsiId) + HBAFCPBindingEntry2_ScsiId_SIZE) - -// MSFC_HBAFCPInfo - MSFC_HBAFCPInfo -#define MSFC_HBAFCPInfoGuid \ - { 0x7a1fc391,0x5b23,0x4c19, { 0xb0,0xeb,0xb1,0xae,0xf5,0x90,0x50,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_HBAFCPInfo_GUID, \ - 0x7a1fc391,0x5b23,0x4c19,0xb0,0xeb,0xb1,0xae,0xf5,0x90,0x50,0xc3); -#endif - -// -// Method id definitions for MSFC_HBAFCPInfo -#define GetFcpTargetMapping 1 -typedef struct _GetFcpTargetMapping_IN -{ - // - UCHAR HbaPortWWN[8]; - #define GetFcpTargetMapping_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define GetFcpTargetMapping_IN_HbaPortWWN_ID 1 - - // - ULONG InEntryCount; - #define GetFcpTargetMapping_IN_InEntryCount_SIZE sizeof(ULONG) - #define GetFcpTargetMapping_IN_InEntryCount_ID 2 - -} GetFcpTargetMapping_IN, *PGetFcpTargetMapping_IN; - -#define GetFcpTargetMapping_IN_SIZE (FIELD_OFFSET(GetFcpTargetMapping_IN, InEntryCount) + GetFcpTargetMapping_IN_InEntryCount_SIZE) - -typedef struct _GetFcpTargetMapping_OUT -{ - // - ULONG HBAStatus; - #define GetFcpTargetMapping_OUT_HBAStatus_SIZE sizeof(ULONG) - #define GetFcpTargetMapping_OUT_HBAStatus_ID 3 - - // - ULONG TotalEntryCount; - #define GetFcpTargetMapping_OUT_TotalEntryCount_SIZE sizeof(ULONG) - #define GetFcpTargetMapping_OUT_TotalEntryCount_ID 4 - - // - ULONG OutEntryCount; - #define GetFcpTargetMapping_OUT_OutEntryCount_SIZE sizeof(ULONG) - #define GetFcpTargetMapping_OUT_OutEntryCount_ID 5 - - // - HBAFCPScsiEntry Entry[1]; - #define GetFcpTargetMapping_OUT_Entry_ID 6 - -} GetFcpTargetMapping_OUT, *PGetFcpTargetMapping_OUT; - -#define GetFcpPersistentBinding 2 -typedef struct _GetFcpPersistentBinding_IN -{ - // - ULONG InEntryCount; - #define GetFcpPersistentBinding_IN_InEntryCount_SIZE sizeof(ULONG) - #define GetFcpPersistentBinding_IN_InEntryCount_ID 1 - -} GetFcpPersistentBinding_IN, *PGetFcpPersistentBinding_IN; - -#define GetFcpPersistentBinding_IN_SIZE (FIELD_OFFSET(GetFcpPersistentBinding_IN, InEntryCount) + GetFcpPersistentBinding_IN_InEntryCount_SIZE) - -typedef struct _GetFcpPersistentBinding_OUT -{ - // - ULONG HBAStatus; - #define GetFcpPersistentBinding_OUT_HBAStatus_SIZE sizeof(ULONG) - #define GetFcpPersistentBinding_OUT_HBAStatus_ID 2 - - // - ULONG TotalEntryCount; - #define GetFcpPersistentBinding_OUT_TotalEntryCount_SIZE sizeof(ULONG) - #define GetFcpPersistentBinding_OUT_TotalEntryCount_ID 3 - - // - ULONG OutEntryCount; - #define GetFcpPersistentBinding_OUT_OutEntryCount_SIZE sizeof(ULONG) - #define GetFcpPersistentBinding_OUT_OutEntryCount_ID 4 - - // - HBAFCPBindingEntry Entry[1]; - #define GetFcpPersistentBinding_OUT_Entry_ID 5 - -} GetFcpPersistentBinding_OUT, *PGetFcpPersistentBinding_OUT; - -#define GetBindingCapability 3 -typedef struct _GetBindingCapability_IN -{ - // - UCHAR PortWWN[8]; - #define GetBindingCapability_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define GetBindingCapability_IN_PortWWN_ID 1 - -} GetBindingCapability_IN, *PGetBindingCapability_IN; - -#define GetBindingCapability_IN_SIZE (FIELD_OFFSET(GetBindingCapability_IN, PortWWN) + GetBindingCapability_IN_PortWWN_SIZE) - -typedef struct _GetBindingCapability_OUT -{ - // - ULONG HBAStatus; - #define GetBindingCapability_OUT_HBAStatus_SIZE sizeof(ULONG) - #define GetBindingCapability_OUT_HBAStatus_ID 2 - - // - ULONG BindType; - #define GetBindingCapability_OUT_BindType_SIZE sizeof(ULONG) - #define GetBindingCapability_OUT_BindType_ID 3 - -} GetBindingCapability_OUT, *PGetBindingCapability_OUT; - -#define GetBindingCapability_OUT_SIZE (FIELD_OFFSET(GetBindingCapability_OUT, BindType) + GetBindingCapability_OUT_BindType_SIZE) - -#define GetBindingSupport 4 -typedef struct _GetBindingSupport_IN -{ - // - UCHAR PortWWN[8]; - #define GetBindingSupport_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define GetBindingSupport_IN_PortWWN_ID 1 - -} GetBindingSupport_IN, *PGetBindingSupport_IN; - -#define GetBindingSupport_IN_SIZE (FIELD_OFFSET(GetBindingSupport_IN, PortWWN) + GetBindingSupport_IN_PortWWN_SIZE) - -typedef struct _GetBindingSupport_OUT -{ - // - ULONG HBAStatus; - #define GetBindingSupport_OUT_HBAStatus_SIZE sizeof(ULONG) - #define GetBindingSupport_OUT_HBAStatus_ID 2 - - // - ULONG BindType; - #define GetBindingSupport_OUT_BindType_SIZE sizeof(ULONG) - #define GetBindingSupport_OUT_BindType_ID 3 - -} GetBindingSupport_OUT, *PGetBindingSupport_OUT; - -#define GetBindingSupport_OUT_SIZE (FIELD_OFFSET(GetBindingSupport_OUT, BindType) + GetBindingSupport_OUT_BindType_SIZE) - -#define SetBindingSupport 5 -typedef struct _SetBindingSupport_IN -{ - // - UCHAR PortWWN[8]; - #define SetBindingSupport_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define SetBindingSupport_IN_PortWWN_ID 1 - - // - ULONG BindType; - #define SetBindingSupport_IN_BindType_SIZE sizeof(ULONG) - #define SetBindingSupport_IN_BindType_ID 2 - -} SetBindingSupport_IN, *PSetBindingSupport_IN; - -#define SetBindingSupport_IN_SIZE (FIELD_OFFSET(SetBindingSupport_IN, BindType) + SetBindingSupport_IN_BindType_SIZE) - -typedef struct _SetBindingSupport_OUT -{ - // - ULONG HBAStatus; - #define SetBindingSupport_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SetBindingSupport_OUT_HBAStatus_ID 3 - -} SetBindingSupport_OUT, *PSetBindingSupport_OUT; - -#define SetBindingSupport_OUT_SIZE (FIELD_OFFSET(SetBindingSupport_OUT, HBAStatus) + SetBindingSupport_OUT_HBAStatus_SIZE) - -#define GetPersistentBinding2 6 -typedef struct _GetPersistentBinding2_IN -{ - // - UCHAR PortWWN[8]; - #define GetPersistentBinding2_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define GetPersistentBinding2_IN_PortWWN_ID 1 - - // - ULONG InEntryCount; - #define GetPersistentBinding2_IN_InEntryCount_SIZE sizeof(ULONG) - #define GetPersistentBinding2_IN_InEntryCount_ID 2 - -} GetPersistentBinding2_IN, *PGetPersistentBinding2_IN; - -#define GetPersistentBinding2_IN_SIZE (FIELD_OFFSET(GetPersistentBinding2_IN, InEntryCount) + GetPersistentBinding2_IN_InEntryCount_SIZE) - -typedef struct _GetPersistentBinding2_OUT -{ - // - ULONG HBAStatus; - #define GetPersistentBinding2_OUT_HBAStatus_SIZE sizeof(ULONG) - #define GetPersistentBinding2_OUT_HBAStatus_ID 3 - - // - ULONG TotalEntryCount; - #define GetPersistentBinding2_OUT_TotalEntryCount_SIZE sizeof(ULONG) - #define GetPersistentBinding2_OUT_TotalEntryCount_ID 4 - - // - ULONG OutEntryCount; - #define GetPersistentBinding2_OUT_OutEntryCount_SIZE sizeof(ULONG) - #define GetPersistentBinding2_OUT_OutEntryCount_ID 5 - - // - HBAFCPBindingEntry2 Bindings[1]; - #define GetPersistentBinding2_OUT_Bindings_ID 6 - -} GetPersistentBinding2_OUT, *PGetPersistentBinding2_OUT; - - - -//********************************************************************* -// -// A call to HBA_SetPersistentBindingV2 will call SetPersistentEntry -// once for each binding entry. -// Each binding entry that SetPersistentEntry accepts will be stored -// in the registry. -// -// Persistent bindings are stored in the registry under: -// -// System\CurrentControlSet\Control\Storage\FC\ -// -// under the REG_BINARY key Bindings is the struct: -// -// typedef struct { -// ULONG Version; -// HBA_FCPBINDING2 Bindings; -// } HBAP_PERSISTENT_BINDINGS, *PHBAP_PERSISTENT_BINDINGS; -// -// This is done so that storport capable drivers may have access to -// this information during boot -// -//******************************************************************** - -#define HBA_REGISTRY_BINDING_VERSION (1) -#define HBA_REGISTRY_BINDING_RELATIVE_PATH L"System\\CurrentControlSet\\Control\\Storage\\FC" -#define HBA_REGISTRY_BINDING_KEY L"Bindings" - - -#define SetPersistentEntry 7 -typedef struct _SetPersistentEntry_IN -{ - // - UCHAR PortWWN[8]; - #define SetPersistentEntry_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define SetPersistentEntry_IN_PortWWN_ID 1 - - // - HBAFCPBindingEntry2 Binding; - #define SetPersistentEntry_IN_Binding_SIZE sizeof(HBAFCPBindingEntry2) - #define SetPersistentEntry_IN_Binding_ID 2 - -} SetPersistentEntry_IN, *PSetPersistentEntry_IN; - -#define SetPersistentEntry_IN_SIZE (FIELD_OFFSET(SetPersistentEntry_IN, Binding) + SetPersistentEntry_IN_Binding_SIZE) - -typedef struct _SetPersistentEntry_OUT -{ - // - ULONG HBAStatus; - #define SetPersistentEntry_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SetPersistentEntry_OUT_HBAStatus_ID 3 - -} SetPersistentEntry_OUT, *PSetPersistentEntry_OUT; - -#define SetPersistentEntry_OUT_SIZE (FIELD_OFFSET(SetPersistentEntry_OUT, HBAStatus) + SetPersistentEntry_OUT_HBAStatus_SIZE) - -#define RemovePersistentEntry 8 -typedef struct _RemovePersistentEntry_IN -{ - // - UCHAR PortWWN[8]; - #define RemovePersistentEntry_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define RemovePersistentEntry_IN_PortWWN_ID 1 - - // - HBAFCPBindingEntry2 Binding; - #define RemovePersistentEntry_IN_Binding_SIZE sizeof(HBAFCPBindingEntry2) - #define RemovePersistentEntry_IN_Binding_ID 2 - -} RemovePersistentEntry_IN, *PRemovePersistentEntry_IN; - -#define RemovePersistentEntry_IN_SIZE (FIELD_OFFSET(RemovePersistentEntry_IN, Binding) + RemovePersistentEntry_IN_Binding_SIZE) - -typedef struct _RemovePersistentEntry_OUT -{ - // - ULONG HBAStatus; - #define RemovePersistentEntry_OUT_HBAStatus_SIZE sizeof(ULONG) - #define RemovePersistentEntry_OUT_HBAStatus_ID 3 - -} RemovePersistentEntry_OUT, *PRemovePersistentEntry_OUT; - -#define RemovePersistentEntry_OUT_SIZE (FIELD_OFFSET(RemovePersistentEntry_OUT, HBAStatus) + RemovePersistentEntry_OUT_HBAStatus_SIZE) - - -// MSFC_AdapterEvent - MSFC_AdapterEvent -#define MSFC_AdapterEventGuid \ - { 0xe9e47403,0xd1d7,0x43f8, { 0x8e,0xe3,0x53,0xcd,0xbf,0xff,0x56,0x46 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_AdapterEvent_GUID, \ - 0xe9e47403,0xd1d7,0x43f8,0x8e,0xe3,0x53,0xcd,0xbf,0xff,0x56,0x46); -#endif - - -typedef struct _MSFC_AdapterEvent -{ - // - ULONG EventType; - #define MSFC_AdapterEvent_EventType_SIZE sizeof(ULONG) - #define MSFC_AdapterEvent_EventType_ID 1 - - // - UCHAR PortWWN[8]; - #define MSFC_AdapterEvent_PortWWN_SIZE sizeof(UCHAR[8]) - #define MSFC_AdapterEvent_PortWWN_ID 2 - -} MSFC_AdapterEvent, *PMSFC_AdapterEvent; - -#define MSFC_AdapterEvent_SIZE (FIELD_OFFSET(MSFC_AdapterEvent, PortWWN) + MSFC_AdapterEvent_PortWWN_SIZE) - -// MSFC_PortEvent - MSFC_PortEvent -#define MSFC_PortEventGuid \ - { 0x095fbe97,0x3876,0x48ef, { 0x8a,0x04,0x1c,0x55,0x93,0x5d,0x0d,0xf5 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_PortEvent_GUID, \ - 0x095fbe97,0x3876,0x48ef,0x8a,0x04,0x1c,0x55,0x93,0x5d,0x0d,0xf5); -#endif - - -typedef struct _MSFC_PortEvent -{ - // - ULONG EventType; - #define MSFC_PortEvent_EventType_SIZE sizeof(ULONG) - #define MSFC_PortEvent_EventType_ID 1 - - // - ULONG FabricPortId; - #define MSFC_PortEvent_FabricPortId_SIZE sizeof(ULONG) - #define MSFC_PortEvent_FabricPortId_ID 2 - - // - UCHAR PortWWN[8]; - #define MSFC_PortEvent_PortWWN_SIZE sizeof(UCHAR[8]) - #define MSFC_PortEvent_PortWWN_ID 3 - -} MSFC_PortEvent, *PMSFC_PortEvent; - -#define MSFC_PortEvent_SIZE (FIELD_OFFSET(MSFC_PortEvent, PortWWN) + MSFC_PortEvent_PortWWN_SIZE) - -// MSFC_TargetEvent - MSFC_TargetEvent -#define MSFC_TargetEventGuid \ - { 0xcfa6ef26,0x8675,0x4e27, { 0x9a,0x0b,0xb4,0xa8,0x60,0xdd,0xd0,0xf3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_TargetEvent_GUID, \ - 0xcfa6ef26,0x8675,0x4e27,0x9a,0x0b,0xb4,0xa8,0x60,0xdd,0xd0,0xf3); -#endif - - -typedef struct _MSFC_TargetEvent -{ - // - ULONG EventType; - #define MSFC_TargetEvent_EventType_SIZE sizeof(ULONG) - #define MSFC_TargetEvent_EventType_ID 1 - - // - UCHAR PortWWN[8]; - #define MSFC_TargetEvent_PortWWN_SIZE sizeof(UCHAR[8]) - #define MSFC_TargetEvent_PortWWN_ID 2 - - // - UCHAR DiscoveredPortWWN[8]; - #define MSFC_TargetEvent_DiscoveredPortWWN_SIZE sizeof(UCHAR[8]) - #define MSFC_TargetEvent_DiscoveredPortWWN_ID 3 - -} MSFC_TargetEvent, *PMSFC_TargetEvent; - -#define MSFC_TargetEvent_SIZE (FIELD_OFFSET(MSFC_TargetEvent, DiscoveredPortWWN) + MSFC_TargetEvent_DiscoveredPortWWN_SIZE) - -// MSFC_EventControl - MSFC_EventControl -#define MSFC_EventControlGuid \ - { 0xa251ccb3,0x5ab0,0x411b, { 0x87,0x71,0x54,0x30,0xef,0x53,0xa2,0x6c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_EventControl_GUID, \ - 0xa251ccb3,0x5ab0,0x411b,0x87,0x71,0x54,0x30,0xef,0x53,0xa2,0x6c); -#endif - -// -// Method id definitions for MSFC_EventControl -#define AddTarget 10 -typedef struct _AddTarget_IN -{ - // - UCHAR HbaPortWWN[8]; - #define AddTarget_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define AddTarget_IN_HbaPortWWN_ID 1 - - // - UCHAR DiscoveredPortWWN[8]; - #define AddTarget_IN_DiscoveredPortWWN_SIZE sizeof(UCHAR[8]) - #define AddTarget_IN_DiscoveredPortWWN_ID 2 - - // - ULONG AllTargets; - #define AddTarget_IN_AllTargets_SIZE sizeof(ULONG) - #define AddTarget_IN_AllTargets_ID 3 - -} AddTarget_IN, *PAddTarget_IN; - -#define AddTarget_IN_SIZE (FIELD_OFFSET(AddTarget_IN, AllTargets) + AddTarget_IN_AllTargets_SIZE) - -typedef struct _AddTarget_OUT -{ - // - ULONG HBAStatus; - #define AddTarget_OUT_HBAStatus_SIZE sizeof(ULONG) - #define AddTarget_OUT_HBAStatus_ID 4 - -} AddTarget_OUT, *PAddTarget_OUT; - -#define AddTarget_OUT_SIZE (FIELD_OFFSET(AddTarget_OUT, HBAStatus) + AddTarget_OUT_HBAStatus_SIZE) - -#define RemoveTarget 11 -typedef struct _RemoveTarget_IN -{ - // - UCHAR HbaPortWWN[8]; - #define RemoveTarget_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define RemoveTarget_IN_HbaPortWWN_ID 1 - - // - UCHAR DiscoveredPortWWN[8]; - #define RemoveTarget_IN_DiscoveredPortWWN_SIZE sizeof(UCHAR[8]) - #define RemoveTarget_IN_DiscoveredPortWWN_ID 2 - - // - ULONG AllTargets; - #define RemoveTarget_IN_AllTargets_SIZE sizeof(ULONG) - #define RemoveTarget_IN_AllTargets_ID 3 - -} RemoveTarget_IN, *PRemoveTarget_IN; - -#define RemoveTarget_IN_SIZE (FIELD_OFFSET(RemoveTarget_IN, AllTargets) + RemoveTarget_IN_AllTargets_SIZE) - -typedef struct _RemoveTarget_OUT -{ - // - ULONG HBAStatus; - #define RemoveTarget_OUT_HBAStatus_SIZE sizeof(ULONG) - #define RemoveTarget_OUT_HBAStatus_ID 4 - -} RemoveTarget_OUT, *PRemoveTarget_OUT; - -#define RemoveTarget_OUT_SIZE (FIELD_OFFSET(RemoveTarget_OUT, HBAStatus) + RemoveTarget_OUT_HBAStatus_SIZE) - -#define AddPort 20 -typedef struct _AddPort_IN -{ - // - UCHAR PortWWN[8]; - #define AddPort_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define AddPort_IN_PortWWN_ID 1 - -} AddPort_IN, *PAddPort_IN; - -#define AddPort_IN_SIZE (FIELD_OFFSET(AddPort_IN, PortWWN) + AddPort_IN_PortWWN_SIZE) - -typedef struct _AddPort_OUT -{ - // - ULONG HBAStatus; - #define AddPort_OUT_HBAStatus_SIZE sizeof(ULONG) - #define AddPort_OUT_HBAStatus_ID 2 - -} AddPort_OUT, *PAddPort_OUT; - -#define AddPort_OUT_SIZE (FIELD_OFFSET(AddPort_OUT, HBAStatus) + AddPort_OUT_HBAStatus_SIZE) - -#define RemovePort 21 -typedef struct _RemovePort_IN -{ - // - UCHAR PortWWN[8]; - #define RemovePort_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define RemovePort_IN_PortWWN_ID 1 - -} RemovePort_IN, *PRemovePort_IN; - -#define RemovePort_IN_SIZE (FIELD_OFFSET(RemovePort_IN, PortWWN) + RemovePort_IN_PortWWN_SIZE) - -typedef struct _RemovePort_OUT -{ - // - ULONG HBAStatus; - #define RemovePort_OUT_HBAStatus_SIZE sizeof(ULONG) - #define RemovePort_OUT_HBAStatus_ID 2 - -} RemovePort_OUT, *PRemovePort_OUT; - -#define RemovePort_OUT_SIZE (FIELD_OFFSET(RemovePort_OUT, HBAStatus) + RemovePort_OUT_HBAStatus_SIZE) - -#define AddLink 30 -typedef struct _AddLink_OUT -{ - // - ULONG HBAStatus; - #define AddLink_OUT_HBAStatus_SIZE sizeof(ULONG) - #define AddLink_OUT_HBAStatus_ID 1 - -} AddLink_OUT, *PAddLink_OUT; - -#define AddLink_OUT_SIZE (FIELD_OFFSET(AddLink_OUT, HBAStatus) + AddLink_OUT_HBAStatus_SIZE) - -#define RemoveLink 31 -typedef struct _RemoveLink_OUT -{ - // - ULONG HBAStatus; - #define RemoveLink_OUT_HBAStatus_SIZE sizeof(ULONG) - #define RemoveLink_OUT_HBAStatus_ID 1 - -} RemoveLink_OUT, *PRemoveLink_OUT; - -#define RemoveLink_OUT_SIZE (FIELD_OFFSET(RemoveLink_OUT, HBAStatus) + RemoveLink_OUT_HBAStatus_SIZE) - - -// MS_SM_AdapterInformationQuery - MS_SM_AdapterInformationQuery - - -#endif // MSFC_HBA_API - -#ifdef MS_SM_HBA_API - -#define MS_SM_AdapterInformationQueryGuid \ - { 0xbdc67efa,0xe5e7,0x4777, { 0xb1,0x3c,0x62,0x14,0x59,0x65,0x70,0x99 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SM_AdapterInformationQuery_GUID, \ - 0xbdc67efa,0xe5e7,0x4777,0xb1,0x3c,0x62,0x14,0x59,0x65,0x70,0x99); -#endif - - -typedef struct _MS_SM_AdapterInformationQuery -{ - // - ULONGLONG UniqueAdapterId; - #define MS_SM_AdapterInformationQuery_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MS_SM_AdapterInformationQuery_UniqueAdapterId_ID 1 - - // - ULONG HBAStatus; - #define MS_SM_AdapterInformationQuery_HBAStatus_SIZE sizeof(ULONG) - #define MS_SM_AdapterInformationQuery_HBAStatus_ID 2 - - // - ULONG NumberOfPorts; - #define MS_SM_AdapterInformationQuery_NumberOfPorts_SIZE sizeof(ULONG) - #define MS_SM_AdapterInformationQuery_NumberOfPorts_ID 3 - - // - ULONG VendorSpecificID; - #define MS_SM_AdapterInformationQuery_VendorSpecificID_SIZE sizeof(ULONG) - #define MS_SM_AdapterInformationQuery_VendorSpecificID_ID 4 - - - - //****************************************************************** - // - // The string type is variable length (up to MaxLen). - // Each string starts with a ushort that holds the strings length - // (in bytes) followed by the WCHARs that make up the string. - // - //****************************************************************** - - - // - WCHAR Manufacturer[64 + 1]; - #define MS_SM_AdapterInformationQuery_Manufacturer_ID 5 - - // - WCHAR SerialNumber[64 + 1]; - #define MS_SM_AdapterInformationQuery_SerialNumber_ID 6 - - // - WCHAR Model[256 + 1]; - #define MS_SM_AdapterInformationQuery_Model_ID 7 - - // - WCHAR ModelDescription[256 + 1]; - #define MS_SM_AdapterInformationQuery_ModelDescription_ID 8 - - // - WCHAR HardwareVersion[256 + 1]; - #define MS_SM_AdapterInformationQuery_HardwareVersion_ID 9 - - // - WCHAR DriverVersion[256 + 1]; - #define MS_SM_AdapterInformationQuery_DriverVersion_ID 10 - - // - WCHAR OptionROMVersion[256 + 1]; - #define MS_SM_AdapterInformationQuery_OptionROMVersion_ID 11 - - // - WCHAR FirmwareVersion[256 + 1]; - #define MS_SM_AdapterInformationQuery_FirmwareVersion_ID 12 - - // - WCHAR DriverName[256 + 1]; - #define MS_SM_AdapterInformationQuery_DriverName_ID 13 - - // - WCHAR HBASymbolicName[256 + 1]; - #define MS_SM_AdapterInformationQuery_HBASymbolicName_ID 14 - - // - WCHAR RedundantOptionROMVersion[256 + 1]; - #define MS_SM_AdapterInformationQuery_RedundantOptionROMVersion_ID 15 - - // - WCHAR RedundantFirmwareVersion[256 + 1]; - #define MS_SM_AdapterInformationQuery_RedundantFirmwareVersion_ID 16 - - // - WCHAR MfgDomain[256 + 1]; - #define MS_SM_AdapterInformationQuery_MfgDomain_ID 17 - -} MS_SM_AdapterInformationQuery, *PMS_SM_AdapterInformationQuery; - -// MS_SMHBA_FC_Port - MS_SMHBA_FC_Port -#define MS_SMHBA_FC_PortGuid \ - { 0x96b827a7,0x2b4a,0x49c8, { 0x90,0x97,0x07,0x82,0x00,0xc5,0xa5,0xcd } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SMHBA_FC_Port_GUID, \ - 0x96b827a7,0x2b4a,0x49c8,0x90,0x97,0x07,0x82,0x00,0xc5,0xa5,0xcd); -#endif - - -typedef struct _MS_SMHBA_FC_Port -{ - // - UCHAR NodeWWN[8]; - #define MS_SMHBA_FC_Port_NodeWWN_SIZE sizeof(UCHAR[8]) - #define MS_SMHBA_FC_Port_NodeWWN_ID 1 - - // - UCHAR PortWWN[8]; - #define MS_SMHBA_FC_Port_PortWWN_SIZE sizeof(UCHAR[8]) - #define MS_SMHBA_FC_Port_PortWWN_ID 2 - - // - ULONG FcId; - #define MS_SMHBA_FC_Port_FcId_SIZE sizeof(ULONG) - #define MS_SMHBA_FC_Port_FcId_ID 3 - - // - ULONG PortSupportedClassofService; - #define MS_SMHBA_FC_Port_PortSupportedClassofService_SIZE sizeof(ULONG) - #define MS_SMHBA_FC_Port_PortSupportedClassofService_ID 4 - - // - UCHAR PortSupportedFc4Types[32]; - #define MS_SMHBA_FC_Port_PortSupportedFc4Types_SIZE sizeof(UCHAR[32]) - #define MS_SMHBA_FC_Port_PortSupportedFc4Types_ID 5 - - // - UCHAR PortActiveFc4Types[32]; - #define MS_SMHBA_FC_Port_PortActiveFc4Types_SIZE sizeof(UCHAR[32]) - #define MS_SMHBA_FC_Port_PortActiveFc4Types_ID 6 - - // - UCHAR FabricName[8]; - #define MS_SMHBA_FC_Port_FabricName_SIZE sizeof(UCHAR[8]) - #define MS_SMHBA_FC_Port_FabricName_ID 7 - - // - ULONG NumberofDiscoveredPorts; - #define MS_SMHBA_FC_Port_NumberofDiscoveredPorts_SIZE sizeof(ULONG) - #define MS_SMHBA_FC_Port_NumberofDiscoveredPorts_ID 8 - - // - UCHAR NumberofPhys; - #define MS_SMHBA_FC_Port_NumberofPhys_SIZE sizeof(UCHAR) - #define MS_SMHBA_FC_Port_NumberofPhys_ID 9 - - // - WCHAR PortSymbolicName[256 + 1]; - #define MS_SMHBA_FC_Port_PortSymbolicName_ID 10 - -} MS_SMHBA_FC_Port, *PMS_SMHBA_FC_Port; - -// MS_SMHBA_SAS_Port - MS_SMHBA_SAS_Port -#define MS_SMHBA_SAS_PortGuid \ - { 0xb914e34f,0x7b80,0x46b0, { 0x80,0x34,0x6d,0x9b,0x68,0x9e,0x1d,0xdd } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SMHBA_SAS_Port_GUID, \ - 0xb914e34f,0x7b80,0x46b0,0x80,0x34,0x6d,0x9b,0x68,0x9e,0x1d,0xdd); -#endif - - -typedef struct _MS_SMHBA_SAS_Port -{ - // - ULONG PortProtocol; - #define MS_SMHBA_SAS_Port_PortProtocol_SIZE sizeof(ULONG) - #define MS_SMHBA_SAS_Port_PortProtocol_ID 1 - - // - UCHAR LocalSASAddress[8]; - #define MS_SMHBA_SAS_Port_LocalSASAddress_SIZE sizeof(UCHAR[8]) - #define MS_SMHBA_SAS_Port_LocalSASAddress_ID 2 - - // - UCHAR AttachedSASAddress[8]; - #define MS_SMHBA_SAS_Port_AttachedSASAddress_SIZE sizeof(UCHAR[8]) - #define MS_SMHBA_SAS_Port_AttachedSASAddress_ID 3 - - // - ULONG NumberofDiscoveredPorts; - #define MS_SMHBA_SAS_Port_NumberofDiscoveredPorts_SIZE sizeof(ULONG) - #define MS_SMHBA_SAS_Port_NumberofDiscoveredPorts_ID 4 - - // - ULONG NumberofPhys; - #define MS_SMHBA_SAS_Port_NumberofPhys_SIZE sizeof(ULONG) - #define MS_SMHBA_SAS_Port_NumberofPhys_ID 5 - -} MS_SMHBA_SAS_Port, *PMS_SMHBA_SAS_Port; - -#define MS_SMHBA_SAS_Port_SIZE (FIELD_OFFSET(MS_SMHBA_SAS_Port, NumberofPhys) + MS_SMHBA_SAS_Port_NumberofPhys_SIZE) - -// MS_SMHBA_PORTATTRIBUTES - MS_SMHBA_PORTATTRIBUTES -#define MS_SMHBA_PORTATTRIBUTESGuid \ - { 0x50a97b2d,0x99ad,0x4cf9, { 0x84,0x37,0xb4,0xea,0x0c,0x07,0xbe,0x4c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SMHBA_PORTATTRIBUTES_GUID, \ - 0x50a97b2d,0x99ad,0x4cf9,0x84,0x37,0xb4,0xea,0x0c,0x07,0xbe,0x4c); -#endif - - -typedef struct _MS_SMHBA_PORTATTRIBUTES -{ - // - ULONG PortType; - #define MS_SMHBA_PORTATTRIBUTES_PortType_SIZE sizeof(ULONG) - #define MS_SMHBA_PORTATTRIBUTES_PortType_ID 1 - - // - ULONG PortState; - #define MS_SMHBA_PORTATTRIBUTES_PortState_SIZE sizeof(ULONG) - #define MS_SMHBA_PORTATTRIBUTES_PortState_ID 2 - - // - ULONG PortSpecificAttributesSize; - #define MS_SMHBA_PORTATTRIBUTES_PortSpecificAttributesSize_SIZE sizeof(ULONG) - #define MS_SMHBA_PORTATTRIBUTES_PortSpecificAttributesSize_ID 3 - - // - WCHAR OSDeviceName[256 + 1]; - #define MS_SMHBA_PORTATTRIBUTES_OSDeviceName_ID 4 - - // - ULONGLONG Reserved; - #define MS_SMHBA_PORTATTRIBUTES_Reserved_SIZE sizeof(ULONGLONG) - #define MS_SMHBA_PORTATTRIBUTES_Reserved_ID 5 - - // - UCHAR PortSpecificAttributes[1]; - #define MS_SMHBA_PORTATTRIBUTES_PortSpecificAttributes_ID 6 - -} MS_SMHBA_PORTATTRIBUTES, *PMS_SMHBA_PORTATTRIBUTES; - -// MS_SMHBA_PROTOCOLSTATISTICS - MS_SMHBA_PROTOCOLSTATISTICS -#define MS_SMHBA_PROTOCOLSTATISTICSGuid \ - { 0xb557bd86,0x4128,0x4d5c, { 0xb6,0xe6,0xb6,0x5f,0x9b,0xd6,0x87,0x22 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SMHBA_PROTOCOLSTATISTICS_GUID, \ - 0xb557bd86,0x4128,0x4d5c,0xb6,0xe6,0xb6,0x5f,0x9b,0xd6,0x87,0x22); -#endif - - -typedef struct _MS_SMHBA_PROTOCOLSTATISTICS -{ - // - LONGLONG SecondsSinceLastReset; - #define MS_SMHBA_PROTOCOLSTATISTICS_SecondsSinceLastReset_SIZE sizeof(LONGLONG) - #define MS_SMHBA_PROTOCOLSTATISTICS_SecondsSinceLastReset_ID 1 - - // - LONGLONG InputRequests; - #define MS_SMHBA_PROTOCOLSTATISTICS_InputRequests_SIZE sizeof(LONGLONG) - #define MS_SMHBA_PROTOCOLSTATISTICS_InputRequests_ID 2 - - // - LONGLONG OutputRequests; - #define MS_SMHBA_PROTOCOLSTATISTICS_OutputRequests_SIZE sizeof(LONGLONG) - #define MS_SMHBA_PROTOCOLSTATISTICS_OutputRequests_ID 3 - - // - LONGLONG ControlRequests; - #define MS_SMHBA_PROTOCOLSTATISTICS_ControlRequests_SIZE sizeof(LONGLONG) - #define MS_SMHBA_PROTOCOLSTATISTICS_ControlRequests_ID 4 - - // - LONGLONG InputMegabytes; - #define MS_SMHBA_PROTOCOLSTATISTICS_InputMegabytes_SIZE sizeof(LONGLONG) - #define MS_SMHBA_PROTOCOLSTATISTICS_InputMegabytes_ID 5 - - // - LONGLONG OutputMegabytes; - #define MS_SMHBA_PROTOCOLSTATISTICS_OutputMegabytes_SIZE sizeof(LONGLONG) - #define MS_SMHBA_PROTOCOLSTATISTICS_OutputMegabytes_ID 6 - -} MS_SMHBA_PROTOCOLSTATISTICS, *PMS_SMHBA_PROTOCOLSTATISTICS; - -#define MS_SMHBA_PROTOCOLSTATISTICS_SIZE (FIELD_OFFSET(MS_SMHBA_PROTOCOLSTATISTICS, OutputMegabytes) + MS_SMHBA_PROTOCOLSTATISTICS_OutputMegabytes_SIZE) - -// MS_SMHBA_SASPHYSTATISTICS - MS_SMHBA_SASPHYSTATISTICS -#define MS_SMHBA_SASPHYSTATISTICSGuid \ - { 0xbd458e7d,0xc40a,0x4401, { 0xa1,0x79,0x11,0x91,0x9c,0xbc,0xc5,0xc6 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SMHBA_SASPHYSTATISTICS_GUID, \ - 0xbd458e7d,0xc40a,0x4401,0xa1,0x79,0x11,0x91,0x9c,0xbc,0xc5,0xc6); -#endif - - -typedef struct _MS_SMHBA_SASPHYSTATISTICS -{ - // - LONGLONG SecondsSinceLastReset; - #define MS_SMHBA_SASPHYSTATISTICS_SecondsSinceLastReset_SIZE sizeof(LONGLONG) - #define MS_SMHBA_SASPHYSTATISTICS_SecondsSinceLastReset_ID 1 - - // - LONGLONG TxFrames; - #define MS_SMHBA_SASPHYSTATISTICS_TxFrames_SIZE sizeof(LONGLONG) - #define MS_SMHBA_SASPHYSTATISTICS_TxFrames_ID 2 - - // - LONGLONG TxWords; - #define MS_SMHBA_SASPHYSTATISTICS_TxWords_SIZE sizeof(LONGLONG) - #define MS_SMHBA_SASPHYSTATISTICS_TxWords_ID 3 - - // - LONGLONG RxFrames; - #define MS_SMHBA_SASPHYSTATISTICS_RxFrames_SIZE sizeof(LONGLONG) - #define MS_SMHBA_SASPHYSTATISTICS_RxFrames_ID 4 - - // - LONGLONG RxWords; - #define MS_SMHBA_SASPHYSTATISTICS_RxWords_SIZE sizeof(LONGLONG) - #define MS_SMHBA_SASPHYSTATISTICS_RxWords_ID 5 - - // - LONGLONG InvalidDwordCount; - #define MS_SMHBA_SASPHYSTATISTICS_InvalidDwordCount_SIZE sizeof(LONGLONG) - #define MS_SMHBA_SASPHYSTATISTICS_InvalidDwordCount_ID 6 - - // - LONGLONG RunningDisparityErrorCount; - #define MS_SMHBA_SASPHYSTATISTICS_RunningDisparityErrorCount_SIZE sizeof(LONGLONG) - #define MS_SMHBA_SASPHYSTATISTICS_RunningDisparityErrorCount_ID 7 - - // - LONGLONG LossofDwordSyncCount; - #define MS_SMHBA_SASPHYSTATISTICS_LossofDwordSyncCount_SIZE sizeof(LONGLONG) - #define MS_SMHBA_SASPHYSTATISTICS_LossofDwordSyncCount_ID 8 - - // - LONGLONG PhyResetProblemCount; - #define MS_SMHBA_SASPHYSTATISTICS_PhyResetProblemCount_SIZE sizeof(LONGLONG) - #define MS_SMHBA_SASPHYSTATISTICS_PhyResetProblemCount_ID 9 - -} MS_SMHBA_SASPHYSTATISTICS, *PMS_SMHBA_SASPHYSTATISTICS; - -#define MS_SMHBA_SASPHYSTATISTICS_SIZE (FIELD_OFFSET(MS_SMHBA_SASPHYSTATISTICS, PhyResetProblemCount) + MS_SMHBA_SASPHYSTATISTICS_PhyResetProblemCount_SIZE) - -// MS_SMHBA_FC_PHY - MS_SMHBA_FC_PHY -#define MS_SMHBA_FC_PHYGuid \ - { 0xfb66c8fe,0x1da0,0x48a2, { 0x92,0xdb,0x02,0xc3,0x41,0x14,0x3c,0x46 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SMHBA_FC_PHY_GUID, \ - 0xfb66c8fe,0x1da0,0x48a2,0x92,0xdb,0x02,0xc3,0x41,0x14,0x3c,0x46); -#endif - - -typedef struct _MS_SMHBA_FC_PHY -{ - // - ULONG PhySupportSpeed; - #define MS_SMHBA_FC_PHY_PhySupportSpeed_SIZE sizeof(ULONG) - #define MS_SMHBA_FC_PHY_PhySupportSpeed_ID 1 - - // - ULONG PhySpeed; - #define MS_SMHBA_FC_PHY_PhySpeed_SIZE sizeof(ULONG) - #define MS_SMHBA_FC_PHY_PhySpeed_ID 2 - - // - UCHAR PhyType; - #define MS_SMHBA_FC_PHY_PhyType_SIZE sizeof(UCHAR) - #define MS_SMHBA_FC_PHY_PhyType_ID 3 - - // - ULONG MaxFrameSize; - #define MS_SMHBA_FC_PHY_MaxFrameSize_SIZE sizeof(ULONG) - #define MS_SMHBA_FC_PHY_MaxFrameSize_ID 4 - -} MS_SMHBA_FC_PHY, *PMS_SMHBA_FC_PHY; - -#define MS_SMHBA_FC_PHY_SIZE (FIELD_OFFSET(MS_SMHBA_FC_PHY, MaxFrameSize) + MS_SMHBA_FC_PHY_MaxFrameSize_SIZE) - -// MS_SMHBA_SAS_PHY - MS_SMHBA_SAS_PHY -#define MS_SMHBA_SAS_PHYGuid \ - { 0xdde0a090,0x96bc,0x452b, { 0x9a,0x64,0x6f,0xbb,0x6a,0x19,0xc4,0x7d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SMHBA_SAS_PHY_GUID, \ - 0xdde0a090,0x96bc,0x452b,0x9a,0x64,0x6f,0xbb,0x6a,0x19,0xc4,0x7d); -#endif - - -typedef struct _MS_SMHBA_SAS_PHY -{ - // - UCHAR PhyIdentifier; - #define MS_SMHBA_SAS_PHY_PhyIdentifier_SIZE sizeof(UCHAR) - #define MS_SMHBA_SAS_PHY_PhyIdentifier_ID 1 - - // - ULONG NegotiatedLinkRate; - #define MS_SMHBA_SAS_PHY_NegotiatedLinkRate_SIZE sizeof(ULONG) - #define MS_SMHBA_SAS_PHY_NegotiatedLinkRate_ID 2 - - // - ULONG ProgrammedMinLinkRate; - #define MS_SMHBA_SAS_PHY_ProgrammedMinLinkRate_SIZE sizeof(ULONG) - #define MS_SMHBA_SAS_PHY_ProgrammedMinLinkRate_ID 3 - - // - ULONG HardwareMinLinkRate; - #define MS_SMHBA_SAS_PHY_HardwareMinLinkRate_SIZE sizeof(ULONG) - #define MS_SMHBA_SAS_PHY_HardwareMinLinkRate_ID 4 - - // - ULONG ProgrammedMaxLinkRate; - #define MS_SMHBA_SAS_PHY_ProgrammedMaxLinkRate_SIZE sizeof(ULONG) - #define MS_SMHBA_SAS_PHY_ProgrammedMaxLinkRate_ID 5 - - // - ULONG HardwareMaxLinkRate; - #define MS_SMHBA_SAS_PHY_HardwareMaxLinkRate_SIZE sizeof(ULONG) - #define MS_SMHBA_SAS_PHY_HardwareMaxLinkRate_ID 6 - - // - UCHAR domainPortWWN[8]; - #define MS_SMHBA_SAS_PHY_domainPortWWN_SIZE sizeof(UCHAR[8]) - #define MS_SMHBA_SAS_PHY_domainPortWWN_ID 7 - -} MS_SMHBA_SAS_PHY, *PMS_SMHBA_SAS_PHY; - -#define MS_SMHBA_SAS_PHY_SIZE (FIELD_OFFSET(MS_SMHBA_SAS_PHY, domainPortWWN) + MS_SMHBA_SAS_PHY_domainPortWWN_SIZE) - -// MS_SM_PortInformationMethods - MS_SM_PortInformationMethods -#define MS_SM_PortInformationMethodsGuid \ - { 0x5b6a8b86,0x708d,0x4ec6, { 0x82,0xa6,0x39,0xad,0xcf,0x6f,0x64,0x33 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SM_PortInformationMethods_GUID, \ - 0x5b6a8b86,0x708d,0x4ec6,0x82,0xa6,0x39,0xad,0xcf,0x6f,0x64,0x33); -#endif - -// -// Method id definitions for MS_SM_PortInformationMethods -#define SM_GetPortType 1 -typedef struct _SM_GetPortType_IN -{ - // - ULONG PortIndex; - #define SM_GetPortType_IN_PortIndex_SIZE sizeof(ULONG) - #define SM_GetPortType_IN_PortIndex_ID 1 - -} SM_GetPortType_IN, *PSM_GetPortType_IN; - -#define SM_GetPortType_IN_SIZE (FIELD_OFFSET(SM_GetPortType_IN, PortIndex) + SM_GetPortType_IN_PortIndex_SIZE) - -typedef struct _SM_GetPortType_OUT -{ - // - ULONG HBAStatus; - #define SM_GetPortType_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetPortType_OUT_HBAStatus_ID 2 - - // - ULONG PortType; - #define SM_GetPortType_OUT_PortType_SIZE sizeof(ULONG) - #define SM_GetPortType_OUT_PortType_ID 3 - -} SM_GetPortType_OUT, *PSM_GetPortType_OUT; - -#define SM_GetPortType_OUT_SIZE (FIELD_OFFSET(SM_GetPortType_OUT, PortType) + SM_GetPortType_OUT_PortType_SIZE) - -#define SM_GetAdapterPortAttributes 2 -typedef struct _SM_GetAdapterPortAttributes_IN -{ - // - ULONG PortIndex; - #define SM_GetAdapterPortAttributes_IN_PortIndex_SIZE sizeof(ULONG) - #define SM_GetAdapterPortAttributes_IN_PortIndex_ID 1 - - -#define SM_PORT_SPECIFIC_ATTRIBUTES_MAXSIZE max(sizeof(MS_SMHBA_FC_Port), sizeof(MS_SMHBA_SAS_Port)) - // - ULONG PortSpecificAttributesMaxSize; - #define SM_GetAdapterPortAttributes_IN_PortSpecificAttributesMaxSize_SIZE sizeof(ULONG) - #define SM_GetAdapterPortAttributes_IN_PortSpecificAttributesMaxSize_ID 2 - -} SM_GetAdapterPortAttributes_IN, *PSM_GetAdapterPortAttributes_IN; - -#define SM_GetAdapterPortAttributes_IN_SIZE (FIELD_OFFSET(SM_GetAdapterPortAttributes_IN, PortSpecificAttributesMaxSize) + SM_GetAdapterPortAttributes_IN_PortSpecificAttributesMaxSize_SIZE) - -typedef struct _SM_GetAdapterPortAttributes_OUT -{ - // - ULONG HBAStatus; - #define SM_GetAdapterPortAttributes_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetAdapterPortAttributes_OUT_HBAStatus_ID 3 - - // - MS_SMHBA_PORTATTRIBUTES PortAttributes; - #define SM_GetAdapterPortAttributes_OUT_PortAttributes_SIZE sizeof(MS_SMHBA_PORTATTRIBUTES) - #define SM_GetAdapterPortAttributes_OUT_PortAttributes_ID 4 - -} SM_GetAdapterPortAttributes_OUT, *PSM_GetAdapterPortAttributes_OUT; - -#define SM_GetAdapterPortAttributes_OUT_SIZE (FIELD_OFFSET(SM_GetAdapterPortAttributes_OUT, PortAttributes) + SM_GetAdapterPortAttributes_OUT_PortAttributes_SIZE) - -#define SM_GetDiscoveredPortAttributes 3 -typedef struct _SM_GetDiscoveredPortAttributes_IN -{ - // - ULONG PortIndex; - #define SM_GetDiscoveredPortAttributes_IN_PortIndex_SIZE sizeof(ULONG) - #define SM_GetDiscoveredPortAttributes_IN_PortIndex_ID 1 - - // - ULONG DiscoveredPortIndex; - #define SM_GetDiscoveredPortAttributes_IN_DiscoveredPortIndex_SIZE sizeof(ULONG) - #define SM_GetDiscoveredPortAttributes_IN_DiscoveredPortIndex_ID 2 - - // - ULONG PortSpecificAttributesMaxSize; - #define SM_GetDiscoveredPortAttributes_IN_PortSpecificAttributesMaxSize_SIZE sizeof(ULONG) - #define SM_GetDiscoveredPortAttributes_IN_PortSpecificAttributesMaxSize_ID 3 - -} SM_GetDiscoveredPortAttributes_IN, *PSM_GetDiscoveredPortAttributes_IN; - -#define SM_GetDiscoveredPortAttributes_IN_SIZE (FIELD_OFFSET(SM_GetDiscoveredPortAttributes_IN, PortSpecificAttributesMaxSize) + SM_GetDiscoveredPortAttributes_IN_PortSpecificAttributesMaxSize_SIZE) - -typedef struct _SM_GetDiscoveredPortAttributes_OUT -{ - // - ULONG HBAStatus; - #define SM_GetDiscoveredPortAttributes_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetDiscoveredPortAttributes_OUT_HBAStatus_ID 4 - - // - MS_SMHBA_PORTATTRIBUTES PortAttributes; - #define SM_GetDiscoveredPortAttributes_OUT_PortAttributes_SIZE sizeof(MS_SMHBA_PORTATTRIBUTES) - #define SM_GetDiscoveredPortAttributes_OUT_PortAttributes_ID 5 - -} SM_GetDiscoveredPortAttributes_OUT, *PSM_GetDiscoveredPortAttributes_OUT; - -#define SM_GetDiscoveredPortAttributes_OUT_SIZE (FIELD_OFFSET(SM_GetDiscoveredPortAttributes_OUT, PortAttributes) + SM_GetDiscoveredPortAttributes_OUT_PortAttributes_SIZE) - -#define SM_GetPortAttributesByWWN 4 -typedef struct _SM_GetPortAttributesByWWN_IN -{ - // - UCHAR PortWWN[8]; - #define SM_GetPortAttributesByWWN_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define SM_GetPortAttributesByWWN_IN_PortWWN_ID 1 - - // - UCHAR DomainPortWWN[8]; - #define SM_GetPortAttributesByWWN_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_GetPortAttributesByWWN_IN_DomainPortWWN_ID 2 - - // - ULONG PortSpecificAttributesMaxSize; - #define SM_GetPortAttributesByWWN_IN_PortSpecificAttributesMaxSize_SIZE sizeof(ULONG) - #define SM_GetPortAttributesByWWN_IN_PortSpecificAttributesMaxSize_ID 3 - -} SM_GetPortAttributesByWWN_IN, *PSM_GetPortAttributesByWWN_IN; - -#define SM_GetPortAttributesByWWN_IN_SIZE (FIELD_OFFSET(SM_GetPortAttributesByWWN_IN, PortSpecificAttributesMaxSize) + SM_GetPortAttributesByWWN_IN_PortSpecificAttributesMaxSize_SIZE) - -typedef struct _SM_GetPortAttributesByWWN_OUT -{ - // - ULONG HBAStatus; - #define SM_GetPortAttributesByWWN_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetPortAttributesByWWN_OUT_HBAStatus_ID 4 - - // - MS_SMHBA_PORTATTRIBUTES PortAttributes; - #define SM_GetPortAttributesByWWN_OUT_PortAttributes_SIZE sizeof(MS_SMHBA_PORTATTRIBUTES) - #define SM_GetPortAttributesByWWN_OUT_PortAttributes_ID 5 - -} SM_GetPortAttributesByWWN_OUT, *PSM_GetPortAttributesByWWN_OUT; - -#define SM_GetPortAttributesByWWN_OUT_SIZE (FIELD_OFFSET(SM_GetPortAttributesByWWN_OUT, PortAttributes) + SM_GetPortAttributesByWWN_OUT_PortAttributes_SIZE) - -#define SM_GetProtocolStatistics 5 -typedef struct _SM_GetProtocolStatistics_IN -{ - // - ULONG PortIndex; - #define SM_GetProtocolStatistics_IN_PortIndex_SIZE sizeof(ULONG) - #define SM_GetProtocolStatistics_IN_PortIndex_ID 1 - - // - ULONG ProtocolType; - #define SM_GetProtocolStatistics_IN_ProtocolType_SIZE sizeof(ULONG) - #define SM_GetProtocolStatistics_IN_ProtocolType_ID 2 - -} SM_GetProtocolStatistics_IN, *PSM_GetProtocolStatistics_IN; - -#define SM_GetProtocolStatistics_IN_SIZE (FIELD_OFFSET(SM_GetProtocolStatistics_IN, ProtocolType) + SM_GetProtocolStatistics_IN_ProtocolType_SIZE) - -typedef struct _SM_GetProtocolStatistics_OUT -{ - // - ULONG HBAStatus; - #define SM_GetProtocolStatistics_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetProtocolStatistics_OUT_HBAStatus_ID 3 - - // - MS_SMHBA_PROTOCOLSTATISTICS ProtocolStatistics; - #define SM_GetProtocolStatistics_OUT_ProtocolStatistics_SIZE sizeof(MS_SMHBA_PROTOCOLSTATISTICS) - #define SM_GetProtocolStatistics_OUT_ProtocolStatistics_ID 4 - -} SM_GetProtocolStatistics_OUT, *PSM_GetProtocolStatistics_OUT; - -#define SM_GetProtocolStatistics_OUT_SIZE (FIELD_OFFSET(SM_GetProtocolStatistics_OUT, ProtocolStatistics) + SM_GetProtocolStatistics_OUT_ProtocolStatistics_SIZE) - -#define SM_GetPhyStatistics 6 -typedef struct _SM_GetPhyStatistics_IN -{ - // - ULONG PortIndex; - #define SM_GetPhyStatistics_IN_PortIndex_SIZE sizeof(ULONG) - #define SM_GetPhyStatistics_IN_PortIndex_ID 1 - - // - ULONG PhyIndex; - #define SM_GetPhyStatistics_IN_PhyIndex_SIZE sizeof(ULONG) - #define SM_GetPhyStatistics_IN_PhyIndex_ID 2 - - // - ULONG InNumOfPhyCounters; - #define SM_GetPhyStatistics_IN_InNumOfPhyCounters_SIZE sizeof(ULONG) - #define SM_GetPhyStatistics_IN_InNumOfPhyCounters_ID 3 - -} SM_GetPhyStatistics_IN, *PSM_GetPhyStatistics_IN; - -#define SM_GetPhyStatistics_IN_SIZE (FIELD_OFFSET(SM_GetPhyStatistics_IN, InNumOfPhyCounters) + SM_GetPhyStatistics_IN_InNumOfPhyCounters_SIZE) - -typedef struct _SM_GetPhyStatistics_OUT -{ - // - ULONG HBAStatus; - #define SM_GetPhyStatistics_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetPhyStatistics_OUT_HBAStatus_ID 4 - - // - ULONG TotalNumOfPhyCounters; - #define SM_GetPhyStatistics_OUT_TotalNumOfPhyCounters_SIZE sizeof(ULONG) - #define SM_GetPhyStatistics_OUT_TotalNumOfPhyCounters_ID 5 - - // - ULONG OutNumOfPhyCounters; - #define SM_GetPhyStatistics_OUT_OutNumOfPhyCounters_SIZE sizeof(ULONG) - #define SM_GetPhyStatistics_OUT_OutNumOfPhyCounters_ID 6 - - // - LONGLONG PhyCounter[1]; - #define SM_GetPhyStatistics_OUT_PhyCounter_ID 7 - -} SM_GetPhyStatistics_OUT, *PSM_GetPhyStatistics_OUT; - -#define SM_GetFCPhyAttributes 7 -typedef struct _SM_GetFCPhyAttributes_IN -{ - // - ULONG PortIndex; - #define SM_GetFCPhyAttributes_IN_PortIndex_SIZE sizeof(ULONG) - #define SM_GetFCPhyAttributes_IN_PortIndex_ID 1 - - // - ULONG PhyIndex; - #define SM_GetFCPhyAttributes_IN_PhyIndex_SIZE sizeof(ULONG) - #define SM_GetFCPhyAttributes_IN_PhyIndex_ID 2 - -} SM_GetFCPhyAttributes_IN, *PSM_GetFCPhyAttributes_IN; - -#define SM_GetFCPhyAttributes_IN_SIZE (FIELD_OFFSET(SM_GetFCPhyAttributes_IN, PhyIndex) + SM_GetFCPhyAttributes_IN_PhyIndex_SIZE) - -typedef struct _SM_GetFCPhyAttributes_OUT -{ - // - ULONG HBAStatus; - #define SM_GetFCPhyAttributes_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetFCPhyAttributes_OUT_HBAStatus_ID 3 - - // - MS_SMHBA_FC_PHY PhyType; - #define SM_GetFCPhyAttributes_OUT_PhyType_SIZE sizeof(MS_SMHBA_FC_PHY) - #define SM_GetFCPhyAttributes_OUT_PhyType_ID 4 - -} SM_GetFCPhyAttributes_OUT, *PSM_GetFCPhyAttributes_OUT; - -#define SM_GetFCPhyAttributes_OUT_SIZE (FIELD_OFFSET(SM_GetFCPhyAttributes_OUT, PhyType) + SM_GetFCPhyAttributes_OUT_PhyType_SIZE) - -#define SM_GetSASPhyAttributes 8 -typedef struct _SM_GetSASPhyAttributes_IN -{ - // - ULONG PortIndex; - #define SM_GetSASPhyAttributes_IN_PortIndex_SIZE sizeof(ULONG) - #define SM_GetSASPhyAttributes_IN_PortIndex_ID 1 - - // - ULONG PhyIndex; - #define SM_GetSASPhyAttributes_IN_PhyIndex_SIZE sizeof(ULONG) - #define SM_GetSASPhyAttributes_IN_PhyIndex_ID 2 - -} SM_GetSASPhyAttributes_IN, *PSM_GetSASPhyAttributes_IN; - -#define SM_GetSASPhyAttributes_IN_SIZE (FIELD_OFFSET(SM_GetSASPhyAttributes_IN, PhyIndex) + SM_GetSASPhyAttributes_IN_PhyIndex_SIZE) - -typedef struct _SM_GetSASPhyAttributes_OUT -{ - // - ULONG HBAStatus; - #define SM_GetSASPhyAttributes_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetSASPhyAttributes_OUT_HBAStatus_ID 3 - - // - MS_SMHBA_SAS_PHY PhyType; - #define SM_GetSASPhyAttributes_OUT_PhyType_SIZE sizeof(MS_SMHBA_SAS_PHY) - #define SM_GetSASPhyAttributes_OUT_PhyType_ID 4 - -} SM_GetSASPhyAttributes_OUT, *PSM_GetSASPhyAttributes_OUT; - -#define SM_GetSASPhyAttributes_OUT_SIZE (FIELD_OFFSET(SM_GetSASPhyAttributes_OUT, PhyType) + SM_GetSASPhyAttributes_OUT_PhyType_SIZE) - -#define SM_RefreshInformation 10 - -// MS_SMHBA_PORTLUN - MS_SMHBA_PORTLUN -#define MS_SMHBA_PORTLUNGuid \ - { 0x0669d100,0x066e,0x4e49, { 0xa6,0x8c,0xe0,0x51,0x99,0x59,0x61,0x32 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SMHBA_PORTLUN_GUID, \ - 0x0669d100,0x066e,0x4e49,0xa6,0x8c,0xe0,0x51,0x99,0x59,0x61,0x32); -#endif - - -typedef struct _MS_SMHBA_PORTLUN -{ - // - UCHAR PortWWN[8]; - #define MS_SMHBA_PORTLUN_PortWWN_SIZE sizeof(UCHAR[8]) - #define MS_SMHBA_PORTLUN_PortWWN_ID 1 - - // - UCHAR domainPortWWN[8]; - #define MS_SMHBA_PORTLUN_domainPortWWN_SIZE sizeof(UCHAR[8]) - #define MS_SMHBA_PORTLUN_domainPortWWN_ID 2 - - // - ULONGLONG TargetLun; - #define MS_SMHBA_PORTLUN_TargetLun_SIZE sizeof(ULONGLONG) - #define MS_SMHBA_PORTLUN_TargetLun_ID 3 - -} MS_SMHBA_PORTLUN, *PMS_SMHBA_PORTLUN; - -#define MS_SMHBA_PORTLUN_SIZE (FIELD_OFFSET(MS_SMHBA_PORTLUN, TargetLun) + MS_SMHBA_PORTLUN_TargetLun_SIZE) - -// MS_SMHBA_SCSIENTRY - MS_SMHBA_SCSIENTRY -#define MS_SMHBA_SCSIENTRYGuid \ - { 0x125d41bc,0x7643,0x4155, { 0xb8,0x1c,0xe2,0xf1,0x28,0xad,0x1f,0xb4 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SMHBA_SCSIENTRY_GUID, \ - 0x125d41bc,0x7643,0x4155,0xb8,0x1c,0xe2,0xf1,0x28,0xad,0x1f,0xb4); -#endif - - -typedef struct _MS_SMHBA_SCSIENTRY -{ - // - MS_SMHBA_PORTLUN PortLun; - #define MS_SMHBA_SCSIENTRY_PortLun_SIZE sizeof(MS_SMHBA_PORTLUN) - #define MS_SMHBA_SCSIENTRY_PortLun_ID 1 - - // - UCHAR LUID[256]; - #define MS_SMHBA_SCSIENTRY_LUID_SIZE sizeof(UCHAR[256]) - #define MS_SMHBA_SCSIENTRY_LUID_ID 2 - - // - HBAScsiID ScsiId; - #define MS_SMHBA_SCSIENTRY_ScsiId_SIZE sizeof(HBAScsiID) - #define MS_SMHBA_SCSIENTRY_ScsiId_ID 3 - -} MS_SMHBA_SCSIENTRY, *PMS_SMHBA_SCSIENTRY; - -#define MS_SMHBA_SCSIENTRY_SIZE (FIELD_OFFSET(MS_SMHBA_SCSIENTRY, ScsiId) + MS_SMHBA_SCSIENTRY_ScsiId_SIZE) - -// MS_SMHBA_BINDINGENTRY - MS_SMHBA_BINDINGENTRY -#define MS_SMHBA_BINDINGENTRYGuid \ - { 0x65bfb548,0xd00a,0x4d4c, { 0xa3,0x57,0x7d,0xaa,0x23,0xbc,0x2e,0x3d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SMHBA_BINDINGENTRY_GUID, \ - 0x65bfb548,0xd00a,0x4d4c,0xa3,0x57,0x7d,0xaa,0x23,0xbc,0x2e,0x3d); -#endif - - -typedef struct _MS_SMHBA_BINDINGENTRY -{ - // - ULONG type; - #define MS_SMHBA_BINDINGENTRY_type_SIZE sizeof(ULONG) - #define MS_SMHBA_BINDINGENTRY_type_ID 1 - - // - MS_SMHBA_PORTLUN PortLun; - #define MS_SMHBA_BINDINGENTRY_PortLun_SIZE sizeof(MS_SMHBA_PORTLUN) - #define MS_SMHBA_BINDINGENTRY_PortLun_ID 2 - - // - UCHAR LUID[256]; - #define MS_SMHBA_BINDINGENTRY_LUID_SIZE sizeof(UCHAR[256]) - #define MS_SMHBA_BINDINGENTRY_LUID_ID 3 - - // - ULONG Status; - #define MS_SMHBA_BINDINGENTRY_Status_SIZE sizeof(ULONG) - #define MS_SMHBA_BINDINGENTRY_Status_ID 4 - - // - HBAScsiID ScsiId; - #define MS_SMHBA_BINDINGENTRY_ScsiId_SIZE sizeof(HBAScsiID) - #define MS_SMHBA_BINDINGENTRY_ScsiId_ID 5 - -} MS_SMHBA_BINDINGENTRY, *PMS_SMHBA_BINDINGENTRY; - -#define MS_SMHBA_BINDINGENTRY_SIZE (FIELD_OFFSET(MS_SMHBA_BINDINGENTRY, ScsiId) + MS_SMHBA_BINDINGENTRY_ScsiId_SIZE) - -// MS_SM_TargetInformationMethods - MS_SM_TargetInformationMethods -#define MS_SM_TargetInformationMethodsGuid \ - { 0x93545055,0xab4c,0x4e80, { 0x84,0xae,0x6a,0x86,0xa2,0xdc,0x4b,0x84 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SM_TargetInformationMethods_GUID, \ - 0x93545055,0xab4c,0x4e80,0x84,0xae,0x6a,0x86,0xa2,0xdc,0x4b,0x84); -#endif - -// -// Method id definitions for MS_SM_TargetInformationMethods -#define SM_GetTargetMapping 1 -typedef struct _SM_GetTargetMapping_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_GetTargetMapping_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_GetTargetMapping_IN_HbaPortWWN_ID 1 - - // - UCHAR DomainPortWWN[8]; - #define SM_GetTargetMapping_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_GetTargetMapping_IN_DomainPortWWN_ID 2 - - // - ULONG InEntryCount; - #define SM_GetTargetMapping_IN_InEntryCount_SIZE sizeof(ULONG) - #define SM_GetTargetMapping_IN_InEntryCount_ID 3 - -} SM_GetTargetMapping_IN, *PSM_GetTargetMapping_IN; - -#define SM_GetTargetMapping_IN_SIZE (FIELD_OFFSET(SM_GetTargetMapping_IN, InEntryCount) + SM_GetTargetMapping_IN_InEntryCount_SIZE) - -typedef struct _SM_GetTargetMapping_OUT -{ - // - ULONG HBAStatus; - #define SM_GetTargetMapping_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetTargetMapping_OUT_HBAStatus_ID 4 - - // - ULONG TotalEntryCount; - #define SM_GetTargetMapping_OUT_TotalEntryCount_SIZE sizeof(ULONG) - #define SM_GetTargetMapping_OUT_TotalEntryCount_ID 5 - - // - ULONG OutEntryCount; - #define SM_GetTargetMapping_OUT_OutEntryCount_SIZE sizeof(ULONG) - #define SM_GetTargetMapping_OUT_OutEntryCount_ID 6 - - // - MS_SMHBA_SCSIENTRY Entry[1]; - #define SM_GetTargetMapping_OUT_Entry_ID 7 - -} SM_GetTargetMapping_OUT, *PSM_GetTargetMapping_OUT; - -#define SM_GetBindingCapability 2 -typedef struct _SM_GetBindingCapability_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_GetBindingCapability_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_GetBindingCapability_IN_HbaPortWWN_ID 1 - - // - UCHAR DomainPortWWN[8]; - #define SM_GetBindingCapability_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_GetBindingCapability_IN_DomainPortWWN_ID 2 - -} SM_GetBindingCapability_IN, *PSM_GetBindingCapability_IN; - -#define SM_GetBindingCapability_IN_SIZE (FIELD_OFFSET(SM_GetBindingCapability_IN, DomainPortWWN) + SM_GetBindingCapability_IN_DomainPortWWN_SIZE) - -typedef struct _SM_GetBindingCapability_OUT -{ - // - ULONG HBAStatus; - #define SM_GetBindingCapability_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetBindingCapability_OUT_HBAStatus_ID 3 - - // - ULONG Flags; - #define SM_GetBindingCapability_OUT_Flags_SIZE sizeof(ULONG) - #define SM_GetBindingCapability_OUT_Flags_ID 4 - -} SM_GetBindingCapability_OUT, *PSM_GetBindingCapability_OUT; - -#define SM_GetBindingCapability_OUT_SIZE (FIELD_OFFSET(SM_GetBindingCapability_OUT, Flags) + SM_GetBindingCapability_OUT_Flags_SIZE) - -#define SM_GetBindingSupport 3 -typedef struct _SM_GetBindingSupport_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_GetBindingSupport_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_GetBindingSupport_IN_HbaPortWWN_ID 1 - - // - UCHAR DomainPortWWN[8]; - #define SM_GetBindingSupport_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_GetBindingSupport_IN_DomainPortWWN_ID 2 - -} SM_GetBindingSupport_IN, *PSM_GetBindingSupport_IN; - -#define SM_GetBindingSupport_IN_SIZE (FIELD_OFFSET(SM_GetBindingSupport_IN, DomainPortWWN) + SM_GetBindingSupport_IN_DomainPortWWN_SIZE) - -typedef struct _SM_GetBindingSupport_OUT -{ - // - ULONG HBAStatus; - #define SM_GetBindingSupport_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetBindingSupport_OUT_HBAStatus_ID 3 - - // - ULONG Flags; - #define SM_GetBindingSupport_OUT_Flags_SIZE sizeof(ULONG) - #define SM_GetBindingSupport_OUT_Flags_ID 4 - -} SM_GetBindingSupport_OUT, *PSM_GetBindingSupport_OUT; - -#define SM_GetBindingSupport_OUT_SIZE (FIELD_OFFSET(SM_GetBindingSupport_OUT, Flags) + SM_GetBindingSupport_OUT_Flags_SIZE) - -#define SM_SetBindingSupport 4 -typedef struct _SM_SetBindingSupport_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_SetBindingSupport_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SetBindingSupport_IN_HbaPortWWN_ID 1 - - // - UCHAR DomainPortWWN[8]; - #define SM_SetBindingSupport_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SetBindingSupport_IN_DomainPortWWN_ID 2 - - // - ULONG Flags; - #define SM_SetBindingSupport_IN_Flags_SIZE sizeof(ULONG) - #define SM_SetBindingSupport_IN_Flags_ID 3 - -} SM_SetBindingSupport_IN, *PSM_SetBindingSupport_IN; - -#define SM_SetBindingSupport_IN_SIZE (FIELD_OFFSET(SM_SetBindingSupport_IN, Flags) + SM_SetBindingSupport_IN_Flags_SIZE) - -typedef struct _SM_SetBindingSupport_OUT -{ - // - ULONG HBAStatus; - #define SM_SetBindingSupport_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SetBindingSupport_OUT_HBAStatus_ID 4 - -} SM_SetBindingSupport_OUT, *PSM_SetBindingSupport_OUT; - -#define SM_SetBindingSupport_OUT_SIZE (FIELD_OFFSET(SM_SetBindingSupport_OUT, HBAStatus) + SM_SetBindingSupport_OUT_HBAStatus_SIZE) - -#define SM_GetPersistentBinding 5 -typedef struct _SM_GetPersistentBinding_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_GetPersistentBinding_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_GetPersistentBinding_IN_HbaPortWWN_ID 1 - - // - UCHAR DomainPortWWN[8]; - #define SM_GetPersistentBinding_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_GetPersistentBinding_IN_DomainPortWWN_ID 2 - - // - ULONG InEntryCount; - #define SM_GetPersistentBinding_IN_InEntryCount_SIZE sizeof(ULONG) - #define SM_GetPersistentBinding_IN_InEntryCount_ID 3 - -} SM_GetPersistentBinding_IN, *PSM_GetPersistentBinding_IN; - -#define SM_GetPersistentBinding_IN_SIZE (FIELD_OFFSET(SM_GetPersistentBinding_IN, InEntryCount) + SM_GetPersistentBinding_IN_InEntryCount_SIZE) - -typedef struct _SM_GetPersistentBinding_OUT -{ - // - ULONG HBAStatus; - #define SM_GetPersistentBinding_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetPersistentBinding_OUT_HBAStatus_ID 4 - - // - ULONG TotalEntryCount; - #define SM_GetPersistentBinding_OUT_TotalEntryCount_SIZE sizeof(ULONG) - #define SM_GetPersistentBinding_OUT_TotalEntryCount_ID 5 - - // - ULONG OutEntryCount; - #define SM_GetPersistentBinding_OUT_OutEntryCount_SIZE sizeof(ULONG) - #define SM_GetPersistentBinding_OUT_OutEntryCount_ID 6 - - // - MS_SMHBA_BINDINGENTRY Entry[1]; - #define SM_GetPersistentBinding_OUT_Entry_ID 7 - -} SM_GetPersistentBinding_OUT, *PSM_GetPersistentBinding_OUT; - -#define SM_SetPersistentBinding 6 -typedef struct _SM_SetPersistentBinding_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_SetPersistentBinding_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SetPersistentBinding_IN_HbaPortWWN_ID 1 - - // - UCHAR DomainPortWWN[8]; - #define SM_SetPersistentBinding_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SetPersistentBinding_IN_DomainPortWWN_ID 2 - - // - ULONG InEntryCount; - #define SM_SetPersistentBinding_IN_InEntryCount_SIZE sizeof(ULONG) - #define SM_SetPersistentBinding_IN_InEntryCount_ID 3 - - // - MS_SMHBA_BINDINGENTRY Entry[1]; - #define SM_SetPersistentBinding_IN_Entry_ID 4 - -} SM_SetPersistentBinding_IN, *PSM_SetPersistentBinding_IN; - -typedef struct _SM_SetPersistentBinding_OUT -{ - // - ULONG HBAStatus; - #define SM_SetPersistentBinding_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SetPersistentBinding_OUT_HBAStatus_ID 5 - - // - ULONG OutStatusCount; - #define SM_SetPersistentBinding_OUT_OutStatusCount_SIZE sizeof(ULONG) - #define SM_SetPersistentBinding_OUT_OutStatusCount_ID 6 - - // - ULONG EntryStatus[1]; - #define SM_SetPersistentBinding_OUT_EntryStatus_ID 7 - -} SM_SetPersistentBinding_OUT, *PSM_SetPersistentBinding_OUT; - -#define SM_RemovePersistentBinding 7 -typedef struct _SM_RemovePersistentBinding_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_RemovePersistentBinding_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_RemovePersistentBinding_IN_HbaPortWWN_ID 1 - - // - UCHAR DomainPortWWN[8]; - #define SM_RemovePersistentBinding_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_RemovePersistentBinding_IN_DomainPortWWN_ID 2 - - // - ULONG EntryCount; - #define SM_RemovePersistentBinding_IN_EntryCount_SIZE sizeof(ULONG) - #define SM_RemovePersistentBinding_IN_EntryCount_ID 3 - - // - MS_SMHBA_BINDINGENTRY Entry[1]; - #define SM_RemovePersistentBinding_IN_Entry_ID 4 - -} SM_RemovePersistentBinding_IN, *PSM_RemovePersistentBinding_IN; - -typedef struct _SM_RemovePersistentBinding_OUT -{ - // - ULONG HBAStatus; - #define SM_RemovePersistentBinding_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_RemovePersistentBinding_OUT_HBAStatus_ID 5 - -} SM_RemovePersistentBinding_OUT, *PSM_RemovePersistentBinding_OUT; - -#define SM_RemovePersistentBinding_OUT_SIZE (FIELD_OFFSET(SM_RemovePersistentBinding_OUT, HBAStatus) + SM_RemovePersistentBinding_OUT_HBAStatus_SIZE) - -#define SM_GetLUNStatistics 8 -typedef struct _SM_GetLUNStatistics_IN -{ - // - HBAScsiID Lunit; - #define SM_GetLUNStatistics_IN_Lunit_SIZE sizeof(HBAScsiID) - #define SM_GetLUNStatistics_IN_Lunit_ID 1 - -} SM_GetLUNStatistics_IN, *PSM_GetLUNStatistics_IN; - -#define SM_GetLUNStatistics_IN_SIZE (FIELD_OFFSET(SM_GetLUNStatistics_IN, Lunit) + SM_GetLUNStatistics_IN_Lunit_SIZE) - -typedef struct _SM_GetLUNStatistics_OUT -{ - // - ULONG HBAStatus; - #define SM_GetLUNStatistics_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetLUNStatistics_OUT_HBAStatus_ID 2 - - // - MS_SMHBA_PROTOCOLSTATISTICS ProtocolStatistics; - #define SM_GetLUNStatistics_OUT_ProtocolStatistics_SIZE sizeof(MS_SMHBA_PROTOCOLSTATISTICS) - #define SM_GetLUNStatistics_OUT_ProtocolStatistics_ID 3 - -} SM_GetLUNStatistics_OUT, *PSM_GetLUNStatistics_OUT; - -#define SM_GetLUNStatistics_OUT_SIZE (FIELD_OFFSET(SM_GetLUNStatistics_OUT, ProtocolStatistics) + SM_GetLUNStatistics_OUT_ProtocolStatistics_SIZE) - - -// MS_SM_ScsiInformationMethods - MS_SM_ScsiInformationMethods -#define MS_SM_ScsiInformationMethodsGuid \ - { 0xb6661e6f,0x075e,0x4209, { 0xae,0x20,0xfe,0x81,0xdb,0x03,0xd9,0x79 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SM_ScsiInformationMethods_GUID, \ - 0xb6661e6f,0x075e,0x4209,0xae,0x20,0xfe,0x81,0xdb,0x03,0xd9,0x79); -#endif - -// -// Method id definitions for MS_SM_ScsiInformationMethods -#define SM_ScsiInquiry 1 -typedef struct _SM_ScsiInquiry_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_ScsiInquiry_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_ScsiInquiry_IN_HbaPortWWN_ID 1 - - // - UCHAR DiscoveredPortWWN[8]; - #define SM_ScsiInquiry_IN_DiscoveredPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_ScsiInquiry_IN_DiscoveredPortWWN_ID 2 - - // - UCHAR DomainPortWWN[8]; - #define SM_ScsiInquiry_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_ScsiInquiry_IN_DomainPortWWN_ID 3 - - // - ULONGLONG SmhbaLUN; - #define SM_ScsiInquiry_IN_SmhbaLUN_SIZE sizeof(ULONGLONG) - #define SM_ScsiInquiry_IN_SmhbaLUN_ID 4 - - // - UCHAR Cdb[6]; - #define SM_ScsiInquiry_IN_Cdb_SIZE sizeof(UCHAR[6]) - #define SM_ScsiInquiry_IN_Cdb_ID 5 - - // - ULONG InRespBufferMaxSize; - #define SM_ScsiInquiry_IN_InRespBufferMaxSize_SIZE sizeof(ULONG) - #define SM_ScsiInquiry_IN_InRespBufferMaxSize_ID 6 - - // - ULONG InSenseBufferMaxSize; - #define SM_ScsiInquiry_IN_InSenseBufferMaxSize_SIZE sizeof(ULONG) - #define SM_ScsiInquiry_IN_InSenseBufferMaxSize_ID 7 - -} SM_ScsiInquiry_IN, *PSM_ScsiInquiry_IN; - -#define SM_ScsiInquiry_IN_SIZE (FIELD_OFFSET(SM_ScsiInquiry_IN, InSenseBufferMaxSize) + SM_ScsiInquiry_IN_InSenseBufferMaxSize_SIZE) - -typedef struct _SM_ScsiInquiry_OUT -{ - // - ULONG HBAStatus; - #define SM_ScsiInquiry_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_ScsiInquiry_OUT_HBAStatus_ID 8 - - // - UCHAR ScsiStatus; - #define SM_ScsiInquiry_OUT_ScsiStatus_SIZE sizeof(UCHAR) - #define SM_ScsiInquiry_OUT_ScsiStatus_ID 9 - - // - ULONG OutRespBufferSize; - #define SM_ScsiInquiry_OUT_OutRespBufferSize_SIZE sizeof(ULONG) - #define SM_ScsiInquiry_OUT_OutRespBufferSize_ID 10 - - // - ULONG OutSenseBufferSize; - #define SM_ScsiInquiry_OUT_OutSenseBufferSize_SIZE sizeof(ULONG) - #define SM_ScsiInquiry_OUT_OutSenseBufferSize_ID 11 - - // - UCHAR RespBuffer[1]; - #define SM_ScsiInquiry_OUT_RespBuffer_ID 12 - - // -// UCHAR SenseBuffer[1]; - #define SM_ScsiInquiry_OUT_SenseBuffer_ID 13 - -} SM_ScsiInquiry_OUT, *PSM_ScsiInquiry_OUT; - -#define SM_ScsiReportLuns 2 -typedef struct _SM_ScsiReportLuns_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_ScsiReportLuns_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_ScsiReportLuns_IN_HbaPortWWN_ID 1 - - // - UCHAR DiscoveredPortWWN[8]; - #define SM_ScsiReportLuns_IN_DiscoveredPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_ScsiReportLuns_IN_DiscoveredPortWWN_ID 2 - - // - UCHAR DomainPortWWN[8]; - #define SM_ScsiReportLuns_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_ScsiReportLuns_IN_DomainPortWWN_ID 3 - - // - UCHAR Cdb[12]; - #define SM_ScsiReportLuns_IN_Cdb_SIZE sizeof(UCHAR[12]) - #define SM_ScsiReportLuns_IN_Cdb_ID 4 - - // - ULONG InRespBufferMaxSize; - #define SM_ScsiReportLuns_IN_InRespBufferMaxSize_SIZE sizeof(ULONG) - #define SM_ScsiReportLuns_IN_InRespBufferMaxSize_ID 5 - - // - ULONG InSenseBufferMaxSize; - #define SM_ScsiReportLuns_IN_InSenseBufferMaxSize_SIZE sizeof(ULONG) - #define SM_ScsiReportLuns_IN_InSenseBufferMaxSize_ID 6 - -} SM_ScsiReportLuns_IN, *PSM_ScsiReportLuns_IN; - -#define SM_ScsiReportLuns_IN_SIZE (FIELD_OFFSET(SM_ScsiReportLuns_IN, InSenseBufferMaxSize) + SM_ScsiReportLuns_IN_InSenseBufferMaxSize_SIZE) - -typedef struct _SM_ScsiReportLuns_OUT -{ - // - ULONG HBAStatus; - #define SM_ScsiReportLuns_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_ScsiReportLuns_OUT_HBAStatus_ID 7 - - // - UCHAR ScsiStatus; - #define SM_ScsiReportLuns_OUT_ScsiStatus_SIZE sizeof(UCHAR) - #define SM_ScsiReportLuns_OUT_ScsiStatus_ID 8 - - // - ULONG TotalRespBufferSize; - #define SM_ScsiReportLuns_OUT_TotalRespBufferSize_SIZE sizeof(ULONG) - #define SM_ScsiReportLuns_OUT_TotalRespBufferSize_ID 9 - - // - ULONG OutRespBufferSize; - #define SM_ScsiReportLuns_OUT_OutRespBufferSize_SIZE sizeof(ULONG) - #define SM_ScsiReportLuns_OUT_OutRespBufferSize_ID 10 - - // - ULONG OutSenseBufferSize; - #define SM_ScsiReportLuns_OUT_OutSenseBufferSize_SIZE sizeof(ULONG) - #define SM_ScsiReportLuns_OUT_OutSenseBufferSize_ID 11 - - // - UCHAR RespBuffer[1]; - #define SM_ScsiReportLuns_OUT_RespBuffer_ID 12 - - // -// UCHAR SenseBuffer[1]; - #define SM_ScsiReportLuns_OUT_SenseBuffer_ID 13 - -} SM_ScsiReportLuns_OUT, *PSM_ScsiReportLuns_OUT; - -#define SM_ScsiReadCapacity 3 -typedef struct _SM_ScsiReadCapacity_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_ScsiReadCapacity_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_ScsiReadCapacity_IN_HbaPortWWN_ID 1 - - // - UCHAR DiscoveredPortWWN[8]; - #define SM_ScsiReadCapacity_IN_DiscoveredPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_ScsiReadCapacity_IN_DiscoveredPortWWN_ID 2 - - // - UCHAR DomainPortWWN[8]; - #define SM_ScsiReadCapacity_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_ScsiReadCapacity_IN_DomainPortWWN_ID 3 - - // - ULONGLONG SmhbaLUN; - #define SM_ScsiReadCapacity_IN_SmhbaLUN_SIZE sizeof(ULONGLONG) - #define SM_ScsiReadCapacity_IN_SmhbaLUN_ID 4 - - // - UCHAR Cdb[16]; - #define SM_ScsiReadCapacity_IN_Cdb_SIZE sizeof(UCHAR[16]) - #define SM_ScsiReadCapacity_IN_Cdb_ID 5 - - // - ULONG InRespBufferMaxSize; - #define SM_ScsiReadCapacity_IN_InRespBufferMaxSize_SIZE sizeof(ULONG) - #define SM_ScsiReadCapacity_IN_InRespBufferMaxSize_ID 6 - - // - ULONG InSenseBufferMaxSize; - #define SM_ScsiReadCapacity_IN_InSenseBufferMaxSize_SIZE sizeof(ULONG) - #define SM_ScsiReadCapacity_IN_InSenseBufferMaxSize_ID 7 - -} SM_ScsiReadCapacity_IN, *PSM_ScsiReadCapacity_IN; - -#define SM_ScsiReadCapacity_IN_SIZE (FIELD_OFFSET(SM_ScsiReadCapacity_IN, InSenseBufferMaxSize) + SM_ScsiReadCapacity_IN_InSenseBufferMaxSize_SIZE) - -typedef struct _SM_ScsiReadCapacity_OUT -{ - // - ULONG HBAStatus; - #define SM_ScsiReadCapacity_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_ScsiReadCapacity_OUT_HBAStatus_ID 8 - - // - UCHAR ScsiStatus; - #define SM_ScsiReadCapacity_OUT_ScsiStatus_SIZE sizeof(UCHAR) - #define SM_ScsiReadCapacity_OUT_ScsiStatus_ID 9 - - // - ULONG OutRespBufferSize; - #define SM_ScsiReadCapacity_OUT_OutRespBufferSize_SIZE sizeof(ULONG) - #define SM_ScsiReadCapacity_OUT_OutRespBufferSize_ID 10 - - // - ULONG OutSenseBufferSize; - #define SM_ScsiReadCapacity_OUT_OutSenseBufferSize_SIZE sizeof(ULONG) - #define SM_ScsiReadCapacity_OUT_OutSenseBufferSize_ID 11 - - // - UCHAR RespBuffer[1]; - #define SM_ScsiReadCapacity_OUT_RespBuffer_ID 12 - - // -// UCHAR SenseBuffer[1]; - #define SM_ScsiReadCapacity_OUT_SenseBuffer_ID 13 - -} SM_ScsiReadCapacity_OUT, *PSM_ScsiReadCapacity_OUT; - - -// MS_SM_FabricAndDomainManagementMethods - MS_SM_FabricAndDomainManagementMethods -#define MS_SM_FabricAndDomainManagementMethodsGuid \ - { 0x467fea10,0x701b,0x4388, { 0x91,0x7f,0x73,0x06,0x20,0xce,0xa3,0x28 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SM_FabricAndDomainManagementMethods_GUID, \ - 0x467fea10,0x701b,0x4388,0x91,0x7f,0x73,0x06,0x20,0xce,0xa3,0x28); -#endif - -// -// Method id definitions for MS_SM_FabricAndDomainManagementMethods -#define SM_SendTEST 1 -typedef struct _SM_SendTEST_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_SendTEST_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendTEST_IN_HbaPortWWN_ID 1 - - // - UCHAR DestWWN[8]; - #define SM_SendTEST_IN_DestWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendTEST_IN_DestWWN_ID 2 - - // - ULONG DestFCID; - #define SM_SendTEST_IN_DestFCID_SIZE sizeof(ULONG) - #define SM_SendTEST_IN_DestFCID_ID 3 - - // - ULONG ReqBufferSize; - #define SM_SendTEST_IN_ReqBufferSize_SIZE sizeof(ULONG) - #define SM_SendTEST_IN_ReqBufferSize_ID 4 - - // - UCHAR ReqBuffer[1]; - #define SM_SendTEST_IN_ReqBuffer_ID 5 - -} SM_SendTEST_IN, *PSM_SendTEST_IN; - -typedef struct _SM_SendTEST_OUT -{ - // - ULONG HBAStatus; - #define SM_SendTEST_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SendTEST_OUT_HBAStatus_ID 6 - -} SM_SendTEST_OUT, *PSM_SendTEST_OUT; - -#define SM_SendTEST_OUT_SIZE (FIELD_OFFSET(SM_SendTEST_OUT, HBAStatus) + SM_SendTEST_OUT_HBAStatus_SIZE) - -#define SM_SendECHO 2 -typedef struct _SM_SendECHO_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_SendECHO_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendECHO_IN_HbaPortWWN_ID 1 - - // - UCHAR DestWWN[8]; - #define SM_SendECHO_IN_DestWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendECHO_IN_DestWWN_ID 2 - - // - ULONG DestFCID; - #define SM_SendECHO_IN_DestFCID_SIZE sizeof(ULONG) - #define SM_SendECHO_IN_DestFCID_ID 3 - - // - ULONG InRespBufferMaxSize; - #define SM_SendECHO_IN_InRespBufferMaxSize_SIZE sizeof(ULONG) - #define SM_SendECHO_IN_InRespBufferMaxSize_ID 4 - - // - ULONG ReqBufferSize; - #define SM_SendECHO_IN_ReqBufferSize_SIZE sizeof(ULONG) - #define SM_SendECHO_IN_ReqBufferSize_ID 5 - - // - UCHAR ReqBuffer[1]; - #define SM_SendECHO_IN_ReqBuffer_ID 6 - -} SM_SendECHO_IN, *PSM_SendECHO_IN; - -typedef struct _SM_SendECHO_OUT -{ - // - ULONG HBAStatus; - #define SM_SendECHO_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SendECHO_OUT_HBAStatus_ID 7 - - // - ULONG OutRespBufferSize; - #define SM_SendECHO_OUT_OutRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendECHO_OUT_OutRespBufferSize_ID 8 - - // - UCHAR RespBuffer[1]; - #define SM_SendECHO_OUT_RespBuffer_ID 9 - -} SM_SendECHO_OUT, *PSM_SendECHO_OUT; - -#define SM_SendSMPPassThru 3 -typedef struct _SM_SendSMPPassThru_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_SendSMPPassThru_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendSMPPassThru_IN_HbaPortWWN_ID 1 - - // - UCHAR DestPortWWN[8]; - #define SM_SendSMPPassThru_IN_DestPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendSMPPassThru_IN_DestPortWWN_ID 2 - - // - UCHAR DomainPortWWN[8]; - #define SM_SendSMPPassThru_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendSMPPassThru_IN_DomainPortWWN_ID 3 - - // - ULONG InRespBufferMaxSize; - #define SM_SendSMPPassThru_IN_InRespBufferMaxSize_SIZE sizeof(ULONG) - #define SM_SendSMPPassThru_IN_InRespBufferMaxSize_ID 4 - - // - ULONG ReqBufferSize; - #define SM_SendSMPPassThru_IN_ReqBufferSize_SIZE sizeof(ULONG) - #define SM_SendSMPPassThru_IN_ReqBufferSize_ID 5 - - // - UCHAR ReqBuffer[1]; - #define SM_SendSMPPassThru_IN_ReqBuffer_ID 6 - -} SM_SendSMPPassThru_IN, *PSM_SendSMPPassThru_IN; - -typedef struct _SM_SendSMPPassThru_OUT -{ - // - ULONG HBAStatus; - #define SM_SendSMPPassThru_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SendSMPPassThru_OUT_HBAStatus_ID 7 - - // - ULONG TotalRespBufferSize; - #define SM_SendSMPPassThru_OUT_TotalRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendSMPPassThru_OUT_TotalRespBufferSize_ID 8 - - // - ULONG OutRespBufferSize; - #define SM_SendSMPPassThru_OUT_OutRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendSMPPassThru_OUT_OutRespBufferSize_ID 9 - - // - UCHAR RespBuffer[1]; - #define SM_SendSMPPassThru_OUT_RespBuffer_ID 10 - -} SM_SendSMPPassThru_OUT, *PSM_SendSMPPassThru_OUT; - -#define SM_SendCTPassThru 10 -typedef struct _SM_SendCTPassThru_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_SendCTPassThru_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendCTPassThru_IN_HbaPortWWN_ID 1 - - // - ULONG InRespBufferMaxSize; - #define SM_SendCTPassThru_IN_InRespBufferMaxSize_SIZE sizeof(ULONG) - #define SM_SendCTPassThru_IN_InRespBufferMaxSize_ID 2 - - // - ULONG ReqBufferSize; - #define SM_SendCTPassThru_IN_ReqBufferSize_SIZE sizeof(ULONG) - #define SM_SendCTPassThru_IN_ReqBufferSize_ID 3 - - // - UCHAR ReqBuffer[1]; - #define SM_SendCTPassThru_IN_ReqBuffer_ID 4 - -} SM_SendCTPassThru_IN, *PSM_SendCTPassThru_IN; - -typedef struct _SM_SendCTPassThru_OUT -{ - // - ULONG HBAStatus; - #define SM_SendCTPassThru_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SendCTPassThru_OUT_HBAStatus_ID 5 - - // - ULONG TotalRespBufferSize; - #define SM_SendCTPassThru_OUT_TotalRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendCTPassThru_OUT_TotalRespBufferSize_ID 6 - - // - ULONG OutRespBufferSize; - #define SM_SendCTPassThru_OUT_OutRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendCTPassThru_OUT_OutRespBufferSize_ID 7 - - // - UCHAR RespBuffer[1]; - #define SM_SendCTPassThru_OUT_RespBuffer_ID 8 - -} SM_SendCTPassThru_OUT, *PSM_SendCTPassThru_OUT; - -#define SM_GetRNIDMgmtInfo 11 -typedef struct _SM_GetRNIDMgmtInfo_OUT -{ - // - ULONG HBAStatus; - #define SM_GetRNIDMgmtInfo_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_GetRNIDMgmtInfo_OUT_HBAStatus_ID 1 - - // - HBAFC3MgmtInfo MgmtInfo; - #define SM_GetRNIDMgmtInfo_OUT_MgmtInfo_SIZE sizeof(HBAFC3MgmtInfo) - #define SM_GetRNIDMgmtInfo_OUT_MgmtInfo_ID 2 - -} SM_GetRNIDMgmtInfo_OUT, *PSM_GetRNIDMgmtInfo_OUT; - -#define SM_GetRNIDMgmtInfo_OUT_SIZE (FIELD_OFFSET(SM_GetRNIDMgmtInfo_OUT, MgmtInfo) + SM_GetRNIDMgmtInfo_OUT_MgmtInfo_SIZE) - -#define SM_SetRNIDMgmtInfo 12 -typedef struct _SM_SetRNIDMgmtInfo_IN -{ - // - HBAFC3MgmtInfo MgmtInfo; - #define SM_SetRNIDMgmtInfo_IN_MgmtInfo_SIZE sizeof(HBAFC3MgmtInfo) - #define SM_SetRNIDMgmtInfo_IN_MgmtInfo_ID 1 - -} SM_SetRNIDMgmtInfo_IN, *PSM_SetRNIDMgmtInfo_IN; - -#define SM_SetRNIDMgmtInfo_IN_SIZE (FIELD_OFFSET(SM_SetRNIDMgmtInfo_IN, MgmtInfo) + SM_SetRNIDMgmtInfo_IN_MgmtInfo_SIZE) - -typedef struct _SM_SetRNIDMgmtInfo_OUT -{ - // - ULONG HBAStatus; - #define SM_SetRNIDMgmtInfo_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SetRNIDMgmtInfo_OUT_HBAStatus_ID 2 - -} SM_SetRNIDMgmtInfo_OUT, *PSM_SetRNIDMgmtInfo_OUT; - -#define SM_SetRNIDMgmtInfo_OUT_SIZE (FIELD_OFFSET(SM_SetRNIDMgmtInfo_OUT, HBAStatus) + SM_SetRNIDMgmtInfo_OUT_HBAStatus_SIZE) - -#define SM_SendRNID 13 -typedef struct _SM_SendRNID_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_SendRNID_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendRNID_IN_HbaPortWWN_ID 1 - - // - UCHAR DestWWN[8]; - #define SM_SendRNID_IN_DestWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendRNID_IN_DestWWN_ID 2 - - // - ULONG DestFCID; - #define SM_SendRNID_IN_DestFCID_SIZE sizeof(ULONG) - #define SM_SendRNID_IN_DestFCID_ID 3 - - // - ULONG NodeIdDataFormat; - #define SM_SendRNID_IN_NodeIdDataFormat_SIZE sizeof(ULONG) - #define SM_SendRNID_IN_NodeIdDataFormat_ID 4 - - // - ULONG InRespBufferMaxSize; - #define SM_SendRNID_IN_InRespBufferMaxSize_SIZE sizeof(ULONG) - #define SM_SendRNID_IN_InRespBufferMaxSize_ID 5 - -} SM_SendRNID_IN, *PSM_SendRNID_IN; - -#define SM_SendRNID_IN_SIZE (FIELD_OFFSET(SM_SendRNID_IN, InRespBufferMaxSize) + SM_SendRNID_IN_InRespBufferMaxSize_SIZE) - -typedef struct _SM_SendRNID_OUT -{ - // - ULONG HBAStatus; - #define SM_SendRNID_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SendRNID_OUT_HBAStatus_ID 6 - - // - ULONG TotalRespBufferSize; - #define SM_SendRNID_OUT_TotalRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendRNID_OUT_TotalRespBufferSize_ID 7 - - // - ULONG OutRespBufferSize; - #define SM_SendRNID_OUT_OutRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendRNID_OUT_OutRespBufferSize_ID 8 - - // - UCHAR RespBuffer[1]; - #define SM_SendRNID_OUT_RespBuffer_ID 9 - -} SM_SendRNID_OUT, *PSM_SendRNID_OUT; - -#define SM_SendRPL 14 -typedef struct _SM_SendRPL_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_SendRPL_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendRPL_IN_HbaPortWWN_ID 1 - - // - UCHAR AgentWWN[8]; - #define SM_SendRPL_IN_AgentWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendRPL_IN_AgentWWN_ID 2 - - // - ULONG AgentDomain; - #define SM_SendRPL_IN_AgentDomain_SIZE sizeof(ULONG) - #define SM_SendRPL_IN_AgentDomain_ID 3 - - // - ULONG PortIndex; - #define SM_SendRPL_IN_PortIndex_SIZE sizeof(ULONG) - #define SM_SendRPL_IN_PortIndex_ID 4 - - // - ULONG InRespBufferMaxSize; - #define SM_SendRPL_IN_InRespBufferMaxSize_SIZE sizeof(ULONG) - #define SM_SendRPL_IN_InRespBufferMaxSize_ID 5 - -} SM_SendRPL_IN, *PSM_SendRPL_IN; - -#define SM_SendRPL_IN_SIZE (FIELD_OFFSET(SM_SendRPL_IN, InRespBufferMaxSize) + SM_SendRPL_IN_InRespBufferMaxSize_SIZE) - -typedef struct _SM_SendRPL_OUT -{ - // - ULONG HBAStatus; - #define SM_SendRPL_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SendRPL_OUT_HBAStatus_ID 6 - - // - ULONG TotalRespBufferSize; - #define SM_SendRPL_OUT_TotalRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendRPL_OUT_TotalRespBufferSize_ID 7 - - // - ULONG OutRespBufferSize; - #define SM_SendRPL_OUT_OutRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendRPL_OUT_OutRespBufferSize_ID 8 - - // - UCHAR RespBuffer[1]; - #define SM_SendRPL_OUT_RespBuffer_ID 9 - -} SM_SendRPL_OUT, *PSM_SendRPL_OUT; - -#define SM_SendRPS 15 -typedef struct _SM_SendRPS_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_SendRPS_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendRPS_IN_HbaPortWWN_ID 1 - - // - UCHAR AgentWWN[8]; - #define SM_SendRPS_IN_AgentWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendRPS_IN_AgentWWN_ID 2 - - // - UCHAR ObjectWWN[8]; - #define SM_SendRPS_IN_ObjectWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendRPS_IN_ObjectWWN_ID 3 - - // - ULONG AgentDomain; - #define SM_SendRPS_IN_AgentDomain_SIZE sizeof(ULONG) - #define SM_SendRPS_IN_AgentDomain_ID 4 - - // - ULONG ObjectPortNumber; - #define SM_SendRPS_IN_ObjectPortNumber_SIZE sizeof(ULONG) - #define SM_SendRPS_IN_ObjectPortNumber_ID 5 - - // - ULONG InRespBufferMaxSize; - #define SM_SendRPS_IN_InRespBufferMaxSize_SIZE sizeof(ULONG) - #define SM_SendRPS_IN_InRespBufferMaxSize_ID 6 - -} SM_SendRPS_IN, *PSM_SendRPS_IN; - -#define SM_SendRPS_IN_SIZE (FIELD_OFFSET(SM_SendRPS_IN, InRespBufferMaxSize) + SM_SendRPS_IN_InRespBufferMaxSize_SIZE) - -typedef struct _SM_SendRPS_OUT -{ - // - ULONG HBAStatus; - #define SM_SendRPS_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SendRPS_OUT_HBAStatus_ID 7 - - // - ULONG TotalRespBufferSize; - #define SM_SendRPS_OUT_TotalRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendRPS_OUT_TotalRespBufferSize_ID 8 - - // - ULONG OutRespBufferSize; - #define SM_SendRPS_OUT_OutRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendRPS_OUT_OutRespBufferSize_ID 9 - - // - UCHAR RespBuffer[1]; - #define SM_SendRPS_OUT_RespBuffer_ID 10 - -} SM_SendRPS_OUT, *PSM_SendRPS_OUT; - -#define SM_SendSRL 16 -typedef struct _SM_SendSRL_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_SendSRL_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendSRL_IN_HbaPortWWN_ID 1 - - // - UCHAR WWN[8]; - #define SM_SendSRL_IN_WWN_SIZE sizeof(UCHAR[8]) - #define SM_SendSRL_IN_WWN_ID 2 - - // - ULONG Domain; - #define SM_SendSRL_IN_Domain_SIZE sizeof(ULONG) - #define SM_SendSRL_IN_Domain_ID 3 - - // - ULONG InRespBufferMaxSize; - #define SM_SendSRL_IN_InRespBufferMaxSize_SIZE sizeof(ULONG) - #define SM_SendSRL_IN_InRespBufferMaxSize_ID 4 - -} SM_SendSRL_IN, *PSM_SendSRL_IN; - -#define SM_SendSRL_IN_SIZE (FIELD_OFFSET(SM_SendSRL_IN, InRespBufferMaxSize) + SM_SendSRL_IN_InRespBufferMaxSize_SIZE) - -typedef struct _SM_SendSRL_OUT -{ - // - ULONG HBAStatus; - #define SM_SendSRL_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SendSRL_OUT_HBAStatus_ID 5 - - // - ULONG TotalRespBufferSize; - #define SM_SendSRL_OUT_TotalRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendSRL_OUT_TotalRespBufferSize_ID 6 - - // - ULONG OutRespBufferSize; - #define SM_SendSRL_OUT_OutRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendSRL_OUT_OutRespBufferSize_ID 7 - - // - UCHAR RespBuffer[1]; - #define SM_SendSRL_OUT_RespBuffer_ID 8 - -} SM_SendSRL_OUT, *PSM_SendSRL_OUT; - -#define SM_SendLIRR 17 -typedef struct _SM_SendLIRR_IN -{ - // - UCHAR SourceWWN[8]; - #define SM_SendLIRR_IN_SourceWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendLIRR_IN_SourceWWN_ID 1 - - // - UCHAR DestWWN[8]; - #define SM_SendLIRR_IN_DestWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendLIRR_IN_DestWWN_ID 2 - - // - UCHAR Function; - #define SM_SendLIRR_IN_Function_SIZE sizeof(UCHAR) - #define SM_SendLIRR_IN_Function_ID 3 - - // - UCHAR Type; - #define SM_SendLIRR_IN_Type_SIZE sizeof(UCHAR) - #define SM_SendLIRR_IN_Type_ID 4 - - // - ULONG InRespBufferMaxSize; - #define SM_SendLIRR_IN_InRespBufferMaxSize_SIZE sizeof(ULONG) - #define SM_SendLIRR_IN_InRespBufferMaxSize_ID 5 - -} SM_SendLIRR_IN, *PSM_SendLIRR_IN; - -#define SM_SendLIRR_IN_SIZE (FIELD_OFFSET(SM_SendLIRR_IN, InRespBufferMaxSize) + SM_SendLIRR_IN_InRespBufferMaxSize_SIZE) - -typedef struct _SM_SendLIRR_OUT -{ - // - ULONG HBAStatus; - #define SM_SendLIRR_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SendLIRR_OUT_HBAStatus_ID 6 - - // - ULONG TotalRespBufferSize; - #define SM_SendLIRR_OUT_TotalRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendLIRR_OUT_TotalRespBufferSize_ID 7 - - // - ULONG OutRespBufferSize; - #define SM_SendLIRR_OUT_OutRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendLIRR_OUT_OutRespBufferSize_ID 8 - - // - UCHAR RespBuffer[1]; - #define SM_SendLIRR_OUT_RespBuffer_ID 9 - -} SM_SendLIRR_OUT, *PSM_SendLIRR_OUT; - -#define SM_SendRLS 18 -typedef struct _SM_SendRLS_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_SendRLS_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendRLS_IN_HbaPortWWN_ID 1 - - // - UCHAR DestWWN[8]; - #define SM_SendRLS_IN_DestWWN_SIZE sizeof(UCHAR[8]) - #define SM_SendRLS_IN_DestWWN_ID 2 - - // - ULONG InRespBufferMaxSize; - #define SM_SendRLS_IN_InRespBufferMaxSize_SIZE sizeof(ULONG) - #define SM_SendRLS_IN_InRespBufferMaxSize_ID 3 - -} SM_SendRLS_IN, *PSM_SendRLS_IN; - -#define SM_SendRLS_IN_SIZE (FIELD_OFFSET(SM_SendRLS_IN, InRespBufferMaxSize) + SM_SendRLS_IN_InRespBufferMaxSize_SIZE) - -typedef struct _SM_SendRLS_OUT -{ - // - ULONG HBAStatus; - #define SM_SendRLS_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_SendRLS_OUT_HBAStatus_ID 4 - - // - ULONG TotalRespBufferSize; - #define SM_SendRLS_OUT_TotalRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendRLS_OUT_TotalRespBufferSize_ID 5 - - // - ULONG OutRespBufferSize; - #define SM_SendRLS_OUT_OutRespBufferSize_SIZE sizeof(ULONG) - #define SM_SendRLS_OUT_OutRespBufferSize_ID 6 - - // - UCHAR RespBuffer[1]; - #define SM_SendRLS_OUT_RespBuffer_ID 7 - -} SM_SendRLS_OUT, *PSM_SendRLS_OUT; - - -// MS_SM_AdapterEvent - MS_SM_AdapterEvent -#define MS_SM_AdapterEventGuid \ - { 0x7944cf67,0x697b,0x4432, { 0x95,0x3e,0x1f,0xda,0xda,0x88,0x43,0x61 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SM_AdapterEvent_GUID, \ - 0x7944cf67,0x697b,0x4432,0x95,0x3e,0x1f,0xda,0xda,0x88,0x43,0x61); -#endif - - -typedef struct _MS_SM_AdapterEvent -{ - // - ULONG EventType; - #define MS_SM_AdapterEvent_EventType_SIZE sizeof(ULONG) - #define MS_SM_AdapterEvent_EventType_ID 1 - - // - UCHAR PortWWN[8]; - #define MS_SM_AdapterEvent_PortWWN_SIZE sizeof(UCHAR[8]) - #define MS_SM_AdapterEvent_PortWWN_ID 2 - -} MS_SM_AdapterEvent, *PMS_SM_AdapterEvent; - -#define MS_SM_AdapterEvent_SIZE (FIELD_OFFSET(MS_SM_AdapterEvent, PortWWN) + MS_SM_AdapterEvent_PortWWN_SIZE) - -// MS_SM_PortEvent - MS_SM_PortEvent -#define MS_SM_PortEventGuid \ - { 0x0f760256,0x8fc6,0x47ad, { 0x9d,0x2e,0xf0,0xd6,0x98,0x01,0xde,0x7c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SM_PortEvent_GUID, \ - 0x0f760256,0x8fc6,0x47ad,0x9d,0x2e,0xf0,0xd6,0x98,0x01,0xde,0x7c); -#endif - - -typedef struct _MS_SM_PortEvent -{ - // - ULONG EventType; - #define MS_SM_PortEvent_EventType_SIZE sizeof(ULONG) - #define MS_SM_PortEvent_EventType_ID 1 - - // - ULONG FabricPortId; - #define MS_SM_PortEvent_FabricPortId_SIZE sizeof(ULONG) - #define MS_SM_PortEvent_FabricPortId_ID 2 - - // - UCHAR PortWWN[8]; - #define MS_SM_PortEvent_PortWWN_SIZE sizeof(UCHAR[8]) - #define MS_SM_PortEvent_PortWWN_ID 3 - -} MS_SM_PortEvent, *PMS_SM_PortEvent; - -#define MS_SM_PortEvent_SIZE (FIELD_OFFSET(MS_SM_PortEvent, PortWWN) + MS_SM_PortEvent_PortWWN_SIZE) - -// MS_SM_TargetEvent - MS_SM_TargetEvent -#define MS_SM_TargetEventGuid \ - { 0x6e2d8b73,0xf928,0x4da9, { 0xbd,0xa1,0xae,0x54,0x18,0x9a,0x38,0x25 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SM_TargetEvent_GUID, \ - 0x6e2d8b73,0xf928,0x4da9,0xbd,0xa1,0xae,0x54,0x18,0x9a,0x38,0x25); -#endif - - -typedef struct _MS_SM_TargetEvent -{ - // - ULONG EventType; - #define MS_SM_TargetEvent_EventType_SIZE sizeof(ULONG) - #define MS_SM_TargetEvent_EventType_ID 1 - - // - UCHAR PortWWN[8]; - #define MS_SM_TargetEvent_PortWWN_SIZE sizeof(UCHAR[8]) - #define MS_SM_TargetEvent_PortWWN_ID 2 - - // - UCHAR DiscoveredPortWWN[8]; - #define MS_SM_TargetEvent_DiscoveredPortWWN_SIZE sizeof(UCHAR[8]) - #define MS_SM_TargetEvent_DiscoveredPortWWN_ID 3 - - // - UCHAR DomainPortWWN[8]; - #define MS_SM_TargetEvent_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define MS_SM_TargetEvent_DomainPortWWN_ID 4 - -} MS_SM_TargetEvent, *PMS_SM_TargetEvent; - -#define MS_SM_TargetEvent_SIZE (FIELD_OFFSET(MS_SM_TargetEvent, DomainPortWWN) + MS_SM_TargetEvent_DomainPortWWN_SIZE) - -// MS_SM_EventControl - MS_SM_EventControl -#define MS_SM_EventControlGuid \ - { 0xd6145693,0x5988,0x457f, { 0x85,0x81,0x9a,0x01,0x57,0xb5,0x86,0x90 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MS_SM_EventControl_GUID, \ - 0xd6145693,0x5988,0x457f,0x85,0x81,0x9a,0x01,0x57,0xb5,0x86,0x90); -#endif - -// -// Method id definitions for MS_SM_EventControl -#define SM_AddTarget 1 -typedef struct _SM_AddTarget_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_AddTarget_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_AddTarget_IN_HbaPortWWN_ID 1 - - // - UCHAR DiscoveredPortWWN[8]; - #define SM_AddTarget_IN_DiscoveredPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_AddTarget_IN_DiscoveredPortWWN_ID 2 - - // - UCHAR DomainPortWWN[8]; - #define SM_AddTarget_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_AddTarget_IN_DomainPortWWN_ID 3 - - // - ULONG AllTargets; - #define SM_AddTarget_IN_AllTargets_SIZE sizeof(ULONG) - #define SM_AddTarget_IN_AllTargets_ID 4 - -} SM_AddTarget_IN, *PSM_AddTarget_IN; - -#define SM_AddTarget_IN_SIZE (FIELD_OFFSET(SM_AddTarget_IN, AllTargets) + SM_AddTarget_IN_AllTargets_SIZE) - -typedef struct _SM_AddTarget_OUT -{ - // - ULONG HBAStatus; - #define SM_AddTarget_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_AddTarget_OUT_HBAStatus_ID 5 - -} SM_AddTarget_OUT, *PSM_AddTarget_OUT; - -#define SM_AddTarget_OUT_SIZE (FIELD_OFFSET(SM_AddTarget_OUT, HBAStatus) + SM_AddTarget_OUT_HBAStatus_SIZE) - -#define SM_RemoveTarget 2 -typedef struct _SM_RemoveTarget_IN -{ - // - UCHAR HbaPortWWN[8]; - #define SM_RemoveTarget_IN_HbaPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_RemoveTarget_IN_HbaPortWWN_ID 1 - - // - UCHAR DiscoveredPortWWN[8]; - #define SM_RemoveTarget_IN_DiscoveredPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_RemoveTarget_IN_DiscoveredPortWWN_ID 2 - - // - UCHAR DomainPortWWN[8]; - #define SM_RemoveTarget_IN_DomainPortWWN_SIZE sizeof(UCHAR[8]) - #define SM_RemoveTarget_IN_DomainPortWWN_ID 3 - - // - ULONG AllTargets; - #define SM_RemoveTarget_IN_AllTargets_SIZE sizeof(ULONG) - #define SM_RemoveTarget_IN_AllTargets_ID 4 - -} SM_RemoveTarget_IN, *PSM_RemoveTarget_IN; - -#define SM_RemoveTarget_IN_SIZE (FIELD_OFFSET(SM_RemoveTarget_IN, AllTargets) + SM_RemoveTarget_IN_AllTargets_SIZE) - -typedef struct _SM_RemoveTarget_OUT -{ - // - ULONG HBAStatus; - #define SM_RemoveTarget_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_RemoveTarget_OUT_HBAStatus_ID 5 - -} SM_RemoveTarget_OUT, *PSM_RemoveTarget_OUT; - -#define SM_RemoveTarget_OUT_SIZE (FIELD_OFFSET(SM_RemoveTarget_OUT, HBAStatus) + SM_RemoveTarget_OUT_HBAStatus_SIZE) - -#define SM_AddPort 3 -typedef struct _SM_AddPort_IN -{ - // - UCHAR PortWWN[8]; - #define SM_AddPort_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define SM_AddPort_IN_PortWWN_ID 1 - - // - ULONG EventType; - #define SM_AddPort_IN_EventType_SIZE sizeof(ULONG) - #define SM_AddPort_IN_EventType_ID 2 - -} SM_AddPort_IN, *PSM_AddPort_IN; - -#define SM_AddPort_IN_SIZE (FIELD_OFFSET(SM_AddPort_IN, EventType) + SM_AddPort_IN_EventType_SIZE) - -typedef struct _SM_AddPort_OUT -{ - // - ULONG HBAStatus; - #define SM_AddPort_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_AddPort_OUT_HBAStatus_ID 3 - -} SM_AddPort_OUT, *PSM_AddPort_OUT; - -#define SM_AddPort_OUT_SIZE (FIELD_OFFSET(SM_AddPort_OUT, HBAStatus) + SM_AddPort_OUT_HBAStatus_SIZE) - -#define SM_RemovePort 4 -typedef struct _SM_RemovePort_IN -{ - // - UCHAR PortWWN[8]; - #define SM_RemovePort_IN_PortWWN_SIZE sizeof(UCHAR[8]) - #define SM_RemovePort_IN_PortWWN_ID 1 - - // - ULONG EventType; - #define SM_RemovePort_IN_EventType_SIZE sizeof(ULONG) - #define SM_RemovePort_IN_EventType_ID 2 - -} SM_RemovePort_IN, *PSM_RemovePort_IN; - -#define SM_RemovePort_IN_SIZE (FIELD_OFFSET(SM_RemovePort_IN, EventType) + SM_RemovePort_IN_EventType_SIZE) - -typedef struct _SM_RemovePort_OUT -{ - // - ULONG HBAStatus; - #define SM_RemovePort_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_RemovePort_OUT_HBAStatus_ID 3 - -} SM_RemovePort_OUT, *PSM_RemovePort_OUT; - -#define SM_RemovePort_OUT_SIZE (FIELD_OFFSET(SM_RemovePort_OUT, HBAStatus) + SM_RemovePort_OUT_HBAStatus_SIZE) - -#define SM_AddLink 10 -typedef struct _SM_AddLink_OUT -{ - // - ULONG HBAStatus; - #define SM_AddLink_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_AddLink_OUT_HBAStatus_ID 1 - -} SM_AddLink_OUT, *PSM_AddLink_OUT; - -#define SM_AddLink_OUT_SIZE (FIELD_OFFSET(SM_AddLink_OUT, HBAStatus) + SM_AddLink_OUT_HBAStatus_SIZE) - -#define SM_RemoveLink 11 -typedef struct _SM_RemoveLink_OUT -{ - // - ULONG HBAStatus; - #define SM_RemoveLink_OUT_HBAStatus_SIZE sizeof(ULONG) - #define SM_RemoveLink_OUT_HBAStatus_ID 1 - -} SM_RemoveLink_OUT, *PSM_RemoveLink_OUT; - -#define SM_RemoveLink_OUT_SIZE (FIELD_OFFSET(SM_RemoveLink_OUT, HBAStatus) + SM_RemoveLink_OUT_HBAStatus_SIZE) - - -// MSFC_TM - MSFC_TM - -#endif // MS_SM_HBA_API - -#define MSFC_TMGuid \ - { 0x8cf4c7eb,0xa286,0x409d, { 0x9e,0xb9,0x29,0xd7,0xe0,0xe9,0xf4,0xfa } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_TM_GUID, \ - 0x8cf4c7eb,0xa286,0x409d,0x9e,0xb9,0x29,0xd7,0xe0,0xe9,0xf4,0xfa); -#endif - - -typedef struct _MSFC_TM -{ - // - ULONG tm_sec; - #define MSFC_TM_tm_sec_SIZE sizeof(ULONG) - #define MSFC_TM_tm_sec_ID 1 - - // - ULONG tm_min; - #define MSFC_TM_tm_min_SIZE sizeof(ULONG) - #define MSFC_TM_tm_min_ID 2 - - // - ULONG tm_hour; - #define MSFC_TM_tm_hour_SIZE sizeof(ULONG) - #define MSFC_TM_tm_hour_ID 3 - - // - ULONG tm_mday; - #define MSFC_TM_tm_mday_SIZE sizeof(ULONG) - #define MSFC_TM_tm_mday_ID 4 - - // - ULONG tm_mon; - #define MSFC_TM_tm_mon_SIZE sizeof(ULONG) - #define MSFC_TM_tm_mon_ID 5 - - // - ULONG tm_year; - #define MSFC_TM_tm_year_SIZE sizeof(ULONG) - #define MSFC_TM_tm_year_ID 6 - - // - ULONG tm_wday; - #define MSFC_TM_tm_wday_SIZE sizeof(ULONG) - #define MSFC_TM_tm_wday_ID 7 - - // - ULONG tm_yday; - #define MSFC_TM_tm_yday_SIZE sizeof(ULONG) - #define MSFC_TM_tm_yday_ID 8 - - // - ULONG tm_isdst; - #define MSFC_TM_tm_isdst_SIZE sizeof(ULONG) - #define MSFC_TM_tm_isdst_ID 9 - -} MSFC_TM, *PMSFC_TM; - -#define MSFC_TM_SIZE (FIELD_OFFSET(MSFC_TM, tm_isdst) + MSFC_TM_tm_isdst_SIZE) - -#endif - diff --git a/pub/ddk/hdaudio.h b/pub/ddk/hdaudio.h deleted file mode 100644 index 70b90af..0000000 --- a/pub/ddk/hdaudio.h +++ /dev/null @@ -1,361 +0,0 @@ -// -// 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_ - diff --git a/pub/ddk/hidclass.h b/pub/ddk/hidclass.h deleted file mode 100644 index 2e20afd..0000000 --- a/pub/ddk/hidclass.h +++ /dev/null @@ -1,245 +0,0 @@ -/*++ - -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 - -// -// 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__ - - - diff --git a/pub/ddk/hidpddi.h b/pub/ddk/hidpddi.h deleted file mode 100644 index cf312b4..0000000 --- a/pub/ddk/hidpddi.h +++ /dev/null @@ -1,256 +0,0 @@ -/*++ - -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 - - diff --git a/pub/ddk/hidport.h b/pub/ddk/hidport.h deleted file mode 100644 index 31bb0d5..0000000 --- a/pub/ddk/hidport.h +++ /dev/null @@ -1,222 +0,0 @@ -/*++ - -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 - -// -// 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 -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 - - -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__ - diff --git a/pub/ddk/hintsdeviceservice.h b/pub/ddk/hintsdeviceservice.h deleted file mode 100644 index d988ffa..0000000 --- a/pub/ddk/hintsdeviceservice.h +++ /dev/null @@ -1,295 +0,0 @@ -/* - * HintsDeviceService.h - * - * Contains definitions of the Hints Device Service - * - * Copyright (c) Microsoft Corporation, All Rights Reserved. - * - */ - -#ifndef _HINTSDEVICESERVICE_H_ -#define _HINTSDEVICESERVICE_H_ - -#include - -/*****************************************************************************/ -/* 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_ */ - - diff --git a/pub/ddk/hubbusif.h b/pub/ddk/hubbusif.h deleted file mode 100644 index 9a23cc7..0000000 --- a/pub/ddk/hubbusif.h +++ /dev/null @@ -1,1232 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - hubbusif.h - -Abstract: - - Services exported by the Port driver for use by the hub driver. - -Environment: - - Kernel mode - ---*/ - -#ifndef __HUBBUSIF_H__ -#define __HUBBUSIF_H__ - -/* - Bus interfaces are supported for Windows XP and later only -*/ - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -typedef PVOID PUSB_DEVICE_HANDLE; - -typedef struct _ROOTHUB_PDO_EXTENSION { - - ULONG Signature; - -} ROOTHUB_PDO_EXTENSION, *PROOTHUB_PDO_EXTENSION; - -// legacy flags -#define USBD_DEVHACK_SLOW_ENUMERATION 0x00000001 -#define USBD_DEVHACK_DISABLE_SN 0x00000002 -#define USBD_DEVHACK_SET_DIAG_ID 0x00000004 - - - -#ifndef USB_BUSIFFN -#define USB_BUSIFFN __stdcall -#endif - -/**************************************************************************************************** - -Module: hubbusif.h - -name: Bus interface for USB Hub -Copyright (c) Microsoft Corporation. All rights reserved - -Revision History: - - 6-20-99 : created - 1-5-03 : revised - - -*******************************************************************************************************/ - - -__drv_functionClass(USB_BUSIFFN_CREATE_USB_DEVICE) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_CREATE_USB_DEVICE ( - __in PVOID BusContext, - __deref_out PUSB_DEVICE_HANDLE *NewDeviceHandle, - __in PUSB_DEVICE_HANDLE HubDeviceHandle, - __in USHORT PortStatus, - __in USHORT PortNumber - ); - -typedef USB_BUSIFFN_CREATE_USB_DEVICE *PUSB_BUSIFFN_CREATE_USB_DEVICE; - -#define CD_ERR_V1 0x00000001 - -typedef enum _USBPORT_CREATEDEV_ERROR { - CreateDevErrNotSet = 0, - CreateDevBadHubDevHandle, - CreateDevFailedAllocDevHandle, - CreateDevFailedOpenEndpoint, - CreateDevFailedAllocDsBuff, - CreateDevFailedGetDs, - CreateDevTtNotFound, - CreateDevBadDevHandlePtr -} USBPORT_CREATEDEV_ERROR; - -typedef struct _USB_CD_ERROR_INFORMATION { - - ULONG Version; - USBPORT_CREATEDEV_ERROR PathError; - ULONG UlongArg1; - ULONG UlongArg2; - NTSTATUS NtStatus; - UCHAR XtraInfo[64]; - -} USB_CD_ERROR_INFORMATION, *PUSB_CD_ERROR_INFORMATION; - - -__drv_functionClass(USB_BUSIFFN_CREATE_USB_DEVICE_EX) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_CREATE_USB_DEVICE_EX ( - __in PVOID BusContext, - __deref_out PUSB_DEVICE_HANDLE *NewDeviceHandle, - __in PUSB_DEVICE_HANDLE HsHubDeviceHandle, - __in USHORT PortStatus, - __in USHORT PortNumber, - __out PUSB_CD_ERROR_INFORMATION CdErrorInfo, - __in USHORT TtPortNumber - ); - -typedef USB_BUSIFFN_CREATE_USB_DEVICE_EX *PUSB_BUSIFFN_CREATE_USB_DEVICE_EX; - -/* - PortPathDepth - - Depth of hubs through which a device is attached to a host - controller. - 0: Root hub device embedded in host controller. - 1: Devices attached directly to a root hub port. - 2 - 6: Devices attached through a chain of a hubs at most 5 deep, - not including root hub. (See section 4.1.1 Bus Topology in the USB - Specification Revision 2.0) - - PortPath - - List of 1-based port numbers on the chain of hubs through which a - device is attached. PortPath list has PortPathDepth valid entries. -*/ - -typedef struct _USB_PORT_PATH { - - ULONG PortPathDepth; - ULONG PortPath[6]; - -} USB_PORT_PATH, *PUSB_PORT_PATH; - - -__drv_functionClass(USB_BUSIFFN_CREATE_USB_DEVICE_V7) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_CREATE_USB_DEVICE_V7 ( - __in PVOID BusContext, - __deref_out PUSB_DEVICE_HANDLE *NewDeviceHandle, - __in PUSB_DEVICE_HANDLE HsHubDeviceHandle, - __in USHORT PortStatus, - __in PUSB_PORT_PATH PortPath, - __out PUSB_CD_ERROR_INFORMATION CdErrorInfo, - __in USHORT TtPortNumber, - __in PDEVICE_OBJECT PdoDeviceObject, - __in PUNICODE_STRING PhysicalDeviceObjectName - ); - -typedef USB_BUSIFFN_CREATE_USB_DEVICE_V7 *PUSB_BUSIFFN_CREATE_USB_DEVICE_V7; -#define ID_ERR_V1 0x00000001 - -typedef enum _USBPORT_INITDEV_ERROR { - InitDevErrNotSet = 0, - InitDevFailedSetAddress, - InitDevFailedPokeEndpoint, - InitDevBadDeviceDescriptor, -} USBPORT_INITDEV_ERROR; - -typedef struct _USB_ID_ERROR_INFORMATION { - - ULONG Version; - USBPORT_INITDEV_ERROR PathError; - ULONG Arg1; - ULONG UsbAddress; - NTSTATUS NtStatus; - USBD_STATUS UsbdStatus; - UCHAR XtraInfo[64]; - -} USB_ID_ERROR_INFORMATION, *PUSB_ID_ERROR_INFORMATION; - - -__drv_functionClass(USB_BUSIFFN_INITIALIZE_USB_DEVICE) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_INITIALIZE_USB_DEVICE ( - __in PVOID BusContext, - __inout PUSB_DEVICE_HANDLE DeviceHandle - ); - -typedef USB_BUSIFFN_INITIALIZE_USB_DEVICE *PUSB_BUSIFFN_INITIALIZE_USB_DEVICE; - -__drv_functionClass(USB_BUSIFFN_INITIALIZE_USB_DEVICE_EX) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_INITIALIZE_USB_DEVICE_EX ( - __in PVOID BusContext, - __inout PUSB_DEVICE_HANDLE DeviceHandle, - __out PUSB_ID_ERROR_INFORMATION IdErrInfo - ); - -typedef USB_BUSIFFN_INITIALIZE_USB_DEVICE_EX *PUSB_BUSIFFN_INITIALIZE_USB_DEVICE_EX; - -/* -flags passed to remove device -*/ - -#define USBD_KEEP_DEVICE_DATA 0x00000001 -#define USBD_MARK_DEVICE_BUSY 0x00000002 - - -__drv_functionClass(USB_BUSIFFN_REMOVE_USB_DEVICE) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_REMOVE_USB_DEVICE ( - __in PVOID BusContext, - __inout PUSB_DEVICE_HANDLE DeviceHandle, - __in ULONG Flags - ); - -typedef USB_BUSIFFN_REMOVE_USB_DEVICE *PUSB_BUSIFFN_REMOVE_USB_DEVICE; - -__drv_functionClass(USB_BUSIFFN_GET_USB_DESCRIPTORS) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_GET_USB_DESCRIPTORS ( - __in PVOID BusContext, - __inout PUSB_DEVICE_HANDLE DeviceHandle, - __out_bcount_part(*DeviceDescriptorBufferLength,*DeviceDescriptorBufferLength) PUCHAR DeviceDescriptorBuffer, - __inout PULONG DeviceDescriptorBufferLength, - __out_bcount_part(*ConfigDescriptorBufferLength, *ConfigDescriptorBufferLength) PUCHAR ConfigDescriptorBuffer, - __inout PULONG ConfigDescriptorBufferLength - ); - -typedef USB_BUSIFFN_GET_USB_DESCRIPTORS *PUSB_BUSIFFN_GET_USB_DESCRIPTORS; - -__drv_functionClass(USB_BUSIFFN_RESTORE_DEVICE) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_RESTORE_DEVICE ( - __in PVOID BusContext, - __inout PUSB_DEVICE_HANDLE OldDeviceHandle, - __inout PUSB_DEVICE_HANDLE NewDeviceHandle - ); - -typedef USB_BUSIFFN_RESTORE_DEVICE *PUSB_BUSIFFN_RESTORE_DEVICE; - -__drv_functionClass(USB_BUSIFFN_GET_POTRTHACK_FLAGS) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_GET_POTRTHACK_FLAGS ( - __in PVOID BusContext, - __inout PULONG Flags - ); - -typedef USB_BUSIFFN_GET_POTRTHACK_FLAGS *PUSB_BUSIFFN_GET_POTRTHACK_FLAGS; - -__drv_functionClass(USB_BUSIFFN_GET_DEVICE_INFORMATION) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_GET_DEVICE_INFORMATION ( - __in PVOID BusContext, - __in PUSB_DEVICE_HANDLE DeviceHandle, - __out_bcount_part(DeviceInformationBufferLength,*LengthOfDataCopied) PVOID DeviceInformationBuffer, - __in ULONG DeviceInformationBufferLength, - __inout PULONG LengthOfDataCopied - ); - -typedef USB_BUSIFFN_GET_DEVICE_INFORMATION *PUSB_BUSIFFN_GET_DEVICE_INFORMATION; - -__drv_functionClass(USB_BUSIFFN_GET_CONTROLLER_INFORMATION) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_GET_CONTROLLER_INFORMATION ( - __in PVOID BusContext, - __inout_bcount_part(ControllerInformationBufferLength, *LengthOfDataCopied) PVOID ControllerInformationBuffer, - __in ULONG ControllerInformationBufferLength, - __inout PULONG LengthOfDataCopied - ); - -typedef USB_BUSIFFN_GET_CONTROLLER_INFORMATION *PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION; - -__drv_functionClass(USB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ( - __in PVOID BusContext, - __in BOOLEAN Enable - ); - -typedef USB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND *PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND; - -/* - Not supported in LH -*/ -__drv_functionClass(USB_BUSIFFN_GET_EXTENDED_HUB_INFO) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_GET_EXTENDED_HUB_INFO ( - __in PVOID BusContext, - __in PDEVICE_OBJECT HubPhysicalDeviceObject, - __inout_bcount_part(HubInformationBufferLength, *LengthOfDataCopied) PVOID HubInformationBuffer, - __in ULONG HubInformationBufferLength, - __out PULONG LengthOfDataCopied - ); - -typedef USB_BUSIFFN_GET_EXTENDED_HUB_INFO *PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO; -/* - Not supported in LH -*/ -__drv_functionClass(USB_BUSIFFN_GET_ROOTHUB_SYM_NAME) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_GET_ROOTHUB_SYM_NAME ( - __in PVOID BusContext, - __inout_bcount_part(HubSymNameBufferLength, *HubSymNameActualLength) PVOID HubSymNameBuffer, - __in ULONG HubSymNameBufferLength, - __out PULONG HubSymNameActualLength - ); - -typedef USB_BUSIFFN_GET_ROOTHUB_SYM_NAME *PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME; - -__drv_functionClass(USB_BUSIFFN_GET_DEVICE_BUSCONTEXT) -typedef -PVOID -USB_BUSIFFN -USB_BUSIFFN_GET_DEVICE_BUSCONTEXT ( - __in PVOID HubBusContext, - __in PVOID DeviceHandle - ); - -typedef USB_BUSIFFN_GET_DEVICE_BUSCONTEXT *PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT; - -__drv_functionClass(USB_BUSIFFN_INITIALIZE_20HUB) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_INITIALIZE_20HUB ( - __in PVOID BusContext, - __in PUSB_DEVICE_HANDLE HubDeviceHandle, - __in ULONG TtCount - ); - -typedef USB_BUSIFFN_INITIALIZE_20HUB *PUSB_BUSIFFN_INITIALIZE_20HUB; - -__drv_functionClass(USB_BUSIFFN_IS_ROOT) -typedef -BOOLEAN -USB_BUSIFFN -USB_BUSIFFN_IS_ROOT ( - __in PVOID BusContext, - __in PVOID DeviceObject - ); - -typedef USB_BUSIFFN_IS_ROOT *PUSB_BUSIFFN_IS_ROOT; - -__drv_functionClass(USB_BUSIFFN_ACQUIRE_SEMAPHORE) -typedef -VOID -USB_BUSIFFN -USB_BUSIFFN_ACQUIRE_SEMAPHORE ( - __in PVOID BusContext - ); - -typedef USB_BUSIFFN_ACQUIRE_SEMAPHORE *PUSB_BUSIFFN_ACQUIRE_SEMAPHORE; - -__drv_functionClass(USB_BUSIFFN_RELEASE_SEMAPHORE) -typedef -VOID -USB_BUSIFFN -USB_BUSIFFN_RELEASE_SEMAPHORE ( - __in PVOID BusContext - ); - -typedef USB_BUSIFFN_RELEASE_SEMAPHORE *PUSB_BUSIFFN_RELEASE_SEMAPHORE; - -__drv_functionClass(RH_INIT_CALLBACK) -typedef -VOID -__stdcall -RH_INIT_CALLBACK ( - __in PVOID CallBackContext - ); - -typedef RH_INIT_CALLBACK *PRH_INIT_CALLBACK; - -__drv_functionClass(USB_BUSIFFN_ROOTHUB_INIT_NOTIFY) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_ROOTHUB_INIT_NOTIFY ( - __in PVOID BusContext, - __in PVOID CallbackContext, - __in PRH_INIT_CALLBACK CallbackRoutine - ); - -typedef USB_BUSIFFN_ROOTHUB_INIT_NOTIFY *PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY; - -__drv_functionClass(USB_BUSIFFN_FLUSH_TRANSFERS) -typedef -VOID -USB_BUSIFFN -USB_BUSIFFN_FLUSH_TRANSFERS ( - __in PVOID BusContext, - __in PVOID DeviceHandle - ); - -typedef USB_BUSIFFN_FLUSH_TRANSFERS *PUSB_BUSIFFN_FLUSH_TRANSFERS; - -__drv_functionClass(USB_BUSIFFN_CALC_PIPE_BANDWIDTH) -typedef -ULONG -USB_BUSIFFN -USB_BUSIFFN_CALC_PIPE_BANDWIDTH ( - __in PVOID BusContext, - __in PUSBD_PIPE_INFORMATION PipeInfo, - __in USB_DEVICE_SPEED DeviceSpeed - ); - -typedef USB_BUSIFFN_CALC_PIPE_BANDWIDTH *PUSB_BUSIFFN_CALC_PIPE_BANDWIDTH; - -__drv_functionClass(USB_BUSIFFN_SET_BUS_WAKE_MODE) -typedef -VOID -USB_BUSIFFN -USB_BUSIFFN_SET_BUS_WAKE_MODE ( - __in PVOID BusContext, - __in ULONG Mode - ); - -typedef USB_BUSIFFN_SET_BUS_WAKE_MODE *PUSB_BUSIFFN_SET_BUS_WAKE_MODE; - -__drv_functionClass(USB_BUSIFFN_SET_DEVICE_FLAG) -typedef -VOID -USB_BUSIFFN -USB_BUSIFFN_SET_DEVICE_FLAG ( - __in PVOID BusContext, - __in GUID *DeviceFlagGuid, - __in PVOID ValueData, - __in ULONG ValueLength - ); - -typedef USB_BUSIFFN_SET_DEVICE_FLAG *PUSB_BUSIFFN_SET_DEVICE_FLAG; - -__drv_functionClass(USB_BUSIFFN_SET_DEVHANDLE_DATA) -typedef -VOID -USB_BUSIFFN -USB_BUSIFFN_SET_DEVHANDLE_DATA ( - __in PVOID BusContext, - __in PVOID DeviceHandle, - __in PDEVICE_OBJECT UsbDevicePdo - ); - -typedef USB_BUSIFFN_SET_DEVHANDLE_DATA *PUSB_BUSIFFN_SET_DEVHANDLE_DATA; - -__drv_functionClass(USB_BUSIFFN_TEST_POINT) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_TEST_POINT ( - __in PVOID BusContext, - __in PVOID DeviceHandle, - __in ULONG Opcode, - __in PVOID TestData - ); - -typedef USB_BUSIFFN_TEST_POINT *PUSB_BUSIFFN_TEST_POINT; - -__drv_functionClass(USB_BUSIFFN_GET_DEVICE_PERFORMANCE_INFO) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_GET_DEVICE_PERFORMANCE_INFO ( - __in PVOID BusContext, - __in PUSB_DEVICE_HANDLE DeviceHandle, - __out_bcount_part(DeviceInformationBufferLength,*LengthOfDataCopied) PVOID DeviceInformationBuffer, - __in ULONG DeviceInformationBufferLength, - __inout PULONG LengthOfDataCopied - ); - -typedef USB_BUSIFFN_GET_DEVICE_PERFORMANCE_INFO *PUSB_BUSIFFN_GET_DEVICE_PERFORMANCE_INFO; - -__drv_functionClass(USB_BUSIFFN_WAIT_ASYNC_POWERUP) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_WAIT_ASYNC_POWERUP ( - __in PVOID BusContext - ); - -typedef USB_BUSIFFN_WAIT_ASYNC_POWERUP *PUSB_BUSIFFN_WAIT_ASYNC_POWERUP; - -__drv_functionClass(USB_BUSIFFN_GET_DEVICE_ADDRESS) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_GET_DEVICE_ADDRESS ( - __in PVOID BusContext, - __in PUSB_DEVICE_HANDLE DeviceHandle, - __out PUSHORT DeviceAddress - ); - -typedef USB_BUSIFFN_GET_DEVICE_ADDRESS *PUSB_BUSIFFN_GET_DEVICE_ADDRESS; - -__drv_functionClass(USB_BUSIFFN_DEREF_DEVICE_HANDLE) -typedef -VOID -USB_BUSIFFN -USB_BUSIFFN_DEREF_DEVICE_HANDLE ( - __in PVOID BusContext, - __in PUSB_DEVICE_HANDLE DeviceHandle, - __in PVOID Object, - __in ULONG Tag - ); - -typedef USB_BUSIFFN_DEREF_DEVICE_HANDLE *PUSB_BUSIFFN_DEREF_DEVICE_HANDLE; - -__drv_functionClass(USB_BUSIFFN_REF_DEVICE_HANDLE) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_REF_DEVICE_HANDLE ( - __in PVOID BusContext, - __in PUSB_DEVICE_HANDLE DeviceHandle, - __in PVOID Object, - __in ULONG Tag - ); - -typedef USB_BUSIFFN_REF_DEVICE_HANDLE *PUSB_BUSIFFN_REF_DEVICE_HANDLE; - -#define USB_IDLE_NOT_READY 0 -#define USB_IDLE_READY 1 - -__drv_functionClass(USB_BUSIFFN_SET_DEVICE_HANDLE_IDLE_READY_STATE) -typedef -ULONG -USB_BUSIFFN -USB_BUSIFFN_SET_DEVICE_HANDLE_IDLE_READY_STATE ( - __in PVOID BusContext, - __in PUSB_DEVICE_HANDLE DeviceHandle, - __in ULONG NewIdleReadyState - ); - -typedef USB_BUSIFFN_SET_DEVICE_HANDLE_IDLE_READY_STATE *PUSB_BUSIFFN_SET_DEVICE_HANDLE_IDLE_READY_STATE; - -__drv_functionClass(USB_BUSIFFN_GET_CONTAINER_ID_FOR_PORT) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_GET_CONTAINER_ID_FOR_PORT ( - __in PVOID BusContext, - __in USHORT PortNumber, - __out LPGUID ContainerId - ); - -typedef USB_BUSIFFN_GET_CONTAINER_ID_FOR_PORT *PUSB_BUSIFFN_GET_CONTAINER_ID_FOR_PORT; - -__drv_functionClass(USB_BUSIFFN_SET_CONTAINER_ID_FOR_PORT) -typedef -VOID -USB_BUSIFFN -USB_BUSIFFN_SET_CONTAINER_ID_FOR_PORT ( - __in PVOID BusContext, - __in USHORT PortNumber, - __in LPGUID ContainerId - ); - -typedef USB_BUSIFFN_SET_CONTAINER_ID_FOR_PORT *PUSB_BUSIFFN_SET_CONTAINER_ID_FOR_PORT; - -__drv_functionClass(USB_BUSIFFN_ABORT_ALL_DEVICE_PIPES) -typedef -NTSTATUS -USB_BUSIFFN -USB_BUSIFFN_ABORT_ALL_DEVICE_PIPES ( - __in PVOID BusContext, - __in PUSB_DEVICE_HANDLE DeviceHandle - ); - -typedef USB_BUSIFFN_ABORT_ALL_DEVICE_PIPES *PUSB_BUSIFFN_ABORT_ALL_DEVICE_PIPES; - -#define ERRATA_FLAG_RESET_TT_ON_CANCEL 1 -#define ERRATA_FLAG_NO_CLEAR_TT_BUFFER_ON_CANCEL 2 - -__drv_functionClass(USB_BUSIFFN_SET_DEVICE_ERRATA_FLAG) -typedef -VOID -USB_BUSIFFN -USB_BUSIFFN_SET_DEVICE_ERRATA_FLAG ( - __in PVOID BusContext, - __in PUSB_DEVICE_HANDLE DeviceHandle, - __in ULONG DeviceErrataFlag - ); - -typedef USB_BUSIFFN_SET_DEVICE_ERRATA_FLAG *PUSB_BUSIFFN_SET_DEVICE_ERRATA_FLAG; - - -#define USB_BUSIF_HUB_VERSION_0 0x0000 -#define USB_BUSIF_HUB_VERSION_1 0x0001 -#define USB_BUSIF_HUB_VERSION_2 0x0002 -#define USB_BUSIF_HUB_VERSION_3 0x0003 -#define USB_BUSIF_HUB_VERSION_4 0x0004 -#define USB_BUSIF_HUB_VERSION_5 0x0005 -#define USB_BUSIF_HUB_VERSION_6 0x0006 -#define USB_BUSIF_HUB_VERSION_7 0x0007 - -/* {B2BB8C0A-5AB4-11d3-A8CD-00C04F68747A}*/ -DEFINE_GUID(USB_BUS_INTERFACE_HUB_GUID, -0xb2bb8c0a, 0x5ab4, 0x11d3, 0xa8, 0xcd, 0x0, 0xc0, 0x4f, 0x68, 0x74, 0x7a); - -typedef struct _USB_BUS_INTERFACE_HUB_V0 { - - USHORT Size; - USHORT Version; - // returns - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - -} USB_BUS_INTERFACE_HUB_V0, *PUSB_BUS_INTERFACE_HUB_V0; - - -typedef struct _USB_BUS_INTERFACE_HUB_V1 { - - USHORT Size; - USHORT Version; - // returns - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - - // - // functions for the hub driver - // - PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice; - PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice; - PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; - PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; - PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; - - PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; - PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; - - -} USB_BUS_INTERFACE_HUB_V1, *PUSB_BUS_INTERFACE_HUB_V1; - -/* -*/ - -typedef struct _USB_BUS_INTERFACE_HUB_V2 { - - USHORT Size; - USHORT Version; - // returns - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - - // - // functions for the hub driver - // - PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice; - PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice; - PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; - PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; - PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; - - PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; - PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; - - // - // new functions for version 2 - // - PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation; - PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend; - PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation; - PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName; - PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext; - PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub; - -} USB_BUS_INTERFACE_HUB_V2, *PUSB_BUS_INTERFACE_HUB_V2; - - -typedef struct _USB_BUS_INTERFACE_HUB_V3 { - - USHORT Size; - USHORT Version; - // returns - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - - // - // functions for the hub driver - // - PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice; - PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice; - PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; - PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; - PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; - - PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; - PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; - - // - // new functions for version 2 - // - PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation; - PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend; - PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation; - PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName; - PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext; - PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub; - - // - // new for version 3 - // - - PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification; - -} USB_BUS_INTERFACE_HUB_V3, *PUSB_BUS_INTERFACE_HUB_V3; - - -typedef struct _USB_BUS_INTERFACE_HUB_V4 { - - USHORT Size; - USHORT Version; - // returns - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - - // - // functions for the hub driver - // - PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice; - PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice; - PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; - PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; - PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; - - PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; - PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; - - // - // new functions for version 2 - // - PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation; - PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend; - PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation; - PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName; - PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext; - PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub; - - // - // new for version 3 - // - - PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification; - - // - // new for version 4 - // - - PUSB_BUSIFFN_FLUSH_TRANSFERS FlushTransfers; - -} USB_BUS_INTERFACE_HUB_V4, *PUSB_BUS_INTERFACE_HUB_V4; - - -typedef struct _USB_BUS_INTERFACE_HUB_V5 { - - USHORT Size; - USHORT Version; - // returns - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - - // - // functions for the hub driver - // - PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice; - PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice; - PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; - PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; - PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; - - PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; - PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; - - // - // new functions for version 2 - // - PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation; - PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend; - PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation; - PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName; - PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext; - PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub; - - // - // new for version 3 - // - - PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification; - - // - // new for version 4 - // - - PUSB_BUSIFFN_FLUSH_TRANSFERS FlushTransfers; - - // new for version 5 - - PUSB_BUSIFFN_SET_DEVHANDLE_DATA SetDeviceHandleData; - -} USB_BUS_INTERFACE_HUB_V5, *PUSB_BUS_INTERFACE_HUB_V5; - - -typedef struct _USB_BUS_INTERFACE_HUB_V6 { - - USHORT Size; - USHORT Version; - // returns - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - - // - // functions for the hub driver - // - PUSB_BUSIFFN_CREATE_USB_DEVICE_EX CreateUsbDevice; - PUSB_BUSIFFN_INITIALIZE_USB_DEVICE_EX InitializeUsbDevice; - PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; - PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; - PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; - - PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; - PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; - - // - // new functions for version 2 - // - PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation; - PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend; - PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation; - PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName; - PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext; - PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub; - - // - // new for version 3 - // - - PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification; - - // - // new for version 4 - // - - PUSB_BUSIFFN_FLUSH_TRANSFERS FlushTransfers; - - // new for version 5 - - PUSB_BUSIFFN_SET_DEVHANDLE_DATA SetDeviceHandleData; - - // new for version 6 - Longhorn - - PUSB_BUSIFFN_IS_ROOT HubIsRoot; - PUSB_BUSIFFN_ACQUIRE_SEMAPHORE AcquireBusSemaphore; - PUSB_BUSIFFN_RELEASE_SEMAPHORE ReleaseBusSemaphore; - PUSB_BUSIFFN_CALC_PIPE_BANDWIDTH CaculatePipeBandwidth; - PUSB_BUSIFFN_SET_BUS_WAKE_MODE SetBusSystemWakeMode; - PUSB_BUSIFFN_SET_DEVICE_FLAG SetDeviceFlag; - PUSB_BUSIFFN_TEST_POINT HubTestPoint; - PUSB_BUSIFFN_GET_DEVICE_PERFORMANCE_INFO GetDevicePerformanceInfo; - PUSB_BUSIFFN_WAIT_ASYNC_POWERUP WaitAsyncPowerUp; - PUSB_BUSIFFN_GET_DEVICE_ADDRESS GetDeviceAddress; - PUSB_BUSIFFN_REF_DEVICE_HANDLE RefDeviceHandle; - PUSB_BUSIFFN_DEREF_DEVICE_HANDLE DerefDeviceHandle; - PUSB_BUSIFFN_SET_DEVICE_HANDLE_IDLE_READY_STATE SetDeviceHandleIdleReadyState; - -} USB_BUS_INTERFACE_HUB_V6, *PUSB_BUS_INTERFACE_HUB_V6; - - -typedef struct _USB_BUS_INTERFACE_HUB_V7 { - - USHORT Size; - USHORT Version; - // returns - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - - // - // functions for the hub driver - // - PUSB_BUSIFFN_CREATE_USB_DEVICE_EX CreateUsbDevice; - PUSB_BUSIFFN_INITIALIZE_USB_DEVICE_EX InitializeUsbDevice; - PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; - PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; - PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; - - PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; - PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; - - // - // new functions for version 2 - // - PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation; - PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend; - PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation; - PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName; - PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext; - PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub; - - // - // new for version 3 - // - - PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification; - - // - // new for version 4 - // - - PUSB_BUSIFFN_FLUSH_TRANSFERS FlushTransfers; - - // new for version 5 - - PUSB_BUSIFFN_SET_DEVHANDLE_DATA SetDeviceHandleData; - - // new for version 6 - Longhorn - - PUSB_BUSIFFN_IS_ROOT HubIsRoot; - PUSB_BUSIFFN_ACQUIRE_SEMAPHORE AcquireBusSemaphore; - PUSB_BUSIFFN_RELEASE_SEMAPHORE ReleaseBusSemaphore; - PUSB_BUSIFFN_CALC_PIPE_BANDWIDTH CaculatePipeBandwidth; - PUSB_BUSIFFN_SET_BUS_WAKE_MODE SetBusSystemWakeMode; - PUSB_BUSIFFN_SET_DEVICE_FLAG SetDeviceFlag; - PUSB_BUSIFFN_TEST_POINT HubTestPoint; - PUSB_BUSIFFN_GET_DEVICE_PERFORMANCE_INFO GetDevicePerformanceInfo; - PUSB_BUSIFFN_WAIT_ASYNC_POWERUP WaitAsyncPowerUp; - PUSB_BUSIFFN_GET_DEVICE_ADDRESS GetDeviceAddress; - PUSB_BUSIFFN_REF_DEVICE_HANDLE RefDeviceHandle; - PUSB_BUSIFFN_DEREF_DEVICE_HANDLE DerefDeviceHandle; - PUSB_BUSIFFN_SET_DEVICE_HANDLE_IDLE_READY_STATE SetDeviceHandleIdleReadyState; - - // - // new functions for version 7 - // - PUSB_BUSIFFN_CREATE_USB_DEVICE_V7 CreateUsbDeviceV7; - PUSB_BUSIFFN_GET_CONTAINER_ID_FOR_PORT GetContainerIdForPort; - PUSB_BUSIFFN_SET_CONTAINER_ID_FOR_PORT SetContainerIdForPort; - PUSB_BUSIFFN_ABORT_ALL_DEVICE_PIPES AbortAllDevicePipes; - PUSB_BUSIFFN_SET_DEVICE_ERRATA_FLAG SetDeviceErrataFlag; - -} USB_BUS_INTERFACE_HUB_V7, *PUSB_BUS_INTERFACE_HUB_V7; - - - - -#define USB_BUSIF_HUB_MIDUMP_VERSION_0 0x0000 - -/* {c5485f21-4e81-4a23-a8f9-d8518af45c3d} */ -DEFINE_GUID(USB_BUS_INTERFACE_HUB_MINIDUMP_GUID, -0xc5485f21, 0x4e81, 0x4a23, 0xa8, 0xf9, 0xd8, 0x51, 0x8a, 0xf4, 0x5c, 0x38); - - - -typedef VOID - (USB_BUSIFFN *PUSB_BUSIFFN_SET_MINIDUMP_FLAGS) ( - IN PVOID - ); - - - -/* -*/ - -typedef struct _USB_BUS_INTERFACE_HUB_MINIDUMP { - - USHORT Size; - USHORT Version; - // returns - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // - // functions for the hub driver - // - - PUSB_BUSIFFN_SET_MINIDUMP_FLAGS SetUsbPortMiniDumpFlags; - -} USB_BUS_INTERFACE_HUB_MINIDUMP, *PUSB_BUS_INTERFACE_HUB_MINIDUMP; - - -#define USB_BUSIF_HUB_SS_VERSION_0 0x0000 - -// {BFC3F363-8BA1-4c7b-97BA-9B12B1CA132F} -DEFINE_GUID(USB_BUS_INTERFACE_HUB_SS_GUID, -0xbfc3f363, 0x8ba1, 0x4c7b, 0x97, 0xba, 0x9b, 0x12, 0xb1, 0xca, 0x13, 0x2f); - -typedef NTSTATUS - (USB_BUSIFFN *PUSB_BUSIFFN_SUSPEND_HUB) ( - PDEVICE_OBJECT Pdo - ); - -typedef NTSTATUS - (USB_BUSIFFN *PUSB_BUSIFFN_RESUME_HUB) ( - PDEVICE_OBJECT Pdo - ); - - -typedef struct _USB_BUS_INTERFACE_HUB_SELECTIVE_SUSPEND { - - USHORT Size; - USHORT Version; - - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - - PUSB_BUSIFFN_SUSPEND_HUB SuspendHub; - PUSB_BUSIFFN_RESUME_HUB ResumeHub; -} USB_BUS_INTERFACE_HUB_SELECTIVE_SUSPEND, *PUSB_BUS_INTERFACE_HUB_SELECTIVE_SUSPEND; - - - - -/* - The following structures are used by the GetDeviceInformation APIs -*/ - -#include - -typedef struct _USB_PIPE_INFORMATION_0 { - - /* pad descriptors to maintain DWORD alignment */ - USB_ENDPOINT_DESCRIPTOR EndpointDescriptor; - UCHAR ED_Pad[1]; - - ULONG ScheduleOffset; -} USB_PIPE_INFORMATION_0, *PUSB_PIPE_INFORMATION_0; - -typedef struct _USB_LEVEL_INFORMATION { - - /* inputs: information level requested */ - ULONG InformationLevel; - - /* outputs: */ - ULONG ActualLength; - -} USB_LEVEL_INFORMATION, *PUSB_LEVEL_INFORMATION; - -typedef struct _USB_DEVICE_INFORMATION_0 { - - /* inputs: information level requested */ - ULONG InformationLevel; - - /* outputs: */ - ULONG ActualLength; - - /* begin level_0 information */ - ULONG PortNumber; - - /* pad descriptors to maintain DWORD alignment */ - USB_DEVICE_DESCRIPTOR DeviceDescriptor; - UCHAR DD_pad[2]; - - UCHAR CurrentConfigurationValue; - UCHAR ReservedMBZ; - USHORT DeviceAddress; - - ULONG HubAddress; - - USB_DEVICE_SPEED DeviceSpeed; - USB_DEVICE_TYPE DeviceType; - - ULONG NumberOfOpenPipes; - - USB_PIPE_INFORMATION_0 PipeList[1]; - -} USB_DEVICE_INFORMATION_0, *PUSB_DEVICE_INFORMATION_0; - - - -typedef struct _USB_CONTROLLER_INFORMATION_0 { - - ULONG InformationLevel; - ULONG ActualLength; - BOOLEAN SelectiveSuspendEnabled; - BOOLEAN IsHighSpeedController; - -} USB_CONTROLLER_INFORMATION_0, *PUSB_CONTROLLER_INFORMATION_0; - - -typedef struct _USB_CONTROLLER_INFORMATION_1 { - - ULONG InformationLevel; - ULONG ActualLength; - BOOLEAN SelectiveSuspendEnabled; - BOOLEAN IsHighSpeedController; - ULONG HcBusNumber; - ULONG HcBusDevice; - ULONG HcBusFunction; - -} USB_CONTROLLER_INFORMATION_1, *PUSB_CONTROLLER_INFORMATION_1; - - - -/* - Structures that define extended hub port characteristics -*/ - -typedef struct _USB_EXTPORT_INFORMATION_0 { - /* - physical port ie number passed in control commands 1, 2, 3..255 - */ - ULONG PhysicalPortNumber; - /* - label on port may not natch the physical number - */ - ULONG PortLabelNumber; - - USHORT VidOverride; - USHORT PidOverride; - /* - extended port attributes as defined in usb.h - */ - ULONG PortAttributes; -} USB_EXTPORT_INFORMATION_0, *PUSB_EXTPORT_INFORMATION; - - -typedef struct _USB_EXTHUB_INFORMATION_0 { - - /* inputs: information level requested */ - ULONG InformationLevel; - - /* begin level_0 information */ - ULONG NumberOfPorts; - - /* hubs don't have > 255 ports */ - USB_EXTPORT_INFORMATION_0 Port[255]; - -} USB_EXTHUB_INFORMATION_0, *PUSB_EXTHUB_INFORMATION_0; - -/* -* Structures used by the GetPerformanceInfo APIs -*/ - -typedef struct _USB_DEVICE_PERFORMANCE_INFO_0 { - - /* inputs: information level requested */ - ULONG InformationLevel; - - /* outputs: */ - ULONG ActualLength; - - // total BulkBytes transfered for this device - ULONG BulkBytes; - ULONG BulkUrbCount; - - // total control bytes transfered for this device - ULONG ControlDataBytes; - ULONG ControlUrbCount; - - // total iso bytes transfered for this device - ULONG IsoBytes; - ULONG IsoUrbCount; - - // total interrupt bytes transfered for this device - ULONG InterruptBytes; - ULONG InterruptUrbCount; - - // BW in bytes alloced in bits/32ms - ULONG AllocedInterrupt[6]; - ULONG AllocedIso; - - // Total BW available on the bus in bits/32ms - ULONG Total32secBandwidth; - - // Total BW available on the device's TT in bits/32ms - ULONG TotalTtBandwidth; - - // Count of the total time left between scheduling iso transfers and their start frame - ULONG TotalIsoLatency; - - // ISO packet errors, etc, that are NOT late - ULONG DroppedIsoPackets; - - // Number of transfer URBs completing with errors - ULONG TransferErrors; - -} USB_DEVICE_PERFORMANCE_INFO_0, *PUSB_DEVICE_PERFORMANCE_INFO_0; - -#include - -#endif - -#endif /* __HUBBUSIF_H */ - - - diff --git a/pub/ddk/i2cgpio.h b/pub/ddk/i2cgpio.h deleted file mode 100644 index 6c81714..0000000 --- a/pub/ddk/i2cgpio.h +++ /dev/null @@ -1,162 +0,0 @@ -//==========================================================================; -// -// 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__ - - diff --git a/pub/ddk/imgerror.h b/pub/ddk/imgerror.h deleted file mode 100644 index 1172b38..0000000 --- a/pub/ddk/imgerror.h +++ /dev/null @@ -1,423 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for imgerror.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __imgerror_h__ -#define __imgerror_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IImgErrorInfo_FWD_DEFINED__ -#define __IImgErrorInfo_FWD_DEFINED__ -typedef interface IImgErrorInfo IImgErrorInfo; -#endif /* __IImgErrorInfo_FWD_DEFINED__ */ - - -#ifndef __IImgCreateErrorInfo_FWD_DEFINED__ -#define __IImgCreateErrorInfo_FWD_DEFINED__ -typedef interface IImgCreateErrorInfo IImgCreateErrorInfo; -#endif /* __IImgCreateErrorInfo_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_imgerror_0000_0000 */ -/* [local] */ - -//+------------------------------------------------------------------------- -// -// Microsoft Windows -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//-------------------------------------------------------------------------- - - -typedef /* [public][public][public] */ struct __MIDL___MIDL_itf_imgerror_0000_0000_0001 - { - BSTR description; - GUID guid; - DWORD helpContext; - BSTR helpFile; - BSTR source; - BSTR devDescription; - GUID errorID; - ULONG cUserParameters; - BSTR *aUserParameters; - BSTR userFallback; - DWORD exceptionID; - } ImgErrorInfo; - - - -extern RPC_IF_HANDLE __MIDL_itf_imgerror_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_imgerror_0000_0000_v0_0_s_ifspec; - -#ifndef __IImgErrorInfo_INTERFACE_DEFINED__ -#define __IImgErrorInfo_INTERFACE_DEFINED__ - -/* interface IImgErrorInfo */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IImgErrorInfo; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("2bce4ece-d30e-445a-9423-6829be945ad8") - IImgErrorInfo : public IErrorInfo - { - public: - virtual HRESULT STDMETHODCALLTYPE GetDeveloperDescription( - /* [annotation][out] */ - __out BSTR *pbstrDevDescription) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetUserErrorId( - /* [annotation][out] */ - __out GUID *pErrorId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetUserParameterCount( - /* [annotation][out] */ - __out ULONG *pcUserParams) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetUserParameter( - /* [annotation][in] */ - __in ULONG cParam, - /* [annotation][out] */ - __out BSTR *pbstrParam) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetUserFallback( - /* [annotation][out] */ - __out BSTR *pbstrFallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetExceptionId( - /* [annotation][out] */ - __out DWORD *pExceptionId) = 0; - - virtual HRESULT STDMETHODCALLTYPE DetachErrorInfo( - /* [annotation][out] */ - __out ImgErrorInfo *pErrorInfo) = 0; - - }; - -#else /* C style interface */ - - typedef struct IImgErrorInfoVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IImgErrorInfo * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IImgErrorInfo * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IImgErrorInfo * This); - - HRESULT ( STDMETHODCALLTYPE *GetGUID )( - IImgErrorInfo * This, - /* [out] */ GUID *pGUID); - - HRESULT ( STDMETHODCALLTYPE *GetSource )( - IImgErrorInfo * This, - /* [out] */ BSTR *pBstrSource); - - HRESULT ( STDMETHODCALLTYPE *GetDescription )( - IImgErrorInfo * This, - /* [out] */ BSTR *pBstrDescription); - - HRESULT ( STDMETHODCALLTYPE *GetHelpFile )( - IImgErrorInfo * This, - /* [out] */ BSTR *pBstrHelpFile); - - HRESULT ( STDMETHODCALLTYPE *GetHelpContext )( - IImgErrorInfo * This, - /* [out] */ DWORD *pdwHelpContext); - - HRESULT ( STDMETHODCALLTYPE *GetDeveloperDescription )( - IImgErrorInfo * This, - /* [annotation][out] */ - __out BSTR *pbstrDevDescription); - - HRESULT ( STDMETHODCALLTYPE *GetUserErrorId )( - IImgErrorInfo * This, - /* [annotation][out] */ - __out GUID *pErrorId); - - HRESULT ( STDMETHODCALLTYPE *GetUserParameterCount )( - IImgErrorInfo * This, - /* [annotation][out] */ - __out ULONG *pcUserParams); - - HRESULT ( STDMETHODCALLTYPE *GetUserParameter )( - IImgErrorInfo * This, - /* [annotation][in] */ - __in ULONG cParam, - /* [annotation][out] */ - __out BSTR *pbstrParam); - - HRESULT ( STDMETHODCALLTYPE *GetUserFallback )( - IImgErrorInfo * This, - /* [annotation][out] */ - __out BSTR *pbstrFallback); - - HRESULT ( STDMETHODCALLTYPE *GetExceptionId )( - IImgErrorInfo * This, - /* [annotation][out] */ - __out DWORD *pExceptionId); - - HRESULT ( STDMETHODCALLTYPE *DetachErrorInfo )( - IImgErrorInfo * This, - /* [annotation][out] */ - __out ImgErrorInfo *pErrorInfo); - - END_INTERFACE - } IImgErrorInfoVtbl; - - interface IImgErrorInfo - { - CONST_VTBL struct IImgErrorInfoVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IImgErrorInfo_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IImgErrorInfo_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IImgErrorInfo_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IImgErrorInfo_GetGUID(This,pGUID) \ - ( (This)->lpVtbl -> GetGUID(This,pGUID) ) - -#define IImgErrorInfo_GetSource(This,pBstrSource) \ - ( (This)->lpVtbl -> GetSource(This,pBstrSource) ) - -#define IImgErrorInfo_GetDescription(This,pBstrDescription) \ - ( (This)->lpVtbl -> GetDescription(This,pBstrDescription) ) - -#define IImgErrorInfo_GetHelpFile(This,pBstrHelpFile) \ - ( (This)->lpVtbl -> GetHelpFile(This,pBstrHelpFile) ) - -#define IImgErrorInfo_GetHelpContext(This,pdwHelpContext) \ - ( (This)->lpVtbl -> GetHelpContext(This,pdwHelpContext) ) - - -#define IImgErrorInfo_GetDeveloperDescription(This,pbstrDevDescription) \ - ( (This)->lpVtbl -> GetDeveloperDescription(This,pbstrDevDescription) ) - -#define IImgErrorInfo_GetUserErrorId(This,pErrorId) \ - ( (This)->lpVtbl -> GetUserErrorId(This,pErrorId) ) - -#define IImgErrorInfo_GetUserParameterCount(This,pcUserParams) \ - ( (This)->lpVtbl -> GetUserParameterCount(This,pcUserParams) ) - -#define IImgErrorInfo_GetUserParameter(This,cParam,pbstrParam) \ - ( (This)->lpVtbl -> GetUserParameter(This,cParam,pbstrParam) ) - -#define IImgErrorInfo_GetUserFallback(This,pbstrFallback) \ - ( (This)->lpVtbl -> GetUserFallback(This,pbstrFallback) ) - -#define IImgErrorInfo_GetExceptionId(This,pExceptionId) \ - ( (This)->lpVtbl -> GetExceptionId(This,pExceptionId) ) - -#define IImgErrorInfo_DetachErrorInfo(This,pErrorInfo) \ - ( (This)->lpVtbl -> DetachErrorInfo(This,pErrorInfo) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IImgErrorInfo_INTERFACE_DEFINED__ */ - - -#ifndef __IImgCreateErrorInfo_INTERFACE_DEFINED__ -#define __IImgCreateErrorInfo_INTERFACE_DEFINED__ - -/* interface IImgCreateErrorInfo */ -/* [ref][helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IImgCreateErrorInfo; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1c55a64c-07cd-4fb5-90f7-b753d91f0c9e") - IImgCreateErrorInfo : public ICreateErrorInfo - { - public: - virtual HRESULT STDMETHODCALLTYPE AttachToErrorInfo( - /* [annotation][out][in] */ - __inout ImgErrorInfo *pErrorInfo) = 0; - - }; - -#else /* C style interface */ - - typedef struct IImgCreateErrorInfoVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IImgCreateErrorInfo * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IImgCreateErrorInfo * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IImgCreateErrorInfo * This); - - HRESULT ( STDMETHODCALLTYPE *SetGUID )( - IImgCreateErrorInfo * This, - /* [in] */ REFGUID rguid); - - HRESULT ( STDMETHODCALLTYPE *SetSource )( - IImgCreateErrorInfo * This, - /* [in] */ LPOLESTR szSource); - - HRESULT ( STDMETHODCALLTYPE *SetDescription )( - IImgCreateErrorInfo * This, - /* [in] */ LPOLESTR szDescription); - - HRESULT ( STDMETHODCALLTYPE *SetHelpFile )( - IImgCreateErrorInfo * This, - /* [in] */ LPOLESTR szHelpFile); - - HRESULT ( STDMETHODCALLTYPE *SetHelpContext )( - IImgCreateErrorInfo * This, - /* [in] */ DWORD dwHelpContext); - - HRESULT ( STDMETHODCALLTYPE *AttachToErrorInfo )( - IImgCreateErrorInfo * This, - /* [annotation][out][in] */ - __inout ImgErrorInfo *pErrorInfo); - - END_INTERFACE - } IImgCreateErrorInfoVtbl; - - interface IImgCreateErrorInfo - { - CONST_VTBL struct IImgCreateErrorInfoVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IImgCreateErrorInfo_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IImgCreateErrorInfo_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IImgCreateErrorInfo_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IImgCreateErrorInfo_SetGUID(This,rguid) \ - ( (This)->lpVtbl -> SetGUID(This,rguid) ) - -#define IImgCreateErrorInfo_SetSource(This,szSource) \ - ( (This)->lpVtbl -> SetSource(This,szSource) ) - -#define IImgCreateErrorInfo_SetDescription(This,szDescription) \ - ( (This)->lpVtbl -> SetDescription(This,szDescription) ) - -#define IImgCreateErrorInfo_SetHelpFile(This,szHelpFile) \ - ( (This)->lpVtbl -> SetHelpFile(This,szHelpFile) ) - -#define IImgCreateErrorInfo_SetHelpContext(This,dwHelpContext) \ - ( (This)->lpVtbl -> SetHelpContext(This,dwHelpContext) ) - - -#define IImgCreateErrorInfo_AttachToErrorInfo(This,pErrorInfo) \ - ( (This)->lpVtbl -> AttachToErrorInfo(This,pErrorInfo) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IImgCreateErrorInfo_INTERFACE_DEFINED__ */ - - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/imgerror.idl b/pub/ddk/imgerror.idl deleted file mode 100644 index 270d1f5..0000000 --- a/pub/ddk/imgerror.idl +++ /dev/null @@ -1,124 +0,0 @@ -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Abstract: -// Contains the definition of the IImgErrorInfo interface used to describe -// extra error state. This inherits from the COM IErrorInfo interface. -// -// Notes: -// IImgErrorInfo stores its state in an ImgErrorInfo structure that can -// be detached from the class implementation. IImgErrorInfo is NOT thread -// safe. -// -// History: -// 2003/10/20-mlawrenc -// Created - removed from imgdata.idl to provide better sanitization -// from the rest of the imgdata interface, also in prepartaion -// of moving to Musl. -// -//---------------------------------------------------------------------------- -cpp_quote("//+-------------------------------------------------------------------------") -cpp_quote("//") -cpp_quote("// Microsoft Windows") -cpp_quote("// Copyright (c) Microsoft Corporation. All rights reserved.") -cpp_quote("//") -cpp_quote("//--------------------------------------------------------------------------") - -import "oaidl.idl"; - -// -// Interfaces used for extended error information. -// -interface IImgErrorInfo; -interface IImgCreateErrorInfo; - -typedef struct -{ - // - // IErrorInfo fields - // - BSTR description; - GUID guid; - DWORD helpContext; - BSTR helpFile; - BSTR source; - - // - // IImgErrorInfo fields - // - BSTR devDescription; - GUID errorID; - ULONG cUserParameters; - [size_is(cUserParameters)] BSTR *aUserParameters; - BSTR userFallback; - DWORD exceptionID; - -} ImgErrorInfo; - -[ - object, - uuid(2bce4ece-d30e-445a-9423-6829be945ad8), - local, - helpstring("Extended error information class, this is used to allow our exceptions to chain correctly across DLL/Machine boundaries."), - pointer_default(ref) -] -interface IImgErrorInfo : IErrorInfo -{ - HRESULT - GetDeveloperDescription( - [out, annotation("__out")] BSTR *pbstrDevDescription - ); - - HRESULT - GetUserErrorId( - [out, annotation("__out")] GUID *pErrorId - ); - - HRESULT - GetUserParameterCount( - [out, annotation("__out")] ULONG *pcUserParams - ); - - HRESULT - GetUserParameter( - [in, annotation("__in")] ULONG cParam, - [out, annotation("__out")] BSTR *pbstrParam - ); - - HRESULT - GetUserFallback( - [out, annotation("__out")] BSTR *pbstrFallback - ); - - HRESULT - GetExceptionId( - [out, annotation("__out")] DWORD *pExceptionId - ); - - HRESULT - DetachErrorInfo( - [out, annotation("__out")] ImgErrorInfo *pErrorInfo - ); -} - -[ - object, - uuid(1c55a64c-07cd-4fb5-90f7-b753d91f0c9e), - local, - helpstring("Class that can be used to create extended error information."), - pointer_default(ref) -] -interface IImgCreateErrorInfo : ICreateErrorInfo -{ - HRESULT - AttachToErrorInfo( - [in, out, annotation("__inout")] ImgErrorInfo *pErrorInfo - ); -} - - - - - - diff --git a/pub/ddk/ioaccess.h b/pub/ddk/ioaccess.h deleted file mode 100644 index 6204130..0000000 --- a/pub/ddk/ioaccess.h +++ /dev/null @@ -1,468 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ioaccess.h - -Abstract: - - Definitions of function prototypes for accessing I/O ports and - memory on I/O adapters from display drivers. - - Cloned from parts of nti386.h. - -Author: - - ---*/ - -// -// Note: IA64 is for 64 bits Merced. Under Merced compiler option, we don't have -// _X86_, instead, we use _IA64_. Same thing, _AXP64_ is for 64 bits compiler -// option for ALPHA -// -#if defined(_MIPS_) || defined(_X86_) || defined(_AMD64_) - -// -// Memory barriers on X86 and MIPS are not required since the Io -// Operations are always garanteed to be executed in order -// - -#define MEMORY_BARRIER() 0 - - -#elif defined(_IA64_) - -// -// Itanium requires memory barriers -// - -void __mf(); - -#define MEMORY_BARRIER() __mf() - -#elif defined(_PPC_) - -// -// A memory barrier function is provided by the PowerPC Enforce -// In-order Execution of I/O instruction (eieio). -// - -#if defined(_M_PPC) && defined(_MSC_VER) && (_MSC_VER>=1000) -void __emit( unsigned const __int32 ); -#define __builtin_eieio() __emit( 0x7C0006AC ) -#else -void __builtin_eieio(void); -#endif - -#define MEMORY_BARRIER() __builtin_eieio() - - -#elif defined(_ALPHA_) || (_AXP64_) - -// -// ALPHA requires memory barriers -// - -#define MEMORY_BARRIER() __MB() - - - -#endif - -#ifndef NO_PORT_MACROS - - - -// -// I/O space read and write macros. -// -// The READ/WRITE_REGISTER_* calls manipulate MEMORY registers. -// (Use x86 move instructions, with LOCK prefix to force correct behavior -// w.r.t. caches and write buffers.) -// -// The READ/WRITE_PORT_* calls manipulate I/O ports. -// (Use x86 in/out instructions.) -// - - -// -// inp(),inpw(), inpd(), outp(), outpw(), outpd() are X86 specific intrinsic -// inline functions. So for IA64, we have to put READ_PORT_USHORT() etc. back -// to it's supposed to be, defined in sdk\inc\wdm.h -// -#if defined(_IA64_) -#define READ_REGISTER_UCHAR(Register) (*(volatile UCHAR *)(Register)) -#define READ_REGISTER_USHORT(Register) (*(volatile USHORT *)(Register)) -#define READ_REGISTER_ULONG(Register) (*(volatile ULONG *)(Register)) -#define WRITE_REGISTER_UCHAR(Register, Value) (*(volatile UCHAR *)(Register) = (Value)) -#define WRITE_REGISTER_USHORT(Register, Value) (*(volatile USHORT *)(Register) = (Value)) -#define WRITE_REGISTER_ULONG(Register, Value) (*(volatile ULONG *)(Register) = (Value)) - -__declspec(dllimport) -UCHAR -READ_PORT_UCHAR( - __in PVOID Port - ); - -__declspec(dllimport) -USHORT -READ_PORT_USHORT( - __in PVOID Port - ); - -__declspec(dllimport) -ULONG -READ_PORT_ULONG( - __in PVOID Port - ); - -// -// All these function prototypes take a ULONG as a parameter so that -// we don't force an extra typecast in the code (which will cause -// the X86 to generate bad code). -// - -__declspec(dllimport) -VOID -WRITE_PORT_UCHAR( - __in PVOID Port, - __in ULONG Value - ); - -__declspec(dllimport) -VOID -WRITE_PORT_USHORT( - __in PVOID Port, - __in ULONG Value - ); - -__declspec(dllimport) -VOID -WRITE_PORT_ULONG( - __in PVOID Port, - __in ULONG Value - ); - -#elif defined(_X86_) -#define READ_REGISTER_UCHAR(Register) (*(volatile UCHAR *)(Register)) -#define READ_REGISTER_USHORT(Register) (*(volatile USHORT *)(Register)) -#define READ_REGISTER_ULONG(Register) (*(volatile ULONG *)(Register)) -#define WRITE_REGISTER_UCHAR(Register, Value) (*(volatile UCHAR *)(Register) = (Value)) -#define WRITE_REGISTER_USHORT(Register, Value) (*(volatile USHORT *)(Register) = (Value)) -#define WRITE_REGISTER_ULONG(Register, Value) (*(volatile ULONG *)(Register) = (Value)) -#define READ_PORT_UCHAR(Port) (UCHAR)(inp (Port)) -#define READ_PORT_USHORT(Port) (USHORT)(inpw (Port)) -#define READ_PORT_ULONG(Port) (ULONG)(inpd (Port)) -#define WRITE_PORT_UCHAR(Port, Value) outp ((Port), (Value)) -#define WRITE_PORT_USHORT(Port, Value) outpw ((Port), (Value)) -#define WRITE_PORT_ULONG(Port, Value) outpd ((Port), (Value)) - -#elif defined(_PPC_) || defined(_MIPS_) - -#define READ_REGISTER_UCHAR(x) (*(volatile UCHAR * const)(x)) -#define READ_REGISTER_USHORT(x) (*(volatile USHORT * const)(x)) -#define READ_REGISTER_ULONG(x) (*(volatile ULONG * const)(x)) -#define WRITE_REGISTER_UCHAR(x, y) (*(volatile UCHAR * const)(x) = (y)) -#define WRITE_REGISTER_USHORT(x, y) (*(volatile USHORT * const)(x) = (y)) -#define WRITE_REGISTER_ULONG(x, y) (*(volatile ULONG * const)(x) = (y)) -#define READ_PORT_UCHAR(x) READ_REGISTER_UCHAR(x) -#define READ_PORT_USHORT(x) READ_REGISTER_USHORT(x) -#define READ_PORT_ULONG(x) READ_REGISTER_ULONG(x) - -// -// All these macros take a ULONG as a parameter so that we don't -// force an extra typecast in the code (which will cause the X86 to -// generate bad code). -// - -#define WRITE_PORT_UCHAR(x, y) WRITE_REGISTER_UCHAR(x, (UCHAR) (y)) -#define WRITE_PORT_USHORT(x, y) WRITE_REGISTER_USHORT(x, (USHORT) (y)) -#define WRITE_PORT_ULONG(x, y) WRITE_REGISTER_ULONG(x, (ULONG) (y)) - - -#elif defined(_ALPHA_) || (_AXP64_) - -// -// READ/WRITE_PORT/REGISTER_UCHAR_USHORT_ULONG are all functions that -// go to the HAL on ALPHA -// -// So we only put the prototypes here -// - -__declspec(dllimport) -UCHAR -READ_REGISTER_UCHAR( - __in PVOID Register - ); - -__declspec(dllimport) -USHORT -READ_REGISTER_USHORT( - __in PVOID Register - ); - -__declspec(dllimport) -ULONG -READ_REGISTER_ULONG( - __in PVOID Register - ); - -__declspec(dllimport) -VOID -WRITE_REGISTER_UCHAR( - __in PVOID Register, - UCHAR Value - ); - -__declspec(dllimport) -VOID -WRITE_REGISTER_USHORT( - __in PVOID Register, - __in USHORT Value - ); - -__declspec(dllimport) -VOID -WRITE_REGISTER_ULONG( - __in PVOID Register, - __in ULONG Value - ); - -__declspec(dllimport) -UCHAR -READ_PORT_UCHAR( - __in PVOID Port - ); - -__declspec(dllimport) -USHORT -READ_PORT_USHORT( - __in PVOID Port - ); - -__declspec(dllimport) -ULONG -READ_PORT_ULONG( - __in PVOID Port - ); - -// -// All these function prototypes take a ULONG as a parameter so that -// we don't force an extra typecast in the code (which will cause -// the X86 to generate bad code). -// - -__declspec(dllimport) -VOID -WRITE_PORT_UCHAR( - __in PVOID Port, - __in ULONG Value - ); - -__declspec(dllimport) -VOID -WRITE_PORT_USHORT( - __in PVOID Port, - __in ULONG Value - ); - -__declspec(dllimport) -VOID -WRITE_PORT_ULONG( - __in PVOID Port, - __in ULONG Value - ); - -#elif defined(_AMD64_) - -UCHAR -__inbyte ( - __in USHORT Port - ); - -USHORT -__inword ( - __in USHORT Port - ); - -ULONG -__indword ( - __in USHORT Port - ); - -VOID -__outbyte ( - __in USHORT Port, - __in UCHAR Data - ); - -VOID -__outword ( - __in USHORT Port, - __in USHORT Data - ); - -VOID -__outdword ( - __in USHORT Port, - __in ULONG Data - ); - -#pragma intrinsic(__inbyte) -#pragma intrinsic(__inword) -#pragma intrinsic(__indword) -#pragma intrinsic(__outbyte) -#pragma intrinsic(__outword) -#pragma intrinsic(__outdword) - -LONG -_InterlockedOr ( - __inout LONG volatile *Target, - __in LONG Set - ); - -#pragma intrinsic(_InterlockedOr) - - -__inline -UCHAR -READ_REGISTER_UCHAR ( - __in PVOID Register - ) -{ - return *(UCHAR volatile *)Register; -} - -__inline -USHORT -READ_REGISTER_USHORT ( - __in PVOID Register - ) -{ - return *(USHORT volatile *)Register; -} - -__inline -ULONG -READ_REGISTER_ULONG ( - __in PVOID Register - ) -{ - return *(ULONG volatile *)Register; -} - -__inline -VOID -WRITE_REGISTER_UCHAR ( - __in PVOID Register, - __in UCHAR Value - ) -{ - LONG Synch; - - *(UCHAR volatile *)Register = Value; - _InterlockedOr(&Synch, 1); - return; -} - -__inline -VOID -WRITE_REGISTER_USHORT ( - __in PVOID Register, - __in USHORT Value - ) -{ - LONG Synch; - - *(USHORT volatile *)Register = Value; - _InterlockedOr(&Synch, 1); - return; -} - -__inline -VOID -WRITE_REGISTER_ULONG ( - __in PVOID Register, - __in ULONG Value - ) -{ - LONG Synch; - - *(ULONG volatile *)Register = Value; - _InterlockedOr(&Synch, 1); - return; -} - -__inline -UCHAR -READ_PORT_UCHAR ( - __in PVOID Port - ) - -{ - return __inbyte((USHORT)((ULONG64)Port)); -} - -__inline -USHORT -READ_PORT_USHORT ( - __in PVOID Port - ) - -{ - return __inword((USHORT)((ULONG64)Port)); -} - -__inline -ULONG -READ_PORT_ULONG ( - __in PVOID Port - ) - -{ - return __indword((USHORT)((ULONG64)Port)); -} - -__inline -VOID -WRITE_PORT_UCHAR ( - __in PVOID Port, - __in UCHAR Value - ) - -{ - __outbyte((USHORT)((ULONG64)Port), Value); - return; -} - -__inline -VOID -WRITE_PORT_USHORT ( - __in PVOID Port, - __in USHORT Value - ) - -{ - __outword((USHORT)((ULONG64)Port), Value); - return; -} - -__inline -VOID -WRITE_PORT_ULONG ( - __in PVOID Port, - __in ULONG Value - ) - -{ - __outdword((USHORT)((ULONG64)Port), Value); - return; -} - -#endif // NO_PORT_MACROS - -#endif - diff --git a/pub/ddk/iointex.h b/pub/ddk/iointex.h deleted file mode 100644 index d594a0e..0000000 --- a/pub/ddk/iointex.h +++ /dev/null @@ -1,73 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - iointex.h - -Abstract: - - This header exposes the new kernel APIs to connect and disconnect - interrupts in a manner that makes it possible for drivers referencing - these new APIs to run on downlevel systems. - ---*/ - -#ifndef _IOINTEX_IOINTEX_H_ -#define _IOINTEX_IOINTEX_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Supply an overrideable library implementation of IoConnectInterruptEx. -// See DDK documentation for more details on this API. -// - -#undef IoConnectInterruptEx -#define IoConnectInterruptEx WdmlibIoConnectInterruptEx - -__drv_requiresIRQL(PASSIVE_LEVEL) -NTSTATUS -WdmlibIoConnectInterruptEx ( - __inout PIO_CONNECT_INTERRUPT_PARAMETERS Parameters - ); - -// -// Supply an overrideable library implementation of IoDisconnectInterruptEx. -// See DDK documentation for more details on this API. -// - -#undef IoDisconnectInterruptEx -#define IoDisconnectInterruptEx WdmlibIoDisconnectInterruptEx - -__drv_requiresIRQL(PASSIVE_LEVEL) -NTSTATUS -WdmlibIoDisconnectInterruptEx ( - __inout PIO_DISCONNECT_INTERRUPT_PARAMETERS Parameters - ); - -// -// Supply an overrideable library implementation of IoGetAffinityInterrupt. -// See DDK documentation for more details on this API. -// - -#undef IoGetAffinityInterrupt -#define IoGetAffinityInterrupt WdmlibIoGetAffinityInterrupt - -NTSTATUS -WdmlibIoGetAffinityInterrupt ( - __in PKINTERRUPT InterruptObject, - __out PGROUP_AFFINITY GroupAffinity - ); - - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // !defined(_IOINTEX_IOINTEX_H_) - diff --git a/pub/ddk/ip6firewall.h b/pub/ddk/ip6firewall.h deleted file mode 100644 index b55877b..0000000 --- a/pub/ddk/ip6firewall.h +++ /dev/null @@ -1,112 +0,0 @@ -/*++ - -Copyright (c) 2004-2005 Microsoft Corporation - -Module Name: - - ip6firewall.h - -Abstract: - - This module contains definitions for the IPv6 firewall hook. - -Environment: - - Kernel mode only. - ---*/ - -#if (NTDDI_VERSION < NTDDI_LONGHORN) - -#ifndef _IP6FIREWALL_ -#define _IP6FIREWALL_ - -#pragma once - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Types used by the firewall hook. -// - -typedef enum { - DirectionTransmit, - DirectionReceive, - DirectionMax -} IPv6Direction; - -typedef enum { - ActionAccept, - ActionDrop, - ActionMax -} IPv6Action; - -__drv_functionClass(IPv6FirewallHookProcType) -__drv_maxIRQL(DISPATCH_LEVEL) -typedef -IPv6Action -IPv6FirewallHookProcType ( - __in const IPv6Addr *SourceAddress, - __in const IPv6Addr *DestinationAddress, - __in uint PayloadLength, - __in uchar HeaderType, - __in const uchar *HeaderData, - __in const void *PacketContext, - __in uint DataLength, - __in uint InterfaceIndex, - __in IPv6Direction Direction, - __in BOOLEAN IsLoopBack - ); - -typedef IPv6FirewallHookProcType *IPv6FirewallHookProc; - -typedef void -(*IPv6FirewallDeregistrationCompleteProc)( - ); - -// -// Exported function declarations. -// - -extern NTSTATUS -__drv_maxIRQL(DISPATCH_LEVEL) -__success(return==STATUS_SUCCESS) -IPv6EnableFirewallHook( - __in IPv6FirewallHookProc FirewallHookFunction - ); - -extern void -__drv_maxIRQL(DISPATCH_LEVEL) -IPv6DisableFirewallHook( - __in IPv6FirewallDeregistrationCompleteProc CompletionRoutine - ); - -extern const uchar * -__drv_maxIRQL(DISPATCH_LEVEL) -IPv6ObtainPacketData( - __in const void *PacketContext, - __in uint DataLength, - __in uint Alignment - ); - -extern IP_STATUS -__drv_maxIRQL(DISPATCH_LEVEL) -IPv6GetBestRouteInfo( - __in const IPv6Addr *Addr, - __in ulong ScopeId, - __in ulong Index, - __out IP6RouteEntry *Ire - ); - -#ifdef __cplusplus -} -#endif - -#endif // _IP6FIREWALL_ - -#endif //(NTDDI_VERSION < NTDDI_LONGHORN) - diff --git a/pub/ddk/ipfirewall.h b/pub/ddk/ipfirewall.h deleted file mode 100644 index 500ab80..0000000 --- a/pub/ddk/ipfirewall.h +++ /dev/null @@ -1,165 +0,0 @@ -/*++ - -Copyright (c) 1999-2001 Microsoft Corporation - -Module Name: - - ipfirewall.h - -Abstract: - - Header file for IP firewall hook clients. - ---*/ - -#if (NTDDI_VERSION < NTDDI_LONGHORN) - -#pragma once - -#define INVALID_IF_INDEX 0xffffffff -#define LOCAL_IF_INDEX 0 - -// -// Indicates whether it is a transmitted or received packet. -// - -typedef enum _IP_DIRECTION_E { - IP_TRANSMIT, - IP_RECEIVE -} DIRECTION_E, *PDIRECTION_E; - -typedef struct _FIREWALL_CONTEXT_T { - DIRECTION_E Direction; - void *NTE; - void *LinkCtxt; - NDIS_HANDLE LContext1; - UINT LContext2; -} FIREWALL_CONTEXT_T, *PFIREWALL_CONTEXT_T; - -// Definition of an IP receive buffer chain. -typedef struct IPRcvBuf { - struct IPRcvBuf *ipr_next; // Next buffer descriptor in chain. - UINT ipr_owner; // Owner of buffer. - __field_ecount(ipr_size) UCHAR *ipr_buffer; // Pointer to buffer. - UINT ipr_size; // Buffer size. - PMDL ipr_pMdl; - UINT *ipr_pClientCnt; - UCHAR *ipr_RcvContext; - UINT ipr_RcvOffset; -#if (NTDDI_VERSION >= NTDDI_WINXP) - ULONG ipr_flags; -#elif (NTDDI_VERSION >= NTDDI_WIN2K) - ULONG ipr_promiscuous; -#endif -} IPRcvBuf; - -#if (NTDDI_VERSION >= NTDDI_WINXP) -#define IPR_FLAG_CHECKSUM_OFFLOAD 0x00000002 -#endif - -// -// Enum for values that may be returned from filter routine. -// - -typedef enum _FORWARD_ACTION { - FORWARD = 0, - DROP = 1, - ICMP_ON_DROP = 2 -} FORWARD_ACTION; - - -// Definiton for a firewall routine callout. -__drv_functionClass(IPPacketFirewallPtrType) -__drv_maxIRQL(DISPATCH_LEVEL) -typedef FORWARD_ACTION -IPPacketFirewallPtrType( - __inout VOID **pData, - __in UINT RecvInterfaceIndex, - __inout UINT *pSendInterfaceIndex, - __inout UCHAR *pDestinationType, - __in_bcount(ContextLength) VOID *pContext, - __in UINT ContextLength, - __out IPRcvBuf **ppRcvBuf - ); - -typedef IPPacketFirewallPtrType *IPPacketFirewallPtr; - -extern -int -__success(return==TRUE) -__drv_maxIRQL(DISPATCH_LEVEL) -IPAllocBuff( - __inout IPRcvBuf *pRcvBuf, - __in UINT Size - ); - -extern -VOID -__drv_maxIRQL(DISPATCH_LEVEL) -IPFreeBuff( - __in IPRcvBuf *pRcvBuf - ); - -extern -VOID -__drv_maxIRQL(DISPATCH_LEVEL) -FreeIprBuff( - __in IPRcvBuf *pRcvBuf - ); - -typedef enum _IPROUTEINFOCLASS { - IPRouteNoInformation, - IPRouteOutgoingFirewallContext, - IPRouteOutgoingFilterContext, - MaxIPRouteInfoClass -} IPROUTEINFOCLASS; - -extern -NTSTATUS -__drv_maxIRQL(DISPATCH_LEVEL) -LookupRouteInformation( - __in VOID* RouteLookupData, - __out_opt VOID* RouteEntry OPTIONAL, - __in IPROUTEINFOCLASS RouteInfoClass OPTIONAL, - __out VOID* RouteInformation OPTIONAL, - __out UINT* RouteInfoLength OPTIONAL - ); - -// Structure passed to the IPSetFirewallHook call - -typedef struct _IP_SET_FIREWALL_HOOK_INFO { - IPPacketFirewallPtr FirewallPtr; // Packet filter callout. - UINT Priority; // Priority of the hook - BOOLEAN Add; // if TRUE then ADD else DELETE -} IP_SET_FIREWALL_HOOK_INFO, *PIP_SET_FIREWALL_HOOK_INFO; - - -#define DEST_LOCAL 0 // Destination is local. -#define DEST_BCAST 0x01 // Destination is net or local bcast. -#define DEST_SN_BCAST 0x03 // A subnet bcast. -#define DEST_MCAST 0x05 // A local mcast. -#define DEST_REMOTE 0x08 // Destination is remote. -#define DEST_REM_BCAST 0x0b // Destination is a remote broadcast -#define DEST_REM_MCAST 0x0d // Destination is a remote mcast. -#define DEST_INVALID 0xff // Invalid destination - -#define DEST_PROMIS 0x20 // Dest is promiscuous - -#define DEST_BCAST_BIT 0x01 -#define DEST_OFFNET_BIT 0x10 // Destination is offnet - - // used only by upper layer - // callers. -#define DEST_MCAST_BIT 0x05 - -#define DD_IP_DEVICE_NAME L"\\Device\\Ip" - -#define FSCTL_IP_BASE FILE_DEVICE_NETWORK - -#define _IP_CTL_CODE(function, method, access) \ - CTL_CODE(FSCTL_IP_BASE, function, method, access) - -#define IOCTL_IP_SET_FIREWALL_HOOK \ - _IP_CTL_CODE(12, METHOD_BUFFERED, FILE_WRITE_ACCESS) - -#endif //(NTDDI_VERSION < NTDDI_LONGHORN) - diff --git a/pub/ddk/ipinfo.h b/pub/ddk/ipinfo.h deleted file mode 100644 index b758733..0000000 --- a/pub/ddk/ipinfo.h +++ /dev/null @@ -1,410 +0,0 @@ -/********************************************************************/ -/** Microsoft LAN Manager **/ -/** Copyright (c) Microsoft Corporation. All rights reserved. **/ -/********************************************************************/ -/* :ts=4 */ - -//** IPINFO.H - IP SNMP information definitions.. -// -// This file contains all of the definitions for IP that are -// related to SNMP information gathering. - -#ifndef IPINFO_INCLUDED -#define IPINFO_INCLUDED - -#pragma warning(push) -#pragma warning(disable:4201) // nameless struct/union - -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifndef CTE_TYPEDEFS_DEFINED -#define CTE_TYPEDEFS_DEFINED - -typedef unsigned long ulong; -typedef unsigned short ushort; -typedef unsigned char uchar; -typedef unsigned int uint; - -#endif // CTE_TYPEDEFS_DEFINED - - -typedef struct IPSNMPInfo { - ulong ipsi_forwarding; - ulong ipsi_defaultttl; - ulong ipsi_inreceives; - ulong ipsi_inhdrerrors; - ulong ipsi_inaddrerrors; - ulong ipsi_forwdatagrams; - ulong ipsi_inunknownprotos; - ulong ipsi_indiscards; - ulong ipsi_indelivers; - ulong ipsi_outrequests; - ulong ipsi_routingdiscards; - ulong ipsi_outdiscards; - ulong ipsi_outnoroutes; - ulong ipsi_reasmtimeout; - ulong ipsi_reasmreqds; - ulong ipsi_reasmoks; - ulong ipsi_reasmfails; - ulong ipsi_fragoks; - ulong ipsi_fragfails; - ulong ipsi_fragcreates; - ulong ipsi_numif; - ulong ipsi_numaddr; - ulong ipsi_numroutes; -} IPSNMPInfo; - -typedef struct ICMPStats { - ulong icmps_msgs; - ulong icmps_errors; - ulong icmps_destunreachs; - ulong icmps_timeexcds; - ulong icmps_parmprobs; - ulong icmps_srcquenchs; - ulong icmps_redirects; - ulong icmps_echos; - ulong icmps_echoreps; - ulong icmps_timestamps; - ulong icmps_timestampreps; - ulong icmps_addrmasks; - ulong icmps_addrmaskreps; -} ICMPStats; - -typedef struct ICMPSNMPInfo { - ICMPStats icsi_instats; - ICMPStats icsi_outstats; -} ICMPSNMPInfo; - -typedef struct ICMPv6Stats { - ulong icmps_msgs; - ulong icmps_errors; - ulong icmps_typecount[256]; -} ICMPv6Stats; - -typedef struct ICMPv6SNMPInfo { - ICMPv6Stats icsi_instats; - ICMPv6Stats icsi_outstats; -} ICMPv6SNMPInfo; - -#define IP_FORWARDING 1 -#define IP_NOT_FORWARDING 2 - -typedef struct IPAddrEntry { - ulong iae_addr; - ulong iae_index; - ulong iae_mask; - ulong iae_bcastaddr; - ulong iae_reasmsize; - ushort iae_context; - ushort iae_pad; -} IPAddrEntry; - -// -// NT4 IPRouteEntry structure -// - -typedef struct IPRouteEntry_V1 { - ulong ire_dest; - ulong ire_index; - ulong ire_metric1; - ulong ire_metric2; - ulong ire_metric3; - ulong ire_metric4; - ulong ire_nexthop; - ulong ire_type; - ulong ire_proto; - ulong ire_age; - ulong ire_mask; - ulong ire_metric5; -// removed ifdef NT because it was breaking route/inetmib1 -// NT is not defined in route and inetmib1 sources file - void *ire_context; -} IPRouteEntry_V1; - -// -// win2000(all SPs) IPRouteEntry structure -// - -typedef struct IPRouteEntry_V2 { - ulong ire_dest; - ulong ire_index; - ulong ire_metric1; - ulong ire_metric2; - ulong ire_metric3; - ulong ire_metric4; - ulong ire_nexthop; - ulong ire_type; - ulong ire_proto; - ulong ire_age; - ulong ire_mask; - ulong ire_metric5; -#ifdef NT - void *ire_context; -#endif -} IPRouteEntry_V2; - -// -// WinXP (RTM/SP1/SP2), Win2k3(RTM/SP1) and Vista (LHS/SP1) -// IPRouteEntry structure. -// - -typedef struct IPRouteEntry_V3 { - ulong ire_dest; - ulong ire_index; - ulong ire_metric1; - ulong ire_metric2; - ulong ire_metric3; - ulong ire_metric4; - ulong ire_nexthop; - ulong ire_type; - ulong ire_proto; - ulong ire_age; - ulong ire_mask; - ulong ire_metric5; -#ifdef NT - ulong ire_context; -#endif -} IPRouteEntry_V3; - -#if (NTDDI_VERSION < NTDDI_WIN2K) -typedef IPRouteEntry_V1 IPRouteEntry; -#elif (NTDDI_VERSION < NTDDI_WINXP) -typedef IPRouteEntry_V2 IPRouteEntry; -#else -typedef IPRouteEntry_V3 IPRouteEntry; -#endif //NTDDI_VERSION < NTDDI_WIN2K - -typedef struct IPRouteBlock { - ulong numofroutes; - IPRouteEntry route[1]; -} IPRouteBlock; - -// -// Route with multiple nexthops and associated defns -// - -// -// Win2000(all SPs) IPRouteNextHopEntry structure -// - -typedef struct IPRouteNextHopEntry_V1 { - ulong ine_iretype; - ulong ine_nexthop; - ulong ine_ifindex; -#ifdef NT - void *ine_context; -#endif -} IPRouteNextHopEntry_V1; - -// -// WinXP and later IPRouteNextHopEntry structure -// - -typedef struct IPRouteNextHopEntry_V2 { - ulong ine_iretype; - ulong ine_nexthop; - ulong ine_ifindex; -#ifdef NT - ulong ine_context; -#endif -} IPRouteNextHopEntry_V2; - -#if (NTDDI_VERSION < NTDDI_WINXP) -typedef IPRouteNextHopEntry_V1 IPRouteNextHopEntry; -#else -typedef IPRouteNextHopEntry_V2 IPRouteNextHopEntry; -#endif //NTDDI_VERSION < NTDDI_WINXP - -// -// Win2000(all SPs) IPMultihopRouteEntry structure -// - -typedef struct IPMultihopRouteEntry_V1 { - ulong imre_numnexthops; - IPRouteEntry imre_routeinfo; - IPRouteNextHopEntry imre_morenexthops[1]; -} IPMultihopRouteEntry_V1; - -// -// WinXP and later IPMultihopRouteEntry structure -// - -typedef struct IPMultihopRouteEntry_V2 { - ulong imre_numnexthops; - ulong imre_flags; - IPRouteEntry imre_routeinfo; - IPRouteNextHopEntry imre_morenexthops[1]; -} IPMultihopRouteEntry_V2; - -#if (NTDDI_VERSION < NTDDI_WINXP) -typedef IPMultihopRouteEntry_V1 IPMultihopRouteEntry; -#else -typedef IPMultihopRouteEntry_V2 IPMultihopRouteEntry; -#endif //NTDDI_VERSION < NTDDI_WINXP - - -#define IMRE_FLAG_DELETE_DEST 0x00000001 - -// -// Input context to pass when querying a route -// - -typedef enum { - IPNotifyNotification = 0, - IPNotifySynchronization, - IPNotifyMaximumVersion -} IPNotifyVersion; - -typedef struct IPNotifyData { - ulong Version; // See IPNotifyVersion above. - ulong Add; - char Info[1]; -} IPNotifyData, *PIPNotifyData; - -typedef struct IPNotifyOutput { - ulong ino_addr; - ulong ino_mask; - ulong ino_info[6]; -} IPNotifyOutput, *PIPNotifyOutput; - -typedef union IPRouteNotifyOutput { - IPNotifyOutput irno_info; - struct { - ulong irno_dest; - ulong irno_mask; - ulong irno_nexthop; - ulong irno_proto; - ulong irno_ifindex; - ulong irno_metric; - ulong irno_flags; - }; -} IPRouteNotifyOutput, *PIPRouteNotifyOutput; - -#define IRNO_FLAG_ADD 0x00000001 -#define IRNO_FLAG_DELETE 0x00000002 - -// -// Input context to pass when querying a route -// -typedef struct IPRouteLookupData { - ulong Version; //version of this structure - ulong DestAdd; - ulong SrcAdd; - char Info[1]; -} IPRouteLookupData, *PIPRouteLookupData; - -typedef struct AddrXlatInfo { - ulong axi_count; - ulong axi_index; -} AddrXlatInfo; - -#define IRE_TYPE_OTHER 1 -#define IRE_TYPE_INVALID 2 -#define IRE_TYPE_DIRECT 3 -#define IRE_TYPE_INDIRECT 4 - -#define IRE_PROTO_OTHER 1 -#define IRE_PROTO_LOCAL 2 -#define IRE_PROTO_NETMGMT 3 -#define IRE_PROTO_ICMP 4 -#define IRE_PROTO_EGP 5 -#define IRE_PROTO_GGP 6 -#define IRE_PROTO_HELLO 7 -#define IRE_PROTO_RIP 8 -#define IRE_PROTO_IS_IS 9 -#define IRE_PROTO_ES_IS 10 -#define IRE_PROTO_CISCO 11 -#define IRE_PROTO_BBN 12 -#define IRE_PROTO_OSPF 13 -#define IRE_PROTO_BGP 14 - -// -// IRE_PROTO_PERSIST_LOCAL was defined on W2k (all SPs), -// XP RTM, and XP SP1. It's been removed since XP SP2. -// -#if ((NTDDI_VERSION >= NTDDI_WIN2K) && (NTDDI_VERSION < NTDDI_WINXPSP2)) -#define IRE_PROTO_PERSIST_LOCAL 10010 -#endif - -#define IRE_METRIC_UNUSED 0xffffffff - -#define IP_MIB_STATS_ID 1 -#define IP_MIB_RTCHANGE_NOTIFY_ID 2 -#define ICMP_MIB_STATS_ID 1 - -#define AT_MIB_ADDRXLAT_INFO_ID 1 -#define AT_MIB_ADDRXLAT_ENTRY_ID 0x101 - -#define IP_MIB_RTTABLE_ENTRY_ID 0x101 -#define IP_MIB_ADDRTABLE_ENTRY_ID 0x102 -#define IP_MIB_RTTABLE_ENTRY_ID_EX 0x103 - -#define IP_INTFC_FLAG_P2P 1 -#define IP_INTFC_FLAG_P2MP 2 -#define IP_INTFC_FLAG_UNIDIRECTIONAL 4 - - -typedef struct IPInterfaceInfo { - ulong iii_flags; - ulong iii_mtu; - ulong iii_speed; - ulong iii_addrlength; - uchar iii_addr[1]; -} IPInterfaceInfo; - -#define IP_INTFC_INFO_ID 0x103 -#define IP_MIB_SINGLE_RT_ENTRY_ID 0x104 -#define IP_GET_BEST_SOURCE 0x105 - -// -// Pick up in6_addr type. -// -#include - -// -// IP6RouteEntry_V1, defined on WinXP RTM, WinXP SP1, W2k3 RTM, -// and Longhorn/Vista. -// -typedef struct IP6RouteEntry_V1 { - ulong ire_Length; - struct in6_addr ire_Source; - ulong ire_ScopeId; - ulong ire_IfIndex; -} IP6RouteEntry_V1; - -// -// IP6RouteEntry_V2, defined on WinXP SP2, W2k3 SP1 -// (and possibly on subsequent service packs of XP and 2k3) -// -typedef struct IP6RouteEntry_V2 { - ulong ire_Length; - ulong ire_Type; - ulong ire_IfIndex; - ulong ire_SourceScopeId; - ulong ire_NextHopScopeId; - struct in6_addr ire_Source; - struct in6_addr ire_NextHop; -} IP6RouteEntry_V2; - -#if (NTDDI_VERSION < NTDDI_WINXPSP2) //XPSP1 and before -typedef IP6RouteEntry_V1 IP6RouteEntry; -#elif (NTDDI_VERSION < NTDDI_WS03) //[XPSP2, 2k3RTM) -typedef IP6RouteEntry_V2 IP6RouteEntry; -#elif (NTDDI_VERSION < NTDDI_WS03SP1) //[2k3RTM] -typedef IP6RouteEntry_V1 IP6RouteEntry; -#elif (NTDDI_VERSION < NTDDI_LONGHORN) //[2k3SP1, Longhorn) -typedef IP6RouteEntry_V2 IP6RouteEntry; -#else //[Longhorn, ...] -typedef IP6RouteEntry_V1 IP6RouteEntry; -#endif //NTDDI_VERSION < NTDDI_WINXPSP2 - -#define IP6_MIB_STATS_ID IP_MIB_STATS_ID -#define IP6_GET_BEST_ROUTE_ID 3 -#define ICMP6_MIB_STATS_ID 4 - -#pragma warning(pop) - -#endif // IPINFO_INCLUDED - diff --git a/pub/ddk/irb.h b/pub/ddk/irb.h deleted file mode 100644 index 6cfc6d8..0000000 --- a/pub/ddk/irb.h +++ /dev/null @@ -1,1973 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - irb.h - -Abstract: - - Defines the interface between the Ataport and the ATA miniport drivers. - -Authors: - -Revision History: - ---*/ - -#include - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -#ifndef _NTIRB_ -#define _NTIRB_ - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif - -#pragma warning(disable:4201) // nameless struct/union -#pragma warning(disable:4214) // bit field types other than int - -#ifdef __cplusplus -extern "C" -{ -#endif - -// -// pre-defined channel numbers for P-ATA -// -#define PRIMARY_CHANNEL_NUMBER 0 -#define SECONDARY_CHANNEL_NUMBER 1 - -// -// max number of devices per channel for P-ATA -// -#define MAX_IDE_DEVICE 2 - -#define MAX_IDE_LUN 8 - -#define IDE_UNTAGGED 0xFF -#define IDE_UNINITIALIZED_VALUE (-1) - -#define IDE_REG_SZ (1) -#define IDE_REG_BINARY (3) -#define IDE_REG_DWORD (4) - -typedef PHYSICAL_ADDRESS IDE_PHYSICAL_ADDRESS, *PIDE_PHYSICAL_ADDRESS; - -#undef TraceNotification -#define TraceNotification 0 - -#ifndef _NTDDSCSIH_ - -// -// Miniport ioctl header -// -typedef struct _IDE_IO_CONTROL { - ULONG HeaderLength; - UCHAR Signature[8]; - ULONG Timeout; - ULONG ControlCode; - ULONG ReturnStatus; - ULONG DataLength; -} IDE_IO_CONTROL, *PIDE_IO_CONTROL; -#endif - -// -// Notification Event Types -// -typedef enum _IDE_NOTIFICATION_TYPE { - IdeDeviceArrival, - IdeDeviceRemoval, - IdePowerStateChange -} IDE_NOTIFICATION_TYPE, *PIDE_NOTIFICATION_TYPE; - -// -// Callback types supported by the port driver -// -typedef enum _IDE_CALLBACK_TYPE { - IdeTimerRoutine, - IdeWorkerRoutine, - IdeSynchronizedRoutine, - IdeControllerSyncRoutine, - IdeMaxCallbackType -} IDE_CALLBACK_TYPE, *PIDE_CALLBACK_TYPE; - -// -// Device type -// -typedef enum { - DeviceUnknown = 0, - DeviceIsAta, - DeviceIsAtapi, - DeviceNotExist -} IDE_DEVICE_TYPE; - -// -// addressing mode -// -typedef enum { - UnknownMode = 0, - ChsMode, - LbaMode, - Lba48BitMode -}ATA_ADDRESS_TRANSLATION; - -// -// control action for ChannelControl -// -typedef enum { - IdeStart = 0, - IdeStop, - IdePowerUp, - IdePowerDown, - IdeVendorDefined -} IDE_CONTROL_ACTION; - -// -// device power states -// -typedef enum { - IdePowerUnSpecified = 0, - IdePowerD0, - IdePowerD3 -} IDE_POWER_STATE; - - -// -// SenseInfoBuffer return types -// -#define SENSE_INFO_BUFFER_RETURN_TYPE_CDB 0 -#define SENSE_INFO_BUFFER_RETURN_TYPE_28BIT_TASKFILE 1 -#define SENSE_INFO_BUFFER_RETURN_TYPE_48BIT_TASKFILE 2 -#define SENSE_INFO_BUFFER_RETURN_TYPE_D2H_FIS 3 - -// -// power transition information -// defines a transition from -// currentPowerState -> DesiredPowerState -// -typedef struct _IDE_POWER_INFO { - IDE_POWER_STATE CurrentPowerState; - IDE_POWER_STATE DesiredPowerState; -} IDE_POWER_INFO, *PIDE_POWER_INFO; - -typedef struct _IDE_VENDOR_DEFINED_POWER_INFO { - UCHAR TargetId; - GUID SettingGuid; - __field_bcount(ValueLength) - PVOID Value; - ULONG ValueLength; -} IDE_VENDOR_DEFINED_POWER_INFO, *PIDE_VENDOR_DEFINED_POWER_INFO; - - -// -// task file register contents -// -typedef struct _IDEREGISTERS { - - // - // ATA features/error register - // - UCHAR bFeaturesReg; - - // - // sector count - // - UCHAR bSectorCountReg; - - // - // block number (7:0) - // - UCHAR bSectorNumberReg; - - // - // cylinder number (7:0) or LBA (15:8) - // - UCHAR bCylLowReg; - - // - // cylinder number (15:8) or LBA (23:16) - // - UCHAR bCylHighReg; - - // - // device/Head and LBA (27:24) - // - UCHAR bDriveHeadReg; - - // - // command/status register - // - UCHAR bCommandReg; - - // - // Reserved for future use. Shall be 0 - // - UCHAR bReserved; - -} IDEREGISTERS, *PIDEREGISTERS; - -// -// task file (to hold 48 bit) -// -typedef struct _IDE_TASK_FILE { - IDEREGISTERS Current; - IDEREGISTERS Previous; -} IDE_TASK_FILE, *PIDE_TASK_FILE; - -typedef UCHAR IRB_STATUS; - -// -// irb -// -typedef struct _IDE_REQUEST_BLOCK { - - // - // IRB_FUNCTION_XXX - // - USHORT Function; - - // - // IRB_STATUS_XXX - // - UCHAR IrbStatus; - - // - // contents of the status and error registers - // at the completion of the command - // - UCHAR AtaStatus; - UCHAR AtaError; - - // - // channel, target and lun ids uniquely identify the target device - // - UCHAR Channel; - UCHAR TargetId; - UCHAR Lun; - // - // Length of the actual CDB in the Cdb[16] array - // - UCHAR CdbLength; - - // - // sense info buffer length - // - UCHAR SenseInfoBufferLength; - - // - // Type of data structure returned in the SenseInfoBuffer - // - UCHAR SenseInfoBufferType; - - // - // holds the queue tag - // - UCHAR QueueTag; - - ULONG ReservedAsUlong; - - // - // Irb Flags - // - ULONG IrbFlags; - - // - // timeout - // - ULONG TimeOutValue; - - // - // data transfer length - // - ULONG DataTransferLength; - - // - // irb extension - // - PVOID IrbExtension; - - // - // data buffer - // - __field_bcount(DataTransferLength) - PVOID DataBuffer; - - // - // sense buffer - // - __field_bcount(SenseInfoBufferLength) - PVOID SenseInfoBuffer; - - // - // Used for queueing irbs - // - PVOID NextIrb; - - // - // For future use (shall be set to NULL) - // - PVOID Reserved; - - // - // task file for ATA devices or - // CDB for ATAPI devices or - // power transition information or - // an array of chars - // (determined by IrbFunction) - // - union { - - // - // ATA Task file register contents - // - IDE_TASK_FILE IdeTaskFile; - - // - // CDB for ATAPI devices - // - UCHAR Cdb[16]; - - // - // power transitition information - // - IDE_POWER_INFO PowerChange; - - // - // array of 16 uchars - // - UCHAR AsUChar[16]; - }; - -} IDE_REQUEST_BLOCK, *PIDE_REQUEST_BLOCK; - -// -// irb status -// -#define IRB_STATUS_PENDING 0x0 -#define IRB_STATUS_SUCCESS 0x1 -#define IRB_STATUS_DATALENGTH_MISMATCH 0x2 -#define IRB_STATUS_DEVICE_ERROR 0x3 -#define IRB_STATUS_INVALID_REQUEST 0x4 -#define IRB_STATUS_BUS_RESET 0x5 -#define IRB_STATUS_SELECTION_TIMEOUT 0x6 -#define IRB_STATUS_BUSY 0x7 - -// -// bit to indicate the SenseInfoBuffer holds a valid Task File -// -#define IRB_STATUS_RETURN_TASKFILE_VALID 0x10 - -// -// bit mask to indicate valid sense info -// -#define IRB_STATUS_AUTOSENSE_VALID 0x20 - -// -// 0x40 and above are reserved for the port driver -// -#define IRB_STATUS_INTERNAL_ERROR 0x40 - -// -// irb function -// - -// -// 0x100 - 0x1FF indicate ATA commands -// -#define IRB_FUNCTION_ATA_COMMAND 0x100 -#define IRB_FUNCTION_ATA_IDENTIFY 0x101 -#define IRB_FUNCTION_ATA_READ 0x102 -#define IRB_FUNCTION_ATA_WRITE 0x103 -#define IRB_FUNCTION_ATA_FLUSH 0x104 -#define IRB_FUNCTION_ATA_SMART 0x105 - -// -// 0x200 - 0x2FF indicate ATAPI commands -// -#define IRB_FUNCTION_ATAPI_COMMAND 0x200 -#define IRB_FUNCTION_REQUEST_SENSE 0x201 - -// -// 0x400-0x4FF indicate miniport commands -// -#define IRB_FUNCTION_MINIPORT_COMMAND 0x400 -#define IRB_FUNCTION_ADAPTER_FLUSH 0x401 -#define IRB_FUNCTION_SHUTDOWN 0x402 -#define IRB_FUNCTION_POWER_CHANGE 0x403 -#define IRB_FUNCTION_LUN_RESET 0x404 -#define IRB_FUNCTION_MINIPORT_IOCTL 0x405 -#define IRB_FUNCTION_POWER_REBOOT 0x406 - -// -// irb flags -// -#define IRB_FLAGS_DRDY_REQUIRED 0x1 -#define IRB_FLAGS_USE_DMA 0x2 -#define IRB_FLAGS_MAP_BUFFERS 0x4 -#define IRB_FLAGS_48BIT 0x8 -#define IRB_FLAGS_PIO_MULTIPLE 0x10 -#define IRB_FLAGS_RETURN_RESULTS 0x20 -#define IRB_FLAGS_DATA_IN 0x40 -#define IRB_FLAGS_DATA_OUT 0x80 -#define IRB_FLAGS_DISCARDABLE 0x100 -#define IRB_FLAGS_HIGH_PRIORITY 0x200 - -// -// helper macros -// -#define IsAtapiCommand(irb) (irb->Function & IRB_FUNCTION_ATAPI_COMMAND) -#define IsAtaCommand(irb) (irb->Function & IRB_FUNCTION_ATA_COMMAND) -#define IsMiniportCommand(irb) (irb->Function & IRB_FUNCTION_MINIPORT_COMMAND) -#define IsRequestSenseIrb(irb) (irb->Function == IRB_FUNCTION_REQUEST_SENSE) -#define IsReturnResults(irb) (irb->IrbFlags & IRB_FLAGS_RETURN_RESULTS) - -#define NeedRequestSense(irb) \ - (IsAtapiCommand(irb) && \ - !IsRequestSenseIrb(irb) && \ - (irb->IrbStatus == IRB_STATUS_DEVICE_ERROR) && \ - (irb->SenseInfoBuffer != NULL) && \ - (irb->SenseInfoBufferLength > 0)) - -#define Is48BitIrb(irb) (irb->IrbFlags & IRB_FLAGS_48BIT) -#define IsPioMultipleIrb(irb) (irb->IrbFlags & IRB_FLAGS_PIO_MULTIPLE) -#define IsHighPriorityIrb(irb) (irb->IrbFlags & IRB_FLAGS_HIGH_PRIORITY) - -#define IRB_USES_DMA(irb) (irb->IrbFlags & IRB_FLAGS_USE_DMA) - -#define MARK_IRB_FOR_DMA(irb) (irb->IrbFlags |= IRB_FLAGS_USE_DMA) -#define MARK_IRB_FOR_PIO(irb) (irb->IrbFlags &= ~IRB_FLAGS_USE_DMA) - -#define IRB_FOR_DATA_TRANSFER(irb) \ - (irb->IrbFlags & (IRB_FLAGS_DATA_IN | IRB_FLAGS_DATA_OUT)) - - -#define GET_IRB_CURRENT_REG(irb) (&((irb->IdeTaskFile).Current)) -#define GET_IRB_PREVIOUS_REG(irb) (&((irb->IdeTaskFile).Previous)) - -#define GET_CURRENT_REG(taskFile) (&(taskFile)->Current) -#define GET_PREVIOUS_REG(taskFile) (&(taskFile)->Previous) - -#define GetIrbErrorReg(irb) (irb->AtaError) -#define GetIrbStatusReg(irb) (irb->AtaStatus) -#define SetIrbCommandReg(irb, cmd) (irb->IdeTaskFile.Current.bCommandReg=cmd) - -// -// TargetId >= 1 implies slave device -// -#define SetIrbDeviceReg(irb, val) \ - (irb->IdeTaskFile.Current.bDriveHeadReg = ((irb->TargetId == 0x0) ? (0xA0 | val) : (0xB0 | val))) - -// -// algorithm used by the port driver to set the irbFunction -// for an ATA command -// -#define IdeMapAtaCommandToIrbFunction(AtaCommand, irbFunc) \ -{ \ - switch (AtaCommand) { \ - case IDE_COMMAND_IDENTIFY: \ - case IDE_COMMAND_ATAPI_IDENTIFY: \ - irbFunc = IRB_FUNCTION_ATA_IDENTIFY; \ - break; \ - case IDE_COMMAND_READ: \ - case IDE_COMMAND_READ_MULTIPLE: \ - case IDE_COMMAND_READ_DMA: \ - case IDE_COMMAND_READ_EXT: \ - case IDE_COMMAND_READ_DMA_EXT: \ - case IDE_COMMAND_READ_MULTIPLE_EXT: \ - irbFunc = IRB_FUNCTION_ATA_READ; \ - break; \ - case IDE_COMMAND_WRITE: \ - case IDE_COMMAND_WRITE_MULTIPLE: \ - case IDE_COMMAND_WRITE_DMA: \ - case IDE_COMMAND_WRITE_EXT: \ - case IDE_COMMAND_WRITE_DMA_EXT: \ - case IDE_COMMAND_WRITE_DMA_FUA_EXT: \ - case IDE_COMMAND_WRITE_MULTIPLE_EXT: \ - case IDE_COMMAND_WRITE_MULTIPLE_FUA_EXT: \ - irbFunc = IRB_FUNCTION_ATA_WRITE; \ - break; \ - case IDE_COMMAND_CHECK_POWER: \ - case IDE_COMMAND_FLUSH_CACHE: \ - case IDE_COMMAND_FLUSH_CACHE_EXT: \ - irbFunc = IRB_FUNCTION_ATA_FLUSH;\ - break; \ - case IDE_COMMAND_SMART: \ - irbFunc = IRB_FUNCTION_ATA_SMART; \ - break;\ - default:\ - irbFunc = IRB_FUNCTION_ATA_COMMAND;\ - break;\ - } \ -} - -// -// scatter-gather list -// -typedef struct _IDE_SCATTER_GATHER_ELEMENT { - IDE_PHYSICAL_ADDRESS Address; - ULONG Length; - ULONG_PTR Reserved; -} IDE_SCATTER_GATHER_ELEMENT, *PIDE_SCATTER_GATHER_ELEMENT; - -#if defined(_MSC_VER) && (_MSC_VER >= 800) -#if (_MSC_VER >= 1200) -#pragma warning(push) -#endif -#pragma warning(disable:4200) /* nonstandard extension used : zero-sized array in struct/union */ -#endif - -typedef struct _IDE_SCATTER_GATHER_LIST { - ULONG NumberOfElements; - ULONG_PTR Reserved; - __field_ecount(NumberOfElements) - IDE_SCATTER_GATHER_ELEMENT Elements[]; -} IDE_SCATTER_GATHER_LIST, *PIDE_SCATTER_GATHER_LIST; - -#if defined(_MSC_VER) && (_MSC_VER >= 800) -#if (_MSC_VER >= 1200) -#pragma warning(pop) -#else -#pragma warning(default:4200) /* nonstandard extension used : zero-sized array in struct/union */ -#endif -#endif - -// -// task file register addresses -// -typedef struct _IDE_REGISTERS_1 { - PUCHAR RegistersBaseAddress; - - PUSHORT Data; - - union { - PUCHAR Error; - PUCHAR Features; - }; - - union { - PUCHAR BlockCount; - PUCHAR InterruptReason; - }; - - PUCHAR BlockNumber; - - union { - PUCHAR CylinderLow; - PUCHAR ByteCountLow; - }; - - union { - PUCHAR CylinderHigh; - PUCHAR ByteCountHigh; - }; - - PUCHAR DriveSelect; - PUCHAR Command; -} IDE_REGISTERS_1, *PIDE_REGISTERS_1; - -// -// device control register addresses -// -typedef struct _IDE_REGISTERS_2 { - PUCHAR RegistersBaseAddress; - - PUCHAR DeviceControl; - PUCHAR DriveAddress; -} IDE_REGISTERS_2, *PIDE_REGISTERS_2; - -// -// access range that indicates the resources -// -typedef struct _IDE_ACCESS_RANGE { - IDE_PHYSICAL_ADDRESS RangeStart; - IDE_PHYSICAL_ADDRESS PhysicalRangeStart; - ULONG RangeLength; - BOOLEAN InMemory; - UCHAR Bar; -} IDE_ACCESS_RANGE, *PIDE_ACCESS_RANGE; - -// -// the miniport's error log entry -// -typedef struct _IDE_ERROR_LOG_ENTRY { - UCHAR IrbStatus; - UCHAR Channel; - UCHAR TargetId; - UCHAR Lun; - UCHAR UniqueId; - UCHAR DumpDataSize; - __field_bcount(DumpDataSize) - UCHAR DumpData[1]; -} IDE_ERROR_LOG_ENTRY, *PIDE_ERROR_LOG_ENTRY; - -// -// device characterstics flags -// - -// -// Indicates that the drive has the 'removable' bit set in -// identify data (offset 128) -// -#define DFLAGS_REMOVABLE_MEDIA (1 << 0) - -// -// Indicates whether device interrupts as DRQ is set after -// receiving Atapi Packet Command -// -#define DFLAGS_INT_DRQ (1 << 1) - -// -// Device supports media status notification -// -#define DFLAGS_MSN_SUPPORT (1 << 2) - -// -// Device can be electronically safe unplugged (such as: eSATA device) -// -#define DFLAGS_REMOVABLE_DEVICE (1 << 3) - -// -// Indicates device supports for FUA -// -#define DFLAGS_FUA_SUPPORT (1 << 12) - - -typedef struct _IDE_DEVICE_PARAMETERS { - - // - // size of this structure - // - USHORT Version; - - // - // device type (ata, atapi etc) - // - IDE_DEVICE_TYPE IdeDeviceType; - - // - // target id - // - UCHAR TargetId; - - // - // Number of Luns - // - UCHAR MaximumLun; - - // - // number of requests the miniport can handle - // at a time for this device - // - UCHAR NumberOfOverlappedRequests; - - // - // max number of blocks that can be transferred - // using read/write multiple command - // - UCHAR MaxBlockXfer; - - // - // device characteristics (removable etc) - // - USHORT DeviceCharacteristics; - - // - // Geometry - // - ATA_ADDRESS_TRANSLATION AddressTranslation; - - union { - LARGE_INTEGER MaxLba; - struct { - USHORT NumCylinders; - USHORT NumHeads; - USHORT NumSectorsPerTrack; - USHORT Reserved; - } Chs; - }; - - // - // number of bytes per sector - // - ULONG BytesPerLogicalSector; - - // - // number of bytes per sector - // - ULONG BytesPerPhysicalSector; - - // - // number of bytes per sector - // - ULONG BytesOffsetForSectorAlignment; - - // - // The transfer modes supported by this device - // - ULONG TransferModeSupported; - - // - // The selected transfer mode for this device - // - ULONG TransferModeSelected; - -} IDE_DEVICE_PARAMETERS, *PIDE_DEVICE_PARAMETERS; - -__drv_sameIRQL -typedef -BOOLEAN -(*IDE_HW_INITIALIZE) ( - __in PVOID ChannelExtension, - __inout PIDE_DEVICE_PARAMETERS DeviceParameters, - __in PIDENTIFY_DEVICE_DATA IdentifyData - ); - -__drv_sameIRQL -typedef -BOOLEAN -(*IDE_HW_STARTIO) ( - __in PVOID ChannelExtension, - __in PIDE_REQUEST_BLOCK Irb - ); - -__drv_sameIRQL -typedef -BOOLEAN -(*IDE_HW_BUILDIO) ( - __in PVOID ChannelExtension, - __in PIDE_REQUEST_BLOCK Irb - ); - -__checkReturn -__drv_sameIRQL -typedef -BOOLEAN -(*IDE_HW_INTERRUPT) ( - __in PVOID ChannelExtension - ); - -__drv_minFunctionIRQL(DISPATCH_LEVEL) -__drv_requiresIRQL(DISPATCH_LEVEL) -typedef -VOID -//KSYNCHRONIZE_ROUTINE -(*IDE_HW_DPC) ( - __in PVOID ChannelExtension - ); - -__drv_sameIRQL -typedef -BOOLEAN -(*IDE_HW_RESET) ( - __in PVOID ChannelExtension - ); - -__drv_sameIRQL -typedef -BOOLEAN -(*IDE_HW_CONTROL) ( - __in PVOID ChannelExtension, - __in IDE_CONTROL_ACTION ControlAction, - __inout_opt PVOID Parameters - ); - -// -// Indicates the operation constraints -// -typedef enum _IDE_OPERATION_MODE { - IdeModeNormal = 0, - IdeModeDump, - IdeModeRemovableBay -} IDE_OPERATION_MODE, *PIDE_OPERATION_MODE; - -// -// miniport hardware resources -// -typedef struct _IDE_MINIPORT_RESOURCES{ - - // - // Number of access ranges - // - ULONG NumberOfAccessRanges; - - // - // array of access range elements. - // - __inout_ecount(NumberOfAccessRanges) - PIDE_ACCESS_RANGE IdeAccessRange; - -} IDE_MINIPORT_RESOURCES, *PIDE_MINIPORT_RESOURCES; - -typedef struct _IDE_VENDOR_DEFINED_POWER { - UCHAR ValidGuids; - GUID Guid[3]; -} IDE_VENDOR_DEFINED_POWER, *PIDE_VENDOR_DEFINED_POWER; - - -typedef union _SUPPORTED_ADVANCES { - - struct { - //LSB - USHORT AdvancedChannelConfigurationSupported :1; - USHORT Reserved :15; - //MSB - }; - - USHORT AsUshort; -} SUPPORTED_ADVANCES, *PSUPPORTED_ADVANCES; - -typedef union _IDE_ADVANCED_CHANNEL_CONFIGURATION_FIELDS_PRESENT { - - struct { - //LSB - USHORT VendorDefinedPower :1; - USHORT Reserved :15; - //MSB - }; - - USHORT AsUshort; -} IDE_ADVANCED_CHANNEL_CONFIGURATION_FIELDS_PRESENT, *PIDE_ADVANCED_CHANNEL_CONFIGURATION_FIELDS_PRESENT; - -typedef struct _IDE_ADVANCED_CHANNEL_CONFIGURATION { - USHORT Length; - IDE_ADVANCED_CHANNEL_CONFIGURATION_FIELDS_PRESENT Present; - IDE_VENDOR_DEFINED_POWER VendorDefinedPower; -} IDE_ADVANCED_CHANNEL_CONFIGURATION, *PIDE_ADVANCED_CHANNEL_CONFIGURATION; - -typedef struct _IDE_CHANNEL_CONFIGURATION { - - // - // Input parameters - // - - // - // IN only. version - // - USHORT Version; - - // - // IN only. The channel number - // - UCHAR ChannelNumber; - - // - // Reserved - // - SUPPORTED_ADVANCES SupportedAdvances; - - // - // Operating mode - // - IDE_OPERATION_MODE ChannelMode; - - // - // IN only field. Pointer to hardware resources - // - PIDE_MINIPORT_RESOURCES ChannelResources; - - // - // Output parameters - // - - // - // Number of overlapped requests the channel can handle - // - UCHAR NumberOfOverlappedRequests; - - // - // The maximum targetId. - // Typically (MaxNumDevices - 1) - // - UCHAR MaxTargetId; - - // - // Always TRUE - // - BOOLEAN SyncWithIsr; - - // - // Always TRUE - // - BOOLEAN SupportsWmi; - - // - // Reserved - // - PIDE_ADVANCED_CHANNEL_CONFIGURATION AdvancedChannelConfiguration; - -} IDE_CHANNEL_CONFIGURATION, *PIDE_CHANNEL_CONFIGURATION; - - -typedef struct _IDE_CHANNEL_INTERFACE { - - // - // Input parameters - // - - // - // Size of this structure - // - USHORT Version; - - // - // The channel number - // - UCHAR ChannelNumber; - - // - // Reserved for future use - // - UCHAR Reserved; - - // - // Reserved - // - ULONG ReservedUlong; - - // - // Output parameters - // - IDE_HW_INITIALIZE IdeHwInitialize; - IDE_HW_BUILDIO IdeHwBuildIo; - IDE_HW_STARTIO IdeHwStartIo; - IDE_HW_INTERRUPT IdeHwInterrupt; - IDE_HW_RESET IdeHwReset; - IDE_HW_CONTROL IdeHwControl; - -} IDE_CHANNEL_INTERFACE, *PIDE_CHANNEL_INTERFACE; - -__checkReturn -__drv_sameIRQL -typedef BOOLEAN - (* IDE_CHANNEL_INIT) ( - __in PVOID ChannelExtension, - __inout PIDE_CHANNEL_INTERFACE ChannelInterface, - __inout_opt PVOID InitContext - ); - -typedef struct _IDE_TRANSFER_MODE_PARAMETERS { - - // - // Input Parameters - // - - // - // IDE Channel Number. - // - UCHAR ChannelNumber; - - // - // Indicate whether devices are present - // - IDE_DEVICE_TYPE DeviceType[MAX_IDE_DEVICE]; - - // - // Indicate whether devices support IO Ready Line - // - BOOLEAN IoReadySupported[MAX_IDE_DEVICE]; - - // - // Indicate the data transfer modes devices support - // - ULONG DeviceTransferModeSupported[MAX_IDE_DEVICE]; - - // - // Indicate devices' current data transfer modes - // - ULONG DeviceTransferModeCurrent[MAX_IDE_DEVICE]; - - // - // Output Parameters - // - - // - // Indicate devices' data transfer modes chosen by - // the miniport - // - ULONG DeviceTransferModeSelected[MAX_IDE_DEVICE]; - -} IDE_TRANSFER_MODE_PARAMETERS, *PIDE_TRANSFER_MODE_PARAMETERS; - -__checkReturn -__drv_sameIRQL -typedef BOOLEAN - (*IDE_TRANSFER_MODE_SELECT) ( - __in PVOID ControllerExtension, - __inout PIDE_TRANSFER_MODE_PARAMETERS TransferModeSelect - ); - -// -// possible channel state -// -typedef enum { - ChannelStateDisabled = 0, - ChannelStateEnabled, - ChannelStateUnKnown -} ATA_CHANNEL_STATE; - -__checkReturn -__drv_sameIRQL -typedef ATA_CHANNEL_STATE - (*IDE_CHANNEL_ENABLED) ( - __in PVOID ControllerExtension, - __in ULONG Channel - ); - -typedef enum { - IdeBusPata = 0, - IdeBusSata, - IdeBusUnknown -} IDE_BUS_TYPE, *PIDE_BUS_TYPE; - -typedef struct _IDE_CONTROLLER_CONFIGURATION { - - // - // size of this structure - // - USHORT Version; - - // - // number of IDE channels - // - UCHAR NumberOfChannels; - - // - // Operating mode - // - IDE_OPERATION_MODE ControllerMode; - - // - // number of elements in the scatter gather list - // - UCHAR NumberOfPhysicalBreaks; - - // - // maximum transfer bytes supported by the controller - // - ULONG MaximumTransferLength; - - // - // Reserved for future use - // - BOOLEAN Reserved; - - // - // TRUE if the controller is in native mode - // - BOOLEAN NativeModeEnabled; - - // - // TRUE if the controller supports 64 bit DMA - // - BOOLEAN Dma64BitAddress; - - // - // TRUE if the controller is a bus master - // - BOOLEAN BusMaster; - - // - // SATA or PATA - // - IDE_BUS_TYPE AtaBusType; - - // - // IN only field. Pointer to hardware resources - // - PIDE_MINIPORT_RESOURCES ControllerResources; - -} IDE_CONTROLLER_CONFIGURATION, *PIDE_CONTROLLER_CONFIGURATION; - -__checkReturn -__drv_sameIRQL -typedef -BOOLEAN -(*IDE_ADAPTER_CONTROL) ( - __in PVOID ControllerExtension, - __in IDE_CONTROL_ACTION ControlAction, - __inout_opt PVOID Parameters - ); - -typedef struct _IDE_CONTROLLER_INTERFACE { - - // - // Size of this structure - // - USHORT Version; - - // - // Reserved for future use - // - USHORT Reserved; - - // Size of the controller device extension - // - ULONG ControllerExtensionSize; - - // - // Size of the channel extension - // - ULONG ChannelExtensionSize; - - // - // Alignment requirement - // - ULONG AlignmentMask; - - // - // mini driver entry point - // - - // - // init routine for each channel - // - IDE_CHANNEL_INIT AtaChannelInitRoutine; - - // - // channelEnabled routine - // - IDE_CHANNEL_ENABLED AtaControllerChannelEnabled; - - // - // Transfer mode select routine - // - IDE_TRANSFER_MODE_SELECT AtaControllerTransferModeSelect; - - // - // Adapter control routine - // - IDE_ADAPTER_CONTROL AtaAdapterControl; - -} IDE_CONTROLLER_INTERFACE, *PIDE_CONTROLLER_INTERFACE; - - -// -// -// -typedef struct _IDE_LBA_RANGE { - ULONGLONG StartSector:48; - ULONGLONG SectorCount:16; -} IDE_LBA_RANGE, *PIDE_LBA_RANGE; - -// by ATA spec, the SectorCount value is 1 - 0xffff. 0 means this entry is not valid. -#define MAX_IDE_LBA_RANGE_SECTOR_COUNT_VALUE 0xffff - - -// -// Transfer mode support bit masks -// -#define PIO_MODE0 (1 << 0) -#define PIO_MODE1 (1 << 1) -#define PIO_MODE2 (1 << 2) -#define PIO_MODE3 (1 << 3) -#define PIO_MODE4 (1 << 4) - -#define SWDMA_MODE0 (1 << 5) -#define SWDMA_MODE1 (1 << 6) -#define SWDMA_MODE2 (1 << 7) - -#define MWDMA_MODE0 (1 << 8) -#define MWDMA_MODE1 (1 << 9) -#define MWDMA_MODE2 (1 << 10) - -#define UDMA_MODE0 (1 << 11) -#define UDMA_MODE1 (1 << 12) -#define UDMA_MODE2 (1 << 13) -#define UDMA_MODE3 (1 << 14) -#define UDMA_MODE4 (1 << 15) -#define UDMA_MODE5 (1 << 16) - -#define PIO_SUPPORT (PIO_MODE0 | PIO_MODE1 | PIO_MODE2 | PIO_MODE3 | PIO_MODE4) -#define SWDMA_SUPPORT (SWDMA_MODE0 | SWDMA_MODE1 | SWDMA_MODE2) -#define MWDMA_SUPPORT (MWDMA_MODE0 | MWDMA_MODE1 | MWDMA_MODE2) -#define UDMA_SUPPORT (UNINITIALIZED_TRANSFER_MODE & (~(PIO_SUPPORT | SWDMA_SUPPORT | MWDMA_SUPPORT))) - -#define DMA_SUPPORT (SWDMA_SUPPORT | MWDMA_SUPPORT | UDMA_SUPPORT) -#define ALL_MODE_SUPPORT (PIO_SUPPORT | DMA_SUPPORT) - -#define PIO0 0 -#define PIO1 1 -#define PIO2 2 -#define PIO3 3 -#define PIO4 4 -#define SWDMA0 5 -#define SWDMA1 6 -#define SWDMA2 7 -#define MWDMA0 8 -#define MWDMA1 9 -#define MWDMA2 10 -#define UDMA0 11 - -#ifdef MAX_XFER_MODE -#undef MAX_XFER_MODE -#endif - -#define MAX_XFER_MODE 18 -#define UNINITIALIZED_CYCLE_TIME 0xffffffff -#define UNINITIALIZED_TRANSFER_MODE 0x7fffffff -#define IS_DEFAULT(mode) (!(mode & 0x80000000)) - -#ifdef GenTransferModeMask -#undef GenTransferModeMask -#endif - -#define GenTransferModeMask(i, mode) {\ - ULONG temp=0xffffffff; \ - mode = (temp >> (31-(i)));\ -} - -#define GetHighestBitSet(mode, i) {\ - ULONG temp = (mode); \ - i=0; \ - while (temp) { \ - temp >>= 1; \ - i++; \ - } \ - i--; \ -} - -__checkReturn -__drv_sameIRQL -ULONG -AtaPortInitializeEx( - __in PVOID DriverObject, - __in PVOID RegistryPath, - __in PIDE_CONTROLLER_INTERFACE ControllerInterface - ); - -// -// To query PCI IDE config space data -// -__drv_sameIRQL -ULONG -AtaPortGetBusData( - __in PVOID ControllerExtension, - __in_bcount(BufferLength) PVOID Buffer, - __in ULONG ConfigDataOffset, - __in ULONG BufferLength - ); - -// -// To save PCI IDE config space data -// -__drv_sameIRQL -ULONG -AtaPortSetBusData( - __in PVOID ControllerExtension, - __in_bcount(BufferLength) PVOID Buffer, - __in ULONG ConfigDataOffset, - __in ULONG BufferLength - ); - -__checkReturn -__drv_sameIRQL -PIDE_SCATTER_GATHER_LIST -AtaPortGetScatterGatherList ( - __in PVOID ChannelExtension, - __in PIDE_REQUEST_BLOCK Irb - ); - -__checkReturn -__drv_sameIRQL -IDE_PHYSICAL_ADDRESS -AtaPortGetPhysicalAddress ( - __in PVOID ChannelExtension, - __in_opt PIDE_REQUEST_BLOCK Irb, - __in_opt PVOID VirtualAddress, - __out_opt ULONG * Length - ); - -__checkReturn -__drv_sameIRQL -PVOID -AtaPortGetDeviceBase ( - __in PVOID ChannelExtension, - __in IDE_PHYSICAL_ADDRESS IoAddress, - __in ULONG NumberOfBytes - ); - -__drv_sameIRQL -VOID -AtaPortCompleteRequest( - __in PVOID ChannelExtension, - __in PIDE_REQUEST_BLOCK Irb - ); - -__drv_sameIRQL -VOID -AtaPortCompleteAllActiveRequests( - __in PVOID ChannelExtension, - __in UCHAR Target, - __in UCHAR Lun, - __in UCHAR IrbStatus - ); - -__drv_sameIRQL -VOID -AtaPortNotification( - __in IDE_NOTIFICATION_TYPE NotificationType, - __in PVOID ChannelExtension, - ... - ); - -__drv_sameIRQL -VOID -AtaPortMoveMemory( - __out_bcount(Length) PVOID WriteBuffer, - __in_bcount(Length) PVOID ReadBuffer, - __in ULONG Length - ); - -__drv_sameIRQL -VOID -AtaPortCopyMemory( - __out_bcount(Length) PVOID WriteBuffer, - __in_bcount(Length) PVOID ReadBuffer, - __in ULONG Length - ); - -__drv_sameIRQL -IDE_PHYSICAL_ADDRESS -AtaPortConvertUlongToPhysicalAddress( - __in ULONG_PTR UlongAddress - ); - -__drv_sameIRQL -ULONG -AtaPortConvertPhysicalAddressToUlong( - __in IDE_PHYSICAL_ADDRESS Address - ); - -__drv_sameIRQL -VOID -AtaPortStallExecution( - __in ULONG Delay - ); - -__checkReturn -__drv_sameIRQL -PVOID -AtaPortGetUnCachedExtension ( - __in PVOID ChannelExtension, - __in ULONG UncachedExtensionSize, - __in ULONG IrbExtensionSize - ); - -VOID -AtaPortDebugPrint( - ULONG DebugPrintLevel, - PCCHAR DebugMessage, - ... - ); - - -__drv_sameIRQL -VOID -AtaPortLogError( - __in PVOID ChannelExtension, - __in PIDE_ERROR_LOG_ENTRY ErrorLogEntry - ); - -__checkReturn -__drv_sameIRQL -PIDE_REQUEST_BLOCK -AtaPortBuildRequestSenseIrb( - __in PVOID ChannelExtension, - __in PIDE_REQUEST_BLOCK Irb - ); - -__drv_sameIRQL -VOID -AtaPortReleaseRequestSenseIrb( - __in PVOID ChannelExtension, - __in PIDE_REQUEST_BLOCK Irb - ); - -__drv_sameIRQL -VOID -AtaPortDeviceStateChange ( - __in PVOID ChannelExtension, - __in UCHAR TargetId, - __in UCHAR Lun, - __in ULONG BusyTimeout - ); - -__checkReturn -__drv_sameIRQL -BOOLEAN -AtaPortRequestCallback ( - __in IDE_CALLBACK_TYPE CallbackType, - __in PVOID ChannelExtension, - __in IDE_HW_DPC CallBackRoutine, - __in ULONG TimerValue - ); - -__checkReturn -__drv_sameIRQL -__bcount_opt(BufferSize) -PVOID -AtaPortRegistryAllocateBuffer ( - __in PVOID ChannelExtension, - __in ULONG BufferSize - ); - -__drv_sameIRQL -VOID -AtaPortRegistryFreeBuffer ( - __in PVOID ChannelExtension, - __in PVOID Buffer - ); - -__checkReturn -__drv_sameIRQL -BOOLEAN -AtaPortInitializeQueueTag ( - __in PVOID DeviceExtension, - __in UCHAR TargetId, - __in UCHAR Lun, - __in UCHAR MaxQueueTag - ); - -__checkReturn -__drv_sameIRQL -UCHAR -AtaPortAllocateQueueTag ( - __in PVOID DeviceExtension, - __in UCHAR TargetId, - __in UCHAR Lun - ); - -__drv_sameIRQL -VOID -AtaPortReleaseQueueTag ( - __in PVOID DeviceExtension, - __in UCHAR TargetId, - __in UCHAR Lun, - __in UCHAR QueueTag - ); - -__checkReturn -__drv_sameIRQL -BOOLEAN -AtaPortRegistryRead ( - __in PVOID ChannelExtension, - __in UCHAR ControllerNumber, - __in BOOLEAN ChannelSubKey, - __in PCHAR ValueName, - __in UCHAR ValueType, - __out_bcount_opt(*BufferLength) PUCHAR Buffer, - __inout PULONG BufferLength - ); - -__checkReturn -__drv_sameIRQL -BOOLEAN -AtaPortRegistryWrite ( - __in PVOID ChannelExtension, - __in UCHAR ControllerNumber, - __in BOOLEAN ChannelSubKey, - __in PCHAR ValueName, - __in UCHAR ValueType, - __in_bcount(*BufferLength) PUCHAR Buffer, - __in PULONG BufferLength - ); - -__checkReturn -__drv_sameIRQL -BOOLEAN -AtaPortRegistryWriteDeferred ( - __in PVOID ChannelExtension, - __in UCHAR ControllerNumber, - __in BOOLEAN ChannelSubKey, - __in PCHAR ValueName, - __in UCHAR ValueType, - __in_ecount(*BufferLength) PUCHAR Buffer, - __in PULONG BufferLength - ); - -VOID -__inline -AtaPortDeviceBusy ( - __in PVOID ChannelExtension, - __in UCHAR TargetId, - __in UCHAR Lun, - __in ULONG BusyTimeout - ) -{ - AtaPortDeviceStateChange(ChannelExtension, - TargetId, - Lun, - BusyTimeout - ); -} - -VOID -__inline -AtaPortDeviceReady ( - __in PVOID ChannelExtension, - __in UCHAR TargetId, - __in UCHAR Lun - ) -{ - AtaPortDeviceStateChange(ChannelExtension, - TargetId, - Lun, - 0 - ); -} - -__checkReturn -__drv_sameIRQL -BOOLEAN -__inline -AtaPortRegistryControllerKeyRead ( - __in PVOID ChannelExtension, - __in UCHAR ControllerNumber, - __in PCHAR ValueName, - __in UCHAR ValueType, - __out_opt PUCHAR Buffer, - __inout PULONG BufferLength - ) -{ - return AtaPortRegistryRead (ChannelExtension, - ControllerNumber, - FALSE, - ValueName, - ValueType, - Buffer, - BufferLength - ); -} - -__checkReturn -__drv_sameIRQL -BOOLEAN -__inline -AtaPortRegistryControllerKeyWrite ( - __in PVOID ChannelExtension, - __in UCHAR ControllerNumber, - __in PCHAR ValueName, - __in UCHAR ValueType, - __in PUCHAR Buffer, - __in PULONG BufferLength - ) -{ - return AtaPortRegistryWrite (ChannelExtension, - ControllerNumber, - FALSE, - ValueName, - ValueType, - Buffer, - BufferLength - ); -} - -__checkReturn -__drv_sameIRQL -BOOLEAN -__inline -AtaPortRegistryControllerKeyWriteDeferred ( - __in PVOID ChannelExtension, - __in UCHAR ControllerNumber, - __in PCHAR ValueName, - __in UCHAR ValueType, - __in PUCHAR Buffer, - __in PULONG BufferLength - ) -{ - return AtaPortRegistryWriteDeferred (ChannelExtension, - ControllerNumber, - FALSE, - ValueName, - ValueType, - Buffer, - BufferLength - ); -} - -__checkReturn -__drv_sameIRQL -BOOLEAN -__inline -AtaPortRegistryChannelSubkeyRead ( - __in PVOID ChannelExtension, - __in UCHAR ControllerNumber, - __in PCHAR ValueName, - __in UCHAR ValueType, - __out_opt PUCHAR Buffer, - __inout PULONG BufferLength - ) -{ - return AtaPortRegistryRead (ChannelExtension, - ControllerNumber, - TRUE, - ValueName, - ValueType, - Buffer, - BufferLength - ); -} - -__checkReturn -__drv_sameIRQL -BOOLEAN -__inline -AtaPortRegistryChannelSubkeyWrite ( - __in PVOID ChannelExtension, - __in UCHAR ControllerNumber, - __in PCHAR ValueName, - __in UCHAR ValueType, - __in PUCHAR Buffer, - __in PULONG BufferLength - ) -{ - return AtaPortRegistryWrite (ChannelExtension, - ControllerNumber, - TRUE, - ValueName, - ValueType, - Buffer, - BufferLength - ); -} - -__checkReturn -__drv_sameIRQL -BOOLEAN -__inline -AtaPortRegistryChannelSubkeyWriteDeferred ( - __in PVOID ChannelExtension, - __in UCHAR ControllerNumber, - __in PCHAR ValueName, - __in UCHAR ValueType, - __in PUCHAR Buffer, - __in PULONG BufferLength - ) -{ - return AtaPortRegistryWriteDeferred (ChannelExtension, - ControllerNumber, - TRUE, - ValueName, - ValueType, - Buffer, - BufferLength - ); - -} - -__checkReturn -__drv_sameIRQL -BOOLEAN -__inline -AtaPortRequestWorkerRoutine ( - __in PVOID ChannelExtension, - __in IDE_HW_DPC CallBackRoutine - ) -{ - return AtaPortRequestCallback (IdeWorkerRoutine, - ChannelExtension, - CallBackRoutine, - 0 - ); -} - -__checkReturn -__drv_sameIRQL -BOOLEAN -__inline -AtaPortRequestSynchronizedRoutine ( - __in PVOID ChannelExtension, - __in IDE_HW_DPC CallBackRoutine - ) -{ - return AtaPortRequestCallback (IdeSynchronizedRoutine, - ChannelExtension, - CallBackRoutine, - 0 - ); -} - -__checkReturn -__drv_sameIRQL -BOOLEAN -__inline -AtaPortControllerSyncRoutine ( - __in PVOID ChannelExtension, - __in IDE_HW_DPC CallBackRoutine - ) -{ - return AtaPortRequestCallback (IdeControllerSyncRoutine, - ChannelExtension, - CallBackRoutine, - 0 - ); -} - -__checkReturn -__drv_sameIRQL -BOOLEAN -__inline -AtaPortRequestTimer ( - __in PVOID ChannelExtension, - __in IDE_HW_DPC CallBackRoutine, - __in ULONG TimerValue - ) -{ - return AtaPortRequestCallback(IdeTimerRoutine, - ChannelExtension, - CallBackRoutine, - TimerValue - ); -} - -VOID -__inline -AtaPortBusChangeDetected ( - __in PVOID ChannelExtension - ) -{ - AtaPortNotification(IdeDeviceArrival, - ChannelExtension, - IDE_UNTAGGED, - 0 - ); -} - - -VOID -__inline -AtaPortDeviceArrived ( - __in PVOID ChannelExtension, - __in UCHAR TargetId - ) -{ - AtaPortNotification(IdeDeviceArrival, - ChannelExtension, - TargetId, - 0 - ); -} - -VOID -__inline -AtaPortDeviceRemoved ( - __in PVOID ChannelExtension, - __in UCHAR TargetId - ) -{ - AtaPortNotification(IdeDeviceRemoval, - ChannelExtension, - TargetId, - 0 - ); -} - -VOID -__inline -AtaPortRequestPowerStateChange ( - __in PVOID ChannelExtension, - __in UCHAR TargetId, - __in UCHAR Lun, - __in IDE_POWER_STATE DesiredPowerState - ) -{ - AtaPortNotification(IdePowerStateChange, - ChannelExtension, - TargetId, - Lun, - DesiredPowerState - ); -} - -__drv_sameIRQL -VOID -AtaPortQuerySystemTime ( - __out PLARGE_INTEGER CurrentTime - ); - -VOID -AtaPortDebugBreak ( - __in PVOID ChannelExtension - ); - -VOID -AtaPortTraceNotification( - __in ULONG NotificationType, - __in_opt PVOID HwDeviceExtension, - ... - ); - -// -// The below I/O access routines should be forwarded to the HAL or NTOSKRNL on -// Intel platforms. -// -UCHAR -AtaPortReadPortUchar( - __in PUCHAR Port - ); - -USHORT -AtaPortReadPortUshort( - __in PUSHORT Port - ); - -ULONG -AtaPortReadPortUlong( - __in PULONG Port - ); - -VOID -AtaPortReadPortBufferUchar( - __in PUCHAR Port, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ); - -VOID -AtaPortReadPortBufferUshort( - __in PUSHORT Port, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ); - -VOID -AtaPortReadPortBufferUlong( - __in PULONG Port, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ); - -UCHAR -AtaPortReadRegisterUchar( - __in PUCHAR Register - ); - -USHORT -AtaPortReadRegisterUshort( - __in PUSHORT Register - ); - -ULONG -AtaPortReadRegisterUlong( - __in PULONG Register - ); - -VOID -AtaPortReadRegisterBufferUchar( - __in PUCHAR Register, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ); - -VOID -AtaPortReadRegisterBufferUshort( - __in PUSHORT Register, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ); - -VOID -AtaPortReadRegisterBufferUlong( - __in PULONG Register, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ); - -VOID -AtaPortWritePortUchar( - __in PUCHAR Port, - __in UCHAR Value - ); - -VOID -AtaPortWritePortUshort( - __in PUSHORT Port, - __in USHORT Value - ); - -VOID -AtaPortWritePortUlong( - __in PULONG Port, - __in ULONG Value - ); - -VOID -AtaPortWritePortBufferUchar( - __in PUCHAR Port, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ); - -VOID -AtaPortWritePortBufferUshort( - __in PUSHORT Port, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ); - -VOID -AtaPortWritePortBufferUlong( - __in PULONG Port, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ); - - -VOID -AtaPortWriteRegisterUchar( - __in PUCHAR Register, - __in UCHAR Value - ); - -VOID -AtaPortWriteRegisterUshort( - __in PUSHORT Register, - __in USHORT Value - ); - -VOID -AtaPortWriteRegisterBufferUchar( - __in PUCHAR Register, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ); - -VOID -AtaPortWriteRegisterBufferUshort( - __in PUSHORT Register, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ); - -VOID -AtaPortWriteRegisterBufferUlong( - __in PULONG Register, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ); - -VOID -AtaPortWriteRegisterUlong( - __in PULONG Register, - __in ULONG Value - ); - -#ifdef __cplusplus -} -#endif - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4201) -#pragma warning(default:4214) -#endif - -#endif - -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - diff --git a/pub/ddk/irclass_ioctl.h b/pub/ddk/irclass_ioctl.h deleted file mode 100644 index a92ce8b..0000000 --- a/pub/ddk/irclass_ioctl.h +++ /dev/null @@ -1,634 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Copyright 2005 OSR, Open Systems Resources, Inc. All rights Reserved. -// -// Module Name: -// -// irclass_ioctl.h -// -// Abstract: -// -// This module contains the IOCTL definitions for the -// WDF IRCLASS class driver -// -// -// Author: -// -// Revision History: -// -#ifndef __IRCLASS_IOCTL_H__ -#define __IRCLASS_IOCTL_H__ - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// disable warnings -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4201) // nameless struct/union - -#define FILE_DEVICE_IRCLASS 0x0F60 - -// -// This value is defined in wdm.h, but user mode code shouldn't include wdm.h, -// so we define this here. -// -#ifndef MAXIMUM_FILENAME_LENGTH -#define MAXIMUM_FILENAME_LENGTH 256 -#endif - -/*++ - - IOCTL_IR_GET_DEVCAPS - - Returns device capabilities. For legacy devices, the Capabilities - registry entry can be used to populate this structure. For new devices, - the implementation is left as an exercise for the reader. - - The capabilities structure gets rev'ed when new capabilities are - added to the class driver. The class driver sends the largest possible - structure size to the port driver. The port driver populates the - capabilties structure, including the ProtocolVersion member. The - class driver then uses the ProtocolVersion member to decide which - version of IR_DEV_CAPS the port driver has filled in. - - Used in IR DDI Versions: V1, V2 - - V1: port driver must set ProtocolVersion to 0x100 and fill in - required members of IR_DEV_CAPS_V1 structure. - - V2: port driver must set ProtocolVersion to 0x200 and fill in - required members of IR_DEV_CAPS_V2 structure - - Parameters: - - lpOutBuffer - pointer to caller-allocated IR_DEV_CAPS_V2 structure - - nOutBufferSize - sizeof (IR_DEV_CAPS_V2) - ---*/ - -#define IOCTL_IR_GET_DEV_CAPS CTL_CODE(FILE_DEVICE_IRCLASS, \ - 1, \ - METHOD_BUFFERED, \ - FILE_READ_ACCESS) - -// -// IR_DEV_CAPS - This is the older version of teh IR_DEV_CAPS -// structure. This is here for historical reasons. New drivers should -// use the full IR_DEV_CAPS_V2 structure. -// -typedef struct _IR_DEV_CAPS { - - // - // Protocol version. Must be 100 (1.0) if using the IR_DEV_CAPS - // structure. - // - /* out */ ULONG_PTR ProtocolVersion; - - // - // Number of transmit ports - 0-32 - // - /* out */ ULONG_PTR NumTransmitPorts; - - // - // Number of receive ports - 0-32 (for snowflake, - // this would be one. For beanbag, this would be - // two (one for learning, one for normal) - // - /* out */ ULONG_PTR NumReceivePorts; - - // - // Bitmask identifying which receivers are - // learning receivers - low bit is the first - // receiver, second-low bit is the second receiver, - // etc - // - /* out */ ULONG_PTR LearningReceiverMask; - - // - // Flags - // - /* out */ ULONG_PTR DevCapsFlags; - -}IR_DEV_CAPS, *PIR_DEV_CAPS; - -typedef IR_DEV_CAPS IR_DEV_CAPS_V1, *PIR_DEV_CAPS_V1; - -#define DEV_CAPS_PROTOCOL_VERSION 0x100 -#define DEV_CAPS_PROTOCOL_VERSION_V1 0x100 - -// -// Valid capabilities bits for protocol V1 -// -#define DEV_CAPS_SUPPORTS_LEGACY_SIGNING 0x1 -#define DEV_CAPS_HAS_UNIQUE_SERIAL 0x2 -#define DEV_CAPS_CAN_FLASH_RECEIVER_LED 0x4 -#define DEV_CAPS_IS_LEGACY 0x8 - -#define V1_DEV_CAPS_VALID_BITS 0xf - - -// -// IR_DEV_CAPS_V2 - This is the full capabilties structure. Drivers -// should use this version whenever possible. The port -// driver must set ProtocolVersion to 0x200 (2.00) if using this -// strucutre. -// -// -// IR_DEV_CAPS_V2 is an extension of IR_DEV_CAPS_V1. This is expressed -// differently between C and C++. -// -#ifdef __cplusplus - -typedef struct _IR_DEV_CAPS_V2 : - public IR_DEV_CAPS_V1 { - -#else - -typedef struct _IR_DEV_CAPS_V2 { - IR_DEV_CAPS_V1; - -#endif - - // - // Bitmask with supported wake protocols - // - /* out */ ULONG_PTR WakeProtocols; - - // - // PNP ID for affiliated tuner. Only valid if - // DEV_CAPS_V2_ATTACHED_TO_TUNER is set. - // - /* out */ WCHAR TunerPnpId[MAXIMUM_FILENAME_LENGTH] ; - -} IR_DEV_CAPS_V2, *PIR_DEV_CAPS_V2; - -#define DEV_CAPS_PROTOCOL_VERSION_V2 0x200 - -// -// Valid capabilities bits for protocol V2 -// - -#define V2_DEV_CAPS_SUPPORTS_WAKE 0x10 -#define V2_DEV_CAPS_MULTIPLE_WAKE 0x20 -#define V2_DEV_CAPS_PROGRAMMABLE_WAKE 0x40 -#define V2_DEV_CAPS_VOLATILE_WAKE_PATTERN 0x80 - -#define V2_DEV_CAPS_LEARNING_ONLY 0x100 -#define V2_DEV_CAPS_NARROW_BPF 0x200 -#define V2_DEV_CAPS_NO_SWDECODE_INPUT 0x400 -#define V2_DEV_CAPS_HWDECODE_INPUT 0x800 - -#define V2_DEV_CAPS_EMULATOR_V1 0x1000 -#define V2_DEV_CAPS_EMULATOR_V2 0x2000 -#define V2_DEV_CAPS_ATTACHED_TO_TUNER 0x4000 - -#define V2_DEV_CAPS_VALID_BITS 0x7fff - -// -// Wake protocols -// -#define V2_WAKE_PROTOCOL_RC6 0x1 -#define V2_WAKE_PROTOCOL_QP 0x2 -#define V2_WAKE_PROTOCOL_SAMSUNG 0x4 -#define V2_WAKE_PROTOCOL_DONTCARE 0x8 - -#define V2_VALID_WAKE_PROTOCOLS 0xf - -/*++ - - IOCTL_IR_GET_EMITTERS - - Gets attached emitters and returns the information in a bitmask. - Information returned in lpOutBuffer. - - Used in IR DDI Versions: V1, V2 - - Parameters: - - lpOutBuffer - pointer to caller-allocated buffer sizeof(ULONG) - - nOutBufferSize - sizeof(ULONG) - ---*/ -#define IOCTL_IR_GET_EMITTERS CTL_CODE(FILE_DEVICE_IRCLASS, \ - 2, \ - METHOD_BUFFERED, \ - FILE_READ_ACCESS) - - -/*++ - - IOCTL_IR_FLASH_RECEIVER - - Flash an LED on the given receiver. Used to tell the user where to point - their remote, so a given "receiver box" with multiple receiver parts only - needs one LED to flash. - - Used in IR DDI Versions: V1, V2 - - Parameters: - - lpInBuffer - pointer to caller-allocated buffer sizeof(ULONG) with - bitmask of receivers to flash - - nInBufferSize - sizeof(ULONG) - ---*/ -#define IOCTL_IR_FLASH_RECEIVER CTL_CODE(FILE_DEVICE_IRCLASS, \ - 3, \ - METHOD_BUFFERED, \ - FILE_WRITE_ACCESS) - - -/*++ - - IOCTL_IR_RESET_DEVICE - - Resets the given device. When a device is reset, all pending transmit and - receive IOCTLs are cancelled by the class driver - - Used in IR DDI Versions: V1, V2 - - Parameters: - ---*/ -#define IOCTL_IR_RESET_DEVICE CTL_CODE(FILE_DEVICE_IRCLASS, \ - 4, \ - METHOD_BUFFERED, \ - FILE_WRITE_ACCESS) - - -/*++ - - IOCTL_IR_TRANSMIT - - - Transmits the given IR stream on the given port(s) at the given carrier - frequency. On legacy devices, this maintains the pre-existing carrier - frequency, port masks, and sample period values. (ie. it gets the old - values, changes them, transmits, and then changes them back.) - - This IOCTL is synchronous. It does not return until the IR has actually - been transmitted. - - Used in IR DDI Versions: V1, V2 - - Parameters: - - lpInBuffer - pointer to caller-allocated IR_TRANSMIT_PARAMS structure - - nInBufferSize - sizeof(IR_TRANSMIT_PARAMS) - - lpOutBuffer - pointer to caller-allocated IR_TRANSMIT_CHUNCK that contains - the data to be transmitted - - nOutBufferSize - size of caller-allocated buffer. - ---*/ -#define IOCTL_IR_TRANSMIT CTL_CODE(FILE_DEVICE_IRCLASS, \ - 5, \ - METHOD_IN_DIRECT, \ - FILE_WRITE_ACCESS) - - -typedef struct _IR_TRANSMIT_PARAMS { - - // - // Bitmask containing ports to transmit on. - // - /* in */ ULONG_PTR TransmitPortMask; - - // - // Carrier period to use. If zero, Flags - // needs to define DC mode or pulse mode. - // - /* in */ ULONG_PTR CarrierPeriod; - - // - // Flags - // - /* in */ ULONG_PTR Flags; - - // - // If pulse mode is set, this contains the length of pulse - // to use. - // - /* in */ ULONG_PTR PulseSize; - -} IR_TRANSMIT_PARAMS, *PIR_TRANSMIT_PARAMS; - -#define TRANSMIT_FLAGS_PULSE_MODE 0x0001 -#define TRANSMIT_FLAGS_DC_MODE 0x0002 - -typedef struct _IR_TRANSMIT_CHUNK { - - // - // offset, in bytes, from Data member of this buffer to next - // IR_TRANSMIT_CHUNK (or zero if no more chunks in buffer) - // - ULONG_PTR OffsetToNextChunk; - - // - // number of times to serially repeat "ByteCount" bytes of data - // - ULONG_PTR RepeatCount; - - // - // count of data bytes to be sent - // - ULONG_PTR ByteCount; - - // - // First byte of "ByteCount" bytes of data. - // Note: Each chunk is filled to integral ULONG_PTR boundary - // - LONG Data[1]; - -} IR_TRANSMIT_CHUNK, *PIR_TRANSMIT_CHUNK; - - -/*++ - - IOCTL_IR_RECEIVE - - Receives IR. Does not return until IR is available. If there is no more IR - data available than space in the buffer, IrReceiveParms->DataEnd is set to - TRUE. The provided timeout is used to define the end of a keypress. So, - once the driver starts receiving IR from the hardware, it will continue to - add it to the buffer until the specified time passes with no IR. - - Used in IR DDI Versions: V1, V2 - - Parameters: - - lpOutBuffer - pointer to caller-allocated IR_RECEIVE_PARAMS structure - - nOutBufferSize - sizeof(IR_RECEIVE_PARAMS) - ---*/ -#define IOCTL_IR_RECEIVE CTL_CODE(FILE_DEVICE_IRCLASS, \ - 6, \ - METHOD_OUT_DIRECT, \ - FILE_READ_ACCESS) - -typedef struct _IR_RECEIVE_PARAMS { - - // - // Does this receive represent a data end event? - // - /* out */ ULONG_PTR DataEnd; - - // - // Size of the data buffer - // - /* in */ ULONG_PTR ByteCount; - - // - // The data buffer itself. - // - /* out */ LONG Data[1]; - -}IR_RECEIVE_PARAMS, *PIR_RECEIVE_PARAMS; - - -/*++ - - IOCTL_IR_PRIORITY_RECEIVE - - This request is sent from CIRClass and receives Run Length Coded (RLC) IR - data when the device is running in Priority Receive mode. If the device is - not already in Priority Receive mode, initiated by having previously - received an IOCTL_ENTER_PRIORITY_RECEIVE, the CIR Port driver fails this - request immediately. If in Priority Receive mode, the request will remain - pending until one of two events occurs: - - 1) The data buffer provided in the request has been completely filled with - data. - - 2) An IR timeout occurs. The length of time required for the IR timeout was - specified when entering Priority Receive mode. - - While in Priority Receive mode and processing IOCTL_IR_PRIORITY_RECEIVE - requests, IOCTL_IR_RECEIVE requests remain pending and are not filled with - IR data. - - Used in IR DDI Versions: V1, V2 - - Parameters: - - lpOutBuffer - pointer to caller-allocated IR_PRIORITY_RECEIVE_PARAMS structure - - nOutBufferSize - sizeof(IR_PRIORITY_RECEIVE_PARAMS) - ---*/ -#define IOCTL_IR_PRIORITY_RECEIVE CTL_CODE(FILE_DEVICE_IRCLASS, \ - 8, \ - METHOD_OUT_DIRECT, \ - FILE_READ_ACCESS) - -typedef struct _IR_PRIORITY_RECEIVE_PARAMS { - - // - // Does this receive represent a data end event? - // - /* out */ ULONG_PTR DataEnd; - - // - // Size of the data buffer - // - /* in */ ULONG_PTR ByteCount; - - // - // Carrier frequency (only valid if DataEnd != 0) - // - /* out */ ULONG_PTR CarrierFrequency; - - // - // The data buffer itself. - // - /* in */ LONG Data[1]; - -}IR_PRIORITY_RECEIVE_PARAMS, *PIR_PRIORITY_RECEIVE_PARAMS; - -/*++ - - IOCTL_IR_HANDSHAKE - - This IOCTL is sent from CIRClass before creating the HID child device to - represent the port. This IOCTL is to be completed synchronously by the - port as an indication that it is prepared to return RLC IR data to the - class driver. - - Used in IR DDI Versions: V1, V2 - - Parameters: - ---*/ -#define IOCTL_IR_HANDSHAKE CTL_CODE(FILE_DEVICE_IRCLASS, \ - 9, \ - METHOD_BUFFERED, \ - FILE_ANY_ACCESS) -/*++ - - IOCTL_IR_ENTER_PRIORITY_RECEIVE - - This request is sent to prepare the port to enter Priority Receive mode. - While the device is in Priority Receive mode, all IOCTL_IR_RECEIVE requests - should be starved and IOCTL_IR_PRIORITY_RECEIVE requests should be - completed. - - Used in IR DDI Versions: V1, V2 - - Parameters: - - lpOutBuffer - pointer to caller-allocated IOCTL_IR_ENTER_PRIORITY_RECEIVE_PARAMS structure - - nOutBufferSize - sizeof(IOCTL_IR_ENTER_PRIORITY_RECEIVE_PARAMS) - ---*/ -#define IOCTL_IR_ENTER_PRIORITY_RECEIVE CTL_CODE(FILE_DEVICE_IRCLASS, \ - 10, \ - METHOD_BUFFERED, \ - FILE_WRITE_ACCESS) - -typedef struct _IOCTL_IR_ENTER_PRIORITY_RECEIVE_PARAMS { - - // - // Index of the receiver to use - // - /* in */ ULONG_PTR Receiver; - - // - // Timeout value, in micsec. Used to define - // the end of a given sample. - // - /* in */ ULONG_PTR TimeOut; - -}IOCTL_IR_ENTER_PRIORITY_RECEIVE_PARAMS, *PIOCTL_IR_ENTER_PRIORITY_RECEIVE_PARAMS; - - -/*++ - - IOCTL_IR_EXIT_PRIORITY_RECEIVE - - This request is sent to end Priority Receive mode. Upon receipt of the - request, the port should abort any outstanding IOCTL_IR_PRIORITY_RECEIVE - requests and fail any future IOCTL_IR_PRIORITY_RECEIVE requests (before - receiving a new IOCTL_IR_ENTER_PRIORITY_RECEIVE request). As a result of - receiving this IOCTL, the CIR Port driver is responsible for restoring the - device to the state that it was in before receipt of the - IOCTL_IR_ENTER_PRIORITY_RECEIVE. - - Used in IR DDI Versions: V1, V2 - - Parameters: - ---*/ -#define IOCTL_IR_EXIT_PRIORITY_RECEIVE CTL_CODE(FILE_DEVICE_IRCLASS, \ - 11, \ - METHOD_BUFFERED, \ - FILE_WRITE_ACCESS) - -/*++ - - IOCTL_IR_USER_OPEN - - This IOCTL is sent from the class driver when a user has indirectly opened - the port driver through IRCLASS. This IOCTL is informational only, allowing - the port to do any initialization or bookkeeping required to handle - requests not directly originating from IRCLASS. - - Used in IR DDI Versions: V1, V2 - - Parameters: - ---*/ -#define IOCTL_IR_USER_OPEN CTL_CODE(FILE_DEVICE_IRCLASS, \ - 12, \ - METHOD_BUFFERED, \ - FILE_WRITE_ACCESS) - - -/*++ - - IOCTL_IR_USER_CLOSE - - This IOCTL is sent from IRCLASS when a user has indirectly closed the port - driver. This IOCTL is informational only, allowing the port to do any - cleanup required when closed by a user. - - Used in IR DDI Versions: V1, V2 - - Parameters: - ---*/ -#define IOCTL_IR_USER_CLOSE CTL_CODE(FILE_DEVICE_IRCLASS, \ - 13, \ - METHOD_BUFFERED, \ - FILE_WRITE_ACCESS) - -/*++ - - IOCTL_IR_SET_WAKE_PATTERN - - This IOCTL is sent from IRCLASS to configure the wake pattern. This is - done dynamically in response to user input, so it could be done at any - time. - - Used in IR DDI Versions: V2 only - - Parameters: - - lpInBuffer - pointer to caller-allocated IR_SET_WAKE_PATTERN_PARAMS structure - - nInBufferSize - sizeof(IR_SET_WAKE_PATTERN_PARAMS) - ---*/ -#define IOCTL_IR_SET_WAKE_PATTERN CTL_CODE(FILE_DEVICE_IRCLASS, \ - 14, \ - METHOD_BUFFERED, \ - FILE_WRITE_ACCESS) - -typedef struct _IOCTL_IR_SET_WAKE_PATTERN_PARAMS { - - // - // Protocol to wake on. One of the V2_WAKE_PROTOCOL_* values. - // - /* in */ ULONG Protocol; - - // - // Key code to wake on. WAKE_CODE_ALL_KEYS to wake on all keys. See - // WAKE_KEY_* for valid values. - // - /* in */ ULONG Payload; - - // - // Address to wake on. The device may ignore this, but we tell them - // anyway. - // - /* in */ ULONG Address; -} IR_SET_WAKE_PATTERN_PARAMS, *PIR_SET_WAKE_PATTERN_PARAMS; - -// -// Valid wake keys. A good implementation will be able to wake on all key -// codes but this is not required. -// -#define WAKE_KEY_POWER_TOGGLE 0x0C -#define WAKE_KEY_DISCRETE_ON 0x29 -#define WAKE_KEY_ALL_KEYS 0xffff - -//re-enable warnings -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4201) -// #pragma warning(default:4214) -#endif - - -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - -#endif // __IRCLASS_IOCTL_H__ - diff --git a/pub/ddk/iscsicfg.h b/pub/ddk/iscsicfg.h deleted file mode 100644 index 654c329..0000000 --- a/pub/ddk/iscsicfg.h +++ /dev/null @@ -1,388 +0,0 @@ -#ifndef _iscsicfg_h_ -#define _iscsicfg_h_ - -// MSiSCSI_TCPIPConfig - MSiSCSI_TCPIPConfig - - -//*************************************************************************** -// -// iscsicfg.h -// -// Module: iScsi Discovery api -// -// Purpose: Header defining interface between user mode configuration -// apps and HBA driver miniport. -// -// Copyright (c) 2001 Microsoft Corporation -// -//*************************************************************************** - -#include - -// -// -// This class is required. -// -// TCP/IP configuration class, implement one instance for each IP address on -// your adapter. For example, if you adapter supports 3 IP addresses then -// your adapter would implement 3 instances of this class. -// -// This class uses PDO instance names with 1 instance for each TCP/IP interface. -// - -#define MSiSCSI_TCPIPConfigGuid \ - { 0x7a2c6c2b,0xe5a5,0x49ad, { 0xad,0x68,0x13,0x30,0x89,0xac,0xd7,0x4d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_TCPIPConfig_GUID, \ - 0x7a2c6c2b,0xe5a5,0x49ad,0xad,0x68,0x13,0x30,0x89,0xac,0xd7,0x4d); -#endif - - -typedef struct _MSiSCSI_TCPIPConfig -{ - // TRUE if the adapter should use an autogenerated and non routable (link local) address as its IP address. - BOOLEAN UseLinkLocalAddress; - #define MSiSCSI_TCPIPConfig_UseLinkLocalAddress_SIZE sizeof(BOOLEAN) - #define MSiSCSI_TCPIPConfig_UseLinkLocalAddress_ID 1 - - // TRUE if the adapter should use DHCP to discovery its IP address information. - BOOLEAN EnableDHCP; - #define MSiSCSI_TCPIPConfig_EnableDHCP_SIZE sizeof(BOOLEAN) - #define MSiSCSI_TCPIPConfig_EnableDHCP_ID 2 - - // TRUE if the adapter should use DHCP to discover DNS addresses. - BOOLEAN UseDHCPForDNS; - #define MSiSCSI_TCPIPConfig_UseDHCPForDNS_SIZE sizeof(BOOLEAN) - #define MSiSCSI_TCPIPConfig_UseDHCPForDNS_ID 3 - - // IP Versions supported **Add #defines** - ULONG IPVersions; - #define MSiSCSI_TCPIPConfig_IPVersions_SIZE sizeof(ULONG) - #define MSiSCSI_TCPIPConfig_IPVersions_ID 4 - - // IP address of the adapter - ISCSI_IP_Address IpAddress; - #define MSiSCSI_TCPIPConfig_IpAddress_SIZE sizeof(ISCSI_IP_Address) - #define MSiSCSI_TCPIPConfig_IpAddress_ID 5 - - // Static Default Gateway IP address - ISCSI_IP_Address DefaultGateway; - #define MSiSCSI_TCPIPConfig_DefaultGateway_SIZE sizeof(ISCSI_IP_Address) - #define MSiSCSI_TCPIPConfig_DefaultGateway_ID 6 - - // Static Subnet Mask - ISCSI_IP_Address SubnetMask; - #define MSiSCSI_TCPIPConfig_SubnetMask_SIZE sizeof(ISCSI_IP_Address) - #define MSiSCSI_TCPIPConfig_SubnetMask_ID 7 - - // Preferred DNS Server - ISCSI_IP_Address PreferredDNSServer; - #define MSiSCSI_TCPIPConfig_PreferredDNSServer_SIZE sizeof(ISCSI_IP_Address) - #define MSiSCSI_TCPIPConfig_PreferredDNSServer_ID 8 - - // Alternate DNS Server - ISCSI_IP_Address AlternateDNSServer; - #define MSiSCSI_TCPIPConfig_AlternateDNSServer_SIZE sizeof(ISCSI_IP_Address) - #define MSiSCSI_TCPIPConfig_AlternateDNSServer_ID 9 - -} MSiSCSI_TCPIPConfig, *PMSiSCSI_TCPIPConfig; - -#define MSiSCSI_TCPIPConfig_SIZE (FIELD_OFFSET(MSiSCSI_TCPIPConfig, AlternateDNSServer) + MSiSCSI_TCPIPConfig_AlternateDNSServer_SIZE) - -// MSiSCSI_NICConfig - MSiSCSI_NICConfig - -// -// This class is optional. -// -// NIC Port configuration class, implement one instance for each physical -// network interface port on your adapter. -// -// This class uses PDO instance names with 1 instance for each physical -// network interface port on your adapter. -// - -typedef enum -{ - ISCSI_NIC_LINKSTATE_DISCONNECTED = 0, - ISCSI_NIC_LINKSTATE_CONNECTED = 1 -} ISCSI_NIC_LINKSTATE, *PISCSI_NIC_LINKSTATE; - -#define MSiSCSI_NICConfigGuid \ - { 0xc75258e9,0xbe79,0x4a48, { 0xa2,0x3d,0xee,0xb6,0xf8,0xfb,0x94,0x0c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_NICConfig_GUID, \ - 0xc75258e9,0xbe79,0x4a48,0xa2,0x3d,0xee,0xb6,0xf8,0xfb,0x94,0x0c); -#endif - - -typedef struct _MSiSCSI_NICConfig -{ - // Speed of network link in megabits per second. - ULONG LinkSpeed; - #define MSiSCSI_NICConfig_LinkSpeed_SIZE sizeof(ULONG) - #define MSiSCSI_NICConfig_LinkSpeed_ID 1 - - // Maximum Speed of network link in megabits per second. - ULONG MaxLinkSpeed; - #define MSiSCSI_NICConfig_MaxLinkSpeed_SIZE sizeof(ULONG) - #define MSiSCSI_NICConfig_MaxLinkSpeed_ID 2 - - // Link State **typedef** - ULONG LinkState; - #define MSiSCSI_NICConfig_LinkState_SIZE sizeof(ULONG) - #define MSiSCSI_NICConfig_LinkState_ID 3 - - // Maximum frame size - ULONG MaxFrameSize; - #define MSiSCSI_NICConfig_MaxFrameSize_SIZE sizeof(ULONG) - #define MSiSCSI_NICConfig_MaxFrameSize_ID 4 - - // Ethernet MAC Address - UCHAR MacAddress[6]; - #define MSiSCSI_NICConfig_MacAddress_SIZE sizeof(UCHAR[6]) - #define MSiSCSI_NICConfig_MacAddress_ID 5 - -} MSiSCSI_NICConfig, *PMSiSCSI_NICConfig; - -#define MSiSCSI_NICConfig_SIZE (FIELD_OFFSET(MSiSCSI_NICConfig, MacAddress) + MSiSCSI_NICConfig_MacAddress_SIZE) - -// MSiSCSI_BootConfiguration - MSiSCSI_BootConfiguration - -// -// This class is optional. -// -// This class exposes the boot configuration if the adapter is configured to -// boot from an iSCSI disk. -// -// This class uses PDO instance names with a single instance. -// - -#define MSiSCSI_BootConfigurationGuid \ - { 0x53ef8d5f,0x36f3,0x4124, { 0x8b,0x76,0xc6,0xad,0x52,0x1a,0x10,0x21 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_BootConfiguration_GUID, \ - 0x53ef8d5f,0x36f3,0x4124,0x8b,0x76,0xc6,0xad,0x52,0x1a,0x10,0x21); -#endif - - -typedef struct _MSiSCSI_BootConfiguration -{ - // LUN on target to use as boot device. - ULONGLONG LUN; - #define MSiSCSI_BootConfiguration_LUN_SIZE sizeof(ULONGLONG) - #define MSiSCSI_BootConfiguration_LUN_ID 1 - - // Security flags - ULONGLONG SecurityFlags; - #define MSiSCSI_BootConfiguration_SecurityFlags_SIZE sizeof(ULONGLONG) - #define MSiSCSI_BootConfiguration_SecurityFlags_ID 2 - - // Size in bytes of Target Username. - ULONG UsernameSize; - #define MSiSCSI_BootConfiguration_UsernameSize_SIZE sizeof(ULONG) - #define MSiSCSI_BootConfiguration_UsernameSize_ID 3 - - // Size in bytes of Target Password. - ULONG PasswordSize; - #define MSiSCSI_BootConfiguration_PasswordSize_SIZE sizeof(ULONG) - #define MSiSCSI_BootConfiguration_PasswordSize_ID 4 - - // If TRUE dynamically discover boot device. - BOOLEAN DiscoverBootDevice; - #define MSiSCSI_BootConfiguration_DiscoverBootDevice_SIZE sizeof(BOOLEAN) - #define MSiSCSI_BootConfiguration_DiscoverBootDevice_ID 5 - - // The InitiatorNode specifies the iSCSI name of the initiator node to use for the connection. If empty, then the adapter can choose any initiator node name. - WCHAR InitiatorNode[223 + 1]; - #define MSiSCSI_BootConfiguration_InitiatorNode_ID 6 - - // TargetName specifies the iSCSI target name on which the boot device resides. - WCHAR TargetName[223 + 1]; - #define MSiSCSI_BootConfiguration_TargetName_ID 7 - - // Target portal to use for connection to the target. - ISCSI_TargetPortal TargetPortal; - #define MSiSCSI_BootConfiguration_TargetPortal_SIZE sizeof(ISCSI_TargetPortal) - #define MSiSCSI_BootConfiguration_TargetPortal_ID 8 - - // Options that affect how login is performed. See ISCSI_LoginOptions - ISCSI_LoginOptions LoginOptions; - #define MSiSCSI_BootConfiguration_LoginOptions_SIZE sizeof(ISCSI_LoginOptions) - #define MSiSCSI_BootConfiguration_LoginOptions_ID 9 - - // **extra fields** Authentication Username, for CHAP this is the CHAP Name (CHAP_N) use when authenticating with the target. NOTE: This field is a variable length array, the field that follows this field starts immediately after the end of this field subject to appropriate padding. - UCHAR Username[1]; - #define MSiSCSI_BootConfiguration_Username_ID 10 - - // Authentication Password, for CHAP this is the shared secret to use when generating the response to the target challange. This field is a variable length array. -// UCHAR Password[1]; - #define MSiSCSI_BootConfiguration_Password_ID 11 - -} MSiSCSI_BootConfiguration, *PMSiSCSI_BootConfiguration; - -// MSiSCSI_SecurityCapabilities - MSiSCSI_SecurityCapabilities - -// -// This class is required if adapter supports IPSEC. -// -// This class exposes the security capabilities if the adapter -// supports IPSEC. -// -// This class uses PDO instance names with a single instance. -// -typedef enum { - ISCSI_ENCRYPT_NONE = 0, - ISCSI_ENCRYPT_3DES_HMAC_SHA1 = 1, - ISCSI_ENCRYPT_AES_CTR = 2 -} ISCSI_ENCRYPTION_TYPES, *PISCSI_ENCRYPTION_TYPES; - - -#define MSiSCSI_SecurityCapabilitiesGuid \ - { 0x225b9d64,0x47a9,0x41c8, { 0x81,0xcd,0x69,0xbc,0x02,0x65,0x2d,0x87 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_SecurityCapabilities_GUID, \ - 0x225b9d64,0x47a9,0x41c8,0x81,0xcd,0x69,0xbc,0x02,0x65,0x2d,0x87); -#endif - - -typedef struct _MSiSCSI_SecurityCapabilities -{ - // TRUE if the adapter can use IPSEC to protect iSCSI traffic. - BOOLEAN ProtectiScsiTraffic; - #define MSiSCSI_SecurityCapabilities_ProtectiScsiTraffic_SIZE sizeof(BOOLEAN) - #define MSiSCSI_SecurityCapabilities_ProtectiScsiTraffic_ID 1 - - // TRUE if the adapter can use IPSEC to protect iSNS traffic. - BOOLEAN ProtectiSNSTraffic; - #define MSiSCSI_SecurityCapabilities_ProtectiSNSTraffic_SIZE sizeof(BOOLEAN) - #define MSiSCSI_SecurityCapabilities_ProtectiSNSTraffic_ID 2 - - // TRUE if adapter supports certificates - BOOLEAN CertificatesSupported; - #define MSiSCSI_SecurityCapabilities_CertificatesSupported_SIZE sizeof(BOOLEAN) - #define MSiSCSI_SecurityCapabilities_CertificatesSupported_ID 3 - - // Number of encryption types available. - ULONG EncryptionAvailableCount; - #define MSiSCSI_SecurityCapabilities_EncryptionAvailableCount_SIZE sizeof(ULONG) - #define MSiSCSI_SecurityCapabilities_EncryptionAvailableCount_ID 4 - - // **typedef** Array of encryption types. This field is a variable length array. - ULONG EncryptionAvailable[1]; - #define MSiSCSI_SecurityCapabilities_EncryptionAvailable_ID 5 - -} MSiSCSI_SecurityCapabilities, *PMSiSCSI_SecurityCapabilities; - -// MSiSCSI_DiscoveryConfig - MSiSCSI_DiscoveryConfig - -// -// This class is required. -// -// This class exposes the configuration capabilities for the adapter to be able to -// perform target discovery. An adapter needs to support target discovery -// if it is ever placed on a separate network from the PC NIC. Although -// the iSCSI Initiator service can use this class with any discovery mechanism -// the best results are obtained by using iSNS. -// -// This class uses PDO instance names with a single instance. -// - -#define MSiSCSI_DiscoveryConfigGuid \ - { 0x45755098,0x4291,0x43df, { 0x97,0x20,0xb5,0x86,0x42,0xdd,0x63,0xdf } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_DiscoveryConfig_GUID, \ - 0x45755098,0x4291,0x43df,0x97,0x20,0xb5,0x86,0x42,0xdd,0x63,0xdf); -#endif - - -typedef struct _MSiSCSI_DiscoveryConfig -{ - // TRUE if adapter should perform target discovery via iSNS. - BOOLEAN PerformiSNSDiscovery; - #define MSiSCSI_DiscoveryConfig_PerformiSNSDiscovery_SIZE sizeof(BOOLEAN) - #define MSiSCSI_DiscoveryConfig_PerformiSNSDiscovery_ID 1 - - // TRUE if adapter should perform target discovery via SLP. - BOOLEAN PerformSLPDiscovery; - #define MSiSCSI_DiscoveryConfig_PerformSLPDiscovery_SIZE sizeof(BOOLEAN) - #define MSiSCSI_DiscoveryConfig_PerformSLPDiscovery_ID 2 - - // TRUE if adapter should perform automatic discovery of iSNS server. - BOOLEAN AutomaticiSNSDiscovery; - #define MSiSCSI_DiscoveryConfig_AutomaticiSNSDiscovery_SIZE sizeof(BOOLEAN) - #define MSiSCSI_DiscoveryConfig_AutomaticiSNSDiscovery_ID 3 - - // Default initiator name for registering with iSNS. - WCHAR InitiatorName[256 + 1]; - #define MSiSCSI_DiscoveryConfig_InitiatorName_ID 4 - - // If AutomaticiSNSDiscovery is FALSE then this contains the fixed addresses of iSNS servers - ISCSI_IP_Address iSNSServer; - #define MSiSCSI_DiscoveryConfig_iSNSServer_SIZE sizeof(ISCSI_IP_Address) - #define MSiSCSI_DiscoveryConfig_iSNSServer_ID 5 - -} MSiSCSI_DiscoveryConfig, *PMSiSCSI_DiscoveryConfig; - -#define MSiSCSI_DiscoveryConfig_SIZE (FIELD_OFFSET(MSiSCSI_DiscoveryConfig, iSNSServer) + MSiSCSI_DiscoveryConfig_iSNSServer_SIZE) - -// MSiSCSI_RADIUSConfig - MSiSCSI_RADIUSConfig - -// -// This class is required if adapter supports using RADIUS for CHAP authentication. -// -// This class exposes the configuration capabilities if the adapter able to -// use radius to perform CHAP authentication. Using RADIUS is encouraged -// since it allows centralized management of CHAP credentials. -// -// This class uses PDO instance names with a single instance. -// - -#define MSiSCSI_RADIUSConfigGuid \ - { 0x8eaef9d8,0xc053,0x49d3, { 0x92,0x05,0x65,0xc7,0x03,0xc2,0xec,0xc1 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_RADIUSConfig_GUID, \ - 0x8eaef9d8,0xc053,0x49d3,0x92,0x05,0x65,0xc7,0x03,0xc2,0xec,0xc1); -#endif - - -typedef struct _MSiSCSI_RADIUSConfig -{ - // TRUE if adapter should use RADIUS for CHAP authentication - BOOLEAN UseRADIUSForCHAP; - #define MSiSCSI_RADIUSConfig_UseRADIUSForCHAP_SIZE sizeof(BOOLEAN) - #define MSiSCSI_RADIUSConfig_UseRADIUSForCHAP_ID 1 - - // Size in bytes of shared secret used to communicate with RADIUS servers - ULONG SharedSecretSizeInBytes; - #define MSiSCSI_RADIUSConfig_SharedSecretSizeInBytes_SIZE sizeof(ULONG) - #define MSiSCSI_RADIUSConfig_SharedSecretSizeInBytes_ID 2 - - // Fixed address of primary RADIUS server - ISCSI_IP_Address RADIUSServer; - #define MSiSCSI_RADIUSConfig_RADIUSServer_SIZE sizeof(ISCSI_IP_Address) - #define MSiSCSI_RADIUSConfig_RADIUSServer_ID 3 - - // Fixed address of backup RADIUS server - ISCSI_IP_Address BackupRADIUSServer; - #define MSiSCSI_RADIUSConfig_BackupRADIUSServer_SIZE sizeof(ISCSI_IP_Address) - #define MSiSCSI_RADIUSConfig_BackupRADIUSServer_ID 4 - - // Must be zero - ULONG Reserved; - #define MSiSCSI_RADIUSConfig_Reserved_SIZE sizeof(ULONG) - #define MSiSCSI_RADIUSConfig_Reserved_ID 5 - - // Shared secret for communicating with primary and backup RADIUS servers. This field is a variable length array. - UCHAR SharedSecret[1]; - #define MSiSCSI_RADIUSConfig_SharedSecret_ID 6 - -} MSiSCSI_RADIUSConfig, *PMSiSCSI_RADIUSConfig; - -#endif - diff --git a/pub/ddk/iscsidef.h b/pub/ddk/iscsidef.h deleted file mode 100644 index ff24f74..0000000 --- a/pub/ddk/iscsidef.h +++ /dev/null @@ -1,350 +0,0 @@ -#ifndef _iscsidef_h_ -#define _iscsidef_h_ - -// ISCSI_IP_Address - ISCSI_IP_Address - - -//*************************************************************************** -// -// iscsidef.h -// -// Module: iScsi Discovery api -// -// Purpose: Internal header defining interface between user mode discovery -// api dll and HBA driver miniport. -// -// Copyright (c) 2001 Microsoft Corporation -// -//*************************************************************************** - -// -// Definitions for iscsi security flags. These flags provide -// information about the security expectations of a target portal and -// are needed to insure a successful IKE/IPSEC negotiation. Note that -// the flags and values are taken directly from the iSNS spec -// - - // 1 = Tunnel Mode Preferred; 0 = No Preference -#define ISCSI_SECURITY_FLAG_TUNNEL_MODE_PREFERRED 0x00000040 - - // 1 = Transport Mode Preferred; 0 = No Preference -#define ISCSI_SECURITY_FLAG_TRANSPORT_MODE_PREFERRED 0x00000020 - - // 1 = PFS Enabled; 0 = PFS Disabled -#define ISCSI_SECURITY_FLAG_PFS_ENABLED 0x00000010 - - // 1 = Aggressive Mode Enabled; 0 = Disabled -#define ISCSI_SECURITY_FLAG_AGGRESSIVE_MODE_ENABLED 0x00000008 - - // 1 = Main Mode Enabled; 0 = MM Disabled -#define ISCSI_SECURITY_FLAG_MAIN_MODE_ENABLED 0x00000004 - - // 1 = IKE/IPSec Enabled; 0 = IKE/IPSec Disabled -#define ISCSI_SECURITY_FLAG_IKE_IPSEC_ENABLED 0x00000002 - - // If set then all other ISCSI_SECURITY_FLAGS are valid -#define ISCSI_SECURITY_FLAG_VALID 0x00000001 - - -// -// Types of addresses that can be passed by management app to driver -// -typedef enum { - // Text based host name. This needs to be resolved to binary form - ISCSI_IP_ADDRESS_TEXT = 0, - // Binary IPv4 address - ISCSI_IP_ADDRESS_IPV4 = 1, - // Binary IPv6 address - ISCSI_IP_ADDRESS_IPV6 = 2, - // Empty address - ISCSI_IP_ADDRESS_EMPTY = 3 -} ISCSIIPADDRESSTYPE, *PISCSIIPADDRESSTYPE; - -#define ISCSI_IP_AddressGuid \ - { 0x9ac5d4a1,0x1a1a,0x48ec, { 0x8e,0x79,0x73,0x58,0x06,0xe9,0xa1,0xfa } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_IP_Address_GUID, \ - 0x9ac5d4a1,0x1a1a,0x48ec,0x8e,0x79,0x73,0x58,0x06,0xe9,0xa1,0xfa); -#endif - - -typedef struct _ISCSI_IP_Address -{ - // Type of address specified. It can be text: a DNS or dotted address or it can be a binary ipv4 or ipv6 address - ULONG Type; - #define ISCSI_IP_Address_Type_SIZE sizeof(ULONG) - #define ISCSI_IP_Address_Type_ID 1 - - // If IPV4 Address is specified as the Address Format then this conains the binary IPv4 ip address - ULONG IpV4Address; - #define ISCSI_IP_Address_IpV4Address_SIZE sizeof(ULONG) - #define ISCSI_IP_Address_IpV4Address_ID 2 - - // If IPV6 Address is specified as the Address Format then this conains the binary IPv6 ip address - UCHAR IpV6Address[16]; - #define ISCSI_IP_Address_IpV6Address_SIZE sizeof(UCHAR[16]) - #define ISCSI_IP_Address_IpV6Address_ID 3 - - // IPV6 flow information - ULONG IpV6FlowInfo; - #define ISCSI_IP_Address_IpV6FlowInfo_SIZE sizeof(ULONG) - #define ISCSI_IP_Address_IpV6FlowInfo_ID 4 - - // IPV6 scope id - ULONG IpV6ScopeId; - #define ISCSI_IP_Address_IpV6ScopeId_SIZE sizeof(ULONG) - #define ISCSI_IP_Address_IpV6ScopeId_ID 5 - - // Text address, either a DNS address or dotted address - WCHAR TextAddress[256 + 1]; - #define ISCSI_IP_Address_TextAddress_ID 6 - -} ISCSI_IP_Address, *PISCSI_IP_Address; - -// ISCSI_TargetPortal - ISCSI_TargetPortal -// ISCSI target portal -#define ISCSI_TargetPortalGuid \ - { 0xde5051a7,0xbf27,0x48f1, { 0xbd,0x12,0x07,0xca,0xde,0x92,0xae,0xfd } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_TargetPortal_GUID, \ - 0xde5051a7,0xbf27,0x48f1,0xbd,0x12,0x07,0xca,0xde,0x92,0xae,0xfd); -#endif - - -typedef struct _ISCSI_TargetPortal -{ - // Network Address - ISCSI_IP_Address Address; - #define ISCSI_TargetPortal_Address_SIZE sizeof(ISCSI_IP_Address) - #define ISCSI_TargetPortal_Address_ID 1 - - // Reserved - ULONG Reserved; - #define ISCSI_TargetPortal_Reserved_SIZE sizeof(ULONG) - #define ISCSI_TargetPortal_Reserved_ID 2 - - // Socket number - USHORT Socket; - #define ISCSI_TargetPortal_Socket_SIZE sizeof(USHORT) - #define ISCSI_TargetPortal_Socket_ID 3 - -} ISCSI_TargetPortal, *PISCSI_TargetPortal; - -#define ISCSI_TargetPortal_SIZE (FIELD_OFFSET(ISCSI_TargetPortal, Socket) + ISCSI_TargetPortal_Socket_SIZE) - -// ISCSI_TargetPortalGroup - ISCSI_TargetPortalGroup -// iSCSI target portal group -#define ISCSI_TargetPortalGroupGuid \ - { 0x3081f2a5,0x95f5,0x4d2a, { 0x81,0x3d,0xee,0x59,0x86,0x4c,0x6f,0xc5 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_TargetPortalGroup_GUID, \ - 0x3081f2a5,0x95f5,0x4d2a,0x81,0x3d,0xee,0x59,0x86,0x4c,0x6f,0xc5); -#endif - - -typedef struct _ISCSI_TargetPortalGroup -{ - // Number of portals in group - ULONG PortalCount; - #define ISCSI_TargetPortalGroup_PortalCount_SIZE sizeof(ULONG) - #define ISCSI_TargetPortalGroup_PortalCount_ID 1 - - // Target portals in group - ISCSI_TargetPortal Portals[1]; - #define ISCSI_TargetPortalGroup_Portals_ID 2 - -} ISCSI_TargetPortalGroup, *PISCSI_TargetPortalGroup; - -// ISCSI_LoginOptions - ISCSI_LoginOptions -// These are options that can be used for logging into a target - -#ifndef _ISCSI_ISCSIDSC_ -typedef enum -{ - ISCSI_DIGEST_TYPE_NONE = 0, - ISCSI_DIGEST_TYPE_CRC32C = 1 -} ISCSI_DIGEST_TYPES, *PISCSI_DIGEST_TYPES; - -typedef enum -{ - ISCSI_NO_AUTH_TYPE = 0, - ISCSI_CHAP_AUTH_TYPE = 1, - ISCSI_MUTUAL_CHAP_AUTH_TYPE = 2 -} ISCSI_AUTH_TYPES, *PISCSI_AUTH_TYPES; -#endif - -#define ISCSI_LoginOptionsGuid \ - { 0x3011a7bd,0x0491,0x478e, { 0x8c,0x79,0x3c,0x76,0x42,0x4d,0x05,0xe2 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_LoginOptions_GUID, \ - 0x3011a7bd,0x0491,0x478e,0x8c,0x79,0x3c,0x76,0x42,0x4d,0x05,0xe2); -#endif - - -typedef struct _ISCSI_LoginOptions -{ - -// -// Bit flags for InformationSpecifies -// -#define ISCSI_LOGIN_OPTIONS_HEADER_DIGEST 0x00000001 -#define ISCSI_LOGIN_OPTIONS_DATA_DIGEST 0x00000002 -#define ISCSI_LOGIN_OPTIONS_MAXIMUM_CONNECTIONS 0x00000004 -#define ISCSI_LOGIN_OPTIONS_DEFAULT_TIME_2_WAIT 0x00000008 -#define ISCSI_LOGIN_OPTIONS_DEFAULT_TIME_2_RETAIN 0x00000010 -#define ISCSI_LOGIN_OPTIONS_USERNAME 0x00000020 -#define ISCSI_LOGIN_OPTIONS_PASSWORD 0x00000040 -#define ISCSI_LOGIN_OPTIONS_AUTH_TYPE 0x00000080 - - - // Bit flags that specify which login option values are specified - ULONG InformationSpecified; - #define ISCSI_LoginOptions_InformationSpecified_SIZE sizeof(ULONG) - #define ISCSI_LoginOptions_InformationSpecified_ID 1 - - // cyclic integrity checksums that can be negotiated for the header digests - ULONG HeaderDigest; - #define ISCSI_LoginOptions_HeaderDigest_SIZE sizeof(ULONG) - #define ISCSI_LoginOptions_HeaderDigest_ID 2 - - // cyclic integrity checksums that can be negotiated for the header digests - ULONG DataDigest; - #define ISCSI_LoginOptions_DataDigest_SIZE sizeof(ULONG) - #define ISCSI_LoginOptions_DataDigest_ID 3 - - // Maximum number of connections, 0 implies no limit - ULONG MaximumConnections; - #define ISCSI_LoginOptions_MaximumConnections_SIZE sizeof(ULONG) - #define ISCSI_LoginOptions_MaximumConnections_ID 4 - - // The initiator and target negotiate the minimum time, in seconds, to wait before attempting an explicit/implicit logout or active task reassignment after an unexpected connection termination or a connection reset. - ULONG DefaultTime2Wait; - #define ISCSI_LoginOptions_DefaultTime2Wait_SIZE sizeof(ULONG) - #define ISCSI_LoginOptions_DefaultTime2Wait_ID 5 - - // The initiator and target negotiate the maximum time, in seconds after an initial wait (Time2Wait), before which an explicit/implicit connection Logout or active task reassignment is still possible after an unexpected connection termination or a connection reset. - ULONG DefaultTime2Retain; - #define ISCSI_LoginOptions_DefaultTime2Retain_SIZE sizeof(ULONG) - #define ISCSI_LoginOptions_DefaultTime2Retain_ID 6 - - -// -// bit flags for ISCSI_LOGIN_FLAGS -// -#ifndef _ISCSI_ISCSIDSC_ -#define ISCSI_LOGIN_FLAGS ULONG - -#define ISCSI_LOGIN_FLAG_REQUIRE_IPSEC 0x00000001 -#define ISCSI_LOGIN_FLAG_MULTIPATH_ENABLED 0x00000002 -#define ISCSI_LOGIN_FLAG_RESERVED1 0x00000004 -#define ISCSI_LOGIN_FLAG_ALLOW_PORTAL_HOPPING 0x00000008 -#define ISCSI_LOGIN_FLAG_USE_RADIUS_RESPONSE 0x00000010 -#define ISCSI_LOGIN_FLAG_USE_RADIUS_VERIFICATION 0x00000020 - -#endif - - // Flags that affect how login occurs - ULONG LoginFlags; - #define ISCSI_LoginOptions_LoginFlags_SIZE sizeof(ULONG) - #define ISCSI_LoginOptions_LoginFlags_ID 7 - - // Authentication method specified for login - ULONG AuthType; - #define ISCSI_LoginOptions_AuthType_SIZE sizeof(ULONG) - #define ISCSI_LoginOptions_AuthType_ID 8 - -} ISCSI_LoginOptions, *PISCSI_LoginOptions; - -#define ISCSI_LoginOptions_SIZE (FIELD_OFFSET(ISCSI_LoginOptions, AuthType) + ISCSI_LoginOptions_AuthType_SIZE) - -// ISCSI_LUNList - ISCSI_LUNList -// This class describes a mapping from a an OS LUN to target device LUN -#define ISCSI_LUNListGuid \ - { 0x994ff278,0x3512,0x4d9b, { 0xa2,0x41,0x54,0xce,0xf4,0x5f,0x5a,0x25 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_LUNList_GUID, \ - 0x994ff278,0x3512,0x4d9b,0xa2,0x41,0x54,0xce,0xf4,0x5f,0x5a,0x25); -#endif - - -typedef struct _ISCSI_LUNList -{ - // Target LUN - ULONGLONG TargetLUN; - #define ISCSI_LUNList_TargetLUN_SIZE sizeof(ULONGLONG) - #define ISCSI_LUNList_TargetLUN_ID 1 - - // OS Scsi bus number target is mapped to - ULONG OSLUN; - #define ISCSI_LUNList_OSLUN_SIZE sizeof(ULONG) - #define ISCSI_LUNList_OSLUN_ID 2 - - // Reserved - ULONG Reserved; - #define ISCSI_LUNList_Reserved_SIZE sizeof(ULONG) - #define ISCSI_LUNList_Reserved_ID 3 - -} ISCSI_LUNList, *PISCSI_LUNList; - -#define ISCSI_LUNList_SIZE (FIELD_OFFSET(ISCSI_LUNList, Reserved) + ISCSI_LUNList_Reserved_SIZE) - -// ISCSI_TargetMapping - ISCSI_TargetMapping -// This class describes a mapping from a target LUN to a Windows port driver LUN -#define ISCSI_TargetMappingGuid \ - { 0x21a28820,0x3c4c,0x4944, { 0xac,0x4f,0xda,0x7f,0xeb,0xa2,0x11,0x68 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_TargetMapping_GUID, \ - 0x21a28820,0x3c4c,0x4944,0xac,0x4f,0xda,0x7f,0xeb,0xa2,0x11,0x68); -#endif - - -typedef struct _ISCSI_TargetMapping -{ - // OS Scsi bus number target is mapped to. If 0xffffffff then any value can be picked by the miniport. - ULONG OSBus; - #define ISCSI_TargetMapping_OSBus_SIZE sizeof(ULONG) - #define ISCSI_TargetMapping_OSBus_ID 1 - - // OS Scsi Target number target is mapped to. If 0xffffffff then any value can be picked by the miniport. - ULONG OSTarget; - #define ISCSI_TargetMapping_OSTarget_SIZE sizeof(ULONG) - #define ISCSI_TargetMapping_OSTarget_ID 2 - - // Unique Session ID for the target mapping - ULONGLONG UniqueSessionId; - #define ISCSI_TargetMapping_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define ISCSI_TargetMapping_UniqueSessionId_ID 3 - - // Count of LUNs mapped for this target - ULONG LUNCount; - #define ISCSI_TargetMapping_LUNCount_SIZE sizeof(ULONG) - #define ISCSI_TargetMapping_LUNCount_ID 4 - - // Target Name - WCHAR TargetName[223 + 1]; - #define ISCSI_TargetMapping_TargetName_ID 5 - - // TRUE if session created from a persistent login - BOOLEAN FromPersistentLogin; - #define ISCSI_TargetMapping_FromPersistentLogin_SIZE sizeof(BOOLEAN) - #define ISCSI_TargetMapping_FromPersistentLogin_ID 6 - - // Reserved - ULONGLONG Reserved; - #define ISCSI_TargetMapping_Reserved_SIZE sizeof(ULONGLONG) - #define ISCSI_TargetMapping_Reserved_ID 7 - - // List of LUNs mapped for this target - ISCSI_LUNList LUNList[1]; - #define ISCSI_TargetMapping_LUNList_ID 8 - -} ISCSI_TargetMapping, *PISCSI_TargetMapping; - -#endif - diff --git a/pub/ddk/iscsierr.h b/pub/ddk/iscsierr.h deleted file mode 100644 index ddf4b96..0000000 --- a/pub/ddk/iscsierr.h +++ /dev/null @@ -1,1031 +0,0 @@ -/*++ - -Copyright (c) 2001 Microsoft Corporation - -Module Name: - - iscsierr.h - -Abstract: - - Constant definitions for the IScsi discover error codes - -Revision History: - ---*/ - -#ifndef _ISCSIERR_ -#define _ISCSIERR_ - -// -// Status values are 32 bit values layed 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| Facility | Code | -// +---+-+-------------------------+-------------------------------+ -// -// where -// -// Sev - is the severity code -// -// 00 - Success -// 01 - Informational -// 10 - Warning -// 11 - Error -// -// C - is the Customer code flag -// -// Facility - is the facility code -// -// Code - is the facility's status code -// - -// -// Error status code for ISCSI discovery apis. Error codes can be a -// standard Windows error code as defined in Winerror.h or one of the -// iscsi discovery specific error codes defined below. -// -#ifndef MOFCOMP_PASS -typedef ULONG ISDSC_STATUS; -#endif - -// -// 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 the severity codes -// -#define STATUS_SEVERITY_WARNING 0x2 -#define STATUS_SEVERITY_SUCCESS 0x0 -#define STATUS_SEVERITY_INFORMATIONAL 0x1 -#define STATUS_SEVERITY_ERROR 0x3 - - -// -// MessageId: ISDSC_NON_SPECIFIC_ERROR -// -// MessageText: -// -// A non specific error occurred. -// -#define ISDSC_NON_SPECIFIC_ERROR ((ISDSC_STATUS)0xEFFF0001L) - -// -// MessageId: ISDSC_LOGIN_FAILED -// -// MessageText: -// -// Login Failed. -// -#define ISDSC_LOGIN_FAILED ((ISDSC_STATUS)0xEFFF0002L) - -// -// MessageId: ISDSC_CONNECTION_FAILED -// -// MessageText: -// -// Connection Failed. -// -#define ISDSC_CONNECTION_FAILED ((ISDSC_STATUS)0xEFFF0003L) - -// -// MessageId: ISDSC_INITIATOR_NODE_ALREADY_EXISTS -// -// MessageText: -// -// Initiator Node Already Exists. -// -#define ISDSC_INITIATOR_NODE_ALREADY_EXISTS ((ISDSC_STATUS)0xEFFF0004L) - -// -// MessageId: ISDSC_INITIATOR_NODE_NOT_FOUND -// -// MessageText: -// -// Initiator Node Does Not Exist. -// -#define ISDSC_INITIATOR_NODE_NOT_FOUND ((ISDSC_STATUS)0xEFFF0005L) - -// -// MessageId: ISDSC_TARGET_MOVED_TEMPORARILY -// -// MessageText: -// -// Target Moved Temporarily. -// -#define ISDSC_TARGET_MOVED_TEMPORARILY ((ISDSC_STATUS)0xEFFF0006L) - -// -// MessageId: ISDSC_TARGET_MOVED_PERMANENTLY -// -// MessageText: -// -// Target Moved Permanently. -// -#define ISDSC_TARGET_MOVED_PERMANENTLY ((ISDSC_STATUS)0xEFFF0007L) - -// -// MessageId: ISDSC_INITIATOR_ERROR -// -// MessageText: -// -// Initiator Error. -// -#define ISDSC_INITIATOR_ERROR ((ISDSC_STATUS)0xEFFF0008L) - -// -// MessageId: ISDSC_AUTHENTICATION_FAILURE -// -// MessageText: -// -// Authentication Failure. -// -#define ISDSC_AUTHENTICATION_FAILURE ((ISDSC_STATUS)0xEFFF0009L) - -// -// MessageId: ISDSC_AUTHORIZATION_FAILURE -// -// MessageText: -// -// Authorization Failure. -// -#define ISDSC_AUTHORIZATION_FAILURE ((ISDSC_STATUS)0xEFFF000AL) - -// -// MessageId: ISDSC_NOT_FOUND -// -// MessageText: -// -// Not Found. -// -#define ISDSC_NOT_FOUND ((ISDSC_STATUS)0xEFFF000BL) - -// -// MessageId: ISDSC_TARGET_REMOVED -// -// MessageText: -// -// Target Removed. -// -#define ISDSC_TARGET_REMOVED ((ISDSC_STATUS)0xEFFF000CL) - -// -// MessageId: ISDSC_UNSUPPORTED_VERSION -// -// MessageText: -// -// Unsupported Version. -// -#define ISDSC_UNSUPPORTED_VERSION ((ISDSC_STATUS)0xEFFF000DL) - -// -// MessageId: ISDSC_TOO_MANY_CONNECTIONS -// -// MessageText: -// -// Too many Connections. -// -#define ISDSC_TOO_MANY_CONNECTIONS ((ISDSC_STATUS)0xEFFF000EL) - -// -// MessageId: ISDSC_MISSING_PARAMETER -// -// MessageText: -// -// Missing Parameter. -// -#define ISDSC_MISSING_PARAMETER ((ISDSC_STATUS)0xEFFF000FL) - -// -// MessageId: ISDSC_CANT_INCLUDE_IN_SESSION -// -// MessageText: -// -// Can not include in session. -// -#define ISDSC_CANT_INCLUDE_IN_SESSION ((ISDSC_STATUS)0xEFFF0010L) - -// -// MessageId: ISDSC_SESSION_TYPE_NOT_SUPPORTED -// -// MessageText: -// -// Session type not supported. -// -#define ISDSC_SESSION_TYPE_NOT_SUPPORTED ((ISDSC_STATUS)0xEFFF0011L) - -// -// MessageId: ISDSC_TARGET_ERROR -// -// MessageText: -// -// Target Error. -// -#define ISDSC_TARGET_ERROR ((ISDSC_STATUS)0xEFFF0012L) - -// -// MessageId: ISDSC_SERVICE_UNAVAILABLE -// -// MessageText: -// -// Service Unavailable. -// -#define ISDSC_SERVICE_UNAVAILABLE ((ISDSC_STATUS)0xEFFF0013L) - -// -// MessageId: ISDSC_OUT_OF_RESOURCES -// -// MessageText: -// -// Out of Resources. -// -#define ISDSC_OUT_OF_RESOURCES ((ISDSC_STATUS)0xEFFF0014L) - -// -// MessageId: ISDSC_CONNECTION_ALREADY_EXISTS -// -// MessageText: -// -// Connections already exist on initiator node. -// -#define ISDSC_CONNECTION_ALREADY_EXISTS ((ISDSC_STATUS)0xEFFF0015L) - -// -// MessageId: ISDSC_SESSION_ALREADY_EXISTS -// -// MessageText: -// -// Session Already Exists. -// -#define ISDSC_SESSION_ALREADY_EXISTS ((ISDSC_STATUS)0xEFFF0016L) - -// -// MessageId: ISDSC_INITIATOR_INSTANCE_NOT_FOUND -// -// MessageText: -// -// Initiator Instance Does Not Exist. -// -#define ISDSC_INITIATOR_INSTANCE_NOT_FOUND ((ISDSC_STATUS)0xEFFF0017L) - -// -// MessageId: ISDSC_TARGET_ALREADY_EXISTS -// -// MessageText: -// -// Target Already Exists. -// -#define ISDSC_TARGET_ALREADY_EXISTS ((ISDSC_STATUS)0xEFFF0018L) - -// -// MessageId: ISDSC_DRIVER_BUG -// -// MessageText: -// -// The iscsi driver implementation did not complete an operation correctly. -// -#define ISDSC_DRIVER_BUG ((ISDSC_STATUS)0xEFFF0019L) - -// -// MessageId: ISDSC_INVALID_TEXT_KEY -// -// MessageText: -// -// An invalid key text was encountered. -// -#define ISDSC_INVALID_TEXT_KEY ((ISDSC_STATUS)0xEFFF001AL) - -// -// MessageId: ISDSC_INVALID_SENDTARGETS_TEXT -// -// MessageText: -// -// Invalid SendTargets response text was encountered. -// -#define ISDSC_INVALID_SENDTARGETS_TEXT ((ISDSC_STATUS)0xEFFF001BL) - -// -// MessageId: ISDSC_INVALID_SESSION_ID -// -// MessageText: -// -// Invalid Session Id. -// -#define ISDSC_INVALID_SESSION_ID ((ISDSC_STATUS)0xEFFF001CL) - -// -// MessageId: ISDSC_SCSI_REQUEST_FAILED -// -// MessageText: -// -// The scsi request failed. -// -#define ISDSC_SCSI_REQUEST_FAILED ((ISDSC_STATUS)0xEFFF001DL) - -// -// MessageId: ISDSC_TOO_MANY_SESSIONS -// -// MessageText: -// -// Exceeded max sessions for this initiator. -// -#define ISDSC_TOO_MANY_SESSIONS ((ISDSC_STATUS)0xEFFF001EL) - -// -// MessageId: ISDSC_SESSION_BUSY -// -// MessageText: -// -// Session is busy since a request is already in progress. -// -#define ISDSC_SESSION_BUSY ((ISDSC_STATUS)0xEFFF001FL) - -// -// MessageId: ISDSC_TARGET_MAPPING_UNAVAILABLE -// -// MessageText: -// -// The target mapping requested is not available. -// -#define ISDSC_TARGET_MAPPING_UNAVAILABLE ((ISDSC_STATUS)0xEFFF0020L) - -// -// MessageId: ISDSC_ADDRESS_TYPE_NOT_SUPPORTED -// -// MessageText: -// -// The Target Address type given is not supported. -// -#define ISDSC_ADDRESS_TYPE_NOT_SUPPORTED ((ISDSC_STATUS)0xEFFF0021L) - -// -// MessageId: ISDSC_LOGON_FAILED -// -// MessageText: -// -// Logon Failed. -// -#define ISDSC_LOGON_FAILED ((ISDSC_STATUS)0xEFFF0022L) - -// -// MessageId: ISDSC_SEND_FAILED -// -// MessageText: -// -// TCP Send Failed. -// -#define ISDSC_SEND_FAILED ((ISDSC_STATUS)0xEFFF0023L) - -// -// MessageId: ISDSC_TRANSPORT_ERROR -// -// MessageText: -// -// TCP Transport Error -// -#define ISDSC_TRANSPORT_ERROR ((ISDSC_STATUS)0xEFFF0024L) - -// -// MessageId: ISDSC_VERSION_MISMATCH -// -// MessageText: -// -// iSCSI Version Mismatch -// -#define ISDSC_VERSION_MISMATCH ((ISDSC_STATUS)0xEFFF0025L) - -// -// MessageId: ISDSC_TARGET_MAPPING_OUT_OF_RANGE -// -// MessageText: -// -// The Target Mapping Address passed is out of range for the adapter configuration. -// -#define ISDSC_TARGET_MAPPING_OUT_OF_RANGE ((ISDSC_STATUS)0xEFFF0026L) - -// -// MessageId: ISDSC_TARGET_PRESHAREDKEY_UNAVAILABLE -// -// MessageText: -// -// The preshared key for the target or IKE identification payload is not available. -// -#define ISDSC_TARGET_PRESHAREDKEY_UNAVAILABLE ((ISDSC_STATUS)0xEFFF0027L) - -// -// MessageId: ISDSC_TARGET_AUTHINFO_UNAVAILABLE -// -// MessageText: -// -// The authentication information for the target is not available. -// -#define ISDSC_TARGET_AUTHINFO_UNAVAILABLE ((ISDSC_STATUS)0xEFFF0028L) - -// -// MessageId: ISDSC_TARGET_NOT_FOUND -// -// MessageText: -// -// The target name is not found or is marked as hidden from login. -// -#define ISDSC_TARGET_NOT_FOUND ((ISDSC_STATUS)0xEFFF0029L) - -// -// MessageId: ISDSC_LOGIN_USER_INFO_BAD -// -// MessageText: -// -// One or more parameters specified in LoginTargetIN structure is invalid. -// -#define ISDSC_LOGIN_USER_INFO_BAD ((ISDSC_STATUS)0xEFFF002AL) - -// -// MessageId: ISDSC_TARGET_MAPPING_EXISTS -// -// MessageText: -// -// Given target mapping already exists. -// -#define ISDSC_TARGET_MAPPING_EXISTS ((ISDSC_STATUS)0xEFFF002BL) - -// -// MessageId: ISDSC_HBA_SECURITY_CACHE_FULL -// -// MessageText: -// -// The HBA security information cache is full. -// -#define ISDSC_HBA_SECURITY_CACHE_FULL ((ISDSC_STATUS)0xEFFF002CL) - -// -// MessageId: ISDSC_INVALID_PORT_NUMBER -// -// MessageText: -// -// The port number passed is not valid for the initiator. -// -#define ISDSC_INVALID_PORT_NUMBER ((ISDSC_STATUS)0xEFFF002DL) - -// -// MessageId: ISDSC_OPERATION_NOT_ALL_SUCCESS -// -// MessageText: -// -// The operation was not successful for all initiators or discovery methods. -// -#define ISDSC_OPERATION_NOT_ALL_SUCCESS ((ISDSC_STATUS)0xAFFF002EL) - -// -// MessageId: ISDSC_HBA_SECURITY_CACHE_NOT_SUPPORTED -// -// MessageText: -// -// The HBA security information cache is not supported by this adapter. -// -#define ISDSC_HBA_SECURITY_CACHE_NOT_SUPPORTED ((ISDSC_STATUS)0xEFFF002FL) - -// -// MessageId: ISDSC_IKE_ID_PAYLOAD_TYPE_NOT_SUPPORTED -// -// MessageText: -// -// The IKE id payload type specified is not supported. -// -#define ISDSC_IKE_ID_PAYLOAD_TYPE_NOT_SUPPORTED ((ISDSC_STATUS)0xEFFF0030L) - -// -// MessageId: ISDSC_IKE_ID_PAYLOAD_INCORRECT_SIZE -// -// MessageText: -// -// The IKE id payload size specified is not correct. -// -#define ISDSC_IKE_ID_PAYLOAD_INCORRECT_SIZE ((ISDSC_STATUS)0xEFFF0031L) - -// -// MessageId: ISDSC_TARGET_PORTAL_ALREADY_EXISTS -// -// MessageText: -// -// Target Portal Structure Already Exists. -// -#define ISDSC_TARGET_PORTAL_ALREADY_EXISTS ((ISDSC_STATUS)0xEFFF0032L) - -// -// MessageId: ISDSC_TARGET_ADDRESS_ALREADY_EXISTS -// -// MessageText: -// -// Target Address Structure Already Exists. -// -#define ISDSC_TARGET_ADDRESS_ALREADY_EXISTS ((ISDSC_STATUS)0xEFFF0033L) - -// -// MessageId: ISDSC_NO_AUTH_INFO_AVAILABLE -// -// MessageText: -// -// There is no IKE authentication information available. -// -#define ISDSC_NO_AUTH_INFO_AVAILABLE ((ISDSC_STATUS)0xEFFF0034L) - -// -// MessageId: ISDSC_NO_TUNNEL_OUTER_MODE_ADDRESS -// -// MessageText: -// -// There is no tunnel mode outer address specified. -// -#define ISDSC_NO_TUNNEL_OUTER_MODE_ADDRESS ((ISDSC_STATUS)0xEFFF0035L) - -// -// MessageId: ISDSC_CACHE_CORRUPTED -// -// MessageText: -// -// Authentication or tunnel address cache is corrupted. -// -#define ISDSC_CACHE_CORRUPTED ((ISDSC_STATUS)0xEFFF0036L) - -// -// MessageId: ISDSC_REQUEST_NOT_SUPPORTED -// -// MessageText: -// -// The request or operation is not supported. -// -#define ISDSC_REQUEST_NOT_SUPPORTED ((ISDSC_STATUS)0xEFFF0037L) - -// -// MessageId: ISDSC_TARGET_OUT_OF_RESORCES -// -// MessageText: -// -// The target does not have enough resources to process the given request. -// -#define ISDSC_TARGET_OUT_OF_RESORCES ((ISDSC_STATUS)0xEFFF0038L) - -// -// MessageId: ISDSC_SERVICE_DID_NOT_RESPOND -// -// MessageText: -// -// The initiator service did not respond to the request sent by the driver. -// -#define ISDSC_SERVICE_DID_NOT_RESPOND ((ISDSC_STATUS)0xEFFF0039L) - -// -// MessageId: ISDSC_ISNS_SERVER_NOT_FOUND -// -// MessageText: -// -// The Internet Storage Name Server (iSNS) server was not found or is unavailable. -// -#define ISDSC_ISNS_SERVER_NOT_FOUND ((ISDSC_STATUS)0xEFFF003AL) - -// -// MessageId: ISDSC_OPERATION_REQUIRES_REBOOT -// -// MessageText: -// -// The operation was successful but requires a driver reload or reboot to become effective. -// -#define ISDSC_OPERATION_REQUIRES_REBOOT ((ISDSC_STATUS)0xAFFF003BL) - -// -// MessageId: ISDSC_NO_PORTAL_SPECIFIED -// -// MessageText: -// -// There is no target portal available to complete the login. -// -#define ISDSC_NO_PORTAL_SPECIFIED ((ISDSC_STATUS)0xEFFF003CL) - -// -// MessageId: ISDSC_CANT_REMOVE_LAST_CONNECTION -// -// MessageText: -// -// Cannot remove the last connection for a session. -// -#define ISDSC_CANT_REMOVE_LAST_CONNECTION ((ISDSC_STATUS)0xEFFF003DL) - -// -// MessageId: ISDSC_SERVICE_NOT_RUNNING -// -// MessageText: -// -// The Microsoft iSCSI initiator service has not been started. -// -#define ISDSC_SERVICE_NOT_RUNNING ((ISDSC_STATUS)0xEFFF003EL) - -// -// MessageId: ISDSC_TARGET_ALREADY_LOGGED_IN -// -// MessageText: -// -// The target has already been logged in via an iSCSI session. -// -#define ISDSC_TARGET_ALREADY_LOGGED_IN ((ISDSC_STATUS)0xEFFF003FL) - -// -// MessageId: ISDSC_DEVICE_BUSY_ON_SESSION -// -// MessageText: -// -// The session cannot be logged out since a device on that session is currently being used. -// -#define ISDSC_DEVICE_BUSY_ON_SESSION ((ISDSC_STATUS)0xEFFF0040L) - -// -// MessageId: ISDSC_COULD_NOT_SAVE_PERSISTENT_LOGIN_DATA -// -// MessageText: -// -// Failed to save persistent login information. -// -#define ISDSC_COULD_NOT_SAVE_PERSISTENT_LOGIN_DATA ((ISDSC_STATUS)0xEFFF0041L) - -// -// MessageId: ISDSC_COULD_NOT_REMOVE_PERSISTENT_LOGIN_DATA -// -// MessageText: -// -// Failed to remove persistent login information. -// -#define ISDSC_COULD_NOT_REMOVE_PERSISTENT_LOGIN_DATA ((ISDSC_STATUS)0xEFFF0042L) - -// -// MessageId: ISDSC_PORTAL_NOT_FOUND -// -// MessageText: -// -// The specified portal was not found. -// -#define ISDSC_PORTAL_NOT_FOUND ((ISDSC_STATUS)0xEFFF0043L) - -// -// MessageId: ISDSC_INITIATOR_NOT_FOUND -// -// MessageText: -// -// The specified initiator name was not found. -// -#define ISDSC_INITIATOR_NOT_FOUND ((ISDSC_STATUS)0xEFFF0044L) - -// -// MessageId: ISDSC_DISCOVERY_MECHANISM_NOT_FOUND -// -// MessageText: -// -// The specified discovery mechanism was not found. -// -#define ISDSC_DISCOVERY_MECHANISM_NOT_FOUND ((ISDSC_STATUS)0xEFFF0045L) - -// -// MessageId: ISDSC_IPSEC_NOT_SUPPORTED_ON_OS -// -// MessageText: -// -// iSCSI does not support IPSEC for this version of the OS. -// -#define ISDSC_IPSEC_NOT_SUPPORTED_ON_OS ((ISDSC_STATUS)0xEFFF0046L) - -// -// MessageId: ISDSC_PERSISTENT_LOGIN_TIMEOUT -// -// MessageText: -// -// The iSCSI service timed out waiting for all persistent logins to complete. -// -#define ISDSC_PERSISTENT_LOGIN_TIMEOUT ((ISDSC_STATUS)0xEFFF0047L) - -// -// MessageId: ISDSC_SHORT_CHAP_SECRET -// -// MessageText: -// -// The specified CHAP secret is less than 96 bits and will not be usable for authenticating over non ipsec connections. -// -#define ISDSC_SHORT_CHAP_SECRET ((ISDSC_STATUS)0xAFFF0048L) - -// -// MessageId: ISDSC_EVALUATION_PEROID_EXPIRED -// -// MessageText: -// -// The evaluation period for the iSCSI initiator service has expired. -// -#define ISDSC_EVALUATION_PEROID_EXPIRED ((ISDSC_STATUS)0xEFFF0049L) - -// -// MessageId: ISDSC_INVALID_CHAP_SECRET -// -// MessageText: -// -// CHAP secret given does not conform to the standard. Please see system event log for more information. -// -#define ISDSC_INVALID_CHAP_SECRET ((ISDSC_STATUS)0xEFFF004AL) - -// -// MessageId: ISDSC_INVALID_TARGET_CHAP_SECRET -// -// MessageText: -// -// Target CHAP secret given is invalid. Maximum size of CHAP secret is 16 bytes. Minimum size is 12 bytes if IPSec is not used. -// -#define ISDSC_INVALID_TARGET_CHAP_SECRET ((ISDSC_STATUS)0xEFFF004BL) - -// -// MessageId: ISDSC_INVALID_INITIATOR_CHAP_SECRET -// -// MessageText: -// -// Initiator CHAP secret given is invalid. Maximum size of CHAP secret is 16 bytes. Minimum size is 12 bytes if IPSec is not used. -// -#define ISDSC_INVALID_INITIATOR_CHAP_SECRET ((ISDSC_STATUS)0xEFFF004CL) - -// -// MessageId: ISDSC_INVALID_CHAP_USER_NAME -// -// MessageText: -// -// CHAP Username given is invalid. -// -#define ISDSC_INVALID_CHAP_USER_NAME ((ISDSC_STATUS)0xEFFF004DL) - -// -// MessageId: ISDSC_INVALID_LOGON_AUTH_TYPE -// -// MessageText: -// -// Logon Authentication type given is invalid. -// -#define ISDSC_INVALID_LOGON_AUTH_TYPE ((ISDSC_STATUS)0xEFFF004EL) - -// -// MessageId: ISDSC_INVALID_TARGET_MAPPING -// -// MessageText: -// -// Target Mapping information given is invalid. -// -#define ISDSC_INVALID_TARGET_MAPPING ((ISDSC_STATUS)0xEFFF004FL) - -// -// MessageId: ISDSC_INVALID_TARGET_ID -// -// MessageText: -// -// Target Id given in Target Mapping is invalid. -// -#define ISDSC_INVALID_TARGET_ID ((ISDSC_STATUS)0xEFFF0050L) - -// -// MessageId: ISDSC_INVALID_ISCSI_NAME -// -// MessageText: -// -// The iSCSI name specified contains invalid characters or is too long. -// -#define ISDSC_INVALID_ISCSI_NAME ((ISDSC_STATUS)0xEFFF0051L) - -// -// MessageId: ISDSC_INCOMPATIBLE_ISNS_VERSION -// -// MessageText: -// -// The version number returned from the Internet Storage Name Server (iSNS) server is not compatible with this version of the iSNS client. -// -#define ISDSC_INCOMPATIBLE_ISNS_VERSION ((ISDSC_STATUS)0xEFFF0052L) - -// -// MessageId: ISDSC_FAILED_TO_CONFIGURE_IPSEC -// -// MessageText: -// -// Initiator failed to configure IPSec for the given connection. This could be because of low resources. -// -#define ISDSC_FAILED_TO_CONFIGURE_IPSEC ((ISDSC_STATUS)0xEFFF0053L) - -// -// MessageId: ISDSC_BUFFER_TOO_SMALL -// -// MessageText: -// -// The buffer given for processing the request is too small. -// -#define ISDSC_BUFFER_TOO_SMALL ((ISDSC_STATUS)0xEFFF0054L) - -// -// MessageId: ISDSC_INVALID_LOAD_BALANCE_POLICY -// -// MessageText: -// -// The given Load Balance policy is not recognized by iScsi initiator. -// -#define ISDSC_INVALID_LOAD_BALANCE_POLICY ((ISDSC_STATUS)0xEFFF0055L) - -// -// MessageId: ISDSC_INVALID_PARAMETER -// -// MessageText: -// -// One or more paramaters specified is not valid. -// -#define ISDSC_INVALID_PARAMETER ((ISDSC_STATUS)0xEFFF0056L) - -// -// MessageId: ISDSC_DUPLICATE_PATH_SPECIFIED -// -// MessageText: -// -// Duplicate PathIds were specified in the call to set Load Balance Policy. -// -#define ISDSC_DUPLICATE_PATH_SPECIFIED ((ISDSC_STATUS)0xEFFF0057L) - -// -// MessageId: ISDSC_PATH_COUNT_MISMATCH -// -// MessageText: -// -// Number of paths specified in Set Load Balance Policy does not match the number of paths to the target. -// -#define ISDSC_PATH_COUNT_MISMATCH ((ISDSC_STATUS)0xEFFF0058L) - -// -// MessageId: ISDSC_INVALID_PATH_ID -// -// MessageText: -// -// Path Id specified in the call to set Load Balance Policy is not valid -// -#define ISDSC_INVALID_PATH_ID ((ISDSC_STATUS)0xEFFF0059L) - -// -// MessageId: ISDSC_MULTIPLE_PRIMARY_PATHS_SPECIFIED -// -// MessageText: -// -// Multiple primary paths specified when only one primary path is expected. -// -#define ISDSC_MULTIPLE_PRIMARY_PATHS_SPECIFIED ((ISDSC_STATUS)0xEFFF005AL) - -// -// MessageId: ISDSC_NO_PRIMARY_PATH_SPECIFIED -// -// MessageText: -// -// No primary path specified when at least one is expected. -// -#define ISDSC_NO_PRIMARY_PATH_SPECIFIED ((ISDSC_STATUS)0xEFFF005BL) - -// -// MessageId: ISDSC_DEVICE_ALREADY_PERSISTENTLY_BOUND -// -// MessageText: -// -// Device is already a persistently bound device. -// -#define ISDSC_DEVICE_ALREADY_PERSISTENTLY_BOUND ((ISDSC_STATUS)0xEFFF005CL) - -// -// MessageId: ISDSC_DEVICE_NOT_FOUND -// -// MessageText: -// -// Device was not found. -// -#define ISDSC_DEVICE_NOT_FOUND ((ISDSC_STATUS)0xEFFF005DL) - -// -// MessageId: ISDSC_DEVICE_NOT_ISCSI_OR_PERSISTENT -// -// MessageText: -// -// The device specified does not originate from an iSCSI disk or a persistent iSCSI login. -// -#define ISDSC_DEVICE_NOT_ISCSI_OR_PERSISTENT ((ISDSC_STATUS)0xEFFF005EL) - -// -// MessageId: ISDSC_DNS_NAME_UNRESOLVED -// -// MessageText: -// -// The DNS name specified was not resolved. -// -#define ISDSC_DNS_NAME_UNRESOLVED ((ISDSC_STATUS)0xEFFF005FL) - -// -// MessageId: ISDSC_NO_CONNECTION_AVAILABLE -// -// MessageText: -// -// There is no connection available in the iSCSI session to process the request. -// -#define ISDSC_NO_CONNECTION_AVAILABLE ((ISDSC_STATUS)0xEFFF0060L) - -// -// MessageId: ISDSC_LB_POLICY_NOT_SUPPORTED -// -// MessageText: -// -// The given Load Balance policy is not supported. -// -#define ISDSC_LB_POLICY_NOT_SUPPORTED ((ISDSC_STATUS)0xEFFF0061L) - -// -// MessageId: ISDSC_REMOVE_CONNECTION_IN_PROGRESS -// -// MessageText: -// -// A remove connection request is already in progress for this session. -// -#define ISDSC_REMOVE_CONNECTION_IN_PROGRESS ((ISDSC_STATUS)0xEFFF0062L) - -// -// MessageId: ISDSC_INVALID_CONNECTION_ID -// -// MessageText: -// -// Given connection was not found in the session. -// -#define ISDSC_INVALID_CONNECTION_ID ((ISDSC_STATUS)0xEFFF0063L) - -// -// MessageId: ISDSC_CANNOT_REMOVE_LEADING_CONNECTION -// -// MessageText: -// -// The leading connection in the session cannot be removed. -// -#define ISDSC_CANNOT_REMOVE_LEADING_CONNECTION ((ISDSC_STATUS)0xEFFF0064L) - -// -// MessageId: ISDSC_RESTRICTED_BY_GROUP_POLICY -// -// MessageText: -// -// The operation cannot be performed since it does not conform with the group policy assigned to this computer. -// -#define ISDSC_RESTRICTED_BY_GROUP_POLICY ((ISDSC_STATUS)0xEFFF0065L) - -// -// MessageId: ISDSC_ISNS_FIREWALL_BLOCKED -// -// MessageText: -// -// The operation cannot be performed since the Internet Storage Name Server (iSNS) firewall exception has not been enabled. -// -#define ISDSC_ISNS_FIREWALL_BLOCKED ((ISDSC_STATUS)0xEFFF0066L) - -// -// MessageId: ISDSC_FAILURE_TO_PERSIST_LB_POLICY -// -// MessageText: -// -// Failed to persist load balancing policy parameters. -// -#define ISDSC_FAILURE_TO_PERSIST_LB_POLICY ((ISDSC_STATUS)0xEFFF0067L) - -// -// MessageId: ISDSC_INVALID_HOST -// -// MessageText: -// -// The name could not be resolved to an IP Address. -// -#define ISDSC_INVALID_HOST ((ISDSC_STATUS)0xEFFF0068L) - -#endif /* _ISCSIERR_ */ - diff --git a/pub/ddk/iscsifnd.h b/pub/ddk/iscsifnd.h deleted file mode 100644 index 4e73340..0000000 --- a/pub/ddk/iscsifnd.h +++ /dev/null @@ -1,274 +0,0 @@ -#ifndef _iscsifnd_h_ -#define _iscsifnd_h_ - -// ISCSI_DiscoveredTargetPortal - ISCSI_DiscoveredTargetPortal -// iSCSI target portal - - -//*************************************************************************** -// -// iscsifnd.h -// -// Module: iScsi Discovery api -// -// Purpose: Header defining interface between user mode discovery -// engine and HBA driver miniport. -// -// Copyright (c) 2001 Microsoft Corporation -// -//*************************************************************************** - -#include - - -#define ISCSI_DiscoveredTargetPortalGuid \ - { 0xfa218c5d,0xb306,0x4d5d, { 0xb2,0xdb,0x6b,0xba,0x05,0x0f,0xd8,0xfa } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_DiscoveredTargetPortal_GUID, \ - 0xfa218c5d,0xb306,0x4d5d,0xb2,0xdb,0x6b,0xba,0x05,0x0f,0xd8,0xfa); -#endif - - -typedef struct _ISCSI_DiscoveredTargetPortal -{ - // Socket number - USHORT Socket; - #define ISCSI_DiscoveredTargetPortal_Socket_SIZE sizeof(USHORT) - #define ISCSI_DiscoveredTargetPortal_Socket_ID 1 - - // Network Address - ISCSI_IP_Address Address; - #define ISCSI_DiscoveredTargetPortal_Address_SIZE sizeof(ISCSI_IP_Address) - #define ISCSI_DiscoveredTargetPortal_Address_ID 2 - - // Portal Symbolic Name - WCHAR SymbolicName[256 + 1]; - #define ISCSI_DiscoveredTargetPortal_SymbolicName_ID 3 - -} ISCSI_DiscoveredTargetPortal, *PISCSI_DiscoveredTargetPortal; - -// ISCSI_DiscoveredTargetPortalGroup - ISCSI_DiscoveredTargetPortalGroup -// iSCSI target portal group -#define ISCSI_DiscoveredTargetPortalGroupGuid \ - { 0x28c3af2c,0xa453,0x4a3d, { 0x8e,0x10,0x9e,0x09,0xd8,0x9e,0xf3,0x33 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_DiscoveredTargetPortalGroup_GUID, \ - 0x28c3af2c,0xa453,0x4a3d,0x8e,0x10,0x9e,0x09,0xd8,0x9e,0xf3,0x33); -#endif - - -typedef struct _ISCSI_DiscoveredTargetPortalGroup -{ - // Number of portals in group - ULONG PortalCount; - #define ISCSI_DiscoveredTargetPortalGroup_PortalCount_SIZE sizeof(ULONG) - #define ISCSI_DiscoveredTargetPortalGroup_PortalCount_ID 1 - - // Target portals in group. NOTE: this field is a variable length array. - ISCSI_DiscoveredTargetPortal Portals[1]; - #define ISCSI_DiscoveredTargetPortalGroup_Portals_ID 2 - -} ISCSI_DiscoveredTargetPortalGroup, *PISCSI_DiscoveredTargetPortalGroup; - -// ISCSI_DiscoveredTarget - ISCSI_DiscoveredTarget -// ISCSI discovered target information -#define ISCSI_DiscoveredTargetGuid \ - { 0x08cdf465,0xe18d,0x42fe, { 0x8e,0xb2,0x56,0x8c,0xa9,0x6a,0x98,0x56 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_DiscoveredTarget_GUID, \ - 0x08cdf465,0xe18d,0x42fe,0x8e,0xb2,0x56,0x8c,0xa9,0x6a,0x98,0x56); -#endif - - -typedef struct _ISCSI_DiscoveredTarget -{ - // Number of portal groups for target - ULONG TargetPortalGroupCount; - #define ISCSI_DiscoveredTarget_TargetPortalGroupCount_SIZE sizeof(ULONG) - #define ISCSI_DiscoveredTarget_TargetPortalGroupCount_ID 1 - - // Target Name - WCHAR TargetName[223 + 1]; - #define ISCSI_DiscoveredTarget_TargetName_ID 2 - - // Target Alias - WCHAR TargetAlias[255 + 1]; - #define ISCSI_DiscoveredTarget_TargetAlias_ID 3 - - // Portal Groups available for connection to target. NOTE: this field is a variable length array - ISCSI_DiscoveredTargetPortalGroup TargetDiscoveredPortalGroups[1]; - #define ISCSI_DiscoveredTarget_TargetDiscoveredPortalGroups_ID 4 - -} ISCSI_DiscoveredTarget, *PISCSI_DiscoveredTarget; - -// ISCSI_DiscoveredTargetPortal2 - ISCSI_DiscoveredTargetPortal2 -// iSCSI target portal -#define ISCSI_DiscoveredTargetPortal2Guid \ - { 0xe95162a2,0x8ee5,0x40f1, { 0xb0,0x5d,0xa5,0x32,0x1a,0x30,0xd0,0x3d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_DiscoveredTargetPortal2_GUID, \ - 0xe95162a2,0x8ee5,0x40f1,0xb0,0x5d,0xa5,0x32,0x1a,0x30,0xd0,0x3d); -#endif - - -typedef struct _ISCSI_DiscoveredTargetPortal2 -{ - // Socket number - USHORT Socket; - #define ISCSI_DiscoveredTargetPortal2_Socket_SIZE sizeof(USHORT) - #define ISCSI_DiscoveredTargetPortal2_Socket_ID 1 - - // Network Address - ISCSI_IP_Address Address; - #define ISCSI_DiscoveredTargetPortal2_Address_SIZE sizeof(ISCSI_IP_Address) - #define ISCSI_DiscoveredTargetPortal2_Address_ID 2 - - // Security capabilities bitmap as specified in iSNS spec - ULONG SecurityBitmap; - #define ISCSI_DiscoveredTargetPortal2_SecurityBitmap_SIZE sizeof(ULONG) - #define ISCSI_DiscoveredTargetPortal2_SecurityBitmap_ID 3 - - // Number of bytes contained in key associated with portal address - ULONG KeySize; - #define ISCSI_DiscoveredTargetPortal2_KeySize_SIZE sizeof(ULONG) - #define ISCSI_DiscoveredTargetPortal2_KeySize_ID 4 - - // Key associated with portal address. NOTE: This field is a variable length array, the field that follows this field starts immediately after the end of this field subject to appropriate padding. All fields after this are commented out in the header. - UCHAR Key[1]; - #define ISCSI_DiscoveredTargetPortal2_Key_ID 5 - - // Portal Symbolic Name -// WCHAR SymbolicName[256 + 1]; - #define ISCSI_DiscoveredTargetPortal2_SymbolicName_ID 6 - -} ISCSI_DiscoveredTargetPortal2, *PISCSI_DiscoveredTargetPortal2; - -// ISCSI_DiscoveredTargetPortalGroup2 - ISCSI_DiscoveredTargetPortalGroup2 -// iSCSI target portal group -#define ISCSI_DiscoveredTargetPortalGroup2Guid \ - { 0x1732b30d,0xee08,0x4de7, { 0xbe,0xd1,0xde,0x16,0x5f,0x1d,0x7b,0x45 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_DiscoveredTargetPortalGroup2_GUID, \ - 0x1732b30d,0xee08,0x4de7,0xbe,0xd1,0xde,0x16,0x5f,0x1d,0x7b,0x45); -#endif - - -typedef struct _ISCSI_DiscoveredTargetPortalGroup2 -{ - // Number of portals in group - ULONG PortalCount; - #define ISCSI_DiscoveredTargetPortalGroup2_PortalCount_SIZE sizeof(ULONG) - #define ISCSI_DiscoveredTargetPortalGroup2_PortalCount_ID 1 - - // portal group tag - USHORT Tag; - #define ISCSI_DiscoveredTargetPortalGroup2_Tag_SIZE sizeof(USHORT) - #define ISCSI_DiscoveredTargetPortalGroup2_Tag_ID 2 - - // Target portals in group. NOTE: This field is a variable length array. - ISCSI_DiscoveredTargetPortal2 Portals[1]; - #define ISCSI_DiscoveredTargetPortalGroup2_Portals_ID 3 - -} ISCSI_DiscoveredTargetPortalGroup2, *PISCSI_DiscoveredTargetPortalGroup2; - -// ISCSI_DiscoveredTarget2 - ISCSI_DiscoveredTarget2 -// ISCSI discovered target information -#define ISCSI_DiscoveredTarget2Guid \ - { 0xa71bcde9,0x5433,0x4b36, { 0xb9,0xc1,0x07,0x86,0x8e,0x18,0xb4,0x8a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_DiscoveredTarget2_GUID, \ - 0xa71bcde9,0x5433,0x4b36,0xb9,0xc1,0x07,0x86,0x8e,0x18,0xb4,0x8a); -#endif - - -typedef struct _ISCSI_DiscoveredTarget2 -{ - // Number of portal groups for target - ULONG TargetPortalGroupCount; - #define ISCSI_DiscoveredTarget2_TargetPortalGroupCount_SIZE sizeof(ULONG) - #define ISCSI_DiscoveredTarget2_TargetPortalGroupCount_ID 1 - - // Target Name - WCHAR TargetName[223 + 1]; - #define ISCSI_DiscoveredTarget2_TargetName_ID 2 - - // Target Alias - WCHAR TargetAlias[255 + 1]; - #define ISCSI_DiscoveredTarget2_TargetAlias_ID 3 - - // Portal Groups available for connection to target. NOTE: This field is a variable length array. - ISCSI_DiscoveredTargetPortalGroup2 TargetDiscoveredPortalGroups[1]; - #define ISCSI_DiscoveredTarget2_TargetDiscoveredPortalGroups_ID 4 - -} ISCSI_DiscoveredTarget2, *PISCSI_DiscoveredTarget2; - -// MSiSCSI_DiscoveryOperations - MSiSCSI_DiscoveryOperations -// Discovery operations - -// -// This class is required -// -// This class exposes the configuration capabilities if the adapter is able to -// perform target discovery. An adapter would need to support target discovery -// if it is ever placed on a separate network from the PC NIC. -// -// This classes uses PDO instance names with a single instance -// - -#define MSiSCSI_DiscoveryOperationsGuid \ - { 0x556bc0b0,0x0fb5,0x40f2, { 0x92,0x55,0xb7,0xd9,0xa6,0x69,0xda,0xec } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_DiscoveryOperations_GUID, \ - 0x556bc0b0,0x0fb5,0x40f2,0x92,0x55,0xb7,0xd9,0xa6,0x69,0xda,0xec); -#endif - -// -// Method id definitions for MSiSCSI_DiscoveryOperations -#define ReportDiscoveredTargets 10 -typedef struct _ReportDiscoveredTargets_OUT -{ - // Status code resulting from operation - ULONG Status; - #define ReportDiscoveredTargets_OUT_Status_SIZE sizeof(ULONG) - #define ReportDiscoveredTargets_OUT_Status_ID 1 - - // Number of targets discovered - ULONG TargetCount; - #define ReportDiscoveredTargets_OUT_TargetCount_SIZE sizeof(ULONG) - #define ReportDiscoveredTargets_OUT_TargetCount_ID 2 - - // Targets that have been discovered. NOTE: This field is a variabale length array. - ISCSI_DiscoveredTarget Targets[1]; - #define ReportDiscoveredTargets_OUT_Targets_ID 3 - -} ReportDiscoveredTargets_OUT, *PReportDiscoveredTargets_OUT; - -#define ReportDiscoveredTargets2 11 -typedef struct _ReportDiscoveredTargets2_OUT -{ - // Status code resulting from operation - ULONG Status; - #define ReportDiscoveredTargets2_OUT_Status_SIZE sizeof(ULONG) - #define ReportDiscoveredTargets2_OUT_Status_ID 1 - - // Number of targets discovered - ULONG TargetCount; - #define ReportDiscoveredTargets2_OUT_TargetCount_SIZE sizeof(ULONG) - #define ReportDiscoveredTargets2_OUT_TargetCount_ID 2 - - // Targets that have been discovered. NOTE: This field is a variabale length array. - ISCSI_DiscoveredTarget2 Targets[1]; - #define ReportDiscoveredTargets2_OUT_Targets_ID 3 - -} ReportDiscoveredTargets2_OUT, *PReportDiscoveredTargets2_OUT; - - -#endif - diff --git a/pub/ddk/iscsilog.h b/pub/ddk/iscsilog.h deleted file mode 100644 index 5e3a6f7..0000000 --- a/pub/ddk/iscsilog.h +++ /dev/null @@ -1,737 +0,0 @@ -/*++ - -Copyright (c) 1991 Microsoft Corporation - -Module Name: - - iscsilog.h - -Abstract: - - Constant definitions for the iSCSI error code log values. - ---*/ - -#ifndef _ISCSILOG_ -#define _ISCSILOG_ - -// -// Status values are 32 bit values layed 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| Facility | Code | -// +---+-+-------------------------+-------------------------------+ -// -// where -// -// Sev - is the severity code -// -// 00 - Success -// 01 - Informational -// 10 - Warning -// 11 - Error -// -// C - is the Customer code flag -// -// Facility - is the facility code -// -// Code - is the facility's status code -// - -// -// 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 the severity codes -// -#define STATUS_SEVERITY_WARNING 0x2 -#define STATUS_SEVERITY_SUCCESS 0x0 -#define STATUS_SEVERITY_INFORMATIONAL 0x1 -#define STATUS_SEVERITY_ERROR 0x3 - - -// -// MessageId: ISCSI_ERR_TDI_CONNECT_FAILED -// -// MessageText: -// -// Initiator failed to connect to the target. Target IP address and TCP Port number are given in dump data. -// -#define ISCSI_ERR_TDI_CONNECT_FAILED ((NTSTATUS)0xC0000001L) - -// -// MessageId: ISCSI_ERR_INSUFFICIENT_SESSION_RESOURCES -// -// MessageText: -// -// The initiator could not allocate resources for an iSCSI session. -// -#define ISCSI_ERR_INSUFFICIENT_SESSION_RESOURCES ((NTSTATUS)0xC0000002L) - -// -// MessageId: ISCSI_ERR_INVALID_COMMAND_SEQUENCE_NUMBER -// -// MessageText: -// -// Maximum command sequence number is not serially greater than expected command sequence number in login response. -// Dump data contains Expected Command Sequence number followed by Maximum Command Sequence number. -// -#define ISCSI_ERR_INVALID_COMMAND_SEQUENCE_NUMBER ((NTSTATUS)0xC0000003L) - -// -// MessageId: ISCSI_ERR_INVALID_BURST_LENGTH -// -// MessageText: -// -// MaxBurstLength is not serially greater than FirstBurstLength. -// Dump data contains FirstBurstLength followed by MaxBurstLength. -// -#define ISCSI_ERR_INVALID_BURST_LENGTH ((NTSTATUS)0xC0000004L) - -// -// MessageId: ISCSI_ERR_SETUP_NETWORK_NODE -// -// MessageText: -// -// Failed to setup initiator portal. Error status is given in the dump data. -// -#define ISCSI_ERR_SETUP_NETWORK_NODE ((NTSTATUS)0xC0000005L) - -// -// MessageId: ISCSI_ERR_INSUFFICIENT_CONNECTION_RESOURCES -// -// MessageText: -// -// The initiator could not allocate resources for an iSCSI connection -// -#define ISCSI_ERR_INSUFFICIENT_CONNECTION_RESOURCES ((NTSTATUS)0xC0000006L) - -// -// MessageId: ISCSI_ERR_SEND_FAILED -// -// MessageText: -// -// The initiator could not send an iSCSI PDU. Error status is given in the dump data. -// -#define ISCSI_ERR_SEND_FAILED ((NTSTATUS)0xC0000007L) - -// -// MessageId: ISCSI_ERR_ISCSI_REQUEST_TIMEOUT -// -// MessageText: -// -// Target or discovery service did not respond in time for an iSCSI request sent by the initiator. -// iSCSI Function code is given in the dump data. For details about iSCSI Function code please refer -// to iSCSI User's Guide. -// -#define ISCSI_ERR_ISCSI_REQUEST_TIMEOUT ((NTSTATUS)0xC0000008L) - -// -// MessageId: ISCSI_ERR_SCSI_REQUEST_TIMEOUT -// -// MessageText: -// -// Target did not respond in time for a SCSI request. The CDB is given in the dump data. -// -#define ISCSI_ERR_SCSI_REQUEST_TIMEOUT ((NTSTATUS)0xC0000009L) - -// -// MessageId: ISCSI_ERR_LOGIN_FAILED -// -// MessageText: -// -// Login request failed. The login response packet is given in the dump data. -// -#define ISCSI_ERR_LOGIN_FAILED ((NTSTATUS)0xC000000AL) - -// -// MessageId: ISCSI_ERR_LOGIN_PDU_ERROR -// -// MessageText: -// -// Target returned an invalid login response packet. The login response packet is given in the dump data. -// -#define ISCSI_ERR_LOGIN_PDU_ERROR ((NTSTATUS)0xC000000BL) - -// -// MessageId: ISCSI_ERR_INVALID_LOGIN_REDIRECT_DATA -// -// MessageText: -// -// Target provided invalid data for login redirect. Dump data contains the data returned by the target. -// -#define ISCSI_ERR_INVALID_LOGIN_REDIRECT_DATA ((NTSTATUS)0xC000000CL) - -// -// MessageId: ISCSI_ERR_INVALID_AUTHMETHOD -// -// MessageText: -// -// Target offered an unknown AuthMethod. Dump data contains the data returned by the target. -// -#define ISCSI_ERR_INVALID_AUTHMETHOD ((NTSTATUS)0xC000000DL) - -// -// MessageId: ISCSI_ERR_INVALID_CHAP_ALGORITHM -// -// MessageText: -// -// Target offered an unknown digest algorithm for CHAP. Dump data contains the data returned by the target. -// -#define ISCSI_ERR_INVALID_CHAP_ALGORITHM ((NTSTATUS)0xC000000EL) - -// -// MessageId: ISCSI_ERR_INVALID_CHAP_CHALLENGE -// -// MessageText: -// -// CHAP challenge given by the target contains invalid characters. Dump data contains the challenge given. -// -#define ISCSI_ERR_INVALID_CHAP_CHALLENGE ((NTSTATUS)0xC000000FL) - -// -// MessageId: ISCSI_ERR_INVALID_KEY_DURING_CHAP -// -// MessageText: -// -// An invalid key was received during CHAP negotiation. The key=value pair is given in the dump data. -// -#define ISCSI_ERR_INVALID_KEY_DURING_CHAP ((NTSTATUS)0xC0000010L) - -// -// MessageId: ISCSI_ERR_INVALID_CHAP_RESPONSE -// -// MessageText: -// -// CHAP Response given by the target did not match the expected one. Dump data contains the CHAP response. -// -#define ISCSI_ERR_INVALID_CHAP_RESPONSE ((NTSTATUS)0xC0000011L) - -// -// MessageId: ISCSI_ERR_HEADER_DIGEST_NEEDED -// -// MessageText: -// -// Header Digest is required by the initiator, but target did not offer it. -// -#define ISCSI_ERR_HEADER_DIGEST_NEEDED ((NTSTATUS)0xC0000012L) - -// -// MessageId: ISCSI_ERR_HEADER_DATA_NEEDED -// -// MessageText: -// -// Data Digest is required by the initiator, but target did not offer it. -// -#define ISCSI_ERR_HEADER_DATA_NEEDED ((NTSTATUS)0xC0000013L) - -// -// MessageId: ISCSI_ERR_CONNECTION_LOST -// -// MessageText: -// -// Connection to the target was lost. The initiator will attempt to retry the connection. -// -#define ISCSI_ERR_CONNECTION_LOST ((NTSTATUS)0xC0000014L) - -// -// MessageId: ISCSI_ERR_INVALID_DATA_SEGMENT_LENGTH -// -// MessageText: -// -// Data Segment Length given in the header exceeds MaxRecvDataSegmentLength declared by the target. -// -#define ISCSI_ERR_INVALID_DATA_SEGMENT_LENGTH ((NTSTATUS)0xC0000015L) - -// -// MessageId: ISCSI_ERR_HEADER_DIGEST_ERROR -// -// MessageText: -// -// Header digest error was detected for the given PDU. Dump data contains the header and digest. -// -#define ISCSI_ERR_HEADER_DIGEST_ERROR ((NTSTATUS)0xC0000016L) - -// -// MessageId: ISCSI_ERR_ISCSI_PDU_ERROR -// -// MessageText: -// -// Target sent an invalid iSCSI PDU. Dump data contains the entire iSCSI header. -// -#define ISCSI_ERR_ISCSI_PDU_ERROR ((NTSTATUS)0xC0000017L) - -// -// MessageId: ISCSI_ERR_UNKNOWN_ISCSI_OPCODE -// -// MessageText: -// -// Target sent an iSCSI PDU with an invalid opcode. Dump data contains the entire iSCSI header. -// -#define ISCSI_ERR_UNKNOWN_ISCSI_OPCODE ((NTSTATUS)0xC0000018L) - -// -// MessageId: ISCSI_ERR_DATA_DIGEST_ERROR -// -// MessageText: -// -// Data digest error was detected. Dump data contains the calculated checksum followed by the given checksum. -// -#define ISCSI_ERR_DATA_DIGEST_ERROR ((NTSTATUS)0xC0000019L) - -// -// MessageId: ISCSI_ERR_EXCESS_DATA_SENT -// -// MessageText: -// -// Target trying to send more data than requested by the initiator. -// -#define ISCSI_ERR_EXCESS_DATA_SENT ((NTSTATUS)0xC000001AL) - -// -// MessageId: ISCSI_ERR_UNEXPECTED_PDU -// -// MessageText: -// -// Initiator could not find a match for the initiator task tag in the received PDU. Dump data contains the entire iSCSI header. -// -#define ISCSI_ERR_UNEXPECTED_PDU ((NTSTATUS)0xC000001BL) - -// -// MessageId: ISCSI_ERR_INVALID_RTT_PDU -// -// MessageText: -// -// Initiator received an invalid R2T packet. Dump data contains the entire iSCSI header. -// -#define ISCSI_ERR_INVALID_RTT_PDU ((NTSTATUS)0xC000001CL) - -// -// MessageId: ISCSI_ERR_ISCSI_PDU_REJECTED -// -// MessageText: -// -// Target rejected an iSCSI PDU sent by the initiator. Dump data contains the rejected PDU. -// -#define ISCSI_ERR_ISCSI_PDU_REJECTED ((NTSTATUS)0xC000001DL) - -// -// MessageId: ISCSI_ERR_INSUFFICIENT_WORKITEM_RESOURCES -// -// MessageText: -// -// Initiator could not allocate a workitem for processing a request. -// -#define ISCSI_ERR_INSUFFICIENT_WORKITEM_RESOURCES ((NTSTATUS)0xC000001EL) - -// -// MessageId: ISCSI_ERR_INSUFFICIENT_REQ_PACKET_RESOURCES -// -// MessageText: -// -// Initiator could not allocate resource for processing a request. -// -#define ISCSI_ERR_INSUFFICIENT_REQ_PACKET_RESOURCES ((NTSTATUS)0xC000001FL) - -// -// MessageId: ISCSI_INFO_RECEIVED_ASYNC_LOGOUT -// -// MessageText: -// -// Initiator received an asynchronous logout message. The Target name is given in the dump data. -// -#define ISCSI_INFO_RECEIVED_ASYNC_LOGOUT ((NTSTATUS)0x40000020L) - -// -// MessageId: ISCSI_ERR_INVALID_CHAP_CHALLENGE_SIZE -// -// MessageText: -// -// Challenge size given by the target exceeds the maximum specified in iSCSI specification. -// -#define ISCSI_ERR_INVALID_CHAP_CHALLENGE_SIZE ((NTSTATUS)0xC0000021L) - -// -// MessageId: ISCSI_INFO_RECONNECTED_TO_TARGET -// -// MessageText: -// -// A connection to the target was lost, but Initiator successfully reconnected to the target. Dump data contains the target name. -// -#define ISCSI_INFO_RECONNECTED_TO_TARGET ((NTSTATUS)0x40000022L) - -// -// MessageId: ISCSI_ERR_INVALID_TARGET_CHAP_SECRET -// -// MessageText: -// -// Target CHAP secret is smaller than the minimum size (12 bytes) required by the spec. -// -#define ISCSI_ERR_INVALID_TARGET_CHAP_SECRET ((NTSTATUS)0xC0000023L) - -// -// MessageId: ISCSI_ERR_INVALID_INITIATOR_CHAP_SECRET -// -// MessageText: -// -// Initiator CHAP secret is smaller than the minimum size (12 bytes) required by the spec. Dump data contains the given CHAP secret. -// -#define ISCSI_ERR_INVALID_INITIATOR_CHAP_SECRET ((NTSTATUS)0xC0000024L) - -// -// MessageId: ISCSI_ERR_FIPS_NOT_AVAILABLE -// -// MessageText: -// -// FIPS service could not be initialized. Persistent logons will not be processed. -// -#define ISCSI_ERR_FIPS_NOT_AVAILABLE ((NTSTATUS)0xC0000025L) - -// -// MessageId: ISCSI_ERR_CHAP_NOT_OFFERED -// -// MessageText: -// -// Initiator requires CHAP for logon authentication, but target did not offer CHAP. -// -#define ISCSI_ERR_CHAP_NOT_OFFERED ((NTSTATUS)0xC0000026L) - -// -// MessageId: ISCSI_ERR_DEVICE_RESET -// -// MessageText: -// -// Initiator sent a task management command to reset the target. The target name is given in the dump data. -// -#define ISCSI_ERR_DEVICE_RESET ((NTSTATUS)0xC0000027L) - -// -// MessageId: ISCSI_ERR_CHAP_OFFERED -// -// MessageText: -// -// Target requires logon authentication via CHAP, but Initiator is not configured to perform CHAP. -// -#define ISCSI_ERR_CHAP_OFFERED ((NTSTATUS)0xC0000028L) - -// -// MessageId: ISCSI_ERR_AUTH_METHOD_NOT_OFFERED -// -// MessageText: -// -// Target did not send AuthMethod key during security negotiation phase. -// -#define ISCSI_ERR_AUTH_METHOD_NOT_OFFERED ((NTSTATUS)0xC0000029L) - -// -// MessageId: ISCSI_ERR_INVALID_STATUS_SEQ_NUM -// -// MessageText: -// -// Target sent an invalid status sequence number for a connection. Dump data contains -// Expected Status Sequence number followed by the given status sequence number. -// -#define ISCSI_ERR_INVALID_STATUS_SEQ_NUM ((NTSTATUS)0xC000002AL) - -// -// MessageId: ISCSI_ERR_LOGIN_TIMED_OUT -// -// MessageText: -// -// Target failed to respond in time for a login request. -// -#define ISCSI_ERR_LOGIN_TIMED_OUT ((NTSTATUS)0xC000002BL) - -// -// MessageId: ISCSI_ERR_LOGOUT_TIMED_OUT -// -// MessageText: -// -// Target failed to respond in time for a logout request. -// -#define ISCSI_ERR_LOGOUT_TIMED_OUT ((NTSTATUS)0xC000002CL) - -// -// MessageId: ISCSI_ERR_ADDCONNECTION_TIMED_OUT -// -// MessageText: -// -// Target failed to respond in time for a login request. This login request was for adding a new connection to a session. -// -#define ISCSI_ERR_ADDCONNECTION_TIMED_OUT ((NTSTATUS)0xC000002DL) - -// -// MessageId: ISCSI_ERR_SENDTARGETS_TIMED_OUT -// -// MessageText: -// -// Target failed to respond in time for a SendTargets command. -// -#define ISCSI_ERR_SENDTARGETS_TIMED_OUT ((NTSTATUS)0xC000002EL) - -// -// MessageId: ISCSI_ERR_SCSICOMMAND_TIMED_OUT -// -// MessageText: -// -// Target failed to respond in time for a SCSI command sent through a WMI request. -// -#define ISCSI_ERR_SCSICOMMAND_TIMED_OUT ((NTSTATUS)0xC000002FL) - -// -// MessageId: ISCSI_ERR_NOP_TIMED_OUT -// -// MessageText: -// -// Target failed to respond in time to a NOP request. -// -#define ISCSI_ERR_NOP_TIMED_OUT ((NTSTATUS)0xC0000030L) - -// -// MessageId: ISCSI_ERR_TASKMGMT_TIMED_OUT -// -// MessageText: -// -// Target failed to respond in time to a Task Management request. -// -#define ISCSI_ERR_TASKMGMT_TIMED_OUT ((NTSTATUS)0xC0000031L) - -// -// MessageId: ISCSI_ERR_ASYNC_TEXT_CMD_TIMED_OUT -// -// MessageText: -// -// Target failed to respond in time to a Text Command sent to renegotiate iSCSI parameters. -// -#define ISCSI_ERR_ASYNC_TEXT_CMD_TIMED_OUT ((NTSTATUS)0xC0000032L) - -// -// MessageId: ISCSI_ERR_ASYNC_LOGOUT_TIMED_OUT -// -// MessageText: -// -// Target failed to respond in time to a logout request sent in response to an asynchronous message from the target. -// -#define ISCSI_ERR_ASYNC_LOGOUT_TIMED_OUT ((NTSTATUS)0xC0000033L) - -// -// MessageId: ISCSI_ERR_CONFIG_IPSEC_TIMED_OUT -// -// MessageText: -// -// Initiator Service failed to respond in time to a request to configure IPSec resources for an iSCSI connection. -// -#define ISCSI_ERR_CONFIG_IPSEC_TIMED_OUT ((NTSTATUS)0xC0000034L) - -// -// MessageId: ISCSI_ERR_RELEASE_IPSEC_TIMED_OUT -// -// MessageText: -// -// Initiator Service failed to respond in time to a request to release IPSec resources allocated for an iSCSI connection. -// -#define ISCSI_ERR_RELEASE_IPSEC_TIMED_OUT ((NTSTATUS)0xC0000035L) - -// -// MessageId: ISCSI_ERR_ENCRYPT_DECRYPT_TIMED_OUT -// -// MessageText: -// -// Initiator Service failed to respond in time to a request to encrypt or decrypt data. -// -#define ISCSI_ERR_ENCRYPT_DECRYPT_TIMED_OUT ((NTSTATUS)0xC0000036L) - -// -// MessageId: ISCSI_ERR_INSUFFICIENT_RESOURCES_FOR_SEND -// -// MessageText: -// -// Initiator failed to allocate resources to send data to target. -// -#define ISCSI_ERR_INSUFFICIENT_RESOURCES_FOR_SEND ((NTSTATUS)0xC0000037L) - -// -// MessageId: ISCSI_ERR_FAILED_TO_GET_SYSTEM_ADDRESS -// -// MessageText: -// -// Initiator could not map an user virtual address to kernel virtual address resulting in I/O failure. -// -#define ISCSI_ERR_FAILED_TO_GET_SYSTEM_ADDRESS ((NTSTATUS)0xC0000038L) - -// -// MessageId: ISCSI_ERR_FAILED_TO_ALLOCATE_RESOURCES_FOR_IO -// -// MessageText: -// -// Initiator could not allocate required resources for processing a request resulting in I/O failure. -// -#define ISCSI_ERR_FAILED_TO_ALLOCATE_RESOURCES_FOR_IO ((NTSTATUS)0xC0000039L) - -// -// MessageId: ISCSI_ERR_FAILED_TO_ALLOCATE_REQUEST_TAG -// -// MessageText: -// -// Initiator could not allocate a tag for processing a request resulting in I/O failure. -// -#define ISCSI_ERR_FAILED_TO_ALLOCATE_REQUEST_TAG ((NTSTATUS)0xC000003AL) - -// -// MessageId: ISCSI_ERR_CONNECTION_DROPPED_BEFORE_FFP -// -// MessageText: -// -// Target dropped the connection before the initiator could transition to Full Feature Phase. -// -#define ISCSI_ERR_CONNECTION_DROPPED_BEFORE_FFP ((NTSTATUS)0xC000003BL) - -// -// MessageId: ISCSI_ERR_DATA_SENT_IN_SCSI_RESPONSE -// -// MessageText: -// -// Target sent data in SCSI Response PDU instead of Data_IN PDU. Only Sense Data can be sent in SCSI Response. -// -#define ISCSI_ERR_DATA_SENT_IN_SCSI_RESPONSE ((NTSTATUS)0xC000003CL) - -// -// MessageId: ISCSI_ERR_DATA_PDU_IN_ORDER_FALSE -// -// MessageText: -// -// Target set DataPduInOrder to NO when initiator requested YES. Login will be failed. -// -#define ISCSI_ERR_DATA_PDU_IN_ORDER_FALSE ((NTSTATUS)0xC000003DL) - -// -// MessageId: ISCSI_ERR_DATA_SEQ_IN_ORDER_FALSE -// -// MessageText: -// -// Target set DataSequenceInOrder to NO when initiator requested YES. Login will be failed. -// -#define ISCSI_ERR_DATA_SEQ_IN_ORDER_FALSE ((NTSTATUS)0xC000003EL) - -// -// MessageId: ISCSI_ERR_TOO_MANY_RESET_FAILURE -// -// MessageText: -// -// Can not Reset the Target or LUN. Will attempt session recovery. -// -#define ISCSI_ERR_TOO_MANY_RESET_FAILURE ((NTSTATUS)0xC000003FL) - -// -// MessageId: ISCSI_INFO_NIC_BOOT -// -// MessageText: -// -// Attempt to bootstrap Windows using iSCSI NIC Boot (iBF) -// -#define ISCSI_INFO_NIC_BOOT ((NTSTATUS)0x40000040L) - -// -// MessageId: ISCSI_PAGING_IRP_ERROR -// -// MessageText: -// -// Booting from iSCSI, but Could not set any NIC in Paging Path. -// -#define ISCSI_PAGING_IRP_ERROR ((NTSTATUS)0xC0000041L) - -// -// MessageId: ISCSI_ERR_DISABLE_NAGLE -// -// MessageText: -// -// Attempt to disable the Nagle Algorithm for iSCSI connection failed. -// -#define ISCSI_ERR_DISABLE_NAGLE ((NTSTATUS)0xC0000042L) - -// -// MessageId: ISCSI_USING_PROCESSOR_CRC32 -// -// MessageText: -// -// If Digest support selected for iSCSI Session, Will use Processor support for Digest computation. -// -#define ISCSI_USING_PROCESSOR_CRC32 ((NTSTATUS)0x40000043L) - -// -// MessageId: ISCSI_ERR_FAILED_TO_RECOVER_SESSION_AFTER_ASYNCLOGOUT -// -// MessageText: -// -// After receiving an async logout from the target, attempt to relogin the session failed. Error status is given in the dump data. -// -#define ISCSI_ERR_FAILED_TO_RECOVER_SESSION_AFTER_ASYNCLOGOUT ((NTSTATUS)0xC0000044L) - -// -// MessageId: ISCSI_ERR_FAILED_TO_RECOVER_UNEXPECTED_TERMINATED_SESSION -// -// MessageText: -// -// Attempt to recover an unexpected terminated session failed. Error status is given in the dump data. -// -#define ISCSI_ERR_FAILED_TO_RECOVER_UNEXPECTED_TERMINATED_SESSION ((NTSTATUS)0xC0000045L) - -// -// MessageId: ISCSI_ERR_FAILED_TO_PROCESS_LOGON_REQUEST -// -// MessageText: -// -// Error occurred when processing iSCSI logon request. The request was not retried. Error status is given in the dump data. -// -#define ISCSI_ERR_FAILED_TO_PROCESS_LOGON_REQUEST ((NTSTATUS)0xC0000046L) - -// -// MessageId: ISCSI_SESSION_RECOVERY_REQUEST_NOT_STARTED -// -// MessageText: -// -// Initiator did not start a session recovery upon receiving the request. Dump data contains the error status. -// -#define ISCSI_SESSION_RECOVERY_REQUEST_NOT_STARTED ((NTSTATUS)0x40000047L) - -// -// MessageId: ISCSI_UNEXPECTED_TARGET_PORTAL_IP_TYPE -// -// MessageText: -// -// Unexpected target portal IP types. Dump data contains the expected IP type. -// -#define ISCSI_UNEXPECTED_TARGET_PORTAL_IP_TYPE ((NTSTATUS)0xC0000048L) - -#endif /* _ISCSILOG_ */ - diff --git a/pub/ddk/iscsimgt.h b/pub/ddk/iscsimgt.h deleted file mode 100644 index 6a71277..0000000 --- a/pub/ddk/iscsimgt.h +++ /dev/null @@ -1,1143 +0,0 @@ -#ifndef _iscsimgt_h_ -#define _iscsimgt_h_ - -// MSiSCSI_HBAInformation - MSiSCSI_HBAInformation - - -//*************************************************************************** -// -// iscsimgt.h -// -// Module: iScsi Discovery api -// -// Purpose: Internal header defining interface between user mode discovery -// api dll and HBA driver miniport. -// -// Copyright (c) 2001 Microsoft Corporation -// -//*************************************************************************** - -#include - -// -// -// This class is required. -// -// Adapter Information class. The iSCSI initiator service relies upon this -// class in order to interface with your adapter. Implement one instance -// per adapter instance. -// -// This class must be registered using PDO instance names with a single instance -// - -#define MSiSCSI_HBAInformationGuid \ - { 0x58515bf3,0x2f59,0x4f37, { 0xb7,0x4f,0x85,0xae,0xec,0x65,0x2a,0xd6 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_HBAInformation_GUID, \ - 0x58515bf3,0x2f59,0x4f37,0xb7,0x4f,0x85,0xae,0xec,0x65,0x2a,0xd6); -#endif - - -typedef struct _MSiSCSI_HBAInformation -{ - // Id that is globally unique for all instances of iSCSI initiators. Use the address of the Adapter Extension or another address owned by the device driver. - ULONGLONG UniqueAdapterId; - #define MSiSCSI_HBAInformation_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_HBAInformation_UniqueAdapterId_ID 1 - - // TRUE if TCP/IP traffic is integrated with the Windows networking TCP/IP stack via a software only initiator. An adapter with its own TCP/IP stack would set this to FALSE. - BOOLEAN IntegratedTCPIP; - #define MSiSCSI_HBAInformation_IntegratedTCPIP_SIZE sizeof(BOOLEAN) - #define MSiSCSI_HBAInformation_IntegratedTCPIP_ID 2 - - // If TRUE the iSCSI Initiator service will perform any DNS lookup and pass binary IP addresses to the adapter; the adapter must be on the same network as the Windows TCP/IP stack. If FALSE then DNS must be available on adapter. - BOOLEAN RequiresBinaryIpAddresses; - #define MSiSCSI_HBAInformation_RequiresBinaryIpAddresses_SIZE sizeof(BOOLEAN) - #define MSiSCSI_HBAInformation_RequiresBinaryIpAddresses_ID 3 - - // Minimum version number of the iScsi spec supported by adapter - UCHAR VersionMin; - #define MSiSCSI_HBAInformation_VersionMin_SIZE sizeof(UCHAR) - #define MSiSCSI_HBAInformation_VersionMin_ID 4 - - // Maximum version number of the iSCSI spec supported by adapter - UCHAR VersionMax; - #define MSiSCSI_HBAInformation_VersionMax_SIZE sizeof(UCHAR) - #define MSiSCSI_HBAInformation_VersionMax_ID 5 - - // TRUE if this adapter is a multifunction device, that is it also exposes a netcard interface - BOOLEAN MultifunctionDevice; - #define MSiSCSI_HBAInformation_MultifunctionDevice_SIZE sizeof(BOOLEAN) - #define MSiSCSI_HBAInformation_MultifunctionDevice_ID 6 - - // TRUE if the adapter caches are valid - BOOLEAN CacheValid; - #define MSiSCSI_HBAInformation_CacheValid_SIZE sizeof(BOOLEAN) - #define MSiSCSI_HBAInformation_CacheValid_ID 7 - - // Number of ports (or TCP/IP addresses) on the adapter - ULONG NumberOfPorts; - #define MSiSCSI_HBAInformation_NumberOfPorts_SIZE sizeof(ULONG) - #define MSiSCSI_HBAInformation_NumberOfPorts_ID 8 - - -#define ISCSI_HBA_STATUS_WORKING 0 -#define ISCSI_HBA_STATUS_DEGRADED 1 -#define ISCSI_HBA_STATUS_CRITICAL 2 -#define ISCSI_HBA_STATUS_FAILED 3 - - // **typedef** Current status of adapter - ULONG Status; - #define MSiSCSI_HBAInformation_Status_SIZE sizeof(ULONG) - #define MSiSCSI_HBAInformation_Status_ID 9 - - - -// -// Flags that define the functionality supported by the HBA -// -#define ISCSI_HBA_PRESHARED_KEY_CACHE 0x00000001 -#define ISCSI_HBA_ISCSI_AUTHENTICATION_CACHE 0x00000002 -#define ISCSI_HBA_IPSEC_TUNNEL_MODE 0x00000004 -#define ISCSI_HBA_CHAP_VIA_RADIUS 0x00000008 -#define ISCSI_HBA_ISNS_DISCOVERY 0x00000010 -#define ISCSI_HBA_SLP_DISCOVERY 0x00000020 - - - // **typedef** Bit flags that indicate various functionality supported - ULONG FunctionalitySupported; - #define MSiSCSI_HBAInformation_FunctionalitySupported_SIZE sizeof(ULONG) - #define MSiSCSI_HBAInformation_FunctionalitySupported_ID 10 - - // This is the GUID value last set by the SetGenerationalGuid method in the MSiSCSI_Operations class. - UCHAR GenerationalGuid[16]; - #define MSiSCSI_HBAInformation_GenerationalGuid_SIZE sizeof(UCHAR[16]) - #define MSiSCSI_HBAInformation_GenerationalGuid_ID 11 - - // Maxumum CDB length supported by the adapter - ULONG MaxCDBLength; - #define MSiSCSI_HBAInformation_MaxCDBLength_SIZE sizeof(ULONG) - #define MSiSCSI_HBAInformation_MaxCDBLength_ID 12 - - // TRUE if Bi-directionsal SCSI comamnd supported - BOOLEAN BiDiScsiCommands; - #define MSiSCSI_HBAInformation_BiDiScsiCommands_SIZE sizeof(BOOLEAN) - #define MSiSCSI_HBAInformation_BiDiScsiCommands_ID 13 - - // A text string describing the manufacturer of adapter - WCHAR VendorID[255 + 1]; - #define MSiSCSI_HBAInformation_VendorID_ID 14 - - // A text string set by the manufacturer describing the model of adapter - WCHAR VendorModel[255 + 1]; - #define MSiSCSI_HBAInformation_VendorModel_ID 15 - - // A text string set by the manufacturer describing the version of adapter - WCHAR VendorVersion[255 + 1]; - #define MSiSCSI_HBAInformation_VendorVersion_ID 16 - - // A text string set by the manufacturer describing the firmware version of adapter - WCHAR FirmwareVersion[255 + 1]; - #define MSiSCSI_HBAInformation_FirmwareVersion_ID 17 - - // A text string set by the manufacturer describing the Asic version - WCHAR AsicVersion[255 + 1]; - #define MSiSCSI_HBAInformation_AsicVersion_ID 18 - - // A text string set by the manufacturer describing the option rom version of adapter - WCHAR OptionRomVersion[255 + 1]; - #define MSiSCSI_HBAInformation_OptionRomVersion_ID 19 - - // A text string set by the manufacturer describing the serial number of adapter - WCHAR SerialNumber[255 + 1]; - #define MSiSCSI_HBAInformation_SerialNumber_ID 20 - - // A text string specifying the name of the driver for the adapter - WCHAR DriverName[255 + 1]; - #define MSiSCSI_HBAInformation_DriverName_ID 21 - -} MSiSCSI_HBAInformation, *PMSiSCSI_HBAInformation; - -// MSiSCSI_HBASessionConfig - MSiSCSI_HBASessionConfig - -// -// -// This class is optional. -// -// This class allows the default session configuration to be managed. It -// contains the default values to use when establishing a session. -// -// This class must be registered using PDO instance names with a single instance -// - -#define MSiSCSI_HBASessionConfigGuid \ - { 0xb35694de,0xd323,0x49d2, { 0xab,0xb2,0x81,0x39,0x20,0x9a,0xd1,0x50 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_HBASessionConfig_GUID, \ - 0xb35694de,0xd323,0x49d2,0xab,0xb2,0x81,0x39,0x20,0x9a,0xd1,0x50); -#endif - - -typedef struct _MSiSCSI_HBASessionConfig -{ - // The InitialR2T key is used to turn off the default use of R2T, thus allowing an initiator to start sending data to a target as if it has received an initial R2T with Buffer Offset=0 and Desired Data Transfer Length=min (FirstBurstSize, Expected Data Transfer Length). - BOOLEAN InitialR2T; - #define MSiSCSI_HBASessionConfig_InitialR2T_SIZE sizeof(BOOLEAN) - #define MSiSCSI_HBASessionConfig_InitialR2T_ID 1 - - // The initiator and target negotiate support for immediate data. To turn immediate data off, the initiator or target must state its desire to do so. ImmediateData can be turned on if both the initiator and target have ImmediateData=Yes. - BOOLEAN ImmediateData; - #define MSiSCSI_HBASessionConfig_ImmediateData_SIZE sizeof(BOOLEAN) - #define MSiSCSI_HBASessionConfig_ImmediateData_ID 2 - - // Maximum data segment length in bytes they can receive in an iSCSI PDU. - ULONG MaxRecvDataSegmentLength; - #define MSiSCSI_HBASessionConfig_MaxRecvDataSegmentLength_SIZE sizeof(ULONG) - #define MSiSCSI_HBASessionConfig_MaxRecvDataSegmentLength_ID 3 - - // Maximum SCSI data payload in bytes in an Data-In or a solicited Data-Out iSCSI sequence. - ULONG MaxBurstLength; - #define MSiSCSI_HBASessionConfig_MaxBurstLength_SIZE sizeof(ULONG) - #define MSiSCSI_HBASessionConfig_MaxBurstLength_ID 4 - - // maximum amount in bytes of unsolicited data an iSCSI initiator may send to the target, during the execution of a single SCSI command. This covers the immediate data (if any) and the sequence of unsolicited Data-Out PDUs (if any) that follow the command. - ULONG FirstBurstLength; - #define MSiSCSI_HBASessionConfig_FirstBurstLength_SIZE sizeof(ULONG) - #define MSiSCSI_HBASessionConfig_FirstBurstLength_ID 5 - - // Initiator and target negotiate the maximum number of outstanding R2Ts per task, excluding any implied initial R2T that might be part of that task. An R2T is considered outstanding until the last data PDU (with the F bit set to 1) is transferred, or a sequence reception timeout (section 6.12.1) is encountered for that data sequence. - ULONG MaxOutstandingR2T; - #define MSiSCSI_HBASessionConfig_MaxOutstandingR2T_SIZE sizeof(ULONG) - #define MSiSCSI_HBASessionConfig_MaxOutstandingR2T_ID 6 - -} MSiSCSI_HBASessionConfig, *PMSiSCSI_HBASessionConfig; - -#define MSiSCSI_HBASessionConfig_SIZE (FIELD_OFFSET(MSiSCSI_HBASessionConfig, MaxOutstandingR2T) + MSiSCSI_HBASessionConfig_MaxOutstandingR2T_SIZE) - -// ISCSI_ConnectionStaticInfo - ISCSI_ConnectionStaticInfo -// iSCSI Static Connection Statistics Information -#define ISCSI_ConnectionStaticInfoGuid \ - { 0x3ce2d6a0,0x7346,0x4826, { 0x97,0x2f,0xf2,0xc1,0x97,0x79,0xd1,0xd1 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_ConnectionStaticInfo_GUID, \ - 0x3ce2d6a0,0x7346,0x4826,0x97,0x2f,0xf2,0xc1,0x97,0x79,0xd1,0xd1); -#endif - - -typedef struct _ISCSI_ConnectionStaticInfo -{ - // A uniquely generated connection ID. Do not confuse this with CID. - ULONGLONG UniqueConnectionId; - #define ISCSI_ConnectionStaticInfo_UniqueConnectionId_SIZE sizeof(ULONGLONG) - #define ISCSI_ConnectionStaticInfo_UniqueConnectionId_ID 1 - - // The iSCSI connection ID for this connection instance. - USHORT CID; - #define ISCSI_ConnectionStaticInfo_CID_SIZE sizeof(USHORT) - #define ISCSI_ConnectionStaticInfo_CID_ID 2 - - - - //login - The TCP connection has been established, but a valid iSCSI - // login response with the final bit set has not been sent or received. - //full - A valid iSCSI login response with the final bit set - // has been sent or received. - //logout - A valid iSCSI logout command has been sent or received, but - // the TCP connection has not yet been closed. - - - -// login -#define login 0 -// full -#define full 1 -// logout -#define logout 2 - - // **typedef** Indicates the current state of this connection - UCHAR State; - #define ISCSI_ConnectionStaticInfo_State_SIZE sizeof(UCHAR) - #define ISCSI_ConnectionStaticInfo_State_ID 3 - - -// TCP -#define TCP 6 - - // **typedef** The transport protocol over which this connection instance is running. - UCHAR Protocol; - #define ISCSI_ConnectionStaticInfo_Protocol_SIZE sizeof(UCHAR) - #define ISCSI_ConnectionStaticInfo_Protocol_ID 4 - - -// None -#define None 0 -// crc32c -#define crc32c 1 - - // **typedef** The name of the iSCSI header digest scheme in use within this session. - UCHAR HeaderIntegrity; - #define ISCSI_ConnectionStaticInfo_HeaderIntegrity_SIZE sizeof(UCHAR) - #define ISCSI_ConnectionStaticInfo_HeaderIntegrity_ID 5 - - -// None -#define None 0 -// crc32c -#define crc32c 1 - - // **typedef** The name of the iSCSI data digest scheme in use within this session. - UCHAR DataIntegrity; - #define ISCSI_ConnectionStaticInfo_DataIntegrity_SIZE sizeof(UCHAR) - #define ISCSI_ConnectionStaticInfo_DataIntegrity_ID 6 - - // Must be zero - USHORT Reserved; - #define ISCSI_ConnectionStaticInfo_Reserved_SIZE sizeof(USHORT) - #define ISCSI_ConnectionStaticInfo_Reserved_ID 7 - - // The maximum data payload size supported for command or data PDUs within this session. - ULONG MaxRecvDataSegmentLength; - #define ISCSI_ConnectionStaticInfo_MaxRecvDataSegmentLength_SIZE sizeof(ULONG) - #define ISCSI_ConnectionStaticInfo_MaxRecvDataSegmentLength_ID 8 - - // **typedef** Authentication type used when establishing the connection. - ULONG AuthType; - #define ISCSI_ConnectionStaticInfo_AuthType_SIZE sizeof(ULONG) - #define ISCSI_ConnectionStaticInfo_AuthType_ID 9 - - // The local network address used for the connection - ISCSI_IP_Address LocalAddr; - #define ISCSI_ConnectionStaticInfo_LocalAddr_SIZE sizeof(ISCSI_IP_Address) - #define ISCSI_ConnectionStaticInfo_LocalAddr_ID 10 - - // The local port used for the connection - ULONG LocalPort; - #define ISCSI_ConnectionStaticInfo_LocalPort_SIZE sizeof(ULONG) - #define ISCSI_ConnectionStaticInfo_LocalPort_ID 11 - - // The remote network address used for the connection - ISCSI_IP_Address RemoteAddr; - #define ISCSI_ConnectionStaticInfo_RemoteAddr_SIZE sizeof(ISCSI_IP_Address) - #define ISCSI_ConnectionStaticInfo_RemoteAddr_ID 12 - - // The remote port used for the connection - ULONG RemotePort; - #define ISCSI_ConnectionStaticInfo_RemotePort_SIZE sizeof(ULONG) - #define ISCSI_ConnectionStaticInfo_RemotePort_ID 13 - - // Estimated throughput of the link in bytes per second - ULONGLONG EstimatedThroughput; - #define ISCSI_ConnectionStaticInfo_EstimatedThroughput_SIZE sizeof(ULONGLONG) - #define ISCSI_ConnectionStaticInfo_EstimatedThroughput_ID 14 - - // Maximum Datagram size supported by the transport in bytes - ULONG MaxDatagramSize; - #define ISCSI_ConnectionStaticInfo_MaxDatagramSize_SIZE sizeof(ULONG) - #define ISCSI_ConnectionStaticInfo_MaxDatagramSize_ID 15 - -} ISCSI_ConnectionStaticInfo, *PISCSI_ConnectionStaticInfo; - -#define ISCSI_ConnectionStaticInfo_SIZE (FIELD_OFFSET(ISCSI_ConnectionStaticInfo, MaxDatagramSize) + ISCSI_ConnectionStaticInfo_MaxDatagramSize_SIZE) - -// ISCSI_SessionStaticInfo - ISCSI_SessionStaticInfo -// iSCSI Static Sessions Statistics Information -#define ISCSI_SessionStaticInfoGuid \ - { 0xb71d2538,0x57e2,0x4228, { 0x88,0x8b,0x1a,0xf9,0xb3,0xbd,0x01,0xcd } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_SessionStaticInfo_GUID, \ - 0xb71d2538,0x57e2,0x4228,0x88,0x8b,0x1a,0xf9,0xb3,0xbd,0x01,0xcd); -#endif - - -typedef struct _ISCSI_SessionStaticInfo -{ - // A uniquely generated session ID, it is the same id returned by the LoginToTarget method. Do not confuse this with ISID or SSID. - ULONGLONG UniqueSessionId; - #define ISCSI_SessionStaticInfo_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define ISCSI_SessionStaticInfo_UniqueSessionId_ID 1 - - // Initiator node name used to establish the session - WCHAR InitiatoriSCSIName[223 + 1]; - #define ISCSI_SessionStaticInfo_InitiatoriSCSIName_ID 2 - - // iSCSI node name of the target - WCHAR TargetiSCSIName[223 + 1]; - #define ISCSI_SessionStaticInfo_TargetiSCSIName_ID 3 - - // Target-defined portion of the iSCSI Session ID - USHORT TSID; - #define ISCSI_SessionStaticInfo_TSID_SIZE sizeof(USHORT) - #define ISCSI_SessionStaticInfo_TSID_ID 4 - - // Initiator-defined portion of the iSCSI Session ID - UCHAR ISID[6]; - #define ISCSI_SessionStaticInfo_ISID_SIZE sizeof(UCHAR[6]) - #define ISCSI_SessionStaticInfo_ISID_ID 5 - - // If TRUE, the initiator must wait for an R2T before sending data to the target. If FALSE, the initiator may send data immediately, within limits set by FirstBurstSize and the expected data transfer length of the request. - BOOLEAN InitialR2t; - #define ISCSI_SessionStaticInfo_InitialR2t_SIZE sizeof(BOOLEAN) - #define ISCSI_SessionStaticInfo_InitialR2t_ID 6 - - // If TRUE indicates whether the initiator and target have agreed to support immediate commands on this session. - BOOLEAN ImmediateData; - #define ISCSI_SessionStaticInfo_ImmediateData_SIZE sizeof(BOOLEAN) - #define ISCSI_SessionStaticInfo_ImmediateData_ID 7 - - - - // Type of iSCSI session - // discoverySession - session is being used only for discovery - // informationalSession - session is used for a limited number of scsi commands - // dataSession - session is being used as a full feature session - // bootSession - session is being used to boot an initiator - - - -// discoverySession -#define discoverySession 0 -// informationalSession -#define informationalSession 1 -// dataSession -#define dataSession 2 -// bootSession -#define bootSession 3 - - // **typedef** Type of iSCSI session - UCHAR Type; - #define ISCSI_SessionStaticInfo_Type_SIZE sizeof(UCHAR) - #define ISCSI_SessionStaticInfo_Type_ID 8 - - // If FALSE indicates that data PDU Sequences may be transferred in any order. If TRUE indicates that data PDU sequences must be transferred using continuously increasing offsets, except during error recovery. - BOOLEAN DataSequenceInOrder; - #define ISCSI_SessionStaticInfo_DataSequenceInOrder_SIZE sizeof(BOOLEAN) - #define ISCSI_SessionStaticInfo_DataSequenceInOrder_ID 9 - - // If FALSE indicates that data PDUs within sequences may be in any order. If TRUE indicates that data PDUs within sequences must be at continuously increasing addresses, with no gaps or overlay between PDUs. - BOOLEAN DataPduInOrder; - #define ISCSI_SessionStaticInfo_DataPduInOrder_SIZE sizeof(BOOLEAN) - #define ISCSI_SessionStaticInfo_DataPduInOrder_ID 10 - - // The level of error recovery negotiated between the initiator and the target. - UCHAR ErrorRecoveryLevel; - #define ISCSI_SessionStaticInfo_ErrorRecoveryLevel_SIZE sizeof(UCHAR) - #define ISCSI_SessionStaticInfo_ErrorRecoveryLevel_ID 11 - - // The maximum number of outstanding request-to-transmit (R2T) per task within this session - ULONG MaxOutstandingR2t; - #define ISCSI_SessionStaticInfo_MaxOutstandingR2t_SIZE sizeof(ULONG) - #define ISCSI_SessionStaticInfo_MaxOutstandingR2t_ID 12 - - // The maximum length supported for unsolicited data sent within this session - ULONG FirstBurstLength; - #define ISCSI_SessionStaticInfo_FirstBurstLength_SIZE sizeof(ULONG) - #define ISCSI_SessionStaticInfo_FirstBurstLength_ID 13 - - // The maximum number of bytes which can be sent within a single sequence of Data-In or Data-Out PDUs - ULONG MaxBurstLength; - #define ISCSI_SessionStaticInfo_MaxBurstLength_SIZE sizeof(ULONG) - #define ISCSI_SessionStaticInfo_MaxBurstLength_ID 14 - - // The maximum number of connections that will be allowed within this session - ULONG MaxConnections; - #define ISCSI_SessionStaticInfo_MaxConnections_SIZE sizeof(ULONG) - #define ISCSI_SessionStaticInfo_MaxConnections_ID 15 - - // The number of connections that currently belong to this session - USHORT ConnectionCount; - #define ISCSI_SessionStaticInfo_ConnectionCount_SIZE sizeof(USHORT) - #define ISCSI_SessionStaticInfo_ConnectionCount_ID 16 - - // List of ISCSI_ConnectionStaticInfo. ConnectionCount specifies the number of elements in the array. NOTE: This is a variable length array. - ISCSI_ConnectionStaticInfo ConnectionsList[1]; - #define ISCSI_SessionStaticInfo_ConnectionsList_ID 17 - -} ISCSI_SessionStaticInfo, *PISCSI_SessionStaticInfo; - -// ISCSI_PortalInfo - ISCSI_PortalInfo -// iSCSI Portal Info -#define ISCSI_PortalInfoGuid \ - { 0x4fb9130e,0x1fef,0x4ae6, { 0x9e,0x48,0x77,0x83,0x92,0x04,0xd4,0x13 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_PortalInfo_GUID, \ - 0x4fb9130e,0x1fef,0x4ae6,0x9e,0x48,0x77,0x83,0x92,0x04,0xd4,0x13); -#endif - - -typedef struct _ISCSI_PortalInfo -{ - // An integer used to uniquely identify a paticular port - ULONG Index; - #define ISCSI_PortalInfo_Index_SIZE sizeof(ULONG) - #define ISCSI_PortalInfo_Index_ID 1 - - -// Initiator -#define InitiatorPortals 0 -// Target -#define TargetPortals 1 - - // **typedef** The type of portal (Initiator or Target) - - UCHAR PortalType; - #define ISCSI_PortalInfo_PortalType_SIZE sizeof(UCHAR) - #define ISCSI_PortalInfo_PortalType_ID 2 - - -// TCP -#define TCP 6 - - // The portal's transport protocol - UCHAR Protocol; - #define ISCSI_PortalInfo_Protocol_SIZE sizeof(UCHAR) - #define ISCSI_PortalInfo_Protocol_ID 3 - - // - UCHAR Reserved1; - #define ISCSI_PortalInfo_Reserved1_SIZE sizeof(UCHAR) - #define ISCSI_PortalInfo_Reserved1_ID 4 - - // - UCHAR Reserved2; - #define ISCSI_PortalInfo_Reserved2_SIZE sizeof(UCHAR) - #define ISCSI_PortalInfo_Reserved2_ID 5 - - // The portal's network address - ISCSI_IP_Address IPAddr; - #define ISCSI_PortalInfo_IPAddr_SIZE sizeof(ISCSI_IP_Address) - #define ISCSI_PortalInfo_IPAddr_ID 6 - - // The portal's socket number - ULONG Port; - #define ISCSI_PortalInfo_Port_SIZE sizeof(ULONG) - #define ISCSI_PortalInfo_Port_ID 7 - - // The portal's aggregation tag - USHORT PortalTag; - #define ISCSI_PortalInfo_PortalTag_SIZE sizeof(USHORT) - #define ISCSI_PortalInfo_PortalTag_ID 8 - -} ISCSI_PortalInfo, *PISCSI_PortalInfo; - -#define ISCSI_PortalInfo_SIZE (FIELD_OFFSET(ISCSI_PortalInfo, PortalTag) + ISCSI_PortalInfo_PortalTag_SIZE) - -// MSiSCSI_PortalInfoClass - MSiSCSI_PortalInfoClass -// iScsi Portal Information Class - -// -// -// This class is recommended. -// -// This class exposes portal information. -// -// This class must be registered using PDO instance names with a single instance -// - -#define MSiSCSI_PortalInfoClassGuid \ - { 0x84ca6fd6,0xb152,0x4e6a, { 0x88,0x69,0xfd,0xe5,0xe3,0x7b,0x61,0x57 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_PortalInfoClass_GUID, \ - 0x84ca6fd6,0xb152,0x4e6a,0x88,0x69,0xfd,0xe5,0xe3,0x7b,0x61,0x57); -#endif - - -typedef struct _MSiSCSI_PortalInfoClass -{ - // Number of elements in iScsiPortalInfo array - ULONG PortalInfoCount; - #define MSiSCSI_PortalInfoClass_PortalInfoCount_SIZE sizeof(ULONG) - #define MSiSCSI_PortalInfoClass_PortalInfoCount_ID 1 - - // Variable length array of iScsiPortalInfo. PortalInfoCount specifies the number of elements in the array. NOTE: this is a variable length array. - ISCSI_PortalInfo PortalInformation[1]; - #define MSiSCSI_PortalInfoClass_PortalInformation_ID 2 - -} MSiSCSI_PortalInfoClass, *PMSiSCSI_PortalInfoClass; - -// MSiSCSI_InitiatorSessionInfo - MSiSCSI_InitiatorSessionInfo -// iSCSI Static Initiator Session Information - -// -// -// This class is required. -// -// This class exposes session and connection information on the initiator. -// -// This class should use PDO instance names with a single instance. -// - -#define MSiSCSI_InitiatorSessionInfoGuid \ - { 0xd7931411,0x0376,0x4869, { 0xa4,0x91,0x8d,0x67,0x9b,0xfc,0x00,0x4a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_InitiatorSessionInfo_GUID, \ - 0xd7931411,0x0376,0x4869,0xa4,0x91,0x8d,0x67,0x9b,0xfc,0x00,0x4a); -#endif - - -typedef struct _MSiSCSI_InitiatorSessionInfo -{ - // Id that is globally unique to each instance of each adapter. Using the address of the Adapter Extension is a good idea. - ULONGLONG UniqueAdapterId; - #define MSiSCSI_InitiatorSessionInfo_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_InitiatorSessionInfo_UniqueAdapterId_ID 1 - - // Number of elements in SessionList array - ULONG SessionCount; - #define MSiSCSI_InitiatorSessionInfo_SessionCount_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorSessionInfo_SessionCount_ID 2 - - // Variable length array of sessions. SessionCount specifies the number of elements in the array. NOTE: this is a variable length array. - ISCSI_SessionStaticInfo SessionsList[1]; - #define MSiSCSI_InitiatorSessionInfo_SessionsList_ID 3 - -} MSiSCSI_InitiatorSessionInfo, *PMSiSCSI_InitiatorSessionInfo; - -// MSiSCSI_InitiatorNodeFailureEvent - MSiSCSI_InitiatorNodeFailureEvent -// iSCSI Initiator Node Failure Event - -// -// -// This class is recommended. -// -// This class fires an event when a node failure occurs. -// -// This class should use PDO instance names with a single instance. -// - -#define MSiSCSI_InitiatorNodeFailureEventGuid \ - { 0x1221948a,0x6332,0x4ac2, { 0xaa,0x04,0x26,0x8a,0xab,0xce,0xce,0x4f } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_InitiatorNodeFailureEvent_GUID, \ - 0x1221948a,0x6332,0x4ac2,0xaa,0x04,0x26,0x8a,0xab,0xce,0xce,0x4f); -#endif - - -typedef struct _MSiSCSI_InitiatorNodeFailureEvent -{ - // Timestamp denoting time failure occured - ULONGLONG FailureTime; - #define MSiSCSI_InitiatorNodeFailureEvent_FailureTime_SIZE sizeof(ULONGLONG) - #define MSiSCSI_InitiatorNodeFailureEvent_FailureTime_ID 1 - - -// LoginOtherFail -#define LoginOtherFail 0 -// LoginAuthFail -#define LoginAuthFail 1 -// LoginAuthenticateFail -#define LoginAuthenticateFail 2 -// LoginNegotiateFail -#define LoginNegotiateFail 3 -// LogoutOthers -#define LogoutOthers 4 - - // **typedef** Types of initiator node failure - UCHAR FailureType; - #define MSiSCSI_InitiatorNodeFailureEvent_FailureType_SIZE sizeof(UCHAR) - #define MSiSCSI_InitiatorNodeFailureEvent_FailureType_ID 2 - - // Name of target involved in failure - WCHAR TargetFailureName[223 + 1]; - #define MSiSCSI_InitiatorNodeFailureEvent_TargetFailureName_ID 3 - - // Network address of target involved in failure - ISCSI_IP_Address TargetFailureAddr; - #define MSiSCSI_InitiatorNodeFailureEvent_TargetFailureAddr_SIZE sizeof(ISCSI_IP_Address) - #define MSiSCSI_InitiatorNodeFailureEvent_TargetFailureAddr_ID 4 - -} MSiSCSI_InitiatorNodeFailureEvent, *PMSiSCSI_InitiatorNodeFailureEvent; - -#define MSiSCSI_InitiatorNodeFailureEvent_SIZE (FIELD_OFFSET(MSiSCSI_InitiatorNodeFailureEvent, TargetFailureAddr) + MSiSCSI_InitiatorNodeFailureEvent_TargetFailureAddr_SIZE) - -// MSiSCSI_InitiatorInstanceFailureEvent - MSiSCSI_InitiatorInstanceFailureEvent -// iSCSI Initiator Instance Failure Event - -// -// -// This class is recommended. -// -// This class fires an event when an initiator failure occurs. -// -// This class should use PDO instance names with a single instance. -// - -#define MSiSCSI_InitiatorInstanceFailureEventGuid \ - { 0xe67e1bdb,0xd130,0x4143, { 0x9e,0xb2,0x8b,0xee,0x18,0x99,0xfd,0x52 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_InitiatorInstanceFailureEvent_GUID, \ - 0xe67e1bdb,0xd130,0x4143,0x9e,0xb2,0x8b,0xee,0x18,0x99,0xfd,0x52); -#endif - - -typedef struct _MSiSCSI_InitiatorInstanceFailureEvent -{ - -// SessionDigestError -#define SessionDigestError 0 -// SessionCxnTimeoutError -#define SessionCxnTimeoutError 1 -// SessionFormatError -#define SessionFormatError 2 - - // **typedef** Type of failure - UCHAR FailureType; - #define MSiSCSI_InitiatorInstanceFailureEvent_FailureType_SIZE sizeof(UCHAR) - #define MSiSCSI_InitiatorInstanceFailureEvent_FailureType_ID 1 - - // Name of target involved in failure - WCHAR RemoteNodeName[223 + 1]; - #define MSiSCSI_InitiatorInstanceFailureEvent_RemoteNodeName_ID 2 - -} MSiSCSI_InitiatorInstanceFailureEvent, *PMSiSCSI_InitiatorInstanceFailureEvent; - -// ISCSI_Path - ISCSI_Path -// This class describes an iSCSI Path (A TCP Connection to the target) -#define ISCSI_PathGuid \ - { 0xc8775641,0x5430,0x4220, { 0xba,0x25,0x7d,0xa5,0x61,0xcb,0x64,0xce } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_Path_GUID, \ - 0xc8775641,0x5430,0x4220,0xba,0x25,0x7d,0xa5,0x61,0xcb,0x64,0xce); -#endif - - -typedef struct _ISCSI_Path -{ - // iSCSI Unique connection id - ULONGLONG UniqueConnectionId; - #define ISCSI_Path_UniqueConnectionId_SIZE sizeof(ULONGLONG) - #define ISCSI_Path_UniqueConnectionId_ID 1 - - // Estimated speed of the connection in MegaBits Per Second - ULONGLONG EstimatedLinkSpeed; - #define ISCSI_Path_EstimatedLinkSpeed_SIZE sizeof(ULONGLONG) - #define ISCSI_Path_EstimatedLinkSpeed_ID 2 - - // Weight assigned to the path - ULONG PathWeight; - #define ISCSI_Path_PathWeight_SIZE sizeof(ULONG) - #define ISCSI_Path_PathWeight_ID 3 - - // Flag set to 1 if the path is a primary path, 0 otherwise. - ULONG PrimaryPath; - #define ISCSI_Path_PrimaryPath_SIZE sizeof(ULONG) - #define ISCSI_Path_PrimaryPath_ID 4 - - -// Connected -#define CONNECTION_STATE_CONNECTED 1 -// Disconnected -#define CONNECTION_STATE_DISCONNECTED 2 -// Reconnecting -#define CONNECTION_STATE_RECONNECTING 3 - - // Status of the path - connected, disconnected, reconnecting - ULONG ConnectionStatus; - #define ISCSI_Path_ConnectionStatus_SIZE sizeof(ULONG) - #define ISCSI_Path_ConnectionStatus_ID 5 - - // Flag set to 1 if TCP offload is supported for this connection, 0 otherwise. - ULONG TCPOffLoadAvailable; - #define ISCSI_Path_TCPOffLoadAvailable_SIZE sizeof(ULONG) - #define ISCSI_Path_TCPOffLoadAvailable_ID 6 - -} ISCSI_Path, *PISCSI_Path; - -#define ISCSI_Path_SIZE (FIELD_OFFSET(ISCSI_Path, TCPOffLoadAvailable) + ISCSI_Path_TCPOffLoadAvailable_SIZE) - -// ISCSI_Supported_LB_Policies - ISCSI_Supported_LB_Policies -// iSCSI Initiator Load Balance Policies supported -#define ISCSI_Supported_LB_PoliciesGuid \ - { 0x749afe4d,0x804d,0x4662, { 0xa6,0x8b,0xdc,0x69,0x66,0x55,0xc7,0x9a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_Supported_LB_Policies_GUID, \ - 0x749afe4d,0x804d,0x4662,0xa6,0x8b,0xdc,0x69,0x66,0x55,0xc7,0x9a); -#endif - - -typedef struct _ISCSI_Supported_LB_Policies -{ - // Id that is unique to this session within this adapter. - ULONGLONG UniqueSessionId; - #define ISCSI_Supported_LB_Policies_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define ISCSI_Supported_LB_Policies_UniqueSessionId_ID 1 - - -// Fail Over Only -#define MSiSCSI_LB_FAILOVER 1 -// Round Robin -#define MSiSCSI_LB_ROUND_ROBIN 2 -// Round Robin with Subset -#define MSiSCSI_LB_ROUND_ROBIN_WITH_SUBSET 3 -// Dynamic Least Queue Depth -#define MSiSCSI_LB_DYN_LEAST_QUEUE_DEPTH 4 -// Weighted Paths -#define MSiSCSI_LB_WEIGHTED_PATHS 5 -// Vendor Specific -#define MSiSCSI_LB_VENDOR_SPECIFIC 6 - - // Load Balance policy supported by the iSCSI Initiator - ULONG LoadBalancePolicy; - #define ISCSI_Supported_LB_Policies_LoadBalancePolicy_SIZE sizeof(ULONG) - #define ISCSI_Supported_LB_Policies_LoadBalancePolicy_ID 2 - - // Number of entries in MSiSCSI_Paths array - ULONG iSCSI_PathCount; - #define ISCSI_Supported_LB_Policies_iSCSI_PathCount_SIZE sizeof(ULONG) - #define ISCSI_Supported_LB_Policies_iSCSI_PathCount_ID 3 - - // Describes iSCSI Initiator Paths - ISCSI_Path iSCSI_Paths[1]; - #define ISCSI_Supported_LB_Policies_iSCSI_Paths_ID 4 - -} ISCSI_Supported_LB_Policies, *PISCSI_Supported_LB_Policies; - -// MSiSCSI_LB_Operations - MSiSCSI_LB_Operations -// Set iSCSI Initiator Load Balance Policies -#define MSiSCSI_LB_OperationsGuid \ - { 0xa7dfe761,0xb6bc,0x4490, { 0x91,0xb0,0xd9,0xcf,0x4a,0x24,0xd3,0x7c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_LB_Operations_GUID, \ - 0xa7dfe761,0xb6bc,0x4490,0x91,0xb0,0xd9,0xcf,0x4a,0x24,0xd3,0x7c); -#endif - -// -// Method id definitions for MSiSCSI_LB_Operations - -// -// SetLoadBalancePolicy instructs the iSCSI Initiator what Load Balance -// policy to use. -// - -#define SetLoadBalancePolicy 10 -typedef struct _SetLoadBalancePolicy_IN -{ - // New Load Balance policy to be set - ISCSI_Supported_LB_Policies LoadBalancePolicies; - #define SetLoadBalancePolicy_IN_LoadBalancePolicies_SIZE sizeof(ISCSI_Supported_LB_Policies) - #define SetLoadBalancePolicy_IN_LoadBalancePolicies_ID 1 - -} SetLoadBalancePolicy_IN, *PSetLoadBalancePolicy_IN; - -#define SetLoadBalancePolicy_IN_SIZE (FIELD_OFFSET(SetLoadBalancePolicy_IN, LoadBalancePolicies) + SetLoadBalancePolicy_IN_LoadBalancePolicies_SIZE) - -typedef struct _SetLoadBalancePolicy_OUT -{ - // Status of the operation - ULONG Status; - #define SetLoadBalancePolicy_OUT_Status_SIZE sizeof(ULONG) - #define SetLoadBalancePolicy_OUT_Status_ID 2 - -} SetLoadBalancePolicy_OUT, *PSetLoadBalancePolicy_OUT; - -#define SetLoadBalancePolicy_OUT_SIZE (FIELD_OFFSET(SetLoadBalancePolicy_OUT, Status) + SetLoadBalancePolicy_OUT_Status_SIZE) - - -// MSiSCSI_QueryLBPolicy - MSiSCSI_QueryLBPolicy -// Query Load Balance policy used by iSCSI Initiator - -// -// MSiSCSI_QueryLBPolicy class is used to query the Initiator about -// the load balance policy that is currently used. -// - -#define MSiSCSI_QueryLBPolicyGuid \ - { 0xe0aecaee,0xb311,0x426f, { 0xb6,0x7a,0x18,0xd5,0xe5,0x5d,0x09,0x96 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_QueryLBPolicy_GUID, \ - 0xe0aecaee,0xb311,0x426f,0xb6,0x7a,0x18,0xd5,0xe5,0x5d,0x09,0x96); -#endif - - -typedef struct _MSiSCSI_QueryLBPolicy -{ - // Id that is globally unique to each instance of each adapter. Using the address of the Adapter Extension is a good idea. - ULONGLONG UniqueAdapterId; - #define MSiSCSI_QueryLBPolicy_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QueryLBPolicy_UniqueAdapterId_ID 1 - - // - ULONG Reserved; - #define MSiSCSI_QueryLBPolicy_Reserved_SIZE sizeof(ULONG) - #define MSiSCSI_QueryLBPolicy_Reserved_ID 2 - - - - // Number of elements in LoadBalancePolicies array - - // Number of elements in LoadBalancePolicies array - ULONG SessionCount; - #define MSiSCSI_QueryLBPolicy_SessionCount_SIZE sizeof(ULONG) - #define MSiSCSI_QueryLBPolicy_SessionCount_ID 3 - - // Load Balance Policy that is currently being used by iSCSI Initiator - one element for each session on the adapter - ISCSI_Supported_LB_Policies LoadBalancePolicies[1]; - #define MSiSCSI_QueryLBPolicy_LoadBalancePolicies_ID 4 - -} MSiSCSI_QueryLBPolicy, *PMSiSCSI_QueryLBPolicy; - -// MSiSCSI_Eventlog - MSiSCSI_Eventlog -// iSCSI Eventlog generation event - -// -// Miniports can fire this event to cause eventlog entries to be -// included in the system eventlog. This is useful as the iscsilog.h -// header has many iSCSI specific eventlog messages that are useful for -// troubleshooting, but can't be fired directly by a miniport. By -// firing this WMI event appropriately a miniport can cause a useful -// eventlog entry to be included in the system eventlog -// - -#define MSiSCSI_EventlogGuid \ - { 0xe6b8552b,0x7c62,0x4c6e, { 0x99,0xeb,0x67,0xce,0x60,0x87,0x89,0x4c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_Eventlog_GUID, \ - 0xe6b8552b,0x7c62,0x4c6e,0x99,0xeb,0x67,0xce,0x60,0x87,0x89,0x4c); -#endif - - -typedef struct _MSiSCSI_Eventlog -{ - // Type of eventlog message - ULONG Type; - #define MSiSCSI_Eventlog_Type_SIZE sizeof(ULONG) - #define MSiSCSI_Eventlog_Type_ID 1 - - // If zero then this event is not logged to system eventlog - ULONG LogToEventlog; - #define MSiSCSI_Eventlog_LogToEventlog_SIZE sizeof(ULONG) - #define MSiSCSI_Eventlog_LogToEventlog_ID 2 - - // Size of Additional Data - ULONG Size; - #define MSiSCSI_Eventlog_Size_SIZE sizeof(ULONG) - #define MSiSCSI_Eventlog_Size_ID 3 - - // Additional data to include in eventlog message, typically iSCSI Header - UCHAR AdditionalData[1]; - #define MSiSCSI_Eventlog_AdditionalData_ID 4 - -} MSiSCSI_Eventlog, *PMSiSCSI_Eventlog; - -// ISCSI_RedirectPortalInfo - ISCSI_RedirectPortalInfo -// iSCSI Redirect Portal Info -#define ISCSI_RedirectPortalInfoGuid \ - { 0xf6004ce6,0x9507,0x4d86, { 0xae,0x1e,0xe9,0xd6,0x4f,0x16,0x6f,0x2f } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_RedirectPortalInfo_GUID, \ - 0xf6004ce6,0x9507,0x4d86,0xae,0x1e,0xe9,0xd6,0x4f,0x16,0x6f,0x2f); -#endif - - -typedef struct _ISCSI_RedirectPortalInfo -{ - // A uniquely generated connection ID. Do not confuse this with CID. - ULONGLONG UniqueConnectionId; - #define ISCSI_RedirectPortalInfo_UniqueConnectionId_SIZE sizeof(ULONGLONG) - #define ISCSI_RedirectPortalInfo_UniqueConnectionId_ID 1 - - // Original Target IP Address given in the login - ISCSI_IP_Address OriginalIPAddr; - #define ISCSI_RedirectPortalInfo_OriginalIPAddr_SIZE sizeof(ISCSI_IP_Address) - #define ISCSI_RedirectPortalInfo_OriginalIPAddr_ID 2 - - // Original Target portal's socket number given in the login - ULONG OriginalPort; - #define ISCSI_RedirectPortalInfo_OriginalPort_SIZE sizeof(ULONG) - #define ISCSI_RedirectPortalInfo_OriginalPort_ID 3 - - // Redirected Target IP Address - ISCSI_IP_Address RedirectedIPAddr; - #define ISCSI_RedirectPortalInfo_RedirectedIPAddr_SIZE sizeof(ISCSI_IP_Address) - #define ISCSI_RedirectPortalInfo_RedirectedIPAddr_ID 4 - - // Redirected Target portal's socket number - ULONG RedirectedPort; - #define ISCSI_RedirectPortalInfo_RedirectedPort_SIZE sizeof(ULONG) - #define ISCSI_RedirectPortalInfo_RedirectedPort_ID 5 - - // TRUE if login was redirected. RedirectedIPAddr and RedirectedPort are valid then. - UCHAR Redirected; - #define ISCSI_RedirectPortalInfo_Redirected_SIZE sizeof(UCHAR) - #define ISCSI_RedirectPortalInfo_Redirected_ID 6 - - // TRUE if the redirection is temporary. FALSE otherwise - UCHAR TemporaryRedirect; - #define ISCSI_RedirectPortalInfo_TemporaryRedirect_SIZE sizeof(UCHAR) - #define ISCSI_RedirectPortalInfo_TemporaryRedirect_ID 7 - -} ISCSI_RedirectPortalInfo, *PISCSI_RedirectPortalInfo; - -#define ISCSI_RedirectPortalInfo_SIZE (FIELD_OFFSET(ISCSI_RedirectPortalInfo, TemporaryRedirect) + ISCSI_RedirectPortalInfo_TemporaryRedirect_SIZE) - -// ISCSI_RedirectSessionInfo - ISCSI_RedirectSessionInfo -// iSCSI Redirect Session Info -#define ISCSI_RedirectSessionInfoGuid \ - { 0xed60bc3f,0x3d56,0x42f0, { 0xb4,0xd0,0x81,0xdd,0x16,0xe2,0x85,0x15 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_RedirectSessionInfo_GUID, \ - 0xed60bc3f,0x3d56,0x42f0,0xb4,0xd0,0x81,0xdd,0x16,0xe2,0x85,0x15); -#endif - - -typedef struct _ISCSI_RedirectSessionInfo -{ - // A uniquely generated session ID, it is the same id returned by the LoginToTarget method. Do not confuse this with ISID or SSID. - ULONGLONG UniqueSessionId; - #define ISCSI_RedirectSessionInfo_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define ISCSI_RedirectSessionInfo_UniqueSessionId_ID 1 - - // Target portal group tag for this Session - ULONG TargetPortalGroupTag; - #define ISCSI_RedirectSessionInfo_TargetPortalGroupTag_SIZE sizeof(ULONG) - #define ISCSI_RedirectSessionInfo_TargetPortalGroupTag_ID 2 - - - - // Number of elements in RedirectPortalList array - - // Number of elements in RedirectPortalList array - ULONG ConnectionCount; - #define ISCSI_RedirectSessionInfo_ConnectionCount_SIZE sizeof(ULONG) - #define ISCSI_RedirectSessionInfo_ConnectionCount_ID 3 - - // Redirect portal info - one element for each connection in the session - ISCSI_RedirectPortalInfo RedirectPortalList[1]; - #define ISCSI_RedirectSessionInfo_RedirectPortalList_ID 4 - -} ISCSI_RedirectSessionInfo, *PISCSI_RedirectSessionInfo; - -// MSiSCSI_RedirectPortalInfoClass - MSiSCSI_RedirectPortalInfoClass -// iScsi Redirect Portal Information Class - -// -// -// This class is recommended. -// -// This class exposes portal information. It provides the original and -// redirected target portal information for an iSCSI Connection. -// -// This class must be registered using PDO instance names with a single instance -// - -#define MSiSCSI_RedirectPortalInfoClassGuid \ - { 0xdaf7f63a,0xf9ea,0x4869, { 0x87,0xe1,0xae,0x8a,0x7c,0x22,0x61,0xe2 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_RedirectPortalInfoClass_GUID, \ - 0xdaf7f63a,0xf9ea,0x4869,0x87,0xe1,0xae,0x8a,0x7c,0x22,0x61,0xe2); -#endif - - -typedef struct _MSiSCSI_RedirectPortalInfoClass -{ - // Id that is globally unique for all instances of iSCSI initiators. - ULONGLONG UniqueAdapterId; - #define MSiSCSI_RedirectPortalInfoClass_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_RedirectPortalInfoClass_UniqueAdapterId_ID 1 - - // Number of elements in RedirectSessionInfo array - ULONG SessionCount; - #define MSiSCSI_RedirectPortalInfoClass_SessionCount_SIZE sizeof(ULONG) - #define MSiSCSI_RedirectPortalInfoClass_SessionCount_ID 2 - - // Variable length array of ISCSI_RedirectSessionInfo. SessionCount specifies the number of elements in the array. NOTE: this is a variable length array. - ISCSI_RedirectSessionInfo RedirectSessionList[1]; - #define MSiSCSI_RedirectPortalInfoClass_RedirectSessionList_ID 3 - -} MSiSCSI_RedirectPortalInfoClass, *PMSiSCSI_RedirectPortalInfoClass; - -// MSiSCSI_ManagementOperations - MSiSCSI_ManagementOperations - - -// -// -// This class is recommended. -// -// iSCSI management applications rely upon this -// class in order to interface with the adapter. Implement one instance -// per miniport instance (adapter). -// -// This class must be registered using PDO instance names with a single instance. -// - -#define MSiSCSI_ManagementOperationsGuid \ - { 0xb8d765f0,0x2d93,0x4da2, { 0x81,0x86,0xa1,0x87,0x62,0x2b,0x43,0x02 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_ManagementOperations_GUID, \ - 0xb8d765f0,0x2d93,0x4da2,0x81,0x86,0xa1,0x87,0x62,0x2b,0x43,0x02); -#endif - -// -// Method id definitions for MSiSCSI_ManagementOperations - -// -// This method is recommended. -// -// Ping will perform ICMP ping requests to the destination address -// and return the number of ping responses received. This is only supported -// by some HBA, use the ping command for the software initiator. -// - -#define PingIPAddress 10 -typedef struct _PingIPAddress_IN -{ - // Number of requests to send - ULONG RequestCount; - #define PingIPAddress_IN_RequestCount_SIZE sizeof(ULONG) - #define PingIPAddress_IN_RequestCount_ID 1 - - // Number of bytes in each request - ULONG RequestSize; - #define PingIPAddress_IN_RequestSize_SIZE sizeof(ULONG) - #define PingIPAddress_IN_RequestSize_ID 2 - - // Number of ms to wait for response - ULONG Timeout; - #define PingIPAddress_IN_Timeout_SIZE sizeof(ULONG) - #define PingIPAddress_IN_Timeout_ID 3 - - // IP address to ping - ISCSI_IP_Address Address; - #define PingIPAddress_IN_Address_SIZE sizeof(ISCSI_IP_Address) - #define PingIPAddress_IN_Address_ID 4 - -} PingIPAddress_IN, *PPingIPAddress_IN; - -#define PingIPAddress_IN_SIZE (FIELD_OFFSET(PingIPAddress_IN, Address) + PingIPAddress_IN_Address_SIZE) - -typedef struct _PingIPAddress_OUT -{ - // Status code resulting from operation - ULONG Status; - #define PingIPAddress_OUT_Status_SIZE sizeof(ULONG) - #define PingIPAddress_OUT_Status_ID 5 - - // Number of responses received - ULONG ResponsesReceived; - #define PingIPAddress_OUT_ResponsesReceived_SIZE sizeof(ULONG) - #define PingIPAddress_OUT_ResponsesReceived_ID 6 - -} PingIPAddress_OUT, *PPingIPAddress_OUT; - -#define PingIPAddress_OUT_SIZE (FIELD_OFFSET(PingIPAddress_OUT, ResponsesReceived) + PingIPAddress_OUT_ResponsesReceived_SIZE) - - -#endif - diff --git a/pub/ddk/iscsiop.h b/pub/ddk/iscsiop.h deleted file mode 100644 index 1fea5f2..0000000 --- a/pub/ddk/iscsiop.h +++ /dev/null @@ -1,1449 +0,0 @@ -#ifndef _iscsiop_h_ -#define _iscsiop_h_ - -// MSiSCSI_Operations - MSiSCSI_Operations - - -//*************************************************************************** -// -// iscsiop.h -// -// Module: iSCSI Discovery api -// -// Purpose: Internal header defining interface between user mode discovery -// api dll and HBA driver miniport. -// -// Copyright (c) 2001 Microsoft Corporation -// -//*************************************************************************** - -#include - - -// -// -// This class is required. -// -// The iSCSI initiator service relies upon this -// class in order to interface with the adapter. Implement one instance -// per miniport instance (adapter). -// -// This class must be registered using PDO instance names with a single instance. -// - -#define MSiSCSI_OperationsGuid \ - { 0xea4d82bf,0x29da,0x4e12, { 0x80,0x0a,0xe5,0x43,0x79,0x64,0x46,0x2c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_Operations_GUID, \ - 0xea4d82bf,0x29da,0x4e12,0x80,0x0a,0xe5,0x43,0x79,0x64,0x46,0x2c); -#endif - -// -// Method id definitions for MSiSCSI_Operations - -// -// This method is required. -// -// SendTargets instructs the adapter to use an existing discovery session -// with the target portal and issue the SendTargets command to it. -// SendTargetsText specifies the value for the SendTargets key in -// the PDU sent to the target. -// - -#define SendTargets 10 -typedef struct _SendTargets_IN -{ - // Unique Session ID on which to do send targets. This is the session ID returned from the LoginToTarget method. - ULONGLONG UniqueSessionId; - #define SendTargets_IN_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define SendTargets_IN_UniqueSessionId_ID 1 - - // SendTargets key text - WCHAR SendTargetsText[223 + 1]; - #define SendTargets_IN_SendTargetsText_ID 2 - -} SendTargets_IN, *PSendTargets_IN; - -typedef struct _SendTargets_OUT -{ - // Status code resulting from operation - ULONG Status; - #define SendTargets_OUT_Status_SIZE sizeof(ULONG) - #define SendTargets_OUT_Status_ID 3 - - // Number of bytes in SendTargets response - ULONG ResponseSize; - #define SendTargets_OUT_ResponseSize_SIZE sizeof(ULONG) - #define SendTargets_OUT_ResponseSize_ID 4 - - // Response to SendTargets in UTF8 characters. NOTE: This field is a variable length array - UCHAR Response[1]; - #define SendTargets_OUT_Response_ID 5 - -} SendTargets_OUT, *PSendTargets_OUT; - - - -// -// This method is required. -// -// LoginTarget instructs the adapter to perform a login to the target -// portal and esatablish a session with the target. -// -// Types of login sessions. -// Discovery - a discovery session is used exclusively for SendTargets -// operations. -// -// Informational - an informational session is a full featured session -// but the miniport should not report the devices on -// the target to the port driver since the devices -// should not be exposed as local devices to Windows. -// Instead a subset of SCSI commands can be executed -// on the devices via other WMI methods. This allows -// applications to gather information about the devices -// without causing the corresponding Windows device -// driver stack to be loaded. -// -// Data - a data session is a full featured session and the miniport -// should report the devices on the target to the port driver. -// In this way the corresponding driver stack will be loaded and -// the device will be available to all applications. -// -// The session id assigned to a session must remain constant for -// the lifetime of a session. Reconnections due to async logout or -// network event should not affect the value of the session id. Also -// the session must be reported to the MSiSCSI_InitiatorSessionInfo -// class. -// -// Data and informational sessions have specific rules related to -// how reconnections should be handled. If a session is disconnected due -// to async logout or a network event then the initiator must periodically -// retry logging back into the session until the session is either -// successfully reconnected or the initiator is called to -// logout of the session. The period between retries is not mandated -// though it is recommended that 5 seconds be a default value. Another -// rule is that the miniport should not immediately call the port -// driver to remove the devices on the target when a session is -// disconnected due to a network event or async logout. If this were to -// happen then the devices would disappear and no longer be available to -// applications. Instead the miniport should maintain the availability -// of the device by queueing requests and faking success for -// INQUIRY and REPORT LUNS commands. It would need to do this for a -// period of time (60 seconds is recommended). If the session is -// reconnected before the end of that period then an application will -// suffer no interruption in its work. If times runs out the miniport -// should report the removal of the devices on the target to the port -// driver. Note that a longer time might mean more requests being queued -// and more system resources used. It is recommended that these value -// be configurable. -// -typedef enum { - // Discovery session is used for SendTargets. - ISCSI_LOGINTARGET_DISCOVERY = 0, - - // Informational session is used for sending Scsi - // Commands and should not cause LUNs to be reported - // to the port driver - ISCSI_LOGINTARGET_INFORMATIONAL = 1, - - // Data session is used for full operations - // to a device and should cause LUNs to be reported - // to the port driver - ISCSI_LOGINTARGET_DATA = 2 - -} LOGINSESSIONTYPE, *PLOGINSESSIONTYPE; - -#define LoginToTarget 30 -typedef struct _LoginToTarget_IN -{ - // Port number corresponding to port in which to initiate the session - ULONG PortNumber; - #define LoginToTarget_IN_PortNumber_SIZE sizeof(ULONG) - #define LoginToTarget_IN_PortNumber_ID 1 - - -// -// Options that affect how login is performed. See ISCSI_LoginOptions -// - - // - ISCSI_LoginOptions LoginOptions; - #define LoginToTarget_IN_LoginOptions_SIZE sizeof(ISCSI_LoginOptions) - #define LoginToTarget_IN_LoginOptions_ID 2 - - // **typedef**Specifies the session type - either discovery, informational or data - ULONG SessionType; - #define LoginToTarget_IN_SessionType_SIZE sizeof(ULONG) - #define LoginToTarget_IN_SessionType_ID 3 - - // Security flags - ULONGLONG SecurityFlags; - #define LoginToTarget_IN_SecurityFlags_SIZE sizeof(ULONGLONG) - #define LoginToTarget_IN_SecurityFlags_ID 4 - - // On target portal to use for initial connection. - ISCSI_TargetPortal TargetPortal; - #define LoginToTarget_IN_TargetPortal_SIZE sizeof(ISCSI_TargetPortal) - #define LoginToTarget_IN_TargetPortal_ID 5 - - // Size in bytes of authentication Username - ULONG UsernameSize; - #define LoginToTarget_IN_UsernameSize_SIZE sizeof(ULONG) - #define LoginToTarget_IN_UsernameSize_ID 6 - - // Size in bytes of authentication Password - ULONG PasswordSize; - #define LoginToTarget_IN_PasswordSize_SIZE sizeof(ULONG) - #define LoginToTarget_IN_PasswordSize_ID 7 - - // Size in bytes of preshared key associated with target ip address - ULONG KeySize; - #define LoginToTarget_IN_KeySize_SIZE sizeof(ULONG) - #define LoginToTarget_IN_KeySize_ID 8 - - // The service will pass an id that is guaranteed to be gloally unique over all initiators for use when connecting to this target. It may be useful as part of the the ISID - USHORT UniqueIdForISID; - #define LoginToTarget_IN_UniqueIdForISID_SIZE sizeof(USHORT) - #define LoginToTarget_IN_UniqueIdForISID_ID 9 - - // If TRUE then this login should be persisted in non-volatile memory. The adapter will then automatically login to the target using the information passed each time the device driver loads. The driver should not attempt to login, just save the information for login later. - BOOLEAN PersistentLogin; - #define LoginToTarget_IN_PersistentLogin_SIZE sizeof(BOOLEAN) - #define LoginToTarget_IN_PersistentLogin_ID 10 - - // The InitiatorNode specifies the iSCSI name of the initiator node to use for the connection. If empty, then the HBA can choose any initiator node - WCHAR InitiatorNode[223 + 1]; - #define LoginToTarget_IN_InitiatorNode_ID 11 - - // The InitiatorAlias specifies the iSCSI alias of the initiator node to use for the connection. - WCHAR InitiatorAlias[255 + 1]; - #define LoginToTarget_IN_InitiatorAlias_ID 12 - - // TargetName specifies the iSCSI target name to which a session should be established. - WCHAR TargetName[223 + 1]; - #define LoginToTarget_IN_TargetName_ID 13 - - // Target mappings. If no mappings are specified then the initiator can use any mappings for the LUNs. If mappings are specified then any LUN on the target that is not specified in the mappings should not be exposed to the port driver. - ISCSI_TargetMapping Mappings; - #define LoginToTarget_IN_Mappings_SIZE sizeof(ISCSI_TargetMapping) - #define LoginToTarget_IN_Mappings_ID 14 - - // **field**Preshared key associated with target ip address. NOTE: This field is a variable length array, the field that follows this field starts immediately after the end of this field subject to appropriate padding. All fields after this are commented out in the header. - UCHAR Key[1]; - #define LoginToTarget_IN_Key_ID 15 - - // Authentication Username, for CHAP this is the CHAP Name (CHAP_N) to use when authenticating the target. NOTE: This field is a variable length array, the field that follows this field starts immediately after the end of this field subject to appropriate padding. -// UCHAR Username[1]; - #define LoginToTarget_IN_Username_ID 16 - - // Authentication Password, for CHAP this is the shared secret to use when generating the respose to the target challange. NOTE: This field is a variable length array. -// UCHAR Password[1]; - #define LoginToTarget_IN_Password_ID 17 - -} LoginToTarget_IN, *PLoginToTarget_IN; - -typedef struct _LoginToTarget_OUT -{ - // Status code resulting from operation - ULONG Status; - #define LoginToTarget_OUT_Status_SIZE sizeof(ULONG) - #define LoginToTarget_OUT_Status_ID 18 - - // Unique Session ID. This ID is used to identify this session in subsqeuent method calls. The unique session ID can never change until the session is logged out. - ULONGLONG UniqueSessionId; - #define LoginToTarget_OUT_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define LoginToTarget_OUT_UniqueSessionId_ID 19 - - // Unique Connection ID - ULONGLONG UniqueConnectionId; - #define LoginToTarget_OUT_UniqueConnectionId_SIZE sizeof(ULONGLONG) - #define LoginToTarget_OUT_UniqueConnectionId_ID 20 - -} LoginToTarget_OUT, *PLoginToTarget_OUT; - -#define LoginToTarget_OUT_SIZE (FIELD_OFFSET(LoginToTarget_OUT, UniqueConnectionId) + LoginToTarget_OUT_UniqueConnectionId_SIZE) - - -// -// This method is required. -// -// This method causes a logout from the target and removal of all LUNs -// exposed on that target. If the session is not connected to the target -// then the driver should stop trying to reconnect. -// - - -#define LogoutFromTarget 31 -typedef struct _LogoutFromTarget_IN -{ - // Unique Session ID. This is the session ID that was returned by the driver when the target was logged in. - ULONGLONG UniqueSessionId; - #define LogoutFromTarget_IN_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define LogoutFromTarget_IN_UniqueSessionId_ID 1 - -} LogoutFromTarget_IN, *PLogoutFromTarget_IN; - -#define LogoutFromTarget_IN_SIZE (FIELD_OFFSET(LogoutFromTarget_IN, UniqueSessionId) + LogoutFromTarget_IN_UniqueSessionId_SIZE) - -typedef struct _LogoutFromTarget_OUT -{ - // Status code resulting from operation - ULONG Status; - #define LogoutFromTarget_OUT_Status_SIZE sizeof(ULONG) - #define LogoutFromTarget_OUT_Status_ID 2 - -} LogoutFromTarget_OUT, *PLogoutFromTarget_OUT; - -#define LogoutFromTarget_OUT_SIZE (FIELD_OFFSET(LogoutFromTarget_OUT, Status) + LogoutFromTarget_OUT_Status_SIZE) - - -// -// This method is required to exist, but the functionality may not be implemented. -// If the functionality is not implemented the driver should return an error -// -// This method causes an additional connection to be established to a target -// over a session -// - - -#define AddConnectionToSession 32 -typedef struct _AddConnectionToSession_IN -{ - // Unique Adapter specific ID. This is the UniqueAdapterId returned by the MSiSCSI_HBAInfo class. - ULONGLONG UniqueAdapterId; - #define AddConnectionToSession_IN_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define AddConnectionToSession_IN_UniqueAdapterId_ID 1 - - // Unique Session ID. This is the unique session id returned when the target was logged in. - ULONGLONG UniqueSessionId; - #define AddConnectionToSession_IN_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define AddConnectionToSession_IN_UniqueSessionId_ID 2 - - // Security flags - ULONGLONG SecurityFlags; - #define AddConnectionToSession_IN_SecurityFlags_SIZE sizeof(ULONGLONG) - #define AddConnectionToSession_IN_SecurityFlags_ID 3 - - // Port number corresponding to port from which to initiate the connection - ULONG PortNumber; - #define AddConnectionToSession_IN_PortNumber_SIZE sizeof(ULONG) - #define AddConnectionToSession_IN_PortNumber_ID 4 - - -// -// Options that affect how login is performed. See ISCSI_LoginOptions -// - - // - ISCSI_LoginOptions LoginOptions; - #define AddConnectionToSession_IN_LoginOptions_SIZE sizeof(ISCSI_LoginOptions) - #define AddConnectionToSession_IN_LoginOptions_ID 5 - - // Target portal to use for additional connection. - ISCSI_TargetPortal TargetPortal; - #define AddConnectionToSession_IN_TargetPortal_SIZE sizeof(ISCSI_TargetPortal) - #define AddConnectionToSession_IN_TargetPortal_ID 6 - - // Size in bytes of authentication Username. - ULONG UsernameSize; - #define AddConnectionToSession_IN_UsernameSize_SIZE sizeof(ULONG) - #define AddConnectionToSession_IN_UsernameSize_ID 7 - - // Size in bytes of authentication Password. - ULONG PasswordSize; - #define AddConnectionToSession_IN_PasswordSize_SIZE sizeof(ULONG) - #define AddConnectionToSession_IN_PasswordSize_ID 8 - - // Size in bytes of preshared key associated with target ip address. - ULONG KeySize; - #define AddConnectionToSession_IN_KeySize_SIZE sizeof(ULONG) - #define AddConnectionToSession_IN_KeySize_ID 9 - - // **fields** Preshared key associated with target ip address. NOTE: This field is a variable length array, the field that follows this field starts immediately after the end of this field subject to appropriate padding. All fields after this are commented out in the header. - UCHAR Key[1]; - #define AddConnectionToSession_IN_Key_ID 10 - - // Authentication Username, for CHAP this is the CHAP_N value to use when authenticating the target. NOTE: This field is a variable length array, the field that follows this field starts immediately after the end of this field subject to appropriate padding. -// UCHAR Username[1]; - #define AddConnectionToSession_IN_Username_ID 11 - - // Authentication Password, for CHAP this is the shared secret to use when generating the respose to the target challange. NOTE: This field is a variable length array. -// UCHAR Password[1]; - #define AddConnectionToSession_IN_Password_ID 12 - -} AddConnectionToSession_IN, *PAddConnectionToSession_IN; - -typedef struct _AddConnectionToSession_OUT -{ - // Status code resulting from operation - ULONG Status; - #define AddConnectionToSession_OUT_Status_SIZE sizeof(ULONG) - #define AddConnectionToSession_OUT_Status_ID 13 - - // Unique Connection ID - ULONGLONG UniqueConnectionId; - #define AddConnectionToSession_OUT_UniqueConnectionId_SIZE sizeof(ULONGLONG) - #define AddConnectionToSession_OUT_UniqueConnectionId_ID 14 - -} AddConnectionToSession_OUT, *PAddConnectionToSession_OUT; - -#define AddConnectionToSession_OUT_SIZE (FIELD_OFFSET(AddConnectionToSession_OUT, UniqueConnectionId) + AddConnectionToSession_OUT_UniqueConnectionId_SIZE) - - -// -// This method is required. -// -// This method will remove a target from the list of persistent logins -// maintained by the adapter. -// - - -#define RemovePersistentLogin 33 -typedef struct _RemovePersistentLogin_IN -{ - // Port number corresponding to port from which to initiate the session - ULONG PortNumber; - #define RemovePersistentLogin_IN_PortNumber_SIZE sizeof(ULONG) - #define RemovePersistentLogin_IN_PortNumber_ID 1 - - // TargetName specifies the iSCSI target name which should be removed. - WCHAR TargetName[223 + 1]; - #define RemovePersistentLogin_IN_TargetName_ID 2 - - // Target portal. If an empty target portal is specified then all persistent logins to this target name for all portals are removed. - ISCSI_TargetPortal TargetPortal; - #define RemovePersistentLogin_IN_TargetPortal_SIZE sizeof(ISCSI_TargetPortal) - #define RemovePersistentLogin_IN_TargetPortal_ID 3 - -} RemovePersistentLogin_IN, *PRemovePersistentLogin_IN; - -#define RemovePersistentLogin_IN_SIZE (FIELD_OFFSET(RemovePersistentLogin_IN, TargetPortal) + RemovePersistentLogin_IN_TargetPortal_SIZE) - -typedef struct _RemovePersistentLogin_OUT -{ - // Status code resulting from operation - ULONG Status; - #define RemovePersistentLogin_OUT_Status_SIZE sizeof(ULONG) - #define RemovePersistentLogin_OUT_Status_ID 4 - -} RemovePersistentLogin_OUT, *PRemovePersistentLogin_OUT; - -#define RemovePersistentLogin_OUT_SIZE (FIELD_OFFSET(RemovePersistentLogin_OUT, Status) + RemovePersistentLogin_OUT_Status_SIZE) - - -// -// This method is required. -// -// This method will remove a connection from a session. -// Note that it is specifically disallowed to remove the last -// connection from a session, use LogoutIScsiTarget instead -// - - -#define RemoveConnectionFromSession 34 -typedef struct _RemoveConnectionFromSession_IN -{ - // Unique Session ID - ULONGLONG UniqueSessionId; - #define RemoveConnectionFromSession_IN_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define RemoveConnectionFromSession_IN_UniqueSessionId_ID 1 - - // Unique Connection ID - ULONGLONG UniqueConnectionId; - #define RemoveConnectionFromSession_IN_UniqueConnectionId_SIZE sizeof(ULONGLONG) - #define RemoveConnectionFromSession_IN_UniqueConnectionId_ID 2 - -} RemoveConnectionFromSession_IN, *PRemoveConnectionFromSession_IN; - -#define RemoveConnectionFromSession_IN_SIZE (FIELD_OFFSET(RemoveConnectionFromSession_IN, UniqueConnectionId) + RemoveConnectionFromSession_IN_UniqueConnectionId_SIZE) - -typedef struct _RemoveConnectionFromSession_OUT -{ - // Status code resulting from operation - ULONG Status; - #define RemoveConnectionFromSession_OUT_Status_SIZE sizeof(ULONG) - #define RemoveConnectionFromSession_OUT_Status_ID 3 - -} RemoveConnectionFromSession_OUT, *PRemoveConnectionFromSession_OUT; - -#define RemoveConnectionFromSession_OUT_SIZE (FIELD_OFFSET(RemoveConnectionFromSession_OUT, Status) + RemoveConnectionFromSession_OUT_Status_SIZE) - - -// -// This method is required. -// -// This method causes a SCSI INQUIRY CDB to be sent to a target. The method -// should return success if the SCSI request succeeded. If the SCSI request -// failed the Status returned should be ISDSC_SCSI_REQUEST_FAILED and the -// ScsiStatus and SenseBuffer fields returned. -// - - -#define ScsiInquiry 50 -typedef struct _ScsiInquiry_IN -{ - // Unique Session ID - ULONGLONG UniqueSessionId; - #define ScsiInquiry_IN_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define ScsiInquiry_IN_UniqueSessionId_ID 1 - - // Logical unit to which to send INQUIRY - ULONGLONG Lun; - #define ScsiInquiry_IN_Lun_SIZE sizeof(ULONGLONG) - #define ScsiInquiry_IN_Lun_ID 2 - - // Flags to use for inquiry - UCHAR InquiryFlags; - #define ScsiInquiry_IN_InquiryFlags_SIZE sizeof(UCHAR) - #define ScsiInquiry_IN_InquiryFlags_ID 3 - - // Page code - UCHAR PageCode; - #define ScsiInquiry_IN_PageCode_SIZE sizeof(UCHAR) - #define ScsiInquiry_IN_PageCode_ID 4 - -} ScsiInquiry_IN, *PScsiInquiry_IN; - -#define ScsiInquiry_IN_SIZE (FIELD_OFFSET(ScsiInquiry_IN, PageCode) + ScsiInquiry_IN_PageCode_SIZE) - -typedef struct _ScsiInquiry_OUT -{ - // Status code resulting from operation - ULONG Status; - #define ScsiInquiry_OUT_Status_SIZE sizeof(ULONG) - #define ScsiInquiry_OUT_Status_ID 5 - - // Size of the response buffer in bytes - ULONG ResponseBufferSize; - #define ScsiInquiry_OUT_ResponseBufferSize_SIZE sizeof(ULONG) - #define ScsiInquiry_OUT_ResponseBufferSize_ID 6 - - // SCSI Status result - UCHAR ScsiStatus; - #define ScsiInquiry_OUT_ScsiStatus_SIZE sizeof(UCHAR) - #define ScsiInquiry_OUT_ScsiStatus_ID 7 - - // Sense buffer returned if SCSI error occured - UCHAR SenseBuffer[18]; - #define ScsiInquiry_OUT_SenseBuffer_SIZE sizeof(UCHAR[18]) - #define ScsiInquiry_OUT_SenseBuffer_ID 8 - - // Response to the SCSI CDB. NOTE: This field is a variable length array. - UCHAR ResponseBuffer[1]; - #define ScsiInquiry_OUT_ResponseBuffer_ID 9 - -} ScsiInquiry_OUT, *PScsiInquiry_OUT; - - -// -// This method is required. -// -// This method causes a READ CAPACITY CDB to be sent to a target. The method -// should return success if the SCSI request succeeded. If the SCSI request -// failed the Status returned should be ISDSC_SCSI_REQUEST_FAILED and the -// ScsiStatus and SenseBuffer fields returned. -// - - -#define ScsiReadCapacity 51 -typedef struct _ScsiReadCapacity_IN -{ - // Unique Session ID - ULONGLONG UniqueSessionId; - #define ScsiReadCapacity_IN_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define ScsiReadCapacity_IN_UniqueSessionId_ID 1 - - // Logical unit to which to send READ CAPACITY - ULONGLONG Lun; - #define ScsiReadCapacity_IN_Lun_SIZE sizeof(ULONGLONG) - #define ScsiReadCapacity_IN_Lun_ID 2 - -} ScsiReadCapacity_IN, *PScsiReadCapacity_IN; - -#define ScsiReadCapacity_IN_SIZE (FIELD_OFFSET(ScsiReadCapacity_IN, Lun) + ScsiReadCapacity_IN_Lun_SIZE) - -typedef struct _ScsiReadCapacity_OUT -{ - // Status code resulting from operation - ULONG Status; - #define ScsiReadCapacity_OUT_Status_SIZE sizeof(ULONG) - #define ScsiReadCapacity_OUT_Status_ID 3 - - // Size of the response buffer in bytes - ULONG ResponseBufferSize; - #define ScsiReadCapacity_OUT_ResponseBufferSize_SIZE sizeof(ULONG) - #define ScsiReadCapacity_OUT_ResponseBufferSize_ID 4 - - // SCSI Status result - UCHAR ScsiStatus; - #define ScsiReadCapacity_OUT_ScsiStatus_SIZE sizeof(UCHAR) - #define ScsiReadCapacity_OUT_ScsiStatus_ID 5 - - // Sense buffer returned on SCSI error - UCHAR SenseBuffer[18]; - #define ScsiReadCapacity_OUT_SenseBuffer_SIZE sizeof(UCHAR[18]) - #define ScsiReadCapacity_OUT_SenseBuffer_ID 6 - - // Response to the SCSI CDB. NOTE: This field is a variable length array. - UCHAR ResponseBuffer[1]; - #define ScsiReadCapacity_OUT_ResponseBuffer_ID 7 - -} ScsiReadCapacity_OUT, *PScsiReadCapacity_OUT; - - -// -// This method is required. -// -// This method causes a REPORT LUNS CDB to be sent to a target. The method -// should return success if the SCSI request succeeded. If the SCSI request -// failed the Status returned should be ISDSC_SCSI_REQUEST_FAILED and the -// ScsiStatus and SenseBuffer fields returned. -// - - -#define ScsiReportLuns 52 -typedef struct _ScsiReportLuns_IN -{ - // Unique Session ID - ULONGLONG UniqueSessionId; - #define ScsiReportLuns_IN_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define ScsiReportLuns_IN_UniqueSessionId_ID 1 - -} ScsiReportLuns_IN, *PScsiReportLuns_IN; - -#define ScsiReportLuns_IN_SIZE (FIELD_OFFSET(ScsiReportLuns_IN, UniqueSessionId) + ScsiReportLuns_IN_UniqueSessionId_SIZE) - -typedef struct _ScsiReportLuns_OUT -{ - // Status code resulting from operation - ULONG Status; - #define ScsiReportLuns_OUT_Status_SIZE sizeof(ULONG) - #define ScsiReportLuns_OUT_Status_ID 2 - - // Size of the response buffer in bytes - ULONG ResponseBufferSize; - #define ScsiReportLuns_OUT_ResponseBufferSize_SIZE sizeof(ULONG) - #define ScsiReportLuns_OUT_ResponseBufferSize_ID 3 - - // SCSI Status result - UCHAR ScsiStatus; - #define ScsiReportLuns_OUT_ScsiStatus_SIZE sizeof(UCHAR) - #define ScsiReportLuns_OUT_ScsiStatus_ID 4 - - // Sense buffer returned on SCSI error - UCHAR SenseBuffer[18]; - #define ScsiReportLuns_OUT_SenseBuffer_SIZE sizeof(UCHAR[18]) - #define ScsiReportLuns_OUT_SenseBuffer_ID 5 - - // Response to the SCSI CDB. NOTE: This field is a variable length array. - UCHAR ResponseBuffer[1]; - #define ScsiReportLuns_OUT_ResponseBuffer_ID 6 - -} ScsiReportLuns_OUT, *PScsiReportLuns_OUT; - - -// -// This method is required. -// -// This method establishes a CHAP shared secret that is assigned to -// this initiator and should be used when verifying the CHAP response -// to a challange sent by the initiator. Note that the shared secret -// that is used to generate the CHAP response to a target's challange -// is passed in the LoginToTarget method -// - - -#define SetCHAPSharedSecret 71 -typedef struct _SetCHAPSharedSecret_IN -{ - // Size of Chap shared secret in bytes - ULONG SharedSecretSize; - #define SetCHAPSharedSecret_IN_SharedSecretSize_SIZE sizeof(ULONG) - #define SetCHAPSharedSecret_IN_SharedSecretSize_ID 1 - - // CHAP shared secret. NOTE: This field is a variable length array. - UCHAR SharedSecret[1]; - #define SetCHAPSharedSecret_IN_SharedSecret_ID 2 - -} SetCHAPSharedSecret_IN, *PSetCHAPSharedSecret_IN; - -typedef struct _SetCHAPSharedSecret_OUT -{ - // Status code resulting from operation - ULONG Status; - #define SetCHAPSharedSecret_OUT_Status_SIZE sizeof(ULONG) - #define SetCHAPSharedSecret_OUT_Status_ID 3 - -} SetCHAPSharedSecret_OUT, *PSetCHAPSharedSecret_OUT; - -#define SetCHAPSharedSecret_OUT_SIZE (FIELD_OFFSET(SetCHAPSharedSecret_OUT, Status) + SetCHAPSharedSecret_OUT_Status_SIZE) - - -// -// This method is required. -// -// This method establishes a RADIUS shared secret that is assigned to -// this initiator and should be used when authenticating oneself -// to the RADIUS server. -// - - -#define SetRADIUSSharedSecret 72 -typedef struct _SetRADIUSSharedSecret_IN -{ - // Size of RADIUS shared secret in bytes - ULONG SharedSecretSize; - #define SetRADIUSSharedSecret_IN_SharedSecretSize_SIZE sizeof(ULONG) - #define SetRADIUSSharedSecret_IN_SharedSecretSize_ID 1 - - // RADIUS shared secret. NOTE: This field is a variable length array. - UCHAR SharedSecret[1]; - #define SetRADIUSSharedSecret_IN_SharedSecret_ID 2 - -} SetRADIUSSharedSecret_IN, *PSetRADIUSSharedSecret_IN; - -typedef struct _SetRADIUSSharedSecret_OUT -{ - // Status code resulting from operation - ULONG Status; - #define SetRADIUSSharedSecret_OUT_Status_SIZE sizeof(ULONG) - #define SetRADIUSSharedSecret_OUT_Status_ID 3 - -} SetRADIUSSharedSecret_OUT, *PSetRADIUSSharedSecret_OUT; - -#define SetRADIUSSharedSecret_OUT_SIZE (FIELD_OFFSET(SetRADIUSSharedSecret_OUT, Status) + SetRADIUSSharedSecret_OUT_Status_SIZE) - - -// -// This method is optional and does not need to be implemented. -// -// This method informs the initiator that an initiator node name is no -// longer in use. -// - - -#define DeleteInitiatorNodeName 91 -typedef struct _DeleteInitiatorNodeName_IN -{ - // Initiator name that is deleted. - WCHAR DeletedInitiatorName[223 + 1]; - #define DeleteInitiatorNodeName_IN_DeletedInitiatorName_ID 1 - -} DeleteInitiatorNodeName_IN, *PDeleteInitiatorNodeName_IN; - -typedef struct _DeleteInitiatorNodeName_OUT -{ - // Status code resulting from operation - ULONG Status; - #define DeleteInitiatorNodeName_OUT_Status_SIZE sizeof(ULONG) - #define DeleteInitiatorNodeName_OUT_Status_ID 2 - -} DeleteInitiatorNodeName_OUT, *PDeleteInitiatorNodeName_OUT; - -#define DeleteInitiatorNodeName_OUT_SIZE (FIELD_OFFSET(DeleteInitiatorNodeName_OUT, Status) + DeleteInitiatorNodeName_OUT_Status_SIZE) - - -// -// This method is optional and does not need to be implemented. -// -// This method informs the initiator that a new initiator node name is -// begin to be in use// - - -#define SetInitiatorNodeName 92 -typedef struct _SetInitiatorNodeName_IN -{ - // New initiator name. - WCHAR CreatedInitiatorName[223 + 1]; - #define SetInitiatorNodeName_IN_CreatedInitiatorName_ID 1 - -} SetInitiatorNodeName_IN, *PSetInitiatorNodeName_IN; - -typedef struct _SetInitiatorNodeName_OUT -{ - // Status code resulting from operation - ULONG Status; - #define SetInitiatorNodeName_OUT_Status_SIZE sizeof(ULONG) - #define SetInitiatorNodeName_OUT_Status_ID 2 - -} SetInitiatorNodeName_OUT, *PSetInitiatorNodeName_OUT; - -#define SetInitiatorNodeName_OUT_SIZE (FIELD_OFFSET(SetInitiatorNodeName_OUT, Status) + SetInitiatorNodeName_OUT_Status_SIZE) - - -// -// This method is optional and does not need to be implemented. -// -// This method adds an iSNS server to the list of iSNS servers the HBA -// should manage -// - - -#define AddiSNSServer 101 -typedef struct _AddiSNSServer_IN -{ - // iSNS Server Name - WCHAR iSNSServerName[223 + 1]; - #define AddiSNSServer_IN_iSNSServerName_ID 1 - -} AddiSNSServer_IN, *PAddiSNSServer_IN; - -typedef struct _AddiSNSServer_OUT -{ - // Status code resulting from operation - ULONG Status; - #define AddiSNSServer_OUT_Status_SIZE sizeof(ULONG) - #define AddiSNSServer_OUT_Status_ID 2 - -} AddiSNSServer_OUT, *PAddiSNSServer_OUT; - -#define AddiSNSServer_OUT_SIZE (FIELD_OFFSET(AddiSNSServer_OUT, Status) + AddiSNSServer_OUT_Status_SIZE) - - -// -// This method is optional and does not need to be implemented. -// -// This method removes an iSNS server from the list of iSNS servers the HBA -// should manage -// - - -#define RemoveiSNSServer 102 -typedef struct _RemoveiSNSServer_IN -{ - // iSNS Server Name - WCHAR iSNSServerName[223 + 1]; - #define RemoveiSNSServer_IN_iSNSServerName_ID 1 - -} RemoveiSNSServer_IN, *PRemoveiSNSServer_IN; - -typedef struct _RemoveiSNSServer_OUT -{ - // Status code resulting from operation - ULONG Status; - #define RemoveiSNSServer_OUT_Status_SIZE sizeof(ULONG) - #define RemoveiSNSServer_OUT_Status_ID 2 - -} RemoveiSNSServer_OUT, *PRemoveiSNSServer_OUT; - -#define RemoveiSNSServer_OUT_SIZE (FIELD_OFFSET(RemoveiSNSServer_OUT, Status) + RemoveiSNSServer_OUT_Status_SIZE) - - -// -// This method is optional and does not need to be implemented. -// -// This method adds a RADIUS server to the list of RADIUS servers the initiator/HBA -// should manage -// - - -#define AddRADIUSServer 103 -typedef struct _AddRADIUSServer_IN -{ - // RADIUS Server Address - ISCSI_IP_Address RADIUSIPAddress; - #define AddRADIUSServer_IN_RADIUSIPAddress_SIZE sizeof(ISCSI_IP_Address) - #define AddRADIUSServer_IN_RADIUSIPAddress_ID 1 - -} AddRADIUSServer_IN, *PAddRADIUSServer_IN; - -#define AddRADIUSServer_IN_SIZE (FIELD_OFFSET(AddRADIUSServer_IN, RADIUSIPAddress) + AddRADIUSServer_IN_RADIUSIPAddress_SIZE) - -typedef struct _AddRADIUSServer_OUT -{ - // Status code resulting from operation - ULONG Status; - #define AddRADIUSServer_OUT_Status_SIZE sizeof(ULONG) - #define AddRADIUSServer_OUT_Status_ID 2 - -} AddRADIUSServer_OUT, *PAddRADIUSServer_OUT; - -#define AddRADIUSServer_OUT_SIZE (FIELD_OFFSET(AddRADIUSServer_OUT, Status) + AddRADIUSServer_OUT_Status_SIZE) - - -// -// This method is optional and does not need to be implemented. -// -// This method removes a RADIUS server from the list of RADIUS servers the initiator/HBA -// should manage -// - - -#define RemoveRADIUSServer 104 -typedef struct _RemoveRADIUSServer_IN -{ - // RADIUS Server Address - ISCSI_IP_Address RADIUSIPAddress; - #define RemoveRADIUSServer_IN_RADIUSIPAddress_SIZE sizeof(ISCSI_IP_Address) - #define RemoveRADIUSServer_IN_RADIUSIPAddress_ID 1 - -} RemoveRADIUSServer_IN, *PRemoveRADIUSServer_IN; - -#define RemoveRADIUSServer_IN_SIZE (FIELD_OFFSET(RemoveRADIUSServer_IN, RADIUSIPAddress) + RemoveRADIUSServer_IN_RADIUSIPAddress_SIZE) - -typedef struct _RemoveRADIUSServer_OUT -{ - // Status code resulting from operation - ULONG Status; - #define RemoveRADIUSServer_OUT_Status_SIZE sizeof(ULONG) - #define RemoveRADIUSServer_OUT_Status_ID 2 - -} RemoveRADIUSServer_OUT, *PRemoveRADIUSServer_OUT; - -#define RemoveRADIUSServer_OUT_SIZE (FIELD_OFFSET(RemoveRADIUSServer_OUT, Status) + RemoveRADIUSServer_OUT_Status_SIZE) - - -// ISCSI_Persistent_Login - ISCSI_Persistent_Login -// Persistent Target login -#define ISCSI_Persistent_LoginGuid \ - { 0x1ac62a5d,0xa418,0x4c15, { 0x96,0xbd,0x2c,0x3a,0x9d,0xb8,0xc8,0xca } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ISCSI_Persistent_Login_GUID, \ - 0x1ac62a5d,0xa418,0x4c15,0x96,0xbd,0x2c,0x3a,0x9d,0xb8,0xc8,0xca); -#endif - - -typedef struct _ISCSI_Persistent_Login -{ - // Name of the target for persistent login - WCHAR TargetName[223 + 1]; - #define ISCSI_Persistent_Login_TargetName_ID 1 - - // Security flags - ULONGLONG SecurityFlags; - #define ISCSI_Persistent_Login_SecurityFlags_SIZE sizeof(ULONGLONG) - #define ISCSI_Persistent_Login_SecurityFlags_ID 2 - - // Port number on which to perform the login - ULONG InitiatorPortNumber; - #define ISCSI_Persistent_Login_InitiatorPortNumber_SIZE sizeof(ULONG) - #define ISCSI_Persistent_Login_InitiatorPortNumber_ID 3 - - // Number of bytes in username - ULONG UsernameSize; - #define ISCSI_Persistent_Login_UsernameSize_SIZE sizeof(ULONG) - #define ISCSI_Persistent_Login_UsernameSize_ID 4 - - // TRUE if informational session - BOOLEAN IsInformationalSession; - #define ISCSI_Persistent_Login_IsInformationalSession_SIZE sizeof(BOOLEAN) - #define ISCSI_Persistent_Login_IsInformationalSession_ID 5 - - // ISID that the persistent login will use for login - USHORT UniqueIdForISID; - #define ISCSI_Persistent_Login_UniqueIdForISID_SIZE sizeof(USHORT) - #define ISCSI_Persistent_Login_UniqueIdForISID_ID 6 - - // Portal to use for initial connection - ISCSI_TargetPortal TargetPortal; - #define ISCSI_Persistent_Login_TargetPortal_SIZE sizeof(ISCSI_TargetPortal) - #define ISCSI_Persistent_Login_TargetPortal_ID 7 - - // Login options - ISCSI_LoginOptions LoginOptions; - #define ISCSI_Persistent_Login_LoginOptions_SIZE sizeof(ISCSI_LoginOptions) - #define ISCSI_Persistent_Login_LoginOptions_ID 8 - - // Target mappings - ISCSI_TargetMapping TargetMapping; - #define ISCSI_Persistent_Login_TargetMapping_SIZE sizeof(ISCSI_TargetMapping) - #define ISCSI_Persistent_Login_TargetMapping_ID 9 - - // Authentication Username, for CHAP this is the CHAP Name (CHAP_N) when authenticating the target. NOTE: This field is a variable length array. - UCHAR Username[1]; - #define ISCSI_Persistent_Login_Username_ID 10 - -} ISCSI_Persistent_Login, *PISCSI_Persistent_Login; - -// MSiSCSI_PersistentLogins - MSiSCSI_PersistentLogins - -// -// This class is required. -// -// This class returns the list of persistent target logins. A persistent -// target login is one where the initiator must login to the -// target immediately upon loading so that the device is available -// early in boot -// - -#define MSiSCSI_PersistentLoginsGuid \ - { 0x420512d9,0x0537,0x4c67, { 0xa7,0x79,0x84,0xba,0x7b,0x29,0xce,0x9f } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_PersistentLogins_GUID, \ - 0x420512d9,0x0537,0x4c67,0xa7,0x79,0x84,0xba,0x7b,0x29,0xce,0x9f); -#endif - - -typedef struct _MSiSCSI_PersistentLogins -{ - // Number of persistent logins - ULONG PersistentLoginCount; - #define MSiSCSI_PersistentLogins_PersistentLoginCount_SIZE sizeof(ULONG) - #define MSiSCSI_PersistentLogins_PersistentLoginCount_ID 1 - - // Reserved - ULONG Reserved; - #define MSiSCSI_PersistentLogins_Reserved_SIZE sizeof(ULONG) - #define MSiSCSI_PersistentLogins_Reserved_ID 2 - - // Array of PersistentLoginCount ISCSI_Persistent_Login structures. NOTE: This field is a variable length array. - ISCSI_Persistent_Login PersistentLogins[1]; - #define MSiSCSI_PersistentLogins_PersistentLogins_ID 3 - -} MSiSCSI_PersistentLogins, *PMSiSCSI_PersistentLogins; - -// MSiSCSI_TargetMappings - MSiSCSI_TargetMappings -// Target mappings for iSCSI LUNs - -// -// This class is required. -// -// This class returns the list of current OS mappings for iSCSI LUNs -// The iSCSI initiator service relies upon this -// class in order to interface with your HBA. Implement one instance -// per adapter. This class must be registered using PDO -// instance names. -// - -#define MSiSCSI_TargetMappingsGuid \ - { 0x41646815,0x7524,0x4bc0, { 0x90,0x4a,0xcd,0x7d,0x51,0x0e,0xac,0x02 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_TargetMappings_GUID, \ - 0x41646815,0x7524,0x4bc0,0x90,0x4a,0xcd,0x7d,0x51,0x0e,0xac,0x02); -#endif - - -typedef struct _MSiSCSI_TargetMappings -{ - // Id that is globally unique to each instance of each adapter. This should be the value returned by the MSiSCSI_HBAInformation class. - ULONGLONG UniqueAdapterId; - #define MSiSCSI_TargetMappings_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_TargetMappings_UniqueAdapterId_ID 1 - - // Number of target mappings - ULONG TargetMappingCount; - #define MSiSCSI_TargetMappings_TargetMappingCount_SIZE sizeof(ULONG) - #define MSiSCSI_TargetMappings_TargetMappingCount_ID 2 - - // Reserved - ULONG Reserved; - #define MSiSCSI_TargetMappings_Reserved_SIZE sizeof(ULONG) - #define MSiSCSI_TargetMappings_Reserved_ID 3 - - // Array of TargetMappingCount ISCSI_TargetMapping structures. NOTE: This field is a variable length array. - ISCSI_TargetMapping TargetMappings[1]; - #define MSiSCSI_TargetMappings_TargetMappings_ID 4 - -} MSiSCSI_TargetMappings, *PMSiSCSI_TargetMappings; - -// MSiSCSI_LUNMappingInformation - MSiSCSI_LUNMappingInformation -// LUN Mapping Information - -// -// This class is required. -// -// It must be implemented using PDO instance names by the PDO device object -// -// This class exposes the OS SCSI address information for a particular LUN. -// The SCSI address information must be consistent with the information returned -// by the MSIScsi_TargetMappings class and the information reported to the port -// driver. The class must be implemented on the PDO device object so that there -// will be one instance for each device created by the adapter and named by the -// PDO name for the created device and not the adapter -// - -#define MSiSCSI_LUNMappingInformationGuid \ - { 0x7bb02370,0xb8ae,0x4d29, { 0x88,0xde,0x76,0x95,0x1d,0x32,0x45,0xba } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_LUNMappingInformation_GUID, \ - 0x7bb02370,0xb8ae,0x4d29,0x88,0xde,0x76,0x95,0x1d,0x32,0x45,0xba); -#endif - - -typedef struct _MSiSCSI_LUNMappingInformation -{ - // Id that is globally unique to each instance of each adapter. Using the address of the Adapter Extension is a good idea. - ULONGLONG UniqueAdapterId; - #define MSiSCSI_LUNMappingInformation_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_LUNMappingInformation_UniqueAdapterId_ID 1 - - // Id that is unique to this session within this adapter. This should be the same session id as the one assigned when the session was logged in. - ULONGLONG UniqueSessionId; - #define MSiSCSI_LUNMappingInformation_UniqueSessionId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_LUNMappingInformation_UniqueSessionId_ID 2 - - // OS Bus Number - ULONG OSBus; - #define MSiSCSI_LUNMappingInformation_OSBus_SIZE sizeof(ULONG) - #define MSiSCSI_LUNMappingInformation_OSBus_ID 3 - - // OS Target Number - ULONG OSTarget; - #define MSiSCSI_LUNMappingInformation_OSTarget_SIZE sizeof(ULONG) - #define MSiSCSI_LUNMappingInformation_OSTarget_ID 4 - - // OS LUN Number - ULONG OSLUN; - #define MSiSCSI_LUNMappingInformation_OSLUN_SIZE sizeof(ULONG) - #define MSiSCSI_LUNMappingInformation_OSLUN_ID 5 - -} MSiSCSI_LUNMappingInformation, *PMSiSCSI_LUNMappingInformation; - -#define MSiSCSI_LUNMappingInformation_SIZE (FIELD_OFFSET(MSiSCSI_LUNMappingInformation, OSLUN) + MSiSCSI_LUNMappingInformation_OSLUN_SIZE) - -// MSiSCSI_SecurityConfigOperations - MSiSCSI_SecurityConfigOperations - -// -// This class is required if your adapter supports IPSEC or CHAP. -// -// An adapter must support the appropriate methods if it implements -// security including IKE (using preshared keys) and/or a non volatile -// cache for IPSEC preshared keys and iSCSI authentication credentials -// (ie, username and passwords). The adapter should also indicate that -// that the cache is implemented by setting the appropriate flags in the -// MSiSCSI_HBAInformation class -// -// This class must be registered using PDO instance names with a single instance -// - -#define MSiSCSI_SecurityConfigOperationsGuid \ - { 0x391f3325,0x0ba3,0x4083, { 0xa8,0x61,0xcf,0x4f,0x6f,0x97,0xa5,0x27 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_SecurityConfigOperations_GUID, \ - 0x391f3325,0x0ba3,0x4083,0xa8,0x61,0xcf,0x4f,0x6f,0x97,0xa5,0x27); -#endif - -// -// Method id definitions for MSiSCSI_SecurityConfigOperations - -// -// This method is required if the initiator supports IKE. -// -// SetPresharedKeyForId allows a management application to configure an -// adapter with a preshared key that is associated with an id. The -// id corresponds to the contents of the identification payload in the -// IKE phase 1 aggressive or main mode exchange. The -// key can be associated with an ip address for use in the IKE phase 1 -// main mode exchange. The adapter should maintain the key in its non -// volatile storage if it is available. The adapter should also maintain -// the key in its working memory so that it is available for IKE phase 1 -// negotiation. If NVRAM is not available then the initiator service will -// maintain the key on behalf of the adapter. -// -// -// -// IKE Identification payload types (from RFC 2407) -// -#define ID_IPV4_ADDR 1 -#define ID_FQDN 2 -#define ID_USER_FQDN 3 -#define ID_IPV6_ADDR 5 - - -#define SetPresharedKeyForId 1 -typedef struct _SetPresharedKeyForId_IN -{ - // Specific port number or 0xffffffff for all ports - ULONG PortNumber; - #define SetPresharedKeyForId_IN_PortNumber_SIZE sizeof(ULONG) - #define SetPresharedKeyForId_IN_PortNumber_ID 1 - - // - ULONGLONG SecurityFlags; - #define SetPresharedKeyForId_IN_SecurityFlags_SIZE sizeof(ULONGLONG) - #define SetPresharedKeyForId_IN_SecurityFlags_ID 2 - - // Type of Id to associate with the preshared key - UCHAR IdType; - #define SetPresharedKeyForId_IN_IdType_SIZE sizeof(UCHAR) - #define SetPresharedKeyForId_IN_IdType_ID 3 - - // Size in bytes of the Id - ULONG IdSize; - #define SetPresharedKeyForId_IN_IdSize_SIZE sizeof(ULONG) - #define SetPresharedKeyForId_IN_IdSize_ID 4 - - // Size in bytes of the Key - ULONG KeySize; - #define SetPresharedKeyForId_IN_KeySize_SIZE sizeof(ULONG) - #define SetPresharedKeyForId_IN_KeySize_ID 5 - - // **fields** Id to associate with the key. NOTE: This field is a variable length array, the field that follows this field starts immediately after the end of this field subject to appropriate padding. All fields after this are commented out in the header. - UCHAR Id[1]; - #define SetPresharedKeyForId_IN_Id_ID 6 - - // Key to associate with the id. NOTE: This field is a variable length array. -// UCHAR Key[1]; - #define SetPresharedKeyForId_IN_Key_ID 7 - -} SetPresharedKeyForId_IN, *PSetPresharedKeyForId_IN; - -typedef struct _SetPresharedKeyForId_OUT -{ - // Status code resulting from operation - ULONG Status; - #define SetPresharedKeyForId_OUT_Status_SIZE sizeof(ULONG) - #define SetPresharedKeyForId_OUT_Status_ID 8 - -} SetPresharedKeyForId_OUT, *PSetPresharedKeyForId_OUT; - -#define SetPresharedKeyForId_OUT_SIZE (FIELD_OFFSET(SetPresharedKeyForId_OUT, Status) + SetPresharedKeyForId_OUT_Status_SIZE) - - -// -// This method is required if the initiator supports IKE. -// -// GetPresharedKeyForId allows a management application to determine if -// a particular IKE identification payload is configured with a preshared -// key -// - -#define GetPresharedKeyForId 2 -typedef struct _GetPresharedKeyForId_IN -{ - // - ULONG PortNumber; - #define GetPresharedKeyForId_IN_PortNumber_SIZE sizeof(ULONG) - #define GetPresharedKeyForId_IN_PortNumber_ID 1 - - // Type of Id to associate with the preshared key - UCHAR IdType; - #define GetPresharedKeyForId_IN_IdType_SIZE sizeof(UCHAR) - #define GetPresharedKeyForId_IN_IdType_ID 2 - - // Size in bytes of the Id - ULONG IdSize; - #define GetPresharedKeyForId_IN_IdSize_SIZE sizeof(ULONG) - #define GetPresharedKeyForId_IN_IdSize_ID 3 - - // Id to associate with the key. NOTE: This field is a variable length array. - UCHAR Id[1]; - #define GetPresharedKeyForId_IN_Id_ID 4 - -} GetPresharedKeyForId_IN, *PGetPresharedKeyForId_IN; - -typedef struct _GetPresharedKeyForId_OUT -{ - // Status code resulting from operation - ULONG Status; - #define GetPresharedKeyForId_OUT_Status_SIZE sizeof(ULONG) - #define GetPresharedKeyForId_OUT_Status_ID 5 - - // - ULONGLONG SecurityFlags; - #define GetPresharedKeyForId_OUT_SecurityFlags_SIZE sizeof(ULONGLONG) - #define GetPresharedKeyForId_OUT_SecurityFlags_ID 6 - -} GetPresharedKeyForId_OUT, *PGetPresharedKeyForId_OUT; - -#define GetPresharedKeyForId_OUT_SIZE (FIELD_OFFSET(GetPresharedKeyForId_OUT, SecurityFlags) + GetPresharedKeyForId_OUT_SecurityFlags_SIZE) - - -// -// This method is required if the initiator supports IKE -// -// SetGroupPresharedKey allows a management application to configure an -// adapter with a group preshared key that is used in an IKE phase 1 exchange -// when there is no specific key available for that exchange. The adapter -// should maintain the key in its non volatile storage if available and -// maintain the key in its working memory so that it is available for IKE -// phase 1 negotiation -// -// - -#define SetGroupPresharedKey 3 -typedef struct _SetGroupPresharedKey_IN -{ - // Number of bytes passed in Key for the preshared key - ULONG KeySize; - #define SetGroupPresharedKey_IN_KeySize_SIZE sizeof(ULONG) - #define SetGroupPresharedKey_IN_KeySize_ID 1 - - // Preshared key used as group key. NOTE: This field is a variable length array. - UCHAR Key[1]; - #define SetGroupPresharedKey_IN_Key_ID 2 - -} SetGroupPresharedKey_IN, *PSetGroupPresharedKey_IN; - -typedef struct _SetGroupPresharedKey_OUT -{ - // Status code resulting from operation - ULONG Status; - #define SetGroupPresharedKey_OUT_Status_SIZE sizeof(ULONG) - #define SetGroupPresharedKey_OUT_Status_ID 3 - -} SetGroupPresharedKey_OUT, *PSetGroupPresharedKey_OUT; - -#define SetGroupPresharedKey_OUT_SIZE (FIELD_OFFSET(SetGroupPresharedKey_OUT, Status) + SetGroupPresharedKey_OUT_Status_SIZE) - - -// -// This method is required if the initiator supports IPSEC tunnel mode -// -// SetTunnelModeOuterAddress allows a management application to configure the -// tunnel mode outer address that is used by a port on an adapter -// The adapter should maintain the address in its non volatile -// storage if available -// - -#define SetTunnelModeOuterAddress 4 -typedef struct _SetTunnelModeOuterAddress_IN -{ - // Port number to which to associate tunnel mode address. Use 0xffffffff to associate with all ports. - ULONG PortNumber; - #define SetTunnelModeOuterAddress_IN_PortNumber_SIZE sizeof(ULONG) - #define SetTunnelModeOuterAddress_IN_PortNumber_ID 1 - - // Destination address - ISCSI_IP_Address DestinationAddress; - #define SetTunnelModeOuterAddress_IN_DestinationAddress_SIZE sizeof(ISCSI_IP_Address) - #define SetTunnelModeOuterAddress_IN_DestinationAddress_ID 2 - - // Tunnel mode outer address - ISCSI_IP_Address TunnelModeOuterAddress; - #define SetTunnelModeOuterAddress_IN_TunnelModeOuterAddress_SIZE sizeof(ISCSI_IP_Address) - #define SetTunnelModeOuterAddress_IN_TunnelModeOuterAddress_ID 3 - -} SetTunnelModeOuterAddress_IN, *PSetTunnelModeOuterAddress_IN; - -#define SetTunnelModeOuterAddress_IN_SIZE (FIELD_OFFSET(SetTunnelModeOuterAddress_IN, TunnelModeOuterAddress) + SetTunnelModeOuterAddress_IN_TunnelModeOuterAddress_SIZE) - -typedef struct _SetTunnelModeOuterAddress_OUT -{ - // Status code resulting from operation - ULONG Status; - #define SetTunnelModeOuterAddress_OUT_Status_SIZE sizeof(ULONG) - #define SetTunnelModeOuterAddress_OUT_Status_ID 4 - -} SetTunnelModeOuterAddress_OUT, *PSetTunnelModeOuterAddress_OUT; - -#define SetTunnelModeOuterAddress_OUT_SIZE (FIELD_OFFSET(SetTunnelModeOuterAddress_OUT, Status) + SetTunnelModeOuterAddress_OUT_Status_SIZE) - - -// -// This method is required if the initiator caches information -// -// ClearCache instructs the HBA to clear the iSCSI authentication and -// preshared key caches -// - -#define ClearCache 5 -typedef struct _ClearCache_OUT -{ - // Status code resulting from operation - ULONG Status; - #define ClearCache_OUT_Status_SIZE sizeof(ULONG) - #define ClearCache_OUT_Status_ID 1 - -} ClearCache_OUT, *PClearCache_OUT; - -#define ClearCache_OUT_SIZE (FIELD_OFFSET(ClearCache_OUT, Status) + ClearCache_OUT_Status_SIZE) - - -// -// This method is required if the initiator caches information -// -// This method establishes a marker that the service can subsequently -// validate to ensure that the initiator cache is valid -// - -#define SetGenerationalGuid 6 -typedef struct _SetGenerationalGuid_IN -{ - // Generational Guid - UCHAR GenerationalGuid[16]; - #define SetGenerationalGuid_IN_GenerationalGuid_SIZE sizeof(UCHAR[16]) - #define SetGenerationalGuid_IN_GenerationalGuid_ID 1 - -} SetGenerationalGuid_IN, *PSetGenerationalGuid_IN; - -#define SetGenerationalGuid_IN_SIZE (FIELD_OFFSET(SetGenerationalGuid_IN, GenerationalGuid) + SetGenerationalGuid_IN_GenerationalGuid_SIZE) - -typedef struct _SetGenerationalGuid_OUT -{ - // Status code resulting from operation - ULONG Status; - #define SetGenerationalGuid_OUT_Status_SIZE sizeof(ULONG) - #define SetGenerationalGuid_OUT_Status_ID 2 - -} SetGenerationalGuid_OUT, *PSetGenerationalGuid_OUT; - -#define SetGenerationalGuid_OUT_SIZE (FIELD_OFFSET(SetGenerationalGuid_OUT, Status) + SetGenerationalGuid_OUT_Status_SIZE) - - -// MSiSCSI_BootInformation - MSiSCSI_BootInformation -#define MSiSCSI_BootInformationGuid \ - { 0xee5a2356,0xc703,0x489b, { 0xb1,0x36,0x69,0xc9,0x94,0xae,0x3a,0x20 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_BootInformation_GUID, \ - 0xee5a2356,0xc703,0x489b,0xb1,0x36,0x69,0xc9,0x94,0xae,0x3a,0x20); -#endif - - -typedef struct _MSiSCSI_BootInformation -{ - // Initiator Node Name used for boot - UCHAR NodeName[223]; - #define MSiSCSI_BootInformation_NodeName_SIZE sizeof(UCHAR[223]) - #define MSiSCSI_BootInformation_NodeName_ID 1 - - // Length of Initiator Shared Secret - ULONG SharedSecretLength; - #define MSiSCSI_BootInformation_SharedSecretLength_SIZE sizeof(ULONG) - #define MSiSCSI_BootInformation_SharedSecretLength_ID 2 - - // Initiator Shared Secret - UCHAR SharedSecret[255]; - #define MSiSCSI_BootInformation_SharedSecret_SIZE sizeof(UCHAR[255]) - #define MSiSCSI_BootInformation_SharedSecret_ID 3 - -} MSiSCSI_BootInformation, *PMSiSCSI_BootInformation; - -#define MSiSCSI_BootInformation_SIZE (FIELD_OFFSET(MSiSCSI_BootInformation, SharedSecret) + MSiSCSI_BootInformation_SharedSecret_SIZE) - -// MSiSCSI_AdapterEvent - MSiSCSI_AdapterEvent - -typedef enum { - ISCSI_ADAPTER_TARGETS_CHANGED = 3 -} ISCSI_ADAPTER_EVENT_CODE, *PISCSI_ADAPTER_EVENT_CODE; - -// -// This class is required if the HBA supports discovery -// -// This class must be registered using PDO instance names with a single instance -// - -#define MSiSCSI_AdapterEventGuid \ - { 0x46b122c0,0x3767,0x4069, { 0x91,0x6e,0x3a,0x43,0x70,0x2f,0x05,0xce } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_AdapterEvent_GUID, \ - 0x46b122c0,0x3767,0x4069,0x91,0x6e,0x3a,0x43,0x70,0x2f,0x05,0xce); -#endif - - -typedef struct _MSiSCSI_AdapterEvent -{ - // Id that is unique to each instance of each adapter. This is the ID returned in the MSiSCSI_HBAInformation class. - ULONGLONG UniqueAdapterId; - #define MSiSCSI_AdapterEvent_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_AdapterEvent_UniqueAdapterId_ID 1 - - // **typedef**Adapter Event Code - ULONG EventCode; - #define MSiSCSI_AdapterEvent_EventCode_SIZE sizeof(ULONG) - #define MSiSCSI_AdapterEvent_EventCode_ID 2 - -} MSiSCSI_AdapterEvent, *PMSiSCSI_AdapterEvent; - -#define MSiSCSI_AdapterEvent_SIZE (FIELD_OFFSET(MSiSCSI_AdapterEvent, EventCode) + MSiSCSI_AdapterEvent_EventCode_SIZE) - -#endif - diff --git a/pub/ddk/iscsiprf.h b/pub/ddk/iscsiprf.h deleted file mode 100644 index b3b67d1..0000000 --- a/pub/ddk/iscsiprf.h +++ /dev/null @@ -1,712 +0,0 @@ -#ifndef _iscsiprf_h_ -#define _iscsiprf_h_ - -// MSiSCSI_MMIPSECStats - MSiSCSI_MMIPSECStats -// iSCSI HBA main mode IPSEC Statistics - - -//*************************************************************************** -// -// iscsiprf.h -// -// Module: iSCSI Discovery api -// -// Purpose: Internal header defining interface between user mode discovery -// api dll and HBA driver miniport. -// -// Note: These classes are recommended as by implementing them the data -// exposed will be available in sysmon (perfmon) when running on -// Windows XP and Windows .Net server -// -// Copyright (c) 2001 Microsoft Corporation -// -//*************************************************************************** - -// -// This class exposes the main mode IPSEC statistics -// -// This class must be registered with PDO instance names using a single instance -// - -#define MSiSCSI_MMIPSECStatsGuid \ - { 0x36b58ea2,0xc461,0x4bb0, { 0xac,0x8e,0x95,0x2f,0x59,0xd2,0x51,0xed } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_MMIPSECStats_GUID, \ - 0x36b58ea2,0xc461,0x4bb0,0xac,0x8e,0x95,0x2f,0x59,0xd2,0x51,0xed); -#endif - - -typedef struct _MSiSCSI_MMIPSECStats -{ - -// An acquire is a request by the IPSEC driver to have IKE perform a task. The active acquire statistic includes the outstanding request and the number of any queued requests. Typically, the number of active acquires is 1. Under a heavy load, the number of active acquires is 1 and the number of requests that are queued by IKE for processing. - // An acquire is a request by the IPSEC driver to have IKE perform a task. The active acquire statistic includes the outstanding request and the number of any queued requests. Typically, the number of active acquires is 1. Under a heavy load, the number of active acquires is 1 and the number of requests that are queued by IKE for processing. - ULONGLONG ActiveAcquire; - #define MSiSCSI_MMIPSECStats_ActiveAcquire_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_ActiveAcquire_ID 1 - - -// The number of IKE messages received that are queued for processing. - // The number of IKE messages received that are queued for processing. - ULONGLONG ActiveReceive; - #define MSiSCSI_MMIPSECStats_ActiveReceive_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_ActiveReceive_ID 2 - - -// The number of times that an acquire has failed. - // The number of times that an acquire has failed. - ULONGLONG AcquireFailures; - #define MSiSCSI_MMIPSECStats_AcquireFailures_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_AcquireFailures_ID 3 - - -// The number of times that the TCP stack has failed when receiving IKE messages. - // The number of times that the TCP stack has failed when receiving IKE messages. - ULONGLONG ReceiveFailures; - #define MSiSCSI_MMIPSECStats_ReceiveFailures_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_ReceiveFailures_ID 4 - - -// The number of times that the TCP/IP stack has failed when sending IKE messages. - // The number of times that the TCP/IP stack has failed when sending IKE messages. - ULONGLONG SendFailures; - #define MSiSCSI_MMIPSECStats_SendFailures_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_SendFailures_ID 5 - - -// The number of entries in the acquire heap, which stores active acquires. This number increases under a heavy load and then gradually decreases over time, as the acquire heap is cleared. - // The number of entries in the acquire heap, which stores active acquires. This number increases under a heavy load and then gradually decreases over time, as the acquire heap is cleared. - ULONGLONG AcquireHeapSize; - #define MSiSCSI_MMIPSECStats_AcquireHeapSize_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_AcquireHeapSize_ID 6 - - -// The number of entries in the IKE receive buffers for incoming IKE messages. - // The number of entries in the IKE receive buffers for incoming IKE messages. - ULONGLONG ReceiveHeapSize; - #define MSiSCSI_MMIPSECStats_ReceiveHeapSize_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_ReceiveHeapSize_ID 7 - - -// The total number of negotiation failures that occurred during main mode (also known as Phase I) or quick mode (also known as Phase II) negotiation. - // The total number of negotiation failures that occurred during main mode (also known as Phase I) or quick mode (also known as Phase II) negotiation. - ULONGLONG NegotiationFailures; - #define MSiSCSI_MMIPSECStats_NegotiationFailures_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_NegotiationFailures_ID 8 - - -// The total number of identity authentication failures (Kerberos, certificate, and preshared key) that occurred during main mode negotiation. - // The total number of identity authentication failures (Kerberos, certificate, and preshared key) that occurred during main mode negotiation. - ULONGLONG AuthenticationFailures; - #define MSiSCSI_MMIPSECStats_AuthenticationFailures_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_AuthenticationFailures_ID 9 - - -// A cookie is a value contained in a received IKE message that is used by IKE to find the state of an active main mode. A cookie in a received IKE message that cannot be matched with an active main mode is invalid. - // A cookie is a value contained in a received IKE message that is used by IKE to find the state of an active main mode. A cookie in a received IKE message that cannot be matched with an active main mode is invalid. - ULONGLONG InvalidCookiesReceived; - #define MSiSCSI_MMIPSECStats_InvalidCookiesReceived_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_InvalidCookiesReceived_ID 10 - - -// The total number of requests submitted by IKE to obtain a unique Security Parameters Index (SPI). - // The total number of requests submitted by IKE to obtain a unique Security Parameters Index (SPI). - ULONGLONG TotalGetSPI; - #define MSiSCSI_MMIPSECStats_TotalGetSPI_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_TotalGetSPI_ID 11 - - -// The number of outbound quick mode security associations (SAs) added by IKE - // The number of outbound quick mode security associations (SAs) added by IKE - ULONGLONG KeyAdditions; - #define MSiSCSI_MMIPSECStats_KeyAdditions_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_KeyAdditions_ID 12 - - -// The number of inbound quick mode security associations (SAs) added by IKE - // The number of inbound quick mode security associations (SAs) added by IKE - ULONGLONG KeyUpdates; - #define MSiSCSI_MMIPSECStats_KeyUpdates_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_KeyUpdates_ID 13 - - -// The total number of requests submitted by IKE to obtain a unique Security Parameters Index (SPI) that failed. - // The total number of requests submitted by IKE to obtain a unique Security Parameters Index (SPI) that failed. - ULONGLONG GetSPIFailures; - #define MSiSCSI_MMIPSECStats_GetSPIFailures_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_GetSPIFailures_ID 14 - - -// The number of outbound quick mode security associations (SAs) submitted by IKE that failed - // The number of outbound quick mode security associations (SAs) submitted by IKE that failed - ULONGLONG KeyAdditionFailures; - #define MSiSCSI_MMIPSECStats_KeyAdditionFailures_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_KeyAdditionFailures_ID 15 - - -// The number of inbound quick mode security associations (SAs) added by IKE - // The number of inbound quick mode security associations (SAs) added by IKE - ULONGLONG KeyUpdateFailures; - #define MSiSCSI_MMIPSECStats_KeyUpdateFailures_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_KeyUpdateFailures_ID 16 - - -// The number of quick mode state entries. - // The number of quick mode state entries. - ULONGLONG ConnectionListSize; - #define MSiSCSI_MMIPSECStats_ConnectionListSize_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_ConnectionListSize_ID 17 - - -// The total number of successful SAs created during main mode negotiations. - // The total number of successful SAs created during main mode negotiations. - ULONGLONG OakleyMainMode; - #define MSiSCSI_MMIPSECStats_OakleyMainMode_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_OakleyMainMode_ID 18 - - -// The total number of successful SAs created during quick mode negotiations - // The total number of successful SAs created during quick mode negotiations - ULONGLONG OakleyQuickMode; - #define MSiSCSI_MMIPSECStats_OakleyQuickMode_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_OakleyQuickMode_ID 19 - - -// The number of received IKE messages that are invalid, including IKE messages with invalid header fields, incorrect payload lengths, and incorrect values for the responder cookie (when it should be set to 0). - // The number of received IKE messages that are invalid, including IKE messages with invalid header fields, incorrect payload lengths, and incorrect values for the responder cookie (when it should be set to 0). - ULONGLONG InvalidPackets; - #define MSiSCSI_MMIPSECStats_InvalidPackets_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_InvalidPackets_ID 20 - - -// The total number of negotiations that resulted in the use of plaintext (also known as soft SAs). This typically reflects the number of associations formed with computers that did not respond to main mode negotiation attempts. This can include both non-IPSEC-aware computers and IPSEC-aware computers that do not have IPSEC policy to negotiate security with this IPSEC peer. - // The total number of negotiations that resulted in the use of plaintext (also known as soft SAs). This typically reflects the number of associations formed with computers that did not respond to main mode negotiation attempts. This can include both non-IPSEC-aware computers and IPSEC-aware computers that do not have IPSEC policy to negotiate security with this IPSEC peer. - ULONGLONG SoftAssociations; - #define MSiSCSI_MMIPSECStats_SoftAssociations_SIZE sizeof(ULONGLONG) - #define MSiSCSI_MMIPSECStats_SoftAssociations_ID 21 - -} MSiSCSI_MMIPSECStats, *PMSiSCSI_MMIPSECStats; - -#define MSiSCSI_MMIPSECStats_SIZE (FIELD_OFFSET(MSiSCSI_MMIPSECStats, SoftAssociations) + MSiSCSI_MMIPSECStats_SoftAssociations_SIZE) - -// MSiSCSI_QMIPSECStats - MSiSCSI_QMIPSECStats -// iSCSI HBA quick mode IPSEC Statistics - -// -// This class exposes the quick mode IPSEC statistics -// -// This class must be registered with PDO instance names using a single instance -// - -#define MSiSCSI_QMIPSECStatsGuid \ - { 0xb4d1c606,0x8682,0x4b7a, { 0xac,0x6b,0xd8,0x83,0xd9,0x15,0x55,0xfb } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_QMIPSECStats_GUID, \ - 0xb4d1c606,0x8682,0x4b7a,0xac,0x6b,0xd8,0x83,0xd9,0x15,0x55,0xfb); -#endif - - -typedef struct _MSiSCSI_QMIPSECStats -{ - -// The number of active IPSEC SAs - // The number of active IPSEC SAs - ULONGLONG ActiveSA; - #define MSiSCSI_QMIPSECStats_ActiveSA_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_ActiveSA_ID 1 - - -// The number of IPSEC key operations in progress - // The number of IPSEC key operations in progress - ULONGLONG PendingKeyOperations; - #define MSiSCSI_QMIPSECStats_PendingKeyOperations_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_PendingKeyOperations_ID 2 - - -// The total number of successful IPSEC SA negotiations - // The total number of successful IPSEC SA negotiations - ULONGLONG KeyAdditions; - #define MSiSCSI_QMIPSECStats_KeyAdditions_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_KeyAdditions_ID 3 - - -// The total number of key deletions for IPSEC SA - // The total number of key deletions for IPSEC SA - ULONGLONG KeyDeletions; - #define MSiSCSI_QMIPSECStats_KeyDeletions_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_KeyDeletions_ID 4 - - -// The number of rekey operations for IPSEC SAs. - // The number of rekey operations for IPSEC SAs. - ULONGLONG ReKeys; - #define MSiSCSI_QMIPSECStats_ReKeys_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_ReKeys_ID 5 - - -// The number of active IPSEC tunnels. - // The number of active IPSEC tunnels. - ULONGLONG ActiveTunnels; - #define MSiSCSI_QMIPSECStats_ActiveTunnels_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_ActiveTunnels_ID 6 - - -// The total number of packets for which the Security Parameters Index (SPI) was incorrect. - // The total number of packets for which the Security Parameters Index (SPI) was incorrect. - ULONGLONG BadSPIPackets; - #define MSiSCSI_QMIPSECStats_BadSPIPackets_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_BadSPIPackets_ID 7 - - -// The total number of packets that failed decryption. - // The total number of packets that failed decryption. - ULONGLONG PacketsNotDecrypted; - #define MSiSCSI_QMIPSECStats_PacketsNotDecrypted_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_PacketsNotDecrypted_ID 8 - - -// The total number of packets for which data could not be verified. - // The total number of packets for which data could not be verified. - ULONGLONG PacketsNotAuthenticated; - #define MSiSCSI_QMIPSECStats_PacketsNotAuthenticated_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_PacketsNotAuthenticated_ID 9 - - -// The total number of packets that contained a valid Sequence Number field. - // The total number of packets that contained a valid Sequence Number field. - ULONGLONG PacketsWithReplayDetection; - #define MSiSCSI_QMIPSECStats_PacketsWithReplayDetection_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_PacketsWithReplayDetection_ID 10 - - -// The number of bytes sent using the ESP protocol. - // The number of bytes sent using the ESP protocol. - ULONGLONG ConfidentialBytesSent; - #define MSiSCSI_QMIPSECStats_ConfidentialBytesSent_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_ConfidentialBytesSent_ID 11 - - -// The number of bytes received using the ESP protocol. - // The number of bytes received using the ESP protocol. - ULONGLONG ConfidentialBytesReceived; - #define MSiSCSI_QMIPSECStats_ConfidentialBytesReceived_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_ConfidentialBytesReceived_ID 12 - - -// The number of bytes sent using the AH protocol. - // The number of bytes sent using the AH protocol. - ULONGLONG AuthenticatedBytesSent; - #define MSiSCSI_QMIPSECStats_AuthenticatedBytesSent_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_AuthenticatedBytesSent_ID 13 - - -// The number of bytes received using the AH protocol. - // The number of bytes received using the AH protocol. - ULONGLONG AuthenticatedBytesReceived; - #define MSiSCSI_QMIPSECStats_AuthenticatedBytesReceived_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_AuthenticatedBytesReceived_ID 14 - - -// The number of bytes sent using the IPSEC protocol. - // The number of bytes sent using the IPSEC protocol. - ULONGLONG TransportBytesSent; - #define MSiSCSI_QMIPSECStats_TransportBytesSent_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_TransportBytesSent_ID 15 - - -// The number of bytes received using the IPSEC protocol. - // The number of bytes received using the IPSEC protocol. - ULONGLONG TransportBytesReceived; - #define MSiSCSI_QMIPSECStats_TransportBytesReceived_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_TransportBytesReceived_ID 16 - - -// The number of bytes sent using the IPSEC tunnel mode. - // The number of bytes sent using the IPSEC tunnel mode. - ULONGLONG TunnelBytesSent; - #define MSiSCSI_QMIPSECStats_TunnelBytesSent_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_TunnelBytesSent_ID 17 - - -// The number of bytes received using the IPSEC tunnel mode. - // The number of bytes received using the IPSEC tunnel mode. - ULONGLONG TunnelBytesReceived; - #define MSiSCSI_QMIPSECStats_TunnelBytesReceived_SIZE sizeof(ULONGLONG) - #define MSiSCSI_QMIPSECStats_TunnelBytesReceived_ID 18 - -} MSiSCSI_QMIPSECStats, *PMSiSCSI_QMIPSECStats; - -#define MSiSCSI_QMIPSECStats_SIZE (FIELD_OFFSET(MSiSCSI_QMIPSECStats, TunnelBytesReceived) + MSiSCSI_QMIPSECStats_TunnelBytesReceived_SIZE) - -// MSiSCSI_ConnectionStatistics - MSiSCSI_ConnectionStatistics -// iSCSI Connection Statistics - -// -// This class exposes connection statistics statistics -// -// This class must be registered with dynamic instance names using -// a specific format: -// -// targetname_#:# where the first # is the SID, and the second -// # is the CID. -// - -#define MSiSCSI_ConnectionStatisticsGuid \ - { 0x4ae27cd9,0x8dfa,0x4c37, { 0xa4,0x2c,0xb8,0x8a,0x93,0xe3,0xe5,0x21 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_ConnectionStatistics_GUID, \ - 0x4ae27cd9,0x8dfa,0x4c37,0xa4,0x2c,0xb8,0x8a,0x93,0xe3,0xe5,0x21); -#endif - - -typedef struct _MSiSCSI_ConnectionStatistics -{ - // Name of the iSCSI Target - WCHAR iSCSIName[223 + 1]; - #define MSiSCSI_ConnectionStatistics_iSCSIName_ID 1 - - // The iSCSI connection ID for this connection instance. - USHORT CID; - #define MSiSCSI_ConnectionStatistics_CID_SIZE sizeof(USHORT) - #define MSiSCSI_ConnectionStatistics_CID_ID 2 - - // A uniquely generated session ID used only internally. This is the value returned by the LoginToTarget method. - ULONGLONG USID; - #define MSiSCSI_ConnectionStatistics_USID_SIZE sizeof(ULONGLONG) - #define MSiSCSI_ConnectionStatistics_USID_ID 3 - - // Id that is globally unique to each instance of each adapter. This is the value reported by the MSiSCSI_HBAInformation class. - ULONGLONG UniqueAdapterId; - #define MSiSCSI_ConnectionStatistics_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_ConnectionStatistics_UniqueAdapterId_ID 4 - - // Count of # of bytes sent over this connection - ULONGLONG BytesSent; - #define MSiSCSI_ConnectionStatistics_BytesSent_SIZE sizeof(ULONGLONG) - #define MSiSCSI_ConnectionStatistics_BytesSent_ID 5 - - // Count of # of bytes received over this connection - ULONGLONG BytesReceived; - #define MSiSCSI_ConnectionStatistics_BytesReceived_SIZE sizeof(ULONGLONG) - #define MSiSCSI_ConnectionStatistics_BytesReceived_ID 6 - - // Count of # of PDU sent over this connection - ULONGLONG PDUCommandsSent; - #define MSiSCSI_ConnectionStatistics_PDUCommandsSent_SIZE sizeof(ULONGLONG) - #define MSiSCSI_ConnectionStatistics_PDUCommandsSent_ID 7 - - // Count of # of PDU received over this connection - ULONGLONG PDUResponsesReceived; - #define MSiSCSI_ConnectionStatistics_PDUResponsesReceived_SIZE sizeof(ULONGLONG) - #define MSiSCSI_ConnectionStatistics_PDUResponsesReceived_ID 8 - -} MSiSCSI_ConnectionStatistics, *PMSiSCSI_ConnectionStatistics; - -#define MSiSCSI_ConnectionStatistics_SIZE (FIELD_OFFSET(MSiSCSI_ConnectionStatistics, PDUResponsesReceived) + MSiSCSI_ConnectionStatistics_PDUResponsesReceived_SIZE) - -// MSiSCSI_SessionStatistics - MSiSCSI_SessionStatistics -// iSCSI Session Statistics - -// -// This class exposes session statistics -// -// This class must be registered with dynamic instance names using -// a specific format: -// -// targetname_# where the # is the SID -// - -#define MSiSCSI_SessionStatisticsGuid \ - { 0xc827993c,0x6d1f,0x4194, { 0x9b,0x5c,0xd7,0xc0,0xa5,0xf1,0xcf,0xb7 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_SessionStatistics_GUID, \ - 0xc827993c,0x6d1f,0x4194,0x9b,0x5c,0xd7,0xc0,0xa5,0xf1,0xcf,0xb7); -#endif - - -typedef struct _MSiSCSI_SessionStatistics -{ - // Name of the iSCSI Target - WCHAR iSCSIName[223 + 1]; - #define MSiSCSI_SessionStatistics_iSCSIName_ID 1 - - // A uniquely generated session ID used only internally. This is the value returned by the LoginToTarget method. - ULONGLONG USID; - #define MSiSCSI_SessionStatistics_USID_SIZE sizeof(ULONGLONG) - #define MSiSCSI_SessionStatistics_USID_ID 2 - - // Id that is globally unique to each instance of each adapter. This is the value reported by the MSiSCSI_HBAInformation class. - ULONGLONG UniqueAdapterId; - #define MSiSCSI_SessionStatistics_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_SessionStatistics_UniqueAdapterId_ID 3 - - // Number of bytes sent over this session - ULONGLONG BytesSent; - #define MSiSCSI_SessionStatistics_BytesSent_SIZE sizeof(ULONGLONG) - #define MSiSCSI_SessionStatistics_BytesSent_ID 4 - - // Number of bytes received over this session - ULONGLONG BytesReceived; - #define MSiSCSI_SessionStatistics_BytesReceived_SIZE sizeof(ULONGLONG) - #define MSiSCSI_SessionStatistics_BytesReceived_ID 5 - - // Number of PDU sent over this session - ULONGLONG PDUCommandsSent; - #define MSiSCSI_SessionStatistics_PDUCommandsSent_SIZE sizeof(ULONGLONG) - #define MSiSCSI_SessionStatistics_PDUCommandsSent_ID 6 - - // Number of PDU received over this session - ULONGLONG PDUResponsesReceived; - #define MSiSCSI_SessionStatistics_PDUResponsesReceived_SIZE sizeof(ULONGLONG) - #define MSiSCSI_SessionStatistics_PDUResponsesReceived_ID 7 - - // Count of Number of Digest errors occured in this session - ULONGLONG DigestErrors; - #define MSiSCSI_SessionStatistics_DigestErrors_SIZE sizeof(ULONGLONG) - #define MSiSCSI_SessionStatistics_DigestErrors_ID 8 - - // Count of Number of ConnectionTimeout errors occured in this session - ULONGLONG ConnectionTimeoutErrors; - #define MSiSCSI_SessionStatistics_ConnectionTimeoutErrors_SIZE sizeof(ULONGLONG) - #define MSiSCSI_SessionStatistics_ConnectionTimeoutErrors_ID 9 - - // Count of Number of Format errors occured in this session - ULONGLONG FormatErrors; - #define MSiSCSI_SessionStatistics_FormatErrors_SIZE sizeof(ULONGLONG) - #define MSiSCSI_SessionStatistics_FormatErrors_ID 10 - -} MSiSCSI_SessionStatistics, *PMSiSCSI_SessionStatistics; - -#define MSiSCSI_SessionStatistics_SIZE (FIELD_OFFSET(MSiSCSI_SessionStatistics, FormatErrors) + MSiSCSI_SessionStatistics_FormatErrors_SIZE) - -// MSiSCSI_InitiatorLoginStatistics - MSiSCSI_InitiatorLoginStatistics -// iSCSI Initiator Login Statistics - -// -// This class exposes login statistics -// -// This class must be registered with PDO instance names -// - -#define MSiSCSI_InitiatorLoginStatisticsGuid \ - { 0xf022f413,0x3bf5,0x47ec, { 0xa9,0x42,0x33,0xb8,0x1c,0xf8,0xe7,0xff } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_InitiatorLoginStatistics_GUID, \ - 0xf022f413,0x3bf5,0x47ec,0xa9,0x42,0x33,0xb8,0x1c,0xf8,0xe7,0xff); -#endif - - -typedef struct _MSiSCSI_InitiatorLoginStatistics -{ - // Id that is globally unique to each instance of each adapter. This is the value reported by the MSiSCSI_HBAInformation class. - ULONGLONG UniqueAdapterId; - #define MSiSCSI_InitiatorLoginStatistics_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_InitiatorLoginStatistics_UniqueAdapterId_ID 1 - - // Count of Login Accept Responses - ULONG LoginAcceptRsps; - #define MSiSCSI_InitiatorLoginStatistics_LoginAcceptRsps_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorLoginStatistics_LoginAcceptRsps_ID 2 - - // Count of Login other failed Responses - ULONG LoginOtherFailRsps; - #define MSiSCSI_InitiatorLoginStatistics_LoginOtherFailRsps_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorLoginStatistics_LoginOtherFailRsps_ID 3 - - // Count of Login Redirect Responses - ULONG LoginRedirectRsps; - #define MSiSCSI_InitiatorLoginStatistics_LoginRedirectRsps_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorLoginStatistics_LoginRedirectRsps_ID 4 - - // Count of Login Authentication Failed Responses - ULONG LoginAuthFailRsps; - #define MSiSCSI_InitiatorLoginStatistics_LoginAuthFailRsps_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorLoginStatistics_LoginAuthFailRsps_ID 5 - - // Count of the number of times a login is aborted due to a target authentication failure - ULONG LoginAuthenticateFails; - #define MSiSCSI_InitiatorLoginStatistics_LoginAuthenticateFails_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorLoginStatistics_LoginAuthenticateFails_ID 6 - - // Count of the number of times login failed due to negotiation failure with target - ULONG LoginNegotiateFails; - #define MSiSCSI_InitiatorLoginStatistics_LoginNegotiateFails_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorLoginStatistics_LoginNegotiateFails_ID 7 - - // Count of Logout command PDU with reason code 0 - ULONG LogoutNormals; - #define MSiSCSI_InitiatorLoginStatistics_LogoutNormals_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorLoginStatistics_LogoutNormals_ID 8 - - // Count of Logout command PDUs with status code other than 0 - ULONG LogoutOtherCodes; - #define MSiSCSI_InitiatorLoginStatistics_LogoutOtherCodes_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorLoginStatistics_LogoutOtherCodes_ID 9 - - // The object counts the number of times a login attempt from this local initiator has failed - ULONG LoginFailures; - #define MSiSCSI_InitiatorLoginStatistics_LoginFailures_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorLoginStatistics_LoginFailures_ID 10 - -} MSiSCSI_InitiatorLoginStatistics, *PMSiSCSI_InitiatorLoginStatistics; - -#define MSiSCSI_InitiatorLoginStatistics_SIZE (FIELD_OFFSET(MSiSCSI_InitiatorLoginStatistics, LoginFailures) + MSiSCSI_InitiatorLoginStatistics_LoginFailures_SIZE) - -// MSiSCSI_InitiatorInstanceStatistics - MSiSCSI_InitiatorInstanceStatistics -// iSCSI Initiator Instance Statistics - -// -// This class exposes initiator statistics -// -// This class must be registered with PDO instance names -// - -#define MSiSCSI_InitiatorInstanceStatisticsGuid \ - { 0xfa30c290,0x68db,0x430a, { 0xaf,0x76,0x91,0xa2,0xe1,0xc4,0x91,0x54 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_InitiatorInstanceStatistics_GUID, \ - 0xfa30c290,0x68db,0x430a,0xaf,0x76,0x91,0xa2,0xe1,0xc4,0x91,0x54); -#endif - - -typedef struct _MSiSCSI_InitiatorInstanceStatistics -{ - // Id that is globally unique to each instance of each adapter. This is the value reported by the MSiSCSI_HBAInformation class. - ULONGLONG UniqueAdapterId; - #define MSiSCSI_InitiatorInstanceStatistics_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_InitiatorInstanceStatistics_UniqueAdapterId_ID 1 - - // Count of Session digest errors - ULONG SessionDigestErrorCount; - #define MSiSCSI_InitiatorInstanceStatistics_SessionDigestErrorCount_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorInstanceStatistics_SessionDigestErrorCount_ID 2 - - // Count of Session connection timeout error - ULONG SessionConnectionTimeoutErrorCount; - #define MSiSCSI_InitiatorInstanceStatistics_SessionConnectionTimeoutErrorCount_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorInstanceStatistics_SessionConnectionTimeoutErrorCount_ID 3 - - // Count of Session format error - ULONG SessionFormatErrorCount; - #define MSiSCSI_InitiatorInstanceStatistics_SessionFormatErrorCount_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorInstanceStatistics_SessionFormatErrorCount_ID 4 - - // Number of Sessions failed belonging to this instance - ULONG SessionFailureCount; - #define MSiSCSI_InitiatorInstanceStatistics_SessionFailureCount_SIZE sizeof(ULONG) - #define MSiSCSI_InitiatorInstanceStatistics_SessionFailureCount_ID 5 - -} MSiSCSI_InitiatorInstanceStatistics, *PMSiSCSI_InitiatorInstanceStatistics; - -#define MSiSCSI_InitiatorInstanceStatistics_SIZE (FIELD_OFFSET(MSiSCSI_InitiatorInstanceStatistics, SessionFailureCount) + MSiSCSI_InitiatorInstanceStatistics_SessionFailureCount_SIZE) - -// MSiSCSI_NICPerformance - MSiSCSI_NICPerformance - -// -// NIC performance information class, implement one instance for each port on -// your adapter. -// -// This class must be registered with PDO instance names with one instance -// names for each port -// - -#define MSiSCSI_NICPerformanceGuid \ - { 0x5c59fd61,0xe919,0x4687, { 0x84,0xe2,0x72,0x00,0xab,0xe2,0x20,0x9b } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_NICPerformance_GUID, \ - 0x5c59fd61,0xe919,0x4687,0x84,0xe2,0x72,0x00,0xab,0xe2,0x20,0x9b); -#endif - - -typedef struct _MSiSCSI_NICPerformance -{ - // Number of bytes transmitted via ethernet port - ULONG BytesTransmitted; - #define MSiSCSI_NICPerformance_BytesTransmitted_SIZE sizeof(ULONG) - #define MSiSCSI_NICPerformance_BytesTransmitted_ID 1 - - // Number of bytes received via ethernet port - ULONG BytesReceived; - #define MSiSCSI_NICPerformance_BytesReceived_SIZE sizeof(ULONG) - #define MSiSCSI_NICPerformance_BytesReceived_ID 2 - - // Number of PDU transmitted via ethernet port - ULONG PDUTransmitted; - #define MSiSCSI_NICPerformance_PDUTransmitted_SIZE sizeof(ULONG) - #define MSiSCSI_NICPerformance_PDUTransmitted_ID 3 - - // Number of PDU received via ethernet port - ULONG PDUReceived; - #define MSiSCSI_NICPerformance_PDUReceived_SIZE sizeof(ULONG) - #define MSiSCSI_NICPerformance_PDUReceived_ID 4 - -} MSiSCSI_NICPerformance, *PMSiSCSI_NICPerformance; - -#define MSiSCSI_NICPerformance_SIZE (FIELD_OFFSET(MSiSCSI_NICPerformance, PDUReceived) + MSiSCSI_NICPerformance_PDUReceived_SIZE) - -// MSiSCSI_RequestTimeStatistics - MSiSCSI_RequestTimeStatistics -// iSCSI Request Processing Time - -// -// This class exposes request processing time statistics -// -// This class must be registered with dynamic instance names using -// a specific format: -// -// targetname_#:# where the first # is the SID, and the second -// # is the CID. -// - -#define MSiSCSI_RequestTimeStatisticsGuid \ - { 0xe0b40aa8,0x544b,0x4d5e, { 0xba,0x60,0xa0,0x3f,0x13,0x6d,0xa8,0x3d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSiSCSI_RequestTimeStatistics_GUID, \ - 0xe0b40aa8,0x544b,0x4d5e,0xba,0x60,0xa0,0x3f,0x13,0x6d,0xa8,0x3d); -#endif - - -typedef struct _MSiSCSI_RequestTimeStatistics -{ - // Name of the iSCSI Target - WCHAR iSCSIName[223 + 1]; - #define MSiSCSI_RequestTimeStatistics_iSCSIName_ID 1 - - // The iSCSI connection ID for this connection instance. - USHORT CID; - #define MSiSCSI_RequestTimeStatistics_CID_SIZE sizeof(USHORT) - #define MSiSCSI_RequestTimeStatistics_CID_ID 2 - - // A uniquely generated session ID used only internally. This is the value returned by the LoginToTarget method. - ULONGLONG USID; - #define MSiSCSI_RequestTimeStatistics_USID_SIZE sizeof(ULONGLONG) - #define MSiSCSI_RequestTimeStatistics_USID_ID 3 - - // Id that is globally unique to each instance of each adapter. This is the value reported by the MSiSCSI_HBAInformation class. - ULONGLONG UniqueAdapterId; - #define MSiSCSI_RequestTimeStatistics_UniqueAdapterId_SIZE sizeof(ULONGLONG) - #define MSiSCSI_RequestTimeStatistics_UniqueAdapterId_ID 4 - - // Maximum time taken to process a request over this connection - ULONG MaximumProcessingTime; - #define MSiSCSI_RequestTimeStatistics_MaximumProcessingTime_SIZE sizeof(ULONG) - #define MSiSCSI_RequestTimeStatistics_MaximumProcessingTime_ID 5 - - // Average time taken to process a request over this connection - ULONG AverageProcessingTime; - #define MSiSCSI_RequestTimeStatistics_AverageProcessingTime_SIZE sizeof(ULONG) - #define MSiSCSI_RequestTimeStatistics_AverageProcessingTime_ID 6 - -} MSiSCSI_RequestTimeStatistics, *PMSiSCSI_RequestTimeStatistics; - -#define MSiSCSI_RequestTimeStatistics_SIZE (FIELD_OFFSET(MSiSCSI_RequestTimeStatistics, AverageProcessingTime) + MSiSCSI_RequestTimeStatistics_AverageProcessingTime_SIZE) - -#endif - diff --git a/pub/ddk/isvbop.h b/pub/ddk/isvbop.h deleted file mode 100644 index c947665..0000000 --- a/pub/ddk/isvbop.h +++ /dev/null @@ -1,139 +0,0 @@ -/*++ BUILD Version: 0001 - -Copyright (c) 1990-1999 Microsoft Corporation - -Module Name: - - ISVBOP.H - -Abstract: - - This is the header file supporting third party bops. - isvbop.inc is the inc file for this h file. - -Note: - Following include file uses 'DB' to define assembly macros. Some - assemblers use 'emit' instead. If you are using such a compiler, - you will have to change db's to emit's. - ---*/ - - -#if _MSC_VER > 1000 -#pragma once -#endif - -#define BOP_3RDPARTY 0x58 -#define BOP_UNSIMULATE 0xFE - -/* XLATOFF */ - -/** RegisterModule - This Bop call is made from the 16 bit module - * to register a third party DLL with the bop - * manager. This call returns a handle to the - * 16bit caller which is to be used later to - * dispatch a call to the DLL. - * - * INPUT: - * Client DS:SI - asciiz string of DLL name. - * Client ES:DI - asciiz string of Init Routine in the DLL. (Optional) - * Client DS:BX - asciiz string to Dispatch routine in the DLL. - * - * OUTPUT: - * SUCCESS: - * Client Carry Clear - * Client AX = Handle (non Zero) - * FAILURE: - * Client Carry Set - * Client AX = Error Code - * AX = 1 - DLL not found - * AX = 2 - Dispacth routine not found. - * AX = 3 - Init Routine Not Found - * AX = 4 - Insufficient Memory - * - * NOTES: - * RegisterModule results in loading the DLL (specified in DS:SI). - * Its Init routine (specified in ES:DI) is called. Its Dispatch - * routine (specified in DS:BX) is stored away and all the calls - * made from DispatchCall are dispacthed to this routine. - * If ES and DI both are null than the caller did'nt supply the init - * routine. - */ - -#define RegisterModule() _asm _emit 0xC4 _asm _emit 0xC4 _asm _emit BOP_3RDPARTY _asm _emit 0x0 - -/** UnRegisterModule - This Bop call is made from the 16 bit module - * to unregister a third party DLL with the bop - * manager. - * - * INPUT: - * Client AX - Handle returned by RegisterModule Call. - * - * OUTPUT: - * None (VDM Is terminated with a debug message if Handle is invalid) - * - * NOTES: - * Use it if initialization of 16bit app fails after registering the - * Bop. - */ - -#define UnRegisterModule() _asm _emit 0xC4 _asm _emit 0xC4 _asm _emit BOP_3RDPARTY _asm _emit 0x1 - -/** DispacthCall - This Bop call is made from the 16 bit module - * to pass a request to its DLL. - * - * INPUT: - * Client AX - Handle returned by RegisterModule Call. - * - * OUTPUT: - * None (DLL should set the proper output registers etc.) - * (VDM Is terminated with a debug message if Handle is invalid) - * - * NOTES: - * Use it to pass a request to 32bit DLL. The request index and the - * parameters are passed in different registers. These register settings - * are private to the 16bit module and its associated VDD. Bop manager - * does'nt know anything about these registers. - */ -#define DispatchCall() _asm _emit 0xC4 _asm _emit 0xC4 _asm _emit BOP_3RDPARTY _asm _emit 0x2 - -/*** VDDUnSimulate16 - * - * This service causes the simulation of intel instructions to stop and - * control to return to VDD. - * - * INPUT - * None - * - * OUTPUT - * None - * - * NOTES - * This service is a macro intended for 16bit stub-drivers. At the - * end of worker routine stub-driver should use it. - */ - -#define VDDUnSimulate16() _asm _emit 0xC4 _asm _emit 0xC4 _asm _emit BOP_UNSIMULATE - -/* XLATON */ - - -/* ASM -RegisterModule macro - db 0C4h, 0C4h, BOP_3RDPARTY, 0 - endm - -UnRegisterModule macro - db 0C4h, 0C4h, BOP_3RDPARTY, 1 - endm - -DispatchCall macro - db 0C4h, 0C4h, BOP_3RDPARTY, 2 - endm - -VDDUnSimulate16 macro - db 0C4h, 0C4h, BOP_UNSIMULATE - endm - - */ - diff --git a/pub/ddk/isvbop.inc b/pub/ddk/isvbop.inc deleted file mode 100644 index bb197e0..0000000 --- a/pub/ddk/isvbop.inc +++ /dev/null @@ -1,22 +0,0 @@ -; This is the inc file for isvbop.h. -; Please refer to isvbop.h for comments and notes on these interfaces -; -BOP_3RDPARTY EQU 58H -BOP_UNSIMULATE EQU 0FEH - -RegisterModule macro - db 0C4h, 0C4h, BOP_3RDPARTY, 0 - endm - -UnRegisterModule macro - db 0C4h, 0C4h, BOP_3RDPARTY, 1 - endm - -DispatchCall macro - db 0C4h, 0C4h, BOP_3RDPARTY, 2 - endm - -VDDUnSimulate16 macro - db 0C4h, 0C4h, BOP_UNSIMULATE - endm - diff --git a/pub/ddk/kbdmou.h b/pub/ddk/kbdmou.h deleted file mode 100644 index 9b6af4f..0000000 --- a/pub/ddk/kbdmou.h +++ /dev/null @@ -1,134 +0,0 @@ -/*++ - -Copyright (c) 1989 Microsoft Corporation - -Module Name: - - kbdmou.h - -Abstract: - - These are the structures and defines that are used in the - keyboard class driver, mouse class driver, and keyboard/mouse port - driver. - -Author: - - lees - -Revision History: - ---*/ - -#ifndef _KBDMOU_ -#define _KBDMOU_ - -#include -#include - -// -// Define the keyboard/mouse port device name strings. -// - -#define DD_KEYBOARD_PORT_DEVICE_NAME "\\Device\\KeyboardPort" -#define DD_KEYBOARD_PORT_DEVICE_NAME_U L"\\Device\\KeyboardPort" -#define DD_KEYBOARD_PORT_BASE_NAME_U L"KeyboardPort" -#define DD_POINTER_PORT_DEVICE_NAME "\\Device\\PointerPort" -#define DD_POINTER_PORT_DEVICE_NAME_U L"\\Device\\PointerPort" -#define DD_POINTER_PORT_BASE_NAME_U L"PointerPort" - -// -// Define the keyboard/mouse class device name strings. -// - -#define DD_KEYBOARD_CLASS_BASE_NAME_U L"KeyboardClass" -#define DD_POINTER_CLASS_BASE_NAME_U L"PointerClass" - -// -// Define the keyboard/mouse resource class names. -// - -#define DD_KEYBOARD_RESOURCE_CLASS_NAME_U L"Keyboard" -#define DD_POINTER_RESOURCE_CLASS_NAME_U L"Pointer" -#define DD_KEYBOARD_MOUSE_COMBO_RESOURCE_CLASS_NAME_U L"Keyboard/Pointer" - -// -// Define the maximum number of pointer/keyboard port names the port driver -// will use in an attempt to IoCreateDevice. -// - -#define POINTER_PORTS_MAXIMUM 8 -#define KEYBOARD_PORTS_MAXIMUM 8 - -// -// Define the port connection data structure. -// - -typedef struct _CONNECT_DATA { - IN PDEVICE_OBJECT ClassDeviceObject; - IN PVOID ClassService; -} CONNECT_DATA, *PCONNECT_DATA; - -// -// Define the service callback routine's structure. -// - -typedef -VOID -(*PSERVICE_CALLBACK_ROUTINE) ( - __in PVOID NormalContext, - __in PVOID SystemArgument1, - __in PVOID SystemArgument2, - __inout PVOID SystemArgument3 - ); - -// -// WMI structures returned by port drivers -// -#include - -// -// NtDeviceIoControlFile internal IoControlCode values for keyboard device. -// - -#define IOCTL_INTERNAL_KEYBOARD_CONNECT CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_KEYBOARD_DISCONNECT CTL_CODE(FILE_DEVICE_KEYBOARD,0x0100, METHOD_NEITHER, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_KEYBOARD_ENABLE CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0200, METHOD_NEITHER, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_KEYBOARD_DISABLE CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0400, METHOD_NEITHER, FILE_ANY_ACCESS) - -// -// NtDeviceIoControlFile internal IoControlCode values for mouse device. -// - - -#define IOCTL_INTERNAL_MOUSE_CONNECT CTL_CODE(FILE_DEVICE_MOUSE, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_MOUSE_DISCONNECT CTL_CODE(FILE_DEVICE_MOUSE, 0x0100, METHOD_NEITHER, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_MOUSE_ENABLE CTL_CODE(FILE_DEVICE_MOUSE, 0x0200, METHOD_NEITHER, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_MOUSE_DISABLE CTL_CODE(FILE_DEVICE_MOUSE, 0x0400, METHOD_NEITHER, FILE_ANY_ACCESS) - -// -// Error log definitions (specific to the keyboard/mouse) for DumpData[0] -// in the IO_ERROR_LOG_PACKET. -// -// DumpData[1] <= hardware port/register -// DumpData[2] <= {command byte || expected response byte} -// DumpData[3] <= {command's parameter byte || actual response byte} -// -// - -#define KBDMOU_COULD_NOT_SEND_COMMAND 0x0000 -#define KBDMOU_COULD_NOT_SEND_PARAM 0x0001 -#define KBDMOU_NO_RESPONSE 0x0002 -#define KBDMOU_INCORRECT_RESPONSE 0x0004 - -// -// Define the base values for the error log packet's UniqueErrorValue field. -// - -#define I8042_ERROR_VALUE_BASE 1000 -#define INPORT_ERROR_VALUE_BASE 2000 -#define SERIAL_MOUSE_ERROR_VALUE_BASE 3000 - -#endif // _KBDMOU_ - - diff --git a/pub/ddk/ksi.h b/pub/ddk/ksi.h deleted file mode 100644 index d7f7daa..0000000 --- a/pub/ddk/ksi.h +++ /dev/null @@ -1,194 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ksi.h - -Abstract: - - Windows Driver Model/Connection and Streaming Architecture (WDM-CSA) - core internal definitions. - ---*/ - -#if !defined(_KSI_) -#define _KSI_ - -#if defined(__cplusplus) -extern "C" { -#endif // defined(__cplusplus) - -#if defined(_NTDDK_) - -typedef struct { - LONGLONG Frequency; - LONGLONG LastDueTime; - LONGLONG RunningTimeDelta; - LONGLONG LastRunningTime; - KSPIN_LOCK TimeAccessLock; - LIST_ENTRY EventQueue; - KSPIN_LOCK EventQueueLock; - KTIMER QueueTimer; - KDPC QueueDpc; - LONG ReferenceCount; - KSSTATE State; - LONGLONG SuspendDelta; - LONGLONG SuspendTime; - PFNKSSETTIMER SetTimer; - PFNKSCANCELTIMER CancelTimer; - PFNKSCLOCK_CORRELATEDTIME CorrelatedTime; - PVOID Context; - KSRESOLUTION Resolution; - KEVENT FreeEvent; - LONG ExternalTimeReferenceCount; - BOOLEAN ExternalTimeValid; - LONGLONG LastStreamTime; -} KSIDEFAULTCLOCK, *PKSIDEFAULTCLOCK; - -typedef struct { - KSOBJECT_HEADER Header; - PKSIDEFAULTCLOCK DefaultClock; - ULONG Reserved; -} KSCLOCKINSTANCE, *PKSCLOCKINSTANCE; - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -KSDDKAPI -NTSTATUS -NTAPI -KsiPropertyDefaultClockGetTime( - __in PIRP Irp, - __in PKSPROPERTY Property, - __out PLONGLONG Time - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -KSDDKAPI -NTSTATUS -NTAPI -KsiPropertyDefaultClockGetPhysicalTime( - __in PIRP Irp, - __in PKSPROPERTY Property, - __out PLONGLONG Time - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -KSDDKAPI -NTSTATUS -NTAPI -KsiPropertyDefaultClockGetCorrelatedTime( - __in PIRP Irp, - __in PKSPROPERTY Property, - __out PKSCORRELATED_TIME Time - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -KSDDKAPI -NTSTATUS -NTAPI -KsiPropertyDefaultClockGetCorrelatedPhysicalTime( - __in PIRP Irp, - __in PKSPROPERTY Property, - __out PKSCORRELATED_TIME Time - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -KSDDKAPI -NTSTATUS -NTAPI -KsiPropertyDefaultClockGetResolution( - __in PIRP Irp, - __in PKSPROPERTY Property, - __out PKSRESOLUTION Resolution - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -KSDDKAPI -NTSTATUS -NTAPI -KsiPropertyDefaultClockGetState( - __in PIRP Irp, - __in PKSPROPERTY Property, - __out PKSSTATE State - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -KSDDKAPI -NTSTATUS -NTAPI -KsiPropertyDefaultClockGetFunctionTable( - __in PIRP Irp, - __in PKSPROPERTY Property, - __out PKSCLOCK_FUNCTIONTABLE FunctionTable - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -KSDDKAPI -NTSTATUS -NTAPI -KsiDefaultClockAddMarkEvent( - __in PIRP Irp, - __in PKSEVENT_TIME_INTERVAL EventTime, - __in PKSEVENT_ENTRY EventEntry - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -KSDDKAPI -BOOLEAN -NTAPI -KsiQueryObjectCreateItemsPresent( - __in KSDEVICE_HEADER Header - ); - -#endif // !defined(_NTDDK_) - -#define STATIC_KSNAME_Server\ - 0x3C0D501AL, 0x140B, 0x11D1, 0xB4, 0x0F, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96 -DEFINE_GUIDSTRUCT("3C0D501A-140B-11D1-B40F-00A0C9223196", KSNAME_Server); -#define KSNAME_Server DEFINE_GUIDNAMED(KSNAME_Server) - -#define KSSTRING_Server L"{3C0D501A-140B-11D1-B40F-00A0C9223196}" - -#define STATIC_KSPROPSETID_Service \ - 0x3C0D501BL, 0x140B, 0x11D1, 0xB4, 0x0F, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96 -DEFINE_GUIDSTRUCT("3C0D501B-140B-11D1-B40F-00A0C9223196", KSPROPSETID_Service); -#define KSPROPSETID_Service DEFINE_GUIDNAMED(KSPROPSETID_Service) - -typedef enum { - KSPROPERTY_SERVICE_BUILDCACHE, - KSPROPERTY_SERVICE_MERIT -} KSPROPERTY_SERVICE; - -#define DEFINE_KSPROPERTY_ITEM_SERVICE_BUILDCACHE(SetHandler)\ - DEFINE_KSPROPERTY_ITEM(\ - KSPROPERTY_SERVICE_BUILDCACHE,\ - NULL,\ - sizeof(KSPROPERTY),\ - sizeof(L"\\\\?\\"),\ - (SetHandler),\ - NULL, 0, NULL, NULL, 0) - -#define DEFINE_KSPROPERTY_ITEM_SERVICE_MERIT(SetHandler)\ - DEFINE_KSPROPERTY_ITEM(\ - KSPROPERTY_SERVICE_MERIT,\ - NULL,\ - sizeof(KSPROPERTY),\ - sizeof(ULONG) + sizeof(L"\\\\?\\"),\ - (SetHandler),\ - NULL, 0, NULL, NULL, 0) - -#if defined(__cplusplus) -} -#endif // defined(__cplusplus) - -#endif // !_KSI_ - diff --git a/pub/ddk/lmstats.h b/pub/ddk/lmstats.h deleted file mode 100644 index d4ea345..0000000 --- a/pub/ddk/lmstats.h +++ /dev/null @@ -1,191 +0,0 @@ -/*++ BUILD Version: 0001 // Increment this if a change has global effects - -Copyright (c) 1991-1999 Microsoft Corporation - -Module Name: - - lmstats.h - -Abstract: - - This module defines the API function prototypes and data structures - for the following groups of NT API functions: - NetStatistics - -Environment: - - User Mode - Win32 - -Notes: - - You must include NETCONS.H before this file, since this file depends - on values defined in NETCONS.H. - ---*/ - -#ifndef _LMSTATS_ -#define _LMSTATS_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -// -// Function Prototypes - Statistics -// - -NET_API_STATUS NET_API_FUNCTION -NetStatisticsGet ( - __in LPTSTR ServerName, - __in LPTSTR Service, - __in DWORD Level, - __in DWORD Options, - __deref_out LPBYTE *Buffer - ); - -// -// Data Structures - Statistics -// - -#ifdef LM20_WORKSTATION_STATISTICS -typedef struct _STAT_WORKSTATION_0 { - DWORD stw0_start; - DWORD stw0_numNCB_r; - DWORD stw0_numNCB_s; - DWORD stw0_numNCB_a; - DWORD stw0_fiNCB_r; - DWORD stw0_fiNCB_s; - DWORD stw0_fiNCB_a; - DWORD stw0_fcNCB_r; - DWORD stw0_fcNCB_s; - DWORD stw0_fcNCB_a; - DWORD stw0_sesstart; - DWORD stw0_sessfailcon; - DWORD stw0_sessbroke; - DWORD stw0_uses; - DWORD stw0_usefail; - DWORD stw0_autorec; - DWORD stw0_bytessent_r_lo; - DWORD stw0_bytessent_r_hi; - DWORD stw0_bytesrcvd_r_lo; - DWORD stw0_bytesrcvd_r_hi; - DWORD stw0_bytessent_s_lo; - DWORD stw0_bytessent_s_hi; - DWORD stw0_bytesrcvd_s_lo; - DWORD stw0_bytesrcvd_s_hi; - DWORD stw0_bytessent_a_lo; - DWORD stw0_bytessent_a_hi; - DWORD stw0_bytesrcvd_a_lo; - DWORD stw0_bytesrcvd_a_hi; - DWORD stw0_reqbufneed; - DWORD stw0_bigbufneed; -} STAT_WORKSTATION_0, *PSTAT_WORKSTATION_0, *LPSTAT_WORKSTATION_0; -#else - -// -// NB: The following structure is REDIR_STATISTICS in sdk\inc\ntddnfs.h. If you -// change the structure, change it in both places -// - -typedef struct _STAT_WORKSTATION_0 { - LARGE_INTEGER StatisticsStartTime; - - LARGE_INTEGER BytesReceived; - LARGE_INTEGER SmbsReceived; - LARGE_INTEGER PagingReadBytesRequested; - LARGE_INTEGER NonPagingReadBytesRequested; - LARGE_INTEGER CacheReadBytesRequested; - LARGE_INTEGER NetworkReadBytesRequested; - - LARGE_INTEGER BytesTransmitted; - LARGE_INTEGER SmbsTransmitted; - LARGE_INTEGER PagingWriteBytesRequested; - LARGE_INTEGER NonPagingWriteBytesRequested; - LARGE_INTEGER CacheWriteBytesRequested; - LARGE_INTEGER NetworkWriteBytesRequested; - - DWORD InitiallyFailedOperations; - DWORD FailedCompletionOperations; - - DWORD ReadOperations; - DWORD RandomReadOperations; - DWORD ReadSmbs; - DWORD LargeReadSmbs; - DWORD SmallReadSmbs; - - DWORD WriteOperations; - DWORD RandomWriteOperations; - DWORD WriteSmbs; - DWORD LargeWriteSmbs; - DWORD SmallWriteSmbs; - - DWORD RawReadsDenied; - DWORD RawWritesDenied; - - DWORD NetworkErrors; - - // Connection/Session counts - DWORD Sessions; - DWORD FailedSessions; - DWORD Reconnects; - DWORD CoreConnects; - DWORD Lanman20Connects; - DWORD Lanman21Connects; - DWORD LanmanNtConnects; - DWORD ServerDisconnects; - DWORD HungSessions; - DWORD UseCount; - DWORD FailedUseCount; - - // - // Queue Lengths (updates protected by RdrMpxTableSpinLock NOT - // RdrStatisticsSpinlock) - // - - DWORD CurrentCommands; - -} STAT_WORKSTATION_0, *PSTAT_WORKSTATION_0, *LPSTAT_WORKSTATION_0; -#endif - -typedef struct _STAT_SERVER_0 { - DWORD sts0_start; - DWORD sts0_fopens; - DWORD sts0_devopens; - DWORD sts0_jobsqueued; - DWORD sts0_sopens; - DWORD sts0_stimedout; - DWORD sts0_serrorout; - DWORD sts0_pwerrors; - DWORD sts0_permerrors; - DWORD sts0_syserrors; - DWORD sts0_bytessent_low; - DWORD sts0_bytessent_high; - DWORD sts0_bytesrcvd_low; - DWORD sts0_bytesrcvd_high; - DWORD sts0_avresponse; - DWORD sts0_reqbufneed; - DWORD sts0_bigbufneed; -} STAT_SERVER_0, *PSTAT_SERVER_0, *LPSTAT_SERVER_0; - - -// -// Special Values and Constants -// - -#define STATSOPT_CLR 1 -#define STATS_NO_VALUE ((unsigned long) -1L) -#define STATS_OVERFLOW ((unsigned long) -2L) - - -#ifdef __cplusplus -} -#endif - -#endif // _LMSTATS.H - diff --git a/pub/ddk/lmuseflg.h b/pub/ddk/lmuseflg.h deleted file mode 100644 index ec69546..0000000 --- a/pub/ddk/lmuseflg.h +++ /dev/null @@ -1,43 +0,0 @@ -/*++ BUILD Version: 0001 // Increment this if a change has global effects - -Copyright (c) 1991-1999 Microsoft Corporation - -Module Name: - - lmuseflg.h - -Abstract: - - This file contains deletion force levels for deleting a connection. - -Environment: - - User Mode - Win32 - -Notes: - - This file has no dependencies. It is included by lmwksta.h and - lmuse.h. - -Revision History: - ---*/ - -#ifndef _LMUSEFLG_ -#define _LMUSEFLG_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -// -// Definition for NetWkstaTransportDel and NetUseDel deletion force levels -// - -#define USE_NOFORCE 0 -#define USE_FORCE 1 -#define USE_LOTS_OF_FORCE 2 - - -#endif // _LMUSEFLG_ - diff --git a/pub/ddk/lmwksta.h b/pub/ddk/lmwksta.h deleted file mode 100644 index 8399690..0000000 --- a/pub/ddk/lmwksta.h +++ /dev/null @@ -1,545 +0,0 @@ -/*++ BUILD Version: 0006 // Increment this if a change has global effects - -Copyright (c) 1991-1999 Microsoft Corporation - -Module Name: - - lmwksta.h - -Abstract: - - This file contains structures, function prototypes, and definitions - for the NetWorkstation and NetWkstaTransport API. - -Environment: - - User Mode - Win32 - Portable to any flat, 32-bit environment. (Uses Win32 typedefs.) - Requires ANSI C extensions: slash-slash comments, long external names. - -Notes: - - You must include NETCONS.H before this file, since this file depends - on values defined in NETCONS.H. - ---*/ - -#ifndef _LMWKSTA_ -#define _LMWKSTA_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include // Deletion force level flags - -// -// Function Prototypes -// - -NET_API_STATUS NET_API_FUNCTION -NetWkstaGetInfo ( - __in_opt IN LMSTR servername OPTIONAL, - IN DWORD level, - __deref_opt_out_xcount("size varies with level") OUT LPBYTE *bufptr - ); - -NET_API_STATUS NET_API_FUNCTION -NetWkstaSetInfo ( - __in_opt IN LMSTR servername OPTIONAL, - IN DWORD level, - IN LPBYTE buffer, - __out_opt OUT LPDWORD parm_err OPTIONAL - ); - -NET_API_STATUS NET_API_FUNCTION -NetWkstaUserGetInfo ( - __in_opt IN LMSTR reserved, - IN DWORD level, - __out_opt OUT LPBYTE *bufptr - ); - -NET_API_STATUS NET_API_FUNCTION -NetWkstaUserSetInfo ( - __in_opt IN LMSTR reserved, - IN DWORD level, - OUT LPBYTE buf, - __out_opt OUT LPDWORD parm_err OPTIONAL - ); - -NET_API_STATUS NET_API_FUNCTION -NetWkstaUserEnum ( - __in_opt LMSTR servername OPTIONAL, - IN DWORD level, - __out_opt LPBYTE *bufptr, - IN DWORD prefmaxlen, - __out_opt LPDWORD entriesread, - __out LPDWORD totalentries, - __inout_opt LPDWORD resumehandle OPTIONAL - ); - -NET_API_STATUS NET_API_FUNCTION -NetWkstaTransportAdd ( - __in_opt LMSTR servername OPTIONAL, - IN DWORD level, - __in LPBYTE buf, - __out_opt LPDWORD parm_err - ); - -NET_API_STATUS NET_API_FUNCTION -NetWkstaTransportDel ( - __in_opt IN LMSTR servername OPTIONAL, - __in_opt IN LMSTR transportname, - IN DWORD ucond - ); - -NET_API_STATUS NET_API_FUNCTION -NetWkstaTransportEnum ( - __in_opt LMSTR servername OPTIONAL, - IN DWORD level, - __out_opt LPBYTE *bufptr, - IN DWORD prefmaxlen, - __out_opt LPDWORD entriesread, - __out LPDWORD totalentries, - __inout_opt LPDWORD resumehandle OPTIONAL - ); - -// -// Data Structures -// - -// -// NetWkstaGetInfo and NetWkstaSetInfo -// - -// -// NetWkstaGetInfo only. System information - guest access -// -typedef struct _WKSTA_INFO_100 { - DWORD wki100_platform_id; - LMSTR wki100_computername; - LMSTR wki100_langroup; - DWORD wki100_ver_major; - DWORD wki100_ver_minor; -}WKSTA_INFO_100, *PWKSTA_INFO_100, *LPWKSTA_INFO_100; - -// -// NetWkstaGetInfo only. System information - user access -// -typedef struct _WKSTA_INFO_101 { - DWORD wki101_platform_id; - LMSTR wki101_computername; - LMSTR wki101_langroup; - DWORD wki101_ver_major; - DWORD wki101_ver_minor; - LMSTR wki101_lanroot; -}WKSTA_INFO_101, *PWKSTA_INFO_101, *LPWKSTA_INFO_101; - -// -// NetWkstaGetInfo only. System information - admin or operator access -// -typedef struct _WKSTA_INFO_102 { - DWORD wki102_platform_id; - LMSTR wki102_computername; - LMSTR wki102_langroup; - DWORD wki102_ver_major; - DWORD wki102_ver_minor; - LMSTR wki102_lanroot; - DWORD wki102_logged_on_users; -}WKSTA_INFO_102, *PWKSTA_INFO_102, *LPWKSTA_INFO_102; - -// -// Down-level NetWkstaGetInfo and NetWkstaSetInfo. -// -// DOS specific workstation information - -// admin or domain operator access -// -typedef struct _WKSTA_INFO_302{ - DWORD wki302_char_wait; - DWORD wki302_collection_time; - DWORD wki302_maximum_collection_count; - DWORD wki302_keep_conn; - DWORD wki302_keep_search; - DWORD wki302_max_cmds; - DWORD wki302_num_work_buf; - DWORD wki302_siz_work_buf; - DWORD wki302_max_wrk_cache; - DWORD wki302_sess_timeout; - DWORD wki302_siz_error; - DWORD wki302_num_alerts; - DWORD wki302_num_services; - DWORD wki302_errlog_sz; - DWORD wki302_print_buf_time; - DWORD wki302_num_char_buf; - DWORD wki302_siz_char_buf; - LMSTR wki302_wrk_heuristics; - DWORD wki302_mailslots; - DWORD wki302_num_dgram_buf; -}WKSTA_INFO_302, *PWKSTA_INFO_302, *LPWKSTA_INFO_302; - -// -// Down-level NetWkstaGetInfo and NetWkstaSetInfo -// -// OS/2 specific workstation information - -// admin or domain operator access -// -typedef struct _WKSTA_INFO_402{ - DWORD wki402_char_wait; - DWORD wki402_collection_time; - DWORD wki402_maximum_collection_count; - DWORD wki402_keep_conn; - DWORD wki402_keep_search; - DWORD wki402_max_cmds; - DWORD wki402_num_work_buf; - DWORD wki402_siz_work_buf; - DWORD wki402_max_wrk_cache; - DWORD wki402_sess_timeout; - DWORD wki402_siz_error; - DWORD wki402_num_alerts; - DWORD wki402_num_services; - DWORD wki402_errlog_sz; - DWORD wki402_print_buf_time; - DWORD wki402_num_char_buf; - DWORD wki402_siz_char_buf; - LMSTR wki402_wrk_heuristics; - DWORD wki402_mailslots; - DWORD wki402_num_dgram_buf; - DWORD wki402_max_threads; -}WKSTA_INFO_402, *PWKSTA_INFO_402, *LPWKSTA_INFO_402; - -// -// Same-level NetWkstaGetInfo and NetWkstaSetInfo. -// -// NT specific workstation information - -// admin or domain operator access -// -typedef struct _WKSTA_INFO_502{ - DWORD wki502_char_wait; - DWORD wki502_collection_time; - DWORD wki502_maximum_collection_count; - DWORD wki502_keep_conn; - DWORD wki502_max_cmds; - DWORD wki502_sess_timeout; - DWORD wki502_siz_char_buf; - DWORD wki502_max_threads; - - DWORD wki502_lock_quota; - DWORD wki502_lock_increment; - DWORD wki502_lock_maximum; - DWORD wki502_pipe_increment; - DWORD wki502_pipe_maximum; - DWORD wki502_cache_file_timeout; - DWORD wki502_dormant_file_limit; - DWORD wki502_read_ahead_throughput; - - DWORD wki502_num_mailslot_buffers; - DWORD wki502_num_srv_announce_buffers; - DWORD wki502_max_illegal_datagram_events; - DWORD wki502_illegal_datagram_event_reset_frequency; - BOOL wki502_log_election_packets; - - BOOL wki502_use_opportunistic_locking; - BOOL wki502_use_unlock_behind; - BOOL wki502_use_close_behind; - BOOL wki502_buf_named_pipes; - BOOL wki502_use_lock_read_unlock; - BOOL wki502_utilize_nt_caching; - BOOL wki502_use_raw_read; - BOOL wki502_use_raw_write; - BOOL wki502_use_write_raw_data; - BOOL wki502_use_encryption; - BOOL wki502_buf_files_deny_write; - BOOL wki502_buf_read_only_files; - BOOL wki502_force_core_create_mode; - BOOL wki502_use_512_byte_max_transfer; -}WKSTA_INFO_502, *PWKSTA_INFO_502, *LPWKSTA_INFO_502; - - -// -// The following info-levels are only valid for NetWkstaSetInfo -// - -// -// The following levels are supported on down-level systems (LAN Man 2.x) -// as well as NT systems: -// -typedef struct _WKSTA_INFO_1010 { - DWORD wki1010_char_wait; -} WKSTA_INFO_1010, *PWKSTA_INFO_1010, *LPWKSTA_INFO_1010; - -typedef struct _WKSTA_INFO_1011 { - DWORD wki1011_collection_time; -} WKSTA_INFO_1011, *PWKSTA_INFO_1011, *LPWKSTA_INFO_1011; - -typedef struct _WKSTA_INFO_1012 { - DWORD wki1012_maximum_collection_count; -} WKSTA_INFO_1012, *PWKSTA_INFO_1012, *LPWKSTA_INFO_1012; - -// -// The following level are supported on down-level systems (LAN Man 2.x) -// only: -// -typedef struct _WKSTA_INFO_1027 { - DWORD wki1027_errlog_sz; -} WKSTA_INFO_1027, *PWKSTA_INFO_1027, *LPWKSTA_INFO_1027; - -typedef struct _WKSTA_INFO_1028 { - DWORD wki1028_print_buf_time; -} WKSTA_INFO_1028, *PWKSTA_INFO_1028, *LPWKSTA_INFO_1028; - -typedef struct _WKSTA_INFO_1032 { - DWORD wki1032_wrk_heuristics; -} WKSTA_INFO_1032, *PWKSTA_INFO_1032, *LPWKSTA_INFO_1032; - -// -// The following levels are settable on NT systems, and have no -// effect on down-level systems (i.e. LANMan 2.x) since these -// fields cannot be set on them: -// -typedef struct _WKSTA_INFO_1013 { - DWORD wki1013_keep_conn; -} WKSTA_INFO_1013, *PWKSTA_INFO_1013, *LPWKSTA_INFO_1013; - -typedef struct _WKSTA_INFO_1018 { - DWORD wki1018_sess_timeout; -} WKSTA_INFO_1018, *PWKSTA_INFO_1018, *LPWKSTA_INFO_1018; - -typedef struct _WKSTA_INFO_1023 { - DWORD wki1023_siz_char_buf; -} WKSTA_INFO_1023, *PWKSTA_INFO_1023, *LPWKSTA_INFO_1023; - -typedef struct _WKSTA_INFO_1033 { - DWORD wki1033_max_threads; -} WKSTA_INFO_1033, *PWKSTA_INFO_1033, *LPWKSTA_INFO_1033; - -// -// The following levels are only supported on NT systems: -// -typedef struct _WKSTA_INFO_1041 { - DWORD wki1041_lock_quota; -} WKSTA_INFO_1041, *PWKSTA_INFO_1041, *LPWKSTA_INFO_1041; - -typedef struct _WKSTA_INFO_1042 { - DWORD wki1042_lock_increment; -} WKSTA_INFO_1042, *PWKSTA_INFO_1042, *LPWKSTA_INFO_1042; - -typedef struct _WKSTA_INFO_1043 { - DWORD wki1043_lock_maximum; -} WKSTA_INFO_1043, *PWKSTA_INFO_1043, *LPWKSTA_INFO_1043; - -typedef struct _WKSTA_INFO_1044 { - DWORD wki1044_pipe_increment; -} WKSTA_INFO_1044, *PWKSTA_INFO_1044, *LPWKSTA_INFO_1044; - -typedef struct _WKSTA_INFO_1045 { - DWORD wki1045_pipe_maximum; -} WKSTA_INFO_1045, *PWKSTA_INFO_1045, *LPWKSTA_INFO_1045; - -typedef struct _WKSTA_INFO_1046 { - DWORD wki1046_dormant_file_limit; -} WKSTA_INFO_1046, *PWKSTA_INFO_1046, *LPWKSTA_INFO_1046; - -typedef struct _WKSTA_INFO_1047 { - DWORD wki1047_cache_file_timeout; -} WKSTA_INFO_1047, *PWKSTA_INFO_1047, *LPWKSTA_INFO_1047; - -typedef struct _WKSTA_INFO_1048 { - BOOL wki1048_use_opportunistic_locking; -} WKSTA_INFO_1048, *PWKSTA_INFO_1048, *LPWKSTA_INFO_1048; - -typedef struct _WKSTA_INFO_1049 { - BOOL wki1049_use_unlock_behind; -} WKSTA_INFO_1049, *PWKSTA_INFO_1049, *LPWKSTA_INFO_1049; - -typedef struct _WKSTA_INFO_1050 { - BOOL wki1050_use_close_behind; -} WKSTA_INFO_1050, *PWKSTA_INFO_1050, *LPWKSTA_INFO_1050; - -typedef struct _WKSTA_INFO_1051 { - BOOL wki1051_buf_named_pipes; -} WKSTA_INFO_1051, *PWKSTA_INFO_1051, *LPWKSTA_INFO_1051; - -typedef struct _WKSTA_INFO_1052 { - BOOL wki1052_use_lock_read_unlock; -} WKSTA_INFO_1052, *PWKSTA_INFO_1052, *LPWKSTA_INFO_1052; - -typedef struct _WKSTA_INFO_1053 { - BOOL wki1053_utilize_nt_caching; -} WKSTA_INFO_1053, *PWKSTA_INFO_1053, *LPWKSTA_INFO_1053; - -typedef struct _WKSTA_INFO_1054 { - BOOL wki1054_use_raw_read; -} WKSTA_INFO_1054, *PWKSTA_INFO_1054, *LPWKSTA_INFO_1054; - -typedef struct _WKSTA_INFO_1055 { - BOOL wki1055_use_raw_write; -} WKSTA_INFO_1055, *PWKSTA_INFO_1055, *LPWKSTA_INFO_1055; - -typedef struct _WKSTA_INFO_1056 { - BOOL wki1056_use_write_raw_data; -} WKSTA_INFO_1056, *PWKSTA_INFO_1056, *LPWKSTA_INFO_1056; - -typedef struct _WKSTA_INFO_1057 { - BOOL wki1057_use_encryption; -} WKSTA_INFO_1057, *PWKSTA_INFO_1057, *LPWKSTA_INFO_1057; - -typedef struct _WKSTA_INFO_1058 { - BOOL wki1058_buf_files_deny_write; -} WKSTA_INFO_1058, *PWKSTA_INFO_1058, *LPWKSTA_INFO_1058; - -typedef struct _WKSTA_INFO_1059 { - BOOL wki1059_buf_read_only_files; -} WKSTA_INFO_1059, *PWKSTA_INFO_1059, *LPWKSTA_INFO_1059; - -typedef struct _WKSTA_INFO_1060 { - BOOL wki1060_force_core_create_mode; -} WKSTA_INFO_1060, *PWKSTA_INFO_1060, *LPWKSTA_INFO_1060; - -typedef struct _WKSTA_INFO_1061 { - BOOL wki1061_use_512_byte_max_transfer; -} WKSTA_INFO_1061, *PWKSTA_INFO_1061, *LPWKSTA_INFO_1061; - -typedef struct _WKSTA_INFO_1062 { - DWORD wki1062_read_ahead_throughput; -} WKSTA_INFO_1062, *PWKSTA_INFO_1062, *LPWKSTA_INFO_1062; - - -// -// NetWkstaUserGetInfo (local only) and NetWkstaUserEnum - -// no access restrictions. -// -typedef struct _WKSTA_USER_INFO_0 { - LMSTR wkui0_username; -}WKSTA_USER_INFO_0, *PWKSTA_USER_INFO_0, *LPWKSTA_USER_INFO_0; - -// -// NetWkstaUserGetInfo (local only) and NetWkstaUserEnum - -// no access restrictions. -// -typedef struct _WKSTA_USER_INFO_1 { - LMSTR wkui1_username; - LMSTR wkui1_logon_domain; - LMSTR wkui1_oth_domains; - LMSTR wkui1_logon_server; -}WKSTA_USER_INFO_1, *PWKSTA_USER_INFO_1, *LPWKSTA_USER_INFO_1; - -// -// NetWkstaUserSetInfo - local access. -// -typedef struct _WKSTA_USER_INFO_1101 { - LMSTR wkui1101_oth_domains; -} WKSTA_USER_INFO_1101, *PWKSTA_USER_INFO_1101, - *LPWKSTA_USER_INFO_1101; - - -// -// NetWkstaTransportAdd - admin access -// -typedef struct _WKSTA_TRANSPORT_INFO_0 { - DWORD wkti0_quality_of_service; - DWORD wkti0_number_of_vcs; - LMSTR wkti0_transport_name; - LMSTR wkti0_transport_address; - BOOL wkti0_wan_ish; -}WKSTA_TRANSPORT_INFO_0, *PWKSTA_TRANSPORT_INFO_0, - *LPWKSTA_TRANSPORT_INFO_0; - - -// -// Special Values and Constants -// - -// -// Identifiers for use as NetWkstaSetInfo parmnum parameter -// - -// -// One of these values indicates the parameter within an information -// structure that is invalid when ERROR_INVALID_PARAMETER is returned by -// NetWkstaSetInfo. -// - -#define WKSTA_PLATFORM_ID_PARMNUM 100 -#define WKSTA_COMPUTERNAME_PARMNUM 1 -#define WKSTA_LANGROUP_PARMNUM 2 -#define WKSTA_VER_MAJOR_PARMNUM 4 -#define WKSTA_VER_MINOR_PARMNUM 5 -#define WKSTA_LOGGED_ON_USERS_PARMNUM 6 -#define WKSTA_LANROOT_PARMNUM 7 -#define WKSTA_LOGON_DOMAIN_PARMNUM 8 -#define WKSTA_LOGON_SERVER_PARMNUM 9 -#define WKSTA_CHARWAIT_PARMNUM 10 // Supported by down-level. -#define WKSTA_CHARTIME_PARMNUM 11 // Supported by down-level. -#define WKSTA_CHARCOUNT_PARMNUM 12 // Supported by down-level. -#define WKSTA_KEEPCONN_PARMNUM 13 -#define WKSTA_KEEPSEARCH_PARMNUM 14 -#define WKSTA_MAXCMDS_PARMNUM 15 -#define WKSTA_NUMWORKBUF_PARMNUM 16 -#define WKSTA_MAXWRKCACHE_PARMNUM 17 -#define WKSTA_SESSTIMEOUT_PARMNUM 18 -#define WKSTA_SIZERROR_PARMNUM 19 -#define WKSTA_NUMALERTS_PARMNUM 20 -#define WKSTA_NUMSERVICES_PARMNUM 21 -#define WKSTA_NUMCHARBUF_PARMNUM 22 -#define WKSTA_SIZCHARBUF_PARMNUM 23 -#define WKSTA_ERRLOGSZ_PARMNUM 27 // Supported by down-level. -#define WKSTA_PRINTBUFTIME_PARMNUM 28 // Supported by down-level. -#define WKSTA_SIZWORKBUF_PARMNUM 29 -#define WKSTA_MAILSLOTS_PARMNUM 30 -#define WKSTA_NUMDGRAMBUF_PARMNUM 31 -#define WKSTA_WRKHEURISTICS_PARMNUM 32 // Supported by down-level. -#define WKSTA_MAXTHREADS_PARMNUM 33 - -#define WKSTA_LOCKQUOTA_PARMNUM 41 -#define WKSTA_LOCKINCREMENT_PARMNUM 42 -#define WKSTA_LOCKMAXIMUM_PARMNUM 43 -#define WKSTA_PIPEINCREMENT_PARMNUM 44 -#define WKSTA_PIPEMAXIMUM_PARMNUM 45 -#define WKSTA_DORMANTFILELIMIT_PARMNUM 46 -#define WKSTA_CACHEFILETIMEOUT_PARMNUM 47 -#define WKSTA_USEOPPORTUNISTICLOCKING_PARMNUM 48 -#define WKSTA_USEUNLOCKBEHIND_PARMNUM 49 -#define WKSTA_USECLOSEBEHIND_PARMNUM 50 -#define WKSTA_BUFFERNAMEDPIPES_PARMNUM 51 -#define WKSTA_USELOCKANDREADANDUNLOCK_PARMNUM 52 -#define WKSTA_UTILIZENTCACHING_PARMNUM 53 -#define WKSTA_USERAWREAD_PARMNUM 54 -#define WKSTA_USERAWWRITE_PARMNUM 55 -#define WKSTA_USEWRITERAWWITHDATA_PARMNUM 56 -#define WKSTA_USEENCRYPTION_PARMNUM 57 -#define WKSTA_BUFFILESWITHDENYWRITE_PARMNUM 58 -#define WKSTA_BUFFERREADONLYFILES_PARMNUM 59 -#define WKSTA_FORCECORECREATEMODE_PARMNUM 60 -#define WKSTA_USE512BYTESMAXTRANSFER_PARMNUM 61 -#define WKSTA_READAHEADTHRUPUT_PARMNUM 62 - - -// -// One of these values indicates the parameter within an information -// structure that is invalid when ERROR_INVALID_PARAMETER is returned by -// NetWkstaUserSetInfo. -// - -#define WKSTA_OTH_DOMAINS_PARMNUM 101 - - -// -// One of these values indicates the parameter within an information -// structure that is invalid when ERROR_INVALID_PARAMETER is returned by -// NetWkstaTransportAdd. -// - -#define TRANSPORT_QUALITYOFSERVICE_PARMNUM 201 -#define TRANSPORT_NAME_PARMNUM 202 - -#ifdef __cplusplus -} -#endif - -#endif // _LMWKSTA_ - diff --git a/pub/ddk/lowio.h b/pub/ddk/lowio.h deleted file mode 100644 index 4af3199..0000000 --- a/pub/ddk/lowio.h +++ /dev/null @@ -1,88 +0,0 @@ -/*++ - -Copyright (c) 1989 Microsoft Corporation - -Module Name: - - lowio.h - -Abstract: - - This module defines all of the structures and prototypes for Low IO. - -Author: -Revision History: - ---*/ - -#ifndef _RXLOWIO_ -#define _RXLOWIO_ - -#include "mrx.h" // mini redirector related definitions .... - -#ifndef WIN9X -extern FAST_MUTEX RxLowIoPagingIoSyncMutex; -#endif - -#define RxLowIoIsMdlLocked(MDL) ( \ - RxMdlIsLocked((MDL)) || RxMdlSourceIsNonPaged((MDL)) \ - ) - -#define RxLowIoIsBufferLocked(LOWIOCONTEXT) \ - ( ((LOWIOCONTEXT)->Operation > LOWIO_OP_WRITE ) || \ - ((LOWIOCONTEXT)->ParamsFor.ReadWrite.Buffer == NULL) || \ - ( \ - ((LOWIOCONTEXT)->ParamsFor.ReadWrite.Buffer != NULL) && \ - RxLowIoIsMdlLocked(((LOWIOCONTEXT)->ParamsFor.ReadWrite.Buffer)) \ - ) \ - ) - -typedef struct _LOWIO_PER_FCB_INFO { - LIST_ENTRY PagingIoReadsOutstanding; - LIST_ENTRY PagingIoWritesOutstanding; -} LOWIO_PER_FCB_INFO, *PLOWIO_PER_FCB_INFO; - -PVOID -NTAPI -RxLowIoGetBufferAddress ( - IN PRX_CONTEXT RxContext - ); - -NTSTATUS -NTAPI -RxLowIoPopulateFsctlInfo ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp - ); - -NTSTATUS -NTAPI -RxLowIoSubmit ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp, - IN PFCB Fcb, - IN PLOWIO_COMPLETION_ROUTINE CompletionRoutine - ); - -NTSTATUS -NTAPI -RxLowIoCompletion ( - PRX_CONTEXT RxContext - ); - -VOID -NTAPI -RxInitializeLowIoContext ( - IN PRX_CONTEXT RxContext, - IN ULONG Operation, - OUT PLOWIO_CONTEXT LowIoContext - ); - -VOID -RxInitializeLowIoPerFcbInfo ( - PLOWIO_PER_FCB_INFO LowIoPerFcbInfo - ); - - -#endif // _RXLOWIO_ - diff --git a/pub/ddk/mcd.h b/pub/ddk/mcd.h deleted file mode 100644 index 852b8e7..0000000 --- a/pub/ddk/mcd.h +++ /dev/null @@ -1,471 +0,0 @@ - -/*++ - -Copyright (C) Microsoft Corporation, 1996 - 1998 - -Module Name: - - mcd.h - -Abstract: - - These are the structures and defines that are used in the - changer class drivers. The changer class driver is separated - into two modules. Mcd.c contains code common to all medium - changer drivers including the driver's major entry points. - - -Environment: - - Kernel mode - -Revision History : - ---*/ - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4201) // named type definition in parentheses -#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int - -#include "scsi.h" -#include "ntddchgr.h" -#include - -#if (NTDDI_VERSION >= NTDDI_WINXP) -#include -#include -#endif - -#ifdef DebugPrint -#undef DebugPrint -#endif - -#if DBG -#if (NTDDI_VERSION < NTDDI_WINXP) -#define DebugPrint(x) MCDebugPrint x -#else -#define DebugPrint(x) ChangerClassDebugPrint x -#endif -#else -#define DebugPrint(x) -#endif - -#define MAXIMUM_CHANGER_INQUIRY_DATA 252 - -#if (NTDDI_VERSION >= NTDDI_WINXP) -typedef -NTSTATUS -(*CHANGER_COMMAND_ROUTINE)( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -typedef -ULONG -(*CHANGER_EXTENSION_SIZE)( - __in VOID - ); - -typedef -NTSTATUS -(*CHANGER_INITIALIZE)( - __in PDEVICE_OBJECT DeviceObject - ); - -typedef -NTSTATUS -(*CHANGER_PERFORM_DIAGNOSTICS)( - __in PDEVICE_OBJECT DeviceObject, - __out PWMI_CHANGER_PROBLEM_DEVICE_ERROR changerDeviceError - ); - -typedef -VOID -(*CHANGER_ERROR_ROUTINE)( - __in PDEVICE_OBJECT DeviceObject, - __in PSCSI_REQUEST_BLOCK Srb, - __in NTSTATUS *Status, - __in BOOLEAN *Retry - ); - -typedef struct _MCD_INIT_DATA { - - // - // Size of this structure. - // - - ULONG InitDataSize; - - // - // To return the size of the minidriver extension - // - - CHANGER_EXTENSION_SIZE ChangerAdditionalExtensionSize; - - // - // To perform minidriver specific initialization - // - - CHANGER_INITIALIZE ChangerInitialize; - - // - // To perform minidriver specific error processing - // - - CHANGER_ERROR_ROUTINE ChangerError; - - // - // To perform diagnostic tests on the device - // - - CHANGER_PERFORM_DIAGNOSTICS ChangerPerformDiagnostics; - - // - // Minidriver dispatch routines - // - - CHANGER_COMMAND_ROUTINE ChangerGetParameters; - - CHANGER_COMMAND_ROUTINE ChangerGetStatus; - - CHANGER_COMMAND_ROUTINE ChangerGetProductData; - - CHANGER_COMMAND_ROUTINE ChangerSetAccess; - - CHANGER_COMMAND_ROUTINE ChangerGetElementStatus; - - CHANGER_COMMAND_ROUTINE ChangerInitializeElementStatus; - - CHANGER_COMMAND_ROUTINE ChangerSetPosition; - - CHANGER_COMMAND_ROUTINE ChangerExchangeMedium; - - CHANGER_COMMAND_ROUTINE ChangerMoveMedium; - - CHANGER_COMMAND_ROUTINE ChangerReinitializeUnit; - - CHANGER_COMMAND_ROUTINE ChangerQueryVolumeTags; - -} MCD_INIT_DATA, *PMCD_INIT_DATA; -#endif - -typedef struct _MODE_ELEMENT_ADDRESS_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PS : 1; - UCHAR PageLength; - UCHAR MediumTransportElementAddress[2]; - UCHAR NumberTransportElements[2]; - UCHAR FirstStorageElementAddress[2]; - UCHAR NumberStorageElements[2]; - UCHAR FirstIEPortElementAddress[2]; - UCHAR NumberIEPortElements[2]; - UCHAR FirstDataXFerElementAddress[2]; - UCHAR NumberDataXFerElements[2]; - UCHAR Reserved2[2]; - -} MODE_ELEMENT_ADDRESS_PAGE, *PMODE_ELEMENT_ADDRESS_PAGE; - -typedef struct _MODE_TRANSPORT_GEOMETRY_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PS : 1; - UCHAR PageLength; - UCHAR Flip : 1; - UCHAR Reserved2: 7; - UCHAR TransportElementNumber; - -} MODE_TRANSPORT_GEOMETRY_PAGE, *PMODE_TRANSPORT_GEOMETRY_PAGE; - -// -// Capabilities page decribes the various functions that the device -// supports. Used in GetParameters. -// - -typedef struct _MODE_DEVICE_CAPABILITIES_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PS : 1; - UCHAR PageLength; - UCHAR MediumTransport : 1; - UCHAR StorageLocation : 1; - UCHAR IEPort : 1; - UCHAR DataXFer : 1; - UCHAR Reserved2 : 4; - UCHAR Reserved3; - UCHAR MTtoMT : 1; - UCHAR MTtoST : 1; - UCHAR MTtoIE : 1; - UCHAR MTtoDT : 1; - UCHAR Reserved4 : 4; - UCHAR STtoMT : 1; - UCHAR STtoST : 1; - UCHAR STtoIE : 1; - UCHAR STtoDT : 1; - UCHAR Reserved5 : 4; - UCHAR IEtoMT : 1; - UCHAR IEtoST : 1; - UCHAR IEtoIE : 1; - UCHAR IEtoDT : 1; - UCHAR Reserved6 : 4; - UCHAR DTtoMT : 1; - UCHAR DTtoST : 1; - UCHAR DTtoIE : 1; - UCHAR DTtoDT : 1; - UCHAR Reserved7 : 4; - UCHAR Reserved8[4]; - UCHAR XMTtoMT : 1; - UCHAR XMTtoST : 1; - UCHAR XMTtoIE : 1; - UCHAR XMTtoDT : 1; - UCHAR Reserved9 : 4; - UCHAR XSTtoMT : 1; - UCHAR XSTtoST : 1; - UCHAR XSTtoIE : 1; - UCHAR XSTtoDT : 1; - UCHAR Reserved10 : 4; - UCHAR XIEtoMT : 1; - UCHAR XIEtoST : 1; - UCHAR XIEtoIE : 1; - UCHAR XIEtoDT : 1; - UCHAR Reserved11 : 4; - UCHAR XDTtoMT : 1; - UCHAR XDTtoST : 1; - UCHAR XDTtoIE : 1; - UCHAR XDTtoDT : 1; - UCHAR Reserved12 : 4; - -} MODE_DEVICE_CAPABILITIES_PAGE, *PMODE_DEVICE_CAPABILITIES_PAGE; - -#define MODE_PAGE_DISPLAY 0x22 - -// -// Structures describing return data from READ_ELEMENT_STATUS -// - -typedef struct _ELEMENT_STATUS_HEADER { - UCHAR FirstElementAddress[2]; - UCHAR NumberOfElements[2]; - UCHAR Reserved1; - UCHAR ReportByteCount[3]; -} ELEMENT_STATUS_HEADER, *PELEMENT_STATUS_HEADER; - -typedef struct _ELEMENT_STATUS_PAGE { - UCHAR ElementType; - UCHAR Reserved1 : 6; - UCHAR AVolTag : 1; - UCHAR PVolTag : 1; - UCHAR ElementDescriptorLength[2]; - UCHAR Reserved2; - UCHAR DescriptorByteCount[3]; -} ELEMENT_STATUS_PAGE, *PELEMENT_STATUS_PAGE; - - -typedef struct _ELEMENT_DESCRIPTOR { - UCHAR ElementAddress[2]; - UCHAR Full : 1; - UCHAR Reserved1 : 1; - UCHAR Exception : 1; - UCHAR Accessible : 1; - UCHAR Reserved2 : 4; - UCHAR Reserved3; - UCHAR AdditionalSenseCode; - UCHAR AddSenseCodeQualifier; - UCHAR Lun : 3; - UCHAR Reserved4 : 1; - UCHAR LunValid : 1; - UCHAR IdValid : 1; - UCHAR Reserved5 : 1; - UCHAR NotThisBus : 1; - UCHAR BusAddress; - UCHAR Reserved6; - UCHAR Reserved7 : 6; - UCHAR Invert : 1; - UCHAR SValid : 1; - UCHAR SourceStorageElementAddress[2]; -} ELEMENT_DESCRIPTOR, *PELEMENT_DESCRIPTOR; - - -// -// The following routines are the exported entry points for -// all changer class drivers. -// - -NTSTATUS -DriverEntry( - __in PDRIVER_OBJECT DriverObject, - __in PUNICODE_STRING RegistryPath - ); - -PVOID -ChangerClassAllocatePool( - __in POOL_TYPE PoolType, - __in ULONG NumberOfBytes - ); - -VOID -ChangerClassFreePool( - __in PVOID PoolToFree - ); - - -// -// The following routines are provided by the changer -// device-specific module. Each routine name is -// prefixed with 'Changer.' - - -ULONG -ChangerAdditionalExtensionSize( - VOID - ); - -NTSTATUS -ChangerInitialize( - __in PDEVICE_OBJECT DeviceObject - ); - -VOID -ChangerError( - PDEVICE_OBJECT DeviceObject, - PSCSI_REQUEST_BLOCK Srb, - NTSTATUS *Status, - BOOLEAN *Retry - ); - -NTSTATUS -ChangerGetParameters( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -NTSTATUS -ChangerGetStatus( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -NTSTATUS -ChangerGetProductData( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -NTSTATUS -ChangerSetAccess( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -NTSTATUS -ChangerGetElementStatus( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - - -NTSTATUS -ChangerInitializeElementStatus( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -NTSTATUS -ChangerSetPosition( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -NTSTATUS -ChangerExchangeMedium( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -NTSTATUS -ChangerMoveMedium( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -NTSTATUS -ChangerReinitializeUnit( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -NTSTATUS -ChangerQueryVolumeTags( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSTATUS -ChangerClassInitialize( - __in PDRIVER_OBJECT DriverObject, - __in PUNICODE_STRING RegistryPath, - __in PMCD_INIT_DATA ChangerInitData - ); - -NTSTATUS -ChangerPerformDiagnostics( - __in PDEVICE_OBJECT DeviceObject, - __out PWMI_CHANGER_PROBLEM_DEVICE_ERROR changerDeviceError - ); - -NTSTATUS -ChangerClassSendSrbSynchronous( - __in PDEVICE_OBJECT DeviceObject, - __in PSCSI_REQUEST_BLOCK Srb, - __in PVOID Buffer, - __in ULONG BufferSize, - __in BOOLEAN WriteToDevice - ); - -VOID -ChangerClassDebugPrint( - ULONG DebugPrintLevel, - PCCHAR DebugMessage, - ... - ); -#endif - -#if (NTDDI_VERSION < NTDDI_WINXP) -VOID -MCDebugPrint( - ULONG DebugPrintLevel, - PCCHAR DebugMessage, - ... - ); - -BOOLEAN -ChangerVerifyInquiry( - PINQUIRYDATA InquiryData - ); -#endif - -#if (NTDDI_VERSION < NTDDI_WS03) -NTSTATUS -ChangerClassCreate ( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -NTSTATUS -ChangerClassDeviceControl( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); -#endif - - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - diff --git a/pub/ddk/mce.h b/pub/ddk/mce.h deleted file mode 100644 index b23816c..0000000 --- a/pub/ddk/mce.h +++ /dev/null @@ -1,1391 +0,0 @@ -/*++ BUILD Version: 0011 // Increment this if a change has global effects - -Copyright (c) 1991-2001 Microsoft Corporation - -Module Name: - - mce.h - -Abstract: - - This header file defines the Machine Check Errors definitions. - -Author: - -Revision History: - - Creation: 04-Apr-2001 - ---*/ - -#ifndef _MCE_ -#define _MCE_ - -#pragma once - -// -// HalMcaLogInformation -// - -#if defined(_X86_) || defined(_IA64_) || defined(_AMD64_) - -// -// ADDR register for each MCA bank -// - -typedef union _MCI_ADDR{ - struct { - ULONG Address; - ULONG Reserved; - } DUMMYSTRUCTNAME; - - ULONGLONG QuadPart; -} MCI_ADDR, *PMCI_ADDR; - - -typedef enum { - HAL_MCE_RECORD, - HAL_MCA_RECORD -} MCA_EXCEPTION_TYPE; - - -#if defined(_AMD64_) - -// -// STATUS register for each MCA bank. -// - -#if (NTDDI_VERSION <= NTDDI_WINXP) -typedef union _MCI_STATS { - struct { - USHORT McaCod; - USHORT ModelErrorCode; - ULONG OtherInfo : 25; - ULONG Damage : 1; - ULONG AddressValid : 1; - ULONG MiscValid : 1; - ULONG Enabled : 1; - ULONG Uncorrected : 1; - ULONG OverFlow : 1; - ULONG Valid : 1; - } MciStatus; - - ULONG64 QuadPart; -} MCI_STATS, *PMCI_STATS; -#else -typedef union _MCI_STATS { - struct { - USHORT McaErrorCode; - USHORT ModelErrorCode; - ULONG OtherInformation : 25; - ULONG ContextCorrupt : 1; - ULONG AddressValid : 1; - ULONG MiscValid : 1; - ULONG ErrorEnabled : 1; - ULONG UncorrectedError : 1; - ULONG StatusOverFlow : 1; - ULONG Valid : 1; - } MciStatus; - - ULONG64 QuadPart; -} MCI_STATS, *PMCI_STATS; -#endif - -#endif // _AMD64_ - -#if defined(_X86_) - -// -// STATUS register for each MCA bank. -// - -typedef union _MCI_STATS { - struct { - USHORT McaCod; - USHORT MsCod; - ULONG OtherInfo : 25; - ULONG Damage : 1; - ULONG AddressValid : 1; - ULONG MiscValid : 1; - ULONG Enabled : 1; - ULONG UnCorrected : 1; - ULONG OverFlow : 1; - ULONG Valid : 1; - } MciStats; - - ULONGLONG QuadPart; - -} MCI_STATS, *PMCI_STATS; - -#endif // _X86_ - -// -// MCA exception log entry -// Defined as a union to contain MCA specific log or Pentium style MCE info. -// - -#define MCA_EXTREG_V2MAX 24 // X86: Max. Number of extended registers - -#if defined(_X86_) || defined(_AMD64_) - -#if (NTDDI_VERSION >= NTDDI_WINXP) -typedef struct _MCA_EXCEPTION { - - // Begin Version 1 stuff - ULONG VersionNumber; // Version number of this record type - MCA_EXCEPTION_TYPE ExceptionType; // MCA or MCE - LARGE_INTEGER TimeStamp; // exception recording timestamp - ULONG ProcessorNumber; - ULONG Reserved1; - - union { - struct { - UCHAR BankNumber; - UCHAR Reserved2[7]; - MCI_STATS Status; - MCI_ADDR Address; - ULONGLONG Misc; - } Mca; - - struct { - ULONGLONG Address; // physical addr of cycle causing the error - ULONGLONG Type; // cycle specification causing the error - } Mce; - } u; - // End Version 1 stuff - - // Begin Version 2 stuff - ULONG ExtCnt; - ULONG Reserved3; - ULONGLONG ExtReg[MCA_EXTREG_V2MAX]; - // End Version 2 stuff - -} MCA_EXCEPTION, *PMCA_EXCEPTION; -#else -typedef struct _MCA_EXCEPTION { - - ULONG VersionNumber; // Version number of this record type - MCA_EXCEPTION_TYPE ExceptionType; // MCA or MCE - LARGE_INTEGER TimeStamp; // exception recording timestamp - ULONG ProcessorNumber; - ULONG Reserved1; - - union { - struct { - UCHAR BankNumber; - UCHAR Reserved2[7]; - MCI_STATS Status; - MCI_ADDR Address; - ULONGLONG Misc; - } Mca; - - struct { - ULONGLONG Address; // physical addr of cycle causing the error - ULONGLONG Type; // cycle specification causing the error - } Mce; - } u; - -} MCA_EXCEPTION, *PMCA_EXCEPTION; -#endif - -typedef MCA_EXCEPTION CMC_EXCEPTION, *PCMC_EXCEPTION; // Corrected Machine Check -typedef MCA_EXCEPTION CPE_EXCEPTION, *PCPE_EXCEPTION; // Corrected Platform Error - -#if (NTDDI_VERSION >= NTDDI_WINXP) -#define MCA_EXCEPTION_V1_SIZE FIELD_OFFSET(MCA_EXCEPTION, ExtCnt) -#define MCA_EXCEPTION_V2_SIZE sizeof(struct _MCA_EXCEPTION) -#endif - -#endif // _X86_ || _AMD64_ - -// -// ERRORS: ERROR_SEVERITY definitions -// -// One day the MS compiler will support typed enums with type != int so this -// type of enums (UCHAR, __int64) could be defined... -// - -#if defined(_AMD64_) || defined(_IA64_) - -typedef UCHAR ERROR_SEVERITY, *PERROR_SEVERITY; - -typedef enum _ERROR_SEVERITY_VALUE { - ErrorRecoverable = 0, - ErrorFatal = 1, - ErrorCorrected = 2, - ErrorOthers = 3, // [3,...] values are reserved -} ERROR_SEVERITY_VALUE; - -#endif - -#if defined(_IA64_) - -#if 0 -// FIXFIX: This should not be required for IA64. -// -// STATUS register for each MCA bank. -// - -typedef union _MCI_STATS { - struct { - USHORT McaCod; - USHORT MsCod; - ULONG OtherInfo : 25; - ULONG Damage : 1; - ULONG AddressValid : 1; - ULONG MiscValid : 1; - ULONG Enabled : 1; - ULONG UnCorrected : 1; - ULONG OverFlow : 1; - ULONG Valid : 1; - } MciStats; - - ULONGLONG QuadPart; - -} MCI_STATS, *PMCI_STATS; - -#endif // 0 - -// -// IA64 ERRORS: ERROR_REVISION definitions -// - -typedef union _ERROR_REVISION { - USHORT Revision; // Major and Minor revision number of the record: - struct { - UCHAR Minor; // Byte0: Minor. - UCHAR Major; // Byte1: Major. - } DUMMYSTRUCTNAME; -} ERROR_REVISION, *PERROR_REVISION; - -// For Info: -#if (NTDDI_VERSION > NTDDI_WINXP) -#define ERROR_MAJOR_REVISION_SAL_03_00 0 -#define ERROR_MINOR_REVISION_SAL_03_00 2 -#define ERROR_REVISION_SAL_03_00 { ERROR_MINOR_REVISION_SAL_03_00, \ - ERROR_MAJOR_REVISION_SAL_03_00 } - -// -// Section Header revision is fixed at Major == 2 and Minor == 0 -// -#define ERROR_FIXED_SECTION_REVISION { 2,\ - 0 } -#else -#define ERROR_REVISION_SAL_03_00 { 2, 0 } -#endif - -// -// IA64 ERRORS: ERROR_TIMESTAMP definitions -// - -typedef union _ERROR_TIMESTAMP { - ULONGLONG TimeStamp; - struct { - UCHAR Seconds; // Byte0: Seconds - UCHAR Minutes; // Byte1: Minutes - UCHAR Hours; // Byte2: Hours - UCHAR Reserved; // Byte3: Reserved - UCHAR Day; // Byte4: Day - UCHAR Month; // Byte5: Month - UCHAR Year; // Byte6: Year - UCHAR Century; // Byte7: Century - } DUMMYSTRUCTNAME; -} ERROR_TIMESTAMP, *PERROR_TIMESTAMP; - -// -// IA64 ERRORS: ERROR_GUID definitions -// - -typedef struct _ERROR_GUID { - ULONG Data1; - USHORT Data2; - USHORT Data3; - UCHAR Data4[8]; -} ERROR_GUID, *PERROR_GUID; - -// -// IA64 ERRORS: ERROR GUIDs definitions -// - -typedef ERROR_GUID _ERROR_DEVICE_GUID; -typedef _ERROR_DEVICE_GUID ERROR_DEVICE_GUID, *PERROR_DEVICE_GUID; - -typedef ERROR_GUID _ERROR_PLATFORM_GUID; -typedef _ERROR_PLATFORM_GUID ERROR_PLATFORM_GUID, *PERROR_PLATFORM_GUID; - -// -// IA64 ERRORS: ERROR_RECORD_HEADER definitions -// - -typedef union _ERROR_RECORD_VALID { - UCHAR Valid; - struct { // Bits - UCHAR OemPlatformID:1; // 0: OEM Platform Id is present in the record header - UCHAR Reserved:7; // 1-7: Reserved - } DUMMYSTRUCTNAME; -} ERROR_RECORD_VALID, *PERROR_RECORD_VALID; - -typedef struct _ERROR_RECORD_HEADER { // Offsets: - ULONGLONG Id; // 0: Unique identifier - ERROR_REVISION Revision; // 8: Major and Minor revision number of the record - ERROR_SEVERITY ErrorSeverity; // 10: Error Severity - ERROR_RECORD_VALID Valid; // 11: Validation bits - ULONG Length; // 12: Length of this record in bytes, including the header - ERROR_TIMESTAMP TimeStamp; // 16: Timestamp recorded when event occured - UCHAR OemPlatformId[16]; // 24: Unique platform identifier. OEM defined. -} ERROR_RECORD_HEADER, *PERROR_RECORD_HEADER; - -// -// IA64 ERRORS: ERROR_SECTION_HEADER definitions -// - -typedef union _ERROR_RECOVERY_INFO { - UCHAR RecoveryInfo; - struct { // Bits: - UCHAR Corrected:1; // 0: Corrected - UCHAR NotContained:1; // 1: Containment Warning - UCHAR Reset:1; // 2: Reset - UCHAR Reserved:4; // 6-3: Reserved - UCHAR Valid:1; // 7: Valid Recovery Information - } DUMMYSTRUCTNAME; -} ERROR_RECOVERY_INFO, *PERROR_RECOVERY_INFO; - -typedef struct _ERROR_SECTION_HEADER { - ERROR_DEVICE_GUID Guid; // Unique identifier - ERROR_REVISION Revision; // Major and Minor revision number of the section - ERROR_RECOVERY_INFO RecoveryInfo; // Recovery Information - UCHAR Reserved; - ULONG Length; // Length of this error device section in bytes, - // including the header. -} ERROR_SECTION_HEADER, *PERROR_SECTION_HEADER; - -// -// IA64 Machine Check Error Logs: -// WMI requires processor LID being stored in the Log. -// This LID corresponds to the processor on which the SAL_PROC was executed on. -// -// TEMPTEMP: Implementation is temporary, until we implement HAL SW Error Section. -// Note that the current FW builds do not update the _ERROR_PROCESSOR.CRLid field, -// assuming there is a _ERROR_PROCESSOR section in the record. -// - -#if !defined(__midl) && defined(_MSC_EXTENSIONS) -__inline -USHORT -GetFwMceLogProcessorNumber( - PERROR_RECORD_HEADER Log - ) -{ - PERROR_SECTION_HEADER section = (PERROR_SECTION_HEADER)((ULONG64)Log + sizeof(*Log)); - USHORT lid = (USHORT)((UCHAR)(section->Reserved)); - lid |= (USHORT)((UCHAR)(Log->TimeStamp.Reserved) << 8); - return( lid ); -} // GetFwMceLogProcessorNumber() -#endif // !__midl - -// -// IA64 ERRORS: ERROR_PROCESSOR device definitions -// -// The MCA architecture supports five different types of error reporting functional units -// with the associated error records and its error severity. -// At any point in time, a processor could encounter an MCA/CMC event due to errors detected -// in one or more of the following units: -// - Cache Check -// - TLB Check -// - Bus Check -// - Register File -// - Micro Architectural -// -// Terminology: -// -// - Target Address: -// 64-bit integer containing the physical address where the data was to be delivered or -// obtained. This could also be the incoming address for external snoops and TLB shoot-downs. -// -// - Requestor Identifier: -// 64-bit integer specifying the bus agent that generated the transaction responsible for -// the Machine Check event. -// -// - Responder Identifier: -// 64-bit integer specifying the bus agent that responded to a transaction responsible for -// the Machine Check event. -// -// - Precise Instruction Pointer: -// 64-bit integer specifying the virtual address that points to the IA-64 bundle that -// contained the instruction responsible for the Machine Check event. -// - -#define ERROR_PROCESSOR_GUID \ - { 0xe429faf1, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }} - -typedef union _ERROR_MODINFO_VALID { - ULONGLONG Valid; - struct { // Bits - ULONGLONG CheckInfo: 1; // 0: - ULONGLONG RequestorIdentifier: 1; // 1: - ULONGLONG ResponderIdentifier: 1; // 2: - ULONGLONG TargetIdentifier: 1; // 3: - ULONGLONG PreciseIP: 1; // 4: - ULONGLONG Reserved: 59; // 5-63: - } DUMMYSTRUCTNAME; -} ERROR_MODINFO_VALID, *PERROR_MODINFO_VALID; - -typedef enum _ERROR_CHECK_IS { - isIA64 = 0, - isIA32 = 1, -} ERROR_CHECK_IS; - -typedef enum _ERROR_CACHE_CHECK_OPERATION { - CacheUnknownOp = 0, - CacheLoad = 1, - CacheStore = 2, - CacheInstructionFetch = 3, - CacheDataPrefetch = 4, - CacheSnoop = 5, - CacheCastOut = 6, - CacheMoveIn = 7, -} ERROR_CACHE_CHECK_OPERATION; - -typedef enum _ERROR_CACHE_CHECK_MESI { - CacheInvalid = 0, - CacheHeldShared = 1, - CacheHeldExclusive = 2, - CacheModified = 3, -} ERROR_CACHE_CHECK_MESI; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef union _ERROR_CACHE_CHECK { - ULONGLONG CacheCheck; - struct - { - ULONGLONG Operation:4; // bits 0- 3: Cache operation - ULONGLONG Level:2; // 4- 5: Cache Level - ULONGLONG Reserved1:2; // 6- 7 - ULONGLONG DataLine:1; // 8 : Failure data part of cache line - ULONGLONG TagLine:1; // 9 : Failure tag part of cache line - ULONGLONG DataCache:1; // 10 : Failure in data cache - ULONGLONG InstructionCache:1; // 11 : Failure in instruction cache - ULONGLONG MESI:3; // 12-14: - ULONGLONG MESIValid:1; // 15 : MESI field is valid - ULONGLONG Way:5; // 16-20: Failure in Way of Cache - ULONGLONG WayIndexValid:1; // 21 : Way and Index fields valid - ULONGLONG Reserved2:1; // 22 - ULONGLONG DP:1; // 23 : 1 - error due to data poisoning - ULONGLONG Reserved3:8; // 24-31 - ULONGLONG Index:20; // 32-51: Index of cache line - ULONGLONG Reserved4:2; // 52-53 - ULONGLONG InstructionSet:1; // 54 : 0 - IA64 instruction, 1- IA32 instruction - ULONGLONG InstructionSetValid:1; // 55 : InstructionSet field is valid - ULONGLONG PrivilegeLevel:2; // 56-57: Privlege level of instrustion - ULONGLONG PrivilegeLevelValid:1; // 58 : PrivilegeLevel field is Valid - ULONGLONG MachineCheckCorrected:1; // 59 : 1 - Machine Check Corrected - ULONGLONG TargetAddressValid:1; // 60 : Target Address is valid - ULONGLONG RequestIdValid:1; // 61 : RequestId is valid - ULONGLONG ResponderIdValid:1; // 62 : ResponderId is valid - ULONGLONG PreciseIPValid:1; // 63 : Precise Inststruction Pointer is Valid - } DUMMYSTRUCTNAME; -} ERROR_CACHE_CHECK, *PERROR_CACHE_CHECK; -# else -typedef union _ERROR_CACHE_CHECK { - ULONGLONG CacheCheck; - struct - { - ULONGLONG Operation:4; // bits 0- 3: Cache operation - ULONGLONG Level:2; // 4- 5: Cache Level - ULONGLONG Reserved1:2; // 6- 7 - ULONGLONG DataLine:1; // 8 : Failure data part of cache line - ULONGLONG TagLine:1; // 9 : Failure tag part of cache line - ULONGLONG DataCache:1; // 10 : Failure in data cache - ULONGLONG InstructionCache:1; // 11 : Failure in instruction cache - ULONGLONG MESI:3; // 12-14: - ULONGLONG MESIValid:1; // 15 : MESI field is valid - ULONGLONG Way:5; // 16-20: Failure in Way of Cache - ULONGLONG WayIndexValid:1; // 21 : Way and Index fields valid - ULONGLONG Reserved2:10; // 22-31 - ULONGLONG Index:20; // 32-51: Index of cache line - ULONGLONG Reserved3:2; // 52-53 - ULONGLONG InstructionSet:1; // 54 : 0 - IA64 instruction, 1- IA32 instruction - ULONGLONG InstructionSetValid:1; // 55 : InstructionSet field is valid - ULONGLONG PrivilegeLevel:2; // 56-57: Privlege level of instrustion - ULONGLONG PrivilegeLevelValid:1; // 58 : PrivilegeLevel field is Valid - ULONGLONG MachineCheckCorrected:1; // 59 : 1 - Machine Check Corrected - ULONGLONG TargetAddressValid:1; // 60 : Target Address is valid - ULONGLONG RequestIdValid:1; // 61 : RequestId is valid - ULONGLONG ResponderIdValid:1; // 62 : ResponderId is valid - ULONGLONG PreciseIPValid:1; // 63 : Precise Inststruction Pointer is Valid - } DUMMYSTRUCTNAME; -} ERROR_CACHE_CHECK, *PERROR_CACHE_CHECK; -#endif - -typedef enum _ERROR_TLB_CHECK_OPERATION { - TlbUnknownOp = 0, - TlbAccessWithLoad = 1, - TlbAccessWithStore = 2, - TlbAccessWithInstructionFetch = 3, - TlbAccessWithDataPrefetch = 4, - TlbShootDown = 5, - TlbProbe = 6, - TlbVhptFill = 7, - TlbPurge = 8, -} ERROR_TLB_CHECK_OPERATION; - -typedef union _ERROR_TLB_CHECK { - ULONGLONG TlbCheck; - struct - { - ULONGLONG TRSlot:8; // bits 0- 7: Slot number of Translation Register - ULONGLONG TRSlotValid:1; // 8 : TRSlot field is valid - ULONGLONG Reserved1:1; // 9 - ULONGLONG Level:2; // 10-11: TLB Level - ULONGLONG Reserved2:4; // 12-15 - ULONGLONG DataTransReg:1; // 16 : Error in data translation register - ULONGLONG InstructionTransReg:1; // 17 : Error in instruction translation register - ULONGLONG DataTransCache:1; // 18 : Error in data translation cache - ULONGLONG InstructionTransCache:1; // 19 : Error in instruction translation cache - ULONGLONG Operation:4; // 20-23: Operation - ULONGLONG Reserved3:30; // 24-53 - ULONGLONG InstructionSet:1; // 54 : 0 - IA64 instruction, 1- IA32 instruction - ULONGLONG InstructionSetValid:1; // 55 : InstructionSet field is valid - ULONGLONG PrivilegeLevel:2; // 56-57: Privlege level of instrustion - ULONGLONG PrivilegeLevelValid:1; // 58 : PrivilegeLevel field is Valid - ULONGLONG MachineCheckCorrected:1; // 59 : 1 - Machine Check Corrected - ULONGLONG TargetAddressValid:1; // 60 : Target Address is valid - ULONGLONG RequestIdValid:1; // 61 : RequestId is valid - ULONGLONG ResponderIdValid:1; // 62 : ResponderId is valid - ULONGLONG PreciseIPValid:1; // 63 : Precise Inststruction Pointer is Valid - } DUMMYSTRUCTNAME; -} ERROR_TLB_CHECK, *PERROR_TLB_CHECK; - -typedef enum _ERROR_BUS_CHECK_OPERATION { - BusUnknownOp = 0, - BusPartialRead = 1, - BusPartialWrite = 2, - BusFullLineRead = 3, - BusFullLineWrite = 4, - BusWriteBack = 5, - BusSnoopProbe = 6, - BusIncomingPtcG = 7, - BusWriteCoalescing = 8, -} ERROR_BUS_CHECK_OPERATION; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef union _ERROR_BUS_CHECK { - ULONGLONG BusCheck; - struct - { - ULONGLONG Size:5; // bits 0- 4: Transaction size - ULONGLONG Internal:1; // 5 : Internal bus error - ULONGLONG External:1; // 6 : External bus error - ULONGLONG CacheTransfer:1; // 7 : Error occured in Cache to Cache Transfer - ULONGLONG Type:8; // 8-15: Transaction type - ULONGLONG Severity:5; // 16-20: Error severity - platform specific - ULONGLONG Hierarchy:2; // 21-22: Level or Bus hierarchy - ULONGLONG DP:1; // 23 : 1 - error due to data poisoning - ULONGLONG Status:8; // 24-31: Bus error status - processor bus specific - ULONGLONG Reserved1:22; // 32-53 - ULONGLONG InstructionSet:1; // 54 : 0 - IA64 instruction, 1- IA32 instruction - ULONGLONG InstructionSetValid:1; // 55 : InstructionSet field is valid - ULONGLONG PrivilegeLevel:2; // 56-57: Privlege level of instrustion - ULONGLONG PrivilegeLevelValid:1; // 58 : PrivilegeLevel field is Valid - ULONGLONG MachineCheckCorrected:1; // 59 : 1 - Machine Check Corrected - ULONGLONG TargetAddressValid:1; // 60 : Target Address is valid - ULONGLONG RequestIdValid:1; // 61 : RequestId is valid - ULONGLONG ResponderIdValid:1; // 62 : ResponderId is valid - ULONGLONG PreciseIPValid:1; // 63 : Precise Inststruction Pointer is Valid - } DUMMYSTRUCTNAME; -} ERROR_BUS_CHECK, *PERROR_BUS_CHECK; -#else -typedef union _ERROR_BUS_CHECK { - ULONGLONG BusCheck; - struct - { - ULONGLONG Size:5; // bits 0- 4: Transaction size - ULONGLONG Internal:1; // 5 : Internal bus error - ULONGLONG External:1; // 6 : External bus error - ULONGLONG CacheTransfer:1; // 7 : Error occured in Cache to Cache Transfer - ULONGLONG Type:8; // 8-15: Transaction type - ULONGLONG Severity:5; // 16-20: Error severity - platform specific - ULONGLONG Hierarchy:2; // 21-22: Level or Bus hierarchy - ULONGLONG Reserved1:1; // 23 - ULONGLONG Status:8; // 24-31: Bus error status - processor bus specific - ULONGLONG Reserved2:22; // 32-53 - ULONGLONG InstructionSet:1; // 54 : 0 - IA64 instruction, 1- IA32 instruction - ULONGLONG InstructionSetValid:1; // 55 : InstructionSet field is valid - ULONGLONG PrivilegeLevel:2; // 56-57: Privlege level of instrustion - ULONGLONG PrivilegeLevelValid:1; // 58 : PrivilegeLevel field is Valid - ULONGLONG MachineCheckCorrected:1; // 59 : 1 - Machine Check Corrected - ULONGLONG TargetAddressValid:1; // 60 : Target Address is valid - ULONGLONG RequestIdValid:1; // 61 : RequestId is valid - ULONGLONG ResponderIdValid:1; // 62 : ResponderId is valid - ULONGLONG PreciseIPValid:1; // 63 : Precise Inststruction Pointer is Valid - } DUMMYSTRUCTNAME; -} ERROR_BUS_CHECK, *PERROR_BUS_CHECK; -#endif - -typedef enum _ERROR_REGFILE_CHECK_IDENTIFIER { - RegFileUnknownId = 0, - GeneralRegisterBank1 = 1, - GeneralRegisterBank0 = 2, - FloatingPointRegister = 3, - BranchRegister = 4, - PredicateRegister = 5, - ApplicationRegister = 6, - ControlRegister = 7, - RegionRegister = 8, - ProtectionKeyRegister = 9, - DataBreakPointRegister = 10, - InstructionBreakPointRegister = 11, - PerformanceMonitorControlRegister = 12, - PerformanceMonitorDataRegister = 13, -} ERROR_REGFILE_CHECK_IDENTIFIER; - -typedef enum _ERROR_REGFILE_CHECK_OPERATION { - RegFileUnknownOp = 0, - RegFileRead = 1, - RegFileWrite = 2, -} ERROR_REGFILE_CHECK_OPERATION; - -typedef union _ERROR_REGFILE_CHECK { - ULONGLONG RegFileCheck; - struct - { - ULONGLONG Identifier:4; // bits 0- 3: Register file identifier - ULONGLONG Operation:4; // 4- 7: Operation that causes the MC event - ULONGLONG RegisterNumber:7; // 8-14: Register number responsible for MC event - ULONGLONG RegisterNumberValid:1; // 15 : Register number field is valid - ULONGLONG Reserved1:38; // 16-53 - ULONGLONG InstructionSet:1; // 54 : 0 - IA64 instruction, 1- IA32 instruction - ULONGLONG InstructionSetValid:1; // 55 : InstructionSet field is valid - ULONGLONG PrivilegeLevel:2; // 56-57: Privlege level of instrustion - ULONGLONG PrivilegeLevelValid:1; // 58 : PrivilegeLevel field is Valid - ULONGLONG MachineCheckCorrected:1; // 59 : 1 - Machine Check Corrected - ULONGLONG Reserved2:3; // 60-62 - ULONGLONG PreciseIPValid:1; // 63 : Precise Inststruction Pointer is Valid - } DUMMYSTRUCTNAME; -} ERROR_REGFILE_CHECK, *PERROR_REGFILE_CHECK; - -#if (NTDDK_VERSION <= WINXP) -typedef enum _ERROR_MS_CHECK_OPERATION { - MsUnknownOp = 0, - MsReadOrLoad = 1, - MsWriteOrStore = 2 -} ERROR_MS_CHECK_OPERATION; -#else -typedef enum _ERROR_MS_CHECK_OPERATION { - MsUnknownOp = 0, - MsReadOrLoad = 1, - MsWriteOrStore = 2, - MsOverTemperature = 3, - MsNormalTemperature = 4 -} ERROR_MS_CHECK_OPERATION; -#endif - -typedef union _ERROR_MS_CHECK { - ULONGLONG MsCheck; - struct - { - ULONGLONG StructureIdentifier:5; // bits 0- 4: Structure Identifier - impl. specific - ULONGLONG Level:3; // 5- 7: Structure Level where error was generated - ULONGLONG ArrayId:4; // 8-11: Identification of the array - ULONGLONG Operation:4; // 12-15: Operation - ULONGLONG Way:6; // 16-21: Way where the error was located - ULONGLONG WayValid:1; // 22 : Way field is valid - ULONGLONG IndexValid:1; // 23 : Index field is valid - ULONGLONG Reserved1:8; // 24-31 - ULONGLONG Index:8; // 32-39: Index where the error was located - ULONGLONG Reserved2:14; // 40-53 - ULONGLONG InstructionSet:1; // 54 : 0 - IA64 instruction, 1- IA32 instruction - ULONGLONG InstructionSetValid:1; // 55 : InstructionSet field is valid - ULONGLONG PrivilegeLevel:2; // 56-57: Privlege level of instrustion - ULONGLONG PrivilegeLevelValid:1; // 58 : PrivilegeLevel field is Valid - ULONGLONG MachineCheckCorrected:1; // 59 : 1 - Machine Check Corrected - ULONGLONG TargetAddressValid:1; // 60 : Target Address is valid - ULONGLONG RequestIdValid:1; // 61 : RequestId is valid - ULONGLONG ResponderIdValid:1; // 62 : ResponderId is valid - ULONGLONG PreciseIPValid:1; // 63 : Precise Inststruction Pointer is Valid - } DUMMYSTRUCTNAME; -} ERROR_MS_CHECK, *PERROR_MS_CHECK; - -typedef union _ERROR_CHECK_INFO { - ULONGLONG CheckInfo; - ERROR_CACHE_CHECK CacheCheck; - ERROR_TLB_CHECK TlbCheck; - ERROR_BUS_CHECK BusCheck; - ERROR_REGFILE_CHECK RegFileCheck; - ERROR_MS_CHECK MsCheck; -} ERROR_CHECK_INFO, *PERROR_CHECK_INFO; - -// SAL Specs July 2000: The size of _ERROR_MODINFO will always be 48 Bytes. - -typedef struct _ERROR_MODINFO { - ERROR_MODINFO_VALID Valid; - ERROR_CHECK_INFO CheckInfo; - ULONGLONG RequestorId; - ULONGLONG ResponderId; - ULONGLONG TargetId; - ULONGLONG PreciseIP; -} ERROR_MODINFO, *PERROR_MODINFO; - -typedef union _ERROR_PROCESSOR_VALID { - ULONGLONG Valid; - struct { // Bits - ULONGLONG ErrorMap: 1; // 0: - ULONGLONG StateParameter: 1; // 1: - ULONGLONG CRLid: 1; // 2: - ULONGLONG StaticStruct:1; // 3: Processor Static Info error. - ULONGLONG CacheCheckNum:4; // 4-7: Cache errors. - ULONGLONG TlbCheckNum:4; // 8-11: Tlb errors. - ULONGLONG BusCheckNum:4; // 12-15: Bus errors. - ULONGLONG RegFileCheckNum:4; // 16-19: Registers file errors. - ULONGLONG MsCheckNum:4; // 20-23: Micro-Architecture errors. - ULONGLONG CpuIdInfo:1; // 24: CPUID Info. - ULONGLONG Reserved:39; // 25-63: Reserved. - } DUMMYSTRUCTNAME; -} ERROR_PROCESSOR_VALID, *PERROR_PROCESSOR_VALID; - -typedef union _ERROR_PROCESSOR_ERROR_MAP { - ULONGLONG ErrorMap; - struct { - ULONGLONG Cid:4; // bits 0- 3: Processor Core Identifier - ULONGLONG Tid:4; // 4- 7: Logical Thread Identifier - ULONGLONG Eic:4; // 8-11: Instruction Caches Level Information - ULONGLONG Edc:4; // 12-15: Data Caches Level Information - ULONGLONG Eit:4; // 16-19: Instruction TLB Level Information - ULONGLONG Edt:4; // 20-23: Data TLB Level Information - ULONGLONG Ebh:4; // 24-27: Processor Bus Level Information - ULONGLONG Erf:4; // 28-31: Register File Level Information - ULONGLONG Ems:16; // 32-47: MicroArchitecture Level Information - ULONGLONG Reserved:16; - } DUMMYSTRUCTNAME; -} ERROR_PROCESSOR_ERROR_MAP, *PERROR_PROCESSOR_ERROR_MAP; - -typedef ERROR_PROCESSOR_ERROR_MAP _ERROR_PROCESSOR_LEVEL_INDEX; -typedef _ERROR_PROCESSOR_LEVEL_INDEX ERROR_PROCESSOR_LEVEL_INDEX, *PERROR_PROCESSOR_LEVEL_INDEX; - -typedef union _ERROR_PROCESSOR_STATE_PARAMETER { - ULONGLONG StateParameter; - struct { - ULONGLONG reserved0:2; // 0-1 : reserved - ULONGLONG rz:1; // 2 : Rendez-vous successful - ULONGLONG ra:1; // 3 : Rendez-vous attempted - ULONGLONG me:1; // 4 : Distinct Multiple errors - ULONGLONG mn:1; // 5 : Min-state Save Area registered - ULONGLONG sy:1; // 6 : Storage integrity synchronized - ULONGLONG co:1; // 7 : Continuable - ULONGLONG ci:1; // 8 : Machine Check isolated - ULONGLONG us:1; // 9 : Uncontained Storage damage - ULONGLONG hd:1; // 10 : Hardware damage - ULONGLONG tl:1; // 11 : Trap lost - ULONGLONG mi:1; // 12 : More Information - ULONGLONG pi:1; // 13 : Precise Instruction pointer - ULONGLONG pm:1; // 14 : Precise Min-state Save Area - ULONGLONG dy:1; // 15 : Processor Dynamic State valid - ULONGLONG in:1; // 16 : INIT interruption - ULONGLONG rs:1; // 17 : RSE valid - ULONGLONG cm:1; // 18 : Machine Check corrected - ULONGLONG ex:1; // 19 : Machine Check expected - ULONGLONG cr:1; // 20 : Control Registers valid - ULONGLONG pc:1; // 21 : Performance Counters valid - ULONGLONG dr:1; // 22 : Debug Registers valid - ULONGLONG tr:1; // 23 : Translation Registers valid - ULONGLONG rr:1; // 24 : Region Registers valid - ULONGLONG ar:1; // 25 : Application Registers valid - ULONGLONG br:1; // 26 : Branch Registers valid - ULONGLONG pr:1; // 27 : Predicate Registers valid - ULONGLONG fp:1; // 28 : Floating-Point Registers valid - ULONGLONG b1:1; // 29 : Preserved Bank 1 General Registers valid - ULONGLONG b0:1; // 30 : Preserved Bank 0 General Registers valid - ULONGLONG gr:1; // 31 : General Registers valid - ULONGLONG dsize:16; // 47-32 : Processor Dynamic State size - ULONGLONG reserved1:11; // 48-58 : reserved - ULONGLONG cc:1; // 59 : Cache Check - ULONGLONG tc:1; // 60 : TLB Check - ULONGLONG bc:1; // 61 : Bus Check - ULONGLONG rc:1; // 62 : Register File Check - ULONGLONG uc:1; // 63 : Micro-Architectural Check - } DUMMYSTRUCTNAME; -} ERROR_PROCESSOR_STATE_PARAMETER, *PERROR_PROCESSOR_STATE_PARAMETER; - -typedef union _PROCESSOR_LOCAL_ID { - ULONGLONG LocalId; - struct { - ULONGLONG reserved:16; // 0-16 : reserved - ULONGLONG eid:8; // 16-23 : Extended Id - ULONGLONG id:8; // 24-31 : Id - ULONGLONG ignored:32; // 32-63 : ignored - } DUMMYSTRUCTNAME; -} PROCESSOR_LOCAL_ID, *PPROCESSOR_LOCAL_ID; - -typedef struct _ERROR_PROCESSOR_MS { - ULONGLONG MsError [ /* Valid.MsCheckNum */ 1]; // 0 -> 15 registers file errors. -} ERROR_PROCESSOR_MS, *PERROR_PROCESSOR_MS; - -typedef struct _ERROR_PROCESSOR_CPUID_INFO { // Must be 48 bytes. - ULONGLONG CpuId0; - ULONGLONG CpuId1; - ULONGLONG CpuId2; - ULONGLONG CpuId3; - ULONGLONG CpuId4; - ULONGLONG Reserved; -} ERROR_PROCESSOR_CPUID_INFO, *PERROR_PROCESSOR_CPUID_INFO; - -typedef union _ERROR_PROCESSOR_STATIC_INFO_VALID { - ULONGLONG Valid; - struct { // Bits - // Warning: Match the VALID fields with the _ERROR_PROCESSOR_STATIC_INFO members. - // KD extensions use the field names to access the PSI structure. - ULONGLONG MinState: 1; // 0: MinState valid. - ULONGLONG BR: 1; // 1: Branch Registers valid. - ULONGLONG CR: 1; // 2: Control Registers valid. - ULONGLONG AR: 1; // 3: Application Registers valid. - ULONGLONG RR: 1; // 4: Registers valid. - ULONGLONG FR: 1; // 5: Registers valid. - ULONGLONG Reserved: 58; // 6-63: Reserved. - } DUMMYSTRUCTNAME; -} ERROR_PROCESSOR_STATIC_INFO_VALID, *PERROR_PROCESSOR_STATIC_INFO_VALID; - -typedef struct _ERROR_PROCESSOR_STATIC_INFO { - ERROR_PROCESSOR_STATIC_INFO_VALID Valid; - UCHAR MinState[ /* SAL Specs, July 2000 and Jan 2001 state approximatively: */ 1024]; - ULONGLONG BR [ 8 ]; - ULONGLONG CR [ /* SAL Specs, July 2000 states that it is processor dependent */ 128 ]; - ULONGLONG AR [ /* SAL Specs, July 2000 states that it is processor dependent */ 128 ]; - ULONGLONG RR [ 8 ]; - ULONGLONG FR [ 2 * 128 ]; -} ERROR_PROCESSOR_STATIC_INFO, *PERROR_PROCESSOR_STATIC_INFO; - -typedef struct _ERROR_PROCESSOR { - ERROR_SECTION_HEADER Header; - ERROR_PROCESSOR_VALID Valid; - ERROR_PROCESSOR_ERROR_MAP ErrorMap; - ERROR_PROCESSOR_STATE_PARAMETER StateParameter; - PROCESSOR_LOCAL_ID CRLid; -#if 0 -// The presence of the following data depends on the valid bits -// from ERROR_PROCESSOR.Valid. -// - ERROR_MODINFO CacheErrorInfo [ /* Valid.CacheCheckNum */ ]; // 0->15 cache error modinfo structs. - ERROR_MODINFO TlbErrorInfo [ /* Valid.TlbCheckNum */ ]; // 0->15 tlb error modinfo structs. - ERROR_MODINFO BusErrorInfo [ /* Valid.BusCheckNum */ ]; // 0->15 bus error modinfo structs. - ERROR_MODINFO RegFileCheckInfo [ /* Valid.RegFileCheckNum */ ]; // 0->15 registers file errors. - ERROR_MODINFO MsCheckInfo [ /* Valid.MsCheckNum */ ]; // 0->15 registers file errors. - ERROR_PROCESSOR_CPUID_INFO CpuIdInfo; // field will always be there but could be zero-padded. - ERROR_PROCESSOR_STATIC_INFO StaticInfo; // field will always be there but could be zero-padded. -#endif // 0 -} ERROR_PROCESSOR, *PERROR_PROCESSOR; - -// -// IA64 ERROR PROCESSOR State Parameter - GR18 - definitions. -// - -#define ERROR_PROCESSOR_STATE_PARAMETER_CACHE_CHECK_SHIFT 59 -#define ERROR_PROCESSOR_STATE_PARAMETER_CACHE_CHECK_MASK 0x1 -#define ERROR_PROCESSOR_STATE_PARAMETER_TLB_CHECK_SHIFT 60 -#define ERROR_PROCESSOR_STATE_PARAMETER_TLB_CHECK_MASK 0x1 -#define ERROR_PROCESSOR_STATE_PARAMETER_BUS_CHECK_SHIFT 61 -#define ERROR_PROCESSOR_STATE_PARAMETER_BUS_CHECK_MASK 0x1 -#define ERROR_PROCESSOR_STATE_PARAMETER_REG_CHECK_SHIFT 62 -#define ERROR_PROCESSOR_STATE_PARAMETER_REG_CHECK_MASK 0x1 -#define ERROR_PROCESSOR_STATE_PARAMETER_MICROARCH_CHECK_SHIFT 63 -#define ERROR_PROCESSOR_STATE_PARAMETER_MICROARCH_CHECK_MASK 0x1 - -// -// For legacy consumers -// -#define ERROR_PROCESSOR_STATE_PARAMETER_UNKNOWN_CHECK_SHIFT ERROR_PROCESSOR_STATE_PARAMETER_MICROARCH_CHECK_SHIFT -#define ERROR_PROCESSOR_STATE_PARAMETER_UNKNOWN_CHECK_MASK ERROR_PROCESSOR_STATE_PARAMETER_MICROARCH_CHECK_MASK - -//////////////////////////////////////////////////////////////////// -// -// IA64 PLATFORM ERRORS Definitions -// -// We tried to respect the order in which these error devices are -// presented in the SAL specs. - -// -// IA64 ERRORS: _ERR_TYPE definitions -// -// Warning 04/01/01: "ERR_TYPE" or "ERROR_TYPE" are already used in the NT namespace. -// - -typedef enum _ERR_TYPES { -// Generic error types: - ERR_INTERNAL = 1, // Error detected internal to the component - ERR_BUS = 16, // Error detected in the bus -// Detailed Internal Error Types: - ERR_MEM = 4, // Storage error in memory (DRAM) - ERR_TLB = 5, // Storage error in TLB - ERR_CACHE = 6, // Storage error in cache - ERR_FUNCTION = 7, // Error in one or more functional units - ERR_SELFTEST = 8, // Component failed self test - ERR_FLOW = 9, // Overflow or Undervalue of internal queue -// Detailed Bus Error Types: - ERR_MAP = 17, // Virtual address not found on IO-TLB or IO-PDIR - ERR_IMPROPER = 18, // Improper access error - ERR_UNIMPL = 19, // Access to a memory address which is not mapped to any component - ERR_LOL = 20, // Loss Of Lockstep - ERR_RESPONSE = 21, // Response to which there is no associated request - ERR_PARITY = 22, // Bus parity error - ERR_PROTOCOL = 23, // Detection of a protocol error - ERR_ERROR = 24, // Detection of PATH_ERROR - ERR_TIMEOUT = 25, // Bus operation time-out - ERR_POISONED = 26, // A read was issued to data which has been poisoned -} _ERR_TYPE; - -// -// IA64 ERRORS: ERROR_STATUS definitions -// - -typedef union _ERROR_STATUS { - ULONGLONG Status; - struct { // Bits: - ULONGLONG Reserved0:8; // 7-0: Reserved - ULONGLONG Type:8; // 15-8: Error Type - See _ERR_TYPE definitions. - ULONGLONG Address:1; // 16: Error was detected on address signals or on address portion of transaction - ULONGLONG Control:1; // 17: Error was detected on control signals or in control portion of transaction - ULONGLONG Data:1; // 18: Error was detected on data signals or in data portion of transaction - ULONGLONG Responder:1; // 19: Error was detected by responder of transaction - ULONGLONG Requestor:1; // 20: Error was detected by requestor of transaction - ULONGLONG FirstError:1; // 21: If multiple errors, this is the first error of the highest severity that occurred - ULONGLONG Overflow:1; // 22: Additional errors occurred which were not logged because registers overflow - ULONGLONG Reserved1:41; // 63-23: Reserved - } DUMMYSTRUCTNAME; -} ERROR_STATUS, *PERROR_STATUS; - -// -// IA64 ERRORS: Platform OEM_DATA definitions -// - -typedef struct _ERROR_OEM_DATA { - USHORT Length; -#if 0 - UCHAR Data[/* ERROR_OEM_DATA.Length */]; -#endif // 0 -} ERROR_OEM_DATA, *PERROR_OEM_DATA; - -// -// IA64 ERRORS: Platform BUS_SPECIFIC_DATA definitions -// - -typedef union _ERROR_BUS_SPECIFIC_DATA { - ULONGLONG BusSpecificData; - struct { // Bits : - ULONGLONG LockAsserted:1; // 0: LOCK# Asserted during request phase - ULONGLONG DeferLogged:1; // 1: Defer phase is logged - ULONGLONG IOQEmpty:1; // 2: IOQ is empty - ULONGLONG DeferredTransaction:1; // 3: Component interface deferred transaction - ULONGLONG RetriedTransaction:1; // 4: Component interface retried transaction - ULONGLONG MemoryClaimedTransaction:1; // 5: memory claimed the transaction - ULONGLONG IOClaimedTransaction:1; // 6: IO controller claimed the transaction - ULONGLONG ResponseParitySignal:1; // 7: Response parity signal - ULONGLONG DeferSignal:1; // 8: DEFER# signal - ULONGLONG HitMSignal:1; // 9: HITM# signal - ULONGLONG HitSignal:1; // 10: HIT# signal - ULONGLONG RequestBusFirstCycle:6; // 16-11: First cycle of request bus - ULONGLONG RequestBusSecondCycle:6; // 22-17: Second cycle of request bus - ULONGLONG AddressParityBusFirstCycle:2; // 24-23: First cycle of address parity bus - ULONGLONG AddressParityBusSecondCycle:2; // 26-25: Second cycle of address parity - ULONGLONG ResponseBus:3; // 29-27: Response bus - ULONGLONG RequestParitySignalFirstCycle:1; // 30: First cycle of request parity signal - ULONGLONG RequestParitySignalSecondCycle:1; // 31: Second cycle of request parity signal - ULONGLONG Reserved:32; // 63-32: Reserved - } DUMMYSTRUCTNAME; -} ERROR_BUS_SPECIFIC_DATA, *PERROR_BUS_SPECIFIC_DATA; - -// -// IA64 ERRORS: Platform ERROR_MEMORY device definitions -// -// With reference to the ACPI Memory Device. -// - -#define ERROR_MEMORY_GUID \ - { 0xe429faf2, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }} - -typedef union _ERROR_MEMORY_VALID { - ULONGLONG Valid; - struct { // Bits - ULONGLONG ErrorStatus:1; // 0: Error Status valid bit - ULONGLONG PhysicalAddress:1; // 1: Physical Address valid bit - ULONGLONG AddressMask:1; // 2: Address Mask bit - ULONGLONG Node:1; // 3: Node valid bit - ULONGLONG Card:1; // 4: Card valid bit - ULONGLONG Module:1; // 5: Module valid bit - ULONGLONG Bank:1; // 6: Bank valid bit - ULONGLONG Device:1; // 7: Device valid bit - ULONGLONG Row:1; // 8: Row valid bit - ULONGLONG Column:1; // 9: Column valid bit - ULONGLONG BitPosition:1; // 10: Bit Position valid bit - ULONGLONG RequestorId:1; // 11: Platform Requestor Id valid bit - ULONGLONG ResponderId:1; // 12: Platform Respinder Id valid bit - ULONGLONG TargetId:1; // 13: Platform Target Id valid bit - ULONGLONG BusSpecificData:1; // 14: Platform Bus specific data valid bit - ULONGLONG OemId:1; // 15: Platform OEM id valid bit - ULONGLONG OemData:1; // 16: Platform OEM data valid bit - ULONGLONG Reserved:47; // 63-17: Reserved - } DUMMYSTRUCTNAME; -} ERROR_MEMORY_VALID, *PERROR_MEMORY_VALID; - -typedef struct _ERROR_MEMORY { - ERROR_SECTION_HEADER Header; - ERROR_MEMORY_VALID Valid; - ERROR_STATUS ErrorStatus; // Memory device error status fields - See ERROR_STATUS defs. - ULONGLONG PhysicalAddress; // Physical Address of the memory error - ULONGLONG PhysicalAddressMask; // Valid bits for Physical Address - USHORT Node; // Node identifier in a multi-node system - USHORT Card; // Card number of the memory error location - USHORT Module; // Module number of the memory error location - USHORT Bank; // Bank number of the memory error location - USHORT Device; // Device number of the memory error location - USHORT Row; // Row number of the memory error location - USHORT Column; // Column number of the memory error location - USHORT BitPosition; // Bit within the word that is in error - ULONGLONG RequestorId; // Hardware address of the device or component initiating transaction - ULONGLONG ResponderId; // Hardware address of the responder to transaction - ULONGLONG TargetId; // Hardware address of intended target of transaction - ULONGLONG BusSpecificData; // Bus dependent data of the on-board processor. It is a OEM specific field. - UCHAR OemId[16]; // OEM defined identification for memory controller - ERROR_OEM_DATA OemData; // OEM platform specific data. -} ERROR_MEMORY, *PERROR_MEMORY; - -// -// IA64 ERRORS: Platform ERROR_PCI_BUS device definitions -// -// With reference to the PCI Specifications. -// - -#define ERROR_PCI_BUS_GUID \ - { 0xe429faf4, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }} - -typedef union _ERROR_PCI_BUS_VALID { - ULONGLONG Valid; - struct { // Bits - ULONGLONG ErrorStatus:1; // 0: Error Status valid bit - ULONGLONG ErrorType:1; // 1: Error Type valid bit - ULONGLONG Id:1; // 2: Identifier valid bit - ULONGLONG Address:1; // 3: Address valid bit - ULONGLONG Data:1; // 4: Data valid bit - ULONGLONG CmdType:1; // 5: Command Type valid bit - ULONGLONG RequestorId:1; // 6: Requestor Identifier valid bit - ULONGLONG ResponderId:1; // 7: Responder Identifier valid bit - ULONGLONG TargetId:1; // 8: Target Identifer valid bit - ULONGLONG OemId:1; // 9: OEM Identification valid bit - ULONGLONG OemData:1; // 10: OEM Data valid bit - ULONGLONG Reserved:53; // 11-63: Reserved - } DUMMYSTRUCTNAME; -} ERROR_PCI_BUS_VALID, *PERROR_PCI_BUS_VALID; - -typedef struct _ERROR_PCI_BUS_TYPE { - UCHAR Type; - UCHAR Reserved; -} ERROR_PCI_BUS_TYPE, *PERROR_PCI_BUS_TYPE; - -#define PciBusUnknownError ((UCHAR)0) -#define PciBusDataParityError ((UCHAR)1) -#define PciBusSystemError ((UCHAR)2) -#define PciBusMasterAbort ((UCHAR)3) -#define PciBusTimeOut ((UCHAR)4) -#define PciMasterDataParityError ((UCHAR)5) -#define PciAddressParityError ((UCHAR)6) -#define PciCommandParityError ((UCHAR)7) -// PciOtherErrors Reserved - -typedef struct _ERROR_PCI_BUS_ID { - UCHAR BusNumber; // Bus Number - UCHAR SegmentNumber; // Segment Number -} ERROR_PCI_BUS_ID, *PERROR_PCI_BUS_ID; - -typedef struct _ERROR_PCI_BUS { - ERROR_SECTION_HEADER Header; - ERROR_PCI_BUS_VALID Valid; - ERROR_STATUS ErrorStatus; // PCI Bus Error Status - See ERROR_STATUS definitions. - ERROR_PCI_BUS_TYPE Type; // PCI Bus Error Type - ERROR_PCI_BUS_ID Id; // PCI Bus Identifier - UCHAR Reserved[4]; // Reserved - ULONGLONG Address; // Memory or IO Address on the PCI bus at - // the time of the event - ULONGLONG Data; // Data on the PCI bus at time of the event - ULONGLONG CmdType; // Bus Command or Operation at time of the event - ULONGLONG RequestorId; // Bus Requestor Identifier at time of the event - ULONGLONG ResponderId; // Bus Responder Identifier at time of the event - ULONGLONG TargetId; // Intended Bus Target Identifier at time of the event - UCHAR OemId[16]; // OEM defined identification for pci bus - ERROR_OEM_DATA OemData; // OEM specific data. -} ERROR_PCI_BUS, *PERROR_PCI_BUS; - -// -// IA64 ERRORS: Platform ERROR_PCI_COMPONENT device definitions -// -// With reference to the PCI Specifications. -// - -#define ERROR_PCI_COMPONENT_GUID \ - { 0xe429faf6, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }} - -typedef union _ERROR_PCI_COMPONENT_VALID { - ULONGLONG Valid; - struct { // Bits: - ULONGLONG ErrorStatus:1; // 0: Error Status valid bit - ULONGLONG Info:1; // 1: Information valid bit - ULONGLONG MemoryMappedRegistersPairs:1; // 2: Number of Memory Mapped Registers Pairs valid bit - ULONGLONG ProgrammedIORegistersPairs:1; // 3: Number of Programmed IO Registers Pairs valid bit - ULONGLONG RegistersDataPairs:1; // 4: Memory Mapped Registers Pairs valid bit - ULONGLONG OemData:1; // 5: OEM Data valid bit. - ULONGLONG Reserved:58; // 63-6: Reserved - } DUMMYSTRUCTNAME; -} ERROR_PCI_COMPONENT_VALID, *PERROR_PCI_COMPONENT_VALID; - -typedef struct _ERROR_PCI_COMPONENT_INFO { // Bytes: - USHORT VendorId; // 0-1: Vendor Identifier - USHORT DeviceId; // 2-3: Device Identifier - UCHAR ClassCodeInterface; // 4: Class Code.Interface field - UCHAR ClassCodeSubClass; // 5: Class Code.SubClass field - UCHAR ClassCodeBaseClass; // 6: Class Code.BaseClass field - UCHAR FunctionNumber; // 7: Function Number - UCHAR DeviceNumber; // 8: Device Number - UCHAR BusNumber; // 9: Bus Number - UCHAR SegmentNumber; // 10: Segment Number - UCHAR Reserved0; - ULONG Reserved1; -} ERROR_PCI_COMPONENT_INFO, *PERROR_PCI_COMPONENT_INFO; - -typedef struct _ERROR_PCI_COMPONENT { - ERROR_SECTION_HEADER Header; - ERROR_PCI_COMPONENT_VALID Valid; - ERROR_STATUS ErrorStatus; // Component Error Status - ERROR_PCI_COMPONENT_INFO Info; // Component Information - ULONG MemoryMappedRegistersPairs; // Number of Memory Mapped Registers Pairs - ULONG ProgrammedIORegistersPairs; // Number of Programmed IO Registers Pairs -#if 0 - ULONGLONG RegistersPairs[/* 2 * (MemoryMappedRegistersPairs + ProgrammedIORegistersPairs) */]; - ERROR_OEM_DATA OemData; -#endif // 0 - } ERROR_PCI_COMPONENT, *PERROR_PCI_COMPONENT; - -// -// IA64 ERRORS: Platform ERROR_SYSTEM_EVENT_LOG device definitions -// -// With reference to the IPMI System Event Log. -// - -#define ERROR_SYSTEM_EVENT_LOG_GUID \ - { 0xe429faf3, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }} - -typedef union _ERROR_SYSTEM_EVENT_LOG_VALID { - ULONGLONG Valid; - struct { // Bits - ULONGLONG RecordId:1; // 0: Record Identifier valid bit - ULONGLONG RecordType:1; // 1: Record Type valid bit - ULONGLONG GeneratorId:1; // 2: Generator Identifier valid bit - ULONGLONG EVMRev:1; // 3: Event Format Revision valid bit - ULONGLONG SensorType:1; // 4: Sensor Type valid bit - ULONGLONG SensorNum:1; // 5: Sensor Number valid bit - ULONGLONG EventDirType:1; // 6: Event Dir valid bit - ULONGLONG EventData1:1; // 7: Event Data1 valid bit - ULONGLONG EventData2:1; // 8: Event Data2 valid bit - ULONGLONG EventData3:1; // 9: Event Data3 valid bit - ULONGLONG Reserved:54; // 10-63: - } DUMMYSTRUCTNAME; -} ERROR_SYSTEM_EVENT_LOG_VALID, *PSYSTEM_EVENT_LOG_VALID; - -typedef struct _ERROR_SYSTEM_EVENT_LOG { - ERROR_SECTION_HEADER Header; - ERROR_SYSTEM_EVENT_LOG_VALID Valid; - USHORT RecordId; // Record Identifier used for SEL record access - UCHAR RecordType; // Record Type: - // 0x02 - System Event Record - // 0xC0 - 0xDF OEM time stamped, bytes 8-16 OEM defined - // 0xE0 - 0xFF OEM non-time stamped, bytes 4-16 OEM defined - ULONG TimeStamp; // Time stamp of the event log - USHORT GeneratorId; // Software ID if event was generated by software - // Byte 1: - // Bit 0 - set to 1 when using system software - // Bit 7:1 - 7-bit system ID - // Byte 2: - // Bit 1:0 - IPMB device LUN if byte 1 holds slave - // address, 0x0 otherwise - // Bit 7:2 - Reserved. - UCHAR EVMRevision; // Error message format version - UCHAR SensorType; // Sensor Type code of the sensor that generated event - UCHAR SensorNumber; // Number of the sensor that generated event - UCHAR EventDir; // Event Dir - // Bit 7 - 0: asserted, 1: desasserted - // Event Type - // Bit 6:0 - Event Type code - UCHAR Data1; // Event data field - UCHAR Data2; // Event data field - UCHAR Data3; // Event data field -} ERROR_SYSTEM_EVENT_LOG, *PERROR_SYSTEM_EVENT_LOG; - -// -// IA64 ERRORS: Platform ERROR_SMBIOS device definitions -// -// With reference to the SMBIOS Specifications. -// - -#define ERROR_SMBIOS_GUID \ - { 0xe429faf5, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }} - -typedef union _ERROR_SMBIOS_VALID { - ULONGLONG Valid; - struct { // Bits - ULONGLONG EventType:1; // 0: Event Type valid bit - ULONGLONG Length:1; // 1: Length valid bit - ULONGLONG TimeStamp:1; // 2: Time Stamp valid bit - ULONGLONG OemData:1; // 3: Data valid bit - ULONGLONG Reserved:60; // 4-63: - } DUMMYSTRUCTNAME; -} ERROR_SMBIOS_VALID, *PERROR_SMBIOS_VALID; - -// -// ERROR_SMBIOS.Type definitions -// - -typedef UCHAR ERROR_SMBIOS_EVENT_TYPE, *PERROR_SMBIOS_EVENT_TYPE; -// enum values defined in SMBIOS 2.3 - 3.3.16.6.1 - -typedef struct _ERROR_SMBIOS { - ERROR_SECTION_HEADER Header; - ERROR_SMBIOS_VALID Valid; - ERROR_SMBIOS_EVENT_TYPE EventType; // Event Type - UCHAR Length; // Length of the error information in bytes - ERROR_TIMESTAMP TimeStamp; // Event Time Stamp - ERROR_OEM_DATA OemData; // Optional data validated by SMBIOS.Valid.Data. -} ERROR_SMBIOS, *PERROR_SMBIOS; - -// -// IA64 ERRORS: Platform Specific error device definitions -// - -#define ERROR_PLATFORM_SPECIFIC_GUID \ - { 0xe429faf7, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }} - -typedef union _ERROR_PLATFORM_SPECIFIC_VALID { - ULONGLONG Valid; - struct { // Bits: - ULONGLONG ErrorStatus:1; // 0: Error Status valid bit - ULONGLONG RequestorId:1; // 1: Requestor Identifier valid bit - ULONGLONG ResponderId:1; // 2: Responder Identifier valid bit - ULONGLONG TargetId:1; // 3: Target Identifier valid bit - ULONGLONG BusSpecificData:1; // 4: Bus Specific Data valid bit - ULONGLONG OemId:1; // 5: OEM Identification valid bit - ULONGLONG OemData:1; // 6: OEM Data valid bit - ULONGLONG OemDevicePath:1; // 7: OEM Device Path valid bit - ULONGLONG Reserved:56; // 63-8: Reserved - } DUMMYSTRUCTNAME; -} ERROR_PLATFORM_SPECIFIC_VALID, *PERROR_PLATFORM_SPECIFIC_VALID; - -typedef struct _ERROR_PLATFORM_SPECIFIC { - ERROR_SECTION_HEADER Header; - ERROR_PLATFORM_SPECIFIC_VALID Valid; - ERROR_STATUS ErrorStatus; // Platform Generic Error Status - ULONGLONG RequestorId; // Bus Requestor ID at the time of the event - ULONGLONG ResponderId; // Bus Responder ID at the time of the event - ULONGLONG TargetId; // Bus intended Target ID at the time of the event - ERROR_BUS_SPECIFIC_DATA BusSpecificData; // OEM specific Bus dependent data - UCHAR OemId[16]; // OEM specific data for bus identification - ERROR_OEM_DATA OemData; // OEM specific data -#if 0 - UCHAR OemDevicePath[/* 16 ? */]; // OEM specific vendor device path. -#endif // 0 - } ERROR_PLATFORM_SPECIFIC, *PERROR_PLATFORM_SPECIFIC; - -// -// IA64 ERRORS: Platform Bus error device definitions -// - -#define ERROR_PLATFORM_BUS_GUID \ - { 0xe429faf9, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }} - -typedef union _ERROR_PLATFORM_BUS_VALID { - ULONGLONG Valid; - struct { // Bits: - ULONGLONG ErrorStatus:1; // 0: Error Status valid bit - ULONGLONG RequestorId:1; // 1: Requestor Identifier valid bit - ULONGLONG ResponderId:1; // 2: Responder Identifier valid bit - ULONGLONG TargetId:1; // 3: Target Identifier valid bit - ULONGLONG BusSpecificData:1; // 4: Bus Specific Data valid bit - ULONGLONG OemId:1; // 5: OEM Identification valid bit - ULONGLONG OemData:1; // 6: OEM Data valid bit - ULONGLONG OemDevicePath:1; // 7: OEM Device Path valid bit - ULONGLONG Reserved:56; // 63-8: Reserved - } DUMMYSTRUCTNAME; -} ERROR_PLATFORM_BUS_VALID, *PERROR_PLATFORM_BUS_VALID; - -typedef struct _ERROR_PLATFORM_BUS { - ERROR_SECTION_HEADER Header; - ERROR_PLATFORM_BUS_VALID Valid; - ERROR_STATUS ErrorStatus; // Bus Error Status - ULONGLONG RequestorId; // Bus Requestor ID at the time of the event - ULONGLONG ResponderId; // Bus Responder ID at the time of the event - ULONGLONG TargetId; // Bus intended Target ID at the time of the event - ERROR_BUS_SPECIFIC_DATA BusSpecificData; // OEM specific Bus dependent data - UCHAR OemId[16]; // OEM specific data for bus identification - ERROR_OEM_DATA OemData; // OEM specific data -#if 0 - UCHAR OemDevicePath[/* 16 ? */]; // OEM specific vendor device path. -#endif // 0 - } ERROR_PLATFORM_BUS, *PERROR_PLATFORM_BUS; - -// -// IA64 ERRORS: Platform Host Controller error device definitions -// - -#define ERROR_PLATFORM_HOST_CONTROLLER_GUID \ - { 0xe429faf8, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }} - - -typedef union _ERROR_PLATFORM_HOST_CONTROLLER_VALID { - ULONGLONG Valid; - struct { // Bits: - ULONGLONG ErrorStatus:1; // 0: Error Status valid bit - ULONGLONG RequestorId:1; // 1: Requestor Identifier valid bit - ULONGLONG ResponderId:1; // 2: Responder Identifier valid bit - ULONGLONG TargetId:1; // 3: Target Identifier valid bit - ULONGLONG BusSpecificData:1; // 4: Bus Specific Data valid bit - ULONGLONG OemId:1; // 5: OEM Identification valid bit - ULONGLONG OemData:1; // 6: OEM Data valid bit - ULONGLONG OemDevicePath:1; // 7: OEM Device Path valid bit - ULONGLONG Reserved:56; // 63-8: Reserved - } DUMMYSTRUCTNAME; -} ERROR_PLATFORM_HOST_CONTROLLER_VALID, *PERROR_PLATFORM_HOST_CONTROLLER_VALID; - -typedef struct _ERROR_PLATFORM_HOST_CONTROLLER { - ERROR_SECTION_HEADER Header; - ERROR_PCI_COMPONENT_VALID Valid; - ERROR_STATUS ErrorStatus; // Host Controller Error Status - ULONGLONG RequestorId; // Host controller Requestor ID at the time of the event - ULONGLONG ResponderId; // Host controller Responder ID at the time of the event - ULONGLONG TargetId; // Host controller intended Target ID at the time of the event - ERROR_BUS_SPECIFIC_DATA BusSpecificData; // OEM specific Bus dependent data - UCHAR OemId[16]; // OEM specific data for bus identification - ERROR_OEM_DATA OemData; // OEM specific data -#if 0 - UCHAR OemDevicePath[/* 16 ? */]; // OEM specific vendor device path. -#endif // 0 -} ERROR_PLATFORM_HOST_CONTROLLER, *PERROR_PLATFORM_HOST_CONTROLLER; - -// -// IA64 ERROR_LOGRECORDS definitions -// -// MCA_EXCEPTION, -// CMC_EXCEPTION, -// CPE_EXCEPTION. -// - -// For compatibility with previous versions of the definitions: -typedef ERROR_RECORD_HEADER ERROR_LOGRECORD, *PERROR_LOGRECORD; - -typedef ERROR_RECORD_HEADER MCA_EXCEPTION, *PMCA_EXCEPTION; // Machine Check Abort -typedef ERROR_RECORD_HEADER CMC_EXCEPTION, *PCMC_EXCEPTION; // Corrected Machine Check -typedef ERROR_RECORD_HEADER CPE_EXCEPTION, *PCPE_EXCEPTION; // Corrected Platform Error -#if (NTDDI_VERSION > NTDDI_WINXP) -typedef ERROR_RECORD_HEADER INIT_EXCEPTION, *PINIT_EXCEPTION; // Init Event -#endif - -#endif // _IA64_ - -#endif // defined(_X86_) || defined(_IA64_) || defined(_AMD64_) - -#endif // _MCE_ - - diff --git a/pub/ddk/messagedeviceservice.h b/pub/ddk/messagedeviceservice.h deleted file mode 100644 index 1b41379..0000000 --- a/pub/ddk/messagedeviceservice.h +++ /dev/null @@ -1,398 +0,0 @@ -/* - * MessageDeviceService.h - * - * Contains declarations for the Message Device Service - * - * Copyright (c) Microsoft Corporation, All Rights Reserved. - * - */ - -#ifndef _MESSAGEDEVICESERVICE_H_ -#define _MESSAGEDEVICESERVICE_H_ - -#include - -/*****************************************************************************/ -/* Message Service Info */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(SERVICE_Message, - 0x29b43bd0, 0x6b16, 0x49af, 0xb7, 0x2e, 0x85, 0x77, 0x0a, 0xdf, 0xeb, 0xdd); - -#define NAME_MessageSvc L"Message" -#define TYPE_MessageSvc DEVSVCTYPE_DEFAULT - - -/*****************************************************************************/ -/* Message Service Object Formats */ -/*****************************************************************************/ - -/* FORMAT_AbstractMessage - * - * MTP Format: Abstract Message (0xBB01) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractMessage, - 0xBB010000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AbstractMessage L"AbstractMessage" - - -/* FORMAT_AbstractMessageFolder - * - * MTP Format: Abstract Message Folder (0xBA07) - * Suggested MIME Type: - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractMessageFolder, - 0xBA070000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); - -#define NAME_AbstractMessageFolder L"AbstractMessageFolder" - - -/*****************************************************************************/ -/* Message Service Object Property Keys */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(MESSAGESVC_OBJECT_PROPERTIES, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F); - - -/* MessageObj.Subject - * - * MTP Property: Subject (0xDCE2) - * Type: String/AUInt16 - * Form: None/LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_Subject, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 2); - -#define NAME_MessageObj_Subject L"Subject" - - -/* MessageObj.Body - * - * MTP Property: Body Text (0xDCE1) - * Type: AUInt16 - * Form: LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_Body, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 3); - -#define NAME_MessageObj_Body L"Body" - - -/* MessageObj.Priority - * - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_Priority, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 4); - -#define NAME_MessageObj_Priority L"Priority" - -#define ENUM_MessageObj_PriorityHighest 2 -#define ENUM_MessageObj_PriorityNormal 1 -#define ENUM_MessageObj_PriorityLowest 0 - - -/* MessageObj.Category - * - * MTP Property: () - * Type: String/AUInt16 - * Form: None/LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_Category, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 10); - -#define NAME_MessageObj_Category L"Category" - - -/* MessageObj.Sender - * - * MTP Property: Message Sender (0xDD45) - * Type: String/AUInt16 - * Form: None/LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_Sender, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 18); - -#define NAME_MessageObj_Sender L"Sender" - - -/* MessageObj.To - * - * MTP Property: Message To (0xDD40) - * Type: AUInt16 - * Form: LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_To, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 20); - -#define NAME_MessageObj_To L"To" - - -/* MessageObj.CC - * - * MTP Property: Message CC (0xDD41) - * Type: AUInt16 - * Form: LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_CC, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 21); - -#define NAME_MessageObj_CC L"CC" - - -/* MessageObj.BCC - * - * MTP Property: Message BCC (0xDD42) - * Type: AUInt16 - * Form: LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_BCC, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 22); - -#define NAME_MessageObj_BCC L"BCC" - - -/* MessageObj.Read - * - * MTP Property: Message Read (0xDD43) - * Type: UInt16 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_Read, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 23); - -#define NAME_MessageObj_Read L"Read" - -#define ENUM_MessageObj_ReadFalse 0x00 -#define ENUM_MessageObj_ReadTrue 0xff - - -/* MessageObj.ReceivedTime - * - * MTP Property: Message Received Time (0xDD44) - * Type: String - * Form: DateTime - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_ReceivedTime, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 24); - -#define NAME_MessageObj_ReceivedTime L"ReceivedTime" - - -/* MessageObj.PatternOriginalDateTime - * - * Contains the original UTC time that a recurring item was to take place. - * - * Type: String - * Form: DateTime - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_PatternOriginalDateTime, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 26); - -#define NAME_MessageObj_PatternOriginalDateTime L"PatternOriginalDateTime" - - -/* MessageObj.PatternType - * - * Contains the pattern type of the recurring item. - * - * Type: UInt32 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_PatternType, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 27); - -#define NAME_MessageObj_PatternType L"PatternType" - -#define ENUM_MessageObj_PatternTypeDaily 0x00000001 -#define ENUM_MessageObj_PatternTypeWeekly 0x00000002 -#define ENUM_MessageObj_PatternTypeMonthly 0x00000003 -#define ENUM_MessageObj_PatternTypeYearly 0x00000004 - - -/* MessageObj.PatternValidStartDate - * - * Contains the first date on which the recurrence pattern is valid. The - * first instance of the recurring item is on or after this date. The date - * is in the time reference of the recurring item. - * - * Type: String - * Form: ISO 8601 Date - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_PatternValidStartDate, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 28); - -#define NAME_MessageObj_PatternValidStartDate L"PatternValidStartDate" - - -/* MessageObj.PatternValidEndDate - * - * Contains the last date on which the recurrence pattern is valid. The - * last instance of the recurring item is on or before this date. The date - * is in the time reference of the recurring item. - * - * Type: String - * Form: ISO 8601 Date - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_PatternValidEndDate, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 29); - -#define NAME_MessageObj_PatternValidEndDate L"PatternValidEndDate" - - -/* MessageObj.PatternPeriod - * - * Contains the period of the repeating recurrence pattern. The units of this - * property are determined by the value of MessageObj.PatternType. - * - * Type: UInt32 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_PatternPeriod, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 31); - -#define NAME_MessageObj_PatternPeriod L"PatternPeriod" - - -/* MessageObj.PatternDayOfWeek - * - * Contains the day of week mask for weekly, monthly, and yearly recurrence - * patterns. - * - * Type: UInt16 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_PatternDayOfWeek, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 32); - -#define NAME_MessageObj_PatternDayOfWeek L"PatternDayOfWeek" - -#define FLAG_MessageObj_DayOfWeekNone 0x0000 -#define FLAG_MessageObj_DayOfWeekSunday 0x0001 -#define FLAG_MessageObj_DayOfWeekMonday 0x0002 -#define FLAG_MessageObj_DayOfWeekTuesday 0x0004 -#define FLAG_MessageObj_DayOfWeekWednesday 0x0008 -#define FLAG_MessageObj_DayOfWeekThursday 0x0010 -#define FLAG_MessageObj_DayOfWeekFriday 0x0020 -#define FLAG_MessageObj_DayOfWeekSaturday 0x0040 - - -/* MessageObj.PatternDayOfMonth - * - * Contains the day of the month for monthly and yearly recurrence patterns. - * If day specified is greater than the number of days in the month the - * value is interpreted as the last valid day of the month. - * - * Type: UInt8 - * Form: Range - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_PatternDayOfMonth, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 33); - -#define NAME_MessageObj_PatternDayOfMonth L"PatternDayOfMonth" - -#define RANGEMIN_MessageObj_PatternDayOfMonth 1 -#define RANGEMAX_MessageObj_PatternDayOfMonth 31 -#define RANGESTEP_MessageObj_PatternDayOfMonth 1 - -/* MessageObj.PatternMonthOfYear - * - * Contains the month of the year for yearly recurrence patterns. - * - * Type: UInt8 - * Form: Range - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_PatternMonthOfYear, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 34); - -#define NAME_MessageObj_PatternMonthOfYear L"PatternMonthOfYear" - -#define RANGEMIN_MessageObj_PatternMonthOfYear 1 -#define RANGEMAX_MessageObj_PatternMonthOfYear 12 -#define RANGESTEP_MessageObj_PatternMonthOfYear 1 - - -/* MessageObj.PatternInstance - * - * Contains the instance of the recurring pattern that is to be matched. - * - * Type: UInt8 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_PatternInstance, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 35); - -#define NAME_MessageObj_PatternInstance L"PatternInstance" - -#define ENUM_MessageObj_PatternInstanceNone 0x00 -#define ENUM_MessageObj_PatternInstanceFirst 0x01 -#define ENUM_MessageObj_PatternInstanceSecond 0x02 -#define ENUM_MessageObj_PatternInstanceThird 0x03 -#define ENUM_MessageObj_PatternInstanceFourth 0x04 -#define ENUM_MessageObj_PatternInstanceLast 0x05 - - -/* MessageObj.PatternDeleteDates - * - * Contains a semi-colon separated list of the the dates on which instances - * of the recurring item have been deleted. Does not contain the original - * dates for items which have been moved. The date specified is in the - * time reference of the recurrence. - * - * Type: AUInt16 - * Form: LongString - */ - -DEFINE_DEVSVCPROPKEY(PKEY_MessageObj_PatternDeleteDates, - 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F, - 36); - -#define NAME_MessageObj_PatternDeleteDates L"PatternDeleteDates" - -#endif /* _MESSAGEDEVICESERVICE_H_ */ - - diff --git a/pub/ddk/metadatadeviceservice.h b/pub/ddk/metadatadeviceservice.h deleted file mode 100644 index 3a4f553..0000000 --- a/pub/ddk/metadatadeviceservice.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * MetadataDeviceService.h - * - * Contains definitions of the Device Metadata Service - * - * Copyright (c) Microsoft Corporation, All Rights Reserved. - * - */ - -#ifndef _METADATADEVICESERVICE_H_ -#define _METADATADEVICESERVICE_H_ - -#include - -/*****************************************************************************/ -/* Device Metadata Service Info */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(SERVICE_DeviceMetadata, - 0x332ffe6a, 0xaf65, 0x41e1, 0xa0, 0xaf, 0xd3, 0xe2, 0x62, 0x7b, 0xdf, 0x54); - -#define NAME_DeviceMetadataSvc L"Metadata" -#define TYPE_DeviceMetadataSvc DEVSVCTYPE_DEFAULT - - -/*****************************************************************************/ -/* Device Metadata Service Object Formats */ -/*****************************************************************************/ - -/* FORMAT_DeviceMetadataCAB - * - * CAB object format - */ - -DEFINE_DEVSVCGUID(FORMAT_DeviceMetadataCAB, - 0xe1809599, 0x4303, 0x4e3b, 0x92, 0x44, 0x99, 0xc6, 0x2c, 0x25, 0x45, 0x51); - -#define NAME_DeviceMetadataCAB L"DeviceMetadataCAB" - - -/*****************************************************************************/ -/* Device Metadata Service Object Property Keys */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(NAMESPACE_DeviceMetadataObj, - 0x68bb7eeb, 0x9eef, 0x45bd, 0x8d, 0xe6, 0x3b, 0x92, 0xa5, 0x7c, 0xae, 0x1e); - - -/* PKEY_DeviceMetadataObj_ContentID - * - * Contains the GUID that uniquely identifies the object cab contents. - * - * Type: UInt128 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_DeviceMetadataObj_ContentID, - 0x68bb7eeb, 0x9eef, 0x45bd, 0x8d, 0xe6, 0x3b, 0x92, 0xa5, 0x7c, 0xae, 0x1e, - 3); - -#define NAME_DeviceMetadataObj_ContentID L"ContentID" - - -/* PKEY_DeviceMetadataObj_DefaultCAB - * - * Indicates whether this object is the default cab. Each service shall have - * only one object marked as default. - * - * Type: UInt8 Boolean - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_DeviceMetadataObj_DefaultCAB, - 0x68bb7eeb, 0x9eef, 0x45bd, 0x8d, 0xe6, 0x3b, 0x92, 0xa5, 0x7c, 0xae, 0x1e, - 4); - -#define NAME_DeviceMetadataObj_DefaultCAB L"DefaultCAB" - -#define ENUM_DeviceMetadataObj_DefaultCABFalse 0 -#define ENUM_DeviceMetadataObj_DefaultCABTrue 1 - -#endif /* _METADATADEVICESERVICE_H_ */ - - diff --git a/pub/ddk/mf.h b/pub/ddk/mf.h deleted file mode 100644 index 809a454..0000000 --- a/pub/ddk/mf.h +++ /dev/null @@ -1,161 +0,0 @@ -/*++ - -Copyright (c) 1997 Microsoft Corporation - -Module Name: - - mf.h - -Abstract: - - This header describes the structures and interfaces required to interact - with the multifunction enumerator. - -Author: - -Revision History: - ---*/ - - -#if !defined(_MF_) -#define _MF_ - -// -// MfFlags value -// - -#define MF_FLAGS_EVEN_IF_NO_RESOURCE 0x00000001 -#define MF_FLAGS_NO_CREATE_IF_NO_RESOURCE 0x00000002 -#define MF_FLAGS_FILL_IN_UNKNOWN_RESOURCE 0x00000004 -#define MF_FLAGS_CREATE_BUT_NO_SHOW_DISABLED 0x00000008 - -typedef struct _MF_RESOURCE_MAP { - - ULONG Count; - UCHAR Resources[ANYSIZE_ARRAY]; - -} MF_RESOURCE_MAP, *PMF_RESOURCE_MAP; - - -typedef struct _MF_VARYING_RESOURCE_ENTRY { - - UCHAR ResourceIndex; - UCHAR Reserved[3]; // Packing - ULONG Offset; - ULONG Size; - ULONG MaxCount; - -} MF_VARYING_RESOURCE_ENTRY, *PMF_VARYING_RESOURCE_ENTRY; - - -typedef struct _MF_VARYING_RESOURCE_MAP { - - ULONG Count; - MF_VARYING_RESOURCE_ENTRY Resources[ANYSIZE_ARRAY]; - -} MF_VARYING_RESOURCE_MAP, *PMF_VARYING_RESOURCE_MAP; - - -typedef struct _MF_DEVICE_INFO *PMF_DEVICE_INFO; - -typedef struct _MF_DEVICE_INFO { - - // - // Name for this child, unique with respect to the other children - // - UNICODE_STRING Name; - - // - // A REG_MULTI_SZ style list of hardware IDs - // - UNICODE_STRING HardwareID; - - // - // A REG_MULTI_SZ style list of compatible IDs - // - UNICODE_STRING CompatibleID; - - // - // Map of resource that we totally consume - // - PMF_RESOURCE_MAP ResourceMap; - - // - // Map of resource that we partially consume - // - PMF_VARYING_RESOURCE_MAP VaryingResourceMap; - - // - // Flags - - // MF_FLAGS_FILL_IN_UNKNOWN_RESOURCE - if the parent resource doesn't - // contain a descriptor referenced in the ResourceMap use a - // null (CmResourceTypeNull) descriptor instead. - // - ULONG MfFlags; - -} MF_DEVICE_INFO; - -typedef -__drv_functionClass(MF_ENUMERATE_CHILD) -NTSTATUS -MF_ENUMERATE_CHILD( - __in_opt PVOID Context, - __in ULONG Index, - __out - __drv_at(ChildInfo->Name.Buffer, __drv_allocatesMem(Mem)) - __drv_at(ChildInfo->HardwareID.Buffer, __drv_allocatesMem(Mem)) - __drv_at(ChildInfo->CompatibleID.Buffer, __drv_allocatesMem(Mem)) - __drv_at(ChildInfo->ResourceMap, __drv_allocatesMem(Mem)) - __drv_at(ChildInfo->VaryingResourceMap, __drv_allocatesMem(Mem)) - PMF_DEVICE_INFO ChildInfo - ); -typedef MF_ENUMERATE_CHILD *PMF_ENUMERATE_CHILD; - -/*++ - - -Routine Description: - - This returns information about children to be enumerated by a multifunction - driver. - -Arguments: - - Context - Context from the MF_ENUMERATION_INTERFACE - - Index - Zero based index of the children - - ChildInfo - Pointer to a caller allocated buffer that should be filled in - by the callee. This will involve allocation of extra buffers for each - piece of information. These will be freed by calling ExFreePool when - they are no longer required. - -Return Value: - - Status code that indicates whether or not the function was successful. - - STATUS_NO_MORE_ENTRIES indicates that the are no more children to enumerate - ---*/ - -typedef struct _MF_ENUMERATION_INTERFACE { - - // - // Generic interface header - // - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // - // Multi-function enumeration data - // - PMF_ENUMERATE_CHILD EnumerateChild; - -} MF_ENUMERATION_INTERFACE, *PMF_ENUMERATION_INTERFACE; - -#endif - diff --git a/pub/ddk/midatlax.h b/pub/ddk/midatlax.h deleted file mode 100644 index 3482ebe..0000000 --- a/pub/ddk/midatlax.h +++ /dev/null @@ -1,122 +0,0 @@ -/*++ BUILD Version: 0009 // Increment this if a change has global effects -Copyright (c) 1987-1993 Microsoft Corporation - -Module Name: - - midatlas.h - -Abstract: - - This module defines the data structure used in mapping MIDS to the corresponding requests/ - contexts associated with them. - -Author: -Notes: - - MID (Multiplex ID) is used at both the server and the client ( redirector ) to distinguish - between the concurrently active requests on any connection. This data structure has been - designed to meet the following criterion. - - 1) It should scale well to handle the differing capabilities of a server, e.g., the typical - NT server permits 50 outstanding requests on any connection. The CORE level servers can go as - low as one and on Gateway machines the desired number can be very high ( in the oreder of thousands) - - 2) The two primary operations that need to be handled well are - i) mapping a MID to the context associated with it. - -- This routine will be invoked to process every packet received along any connection - at both the server and the client. - ii) generating a new MID for sending requests to the server. - -- This will be used at the client both for max. command enforcement as well as - tagging each concurrent request with a unique id. - - The most common case is that of a connection between a NT client and a NT server. All - design decisions have been made in order to ensure that the solutions are optimal - for this case. - - The MID data structure must be efficiently able to manage the unique tagging and identification - of a number of mids ( typically 50 ) from a possible combination of 65536 values. In order to - ensure a proper time space tradeoff the lookup is organized as a three level hierarchy. - - The 16 bits used to represent a MID are split upinto three bit fields. The length of the - rightmost field ( least signifiant ) is decided by the number of mids that are to be - allocated on creation. The remaining length is split up equally between the next two - fields, e.g., if 50 mids are to be allocated on creation , the length of the first field - is 6 ( 64 ( 2 ** 6 ) is greater than 50 ), 5 and 5. - ---*/ - -#ifndef _MIDATLAX_H_ -#define _MIDATLAX_H_ - -// -// Forward declaration -// - -typedef struct _MID_MAP_ *PMID_MAP; - - -typedef struct _RX_MID_ATLAS { - USHORT MaximumNumberOfMids; - USHORT MidsAllocated; - USHORT NumberOfMidsInUse; - USHORT NumberOfMidsDiscarded; - USHORT MaximumMidFieldWidth; - USHORT Reserved; - USHORT MidQuantum; - UCHAR MidQuantumFieldWidth; - UCHAR NumberOfLevels; - LIST_ENTRY MidMapFreeList; - LIST_ENTRY MidMapExpansionList; - PMID_MAP pRootMidMap; -} RX_MID_ATLAS, *PRX_MID_ATLAS; - -typedef -VOID (*PCONTEXT_DESTRUCTOR) ( - PVOID Context - ); - -#define RxGetMaximumNumberOfMids(ATLAS) ((ATLAS)->MaximumNumberOfMids) - -#define RxGetNumberOfMidsInUse(ATLAS) ((ATLAS)->NumberOfMidsInUse) - -PRX_MID_ATLAS -RxCreateMidAtlas ( - USHORT MaximumNumberOfEntries, - USHORT InitialAllocation - ); - -VOID -RxDestroyMidAtlas ( - PRX_MID_ATLAS MidAtlas, - PCONTEXT_DESTRUCTOR ContextDestructor - ); - -PVOID -RxMapMidToContext ( - PRX_MID_ATLAS MidAtlas, - USHORT Mid - ); - -NTSTATUS -RxAssociateContextWithMid ( - PRX_MID_ATLAS MidAtlas, - PVOID Context, - PUSHORT NewMid - ); - -NTSTATUS -RxMapAndDissociateMidFromContext ( - PRX_MID_ATLAS MidAtlas, - USHORT Mid, - PVOID *ContextPointer - ); - -NTSTATUS -RxReassociateMid ( - PRX_MID_ATLAS MidAtlas, - USHORT Mid, - PVOID NewContext - ); - -#endif - diff --git a/pub/ddk/miniport.h b/pub/ddk/miniport.h deleted file mode 100644 index 6bbcda5..0000000 --- a/pub/ddk/miniport.h +++ /dev/null @@ -1,6608 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - miniport.h - -Abstract: - - Type definitions for miniport drivers. - -Revision History: - ---*/ - -#ifndef _MINIPORT_ -#define _MINIPORT_ - -#include "stddef.h" - -#define ASSERT( exp ) - -#ifndef FAR -#define FAR -#endif - -#if defined(_MSC_VER) -#if (_MSC_VER >= 1200) -#pragma warning(push) -#pragma warning(disable:4201) // nameless struct/union -#pragma warning(disable:4214) // bit field other than int -#endif -#endif - - -#ifndef IN -#define IN -#endif - -#ifndef OUT -#define OUT -#endif - -#ifndef OPTIONAL -#define OPTIONAL -#endif - -#ifndef NOTHING -#define NOTHING -#endif - -#ifndef CRITICAL -#define CRITICAL -#endif - -#ifndef ANYSIZE_ARRAY -#define ANYSIZE_ARRAY 1 // winnt -#endif - -// begin_winnt - -// -// For compilers that don't support nameless unions/structs -// -#ifndef DUMMYUNIONNAME -#if defined(NONAMELESSUNION) || !defined(_MSC_EXTENSIONS) -#define DUMMYUNIONNAME u -#define DUMMYUNIONNAME2 u2 -#define DUMMYUNIONNAME3 u3 -#define DUMMYUNIONNAME4 u4 -#define DUMMYUNIONNAME5 u5 -#define DUMMYUNIONNAME6 u6 -#define DUMMYUNIONNAME7 u7 -#define DUMMYUNIONNAME8 u8 -#define DUMMYUNIONNAME9 u9 -#else -#define DUMMYUNIONNAME -#define DUMMYUNIONNAME2 -#define DUMMYUNIONNAME3 -#define DUMMYUNIONNAME4 -#define DUMMYUNIONNAME5 -#define DUMMYUNIONNAME6 -#define DUMMYUNIONNAME7 -#define DUMMYUNIONNAME8 -#define DUMMYUNIONNAME9 -#endif -#endif // DUMMYUNIONNAME - -#ifndef DUMMYSTRUCTNAME -#if defined(NONAMELESSUNION) || !defined(_MSC_EXTENSIONS) -#define DUMMYSTRUCTNAME s -#define DUMMYSTRUCTNAME2 s2 -#define DUMMYSTRUCTNAME3 s3 -#define DUMMYSTRUCTNAME4 s4 -#define DUMMYSTRUCTNAME5 s5 -#else -#define DUMMYSTRUCTNAME -#define DUMMYSTRUCTNAME2 -#define DUMMYSTRUCTNAME3 -#define DUMMYSTRUCTNAME4 -#define DUMMYSTRUCTNAME5 -#endif -#endif // DUMMYSTRUCTNAME - -#include -#include - -#if defined(STRICT_GS_ENABLED) -#pragma strict_gs_check(push, on) -#endif - -#if defined(_M_MRX000) && !(defined(MIDL_PASS) || defined(RC_INVOKED)) && defined(ENABLE_RESTRICTED) -#define RESTRICTED_POINTER __restrict -#else -#define RESTRICTED_POINTER -#endif - -#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64) -#define ALIGNMENT_MACHINE -#define UNALIGNED __unaligned -#if defined(_WIN64) -#define UNALIGNED64 __unaligned -#else -#define UNALIGNED64 -#endif -#else -#undef ALIGNMENT_MACHINE -#define UNALIGNED -#define UNALIGNED64 -#endif - - -#if defined(_WIN64) || defined(_M_ALPHA) -#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG) -#define MEMORY_ALLOCATION_ALIGNMENT 16 -#else -#define MAX_NATURAL_ALIGNMENT sizeof(ULONG) -#define MEMORY_ALLOCATION_ALIGNMENT 8 -#endif - -// -// TYPE_ALIGNMENT will return the alignment requirements of a given type for -// the current platform. -// - -#ifdef __cplusplus -#if _MSC_VER >= 1300 -#define TYPE_ALIGNMENT( t ) __alignof(t) -#endif -#else -#define TYPE_ALIGNMENT( t ) \ - FIELD_OFFSET( struct { char x; t test; }, test ) -#endif - -#if defined(_WIN64) - -#if defined(_AMD64_) -#define PROBE_ALIGNMENT( _s ) TYPE_ALIGNMENT( ULONG ) -#elif defined(_IA64_) -#define PROBE_ALIGNMENT( _s ) (TYPE_ALIGNMENT( _s ) > TYPE_ALIGNMENT( ULONG ) ? \ - TYPE_ALIGNMENT( _s ) : TYPE_ALIGNMENT( ULONG )) -#else -#error "No Target Architecture" -#endif - -#define PROBE_ALIGNMENT32( _s ) TYPE_ALIGNMENT( ULONG ) - -#else - -#define PROBE_ALIGNMENT( _s ) TYPE_ALIGNMENT( ULONG ) - -#endif - -// -// C_ASSERT() can be used to perform many compile-time assertions: -// type sizes, field offsets, etc. -// -// An assertion failure results in error C2118: negative subscript. -// - -#ifndef SORTPP_PASS -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#else -#define C_ASSERT(e) /* nothing */ -#endif - -#include - -// end_winnt - -#ifndef CONST -#define CONST const -#endif - -// begin_winnt - -#if (defined(_M_IX86) || defined(_M_IA64) || defined(_M_AMD64)) && !defined(MIDL_PASS) -#define DECLSPEC_IMPORT __declspec(dllimport) -#else -#define DECLSPEC_IMPORT -#endif - -#ifndef DECLSPEC_NORETURN -#if (_MSC_VER >= 1200) && !defined(MIDL_PASS) -#define DECLSPEC_NORETURN __declspec(noreturn) -#else -#define DECLSPEC_NORETURN -#endif -#endif - -#ifndef DECLSPEC_NOTHROW -#if (_MSC_VER >= 1200) && !defined(MIDL_PASS) -#define DECLSPEC_NOTHROW __declspec(nothrow) -#else -#define DECLSPEC_NOTHROW -#endif -#endif - -#ifndef DECLSPEC_ALIGN -#if (_MSC_VER >= 1300) && !defined(MIDL_PASS) -#define DECLSPEC_ALIGN(x) __declspec(align(x)) -#else -#define DECLSPEC_ALIGN(x) -#endif -#endif - -#ifndef SYSTEM_CACHE_ALIGNMENT_SIZE -#if defined(_AMD64_) || defined(_X86_) -#define SYSTEM_CACHE_ALIGNMENT_SIZE 64 -#else -#define SYSTEM_CACHE_ALIGNMENT_SIZE 128 -#endif -#endif - -#ifndef DECLSPEC_CACHEALIGN -#define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(SYSTEM_CACHE_ALIGNMENT_SIZE) -#endif - -#ifndef DECLSPEC_UUID -#if (_MSC_VER >= 1100) && defined (__cplusplus) -#define DECLSPEC_UUID(x) __declspec(uuid(x)) -#else -#define DECLSPEC_UUID(x) -#endif -#endif - -#ifndef DECLSPEC_NOVTABLE -#if (_MSC_VER >= 1100) && defined(__cplusplus) -#define DECLSPEC_NOVTABLE __declspec(novtable) -#else -#define DECLSPEC_NOVTABLE -#endif -#endif - -#ifndef DECLSPEC_SELECTANY -#if (_MSC_VER >= 1100) -#define DECLSPEC_SELECTANY __declspec(selectany) -#else -#define DECLSPEC_SELECTANY -#endif -#endif - -#ifndef NOP_FUNCTION -#if (_MSC_VER >= 1210) -#define NOP_FUNCTION __noop -#else -#define NOP_FUNCTION (void)0 -#endif -#endif - -#ifndef DECLSPEC_ADDRSAFE -#if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64)) -#define DECLSPEC_ADDRSAFE __declspec(address_safe) -#else -#define DECLSPEC_ADDRSAFE -#endif -#endif - -#ifndef DECLSPEC_NOINLINE -#if (_MSC_VER >= 1300) -#define DECLSPEC_NOINLINE __declspec(noinline) -#else -#define DECLSPEC_NOINLINE -#endif -#endif - -#ifndef FORCEINLINE -#if (_MSC_VER >= 1200) -#define FORCEINLINE __forceinline -#else -#define FORCEINLINE __inline -#endif -#endif - -#ifndef DECLSPEC_DEPRECATED -#if (_MSC_VER >= 1300) && !defined(MIDL_PASS) -#define DECLSPEC_DEPRECATED __declspec(deprecated) -#define DEPRECATE_SUPPORTED -#else -#define DECLSPEC_DEPRECATED -#undef DEPRECATE_SUPPORTED -#endif -#endif - -#ifdef DEPRECATE_DDK_FUNCTIONS -#ifdef _NTDDK_ -#define DECLSPEC_DEPRECATED_DDK DECLSPEC_DEPRECATED -#ifdef DEPRECATE_SUPPORTED -#define PRAGMA_DEPRECATED_DDK 1 -#endif -#else -#define DECLSPEC_DEPRECATED_DDK -#define PRAGMA_DEPRECATED_DDK 1 -#endif -#else -#define DECLSPEC_DEPRECATED_DDK -#define PRAGMA_DEPRECATED_DDK 0 -#endif - -// -// Void -// - -typedef void *PVOID; -typedef void * POINTER_64 PVOID64; - -// end_winnt - -#ifndef _MANAGED -#if defined(_M_IX86) -#define FASTCALL __fastcall -#else -#define FASTCALL -#endif -#else -#define FASTCALL NTAPI -#endif - - -// -// Basics -// - -#ifndef VOID -#define VOID void -typedef char CHAR; -typedef short SHORT; -typedef long LONG; -#if !defined(MIDL_PASS) -typedef int INT; -#endif -#endif - -// -// UNICODE (Wide Character) types -// - -#ifndef _MAC -typedef wchar_t WCHAR; // wc, 16-bit UNICODE character -#else -// some Macintosh compilers don't define wchar_t in a convenient location, or define it as a char -typedef unsigned short WCHAR; // wc, 16-bit UNICODE character -#endif - -typedef WCHAR *PWCHAR, *LPWCH, *PWCH; -typedef CONST WCHAR *LPCWCH, *PCWCH; - -typedef __nullterminated WCHAR *NWPSTR, *LPWSTR, *PWSTR; -typedef __nullterminated PWSTR *PZPWSTR; -typedef __nullterminated CONST PWSTR *PCZPWSTR; -typedef __nullterminated WCHAR UNALIGNED *LPUWSTR, *PUWSTR; -typedef __nullterminated CONST WCHAR *LPCWSTR, *PCWSTR; -typedef __nullterminated PCWSTR *PZPCWSTR; -typedef __nullterminated CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR; - -typedef __nullnullterminated WCHAR *PZZWSTR; -typedef __nullnullterminated CONST WCHAR *PCZZWSTR; -typedef __nullnullterminated WCHAR UNALIGNED *PUZZWSTR; -typedef __nullnullterminated CONST WCHAR UNALIGNED *PCUZZWSTR; - -typedef __possibly_notnullterminated WCHAR *PNZWCH; -typedef __possibly_notnullterminated CONST WCHAR *PCNZWCH; -typedef __possibly_notnullterminated WCHAR UNALIGNED *PUNZWCH; -typedef __possibly_notnullterminated CONST WCHAR UNALIGNED *PCUNZWCH; - -#if _WIN32_WINNT >= 0x0600 || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS)) - -typedef CONST WCHAR *LPCWCHAR, *PCWCHAR; -typedef CONST WCHAR UNALIGNED *LPCUWCHAR, *PCUWCHAR; - -// -// UCS (Universal Character Set) types -// - -typedef unsigned long UCSCHAR; - -// -// Even pre-Unicode agreement, UCS values are always in the -// range U+00000000 to U+7FFFFFFF, so we'll pick an obvious -// value. - -#define UCSCHAR_INVALID_CHARACTER (0xffffffff) - -#define MIN_UCSCHAR (0) - -// -// We'll assume here that the ISO-10646 / Unicode agreement -// not to assign code points after U+0010FFFF holds so that -// we do not have to have separate "UCSCHAR" and "UNICODECHAR" -// types. -// - -#define MAX_UCSCHAR (0x0010FFFF) - -typedef UCSCHAR *PUCSCHAR; -typedef const UCSCHAR *PCUCSCHAR; - -typedef UCSCHAR *PUCSSTR; -typedef UCSCHAR UNALIGNED *PUUCSSTR; - -typedef const UCSCHAR *PCUCSSTR; -typedef const UCSCHAR UNALIGNED *PCUUCSSTR; - -typedef UCSCHAR UNALIGNED *PUUCSCHAR; -typedef const UCSCHAR UNALIGNED *PCUUCSCHAR; - -#endif // _WIN32_WINNT >= 0x0600 - - -// -// ANSI (Multi-byte Character) types -// -typedef CHAR *PCHAR, *LPCH, *PCH; -typedef CONST CHAR *LPCCH, *PCCH; - -typedef __nullterminated CHAR *NPSTR, *LPSTR, *PSTR; -typedef __nullterminated PSTR *PZPSTR; -typedef __nullterminated CONST PSTR *PCZPSTR; -typedef __nullterminated CONST CHAR *LPCSTR, *PCSTR; -typedef __nullterminated PCSTR *PZPCSTR; - -typedef __nullnullterminated CHAR *PZZSTR; -typedef __nullnullterminated CONST CHAR *PCZZSTR; - -typedef __possibly_notnullterminated CHAR *PNZCH; -typedef __possibly_notnullterminated CONST CHAR *PCNZCH; - -// -// Neutral ANSI/UNICODE types and macros -// -#ifdef UNICODE // r_winnt - -#ifndef _TCHAR_DEFINED -typedef WCHAR TCHAR, *PTCHAR; -typedef WCHAR TUCHAR, *PTUCHAR; -#define _TCHAR_DEFINED -#endif /* !_TCHAR_DEFINED */ - -typedef LPWCH LPTCH, PTCH; -typedef LPCWCH LPCTCH, PCTCH; -typedef LPWSTR PTSTR, LPTSTR; -typedef LPCWSTR PCTSTR, LPCTSTR; -typedef LPUWSTR PUTSTR, LPUTSTR; -typedef LPCUWSTR PCUTSTR, LPCUTSTR; -typedef LPWSTR LP; -typedef PZZWSTR PZZTSTR; -typedef PCZZWSTR PCZZTSTR; -typedef PUZZWSTR PUZZTSTR; -typedef PCUZZWSTR PCUZZTSTR; -typedef PNZWCH PNZTCH; -typedef PCNZWCH PCNZTCH; -typedef PUNZWCH PUNZTCH; -typedef PCUNZWCH PCUNZTCH; -#define __TEXT(quote) L##quote // r_winnt - -#else /* UNICODE */ // r_winnt - -#ifndef _TCHAR_DEFINED -typedef char TCHAR, *PTCHAR; -typedef unsigned char TUCHAR, *PTUCHAR; -#define _TCHAR_DEFINED -#endif /* !_TCHAR_DEFINED */ - -typedef LPCH LPTCH, PTCH; -typedef LPCCH LPCTCH, PCTCH; -typedef LPSTR PTSTR, LPTSTR, PUTSTR, LPUTSTR; -typedef LPCSTR PCTSTR, LPCTSTR, PCUTSTR, LPCUTSTR; -typedef PZZSTR PZZTSTR, PUZZTSTR; -typedef PCZZSTR PCZZTSTR, PCUZZTSTR; -typedef PNZCH PNZTCH, PUNZTCH; -typedef PCNZCH PCNZTCH, PCUNZTCH; -#define __TEXT(quote) quote // r_winnt - -#endif /* UNICODE */ // r_winnt -#define TEXT(quote) __TEXT(quote) // r_winnt - - -// end_winnt - -// -// The type QUAD and UQUAD are intended to use when a 8 byte aligned structure -// is required, but it is not a floating point number. -// - -typedef double DOUBLE; - -typedef struct _QUAD { - union { - __int64 UseThisFieldToCopy; - double DoNotUseThisField; - } DUMMYUNIONNAME; - -} QUAD; - -// -// Pointer to Basics -// - -typedef SHORT *PSHORT; // winnt -typedef LONG *PLONG; // winnt -typedef QUAD *PQUAD; - -// -// Unsigned Basics -// - -// Tell windef.h that some types are already defined. -#define BASETYPES - -typedef unsigned char UCHAR; -typedef unsigned short USHORT; -typedef unsigned long ULONG; -typedef QUAD UQUAD; - -// -// Pointer to Unsigned Basics -// - -typedef UCHAR *PUCHAR; -typedef USHORT *PUSHORT; -typedef ULONG *PULONG; -typedef UQUAD *PUQUAD; - -#if _WIN32_WINNT >= 0x0600 || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS)) - -// -// Pointer to Const Unsigned Basics -// - -typedef CONST UCHAR *PCUCHAR; -typedef CONST USHORT *PCUSHORT; -typedef CONST ULONG *PCULONG; -typedef CONST UQUAD *PCUQUAD; - -#endif // _WIN32_WINNT >= 0x0600 - -// -// Signed characters -// - -typedef signed char SCHAR; -typedef SCHAR *PSCHAR; - -#if _WIN32_WINNT >= 0x0600 || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS)) - -typedef CONST SCHAR *PCSCHAR; - -#endif // _WIN32_WINNT >= 0x0600 - -#ifndef NO_STRICT -#ifndef STRICT -#define STRICT 1 -#endif -#endif - -// begin_winnt - -#define ALL_PROCESSOR_GROUPS 0xffff - -// -// Structure to represent a system wide processor number. It contains a -// group number and relative processor number within the group. -// - -typedef struct _PROCESSOR_NUMBER { - USHORT Group; - UCHAR Number; - UCHAR Reserved; -} PROCESSOR_NUMBER, *PPROCESSOR_NUMBER; - -// -// Structure to represent a group-specific affinity, such as that of a -// thread. Specifies the group number and the affinity within that group. -// - -typedef struct _GROUP_AFFINITY { - KAFFINITY Mask; - USHORT Group; - USHORT Reserved[3]; -} GROUP_AFFINITY, *PGROUP_AFFINITY; - -// -// Handle to an Object -// - -#ifdef STRICT -typedef void *HANDLE; -#if 0 && (_MSC_VER > 1000) -#define DECLARE_HANDLE(name) struct name##__; typedef struct name##__ *name -#else -#define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name -#endif -#else -typedef PVOID HANDLE; -#define DECLARE_HANDLE(name) typedef HANDLE name -#endif -typedef HANDLE *PHANDLE; - -// -// Flag (bit) fields -// - -typedef UCHAR FCHAR; -typedef USHORT FSHORT; -typedef ULONG FLONG; - -// Component Object Model defines, and macros - -#ifndef _HRESULT_DEFINED -#define _HRESULT_DEFINED -#ifdef __midl -typedef LONG HRESULT; -#else -typedef __success(return >= 0) long HRESULT; -#endif // __midl -#endif // !_HRESULT_DEFINED - -#ifdef __cplusplus - #define EXTERN_C extern "C" -#else - #define EXTERN_C extern -#endif - -#if defined(_WIN32) || defined(_MPPC_) - -// Win32 doesn't support __export - -#ifdef _68K_ -#define STDMETHODCALLTYPE __cdecl -#else -#define STDMETHODCALLTYPE __stdcall -#endif -#define STDMETHODVCALLTYPE __cdecl - -#define STDAPICALLTYPE __stdcall -#define STDAPIVCALLTYPE __cdecl - -#else - -#define STDMETHODCALLTYPE __export __stdcall -#define STDMETHODVCALLTYPE __export __cdecl - -#define STDAPICALLTYPE __export __stdcall -#define STDAPIVCALLTYPE __export __cdecl - -#endif - - -#define STDAPI EXTERN_C HRESULT STDAPICALLTYPE -#define STDAPI_(type) EXTERN_C type STDAPICALLTYPE - -#define STDMETHODIMP HRESULT STDMETHODCALLTYPE -#define STDMETHODIMP_(type) type STDMETHODCALLTYPE - -#define STDOVERRIDEMETHODIMP __override STDMETHODIMP -#define STDOVERRIDEMETHODIMP_(type) __override STDMETHODIMP_(type) - -#define IFACEMETHODIMP __override STDMETHODIMP -#define IFACEMETHODIMP_(type) __override STDMETHODIMP_(type) - -// The 'V' versions allow Variable Argument lists. - -#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE -#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE - -#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE -#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE - -#define STDOVERRIDEMETHODIMPV __override STDMETHODIMPV -#define STDOVERRIDEMETHODIMPV_(type) __override STDMETHODIMPV_(type) - -#define IFACEMETHODIMPV __override STDMETHODIMPV -#define IFACEMETHODIMPV_(type) __override STDMETHODIMPV_(type) - -// end_winnt - - -// -// Low order two bits of a handle are ignored by the system and available -// for use by application code as tag bits. The remaining bits are opaque -// and used to store a serial number and table index. -// - -#define OBJ_HANDLE_TAGBITS 0x00000003L - -// -// Cardinal Data Types [0 - 2**N-2) -// - -typedef char CCHAR; // winnt -typedef short CSHORT; -typedef ULONG CLONG; - -typedef CCHAR *PCCHAR; -typedef CSHORT *PCSHORT; -typedef CLONG *PCLONG; - - -// -// __int64 is only supported by 2.0 and later midl. -// __midl is set by the 2.0 midl and not by 1.0 midl. -// - -#define _ULONGLONG_ -#if (!defined (_MAC) && (!defined(MIDL_PASS) || defined(__midl)) && (!defined(_M_IX86) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64))) -typedef __int64 LONGLONG; -typedef unsigned __int64 ULONGLONG; - -#define MAXLONGLONG (0x7fffffffffffffff) - - -#else - -#if defined(_MAC) && defined(_MAC_INT_64) -typedef __int64 LONGLONG; -typedef unsigned __int64 ULONGLONG; - -#define MAXLONGLONG (0x7fffffffffffffff) - - -#else -typedef double LONGLONG; -typedef double ULONGLONG; -#endif //_MAC and int64 - -#endif - -typedef LONGLONG *PLONGLONG; -typedef ULONGLONG *PULONGLONG; - -// Update Sequence Number - -typedef LONGLONG USN; - -#if defined(MIDL_PASS) -typedef struct _LARGE_INTEGER { -#else // MIDL_PASS -typedef union _LARGE_INTEGER { - struct { - ULONG LowPart; - LONG HighPart; - } DUMMYSTRUCTNAME; - struct { - ULONG LowPart; - LONG HighPart; - } u; -#endif //MIDL_PASS - LONGLONG QuadPart; -} LARGE_INTEGER; - -typedef LARGE_INTEGER *PLARGE_INTEGER; - -#if defined(MIDL_PASS) -typedef struct _ULARGE_INTEGER { -#else // MIDL_PASS -typedef union _ULARGE_INTEGER { - struct { - ULONG LowPart; - ULONG HighPart; - } DUMMYSTRUCTNAME; - struct { - ULONG LowPart; - ULONG HighPart; - } u; -#endif //MIDL_PASS - ULONGLONG QuadPart; -} ULARGE_INTEGER; - -typedef ULARGE_INTEGER *PULARGE_INTEGER; - - -// -// Physical address. -// - -typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS; - - -// -// Boolean -// - -typedef UCHAR BOOLEAN; // winnt -typedef BOOLEAN *PBOOLEAN; // winnt - - -// -// Constants -// - -#define FALSE 0 -#define TRUE 1 - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#define NULL64 0 -#else -#define NULL ((void *)0) -#define NULL64 ((void * POINTER_64)0) -#endif -#endif // NULL - -// -// Calculate the byte offset of a field in a structure of type type. -// - -#define FIELD_OFFSET(type, field) ((LONG)(LONG_PTR)&(((type *)0)->field)) - -// -// Calculate the size of a field in a structure of type type, without -// knowing or stating the type of the field. -// -#define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field)) - -// -// Calculate the size of a structure of type type up through and -// including a field. -// -#define RTL_SIZEOF_THROUGH_FIELD(type, field) \ - (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field)) - -// -// RTL_CONTAINS_FIELD usage: -// -// if (RTL_CONTAINS_FIELD(pBlock, pBlock->cbSize, dwMumble)) { // safe to use pBlock->dwMumble -// -#define RTL_CONTAINS_FIELD(Struct, Size, Field) \ - ( (((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size)) ) - -// -// Return the number of elements in a statically sized array. -// ULONG Buffer[100]; -// RTL_NUMBER_OF(Buffer) == 100 -// This is also popularly known as: NUMBER_OF, ARRSIZE, _countof, NELEM, etc. -// -#define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0])) - -#if defined(__cplusplus) && \ - !defined(MIDL_PASS) && \ - !defined(RC_INVOKED) && \ - !defined(_PREFAST_) && \ - (_MSC_FULL_VER >= 13009466) && \ - !defined(SORTPP_PASS) -// -// RtlpNumberOf is a function that takes a reference to an array of N Ts. -// -// typedef T array_of_T[N]; -// typedef array_of_T &reference_to_array_of_T; -// -// RtlpNumberOf returns a pointer to an array of N chars. -// We could return a reference instead of a pointer but older compilers do not accept that. -// -// typedef char array_of_char[N]; -// typedef array_of_char *pointer_to_array_of_char; -// -// sizeof(array_of_char) == N -// sizeof(*pointer_to_array_of_char) == N -// -// pointer_to_array_of_char RtlpNumberOf(reference_to_array_of_T); -// -// We never even call RtlpNumberOf, we just take the size of dereferencing its return type. -// We do not even implement RtlpNumberOf, we just decare it. -// -// Attempts to pass pointers instead of arrays to this macro result in compile time errors. -// That is the point. -// -extern "C++" // templates cannot be declared to have 'C' linkage -template -char (*RtlpNumberOf( UNALIGNED T (&)[N] ))[N]; - -#define RTL_NUMBER_OF_V2(A) (sizeof(*RtlpNumberOf(A))) - -// -// This does not work with: -// -// void Foo() -// { -// struct { int x; } y[2]; -// RTL_NUMBER_OF_V2(y); // illegal use of anonymous local type in template instantiation -// } -// -// You must instead do: -// -// struct Foo1 { int x; }; -// -// void Foo() -// { -// Foo1 y[2]; -// RTL_NUMBER_OF_V2(y); // ok -// } -// -// OR -// -// void Foo() -// { -// struct { int x; } y[2]; -// RTL_NUMBER_OF_V1(y); // ok -// } -// -// OR -// -// void Foo() -// { -// struct { int x; } y[2]; -// _ARRAYSIZE(y); // ok -// } -// - -#else -#define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A) -#endif - -#ifdef ENABLE_RTL_NUMBER_OF_V2 -#define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A) -#else -#define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A) -#endif - -// -// ARRAYSIZE is more readable version of RTL_NUMBER_OF_V2, and uses -// it regardless of ENABLE_RTL_NUMBER_OF_V2 -// -// _ARRAYSIZE is a version useful for anonymous types -// -#define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A) -#define _ARRAYSIZE(A) RTL_NUMBER_OF_V1(A) - -// -// An expression that yields the type of a field in a struct. -// -#define RTL_FIELD_TYPE(type, field) (((type*)0)->field) - -// RTL_ to avoid collisions in the global namespace. -// -// Given typedef struct _FOO { BYTE Bar[123]; } FOO; -// RTL_NUMBER_OF_FIELD(FOO, Bar) == 123 -// -#define RTL_NUMBER_OF_FIELD(type, field) (RTL_NUMBER_OF(RTL_FIELD_TYPE(type, field))) - -// -// eg: -// typedef struct FOO { -// ULONG Integer; -// PVOID Pointer; -// } FOO; -// -// RTL_PADDING_BETWEEN_FIELDS(FOO, Integer, Pointer) == 0 for Win32, 4 for Win64 -// -#define RTL_PADDING_BETWEEN_FIELDS(T, F1, F2) \ - ((FIELD_OFFSET(T, F2) > FIELD_OFFSET(T, F1)) \ - ? (FIELD_OFFSET(T, F2) - FIELD_OFFSET(T, F1) - RTL_FIELD_SIZE(T, F1)) \ - : (FIELD_OFFSET(T, F1) - FIELD_OFFSET(T, F2) - RTL_FIELD_SIZE(T, F2))) - -// RTL_ to avoid collisions in the global namespace. -#if defined(__cplusplus) -#define RTL_CONST_CAST(type) const_cast -#else -#define RTL_CONST_CAST(type) (type) -#endif - -// end_winnt -// -// This works "generically" for Unicode and Ansi/Oem strings. -// Usage: -// const static UNICODE_STRING FooU = RTL_CONSTANT_STRING(L"Foo"); -// const static STRING Foo = RTL_CONSTANT_STRING( "Foo"); -// instead of the slower: -// UNICODE_STRING FooU; -// STRING Foo; -// RtlInitUnicodeString(&FooU, L"Foo"); -// RtlInitString(&Foo , "Foo"); -// -// Or: -// const static char szFoo[] = "Foo"; -// const static STRING sFoo = RTL_CONSTANT_STRING(szFoo); -// -// This will compile without error or warning in C++. C will get a warning. -// -#ifdef __cplusplus -extern "C++" -{ -char _RTL_CONSTANT_STRING_type_check(const char *s); -char _RTL_CONSTANT_STRING_type_check(const WCHAR *s); -// __typeof would be desirable here instead of sizeof. -template class _RTL_CONSTANT_STRING_remove_const_template_class; -template <> class _RTL_CONSTANT_STRING_remove_const_template_class {public: typedef char T; }; -template <> class _RTL_CONSTANT_STRING_remove_const_template_class {public: typedef WCHAR T; }; -#define _RTL_CONSTANT_STRING_remove_const_macro(s) \ - (const_cast<_RTL_CONSTANT_STRING_remove_const_template_class::T*>(s)) -} -#else -char _RTL_CONSTANT_STRING_type_check(const void *s); -#define _RTL_CONSTANT_STRING_remove_const_macro(s) (s) -#endif -#define RTL_CONSTANT_STRING(s) \ -{ \ - sizeof( s ) - sizeof( (s)[0] ), \ - sizeof( s ) / sizeof(_RTL_CONSTANT_STRING_type_check(s)), \ - _RTL_CONSTANT_STRING_remove_const_macro(s) \ -} -// begin_winnt - -// like sizeof -// usually this would be * CHAR_BIT, but we don't necessarily have #include -#define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) * 8) - -#define RTL_BITS_OF_FIELD(type, field) (RTL_BITS_OF(RTL_FIELD_TYPE(type, field))) - -// -// Calculate the address of the base of the structure given its type, and an -// address of a field within the structure. -// - -#define CONTAINING_RECORD(address, type, field) ((type *)( \ - (PCHAR)(address) - \ - (ULONG_PTR)(&((type *)0)->field))) - - -// -// Interrupt Request Level (IRQL) -// - -typedef UCHAR KIRQL; - -typedef KIRQL *PKIRQL; - -#include - -// -// Macros used to eliminate compiler warning generated when formal -// parameters or local variables are not declared. -// -// Use DBG_UNREFERENCED_PARAMETER() when a parameter is not yet -// referenced but will be once the module is completely developed. -// -// Use DBG_UNREFERENCED_LOCAL_VARIABLE() when a local variable is not yet -// referenced but will be once the module is completely developed. -// -// Use UNREFERENCED_PARAMETER() if a parameter will never be referenced. -// -// DBG_UNREFERENCED_PARAMETER and DBG_UNREFERENCED_LOCAL_VARIABLE will -// eventually be made into a null macro to help determine whether there -// is unfinished work. -// - -#if ! defined(lint) -#define UNREFERENCED_PARAMETER(P) (P) -#define DBG_UNREFERENCED_PARAMETER(P) (P) -#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V) - -#else // lint - -// Note: lint -e530 says don't complain about uninitialized variables for -// this varible. Error 527 has to do with unreachable code. -// -restore restores checking to the -save state - -#define UNREFERENCED_PARAMETER(P) \ - /*lint -save -e527 -e530 */ \ - { \ - (P) = (P); \ - } \ - /*lint -restore */ -#define DBG_UNREFERENCED_PARAMETER(P) \ - /*lint -save -e527 -e530 */ \ - { \ - (P) = (P); \ - } \ - /*lint -restore */ -#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) \ - /*lint -save -e527 -e530 */ \ - { \ - (V) = (V); \ - } \ - /*lint -restore */ - -#endif // lint - -// -// Macro used to eliminate compiler warning 4715 within a switch statement -// when all possible cases have already been accounted for. -// -// switch (a & 3) { -// case 0: return 1; -// case 1: return Foo(); -// case 2: return Bar(); -// case 3: return 1; -// DEFAULT_UNREACHABLE; -// - -#if (_MSC_VER > 1200) -#define DEFAULT_UNREACHABLE default: __assume(0) -#else - -// -// Older compilers do not support __assume(), and there is no other free -// method of eliminating the warning. -// - -#define DEFAULT_UNREACHABLE - -#endif - -#ifdef __cplusplus - -// Define operator overloads to enable bit operations on enum values that are -// used to define flags. Use DEFINE_ENUM_FLAG_OPERATORS(YOUR_TYPE) to enable these -// operators on YOUR_TYPE. - -// Moved here from objbase.w. - -#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \ -extern "C++" { \ -inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) | ((int)b)); } \ -inline ENUMTYPE &operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \ -inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) & ((int)b)); } \ -inline ENUMTYPE &operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \ -inline ENUMTYPE operator ~ (ENUMTYPE a) { return ENUMTYPE(~((int)a)); } \ -inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) ^ ((int)b)); } \ -inline ENUMTYPE &operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \ -} -#else -#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) // NOP, C allows these operators. -#endif - -// Compile-time macros for initializing flag values in const data. -// -// When using DEFINE_ENUM_FLAG_OPERATORS for enum values you should use the macros below -// when you need to initialize global const data. Without these macros the inline operators -// from DEFINE_ENUM_FLAG_OPERATORS force a runtime initialization rather than a -// compile time initialization. This applies even if you have declared the data as const. -#define COMPILETIME_OR_2FLAGS(a,b) ((UINT)(a)|(UINT)(b)) -#define COMPILETIME_OR_3FLAGS(a,b,c) ((UINT)(a)|(UINT)(b)|(UINT)(c)) -#define COMPILETIME_OR_4FLAGS(a,b,c,d) ((UINT)(a)|(UINT)(b)|(UINT)(c)|(UINT)(d)) -#define COMPILETIME_OR_5FLAGS(a,b,c,d,e) ((UINT)(a)|(UINT)(b)|(UINT)(c)|(UINT)(d)|(UINT)(e)) - -// end_winnt - -// -// Define standard min and max macros -// - -#ifndef NOMINMAX - -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - -#endif // NOMINMAX - - -#ifdef _AMD64_ - - -#if defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -// -// Define bit test intrinsics. -// - -#ifdef __cplusplus -extern "C" { -#endif - -#define BitTest _bittest -#define BitTestAndComplement _bittestandcomplement -#define BitTestAndSet _bittestandset -#define BitTestAndReset _bittestandreset -#define InterlockedBitTestAndSet _interlockedbittestandset -#define InterlockedBitTestAndReset _interlockedbittestandreset - -#define BitTest64 _bittest64 -#define BitTestAndComplement64 _bittestandcomplement64 -#define BitTestAndSet64 _bittestandset64 -#define BitTestAndReset64 _bittestandreset64 -#define InterlockedBitTestAndSet64 _interlockedbittestandset64 -#define InterlockedBitTestAndReset64 _interlockedbittestandreset64 - -__checkReturn -BOOLEAN -_bittest ( - __in_bcount((Offset+7)/8) LONG const *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandcomplement ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandreset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_interlockedbittestandset ( - __inout_bcount((Offset+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Offset - ); - -BOOLEAN -_interlockedbittestandreset ( - __inout_bcount((Offset+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Offset - ); - -BOOLEAN -_bittest64 ( - __in_bcount((Offset+7)/8) LONG64 const *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandcomplement64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandset64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandreset64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -BOOLEAN -_interlockedbittestandset64 ( - __inout_bcount((Offset+7)/8) __drv_interlocked LONG64 volatile *Base, - __in LONG64 Offset - ); - -BOOLEAN -_interlockedbittestandreset64 ( - __inout_bcount((Offset+7)/8) __drv_interlocked LONG64 volatile *Base, - __in LONG64 Offset - ); - -#pragma intrinsic(_bittest) -#pragma intrinsic(_bittestandcomplement) -#pragma intrinsic(_bittestandset) -#pragma intrinsic(_bittestandreset) -#pragma intrinsic(_interlockedbittestandset) -#pragma intrinsic(_interlockedbittestandreset) - -#pragma intrinsic(_bittest64) -#pragma intrinsic(_bittestandcomplement64) -#pragma intrinsic(_bittestandset64) -#pragma intrinsic(_bittestandreset64) -#pragma intrinsic(_interlockedbittestandset64) -#pragma intrinsic(_interlockedbittestandreset64) - -// -// Define bit scan intrinsics. -// - -#define BitScanForward _BitScanForward -#define BitScanReverse _BitScanReverse -#define BitScanForward64 _BitScanForward64 -#define BitScanReverse64 _BitScanReverse64 - -__success(return!=0) -BOOLEAN -_BitScanForward ( - __out ULONG *Index, - __in ULONG Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanReverse ( - __out ULONG *Index, - __in ULONG Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanForward64 ( - __out ULONG *Index, - __in ULONG64 Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanReverse64 ( - __out ULONG *Index, - __in ULONG64 Mask - ); - -#pragma intrinsic(_BitScanForward) -#pragma intrinsic(_BitScanReverse) -#pragma intrinsic(_BitScanForward64) -#pragma intrinsic(_BitScanReverse64) - -// -// Interlocked intrinsic functions. -// - -#define InterlockedIncrement16 _InterlockedIncrement16 -#define InterlockedDecrement16 _InterlockedDecrement16 -#define InterlockedCompareExchange16 _InterlockedCompareExchange16 - -#define InterlockedAnd _InterlockedAnd -#define InterlockedAndAcquire _InterlockedAnd -#define InterlockedAndRelease _InterlockedAnd -#define InterlockedOr _InterlockedOr -#define InterlockedOrAcquire _InterlockedOr -#define InterlockedOrRelease _InterlockedOr -#define InterlockedXor _InterlockedXor -#define InterlockedIncrement _InterlockedIncrement -#define InterlockedIncrementAcquire InterlockedIncrement -#define InterlockedIncrementRelease InterlockedIncrement -#define InterlockedDecrement _InterlockedDecrement -#define InterlockedDecrementAcquire InterlockedDecrement -#define InterlockedDecrementRelease InterlockedDecrement -#define InterlockedAdd _InterlockedAdd -#define InterlockedExchange _InterlockedExchange -#define InterlockedExchangeAdd _InterlockedExchangeAdd -#define InterlockedCompareExchange _InterlockedCompareExchange -#define InterlockedCompareExchangeAcquire InterlockedCompareExchange -#define InterlockedCompareExchangeRelease InterlockedCompareExchange - -#define InterlockedAnd64 _InterlockedAnd64 -#define InterlockedAnd64Acquire _InterlockedAnd64 -#define InterlockedAnd64Release _InterlockedAnd64 -#define InterlockedAndAffinity InterlockedAnd64 -#define InterlockedOr64 _InterlockedOr64 -#define InterlockedOr64Acquire _InterlockedOr64 -#define InterlockedOr64Release _InterlockedOr64 -#define InterlockedOrAffinity InterlockedOr64 -#define InterlockedXor64 _InterlockedXor64 -#define InterlockedIncrement64 _InterlockedIncrement64 -#define InterlockedDecrement64 _InterlockedDecrement64 -#define InterlockedAdd64 _InterlockedAdd64 -#define InterlockedExchange64 _InterlockedExchange64 -#define InterlockedExchangeAcquire64 InterlockedExchange64 -#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 -#define InterlockedCompareExchange64 _InterlockedCompareExchange64 -#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 -#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 - -#define InterlockedExchangePointer _InterlockedExchangePointer -#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer - -#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONG64 *)a, b) -#define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONG64 *)a) -#define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONG64 *)a) - -SHORT -InterlockedIncrement16 ( - __inout __drv_interlocked SHORT volatile *Addend - ); - -SHORT -InterlockedDecrement16 ( - __inout __drv_interlocked SHORT volatile *Addend - ); - -SHORT -InterlockedCompareExchange16 ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT ExChange, - __in SHORT Comperand - ); - -LONG -InterlockedAnd ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -InterlockedOr ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -InterlockedXor ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG64 -InterlockedAnd64 ( - __inout __drv_interlocked LONG64 volatile *Destination, - __in LONG64 Value - ); - -LONG64 -InterlockedOr64 ( - __inout __drv_interlocked LONG64 volatile *Destination, - __in LONG64 Value - ); - -LONG64 -InterlockedXor64 ( - __inout __drv_interlocked LONG64 volatile *Destination, - __in LONG64 Value - ); - -LONG -InterlockedIncrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -InterlockedDecrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -InterlockedExchange( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Value - ); - -LONG -InterlockedExchangeAdd( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -#if !defined(_X86AMD64_) - -__forceinline -LONG -InterlockedAdd( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ) - -{ - return InterlockedExchangeAdd(Addend, Value) + Value; -} - -#endif - -LONG -InterlockedCompareExchange ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - -LONG64 -InterlockedIncrement64( - __inout __drv_interlocked LONG64 volatile *Addend - ); - -LONG64 -InterlockedDecrement64( - __inout __drv_interlocked LONG64 volatile *Addend - ); - -LONG64 -InterlockedExchange64( - __inout __drv_interlocked LONG64 volatile *Target, - __in LONG64 Value - ); - -LONG64 -InterlockedExchangeAdd64( - __inout __drv_interlocked LONG64 volatile *Addend, - __in LONG64 Value - ); - -#if !defined(_X86AMD64_) - -__forceinline -LONG64 -InterlockedAdd64( - __inout __drv_interlocked LONG64 volatile *Addend, - __in LONG64 Value - ) - -{ - return InterlockedExchangeAdd64(Addend, Value) + Value; -} - -#endif - -LONG64 -InterlockedCompareExchange64 ( - __inout __drv_interlocked LONG64 volatile *Destination, - __in LONG64 ExChange, - __in LONG64 Comperand - ); - -PVOID -InterlockedCompareExchangePointer ( - __inout __drv_interlocked PVOID volatile *Destination, - __in_opt PVOID Exchange, - __in_opt PVOID Comperand - ); - -PVOID -InterlockedExchangePointer( - __inout __drv_interlocked PVOID volatile *Target, - __in_opt PVOID Value - ); - -#pragma intrinsic(_InterlockedIncrement16) -#pragma intrinsic(_InterlockedDecrement16) -#pragma intrinsic(_InterlockedCompareExchange16) -#pragma intrinsic(_InterlockedAnd) -#pragma intrinsic(_InterlockedOr) -#pragma intrinsic(_InterlockedXor) -#pragma intrinsic(_InterlockedIncrement) -#pragma intrinsic(_InterlockedDecrement) -#pragma intrinsic(_InterlockedExchange) -#pragma intrinsic(_InterlockedExchangeAdd) -#pragma intrinsic(_InterlockedCompareExchange) -#pragma intrinsic(_InterlockedAnd64) -#pragma intrinsic(_InterlockedOr64) -#pragma intrinsic(_InterlockedXor64) -#pragma intrinsic(_InterlockedIncrement64) -#pragma intrinsic(_InterlockedDecrement64) -#pragma intrinsic(_InterlockedExchange64) -#pragma intrinsic(_InterlockedExchangeAdd64) -#pragma intrinsic(_InterlockedCompareExchange64) -#pragma intrinsic(_InterlockedExchangePointer) -#pragma intrinsic(_InterlockedCompareExchangePointer) - -#if _MSC_FULL_VER >= 140041204 - -#define InterlockedAnd8 _InterlockedAnd8 -#define InterlockedOr8 _InterlockedOr8 -#define InterlockedXor8 _InterlockedXor8 -#define InterlockedAnd16 _InterlockedAnd16 -#define InterlockedOr16 _InterlockedOr16 -#define InterlockedXor16 _InterlockedXor16 - -char -InterlockedAnd8 ( - __inout __drv_interlocked char volatile *Destination, - __in char Value - ); - -char -InterlockedOr8 ( - __inout __drv_interlocked char volatile *Destination, - __in char Value - ); - -char -InterlockedXor8 ( - __inout __drv_interlocked char volatile *Destination, - __in char Value - ); - -SHORT -InterlockedAnd16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -InterlockedOr16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -InterlockedXor16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -#pragma intrinsic (_InterlockedAnd8) -#pragma intrinsic (_InterlockedOr8) -#pragma intrinsic (_InterlockedXor8) -#pragma intrinsic (_InterlockedAnd16) -#pragma intrinsic (_InterlockedOr16) -#pragma intrinsic (_InterlockedXor16) - -#endif - -// -// Define function to flush a cache line. -// - -#define CacheLineFlush(Address) _mm_clflush(Address) - -VOID -_mm_clflush ( - __in VOID const *Address - ); - -#pragma intrinsic(_mm_clflush) - -VOID -_ReadWriteBarrier ( - VOID - ); - -#pragma intrinsic(_ReadWriteBarrier) - -// -// Define memory fence intrinsics -// - -#define FastFence __faststorefence -#define LoadFence _mm_lfence -#define MemoryFence _mm_mfence -#define StoreFence _mm_sfence - -VOID -__faststorefence ( - VOID - ); - -VOID -_mm_lfence ( - VOID - ); - -VOID -_mm_mfence ( - VOID - ); - -VOID -_mm_sfence ( - VOID - ); - -VOID -_mm_pause ( - VOID - ); - -VOID -_mm_prefetch ( - __in CHAR CONST *a, - __in int sel - ); - -VOID -_m_prefetchw ( - __in volatile CONST VOID *Source - ); - -// -// Define constants for use with _mm_prefetch. -// - -#define _MM_HINT_T0 1 -#define _MM_HINT_T1 2 -#define _MM_HINT_T2 3 -#define _MM_HINT_NTA 0 - -#pragma intrinsic(__faststorefence) -#pragma intrinsic(_mm_pause) -#pragma intrinsic(_mm_prefetch) -#pragma intrinsic(_mm_lfence) -#pragma intrinsic(_mm_mfence) -#pragma intrinsic(_mm_sfence) -#pragma intrinsic(_m_prefetchw) - -#define YieldProcessor _mm_pause -#define MemoryBarrier __faststorefence -#define PreFetchCacheLine(l, a) _mm_prefetch((CHAR CONST *) a, l) -#define PrefetchForWrite(p) _m_prefetchw(p) -#define ReadForWriteAccess(p) (_m_prefetchw(p), *(p)) - -// -// PreFetchCacheLine level defines. -// - -#define PF_TEMPORAL_LEVEL_1 _MM_HINT_T0 -#define PF_TEMPORAL_LEVEL_2 _MM_HINT_T1 -#define PF_TEMPORAL_LEVEL_3 _MM_HINT_T2 -#define PF_NON_TEMPORAL_LEVEL_ALL _MM_HINT_NTA - -// -// Define get/set MXCSR intrinsics. -// - -#define ReadMxCsr _mm_getcsr -#define WriteMxCsr _mm_setcsr - -unsigned int -_mm_getcsr ( - VOID - ); - -VOID -_mm_setcsr ( - __in unsigned int MxCsr - ); - -#pragma intrinsic(_mm_getcsr) -#pragma intrinsic(_mm_setcsr) - -// -// Assert exception. -// - -VOID -__int2c ( - VOID - ); - -#pragma intrinsic(__int2c) - -__analysis_noreturn -FORCEINLINE -VOID -DbgRaiseAssertionFailure ( - VOID - ) - -{ - __int2c(); -} - -// -// Define function to get the caller's EFLAGs value. -// - -#define GetCallersEflags() __getcallerseflags() - -unsigned __int32 -__getcallerseflags ( - VOID - ); - -#pragma intrinsic(__getcallerseflags) - -// -// Define function to get segment limit. -// - -#define GetSegmentLimit __segmentlimit - -ULONG -__segmentlimit ( - __in ULONG Selector - ); - -#pragma intrinsic(__segmentlimit) - -// -// Define function to read the value of a performance counter. -// - -#define ReadPMC __readpmc - -ULONG64 -__readpmc ( - __in ULONG Counter - ); - -#pragma intrinsic(__readpmc) - -// -// Define function to read the value of the time stamp counter -// - -#define ReadTimeStampCounter() __rdtsc() - -ULONG64 -__rdtsc ( - VOID - ); - -#pragma intrinsic(__rdtsc) - -// -// Define functions to move strings as bytes, words, dwords, and qwords. -// - -VOID -__movsb ( - __out_ecount_full(Count) PUCHAR Destination, - __in_ecount(Count) UCHAR const *Source, - __in SIZE_T Count - ); - -VOID -__movsw ( - __out_ecount_full(Count) PUSHORT Destination, - __in_ecount(Count) USHORT const *Source, - __in SIZE_T Count - ); - -VOID -__movsd ( - __out_ecount_full(Count) PULONG Destination, - __in_ecount(Count) ULONG const *Source, - __in SIZE_T Count - ); - -VOID -__movsq ( - __out_ecount_full(Count) PULONG64 Destination, - __in_ecount(Count) ULONG64 const *Source, - __in SIZE_T Count - ); - -#pragma intrinsic(__movsb) -#pragma intrinsic(__movsw) -#pragma intrinsic(__movsd) -#pragma intrinsic(__movsq) - -// -// Define functions to store strings as bytes, words, dwords, and qwords. -// - -VOID -__stosb ( - __out_ecount_full(Count) PUCHAR Destination, - __in UCHAR Value, - __in SIZE_T Count - ); - -VOID -__stosw ( - __out_ecount_full(Count) PUSHORT Destination, - __in USHORT Value, - __in SIZE_T Count - ); - -VOID -__stosd ( - __out_ecount_full(Count) PULONG Destination, - __in ULONG Value, - __in SIZE_T Count - ); - -VOID -__stosq ( - __out_ecount_full(Count) PULONG64 Destination, - __in ULONG64 Value, - __in SIZE_T Count - ); - -#pragma intrinsic(__stosb) -#pragma intrinsic(__stosw) -#pragma intrinsic(__stosd) -#pragma intrinsic(__stosq) - -// -// Define functions to capture the high 64-bits of a 128-bit multiply. -// - -#define MultiplyHigh __mulh -#define UnsignedMultiplyHigh __umulh - -LONGLONG -MultiplyHigh ( - __in LONG64 Multiplier, - __in LONG64 Multiplicand - ); - -ULONGLONG -UnsignedMultiplyHigh ( - __in ULONG64 Multiplier, - __in ULONG64 Multiplicand - ); - -#pragma intrinsic(__mulh) -#pragma intrinsic(__umulh) - -// -// Define functions to perform 128-bit shifts -// - -#define ShiftLeft128 __shiftleft128 -#define ShiftRight128 __shiftright128 - -ULONG64 -ShiftLeft128 ( - __in ULONG64 LowPart, - __in ULONG64 HighPart, - __in UCHAR Shift - ); - -ULONG64 -ShiftRight128 ( - __in ULONG64 LowPart, - __in ULONG64 HighPart, - __in UCHAR Shift - ); - -#pragma intrinsic(__shiftleft128) -#pragma intrinsic(__shiftright128) - -// -// Define functions to perform 128-bit multiplies. -// - -#define Multiply128 _mul128 - -LONG64 -Multiply128 ( - __in LONG64 Multiplier, - __in LONG64 Multiplicand, - __out LONG64 *HighProduct - ); - -#pragma intrinsic(_mul128) - -#ifndef UnsignedMultiply128 - -#define UnsignedMultiply128 _umul128 - -ULONG64 -UnsignedMultiply128 ( - __in ULONG64 Multiplier, - __in ULONG64 Multiplicand, - __out ULONG64 *HighProduct - ); - -#pragma intrinsic(_umul128) - -#endif - -__forceinline -LONG64 -MultiplyExtract128 ( - __in LONG64 Multiplier, - __in LONG64 Multiplicand, - __in UCHAR Shift - ) - -{ - - LONG64 extractedProduct; - LONG64 highProduct; - LONG64 lowProduct; - BOOLEAN negate; - ULONG64 uhighProduct; - ULONG64 ulowProduct; - - lowProduct = Multiply128(Multiplier, Multiplicand, &highProduct); - negate = FALSE; - uhighProduct = (ULONG64)highProduct; - ulowProduct = (ULONG64)lowProduct; - if (highProduct < 0) { - negate = TRUE; - uhighProduct = (ULONG64)(-highProduct); - ulowProduct = (ULONG64)(-lowProduct); - if (ulowProduct != 0) { - uhighProduct -= 1; - } - } - - extractedProduct = (LONG64)ShiftRight128(ulowProduct, uhighProduct, Shift); - if (negate != FALSE) { - extractedProduct = -extractedProduct; - } - - return extractedProduct; -} - -__forceinline -ULONG64 -UnsignedMultiplyExtract128 ( - __in ULONG64 Multiplier, - __in ULONG64 Multiplicand, - __in UCHAR Shift - ) - -{ - - ULONG64 extractedProduct; - ULONG64 highProduct; - ULONG64 lowProduct; - - lowProduct = UnsignedMultiply128(Multiplier, Multiplicand, &highProduct); - extractedProduct = ShiftRight128(lowProduct, highProduct, Shift); - return extractedProduct; -} - -// -// Define functions to read and write the uer TEB and the system PCR/PRCB. -// - -UCHAR -__readgsbyte ( - __in ULONG Offset - ); - -USHORT -__readgsword ( - __in ULONG Offset - ); - -ULONG -__readgsdword ( - __in ULONG Offset - ); - -ULONG64 -__readgsqword ( - __in ULONG Offset - ); - -VOID -__writegsbyte ( - __in ULONG Offset, - __in UCHAR Data - ); - -VOID -__writegsword ( - __in ULONG Offset, - __in USHORT Data - ); - -VOID -__writegsdword ( - __in ULONG Offset, - __in ULONG Data - ); - -VOID -__writegsqword ( - __in ULONG Offset, - __in ULONG64 Data - ); - -#pragma intrinsic(__readgsbyte) -#pragma intrinsic(__readgsword) -#pragma intrinsic(__readgsdword) -#pragma intrinsic(__readgsqword) -#pragma intrinsic(__writegsbyte) -#pragma intrinsic(__writegsword) -#pragma intrinsic(__writegsdword) -#pragma intrinsic(__writegsqword) - -#if !defined(_MANAGED) - -VOID -__incgsbyte ( - __in ULONG Offset - ); - -VOID -__addgsbyte ( - __in ULONG Offset, - __in UCHAR Value - ); - -VOID -__incgsword ( - __in ULONG Offset - ); - -VOID -__addgsword ( - __in ULONG Offset, - __in USHORT Value - ); - -VOID -__incgsdword ( - __in ULONG Offset - ); - -VOID -__addgsdword ( - __in ULONG Offset, - __in ULONG Value - ); - -VOID -__incgsqword ( - __in ULONG Offset - ); - -VOID -__addgsqword ( - __in ULONG Offset, - __in ULONG64 Value - ); - -#if 0 -#pragma intrinsic(__incgsbyte) -#pragma intrinsic(__addgsbyte) -#pragma intrinsic(__incgsword) -#pragma intrinsic(__addgsword) -#pragma intrinsic(__incgsdword) -#pragma intrinsic(__addgsdword) -#pragma intrinsic(__incgsqword) -#pragma intrinsic(__addgsqword) -#endif - -#endif - -#ifdef __cplusplus -} -#endif - -#endif // defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - - -#endif // _AMD64_ - - -#ifdef _X86_ - -// -// Disable these two pragmas that evaluate to "sti" "cli" on x86 so that driver -// writers to not leave them inadvertantly in their code. -// - -#if !defined(MIDL_PASS) -#if !defined(RC_INVOKED) - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4164) // disable C4164 warning so that apps that - // build with /Od don't get weird errors ! -#ifdef _M_IX86 -#pragma function(_enable) -#pragma function(_disable) -#endif - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4164) // reenable C4164 warning -#endif - -#endif -#endif - -// end_ntddk end_nthal -#if defined(_M_IX86) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -#ifdef __cplusplus -extern "C" { -#endif - - - -#if (_MSC_FULL_VER >= 14000101) - - -// -// Define bit test intrinsics. -// - -#define BitTest _bittest -#define BitTestAndComplement _bittestandcomplement -#define BitTestAndSet _bittestandset -#define BitTestAndReset _bittestandreset -#define InterlockedBitTestAndSet _interlockedbittestandset -#define InterlockedBitTestAndReset _interlockedbittestandreset - -__checkReturn -BOOLEAN -_bittest ( - __in_bcount((Offset+7)/8) LONG const *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandcomplement ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandreset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_interlockedbittestandset ( - __inout_bcount((Offset+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Offset - ); - -BOOLEAN -_interlockedbittestandreset ( - __inout_bcount((Offset+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Offset - ); - -#pragma intrinsic(_bittest) -#pragma intrinsic(_bittestandcomplement) -#pragma intrinsic(_bittestandset) -#pragma intrinsic(_bittestandreset) -#pragma intrinsic(_interlockedbittestandset) -#pragma intrinsic(_interlockedbittestandreset) - -// -// Define bit scan intrinsics. -// - -#define BitScanForward _BitScanForward -#define BitScanReverse _BitScanReverse - -__success(return != 0) -BOOLEAN -_BitScanForward ( - __out ULONG *Index, - __in ULONG Mask - ); - -__success(return != 0) -BOOLEAN -_BitScanReverse ( - __out ULONG *Index, - __in ULONG Mask - ); - -#pragma intrinsic(_BitScanForward) -#pragma intrinsic(_BitScanReverse) - -#else - -#pragma warning(push) -#pragma warning(disable:4035 4793) - -FORCEINLINE -BOOLEAN -InterlockedBitTestAndSet ( - __inout_bcount((Bit+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - __asm { - mov eax, Bit - mov ecx, Base - lock bts [ecx], eax - setc al - }; -} - -FORCEINLINE -BOOLEAN -InterlockedBitTestAndReset ( - __inout_bcount((Bit+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - __asm { - mov eax, Bit - mov ecx, Base - lock btr [ecx], eax - setc al - }; -} -#pragma warning(pop) - -#endif /* _MSC_FULL_VER >= 14000101 */ - -// -// [pfx_parse] - guard against PREfix intrinsic error -// -#if (_MSC_FULL_VER >= 140040816) || (defined(_PREFAST_) && (_MSC_VER >= 1400)) - -#define InterlockedAnd16 _InterlockedAnd16 -#define InterlockedCompareExchange16 _InterlockedCompareExchange16 -#define InterlockedOr16 _InterlockedOr16 - -SHORT -_InterlockedAnd16 ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -_InterlockedCompareExchange16 ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT ExChange, - __in SHORT Comperand - ); - -SHORT -_InterlockedOr16 ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -#pragma intrinsic(_InterlockedAnd16) -#pragma intrinsic(_InterlockedCompareExchange16) -#pragma intrinsic(_InterlockedOr16) - -#endif /* _MSC_FULL_VER >= 140040816 */ - -#if !defined(_M_CEE_PURE) -#pragma warning(push) -#pragma warning(disable:4035 4793) - -FORCEINLINE -BOOLEAN -InterlockedBitTestAndComplement ( - __inout_bcount((Bit+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - __asm { - mov eax, Bit - mov ecx, Base - lock btc [ecx], eax - setc al - }; -} -#pragma warning(pop) -#endif /* _M_CEE_PURE */ - -// -// [pfx_parse] -// guard against __readfsbyte parsing error -// -#if (_MSC_FULL_VER >= 13012035) || defined(_PREFIX_) || defined(_PREFAST_) - -// -// Define FS referencing intrinsics -// - -UCHAR -__readfsbyte ( - __in ULONG Offset - ); - -USHORT -__readfsword ( - __in ULONG Offset - ); - -ULONG -__readfsdword ( - __in ULONG Offset - ); - -VOID -__writefsbyte ( - __in ULONG Offset, - __in UCHAR Data - ); - -VOID -__writefsword ( - __in ULONG Offset, - __in USHORT Data - ); - -VOID -__writefsdword ( - __in ULONG Offset, - __in ULONG Data - ); - -#pragma intrinsic(__readfsbyte) -#pragma intrinsic(__readfsword) -#pragma intrinsic(__readfsdword) -#pragma intrinsic(__writefsbyte) -#pragma intrinsic(__writefsword) -#pragma intrinsic(__writefsdword) - -#endif /* _MSC_FULL_VER >= 13012035 */ - -#if (_MSC_FULL_VER >= 140050727) || defined(_PREFIX_) || defined(_PREFAST_) - -#if !defined(_MANAGED) - -VOID -__incfsbyte ( - __in ULONG Offset - ); - -VOID -__addfsbyte ( - __in ULONG Offset, - __in UCHAR Value - ); - -VOID -__incfsword ( - __in ULONG Offset - ); - -VOID -__addfsword ( - __in ULONG Offset, - __in USHORT Value - ); - -VOID -__incfsdword ( - __in ULONG Offset - ); - -VOID -__addfsdword ( - __in ULONG Offset, - __in ULONG Value - ); - -#pragma intrinsic(__incfsbyte) -#pragma intrinsic(__addfsbyte) -#pragma intrinsic(__incfsword) -#pragma intrinsic(__addfsword) -#pragma intrinsic(__incfsdword) -#pragma intrinsic(__addfsdword) - -#endif - -#endif /* _MSC_FULL_VER >= 140050727 */ - -#if (_MSC_FULL_VER >= 140041204) || defined(_PREFIX_) || defined(_PREFAST_) - -VOID -_mm_pause ( - VOID - ); - -#pragma intrinsic(_mm_pause) - -#define YieldProcessor _mm_pause - -#else - -#if !defined(_M_CEE_PURE) -#define YieldProcessor() __asm { rep nop } -#endif // !defined(_M_CEE_PURE) - -#endif // (_MSC_FULL_VER >= 140041204) - -#ifdef __cplusplus -} -#endif - -#endif /* !defined(MIDL_PASS) || defined(_M_IX86) */ - -#endif //_X86_ - - -#if defined(_M_IA64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Define bit test intrinsics. -// - -#define BitTest _bittest -#define BitTestAndComplement _bittestandcomplement -#define BitTestAndSet _bittestandset -#define BitTestAndReset _bittestandreset - -#define BitTest64 _bittest64 -#define BitTestAndComplement64 _bittestandcomplement64 -#define BitTestAndSet64 _bittestandset64 -#define BitTestAndReset64 _bittestandreset64 - -__checkReturn -BOOLEAN -_bittest ( - __in_bcount((Offset+7)/8) LONG const *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandcomplement ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandreset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -__checkReturn -BOOLEAN -_bittest64 ( - __in_bcount((Offset+7)/8) LONG64 const *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandcomplement64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandset64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandreset64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -#pragma intrinsic(_bittest) -#pragma intrinsic(_bittestandcomplement) -#pragma intrinsic(_bittestandset) -#pragma intrinsic(_bittestandreset) - -#pragma intrinsic(_bittest64) -#pragma intrinsic(_bittestandcomplement64) -#pragma intrinsic(_bittestandset64) -#pragma intrinsic(_bittestandreset64) - -// -// Define bit scan intrinsics. -// - -#define BitScanForward _BitScanForward -#define BitScanReverse _BitScanReverse -#define BitScanForward64 _BitScanForward64 -#define BitScanReverse64 _BitScanReverse64 - -__success(return!=0) -BOOLEAN -_BitScanForward ( - __out ULONG *Index, - __in ULONG Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanReverse ( - __out ULONG *Index, - __in ULONG Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanForward64 ( - __out ULONG *Index, - __in ULONG64 Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanReverse64 ( - __out ULONG *Index, - __in ULONG64 Mask - ); - -#pragma intrinsic(_BitScanForward) -#pragma intrinsic(_BitScanReverse) -#pragma intrinsic(_BitScanForward64) -#pragma intrinsic(_BitScanReverse64) - -#define InterlockedCompareExchange16 _InterlockedCompareExchange16 - -SHORT -_InterlockedCompareExchange16 ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT ExChange, - __in SHORT Comperand - ); - -#pragma intrinsic(_InterlockedCompareExchange16) - -#ifdef __cplusplus -} -#endif - -#define InterlockedAdd _InterlockedAdd -#define InterlockedAddAcquire _InterlockedAdd_acq -#define InterlockedAddRelease _InterlockedAdd_rel - -#define InterlockedIncrement _InterlockedIncrement -#define InterlockedIncrementAcquire _InterlockedIncrement_acq -#define InterlockedIncrementRelease _InterlockedIncrement_rel - -#define InterlockedDecrement _InterlockedDecrement -#define InterlockedDecrementAcquire _InterlockedDecrement_acq -#define InterlockedDecrementRelease _InterlockedDecrement_rel - -#define InterlockedExchange _InterlockedExchange -#define InterlockedExchangeAcquire _InterlockedExchange_acq - -#define InterlockedExchangeAdd _InterlockedExchangeAdd -#define InterlockedExchangeAddAcquire _InterlockedExchangeAdd_acq -#define InterlockedExchangeAddRelease _InterlockedExchangeAdd_rel - -#define InterlockedAdd64 _InterlockedAdd64 -#define InterlockedAddAcquire64 _InterlockedAdd64_acq -#define InterlockedAddRelease64 _InterlockedAdd64_rel - -#define InterlockedIncrement64 _InterlockedIncrement64 -#define InterlockedIncrementAcquire64 _InterlockedIncrement64_acq -#define InterlockedIncrementRelease64 _InterlockedIncrement64_rel - -#define InterlockedDecrement64 _InterlockedDecrement64 -#define InterlockedDecrementAcquire64 _InterlockedDecrement64_acq -#define InterlockedDecrementRelease64 _InterlockedDecrement64_rel - -#define InterlockedExchange64 _InterlockedExchange64 -#define InterlockedExchangeAcquire64 _InterlockedExchange64_acq - -#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 -#define InterlockedExchangeAddAcquire64 _InterlockedExchangeAdd64_acq -#define InterlockedExchangeAddRelease64 _InterlockedExchangeAdd64_rel - -#define InterlockedCompareExchange64 _InterlockedCompareExchange64 -#define InterlockedCompareExchangeAcquire64 _InterlockedCompareExchange64_acq -#define InterlockedCompareExchangeRelease64 _InterlockedCompareExchange64_rel - -#define InterlockedCompare64Exchange128 _InterlockedCompare64Exchange128 -#define InterlockedCompare64ExchangeAcquire128 _InterlockedCompare64Exchange128_acq -#define InterlockedCompare64ExchangeRelease128 _InterlockedCompare64Exchange128_rel - -#define InterlockedCompareExchange _InterlockedCompareExchange -#define InterlockedCompareExchangeAcquire _InterlockedCompareExchange_acq -#define InterlockedCompareExchangeRelease _InterlockedCompareExchange_rel - -#define InterlockedExchangePointer _InterlockedExchangePointer -#define InterlockedExchangePointerAcquire _InterlockedExchangePointer_acq - -#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer_rel -#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer_acq - - -#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONG64 *)a, b) -#define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONG64 *)a) -#define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONG64 *)a) - -#define InterlockedOr _InterlockedOr -#define InterlockedOrAcquire _InterlockedOr_acq -#define InterlockedOrRelease _InterlockedOr_rel -#define InterlockedOr8 _InterlockedOr8 -#define InterlockedOr8Acquire _InterlockedOr8_acq -#define InterlockedOr8Release _InterlockedOr8_rel -#define InterlockedOr16 _InterlockedOr16 -#define InterlockedOr16Acquire _InterlockedOr16_acq -#define InterlockedOr16Release _InterlockedOr16_rel -#define InterlockedOr64 _InterlockedOr64 -#define InterlockedOr64Acquire _InterlockedOr64_acq -#define InterlockedOr64Release _InterlockedOr64_rel -#define InterlockedXor _InterlockedXor -#define InterlockedXorAcquire _InterlockedXor_acq -#define InterlockedXorRelease _InterlockedXor_rel -#define InterlockedXor8 _InterlockedXor8 -#define InterlockedXor8Acquire _InterlockedXor8_acq -#define InterlockedXor8Release _InterlockedXor8_rel -#define InterlockedXor16 _InterlockedXor16 -#define InterlockedXor16Acquire _InterlockedXor16_acq -#define InterlockedXor16Release _InterlockedXor16_rel -#define InterlockedXor64 _InterlockedXor64 -#define InterlockedXor64Acquire _InterlockedXor64_acq -#define InterlockedXor64Release _InterlockedXor64_rel -#define InterlockedAnd _InterlockedAnd -#define InterlockedAndAcquire _InterlockedAnd_acq -#define InterlockedAndRelease _InterlockedAnd_rel -#define InterlockedAnd8 _InterlockedAnd8 -#define InterlockedAnd8Acquire _InterlockedAnd8_acq -#define InterlockedAnd8Release _InterlockedAnd8_rel -#define InterlockedAnd16 _InterlockedAnd16 -#define InterlockedAnd16Acquire _InterlockedAnd16_acq -#define InterlockedAnd16Release _InterlockedAnd16_rel -#define InterlockedAnd64 _InterlockedAnd64 -#define InterlockedAnd64Acquire _InterlockedAnd64_acq -#define InterlockedAnd64Release _InterlockedAnd64_rel - -#ifdef __cplusplus -extern "C" { -#endif - -LONG -__cdecl -InterlockedAdd ( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedAddAcquire ( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedAddRelease ( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONGLONG -__cdecl -InterlockedAdd64 ( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedAddAcquire64 ( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - - -LONGLONG -__cdecl -InterlockedAddRelease64 ( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONG -__cdecl -InterlockedIncrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedDecrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedIncrementAcquire( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedDecrementAcquire( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedIncrementRelease( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedDecrementRelease( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedExchange( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Value - ); - -LONG -__cdecl -InterlockedExchangeAcquire( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Value - ); - -LONG -__cdecl -InterlockedExchangeAdd( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedExchangeAddAcquire( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedExchangeAddRelease( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedCompareExchange ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - - -LONG -__cdecl -InterlockedCompareExchangeRelease ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - - -LONG -__cdecl -InterlockedCompareExchangeAcquire ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - - -LONGLONG -__cdecl -InterlockedIncrement64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedIncrementAcquire64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedIncrementRelease64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedDecrement64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedDecrementAcquire64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedDecrementRelease64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedExchange64( - __inout __drv_interlocked LONGLONG volatile *Target, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedExchangeAcquire64( - __inout __drv_interlocked LONGLONG volatile *Target, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedExchangeAdd64( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedExchangeAddAcquire64( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedExchangeAddRelease64( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedCompareExchange64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG ExChange, - __in LONGLONG Comperand - ); - -LONGLONG -__cdecl -InterlockedCompareExchangeAcquire64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG ExChange, - __in LONGLONG Comperand - ); - -LONGLONG -__cdecl -InterlockedCompareExchangeRelease64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG ExChange, - __in LONGLONG Comperand - ); - -LONG64 -__cdecl -InterlockedCompare64Exchange128( - __inout_bcount(16) __drv_interlocked LONG64 volatile *Destination, - __in LONG64 ExchangeHigh, - __in LONG64 ExchangeLow, - __in LONG64 Comperand - ); - -LONG64 -__cdecl -InterlockedCompare64ExchangeAcquire128( - __inout_bcount(16) __drv_interlocked LONG64 volatile *Destination, - __in LONG64 ExchangeHigh, - __in LONG64 ExchangeLow, - __in LONG64 Comperand - ); - -LONG64 -__cdecl -InterlockedCompare64ExchangeRelease128( - __inout_bcount(16) __drv_interlocked LONG64 volatile *Destination, - __in LONG64 ExchangeHigh, - __in LONG64 ExchangeLow, - __in LONG64 Comperand - ); - -PVOID -__cdecl -InterlockedCompareExchangePointer ( - __inout __drv_interlocked PVOID volatile *Destination, - __in PVOID Exchange, - __in PVOID Comperand - ); - -PVOID -__cdecl -InterlockedCompareExchangePointerAcquire ( - __inout __drv_interlocked PVOID volatile *Destination, - __in PVOID Exchange, - __in PVOID Comperand - ); - -PVOID -__cdecl -InterlockedCompareExchangePointerRelease ( - __inout __drv_interlocked PVOID volatile *Destination, - __in PVOID Exchange, - __in PVOID Comperand - ); - -PVOID -__cdecl -InterlockedExchangePointer( - __inout __drv_interlocked PVOID volatile *Target, - __in PVOID Value - ); - -PVOID -__cdecl -InterlockedExchangePointerAcquire( - __inout __drv_interlocked PVOID volatile *Target, - __in PVOID Value - ); - -LONG -__cdecl -InterlockedOr ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedOrAcquire ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedOrRelease ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -CHAR -__cdecl -InterlockedOr8 ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedOr8Acquire ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedOr8Release ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -SHORT -__cdecl -InterlockedOr16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedOr16Acquire ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedOr16Release ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -LONGLONG -__cdecl -InterlockedOr64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedOr64Acquire ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedOr64Release ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONG -__cdecl -InterlockedXor ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedXorAcquire ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedXorRelease ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -CHAR -__cdecl -InterlockedXor8 ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedXor8Acquire ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedXor8Release ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -SHORT -__cdecl -InterlockedXor16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedXor16Acquire ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedXor16Release ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -LONGLONG -__cdecl -InterlockedXor64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedXor64Acquire ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedXor64Release ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONG -__cdecl -InterlockedAnd ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedAndAcquire ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedAndRelease ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -CHAR -__cdecl -InterlockedAnd8 ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedAnd8Acquire ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedAnd8Release ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -SHORT -__cdecl -InterlockedAnd16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedAnd16Acquire ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedAnd16Release ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -LONGLONG -__cdecl -InterlockedAnd64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedAnd64Acquire ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedAnd64Release ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -#pragma intrinsic(_InterlockedAdd) -#pragma intrinsic(_InterlockedIncrement) -#pragma intrinsic(_InterlockedIncrement_acq) -#pragma intrinsic(_InterlockedIncrement_rel) -#pragma intrinsic(_InterlockedDecrement) -#pragma intrinsic(_InterlockedDecrement_acq) -#pragma intrinsic(_InterlockedDecrement_rel) -#pragma intrinsic(_InterlockedExchange) -#pragma intrinsic(_InterlockedCompareExchange) -#pragma intrinsic(_InterlockedCompareExchange_acq) -#pragma intrinsic(_InterlockedCompareExchange_rel) -#pragma intrinsic(_InterlockedExchangeAdd) -#pragma intrinsic(_InterlockedAdd64) -#pragma intrinsic(_InterlockedIncrement64) -#pragma intrinsic(_InterlockedDecrement64) -#pragma intrinsic(_InterlockedExchange64) -#pragma intrinsic(_InterlockedExchange64_acq) -#pragma intrinsic(_InterlockedCompareExchange64) -#pragma intrinsic(_InterlockedCompareExchange64_acq) -#pragma intrinsic(_InterlockedCompareExchange64_rel) -#pragma intrinsic(_InterlockedCompare64Exchange128) -#pragma intrinsic(_InterlockedCompare64Exchange128_acq) -#pragma intrinsic(_InterlockedCompare64Exchange128_rel) -#pragma intrinsic(_InterlockedExchangeAdd64) -#pragma intrinsic(_InterlockedExchangePointer) -#pragma intrinsic(_InterlockedCompareExchangePointer) -#pragma intrinsic(_InterlockedCompareExchangePointer_acq) -#pragma intrinsic(_InterlockedCompareExchangePointer_rel) -#pragma intrinsic(_InterlockedAdd_acq) -#pragma intrinsic(_InterlockedAdd_rel) -#pragma intrinsic(_InterlockedExchange_acq) -#pragma intrinsic(_InterlockedExchangeAdd_acq) -#pragma intrinsic(_InterlockedExchangeAdd_rel) -#pragma intrinsic(_InterlockedAdd64_acq) -#pragma intrinsic(_InterlockedAdd64_rel) -#pragma intrinsic(_InterlockedIncrement64_acq) -#pragma intrinsic(_InterlockedIncrement64_rel) -#pragma intrinsic(_InterlockedDecrement64_acq) -#pragma intrinsic(_InterlockedDecrement64_rel) -#pragma intrinsic(_InterlockedExchangeAdd64_acq) -#pragma intrinsic(_InterlockedExchangeAdd64_rel) -#pragma intrinsic(_InterlockedExchangePointer_acq) -#pragma intrinsic (_InterlockedOr) -#pragma intrinsic (_InterlockedOr_acq) -#pragma intrinsic (_InterlockedOr_rel) -#pragma intrinsic (_InterlockedOr8) -#pragma intrinsic (_InterlockedOr8_acq) -#pragma intrinsic (_InterlockedOr8_rel) -#pragma intrinsic (_InterlockedOr16) -#pragma intrinsic (_InterlockedOr16_acq) -#pragma intrinsic (_InterlockedOr16_rel) -#pragma intrinsic (_InterlockedOr64) -#pragma intrinsic (_InterlockedOr64_acq) -#pragma intrinsic (_InterlockedOr64_rel) -#pragma intrinsic (_InterlockedXor) -#pragma intrinsic (_InterlockedXor_acq) -#pragma intrinsic (_InterlockedXor_rel) -#pragma intrinsic (_InterlockedXor8) -#pragma intrinsic (_InterlockedXor8_acq) -#pragma intrinsic (_InterlockedXor8_rel) -#pragma intrinsic (_InterlockedXor16) -#pragma intrinsic (_InterlockedXor16_acq) -#pragma intrinsic (_InterlockedXor16_rel) -#pragma intrinsic (_InterlockedXor64) -#pragma intrinsic (_InterlockedXor64_acq) -#pragma intrinsic (_InterlockedXor64_rel) -#pragma intrinsic (_InterlockedAnd) -#pragma intrinsic (_InterlockedAnd_acq) -#pragma intrinsic (_InterlockedAnd_rel) -#pragma intrinsic (_InterlockedAnd8) -#pragma intrinsic (_InterlockedAnd8_acq) -#pragma intrinsic (_InterlockedAnd8_rel) -#pragma intrinsic (_InterlockedAnd16) -#pragma intrinsic (_InterlockedAnd16_acq) -#pragma intrinsic (_InterlockedAnd16_rel) -#pragma intrinsic (_InterlockedAnd64) -#pragma intrinsic (_InterlockedAnd64_acq) -#pragma intrinsic (_InterlockedAnd64_rel) - -#if !defined (InterlockedAnd64) - -#define InterlockedAnd64 InterlockedAnd64_Inline - -LONGLONG -FORCEINLINE -InterlockedAnd64_Inline ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Destination; - } while (InterlockedCompareExchange64(Destination, - Old & Value, - Old) != Old); - - return Old; -} - -#endif - -#define InterlockedAndAffinity InterlockedAnd64 - -#if !defined (InterlockedOr64) - -#define InterlockedOr64 InterlockedOr64_Inline - -LONGLONG -FORCEINLINE -InterlockedOr64_Inline ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Destination; - } while (InterlockedCompareExchange64(Destination, - Old | Value, - Old) != Old); - - return Old; -} - -#endif - -#define InterlockedOrAffinity InterlockedOr64 - -#if !defined (InterlockedXor64) - -#define InterlockedXor64 InterlockedXor64_Inline - -LONGLONG -FORCEINLINE -InterlockedXor64_Inline ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Destination; - } while (InterlockedCompareExchange64(Destination, - Old ^ Value, - Old) != Old); - - return Old; -} - -#endif - -#if !defined (InterlockedBitTestAndSet) - -#define InterlockedBitTestAndSet InterlockedBitTestAndSet_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndSet_Inline ( - __inout __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - LONG tBit; - - tBit = 1<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedOr (&Base[Bit/(sizeof (*Base)*8)], tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndReset) - -#define InterlockedBitTestAndReset InterlockedBitTestAndReset_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndReset_Inline ( - __inout __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - LONG tBit; - - tBit = 1<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedAnd (&Base[Bit/(sizeof (*Base)*8)], ~tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndSet64) - -#define InterlockedBitTestAndSet64 InterlockedBitTestAndSet64_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndSet64_Inline ( - __inout __drv_interlocked LONG64 volatile *Base, - __in LONG64 Bit - ) -{ - LONG64 tBit; - - tBit = 1i64<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedOr64 (&Base[Bit/(sizeof (*Base)*8)], tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndReset64) - -#define InterlockedBitTestAndReset64 InterlockedBitTestAndReset64_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndReset64_Inline ( - __inout __drv_interlocked LONG64 volatile *Base, - __in LONG64 Bit - ) -{ - LONG64 tBit; - - tBit = 1i64<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedAnd64 (&Base[Bit/(sizeof (*Base)*8)], ~tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndComplement) - -#define InterlockedBitTestAndComplement InterlockedBitTestAndComplement_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndComplement_Inline ( - __inout __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - LONG tBit; - - tBit = 1<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedXor (&Base[Bit/(sizeof (*Base)*8)], tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndComplement64) - -#define InterlockedBitTestAndComplement64 InterlockedBitTestAndComplement64_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndComplement64_Inline ( - __inout __drv_interlocked LONG64 volatile *Base, - __in LONG64 Bit - ) -{ - LONG64 tBit; - - tBit = 1i64<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedXor64 (&Base[Bit/(sizeof (*Base)*8)], tBit)&tBit) != 0); -} - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* defined(_M_IA64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) */ - - -typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP { - RelationProcessorCore, - RelationNumaNode, - RelationCache, - RelationProcessorPackage, - RelationGroup, - RelationAll = 0xffff -} LOGICAL_PROCESSOR_RELATIONSHIP; - -#define LTP_PC_SMT 0x1 - -typedef enum _PROCESSOR_CACHE_TYPE { - CacheUnified, - CacheInstruction, - CacheData, - CacheTrace -} PROCESSOR_CACHE_TYPE; - -#define CACHE_FULLY_ASSOCIATIVE 0xFF - -typedef struct _CACHE_DESCRIPTOR { - UCHAR Level; - UCHAR Associativity; - USHORT LineSize; - ULONG Size; - PROCESSOR_CACHE_TYPE Type; -} CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR; - -typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION { - ULONG_PTR ProcessorMask; - LOGICAL_PROCESSOR_RELATIONSHIP Relationship; - union { - struct { - UCHAR Flags; - } ProcessorCore; - struct { - ULONG NodeNumber; - } NumaNode; - CACHE_DESCRIPTOR Cache; - ULONGLONG Reserved[2]; - } DUMMYUNIONNAME; -} SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION; - -typedef struct _PROCESSOR_RELATIONSHIP { - UCHAR Flags; - UCHAR Reserved[21]; - USHORT GroupCount; - __field_ecount(GroupCount) GROUP_AFFINITY GroupMask[ANYSIZE_ARRAY]; -} PROCESSOR_RELATIONSHIP, *PPROCESSOR_RELATIONSHIP; - -typedef struct _NUMA_NODE_RELATIONSHIP { - ULONG NodeNumber; - UCHAR Reserved[20]; - GROUP_AFFINITY GroupMask; -} NUMA_NODE_RELATIONSHIP, *PNUMA_NODE_RELATIONSHIP; - -typedef struct _CACHE_RELATIONSHIP { - UCHAR Level; - UCHAR Associativity; - USHORT LineSize; - ULONG CacheSize; - PROCESSOR_CACHE_TYPE Type; - UCHAR Reserved[20]; - GROUP_AFFINITY GroupMask; -} CACHE_RELATIONSHIP, *PCACHE_RELATIONSHIP; - -typedef struct _PROCESSOR_GROUP_INFO { - UCHAR MaximumProcessorCount; - UCHAR ActiveProcessorCount; - UCHAR Reserved[38]; - KAFFINITY ActiveProcessorMask; -} PROCESSOR_GROUP_INFO, *PPROCESSOR_GROUP_INFO; - -typedef struct _GROUP_RELATIONSHIP { - USHORT MaximumGroupCount; - USHORT ActiveGroupCount; - UCHAR Reserved[20]; - PROCESSOR_GROUP_INFO GroupInfo[ANYSIZE_ARRAY]; -} GROUP_RELATIONSHIP, *PGROUP_RELATIONSHIP; - -__struct_bcount(Size) struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX { - LOGICAL_PROCESSOR_RELATIONSHIP Relationship; - ULONG Size; - union { - PROCESSOR_RELATIONSHIP Processor; - NUMA_NODE_RELATIONSHIP NumaNode; - CACHE_RELATIONSHIP Cache; - GROUP_RELATIONSHIP Group; - } DUMMYUNIONNAME; -}; - -typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX; - -// -// Define the I/O bus interface types. -// - -typedef enum _INTERFACE_TYPE { - InterfaceTypeUndefined = -1, - Internal, - Isa, - Eisa, - MicroChannel, - TurboChannel, - PCIBus, - VMEBus, - NuBus, - PCMCIABus, - CBus, - MPIBus, - MPSABus, - ProcessorInternal, - InternalPowerBus, - PNPISABus, - PNPBus, - Vmcs, - MaximumInterfaceType -}INTERFACE_TYPE, *PINTERFACE_TYPE; - -// -// Define the DMA transfer widths. -// - -typedef enum _DMA_WIDTH { - Width8Bits, - Width16Bits, - Width32Bits, - MaximumDmaWidth -}DMA_WIDTH, *PDMA_WIDTH; - -// -// Define DMA transfer speeds. -// - -typedef enum _DMA_SPEED { - Compatible, - TypeA, - TypeB, - TypeC, - TypeF, - MaximumDmaSpeed -}DMA_SPEED, *PDMA_SPEED; - -// -// Define Interface reference/dereference routines for -// Interfaces exported by IRP_MN_QUERY_INTERFACE -// - -typedef VOID (*PINTERFACE_REFERENCE)(PVOID Context); -typedef VOID (*PINTERFACE_DEREFERENCE)(PVOID Context); - -// end_wdm -// begin_ntddk - -// -// Define types of bus information. -// - -typedef enum _BUS_DATA_TYPE { - ConfigurationSpaceUndefined = -1, - Cmos, - EisaConfiguration, - Pos, - CbusConfiguration, - PCIConfiguration, - VMEConfiguration, - NuBusConfiguration, - PCMCIAConfiguration, - MPIConfiguration, - MPSAConfiguration, - PNPISAConfiguration, - SgiInternalConfiguration, - MaximumBusDataType -} BUS_DATA_TYPE, *PBUS_DATA_TYPE; - - -#include - - -#if defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -// -// Define intrinsic function to do in's and out's. -// - -#ifdef __cplusplus -extern "C" { -#endif - -UCHAR -__inbyte ( - __in USHORT Port - ); - -USHORT -__inword ( - __in USHORT Port - ); - -ULONG -__indword ( - __in USHORT Port - ); - -VOID -__outbyte ( - __in USHORT Port, - __in UCHAR Data - ); - -VOID -__outword ( - __in USHORT Port, - __in USHORT Data - ); - -VOID -__outdword ( - __in USHORT Port, - __in ULONG Data - ); - -VOID -__inbytestring ( - __in USHORT Port, - __out_ecount_full(Count) PUCHAR Buffer, - __in ULONG Count - ); - -VOID -__inwordstring ( - __in USHORT Port, - __out_ecount_full(Count) PUSHORT Buffer, - __in ULONG Count - ); - -VOID -__indwordstring ( - __in USHORT Port, - __out_ecount_full(Count) PULONG Buffer, - __in ULONG Count - ); - -VOID -__outbytestring ( - __in USHORT Port, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ); - -VOID -__outwordstring ( - __in USHORT Port, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ); - -VOID -__outdwordstring ( - __in USHORT Port, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ); - -#pragma intrinsic(__inbyte) -#pragma intrinsic(__inword) -#pragma intrinsic(__indword) -#pragma intrinsic(__outbyte) -#pragma intrinsic(__outword) -#pragma intrinsic(__outdword) -#pragma intrinsic(__inbytestring) -#pragma intrinsic(__inwordstring) -#pragma intrinsic(__indwordstring) -#pragma intrinsic(__outbytestring) -#pragma intrinsic(__outwordstring) -#pragma intrinsic(__outdwordstring) - -#ifdef __cplusplus -} -#endif - -#endif // defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -#if defined(_AMD64_) && !defined(DSF_DRIVER) - -// -// I/O space read and write macros. -// -// The READ/WRITE_REGISTER_* calls manipulate I/O registers in MEMORY space. -// -// The READ/WRITE_PORT_* calls manipulate I/O registers in PORT space. -// - -#ifdef __cplusplus -extern "C" { -#endif - -__forceinline -UCHAR -READ_REGISTER_UCHAR ( - __in __drv_nonConstant volatile UCHAR *Register - ) -{ - _ReadWriteBarrier(); - return *Register; -} - -__forceinline -USHORT -READ_REGISTER_USHORT ( - __in __drv_nonConstant volatile USHORT *Register - ) -{ - _ReadWriteBarrier(); - return *Register; -} - -__forceinline -ULONG -READ_REGISTER_ULONG ( - __in __drv_nonConstant volatile ULONG *Register - ) -{ - _ReadWriteBarrier(); - return *Register; -} - -__forceinline -ULONG64 -READ_REGISTER_ULONG64 ( - __in __drv_nonConstant volatile ULONG64 *Register - ) -{ - _ReadWriteBarrier(); - return *Register; -} - -__forceinline -VOID -READ_REGISTER_BUFFER_UCHAR ( - __in __drv_nonConstant PUCHAR Register, - __out_ecount_full(Count) PUCHAR Buffer, - __in ULONG Count - ) -{ - _ReadWriteBarrier(); - __movsb(Buffer, Register, Count); - return; -} - -__forceinline -VOID -READ_REGISTER_BUFFER_USHORT ( - __in __drv_nonConstant PUSHORT Register, - __out_ecount_full(Count) PUSHORT Buffer, - __in ULONG Count - ) -{ - _ReadWriteBarrier(); - __movsw(Buffer, Register, Count); - return; -} - -__forceinline -VOID -READ_REGISTER_BUFFER_ULONG ( - __in __drv_nonConstant PULONG Register, - __out_ecount_full(Count) PULONG Buffer, - __in ULONG Count - ) -{ - _ReadWriteBarrier(); - __movsd(Buffer, Register, Count); - return; -} - -__forceinline -VOID -READ_REGISTER_BUFFER_ULONG64 ( - __in __drv_nonConstant PULONG64 Register, - __out_ecount_full(Count) PULONG64 Buffer, - __in ULONG Count - ) -{ - _ReadWriteBarrier(); - __movsq(Buffer, Register, Count); - return; -} - -__forceinline -VOID -WRITE_REGISTER_UCHAR ( - __in __drv_nonConstant volatile UCHAR *Register, - __in UCHAR Value - ) -{ - - *Register = Value; - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_USHORT ( - __in __drv_nonConstant volatile USHORT *Register, - __in USHORT Value - ) -{ - - *Register = Value; - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_ULONG ( - __in __drv_nonConstant volatile ULONG *Register, - __in ULONG Value - ) -{ - - *Register = Value; - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_ULONG64 ( - __in __drv_nonConstant volatile ULONG64 *Register, - __in ULONG64 Value - ) -{ - - *Register = Value; - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_BUFFER_UCHAR ( - __in __drv_nonConstant PUCHAR Register, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ) -{ - - __movsb(Register, Buffer, Count); - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_BUFFER_USHORT ( - __in __drv_nonConstant PUSHORT Register, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ) -{ - - __movsw(Register, Buffer, Count); - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_BUFFER_ULONG ( - __in __drv_nonConstant PULONG Register, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ) -{ - - __movsd(Register, Buffer, Count); - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_BUFFER_ULONG64 ( - __in __drv_nonConstant PULONG64 Register, - __in_ecount(Count) PULONG64 Buffer, - __in ULONG Count - ) -{ - - __movsq(Register, Buffer, Count); - FastFence(); - return; -} - -__forceinline -UCHAR -READ_PORT_UCHAR ( - __in __drv_nonConstant PUCHAR Port - ) - -{ - UCHAR Result; - - _ReadWriteBarrier(); - Result = __inbyte((USHORT)((ULONG_PTR)Port)); - _ReadWriteBarrier(); - return Result; -} - -__forceinline -USHORT -READ_PORT_USHORT ( - __in __drv_nonConstant PUSHORT Port - ) - -{ - USHORT Result; - - _ReadWriteBarrier(); - Result = __inword((USHORT)((ULONG_PTR)Port)); - _ReadWriteBarrier(); - return Result; -} - -__forceinline -ULONG -READ_PORT_ULONG ( - __in __drv_nonConstant PULONG Port - ) - -{ - ULONG Result; - - _ReadWriteBarrier(); - Result = __indword((USHORT)((ULONG_PTR)Port)); - _ReadWriteBarrier(); - return Result; -} - - -__forceinline -VOID -READ_PORT_BUFFER_UCHAR ( - __in __drv_nonConstant PUCHAR Port, - __out_ecount_full(Count) PUCHAR Buffer, - __in ULONG Count - ) - -{ - _ReadWriteBarrier(); - __inbytestring((USHORT)((ULONG_PTR)Port), Buffer, Count); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -READ_PORT_BUFFER_USHORT ( - __in __drv_nonConstant PUSHORT Port, - __out_ecount_full(Count) PUSHORT Buffer, - __in ULONG Count - ) - -{ - _ReadWriteBarrier(); - __inwordstring((USHORT)((ULONG_PTR)Port), Buffer, Count); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -READ_PORT_BUFFER_ULONG ( - __in __drv_nonConstant PULONG Port, - __out_ecount_full(Count) PULONG Buffer, - __in ULONG Count - ) - -{ - _ReadWriteBarrier(); - __indwordstring((USHORT)((ULONG_PTR)Port), Buffer, Count); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -WRITE_PORT_UCHAR ( - __in __drv_nonConstant PUCHAR Port, - __in UCHAR Value - ) - -{ - _ReadWriteBarrier(); - __outbyte((USHORT)((ULONG_PTR)Port), Value); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -WRITE_PORT_USHORT ( - __in __drv_nonConstant PUSHORT Port, - __in USHORT Value - ) - -{ - _ReadWriteBarrier(); - __outword((USHORT)((ULONG_PTR)Port), Value); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -WRITE_PORT_ULONG ( - __in __drv_nonConstant PULONG Port, - __in ULONG Value - ) - -{ - _ReadWriteBarrier(); - __outdword((USHORT)((ULONG_PTR)Port), Value); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -WRITE_PORT_BUFFER_UCHAR ( - __in __drv_nonConstant PUCHAR Port, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ) - -{ - _ReadWriteBarrier(); - __outbytestring((USHORT)((ULONG_PTR)Port), Buffer, Count); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -WRITE_PORT_BUFFER_USHORT ( - __in __drv_nonConstant PUSHORT Port, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ) - -{ - _ReadWriteBarrier(); - __outwordstring((USHORT)((ULONG_PTR)Port), Buffer, Count); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -WRITE_PORT_BUFFER_ULONG ( - __in __drv_nonConstant PULONG Port, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ) - -{ - _ReadWriteBarrier(); - __outdwordstring((USHORT)((ULONG_PTR)Port), Buffer, Count); - _ReadWriteBarrier(); - return; -} - -#ifdef __cplusplus -} -#endif - -#elif defined(_AMD64_) && defined(DSF_DRIVER) -#include -#endif - - -// -// Interrupt modes. -// - -typedef enum _KINTERRUPT_MODE { - LevelSensitive, - Latched -} KINTERRUPT_MODE; - -typedef enum _KINTERRUPT_POLARITY { - InterruptPolarityUnknown, - InterruptActiveHigh, - InterruptActiveLow -} KINTERRUPT_POLARITY, *PKINTERRUPT_POLARITY; - - -typedef enum _MEMORY_CACHING_TYPE_ORIG { - MmFrameBufferCached = 2 -} MEMORY_CACHING_TYPE_ORIG; - -typedef enum _MEMORY_CACHING_TYPE { - MmNonCached = FALSE, - MmCached = TRUE, - MmWriteCombined = MmFrameBufferCached, - MmHardwareCoherentCached, - MmNonCachedUnordered, // IA64 - MmUSWCCached, - MmMaximumCacheType -} MEMORY_CACHING_TYPE; - - -// -// Structures used by the kernel drivers to describe which ports must be -// hooked out directly from the V86 emulator to the driver. -// - -typedef enum _EMULATOR_PORT_ACCESS_TYPE { - Uchar, - Ushort, - Ulong -} EMULATOR_PORT_ACCESS_TYPE, *PEMULATOR_PORT_ACCESS_TYPE; - -// -// Access Modes -// - -#define EMULATOR_READ_ACCESS 0x01 -#define EMULATOR_WRITE_ACCESS 0x02 - -typedef struct _EMULATOR_ACCESS_ENTRY { - ULONG BasePort; - ULONG NumConsecutivePorts; - EMULATOR_PORT_ACCESS_TYPE AccessType; - UCHAR AccessMode; - UCHAR StringSupport; - PVOID Routine; -} EMULATOR_ACCESS_ENTRY, *PEMULATOR_ACCESS_ENTRY; - - -typedef struct _PCI_SLOT_NUMBER { - union { - struct { - ULONG DeviceNumber:5; - ULONG FunctionNumber:3; - ULONG Reserved:24; - } bits; - ULONG AsULONG; - } u; -} PCI_SLOT_NUMBER, *PPCI_SLOT_NUMBER; - - -#define PCI_TYPE0_ADDRESSES 6 -#define PCI_TYPE1_ADDRESSES 2 -#define PCI_TYPE2_ADDRESSES 5 - -typedef struct _PCI_COMMON_HEADER { - USHORT VendorID; // (ro) - USHORT DeviceID; // (ro) - USHORT Command; // Device control - USHORT Status; - UCHAR RevisionID; // (ro) - UCHAR ProgIf; // (ro) - UCHAR SubClass; // (ro) - UCHAR BaseClass; // (ro) - UCHAR CacheLineSize; // (ro+) - UCHAR LatencyTimer; // (ro+) - UCHAR HeaderType; // (ro) - UCHAR BIST; // Built in self test - - union { - struct _PCI_HEADER_TYPE_0 { - ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; - ULONG CIS; - USHORT SubVendorID; - USHORT SubSystemID; - ULONG ROMBaseAddress; - UCHAR CapabilitiesPtr; - UCHAR Reserved1[3]; - ULONG Reserved2; - UCHAR InterruptLine; // - UCHAR InterruptPin; // (ro) - UCHAR MinimumGrant; // (ro) - UCHAR MaximumLatency; // (ro) - } type0; - - - } u; - -} PCI_COMMON_HEADER, *PPCI_COMMON_HEADER; - -#ifdef __cplusplus - -typedef struct _PCI_COMMON_CONFIG : PCI_COMMON_HEADER { - UCHAR DeviceSpecific[192]; -} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; - -#else - -typedef struct _PCI_COMMON_CONFIG { - PCI_COMMON_HEADER DUMMYSTRUCTNAME; - UCHAR DeviceSpecific[192]; -} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; - -#endif - -#define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET (PCI_COMMON_CONFIG, DeviceSpecific)) -#define PCI_EXTENDED_CONFIG_LENGTH 0x1000 - -#define PCI_MAX_DEVICES 32 -#define PCI_MAX_FUNCTION 8 -#define PCI_MAX_BRIDGE_NUMBER 0xFF - -#define PCI_INVALID_VENDORID 0xFFFF - -// -// Bit encodings for PCI_COMMON_CONFIG.HeaderType -// - -#define PCI_MULTIFUNCTION 0x80 -#define PCI_DEVICE_TYPE 0x00 -#define PCI_BRIDGE_TYPE 0x01 -#define PCI_CARDBUS_BRIDGE_TYPE 0x02 - -#define PCI_CONFIGURATION_TYPE(PciData) \ - (((PPCI_COMMON_CONFIG)(PciData))->HeaderType & ~PCI_MULTIFUNCTION) - -#define PCI_MULTIFUNCTION_DEVICE(PciData) \ - ((((PPCI_COMMON_CONFIG)(PciData))->HeaderType & PCI_MULTIFUNCTION) != 0) - -// -// Bit encodings for PCI_COMMON_CONFIG.Command -// - -#define PCI_ENABLE_IO_SPACE 0x0001 -#define PCI_ENABLE_MEMORY_SPACE 0x0002 -#define PCI_ENABLE_BUS_MASTER 0x0004 -#define PCI_ENABLE_SPECIAL_CYCLES 0x0008 -#define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010 -#define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020 -#define PCI_ENABLE_PARITY 0x0040 // (ro+) -#define PCI_ENABLE_WAIT_CYCLE 0x0080 // (ro+) -#define PCI_ENABLE_SERR 0x0100 // (ro+) -#define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200 // (ro) -#define PCI_DISABLE_LEVEL_INTERRUPT 0x0400 - -// -// Bit encodings for PCI_COMMON_CONFIG.Status -// - -#define PCI_STATUS_INTERRUPT_PENDING 0x0008 -#define PCI_STATUS_CAPABILITIES_LIST 0x0010 // (ro) -#define PCI_STATUS_66MHZ_CAPABLE 0x0020 // (ro) -#define PCI_STATUS_UDF_SUPPORTED 0x0040 // (ro) -#define PCI_STATUS_FAST_BACK_TO_BACK 0x0080 // (ro) -#define PCI_STATUS_DATA_PARITY_DETECTED 0x0100 -#define PCI_STATUS_DEVSEL 0x0600 // 2 bits wide -#define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800 -#define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000 -#define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000 -#define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000 -#define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000 - -// -// The NT PCI Driver uses a WhichSpace parameter on its CONFIG_READ/WRITE -// routines. The following values are defined- -// - -#define PCI_WHICHSPACE_CONFIG 0x0 -#define PCI_WHICHSPACE_ROM 0x52696350 - -// -// PCI Capability IDs -// - -#define PCI_CAPABILITY_ID_POWER_MANAGEMENT 0x01 -#define PCI_CAPABILITY_ID_AGP 0x02 -#define PCI_CAPABILITY_ID_VPD 0x03 -#define PCI_CAPABILITY_ID_SLOT_ID 0x04 -#define PCI_CAPABILITY_ID_MSI 0x05 -#define PCI_CAPABILITY_ID_CPCI_HOTSWAP 0x06 -#define PCI_CAPABILITY_ID_PCIX 0x07 -#define PCI_CAPABILITY_ID_HYPERTRANSPORT 0x08 -#define PCI_CAPABILITY_ID_VENDOR_SPECIFIC 0x09 -#define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A -#define PCI_CAPABILITY_ID_CPCI_RES_CTRL 0x0B -#define PCI_CAPABILITY_ID_SHPC 0x0C -#define PCI_CAPABILITY_ID_P2P_SSID 0x0D -#define PCI_CAPABILITY_ID_AGP_TARGET 0x0E -#define PCI_CAPABILITY_ID_SECURE 0x0F -#define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10 -#define PCI_CAPABILITY_ID_MSIX 0x11 - -// -// All PCI Capability structures have the following header. -// -// CapabilityID is used to identify the type of the structure (is -// one of the PCI_CAPABILITY_ID values above. -// -// Next is the offset in PCI Configuration space (0x40 - 0xfc) of the -// next capability structure in the list, or 0x00 if there are no more -// entries. -// -typedef struct _PCI_CAPABILITIES_HEADER { - UCHAR CapabilityID; - UCHAR Next; -} PCI_CAPABILITIES_HEADER, *PPCI_CAPABILITIES_HEADER; - -// -// Power Management Capability -// - -typedef struct _PCI_PMC { - UCHAR Version:3; - UCHAR PMEClock:1; - UCHAR Rsvd1:1; - UCHAR DeviceSpecificInitialization:1; - UCHAR Rsvd2:2; - struct _PM_SUPPORT { - UCHAR Rsvd2:1; - UCHAR D1:1; - UCHAR D2:1; - UCHAR PMED0:1; - UCHAR PMED1:1; - UCHAR PMED2:1; - UCHAR PMED3Hot:1; - UCHAR PMED3Cold:1; - } Support; -} PCI_PMC, *PPCI_PMC; - -typedef struct _PCI_PMCSR { - USHORT PowerState:2; - USHORT Rsvd1:6; - USHORT PMEEnable:1; - USHORT DataSelect:4; - USHORT DataScale:2; - USHORT PMEStatus:1; -} PCI_PMCSR, *PPCI_PMCSR; - - -typedef struct _PCI_PMCSR_BSE { - UCHAR Rsvd1:6; - UCHAR D3HotSupportsStopClock:1; // B2_B3# - UCHAR BusPowerClockControlEnabled:1; // BPCC_EN -} PCI_PMCSR_BSE, *PPCI_PMCSR_BSE; - - -typedef struct _PCI_PM_CAPABILITY { - - PCI_CAPABILITIES_HEADER Header; - - // - // Power Management Capabilities (Offset = 2) - // - - union { - PCI_PMC Capabilities; - USHORT AsUSHORT; - } PMC; - - // - // Power Management Control/Status (Offset = 4) - // - - union { - PCI_PMCSR ControlStatus; - USHORT AsUSHORT; - } PMCSR; - - // - // PMCSR PCI-PCI Bridge Support Extensions - // - - union { - PCI_PMCSR_BSE BridgeSupport; - UCHAR AsUCHAR; - } PMCSR_BSE; - - // - // Optional read only 8 bit Data register. Contents controlled by - // DataSelect and DataScale in ControlStatus. - // - - UCHAR Data; - -} PCI_PM_CAPABILITY, *PPCI_PM_CAPABILITY; - -// end_wdm -// begin_ntddk - -// -// AGP Capabilities -// -typedef struct _PCI_AGP_CAPABILITY { - - PCI_CAPABILITIES_HEADER Header; - - USHORT Minor:4; - USHORT Major:4; - USHORT Rsvd1:8; - - struct _PCI_AGP_STATUS { - ULONG Rate:3; - ULONG Agp3Mode:1; - ULONG FastWrite:1; - ULONG FourGB:1; - ULONG HostTransDisable:1; - ULONG Gart64:1; - ULONG ITA_Coherent:1; - ULONG SideBandAddressing:1; // SBA - ULONG CalibrationCycle:3; - ULONG AsyncRequestSize:3; - ULONG Rsvd1:1; - ULONG Isoch:1; - ULONG Rsvd2:6; - ULONG RequestQueueDepthMaximum:8; // RQ - } AGPStatus; - - struct _PCI_AGP_COMMAND { - ULONG Rate:3; - ULONG Rsvd1:1; - ULONG FastWriteEnable:1; - ULONG FourGBEnable:1; - ULONG Rsvd2:1; - ULONG Gart64:1; - ULONG AGPEnable:1; - ULONG SBAEnable:1; - ULONG CalibrationCycle:3; - ULONG AsyncReqSize:3; - ULONG Rsvd3:8; - ULONG RequestQueueDepth:8; - } AGPCommand; - -} PCI_AGP_CAPABILITY, *PPCI_AGP_CAPABILITY; - -// -// An AGPv3 Target must have an extended capability, -// but it's only present for a Master when the Isoch -// bit is set in its status register -// -typedef enum _EXTENDED_AGP_REGISTER { - IsochStatus, - AgpControl, - ApertureSize, - AperturePageSize, - GartLow, - GartHigh, - IsochCommand -} EXTENDED_AGP_REGISTER, *PEXTENDED_AGP_REGISTER; - -typedef struct _PCI_AGP_ISOCH_STATUS { - ULONG ErrorCode: 2; - ULONG Rsvd1: 1; - ULONG Isoch_L: 3; - ULONG Isoch_Y: 2; - ULONG Isoch_N: 8; - ULONG Rsvd2: 16; -} PCI_AGP_ISOCH_STATUS, *PPCI_AGP_ISOCH_STATUS; - -typedef struct _PCI_AGP_CONTROL { - ULONG Rsvd1: 7; - ULONG GTLB_Enable: 1; - ULONG AP_Enable: 1; - ULONG CAL_Disable: 1; - ULONG Rsvd2: 22; -} PCI_AGP_CONTROL, *PPCI_AGP_CONTROL; - -typedef struct _PCI_AGP_APERTURE_PAGE_SIZE { - USHORT PageSizeMask: 11; - USHORT Rsvd1: 1; - USHORT PageSizeSelect: 4; -} PCI_AGP_APERTURE_PAGE_SIZE, *PPCI_AGP_APERTURE_PAGE_SIZE; - -typedef struct _PCI_AGP_ISOCH_COMMAND { - USHORT Rsvd1: 6; - USHORT Isoch_Y: 2; - USHORT Isoch_N: 8; -} PCI_AGP_ISOCH_COMMAND, *PPCI_AGP_ISOCH_COMMAND; - -typedef struct PCI_AGP_EXTENDED_CAPABILITY { - - PCI_AGP_ISOCH_STATUS IsochStatus; - -// -// Target only ----------------<<-begin->> -// - PCI_AGP_CONTROL AgpControl; - USHORT ApertureSize; - PCI_AGP_APERTURE_PAGE_SIZE AperturePageSize; - ULONG GartLow; - ULONG GartHigh; -// -// ------------------------------<<-end->> -// - - PCI_AGP_ISOCH_COMMAND IsochCommand; - -} PCI_AGP_EXTENDED_CAPABILITY, *PPCI_AGP_EXTENDED_CAPABILITY; - - -#define PCI_AGP_RATE_1X 0x1 -#define PCI_AGP_RATE_2X 0x2 -#define PCI_AGP_RATE_4X 0x4 - -// end_ntddk -// begin_wdm - -// -// PCI-X Capability -// - -typedef struct { - - PCI_CAPABILITIES_HEADER Header; - - union { - struct { - USHORT DataParityErrorRecoveryEnable:1; - USHORT EnableRelaxedOrdering:1; - USHORT MaxMemoryReadByteCount:2; - USHORT MaxOutstandingSplitTransactions:3; - USHORT Reserved:9; - } bits; - USHORT AsUSHORT; - } Command; - - union { - struct { - ULONG FunctionNumber:3; - ULONG DeviceNumber:5; - ULONG BusNumber:8; - ULONG Device64Bit:1; - ULONG Capable133MHz:1; - ULONG SplitCompletionDiscarded:1; - ULONG UnexpectedSplitCompletion:1; - ULONG DeviceComplexity:1; - ULONG DesignedMaxMemoryReadByteCount:2; - ULONG DesignedMaxOutstandingSplitTransactions:3; - ULONG DesignedMaxCumulativeReadSize:3; - ULONG ReceivedSplitCompletionErrorMessage:1; - ULONG CapablePCIX266:1; - ULONG CapablePCIX533:1; - } bits; - ULONG AsULONG; - } Status; -} PCI_X_CAPABILITY, *PPCI_X_CAPABILITY; - -// end_wdm -// begin_ntddk - -// -// PCI-X Bridge Capability -// - -// -// Values for BusModeFrequency in the SecondaryStatus register -// -#define PCIX_MODE_CONVENTIONAL_PCI 0x0 -#define PCIX_MODE1_66MHZ 0x1 -#define PCIX_MODE1_100MHZ 0x2 -#define PCIX_MODE1_133MHZ 0x3 -#define PCIX_MODE2_266_66MHZ 0x9 -#define PCIX_MODE2_266_100MHZ 0xA -#define PCIX_MODE2_266_133MHZ 0xB -#define PCIX_MODE2_533_66MHZ 0xD -#define PCIX_MODE2_533_100MHZ 0xE -#define PCIX_MODE2_533_133MHZ 0xF - -// -// Values for the Version in the SecondaryStatus register -// -#define PCIX_VERSION_MODE1_ONLY 0x0 -#define PCIX_VERSION_MODE2_ECC 0x1 -#define PCIX_VERSION_DUAL_MODE_ECC 0x2 - -typedef struct _PCIX_BRIDGE_CAPABILITY { - - PCI_CAPABILITIES_HEADER Header; - - union { - struct { - USHORT Bus64Bit:1; - USHORT Bus133MHzCapable:1; - USHORT SplitCompletionDiscarded:1; - USHORT UnexpectedSplitCompletion:1; - USHORT SplitCompletionOverrun:1; - USHORT SplitRequestDelayed:1; - USHORT BusModeFrequency:4; // PCIX_MODE_x - USHORT Rsvd:2; - USHORT Version:2; // PCIX_VERSION_x - USHORT Bus266MHzCapable:1; - USHORT Bus533MHzCapable:1; - } DUMMYSTRUCTNAME; - USHORT AsUSHORT; - } SecondaryStatus; - - union { - struct { - ULONG FunctionNumber:3; - ULONG DeviceNumber:5; - ULONG BusNumber:8; - ULONG Device64Bit:1; - ULONG Device133MHzCapable:1; - ULONG SplitCompletionDiscarded:1; - ULONG UnexpectedSplitCompletion:1; - ULONG SplitCompletionOverrun:1; - ULONG SplitRequestDelayed:1; - ULONG Rsvd:7; - ULONG DIMCapable:1; - ULONG Device266MHzCapable:1; - ULONG Device533MHzCapable:1; - } DUMMYSTRUCTNAME; - ULONG AsULONG; - } BridgeStatus; - - USHORT UpstreamSplitTransactionCapacity; - USHORT UpstreamSplitTransactionLimit; - - USHORT DownstreamSplitTransactionCapacity; - USHORT DownstreamSplitTransactionLimit; - - union { - struct { - ULONG SelectSecondaryRegisters:1; - ULONG ErrorPresentInOtherBank:1; - ULONG AdditionalCorrectableError:1; - ULONG AdditionalUncorrectableError:1; - ULONG ErrorPhase:3; - ULONG ErrorCorrected:1; - ULONG Syndrome:8; - ULONG ErrorFirstCommand:4; - ULONG ErrorSecondCommand:4; - ULONG ErrorUpperAttributes:4; - ULONG ControlUpdateEnable:1; - ULONG Rsvd:1; - ULONG DisableSingleBitCorrection:1; - ULONG EccMode:1; - } DUMMYSTRUCTNAME; - ULONG AsULONG; - } EccControlStatus; - - ULONG EccFirstAddress; - ULONG EccSecondAddress; - ULONG EccAttribute; - -} PCIX_BRIDGE_CAPABILITY, *PPCIX_BRIDGE_CAPABILITY; - -// -// PCI to PCI Bridge Subsystem ID Capability -// -typedef struct _PCI_SUBSYSTEM_IDS_CAPABILITY { - - PCI_CAPABILITIES_HEADER Header; - USHORT Reserved; - USHORT SubVendorID; - USHORT SubSystemID; - -} PCI_SUBSYSTEM_IDS_CAPABILITY, *PPCI_SUBSYSTEM_IDS_CAPABILITY; - -// -// _OSC is used by OSPM to query the capabilities of a device and to -// communicate the features supported by the device driver to the platform. -// The _OSC interface for PCI host bridge devices that originate PCI, PCI-X or -// PCI Express hierarchies is identified by a UUID of {33db4d5b-1ff7-401c-9657- -// 7441c03dd766}. A revision ID of 1 indicates that the capabilities buffer is -// composed of 3 DWORDs. -// The first DWORD is common across all OSC implementations and includes status -// and error information. -// The second DWORD (Support Field) provides information regarding OS supported -// features. -// The third DWORD (Control Field) is used to submit request for control of -// associated features. If any bits in the control field are returned cleared, -// then the respective feature is unsupported by the platform and must not be -// enabled. -// According to the PCI Firmware Specification a machine with multiple host -// bridge devices should report the same capabilities for all host bridges -// and also negotiate control of the features in the same way. -// - -#define OSC_FIRMWARE_FAILURE 0x02 -#define OSC_UNRECOGNIZED_UUID 0x04 -#define OSC_UNRECOGNIZED_REVISION 0x08 -#define OSC_CAPABILITIES_MASKED 0x10 - -#define PCI_ROOT_BUS_OSC_METHOD_CAPABILITY_REVISION 0x01 - -// -// The following declarations pertain to the second and third DWORD in -// evaluation of _OSC for PCI host bridge devices. -// - -typedef struct _PCI_ROOT_BUS_OSC_SUPPORT_FIELD { - union { - struct { - ULONG ExtendedConfigOpRegions:1; - ULONG ActiveStatePowerManagement:1; - ULONG ClockPowerManagement:1; - ULONG SegmentGroups:1; - ULONG MessageSignaledInterrupts:1; - ULONG WindowsHardwareErrorArchitecture:1; - ULONG Reserved:26; - } DUMMYSTRUCTNAME; - ULONG AsULONG; - } u; -} PCI_ROOT_BUS_OSC_SUPPORT_FIELD, *PPCI_ROOT_BUS_OSC_SUPPORT_FIELD; - -typedef struct _PCI_ROOT_BUS_OSC_CONTROL_FIELD { - union { - struct { - ULONG ExpressNativeHotPlug:1; - ULONG ShpcNativeHotPlug:1; - ULONG ExpressNativePME:1; - ULONG ExpressAdvancedErrorReporting:1; - ULONG ExpressCapabilityStructure:1; - ULONG Reserved:27; - } DUMMYSTRUCTNAME; - ULONG AsULONG; - } u; -} PCI_ROOT_BUS_OSC_CONTROL_FIELD, *PPCI_ROOT_BUS_OSC_CONTROL_FIELD; - -// -// An enumerator for the PCI physical and electrical interface. -// - -typedef enum _PCI_HARDWARE_INTERFACE { - - PciConventional, - PciXMode1, - PciXMode2, - PciExpress - -} PCI_HARDWARE_INTERFACE, *PPCI_HARDWARE_INTERFACE; - -typedef enum { - - BusWidth32Bits, - BusWidth64Bits - -} PCI_BUS_WIDTH; - -typedef struct _PCI_ROOT_BUS_HARDWARE_CAPABILITY { - - // - // Describes the secondary side of a PCI root bus. - // - - PCI_HARDWARE_INTERFACE SecondaryInterface; - - // - // These additional capabilities are available when each of the following - // is true. - // 1. The secondary side of a PCI root bus operates in conventional or - // PCI-X mode. - // 2. The PCI root bus has a hardware ID or compatible ID of PNP0A03. - // 3. A _DSM function 4 is defined for the root bus. - // - - struct { - - // - // This boolean indicates if the remaining fields describing the bus - // capabilities are valid or not. - // - - BOOLEAN BusCapabilitiesFound; - - - // - // Provides information on current and supported speeds/modes. - // - - ULONG CurrentSpeedAndMode; - ULONG SupportedSpeedsAndModes; - - // - // Describes the root bus capability on forwarding of Device ID message - // transactions. - // - - BOOLEAN DeviceIDMessagingCapable; - - // - // Provides the width for a PCI interface. - // - - PCI_BUS_WIDTH SecondaryBusWidth; - } DUMMYSTRUCTNAME; - - // - // Fields describing features supported as well as control for them from - // the bios. - // - - PCI_ROOT_BUS_OSC_SUPPORT_FIELD OscFeatureSupport; - PCI_ROOT_BUS_OSC_CONTROL_FIELD OscControlRequest; - PCI_ROOT_BUS_OSC_CONTROL_FIELD OscControlGranted; - -} PCI_ROOT_BUS_HARDWARE_CAPABILITY, *PPCI_ROOT_BUS_HARDWARE_CAPABILITY; - -// -// PCI Express Capability -// - -typedef union _PCI_EXPRESS_CAPABILITIES_REGISTER { - - struct { - - USHORT CapabilityVersion:4; - USHORT DeviceType:4; // PCI_EXPRESS_DEVICE_TYPE - USHORT SlotImplemented:1; - USHORT InterruptMessageNumber:5; - USHORT Rsvd:2; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_CAPABILITIES_REGISTER, *PPCI_EXPRESS_CAPABILITIES_REGISTER; - -typedef union _PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER { - - struct { - - ULONG MaxPayloadSizeSupported:3; // EXPRESS_MAX_PAYLOAD_SIZE - ULONG PhantomFunctionsSupported:2; - ULONG ExtendedTagSupported:1; - ULONG L0sAcceptableLatency:3; // EXPRESS_L0S_LATENCY - ULONG L1AcceptableLatency:3; // EXPRESS_L1_LATENCY - ULONG Undefined:3; - ULONG RoleBasedErrorReporting:1; - ULONG Rsvd1:2; - ULONG CapturedSlotPowerLimit:8; - ULONG CapturedSlotPowerLimitScale:2; - ULONG Rsvd2:4; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER, *PPCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER; - -// -// The low 3 bits of the PCI Express device control register dictate whether -// a device that implements AER routes error messages to the root complex. -// This mask is used when programming the AER bits in the device control -// register. -// - -#define PCI_EXPRESS_AER_DEVICE_CONTROL_MASK 0x07; - -typedef union _PCI_EXPRESS_DEVICE_CONTROL_REGISTER { - - struct { - - USHORT CorrectableErrorEnable:1; - USHORT NonFatalErrorEnable:1; - USHORT FatalErrorEnable:1; - USHORT UnsupportedRequestErrorEnable:1; - USHORT EnableRelaxedOrder:1; - USHORT MaxPayloadSize:3; // EXPRESS_MAX_PAYLOAD_SIZE - USHORT ExtendedTagEnable:1; - USHORT PhantomFunctionsEnable:1; - USHORT AuxPowerEnable:1; - USHORT NoSnoopEnable:1; - USHORT MaxReadRequestSize:3; // EXPRESS_MAX_PAYLOAD_SIZE - USHORT BridgeConfigRetryEnable:1; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_DEVICE_CONTROL_REGISTER, *PPCI_EXPRESS_DEVICE_CONTROL_REGISTER; - -// -// The low 4 bits of the PCI Express device status register hold AER device -// status. This mask is used when programming the AER bits in the device status -// register. -// - -#define PCI_EXPRESS_AER_DEVICE_STATUS_MASK 0x0F; - -typedef union _PCI_EXPRESS_DEVICE_STATUS_REGISTER { - - struct { - - USHORT CorrectableErrorDetected:1; - USHORT NonFatalErrorDetected:1; - USHORT FatalErrorDetected:1; - USHORT UnsupportedRequestDetected:1; - USHORT AuxPowerDetected:1; - USHORT TransactionsPending:1; - USHORT Rsvd:10; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_DEVICE_STATUS_REGISTER, *PPCI_EXPRESS_DEVICE_STATUS_REGISTER; - -typedef union _PCI_EXPRESS_LINK_CAPABILITIES_REGISTER { - - struct { - - ULONG MaximumLinkSpeed:4; - ULONG MaximumLinkWidth:6; - ULONG ActiveStatePMSupport:2; // EXPRESS_ASPM_CONFIG - ULONG L0sExitLatency:3; // EXPRESS_L0S_LATENCY - ULONG L1ExitLatency:3; // EXPRESS_L1_LATENCY - ULONG ClockPowerManagement:1; - ULONG SurpriseDownErrorReportingCapable:1; - ULONG DataLinkLayerActiveReportingCapable:1; - ULONG Rsvd:3; - ULONG PortNumber:8; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_LINK_CAPABILITIES_REGISTER, *PPCI_EXPRESS_LINK_CAPABILITIES_REGISTER; - -typedef union _PCI_EXPRESS_LINK_CONTROL_REGISTER { - - struct { - - USHORT ActiveStatePMControl:2; // EXPRESS_ASPM_CONFIG - USHORT Rsvd1:1; - USHORT ReadCompletionBoundary:1; // EXPRESS_RCB - USHORT LinkDisable:1; - USHORT RetrainLink:1; - USHORT CommonClockConfig:1; - USHORT ExtendedSynch:1; - USHORT EnableClockPowerManagement:1; - USHORT Rsvd2:7; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_LINK_CONTROL_REGISTER, *PPCI_EXPRESS_LINK_CONTROL_REGISTER; - -typedef union _PCI_EXPRESS_LINK_STATUS_REGISTER { - - struct { - - USHORT LinkSpeed:4; - USHORT LinkWidth:6; - USHORT Undefined:1; - USHORT LinkTraining:1; - USHORT SlotClockConfig:1; - USHORT DataLinkLayerActive:1; - USHORT Rsvd:2; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_LINK_STATUS_REGISTER, *PPCI_EXPRESS_LINK_STATUS_REGISTER; - -typedef union _PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER { - - struct { - - ULONG AttentionButtonPresent:1; - ULONG PowerControllerPresent:1; - ULONG MRLSensorPresent:1; - ULONG AttentionIndicatorPresent:1; - ULONG PowerIndicatorPresent:1; - ULONG HotPlugSurprise:1; - ULONG HotPlugCapable:1; - ULONG SlotPowerLimit:8; - ULONG SlotPowerLimitScale:2; - ULONG ElectromechanicalLockPresent:1; - ULONG NoCommandCompletedSupport:1; - ULONG PhysicalSlotNumber:13; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER, *PPCI_EXPRESS_SLOT_CAPABILITIES_REGISTER; - -typedef union _PCI_EXPRESS_SLOT_CONTROL_REGISTER { - - struct { - - USHORT AttentionButtonEnable:1; - USHORT PowerFaultDetectEnable:1; - USHORT MRLSensorEnable:1; - USHORT PresenceDetectEnable:1; - USHORT CommandCompletedEnable:1; - USHORT HotPlugInterruptEnable:1; - USHORT AttentionIndicatorControl:2; // EXPRESS_INDICATOR_STATE - USHORT PowerIndicatorControl:2; // EXPRESS_INDICATOR_STATE - USHORT PowerControllerControl:1; // EXPRESS_POWER_STATE - USHORT ElectromechanicalLockControl:1; - USHORT DataLinkStateChangeEnable:1; - USHORT Rsvd:3; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_SLOT_CONTROL_REGISTER, *PPCI_EXPRESS_SLOT_CONTROL_REGISTER; - -typedef union _PCI_EXPRESS_SLOT_STATUS_REGISTER { - - struct { - - USHORT AttentionButtonPressed:1; - USHORT PowerFaultDetected:1; - USHORT MRLSensorChanged:1; - USHORT PresenceDetectChanged:1; - USHORT CommandCompleted:1; - USHORT MRLSensorState:1; // EXPRESS_MRL_STATE - USHORT PresenceDetectState:1; // EXPRESS_CARD_PRESENCE - USHORT ElectromechanicalLockEngaged:1; - USHORT DataLinkStateChanged:1; - USHORT Rsvd:7; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_SLOT_STATUS_REGISTER, *PPCI_EXPRESS_SLOT_STATUS_REGISTER; - -typedef union _PCI_EXPRESS_ROOT_CONTROL_REGISTER { - - struct { - - USHORT CorrectableSerrEnable:1; - USHORT NonFatalSerrEnable:1; - USHORT FatalSerrEnable:1; - USHORT PMEInterruptEnable:1; - USHORT CRSSoftwareVisibilityEnable:1; - USHORT Rsvd:11; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_ROOT_CONTROL_REGISTER, *PPCI_EXPRESS_ROOT_CONTROL_REGISTER; - -typedef union _PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER { - - struct { - - USHORT CRSSoftwareVisibility:1; - USHORT Rsvd:15; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER, *PPCI_EXPRESS_ROOT_CAPABILITIES_REGISTER; - -typedef union _PCI_EXPRESS_ROOT_STATUS_REGISTER { - - struct { - - ULONG PMERequestorId:16; // PCI_EXPRESS_REQUESTOR_ID - ULONG PMEStatus:1; - ULONG PMEPending:1; - ULONG Rsvd:14; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_ROOT_STATUS_REGISTER, *PPCI_EXPRESS_ROOT_STATUS_REGISTER; - -// -// PCI Express Capability -// - -typedef struct _PCI_EXPRESS_CAPABILITY { - - PCI_CAPABILITIES_HEADER Header; - PCI_EXPRESS_CAPABILITIES_REGISTER ExpressCapabilities; - - PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER DeviceCapabilities; - - PCI_EXPRESS_DEVICE_CONTROL_REGISTER DeviceControl; - PCI_EXPRESS_DEVICE_STATUS_REGISTER DeviceStatus; - - PCI_EXPRESS_LINK_CAPABILITIES_REGISTER LinkCapabilities; - - PCI_EXPRESS_LINK_CONTROL_REGISTER LinkControl; - PCI_EXPRESS_LINK_STATUS_REGISTER LinkStatus; - - PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER SlotCapabilities; - - PCI_EXPRESS_SLOT_CONTROL_REGISTER SlotControl; - PCI_EXPRESS_SLOT_STATUS_REGISTER SlotStatus; - - PCI_EXPRESS_ROOT_CONTROL_REGISTER RootControl; - PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER RootCapabilities; - - PCI_EXPRESS_ROOT_STATUS_REGISTER RootStatus; - -} PCI_EXPRESS_CAPABILITY, *PPCI_EXPRESS_CAPABILITY; - -typedef enum { - - MRLClosed = 0, - MRLOpen - -} PCI_EXPRESS_MRL_STATE; - -typedef enum { - - SlotEmpty = 0, - CardPresent - -} PCI_EXPRESS_CARD_PRESENCE; - -typedef enum { - - IndicatorOn = 1, - IndicatorBlink, - IndicatorOff - -} PCI_EXPRESS_INDICATOR_STATE; - -typedef enum { - - PowerOn = 0, - PowerOff - -} PCI_EXPRESS_POWER_STATE; - -typedef enum { - - L0sEntrySupport = 1, - L0sAndL1EntrySupport = 3 - -} PCI_EXPRESS_ASPM_SUPPORT; - -typedef enum { - - L0sAndL1EntryDisabled, - L0sEntryEnabled, - L1EntryEnabled, - L0sAndL1EntryEnabled - -} PCI_EXPRESS_ASPM_CONTROL; - -typedef enum { - - L0s_Below64ns = 0, - L0s_64ns_128ns, - L0s_128ns_256ns, - L0s_256ns_512ns, - L0s_512ns_1us, - L0s_1us_2us, - L0s_2us_4us, - L0s_Above4us - -} PCI_EXPRESS_L0s_EXIT_LATENCY; - -typedef enum { - - L1_Below1us = 0, - L1_1us_2us, - L1_2us_4us, - L1_4us_8us, - L1_8us_16us, - L1_16us_32us, - L1_32us_64us, - L1_Above64us - -} PCI_EXPRESS_L1_EXIT_LATENCY; - -typedef enum { - - PciExpressEndpoint = 0, - PciExpressLegacyEndpoint, - PciExpressRootPort = 4, - PciExpressUpstreamSwitchPort, - PciExpressDownstreamSwitchPort, - PciExpressToPciXBridge, - PciXToExpressBridge, - PciExpressRootComplexIntegratedEndpoint, - PciExpressRootComplexEventCollector - -} PCI_EXPRESS_DEVICE_TYPE; - -typedef enum { - - MaxPayload128Bytes = 0, - MaxPayload256Bytes, - MaxPayload512Bytes, - MaxPayload1024Bytes, - MaxPayload2048Bytes, - MaxPayload4096Bytes - -} PCI_EXPRESS_MAX_PAYLOAD_SIZE; - -typedef union _PCI_EXPRESS_PME_REQUESTOR_ID { - - struct { - - USHORT FunctionNumber:3; - USHORT DeviceNumber:5; - USHORT BusNumber:8; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_PME_REQUESTOR_ID, *PPCI_EXPRESS_PME_REQUESTOR_ID; - -// end_ntddk -// begin_wdm - -// -// PCI Express Extended Capabilities. -// - -#define PCI_EXPRESS_ADVANCED_ERROR_REPORTING_CAP_ID 0x0001 -#define PCI_EXPRESS_VIRTUAL_CHANNEL_CAP_ID 0x0002 -#define PCI_EXPRESS_DEVICE_SERIAL_NUMBER_CAP_ID 0x0003 -#define PCI_EXPRESS_POWER_BUDGETING_CAP_ID 0x0004 -#define PCI_EXPRESS_RC_LINK_DECLARATION_CAP_ID 0x0005 -#define PCI_EXPRESS_RC_INTERNAL_LINK_CONTROL_CAP_ID 0x0006 -#define PCI_EXPRESS_RC_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_CAP_ID 0x0007 -#define PCI_EXPRESS_MFVC_CAP_ID 0x0008 -#define PCI_EXPRESS_VC_AND_MFVC_CAP_ID 0x0009 -#define PCI_EXPRESS_RCRB_HEADER_CAP_ID 0x000A -#define PCI_EXPRESS_SINGLE_ROOT_IO_VIRTUALIZATION_CAP_ID 0x0010 - -// -// All Enhanced capabilities have the following header. -// - -typedef struct _PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER { - - USHORT CapabilityID; - USHORT Version:4; - USHORT Next:12; - -} PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER, *PPCI_EXPRESS_ENHANCED_CAPABILITY_HEADER; - -// -// Serial Number Capability. -// - -typedef struct _PCI_EXPRESS_SERIAL_NUMBER_CAPABILITY { - - PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; - - ULONG LowSerialNumber; - ULONG HighSerialNumber; - -} PCI_EXPRESS_SERIAL_NUMBER_CAPABILITY, *PPCI_EXPRESS_SERIAL_NUMBER_CAPABILITY; - -// -// PCI Express Advanced Error Reporting structures. -// - -typedef union _PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS { - - struct { - ULONG Undefined:1; - ULONG Reserved1:3; - ULONG DataLinkProtocolError:1; - ULONG SurpriseDownError:1; - ULONG Reserved2:6; - ULONG PoisonedTLP:1; - ULONG FlowControlProtocolError:1; - ULONG CompletionTimeout:1; - ULONG CompleterAbort:1; - ULONG UnexpectedCompletion:1; - ULONG ReceiverOverflow:1; - ULONG MalformedTLP:1; - ULONG ECRCError:1; - ULONG UnsupportedRequestError:1; - ULONG Reserved3:11; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS, *PPCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS; - -typedef union _PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK { - - struct { - ULONG Undefined:1; - ULONG Reserved1:3; - ULONG DataLinkProtocolError:1; - ULONG SurpriseDownError:1; - ULONG Reserved2:6; - ULONG PoisonedTLP:1; - ULONG FlowControlProtocolError:1; - ULONG CompletionTimeout:1; - ULONG CompleterAbort:1; - ULONG UnexpectedCompletion:1; - ULONG ReceiverOverflow:1; - ULONG MalformedTLP:1; - ULONG ECRCError:1; - ULONG UnsupportedRequestError:1; - ULONG Reserved3:11; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK, *PPCI_EXPRESS_UNCORRECTABLE_ERROR_MASK; - -typedef union _PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY { - - struct { - ULONG Undefined:1; - ULONG Reserved1:3; - ULONG DataLinkProtocolError:1; - ULONG SurpriseDownError:1; - ULONG Reserved2:6; - ULONG PoisonedTLP:1; - ULONG FlowControlProtocolError:1; - ULONG CompletionTimeout:1; - ULONG CompleterAbort:1; - ULONG UnexpectedCompletion:1; - ULONG ReceiverOverflow:1; - ULONG MalformedTLP:1; - ULONG ECRCError:1; - ULONG UnsupportedRequestError:1; - ULONG Reserved3:11; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY, *PPCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY; - -typedef union _PCI_EXPRESS_CORRECTABLE_ERROR_STATUS { - - struct { - ULONG ReceiverError:1; - ULONG Reserved1:5; - ULONG BadTLP:1; - ULONG BadDLLP:1; - ULONG ReplayNumRollover:1; - ULONG Reserved2:3; - ULONG ReplayTimerTimeout:1; - ULONG AdvisoryNonFatalError:1; - ULONG Reserved3:18; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_CORRECTABLE_ERROR_STATUS, *PPCI_CORRECTABLE_ERROR_STATUS; - -typedef union _PCI_EXPRESS_CORRECTABLE_ERROR_MASK { - - struct { - ULONG ReceiverError:1; - ULONG Reserved1:5; - ULONG BadTLP:1; - ULONG BadDLLP:1; - ULONG ReplayNumRollover:1; - ULONG Reserved2:3; - ULONG ReplayTimerTimeout:1; - ULONG AdvisoryNonFatalError:1; - ULONG Reserved3:18; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_CORRECTABLE_ERROR_MASK, *PPCI_CORRECTABLE_ERROR_MASK; - -typedef union _PCI_EXPRESS_AER_CAPABILITIES { - - struct { - ULONG FirstErrorPointer:5; - ULONG ECRCGenerationCapable:1; - ULONG ECRCGenerationEnable:1; - ULONG ECRCCheckCapable:1; - ULONG ECRCCheckEnable:1; - ULONG Reserved:23; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_AER_CAPABILITIES, *PPCI_EXPRESS_AER_CAPABILITIES; - -typedef union _PCI_EXPRESS_ROOT_ERROR_COMMAND { - - struct { - ULONG CorrectableErrorReportingEnable:1; - ULONG NonFatalErrorReportingEnable:1; - ULONG FatalErrorReportingEnable:1; - ULONG Reserved:29; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_ROOT_ERROR_COMMAND, *PPCI_EXPRESS_ROOT_ERROR_COMMAND; - -typedef union _PCI_EXPRESS_ROOT_ERROR_STATUS { - - struct { - ULONG CorrectableErrorReceived:1; - ULONG MultipleCorrectableErrorsReceived:1; - ULONG UncorrectableErrorReceived:1; - ULONG MultipleUncorrectableErrorsReceived:1; - ULONG FirstUncorrectableFatal:1; - ULONG NonFatalErrorMessagesReceived:1; - ULONG FatalErrorMessagesReceived:1; - ULONG Reserved:20; - ULONG AdvancedErrorInterruptMessageNumber:5; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_ROOT_ERROR_STATUS, *PPCI_EXPRESS_ROOT_ERROR_STATUS; - -typedef union _PCI_EXPRESS_ERROR_SOURCE_ID { - - struct { - USHORT CorrectableSourceIdFun:3; - USHORT CorrectableSourceIdDev:5; - USHORT CorrectableSourceIdBus:8; - USHORT UncorrectableSourceIdFun:3; - USHORT UncorrectableSourceIdDev:5; - USHORT UncorrectableSourceIdBus:8; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_ERROR_SOURCE_ID, *PPCI_EXPRESS_ERROR_SOURCE_ID; - -typedef union _PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS { - - struct { - ULONG TargetAbortOnSplitCompletion:1; - ULONG MasterAbortOnSplitCompletion:1; - ULONG ReceivedTargetAbort:1; - ULONG ReceivedMasterAbort:1; - ULONG RsvdZ:1; - ULONG UnexpectedSplitCompletionError:1; - ULONG UncorrectableSplitCompletion:1; - ULONG UncorrectableDataError:1; - ULONG UncorrectableAttributeError:1; - ULONG UncorrectableAddressError:1; - ULONG DelayedTransactionDiscardTimerExpired:1; - ULONG PERRAsserted:1; - ULONG SERRAsserted:1; - ULONG InternalBridgeError:1; - ULONG Reserved:18; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS, - *PPCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS; - -typedef union _PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK { - - struct { - ULONG TargetAbortOnSplitCompletion:1; - ULONG MasterAbortOnSplitCompletion:1; - ULONG ReceivedTargetAbort:1; - ULONG ReceivedMasterAbort:1; - ULONG RsvdZ:1; - ULONG UnexpectedSplitCompletionError:1; - ULONG UncorrectableSplitCompletion:1; - ULONG UncorrectableDataError:1; - ULONG UncorrectableAttributeError:1; - ULONG UncorrectableAddressError:1; - ULONG DelayedTransactionDiscardTimerExpired:1; - ULONG PERRAsserted:1; - ULONG SERRAsserted:1; - ULONG InternalBridgeError:1; - ULONG Reserved:18; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK, - *PPCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK; - -typedef union _PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY { - - struct { - ULONG TargetAbortOnSplitCompletion:1; - ULONG MasterAbortOnSplitCompletion:1; - ULONG ReceivedTargetAbort:1; - ULONG ReceivedMasterAbort:1; - ULONG RsvdZ:1; - ULONG UnexpectedSplitCompletionError:1; - ULONG UncorrectableSplitCompletion:1; - ULONG UncorrectableDataError:1; - ULONG UncorrectableAttributeError:1; - ULONG UncorrectableAddressError:1; - ULONG DelayedTransactionDiscardTimerExpired:1; - ULONG PERRAsserted:1; - ULONG SERRAsserted:1; - ULONG InternalBridgeError:1; - ULONG Reserved:18; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY, - *PPCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY; - -typedef union _PCI_EXPRESS_SEC_AER_CAPABILITIES { - - struct { - ULONG SecondaryUncorrectableFirstErrorPtr:5; - ULONG Reserved:27; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SEC_AER_CAPABILITIES, *PPCI_EXPRESS_SEC_AER_CAPABILITIES; - -#define ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING 0x00000001 -#define ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING 0x00000002 -#define ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING 0x00000004 - -#define ROOT_CMD_ERROR_REPORTING_ENABLE_MASK \ - (ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING | \ - ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING | \ - ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING) - -// -// Advanced Error Reporting Capability structure. -// - -typedef struct _PCI_EXPRESS_AER_CAPABILITY { - - PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; - - PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS UncorrectableErrorStatus; - PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK UncorrectableErrorMask; - PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY UncorrectableErrorSeverity; - PCI_EXPRESS_CORRECTABLE_ERROR_STATUS CorrectableErrorStatus; - PCI_EXPRESS_CORRECTABLE_ERROR_MASK CorrectableErrorMask; - PCI_EXPRESS_AER_CAPABILITIES CapabilitiesAndControl; - ULONG HeaderLog[4]; - PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS SecUncorrectableErrorStatus; - PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK SecUncorrectableErrorMask; - PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY SecUncorrectableErrorSeverity; - PCI_EXPRESS_SEC_AER_CAPABILITIES SecCapabilitiesAndControl; - ULONG SecHeaderLog[4]; - -} PCI_EXPRESS_AER_CAPABILITY, *PPCI_EXPRESS_AER_CAPABILITY; - -// -// Advanced Error Reporting Capability structure for root port. -// - -typedef struct _PCI_EXPRESS_ROOTPORT_AER_CAPABILITY { - - PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; - - PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS UncorrectableErrorStatus; - PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK UncorrectableErrorMask; - PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY UncorrectableErrorSeverity; - PCI_EXPRESS_CORRECTABLE_ERROR_STATUS CorrectableErrorStatus; - PCI_EXPRESS_CORRECTABLE_ERROR_MASK CorrectableErrorMask; - PCI_EXPRESS_AER_CAPABILITIES CapabilitiesAndControl; - ULONG HeaderLog[4]; - PCI_EXPRESS_ROOT_ERROR_COMMAND RootErrorCommand; - PCI_EXPRESS_ROOT_ERROR_STATUS RootErrorStatus; - PCI_EXPRESS_ERROR_SOURCE_ID ErrorSourceId; - -} PCI_EXPRESS_ROOTPORT_AER_CAPABILITY, *PPCI_EXPRESS_ROOTPORT_AER_CAPABILITY; - -// -// Advanced Error Reporting Capability structure for root port. -// - -typedef struct _PCI_EXPRESS_BRIDGE_AER_CAPABILITY { - - PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; - - PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS UncorrectableErrorStatus; - PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK UncorrectableErrorMask; - PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY UncorrectableErrorSeverity; - PCI_EXPRESS_CORRECTABLE_ERROR_STATUS CorrectableErrorStatus; - PCI_EXPRESS_CORRECTABLE_ERROR_MASK CorrectableErrorMask; - PCI_EXPRESS_AER_CAPABILITIES CapabilitiesAndControl; - ULONG HeaderLog[4]; - PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS SecUncorrectableErrorStatus; - PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK SecUncorrectableErrorMask; - PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY SecUncorrectableErrorSeverity; - PCI_EXPRESS_SEC_AER_CAPABILITIES SecCapabilitiesAndControl; - ULONG SecHeaderLog[4]; - -} PCI_EXPRESS_BRIDGE_AER_CAPABILITY, *PPCI_EXPRESS_BRIDGE_AER_CAPABILITY; - -// -// Single-Root I/O Virtualization Capability structure for endpoints -// - -typedef union _PCI_EXPRESS_SRIOV_CAPS { - - struct { - ULONG VFMigrationCapable:1; - ULONG Reserved1:20; - ULONG VFMigrationInterruptNumber:11; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SRIOV_CAPS, *PPCI_EXPRESS_SRIOV_CAPS; - -typedef union _PCI_EXPRESS_SRIOV_CONTROL { - - struct { - USHORT VFEnable:1; - USHORT VFMigrationEnable:1; - USHORT VFMigrationInterruptEnable:1; - USHORT VFMemorySpaceEnable:1; - USHORT ARICapableHierarchy:1; - USHORT Reserved1:11; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_SRIOV_CONTROL, *PPCI_EXPRESS_SRIOV_CONTROL; - -typedef union _PCI_EXPRESS_SRIOV_STATUS { - - struct { - USHORT VFMigrationStatus:1; - USHORT Reserved1:15; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_SRIOV_STATUS, *PPCI_EXPRESS_SRIOV_STATUS; - -typedef union _PCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY { - - struct { - ULONG VFMigrationStateBIR:3; - ULONG VFMigrationStateOffset:29; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY, *PPCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY; - -typedef struct _PCI_EXPRESS_SRIOV_CAPABILITY { - - PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; - - PCI_EXPRESS_SRIOV_CAPS SRIOVCapabilities; - PCI_EXPRESS_SRIOV_CONTROL SRIOVControl; - PCI_EXPRESS_SRIOV_STATUS SRIOVStatus; - USHORT InitialVFs; - USHORT TotalVFs; - USHORT NumVFs; - UCHAR FunctionDependencyLink; - UCHAR RsvdP1; - USHORT FirstVFOffset; - USHORT VFStride; - USHORT RsvdP2; - USHORT VFDeviceId; - ULONG SupportedPageSizes; - ULONG SystemPageSize; - ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; - PCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY VFMigrationStateArrayOffset; - -} PCI_EXPRESS_SRIOV_CAPABILITY, *PPCI_EXPRESS_SRIOV_CAPABILITY; - -// -// Base Class Code encodings for Base Class (from PCI spec rev 2.1). -// - -#define PCI_CLASS_PRE_20 0x00 -#define PCI_CLASS_MASS_STORAGE_CTLR 0x01 -#define PCI_CLASS_NETWORK_CTLR 0x02 -#define PCI_CLASS_DISPLAY_CTLR 0x03 -#define PCI_CLASS_MULTIMEDIA_DEV 0x04 -#define PCI_CLASS_MEMORY_CTLR 0x05 -#define PCI_CLASS_BRIDGE_DEV 0x06 -#define PCI_CLASS_SIMPLE_COMMS_CTLR 0x07 -#define PCI_CLASS_BASE_SYSTEM_DEV 0x08 -#define PCI_CLASS_INPUT_DEV 0x09 -#define PCI_CLASS_DOCKING_STATION 0x0a -#define PCI_CLASS_PROCESSOR 0x0b -#define PCI_CLASS_SERIAL_BUS_CTLR 0x0c -#define PCI_CLASS_WIRELESS_CTLR 0x0d -#define PCI_CLASS_INTELLIGENT_IO_CTLR 0x0e -#define PCI_CLASS_SATELLITE_COMMS_CTLR 0x0f -#define PCI_CLASS_ENCRYPTION_DECRYPTION 0x10 -#define PCI_CLASS_DATA_ACQ_SIGNAL_PROC 0x11 - -// 0d thru fe reserved - -#define PCI_CLASS_NOT_DEFINED 0xff - -// -// Sub Class Code encodings (PCI rev 2.1). -// - -// Class 00 - PCI_CLASS_PRE_20 - -#define PCI_SUBCLASS_PRE_20_NON_VGA 0x00 -#define PCI_SUBCLASS_PRE_20_VGA 0x01 - -// Class 01 - PCI_CLASS_MASS_STORAGE_CTLR - -#define PCI_SUBCLASS_MSC_SCSI_BUS_CTLR 0x00 -#define PCI_SUBCLASS_MSC_IDE_CTLR 0x01 -#define PCI_SUBCLASS_MSC_FLOPPY_CTLR 0x02 -#define PCI_SUBCLASS_MSC_IPI_CTLR 0x03 -#define PCI_SUBCLASS_MSC_RAID_CTLR 0x04 -#define PCI_SUBCLASS_MSC_OTHER 0x80 - -// Class 02 - PCI_CLASS_NETWORK_CTLR - -#define PCI_SUBCLASS_NET_ETHERNET_CTLR 0x00 -#define PCI_SUBCLASS_NET_TOKEN_RING_CTLR 0x01 -#define PCI_SUBCLASS_NET_FDDI_CTLR 0x02 -#define PCI_SUBCLASS_NET_ATM_CTLR 0x03 -#define PCI_SUBCLASS_NET_ISDN_CTLR 0x04 -#define PCI_SUBCLASS_NET_OTHER 0x80 - -// Class 03 - PCI_CLASS_DISPLAY_CTLR - -// N.B. Sub Class 00 could be VGA or 8514 depending on Interface byte - -#define PCI_SUBCLASS_VID_VGA_CTLR 0x00 -#define PCI_SUBCLASS_VID_XGA_CTLR 0x01 -#define PCI_SUBLCASS_VID_3D_CTLR 0x02 -#define PCI_SUBCLASS_VID_OTHER 0x80 - -// Class 04 - PCI_CLASS_MULTIMEDIA_DEV - -#define PCI_SUBCLASS_MM_VIDEO_DEV 0x00 -#define PCI_SUBCLASS_MM_AUDIO_DEV 0x01 -#define PCI_SUBCLASS_MM_TELEPHONY_DEV 0x02 -#define PCI_SUBCLASS_MM_OTHER 0x80 - -// Class 05 - PCI_CLASS_MEMORY_CTLR - -#define PCI_SUBCLASS_MEM_RAM 0x00 -#define PCI_SUBCLASS_MEM_FLASH 0x01 -#define PCI_SUBCLASS_MEM_OTHER 0x80 - -// Class 06 - PCI_CLASS_BRIDGE_DEV - -#define PCI_SUBCLASS_BR_HOST 0x00 -#define PCI_SUBCLASS_BR_ISA 0x01 -#define PCI_SUBCLASS_BR_EISA 0x02 -#define PCI_SUBCLASS_BR_MCA 0x03 -#define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04 -#define PCI_SUBCLASS_BR_PCMCIA 0x05 -#define PCI_SUBCLASS_BR_NUBUS 0x06 -#define PCI_SUBCLASS_BR_CARDBUS 0x07 -#define PCI_SUBCLASS_BR_RACEWAY 0x08 -#define PCI_SUBCLASS_BR_OTHER 0x80 - -// Class 07 - PCI_CLASS_SIMPLE_COMMS_CTLR - -// N.B. Sub Class 00 and 01 additional info in Interface byte - -#define PCI_SUBCLASS_COM_SERIAL 0x00 -#define PCI_SUBCLASS_COM_PARALLEL 0x01 -#define PCI_SUBCLASS_COM_MULTIPORT 0x02 -#define PCI_SUBCLASS_COM_MODEM 0x03 -#define PCI_SUBCLASS_COM_OTHER 0x80 - -// Class 08 - PCI_CLASS_BASE_SYSTEM_DEV - -// N.B. See Interface byte for additional info. - -#define PCI_SUBCLASS_SYS_INTERRUPT_CTLR 0x00 -#define PCI_SUBCLASS_SYS_DMA_CTLR 0x01 -#define PCI_SUBCLASS_SYS_SYSTEM_TIMER 0x02 -#define PCI_SUBCLASS_SYS_REAL_TIME_CLOCK 0x03 -#define PCI_SUBCLASS_SYS_GEN_HOTPLUG_CTLR 0x04 -#define PCI_SUBCLASS_SYS_SDIO_CTRL 0x05 -#define PCI_SUBCLASS_SYS_OTHER 0x80 - -// Class 09 - PCI_CLASS_INPUT_DEV - -#define PCI_SUBCLASS_INP_KEYBOARD 0x00 -#define PCI_SUBCLASS_INP_DIGITIZER 0x01 -#define PCI_SUBCLASS_INP_MOUSE 0x02 -#define PCI_SUBCLASS_INP_SCANNER 0x03 -#define PCI_SUBCLASS_INP_GAMEPORT 0x04 -#define PCI_SUBCLASS_INP_OTHER 0x80 - -// Class 0a - PCI_CLASS_DOCKING_STATION - -#define PCI_SUBCLASS_DOC_GENERIC 0x00 -#define PCI_SUBCLASS_DOC_OTHER 0x80 - -// Class 0b - PCI_CLASS_PROCESSOR - -#define PCI_SUBCLASS_PROC_386 0x00 -#define PCI_SUBCLASS_PROC_486 0x01 -#define PCI_SUBCLASS_PROC_PENTIUM 0x02 -#define PCI_SUBCLASS_PROC_ALPHA 0x10 -#define PCI_SUBCLASS_PROC_POWERPC 0x20 -#define PCI_SUBCLASS_PROC_COPROCESSOR 0x40 - -// Class 0c - PCI_CLASS_SERIAL_BUS_CTLR - -#define PCI_SUBCLASS_SB_IEEE1394 0x00 -#define PCI_SUBCLASS_SB_ACCESS 0x01 -#define PCI_SUBCLASS_SB_SSA 0x02 -#define PCI_SUBCLASS_SB_USB 0x03 -#define PCI_SUBCLASS_SB_FIBRE_CHANNEL 0x04 -#define PCI_SUBCLASS_SB_SMBUS 0x05 - -// Class 0d - PCI_CLASS_WIRELESS_CTLR - -#define PCI_SUBCLASS_WIRELESS_IRDA 0x00 -#define PCI_SUBCLASS_WIRELESS_CON_IR 0x01 -#define PCI_SUBCLASS_WIRELESS_RF 0x10 -#define PCI_SUBCLASS_WIRELESS_OTHER 0x80 - -// Class 0e - PCI_CLASS_INTELLIGENT_IO_CTLR - -#define PCI_SUBCLASS_INTIO_I2O 0x00 - -// Class 0f - PCI_CLASS_SATELLITE_CTLR - -#define PCI_SUBCLASS_SAT_TV 0x01 -#define PCI_SUBCLASS_SAT_AUDIO 0x02 -#define PCI_SUBCLASS_SAT_VOICE 0x03 -#define PCI_SUBCLASS_SAT_DATA 0x04 - -// Class 10 - PCI_CLASS_ENCRYPTION_DECRYPTION - -#define PCI_SUBCLASS_CRYPTO_NET_COMP 0x00 -#define PCI_SUBCLASS_CRYPTO_ENTERTAINMENT 0x10 -#define PCI_SUBCLASS_CRYPTO_OTHER 0x80 - -// Class 11 - PCI_CLASS_DATA_ACQ_SIGNAL_PROC - -#define PCI_SUBCLASS_DASP_DPIO 0x00 -#define PCI_SUBCLASS_DASP_OTHER 0x80 - -// end_ntndis - -// -// Bit encodes for PCI_COMMON_CONFIG.u.type0.BaseAddresses -// - -#define PCI_ADDRESS_IO_SPACE 0x00000001 // (ro) -#define PCI_ADDRESS_MEMORY_TYPE_MASK 0x00000006 // (ro) -#define PCI_ADDRESS_MEMORY_PREFETCHABLE 0x00000008 // (ro) - -#define PCI_ADDRESS_IO_ADDRESS_MASK 0xfffffffc -#define PCI_ADDRESS_MEMORY_ADDRESS_MASK 0xfffffff0 -#define PCI_ADDRESS_ROM_ADDRESS_MASK 0xfffff800 - -#define PCI_TYPE_32BIT 0 -#define PCI_TYPE_20BIT 2 -#define PCI_TYPE_64BIT 4 - -// -// Bit encodes for PCI_COMMON_CONFIG.u.type0.ROMBaseAddresses -// - -#define PCI_ROMADDRESS_ENABLED 0x00000001 - - -// -// Reference notes for PCI configuration fields: -// -// ro these field are read only. changes to these fields are ignored -// -// ro+ these field are intended to be read only and should be initialized -// by the system to their proper values. However, driver may change -// these settings. -// -// --- -// -// All resources comsumed by a PCI device start as unitialized -// under NT. An uninitialized memory or I/O base address can be -// determined by checking it's corrisponding enabled bit in the -// PCI_COMMON_CONFIG.Command value. An InterruptLine is unitialized -// if it contains the value of -1. -// - - -typedef ULONG NODE_REQUIREMENT; - -#define MM_ANY_NODE_OK 0x80000000 - - -// -// Graphics support routines. -// - -typedef -VOID -(*PBANKED_SECTION_ROUTINE) ( - __in ULONG ReadBank, - __in ULONG WriteBank, - __in PVOID Context - ); - -// -// WMI minor function codes under IRP_MJ_SYSTEM_CONTROL -// - -#define IRP_MN_QUERY_ALL_DATA 0x00 -#define IRP_MN_QUERY_SINGLE_INSTANCE 0x01 -#define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02 -#define IRP_MN_CHANGE_SINGLE_ITEM 0x03 -#define IRP_MN_ENABLE_EVENTS 0x04 -#define IRP_MN_DISABLE_EVENTS 0x05 -#define IRP_MN_ENABLE_COLLECTION 0x06 -#define IRP_MN_DISABLE_COLLECTION 0x07 -#define IRP_MN_REGINFO 0x08 -#define IRP_MN_EXECUTE_METHOD 0x09 -// Minor code 0x0a is reserved -#define IRP_MN_REGINFO_EX 0x0b -// Minor code 0x0c is reserved - - -// workaround overloaded definition (rpc generated headers all define INTERFACE -// to match the class name). -#undef INTERFACE - -typedef struct _INTERFACE { - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - // interface specific entries go here -} INTERFACE, *PINTERFACE; - - -// -// Defines the Type in the RESOURCE_DESCRIPTOR -// -// NOTE: For all CM_RESOURCE_TYPE values, there must be a -// corresponding ResType value in the 32-bit ConfigMgr headerfile -// (cfgmgr32.h). Values in the range [0x6,0x80) use the same values -// as their ConfigMgr counterparts. CM_RESOURCE_TYPE values with -// the high bit set (i.e., in the range [0x80,0xFF]), are -// non-arbitrated resources. These correspond to the same values -// in cfgmgr32.h that have their high bit set (however, since -// cfgmgr32.h uses 16 bits for ResType values, these values are in -// the range [0x8000,0x807F). Note that ConfigMgr ResType values -// cannot be in the range [0x8080,0xFFFF), because they would not -// be able to map into CM_RESOURCE_TYPE values. (0xFFFF itself is -// a special value, because it maps to CmResourceTypeDeviceSpecific.) -// - -typedef int CM_RESOURCE_TYPE; - -// CmResourceTypeNull is reserved - -#define CmResourceTypeNull 0 // ResType_All or ResType_None (0x0000) -#define CmResourceTypePort 1 // ResType_IO (0x0002) -#define CmResourceTypeInterrupt 2 // ResType_IRQ (0x0004) -#define CmResourceTypeMemory 3 // ResType_Mem (0x0001) -#define CmResourceTypeDma 4 // ResType_DMA (0x0003) -#define CmResourceTypeDeviceSpecific 5 // ResType_ClassSpecific (0xFFFF) -#define CmResourceTypeBusNumber 6 // ResType_BusNumber (0x0006) -#define CmResourceTypeMemoryLarge 7 // ResType_MemLarge (0x0007) -// end_wdm -// begin_ntddk -#define CmResourceTypeMaximum 8 -// end_ntddk -// begin_wdm -#define CmResourceTypeNonArbitrated 128 // Not arbitrated if 0x80 bit set -#define CmResourceTypeConfigData 128 // ResType_Reserved (0x8000) -#define CmResourceTypeDevicePrivate 129 // ResType_DevicePrivate (0x8001) -#define CmResourceTypePcCardConfig 130 // ResType_PcCardConfig (0x8002) -#define CmResourceTypeMfCardConfig 131 // ResType_MfCardConfig (0x8003) - -// -// Defines the ShareDisposition in the RESOURCE_DESCRIPTOR -// - -typedef enum _CM_SHARE_DISPOSITION { - CmResourceShareUndetermined = 0, // Reserved - CmResourceShareDeviceExclusive, - CmResourceShareDriverExclusive, - CmResourceShareShared -} CM_SHARE_DISPOSITION; - -// -// Define the bit masks for Flags when type is CmResourceTypeInterrupt -// - -#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0 -#define CM_RESOURCE_INTERRUPT_LATCHED 1 -#define CM_RESOURCE_INTERRUPT_MESSAGE 2 -#define CM_RESOURCE_INTERRUPT_POLICY_INCLUDED 4 -// end_wdm -#define CM_RESOURCE_INTERRUPT_ALLOW_RESERVED_IDT 8 -// begin_wdm - -// -// A bitmask defining the bits in a resource or requirements descriptor -// flags field that corresponds to the latch mode or a level triggered -// interrupt. -// - -#define CM_RESOURCE_INTERRUPT_LEVEL_LATCHED_BITS 0x0001 - -// -// Define the token value used for an interrupt vector to mean that the vector -// is message signaled. This value is used in the MaximumVector field. -// - -#define CM_RESOURCE_INTERRUPT_MESSAGE_TOKEN ((ULONG)-2) - -// -// Define the bit masks for Flags when type is CmResourceTypeMemory -// or CmResourceTypeMemoryLarge -// - -#define CM_RESOURCE_MEMORY_READ_WRITE 0x0000 -#define CM_RESOURCE_MEMORY_READ_ONLY 0x0001 -#define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002 -#define CM_RESOURCE_MEMORY_WRITEABILITY_MASK 0x0003 -#define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004 - -#define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008 -#define CM_RESOURCE_MEMORY_24 0x0010 -#define CM_RESOURCE_MEMORY_CACHEABLE 0x0020 -#define CM_RESOURCE_MEMORY_WINDOW_DECODE 0x0040 -#define CM_RESOURCE_MEMORY_BAR 0x0080 - -#define CM_RESOURCE_MEMORY_COMPAT_FOR_INACCESSIBLE_RANGE 0x0100 - -// -// Define the bit masks exclusive to type CmResourceTypeMemoryLarge. -// - -#define CM_RESOURCE_MEMORY_LARGE 0x0E00 -#define CM_RESOURCE_MEMORY_LARGE_40 0x0200 -#define CM_RESOURCE_MEMORY_LARGE_48 0x0400 -#define CM_RESOURCE_MEMORY_LARGE_64 0x0800 - -// -// Define limits for large memory resources -// - -#define CM_RESOURCE_MEMORY_LARGE_40_MAXLEN 0x000000FFFFFFFF00 -#define CM_RESOURCE_MEMORY_LARGE_48_MAXLEN 0x0000FFFFFFFF0000 -#define CM_RESOURCE_MEMORY_LARGE_64_MAXLEN 0xFFFFFFFF00000000 - -// -// Define the bit masks for Flags when type is CmResourceTypePort -// - -#define CM_RESOURCE_PORT_MEMORY 0x0000 -#define CM_RESOURCE_PORT_IO 0x0001 -#define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004 -#define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008 -#define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010 -#define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020 -#define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040 -#define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080 -#define CM_RESOURCE_PORT_BAR 0x0100 - -// -// Define the bit masks for Flags when type is CmResourceTypeDma -// - -#define CM_RESOURCE_DMA_8 0x0000 -#define CM_RESOURCE_DMA_16 0x0001 -#define CM_RESOURCE_DMA_32 0x0002 -#define CM_RESOURCE_DMA_8_AND_16 0x0004 -#define CM_RESOURCE_DMA_BUS_MASTER 0x0008 -#define CM_RESOURCE_DMA_TYPE_A 0x0010 -#define CM_RESOURCE_DMA_TYPE_B 0x0020 -#define CM_RESOURCE_DMA_TYPE_F 0x0040 - - -#include "pshpack1.h" - - -// -// Define Mca POS data block for slot -// - -typedef struct _CM_MCA_POS_DATA { - USHORT AdapterId; - UCHAR PosData1; - UCHAR PosData2; - UCHAR PosData3; - UCHAR PosData4; -} CM_MCA_POS_DATA, *PCM_MCA_POS_DATA; - -// -// Memory configuration of eisa data block structure -// - -typedef struct _EISA_MEMORY_TYPE { - UCHAR ReadWrite: 1; - UCHAR Cached : 1; - UCHAR Reserved0 :1; - UCHAR Type:2; - UCHAR Shared:1; - UCHAR Reserved1 :1; - UCHAR MoreEntries : 1; -} EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE; - -typedef struct _EISA_MEMORY_CONFIGURATION { - EISA_MEMORY_TYPE ConfigurationByte; - UCHAR DataSize; - USHORT AddressLowWord; - UCHAR AddressHighByte; - USHORT MemorySize; -} EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION; - - -// -// Interrupt configurationn of eisa data block structure -// - -typedef struct _EISA_IRQ_DESCRIPTOR { - UCHAR Interrupt : 4; - UCHAR Reserved :1; - UCHAR LevelTriggered :1; - UCHAR Shared : 1; - UCHAR MoreEntries : 1; -} EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR; - -typedef struct _EISA_IRQ_CONFIGURATION { - EISA_IRQ_DESCRIPTOR ConfigurationByte; - UCHAR Reserved; -} EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION; - - -// -// DMA description of eisa data block structure -// - -typedef struct _DMA_CONFIGURATION_BYTE0 { - UCHAR Channel : 3; - UCHAR Reserved : 3; - UCHAR Shared :1; - UCHAR MoreEntries :1; -} DMA_CONFIGURATION_BYTE0; - -typedef struct _DMA_CONFIGURATION_BYTE1 { - UCHAR Reserved0 : 2; - UCHAR TransferSize : 2; - UCHAR Timing : 2; - UCHAR Reserved1 : 2; -} DMA_CONFIGURATION_BYTE1; - -typedef struct _EISA_DMA_CONFIGURATION { - DMA_CONFIGURATION_BYTE0 ConfigurationByte0; - DMA_CONFIGURATION_BYTE1 ConfigurationByte1; -} EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION; - - -// -// Port description of eisa data block structure -// - -typedef struct _EISA_PORT_DESCRIPTOR { - UCHAR NumberPorts : 5; - UCHAR Reserved :1; - UCHAR Shared :1; - UCHAR MoreEntries : 1; -} EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR; - -typedef struct _EISA_PORT_CONFIGURATION { - EISA_PORT_DESCRIPTOR Configuration; - USHORT PortAddress; -} EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION; - - -// -// Eisa slot information definition -// N.B. This structure is different from the one defined -// in ARC eisa addendum. -// - -typedef struct _CM_EISA_SLOT_INFORMATION { - UCHAR ReturnCode; - UCHAR ReturnFlags; - UCHAR MajorRevision; - UCHAR MinorRevision; - USHORT Checksum; - UCHAR NumberFunctions; - UCHAR FunctionInformation; - ULONG CompressedId; -} CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION; - - -// -// Eisa function information definition -// - -typedef struct _CM_EISA_FUNCTION_INFORMATION { - ULONG CompressedId; - UCHAR IdSlotFlags1; - UCHAR IdSlotFlags2; - UCHAR MinorRevision; - UCHAR MajorRevision; - UCHAR Selections[26]; - UCHAR FunctionFlags; - UCHAR TypeString[80]; - EISA_MEMORY_CONFIGURATION EisaMemory[9]; - EISA_IRQ_CONFIGURATION EisaIrq[7]; - EISA_DMA_CONFIGURATION EisaDma[4]; - EISA_PORT_CONFIGURATION EisaPort[20]; - UCHAR InitializationData[60]; -} CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION; - -// -// The following defines the way pnp bios information is stored in -// the registry \\HKEY_LOCAL_MACHINE\HARDWARE\Description\System\MultifunctionAdapter\x -// key, where x is an integer number indicating adapter instance. The -// "Identifier" of the key must equal to "PNP BIOS" and the -// "ConfigurationData" is organized as follow: -// -// CM_PNP_BIOS_INSTALLATION_CHECK + -// CM_PNP_BIOS_DEVICE_NODE for device 1 + -// CM_PNP_BIOS_DEVICE_NODE for device 2 + -// ... -// CM_PNP_BIOS_DEVICE_NODE for device n -// - -// -// Pnp BIOS device node structure -// - -typedef struct _CM_PNP_BIOS_DEVICE_NODE { - USHORT Size; - UCHAR Node; - ULONG ProductId; - UCHAR DeviceType[3]; - USHORT DeviceAttributes; - // followed by AllocatedResourceBlock, PossibleResourceBlock - // and CompatibleDeviceId -} CM_PNP_BIOS_DEVICE_NODE,*PCM_PNP_BIOS_DEVICE_NODE; - -// -// Pnp BIOS Installation check -// - -typedef struct _CM_PNP_BIOS_INSTALLATION_CHECK { - UCHAR Signature[4]; // $PnP (ascii) - UCHAR Revision; - UCHAR Length; - USHORT ControlField; - UCHAR Checksum; - ULONG EventFlagAddress; // Physical address - USHORT RealModeEntryOffset; - USHORT RealModeEntrySegment; - USHORT ProtectedModeEntryOffset; - ULONG ProtectedModeCodeBaseAddress; - ULONG OemDeviceId; - USHORT RealModeDataBaseAddress; - ULONG ProtectedModeDataBaseAddress; -} CM_PNP_BIOS_INSTALLATION_CHECK, *PCM_PNP_BIOS_INSTALLATION_CHECK; - -#include "poppack.h" - -// -// Masks for EISA function information -// - -#define EISA_FUNCTION_ENABLED 0x80 -#define EISA_FREE_FORM_DATA 0x40 -#define EISA_HAS_PORT_INIT_ENTRY 0x20 -#define EISA_HAS_PORT_RANGE 0x10 -#define EISA_HAS_DMA_ENTRY 0x08 -#define EISA_HAS_IRQ_ENTRY 0x04 -#define EISA_HAS_MEMORY_ENTRY 0x02 -#define EISA_HAS_TYPE_ENTRY 0x01 -#define EISA_HAS_INFORMATION EISA_HAS_PORT_RANGE + \ - EISA_HAS_DMA_ENTRY + \ - EISA_HAS_IRQ_ENTRY + \ - EISA_HAS_MEMORY_ENTRY + \ - EISA_HAS_TYPE_ENTRY - -// -// Masks for EISA memory configuration -// - -#define EISA_MORE_ENTRIES 0x80 -#define EISA_SYSTEM_MEMORY 0x00 -#define EISA_MEMORY_TYPE_RAM 0x01 - -// -// Returned error code for EISA bios call -// - -#define EISA_INVALID_SLOT 0x80 -#define EISA_INVALID_FUNCTION 0x81 -#define EISA_INVALID_CONFIGURATION 0x82 -#define EISA_EMPTY_SLOT 0x83 -#define EISA_INVALID_BIOS_CALL 0x86 - - -// -// Define the bitmasks for resource options -// - -#define IO_RESOURCE_PREFERRED 0x01 -#define IO_RESOURCE_DEFAULT 0x02 -#define IO_RESOURCE_ALTERNATIVE 0x08 - -// -// Define interrupt affinity policy values -// - -#if defined(NT_PROCESSOR_GROUPS) - -typedef USHORT IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY; -typedef enum _IRQ_DEVICE_POLICY_USHORT { - IrqPolicyMachineDefault = 0, - IrqPolicyAllCloseProcessors = 1, - IrqPolicyOneCloseProcessor = 2, - IrqPolicyAllProcessorsInMachine = 3, - IrqPolicyAllProcessorsInGroup = 3, - IrqPolicySpecifiedProcessors = 4, - IrqPolicySpreadMessagesAcrossAllProcessors = 5 -}; - -#else - -typedef enum _IRQ_DEVICE_POLICY { - IrqPolicyMachineDefault = 0, - IrqPolicyAllCloseProcessors, - IrqPolicyOneCloseProcessor, - IrqPolicyAllProcessorsInMachine, - IrqPolicySpecifiedProcessors, - IrqPolicySpreadMessagesAcrossAllProcessors -} IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY; - -#endif - -// -// Define interrupt priority policy values -// - -typedef enum _IRQ_PRIORITY { - IrqPriorityUndefined = 0, - IrqPriorityLow, - IrqPriorityNormal, - IrqPriorityHigh -} IRQ_PRIORITY, *PIRQ_PRIORITY; - -// -// Define interrupt group affinity policy -// - -typedef enum _IRQ_GROUP_POLICY { - GroupAffinityAllGroupZero = 0, - GroupAffinityDontCare -} IRQ_GROUP_POLICY, *PIRQ_GROUP_POLICY; - -// -// This structure defines one type of resource requested by the driver -// - -typedef struct _IO_RESOURCE_DESCRIPTOR { - UCHAR Option; - UCHAR Type; // use CM_RESOURCE_TYPE - UCHAR ShareDisposition; // use CM_SHARE_DISPOSITION - UCHAR Spare1; - USHORT Flags; // use CM resource flag defines - USHORT Spare2; // align - - union { - struct { - ULONG Length; - ULONG Alignment; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Port; - - struct { - ULONG Length; - ULONG Alignment; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Memory; - - struct { - ULONG MinimumVector; - ULONG MaximumVector; -#if defined(NT_PROCESSOR_GROUPS) - IRQ_DEVICE_POLICY AffinityPolicy; - USHORT Group; -#else - IRQ_DEVICE_POLICY AffinityPolicy; -#endif - IRQ_PRIORITY PriorityPolicy; - KAFFINITY TargetedProcessors; - } Interrupt; - - struct { - ULONG MinimumChannel; - ULONG MaximumChannel; - } Dma; - - struct { - ULONG Length; - ULONG Alignment; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Generic; - - struct { - ULONG Data[3]; - } DevicePrivate; - - // - // Bus Number information. - // - - struct { - ULONG Length; - ULONG MinBusNumber; - ULONG MaxBusNumber; - ULONG Reserved; - } BusNumber; - - struct { - ULONG Priority; // use LCPRI_Xxx values in cfg.h - ULONG Reserved1; - ULONG Reserved2; - } ConfigData; - - // - // The following structures provide descriptions - // for memory resource requirement greater than MAXULONG - // - - struct { - ULONG Length40; - ULONG Alignment40; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Memory40; - - struct { - ULONG Length48; - ULONG Alignment48; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Memory48; - - struct { - ULONG Length64; - ULONG Alignment64; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Memory64; - - - } u; - -} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR; - - -#if defined(_MSC_VER) -#if (_MSC_VER >= 1200) -#pragma warning(pop) -#endif -#endif - -#endif /* _MINIPORT_ */ - diff --git a/pub/ddk/minitape.h b/pub/ddk/minitape.h deleted file mode 100644 index bb5d435..0000000 --- a/pub/ddk/minitape.h +++ /dev/null @@ -1,5905 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - minitape.h - -Abstract: - - Type definitions for minitape drivers. - -Revision History: - ---*/ - -#ifndef _MINITAPE_ -#define _MINITAPE_ - -#include "stddef.h" - -#define ASSERT( exp ) - -#if DBG - -#define DebugPrint(x) ScsiDebugPrint x - -#else - -#define DebugPrint(x) - -#endif // DBG - -#if defined(_MSC_VER) && (_MSC_VER >= 800) -#if (_MSC_VER >= 1200) -#pragma warning(push) -#endif -#pragma warning(disable:4200) /* nonstandard extension used : zero-sized array in struct/union */ -#pragma warning(disable:4201) /* nonstandard extension used : Nameless struct/union */ -#pragma warning(disable:4214) /* nonstandard extension used : Bit field types other than int */ -#endif - - -#ifndef IN -#define IN -#endif - -#ifndef OUT -#define OUT -#endif - -#ifndef OPTIONAL -#define OPTIONAL -#endif - -#ifndef NOTHING -#define NOTHING -#endif - -#ifndef CRITICAL -#define CRITICAL -#endif - -#ifndef ANYSIZE_ARRAY -#define ANYSIZE_ARRAY 1 // winnt -#endif - -// begin_winnt - -// -// For compilers that don't support nameless unions/structs -// -#ifndef DUMMYUNIONNAME -#if defined(NONAMELESSUNION) || !defined(_MSC_EXTENSIONS) -#define DUMMYUNIONNAME u -#define DUMMYUNIONNAME2 u2 -#define DUMMYUNIONNAME3 u3 -#define DUMMYUNIONNAME4 u4 -#define DUMMYUNIONNAME5 u5 -#define DUMMYUNIONNAME6 u6 -#define DUMMYUNIONNAME7 u7 -#define DUMMYUNIONNAME8 u8 -#define DUMMYUNIONNAME9 u9 -#else -#define DUMMYUNIONNAME -#define DUMMYUNIONNAME2 -#define DUMMYUNIONNAME3 -#define DUMMYUNIONNAME4 -#define DUMMYUNIONNAME5 -#define DUMMYUNIONNAME6 -#define DUMMYUNIONNAME7 -#define DUMMYUNIONNAME8 -#define DUMMYUNIONNAME9 -#endif -#endif // DUMMYUNIONNAME - -#ifndef DUMMYSTRUCTNAME -#if defined(NONAMELESSUNION) || !defined(_MSC_EXTENSIONS) -#define DUMMYSTRUCTNAME s -#define DUMMYSTRUCTNAME2 s2 -#define DUMMYSTRUCTNAME3 s3 -#define DUMMYSTRUCTNAME4 s4 -#define DUMMYSTRUCTNAME5 s5 -#else -#define DUMMYSTRUCTNAME -#define DUMMYSTRUCTNAME2 -#define DUMMYSTRUCTNAME3 -#define DUMMYSTRUCTNAME4 -#define DUMMYSTRUCTNAME5 -#endif -#endif // DUMMYSTRUCTNAME - -#include -#include - -#if defined(STRICT_GS_ENABLED) -#pragma strict_gs_check(push, on) -#endif - -#if defined(_M_MRX000) && !(defined(MIDL_PASS) || defined(RC_INVOKED)) && defined(ENABLE_RESTRICTED) -#define RESTRICTED_POINTER __restrict -#else -#define RESTRICTED_POINTER -#endif - -#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64) -#define ALIGNMENT_MACHINE -#define UNALIGNED __unaligned -#if defined(_WIN64) -#define UNALIGNED64 __unaligned -#else -#define UNALIGNED64 -#endif -#else -#undef ALIGNMENT_MACHINE -#define UNALIGNED -#define UNALIGNED64 -#endif - - -#if defined(_WIN64) || defined(_M_ALPHA) -#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG) -#define MEMORY_ALLOCATION_ALIGNMENT 16 -#else -#define MAX_NATURAL_ALIGNMENT sizeof(ULONG) -#define MEMORY_ALLOCATION_ALIGNMENT 8 -#endif - -// -// TYPE_ALIGNMENT will return the alignment requirements of a given type for -// the current platform. -// - -#ifdef __cplusplus -#if _MSC_VER >= 1300 -#define TYPE_ALIGNMENT( t ) __alignof(t) -#endif -#else -#define TYPE_ALIGNMENT( t ) \ - FIELD_OFFSET( struct { char x; t test; }, test ) -#endif - -#if defined(_WIN64) - -#if defined(_AMD64_) -#define PROBE_ALIGNMENT( _s ) TYPE_ALIGNMENT( ULONG ) -#elif defined(_IA64_) -#define PROBE_ALIGNMENT( _s ) (TYPE_ALIGNMENT( _s ) > TYPE_ALIGNMENT( ULONG ) ? \ - TYPE_ALIGNMENT( _s ) : TYPE_ALIGNMENT( ULONG )) -#else -#error "No Target Architecture" -#endif - -#define PROBE_ALIGNMENT32( _s ) TYPE_ALIGNMENT( ULONG ) - -#else - -#define PROBE_ALIGNMENT( _s ) TYPE_ALIGNMENT( ULONG ) - -#endif - -// -// C_ASSERT() can be used to perform many compile-time assertions: -// type sizes, field offsets, etc. -// -// An assertion failure results in error C2118: negative subscript. -// - -#ifndef SORTPP_PASS -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#else -#define C_ASSERT(e) /* nothing */ -#endif - -#include - -// end_winnt - -#ifndef CONST -#define CONST const -#endif - -// begin_winnt - -#if (defined(_M_IX86) || defined(_M_IA64) || defined(_M_AMD64)) && !defined(MIDL_PASS) -#define DECLSPEC_IMPORT __declspec(dllimport) -#else -#define DECLSPEC_IMPORT -#endif - -#ifndef DECLSPEC_NORETURN -#if (_MSC_VER >= 1200) && !defined(MIDL_PASS) -#define DECLSPEC_NORETURN __declspec(noreturn) -#else -#define DECLSPEC_NORETURN -#endif -#endif - -#ifndef DECLSPEC_NOTHROW -#if (_MSC_VER >= 1200) && !defined(MIDL_PASS) -#define DECLSPEC_NOTHROW __declspec(nothrow) -#else -#define DECLSPEC_NOTHROW -#endif -#endif - -#ifndef DECLSPEC_ALIGN -#if (_MSC_VER >= 1300) && !defined(MIDL_PASS) -#define DECLSPEC_ALIGN(x) __declspec(align(x)) -#else -#define DECLSPEC_ALIGN(x) -#endif -#endif - -#ifndef SYSTEM_CACHE_ALIGNMENT_SIZE -#if defined(_AMD64_) || defined(_X86_) -#define SYSTEM_CACHE_ALIGNMENT_SIZE 64 -#else -#define SYSTEM_CACHE_ALIGNMENT_SIZE 128 -#endif -#endif - -#ifndef DECLSPEC_CACHEALIGN -#define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(SYSTEM_CACHE_ALIGNMENT_SIZE) -#endif - -#ifndef DECLSPEC_UUID -#if (_MSC_VER >= 1100) && defined (__cplusplus) -#define DECLSPEC_UUID(x) __declspec(uuid(x)) -#else -#define DECLSPEC_UUID(x) -#endif -#endif - -#ifndef DECLSPEC_NOVTABLE -#if (_MSC_VER >= 1100) && defined(__cplusplus) -#define DECLSPEC_NOVTABLE __declspec(novtable) -#else -#define DECLSPEC_NOVTABLE -#endif -#endif - -#ifndef DECLSPEC_SELECTANY -#if (_MSC_VER >= 1100) -#define DECLSPEC_SELECTANY __declspec(selectany) -#else -#define DECLSPEC_SELECTANY -#endif -#endif - -#ifndef NOP_FUNCTION -#if (_MSC_VER >= 1210) -#define NOP_FUNCTION __noop -#else -#define NOP_FUNCTION (void)0 -#endif -#endif - -#ifndef DECLSPEC_ADDRSAFE -#if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64)) -#define DECLSPEC_ADDRSAFE __declspec(address_safe) -#else -#define DECLSPEC_ADDRSAFE -#endif -#endif - -#ifndef DECLSPEC_NOINLINE -#if (_MSC_VER >= 1300) -#define DECLSPEC_NOINLINE __declspec(noinline) -#else -#define DECLSPEC_NOINLINE -#endif -#endif - -#ifndef FORCEINLINE -#if (_MSC_VER >= 1200) -#define FORCEINLINE __forceinline -#else -#define FORCEINLINE __inline -#endif -#endif - -#ifndef DECLSPEC_DEPRECATED -#if (_MSC_VER >= 1300) && !defined(MIDL_PASS) -#define DECLSPEC_DEPRECATED __declspec(deprecated) -#define DEPRECATE_SUPPORTED -#else -#define DECLSPEC_DEPRECATED -#undef DEPRECATE_SUPPORTED -#endif -#endif - -#ifdef DEPRECATE_DDK_FUNCTIONS -#ifdef _NTDDK_ -#define DECLSPEC_DEPRECATED_DDK DECLSPEC_DEPRECATED -#ifdef DEPRECATE_SUPPORTED -#define PRAGMA_DEPRECATED_DDK 1 -#endif -#else -#define DECLSPEC_DEPRECATED_DDK -#define PRAGMA_DEPRECATED_DDK 1 -#endif -#else -#define DECLSPEC_DEPRECATED_DDK -#define PRAGMA_DEPRECATED_DDK 0 -#endif - -// -// Void -// - -typedef void *PVOID; -typedef void * POINTER_64 PVOID64; - -// end_winnt - -#ifndef _MANAGED -#if defined(_M_IX86) -#define FASTCALL __fastcall -#else -#define FASTCALL -#endif -#else -#define FASTCALL NTAPI -#endif - - -// -// Basics -// - -#ifndef VOID -#define VOID void -typedef char CHAR; -typedef short SHORT; -typedef long LONG; -#if !defined(MIDL_PASS) -typedef int INT; -#endif -#endif - -// -// UNICODE (Wide Character) types -// - -#ifndef _MAC -typedef wchar_t WCHAR; // wc, 16-bit UNICODE character -#else -// some Macintosh compilers don't define wchar_t in a convenient location, or define it as a char -typedef unsigned short WCHAR; // wc, 16-bit UNICODE character -#endif - -typedef WCHAR *PWCHAR, *LPWCH, *PWCH; -typedef CONST WCHAR *LPCWCH, *PCWCH; - -typedef __nullterminated WCHAR *NWPSTR, *LPWSTR, *PWSTR; -typedef __nullterminated PWSTR *PZPWSTR; -typedef __nullterminated CONST PWSTR *PCZPWSTR; -typedef __nullterminated WCHAR UNALIGNED *LPUWSTR, *PUWSTR; -typedef __nullterminated CONST WCHAR *LPCWSTR, *PCWSTR; -typedef __nullterminated PCWSTR *PZPCWSTR; -typedef __nullterminated CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR; - -typedef __nullnullterminated WCHAR *PZZWSTR; -typedef __nullnullterminated CONST WCHAR *PCZZWSTR; -typedef __nullnullterminated WCHAR UNALIGNED *PUZZWSTR; -typedef __nullnullterminated CONST WCHAR UNALIGNED *PCUZZWSTR; - -typedef __possibly_notnullterminated WCHAR *PNZWCH; -typedef __possibly_notnullterminated CONST WCHAR *PCNZWCH; -typedef __possibly_notnullterminated WCHAR UNALIGNED *PUNZWCH; -typedef __possibly_notnullterminated CONST WCHAR UNALIGNED *PCUNZWCH; - -#if _WIN32_WINNT >= 0x0600 || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS)) - -typedef CONST WCHAR *LPCWCHAR, *PCWCHAR; -typedef CONST WCHAR UNALIGNED *LPCUWCHAR, *PCUWCHAR; - -// -// UCS (Universal Character Set) types -// - -typedef unsigned long UCSCHAR; - -// -// Even pre-Unicode agreement, UCS values are always in the -// range U+00000000 to U+7FFFFFFF, so we'll pick an obvious -// value. - -#define UCSCHAR_INVALID_CHARACTER (0xffffffff) - -#define MIN_UCSCHAR (0) - -// -// We'll assume here that the ISO-10646 / Unicode agreement -// not to assign code points after U+0010FFFF holds so that -// we do not have to have separate "UCSCHAR" and "UNICODECHAR" -// types. -// - -#define MAX_UCSCHAR (0x0010FFFF) - -typedef UCSCHAR *PUCSCHAR; -typedef const UCSCHAR *PCUCSCHAR; - -typedef UCSCHAR *PUCSSTR; -typedef UCSCHAR UNALIGNED *PUUCSSTR; - -typedef const UCSCHAR *PCUCSSTR; -typedef const UCSCHAR UNALIGNED *PCUUCSSTR; - -typedef UCSCHAR UNALIGNED *PUUCSCHAR; -typedef const UCSCHAR UNALIGNED *PCUUCSCHAR; - -#endif // _WIN32_WINNT >= 0x0600 - - -// -// ANSI (Multi-byte Character) types -// -typedef CHAR *PCHAR, *LPCH, *PCH; -typedef CONST CHAR *LPCCH, *PCCH; - -typedef __nullterminated CHAR *NPSTR, *LPSTR, *PSTR; -typedef __nullterminated PSTR *PZPSTR; -typedef __nullterminated CONST PSTR *PCZPSTR; -typedef __nullterminated CONST CHAR *LPCSTR, *PCSTR; -typedef __nullterminated PCSTR *PZPCSTR; - -typedef __nullnullterminated CHAR *PZZSTR; -typedef __nullnullterminated CONST CHAR *PCZZSTR; - -typedef __possibly_notnullterminated CHAR *PNZCH; -typedef __possibly_notnullterminated CONST CHAR *PCNZCH; - -// -// Neutral ANSI/UNICODE types and macros -// -#ifdef UNICODE // r_winnt - -#ifndef _TCHAR_DEFINED -typedef WCHAR TCHAR, *PTCHAR; -typedef WCHAR TUCHAR, *PTUCHAR; -#define _TCHAR_DEFINED -#endif /* !_TCHAR_DEFINED */ - -typedef LPWCH LPTCH, PTCH; -typedef LPCWCH LPCTCH, PCTCH; -typedef LPWSTR PTSTR, LPTSTR; -typedef LPCWSTR PCTSTR, LPCTSTR; -typedef LPUWSTR PUTSTR, LPUTSTR; -typedef LPCUWSTR PCUTSTR, LPCUTSTR; -typedef LPWSTR LP; -typedef PZZWSTR PZZTSTR; -typedef PCZZWSTR PCZZTSTR; -typedef PUZZWSTR PUZZTSTR; -typedef PCUZZWSTR PCUZZTSTR; -typedef PNZWCH PNZTCH; -typedef PCNZWCH PCNZTCH; -typedef PUNZWCH PUNZTCH; -typedef PCUNZWCH PCUNZTCH; -#define __TEXT(quote) L##quote // r_winnt - -#else /* UNICODE */ // r_winnt - -#ifndef _TCHAR_DEFINED -typedef char TCHAR, *PTCHAR; -typedef unsigned char TUCHAR, *PTUCHAR; -#define _TCHAR_DEFINED -#endif /* !_TCHAR_DEFINED */ - -typedef LPCH LPTCH, PTCH; -typedef LPCCH LPCTCH, PCTCH; -typedef LPSTR PTSTR, LPTSTR, PUTSTR, LPUTSTR; -typedef LPCSTR PCTSTR, LPCTSTR, PCUTSTR, LPCUTSTR; -typedef PZZSTR PZZTSTR, PUZZTSTR; -typedef PCZZSTR PCZZTSTR, PCUZZTSTR; -typedef PNZCH PNZTCH, PUNZTCH; -typedef PCNZCH PCNZTCH, PCUNZTCH; -#define __TEXT(quote) quote // r_winnt - -#endif /* UNICODE */ // r_winnt -#define TEXT(quote) __TEXT(quote) // r_winnt - - -// end_winnt - -// -// The type QUAD and UQUAD are intended to use when a 8 byte aligned structure -// is required, but it is not a floating point number. -// - -typedef double DOUBLE; - -typedef struct _QUAD { - union { - __int64 UseThisFieldToCopy; - double DoNotUseThisField; - } DUMMYUNIONNAME; - -} QUAD; - -// -// Pointer to Basics -// - -typedef SHORT *PSHORT; // winnt -typedef LONG *PLONG; // winnt -typedef QUAD *PQUAD; - -// -// Unsigned Basics -// - -// Tell windef.h that some types are already defined. -#define BASETYPES - -typedef unsigned char UCHAR; -typedef unsigned short USHORT; -typedef unsigned long ULONG; -typedef QUAD UQUAD; - -// -// Pointer to Unsigned Basics -// - -typedef UCHAR *PUCHAR; -typedef USHORT *PUSHORT; -typedef ULONG *PULONG; -typedef UQUAD *PUQUAD; - -#if _WIN32_WINNT >= 0x0600 || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS)) - -// -// Pointer to Const Unsigned Basics -// - -typedef CONST UCHAR *PCUCHAR; -typedef CONST USHORT *PCUSHORT; -typedef CONST ULONG *PCULONG; -typedef CONST UQUAD *PCUQUAD; - -#endif // _WIN32_WINNT >= 0x0600 - -// -// Signed characters -// - -typedef signed char SCHAR; -typedef SCHAR *PSCHAR; - -#if _WIN32_WINNT >= 0x0600 || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS)) - -typedef CONST SCHAR *PCSCHAR; - -#endif // _WIN32_WINNT >= 0x0600 - -#ifndef NO_STRICT -#ifndef STRICT -#define STRICT 1 -#endif -#endif - -// begin_winnt - -#define ALL_PROCESSOR_GROUPS 0xffff - -// -// Structure to represent a system wide processor number. It contains a -// group number and relative processor number within the group. -// - -typedef struct _PROCESSOR_NUMBER { - USHORT Group; - UCHAR Number; - UCHAR Reserved; -} PROCESSOR_NUMBER, *PPROCESSOR_NUMBER; - -// -// Structure to represent a group-specific affinity, such as that of a -// thread. Specifies the group number and the affinity within that group. -// - -typedef struct _GROUP_AFFINITY { - KAFFINITY Mask; - USHORT Group; - USHORT Reserved[3]; -} GROUP_AFFINITY, *PGROUP_AFFINITY; - -// -// Handle to an Object -// - -#ifdef STRICT -typedef void *HANDLE; -#if 0 && (_MSC_VER > 1000) -#define DECLARE_HANDLE(name) struct name##__; typedef struct name##__ *name -#else -#define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name -#endif -#else -typedef PVOID HANDLE; -#define DECLARE_HANDLE(name) typedef HANDLE name -#endif -typedef HANDLE *PHANDLE; - -// -// Flag (bit) fields -// - -typedef UCHAR FCHAR; -typedef USHORT FSHORT; -typedef ULONG FLONG; - -// Component Object Model defines, and macros - -#ifndef _HRESULT_DEFINED -#define _HRESULT_DEFINED -#ifdef __midl -typedef LONG HRESULT; -#else -typedef __success(return >= 0) long HRESULT; -#endif // __midl -#endif // !_HRESULT_DEFINED - -#ifdef __cplusplus - #define EXTERN_C extern "C" -#else - #define EXTERN_C extern -#endif - -#if defined(_WIN32) || defined(_MPPC_) - -// Win32 doesn't support __export - -#ifdef _68K_ -#define STDMETHODCALLTYPE __cdecl -#else -#define STDMETHODCALLTYPE __stdcall -#endif -#define STDMETHODVCALLTYPE __cdecl - -#define STDAPICALLTYPE __stdcall -#define STDAPIVCALLTYPE __cdecl - -#else - -#define STDMETHODCALLTYPE __export __stdcall -#define STDMETHODVCALLTYPE __export __cdecl - -#define STDAPICALLTYPE __export __stdcall -#define STDAPIVCALLTYPE __export __cdecl - -#endif - - -#define STDAPI EXTERN_C HRESULT STDAPICALLTYPE -#define STDAPI_(type) EXTERN_C type STDAPICALLTYPE - -#define STDMETHODIMP HRESULT STDMETHODCALLTYPE -#define STDMETHODIMP_(type) type STDMETHODCALLTYPE - -#define STDOVERRIDEMETHODIMP __override STDMETHODIMP -#define STDOVERRIDEMETHODIMP_(type) __override STDMETHODIMP_(type) - -#define IFACEMETHODIMP __override STDMETHODIMP -#define IFACEMETHODIMP_(type) __override STDMETHODIMP_(type) - -// The 'V' versions allow Variable Argument lists. - -#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE -#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE - -#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE -#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE - -#define STDOVERRIDEMETHODIMPV __override STDMETHODIMPV -#define STDOVERRIDEMETHODIMPV_(type) __override STDMETHODIMPV_(type) - -#define IFACEMETHODIMPV __override STDMETHODIMPV -#define IFACEMETHODIMPV_(type) __override STDMETHODIMPV_(type) - -// end_winnt - - -// -// Low order two bits of a handle are ignored by the system and available -// for use by application code as tag bits. The remaining bits are opaque -// and used to store a serial number and table index. -// - -#define OBJ_HANDLE_TAGBITS 0x00000003L - -// -// Cardinal Data Types [0 - 2**N-2) -// - -typedef char CCHAR; // winnt -typedef short CSHORT; -typedef ULONG CLONG; - -typedef CCHAR *PCCHAR; -typedef CSHORT *PCSHORT; -typedef CLONG *PCLONG; - - -// -// __int64 is only supported by 2.0 and later midl. -// __midl is set by the 2.0 midl and not by 1.0 midl. -// - -#define _ULONGLONG_ -#if (!defined (_MAC) && (!defined(MIDL_PASS) || defined(__midl)) && (!defined(_M_IX86) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64))) -typedef __int64 LONGLONG; -typedef unsigned __int64 ULONGLONG; - -#define MAXLONGLONG (0x7fffffffffffffff) - - -#else - -#if defined(_MAC) && defined(_MAC_INT_64) -typedef __int64 LONGLONG; -typedef unsigned __int64 ULONGLONG; - -#define MAXLONGLONG (0x7fffffffffffffff) - - -#else -typedef double LONGLONG; -typedef double ULONGLONG; -#endif //_MAC and int64 - -#endif - -typedef LONGLONG *PLONGLONG; -typedef ULONGLONG *PULONGLONG; - -// Update Sequence Number - -typedef LONGLONG USN; - -#if defined(MIDL_PASS) -typedef struct _LARGE_INTEGER { -#else // MIDL_PASS -typedef union _LARGE_INTEGER { - struct { - ULONG LowPart; - LONG HighPart; - } DUMMYSTRUCTNAME; - struct { - ULONG LowPart; - LONG HighPart; - } u; -#endif //MIDL_PASS - LONGLONG QuadPart; -} LARGE_INTEGER; - -typedef LARGE_INTEGER *PLARGE_INTEGER; - -#if defined(MIDL_PASS) -typedef struct _ULARGE_INTEGER { -#else // MIDL_PASS -typedef union _ULARGE_INTEGER { - struct { - ULONG LowPart; - ULONG HighPart; - } DUMMYSTRUCTNAME; - struct { - ULONG LowPart; - ULONG HighPart; - } u; -#endif //MIDL_PASS - ULONGLONG QuadPart; -} ULARGE_INTEGER; - -typedef ULARGE_INTEGER *PULARGE_INTEGER; - - -// -// Boolean -// - -typedef UCHAR BOOLEAN; // winnt -typedef BOOLEAN *PBOOLEAN; // winnt - - -// -// Constants -// - -#define FALSE 0 -#define TRUE 1 - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#define NULL64 0 -#else -#define NULL ((void *)0) -#define NULL64 ((void * POINTER_64)0) -#endif -#endif // NULL - -#include - -// -// Macros used to eliminate compiler warning generated when formal -// parameters or local variables are not declared. -// -// Use DBG_UNREFERENCED_PARAMETER() when a parameter is not yet -// referenced but will be once the module is completely developed. -// -// Use DBG_UNREFERENCED_LOCAL_VARIABLE() when a local variable is not yet -// referenced but will be once the module is completely developed. -// -// Use UNREFERENCED_PARAMETER() if a parameter will never be referenced. -// -// DBG_UNREFERENCED_PARAMETER and DBG_UNREFERENCED_LOCAL_VARIABLE will -// eventually be made into a null macro to help determine whether there -// is unfinished work. -// - -#if ! defined(lint) -#define UNREFERENCED_PARAMETER(P) (P) -#define DBG_UNREFERENCED_PARAMETER(P) (P) -#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V) - -#else // lint - -// Note: lint -e530 says don't complain about uninitialized variables for -// this varible. Error 527 has to do with unreachable code. -// -restore restores checking to the -save state - -#define UNREFERENCED_PARAMETER(P) \ - /*lint -save -e527 -e530 */ \ - { \ - (P) = (P); \ - } \ - /*lint -restore */ -#define DBG_UNREFERENCED_PARAMETER(P) \ - /*lint -save -e527 -e530 */ \ - { \ - (P) = (P); \ - } \ - /*lint -restore */ -#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) \ - /*lint -save -e527 -e530 */ \ - { \ - (V) = (V); \ - } \ - /*lint -restore */ - -#endif // lint - -// -// Macro used to eliminate compiler warning 4715 within a switch statement -// when all possible cases have already been accounted for. -// -// switch (a & 3) { -// case 0: return 1; -// case 1: return Foo(); -// case 2: return Bar(); -// case 3: return 1; -// DEFAULT_UNREACHABLE; -// - -#if (_MSC_VER > 1200) -#define DEFAULT_UNREACHABLE default: __assume(0) -#else - -// -// Older compilers do not support __assume(), and there is no other free -// method of eliminating the warning. -// - -#define DEFAULT_UNREACHABLE - -#endif - -#ifdef __cplusplus - -// Define operator overloads to enable bit operations on enum values that are -// used to define flags. Use DEFINE_ENUM_FLAG_OPERATORS(YOUR_TYPE) to enable these -// operators on YOUR_TYPE. - -// Moved here from objbase.w. - -#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \ -extern "C++" { \ -inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) | ((int)b)); } \ -inline ENUMTYPE &operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \ -inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) & ((int)b)); } \ -inline ENUMTYPE &operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \ -inline ENUMTYPE operator ~ (ENUMTYPE a) { return ENUMTYPE(~((int)a)); } \ -inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) ^ ((int)b)); } \ -inline ENUMTYPE &operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \ -} -#else -#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) // NOP, C allows these operators. -#endif - -// Compile-time macros for initializing flag values in const data. -// -// When using DEFINE_ENUM_FLAG_OPERATORS for enum values you should use the macros below -// when you need to initialize global const data. Without these macros the inline operators -// from DEFINE_ENUM_FLAG_OPERATORS force a runtime initialization rather than a -// compile time initialization. This applies even if you have declared the data as const. -#define COMPILETIME_OR_2FLAGS(a,b) ((UINT)(a)|(UINT)(b)) -#define COMPILETIME_OR_3FLAGS(a,b,c) ((UINT)(a)|(UINT)(b)|(UINT)(c)) -#define COMPILETIME_OR_4FLAGS(a,b,c,d) ((UINT)(a)|(UINT)(b)|(UINT)(c)|(UINT)(d)) -#define COMPILETIME_OR_5FLAGS(a,b,c,d,e) ((UINT)(a)|(UINT)(b)|(UINT)(c)|(UINT)(d)|(UINT)(e)) - -// end_winnt - -// -// Define standard min and max macros -// - -#ifndef NOMINMAX - -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - -#endif // NOMINMAX - - - -// -// IOCTL_TAPE_ERASE definitions -// - -#define TAPE_ERASE_SHORT 0L -#define TAPE_ERASE_LONG 1L - -typedef struct _TAPE_ERASE { - ULONG Type; - BOOLEAN Immediate; -} TAPE_ERASE, *PTAPE_ERASE; - -// -// IOCTL_TAPE_PREPARE definitions -// - -#define TAPE_LOAD 0L -#define TAPE_UNLOAD 1L -#define TAPE_TENSION 2L -#define TAPE_LOCK 3L -#define TAPE_UNLOCK 4L -#define TAPE_FORMAT 5L - -typedef struct _TAPE_PREPARE { - ULONG Operation; - BOOLEAN Immediate; -} TAPE_PREPARE, *PTAPE_PREPARE; - -// -// IOCTL_TAPE_WRITE_MARKS definitions -// - -#define TAPE_SETMARKS 0L -#define TAPE_FILEMARKS 1L -#define TAPE_SHORT_FILEMARKS 2L -#define TAPE_LONG_FILEMARKS 3L - -typedef struct _TAPE_WRITE_MARKS { - ULONG Type; - ULONG Count; - BOOLEAN Immediate; -} TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS; - -// -// IOCTL_TAPE_GET_POSITION definitions -// - -#define TAPE_ABSOLUTE_POSITION 0L -#define TAPE_LOGICAL_POSITION 1L -#define TAPE_PSEUDO_LOGICAL_POSITION 2L - -typedef struct _TAPE_GET_POSITION { - ULONG Type; - ULONG Partition; - LARGE_INTEGER Offset; -} TAPE_GET_POSITION, *PTAPE_GET_POSITION; - -// -// IOCTL_TAPE_SET_POSITION definitions -// - -#define TAPE_REWIND 0L -#define TAPE_ABSOLUTE_BLOCK 1L -#define TAPE_LOGICAL_BLOCK 2L -#define TAPE_PSEUDO_LOGICAL_BLOCK 3L -#define TAPE_SPACE_END_OF_DATA 4L -#define TAPE_SPACE_RELATIVE_BLOCKS 5L -#define TAPE_SPACE_FILEMARKS 6L -#define TAPE_SPACE_SEQUENTIAL_FMKS 7L -#define TAPE_SPACE_SETMARKS 8L -#define TAPE_SPACE_SEQUENTIAL_SMKS 9L - -typedef struct _TAPE_SET_POSITION { - ULONG Method; - ULONG Partition; - LARGE_INTEGER Offset; - BOOLEAN Immediate; -} TAPE_SET_POSITION, *PTAPE_SET_POSITION; - -// -// IOCTL_TAPE_GET_DRIVE_PARAMS definitions -// - -// -// Definitions for FeaturesLow parameter -// - -#define TAPE_DRIVE_FIXED 0x00000001 -#define TAPE_DRIVE_SELECT 0x00000002 -#define TAPE_DRIVE_INITIATOR 0x00000004 - -#define TAPE_DRIVE_ERASE_SHORT 0x00000010 -#define TAPE_DRIVE_ERASE_LONG 0x00000020 -#define TAPE_DRIVE_ERASE_BOP_ONLY 0x00000040 -#define TAPE_DRIVE_ERASE_IMMEDIATE 0x00000080 - -#define TAPE_DRIVE_TAPE_CAPACITY 0x00000100 -#define TAPE_DRIVE_TAPE_REMAINING 0x00000200 -#define TAPE_DRIVE_FIXED_BLOCK 0x00000400 -#define TAPE_DRIVE_VARIABLE_BLOCK 0x00000800 - -#define TAPE_DRIVE_WRITE_PROTECT 0x00001000 -#define TAPE_DRIVE_EOT_WZ_SIZE 0x00002000 - -#define TAPE_DRIVE_ECC 0x00010000 -#define TAPE_DRIVE_COMPRESSION 0x00020000 -#define TAPE_DRIVE_PADDING 0x00040000 -#define TAPE_DRIVE_REPORT_SMKS 0x00080000 - -#define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x00100000 -#define TAPE_DRIVE_GET_LOGICAL_BLK 0x00200000 -#define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x00400000 - -#define TAPE_DRIVE_EJECT_MEDIA 0x01000000 -#define TAPE_DRIVE_CLEAN_REQUESTS 0x02000000 -#define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x04000000 - -#define TAPE_DRIVE_RESERVED_BIT 0x80000000 //don't use this bit! -// //can't be a low features bit! -// //reserved; high features only - -// -// Definitions for FeaturesHigh parameter -// - -#define TAPE_DRIVE_LOAD_UNLOAD 0x80000001 -#define TAPE_DRIVE_TENSION 0x80000002 -#define TAPE_DRIVE_LOCK_UNLOCK 0x80000004 -#define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008 - -#define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010 -#define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020 -#define TAPE_DRIVE_TENSION_IMMED 0x80000040 -#define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080 - -#define TAPE_DRIVE_SET_ECC 0x80000100 -#define TAPE_DRIVE_SET_COMPRESSION 0x80000200 -#define TAPE_DRIVE_SET_PADDING 0x80000400 -#define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800 - -#define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000 -#define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000 -#define TAPE_DRIVE_LOGICAL_BLK 0x80004000 -#define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000 - -#define TAPE_DRIVE_END_OF_DATA 0x80010000 -#define TAPE_DRIVE_RELATIVE_BLKS 0x80020000 -#define TAPE_DRIVE_FILEMARKS 0x80040000 -#define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000 - -#define TAPE_DRIVE_SETMARKS 0x80100000 -#define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000 -#define TAPE_DRIVE_REVERSE_POSITION 0x80400000 -#define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000 - -#define TAPE_DRIVE_WRITE_SETMARKS 0x81000000 -#define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000 -#define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000 -#define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000 - -#define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000 -#define TAPE_DRIVE_FORMAT 0xA0000000 -#define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000 -#define TAPE_DRIVE_HIGH_FEATURES 0x80000000 //mask for high features flag - -typedef struct _TAPE_GET_DRIVE_PARAMETERS { - BOOLEAN ECC; - BOOLEAN Compression; - BOOLEAN DataPadding; - BOOLEAN ReportSetmarks; - ULONG DefaultBlockSize; - ULONG MaximumBlockSize; - ULONG MinimumBlockSize; - ULONG MaximumPartitionCount; - ULONG FeaturesLow; - ULONG FeaturesHigh; - ULONG EOTWarningZoneSize; -} TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS; - -// -// IOCTL_TAPE_SET_DRIVE_PARAMETERS definitions -// - -typedef struct _TAPE_SET_DRIVE_PARAMETERS { - BOOLEAN ECC; - BOOLEAN Compression; - BOOLEAN DataPadding; - BOOLEAN ReportSetmarks; - ULONG EOTWarningZoneSize; -} TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS; - -// -// IOCTL_TAPE_GET_MEDIA_PARAMETERS definitions -// - -typedef struct _TAPE_GET_MEDIA_PARAMETERS { - LARGE_INTEGER Capacity; - LARGE_INTEGER Remaining; - ULONG BlockSize; - ULONG PartitionCount; - BOOLEAN WriteProtected; -} TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS; - -// -// IOCTL_TAPE_SET_MEDIA_PARAMETERS definitions -// - -typedef struct _TAPE_SET_MEDIA_PARAMETERS { - ULONG BlockSize; -} TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS; - -// -// IOCTL_TAPE_CREATE_PARTITION definitions -// - -#define TAPE_FIXED_PARTITIONS 0L -#define TAPE_SELECT_PARTITIONS 1L -#define TAPE_INITIATOR_PARTITIONS 2L - -typedef struct _TAPE_CREATE_PARTITION { - ULONG Method; - ULONG Count; - ULONG Size; -} TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION; - - -// -// WMI Methods -// -#define TAPE_QUERY_DRIVE_PARAMETERS 0L -#define TAPE_QUERY_MEDIA_CAPACITY 1L -#define TAPE_CHECK_FOR_DRIVE_PROBLEM 2L -#define TAPE_QUERY_IO_ERROR_DATA 3L -#define TAPE_QUERY_DEVICE_ERROR_DATA 4L - -typedef struct _TAPE_WMI_OPERATIONS { - ULONG Method; - ULONG DataBufferSize; - PVOID DataBuffer; -} TAPE_WMI_OPERATIONS, *PTAPE_WMI_OPERATIONS; - -// -// Type of drive errors -// -typedef enum _TAPE_DRIVE_PROBLEM_TYPE { - TapeDriveProblemNone, TapeDriveReadWriteWarning, - TapeDriveReadWriteError, TapeDriveReadWarning, - TapeDriveWriteWarning, TapeDriveReadError, - TapeDriveWriteError, TapeDriveHardwareError, - TapeDriveUnsupportedMedia, TapeDriveScsiConnectionError, - TapeDriveTimetoClean, TapeDriveCleanDriveNow, - TapeDriveMediaLifeExpired, TapeDriveSnappedTape -} TAPE_DRIVE_PROBLEM_TYPE; - - - -typedef struct _TAPE_STATISTICS { - ULONG Version; - ULONG Flags; - LARGE_INTEGER RecoveredWrites; - LARGE_INTEGER UnrecoveredWrites; - LARGE_INTEGER RecoveredReads; - LARGE_INTEGER UnrecoveredReads; - UCHAR CompressionRatioReads; - UCHAR CompressionRatioWrites; -} TAPE_STATISTICS, *PTAPE_STATISTICS; - -#define RECOVERED_WRITES_VALID 0x00000001 -#define UNRECOVERED_WRITES_VALID 0x00000002 -#define RECOVERED_READS_VALID 0x00000004 -#define UNRECOVERED_READS_VALID 0x00000008 -#define WRITE_COMPRESSION_INFO_VALID 0x00000010 -#define READ_COMPRESSION_INFO_VALID 0x00000020 - -typedef struct _TAPE_GET_STATISTICS { - ULONG Operation; -} TAPE_GET_STATISTICS, *PTAPE_GET_STATISTICS; - -#define TAPE_RETURN_STATISTICS 0L -#define TAPE_RETURN_ENV_INFO 1L -#define TAPE_RESET_STATISTICS 2L - -// -// IOCTL_STORAGE_GET_MEDIA_TYPES_EX will return an array of DEVICE_MEDIA_INFO -// structures, one per supported type, embedded in the GET_MEDIA_TYPES struct. -// - -typedef enum _STORAGE_MEDIA_TYPE { - // - // Following are defined in ntdddisk.h in the MEDIA_TYPE enum - // - // Unknown, // Format is unknown - // F5_1Pt2_512, // 5.25", 1.2MB, 512 bytes/sector - // F3_1Pt44_512, // 3.5", 1.44MB, 512 bytes/sector - // F3_2Pt88_512, // 3.5", 2.88MB, 512 bytes/sector - // F3_20Pt8_512, // 3.5", 20.8MB, 512 bytes/sector - // F3_720_512, // 3.5", 720KB, 512 bytes/sector - // F5_360_512, // 5.25", 360KB, 512 bytes/sector - // F5_320_512, // 5.25", 320KB, 512 bytes/sector - // F5_320_1024, // 5.25", 320KB, 1024 bytes/sector - // F5_180_512, // 5.25", 180KB, 512 bytes/sector - // F5_160_512, // 5.25", 160KB, 512 bytes/sector - // RemovableMedia, // Removable media other than floppy - // FixedMedia, // Fixed hard disk media - // F3_120M_512, // 3.5", 120M Floppy - // F3_640_512, // 3.5" , 640KB, 512 bytes/sector - // F5_640_512, // 5.25", 640KB, 512 bytes/sector - // F5_720_512, // 5.25", 720KB, 512 bytes/sector - // F3_1Pt2_512, // 3.5" , 1.2Mb, 512 bytes/sector - // F3_1Pt23_1024, // 3.5" , 1.23Mb, 1024 bytes/sector - // F5_1Pt23_1024, // 5.25", 1.23MB, 1024 bytes/sector - // F3_128Mb_512, // 3.5" MO 128Mb 512 bytes/sector - // F3_230Mb_512, // 3.5" MO 230Mb 512 bytes/sector - // F8_256_128, // 8", 256KB, 128 bytes/sector - // F3_200Mb_512, // 3.5", 200M Floppy (HiFD) - // - - DDS_4mm = 0x20, // Tape - DAT DDS1,2,... (all vendors) - MiniQic, // Tape - miniQIC Tape - Travan, // Tape - Travan TR-1,2,3,... - QIC, // Tape - QIC - MP_8mm, // Tape - 8mm Exabyte Metal Particle - AME_8mm, // Tape - 8mm Exabyte Advanced Metal Evap - AIT1_8mm, // Tape - 8mm Sony AIT - DLT, // Tape - DLT Compact IIIxt, IV - NCTP, // Tape - Philips NCTP - IBM_3480, // Tape - IBM 3480 - IBM_3490E, // Tape - IBM 3490E - IBM_Magstar_3590, // Tape - IBM Magstar 3590 - IBM_Magstar_MP, // Tape - IBM Magstar MP - STK_DATA_D3, // Tape - STK Data D3 - SONY_DTF, // Tape - Sony DTF - DV_6mm, // Tape - 6mm Digital Video - DMI, // Tape - Exabyte DMI and compatibles - SONY_D2, // Tape - Sony D2S and D2L - CLEANER_CARTRIDGE, // Cleaner - All Drive types that support Drive Cleaners - CD_ROM, // Opt_Disk - CD - CD_R, // Opt_Disk - CD-Recordable (Write Once) - CD_RW, // Opt_Disk - CD-Rewriteable - DVD_ROM, // Opt_Disk - DVD-ROM - DVD_R, // Opt_Disk - DVD-Recordable (Write Once) - DVD_RW, // Opt_Disk - DVD-Rewriteable - MO_3_RW, // Opt_Disk - 3.5" Rewriteable MO Disk - MO_5_WO, // Opt_Disk - MO 5.25" Write Once - MO_5_RW, // Opt_Disk - MO 5.25" Rewriteable (not LIMDOW) - MO_5_LIMDOW, // Opt_Disk - MO 5.25" Rewriteable (LIMDOW) - PC_5_WO, // Opt_Disk - Phase Change 5.25" Write Once Optical - PC_5_RW, // Opt_Disk - Phase Change 5.25" Rewriteable - PD_5_RW, // Opt_Disk - PhaseChange Dual Rewriteable - ABL_5_WO, // Opt_Disk - Ablative 5.25" Write Once Optical - PINNACLE_APEX_5_RW, // Opt_Disk - Pinnacle Apex 4.6GB Rewriteable Optical - SONY_12_WO, // Opt_Disk - Sony 12" Write Once - PHILIPS_12_WO, // Opt_Disk - Philips/LMS 12" Write Once - HITACHI_12_WO, // Opt_Disk - Hitachi 12" Write Once - CYGNET_12_WO, // Opt_Disk - Cygnet/ATG 12" Write Once - KODAK_14_WO, // Opt_Disk - Kodak 14" Write Once - MO_NFR_525, // Opt_Disk - Near Field Recording (Terastor) - NIKON_12_RW, // Opt_Disk - Nikon 12" Rewriteable - IOMEGA_ZIP, // Mag_Disk - Iomega Zip - IOMEGA_JAZ, // Mag_Disk - Iomega Jaz - SYQUEST_EZ135, // Mag_Disk - Syquest EZ135 - SYQUEST_EZFLYER, // Mag_Disk - Syquest EzFlyer - SYQUEST_SYJET, // Mag_Disk - Syquest SyJet - AVATAR_F2, // Mag_Disk - 2.5" Floppy - MP2_8mm, // Tape - 8mm Hitachi - DST_S, // Ampex DST Small Tapes - DST_M, // Ampex DST Medium Tapes - DST_L, // Ampex DST Large Tapes - VXATape_1, // Ecrix 8mm Tape - VXATape_2, // Ecrix 8mm Tape -#if (NTDDI_VERSION < NTDDI_WINXP) - STK_EAGLE, // STK Eagle -#else - STK_9840, // STK 9840 -#endif - LTO_Ultrium, // IBM, HP, Seagate LTO Ultrium - LTO_Accelis, // IBM, HP, Seagate LTO Accelis - DVD_RAM, // Opt_Disk - DVD-RAM - AIT_8mm, // AIT2 or higher - ADR_1, // OnStream ADR Mediatypes - ADR_2, - STK_9940, // STK 9940 - SAIT, // SAIT Tapes - VXATape // VXA (Ecrix 8mm) Tape -}STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE; - -#define MEDIA_ERASEABLE 0x00000001 -#define MEDIA_WRITE_ONCE 0x00000002 -#define MEDIA_READ_ONLY 0x00000004 -#define MEDIA_READ_WRITE 0x00000008 - -#define MEDIA_WRITE_PROTECTED 0x00000100 -#define MEDIA_CURRENTLY_MOUNTED 0x80000000 - -// -// Define the different storage bus types -// Bus types below 128 (0x80) are reserved for Microsoft use -// - -typedef enum _STORAGE_BUS_TYPE { - BusTypeUnknown = 0x00, - BusTypeScsi, - BusTypeAtapi, - BusTypeAta, - BusType1394, - BusTypeSsa, - BusTypeFibre, - BusTypeUsb, - BusTypeRAID, - BusTypeiScsi, - BusTypeSas, - BusTypeSata, - BusTypeSd, - BusTypeMmc, - BusTypeVirtual, - BusTypeFileBackedVirtual, - BusTypeMax, - BusTypeMaxReserved = 0x7F -} STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE; - -typedef struct _DEVICE_MEDIA_INFO { - union { - struct { - LARGE_INTEGER Cylinders; - STORAGE_MEDIA_TYPE MediaType; - ULONG TracksPerCylinder; - ULONG SectorsPerTrack; - ULONG BytesPerSector; - ULONG NumberMediaSides; - ULONG MediaCharacteristics; // Bitmask of MEDIA_XXX values. - } DiskInfo; - - struct { - LARGE_INTEGER Cylinders; - STORAGE_MEDIA_TYPE MediaType; - ULONG TracksPerCylinder; - ULONG SectorsPerTrack; - ULONG BytesPerSector; - ULONG NumberMediaSides; - ULONG MediaCharacteristics; // Bitmask of MEDIA_XXX values. - } RemovableDiskInfo; - - struct { - STORAGE_MEDIA_TYPE MediaType; - ULONG MediaCharacteristics; // Bitmask of MEDIA_XXX values. - ULONG CurrentBlockSize; - STORAGE_BUS_TYPE BusType; - - // - // Bus specific information describing the medium supported. - // - - union { - struct { - UCHAR MediumType; - UCHAR DensityCode; - } ScsiInformation; - } BusSpecificData; - - } TapeInfo; - } DeviceSpecific; -} DEVICE_MEDIA_INFO, *PDEVICE_MEDIA_INFO; - -typedef struct _GET_MEDIA_TYPES { - ULONG DeviceType; // FILE_DEVICE_XXX values - ULONG MediaInfoCount; - DEVICE_MEDIA_INFO MediaInfo[1]; -} GET_MEDIA_TYPES, *PGET_MEDIA_TYPES; - - -// -// IOCTL_STORAGE_PREDICT_FAILURE -// -// input - none -// -// output - STORAGE_PREDICT_FAILURE structure -// PredictFailure returns zero if no failure predicted and non zero -// if a failure is predicted. -// -// VendorSpecific returns 512 bytes of vendor specific information -// if a failure is predicted -// -typedef struct _STORAGE_PREDICT_FAILURE -{ - ULONG PredictFailure; - UCHAR VendorSpecific[512]; -} STORAGE_PREDICT_FAILURE, *PSTORAGE_PREDICT_FAILURE; - - -#define MAXIMUM_CDB_SIZE 12 - -// -// SCSI I/O Request Block -// - -typedef struct _SCSI_REQUEST_BLOCK { - USHORT Length; // offset 0 - UCHAR Function; // offset 2 - UCHAR SrbStatus; // offset 3 - UCHAR ScsiStatus; // offset 4 - UCHAR PathId; // offset 5 - UCHAR TargetId; // offset 6 - UCHAR Lun; // offset 7 - UCHAR QueueTag; // offset 8 - UCHAR QueueAction; // offset 9 - UCHAR CdbLength; // offset a - UCHAR SenseInfoBufferLength; // offset b - ULONG SrbFlags; // offset c - ULONG DataTransferLength; // offset 10 - ULONG TimeOutValue; // offset 14 - __field_bcount(DataTransferLength) \ - PVOID DataBuffer; // offset 18 - PVOID SenseInfoBuffer; // offset 1c - struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20 - PVOID OriginalRequest; // offset 24 - PVOID SrbExtension; // offset 28 - union { - ULONG InternalStatus; // offset 2c - ULONG QueueSortKey; // offset 2c - ULONG LinkTimeoutValue; // offset 2c - }; - -#if defined(_WIN64) - - // - // Force PVOID alignment of Cdb - // - - ULONG Reserved; - -#endif - - UCHAR Cdb[16]; // offset 30 -} SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK; - -#define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK) - -// -// SCSI I/O Request Block for WMI Requests -// - -typedef struct _SCSI_WMI_REQUEST_BLOCK { - USHORT Length; - UCHAR Function; // SRB_FUNCTION_WMI - UCHAR SrbStatus; - UCHAR WMISubFunction; - UCHAR PathId; // If SRB_WMI_FLAGS_ADAPTER_REQUEST is set in - UCHAR TargetId; // WMIFlags then PathId, TargetId and Lun are - UCHAR Lun; // reserved fields. - UCHAR Reserved1; - UCHAR WMIFlags; - UCHAR Reserved2[2]; - ULONG SrbFlags; - ULONG DataTransferLength; - ULONG TimeOutValue; - PVOID DataBuffer; - PVOID DataPath; - PVOID Reserved3; - PVOID OriginalRequest; - PVOID SrbExtension; - ULONG Reserved4; - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -#if defined(_WIN64) - - // - // Force PVOID alignment of Cdb - // - - ULONG Reserved6; - -#endif -#endif - - UCHAR Reserved5[16]; -} SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK; - -typedef enum _STOR_DEVICE_POWER_STATE { - StorPowerDeviceUnspecified = 0, - StorPowerDeviceD0, - StorPowerDeviceD1, - StorPowerDeviceD2, - StorPowerDeviceD3, - StorPowerDeviceMaximum -} STOR_DEVICE_POWER_STATE, *PSTOR_DEVICE_POWER_STATE; - -typedef enum { - StorPowerActionNone = 0, - StorPowerActionReserved, - StorPowerActionSleep, - StorPowerActionHibernate, - StorPowerActionShutdown, - StorPowerActionShutdownReset, - StorPowerActionShutdownOff, - StorPowerActionWarmEject -} STOR_POWER_ACTION, *PSTOR_POWER_ACTION; - -typedef struct _SCSI_POWER_REQUEST_BLOCK { - USHORT Length; // offset 0 - UCHAR Function; // offset 2 - UCHAR SrbStatus; // offset 3 - UCHAR SrbPowerFlags; // offset 4 - UCHAR PathId; // offset 5 - UCHAR TargetId; // offset 6 - UCHAR Lun; // offset 7 - STOR_DEVICE_POWER_STATE DevicePowerState; // offset 8 - ULONG SrbFlags; // offset c - ULONG DataTransferLength; // offset 10 - ULONG TimeOutValue; // offset 14 - PVOID DataBuffer; // offset 18 - PVOID SenseInfoBuffer; // offset 1c - struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20 - PVOID OriginalRequest; // offset 24 - PVOID SrbExtension; // offset 28 - STOR_POWER_ACTION PowerAction; // offset 2c - -#if defined(_WIN64) - - // - // Force PVOID alignment of Cdb - // - - ULONG Reserved; - -#endif - - UCHAR Reserved5[16]; // offset 30 -} SCSI_POWER_REQUEST_BLOCK, *PSCSI_POWER_REQUEST_BLOCK; - -// -// PNP minor function codes. -// -typedef enum { - StorStartDevice = 0x0, - StorRemoveDevice = 0x2, - StorStopDevice = 0x4, - StorQueryCapabilities = 0x9, - StorQueryResourceRequirements = 0xB, - StorFilterResourceRequirements = 0xD, - StorSurpriseRemoval = 0x17 -} STOR_PNP_ACTION, *PSTOR_PNP_ACTION; - -typedef struct _STOR_DEVICE_CAPABILITIES { - USHORT Version; - ULONG DeviceD1:1; - ULONG DeviceD2:1; - ULONG LockSupported:1; - ULONG EjectSupported:1; - ULONG Removable:1; - ULONG DockDevice:1; - ULONG UniqueID:1; - ULONG SilentInstall:1; - ULONG SurpriseRemovalOK:1; - ULONG NoDisplayInUI:1; - -} STOR_DEVICE_CAPABILITIES, *PSTOR_DEVICE_CAPABILITIES; - -typedef struct _SCSI_PNP_REQUEST_BLOCK { - USHORT Length; // offset 0 - UCHAR Function; // offset 2 - UCHAR SrbStatus; // offset 3 - UCHAR PnPSubFunction; // offset 4 - UCHAR PathId; // offset 5 - UCHAR TargetId; // offset 6 - UCHAR Lun; // offset 7 - STOR_PNP_ACTION PnPAction; // offset 8 - ULONG SrbFlags; // offset c - ULONG DataTransferLength; // offset 10 - ULONG TimeOutValue; // offset 14 - PVOID DataBuffer; // offset 18 - PVOID SenseInfoBuffer; // offset 1c - struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20 - PVOID OriginalRequest; // offset 24 - PVOID SrbExtension; // offset 28 - ULONG SrbPnPFlags; // offset 2c - -#if defined(_WIN64) - - // - // Force PVOID alignment of Cdb - // - - ULONG Reserved; - -#endif - UCHAR Reserved4[16]; // offset 30 -} SCSI_PNP_REQUEST_BLOCK, *PSCSI_PNP_REQUEST_BLOCK; - - -// -// SRB Functions -// - -#define SRB_FUNCTION_EXECUTE_SCSI 0x00 -#define SRB_FUNCTION_CLAIM_DEVICE 0x01 -#define SRB_FUNCTION_IO_CONTROL 0x02 -#define SRB_FUNCTION_RECEIVE_EVENT 0x03 -#define SRB_FUNCTION_RELEASE_QUEUE 0x04 -#define SRB_FUNCTION_ATTACH_DEVICE 0x05 -#define SRB_FUNCTION_RELEASE_DEVICE 0x06 -#define SRB_FUNCTION_SHUTDOWN 0x07 -#define SRB_FUNCTION_FLUSH 0x08 -#define SRB_FUNCTION_ABORT_COMMAND 0x10 -#define SRB_FUNCTION_RELEASE_RECOVERY 0x11 -#define SRB_FUNCTION_RESET_BUS 0x12 -#define SRB_FUNCTION_RESET_DEVICE 0x13 -#define SRB_FUNCTION_TERMINATE_IO 0x14 -#define SRB_FUNCTION_FLUSH_QUEUE 0x15 -#define SRB_FUNCTION_REMOVE_DEVICE 0x16 -#define SRB_FUNCTION_WMI 0x17 -#define SRB_FUNCTION_LOCK_QUEUE 0x18 -#define SRB_FUNCTION_UNLOCK_QUEUE 0x19 -#define SRB_FUNCTION_RESET_LOGICAL_UNIT 0x20 -#define SRB_FUNCTION_SET_LINK_TIMEOUT 0x21 -#define SRB_FUNCTION_LINK_TIMEOUT_OCCURRED 0x22 -#define SRB_FUNCTION_LINK_TIMEOUT_COMPLETE 0x23 -#define SRB_FUNCTION_POWER 0x24 -#define SRB_FUNCTION_PNP 0x25 -#define SRB_FUNCTION_DUMP_POINTERS 0x26 -// -// SRB Status -// - -#define SRB_STATUS_PENDING 0x00 -#define SRB_STATUS_SUCCESS 0x01 -#define SRB_STATUS_ABORTED 0x02 -#define SRB_STATUS_ABORT_FAILED 0x03 -#define SRB_STATUS_ERROR 0x04 -#define SRB_STATUS_BUSY 0x05 -#define SRB_STATUS_INVALID_REQUEST 0x06 -#define SRB_STATUS_INVALID_PATH_ID 0x07 -#define SRB_STATUS_NO_DEVICE 0x08 -#define SRB_STATUS_TIMEOUT 0x09 -#define SRB_STATUS_SELECTION_TIMEOUT 0x0A -#define SRB_STATUS_COMMAND_TIMEOUT 0x0B -#define SRB_STATUS_MESSAGE_REJECTED 0x0D -#define SRB_STATUS_BUS_RESET 0x0E -#define SRB_STATUS_PARITY_ERROR 0x0F -#define SRB_STATUS_REQUEST_SENSE_FAILED 0x10 -#define SRB_STATUS_NO_HBA 0x11 -#define SRB_STATUS_DATA_OVERRUN 0x12 -#define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13 -#define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14 -#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15 -#define SRB_STATUS_REQUEST_FLUSHED 0x16 -#define SRB_STATUS_INVALID_LUN 0x20 -#define SRB_STATUS_INVALID_TARGET_ID 0x21 -#define SRB_STATUS_BAD_FUNCTION 0x22 -#define SRB_STATUS_ERROR_RECOVERY 0x23 -#define SRB_STATUS_NOT_POWERED 0x24 -#define SRB_STATUS_LINK_DOWN 0x25 - -// -// This value is used by the port driver to indicate that a non-scsi-related -// error occured. Miniports must never return this status. -// - -#define SRB_STATUS_INTERNAL_ERROR 0x30 - -// -// Srb status values 0x38 through 0x3f are reserved for internal port driver -// use. -// - - - -// -// SRB Status Masks -// - -#define SRB_STATUS_QUEUE_FROZEN 0x40 -#define SRB_STATUS_AUTOSENSE_VALID 0x80 - -#define SRB_STATUS(Status) (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN)) - -// -// SRB Flag Bits -// - -#define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002 -#define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004 -#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008 - -#define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010 -#define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020 -#define SRB_FLAGS_DATA_IN 0x00000040 -#define SRB_FLAGS_DATA_OUT 0x00000080 -#define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000 -#define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT) - -#define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100 -#define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200 -#define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400 - -#define SRB_FLAGS_IS_ACTIVE 0x00010000 -#define SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000 -#define SRB_FLAGS_SGLIST_FROM_POOL 0x00040000 -#define SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000 - -#define SRB_FLAGS_NO_KEEP_AWAKE 0x00100000 -#define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000 - -#define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000 -#define SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000 - -#define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000 -#define SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000 - -#if DBG==1 -// -// A signature used to validate the scsi port number -// at the end of a sense buffer. -// -#define SCSI_PORT_SIGNATURE 0x54524f50 -#endif - -// -// Queue Action -// - -#define SRB_SIMPLE_TAG_REQUEST 0x20 -#define SRB_HEAD_OF_QUEUE_TAG_REQUEST 0x21 -#define SRB_ORDERED_QUEUE_TAG_REQUEST 0x22 - -#define SRB_WMI_FLAGS_ADAPTER_REQUEST 0x01 -#define SRB_POWER_FLAGS_ADAPTER_REQUEST 0x01 -#define SRB_PNP_FLAGS_ADAPTER_REQUEST 0x01 - - -#ifndef _NTDDK_ -#define SCSIPORT_API DECLSPEC_IMPORT -#else -#define SCSIPORT_API -#endif - - -SCSIPORT_API -VOID -ScsiDebugPrint( - ULONG DebugPrintLevel, - PCCHAR DebugMessage, - ... - ); - - -// begin_storport - -// -// Command Descriptor Block. Passed by SCSI controller chip over the SCSI bus -// - -#pragma pack(push, cdb, 1) -typedef union _CDB { - - // - // Generic 6-Byte CDB - // - - struct _CDB6GENERIC { - UCHAR OperationCode; - UCHAR Immediate : 1; - UCHAR CommandUniqueBits : 4; - UCHAR LogicalUnitNumber : 3; - UCHAR CommandUniqueBytes[3]; - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved : 4; - UCHAR VendorUnique : 2; - } CDB6GENERIC; - - // - // Standard 6-byte CDB - // - - struct _CDB6READWRITE { - UCHAR OperationCode; // 0x08, 0x0A - SCSIOP_READ, SCSIOP_WRITE - UCHAR LogicalBlockMsb1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlockMsb0; - UCHAR LogicalBlockLsb; - UCHAR TransferBlocks; - UCHAR Control; - } CDB6READWRITE; - - // - // SCSI-1 Inquiry CDB - // - - struct _CDB6INQUIRY { - UCHAR OperationCode; // 0x12 - SCSIOP_INQUIRY - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR PageCode; - UCHAR IReserved; - UCHAR AllocationLength; - UCHAR Control; - } CDB6INQUIRY; - - // - // SCSI-3 Inquiry CDB - // - - struct _CDB6INQUIRY3 { - UCHAR OperationCode; // 0x12 - SCSIOP_INQUIRY - UCHAR EnableVitalProductData : 1; - UCHAR CommandSupportData : 1; - UCHAR Reserved1 : 6; - UCHAR PageCode; - UCHAR Reserved2; - UCHAR AllocationLength; - UCHAR Control; - } CDB6INQUIRY3; - - struct _CDB6VERIFY { - UCHAR OperationCode; // 0x13 - SCSIOP_VERIFY - UCHAR Fixed : 1; - UCHAR ByteCompare : 1; - UCHAR Immediate : 1; - UCHAR Reserved : 2; - UCHAR LogicalUnitNumber : 3; - UCHAR VerificationLength[3]; - UCHAR Control; - } CDB6VERIFY; - - // - // SCSI Format CDB - // - - struct _CDB6FORMAT { - UCHAR OperationCode; // 0x04 - SCSIOP_FORMAT_UNIT - UCHAR FormatControl : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR FReserved1; - UCHAR InterleaveMsb; - UCHAR InterleaveLsb; - UCHAR FReserved2; - } CDB6FORMAT; - - // - // Standard 10-byte CDB - - struct _CDB10 { - UCHAR OperationCode; - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 2; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlockByte0; - UCHAR LogicalBlockByte1; - UCHAR LogicalBlockByte2; - UCHAR LogicalBlockByte3; - UCHAR Reserved2; - UCHAR TransferBlocksMsb; - UCHAR TransferBlocksLsb; - UCHAR Control; - } CDB10; - - // - // Standard 12-byte CDB - // - - struct _CDB12 { - UCHAR OperationCode; - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 2; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlock[4]; - UCHAR TransferLength[4]; - UCHAR Reserved2; - UCHAR Control; - } CDB12; - - - - // - // Standard 16-byte CDB - // - - struct _CDB16 { - UCHAR OperationCode; - UCHAR Reserved1 : 3; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR Protection : 3; - UCHAR LogicalBlock[8]; - UCHAR TransferLength[4]; - UCHAR Reserved2; - UCHAR Control; - } CDB16; - - - // - // CD Rom Audio CDBs - // - - struct _PAUSE_RESUME { - UCHAR OperationCode; // 0x4B - SCSIOP_PAUSE_RESUME - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[6]; - UCHAR Action; - UCHAR Control; - } PAUSE_RESUME; - - // - // Read Table of Contents - // - - struct _READ_TOC { - UCHAR OperationCode; // 0x43 - SCSIOP_READ_TOC - UCHAR Reserved0 : 1; - UCHAR Msf : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR Format2 : 4; - UCHAR Reserved2 : 4; - UCHAR Reserved3[3]; - UCHAR StartingTrack; - UCHAR AllocationLength[2]; - UCHAR Control : 6; - UCHAR Format : 2; - } READ_TOC; - - struct _READ_DISK_INFORMATION { - UCHAR OperationCode; // 0x51 - SCSIOP_READ_DISC_INFORMATION - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[5]; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_DISK_INFORMATION, READ_DISC_INFORMATION; - - struct _READ_TRACK_INFORMATION { - UCHAR OperationCode; // 0x52 - SCSIOP_READ_TRACK_INFORMATION - UCHAR Track : 2; - UCHAR Reserved4 : 3; - UCHAR Lun : 3; - UCHAR BlockAddress[4]; // or Track Number - UCHAR Reserved3; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_TRACK_INFORMATION; - - struct _RESERVE_TRACK_RZONE { - UCHAR OperationCode; // 0x53 - SCSIOP_RESERVE_TRACK_RZONE - UCHAR Reserved1[4]; - UCHAR ReservationSize[4]; - UCHAR Control; - } RESERVE_TRACK_RZONE; - - struct _SEND_OPC_INFORMATION { - UCHAR OperationCode; // 0x54 - SCSIOP_SEND_OPC_INFORMATION - UCHAR DoOpc : 1; // perform OPC - UCHAR Reserved1 : 7; - UCHAR Exclude0 : 1; // exclude layer 0 - UCHAR Exclude1 : 1; // exclude layer 1 - UCHAR Reserved2 : 6; - UCHAR Reserved3[4]; - UCHAR ParameterListLength[2]; - UCHAR Reserved4; - } SEND_OPC_INFORMATION; - - struct _REPAIR_TRACK { - UCHAR OperationCode; // 0x58 - SCSIOP_REPAIR_TRACK - UCHAR Immediate : 1; - UCHAR Reserved1 : 7; - UCHAR Reserved2[2]; - UCHAR TrackNumber[2]; - UCHAR Reserved3[3]; - UCHAR Control; - } REPAIR_TRACK; - - struct _CLOSE_TRACK { - UCHAR OperationCode; // 0x5B - SCSIOP_CLOSE_TRACK_SESSION - UCHAR Immediate : 1; - UCHAR Reserved1 : 7; - UCHAR Track : 1; - UCHAR Session : 1; - UCHAR Reserved2 : 6; - UCHAR Reserved3; - UCHAR TrackNumber[2]; - UCHAR Reserved4[3]; - UCHAR Control; - } CLOSE_TRACK; - - struct _READ_BUFFER_CAPACITY { - UCHAR OperationCode; // 0x5C - SCSIOP_READ_BUFFER_CAPACITY - UCHAR BlockInfo : 1; - UCHAR Reserved1 : 7; - UCHAR Reserved2[5]; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_BUFFER_CAPACITY; - - struct _SEND_CUE_SHEET { - UCHAR OperationCode; // 0x5D - SCSIOP_SEND_CUE_SHEET - UCHAR Reserved[5]; - UCHAR CueSheetSize[3]; - UCHAR Control; - } SEND_CUE_SHEET; - - struct _READ_HEADER { - UCHAR OperationCode; // 0x44 - SCSIOP_READ_HEADER - UCHAR Reserved1 : 1; - UCHAR Msf : 1; - UCHAR Reserved2 : 3; - UCHAR Lun : 3; - UCHAR LogicalBlockAddress[4]; - UCHAR Reserved3; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_HEADER; - - struct _PLAY_AUDIO { - UCHAR OperationCode; // 0x45 - SCSIOP_PLAY_AUDIO - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR StartingBlockAddress[4]; - UCHAR Reserved2; - UCHAR PlayLength[2]; - UCHAR Control; - } PLAY_AUDIO; - - struct _PLAY_AUDIO_MSF { - UCHAR OperationCode; // 0x47 - SCSIOP_PLAY_AUDIO_MSF - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2; - UCHAR StartingM; - UCHAR StartingS; - UCHAR StartingF; - UCHAR EndingM; - UCHAR EndingS; - UCHAR EndingF; - UCHAR Control; - } PLAY_AUDIO_MSF; - - struct _BLANK_MEDIA { - UCHAR OperationCode; // 0xA1 - SCSIOP_BLANK - UCHAR BlankType : 3; - UCHAR Reserved1 : 1; - UCHAR Immediate : 1; - UCHAR Reserved2 : 3; - UCHAR AddressOrTrack[4]; - UCHAR Reserved3[5]; - UCHAR Control; - } BLANK_MEDIA; - - struct _PLAY_CD { - UCHAR OperationCode; // 0xBC - SCSIOP_PLAY_CD - UCHAR Reserved1 : 1; - UCHAR CMSF : 1; // LBA = 0, MSF = 1 - UCHAR ExpectedSectorType : 3; - UCHAR Lun : 3; - - union { - struct _LBA { - UCHAR StartingBlockAddress[4]; - UCHAR PlayLength[4]; - } LBA; - - struct _MSF { - UCHAR Reserved1; - UCHAR StartingM; - UCHAR StartingS; - UCHAR StartingF; - UCHAR EndingM; - UCHAR EndingS; - UCHAR EndingF; - UCHAR Reserved2; - } MSF; - }; - - UCHAR Audio : 1; - UCHAR Composite : 1; - UCHAR Port1 : 1; - UCHAR Port2 : 1; - UCHAR Reserved2 : 3; - UCHAR Speed : 1; - UCHAR Control; - } PLAY_CD; - - struct _SCAN_CD { - UCHAR OperationCode; // 0xBA - SCSIOP_SCAN_CD - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 3; - UCHAR Direct : 1; - UCHAR Lun : 3; - UCHAR StartingAddress[4]; - UCHAR Reserved2[3]; - UCHAR Reserved3 : 6; - UCHAR Type : 2; - UCHAR Reserved4; - UCHAR Control; - } SCAN_CD; - - struct _STOP_PLAY_SCAN { - UCHAR OperationCode; // 0x4E - SCSIOP_STOP_PLAY_SCAN - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[7]; - UCHAR Control; - } STOP_PLAY_SCAN; - - - // - // Read SubChannel Data - // - - struct _SUBCHANNEL { - UCHAR OperationCode; // 0x42 - SCSIOP_READ_SUB_CHANNEL - UCHAR Reserved0 : 1; - UCHAR Msf : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2 : 6; - UCHAR SubQ : 1; - UCHAR Reserved3 : 1; - UCHAR Format; - UCHAR Reserved4[2]; - UCHAR TrackNumber; - UCHAR AllocationLength[2]; - UCHAR Control; - } SUBCHANNEL; - - // - // Read CD. Used by Atapi for raw sector reads. - // - - struct _READ_CD { - UCHAR OperationCode; // 0xBE - SCSIOP_READ_CD - UCHAR RelativeAddress : 1; - UCHAR Reserved0 : 1; - UCHAR ExpectedSectorType : 3; - UCHAR Lun : 3; - UCHAR StartingLBA[4]; - UCHAR TransferBlocks[3]; - UCHAR Reserved2 : 1; - UCHAR ErrorFlags : 2; - UCHAR IncludeEDC : 1; - UCHAR IncludeUserData : 1; - UCHAR HeaderCode : 2; - UCHAR IncludeSyncData : 1; - UCHAR SubChannelSelection : 3; - UCHAR Reserved3 : 5; - UCHAR Control; - } READ_CD; - - struct _READ_CD_MSF { - UCHAR OperationCode; // 0xB9 - SCSIOP_READ_CD_MSF - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 1; - UCHAR ExpectedSectorType : 3; - UCHAR Lun : 3; - UCHAR Reserved2; - UCHAR StartingM; - UCHAR StartingS; - UCHAR StartingF; - UCHAR EndingM; - UCHAR EndingS; - UCHAR EndingF; - UCHAR Reserved4 : 1; - UCHAR ErrorFlags : 2; - UCHAR IncludeEDC : 1; - UCHAR IncludeUserData : 1; - UCHAR HeaderCode : 2; - UCHAR IncludeSyncData : 1; - UCHAR SubChannelSelection : 3; - UCHAR Reserved5 : 5; - UCHAR Control; - } READ_CD_MSF; - - // - // Plextor Read CD-DA - // - - struct _PLXTR_READ_CDDA { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR Reserved0 : 5; - UCHAR LogicalUnitNumber :3; - UCHAR LogicalBlockByte0; - UCHAR LogicalBlockByte1; - UCHAR LogicalBlockByte2; - UCHAR LogicalBlockByte3; - UCHAR TransferBlockByte0; - UCHAR TransferBlockByte1; - UCHAR TransferBlockByte2; - UCHAR TransferBlockByte3; - UCHAR SubCode; - UCHAR Control; - } PLXTR_READ_CDDA; - - // - // NEC Read CD-DA - // - - struct _NEC_READ_CDDA { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR Reserved0; - UCHAR LogicalBlockByte0; - UCHAR LogicalBlockByte1; - UCHAR LogicalBlockByte2; - UCHAR LogicalBlockByte3; - UCHAR Reserved1; - UCHAR TransferBlockByte0; - UCHAR TransferBlockByte1; - UCHAR Control; - } NEC_READ_CDDA; - - // - // Mode sense - // - - struct _MODE_SENSE { - UCHAR OperationCode; // 0x1A - SCSIOP_MODE_SENSE - UCHAR Reserved1 : 3; - UCHAR Dbd : 1; - UCHAR Reserved2 : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR PageCode : 6; - UCHAR Pc : 2; - UCHAR Reserved3; - UCHAR AllocationLength; - UCHAR Control; - } MODE_SENSE; - - struct _MODE_SENSE10 { - UCHAR OperationCode; // 0x5A - SCSIOP_MODE_SENSE10 - UCHAR Reserved1 : 3; - UCHAR Dbd : 1; - UCHAR Reserved2 : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR PageCode : 6; - UCHAR Pc : 2; - UCHAR Reserved3[4]; - UCHAR AllocationLength[2]; - UCHAR Control; - } MODE_SENSE10; - - // - // Mode select - // - - struct _MODE_SELECT { - UCHAR OperationCode; // 0x15 - SCSIOP_MODE_SELECT - UCHAR SPBit : 1; - UCHAR Reserved1 : 3; - UCHAR PFBit : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[2]; - UCHAR ParameterListLength; - UCHAR Control; - } MODE_SELECT; - - struct _MODE_SELECT10 { - UCHAR OperationCode; // 0x55 - SCSIOP_MODE_SELECT10 - UCHAR SPBit : 1; - UCHAR Reserved1 : 3; - UCHAR PFBit : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[5]; - UCHAR ParameterListLength[2]; - UCHAR Control; - } MODE_SELECT10; - - struct _LOCATE { - UCHAR OperationCode; // 0x2B - SCSIOP_LOCATE - UCHAR Immediate : 1; - UCHAR CPBit : 1; - UCHAR BTBit : 1; - UCHAR Reserved1 : 2; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved3; - UCHAR LogicalBlockAddress[4]; - UCHAR Reserved4; - UCHAR Partition; - UCHAR Control; - } LOCATE; - - struct _LOGSENSE { - UCHAR OperationCode; // 0x4D - SCSIOP_LOG_SENSE - UCHAR SPBit : 1; - UCHAR PPCBit : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR PageCode : 6; - UCHAR PCBit : 2; - UCHAR Reserved2; - UCHAR Reserved3; - UCHAR ParameterPointer[2]; - UCHAR AllocationLength[2]; - UCHAR Control; - } LOGSENSE; - - struct _LOGSELECT { - UCHAR OperationCode; // 0x4C - SCSIOP_LOG_SELECT - UCHAR SPBit : 1; - UCHAR PCRBit : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved : 6; - UCHAR PCBit : 2; - UCHAR Reserved2[4]; - UCHAR ParameterListLength[2]; - UCHAR Control; - } LOGSELECT; - - struct _PRINT { - UCHAR OperationCode; // 0x0A - SCSIOP_PRINT - UCHAR Reserved : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR TransferLength[3]; - UCHAR Control; - } PRINT; - - struct _SEEK { - UCHAR OperationCode; // 0x2B - SCSIOP_SEEK - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlockAddress[4]; - UCHAR Reserved2[3]; - UCHAR Control; - } SEEK; - - struct _ERASE { - UCHAR OperationCode; // 0x19 - SCSIOP_ERASE - UCHAR Long : 1; - UCHAR Immediate : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[3]; - UCHAR Control; - } ERASE; - - struct _START_STOP { - UCHAR OperationCode; // 0x1B - SCSIOP_START_STOP_UNIT - UCHAR Immediate: 1; - UCHAR Reserved1 : 4; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[2]; - UCHAR Start : 1; - UCHAR LoadEject : 1; - UCHAR Reserved3 : 6; - UCHAR Control; - } START_STOP; - - struct _MEDIA_REMOVAL { - UCHAR OperationCode; // 0x1E - SCSIOP_MEDIUM_REMOVAL - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[2]; - - UCHAR Prevent : 1; - UCHAR Persistant : 1; - UCHAR Reserved3 : 6; - - UCHAR Control; - } MEDIA_REMOVAL; - - // - // Tape CDBs - // - - struct _SEEK_BLOCK { - UCHAR OperationCode; // 0x0C - SCSIOP_SEEK_BLOCK - UCHAR Immediate : 1; - UCHAR Reserved1 : 7; - UCHAR BlockAddress[3]; - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved2 : 4; - UCHAR VendorUnique : 2; - } SEEK_BLOCK; - - struct _REQUEST_BLOCK_ADDRESS { - UCHAR OperationCode; // 0x02 - SCSIOP_REQUEST_BLOCK_ADDR - UCHAR Reserved1[3]; - UCHAR AllocationLength; - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved2 : 4; - UCHAR VendorUnique : 2; - } REQUEST_BLOCK_ADDRESS; - - struct _PARTITION { - UCHAR OperationCode; // 0x0D - SCSIOP_PARTITION - UCHAR Immediate : 1; - UCHAR Sel: 1; - UCHAR PartitionSelect : 6; - UCHAR Reserved1[3]; - UCHAR Control; - } PARTITION; - - struct _WRITE_TAPE_MARKS { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR Immediate : 1; - UCHAR WriteSetMarks: 1; - UCHAR Reserved : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR TransferLength[3]; - UCHAR Control; - } WRITE_TAPE_MARKS; - - struct _SPACE_TAPE_MARKS { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR Code : 3; - UCHAR Reserved : 2; - UCHAR LogicalUnitNumber : 3; - UCHAR NumMarksMSB ; - UCHAR NumMarks; - UCHAR NumMarksLSB; - union { - UCHAR value; - struct { - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved : 4; - UCHAR VendorUnique : 2; - } Fields; - } Byte6; - } SPACE_TAPE_MARKS; - - // - // Read tape position - // - - struct _READ_POSITION { - UCHAR Operation; // 0x43 - SCSIOP_READ_POSITION - UCHAR BlockType:1; - UCHAR Reserved1:4; - UCHAR Lun:3; - UCHAR Reserved2[7]; - UCHAR Control; - } READ_POSITION; - - // - // ReadWrite for Tape - // - - struct _CDB6READWRITETAPE { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR VendorSpecific : 5; - UCHAR Reserved : 3; - UCHAR TransferLenMSB; - UCHAR TransferLen; - UCHAR TransferLenLSB; - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved1 : 4; - UCHAR VendorUnique : 2; - } CDB6READWRITETAPE; - - // - // Medium changer CDB's - // - - struct _INIT_ELEMENT_STATUS { - UCHAR OperationCode; // 0x07 - SCSIOP_INIT_ELEMENT_STATUS - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNubmer : 3; - UCHAR Reserved2[3]; - UCHAR Reserved3 : 7; - UCHAR NoBarCode : 1; - } INIT_ELEMENT_STATUS; - - struct _INITIALIZE_ELEMENT_RANGE { - UCHAR OperationCode; // 0xE7 - SCSIOP_INIT_ELEMENT_RANGE - UCHAR Range : 1; - UCHAR Reserved1 : 4; - UCHAR LogicalUnitNubmer : 3; - UCHAR FirstElementAddress[2]; - UCHAR Reserved2[2]; - UCHAR NumberOfElements[2]; - UCHAR Reserved3; - UCHAR Reserved4 : 7; - UCHAR NoBarCode : 1; - } INITIALIZE_ELEMENT_RANGE; - - struct _POSITION_TO_ELEMENT { - UCHAR OperationCode; // 0x2B - SCSIOP_POSITION_TO_ELEMENT - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR TransportElementAddress[2]; - UCHAR DestinationElementAddress[2]; - UCHAR Reserved2[2]; - UCHAR Flip : 1; - UCHAR Reserved3 : 7; - UCHAR Control; - } POSITION_TO_ELEMENT; - - struct _MOVE_MEDIUM { - UCHAR OperationCode; // 0xA5 - SCSIOP_MOVE_MEDIUM - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR TransportElementAddress[2]; - UCHAR SourceElementAddress[2]; - UCHAR DestinationElementAddress[2]; - UCHAR Reserved2[2]; - UCHAR Flip : 1; - UCHAR Reserved3 : 7; - UCHAR Control; - } MOVE_MEDIUM; - - struct _EXCHANGE_MEDIUM { - UCHAR OperationCode; // 0xA6 - SCSIOP_EXCHANGE_MEDIUM - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR TransportElementAddress[2]; - UCHAR SourceElementAddress[2]; - UCHAR Destination1ElementAddress[2]; - UCHAR Destination2ElementAddress[2]; - UCHAR Flip1 : 1; - UCHAR Flip2 : 1; - UCHAR Reserved3 : 6; - UCHAR Control; - } EXCHANGE_MEDIUM; - - struct _READ_ELEMENT_STATUS { - UCHAR OperationCode; // 0xB8 - SCSIOP_READ_ELEMENT_STATUS - UCHAR ElementType : 4; - UCHAR VolTag : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR StartingElementAddress[2]; - UCHAR NumberOfElements[2]; - UCHAR Reserved1; - UCHAR AllocationLength[3]; - UCHAR Reserved2; - UCHAR Control; - } READ_ELEMENT_STATUS; - - struct _SEND_VOLUME_TAG { - UCHAR OperationCode; // 0xB6 - SCSIOP_SEND_VOLUME_TAG - UCHAR ElementType : 4; - UCHAR Reserved1 : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR StartingElementAddress[2]; - UCHAR Reserved2; - UCHAR ActionCode : 5; - UCHAR Reserved3 : 3; - UCHAR Reserved4[2]; - UCHAR ParameterListLength[2]; - UCHAR Reserved5; - UCHAR Control; - } SEND_VOLUME_TAG; - - struct _REQUEST_VOLUME_ELEMENT_ADDRESS { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR ElementType : 4; - UCHAR VolTag : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR StartingElementAddress[2]; - UCHAR NumberElements[2]; - UCHAR Reserved1; - UCHAR AllocationLength[3]; - UCHAR Reserved2; - UCHAR Control; - } REQUEST_VOLUME_ELEMENT_ADDRESS; - - // - // Atapi 2.5 Changer 12-byte CDBs - // - - struct _LOAD_UNLOAD { - UCHAR OperationCode; // 0xA6 - SCSIOP_LOAD_UNLOAD_SLOT - UCHAR Immediate : 1; - UCHAR Reserved1 : 4; - UCHAR Lun : 3; - UCHAR Reserved2[2]; - UCHAR Start : 1; - UCHAR LoadEject : 1; - UCHAR Reserved3: 6; - UCHAR Reserved4[3]; - UCHAR Slot; - UCHAR Reserved5[3]; - } LOAD_UNLOAD; - - struct _MECH_STATUS { - UCHAR OperationCode; // 0xBD - SCSIOP_MECHANISM_STATUS - UCHAR Reserved : 5; - UCHAR Lun : 3; - UCHAR Reserved1[6]; - UCHAR AllocationLength[2]; - UCHAR Reserved2[1]; - UCHAR Control; - } MECH_STATUS; - - // - // C/DVD 0.9 CDBs - // - - struct _SYNCHRONIZE_CACHE10 { - - UCHAR OperationCode; // 0x35 - SCSIOP_SYNCHRONIZE_CACHE - - UCHAR RelAddr : 1; - UCHAR Immediate : 1; - UCHAR Reserved : 3; - UCHAR Lun : 3; - - UCHAR LogicalBlockAddress[4]; // Unused - set to zero - UCHAR Reserved2; - UCHAR BlockCount[2]; // Unused - set to zero - UCHAR Control; - } SYNCHRONIZE_CACHE10; - - struct _GET_EVENT_STATUS_NOTIFICATION { - UCHAR OperationCode; // 0x4A - SCSIOP_GET_EVENT_STATUS_NOTIFICATION - - UCHAR Immediate : 1; - UCHAR Reserved : 4; - UCHAR Lun : 3; - - UCHAR Reserved2[2]; - UCHAR NotificationClassRequest; - UCHAR Reserved3[2]; - UCHAR EventListLength[2]; - - UCHAR Control; - } GET_EVENT_STATUS_NOTIFICATION; - - struct _GET_PERFORMANCE { - UCHAR OperationCode; // 0xAC - SCSIOP_GET_PERFORMANCE - UCHAR Except : 2; - UCHAR Write : 1; - UCHAR Tolerance : 2; - UCHAR Reserved0 : 3; - UCHAR StartingLBA[4]; - UCHAR Reserved1[2]; - UCHAR MaximumNumberOfDescriptors[2]; - UCHAR Type; - UCHAR Control; - } GET_PERFORMANCE; - - struct _READ_DVD_STRUCTURE { - UCHAR OperationCode; // 0xAD - SCSIOP_READ_DVD_STRUCTURE - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR RMDBlockNumber[4]; - UCHAR LayerNumber; - UCHAR Format; - UCHAR AllocationLength[2]; - UCHAR Reserved3 : 6; - UCHAR AGID : 2; - UCHAR Control; - } READ_DVD_STRUCTURE; - - struct _SET_STREAMING { - UCHAR OperationCode; // 0xB6 - SCSIOP_SET_STREAMING - UCHAR Reserved[8]; - UCHAR ParameterListLength[2]; - UCHAR Control; - } SET_STREAMING; - - struct _SEND_DVD_STRUCTURE { - UCHAR OperationCode; // 0xBF - SCSIOP_SEND_DVD_STRUCTURE - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[5]; - UCHAR Format; - UCHAR ParameterListLength[2]; - UCHAR Reserved3; - UCHAR Control; - } SEND_DVD_STRUCTURE; - - struct _SEND_KEY { - UCHAR OperationCode; // 0xA3 - SCSIOP_SEND_KEY - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[6]; - UCHAR ParameterListLength[2]; - UCHAR KeyFormat : 6; - UCHAR AGID : 2; - UCHAR Control; - } SEND_KEY; - - struct _REPORT_KEY { - UCHAR OperationCode; // 0xA4 - SCSIOP_REPORT_KEY - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR LogicalBlockAddress[4]; // for title key - UCHAR Reserved2[2]; - UCHAR AllocationLength[2]; - UCHAR KeyFormat : 6; - UCHAR AGID : 2; - UCHAR Control; - } REPORT_KEY; - - struct _SET_READ_AHEAD { - UCHAR OperationCode; // 0xA7 - SCSIOP_SET_READ_AHEAD - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR TriggerLBA[4]; - UCHAR ReadAheadLBA[4]; - UCHAR Reserved2; - UCHAR Control; - } SET_READ_AHEAD; - - struct _READ_FORMATTED_CAPACITIES { - UCHAR OperationCode; // 0x23 - SCSIOP_READ_FORMATTED_CAPACITY - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[5]; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_FORMATTED_CAPACITIES; - - // - // SCSI-3 - // - - struct _REPORT_LUNS { - UCHAR OperationCode; // 0xA0 - SCSIOP_REPORT_LUNS - UCHAR Reserved1[5]; - UCHAR AllocationLength[4]; - UCHAR Reserved2[1]; - UCHAR Control; - } REPORT_LUNS; - - struct _PERSISTENT_RESERVE_IN { - UCHAR OperationCode; // 0x5E - SCSIOP_PERSISTENT_RESERVE_IN - UCHAR ServiceAction : 5; - UCHAR Reserved1 : 3; - UCHAR Reserved2[5]; - UCHAR AllocationLength[2]; - UCHAR Control; - } PERSISTENT_RESERVE_IN; - - struct _PERSISTENT_RESERVE_OUT { - UCHAR OperationCode; // 0x5F - SCSIOP_PERSISTENT_RESERVE_OUT - UCHAR ServiceAction : 5; - UCHAR Reserved1 : 3; - UCHAR Type : 4; - UCHAR Scope : 4; - UCHAR Reserved2[4]; - UCHAR ParameterListLength[2]; // 0x18 - UCHAR Control; - } PERSISTENT_RESERVE_OUT; - - // - // MMC / SFF-8090 commands - // - - struct _GET_CONFIGURATION { - UCHAR OperationCode; // 0x46 - SCSIOP_GET_CONFIGURATION - UCHAR RequestType : 2; // SCSI_GET_CONFIGURATION_REQUEST_TYPE_* - UCHAR Reserved1 : 6; // includes obsolete LUN field - UCHAR StartingFeature[2]; - UCHAR Reserved2[3]; - UCHAR AllocationLength[2]; - UCHAR Control; - } GET_CONFIGURATION; - - struct _SET_CD_SPEED { - UCHAR OperationCode; // 0xB8 - SCSIOP_SET_CD_SPEED - union { - UCHAR Reserved1; - struct { - UCHAR RotationControl : 2; - UCHAR Reserved3 : 6; - }; - }; - UCHAR ReadSpeed[2]; // 1x == (75 * 2352) - UCHAR WriteSpeed[2]; // 1x == (75 * 2352) - UCHAR Reserved2[5]; - UCHAR Control; - } SET_CD_SPEED; - - struct _READ12 { - UCHAR OperationCode; // 0xA8 - SCSIOP_READ12 - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 2; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlock[4]; - UCHAR TransferLength[4]; - UCHAR Reserved2 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } READ12; - - struct _WRITE12 { - UCHAR OperationCode; // 0xAA - SCSIOP_WRITE12 - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 1; - UCHAR EBP : 1; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlock[4]; - UCHAR TransferLength[4]; - UCHAR Reserved2 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } WRITE12; - - // - // 16-byte CDBs - // - - struct _READ16 { - UCHAR OperationCode; // 0x88 - SCSIOP_READ16 - UCHAR Reserved1 : 3; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR ReadProtect : 3; - UCHAR LogicalBlock[8]; - UCHAR TransferLength[4]; - UCHAR Reserved2 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } READ16; - - struct _WRITE16 { - UCHAR OperationCode; // 0x8A - SCSIOP_WRITE16 - UCHAR Reserved1 : 3; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR WriteProtect : 3; - UCHAR LogicalBlock[8]; - UCHAR TransferLength[4]; - UCHAR Reserved2 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } WRITE16; - - struct _VERIFY16 { - UCHAR OperationCode; // 0x8F - SCSIOP_VERIFY16 - UCHAR Reserved1 : 1; - UCHAR ByteCheck : 1; - UCHAR BlockVerify : 1; - UCHAR Reserved2 : 1; - UCHAR DisablePageOut : 1; - UCHAR VerifyProtect : 3; - UCHAR LogicalBlock[8]; - UCHAR VerificationLength[4]; - UCHAR Reserved3 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } VERIFY16; - - struct _SYNCHRONIZE_CACHE16 { - UCHAR OperationCode; // 0x91 - SCSIOP_SYNCHRONIZE_CACHE16 - UCHAR Reserved1 : 1; - UCHAR Immediate : 1; - UCHAR Reserved2 : 6; - UCHAR LogicalBlock[8]; - UCHAR BlockCount[4]; - UCHAR Reserved3; - UCHAR Control; - } SYNCHRONIZE_CACHE16; - - struct _READ_CAPACITY16 { - UCHAR OperationCode; // 0x9E - SCSIOP_READ_CAPACITY16 - UCHAR ServiceAction : 5; - UCHAR Reserved1 : 3; - UCHAR LogicalBlock[8]; - UCHAR BlockCount[4]; - UCHAR PMI : 1; - UCHAR Reserved2 : 7; - UCHAR Control; - } READ_CAPACITY16; - - ULONG AsUlong[4]; - UCHAR AsByte[16]; - -} CDB, *PCDB; -#pragma pack(pop, cdb) - -//////////////////////////////////////////////////////////////////////////////// -// -// GET_EVENT_STATUS_NOTIFICATION -// - - -#define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_MASK 0x02 -#define NOTIFICATION_POWER_MANAGEMENT_CLASS_MASK 0x04 -#define NOTIFICATION_EXTERNAL_REQUEST_CLASS_MASK 0x08 -#define NOTIFICATION_MEDIA_STATUS_CLASS_MASK 0x10 -#define NOTIFICATION_MULTI_HOST_CLASS_MASK 0x20 -#define NOTIFICATION_DEVICE_BUSY_CLASS_MASK 0x40 - - -#define NOTIFICATION_NO_CLASS_EVENTS 0x0 -#define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_EVENTS 0x1 -#define NOTIFICATION_POWER_MANAGEMENT_CLASS_EVENTS 0x2 -#define NOTIFICATION_EXTERNAL_REQUEST_CLASS_EVENTS 0x3 -#define NOTIFICATION_MEDIA_STATUS_CLASS_EVENTS 0x4 -#define NOTIFICATION_MULTI_HOST_CLASS_EVENTS 0x5 -#define NOTIFICATION_DEVICE_BUSY_CLASS_EVENTS 0x6 - -#pragma pack(push, not_header, 1) -typedef struct _NOTIFICATION_EVENT_STATUS_HEADER { - UCHAR EventDataLength[2]; - - UCHAR NotificationClass : 3; - UCHAR Reserved : 4; - UCHAR NEA : 1; - - UCHAR SupportedEventClasses; -#if !defined(__midl) - UCHAR ClassEventData[0]; -#endif -} NOTIFICATION_EVENT_STATUS_HEADER, *PNOTIFICATION_EVENT_STATUS_HEADER; -#pragma pack(pop, not_header) - -#define NOTIFICATION_OPERATIONAL_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_REQUESTED 0x1 -#define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_OCCURRED 0x2 - -#define NOTIFICATION_OPERATIONAL_STATUS_AVAILABLE 0x0 -#define NOTIFICATION_OPERATIONAL_STATUS_TEMPORARY_BUSY 0x1 -#define NOTIFICATION_OPERATIONAL_STATUS_EXTENDED_BUSY 0x2 - -#define NOTIFICATION_OPERATIONAL_OPCODE_NONE 0x0 -#define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_CHANGE 0x1 -#define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_ADDED 0x2 -#define NOTIFICATION_OPERATIONAL_OPCODE_UNIT_RESET 0x3 -#define NOTIFICATION_OPERATIONAL_OPCODE_FIRMWARE_CHANGED 0x4 -#define NOTIFICATION_OPERATIONAL_OPCODE_INQUIRY_CHANGED 0x5 - -// -// Class event data may be one (or none) of the following: -// - -#pragma pack(push, not_op, 1) -typedef struct _NOTIFICATION_OPERATIONAL_STATUS { // event class == 0x1 - UCHAR OperationalEvent : 4; - UCHAR Reserved1 : 4; - UCHAR OperationalStatus : 4; - UCHAR Reserved2 : 3; - UCHAR PersistentPrevented : 1; - UCHAR Operation[2]; -} NOTIFICATION_OPERATIONAL_STATUS, *PNOTIFICATION_OPERATIONAL_STATUS; -#pragma pack(pop, not_op) - - -#define NOTIFICATION_POWER_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_POWER_EVENT_CHANGE_SUCCEEDED 0x1 -#define NOTIFICATION_POWER_EVENT_CHANGE_FAILED 0x2 - -#define NOTIFICATION_POWER_STATUS_ACTIVE 0x1 -#define NOTIFICATION_POWER_STATUS_IDLE 0x2 -#define NOTIFICATION_POWER_STATUS_STANDBY 0x3 -#define NOTIFICATION_POWER_STATUS_SLEEP 0x4 - -#pragma pack(push, not_power, 1) -typedef struct _NOTIFICATION_POWER_STATUS { // event class == 0x2 - UCHAR PowerEvent : 4; - UCHAR Reserved : 4; - UCHAR PowerStatus; - UCHAR Reserved2[2]; -} NOTIFICATION_POWER_STATUS, *PNOTIFICATION_POWER_STATUS; -#pragma pack(pop, not_power) - -#define NOTIFICATION_MEDIA_EVENT_NO_EVENT 0x0 -#define NOTIFICATION_EXTERNAL_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_EXTERNAL_EVENT_BUTTON_DOWN 0x1 -#define NOTIFICATION_EXTERNAL_EVENT_BUTTON_UP 0x2 -#define NOTIFICATION_EXTERNAL_EVENT_EXTERNAL 0x3 // respond with GET_CONFIGURATION? - -#define NOTIFICATION_EXTERNAL_STATUS_READY 0x0 -#define NOTIFICATION_EXTERNAL_STATUS_PREVENT 0x1 - -#define NOTIFICATION_EXTERNAL_REQUEST_NONE 0x0000 -#define NOTIFICATION_EXTERNAL_REQUEST_QUEUE_OVERRUN 0x0001 -#define NOTIFICATION_EXTERNAL_REQUEST_PLAY 0x0101 -#define NOTIFICATION_EXTERNAL_REQUEST_REWIND_BACK 0x0102 -#define NOTIFICATION_EXTERNAL_REQUEST_FAST_FORWARD 0x0103 -#define NOTIFICATION_EXTERNAL_REQUEST_PAUSE 0x0104 -#define NOTIFICATION_EXTERNAL_REQUEST_STOP 0x0106 -#define NOTIFICATION_EXTERNAL_REQUEST_ASCII_LOW 0x0200 -#define NOTIFICATION_EXTERNAL_REQUEST_ASCII_HIGH 0x02ff - -#pragma pack(push, not_extern, 1) -typedef struct _NOTIFICATION_EXTERNAL_STATUS { // event class == 0x3 - UCHAR ExternalEvent : 4; - UCHAR Reserved1 : 4; - UCHAR ExternalStatus : 4; - UCHAR Reserved2 : 3; - UCHAR PersistentPrevented : 1; - UCHAR Request[2]; -} NOTIFICATION_EXTERNAL_STATUS, *PNOTIFICATION_EXTERNAL_STATUS; -#pragma pack(pop, not_extern) - -#define NOTIFICATION_MEDIA_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_MEDIA_EVENT_EJECT_REQUEST 0x1 -#define NOTIFICATION_MEDIA_EVENT_NEW_MEDIA 0x2 -#define NOTIFICATION_MEDIA_EVENT_MEDIA_REMOVAL 0x3 -#define NOTIFICATION_MEDIA_EVENT_MEDIA_CHANGE 0x4 - -#pragma pack(push, not_media, 1) -typedef struct _NOTIFICATION_MEDIA_STATUS { // event class == 0x4 - UCHAR MediaEvent : 4; - UCHAR Reserved : 4; - - union { - UCHAR PowerStatus; // OBSOLETE -- was improperly named in NT5 headers - UCHAR MediaStatus; // Use this for currently reserved fields - struct { - UCHAR DoorTrayOpen : 1; - UCHAR MediaPresent : 1; - UCHAR ReservedX : 6; // do not reference this directly! - }; - }; - UCHAR StartSlot; - UCHAR EndSlot; -} NOTIFICATION_MEDIA_STATUS, *PNOTIFICATION_MEDIA_STATUS; -#pragma pack(pop, not_media) - -#define NOTIFICATION_BUSY_EVENT_NO_EVENT 0x0 -#define NOTIFICATION_MULTI_HOST_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_REQUEST 0x1 -#define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_GRANT 0x2 -#define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_RELEASE 0x3 - -#define NOTIFICATION_MULTI_HOST_STATUS_READY 0x0 -#define NOTIFICATION_MULTI_HOST_STATUS_PREVENT 0x1 - -#define NOTIFICATION_MULTI_HOST_PRIORITY_NO_REQUESTS 0x0 -#define NOTIFICATION_MULTI_HOST_PRIORITY_LOW 0x1 -#define NOTIFICATION_MULTI_HOST_PRIORITY_MEDIUM 0x2 -#define NOTIFICATION_MULTI_HOST_PRIORITY_HIGH 0x3 - -#pragma pack(push, not_multi, 1) -typedef struct _NOTIFICATION_MULTI_HOST_STATUS { // event class == 0x5 - UCHAR MultiHostEvent : 4; - UCHAR Reserved1 : 4; - UCHAR MultiHostStatus : 4; - UCHAR Reserved2 : 3; - UCHAR PersistentPrevented : 1; - UCHAR Priority[2]; -} NOTIFICATION_MULTI_HOST_STATUS, *PNOTIFICATION_MULTI_HOST_STATUS; -#pragma pack(pop, not_multi) - -#define NOTIFICATION_BUSY_EVENT_NO_EVENT 0x0 -#define NOTIFICATION_BUSY_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_BUSY_EVENT_BUSY 0x1 - -#define NOTIFICATION_BUSY_STATUS_NO_EVENT 0x0 -#define NOTIFICATION_BUSY_STATUS_POWER 0x1 -#define NOTIFICATION_BUSY_STATUS_IMMEDIATE 0x2 -#define NOTIFICATION_BUSY_STATUS_DEFERRED 0x3 - -#pragma pack(push, not_busy, 1) -typedef struct _NOTIFICATION_BUSY_STATUS { // event class == 0x6 - UCHAR DeviceBusyEvent : 4; - UCHAR Reserved : 4; - - UCHAR DeviceBusyStatus; - UCHAR Time[2]; -} NOTIFICATION_BUSY_STATUS, *PNOTIFICATION_BUSY_STATUS; -#pragma pack(pop, not_busy) - -//////////////////////////////////////////////////////////////////////////////// - -// -// Read DVD Structure Definitions and Constants -// - -#define DVD_FORMAT_LEAD_IN 0x00 -#define DVD_FORMAT_COPYRIGHT 0x01 -#define DVD_FORMAT_DISK_KEY 0x02 -#define DVD_FORMAT_BCA 0x03 -#define DVD_FORMAT_MANUFACTURING 0x04 - -#pragma pack(push, dvd_struct_header, 1) -typedef struct _READ_DVD_STRUCTURES_HEADER { - UCHAR Length[2]; - UCHAR Reserved[2]; - -#if !defined(__midl) - UCHAR Data[0]; -#endif -} READ_DVD_STRUCTURES_HEADER, *PREAD_DVD_STRUCTURES_HEADER; -#pragma pack(pop, dvd_struct_header) - -// -// DiskKey, BCA & Manufacturer information will provide byte arrays as their -// data. -// - -// -// CDVD 0.9 Send & Report Key Definitions and Structures -// - -#define DVD_REPORT_AGID 0x00 -#define DVD_CHALLENGE_KEY 0x01 -#define DVD_KEY_1 0x02 -#define DVD_KEY_2 0x03 -#define DVD_TITLE_KEY 0x04 -#define DVD_REPORT_ASF 0x05 -#define DVD_INVALIDATE_AGID 0x3F - -#pragma pack(push, dvdstuff, 1) -typedef struct _CDVD_KEY_HEADER { - UCHAR DataLength[2]; - UCHAR Reserved[2]; -#if !defined(__midl) - UCHAR Data[0]; -#endif -} CDVD_KEY_HEADER, *PCDVD_KEY_HEADER; - -typedef struct _CDVD_REPORT_AGID_DATA { - UCHAR Reserved1[3]; - UCHAR Reserved2 : 6; - UCHAR AGID : 2; -} CDVD_REPORT_AGID_DATA, *PCDVD_REPORT_AGID_DATA; - -typedef struct _CDVD_CHALLENGE_KEY_DATA { - UCHAR ChallengeKeyValue[10]; - UCHAR Reserved[2]; -} CDVD_CHALLENGE_KEY_DATA, *PCDVD_CHALLENGE_KEY_DATA; - -typedef struct _CDVD_KEY_DATA { - UCHAR Key[5]; - UCHAR Reserved[3]; -} CDVD_KEY_DATA, *PCDVD_KEY_DATA; - -typedef struct _CDVD_REPORT_ASF_DATA { - UCHAR Reserved1[3]; - UCHAR Success : 1; - UCHAR Reserved2 : 7; -} CDVD_REPORT_ASF_DATA, *PCDVD_REPORT_ASF_DATA; - -typedef struct _CDVD_TITLE_KEY_HEADER { - UCHAR DataLength[2]; - UCHAR Reserved1[1]; - UCHAR Reserved2 : 3; - UCHAR CGMS : 2; - UCHAR CP_SEC : 1; - UCHAR CPM : 1; - UCHAR Zero : 1; - CDVD_KEY_DATA TitleKey; -} CDVD_TITLE_KEY_HEADER, *PCDVD_TITLE_KEY_HEADER; -#pragma pack(pop, dvdstuff) - - -// -// Format Unit Data definitions and structures -// - -#pragma pack(push, format_unit, 1) -typedef struct _FORMAT_DESCRIPTOR { - UCHAR NumberOfBlocks[4]; - UCHAR FormatSubType : 2; - UCHAR FormatType : 6; - UCHAR BlockLength[3]; -} FORMAT_DESCRIPTOR, *PFORMAT_DESCRIPTOR; - -typedef struct _FORMAT_LIST_HEADER { - UCHAR Reserved; - UCHAR VendorSpecific : 1; - UCHAR Immediate : 1; - UCHAR TryOut : 1; - UCHAR IP : 1; - UCHAR STPF : 1; - UCHAR DCRT : 1; - UCHAR DPRY : 1; - UCHAR FOV : 1; - UCHAR FormatDescriptorLength[2]; -#if !defined(__midl) - FORMAT_DESCRIPTOR Descriptors[0]; -#endif -} FORMAT_LIST_HEADER, *PFORMAT_LIST_HEADER; -#pragma pack(pop, format_unit) - -// -// Read Formatted Capacity Data - returned in Big Endian Format -// - - -#pragma pack(push, formatted_capacity, 1) -typedef struct _FORMATTED_CAPACITY_DESCRIPTOR { - UCHAR NumberOfBlocks[4]; - UCHAR Maximum : 1; - UCHAR Valid : 1; - UCHAR FormatType : 6; - UCHAR BlockLength[3]; -} FORMATTED_CAPACITY_DESCRIPTOR, *PFORMATTED_CAPACITY_DESCRIPTOR; - -typedef struct _FORMATTED_CAPACITY_LIST { - UCHAR Reserved[3]; - UCHAR CapacityListLength; -#if !defined(__midl) - FORMATTED_CAPACITY_DESCRIPTOR Descriptors[0]; -#endif -} FORMATTED_CAPACITY_LIST, *PFORMATTED_CAPACITY_LIST; -#pragma pack(pop, formatted_capacity) - -// -// BLANK command blanking type codes -// - -#define BLANK_FULL 0x0 -#define BLANK_MINIMAL 0x1 -#define BLANK_TRACK 0x2 -#define BLANK_UNRESERVE_TRACK 0x3 -#define BLANK_TAIL 0x4 -#define BLANK_UNCLOSE_SESSION 0x5 -#define BLANK_SESSION 0x6 - -// -// PLAY_CD definitions and constants -// - -#define CD_EXPECTED_SECTOR_ANY 0x0 -#define CD_EXPECTED_SECTOR_CDDA 0x1 -#define CD_EXPECTED_SECTOR_MODE1 0x2 -#define CD_EXPECTED_SECTOR_MODE2 0x3 -#define CD_EXPECTED_SECTOR_MODE2_FORM1 0x4 -#define CD_EXPECTED_SECTOR_MODE2_FORM2 0x5 - -// -// Read Disk Information Definitions and Capabilities -// - -#define DISK_STATUS_EMPTY 0x00 -#define DISK_STATUS_INCOMPLETE 0x01 -#define DISK_STATUS_COMPLETE 0x02 -#define DISK_STATUS_OTHERS 0x03 - -#define LAST_SESSION_EMPTY 0x00 -#define LAST_SESSION_INCOMPLETE 0x01 -#define LAST_SESSION_RESERVED_DAMAGED 0x02 -#define LAST_SESSION_COMPLETE 0x03 - -#define DISK_TYPE_CDDA 0x00 -#define DISK_TYPE_CDI 0x10 -#define DISK_TYPE_XA 0x20 -#define DISK_TYPE_UNDEFINED 0xFF - -// -// Values for MrwStatus field. -// - -#define DISC_BGFORMAT_STATE_NONE 0x0 -#define DISC_BGFORMAT_STATE_INCOMPLETE 0x1 -#define DISC_BGFORMAT_STATE_RUNNING 0x2 -#define DISC_BGFORMAT_STATE_COMPLETE 0x3 - - -#pragma pack(push, discinfo, 1) -typedef struct _OPC_TABLE_ENTRY { - UCHAR Speed[2]; - UCHAR OPCValue[6]; -} OPC_TABLE_ENTRY, *POPC_TABLE_ENTRY; - -typedef struct _DISC_INFORMATION { - - UCHAR Length[2]; - UCHAR DiscStatus : 2; - UCHAR LastSessionStatus : 2; - UCHAR Erasable : 1; - UCHAR Reserved1 : 3; - UCHAR FirstTrackNumber; - - UCHAR NumberOfSessionsLsb; - UCHAR LastSessionFirstTrackLsb; - UCHAR LastSessionLastTrackLsb; - UCHAR MrwStatus : 2; - UCHAR MrwDirtyBit : 1; - UCHAR Reserved2 : 2; - UCHAR URU : 1; - UCHAR DBC_V : 1; - UCHAR DID_V : 1; - - UCHAR DiscType; - UCHAR NumberOfSessionsMsb; - UCHAR LastSessionFirstTrackMsb; - UCHAR LastSessionLastTrackMsb; - - UCHAR DiskIdentification[4]; - UCHAR LastSessionLeadIn[4]; // HMSF - UCHAR LastPossibleLeadOutStartTime[4]; // HMSF - UCHAR DiskBarCode[8]; - - UCHAR Reserved4; - UCHAR NumberOPCEntries; - OPC_TABLE_ENTRY OPCTable[ 1 ]; // can be many of these here.... - -} DISC_INFORMATION, *PDISC_INFORMATION; - -// TODO: Deprecate DISK_INFORMATION -//#if PRAGMA_DEPRECATED_DDK -//#pragma deprecated(_DISK_INFORMATION) // Use DISC_INFORMATION, note size change -//#pragma deprecated( DISK_INFORMATION) // Use DISC_INFORMATION, note size change -//#pragma deprecated(PDISK_INFORMATION) // Use DISC_INFORMATION, note size change -//#endif - -typedef struct _DISK_INFORMATION { - UCHAR Length[2]; - - UCHAR DiskStatus : 2; - UCHAR LastSessionStatus : 2; - UCHAR Erasable : 1; - UCHAR Reserved1 : 3; - - UCHAR FirstTrackNumber; - UCHAR NumberOfSessions; - UCHAR LastSessionFirstTrack; - UCHAR LastSessionLastTrack; - - UCHAR Reserved2 : 5; - UCHAR GEN : 1; - UCHAR DBC_V : 1; - UCHAR DID_V : 1; - - UCHAR DiskType; - UCHAR Reserved3[3]; - - UCHAR DiskIdentification[4]; - UCHAR LastSessionLeadIn[4]; // MSF - UCHAR LastPossibleStartTime[4]; // MSF - UCHAR DiskBarCode[8]; - - UCHAR Reserved4; - UCHAR NumberOPCEntries; -#if !defined(__midl) - OPC_TABLE_ENTRY OPCTable[0]; -#endif -} DISK_INFORMATION, *PDISK_INFORMATION; -#pragma pack(pop, discinfo) - - -// -// Read Header definitions and structures -// -#pragma pack(push, cdheader, 1) -typedef struct _DATA_BLOCK_HEADER { - UCHAR DataMode; - UCHAR Reserved[4]; - union { - UCHAR LogicalBlockAddress[4]; - struct { - UCHAR Reserved; - UCHAR M; - UCHAR S; - UCHAR F; - } MSF; - }; -} DATA_BLOCK_HEADER, *PDATA_BLOCK_HEADER; -#pragma pack(pop, cdheader) - - -#define DATA_BLOCK_MODE0 0x0 -#define DATA_BLOCK_MODE1 0x1 -#define DATA_BLOCK_MODE2 0x2 - -// -// Read TOC Format Codes -// - -#define READ_TOC_FORMAT_TOC 0x00 -#define READ_TOC_FORMAT_SESSION 0x01 -#define READ_TOC_FORMAT_FULL_TOC 0x02 -#define READ_TOC_FORMAT_PMA 0x03 -#define READ_TOC_FORMAT_ATIP 0x04 - -// TODO: Deprecate TRACK_INFORMATION structure, use TRACK_INFORMATION2 instead -#pragma pack(push, track_info, 1) -typedef struct _TRACK_INFORMATION { - UCHAR Length[2]; - UCHAR TrackNumber; - UCHAR SessionNumber; - UCHAR Reserved1; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR Damage : 1; - UCHAR Reserved2 : 2; - UCHAR DataMode : 4; - UCHAR FP : 1; - UCHAR Packet : 1; - UCHAR Blank : 1; - UCHAR RT : 1; - UCHAR NWA_V : 1; - UCHAR Reserved3 : 7; - UCHAR TrackStartAddress[4]; - UCHAR NextWritableAddress[4]; - UCHAR FreeBlocks[4]; - UCHAR FixedPacketSize[4]; -} TRACK_INFORMATION, *PTRACK_INFORMATION; - -// Second Revision Modifies: -// * Longer names for some fields -// * LSB to track/session number fields -// * LRA_V bit -// Second Revision Adds: -// * TrackSize -// * LastRecordedAddress -// * MSB to track/session -// * Two reserved bytes -// Total structure size increased by 12 (0x0C) bytes -typedef struct _TRACK_INFORMATION2 { - - UCHAR Length[2]; - UCHAR TrackNumberLsb; - UCHAR SessionNumberLsb; - - UCHAR Reserved4; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR Damage : 1; - UCHAR Reserved5 : 2; - UCHAR DataMode : 4; - UCHAR FixedPacket : 1; - UCHAR Packet : 1; - UCHAR Blank : 1; - UCHAR ReservedTrack : 1; - UCHAR NWA_V : 1; - UCHAR LRA_V : 1; - UCHAR Reserved6 : 6; - - UCHAR TrackStartAddress[4]; - UCHAR NextWritableAddress[4]; - UCHAR FreeBlocks[4]; - UCHAR FixedPacketSize[4]; // blocking factor - UCHAR TrackSize[4]; - UCHAR LastRecordedAddress[4]; - - UCHAR TrackNumberMsb; - UCHAR SessionNumberMsb; - UCHAR Reserved7[2]; - -} TRACK_INFORMATION2, *PTRACK_INFORMATION2; - -// Third Revision Adds -// * ReadCompatibilityLBA -// Total structure size increased by 4 bytes -typedef struct _TRACK_INFORMATION3 { - - UCHAR Length[2]; - UCHAR TrackNumberLsb; - UCHAR SessionNumberLsb; - - UCHAR Reserved4; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR Damage : 1; - UCHAR Reserved5 : 2; - UCHAR DataMode : 4; - UCHAR FixedPacket : 1; - UCHAR Packet : 1; - UCHAR Blank : 1; - UCHAR ReservedTrack : 1; - UCHAR NWA_V : 1; - UCHAR LRA_V : 1; - UCHAR Reserved6 : 6; - - UCHAR TrackStartAddress[4]; - UCHAR NextWritableAddress[4]; - UCHAR FreeBlocks[4]; - UCHAR FixedPacketSize[4]; // blocking factor - UCHAR TrackSize[4]; - UCHAR LastRecordedAddress[4]; - - UCHAR TrackNumberMsb; - UCHAR SessionNumberMsb; - UCHAR Reserved7[2]; - UCHAR ReadCompatibilityLba[4]; - -} TRACK_INFORMATION3, *PTRACK_INFORMATION3; - -#pragma pack(pop, track_info) - -#pragma pack(push, perf_descriptor, 1) -typedef struct _PERFORMANCE_DESCRIPTOR { - - UCHAR RandomAccess : 1; - UCHAR Exact : 1; - UCHAR RestoreDefaults : 1; - UCHAR WriteRotationControl : 2; - UCHAR Reserved1 : 3; - - UCHAR Reserved[3]; - UCHAR StartLba[4]; - UCHAR EndLba[4]; - UCHAR ReadSize[4]; - UCHAR ReadTime[4]; - UCHAR WriteSize[4]; - UCHAR WriteTime[4]; - -} PERFORMANCE_DESCRIPTOR, *PPERFORMANCE_DESCRIPTOR; -#pragma pack(pop, perf_descriptor) - -// -// Command Descriptor Block constants. -// - -#define CDB6GENERIC_LENGTH 6 -#define CDB10GENERIC_LENGTH 10 -#define CDB12GENERIC_LENGTH 12 - -#define SETBITON 1 -#define SETBITOFF 0 - -// -// Mode Sense/Select page constants. -// - -#define MODE_PAGE_VENDOR_SPECIFIC 0x00 -#define MODE_PAGE_ERROR_RECOVERY 0x01 -#define MODE_PAGE_DISCONNECT 0x02 -#define MODE_PAGE_FORMAT_DEVICE 0x03 // disk -#define MODE_PAGE_MRW 0x03 // cdrom -#define MODE_PAGE_RIGID_GEOMETRY 0x04 -#define MODE_PAGE_FLEXIBILE 0x05 // disk -#define MODE_PAGE_WRITE_PARAMETERS 0x05 // cdrom -#define MODE_PAGE_VERIFY_ERROR 0x07 -#define MODE_PAGE_CACHING 0x08 -#define MODE_PAGE_PERIPHERAL 0x09 -#define MODE_PAGE_CONTROL 0x0A -#define MODE_PAGE_MEDIUM_TYPES 0x0B -#define MODE_PAGE_NOTCH_PARTITION 0x0C -#define MODE_PAGE_CD_AUDIO_CONTROL 0x0E -#define MODE_PAGE_DATA_COMPRESS 0x0F -#define MODE_PAGE_DEVICE_CONFIG 0x10 -#define MODE_PAGE_XOR_CONTROL 0x10 // disk -#define MODE_PAGE_MEDIUM_PARTITION 0x11 -#define MODE_PAGE_ENCLOSURE_SERVICES_MANAGEMENT 0x14 -#define MODE_PAGE_EXTENDED 0x15 -#define MODE_PAGE_EXTENDED_DEVICE_SPECIFIC 0x16 -#define MODE_PAGE_CDVD_FEATURE_SET 0x18 -#define MODE_PAGE_PROTOCOL_SPECIFIC_LUN 0x18 -#define MODE_PAGE_PROTOCOL_SPECIFIC_PORT 0x19 -#define MODE_PAGE_POWER_CONDITION 0x1A -#define MODE_PAGE_LUN_MAPPING 0x1B -#define MODE_PAGE_FAULT_REPORTING 0x1C -#define MODE_PAGE_CDVD_INACTIVITY 0x1D // cdrom -#define MODE_PAGE_ELEMENT_ADDRESS 0x1D -#define MODE_PAGE_TRANSPORT_GEOMETRY 0x1E -#define MODE_PAGE_DEVICE_CAPABILITIES 0x1F -#define MODE_PAGE_CAPABILITIES 0x2A // cdrom - -#define MODE_SENSE_RETURN_ALL 0x3f - -#define MODE_SENSE_CURRENT_VALUES 0x00 -#define MODE_SENSE_CHANGEABLE_VALUES 0x40 -#define MODE_SENSE_DEFAULT_VAULES 0x80 -#define MODE_SENSE_SAVED_VALUES 0xc0 - - -// -// SCSI CDB operation codes -// - -// 6-byte commands: -#define SCSIOP_TEST_UNIT_READY 0x00 -#define SCSIOP_REZERO_UNIT 0x01 -#define SCSIOP_REWIND 0x01 -#define SCSIOP_REQUEST_BLOCK_ADDR 0x02 -#define SCSIOP_REQUEST_SENSE 0x03 -#define SCSIOP_FORMAT_UNIT 0x04 -#define SCSIOP_READ_BLOCK_LIMITS 0x05 -#define SCSIOP_REASSIGN_BLOCKS 0x07 -#define SCSIOP_INIT_ELEMENT_STATUS 0x07 -#define SCSIOP_READ6 0x08 -#define SCSIOP_RECEIVE 0x08 -#define SCSIOP_WRITE6 0x0A -#define SCSIOP_PRINT 0x0A -#define SCSIOP_SEND 0x0A -#define SCSIOP_SEEK6 0x0B -#define SCSIOP_TRACK_SELECT 0x0B -#define SCSIOP_SLEW_PRINT 0x0B -#define SCSIOP_SET_CAPACITY 0x0B // tape -#define SCSIOP_SEEK_BLOCK 0x0C -#define SCSIOP_PARTITION 0x0D -#define SCSIOP_READ_REVERSE 0x0F -#define SCSIOP_WRITE_FILEMARKS 0x10 -#define SCSIOP_FLUSH_BUFFER 0x10 -#define SCSIOP_SPACE 0x11 -#define SCSIOP_INQUIRY 0x12 -#define SCSIOP_VERIFY6 0x13 -#define SCSIOP_RECOVER_BUF_DATA 0x14 -#define SCSIOP_MODE_SELECT 0x15 -#define SCSIOP_RESERVE_UNIT 0x16 -#define SCSIOP_RELEASE_UNIT 0x17 -#define SCSIOP_COPY 0x18 -#define SCSIOP_ERASE 0x19 -#define SCSIOP_MODE_SENSE 0x1A -#define SCSIOP_START_STOP_UNIT 0x1B -#define SCSIOP_STOP_PRINT 0x1B -#define SCSIOP_LOAD_UNLOAD 0x1B -#define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C -#define SCSIOP_SEND_DIAGNOSTIC 0x1D -#define SCSIOP_MEDIUM_REMOVAL 0x1E - -// 10-byte commands -#define SCSIOP_READ_FORMATTED_CAPACITY 0x23 -#define SCSIOP_READ_CAPACITY 0x25 -#define SCSIOP_READ 0x28 -#define SCSIOP_WRITE 0x2A -#define SCSIOP_SEEK 0x2B -#define SCSIOP_LOCATE 0x2B -#define SCSIOP_POSITION_TO_ELEMENT 0x2B -#define SCSIOP_WRITE_VERIFY 0x2E -#define SCSIOP_VERIFY 0x2F -#define SCSIOP_SEARCH_DATA_HIGH 0x30 -#define SCSIOP_SEARCH_DATA_EQUAL 0x31 -#define SCSIOP_SEARCH_DATA_LOW 0x32 -#define SCSIOP_SET_LIMITS 0x33 -#define SCSIOP_READ_POSITION 0x34 -#define SCSIOP_SYNCHRONIZE_CACHE 0x35 -#define SCSIOP_COMPARE 0x39 -#define SCSIOP_COPY_COMPARE 0x3A -#define SCSIOP_WRITE_DATA_BUFF 0x3B -#define SCSIOP_READ_DATA_BUFF 0x3C -#define SCSIOP_WRITE_LONG 0x3F -#define SCSIOP_CHANGE_DEFINITION 0x40 -#define SCSIOP_WRITE_SAME 0x41 -#define SCSIOP_READ_SUB_CHANNEL 0x42 -#define SCSIOP_READ_TOC 0x43 -#define SCSIOP_READ_HEADER 0x44 -#define SCSIOP_REPORT_DENSITY_SUPPORT 0x44 // tape -#define SCSIOP_PLAY_AUDIO 0x45 -#define SCSIOP_GET_CONFIGURATION 0x46 -#define SCSIOP_PLAY_AUDIO_MSF 0x47 -#define SCSIOP_PLAY_TRACK_INDEX 0x48 -#define SCSIOP_PLAY_TRACK_RELATIVE 0x49 -#define SCSIOP_GET_EVENT_STATUS 0x4A -#define SCSIOP_PAUSE_RESUME 0x4B -#define SCSIOP_LOG_SELECT 0x4C -#define SCSIOP_LOG_SENSE 0x4D -#define SCSIOP_STOP_PLAY_SCAN 0x4E -#define SCSIOP_XDWRITE 0x50 -#define SCSIOP_XPWRITE 0x51 -#define SCSIOP_READ_DISK_INFORMATION 0x51 -#define SCSIOP_READ_DISC_INFORMATION 0x51 // proper use of disc over disk -#define SCSIOP_READ_TRACK_INFORMATION 0x52 -#define SCSIOP_XDWRITE_READ 0x53 -#define SCSIOP_RESERVE_TRACK_RZONE 0x53 -#define SCSIOP_SEND_OPC_INFORMATION 0x54 // optimum power calibration -#define SCSIOP_MODE_SELECT10 0x55 -#define SCSIOP_RESERVE_UNIT10 0x56 -#define SCSIOP_RESERVE_ELEMENT 0x56 -#define SCSIOP_RELEASE_UNIT10 0x57 -#define SCSIOP_RELEASE_ELEMENT 0x57 -#define SCSIOP_REPAIR_TRACK 0x58 -#define SCSIOP_MODE_SENSE10 0x5A -#define SCSIOP_CLOSE_TRACK_SESSION 0x5B -#define SCSIOP_READ_BUFFER_CAPACITY 0x5C -#define SCSIOP_SEND_CUE_SHEET 0x5D -#define SCSIOP_PERSISTENT_RESERVE_IN 0x5E -#define SCSIOP_PERSISTENT_RESERVE_OUT 0x5F - -// 12-byte commands -#define SCSIOP_REPORT_LUNS 0xA0 -#define SCSIOP_BLANK 0xA1 -#define SCSIOP_ATA_PASSTHROUGH12 0xA1 -#define SCSIOP_SEND_EVENT 0xA2 -#define SCSIOP_SEND_KEY 0xA3 -#define SCSIOP_MAINTENANCE_IN 0xA3 -#define SCSIOP_REPORT_KEY 0xA4 -#define SCSIOP_MAINTENANCE_OUT 0xA4 -#define SCSIOP_MOVE_MEDIUM 0xA5 -#define SCSIOP_LOAD_UNLOAD_SLOT 0xA6 -#define SCSIOP_EXCHANGE_MEDIUM 0xA6 -#define SCSIOP_SET_READ_AHEAD 0xA7 -#define SCSIOP_MOVE_MEDIUM_ATTACHED 0xA7 -#define SCSIOP_READ12 0xA8 -#define SCSIOP_GET_MESSAGE 0xA8 -#define SCSIOP_SERVICE_ACTION_OUT12 0xA9 -#define SCSIOP_WRITE12 0xAA -#define SCSIOP_SEND_MESSAGE 0xAB -#define SCSIOP_SERVICE_ACTION_IN12 0xAB -#define SCSIOP_GET_PERFORMANCE 0xAC -#define SCSIOP_READ_DVD_STRUCTURE 0xAD -#define SCSIOP_WRITE_VERIFY12 0xAE -#define SCSIOP_VERIFY12 0xAF -#define SCSIOP_SEARCH_DATA_HIGH12 0xB0 -#define SCSIOP_SEARCH_DATA_EQUAL12 0xB1 -#define SCSIOP_SEARCH_DATA_LOW12 0xB2 -#define SCSIOP_SET_LIMITS12 0xB3 -#define SCSIOP_READ_ELEMENT_STATUS_ATTACHED 0xB4 -#define SCSIOP_REQUEST_VOL_ELEMENT 0xB5 -#define SCSIOP_SEND_VOLUME_TAG 0xB6 -#define SCSIOP_SET_STREAMING 0xB6 // C/DVD -#define SCSIOP_READ_DEFECT_DATA 0xB7 -#define SCSIOP_READ_ELEMENT_STATUS 0xB8 -#define SCSIOP_READ_CD_MSF 0xB9 -#define SCSIOP_SCAN_CD 0xBA -#define SCSIOP_REDUNDANCY_GROUP_IN 0xBA -#define SCSIOP_SET_CD_SPEED 0xBB -#define SCSIOP_REDUNDANCY_GROUP_OUT 0xBB -#define SCSIOP_PLAY_CD 0xBC -#define SCSIOP_SPARE_IN 0xBC -#define SCSIOP_MECHANISM_STATUS 0xBD -#define SCSIOP_SPARE_OUT 0xBD -#define SCSIOP_READ_CD 0xBE -#define SCSIOP_VOLUME_SET_IN 0xBE -#define SCSIOP_SEND_DVD_STRUCTURE 0xBF -#define SCSIOP_VOLUME_SET_OUT 0xBF -#define SCSIOP_INIT_ELEMENT_RANGE 0xE7 - -// 16-byte commands -#define SCSIOP_XDWRITE_EXTENDED16 0x80 // disk -#define SCSIOP_WRITE_FILEMARKS16 0x80 // tape -#define SCSIOP_REBUILD16 0x81 // disk -#define SCSIOP_READ_REVERSE16 0x81 // tape -#define SCSIOP_REGENERATE16 0x82 // disk -#define SCSIOP_EXTENDED_COPY 0x83 -#define SCSIOP_RECEIVE_COPY_RESULTS 0x84 -#define SCSIOP_ATA_PASSTHROUGH16 0x85 -#define SCSIOP_ACCESS_CONTROL_IN 0x86 -#define SCSIOP_ACCESS_CONTROL_OUT 0x87 -#define SCSIOP_READ16 0x88 -#define SCSIOP_WRITE16 0x8A -#define SCSIOP_READ_ATTRIBUTES 0x8C -#define SCSIOP_WRITE_ATTRIBUTES 0x8D -#define SCSIOP_WRITE_VERIFY16 0x8E -#define SCSIOP_VERIFY16 0x8F -#define SCSIOP_PREFETCH16 0x90 -#define SCSIOP_SYNCHRONIZE_CACHE16 0x91 -#define SCSIOP_SPACE16 0x91 // tape -#define SCSIOP_LOCK_UNLOCK_CACHE16 0x92 -#define SCSIOP_LOCATE16 0x92 // tape -#define SCSIOP_WRITE_SAME16 0x93 -#define SCSIOP_ERASE16 0x93 // tape -#define SCSIOP_READ_CAPACITY16 0x9E -#define SCSIOP_SERVICE_ACTION_IN16 0x9E -#define SCSIOP_SERVICE_ACTION_OUT16 0x9F - - -// -// If the IMMED bit is 1, status is returned as soon -// as the operation is initiated. If the IMMED bit -// is 0, status is not returned until the operation -// is completed. -// - -#define CDB_RETURN_ON_COMPLETION 0 -#define CDB_RETURN_IMMEDIATE 1 - - -// -// Inquiry buffer structure. This is the data returned from the target -// after it receives an inquiry. -// -// This structure may be extended by the number of bytes specified -// in the field AdditionalLength. The defined size constant only -// includes fields through ProductRevisionLevel. -// -// The NT SCSI drivers are only interested in the first 36 bytes of data. -// - -#define INQUIRYDATABUFFERSIZE 36 - -#if (NTDDI_VERSION < NTDDI_WINXP) -typedef struct _INQUIRYDATA { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR DeviceTypeModifier : 7; - UCHAR RemovableMedia : 1; - UCHAR Versions; - UCHAR ResponseDataFormat : 4; - UCHAR HiSupport : 1; - UCHAR NormACA : 1; - UCHAR ReservedBit : 1; - UCHAR AERC : 1; - UCHAR AdditionalLength; - UCHAR Reserved[2]; - UCHAR SoftReset : 1; - UCHAR CommandQueue : 1; - UCHAR Reserved2 : 1; - UCHAR LinkedCommands : 1; - UCHAR Synchronous : 1; - UCHAR Wide16Bit : 1; - UCHAR Wide32Bit : 1; - UCHAR RelativeAddressing : 1; - UCHAR VendorId[8]; - UCHAR ProductId[16]; - UCHAR ProductRevisionLevel[4]; - UCHAR VendorSpecific[20]; - UCHAR Reserved3[40]; -} INQUIRYDATA, *PINQUIRYDATA; -#else -#pragma pack(push, inquiry, 1) -typedef struct _INQUIRYDATA { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR DeviceTypeModifier : 7; - UCHAR RemovableMedia : 1; - union { - UCHAR Versions; - struct { - UCHAR ANSIVersion : 3; - UCHAR ECMAVersion : 3; - UCHAR ISOVersion : 2; - }; - }; - UCHAR ResponseDataFormat : 4; - UCHAR HiSupport : 1; - UCHAR NormACA : 1; - UCHAR TerminateTask : 1; - UCHAR AERC : 1; - UCHAR AdditionalLength; - UCHAR Reserved; - UCHAR Addr16 : 1; // defined only for SIP devices. - UCHAR Addr32 : 1; // defined only for SIP devices. - UCHAR AckReqQ: 1; // defined only for SIP devices. - UCHAR MediumChanger : 1; - UCHAR MultiPort : 1; - UCHAR ReservedBit2 : 1; - UCHAR EnclosureServices : 1; - UCHAR ReservedBit3 : 1; - UCHAR SoftReset : 1; - UCHAR CommandQueue : 1; - UCHAR TransferDisable : 1; // defined only for SIP devices. - UCHAR LinkedCommands : 1; - UCHAR Synchronous : 1; // defined only for SIP devices. - UCHAR Wide16Bit : 1; // defined only for SIP devices. - UCHAR Wide32Bit : 1; // defined only for SIP devices. - UCHAR RelativeAddressing : 1; - UCHAR VendorId[8]; - UCHAR ProductId[16]; - UCHAR ProductRevisionLevel[4]; - UCHAR VendorSpecific[20]; - UCHAR Reserved3[40]; -} INQUIRYDATA, *PINQUIRYDATA; -#pragma pack(pop, inquiry) -#endif - -// -// Inquiry defines. Used to interpret data returned from target as result -// of inquiry command. -// -// DeviceType field -// - -#define DIRECT_ACCESS_DEVICE 0x00 // disks -#define SEQUENTIAL_ACCESS_DEVICE 0x01 // tapes -#define PRINTER_DEVICE 0x02 // printers -#define PROCESSOR_DEVICE 0x03 // scanners, printers, etc -#define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04 // worms -#define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05 // cdroms -#define SCANNER_DEVICE 0x06 // scanners -#define OPTICAL_DEVICE 0x07 // optical disks -#define MEDIUM_CHANGER 0x08 // jukebox -#define COMMUNICATION_DEVICE 0x09 // network -// 0xA and 0xB are obsolete -#define ARRAY_CONTROLLER_DEVICE 0x0C -#define SCSI_ENCLOSURE_DEVICE 0x0D -#define REDUCED_BLOCK_DEVICE 0x0E // e.g., 1394 disk -#define OPTICAL_CARD_READER_WRITER_DEVICE 0x0F -#define BRIDGE_CONTROLLER_DEVICE 0x10 -#define OBJECT_BASED_STORAGE_DEVICE 0x11 // OSD -#define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F - -#define DEVICE_QUALIFIER_ACTIVE 0x00 -#define DEVICE_QUALIFIER_NOT_ACTIVE 0x01 -#define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03 - -// -// DeviceTypeQualifier field -// - -#define DEVICE_CONNECTED 0x00 - -// -// Vital Product Data Pages -// - -// -// Unit Serial Number Page (page code 0x80) -// -// Provides a product serial number for the target or the logical unit. -// -#pragma pack(push, vpd_media_sn, 1) -typedef struct _VPD_MEDIA_SERIAL_NUMBER_PAGE { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR PageCode; - UCHAR Reserved; - UCHAR PageLength; -#if !defined(__midl) - UCHAR SerialNumber[0]; -#endif -} VPD_MEDIA_SERIAL_NUMBER_PAGE, *PVPD_MEDIA_SERIAL_NUMBER_PAGE; -#pragma pack(pop, vpd_media_sn) - -#pragma pack(push, vpd_sn, 1) -typedef struct _VPD_SERIAL_NUMBER_PAGE { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR PageCode; - UCHAR Reserved; - UCHAR PageLength; -#if !defined(__midl) - UCHAR SerialNumber[0]; -#endif -} VPD_SERIAL_NUMBER_PAGE, *PVPD_SERIAL_NUMBER_PAGE; -#pragma pack(pop, vpd_sn) - -// -// Device Identification Page (page code 0x83) -// Provides the means to retrieve zero or more identification descriptors -// applying to the logical unit. -// - -#pragma pack(push, vpd_stuff, 1) -typedef enum _VPD_CODE_SET { - VpdCodeSetReserved = 0, - VpdCodeSetBinary = 1, - VpdCodeSetAscii = 2, - VpdCodeSetUTF8 = 3 -} VPD_CODE_SET, *PVPD_CODE_SET; - -typedef enum _VPD_ASSOCIATION { - VpdAssocDevice = 0, - VpdAssocPort = 1, - VpdAssocTarget = 2, - VpdAssocReserved1 = 3, - VpdAssocReserved2 = 4 // bogus, only two bits -} VPD_ASSOCIATION, *PVPD_ASSOCIATION; - -typedef enum _VPD_IDENTIFIER_TYPE { - VpdIdentifierTypeVendorSpecific = 0, - VpdIdentifierTypeVendorId = 1, - VpdIdentifierTypeEUI64 = 2, - VpdIdentifierTypeFCPHName = 3, - VpdIdentifierTypePortRelative = 4, - VpdIdentifierTypeTargetPortGroup = 5, - VpdIdentifierTypeLogicalUnitGroup = 6, - VpdIdentifierTypeMD5LogicalUnitId = 7, - VpdIdentifierTypeSCSINameString = 8 -} VPD_IDENTIFIER_TYPE, *PVPD_IDENTIFIER_TYPE; - -typedef struct _VPD_IDENTIFICATION_DESCRIPTOR { - UCHAR CodeSet : 4; // VPD_CODE_SET - UCHAR Reserved : 4; - UCHAR IdentifierType : 4; // VPD_IDENTIFIER_TYPE - UCHAR Association : 2; - UCHAR Reserved2 : 2; - UCHAR Reserved3; - UCHAR IdentifierLength; -#if !defined(__midl) - UCHAR Identifier[0]; -#endif -} VPD_IDENTIFICATION_DESCRIPTOR, *PVPD_IDENTIFICATION_DESCRIPTOR; - -typedef struct _VPD_IDENTIFICATION_PAGE { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR PageCode; - UCHAR Reserved; - UCHAR PageLength; - - - // - // The following field is actually a variable length array of identification - // descriptors. Unfortunately there's no C notation for an array of - // variable length structures so we're forced to just pretend. - // - -#if !defined(__midl) - // VPD_IDENTIFICATION_DESCRIPTOR Descriptors[0]; - UCHAR Descriptors[0]; -#endif -} VPD_IDENTIFICATION_PAGE, *PVPD_IDENTIFICATION_PAGE; - -// -// Supported Vital Product Data Pages Page (page code 0x00) -// Contains a list of the vital product data page cods supported by the target -// or logical unit. -// - -typedef struct _VPD_SUPPORTED_PAGES_PAGE { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR PageCode; - UCHAR Reserved; - UCHAR PageLength; -#if !defined(__midl) - UCHAR SupportedPageList[0]; -#endif -} VPD_SUPPORTED_PAGES_PAGE, *PVPD_SUPPORTED_PAGES_PAGE; -#pragma pack(pop, vpd_stuff) - - -#define VPD_MAX_BUFFER_SIZE 0xff - -#define VPD_SUPPORTED_PAGES 0x00 -#define VPD_SERIAL_NUMBER 0x80 -#define VPD_DEVICE_IDENTIFIERS 0x83 -#define VPD_MEDIA_SERIAL_NUMBER 0x84 -#define VPD_SOFTWARE_INTERFACE_IDENTIFIERS 0x84 -#define VPD_NETWORK_MANAGEMENT_ADDRESSES 0x85 -#define VPD_EXTENDED_INQUIRY_DATA 0x86 -#define VPD_MODE_PAGE_POLICY 0x87 -#define VPD_SCSI_PORTS 0x88 - - -// -// Persistent Reservation Definitions. -// - -// -// PERSISTENT_RESERVE_* definitions -// - -#define RESERVATION_ACTION_READ_KEYS 0x00 -#define RESERVATION_ACTION_READ_RESERVATIONS 0x01 - -#define RESERVATION_ACTION_REGISTER 0x00 -#define RESERVATION_ACTION_RESERVE 0x01 -#define RESERVATION_ACTION_RELEASE 0x02 -#define RESERVATION_ACTION_CLEAR 0x03 -#define RESERVATION_ACTION_PREEMPT 0x04 -#define RESERVATION_ACTION_PREEMPT_ABORT 0x05 -#define RESERVATION_ACTION_REGISTER_IGNORE_EXISTING 0x06 - -#define RESERVATION_SCOPE_LU 0x00 -#define RESERVATION_SCOPE_ELEMENT 0x02 - -#define RESERVATION_TYPE_WRITE_EXCLUSIVE 0x01 -#define RESERVATION_TYPE_EXCLUSIVE 0x03 -#define RESERVATION_TYPE_WRITE_EXCLUSIVE_REGISTRANTS 0x05 -#define RESERVATION_TYPE_EXCLUSIVE_REGISTRANTS 0x06 - -// -// Structures for reserve in command. -// - -#pragma pack(push, reserve_in_stuff, 1) -typedef struct { - UCHAR Generation[4]; - UCHAR AdditionalLength[4]; -#if !defined(__midl) - UCHAR ReservationKeyList[0][8]; -#endif -} PRI_REGISTRATION_LIST, *PPRI_REGISTRATION_LIST; - -typedef struct { - UCHAR ReservationKey[8]; - UCHAR ScopeSpecificAddress[4]; - UCHAR Reserved; - UCHAR Type : 4; - UCHAR Scope : 4; - UCHAR Obsolete[2]; -} PRI_RESERVATION_DESCRIPTOR, *PPRI_RESERVATION_DESCRIPTOR; - -typedef struct { - UCHAR Generation[4]; - UCHAR AdditionalLength[4]; -#if !defined(__midl) - PRI_RESERVATION_DESCRIPTOR Reservations[0]; -#endif -} PRI_RESERVATION_LIST, *PPRI_RESERVATION_LIST; -#pragma pack(pop, reserve_in_stuff) - -// -// Structures for reserve out command. -// - -#pragma pack(push, reserve_out_stuff, 1) -typedef struct { - UCHAR ReservationKey[8]; - UCHAR ServiceActionReservationKey[8]; - UCHAR ScopeSpecificAddress[4]; - UCHAR ActivatePersistThroughPowerLoss : 1; - UCHAR Reserved1 : 7; - UCHAR Reserved2; - UCHAR Obsolete[2]; -} PRO_PARAMETER_LIST, *PPRO_PARAMETER_LIST; -#pragma pack(pop, reserve_out_stuff) - - -// -// Sense Data Format -// - -#pragma pack(push, sensedata, 1) -typedef struct _SENSE_DATA { - UCHAR ErrorCode:7; - UCHAR Valid:1; - UCHAR SegmentNumber; - UCHAR SenseKey:4; - UCHAR Reserved:1; - UCHAR IncorrectLength:1; - UCHAR EndOfMedia:1; - UCHAR FileMark:1; - UCHAR Information[4]; - UCHAR AdditionalSenseLength; - UCHAR CommandSpecificInformation[4]; - UCHAR AdditionalSenseCode; - UCHAR AdditionalSenseCodeQualifier; - UCHAR FieldReplaceableUnitCode; - UCHAR SenseKeySpecific[3]; -} SENSE_DATA, *PSENSE_DATA; -#pragma pack(pop, sensedata) - -// -// Default request sense buffer size -// - -#define SENSE_BUFFER_SIZE 18 - -// -// Maximum request sense buffer size -// - -#define MAX_SENSE_BUFFER_SIZE 255 - -// -// Maximum number of additional sense bytes. -// - -#define MAX_ADDITIONAL_SENSE_BYTES (MAX_SENSE_BUFFER_SIZE - SENSE_BUFFER_SIZE) - -// -// Sense codes -// - -#define SCSI_SENSE_NO_SENSE 0x00 -#define SCSI_SENSE_RECOVERED_ERROR 0x01 -#define SCSI_SENSE_NOT_READY 0x02 -#define SCSI_SENSE_MEDIUM_ERROR 0x03 -#define SCSI_SENSE_HARDWARE_ERROR 0x04 -#define SCSI_SENSE_ILLEGAL_REQUEST 0x05 -#define SCSI_SENSE_UNIT_ATTENTION 0x06 -#define SCSI_SENSE_DATA_PROTECT 0x07 -#define SCSI_SENSE_BLANK_CHECK 0x08 -#define SCSI_SENSE_UNIQUE 0x09 -#define SCSI_SENSE_COPY_ABORTED 0x0A -#define SCSI_SENSE_ABORTED_COMMAND 0x0B -#define SCSI_SENSE_EQUAL 0x0C -#define SCSI_SENSE_VOL_OVERFLOW 0x0D -#define SCSI_SENSE_MISCOMPARE 0x0E -#define SCSI_SENSE_RESERVED 0x0F - -// -// Additional tape bit -// - -#define SCSI_ILLEGAL_LENGTH 0x20 -#define SCSI_EOM 0x40 -#define SCSI_FILE_MARK 0x80 - -// -// Additional Sense codes -// - -#define SCSI_ADSENSE_NO_SENSE 0x00 -#define SCSI_ADSENSE_NO_SEEK_COMPLETE 0x02 -#define SCSI_ADSENSE_LUN_NOT_READY 0x04 -#define SCSI_ADSENSE_LUN_COMMUNICATION 0x08 -#define SCSI_ADSENSE_WRITE_ERROR 0x0C -#define SCSI_ADSENSE_TRACK_ERROR 0x14 -#define SCSI_ADSENSE_SEEK_ERROR 0x15 -#define SCSI_ADSENSE_REC_DATA_NOECC 0x17 -#define SCSI_ADSENSE_REC_DATA_ECC 0x18 -#define SCSI_ADSENSE_PARAMETER_LIST_LENGTH 0x1A -#define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20 -#define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21 -#define SCSI_ADSENSE_INVALID_CDB 0x24 -#define SCSI_ADSENSE_INVALID_LUN 0x25 -#define SCSI_ADSENSE_INVALID_FIELD_PARAMETER_LIST 0x26 -#define SCSI_ADSENSE_WRITE_PROTECT 0x27 -#define SCSI_ADSENSE_MEDIUM_CHANGED 0x28 -#define SCSI_ADSENSE_BUS_RESET 0x29 -#define SCSI_ADSENSE_PARAMETERS_CHANGED 0x2A -#define SCSI_ADSENSE_INSUFFICIENT_TIME_FOR_OPERATION 0x2E -#define SCSI_ADSENSE_INVALID_MEDIA 0x30 -#define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3a -#define SCSI_ADSENSE_POSITION_ERROR 0x3b -#define SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED 0x3f -#define SCSI_ADSENSE_OPERATOR_REQUEST 0x5a // see below -#define SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x5d -#define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK 0x64 -#define SCSI_ADSENSE_COPY_PROTECTION_FAILURE 0x6f -#define SCSI_ADSENSE_POWER_CALIBRATION_ERROR 0x73 -#define SCSI_ADSENSE_VENDOR_UNIQUE 0x80 // and higher -#define SCSI_ADSENSE_MUSIC_AREA 0xA0 -#define SCSI_ADSENSE_DATA_AREA 0xA1 -#define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7 - -// for legacy apps: -#define SCSI_ADWRITE_PROTECT SCSI_ADSENSE_WRITE_PROTECT -#define SCSI_FAILURE_PREDICTION_THRESHOLD_EXCEEDED SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED - - -// -// SCSI_ADSENSE_LUN_NOT_READY (0x04) qualifiers -// - -#define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00 -#define SCSI_SENSEQ_BECOMING_READY 0x01 -#define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02 -#define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03 -#define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04 -#define SCSI_SENSEQ_REBUILD_IN_PROGRESS 0x05 -#define SCSI_SENSEQ_RECALCULATION_IN_PROGRESS 0x06 -#define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07 -#define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08 - -// -// SCSI_ADSENSE_LUN_COMMUNICATION (0x08) qualifiers -// - -#define SCSI_SENSEQ_COMM_FAILURE 0x00 -#define SCSI_SENSEQ_COMM_TIMEOUT 0x01 -#define SCSI_SENSEQ_COMM_PARITY_ERROR 0x02 -#define SCSI_SESNEQ_COMM_CRC_ERROR 0x03 -#define SCSI_SENSEQ_UNREACHABLE_TARGET 0x04 - -// -// SCSI_ADSENSE_WRITE_ERROR (0x0C) qualifiers -// -#define SCSI_SENSEQ_LOSS_OF_STREAMING 0x09 -#define SCSI_SENSEQ_PADDING_BLOCKS_ADDED 0x0A - - -// -// SCSI_ADSENSE_NO_SENSE (0x00) qualifiers -// - -#define SCSI_SENSEQ_FILEMARK_DETECTED 0x01 -#define SCSI_SENSEQ_END_OF_MEDIA_DETECTED 0x02 -#define SCSI_SENSEQ_SETMARK_DETECTED 0x03 -#define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED 0x04 - -// -// SCSI_ADSENSE_ILLEGAL_BLOCK (0x21) qualifiers -// - -#define SCSI_SENSEQ_ILLEGAL_ELEMENT_ADDR 0x01 - -// -// SCSI_ADSENSE_POSITION_ERROR (0x3b) qualifiers -// - -#define SCSI_SENSEQ_DESTINATION_FULL 0x0d -#define SCSI_SENSEQ_SOURCE_EMPTY 0x0e - -// -// SCSI_ADSENSE_INVALID_MEDIA (0x30) qualifiers -// - -#define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00 -#define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01 -#define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02 -#define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03 - - -// -// SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED (0x3f) qualifiers -// - -#define SCSI_SENSEQ_TARGET_OPERATING_CONDITIONS_CHANGED 0x00 -#define SCSI_SENSEQ_MICROCODE_CHANGED 0x01 -#define SCSI_SENSEQ_OPERATING_DEFINITION_CHANGED 0x02 -#define SCSI_SENSEQ_INQUIRY_DATA_CHANGED 0x03 -#define SCSI_SENSEQ_COMPONENT_DEVICE_ATTACHED 0x04 -#define SCSI_SENSEQ_DEVICE_IDENTIFIER_CHANGED 0x05 -#define SCSI_SENSEQ_REDUNDANCY_GROUP_MODIFIED 0x06 -#define SCSI_SENSEQ_REDUNDANCY_GROUP_DELETED 0x07 -#define SCSI_SENSEQ_SPARE_MODIFIED 0x08 -#define SCSI_SENSEQ_SPARE_DELETED 0x09 -#define SCSI_SENSEQ_VOLUME_SET_MODIFIED 0x0A -#define SCSI_SENSEQ_VOLUME_SET_DELETED 0x0B -#define SCSI_SENSEQ_VOLUME_SET_DEASSIGNED 0x0C -#define SCSI_SENSEQ_VOLUME_SET_REASSIGNED 0x0D -#define SCSI_SENSEQ_REPORTED_LUNS_DATA_CHANGED 0x0E -#define SCSI_SENSEQ_ECHO_BUFFER_OVERWRITTEN 0x0F -#define SCSI_SENSEQ_MEDIUM_LOADABLE 0x10 -#define SCSI_SENSEQ_MEDIUM_AUXILIARY_MEMORY_ACCESSIBLE 0x11 - - -// -// SCSI_ADSENSE_OPERATOR_REQUEST (0x5a) qualifiers -// - -#define SCSI_SENSEQ_STATE_CHANGE_INPUT 0x00 // generic request -#define SCSI_SENSEQ_MEDIUM_REMOVAL 0x01 -#define SCSI_SENSEQ_WRITE_PROTECT_ENABLE 0x02 -#define SCSI_SENSEQ_WRITE_PROTECT_DISABLE 0x03 - -// -// SCSI_ADSENSE_COPY_PROTECTION_FAILURE (0x6f) qualifiers -// -#define SCSI_SENSEQ_AUTHENTICATION_FAILURE 0x00 -#define SCSI_SENSEQ_KEY_NOT_PRESENT 0x01 -#define SCSI_SENSEQ_KEY_NOT_ESTABLISHED 0x02 -#define SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION 0x03 -#define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT 0x04 -#define SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR 0x05 - -// -// SCSI_ADSENSE_POWER_CALIBRATION_ERROR (0x73) qualifiers -// - -#define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ALMOST_FULL 0x01 -#define SCSI_SENSEQ_POWER_CALIBRATION_AREA_FULL 0x02 -#define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ERROR 0x03 -#define SCSI_SENSEQ_PMA_RMA_UPDATE_FAILURE 0x04 -#define SCSI_SENSEQ_PMA_RMA_IS_FULL 0x05 -#define SCSI_SENSEQ_PMA_RMA_ALMOST_FULL 0x06 - - - -// -// Read Capacity Data - returned in Big Endian format -// - -#pragma pack(push, read_capacity, 1) -typedef struct _READ_CAPACITY_DATA { - ULONG LogicalBlockAddress; - ULONG BytesPerBlock; -} READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA; -#pragma pack(pop, read_capacity) - - -#pragma pack(push, read_capacity_ex, 1) -typedef struct _READ_CAPACITY_DATA_EX { - LARGE_INTEGER LogicalBlockAddress; - ULONG BytesPerBlock; -} READ_CAPACITY_DATA_EX, *PREAD_CAPACITY_DATA_EX; -#pragma pack(pop, read_capacity_ex) - - -// -// Read Block Limits Data - returned in Big Endian format -// This structure returns the maximum and minimum block -// size for a TAPE device. -// - -#pragma pack(push, read_block_limits, 1) -typedef struct _READ_BLOCK_LIMITS { - UCHAR Reserved; - UCHAR BlockMaximumSize[3]; - UCHAR BlockMinimumSize[2]; -} READ_BLOCK_LIMITS_DATA, *PREAD_BLOCK_LIMITS_DATA; -#pragma pack(pop, read_block_limits) - -#pragma pack(push, read_buffer_capacity, 1) -typedef struct _READ_BUFFER_CAPACITY_DATA { - UCHAR DataLength[2]; - UCHAR Reserved1; - UCHAR BlockDataReturned : 1; - UCHAR Reserved4 : 7; - UCHAR TotalBufferSize[4]; - UCHAR AvailableBufferSize[4]; -} READ_BUFFER_CAPACITY_DATA, *PREAD_BUFFER_CAPACITY_DATA; -#pragma pack(pop, read_buffer_capacity) - -// -// Mode data structures. -// - -// -// Define Mode parameter header. -// - -#pragma pack(push, mode_params, 1) -typedef struct _MODE_PARAMETER_HEADER { - UCHAR ModeDataLength; - UCHAR MediumType; - UCHAR DeviceSpecificParameter; - UCHAR BlockDescriptorLength; -}MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER; - -typedef struct _MODE_PARAMETER_HEADER10 { - UCHAR ModeDataLength[2]; - UCHAR MediumType; - UCHAR DeviceSpecificParameter; - UCHAR Reserved[2]; - UCHAR BlockDescriptorLength[2]; -}MODE_PARAMETER_HEADER10, *PMODE_PARAMETER_HEADER10; -#pragma pack(pop, mode_params) - -#define MODE_FD_SINGLE_SIDE 0x01 -#define MODE_FD_DOUBLE_SIDE 0x02 -#define MODE_FD_MAXIMUM_TYPE 0x1E -#define MODE_DSP_FUA_SUPPORTED 0x10 -#define MODE_DSP_WRITE_PROTECT 0x80 - -// -// Define the mode parameter block. -// - -#pragma pack(push, mode_params_block, 1) -typedef struct _MODE_PARAMETER_BLOCK { - UCHAR DensityCode; - UCHAR NumberOfBlocks[3]; - UCHAR Reserved; - UCHAR BlockLength[3]; -}MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK; -#pragma pack(pop, mode_params_block) - -// -// Define Disconnect-Reconnect page. -// - - -#pragma pack(push, mode_page_disconnect, 1) -typedef struct _MODE_DISCONNECT_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR BufferFullRatio; - UCHAR BufferEmptyRatio; - UCHAR BusInactivityLimit[2]; - UCHAR BusDisconnectTime[2]; - UCHAR BusConnectTime[2]; - UCHAR MaximumBurstSize[2]; - UCHAR DataTransferDisconnect : 2; - UCHAR Reserved2[3]; -}MODE_DISCONNECT_PAGE, *PMODE_DISCONNECT_PAGE; -#pragma pack(pop, mode_page_disconnect) - -// -// Define mode caching page. -// - -#pragma pack(push, mode_page_caching, 1) -typedef struct _MODE_CACHING_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR ReadDisableCache : 1; - UCHAR MultiplicationFactor : 1; - UCHAR WriteCacheEnable : 1; - UCHAR Reserved2 : 5; - UCHAR WriteRetensionPriority : 4; - UCHAR ReadRetensionPriority : 4; - UCHAR DisablePrefetchTransfer[2]; - UCHAR MinimumPrefetch[2]; - UCHAR MaximumPrefetch[2]; - UCHAR MaximumPrefetchCeiling[2]; -}MODE_CACHING_PAGE, *PMODE_CACHING_PAGE; -#pragma pack(pop, mode_page_caching) - -// -// Define write parameters cdrom page -// -#pragma pack(push, mode_page_wp2, 1) -typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE2 { - UCHAR PageCode : 6; // 0x05 - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; // 0x32 ?? - UCHAR WriteType : 4; - UCHAR TestWrite : 1; - UCHAR LinkSizeValid : 1; - UCHAR BufferUnderrunFreeEnabled : 1; - UCHAR Reserved2 : 1; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR FixedPacket : 1; - UCHAR MultiSession : 2; - UCHAR DataBlockType : 4; - UCHAR Reserved3 : 4; - UCHAR LinkSize; - UCHAR Reserved4; - UCHAR HostApplicationCode : 6; - UCHAR Reserved5 : 2; - UCHAR SessionFormat; - UCHAR Reserved6; - UCHAR PacketSize[4]; - UCHAR AudioPauseLength[2]; - UCHAR MediaCatalogNumber[16]; - UCHAR ISRC[16]; - UCHAR SubHeaderData[4]; -} MODE_CDROM_WRITE_PARAMETERS_PAGE2, *PMODE_CDROM_WRITE_PARAMETERS_PAGE2; -#pragma pack(pop, mode_page_wp2) - -#ifndef DEPRECATE_DDK_FUNCTIONS -// this structure is being retired due to missing fields and overly -// complex data definitions for the MCN and ISRC. -#pragma pack(push, mode_page_wp, 1) -typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE { - UCHAR PageLength; // 0x32 ?? - UCHAR WriteType : 4; - UCHAR TestWrite : 1; - UCHAR LinkSizeValid : 1; - UCHAR BufferUnderrunFreeEnabled : 1; - UCHAR Reserved2 : 1; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR FixedPacket : 1; - UCHAR MultiSession : 2; - UCHAR DataBlockType : 4; - UCHAR Reserved3 : 4; - UCHAR LinkSize; - UCHAR Reserved4; - UCHAR HostApplicationCode : 6; - UCHAR Reserved5 : 2; - UCHAR SessionFormat; - UCHAR Reserved6; - UCHAR PacketSize[4]; - UCHAR AudioPauseLength[2]; - UCHAR Reserved7 : 7; - UCHAR MediaCatalogNumberValid : 1; - UCHAR MediaCatalogNumber[13]; - UCHAR MediaCatalogNumberZero; - UCHAR MediaCatalogNumberAFrame; - UCHAR Reserved8 : 7; - UCHAR ISRCValid : 1; - UCHAR ISRCCountry[2]; - UCHAR ISRCOwner[3]; - UCHAR ISRCRecordingYear[2]; - UCHAR ISRCSerialNumber[5]; - UCHAR ISRCZero; - UCHAR ISRCAFrame; - UCHAR ISRCReserved; - UCHAR SubHeaderData[4]; -} MODE_CDROM_WRITE_PARAMETERS_PAGE, *PMODE_CDROM_WRITE_PARAMETERS_PAGE; -#pragma pack(pop, mode_page_wp) -#endif //ifndef DEPRECATE_DDK_FUNCTIONS - -// -// Define the MRW mode page for CDROM device types -// -#pragma pack(push, mode_page_mrw, 1) -typedef struct _MODE_MRW_PAGE { - UCHAR PageCode : 6; // 0x03 - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; //0x06 - UCHAR Reserved1; - UCHAR LbaSpace : 1; - UCHAR Reserved2 : 7; - UCHAR Reserved3[4]; -} MODE_MRW_PAGE, *PMODE_MRW_PAGE; -#pragma pack(pop, mode_page_mrw) - -// -// Define mode flexible disk page. -// - -#pragma pack(push, mode_page_flex, 1) -typedef struct _MODE_FLEXIBLE_DISK_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR TransferRate[2]; - UCHAR NumberOfHeads; - UCHAR SectorsPerTrack; - UCHAR BytesPerSector[2]; - UCHAR NumberOfCylinders[2]; - UCHAR StartWritePrecom[2]; - UCHAR StartReducedCurrent[2]; - UCHAR StepRate[2]; - UCHAR StepPluseWidth; - UCHAR HeadSettleDelay[2]; - UCHAR MotorOnDelay; - UCHAR MotorOffDelay; - UCHAR Reserved2 : 5; - UCHAR MotorOnAsserted : 1; - UCHAR StartSectorNumber : 1; - UCHAR TrueReadySignal : 1; - UCHAR StepPlusePerCyclynder : 4; - UCHAR Reserved3 : 4; - UCHAR WriteCompenstation; - UCHAR HeadLoadDelay; - UCHAR HeadUnloadDelay; - UCHAR Pin2Usage : 4; - UCHAR Pin34Usage : 4; - UCHAR Pin1Usage : 4; - UCHAR Pin4Usage : 4; - UCHAR MediumRotationRate[2]; - UCHAR Reserved4[2]; -} MODE_FLEXIBLE_DISK_PAGE, *PMODE_FLEXIBLE_DISK_PAGE; -#pragma pack(pop, mode_page_flex) - -// -// Define mode format page. -// - -#pragma pack(push, mode_page_format, 1) -typedef struct _MODE_FORMAT_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR TracksPerZone[2]; - UCHAR AlternateSectorsPerZone[2]; - UCHAR AlternateTracksPerZone[2]; - UCHAR AlternateTracksPerLogicalUnit[2]; - UCHAR SectorsPerTrack[2]; - UCHAR BytesPerPhysicalSector[2]; - UCHAR Interleave[2]; - UCHAR TrackSkewFactor[2]; - UCHAR CylinderSkewFactor[2]; - UCHAR Reserved2 : 4; - UCHAR SurfaceFirst : 1; - UCHAR RemovableMedia : 1; - UCHAR HardSectorFormating : 1; - UCHAR SoftSectorFormating : 1; - UCHAR Reserved3[3]; -} MODE_FORMAT_PAGE, *PMODE_FORMAT_PAGE; -#pragma pack(pop, mode_page_format) - -// -// Define rigid disk driver geometry page. -// - -#pragma pack(push, mode_page_geometry, 1) -typedef struct _MODE_RIGID_GEOMETRY_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR NumberOfCylinders[3]; - UCHAR NumberOfHeads; - UCHAR StartWritePrecom[3]; - UCHAR StartReducedCurrent[3]; - UCHAR DriveStepRate[2]; - UCHAR LandZoneCyclinder[3]; - UCHAR RotationalPositionLock : 2; - UCHAR Reserved2 : 6; - UCHAR RotationOffset; - UCHAR Reserved3; - UCHAR RoataionRate[2]; - UCHAR Reserved4[2]; -}MODE_RIGID_GEOMETRY_PAGE, *PMODE_RIGID_GEOMETRY_PAGE; -#pragma pack(pop, mode_page_geometry) - -// -// Define read write recovery page -// - -#pragma pack(push, mode_page_rw_recovery, 1) -typedef struct _MODE_READ_WRITE_RECOVERY_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PSBit : 1; - UCHAR PageLength; - UCHAR DCRBit : 1; - UCHAR DTEBit : 1; - UCHAR PERBit : 1; - UCHAR EERBit : 1; - UCHAR RCBit : 1; - UCHAR TBBit : 1; - UCHAR ARRE : 1; - UCHAR AWRE : 1; - UCHAR ReadRetryCount; - UCHAR Reserved4[4]; - UCHAR WriteRetryCount; - UCHAR Reserved5[3]; - -} MODE_READ_WRITE_RECOVERY_PAGE, *PMODE_READ_WRITE_RECOVERY_PAGE; -#pragma pack(pop, mode_page_rw_recovery) - -// -// Define read recovery page - cdrom -// - -#pragma pack(push, mode_page_r_recovery, 1) -typedef struct _MODE_READ_RECOVERY_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PSBit : 1; - UCHAR PageLength; - UCHAR DCRBit : 1; - UCHAR DTEBit : 1; - UCHAR PERBit : 1; - UCHAR Reserved2 : 1; - UCHAR RCBit : 1; - UCHAR TBBit : 1; - UCHAR Reserved3 : 2; - UCHAR ReadRetryCount; - UCHAR Reserved4[4]; - -} MODE_READ_RECOVERY_PAGE, *PMODE_READ_RECOVERY_PAGE; -#pragma pack(pop, mode_page_r_recovery) - - -// -// Define Informational Exception Control Page. Used for failure prediction -// - -#pragma pack(push, mode_page_xcpt, 1) -typedef struct _MODE_INFO_EXCEPTIONS -{ - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PSBit : 1; - - UCHAR PageLength; - - union - { - UCHAR Flags; - struct - { - UCHAR LogErr : 1; - UCHAR Reserved2 : 1; - UCHAR Test : 1; - UCHAR Dexcpt : 1; - UCHAR Reserved3 : 3; - UCHAR Perf : 1; - }; - }; - - UCHAR ReportMethod : 4; - UCHAR Reserved4 : 4; - - UCHAR IntervalTimer[4]; - UCHAR ReportCount[4]; - -} MODE_INFO_EXCEPTIONS, *PMODE_INFO_EXCEPTIONS; -#pragma pack(pop, mode_page_xcpt) - -// -// Begin C/DVD 0.9 definitions -// - -// -// Power Condition Mode Page Format -// - -#pragma pack(push, mode_page_power, 1) -typedef struct _POWER_CONDITION_PAGE { - UCHAR PageCode : 6; // 0x1A - UCHAR Reserved : 1; - UCHAR PSBit : 1; - UCHAR PageLength; // 0x0A - UCHAR Reserved2; - - UCHAR Standby : 1; - UCHAR Idle : 1; - UCHAR Reserved3 : 6; - - UCHAR IdleTimer[4]; - UCHAR StandbyTimer[4]; -} POWER_CONDITION_PAGE, *PPOWER_CONDITION_PAGE; -#pragma pack(pop, mode_page_power) - -// -// CD-Audio Control Mode Page Format -// - -#pragma pack(push, mode_page_cdaudio, 1) -typedef struct _CDDA_OUTPUT_PORT { - UCHAR ChannelSelection : 4; - UCHAR Reserved : 4; - UCHAR Volume; -} CDDA_OUTPUT_PORT, *PCDDA_OUTPUT_PORT; - -typedef struct _CDAUDIO_CONTROL_PAGE { - UCHAR PageCode : 6; // 0x0E - UCHAR Reserved : 1; - UCHAR PSBit : 1; - - UCHAR PageLength; // 0x0E - - UCHAR Reserved2 : 1; - UCHAR StopOnTrackCrossing : 1; // Default 0 - UCHAR Immediate : 1; // Always 1 - UCHAR Reserved3 : 5; - - UCHAR Reserved4[3]; - UCHAR Obsolete[2]; - - CDDA_OUTPUT_PORT CDDAOutputPorts[4]; - -} CDAUDIO_CONTROL_PAGE, *PCDAUDIO_CONTROL_PAGE; -#pragma pack(pop, mode_page_cdaudio) - -#define CDDA_CHANNEL_MUTED 0x0 -#define CDDA_CHANNEL_ZERO 0x1 -#define CDDA_CHANNEL_ONE 0x2 -#define CDDA_CHANNEL_TWO 0x4 -#define CDDA_CHANNEL_THREE 0x8 - -// -// C/DVD Feature Set Support & Version Page -// - -#pragma pack(push, mode_page_features, 1) -typedef struct _CDVD_FEATURE_SET_PAGE { - UCHAR PageCode : 6; // 0x18 - UCHAR Reserved : 1; - UCHAR PSBit : 1; - - UCHAR PageLength; // 0x16 - - UCHAR CDAudio[2]; - UCHAR EmbeddedChanger[2]; - UCHAR PacketSMART[2]; - UCHAR PersistantPrevent[2]; - UCHAR EventStatusNotification[2]; - UCHAR DigitalOutput[2]; - UCHAR CDSequentialRecordable[2]; - UCHAR DVDSequentialRecordable[2]; - UCHAR RandomRecordable[2]; - UCHAR KeyExchange[2]; - UCHAR Reserved2[2]; -} CDVD_FEATURE_SET_PAGE, *PCDVD_FEATURE_SET_PAGE; -#pragma pack(pop, mode_page_features) - -// -// CDVD Inactivity Time-out Page Format -// - -#pragma pack(push, mode_page_timeout, 1) -typedef struct _CDVD_INACTIVITY_TIMEOUT_PAGE { - UCHAR PageCode : 6; // 0x1D - UCHAR Reserved : 1; - UCHAR PSBit : 1; - - UCHAR PageLength; // 0x08 - UCHAR Reserved2[2]; - - UCHAR SWPP : 1; - UCHAR DISP : 1; - UCHAR Reserved3 : 6; - - UCHAR Reserved4; - UCHAR GroupOneMinimumTimeout[2]; - UCHAR GroupTwoMinimumTimeout[2]; -} CDVD_INACTIVITY_TIMEOUT_PAGE, *PCDVD_INACTIVITY_TIMEOUT_PAGE; -#pragma pack(pop, mode_page_timeout) - -// -// CDVD Capabilities & Mechanism Status Page -// - -#define CDVD_LMT_CADDY 0 -#define CDVD_LMT_TRAY 1 -#define CDVD_LMT_POPUP 2 -#define CDVD_LMT_RESERVED1 3 -#define CDVD_LMT_CHANGER_INDIVIDUAL 4 -#define CDVD_LMT_CHANGER_CARTRIDGE 5 -#define CDVD_LMT_RESERVED2 6 -#define CDVD_LMT_RESERVED3 7 - - -#pragma pack(push, mode_page_capabilities, 1) -typedef struct _CDVD_CAPABILITIES_PAGE { - UCHAR PageCode : 6; // 0x2A - UCHAR Reserved : 1; - UCHAR PSBit : 1; // offset 0 - - UCHAR PageLength; // >= 0x18 // offset 1 - - UCHAR CDRRead : 1; - UCHAR CDERead : 1; - UCHAR Method2 : 1; - UCHAR DVDROMRead : 1; - UCHAR DVDRRead : 1; - UCHAR DVDRAMRead : 1; - UCHAR Reserved2 : 2; // offset 2 - - UCHAR CDRWrite : 1; - UCHAR CDEWrite : 1; - UCHAR TestWrite : 1; - UCHAR Reserved3 : 1; - UCHAR DVDRWrite : 1; - UCHAR DVDRAMWrite : 1; - UCHAR Reserved4 : 2; // offset 3 - - UCHAR AudioPlay : 1; - UCHAR Composite : 1; - UCHAR DigitalPortOne : 1; - UCHAR DigitalPortTwo : 1; - UCHAR Mode2Form1 : 1; - UCHAR Mode2Form2 : 1; - UCHAR MultiSession : 1; - UCHAR BufferUnderrunFree : 1; // offset 4 - - UCHAR CDDA : 1; - UCHAR CDDAAccurate : 1; - UCHAR RWSupported : 1; - UCHAR RWDeinterleaved : 1; - UCHAR C2Pointers : 1; - UCHAR ISRC : 1; - UCHAR UPC : 1; - UCHAR ReadBarCodeCapable : 1; // offset 5 - - UCHAR Lock : 1; - UCHAR LockState : 1; - UCHAR PreventJumper : 1; - UCHAR Eject : 1; - UCHAR Reserved6 : 1; - UCHAR LoadingMechanismType : 3; // offset 6 - - UCHAR SeparateVolume : 1; - UCHAR SeperateChannelMute : 1; - UCHAR SupportsDiskPresent : 1; - UCHAR SWSlotSelection : 1; - UCHAR SideChangeCapable : 1; - UCHAR RWInLeadInReadable : 1; - UCHAR Reserved7 : 2; // offset 7 - - union { - UCHAR ReadSpeedMaximum[2]; - UCHAR ObsoleteReserved[2]; // offset 8 - }; - - UCHAR NumberVolumeLevels[2]; // offset 10 - UCHAR BufferSize[2]; // offset 12 - - union { - UCHAR ReadSpeedCurrent[2]; - UCHAR ObsoleteReserved2[2]; // offset 14 - }; - UCHAR ObsoleteReserved3; // offset 16 - - UCHAR Reserved8 : 1; - UCHAR BCK : 1; - UCHAR RCK : 1; - UCHAR LSBF : 1; - UCHAR Length : 2; - UCHAR Reserved9 : 2; // offset 17 - - union { - UCHAR WriteSpeedMaximum[2]; - UCHAR ObsoleteReserved4[2]; // offset 18 - }; - union { - UCHAR WriteSpeedCurrent[2]; - UCHAR ObsoleteReserved11[2]; // offset 20 - }; - - // - // NOTE: This mode page is two bytes too small in the release - // version of the Windows2000 DDK. it also incorrectly - // put the CopyManagementRevision at offset 20 instead - // of offset 22, so fix that with a nameless union (for - // backwards-compatibility with those who "fixed" it on - // their own by looking at Reserved10[]). - // - - union { - UCHAR CopyManagementRevision[2]; // offset 22 - UCHAR Reserved10[2]; - }; - //UCHAR Reserved12[2]; // offset 24 - -} CDVD_CAPABILITIES_PAGE, *PCDVD_CAPABILITIES_PAGE; -#pragma pack(pop, mode_page_capabilities) - -#pragma pack(push, lun_list, 1) -typedef struct _LUN_LIST { - UCHAR LunListLength[4]; // sizeof LunSize * 8 - UCHAR Reserved[4]; -#if !defined(__midl) - UCHAR Lun[0][8]; // 4 level of addressing. 2 bytes each. -#endif -} LUN_LIST, *PLUN_LIST; -#pragma pack(pop, lun_list) - - -#define LOADING_MECHANISM_CADDY 0x00 -#define LOADING_MECHANISM_TRAY 0x01 -#define LOADING_MECHANISM_POPUP 0x02 -#define LOADING_MECHANISM_INDIVIDUAL_CHANGER 0x04 -#define LOADING_MECHANISM_CARTRIDGE_CHANGER 0x05 - -// -// end C/DVD 0.9 mode page definitions - -// -// Mode parameter list block descriptor - -// set the block length for reading/writing -// -// - -#define MODE_BLOCK_DESC_LENGTH 8 -#define MODE_HEADER_LENGTH 4 -#define MODE_HEADER_LENGTH10 8 - -#pragma pack(push, mode_parm_rw, 1) -typedef struct _MODE_PARM_READ_WRITE { - - MODE_PARAMETER_HEADER ParameterListHeader; // List Header Format - MODE_PARAMETER_BLOCK ParameterListBlock; // List Block Descriptor - -} MODE_PARM_READ_WRITE_DATA, *PMODE_PARM_READ_WRITE_DATA; -#pragma pack(pop, mode_parm_rw) - - -// -// Tape definitions -// - -#pragma pack(push, tape_position, 1) -typedef struct _TAPE_POSITION_DATA { - UCHAR Reserved1:2; - UCHAR BlockPositionUnsupported:1; - UCHAR Reserved2:3; - UCHAR EndOfPartition:1; - UCHAR BeginningOfPartition:1; - UCHAR PartitionNumber; - USHORT Reserved3; - UCHAR FirstBlock[4]; - UCHAR LastBlock[4]; - UCHAR Reserved4; - UCHAR NumberOfBlocks[3]; - UCHAR NumberOfBytes[4]; -} TAPE_POSITION_DATA, *PTAPE_POSITION_DATA; -#pragma pack(pop, tape_position) - -// -// This structure is used to convert little endian -// ULONGs to SCSI CDB big endians values. -// - -#pragma pack(push, byte_stuff, 1) -typedef union _EIGHT_BYTE { - - struct { - UCHAR Byte0; - UCHAR Byte1; - UCHAR Byte2; - UCHAR Byte3; - UCHAR Byte4; - UCHAR Byte5; - UCHAR Byte6; - UCHAR Byte7; - }; - - ULONGLONG AsULongLong; -} EIGHT_BYTE, *PEIGHT_BYTE; - -typedef union _FOUR_BYTE { - - struct { - UCHAR Byte0; - UCHAR Byte1; - UCHAR Byte2; - UCHAR Byte3; - }; - - ULONG AsULong; -} FOUR_BYTE, *PFOUR_BYTE; - -typedef union _TWO_BYTE { - - struct { - UCHAR Byte0; - UCHAR Byte1; - }; - - USHORT AsUShort; -} TWO_BYTE, *PTWO_BYTE; -#pragma pack(pop, byte_stuff) - -// -// Byte reversing macro for converting -// between big- and little-endian formats -// - -#define REVERSE_BYTES_QUAD(Destination, Source) { \ - PEIGHT_BYTE d = (PEIGHT_BYTE)(Destination); \ - PEIGHT_BYTE s = (PEIGHT_BYTE)(Source); \ - d->Byte7 = s->Byte0; \ - d->Byte6 = s->Byte1; \ - d->Byte5 = s->Byte2; \ - d->Byte4 = s->Byte3; \ - d->Byte3 = s->Byte4; \ - d->Byte2 = s->Byte5; \ - d->Byte1 = s->Byte6; \ - d->Byte0 = s->Byte7; \ -} - -#define REVERSE_BYTES(Destination, Source) { \ - PFOUR_BYTE d = (PFOUR_BYTE)(Destination); \ - PFOUR_BYTE s = (PFOUR_BYTE)(Source); \ - d->Byte3 = s->Byte0; \ - d->Byte2 = s->Byte1; \ - d->Byte1 = s->Byte2; \ - d->Byte0 = s->Byte3; \ -} - -#define REVERSE_BYTES_SHORT(Destination, Source) { \ - PTWO_BYTE d = (PTWO_BYTE)(Destination); \ - PTWO_BYTE s = (PTWO_BYTE)(Source); \ - d->Byte1 = s->Byte0; \ - d->Byte0 = s->Byte1; \ -} - -// -// Byte reversing macro for converting -// USHORTS from big to little endian in place -// - -#define REVERSE_SHORT(Short) { \ - UCHAR tmp; \ - PTWO_BYTE w = (PTWO_BYTE)(Short); \ - tmp = w->Byte0; \ - w->Byte0 = w->Byte1; \ - w->Byte1 = tmp; \ - } - -// -// Byte reversing macro for convering -// ULONGS between big & little endian in place -// - -#define REVERSE_LONG(Long) { \ - UCHAR tmp; \ - PFOUR_BYTE l = (PFOUR_BYTE)(Long); \ - tmp = l->Byte3; \ - l->Byte3 = l->Byte0; \ - l->Byte0 = tmp; \ - tmp = l->Byte2; \ - l->Byte2 = l->Byte1; \ - l->Byte1 = tmp; \ - } - -// -// This macro has the effect of Bit = log2(Data) -// - -#define WHICH_BIT(Data, Bit) { \ - UCHAR tmp; \ - for (tmp = 0; tmp < 32; tmp++) { \ - if (((Data) >> tmp) == 1) { \ - break; \ - } \ - } \ - ASSERT(tmp != 32); \ - (Bit) = tmp; \ -} - -// end_storport - - -#if defined DebugPrint - #undef DebugPrint -#endif - -#if DBG - -#define DebugPrint(x) TapeDebugPrint x - -#else - -#define DebugPrint(x) - -#endif // DBG - -// -// Define Device Configuration Page -// - -typedef struct _MODE_DEVICE_CONFIGURATION_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PS : 1; - UCHAR PageLength; - UCHAR ActiveFormat : 5; - UCHAR CAFBit : 1; - UCHAR CAPBit : 1; - UCHAR Reserved2 : 1; - UCHAR ActivePartition; - UCHAR WriteBufferFullRatio; - UCHAR ReadBufferEmptyRatio; - UCHAR WriteDelayTime[2]; - UCHAR REW : 1; - UCHAR RBO : 1; - UCHAR SOCF : 2; - UCHAR AVC : 1; - UCHAR RSmk : 1; - UCHAR BIS : 1; - UCHAR DBR : 1; - UCHAR GapSize; - UCHAR Reserved3 : 3; - UCHAR SEW : 1; - UCHAR EEG : 1; - UCHAR EODdefined : 3; - UCHAR BufferSize[3]; - UCHAR DCAlgorithm; - UCHAR Reserved4; - -} MODE_DEVICE_CONFIGURATION_PAGE, *PMODE_DEVICE_CONFIGURATION_PAGE; - -// -// Define Medium Partition Page -// - -typedef struct _MODE_MEDIUM_PARTITION_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PSBit : 1; - UCHAR PageLength; - UCHAR MaximumAdditionalPartitions; - UCHAR AdditionalPartitionDefined; - UCHAR Reserved2 : 3; - UCHAR PSUMBit : 2; - UCHAR IDPBit : 1; - UCHAR SDPBit : 1; - UCHAR FDPBit : 1; - UCHAR MediumFormatRecognition; - UCHAR Reserved3[2]; - UCHAR Partition0Size[2]; - UCHAR Partition1Size[2]; - -} MODE_MEDIUM_PARTITION_PAGE, *PMODE_MEDIUM_PARTITION_PAGE; - -// -// Define Data Compression Page -// - -typedef struct _MODE_DATA_COMPRESSION_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 2; - UCHAR PageLength; - UCHAR Reserved2 : 6; - UCHAR DCC : 1; - UCHAR DCE : 1; - UCHAR Reserved3 : 5; - UCHAR RED : 2; - UCHAR DDE : 1; - UCHAR CompressionAlgorithm[4]; - UCHAR DecompressionAlgorithm[4]; - UCHAR Reserved4[4]; - -} MODE_DATA_COMPRESSION_PAGE, *PMODE_DATA_COMPRESSION_PAGE; - -// -// Define capabilites and mechanical status page. -// - -typedef struct _MODE_CAPABILITIES_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 2; - UCHAR PageLength; - UCHAR Reserved2[2]; - UCHAR RO : 1; - UCHAR Reserved3 : 4; - UCHAR SPREV : 1; - UCHAR Reserved4 : 2; - UCHAR Reserved5 : 3; - UCHAR EFMT : 1; - UCHAR Reserved6 : 1; - UCHAR QFA : 1; - UCHAR Reserved7 : 2; - UCHAR LOCK : 1; - UCHAR LOCKED : 1; - UCHAR PREVENT : 1; - UCHAR UNLOAD : 1; - UCHAR Reserved8 : 2; - UCHAR ECC : 1; - UCHAR CMPRS : 1; - UCHAR Reserved9 : 1; - UCHAR BLK512 : 1; - UCHAR BLK1024 : 1; - UCHAR Reserved10 : 4; - UCHAR SLOWB : 1; - UCHAR MaximumSpeedSupported[2]; - UCHAR MaximumStoredDefectedListEntries[2]; - UCHAR ContinuousTransferLimit[2]; - UCHAR CurrentSpeedSelected[2]; - UCHAR BufferSize[2]; - UCHAR Reserved11[2]; - -} MODE_CAPABILITIES_PAGE, *PMODE_CAPABILITIES_PAGE; - -typedef struct _MODE_CAP_PAGE { - - MODE_PARAMETER_HEADER ParameterListHeader; - MODE_PARAMETER_BLOCK ParameterListBlock; - MODE_CAPABILITIES_PAGE CapabilitiesPage; - -} MODE_CAP_PAGE, *PMODE_CAP_PAGE; - - - -// -// Mode parameter list header and medium partition page - -// used in creating partitions -// - -typedef struct _MODE_MEDIUM_PART_PAGE { - - MODE_PARAMETER_HEADER ParameterListHeader; - MODE_MEDIUM_PARTITION_PAGE MediumPartPage; - -} MODE_MEDIUM_PART_PAGE, *PMODE_MEDIUM_PART_PAGE; - -typedef struct _MODE_MEDIUM_PART_PAGE_PLUS { - - MODE_PARAMETER_HEADER ParameterListHeader; - MODE_PARAMETER_BLOCK ParameterListBlock; - MODE_MEDIUM_PARTITION_PAGE MediumPartPage; - -} MODE_MEDIUM_PART_PAGE_PLUS, *PMODE_MEDIUM_PART_PAGE_PLUS; - - - -// -// Mode parameters for retrieving tape or media information -// - -typedef struct _MODE_TAPE_MEDIA_INFORMATION { - - MODE_PARAMETER_HEADER ParameterListHeader; - MODE_PARAMETER_BLOCK ParameterListBlock; - MODE_MEDIUM_PARTITION_PAGE MediumPartPage; - -} MODE_TAPE_MEDIA_INFORMATION, *PMODE_TAPE_MEDIA_INFORMATION; - -// -// Mode parameter list header and device configuration page - -// used in retrieving device configuration information -// - -typedef struct _MODE_DEVICE_CONFIG_PAGE { - - MODE_PARAMETER_HEADER ParameterListHeader; - MODE_DEVICE_CONFIGURATION_PAGE DeviceConfigPage; - -} MODE_DEVICE_CONFIG_PAGE, *PMODE_DEVICE_CONFIG_PAGE; - -typedef struct _MODE_DEVICE_CONFIG_PAGE_PLUS { - - MODE_PARAMETER_HEADER ParameterListHeader; - MODE_PARAMETER_BLOCK ParameterListBlock; - MODE_DEVICE_CONFIGURATION_PAGE DeviceConfigPage; - -} MODE_DEVICE_CONFIG_PAGE_PLUS, *PMODE_DEVICE_CONFIG_PAGE_PLUS ; - -// -// Mode parameter list header and data compression page - -// used in retrieving data compression information -// - -typedef struct _MODE_DATA_COMPRESS_PAGE { - - MODE_PARAMETER_HEADER ParameterListHeader; - MODE_DATA_COMPRESSION_PAGE DataCompressPage; - -} MODE_DATA_COMPRESS_PAGE, *PMODE_DATA_COMPRESS_PAGE; - -typedef struct _MODE_DATA_COMPRESS_PAGE_PLUS { - - MODE_PARAMETER_HEADER ParameterListHeader; - MODE_PARAMETER_BLOCK ParameterListBlock; - MODE_DATA_COMPRESSION_PAGE DataCompressPage; - -} MODE_DATA_COMPRESS_PAGE_PLUS, *PMODE_DATA_COMPRESS_PAGE_PLUS; - - - -// -// Tape/Minitape definition. -// - -typedef -BOOLEAN -(*TAPE_VERIFY_INQUIRY_ROUTINE)( - __in PINQUIRYDATA InquiryData, - __in PMODE_CAPABILITIES_PAGE ModeCapabilitiesPage - ); - -typedef -VOID -(*TAPE_EXTENSION_INIT_ROUTINE)( - __in PVOID MinitapeExtension, - __in PINQUIRYDATA InquiryData, - __in PMODE_CAPABILITIES_PAGE ModeCapabilitiesPage - ); - -typedef enum _TAPE_STATUS { - TAPE_STATUS_SEND_SRB_AND_CALLBACK, - TAPE_STATUS_CALLBACK, - TAPE_STATUS_CHECK_TEST_UNIT_READY, - - TAPE_STATUS_SUCCESS, - TAPE_STATUS_INSUFFICIENT_RESOURCES, - TAPE_STATUS_NOT_IMPLEMENTED, - TAPE_STATUS_INVALID_DEVICE_REQUEST, - TAPE_STATUS_INVALID_PARAMETER, - - TAPE_STATUS_MEDIA_CHANGED, - TAPE_STATUS_BUS_RESET, - TAPE_STATUS_SETMARK_DETECTED, - TAPE_STATUS_FILEMARK_DETECTED, - TAPE_STATUS_BEGINNING_OF_MEDIA, - TAPE_STATUS_END_OF_MEDIA, - TAPE_STATUS_BUFFER_OVERFLOW, - TAPE_STATUS_NO_DATA_DETECTED, - TAPE_STATUS_EOM_OVERFLOW, - TAPE_STATUS_NO_MEDIA, - TAPE_STATUS_IO_DEVICE_ERROR, - TAPE_STATUS_UNRECOGNIZED_MEDIA, - - TAPE_STATUS_DEVICE_NOT_READY, - TAPE_STATUS_MEDIA_WRITE_PROTECTED, - TAPE_STATUS_DEVICE_DATA_ERROR, - TAPE_STATUS_NO_SUCH_DEVICE, - TAPE_STATUS_INVALID_BLOCK_LENGTH, - TAPE_STATUS_IO_TIMEOUT, - TAPE_STATUS_DEVICE_NOT_CONNECTED, - TAPE_STATUS_DATA_OVERRUN, - TAPE_STATUS_DEVICE_BUSY, - TAPE_STATUS_REQUIRES_CLEANING, - TAPE_STATUS_CLEANER_CARTRIDGE_INSTALLED - -} TAPE_STATUS, *PTAPE_STATUS; - -typedef -VOID -(*TAPE_ERROR_ROUTINE)( - __in PVOID MinitapeExtension, - __in PSCSI_REQUEST_BLOCK Srb, - __inout PTAPE_STATUS TapeStatus - ); - -#define TAPE_RETRY_MASK 0x0000FFFF -#define IGNORE_ERRORS 0x00010000 -#define RETURN_ERRORS 0x00020000 - -typedef -TAPE_STATUS -(*TAPE_PROCESS_COMMAND_ROUTINE)( - __inout PVOID MinitapeExtension, - __inout PVOID CommandExtension, - __inout PVOID CommandParameters, - __inout PSCSI_REQUEST_BLOCK Srb, - __in ULONG CallNumber, - __in TAPE_STATUS StatusOfLastCommand, - __inout PULONG RetryFlags - ); - -// -// NT 4.0 miniclass drivers will be using this. -// - -typedef struct _TAPE_INIT_DATA { - TAPE_VERIFY_INQUIRY_ROUTINE VerifyInquiry; - BOOLEAN QueryModeCapabilitiesPage ; - ULONG MinitapeExtensionSize; - TAPE_EXTENSION_INIT_ROUTINE ExtensionInit; /* OPTIONAL */ - ULONG DefaultTimeOutValue; /* OPTIONAL */ - TAPE_ERROR_ROUTINE TapeError; /* OPTIONAL */ - ULONG CommandExtensionSize; - TAPE_PROCESS_COMMAND_ROUTINE CreatePartition; - TAPE_PROCESS_COMMAND_ROUTINE Erase; - TAPE_PROCESS_COMMAND_ROUTINE GetDriveParameters; - TAPE_PROCESS_COMMAND_ROUTINE GetMediaParameters; - TAPE_PROCESS_COMMAND_ROUTINE GetPosition; - TAPE_PROCESS_COMMAND_ROUTINE GetStatus; - TAPE_PROCESS_COMMAND_ROUTINE Prepare; - TAPE_PROCESS_COMMAND_ROUTINE SetDriveParameters; - TAPE_PROCESS_COMMAND_ROUTINE SetMediaParameters; - TAPE_PROCESS_COMMAND_ROUTINE SetPosition; - TAPE_PROCESS_COMMAND_ROUTINE WriteMarks; - TAPE_PROCESS_COMMAND_ROUTINE PreProcessReadWrite; -} TAPE_INIT_DATA, *PTAPE_INIT_DATA; - -typedef struct _TAPE_INIT_DATA_EX { - - // - // Size of this structure. - // - - ULONG InitDataSize; - - // - // Keep the 4.0 init data as is, so support of these - // drivers can be as seamless as possible. - // - - TAPE_VERIFY_INQUIRY_ROUTINE VerifyInquiry; - BOOLEAN QueryModeCapabilitiesPage ; - ULONG MinitapeExtensionSize; - TAPE_EXTENSION_INIT_ROUTINE ExtensionInit; /* OPTIONAL */ - ULONG DefaultTimeOutValue; /* OPTIONAL */ - TAPE_ERROR_ROUTINE TapeError; /* OPTIONAL */ - ULONG CommandExtensionSize; - TAPE_PROCESS_COMMAND_ROUTINE CreatePartition; - TAPE_PROCESS_COMMAND_ROUTINE Erase; - TAPE_PROCESS_COMMAND_ROUTINE GetDriveParameters; - TAPE_PROCESS_COMMAND_ROUTINE GetMediaParameters; - TAPE_PROCESS_COMMAND_ROUTINE GetPosition; - TAPE_PROCESS_COMMAND_ROUTINE GetStatus; - TAPE_PROCESS_COMMAND_ROUTINE Prepare; - TAPE_PROCESS_COMMAND_ROUTINE SetDriveParameters; - TAPE_PROCESS_COMMAND_ROUTINE SetMediaParameters; - TAPE_PROCESS_COMMAND_ROUTINE SetPosition; - TAPE_PROCESS_COMMAND_ROUTINE WriteMarks; - TAPE_PROCESS_COMMAND_ROUTINE PreProcessReadWrite; - - // - // New entry points / information for 5.0 - // - // Returns supported media types for the device. - // - - TAPE_PROCESS_COMMAND_ROUTINE TapeGetMediaTypes; - - // - // Indicates the number of different types the drive supports. - // - - ULONG MediaTypesSupported; - - // - // Entry point for all WMI operations that the driver/device supports. - // - - TAPE_PROCESS_COMMAND_ROUTINE TapeWMIOperations; - ULONG Reserved[2]; -} TAPE_INIT_DATA_EX, *PTAPE_INIT_DATA_EX; - -SCSIPORT_API -ULONG -TapeClassInitialize( - __in PVOID Argument1, - __in PVOID Argument2, - __in PTAPE_INIT_DATA_EX TapeInitData - ); - -SCSIPORT_API -BOOLEAN -TapeClassAllocateSrbBuffer( - __inout PSCSI_REQUEST_BLOCK Srb, - __in ULONG SrbBufferSize - ); - -SCSIPORT_API -VOID -TapeClassZeroMemory( - __inout_bcount(BufferSize) __inout PVOID Buffer, - __in ULONG BufferSize - ); - -SCSIPORT_API -ULONG -TapeClassCompareMemory( - __inout PVOID Source1, - __inout PVOID Source2, - __in ULONG Length - ); - -SCSIPORT_API -LARGE_INTEGER -TapeClassLiDiv( - __in LARGE_INTEGER Dividend, - __in LARGE_INTEGER Divisor - ); - -SCSIPORT_API -VOID -TapeDebugPrint( - ULONG DebugPrintLevel, - PCCHAR DebugMessage, - ... - ); - - -// -// defines for QIC tape density codes -// - -#define QIC_XX 0 // ???? -#define QIC_24 5 // 0x05 -#define QIC_120 15 // 0x0F -#define QIC_150 16 // 0x10 -#define QIC_525 17 // 0x11 -#define QIC_1350 18 // 0x12 -#define QIC_1000 21 // 0x15 -#define QIC_1000C 30 // 0x1E -#define QIC_2100 31 // 0x1F -#define QIC_2GB 34 // 0x22 -#define QIC_5GB 40 // 0x28 - -// -// defines for QIC tape media codes -// - -#define DCXXXX 0 -#define DC300 1 -#define DC300XLP 2 -#define DC615 3 -#define DC600 4 -#define DC6037 5 -#define DC6150 6 -#define DC6250 7 -#define DC6320 8 -#define DC6525 9 -#define DC9135SL 33 //0x21 -#define DC9210 34 //0x22 -#define DC9135 35 //0x23 -#define DC9100 36 //0x24 -#define DC9120 37 //0x25 -#define DC9120SL 38 //0x26 -#define DC9164 39 //0x27 -#define DCXXXXFW 48 //0x30 -#define DC9200SL 49 //0x31 -#define DC9210XL 50 //0x32 -#define DC10GB 51 //0x33 -#define DC9200 52 //0x34 -#define DC9120XL 53 //0x35 -#define DC9210SL 54 //0x36 -#define DC9164XL 55 //0x37 -#define DC9200XL 64 //0x40 -#define DC9400 65 //0x41 -#define DC9500 66 //0x42 -#define DC9500SL 70 //0x46 - -// -// defines for translation reference point -// - -#define NOT_FROM_BOT 0 -#define FROM_BOT 1 - -// -// info/structure returned by/from -// TapeLogicalBlockToPhysicalBlock( ) -// - -typedef struct _TAPE_PHYS_POSITION { - ULONG SeekBlockAddress; - ULONG SpaceBlockCount; -} TAPE_PHYS_POSITION, PTAPE_PHYS_POSITION; - -// -// function prototypes -// - -TAPE_PHYS_POSITION -TapeClassLogicalBlockToPhysicalBlock( - __in UCHAR DensityCode, - __in ULONG LogicalBlockAddress, - __in ULONG BlockLength, - __in BOOLEAN FromBOT - ); - -ULONG -TapeClassPhysicalBlockToLogicalBlock( - __in UCHAR DensityCode, - __in ULONG PhysicalBlockAddress, - __in ULONG BlockLength, - __in BOOLEAN FromBOT - ); - - -// -// LOG SENSE Page codes -// -#define TapeAlertLogPage 0x2E - -// -// Type of tape drive alert information -// supported by the drive. -// For example, if the type is TapeAlertInfoNone, the drive doesn't -// support any alert info. Need to use read\write error counters -// to predict drive problems. If the type is TapeAlertInfoRequestSense, -// request sense command can be used to determine drive problems. -// -typedef enum _TAPE_ALERT_INFO_TYPE { - TapeAlertInfoNone, - TapeAlertInfoRequestSense, - TapeAlertInfoLogPage -} TAPE_ALERT_INFO_TYPE; - -// -// Tape alert information -// -#define READ_WARNING 1 -#define WRITE_WARNING 2 -#define HARD_ERROR 3 -#define MEDIA_ERROR 4 -#define READ_FAILURE 5 -#define WRITE_FAILURE 6 -#define MEDIA_LIFE 7 -#define NOT_DATA_GRADE 8 -#define WRITE_PROTECT 9 -#define NO_REMOVAL 10 -#define CLEANING_MEDIA 11 -#define UNSUPPORTED_FORMAT 12 -#define SNAPPED_TAPE 13 -#define CLEAN_NOW 20 -#define CLEAN_PERIODIC 21 -#define EXPIRED_CLEANING_MEDIA 22 -#define HARDWARE_A 30 -#define HARDWARE_B 31 -#define INTERFACE_ERROR 32 -#define EJECT_MEDIA 33 -#define DOWNLOAD_FAIL 34 - -// -// The following structs are duplicated from wmidata.h -// wmidata.h is generated from wmicore.mof file. Should -// the MOF file change for these structs, the corresponding -// change should be made in these structs also. -// Since minidrivers do not have access wmidata.h, we need -// to duplicate it here. -// -// ISSUE : 02/28/2000 - nramas : Should find a better way to -// handle the above. Duplication will cause problems in keeping -// these definitions in sync. -// -typedef struct _WMI_TAPE_DRIVE_PARAMETERS -{ - // Maximum block size supported - ULONG MaximumBlockSize; - - // Minimum block size supported - ULONG MinimumBlockSize; - - // Default block size supported - ULONG DefaultBlockSize; - - // Maximum number of partitions allowed. - ULONG MaximumPartitionCount; - - // TRUE if drive supports compression. - BOOLEAN CompressionCapable; - - // TRUE if compression is enabled. - BOOLEAN CompressionEnabled; - - // TRUE if drive reports setmarks - BOOLEAN ReportSetmarks; - - // TRUE if drive supports hardware error correction - BOOLEAN HardwareErrorCorrection; -} WMI_TAPE_DRIVE_PARAMETERS, *PWMI_TAPE_DRIVE_PARAMETERS; - -typedef struct _WMI_TAPE_MEDIA_PARAMETERS -{ - // Maximum capacity of the media - ULONGLONG MaximumCapacity; - - // Available capacity of the media - ULONGLONG AvailableCapacity; - - // Current blocksize - ULONG BlockSize; - - // Current number of partitions - ULONG PartitionCount; - - // TRUEif media is write protected - BOOLEAN MediaWriteProtected; -} WMI_TAPE_MEDIA_PARAMETERS, *PWMI_TAPE_MEDIA_PARAMETERS; - - -typedef struct _WMI_TAPE_PROBLEM_WARNING -{ - // Tape drive problem warning event - ULONG DriveProblemType; - - // Tape drive problem data - UCHAR TapeData[512]; -} WMI_TAPE_PROBLEM_WARNING, *PWMI_TAPE_PROBLEM_WARNING; - -typedef struct _WMI_TAPE_PROBLEM_IO_ERROR -{ - // Read errors corrected without much delay - ULONG ReadCorrectedWithoutDelay; - - // Read errors corrected with substantial delay - ULONG ReadCorrectedWithDelay; - - // Total number of Read errors - ULONG ReadTotalErrors; - - // Total number of read errors that were corrected - ULONG ReadTotalCorrectedErrors; - - // Total number of uncorrected read errors - ULONG ReadTotalUncorrectedErrors; - - // Number of times correction algorithm was processed for read - ULONG ReadCorrectionAlgorithmProcessed; - - // Write errors corrected without much delay - ULONG WriteCorrectedWithoutDelay; - - // Write errors corrected with substantial delay - ULONG WriteCorrectedWithDelay; - - // Total number of Read errors - ULONG WriteTotalErrors; - - // Total number of write errors that were corrected - ULONG WriteTotalCorrectedErrors; - - // Total number of uncorrected write errors - ULONG WriteTotalUncorrectedErrors; - - // Number of times correction algorithm was processed for write - ULONG WriteCorrectionAlgorithmProcessed; - - // Errors not related to medium - ULONG NonMediumErrors; -} WMI_TAPE_PROBLEM_IO_ERROR, *PWMI_TAPE_PROBLEM_IO_ERROR; - -typedef struct _WMI_TAPE_PROBLEM_DEVICE_ERROR -{ - - // WARNING : Drive is experiencing read problem. - BOOLEAN ReadWarning; - - // WARNING : Drive is experiencing write problem. - BOOLEAN WriteWarning; - - // Drive hardware problem - BOOLEAN HardError; - - // Critical Error : Too many read errors. - BOOLEAN ReadFailure; - - // Critical Error : Too many write errors. - BOOLEAN WriteFailure; - - // Tape format not supported - BOOLEAN UnsupportedFormat; - - // Tape is snapped. Replace media - BOOLEAN TapeSnapped; - - // Drive Requires Cleaning - BOOLEAN DriveRequiresCleaning; - - // It's time to clean the drive - BOOLEAN TimetoCleanDrive; - - // Hardware error. Check drive - BOOLEAN DriveHardwareError; - - // Some error in cabling, or connection. - BOOLEAN ScsiInterfaceError; - - // Critical Error : Media life expired. - BOOLEAN MediaLife; -} WMI_TAPE_PROBLEM_DEVICE_ERROR, *PWMI_TAPE_PROBLEM_DEVICE_ERROR; - - -#if defined(_MSC_VER) && (_MSC_VER >= 800) -#if (_MSC_VER >= 1200) -#pragma warning(pop) -#else -#pragma warning(default:4200) /* nonstandard extension used : zero-sized array in struct/union */ -#pragma warning(default:4201) /* nonstandard extension used : Nameless struct/union */ -#pragma warning(default:4214) /* nonstandard extension used : Bit field types other than int */ -#endif -#endif - -#endif /* _MINITAPE_ */ - diff --git a/pub/ddk/mountdev.h b/pub/ddk/mountdev.h deleted file mode 100644 index 569868b..0000000 --- a/pub/ddk/mountdev.h +++ /dev/null @@ -1,77 +0,0 @@ -/*++ - -Copyright (c) 1997 Microsoft Corporation - -Module Name: - - mountdev.h - -Abstract: - - This file defines the private interfaces between the mount point manager - and the mounted devices. - - - -Revision History: - ---*/ - -#ifndef _MOUNTDEV_ -#define _MOUNTDEV_ - -#include - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -#define IOCTL_MOUNTDEV_QUERY_UNIQUE_ID CTL_CODE(MOUNTDEVCONTROLTYPE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME CTL_CODE(MOUNTDEVCONTROLTYPE, 3, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_MOUNTDEV_LINK_CREATED CTL_CODE(MOUNTDEVCONTROLTYPE, 4, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_MOUNTDEV_LINK_DELETED CTL_CODE(MOUNTDEVCONTROLTYPE, 5, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) - -// -// Output structure for IOCTL_MOUNTDEV_QUERY_UNIQUE_ID. -// Input structure for IOCTL_MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY. -// - -typedef struct _MOUNTDEV_UNIQUE_ID { - USHORT UniqueIdLength; - UCHAR UniqueId[1]; -} MOUNTDEV_UNIQUE_ID, *PMOUNTDEV_UNIQUE_ID; - -// -// MOUNTDEV_NAME -// -// Input structure for IOCTL_MOUNTDEV_LINK_CREATED. -// Input structure for IOCTL_MOUNTDEV_LINK_DELETED. -// - -// -// Output structure for IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME -// - -typedef struct _MOUNTDEV_SUGGESTED_LINK_NAME { - BOOLEAN UseOnlyIfThereAreNoOtherLinks; - USHORT NameLength; - WCHAR Name[1]; -} MOUNTDEV_SUGGESTED_LINK_NAME, *PMOUNTDEV_SUGGESTED_LINK_NAME; - - -#endif // NTDDI_VERSION >= NTDDI_WIN2K - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -#define IOCTL_MOUNTDEV_QUERY_STABLE_GUID CTL_CODE(MOUNTDEVCONTROLTYPE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS) - -// -// Output structure for IOCTL_MOUNTDEV_QUERY_STABLE_GUID. -// - -typedef struct _MOUNTDEV_STABLE_GUID { - GUID StableGuid; -} MOUNTDEV_STABLE_GUID, *PMOUNTDEV_STABLE_GUID; - -#endif // NTDDI_VERSION >= NTDDI_WINXP - -#endif // _MOUNTDEV_ - diff --git a/pub/ddk/mountmgr.h b/pub/ddk/mountmgr.h deleted file mode 100644 index 39ed80a..0000000 --- a/pub/ddk/mountmgr.h +++ /dev/null @@ -1,295 +0,0 @@ -/*++ - -Copyright (c) 1997-1999 Microsoft Corporation - -Module Name: - - mountmgr.h - -Abstract: - - This file defines the external mount point interface for administering - mount points. - -Revision History: - ---*/ - -#ifndef _MOUNTMGR_ -#define _MOUNTMGR_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifndef FAR -#define FAR -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -#define MOUNTMGR_DEVICE_NAME L"\\Device\\MountPointManager" -#define MOUNTMGR_DOS_DEVICE_NAME L"\\\\.\\MountPointManager" - -#define MOUNTMGRCONTROLTYPE 0x0000006D // 'm' -#define MOUNTDEVCONTROLTYPE 0x0000004D // 'M' - -// -// These are the IOCTLs supported by the mount point manager. -// - -#define IOCTL_MOUNTMGR_CREATE_POINT CTL_CODE(MOUNTMGRCONTROLTYPE, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_MOUNTMGR_DELETE_POINTS CTL_CODE(MOUNTMGRCONTROLTYPE, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_MOUNTMGR_QUERY_POINTS CTL_CODE(MOUNTMGRCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY CTL_CODE(MOUNTMGRCONTROLTYPE, 3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER CTL_CODE(MOUNTMGRCONTROLTYPE, 4, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_MOUNTMGR_AUTO_DL_ASSIGNMENTS CTL_CODE(MOUNTMGRCONTROLTYPE, 5, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED CTL_CODE(MOUNTMGRCONTROLTYPE, 6, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED CTL_CODE(MOUNTMGRCONTROLTYPE, 7, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_MOUNTMGR_CHANGE_NOTIFY CTL_CODE(MOUNTMGRCONTROLTYPE, 8, METHOD_BUFFERED, FILE_READ_ACCESS) -#define IOCTL_MOUNTMGR_KEEP_LINKS_WHEN_OFFLINE CTL_CODE(MOUNTMGRCONTROLTYPE, 9, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_MOUNTMGR_CHECK_UNPROCESSED_VOLUMES CTL_CODE(MOUNTMGRCONTROLTYPE, 10, METHOD_BUFFERED, FILE_READ_ACCESS) -#define IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION CTL_CODE(MOUNTMGRCONTROLTYPE, 11, METHOD_BUFFERED, FILE_READ_ACCESS) - -// -// Input structure for IOCTL_MOUNTMGR_CREATE_POINT. -// - -typedef struct _MOUNTMGR_CREATE_POINT_INPUT { - USHORT SymbolicLinkNameOffset; - USHORT SymbolicLinkNameLength; - USHORT DeviceNameOffset; - USHORT DeviceNameLength; -} MOUNTMGR_CREATE_POINT_INPUT, *PMOUNTMGR_CREATE_POINT_INPUT; - -// -// Input structure for IOCTL_MOUNTMGR_DELETE_POINTS, -// IOCTL_MOUNTMGR_QUERY_POINTS, and IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY. -// - -typedef struct _MOUNTMGR_MOUNT_POINT { - ULONG SymbolicLinkNameOffset; - USHORT SymbolicLinkNameLength; - ULONG UniqueIdOffset; - USHORT UniqueIdLength; - ULONG DeviceNameOffset; - USHORT DeviceNameLength; -} MOUNTMGR_MOUNT_POINT, *PMOUNTMGR_MOUNT_POINT; - -// -// Output structure for IOCTL_MOUNTMGR_DELETE_POINTS, -// IOCTL_MOUNTMGR_QUERY_POINTS, and IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY. -// - -typedef struct _MOUNTMGR_MOUNT_POINTS { - ULONG Size; - ULONG NumberOfMountPoints; - MOUNTMGR_MOUNT_POINT MountPoints[1]; -} MOUNTMGR_MOUNT_POINTS, *PMOUNTMGR_MOUNT_POINTS; - -// -// Input structure for IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER. -// - -typedef struct _MOUNTMGR_DRIVE_LETTER_TARGET { - USHORT DeviceNameLength; - WCHAR DeviceName[1]; -} MOUNTMGR_DRIVE_LETTER_TARGET, *PMOUNTMGR_DRIVE_LETTER_TARGET; - -// -// Output structure for IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER. -// - -typedef struct _MOUNTMGR_DRIVE_LETTER_INFORMATION { - BOOLEAN DriveLetterWasAssigned; - UCHAR CurrentDriveLetter; -} MOUNTMGR_DRIVE_LETTER_INFORMATION, *PMOUNTMGR_DRIVE_LETTER_INFORMATION; - -// -// Input structure for IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED and -// IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED. -// - -typedef struct _MOUNTMGR_VOLUME_MOUNT_POINT { - USHORT SourceVolumeNameOffset; - USHORT SourceVolumeNameLength; - USHORT TargetVolumeNameOffset; - USHORT TargetVolumeNameLength; -} MOUNTMGR_VOLUME_MOUNT_POINT, *PMOUNTMGR_VOLUME_MOUNT_POINT; - -// -// Input structure for IOCTL_MOUNTMGR_CHANGE_NOTIFY. -// Output structure for IOCTL_MOUNTMGR_CHANGE_NOTIFY. -// - -typedef struct _MOUNTMGR_CHANGE_NOTIFY_INFO { - ULONG EpicNumber; -} MOUNTMGR_CHANGE_NOTIFY_INFO, *PMOUNTMGR_CHANGE_NOTIFY_INFO; - -// -// Input structure for IOCTL_MOUNTMGR_KEEP_LINKS_WHEN_OFFLINE, -// IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION, -// IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH, and -// IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS. -// - -typedef struct _MOUNTMGR_TARGET_NAME { - USHORT DeviceNameLength; - WCHAR DeviceName[1]; -} MOUNTMGR_TARGET_NAME, *PMOUNTMGR_TARGET_NAME; - -// -// Macro that defines what a "drive letter" mount point is. This macro can -// be used to scan the result from QUERY_POINTS to discover which mount points -// are find "drive letter" mount points. -// - -#define MOUNTMGR_IS_DRIVE_LETTER(s) ( \ - (s)->Length == 28 && \ - (s)->Buffer[0] == '\\' && \ - (s)->Buffer[1] == 'D' && \ - (s)->Buffer[2] == 'o' && \ - (s)->Buffer[3] == 's' && \ - (s)->Buffer[4] == 'D' && \ - (s)->Buffer[5] == 'e' && \ - (s)->Buffer[6] == 'v' && \ - (s)->Buffer[7] == 'i' && \ - (s)->Buffer[8] == 'c' && \ - (s)->Buffer[9] == 'e' && \ - (s)->Buffer[10] == 's' && \ - (s)->Buffer[11] == '\\' && \ - (s)->Buffer[12] >= 'A' && \ - (s)->Buffer[12] <= 'Z' && \ - (s)->Buffer[13] == ':') - -// -// Macro that defines what a "volume name" mount point is. This macro can -// be used to scan the result from QUERY_POINTS to discover which mount points -// are "volume name" mount points. -// - -#define MOUNTMGR_IS_VOLUME_NAME(s) ( \ - ((s)->Length == 96 || ((s)->Length == 98 && (s)->Buffer[48] == '\\')) && \ - (s)->Buffer[0] == '\\' && \ - ((s)->Buffer[1] == '?' || (s)->Buffer[1] == '\\') && \ - (s)->Buffer[2] == '?' && \ - (s)->Buffer[3] == '\\' && \ - (s)->Buffer[4] == 'V' && \ - (s)->Buffer[5] == 'o' && \ - (s)->Buffer[6] == 'l' && \ - (s)->Buffer[7] == 'u' && \ - (s)->Buffer[8] == 'm' && \ - (s)->Buffer[9] == 'e' && \ - (s)->Buffer[10] == '{' && \ - (s)->Buffer[19] == '-' && \ - (s)->Buffer[24] == '-' && \ - (s)->Buffer[29] == '-' && \ - (s)->Buffer[34] == '-' && \ - (s)->Buffer[47] == '}' \ - ) - -// -// The following IOCTL is supported by mounted devices. -// - -#define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME CTL_CODE(MOUNTDEVCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) - -// -// Output structure for IOCTL_MOUNTDEV_QUERY_DEVICE_NAME. -// - -typedef struct _MOUNTDEV_NAME { - USHORT NameLength; - WCHAR Name[1]; -} MOUNTDEV_NAME, *PMOUNTDEV_NAME; - -// -// Devices that wish to be mounted should report this GUID in -// IoRegisterDeviceInterface. -// - -#ifdef DEFINE_GUID - -DEFINE_GUID(MOUNTDEV_MOUNTED_DEVICE_GUID, 0x53f5630d, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b); - -#endif - - -#endif // NTDDI_VERSION >= NTDDI_WIN2K - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -#define IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH CTL_CODE(MOUNTMGRCONTROLTYPE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS CTL_CODE(MOUNTMGRCONTROLTYPE, 13, METHOD_BUFFERED, FILE_ANY_ACCESS) - -// -// Output structure for IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH and -// IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS. -// - -typedef struct _MOUNTMGR_VOLUME_PATHS { - ULONG MultiSzLength; - WCHAR MultiSz[1]; -} MOUNTMGR_VOLUME_PATHS, *PMOUNTMGR_VOLUME_PATHS; - - -#define MOUNTMGR_IS_DOS_VOLUME_NAME(s) ( \ - MOUNTMGR_IS_VOLUME_NAME(s) && \ - (s)->Length == 96 && \ - (s)->Buffer[1] == '\\' \ - ) - -#define MOUNTMGR_IS_DOS_VOLUME_NAME_WB(s) ( \ - MOUNTMGR_IS_VOLUME_NAME(s) && \ - (s)->Length == 98 && \ - (s)->Buffer[1] == '\\' \ - ) - -#define MOUNTMGR_IS_NT_VOLUME_NAME(s) ( \ - MOUNTMGR_IS_VOLUME_NAME(s) && \ - (s)->Length == 96 && \ - (s)->Buffer[1] == '?' \ - ) - -#define MOUNTMGR_IS_NT_VOLUME_NAME_WB(s) ( \ - MOUNTMGR_IS_VOLUME_NAME(s) && \ - (s)->Length == 98 && \ - (s)->Buffer[1] == '?' \ - ) - -#endif // NTDDI_VERSION >= NTDDI_WINXP - -#if (NTDDI_VERSION >= NTDDI_WS03) - -#define IOCTL_MOUNTMGR_SCRUB_REGISTRY CTL_CODE(MOUNTMGRCONTROLTYPE, 14, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_MOUNTMGR_QUERY_AUTO_MOUNT CTL_CODE(MOUNTMGRCONTROLTYPE, 15, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_MOUNTMGR_SET_AUTO_MOUNT CTL_CODE(MOUNTMGRCONTROLTYPE, 16, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) - -// -// Input / Output structure for querying / setting the auto-mount setting -// - -typedef enum _MOUNTMGR_AUTO_MOUNT_STATE { - Disabled = 0, - Enabled - } MOUNTMGR_AUTO_MOUNT_STATE; - -typedef struct _MOUNTMGR_QUERY_AUTO_MOUNT { - MOUNTMGR_AUTO_MOUNT_STATE CurrentState; - } MOUNTMGR_QUERY_AUTO_MOUNT, *PMOUNTMGR_QUERY_AUTO_MOUNT; - -typedef struct _MOUNTMGR_SET_AUTO_MOUNT { - MOUNTMGR_AUTO_MOUNT_STATE NewState; - } MOUNTMGR_SET_AUTO_MOUNT, *PMOUNTMGR_SET_AUTO_MOUNT; - -#endif // NTDDI_VERSION >= NTDDI_WS03 - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -#define IOCTL_MOUNTMGR_BOOT_DL_ASSIGNMENT CTL_CODE(MOUNTMGRCONTROLTYPE, 17, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_MOUNTMGR_TRACELOG_CACHE CTL_CODE(MOUNTMGRCONTROLTYPE, 18, METHOD_BUFFERED, FILE_READ_ACCESS) - -#endif // NTDDI_VERSION >= NTDDI_WIN7 - -#endif // _MOUNTMGR_ - diff --git a/pub/ddk/mpiodisk.h b/pub/ddk/mpiodisk.h deleted file mode 100644 index 901bd96..0000000 --- a/pub/ddk/mpiodisk.h +++ /dev/null @@ -1,674 +0,0 @@ -#ifndef _mpiodisk_h_ -#define _mpiodisk_h_ - -// PDOSCSI_ADDR - PDOSCSI_ADDR -#define PDOSCSI_ADDRGuid \ - { 0xc74aece4,0x468b,0x4113, { 0xb0,0x06,0x0c,0xec,0xdc,0x96,0x8a,0xc4 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(PDOSCSI_ADDR_GUID, \ - 0xc74aece4,0x468b,0x4113,0xb0,0x06,0x0c,0xec,0xdc,0x96,0x8a,0xc4); -#endif - - -typedef struct _PDOSCSI_ADDR -{ - // - UCHAR PortNumber; - #define PDOSCSI_ADDR_PortNumber_SIZE sizeof(UCHAR) - #define PDOSCSI_ADDR_PortNumber_ID 1 - - // - UCHAR ScsiPathId; - #define PDOSCSI_ADDR_ScsiPathId_SIZE sizeof(UCHAR) - #define PDOSCSI_ADDR_ScsiPathId_ID 2 - - // - UCHAR TargetId; - #define PDOSCSI_ADDR_TargetId_SIZE sizeof(UCHAR) - #define PDOSCSI_ADDR_TargetId_ID 3 - - // - UCHAR Lun; - #define PDOSCSI_ADDR_Lun_SIZE sizeof(UCHAR) - #define PDOSCSI_ADDR_Lun_ID 4 - -} PDOSCSI_ADDR, *PPDOSCSI_ADDR; - -#define PDOSCSI_ADDR_SIZE (FIELD_OFFSET(PDOSCSI_ADDR, Lun) + PDOSCSI_ADDR_Lun_SIZE) - -// PDO_INFORMATION - PDO_INFORMATION -#define PDO_INFORMATIONGuid \ - { 0xe69e581d,0x6580,0x4bc2, { 0xba,0xd1,0x7e,0xee,0x85,0x98,0x90,0x86 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(PDO_INFORMATION_GUID, \ - 0xe69e581d,0x6580,0x4bc2,0xba,0xd1,0x7e,0xee,0x85,0x98,0x90,0x86); -#endif - - -typedef struct _PDO_INFORMATION -{ - // - PDOSCSI_ADDR ScsiAddress; - #define PDO_INFORMATION_ScsiAddress_SIZE sizeof(PDOSCSI_ADDR) - #define PDO_INFORMATION_ScsiAddress_ID 1 - - // - ULONG DeviceState; - #define PDO_INFORMATION_DeviceState_SIZE sizeof(ULONG) - #define PDO_INFORMATION_DeviceState_ID 2 - - // - ULONGLONG PathIdentifier; - #define PDO_INFORMATION_PathIdentifier_SIZE sizeof(ULONGLONG) - #define PDO_INFORMATION_PathIdentifier_ID 3 - - // - ULONG IdentifierType; - #define PDO_INFORMATION_IdentifierType_SIZE sizeof(ULONG) - #define PDO_INFORMATION_IdentifierType_ID 4 - - // - ULONG IdentifierLength; - #define PDO_INFORMATION_IdentifierLength_SIZE sizeof(ULONG) - #define PDO_INFORMATION_IdentifierLength_ID 5 - - // - UCHAR Identifier[32]; - #define PDO_INFORMATION_Identifier_SIZE sizeof(UCHAR[32]) - #define PDO_INFORMATION_Identifier_ID 6 - - // - UCHAR Pad[4]; - #define PDO_INFORMATION_Pad_SIZE sizeof(UCHAR[4]) - #define PDO_INFORMATION_Pad_ID 7 - -} PDO_INFORMATION, *PPDO_INFORMATION; - -#define PDO_INFORMATION_SIZE (FIELD_OFFSET(PDO_INFORMATION, Pad) + PDO_INFORMATION_Pad_SIZE) - -// MPIO_GET_DESCRIPTOR - MPIO_GET_DESCRIPTOR -#define MPIO_GET_DESCRIPTORGuid \ - { 0x85134d46,0xd17c,0x4992, { 0x83,0xf9,0x07,0x0d,0xd4,0xc4,0x8e,0x0b } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_GET_DESCRIPTOR_GUID, \ - 0x85134d46,0xd17c,0x4992,0x83,0xf9,0x07,0x0d,0xd4,0xc4,0x8e,0x0b); -#endif - - -typedef struct _MPIO_GET_DESCRIPTOR -{ - // - ULONG NumberPdos; - #define MPIO_GET_DESCRIPTOR_NumberPdos_SIZE sizeof(ULONG) - #define MPIO_GET_DESCRIPTOR_NumberPdos_ID 1 - - // - WCHAR DeviceName[63 + 1]; - #define MPIO_GET_DESCRIPTOR_DeviceName_ID 2 - - // - PDO_INFORMATION PdoInformation[1]; - #define MPIO_GET_DESCRIPTOR_PdoInformation_ID 3 - -} MPIO_GET_DESCRIPTOR, *PMPIO_GET_DESCRIPTOR; - -// MPIO_DEVINSTANCE_HEALTH_CLASS - MPIO_DEVINSTANCE_HEALTH_CLASS -#define MPIO_DEVINSTANCE_HEALTH_CLASSGuid \ - { 0xf5e3daf3,0x4fe2,0x4faa, { 0xb0,0x00,0x48,0x85,0x10,0xa6,0x91,0xe4 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_DEVINSTANCE_HEALTH_CLASS_GUID, \ - 0xf5e3daf3,0x4fe2,0x4faa,0xb0,0x00,0x48,0x85,0x10,0xa6,0x91,0xe4); -#endif - - -typedef struct _MPIO_DEVINSTANCE_HEALTH_CLASS -{ - // - ULONGLONG PathId; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_PathId_SIZE sizeof(ULONGLONG) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_PathId_ID 1 - - // - ULONGLONG NumberReads; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberReads_SIZE sizeof(ULONGLONG) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberReads_ID 2 - - // - ULONGLONG NumberWrites; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberWrites_SIZE sizeof(ULONGLONG) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberWrites_ID 3 - - // - ULONGLONG NumberBytesRead; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberBytesRead_SIZE sizeof(ULONGLONG) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberBytesRead_ID 4 - - // - ULONGLONG NumberBytesWritten; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberBytesWritten_SIZE sizeof(ULONGLONG) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberBytesWritten_ID 5 - - // - ULONGLONG NumberRetries; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberRetries_SIZE sizeof(ULONGLONG) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberRetries_ID 6 - - // - ULONGLONG NumberIoErrors; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberIoErrors_SIZE sizeof(ULONGLONG) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberIoErrors_ID 7 - - // - ULONGLONG CreateTime; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_CreateTime_SIZE sizeof(ULONGLONG) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_CreateTime_ID 8 - - // - ULONGLONG FailTime; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_FailTime_SIZE sizeof(ULONGLONG) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_FailTime_ID 9 - - // - BOOLEAN DeviceOffline; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_DeviceOffline_SIZE sizeof(BOOLEAN) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_DeviceOffline_ID 10 - - // - UCHAR NumberReadsWrap; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberReadsWrap_SIZE sizeof(UCHAR) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberReadsWrap_ID 11 - - // - UCHAR NumberWritesWrap; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberWritesWrap_SIZE sizeof(UCHAR) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberWritesWrap_ID 12 - - // - UCHAR NumberBytesReadWrap; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberBytesReadWrap_SIZE sizeof(UCHAR) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberBytesReadWrap_ID 13 - - // - UCHAR NumberBytesWrittenWrap; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberBytesWrittenWrap_SIZE sizeof(UCHAR) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_NumberBytesWrittenWrap_ID 14 - - // - UCHAR Pad[3]; - #define MPIO_DEVINSTANCE_HEALTH_CLASS_Pad_SIZE sizeof(UCHAR[3]) - #define MPIO_DEVINSTANCE_HEALTH_CLASS_Pad_ID 15 - -} MPIO_DEVINSTANCE_HEALTH_CLASS, *PMPIO_DEVINSTANCE_HEALTH_CLASS; - -#define MPIO_DEVINSTANCE_HEALTH_CLASS_SIZE (FIELD_OFFSET(MPIO_DEVINSTANCE_HEALTH_CLASS, Pad) + MPIO_DEVINSTANCE_HEALTH_CLASS_Pad_SIZE) - -// MPIO_DEVINSTANCE_HEALTH_INFO - MPIO_DEVINSTANCE_HEALTH_INFO -#define MPIO_DEVINSTANCE_HEALTH_INFOGuid \ - { 0x9e4f39ac,0xcbaa,0x4298, { 0xb6,0x00,0x48,0x8a,0xc5,0x65,0x2e,0xa9 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_DEVINSTANCE_HEALTH_INFO_GUID, \ - 0x9e4f39ac,0xcbaa,0x4298,0xb6,0x00,0x48,0x8a,0xc5,0x65,0x2e,0xa9); -#endif - - -typedef struct _MPIO_DEVINSTANCE_HEALTH_INFO -{ - // - ULONG NumberDevInstancePackets; - #define MPIO_DEVINSTANCE_HEALTH_INFO_NumberDevInstancePackets_SIZE sizeof(ULONG) - #define MPIO_DEVINSTANCE_HEALTH_INFO_NumberDevInstancePackets_ID 1 - - // - ULONG Reserved; - #define MPIO_DEVINSTANCE_HEALTH_INFO_Reserved_SIZE sizeof(ULONG) - #define MPIO_DEVINSTANCE_HEALTH_INFO_Reserved_ID 2 - - // - MPIO_DEVINSTANCE_HEALTH_CLASS DevInstanceHealthPackets[1]; - #define MPIO_DEVINSTANCE_HEALTH_INFO_DevInstanceHealthPackets_ID 3 - -} MPIO_DEVINSTANCE_HEALTH_INFO, *PMPIO_DEVINSTANCE_HEALTH_INFO; - -// MPIO_DISK_WMI_METHODS - MPIO_DISK_WMI_METHODS -#define MPIO_DISK_WMI_METHODSGuid \ - { 0xe6f52471,0xf302,0x49ce, { 0x99,0x0b,0xfa,0x7f,0xc9,0xeb,0xe6,0x66 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_DISK_WMI_METHODS_GUID, \ - 0xe6f52471,0xf302,0x49ce,0x99,0x0b,0xfa,0x7f,0xc9,0xeb,0xe6,0x66); -#endif - -// -// Method id definitions for MPIO_DISK_WMI_METHODS -#define ClearAllDevInstancesHealthCounters 1 -#define ClearDevInstanceHealthCounters 2 -typedef struct _ClearDevInstanceHealthCounters_IN -{ - // - ULONGLONG PathID; - #define ClearDevInstanceHealthCounters_IN_PathID_SIZE sizeof(ULONGLONG) - #define ClearDevInstanceHealthCounters_IN_PathID_ID 1 - -} ClearDevInstanceHealthCounters_IN, *PClearDevInstanceHealthCounters_IN; - -#define ClearDevInstanceHealthCounters_IN_SIZE (FIELD_OFFSET(ClearDevInstanceHealthCounters_IN, PathID) + ClearDevInstanceHealthCounters_IN_PathID_SIZE) - - -// MPIO_DSM_Path_V2 - MPIO_DSM_Path_V2 -#define MPIO_DSM_Path_V2Guid \ - { 0xac4e13b0,0x7cb6,0x4599, { 0xb3,0x97,0xfb,0x36,0xfa,0xec,0x5c,0x96 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_DSM_Path_V2_GUID, \ - 0xac4e13b0,0x7cb6,0x4599,0xb3,0x97,0xfb,0x36,0xfa,0xec,0x5c,0x96); -#endif - - -typedef struct _MPIO_DSM_Path_V2 -{ - // - ULONGLONG DsmPathId; - #define MPIO_DSM_Path_V2_DsmPathId_SIZE sizeof(ULONGLONG) - #define MPIO_DSM_Path_V2_DsmPathId_ID 1 - - // - ULONGLONG Reserved; - #define MPIO_DSM_Path_V2_Reserved_SIZE sizeof(ULONGLONG) - #define MPIO_DSM_Path_V2_Reserved_ID 2 - - // - ULONG PathWeight; - #define MPIO_DSM_Path_V2_PathWeight_SIZE sizeof(ULONG) - #define MPIO_DSM_Path_V2_PathWeight_ID 3 - - // - ULONG PrimaryPath; - #define MPIO_DSM_Path_V2_PrimaryPath_SIZE sizeof(ULONG) - #define MPIO_DSM_Path_V2_PrimaryPath_ID 4 - - // - ULONG OptimizedPath; - #define MPIO_DSM_Path_V2_OptimizedPath_SIZE sizeof(ULONG) - #define MPIO_DSM_Path_V2_OptimizedPath_ID 5 - - // - ULONG PreferredPath; - #define MPIO_DSM_Path_V2_PreferredPath_SIZE sizeof(ULONG) - #define MPIO_DSM_Path_V2_PreferredPath_ID 6 - - // - ULONG FailedPath; - #define MPIO_DSM_Path_V2_FailedPath_SIZE sizeof(ULONG) - #define MPIO_DSM_Path_V2_FailedPath_ID 7 - - -#define STATE_ACTIVE_OPTIMIZED 0 -#define STATE_ACTIVE_UNOPTIMIZED 1 -#define STATE_STANDBY 2 -#define STATE_UNAVAILABLE 3 -#define STATE_NOT_USED 16 - - // - ULONG TargetPortGroup_State; - #define MPIO_DSM_Path_V2_TargetPortGroup_State_SIZE sizeof(ULONG) - #define MPIO_DSM_Path_V2_TargetPortGroup_State_ID 8 - - -#define ALUA_NOT_SUPPORTED 0 -#define ALUA_IMPLICIT_ONLY 1 -#define ALUA_EXPLICIT_ONLY 2 -#define ALUA_IMPLICIT_AND_EXPLICIT 3 - - // - ULONG ALUASupport; - #define MPIO_DSM_Path_V2_ALUASupport_SIZE sizeof(ULONG) - #define MPIO_DSM_Path_V2_ALUASupport_ID 9 - - // - UCHAR SymmetricLUA; - #define MPIO_DSM_Path_V2_SymmetricLUA_SIZE sizeof(UCHAR) - #define MPIO_DSM_Path_V2_SymmetricLUA_ID 10 - - // - UCHAR TargetPortGroup_Preferred; - #define MPIO_DSM_Path_V2_TargetPortGroup_Preferred_SIZE sizeof(UCHAR) - #define MPIO_DSM_Path_V2_TargetPortGroup_Preferred_ID 11 - - // - USHORT TargetPortGroup_Identifier; - #define MPIO_DSM_Path_V2_TargetPortGroup_Identifier_SIZE sizeof(USHORT) - #define MPIO_DSM_Path_V2_TargetPortGroup_Identifier_ID 12 - - // - ULONG TargetPort_Identifier; - #define MPIO_DSM_Path_V2_TargetPort_Identifier_SIZE sizeof(ULONG) - #define MPIO_DSM_Path_V2_TargetPort_Identifier_ID 13 - - // - ULONG Reserved32; - #define MPIO_DSM_Path_V2_Reserved32_SIZE sizeof(ULONG) - #define MPIO_DSM_Path_V2_Reserved32_ID 14 - - // - ULONGLONG Reserved64; - #define MPIO_DSM_Path_V2_Reserved64_SIZE sizeof(ULONGLONG) - #define MPIO_DSM_Path_V2_Reserved64_ID 15 - -} MPIO_DSM_Path_V2, *PMPIO_DSM_Path_V2; - -#define MPIO_DSM_Path_V2_SIZE (FIELD_OFFSET(MPIO_DSM_Path_V2, Reserved64) + MPIO_DSM_Path_V2_Reserved64_SIZE) - -// DSM_Load_Balance_Policy_V2 - DSM_Load_Balance_Policy_V2 -#define DSM_Load_Balance_Policy_V2Guid \ - { 0x6f4474ce,0xd20e,0x426c, { 0x93,0x71,0x9b,0x87,0xc2,0xe2,0xcd,0x5a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(DSM_Load_Balance_Policy_V2_GUID, \ - 0x6f4474ce,0xd20e,0x426c,0x93,0x71,0x9b,0x87,0xc2,0xe2,0xcd,0x5a); -#endif - - -typedef struct _DSM_Load_Balance_Policy_V2 -{ - // - ULONG Version; - #define DSM_Load_Balance_Policy_V2_Version_SIZE sizeof(ULONG) - #define DSM_Load_Balance_Policy_V2_Version_ID 1 - - -#define DSM_LB_FAILOVER 1 -#define DSM_LB_ROUND_ROBIN 2 -#define DSM_LB_ROUND_ROBIN_WITH_SUBSET 3 -#define DSM_LB_DYN_LEAST_QUEUE_DEPTH 4 -#define DSM_LB_WEIGHTED_PATHS 5 -#define DSM_LB_LEAST_BLOCKS 6 -#define DSM_LB_VENDOR_SPECIFIC 7 - - // - ULONG LoadBalancePolicy; - #define DSM_Load_Balance_Policy_V2_LoadBalancePolicy_SIZE sizeof(ULONG) - #define DSM_Load_Balance_Policy_V2_LoadBalancePolicy_ID 2 - - // - ULONG DSMPathCount; - #define DSM_Load_Balance_Policy_V2_DSMPathCount_SIZE sizeof(ULONG) - #define DSM_Load_Balance_Policy_V2_DSMPathCount_ID 3 - - // - ULONG Reserved; - #define DSM_Load_Balance_Policy_V2_Reserved_SIZE sizeof(ULONG) - #define DSM_Load_Balance_Policy_V2_Reserved_ID 4 - - // - MPIO_DSM_Path_V2 DSM_Paths[1]; - #define DSM_Load_Balance_Policy_V2_DSM_Paths_ID 5 - -} DSM_Load_Balance_Policy_V2, *PDSM_Load_Balance_Policy_V2; - -// DSM_QueryLBPolicy_V2 - DSM_QueryLBPolicy_V2 -#define DSM_QueryLBPolicy_V2Guid \ - { 0xd14fed0e,0xbdfb,0x4615, { 0x85,0x78,0x35,0x0c,0x4c,0x2b,0x06,0xd7 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(DSM_QueryLBPolicy_V2_GUID, \ - 0xd14fed0e,0xbdfb,0x4615,0x85,0x78,0x35,0x0c,0x4c,0x2b,0x06,0xd7); -#endif - - -typedef struct _DSM_QueryLBPolicy_V2 -{ - // - DSM_Load_Balance_Policy_V2 LoadBalancePolicy; - #define DSM_QueryLBPolicy_V2_LoadBalancePolicy_SIZE sizeof(DSM_Load_Balance_Policy_V2) - #define DSM_QueryLBPolicy_V2_LoadBalancePolicy_ID 1 - -} DSM_QueryLBPolicy_V2, *PDSM_QueryLBPolicy_V2; - -#define DSM_QueryLBPolicy_V2_SIZE (FIELD_OFFSET(DSM_QueryLBPolicy_V2, LoadBalancePolicy) + DSM_QueryLBPolicy_V2_LoadBalancePolicy_SIZE) - -// DSM_QuerySupportedLBPolicies_V2 - DSM_QuerySupportedLBPolicies_V2 -#define DSM_QuerySupportedLBPolicies_V2Guid \ - { 0xfc777b74,0x7bcc,0x47ae, { 0xaa,0x63,0x59,0x65,0x6b,0xa5,0x93,0xfe } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(DSM_QuerySupportedLBPolicies_V2_GUID, \ - 0xfc777b74,0x7bcc,0x47ae,0xaa,0x63,0x59,0x65,0x6b,0xa5,0x93,0xfe); -#endif - - -typedef struct _DSM_QuerySupportedLBPolicies_V2 -{ - // - ULONG SupportedLBPoliciesCount; - #define DSM_QuerySupportedLBPolicies_V2_SupportedLBPoliciesCount_SIZE sizeof(ULONG) - #define DSM_QuerySupportedLBPolicies_V2_SupportedLBPoliciesCount_ID 1 - - // - ULONG Reserved; - #define DSM_QuerySupportedLBPolicies_V2_Reserved_SIZE sizeof(ULONG) - #define DSM_QuerySupportedLBPolicies_V2_Reserved_ID 2 - - // - DSM_Load_Balance_Policy_V2 Supported_LB_Policies[1]; - #define DSM_QuerySupportedLBPolicies_V2_Supported_LB_Policies_ID 3 - -} DSM_QuerySupportedLBPolicies_V2, *PDSM_QuerySupportedLBPolicies_V2; - -// MPIO_DSM_Path - MPIO_DSM_Path -#define MPIO_DSM_PathGuid \ - { 0x80ebd5b4,0x3baf,0x41f1, { 0x9c,0x41,0xbd,0x36,0xc5,0x28,0x2b,0x67 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_DSM_Path_GUID, \ - 0x80ebd5b4,0x3baf,0x41f1,0x9c,0x41,0xbd,0x36,0xc5,0x28,0x2b,0x67); -#endif - - -typedef struct _MPIO_DSM_Path -{ - // - ULONGLONG DsmPathId; - #define MPIO_DSM_Path_DsmPathId_SIZE sizeof(ULONGLONG) - #define MPIO_DSM_Path_DsmPathId_ID 1 - - // - ULONGLONG Reserved; - #define MPIO_DSM_Path_Reserved_SIZE sizeof(ULONGLONG) - #define MPIO_DSM_Path_Reserved_ID 2 - - // - ULONG PathWeight; - #define MPIO_DSM_Path_PathWeight_SIZE sizeof(ULONG) - #define MPIO_DSM_Path_PathWeight_ID 3 - - // - ULONG PrimaryPath; - #define MPIO_DSM_Path_PrimaryPath_SIZE sizeof(ULONG) - #define MPIO_DSM_Path_PrimaryPath_ID 4 - -} MPIO_DSM_Path, *PMPIO_DSM_Path; - -#define MPIO_DSM_Path_SIZE (FIELD_OFFSET(MPIO_DSM_Path, PrimaryPath) + MPIO_DSM_Path_PrimaryPath_SIZE) - -// DSM_Load_Balance_Policy - DSM_Load_Balance_Policy -#define DSM_Load_Balance_PolicyGuid \ - { 0x3078b89b,0xa34f,0x4ff6, { 0x81,0x0a,0xc5,0x6a,0xd3,0xba,0x94,0x7d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(DSM_Load_Balance_Policy_GUID, \ - 0x3078b89b,0xa34f,0x4ff6,0x81,0x0a,0xc5,0x6a,0xd3,0xba,0x94,0x7d); -#endif - - -typedef struct _DSM_Load_Balance_Policy -{ - // - ULONG Version; - #define DSM_Load_Balance_Policy_Version_SIZE sizeof(ULONG) - #define DSM_Load_Balance_Policy_Version_ID 1 - - -#define DSM_LB_FAILOVER 1 -#define DSM_LB_ROUND_ROBIN 2 -#define DSM_LB_ROUND_ROBIN_WITH_SUBSET 3 -#define DSM_LB_DYN_LEAST_QUEUE_DEPTH 4 -#define DSM_LB_WEIGHTED_PATHS 5 -#define DSM_LB_LEAST_BLOCKS 6 -#define DSM_LB_VENDOR_SPECIFIC 7 - - // - ULONG LoadBalancePolicy; - #define DSM_Load_Balance_Policy_LoadBalancePolicy_SIZE sizeof(ULONG) - #define DSM_Load_Balance_Policy_LoadBalancePolicy_ID 2 - - // - ULONG DSMPathCount; - #define DSM_Load_Balance_Policy_DSMPathCount_SIZE sizeof(ULONG) - #define DSM_Load_Balance_Policy_DSMPathCount_ID 3 - - // - ULONG Reserved; - #define DSM_Load_Balance_Policy_Reserved_SIZE sizeof(ULONG) - #define DSM_Load_Balance_Policy_Reserved_ID 4 - - // - MPIO_DSM_Path DSM_Paths[1]; - #define DSM_Load_Balance_Policy_DSM_Paths_ID 5 - -} DSM_Load_Balance_Policy, *PDSM_Load_Balance_Policy; - -// DSM_QueryLBPolicy - DSM_QueryLBPolicy -#define DSM_QueryLBPolicyGuid \ - { 0x20a4663b,0xbf54,0x4738, { 0xb4,0x03,0x0c,0xfc,0x71,0xec,0xfc,0x90 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(DSM_QueryLBPolicy_GUID, \ - 0x20a4663b,0xbf54,0x4738,0xb4,0x03,0x0c,0xfc,0x71,0xec,0xfc,0x90); -#endif - - -typedef struct _DSM_QueryLBPolicy -{ - // - DSM_Load_Balance_Policy LoadBalancePolicy; - #define DSM_QueryLBPolicy_LoadBalancePolicy_SIZE sizeof(DSM_Load_Balance_Policy) - #define DSM_QueryLBPolicy_LoadBalancePolicy_ID 1 - -} DSM_QueryLBPolicy, *PDSM_QueryLBPolicy; - -#define DSM_QueryLBPolicy_SIZE (FIELD_OFFSET(DSM_QueryLBPolicy, LoadBalancePolicy) + DSM_QueryLBPolicy_LoadBalancePolicy_SIZE) - -// DSM_QuerySupportedLBPolicies - DSM_QuerySupportedLBPolicies -#define DSM_QuerySupportedLBPoliciesGuid \ - { 0xffcf3f4e,0xbab6,0x455c, { 0xba,0x99,0xd6,0x0c,0xfb,0xc5,0x88,0x7d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(DSM_QuerySupportedLBPolicies_GUID, \ - 0xffcf3f4e,0xbab6,0x455c,0xba,0x99,0xd6,0x0c,0xfb,0xc5,0x88,0x7d); -#endif - - -typedef struct _DSM_QuerySupportedLBPolicies -{ - // - ULONG SupportedLBPoliciesCount; - #define DSM_QuerySupportedLBPolicies_SupportedLBPoliciesCount_SIZE sizeof(ULONG) - #define DSM_QuerySupportedLBPolicies_SupportedLBPoliciesCount_ID 1 - - // - ULONG Reserved; - #define DSM_QuerySupportedLBPolicies_Reserved_SIZE sizeof(ULONG) - #define DSM_QuerySupportedLBPolicies_Reserved_ID 2 - - // - DSM_Load_Balance_Policy Supported_LB_Policies[1]; - #define DSM_QuerySupportedLBPolicies_Supported_LB_Policies_ID 3 - -} DSM_QuerySupportedLBPolicies, *PDSM_QuerySupportedLBPolicies; - -// DSM_LB_Operations - DSM_LB_Operations -#define DSM_LB_OperationsGuid \ - { 0xc944053c,0xc90f,0x4012, { 0xb7,0x75,0x1f,0x1a,0x26,0x1d,0x4b,0xe4 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(DSM_LB_Operations_GUID, \ - 0xc944053c,0xc90f,0x4012,0xb7,0x75,0x1f,0x1a,0x26,0x1d,0x4b,0xe4); -#endif - -// -// Method id definitions for DSM_LB_Operations -#define DsmSetLoadBalancePolicy 1 -typedef struct _DsmSetLoadBalancePolicy_IN -{ - // - DSM_Load_Balance_Policy LoadBalancePolicy; - #define DsmSetLoadBalancePolicy_IN_LoadBalancePolicy_SIZE sizeof(DSM_Load_Balance_Policy) - #define DsmSetLoadBalancePolicy_IN_LoadBalancePolicy_ID 1 - -} DsmSetLoadBalancePolicy_IN, *PDsmSetLoadBalancePolicy_IN; - -#define DsmSetLoadBalancePolicy_IN_SIZE (FIELD_OFFSET(DsmSetLoadBalancePolicy_IN, LoadBalancePolicy) + DsmSetLoadBalancePolicy_IN_LoadBalancePolicy_SIZE) - -typedef struct _DsmSetLoadBalancePolicy_OUT -{ - // - ULONG Status; - #define DsmSetLoadBalancePolicy_OUT_Status_SIZE sizeof(ULONG) - #define DsmSetLoadBalancePolicy_OUT_Status_ID 2 - -} DsmSetLoadBalancePolicy_OUT, *PDsmSetLoadBalancePolicy_OUT; - -#define DsmSetLoadBalancePolicy_OUT_SIZE (FIELD_OFFSET(DsmSetLoadBalancePolicy_OUT, Status) + DsmSetLoadBalancePolicy_OUT_Status_SIZE) - -#define DsmSetLoadBalancePolicyALUA 2 -typedef struct _DsmSetLoadBalancePolicyALUA_IN -{ - // - DSM_Load_Balance_Policy_V2 LoadBalancePolicy; - #define DsmSetLoadBalancePolicyALUA_IN_LoadBalancePolicy_SIZE sizeof(DSM_Load_Balance_Policy_V2) - #define DsmSetLoadBalancePolicyALUA_IN_LoadBalancePolicy_ID 1 - -} DsmSetLoadBalancePolicyALUA_IN, *PDsmSetLoadBalancePolicyALUA_IN; - -#define DsmSetLoadBalancePolicyALUA_IN_SIZE (FIELD_OFFSET(DsmSetLoadBalancePolicyALUA_IN, LoadBalancePolicy) + DsmSetLoadBalancePolicyALUA_IN_LoadBalancePolicy_SIZE) - -typedef struct _DsmSetLoadBalancePolicyALUA_OUT -{ - // - ULONG Status; - #define DsmSetLoadBalancePolicyALUA_OUT_Status_SIZE sizeof(ULONG) - #define DsmSetLoadBalancePolicyALUA_OUT_Status_ID 2 - -} DsmSetLoadBalancePolicyALUA_OUT, *PDsmSetLoadBalancePolicyALUA_OUT; - -#define DsmSetLoadBalancePolicyALUA_OUT_SIZE (FIELD_OFFSET(DsmSetLoadBalancePolicyALUA_OUT, Status) + DsmSetLoadBalancePolicyALUA_OUT_Status_SIZE) - - -// DSM_QueryUniqueId - DSM_QueryUniqueId -#define DSM_QueryUniqueIdGuid \ - { 0x7b47cbe2,0x63d0,0x4e6b, { 0xb9,0x87,0x4b,0xfc,0xbd,0x6c,0x36,0x8e } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(DSM_QueryUniqueId_GUID, \ - 0x7b47cbe2,0x63d0,0x4e6b,0xb9,0x87,0x4b,0xfc,0xbd,0x6c,0x36,0x8e); -#endif - - -typedef struct _DSM_QueryUniqueId -{ - // - ULONGLONG DsmUniqueId; - #define DSM_QueryUniqueId_DsmUniqueId_SIZE sizeof(ULONGLONG) - #define DSM_QueryUniqueId_DsmUniqueId_ID 1 - -} DSM_QueryUniqueId, *PDSM_QueryUniqueId; - -#define DSM_QueryUniqueId_SIZE (FIELD_OFFSET(DSM_QueryUniqueId, DsmUniqueId) + DSM_QueryUniqueId_DsmUniqueId_SIZE) - -#endif - diff --git a/pub/ddk/mpiowmi.h b/pub/ddk/mpiowmi.h deleted file mode 100644 index facbc9c..0000000 --- a/pub/ddk/mpiowmi.h +++ /dev/null @@ -1,806 +0,0 @@ -#ifndef _mpiowmi_h_ -#define _mpiowmi_h_ - -// MPIO_PATH_HEALTH_CLASS - MPIO_PATH_HEALTH_CLASS -#define MPIO_PATH_HEALTH_CLASSGuid \ - { 0xea0f7134,0x269e,0x44ca, { 0xb3,0x50,0x7c,0x7e,0xbe,0xba,0x8b,0xbc } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_PATH_HEALTH_CLASS_GUID, \ - 0xea0f7134,0x269e,0x44ca,0xb3,0x50,0x7c,0x7e,0xbe,0xba,0x8b,0xbc); -#endif - - -typedef struct _MPIO_PATH_HEALTH_CLASS -{ - // - ULONGLONG PathId; - #define MPIO_PATH_HEALTH_CLASS_PathId_SIZE sizeof(ULONGLONG) - #define MPIO_PATH_HEALTH_CLASS_PathId_ID 1 - - // - ULONGLONG NumberReads; - #define MPIO_PATH_HEALTH_CLASS_NumberReads_SIZE sizeof(ULONGLONG) - #define MPIO_PATH_HEALTH_CLASS_NumberReads_ID 2 - - // - ULONGLONG NumberWrites; - #define MPIO_PATH_HEALTH_CLASS_NumberWrites_SIZE sizeof(ULONGLONG) - #define MPIO_PATH_HEALTH_CLASS_NumberWrites_ID 3 - - // - ULONGLONG NumberBytesRead; - #define MPIO_PATH_HEALTH_CLASS_NumberBytesRead_SIZE sizeof(ULONGLONG) - #define MPIO_PATH_HEALTH_CLASS_NumberBytesRead_ID 4 - - // - ULONGLONG NumberBytesWritten; - #define MPIO_PATH_HEALTH_CLASS_NumberBytesWritten_SIZE sizeof(ULONGLONG) - #define MPIO_PATH_HEALTH_CLASS_NumberBytesWritten_ID 5 - - // - ULONGLONG NumberRetries; - #define MPIO_PATH_HEALTH_CLASS_NumberRetries_SIZE sizeof(ULONGLONG) - #define MPIO_PATH_HEALTH_CLASS_NumberRetries_ID 6 - - // - ULONGLONG NumberIoErrors; - #define MPIO_PATH_HEALTH_CLASS_NumberIoErrors_SIZE sizeof(ULONGLONG) - #define MPIO_PATH_HEALTH_CLASS_NumberIoErrors_ID 7 - - // - ULONGLONG CreateTime; - #define MPIO_PATH_HEALTH_CLASS_CreateTime_SIZE sizeof(ULONGLONG) - #define MPIO_PATH_HEALTH_CLASS_CreateTime_ID 8 - - // - ULONGLONG FailTime; - #define MPIO_PATH_HEALTH_CLASS_FailTime_SIZE sizeof(ULONGLONG) - #define MPIO_PATH_HEALTH_CLASS_FailTime_ID 9 - - // - BOOLEAN PathOffline; - #define MPIO_PATH_HEALTH_CLASS_PathOffline_SIZE sizeof(BOOLEAN) - #define MPIO_PATH_HEALTH_CLASS_PathOffline_ID 10 - - // - UCHAR NumberReadsWrap; - #define MPIO_PATH_HEALTH_CLASS_NumberReadsWrap_SIZE sizeof(UCHAR) - #define MPIO_PATH_HEALTH_CLASS_NumberReadsWrap_ID 11 - - // - UCHAR NumberWritesWrap; - #define MPIO_PATH_HEALTH_CLASS_NumberWritesWrap_SIZE sizeof(UCHAR) - #define MPIO_PATH_HEALTH_CLASS_NumberWritesWrap_ID 12 - - // - UCHAR NumberBytesReadWrap; - #define MPIO_PATH_HEALTH_CLASS_NumberBytesReadWrap_SIZE sizeof(UCHAR) - #define MPIO_PATH_HEALTH_CLASS_NumberBytesReadWrap_ID 13 - - // - UCHAR NumberBytesWrittenWrap; - #define MPIO_PATH_HEALTH_CLASS_NumberBytesWrittenWrap_SIZE sizeof(UCHAR) - #define MPIO_PATH_HEALTH_CLASS_NumberBytesWrittenWrap_ID 14 - - // - UCHAR OutstandingRequests; - #define MPIO_PATH_HEALTH_CLASS_OutstandingRequests_SIZE sizeof(UCHAR) - #define MPIO_PATH_HEALTH_CLASS_OutstandingRequests_ID 15 - - // - UCHAR Pad[2]; - #define MPIO_PATH_HEALTH_CLASS_Pad_SIZE sizeof(UCHAR[2]) - #define MPIO_PATH_HEALTH_CLASS_Pad_ID 16 - -} MPIO_PATH_HEALTH_CLASS, *PMPIO_PATH_HEALTH_CLASS; - -#define MPIO_PATH_HEALTH_CLASS_SIZE (FIELD_OFFSET(MPIO_PATH_HEALTH_CLASS, Pad) + MPIO_PATH_HEALTH_CLASS_Pad_SIZE) - -// MPIO_PATH_HEALTH_INFO - MPIO_PATH_HEALTH_INFO -#define MPIO_PATH_HEALTH_INFOGuid \ - { 0x01ea1dfb,0x668b,0x48bc, { 0xa8,0x6e,0xa8,0xb4,0xca,0xbf,0xce,0x33 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_PATH_HEALTH_INFO_GUID, \ - 0x01ea1dfb,0x668b,0x48bc,0xa8,0x6e,0xa8,0xb4,0xca,0xbf,0xce,0x33); -#endif - - -typedef struct _MPIO_PATH_HEALTH_INFO -{ - // - ULONG NumberPathPackets; - #define MPIO_PATH_HEALTH_INFO_NumberPathPackets_SIZE sizeof(ULONG) - #define MPIO_PATH_HEALTH_INFO_NumberPathPackets_ID 1 - - // - ULONG Reserved; - #define MPIO_PATH_HEALTH_INFO_Reserved_SIZE sizeof(ULONG) - #define MPIO_PATH_HEALTH_INFO_Reserved_ID 2 - - // - MPIO_PATH_HEALTH_CLASS PathHealthPackets[1]; - #define MPIO_PATH_HEALTH_INFO_PathHealthPackets_ID 3 - -} MPIO_PATH_HEALTH_INFO, *PMPIO_PATH_HEALTH_INFO; - -// MPIO_DISK_HEALTH_CLASS - MPIO_DISK_HEALTH_CLASS -#define MPIO_DISK_HEALTH_CLASSGuid \ - { 0x6453c476,0x0499,0x42ab, { 0x98,0x25,0x51,0x33,0x28,0x2b,0x0b,0x56 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_DISK_HEALTH_CLASS_GUID, \ - 0x6453c476,0x0499,0x42ab,0x98,0x25,0x51,0x33,0x28,0x2b,0x0b,0x56); -#endif - - -typedef struct _MPIO_DISK_HEALTH_CLASS -{ - // - WCHAR Name[63 + 1]; - #define MPIO_DISK_HEALTH_CLASS_Name_ID 1 - - // - ULONGLONG NumberReads; - #define MPIO_DISK_HEALTH_CLASS_NumberReads_SIZE sizeof(ULONGLONG) - #define MPIO_DISK_HEALTH_CLASS_NumberReads_ID 2 - - // - ULONGLONG NumberWrites; - #define MPIO_DISK_HEALTH_CLASS_NumberWrites_SIZE sizeof(ULONGLONG) - #define MPIO_DISK_HEALTH_CLASS_NumberWrites_ID 3 - - // - ULONGLONG NumberBytesRead; - #define MPIO_DISK_HEALTH_CLASS_NumberBytesRead_SIZE sizeof(ULONGLONG) - #define MPIO_DISK_HEALTH_CLASS_NumberBytesRead_ID 4 - - // - ULONGLONG NumberBytesWritten; - #define MPIO_DISK_HEALTH_CLASS_NumberBytesWritten_SIZE sizeof(ULONGLONG) - #define MPIO_DISK_HEALTH_CLASS_NumberBytesWritten_ID 5 - - // - ULONGLONG NumberRetries; - #define MPIO_DISK_HEALTH_CLASS_NumberRetries_SIZE sizeof(ULONGLONG) - #define MPIO_DISK_HEALTH_CLASS_NumberRetries_ID 6 - - // - ULONGLONG NumberIoErrors; - #define MPIO_DISK_HEALTH_CLASS_NumberIoErrors_SIZE sizeof(ULONGLONG) - #define MPIO_DISK_HEALTH_CLASS_NumberIoErrors_ID 7 - - // - ULONGLONG CreateTime; - #define MPIO_DISK_HEALTH_CLASS_CreateTime_SIZE sizeof(ULONGLONG) - #define MPIO_DISK_HEALTH_CLASS_CreateTime_ID 8 - - // - ULONGLONG PathFailures; - #define MPIO_DISK_HEALTH_CLASS_PathFailures_SIZE sizeof(ULONGLONG) - #define MPIO_DISK_HEALTH_CLASS_PathFailures_ID 9 - - // - ULONGLONG FailTime; - #define MPIO_DISK_HEALTH_CLASS_FailTime_SIZE sizeof(ULONGLONG) - #define MPIO_DISK_HEALTH_CLASS_FailTime_ID 10 - - // - BOOLEAN DeviceOffline; - #define MPIO_DISK_HEALTH_CLASS_DeviceOffline_SIZE sizeof(BOOLEAN) - #define MPIO_DISK_HEALTH_CLASS_DeviceOffline_ID 11 - - // - UCHAR NumberReadsWrap; - #define MPIO_DISK_HEALTH_CLASS_NumberReadsWrap_SIZE sizeof(UCHAR) - #define MPIO_DISK_HEALTH_CLASS_NumberReadsWrap_ID 12 - - // - UCHAR NumberWritesWrap; - #define MPIO_DISK_HEALTH_CLASS_NumberWritesWrap_SIZE sizeof(UCHAR) - #define MPIO_DISK_HEALTH_CLASS_NumberWritesWrap_ID 13 - - // - UCHAR NumberBytesReadWrap; - #define MPIO_DISK_HEALTH_CLASS_NumberBytesReadWrap_SIZE sizeof(UCHAR) - #define MPIO_DISK_HEALTH_CLASS_NumberBytesReadWrap_ID 14 - - // - UCHAR NumberBytesWrittenWrap; - #define MPIO_DISK_HEALTH_CLASS_NumberBytesWrittenWrap_SIZE sizeof(UCHAR) - #define MPIO_DISK_HEALTH_CLASS_NumberBytesWrittenWrap_ID 15 - - // - UCHAR Pad[3]; - #define MPIO_DISK_HEALTH_CLASS_Pad_SIZE sizeof(UCHAR[3]) - #define MPIO_DISK_HEALTH_CLASS_Pad_ID 16 - -} MPIO_DISK_HEALTH_CLASS, *PMPIO_DISK_HEALTH_CLASS; - -#define MPIO_DISK_HEALTH_CLASS_SIZE (FIELD_OFFSET(MPIO_DISK_HEALTH_CLASS, Pad) + MPIO_DISK_HEALTH_CLASS_Pad_SIZE) - -// MPIO_DISK_HEALTH_INFO - MPIO_DISK_HEALTH_INFO -#define MPIO_DISK_HEALTH_INFOGuid \ - { 0xef04568a,0x782b,0x443c, { 0xa3,0xdb,0x96,0x6a,0xb4,0x37,0x75,0xf9 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_DISK_HEALTH_INFO_GUID, \ - 0xef04568a,0x782b,0x443c,0xa3,0xdb,0x96,0x6a,0xb4,0x37,0x75,0xf9); -#endif - - -typedef struct _MPIO_DISK_HEALTH_INFO -{ - // - ULONG NumberDiskPackets; - #define MPIO_DISK_HEALTH_INFO_NumberDiskPackets_SIZE sizeof(ULONG) - #define MPIO_DISK_HEALTH_INFO_NumberDiskPackets_ID 1 - - // - ULONG Reserved; - #define MPIO_DISK_HEALTH_INFO_Reserved_SIZE sizeof(ULONG) - #define MPIO_DISK_HEALTH_INFO_Reserved_ID 2 - - // - MPIO_DISK_HEALTH_CLASS DiskHealthPackets[1]; - #define MPIO_DISK_HEALTH_INFO_DiskHealthPackets_ID 3 - -} MPIO_DISK_HEALTH_INFO, *PMPIO_DISK_HEALTH_INFO; - -// SCSI_ADDR - SCSI_ADDR -#define SCSI_ADDRGuid \ - { 0xc74aece4,0x468b,0x4113, { 0xb0,0x06,0x0c,0xec,0xdc,0x96,0x8a,0xc4 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(SCSI_ADDR_GUID, \ - 0xc74aece4,0x468b,0x4113,0xb0,0x06,0x0c,0xec,0xdc,0x96,0x8a,0xc4); -#endif - - -typedef struct _SCSI_ADDR -{ - // - UCHAR PortNumber; - #define SCSI_ADDR_PortNumber_SIZE sizeof(UCHAR) - #define SCSI_ADDR_PortNumber_ID 1 - - // - UCHAR ScsiPathId; - #define SCSI_ADDR_ScsiPathId_SIZE sizeof(UCHAR) - #define SCSI_ADDR_ScsiPathId_ID 2 - - // - UCHAR TargetId; - #define SCSI_ADDR_TargetId_SIZE sizeof(UCHAR) - #define SCSI_ADDR_TargetId_ID 3 - - // - UCHAR Lun; - #define SCSI_ADDR_Lun_SIZE sizeof(UCHAR) - #define SCSI_ADDR_Lun_ID 4 - -} SCSI_ADDR, *PSCSI_ADDR; - -#define SCSI_ADDR_SIZE (FIELD_OFFSET(SCSI_ADDR, Lun) + SCSI_ADDR_Lun_SIZE) - -// MPIO_DRIVE_INFO - MPIO_DRIVE_INFO -#define MPIO_DRIVE_INFOGuid \ - { 0xcb9d55b2,0xd833,0x4a4c, { 0x8c,0xaa,0x4a,0xee,0x3f,0x24,0x0e,0x9a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_DRIVE_INFO_GUID, \ - 0xcb9d55b2,0xd833,0x4a4c,0x8c,0xaa,0x4a,0xee,0x3f,0x24,0x0e,0x9a); -#endif - - -typedef struct _MPIO_DRIVE_INFO -{ - // - ULONG NumberPaths; - #define MPIO_DRIVE_INFO_NumberPaths_SIZE sizeof(ULONG) - #define MPIO_DRIVE_INFO_NumberPaths_ID 1 - - // - WCHAR Name[63 + 1]; - #define MPIO_DRIVE_INFO_Name_ID 2 - - // - WCHAR SerialNumber[63 + 1]; - #define MPIO_DRIVE_INFO_SerialNumber_ID 3 - - // - WCHAR DsmName[63 + 1]; - #define MPIO_DRIVE_INFO_DsmName_ID 4 - -} MPIO_DRIVE_INFO, *PMPIO_DRIVE_INFO; - -// MPIO_DISK_INFO - MPIO_DISK_INFO -#define MPIO_DISK_INFOGuid \ - { 0x9f9765ed,0xc3a0,0x451f, { 0x86,0xc1,0x47,0x0a,0x1d,0xdd,0x32,0x17 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_DISK_INFO_GUID, \ - 0x9f9765ed,0xc3a0,0x451f,0x86,0xc1,0x47,0x0a,0x1d,0xdd,0x32,0x17); -#endif - - -typedef struct _MPIO_DISK_INFO -{ - // - ULONG NumberDrives; - #define MPIO_DISK_INFO_NumberDrives_SIZE sizeof(ULONG) - #define MPIO_DISK_INFO_NumberDrives_ID 1 - - // - MPIO_DRIVE_INFO DriveInfo[1]; - #define MPIO_DISK_INFO_DriveInfo_ID 2 - -} MPIO_DISK_INFO, *PMPIO_DISK_INFO; - -// DSM_VERSION - DSM_VERSION -#define DSM_VERSIONGuid \ - { 0x7cc0ae8e,0xf30d,0x4ecd, { 0xa3,0xc6,0x5b,0xee,0x8d,0xe6,0x1d,0x48 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(DSM_VERSION_GUID, \ - 0x7cc0ae8e,0xf30d,0x4ecd,0xa3,0xc6,0x5b,0xee,0x8d,0xe6,0x1d,0x48); -#endif - - -typedef struct _DSM_VERSION -{ - // - ULONG MajorVersion; - #define DSM_VERSION_MajorVersion_SIZE sizeof(ULONG) - #define DSM_VERSION_MajorVersion_ID 1 - - // - ULONG MinorVersion; - #define DSM_VERSION_MinorVersion_SIZE sizeof(ULONG) - #define DSM_VERSION_MinorVersion_ID 2 - - // - ULONG ProductBuild; - #define DSM_VERSION_ProductBuild_SIZE sizeof(ULONG) - #define DSM_VERSION_ProductBuild_ID 3 - - // - ULONG QfeNumber; - #define DSM_VERSION_QfeNumber_SIZE sizeof(ULONG) - #define DSM_VERSION_QfeNumber_ID 4 - -} DSM_VERSION, *PDSM_VERSION; - -#define DSM_VERSION_SIZE (FIELD_OFFSET(DSM_VERSION, QfeNumber) + DSM_VERSION_QfeNumber_SIZE) - -// DSM_COUNTERS - DSM_COUNTERS -#define DSM_COUNTERSGuid \ - { 0x39026ae4,0x9e81,0x468b, { 0x81,0x9c,0x25,0x34,0x48,0x12,0x7f,0xd5 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(DSM_COUNTERS_GUID, \ - 0x39026ae4,0x9e81,0x468b,0x81,0x9c,0x25,0x34,0x48,0x12,0x7f,0xd5); -#endif - - -typedef struct _DSM_COUNTERS -{ - // - ULONG PathVerifyEnabled; - #define DSM_COUNTERS_PathVerifyEnabled_SIZE sizeof(ULONG) - #define DSM_COUNTERS_PathVerifyEnabled_ID 1 - - // - ULONG PathVerificationPeriod; - #define DSM_COUNTERS_PathVerificationPeriod_SIZE sizeof(ULONG) - #define DSM_COUNTERS_PathVerificationPeriod_ID 2 - - // - ULONG PDORemovePeriod; - #define DSM_COUNTERS_PDORemovePeriod_SIZE sizeof(ULONG) - #define DSM_COUNTERS_PDORemovePeriod_ID 3 - - // - ULONG RetryCount; - #define DSM_COUNTERS_RetryCount_SIZE sizeof(ULONG) - #define DSM_COUNTERS_RetryCount_ID 4 - - // - ULONG RetryInterval; - #define DSM_COUNTERS_RetryInterval_SIZE sizeof(ULONG) - #define DSM_COUNTERS_RetryInterval_ID 5 - - // - ULONG Reserved32; - #define DSM_COUNTERS_Reserved32_SIZE sizeof(ULONG) - #define DSM_COUNTERS_Reserved32_ID 6 - - // - ULONGLONG Reserved64; - #define DSM_COUNTERS_Reserved64_SIZE sizeof(ULONGLONG) - #define DSM_COUNTERS_Reserved64_ID 7 - -} DSM_COUNTERS, *PDSM_COUNTERS; - -#define DSM_COUNTERS_SIZE (FIELD_OFFSET(DSM_COUNTERS, Reserved64) + DSM_COUNTERS_Reserved64_SIZE) - -// DSM_PARAMETERS - DSM_PARAMETERS -#define DSM_PARAMETERSGuid \ - { 0x695df15f,0x9bd1,0x49f7, { 0xbe,0xbb,0x16,0xde,0xbd,0x15,0x11,0xcb } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(DSM_PARAMETERS_GUID, \ - 0x695df15f,0x9bd1,0x49f7,0xbe,0xbb,0x16,0xde,0xbd,0x15,0x11,0xcb); -#endif - - -typedef struct _DSM_PARAMETERS -{ - // - WCHAR DsmName[63 + 1]; - #define DSM_PARAMETERS_DsmName_ID 1 - - // - ULONGLONG DsmContext; - #define DSM_PARAMETERS_DsmContext_SIZE sizeof(ULONGLONG) - #define DSM_PARAMETERS_DsmContext_ID 2 - - // - DSM_VERSION DsmVersion; - #define DSM_PARAMETERS_DsmVersion_SIZE sizeof(DSM_VERSION) - #define DSM_PARAMETERS_DsmVersion_ID 3 - - // - DSM_COUNTERS DsmCounters; - #define DSM_PARAMETERS_DsmCounters_SIZE sizeof(DSM_COUNTERS) - #define DSM_PARAMETERS_DsmCounters_ID 4 - -} DSM_PARAMETERS, *PDSM_PARAMETERS; - -#define DSM_PARAMETERS_SIZE (FIELD_OFFSET(DSM_PARAMETERS, DsmCounters) + DSM_PARAMETERS_DsmCounters_SIZE) - -// MPIO_REGISTERED_DSM - MPIO_REGISTERED_DSM -#define MPIO_REGISTERED_DSMGuid \ - { 0x0c2c484b,0x030b,0x4540, { 0x88,0x90,0xbb,0x66,0x81,0x94,0x1c,0xe3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_REGISTERED_DSM_GUID, \ - 0x0c2c484b,0x030b,0x4540,0x88,0x90,0xbb,0x66,0x81,0x94,0x1c,0xe3); -#endif - - -typedef struct _MPIO_REGISTERED_DSM -{ - // - ULONG NumberDSMs; - #define MPIO_REGISTERED_DSM_NumberDSMs_SIZE sizeof(ULONG) - #define MPIO_REGISTERED_DSM_NumberDSMs_ID 1 - - // - DSM_PARAMETERS DsmParameters[1]; - #define MPIO_REGISTERED_DSM_DsmParameters_ID 2 - -} MPIO_REGISTERED_DSM, *PMPIO_REGISTERED_DSM; - -// MPIO_ADAPTER_INFORMATION - MPIO_ADAPTER_INFORMATION -#define MPIO_ADAPTER_INFORMATIONGuid \ - { 0xb87c0fec,0x88b7,0x451d, { 0xa3,0x78,0x38,0x7b,0xa6,0x1a,0xeb,0x89 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_ADAPTER_INFORMATION_GUID, \ - 0xb87c0fec,0x88b7,0x451d,0xa3,0x78,0x38,0x7b,0xa6,0x1a,0xeb,0x89); -#endif - - -typedef struct _MPIO_ADAPTER_INFORMATION -{ - // - ULONGLONG PathId; - #define MPIO_ADAPTER_INFORMATION_PathId_SIZE sizeof(ULONGLONG) - #define MPIO_ADAPTER_INFORMATION_PathId_ID 1 - - // - UCHAR BusNumber; - #define MPIO_ADAPTER_INFORMATION_BusNumber_SIZE sizeof(UCHAR) - #define MPIO_ADAPTER_INFORMATION_BusNumber_ID 2 - - // - UCHAR DeviceNumber; - #define MPIO_ADAPTER_INFORMATION_DeviceNumber_SIZE sizeof(UCHAR) - #define MPIO_ADAPTER_INFORMATION_DeviceNumber_ID 3 - - // - UCHAR FunctionNumber; - #define MPIO_ADAPTER_INFORMATION_FunctionNumber_SIZE sizeof(UCHAR) - #define MPIO_ADAPTER_INFORMATION_FunctionNumber_ID 4 - - // - UCHAR Pad; - #define MPIO_ADAPTER_INFORMATION_Pad_SIZE sizeof(UCHAR) - #define MPIO_ADAPTER_INFORMATION_Pad_ID 5 - - // - WCHAR AdapterName[63 + 1]; - #define MPIO_ADAPTER_INFORMATION_AdapterName_ID 6 - -} MPIO_ADAPTER_INFORMATION, *PMPIO_ADAPTER_INFORMATION; - -// MPIO_PATH_INFORMATION - MPIO_PATH_INFORMATION -#define MPIO_PATH_INFORMATIONGuid \ - { 0xb3a05997,0x2077,0x40a3, { 0xbf,0x36,0xeb,0xd9,0x1f,0xf8,0xb2,0x54 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_PATH_INFORMATION_GUID, \ - 0xb3a05997,0x2077,0x40a3,0xbf,0x36,0xeb,0xd9,0x1f,0xf8,0xb2,0x54); -#endif - - -typedef struct _MPIO_PATH_INFORMATION -{ - // - ULONG NumberPaths; - #define MPIO_PATH_INFORMATION_NumberPaths_SIZE sizeof(ULONG) - #define MPIO_PATH_INFORMATION_NumberPaths_ID 1 - - // - ULONG Pad; - #define MPIO_PATH_INFORMATION_Pad_SIZE sizeof(ULONG) - #define MPIO_PATH_INFORMATION_Pad_ID 2 - - // - MPIO_ADAPTER_INFORMATION PathList[1]; - #define MPIO_PATH_INFORMATION_PathList_ID 3 - -} MPIO_PATH_INFORMATION, *PMPIO_PATH_INFORMATION; - -// MPIO_CONTROLLER_INFO - MPIO_CONTROLLER_INFO -#define MPIO_CONTROLLER_INFOGuid \ - { 0xe732405b,0xb15e,0x4872, { 0xaf,0xd0,0x0d,0xf6,0x9d,0xc1,0xbb,0x01 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_CONTROLLER_INFO_GUID, \ - 0xe732405b,0xb15e,0x4872,0xaf,0xd0,0x0d,0xf6,0x9d,0xc1,0xbb,0x01); -#endif - - -typedef struct _MPIO_CONTROLLER_INFO -{ - // - ULONG IdentifierType; - #define MPIO_CONTROLLER_INFO_IdentifierType_SIZE sizeof(ULONG) - #define MPIO_CONTROLLER_INFO_IdentifierType_ID 1 - - // - ULONG IdentifierLength; - #define MPIO_CONTROLLER_INFO_IdentifierLength_SIZE sizeof(ULONG) - #define MPIO_CONTROLLER_INFO_IdentifierLength_ID 2 - - // - UCHAR Identifier[32]; - #define MPIO_CONTROLLER_INFO_Identifier_SIZE sizeof(UCHAR[32]) - #define MPIO_CONTROLLER_INFO_Identifier_ID 3 - - // - ULONG ControllerState; - #define MPIO_CONTROLLER_INFO_ControllerState_SIZE sizeof(ULONG) - #define MPIO_CONTROLLER_INFO_ControllerState_ID 4 - - // - ULONG Pad; - #define MPIO_CONTROLLER_INFO_Pad_SIZE sizeof(ULONG) - #define MPIO_CONTROLLER_INFO_Pad_ID 5 - - // - WCHAR AssociatedDsm[63 + 1]; - #define MPIO_CONTROLLER_INFO_AssociatedDsm_ID 6 - -} MPIO_CONTROLLER_INFO, *PMPIO_CONTROLLER_INFO; - -// MPIO_CONTROLLER_CONFIGURATION - MPIO_CONTROLLER_CONFIGURATION -#define MPIO_CONTROLLER_CONFIGURATIONGuid \ - { 0xcf07da2c,0xe598,0x45d2, { 0x9d,0x78,0x75,0xc3,0x8b,0x81,0x64,0xe8 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_CONTROLLER_CONFIGURATION_GUID, \ - 0xcf07da2c,0xe598,0x45d2,0x9d,0x78,0x75,0xc3,0x8b,0x81,0x64,0xe8); -#endif - - -typedef struct _MPIO_CONTROLLER_CONFIGURATION -{ - // - ULONG NumberControllers; - #define MPIO_CONTROLLER_CONFIGURATION_NumberControllers_SIZE sizeof(ULONG) - #define MPIO_CONTROLLER_CONFIGURATION_NumberControllers_ID 1 - - // - MPIO_CONTROLLER_INFO ControllerInfo[1]; - #define MPIO_CONTROLLER_CONFIGURATION_ControllerInfo_ID 2 - -} MPIO_CONTROLLER_CONFIGURATION, *PMPIO_CONTROLLER_CONFIGURATION; - -// MPIO_TIMERS_COUNTERS - MPIO_TIMERS_COUNTERS -#define MPIO_TIMERS_COUNTERSGuid \ - { 0xce49b95b,0x690f,0x4cd0, { 0x8a,0x95,0xec,0xe3,0xfa,0xd8,0xef,0xc2 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_TIMERS_COUNTERS_GUID, \ - 0xce49b95b,0x690f,0x4cd0,0x8a,0x95,0xec,0xe3,0xfa,0xd8,0xef,0xc2); -#endif - - -typedef struct _MPIO_TIMERS_COUNTERS -{ - // - ULONG PathVerifyEnabled; - #define MPIO_TIMERS_COUNTERS_PathVerifyEnabled_SIZE sizeof(ULONG) - #define MPIO_TIMERS_COUNTERS_PathVerifyEnabled_ID 1 - - // - ULONG PathVerificationPeriod; - #define MPIO_TIMERS_COUNTERS_PathVerificationPeriod_SIZE sizeof(ULONG) - #define MPIO_TIMERS_COUNTERS_PathVerificationPeriod_ID 2 - - // - ULONG PDORemovePeriod; - #define MPIO_TIMERS_COUNTERS_PDORemovePeriod_SIZE sizeof(ULONG) - #define MPIO_TIMERS_COUNTERS_PDORemovePeriod_ID 3 - - // - ULONG RetryCount; - #define MPIO_TIMERS_COUNTERS_RetryCount_SIZE sizeof(ULONG) - #define MPIO_TIMERS_COUNTERS_RetryCount_ID 4 - - // - ULONG RetryInterval; - #define MPIO_TIMERS_COUNTERS_RetryInterval_SIZE sizeof(ULONG) - #define MPIO_TIMERS_COUNTERS_RetryInterval_ID 5 - -} MPIO_TIMERS_COUNTERS, *PMPIO_TIMERS_COUNTERS; - -#define MPIO_TIMERS_COUNTERS_SIZE (FIELD_OFFSET(MPIO_TIMERS_COUNTERS, RetryInterval) + MPIO_TIMERS_COUNTERS_RetryInterval_SIZE) - -// MPIO_WMI_METHODS - MPIO_WMI_METHODS -#define MPIO_WMI_METHODSGuid \ - { 0xe37bc327,0xf7b1,0x4675, { 0x80,0x18,0x85,0x27,0x32,0xe2,0xed,0xe1 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_WMI_METHODS_GUID, \ - 0xe37bc327,0xf7b1,0x4675,0x80,0x18,0x85,0x27,0x32,0xe2,0xed,0xe1); -#endif - -// -// Method id definitions for MPIO_WMI_METHODS -#define MPIOMoveDevice 1 -typedef struct _MPIOMoveDevice_IN -{ - // - ULONG DiskOrdinal; - #define MPIOMoveDevice_IN_DiskOrdinal_SIZE sizeof(ULONG) - #define MPIOMoveDevice_IN_DiskOrdinal_ID 1 - - // - ULONG Flags; - #define MPIOMoveDevice_IN_Flags_SIZE sizeof(ULONG) - #define MPIOMoveDevice_IN_Flags_ID 2 - - // - ULONGLONG PathID; - #define MPIOMoveDevice_IN_PathID_SIZE sizeof(ULONGLONG) - #define MPIOMoveDevice_IN_PathID_ID 3 - -} MPIOMoveDevice_IN, *PMPIOMoveDevice_IN; - -#define MPIOMoveDevice_IN_SIZE (FIELD_OFFSET(MPIOMoveDevice_IN, PathID) + MPIOMoveDevice_IN_PathID_SIZE) - -#define GetPathConfiguration 2 -typedef struct _GetPathConfiguration_IN -{ - // - ULONGLONG PathID; - #define GetPathConfiguration_IN_PathID_SIZE sizeof(ULONGLONG) - #define GetPathConfiguration_IN_PathID_ID 1 - -} GetPathConfiguration_IN, *PGetPathConfiguration_IN; - -#define GetPathConfiguration_IN_SIZE (FIELD_OFFSET(GetPathConfiguration_IN, PathID) + GetPathConfiguration_IN_PathID_SIZE) - -typedef struct _GetPathConfiguration_OUT -{ - // - ULONG EntryCount; - #define GetPathConfiguration_OUT_EntryCount_SIZE sizeof(ULONG) - #define GetPathConfiguration_OUT_EntryCount_ID 2 - - // - SCSI_ADDR Address[1]; - #define GetPathConfiguration_OUT_Address_ID 3 - -} GetPathConfiguration_OUT, *PGetPathConfiguration_OUT; - -#define SetDSMCounters 3 -typedef struct _SetDSMCounters_IN -{ - // - ULONGLONG DsmContext; - #define SetDSMCounters_IN_DsmContext_SIZE sizeof(ULONGLONG) - #define SetDSMCounters_IN_DsmContext_ID 1 - - // - DSM_COUNTERS DsmCounters; - #define SetDSMCounters_IN_DsmCounters_SIZE sizeof(DSM_COUNTERS) - #define SetDSMCounters_IN_DsmCounters_ID 2 - -} SetDSMCounters_IN, *PSetDSMCounters_IN; - -#define SetDSMCounters_IN_SIZE (FIELD_OFFSET(SetDSMCounters_IN, DsmCounters) + SetDSMCounters_IN_DsmCounters_SIZE) - -#define ClearAllHealthCounters 4 -#define ClearPathHealthCounters 5 -typedef struct _ClearPathHealthCounters_IN -{ - // - ULONGLONG PathID; - #define ClearPathHealthCounters_IN_PathID_SIZE sizeof(ULONGLONG) - #define ClearPathHealthCounters_IN_PathID_ID 1 - -} ClearPathHealthCounters_IN, *PClearPathHealthCounters_IN; - -#define ClearPathHealthCounters_IN_SIZE (FIELD_OFFSET(ClearPathHealthCounters_IN, PathID) + ClearPathHealthCounters_IN_PathID_SIZE) - -#define ClearAllPathsHealthCounters 6 -#define ClearMpioDiskHealthCounters 7 -typedef struct _ClearMpioDiskHealthCounters_IN -{ - // - ULONG DiskOrdinal; - #define ClearMpioDiskHealthCounters_IN_DiskOrdinal_SIZE sizeof(ULONG) - #define ClearMpioDiskHealthCounters_IN_DiskOrdinal_ID 1 - -} ClearMpioDiskHealthCounters_IN, *PClearMpioDiskHealthCounters_IN; - -#define ClearMpioDiskHealthCounters_IN_SIZE (FIELD_OFFSET(ClearMpioDiskHealthCounters_IN, DiskOrdinal) + ClearMpioDiskHealthCounters_IN_DiskOrdinal_SIZE) - -#define ClearAllMpioDisksHealthCounters 8 - -// MPIO_EventEntry - MPIO_EventEntry -#define MPIO_EventEntryGuid \ - { 0x2abb031a,0x71aa,0x46d4, { 0xa5,0x3f,0xea,0xe3,0x40,0x51,0xe3,0x57 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MPIO_EventEntry_GUID, \ - 0x2abb031a,0x71aa,0x46d4,0xa5,0x3f,0xea,0xe3,0x40,0x51,0xe3,0x57); -#endif - - -typedef struct _MPIO_EventEntry -{ - // - ULONGLONG TimeStamp; - #define MPIO_EventEntry_TimeStamp_SIZE sizeof(ULONGLONG) - #define MPIO_EventEntry_TimeStamp_ID 1 - - -#define MPIO_FATAL_ERROR 1 -#define MPIO_ERROR 2 -#define MPIO_WARNING 3 -#define MPIO_INFORMATION 4 - - // - ULONG Severity; - #define MPIO_EventEntry_Severity_SIZE sizeof(ULONG) - #define MPIO_EventEntry_Severity_ID 2 - - // - WCHAR Component[63 + 1]; - #define MPIO_EventEntry_Component_ID 3 - - // - WCHAR EventDescription[63 + 1]; - #define MPIO_EventEntry_EventDescription_ID 4 - -} MPIO_EventEntry, *PMPIO_EventEntry; - -#endif - diff --git a/pub/ddk/mrx.h b/pub/ddk/mrx.h deleted file mode 100644 index 2ae4e5f..0000000 --- a/pub/ddk/mrx.h +++ /dev/null @@ -1,818 +0,0 @@ -/*++ - -Copyright (c) 1989 Microsoft Corporation - -Module Name: - - mrx.h - -Abstract: - - This module defines the interface between the MINI Redirectors and the RDBSS. - The inteface is a dispatch table for the normal file system operations. In - addition routines are provided for registrations/deregistration of mini - redirectors. - -Author: -Revision History: - -Notes: - - The interface definition between the mini redirectors and the wrapper - consists of two parts, the data structures used and the dispatch vector. - The data structures are defined in mrxfcb.h while the signatures of the - various entries in the dispatch vector and the dispatch vector itself is - defined in this file. - ---*/ - -#ifndef _RXMINIRDR_ -#define _RXMINIRDR_ - -// -// RDBSS data structures shared with the mini redirectors -// - -#include - -// -// The following macros encapsulate commonly used operations in the mini redirector. -// These include setting the status/information associated with the completion of -// a request etc. -// - - -// -// The following three macros are used for passing back operation status from the -// minirdr to the NT wrapper. information passed back is either the open_action -// for a create or the actual byte count or an operation. these should be passed -// back directly in the rxcontext. -// - -#define RxSetIoStatusStatus(RXCONTEXT, STATUS) \ - (RXCONTEXT)->CurrentIrp->IoStatus.Status = (STATUS) - -#define RxSetIoStatusInfo(RXCONTEXT, INFORMATION) \ - ((RXCONTEXT))->CurrentIrp->IoStatus.Information = (INFORMATION) - -#define RxGetIoStatusInfo(RXCONTEXT) \ - ((RXCONTEXT)->CurrentIrp->IoStatus.Information) - -#define RxShouldPostCompletion() ((KeGetCurrentIrql() >= DISPATCH_LEVEL)) - -// -// The mini rdr's register/unregister with the RDBSS whenever they are loaded/unloaded. -// The registartion process is a two way hand shake in which the mini rdr informs the RDBSS -// by invoking the registartion routine. The RDBSS completes the initialization by invoking -// the Start routine in the dispatch vector. -// - -#define RX_REGISTERMINI_FLAG_DONT_PROVIDE_UNCS 0x00000001 -#define RX_REGISTERMINI_FLAG_DONT_PROVIDE_MAILSLOTS 0x00000002 -#define RX_REGISTERMINI_FLAG_DONT_INIT_DRIVER_DISPATCH 0x00000004 -#define RX_REGISTERMINI_FLAG_DONT_INIT_PREFIX_N_SCAVENGER 0x00000008 -#define RX_REGISTERMINI_FLAG_DONT_USE_VISTA_REDIRECTOR 0x00000010 - -NTSTATUS -NTAPI -RxRegisterMinirdr ( - OUT PRDBSS_DEVICE_OBJECT *DeviceObject, // the deviceobject that was created - IN OUT PDRIVER_OBJECT DriverObject, // the minirdr driver object - IN PMINIRDR_DISPATCH MrdrDispatch, // the mini rdr dispatch vector - IN ULONG Controls, - IN PUNICODE_STRING DeviceName, - IN ULONG DeviceExtensionSize, - IN DEVICE_TYPE DeviceType, - IN ULONG DeviceCharacteristics - ); - -VOID -NTAPI -RxMakeLateDeviceAvailable ( - IN PRDBSS_DEVICE_OBJECT RxDeviceObject - ); - -VOID -NTAPI -__RxFillAndInstallFastIoDispatch ( - IN PRDBSS_DEVICE_OBJECT RxDeviceObject, - IN OUT PFAST_IO_DISPATCH FastIoDispatch, - IN ULONG FastIoDispatchSize - ); -#define RxFillAndInstallFastIoDispatch(__devobj,__fastiodisp) {\ - __RxFillAndInstallFastIoDispatch(&__devobj->RxDeviceObject,\ - &__fastiodisp, \ - sizeof(__fastiodisp)); \ - } - -VOID -NTAPI -RxpUnregisterMinirdr ( - IN PRDBSS_DEVICE_OBJECT RxDeviceObject - ); - -NTSTATUS -RxStartMinirdr ( - IN PRX_CONTEXT RxContext, - OUT PBOOLEAN PostToFsp - ); - -NTSTATUS -RxStopMinirdr ( - IN PRX_CONTEXT RxContext, - OUT PBOOLEAN PostToFsp - ); - -NTSTATUS -RxSetDomainForMailslotBroadcast ( - IN PUNICODE_STRING DomainName - ); - -NTSTATUS -RxFsdDispatch ( - IN PRDBSS_DEVICE_OBJECT RxDeviceObject, - IN PIRP Irp - ); - -typedef -NTSTATUS -(NTAPI *PMRX_CALLDOWN) ( - IN OUT PRX_CONTEXT RxContext - ); - -typedef -NTSTATUS -(NTAPI *PMRX_CALLDOWN_CTX) ( - IN OUT PRX_CONTEXT RxContext, - IN OUT PRDBSS_DEVICE_OBJECT RxDeviceObject - ); - -typedef -NTSTATUS -(NTAPI *PMRX_CHKDIR_CALLDOWN) ( - IN OUT PRX_CONTEXT RxContext, - IN PUNICODE_STRING DirectoryName - ); - -typedef -NTSTATUS -(NTAPI *PMRX_CHKFCB_CALLDOWN) ( - IN PFCB Fcb1, - IN PFCB Fcb2 - ); - -// -// The two important abstractions used in the interface between the mini rdr and RDBSS are -// Server Calls and Net Roots. The former corresponds to the context associated with a -// server with which a connection has been established and the later corresponds to a -// share on a server ( This could also be viewed as a portion of the name space which has -// been claimed by a mini rdr). -// -// The creation of Server calls and net roots typically involve atleast one network round trip. -// In order to provide for asynchronous operations to continue these operations are modelled -// as a two phase activity. Each calldown to a mini rdr for creating a server call and net root is -// accompanied by a callup from the mini rdr to the RDBSS notifying with the completion status -// of the request. Currently these are synchronous! -// -// The creation of Srv calls is further complicated by the fact that the RDBSS has to choose -// from a number of mini rdr's to establish a connection with a server. In order to provide -// the RDBSS with maximum flexibility in choosing the mini rdr's that it wishes to deploy the -// creation of server calls involves a third phase in which the RDBSS notifies the mini rdr of -// a winner. All the losing mini rdrs destroy the associated context. -// - -typedef enum _RX_BLOCK_CONDITION { - Condition_Uninitialized = 0, - Condition_InTransition, - Condition_Closing, - Condition_Good, - Condition_Bad, - Condition_Closed - } RX_BLOCK_CONDITION, *PRX_BLOCK_CONDITION; - -#define StableCondition(X) ((X) >= Condition_Good) - -// -// The routine for notifying the RDBSS about the completion status of the NetRoot creation -// request. -// - -typedef -VOID -(NTAPI *PMRX_NETROOT_CALLBACK) ( - IN OUT PMRX_CREATENETROOT_CONTEXT CreateContext - ); - -// -// this routine allows the minirdr to specify the netrootname. NetRootName and RestOfName are set -// to point to the appropriate places within FilePathName. SrvCall is used to find the lengthof the srvcallname. -// - -typedef -VOID -(NTAPI *PMRX_EXTRACT_NETROOT_NAME) ( - IN PUNICODE_STRING FilePathName, - IN PMRX_SRV_CALL SrvCall, - OUT PUNICODE_STRING NetRootName, - OUT PUNICODE_STRING RestOfName OPTIONAL - ); -// -// The resumption context for the RDBSS. -// - -typedef struct _MRX_CREATENETROOT_CONTEXT { - PRX_CONTEXT RxContext; - PV_NET_ROOT pVNetRoot; - KEVENT FinishEvent; - NTSTATUS VirtualNetRootStatus; - NTSTATUS NetRootStatus; - RX_WORK_QUEUE_ITEM WorkQueueItem; - PMRX_NETROOT_CALLBACK Callback; -} MRX_CREATENETROOT_CONTEXT, *PMRX_CREATENETROOT_CONTEXT; - -// -// the calldown from RDBSS to the mini rdr for creating a netroot. -// - -typedef -NTSTATUS -(NTAPI *PMRX_CREATE_V_NET_ROOT) ( - IN OUT PMRX_CREATENETROOT_CONTEXT Context - ); - -// -// the calldown for querying a net root state. -// - -typedef -NTSTATUS -(NTAPI *PMRX_UPDATE_NETROOT_STATE) ( - IN OUT PMRX_NET_ROOT NetRoot - ); - -// -// The resumption context for the RDBSS. -// -typedef struct _MRX_SRVCALL_CALLBACK_CONTEXT { - struct _MRX_SRVCALLDOWN_STRUCTURE *SrvCalldownStructure; // could be computed - ULONG CallbackContextOrdinal; - PRDBSS_DEVICE_OBJECT RxDeviceObject; - NTSTATUS Status; - PVOID RecommunicateContext; -} MRX_SRVCALL_CALLBACK_CONTEXT, *PMRX_SRVCALL_CALLBACK_CONTEXT; - - -// -// The routine for notifying the RDBSS about the completion status of the SrvCall creation -// request. -// - -typedef -VOID -(NTAPI *PMRX_SRVCALL_CALLBACK) ( - IN OUT PMRX_SRVCALL_CALLBACK_CONTEXT Context - ); - -// -// The context passed from the RDBSS to the mini rdr for creating a server call. -// - -typedef struct _MRX_SRVCALLDOWN_STRUCTURE { - KEVENT FinishEvent; - LIST_ENTRY SrvCalldownList; - PRX_CONTEXT RxContext; - PMRX_SRV_CALL SrvCall; - PMRX_SRVCALL_CALLBACK CallBack; - BOOLEAN CalldownCancelled; - ULONG NumberRemaining; - ULONG NumberToWait; - ULONG BestFinisherOrdinal; - PRDBSS_DEVICE_OBJECT BestFinisher; - MRX_SRVCALL_CALLBACK_CONTEXT CallbackContexts[1]; -} MRX_SRVCALLDOWN_STRUCTURE; - -// -// the calldown from the RDBSS to the mini rdr for creating a server call -// - -typedef -NTSTATUS -(NTAPI *PMRX_CREATE_SRVCALL) ( - IN OUT PMRX_SRV_CALL SrvCall, - IN OUT PMRX_SRVCALL_CALLBACK_CONTEXT SrvCallCallBackContext - ); -// -// the calldown from the RDBSS to the mini rdr for notifying the mini rdr's of the winner. -// - -typedef -NTSTATUS -(NTAPI *PMRX_SRVCALL_WINNER_NOTIFY)( - IN OUT PMRX_SRV_CALL SrvCall, - IN BOOLEAN ThisMinirdrIsTheWinner, - IN OUT PVOID RecommunicateContext - ); - -// -// The prototypes for calldown routines relating to various file system operations -// - -typedef -VOID -(NTAPI *PMRX_NEWSTATE_CALLDOWN) ( - IN OUT PVOID Context - ); - -typedef -NTSTATUS -(NTAPI *PMRX_DEALLOCATE_FOR_FCB) ( - IN OUT PMRX_FCB Fcb - ); - -typedef -NTSTATUS -(NTAPI *PMRX_DEALLOCATE_FOR_FOBX) ( - IN OUT PMRX_FOBX Fobx - ); - -typedef -NTSTATUS -(NTAPI *PMRX_IS_LOCK_REALIZABLE) ( - IN OUT PMRX_FCB Fcb, - IN PLARGE_INTEGER ByteOffset, - IN PLARGE_INTEGER Length, - IN ULONG LowIoLockFlags - ); - -typedef -NTSTATUS -(NTAPI *PMRX_FORCECLOSED_CALLDOWN) ( - IN OUT PMRX_SRV_OPEN SrvOpen - ); - -typedef -NTSTATUS -(NTAPI *PMRX_FINALIZE_SRVCALL_CALLDOWN) ( - IN OUT PMRX_SRV_CALL SrvCall, - IN BOOLEAN Force - ); - -typedef -NTSTATUS -(NTAPI *PMRX_FINALIZE_V_NET_ROOT_CALLDOWN) ( - IN OUT PMRX_V_NET_ROOT VirtualNetRoot, - IN PBOOLEAN Force - ); - -typedef -NTSTATUS -(NTAPI *PMRX_FINALIZE_NET_ROOT_CALLDOWN) ( - IN OUT PMRX_NET_ROOT NetRoot, - IN PBOOLEAN Force - ); - -typedef -ULONG -(NTAPI *PMRX_EXTENDFILE_CALLDOWN) ( - IN OUT PRX_CONTEXT RxContext, - IN OUT PLARGE_INTEGER NewFileSize, - OUT PLARGE_INTEGER NewAllocationSize - ); - -typedef -BOOLEAN -(*PRX_LOCK_ENUMERATOR) ( - IN OUT PMRX_SRV_OPEN SrvOpen, - IN OUT PVOID *ContinuationHandle, - OUT PLARGE_INTEGER FileOffset, - OUT PLARGE_INTEGER LockRange, - OUT PBOOLEAN IsLockExclusive - ); -typedef -NTSTATUS -(NTAPI *PMRX_CHANGE_BUFFERING_STATE_CALLDOWN) ( - IN OUT PRX_CONTEXT RxContext, - IN OUT PMRX_SRV_OPEN SrvOpen, - IN PVOID MRxContext - ); - -typedef -NTSTATUS -(NTAPI *PMRX_PREPARSE_NAME) ( - IN OUT PRX_CONTEXT RxContext, - IN PUNICODE_STRING Name - ); - -typedef -NTSTATUS -(NTAPI *PMRX_GET_CONNECTION_ID) ( - IN OUT PRX_CONTEXT RxContext, - IN OUT PRX_CONNECTION_ID UniqueId - ); - -// -// Buffering state/Policy management TBD -// -typedef enum _MINIRDR_BUFSTATE_COMMANDS { - MRDRBUFSTCMD__COMMAND_FORCEPURGE0, - MRDRBUFSTCMD__1, - MRDRBUFSTCMD__2, - MRDRBUFSTCMD__3, - MRDRBUFSTCMD__4, - MRDRBUFSTCMD__5, - MRDRBUFSTCMD__6, - MRDRBUFSTCMD__7, - MRDRBUFSTCMD__8, - MRDRBUFSTCMD__9, - MRDRBUFSTCMD__10, - MRDRBUFSTCMD__11, - MRDRBUFSTCMD__12, - MRDRBUFSTCMD__13, - MRDRBUFSTCMD__14, - MRDRBUFSTCMD__15, - MRDRBUFSTCMD__16, - MRDRBUFSTCMD__17, - MRDRBUFSTCMD__18, - MRDRBUFSTCMD__19, - MRDRBUFSTCMD__20, - MRDRBUFSTCMD__21, - MRDRBUFSTCMD__22, - MRDRBUFSTCMD__23, - MRDRBUFSTCMD__24, - MRDRBUFSTCMD__25, - MRDRBUFSTCMD__26, - MRDRBUFSTCMD__27, - MRDRBUFSTCMD__28, - MRDRBUFSTCMD__29, - MRDRBUFSTCMD__30, - MRDRBUFSTCMD__31, - MRDRBUFSTCMD_MAXXX -} MINIRDR_BUFSTATE_COMMANDS; - - -#define MINIRDR_BUFSTATE_COMMAND_FORCEPURGE 0x00000001 -#define MINIRDR_BUFSTATE_COMMAND_MASK ((MINIRDR_BUFSTATE_COMMAND_FORCEPURGE)) - -typedef -NTSTATUS -(NTAPI *PMRX_COMPUTE_NEW_BUFFERING_STATE) ( - IN OUT PMRX_SRV_OPEN SrvOpen, - IN PVOID MRxContext, - OUT PULONG NewBufferingState - ); - -typedef enum _LOWIO_OPS { - LOWIO_OP_READ=0, - LOWIO_OP_WRITE, - LOWIO_OP_SHAREDLOCK, - LOWIO_OP_EXCLUSIVELOCK, - LOWIO_OP_UNLOCK, - LOWIO_OP_UNLOCK_MULTIPLE, - //LOWIO_OP_UNLOCKALLBYKEY, - LOWIO_OP_FSCTL, - LOWIO_OP_IOCTL, - LOWIO_OP_NOTIFY_CHANGE_DIRECTORY, - LOWIO_OP_CLEAROUT, - LOWIO_OP_MAXIMUM -} LOWIO_OPS; - -typedef -NTSTATUS -(NTAPI *PLOWIO_COMPLETION_ROUTINE) ( - IN PRX_CONTEXT RxContext - ); - -typedef LONGLONG RXVBO; - -// -// we may, at some point, want a smarter implementation of this. we don't statically allocate the first -// element because that would make unlock behind much harder. -// - -typedef struct _LOWIO_LOCK_LIST { - - struct _LOWIO_LOCK_LIST * Next; - ULONG LockNumber; - RXVBO ByteOffset; - LONGLONG Length; - BOOLEAN ExclusiveLock; - ULONG Key; - -} LOWIO_LOCK_LIST, *PLOWIO_LOCK_LIST; - -VOID -NTAPI -RxFinalizeLockList( - struct _RX_CONTEXT *RxContext - ); - -typedef struct _XXCTL_LOWIO_COMPONENT { - ULONG Flags; - union { - ULONG FsControlCode; - ULONG IoControlCode; - }; - ULONG InputBufferLength; - PVOID pInputBuffer; - ULONG OutputBufferLength; - PVOID pOutputBuffer; - UCHAR MinorFunction; -} XXCTL_LOWIO_COMPONENT; - -typedef struct _LOWIO_CONTEXT { - USHORT Operation; // padding! - USHORT Flags; - PLOWIO_COMPLETION_ROUTINE CompletionRoutine; - PERESOURCE Resource; - ERESOURCE_THREAD ResourceThreadId; - union { - struct { - ULONG Flags; - PMDL Buffer; - RXVBO ByteOffset; - ULONG ByteCount; - ULONG Key; - PNON_PAGED_FCB NonPagedFcb; - } ReadWrite; - struct { - union { - PLOWIO_LOCK_LIST LockList; - LONGLONG Length; - }; - // - // these fields are not used if locklist is used - // - - ULONG Flags; - RXVBO ByteOffset; - ULONG Key; - } Locks; - XXCTL_LOWIO_COMPONENT FsCtl; - XXCTL_LOWIO_COMPONENT IoCtl; // these must be the same - struct { - BOOLEAN WatchTree; - ULONG CompletionFilter; - ULONG NotificationBufferLength; - PVOID pNotificationBuffer; - } NotifyChangeDirectory; - } ParamsFor; -} LOWIO_CONTEXT; - -#define LOWIO_CONTEXT_FLAG_SYNCCALL 0x0001 // this is set if lowiocompletion is called from lowiosubmit -#define LOWIO_CONTEXT_FLAG_SAVEUNLOCKS 0x0002 // WRAPPER INTERNAL: on NT, it means the unlock routine add unlocks to the list -#define LOWIO_CONTEXT_FLAG_LOUDOPS 0x0004 // WRAPPER INTERNAL: on NT, it means read and write routines generate dbg output -#define LOWIO_CONTEXT_FLAG_CAN_COMPLETE_AT_DPC_LEVEL 0x0008 // WRAPPER INTERNAL: on NT, it means the completion routine maybe can - // complete when called at DPC. otherwise it cannnot. currently - // none can. - -#define LOWIO_READWRITEFLAG_PAGING_IO 0x01 -#define LOWIO_READWRITEFLAG_EXTENDING_FILESIZE 0x02 -#define LOWIO_READWRITEFLAG_EXTENDING_VDL 0x04 - -// -// these must match the SL_ values in io.h (ntifs.h) since the flags field is just copied -// - -#define LOWIO_LOCKSFLAG_FAIL_IMMEDIATELY 0x01 -#define LOWIO_LOCKSFLAG_EXCLUSIVELOCK 0x02 - -#if (LOWIO_LOCKSFLAG_FAIL_IMMEDIATELY!=SL_FAIL_IMMEDIATELY) -#error LOWIO_LOCKSFLAG_FAIL_IMMEDIATELY!=SL_FAIL_IMMEDIATELY -#endif -#if (LOWIO_LOCKSFLAG_EXCLUSIVELOCK!=SL_EXCLUSIVE_LOCK) -#error LOWIO_LOCKSFLAG_EXCLUSIVELOCK!=SL_EXCLUSIVE_LOCK -#endif - -// -// The six important data structures (SRV_CALL,NET_ROOT,V_NET_ROOT,FCB,SRV_OPEN and -// FOBX) that are an integral part of the mini rdr architecture have a corresponding -// counterpart in every mini rdr implementation. In order to provide maximal flexibility -// and at the same time enhance performance the sizes and the desired allocation -// behaviour are communicated at the registration time of a mini rdr. -// -// There is no single way in which these extensions can be managed which will -// address the concerns of flexibility as well as performance. The solution adopted -// in the current architecture that meets the dual goals in most cases. The solution -// and the rationale is as follows ... -// -// Each mini rdr implementor specifies the size of the data structure extensions -// alongwith a flag specfying if the allocation/free of the extensions are to be -// managed by the wrapper. -// -// In all those cases where a one to one relationship exists between the wrapper -// data structure and the corresponding mini rdr counterpart specifying the flag -// results in maximal performance gains. There are a certain data structures for -// which many instances of a wrapper data structure map onto the same extension in -// the mini redirector. In such cases the mini rdr implementor will be better off -// managing the allocation/deallocation of the data structure extension without the -// intervention of the wrapper. -// -// Irrespective of the mechanism choosen the convention is to always associate the -// extension with the Context field in the corresponding RDBSS data structure. -// !!!NO EXCEPTIONS!!! -// -// The remaining field in all the RDBSS data structures, i.e., Context2 is left to -// the discretion og the mini rdr implementor. -// -// -// The SRV_CALL extension is not handled currently. This is because of further fixes -// required in RDBSS w.r.t the mecahsnism used to select the mini rdr and to allow several -// minis to share the srvcall. -// -// Please do not use it till further notice; rather, the mini should manage its own srcall -// storage. There is a finalization calldown that assists in this endeavor. -// - -#define RDBSS_MANAGE_SRV_CALL_EXTENSION (0x1) -#define RDBSS_MANAGE_NET_ROOT_EXTENSION (0x2) -#define RDBSS_MANAGE_V_NET_ROOT_EXTENSION (0x4) -#define RDBSS_MANAGE_FCB_EXTENSION (0x8) -#define RDBSS_MANAGE_SRV_OPEN_EXTENSION (0x10) -#define RDBSS_MANAGE_FOBX_EXTENSION (0x20) - -#define RDBSS_NO_DEFERRED_CACHE_READAHEAD (0x1000) - -typedef struct _MINIRDR_DISPATCH { - - // - // Normal Header - // - - NODE_TYPE_CODE NodeTypeCode; - NODE_BYTE_SIZE NodeByteSize; - - // - // Flags to control the allocation of extensions. - // and various other per-minirdr policies - // - - ULONG MRxFlags; - - // - // size of the SRV_CALL extensions - // - - ULONG MRxSrvCallSize; - - // - // size of the NET_ROOT extensions - // - - ULONG MRxNetRootSize; - - // - // size of the V_NET_ROOT extensions - // - - ULONG MRxVNetRootSize; - - // - // size of FCB extensions - // - - ULONG MRxFcbSize; - - // - // size of SRV_OPEN extensions - // - - ULONG MRxSrvOpenSize; - - // - // size of FOBX extensions - // - - ULONG MRxFobxSize; - - // - // Call downs for starting/stopping the mini rdr - // - - PMRX_CALLDOWN_CTX MRxStart; - PMRX_CALLDOWN_CTX MRxStop; - - // - // Call down for cancelling outstanding requests - // - - PMRX_CALLDOWN MRxCancel; - - // - // Call downs related to creating/opening/closing file system objects - // - - PMRX_CALLDOWN MRxCreate; - PMRX_CALLDOWN MRxCollapseOpen; - PMRX_CALLDOWN MRxShouldTryToCollapseThisOpen; - PMRX_CALLDOWN MRxFlush; - PMRX_CALLDOWN MRxZeroExtend; - PMRX_CALLDOWN MRxTruncate; - PMRX_CALLDOWN MRxCleanupFobx; - PMRX_CALLDOWN MRxCloseSrvOpen; - PMRX_DEALLOCATE_FOR_FCB MRxDeallocateForFcb; - PMRX_DEALLOCATE_FOR_FOBX MRxDeallocateForFobx; - PMRX_IS_LOCK_REALIZABLE MRxIsLockRealizable; - PMRX_FORCECLOSED_CALLDOWN MRxForceClosed; - PMRX_CHKFCB_CALLDOWN MRxAreFilesAliased; - - // - // call downs related to nonNT style printing.....note that the connect goes thru - // the normal srvcall/netroot interface - // - - PMRX_CALLDOWN MRxOpenPrintFile; - PMRX_CALLDOWN MRxClosePrintFile; - PMRX_CALLDOWN MRxWritePrintFile; - PMRX_CALLDOWN MRxEnumeratePrintQueue; - - // - // call downs related to unsatisfied requests, i.e., time outs - // - - PMRX_CALLDOWN MRxClosedSrvOpenTimeOut; - PMRX_CALLDOWN MRxClosedFcbTimeOut; - - // - // call downs related to query/set information on file system objects - // - - PMRX_CALLDOWN MRxQueryDirectory; - PMRX_CALLDOWN MRxQueryFileInfo; - PMRX_CALLDOWN MRxSetFileInfo; - PMRX_CALLDOWN MRxSetFileInfoAtCleanup; - PMRX_CALLDOWN MRxQueryEaInfo; - PMRX_CALLDOWN MRxSetEaInfo; - PMRX_CALLDOWN MRxQuerySdInfo; - PMRX_CALLDOWN MRxSetSdInfo; - PMRX_CALLDOWN MRxQueryQuotaInfo; - PMRX_CALLDOWN MRxSetQuotaInfo; - PMRX_CALLDOWN MRxQueryVolumeInfo; - PMRX_CALLDOWN MRxSetVolumeInfo; - PMRX_CHKDIR_CALLDOWN MRxIsValidDirectory; - - // - // call downs related to buffer management - // - - PMRX_COMPUTE_NEW_BUFFERING_STATE MRxComputeNewBufferingState; - - // - // call downs related to Low I/O management (reads/writes on file system objects) - // - - PMRX_CALLDOWN MRxLowIOSubmit[LOWIO_OP_MAXIMUM+1]; - PMRX_EXTENDFILE_CALLDOWN MRxExtendForCache; - PMRX_EXTENDFILE_CALLDOWN MRxExtendForNonCache; - PMRX_CHANGE_BUFFERING_STATE_CALLDOWN MRxCompleteBufferingStateChangeRequest; - - // - // call downs related to name space management - // - - PMRX_CREATE_V_NET_ROOT MRxCreateVNetRoot; - PMRX_FINALIZE_V_NET_ROOT_CALLDOWN MRxFinalizeVNetRoot; - PMRX_FINALIZE_NET_ROOT_CALLDOWN MRxFinalizeNetRoot; - PMRX_UPDATE_NETROOT_STATE MRxUpdateNetRootState; - PMRX_EXTRACT_NETROOT_NAME MRxExtractNetRootName; - - // - // call downs related to establishing connections with servers - // - - PMRX_CREATE_SRVCALL MRxCreateSrvCall; - PMRX_CREATE_SRVCALL MRxCancelCreateSrvCall; - PMRX_SRVCALL_WINNER_NOTIFY MRxSrvCallWinnerNotify; - PMRX_FINALIZE_SRVCALL_CALLDOWN MRxFinalizeSrvCall; - - PMRX_CALLDOWN MRxDevFcbXXXControlFile; - - // - // New calldowns - // - - // - // Allow a client to preparse the name - // - - PMRX_PREPARSE_NAME MRxPreparseName; - - // - // call down for controlling multi-plexing - // - - PMRX_GET_CONNECTION_ID MRxGetConnectionId; - - // - // New field to allow mini-rdrs to specify - // scavenger time interval (in seconds) - // - ULONG ScavengerTimeout; - -} MINIRDR_DISPATCH, *PMINIRDR_DISPATCH; - - -#endif // _RXMINIRDR_ - - - - diff --git a/pub/ddk/mrxfcb.h b/pub/ddk/mrxfcb.h deleted file mode 100644 index a78fa60..0000000 --- a/pub/ddk/mrxfcb.h +++ /dev/null @@ -1,822 +0,0 @@ -/*++ - -Copyright (c) 1994 Microsoft Corporation - -Module Name: - - mrxfFcb.h - -Abstract: - - This module defines the macros/inline functions and function prototypes used by - the mini redirectors to access the RDBSS wrapper data structures. - - IMPORTANT: All mini redirector writers cannot and should not make any assumptions - about the layout of the RDBSS wrapper data structures. They are not guaranteed to - be the same across platforms and even on a single platform are liable to change - across versions. - - The following six data structure abstractions are available to the mini - redirector writer. - - 1) Server Call Context (SRV_CALL) - The context associated with each known file system server. - - 2) Net Roots (NET_ROOT) - The root of a file system volume( local/remote) opened by the user. - - 3) Virtual Net Roots (V_NET_ROOT) - The view of a file system volume on a server. The view can be - constrained along multiple dimensions. As an example the view can be - associated with a logon id. which will constrain the operations that - can be performed on the file system volume. - - 4) File Control Blocks (FCB) - The RDBSS data structure associated with each unique file opened. - - 5) File Object Extensions (FOXB) - - 6) ServerSide Open Context (SRV_OPEN) - - A common convention that is adopted for defining Flags in all of these data structures - is to define a ULONG ( 32 ) flags and split them into two groups -- those that are visible - to the mini redirector and those that are invisible. These flags are not meant for use - by the mini redirector writers and are reserved for the wrapper. - -Author: -Revision History: - ---*/ - -#ifndef __MRXFCB_H__ -#define __MRXFCB_H__ - -// -// The SRVCALL flags are split into two groups, i.e., visible to mini rdrs and invisible to mini rdrs. -// The visible ones are defined above and the definitions for the invisible ones can be found -// in fcb.h. The convention that has been adopted is that the lower 16 flags will be visible -// to the mini rdr and the upper 16 flags will be reserved for the wrapper. This needs to be -// enforced in defining new flags. -// - -#define SRVCALL_FLAG_MAILSLOT_SERVER (0x1) -#define SRVCALL_FLAG_FILE_SERVER (0x2) -#define SRVCALL_FLAG_CASE_INSENSITIVE_NETROOTS (0x4) -#define SRVCALL_FLAG_CASE_INSENSITIVE_FILENAMES (0x8) -#define SRVCALL_FLAG_DFS_AWARE_SERVER (0x10) -#define SRVCALL_FLAG_FORCE_FINALIZED (0x20) -#define SRVCALL_FLAG_LWIO_AWARE_SERVER (0x40) -#define SRVCALL_FLAG_LOOPBACK_SERVER (0x80) - -typedef struct _MRX_NORMAL_NODE_HEADER { - NODE_TYPE_CODE NodeTypeCode; - NODE_BYTE_SIZE NodeByteSize; - __volatile ULONG NodeReferenceCount; -} MRX_NORMAL_NODE_HEADER; - -#ifdef __cplusplus -typedef struct _MRX_SRV_CALL_ : public MRX_NORMAL_NODE_HEADER { -#else // !__cplusplus -typedef struct _MRX_SRV_CALL_ { - MRX_NORMAL_NODE_HEADER; -#endif // __cplusplus - - // - // !!!! changes above this require realignment with fcb.h - // - - // - // the context fields for extensions required by the mini redirectors - // - - PVOID Context; - PVOID Context2; - - // - // Associated DeviceObject which also contains the dispatch vector - // - - PRDBSS_DEVICE_OBJECT RxDeviceObject; - - // - // the srv call name, the server principal name and the server domain name. - // - - PUNICODE_STRING pSrvCallName; - PUNICODE_STRING pPrincipalName; - PUNICODE_STRING pDomainName; - - // - // Flags used to denote the state of the SRV_CALL. - // - - ULONG Flags; - - // - // Server parameters updated by the mini redirectors. - // - - LONG MaximumNumberOfCloseDelayedFiles; - - // - // Status return from the transport in case of failure - // - - NTSTATUS Status; - -} MRX_SRV_CALL, *PMRX_SRV_CALL; - -// -// The various types of NET_ROOT's currently supported by the wrapper. -// - -#define NET_ROOT_DISK ((UCHAR)0) -#define NET_ROOT_PIPE ((UCHAR)1) -#define NET_ROOT_COMM ((UCHAR)2) -#define NET_ROOT_PRINT ((UCHAR)3) -#define NET_ROOT_WILD ((UCHAR)4) -#define NET_ROOT_MAILSLOT ((UCHAR)5) - -typedef UCHAR NET_ROOT_TYPE, *PNET_ROOT_TYPE; - -// -// The pipe buffer size for transferring cannot be larger than 0xffff -// - -#define MAX_PIPE_BUFFER_SIZE 0xFFFF - -// -// The possible states associated with a NET_ROOT. These have been defined to be -// line with the definitions foe the LanManager service to avoid redundant mappings. -// These MUST agree with sdkinc\lmuse.h use_ok, etc..... -// - -#define MRX_NET_ROOT_STATE_GOOD ((UCHAR)0) -#define MRX_NET_ROOT_STATE_PAUSED ((UCHAR)1) -#define MRX_NET_ROOT_STATE_DISCONNECTED ((UCHAR)2) -#define MRX_NET_ROOT_STATE_ERROR ((UCHAR)3) -#define MRX_NET_ROOT_STATE_CONNECTED ((UCHAR)4) -#define MRX_NET_ROOT_STATE_RECONN ((UCHAR)5) - -typedef UCHAR MRX_NET_ROOT_STATE, *PMRX_NET_ROOT_STATE; - -// -// The file systems on the remote servers provide varying levels of functionality to -// detect aliasing between file names. As an example consider two shares on the same -// file system volume. In the absence of any support from the file system on the server -// the correct and conservative approach is to flush all the files to the server as -// opposed to all the files on the same NET_ROOT to preserve coherency and handle -// delayed close operations. -// - -#define MRX_PURGE_SAME_NETROOT ((UCHAR)0) -#define MRX_PURGE_SAME_SRVCALL ((UCHAR)1) - -// -// these are not implemented yet.... -// #define MRX_PURGE_SAME_FCB ((UCHAR)2) -// #define MRX_PURGE_SAME_VOLUME ((UCHAR)3) -// #define MRX_PURGE_ALL ((UCHAR)4) -// - -typedef UCHAR MRX_PURGE_RELATIONSHIP, *PMRX_PURGE_RELATIONSHIP; - -#define MRX_PURGE_SYNC_AT_NETROOT ((UCHAR)0) -#define MRX_PURGE_SYNC_AT_SRVCALL ((UCHAR)1) - -typedef UCHAR MRX_PURGE_SYNCLOCATION, *PMRX_PURGE_SYNCLOCATION; - -// -// The NET_ROOT flags are split into two groups, i.e., visible to mini rdrs and -// invisible to mini rdrs. The visible ones are defined above and the definitions -// for the invisible ones can be found in fcb.h. The convention that has been -// adopted is that the lower 16 flags will be visible to the mini rdr and the -// upper 16 flags will be reserved for the wrapper. This needs to be enforced -// in defining new flags. -// - -#define NETROOT_FLAG_SUPPORTS_SYMBOLIC_LINKS ( 0x0001 ) -#define NETROOT_FLAG_DFS_AWARE_NETROOT ( 0x0002 ) -#define NETROOT_FLAG_DEFER_READAHEAD ( 0x0004 ) -#define NETROOT_FLAG_VOLUMEID_INITIALIZED ( 0x0008 ) -#define NETROOT_FLAG_FINALIZE_INVOKED ( 0x0010 ) -#define NETROOT_FLAG_UNIQUE_FILE_NAME ( 0x0020 ) - -// -// Read ahead amount used for normal data files (32k) -// - -#define DEFAULT_READ_AHEAD_GRANULARITY (0x08000) - -// -// the wrapper implements throttling for certain kinds of operations: -// PeekNamedPipe/ReadNamedPipe -// LockFile -// -// a minirdr can set the timing parameters for this in the netroot. leaving them -// as zero will disable throttling. -// - -typedef struct _NETROOT_THROTTLING_PARAMETERS { - - // - // Supplies the increase in delay in milliseconds, each time a request - // to the network fails. - // - - ULONG Increment; - - // - // Supplies the longest delay the backoff package can introduce - // in milliseconds. - - ULONG MaximumDelay; - -} NETROOT_THROTTLING_PARAMETERS, *PNETROOT_THROTTLING_PARAMETERS; - -#define RxInitializeNetRootThrottlingParameters(__tp,__incr,__maxdelay) { \ - PNETROOT_THROTTLING_PARAMETERS tp = (__tp); \ - tp->Increment = (__incr); \ - tp->MaximumDelay = (__maxdelay); \ -} - -#ifdef __cplusplus -typedef struct _MRX_NET_ROOT_ : public MRX_NORMAL_NODE_HEADER { -#else // !__cplusplus -typedef struct _MRX_NET_ROOT_ { - MRX_NORMAL_NODE_HEADER; -#endif // __cplusplus - - // - // the MRX_SRV_CALL instance with which this MRX_NET_ROOT instance is associated - // - - PMRX_SRV_CALL pSrvCall; - - // - // !!!! changes above this require realignment with fcb.h - // - - // - // the context fields used by the mini redirectors for recording - // additional state. - // - - PVOID Context; - PVOID Context2; - - // - // The flags used to denote the state of the NET_ROOT instance. - // - - ULONG Flags; - - // - // We count the number of fcbs, srvopens on the netroot - // - - __volatile ULONG NumberOfFcbs; - __volatile ULONG NumberOfSrvOpens; - - // - // The current state and the purge relationships based on the support - // provided by the file system on the server. - // - - MRX_NET_ROOT_STATE MRxNetRootState; - NET_ROOT_TYPE Type; - MRX_PURGE_RELATIONSHIP PurgeRelationship; - MRX_PURGE_SYNCLOCATION PurgeSyncLocation; - - // - // the type of device, i.e., file system volume, printer, com port etc. - // - - DEVICE_TYPE DeviceType; - - // - // Name of the NET_ROOT instance - // - - PUNICODE_STRING pNetRootName; - - // - // the name to be prepended to all FCBS associated with this NET_ROOT - // - - UNICODE_STRING InnerNamePrefix; - - // - // Parameters based upon the type of the NET_ROOT. - // - - ULONG ParameterValidationStamp; - union { - struct { - ULONG DataCollectionSize; - NETROOT_THROTTLING_PARAMETERS PipeReadThrottlingParameters; - } NamedPipeParameters; - - struct { - ULONG ClusterSize; - ULONG ReadAheadGranularity; - NETROOT_THROTTLING_PARAMETERS LockThrottlingParameters; - ULONG RenameInfoOverallocationSize; //could be a USHORT - GUID VolumeId; - } DiskParameters; - }; -} MRX_NET_ROOT, *PMRX_NET_ROOT; - -// -// The VNET_ROOT flags are split into two groups, i.e., visible to mini rdrs and -// invisible to mini rdrs. The visible ones are defined below and the definitions -// for the invisible ones can be found in fcb.h. The convention that has been -// adopted is that the lower 16 flags will be visible to the mini rdr and the -// upper 16 flags will be reserved for the wrapper. This needs to be enforced -// in defining new flags. -// - -#define VNETROOT_FLAG_CSCAGENT_INSTANCE 0x00000001 -#define VNETROOT_FLAG_FINALIZE_INVOKED 0x00000002 -#define VNETROOT_FLAG_FORCED_FINALIZE 0x00000004 -#define VNETROOT_FLAG_NOT_FINALIZED 0x00000008 - -#ifdef __cplusplus -typedef struct _MRX_V_NET_ROOT_ : public MRX_NORMAL_NODE_HEADER { -#else // !__cplusplus -typedef struct _MRX_V_NET_ROOT_ { - MRX_NORMAL_NODE_HEADER; -#endif // __cplusplus - - // - // the MRX_NET_ROOT instance with which the MRX_V_NET_ROOT instance is associated - // - - PMRX_NET_ROOT pNetRoot; - - // - // !!!! changes above this require realignment with fcb.h - // - - // - // the context fields provided for storing additional information as deemed - // necessary by the mini redirectors - // - - PVOID Context; - PVOID Context2; - - ULONG Flags; - - // - // This field should not be updated by the mini redirectors. Its usage is intended - // to provide an easy mechanism for accessing certain state information - // - - ULONG NumberOfOpens; - - // - // We count the number of Fobxss on the virtual netroot - // - - __volatile ULONG NumberOfFobxs; - - // - // the security parameters associated with the V_NET_ROOT instance. - // - - LUID LogonId; - - // - // These are the parameters supplied by the used in a NtCreateFile call in - // which the FILE_CREATE_TREE_CONNECTION flag is specified as part of the - // CreateOptions. - // - - PUNICODE_STRING pUserDomainName; - PUNICODE_STRING pUserName; - PUNICODE_STRING pPassword; - ULONG SessionId; - NTSTATUS ConstructionStatus; - BOOLEAN IsExplicitConnection; -} MRX_V_NET_ROOT, *PMRX_V_NET_ROOT; - -// -// ALL FIELDS IN AN FCB ARE READONLY EXCEPT Context and Context2.... -// Also, Context is read only the the mini has specified RDBSS_MANAGE_FCB_EXTENSION -// - -typedef struct _MRX_FCB_ { - - FSRTL_ADVANCED_FCB_HEADER Header; - - // - // The MRX_NET_ROOT instance with which this is associated - // - - PMRX_NET_ROOT pNetRoot; - - // - // !!!! changes above this require realignment with fcb.h - // - - // - // the context fields to store additional information as deemed necessary by the - // mini redirectors. - // - - PVOID Context; - PVOID Context2; - - // - // The reference count: in a different place because we must prefix with - // the FSRTL_COMMON_FCB_HEADER structure. - // - - __volatile ULONG NodeReferenceCount; - - // - // The internal state of the Fcb. THIS FIELD IS READONLY FOR MINIRDRS - // - - ULONG FcbState; - - // - // A count of the number of file objects that have been opened for - // this file/directory, but not yet been cleaned up yet. This count - // is only used for data file objects, not for the Acl or Ea stream - // file objects. This count gets decremented in RxCommonCleanup, - // while the OpenCount below gets decremented in RxCommonClose. - // - - __volatile CLONG UncleanCount; - - // - // A count of the number of file objects that have been opened for - // this file/directory, but not yet been cleaned up yet and for which - // cacheing is not supported. This is used in cleanup.c to tell if extra - // purges are required to maintain coherence. - // - - CLONG UncachedUncleanCount; - - // - // A count of the number of file objects that have opened - // this file/directory. For files & directories the FsContext of the - // file object points to this record. - // - - __volatile CLONG OpenCount; - - // - // The outstanding locks count: if this count is nonzero, the we silently - // ignore adding LOCK_BUFFERING in a ChangeBufferingState request. This field - // is manipulated by interlocked operations so you only have to have the fcb - // shared to manipulate it but you have to have it exclusive to use it. - // - - __volatile ULONG OutstandingLockOperationsCount; - - // - // The actual allocation length as opposed to the valid data length - // - - ULONGLONG ActualAllocationLength; - - // - // Attributes of the MRX_FCB, - // - - ULONG Attributes; - - // - // Intended for future use, currently used to round off allocation to - // DWORD boundaries. - // - - BOOLEAN IsFileWritten; - BOOLEAN fShouldBeOrphaned; - BOOLEAN fMiniInited; - - // - // Type of the associated MRX_NET_ROOT, intended to avoid pointer chasing. - // - - UCHAR CachedNetRootType; - - // - // Header for the list of srv_opens for this FCB.... - // THIS FIELD IS READONLY FOR MINIS - // - - LIST_ENTRY SrvOpenList; - - // - // changes whenever the list changes..prevents extra lookups - // THIS FIELD IS READONLY FOR MINIS - // - - ULONG SrvOpenListVersion; - -} MRX_FCB, *PMRX_FCB; - - -// -// The following flags define the various types of buffering that can be selectively -// enabled or disabled for each SRV_OPEN. -// - -#define SRVOPEN_FLAG_DONTUSE_READ_CACHING (0x1) -#define SRVOPEN_FLAG_DONTUSE_WRITE_CACHING (0x2) -#define SRVOPEN_FLAG_CLOSED (0x4) -#define SRVOPEN_FLAG_CLOSE_DELAYED (0x8) -#define SRVOPEN_FLAG_FILE_RENAMED (0x10) -#define SRVOPEN_FLAG_FILE_DELETED (0x20) -#define SRVOPEN_FLAG_BUFFERING_STATE_CHANGE_PENDING (0x40) -#define SRVOPEN_FLAG_COLLAPSING_DISABLED (0x80) -#define SRVOPEN_FLAG_BUFFERING_STATE_CHANGE_REQUESTS_PURGED (0x100) -#define SRVOPEN_FLAG_NO_BUFFERING_STATE_CHANGE (0x200) -#define SRVOPEN_FLAG_ORPHANED (0x400) - -typedef -NTSTATUS -(NTAPI *PMRX_SHADOW_CALLDOWN) ( - IN OUT struct _RX_CONTEXT * RxContext - ); - -// -// Minirdrs allocate, initialize and free this structure -// - -typedef struct { - - // - // Pointer to the file object associated with the handle. This is set - // after the handle is successfully created in the usermode. - // - - PFILE_OBJECT UnderlyingFileObject; - - // - // Pointer to the device object represented by the file object mentioned - // above. - // - - PDEVICE_OBJECT UnderlyingDeviceObject; - - ULONG LockKey; - - PFAST_IO_READ FastIoRead; - PFAST_IO_WRITE FastIoWrite; - - PMRX_SHADOW_CALLDOWN DispatchRoutine; - -} MRXSHADOW_SRV_OPEN, *PMRXSHADOW_SRV_OPEN; - -#ifdef __cplusplus -typedef struct _MRX_SRV_OPEN_ : public MRX_NORMAL_NODE_HEADER { -#else // !__cplusplus -typedef struct _MRX_SRV_OPEN_ { - MRX_NORMAL_NODE_HEADER; -#endif // __cplusplus - - // - // the MRX_FCB instance with which the SRV_OPEN is associated. - // - - PMRX_FCB pFcb; - - // - // the V_NET_ROOT instance with which the SRV_OPEN is associated - // - - PMRX_V_NET_ROOT pVNetRoot; - - // - // !!!! changes above this require realignment with fcb.h - // - - // - // the context fields to store additional state information as deemed necessary - // by the mini redirectors - // - - PVOID Context; - PVOID Context2; - - // - // shadow context, mini-rdr allocates and deallocates this structure - // - - PMRXSHADOW_SRV_OPEN ShadowContext; - - // - // The flags are split into two groups, i.e., visible to mini rdrs and invisible - // to mini rdrs. The visible ones are defined above and the definitions for the - // invisible ones can be found in fcb.h. The convention that has been adopted is - // that the lower 16 flags will be visible to the mini rdr and the upper 16 flags - // will be reserved for the wrapper. This needs to be enforced in defining new flags. - // - - ULONG Flags; - - // - // the name alongwith the MRX_NET_ROOT prefix, i.e. fully qualified name - // - - PUNICODE_STRING pAlreadyPrefixedName; - - // - // the number of Fobx's associated with this open for which a cleanup IRP - // has not been processed. - // - - CLONG UncleanFobxCount; - - // - // the number of local opens associated with this open on the server - // - - CLONG OpenCount; - - // - // the Key assigned by the mini redirector for this SRV_OPEN. Since the various mini - // redirectors do not always get to pick the unique id for a open instance, the key - // used to identify the open to the server is different for different mini redirectors - // based upon the convention adopted at the server. - // - - PVOID Key; - - // - // the access and sharing rights specified for this SRV_OPEN. This is used in - // determining is subsequent open requests can be collapsed with an existing - // SRV_OPEN instance. - // - - ACCESS_MASK DesiredAccess; - ULONG ShareAccess; - ULONG CreateOptions; - - // - // The BufferingFlags field is temporal.....it does not really belong to the - // srvopen; rather the srvopen is used as a representative of the fcb. On - // each open, the bufferingflags field of the srvopen is taken as the minirdr's - // contribution to the buffering state. On an oplock break, a srvopen is passed - // (the one that's being broken) whose bufferflags field is taken as the new - // proxy. On a close that changes the minirdr's contribution, the minirdr should - // take steps to cause a ChangeBufferingState to the new state. - // - // just to reiterate, the field is just used to carry the information from - // the minirdr to RxChangeBufferingState and does not hold longterm coherent - // information. - // - - ULONG BufferingFlags; - - // - // List Entry to wire the SRV_OPEN to the list of SRV_OPENS maintained as - // part of theFCB - // THIS FIELD IS READONLY FOR MINIS - // - - ULONG ulFileSizeVersion; - - LIST_ENTRY SrvOpenQLinks; - -} MRX_SRV_OPEN, *PMRX_SRV_OPEN; - -#define FOBX_FLAG_DFS_OPEN (0x0001) -#define FOBX_FLAG_BAD_HANDLE (0x0002) -#define FOBX_FLAG_BACKUP_INTENT (0x0004) -#define FOBX_FLAG_NOT_USED (0x0008) - -#define FOBX_FLAG_FLUSH_EVEN_CACHED_READS (0x0010) -#define FOBX_FLAG_DONT_ALLOW_PAGING_IO (0x0020) -#define FOBX_FLAG_DONT_ALLOW_FASTIO_READ (0x0040) - -typedef struct _MRX_PIPE_HANDLE_INFORMATION { - - ULONG TypeOfPipe; - ULONG ReadMode; - ULONG CompletionMode; - -} MRX_PIPE_HANDLE_INFORMATION, *PMRX_PIPE_HANDLE_INFORMATION; - -#ifdef __cplusplus -typedef struct _MRX_FOBX_ : public MRX_NORMAL_NODE_HEADER { -#else // !__cplusplus -typedef struct _MRX_FOBX_ { - MRX_NORMAL_NODE_HEADER; -#endif // __cplusplus - - // - // the MRX_SRV_OPEN instance with which the FOBX is associated - // - - PMRX_SRV_OPEN pSrvOpen; - - // - // the FILE_OBJECT with which this FOBX is associated - // In certain instances the I/O subsystem creates a FILE_OBJECT instance - // on the stack in the interests of efficiency. In such cases this field - // is NULL. - // - - PFILE_OBJECT AssociatedFileObject; - - // - // !!!! changes above this require realignment with fcb.h - // - - // - // The fields provided to accomodate additional state to be associated - // by the various mini redirectors - // - - PVOID Context; - PVOID Context2; - - // - // The FOBX flags are split into two groups, i.e., visible to mini rdrs and invisible to mini rdrs. - // The visible ones are defined above and the definitions for the invisible ones can be found - // in fcb.h. The convention that has been adopted is that the lower 16 flags will be visible - // to the mini rdr and the upper 16 flags will be reserved for the wrapper. This needs to be - // enforced in defining new flags. - // - - ULONG Flags; - - union { - struct { - - // - // The query template is used to filter directory query requests. - // It originally is set to null and on the first call the NtQueryDirectory - // it is set to the input filename or "*" if the name is not supplied. - // All subsquent queries then use this template. - // - - UNICODE_STRING UnicodeQueryTemplate; - }; // for directories - - PMRX_PIPE_HANDLE_INFORMATION PipeHandleInformation; // for pipes - }; - - // - // The following field is used as an offset into the Eas for a - // particular file. This will be the offset for the next - // Ea to return. A value of 0xffffffff indicates that the - // Ea's are exhausted. - // - - // - // This field is manipulated directly by the smbmini....maybe it should move down - // one thing is that it is a reminder that NT allows a resume on getting EAs - // - - ULONG OffsetOfNextEaToReturn; -} MRX_FOBX, *PMRX_FOBX; - -// -// Resource accquisition routines. -// -// The synchronization resources of interest to mini redirector writers are -// primarily associated with the FCB. There is a paging I/O resource and a -// regular resource. The paging I/O resource is managed by the wrapper. The only -// resource accesible to mini redirector writers is the regular resource which -// should be accessed using the supplied routines. -// - -NTSTATUS -RxAcquireExclusiveFcbResourceInMRx ( - __inout PMRX_FCB Fcb - ); - -NTSTATUS -RxAcquireSharedFcbResourceInMRx ( - __inout PMRX_FCB Fcb - ); - -NTSTATUS -RxAcquireSharedFcbResourceInMRxEx ( - IN PRX_CONTEXT pRxContext, - PMRX_FCB Fcb - ); - -VOID -RxReleaseFcbResourceInMRx ( - PMRX_FCB Fcb - ); - -extern VOID -RxReleaseFcbResourceForThreadInMRx( - IN PRX_CONTEXT pRxContext, - IN OUT PMRX_FCB MrxFcb, - IN ERESOURCE_THREAD ResourceThreadId); - -#endif // __MRXFCB_H__ - - - - diff --git a/pub/ddk/msdadc.h b/pub/ddk/msdadc.h deleted file mode 100644 index 1459440..0000000 --- a/pub/ddk/msdadc.h +++ /dev/null @@ -1,392 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for msdadc.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __msdadc_h__ -#define __msdadc_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IDataConvert_FWD_DEFINED__ -#define __IDataConvert_FWD_DEFINED__ -typedef interface IDataConvert IDataConvert; -#endif /* __IDataConvert_FWD_DEFINED__ */ - - -#ifndef __IDCInfo_FWD_DEFINED__ -#define __IDCInfo_FWD_DEFINED__ -typedef interface IDCInfo IDCInfo; -#endif /* __IDCInfo_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" -#include "ocidl.h" -#include "oledb.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_msdadc_0000_0000 */ -/* [local] */ - -//----------------------------------------------------------------------------- -// File: .C or .H file generated by msdadc.idl -// -// Copyright: Copyright (c) 1998-1999 Microsoft Corporation -// -// Contents: .C or .H file generated by msdadc.idl -// -// Comments: -// -//----------------------------------------------------------------------------- -#include // 8-byte structure packing -#undef OLEDBDECLSPEC -#if _MSC_VER >= 1100 -#define OLEDBDECLSPEC __declspec(selectany) -#else -#define OLEDBDECLSPEC -#endif //_MSC_VER - - -extern RPC_IF_HANDLE __MIDL_itf_msdadc_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_msdadc_0000_0000_v0_0_s_ifspec; - -#ifndef __IDataConvert_INTERFACE_DEFINED__ -#define __IDataConvert_INTERFACE_DEFINED__ - -/* interface IDataConvert */ -/* [unique][helpstring][uuid][object] */ - -typedef DWORD DBDATACONVERT; - - -enum DBDATACONVERTENUM - { DBDATACONVERT_DEFAULT = 0, - DBDATACONVERT_SETDATABEHAVIOR = 0x1, - DBDATACONVERT_LENGTHFROMNTS = 0x2, - DBDATACONVERT_DSTISFIXEDLENGTH = 0x4, - DBDATACONVERT_DECIMALSCALE = 0x8 - } ; - -EXTERN_C const IID IID_IDataConvert; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("0c733a8d-2a1c-11ce-ade5-00aa0044773d") - IDataConvert : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE DataConvert( - /* [in] */ DBTYPE wSrcType, - /* [in] */ DBTYPE wDstType, - /* [in] */ DBLENGTH cbSrcLength, - /* [annotation][out][in] */ - __out_opt DBLENGTH *pcbDstLength, - /* [annotation][in] */ - __in_bcount(cbSrcLength) void *pSrc, - /* [annotation][out] */ - __out_xcount(cbDstMaxLength) void *pDst, - /* [in] */ DBLENGTH cbDstMaxLength, - /* [in] */ DBSTATUS dbsSrcStatus, - /* [annotation][out] */ - __out_opt DBSTATUS *pdbsStatus, - /* [in] */ BYTE bPrecision, - /* [in] */ BYTE bScale, - /* [in] */ DBDATACONVERT dwFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE CanConvert( - /* [in] */ DBTYPE wSrcType, - /* [in] */ DBTYPE wDstType) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetConversionSize( - /* [in] */ DBTYPE wSrcType, - /* [in] */ DBTYPE wDstType, - /* [annotation][in] */ - __in_opt DBLENGTH *pcbSrcLength, - /* [annotation][out] */ - __out_opt DBLENGTH *pcbDstLength, - /* [annotation][size_is][in] */ - __in_bcount_opt(*pcbSrcLength) void *pSrc) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDataConvertVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDataConvert * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDataConvert * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDataConvert * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *DataConvert )( - IDataConvert * This, - /* [in] */ DBTYPE wSrcType, - /* [in] */ DBTYPE wDstType, - /* [in] */ DBLENGTH cbSrcLength, - /* [annotation][out][in] */ - __out_opt DBLENGTH *pcbDstLength, - /* [annotation][in] */ - __in_bcount(cbSrcLength) void *pSrc, - /* [annotation][out] */ - __out_xcount(cbDstMaxLength) void *pDst, - /* [in] */ DBLENGTH cbDstMaxLength, - /* [in] */ DBSTATUS dbsSrcStatus, - /* [annotation][out] */ - __out_opt DBSTATUS *pdbsStatus, - /* [in] */ BYTE bPrecision, - /* [in] */ BYTE bScale, - /* [in] */ DBDATACONVERT dwFlags); - - HRESULT ( STDMETHODCALLTYPE *CanConvert )( - __RPC__in IDataConvert * This, - /* [in] */ DBTYPE wSrcType, - /* [in] */ DBTYPE wDstType); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetConversionSize )( - IDataConvert * This, - /* [in] */ DBTYPE wSrcType, - /* [in] */ DBTYPE wDstType, - /* [annotation][in] */ - __in_opt DBLENGTH *pcbSrcLength, - /* [annotation][out] */ - __out_opt DBLENGTH *pcbDstLength, - /* [annotation][size_is][in] */ - __in_bcount_opt(*pcbSrcLength) void *pSrc); - - END_INTERFACE - } IDataConvertVtbl; - - interface IDataConvert - { - CONST_VTBL struct IDataConvertVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDataConvert_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDataConvert_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDataConvert_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDataConvert_DataConvert(This,wSrcType,wDstType,cbSrcLength,pcbDstLength,pSrc,pDst,cbDstMaxLength,dbsSrcStatus,pdbsStatus,bPrecision,bScale,dwFlags) \ - ( (This)->lpVtbl -> DataConvert(This,wSrcType,wDstType,cbSrcLength,pcbDstLength,pSrc,pDst,cbDstMaxLength,dbsSrcStatus,pdbsStatus,bPrecision,bScale,dwFlags) ) - -#define IDataConvert_CanConvert(This,wSrcType,wDstType) \ - ( (This)->lpVtbl -> CanConvert(This,wSrcType,wDstType) ) - -#define IDataConvert_GetConversionSize(This,wSrcType,wDstType,pcbSrcLength,pcbDstLength,pSrc) \ - ( (This)->lpVtbl -> GetConversionSize(This,wSrcType,wDstType,pcbSrcLength,pcbDstLength,pSrc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDataConvert_INTERFACE_DEFINED__ */ - - -#ifndef __IDCInfo_INTERFACE_DEFINED__ -#define __IDCInfo_INTERFACE_DEFINED__ - -/* interface IDCInfo */ -/* [unique][helpstring][uuid][object] */ - -typedef DWORD DCINFOTYPE; - - -enum DCINFOTYPEENUM - { DCINFOTYPE_VERSION = 1 - } ; -typedef struct tagDCINFO - { - DCINFOTYPE eInfoType; - VARIANT vData; - } DCINFO; - - -EXTERN_C const IID IID_IDCInfo; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("0c733a9c-2a1c-11ce-ade5-00aa0044773d") - IDCInfo : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetInfo( - /* [in] */ ULONG cInfo, - /* [size_is][in] */ __RPC__in_ecount_full(cInfo) DCINFOTYPE rgeInfoType[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cInfo) DCINFO **prgInfo) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInfo( - /* [in] */ ULONG cInfo, - /* [size_is][in] */ __RPC__in_ecount_full(cInfo) DCINFO rgInfo[ ]) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDCInfoVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDCInfo * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDCInfo * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDCInfo * This); - - HRESULT ( STDMETHODCALLTYPE *GetInfo )( - __RPC__in IDCInfo * This, - /* [in] */ ULONG cInfo, - /* [size_is][in] */ __RPC__in_ecount_full(cInfo) DCINFOTYPE rgeInfoType[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cInfo) DCINFO **prgInfo); - - HRESULT ( STDMETHODCALLTYPE *SetInfo )( - __RPC__in IDCInfo * This, - /* [in] */ ULONG cInfo, - /* [size_is][in] */ __RPC__in_ecount_full(cInfo) DCINFO rgInfo[ ]); - - END_INTERFACE - } IDCInfoVtbl; - - interface IDCInfo - { - CONST_VTBL struct IDCInfoVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDCInfo_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDCInfo_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDCInfo_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDCInfo_GetInfo(This,cInfo,rgeInfoType,prgInfo) \ - ( (This)->lpVtbl -> GetInfo(This,cInfo,rgeInfoType,prgInfo) ) - -#define IDCInfo_SetInfo(This,cInfo,rgInfo) \ - ( (This)->lpVtbl -> SetInfo(This,cInfo,rgInfo) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDCInfo_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_msdadc_0000_0002 */ -/* [local] */ - -extern const GUID OLEDBDECLSPEC IID_IDataConvert = { 0x0c733a8dL,0x2a1c,0x11ce, { 0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d } }; -extern const GUID OLEDBDECLSPEC IID_IDCInfo = { 0x0c733a9cL,0x2a1c,0x11ce, { 0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d } }; -#include // restore original structure packing - - -extern RPC_IF_HANDLE __MIDL_itf_msdadc_0000_0002_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_msdadc_0000_0002_v0_0_s_ifspec; - -/* Additional Prototypes for ALL interfaces */ - -unsigned long __RPC_USER VARIANT_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in VARIANT * ); -unsigned char * __RPC_USER VARIANT_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in VARIANT * ); -unsigned char * __RPC_USER VARIANT_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out VARIANT * ); -void __RPC_USER VARIANT_UserFree( __RPC__in unsigned long *, __RPC__in VARIANT * ); - -unsigned long __RPC_USER VARIANT_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in VARIANT * ); -unsigned char * __RPC_USER VARIANT_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in VARIANT * ); -unsigned char * __RPC_USER VARIANT_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out VARIANT * ); -void __RPC_USER VARIANT_UserFree64( __RPC__in unsigned long *, __RPC__in VARIANT * ); - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/msdaguid.h b/pub/ddk/msdaguid.h deleted file mode 100644 index 21eec36..0000000 --- a/pub/ddk/msdaguid.h +++ /dev/null @@ -1,41 +0,0 @@ -//--------------------------------------------------------------------------- -// -// File: MSDAGUID.H -// -// Copyright: Copyright (c) Microsoft Corporation -// -// Contents: Microsoft Data Access GUID defintions -// -// Comments: -// -//--------------------------------------------------------------------------- - -#ifndef MSDAGUID -#define MSDAGUID - -#undef OLEDBDECLSPEC -#if _MSC_VER >= 1100 -#define OLEDBDECLSPEC __declspec(selectany) -#else -#define OLEDBDECLSPEC -#endif //_MSC_VER - -#ifdef DBINITCONSTANTS -EXTERN_C const OLEDBDECLSPEC GUID CLSID_OLEDB_ENUMERATOR = {0xc8b522d0L,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}}; -EXTERN_C const OLEDBDECLSPEC GUID CLSID_EXTENDEDERRORINFO = {0xc8b522cfL,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}}; -EXTERN_C const OLEDBDECLSPEC GUID CLSID_MSDAVTM = {0x0c733a8eL,0x2a1c,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}}; -EXTERN_C const OLEDBDECLSPEC GUID CLSID_OLEDB_CONVERSIONLIBRARY= {0xc8b522d1L,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}}; -EXTERN_C const OLEDBDECLSPEC GUID CLSID_OLEDB_ROWPOSITIONLIBRARY= {0x2048eee6l,0x7fa2,0x11d0,{0x9e,0x6a,0x00,0xa0,0xc9,0x13,0x8c,0x29}}; -EXTERN_C const OLEDBDECLSPEC GUID OLEDB_SVC_DSLPropertyPages = {0x51740c02,0x7e8e,0x11d2,{0xa0,0x2d,0x00,0xc0,0x4f,0xa3,0x73,0x48}}; - -#else -EXTERN_C const GUID CLSID_OLEDB_ENUMERATOR; -EXTERN_C const GUID CLSID_EXTENDEDERRORINFO; -EXTERN_C const GUID CLSID_MSDAVTM; -EXTERN_C const GUID CLSID_OLEDB_CONVERSIONLIBRARY; -EXTERN_C const GUID CLSID_OLEDB_ROWPOSITIONLIBRARY; -EXTERN_C const GUID OLEDB_SVC_DSLPropertyPages; -#endif - -#endif // MSDAGUID - diff --git a/pub/ddk/msdasc.h b/pub/ddk/msdasc.h deleted file mode 100644 index aca318a..0000000 --- a/pub/ddk/msdasc.h +++ /dev/null @@ -1,828 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for msdasc.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __msdasc_h__ -#define __msdasc_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IService_FWD_DEFINED__ -#define __IService_FWD_DEFINED__ -typedef interface IService IService; -#endif /* __IService_FWD_DEFINED__ */ - - -#ifndef __IDBPromptInitialize_FWD_DEFINED__ -#define __IDBPromptInitialize_FWD_DEFINED__ -typedef interface IDBPromptInitialize IDBPromptInitialize; -#endif /* __IDBPromptInitialize_FWD_DEFINED__ */ - - -#ifndef __IDataInitialize_FWD_DEFINED__ -#define __IDataInitialize_FWD_DEFINED__ -typedef interface IDataInitialize IDataInitialize; -#endif /* __IDataInitialize_FWD_DEFINED__ */ - - -#ifndef __IDataSourceLocator_FWD_DEFINED__ -#define __IDataSourceLocator_FWD_DEFINED__ -typedef interface IDataSourceLocator IDataSourceLocator; -#endif /* __IDataSourceLocator_FWD_DEFINED__ */ - - -#ifndef __DataLinks_FWD_DEFINED__ -#define __DataLinks_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class DataLinks DataLinks; -#else -typedef struct DataLinks DataLinks; -#endif /* __cplusplus */ - -#endif /* __DataLinks_FWD_DEFINED__ */ - - -#ifndef __MSDAINITIALIZE_FWD_DEFINED__ -#define __MSDAINITIALIZE_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class MSDAINITIALIZE MSDAINITIALIZE; -#else -typedef struct MSDAINITIALIZE MSDAINITIALIZE; -#endif /* __cplusplus */ - -#endif /* __MSDAINITIALIZE_FWD_DEFINED__ */ - - -#ifndef __PDPO_FWD_DEFINED__ -#define __PDPO_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class PDPO PDPO; -#else -typedef struct PDPO PDPO; -#endif /* __cplusplus */ - -#endif /* __PDPO_FWD_DEFINED__ */ - - -#ifndef __RootBinder_FWD_DEFINED__ -#define __RootBinder_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class RootBinder RootBinder; -#else -typedef struct RootBinder RootBinder; -#endif /* __cplusplus */ - -#endif /* __RootBinder_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" -#include "ocidl.h" -#include "oledb.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_msdasc_0000_0000 */ -/* [local] */ - -//----------------------------------------------------------------------------- -// File: .C or .H file generated by msdasc.idl -// -// Copyright: Copyright (c) 1998-1999 Microsoft Corporation -// -// Contents: .C or .H file generated by msdasc.idl -// -// Comments: -// -//----------------------------------------------------------------------------- - -#ifdef _WIN64 - -typedef LONGLONG COMPATIBLE_LONG; - -#else - -typedef LONG COMPATIBLE_LONG; - -#endif // _WIN64 -typedef -enum tagEBindInfoOptions - { BIO_BINDER = 0x1 - } EBindInfoOptions; - -#define STGM_COLLECTION 0x00002000L -#define STGM_OUTPUT 0x00008000L -#define STGM_OPEN 0x80000000L -#define STGM_RECURSIVE 0x01000000L -#define STGM_STRICTOPEN 0x40000000L - - -extern RPC_IF_HANDLE __MIDL_itf_msdasc_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_msdasc_0000_0000_v0_0_s_ifspec; - -#ifndef __IService_INTERFACE_DEFINED__ -#define __IService_INTERFACE_DEFINED__ - -/* interface IService */ -/* [object][unique][helpstring][uuid] */ - - -EXTERN_C const IID IID_IService; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("06210E88-01F5-11D1-B512-0080C781C384") - IService : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE InvokeService( - /* [annotation][in] */ - __in IUnknown *pUnkInner) = 0; - - }; - -#else /* C style interface */ - - typedef struct IServiceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IService * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IService * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IService * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *InvokeService )( - IService * This, - /* [annotation][in] */ - __in IUnknown *pUnkInner); - - END_INTERFACE - } IServiceVtbl; - - interface IService - { - CONST_VTBL struct IServiceVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IService_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IService_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IService_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IService_InvokeService(This,pUnkInner) \ - ( (This)->lpVtbl -> InvokeService(This,pUnkInner) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IService_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_msdasc_0000_0001 */ -/* [local] */ - -typedef DWORD DBPROMPTOPTIONS; - -typedef -enum tagDBPROMPTOPTIONSENUM - { DBPROMPTOPTIONS_NONE = 0, - DBPROMPTOPTIONS_WIZARDSHEET = 0x1, - DBPROMPTOPTIONS_PROPERTYSHEET = 0x2, - DBPROMPTOPTIONS_BROWSEONLY = 0x8, - DBPROMPTOPTIONS_DISABLE_PROVIDER_SELECTION = 0x10, - DBPROMPTOPTIONS_DISABLESAVEPASSWORD = 0x20 - } DBPROMPTOPTIONSENUM; - - - -extern RPC_IF_HANDLE __MIDL_itf_msdasc_0000_0001_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_msdasc_0000_0001_v0_0_s_ifspec; - -#ifndef __IDBPromptInitialize_INTERFACE_DEFINED__ -#define __IDBPromptInitialize_INTERFACE_DEFINED__ - -/* interface IDBPromptInitialize */ -/* [restricted][local][unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDBPromptInitialize; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("2206CCB0-19C1-11D1-89E0-00C04FD7A829") - IDBPromptInitialize : public IUnknown - { - public: - virtual /* [local][helpstring] */ HRESULT STDMETHODCALLTYPE PromptDataSource( - /* [annotation][in] */ - __in_opt IUnknown *pUnkOuter, - /* [in] */ HWND hWndParent, - /* [in] */ DBPROMPTOPTIONS dwPromptOptions, - /* [in] */ ULONG cSourceTypeFilter, - /* [annotation][size_is][in] */ - __in_ecount_opt(cSourceTypeFilter) DBSOURCETYPE *rgSourceTypeFilter, - /* [annotation][in] */ - __in_z_opt LPCOLESTR pwszszzProviderFilter, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out][in] */ - __deref_inout IUnknown **ppDataSource) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE PromptFileName( - /* [in] */ HWND hWndParent, - /* [in] */ DBPROMPTOPTIONS dwPromptOptions, - /* [in] */ LPCOLESTR pwszInitialDirectory, - /* [in] */ LPCOLESTR pwszInitialFile, - /* [annotation][out] */ - __deref_out LPOLESTR *ppwszSelectedFile) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDBPromptInitializeVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDBPromptInitialize * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDBPromptInitialize * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDBPromptInitialize * This); - - /* [local][helpstring] */ HRESULT ( STDMETHODCALLTYPE *PromptDataSource )( - IDBPromptInitialize * This, - /* [annotation][in] */ - __in_opt IUnknown *pUnkOuter, - /* [in] */ HWND hWndParent, - /* [in] */ DBPROMPTOPTIONS dwPromptOptions, - /* [in] */ ULONG cSourceTypeFilter, - /* [annotation][size_is][in] */ - __in_ecount_opt(cSourceTypeFilter) DBSOURCETYPE *rgSourceTypeFilter, - /* [annotation][in] */ - __in_z_opt LPCOLESTR pwszszzProviderFilter, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out][in] */ - __deref_inout IUnknown **ppDataSource); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *PromptFileName )( - IDBPromptInitialize * This, - /* [in] */ HWND hWndParent, - /* [in] */ DBPROMPTOPTIONS dwPromptOptions, - /* [in] */ LPCOLESTR pwszInitialDirectory, - /* [in] */ LPCOLESTR pwszInitialFile, - /* [annotation][out] */ - __deref_out LPOLESTR *ppwszSelectedFile); - - END_INTERFACE - } IDBPromptInitializeVtbl; - - interface IDBPromptInitialize - { - CONST_VTBL struct IDBPromptInitializeVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDBPromptInitialize_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDBPromptInitialize_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDBPromptInitialize_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDBPromptInitialize_PromptDataSource(This,pUnkOuter,hWndParent,dwPromptOptions,cSourceTypeFilter,rgSourceTypeFilter,pwszszzProviderFilter,riid,ppDataSource) \ - ( (This)->lpVtbl -> PromptDataSource(This,pUnkOuter,hWndParent,dwPromptOptions,cSourceTypeFilter,rgSourceTypeFilter,pwszszzProviderFilter,riid,ppDataSource) ) - -#define IDBPromptInitialize_PromptFileName(This,hWndParent,dwPromptOptions,pwszInitialDirectory,pwszInitialFile,ppwszSelectedFile) \ - ( (This)->lpVtbl -> PromptFileName(This,hWndParent,dwPromptOptions,pwszInitialDirectory,pwszInitialFile,ppwszSelectedFile) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDBPromptInitialize_INTERFACE_DEFINED__ */ - - -#ifndef __IDataInitialize_INTERFACE_DEFINED__ -#define __IDataInitialize_INTERFACE_DEFINED__ - -/* interface IDataInitialize */ -/* [unique][helpstring][uuid][object] */ - - - - -EXTERN_C const IID IID_IDataInitialize; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("2206CCB1-19C1-11D1-89E0-00C04FD7A829") - IDataInitialize : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetDataSource( - /* [in] */ __RPC__in_opt IUnknown *pUnkOuter, - /* [in] */ DWORD dwClsCtx, - /* [unique][in] */ __RPC__in_opt LPCOLESTR pwszInitializationString, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out][in] */ __RPC__deref_inout_opt IUnknown **ppDataSource) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetInitializationString( - /* [in] */ __RPC__in_opt IUnknown *pDataSource, - /* [in] */ boolean fIncludePassword, - /* [out] */ __RPC__deref_out_opt LPOLESTR *ppwszInitString) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CreateDBInstance( - /* [in] */ __RPC__in REFCLSID clsidProvider, - /* [in] */ __RPC__in_opt IUnknown *pUnkOuter, - /* [in] */ DWORD dwClsCtx, - /* [unique][in] */ __RPC__in_opt LPOLESTR pwszReserved, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ __RPC__deref_out_opt IUnknown **ppDataSource) = 0; - - virtual /* [local][helpstring] */ HRESULT STDMETHODCALLTYPE CreateDBInstanceEx( - /* [in] */ REFCLSID clsidProvider, - /* [annotation][in] */ - __in_opt IUnknown *pUnkOuter, - /* [in] */ DWORD dwClsCtx, - /* [annotation][unique][in] */ - __in_z_opt LPOLESTR pwszReserved, - /* [annotation][unique][in] */ - __in COSERVERINFO *pServerInfo, - /* [in] */ ULONG cmq, - /* [annotation][size_is][out][in] */ - __out_ecount(cmq) MULTI_QI *rgmqResults) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE LoadStringFromStorage( - /* [unique][in] */ __RPC__in_opt LPCOLESTR pwszFileName, - /* [out] */ __RPC__deref_out_opt LPOLESTR *ppwszInitializationString) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE WriteStringToStorage( - /* [unique][in] */ __RPC__in_opt LPCOLESTR pwszFileName, - /* [unique][in] */ __RPC__in_opt LPCOLESTR pwszInitializationString, - /* [in] */ DWORD dwCreationDisposition) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDataInitializeVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDataInitialize * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDataInitialize * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDataInitialize * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDataSource )( - __RPC__in IDataInitialize * This, - /* [in] */ __RPC__in_opt IUnknown *pUnkOuter, - /* [in] */ DWORD dwClsCtx, - /* [unique][in] */ __RPC__in_opt LPCOLESTR pwszInitializationString, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out][in] */ __RPC__deref_inout_opt IUnknown **ppDataSource); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetInitializationString )( - __RPC__in IDataInitialize * This, - /* [in] */ __RPC__in_opt IUnknown *pDataSource, - /* [in] */ boolean fIncludePassword, - /* [out] */ __RPC__deref_out_opt LPOLESTR *ppwszInitString); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateDBInstance )( - __RPC__in IDataInitialize * This, - /* [in] */ __RPC__in REFCLSID clsidProvider, - /* [in] */ __RPC__in_opt IUnknown *pUnkOuter, - /* [in] */ DWORD dwClsCtx, - /* [unique][in] */ __RPC__in_opt LPOLESTR pwszReserved, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ __RPC__deref_out_opt IUnknown **ppDataSource); - - /* [local][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateDBInstanceEx )( - IDataInitialize * This, - /* [in] */ REFCLSID clsidProvider, - /* [annotation][in] */ - __in_opt IUnknown *pUnkOuter, - /* [in] */ DWORD dwClsCtx, - /* [annotation][unique][in] */ - __in_z_opt LPOLESTR pwszReserved, - /* [annotation][unique][in] */ - __in COSERVERINFO *pServerInfo, - /* [in] */ ULONG cmq, - /* [annotation][size_is][out][in] */ - __out_ecount(cmq) MULTI_QI *rgmqResults); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *LoadStringFromStorage )( - __RPC__in IDataInitialize * This, - /* [unique][in] */ __RPC__in_opt LPCOLESTR pwszFileName, - /* [out] */ __RPC__deref_out_opt LPOLESTR *ppwszInitializationString); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *WriteStringToStorage )( - __RPC__in IDataInitialize * This, - /* [unique][in] */ __RPC__in_opt LPCOLESTR pwszFileName, - /* [unique][in] */ __RPC__in_opt LPCOLESTR pwszInitializationString, - /* [in] */ DWORD dwCreationDisposition); - - END_INTERFACE - } IDataInitializeVtbl; - - interface IDataInitialize - { - CONST_VTBL struct IDataInitializeVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDataInitialize_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDataInitialize_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDataInitialize_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDataInitialize_GetDataSource(This,pUnkOuter,dwClsCtx,pwszInitializationString,riid,ppDataSource) \ - ( (This)->lpVtbl -> GetDataSource(This,pUnkOuter,dwClsCtx,pwszInitializationString,riid,ppDataSource) ) - -#define IDataInitialize_GetInitializationString(This,pDataSource,fIncludePassword,ppwszInitString) \ - ( (This)->lpVtbl -> GetInitializationString(This,pDataSource,fIncludePassword,ppwszInitString) ) - -#define IDataInitialize_CreateDBInstance(This,clsidProvider,pUnkOuter,dwClsCtx,pwszReserved,riid,ppDataSource) \ - ( (This)->lpVtbl -> CreateDBInstance(This,clsidProvider,pUnkOuter,dwClsCtx,pwszReserved,riid,ppDataSource) ) - -#define IDataInitialize_CreateDBInstanceEx(This,clsidProvider,pUnkOuter,dwClsCtx,pwszReserved,pServerInfo,cmq,rgmqResults) \ - ( (This)->lpVtbl -> CreateDBInstanceEx(This,clsidProvider,pUnkOuter,dwClsCtx,pwszReserved,pServerInfo,cmq,rgmqResults) ) - -#define IDataInitialize_LoadStringFromStorage(This,pwszFileName,ppwszInitializationString) \ - ( (This)->lpVtbl -> LoadStringFromStorage(This,pwszFileName,ppwszInitializationString) ) - -#define IDataInitialize_WriteStringToStorage(This,pwszFileName,pwszInitializationString,dwCreationDisposition) \ - ( (This)->lpVtbl -> WriteStringToStorage(This,pwszFileName,pwszInitializationString,dwCreationDisposition) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [call_as] */ HRESULT STDMETHODCALLTYPE IDataInitialize_RemoteCreateDBInstanceEx_Proxy( - __RPC__in IDataInitialize * This, - /* [in] */ __RPC__in REFCLSID clsidProvider, - /* [in] */ __RPC__in_opt IUnknown *pUnkOuter, - /* [in] */ DWORD dwClsCtx, - /* [unique][in] */ __RPC__in_opt LPOLESTR pwszReserved, - /* [unique][in] */ __RPC__in_opt COSERVERINFO *pServerInfo, - /* [in] */ ULONG cmq, - /* [size_is][in] */ __RPC__in_ecount_full(cmq) const IID **rgpIID, - /* [size_is][out] */ __RPC__out_ecount_full(cmq) IUnknown **rgpItf, - /* [size_is][out] */ __RPC__out_ecount_full(cmq) HRESULT *rghr); - - -void __RPC_STUB IDataInitialize_RemoteCreateDBInstanceEx_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IDataInitialize_INTERFACE_DEFINED__ */ - - - -#ifndef __MSDASC_LIBRARY_DEFINED__ -#define __MSDASC_LIBRARY_DEFINED__ - -/* library MSDASC */ -/* [helpstring][version][uuid] */ - - -EXTERN_C const IID LIBID_MSDASC; - -#ifndef __IDataSourceLocator_INTERFACE_DEFINED__ -#define __IDataSourceLocator_INTERFACE_DEFINED__ - -/* interface IDataSourceLocator */ -/* [unique][helpstring][dual][uuid][object] */ - - -EXTERN_C const IID IID_IDataSourceLocator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("2206CCB2-19C1-11D1-89E0-00C04FD7A829") - IDataSourceLocator : public IDispatch - { - public: - virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_hWnd( - /* [retval][out] */ __RPC__out COMPATIBLE_LONG *phwndParent) = 0; - - virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_hWnd( - /* [in] */ COMPATIBLE_LONG hwndParent) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE PromptNew( - /* [retval][out] */ __RPC__deref_out_opt IDispatch **ppADOConnection) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE PromptEdit( - /* [out][in] */ __RPC__deref_inout_opt IDispatch **ppADOConnection, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pbSuccess) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDataSourceLocatorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IDataSourceLocator * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IDataSourceLocator * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IDataSourceLocator * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in IDataSourceLocator * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in IDataSourceLocator * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in IDataSourceLocator * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDataSourceLocator * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_hWnd )( - __RPC__in IDataSourceLocator * This, - /* [retval][out] */ __RPC__out COMPATIBLE_LONG *phwndParent); - - /* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_hWnd )( - __RPC__in IDataSourceLocator * This, - /* [in] */ COMPATIBLE_LONG hwndParent); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *PromptNew )( - __RPC__in IDataSourceLocator * This, - /* [retval][out] */ __RPC__deref_out_opt IDispatch **ppADOConnection); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *PromptEdit )( - __RPC__in IDataSourceLocator * This, - /* [out][in] */ __RPC__deref_inout_opt IDispatch **ppADOConnection, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pbSuccess); - - END_INTERFACE - } IDataSourceLocatorVtbl; - - interface IDataSourceLocator - { - CONST_VTBL struct IDataSourceLocatorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDataSourceLocator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDataSourceLocator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDataSourceLocator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDataSourceLocator_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define IDataSourceLocator_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define IDataSourceLocator_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define IDataSourceLocator_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define IDataSourceLocator_get_hWnd(This,phwndParent) \ - ( (This)->lpVtbl -> get_hWnd(This,phwndParent) ) - -#define IDataSourceLocator_put_hWnd(This,hwndParent) \ - ( (This)->lpVtbl -> put_hWnd(This,hwndParent) ) - -#define IDataSourceLocator_PromptNew(This,ppADOConnection) \ - ( (This)->lpVtbl -> PromptNew(This,ppADOConnection) ) - -#define IDataSourceLocator_PromptEdit(This,ppADOConnection,pbSuccess) \ - ( (This)->lpVtbl -> PromptEdit(This,ppADOConnection,pbSuccess) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDataSourceLocator_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_DataLinks; - -#ifdef __cplusplus - -class DECLSPEC_UUID("2206CDB2-19C1-11D1-89E0-00C04FD7A829") -DataLinks; -#endif - -EXTERN_C const CLSID CLSID_MSDAINITIALIZE; - -#ifdef __cplusplus - -class DECLSPEC_UUID("2206CDB0-19C1-11D1-89E0-00C04FD7A829") -MSDAINITIALIZE; -#endif - -EXTERN_C const CLSID CLSID_PDPO; - -#ifdef __cplusplus - -class DECLSPEC_UUID("CCB4EC60-B9DC-11D1-AC80-00A0C9034873") -PDPO; -#endif - -EXTERN_C const CLSID CLSID_RootBinder; - -#ifdef __cplusplus - -class DECLSPEC_UUID("FF151822-B0BF-11D1-A80D-000000000000") -RootBinder; -#endif -#endif /* __MSDASC_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -/* [local][helpstring] */ HRESULT STDMETHODCALLTYPE IDataInitialize_CreateDBInstanceEx_Proxy( - IDataInitialize * This, - /* [in] */ REFCLSID clsidProvider, - /* [annotation][in] */ - __in_opt IUnknown *pUnkOuter, - /* [in] */ DWORD dwClsCtx, - /* [annotation][unique][in] */ - __in_z_opt LPOLESTR pwszReserved, - /* [annotation][unique][in] */ - __in COSERVERINFO *pServerInfo, - /* [in] */ ULONG cmq, - /* [annotation][size_is][out][in] */ - __out_ecount(cmq) MULTI_QI *rgmqResults); - - -/* [call_as] */ HRESULT STDMETHODCALLTYPE IDataInitialize_CreateDBInstanceEx_Stub( - __RPC__in IDataInitialize * This, - /* [in] */ __RPC__in REFCLSID clsidProvider, - /* [in] */ __RPC__in_opt IUnknown *pUnkOuter, - /* [in] */ DWORD dwClsCtx, - /* [unique][in] */ __RPC__in_opt LPOLESTR pwszReserved, - /* [unique][in] */ __RPC__in_opt COSERVERINFO *pServerInfo, - /* [in] */ ULONG cmq, - /* [size_is][in] */ __RPC__in_ecount_full(cmq) const IID **rgpIID, - /* [size_is][out] */ __RPC__out_ecount_full(cmq) IUnknown **rgpItf, - /* [size_is][out] */ __RPC__out_ecount_full(cmq) HRESULT *rghr); - - - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/msviddrv.h b/pub/ddk/msviddrv.h deleted file mode 100644 index bc2d19b..0000000 --- a/pub/ddk/msviddrv.h +++ /dev/null @@ -1,127 +0,0 @@ -/****************************************************************************/ -/* */ -/* MSVIDDRV.H - Include file for messages to video capture drivers */ -/* */ -/* Note: You must include WINDOWS.H before including this file. */ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/****************************************************************************/ - -#ifndef _INC_MSVIDDRV -#define _INC_MSVIDDRV 50 /* version number */ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - -/**************************************************************************** - - Digital Video Messages (DVM_) - -****************************************************************************/ - -// General messages -#define DVM_START DRV_USER -#define DVM_GETERRORTEXT (DVM_START + 0) -#define DVM_GETVIDEOAPIVER (DVM_START + 1) - -// This value increments each time the API changes -// It is passed to the driver in the DRV_OPEN message. -#define VIDEOAPIVERSION 4 - -// General messages applicable to all channel types -#define DVM_DIALOG (DVM_START + 100) -#define DVM_CONFIGURESTORAGE (DVM_START + 101) -#define DVM_GET_CHANNEL_CAPS (DVM_START + 102) -#define DVM_UPDATE (DVM_START + 103) - -// Single frame msg -#define DVM_FRAME (DVM_START + 200) - -// stream messages -#define DVM_STREAM_MSG_START (DVM_START + 300) -#define DVM_STREAM_MSG_END (DVM_START + 399) - -#define DVM_STREAM_ADDBUFFER (DVM_START + 300) -#define DVM_STREAM_FINI (DVM_START + 301) -#define DVM_STREAM_GETERROR (DVM_START + 302) -#define DVM_STREAM_GETPOSITION (DVM_START + 303) -#define DVM_STREAM_INIT (DVM_START + 304) -#define DVM_STREAM_PREPAREHEADER (DVM_START + 305) -#define DVM_STREAM_RESET (DVM_START + 306) -#define DVM_STREAM_START (DVM_START + 307) -#define DVM_STREAM_STOP (DVM_START + 308) -#define DVM_STREAM_UNPREPAREHEADER (DVM_START + 309) - -// Following added post VFW1.1a, but are now obsolete -#define DVM_STREAM_ALLOCHDRANDBUFFER (DVM_START + 310) -#define DVM_STREAM_FREEHDRANDBUFFER (DVM_START + 311) -// The 2 messages above will be removed once the ALLOCBUFFER code is ready - -// Following added for Win95 and NTPPC -#define DVM_STREAM_ALLOCBUFFER (DVM_START + 312) -#define DVM_STREAM_FREEBUFFER (DVM_START + 313) - -// NOTE that DVM_CONFIGURE numbers will start at 0x1000 (for configure API) - - -/**************************************************************************** - - Open Definitions - -****************************************************************************/ -#define OPEN_TYPE_VCAP mmioFOURCC('v', 'c', 'a', 'p') - -// The following structure is the same as IC_OPEN -// to allow compressors and capture devices to share -// the same DriverProc. - -typedef struct tag_video_open_parms { - DWORD dwSize; // sizeof(VIDEO_OPEN_PARMS) - FOURCC fccType; // 'vcap' - FOURCC fccComp; // unused - DWORD dwVersion; // version of msvideo opening you - DWORD dwFlags; // channel type - DWORD dwError; // if open fails, this is why - LPVOID pV1Reserved; // Reserved - LPVOID pV2Reserved; // Reserved - DWORD dnDevNode; // Devnode for PnP devices -} VIDEO_OPEN_PARMS, FAR * LPVIDEO_OPEN_PARMS; - -typedef struct tag_video_geterrortext_parms { - DWORD dwError; // The error number to identify -#ifdef _WIN32 - LPWSTR lpText; // Text buffer to fill -#else - LPSTR lpText; // Text buffer to fill -#endif - DWORD dwLength; // Size of text buffer in characters -} VIDEO_GETERRORTEXT_PARMS, FAR * LPVIDEO_GETERRORTEXT_PARMS; - -typedef struct tag_video_stream_init_parms { - DWORD dwMicroSecPerFrame; - DWORD dwCallback; - DWORD dwCallbackInst; - DWORD dwFlags; - HANDLE hVideo; -} VIDEO_STREAM_INIT_PARMS, FAR * LPVIDEO_STREAM_INIT_PARMS; - -typedef struct tag_video_configure_parms { - LPDWORD lpdwReturn; // Return parameter from configure MSG. - LPVOID lpData1; // Pointer to data 1. - DWORD dwSize1; // size of data buffer 1. - LPVOID lpData2; // Pointer to data 2. - DWORD dwSize2; // size of data buffer 2. -} VIDEOCONFIGPARMS, FAR * LPVIDEOCONFIGPARMS; - -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - -#endif /* _INC_MSVIDDRV */ - diff --git a/pub/ddk/namcache.h b/pub/ddk/namcache.h deleted file mode 100644 index a4040a1..0000000 --- a/pub/ddk/namcache.h +++ /dev/null @@ -1,210 +0,0 @@ -/*++ - -Copyright (c) 1996 Microsoft Corporation - -Module Name: - - namcache.h - -Abstract: - -The NAME_CACHE structure is used to remember the name strings of recent -operations performed at the server so the client can suppress redundant -requests. For example if an open has recently failed with file not found and -the client app tries it again with an upcased string then we can fail it -immediately with STATUS_OBJECT_NAME_NOT_FOUND without hitting the server. In -general the algorithm is to put a time window and SMB operation count limit on -the NAME_CACHE entry. The time window is usually 2 seconds so if NAME_CACHE -entry is more than 2 seconds old the match will fail and the request will go to -the server. If the request fails again at the server the NAME_CACHE is updated -with another 2 second window. If the SMB operation count doesn't match then one -or more SMBs have been sent to the server which could make this NAME_CACHE entry -invalid. So again this operation will get sent to the server. - -A NAME_CACHE struct has a mini-rdr portion and an RDBSS portion. The mini-rdr -portion has a context field (see below), an NTSTATUS field for the result of a -prior server operation on this name entry and a context extension pointer for -some additional mini-rdr specific storage that can be co-allocated with the -NAME_CACHE structure. See RxNameCacheInitialize(). - -The SMB operation count is an example of mini-rdr specific state which could be -saved in the context field of MRX_NAME_CACHE. When the wrapper routine -RxNameCacheCheckEntry() is called it will perform an equality check between the -context field and a supplied parameter as part of finding a match in the name -cache. When a NAME_CACHE entry is created or updated it is the mini-rdr's job -to supply an appropriate value for this field. - -The RDBSS portion of the NAME_CACHE struct contains the name (in a UNICODE -STRING) and the expiration time of the entry. The MaximumEntries field is used -to limit the number of NAME_CACHE entries created in case a poorly behaved -program were to generate a large number of opens with bad file names and so -consume large quanities of pool. - -The NAME_CACHE_CONTROL struct is used to manage a given name cache. It has -a free list, an active list and a lock used to synchronize updates. - -Currently there are name caches for: - 1. OBJECT_NAME_NOT_FOUND - 2 second window, any SMB op sent to the - server will invalidate it. This is because you could have the case - where the client app has a file (foo) open which an app on the server could - use to signal the creation of a file (bar) on the server. When the client - reads file foo and learns that file bar has been created on the - server then a hit in the name cache which matches bar can't return an - error. So this optimization only handles the case of successive file - opens on the same file which does not yet exist. Happens in WORD. - -Author: - - -Revision History: - ---*/ - -#ifndef _NAME_CACHE_DEFINED_ -#define _NAME_CACHE_DEFINED_ - - -#ifdef __cplusplus -typedef struct _MRX_NAME_CACHE_ : public MRX_NORMAL_NODE_HEADER { -#else // !__cplusplus -typedef struct _MRX_NAME_CACHE_ { - MRX_NORMAL_NODE_HEADER; -#endif // __cplusplus - - // !!!! changes above this require realignment with fcb.h - - ULONG Context; // Operation Count snapshot when entry made - PVOID ContextExtension; // Pointer to mini-rdr extension area - NTSTATUS PriorStatus; // Saved Status from last attempt at operation - -} MRX_NAME_CACHE, *PMRX_NAME_CACHE; - - -#ifdef __cplusplus -typedef struct _NAME_CACHE : public MRX_NAME_CACHE { - // I didn't find any use of the spacer in the union below, - // and the MRX_NAME_CACHE is by definition larger than - // MRX_NORMAL_NODE_HEADER, so I didn't worry about the union -#else // !__cplusplus -typedef struct _NAME_CACHE { - // - // The portion of NAME_CACHE visible to mini redirectors. - // - union { - MRX_NAME_CACHE; - struct { - MRX_NORMAL_NODE_HEADER spacer; - }; - }; -#endif // __cplusplus - // - // The portion of NAME_CACHE visible to RDBSS. - // - LARGE_INTEGER ExpireTime; // Time when entry expires - LIST_ENTRY Link; // Entry on free or active list - UNICODE_STRING Name; // Cached name - ULONG HashValue; // Hash value of name - BOOLEAN CaseInsensitive; // Controls name string compare - -} NAME_CACHE, *PNAME_CACHE; - - -typedef struct _NAME_CACHE_CONTROL_ { - - FAST_MUTEX NameCacheLock; // Lock to synchronize access to the list - LIST_ENTRY ActiveList; // List of active name cache entries - LIST_ENTRY FreeList; // Free list of NAME_CACHE structs - __volatile ULONG EntryCount; // Current number of NAME_CACHE entries allocated - ULONG MaximumEntries; // Max number of entries we will allocate - ULONG MRxNameCacheSize; // Size of Mini-rdr storage area in entry - // - // Stats - // - ULONG NumberActivates; // Number of times cache was updated - ULONG NumberChecks; // Number of times cache was checked - ULONG NumberNameHits; // Number of times a valid match was returned - ULONG NumberNetOpsSaved; // Number of times mini-rdr saved a net op - - ULONG Spare[4]; - -} NAME_CACHE_CONTROL, *PNAME_CACHE_CONTROL; - - -// -// Return status for RxNameCacheCheckEntry() -// -typedef enum _RX_NC_CHECK_STATUS { - RX_NC_SUCCESS = 0, - RX_NC_TIME_EXPIRED, - RX_NC_MRXCTX_FAIL -} RX_NC_CHECK_STATUS; - - - -// -// Mini-rdr function to count the number of times the cached state avoided -// a trip to the server. -// -#define RxNameCacheOpSaved(_NCC) (_NCC)->NumberNetOpsSaved += 1 - - - -VOID -RxNameCacheInitialize( - IN PNAME_CACHE_CONTROL NameCacheCtl, - IN ULONG MRxNameCacheSize, - IN ULONG MaximumEntries - ); - -PNAME_CACHE -RxNameCacheCreateEntry ( - IN PNAME_CACHE_CONTROL NameCacheCtl, - IN PUNICODE_STRING Name, - IN BOOLEAN CaseInsensitive - ); - -PNAME_CACHE -RxNameCacheFetchEntry ( - IN PNAME_CACHE_CONTROL NameCacheCtl, - IN PUNICODE_STRING Name - ); - -RX_NC_CHECK_STATUS -RxNameCacheCheckEntry ( - IN PNAME_CACHE NameCache, - IN ULONG MRxContext - ); - -VOID -RxNameCacheActivateEntry ( - IN PNAME_CACHE_CONTROL NameCacheCtl, - IN PNAME_CACHE NameCache, - IN ULONG LifeTime, - IN ULONG MRxContext - ); - -VOID -RxNameCacheExpireEntry ( - IN PNAME_CACHE_CONTROL NameCacheCtl, - IN PNAME_CACHE NameCache - ); - -VOID -RxNameCacheExpireEntryWithShortName ( - IN PNAME_CACHE_CONTROL NameCacheCtl, - IN PUNICODE_STRING Name - ); - -VOID -RxNameCacheFreeEntry ( - IN PNAME_CACHE_CONTROL NameCacheCtl, - IN PNAME_CACHE NameCache - ); - -VOID -RxNameCacheFinalize ( - IN PNAME_CACHE_CONTROL NameCacheCtl - ); - -#endif // _NAME_CACHE_DEFINED_ - diff --git a/pub/ddk/ndis.h b/pub/ddk/ndis.h deleted file mode 100644 index d14766f..0000000 --- a/pub/ddk/ndis.h +++ /dev/null @@ -1,12456 +0,0 @@ -/*++ BUILD Version: ???? // Increment this if a change has global effects - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ndis.h - -Abstract: - - This module defines the structures, macros, and functions available - to NDIS drivers. - -Revision History: - ---*/ - -#if !defined(_NDIS_) -#define _NDIS_ - -#if !defined(NDIS_WDM) -#define NDIS_WDM 0 -#endif - - -// -// Set BINARY_COMPATIBLE to 0 if it is not defined. Error out if user tries -// to build a Win9x binary compatible driver using this DDK. -// - -#if !defined(BINARY_COMPATIBLE) -#define BINARY_COMPATIBLE 0 -#else -#if (BINARY_COMPATIBLE != 0) -#error "can not build Win9x binary compatible drivers, please remove the definition for BINARY_COMPATIBLE or set it to 0" -#endif -#endif - - -// -// BEGIN INTERNAL DEFINITIONS -// - - -#include - -// -// END INTERNAL DEFINITIONS -// -// The following definitions may be used by NDIS drivers, except as noted. -// - -#ifndef __NET_PNP__ -#define __NET_PNP__ - -#pragma once - -// -// PnP and PM event codes that can be indicated up to transports -// and clients. -// -typedef enum _NET_PNP_EVENT_CODE -{ - NetEventSetPower, - NetEventQueryPower, - NetEventQueryRemoveDevice, - NetEventCancelRemoveDevice, - NetEventReconfigure, - NetEventBindList, - NetEventBindsComplete, - NetEventPnPCapabilities, - NetEventPause, - NetEventRestart, - NetEventPortActivation, - NetEventPortDeactivation, - NetEventIMReEnableDevice, - NetEventMaximum -} NET_PNP_EVENT_CODE, *PNET_PNP_EVENT_CODE; - -// -// Networking PnP event indication structure. -// -typedef struct _NET_PNP_EVENT -{ - // - // Event code describing action to take. - // - NET_PNP_EVENT_CODE NetEvent; - - // - // Event specific data. - // - PVOID Buffer; - - // - // Length of event specific data. - // - ULONG BufferLength; - - // - // Reserved values are for use by respective components only. - // - // Note: these reserved areas must be pointer aligned. - // - - ULONG_PTR NdisReserved[4]; - ULONG_PTR TransportReserved[4]; - ULONG_PTR TdiReserved[4]; - ULONG_PTR TdiClientReserved[4]; -} NET_PNP_EVENT, *PNET_PNP_EVENT; - -// -// The following structure defines the device power states. -// -typedef enum _NET_DEVICE_POWER_STATE -{ - NetDeviceStateUnspecified = 0, - NetDeviceStateD0, - NetDeviceStateD1, - NetDeviceStateD2, - NetDeviceStateD3, - NetDeviceStateMaximum -} NET_DEVICE_POWER_STATE, *PNET_DEVICE_POWER_STATE; - -#endif // __NET_PNP__ - -#pragma once - -// -// Indicate that we're building for NT. NDIS_NT is always used for -// miniport builds. -// - -#define NDIS_NT 1 - -#if defined(NDIS_DOS) -#undef NDIS_DOS -#endif - -// -// Define status codes and event log codes. -// - -#include -#include -#include - -#pragma warning(push) - - -#pragma warning(disable:4201) // (nonstandard extension used : nameless struct/union) -#pragma warning(disable:4214) // (extension used : bit field types other than int) - - -// -// Define a couple of extra types. -// - -#if !defined(_WINDEF_) // these are defined in windows.h too -typedef signed int INT, *PINT; -typedef unsigned int UINT, *PUINT; -#endif - -typedef UNICODE_STRING NDIS_STRING, *PNDIS_STRING; -// -// Landmarks for PFD and SDV to detect kernel mode drivers -// - -__drv_Mode_impl(NDIS_INCLUDED) - -// -// Portability extentions -// - -#define NDIS_INIT_FUNCTION(_F) alloc_text(INIT,_F) -#define NDIS_PAGABLE_FUNCTION(_F) alloc_text(PAGE,_F) -#define NDIS_PAGEABLE_FUNCTION(_F) alloc_text(PAGE,_F) - -// -// This file contains the definition of an NDIS_OID as -// well as #defines for all the current OID values. -// - -// -// Define NDIS_STATUS and NDIS_HANDLE here -// -typedef PVOID NDIS_HANDLE, *PNDIS_HANDLE; - -typedef int NDIS_STATUS, *PNDIS_STATUS; // note default size - -#if (!defined(NDIS_WRAPPER)) - - -#if defined(NTDDI_VERSION) -#if (NTDDI_VERSION > NTDDI_WIN7) -#error "unsupported NTDDI_VERSION" -#endif -#endif - - -// -// -// error out if driver has defined these values -// -#if (defined(NDIS_MINIPORT_MAJOR_VERSION) || \ - (defined(NDIS_MINIPORT_MINOR_VERSION)) || \ - (defined(NDIS_PROTOCOL_MAJOR_VERSION)) || \ - (defined(NDIS_PROTOCOL_MINOR_VERSION)) || \ - (defined(NDIS_FILTER_MAJOR_VERSION)) || \ - (defined(NDIS_FILTER_MINOR_VERSION))) -#error "Driver is re-defining NDIS reserved macros" -#endif - -#if (defined(NDIS_MINIPORT_DRIVER)) - -// -// for Miniports versions 5.0 and up, provide a consistent way to match -// Ndis version in their characteristics with their makefile defines -// -#if (defined(NDIS620_MINIPORT)) -#define NDIS_MINIPORT_MAJOR_VERSION 6 -#define NDIS_MINIPORT_MINOR_VERSION 20 -#elif (defined(NDIS61_MINIPORT)) -#define NDIS_MINIPORT_MAJOR_VERSION 6 -#define NDIS_MINIPORT_MINOR_VERSION 1 -#elif (defined(NDIS60_MINIPORT)) -#define NDIS_MINIPORT_MAJOR_VERSION 6 -#define NDIS_MINIPORT_MINOR_VERSION 0 -#elif (defined(NDIS51_MINIPORT)) -#define NDIS_MINIPORT_MAJOR_VERSION 5 -#define NDIS_MINIPORT_MINOR_VERSION 1 -#elif (defined(NDIS50_MINIPORT)) -#define NDIS_MINIPORT_MAJOR_VERSION 5 -#define NDIS_MINIPORT_MINOR_VERSION 0 -#else -#error ("Only NDIS miniport drivers with version >= 5 are supported") -#endif - - - -// -// disallow invalid major/minor combination -// -#if ((NDIS_MINIPORT_MAJOR_VERSION == 6) && \ - (NDIS_MINIPORT_MINOR_VERSION != 20) && \ - (NDIS_MINIPORT_MINOR_VERSION != 1) && \ - (NDIS_MINIPORT_MINOR_VERSION != 0)) -#error "Invalid Miniport major/minor version" -#elif ((NDIS_MINIPORT_MAJOR_VERSION == 5) && \ - (NDIS_MINIPORT_MINOR_VERSION != 1) && \ - (NDIS_MINIPORT_MINOR_VERSION != 0)) -#error "Invalid Miniport major/minor version" -#endif - - - - -// -// make sure the target platform is consistent with miniport version -// -#if (NDIS_MINIPORT_MAJOR_VERSION == 6) && \ - ((NDIS_MINIPORT_MINOR_VERSION == 20 && NTDDI_VERSION < NTDDI_WIN7) || \ - (NDIS_MINIPORT_MINOR_VERSION == 1 && NTDDI_VERSION < NTDDI_VISTA) || \ - (NDIS_MINIPORT_MINOR_VERSION == 0 && NTDDI_VERSION < NTDDI_VISTA)) -#error "Wrong NDIS or DDI version specified" -#elif ((NDIS_MINIPORT_MAJOR_VERSION == 5) && \ - (((NDIS_MINIPORT_MINOR_VERSION == 1) && (NTDDI_VERSION < NTDDI_WINXP)) || \ - ((NDIS_MINIPORT_MINOR_VERSION == 0) && (NTDDI_VERSION < NTDDI_WIN2K)))) -#error "Wrong NDIS or DDI version specified" -#endif - - -#endif // NDIS_MINIPORT_DRIVER - - - -#if (defined(NDIS30)) -#error "Only NDIS Protocol drivers versions >= 4 are supported" -#endif - -// -// for protocol versions 4.0 and up, provide a consistent way to match -// Ndis version in their characteristics with their makefile defines -// -// -// a protocol only or filter driver -// - -#if (defined(NDIS620)) -#define NDIS_PROTOCOL_MAJOR_VERSION 6 -#define NDIS_PROTOCOL_MINOR_VERSION 20 -#define NDIS_FILTER_MAJOR_VERSION 6 -#define NDIS_FILTER_MINOR_VERSION 20 -#elif (defined(NDIS61)) -#define NDIS_PROTOCOL_MAJOR_VERSION 6 -#define NDIS_PROTOCOL_MINOR_VERSION 1 -#define NDIS_FILTER_MAJOR_VERSION 6 -#define NDIS_FILTER_MINOR_VERSION 1 -#elif (defined(NDIS60)) -#define NDIS_PROTOCOL_MAJOR_VERSION 6 -#define NDIS_PROTOCOL_MINOR_VERSION 0 -#define NDIS_FILTER_MAJOR_VERSION 6 -#define NDIS_FILTER_MINOR_VERSION 0 -#elif (defined(NDIS51)) -#define NDIS_PROTOCOL_MAJOR_VERSION 5 -#define NDIS_PROTOCOL_MINOR_VERSION 1 -#elif (defined(NDIS50)) -#define NDIS_PROTOCOL_MAJOR_VERSION 5 -#define NDIS_PROTOCOL_MINOR_VERSION 0 -#elif(defined(NDIS40)) -#define NDIS_PROTOCOL_MAJOR_VERSION 4 -#define NDIS_PROTOCOL_MINOR_VERSION 0 -#endif // (defined(NDIS60)) - - -#if (!defined(NDIS_MINIPORT_DRIVER) && !defined (NDIS_PROTOCOL_MAJOR_VERSION)) -// -// if it is not a miniport and -// NDIS_PROTOCOL_MAJOR_VERSION is not defined, define it here -// -#define NDIS40 -#define NDIS_PROTOCOL_MAJOR_VERSION 4 -#define NDIS_PROTOCOL_MINOR_VERSION 0 -#endif // (!defined(NDIS_MINIPORT_DRIVER) && !defined (NDIS_PROTOCOL_MAJOR_VERSION)) - - - -#if defined (NDIS_FILTER_MAJOR_VERSION) -// -// disallow invalid major/minor combination -// -#if ((NDIS_FILTER_MAJOR_VERSION == 6) && \ - (NDIS_FILTER_MINOR_VERSION != 20) && \ - (NDIS_FILTER_MINOR_VERSION != 1) && \ - (NDIS_FILTER_MINOR_VERSION != 0)) -#error "Invalid Filter version" -#endif -#endif // defined (NDIS_FILTER_MAJOR_VERSION) - - -#if defined (NDIS_PROTOCOL_MAJOR_VERSION) -// -// disallow invalid major/minor combination -// -#if ((NDIS_PROTOCOL_MAJOR_VERSION == 6) && \ - (NDIS_PROTOCOL_MINOR_VERSION != 20) && \ - (NDIS_PROTOCOL_MINOR_VERSION != 1) && \ - (NDIS_PROTOCOL_MINOR_VERSION != 0)) -#error "Invalid Protocol version" -#elif ((NDIS_PROTOCOL_MAJOR_VERSION == 5) && \ - (NDIS_PROTOCOL_MINOR_VERSION != 1) && (NDIS_PROTOCOL_MINOR_VERSION != 0)) -#error "Invalid Protocol version" -#elif ((NDIS_PROTOCOL_MAJOR_VERSION == 4) && (NDIS_PROTOCOL_MINOR_VERSION != 0)) -#error "Invalid Protocol major/minor version" -#endif - -// -// make sure the target platform is consistent with protocol version -// but don't stop NDIS protocol drivers older than 6.0 from specifying NTDDI_VISTA -// -#if ((NDIS_PROTOCOL_MAJOR_VERSION == 6) && (NTDDI_VERSION < NTDDI_VISTA)) -#error "Wrong NDIS or DDI version specified" -#endif -#endif // defined (NDIS_PROTOCOL_MAJOR_VERSION) - - - -#endif // !NDIS_WRAPPER - -// -// identify Legacy miniport drivers -// -#if !defined(NDIS_LEGACY_MINIPORT) -#if ((defined(NDIS_MINIPORT_DRIVER) && (NDIS_MINIPORT_MAJOR_VERSION < 6)) || NDIS_WRAPPER) -#define NDIS_LEGACY_MINIPORT 1 -#else -#define NDIS_LEGACY_MINIPORT 0 -#endif // ((defined(NDIS_MINIPORT_DRIVER) && (NDIS_MINIPORT_MAJOR_VERSION < 6)) || NDIS_WRAPPER) -#endif // !defined(NDIS_LEGACY_MINIPORT) - - -// -// identify Legacy protocol drivers -// -#if !defined(NDIS_LEGACY_PROTOCOL) -#if ((defined(NDIS_PROTOCOL_MAJOR_VERSION) && (NDIS_PROTOCOL_MAJOR_VERSION < 6)) || NDIS_WRAPPER) -#define NDIS_LEGACY_PROTOCOL 1 -#else -#define NDIS_LEGACY_PROTOCOL 0 -#endif // ((defined(NDIS_PROTOCOL_MAJOR_VERSION) && (NDIS_PROTOCOL_MAJOR_VERSION < 6)) || NDIS_WRAPPER) -#endif // !defined(NDIS_LEGACY_PROTOCOL) - - -// -// use something to identify legacy (pre NDIS 6 drivers) + NDIS itself -// -#if !defined(NDIS_LEGACY_DRIVER) -#if (NDIS_LEGACY_MINIPORT || NDIS_LEGACY_PROTOCOL || NDIS_WRAPPER) -#define NDIS_LEGACY_DRIVER 1 -#else -#define NDIS_LEGACY_DRIVER 0 -#endif // either protocol is legacy or miniport is legacy or this is NDIS -#endif // !defined(NDIS_LEGACY_DRIVER) - - -// -// and something to identify Vista+ drivers + NDIS itself -// -#if !defined(NDIS_SUPPORT_NDIS6) -#if ((defined (NDIS_MINIPORT_MAJOR_VERSION) && (NDIS_MINIPORT_MAJOR_VERSION >= 6)) || \ - (defined (NDIS60)) || NDIS_WRAPPER) -#define NDIS_SUPPORT_NDIS6 1 -#else -#define NDIS_SUPPORT_NDIS6 0 -#endif -#endif // !defined(NDIS_SUPPORT_NDIS6) - - -// -// and something to identify Server 2008+ drivers + NDIS itself -// -#if !defined(NDIS_SUPPORT_NDIS61) -#if (((defined (NDIS_MINIPORT_MAJOR_VERSION) && (NDIS_MINIPORT_MAJOR_VERSION >= 6)) && \ - (defined (NDIS_MINIPORT_MINOR_VERSION) && (NDIS_MINIPORT_MINOR_VERSION >= 1))) || \ - (defined (NDIS61)) || NDIS_WRAPPER) -#define NDIS_SUPPORT_NDIS61 1 -#else -#define NDIS_SUPPORT_NDIS61 0 -#endif -#endif // !defined(NDIS_SUPPORT_NDIS61) - - -// -// and something to identify new (Win7 and up) drivers + NDIS itself -// -#if !defined(NDIS_SUPPORT_NDIS620) -#if (((defined (NDIS_MINIPORT_MAJOR_VERSION) && (NDIS_MINIPORT_MAJOR_VERSION >= 6)) && \ - (defined (NDIS_MINIPORT_MINOR_VERSION) && (NDIS_MINIPORT_MINOR_VERSION >= 20))) || \ - (defined (NDIS620)) || NDIS_WRAPPER) -#define NDIS_SUPPORT_NDIS620 1 -#else -#define NDIS_SUPPORT_NDIS620 0 -#endif -#endif // !defined(NDIS_SUPPORT_NDIS620) - -// -// Enable NDIS61 defines for NDIS 62 drivers -// -#if (NDIS_SUPPORT_NDIS620) -#undef NDIS_SUPPORT_NDIS61 -#define NDIS_SUPPORT_NDIS61 1 -#endif - -// -// Enable NDIS60 defines for NDIS 61 drivers -// -#if (NDIS_SUPPORT_NDIS61) -#undef NDIS_SUPPORT_NDIS6 -#define NDIS_SUPPORT_NDIS6 1 -#endif - -// -// Enable deprecated NDIS 6.0/1 APIs for NDIS 6.20+ drivers -// that also want to run the same binary on NDIS 6.0/1 -// In this case, such a driver would need to define both -// NDIS620_MINIPORT and NDIS60/61_MINIPORT -// Note: We cannot use NDIS_SUPPORT_NDIS6/61 in this check because -// that would be defined even for NDIS 6.20+ -// -#if defined(NDIS61_MINIPORT) || defined(NDIS60_MINIPORT) || \ - defined(NDIS61) || defined(NDIS60) || \ - defined(NDIS_WRAPPER) || defined(NDIS_LEGACY_DRIVER) -#define NDIS_SUPPORT_60_COMPATIBLE_API 1 -#else -#define NDIS_SUPPORT_60_COMPATIBLE_API 0 -#endif - -#include - -// -// Ndis defines for configuration manager data structures -// -typedef CM_MCA_POS_DATA NDIS_MCA_POS_DATA, *PNDIS_MCA_POS_DATA; -typedef CM_EISA_SLOT_INFORMATION NDIS_EISA_SLOT_INFORMATION, *PNDIS_EISA_SLOT_INFORMATION; -typedef CM_EISA_FUNCTION_INFORMATION NDIS_EISA_FUNCTION_INFORMATION, *PNDIS_EISA_FUNCTION_INFORMATION; - -// -// Define an exported function. -// -#if defined(NDIS_WRAPPER) -#define EXPORT -#else -#define EXPORT DECLSPEC_IMPORT -#endif - -#if NDIS_SUPPORT_NDIS6 -typedef struct _NDIS_GENERIC_OBJECT -{ - NDIS_OBJECT_HEADER Header; - PVOID Caller; - PVOID CallersCaller; - PDRIVER_OBJECT DriverObject; -} NDIS_GENERIC_OBJECT, *PNDIS_GENERIC_OBJECT; - -EXPORT -PNDIS_GENERIC_OBJECT -NdisAllocateGenericObject( - PDRIVER_OBJECT DriverObject OPTIONAL, - ULONG Tag, - USHORT Size - ); - -EXPORT -VOID -NdisFreeGenericObject( - IN PNDIS_GENERIC_OBJECT NdisObject - ); - -#endif // NDIS_SUPPORT_NDIS6 - - -// -// Memory manipulation functions. -// -#define NdisMoveMemory(Destination, Source, Length) RtlCopyMemory(Destination, Source, Length) -#define NdisZeroMemory(Destination, Length) RtlZeroMemory(Destination, Length) -#define NdisEqualMemory(Source1, Source2, Length) RtlEqualMemory(Source1, Source2, Length) -#define NdisFillMemory(Destination, Length, Fill) RtlFillMemory(Destination, Length, Fill) -#define NdisRetrieveUlong(Destination, Source) RtlRetrieveUlong(Destination, Source) -#define NdisStoreUlong(Destination, Value) RtlStoreUlong(Destination, Value) - -#define NDIS_STRING_CONST(x) {sizeof(L##x)-2, sizeof(L##x), L##x} - -// -// On a RISC machine, I/O mapped memory can't be accessed with -// the Rtl routines. -// -#if defined(_M_IX86) || defined(_M_AMD64) - -#define NdisMoveMappedMemory(Destination,Source,Length) RtlCopyMemory(Destination,Source,Length) -#define NdisZeroMappedMemory(Destination,Length) RtlZeroMemory(Destination,Length) - -#elif defined(_M_IA64) - -#define NdisMoveMappedMemory(Destination,Source,Length) \ -{ \ - PUCHAR _Src = (Source); \ - PUCHAR _Dest = (Destination); \ - PUCHAR _End = _Dest + (Length); \ - while (_Dest < _End) \ - { \ - *_Dest++ = *_Src++; \ - } \ -} - -#define NdisZeroMappedMemory(Destination,Length) \ -{ \ - PUCHAR _Dest = (Destination); \ - PUCHAR _End = _Dest + (Length); \ - while (_Dest < _End) \ - { \ - *_Dest++ = 0; \ - } \ -} -#endif - - -#define NdisMoveToMappedMemory(Destination,Source,Length) \ - NdisMoveMappedMemory(Destination,Source,Length) -#define NdisMoveFromMappedMemory(Destination,Source,Length) \ - NdisMoveMappedMemory(Destination,Source,Length) - - -// -// definition of the basic spin lock structure -// - -typedef struct _NDIS_SPIN_LOCK -{ - KSPIN_LOCK SpinLock; - KIRQL OldIrql; -} NDIS_SPIN_LOCK, * PNDIS_SPIN_LOCK; - - -// -// definition of the ndis event structure -// -typedef struct _NDIS_EVENT -{ - KEVENT Event; -} NDIS_EVENT, *PNDIS_EVENT; - -#pragma warning(push) -#pragma warning(disable:4115) // named type definition in parenthesis -typedef VOID (*NDIS_PROC)(struct _NDIS_WORK_ITEM *, PVOID); -#pragma warning(pop) - - -// -// Definition of an ndis work-item -// -typedef struct _NDIS_WORK_ITEM -{ - PVOID Context; - NDIS_PROC Routine; - UCHAR WrapperReserved[8*sizeof(PVOID)]; -} NDIS_WORK_ITEM, *PNDIS_WORK_ITEM; - -#define NdisInterruptLatched Latched -#define NdisInterruptLevelSensitive LevelSensitive -typedef KINTERRUPT_MODE NDIS_INTERRUPT_MODE, *PNDIS_INTERRUPT_MODE; - -// -// Configuration definitions -// - -// -// Possible data types -// - -typedef enum _NDIS_PARAMETER_TYPE -{ - NdisParameterInteger, - NdisParameterHexInteger, - NdisParameterString, - NdisParameterMultiString, - NdisParameterBinary -} NDIS_PARAMETER_TYPE, *PNDIS_PARAMETER_TYPE; - -typedef struct -{ - USHORT Length; - PVOID Buffer; -} BINARY_DATA; - -// -// To store configuration information -// -typedef struct _NDIS_CONFIGURATION_PARAMETER -{ - NDIS_PARAMETER_TYPE ParameterType; - union - { - ULONG IntegerData; - NDIS_STRING StringData; - BINARY_DATA BinaryData; - } ParameterData; -} NDIS_CONFIGURATION_PARAMETER, *PNDIS_CONFIGURATION_PARAMETER; - - -// -// Definitions for the "ProcessorType" keyword -// -typedef enum _NDIS_PROCESSOR_TYPE -{ - NdisProcessorX86, - NdisProcessorMips, - NdisProcessorAlpha, - NdisProcessorPpc, - NdisProcessorAmd64, - NdisProcessorIA64 -} NDIS_PROCESSOR_TYPE, *PNDIS_PROCESSOR_TYPE; - -// -// Definitions for the "Environment" keyword -// -typedef enum _NDIS_ENVIRONMENT_TYPE -{ - NdisEnvironmentWindows, - NdisEnvironmentWindowsNt -} NDIS_ENVIRONMENT_TYPE, *PNDIS_ENVIRONMENT_TYPE; - - -// -// Possible Hardware Architecture. Define these to -// match the HAL INTERFACE_TYPE enum. -// -typedef enum _NDIS_INTERFACE_TYPE -{ - NdisInterfaceInternal = Internal, - NdisInterfaceIsa = Isa, - NdisInterfaceEisa = Eisa, - NdisInterfaceMca = MicroChannel, - NdisInterfaceTurboChannel = TurboChannel, - NdisInterfacePci = PCIBus, - NdisInterfacePcMcia = PCMCIABus, - NdisInterfaceCBus = CBus, - NdisInterfaceMPIBus = MPIBus, - NdisInterfaceMPSABus = MPSABus, - NdisInterfaceProcessorInternal = ProcessorInternal, - NdisInterfaceInternalPowerBus = InternalPowerBus, - NdisInterfacePNPISABus = PNPISABus, - NdisInterfacePNPBus = PNPBus, - NdisInterfaceUSB, - NdisInterfaceIrda, - NdisInterface1394, - NdisMaximumInterfaceType -} NDIS_INTERFACE_TYPE, *PNDIS_INTERFACE_TYPE; - -// -// Stuff for PCI configuring -// - -typedef CM_PARTIAL_RESOURCE_LIST NDIS_RESOURCE_LIST, *PNDIS_RESOURCE_LIST; - - -// -// The structure passed up on a WAN_LINE_UP indication -// - -typedef struct _NDIS_WAN_LINE_UP -{ - IN ULONG LinkSpeed; // 100 bps units - IN ULONG MaximumTotalSize; // suggested max for send packets - IN NDIS_WAN_QUALITY Quality; - IN USHORT SendWindow; // suggested by the MAC - IN UCHAR RemoteAddress[6]; - IN OUT UCHAR LocalAddress[6]; - IN ULONG ProtocolBufferLength; // Length of protocol info buffer - IN PUCHAR ProtocolBuffer; // Information used by protocol - IN USHORT ProtocolType; // Protocol ID - IN OUT NDIS_STRING DeviceName; -} NDIS_WAN_LINE_UP, *PNDIS_WAN_LINE_UP; - - -// -// The structure passed up on a WAN_LINE_DOWN indication -// - -typedef struct _NDIS_WAN_LINE_DOWN -{ - IN UCHAR RemoteAddress[6]; - IN UCHAR LocalAddress[6]; -} NDIS_WAN_LINE_DOWN, *PNDIS_WAN_LINE_DOWN; - -// -// The structure passed up on a WAN_FRAGMENT indication -// - -typedef struct _NDIS_WAN_FRAGMENT -{ - IN UCHAR RemoteAddress[6]; - IN UCHAR LocalAddress[6]; -} NDIS_WAN_FRAGMENT, *PNDIS_WAN_FRAGMENT; - -// -// The structure passed up on a WAN_GET_STATS indication -// - -typedef struct _NDIS_WAN_GET_STATS -{ - IN UCHAR LocalAddress[6]; - OUT ULONG BytesSent; - OUT ULONG BytesRcvd; - OUT ULONG FramesSent; - OUT ULONG FramesRcvd; - OUT ULONG CRCErrors; // Serial-like info only - OUT ULONG TimeoutErrors; // Serial-like info only - OUT ULONG AlignmentErrors; // Serial-like info only - OUT ULONG SerialOverrunErrors; // Serial-like info only - OUT ULONG FramingErrors; // Serial-like info only - OUT ULONG BufferOverrunErrors; // Serial-like info only - OUT ULONG BytesTransmittedUncompressed; // Compression info only - OUT ULONG BytesReceivedUncompressed; // Compression info only - OUT ULONG BytesTransmittedCompressed; // Compression info only - OUT ULONG BytesReceivedCompressed; // Compression info only -} NDIS_WAN_GET_STATS, *PNDIS_WAN_GET_STATS; - - -// -// Ndis Buffer is actually an Mdl -// -typedef MDL NDIS_BUFFER, *PNDIS_BUFFER; - -#if NDIS_LEGACY_DRIVER -struct _NDIS_PACKET; -typedef NDIS_HANDLE PNDIS_PACKET_POOL; - -// -// -// wrapper-specific part of a packet -// -typedef struct _NDIS_PACKET_PRIVATE -{ - UINT PhysicalCount; // number of physical pages in packet. - UINT TotalLength; // Total amount of data in the packet. - PNDIS_BUFFER Head; // first buffer in the chain - PNDIS_BUFFER Tail; // last buffer in the chain - - // if Head is NULL the chain is empty; Tail doesn't have to be NULL also - - PNDIS_PACKET_POOL Pool; // so we know where to free it back to - UINT Count; - ULONG Flags; - BOOLEAN ValidCounts; - UCHAR NdisPacketFlags; // See fPACKET_xxx bits below - USHORT NdisPacketOobOffset; -} NDIS_PACKET_PRIVATE, * PNDIS_PACKET_PRIVATE; - -// -// The bits define the bits in the Flags -// -#define NDIS_FLAGS_PROTOCOL_ID_MASK 0x0000000F // The low 4 bits are defined for protocol-id - // The values are defined in ntddndis.h -#define NDIS_FLAGS_MULTICAST_PACKET 0x00000010 // don't use -#define NDIS_FLAGS_RESERVED2 0x00000020 // don't use -#define NDIS_FLAGS_RESERVED3 0x00000040 // don't use -#define NDIS_FLAGS_DONT_LOOPBACK 0x00000080 // Write only -#define NDIS_FLAGS_IS_LOOPBACK_PACKET 0x00000100 // Read only -#define NDIS_FLAGS_LOOPBACK_ONLY 0x00000200 // Write only -#define NDIS_FLAGS_RESERVED4 0x00000400 // don't use -#define NDIS_FLAGS_DOUBLE_BUFFERED 0x00000800 // used by ndis -#define NDIS_FLAGS_SENT_AT_DPC 0x00001000 // the protocol sent this packet at DPC -#define NDIS_FLAGS_USES_SG_BUFFER_LIST 0x00002000 // used by Ndis -#define NDIS_FLAGS_USES_ORIGINAL_PACKET 0x00004000 // used by Ndis -#define NDIS_FLAGS_PADDED 0x00010000 // used by NDIS -#define NDIS_FLAGS_XLATE_AT_TOP 0x00020000 // used by NDIS - -// -// Low-bits in the NdisPacketFlags are reserved by NDIS Wrapper for internal use -// -#define fPACKET_WRAPPER_RESERVED 0x3F -#define fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO 0x40 -#define fPACKET_ALLOCATED_BY_NDIS 0x80 - -#endif // NDIS_LEGACY_DRIVER - -// -// Definition for layout of the media-specific data. More than one class of media-specific -// information can be tagged onto a packet. -// -typedef enum _NDIS_CLASS_ID -{ - NdisClass802_3Priority, - NdisClassWirelessWanMbxMailbox, - NdisClassIrdaPacketInfo, - NdisClassAtmAALInfo - -} NDIS_CLASS_ID; - -typedef struct _MEDIA_SPECIFIC_INFORMATION -{ - UINT NextEntryOffset; - NDIS_CLASS_ID ClassId; - UINT Size; - UCHAR ClassInformation[1]; - -} MEDIA_SPECIFIC_INFORMATION, *PMEDIA_SPECIFIC_INFORMATION; - -#if NDIS_LEGACY_DRIVER - -typedef struct _NDIS_PACKET_OOB_DATA -{ - union - { - ULONGLONG TimeToSend; - ULONGLONG TimeSent; - }; - ULONGLONG TimeReceived; - UINT HeaderSize; - UINT SizeMediaSpecificInfo; - PVOID MediaSpecificInformation; - - NDIS_STATUS Status; -} NDIS_PACKET_OOB_DATA, *PNDIS_PACKET_OOB_DATA; - -#define NDIS_GET_PACKET_PROTOCOL_TYPE(_Packet_) ((_Packet_)->Private.Flags & NDIS_PROTOCOL_ID_MASK) - -#define NDIS_OOB_DATA_FROM_PACKET(_p) \ - (PNDIS_PACKET_OOB_DATA)((PUCHAR)(_p) + \ - (_p)->Private.NdisPacketOobOffset) -#define NDIS_GET_PACKET_HEADER_SIZE(_Packet) \ - ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \ - (_Packet)->Private.NdisPacketOobOffset))->HeaderSize -#define NDIS_GET_PACKET_STATUS(_Packet) \ - ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \ - (_Packet)->Private.NdisPacketOobOffset))->Status -#define NDIS_GET_PACKET_TIME_TO_SEND(_Packet) \ - ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \ - (_Packet)->Private.NdisPacketOobOffset))->TimeToSend -#define NDIS_GET_PACKET_TIME_SENT(_Packet) \ - ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \ - (_Packet)->Private.NdisPacketOobOffset))->TimeSent -#define NDIS_GET_PACKET_TIME_RECEIVED(_Packet) \ - ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \ - (_Packet)->Private.NdisPacketOobOffset))->TimeReceived -#define NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \ - _pMediaSpecificInfo, \ - _pSizeMediaSpecificInfo) \ -{ \ - if (!((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) ||\ - !((_Packet)->Private.NdisPacketFlags & fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO))\ - { \ - *(_pMediaSpecificInfo) = NULL; \ - *(_pSizeMediaSpecificInfo) = 0; \ - } \ - else \ - { \ - *(_pMediaSpecificInfo) =((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +\ - (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation;\ - *(_pSizeMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +\ - (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo;\ - } \ -} - -#define NDIS_SET_PACKET_HEADER_SIZE(_Packet, _HdrSize) \ - ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \ - (_Packet)->Private.NdisPacketOobOffset))->HeaderSize = (_HdrSize) -#define NDIS_SET_PACKET_STATUS(_Packet, _Status) \ - ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \ - (_Packet)->Private.NdisPacketOobOffset))->Status = (_Status) -#define NDIS_SET_PACKET_TIME_TO_SEND(_Packet, _TimeToSend) \ - ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \ - (_Packet)->Private.NdisPacketOobOffset))->TimeToSend = (_TimeToSend) -#define NDIS_SET_PACKET_TIME_SENT(_Packet, _TimeSent) \ - ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \ - (_Packet)->Private.NdisPacketOobOffset))->TimeSent = (_TimeSent) -#define NDIS_SET_PACKET_TIME_RECEIVED(_Packet, _TimeReceived) \ - ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \ - (_Packet)->Private.NdisPacketOobOffset))->TimeReceived = (_TimeReceived) -#define NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \ - _MediaSpecificInfo, \ - _SizeMediaSpecificInfo) \ -{ \ - if ((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) \ - { \ - (_Packet)->Private.NdisPacketFlags |= fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO;\ - ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \ - (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation = (_MediaSpecificInfo);\ - ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \ - (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo = (_SizeMediaSpecificInfo);\ - } \ -} - -// -// packet definition -// -typedef struct _NDIS_PACKET -{ - NDIS_PACKET_PRIVATE Private; - - union - { - struct // For Connection-less miniports - { - UCHAR MiniportReserved[2*sizeof(PVOID)]; - UCHAR WrapperReserved[2*sizeof(PVOID)]; - }; - - struct - { - // - // For de-serialized miniports. And by implication conn-oriented miniports. - // - UCHAR MiniportReservedEx[3*sizeof(PVOID)]; - UCHAR WrapperReservedEx[sizeof(PVOID)]; - }; - - struct - { - UCHAR MacReserved[4*sizeof(PVOID)]; - }; - }; - - ULONG_PTR Reserved[2]; // For compatibility with Win95 - UCHAR ProtocolReserved[1]; - -} NDIS_PACKET, *PNDIS_PACKET, **PPNDIS_PACKET; - -#endif // NDIS_LEGACY_DRIVER - -// -// NDIS per-packet information. -// -typedef enum _NDIS_PER_PACKET_INFO -{ - TcpIpChecksumPacketInfo, - IpSecPacketInfo, - TcpLargeSendPacketInfo, - ClassificationHandlePacketInfo, - NdisReserved, - ScatterGatherListPacketInfo, - Ieee8021QInfo, - OriginalPacketInfo, - PacketCancelId, - OriginalNetBufferList, - CachedNetBufferList, - ShortPacketPaddingInfo, - MaxPerPacketInfo -} NDIS_PER_PACKET_INFO, *PNDIS_PER_PACKET_INFO; - -#if NDIS_LEGACY_DRIVER -typedef struct _NDIS_PACKET_EXTENSION -{ - PVOID NdisPacketInfo[MaxPerPacketInfo]; -} NDIS_PACKET_EXTENSION, *PNDIS_PACKET_EXTENSION; - -#define NDIS_PACKET_EXTENSION_FROM_PACKET(_P) ((PNDIS_PACKET_EXTENSION)((PUCHAR)(_P) + (_P)->Private.NdisPacketOobOffset + sizeof(NDIS_PACKET_OOB_DATA))) -#define NDIS_PER_PACKET_INFO_FROM_PACKET(_P, _Id) ((PNDIS_PACKET_EXTENSION)((PUCHAR)(_P) + (_P)->Private.NdisPacketOobOffset + sizeof(NDIS_PACKET_OOB_DATA)))->NdisPacketInfo[(_Id)] -#define NDIS_GET_ORIGINAL_PACKET(_P) NDIS_PER_PACKET_INFO_FROM_PACKET(_P, OriginalPacketInfo) -#define NDIS_SET_ORIGINAL_PACKET(_P, _OP) NDIS_PER_PACKET_INFO_FROM_PACKET(_P, OriginalPacketInfo) = _OP -#define NDIS_GET_PACKET_CANCEL_ID(_P) NDIS_PER_PACKET_INFO_FROM_PACKET(_P, PacketCancelId) -#define NDIS_SET_PACKET_CANCEL_ID(_P, _cId) NDIS_PER_PACKET_INFO_FROM_PACKET(_P, PacketCancelId) = _cId - - -// -// Ndis 5.1 entry points for setting/gettign packet's CancelId and cancelling send packets -// - -/* -EXPORT -VOID -NdisSetPacketCancelId( - IN PNDIS_PACKET Packet, - IN PVOID CancelId - ); -*/ -#define NdisSetPacketCancelId(_Packet, _CancelId) NDIS_SET_PACKET_CANCEL_ID(_Packet, _CancelId) - -/* -EXPORT -PVOID -NdisGetPacketCancelId( - IN PNDIS_PACKET Packet - ); -*/ -#define NdisGetPacketCancelId(_Packet) NDIS_GET_PACKET_CANCEL_ID(_Packet) - - -typedef struct _NDIS_PACKET_STACK -{ - ULONG_PTR IMReserved[2]; - ULONG_PTR NdisReserved[4]; -} NDIS_PACKET_STACK, *PNDIS_PACKET_STACK; - - -#endif // NDIS_LEGACY_DRIVER - -// -// Per-packet information for TcpIpChecksumPacketInfo. -// - - - - - -typedef struct _NDIS_TCP_IP_CHECKSUM_PACKET_INFO -{ - union - { - struct - { - ULONG NdisPacketChecksumV4:1; - ULONG NdisPacketChecksumV6:1; - ULONG NdisPacketTcpChecksum:1; - ULONG NdisPacketUdpChecksum:1; - ULONG NdisPacketIpChecksum:1; - } Transmit; - - struct - { - ULONG NdisPacketTcpChecksumFailed:1; - ULONG NdisPacketUdpChecksumFailed:1; - ULONG NdisPacketIpChecksumFailed:1; - ULONG NdisPacketTcpChecksumSucceeded:1; - ULONG NdisPacketUdpChecksumSucceeded:1; - ULONG NdisPacketIpChecksumSucceeded:1; - ULONG NdisPacketLoopback:1; - } Receive; - - ULONG Value; - }; -} NDIS_TCP_IP_CHECKSUM_PACKET_INFO, *PNDIS_TCP_IP_CHECKSUM_PACKET_INFO; - - -// -// Per-packet information for Ieee8021QInfo. -// -typedef struct _NDIS_PACKET_8021Q_INFO -{ - union - { - struct - { - UINT32 UserPriority:3; // 802.1p priority - UINT32 CanonicalFormatId:1; // always 0 - UINT32 VlanId:12; // VLAN Identification - UINT32 Reserved:16; // set to 0 - } TagHeader; - - PVOID Value; - }; -} NDIS_PACKET_8021Q_INFO, *PNDIS_PACKET_8021Q_INFO; - - -#if NDIS_LEGACY_DRIVER -// -// Old definitions, to be obsoleted. -// -#define Ieee8021pPriority Ieee8021QInfo -typedef UINT IEEE8021PPRIORITY; - -// -// WAN Packet. This is used by WAN miniports only. This is the legacy model. -// Co-Ndis is the preferred model for WAN miniports -// -typedef struct _NDIS_WAN_PACKET -{ - LIST_ENTRY WanPacketQueue; - PUCHAR CurrentBuffer; - ULONG CurrentLength; - PUCHAR StartBuffer; - PUCHAR EndBuffer; - PVOID ProtocolReserved1; - PVOID ProtocolReserved2; - PVOID ProtocolReserved3; - PVOID ProtocolReserved4; - PVOID MacReserved1; - PVOID MacReserved2; - PVOID MacReserved3; - PVOID MacReserved4; -} NDIS_WAN_PACKET, *PNDIS_WAN_PACKET; - -// -// Routines to get/set packet flags -// - -/*++ - -UINT -NdisGetPacketFlags( - IN PNDIS_PACKET Packet - ); - ---*/ - -#define NdisGetPacketFlags(_Packet) ((_Packet)->Private.Flags) - -#define NDIS_PACKET_FIRST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Head) -#define NDIS_PACKET_LAST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Tail) -#define NDIS_PACKET_VALID_COUNTS(_Packet) ((_Packet)->Private.ValidCounts) - - -/*++ - -VOID -NdisSetPacketFlags( - IN PNDIS_PACKET Packet, - IN UINT Flags - ); - ---*/ - -#define NdisSetPacketFlags(_Packet, _Flags) (_Packet)->Private.Flags |= (_Flags) -#define NdisClearPacketFlags(_Packet, _Flags) (_Packet)->Private.Flags &= ~(_Flags) - -#endif // NDIS_LEGACY_DRIVER - -// -// Request types used by NdisRequest; constants are added for -// all entry points in the MAC, for those that want to create -// their own internal requests. -// - -#if NDIS_SUPPORT_NDIS6 -typedef enum _NDIS_REQUEST_TYPE -{ - NdisRequestQueryInformation, - NdisRequestSetInformation, - NdisRequestQueryStatistics, - NdisRequestOpen, - NdisRequestClose, - NdisRequestSend, - NdisRequestTransferData, - NdisRequestReset, - NdisRequestGeneric1, - NdisRequestGeneric2, - NdisRequestGeneric3, - NdisRequestGeneric4, - NdisRequestMethod, -} NDIS_REQUEST_TYPE, *PNDIS_REQUEST_TYPE; -#else -typedef enum _NDIS_REQUEST_TYPE -{ - NdisRequestQueryInformation, - NdisRequestSetInformation, - NdisRequestQueryStatistics, - NdisRequestOpen, - NdisRequestClose, - NdisRequestSend, - NdisRequestTransferData, - NdisRequestReset, - NdisRequestGeneric1, - NdisRequestGeneric2, - NdisRequestGeneric3, - NdisRequestGeneric4, -} NDIS_REQUEST_TYPE, *PNDIS_REQUEST_TYPE; -#endif // NDIS_SUPPORT_NDIS6 - - -#if NDIS_LEGACY_DRIVER - -// -// Structure of requests sent via NdisRequest -// - -typedef struct _NDIS_REQUEST -{ - UCHAR MacReserved[4*sizeof(PVOID)]; - NDIS_REQUEST_TYPE RequestType; - union _DATA - { - struct _QUERY_INFORMATION - { - NDIS_OID Oid; - PVOID InformationBuffer; - UINT InformationBufferLength; - UINT BytesWritten; - UINT BytesNeeded; - } QUERY_INFORMATION; - - struct _SET_INFORMATION - { - NDIS_OID Oid; - PVOID InformationBuffer; - UINT InformationBufferLength; - UINT BytesRead; - UINT BytesNeeded; - } SET_INFORMATION; - - } DATA; -#if (defined(NDIS50) || defined(NDIS51) || defined(NDIS50_MINIPORT) || defined(NDIS51_MINIPORT)) - UCHAR NdisReserved[9*sizeof(PVOID)]; - union - { - UCHAR CallMgrReserved[2*sizeof(PVOID)]; - UCHAR ProtocolReserved[2*sizeof(PVOID)]; - }; - UCHAR MiniportReserved[2*sizeof(PVOID)]; -#endif -} NDIS_REQUEST, *PNDIS_REQUEST; - -#endif - -// -// NDIS Address Family definitions. -// -typedef ULONG NDIS_AF, *PNDIS_AF; -#define CO_ADDRESS_FAMILY_Q2931 ((NDIS_AF)0x1) // ATM -#define CO_ADDRESS_FAMILY_PSCHED ((NDIS_AF)0x2) // Packet scheduler -#define CO_ADDRESS_FAMILY_L2TP ((NDIS_AF)0x3) -#define CO_ADDRESS_FAMILY_IRDA ((NDIS_AF)0x4) -#define CO_ADDRESS_FAMILY_1394 ((NDIS_AF)0x5) -#define CO_ADDRESS_FAMILY_PPP ((NDIS_AF)0x6) -#define CO_ADDRESS_FAMILY_INFINIBAND ((NDIS_AF)0x7) -#define CO_ADDRESS_FAMILY_TAPI ((NDIS_AF)0x800) -#define CO_ADDRESS_FAMILY_TAPI_PROXY ((NDIS_AF)0x801) - -// -// The following is OR'ed with the base AF to denote proxy support -// -#define CO_ADDRESS_FAMILY_PROXY 0x80000000 - - -// -// Address family structure registered/opened via -// NdisCmRegisterAddressFamily -// NdisClOpenAddressFamily -// -typedef struct -{ - NDIS_AF AddressFamily; // one of the CO_ADDRESS_FAMILY_xxx values above - ULONG MajorVersion; // the major version of call manager - ULONG MinorVersion; // the minor version of call manager -} CO_ADDRESS_FAMILY, *PCO_ADDRESS_FAMILY; - -// -// Definition for a SAP -// -typedef struct -{ - ULONG SapType; - ULONG SapLength; - UCHAR Sap[1]; -} CO_SAP, *PCO_SAP; - -// -// Definitions for physical address. -// - -typedef PHYSICAL_ADDRESS NDIS_PHYSICAL_ADDRESS, *PNDIS_PHYSICAL_ADDRESS; -typedef struct _NDIS_PHYSICAL_ADDRESS_UNIT -{ - NDIS_PHYSICAL_ADDRESS PhysicalAddress; - UINT Length; -} NDIS_PHYSICAL_ADDRESS_UNIT, *PNDIS_PHYSICAL_ADDRESS_UNIT; - - -/*++ - -ULONG -NdisGetPhysicalAddressHigh( - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress - ); - ---*/ - -#define NdisGetPhysicalAddressHigh(_PhysicalAddress) \ - ((_PhysicalAddress).HighPart) - -/*++ - -VOID -NdisSetPhysicalAddressHigh( - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, - IN ULONG Value - ); - ---*/ - -#define NdisSetPhysicalAddressHigh(_PhysicalAddress, _Value) \ - ((_PhysicalAddress).HighPart) = (_Value) - - -/*++ - -ULONG -NdisGetPhysicalAddressLow( - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress - ); - ---*/ - -#define NdisGetPhysicalAddressLow(_PhysicalAddress) \ - ((_PhysicalAddress).LowPart) - - -/*++ - -VOID -NdisSetPhysicalAddressLow( - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, - IN ULONG Value - ); - ---*/ - -#define NdisSetPhysicalAddressLow(_PhysicalAddress, _Value) \ - ((_PhysicalAddress).LowPart) = (_Value) - -// -// Macro to initialize an NDIS_PHYSICAL_ADDRESS constant -// - -#define NDIS_PHYSICAL_ADDRESS_CONST(_Low, _High) \ - { (ULONG)(_Low), (LONG)(_High) } - -// -// block used for references... -// -typedef struct _REFERENCE -{ - KSPIN_LOCK SpinLock; - USHORT ReferenceCount; - BOOLEAN Closing; -} REFERENCE, * PREFERENCE; - -// -// Types of Memory (not mutually exclusive) -// - -#define NDIS_MEMORY_CONTIGUOUS 0x00000001 -#define NDIS_MEMORY_NONCACHED 0x00000002 - -// -// Open options -// - -// -// This flag has been deprecated -// -#pragma deprecated(NDIS_OPEN_RECEIVE_NOT_REENTRANT) -#define NDIS_OPEN_RECEIVE_NOT_REENTRANT 0x00000001 - -// -// NDIS_STATUS values used in status indication -// - -#define NDIS_STATUS_ONLINE ((NDIS_STATUS)0x40010003L) -#define NDIS_STATUS_RESET_START ((NDIS_STATUS)0x40010004L) -#define NDIS_STATUS_RESET_END ((NDIS_STATUS)0x40010005L) -#define NDIS_STATUS_RING_STATUS ((NDIS_STATUS)0x40010006L) -#define NDIS_STATUS_CLOSED ((NDIS_STATUS)0x40010007L) -#define NDIS_STATUS_WAN_LINE_UP ((NDIS_STATUS)0x40010008L) -#define NDIS_STATUS_WAN_LINE_DOWN ((NDIS_STATUS)0x40010009L) -#define NDIS_STATUS_WAN_FRAGMENT ((NDIS_STATUS)0x4001000AL) -#define NDIS_STATUS_MEDIA_CONNECT ((NDIS_STATUS)0x4001000BL) -#define NDIS_STATUS_MEDIA_DISCONNECT ((NDIS_STATUS)0x4001000CL) -#define NDIS_STATUS_HARDWARE_LINE_UP ((NDIS_STATUS)0x4001000DL) -#define NDIS_STATUS_HARDWARE_LINE_DOWN ((NDIS_STATUS)0x4001000EL) -#define NDIS_STATUS_INTERFACE_UP ((NDIS_STATUS)0x4001000FL) -#define NDIS_STATUS_INTERFACE_DOWN ((NDIS_STATUS)0x40010010L) -#define NDIS_STATUS_MEDIA_BUSY ((NDIS_STATUS)0x40010011L) -#define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION ((NDIS_STATUS)0x40010012L) -#define NDIS_STATUS_WW_INDICATION NDIS_STATUS_MEDIA_SPECIFIC_INDICATION -#define NDIS_STATUS_LINK_SPEED_CHANGE ((NDIS_STATUS)0x40010013L) -#define NDIS_STATUS_WAN_GET_STATS ((NDIS_STATUS)0x40010014L) -#define NDIS_STATUS_WAN_CO_FRAGMENT ((NDIS_STATUS)0x40010015L) -#define NDIS_STATUS_WAN_CO_LINKPARAMS ((NDIS_STATUS)0x40010016L) -#define NDIS_STATUS_WAN_CO_MTULINKPARAMS ((NDIS_STATUS)0x40010025L) -// -// new status indication codes used by NDIS 6 drivers -// -#if NDIS_SUPPORT_NDIS6 -#define NDIS_STATUS_LINK_STATE ((NDIS_STATUS)0x40010017L) -#define NDIS_STATUS_NETWORK_CHANGE ((NDIS_STATUS)0x40010018L) -#define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION_EX ((NDIS_STATUS)0x40010019L) -#define NDIS_STATUS_PORT_STATE ((NDIS_STATUS)0x40010022L) -#define NDIS_STATUS_OPER_STATUS ((NDIS_STATUS)0x40010023L) -#define NDIS_STATUS_PACKET_FILTER ((NDIS_STATUS)0x40010024L) -// Note that 0x40010025L is reserved for NDIS_STATUS_WAN_CO_MTULINKPARAMS - -#define NDIS_STATUS_IP_OPER_STATUS ((NDIS_STATUS)0x40010026L) - -// -// offload specific status indication codes -// -#define NDIS_STATUS_OFFLOAD_PAUSE ((NDIS_STATUS)0x40020001L) -#define NDIS_STATUS_UPLOAD_ALL ((NDIS_STATUS)0x40020002L) -#define NDIS_STATUS_OFFLOAD_RESUME ((NDIS_STATUS)0x40020003L) -#define NDIS_STATUS_OFFLOAD_PARTIAL_SUCCESS ((NDIS_STATUS)0x40020004L) -#define NDIS_STATUS_OFFLOAD_STATE_INVALID ((NDIS_STATUS)0x40020005L) -#define NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG ((NDIS_STATUS)0x40020006L) -#define NDIS_STATUS_TASK_OFFLOAD_HARDWARE_CAPABILITIES ((NDIS_STATUS)0x40020007L) -#define NDIS_STATUS_OFFLOAD_ENCASPULATION_CHANGE ((NDIS_STATUS)0x40020008L) -#define NDIS_STATUS_TCP_CONNECTION_OFFLOAD_HARDWARE_CAPABILITIES ((NDIS_STATUS)0x4002000BL) -#if (NDIS_SUPPORT_NDIS61) -#define NDIS_STATUS_HD_SPLIT_CURRENT_CONFIG ((NDIS_STATUS)0x4002000CL) -#endif // (NDIS_SUPPORT_NDIS61) - -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_STATUS_RECEIVE_QUEUE_STATE ((NDIS_STATUS)0x4002000DL) -#endif - -#define NDIS_STATUS_OFFLOAD_IM_RESERVED1 ((NDIS_STATUS)0x40020100L) -#define NDIS_STATUS_OFFLOAD_IM_RESERVED2 ((NDIS_STATUS)0x40020101L) -#define NDIS_STATUS_OFFLOAD_IM_RESERVED3 ((NDIS_STATUS)0x40020102L) - -// -// 802.11 specific status indication codes -// -#define NDIS_STATUS_DOT11_SCAN_CONFIRM ((NDIS_STATUS)0x40030000L) -#define NDIS_STATUS_DOT11_MPDU_MAX_LENGTH_CHANGED ((NDIS_STATUS)0x40030001L) -#define NDIS_STATUS_DOT11_ASSOCIATION_START ((NDIS_STATUS)0x40030002L) -#define NDIS_STATUS_DOT11_ASSOCIATION_COMPLETION ((NDIS_STATUS)0x40030003L) -#define NDIS_STATUS_DOT11_CONNECTION_START ((NDIS_STATUS)0x40030004L) -#define NDIS_STATUS_DOT11_CONNECTION_COMPLETION ((NDIS_STATUS)0x40030005L) -#define NDIS_STATUS_DOT11_ROAMING_START ((NDIS_STATUS)0x40030006L) -#define NDIS_STATUS_DOT11_ROAMING_COMPLETION ((NDIS_STATUS)0x40030007L) -#define NDIS_STATUS_DOT11_DISASSOCIATION ((NDIS_STATUS)0x40030008L) -#define NDIS_STATUS_DOT11_TKIPMIC_FAILURE ((NDIS_STATUS)0x40030009L) -#define NDIS_STATUS_DOT11_PMKID_CANDIDATE_LIST ((NDIS_STATUS)0x4003000AL) -#define NDIS_STATUS_DOT11_PHY_STATE_CHANGED ((NDIS_STATUS)0x4003000BL) -#define NDIS_STATUS_DOT11_LINK_QUALITY ((NDIS_STATUS)0x4003000CL) -#define NDIS_STATUS_DOT11_INCOMING_ASSOC_STARTED ((NDIS_STATUS)0x4003000DL) -#define NDIS_STATUS_DOT11_INCOMING_ASSOC_REQUEST_RECEIVED ((NDIS_STATUS)0x4003000EL) -#define NDIS_STATUS_DOT11_INCOMING_ASSOC_COMPLETION ((NDIS_STATUS)0x4003000FL) -#define NDIS_STATUS_DOT11_STOP_AP ((NDIS_STATUS)0x40030010L) -#define NDIS_STATUS_DOT11_PHY_FREQUENCY_ADOPTED ((NDIS_STATUS)0x40030011L) -#define NDIS_STATUS_DOT11_CAN_SUSTAIN_AP ((NDIS_STATUS)0x40030012L) - -// -// Add WWAN specific status indication codes -// -#define NDIS_STATUS_WWAN_DEVICE_CAPS ((NDIS_STATUS)0x40041000) -#define NDIS_STATUS_WWAN_READY_INFO ((NDIS_STATUS)0x40041001) -#define NDIS_STATUS_WWAN_RADIO_STATE ((NDIS_STATUS)0x40041002) -#define NDIS_STATUS_WWAN_PIN_INFO ((NDIS_STATUS)0x40041003) -#define NDIS_STATUS_WWAN_PIN_LIST ((NDIS_STATUS)0x40041004) -#define NDIS_STATUS_WWAN_HOME_PROVIDER ((NDIS_STATUS)0x40041005) -#define NDIS_STATUS_WWAN_PREFERRED_PROVIDERS ((NDIS_STATUS)0x40041006) -#define NDIS_STATUS_WWAN_VISIBLE_PROVIDERS ((NDIS_STATUS)0x40041007) -#define NDIS_STATUS_WWAN_REGISTER_STATE ((NDIS_STATUS)0x40041008) -#define NDIS_STATUS_WWAN_PACKET_SERVICE ((NDIS_STATUS)0x40041009) -#define NDIS_STATUS_WWAN_SIGNAL_STATE ((NDIS_STATUS)0x4004100a) -#define NDIS_STATUS_WWAN_CONTEXT_STATE ((NDIS_STATUS)0x4004100b) -#define NDIS_STATUS_WWAN_PROVISIONED_CONTEXTS ((NDIS_STATUS)0x4004100c) -#define NDIS_STATUS_WWAN_SERVICE_ACTIVATION ((NDIS_STATUS)0x4004100d) -#define NDIS_STATUS_WWAN_SMS_CONFIGURATION ((NDIS_STATUS)0x4004100e) -#define NDIS_STATUS_WWAN_SMS_RECEIVE ((NDIS_STATUS)0x4004100f) -#define NDIS_STATUS_WWAN_SMS_SEND ((NDIS_STATUS)0x40041010) -#define NDIS_STATUS_WWAN_SMS_DELETE ((NDIS_STATUS)0x40041011) -#define NDIS_STATUS_WWAN_SMS_STATUS ((NDIS_STATUS)0x40041012) -#define NDIS_STATUS_WWAN_DNS_ADDRESS ((NDIS_STATUS)0x40041013) - -#define NDIS_STATUS_WWAN_VENDOR_SPECIFIC ((NDIS_STATUS)0x40043000) -// -// End of WWAN specific status indication codes -// - -// -// Add WiMAX specific status indication codes -// - - -#endif NDIS_SUPPORT_NDIS6 - -// -// Status codes for NDIS 6.20 Power Management -// -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_STATUS_PM_WOL_PATTERN_REJECTED ((NDIS_STATUS)0x40030051L) -#define NDIS_STATUS_PM_OFFLOAD_REJECTED ((NDIS_STATUS)0x40030052L) -#define NDIS_STATUS_PM_CAPABILITIES_CHANGE ((NDIS_STATUS)0x40030053L) -#endif - - -// -// status codes returned by drivers -// -#define NDIS_STATUS_SUCCESS ((NDIS_STATUS)STATUS_SUCCESS) -#define NDIS_STATUS_PENDING ((NDIS_STATUS)STATUS_PENDING) -#define NDIS_STATUS_NOT_RECOGNIZED ((NDIS_STATUS)0x00010001L) -#define NDIS_STATUS_NOT_COPIED ((NDIS_STATUS)0x00010002L) -#define NDIS_STATUS_NOT_ACCEPTED ((NDIS_STATUS)0x00010003L) -#define NDIS_STATUS_CALL_ACTIVE ((NDIS_STATUS)0x00010007L) -#define NDIS_STATUS_INDICATION_REQUIRED ((NDIS_STATUS)STATUS_NDIS_INDICATION_REQUIRED) -#define NDIS_STATUS_NOT_RESETTABLE ((NDIS_STATUS)0x80010001L) -#define NDIS_STATUS_SOFT_ERRORS ((NDIS_STATUS)0x80010003L) -#define NDIS_STATUS_HARD_ERRORS ((NDIS_STATUS)0x80010004L) -#define NDIS_STATUS_BUFFER_OVERFLOW ((NDIS_STATUS)STATUS_BUFFER_OVERFLOW) -#define NDIS_STATUS_FAILURE ((NDIS_STATUS)STATUS_UNSUCCESSFUL) -#define NDIS_STATUS_RESOURCES ((NDIS_STATUS)STATUS_INSUFFICIENT_RESOURCES) -#define NDIS_STATUS_CLOSING ((NDIS_STATUS)0xC0010002L) -#define NDIS_STATUS_BAD_VERSION ((NDIS_STATUS)0xC0010004L) -#define NDIS_STATUS_BAD_CHARACTERISTICS ((NDIS_STATUS)0xC0010005L) -#define NDIS_STATUS_ADAPTER_NOT_FOUND ((NDIS_STATUS)0xC0010006L) -#define NDIS_STATUS_OPEN_FAILED ((NDIS_STATUS)0xC0010007L) -#define NDIS_STATUS_DEVICE_FAILED ((NDIS_STATUS)0xC0010008L) -#define NDIS_STATUS_MULTICAST_FULL ((NDIS_STATUS)0xC0010009L) -#define NDIS_STATUS_MULTICAST_EXISTS ((NDIS_STATUS)0xC001000AL) -#define NDIS_STATUS_MULTICAST_NOT_FOUND ((NDIS_STATUS)0xC001000BL) -#define NDIS_STATUS_REQUEST_ABORTED ((NDIS_STATUS)0xC001000CL) -#define NDIS_STATUS_RESET_IN_PROGRESS ((NDIS_STATUS)0xC001000DL) -#define NDIS_STATUS_CLOSING_INDICATING ((NDIS_STATUS)0xC001000EL) -#define NDIS_STATUS_NOT_SUPPORTED ((NDIS_STATUS)STATUS_NOT_SUPPORTED) -#define NDIS_STATUS_INVALID_PACKET ((NDIS_STATUS)0xC001000FL) -#define NDIS_STATUS_OPEN_LIST_FULL ((NDIS_STATUS)0xC0010010L) -#define NDIS_STATUS_ADAPTER_NOT_READY ((NDIS_STATUS)0xC0010011L) -#define NDIS_STATUS_ADAPTER_NOT_OPEN ((NDIS_STATUS)0xC0010012L) -#define NDIS_STATUS_NOT_INDICATING ((NDIS_STATUS)0xC0010013L) -#define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L) -#define NDIS_STATUS_INVALID_DATA ((NDIS_STATUS)0xC0010015L) -#define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L) -#define NDIS_STATUS_INVALID_OID ((NDIS_STATUS)0xC0010017L) -#define NDIS_STATUS_ADAPTER_REMOVED ((NDIS_STATUS)0xC0010018L) -#define NDIS_STATUS_UNSUPPORTED_MEDIA ((NDIS_STATUS)0xC0010019L) -#define NDIS_STATUS_GROUP_ADDRESS_IN_USE ((NDIS_STATUS)0xC001001AL) -#define NDIS_STATUS_FILE_NOT_FOUND ((NDIS_STATUS)0xC001001BL) -#define NDIS_STATUS_ERROR_READING_FILE ((NDIS_STATUS)0xC001001CL) -#define NDIS_STATUS_ALREADY_MAPPED ((NDIS_STATUS)0xC001001DL) -#define NDIS_STATUS_RESOURCE_CONFLICT ((NDIS_STATUS)0xC001001EL) -#define NDIS_STATUS_NO_CABLE ((NDIS_STATUS)0xC001001FL) -#define NDIS_STATUS_INVALID_DEVICE_REQUEST ((NDIS_STATUS)STATUS_INVALID_DEVICE_REQUEST) -#define NDIS_STATUS_NETWORK_UNREACHABLE ((NDIS_STATUS)STATUS_NETWORK_UNREACHABLE) - -// -// CO-NDIS specific -// -#define NDIS_STATUS_INVALID_SAP ((NDIS_STATUS)0xC0010020L) -#define NDIS_STATUS_SAP_IN_USE ((NDIS_STATUS)0xC0010021L) -#define NDIS_STATUS_INVALID_ADDRESS ((NDIS_STATUS)0xC0010022L) -#define NDIS_STATUS_VC_NOT_ACTIVATED ((NDIS_STATUS)0xC0010023L) -#define NDIS_STATUS_DEST_OUT_OF_ORDER ((NDIS_STATUS)0xC0010024L) // cause 27 -#define NDIS_STATUS_VC_NOT_AVAILABLE ((NDIS_STATUS)0xC0010025L) // cause 35,45 -#define NDIS_STATUS_CELLRATE_NOT_AVAILABLE ((NDIS_STATUS)0xC0010026L) // cause 37 -#define NDIS_STATUS_INCOMPATABLE_QOS ((NDIS_STATUS)0xC0010027L) // cause 49 -#define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED ((NDIS_STATUS)0xC0010028L) // cause 93 -#define NDIS_STATUS_NO_ROUTE_TO_DESTINATION ((NDIS_STATUS)0xC0010029L) // cause 3 - -// -// 802.5 specific -// -#define NDIS_STATUS_TOKEN_RING_OPEN_ERROR ((NDIS_STATUS)0xC0011000L) - - -// -// new status codes used in NDIS 6 -// -#if NDIS_SUPPORT_NDIS6 -#define NDIS_STATUS_SEND_ABORTED ((NDIS_STATUS)STATUS_NDIS_REQUEST_ABORTED) -#define NDIS_STATUS_PAUSED ((NDIS_STATUS)STATUS_NDIS_PAUSED) -#define NDIS_STATUS_INTERFACE_NOT_FOUND ((NDIS_STATUS)STATUS_NDIS_INTERFACE_NOT_FOUND) -#define NDIS_STATUS_INVALID_PARAMETER ((NDIS_STATUS)STATUS_INVALID_PARAMETER) -#define NDIS_STATUS_UNSUPPORTED_REVISION ((NDIS_STATUS)STATUS_NDIS_UNSUPPORTED_REVISION) -#define NDIS_STATUS_INVALID_PORT ((NDIS_STATUS)STATUS_NDIS_INVALID_PORT) -#define NDIS_STATUS_INVALID_PORT_STATE ((NDIS_STATUS)STATUS_NDIS_INVALID_PORT_STATE) -#define NDIS_STATUS_INVALID_STATE ((NDIS_STATUS)STATUS_INVALID_DEVICE_STATE) -#define NDIS_STATUS_MEDIA_DISCONNECTED ((NDIS_STATUS)STATUS_NDIS_MEDIA_DISCONNECTED) -#define NDIS_STATUS_LOW_POWER_STATE ((NDIS_STATUS)STATUS_NDIS_LOW_POWER_STATE) - -#define NDIS_STATUS_DOT11_AUTO_CONFIG_ENABLED ((NDIS_STATUS)STATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED) -#define NDIS_STATUS_DOT11_MEDIA_IN_USE ((NDIS_STATUS)STATUS_NDIS_DOT11_MEDIA_IN_USE) -#define NDIS_STATUS_DOT11_POWER_STATE_INVALID ((NDIS_STATUS)STATUS_NDIS_DOT11_POWER_STATE_INVALID) - -// -// new status codes used in NDIS 6.20 -// -#if NDIS_SUPPORT_NDIS620 -#define NDIS_STATUS_PM_WOL_PATTERN_LIST_FULL ((NDIS_STATUS)STATUS_NDIS_PM_WOL_PATTERN_LIST_FULL) -#define NDIS_STATUS_PM_PROTOCOL_OFFLOAD_LIST_FULL ((NDIS_STATUS)STATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL) -#endif - -// -// status codes for offload operations -// -#define NDIS_STATUS_UPLOAD_IN_PROGRESS ((NDIS_STATUS)0xC0231001L) -#define NDIS_STATUS_REQUEST_UPLOAD ((NDIS_STATUS)0xC0231002L) -#define NDIS_STATUS_UPLOAD_REQUESTED ((NDIS_STATUS)0xC0231003L) -#define NDIS_STATUS_OFFLOAD_TCP_ENTRIES ((NDIS_STATUS)0xC0231004L) -#define NDIS_STATUS_OFFLOAD_PATH_ENTRIES ((NDIS_STATUS)0xC0231005L) -#define NDIS_STATUS_OFFLOAD_NEIGHBOR_ENTRIES ((NDIS_STATUS)0xC0231006L) -#define NDIS_STATUS_OFFLOAD_IP_ADDRESS_ENTRIES ((NDIS_STATUS)0xC0231007L) -#define NDIS_STATUS_OFFLOAD_HW_ADDRESS_ENTRIES ((NDIS_STATUS)0xC0231008L) -#define NDIS_STATUS_OFFLOAD_VLAN_ENTRIES ((NDIS_STATUS)0xC0231009L) -#define NDIS_STATUS_OFFLOAD_TCP_XMIT_BUFFER ((NDIS_STATUS)0xC023100AL) -#define NDIS_STATUS_OFFLOAD_TCP_RCV_BUFFER ((NDIS_STATUS)0xC023100BL) -#define NDIS_STATUS_OFFLOAD_TCP_RCV_WINDOW ((NDIS_STATUS)0xC023100CL) -#define NDIS_STATUS_OFFLOAD_VLAN_MISMATCH ((NDIS_STATUS)0xC023100DL) -#define NDIS_STATUS_OFFLOAD_DATA_NOT_ACCEPTED ((NDIS_STATUS)0xC023100EL) -#define NDIS_STATUS_OFFLOAD_POLICY ((NDIS_STATUS)0xC023100FL) -#define NDIS_STATUS_OFFLOAD_DATA_PARTIALLY_ACCEPTED ((NDIS_STATUS)0xC0231010L) -#define NDIS_STATUS_OFFLOAD_REQUEST_RESET ((NDIS_STATUS)0xC0231011L) -#endif // NDIS_SUPPORT_NDIS6 - -// -// Status codes for NDIS 6.20 capable Chimney offload miniports. -// -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_STATUS_OFFLOAD_CONNECTION_REJECTED ((NDIS_STATUS)STATUS_NDIS_OFFLOAD_CONNECTION_REJECTED) -#endif - -// -// used in error logging -// - -#define NDIS_ERROR_CODE ULONG - -#define NDIS_ERROR_CODE_RESOURCE_CONFLICT EVENT_NDIS_RESOURCE_CONFLICT -#define NDIS_ERROR_CODE_OUT_OF_RESOURCES EVENT_NDIS_OUT_OF_RESOURCE -#define NDIS_ERROR_CODE_HARDWARE_FAILURE EVENT_NDIS_HARDWARE_FAILURE -#define NDIS_ERROR_CODE_ADAPTER_NOT_FOUND EVENT_NDIS_ADAPTER_NOT_FOUND -#define NDIS_ERROR_CODE_INTERRUPT_CONNECT EVENT_NDIS_INTERRUPT_CONNECT -#define NDIS_ERROR_CODE_DRIVER_FAILURE EVENT_NDIS_DRIVER_FAILURE -#define NDIS_ERROR_CODE_BAD_VERSION EVENT_NDIS_BAD_VERSION -#define NDIS_ERROR_CODE_TIMEOUT EVENT_NDIS_TIMEOUT -#define NDIS_ERROR_CODE_NETWORK_ADDRESS EVENT_NDIS_NETWORK_ADDRESS -#define NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION EVENT_NDIS_UNSUPPORTED_CONFIGURATION -#define NDIS_ERROR_CODE_INVALID_VALUE_FROM_ADAPTER EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER -#define NDIS_ERROR_CODE_MISSING_CONFIGURATION_PARAMETER EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER -#define NDIS_ERROR_CODE_BAD_IO_BASE_ADDRESS EVENT_NDIS_BAD_IO_BASE_ADDRESS -#define NDIS_ERROR_CODE_RECEIVE_SPACE_SMALL EVENT_NDIS_RECEIVE_SPACE_SMALL -#define NDIS_ERROR_CODE_ADAPTER_DISABLED EVENT_NDIS_ADAPTER_DISABLED - - -#define NdisAllocateSpinLock(_SpinLock) KeInitializeSpinLock(&(_SpinLock)->SpinLock) - -#define NdisFreeSpinLock(_SpinLock) - -#define NdisAcquireSpinLock(_SpinLock) KeAcquireSpinLock(&(_SpinLock)->SpinLock, &(_SpinLock)->OldIrql) - -#define NdisReleaseSpinLock(_SpinLock) KeReleaseSpinLock(&(_SpinLock)->SpinLock,(_SpinLock)->OldIrql) - -#define NdisDprAcquireSpinLock(_SpinLock) \ -{ \ - KeAcquireSpinLockAtDpcLevel(&(_SpinLock)->SpinLock); \ -} - -#define NdisDprReleaseSpinLock(_SpinLock) KeReleaseSpinLockFromDpcLevel(&(_SpinLock)->SpinLock) - -#define NdisGetCurrentSystemTime(_pSystemTime) \ - { \ - KeQuerySystemTime(_pSystemTime); \ - } - -// -// Interlocked support functions -// - -#define NdisInterlockedIncrement(Addend) InterlockedIncrement(Addend) - -#define NdisInterlockedDecrement(Addend) InterlockedDecrement(Addend) - -#define NdisInterlockedAddUlong(_Addend, _Increment, _SpinLock) \ - ExInterlockedAddUlong(_Addend, _Increment, &(_SpinLock)->SpinLock) - -#define NdisInterlockedInsertHeadList(_ListHead, _ListEntry, _SpinLock) \ - ExInterlockedInsertHeadList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock) - -#define NdisInterlockedInsertTailList(_ListHead, _ListEntry, _SpinLock) \ - ExInterlockedInsertTailList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock) - -#define NdisInterlockedRemoveHeadList(_ListHead, _SpinLock) \ - ExInterlockedRemoveHeadList(_ListHead, &(_SpinLock)->SpinLock) - -#define NdisInterlockedPushEntryList(ListHead, ListEntry, Lock) \ - ExInterlockedPushEntryList(ListHead, ListEntry, &(Lock)->SpinLock) - -#define NdisInterlockedPopEntryList(ListHead, Lock) \ - ExInterlockedPopEntryList(ListHead, &(Lock)->SpinLock) - - - -#if NDIS_SUPPORT_60_COMPATIBLE_API - -typedef union _NDIS_RW_LOCK_REFCOUNT -{ - ULONG RefCount; - UCHAR cacheLine[16]; // This is smaller than a cacheline on most CPUs now -} NDIS_RW_LOCK_REFCOUNT; - -typedef struct _NDIS_RW_LOCK -{ - union - { - struct - { - KSPIN_LOCK SpinLock; - PVOID Context; - }; - UCHAR Reserved[16]; - }; - - union - { - NDIS_RW_LOCK_REFCOUNT RefCount[MAXIMUM_PROCESSORS]; - ULONG RefCountEx[sizeof(NDIS_RW_LOCK_REFCOUNT)/sizeof(ULONG) - * MAXIMUM_PROCESSORS]; - struct - { - KSPIN_LOCK RefCountLock; - volatile ULONG SharedRefCount; - volatile BOOLEAN WriterWaiting; - }; - }; -} NDIS_RW_LOCK, *PNDIS_RW_LOCK; - -typedef struct _LOCK_STATE -{ - USHORT LockState; - KIRQL OldIrql; -} LOCK_STATE, *PLOCK_STATE; - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisInitializeReadWriteLock( - __out PNDIS_RW_LOCK Lock - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_setsIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisAcquireReadWriteLock( - __inout __drv_acquiresResource(NdisReadWriteLock) PNDIS_RW_LOCK Lock, - __in BOOLEAN fWrite,// TRUE -> Write, FALSE -> Read - __out __drv_savesIRQL - __drv_deref(__drv_acquiresExclusiveResource(NdisReadWriteLockState)) - PLOCK_STATE LockState - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisReleaseReadWriteLock( - __inout __drv_releasesResource(NdisReadWriteLock) PNDIS_RW_LOCK Lock, - __in __drv_restoresIRQL __drv_deref( - __drv_releasesExclusiveResource(NdisReadWriteLockState)) - PLOCK_STATE LockState - ); - -#if NDIS_SUPPORT_NDIS6 - -EXPORT -VOID -NdisDprAcquireReadWriteLock( - IN PNDIS_RW_LOCK Lock, - IN BOOLEAN fWrite, // TRUE -> Write, FALSE -> Read - IN PLOCK_STATE LockState - ); - -EXPORT -VOID -NdisDprReleaseReadWriteLock( - IN PNDIS_RW_LOCK Lock, - IN PLOCK_STATE LockState - ); - -#endif -#endif - -#if NDIS_SUPPORT_NDIS620 - -struct _NDIS_RW_LOCK_EX; -typedef struct _NDIS_RW_LOCK_EX NDIS_RW_LOCK_EX; -typedef struct _NDIS_RW_LOCK_EX* PNDIS_RW_LOCK_EX; - -typedef struct _LOCK_STATE_EX -{ - KIRQL OldIrql; - UCHAR LockState; - UCHAR Flags; -} LOCK_STATE_EX, *PLOCK_STATE_EX; - -#define NDIS_RWL_AT_DISPATCH_LEVEL 1 - -EXPORT -PNDIS_RW_LOCK_EX -NdisAllocateRWLock( - NDIS_HANDLE NdisHandle - ); - -EXPORT -VOID -NdisFreeRWLock( - __in PNDIS_RW_LOCK_EX Lock - ); - -EXPORT -VOID -NdisAcquireRWLockRead( - __in PNDIS_RW_LOCK_EX Lock, - __out PLOCK_STATE_EX LockState, - __in UCHAR Flags - ); - -EXPORT -VOID -NdisAcquireRWLockWrite( - __in PNDIS_RW_LOCK_EX Lock, - __out PLOCK_STATE_EX LockState, - __in UCHAR Flags - ); - -EXPORT -VOID -NdisReleaseRWLock( - __in PNDIS_RW_LOCK_EX Lock, - __in PLOCK_STATE_EX LockState - ); - -#endif - -#define NdisInterlockedAddLargeStatistic(_Addend, _Increment) \ - ExInterlockedAddLargeStatistic((PLARGE_INTEGER)_Addend, _Increment) - -// -// S-List support -// - -#define NdisInterlockedPushEntrySList(SListHead, SListEntry, Lock) \ - ExInterlockedPushEntrySList(SListHead, SListEntry, &(Lock)->SpinLock) - -#define NdisInterlockedPopEntrySList(SListHead, Lock) \ - ExInterlockedPopEntrySList(SListHead, &(Lock)->SpinLock) - -#define NdisInterlockedFlushSList(SListHead) ExInterlockedFlushSList(SListHead) - -#define NdisInitializeSListHead(SListHead) ExInitializeSListHead(SListHead) - -#define NdisQueryDepthSList(SListHead) ExQueryDepthSList(SListHead) - -EXPORT -VOID -NdisGetCurrentProcessorCpuUsage( - OUT PULONG pCpuUsage - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisGetCurrentProcessorCounts( - __out PULONG pIdleCount, - __out PULONG pKernelAndUser, - __out PULONG pIndex - ); - - -#if NDIS_LEGACY_DRIVER - -/* -NdisGetSystemUpTime is deprecated, use NdisGetSystemUpTimeEx instead. -*/ -DECLSPEC_DEPRECATED_DDK -EXPORT -VOID -NdisGetSystemUpTime( - OUT PULONG pSystemUpTime - ); - -#endif // NDIS_LEGACY_DRIVER - -// -// List manipulation -// - -/*++ - -VOID -NdisInitializeListHead( - IN PLIST_ENTRY ListHead - ); - ---*/ -#define NdisInitializeListHead(_ListHead) InitializeListHead(_ListHead) - -// -// Configuration Requests -// - -#if NDIS_LEGACY_DRIVER - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisOpenConfiguration( - OUT __checkReturn PNDIS_STATUS Status, - OUT PNDIS_HANDLE ConfigurationHandle, - IN NDIS_HANDLE WrapperConfigurationContext - ); - -#endif // NDIS_LEGACY_DRIVER - - -__drv_maxIRQL(APC_LEVEL) -EXPORT -VOID -NdisOpenConfigurationKeyByName( - __out __checkReturn PNDIS_STATUS Status, - __in NDIS_HANDLE ConfigurationHandle, - __in PNDIS_STRING SubKeyName, - __out PNDIS_HANDLE SubKeyHandle - ); - - -__drv_maxIRQL(APC_LEVEL) -EXPORT -VOID -NdisOpenConfigurationKeyByIndex( - __out __checkReturn PNDIS_STATUS Status, - __in NDIS_HANDLE ConfigurationHandle, - __in ULONG Index, - __out PNDIS_STRING KeyName, - __out PNDIS_HANDLE KeyHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisReadConfiguration( - __out __checkReturn PNDIS_STATUS Status, - __deref_out PNDIS_CONFIGURATION_PARAMETER *ParameterValue, - __in NDIS_HANDLE ConfigurationHandle, - __in PNDIS_STRING Keyword, - __in NDIS_PARAMETER_TYPE ParameterType - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisWriteConfiguration( - __out __checkReturn PNDIS_STATUS Status, - __in NDIS_HANDLE ConfigurationHandle, - __in PNDIS_STRING Keyword, - __in PNDIS_CONFIGURATION_PARAMETER ParameterValue - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisCloseConfiguration( - __in __drv_freesMem(mem) NDIS_HANDLE ConfigurationHandle - ); - - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisReadNetworkAddress( - __out __checkReturn PNDIS_STATUS Status, - __deref_out_bcount(*NetworkAddressLength) PVOID * NetworkAddress, - __out PUINT NetworkAddressLength, - __in NDIS_HANDLE ConfigurationHandle - ); - - -#if NDIS_LEGACY_MINIPORT - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -ULONG -NdisReadPciSlotInformation( - __in NDIS_HANDLE NdisAdapterHandle, - __in ULONG SlotNumber, - __in ULONG Offset, - __out_bcount(Length) - PVOID Buffer, - __in ULONG Length - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -ULONG -NdisWritePciSlotInformation( - __in NDIS_HANDLE NdisAdapterHandle, - __in ULONG SlotNumber, - __in ULONG Offset, - __in_bcount(Length) - PVOID Buffer, - __in ULONG Length - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -ULONG -NdisReadPcmciaAttributeMemory( - __in NDIS_HANDLE NdisAdapterHandle, - __in ULONG Offset, - __out_bcount(Length) - PVOID Buffer, - __in ULONG Length - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -ULONG -NdisWritePcmciaAttributeMemory( - __in NDIS_HANDLE NdisAdapterHandle, - __in ULONG Offset, - __in_bcount(Length) - PVOID Buffer, - __in ULONG Length - ); - -#endif // NDIS_LEGACY_MINIPORT - - -#if NDIS_LEGACY_DRIVER -// -// Buffer Pool -// - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisAllocateBufferPool( - __out PNDIS_STATUS Status, - __out PNDIS_HANDLE PoolHandle, - __in UINT NumberOfDescriptors - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreeBufferPool( - __in NDIS_HANDLE PoolHandle - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisAllocateBuffer( - __out PNDIS_STATUS Status, - __out PNDIS_BUFFER * Buffer, - __in_opt NDIS_HANDLE PoolHandle, - __in_bcount(Length) - PVOID VirtualAddress, - __in UINT Length - ); - -#define NdisFreeBuffer(Buffer) IoFreeMdl(Buffer) -#endif - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCopyBuffer( - __out PNDIS_STATUS Status, - __out PNDIS_BUFFER * Buffer, - __in NDIS_HANDLE PoolHandle, - __in PVOID MemoryDescriptor, - __in UINT Offset, - __in UINT Length - ); - - -// -// VOID -// NdisCopyLookaheadData( -// IN PVOID Destination, -// IN PVOID Source, -// IN ULONG Length, -// IN ULONG ReceiveFlags -// ); -// - -#if defined(_M_IX86) || defined(_M_AMD64) -#define NdisCopyLookaheadData(_Destination, _Source, _Length, _MacOptions) \ - RtlCopyMemory(_Destination, _Source, _Length) -#else -#define NdisCopyLookaheadData(_Destination, _Source, _Length, _MacOptions) \ - { \ - if ((_MacOptions) & NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA) \ - { \ - RtlCopyMemory(_Destination, _Source, _Length); \ - } \ - else \ - { \ - PUCHAR _Src = (PUCHAR)(_Source); \ - PUCHAR _Dest = (PUCHAR)(_Destination); \ - PUCHAR _End = _Dest + (_Length); \ - while (_Dest < _End) \ - { \ - *_Dest++ = *_Src++; \ - } \ - } \ - } -#endif - -#if NDIS_LEGACY_DRIVER -// -// Packet Pool -// -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisAllocatePacketPool( - __out PNDIS_STATUS Status, - __out PNDIS_HANDLE PoolHandle, - __in UINT NumberOfDescriptors, - __in UINT ProtocolReservedLength - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisAllocatePacketPoolEx( - __out PNDIS_STATUS Status, - __out PNDIS_HANDLE PoolHandle, - __in UINT NumberOfDescriptors, - __in UINT NumberOfOverflowDescriptors, - __in UINT ProtocolReservedLength - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisSetPacketPoolProtocolId( - __in NDIS_HANDLE PacketPoolHandle, - __in UINT ProtocolId - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -UINT -NdisPacketPoolUsage( - __in NDIS_HANDLE PoolHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -UINT -NdisPacketSize( - __in UINT ProtocolReservedSize - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_HANDLE -NdisGetPoolFromPacket( - __in PNDIS_PACKET Packet - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -PNDIS_PACKET_STACK -NdisIMGetCurrentPacketStack( - __in PNDIS_PACKET Packet, - __out BOOLEAN * StacksRemaining - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreePacketPool( - __in NDIS_HANDLE PoolHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreePacket( - __in PNDIS_PACKET Packet - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisDprFreePacket( - __in PNDIS_PACKET Packet - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisDprFreePacketNonInterlocked( - __in PNDIS_PACKET Packet - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisAllocatePacket( - __out PNDIS_STATUS Status, - __out PNDIS_PACKET * Packet, - __in NDIS_HANDLE PoolHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisDprAllocatePacket( - __out PNDIS_STATUS Status, - __out PNDIS_PACKET* Packet, - __in NDIS_HANDLE PoolHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisDprAllocatePacketNonInterlocked( - __out PNDIS_STATUS Status, - __out PNDIS_PACKET * Packet, - __in NDIS_HANDLE PoolHandle - ); - -// VOID -// NdisReinitializePacket( -// IN OUT PNDIS_PACKET Packet -// ); -#define NdisReinitializePacket(Packet) \ -{ \ - (Packet)->Private.Head = (PNDIS_BUFFER)NULL; \ - (Packet)->Private.ValidCounts = FALSE; \ -} - -#endif // NDIS_LEGACY_DRIVER - -#define NdisFreeBuffer(Buffer) IoFreeMdl(Buffer) - -#if NDIS_LEGACY_DRIVER -#define NdisQueryBuffer(_Buffer, _VirtualAddress, _Length) \ -{ \ - if (ARGUMENT_PRESENT(_VirtualAddress)) \ - { \ - *(PVOID *)(_VirtualAddress) = MmGetSystemAddressForMdl(_Buffer); \ - } \ - *(_Length) = MmGetMdlByteCount(_Buffer); \ -} -#endif // NDIS_LEGACY_DRIVER - -#define NdisQueryBufferSafe(_Buffer, _VirtualAddress, _Length, _Priority) \ -{ \ - if (ARGUMENT_PRESENT(_VirtualAddress)) \ - { \ - *(PVOID *)(_VirtualAddress) = MmGetSystemAddressForMdlSafe(_Buffer, _Priority); \ - } \ - *(_Length) = MmGetMdlByteCount(_Buffer); \ -} - -#define NdisQueryBufferOffset(_Buffer, _Offset, _Length) \ -{ \ - *(_Offset) = MmGetMdlByteOffset(_Buffer); \ - *(_Length) = MmGetMdlByteCount(_Buffer); \ -} - - -#if NDIS_LEGACY_DRIVER - -#define NdisGetFirstBufferFromPacket(_Packet, \ - _FirstBuffer, \ - _FirstBufferVA, \ - _FirstBufferLength, \ - _TotalBufferLength) \ - { \ - PNDIS_BUFFER _pBuf; \ - \ - _pBuf = (_Packet)->Private.Head; \ - *(_FirstBuffer) = _pBuf; \ - if (_pBuf) \ - { \ - *(_FirstBufferVA) = MmGetSystemAddressForMdl(_pBuf); \ - *(_FirstBufferLength) = \ - *(_TotalBufferLength) = MmGetMdlByteCount(_pBuf); \ - for (_pBuf = _pBuf->Next; \ - _pBuf != NULL; \ - _pBuf = _pBuf->Next) \ - { \ - *(_TotalBufferLength) += MmGetMdlByteCount(_pBuf); \ - } \ - } \ - else \ - { \ - *(_FirstBufferVA) = 0; \ - *(_FirstBufferLength) = 0; \ - *(_TotalBufferLength) = 0; \ - } \ - } - -#define NdisGetFirstBufferFromPacketSafe(_Packet, \ - _FirstBuffer, \ - _FirstBufferVA, \ - _FirstBufferLength, \ - _TotalBufferLength, \ - _Priority) \ - { \ - PNDIS_BUFFER _pBuf; \ - \ - _pBuf = (_Packet)->Private.Head; \ - *(_FirstBuffer) = _pBuf; \ - if (_pBuf) \ - { \ - *(_FirstBufferVA) = MmGetSystemAddressForMdlSafe(_pBuf, _Priority); \ - *(_FirstBufferLength) = *(_TotalBufferLength) = MmGetMdlByteCount(_pBuf); \ - for (_pBuf = _pBuf->Next; \ - _pBuf != NULL; \ - _pBuf = _pBuf->Next) \ - { \ - *(_TotalBufferLength) += MmGetMdlByteCount(_pBuf); \ - } \ - } \ - else \ - { \ - *(_FirstBufferVA) = 0; \ - *(_FirstBufferLength) = 0; \ - *(_TotalBufferLength) = 0; \ - } \ - } - -#endif // NDIS_LEGACY_DRIVER - -#define NDIS_BUFFER_TO_SPAN_PAGES(_Buffer) \ - (MmGetMdlByteCount(_Buffer)==0 ? \ - 1 : \ - (ADDRESS_AND_SIZE_TO_SPAN_PAGES( \ - MmGetMdlVirtualAddress(_Buffer), \ - MmGetMdlByteCount(_Buffer)))) - -#define NdisGetBufferPhysicalArraySize(Buffer, ArraySize) \ - (*(ArraySize) = NDIS_BUFFER_TO_SPAN_PAGES(Buffer)) - - -/*++ - -NDIS_BUFFER_LINKAGE( - IN PNDIS_BUFFER Buffer - ); - ---*/ - -#define NDIS_BUFFER_LINKAGE(Buffer) ((Buffer)->Next) - - -#if NDIS_LEGACY_DRIVER - -/*++ - -VOID -NdisRecalculatePacketCounts( - IN OUT PNDIS_PACKET Packet - ); - ---*/ - -#define NdisRecalculatePacketCounts(Packet) \ -{ \ - { \ - PNDIS_BUFFER TmpBuffer = (Packet)->Private.Head; \ - if (TmpBuffer) \ - { \ - while (TmpBuffer->Next) \ - { \ - TmpBuffer = TmpBuffer->Next; \ - } \ - (Packet)->Private.Tail = TmpBuffer; \ - } \ - (Packet)->Private.ValidCounts = FALSE; \ - } \ -} - - -/*++ - -VOID -NdisChainBufferAtFront( - IN OUT PNDIS_PACKET Packet, - IN OUT PNDIS_BUFFER Buffer - ); - ---*/ - -#define NdisChainBufferAtFront(Packet, Buffer) \ -{ \ - PNDIS_BUFFER TmpBuffer = (Buffer); \ - \ - for (;;) \ - { \ - if (TmpBuffer->Next == (PNDIS_BUFFER)NULL) \ - break; \ - TmpBuffer = TmpBuffer->Next; \ - } \ - if ((Packet)->Private.Head == NULL) \ - { \ - (Packet)->Private.Tail = TmpBuffer; \ - } \ - TmpBuffer->Next = (Packet)->Private.Head; \ - (Packet)->Private.Head = (Buffer); \ - (Packet)->Private.ValidCounts = FALSE; \ -} - -/*++ - -VOID -NdisChainBufferAtBack( - IN OUT PNDIS_PACKET Packet, - IN OUT PNDIS_BUFFER Buffer - ); - ---*/ - -#define NdisChainBufferAtBack(Packet, Buffer) \ -{ \ - PNDIS_BUFFER TmpBuffer = (Buffer); \ - \ - for (;;) \ - { \ - if (TmpBuffer->Next == NULL) \ - break; \ - TmpBuffer = TmpBuffer->Next; \ - } \ - if ((Packet)->Private.Head != NULL) \ - { \ - (Packet)->Private.Tail->Next = (Buffer); \ - } \ - else \ - { \ - (Packet)->Private.Head = (Buffer); \ - } \ - (Packet)->Private.Tail = TmpBuffer; \ - (Packet)->Private.ValidCounts = FALSE; \ -} - -EXPORT -VOID -NdisUnchainBufferAtFront( - IN OUT PNDIS_PACKET Packet, - OUT PNDIS_BUFFER * Buffer - ); - -EXPORT -VOID -NdisUnchainBufferAtBack( - IN OUT PNDIS_PACKET Packet, - OUT PNDIS_BUFFER * Buffer - ); - - -/*++ - -VOID -NdisQueryPacket( - IN PNDIS_PACKET _Packet, - OUT PUINT _PhysicalBufferCount OPTIONAL, - OUT PUINT _BufferCount OPTIONAL, - OUT PNDIS_BUFFER * _FirstBuffer OPTIONAL, - OUT PUINT _TotalPacketLength OPTIONAL - ); - ---*/ - -#pragma warning(push) -#pragma warning(disable:4127) -__inline -VOID -NdisQueryPacket( - IN PNDIS_PACKET _Packet, - OUT PUINT _PhysicalBufferCount OPTIONAL, - OUT PUINT _BufferCount OPTIONAL, - OUT PNDIS_BUFFER * _FirstBuffer OPTIONAL, - OUT PUINT _TotalPacketLength OPTIONAL - ) -{ - if ((_FirstBuffer) != NULL) - { - PNDIS_BUFFER * __FirstBuffer = (_FirstBuffer); - *(__FirstBuffer) = (_Packet)->Private.Head; - } - if ((_TotalPacketLength) || (_BufferCount) || (_PhysicalBufferCount)) - { - if (!(_Packet)->Private.ValidCounts) - { - PNDIS_BUFFER TmpBuffer = (_Packet)->Private.Head; - UINT PTotalLength = 0, PPhysicalCount = 0, PAddedCount = 0; - UINT PacketLength, Offset; - - while (TmpBuffer != (PNDIS_BUFFER)NULL) - { - NdisQueryBufferOffset(TmpBuffer, &Offset, &PacketLength); - PTotalLength += PacketLength; - PPhysicalCount += (UINT)NDIS_BUFFER_TO_SPAN_PAGES(TmpBuffer); - ++PAddedCount; - TmpBuffer = TmpBuffer->Next; - } - (_Packet)->Private.Count = PAddedCount; - (_Packet)->Private.TotalLength = PTotalLength; - (_Packet)->Private.PhysicalCount = PPhysicalCount; - (_Packet)->Private.ValidCounts = TRUE; - } - - if (_PhysicalBufferCount) - { - PUINT __PhysicalBufferCount = (_PhysicalBufferCount); - *(__PhysicalBufferCount) = (_Packet)->Private.PhysicalCount; - } - if (_BufferCount) - { - PUINT __BufferCount = (_BufferCount); - *(__BufferCount) = (_Packet)->Private.Count; - } - if (_TotalPacketLength) - { - PUINT __TotalPacketLength = (_TotalPacketLength); - *(__TotalPacketLength) = (_Packet)->Private.TotalLength; - } - } -} -#pragma warning(pop) - -/*++ - -VOID -NdisQueryPacketLength( - IN PNDIS_PACKET _Packet, - OUT PUINT _TotalPacketLength OPTIONAL - ); - ---*/ - -#define NdisQueryPacketLength(_Packet, \ - _TotalPacketLength) \ -{ \ - if (!(_Packet)->Private.ValidCounts) \ - { \ - NdisQueryPacket(_Packet, NULL, NULL, NULL, _TotalPacketLength); \ - } \ - else *(_TotalPacketLength) = (_Packet)->Private.TotalLength; \ -} - -#endif // NDIS_LEGACY_DRIVER - - -/*++ - -VOID -NdisGetNextBuffer( - IN PNDIS_BUFFER CurrentBuffer, - OUT PNDIS_BUFFER * NextBuffer - ); - ---*/ - -#define NdisGetNextBuffer(CurrentBuffer, NextBuffer) \ -{ \ - *(NextBuffer) = (CurrentBuffer)->Next; \ -} - - -#define NdisAdjustBufferLength(Buffer, Length) (((Buffer)->ByteCount) = (Length)) - - -#if NDIS_SUPPORT_NDIS6 -/* -VOID -NdisAdjustMdlLength( - IN PMDL Mdl, - IN UINT Length - ); - -*/ -#define NdisAdjustMdlLength(_Mdl, _Length) (((_Mdl)->ByteCount) = (_Length)) -#endif // NDIS_SUPPORT_NDIS6 - -#if NDIS_LEGACY_DRIVER - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCopyFromPacketToPacket( - __in PNDIS_PACKET Destination, - __in UINT DestinationOffset, - __in UINT BytesToCopy, - __in PNDIS_PACKET Source, - __in UINT SourceOffset, - __out PUINT BytesCopied - ); - -EXPORT -VOID -NdisCopyFromPacketToPacketSafe( - IN PNDIS_PACKET Destination, - IN UINT DestinationOffset, - IN UINT BytesToCopy, - IN PNDIS_PACKET Source, - IN UINT SourceOffset, - OUT PUINT BytesCopied, - IN MM_PAGE_PRIORITY Priority - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_preferredFunction("NdisAllocateMemoryWithTag", "Obsolete") -DECLSPEC_DEPRECATED_DDK -EXPORT -NDIS_STATUS -NdisAllocateMemory( - __deref_out_bcount_opt(Length) __drv_allocatesMem(Mem) - PVOID * VirtualAddress, - __in UINT Length, - __in UINT MemoryFlags, - __in NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress - ); - -#endif // NDIS_LEGACY_DRIVER - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisAllocateMemoryWithTag( - __deref_out_bcount_opt(Length) __drv_allocatesMem(Mem) - PVOID * VirtualAddress, - __in UINT Length, - __in ULONG Tag - ); - -__drv_when(MemoryFlags==0, - __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(MemoryFlags==NDIS_MEMORY_NONCACHED, - __drv_maxIRQL(APC_LEVEL)) -__drv_when(MemoryFlags==NDIS_MEMORY_CONTIGUOUS, - __drv_requiresIRQL(PASSIVE_LEVEL)) -EXPORT -VOID -NdisFreeMemory( - __in_bcount(Length) __drv_freesMem(Mem) - PVOID VirtualAddress, - __in UINT Length, - __in __drv_in(__drv_valueIs(==0; - ==NDIS_MEMORY_NONCACHED; - ==NDIS_MEMORY_CONTIGUOUS)) - UINT MemoryFlags - ); - -EXPORT -VOID -NdisFreeMemoryWithTag( - IN PVOID VirtualAddress, - IN ULONG Tag - ); - -/*++ -VOID -NdisStallExecution( - IN UINT MicrosecondsToStall - ) ---*/ - -#define NdisStallExecution(MicroSecondsToStall) KeStallExecutionProcessor(MicroSecondsToStall) - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisInitializeEvent( - __out PNDIS_EVENT Event -); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisSetEvent( - __in PNDIS_EVENT Event -); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisResetEvent( - __in PNDIS_EVENT Event -); - -__drv_when(MsToWait !=0, __checkReturn) -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -BOOLEAN -NdisWaitEvent( - __in PNDIS_EVENT Event, - __in UINT MsToWait -); - - -#if NDIS_LEGACY_DRIVER -/*++ -VOID -NdisInitializeWorkItem( - IN PNDIS_WORK_ITEM WorkItem, - IN NDIS_PROC Routine, - IN PVOID Context - ); ---*/ - -#define NdisInitializeWorkItem(_WI_, _R_, _C_) \ - { \ - (_WI_)->Context = _C_; \ - (_WI_)->Routine = _R_; \ - } - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisScheduleWorkItem( - __in PNDIS_WORK_ITEM WorkItem - ); - -#endif // NDIS_LEGACY_DRIVER - -// -// Simple I/O support -// - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisOpenFile( - __out PNDIS_STATUS Status, - __out PNDIS_HANDLE FileHandle, - __out PUINT FileLength, - __in PNDIS_STRING FileName, - __in NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisCloseFile( - __in NDIS_HANDLE FileHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMapFile( - __out PNDIS_STATUS Status, - __out PVOID * MappedBuffer, - __in NDIS_HANDLE FileHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisUnmapFile( - __in NDIS_HANDLE FileHandle - ); - - -// -// Portability extensions -// - -/*++ -VOID -NdisFlushBuffer( - IN PNDIS_BUFFER Buffer, - IN BOOLEAN WriteToDevice - ) ---*/ - -#define NdisFlushBuffer(Buffer,WriteToDevice) \ - KeFlushIoBuffers((Buffer),!(WriteToDevice), TRUE) - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -ULONG -NdisGetSharedDataAlignment( - VOID - ); - - -// -// Raw Routines -// - -// -// Write Port Raw -// - -/*++ -VOID -NdisRawWritePortUchar( - IN ULONG_PTR Port, - IN UCHAR Data - ) ---*/ -#define NdisRawWritePortUchar(Port,Data) \ - WRITE_PORT_UCHAR((PUCHAR)(Port),(UCHAR)(Data)) - -/*++ -VOID -NdisRawWritePortUshort( - IN ULONG_PTR Port, - IN USHORT Data - ) ---*/ -#define NdisRawWritePortUshort(Port,Data) \ - WRITE_PORT_USHORT((PUSHORT)(Port),(USHORT)(Data)) - -/*++ -VOID -NdisRawWritePortUlong( - IN ULONG_PTR Port, - IN ULONG Data - ) ---*/ -#define NdisRawWritePortUlong(Port,Data) \ - WRITE_PORT_ULONG((PULONG)(Port),(ULONG)(Data)) - - -// -// Raw Write Port Buffers -// - -/*++ -VOID -NdisRawWritePortBufferUchar( - IN ULONG_PTR Port, - IN PUCHAR Buffer, - IN ULONG Length - ) ---*/ -#define NdisRawWritePortBufferUchar(Port,Buffer,Length) \ - WRITE_PORT_BUFFER_UCHAR((PUCHAR)(Port),(PUCHAR)(Buffer),(Length)) - -/*++ -VOID -NdisRawWritePortBufferUshort( - IN ULONG_PTR Port, - IN PUSHORT Buffer, - IN ULONG Length - ) ---*/ -#if defined(_M_IX86) || defined(_M_AMD64) -#define NdisRawWritePortBufferUshort(Port,Buffer,Length) \ - WRITE_PORT_BUFFER_USHORT((PUSHORT)(Port),(PUSHORT)(Buffer),(Length)) -#else -#define NdisRawWritePortBufferUshort(Port,Buffer,Length) \ -{ \ - ULONG_PTR _Port = (ULONG_PTR)(Port); \ - PUSHORT _Current = (Buffer); \ - PUSHORT _End = _Current + (Length); \ - for ( ; _Current < _End; ++_Current) \ - { \ - WRITE_PORT_USHORT((PUSHORT)_Port,*(UNALIGNED USHORT *)_Current);\ - } \ -} -#endif - - -/*++ -VOID -NdisRawWritePortBufferUlong( - IN ULONG_PTR Port, - IN PULONG Buffer, - IN ULONG Length - ) ---*/ -#if defined(_M_IX86) || defined(_M_AMD64) -#define NdisRawWritePortBufferUlong(Port,Buffer,Length) \ - WRITE_PORT_BUFFER_ULONG((PULONG)(Port),(PULONG)(Buffer),(Length)) -#else -#define NdisRawWritePortBufferUlong(Port,Buffer,Length) \ -{ \ - ULONG_PTR _Port = (ULONG_PTR)(Port); \ - PULONG _Current = (Buffer); \ - PULONG _End = _Current + (Length); \ - for ( ; _Current < _End; ++_Current) \ - { \ - WRITE_PORT_ULONG((PULONG)_Port,*(UNALIGNED ULONG *)_Current); \ - } \ -} -#endif - - -// -// Raw Read Ports -// - -/*++ -VOID -NdisRawReadPortUchar( - IN ULONG_PTR Port, - OUT PUCHAR Data - ) ---*/ -#define NdisRawReadPortUchar(Port, Data) \ - *(Data) = READ_PORT_UCHAR((PUCHAR)(Port)) - -/*++ -VOID -NdisRawReadPortUshort( - IN ULONG_PTR Port, - OUT PUSHORT Data - ) ---*/ -#define NdisRawReadPortUshort(Port,Data) \ - *(Data) = READ_PORT_USHORT((PUSHORT)(Port)) - -/*++ -VOID -NdisRawReadPortUlong( - IN ULONG_PTR Port, - OUT PULONG Data - ) ---*/ -#define NdisRawReadPortUlong(Port,Data) \ - *(Data) = READ_PORT_ULONG((PULONG)(Port)) - - -// -// Raw Read Buffer Ports -// - -/*++ -VOID -NdisRawReadPortBufferUchar( - IN ULONG_PTR Port, - OUT PUCHAR Buffer, - IN ULONG Length - ) ---*/ -#define NdisRawReadPortBufferUchar(Port,Buffer,Length) \ - READ_PORT_BUFFER_UCHAR((PUCHAR)(Port),(PUCHAR)(Buffer),(Length)) - - -/*++ -VOID -NdisRawReadPortBufferUshort( - IN ULONG_PTR Port, - OUT PUSHORT Buffer, - IN ULONG Length - ) ---*/ -#if defined(_M_IX86) || defined(_M_AMD64) -#define NdisRawReadPortBufferUshort(Port,Buffer,Length) \ - READ_PORT_BUFFER_USHORT((PUSHORT)(Port),(PUSHORT)(Buffer),(Length)) -#else -#define NdisRawReadPortBufferUshort(Port,Buffer,Length) \ -{ \ - ULONG_PTR _Port = (ULONG_PTR)(Port); \ - PUSHORT _Current = (Buffer); \ - PUSHORT _End = _Current + (Length); \ - for ( ; _Current < _End; ++_Current) \ - { \ - *(UNALIGNED USHORT *)_Current = READ_PORT_USHORT((PUSHORT)_Port); \ - } \ -} -#endif - - -/*++ -VOID -NdisRawReadPortBufferUlong( - IN ULONG_PTR Port, - OUT PULONG Buffer, - IN ULONG Length - ) ---*/ -#if defined(_M_IX86) || defined(_M_AMD64) -#define NdisRawReadPortBufferUlong(Port,Buffer,Length) \ - READ_PORT_BUFFER_ULONG((PULONG)(Port),(PULONG)(Buffer),(Length)) -#else -#define NdisRawReadPortBufferUlong(Port,Buffer,Length) \ -{ \ - ULONG_PTR _Port = (ULONG_PTR)(Port); \ - PULONG _Current = (Buffer); \ - PULONG _End = _Current + (Length); \ - for ( ; _Current < _End; ++_Current) \ - { \ - *(UNALIGNED ULONG *)_Current = READ_PORT_ULONG((PULONG)_Port); \ - } \ -} -#endif - - -// -// Write Registers -// - -/*++ -VOID -NdisWriteRegisterUchar( - IN PUCHAR Register, - IN UCHAR Data - ) ---*/ - -#if defined(_M_IX86) || defined(_M_AMD64) -#define NdisWriteRegisterUchar(Register,Data) \ - WRITE_REGISTER_UCHAR((Register),(Data)) -#else -#define NdisWriteRegisterUchar(Register,Data) \ - { \ - WRITE_REGISTER_UCHAR((Register),(Data)); \ - READ_REGISTER_UCHAR(Register); \ - } -#endif - -/*++ -VOID -NdisWriteRegisterUshort( - IN PUCHAR Register, - IN USHORT Data - ) ---*/ - -#if defined(_M_IX86) || defined(_M_AMD64) -#define NdisWriteRegisterUshort(Register,Data) \ - WRITE_REGISTER_USHORT((Register),(Data)) -#else -#define NdisWriteRegisterUshort(Register,Data) \ - { \ - WRITE_REGISTER_USHORT((Register),(Data)); \ - READ_REGISTER_USHORT(Register); \ - } -#endif - -/*++ -VOID -NdisWriteRegisterUlong( - IN PUCHAR Register, - IN ULONG Data - ) ---*/ - -#if defined(_M_IX86) || defined(_M_AMD64) -#define NdisWriteRegisterUlong(Register,Data) WRITE_REGISTER_ULONG((Register),(Data)) -#else -#define NdisWriteRegisterUlong(Register,Data) \ - { \ - WRITE_REGISTER_ULONG((Register),(Data)); \ - READ_REGISTER_ULONG(Register); \ - } -#endif - -/*++ -VOID -NdisReadRegisterUchar( - IN PUCHAR Register, - OUT PUCHAR Data - ) ---*/ -#if defined(_M_IX86) -#define NdisReadRegisterUchar(Register,Data) \ - _ReadWriteBarrier(); \ - *(Data) = *((volatile UCHAR * const)(Register)); -#else -#define NdisReadRegisterUchar(Register,Data) *(Data) = READ_REGISTER_UCHAR((PUCHAR)(Register)) -#endif - -/*++ -VOID -NdisReadRegisterUshort( - IN PUSHORT Register, - OUT PUSHORT Data - ) ---*/ -#if defined(_M_IX86) -#define NdisReadRegisterUshort(Register,Data) \ - _ReadWriteBarrier(); \ - *(Data) = *((volatile USHORT * const)(Register)) -#else -#define NdisReadRegisterUshort(Register,Data) *(Data) = READ_REGISTER_USHORT((PUSHORT)(Register)) -#endif - -/*++ -VOID -NdisReadRegisterUlong( - IN PULONG Register, - OUT PULONG Data - ) ---*/ -#if defined(_M_IX86) -#define NdisReadRegisterUlong(Register,Data) \ - _ReadWriteBarrier(); \ - *(Data) = *((volatile ULONG * const)(Register)) -#else -#define NdisReadRegisterUlong(Register,Data) *(Data) = READ_REGISTER_ULONG((PULONG)(Register)) -#endif - -#define NdisEqualString(_String1, _String2, _CaseInsensitive) \ - RtlEqualUnicodeString(_String1, _String2, _CaseInsensitive) - -#define NdisEqualUnicodeString(_String1, _String2, _CaseInsensitive) \ - RtlEqualUnicodeString(_String1, _String2, _CaseInsensitive) - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID __cdecl -NdisWriteErrorLogEntry( - __in NDIS_HANDLE NdisAdapterHandle, - __in NDIS_ERROR_CODE ErrorCode, - __in ULONG NumberOfErrorValues, - ... - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisInitializeString( - __out PNDIS_STRING Destination, - __in PUCHAR Source - ); - -#define NdisFreeString(String) NdisFreeMemory((String).Buffer, (String).MaximumLength, 0) - -#define NdisPrintString(String) DbgPrint("%ls",(String).Buffer) - - -/*++ - -VOID -NdisCreateLookaheadBufferFromSharedMemory( - IN PVOID pSharedMemory, - IN UINT LookaheadLength, - OUT PVOID * pLookaheadBuffer - ); - ---*/ - -#define NdisCreateLookaheadBufferFromSharedMemory(_S, _L, _B) ((*(_B)) = (_S)) - -/*++ - -VOID -NdisDestroyLookaheadBufferFromSharedMemory( - IN PVOID pLookaheadBuffer - ); - ---*/ - -#define NdisDestroyLookaheadBufferFromSharedMemory(_B) - - -// -// The following declarations are shared between ndismac.h and ndismini.h. They -// are meant to be for internal use only. They should not be used directly by -// miniport drivers. -// - -// -// declare these first since they point to each other -// - -typedef struct _NDIS_WRAPPER_HANDLE NDIS_WRAPPER_HANDLE, *PNDIS_WRAPPER_HANDLE; -typedef struct _NDIS_PROTOCOL_BLOCK NDIS_PROTOCOL_BLOCK, *PNDIS_PROTOCOL_BLOCK; -typedef struct _NDIS_OPEN_BLOCK NDIS_OPEN_BLOCK, *PNDIS_OPEN_BLOCK; -typedef struct _NDIS_M_DRIVER_BLOCK NDIS_M_DRIVER_BLOCK, *PNDIS_M_DRIVER_BLOCK; -typedef struct _NDIS_MINIPORT_BLOCK NDIS_MINIPORT_BLOCK,*PNDIS_MINIPORT_BLOCK; -typedef struct _CO_CALL_PARAMETERS CO_CALL_PARAMETERS, *PCO_CALL_PARAMETERS; -typedef struct _CO_MEDIA_PARAMETERS CO_MEDIA_PARAMETERS, *PCO_MEDIA_PARAMETERS; -typedef struct _NDIS_CALL_MANAGER_CHARACTERISTICS *PNDIS_CALL_MANAGER_CHARACTERISTICS; -typedef struct _NDIS_OFFLOAD NDIS_OFFLOAD, *PNDIS_OFFLOAD; -typedef struct _NDIS_AF_LIST NDIS_AF_LIST, *PNDIS_AF_LIST; -typedef struct _X_FILTER ETH_FILTER, *PETH_FILTER; -typedef struct _X_FILTER TR_FILTER, *PTR_FILTER; -typedef struct _X_FILTER NULL_FILTER, *PNULL_FILTER; - -#if NDIS_SUPPORT_NDIS6 - -typedef USHORT NET_FRAME_TYPE, *PNET_FRAME_TYPE; - -#endif NDIS_SUPPORT_NDIS6 - - - -// -// Timers. -// - -typedef -VOID -(NDIS_TIMER_FUNCTION) ( - __in PVOID SystemSpecific1, - __in PVOID FunctionContext, - __in PVOID SystemSpecific2, - __in PVOID SystemSpecific3 - ); -typedef NDIS_TIMER_FUNCTION (*PNDIS_TIMER_FUNCTION); - -typedef struct _NDIS_TIMER -{ - KTIMER Timer; - KDPC Dpc; -} NDIS_TIMER, *PNDIS_TIMER; - - -#if NDIS_SUPPORT_NDIS6 -__drv_preferredFunction(NdisAllocateTimerObject, "Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisAllocateTimerObject instead.") -#endif NDIS_SUPPORT_NDIS6 -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisInitializeTimer( - __inout PNDIS_TIMER Timer, - __in PNDIS_TIMER_FUNCTION TimerFunction, - __in_opt __drv_isObjectPointer - PVOID FunctionContext - ); - -#if NDIS_SUPPORT_NDIS6 -__drv_preferredFunction(NdisCancelTimerObject, "Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisCancelTimerObject instead.") -#endif NDIS_SUPPORT_NDIS6 -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -NdisCancelTimer( - __in PNDIS_TIMER Timer, - __out __checkReturn - PBOOLEAN TimerCancelled - ); - -#if NDIS_SUPPORT_NDIS6 -__drv_preferredFunction(NdisSetTimerObject, "Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisSetTimerObject instead.") -#endif NDIS_SUPPORT_NDIS6 -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisSetTimer( - __in PNDIS_TIMER Timer, - __in UINT MillisecondsToDelay - ); - -#if NDIS_SUPPORT_NDIS6 -__drv_preferredFunction(NdisSetTimerObject, "Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisSetTimerObject instead.") -#endif NDIS_SUPPORT_NDIS6 -EXPORT -VOID -NdisSetPeriodicTimer( - __in PNDIS_TIMER NdisTimer, - __in UINT MillisecondsPeriod - ); - -#if NDIS_SUPPORT_NDIS6 -__drv_preferredFunction(NdisSetTimerObject, "Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisSetTimerObject instead.") -#endif NDIS_SUPPORT_NDIS6 - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisSetTimerEx( - __in PNDIS_TIMER NdisTimer, - __in UINT MillisecondsToDelay, - __in __drv_isObjectPointer - PVOID FunctionContext - ); - - -#if NDIS_SUPPORT_60_COMPATIBLE_API -// -// System processor count -// - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -CCHAR -NdisSystemProcessorCount( - VOID - ); - -#endif - - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -PVOID -NdisGetRoutineAddress( - __in PNDIS_STRING NdisRoutineName - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -UINT -NdisGetVersion( - VOID - ); - - -// -// Ansi/Unicode support routines -// - - -#define NdisInitAnsiString(_as, s) RtlInitString(_as, s) -#define NdisInitUnicodeString(_us, s) RtlInitUnicodeString(_us, s) -#define NdisAnsiStringToUnicodeString(_us, _as) RtlAnsiStringToUnicodeString(_us, _as, FALSE) -#define NdisUnicodeStringToAnsiString(_as, _us) RtlUnicodeStringToAnsiString(_as, _us, FALSE) -#define NdisUpcaseUnicodeString(_d, _s) RtlUpcaseUnicodeString(_d, _s, FALSE) - - -// -// Non-paged lookaside list support routines -// - -#define NdisInitializeNPagedLookasideList(_L, _AR, _FR, _Fl, _S, _T, _D) \ - ExInitializeNPagedLookasideList(_L, _AR, _FR, _Fl, _S, _T, _D) - -#define NdisDeleteNPagedLookasideList(_L) ExDeleteNPagedLookasideList(_L) -#define NdisAllocateFromNPagedLookasideList(_L) ExAllocateFromNPagedLookasideList(_L) -#define NdisFreeToNPagedLookasideList(_L, _E) ExFreeToNPagedLookasideList(_L, _E) - -#if NDIS_LEGACY_DRIVER -/* -NdisSetPacketStatus is deprecated. use NDIS_SET_PACKET_STATUS macro -*/ -__drv_maxIRQL(DISPATCH_LEVEL) -DECLSPEC_DEPRECATED_DDK -EXPORT -VOID -NdisSetPacketStatus( - __in PNDIS_PACKET Packet, - __in NDIS_STATUS Status, - __in NDIS_HANDLE Handle, - __in ULONG Code - ); - -#endif - -#define NDIS_MAX_EVENT_LOG_DATA_SIZE ((ERROR_LOG_MAXIMUM_SIZE - sizeof(IO_ERROR_LOG_PACKET) + sizeof(ULONG)) & ~3) - -#if NDIS_SUPPORT_60_COMPATIBLE_API && !defined(NDIS_WRAPPER) - -#ifdef _WIN64 -#define NDIS_MAX_PROCESSOR_COUNT 64 -#else -#define NDIS_MAX_PROCESSOR_COUNT 32 -#endif - -#endif - -#if NDIS_SUPPORT_NDIS6 - -// -// NDIS_RESTART_ATTRIBUTES is used in NDIS_FILTER_RESTART_PARAMETERS, -// NDIS_MINIPORT_RESTART_PARAMETERS and NDIS_PROTOCOL_RESTART_PARAMETERS -// -typedef struct _NDIS_RESTART_ATTRIBUTES NDIS_RESTART_ATTRIBUTES, *PNDIS_RESTART_ATTRIBUTES; - -typedef struct _NDIS_RESTART_ATTRIBUTES -{ - PNDIS_RESTART_ATTRIBUTES Next; - NDIS_OID Oid; - ULONG DataLength; - DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) UCHAR Data[1]; -}NDIS_RESTART_ATTRIBUTES, *PNDIS_RESTART_ATTRIBUTES; - - - -// -// used in all NDIS drivers -// -typedef -NDIS_STATUS -(SET_OPTIONS)( - __in NDIS_HANDLE NdisDriverHandle, - __in NDIS_HANDLE DriverContext - ); - -typedef SET_OPTIONS (*SET_OPTIONS_HANDLER); -typedef SET_OPTIONS (MINIPORT_SET_OPTIONS); -typedef SET_OPTIONS (PROTOCOL_SET_OPTIONS); -typedef SET_OPTIONS (FILTER_SET_OPTIONS); - -#endif // NDIS_SUPPORT_NDIS6 - -#if NDIS_LEGACY_DRIVER -typedef -NDIS_STATUS -(*WAN_SEND_HANDLER)( - __in NDIS_HANDLE NdisBindingHandle, - __in NDIS_HANDLE LinkHandle, - __in PVOID Packet - ); - -typedef -NDIS_STATUS -(*SEND_HANDLER)( - __in NDIS_HANDLE NdisBindingHandle, - __in PNDIS_PACKET Packet - ); - -typedef -NDIS_STATUS -(*TRANSFER_DATA_HANDLER)( - __in NDIS_HANDLE NdisBindingHandle, - __in NDIS_HANDLE MacReceiveContext, - __in UINT ByteOffset, - __in UINT BytesToTransfer, - __out PNDIS_PACKET Packet, - __out PUINT BytesTransferred - ); - -typedef -NDIS_STATUS -(*RESET_HANDLER)( - __in NDIS_HANDLE NdisBindingHandle - ); - -typedef -NDIS_STATUS -(*REQUEST_HANDLER)( - __in NDIS_HANDLE NdisBindingHandle, - __in PNDIS_REQUEST NdisRequest - ); - -typedef -VOID -(*SEND_PACKETS_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PPNDIS_PACKET PacketArray, - __in UINT NumberOfPackets - ); - -#endif // NDIS_LEGACY_DRIVER - -// -// NDIS object types created by NDIS drivers -// - - -#if NDIS_SUPPORT_NDIS6 - -#if NDIS_SUPPORT_60_COMPATIBLE_API -#define NDIS_CURRENT_PROCESSOR_NUMBER KeGetCurrentProcessorNumber() -#endif - -#define NDIS_CURRENT_IRQL() KeGetCurrentIrql() - -#define NDIS_RAISE_IRQL_TO_DISPATCH(_pIrql_) KeRaiseIrql(DISPATCH_LEVEL, _pIrql_) - -#define NDIS_LOWER_IRQL(_OldIrql_, _CurIrql_) \ -{ \ - if (_OldIrql_ != _CurIrql_) KeLowerIrql(_OldIrql_); \ -} - -typedef KMUTEX NDIS_MUTEX, *PNDIS_MUTEX; - -#define NDIS_INIT_MUTEX(_M_) KeInitializeMutex(_M_, 0xFFFF) -#define NDIS_RELEASE_MUTEX(_M_) KeReleaseMutex(_M_, FALSE) - -#define NDIS_WAIT_FOR_MUTEX(_M_) KeWaitForSingleObject(_M_, \ - Executive,\ - KernelMode,\ - FALSE, \ - NULL) \ - - - -#if NDIS_SUPPORT_60_COMPATIBLE_API - -EXPORT -ULONG -NdisSystemActiveProcessorCount( - PKAFFINITY ActiveProcessors - ); - -#endif - -#if NDIS_SUPPORT_NDIS620 - -EXPORT -USHORT -NdisActiveGroupCount( - VOID - ); - -EXPORT -USHORT -NdisMaxGroupCount( - VOID - ); - -EXPORT -ULONG -NdisGroupMaxProcessorCount( - USHORT Group - ); - -EXPORT -ULONG -NdisGroupActiveProcessorCount( - USHORT Group - ); - -EXPORT -KAFFINITY -NdisGroupActiveProcessorMask( - USHORT Group - ); - -EXPORT -PROCESSOR_NUMBER -NdisCurrentGroupAndProcessor( - VOID - ); - -EXPORT -ULONG -NdisCurrentProcessorIndex( - VOID - ); - -EXPORT -ULONG -NdisProcessorNumberToIndex( - PROCESSOR_NUMBER ProcNum - ); - -EXPORT -NTSTATUS -NdisProcessorIndexToNumber( - __in ULONG ProcIndex, - __out PPROCESSOR_NUMBER ProcNum - ); - -#endif - -#define NDIS_CONFIGURATION_OBJECT_REVISION_1 1 - -// -// Flags for NdisOpenConfigurationEx -// -#define NDIS_CONFIG_FLAG_FILTER_INSTANCE_CONFIGURATION 0x00000001 - -typedef struct _NDIS_CONFIGURATION_OBJECT -{ - NDIS_OBJECT_HEADER Header; - NDIS_HANDLE NdisHandle; - ULONG Flags; -} NDIS_CONFIGURATION_OBJECT, *PNDIS_CONFIGURATION_OBJECT; - -#define NDIS_SIZEOF_CONFIGURATION_OBJECT_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_CONFIGURATION_OBJECT, Flags) - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisOpenConfigurationEx( - __in PNDIS_CONFIGURATION_OBJECT ConfigObject, - __out __drv_when(return==NDIS_STATUS_SUCCESS, - __drv_deref(__drv_allocatesMem(mem))) PNDIS_HANDLE ConfigurationHandle - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_allocatesMem(Mem) -EXPORT -PVOID -NdisAllocateMemoryWithTagPriority( - __in NDIS_HANDLE NdisHandle, - __in UINT Length, - __in ULONG Tag, - __in EX_POOL_PRIORITY Priority - ); - - -typedef struct _NDIS_DRIVER_OPTIONAL_HANDLERS -{ - NDIS_OBJECT_HEADER Header; -} NDIS_DRIVER_OPTIONAL_HANDLERS, *PNDIS_DRIVER_OPTIONAL_HANDLERS; - -EXPORT -NDIS_STATUS -NdisSetOptionalHandlers( - NDIS_HANDLE NdisDriverHandle, - PNDIS_DRIVER_OPTIONAL_HANDLERS OptionalHandlers - ); - -// -// Flags used in NET_PNP_EVENT_NOTIFICATION Flags field -// - -#define NET_EVENT_HALT_MINIPORT_ON_LOW_POWER 0x00000001 - -#define NET_PNP_EVENT_NOTIFICATION_REVISION_1 1 - -typedef struct _NET_PNP_EVENT_NOTIFICATION -{ - // - // Caller must set Header to - // Type = NDIS_OBJECT_TYPE_DEFAULT - // Revision = NET_PNP_EVENT_NOTIFICATION_REVISION_1 - // Size = sizeof(_NET_PNP_EVENT_NOTIFICATION) - // - NDIS_OBJECT_HEADER Header; - - NDIS_PORT_NUMBER PortNumber; - - NET_PNP_EVENT NetPnPEvent; - ULONG Flags; - - -} NET_PNP_EVENT_NOTIFICATION, *PNET_PNP_EVENT_NOTIFICATION; - -#define NDIS_SIZEOF_NET_PNP_EVENT_NOTIFICATION_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NET_PNP_EVENT_NOTIFICATION, NetPnPEvent) - -// -// new request and status structures -// - -#define NDIS_OID_REQUEST_REVISION_1 1 -#define NDIS_OID_REQUEST_TIMEOUT_INFINITE 0 -#define NDIS_OID_REQUEST_NDIS_RESERVED_SIZE 16 - -typedef struct _NDIS_OID_REQUEST -{ - // - // Caller must set Header to - // Header.Type = NDIS_OBJECT_TYPE_OID_REQUEST - // Header.Revision = NDIS_OID_REQUEST_REVISION_1 - // Header.Size = NDIS_SIZEOF_OID_REQUEST_REVISION_1 - // - NDIS_OBJECT_HEADER Header; - NDIS_REQUEST_TYPE RequestType; - NDIS_PORT_NUMBER PortNumber; - UINT Timeout; // in Seconds - PVOID RequestId; - NDIS_HANDLE RequestHandle; - - // - // OID - Information - // - union _REQUEST_DATA - { - struct _QUERY - { - NDIS_OID Oid; - PVOID InformationBuffer; - UINT InformationBufferLength; - UINT BytesWritten; - UINT BytesNeeded; - } QUERY_INFORMATION; - - struct _SET - { - NDIS_OID Oid; - PVOID InformationBuffer; - UINT InformationBufferLength; - UINT BytesRead; - UINT BytesNeeded; - } SET_INFORMATION; - - struct _METHOD - { - NDIS_OID Oid; - PVOID InformationBuffer; - ULONG InputBufferLength; - ULONG OutputBufferLength; - ULONG MethodId; - UINT BytesWritten; - UINT BytesRead; - UINT BytesNeeded; - } METHOD_INFORMATION; - } DATA; - // - // NDIS Reserved - // - UCHAR NdisReserved[NDIS_OID_REQUEST_NDIS_RESERVED_SIZE * sizeof(PVOID)]; - UCHAR MiniportReserved[2*sizeof(PVOID)]; - UCHAR SourceReserved[2*sizeof(PVOID)]; - UCHAR SupportedRevision; - UCHAR Reserved1; - USHORT Reserved2; - -}NDIS_OID_REQUEST, *PNDIS_OID_REQUEST; - -#define NDIS_SIZEOF_OID_REQUEST_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_OID_REQUEST, Reserved2) -// -// Macros to set, clear and test NDIS_STATUS_INDICATION Flags -// -#define NDIS_STATUS_INDICATION_SET_FLAG(_StatusIndication, _F) \ - ((_StatusIndication)->Flags |= (_F)) - -#define NDIS_STATUS_INDICATION_TEST_FLAG(_StatusIndication, _F) \ - (((_StatusIndication)->Flags & (_F)) != 0) - -#define NDIS_STATUS_INDICATION_CLEAR_FLAG(_StatusIndication, _F) \ - ((_StatusIndication)->Flags &= ~(_F)) - -#define NDIS_STATUS_INDICATION_FLAGS_NDIS_RESERVED 0xFFF - -// -// Public flags for NDIS_STATUS_INDICATION -// -#define NDIS_STATUS_INDICATION_FLAGS_MEDIA_CONNECT_TO_CONNECT 0x1000 - -#define NDIS_STATUS_INDICATION_REVISION_1 1 - -typedef struct _NDIS_STATUS_INDICATION -{ - NDIS_OBJECT_HEADER Header; - NDIS_HANDLE SourceHandle; - NDIS_PORT_NUMBER PortNumber; - NDIS_STATUS StatusCode; - ULONG Flags; - NDIS_HANDLE DestinationHandle; - PVOID RequestId; - PVOID StatusBuffer; - ULONG StatusBufferSize; - GUID Guid; // optional and valid only if StatusCode = NDIS_STATUS_MEDIA_SPECIFIC_INDICATION - PVOID NdisReserved[4]; -}NDIS_STATUS_INDICATION, *PNDIS_STATUS_INDICATION; - -#define NDIS_SIZEOF_STATUS_INDICATION_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_STATUS_INDICATION, NdisReserved) - - -// -// Generic Timer support -// - -#define NDIS_TIMER_CHARACTERISTICS_REVISION_1 1 - -typedef struct _NDIS_TIMER_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; - ULONG AllocationTag; - PNDIS_TIMER_FUNCTION TimerFunction; - PVOID FunctionContext; -} NDIS_TIMER_CHARACTERISTICS, *PNDIS_TIMER_CHARACTERISTICS; - -#define NDIS_SIZEOF_TIMER_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_TIMER_CHARACTERISTICS, FunctionContext) - -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_MAX_LOOKAHEAD_SIZE_ACCESSED_UNDEFINED -1 - -// -// Bits used in Flags field of NDIS_RESTART_GENERAL_ATTRIBUTES structure -// -#define NDIS_RESTART_GENERAL_ATTRIBUTES_MAX_LOOKAHEAD_ACCESSED_DEFINED 0x00000001 -#endif - -// -// NDIS_RESTART_GENERAL_ATTRIBUTES is used in NDIS_RESTART_ATTRIBUTES -// - -#define NDIS_RESTART_GENERAL_ATTRIBUTES_REVISION_1 1 - -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_RESTART_GENERAL_ATTRIBUTES_REVISION_2 2 -#endif - -typedef struct _NDIS_RESTART_GENERAL_ATTRIBUTES -{ - NDIS_OBJECT_HEADER Header; - ULONG MtuSize; - ULONG64 MaxXmitLinkSpeed; - ULONG64 MaxRcvLinkSpeed; - ULONG LookaheadSize; - ULONG MacOptions; - ULONG SupportedPacketFilters; - ULONG MaxMulticastListSize; - PNDIS_RECEIVE_SCALE_CAPABILITIES RecvScaleCapabilities; - NET_IF_ACCESS_TYPE AccessType; - ULONG Flags; - NET_IF_CONNECTION_TYPE ConnectionType; - ULONG SupportedStatistics; - ULONG DataBackFillSize; - ULONG ContextBackFillSize; - PNDIS_OID SupportedOidList; - ULONG SupportedOidListLength; -#if (NDIS_SUPPORT_NDIS620) - ULONG MaxLookaheadSizeAccessed; -#endif -}NDIS_RESTART_GENERAL_ATTRIBUTES, *PNDIS_RESTART_GENERAL_ATTRIBUTES; - -#define NDIS_SIZEOF_RESTART_GENERAL_ATTRIBUTES_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_RESTART_GENERAL_ATTRIBUTES, SupportedOidListLength) - -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_SIZEOF_RESTART_GENERAL_ATTRIBUTES_REVISION_2 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_RESTART_GENERAL_ATTRIBUTES, MaxLookaheadSizeAccessed) -#endif - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisAllocateTimerObject( - __in NDIS_HANDLE NdisHandle, - __in PNDIS_TIMER_CHARACTERISTICS TimerCharacteristics, - __out __drv_deref(__drv_isObjectPointer) - PNDIS_HANDLE pTimerObject - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -BOOLEAN -NdisSetTimerObject( - __in NDIS_HANDLE TimerObject, - __in LARGE_INTEGER DueTime, - __in_opt LONG MillisecondsPeriod, - __in_opt PVOID FunctionContext - ); - -// -// Marking this as <= DISPATCH but in reality this should actually be == PASSIVE -// (in some cases). It depends if the TimerObject was created to be a Periodic Timer -// or not. We'll rely on SDV to catch these extra cases for now. -// -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -EXPORT -BOOLEAN -NdisCancelTimerObject( - __in NDIS_HANDLE TimerObject - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreeTimerObject( - __in NDIS_HANDLE TimerObject - ); - -EXPORT -NDIS_STATUS -NdisAllocateCloneOidRequest( - IN NDIS_HANDLE SourceHandle, - IN PNDIS_OID_REQUEST OidRequest, - IN UINT PoolTag, - OUT PNDIS_OID_REQUEST* ClonedOidRequest - ); - -EXPORT -VOID -NdisFreeCloneOidRequest( - IN NDIS_HANDLE SourceHandle, - IN PNDIS_OID_REQUEST Request - ); - -EXPORT -VOID -NdisGetSystemUpTimeEx( - OUT PLARGE_INTEGER pSystemUpTime - ); - -#if NDIS_SUPPORT_60_COMPATIBLE_API - -typedef struct _NDIS_PROCESSOR_INFO -{ - ULONG CpuNumber; - ULONG PhysicalPackageId; - ULONG CoreId; - ULONG HyperThreadID; -}NDIS_PROCESSOR_INFO, *PNDIS_PROCESSOR_INFO; - -#define NDIS_SYSTEM_PROCESSOR_INFO_REVISION_1 1 - -typedef struct _NDIS_SYSTEM_PROCESSOR_INFO -{ - NDIS_OBJECT_HEADER Header; - ULONG Flags; - NDIS_PROCESSOR_VENDOR ProcessorVendor; - ULONG NumPhysicalPackages; - ULONG NumCores; - ULONG NumCoresPerPhysicalPackage; - ULONG MaxHyperThreadingCpusPerCore; - ULONG RssBaseCpu; - ULONG RssCpuCount; - __out_ecount(MAXIMUM_PROC_PER_GROUP) PUCHAR RssProcessors; - NDIS_PROCESSOR_INFO CpuInfo[MAXIMUM_PROC_PER_GROUP]; -}NDIS_SYSTEM_PROCESSOR_INFO, *PNDIS_SYSTEM_PROCESSOR_INFO; - -#define NDIS_SIZEOF_SYSTEM_PROCESSOR_INFO_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_SYSTEM_PROCESSOR_INFO, CpuInfo) - -EXPORT -NDIS_STATUS -NdisGetProcessorInformation( - __inout PNDIS_SYSTEM_PROCESSOR_INFO SystemProcessorInfo - ); - -#endif // NDIS_SUPPORT_60_COMPATIBLE_API - -#if NDIS_SUPPORT_NDIS620 - -EXPORT -NDIS_STATUS -NdisGetRssProcessorInformation( - __in NDIS_HANDLE NdisHandle, - __out_bcount_opt(*Size) PNDIS_RSS_PROCESSOR_INFO RssProcessorInfo, - __inout PSIZE_T Size - ); - -EXPORT -NDIS_STATUS -NdisGetProcessorInformationEx( - __in_opt NDIS_HANDLE NdisHandle, - __out_bcount_opt(*Size) PNDIS_SYSTEM_PROCESSOR_INFO_EX SystemProcessorInfo, - __inout PSIZE_T Size - ); - -#endif - - -// -// Pause reason used in NDIS_MINIPORT_PAUSE_PARAMETERS, NDIS_FILTER_PAUSE_PARAMETERS -// and NDIS_PROTOCOL_PAUSE_PARAMETERS -// -#define NDIS_PAUSE_NDIS_INTERNAL 0x00000001 -#define NDIS_PAUSE_LOW_POWER 0x00000002 -#define NDIS_PAUSE_BIND_PROTOCOL 0x00000004 -#define NDIS_PAUSE_UNBIND_PROTOCOL 0x00000008 -#define NDIS_PAUSE_ATTACH_FILTER 0x00000010 -#define NDIS_PAUSE_DETACH_FILTER 0x00000020 -#define NDIS_PAUSE_FILTER_RESTART_STACK 0x00000040 -#define NDIS_PAUSE_MINIPORT_DEVICE_REMOVE 0x00000080 - -#endif // NDIS_SUPPORT_NDIS6 - -#if (NTDDI_VERSION >= NTDDI_VISTA) -#if (NDIS_LEGACY_DRIVER || NDIS_SUPPORT_NDIS6) -// -// Flags used in NDIS_FILTER_INTERFACE -// -#define NDIS_FILTER_INTERFACE_IM_FILTER 0x00000001 -#define NDIS_FILTER_INTERFACE_LW_FILTER 0x00000002 - - -// -// NDIS_FILTER_INTERFACE is used in NDIS_ENUM_FILTERS -// structure that is used in NdisEnumerateFilterModules -// -#define NDIS_FILTER_INTERFACE_REVISION_1 1 - -typedef struct _NDIS_FILTER_INTERFACE -{ - - NDIS_OBJECT_HEADER Header; - ULONG Flags; - ULONG FilterType; - ULONG FilterRunType; - NET_IFINDEX IfIndex; - NET_LUID NetLuid; - NDIS_STRING FilterClass; - NDIS_STRING FilterInstanceName; -} NDIS_FILTER_INTERFACE, *PNDIS_FILTER_INTERFACE; - -#define NDIS_SIZEOF_FILTER_INTERFACE_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_FILTER_INTERFACE, FilterInstanceName) - -// -// NDIS_ENUM_FILTERS is used in NdisEnumerateFilterModules -// -#define NDIS_ENUM_FILTERS_REVISION_1 1 - -typedef struct _NDIS_ENUM_FILTERS -{ - NDIS_OBJECT_HEADER Header; - ULONG Flags; - ULONG NumberOfFilters; - ULONG OffsetFirstFilter; - NDIS_FILTER_INTERFACE Filter[1]; -} NDIS_ENUM_FILTERS, *PNDIS_ENUM_FILTERS; - -#define NDIS_SIZEOF_ENUM_FILTERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_ENUM_FILTERS, Filter) - -EXPORT -NDIS_STATUS -NdisEnumerateFilterModules( - IN NDIS_HANDLE NdisHandle, - IN PVOID InterfaceBuffer, - IN ULONG InterfaceBufferLength, - IN OUT PULONG BytesNeeded, - IN OUT PULONG BytesWritten - ); - -// -// The NdisRegisterDeviceEx is used by NDIS 5 and 6 drivers on NTDDI_VISTA -// These drivers use NdisRegisterDeviceEx to use the new security features -// not available in NdisRegisterDevice or NdisMRegisterDevice -// -#define NDIS_DEVICE_OBJECT_ATTRIBUTES_REVISION_1 1 - -typedef struct _NDIS_DEVICE_OBJECT_ATTRIBUTES -{ - NDIS_OBJECT_HEADER Header; - PNDIS_STRING DeviceName; - PNDIS_STRING SymbolicName; - PDRIVER_DISPATCH* MajorFunctions; - ULONG ExtensionSize; - PCUNICODE_STRING DefaultSDDLString; - LPCGUID DeviceClassGuid; -} NDIS_DEVICE_OBJECT_ATTRIBUTES, *PNDIS_DEVICE_OBJECT_ATTRIBUTES; - -#define NDIS_SIZEOF_DEVICE_OBJECT_ATTRIBUTES_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_DEVICE_OBJECT_ATTRIBUTES, DeviceClassGuid) - -EXPORT -NDIS_STATUS -NdisRegisterDeviceEx( - IN NDIS_HANDLE NdisObjectHandle, - IN PNDIS_DEVICE_OBJECT_ATTRIBUTES DeviceObjectAttributes, - OUT PDEVICE_OBJECT * pDeviceObject, - OUT PNDIS_HANDLE NdisDeviceHandle - ); - -EXPORT -VOID -NdisDeregisterDeviceEx( - IN NDIS_HANDLE NdisDeviceHandle - ); - -EXPORT -PVOID -NdisGetDeviceReservedExtension( - IN PDEVICE_OBJECT DeviceObject - ); - -// -// This structure is used by NDIS 5.x drivers that want to use -// NdisRegisterDeviceEx -// -#define NDIS_OBJECT_TYPE_DRIVER_WRAPPER_REVISION_1 1 -typedef struct _NDIS_DRIVER_WRAPPER_HANDLE -{ - // - // Caller must set Header to - // Header.Type = NDIS_OBJECT_TYPE_DRIVER_WRAPPER_OBJECT - // Header.Revision = NDIS_OBJECT_TYPE_DRIVER_WRAPPER_REVISION_1 - // Header.Size = sizeof(NDIS_DRIVER_WRAPPER_HANDLE) - // - NDIS_OBJECT_HEADER Header; - NDIS_HANDLE NdisWrapperHandle; - -} NDIS_DRIVER_WRAPPER_HANDLE, *PNDIS_DRIVER_WRAPPER_HANDLE; - -#define NDIS_SIZEOF_DRIVER_WRAPPER_HANDLE_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_DRIVER_WRAPPER_HANDLE, NdisWrapperHandle) - -#endif // NDIS_SUPPORT_NDIS6 || NDIS_LEGACY_DRIVER -#endif // NTDDI_VERSION >= NTDDI_VISTA - -#if (NDIS_SUPPORT_NDIS620) - -// -// shared memory usage types used in NDIS_SHARED_MEMORY_PARAMETERS -// - -typedef enum _NDIS_SHARED_MEMORY_USAGE -{ - NdisSharedMemoryUsageUndefined, - NdisSharedMemoryUsageXmit, - NdisSharedMemoryUsageXmitHeader, - NdisSharedMemoryUsageXmitData, - NdisSharedMemoryUsageReceive, - NdisSharedMemoryUsageReceiveLookahead, - NdisSharedMemoryUsageReceivePostLookahead, - NdisSharedMemoryUsageReceiveHeader, - NdisSharedMemoryUsageReceiveData, - NdisSharedMemoryUsageOther, - NdisSharedMemoryUsageMax -}NDIS_SHARED_MEMORY_USAGE, *PNDIS_SHARED_MEMORY_USAGE; - -// -// NDIS_SHARED_MEMORY_PARAMETERS structure describes -// a shared memory allocation request for a receive queue. -// This structure is used in NdisMAllocateSharedMemoryEx API -// as well as ALLOCATE_SHARED_MEMORY_HANDLER entry point -// - -// -// TODO: Temporary definition to get around VSP build break -// -typedef ULONG NODE_REQUIREMENT; - -// -// flags used in Flags field of NDIS_SHARED_MEMORY_PARAMETERS structure -// -#define NDIS_SHARED_MEM_PARAMETERS_CONTIGOUS 0x00000001 - - -// -// shared memory handle used for allocation from HAL -// -#define NDIS_SHARED_MEM_HANDLE_HAL_ALLOCATED ((NDIS_HANDLE)(NULL)) - -#define NDIS_SHARED_MEMORY_PARAMETERS_REVISION_1 1 - -typedef struct _NDIS_SHARED_MEMORY_PARAMETERS -{ - __in NDIS_OBJECT_HEADER Header; - __in ULONG Flags; - __in NDIS_RECEIVE_QUEUE_ID QueueId; - __out NDIS_HANDLE SharedMemoryHandle; - __in NODE_REQUIREMENT PreferredNode; - __in NDIS_SHARED_MEMORY_USAGE Usage; - __in ULONG Length; - __out PVOID VirtualAddress; - __in ULONG SGListBufferLength; - __inout PSCATTER_GATHER_LIST SGListBuffer; - }NDIS_SHARED_MEMORY_PARAMETERS, *PNDIS_SHARED_MEMORY_PARAMETERS; - -#define NDIS_SIZEOF_SHARED_MEMORY_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_SHARED_MEMORY_PARAMETERS, SGListBuffer) - -typedef -NDIS_STATUS -(*ALLOCATE_SHARED_MEMORY_HANDLER)( - __in NDIS_HANDLE ProviderContext, - __in PNDIS_SHARED_MEMORY_PARAMETERS SharedMemoryParameters, - __inout PNDIS_HANDLE pSharedMemoryProviderContext - ); - -typedef -VOID -(*FREE_SHARED_MEMORY_HANDLER)( - __in NDIS_HANDLE ProviderContext, - __in NDIS_HANDLE SharedMemoryProviderContext - ); - -#define NDIS_SHARED_MEMORY_PROVIDER_CHARACTERISTICS_REVISION_1 1 - -typedef struct _NDIS_SHARED_MEMORY_PROVIDER_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; // Header.Type = NDIS_OBJECT_TYPE_SHARED_MEMORY_PROVIDER_CHARACTERISTICS - ULONG Flags; - NDIS_HANDLE ProviderContext; - ALLOCATE_SHARED_MEMORY_HANDLER AllocateSharedMemoryHandler; - FREE_SHARED_MEMORY_HANDLER FreeSharedMemoryHandler; -} NDIS_SHARED_MEMORY_PROVIDER_CHARACTERISTICS, *PNDIS_SHARED_MEMORY_PROVIDER_CHARACTERISTICS; - -#define NDIS_SIZEOF_SHARED_MEMORY_PROVIDER_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_SHARED_MEMORY_PROVIDER_CHARACTERISTICS, FreeSharedMemoryHandler) - -EXPORT -VOID -NdisFreeMemoryWithTagPriority( - IN NDIS_HANDLE NdisHandle, - IN PVOID VirtualAddress, - IN ULONG Tag - ); - -// -// the following structure is used in NDIS_STATUS_RECEIVE_QUEUE_STATE -// status indication -// -#define NDIS_RECEIVE_QUEUE_STATE_REVISION_1 1 -typedef struct _NDIS_RECEIVE_QUEUE_STATE -{ - NDIS_OBJECT_HEADER Header; - ULONG Flags; - NDIS_RECEIVE_QUEUE_ID QueueId; - NDIS_RECEIVE_QUEUE_OPERATIONAL_STATE QueueState; -}NDIS_RECEIVE_QUEUE_STATE, *PNDIS_RECEIVE_QUEUE_STATE; - -#define NDIS_SIZEOF_NDIS_RECEIVE_QUEUE_STATE_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_RECEIVE_QUEUE_STATE, QueueState) - -EXPORT -NDIS_STATUS -NdisAllocateSharedMemory( - IN NDIS_HANDLE NdisHandle, - IN PNDIS_SHARED_MEMORY_PARAMETERS SharedMemoryParameters, - IN OUT PNDIS_HANDLE pAllocationHandle - ); - -EXPORT -VOID -NdisFreeSharedMemory( - IN NDIS_HANDLE NdisHandle, - IN NDIS_HANDLE AllocationHandle - ); - -// -// NDIS_PROCESS_SG_LIST is a driver supplied callback routine used -// in NdisBuildScatterGatherList -// - -typedef -VOID -(NDIS_PROCESS_SG_LIST)( - __in PDEVICE_OBJECT DeviceObject, - __in PVOID Reserved, - __in PSCATTER_GATHER_LIST ScatterGatherListBuffer, - __in PVOID Context - ); - -typedef NDIS_PROCESS_SG_LIST (*NDIS_PROCESS_SG_LIST_HANDLER); - - -// -// NDIS_SCATTER_GATHER_LIST_PARAMETERS is used in NdisBuildScatterGatherList -// API call to build a scatter gather list for a buffer -// - -#define NDIS_SCATTER_GATHER_LIST_PARAMETERS_REVISION_1 1 - -typedef struct _NDIS_SCATTER_GATHER_LIST_PARAMETERS -{ - NDIS_OBJECT_HEADER Header; - ULONG Flags; - NDIS_RECEIVE_QUEUE_ID QueueId; - NDIS_SHARED_MEMORY_USAGE SharedMemoryUsage; - PMDL Mdl; - PVOID CurrentVa; - ULONG Length; - NDIS_PROCESS_SG_LIST_HANDLER ProcessSGListHandler; - PVOID Context; - PSCATTER_GATHER_LIST ScatterGatherListBuffer; - ULONG ScatterGatherListBufferSize; - ULONG ScatterGatherListBufferSizeNeeded; -}NDIS_SCATTER_GATHER_LIST_PARAMETERS, *PNDIS_SCATTER_GATHER_LIST_PARAMETERS; -#define NDIS_SIZEOF_SCATTER_GATHER_LIST_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_SCATTER_GATHER_LIST_PARAMETERS, ScatterGatherListBufferSizeNeeded) - -EXPORT -NDIS_STATUS -NdisBuildScatterGatherList( - IN NDIS_HANDLE NdisHandle, - IN PNDIS_SCATTER_GATHER_LIST_PARAMETERS SGListParameters - ); - -EXPORT -VOID -NdisFreeScatterGatherList( - IN NDIS_HANDLE NdisHandle, - IN PSCATTER_GATHER_LIST ScatterGatherListBuffer, - IN BOOLEAN WriteToDevice - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -BOOLEAN -NdisSetCoalescableTimerObject( - __in NDIS_HANDLE TimerObject, - __in LARGE_INTEGER DueTime, - __in_opt LONG MillisecondsPeriod, - __in_opt PVOID FunctionContext, - __in_opt ULONG Tolerance - ); - -NDIS_STATUS -NdisGetHypervisorInfo( - __inout PNDIS_HYPERVISOR_INFO HypervisorInfo - ); - -#endif // #if (NDIS_SUPPORT_NDIS620) - - -#ifndef AFFINITY_MASK -#define AFFINITY_MASK(n) ((KAFFINITY)1 << (n)) -#endif - -#pragma warning(pop) - - -#pragma once - -#pragma warning(push) - -#pragma warning(disable:4201) // (nonstandard extension used : nameless struct/union) -#pragma warning(disable:4214) // (extension used : bit field types other than int) - -#if (NDIS_SUPPORT_NDIS6 || NDIS60) - -// -// NET_BUFFER data structures, APIs and macros -// - -typedef struct _NET_BUFFER NET_BUFFER, *PNET_BUFFER; -typedef struct _NET_BUFFER_LIST_CONTEXT NET_BUFFER_LIST_CONTEXT, *PNET_BUFFER_LIST_CONTEXT; -typedef struct _NET_BUFFER_LIST NET_BUFFER_LIST, *PNET_BUFFER_LIST; - -struct _SCATTER_GATHER_LIST; -typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST; - -typedef union _NET_BUFFER_DATA_LENGTH -{ - ULONG DataLength; - SIZE_T stDataLength; -} NET_BUFFER_DATA_LENGTH, *PNET_BUFFER_DATA_LENGTH; - - -typedef struct _NET_BUFFER_DATA -{ - PNET_BUFFER Next; - PMDL CurrentMdl; - ULONG CurrentMdlOffset; -#ifdef __cplusplus - NET_BUFFER_DATA_LENGTH NbDataLength; -#else - NET_BUFFER_DATA_LENGTH; -#endif - PMDL MdlChain; - ULONG DataOffset; -} NET_BUFFER_DATA, *PNET_BUFFER_DATA; - -typedef union _NET_BUFFER_HEADER -{ -#ifdef __cplusplus - NET_BUFFER_DATA NetBufferData; -#else - NET_BUFFER_DATA; -#endif - SLIST_HEADER Link; - -} NET_BUFFER_HEADER, *PNET_BUFFER_HEADER; - - -#if (NDIS_SUPPORT_NDIS620) - -// -// NET_BUFFER_SHARED_MEMORY is used to describe the -// shared memory segments used in each NET_BUFFER. -// for NDIS 6.20, they are used in VM queue capable NICs -// used in virtualization environment -// -typedef struct _NET_BUFFER_SHARED_MEMORY NET_BUFFER_SHARED_MEMORY, *PNET_BUFFER_SHARED_MEMORY; - -typedef struct _NET_BUFFER_SHARED_MEMORY -{ - PNET_BUFFER_SHARED_MEMORY NextSharedMemorySegment; - ULONG SharedMemoryFlags; - NDIS_HANDLE SharedMemoryHandle; - ULONG SharedMemoryOffset; - ULONG SharedMemoryLength; -}NET_BUFFER_SHARED_MEMORY, *PNET_BUFFER_SHARED_MEMORY; - -#endif // NDIS_SUPPORT_NDIS620 - - - -typedef struct _NET_BUFFER -{ - -#ifdef __cplusplus - NET_BUFFER_HEADER NetBufferHeader; -#else - NET_BUFFER_HEADER; -#endif - - USHORT ChecksumBias; - USHORT Reserved; - NDIS_HANDLE NdisPoolHandle; - DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)PVOID NdisReserved[2]; - DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)PVOID ProtocolReserved[6]; - DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)PVOID MiniportReserved[4]; - NDIS_PHYSICAL_ADDRESS DataPhysicalAddress; -#if (NDIS_SUPPORT_NDIS620) - union - { - PNET_BUFFER_SHARED_MEMORY SharedMemoryInfo; - PSCATTER_GATHER_LIST ScatterGatherList; - }; -#endif -}NET_BUFFER, *PNET_BUFFER; - -#pragma warning(push) -#pragma warning(disable:4200) // nonstandard extension used : zero-sized array in struct/union - -typedef struct _NET_BUFFER_LIST_CONTEXT -{ - PNET_BUFFER_LIST_CONTEXT Next; - USHORT Size; - USHORT Offset; - DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) UCHAR ContextData[]; -} NET_BUFFER_LIST_CONTEXT, *PNET_BUFFER_LIST_CONTEXT; - -#pragma warning(pop) - -typedef enum _NDIS_NET_BUFFER_LIST_INFO -{ - TcpIpChecksumNetBufferListInfo, - TcpOffloadBytesTransferred = TcpIpChecksumNetBufferListInfo, - IPsecOffloadV1NetBufferListInfo, -#if (NDIS_SUPPORT_NDIS61) - IPsecOffloadV2NetBufferListInfo = IPsecOffloadV1NetBufferListInfo, -#endif // (NDIS_SUPPORT_NDIS61) - TcpLargeSendNetBufferListInfo, - TcpReceiveNoPush = TcpLargeSendNetBufferListInfo, - ClassificationHandleNetBufferListInfo, - Ieee8021QNetBufferListInfo, - NetBufferListCancelId, - MediaSpecificInformation, - NetBufferListFrameType, - NetBufferListProtocolId = NetBufferListFrameType, - NetBufferListHashValue, - NetBufferListHashInfo, - WfpNetBufferListInfo, -#if (NDIS_SUPPORT_NDIS61) - IPsecOffloadV2TunnelNetBufferListInfo, - IPsecOffloadV2HeaderNetBufferListInfo, -#endif // (NDIS_SUPPORT_NDIS61) - -#if (NDIS_SUPPORT_NDIS620) - NetBufferListCorrelationId, - NetBufferListFilteringInfo, - - - MediaSpecificInformationEx, - NblOriginalInterfaceIfIndex, - NblReAuthWfpFlowContext = NblOriginalInterfaceIfIndex, - TcpReceiveBytesTransferred, -#endif // (NDIS_SUPPORT_NDIS620) - - - MaxNetBufferListInfo -} NDIS_NET_BUFFER_LIST_INFO, *PNDIS_NET_BUFFER_LIST_INFO; - -typedef struct _NET_BUFFER_LIST_DATA -{ - PNET_BUFFER_LIST Next; // Next NetBufferList in the chain - PNET_BUFFER FirstNetBuffer; // First NetBuffer on this NetBufferList -} NET_BUFFER_LIST_DATA, *PNET_BUFFER_LIST_DATA; - -typedef union _NET_BUFFER_LIST_HEADER -{ -#ifdef __cplusplus - NET_BUFFER_LIST_DATA NetBufferListData; -#else - NET_BUFFER_LIST_DATA; -#endif - SLIST_HEADER Link; // used in SLIST of free NetBuffers in the block -} NET_BUFFER_LIST_HEADER, *PNET_BUFFER_LIST_HEADER; - - -typedef struct _NET_BUFFER_LIST -{ - -#ifdef __cplusplus - NET_BUFFER_LIST_HEADER NetBufferListHeader; -#else - NET_BUFFER_LIST_HEADER; -#endif - - PNET_BUFFER_LIST_CONTEXT Context; - PNET_BUFFER_LIST ParentNetBufferList; - NDIS_HANDLE NdisPoolHandle; - DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)PVOID NdisReserved[2]; - DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)PVOID ProtocolReserved[4]; - DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)PVOID MiniportReserved[2]; - PVOID Scratch; - NDIS_HANDLE SourceHandle; - ULONG NblFlags; // public flags - LONG ChildRefCount; - ULONG Flags; // private flags used by NDIs, protocols, miniport, etc. - NDIS_STATUS Status; - PVOID NetBufferListInfo[MaxNetBufferListInfo]; -} NET_BUFFER_LIST, *PNET_BUFFER_LIST; - - - - -#ifdef __cplusplus -#define NET_BUFFER_NEXT_NB(_NB) ((_NB)->NetBufferHeader.NetBufferData.Next) -#define NET_BUFFER_FIRST_MDL(_NB) ((_NB)->NetBufferHeader.NetBufferData.MdlChain) -#define NET_BUFFER_DATA_LENGTH(_NB) ((_NB)->NetBufferHeader.NetBufferData.NbDataLength.DataLength) -#define NET_BUFFER_DATA_OFFSET(_NB) ((_NB)->NetBufferHeader.NetBufferData.DataOffset) -#define NET_BUFFER_CURRENT_MDL(_NB) ((_NB)->NetBufferHeader.NetBufferData.CurrentMdl) -#define NET_BUFFER_CURRENT_MDL_OFFSET(_NB) ((_NB)->NetBufferHeader.NetBufferData.CurrentMdlOffset) -#else -#define NET_BUFFER_NEXT_NB(_NB) ((_NB)->Next) -#define NET_BUFFER_FIRST_MDL(_NB) ((_NB)->MdlChain) -#define NET_BUFFER_DATA_LENGTH(_NB) ((_NB)->DataLength) -#define NET_BUFFER_DATA_OFFSET(_NB) ((_NB)->DataOffset) -#define NET_BUFFER_CURRENT_MDL(_NB) ((_NB)->CurrentMdl) -#define NET_BUFFER_CURRENT_MDL_OFFSET(_NB) ((_NB)->CurrentMdlOffset) -#endif - -#define NET_BUFFER_PROTOCOL_RESERVED(_NB) ((_NB)->ProtocolReserved) -#define NET_BUFFER_MINIPORT_RESERVED(_NB) ((_NB)->MiniportReserved) -#define NET_BUFFER_CHECKSUM_BIAS(_NB) ((_NB)->ChecksumBias) - -#if (NDIS_SUPPORT_NDIS61) -#define NET_BUFFER_DATA_PHYSICAL_ADDRESS(_NB) ((_NB)->DataPhysicalAddress) -#endif // (NDIS_SUPPORT_NDIS61) - -#if (NDIS_SUPPORT_NDIS620) -#define NET_BUFFER_FIRST_SHARED_MEM_INFO(_NB) ((_NB)->SharedMemoryInfo) -#define NET_BUFFER_SHARED_MEM_NEXT_SEGMENT(_SHI) ((_SHI)->NextSharedMemorySegment) -#define NET_BUFFER_SHARED_MEM_FLAGS(_SHI) ((_SHI)->SharedMemoryFlags) -#define NET_BUFFER_SHARED_MEM_HANDLE(_SHI) ((_SHI)->SharedMemoryHandle) -#define NET_BUFFER_SHARED_MEM_OFFSET(_SHI) ((_SHI)->SharedMemoryOffset) -#define NET_BUFFER_SHARED_MEM_LENGTH(_SHI) ((_SHI)->SharedMemoryLength) - -#define NET_BUFFER_SCATTER_GATHER_LIST(_NB) ((_NB)->ScatterGatherList) - -#endif // (NDIS_SUPPORT_NDIS620) - - -#ifdef __cplusplus -#define NET_BUFFER_LIST_NEXT_NBL(_NBL) ((_NBL)->NetBufferListHeader.NetBufferListData.Next) -#define NET_BUFFER_LIST_FIRST_NB(_NBL) ((_NBL)->NetBufferListHeader.NetBufferListData.FirstNetBuffer) -#else -#define NET_BUFFER_LIST_NEXT_NBL(_NBL) ((_NBL)->Next) -#define NET_BUFFER_LIST_FIRST_NB(_NBL) ((_NBL)->FirstNetBuffer) -#endif - -#define NET_BUFFER_LIST_FLAGS(_NBL) ((_NBL)->Flags) -#define NET_BUFFER_LIST_NBL_FLAGS(_NBL) ((_NBL)->NblFlags) -#define NET_BUFFER_LIST_PROTOCOL_RESERVED(_NBL) ((_NBL)->ProtocolReserved) -#define NET_BUFFER_LIST_MINIPORT_RESERVED(_NBL) ((_NBL)->MiniportReserved) -#define NET_BUFFER_LIST_CONTEXT_DATA_START(_NBL) ((PUCHAR)(((_NBL)->Context)+1)+(_NBL)->Context->Offset) -#define NET_BUFFER_LIST_CONTEXT_DATA_SIZE(_NBL) (((_NBL)->Context)->Size) - -#define NET_BUFFER_LIST_INFO(_NBL, _Id) ((_NBL)->NetBufferListInfo[(_Id)]) -#define NET_BUFFER_LIST_STATUS(_NBL) ((_NBL)->Status) - - -#define NDIS_GET_NET_BUFFER_LIST_CANCEL_ID(_NBL) (NET_BUFFER_LIST_INFO(_NBL, NetBufferListCancelId)) -#define NDIS_SET_NET_BUFFER_LIST_CANCEL_ID(_NBL, _CancelId) \ - NET_BUFFER_LIST_INFO(_NBL, NetBufferListCancelId) = _CancelId - - -// -// Per-NBL information for Ieee8021QNetBufferListInfo. -// -typedef struct _NDIS_NET_BUFFER_LIST_8021Q_INFO -{ - union - { - struct - { - UINT32 UserPriority:3; // 802.1p priority - UINT32 CanonicalFormatId:1; // always 0 - UINT32 VlanId:12; // VLAN Identification - UINT32 Reserved:16; // set to 0 for ethernet - }TagHeader; - - struct - { - UINT32 UserPriority:3; // 802.1p priority - UINT32 CanonicalFormatId:1; // always 0 - UINT32 VlanId:12; // VLAN Identification - UINT32 WMMInfo:4; - UINT32 Reserved:12; // set to 0 for wireless lan - - }WLanTagHeader; - - PVOID Value; - }; -} NDIS_NET_BUFFER_LIST_8021Q_INFO, *PNDIS_NET_BUFFER_LIST_8021Q_INFO; - -typedef struct _NDIS_NET_BUFFER_LIST_MEDIA_SPECIFIC_INFO -{ - union - { - PVOID MediaSpecificInfo; - PVOID NativeWifiSpecificInfo; - - PVOID Value; - }; - -} NDIS_NET_BUFFER_LIST_MEDIA_SPECIFIC_INFO, *PNDIS_NET_BUFFER_LIST_MEDIA_SPECIFIC_INFO; - -typedef struct _NDIS_NBL_MEDIA_MEDIA_SPECIFIC_INFORMATION NDIS_NBL_MEDIA_SPECIFIC_INFORMATION, *PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION; - - -struct _NDIS_NBL_MEDIA_MEDIA_SPECIFIC_INFORMATION -{ - PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION NextEntry; - ULONG Tag; - DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) UCHAR Data[1]; -}; - -#define NDIS_NBL_ADD_MEDIA_SPECIFIC_INFO(_NBL, _MediaSpecificInfo) \ - { \ - PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION HeadEntry = NULL; \ - if (NET_BUFFER_LIST_INFO((_NBL), MediaSpecificInformation) != NULL) \ - { \ - HeadEntry = (PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION)(NET_BUFFER_LIST_INFO((_NBL), MediaSpecificInformation)); \ - } \ - NET_BUFFER_LIST_INFO((_NBL), MediaSpecificInformation) = (_MediaSpecificInfo); \ - (_MediaSpecificInfo)->NextEntry = HeadEntry; \ - } - -#define NDIS_NBL_REMOVE_MEDIA_SPECIFIC_INFO(_NBL, _MediaSpecificInfo) \ - { \ - PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION *HeadEntry; \ - HeadEntry = (PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION *)&(NET_BUFFER_LIST_INFO((_NBL), MediaSpecificInformation)); \ - for (; *HeadEntry != NULL; HeadEntry = &(*HeadEntry)->NextEntry) \ - { \ - if ((*HeadEntry)->Tag == (_MediaSpecificInfo)->Tag) \ - { \ - *HeadEntry = (*HeadEntry)->NextEntry; \ - break; \ - } \ - } \ - } - -#define NDIS_NBL_GET_MEDIA_SPECIFIC_INFO(_NBL, _Tag, _MediaSpecificInfo) \ - { \ - PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION HeadEntry; \ - (_MediaSpecificInfo) = NULL; \ - HeadEntry = (PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION)(NET_BUFFER_LIST_INFO((_NBL), MediaSpecificInformation)); \ - for (; HeadEntry != NULL; HeadEntry = HeadEntry->NextEntry) \ - { \ - if (HeadEntry->Tag == (_Tag)) \ - { \ - (_MediaSpecificInfo) = HeadEntry; \ - break; \ - } \ - } \ - } - -#if NDIS_SUPPORT_NDIS620 - -typedef struct _NDIS_NBL_MEDIA_SPECIFIC_INFORMATION_EX -{ - NDIS_OBJECT_HEADER Header; - struct _NDIS_NBL_MEDIA_SPECIFIC_INFORMATION_EX* NextEntry; - ULONG Tag; - PVOID Data; -} NDIS_NBL_MEDIA_SPECIFIC_INFORMATION_EX, *PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION_EX; - -#define NDIS_NBL_MEDIA_SPECIFIC_INFO_REVISION_1 1 - -#define NDIS_SIZEOF_NBL_MEDIA_SPECIFIC_INFO_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_NBL_MEDIA_SPECIFIC_INFORMATION_EX,Data) - -#define NDIS_NBL_ADD_MEDIA_SPECIFIC_INFO_EX(_NBL, _MediaSpecificInfo) \ - { \ - PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION_EX HeadEntry; \ - \ - HeadEntry = NET_BUFFER_LIST_INFO(_NBL, MediaSpecificInformationEx); \ - NET_BUFFER_LIST_INFO((_NBL), MediaSpecificInformationEx) = (_MediaSpecificInfo); \ - (_MediaSpecificInfo)->NextEntry = HeadEntry; \ - } - -#define NDIS_NBL_REMOVE_MEDIA_SPECIFIC_INFO_EX(_NBL, _MediaSpecificInfo) \ - { \ - PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION_EX *HeadEntry; \ - HeadEntry = (PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION_EX *)&(NET_BUFFER_LIST_INFO((_NBL), MediaSpecificInformationEx)); \ - for (; *HeadEntry != NULL; HeadEntry = &(*HeadEntry)->NextEntry) \ - { \ - if ((*HeadEntry)->Tag == (_MediaSpecificInfo)->Tag) \ - { \ - *HeadEntry = (*HeadEntry)->NextEntry; \ - break; \ - } \ - } \ - } - -#define NDIS_NBL_GET_MEDIA_SPECIFIC_INFO_EX(_NBL, _Tag, _MediaSpecificInfo) \ - { \ - PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION_EX HeadEntry; \ - (_MediaSpecificInfo) = NULL; \ - HeadEntry = (PNDIS_NBL_MEDIA_SPECIFIC_INFORMATION_EX)(NET_BUFFER_LIST_INFO((_NBL), MediaSpecificInformationEx)); \ - for (; HeadEntry != NULL; HeadEntry = HeadEntry->NextEntry) \ - { \ - if (HeadEntry->Tag == (_Tag)) \ - { \ - (_MediaSpecificInfo) = HeadEntry; \ - break; \ - } \ - } \ - } - -#endif - - -/* -Bit 31 - 0 for MS tag - 1 for Vendor tag -Bits 30-16 - Vendor ID (if Bit 31 = 1) - - Technology ID (if Bit 31 = 0) -Bits 15-0 - Tag ID - -*/ - -// -// Microsoft Media Specific-Info tags -// -//TUNNEL - Technology ID : 1 -#define NDIS_MEDIA_SPECIFIC_INFO_TUNDL 0x00010001 -// -// Intel Media Specific Info tags -// -#define NDIS_MEDIA_SPECIFIC_INFO_FCOE 0x80010000 -#define NDIS_MEDIA_SPECIFIC_INFO_EAPOL 0x80010001 -#define NDIS_MEDIA_SPECIFIC_INFO_LLDP 0x80010002 -#define NDIS_MEDIA_SPECIFIC_INFO_TIMESYNC 0x80010003 - - -#ifndef NDIS_HASH_FUNCTION_MASK -#define NDIS_HASH_FUNCTION_MASK 0x000000FF -#define NDIS_HASH_TYPE_MASK 0x00FFFF00 -#endif - -// -// The following macros are used by miniport driver and protocol driver to set and get -// the hash value, hash type and hash function. -// -VOID -FORCEINLINE -NET_BUFFER_LIST_SET_HASH_TYPE( - __in PNET_BUFFER_LIST _NBL, - __in volatile ULONG _HashType - ) -{ - (NET_BUFFER_LIST_INFO(_NBL, NetBufferListHashInfo) = - UlongToPtr(((PtrToUlong (NET_BUFFER_LIST_INFO(_NBL, NetBufferListHashInfo)) & (~NDIS_HASH_TYPE_MASK)) | ((_HashType) & (NDIS_HASH_TYPE_MASK))))); -} - -VOID -FORCEINLINE -NET_BUFFER_LIST_SET_HASH_FUNCTION( - __in PNET_BUFFER_LIST _NBL, - __in volatile ULONG _HashFunction - ) -{ - (NET_BUFFER_LIST_INFO(_NBL, NetBufferListHashInfo) = - UlongToPtr(((PtrToUlong(NET_BUFFER_LIST_INFO(_NBL, NetBufferListHashInfo)) & (~NDIS_HASH_FUNCTION_MASK)) | ((_HashFunction) & (NDIS_HASH_FUNCTION_MASK))))); -} - -#define NET_BUFFER_LIST_SET_HASH_VALUE(_NBL, _HashValue) \ - (NET_BUFFER_LIST_INFO(_NBL, NetBufferListHashValue) = UlongToPtr(_HashValue)) - -#define NET_BUFFER_LIST_GET_HASH_TYPE(_NBL) \ - (PtrToUlong(NET_BUFFER_LIST_INFO(_NBL, NetBufferListHashInfo)) & (NDIS_HASH_TYPE_MASK)) - -#define NET_BUFFER_LIST_GET_HASH_FUNCTION(_NBL) \ - (PtrToUlong(NET_BUFFER_LIST_INFO(_NBL, NetBufferListHashInfo)) & (NDIS_HASH_FUNCTION_MASK)) - -#define NET_BUFFER_LIST_GET_HASH_VALUE(_NBL) \ - (PtrToUlong(NET_BUFFER_LIST_INFO(_NBL, NetBufferListHashValue))) - -#define NdisSetNetBufferListProtocolId(_NBL,_ProtocolId) \ - *((PUCHAR)(&NET_BUFFER_LIST_INFO(_NBL, NetBufferListProtocolId))) = _ProtocolId - - -#if (NDIS_SUPPORT_NDIS620) - -// -// Per-NBL information for NetBufferListFilteringInfo. -// -typedef struct _NDIS_NET_BUFFER_LIST_FILTERING_INFO -{ - union - { - struct - { - USHORT FilterId; - USHORT QueueId; - } FilteringInfo; - PVOID Value; - }; -} NDIS_NET_BUFFER_LIST_FILTERING_INFO, *PNDIS_NET_BUFFER_LIST_FILTERING_INFO; - -#define NET_BUFFER_LIST_RECEIVE_FILTER_ID(_NBL) \ - (((PNDIS_NET_BUFFER_LIST_FILTERING_INFO)&NET_BUFFER_LIST_INFO(_NBL, NetBufferListFilteringInfo))->FilteringInfo.FilterId) - -#define NET_BUFFER_LIST_RECEIVE_QUEUE_ID(_NBL) \ - (((PNDIS_NET_BUFFER_LIST_FILTERING_INFO)&NET_BUFFER_LIST_INFO(_NBL, NetBufferListFilteringInfo))->FilteringInfo.QueueId) - - - -#endif // (NDIS_SUPPORT_NDIS620) - - -#define NdisQueryMdl(_Mdl, _VirtualAddress, _Length, _Priority) \ -{ \ - if (ARGUMENT_PRESENT(_VirtualAddress)) \ - { \ - *(PVOID *)(_VirtualAddress) = MmGetSystemAddressForMdlSafe(_Mdl, _Priority); \ - } \ - *(_Length) = MmGetMdlByteCount(_Mdl); \ -} - -#define NdisQueryMdlOffset(_Mdl, _Offset, _Length) \ -{ \ - *(_Offset) = MmGetMdlByteOffset(_Mdl); \ - *(_Length) = MmGetMdlByteCount(_Mdl); \ -} - -#define NDIS_MDL_TO_SPAN_PAGES(_Mdl) \ - (MmGetMdlByteCount(_Mdl)==0 ? \ - 1 : \ - (ADDRESS_AND_SIZE_TO_SPAN_PAGES( \ - MmGetMdlVirtualAddress(_Mdl), \ - MmGetMdlByteCount(_Mdl)))) - -#define NdisGetMdlPhysicalArraySize(_Mdl, _ArraySize) \ - (*(_ArraySize) = NDIS_MDL_TO_SPAN_PAGES(_Mdl)) - - -#define NDIS_MDL_LINKAGE(_Mdl) ((_Mdl)->Next) - -#define NdisGetNextMdl(_CurrentMdl, _NextMdl) \ -{ \ - *(_NextMdl) = (_CurrentMdl)->Next; \ -} - - -__drv_maxIRQL(DISPATCH_LEVEL) -UCHAR -NdisGetNetBufferListProtocolId( - __in PNET_BUFFER_LIST NetBufferList - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -NdisAdjustNetBufferCurrentMdl( - __in PNET_BUFFER NetBuffer - ); - - -// -// The flags that can be set at NET_BUFFER_LIST.Flags are defined below. -// -#define NBL_FLAGS_PROTOCOL_RESERVED 0xFFF00000 -#define NBL_FLAGS_MINIPORT_RESERVED 0x0000F000 -#define NBL_FLAGS_SCRATCH 0x000F0000 -#define NBL_FLAGS_NDIS_RESERVED 0x00000FFF - - -#define NBL_TEST_FLAG(_NBL, _F) (((_NBL)->Flags & (_F)) != 0) -#define NBL_SET_FLAG(_NBL, _F) ((_NBL)->Flags |= (_F)) -#define NBL_CLEAR_FLAG(_NBL, _F) ((_NBL)->Flags &= ~(_F)) - -#define NBL_SET_PROTOCOL_RSVD_FLAG(_NBL, _F) ((_NBL)->Flags |= ((_F) & NBL_FLAGS_PROTOCOL_RESERVED)) -#define NBL_CLEAR_PROTOCOL_RSVD_FLAG(_NBL, _F) ((_NBL)->Flags &= ~((_F) & NBL_FLAGS_PROTOCOL_RESERVED)) -#define NBL_TEST_PROTOCOL_RSVD_FLAG(_NBL, _F) (((_NBL)->Flags & ((_F) & NBL_FLAGS_PROTOCOL_RESERVED)) != 0) - - -// -// Define some flags for protocols' own use -// -#define NBL_PROT_RSVD_FLAGS NBL_FLAGS_PROTOCOL_RESERVED -#define NBL_SET_PROT_RSVD_FLAG(_NBL, _F) NBL_SET_PROTOCOL_RSVD_FLAG(_NBL,_F) -#define NBL_CLEAR_PROT_RSVD_FLAG(_NBL, _F) NBL_CLEAR_PROTOCOL_RSVD_FLAG(_NBL, _F) -#define NBL_TEST_PROT_RSVD_FLAG(_NBL, _F) NBL_TEST_PROTOCOL_RSVD_FLAG(_NBL, _F) - - -// -// Flags used in NBL->NblFlags -// 0x01 to 0xFF are reserved for use by NDIS -// -#define NDIS_NBL_FLAGS_SEND_READ_ONLY 0x00000001 -#define NDIS_NBL_FLAGS_RECV_READ_ONLY 0x00000002 - -#if (NDIS_SUPPORT_NDIS61) -#define NDIS_NBL_FLAGS_HD_SPLIT 0x00000100 // Data and header are split -#define NDIS_NBL_FLAGS_IS_IPV4 0x00000200 // Packet is an IPv4 packet -#define NDIS_NBL_FLAGS_IS_IPV6 0x00000400 // Packet is an IPv6 packet -#define NDIS_NBL_FLAGS_IS_TCP 0x00000800 // Packet is a TCP packet -#define NDIS_NBL_FLAGS_IS_UDP 0x00001000 // Packet is a UDP packet -#define NDIS_NBL_FLAGS_SPLIT_AT_UPPER_LAYER_PROTOCOL_HEADER 0x00002000 // Packet is split at the beginning of upper layer protocol header -#define NDIS_NBL_FLAGS_SPLIT_AT_UPPER_LAYER_PROTOCOL_PAYLOAD 0x00004000 // Packet is split at the beginning of upper layer protocol data (TCP or UDP) -#endif // (NDIS_SUPPORT_NDIS61) - -#define NDIS_NBL_FLAGS_IS_LOOPBACK_PACKET 0x00008000 // The NBL is loopback NBL. - -#define NdisTestNblFlag(_NBL, _F) (((_NBL)->NblFlags & (_F)) != 0) -#define NdisTestNblFlags(_NBL, _F) (((_NBL)->NblFlags & (_F)) == (_F)) -#define NdisSetNblFlag(_NBL, _F) ((_NBL)->NblFlags |= (_F)) -#define NdisClearNblFlag(_NBL, _F) ((_NBL)->NblFlags &= ~(_F)) - - - -#define NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1 1 - -typedef struct _NET_BUFFER_LIST_POOL_PARAMETERS -{ - // - // Set ObjectHeader.Type to NDIS_OBJECT_TYPE_DEFAULT - // - NDIS_OBJECT_HEADER Header; - UCHAR ProtocolId; - BOOLEAN fAllocateNetBuffer; - USHORT ContextSize; - ULONG PoolTag; - ULONG DataSize; -}NET_BUFFER_LIST_POOL_PARAMETERS, *PNET_BUFFER_LIST_POOL_PARAMETERS; - -#define NDIS_SIZEOF_NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NET_BUFFER_LIST_POOL_PARAMETERS, DataSize) - -#define NET_BUFFER_POOL_PARAMETERS_REVISION_1 1 - -typedef struct _NET_BUFFER_POOL_PARAMETERS -{ - // - // Set ObjectHeader.Type to NDIS_OBJECT_TYPE_DEFAULT - // - NDIS_OBJECT_HEADER Header; - ULONG PoolTag; - ULONG DataSize; -}NET_BUFFER_POOL_PARAMETERS,*PNET_BUFFER_POOL_PARAMETERS; - -#define NDIS_SIZEOF_NET_BUFFER_POOL_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NET_BUFFER_POOL_PARAMETERS, DataSize); - -// -// Prototypes of the MDL allocation and free callback. -// - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -PMDL -(*NET_BUFFER_ALLOCATE_MDL_HANDLER)( - __inout PULONG BufferSize - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(*NET_BUFFER_FREE_MDL_HANDLER)( - __in PMDL Mdl - ); - -__checkReturn -__drv_ret(__drv_allocatesMem(mem)) -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_HANDLE -NdisAllocateNetBufferPool( - __in_opt NDIS_HANDLE NdisHandle, - __in PNET_BUFFER_POOL_PARAMETERS Parameters - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreeNetBufferPool( - __in __drv_freesMem(mem) NDIS_HANDLE PoolHandle - ); - -__checkReturn -__drv_ret(__drv_allocatesMem(mem)) -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -PNET_BUFFER -NdisAllocateNetBuffer( - __in NDIS_HANDLE PoolHandle, - __in_opt PMDL MdlChain, - __in ULONG DataOffset, - __in SIZE_T DataLength - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreeNetBuffer( - __in __drv_freesMem(mem) PNET_BUFFER NetBuffer - ); - - -__checkReturn -__drv_ret(__drv_allocatesMem(mem)) -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -PNET_BUFFER -NdisAllocateNetBufferMdlAndData( - __in NDIS_HANDLE PoolHandle - ); - - -__checkReturn -__drv_ret(__drv_allocatesMem(mem)) -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_HANDLE -NdisAllocateNetBufferListPool( - __in_opt NDIS_HANDLE NdisHandle, - __in PNET_BUFFER_LIST_POOL_PARAMETERS Parameters - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreeNetBufferListPool( - __in __drv_freesMem(mem) NDIS_HANDLE PoolHandle - ); - -__checkReturn -__drv_ret(__drv_allocatesMem(mem)) -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -PNET_BUFFER_LIST -NdisAllocateNetBufferList( - __in NDIS_HANDLE PoolHandle, - __in USHORT ContextSize, - __in USHORT ContextBackFill - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreeNetBufferList( - __in __drv_freesMem(mem) PNET_BUFFER_LIST NetBufferList - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisRetreatNetBufferDataStart( - __in PNET_BUFFER NetBuffer, - __in ULONG DataOffsetDelta, - __in ULONG DataBackFill, - __in_opt NET_BUFFER_ALLOCATE_MDL_HANDLER AllocateMdlHandler - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisAdvanceNetBufferDataStart( - __in PNET_BUFFER NetBuffer, - __in ULONG DataOffsetDelta, - __in BOOLEAN FreeMdl, - __in_opt NET_BUFFER_FREE_MDL_HANDLER FreeMdlHandler - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisRetreatNetBufferListDataStart( - __in PNET_BUFFER_LIST NetBufferList, - __in ULONG DataOffsetDelta, - __in ULONG DataBackFill, - __in_opt NET_BUFFER_ALLOCATE_MDL_HANDLER AllocateMdlHandler, - __in_opt NET_BUFFER_FREE_MDL_HANDLER FreeMdlHandler - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisAdvanceNetBufferListDataStart( - __in PNET_BUFFER_LIST NetBufferList, - __in ULONG DataOffsetDelta, - __in BOOLEAN FreeMdl, - __in_opt NET_BUFFER_FREE_MDL_HANDLER FreeMdlMdlHandler - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_when(return==0,__drv_at(NetBufferList->Context, __drv_allocatesMem(mem))) -EXPORT -NDIS_STATUS -NdisAllocateNetBufferListContext( - __in PNET_BUFFER_LIST NetBufferList, - __in USHORT ContextSize, - __in USHORT ContextBackFill, - __in ULONG PoolTag - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_at(NetBufferList->Context, __drv_freesMem(mem)) -EXPORT -VOID -NdisFreeNetBufferListContext( - __in PNET_BUFFER_LIST NetBufferList, - __in USHORT ContextSize - ); - -__checkReturn -__drv_ret(__drv_allocatesMem(mem)) -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -PNET_BUFFER_LIST -NdisAllocateCloneNetBufferList( - __in PNET_BUFFER_LIST OriginalNetBufferList, - __in_opt NDIS_HANDLE NetBufferListPoolHandle, - __in_opt NDIS_HANDLE NetBufferPoolHandle, - __in ULONG AllocateCloneFlags - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreeCloneNetBufferList( - __in __drv_freesMem(mem) PNET_BUFFER_LIST CloneNetBufferList, - __in ULONG FreeCloneFlags - ); - -__checkReturn -__drv_ret(__drv_allocatesMem(mem)) -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -PNET_BUFFER_LIST -NdisAllocateFragmentNetBufferList( - __in PNET_BUFFER_LIST OriginalNetBufferList, - __in_opt NDIS_HANDLE NetBufferListPool, - __in_opt NDIS_HANDLE NetBufferPool, - __in ULONG StartOffset, - __in ULONG MaximumLength, - __in ULONG DataOffsetDelta, - __in ULONG DataBackFill, - __in ULONG AllocateFragmentFlags - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreeFragmentNetBufferList( - __in __drv_freesMem(mem) PNET_BUFFER_LIST FragmentNetBufferList, - __in ULONG DataOffsetDelta, - __in ULONG FreeFragmentFlags - ); - -__checkReturn -__drv_ret(__drv_allocatesMem(mem)) -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -PNET_BUFFER_LIST -NdisAllocateReassembledNetBufferList( - __in PNET_BUFFER_LIST FagmentNetBufferList, - __in_opt NDIS_HANDLE NetBufferAndNetBufferListPoolHandle, - __in ULONG StartOffset, - __in ULONG DataOffsetDelta, - __in ULONG DataBackFill, - __in ULONG AllocateReassembleFlags - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreeReassembledNetBufferList( - __in __drv_freesMem(mem) PNET_BUFFER_LIST ReassembledNetBufferList, - __in ULONG DataOffsetDelta, - __in ULONG FreeReassembleFlags - ); - -__checkReturn -__drv_ret(__drv_allocatesMem(mem)) -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -PNET_BUFFER_LIST -NdisAllocateNetBufferAndNetBufferList( - __in NDIS_HANDLE PoolHandle, - __in USHORT ContextSize, - __in USHORT ContextBackFill, - __in_opt __drv_aliasesMem PMDL MdlChain, - __in ULONG DataOffset, - __in SIZE_T DataLength - ); - -__allocator -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -PVOID -NdisGetDataBuffer( - __in PNET_BUFFER NetBuffer, - __in ULONG BytesNeeded, - __in_opt PVOID Storage, - __in UINT AlignMultiple, - __in UINT AlignOffset - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_HANDLE -NdisGetPoolFromNetBufferList( - __in PNET_BUFFER_LIST NetBufferList - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_HANDLE -NdisGetPoolFromNetBuffer( - __in PNET_BUFFER NetBuffer - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisCopyFromNetBufferToNetBuffer( - __in PNET_BUFFER Destination, - __in ULONG DestinationOffset, - __in ULONG BytesToCopy, - __in PNET_BUFFER Source, - __in ULONG SourceOffset, - __out PULONG BytesCopied - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCopySendNetBufferListInfo( - __in PNET_BUFFER_LIST DestNetBufferList, - __in PNET_BUFFER_LIST SrcNetBufferList - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCopyReceiveNetBufferListInfo( - __in PNET_BUFFER_LIST DestNetBufferList, - __in PNET_BUFFER_LIST SrcNetBufferList - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -ULONG -NdisQueryNetBufferPhysicalCount( - __in PNET_BUFFER NetBuffer - ); - -__checkReturn -__drv_ret(__drv_allocatesMem(mem)) -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -PMDL -NdisAllocateMdl( - __in NDIS_HANDLE NdisHandle, - __in_bcount(Length) - PVOID VirtualAddress, - __in UINT Length - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreeMdl( - __in __drv_freesMem(mem) PMDL Mdl - ); - -// -// The following flags are used in the Send APIs such as Ndis(F)SendNetBufferLists -// and MINIPORT_SEND_NET_BUFFER_LISTS_HANDLER -// -#define NDIS_SEND_FLAGS_DISPATCH_LEVEL 0x00000001 -#define NDIS_SEND_FLAGS_CHECK_FOR_LOOPBACK 0x00000002 -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_SEND_FLAGS_SINGLE_QUEUE 0x00000004 -#endif - -#define NDIS_TEST_SEND_FLAG(_Flags, _Fl) (((_Flags) & (_Fl)) == (_Fl)) -#define NDIS_SET_SEND_FLAG(_Flags, _Fl) ((_Flags) |= (_Fl)) - -#define NDIS_TEST_SEND_AT_DISPATCH_LEVEL(_Flags) \ - NDIS_TEST_SEND_FLAG((_Flags), NDIS_SEND_FLAGS_DISPATCH_LEVEL) - -// -// The following flags are used in the SendComplete APIs such as -// NdisMSendNetBufferListsComplete -// -#define NDIS_SEND_COMPLETE_FLAGS_DISPATCH_LEVEL 0x00000001 -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_SEND_COMPLETE_FLAGS_SINGLE_QUEUE 0x00000002 -#endif - - -#define NDIS_TEST_SEND_COMPLETE_FLAG(_Flags, _Fl) (((_Flags) & (_Fl)) == (_Fl)) -#define NDIS_SET_SEND_COMPLETE_FLAG(_Flags, _Fl) ((_Flags) |= (_Fl)) - -#define NDIS_TEST_SEND_COMPLETE_AT_DISPATCH_LEVEL(_Flags) \ - NDIS_TEST_SEND_COMPLETE_FLAG((_Flags), NDIS_SEND_COMPLETE_FLAGS_DISPATCH_LEVEL) - -// -// The following flags are used in the IndicateReceive APIs such -// as NdisMIndicateReceiveNetBufferLists and RECEIVE_NET_BUFFER_LISTS_HANDLER -// -#define NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL 0x00000001 -#define NDIS_RECEIVE_FLAGS_RESOURCES 0x00000002 -#define NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE 0x00000100 -#define NDIS_RECEIVE_FLAGS_SINGLE_VLAN 0x00000200 -#define NDIS_RECEIVE_FLAGS_PERFECT_FILTERED 0x00000400 -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_RECEIVE_FLAGS_SINGLE_QUEUE 0x00000800 -#define NDIS_RECEIVE_FLAGS_SHARED_MEMORY_INFO_VALID 0x00001000 -#define NDIS_RECEIVE_FLAGS_MORE_NBLS 0x00002000 -#endif - - -#define NDIS_TEST_RECEIVE_FLAG(_Flags, _Fl) (((_Flags) & (_Fl)) == (_Fl)) -#define NDIS_SET_RECEIVE_FLAG(_Flags, _Fl) ((_Flags) |= (_Fl)) - -#define NDIS_TEST_RECEIVE_AT_DISPATCH_LEVEL(_Flags) \ - NDIS_TEST_RECEIVE_FLAG((_Flags), NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL) - -#define NDIS_TEST_RECEIVE_CANNOT_PEND(_Flags) \ - NDIS_TEST_RECEIVE_FLAG((_Flags), NDIS_RECEIVE_FLAGS_RESOURCES) - -#define NDIS_TEST_RECEIVE_CAN_PEND(_Flags) \ - (((_Flags) & NDIS_RECEIVE_FLAGS_RESOURCES) == 0) -// -// The following flags are used in the ReturnNetBufferLists APIs such -// as NdisReturnNetBufferLists and MINIPORT_RETURN_NET_BUFFER_LISTS -// -#define NDIS_RETURN_FLAGS_DISPATCH_LEVEL 0x00000001 -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_RETURN_FLAGS_SINGLE_QUEUE 0x00000002 -#endif - - -#define NDIS_TEST_RETURN_FLAG(_Flags, _Fl) (((_Flags) & (_Fl)) == (_Fl)) -#define NDIS_SET_RETURN_FLAG(_Flags, _Fl) ((_Flags) |= (_Fl)) - -#define NDIS_TEST_RETURN_AT_DISPATCH_LEVEL(_Flags) \ - NDIS_TEST_RETURN_FLAG((_Flags),NDIS_RETURN_FLAGS_DISPATCH_LEVEL) - - -// -// The following flags are used in the NdisAllocateCloneNetBufferList -// and NdisFreeCloneNetBufferList -// - -#define NDIS_CLONE_FLAGS_RESERVED 0x00000001 -#define NDIS_CLONE_FLAGS_USE_ORIGINAL_MDLS 0x00000002 - -#define NDIS_TEST_CLONE_FLAG(_Flags, _Fl) (((_Flags) & (_Fl)) == (_Fl)) -#define NDIS_SET_CLONE_FLAG(_Flags, _Fl) ((_Flags) |= (_Fl)) -#define NDIS_CLEAR_CLONE_FLAG(_Flags, _Fl) ((_Flags) &= ~(_Fl)) - - -#endif // (NDIS_SUPPORT_NDIS6 || NDIS60) - -#pragma warning(pop) - - -#pragma once -#pragma warning(push) - -#pragma warning(disable:4201) // (nonstandard extension used : nameless struct/union) -#pragma warning(disable:4214) // (extension used : bit field types other than int) - -#define NDIS_TASK_OFFLOAD_VERSION 1 - -#define MAX_HASHES 4 -#define TRUNCATED_HASH_LEN 12 - -#define CRYPTO_SUCCESS 0 -#define CRYPTO_GENERIC_ERROR 1 -#define CRYPTO_TRANSPORT_AH_AUTH_FAILED 2 -#define CRYPTO_TRANSPORT_ESP_AUTH_FAILED 3 -#define CRYPTO_TUNNEL_AH_AUTH_FAILED 4 -#define CRYPTO_TUNNEL_ESP_AUTH_FAILED 5 -#define CRYPTO_INVALID_PACKET_SYNTAX 6 -#define CRYPTO_INVALID_PROTOCOL 7 - -#if NDIS_LEGACY_DRIVER -typedef struct _NDIS_IPSEC_PACKET_INFO -{ - union - { - struct - { - NDIS_HANDLE OffloadHandle; - NDIS_HANDLE NextOffloadHandle; - - } Transmit; - - struct - { - ULONG SA_DELETE_REQ:1; - ULONG CRYPTO_DONE:1; - ULONG NEXT_CRYPTO_DONE:1; - ULONG CryptoStatus; - } Receive; - }; -} NDIS_IPSEC_PACKET_INFO, *PNDIS_IPSEC_PACKET_INFO; -#endif // NDIS_LEGACY_DRIVER - -#if (NDIS_SUPPORT_NDIS6 || NDIS60) -typedef struct _NDIS_IPSEC_OFFLOAD_V1_NET_BUFFER_LIST_INFO -{ - union - { - struct - { - NDIS_HANDLE OffloadHandle; - - } Transmit; - - struct - { - USHORT SaDeleteReq:1; - USHORT CryptoDone:1; - USHORT NextCryptoDone:1; - USHORT Pad:13; - USHORT CryptoStatus; - } Receive; - }; -} NDIS_IPSEC_OFFLOAD_V1_NET_BUFFER_LIST_INFO, *PNDIS_IPSEC_OFFLOAD_V1_NET_BUFFER_LIST_INFO; -#endif // (NDIS_SUPPORT_NDIS6 || NDIS60) - -#if NDIS_LEGACY_DRIVER -// -// The following defines are used in the Task field above to define -// the type of task offloading necessary. -// -typedef enum _NDIS_TASK -{ - TcpIpChecksumNdisTask, - IpSecNdisTask, - TcpLargeSendNdisTask, - MaxNdisTask -} NDIS_TASK, *PNDIS_TASK; - - -typedef enum _NDIS_ENCAPSULATION -{ - UNSPECIFIED_Encapsulation, - NULL_Encapsulation, - IEEE_802_3_Encapsulation, - IEEE_802_5_Encapsulation, - LLC_SNAP_ROUTED_Encapsulation, - LLC_SNAP_BRIDGED_Encapsulation - -} NDIS_ENCAPSULATION; - -// -// Encapsulation header format -// -typedef struct _NDIS_ENCAPSULATION_FORMAT -{ - NDIS_ENCAPSULATION Encapsulation; // Encapsulation type - struct - { - ULONG FixedHeaderSize:1; - ULONG Reserved:31; - } Flags; - - ULONG EncapsulationHeaderSize; // Encapsulation header size - -} NDIS_ENCAPSULATION_FORMAT,*PNDIS_ENCAPSULATION_FORMAT; - - -// -// OFFLOAD header structure for OID_TCP_TASK_OFFLOAD -// -typedef struct _NDIS_TASK_OFFLOAD_HEADER -{ - ULONG Version; // set to NDIS_TASK_OFFLOAD_VERSION - ULONG Size; // Size of this structure - ULONG Reserved; // Reserved for future use - ULONG OffsetFirstTask; // Offset to the first - NDIS_ENCAPSULATION_FORMAT EncapsulationFormat; // Encapsulation information. - // NDIS_TASK_OFFLOAD structure(s) - -} NDIS_TASK_OFFLOAD_HEADER, *PNDIS_TASK_OFFLOAD_HEADER; - - -// -// Task offload Structure, which follows the above header in ndis query -// -typedef struct _NDIS_TASK_OFFLOAD -{ - ULONG Version; // NDIS_TASK_OFFLOAD_VERSION - ULONG Size; // Size of this structure. Used for version checking. - NDIS_TASK Task; // Task. - ULONG OffsetNextTask; // Offset to the next NDIS_TASK_OFFLOAD - ULONG TaskBufferLength; // Length of the task offload information. - UCHAR TaskBuffer[1]; // The task offload information. -} NDIS_TASK_OFFLOAD, *PNDIS_TASK_OFFLOAD; - -// -// Offload structure for NDIS_TASK_TCP_IP_CHECKSUM -// -typedef struct _NDIS_TASK_TCP_IP_CHECKSUM -{ - struct - { - ULONG IpOptionsSupported:1; - ULONG TcpOptionsSupported:1; - ULONG TcpChecksum:1; - ULONG UdpChecksum:1; - ULONG IpChecksum:1; - } V4Transmit; - - struct - { - ULONG IpOptionsSupported:1; - ULONG TcpOptionsSupported:1; - ULONG TcpChecksum:1; - ULONG UdpChecksum:1; - ULONG IpChecksum:1; - } V4Receive; - - - struct - { - ULONG IpOptionsSupported:1; // This field implies IpExtensionHeaders support - ULONG TcpOptionsSupported:1; - ULONG TcpChecksum:1; - ULONG UdpChecksum:1; - - } V6Transmit; - - struct - { - ULONG IpOptionsSupported:1; // This field implies IpExtensionHeaders support - ULONG TcpOptionsSupported:1; - ULONG TcpChecksum:1; - ULONG UdpChecksum:1; - - } V6Receive; - - -} NDIS_TASK_TCP_IP_CHECKSUM, *PNDIS_TASK_TCP_IP_CHECKSUM; - -// -// Off-load structure for NDIS_TASK_TCP_LARGE_SEND -// -#define NDIS_TASK_TCP_LARGE_SEND_V0 0 - -typedef struct _NDIS_TASK_TCP_LARGE_SEND -{ - ULONG Version; // set to NDIS_TASK_TCP_LARGE_SEND_V0 - ULONG MaxOffLoadSize; - ULONG MinSegmentCount; - BOOLEAN TcpOptions; - BOOLEAN IpOptions; - -} NDIS_TASK_TCP_LARGE_SEND, *PNDIS_TASK_TCP_LARGE_SEND; - - -typedef struct _NDIS_TASK_IPSEC -{ - struct - { - ULONG AH_ESP_COMBINED; - ULONG TRANSPORT_TUNNEL_COMBINED; - ULONG V4_OPTIONS; - ULONG RESERVED; - } Supported; - - struct - { - ULONG MD5:1; - ULONG SHA_1:1; - ULONG Transport:1; - ULONG Tunnel:1; - ULONG Send:1; - ULONG Receive:1; - } V4AH; - - struct - { - ULONG DES:1; - ULONG RESERVED:1; - ULONG TRIPLE_DES:1; - ULONG NULL_ESP:1; - ULONG Transport:1; - ULONG Tunnel:1; - ULONG Send:1; - ULONG Receive:1; - } V4ESP; - -} NDIS_TASK_IPSEC, *PNDIS_TASK_IPSEC; -#endif // NDIS_LEGACY_DRIVER - -// -// flags used in NDIS_TASK_IPSEC->Supprted.RESERVED and -// NDIS_IPSEC_OFFLOAD_V1->Supported.Flags -// -#define IPSEC_TPT_UDPESP_ENCAPTYPE_IKE 0x00000001 -#define IPSEC_TUN_UDPESP_ENCAPTYPE_IKE 0x00000002 -#define IPSEC_TPTOVERTUN_UDPESP_ENCAPTYPE_IKE 0x00000004 -#define IPSEC_TPT_UDPESP_OVER_PURE_TUN_ENCAPTYPE_IKE 0x00000008 -#define IPSEC_TPT_UDPESP_ENCAPTYPE_OTHER 0x00000010 -#define IPSEC_TUN_UDPESP_ENCAPTYPE_OTHER 0x00000020 -#define IPSEC_TPTOVERTUN_UDPESP_ENCAPTYPE_OTHER 0x00000040 -#define IPSEC_TPT_UDPESP_OVER_PURE_TUN_ENCAPTYPE_OTHER 0x00000080 - - -#if (NDIS_SUPPORT_NDIS6 || NDIS60) - -// -// The definitions for the NDIS_TCP_LARGE_SEND_OFFLOAD_NET_BUFFER_LIST_INFO.Transmit.Type -// A miniport will use this definition to identify what offload type to use -// on the NetBufferList -// -#define NDIS_TCP_LARGE_SEND_OFFLOAD_V1_TYPE 0 -#define NDIS_TCP_LARGE_SEND_OFFLOAD_V2_TYPE 1 - -// -// IP protocol version encoded in IPVersion field of -// NDIS_TCP_LARGE_SEND_OFFLOAD_NET_BUFFER_LIST_INFO->LsoV2Transmit.IPVersion -// -#define NDIS_TCP_LARGE_SEND_OFFLOAD_IPv4 0 -#define NDIS_TCP_LARGE_SEND_OFFLOAD_IPv6 1 - -// -// The maximum length of the headers (MAC+IP+IP option or extension headers+TCP+TCP options) -// when stack does large send offload. If header is bigger than this value, it will not do -// LSO -// -#define NDIS_LARGE_SEND_OFFLOAD_MAX_HEADER_LENGTH 128 - -// -// This structure is used in the OOB TcpLargeSendNetBufferListInfo. -// -typedef struct _NDIS_TCP_LARGE_SEND_OFFLOAD_NET_BUFFER_LIST_INFO -{ - union - { - struct - { - ULONG Unused:30; - ULONG Type:1; - ULONG Reserved2:1; - } Transmit; - - struct - { - ULONG MSS:20; - ULONG TcpHeaderOffset:10; - ULONG Type:1; - ULONG Reserved2:1; - } LsoV1Transmit; - - struct - { - ULONG TcpPayload:30; - ULONG Type:1; - ULONG Reserved2:1; - } LsoV1TransmitComplete; - - struct - { - ULONG MSS:20; - ULONG TcpHeaderOffset:10; - ULONG Type:1; - ULONG IPVersion:1; - } LsoV2Transmit; - - struct - { - ULONG Reserved:30; - ULONG Type:1; - ULONG Reserved2:1; - } LsoV2TransmitComplete; - - PVOID Value; - }; -} NDIS_TCP_LARGE_SEND_OFFLOAD_NET_BUFFER_LIST_INFO,*PNDIS_TCP_LARGE_SEND_OFFLOAD_NET_BUFFER_LIST_INFO; - - -// -// Per-NetBufferList information for TcpIpChecksumNetBufferListInfo. -// -typedef struct _NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO -{ - union - { - struct - { - ULONG IsIPv4:1; - ULONG IsIPv6:1; - ULONG TcpChecksum:1; - ULONG UdpChecksum:1; - ULONG IpHeaderChecksum:1; - ULONG Reserved:11; - ULONG TcpHeaderOffset:10; - } Transmit; - - struct - { - ULONG TcpChecksumFailed:1; - ULONG UdpChecksumFailed:1; - ULONG IpChecksumFailed:1; - ULONG TcpChecksumSucceeded:1; - ULONG UdpChecksumSucceeded:1; - ULONG IpChecksumSucceeded:1; - ULONG Loopback:1; - } Receive; - - PVOID Value; - }; -} NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO, *PNDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO; - -// -// used in NDIS_STATUS_OFFLOAD_ENCASPULATION_CHANGE status indication and -// and OID_OFFLOAD_ENCAPSULATION OID request -// -#define NDIS_OFFLOAD_ENCAPSULATION_REVISION_1 1 - -typedef struct _NDIS_OFFLOAD_ENCAPSULATION -{ - // - // Header.Type = NDIS_OBJECT_TYPE_OFFLOAD_ENCAPSULATION; - // Header.Size = sizeof(NDIS_OFFLOAD_ENCAPSULATION); - // Header.Revision = NDIS_OFFLOAD_ENCAPSULATION_REVISION_1; - // - - NDIS_OBJECT_HEADER Header; - - struct - { - // - // A Protocol sets Enable to NDIS_OFFLOAD_SET_ON if it is enabling IPv4 LSO, - // or XSum offloads - // otherwise it is set to NDIS_OFFLOAD_SET_NO_CHANGE - // - ULONG Enabled; - - // - // If Enabled is TRUE, a Protocol must set this to - // either NDIS_ENCAPSULATION_IEEE_802_3 - // or NDIS_ENCAPSULATION_IEEE_LLC_SNAP_ROUTED - // - ULONG EncapsulationType; - - // - // If Enabled is TRUE, a protocol must set this field to the - // HeaderSize it uses - // - ULONG HeaderSize; - } IPv4; - - - struct - { - // - // A Protocol sets Enable to NDIS_OFFLOAD_SET_ON if it is enabling IPv6 LSO, - // or XSum offloads - // otherwise it is set to NDIS_OFFLOAD_SET_NO_CHANGE - // - ULONG Enabled; - // - // If Enabled is TRUE, a Protocol must set this to - // either NDIS_ENCAPSULATION_IEEE_802_3 - // or NDIS_ENCAPSULATION_IEEE_LLC_SNAP_ROUTED - // - ULONG EncapsulationType; - - // - // If Enabled is TRUE, a protocol must set this field to the - // HeaderSize it uses - // - ULONG HeaderSize; - } IPv6; - -}NDIS_OFFLOAD_ENCAPSULATION, *PNDIS_OFFLOAD_ENCAPSULATION; - -#define NDIS_SIZEOF_OFFLOAD_ENCAPSULATION_REVISION_1 RTL_SIZEOF_THROUGH_FIELD(NDIS_OFFLOAD_ENCAPSULATION, IPv6.HeaderSize) - -#if (NDIS_SUPPORT_NDIS61) -// -// Per-NetBufferList information for IPsecOffloadV2NetBufferListInfo. -// -typedef struct _NDIS_IPSEC_OFFLOAD_V2_NET_BUFFER_LIST_INFO -{ - union - { - struct - { - PVOID OffloadHandle; - } Transmit; - - struct - { - ULONG SaDeleteReq:1; - ULONG CryptoDone:1; - ULONG NextCryptoDone:1; // Required for transport over tunnel - ULONG Reserved:13; - ULONG CryptoStatus:16; - } Receive; - }; -} NDIS_IPSEC_OFFLOAD_V2_NET_BUFFER_LIST_INFO, *PNDIS_IPSEC_OFFLOAD_V2_NET_BUFFER_LIST_INFO; - -// -// Per-NetBufferList information for IPsecOffloadV2TunnelNetBufferListInfo. -// -typedef struct _NDIS_IPSEC_OFFLOAD_V2_TUNNEL_NET_BUFFER_LIST_INFO -{ - struct - { - NDIS_HANDLE TunnelHandle; // Tunnel SA handle in Transport over tunnel - } Transmit; -} NDIS_IPSEC_OFFLOAD_V2_TUNNEL_NET_BUFFER_LIST_INFO, *PNDIS_IPSEC_OFFLOAD_V2_TUNNEL_NET_BUFFER_LIST_INFO; - -// -// Per-NetBufferList information for IPsecOffloadV2HeaderNetBufferListInfo. -// -typedef struct _NDIS_IPSEC_OFFLOAD_V2_HEADER_NET_BUFFER_LIST_INFO -{ - union - { - struct - { - ULONG NextHeader:8; // Next Header value is the one carried in ESP trailer - ULONG PadLength:8; - ULONG AhHeaderOffset:8; // This is offset from beginning of IP Header and is measured in 4 byte increments - ULONG EspHeaderOffset:8; // This is offset from beginning of IP Header and is measured in 4 byte increments - } Transmit; - - struct - { - ULONG NextHeader:8; - ULONG PadLength:8; - ULONG HeaderInfoSet:1; - } Receive; - }; -} NDIS_IPSEC_OFFLOAD_V2_HEADER_NET_BUFFER_LIST_INFO, *PNDIS_IPSEC_OFFLOAD_V2_HEADER_NET_BUFFER_LIST_INFO; - -// -// Used in IPSEC_OFFLOAD_V2_ADD_SA.SecAssoc -// -#define IPSEC_OFFLOAD_V2_MAX_EXTENSION_HEADERS 2 - -// -// used in IPSEC_OFFLOAD_V2_ADD_SA.UdpEspEncapsulation and -// NDIS_IPSEC_OFFLOAD_V2.UdpEsp -// -#define IPSEC_OFFLOAD_V2_UDP_ESP_ENCAPSULATION_NONE 0x00000000 -#define IPSEC_OFFLOAD_V2_UDP_ESP_ENCAPSULATION_TRANSPORT 0x00000001 -#define IPSEC_OFFLOAD_V2_UDP_ESP_ENCAPSULATION_TUNNEL 0x00000002 -#define IPSEC_OFFLOAD_V2_TRANSPORT_OVER_UDP_ESP_ENCAPSULATION_TUNNEL 0x00000004 -#define IPSEC_OFFLOAD_V2_UDP_ESP_ENCAPSULATION_TRANSPORT_OVER_TUNNEL 0x00000008 - -// -// used in IPSEC_OFFLOAD_V2_SECURITY_ASSOCIATION.Flags -// -#define IPSEC_OFFLOAD_V2_ESN_SA 0x00000001 - -// -// used in IPSEC_OFFLOAD_V2_SECURITY_ASSOCIATION.Operation -// -typedef enum _IPSEC_OFFLOAD_V2_OPERATION -{ - IPsecOffloadV2Ah = 1, - IPsecOffloadV2Esp, - IPsecOffloadV2Max -} IPSEC_OFFLOAD_V2_OPERATION, *PIPSEC_OFFLOAD_V2_OPERATION; - -// -// used in IPSEC_OFFLOAD_V2_SECURITY_ASSOCIATION.Spi -// -typedef ULONG IPSEC_OFFLOAD_V2_SPI_TYPE; - -// -// used in AuthenticationAlgorithm and EncryptionAlgorithm fields -// of IPSEC_OFFLOAD_V2_SECURITY_ASSOCIATION structure -// -typedef struct _IPSEC_OFFLOAD_V2_ALGORITHM_INFO -{ - ULONG Identifier; - ULONG KeyLength; - ULONG KeyOffsetBytes; - ULONG AdditionalInfo; -} IPSEC_OFFLOAD_V2_ALGORITHM_INFO, *PIPSEC_OFFLOAD_V2_ALGORITHM_INFO; - -// -// used in IPSEC_OFFLOAD_V2_ADD_SA.SecAssoc -// -typedef struct _IPSEC_OFFLOAD_V2_SECURITY_ASSOCIATION -{ - ULONG Flags; - IPSEC_OFFLOAD_V2_OPERATION Operation; // AH - SA is used for AH, ESP - SA is used for ESP - IPSEC_OFFLOAD_V2_SPI_TYPE Spi; - IPSEC_OFFLOAD_V2_ALGORITHM_INFO AuthenticationAlgorithm; - IPSEC_OFFLOAD_V2_ALGORITHM_INFO EncryptionAlgorithm; - ULONG SequenceNumberHighOrder; -} IPSEC_OFFLOAD_V2_SECURITY_ASSOCIATION, *PIPSEC_OFFLOAD_V2_SECURITY_ASSOCIATION; - -// -// used in IPSEC_OFFLOAD_V2_ADD_SA.Flags -// -#define IPSEC_OFFLOAD_V2_INBOUND 0x00000001 -#define IPSEC_OFFLOAD_V2_IPv6 0x00000010 - -// -// used in OID_TCP_TASK_IPSEC_OFFLOAD_V2_ADD_SA -// -typedef struct _IPSEC_OFFLOAD_V2_ADD_SA IPSEC_OFFLOAD_V2_ADD_SA, *PIPSEC_OFFLOAD_V2_ADD_SA; - -#define NDIS_IPSEC_OFFLOAD_V2_ADD_SA_REVISION_1 1 - -typedef struct _IPSEC_OFFLOAD_V2_ADD_SA -{ - // - // Header.Type = NDIS_OBJECT_TYPE_DEFAULT; - // Header.Revision = NDIS_IPSEC_OFFLOAD_V2_ADD_SA_REVISION_1; - // Header.Size = sizeof(IPSEC_OFFLOAD_V2_ADD_SA); - // - NDIS_OBJECT_HEADER Header; - PIPSEC_OFFLOAD_V2_ADD_SA Next; - ULONG NumExtHdrs; - ULONG Flags; - - union - { - struct - { - IPAddr SrcAddr; - IPAddr DestAddr; - } IPv4Endpoints; - - struct - { - UCHAR SrcAddr[16]; - UCHAR DestAddr[16]; - } IPv6Endpoints; - }; - - NDIS_HANDLE OffloadHandle; - ULONG UdpEspEncapsulation; - IPSEC_OFFLOAD_V2_SECURITY_ASSOCIATION SecAssoc[IPSEC_OFFLOAD_V2_MAX_EXTENSION_HEADERS]; - ULONG KeyLength; - UCHAR KeyData[1]; -} IPSEC_OFFLOAD_V2_ADD_SA, *PIPSEC_OFFLOAD_V2_ADD_SA; - -#define NDIS_SIZEOF_IPSEC_OFFLOAD_V2_ADD_SA_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(IPSEC_OFFLOAD_V2_ADD_SA, KeyData) - -// -// used in OID_TCP_TASK_IPSEC_OFFLOAD_V2_DELETE_SA -// -typedef struct _IPSEC_OFFLOAD_V2_DELETE_SA IPSEC_OFFLOAD_V2_DELETE_SA, *PIPSEC_OFFLOAD_V2_DELETE_SA; - -#define NDIS_IPSEC_OFFLOAD_V2_DELETE_SA_REVISION_1 1 - -typedef struct _IPSEC_OFFLOAD_V2_DELETE_SA -{ - // - // Header.Type = NDIS_OBJECT_TYPE_DEFAULT; - // Header.Revision = NDIS_IPSEC_OFFLOAD_V2_DELETE_SA_REVISION_1; - // Header.Size = sizeof(IPSEC_OFFLOAD_V2_DELETE_SA); - // - NDIS_OBJECT_HEADER Header; - PIPSEC_OFFLOAD_V2_DELETE_SA Next; - NDIS_HANDLE OffloadHandle; -} IPSEC_OFFLOAD_V2_DELETE_SA, *PIPSEC_OFFLOAD_V2_DELETE_SA; - -#define NDIS_SIZEOF_IPSEC_OFFLOAD_V2_DELETE_SA_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(IPSEC_OFFLOAD_V2_DELETE_SA, OffloadHandle) - -// -// Structure and defines used in -// OID_TCP_TASK_IPSEC_OFFLOAD_V2_UPDATE_SA -// - -#define NDIS_IPSEC_OFFLOAD_V2_UPDATE_SA_REVISION_1 1 - -typedef struct _IPSEC_OFFLOAD_V2_UPDATE_SA -{ - // - // Header.Type = NDIS_OBJECT_TYPE_DEFAULT; - // Header.Revision = NDIS_IPSEC_OFFLOAD_V2_UPDATE_SA_REVISION_1; - // Header.Size = sizeof(IPSEC_OFFLOAD_V2_UPDATE_SA); - // - NDIS_OBJECT_HEADER Header; - NDIS_HANDLE OffloadHandle; - IPSEC_OFFLOAD_V2_OPERATION Operation; - IPSEC_OFFLOAD_V2_SPI_TYPE Spi; - ULONG SequenceNumberHighOrder; -} IPSEC_OFFLOAD_V2_UPDATE_SA, *PIPSEC_OFFLOAD_V2_UPDATE_SA; - -#define NDIS_SIZEOF_IPSEC_OFFLOAD_V2_UPDATE_SA_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(IPSEC_OFFLOAD_V2_UPDATE_SA, SequenceNumberHighOrder) - -#endif // (NDIS_SUPPORT_NDIS61) - -#endif // (NDIS_SUPPORT_NDIS6 || NDIS60) - -#pragma warning(pop) - - - -#pragma once - -#if NDIS_LEGACY_PROTOCOL - -// -// Function types for NDIS_PROTOCOL_CHARACTERISTICS -// - -typedef -VOID -(*OPEN_ADAPTER_COMPLETE_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext, - __in NDIS_STATUS Status, - __in NDIS_STATUS OpenErrorStatus - ); - -typedef -VOID -(*CLOSE_ADAPTER_COMPLETE_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext, - __in NDIS_STATUS Status - ); - -typedef -VOID -(*RESET_COMPLETE_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext, - __in NDIS_STATUS Status - ); - -typedef -VOID -(*REQUEST_COMPLETE_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext, - __in PNDIS_REQUEST NdisRequest, - __in NDIS_STATUS Status - ); - -typedef -VOID -(*STATUS_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext, - __in NDIS_STATUS GeneralStatus, - __in PVOID StatusBuffer, - __in UINT StatusBufferSize - ); - -typedef -VOID -(*STATUS_COMPLETE_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext - ); - -typedef -VOID -(*SEND_COMPLETE_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext, - __in PNDIS_PACKET Packet, - __in NDIS_STATUS Status - ); - -typedef -VOID -(*WAN_SEND_COMPLETE_HANDLER) ( - __in NDIS_HANDLE ProtocolBindingContext, - __in PNDIS_WAN_PACKET Packet, - __in NDIS_STATUS Status - ); - -typedef -VOID -(*TRANSFER_DATA_COMPLETE_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext, - __in PNDIS_PACKET Packet, - __in NDIS_STATUS Status, - __in UINT BytesTransferred - ); - -typedef -VOID -(*WAN_TRANSFER_DATA_COMPLETE_HANDLER)( - VOID - ); - -typedef -NDIS_STATUS -(*RECEIVE_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext, - __in NDIS_HANDLE MacReceiveContext, - __in PVOID HeaderBuffer, - __in UINT HeaderBufferSize, - __in PVOID LookAheadBuffer, - __in UINT LookaheadBufferSize, - __in UINT PacketSize - ); - -typedef -NDIS_STATUS -(*WAN_RECEIVE_HANDLER)( - __in NDIS_HANDLE NdisLinkHandle, - __in PUCHAR Packet, - __in ULONG PacketSize - ); - -typedef -VOID -(*RECEIVE_COMPLETE_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext - ); - -// -// Function types extensions for NDIS 4.0 Protocols -// -typedef -INT -(*RECEIVE_PACKET_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext, - __in PNDIS_PACKET Packet - ); - -typedef -VOID -(*BIND_HANDLER)( - __out PNDIS_STATUS Status, - __in NDIS_HANDLE BindContext, - __in PNDIS_STRING DeviceName, - __in PVOID SystemSpecific1, - __in PVOID SystemSpecific2 - ); - -typedef -VOID -(*UNBIND_HANDLER)( - __out PNDIS_STATUS Status, - __in NDIS_HANDLE ProtocolBindingContext, - __in NDIS_HANDLE UnbindContext - ); - -typedef -NDIS_STATUS -(*PNP_EVENT_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext, - __in PNET_PNP_EVENT NetPnPEvent - ); - - -typedef -VOID -(*UNLOAD_PROTOCOL_HANDLER)( - VOID - ); - -// -// Protocol characteristics for NDIS 4.0 protocols -// -typedef struct _NDIS40_PROTOCOL_CHARACTERISTICS -{ - UCHAR MajorNdisVersion; - UCHAR MinorNdisVersion; - USHORT Filler; - union - { - UINT Reserved; - UINT Flags; - }; - OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler; - CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler; - union - { - SEND_COMPLETE_HANDLER SendCompleteHandler; - WAN_SEND_COMPLETE_HANDLER WanSendCompleteHandler; - }; - union - { - TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler; - WAN_TRANSFER_DATA_COMPLETE_HANDLER WanTransferDataCompleteHandler; - }; - - RESET_COMPLETE_HANDLER ResetCompleteHandler; - REQUEST_COMPLETE_HANDLER RequestCompleteHandler; - union - { - RECEIVE_HANDLER ReceiveHandler; - WAN_RECEIVE_HANDLER WanReceiveHandler; - }; - RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler; - STATUS_HANDLER StatusHandler; - STATUS_COMPLETE_HANDLER StatusCompleteHandler; - NDIS_STRING Name; - - // - // Start of NDIS 4.0 extensions. - // - RECEIVE_PACKET_HANDLER ReceivePacketHandler; - - // - // PnP protocol entry-points - // - BIND_HANDLER BindAdapterHandler; - UNBIND_HANDLER UnbindAdapterHandler; - PNP_EVENT_HANDLER PnPEventHandler; - UNLOAD_PROTOCOL_HANDLER UnloadHandler; - -} NDIS40_PROTOCOL_CHARACTERISTICS; - -#endif - -#if NDIS_LEGACY_DRIVER - -// -// NDIS 5.0 co-NDIS Protocol handler proto-types - used by clients as well as call manager modules -// -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -VOID -(*CO_SEND_COMPLETE_HANDLER)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE ProtocolVcContext, - __in PNDIS_PACKET Packet - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(*CO_STATUS_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext, - __in_opt NDIS_HANDLE ProtocolVcContext, - __in NDIS_STATUS GeneralStatus, - __in PVOID StatusBuffer, - __in UINT StatusBufferSize - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -UINT -(*CO_RECEIVE_PACKET_HANDLER)( - __in NDIS_HANDLE ProtocolBindingContext, - __in NDIS_HANDLE ProtocolVcContext, - __in PNDIS_PACKET Packet - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(*CO_REQUEST_HANDLER)( - __in NDIS_HANDLE ProtocolAfContext, - __in_opt NDIS_HANDLE ProtocolVcContext, - __in_opt NDIS_HANDLE ProtocolPartyContext, - __inout PNDIS_REQUEST NdisRequest - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(*CO_REQUEST_COMPLETE_HANDLER)( - __in NDIS_STATUS Status, - __in_opt NDIS_HANDLE ProtocolAfContext, - __in_opt NDIS_HANDLE ProtocolVcContext, - __in_opt NDIS_HANDLE ProtocolPartyContext, - __in PNDIS_REQUEST NdisRequest - ); - -#endif // NDIS_LEGACY_DRIVER - -#if (NDIS_SUPPORT_NDIS6 || defined(NDIS60)) -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CO_OID_REQUEST)( - __in NDIS_HANDLE ProtocolAfContext, - __in_opt NDIS_HANDLE ProtocolVcContext, - __in_opt NDIS_HANDLE ProtocolPartyContext, - __inout PNDIS_OID_REQUEST OidRequest - ); - -typedef PROTOCOL_CO_OID_REQUEST (*CO_OID_REQUEST_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CO_OID_REQUEST_COMPLETE)( - __in_opt NDIS_HANDLE ProtocolAfContext, - __in_opt NDIS_HANDLE ProtocolVcContext, - __in_opt NDIS_HANDLE ProtocolPartyContext, - __in PNDIS_OID_REQUEST OidRequest, - __in NDIS_STATUS Status - ); - -typedef PROTOCOL_CO_OID_REQUEST_COMPLETE (*CO_OID_REQUEST_COMPLETE_HANDLER); - -#endif // (NDIS_SUPPORT_NDIS6 || defined(NDIS60)) - -// -// CO_CREATE_VC_HANDLER and CO_DELETE_VC_HANDLER are synchronous calls -// the following APIs are used by NDIS 6 protocols as well as NDIS 5 protocols -// -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CO_CREATE_VC)( - __in NDIS_HANDLE ProtocolAfContext, - __in NDIS_HANDLE NdisVcHandle, - __out PNDIS_HANDLE ProtocolVcContext - ); - -typedef PROTOCOL_CO_CREATE_VC (*CO_CREATE_VC_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CO_DELETE_VC)( - __in NDIS_HANDLE ProtocolVcContext - ); - -typedef PROTOCOL_CO_DELETE_VC (*CO_DELETE_VC_HANDLER); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -VOID -(PROTCOL_CO_AF_REGISTER_NOTIFY)( - __in NDIS_HANDLE ProtocolBindingContext, - __in PCO_ADDRESS_FAMILY AddressFamily - ); -typedef PROTCOL_CO_AF_REGISTER_NOTIFY (*CO_AF_REGISTER_NOTIFY_HANDLER); - -#if NDIS_LEGACY_PROTOCOL - -typedef struct _NDIS50_PROTOCOL_CHARACTERISTICS -{ -#ifdef __cplusplus - NDIS40_PROTOCOL_CHARACTERISTICS Ndis40Chars; -#else - NDIS40_PROTOCOL_CHARACTERISTICS; -#endif - - // - // Placeholders for protocol extensions for PnP/PM etc. - // - PVOID ReservedHandlers[4]; - - // - // Start of NDIS 5.0 extensions. - // - - CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler; - CO_STATUS_HANDLER CoStatusHandler; - CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler; - CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler; - -} NDIS50_PROTOCOL_CHARACTERISTICS; - -#endif // NDIS_LEGACY_PROTOCOL - -#if (NDIS_SUPPORT_NDIS6 || defined(NDIS60)) - -// -// CONDIS 6.0 protocol's entry points -// - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CO_RECEIVE_NET_BUFFER_LISTS)( - __in NDIS_HANDLE ProtocolBindingContext, - __in NDIS_HANDLE ProtocolVcContext, - __in PNET_BUFFER_LIST NetBufferLists, - __in ULONG NumberOfNetBufferLists, - __in ULONG ReceiveFlags - ); - -typedef PROTOCOL_CO_RECEIVE_NET_BUFFER_LISTS (*CO_RECEIVE_NET_BUFFER_LISTS_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CO_SEND_NET_BUFFER_LISTS_COMPLETE)( - __in NDIS_HANDLE ProtocolVcContext, - __in PNET_BUFFER_LIST NetBufferLists, - __in ULONG SendCompleteFlags - ); - -typedef PROTOCOL_CO_SEND_NET_BUFFER_LISTS_COMPLETE (*CO_SEND_NET_BUFFER_LISTS_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CO_STATUS_EX)( - __in NDIS_HANDLE ProtocolBindingContext, - __in NDIS_HANDLE ProtocolVcContext, - __in PNDIS_STATUS_INDICATION StatusIndication - ); - -typedef PROTOCOL_CO_STATUS_EX (*CO_STATUS_HANDLER_EX); - -// -// CoNDIS 6 Client handler -// -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CL_NOTIFY_CLOSE_AF)( - __in NDIS_HANDLE ClientAfContext - ); - -typedef PROTOCOL_CL_NOTIFY_CLOSE_AF (*CL_NOTIFY_CLOSE_AF_HANDLER); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -VOID -(PROTOCOL_CL_OPEN_AF_COMPLETE_EX)( - __in NDIS_HANDLE ProtocolAfContext, - __in NDIS_HANDLE NdisAfHandle, - __in NDIS_STATUS Status - ); - -typedef PROTOCOL_CL_OPEN_AF_COMPLETE_EX (*CL_OPEN_AF_COMPLETE_HANDLER_EX); - -// -// CoNDIS 6 Call manager handler -// - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CM_NOTIFY_CLOSE_AF_COMPLETE)( - __in NDIS_HANDLE CallMgrAfContext, - __in NDIS_STATUS Status - ); - -typedef PROTOCOL_CM_NOTIFY_CLOSE_AF_COMPLETE (*CM_NOTIFY_CLOSE_AF_COMPLETE_HANDLER); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisDeregisterProtocolDriver( - __in NDIS_HANDLE NdisProtocolHandle - ); - - -#endif // (NDIS_SUPPORT_NDIS6 || defined(NDIS60)) - - -#if NDIS_LEGACY_PROTOCOL - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisDeregisterProtocol( - __out PNDIS_STATUS Status, - __in NDIS_HANDLE NdisProtocolHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisOpenAdapter( - __out __checkReturn PNDIS_STATUS Status, - __out PNDIS_STATUS OpenErrorStatus, - __out PNDIS_HANDLE NdisBindingHandle, - __out PUINT SelectedMediumIndex, - __in PNDIS_MEDIUM MediumArray, - __in UINT MediumArraySize, - __in NDIS_HANDLE NdisProtocolHandle, - __in NDIS_HANDLE ProtocolBindingContext, - __in PNDIS_STRING AdapterName, - __in UINT OpenOptions, - __in_opt PSTRING AddressingInformation - ); - - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisCloseAdapter( - __out PNDIS_STATUS Status, - __in NDIS_HANDLE NdisBindingHandle - ); - - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisCompleteBindAdapter( - __in NDIS_HANDLE BindAdapterContext, - __in NDIS_STATUS Status, - __in NDIS_STATUS OpenStatus - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisCompleteUnbindAdapter( - __in NDIS_HANDLE UnbindAdapterContext, - __in NDIS_STATUS Status - ); - -EXPORT -VOID -NdisSetProtocolFilter( - __out __checkReturn - PNDIS_STATUS Status, - __in NDIS_HANDLE NdisBindingHandle, - __in RECEIVE_HANDLER ReceiveHandler, - __in RECEIVE_PACKET_HANDLER ReceivePacketHandler, - __in NDIS_MEDIUM Medium, - __in UINT Offset, - __in UINT Size, - __in PUCHAR Pattern - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisGetDriverHandle( - __in NDIS_HANDLE NdisBindingHandle, - __out PNDIS_HANDLE NdisDriverHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisOpenProtocolConfiguration( - __out PNDIS_STATUS Status, - __out PNDIS_HANDLE ConfigurationHandle, - __in PNDIS_STRING ProtocolSection - ); - -#endif // NDIS_LEGACY_PROTOCOL - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisReEnumerateProtocolBindings( - __in NDIS_HANDLE NdisProtocolHandle - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisWriteEventLogEntry( - __in __drv_isObjectPointer - PVOID LogHandle, - __in NDIS_STATUS EventCode, - __in ULONG UniqueEventValue, - __in USHORT NumStrings, - __in_opt PVOID StringsList, - __in ULONG DataSize, - __in_bcount_opt(DataSize) - PVOID Data - ); - -#if NDIS_LEGACY_PROTOCOL - -// -// The following routine is used by transports to complete pending -// network PnP events. -// -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisCompletePnPEvent( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisBindingHandle, - __in PNET_PNP_EVENT NetPnPEvent - ); - -#endif // NDIS_LEGACY_PROTOCOL - -#if (NDIS_SUPPORT_NDIS6 || defined(NDIS60)) -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisCompleteNetPnPEvent( - __in NDIS_HANDLE NdisBindingHandle, - __in PNET_PNP_EVENT_NOTIFICATION NetPnPEventNotification, - __in NDIS_STATUS Status - ); -#endif // (NDIS_SUPPORT_NDIS6 || defined(NDIS60)) - -// -// The following routine is used by a transport to query the localized -// friendly instance name of the adapter that they are bound to. There -// are two variations of this, one uses the binding handle and the other -// the binding context. Some transports need this before they bind - like -// TCP/IP for instance. -// - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisQueryAdapterInstanceName( - __out PNDIS_STRING pAdapterInstanceName, - __in NDIS_HANDLE NdisBindingHandle - ); - -__checkReturn -EXPORT -NDIS_STATUS -NdisQueryBindInstanceName( - __out PNDIS_STRING pAdapterInstanceName, - __in NDIS_HANDLE BindingContext - ); - -// -// The following is used by TDI/NDIS interface as part of Network PnP. -// For use by TDI alone. -// -typedef -NTSTATUS -(*TDI_REGISTER_CALLBACK)( - __in PUNICODE_STRING DeviceName, - __out HANDLE * TdiHandle - ); - -typedef -NTSTATUS -(*TDI_PNP_HANDLER)( - __in PUNICODE_STRING UpperComponent, - __in PUNICODE_STRING LowerComponent, - __in PUNICODE_STRING BindList, - __in PVOID ReconfigBuffer, - __in UINT ReconfigBufferSize, - __in UINT Operation - ); - -EXPORT -VOID -NdisRegisterTdiCallBack( - __in TDI_REGISTER_CALLBACK RegisterCallback, - __in TDI_PNP_HANDLER PnPHandler - ); - -EXPORT -VOID -NdisDeregisterTdiCallBack( - VOID - ); - -#if NDIS_LEGACY_PROTOCOL - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -NdisReset( - __out PNDIS_STATUS Status, - __in NDIS_HANDLE NdisBindingHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -NdisRequest( - __out PNDIS_STATUS Status, - __in NDIS_HANDLE NdisBindingHandle, - __in PNDIS_REQUEST NdisRequest - ); - -#ifdef __cplusplus - -#define NdisSend(Status, NdisBindingHandle, Packet) \ -{ \ - *(Status) = \ - (((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.SendHandler)( \ - ((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.BindingHandle, \ - (Packet)); \ -} - -#define NdisSendPackets(NdisBindingHandle, PacketArray, NumberOfPackets) \ -{ \ - (((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.SendPacketsHandler)( \ - (PNDIS_OPEN_BLOCK)(NdisBindingHandle), \ - (PacketArray), \ - (NumberOfPackets)); \ -} - - -#define NdisTransferData(Status, \ - NdisBindingHandle, \ - MacReceiveContext, \ - ByteOffset, \ - BytesToTransfer, \ - Packet, \ - BytesTransferred) \ -{ \ - *(Status) = \ - (((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.TransferDataHandler)( \ - ((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.BindingHandle, \ - (MacReceiveContext), \ - (ByteOffset), \ - (BytesToTransfer), \ - (Packet), \ - (BytesTransferred)); \ -} - -#else - -#define NdisSend(Status, NdisBindingHandle, Packet) \ -{ \ - *(Status) = \ - (((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->SendHandler)( \ - ((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->BindingHandle, \ - (Packet)); \ -} - - -#define NdisSendPackets(NdisBindingHandle, PacketArray, NumberOfPackets) \ -{ \ - (((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->SendPacketsHandler)( \ - (PNDIS_OPEN_BLOCK)(NdisBindingHandle), \ - (PacketArray), \ - (NumberOfPackets)); \ -} - -#define NdisTransferData(Status, \ - NdisBindingHandle, \ - MacReceiveContext, \ - ByteOffset, \ - BytesToTransfer, \ - Packet, \ - BytesTransferred) \ -{ \ - *(Status) = \ - (((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->TransferDataHandler)( \ - ((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->BindingHandle, \ - (MacReceiveContext), \ - (ByteOffset), \ - (BytesToTransfer), \ - (Packet), \ - (BytesTransferred)); \ -} - -#endif // ifdef __cplusplus -#endif // NDIS_LEGACY_PROTOCOL - -#if NDIS_LEGACY_PROTOCOL -// -// Routines to access packet flags -// - -/*++ - -VOID -NdisSetSendFlags( - IN PNDIS_PACKET Packet, - IN UINT Flags - ); - ---*/ - -#define NdisSetSendFlags(_Packet,_Flags) (_Packet)->Private.Flags = (_Flags) - -/*++ - -VOID -NdisQuerySendFlags( - IN PNDIS_PACKET Packet, - OUT PUINT Flags - ); - ---*/ - -#define NdisQuerySendFlags(_Packet,_Flags) *(_Flags) = (_Packet)->Private.Flags - -#endif // NDIS_LEGACY_PROTOCOL - -#if NDIS_LEGACY_DRIVER -// -// The following is the minimum size of packets a miniport must allocate -// when it indicates packets via NdisMIndicatePacket or NdisMCoIndicatePacket -// -#define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(PVOID)) -#endif // NDIS_LEGACY_DRIVER - - -#ifdef __cplusplus -#define WanMiniportSend(Status, \ - NdisBindingHandle, \ - NdisLinkHandle, \ - WanPacket) \ -{ \ - *(Status) = \ - ((((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.WanSendHandler))( \ - ((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.BindingHandle, \ - (NdisLinkHandle), \ - (PNDIS_PACKET)(WanPacket)); \ -} - -#else -#define WanMiniportSend(Status, \ - NdisBindingHandle, \ - NdisLinkHandle, \ - WanPacket) \ -{ \ - *(Status) = \ - ((((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->WanSendHandler))( \ - ((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->BindingHandle, \ - (NdisLinkHandle), \ - (PNDIS_PACKET)(WanPacket)); \ -} - -#endif - - -#if NDIS_LEGACY_PROTOCOL - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisReturnPackets( - __in PNDIS_PACKET * PacketsToReturn, - __in UINT NumberOfPackets - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -PNDIS_PACKET -NdisGetReceivedPacket( - __in NDIS_HANDLE NdisBindingHandle, - __in NDIS_HANDLE MacContext - ); - -#endif // NDIS_LEGACY_PROTOCOL - -// -// Macros to portably manipulate NDIS buffers. -// - -#define NdisBufferLength(Buffer) MmGetMdlByteCount(Buffer) -#define NdisBufferVirtualAddress(_Buffer) MmGetSystemAddressForMdl(_Buffer) -#define NdisBufferVirtualAddressSafe(_Buffer, _Priority) MmGetSystemAddressForMdlSafe(_Buffer, _Priority) - - - -#if NDIS_LEGACY_PROTOCOL - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCancelSendPackets( - __in NDIS_HANDLE NdisBindingHandle, - __in __drv_isObjectPointer - PVOID CancelId - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisQueryPendingIOCount( - __in __drv_isObjectPointer - PVOID NdisBindingHandle, - __out PULONG IoCount - ); - -#endif // NDIS_LEGACY_PROTOCOL - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -UCHAR -NdisGeneratePartialCancelId( - VOID - ); - - -#if (NDIS_SUPPORT_NDIS6 || defined(NDIS60)) - -// -// NDIS 6.0 protocol's entry points -// -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_OID_REQUEST_COMPLETE)( - __in NDIS_HANDLE ProtocolBindingContext, - __in PNDIS_OID_REQUEST OidRequest, - __in NDIS_STATUS Status - ); - -typedef PROTOCOL_OID_REQUEST_COMPLETE (*OID_REQUEST_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_RECEIVE_NET_BUFFER_LISTS)( - __in NDIS_HANDLE ProtocolBindingContext, - __in PNET_BUFFER_LIST NetBufferLists, - __in NDIS_PORT_NUMBER PortNumber, - __in ULONG NumberOfNetBufferLists, - __in ULONG ReceiveFlags - ); - -typedef PROTOCOL_RECEIVE_NET_BUFFER_LISTS (*RECEIVE_NET_BUFFER_LISTS_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_SEND_NET_BUFFER_LISTS_COMPLETE)( - __in NDIS_HANDLE ProtocolBindingContext, - __in PNET_BUFFER_LIST NetBufferList, - __in ULONG SendCompleteFlags - ); - -typedef PROTOCOL_SEND_NET_BUFFER_LISTS_COMPLETE (*SEND_NET_BUFFER_LISTS_COMPLETE_HANDLER); - -#if (NDIS_SUPPORT_NDIS61) -// -// NDIS 6.1 protocol's entry points -// -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_DIRECT_OID_REQUEST_COMPLETE)( - __in NDIS_HANDLE ProtocolBindingContext, - __in PNDIS_OID_REQUEST OidRequest, - __in NDIS_STATUS Status - ); - -typedef PROTOCOL_DIRECT_OID_REQUEST_COMPLETE (*DIRECT_OID_REQUEST_COMPLETE_HANDLER); - -#endif // (NDIS_SUPPORT_NDIS61) - -// -// structure passed to protocol's BIND_HANDLER_EX -// -#define NDIS_BIND_PARAMETERS_REVISION_1 1 - -#if (NDIS_SUPPORT_NDIS61) -#define NDIS_BIND_PARAMETERS_REVISION_2 2 -#endif // (NDIS_SUPPORT_NDIS61) - -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_BIND_PARAMETERS_REVISION_3 3 -#endif // (NDIS_SUPPORT_NDIS620) - - -typedef struct _NDIS_BIND_PARAMETERS -{ - NDIS_OBJECT_HEADER Header; - PNDIS_STRING ProtocolSection; - PNDIS_STRING AdapterName; - PDEVICE_OBJECT PhysicalDeviceObject; - NDIS_MEDIUM MediaType; - ULONG MtuSize; - ULONG64 MaxXmitLinkSpeed; - ULONG64 XmitLinkSpeed; - ULONG64 MaxRcvLinkSpeed; - ULONG64 RcvLinkSpeed; - NDIS_MEDIA_CONNECT_STATE MediaConnectState; - NDIS_MEDIA_DUPLEX_STATE MediaDuplexState; - ULONG LookaheadSize; - PNDIS_PNP_CAPABILITIES PowerManagementCapabilities; // 6.20 drivers must use PowerManagementCapabilitiesEx - ULONG SupportedPacketFilters; - ULONG MaxMulticastListSize; - USHORT MacAddressLength; - UCHAR CurrentMacAddress[NDIS_MAX_PHYS_ADDRESS_LENGTH]; - NDIS_PHYSICAL_MEDIUM PhysicalMediumType; - PNDIS_RECEIVE_SCALE_CAPABILITIES RcvScaleCapabilities; - NET_LUID BoundIfNetluid; - NET_IFINDEX BoundIfIndex; - NET_LUID LowestIfNetluid; - NET_IFINDEX LowestIfIndex; - NET_IF_ACCESS_TYPE AccessType; // NET_IF_ACCESS_BROADCAST for a typical ethernet adapter - NET_IF_DIRECTION_TYPE DirectionType; // NET_IF_DIRECTION_SENDRECEIVE for a typical ethernet adapter - NET_IF_CONNECTION_TYPE ConnectionType; // NET_IF_CONNECTION_DEDICATED for a typical ethernet adapter - NET_IFTYPE IfType; // IF_TYPE_ETHERNET_CSMACD for a typical ethernet adapter (regardless of speed) - BOOLEAN IfConnectorPresent; // RFC 2665 TRUE if physical adapter - PNDIS_PORT ActivePorts; - ULONG DataBackFillSize; - ULONG ContextBackFillSize; - ULONG MacOptions; - NET_IF_COMPARTMENT_ID CompartmentId; - PNDIS_OFFLOAD DefaultOffloadConfiguration; - PNDIS_TCP_CONNECTION_OFFLOAD TcpConnectionOffloadCapabilities; - PNDIS_STRING BoundAdapterName; -#if (NDIS_SUPPORT_NDIS61) - PNDIS_HD_SPLIT_CURRENT_CONFIG HDSplitCurrentConfig; -#endif // (NDIS_SUPPORT_NDIS61) -#if (NDIS_SUPPORT_NDIS620) - PNDIS_RECEIVE_FILTER_CAPABILITIES ReceiveFilterCapabilities; - PNDIS_PM_CAPABILITIES PowerManagementCapabilitiesEx; - PNDIS_NIC_SWITCH_CAPABILITIES NicSwitchCapabilities; -#endif // (NDIS_SUPPORT_NDIS620) -}NDIS_BIND_PARAMETERS, *PNDIS_BIND_PARAMETERS; - -#define NDIS_SIZEOF_BIND_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_BIND_PARAMETERS, BoundAdapterName) - -#if (NDIS_SUPPORT_NDIS61) -#define NDIS_SIZEOF_BIND_PARAMETERS_REVISION_2 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_BIND_PARAMETERS, HDSplitCurrentConfig) -#endif // (NDIS_SUPPORT_NDIS61) - -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_SIZEOF_BIND_PARAMETERS_REVISION_3 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_BIND_PARAMETERS, NicSwitchCapabilities) -#endif // (NDIS_SUPPORT_NDIS620) - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -NDIS_STATUS -(PROTOCOL_BIND_ADAPTER_EX)( - __in NDIS_HANDLE ProtocolDriverContext, - __in NDIS_HANDLE BindContext, - __in PNDIS_BIND_PARAMETERS BindParameters - ); - -typedef PROTOCOL_BIND_ADAPTER_EX (*BIND_HANDLER_EX); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -NDIS_STATUS -(PROTOCOL_UNBIND_ADAPTER_EX)( - __in NDIS_HANDLE UnbindContext, - __in NDIS_HANDLE ProtocolBindingContext - ); - -typedef PROTOCOL_UNBIND_ADAPTER_EX (*UNBIND_HANDLER_EX); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -VOID -(PROTOCOL_OPEN_ADAPTER_COMPLETE_EX)( - __in NDIS_HANDLE ProtocolBindingContext, - __in NDIS_STATUS Status - ); - -typedef PROTOCOL_OPEN_ADAPTER_COMPLETE_EX (*OPEN_ADAPTER_COMPLETE_HANDLER_EX); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -VOID -(PROTOCOL_CLOSE_ADAPTER_COMPLETE_EX)( - __in NDIS_HANDLE ProtocolBindingContext - ); - -typedef PROTOCOL_CLOSE_ADAPTER_COMPLETE_EX (*CLOSE_ADAPTER_COMPLETE_HANDLER_EX); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_STATUS_EX)( - __in NDIS_HANDLE ProtocolBindingContext, - __in PNDIS_STATUS_INDICATION StatusIndication - ); - -typedef PROTOCOL_STATUS_EX (*STATUS_HANDLER_EX); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -NDIS_STATUS -(PROTOCOL_NET_PNP_EVENT)( - __in NDIS_HANDLE ProtocolBindingContext, - __in PNET_PNP_EVENT_NOTIFICATION NetPnPEventNotification - ); - -typedef PROTOCOL_NET_PNP_EVENT (*NET_PNP_EVENT_HANDLER); - -typedef -__drv_requiresIRQL(PASSIVE_LEVEL) -VOID -(PROTOCOL_UNINSTALL)( - VOID - ); -typedef PROTOCOL_UNINSTALL (*UNINSTALL_PROTOCOL_HANDLER); - - -#define NDIS_PROTOCOL_CO_CHARACTERISTICS_REVISION_1 1 - -typedef struct _NDIS_PROTOCOL_CO_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; // Header.Type = NDIS_OBJECT_TYPE_PROTOCOL_CO_CHARACTERISTICS - ULONG Flags; - CO_STATUS_HANDLER_EX CoStatusHandlerEx; - CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler; - CO_RECEIVE_NET_BUFFER_LISTS_HANDLER CoReceiveNetBufferListsHandler; - CO_SEND_NET_BUFFER_LISTS_COMPLETE_HANDLER CoSendNetBufferListsCompleteHandler; -} NDIS_PROTOCOL_CO_CHARACTERISTICS, *PNDIS_PROTOCOL_CO_CHARACTERISTICS; - -#define NDIS_SIZEOF_PROTOCOL_CO_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_PROTOCOL_CO_CHARACTERISTICS, CoSendNetBufferListsCompleteHandler) - -#define NDIS_PROTOCOL_DRIVER_CHARACTERISTICS_REVISION_1 1 -#if (NDIS_SUPPORT_NDIS61) -#define NDIS_PROTOCOL_DRIVER_CHARACTERISTICS_REVISION_2 2 -#endif // (NDIS_SUPPORT_NDIS61) - -typedef struct _NDIS_PROTOCOL_DRIVER_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; - UCHAR MajorNdisVersion; - UCHAR MinorNdisVersion; - UCHAR MajorDriverVersion; - UCHAR MinorDriverVersion; - ULONG Flags; - NDIS_STRING Name; - SET_OPTIONS_HANDLER SetOptionsHandler; - BIND_HANDLER_EX BindAdapterHandlerEx; - UNBIND_HANDLER_EX UnbindAdapterHandlerEx; - OPEN_ADAPTER_COMPLETE_HANDLER_EX OpenAdapterCompleteHandlerEx; - CLOSE_ADAPTER_COMPLETE_HANDLER_EX CloseAdapterCompleteHandlerEx; - NET_PNP_EVENT_HANDLER NetPnPEventHandler; - UNINSTALL_PROTOCOL_HANDLER UninstallHandler; - OID_REQUEST_COMPLETE_HANDLER OidRequestCompleteHandler; - STATUS_HANDLER_EX StatusHandlerEx; - RECEIVE_NET_BUFFER_LISTS_HANDLER ReceiveNetBufferListsHandler; - SEND_NET_BUFFER_LISTS_COMPLETE_HANDLER SendNetBufferListsCompleteHandler; -#if (NDIS_SUPPORT_NDIS61) - DIRECT_OID_REQUEST_COMPLETE_HANDLER DirectOidRequestCompleteHandler; -#endif // (NDIS_SUPPORT_NDIS61) -} NDIS_PROTOCOL_DRIVER_CHARACTERISTICS, *PNDIS_PROTOCOL_DRIVER_CHARACTERISTICS; - -#define NDIS_SIZEOF_PROTOCOL_DRIVER_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_PROTOCOL_DRIVER_CHARACTERISTICS, SendNetBufferListsCompleteHandler) - -#if (NDIS_SUPPORT_NDIS61) -#define NDIS_SIZEOF_PROTOCOL_DRIVER_CHARACTERISTICS_REVISION_2 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_PROTOCOL_DRIVER_CHARACTERISTICS, DirectOidRequestCompleteHandler) -#endif // (NDIS_SUPPORT_NDIS61) - -#endif // (NDIS_SUPPORT_NDIS6 || defined(NDIS60)) - - -#if NDIS_LEGACY_PROTOCOL - -#if (defined(NDIS50) || defined(NDIS51)) -typedef NDIS50_PROTOCOL_CHARACTERISTICS NDIS_PROTOCOL_CHARACTERISTICS; -#else -typedef NDIS40_PROTOCOL_CHARACTERISTICS NDIS_PROTOCOL_CHARACTERISTICS; -#endif - - -typedef NDIS_PROTOCOL_CHARACTERISTICS *PNDIS_PROTOCOL_CHARACTERISTICS; - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisRegisterProtocol( - __out PNDIS_STATUS Status, - __out PNDIS_HANDLE NdisProtocolHandle, - __in PNDIS_PROTOCOL_CHARACTERISTICS ProtocolCharacteristics, - __in UINT CharacteristicsLength - ); - -#endif // NDIS_LEGACY_PROTOCOL - -#if (NDIS_SUPPORT_NDIS6 || defined(NDIS60)) - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisRegisterProtocolDriver( - __in_opt NDIS_HANDLE ProtocolDriverContext, - __in PNDIS_PROTOCOL_DRIVER_CHARACTERISTICS ProtocolCharacteristics, - __out PNDIS_HANDLE NdisProtocolHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisSendNetBufferLists( - __in NDIS_HANDLE NdisBindingHandle, - __in __drv_aliasesMem PNET_BUFFER_LIST NetBufferLists, - __in NDIS_PORT_NUMBER PortNumber, - __in ULONG SendFlags - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisReturnNetBufferLists( - __in NDIS_HANDLE NdisBindingHandle, - __in PNET_BUFFER_LIST NetBufferLists, - __in ULONG ReturnFlags - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCancelSendNetBufferLists( - __in NDIS_HANDLE NdisBindingHandle, - __in __drv_isObjectPointer - PVOID CancelId - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisOidRequest( - __in NDIS_HANDLE NdisBindingHandle, - __in PNDIS_OID_REQUEST OidRequest - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCancelOidRequest( - __in NDIS_HANDLE NdisBindingHandle, - __in __drv_isObjectPointer - PVOID RequestId - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisUnbindAdapter( - __in NDIS_HANDLE NdisBindingHandle - ); - - -// -// structure passed to NdisOpenAdapterEx -// - -#define NDIS_OPEN_PARAMETERS_REVISION_1 1 -typedef struct _NDIS_OPEN_PARAMETERS -{ - NDIS_OBJECT_HEADER Header; - PNDIS_STRING AdapterName; - PNDIS_MEDIUM MediumArray; - UINT MediumArraySize; - PUINT SelectedMediumIndex; - PNET_FRAME_TYPE FrameTypeArray; - UINT FrameTypeArraySize; -} NDIS_OPEN_PARAMETERS, *PNDIS_OPEN_PARAMETERS; - -#define NDIS_SIZEOF_OPEN_PARAMETERS_REVSION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_OPEN_PARAMETERS, FrameTypeArraySize) - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisOpenAdapterEx( - __in NDIS_HANDLE NdisProtocolHandle, - __in NDIS_HANDLE ProtocolBindingContext, - __in PNDIS_OPEN_PARAMETERS OpenParameters, - __in NDIS_HANDLE BindContext, - __out PNDIS_HANDLE NdisBindingHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCompleteBindAdapterEx( - __in NDIS_HANDLE BindAdapterContext, - __in NDIS_STATUS Status - ); - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisCloseAdapterEx( - __in NDIS_HANDLE NdisBindingHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCompleteUnbindAdapterEx( - __in NDIS_HANDLE UnbindContext - ); - - - -#define NDIS_PROTOCOL_PAUSE_PARAMETERS_REVISION_1 1 - -typedef struct _NDIS_PROTOCOL_PAUSE_PARAMETERS -{ - NDIS_OBJECT_HEADER Header; - ULONG Flags; - ULONG PauseReason; -} NDIS_PROTOCOL_PAUSE_PARAMETERS, *PNDIS_PROTOCOL_PAUSE_PARAMETERS; - -#define NDIS_SIZEOF_PROTOCOL_PAUSE_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_PROTOCOL_PAUSE_PARAMETERS, PauseReason) - - -// -// NDIS_PROTOCOL_RESTART_PARAMETERS is used in -// NetEventRestart event indication to the protocols -// -#define NDIS_PROTOCOL_RESTART_PARAMETERS_REVISION_1 1 - -typedef struct _NDIS_PROTOCOL_RESTART_PARAMETERS -{ - NDIS_OBJECT_HEADER Header; - PUCHAR FilterModuleNameBuffer; - ULONG FilterModuleNameBufferLength; - PNDIS_RESTART_ATTRIBUTES RestartAttributes; - NET_IFINDEX BoundIfIndex; - NET_LUID BoundIfNetluid; - ULONG Flags; -} NDIS_PROTOCOL_RESTART_PARAMETERS, *PNDIS_PROTOCOL_RESTART_PARAMETERS; - -#define NDIS_SIZEOF_PROTOCOL_RESTART_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_PROTOCOL_RESTART_PARAMETERS, Flags) - -#if (NDIS_SUPPORT_NDIS61) - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisDirectOidRequest( - __in NDIS_HANDLE NdisBindingHandle, - __in PNDIS_OID_REQUEST OidRequest - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCancelDirectOidRequest( - __in NDIS_HANDLE NdisBindingHandle, - __in __drv_isObjectPointer - PVOID RequestId - ); -#endif // (NDIS_SUPPORT_NDIS61) - -#endif // (NDIS_SUPPORT_NDIS6 || defined(NDIS60)) - - -// -// needed for macros used by legacy protocols -// -#if !defined(NDIS_WRAPPER) -#if NDIS_LEGACY_PROTOCOL - typedef struct _NDIS_COMMON_OPEN_BLOCK - { - PVOID MacHandle; // needed for backward compatibility - - NDIS_HANDLE BindingHandle; - NDIS_HANDLE Reserved6; - NDIS_HANDLE Reserved7; - NDIS_HANDLE Reserved8; - - PVOID Reserved9; - NDIS_HANDLE Reserved10; - - NDIS_HANDLE Reserved11; - BOOLEAN Reserved12; - BOOLEAN Reserved2; - BOOLEAN Reserved3; - BOOLEAN Reserved4; - PVOID Reserved13; - KSPIN_LOCK Reserved5; - NDIS_HANDLE Reserved14; - - // - // These are referenced by the macros used by protocols to call. - // All of the ones referenced by the macros are internal NDIS handlers for the miniports - // - union - { - SEND_HANDLER SendHandler; - WAN_SEND_HANDLER WanSendHandler; - }; - TRANSFER_DATA_HANDLER TransferDataHandler; - - // - // These are referenced internally by NDIS - // - SEND_COMPLETE_HANDLER SendCompleteHandler; - TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler; - RECEIVE_HANDLER ReceiveHandler; - RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler; - WAN_RECEIVE_HANDLER WanReceiveHandler; - REQUEST_COMPLETE_HANDLER RequestCompleteHandler; - - // - // NDIS 4.0 extensions - // - RECEIVE_PACKET_HANDLER ReceivePacketHandler; - SEND_PACKETS_HANDLER SendPacketsHandler; - - // - // More Cached Handlers - // - RESET_HANDLER ResetHandler; - REQUEST_HANDLER RequestHandler; - RESET_COMPLETE_HANDLER ResetCompleteHandler; - STATUS_HANDLER StatusHandler; - STATUS_COMPLETE_HANDLER StatusCompleteHandler; - - }NDIS_COMMON_OPEN_BLOCK, *PNDIS_COMMON_OPEN_BLOCK; - // - // one of these per open on an adapter/protocol - // - struct _NDIS_OPEN_BLOCK - { -#ifdef __cplusplus - NDIS_COMMON_OPEN_BLOCK NdisCommonOpenBlock; -#else - NDIS_COMMON_OPEN_BLOCK; -#endif - - }; - -#endif // NDIS_LEGACY_PROTOCOL -#endif // NDIS_WRAPPER - - - - -#pragma once - -#include - -#define NDIS_M_MAX_LOOKAHEAD 526 - -#if NDIS_LEGACY_MINIPORT - -// -// Function types for NDIS_MINIPORT_CHARACTERISTICS -// - - -typedef -BOOLEAN -(*W_CHECK_FOR_HANG_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext - ); - -typedef -VOID -(*W_DISABLE_INTERRUPT_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext - ); - -typedef -VOID -(*W_ENABLE_INTERRUPT_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext - ); - -typedef -VOID -(*W_HALT_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext - ); - -typedef -VOID -(*W_HANDLE_INTERRUPT_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext - ); - -typedef -NDIS_STATUS -(*W_INITIALIZE_HANDLER)( - __out PNDIS_STATUS OpenErrorStatus, - __out PUINT SelectedMediumIndex, - __in PNDIS_MEDIUM MediumArray, - __in UINT MediumArraySize, - __in NDIS_HANDLE MiniportAdapterContext, - __in NDIS_HANDLE WrapperConfigurationContext - ); - -typedef -VOID -(*W_ISR_HANDLER)( - __out PBOOLEAN InterruptRecognized, - __out PBOOLEAN QueueMiniportHandleInterrupt, - __in NDIS_HANDLE MiniportAdapterContext - ); - -typedef -NDIS_STATUS -(*W_QUERY_INFORMATION_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext, - __in NDIS_OID Oid, - __in PVOID InformationBuffer, - __in ULONG InformationBufferLength, - __out PULONG BytesWritten, - __out PULONG BytesNeeded - ); - -typedef -NDIS_STATUS -(*W_RECONFIGURE_HANDLER)( - __out PNDIS_STATUS OpenErrorStatus, - __in NDIS_HANDLE MiniportAdapterContext OPTIONAL, - __in NDIS_HANDLE WrapperConfigurationContext - ); - -typedef -NDIS_STATUS -(*W_RESET_HANDLER)( - __out PBOOLEAN AddressingReset, - __in NDIS_HANDLE MiniportAdapterContext - ); - -typedef -NDIS_STATUS -(*W_SEND_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PNDIS_PACKET Packet, - __in UINT Flags - ); - -typedef -NDIS_STATUS -(*WM_SEND_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext, - __in NDIS_HANDLE NdisLinkHandle, - __in PNDIS_WAN_PACKET Packet - ); - -typedef -NDIS_STATUS -(*W_SET_INFORMATION_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext, - __in NDIS_OID Oid, - __in PVOID InformationBuffer, - __in ULONG InformationBufferLength, - __out PULONG BytesRead, - __out PULONG BytesNeeded - ); - -typedef -NDIS_STATUS -(*W_TRANSFER_DATA_HANDLER)( - __out PNDIS_PACKET Packet, - __out PUINT BytesTransferred, - __in NDIS_HANDLE MiniportAdapterContext, - __in NDIS_HANDLE MiniportReceiveContext, - __in UINT ByteOffset, - __in UINT BytesToTransfer - ); - -typedef -NDIS_STATUS -(*WM_TRANSFER_DATA_HANDLER)( - VOID - ); - -// -// Definition for shutdown handler -// - -typedef -VOID -(*ADAPTER_SHUTDOWN_HANDLER) ( - __in PVOID ShutdownContext - ); - -// -// Miniport extensions for NDIS 4.0 -// -typedef -VOID -(*W_RETURN_PACKET_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PNDIS_PACKET Packet - ); - -// -// NDIS 4.0 extension -// -typedef -VOID -(*W_SEND_PACKETS_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PPNDIS_PACKET PacketArray, - __in UINT NumberOfPackets - ); - -typedef -VOID -(*W_ALLOCATE_COMPLETE_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PVOID VirtualAddress, - __in PNDIS_PHYSICAL_ADDRESS PhysicalAddress, - __in ULONG Length, - __in PVOID Context - ); - -#endif // NDIS_LEGACY_MINIPORT - - -// -// W_CO_CREATE_VC_HANDLER is a synchronous call -// -typedef -NDIS_STATUS -(MINIPORT_CO_CREATE_VC)( - __in NDIS_HANDLE MiniportAdapterContext, - __in NDIS_HANDLE NdisVcHandle, - __out PNDIS_HANDLE MiniportVcContext - ); - -typedef MINIPORT_CO_CREATE_VC (*W_CO_CREATE_VC_HANDLER); - -typedef -NDIS_STATUS -(MINIPORT_CO_DELETE_VC)( - __in NDIS_HANDLE MiniportVcContext - ); - -typedef MINIPORT_CO_DELETE_VC (*W_CO_DELETE_VC_HANDLER); - -typedef -NDIS_STATUS -(MINIPORT_CO_ACTIVATE_VC)( - __in NDIS_HANDLE MiniportVcContext, - __inout PCO_CALL_PARAMETERS CallParameters - ); - -typedef MINIPORT_CO_ACTIVATE_VC (*W_CO_ACTIVATE_VC_HANDLER); - -typedef -NDIS_STATUS -(MINIPORT_CO_DEACTIVATE_VC)( - __in NDIS_HANDLE MiniportVcContext - ); -typedef MINIPORT_CO_DEACTIVATE_VC (*W_CO_DEACTIVATE_VC_HANDLER); - -#if NDIS_LEGACY_MINIPORT - -typedef -VOID -(*W_CO_SEND_PACKETS_HANDLER)( - __in NDIS_HANDLE MiniportVcContext, - __in PPNDIS_PACKET PacketArray, - __in UINT NumberOfPackets - ); - -typedef -NDIS_STATUS -(*W_CO_REQUEST_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext, - __in NDIS_HANDLE MiniportVcContext OPTIONAL, - __inout PNDIS_REQUEST NdisRequest - ); - -#endif // NDIS_LEGACY_MINIPORT - - -#if NDIS_SUPPORT_NDIS6 - -// -// CONDIS 6.0 handlers -// - -typedef -VOID -(MINIPORT_CO_SEND_NET_BUFFER_LISTS)( - __in NDIS_HANDLE MiniportVcContext, - __in PNET_BUFFER_LIST NetBufferLists, - __in ULONG SendFlags - ); - -typedef MINIPORT_CO_SEND_NET_BUFFER_LISTS (*W_CO_SEND_NET_BUFFER_LISTS_HANDLER); - -typedef -NDIS_STATUS -(MINIPORT_CO_OID_REQUEST)( - __in NDIS_HANDLE MiniportAdapterContext, - __in NDIS_HANDLE MiniportVcContext OPTIONAL, - __inout PNDIS_OID_REQUEST NdisRequest - ); - -typedef MINIPORT_CO_OID_REQUEST (*W_CO_OID_REQUEST_HANDLER); - -#endif // NDIS_SUPPORT_NDIS6 - -typedef enum _NDIS_DEVICE_PNP_EVENT -{ - NdisDevicePnPEventQueryRemoved, - NdisDevicePnPEventRemoved, - NdisDevicePnPEventSurpriseRemoved, - NdisDevicePnPEventQueryStopped, - NdisDevicePnPEventStopped, - NdisDevicePnPEventPowerProfileChanged, -#if NDIS_SUPPORT_NDIS6 - NdisDevicePnPEventFilterListChanged, -#endif // NDIS_SUPPORT_NDIS6 - NdisDevicePnPEventMaximum -} NDIS_DEVICE_PNP_EVENT, *PNDIS_DEVICE_PNP_EVENT; - -// -// power profiles -// -typedef enum _NDIS_POWER_PROFILE -{ - NdisPowerProfileBattery, - NdisPowerProfileAcOnLine -} NDIS_POWER_PROFILE, *PNDIS_POWER_PROFILE; - -#if NDIS_LEGACY_MINIPORT - -typedef struct _NDIS50_MINIPORT_CHARACTERISTICS -{ - UCHAR MajorNdisVersion; - UCHAR MinorNdisVersion; - USHORT Filler; - UINT Reserved; - W_CHECK_FOR_HANG_HANDLER CheckForHangHandler; - W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler; - W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler; - W_HALT_HANDLER HaltHandler; - W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler; - W_INITIALIZE_HANDLER InitializeHandler; - W_ISR_HANDLER ISRHandler; - W_QUERY_INFORMATION_HANDLER QueryInformationHandler; - W_RECONFIGURE_HANDLER ReconfigureHandler; - W_RESET_HANDLER ResetHandler; - union - { - W_SEND_HANDLER SendHandler; - WM_SEND_HANDLER WanSendHandler; - }; - W_SET_INFORMATION_HANDLER SetInformationHandler; - union - { - W_TRANSFER_DATA_HANDLER TransferDataHandler; - WM_TRANSFER_DATA_HANDLER WanTransferDataHandler; - }; - - // - // Extensions for NDIS 4.0 - // - W_RETURN_PACKET_HANDLER ReturnPacketHandler; - W_SEND_PACKETS_HANDLER SendPacketsHandler; - W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler; - - // - // Extensions for NDIS 5.0 - // - W_CO_CREATE_VC_HANDLER CoCreateVcHandler; - W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; - W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; - W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; - W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler; - W_CO_REQUEST_HANDLER CoRequestHandler; -} NDIS50_MINIPORT_CHARACTERISTICS; - -#if (((NDIS_MINIPORT_MAJOR_VERSION == 5) && (NDIS_MINIPORT_MINOR_VERSION == 1)) || NDIS_WRAPPER) -// -// Miniport extensions for NDIS 5.1 -// -typedef VOID -(*W_CANCEL_SEND_PACKETS_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PVOID CancelId - ); - -typedef VOID -(*W_PNP_EVENT_NOTIFY_HANDLER)( - __in NDIS_HANDLE MiniportAdapterContext, - __in NDIS_DEVICE_PNP_EVENT DevicePnPEvent, - __in PVOID InformationBuffer, - __in ULONG InformationBufferLength - ); - -typedef VOID -(*W_MINIPORT_SHUTDOWN_HANDLER) ( - __in NDIS_HANDLE MiniportAdapterContext - ); - -#endif // (((NDIS_MINIPORT_MAJOR_VERSION == 5) && (NDIS_MINIPORT_MINOR_VERSION == 1)) || NDIS_WRAPPER) - -#endif // NDIS_LEGACY_MINIPORT - -#if NDIS_SUPPORT_NDIS6 -typedef -BOOLEAN -(MINIPORT_ISR)( - __in NDIS_HANDLE MiniportInterruptContext, - __out PBOOLEAN QueueDefaultInterruptDpc, - __out PULONG TargetProcessors - ); - -typedef MINIPORT_ISR (*MINIPORT_ISR_HANDLER); - -typedef -VOID -(MINIPORT_INTERRUPT_DPC)( - __in NDIS_HANDLE MiniportInterruptContext, - __in PVOID MiniportDpcContext, - __in PVOID ReceiveThrottleParameters, - __in PVOID NdisReserved2 - ); - -typedef MINIPORT_INTERRUPT_DPC (*MINIPORT_INTERRUPT_DPC_HANDLER); - -#if NDIS_SUPPORT_NDIS620 - -typedef struct _NDIS_RECEIVE_THROTTLE_PARAMETERS -{ - __in ULONG MaxNblsToIndicate; - __out ULONG MoreNblsPending:1; -} NDIS_RECEIVE_THROTTLE_PARAMETERS, *PNDIS_RECEIVE_THROTTLE_PARAMETERS; - -#define NDIS_INDICATE_ALL_NBLS (~0ul) - -#endif - - -typedef -VOID -(MINIPORT_DISABLE_INTERRUPT)( - __in NDIS_HANDLE MiniportInterruptContext - ); - -typedef MINIPORT_DISABLE_INTERRUPT (*MINIPORT_DISABLE_INTERRUPT_HANDLER); - -typedef -VOID -(MINIPORT_ENABLE_INTERRUPT)( - __in NDIS_HANDLE MiniportInterruptContext - ); - -typedef MINIPORT_ENABLE_INTERRUPT (*MINIPORT_ENABLE_INTERRUPT_HANDLER); -// -// MSI support handlers -// -typedef -BOOLEAN -(MINIPORT_MESSAGE_INTERRUPT)( - __in NDIS_HANDLE MiniportInterruptContext, - __in ULONG MessageId, - __out PBOOLEAN QueueDefaultInterruptDpc, - __out PULONG TargetProcessors - ); - -typedef MINIPORT_MESSAGE_INTERRUPT (*MINIPORT_MSI_ISR_HANDLER); - -typedef -VOID -(MINIPORT_MESSAGE_INTERRUPT_DPC)( - __in NDIS_HANDLE MiniportInterruptContext, - __in ULONG MessageId, - __in PVOID MiniportDpcContext, -#if NDIS_SUPPORT_NDIS620 - __in PVOID ReceiveThrottleParameters, - __in PVOID NdisReserved2 -#else - __in PULONG NdisReserved1, - __in PULONG NdisReserved2 -#endif - ); - -typedef MINIPORT_MESSAGE_INTERRUPT_DPC (*MINIPORT_MSI_INTERRUPT_DPC_HANDLER); - -typedef -VOID -(MINIPORT_DISABLE_MESSAGE_INTERRUPT)( - __in NDIS_HANDLE MiniportInterruptContext, - __in ULONG MessageId - ); - -typedef MINIPORT_DISABLE_MESSAGE_INTERRUPT (*MINIPORT_DISABLE_MSI_INTERRUPT_HANDLER); - -typedef -VOID -(MINIPORT_ENABLE_MESSAGE_INTERRUPT)( - __in NDIS_HANDLE MiniportInterruptContext, - __in ULONG MessageId - ); -typedef MINIPORT_ENABLE_MESSAGE_INTERRUPT (*MINIPORT_ENABLE_MSI_INTERRUPT_HANDLER); - -typedef -BOOLEAN -(MINIPORT_SYNCHRONIZE_INTERRUPT)( - __in NDIS_HANDLE SynchronizeContext - ); -typedef MINIPORT_SYNCHRONIZE_INTERRUPT (*MINIPORT_SYNCHRONIZE_INTERRUPT_HANDLER); -typedef MINIPORT_SYNCHRONIZE_INTERRUPT (MINIPORT_SYNCHRONIZE_MESSAGE_INTERRUPT); -typedef MINIPORT_SYNCHRONIZE_MESSAGE_INTERRUPT (*MINIPORT_SYNCHRONIZE_MSI_INTERRUPT_HANDLER); - -typedef enum _NDIS_INTERRUPT_TYPE -{ - NDIS_CONNECT_LINE_BASED = 1, - NDIS_CONNECT_MESSAGE_BASED -} NDIS_INTERRUPT_TYPE, *PNDIS_INTERRUPT_TYPE; - -#define NDIS_MINIPORT_INTERRUPT_REVISION_1 1 - -typedef struct _NDIS_MINIPORT_INTERRUPT_CHARACTERISTICS -{ - __in NDIS_OBJECT_HEADER Header; - __in MINIPORT_ISR_HANDLER InterruptHandler; - __in MINIPORT_INTERRUPT_DPC_HANDLER InterruptDpcHandler; - __in MINIPORT_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler; - __in MINIPORT_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler; - __in BOOLEAN MsiSupported; - __in BOOLEAN MsiSyncWithAllMessages; - __in MINIPORT_MSI_ISR_HANDLER MessageInterruptHandler; - __in MINIPORT_MSI_INTERRUPT_DPC_HANDLER MessageInterruptDpcHandler; - __in MINIPORT_DISABLE_MSI_INTERRUPT_HANDLER DisableMessageInterruptHandler; - __in MINIPORT_ENABLE_MSI_INTERRUPT_HANDLER EnableMessageInterruptHandler; - __out NDIS_INTERRUPT_TYPE InterruptType; - __out PIO_INTERRUPT_MESSAGE_INFO MessageInfoTable; -} NDIS_MINIPORT_INTERRUPT_CHARACTERISTICS, *PNDIS_MINIPORT_INTERRUPT_CHARACTERISTICS; - -#define NDIS_SIZEOF_MINIPORT_INTERRUPT_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_INTERRUPT_CHARACTERISTICS, MessageInfoTable) - -typedef -NDIS_STATUS -(MINIPORT_ADD_DEVICE)( - __in NDIS_HANDLE NdisMiniportHandle, - __in NDIS_HANDLE MiniportDriverContext - ); - -typedef MINIPORT_ADD_DEVICE (*MINIPORT_ADD_DEVICE_HANDLER); - -typedef -VOID -(MINIPORT_REMOVE_DEVICE)( - __in NDIS_HANDLE MiniportAddDeviceContext - ); - -typedef MINIPORT_REMOVE_DEVICE (*MINIPORT_REMOVE_DEVICE_HANDLER); - -typedef -NDIS_STATUS -(MINIPORT_PNP_IRP)( - __in NDIS_HANDLE MiniportAddDeviceContext, - __in PIRP Irp - ); - -typedef MINIPORT_PNP_IRP (*MINIPORT_PNP_IRP_HANDLER); - -typedef MINIPORT_PNP_IRP (MINIPORT_START_DEVICE); -typedef MINIPORT_PNP_IRP (* MINIPORT_START_DEVICE_HANDLER); -typedef MINIPORT_PNP_IRP (MINIPORT_FILTER_RESOURCE_REQUIREMENTS); -typedef MINIPORT_PNP_IRP (*MINIPORT_FILTER_RESOURCE_REQUIREMENTS_HANDLER); - -#define NDIS_MINIPORT_PNP_CHARACTERISTICS_REVISION_1 1 - -typedef struct _NDIS_MINIPORT_PNP_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; - MINIPORT_ADD_DEVICE_HANDLER MiniportAddDeviceHandler; - MINIPORT_REMOVE_DEVICE_HANDLER MiniportRemoveDeviceHandler; - MINIPORT_FILTER_RESOURCE_REQUIREMENTS_HANDLER MiniportFilterResourceRequirementsHandler; - MINIPORT_START_DEVICE_HANDLER MiniportStartDeviceHandler; - ULONG Flags; - -} NDIS_MINIPORT_PNP_CHARACTERISTICS, *PNDIS_MINIPORT_PNP_CHARACTERISTICS; - -#define NDIS_SIZEOF_MINIPORT_PNP_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_PNP_CHARACTERISTICS, Flags) - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMRegisterInterruptEx( - __in NDIS_HANDLE MiniportAdapterHandle, - __in NDIS_HANDLE MiniportInterruptContext, - __in PNDIS_MINIPORT_INTERRUPT_CHARACTERISTICS MiniportInterruptCharacteristics, - __out PNDIS_HANDLE NdisInterruptHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMDeregisterInterruptEx( - __in NDIS_HANDLE NdisInterruptHandle - ); - -EXPORT -BOOLEAN -NdisMSynchronizeWithInterruptEx( - __in NDIS_HANDLE NdisInterruptHandle, - __in ULONG MessageId, -#if (NDIS_SUPPORT_NDIS620) - __in MINIPORT_SYNCHRONIZE_INTERRUPT_HANDLER SynchronizeFunction, -#else - __in PVOID SynchronizeFunction, -#endif - __in __drv_isObjectPointer - PVOID SynchronizeContext - ); - -#if NDIS_SUPPORT_60_COMPATIBLE_API - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -ULONG -NdisMQueueDpc( - __in NDIS_HANDLE NdisInterruptHandle, - __in ULONG MessageId, - __in ULONG TargetProcessors, - __in_opt __drv_isObjectPointer - PVOID MiniportDpcContext - ); - -#endif - -#if NDIS_SUPPORT_NDIS620 - -EXPORT -KAFFINITY -NdisMQueueDpcEx( - IN NDIS_HANDLE NdisInterruptHandle, - IN ULONG MessageId, - IN PGROUP_AFFINITY TargetProcessors, - IN PVOID MiniportDpcContext - ); - -#endif - - - -#endif // NDIS_SUPPORT_NDIS6 - -#if NDIS_LEGACY_MINIPORT -#if (((NDIS_MINIPORT_MAJOR_VERSION == 5) && (NDIS_MINIPORT_MINOR_VERSION == 1)) || NDIS_WRAPPER) -typedef struct _NDIS51_MINIPORT_CHARACTERISTICS -{ -#ifdef __cplusplus - NDIS50_MINIPORT_CHARACTERISTICS Ndis50Chars; -#else - NDIS50_MINIPORT_CHARACTERISTICS; -#endif - // - // Extensions for NDIS 5.1 - // - W_CANCEL_SEND_PACKETS_HANDLER CancelSendPacketsHandler; - W_PNP_EVENT_NOTIFY_HANDLER PnPEventNotifyHandler; - W_MINIPORT_SHUTDOWN_HANDLER AdapterShutdownHandler; - PVOID Reserved1; - PVOID Reserved2; - PVOID Reserved3; - PVOID Reserved4; -} NDIS51_MINIPORT_CHARACTERISTICS; -#endif // (((NDIS_MINIPORT_MAJOR_VERSION == 5) && (NDIS_MINIPORT_MINOR_VERSION == 1)) || NDIS_WRAPPER) - -typedef struct _NDIS_MINIPORT_INTERRUPT -{ - PKINTERRUPT InterruptObject; - KSPIN_LOCK DpcCountLock; - PVOID Reserved; - W_ISR_HANDLER MiniportIsr; - W_HANDLE_INTERRUPT_HANDLER MiniportDpc; - KDPC InterruptDpc; - PNDIS_MINIPORT_BLOCK Miniport; - - UCHAR DpcCount; - BOOLEAN Filler1; - - // - // This is used to tell when all the Dpcs for the adapter are completed. - // - - KEVENT DpcsCompletedEvent; - - BOOLEAN SharedInterrupt; - BOOLEAN IsrRequested; - -} NDIS_MINIPORT_INTERRUPT, *PNDIS_MINIPORT_INTERRUPT; -#endif // NDIS_LEGACY_MINIPORT - -typedef struct _NDIS_MINIPORT_TIMER -{ - KTIMER Timer; - KDPC Dpc; - PNDIS_TIMER_FUNCTION MiniportTimerFunction; - PVOID MiniportTimerContext; - PNDIS_MINIPORT_BLOCK Miniport; - struct _NDIS_MINIPORT_TIMER *NextTimer; -} NDIS_MINIPORT_TIMER, *PNDIS_MINIPORT_TIMER; - -#if NDIS_LEGACY_MINIPORT -typedef -VOID -(*ETH_RCV_INDICATE_HANDLER)( - __in PETH_FILTER Filter, - __in NDIS_HANDLE MacReceiveContext, - __in PCHAR Address, - __in PVOID HeaderBuffer, - __in UINT HeaderBufferSize, - __in PVOID LookaheadBuffer, - __in UINT LookaheadBufferSize, - __in UINT PacketSize - ); - -typedef -VOID -(*ETH_RCV_COMPLETE_HANDLER)( - __in PETH_FILTER Filter - ); - -typedef -VOID -(*TR_RCV_INDICATE_HANDLER)( - __in PTR_FILTER Filter, - __in NDIS_HANDLE MacReceiveContext, - __in PVOID HeaderBuffer, - __in UINT HeaderBufferSize, - __in PVOID LookaheadBuffer, - __in UINT LookaheadBufferSize, - __in UINT PacketSize - ); - -typedef -VOID -(*TR_RCV_COMPLETE_HANDLER)( - __in PTR_FILTER Filter - ); - -typedef -VOID -(*WAN_RCV_HANDLER)( - __out PNDIS_STATUS Status, - __in NDIS_HANDLE MiniportAdapterHandle, - __in NDIS_HANDLE NdisLinkContext, - __in PUCHAR Packet, - __in ULONG PacketSize - ); - -typedef -VOID -(*WAN_RCV_COMPLETE_HANDLER)( - __in NDIS_HANDLE MiniportAdapterHandle, - __in NDIS_HANDLE NdisLinkContext - ); - -typedef -VOID -(*NDIS_M_SEND_COMPLETE_HANDLER)( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNDIS_PACKET Packet, - __in NDIS_STATUS Status - ); - -typedef -VOID -(*NDIS_WM_SEND_COMPLETE_HANDLER)( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PVOID Packet, - __in NDIS_STATUS Status - ); - -typedef -VOID -(*NDIS_M_TD_COMPLETE_HANDLER)( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNDIS_PACKET Packet, - __in NDIS_STATUS Status, - __in UINT BytesTransferred - ); - -typedef -VOID -(*NDIS_M_SEND_RESOURCES_HANDLER)( - __in NDIS_HANDLE MiniportAdapterHandle - ); - -typedef -VOID -(*NDIS_M_STATUS_HANDLER)( - __in NDIS_HANDLE MiniportHandle, - __in NDIS_STATUS GeneralStatus, - __in PVOID StatusBuffer, - __in UINT StatusBufferSize - ); - -typedef -VOID -(*NDIS_M_STS_COMPLETE_HANDLER)( - __in NDIS_HANDLE MiniportAdapterHandle - ); - -typedef -VOID -(*NDIS_M_REQ_COMPLETE_HANDLER)( - __in NDIS_HANDLE MiniportAdapterHandle, - __in NDIS_STATUS Status - ); - -typedef -VOID -(*NDIS_M_RESET_COMPLETE_HANDLER)( - __in NDIS_HANDLE MiniportAdapterHandle, - __in NDIS_STATUS Status, - __in BOOLEAN AddressingReset - ); - -typedef -BOOLEAN -(FASTCALL *NDIS_M_START_SENDS)( - __in PNDIS_MINIPORT_BLOCK Miniport - ); - -// -// Wrapper initialization and termination. -// - -EXPORT -VOID -NdisInitializeWrapper( - OUT PNDIS_HANDLE NdisWrapperHandle, - IN PVOID SystemSpecific1, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3 - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisTerminateWrapper( - __in NDIS_HANDLE NdisWrapperHandle, - __in PVOID SystemSpecific - ); - -#endif // NDIS_LEGACY_MINIPORT - -#if NDIS_SUPPORT_NDIS6 - -typedef -VOID -(MINIPORT_PROCESS_SG_LIST)( - __in PDEVICE_OBJECT pDO, - __in PVOID Reserved, - __in PSCATTER_GATHER_LIST pSGL, - __in PVOID Context - ); - -typedef MINIPORT_PROCESS_SG_LIST (*MINIPORT_PROCESS_SG_LIST_HANDLER); -// -// NDIS DMA description structure -// - -typedef -VOID -(MINIPORT_ALLOCATE_SHARED_MEM_COMPLETE)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PVOID VirtualAddress, - __in PNDIS_PHYSICAL_ADDRESS PhysicalAddress, - __in ULONG Length, - __in PVOID Context - ); -typedef MINIPORT_ALLOCATE_SHARED_MEM_COMPLETE (*MINIPORT_ALLOCATE_SHARED_MEM_COMPLETE_HANDLER); - -/* -NDIS_STATUS -NdisMAllocateSharedMemoryAsyncEx( - IN NDIS_HANDLE MiniportDmaHandle, - IN ULONG Length, - IN BOOLEAN Cached, - IN PVOID Context - ); -*/ -#define NdisMAllocateSharedMemoryAsyncEx(_H, _L, _C, _X) NdisMAllocateSharedMemoryAsync(_H, _L, _C, _X) -#endif // NDIS_SUPPORT_NDIS6 - - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisMAllocateSharedMemoryAsync( - __in NDIS_HANDLE MiniportAdapterHandle, - __in ULONG Length, - __in BOOLEAN Cached, - __in PVOID Context - ); - -// -// defintions for subordinate (as referred in Master/subordinate) DMA -// - -// -// DMA Channel information -// -typedef struct _NDIS_DMA_DESCRIPTION -{ - BOOLEAN DemandMode; - BOOLEAN AutoInitialize; - BOOLEAN DmaChannelSpecified; - DMA_WIDTH DmaWidth; - DMA_SPEED DmaSpeed; - ULONG DmaPort; - ULONG DmaChannel; -} NDIS_DMA_DESCRIPTION, *PNDIS_DMA_DESCRIPTION; - -// -// Internal structure representing an NDIS DMA channel -// -typedef struct _NDIS_DMA_BLOCK -{ - PVOID MapRegisterBase; - KEVENT AllocationEvent; - PVOID SystemAdapterObject; - PVOID Miniport; - BOOLEAN InProgress; -} NDIS_DMA_BLOCK, *PNDIS_DMA_BLOCK; - - -EXPORT -VOID -NdisSetupDmaTransfer( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE NdisDmaHandle, - IN PNDIS_BUFFER Buffer, - IN ULONG Offset, - IN ULONG Length, - IN BOOLEAN WriteToDevice - ); - -EXPORT -VOID -NdisCompleteDmaTransfer( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE NdisDmaHandle, - IN PNDIS_BUFFER Buffer, - IN ULONG Offset, - IN ULONG Length, - IN BOOLEAN WriteToDevice - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMRegisterDmaChannel( - __out PNDIS_HANDLE MiniportDmaHandle, - __in NDIS_HANDLE MiniportAdapterHandle, - __in UINT DmaChannel, - __in BOOLEAN Dma32BitAddresses, - __in PNDIS_DMA_DESCRIPTION DmaDescription, - __in ULONG MaximumLength - ); - - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMDeregisterDmaChannel( - __in NDIS_HANDLE MiniportDmaHandle - ); - -/*++ -VOID -NdisMSetupDmaTransfer( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE MiniportDmaHandle, - IN PNDIS_BUFFER Buffer, - IN ULONG Offset, - IN ULONG Length, - IN BOOLEAN WriteToDevice - ) ---*/ -#define NdisMSetupDmaTransfer(_S, _H, _B, _O, _L, _M_) \ - NdisSetupDmaTransfer(_S, _H, _B, _O, _L, _M_) - -/*++ -VOID -NdisMCompleteDmaTransfer( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE MiniportDmaHandle, - IN PNDIS_BUFFER Buffer, - IN ULONG Offset, - IN ULONG Length, - IN BOOLEAN WriteToDevice - ) ---*/ -#define NdisMCompleteDmaTransfer(_S, _H, _B, _O, _L, _M_) \ - NdisCompleteDmaTransfer(_S, _H, _B, _O, _L, _M_) - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -ULONG -NdisMReadDmaCounter( - __in NDIS_HANDLE MiniportDmaHandle - ); - - -// -// This API has been deprecated -// -DECLSPEC_DEPRECATED_DDK -EXPORT -VOID -NdisUpdateSharedMemory( - IN NDIS_HANDLE NdisAdapterHandle, - IN ULONG Length, - IN PVOID VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress - ); - - -#if NDIS_SUPPORT_NDIS6 - - -// -// Flags used in NDIS_SG_DMA_DESCRIPTION -// - -#define NDIS_SG_DMA_64_BIT_ADDRESS 0x00000001 - -// -// supported revision -// -#define NDIS_SG_DMA_DESCRIPTION_REVISION_1 1 - -typedef struct _NDIS_SG_DMA_DESCRIPTION -{ - NDIS_OBJECT_HEADER Header; - ULONG Flags; - ULONG MaximumPhysicalMapping; - MINIPORT_PROCESS_SG_LIST_HANDLER ProcessSGListHandler; - MINIPORT_ALLOCATE_SHARED_MEM_COMPLETE_HANDLER SharedMemAllocateCompleteHandler; - ULONG ScatterGatherListSize; -} NDIS_SG_DMA_DESCRIPTION, *PNDIS_SG_DMA_DESCRIPTION; - -#define NDIS_SIZEOF_SG_DMA_DESCRIPTION_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_SG_DMA_DESCRIPTION, ScatterGatherListSize) - -#define NDIS_MINIPORT_INIT_PARAMETERS_REVISION_1 1 - -typedef struct _NDIS_MINIPORT_INIT_PARAMETERS -{ - __in NDIS_OBJECT_HEADER Header; - __in ULONG Flags; - __in PNDIS_RESOURCE_LIST AllocatedResources; - __in NDIS_HANDLE IMDeviceInstanceContext; - __in NDIS_HANDLE MiniportAddDeviceContext; - __in NET_IFINDEX IfIndex; - __in NET_LUID NetLuid; - __in PNDIS_PORT_AUTHENTICATION_PARAMETERS DefaultPortAuthStates; - __in PNDIS_PCI_DEVICE_CUSTOM_PROPERTIES PciDeviceCustomProperties; -} NDIS_MINIPORT_INIT_PARAMETERS, *PNDIS_MINIPORT_INIT_PARAMETERS; - -#define NDIS_SIZEOF_MINIPORT_INIT_PARAMETER_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_INIT_PARAMETERS, PciDeviceCustomProperties) - -// -// NDIS_MINIPORT_RESTART_PARAMETERS is used in MINIPORT_RESTART handler -// -#define NDIS_MINIPORT_RESTART_PARAMETERS_REVISION_1 1 - -typedef struct _NDIS_MINIPORT_RESTART_PARAMETERS -{ - NDIS_OBJECT_HEADER Header; - PNDIS_RESTART_ATTRIBUTES RestartAttributes; - ULONG Flags; -} NDIS_MINIPORT_RESTART_PARAMETERS, *PNDIS_MINIPORT_RESTART_PARAMETERS; - -#define NDIS_SIZEOF_MINIPORT_RESTART_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_RESTART_PARAMETERS, Flags) - -#define NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_1 1 - -typedef struct _NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES -{ - NDIS_OBJECT_HEADER Header; - NDIS_HANDLE MiniportAdapterContext; - ULONG AttributeFlags; - UINT CheckForHangTimeInSeconds; - NDIS_INTERFACE_TYPE InterfaceType; -} NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES, *PNDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES; - -#define NDIS_SIZEOF_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES, InterfaceType) - -// -// flags used in NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES->SupportedStatistics -// - -#define NDIS_STATISTICS_XMIT_OK_SUPPORTED 0x00000001 -#define NDIS_STATISTICS_RCV_OK_SUPPORTED 0x00000002 -#define NDIS_STATISTICS_XMIT_ERROR_SUPPORTED 0x00000004 -#define NDIS_STATISTICS_RCV_ERROR_SUPPORTED 0x00000008 -#define NDIS_STATISTICS_RCV_NO_BUFFER_SUPPORTED 0x00000010 -#define NDIS_STATISTICS_DIRECTED_BYTES_XMIT_SUPPORTED 0x00000020 -#define NDIS_STATISTICS_DIRECTED_FRAMES_XMIT_SUPPORTED 0x00000040 -#define NDIS_STATISTICS_MULTICAST_BYTES_XMIT_SUPPORTED 0x00000080 -#define NDIS_STATISTICS_MULTICAST_FRAMES_XMIT_SUPPORTED 0x00000100 -#define NDIS_STATISTICS_BROADCAST_BYTES_XMIT_SUPPORTED 0x00000200 -#define NDIS_STATISTICS_BROADCAST_FRAMES_XMIT_SUPPORTED 0x00000400 -#define NDIS_STATISTICS_DIRECTED_BYTES_RCV_SUPPORTED 0x00000800 -#define NDIS_STATISTICS_DIRECTED_FRAMES_RCV_SUPPORTED 0x00001000 -#define NDIS_STATISTICS_MULTICAST_BYTES_RCV_SUPPORTED 0x00002000 -#define NDIS_STATISTICS_MULTICAST_FRAMES_RCV_SUPPORTED 0x00004000 -#define NDIS_STATISTICS_BROADCAST_BYTES_RCV_SUPPORTED 0x00008000 -#define NDIS_STATISTICS_BROADCAST_FRAMES_RCV_SUPPORTED 0x00010000 -#define NDIS_STATISTICS_RCV_CRC_ERROR_SUPPORTED 0x00020000 -#define NDIS_STATISTICS_TRANSMIT_QUEUE_LENGTH_SUPPORTED 0x00040000 -#define NDIS_STATISTICS_BYTES_RCV_SUPPORTED 0x00080000 -#define NDIS_STATISTICS_BYTES_XMIT_SUPPORTED 0x00100000 -#define NDIS_STATISTICS_RCV_DISCARDS_SUPPORTED 0x00200000 -#define NDIS_STATISTICS_GEN_STATISTICS_SUPPORTED 0x00400000 -#define NDIS_STATISTICS_XMIT_DISCARDS_SUPPORTED 0x08000000 - - -#define NDIS_MINIPORT_ADD_DEVICE_REGISTRATION_ATTRIBUTES_REVISION_1 1 - -typedef struct _NDIS_MINIPORT_ADD_DEVICE_REGISTRATION_ATTRIBUTES -{ - NDIS_OBJECT_HEADER Header; - NDIS_HANDLE MiniportAddDeviceContext; - ULONG Flags; - -} NDIS_MINIPORT_ADD_DEVICE_REGISTRATION_ATTRIBUTES, - *PNDIS_MINIPORT_ADD_DEVICE_REGISTRATION_ATTRIBUTES; - -#define NDIS_SIZEOF_MINIPORT_ADD_DEVICE_REGISTRATION_ATTRIBUTES_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_ADD_DEVICE_REGISTRATION_ATTRIBUTES, Flags) - -#define NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_1 1 - -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_2 2 -#endif - -typedef struct _NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES -{ - NDIS_OBJECT_HEADER Header; - ULONG Flags; - NDIS_MEDIUM MediaType; - NDIS_PHYSICAL_MEDIUM PhysicalMediumType; - ULONG MtuSize; - ULONG64 MaxXmitLinkSpeed; - ULONG64 XmitLinkSpeed; - ULONG64 MaxRcvLinkSpeed; - ULONG64 RcvLinkSpeed; - NDIS_MEDIA_CONNECT_STATE MediaConnectState; - NDIS_MEDIA_DUPLEX_STATE MediaDuplexState; - ULONG LookaheadSize; - PNDIS_PNP_CAPABILITIES PowerManagementCapabilities; // 6.20 drivers must use PowerManagementCapabilitiesEx - ULONG MacOptions; - ULONG SupportedPacketFilters; - ULONG MaxMulticastListSize; - USHORT MacAddressLength; - UCHAR PermanentMacAddress[NDIS_MAX_PHYS_ADDRESS_LENGTH]; - UCHAR CurrentMacAddress[NDIS_MAX_PHYS_ADDRESS_LENGTH]; - PNDIS_RECEIVE_SCALE_CAPABILITIES RecvScaleCapabilities; - NET_IF_ACCESS_TYPE AccessType; // NET_IF_ACCESS_BROADCAST for a typical ethernet adapter - NET_IF_DIRECTION_TYPE DirectionType; // NET_IF_DIRECTION_SENDRECEIVE for a typical ethernet adapter - NET_IF_CONNECTION_TYPE ConnectionType; // IF_CONNECTION_DEDICATED for a typical ethernet adapter - NET_IFTYPE IfType; // IF_TYPE_ETHERNET_CSMACD for a typical ethernet adapter (regardless of speed) - BOOLEAN IfConnectorPresent; // RFC 2665 TRUE if physical adapter - ULONG SupportedStatistics; // use NDIS_STATISTICS_XXXX_SUPPORTED - ULONG SupportedPauseFunctions; // IEEE 802.3 37.2.1 - ULONG DataBackFillSize; - ULONG ContextBackFillSize; - PNDIS_OID SupportedOidList; - ULONG SupportedOidListLength; - ULONG AutoNegotiationFlags; -#if (NDIS_SUPPORT_NDIS620) - PNDIS_PM_CAPABILITIES PowerManagementCapabilitiesEx; -#endif -} NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES, *PNDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES; - -#define NDIS_SIZEOF_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES, AutoNegotiationFlags) - -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_SIZEOF_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_2 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES, PowerManagementCapabilitiesEx) -#endif - -#if (NDIS_SUPPORT_NDIS61) - -// -// Flags and structure for Header/Data split -// -#define NDIS_HD_SPLIT_ATTRIBUTES_REVISION_1 1 - -typedef struct _NDIS_HD_SPLIT_ATTRIBUTES -{ - __in NDIS_OBJECT_HEADER Header; - __in ULONG HardwareCapabilities; - __in ULONG CurrentCapabilities; - __out ULONG HDSplitFlags; - __out ULONG BackfillSize; - __out ULONG MaxHeaderSize; -} NDIS_HD_SPLIT_ATTRIBUTES, *PNDIS_HD_SPLIT_ATTRIBUTES; - -#define NDIS_SIZEOF_HD_SPLIT_ATTRIBUTES_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_HD_SPLIT_ATTRIBUTES, MaxHeaderSize) - -// -// The miniport registers its hardware assist capabilities through this -// structure -// -#define NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES_REVISION_1 1 - -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES_REVISION_2 2 -#endif - - -typedef struct _NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES -{ - NDIS_OBJECT_HEADER Header; - PNDIS_HD_SPLIT_ATTRIBUTES HDSplitAttributes; -#if (NDIS_SUPPORT_NDIS620) - PNDIS_RECEIVE_FILTER_CAPABILITIES HardwareReceiveFilterCapabilities; - PNDIS_RECEIVE_FILTER_CAPABILITIES CurrentReceiveFilterCapabilities; - PNDIS_NIC_SWITCH_CAPABILITIES HardwareNicSwitchCapabilities; - PNDIS_NIC_SWITCH_CAPABILITIES CurrentNicSwitchCapabilities; -#endif -} NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES, *PNDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES; - -#define NDIS_SIZEOF_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES, HDSplitAttributes) - -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_SIZEOF_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES_REVISION_2 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES, CurrentNicSwitchCapabilities) -#endif - -#endif // (NDIS_SUPPORT_NDIS61) - -// -// The miniport registers its offload capabilities through this -// structure -// -#define NDIS_MINIPORT_ADAPTER_OFFLOAD_ATTRIBUTES_REVISION_1 1 -typedef struct _NDIS_MINIPORT_ADAPTER_OFFLOAD_ATTRIBUTES -{ - NDIS_OBJECT_HEADER Header; - PNDIS_OFFLOAD DefaultOffloadConfiguration; - PNDIS_OFFLOAD HardwareOffloadCapabilities; - PNDIS_TCP_CONNECTION_OFFLOAD DefaultTcpConnectionOffloadConfiguration; - PNDIS_TCP_CONNECTION_OFFLOAD TcpConnectionOffloadHardwareCapabilities; -} NDIS_MINIPORT_ADAPTER_OFFLOAD_ATTRIBUTES, *PNDIS_MINIPORT_ADAPTER_OFFLOAD_ATTRIBUTES; - -#define NDIS_SIZEOF_MINIPORT_ADAPTER_OFFLOAD_ATTRIBUTES_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_ADAPTER_OFFLOAD_ATTRIBUTES, TcpConnectionOffloadHardwareCapabilities) - -#include - -#define NDIS_MINIPORT_ADAPTER_802_11_ATTRIBUTES_REVISION_1 1 -#define NDIS_MINIPORT_ADAPTER_802_11_ATTRIBUTES_REVISION_2 2 - -typedef struct _NDIS_MINIPORT_ADAPTER_NATIVE_802_11_ATTRIBUTES -{ - NDIS_OBJECT_HEADER Header; - - ULONG OpModeCapability; - ULONG NumOfTXBuffers; - ULONG NumOfRXBuffers; - BOOLEAN MultiDomainCapabilityImplemented; - ULONG NumSupportedPhys; -#ifdef __midl - [size_is(NumSupportedPhys)] -#endif - PDOT11_PHY_ATTRIBUTES SupportedPhyAttributes; - - // Attributes specific to the operation modes - PDOT11_EXTSTA_ATTRIBUTES ExtSTAAttributes; - - -#if (NDIS_SUPPORT_NDIS620) - // virtual wifi specific attributes - PDOT11_VWIFI_ATTRIBUTES VWiFiAttributes; - // Ext AP specific attributes - PDOT11_EXTAP_ATTRIBUTES ExtAPAttributes; -#endif // (NDIS_SUPPORT_NDIS620) - - -}NDIS_MINIPORT_ADAPTER_NATIVE_802_11_ATTRIBUTES, - *PNDIS_MINIPORT_ADAPTER_NATIVE_802_11_ATTRIBUTES; - -#define NDIS_SIZEOF_MINIPORT_ADAPTER_NATIVE_802_11_ATTRIBUTES_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_ADAPTER_NATIVE_802_11_ATTRIBUTES, ExtSTAAttributes) - -#if (NDIS_SUPPORT_NDIS620) - -#define NDIS_SIZEOF_MINIPORT_ADAPTER_NATIVE_802_11_ATTRIBUTES_REVISION_2 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_ADAPTER_NATIVE_802_11_ATTRIBUTES, ExtAPAttributes) - -#endif // (NDIS_SUPPORT_NDIS620) - - -typedef union _NDIS_MINIPORT_ADAPTER_ATTRIBUTES -{ - NDIS_MINIPORT_ADD_DEVICE_REGISTRATION_ATTRIBUTES AddDeviceRegistrationAttributes; - NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES RegistrationAttributes; - NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES GeneralAttributes; - NDIS_MINIPORT_ADAPTER_OFFLOAD_ATTRIBUTES OffloadAttributes; - NDIS_MINIPORT_ADAPTER_NATIVE_802_11_ATTRIBUTES Native_802_11_Attributes; -#if (NDIS_SUPPORT_NDIS61) - NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES HardwareAssistAttributes; -#endif // (NDIS_SUPPORT_NDIS61) -} NDIS_MINIPORT_ADAPTER_ATTRIBUTES, *PNDIS_MINIPORT_ADAPTER_ATTRIBUTES; - - -// -// flags used in NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES -// - -#define NDIS_MINIPORT_ATTRIBUTES_HARDWARE_DEVICE 0x00000001 -#define NDIS_MINIPORT_ATTRIBUTES_NDIS_WDM 0x00000002 -#define NDIS_MINIPORT_ATTRIBUTES_SURPRISE_REMOVE_OK 0x00000004 -#define NDIS_MINIPORT_ATTRIBUTES_NOT_CO_NDIS 0x00000008 -#define NDIS_MINIPORT_ATTRIBUTES_DO_NOT_BIND_TO_ALL_CO 0x00000010 -#define NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND 0x00000020 -#define NDIS_MINIPORT_ATTRIBUTES_BUS_MASTER 0x00000040 -#define NDIS_MINIPORT_ATTRIBUTES_CONTROLS_DEFAULT_PORT 0x00000080 - -// -// NDIS 6.0 miniport's entry points -// - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMSetMiniportAttributes( - __in NDIS_HANDLE NdisMiniportHandle, - __in_bcount(((NDIS_OBJECT_HEADER)MiniportAttributes).Size) - PNDIS_MINIPORT_ADAPTER_ATTRIBUTES MiniportAttributes - ); - -typedef -NDIS_STATUS -(MINIPORT_INITIALIZE)( - __in NDIS_HANDLE NdisMiniportHandle, - __in NDIS_HANDLE MiniportDriverContext, - __in PNDIS_MINIPORT_INIT_PARAMETERS MiniportInitParameters - ); - -typedef MINIPORT_INITIALIZE (*MINIPORT_INITIALIZE_HANDLER); - -typedef enum _NDIS_HALT_ACTION -{ - NdisHaltDeviceDisabled, - NdisHaltDeviceInstanceDeInitialized, - NdisHaltDevicePoweredDown, - NdisHaltDeviceSurpriseRemoved, - NdisHaltDeviceFailed, - NdisHaltDeviceInitializationFailed, - NdisHaltDeviceStopped -} NDIS_HALT_ACTION, *PNDIS_HALT_ACTION; - -typedef -VOID -(MINIPORT_HALT)( - __in NDIS_HANDLE MiniportAdapterContext, - __in NDIS_HALT_ACTION HaltAction - ); - -typedef MINIPORT_HALT (*MINIPORT_HALT_HANDLER); - - -#define NDIS_MINIPORT_PAUSE_PARAMETERS_REVISION_1 1 - -typedef struct _NDIS_MINIPORT_PAUSE_PARAMETERS -{ - NDIS_OBJECT_HEADER Header; - ULONG Flags; - ULONG PauseReason; -} NDIS_MINIPORT_PAUSE_PARAMETERS, *PNDIS_MINIPORT_PAUSE_PARAMETERS; - -#define NDIS_SIZEOF_MINIPORT_PAUSE_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_PAUSE_PARAMETERS, PauseReason) - -typedef -NDIS_STATUS -(MINIPORT_PAUSE)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PNDIS_MINIPORT_PAUSE_PARAMETERS PauseParameters - ); - -typedef MINIPORT_PAUSE (*MINIPORT_PAUSE_HANDLER); - -typedef -NDIS_STATUS -(MINIPORT_RESTART)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PNDIS_MINIPORT_RESTART_PARAMETERS RestartParameters - ); - -typedef MINIPORT_RESTART (*MINIPORT_RESTART_HANDLER); - -typedef -NDIS_STATUS -(MINIPORT_OID_REQUEST) ( - __in NDIS_HANDLE MiniportAdapterContext, - __in PNDIS_OID_REQUEST OidRequest - ); - -typedef MINIPORT_OID_REQUEST (*MINIPORT_OID_REQUEST_HANDLER); - -typedef -VOID -(MINIPORT_UNLOAD) ( - __in PDRIVER_OBJECT DriverObject - ); -typedef MINIPORT_UNLOAD (*MINIPORT_DRIVER_UNLOAD); - -// -// reasons for calling shutdown handler -// -typedef enum _NDIS_SHUTDOWN_ACTION { - NdisShutdownPowerOff, - NdisShutdownBugCheck -} NDIS_SHUTDOWN_ACTION, PNDIS_SHUTDOWN_ACTION; - -typedef -VOID -(MINIPORT_SHUTDOWN) ( - __in NDIS_HANDLE MiniportAdapterContext, - __in NDIS_SHUTDOWN_ACTION ShutdownAction - ); - -typedef MINIPORT_SHUTDOWN (*MINIPORT_SHUTDOWN_HANDLER); - - -#define NET_DEVICE_PNP_EVENT_REVISION_1 1 - -typedef struct _NET_DEVICE_PNP_EVENT -{ - NDIS_OBJECT_HEADER Header; - NDIS_PORT_NUMBER PortNumber; - NDIS_DEVICE_PNP_EVENT DevicePnPEvent; - PVOID InformationBuffer; - ULONG InformationBufferLength; - UCHAR NdisReserved[2 * sizeof(PVOID)]; - -} NET_DEVICE_PNP_EVENT, *PNET_DEVICE_PNP_EVENT; - -#define NDIS_SIZEOF_NET_DEVICE_PNP_EVENT_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NET_DEVICE_PNP_EVENT, NdisReserved) - -typedef -VOID -(MINIPORT_DEVICE_PNP_EVENT_NOTIFY)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PNET_DEVICE_PNP_EVENT NetDevicePnPEvent - ); - -typedef MINIPORT_DEVICE_PNP_EVENT_NOTIFY (*MINIPORT_DEVICE_PNP_EVENT_NOTIFY_HANDLER); - -typedef -VOID -(MINIPORT_CANCEL_SEND)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PVOID CancelId - ); - -typedef MINIPORT_CANCEL_SEND (*MINIPORT_CANCEL_SEND_HANDLER); - -typedef -BOOLEAN -(MINIPORT_CHECK_FOR_HANG)( - __in NDIS_HANDLE MiniportAdapterContext - ); - -typedef MINIPORT_CHECK_FOR_HANG (*MINIPORT_CHECK_FOR_HANG_HANDLER); - -typedef -NDIS_STATUS -(MINIPORT_RESET)( - __in NDIS_HANDLE MiniportAdapterContext, - __out PBOOLEAN AddressingReset - ); - -typedef MINIPORT_RESET (*MINIPORT_RESET_HANDLER); - -typedef -VOID -(MINIPORT_CANCEL_OID_REQUEST)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PVOID RequestId - ); - -typedef MINIPORT_CANCEL_OID_REQUEST (*MINIPORT_CANCEL_OID_REQUEST_HANDLER); - -typedef -VOID -(MINIPORT_SEND_NET_BUFFER_LISTS)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PNET_BUFFER_LIST NetBufferList, - __in NDIS_PORT_NUMBER PortNumber, - __in ULONG SendFlags - ); - -typedef MINIPORT_SEND_NET_BUFFER_LISTS (*MINIPORT_SEND_NET_BUFFER_LISTS_HANDLER); - -typedef -VOID -(MINIPORT_RETURN_NET_BUFFER_LISTS)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PNET_BUFFER_LIST NetBufferLists, - __in ULONG ReturnFlags - ); - -typedef MINIPORT_RETURN_NET_BUFFER_LISTS (*MINIPORT_RETURN_NET_BUFFER_LISTS_HANDLER); - -#if (NDIS_SUPPORT_NDIS61) -// -// NDIS 6.1 miniport's entry points -// - -typedef -NDIS_STATUS -(MINIPORT_DIRECT_OID_REQUEST) ( - __in NDIS_HANDLE MiniportAdapterContext, - __in PNDIS_OID_REQUEST OidRequest - ); - -typedef MINIPORT_DIRECT_OID_REQUEST (*MINIPORT_DIRECT_OID_REQUEST_HANDLER); - -typedef -VOID -(MINIPORT_CANCEL_DIRECT_OID_REQUEST)( - __in NDIS_HANDLE MiniportAdapterContext, - __in PVOID RequestId - ); - -typedef MINIPORT_CANCEL_DIRECT_OID_REQUEST (*MINIPORT_CANCEL_DIRECT_OID_REQUEST_HANDLER); - - -#endif // (NDIS_SUPPORT_NDIS61) - -// -// flags used in Flags field of NDIS60_MINIPORT_CHARACTERISTICS -// -#define NDIS_INTERMEDIATE_DRIVER 0x00000001 -#define NDIS_WDM_DRIVER 0x00000002 - - -#define NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_1 1 - -#if (NDIS_SUPPORT_NDIS61) -#define NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2 2 -#endif // (NDIS_SUPPORT_NDIS61) - -typedef struct _NDIS_MINIPORT_DRIVER_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; - UCHAR MajorNdisVersion; - UCHAR MinorNdisVersion; - UCHAR MajorDriverVersion; - UCHAR MinorDriverVersion; - ULONG Flags; - SET_OPTIONS_HANDLER SetOptionsHandler; - MINIPORT_INITIALIZE_HANDLER InitializeHandlerEx; - MINIPORT_HALT_HANDLER HaltHandlerEx; - MINIPORT_DRIVER_UNLOAD UnloadHandler; - MINIPORT_PAUSE_HANDLER PauseHandler; - MINIPORT_RESTART_HANDLER RestartHandler; - MINIPORT_OID_REQUEST_HANDLER OidRequestHandler; - MINIPORT_SEND_NET_BUFFER_LISTS_HANDLER SendNetBufferListsHandler; - MINIPORT_RETURN_NET_BUFFER_LISTS_HANDLER ReturnNetBufferListsHandler; - MINIPORT_CANCEL_SEND_HANDLER CancelSendHandler; - MINIPORT_CHECK_FOR_HANG_HANDLER CheckForHangHandlerEx; - MINIPORT_RESET_HANDLER ResetHandlerEx; - MINIPORT_DEVICE_PNP_EVENT_NOTIFY_HANDLER DevicePnPEventNotifyHandler; - MINIPORT_SHUTDOWN_HANDLER ShutdownHandlerEx; - MINIPORT_CANCEL_OID_REQUEST_HANDLER CancelOidRequestHandler; -#if (NDIS_SUPPORT_NDIS61) - MINIPORT_DIRECT_OID_REQUEST_HANDLER DirectOidRequestHandler; - MINIPORT_CANCEL_DIRECT_OID_REQUEST_HANDLER CancelDirectOidRequestHandler; -#endif // (NDIS_SUPPORT_NDIS61) -} NDIS_MINIPORT_DRIVER_CHARACTERISTICS, *PNDIS_MINIPORT_DRIVER_CHARACTERISTICS; - -#define NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_DRIVER_CHARACTERISTICS, CancelOidRequestHandler) - -#if (NDIS_SUPPORT_NDIS61) -#define NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_DRIVER_CHARACTERISTICS, CancelDirectOidRequestHandler) -#endif // (NDIS_SUPPORT_NDIS61) - -// -// CO NDIS 6.0 handlers -// - -#define NDIS_MINIPORT_CO_CHARACTERISTICS_REVISION_1 1 - -typedef struct _NDIS_MINIPORT_CO_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; // Header.Type = NDIS_OBJECT_TYPE_PROTOCOL_CO_CHARACTERISTICS - ULONG Flags; - W_CO_CREATE_VC_HANDLER CoCreateVcHandler; - W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; - W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; - W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; - W_CO_SEND_NET_BUFFER_LISTS_HANDLER CoSendNetBufferListsHandler; - W_CO_OID_REQUEST_HANDLER CoOidRequestHandler; - -} NDIS_MINIPORT_CO_CHARACTERISTICS, *PNDIS_MINIPORT_CO_CHARACTERISTICS; - -#define NDIS_SIZEOF_MINIPORT_CO_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MINIPORT_CO_CHARACTERISTICS, CoOidRequestHandler) - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMIndicateStatusEx( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNDIS_STATUS_INDICATION StatusIndication - ); - -EXPORT -VOID -NdisMCoOidRequestComplete( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_HANDLE NdisMiniportVcHandle, - IN PNDIS_OID_REQUEST Request, - IN NDIS_STATUS Status - ); - - -EXPORT -NDIS_STATUS -NdisMCmOidRequest( - IN NDIS_HANDLE NdisAfHandle, - IN NDIS_HANDLE NdisVcHandle OPTIONAL, - IN NDIS_HANDLE NdisPartyHandle OPTIONAL, - IN OUT PNDIS_OID_REQUEST NdisRequest - ); - - -EXPORT -VOID -NdisMCoIndicateStatusEx( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_HANDLE NdisVcHandle OPTIONAL, - IN PNDIS_STATUS_INDICATION StatusIndication - ); - -#endif // NDIS_SUPPORT_NDIS6 - - -// -// Do not change the structure below !!! -// -typedef struct -{ - union - { - PETH_FILTER EthDB; - PNULL_FILTER NullDB; // Default Filter - }; - PTR_FILTER TrDB; - - PVOID YYYDB; - - PVOID XXXDB; -} FILTERDBS, *PFILTERDBS; - -#if NDIS_LEGACY_MINIPORT -typedef -VOID -(*FILTER_PACKET_INDICATION_HANDLER)( - __in NDIS_HANDLE Miniport, - __in PPNDIS_PACKET PacketArray, - __in UINT NumberOfPackets - ); - -#endif // NDIS_LEGACY_MINIPORT - -#if !NDIS_WRAPPER -// -// one of these per mini-port registered on a Driver -// - -#if NDIS_LEGACY_MINIPORT - -#pragma warning(push) - -#pragma warning(disable:4201) // (nonstandard extension used : nameless struct/union) - - -struct _NDIS_MINIPORT_BLOCK -{ - NDIS_OBJECT_HEADER Header; - PNDIS_MINIPORT_BLOCK NextMiniport; // used by driver's MiniportQueue - PNDIS_MINIPORT_BLOCK BaseMiniport; - NDIS_HANDLE MiniportAdapterContext; // context when calling mini-port functions - UNICODE_STRING Reserved4; - PVOID Reserved10; - NDIS_HANDLE OpenQueue; // queue of opens for this mini-port - REFERENCE ShortRef; // contains spinlock for OpenQueue - - NDIS_HANDLE Reserved12; - - UCHAR Padding1; // DO NOT REMOVE OR NDIS WILL BREAK!!! - - // - // Synchronization stuff. - // - // The boolean is used to lock out several DPCs from running at the same time. - // - UCHAR LockAcquired; // EXPOSED via macros. Do not move - - UCHAR PmodeOpens; // Count of opens which turned on pmode/all_local - - // - // This is the processor number that the miniport's - // interrupt DPC and timers are running on. - // - // Note: This field is no longer used - // - UCHAR Reserved23; - - KSPIN_LOCK Lock; - - PNDIS_REQUEST MediaRequest; - - PVOID Interrupt; - - ULONG Flags; // Flags to keep track of the miniport's state. - ULONG PnPFlags; - - // - // Send information - // - LIST_ENTRY PacketList; - PNDIS_PACKET FirstPendingPacket; // This is head of the queue of packets - // waiting to be sent to miniport. - PNDIS_PACKET ReturnPacketsQueue; - - // - // Space used for temp. use during request processing - // - ULONG RequestBuffer; - PVOID SetMCastBuffer; - - PNDIS_MINIPORT_BLOCK PrimaryMiniport; - PVOID Reserved11; - - // - // context to pass to bus driver when reading or writing config space - // - PVOID BusDataContext; - ULONG Reserved3; - - // - // Resource information - // - PCM_RESOURCE_LIST Resources; - - // - // Watch-dog timer - // - NDIS_TIMER WakeUpDpcTimer; - - // - // Needed for PnP. Upcased version. The buffer is allocated as part of the - // NDIS_MINIPORT_BLOCK itself. - // - // Note: - // the following two fields should be explicitly UNICODE_STRING because - // under Win9x the NDIS_STRING is an ANSI_STRING - // - UNICODE_STRING Reserved20; - UNICODE_STRING SymbolicLinkName; - - // - // Check for hang stuff - // - ULONG CheckForHangSeconds; - USHORT CFHangTicks; - USHORT CFHangCurrentTick; - - // - // Reset information - // - NDIS_STATUS ResetStatus; - NDIS_HANDLE ResetOpen; - - // - // Holds media specific information. - // -#ifdef __cplusplus - FILTERDBS FilterDbs; // EXPOSED via macros. Do not move -#else - FILTERDBS; // EXPOSED via macros. Do not move -#endif - - FILTER_PACKET_INDICATION_HANDLER PacketIndicateHandler; - NDIS_M_SEND_COMPLETE_HANDLER SendCompleteHandler; - NDIS_M_SEND_RESOURCES_HANDLER SendResourcesHandler; - NDIS_M_RESET_COMPLETE_HANDLER ResetCompleteHandler; - - NDIS_MEDIUM MediaType; - - // - // contains mini-port information - // - ULONG BusNumber; - NDIS_INTERFACE_TYPE BusType; - NDIS_INTERFACE_TYPE AdapterType; - - PDEVICE_OBJECT Reserved6; - PDEVICE_OBJECT Reserved7; - PDEVICE_OBJECT Reserved8; - - - PVOID MiniportSGDmaBlock; - - // - // List of registered address families. Valid for the call-manager, Null for the client - // - PNDIS_AF_LIST CallMgrAfList; - - PVOID MiniportThread; - PVOID SetInfoBuf; - USHORT SetInfoBufLen; - USHORT MaxSendPackets; - - // - // Status code that is returned from the fake handlers. - // - NDIS_STATUS FakeStatus; - - PVOID Reserved24; // For the filter lock - - PUNICODE_STRING Reserved9; - - PVOID Reserved21; - - UINT MacOptions; - - // - // RequestInformation - // - PNDIS_REQUEST PendingRequest; - UINT MaximumLongAddresses; - UINT MaximumShortAddresses; - UINT CurrentLookahead; - UINT MaximumLookahead; - - // - // For efficiency - // - ULONG_PTR Reserved1; - W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler; - W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler; - W_SEND_PACKETS_HANDLER SendPacketsHandler; - NDIS_M_START_SENDS DeferredSendHandler; - - // - // The following cannot be unionized. - // - ETH_RCV_INDICATE_HANDLER EthRxIndicateHandler; // EXPOSED via macros. Do not move - TR_RCV_INDICATE_HANDLER TrRxIndicateHandler; // EXPOSED via macros. Do not move - PVOID Reserved2; - - ETH_RCV_COMPLETE_HANDLER EthRxCompleteHandler; // EXPOSED via macros. Do not move - TR_RCV_COMPLETE_HANDLER TrRxCompleteHandler; // EXPOSED via macros. Do not move - PVOID Reserved22; - - NDIS_M_STATUS_HANDLER StatusHandler; // EXPOSED via macros. Do not move - NDIS_M_STS_COMPLETE_HANDLER StatusCompleteHandler; // EXPOSED via macros. Do not move - NDIS_M_TD_COMPLETE_HANDLER TDCompleteHandler; // EXPOSED via macros. Do not move - NDIS_M_REQ_COMPLETE_HANDLER QueryCompleteHandler; // EXPOSED via macros. Do not move - NDIS_M_REQ_COMPLETE_HANDLER SetCompleteHandler; // EXPOSED via macros. Do not move - - NDIS_WM_SEND_COMPLETE_HANDLER WanSendCompleteHandler;// EXPOSED via macros. Do not move - WAN_RCV_HANDLER WanRcvHandler; // EXPOSED via macros. Do not move - WAN_RCV_COMPLETE_HANDLER WanRcvCompleteHandler; // EXPOSED via macros. Do not move - - /********************************************************************************************/ - /**************** **********/ - /**************** STUFF ABOVE IS POTENTIALLY ACCESSED BY MACROS. ADD STUFF BELOW **********/ - /**************** SEVERE POSSIBILITY OF BREAKING SOMETHING IF STUFF ABOVE IS MOVED **********/ - /**************** **********/ - /********************************************************************************************/ - -}; - -#pragma warning(pop) - - -#endif // NDIS_LEGACY_MINIPORT - -#endif // NDIS_WRAPPER not defined - - -#if NDIS_LEGACY_MINIPORT - -#ifdef NDIS51_MINIPORT -typedef struct _NDIS51_MINIPORT_CHARACTERISTICS NDIS_MINIPORT_CHARACTERISTICS; -#else -#ifdef NDIS50_MINIPORT -typedef struct _NDIS50_MINIPORT_CHARACTERISTICS NDIS_MINIPORT_CHARACTERISTICS; -#else -#ifdef NDIS40_MINIPORT -typedef struct _NDIS40_MINIPORT_CHARACTERISTICS NDIS_MINIPORT_CHARACTERISTICS; -#else -typedef struct _NDIS30_MINIPORT_CHARACTERISTICS NDIS_MINIPORT_CHARACTERISTICS; -#endif -#endif -#endif - -typedef NDIS_MINIPORT_CHARACTERISTICS * PNDIS_MINIPORT_CHARACTERISTICS; -typedef NDIS_MINIPORT_CHARACTERISTICS NDIS_WAN_MINIPORT_CHARACTERISTICS; -typedef NDIS_WAN_MINIPORT_CHARACTERISTICS * PNDIS_MINIPORT_CHARACTERISTICS; - - -// -// Routines for intermediate miniport drivers. NDIS 6 IM drivers -// use the same registration deregistration APIs as regular miniports -// - -EXPORT -NDIS_STATUS -NdisIMRegisterLayeredMiniport( - IN NDIS_HANDLE NdisWrapperHandle, - IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics, - IN UINT CharacteristicsLength, - OUT PNDIS_HANDLE DriverHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisIMDeregisterLayeredMiniport( - __in NDIS_HANDLE DriverHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMRegisterDevice( - __in NDIS_HANDLE NdisWrapperHandle, - __in PNDIS_STRING DeviceName, - __in PNDIS_STRING SymbolicName, - __in PDRIVER_DISPATCH MajorFunctions[], - __out PDEVICE_OBJECT * pDeviceObject, - __out NDIS_HANDLE * NdisDeviceHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMDeregisterDevice( - __in NDIS_HANDLE NdisDeviceHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMRegisterUnloadHandler( - __in NDIS_HANDLE NdisWrapperHandle, - __in PDRIVER_UNLOAD UnloadHandler - ); - -#endif // NDIS_LEGACY_MINIPORT - - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisIMAssociateMiniport( - __in NDIS_HANDLE DriverHandle, - __in NDIS_HANDLE ProtocolHandle - ); - -// -// Operating System Requests -// -typedef UCHAR NDIS_DMA_SIZE; - -#define NDIS_DMA_24BITS ((NDIS_DMA_SIZE)0) -#define NDIS_DMA_32BITS ((NDIS_DMA_SIZE)1) -#define NDIS_DMA_64BITS ((NDIS_DMA_SIZE)2) - -#if NDIS_LEGACY_MINIPORT -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("NdisMInitializeScatterGatherDma", "See details in NdisMAllocateMapRegisters documentation") -EXPORT -NDIS_STATUS -NdisMAllocateMapRegisters( - __in NDIS_HANDLE MiniportAdapterHandle, - __in UINT DmaChannel, - __in NDIS_DMA_SIZE DmaSize, - __in ULONG BaseMapRegistersNeeded, - __in ULONG MaximumPhysicalMapping - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMFreeMapRegisters( - __in NDIS_HANDLE MiniportAdapterHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMInitializeScatterGatherDma( - __in NDIS_HANDLE MiniportAdapterHandle, - __in BOOLEAN Dma64BitAddresses, - __in ULONG MaximumPhysicalMapping - ); - -#endif // NDIS_LEGACY_MINIPORT - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMRegisterIoPortRange( - __out PVOID * PortOffset, - __in NDIS_HANDLE MiniportAdapterHandle, - __in UINT InitialPort, - __in UINT NumberOfPorts - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMDeregisterIoPortRange( - __in NDIS_HANDLE MiniportAdapterHandle, - __in UINT InitialPort, - __in UINT NumberOfPorts, - __in PVOID PortOffset - ); - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMMapIoSpace( - __deref_out_bcount(Length) PVOID * VirtualAddress, - __in NDIS_HANDLE MiniportAdapterHandle, - __in NDIS_PHYSICAL_ADDRESS PhysicalAddress, - __in UINT Length - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMUnmapIoSpace( - __in NDIS_HANDLE MiniportAdapterHandle, - __in_bcount(Length) PVOID VirtualAddress, - __in UINT Length - ); - -#if NDIS_LEGACY_MINIPORT - -EXPORT -NDIS_STATUS -NdisMRegisterInterrupt( - OUT PNDIS_MINIPORT_INTERRUPT Interrupt, - IN NDIS_HANDLE MiniportAdapterHandle, - IN UINT InterruptVector, - IN UINT InterruptLevel, - IN BOOLEAN RequestIsr, - IN BOOLEAN SharedInterrupt, - IN NDIS_INTERRUPT_MODE InterruptMode - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMDeregisterInterrupt( - __in PNDIS_MINIPORT_INTERRUPT Interrupt - ); - -EXPORT -BOOLEAN -NdisMSynchronizeWithInterrupt( - IN PNDIS_MINIPORT_INTERRUPT Interrupt, -#if (NDIS_SUPPORT_NDIS620) - IN MINIPORT_SYNCHRONIZE_INTERRUPT_HANDLER SynchronizeFunction, -#else - IN PVOID SynchronizeFunction, -#endif - IN PVOID SynchronizeContext - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMQueryAdapterResources( - __out PNDIS_STATUS Status, - __in NDIS_HANDLE WrapperConfigurationContext, - __out PNDIS_RESOURCE_LIST ResourceList, - __deref_inout PUINT BufferSize - ); - -// -// Physical Mapping -// -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMStartBufferPhysicalMapping( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNDIS_BUFFER Buffer, - __in ULONG PhysicalMapRegister, - __in BOOLEAN WriteToDevice, - __out PNDIS_PHYSICAL_ADDRESS_UNIT PhysicalAddressArray, - __out PUINT ArraySize - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMCompleteBufferPhysicalMapping( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNDIS_BUFFER Buffer, - __in ULONG PhysicalMapRegister - ); - -/*++ -// -// This API has been deprecated -// -VOID -NdisMUpdateSharedMemory( - IN NDIS_HANDLE MiniportAdapterHandle, - IN ULONG Length, - IN PVOID VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress - ); -*/ -#define NdisMUpdateSharedMemory(_H, _L, _V, _P) -#pragma deprecated(NdisMUpdateSharedMemory) - - -#endif // NDIS_LEGACY_MINIPORT - -// -// Timers -// -// VOID -// NdisMSetTimer( -// IN PNDIS_MINIPORT_TIMER Timer, -// IN UINT MillisecondsToDelay -// ); -#define NdisMSetTimer(_Timer, _Delay) NdisSetTimer((PNDIS_TIMER)_Timer, _Delay) - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMSetPeriodicTimer( - __in PNDIS_MINIPORT_TIMER Timer, - __in UINT MillisecondPeriod - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMInitializeTimer( - __in OUT PNDIS_MINIPORT_TIMER Timer, - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNDIS_TIMER_FUNCTION TimerFunction, - __in PVOID FunctionContext - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMCancelTimer( - __in PNDIS_MINIPORT_TIMER Timer, - __out __checkReturn - PBOOLEAN TimerCancelled - ); - -__drv_maxIRQL(APC_LEVEL) -EXPORT -VOID -NdisMSleep( - __in ULONG MicrosecondsToSleep - ); - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -ULONG -NdisMGetDmaAlignment( - __in NDIS_HANDLE MiniportAdapterHandle - ); - -// -// Shared memory -// -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMAllocateSharedMemory( - __in NDIS_HANDLE MiniportAdapterHandle, - __in ULONG Length, - __in BOOLEAN Cached, - __deref_out __checkReturn - PVOID * VirtualAddress, - __out __checkReturn - PNDIS_PHYSICAL_ADDRESS PhysicalAddress - ); - - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMFreeSharedMemory( - __in NDIS_HANDLE MiniportAdapterHandle, - __in ULONG Length, - __in BOOLEAN Cached, - __in_bcount(Length) PVOID VirtualAddress, - __in NDIS_PHYSICAL_ADDRESS PhysicalAddress - ); - -#if NDIS_LEGACY_MINIPORT - -// -// Requests Used by Miniport Drivers -// -#define NdisMInitializeWrapper(_a,_b,_c,_d) NdisInitializeWrapper((_a),(_b),(_c),(_d)) - - -EXPORT -NDIS_STATUS -NdisMRegisterMiniport( - IN NDIS_HANDLE NdisWrapperHandle, - IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics, - IN UINT CharacteristicsLength - ); - - -// EXPORT -// NDIS_STATUS -// NdisIMInitializeDeviceInstance( -// IN NDIS_HANDLE DriverHandle, -// IN PNDIS_STRING DriverInstance -// ); -#define NdisIMInitializeDeviceInstance(_H_, _I_) \ - NdisIMInitializeDeviceInstanceEx(_H_, _I_, NULL) -#endif // NDIS_LEGACY_MINIPORT - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisIMInitializeDeviceInstanceEx( - __in NDIS_HANDLE DriverHandle, - __in PNDIS_STRING DriverInstance, - __in_opt NDIS_HANDLE DeviceContext - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisIMCancelInitializeDeviceInstance( - __in NDIS_HANDLE DriverHandle, - __in PNDIS_STRING DeviceInstance - ); - -#if NDIS_LEGACY_MINIPORT -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_HANDLE -NdisIMGetDeviceContext( - __in NDIS_HANDLE MiniportAdapterHandle - ); - -#endif // NDIS_LEGACY_MINIPORT - -__drv_maxIRQL(APC_LEVEL) -EXPORT -NDIS_HANDLE -NdisIMGetBindingContext( - __in NDIS_HANDLE NdisBindingHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisIMDeInitializeDeviceInstance( - __in NDIS_HANDLE NdisMiniportHandle - ); - - -#if NDIS_LEGACY_MINIPORT - -EXPORT -VOID -NdisIMCopySendPerPacketInfo( - OUT PNDIS_PACKET DstPacket, - IN PNDIS_PACKET SrcPacket - ); - -EXPORT -VOID -NdisIMCopySendCompletePerPacketInfo( - OUT PNDIS_PACKET DstPacket, - IN PNDIS_PACKET SrcPacket - ); - -// EXPORT -// VOID -// NdisMSetAttributes( -// IN NDIS_HANDLE MiniportAdapterHandle, -// IN NDIS_HANDLE MiniportAdapterContext, -// IN BOOLEAN BusMaster, -// IN NDIS_INTERFACE_TYPE AdapterType -// ); -#define NdisMSetAttributes(_H_, _C_, _M_, _T_) \ - NdisMSetAttributesEx(_H_, \ - _C_, \ - 0, \ - (_M_) ? NDIS_ATTRIBUTE_BUS_MASTER : 0, \ - _T_) \ - - -EXPORT -VOID -NdisMSetAttributesEx( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_HANDLE MiniportAdapterContext, - IN UINT CheckForHangTimeInSeconds OPTIONAL, - IN ULONG AttributeFlags, - IN NDIS_INTERFACE_TYPE AdapterType OPTIONAL - ); - -#define NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT 0x00000001 -#define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT 0x00000002 -#define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS 0x00000004 -#define NDIS_ATTRIBUTE_BUS_MASTER 0x00000008 -#define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER 0x00000010 -#define NDIS_ATTRIBUTE_DESERIALIZE 0x00000020 -#define NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND 0x00000040 -#define NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK 0x00000080 -#define NDIS_ATTRIBUTE_NOT_CO_NDIS 0x00000100 -#define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS 0x00000200 -#define NDIS_ATTRIBUTE_DO_NOT_BIND_TO_ALL_CO 0x00000400 -#define NDIS_ATTRIBUTE_MINIPORT_PADS_SHORT_PACKETS 0x00000800 - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMSetMiniportSecondary( - __in NDIS_HANDLE MiniportHandle, - __in NDIS_HANDLE PrimaryMiniportHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisMPromoteMiniport( - __in NDIS_HANDLE MiniportHandle - ); - -#endif // NDIS_LEGACY_MINIPORT - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisMRemoveMiniport( - __in NDIS_HANDLE MiniportHandle - ); - - -#if NDIS_LEGACY_MINIPORT - -#define NdisMSendComplete(_M, _P, _S) (*((PNDIS_MINIPORT_BLOCK)(_M))->SendCompleteHandler)(_M, _P, _S) - -#define NdisMSendResourcesAvailable(_M) (*((PNDIS_MINIPORT_BLOCK)(_M))->SendResourcesHandler)(_M) - -#if (!NDIS_WRAPPER) -#if (!NDIS_SUPPORT_NDIS6) - -#define NdisMResetComplete(_M, _S, _A) (*((PNDIS_MINIPORT_BLOCK)(_M))->ResetCompleteHandler)(_M, _S, _A) -#endif // NDIS_SUPPORT_NDIS6 -#endif // !NDIS_WRAPPER - -#define NdisMTransferDataComplete(_M, _P, _S, _B) \ - (*((PNDIS_MINIPORT_BLOCK)(_M))->TDCompleteHandler)(_M, _P, _S, _B) - -/*++ - -VOID -NdisMWanSendComplete( - IN NDIS_HANDLE MiniportAdapterHandle, - IN PVOID Packet, - IN NDIS_STATUS Status - ); - ---*/ - -#define NdisMWanSendComplete(_M_, _P_, _S_) \ - (*((PNDIS_MINIPORT_BLOCK)(_M_))->WanSendCompleteHandler)(_M_, _P_, _S_) - -#define NdisMQueryInformationComplete(_M, _S) \ - (*((PNDIS_MINIPORT_BLOCK)(_M))->QueryCompleteHandler)(_M, _S) - -#define NdisMSetInformationComplete(_M, _S) \ - (*((PNDIS_MINIPORT_BLOCK)(_M))->SetCompleteHandler)(_M, _S) - -/*++ - -VOID -NdisMIndicateReceivePacket( - IN NDIS_HANDLE MiniportAdapterHandle, - IN PPNDIS_PACKET ReceivedPackets, - IN UINT NumberOfPackets - ); - ---*/ -#define NdisMIndicateReceivePacket(_H, _P, _N) \ -{ \ - (*((PNDIS_MINIPORT_BLOCK)(_H))->PacketIndicateHandler)( \ - _H, \ - _P, \ - _N); \ -} - -/*++ - -VOID -NdisMWanIndicateReceive( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_HANDLE NdisLinkContext, - IN PUCHAR Packet, - IN ULONG PacketSize - ); - ---*/ - -#define NdisMWanIndicateReceive(_S_, _M_, _C_, _P_, _Z_) \ - (*((PNDIS_MINIPORT_BLOCK)(_M_))->WanRcvHandler)(_S_, _M_, _C_, _P_, _Z_) - -/*++ - -VOID -NdisMWanIndicateReceiveComplete( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_HANDLE NdisLinkContext - ); - ---*/ - -#define NdisMWanIndicateReceiveComplete(_M_, _C_) \ - (*((PNDIS_MINIPORT_BLOCK)(_M_))->WanRcvCompleteHandler)(_M_, _C_) - -/*++ - -VOID -NdisMEthIndicateReceive( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_HANDLE MiniportReceiveContext, - IN PVOID HeaderBuffer, - IN UINT HeaderBufferSize, - IN PVOID LookaheadBuffer, - IN UINT LookaheadBufferSize, - IN UINT PacketSize - ) - ---*/ -#ifdef __cplusplus - -#define NdisMEthIndicateReceive( _H, _C, _B, _SZ, _L, _LSZ, _PSZ) \ -{ \ - (*((PNDIS_MINIPORT_BLOCK)(_H))->EthRxIndicateHandler)( \ - ((PNDIS_MINIPORT_BLOCK)(_H))->FilterDbs.EthDB, \ - _C, \ - _B, \ - _B, \ - _SZ, \ - _L, \ - _LSZ, \ - _PSZ \ - ); \ -} - -#else - -#define NdisMEthIndicateReceive( _H, _C, _B, _SZ, _L, _LSZ, _PSZ) \ -{ \ - (*((PNDIS_MINIPORT_BLOCK)(_H))->EthRxIndicateHandler)( \ - ((PNDIS_MINIPORT_BLOCK)(_H))->EthDB, \ - _C, \ - _B, \ - _B, \ - _SZ, \ - _L, \ - _LSZ, \ - _PSZ \ - ); \ -} - -#endif - -/*++ - -VOID -NdisMTrIndicateReceive( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_HANDLE MiniportReceiveContext, - IN PVOID HeaderBuffer, - IN UINT HeaderBufferSize, - IN PVOID LookaheadBuffer, - IN UINT LookaheadBufferSize, - IN UINT PacketSize - ) - ---*/ -#ifdef __cplusplus -#define NdisMTrIndicateReceive( _H, _C, _B, _SZ, _L, _LSZ, _PSZ) \ -{ \ - (*((PNDIS_MINIPORT_BLOCK)(_H))->TrRxIndicateHandler)( \ - ((PNDIS_MINIPORT_BLOCK)(_H))->FilterDbs.TrDB, \ - _C, \ - _B, \ - _SZ, \ - _L, \ - _LSZ, \ - _PSZ \ - ); \ -} - -#else - -#define NdisMTrIndicateReceive( _H, _C, _B, _SZ, _L, _LSZ, _PSZ) \ -{ \ - (*((PNDIS_MINIPORT_BLOCK)(_H))->TrRxIndicateHandler)( \ - ((PNDIS_MINIPORT_BLOCK)(_H))->TrDB, \ - _C, \ - _B, \ - _SZ, \ - _L, \ - _LSZ, \ - _PSZ \ - ); \ -} -#endif - -/*++ - -VOID -NdisMEthIndicateReceiveComplete( - IN NDIS_HANDLE MiniportHandle - ); - ---*/ -#ifdef __cplusplus - -#define NdisMEthIndicateReceiveComplete( _H ) \ -{ \ - (*((PNDIS_MINIPORT_BLOCK)(_H))->EthRxCompleteHandler)( \ - ((PNDIS_MINIPORT_BLOCK)_H)->FilterDbs.EthDB); \ -} - -#else - -#define NdisMEthIndicateReceiveComplete( _H ) \ -{ \ - (*((PNDIS_MINIPORT_BLOCK)(_H))->EthRxCompleteHandler)( \ - ((PNDIS_MINIPORT_BLOCK)_H)->EthDB); \ -} - -#endif - - -/*++ - -VOID -NdisMTrIndicateReceiveComplete( - IN NDIS_HANDLE MiniportHandle - ); - ---*/ -#ifdef __cplusplus -#define NdisMTrIndicateReceiveComplete( _H ) \ -{ \ - (*((PNDIS_MINIPORT_BLOCK)(_H))->TrRxCompleteHandler)( \ - ((PNDIS_MINIPORT_BLOCK)_H)->FilterDbs.TrDB); \ -} -#else -#define NdisMTrIndicateReceiveComplete( _H ) \ -{ \ - (*((PNDIS_MINIPORT_BLOCK)(_H))->TrRxCompleteHandler)( \ - ((PNDIS_MINIPORT_BLOCK)_H)->TrDB); \ -} -#endif - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMIndicateStatus( - __in NDIS_HANDLE MiniportHandle, - __in NDIS_STATUS GeneralStatus, - __in_bcount(StatusBufferSize) - PVOID StatusBuffer, - __in UINT StatusBufferSize - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMIndicateStatusComplete( - __in NDIS_HANDLE MiniportHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMRegisterAdapterShutdownHandler( - __in NDIS_HANDLE MiniportHandle, - __in PVOID ShutdownContext, - __in ADAPTER_SHUTDOWN_HANDLER ShutdownHandler - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMDeregisterAdapterShutdownHandler( - __in NDIS_HANDLE MiniportHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("NdisMQueryAdapterResources", "Obsolete") -EXPORT -NDIS_STATUS -NdisMPciAssignResources( - __in NDIS_HANDLE MiniportHandle, - __in ULONG SlotNumber, - __out PNDIS_RESOURCE_LIST * AssignedResources - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisIMNotifyPnPEvent( - __in NDIS_HANDLE MiniportHandle, - __in PNET_PNP_EVENT NetPnPEvent - ); - -#endif // NDIS_LEGACY_MINIPORT - - -// -// Logging support for miniports -// - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMCreateLog( - __in NDIS_HANDLE MiniportAdapterHandle, - __in UINT Size, - __out PNDIS_HANDLE LogHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMCloseLog( - __in NDIS_HANDLE LogHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisMWriteLogData( - __in NDIS_HANDLE LogHandle, - __in_bcount(LogBufferSize) - PVOID LogBuffer, - __in UINT LogBufferSize - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMFlushLog( - __in NDIS_HANDLE LogHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMGetDeviceProperty( - __in NDIS_HANDLE MiniportAdapterHandle, - __inout_opt PDEVICE_OBJECT * PhysicalDeviceObject, - __inout_opt PDEVICE_OBJECT * FunctionalDeviceObject, - __inout_opt PDEVICE_OBJECT * NextDeviceObject, - __inout_opt PCM_RESOURCE_LIST * AllocatedResources, - __inout_opt PCM_RESOURCE_LIST * AllocatedResourcesTranslated - ); - -// -// Get a pointer to the adapter's localized instance name. -// -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMQueryAdapterInstanceName( - __out PNDIS_STRING pAdapterInstanceName, - __in NDIS_HANDLE MiniportHandle - ); - - -#if NDIS_LEGACY_MINIPORT - -// -// NDIS 5.0 extensions for miniports -// - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMCoIndicateReceivePacket( - __in NDIS_HANDLE NdisVcHandle, - __in PPNDIS_PACKET PacketArray, - __in UINT NumberOfPackets - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -NdisMCoIndicateStatus( - __in NDIS_HANDLE MiniportAdapterHandle, - __in_opt NDIS_HANDLE NdisVcHandle, - __in NDIS_STATUS GeneralStatus, - __in_bcount_opt(StatusBufferSize) - PVOID StatusBuffer, - __in ULONG StatusBufferSize - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMCoReceiveComplete( - __in NDIS_HANDLE MiniportAdapterHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMCoSendComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisVcHandle, - __in PNDIS_PACKET Packet - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMCoRequestComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNDIS_REQUEST Request - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisMCmRequest( - __in NDIS_HANDLE NdisAfHandle, - __in_opt NDIS_HANDLE NdisVcHandle, - __in_opt NDIS_HANDLE NdisPartyHandle, - __inout PNDIS_REQUEST NdisRequest - ); - -#endif // NDIS_LEGACY_MINIPORT - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMCoActivateVcComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisVcHandle, - __in PCO_CALL_PARAMETERS CallParameters - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMCoDeactivateVcComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisVcHandle - ); - -EXPORT -NDIS_STATUS -NdisMCmRegisterAddressFamily( - IN NDIS_HANDLE MiniportAdapterHandle, - IN PCO_ADDRESS_FAMILY AddressFamily, - IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics, - IN UINT SizeOfCmCharacteristics - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -NdisMCmCreateVc( - __in NDIS_HANDLE MiniportAdapterHandle, - __in NDIS_HANDLE NdisAfHandle, - __in NDIS_HANDLE MiniportVcContext, - __out PNDIS_HANDLE NdisVcHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisMCmDeleteVc( - __in NDIS_HANDLE NdisVcHandle - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisMCmActivateVc( - __in NDIS_HANDLE NdisVcHandle, - __in PCO_CALL_PARAMETERS CallParameters - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisMCmDeactivateVc( - __in NDIS_HANDLE NdisVcHandle - ); - - -#if NDIS_LEGACY_MINIPORT - -// EXPORT -// VOID -// NdisMCmRequestComplete( -// IN NDIS_STATUS Status, -// IN NDIS_HANDLE NdisAfHandle, -// IN NDIS_HANDLE NdisVcHandle OPTIONAL, -// IN NDIS_HANDLE NdisPartyHandle OPTIONAL, -// IN PNDIS_REQUEST NdisRequest -// ); -#define NdisMCmRequestComplete(_S_, _AH_, _VH_, _PH_, _R_) \ - NdisCoRequestComplete(_S_, _AH_, _VH_, _PH_, _R_) -#endif // NDIS_LEGACY_MINIPORT - -#if (NDIS_SUPPORT_NDIS6 || NDIS60) - -// EXPORT -// VOID -// NdisMCmOidRequestComplete( -// IN NDIS_HANDLE NdisAfHandle, -// IN NDIS_HANDLE NdisVcHandle OPTIONAL, -// IN NDIS_HANDLE NdisPartyHandle OPTIONAL, -// IN PNDIS_OID_REQUEST OidRequest, -// IN NDIS_STATUS Status -// ); -#define NdisMCmOidRequestComplete(_AH_, _VH_, _PH_, _R_, _S_) \ - NdisCoOidRequestComplete(_AH_, _VH_, _PH_, _R_, _S_) -#endif // NDIS_SUPPORT_NDIS6 || NDIS60 - - -// EXPORT -// VOID -// NdisMCmOpenAddressFamilyComplete( -// IN NDIS_STATUS Status, -// IN NDIS_HANDLE NdisAfHandle, -// IN NDIS_HANDLE CallMgrAfContext -// ); - -#define NdisMCmOpenAddressFamilyComplete(_S_, _H_, _C_) \ - NdisCmOpenAddressFamilyComplete(_S_, _H_, _C_) -// EXPORT -// NDIS_STATUS -// NdisMCmNotifyCloseAddressFamily( -// IN NDIS_HANDLE NdisAfHandle -// ); - -#define NdisMCmNotifyCloseAddressFamily(_AH_) \ - NdisCmNotifyCloseAddressFamily(_AH_) - -// EXPORT -// VOID -// NdisMCmCloseAddressFamilyComplete( -// IN NDIS_STATUS Status, -// IN NDIS_HANDLE NdisAfHandle -// ); - -#define NdisMCmCloseAddressFamilyComplete(_S_, _H_) \ - NdisCmCloseAddressFamilyComplete(_S_, _H_) - - - -// EXPORT -// VOID -// NdisMCmRegisterSapComplete( -// IN NDIS_STATUS Status, -// IN NDIS_HANDLE NdisSapHandle, -// IN NDIS_HANDLE CallMgrSapContext -// ); - -#define NdisMCmRegisterSapComplete(_S_, _H_, _C_) \ - NdisCmRegisterSapComplete(_S_, _H_, _C_) - - -// EXPORT -// VOID -// NdisMCmDeregisterSapComplete( -// IN NDIS_STATUS Status, -// IN NDIS_HANDLE NdisSapHandle -// ); - -#define NdisMCmDeregisterSapComplete(_S_, _H_) \ - NdisCmDeregisterSapComplete(_S_, _H_) - - -// EXPORT -// VOID -// NdisMCmMakeCallComplete( -// IN NDIS_STATUS Status, -// IN NDIS_HANDLE NdisVcHandle, -// IN NDIS_HANDLE NdisPartyHandle OPTIONAL, -// IN NDIS_HANDLE CallMgrPartyContext OPTIONAL, -// IN PCO_CALL_PARAMETERS CallParameters -// ); - -#define NdisMCmMakeCallComplete(_S_, _VH_, _PH_, _CC_, _CP_) \ - NdisCmMakeCallComplete(_S_, _VH_, _PH_, _CC_, _CP_) - - -// EXPORT -// VOID -// NdisMCmCloseCallComplete( -// IN NDIS_STATUS Status, -// IN NDIS_HANDLE NdisVcHandle, -// IN NDIS_HANDLE NdisPartyHandle OPTIONAL -// ); - -#define NdisMCmCloseCallComplete(_S_, _VH_, _PH_) \ - NdisCmCloseCallComplete(_S_, _VH_, _PH_) - - -// EXPORT -// VOID -// NdisMCmAddPartyComplete( -// IN NDIS_STATUS Status, -// IN NDIS_HANDLE NdisPartyHandle, -// IN NDIS_HANDLE CallMgrPartyContext OPTIONAL, -// IN PCO_CALL_PARAMETERS CallParameters -// ); - -#define NdisMCmAddPartyComplete(_S_, _H_, _C_, _P_) \ - NdisCmAddPartyComplete(_S_, _H_, _C_, _P_) - - -// EXPORT -// VOID -// NdisMCmDropPartyComplete( -// IN NDIS_STATUS Status, -// IN NDIS_HANDLE NdisPartyHandle -// ); - -#define NdisMCmDropPartyComplete(_S_, _H_) \ - NdisCmDropPartyComplete(_S_, _H_) - - -// EXPORT -// NDIS_STATUS -// NdisMCmDispatchIncomingCall( -// IN NDIS_HANDLE NdisSapHandle, -// IN NDIS_HANDLE NdisVcHandle, -// IN PCO_CALL_PARAMETERS CallParameters -// ); - -#define NdisMCmDispatchIncomingCall(_SH_, _VH_, _CP_) \ - NdisCmDispatchIncomingCall(_SH_, _VH_, _CP_) - - -// EXPORT -// VOID -// NdisMCmDispatchCallConnected( -// IN NDIS_HANDLE NdisVcHandle -// ); - -#define NdisMCmDispatchCallConnected(_H_) \ - NdisCmDispatchCallConnected(_H_) - - -// EXPORT -// NdisMCmModifyCallQoSComplete( -// IN NDIS_STATUS Status, -// IN NDIS_HANDLE NdisVcHandle, -// IN PCO_CALL_PARAMETERS CallParameters -// ); - -#define NdisMCmModifyCallQoSComplete(_S_, _H_, _P_) \ - NdisCmModifyCallQoSComplete(_S_, _H_, _P_) - - -// EXPORT -// VOID -// VOID -// NdisMCmDispatchIncomingCallQoSChange( -// IN NDIS_HANDLE NdisVcHandle, -// IN PCO_CALL_PARAMETERS CallParameters -// ); - -#define NdisMCmDispatchIncomingCallQoSChange(_H_, _P_) \ - NdisCmDispatchIncomingCallQoSChange(_H_, _P_) - - -// EXPORT -// VOID -// NdisMCmDispatchIncomingCloseCall( -// IN NDIS_STATUS CloseStatus, -// IN NDIS_HANDLE NdisVcHandle, -// IN PVOID Buffer OPTIONAL, -// IN UINT Size -// ); - -#define NdisMCmDispatchIncomingCloseCall(_S_, _H_, _B_, _Z_) \ - NdisCmDispatchIncomingCloseCall(_S_, _H_, _B_, _Z_) - - -// EXPORT -// VOID -// NdisMCmDispatchIncomingDropParty( -// IN NDIS_STATUS DropStatus, -// IN NDIS_HANDLE NdisPartyHandle, -// IN PVOID Buffer OPTIONAL, -// IN UINT Size -// ); -#define NdisMCmDispatchIncomingDropParty(_S_, _H_, _B_, _Z_) \ - NdisCmDispatchIncomingDropParty(_S_, _H_, _B_, _Z_) - - -#if NDIS_SUPPORT_NDIS6 - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMRegisterScatterGatherDma( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNDIS_SG_DMA_DESCRIPTION DmaDescription, - __out PNDIS_HANDLE NdisMiniportDmaHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMDeregisterScatterGatherDma( - __in NDIS_HANDLE NdisMiniportDmaHandle - ); - -// -// flags used in the call to NdisMAllocateNetBufferSGList -// -#define NDIS_SG_LIST_WRITE_TO_DEVICE 0x000000001 - - -__checkReturn -__drv_requiresIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisMAllocateNetBufferSGList( - __in NDIS_HANDLE NdisMiniportDmaHandle, - __in PNET_BUFFER NetBuffer, - __in __drv_isObjectPointer - PVOID Context, - __in ULONG Flags, - __in_bcount_opt(ScatterGatherListBufferSize) __drv_isObjectPointer - PVOID ScatterGatherListBuffer, - __in ULONG ScatterGatherListBufferSize - ); - -__drv_requiresIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMFreeNetBufferSGList( - __in NDIS_HANDLE NdisMiniportDmaHandle, - __in PSCATTER_GATHER_LIST pSGL, - __in PNET_BUFFER NetBuffer - ); - - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMRegisterMiniportDriver( - __in PDRIVER_OBJECT DriverObject, - __in PUNICODE_STRING RegistryPath, - __in_opt NDIS_HANDLE MiniportDriverContext, - __in PNDIS_MINIPORT_DRIVER_CHARACTERISTICS MiniportDriverCharacteristics, - __out PNDIS_HANDLE NdisMiniportDriverHandle - ); - -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisMDeregisterMiniportDriver( - __in NDIS_HANDLE NdisMiniportDriverHandle - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMPauseComplete( - __in NDIS_HANDLE MiniportAdapterHandle - ); - -EXPORT -VOID -NdisMRestartComplete( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_STATUS Status - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMOidRequestComplete( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNDIS_OID_REQUEST OidRequest, - __in NDIS_STATUS Status - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMSendNetBufferListsComplete( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNET_BUFFER_LIST NetBufferList, - __in ULONG SendCompleteFlags - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMIndicateReceiveNetBufferLists( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNET_BUFFER_LIST NetBufferList, - __in NDIS_PORT_NUMBER PortNumber, - __in ULONG NumberOfNetBufferLists, - __in ULONG ReceiveFlags - ); - - -// -// IO workitem routines -// - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_HANDLE -NdisAllocateIoWorkItem( - __in NDIS_HANDLE NdisObjectHandle - ); - -typedef -VOID -(NDIS_IO_WORKITEM_FUNCTION)( - IN PVOID WorkItemContext, - IN NDIS_HANDLE NdisIoWorkItemHandle - ); -typedef NDIS_IO_WORKITEM_FUNCTION (*NDIS_IO_WORKITEM_ROUTINE); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisQueueIoWorkItem( - __in NDIS_HANDLE NdisIoWorkItemHandle, - __in NDIS_IO_WORKITEM_ROUTINE Routine, - __in __drv_isObjectPointer PVOID WorkItemContext - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFreeIoWorkItem( - __in NDIS_HANDLE NdisIoWorkItemHandle - ); - -// -// CONDIS 6.0 extensions -// - -EXPORT -VOID -NdisMCoSendNetBufferListsComplete( - IN NDIS_HANDLE NdisVcHandle, - IN PNET_BUFFER_LIST NetBufferLists, - IN ULONG SendCompleteFlags - ); - -EXPORT -VOID -NdisMCoIndicateReceiveNetBufferLists( - IN NDIS_HANDLE NdisVcHandle, - IN PNET_BUFFER_LIST NetBufferLists, - IN ULONG NumberOfNetBufferLists, - IN ULONG CoReceiveFlags - ); - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMNetPnPEvent( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNET_PNP_EVENT_NOTIFICATION NetPnPEventNotification - ); - - -#if NDIS_SUPPORT_NDIS6 -__drv_maxIRQL(DISPATCH_LEVEL) -#endif NDIS_SUPPORT_NDIS6 -EXPORT -VOID -NdisMResetComplete( - __in NDIS_HANDLE MiniportAdapterHandle, - __in NDIS_STATUS Status, - __in BOOLEAN AddressingReset - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -ULONG -NdisMGetBusData( - __in NDIS_HANDLE NdisMiniportHandle, - __in ULONG WhichSpace, - __in ULONG Offset, - __out_bcount_full(Length) PVOID Buffer, - __in ULONG Length - ); - -EXPORT -ULONG -NdisMSetBusData( - IN NDIS_HANDLE NdisMiniportHandle, - IN ULONG WhichSpace, - IN ULONG Offset, - IN PVOID Buffer, - IN ULONG Length - ); - -// -// NDIS port APIs -// - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisMAllocatePort( - __in NDIS_HANDLE NdisMiniportHandle, - __inout PNDIS_PORT_CHARACTERISTICS PortCharacteristics - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisMFreePort( - __in NDIS_HANDLE NdisMiniportHandle, - __in NDIS_PORT_NUMBER PortNumber - ); - -#if (NDIS_SUPPORT_NDIS61) -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisMDirectOidRequestComplete( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PNDIS_OID_REQUEST OidRequest, - __in NDIS_STATUS Status - ); - -typedef enum _NDIS_MSIX_TABLE_CONFIG -{ - NdisMSIXTableConfigSetTableEntry, - NdisMSIXTableConfigMaskTableEntry, - NdisMSIXTableConfigUnmaskTableEntry, - NdisMSIXTableConfigMax -}NDIS_MSIX_TABLE_OPERATION, *PNDIS_MSIX_TABLE_OPERATION; - -#define NDIS_MSIX_CONFIG_PARAMETERS_REVISION_1 1 - -typedef struct _NDIS_MSIX_CONFIG_PARAMETERS -{ - NDIS_OBJECT_HEADER Header; - NDIS_MSIX_TABLE_OPERATION ConfigOperation; - ULONG TableEntry; - ULONG MessageNumber; -}NDIS_MSIX_CONFIG_PARAMETERS, *PNDIS_MSIX_CONFIG_PARAMETERS; - -#define NDIS_SIZEOF_MSIX_CONFIG_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_MSIX_CONFIG_PARAMETERS, MessageNumber) - -EXPORT -NDIS_STATUS -NdisMConfigMSIXTableEntry( - __in NDIS_HANDLE NdisMiniportHandle, - __in PNDIS_MSIX_CONFIG_PARAMETERS MSIXConfigParameters - ); - -#endif // (NDIS_SUPPORT_NDIS61) - -#endif // NDIS_SUPPORT_NDIS6 - - -#pragma once - -typedef struct _CO_CALL_PARAMETERS CO_CALL_PARAMETERS, *PCO_CALL_PARAMETERS; -typedef struct _CO_MEDIA_PARAMETERS CO_MEDIA_PARAMETERS, *PCO_MEDIA_PARAMETERS; - -// -// CoNdis client only handler proto-types - used by clients of call managers -// -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_OPEN_AF_COMPLETE)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE ProtocolAfContext, - __in NDIS_HANDLE NdisAfHandle - ); - -typedef PROTOCOL_CL_OPEN_AF_COMPLETE (*CL_OPEN_AF_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_CLOSE_AF_COMPLETE)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE ProtocolAfContext - ); - -typedef PROTOCOL_CL_CLOSE_AF_COMPLETE (*CL_CLOSE_AF_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_REGISTER_SAP_COMPLETE)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE ProtocolSapContext, - __in PCO_SAP Sap, - __in NDIS_HANDLE NdisSapHandle - ); - -typedef PROTOCOL_CL_REGISTER_SAP_COMPLETE (*CL_REG_SAP_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_DEREGISTER_SAP_COMPLETE)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE ProtocolSapContext - ); - -typedef PROTOCOL_CL_DEREGISTER_SAP_COMPLETE (*CL_DEREG_SAP_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_MAKE_CALL_COMPLETE)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE ProtocolVcContext, - __in_opt NDIS_HANDLE NdisPartyHandle, - __in PCO_CALL_PARAMETERS CallParameters - ); - -typedef PROTOCOL_CL_MAKE_CALL_COMPLETE (*CL_MAKE_CALL_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_CLOSE_CALL_COMPLETE)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE ProtocolVcContext, - __in_opt NDIS_HANDLE ProtocolPartyContext - ); - -typedef PROTOCOL_CL_CLOSE_CALL_COMPLETE (*CL_CLOSE_CALL_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_ADD_PARTY_COMPLETE)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE ProtocolPartyContext, - __in NDIS_HANDLE NdisPartyHandle, - __in PCO_CALL_PARAMETERS CallParameters - ); - -typedef PROTOCOL_CL_ADD_PARTY_COMPLETE (*CL_ADD_PARTY_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_DROP_PARTY_COMPLETE)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE ProtocolPartyContext - ); - -typedef PROTOCOL_CL_DROP_PARTY_COMPLETE (*CL_DROP_PARTY_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CL_INCOMING_CALL)( - __in NDIS_HANDLE ProtocolSapContext, - __in NDIS_HANDLE ProtocolVcContext, - __inout PCO_CALL_PARAMETERS CallParameters - ); - -typedef PROTOCOL_CL_INCOMING_CALL (*CL_INCOMING_CALL_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_CALL_CONNECTED)( - __in NDIS_HANDLE ProtocolVcContext - ); - -typedef PROTOCOL_CL_CALL_CONNECTED (*CL_CALL_CONNECTED_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_INCOMING_CLOSE_CALL)( - __in NDIS_STATUS CloseStatus, - __in NDIS_HANDLE ProtocolVcContext, - __in_opt PVOID CloseData, - __in_opt UINT Size - ); - -typedef PROTOCOL_CL_INCOMING_CLOSE_CALL (*CL_INCOMING_CLOSE_CALL_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_INCOMING_DROP_PARTY)( - __in NDIS_STATUS DropStatus, - __in NDIS_HANDLE ProtocolPartyContext, - __in_opt PVOID CloseData, - __in_opt UINT Size - ); - -typedef PROTOCOL_CL_INCOMING_DROP_PARTY (*CL_INCOMING_DROP_PARTY_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_MODIFY_CALL_QOS_COMPLETE)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE ProtocolVcContext, - __in PCO_CALL_PARAMETERS CallParameters - ); - -typedef PROTOCOL_CL_MODIFY_CALL_QOS_COMPLETE (*CL_MODIFY_CALL_QOS_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CL_INCOMING_CALL_QOS_CHANGE)( - __in NDIS_HANDLE ProtocolVcContext, - __in PCO_CALL_PARAMETERS CallParameters - ); -typedef PROTOCOL_CL_INCOMING_CALL_QOS_CHANGE (*CL_INCOMING_CALL_QOS_CHANGE_HANDLER); - -#if NDIS_LEGACY_PROTOCOL -typedef struct _NDIS_CLIENT_CHARACTERISTICS -{ - UCHAR MajorVersion; - UCHAR MinorVersion; - - USHORT Filler; - UINT Reserved; - - CO_CREATE_VC_HANDLER ClCreateVcHandler; - CO_DELETE_VC_HANDLER ClDeleteVcHandler; - CO_REQUEST_HANDLER ClRequestHandler; - CO_REQUEST_COMPLETE_HANDLER ClRequestCompleteHandler; - CL_OPEN_AF_COMPLETE_HANDLER ClOpenAfCompleteHandler; - CL_CLOSE_AF_COMPLETE_HANDLER ClCloseAfCompleteHandler; - CL_REG_SAP_COMPLETE_HANDLER ClRegisterSapCompleteHandler; - CL_DEREG_SAP_COMPLETE_HANDLER ClDeregisterSapCompleteHandler; - CL_MAKE_CALL_COMPLETE_HANDLER ClMakeCallCompleteHandler; - CL_MODIFY_CALL_QOS_COMPLETE_HANDLER ClModifyCallQoSCompleteHandler; - CL_CLOSE_CALL_COMPLETE_HANDLER ClCloseCallCompleteHandler; - CL_ADD_PARTY_COMPLETE_HANDLER ClAddPartyCompleteHandler; - CL_DROP_PARTY_COMPLETE_HANDLER ClDropPartyCompleteHandler; - CL_INCOMING_CALL_HANDLER ClIncomingCallHandler; - CL_INCOMING_CALL_QOS_CHANGE_HANDLER ClIncomingCallQoSChangeHandler; - CL_INCOMING_CLOSE_CALL_HANDLER ClIncomingCloseCallHandler; - CL_INCOMING_DROP_PARTY_HANDLER ClIncomingDropPartyHandler; - CL_CALL_CONNECTED_HANDLER ClCallConnectedHandler; - -} NDIS_CLIENT_CHARACTERISTICS, *PNDIS_CLIENT_CHARACTERISTICS; -#endif // NDIS_LEGACY_PROTOCOL - -// -// CoNdis call-manager only handler proto-types - used by call managers only -// -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CM_OPEN_AF)( - __in NDIS_HANDLE CallMgrBindingContext, - __in PCO_ADDRESS_FAMILY AddressFamily, - __in NDIS_HANDLE NdisAfHandle, - __out PNDIS_HANDLE CallMgrAfContext - ); - -typedef PROTOCOL_CM_OPEN_AF (*CM_OPEN_AF_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CM_CLOSE_AF)( - __in NDIS_HANDLE CallMgrAfContext - ); - -typedef PROTOCOL_CM_CLOSE_AF (*CM_CLOSE_AF_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CM_REG_SAP)( - __in NDIS_HANDLE CallMgrAfContext, - __in PCO_SAP Sap, - __in NDIS_HANDLE NdisSapHandle, - __out PNDIS_HANDLE CallMgrSapContext - ); - -typedef PROTOCOL_CM_REG_SAP (*CM_REG_SAP_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CM_DEREGISTER_SAP)( - __in NDIS_HANDLE CallMgrSapContext - ); - -typedef PROTOCOL_CM_DEREGISTER_SAP (*CM_DEREG_SAP_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CM_MAKE_CALL)( - __in NDIS_HANDLE CallMgrVcContext, - __inout PCO_CALL_PARAMETERS CallParameters, - __in_opt NDIS_HANDLE NdisPartyHandle, - __out_opt PNDIS_HANDLE CallMgrPartyContext - ); - -typedef PROTOCOL_CM_MAKE_CALL (*CM_MAKE_CALL_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CM_CLOSE_CALL)( - __in NDIS_HANDLE CallMgrVcContext, - __in_opt NDIS_HANDLE CallMgrPartyContext, - __in_opt PVOID CloseData, - __in_opt UINT Size - ); - -typedef PROTOCOL_CM_CLOSE_CALL (*CM_CLOSE_CALL_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CM_MODIFY_QOS_CALL)( - __in NDIS_HANDLE CallMgrVcContext, - __in PCO_CALL_PARAMETERS CallParameters - ); - -typedef PROTOCOL_CM_MODIFY_QOS_CALL (*CM_MODIFY_CALL_QOS_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CM_INCOMING_CALL_COMPLETE)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE CallMgrVcContext, - __in PCO_CALL_PARAMETERS CallParameters - ); - -typedef PROTOCOL_CM_INCOMING_CALL_COMPLETE (*CM_INCOMING_CALL_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CM_ACTIVATE_VC_COMPLETE)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE CallMgrVcContext, - __in PCO_CALL_PARAMETERS CallParameters - ); - -typedef PROTOCOL_CM_ACTIVATE_VC_COMPLETE (*CM_ACTIVATE_VC_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(PROTOCOL_CM_DEACTIVATE_VC_COMPLETE)( - __in NDIS_STATUS Status, - __in NDIS_HANDLE CallMgrVcContext - ); - -typedef PROTOCOL_CM_DEACTIVATE_VC_COMPLETE (*CM_DEACTIVATE_VC_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CM_ADD_PARTY)( - __in NDIS_HANDLE CallMgrVcContext, - __inout PCO_CALL_PARAMETERS CallParameters, - __in NDIS_HANDLE NdisPartyHandle, - __out PNDIS_HANDLE CallMgrPartyContext - ); - -typedef PROTOCOL_CM_ADD_PARTY (*CM_ADD_PARTY_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(PROTOCOL_CM_DROP_PARTY)( - __in NDIS_HANDLE CallMgrPartyContext, - __in_opt PVOID CloseData, - __in_opt UINT Size - ); - -typedef PROTOCOL_CM_DROP_PARTY (*CM_DROP_PARTY_HANDLER); - -#if NDIS_LEGACY_DRIVER - -typedef struct _NDIS_CALL_MANAGER_CHARACTERISTICS -{ - UCHAR MajorVersion; - UCHAR MinorVersion; - USHORT Filler; - UINT Reserved; - - CO_CREATE_VC_HANDLER CmCreateVcHandler; - CO_DELETE_VC_HANDLER CmDeleteVcHandler; - CM_OPEN_AF_HANDLER CmOpenAfHandler; - CM_CLOSE_AF_HANDLER CmCloseAfHandler; - CM_REG_SAP_HANDLER CmRegisterSapHandler; - CM_DEREG_SAP_HANDLER CmDeregisterSapHandler; - CM_MAKE_CALL_HANDLER CmMakeCallHandler; - CM_CLOSE_CALL_HANDLER CmCloseCallHandler; - CM_INCOMING_CALL_COMPLETE_HANDLER CmIncomingCallCompleteHandler; - CM_ADD_PARTY_HANDLER CmAddPartyHandler; - CM_DROP_PARTY_HANDLER CmDropPartyHandler; - CM_ACTIVATE_VC_COMPLETE_HANDLER CmActivateVcCompleteHandler; - CM_DEACTIVATE_VC_COMPLETE_HANDLER CmDeactivateVcCompleteHandler; - CM_MODIFY_CALL_QOS_HANDLER CmModifyCallQoSHandler; - CO_REQUEST_HANDLER CmRequestHandler; - CO_REQUEST_COMPLETE_HANDLER CmRequestCompleteHandler; - -} NDIS_CALL_MANAGER_CHARACTERISTICS, *PNDIS_CALL_MANAGER_CHARACTERISTICS; - -#endif // NDIS_LEGACY_DRIVER - -// -// this send flag is used on ATM net cards to set ( turn on ) the CLP bit -// (Cell Loss Priority) bit -// -#define CO_SEND_FLAG_SET_DISCARD_ELIBILITY 0x00000001 - -// -// the Address structure used on NDIS_CO_ADD_ADDRESS or NDIS_CO_DELETE_ADDRESS -// -typedef struct _CO_ADDRESS -{ - ULONG AddressSize; - UCHAR Address[1]; -} CO_ADDRESS, *PCO_ADDRESS; - -// -// the list of addresses returned from the CallMgr on a NDIS_CO_GET_ADDRESSES -// -typedef struct _CO_ADDRESS_LIST -{ - ULONG NumberOfAddressesAvailable; - ULONG NumberOfAddresses; - CO_ADDRESS AddressList; -} CO_ADDRESS_LIST, *PCO_ADDRESS_LIST; - -#ifndef FAR -#define FAR -#endif -#include - -typedef struct _CO_SPECIFIC_PARAMETERS -{ - ULONG ParamType; - ULONG Length; - UCHAR Parameters[1]; -} CO_SPECIFIC_PARAMETERS, *PCO_SPECIFIC_PARAMETERS; - -typedef struct _CO_CALL_MANAGER_PARAMETERS -{ - FLOWSPEC Transmit; - FLOWSPEC Receive; - CO_SPECIFIC_PARAMETERS CallMgrSpecific; -} CO_CALL_MANAGER_PARAMETERS, *PCO_CALL_MANAGER_PARAMETERS; - - -// -// this is the generic portion of the media parameters, including the media -// specific component too. -// -typedef struct _CO_MEDIA_PARAMETERS -{ - ULONG Flags; - ULONG ReceivePriority; - ULONG ReceiveSizeHint; - CO_SPECIFIC_PARAMETERS POINTER_ALIGNMENT MediaSpecific; -} CO_MEDIA_PARAMETERS, *PCO_MEDIA_PARAMETERS; - - -// -// definitions for the flags in CO_MEDIA_PARAMETERS -// -#define RECEIVE_TIME_INDICATION 0x00000001 -#define USE_TIME_STAMPS 0x00000002 -#define TRANSMIT_VC 0x00000004 -#define RECEIVE_VC 0x00000008 -#define INDICATE_ERRED_PACKETS 0x00000010 -#define INDICATE_END_OF_TX 0x00000020 -#define RESERVE_RESOURCES_VC 0x00000040 -#define ROUND_DOWN_FLOW 0x00000080 -#define ROUND_UP_FLOW 0x00000100 -// -// define a flag to set in the flags of an Ndis packet when the miniport -// indicates a receive with an error in it -// -#define ERRED_PACKET_INDICATION 0x00000001 - -// -// this is the structure passed during call-setup -// -typedef struct _CO_CALL_PARAMETERS -{ - ULONG Flags; - PCO_CALL_MANAGER_PARAMETERS CallMgrParameters; - PCO_MEDIA_PARAMETERS MediaParameters; -} CO_CALL_PARAMETERS, *PCO_CALL_PARAMETERS; - -// -// Definitions for the Flags in CO_CALL_PARAMETERS -// -#define PERMANENT_VC 0x00000001 -#define CALL_PARAMETERS_CHANGED 0x00000002 -#define QUERY_CALL_PARAMETERS 0x00000004 -#define BROADCAST_VC 0x00000008 -#define MULTIPOINT_VC 0x00000010 - -// -// The format of the Request for adding/deleting a PVC -// -typedef struct _CO_PVC -{ - NDIS_HANDLE NdisAfHandle; - CO_SPECIFIC_PARAMETERS PvcParameters; -} CO_PVC,*PCO_PVC; - - - -// -// NDIS 5.0 Extensions for protocols -// -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisCoAssignInstanceName( - __in NDIS_HANDLE NdisVcHandle, - __in PNDIS_STRING BaseInstanceName, - __out_opt PNDIS_STRING VcInstanceName - ); - -#if NDIS_LEGACY_PROTOCOL -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCoSendPackets( - __in NDIS_HANDLE NdisVcHandle, - __in PPNDIS_PACKET PacketArray, - __in UINT NumberOfPackets - ); - -#endif // NDIS_LEGACY_PROTOCOL - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisCoCreateVc( - __in NDIS_HANDLE NdisBindingHandle, - __in_opt NDIS_HANDLE NdisAfHandle, // For CM signalling VCs - __in NDIS_HANDLE ProtocolVcContext, - __inout PNDIS_HANDLE NdisVcHandle - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisCoDeleteVc( - __in NDIS_HANDLE NdisVcHandle - ); - -#if NDIS_LEGACY_PROTOCOL -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisCoRequest( - __in NDIS_HANDLE NdisBindingHandle, - __in_opt NDIS_HANDLE NdisAfHandle, - __in_opt NDIS_HANDLE NdisVcHandle, - __in_opt NDIS_HANDLE NdisPartyHandle, - __inout PNDIS_REQUEST NdisRequest - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCoRequestComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisAfHandle, - __in_opt NDIS_HANDLE NdisVcHandle, - __in_opt NDIS_HANDLE NdisPartyHandle, - __in PNDIS_REQUEST NdisRequest - ); - -#endif // NDIS_LEGACY_PROTOCOL - -#ifndef __NDISTAPI_VAR_STRING_DECLARED -#define __NDISTAPI_VAR_STRING_DECLARED - -typedef struct _VAR_STRING -{ - ULONG ulTotalSize; - ULONG ulNeededSize; - ULONG ulUsedSize; - - ULONG ulStringFormat; - ULONG ulStringSize; - ULONG ulStringOffset; - -} VAR_STRING, *PVAR_STRING; - -#endif // __NDISTAPI_VAR_STRING_DECLARED - - -#ifndef __NDISTAPI_STRINGFORMATS_DEFINED -#define __NDISTAPI_STRINGFORMATS_DEFINED - -#define STRINGFORMAT_ASCII 0x00000001 -#define STRINGFORMAT_DBCS 0x00000002 -#define STRINGFORMAT_UNICODE 0x00000003 -#define STRINGFORMAT_BINARY 0x00000004 - -#endif // __NDISTAPI_STRINGFORMATS_DEFINED - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisCoGetTapiCallId( - __in NDIS_HANDLE NdisVcHandle, - __inout PVAR_STRING TapiCallId - ); - -#if NDIS_LEGACY_PROTOCOL -// -// Client Apis -// -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisClOpenAddressFamily( - __in NDIS_HANDLE NdisBindingHandle, - __in PCO_ADDRESS_FAMILY AddressFamily, - __in NDIS_HANDLE ProtocolAfContext, - __in PNDIS_CLIENT_CHARACTERISTICS ClCharacteristics, - __in UINT SizeOfClCharacteristics, - __out PNDIS_HANDLE NdisAfHandle - ); - -#endif // NDIS_LEGACY_PROTOCOL - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisClCloseAddressFamily( - __in NDIS_HANDLE NdisAfHandle - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisClRegisterSap( - __in NDIS_HANDLE NdisAfHandle, - __in NDIS_HANDLE ProtocolSapContext, - __in PCO_SAP Sap, - __out PNDIS_HANDLE NdisSapHandle - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisClDeregisterSap( - __in NDIS_HANDLE NdisSapHandle - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisClMakeCall( - __in NDIS_HANDLE NdisVcHandle, - __inout PCO_CALL_PARAMETERS CallParameters, - __in_opt NDIS_HANDLE ProtocolPartyContext, - __out_opt PNDIS_HANDLE NdisPartyHandle - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisClCloseCall( - __in NDIS_HANDLE NdisVcHandle, - __in_opt NDIS_HANDLE NdisPartyHandle, - __in_bcount_opt(Size) PVOID Buffer, - __in UINT Size - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisClModifyCallQoS( - __in NDIS_HANDLE NdisVcHandle, - __in PCO_CALL_PARAMETERS CallParameters - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisClIncomingCallComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisVcHandle, - __in PCO_CALL_PARAMETERS CallParameters - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisClAddParty( - __in NDIS_HANDLE NdisVcHandle, - __in NDIS_HANDLE ProtocolPartyContext, - __inout PCO_CALL_PARAMETERS CallParameters, - __out PNDIS_HANDLE NdisPartyHandle - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisClDropParty( - __in NDIS_HANDLE NdisPartyHandle, - __in_bcount_opt(Size) PVOID Buffer, - __in_opt UINT Size - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisClGetProtocolVcContextFromTapiCallId( - __in UNICODE_STRING TapiCallId, - __out PNDIS_HANDLE ProtocolVcContext - ); - -// -// Call Manager Apis -// - -#if NDIS_LEGACY_DRIVER -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisCmRegisterAddressFamily( - __in NDIS_HANDLE NdisBindingHandle, - __in PCO_ADDRESS_FAMILY AddressFamily, - __in PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics, - __in UINT SizeOfCmCharacteristics - ); - -#endif - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmOpenAddressFamilyComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisAfHandle, - __in NDIS_HANDLE CallMgrAfContext - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmCloseAddressFamilyComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisAfHandle - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmRegisterSapComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisSapHandle, - __in NDIS_HANDLE CallMgrSapContext - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmDeregisterSapComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisSapHandle - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisCmActivateVc( - __in NDIS_HANDLE NdisVcHandle, - __inout PCO_CALL_PARAMETERS CallParameters - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisCmDeactivateVc( - __in NDIS_HANDLE NdisVcHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmMakeCallComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisVcHandle, - __in_opt NDIS_HANDLE NdisPartyHandle, - __in_opt NDIS_HANDLE CallMgrPartyContext, - __in PCO_CALL_PARAMETERS CallParameters - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmCloseCallComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisVcHandle, - __in_opt NDIS_HANDLE NdisPartyHandle - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmAddPartyComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisPartyHandle, - __in_opt NDIS_HANDLE CallMgrPartyContext, - __in PCO_CALL_PARAMETERS CallParameters - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmDropPartyComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisPartyHandle - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisCmDispatchIncomingCall( - __in NDIS_HANDLE NdisSapHandle, - __in NDIS_HANDLE NdisVcHandle, - __in PCO_CALL_PARAMETERS CallParameters - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmDispatchCallConnected( - __in NDIS_HANDLE NdisVcHandle - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmModifyCallQoSComplete( - __in NDIS_STATUS Status, - __in NDIS_HANDLE NdisVcHandle, - __in PCO_CALL_PARAMETERS CallParameters - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmDispatchIncomingCallQoSChange( - __in NDIS_HANDLE NdisVcHandle, - __in PCO_CALL_PARAMETERS CallParameters - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmDispatchIncomingCloseCall( - __in NDIS_STATUS CloseStatus, - __in NDIS_HANDLE NdisVcHandle, - __in_bcount_opt(Size) PVOID Buffer, - __in UINT Size - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCmDispatchIncomingDropParty( - __in NDIS_STATUS DropStatus, - __in NDIS_HANDLE NdisPartyHandle, - __in_bcount_opt(Size) PVOID Buffer, - __in UINT Size - ); - -#if (NDIS_SUPPORT_NDIS6) - -// -// CONDIS 6.0 extensions -// -#define NDIS_CO_CLIENT_OPTIONAL_HANDLERS_REVISION_1 1 - -typedef struct _NDIS_CO_CLIENT_OPTIONAL_HANDLERS -{ - NDIS_OBJECT_HEADER Header; - ULONG Reserved; - - CO_CREATE_VC_HANDLER ClCreateVcHandler; - CO_DELETE_VC_HANDLER ClDeleteVcHandler; - CO_OID_REQUEST_HANDLER ClOidRequestHandler; - CO_OID_REQUEST_COMPLETE_HANDLER ClOidRequestCompleteHandler; - CL_OPEN_AF_COMPLETE_HANDLER_EX ClOpenAfCompleteHandlerEx; - CL_CLOSE_AF_COMPLETE_HANDLER ClCloseAfCompleteHandler; - CL_REG_SAP_COMPLETE_HANDLER ClRegisterSapCompleteHandler; - CL_DEREG_SAP_COMPLETE_HANDLER ClDeregisterSapCompleteHandler; - CL_MAKE_CALL_COMPLETE_HANDLER ClMakeCallCompleteHandler; - CL_MODIFY_CALL_QOS_COMPLETE_HANDLER ClModifyCallQoSCompleteHandler; - CL_CLOSE_CALL_COMPLETE_HANDLER ClCloseCallCompleteHandler; - CL_ADD_PARTY_COMPLETE_HANDLER ClAddPartyCompleteHandler; - CL_DROP_PARTY_COMPLETE_HANDLER ClDropPartyCompleteHandler; - CL_INCOMING_CALL_HANDLER ClIncomingCallHandler; - CL_INCOMING_CALL_QOS_CHANGE_HANDLER ClIncomingCallQoSChangeHandler; - CL_INCOMING_CLOSE_CALL_HANDLER ClIncomingCloseCallHandler; - CL_INCOMING_DROP_PARTY_HANDLER ClIncomingDropPartyHandler; - CL_CALL_CONNECTED_HANDLER ClCallConnectedHandler; - CL_NOTIFY_CLOSE_AF_HANDLER ClNotifyCloseAfHandler; -}NDIS_CO_CLIENT_OPTIONAL_HANDLERS, *PNDIS_CO_CLIENT_OPTIONAL_HANDLERS; - -#define NDIS_SIZEOF_CO_CLIENT_OPTIONAL_HANDLERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_CO_CLIENT_OPTIONAL_HANDLERS, ClNotifyCloseAfHandler) - -#define NDIS_CO_CALL_MANAGER_OPTIONAL_HANDLERS_REVISION_1 1 - -typedef struct _NDIS_CO_CALL_MANAGER_OPTIONAL_HANDLERS -{ - NDIS_OBJECT_HEADER Header; - ULONG Reserved; - CO_CREATE_VC_HANDLER CmCreateVcHandler; - CO_DELETE_VC_HANDLER CmDeleteVcHandler; - CM_OPEN_AF_HANDLER CmOpenAfHandler; - CM_CLOSE_AF_HANDLER CmCloseAfHandler; - CM_REG_SAP_HANDLER CmRegisterSapHandler; - CM_DEREG_SAP_HANDLER CmDeregisterSapHandler; - CM_MAKE_CALL_HANDLER CmMakeCallHandler; - CM_CLOSE_CALL_HANDLER CmCloseCallHandler; - CM_INCOMING_CALL_COMPLETE_HANDLER CmIncomingCallCompleteHandler; - CM_ADD_PARTY_HANDLER CmAddPartyHandler; - CM_DROP_PARTY_HANDLER CmDropPartyHandler; - CM_ACTIVATE_VC_COMPLETE_HANDLER CmActivateVcCompleteHandler; - CM_DEACTIVATE_VC_COMPLETE_HANDLER CmDeactivateVcCompleteHandler; - CM_MODIFY_CALL_QOS_HANDLER CmModifyCallQoSHandler; - CO_OID_REQUEST_HANDLER CmOidRequestHandler; - CO_OID_REQUEST_COMPLETE_HANDLER CmOidRequestCompleteHandler; - CM_NOTIFY_CLOSE_AF_COMPLETE_HANDLER CmNotifyCloseAfCompleteHandler; - -} NDIS_CO_CALL_MANAGER_OPTIONAL_HANDLERS, *PNDIS_CO_CALL_MANAGER_OPTIONAL_HANDLERS; - -#define NDIS_SIZEOF_CO_CALL_MANAGER_OPTIONAL_HANDLERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_CO_CALL_MANAGER_OPTIONAL_HANDLERS, CmOidRequestCompleteHandler) - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCoSendNetBufferLists( - __in NDIS_HANDLE NdisVcHandle, - __in PNET_BUFFER_LIST NetBufferLists, - __in ULONG SendFlags - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisCoOidRequest( - __in NDIS_HANDLE NdisBindingHandle, - __in_opt NDIS_HANDLE NdisAfHandle, - __in_opt NDIS_HANDLE NdisVcHandle, - __in_opt NDIS_HANDLE NdisPartyHandle, - __inout PNDIS_OID_REQUEST OidRequest - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisCoOidRequestComplete( - __in NDIS_HANDLE NdisAfHandle, - __in_opt NDIS_HANDLE NdisVcHandle, - __in_opt NDIS_HANDLE NdisPartyHandle, - __in PNDIS_OID_REQUEST OidRequest, - __in NDIS_STATUS Status - ); - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisClOpenAddressFamilyEx ( - __in NDIS_HANDLE NdisBindingHandle, - __in PCO_ADDRESS_FAMILY AddressFamily, - __in NDIS_HANDLE ClientAfContext, - __out PNDIS_HANDLE NdisAfHandle - ); - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisCmRegisterAddressFamilyEx( - __in NDIS_HANDLE NdisBindingHandle, - __in PCO_ADDRESS_FAMILY AddressFamily - ); - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisMCmRegisterAddressFamilyEx( - __in NDIS_HANDLE MiniportAdapterHandle, - __in PCO_ADDRESS_FAMILY AddressFamily - ); - -__checkReturn -__drv_requiresIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisCmNotifyCloseAddressFamily ( - __in NDIS_HANDLE NdisAfHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisClNotifyCloseAddressFamilyComplete ( - __in NDIS_HANDLE NdisAfHandle, - __in NDIS_STATUS Status - ); - - -#endif // NDIS_SUPPORT_NDIS6 - - -#pragma once - -#if NDIS_SUPPORT_NDIS6 -// -// Ndis Light Weight filters -// - - -// -// init / de-init -// - -// -// Flags used in NDIS_FILTER_ATTACH_PARAMETERS -// - -#define NDIS_FILTER_ATTACH_FLAGS_IGNORE_MANDATORY 0x00000001 // If a mandatory filter fails to attach, it can set the flag - // to ask NDIS to ignore it is a mandatory filter - - -#define NDIS_FILTER_ATTACH_PARAMETERS_REVISION_1 1 - -#if (NDIS_SUPPORT_NDIS61) -#define NDIS_FILTER_ATTACH_PARAMETERS_REVISION_2 2 -#endif // (NDIS_SUPPORT_NDIS61) - -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_FILTER_ATTACH_PARAMETERS_REVISION_3 3 -#endif // (NDIS_SUPPORT_NDIS61) - -typedef struct _NDIS_FILTER_ATTACH_PARAMETERS -{ - __in NDIS_OBJECT_HEADER Header; - __in NET_IFINDEX IfIndex; - __in NET_LUID NetLuid; - __in PNDIS_STRING FilterModuleGuidName; - __in NET_IFINDEX BaseMiniportIfIndex; - __in PNDIS_STRING BaseMiniportInstanceName; - __in PNDIS_STRING BaseMiniportName; - __in NDIS_MEDIA_CONNECT_STATE MediaConnectState; - __in NET_IF_MEDIA_DUPLEX_STATE MediaDuplexState; - __in ULONG64 XmitLinkSpeed; - __in ULONG64 RcvLinkSpeed; - __inout NDIS_MEDIUM MiniportMediaType; - __inout NDIS_PHYSICAL_MEDIUM MiniportPhysicalMediaType; - __in NDIS_HANDLE MiniportMediaSpecificAttributes; - __in PNDIS_OFFLOAD DefaultOffloadConfiguration; - __in USHORT MacAddressLength; - __in UCHAR CurrentMacAddress[NDIS_MAX_PHYS_ADDRESS_LENGTH]; - __in NET_LUID BaseMiniportNetLuid; - __in NET_IFINDEX LowerIfIndex; - __in NET_LUID LowerIfNetLuid; - __inout ULONG Flags; -#if (NDIS_SUPPORT_NDIS61) - __in PNDIS_HD_SPLIT_CURRENT_CONFIG HDSplitCurrentConfig; -#endif // (NDIS_SUPPORT_NDIS61) -#if (NDIS_SUPPORT_NDIS620) - __in PNDIS_RECEIVE_FILTER_CAPABILITIES ReceiveFilterCapabilities; - __in PDEVICE_OBJECT MiniportPhysicalDeviceObject; - __in PNDIS_NIC_SWITCH_CAPABILITIES NicSwitchCapabilities; -#endif -} NDIS_FILTER_ATTACH_PARAMETERS, *PNDIS_FILTER_ATTACH_PARAMETERS; -#define NDIS_SIZEOF_FILTER_ATTACH_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_FILTER_ATTACH_PARAMETERS, Flags) - -#if (NDIS_SUPPORT_NDIS61) -#define NDIS_SIZEOF_FILTER_ATTACH_PARAMETERS_REVISION_2 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_FILTER_ATTACH_PARAMETERS, HDSplitCurrentConfig) -#endif // (NDIS_SUPPORT_NDIS61) - -#if (NDIS_SUPPORT_NDIS620) -#define NDIS_SIZEOF_FILTER_ATTACH_PARAMETERS_REVISION_3 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_FILTER_ATTACH_PARAMETERS, NicSwitchCapabilities) -#endif // (NDIS_SUPPORT_NDIS620) - - -typedef -__drv_maxIRQL(PASSIVE_LEVEL) -NDIS_STATUS -(FILTER_ATTACH)( - __in NDIS_HANDLE NdisFilterHandle, - __in NDIS_HANDLE FilterDriverContext, - __in PNDIS_FILTER_ATTACH_PARAMETERS AttachParameters - ); - -typedef FILTER_ATTACH (*FILTER_ATTACH_HANDLER); - -typedef -__drv_maxIRQL(PASSIVE_LEVEL) -VOID -(FILTER_DETACH)( - __in NDIS_HANDLE FilterModuleContext - ); - -typedef FILTER_DETACH (*FILTER_DETACH_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(FILTER_SET_MODULE_OPTIONS)( - __in NDIS_HANDLE FilterModuleContext - ); - -typedef FILTER_SET_MODULE_OPTIONS (*FILTER_SET_FILTER_MODULE_OPTIONS_HANDLER); - - -// -// NDIS_FILTER_RESTART_PARAMETERS is used in FILTER_RESTART handler -// -#define NDIS_FILTER_RESTART_PARAMETERS_REVISION_1 1 - -typedef struct _NDIS_FILTER_RESTART_PARAMETERS -{ - NDIS_OBJECT_HEADER Header; - NDIS_MEDIUM MiniportMediaType; - NDIS_PHYSICAL_MEDIUM MiniportPhysicalMediaType; - PNDIS_RESTART_ATTRIBUTES RestartAttributes; - NET_IFINDEX LowerIfIndex; - NET_LUID LowerIfNetLuid; - ULONG Flags; -} NDIS_FILTER_RESTART_PARAMETERS, *PNDIS_FILTER_RESTART_PARAMETERS; - -#define NDIS_SIZEOF__FILTER_RESTART_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_FILTER_RESTART_PARAMETERS, Flags) - -typedef -__drv_maxIRQL(PASSIVE_LEVEL) -NDIS_STATUS -(FILTER_RESTART)( - __in NDIS_HANDLE FilterModuleContext, - __in PNDIS_FILTER_RESTART_PARAMETERS RestartParameters - ); -typedef FILTER_RESTART (*FILTER_RESTART_HANDLER); - -#define NDIS_FILTER_PAUSE_PARAMETERS_REVISION_1 1 - -typedef struct _NDIS_FILTER_PAUSE_PARAMETERS -{ - NDIS_OBJECT_HEADER Header; - ULONG Flags; - ULONG PauseReason; -} NDIS_FILTER_PAUSE_PARAMETERS, *PNDIS_FILTER_PAUSE_PARAMETERS; - -#define NDIS_SIZEOF_FILTER_PAUSE_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_FILTER_PAUSE_PARAMETERS, PauseReason) - -typedef -__drv_maxIRQL(PASSIVE_LEVEL) -NDIS_STATUS -(FILTER_PAUSE)( - __in NDIS_HANDLE FilterModuleContext, - __in PNDIS_FILTER_PAUSE_PARAMETERS PauseParameters - ); - -typedef FILTER_PAUSE (*FILTER_PAUSE_HANDLER); -// -// inbound requests/data -// - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(FILTER_OID_REQUEST)( - __in NDIS_HANDLE FilterModuleContext, - __in PNDIS_OID_REQUEST OidRequest - ); - -typedef FILTER_OID_REQUEST (*FILTER_OID_REQUEST_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(FILTER_CANCEL_OID_REQUEST)( - __in NDIS_HANDLE FilterModuleContext, - __in PVOID RequestId - ); - -typedef FILTER_CANCEL_OID_REQUEST (*FILTER_CANCEL_OID_REQUEST_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(FILTER_SEND_NET_BUFFER_LISTS)( - __in NDIS_HANDLE FilterModuleContext, - __in PNET_BUFFER_LIST NetBufferList, - __in NDIS_PORT_NUMBER PortNumber, - __in ULONG SendFlags - ); - -typedef FILTER_SEND_NET_BUFFER_LISTS (*FILTER_SEND_NET_BUFFER_LISTS_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(FILTER_CANCEL_SEND_NET_BUFFER_LISTS)( - __in NDIS_HANDLE FilterModuleContext, - __in PVOID CancelId - ); - -typedef FILTER_CANCEL_SEND_NET_BUFFER_LISTS (*FILTER_CANCEL_SEND_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(FILTER_RETURN_NET_BUFFER_LISTS)( - __in NDIS_HANDLE FilterModuleContext, - __in PNET_BUFFER_LIST NetBufferLists, - __in ULONG ReturnFlags - ); - -typedef FILTER_RETURN_NET_BUFFER_LISTS (*FILTER_RETURN_NET_BUFFER_LISTS_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(FILTER_SEND_NET_BUFFER_LISTS_COMPLETE)( - __in NDIS_HANDLE FilterModuleContext, - __in PNET_BUFFER_LIST NetBufferList, - __in ULONG SendCompleteFlags - ); - -typedef FILTER_SEND_NET_BUFFER_LISTS_COMPLETE (*FILTER_SEND_NET_BUFFER_LISTS_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(FILTER_RECEIVE_NET_BUFFER_LISTS)( - __in NDIS_HANDLE FilterModuleContext, - __in PNET_BUFFER_LIST NetBufferLists, - __in NDIS_PORT_NUMBER PortNumber, - __in ULONG NumberOfNetBufferLists, - __in ULONG ReceiveFlags - ); - -typedef FILTER_RECEIVE_NET_BUFFER_LISTS (*FILTER_RECEIVE_NET_BUFFER_LISTS_HANDLER); - -typedef -__drv_maxIRQL(PASSIVE_LEVEL) -VOID -(FILTER_DEVICE_PNP_EVENT_NOTIFY)( - __in NDIS_HANDLE FilterModuleContext, - __in PNET_DEVICE_PNP_EVENT NetDevicePnPEvent - ); - -typedef FILTER_DEVICE_PNP_EVENT_NOTIFY (*FILTER_DEVICE_PNP_EVENT_NOTIFY_HANDLER); - -typedef -__drv_maxIRQL(PASSIVE_LEVEL) -NDIS_STATUS -(FILTER_NET_PNP_EVENT)( - __in NDIS_HANDLE FilterModuleContext, - __in PNET_PNP_EVENT_NOTIFICATION NetPnPEventNotification - ); - -typedef FILTER_NET_PNP_EVENT (*FILTER_NET_PNP_EVENT_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(FILTER_STATUS)( - __in NDIS_HANDLE FilterModuleContext, - __in PNDIS_STATUS_INDICATION StatusIndication - ); - -typedef FILTER_STATUS (*FILTER_STATUS_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(FILTER_OID_REQUEST_COMPLETE)( - __in NDIS_HANDLE FilterModuleContext, - __in PNDIS_OID_REQUEST OidRequest, - __in NDIS_STATUS Status - ); - -typedef FILTER_OID_REQUEST_COMPLETE (*FILTER_OID_REQUEST_COMPLETE_HANDLER); -#if (NDIS_SUPPORT_NDIS61) -// -// NDIS 6.1 filter's entry points -// -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -NDIS_STATUS -(FILTER_DIRECT_OID_REQUEST)( - __in NDIS_HANDLE FilterModuleContext, - __in PNDIS_OID_REQUEST OidRequest - ); - -typedef FILTER_DIRECT_OID_REQUEST (*FILTER_DIRECT_OID_REQUEST_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(FILTER_DIRECT_OID_REQUEST_COMPLETE)( - __in NDIS_HANDLE FilterModuleContext, - __in PNDIS_OID_REQUEST OidRequest, - __in NDIS_STATUS Status - ); - -typedef FILTER_DIRECT_OID_REQUEST_COMPLETE (*FILTER_DIRECT_OID_REQUEST_COMPLETE_HANDLER); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(FILTER_CANCEL_DIRECT_OID_REQUEST)( - __in NDIS_HANDLE FilterModuleContext, - __in PVOID RequestId - ); - -typedef FILTER_CANCEL_DIRECT_OID_REQUEST (*FILTER_CANCEL_DIRECT_OID_REQUEST_HANDLER); -#endif (NDIS_SUPPORT_NDIS61) - -#define NDIS_FILTER_PARTIAL_CHARACTERISTICS_REVISION_1 1 - -typedef struct _NDIS_FILTER_PARTIAL_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; // Header.Type = NDIS_OBJECT_TYPE_FILTER_PARTIAL_CHARACTERISTICS - ULONG Flags; - FILTER_SEND_NET_BUFFER_LISTS_HANDLER SendNetBufferListsHandler; - FILTER_SEND_NET_BUFFER_LISTS_COMPLETE_HANDLER SendNetBufferListsCompleteHandler; - FILTER_CANCEL_SEND_HANDLER CancelSendNetBufferListsHandler; - FILTER_RECEIVE_NET_BUFFER_LISTS_HANDLER ReceiveNetBufferListsHandler; - FILTER_RETURN_NET_BUFFER_LISTS_HANDLER ReturnNetBufferListsHandler; -} NDIS_FILTER_PARTIAL_CHARACTERISTICS, *PNDIS_FILTER_PARTIAL_CHARACTERISTICS; - -#define NDIS_SIZEOF_FILTER_PARTIAL_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_FILTER_PARTIAL_CHARACTERISTICS, ReturnNetBufferListsHandler) - -// -// Filter driver flags -// -#define NDIS_FILTER_DRIVER_MANDATORY 0x00000001 - -#define NDIS_FILTER_CHARACTERISTICS_REVISION_1 1 - -#if (NDIS_SUPPORT_NDIS61) -#define NDIS_FILTER_CHARACTERISTICS_REVISION_2 2 -#endif // (NDIS_SUPPORT_NDIS61) - -typedef struct _NDIS_FILTER_DRIVER_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; - UCHAR MajorNdisVersion; - UCHAR MinorNdisVersion; - UCHAR MajorDriverVersion; - UCHAR MinorDriverVersion; - ULONG Flags; - NDIS_STRING FriendlyName; - NDIS_STRING UniqueName; - NDIS_STRING ServiceName; - SET_OPTIONS_HANDLER SetOptionsHandler; - FILTER_SET_FILTER_MODULE_OPTIONS_HANDLER SetFilterModuleOptionsHandler; - FILTER_ATTACH_HANDLER AttachHandler; - FILTER_DETACH_HANDLER DetachHandler; - FILTER_RESTART_HANDLER RestartHandler; - FILTER_PAUSE_HANDLER PauseHandler; - FILTER_SEND_NET_BUFFER_LISTS_HANDLER SendNetBufferListsHandler; - FILTER_SEND_NET_BUFFER_LISTS_COMPLETE_HANDLER SendNetBufferListsCompleteHandler; - FILTER_CANCEL_SEND_HANDLER CancelSendNetBufferListsHandler; - FILTER_RECEIVE_NET_BUFFER_LISTS_HANDLER ReceiveNetBufferListsHandler; - FILTER_RETURN_NET_BUFFER_LISTS_HANDLER ReturnNetBufferListsHandler; - FILTER_OID_REQUEST_HANDLER OidRequestHandler; - FILTER_OID_REQUEST_COMPLETE_HANDLER OidRequestCompleteHandler; - FILTER_CANCEL_OID_REQUEST_HANDLER CancelOidRequestHandler; - FILTER_DEVICE_PNP_EVENT_NOTIFY_HANDLER DevicePnPEventNotifyHandler; - FILTER_NET_PNP_EVENT_HANDLER NetPnPEventHandler; - FILTER_STATUS_HANDLER StatusHandler; -#if (NDIS_SUPPORT_NDIS61) - FILTER_DIRECT_OID_REQUEST_HANDLER DirectOidRequestHandler; - FILTER_DIRECT_OID_REQUEST_COMPLETE_HANDLER DirectOidRequestCompleteHandler; - FILTER_CANCEL_DIRECT_OID_REQUEST_HANDLER CancelDirectOidRequestHandler; -#endif // (NDIS_SUPPORT_NDIS61) -} NDIS_FILTER_DRIVER_CHARACTERISTICS, *PNDIS_FILTER_DRIVER_CHARACTERISTICS; -#define NDIS_SIZEOF_FILTER_DRIVER_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_FILTER_DRIVER_CHARACTERISTICS, StatusHandler) - -#if (NDIS_SUPPORT_NDIS61) -#define NDIS_SIZEOF_FILTER_DRIVER_CHARACTERISTICS_REVISION_2 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_FILTER_DRIVER_CHARACTERISTICS, CancelDirectOidRequestHandler) -#endif //(NDIS_SUPPORT_NDIS61) - -#define NDIS_FILTER_ATTRIBUTES_REVISION_1 1 - -typedef struct _NDIS_FILTER_ATTRIBUTES -{ - NDIS_OBJECT_HEADER Header; - ULONG Flags; -} NDIS_FILTER_ATTRIBUTES, *PNDIS_FILTER_ATTRIBUTES; - -#define NDIS_SIZEOF_FILTER_ATTRIBUTES_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_FILTER_ATTRIBUTES, Flags) - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisFRegisterFilterDriver( - __in PDRIVER_OBJECT DriverObject, - __in NDIS_HANDLE FilterDriverContext, - __in PNDIS_FILTER_DRIVER_CHARACTERISTICS FilterDriverCharacteristics, - __out PNDIS_HANDLE NdisFilterDriverHandle - ); - - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisFDeregisterFilterDriver( - __in NDIS_HANDLE NdisFilterDriverHandle - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisFSetAttributes( - __in NDIS_HANDLE NdisFilterHandle, - __in NDIS_HANDLE FilterModuleContext, - __in PNDIS_FILTER_ATTRIBUTES FilterAttributes - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisFRestartFilter( - __in NDIS_HANDLE NdisFilterHandle - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFSendNetBufferLists( - __in NDIS_HANDLE NdisFilterHandle, - __in PNET_BUFFER_LIST NetBufferList, - __in NDIS_PORT_NUMBER PortNumber, - __in ULONG SendFlags - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFReturnNetBufferLists( - __in NDIS_HANDLE NdisFilterHandle, - __in PNET_BUFFER_LIST NetBufferLists, - __in ULONG ReturnFlags - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFSendNetBufferListsComplete( - __in NDIS_HANDLE NdisFilterHandle, - __in PNET_BUFFER_LIST NetBufferList, - __in ULONG SendCompleteFlags - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFIndicateReceiveNetBufferLists( - __in NDIS_HANDLE NdisFilterHandle, - __in PNET_BUFFER_LIST NetBufferLists, - __in NDIS_PORT_NUMBER PortNumber, - __in ULONG NumberOfNetBufferLists, - __in ULONG ReceiveFlags - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisFOidRequest( - __in NDIS_HANDLE NdisFilterHandle, - __in PNDIS_OID_REQUEST OidRequest - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFOidRequestComplete( - __in NDIS_HANDLE NdisFilterHandle, - __in PNDIS_OID_REQUEST OidRequest, - __in NDIS_STATUS Status - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFIndicateStatus( - __in NDIS_HANDLE NdisFilterHandle, - __in PNDIS_STATUS_INDICATION StatusIndication - ); - - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisFRestartComplete( - __in NDIS_HANDLE NdisFilterHandle, - __in NDIS_STATUS Status - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFPauseComplete( - __in NDIS_HANDLE NdisFilterHandle - ); - - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisFDevicePnPEventNotify( - __in NDIS_HANDLE NdisFilterHandle, - __in PNET_DEVICE_PNP_EVENT NetDevicePnPEvent - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisFNetPnPEvent( - __in NDIS_HANDLE NdisFilterHandle, - __in PNET_PNP_EVENT_NOTIFICATION NetPnPEventNotification - ); - - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFCancelSendNetBufferLists( - __in NDIS_HANDLE NdisFilterHandle, - __in PVOID CancelId - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFCancelOidRequest( - __in NDIS_HANDLE NdisFilterHandle, - __in PVOID RequestId - ); - -#if (NDIS_SUPPORT_NDIS61) -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -NDIS_STATUS -NdisFDirectOidRequest( - __in NDIS_HANDLE NdisFilterHandle, - __in PNDIS_OID_REQUEST OidRequest - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFDirectOidRequestComplete( - __in NDIS_HANDLE NdisFilterHandle, - __in PNDIS_OID_REQUEST OidRequest, - __in NDIS_STATUS Status - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -EXPORT -VOID -NdisFCancelDirectOidRequest( - __in NDIS_HANDLE NdisFilterHandle, - __in PVOID RequestId - ); - -#endif // (NDIS_SUPPORT_NDIS61) - -#endif // NDIS_SUPPORT_NDIS6 - -#pragma once - -#if (NDIS_SUPPORT_NDIS6 || defined(NDIS60)) - -// -// NDIS IF data structures, function prototypes and macros -// - -typedef -__drv_maxIRQL(PASSIVE_LEVEL) -NDIS_STATUS -(*IFP_QUERY_OBJECT)( - __in NDIS_HANDLE ProviderIfContext, - __in NET_IF_OBJECT_ID ObjectId, - __inout PULONG pOutputBufferLength, - __out PVOID pOutputBuffer - ); - -typedef -__drv_maxIRQL(PASSIVE_LEVEL) -NDIS_STATUS -(*IFP_SET_OBJECT)( - __in NDIS_HANDLE ProviderIfContext, - __in NET_IF_OBJECT_ID ObjectId, - __in ULONG InputBufferLength, - __in PVOID pInputBuffer - ); - - -typedef struct _NDIS_IF_PROVIDER_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; - - // - // Generic query and set handlers: - // - IFP_QUERY_OBJECT QueryObjectHandler; - IFP_SET_OBJECT SetObjectHandler; - - PVOID Reserved1; - PVOID Reserved2; - -} NDIS_IF_PROVIDER_CHARACTERISTICS, *PNDIS_IF_PROVIDER_CHARACTERISTICS; - -#define NDIS_SIZEOF_IF_PROVIDER_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_IF_PROVIDER_CHARACTERISTICS, Reserved2) - -// -// NET_IF_INFORMATION is passed to NdisIfRegisterInterface -// -typedef struct _NET_IF_INFORMATION -{ - NDIS_OBJECT_HEADER Header; - ULONG Flags; // Misc. information - NET_PHYSICAL_LOCATION PhysicalLocation; // physical location on machine - ULONG WanTunnelType; // tunnelIfEncapsMethod (RFC 2667) - ULONG PortNumber; // for WAN devices. - NET_IF_ACCESS_TYPE AccessType; - NET_IF_DIRECTION_TYPE DirectionType; - NET_IF_CONNECTION_TYPE ConnectionType; - BOOLEAN ifConnectorPresent; - USHORT PhysAddressLength; // in bytes (ifPhysAddress). this is -current- mac address - USHORT PhysAddressOffset; // from beginning of this struct - USHORT PermanentPhysAddressOffset; // from beginning of this struct - // - // The "friendly name" represents ifDescr: - // - USHORT FriendlyNameLength; // in bytes - USHORT FriendlyNameOffset; // from beginning of this struct - GUID InterfaceGuid; - NET_IF_NETWORK_GUID NetworkGuid; - ULONG SupportedStatistics; - NDIS_MEDIUM MediaType; - NDIS_PHYSICAL_MEDIUM PhysicalMediumType; -} NET_IF_INFORMATION, *PNET_IF_INFORMATION; - - -#define NDIS_SIZEOF_NET_IF_INFORMATION_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NET_IF_INFORMATION, PhysicalMediumType) - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisIfRegisterProvider( - __in PNDIS_IF_PROVIDER_CHARACTERISTICS ProviderCharacteristics, - __in NDIS_HANDLE IfProviderContext, - __out PNDIS_HANDLE pNdisIfProviderHandle - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisIfDeregisterProvider( - __in NDIS_HANDLE NdisProviderHandle - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisIfAllocateNetLuidIndex( - __in NET_IFTYPE ifType, - __out PUINT32 pNetLuidIndex - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisIfFreeNetLuidIndex( - __in NET_IFTYPE ifType, - __in UINT32 NetLuidIndex - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisIfRegisterInterface( - __in NDIS_HANDLE NdisProviderHandle, - __in NET_LUID NetLuid, - __in NDIS_HANDLE ProviderIfContext, - __in PNET_IF_INFORMATION pIfInfo, - __out PNET_IFINDEX pfIndex - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisIfDeregisterInterface( - __in NET_IFINDEX ifIndex - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisIfGetInterfaceIndexFromNetLuid( - __in NET_LUID NetLuid, - __out PNET_IFINDEX pIfIndex - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisIfGetNetLuidFromInterfaceIndex( - __in NET_IFINDEX ifIndex, - __out PNET_LUID pNetLuid - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisIfQueryBindingIfIndex( - __in NDIS_HANDLE NdisBindingHandle, - __out PNET_IFINDEX pBoundIfIndex, - __out PNET_LUID pBoundIfNetLuid, - __out PNET_IFINDEX pLowestIfIndex, - __out PNET_LUID pLowestIfNetLuid - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -NDIS_STATUS -NdisIfAddIfStackEntry( - __in NET_IFINDEX HigherLayerIfIndex, - __in NET_IFINDEX LowerLayerIfIndex - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -EXPORT -VOID -NdisIfDeleteIfStackEntry( - __in NET_IFINDEX HigherLayerIfIndex, - __in NET_IFINDEX LowerLayerIfIndex - ); - -#endif // (NDIS_SUPPORT_NDIS6 || defined(NDIS60)) - -#endif // _NDIS_ - diff --git a/pub/ddk/ndischimney.h b/pub/ddk/ndischimney.h deleted file mode 100644 index d3a61d0..0000000 --- a/pub/ddk/ndischimney.h +++ /dev/null @@ -1,973 +0,0 @@ -#ifndef _CHIMNEY_OFFLOAD_ -#define _CHIMNEY_OFFLOAD_ - -#pragma once - -#if (defined(NDIS60) || NDIS_WRAPPER || defined(NDIS61) || defined(NDIS620)) - -// -// This is the encapsulation type used by the stack for TCP connection offload -// -typedef struct _NDIS_TCP_CONNECTION_OFFLOAD_ENCAPSULATION -{ - struct - { - UCHAR Enabled; - ULONG EncapsulationType; - ULONG HeaderSize; - }V4; - struct - { - UCHAR Enabled; - ULONG EncapsulationType; - ULONG HeaderSize; - }V6; - -}NDIS_TCP_CONNECTION_OFFLOAD_ENCAPSULATION, NDIS_TCP_CONNECTION_OFFLOAD_ENCAPSULATION; -// -// These are the parameters that the stack sets on the NIC to use during -// connection offload by setting OID OID_TCP_CONNECTION_OFFLOAD_PARAMETERS -// - -// -// Header.Type = NDIS_OBJECT_TYPE_DEFAULT; -// Header.Revision = NDIS_TCP_CONNECTION_OFFLOAD_PARAMETERS_1; -// Header.Size = sizeof(NDIS_TCP_CONNECTION_OFFLOAD_PARAMETERS); -// -#define NDIS_TCP_CONNECTION_OFFLOAD_PARAMETERS_1 1 -#if NDIS_SUPPORT_NDIS61 -#define NDIS_TCP_CONNECTION_OFFLOAD_PARAMETERS_2 2 -#endif // NDIS_SUPPORT_NDIS61 - -typedef struct _NDIS_TCP_CONNECTION_OFFLOAD_PARAMETERS -{ - NDIS_OBJECT_HEADER Header; - NDIS_OFFLOAD_ENCAPSULATION Encapsulation; - ULONG TicksPerSecond; - UCHAR TcpAckFrequency; - UCHAR TcpDelayedAckTicks; - UCHAR TcpMaximumRetransmissions; - UCHAR TcpDoubtReachabilityRetransmissions; - ULONG TcpSwsPreventionTicks; - ULONG TcpDuplicateAckThreshold; - ULONG TcpPushTicks; - ULONG NceStaleTicks; -#if NDIS_SUPPORT_NDIS61 - ULONG CongestionAlgorithm; -#endif // NDIS_SUPPORT_NDIS61 -} NDIS_TCP_CONNECTION_OFFLOAD_PARAMETERS, *PNDIS_TCP_CONNECTION_OFFLOAD_PARAMETERS; - -#define NDIS_SIZEOF_TCP_CONNECTION_OFFLOAD_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_TCP_CONNECTION_OFFLOAD_PARAMETERS, NceStaleTicks) -#if NDIS_SUPPORT_NDIS61 -#define NDIS_SIZEOF_TCP_CONNECTION_OFFLOAD_PARAMETERS_REVISION_2 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_TCP_CONNECTION_OFFLOAD_PARAMETERS, CongestionAlgorithm) -#endif // NDIS_SUPPORT_NDIS61 - -// -// NDIS_CHIMNEY_OFFLOAD_TYPE -// -// Specifies the chimney type. -// -typedef enum -{ - NdisTcpChimneyOffload = 1, - NdisIpsecChimneyOffload, - NdisRdmaChimneyOffload, - NdisMaxChimneyOffload -} NDIS_CHIMNEY_OFFLOAD_TYPE, *PNDIS_CHIMNEY_OFFLOAD_TYPE; - -// -// INDICATE_OFFLOAD_EVENT -// -// Qualifies a Offload Event indication. -// -typedef enum -{ - NeighborReachabilityInDoubt = 0x0001, - NeighborReachabilityQuery, - MaxOffloadEvent -} INDICATE_OFFLOAD_EVENT, *PINDICATE_OFFLOAD_EVENT; - -// -// OFFLOAD_STATE_TYPE -// -// State type at each layer in the stack. -// -typedef enum -{ - NeighborOffloadConstState = 0x1, - NeighborOffloadCachedState, - NeighborOffloadDelegatedState, - NeighborOffloadState, - Ip4OffloadConstState, - Ip4OffloadCachedState, - Ip4OffloadDelegatedState, - Ip4OffloadState, - Ip6OffloadConstState, - Ip6OffloadCachedState, - Ip6OffloadDelegatedState, - Ip6OffloadState, - TcpOffloadConstState, - TcpOffloadCachedState, - TcpOffloadDelegatedState, - TcpOffloadResourceState, - TcpOffloadState, - FilterReservedOffloadState = 0xFE, - MaximumOffloadState -} OFFLOAD_STATE_TYPE, *POFFLOAD_STATE_TYPE; - -// -// OFFLOAD_STATE_HEADER -// -// Offload state header, precedes each offload state. -// -typedef struct _OFFLOAD_STATE_HEADER -{ - ULONG Length; - ULONG RecognizedOptions; -} OFFLOAD_STATE_HEADER, *POFFLOAD_STATE_HEADER; - -// -// -// TCP_OFFLOAD_CONNECTION_STATE -// -// TCP connection state [RFC 793]. -// -typedef enum -{ - TcpConnectionClosed, - TcpConnectionListen, - TcpConnectionSynSent, - TcpConnectionSynRcvd, - TcpConnectionEstablished, - TcpConnectionFinWait1, - TcpConnectionFinWait2, - TcpConnectionCloseWait, - TcpConnectionClosing, - TcpConnectionLastAck, - TcpConnectionTimeWait, - TcpConnectionMaxState -} TCP_OFFLOAD_CONNECTION_STATE, *PTCP_OFFLOAD_CONNECTION_STATE; - -// -// TCP_UPLOAD_REASON -// -// Reason for upoloading an offloaded TCP connection back to the host. -// -typedef enum -{ - LowActivity = 1, - HighDropRate, - SmallIO, - NoBufferProposting, - ReceivedUrgentData, - HighFragmentation, - HighOutOfOrderPackets, - TimeoutExpiration, - InvalidState, - UploadRequested, - HardwareFailure, - MaxUploadReason -} TCP_UPLOAD_REASON, *PTCP_UPLOAD_REASON; - -// -// Qualifies a disconnect event or a disconnect request on a TCP connection. -// -#define TCP_DISCONNECT_GRACEFUL_CLOSE 0x01 -#define TCP_DISCONNECT_ABORTIVE_CLOSE 0x02 - -// -// TCP_OFFLOAD_EVENT_TYPE -// -// Event indications possible on an offloaded TCP connection. -// -typedef enum -{ - TcpIndicateSendBacklogChange = 1, - TcpIndicateDisconnect, - TcpIndicateRetrieve, - TcpIndicateAbort -} TCP_OFFLOAD_EVENT_TYPE, *PTCP_OFFLOAD_EVENT_TYPE; - - -// -// Flags part of the TCP constant state. -// -#define TCP_FLAG_TIMESTAMP_ENABLED 0x01 -#define TCP_FLAG_SACK_ENABLED 0x02 -#define TCP_FLAG_WINDOW_SCALING_ENABLED 0x04 - -// -// TCP_OFFLOAD_STATE_CONST -// -// Constant fields of a Connection. -// -typedef struct _TCP_OFFLOAD_STATE_CONST -{ - OFFLOAD_STATE_HEADER Header; - USHORT Flags; - USHORT RemotePort; - USHORT LocalPort; - UCHAR SndWindScale: 4; - UCHAR RcvWindScale: 4; - USHORT RemoteMss; - ULONG HashValue; -} TCP_OFFLOAD_STATE_CONST, *PTCP_OFFLOAD_STATE_CONST; - -// -// Flags part of the TCP cached state. -// -#define TCP_FLAG_KEEP_ALIVE_ENABLED 0x01 -#define TCP_FLAG_NAGLING_ENABLED 0x02 -#define TCP_FLAG_KEEP_ALIVE_RESTART 0x04 -#define TCP_FLAG_MAX_RT_RESTART 0x08 -#define TCP_FLAG_UPDATE_RCV_WND 0x10 - -// -// TCP_OFFLOAD_STATE_CACHED -// -// Cached fields of a TCB. -// -typedef struct _TCP_OFFLOAD_STATE_CACHED -{ - OFFLOAD_STATE_HEADER Header; - USHORT Flags; - ULONG InitialRcvWnd; - ULONG RcvIndicationSize; - UCHAR KaProbeCount; - ULONG KaTimeout; - ULONG KaInterval; - ULONG MaxRT; - ULONG FlowLabel:20; - UCHAR TtlOrHopLimit; - UCHAR TosOrTrafficClass; - UCHAR UserPriority:3; -} TCP_OFFLOAD_STATE_CACHED, *PTCP_OFFLOAD_STATE_CACHED; - -// -// TCP_OFFLOAD_STATE_DELEGATED -// -// Delegated fields of a TCB. -// -typedef struct _TCP_OFFLOAD_STATE_DELEGATED -{ - OFFLOAD_STATE_HEADER Header; - TCP_OFFLOAD_CONNECTION_STATE State; - USHORT Flags; - ULONG RcvNxt; - ULONG RcvWnd; - ULONG SndUna; - ULONG SndNxt; - ULONG SndMax; - ULONG SndWnd; - ULONG MaxSndWnd; - ULONG SendWL1; - ULONG CWnd; - ULONG SsThresh; - USHORT SRtt; - USHORT RttVar; - ULONG TsRecent; - ULONG TsRecentAge; - ULONG TsTime; - ULONG TotalRT; - UCHAR DupAckCount; - UCHAR SndWndProbeCount; - - struct - { - UCHAR ProbeCount; - ULONG TimeoutDelta; - } KeepAlive; - - struct - { - UCHAR Count; - ULONG TimeoutDelta; - } Retransmit; - - union - { - struct - { - PNET_BUFFER_LIST SendDataHead; - PNET_BUFFER_LIST SendDataTail; - }; - - ULONG SendBacklogSize; - }; - - union - { - PNET_BUFFER_LIST BufferedData; - ULONG ReceiveBacklogSize; - }; -#if NDIS_SUPPORT_NDIS61 - ULONG DWnd; -#endif // NDIS_SUPPORT_NDIS61 -} TCP_OFFLOAD_STATE_DELEGATED, *PTCP_OFFLOAD_STATE_DELEGATED; - -// -// PATH_OFFLOAD_STATE_CONST -// -// IP path constant parameters. -// -typedef struct _PATH_OFFLOAD_STATE_CONST -{ - OFFLOAD_STATE_HEADER Header; - CONST UCHAR *SourceAddress; - CONST UCHAR *DestinationAddress; -} PATH_OFFLOAD_STATE_CONST, *PPATH_OFFLOAD_STATE_CONST; - -// -// PATH_OFFLOAD_STATE_CACHED -// -// IP path cached parameters. -// -typedef struct _PATH_OFFLOAD_STATE_CACHED -{ - OFFLOAD_STATE_HEADER Header; - ULONG PathMtu; -} PATH_OFFLOAD_STATE_CACHED, *PPATH_OFFLOAD_STATE_CACHED; - -// -// PATH_OFFLOAD_STATE_DELEGATED -// -// IP path delegated parameters. -// -typedef struct _PATH_OFFLOAD_STATE_DELEGATED -{ - OFFLOAD_STATE_HEADER Header; -} PATH_OFFLOAD_STATE_DELEGATED, *PPATH_OFFLOAD_STATE_DELEGATED; - -// -// NEIGHBOR_OFFLOAD_STATE_CONST -// -// Neighbor const parameters. -// -typedef struct _NEIGHBOR_OFFLOAD_STATE_CONST -{ - OFFLOAD_STATE_HEADER Header; - UCHAR DlSourceAddress[32]; - ULONG VlanId: 12; -} NEIGHBOR_OFFLOAD_STATE_CONST, *PNEIGHBOR_OFFLOAD_STATE_CONST; - -// -// NEIGHBOR_OFFLOAD_STATE_CACHED -// -// Neighbor cached parameters. -// -typedef struct _NEIGHBOR_OFFLOAD_STATE_CACHED -{ - OFFLOAD_STATE_HEADER Header; - UCHAR DlDestinationAddress[32]; - ULONG HostReachabilityDelta; -} NEIGHBOR_OFFLOAD_STATE_CACHED, *PNEIGHBOR_OFFLOAD_STATE_CACHED; - -// -// NEIGHBOR_OFFLOAD_STATE_DELEGATED -// -// Neighbor cached parameters. -// -typedef struct _NEIGHBOR_OFFLOAD_STATE_DELEGATED -{ - OFFLOAD_STATE_HEADER Header; - ULONG NicReachabilityDelta; -} NEIGHBOR_OFFLOAD_STATE_DELEGATED, *PNEIGHBOR_OFFLOAD_STATE_DELEGATED; - - -// -// TCP_OFFLOAD_STATS -// -// Statistics definitions in TCP on a per interface basis -// -typedef struct _TCP_OFFLOAD_STATS -{ - ULONG64 InSegments; - ULONG64 OutSegments; - ULONG CurrentlyEstablished; - ULONG ResetEstablished; - ULONG RetransmittedSegments; - ULONG InErrors; - ULONG OutResets; -} TCP_OFFLOAD_STATS, *PTCP_OFFLOAD_STATS; - -// -// IP_OFFLOAD_STATS -// -// Stats definitions in IPV4/IPV6 on a per interface basis -// -typedef struct _IP_OFFLOAD_STATS -{ - ULONG64 InReceives; - ULONG64 InOctets; - ULONG64 InDelivers; - ULONG64 OutRequests; - ULONG64 OutOctets; - ULONG InHeaderErrors; - ULONG InTruncatedPackets; - ULONG InDiscards; - ULONG OutDiscards; - ULONG OutNoRoutes; -} IP_OFFLOAD_STATS, *PIP_OFFLOAD_STATS; - - -typedef struct _NDIS_OFFLOAD_HANDLE -{ - PVOID NdisReserved[1]; - PVOID MiniportOffloadContext; -} NDIS_OFFLOAD_HANDLE, *PNDIS_OFFLOAD_HANDLE; - - -// -// Internal wrapper sround NDIS_OFFLOAD_HANDLE. -// ProtocolBindingContext is required for handling Receive Indications in FL. -// -typedef struct _NDIS_OFFLOAD_HANDLE_PRIVATE -{ - NDIS_OFFLOAD_HANDLE Handle; - PVOID ProtocolBindingContext; -} NDIS_OFFLOAD_HANDLE_PRIVATE, *PNDIS_OFFLOAD_HANDLE_PRIVATE; - - -typedef struct _NDIS_PROTOCOL_OFFLOAD_BLOCK_LIST -{ - IN NDIS_OBJECT_HEADER Header; - IN struct _NDIS_PROTOCOL_OFFLOAD_BLOCK_LIST *NextBlock; - IN struct _NDIS_PROTOCOL_OFFLOAD_BLOCK_LIST *DependentBlockList; - OUT NDIS_STATUS Status; - IN PVOID NdisReserved[3]; - IN OUT PNDIS_OFFLOAD_HANDLE OffloadHandle; - IN PVOID ProtocolReserved[2]; - IN PVOID MiniportReserved[2]; - IN PVOID ImReserved[2]; - IN PVOID Scratch[2]; - IN PVOID SourceHandle; - IN NDIS_PORT_NUMBER PortNumber; - IN OUT PNET_BUFFER_LIST NetBufferListChain; - // - // The state specific information (if any) will follow this. - // -} NDIS_PROTOCOL_OFFLOAD_BLOCK_LIST, *PNDIS_PROTOCOL_OFFLOAD_BLOCK_LIST; - -// -// Generic offload functions supported by the protocol. -// -typedef -VOID -(*INITIATE_OFFLOAD_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_PROTOCOL_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -typedef -VOID -(*TERMINATE_OFFLOAD_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_PROTOCOL_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -typedef -VOID -(*INVALIDATE_OFFLOAD_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_PROTOCOL_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -typedef -VOID -(*UPDATE_OFFLOAD_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_PROTOCOL_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -typedef -VOID -(*QUERY_OFFLOAD_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_PROTOCOL_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -// -// Generic indication handlers supported by the protocol. -// -typedef -VOID -(*INDICATE_OFFLOAD_EVENT_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_PROTOCOL_OFFLOAD_BLOCK_LIST OffloadBlockList, - IN ULONG IndicationCode - ); - -// -// Tcp offload specific functions supported by the protocol, for completions. -// -typedef -VOID -(*TCP_OFFLOAD_SEND_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNET_BUFFER_LIST NetBufferList - ); - -typedef -VOID -(*TCP_OFFLOAD_RECV_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNET_BUFFER_LIST NetBufferList - ); - -typedef -VOID -(*TCP_OFFLOAD_DISCONNECT_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNET_BUFFER_LIST NetBufferList - ); - -typedef -VOID -(*TCP_OFFLOAD_FORWARD_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNET_BUFFER_LIST NetBufferList - ); - -// -// Tcp offload specific functions supported by the protocol, for indications. -// -typedef -VOID -(*TCP_OFFLOAD_EVENT_HANDLER)( - IN PVOID OffloadContext, - IN ULONG EventType, - IN ULONG EventSpecificInformation - ); - -typedef -NDIS_STATUS -(*TCP_OFFLOAD_RECEIVE_INDICATE_HANDLER)( - IN PVOID OffloadContext, - IN PNET_BUFFER_LIST NetBufferList, - IN NDIS_STATUS Status, - OUT PULONG BytesConsumed - ); - -typedef struct _NDIS_OFFLOAD_CLIENT_HANDLERS -{ - NDIS_OBJECT_HEADER Header; -} NDIS_OFFLOAD_CLIENT_HANDLERS, *PNDIS_OFFLOAD_CLIENT_HANDLERS; - -typedef struct _NDIS_TCP_OFFLOAD_CLIENT_HANDLERS -{ - NDIS_OBJECT_HEADER Header; - TCP_OFFLOAD_SEND_COMPLETE_HANDLER TcpOffloadSendCompleteHandler; - TCP_OFFLOAD_RECV_COMPLETE_HANDLER TcpOffloadReceiveCompleteHandler; - TCP_OFFLOAD_DISCONNECT_COMPLETE_HANDLER TcpOffloadDisconnectCompleteHandler; - TCP_OFFLOAD_FORWARD_COMPLETE_HANDLER TcpOffloadForwardCompleteHandler; - TCP_OFFLOAD_EVENT_HANDLER TcpOffloadEventHandler; - TCP_OFFLOAD_RECEIVE_INDICATE_HANDLER TcpOffloadReceiveIndicateHandler; -} NDIS_TCP_OFFLOAD_CLIENT_HANDLERS, *PNDIS_TCP_OFFLOAD_CLIENT_HANDLERS; - - -#define NDIS_CLIENT_CHIMNEY_OFFLOAD_GENERIC_CHARACTERISTICS_REVISION_1 1 - -typedef struct _NDIS_CLIENT_CHIMNEY_OFFLOAD_GENERIC_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; // Header.Type = NDIS_OBJECT_TYPE_CLIENT_CHIMNEY_OFFLOAD_GENERIC_CHARACTERISTICS - ULONG Flags; - // - // Generic Offload initiation and termination completion handlers. - // - INITIATE_OFFLOAD_COMPLETE_HANDLER InitiateOffloadCompleteHandler; - TERMINATE_OFFLOAD_COMPLETE_HANDLER TerminateOffloadCompleteHandler; - - // - // Generic offload state control request completion handlers. - // - UPDATE_OFFLOAD_COMPLETE_HANDLER UpdateOffloadCompleteHandler; - INVALIDATE_OFFLOAD_COMPLETE_HANDLER InvalidateOffloadCompleteHandler; - QUERY_OFFLOAD_COMPLETE_HANDLER QueryOffloadCompleteHandler; - - // - // Generic offload state indication handlers. - // - INDICATE_OFFLOAD_EVENT_HANDLER IndicateOffloadEventHandler; - -} NDIS_CLIENT_CHIMNEY_OFFLOAD_GENERIC_CHARACTERISTICS, *PNDIS_CLIENT_CHIMNEY_OFFLOAD_GENERIC_CHARACTERISTICS; - -#define NDIS_SIZEOF_CLIENT_CHIMNEY_OFFLOAD_GENERIC_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_CLIENT_CHIMNEY_OFFLOAD_GENERIC_CHARACTERISTICS, IndicateOffloadEventHandler) - -#define NDIS_CLIENT_CHIMNEY_OFFLOAD_TCP_CHARACTERISTICS_REVISION_1 1 - -typedef struct _NDIS_CLIENT_CHIMNEY_OFFLOAD_TCP_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; // Header.Type = NDIS_OBJECT_TYPE_CLIENT_CHIMNEY_OFFLOAD_CHARACTERISTICS - ULONG Flags; - NDIS_CHIMNEY_OFFLOAD_TYPE OffloadType; // NdisTcpChimneyOffload - TCP_OFFLOAD_SEND_COMPLETE_HANDLER TcpOffloadSendCompleteHandler; - TCP_OFFLOAD_RECV_COMPLETE_HANDLER TcpOffloadReceiveCompleteHandler; - TCP_OFFLOAD_DISCONNECT_COMPLETE_HANDLER TcpOffloadDisconnectCompleteHandler; - TCP_OFFLOAD_FORWARD_COMPLETE_HANDLER TcpOffloadForwardCompleteHandler; - TCP_OFFLOAD_EVENT_HANDLER TcpOffloadEventHandler; - TCP_OFFLOAD_RECEIVE_INDICATE_HANDLER TcpOffloadReceiveIndicateHandler; -} NDIS_CLIENT_CHIMNEY_OFFLOAD_TCP_CHARACTERISTICS, *PNDIS_CLIENT_CHIMNEY_OFFLOAD_TCP_CHARACTERISTICS; - -#define NDIS_SIZEOF_CLIENT_CHIMNEY_OFFLOAD_TCP_CHARACTERISTICS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_CLIENT_CHIMNEY_OFFLOAD_TCP_CHARACTERISTICS, TcpOffloadReceiveIndicateHandler) - -// -// Generic offload functions supported by NDIS, for use by the protocol. -// -EXPORT -VOID -NdisInitiateOffload( - IN NDIS_HANDLE NdisBindingHandle, - IN OUT PNDIS_PROTOCOL_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -EXPORT -VOID -NdisTerminateOffload( - IN NDIS_HANDLE NdisBindingHandle, - IN OUT PNDIS_PROTOCOL_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -EXPORT -VOID -NdisInvalidateOffload( - IN NDIS_HANDLE NdisBindingHandle, - IN PNDIS_PROTOCOL_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -EXPORT -VOID -NdisUpdateOffload( - IN NDIS_HANDLE NdisBindingHandle, - IN PNDIS_PROTOCOL_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -EXPORT -VOID -NdisQueryOffloadState( - IN NDIS_HANDLE NdisBindingHandle, - IN PNDIS_PROTOCOL_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -// -// Tcp specific offload functions supported by NDIS, for use by the protocol. -// -EXPORT -NDIS_STATUS -NdisOffloadTcpSend( - IN PNDIS_OFFLOAD_HANDLE NdisOffloadHandle, - IN PNET_BUFFER_LIST NetBufferList - ); - -EXPORT -NDIS_STATUS -NdisOffloadTcpReceive( - IN PNDIS_OFFLOAD_HANDLE NdisOffloadHandle, - IN PNET_BUFFER_LIST NetBufferList - ); - -EXPORT -NDIS_STATUS -NdisOffloadTcpDisconnect( - IN PNDIS_OFFLOAD_HANDLE NdisOffloadHandle, - IN PNET_BUFFER_LIST NetBufferList, - IN ULONG Flags - ); - -EXPORT -NDIS_STATUS -NdisOffloadTcpForward( - IN PNDIS_OFFLOAD_HANDLE NdisOffloadHandle, - IN PNET_BUFFER_LIST NetBufferList - ); - -VOID -NdisOffloadTcpReceiveReturn( - IN NDIS_HANDLE NdisBindingHandle, - IN PNET_BUFFER_LIST NetBufferList - ); - -typedef struct _NDIS_MINIPORT_OFFLOAD_BLOCK_LIST -{ - IN NDIS_OBJECT_HEADER Header; - IN struct _NDIS_MINIPORT_OFFLOAD_BLOCK_LIST *NextBlock; - IN struct _NDIS_MINIPORT_OFFLOAD_BLOCK_LIST *DependentBlockList; - OUT NDIS_STATUS Status; - IN PVOID NdisReserved[2]; - IN OUT PVOID *MiniportOffloadContext; - IN NDIS_HANDLE NdisOffloadHandle; - IN PVOID ProtocolReserved[2]; - IN PVOID MiniportReserved[2]; - IN PVOID ImReserved[2]; - IN PVOID Scratch[2]; - IN PVOID SourceHandle; - IN NDIS_PORT_NUMBER PortNumber; - IN OUT PNET_BUFFER_LIST NetBufferListChain; - // - // The state specific information (if any) will follow this. - // -} NDIS_MINIPORT_OFFLOAD_BLOCK_LIST, *PNDIS_MINIPORT_OFFLOAD_BLOCK_LIST; - -// -// Generic offload functions supported by the miniport. -// -typedef -VOID -(*W_INITIATE_OFFLOAD_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN OUT PNDIS_MINIPORT_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -typedef -VOID -(*W_TERMINATE_OFFLOAD_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN OUT PNDIS_MINIPORT_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -typedef -VOID -(*W_INVALIDATE_OFFLOAD_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PNDIS_MINIPORT_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -typedef -VOID -(*W_UPDATE_OFFLOAD_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PNDIS_MINIPORT_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -typedef -VOID -(*W_QUERY_OFFLOAD_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN OUT PNDIS_MINIPORT_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -// -// Tcp specific offload functions supported by the miniport. -// -typedef -NDIS_STATUS -(*W_TCP_OFFLOAD_SEND_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PVOID MiniportOffloadContext, - IN PNET_BUFFER_LIST NetBufferList - ); - -typedef -NDIS_STATUS -(*W_TCP_OFFLOAD_RECEIVE_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PVOID MiniportOffloadContext, - IN PNET_BUFFER_LIST NetBufferList - ); - -typedef -NDIS_STATUS -(*W_TCP_OFFLOAD_DISCONNECT_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PVOID MiniportOffloadContext, - IN PNET_BUFFER_LIST NetBufferList, - IN ULONG Flags - ); - -typedef -NDIS_STATUS -(*W_TCP_OFFLOAD_FORWARD_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PVOID MiniportOffloadContext, - IN PNET_BUFFER_LIST NetBufferList - ); - - -typedef -NDIS_STATUS -(*W_TCP_OFFLOAD_RECEIVE_RETURN_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PNET_BUFFER_LIST NetBufferList - ); - - -typedef struct _NDIS_PROVIDER_CHIMNEY_OFFLOAD_GENERIC_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; // Header.Type = NDIS_OBJECT_TYPE_PROVIDER_CHIMNEY_OFFLOAD_GENERIC_CHARACTERISTICS - ULONG Flags; - - // - // Generic Offload initiation and termination handlers. - // - W_INITIATE_OFFLOAD_HANDLER InitiateOffloadHandler; - W_TERMINATE_OFFLOAD_HANDLER TerminateOffloadHandler; - - // - // Generic offload state control functions. - // - W_UPDATE_OFFLOAD_HANDLER UpdateOffloadHandler; - W_INVALIDATE_OFFLOAD_HANDLER InvalidateOffloadHandler; - W_QUERY_OFFLOAD_HANDLER QueryOffloadHandler; - -} NDIS_PROVIDER_CHIMNEY_OFFLOAD_GENERIC_CHARACTERISTICS, *PNDIS_PROVIDER_CHIMNEY_OFFLOAD_GENERIC_CHARACTERISTICS; - -typedef struct _NDIS_PROVIDER_CHIMNEY_OFFLOAD_TCP_CHARACTERISTICS -{ - NDIS_OBJECT_HEADER Header; // Header.Type = NDIS_OBJECT_TYPE_PROVIDER_CHIMNEY_OFFLOAD_CHARACTERISTICS - ULONG Flags; - NDIS_CHIMNEY_OFFLOAD_TYPE OffloadType; // NdisTcpChimneyOffload - // - // TCP function handlers - // - W_TCP_OFFLOAD_SEND_HANDLER TcpOffloadSendHandler; - W_TCP_OFFLOAD_RECEIVE_HANDLER TcpOffloadReceiveHandler; - W_TCP_OFFLOAD_DISCONNECT_HANDLER TcpOffloadDisconnectHandler; - W_TCP_OFFLOAD_FORWARD_HANDLER TcpOffloadForwardHandler; - - // - // Receive return handler. - // - W_TCP_OFFLOAD_RECEIVE_RETURN_HANDLER TcpOffloadReceiveReturnHandler; - -} NDIS_PROVIDER_CHIMNEY_OFFLOAD_TCP_CHARACTERISTICS, *PNDIS_PROVIDER_CHIMNEY_OFFLOAD_TCP_CHARACTERISTICS; - - - -// -// Generic offload functions supported by NDIS for use by the miniport. -// -EXPORT -VOID -NdisMInitiateOffloadComplete( - IN NDIS_HANDLE NdisMiniportHandle, - IN PNDIS_MINIPORT_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -EXPORT -VOID -NdisMTerminateOffloadComplete( - IN NDIS_HANDLE NdisMiniportHandle, - IN PNDIS_MINIPORT_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -EXPORT -VOID -NdisMInvalidateOffloadComplete( - IN NDIS_HANDLE NdisMiniportHandle, - IN PNDIS_MINIPORT_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -EXPORT -VOID -NdisMUpdateOffloadComplete( - IN NDIS_HANDLE NdisMiniportHandle, - IN PNDIS_MINIPORT_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -EXPORT -VOID -NdisMQueryOffloadStateComplete( - IN NDIS_HANDLE NdisMiniportHandle, - IN PNDIS_MINIPORT_OFFLOAD_BLOCK_LIST OffloadBlockList - ); - -// -// Generic offload event indication handlers. -// -EXPORT -VOID -NdisMOffloadEventIndicate( - IN NDIS_HANDLE NdisMiniportHandle, - IN PNDIS_MINIPORT_OFFLOAD_BLOCK_LIST OffloadBlockList, - IN ULONG IndicationCode - ); - -// -// Tcp offload specific functions supported by NDIS used for completions. -// -typedef -VOID -(*NDIS_TCP_OFFLOAD_SEND_COMPLETE)( - IN NDIS_HANDLE NdisMiniportHandle, - IN PNET_BUFFER_LIST NetBufferList - ); - -typedef -VOID -(*NDIS_TCP_OFFLOAD_RECEIVE_COMPLETE)( - IN NDIS_HANDLE NdisMiniportHandle, - IN PNET_BUFFER_LIST NetBufferList - ); - -typedef -VOID -(*NDIS_TCP_OFFLOAD_DISCONNECT_COMPLETE)( - IN NDIS_HANDLE NdisMiniportHandle, - IN PNET_BUFFER_LIST NetBufferList - ); - -typedef -VOID -(*NDIS_TCP_OFFLOAD_FORWARD_COMPLETE)( - IN NDIS_HANDLE NdisMiniportHandle, - IN PNET_BUFFER_LIST NetBufferList - ); - -// -// Tcp offload specific functions supported by NDIS used for indication. -// -typedef -VOID -(*NDIS_TCP_OFFLOAD_EVENT_INDICATE)( - IN NDIS_HANDLE NdisOffloadHandle, - IN ULONG EventType, - IN ULONG EventSpecificInformation - ); - -typedef -NDIS_STATUS -(*NDIS_TCP_OFFLOAD_RECEIVE_INDICATE)( - IN NDIS_HANDLE NdisOffloadHandle, - IN PNET_BUFFER_LIST NetBufferList, - IN NDIS_STATUS Status, - OUT PULONG BytesConsumed - ); - -typedef struct _NDIS_OFFLOAD_EVENT_HANDLERS -{ - NDIS_OBJECT_HEADER Header; -} NDIS_OFFLOAD_EVENT_HANDLERS, *PNDIS_OFFLOAD_EVENT_HANDLERS; - - -EXPORT -NDIS_STATUS -NdisMGetOffloadHandlers( - IN NDIS_HANDLE NdisMiniportHandle, - IN NDIS_CHIMNEY_OFFLOAD_TYPE ChimneyType, - OUT PNDIS_OFFLOAD_EVENT_HANDLERS *OffloadHandlers - ); - - -#define NDIS_OBJECT_TCP_OFFLOAD_REVISION_1 1 - -typedef struct _NDIS_TCP_OFFLOAD_EVENT_HANDLERS -{ - NDIS_OBJECT_HEADER Header; - NDIS_TCP_OFFLOAD_EVENT_INDICATE NdisTcpOffloadEventHandler; - NDIS_TCP_OFFLOAD_RECEIVE_INDICATE NdisTcpOffloadReceiveHandler; - NDIS_TCP_OFFLOAD_SEND_COMPLETE NdisTcpOffloadSendComplete; - NDIS_TCP_OFFLOAD_RECEIVE_COMPLETE NdisTcpOffloadReceiveComplete; - NDIS_TCP_OFFLOAD_DISCONNECT_COMPLETE NdisTcpOffloadDisconnectComplete; - NDIS_TCP_OFFLOAD_FORWARD_COMPLETE NdisTcpOffloadForwardComplete; -} NDIS_TCP_OFFLOAD_EVENT_HANDLERS, *PNDIS_TCP_OFFLOAD_EVENT_HANDLERS; - -#define NDIS_SIZEOF_TCP_OFFLOAD_EVENT_HANDLERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NDIS_TCP_OFFLOAD_EVENT_HANDLERS, NdisTcpOffloadForwardComplete) - -#endif //#if (defined(NDIS60) || NDIS_WRAPPER || defined(NDIS61)) -#endif //_CHIMNEY_OFFLOAD - - diff --git a/pub/ddk/ndisguid.h b/pub/ddk/ndisguid.h deleted file mode 100644 index 3fa41a0..0000000 --- a/pub/ddk/ndisguid.h +++ /dev/null @@ -1,278 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ndisguid.h - -Abstract: - - GUID definitions for NDIS objects. - -Environment: - - User/Kernel mode - -Revision History: - ---*/ - -#pragma once - - -// -// Guid for Lan Class. -// -DEFINE_GUID(GUID_NDIS_LAN_CLASS, 0xad498944, 0x762f, 0x11d0, 0x8d, 0xcb, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_DEVINTERFACE_NET, 0xcac88484, 0x7515, 0x4c03, 0x82, 0xe6, 0x71, 0xa8, 0x7a, 0xba, 0xc3, 0x61); -DEFINE_GUID(UNSPECIFIED_NETWORK_GUID, 0x12ba5bde, 0x143e, 0x4c0d, 0xb6, 0x6d, 0x23, 0x79, 0xbb, 0x14, 0x19, 0x13); - -// -// NDIS global GUIDs -// -DEFINE_GUID(GUID_NDIS_ENUMERATE_ADAPTER, 0x981f2d7f, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_NOTIFY_ADAPTER_REMOVAL, 0x981f2d80, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_NOTIFY_ADAPTER_ARRIVAL, 0x981f2d81, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_ENUMERATE_VC, 0x981f2d82, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_NOTIFY_VC_REMOVAL, 0x981f2d79, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_NOTIFY_VC_ARRIVAL, 0x182f9e0c, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_NOTIFY_BIND, 0x5413531c, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_NOTIFY_UNBIND, 0x6e3ce1ec, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_WAKE_ON_MAGIC_PACKET_ONLY, 0xa14f1c97, 0x8839, 0x4f8a, 0x99, 0x96, 0xa2, 0x89, 0x96, 0xeb, 0xbf, 0x1d); -DEFINE_GUID(GUID_NDIS_NOTIFY_DEVICE_POWER_ON, 0x5f81cfd0, 0xf046, 0x4342, 0xaf, 0x61, 0x89, 0x5a, 0xce, 0xda, 0xef, 0xd9); -DEFINE_GUID(GUID_NDIS_NOTIFY_DEVICE_POWER_OFF, 0x81bc8189, 0xb026, 0x46ab, 0xb9, 0x64, 0xf1, 0x82, 0xe3, 0x42, 0x93, 0x4e); - -DEFINE_GUID(GUID_NDIS_NOTIFY_FILTER_REMOVAL, 0x1f177cd9, 0x5955, 0x4721, 0x9f, 0x6a, 0x78, 0xeb, 0xdf, 0xae, 0xf8, 0x89); -DEFINE_GUID(GUID_NDIS_NOTIFY_FILTER_ARRIVAL, 0x0b6d3c89, 0x5917, 0x43ca, 0xb5, 0x78, 0xd0, 0x1a, 0x79, 0x67, 0xc4, 0x1c); - -DEFINE_GUID(GUID_NDIS_NOTIFY_DEVICE_POWER_ON_EX, 0x2b440188, 0x92ac, 0x4f60, 0x9b, 0x2d, 0x20, 0xa3, 0x0c, 0xbb, 0x6b, 0xbe); -DEFINE_GUID(GUID_NDIS_NOTIFY_DEVICE_POWER_OFF_EX, 0x4159353c, 0x5cd7, 0x42ce, 0x8f, 0xe4, 0xa4, 0x5a, 0x23, 0x80, 0xcc, 0x4f); - -// {1528D111-708A-4ca4-9215-C05771161CDA} - used with NDIS_WMI_PM_ADMIN_CONFIG -DEFINE_GUID(GUID_NDIS_PM_ADMIN_CONFIG, 0x1528d111, 0x708a, 0x4ca4, 0x92, 0x15, 0xc0, 0x57, 0x71, 0x16, 0x1c, 0xda); -// {B2CF76E3-B3AE-4394-A01F-338C9870E939} - use with NDIS_WMI_PM_ACTIVE_CAPABILITIES -DEFINE_GUID(GUID_NDIS_PM_ACTIVE_CAPABILITIES, 0xb2cf76e3, 0xb3ae, 0x4394, 0xa0, 0x1f, 0x33, 0x8c, 0x98, 0x70, 0xe9, 0x39); - -DEFINE_GUID(GUID_NDIS_RSS_ENABLED, 0x9565cd55, 0x3402, 0x4e32, 0xa5, 0xb6, 0x2f, 0x14, 0x3f, 0x2f, 0x2c, 0x30); - -// -// GUIDs for General OIDs -// -DEFINE_GUID(GUID_NDIS_GEN_HARDWARE_STATUS, 0x5ec10354, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_MEDIA_SUPPORTED, 0x5ec10355, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_MEDIA_IN_USE, 0x5ec10356, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_MAXIMUM_LOOKAHEAD, 0x5ec10357, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_MAXIMUM_FRAME_SIZE, 0x5ec10358, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_LINK_SPEED, 0x5ec10359, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_TRANSMIT_BUFFER_SPACE, 0x5ec1035a, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_RECEIVE_BUFFER_SPACE, 0x5ec1035b, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_TRANSMIT_BLOCK_SIZE, 0x5ec1035c, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_RECEIVE_BLOCK_SIZE, 0x5ec1035d, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_VENDOR_ID, 0x5ec1035e, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_VENDOR_DESCRIPTION, 0x5ec1035f, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CURRENT_PACKET_FILTER, 0x5ec10360, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CURRENT_LOOKAHEAD, 0x5ec10361, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_DRIVER_VERSION, 0x5ec10362, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_MAXIMUM_TOTAL_SIZE, 0x5ec10363, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_MAC_OPTIONS, 0x5ec10365, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_MEDIA_CONNECT_STATUS, 0x5ec10366, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_MAXIMUM_SEND_PACKETS, 0x5ec10367, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_VENDOR_DRIVER_VERSION, 0x447956f9, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_VLAN_ID, 0x765dc702, 0xc5e8, 0x4b67, 0x84, 0x3b, 0x3f, 0x5a, 0x4f, 0xf2, 0x64, 0x8b); -DEFINE_GUID(GUID_NDIS_GEN_PHYSICAL_MEDIUM, 0x418ca16d, 0x3937, 0x4208, 0x94, 0x0a, 0xec, 0x61, 0x96, 0x27, 0x80, 0x85); -DEFINE_GUID(GUID_NDIS_TCP_OFFLOAD_CURRENT_CONFIG, 0x68542fed, 0x5c74, 0x461e, 0x89, 0x34, 0x91, 0xc6, 0xf9, 0xc6, 0x09, 0x60); // uses NDIS_OFFLOAD -DEFINE_GUID(GUID_NDIS_TCP_OFFLOAD_HARDWARE_CAPABILITIES, 0xcd5f1102, 0x590f, 0x4ada, 0xab, 0x65, 0x5b, 0x31, 0xb1, 0xdc, 0x01, 0x72); // uses NDIS_OFFLOAD -DEFINE_GUID(GUID_NDIS_TCP_OFFLOAD_PARAMETERS, 0x8ead9a22, 0x7f69, 0x4bc6, 0x94, 0x9a, 0xc8, 0x18, 0x7b, 0x07, 0x4e, 0x61); // uses NDIS_OFFLOAD_PARAMETERS -DEFINE_GUID(GUID_NDIS_TCP_CONNECTION_OFFLOAD_CURRENT_CONFIG, 0x2ee6aef1, 0x0851, 0x458b, 0xbf, 0x0d, 0x79, 0x23, 0x43, 0xd1, 0xcd, 0xe1); // uses NDIS_TCP_CONNECTION_OFFLOAD -DEFINE_GUID(GUID_NDIS_TCP_CONNECTION_OFFLOAD_HARDWARE_CAPABILITIES, 0x8ce71f2c, 0xd63a, 0x4390, 0xa4, 0x87, 0x18, 0xfa, 0x47, 0x26, 0x2c, 0xeb); // uses NDIS_TCP_CONNECTION_OFFLOAD -DEFINE_GUID(GUID_NDIS_RECEIVE_SCALE_CAPABILITIES, 0x26c28774, 0x4252, 0x48fe, 0xa6, 0x10, 0xa5, 0x8a, 0x39, 0x8c, 0x0e, 0xb1); - - -DEFINE_GUID(GUID_NDIS_GEN_LINK_STATE, 0xba1f4c14, 0xa945, 0x4762, 0xb9, 0x16, 0x0b, 0x55, 0x15, 0xb6, 0xf4, 0x3a); -DEFINE_GUID(GUID_NDIS_GEN_LINK_PARAMETERS, 0x8c7d3579, 0x252b, 0x4614, 0x82, 0xc5, 0xa6, 0x50, 0xda, 0xa1, 0x50, 0x49); -DEFINE_GUID(GUID_NDIS_GEN_STATISTICS, 0x368c45b5, 0xc129, 0x43c1, 0x93, 0x9e, 0x7e, 0xdc, 0x2d, 0x7f, 0xe6, 0x21); -DEFINE_GUID(GUID_NDIS_GEN_PORT_STATE, 0x6fbf2a5f, 0x8b8f, 0x4920, 0x81, 0x43, 0xe6, 0xc4, 0x60, 0xf5, 0x25, 0x24); -DEFINE_GUID(GUID_NDIS_GEN_ENUMERATE_PORTS, 0xf1d6abe8, 0x15e4, 0x4407, 0x81, 0xb7, 0x6b, 0x83, 0x0c, 0x77, 0x7c, 0xd9); -DEFINE_GUID(GUID_NDIS_ENUMERATE_ADAPTERS_EX, 0x16716917, 0x4306, 0x4be4, 0x9b, 0x5a, 0x38, 0x09, 0xae, 0x44, 0xb1, 0x25); -DEFINE_GUID(GUID_NDIS_GEN_PORT_AUTHENTICATION_PARAMETERS, 0xaab6ac31, 0x86fb, 0x48fb, 0x8b, 0x48, 0x63, 0xdb, 0x23, 0x5a, 0xce, 0x16); -DEFINE_GUID(GUID_NDIS_GEN_INTERRUPT_MODERATION, 0xd9c8eea5, 0xf16e, 0x467c, 0x84, 0xd5, 0x63, 0x45, 0xa2, 0x2c, 0xe2, 0x13); -DEFINE_GUID(GUID_NDIS_GEN_INTERRUPT_MODERATION_PARAMETERS, 0xd789adfa, 0x9c56, 0x433b, 0xad, 0x01, 0x75, 0x74, 0xf3, 0xce, 0xdb, 0xe9); -DEFINE_GUID(GUID_NDIS_GEN_PCI_DEVICE_CUSTOM_PROPERTIES, 0xaa39f5ab, 0xe260,0x4d01, 0x82, 0xb0, 0xb7, 0x37, 0xc8, 0x80, 0xea, 0x05); -DEFINE_GUID(GUID_NDIS_GEN_PHYSICAL_MEDIUM_EX, 0x899e7782, 0x035b,0x43f9, 0x8b, 0xb6, 0x2b, 0x58, 0x97, 0x16, 0x12, 0xe5); -DEFINE_GUID(GUID_NDIS_HD_SPLIT_CURRENT_CONFIG, 0x81d1303c, 0xab00, 0x4e49, 0x80, 0xb1, 0x5e, 0x6e, 0x0b, 0xf9, 0xbe, 0x53); // uses NDIS_HD_SPLIT_CURRENT_CONFIGURATION -DEFINE_GUID(GUID_NDIS_HD_SPLIT_PARAMETERS, 0x8c048bea, 0x2913, 0x4458, 0xb6, 0x8e, 0x17, 0xf6, 0xc1, 0xe5, 0xc6, 0x0e); // uses NDIS_HD_SPLIT_PARAMETERS - - -// {ece5360d-3291-4a6e-8044-00511fed27ee} - uses NDIS_PM_CAPABILITIES -DEFINE_GUID(GUID_PM_HARDWARE_CAPABILITIES, 0xece5360d, 0x3291, 0x4a6e, 0x80, 0x44, 0x00, 0x51, 0x1f, 0xed, 0x27, 0xee); -// {3ABDBD14-D44A-4a3f-9A63-A0A42A51B131} - uses NDIS_PM_CAPABILITIES -DEFINE_GUID(GUID_PM_CURRENT_CAPABILITIES, 0x3abdbd14, 0xd44a, 0x4a3f, 0x9a, 0x63, 0xa0, 0xa4, 0x2a, 0x51, 0xb1, 0x31); -// {560245D2-E251-409c-A280-311935BE3B28} - use NDIS_PM_PARAMETERS -DEFINE_GUID(GUID_PM_PARAMETERS, 0x560245d2, 0xe251, 0x409c, 0xa2, 0x80, 0x31, 0x19, 0x35, 0xbe, 0x3b, 0x28); -// {6FC83BA7-52BC-4faa-AC51-7D2FFE63BA90} - use NDIS_PM_WOL_PATTERN -DEFINE_GUID(GUID_PM_ADD_WOL_PATTERN, 0x6fc83ba7, 0x52bc, 0x4faa, 0xac, 0x51, 0x7d, 0x2f, 0xfe, 0x63, 0xba, 0x90); -// {A037A915-C6CA-4322-B3E3-EF754EC498DC} -DEFINE_GUID(GUID_PM_REMOVE_WOL_PATTERN, 0xa037a915, 0xc6ca, 0x4322, 0xb3, 0xe3, 0xef, 0x75, 0x4e, 0xc4, 0x98, 0xdc); -// {4022BE37-7EE2-47be-A5A5-050FC79AFC75} -DEFINE_GUID(GUID_PM_WOL_PATTERN_LIST, 0x4022be37, 0x7ee2, 0x47be, 0xa5, 0xa5, 0x05, 0x0f, 0xc7, 0x9a, 0xfc, 0x75); -// {0C06C112-0D93-439b-9E6D-26BE130C9784} - uses NDIS_PM_PROTOCOL_OFFLOAD -DEFINE_GUID(GUID_PM_ADD_PROTOCOL_OFFLOAD, 0x0c06c112, 0x0d93, 0x439b, 0x9e, 0x6d, 0x26, 0xbe, 0x13, 0x0c, 0x97, 0x84); -// {A6435CD9-149F-498e-951B-2D94BEA3E3A3} - uses NDIS_PM_PROTOCOL_OFFLOAD -DEFINE_GUID(GUID_PM_GET_PROTOCOL_OFFLOAD, 0xa6435cd9, 0x149f, 0x498e, 0x95, 0x1b, 0x2d, 0x94, 0xbe, 0xa3, 0xe3, 0xa3); -// {DECD7BE2-A6B0-43ca-AE45-D000D20E5265} -DEFINE_GUID(GUID_PM_REMOVE_PROTOCOL_OFFLOAD, 0xdecd7be2, 0xa6b0, 0x43ca, 0xae, 0x45, 0xd0, 0x00, 0xd2, 0x0e, 0x52, 0x65); -// {736EC5AB-CA8F-4043-BB58-DA402A48D9CC} -DEFINE_GUID(GUID_PM_PROTOCOL_OFFLOAD_LIST, 0x736ec5ab, 0xca8f, 0x4043, 0xbb, 0x58, 0xda, 0x40, 0x2a, 0x48, 0xd9, 0xcc); - -// -// GUIDs for receive filters -// -DEFINE_GUID(GUID_NDIS_RECEIVE_FILTER_HARDWARE_CAPABILITIES, 0x3f2c1419, 0x83bc, 0x11dd, 0x94, 0xb8, 0x00, 0x1d, 0x09, 0x16, 0x2b, 0xc3); // uses NDIS_RECEIVE_FILTER_CAPABILITIES -DEFINE_GUID(GUID_NDIS_RECEIVE_FILTER_GLOBAL_PARAMETERS, 0x3f2c141a, 0x83bc, 0x11dd, 0x94, 0xb8, 0x00, 0x1d, 0x09, 0x16, 0x2b, 0xc3); // uses NDIS_RECEIVE_FILTER_GLOBAL_PARAMETERS -DEFINE_GUID(GUID_NDIS_RECEIVE_FILTER_ENUM_QUEUES, 0x3f2c141b, 0x83bc, 0x11dd, 0x94, 0xb8, 0x00, 0x1d, 0x09, 0x16, 0x2b, 0xc3); // uses NDIS_RECEIVE_QUEUE_INFO_ARRAY -DEFINE_GUID(GUID_NDIS_RECEIVE_FILTER_QUEUE_PARAMETERS, 0x3f2c141c, 0x83bc, 0x11dd, 0x94, 0xb8, 0x00, 0x1d, 0x09, 0x16, 0x2b, 0xc3); // uses NDIS_RECEIVE_QUEUE_PARAMETERS -DEFINE_GUID(GUID_NDIS_RECEIVE_FILTER_ENUM_FILTERS, 0x3f2c141d, 0x83bc, 0x11dd, 0x94, 0xb8, 0x00, 0x1d, 0x09, 0x16, 0x2b, 0xc3); // uses NDIS_RECEIVE_FILTER_INFO_ARRAY -DEFINE_GUID(GUID_NDIS_RECEIVE_FILTER_PARAMETERS, 0x3f2c141e, 0x83bc, 0x11dd, 0x94, 0xb8, 0x00, 0x1d, 0x09, 0x16, 0x2b, 0xc3); // uses NDIS_RECEIVE_FILTER_PARAMETERS -DEFINE_GUID(GUID_RECEIVE_FILTER_CURRENT_CAPABILITIES, 0x4054e80f, 0x2bc1, 0x4ccc, 0xb0, 0x33, 0x4a, 0xbc, 0x0c, 0x4a, 0x1e, 0x8c); // uses RECEIVE_FILTER_CAPABILITIES -DEFINE_GUID(GUID_NIC_SWITCH_HARDWARE_CAPABILITIES, 0x37cab40c, 0xd1e8, 0x4301, 0x8c, 0x1d, 0x58, 0x46, 0x5e, 0x0c, 0x4c, 0x0f); // uses NIC_SWITCH_CAPABILITIES -DEFINE_GUID(GUID_NIC_SWITCH_CURRENT_CAPABILITIES, 0xe76fdaf3, 0x0be7, 0x4d95, 0x87, 0xe9, 0x5a, 0xea, 0xd4, 0xb5, 0x90, 0xe9); // uses NIC_SWITCH_CAPABILITIES -// -// GUIDs for General Required Statistics OIDs -// -DEFINE_GUID(GUID_NDIS_GEN_XMIT_OK, 0x447956fa, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_RCV_OK, 0x447956fb, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_XMIT_ERROR, 0x447956fc, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_RCV_ERROR, 0x447956fd, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_RCV_NO_BUFFER, 0x447956fe, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); - -// -// GUIDs for General Required CO-NDIS OIDs -// -DEFINE_GUID(GUID_NDIS_GEN_CO_HARDWARE_STATUS, 0x791ad192, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_MEDIA_SUPPORTED, 0x791ad193, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_MEDIA_IN_USE, 0x791ad194, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_LINK_SPEED, 0x791ad195, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_VENDOR_ID, 0x791ad196, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_VENDOR_DESCRIPTION, 0x791ad197, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_DRIVER_VERSION, 0x791ad198, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_MAC_OPTIONS, 0x791ad19a, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_MEDIA_CONNECT_STATUS, 0x791ad19b, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_VENDOR_DRIVER_VERSION, 0x791ad19c, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_MINIMUM_LINK_SPEED, 0x791ad19d, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); - -// -// GUIDs for General Required CO-NDIS Statistics OIDs -// -DEFINE_GUID(GUID_NDIS_GEN_CO_XMIT_PDUS_OK, 0x0a214805, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_RCV_PDUS_OK, 0x0a214806, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_XMIT_PDUS_ERROR, 0x0a214807, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_RCV_PDUS_ERROR, 0x0a214808, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_GEN_CO_RCV_PDUS_NO_BUFFER, 0x0a214809, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); - -// -// GUIDs for Required Ethernet OIDs -// -DEFINE_GUID(GUID_NDIS_802_3_PERMANENT_ADDRESS, 0x447956ff, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_3_CURRENT_ADDRESS, 0x44795700, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_3_MULTICAST_LIST, 0x44795701, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_3_MAXIMUM_LIST_SIZE, 0x44795702, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_3_MAC_OPTIONS, 0x44795703, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); - -// -// GUIDs for Required Ethernet Statistics OIDs -// -DEFINE_GUID(GUID_NDIS_802_3_RCV_ERROR_ALIGNMENT, 0x44795704, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_3_XMIT_ONE_COLLISION, 0x44795705, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_3_XMIT_MORE_COLLISIONS, 0x44795706, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); - -// -// GUIDs for Required Token-Ring OIDs -// -DEFINE_GUID(GUID_NDIS_802_5_PERMANENT_ADDRESS, 0x44795707, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_5_CURRENT_ADDRESS, 0x44795708, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_5_CURRENT_FUNCTIONAL, 0x44795709, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_5_CURRENT_GROUP, 0x4479570a, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_5_LAST_OPEN_STATUS, 0x4479570b, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_5_CURRENT_RING_STATUS, 0x890a36ec, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_5_CURRENT_RING_STATE, 0xacf14032, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); - -// -// GUIDs for Required Token-Ring Statistics OIDs -// -DEFINE_GUID(GUID_NDIS_802_5_LINE_ERRORS, 0xacf14033, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_802_5_LOST_FRAMES, 0xacf14034, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); - -// -// GUIDs for required and optional 802.11 Wireless LAN OIDs -// -DEFINE_GUID(GUID_NDIS_802_11_BSSID, 0x2504b6c2, 0x1fa5, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_SSID, 0x7d2a90ea, 0x2041, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_NETWORK_TYPES_SUPPORTED, 0x8531d6e6, 0x2041, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_NETWORK_TYPE_IN_USE, 0x857e2326, 0x2041, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_POWER_MODE, 0x85be837c, 0x2041, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_TX_POWER_LEVEL, 0x11e6ba76, 0x2053, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_RSSI, 0x1507db16, 0x2053, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_RSSI_TRIGGER, 0x155689b8, 0x2053, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_BSSID_LIST, 0x69526f9a, 0x2062, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_INFRASTRUCTURE_MODE, 0x697d5a7e, 0x2062, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_FRAGMENTATION_THRESHOLD, 0x69aaa7c4, 0x2062, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_RTS_THRESHOLD, 0x0134d07e, 0x2064, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_NUMBER_OF_ANTENNAS, 0x01779336, 0x2064, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_RX_ANTENNA_SELECTED, 0x01ac07a2, 0x2064, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_TX_ANTENNA_SELECTED, 0x01dbb74a, 0x2064, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_SUPPORTED_RATES, 0x49db8722, 0x2068, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_DESIRED_RATES, 0x452ee08e, 0x2536, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_CONFIGURATION, 0x4a4df982, 0x2068, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_STATISTICS, 0x42bb73b0, 0x2129, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_ADD_WEP, 0x4307bff0, 0x2129, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_REMOVE_WEP, 0x433c345c, 0x2129, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_DISASSOCIATE, 0x43671f40, 0x2129, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_AUTHENTICATION_MODE, 0x43920a24, 0x2129, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_PRIVACY_FILTER, 0x6733c4e9, 0x4792, 0x11d4, 0x97, 0xf1, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03); -DEFINE_GUID(GUID_NDIS_802_11_BSSID_LIST_SCAN, 0x0d9e01e1, 0xba70, 0x11d4, 0xb6, 0x75, 0x00, 0x20, 0x48, 0x57, 0x03, 0x37); -DEFINE_GUID(GUID_NDIS_802_11_WEP_STATUS, 0xb027a21f, 0x3cfa, 0x4125, 0x80, 0x0b, 0x3f, 0x7a, 0x18, 0xfd, 0xdc, 0xdc); -DEFINE_GUID(GUID_NDIS_802_11_RELOAD_DEFAULTS, 0x748b14e8, 0x32ee, 0x4425, 0xb9, 0x1b, 0xc9, 0x84, 0x8c, 0x58, 0xb5, 0x5a); -DEFINE_GUID(GUID_NDIS_802_11_ADD_KEY, 0xab8b5a62, 0x1d51, 0x49d8, 0xba, 0x5c, 0xfa, 0x98, 0x0b, 0xe0, 0x3a, 0x1d); -DEFINE_GUID(GUID_NDIS_802_11_REMOVE_KEY, 0x73cb28e9, 0x3188, 0x42d5, 0xb5, 0x53, 0xb2, 0x12, 0x37, 0xe6, 0x08, 0x8c); -DEFINE_GUID(GUID_NDIS_802_11_ASSOCIATION_INFORMATION, 0xa08d4dd0, 0x960e, 0x40bd, 0x8c, 0xf6, 0xc5, 0x38, 0xaf, 0x98, 0xf2, 0xe3); -DEFINE_GUID(GUID_NDIS_802_11_TEST, 0x4b9ca16a, 0x6a60, 0x4e9d, 0x92, 0x0c, 0x63, 0x35, 0x95, 0x3f, 0xa0, 0xb5); -DEFINE_GUID(GUID_NDIS_802_11_MEDIA_STREAM_MODE, 0x0a56af66, 0xd84b, 0x49eb, 0xa2, 0x8d, 0x52, 0x82, 0xcb, 0xb6, 0xd0, 0xcd); - -// -// GUIDs for NDIS status indications -// - -DEFINE_GUID(GUID_NDIS_STATUS_RESET_START, 0x981f2d76, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_STATUS_RESET_END, 0x981f2d77, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_STATUS_MEDIA_CONNECT, 0x981f2d7d, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_STATUS_MEDIA_DISCONNECT, 0x981f2d7e, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_STATUS_MEDIA_SPECIFIC_INDICATION, 0x981f2d84, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_STATUS_LINK_SPEED_CHANGE, 0x981f2d85, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c); -DEFINE_GUID(GUID_NDIS_STATUS_PACKET_FILTER, 0xd47c5407, 0x2e75, 0x46dd, 0x81, 0x46, 0x1d, 0x7e, 0xd2, 0xd6, 0xab, 0x1d); -DEFINE_GUID(GUID_NDIS_STATUS_NETWORK_CHANGE, 0xca8a56f9, 0xce81, 0x40e6, 0xa7, 0x0f, 0xa0, 0x67,0xa4,0x76, 0xe9, 0xe9); -DEFINE_GUID(GUID_NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG, 0x45049fc6, 0x54d8, 0x40c8, 0x9c, 0x3d, 0xb0, 0x11, 0xc4, 0xe7, 0x15, 0xbc); // NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG -DEFINE_GUID(GUID_NDIS_STATUS_TASK_OFFLOAD_HARDWARE_CAPABILITIES, 0xb6b8158b, 0x217c, 0x4b2a, 0xbe, 0x86, 0x6a, 0x04, 0xbe, 0xea, 0x65, 0xb8); // NDIS_STATUS_TASK_OFFLOAD_HARDWARE_CAPABILITIES -DEFINE_GUID(GUID_NDIS_STATUS_TCP_CONNECTION_OFFLOAD_CURRENT_CONFIG, 0xf8edaeff, 0x24e4, 0x4ae6, 0xa4, 0x13, 0x0b, 0x27, 0xf7, 0x6b, 0x24, 0x3d); // NDIS_STATUS_OFFLOAD_RESUME -DEFINE_GUID(GUID_NDIS_STATUS_TCP_CONNECTION_OFFLOAD_HARDWARE_CAPABILITIES, 0x391969b6, 0x402c, 0x43bf, 0x89, 0x22, 0x39, 0xea, 0xe0, 0xda, 0x1b, 0xb5); // NDIS_STATUS_TCP_CONNECTION_OFFLOAD_HARDWARE_CAPABILITIES - -DEFINE_GUID(GUID_NDIS_STATUS_OPER_STATUS, 0xf917b663, 0x845e, 0x4d3d, 0xb6, 0xd4, 0x15, 0xeb, 0x27, 0xaf, 0x81, 0xc5); -DEFINE_GUID(GUID_NDIS_STATUS_LINK_STATE, 0x64c6f797, 0x878c, 0x4311, 0x92, 0x46, 0x65, 0xdb, 0xa8, 0x9c, 0x3a, 0x61); -DEFINE_GUID(GUID_NDIS_STATUS_PORT_STATE, 0x1dac0dfe, 0x43e5, 0x44b7, 0xb7, 0x59, 0x7b, 0xf4, 0x6d, 0xe3, 0x2e, 0x81); -DEFINE_GUID(GUID_STATUS_MEDIA_SPECIFIC_INDICATION_EX, 0xaaacfca7, 0x954a, 0x4632, 0xa1, 0x6e, 0xa8, 0xa6, 0x37, 0x93, 0xa9, 0xe5); -DEFINE_GUID(GUID_NDIS_STATUS_HD_SPLIT_CURRENT_CONFIG, 0x6c744b0e, 0xee9c, 0x4205, 0x90, 0xa2, 0x01, 0x5f, 0x6d, 0x65, 0xf4, 0x03); // NDIS_STATUS_HD_SPLIT_CURRENT_CONFIG - -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_SCAN_CONFIRM, 0x8500591e, 0xa0c7, 0x4efb, 0x93, 0x42, 0xb6, 0x74, 0xb0, 0x02, 0xcb, 0xe6); -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_MPDU_MAX_LENGTH_CHANGED, 0x1d6560ec, 0x8e48, 0x4a3e, 0x9f, 0xd5, 0xa0, 0x1b, 0x69, 0x8d, 0xb6, 0xc5); -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_ASSOCIATION_START, 0x3927843b, 0x6980, 0x4b48, 0xb1, 0x5b, 0x4d, 0xe5, 0x09, 0x77, 0xac, 0x40); -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_ASSOCIATION_COMPLETION, 0x458bbea7, 0x45a4, 0x4ae2, 0xb1, 0x76, 0xe5, 0x1f, 0x96, 0xfc, 0x05, 0x68); -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_CONNECTION_START, 0x7b74299d, 0x998f, 0x4454, 0xad, 0x08, 0xc5, 0xaf, 0x28, 0x57, 0x6d, 0x1b); -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_CONNECTION_COMPLETION, 0x96efd9c9, 0x7f1b, 0x4a89, 0xbc, 0x04, 0x3e, 0x9e, 0x27, 0x17, 0x65, 0xf1); -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_ROAMING_START, 0xb2412d0d, 0x26c8, 0x4f4e, 0x93, 0xdf, 0xf7, 0xb7, 0x05, 0xa0, 0xb4, 0x33); -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_ROAMING_COMPLETION, 0xdd9d47d1, 0x282b, 0x41e4, 0xb9, 0x24, 0x66, 0x36, 0x88, 0x17, 0xfc, 0xd3); -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_DISASSOCIATION, 0x3fbeb6fc, 0x0fe2, 0x43fd, 0xb2, 0xad, 0xbd, 0x99, 0xb5, 0xf9, 0x3e, 0x13); -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_TKIPMIC_FAILURE, 0x442c2ae4, 0x9bc5, 0x4b90, 0xa8, 0x89, 0x45, 0x5e, 0xf2, 0x20, 0xf4, 0xee); -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_PMKID_CANDIDATE_LIST, 0x26d8b8f6, 0xdb82, 0x49eb, 0x8b, 0xf3, 0x4c, 0x13, 0x0e, 0xf0, 0x69, 0x50); -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_PHY_STATE_CHANGED, 0xdeb45316, 0x71b5, 0x4736, 0xbd, 0xef, 0x0a, 0x9e, 0x9f, 0x4e, 0x62, 0xdc); -DEFINE_GUID(GUID_NDIS_STATUS_DOT11_LINK_QUALITY, 0xa3285184, 0xea99, 0x48ed, 0x82, 0x5e, 0xa4, 0x26, 0xb1, 0x1c, 0x27, 0x54); - diff --git a/pub/ddk/ndistapi.h b/pub/ddk/ndistapi.h deleted file mode 100644 index 22f4712..0000000 --- a/pub/ddk/ndistapi.h +++ /dev/null @@ -1,1676 +0,0 @@ -/*++ BUILD Version: 0000 // Increment this if a change has global effects - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ndiswan.h - -Abstract: - - Main header file for the TAPI wrapper - - -Revision History: - ---*/ - -#ifndef _NDIS_TAPI_ -#define _NDIS_TAPI_ - -#pragma once - -// -// -// -// -// Begin definitions for TAPI -// -// -// -// - -#ifndef NDIS_TAPI_CURRENT_VERSION -#define NDIS_TAPI_CURRENT_VERSION 0x00010003 -#endif -// -// Symbolic constants -// - - -#define NDIS_STATUS_TAPI_ADDRESSBLOCKED ((NDIS_STATUS)0xC0012000L) -#define NDIS_STATUS_TAPI_BEARERMODEUNAVAIL ((NDIS_STATUS)0xC0012001L) -#define NDIS_STATUS_TAPI_CALLUNAVAIL ((NDIS_STATUS)0xC0012002L) -#define NDIS_STATUS_TAPI_DIALBILLING ((NDIS_STATUS)0xC0012003L) -#define NDIS_STATUS_TAPI_DIALDIALTONE ((NDIS_STATUS)0xC0012004L) -#define NDIS_STATUS_TAPI_DIALPROMPT ((NDIS_STATUS)0xC0012005L) -#define NDIS_STATUS_TAPI_DIALQUIET ((NDIS_STATUS)0xC0012006L) -#define NDIS_STATUS_TAPI_INCOMPATIBLEEXTVERSION ((NDIS_STATUS)0xC0012007L) -#define NDIS_STATUS_TAPI_INUSE ((NDIS_STATUS)0xC0012008L) -#define NDIS_STATUS_TAPI_INVALADDRESS ((NDIS_STATUS)0xC0012009L) -#define NDIS_STATUS_TAPI_INVALADDRESSID ((NDIS_STATUS)0xC001200AL) -#define NDIS_STATUS_TAPI_INVALADDRESSMODE ((NDIS_STATUS)0xC001200BL) -#define NDIS_STATUS_TAPI_INVALBEARERMODE ((NDIS_STATUS)0xC001200CL) -#define NDIS_STATUS_TAPI_INVALCALLHANDLE ((NDIS_STATUS)0xC001200DL) -#define NDIS_STATUS_TAPI_INVALCALLPARAMS ((NDIS_STATUS)0xC001200EL) -#define NDIS_STATUS_TAPI_INVALCALLSTATE ((NDIS_STATUS)0xC001200FL) -#define NDIS_STATUS_TAPI_INVALDEVICECLASS ((NDIS_STATUS)0xC0012010L) -#define NDIS_STATUS_TAPI_INVALLINEHANDLE ((NDIS_STATUS)0xC0012011L) -#define NDIS_STATUS_TAPI_INVALLINESTATE ((NDIS_STATUS)0xC0012012L) -#define NDIS_STATUS_TAPI_INVALMEDIAMODE ((NDIS_STATUS)0xC0012013L) -#define NDIS_STATUS_TAPI_INVALRATE ((NDIS_STATUS)0xC0012014L) -#define NDIS_STATUS_TAPI_NODRIVER ((NDIS_STATUS)0xC0012015L) -#define NDIS_STATUS_TAPI_OPERATIONUNAVAIL ((NDIS_STATUS)0xC0012016L) -#define NDIS_STATUS_TAPI_RATEUNAVAIL ((NDIS_STATUS)0xC0012017L) -#define NDIS_STATUS_TAPI_RESOURCEUNAVAIL ((NDIS_STATUS)0xC0012018L) -#define NDIS_STATUS_TAPI_STRUCTURETOOSMALL ((NDIS_STATUS)0xC0012019L) -#define NDIS_STATUS_TAPI_USERUSERINFOTOOBIG ((NDIS_STATUS)0xC001201AL) -#define NDIS_STATUS_TAPI_ALLOCATED ((NDIS_STATUS)0xC001201BL) -#define NDIS_STATUS_TAPI_INVALADDRESSSTATE ((NDIS_STATUS)0xC001201CL) -#define NDIS_STATUS_TAPI_INVALPARAM ((NDIS_STATUS)0xC001201DL) -#define NDIS_STATUS_TAPI_NODEVICE ((NDIS_STATUS)0xC001201EL) - -// -// The following DISCONNECTMODE status codes are used by CO_ADDRESS_FAMILY_TAPI -// NDIS Call Managers as the NDIS status passed to: -// -// - Ndis[M]CmMakeCallComplete -// - Ndis[M]CmDispatchIncomingCloseCall -// -#define NDIS_STATUS_TAPI_DISCONNECTMODE_NORMAL ((NDIS_STATUS)0xC0012020L) -#define NDIS_STATUS_TAPI_DISCONNECTMODE_UNKNOWN ((NDIS_STATUS)0xC0012021L) -#define NDIS_STATUS_TAPI_DISCONNECTMODE_REJECT ((NDIS_STATUS)0xC0012022L) -#define NDIS_STATUS_TAPI_DISCONNECTMODE_PICKUP ((NDIS_STATUS)0xC0012023L) -#define NDIS_STATUS_TAPI_DISCONNECTMODE_FORWARDED ((NDIS_STATUS)0xC0012024L) -#define NDIS_STATUS_TAPI_DISCONNECTMODE_BUSY ((NDIS_STATUS)0xC0012025L) -#define NDIS_STATUS_TAPI_DISCONNECTMODE_NOANSWER ((NDIS_STATUS)0xC0012026L) -#define NDIS_STATUS_TAPI_DISCONNECTMODE_BADADDRESS ((NDIS_STATUS)0xC0012027L) -#define NDIS_STATUS_TAPI_DISCONNECTMODE_UNREACHABLE ((NDIS_STATUS)0xC0012028L) -#define NDIS_STATUS_TAPI_DISCONNECTMODE_CONGESTION ((NDIS_STATUS)0xC0012029L) -#define NDIS_STATUS_TAPI_DISCONNECTMODE_INCOMPATIBLE ((NDIS_STATUS)0xC001202AL) -#define NDIS_STATUS_TAPI_DISCONNECTMODE_UNAVAIL ((NDIS_STATUS)0xC001202BL) - - -#define NDIS_STATUS_TAPI_RECV_DIGIT ((NDIS_STATUS)0x40010020L) // FIXME: Should this be in ndis.h? - -#define LINE_ADDRESSSTATE 0L -#define LINE_CALLINFO 1L -#define LINE_CALLSTATE 2L -#define LINE_CLOSE 3L -#define LINE_DEVSPECIFIC 4L -#define LINE_DEVSPECIFICFEATURE 5L // not used -#define LINE_GATHERDIGITS 6L // not used -#define LINE_GENERATE 7L // not used -#define LINE_LINEDEVSTATE 8L -#define LINE_MONITORDIGITS 9L // not used -#define LINE_MONITORMEDIA 10L // not used -#define LINE_MONITORTONE 11L // not used -#define LINE_REPLY 12L // not used -#define LINE_REQUEST 13L // not used -#define LINE_CREATE 19L // TAPI v1.4 - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) -#define LINE_AGENTSPECIFIC 21L // TAPI v2.0 -#define LINE_AGENTSTATUS 22L // TAPI v2.0 -#define LINE_APPNEWCALL 23L // TAPI v2.0 -#define LINE_PROXYREQUEST 24L // TAPI v2.0 -#define LINE_REMOVE 25L // TAPI v2.0 -#endif - - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020002) -#define LINE_AGENTSESSIONSTATUS 27L // TAPI v2.2 -#define LINE_QUEUESTATUS 28L // TAPI v2.2 -#define LINE_AGENTSTATUSEX 29L // TAPI v2.2 -#define LINE_GROUPSTATUS 30L // TAPI v2.2 -#define LINE_PROXYSTATUS 31L // TAPI v2.2 -#endif - - -#if (TAPI_CURRENT_VERSION >= 0x00030000) -#define LINE_APPNEWCALLHUB 32L // TAPI v3.0 -#define LINE_CALLHUBCLOSE 33L // TAPI v3.0 -#define LINE_DEVSPECIFICEX 34L // TAPI v3.0 -#endif - - -#define TSPI_MESSAGE_BASE 500L - -#define LINE_NEWCALL TSPI_MESSAGE_BASE -#define LINE_CALLDEVSPECIFIC (TSPI_MESSAGE_BASE + 1L) - -#ifndef __NDISTAPI_STRINGFORMATS_DEFINED -#define __NDISTAPI_STRINGFORMATS_DEFINED - -#define STRINGFORMAT_ASCII 0x00000001 -#define STRINGFORMAT_DBCS 0x00000002 -#define STRINGFORMAT_UNICODE 0x00000003 -#define STRINGFORMAT_BINARY 0x00000004 - -#endif // __NDISTAPI_STRINGFORMATS_DEFINED - -#define LINEADDRCAPFLAGS_FWDNUMRINGS 0x00000001 -#define LINEADDRCAPFLAGS_PICKUPGROUPID 0x00000002 -#define LINEADDRCAPFLAGS_SECURE 0x00000004 -#define LINEADDRCAPFLAGS_BLOCKIDDEFAULT 0x00000008 -#define LINEADDRCAPFLAGS_BLOCKIDOVERRIDE 0x00000010 -#define LINEADDRCAPFLAGS_DIALED 0x00000020 -#define LINEADDRCAPFLAGS_ORIGOFFHOOK 0x00000040 -#define LINEADDRCAPFLAGS_DESTOFFHOOK 0x00000080 -#define LINEADDRCAPFLAGS_FWDCONSULT 0x00000100 -#define LINEADDRCAPFLAGS_SETUPCONFNULL 0x00000200 -#define LINEADDRCAPFLAGS_AUTORECONNECT 0x00000400 -#define LINEADDRCAPFLAGS_COMPLETIONID 0x00000800 -#define LINEADDRCAPFLAGS_TRANSFERHELD 0x00001000 -#define LINEADDRCAPFLAGS_TRANSFERMAKE 0x00002000 -#define LINEADDRCAPFLAGS_CONFERENCEHELD 0x00004000 -#define LINEADDRCAPFLAGS_CONFERENCEMAKE 0x00008000 -#define LINEADDRCAPFLAGS_PARTIALDIAL 0x00010000 -#define LINEADDRCAPFLAGS_FWDSTATUSVALID 0x00020000 -#define LINEADDRCAPFLAGS_FWDINTEXTADDR 0x00040000 -#define LINEADDRCAPFLAGS_FWDBUSYNAADDR 0x00080000 -#define LINEADDRCAPFLAGS_ACCEPTTOALERT 0x00100000 -#define LINEADDRCAPFLAGS_CONFDROP 0x00200000 -#define LINEADDRCAPFLAGS_PICKUPCALLWAIT 0x00400000 -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) -#define LINEADDRCAPFLAGS_PREDICTIVEDIALER 0x00800000 // TAPI v2.0 -#define LINEADDRCAPFLAGS_QUEUE 0x01000000 // TAPI v2.0 -#define LINEADDRCAPFLAGS_ROUTEPOINT 0x02000000 // TAPI v2.0 -#define LINEADDRCAPFLAGS_HOLDMAKESNEW 0x04000000 // TAPI v2.0 -#define LINEADDRCAPFLAGS_NOINTERNALCALLS 0x08000000 // TAPI v2.0 -#define LINEADDRCAPFLAGS_NOEXTERNALCALLS 0x10000000 // TAPI v2.0 -#define LINEADDRCAPFLAGS_SETCALLINGID 0x20000000 // TAPI v2.0 -#endif -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000) -#define LINEADDRCAPFLAGS_ACDGROUP 0x40000000 // TAPI v3.0 -#define LINEADDRCAPFLAGS_NOPSTNADDRESSTRANSLATION 0x80000000 // TAPI v3.0 -#endif - - -#define LINEADDRESSMODE_ADDRESSID 0x00000001 -#define LINEADDRESSMODE_DIALABLEADDR 0x00000002 - -#define LINEADDRESSSHARING_PRIVATE 0x00000001 -#define LINEADDRESSSHARING_BRIDGEDEXCL 0x00000002 -#define LINEADDRESSSHARING_BRIDGEDNEW 0x00000004 -#define LINEADDRESSSHARING_BRIDGEDSHARED 0x00000008 -#define LINEADDRESSSHARING_MONITORED 0x00000010 - -#define LINEADDRESSSTATE_OTHER 0x00000001 -#define LINEADDRESSSTATE_DEVSPECIFIC 0x00000002 -#define LINEADDRESSSTATE_INUSEZERO 0x00000004 -#define LINEADDRESSSTATE_INUSEONE 0x00000008 -#define LINEADDRESSSTATE_INUSEMANY 0x00000010 -#define LINEADDRESSSTATE_NUMCALLS 0x00000020 -#define LINEADDRESSSTATE_FORWARD 0x00000040 -#define LINEADDRESSSTATE_TERMINALS 0x00000080 - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000) -#define LINEADDRESSTYPE_PHONENUMBER 0x00000001 -#define LINEADDRESSTYPE_SDP 0x00000002 -#define LINEADDRESSTYPE_EMAILNAME 0x00000004 -#define LINEADDRESSTYPE_DOMAINNAME 0x00000008 -#define LINEADDRESSTYPE_IPADDRESS 0x00000010 -#endif - -#define LINEADDRFEATURE_FORWARD 0x00000001 -#define LINEADDRFEATURE_MAKECALL 0x00000002 -#define LINEADDRFEATURE_PICKUP 0x00000004 -#define LINEADDRFEATURE_SETMEDIACONTROL 0x00000008 -#define LINEADDRFEATURE_SETTERMINAL 0x00000010 -#define LINEADDRFEATURE_SETUPCONF 0x00000020 -#define LINEADDRFEATURE_UNCOMPLETECALL 0x00000040 -#define LINEADDRFEATURE_UNPARK 0x00000080 -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) -#define LINEADDRFEATURE_PICKUPHELD 0x00000100 // TAPI v2.0 -#define LINEADDRFEATURE_PICKUPGROUP 0x00000200 // TAPI v2.0 -#define LINEADDRFEATURE_PICKUPDIRECT 0x00000400 // TAPI v2.0 -#define LINEADDRFEATURE_PICKUPWAITING 0x00000800 // TAPI v2.0 -#define LINEADDRFEATURE_FORWARDFWD 0x00001000 // TAPI v2.0 -#define LINEADDRFEATURE_FORWARDDND 0x00002000 // TAPI v2.0 -#endif - - -#define LINEANSWERMODE_NONE 0x00000001 -#define LINEANSWERMODE_DROP 0x00000002 -#define LINEANSWERMODE_HOLD 0x00000004 - -#define LINEBEARERMODE_VOICE 0x00000001 -#define LINEBEARERMODE_SPEECH 0x00000002 -#define LINEBEARERMODE_MULTIUSE 0x00000004 -#define LINEBEARERMODE_DATA 0x00000008 -#define LINEBEARERMODE_ALTSPEECHDATA 0x00000010 -#define LINEBEARERMODE_NONCALLSIGNALING 0x00000020 -#define LINEBEARERMODE_PASSTHROUGH 0x00000040 // TAPI v1.4 -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) -#define LINEBEARERMODE_RESTRICTEDDATA 0x00000080 // TAPI v2.0 -#endif - -#define LINEBUSYMODE_STATION 0x00000001 -#define LINEBUSYMODE_TRUNK 0x00000002 -#define LINEBUSYMODE_UNKNOWN 0x00000004 -#define LINEBUSYMODE_UNAVAIL 0x00000008 - -#define LINECALLCOMPLCOND_BUSY 0x00000001 -#define LINECALLCOMPLCOND_NOANSWER 0x00000002 - -#define LINECALLCOMPLMODE_CAMPON 0x00000001 -#define LINECALLCOMPLMODE_CALLBACK 0x00000002 -#define LINECALLCOMPLMODE_INTRUDE 0x00000004 -#define LINECALLCOMPLMODE_MESSAGE 0x00000008 - -#define LINECALLFEATURE_ACCEPT 0x00000001 -#define LINECALLFEATURE_ADDTOCONF 0x00000002 -#define LINECALLFEATURE_ANSWER 0x00000004 -#define LINECALLFEATURE_BLINDTRANSFER 0x00000008 -#define LINECALLFEATURE_COMPLETECALL 0x00000010 -#define LINECALLFEATURE_COMPLETETRANSF 0x00000020 -#define LINECALLFEATURE_DIAL 0x00000040 -#define LINECALLFEATURE_DROP 0x00000080 -#define LINECALLFEATURE_GATHERDIGITS 0x00000100 -#define LINECALLFEATURE_GENERATEDIGITS 0x00000200 -#define LINECALLFEATURE_GENERATETONE 0x00000400 -#define LINECALLFEATURE_HOLD 0x00000800 -#define LINECALLFEATURE_MONITORDIGITS 0x00001000 -#define LINECALLFEATURE_MONITORMEDIA 0x00002000 -#define LINECALLFEATURE_MONITORTONES 0x00004000 -#define LINECALLFEATURE_PARK 0x00008000 -#define LINECALLFEATURE_PREPAREADDCONF 0x00010000 -#define LINECALLFEATURE_REDIRECT 0x00020000 -#define LINECALLFEATURE_REMOVEFROMCONF 0x00040000 -#define LINECALLFEATURE_SECURECALL 0x00080000 -#define LINECALLFEATURE_SENDUSERUSER 0x00100000 -#define LINECALLFEATURE_SETCALLPARAMS 0x00200000 -#define LINECALLFEATURE_SETMEDIACONTROL 0x00400000 -#define LINECALLFEATURE_SETTERMINAL 0x00800000 -#define LINECALLFEATURE_SETUPCONF 0x01000000 -#define LINECALLFEATURE_SETUPTRANSFER 0x02000000 -#define LINECALLFEATURE_SWAPHOLD 0x04000000 -#define LINECALLFEATURE_UNHOLD 0x08000000 -#define LINECALLFEATURE_RELEASEUSERUSERINFO 0x10000000 // TAPI v1.4 -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) -#define LINECALLFEATURE_SETTREATMENT 0x20000000 // TAPI v2.0 -#define LINECALLFEATURE_SETQOS 0x40000000 // TAPI v2.0 -#define LINECALLFEATURE_SETCALLDATA 0x80000000 // TAPI v2.0 -#endif - - -#define LINECALLINFOSTATE_OTHER 0x00000001 -#define LINECALLINFOSTATE_DEVSPECIFIC 0x00000002 -#define LINECALLINFOSTATE_BEARERMODE 0x00000004 -#define LINECALLINFOSTATE_RATE 0x00000008 -#define LINECALLINFOSTATE_MEDIAMODE 0x00000010 -#define LINECALLINFOSTATE_APPSPECIFIC 0x00000020 -#define LINECALLINFOSTATE_CALLID 0x00000040 -#define LINECALLINFOSTATE_RELATEDCALLID 0x00000080 -#define LINECALLINFOSTATE_ORIGIN 0x00000100 -#define LINECALLINFOSTATE_REASON 0x00000200 -#define LINECALLINFOSTATE_COMPLETIONID 0x00000400 -#define LINECALLINFOSTATE_NUMOWNERINCR 0x00000800 -#define LINECALLINFOSTATE_NUMOWNERDECR 0x00001000 -#define LINECALLINFOSTATE_NUMMONITORS 0x00002000 -#define LINECALLINFOSTATE_TRUNK 0x00004000 -#define LINECALLINFOSTATE_CALLERID 0x00008000 -#define LINECALLINFOSTATE_CALLEDID 0x00010000 -#define LINECALLINFOSTATE_CONNECTEDID 0x00020000 -#define LINECALLINFOSTATE_REDIRECTIONID 0x00040000 -#define LINECALLINFOSTATE_REDIRECTINGID 0x00080000 -#define LINECALLINFOSTATE_DISPLAY 0x00100000 -#define LINECALLINFOSTATE_USERUSERINFO 0x00200000 -#define LINECALLINFOSTATE_HIGHLEVELCOMP 0x00400000 -#define LINECALLINFOSTATE_LOWLEVELCOMP 0x00800000 -#define LINECALLINFOSTATE_CHARGINGINFO 0x01000000 -#define LINECALLINFOSTATE_TERMINAL 0x02000000 -#define LINECALLINFOSTATE_DIALPARAMS 0x04000000 -#define LINECALLINFOSTATE_MONITORMODES 0x08000000 -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) -#define LINECALLINFOSTATE_TREATMENT 0x10000000 // TAPI v2.0 -#define LINECALLINFOSTATE_QOS 0x20000000 // TAPI v2.0 -#define LINECALLINFOSTATE_CALLDATA 0x40000000 // TAPI v2.0 -#endif - - -#define LINECALLORIGIN_OUTBOUND 0x00000001 -#define LINECALLORIGIN_INTERNAL 0x00000002 -#define LINECALLORIGIN_EXTERNAL 0x00000004 -#define LINECALLORIGIN_UNKNOWN 0x00000010 -#define LINECALLORIGIN_UNAVAIL 0x00000020 -#define LINECALLORIGIN_CONFERENCE 0x00000040 -#define LINECALLORIGIN_INBOUND 0x00000080 - -#define LINECALLPARAMFLAGS_SECURE 0x00000001 -#define LINECALLPARAMFLAGS_IDLE 0x00000002 -#define LINECALLPARAMFLAGS_BLOCKID 0x00000004 -#define LINECALLPARAMFLAGS_ORIGOFFHOOK 0x00000008 -#define LINECALLPARAMFLAGS_DESTOFFHOOK 0x00000010 -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) -#define LINECALLPARAMFLAGS_NOHOLDCONFERENCE 0x00000020 // TAPI v2.0 -#define LINECALLPARAMFLAGS_PREDICTIVEDIAL 0x00000040 // TAPI v2.0 -#define LINECALLPARAMFLAGS_ONESTEPTRANSFER 0x00000080 // TAPI v2.0 -#endif - - -#define LINECALLPARTYID_BLOCKED 0x00000001 -#define LINECALLPARTYID_OUTOFAREA 0x00000002 -#define LINECALLPARTYID_NAME 0x00000004 -#define LINECALLPARTYID_ADDRESS 0x00000008 -#define LINECALLPARTYID_PARTIAL 0x00000010 -#define LINECALLPARTYID_UNKNOWN 0x00000020 -#define LINECALLPARTYID_UNAVAIL 0x00000040 - -#define LINECALLPRIVILEGE_NONE 0x00000001 -#define LINECALLPRIVILEGE_MONITOR 0x00000002 -#define LINECALLPRIVILEGE_OWNER 0x00000004 - -#define LINECALLREASON_DIRECT 0x00000001 -#define LINECALLREASON_FWDBUSY 0x00000002 -#define LINECALLREASON_FWDNOANSWER 0x00000004 -#define LINECALLREASON_FWDUNCOND 0x00000008 -#define LINECALLREASON_PICKUP 0x00000010 -#define LINECALLREASON_UNPARK 0x00000020 -#define LINECALLREASON_REDIRECT 0x00000040 -#define LINECALLREASON_CALLCOMPLETION 0x00000080 -#define LINECALLREASON_TRANSFER 0x00000100 -#define LINECALLREASON_REMINDER 0x00000200 -#define LINECALLREASON_UNKNOWN 0x00000400 -#define LINECALLREASON_UNAVAIL 0x00000800 -#define LINECALLREASON_INTRUDE 0x00001000 // TAPI v1.4 -#define LINECALLREASON_PARKED 0x00002000 // TAPI v1.4 -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) -#define LINECALLREASON_CAMPEDON 0x00004000 // TAPI v2.0 -#define LINECALLREASON_ROUTEREQUEST 0x00008000 // TAPI v2.0 -#endif - - -#define LINECALLSELECT_LINE 0x00000001 -#define LINECALLSELECT_ADDRESS 0x00000002 -#define LINECALLSELECT_CALL 0x00000004 -#if (NDIS_TAPI_CURRENT_VERSION > 0x00020000) -#define LINECALLSELECT_DEVICEID 0x00000008 -#endif -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000) -#define LINECALLSELECT_CALLID 0x00000010 -#endif - - -#define LINECALLSTATE_IDLE 0x00000001 -#define LINECALLSTATE_OFFERING 0x00000002 -#define LINECALLSTATE_ACCEPTED 0x00000004 -#define LINECALLSTATE_DIALTONE 0x00000008 -#define LINECALLSTATE_DIALING 0x00000010 -#define LINECALLSTATE_RINGBACK 0x00000020 -#define LINECALLSTATE_BUSY 0x00000040 -#define LINECALLSTATE_SPECIALINFO 0x00000080 -#define LINECALLSTATE_CONNECTED 0x00000100 -#define LINECALLSTATE_PROCEEDING 0x00000200 -#define LINECALLSTATE_ONHOLD 0x00000400 -#define LINECALLSTATE_CONFERENCED 0x00000800 -#define LINECALLSTATE_ONHOLDPENDCONF 0x00001000 -#define LINECALLSTATE_ONHOLDPENDTRANSFER 0x00002000 -#define LINECALLSTATE_DISCONNECTED 0x00004000 -#define LINECALLSTATE_UNKNOWN 0x00008000 - -#define LINEDEVCAPFLAGS_CROSSADDRCONF 0x00000001 -#define LINEDEVCAPFLAGS_HIGHLEVCOMP 0x00000002 -#define LINEDEVCAPFLAGS_LOWLEVCOMP 0x00000004 -#define LINEDEVCAPFLAGS_MEDIACONTROL 0x00000008 -#define LINEDEVCAPFLAGS_MULTIPLEADDR 0x00000010 -#define LINEDEVCAPFLAGS_CLOSEDROP 0x00000020 -#define LINEDEVCAPFLAGS_DIALBILLING 0x00000040 -#define LINEDEVCAPFLAGS_DIALQUIET 0x00000080 -#define LINEDEVCAPFLAGS_DIALDIALTONE 0x00000100 -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000) -#define LINEDEVCAPFLAGS_MSP 0x00000200 // TAPI v3.0 -#define LINEDEVCAPFLAGS_CALLHUB 0x00000400 // TAPI v3.0 -#define LINEDEVCAPFLAGS_CALLHUBTRACKING 0x00000800 // TAPI v3.0 -#define LINEDEVCAPFLAGS_PRIVATEOBJECTS 0x00001000 // TAPI v3.0 -#endif - - -#define LINEDEVSTATE_OTHER 0x00000001 -#define LINEDEVSTATE_RINGING 0x00000002 -#define LINEDEVSTATE_CONNECTED 0x00000004 -#define LINEDEVSTATE_DISCONNECTED 0x00000008 -#define LINEDEVSTATE_MSGWAITON 0x00000010 -#define LINEDEVSTATE_MSGWAITOFF 0x00000020 -#define LINEDEVSTATE_INSERVICE 0x00000040 -#define LINEDEVSTATE_OUTOFSERVICE 0x00000080 -#define LINEDEVSTATE_MAINTENANCE 0x00000100 -#define LINEDEVSTATE_OPEN 0x00000200 -#define LINEDEVSTATE_CLOSE 0x00000400 -#define LINEDEVSTATE_NUMCALLS 0x00000800 -#define LINEDEVSTATE_NUMCOMPLETIONS 0x00001000 -#define LINEDEVSTATE_TERMINALS 0x00002000 -#define LINEDEVSTATE_ROAMMODE 0x00004000 -#define LINEDEVSTATE_BATTERY 0x00008000 -#define LINEDEVSTATE_SIGNAL 0x00010000 -#define LINEDEVSTATE_DEVSPECIFIC 0x00020000 -#define LINEDEVSTATE_REINIT 0x00040000 -#define LINEDEVSTATE_LOCK 0x00080000 - -#define LINEDEVSTATUSFLAGS_CONNECTED 0x00000001 -#define LINEDEVSTATUSFLAGS_MSGWAIT 0x00000002 -#define LINEDEVSTATUSFLAGS_INSERVICE 0x00000004 -#define LINEDEVSTATUSFLAGS_LOCKED 0x00000008 - -#define LINEDIALTONEMODE_NORMAL 0x00000001 -#define LINEDIALTONEMODE_SPECIAL 0x00000002 -#define LINEDIALTONEMODE_INTERNAL 0x00000004 -#define LINEDIALTONEMODE_EXTERNAL 0x00000008 -#define LINEDIALTONEMODE_UNKNOWN 0x00000010 -#define LINEDIALTONEMODE_UNAVAIL 0x00000020 - -#define LINEDIGITMODE_PULSE 0x00000001 -#define LINEDIGITMODE_DTMF 0x00000002 -#define LINEDIGITMODE_DTMFEND 0x00000004 - -#define LINEDISCONNECTMODE_NORMAL 0x00000001 -#define LINEDISCONNECTMODE_UNKNOWN 0x00000002 -#define LINEDISCONNECTMODE_REJECT 0x00000004 -#define LINEDISCONNECTMODE_PICKUP 0x00000008 -#define LINEDISCONNECTMODE_FORWARDED 0x00000010 -#define LINEDISCONNECTMODE_BUSY 0x00000020 -#define LINEDISCONNECTMODE_NOANSWER 0x00000040 -#define LINEDISCONNECTMODE_BADADDRESS 0x00000080 -#define LINEDISCONNECTMODE_UNREACHABLE 0x00000100 -#define LINEDISCONNECTMODE_CONGESTION 0x00000200 -#define LINEDISCONNECTMODE_INCOMPATIBLE 0x00000400 -#define LINEDISCONNECTMODE_UNAVAIL 0x00000800 -#define LINEDISCONNECTMODE_NODIALTONE 0x00001000 // TAPI v1.4 -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) -#define LINEDISCONNECTMODE_NUMBERCHANGED 0x00002000 // TAPI v2.0 -#define LINEDISCONNECTMODE_OUTOFORDER 0x00004000 // TAPI v2.0 -#define LINEDISCONNECTMODE_TEMPFAILURE 0x00008000 // TAPI v2.0 -#define LINEDISCONNECTMODE_QOSUNAVAIL 0x00010000 // TAPI v2.0 -#define LINEDISCONNECTMODE_BLOCKED 0x00020000 // TAPI v2.0 -#define LINEDISCONNECTMODE_DONOTDISTURB 0x00040000 // TAPI v2.0 -#define LINEDISCONNECTMODE_CANCELLED 0x00080000 // TAPI v2.0 -#endif - - -#define LINEFEATURE_DEVSPECIFIC 0x00000001 -#define LINEFEATURE_DEVSPECIFICFEAT 0x00000002 -#define LINEFEATURE_FORWARD 0x00000004 -#define LINEFEATURE_MAKECALL 0x00000008 -#define LINEFEATURE_SETMEDIACONTROL 0x00000010 -#define LINEFEATURE_SETTERMINAL 0x00000020 -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) -#define LINEFEATURE_SETDEVSTATUS 0x00000040 // TAPI v2.0 -#define LINEFEATURE_FORWARDFWD 0x00000080 // TAPI v2.0 -#define LINEFEATURE_FORWARDDND 0x00000100 // TAPI v2.0 -#endif - - -#define LINEFORWARDMODE_UNCOND 0x00000001 -#define LINEFORWARDMODE_UNCONDINTERNAL 0x00000002 -#define LINEFORWARDMODE_UNCONDEXTERNAL 0x00000004 -#define LINEFORWARDMODE_UNCONDSPECIFIC 0x00000008 -#define LINEFORWARDMODE_BUSY 0x00000010 -#define LINEFORWARDMODE_BUSYINTERNAL 0x00000020 -#define LINEFORWARDMODE_BUSYEXTERNAL 0x00000040 -#define LINEFORWARDMODE_BUSYSPECIFIC 0x00000080 -#define LINEFORWARDMODE_NOANSW 0x00000100 -#define LINEFORWARDMODE_NOANSWINTERNAL 0x00000200 -#define LINEFORWARDMODE_NOANSWEXTERNAL 0x00000400 -#define LINEFORWARDMODE_NOANSWSPECIFIC 0x00000800 -#define LINEFORWARDMODE_BUSYNA 0x00001000 -#define LINEFORWARDMODE_BUSYNAINTERNAL 0x00002000 -#define LINEFORWARDMODE_BUSYNAEXTERNAL 0x00004000 -#define LINEFORWARDMODE_BUSYNASPECIFIC 0x00008000 - -#define LINEGATHERTERM_BUFFERFULL 0x00000001 -#define LINEGATHERTERM_TERMDIGIT 0x00000002 -#define LINEGATHERTERM_FIRSTTIMEOUT 0x00000004 -#define LINEGATHERTERM_INTERTIMEOUT 0x00000008 -#define LINEGATHERTERM_CANCEL 0x00000010 - -#define LINEGENERATETERM_DONE 0x00000001 -#define LINEGENERATETERM_CANCEL 0x00000002 - -#define LINEMEDIACONTROL_NONE 0x00000001 -#define LINEMEDIACONTROL_START 0x00000002 -#define LINEMEDIACONTROL_RESET 0x00000004 -#define LINEMEDIACONTROL_PAUSE 0x00000008 -#define LINEMEDIACONTROL_RESUME 0x00000010 -#define LINEMEDIACONTROL_RATEUP 0x00000020 -#define LINEMEDIACONTROL_RATEDOWN 0x00000040 -#define LINEMEDIACONTROL_RATENORMAL 0x00000080 -#define LINEMEDIACONTROL_VOLUMEUP 0x00000100 -#define LINEMEDIACONTROL_VOLUMEDOWN 0x00000200 -#define LINEMEDIACONTROL_VOLUMENORMAL 0x00000400 - -#define LINEMEDIAMODE_UNKNOWN 0x00000002 -#define LINEMEDIAMODE_INTERACTIVEVOICE 0x00000004 -#define LINEMEDIAMODE_AUTOMATEDVOICE 0x00000008 -#define LINEMEDIAMODE_DATAMODEM 0x00000010 -#define LINEMEDIAMODE_G3FAX 0x00000020 -#define LINEMEDIAMODE_TDD 0x00000040 -#define LINEMEDIAMODE_G4FAX 0x00000080 -#define LINEMEDIAMODE_DIGITALDATA 0x00000100 -#define LINEMEDIAMODE_TELETEX 0x00000200 -#define LINEMEDIAMODE_VIDEOTEX 0x00000400 -#define LINEMEDIAMODE_TELEX 0x00000800 -#define LINEMEDIAMODE_MIXED 0x00001000 -#define LINEMEDIAMODE_ADSI 0x00002000 - -#define LINEMEDIAMODE_VOICEVIEW 0x00004000 // TAPI v1.4 -#define LAST_LINEMEDIAMODE 0x00004000 -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020001) -#define LINEMEDIAMODE_VIDEO 0x00008000 // TAPI v2.1 -#undef LAST_LINEMEDIAMODE -#define LAST_LINEMEDIAMODE 0x00008000 // Should override last definition. -#endif - - - - -#define LINEPARKMODE_DIRECTED 0x00000001 -#define LINEPARKMODE_NONDIRECTED 0x00000002 - -#define LINEREMOVEFROMCONF_NONE 0x00000001 -#define LINEREMOVEFROMCONF_LAST 0x00000002 -#define LINEREMOVEFROMCONF_ANY 0x00000003 - -#define LINEREQUESTMODE_MAKECALL 0x00000001 -#define LINEREQUESTMODE_MEDIACALL 0x00000002 -#define LINEREQUESTMODE_DROP 0x00000004 - -#define LAST_LINEREQUESTMODE LINEREQUESTMODE_MEDIACALL - -#define LINEROAMMODE_UNKNOWN 0x00000001 -#define LINEROAMMODE_UNAVAIL 0x00000002 -#define LINEROAMMODE_HOME 0x00000004 -#define LINEROAMMODE_ROAMA 0x00000008 -#define LINEROAMMODE_ROAMB 0x00000010 - -#define LINESPECIALINFO_NOCIRCUIT 0x00000001 -#define LINESPECIALINFO_CUSTIRREG 0x00000002 -#define LINESPECIALINFO_REORDER 0x00000004 -#define LINESPECIALINFO_UNKNOWN 0x00000008 -#define LINESPECIALINFO_UNAVAIL 0x00000010 - -#define LINETERMDEV_PHONE 0x00000001 -#define LINETERMDEV_HEADSET 0x00000002 -#define LINETERMDEV_SPEAKER 0x00000004 - -#define LINETERMMODE_BUTTONS 0x00000001 -#define LINETERMMODE_LAMPS 0x00000002 -#define LINETERMMODE_DISPLAY 0x00000004 -#define LINETERMMODE_RINGER 0x00000008 -#define LINETERMMODE_HOOKSWITCH 0x00000010 -#define LINETERMMODE_MEDIATOLINE 0x00000020 -#define LINETERMMODE_MEDIAFROMLINE 0x00000040 -#define LINETERMMODE_MEDIABIDIRECT 0x00000080 - -#define LINETERMSHARING_PRIVATE 0x00000001 -#define LINETERMSHARING_SHAREDEXCL 0x00000002 -#define LINETERMSHARING_SHAREDCONF 0x00000004 - -#define LINETONEMODE_CUSTOM 0x00000001 -#define LINETONEMODE_RINGBACK 0x00000002 -#define LINETONEMODE_BUSY 0x00000004 -#define LINETONEMODE_BEEP 0x00000008 -#define LINETONEMODE_BILLING 0x00000010 - -#define LINETRANSFERMODE_TRANSFER 0x00000001 -#define LINETRANSFERMODE_CONFERENCE 0x00000002 - -#define LINETOLLLISTOPTION_ADD 0x00000001 -#define LINETOLLLISTOPTION_REMOVE 0x00000002 - -#define LINETRANSLATEOPTION_CARDOVERRIDE 0x00000001 - -#define LINETRANSLATERESULT_CANONICAL 0x00000001 -#define LINETRANSLATERESULT_INTERNATIONAL 0x00000002 -#define LINETRANSLATERESULT_LONGDISTANCE 0x00000004 -#define LINETRANSLATERESULT_LOCAL 0x00000008 -#define LINETRANSLATERESULT_INTOLLLIST 0x00000010 -#define LINETRANSLATERESULT_NOTINTOLLLIST 0x00000020 -#define LINETRANSLATERESULT_DIALBILLING 0x00000040 -#define LINETRANSLATERESULT_DIALQUIET 0x00000080 -#define LINETRANSLATERESULT_DIALDIALTONE 0x00000100 -#define LINETRANSLATERESULT_DIALPROMPT 0x00000200 -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) -#define LINETRANSLATERESULT_VOICEDETECT 0x00000400 // TAPI v2.0 -#endif - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000) -#define LINETRANSLATERESULT_NOTRANSLATION 0x00000800 // TAPI v3.0 -#endif - -// -// Type definitions -// - -typedef ULONG_PTR HTAPI_LINE; -typedef ULONG_PTR HDRV_LINE; -typedef ULONG_PTR HTAPI_CALL; -typedef ULONG_PTR HDRV_CALL; - -typedef struct _LINE_ADDRESS_CAPS -{ - ULONG ulTotalSize; - ULONG ulNeededSize; - ULONG ulUsedSize; - - ULONG ulLineDeviceID; - - ULONG ulAddressSize; - ULONG ulAddressOffset; - - ULONG ulDevSpecificSize; - ULONG ulDevSpecificOffset; - - ULONG ulAddressSharing; - ULONG ulAddressStates; - ULONG ulCallInfoStates; - ULONG ulCallerIDFlags; - ULONG ulCalledIDFlags; - ULONG ulConnectedIDFlags; - ULONG ulRedirectionIDFlags; - ULONG ulRedirectingIDFlags; - ULONG ulCallStates; - ULONG ulDialToneModes; - ULONG ulBusyModes; - ULONG ulSpecialInfo; - ULONG ulDisconnectModes; - - ULONG ulMaxNumActiveCalls; - ULONG ulMaxNumOnHoldCalls; - ULONG ulMaxNumOnHoldPendingCalls; - ULONG ulMaxNumConference; - ULONG ulMaxNumTransConf; - - ULONG ulAddrCapFlags; - ULONG ulCallFeatures; - ULONG ulRemoveFromConfCaps; - ULONG ulRemoveFromConfState; - ULONG ulTransferModes; - ULONG ulParkModes; - - ULONG ulForwardModes; - ULONG ulMaxForwardEntries; - ULONG ulMaxSpecificEntries; - ULONG ulMinFwdNumRings; - ULONG ulMaxFwdNumRings; - - ULONG ulMaxCallCompletions; - ULONG ulCallCompletionConds; - ULONG ulCallCompletionModes; - ULONG ulNumCompletionMessages; - ULONG ulCompletionMsgTextEntrySize; - ULONG ulCompletionMsgTextSize; - ULONG ulCompletionMsgTextOffset; - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00010004) - ULONG ulAddressFeatures; // TAPI v1.4 - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) - ULONG ulPredictiveAutoTransferStates; // TAPI v2.0 - ULONG ulNumCallTreatments; // TAPI v2.0 - ULONG ulCallTreatmentListSize; // TAPI v2.0 - ULONG ulCallTreatmentListOffset; // TAPI v2.0 - ULONG ulDeviceClassesSize; // TAPI v2.0 - ULONG ulDeviceClassesOffset; // TAPI v2.0 - ULONG ulMaxCallDataSize; // TAPI v2.0 - ULONG ulCallFeatures2; // TAPI v2.0 - ULONG ulMaxNoAnswerTimeout; // TAPI v2.0 - ULONG ulConnectedModes; // TAPI v2.0 - ULONG ulOfferingModes; // TAPI v2.0 - ULONG ulAvailableMediaModes; // TAPI v2.0 -#endif -#endif - -} LINE_ADDRESS_CAPS, *PLINE_ADDRESS_CAPS; - - -typedef struct _LINE_ADDRESS_STATUS -{ - ULONG ulTotalSize; - ULONG ulNeededSize; - ULONG ulUsedSize; - - ULONG ulNumInUse; - ULONG ulNumActiveCalls; - ULONG ulNumOnHoldCalls; - ULONG ulNumOnHoldPendCalls; - ULONG ulAddressFeatures; - - ULONG ulNumRingsNoAnswer; - ULONG ulForwardNumEntries; - ULONG ulForwardSize; - ULONG ulForwardOffset; - - ULONG ulTerminalModesSize; - ULONG ulTerminalModesOffset; - - ULONG ulDevSpecificSize; - ULONG ulDevSpecificOffset; - -} LINE_ADDRESS_STATUS, *PLINE_ADDRESS_STATUS; - - -typedef struct _LINE_DIAL_PARAMS -{ - ULONG ulDialPause; - ULONG ulDialSpeed; - ULONG ulDigitDuration; - ULONG ulWaitForDialtone; - -} LINE_DIAL_PARAMS, *PLINE_DIAL_PARAMS; - - -typedef struct _LINE_CALL_INFO -{ - ULONG ulTotalSize; - ULONG ulNeededSize; - ULONG ulUsedSize; - - ULONG hLine; - ULONG ulLineDeviceID; - ULONG ulAddressID; - - ULONG ulBearerMode; - ULONG ulRate; - ULONG ulMediaMode; - - ULONG ulAppSpecific; - ULONG ulCallID; - ULONG ulRelatedCallID; - ULONG ulCallParamFlags; - ULONG ulCallStates; - - ULONG ulMonitorDigitModes; - ULONG ulMonitorMediaModes; - LINE_DIAL_PARAMS DialParams; - - ULONG ulOrigin; - ULONG ulReason; - ULONG ulCompletionID; - ULONG ulNumOwners; - ULONG ulNumMonitors; - - ULONG ulCountryCode; - ULONG ulTrunk; - - ULONG ulCallerIDFlags; - ULONG ulCallerIDSize; - ULONG ulCallerIDOffset; - ULONG ulCallerIDNameSize; - ULONG ulCallerIDNameOffset; - - ULONG ulCalledIDFlags; - ULONG ulCalledIDSize; - ULONG ulCalledIDOffset; - ULONG ulCalledIDNameSize; - ULONG ulCalledIDNameOffset; - - ULONG ulConnectedIDFlags; - ULONG ulConnectedIDSize; - ULONG ulConnectedIDOffset; - ULONG ulConnectedIDNameSize; - ULONG ulConnectedIDNameOffset; - - ULONG ulRedirectionIDFlags; - ULONG ulRedirectionIDSize; - ULONG ulRedirectionIDOffset; - ULONG ulRedirectionIDNameSize; - ULONG ulRedirectionIDNameOffset; - - ULONG ulRedirectingIDFlags; - ULONG ulRedirectingIDSize; - ULONG ulRedirectingIDOffset; - ULONG ulRedirectingIDNameSize; - ULONG ulRedirectingIDNameOffset; - - ULONG ulAppNameSize; - ULONG ulAppNameOffset; - - ULONG ulDisplayableAddressSize; - ULONG ulDisplayableAddressOffset; - - ULONG ulCalledPartySize; - ULONG ulCalledPartyOffset; - - ULONG ulCommentSize; - ULONG ulCommentOffset; - - ULONG ulDisplaySize; - ULONG ulDisplayOffset; - - ULONG ulUserUserInfoSize; - ULONG ulUserUserInfoOffset; - - ULONG ulHighLevelCompSize; - ULONG ulHighLevelCompOffset; - - ULONG ulLowLevelCompSize; - ULONG ulLowLevelCompOffset; - - ULONG ulChargingInfoSize; - ULONG ulChargingInfoOffset; - - ULONG ulTerminalModesSize; - ULONG ulTerminalModesOffset; - - ULONG ulDevSpecificSize; - ULONG ulDevSpecificOffset; - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) - ULONG ulCallTreatment; // TAPI v2.0 - ULONG ulCallDataSize; // TAPI v2.0 - ULONG ulCallDataOffset; // TAPI v2.0 - ULONG ulSendingFlowspecSize; // TAPI v2.0 - ULONG ulSendingFlowspecOffset; // TAPI v2.0 - ULONG ulReceivingFlowspecSize; // TAPI v2.0 - ULONG ulReceivingFlowspecOffset; // TAPI v2.0 -#endif - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000) - ULONG ulCallerIDAddressType; // TAPI v3.0 - ULONG ulCalledIDAddressType; // TAPI v3.0 - ULONG ulConnectedIDAddressType; // TAPI v3.0 - ULONG ulRedirectionIDAddressType; // TAPI v3.0 - ULONG ulRedirectingIDAddressType; // TAPI v3.0 -#endif - -} LINE_CALL_INFO, *PLINE_CALL_INFO; - - -typedef struct _LINE_CALL_PARAMS // Defaults: -{ - ULONG ulTotalSize; // --------- - - ULONG ulBearerMode; // voice - ULONG ulMinRate; // (3.1kHz) - ULONG ulMaxRate; // (3.1kHz) - ULONG ulMediaMode; // interactiveVoice - - ULONG ulCallParamFlags; // 0 - ULONG ulAddressMode; // addressID - ULONG ulAddressID; // (any available) - - LINE_DIAL_PARAMS DialParams; // (0, 0, 0, 0) - - ULONG ulOrigAddressSize; // 0 - ULONG ulOrigAddressOffset; - ULONG ulDisplayableAddressSize; - ULONG ulDisplayableAddressOffset; - - ULONG ulCalledPartySize; // 0 - ULONG ulCalledPartyOffset; - - ULONG ulCommentSize; // 0 - ULONG ulCommentOffset; - - ULONG ulUserUserInfoSize; // 0 - ULONG ulUserUserInfoOffset; - - ULONG ulHighLevelCompSize; // 0 - ULONG ulHighLevelCompOffset; - - ULONG ulLowLevelCompSize; // 0 - ULONG ulLowLevelCompOffset; - - ULONG ulDevSpecificSize; // 0 - ULONG ulDevSpecificOffset; - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) - ULONG ulPredictiveAutoTransferStates; // TAPI v2.0 - ULONG ulTargetAddressSize; // TAPI v2.0 - ULONG ulTargetAddressOffset; // TAPI v2.0 - ULONG ulSendingFlowspecSize; // TAPI v2.0 - ULONG ulSendingFlowspecOffset; // TAPI v2.0 - ULONG ulReceivingFlowspecSize; // TAPI v2.0 - ULONG ulReceivingFlowspecOffset; // TAPI v2.0 - ULONG ulDeviceClassSize; // TAPI v2.0 - ULONG ulDeviceClassOffset; // TAPI v2.0 - ULONG ulDeviceConfigSize; // TAPI v2.0 - ULONG ulDeviceConfigOffset; // TAPI v2.0 - ULONG ulCallDataSize; // TAPI v2.0 - ULONG ulCallDataOffset; // TAPI v2.0 - ULONG ulNoAnswerTimeout; // TAPI v2.0 - ULONG ulCallingPartyIDSize; // TAPI v2.0 - ULONG ulCallingPartyIDOffset; // TAPI v2.0 -#endif - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000) - ULONG ulAddressType; // TAPI v3.0 -#endif - -} LINE_CALL_PARAMS, *PLINE_CALL_PARAMS; - - -typedef struct _LINE_CALL_STATUS -{ - ULONG ulTotalSize; - ULONG ulNeededSize; - ULONG ulUsedSize; - - ULONG ulCallState; - ULONG ulCallStateMode; - ULONG ulCallPrivilege; - ULONG ulCallFeatures; - - ULONG ulDevSpecificSize; - ULONG ulDevSpecificOffset; - -} LINE_CALL_STATUS, *PLINE_CALL_STATUS; - - -typedef struct _LINE_EXTENSION_ID -{ - ULONG ulExtensionID0; - ULONG ulExtensionID1; - ULONG ulExtensionID2; - ULONG ulExtensionID3; - -} LINE_EXTENSION_ID, *PLINE_EXTENSION_ID; - - -typedef struct _LINE_DEV_CAPS -{ - ULONG ulTotalSize; - ULONG ulNeededSize; - ULONG ulUsedSize; - - ULONG ulProviderInfoSize; - ULONG ulProviderInfoOffset; - - ULONG ulSwitchInfoSize; - ULONG ulSwitchInfoOffset; - - ULONG ulPermanentLineID; - ULONG ulLineNameSize; - ULONG ulLineNameOffset; - ULONG ulStringFormat; - - ULONG ulAddressModes; - ULONG ulNumAddresses; - ULONG ulBearerModes; - ULONG ulMaxRate; - ULONG ulMediaModes; - - ULONG ulGenerateToneModes; - ULONG ulGenerateToneMaxNumFreq; - ULONG ulGenerateDigitModes; - ULONG ulMonitorToneMaxNumFreq; - ULONG ulMonitorToneMaxNumEntries; - ULONG ulMonitorDigitModes; - ULONG ulGatherDigitsMinTimeout; - ULONG ulGatherDigitsMaxTimeout; - - ULONG ulMedCtlDigitMaxListSize; - ULONG ulMedCtlMediaMaxListSize; - ULONG ulMedCtlToneMaxListSize; - ULONG ulMedCtlCallStateMaxListSize; - - ULONG ulDevCapFlags; - ULONG ulMaxNumActiveCalls; - ULONG ulAnswerMode; - ULONG ulRingModes; - ULONG ulLineStates; - - ULONG ulUUIAcceptSize; - ULONG ulUUIAnswerSize; - ULONG ulUUIMakeCallSize; - ULONG ulUUIDropSize; - ULONG ulUUISendUserUserInfoSize; - ULONG ulUUICallInfoSize; - - LINE_DIAL_PARAMS MinDialParams; - LINE_DIAL_PARAMS MaxDialParams; - LINE_DIAL_PARAMS DefaultDialParams; - - ULONG ulNumTerminals; - ULONG ulTerminalCapsSize; - ULONG ulTerminalCapsOffset; - ULONG ulTerminalTextEntrySize; - ULONG ulTerminalTextSize; - ULONG ulTerminalTextOffset; - - ULONG ulDevSpecificSize; - ULONG ulDevSpecificOffset; - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00010004) - ULONG ulLineFeatures; // TAPI v1.4 -#endif - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000) - ULONG ulSettableDevStatus; // TAPI v2.0 - ULONG ulDeviceClassesSize; // TAPI v2.0 - ULONG ulDeviceClassesOffset; // TAPI v2.0 -#endif - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020002) - GUID PermanentLineGuid; // TAPI v3.0 -#endif - -#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000) - ULONG ulAddressTypes; // TAPI v3.0 - GUID ProtocolGuid; // TAPI v3.0 - ULONG ulAvailableTracking; // TAPI v3.0 -#endif - -} LINE_DEV_CAPS, *PLINE_DEV_CAPS; - - -typedef struct _LINE_DEV_STATUS -{ - ULONG ulTotalSize; - ULONG ulNeededSize; - ULONG ulUsedSize; - - ULONG ulNumOpens; - ULONG ulOpenMediaModes; - ULONG ulNumActiveCalls; - ULONG ulNumOnHoldCalls; - ULONG ulNumOnHoldPendCalls; - ULONG ulLineFeatures; - ULONG ulNumCallCompletions; - ULONG ulRingMode; - ULONG ulSignalLevel; - ULONG ulBatteryLevel; - ULONG ulRoamMode; - - ULONG ulDevStatusFlags; - - ULONG ulTerminalModesSize; - ULONG ulTerminalModesOffset; - - ULONG ulDevSpecificSize; - ULONG ulDevSpecificOffset; - -} LINE_DEV_STATUS, *PLINE_DEV_STATUS; - - -#ifndef __NDISTAPI_VAR_STRING_DECLARED -#define __NDISTAPI_VAR_STRING_DECLARED - -typedef struct _VAR_STRING -{ - ULONG ulTotalSize; - ULONG ulNeededSize; - ULONG ulUsedSize; - - ULONG ulStringFormat; - ULONG ulStringSize; - ULONG ulStringOffset; - -} VAR_STRING, *PVAR_STRING; - -#endif // __NDISTAPI_VAR_STRING_DECLARED - -typedef struct _NDIS_TAPI_ACCEPT -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - __in ULONG ulUserUserInfoSize; - __in UCHAR UserUserInfo[1]; - -} NDIS_TAPI_ACCEPT, *PNDIS_TAPI_ACCEPT; - - -typedef struct _NDIS_TAPI_ANSWER -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - __in ULONG ulUserUserInfoSize; - __in UCHAR UserUserInfo[1]; - -} NDIS_TAPI_ANSWER, *PNDIS_TAPI_ANSWER; - - -typedef struct _NDIS_TAPI_CLOSE -{ - __in ULONG ulRequestID; - __in HDRV_LINE hdLine; - -} NDIS_TAPI_CLOSE, *PNDIS_TAPI_CLOSE; - - -typedef struct _NDIS_TAPI_CLOSE_CALL -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - -} NDIS_TAPI_CLOSE_CALL, *PNDIS_TAPI_CLOSE_CALL; - - -typedef struct _NDIS_TAPI_CONDITIONAL_MEDIA_DETECTION -{ - __in ULONG ulRequestID; - __in HDRV_LINE hdLine; - __in ULONG ulMediaModes; - __in LINE_CALL_PARAMS LineCallParams; - -} NDIS_TAPI_CONDITIONAL_MEDIA_DETECTION, -*PNDIS_TAPI_CONDITIONAL_MEDIA_DETECTION; - - -typedef struct _NDIS_TAPI_CONFIG_DIALOG -{ - __in ULONG ulRequestID; - __in ULONG ulDeviceID; - __in ULONG ulDeviceClassSize; - __in ULONG ulDeviceClassOffset; - __in ULONG ulLibraryNameTotalSize; - __out ULONG ulLibraryNameNeededSize; - __out CHAR szLibraryName[1]; - -} NDIS_TAPI_CONFIG_DIALOG, *PNDIS_TAPI_CONFIG_DIALOG; - - -typedef struct _NDIS_TAPI_DEV_SPECIFIC -{ - __in ULONG ulRequestID; - __in HDRV_LINE hdLine; - __in ULONG ulAddressID; - __in HDRV_CALL hdCall; - __inout ULONG ulParamsSize; - __inout UCHAR Params[1]; - -} NDIS_TAPI_DEV_SPECIFIC, *PNDIS_TAPI_DEV_SPECIFIC; - - -typedef struct _NDIS_TAPI_DIAL -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - __in ULONG ulDestAddressSize; - __in CHAR szDestAddress[1]; - -} NDIS_TAPI_DIAL, *PNDIS_TAPI_DIAL; - - -typedef struct _NDIS_TAPI_DROP -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - __in ULONG ulUserUserInfoSize; - __in UCHAR UserUserInfo[1]; - -} NDIS_TAPI_DROP, *PNDIS_TAPI_DROP; - - -typedef struct _NDIS_TAPI_GET_ADDRESS_CAPS -{ - __in ULONG ulRequestID; - __in ULONG ulDeviceID; - __in ULONG ulAddressID; - __in ULONG ulExtVersion; - __out LINE_ADDRESS_CAPS LineAddressCaps; - -} NDIS_TAPI_GET_ADDRESS_CAPS, *PNDIS_TAPI_GET_ADDRESS_CAPS; - - -typedef struct _NDIS_TAPI_GET_ADDRESS_ID -{ - __in ULONG ulRequestID; - __in HDRV_LINE hdLine; - __out ULONG ulAddressID; - __in ULONG ulAddressMode; - __in ULONG ulAddressSize; - __in CHAR szAddress[1]; - -} NDIS_TAPI_GET_ADDRESS_ID, *PNDIS_TAPI_GET_ADDRESS_ID; - - -typedef struct _NDIS_TAPI_GET_ADDRESS_STATUS -{ - __in ULONG ulRequestID; - __in HDRV_LINE hdLine; - __in ULONG ulAddressID; - __out LINE_ADDRESS_STATUS LineAddressStatus; - -} NDIS_TAPI_GET_ADDRESS_STATUS, *PNDIS_TAPI_GET_ADDRESS_STATUS; - - -typedef struct _NDIS_TAPI_GET_CALL_ADDRESS_ID -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - __out ULONG ulAddressID; - -} NDIS_TAPI_GET_CALL_ADDRESS_ID, *PNDIS_TAPI_GET_CALL_ADDRESS_ID; - - -typedef struct _NDIS_TAPI_GET_CALL_INFO -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - __out LINE_CALL_INFO LineCallInfo; - -} NDIS_TAPI_GET_CALL_INFO, *PNDIS_TAPI_GET_CALL_INFO; - - -typedef struct _NDIS_TAPI_GET_CALL_STATUS -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - __out LINE_CALL_STATUS LineCallStatus; - -} NDIS_TAPI_GET_CALL_STATUS, *PNDIS_TAPI_GET_CALL_STATUS; - - -typedef struct _NDIS_TAPI_GET_DEV_CAPS -{ - __in ULONG ulRequestID; - __in ULONG ulDeviceID; - __in ULONG ulExtVersion; - __out LINE_DEV_CAPS LineDevCaps; - -} NDIS_TAPI_GET_DEV_CAPS, *PNDIS_TAPI_GET_DEV_CAPS; - - -typedef struct _NDIS_TAPI_GET_DEV_CONFIG -{ - __in ULONG ulRequestID; - __in ULONG ulDeviceID; - __in ULONG ulDeviceClassSize; - __in ULONG ulDeviceClassOffset; - __out VAR_STRING DeviceConfig; - -} NDIS_TAPI_GET_DEV_CONFIG, *PNDIS_TAPI_GET_DEV_CONFIG; - - -typedef struct _NDIS_TAPI_GET_EXTENSION_ID -{ - __in ULONG ulRequestID; - __in ULONG ulDeviceID; - __out LINE_EXTENSION_ID LineExtensionID; - -} NDIS_TAPI_GET_EXTENSION_ID, *PNDIS_TAPI_GET_EXTENSION_ID; - - -typedef struct _NDIS_TAPI_GET_ID -{ - __in ULONG ulRequestID; - __in HDRV_LINE hdLine; - __in ULONG ulAddressID; - __in HDRV_CALL hdCall; - __in ULONG ulSelect; - __in ULONG ulDeviceClassSize; - __in ULONG ulDeviceClassOffset; - __out VAR_STRING DeviceID; - -} NDIS_TAPI_GET_ID, *PNDIS_TAPI_GET_ID; - - -typedef struct _NDIS_TAPI_GET_LINE_DEV_STATUS -{ - __in ULONG ulRequestID; - __in HDRV_LINE hdLine; - __out LINE_DEV_STATUS LineDevStatus; - -} NDIS_TAPI_GET_LINE_DEV_STATUS, *PNDIS_TAPI_GET_LINE_DEV_STATUS; - - -typedef struct _NDIS_TAPI_MAKE_CALL -{ - __in ULONG ulRequestID; - __in HDRV_LINE hdLine; - __in HTAPI_CALL htCall; - __out HDRV_CALL hdCall; - __in ULONG ulDestAddressSize; - __in ULONG ulDestAddressOffset; - __in BOOLEAN bUseDefaultLineCallParams; - __in LINE_CALL_PARAMS LineCallParams; - -} NDIS_TAPI_MAKE_CALL, *PNDIS_TAPI_MAKE_CALL; - - -typedef struct _NDIS_TAPI_NEGOTIATE_EXT_VERSION -{ - __in ULONG ulRequestID; - __in ULONG ulDeviceID; - __in ULONG ulLowVersion; - __in ULONG ulHighVersion; - __out ULONG ulExtVersion; - -} NDIS_TAPI_NEGOTIATE_EXT_VERSION, *PNDIS_TAPI_NEGOTIATE_EXT_VERSION; - - -typedef struct _NDIS_TAPI_OPEN -{ - __in ULONG ulRequestID; - __in ULONG ulDeviceID; - __in HTAPI_LINE htLine; - __out HDRV_LINE hdLine; - -} NDIS_TAPI_OPEN, *PNDIS_TAPI_OPEN; - - -typedef struct _NDIS_TAPI_PROVIDER_INITIALIZE -{ - __in ULONG ulRequestID; - __in ULONG ulDeviceIDBase; - __out ULONG ulNumLineDevs; - __out ULONG_PTR ulProviderID; - -} NDIS_TAPI_PROVIDER_INITIALIZE, *PNDIS_TAPI_PROVIDER_INITIALIZE; - - -typedef struct _NDIS_TAPI_PROVIDER_SHUTDOWN -{ - __in ULONG ulRequestID; - -} NDIS_TAPI_PROVIDER_SHUTDOWN, *PNDIS_TAPI_PROVIDER_SHUTDOWN; - - -typedef struct _NDIS_TAPI_SECURE_CALL -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - -} NDIS_TAPI_SECURE_CALL, *PNDIS_TAPI_SECURE_CALL; - - -typedef struct _NDIS_TAPI_SELECT_EXT_VERSION -{ - __in ULONG ulRequestID; - __in HDRV_LINE hdLine; - __in ULONG ulExtVersion; - -} NDIS_TAPI_SELECT_EXT_VERSION, *PNDIS_TAPI_SELECT_EXT_VERSION; - - -typedef struct _NDIS_TAPI_SEND_USER_USER_INFO -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - __in ULONG ulUserUserInfoSize; - __in UCHAR UserUserInfo[1]; - -} NDIS_TAPI_SEND_USER_USER_INFO, *PNDIS_TAPI_SEND_USER_USER_INFO; - - -typedef struct _NDIS_TAPI_SET_APP_SPECIFIC -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - __in ULONG ulAppSpecific; - -} NDIS_TAPI_SET_APP_SPECIFIC, *PNDIS_TAPI_SET_APP_SPECIFIC; - - -typedef struct _NDIS_TAPI_SET_CALL_PARAMS -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - __in ULONG ulBearerMode; - __in ULONG ulMinRate; - __in ULONG ulMaxRate; - __in BOOLEAN bSetLineDialParams; - __in LINE_DIAL_PARAMS LineDialParams; - -} NDIS_TAPI_SET_CALL_PARAMS, *PNDIS_TAPI_SET_CALL_PARAMS; - - -typedef struct _NDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION -{ - __in ULONG ulRequestID; - __in HDRV_LINE hdLine; - __in ULONG ulMediaModes; - -} NDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION, -*PNDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION; - - -typedef struct _NDIS_TAPI_SET_DEV_CONFIG -{ - __in ULONG ulRequestID; - __in ULONG ulDeviceID; - __in ULONG ulDeviceClassSize; - __in ULONG ulDeviceClassOffset; - __in ULONG ulDeviceConfigSize; - __in UCHAR DeviceConfig[1]; - -} NDIS_TAPI_SET_DEV_CONFIG, *PNDIS_TAPI_SET_DEV_CONFIG; - - -typedef struct _NDIS_TAPI_SET_MEDIA_MODE -{ - __in ULONG ulRequestID; - __in HDRV_CALL hdCall; - __in ULONG ulMediaMode; - -} NDIS_TAPI_SET_MEDIA_MODE, *PNDIS_TAPI_SET_MEDIA_MODE; - - -typedef struct _NDIS_TAPI_SET_STATUS_MESSAGES -{ - __in ULONG ulRequestID; - __in HDRV_LINE hdLine; - __in ULONG ulLineStates; - __in ULONG ulAddressStates; - -} NDIS_TAPI_SET_STATUS_MESSAGES, *PNDIS_TAPI_SET_STATUS_MESSAGES; - - -typedef struct _NDIS_TAPI_EVENT -{ - __in HTAPI_LINE htLine; - __in HTAPI_CALL htCall; - __in ULONG ulMsg; - __in ULONG_PTR ulParam1; - __in ULONG_PTR ulParam2; - __in ULONG_PTR ulParam3; - -} NDIS_TAPI_EVENT, *PNDIS_TAPI_EVENT; - -typedef struct _NDISTAPI_CHARACTERISTICS { - PVOID RequestProc; - GUID Guid; - NDIS_WAN_MEDIUM_SUBTYPE MediaType; -} NDISTAPI_CHARACTERISTICS, *PNDISTAPI_CHARACTERISTICS; - - -typedef struct _NDIS_TAPI_GATHER_DIGITS -{ - __in ULONG ulRequestID; - IN HDRV_CALL hdCall; - IN ULONG ulEndToEndID; - IN ULONG ulDigitModes; - __field_ecount(ulNumDigitsNeeded) IN LPWSTR lpsOrigDigitsBuffer; - IN ULONG ulDigitsBufferOffset; - IN ULONG ulNumDigitsNeeded; - OUT ULONG ulNumDigitsRead; - OUT ULONG ulTickCount; - OUT ULONG ulTerminationReason; - IN ULONG ulTerminationDigitsMask; - IN ULONG ulFirstDigitTimeout; - IN ULONG ulInterDigitTimeout; -} NDIS_TAPI_GATHER_DIGITS, *PNDIS_TAPI_GATHER_DIGITS; - -typedef struct _NDIS_TAPI_MONITOR_DIGITS -{ - IN HDRV_CALL hdCall; - IN ULONG ulDigitModes; -} NDIS_TAPI_MONITOR_DIGITS, *PNDIS_TAPI_MONITOR_DIGITS; - -#define CO_TAPI_VERSION NDIS_TAPI_CURRENT_VERSION - -// -// The CO_TAPI structures below are meant for TAPI support -// over CONDIS Call Managers and Miniport Call Managers. -// - -// Structure associated with OID_CO_TAPI_CM_CAPS -// -typedef struct _CO_TAPI_CM_CAPS -{ - __out ULONG ulCoTapiVersion; - __out ULONG ulNumLines; - __out ULONG ulFlags; - -} CO_TAPI_CM_CAPS, *PCO_TAPI_CM_CAPS; - -// -// Bit definitions for Flags in CO_TAPI_CM_CAPS -// -#define CO_TAPI_FLAG_PER_LINE_CAPS 0x00000001 - -// -// Structure associated with OID_CO_TAPI_LINE_CAPS. -// -typedef struct _CO_TAPI_LINE_CAPS -{ - __in ULONG ulLineID; - __out ULONG ulFlags; - __out LINE_DEV_CAPS LineDevCaps; - -} CO_TAPI_LINE_CAPS, *PCO_TAPI_LINE_CAPS; - -// -// Bit definitions for Flags in CO_TAPI_LINE_CAPS -// -#define CO_TAPI_FLAG_PER_ADDRESS_CAPS 0x00000001 - -// -// Structure associated with OID_CO_TAPI_ADDRESS_CAPS. -// -typedef struct _CO_TAPI_ADDRESS_CAPS -{ - __in ULONG ulLineID; - __in ULONG ulAddressID; - __out ULONG ulFlags; - __out LINE_ADDRESS_CAPS LineAddressCaps; - -} CO_TAPI_ADDRESS_CAPS, *PCO_TAPI_ADDRESS_CAPS; - - -// -// Special values for Line and Address ID fields: -// -#define CO_TAPI_LINE_ID_UNSPECIFIED 0xFFFFFFFF -#define CO_TAPI_ADDRESS_ID_UNSPECIFIED 0xFFFFFFFF - -// -// Structure associated with OID_CO_TAPI_TRANSLATE_TAPI_CALLPARAMS. -// -typedef struct _CO_TAPI_TRANSLATE_TAPI_CALLPARAMS -{ - __in ULONG ulLineID; - __in ULONG ulAddressID; - __in ULONG ulFlags; // see below - __in NDIS_VAR_DATA_DESC DestAddress; - __in NDIS_VAR_DATA_DESC LineCallParams; // LINE_CALL_PARAMS - __out NDIS_VAR_DATA_DESC NdisCallParams; // CO_CALL_PARAMETERS - -} CO_TAPI_TRANSLATE_TAPI_CALLPARAMS, *PCO_TAPI_TRANSLATE_TAPI_CALLPARAMS; - -// -// Bit definitions for Flags in CO_TAPI_TRANSLATE_TAPI_CALLPARAMS -// and CO_TAPI_TRANSLATE_NDIS_CALLPARAMS. -// -#define CO_TAPI_FLAG_OUTGOING_CALL 0x00000001 -#define CO_TAPI_FLAG_INCOMING_CALL 0x00000002 -#define CO_TAPI_FLAG_USE_DEFAULT_CALLPARAMS 0x00000004 - - -// -// Structure associated with OID_CO_TAPI_TRANSLATE_NDIS_CALLPARAMS. -// -typedef struct _CO_TAPI_TRANSLATE_NDIS_CALLPARAMS -{ - __in ULONG ulFlags; // see above - __in NDIS_VAR_DATA_DESC NdisCallParams; // CO_CALL_PARAMETERS - __out NDIS_VAR_DATA_DESC LineCallInfo; // LINE_CALL_INFO - -} CO_TAPI_TRANSLATE_NDIS_CALLPARAMS, *PCO_TAPI_TRANSLATE_NDIS_CALLPARAMS; - - -// -// Structure associated with OID_CO_TAPI_TRANSLATE_SAP. -// -typedef struct _CO_TAPI_TRANSLATE_SAP -{ - __in ULONG ulLineID; - __in ULONG ulAddressID; - __in ULONG ulMediaModes; - __in ULONG Reserved; - __out ULONG NumberOfSaps; - __out NDIS_VAR_DATA_DESC NdisSapParams[1]; // CO_SAP - -} CO_TAPI_TRANSLATE_SAP, *PCO_TAPI_TRANSLATE_SAP; - - -// -// Structure associated with OID_CO_TAPI_GET_CALL_DIAGNOSTICS. -// -typedef struct _CO_TAPI_CALL_DIAGNOSTICS -{ - __out ULONG ulOrigin; - __out ULONG ulReason; - __out NDIS_VAR_DATA_DESC DiagInfo; - -} CO_TAPI_CALL_DIAGNOSTICS, *PCO_TAPI_CALL_DIAGNOSTICS; - - -// -// Structure used in the Media-specific part of CO_CALL_PARAMETERS -// for an outgoing call for the CO_ADDRESS_FAMILY_TAPI address family. -// This is used in NdisClMakeCall/Ndis[M]CmActivateVc, and -// completion routines. -// -// This overlays: -// CO_CALL_PARAMETERS.MediaParameters->MediaSpecific.Parameters[] -// -typedef struct _CO_AF_TAPI_MAKE_CALL_PARAMETERS -{ - __in ULONG ulLineID; - __in ULONG ulAddressID; - __in ULONG ulFlags; // see CO_TAPI_TRANSLATE_TAPI_CALLPARAMS - __in NDIS_VAR_DATA_DESC DestAddress; - __in NDIS_VAR_DATA_DESC LineCallParams; // LINE_CALL_PARAMS - -} CO_AF_TAPI_MAKE_CALL_PARAMETERS, *PCO_AF_TAPI_MAKE_CALL_PARAMETERS; - - - -// -// Structure used in the Media-specific part of CO_CALL_PARAMETERS -// for an incoming call for the CO_ADDRESS_FAMILY_TAPI address family. -// This is used in Ndis[M]CmDispatchIncomingCall/Ndis[M]CmActivateVc -// and completion routines. -// -// This overlays: -// CO_CALL_PARAMETERS.MediaParameters->MediaSpecific.Parameters[] -// -typedef struct _CO_AF_TAPI_INCOMING_CALL_PARAMETERS -{ - __in ULONG ulLineID; - __in ULONG ulAddressID; - __in ULONG ulFlags; // see CO_TAPI_TRANSLATE_TAPI_CALLPARAMS - __in NDIS_VAR_DATA_DESC LineCallInfo; // LINE_CALL_INFO - -} CO_AF_TAPI_INCOMING_CALL_PARAMETERS, *PCO_AF_TAPI_INCOMING_CALL_PARAMETERS; - - - -// -// Value of SapType in CO_SAP for a Service Access Point on the -// CO_ADDRESS_FAMILY_TAPI address family. -// -#define AF_TAPI_SAP_TYPE 0x00008000 - -// -// Structure used to convey TAPI-style SAP information in the NDIS CO_SAP -// structure. -// -// This overlays: -// CO_SAP.Sap[] -// -typedef struct _CO_AF_TAPI_SAP -{ - __in ULONG ulLineID; - __in ULONG ulAddressID; - __in ULONG ulMediaModes; - -} CO_AF_TAPI_SAP, *PCO_AF_TAPI_SAP; - - - -#endif // _NDIS_TAPI_ - diff --git a/pub/ddk/ndiswan.h b/pub/ddk/ndiswan.h deleted file mode 100644 index f640082..0000000 --- a/pub/ddk/ndiswan.h +++ /dev/null @@ -1,485 +0,0 @@ -/*++ BUILD Version: 0000 // Increment this if a change has global effects - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ndiswan.h - -Abstract: - - Main header file for the wan wrapper - - -Revision History: - ---*/ - - -#ifndef _NDIS_WAN_ -#define _NDIS_WAN_ - -#pragma once - -// -// Begin definitions for WANs -// - -// -// Bit field set int he Reserved field for -// NdisRegisterMiniport or passed in NdisRegisterSpecial -// - -#define NDIS_USE_WAN_WRAPPER 0x00000001 - -#define NDIS_STATUS_TAPI_INDICATION ((NDIS_STATUS)0x40010080L) - - -// -// NDIS WAN Framing bits -// -#define RAS_FRAMING 0x00000001 -#define RAS_COMPRESSION 0x00000002 - -#define ARAP_V1_FRAMING 0x00000004 -#define ARAP_V2_FRAMING 0x00000008 -#define ARAP_FRAMING (ARAP_V1_FRAMING | ARAP_V2_FRAMING) - -#define PPP_MULTILINK_FRAMING 0x00000010 -#define PPP_SHORT_SEQUENCE_HDR_FORMAT 0x00000020 -#define PPP_MC_MULTILINK_FRAMING 0x00000040 - -#define PPP_FRAMING 0x00000100 -#define PPP_COMPRESS_ADDRESS_CONTROL 0x00000200 -#define PPP_COMPRESS_PROTOCOL_FIELD 0x00000400 -#define PPP_ACCM_SUPPORTED 0x00000800 - -#define SLIP_FRAMING 0x00001000 -#define SLIP_VJ_COMPRESSION 0x00002000 -#define SLIP_VJ_AUTODETECT 0x00004000 - -#define MEDIA_NRZ_ENCODING 0x00010000 -#define MEDIA_NRZI_ENCODING 0x00020000 -#define MEDIA_NLPID 0x00040000 - -#define RFC_1356_FRAMING 0x00100000 -#define RFC_1483_FRAMING 0x00200000 -#define RFC_1490_FRAMING 0x00400000 -#define LLC_ENCAPSULATION 0x00800000 - -#define SHIVA_FRAMING 0x01000000 -#define NBF_PRESERVE_MAC_ADDRESS 0x01000000 -#define PASS_THROUGH_MODE 0x10000000 - -#ifndef _WAN50_ -#define RAW_PASS_THROUGH_MODE 0x20000000 -#endif - -#define TAPI_PROVIDER 0x80000000 - -// -// NDIS WAN Information structures used -// by NDIS 3.1 Wan Miniport drivers -// -typedef struct _NDIS_WAN_INFO -{ - __out ULONG MaxFrameSize; - __out ULONG MaxTransmit; - __out ULONG HeaderPadding; - __out ULONG TailPadding; - __out ULONG Endpoints; - __out UINT MemoryFlags; - __out NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress; - __out ULONG FramingBits; - __out ULONG DesiredACCM; -} NDIS_WAN_INFO, *PNDIS_WAN_INFO; - -typedef struct _NDIS_WAN_SET_LINK_INFO -{ - __in NDIS_HANDLE NdisLinkHandle; - __in ULONG MaxSendFrameSize; - __in ULONG MaxRecvFrameSize; - ULONG HeaderPadding; - ULONG TailPadding; - __in ULONG SendFramingBits; - __in ULONG RecvFramingBits; - __in ULONG SendCompressionBits; - __in ULONG RecvCompressionBits; - __in ULONG SendACCM; - __in ULONG RecvACCM; -} NDIS_WAN_SET_LINK_INFO, *PNDIS_WAN_SET_LINK_INFO; - -typedef struct _NDIS_WAN_GET_LINK_INFO { - __in NDIS_HANDLE NdisLinkHandle; - __out ULONG MaxSendFrameSize; - __out ULONG MaxRecvFrameSize; - __out ULONG HeaderPadding; - __out ULONG TailPadding; - __out ULONG SendFramingBits; - __out ULONG RecvFramingBits; - __out ULONG SendCompressionBits; - __out ULONG RecvCompressionBits; - __out ULONG SendACCM; - __out ULONG RecvACCM; -} NDIS_WAN_GET_LINK_INFO, *PNDIS_WAN_GET_LINK_INFO; - -// -// NDIS WAN Bridging Options -// -#define BRIDGING_FLAG_LANFCS 0x00000001 -#define BRIDGING_FLAG_LANID 0x00000002 -#define BRIDGING_FLAG_PADDING 0x00000004 - -// -// NDIS WAN Bridging Capabilities -// -#define BRIDGING_TINYGRAM 0x00000001 -#define BRIDGING_LANID 0x00000002 -#define BRIDGING_NO_SPANNING_TREE 0x00000004 -#define BRIDGING_8021D_SPANNING_TREE 0x00000008 -#define BRIDGING_8021G_SPANNING_TREE 0x00000010 -#define BRIDGING_SOURCE_ROUTING 0x00000020 -#define BRIDGING_DEC_LANBRIDGE 0x00000040 - -// -// NDIS WAN Bridging Type -// -#define BRIDGING_TYPE_RESERVED 0x00000001 -#define BRIDGING_TYPE_8023_CANON 0x00000002 -#define BRIDGING_TYPE_8024_NO_CANON 0x00000004 -#define BRIDGING_TYPE_8025_NO_CANON 0x00000008 -#define BRIDGING_TYPE_FDDI_NO_CANON 0x00000010 -#define BRIDGING_TYPE_8024_CANON 0x00000400 -#define BRIDGING_TYPE_8025_CANON 0x00000800 -#define BRIDGING_TYPE_FDDI_CANON 0x00001000 - -typedef struct _NDIS_WAN_GET_BRIDGE_INFO -{ - __in NDIS_HANDLE NdisLinkHandle; - __out USHORT LanSegmentNumber; - __out UCHAR BridgeNumber; - __out UCHAR BridgingOptions; - __out ULONG BridgingCapabilities; - __out UCHAR BridgingType; - __out UCHAR MacBytes[6]; -} NDIS_WAN_GET_BRIDGE_INFO, *PNDIS_WAN_GET_BRIDGE_INFO; - -typedef struct _NDIS_WAN_SET_BRIDGE_INFO -{ - __in NDIS_HANDLE NdisLinkHandle; - __in USHORT LanSegmentNumber; - __in UCHAR BridgeNumber; - __in UCHAR BridgingOptions; - __in ULONG BridgingCapabilities; - __in UCHAR BridgingType; - __in UCHAR MacBytes[6]; -} NDIS_WAN_SET_BRIDGE_INFO, *PNDIS_WAN_SET_BRIDGE_INFO; - -// -// NDIS WAN Compression Information -// - -// -// Define MSCompType bit field, 0 disables all -// -#define NDISWAN_COMPRESSION 0x00000001 -#define NDISWAN_ENCRYPTION 0x00000010 -#define NDISWAN_40_ENCRYPTION 0x00000020 -#define NDISWAN_128_ENCRYPTION 0x00000040 -#define NDISWAN_56_ENCRYPTION 0x00000080 -#define NDISWAN_HISTORY_LESS 0x01000000 - -// -// Define CompType codes -// -#define COMPTYPE_OUI 0 -#define COMPTYPE_NT31RAS 254 -#define COMPTYPE_NONE 255 - - -typedef struct _NDIS_WAN_COMPRESS_INFO -{ - UCHAR SessionKey[8]; - ULONG MSCompType; - - // Fields above indicate NDISWAN capabilities. - // Fields below indicate MAC-specific capabilities. - - UCHAR CompType; - USHORT CompLength; - - union - { - struct - { - UCHAR CompOUI[3]; - UCHAR CompSubType; - UCHAR CompValues[32]; - } Proprietary; - - struct - { - UCHAR CompValues[32]; - } Public; - }; -} NDIS_WAN_COMPRESS_INFO; - -typedef NDIS_WAN_COMPRESS_INFO UNALIGNED *PNDIS_WAN_COMPRESS_INFO; - -typedef struct _NDIS_WAN_GET_COMP_INFO -{ - __in NDIS_HANDLE NdisLinkHandle; - __out NDIS_WAN_COMPRESS_INFO SendCapabilities; - __out NDIS_WAN_COMPRESS_INFO RecvCapabilities; -} NDIS_WAN_GET_COMP_INFO, *PNDIS_WAN_GET_COMP_INFO; - -typedef struct _NDIS_WAN_SET_COMP_INFO -{ - __in NDIS_HANDLE NdisLinkHandle; - __in NDIS_WAN_COMPRESS_INFO SendCapabilities; - __in NDIS_WAN_COMPRESS_INFO RecvCapabilities; -} NDIS_WAN_SET_COMP_INFO, *PNDIS_WAN_SET_COMP_INFO; - -// -// NDIS WAN Statistics Information -// - -typedef struct _NDIS_WAN_GET_STATS_INFO -{ - __in NDIS_HANDLE NdisLinkHandle; - __out ULONG BytesSent; - __out ULONG BytesRcvd; - __out ULONG FramesSent; - __out ULONG FramesRcvd; - __out ULONG CRCErrors; // Serial-like info only - __out ULONG TimeoutErrors; // Serial-like info only - __out ULONG AlignmentErrors; // Serial-like info only - __out ULONG SerialOverrunErrors; // Serial-like info only - __out ULONG FramingErrors; // Serial-like info only - __out ULONG BufferOverrunErrors; // Serial-like info only - __out ULONG BytesTransmittedUncompressed; // Compression info only - __out ULONG BytesReceivedUncompressed; // Compression info only - __out ULONG BytesTransmittedCompressed; // Compression info only - __out ULONG BytesReceivedCompressed; // Compression info only - __out ULONG TunnelPacketsRecieved; - __out ULONG TunnelRecievePacketsPending; - __out ULONG TunnelPacketsIndicatedUp; - __out ULONG TunnelRecievePacketsRejected; - __out ULONG TunnelPacketsSent; - __out ULONG TunnelPacketsSentComplete; - __out ULONG TunnelTransmitPacketsPending; - __out ULONG TunnelPacketsTransmitError; - __out ULONG TunnelPacketsSentError; - __out ULONG TunnelTransmitPacketsRejected; - __out ULONG TunnelAcksSent; - __out ULONG TunnelAcksSentComplete; - __out ULONG TunnelGeneric1; - __out ULONG TunnelGeneric2; - __out ULONG TunnelGeneric3; -} NDIS_WAN_GET_STATS_INFO, *PNDIS_WAN_GET_STATS_INFO; - -#define NdisMWanInitializeWrapper(NdisWrapperHandle, \ - SystemSpecific1, \ - SystemSpecific2, \ - SystemSpecific3) \ -{ \ - NdisMInitializeWrapper(NdisWrapperHandle, \ - SystemSpecific1, \ - SystemSpecific2, \ - SystemSpecific3); \ -} - -typedef struct _NDIS_MAC_LINE_UP -{ - __in ULONG LinkSpeed; - __in NDIS_WAN_QUALITY Quality; - __in USHORT SendWindow; - __in NDIS_HANDLE ConnectionWrapperID; - __in NDIS_HANDLE NdisLinkHandle; - __out NDIS_HANDLE NdisLinkContext; -} NDIS_MAC_LINE_UP, *PNDIS_MAC_LINE_UP; - - -typedef struct _NDIS_MAC_LINE_DOWN -{ - __in NDIS_HANDLE NdisLinkContext; -} NDIS_MAC_LINE_DOWN, *PNDIS_MAC_LINE_DOWN; - - -// -// These are the error values that can be indicated by the driver. -// This bit field is set when calling NdisIndicateStatus. -// -#define WAN_ERROR_CRC ((ULONG)0x00000001) -#define WAN_ERROR_FRAMING ((ULONG)0x00000002) -#define WAN_ERROR_HARDWAREOVERRUN ((ULONG)0x00000004) -#define WAN_ERROR_BUFFEROVERRUN ((ULONG)0x00000008) -#define WAN_ERROR_TIMEOUT ((ULONG)0x00000010) -#define WAN_ERROR_ALIGNMENT ((ULONG)0x00000020) - -typedef struct _NDIS_MAC_FRAGMENT -{ - __in NDIS_HANDLE NdisLinkContext; - __in ULONG Errors; -} NDIS_MAC_FRAGMENT, *PNDIS_MAC_FRAGMENT; - -// -// NDIS WAN Information structures used -// by NDIS 5.0 Miniport drivers -// - -// -// Defines for the individual fields are the -// same as for NDIS 3.x/4.x Wan miniports. -// -// See the DDK. -// - -// -// Information that applies to all VC's on -// this adapter. -// -// OID: OID_WAN_CO_GET_INFO -// -typedef struct _NDIS_WAN_CO_INFO { - __out ULONG MaxFrameSize; - __out ULONG MaxSendWindow; - __out ULONG FramingBits; - __out ULONG DesiredACCM; -} NDIS_WAN_CO_INFO, *PNDIS_WAN_CO_INFO; - -// -// Set VC specific PPP framing information. -// -// OID: OID_WAN_CO_SET_LINK_INFO -// -typedef struct _NDIS_WAN_CO_SET_LINK_INFO { - __in ULONG MaxSendFrameSize; - __in ULONG MaxRecvFrameSize; - __in ULONG SendFramingBits; - __in ULONG RecvFramingBits; - __in ULONG SendCompressionBits; - __in ULONG RecvCompressionBits; - __in ULONG SendACCM; - __in ULONG RecvACCM; -} NDIS_WAN_CO_SET_LINK_INFO, *PNDIS_WAN_CO_SET_LINK_INFO; - -// -// Get VC specific PPP framing information. -// -// OID: OID_WAN_CO_GET_LINK_INFO -// -typedef struct _NDIS_WAN_CO_GET_LINK_INFO { - __out ULONG MaxSendFrameSize; - __out ULONG MaxRecvFrameSize; - __out ULONG SendFramingBits; - __out ULONG RecvFramingBits; - __out ULONG SendCompressionBits; - __out ULONG RecvCompressionBits; - __out ULONG SendACCM; - __out ULONG RecvACCM; -} NDIS_WAN_CO_GET_LINK_INFO, *PNDIS_WAN_CO_GET_LINK_INFO; - -// -// Get VC specific PPP compression information -// -// OID: OID_WAN_CO_GET_COMP_INFO -// -typedef struct _NDIS_WAN_CO_GET_COMP_INFO { - __out NDIS_WAN_COMPRESS_INFO SendCapabilities; - __out NDIS_WAN_COMPRESS_INFO RecvCapabilities; -} NDIS_WAN_CO_GET_COMP_INFO, *PNDIS_WAN_CO_GET_COMP_INFO; - - -// -// Set VC specific PPP compression information -// -// OID: OID_WAN_CO_SET_COMP_INFO -// -typedef struct _NDIS_WAN_CO_SET_COMP_INFO { - __in NDIS_WAN_COMPRESS_INFO SendCapabilities; - __in NDIS_WAN_COMPRESS_INFO RecvCapabilities; -} NDIS_WAN_CO_SET_COMP_INFO, *PNDIS_WAN_CO_SET_COMP_INFO; - - -// -// Get VC specific statistics -// -// OID: OID_WAN_CO_GET_STATS_INFO -// -typedef struct _NDIS_WAN_CO_GET_STATS_INFO { - __out ULONG BytesSent; - __out ULONG BytesRcvd; - __out ULONG FramesSent; - __out ULONG FramesRcvd; - __out ULONG CRCErrors; // Serial-like info only - __out ULONG TimeoutErrors; // Serial-like info only - __out ULONG AlignmentErrors; // Serial-like info only - __out ULONG SerialOverrunErrors; // Serial-like info only - __out ULONG FramingErrors; // Serial-like info only - __out ULONG BufferOverrunErrors; // Serial-like info only - __out ULONG BytesTransmittedUncompressed; // Compression info only - __out ULONG BytesReceivedUncompressed; // Compression info only - __out ULONG BytesTransmittedCompressed; // Compression info only - __out ULONG BytesReceivedCompressed; // Compression info only - __out ULONG TunnelPacketsRecieved; - __out ULONG TunnelRecievePacketsPending; - __out ULONG TunnelPacketsIndicatedUp; - __out ULONG TunnelRecievePacketsRejected; - __out ULONG TunnelPacketsSent; - __out ULONG TunnelPacketsSentComplete; - __out ULONG TunnelTransmitPacketsPending; - __out ULONG TunnelPacketsTransmitError; - __out ULONG TunnelPacketsSentError; - __out ULONG TunnelTransmitPacketsRejected; - __out ULONG TunnelAcksSent; - __out ULONG TunnelAcksSentComplete; - __out ULONG TunnelGeneric1; - __out ULONG TunnelGeneric2; - __out ULONG TunnelGeneric3; -} NDIS_WAN_CO_GET_STATS_INFO, *PNDIS_WAN_CO_GET_STATS_INFO; - -// -// Used to notify NdisWan of Errors. See error -// bit mask in ndiswan.h -// -// NDIS_STATUS: NDIS_STATUS_WAN_CO_FRAGMENT -// -typedef struct _NDIS_WAN_CO_FRAGMENT { - __in ULONG Errors; -} NDIS_WAN_CO_FRAGMENT, *PNDIS_WAN_CO_FRAGMENT; - -// -// Used to notify NdisWan of changes in link speed and -// send window. Can be given at any time. NdisWan will honor -// any send window (even zero). NdisWan will default zero -// TransmitSpeed/ReceiveSpeed settings to 28.8Kbs. -// -// NDIS_STATUS: NDIS_STATUS_WAN_CO_LINKPARAMS -// -typedef struct _WAN_CO_LINKPARAMS { - ULONG TransmitSpeed; // Transmit speed of the VC in Bytes/sec - ULONG ReceiveSpeed; // Receive speed of the VC in Bytes/sec - ULONG SendWindow; // Current send window for the VC -} WAN_CO_LINKPARAMS, *PWAN_CO_LINKPARAMS; - - -// -// Used to notify NdisWan of changes in link speed and -// send window. Can be given at any time. NdisWan will honor -// any send window (even zero). NdisWan will default zero -// TransmitSpeed/ReceiveSpeed settings to 28.8Kbs. -// -// NDIS_STATUS: NDIS_STATUS_WAN_CO_MTULINKPARAMS -// - -typedef struct _WAN_CO_MTULINKPARAMS { - ULONG Version; // Specifies the version: In future it can be extended using this version field: Current Supported version: 1 - ULONG TransmitSpeed; // Transmit speed of the VC in Bytes/sec - ULONG ReceiveSpeed; // Receive speed of the VC in Bytes/sec - ULONG SendWindow; // Current send window for the VC - ULONG MTU; // MTU for the current Vc -} WAN_CO_MTULINKPARAMS, *PWAN_CO_MTULINKPARAMS; - -#endif // _NDIS_WAN - diff --git a/pub/ddk/ndiswwan.h b/pub/ddk/ndiswwan.h deleted file mode 100644 index 21652bf..0000000 --- a/pub/ddk/ndiswwan.h +++ /dev/null @@ -1,285 +0,0 @@ -/*++ -Copyright (c) 2007 Microsoft Corporation - -Module Name: - ndiswwan.h - -Abstract: - Header file for WWAN structures - -Revision History: - DATE DESCRIPTION - ------------ ----------- - 23-FEB-2007 V0.40 Driver Model Compliant - 23-MAY-2007 V0.50 Driver Model Compliant - 02-APR-2008 V1.00 Driver Model Compliant ---*/ - -#ifndef __NDIS_WWAN_DECL__ -#define __NDIS_WWAN_DECL__ - -/////////////////////////////////////////////////////////////////////////// -// wwansvc requests // -/////////////////////////////////////////////////////////////////////////// - -#define NDIS_WWAN_DRIVER_CAPS_REVISION_1 1 - -typedef struct _NDIS_WWAN_DRIVER_CAPS { - NDIS_OBJECT_HEADER Header; - WWAN_DRIVER_CAPS DriverCaps; -} NDIS_WWAN_DRIVER_CAPS, *PNDIS_WWAN_DRIVER_CAPS; - -#define NDIS_WWAN_SERVICE_ACTIVATION_REVISION_1 1 - -typedef struct _NDIS_WWAN_SERVICE_ACTIVATION { - NDIS_OBJECT_HEADER Header; - WWAN_SERVICE_ACTIVATION ServiceActivation; -} NDIS_WWAN_SERVICE_ACTIVATION, *PNDIS_WWAN_SERVICE_ACTIVATION; - -#define NDIS_WWAN_SET_RADIO_STATE_REVISION_1 1 - -typedef struct _NDIS_WWAN_SET_RADIO_STATE { - NDIS_OBJECT_HEADER Header; - WWAN_RADIO RadioAction; -} NDIS_WWAN_SET_RADIO_STATE, *PNDIS_WWAN_SET_RADIO_STATE; - -#define NDIS_WWAN_SET_PIN_REVISION_1 1 - -typedef struct _NDIS_WWAN_SET_PIN { - NDIS_OBJECT_HEADER Header; - WWAN_PIN_ACTION PinAction; -} NDIS_WWAN_SET_PIN, *PNDIS_WWAN_SET_PIN; - -#define NDIS_WWAN_SET_PREFERRED_PROVIDERS_REVISION_1 1 - -typedef struct _NDIS_WWAN_SET_PREFERRED_PROVIDERS { - NDIS_OBJECT_HEADER Header; - WWAN_LIST_HEADER PreferredListHeader; -} NDIS_WWAN_SET_PREFERRED_PROVIDERS, *PNDIS_WWAN_SET_PREFERRED_PROVIDERS; - -#define NDIS_WWAN_SET_REGISTER_STATE_REVISION_1 1 - -typedef struct _NDIS_WWAN_SET_REGISTER_STATE { - NDIS_OBJECT_HEADER Header; - WWAN_SET_REGISTER_STATE SetRegisterState; -} NDIS_WWAN_SET_REGISTER_STATE, *PNDIS_WWAN_SET_REGISTER_STATE; - -#define NDIS_WWAN_SET_SIGNAL_INDICATION_REVISION_1 1 - -typedef struct _NDIS_WWAN_SET_SIGNAL_INDICATION { - NDIS_OBJECT_HEADER Header; - WWAN_SET_SIGNAL_INDICATION SignalIndication; -} NDIS_WWAN_SET_SIGNAL_INDICATION, *PNDIS_WWAN_SET_SIGNAL_INDICATION; - -#define NDIS_WWAN_SET_PACKET_SERVICE_REVISION_1 1 - -typedef struct _NDIS_WWAN_SET_PACKET_SERVICE { - NDIS_OBJECT_HEADER Header; - WWAN_PACKET_SERVICE_ACTION PacketServiceAction; -} NDIS_WWAN_SET_PACKET_SERVICE, *PNDIS_WWAN_SET_PACKET_SERVICE; - -#define NDIS_WWAN_SET_PROVISIONED_CONTEXT_REVISION_1 1 - -typedef struct _NDIS_WWAN_SET_PROVISIONED_CONTEXT { - NDIS_OBJECT_HEADER Header; - WWAN_SET_CONTEXT ProvisionedContext; -} NDIS_WWAN_SET_PROVISIONED_CONTEXT, *PNDIS_WWAN_SET_PROVISIONED_CONTEXT; - -#define NDIS_WWAN_SET_CONTEXT_STATE_REVISION_1 1 - -typedef struct _NDIS_WWAN_SET_CONTEXT_STATE { - NDIS_OBJECT_HEADER Header; - WWAN_SET_CONTEXT_STATE SetContextState; -} NDIS_WWAN_SET_CONTEXT_STATE, *PNDIS_WWAN_SET_CONTEXT_STATE; - -#define NDIS_WWAN_SET_SMS_CONFIGURATION_REVISION_1 1 - -typedef struct _NDIS_WWAN_SET_SMS_CONFIGURATION { - NDIS_OBJECT_HEADER Header; - WWAN_SET_SMS_CONFIGURATION SetSmsConfiguration; -} NDIS_WWAN_SET_SMS_CONFIGURATION, *PNDIS_WWAN_SET_SMS_CONFIGURATION; - -#define NDIS_WWAN_SMS_READ_REVISION_1 1 - -typedef struct _NDIS_WWAN_SMS_READ { - NDIS_OBJECT_HEADER Header; - WWAN_SMS_READ SmsRead; -} NDIS_WWAN_SMS_READ, *PNDIS_WWAN_SMS_READ; - -#define NDIS_WWAN_SMS_SEND_REVISION_1 1 - -typedef struct _NDIS_WWAN_SMS_SEND { - NDIS_OBJECT_HEADER Header; - WWAN_SMS_SEND SmsSend; -} NDIS_WWAN_SMS_SEND, *PNDIS_WWAN_SMS_SEND; - -#define NDIS_WWAN_SMS_DELETE_REVISION_1 1 - -typedef struct _NDIS_WWAN_SMS_DELETE { - NDIS_OBJECT_HEADER Header; - WWAN_SMS_FILTER SmsFilter; -} NDIS_WWAN_SMS_DELETE, *PNDIS_WWAN_SMS_DELETE; - -/////////////////////////////////////////////////////////////////////////// -// device indications and responses // -/////////////////////////////////////////////////////////////////////////// - -#define NDIS_WWAN_DEVICE_CAPS_REVISION_1 1 - -typedef struct _NDIS_WWAN_DEVICE_CAPS { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_DEVICE_CAPS DeviceCaps; -} NDIS_WWAN_DEVICE_CAPS, *PNDIS_WWAN_DEVICE_CAPS; - -#define NDIS_WWAN_READY_INFO_REVISION_1 1 - -typedef struct _NDIS_WWAN_READY_INFO { - NDIS_OBJECT_HEADER Header; - WWAN_READY_INFO ReadyInfo; -} NDIS_WWAN_READY_INFO, *PNDIS_WWAN_READY_INFO; - -#define NDIS_WWAN_SERVICE_ACTIVATION_STATUS_REVISION_1 1 - -typedef struct _NDIS_WWAN_SERVICE_ACTIVATION_STATUS { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_SERVICE_ACTIVATION_STATUS ServiceActivationStatus; -} NDIS_WWAN_SERVICE_ACTIVATION_STATUS, *PNDIS_WWAN_SERVICE_ACTIVATION_STATUS; - -#define NDIS_WWAN_VENDOR_SPECIFIC_REVISION_1 1 - -typedef struct _NDIS_WWAN_VENDOR_SPECIFIC { - NDIS_OBJECT_HEADER Header; - WWAN_VENDOR_SPECIFIC VendorSpecificData; -} NDIS_WWAN_VENDOR_SPECIFIC, *PNDIS_WWAN_VENDOR_SPECIFIC; - -#define NDIS_WWAN_RADIO_STATE_REVISION_1 1 - -typedef struct _NDIS_WWAN_RADIO_STATE { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_RADIO_STATE RadioState; -} NDIS_WWAN_RADIO_STATE, *PNDIS_WWAN_RADIO_STATE; - -#define NDIS_WWAN_PIN_INFO_REVISION_1 1 - -typedef struct _NDIS_WWAN_PIN_INFO { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_PIN_INFO PinInfo; -} NDIS_WWAN_PIN_INFO, *PNDIS_WWAN_PIN_INFO; - -#define NDIS_WWAN_PIN_LIST_REVISION_1 1 - -typedef struct _NDIS_WWAN_PIN_LIST { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_PIN_LIST PinList; -} NDIS_WWAN_PIN_LIST, *PNDIS_WWAN_PIN_LIST; - -#define NDIS_WWAN_HOME_PROVIDER_REVISION_1 1 - -typedef struct _NDIS_WWAN_HOME_PROVIDER { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_PROVIDER Provider; -} NDIS_WWAN_HOME_PROVIDER, *PNDIS_WWAN_HOME_PROVIDER; - -#define NDIS_WWAN_PREFERRED_PROVIDERS_REVISION_1 1 - -typedef struct _NDIS_WWAN_PREFERRED_PROVIDERS { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_LIST_HEADER PreferredListHeader; -} NDIS_WWAN_PREFERRED_PROVIDERS, *PNDIS_WWAN_PREFERRED_PROVIDERS; - -#define NDIS_WWAN_VISIBLE_PROVIDERS_REVISION_1 1 - -typedef struct _NDIS_WWAN_VISIBLE_PROVIDERS { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_LIST_HEADER VisibleListHeader; -} NDIS_WWAN_VISIBLE_PROVIDERS, *PNDIS_WWAN_VISIBLE_PROVIDERS; - -#define NDIS_WWAN_REGISTRATION_STATE_REVISION_1 1 - -typedef struct _NDIS_WWAN_REGISTRATION_STATE { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_REGISTRATION_STATE RegistrationState; -} NDIS_WWAN_REGISTRATION_STATE, *PNDIS_WWAN_REGISTRATION_STATE; - -#define NDIS_WWAN_SIGNAL_STATE_REVISION_1 1 - -typedef struct _NDIS_WWAN_SIGNAL_STATE { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_SIGNAL_STATE SignalState; -} NDIS_WWAN_SIGNAL_STATE, *PNDIS_WWAN_SIGNAL_STATE; - -#define NDIS_WWAN_PACKET_SERVICE_STATE_REVISION_1 1 - -typedef struct _NDIS_WWAN_PACKET_SERVICE_STATE { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_PACKET_SERVICE PacketService; -} NDIS_WWAN_PACKET_SERVICE_STATE, *PNDIS_WWAN_PACKET_SERVICE_STATE; - -#define NDIS_WWAN_CONTEXT_STATE_REVISION_1 1 - -typedef struct _NDIS_WWAN_CONTEXT_STATE { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_CONTEXT_STATE ContextState; -} NDIS_WWAN_CONTEXT_STATE, *PNDIS_WWAN_CONTEXT_STATE; - -#define NDIS_WWAN_PROVISIONED_CONTEXTS_REVISION_1 1 - -typedef struct _NDIS_WWAN_PROVISIONED_CONTEXTS { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_LIST_HEADER ContextListHeader; -} NDIS_WWAN_PROVISIONED_CONTEXTS, *PNDIS_WWAN_PROVISIONED_CONTEXTS; - -#define NDIS_WWAN_SMS_CONFIGURATION_REVISION_1 1 - -typedef struct _NDIS_WWAN_SMS_CONFIGURATION { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_SMS_CONFIGURATION SmsConfiguration; -} NDIS_WWAN_SMS_CONFIGURATION, *PNDIS_WWAN_SMS_CONFIGURATION; - -#define NDIS_WWAN_SMS_RECEIVE_REVISION_1 1 - -typedef struct _NDIS_WWAN_SMS_RECEIVE { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_LIST_HEADER SmsListHeader; -} NDIS_WWAN_SMS_RECEIVE, *PNDIS_WWAN_SMS_RECEIVE; - -#define NDIS_WWAN_SMS_SEND_STATUS_REVISION_1 1 - -typedef struct _NDIS_WWAN_SMS_SEND_STATUS { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - ULONG MessageReference; -} NDIS_WWAN_SMS_SEND_STATUS, *PNDIS_WWAN_SMS_SEND_STATUS; - -#define NDIS_WWAN_SMS_DELETE_STATUS_REVISION_1 1 - -typedef struct _NDIS_WWAN_SMS_DELETE_STATUS { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; -} NDIS_WWAN_SMS_DELETE_STATUS, *PNDIS_WWAN_SMS_DELETE_STATUS; - -#define NDIS_WWAN_SMS_STATUS_REVISION_1 1 - -typedef struct _NDIS_WWAN_SMS_STATUS { - NDIS_OBJECT_HEADER Header; - WWAN_STATUS uStatus; - WWAN_SMS_STATUS SmsStatus; -} NDIS_WWAN_SMS_STATUS, *PNDIS_WWAN_SMS_STATUS; - -#endif - diff --git a/pub/ddk/ndr64types.h b/pub/ddk/ndr64types.h deleted file mode 100644 index e418d70..0000000 --- a/pub/ddk/ndr64types.h +++ /dev/null @@ -1,754 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ndr64types.h - -Abstract: - - Definitions for NDR64 format strings. - ---*/ - - - -#ifndef _NDR64TYPES_H -#define _NDR64TYPES_H - -#include - -#include // REVIEW: or just redefine GUID here -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif - -#pragma warning (disable: 4201) // nameless struct/union -#pragma warning (disable: 4214) // bitfield - - -typedef const void * FormatInfoRef; -#define INVALID_FRAGMENT_ID 0 - -/* -* Format string types -*/ -typedef unsigned __int8 NDR64_UINT8; -typedef unsigned __int16 NDR64_UINT16; -typedef unsigned __int32 NDR64_UINT32; -typedef unsigned __int64 NDR64_UINT64; - -typedef __int8 NDR64_INT8; -typedef __int16 NDR64_INT16; -typedef __int32 NDR64_INT32; -typedef __int64 NDR64_INT64; - -typedef NDR64_UINT8 NDR64_FORMAT_CHAR; -typedef const void * PNDR64_FORMAT; -typedef NDR64_UINT8 NDR64_ALIGNMENT; -typedef NDR64_UINT32 NDR64_FORMAT_UINT32; - - -#define NDR64_FC_EXPLICIT_HANDLE 0 -#define NDR64_FC_BIND_GENERIC 1 -#define NDR64_FC_BIND_PRIMITIVE 2 -#define NDR64_FC_AUTO_HANDLE 3 -#define NDR64_FC_CALLBACK_HANDLE 4 -#define NDR64_FC_NO_HANDLE 5 - - -#if defined(__RPC_WIN32__) -typedef NDR64_INT32 NDR64_PTR_WIRE_TYPE; -#else -typedef NDR64_INT64 NDR64_PTR_WIRE_TYPE; -#endif - -#define NDR64_PTR_WIRE_ALIGN (sizeof(NDR64_PTR_WIRE_TYPE)-1) - -typedef NDR64_UINT64 NDR64_WIRE_COUNT_TYPE; -#define NDR64_WIRE_COUNT_ALIGN (sizeof(NDR64_WIRE_COUNT_TYPE)-1) - -// -// Procedures and parameters -// - -typedef struct _NDR64_PROC_FLAGS -{ - NDR64_UINT32 HandleType : 3; // 0x00000000 - NDR64_UINT32 ProcType : 3; // 0x00000008 - NDR64_UINT32 IsInterpreted : 2; // 0x00000040 - NDR64_UINT32 IsObject : 1; // 0x00000100 - NDR64_UINT32 IsAsync : 1; // 0x00000200 - NDR64_UINT32 IsEncode : 1; // 0x00000400 - NDR64_UINT32 IsDecode : 1; // 0x00000800 - NDR64_UINT32 UsesFullPtrPackage : 1; // 0x00001000 - NDR64_UINT32 UsesRpcSmPackage : 1; // 0x00002000 - NDR64_UINT32 UsesPipes : 1; // 0x00004000 - NDR64_UINT32 HandlesExceptions : 2; // 0x00008000 - NDR64_UINT32 ServerMustSize : 1; // 0x00020000 - NDR64_UINT32 ClientMustSize : 1; // 0x00040000 - NDR64_UINT32 HasReturn : 1; // 0x00080000 - NDR64_UINT32 HasComplexReturn : 1; // 0x00100000 - NDR64_UINT32 ServerHasCorrelation : 1; // 0x00200000 - NDR64_UINT32 ClientHasCorrelation : 1; // 0x00400000 - NDR64_UINT32 HasNotify : 1; // 0x00800000 - NDR64_UINT32 HasOtherExtensions : 1; // 0x01000000 - NDR64_UINT32 HasBigByValueParam : 1; // 0x02000000 - NDR64_UINT32 Reserved : 6; // 0x04000000 -} NDR64_PROC_FLAGS; - -typedef struct _NDR64_RPC_FLAGS -{ - NDR64_UINT16 Idempotent : 1; - NDR64_UINT16 Broadcast : 1; - NDR64_UINT16 Maybe : 1; - NDR64_UINT16 Reserved0 : 1; - NDR64_UINT16 HasGuarantee : 1; - NDR64_UINT16 Reserved1 : 3; - NDR64_UINT16 Message : 1; - NDR64_UINT16 Reserved2 : 4; - NDR64_UINT16 InputSynchronous : 1; - NDR64_UINT16 Asynchronous : 1; - NDR64_UINT16 Reserved3 : 1; -} NDR64_RPC_FLAGS; - - -typedef struct _NDR64_PROC_FORMAT -{ - NDR64_UINT32 Flags; - NDR64_UINT32 StackSize; - NDR64_UINT32 ConstantClientBufferSize; - NDR64_UINT32 ConstantServerBufferSize; - NDR64_UINT16 RpcFlags; - NDR64_UINT16 FloatDoubleMask; - NDR64_UINT16 NumberOfParams; - NDR64_UINT16 ExtensionSize; -} NDR64_PROC_FORMAT, *PNDR64_PROC_FORMAT; - -typedef struct _NDR64_PARAM_FLAGS -{ - NDR64_UINT16 MustSize : 1; - NDR64_UINT16 MustFree : 1; - NDR64_UINT16 IsPipe : 1; - NDR64_UINT16 IsIn : 1; - NDR64_UINT16 IsOut : 1; - NDR64_UINT16 IsReturn : 1; - NDR64_UINT16 IsBasetype : 1; - NDR64_UINT16 IsByValue : 1; - NDR64_UINT16 IsSimpleRef : 1; - NDR64_UINT16 IsDontCallFreeInst : 1; - NDR64_UINT16 SaveForAsyncFinish : 1; - NDR64_UINT16 IsPartialIgnore : 1; - NDR64_UINT16 IsForceAllocate : 1; - NDR64_UINT16 Reserved : 2; - NDR64_UINT16 UseCache : 1; -} NDR64_PARAM_FLAGS; - - -typedef struct _NDR64_PARAM_FORMAT -{ - PNDR64_FORMAT Type; - NDR64_PARAM_FLAGS Attributes; - NDR64_UINT16 Reserved; - NDR64_UINT32 StackOffset; -} NDR64_PARAM_FORMAT, *PNDR64_PARAM_FORMAT; - - -// -// Base types -// - -typedef struct _NDR64_RANGE_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_FORMAT_CHAR RangeType; - NDR64_UINT16 Reserved; - NDR64_INT64 MinValue; - NDR64_INT64 MaxValue; -} NDR64_RANGE_FORMAT; - -// -// Handles & bindings -// - -typedef struct _NDR64_CONTEXT_HANDLE_FLAGS -{ - NDR64_UINT8 CannotBeNull : 1; - NDR64_UINT8 Serialize : 1; - NDR64_UINT8 NoSerialize : 1; - NDR64_UINT8 Strict : 1; - NDR64_UINT8 IsReturn : 1; - NDR64_UINT8 IsOut : 1; - NDR64_UINT8 IsIn : 1; - NDR64_UINT8 IsViaPointer : 1; -} NDR64_CONTEXT_HANDLE_FLAGS; - -typedef struct _NDR64_CONTEXT_HANDLE_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 ContextFlags; - NDR64_UINT8 RundownRoutineIndex; - NDR64_UINT8 Ordinal; -} NDR64_CONTEXT_HANDLE_FORMAT; - -typedef struct _NDR64_BIND_PRIMITIVE -{ - NDR64_FORMAT_CHAR HandleType; - NDR64_UINT8 Flags; - NDR64_UINT16 StackOffset; - NDR64_UINT16 Reserved; -} NDR64_BIND_PRIMITIVE; - -typedef struct _NDR64_BIND_GENERIC -{ - NDR64_FORMAT_CHAR HandleType; - NDR64_UINT8 Flags; - NDR64_UINT16 StackOffset; - NDR64_UINT8 RoutineIndex; - NDR64_UINT8 Size; -} NDR64_BIND_GENERIC; - -typedef struct _NDR64_BIND_CONTEXT -{ - NDR64_FORMAT_CHAR HandleType; - NDR64_UINT8 Flags; - NDR64_UINT16 StackOffset; - NDR64_UINT8 RoutineIndex; - NDR64_UINT8 Ordinal; -} NDR64_BIND_CONTEXT; - -typedef union _NDR64_BINDINGS -{ - NDR64_BIND_PRIMITIVE Primitive; - NDR64_BIND_GENERIC Generic; - NDR64_BIND_CONTEXT Context; -} NDR64_BINDINGS; - -// NOTE: The type of the Binding member below is actually NDR64_BINDINGS. -// We use NDR64_BIND_CONTEXT because it has essentially the same -// signature as the others and it makes static initilization clearer. - -typedef struct _NDR64_BIND_AND_NOTIFY_EXTENSION -{ - NDR64_BIND_CONTEXT Binding; - NDR64_UINT16 NotifyIndex; -} NDR64_BIND_AND_NOTIFY_EXTENSION; - - -// -// Pointers -// - -typedef struct _NDR64_POINTER_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Flags; - NDR64_UINT16 Reserved; - PNDR64_FORMAT Pointee; -} NDR64_POINTER_FORMAT; - -typedef struct _NDR64_NO_REPEAT_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Flags; - NDR64_UINT16 Reserved1; - NDR64_UINT32 Reserved2; -} NDR64_NO_REPEAT_FORMAT; - -typedef struct _NDR64_POINTER_INSTANCE_HEADER_FORMAT -{ - NDR64_UINT32 Offset; - NDR64_UINT32 Reserved; -} NDR64_POINTER_INSTANCE_HEADER_FORMAT; - -typedef struct _NDR64_POINTER_REPEAT_FLAGS -{ - NDR64_UINT8 SetCorrMark : 1; - NDR64_UINT8 Reserved : 7; -} NDR64_POINTER_REPEAT_FLAGS, *PNDR64_POINTER_REPEAT_FLAGS; - -typedef struct _NDR64_REPEAT_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_POINTER_REPEAT_FLAGS Flags; - NDR64_UINT16 Reserved; - NDR64_UINT32 Increment; - NDR64_UINT32 OffsetToArray; - NDR64_UINT32 NumberOfPointers; -} NDR64_REPEAT_FORMAT, *PNDR64_REPEAT_FORMAT; - -typedef struct _NDR64_FIXED_REPEAT_FORMAT -{ - NDR64_REPEAT_FORMAT RepeatFormat; - NDR64_UINT32 Iterations; - NDR64_UINT32 Reserved; -} NDR64_FIXED_REPEAT_FORMAT, *PNDR64_FIXED_REPEAT_FORMAT; - -typedef struct _NDR64_IID_FLAGS -{ - NDR64_UINT8 ConstantIID : 1; - NDR64_UINT8 Reserved : 7; -} NDR64_IID_FLAGS; - -typedef struct _NDR64_CONSTANT_IID_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Flags; - NDR64_UINT16 Reserved; - GUID Guid; -} NDR64_CONSTANT_IID_FORMAT; - -typedef struct _NDR64_IID_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Flags; - NDR64_UINT16 Reserved; - PNDR64_FORMAT IIDDescriptor; -} NDR64_IID_FORMAT; - -// -// Structures -// - -typedef struct _NDR64_STRUCTURE_FLAGS -{ - NDR64_UINT8 HasPointerInfo : 1; /* 1 */ - NDR64_UINT8 HasMemberInfo : 1; /* 2 */ - NDR64_UINT8 HasConfArray : 1; /* 3 */ - NDR64_UINT8 HasOrigPointerInfo : 1; /* 4 */ - NDR64_UINT8 HasOrigMemberInfo : 1; /* 5 */ - NDR64_UINT8 Reserved1 : 1; /* 6 */ - NDR64_UINT8 Reserved2 : 1; /* 7 */ - NDR64_UINT8 Reserved3 : 1; /* 8 */ -} NDR64_STRUCTURE_FLAGS; - -typedef struct _NDR64_STRUCTURE_HEADER_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_ALIGNMENT Alignment; - NDR64_STRUCTURE_FLAGS Flags; - NDR64_UINT8 Reserve; - NDR64_UINT32 MemorySize; -} NDR64_STRUCTURE_HEADER_FORMAT; - -typedef struct _NDR64_CONF_STRUCTURE_HEADER_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_ALIGNMENT Alignment; - NDR64_STRUCTURE_FLAGS Flags; - NDR64_UINT8 Reserve; - NDR64_UINT32 MemorySize; - PNDR64_FORMAT ArrayDescription; -} NDR64_CONF_STRUCTURE_HEADER_FORMAT; - -typedef struct _NDR64_BOGUS_STRUCTURE_HEADER_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_ALIGNMENT Alignment; - NDR64_STRUCTURE_FLAGS Flags; - NDR64_UINT8 Reserve; - NDR64_UINT32 MemorySize; - PNDR64_FORMAT OriginalMemberLayout; - PNDR64_FORMAT OriginalPointerLayout; - PNDR64_FORMAT PointerLayout; -} NDR64_BOGUS_STRUCTURE_HEADER_FORMAT; - -typedef struct _NDR64_CONF_BOGUS_STRUCTURE_HEADER_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_ALIGNMENT Alignment; - NDR64_STRUCTURE_FLAGS Flags; - NDR64_UINT8 Dimensions; - NDR64_UINT32 MemorySize; - PNDR64_FORMAT OriginalMemberLayout; - PNDR64_FORMAT OriginalPointerLayout; - PNDR64_FORMAT PointerLayout; - PNDR64_FORMAT ConfArrayDescription; -} NDR64_CONF_BOGUS_STRUCTURE_HEADER_FORMAT; - -/* -* Structure member layout components -*/ - -typedef struct _NDR64_SIMPLE_MEMBER_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Reserved1; - NDR64_UINT16 Reserved2; - NDR64_UINT32 Reserved3; -} NDR64_SIMPLE_MEMBER_FORMAT; - -typedef struct _NDR64_MEMPAD_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Reserve1; - NDR64_UINT16 MemPad; - NDR64_UINT32 Reserved2; -} NDR64_MEMPAD_FORMAT; - -typedef struct _NDR64_EMBEDDED_COMPLEX_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Reserve1; - NDR64_UINT16 Reserve2; - PNDR64_FORMAT Type; -} NDR64_EMBEDDED_COMPLEX_FORMAT; - -typedef struct _NDR64_BUFFER_ALIGN_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_ALIGNMENT Alignment; - NDR64_UINT16 Reserved; - NDR64_UINT32 Reserved2; -} NDR64_BUFFER_ALIGN_FORMAT; - -typedef struct _NDR64_SIMPLE_REGION_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_ALIGNMENT Alignment; - NDR64_UINT16 RegionSize; - NDR64_UINT32 Reserved; -} NDR64_SIMPLE_REGION_FORMAT; - -// -// Unions -// - -typedef struct _NDR64_ENCAPSULATED_UNION -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Alignment; - NDR64_UINT8 Flags; - NDR64_FORMAT_CHAR SwitchType; - NDR64_UINT32 MemoryOffset; - NDR64_UINT32 MemorySize; - NDR64_UINT32 Reserved; -} -NDR64_ENCAPSULATED_UNION; - -typedef struct _NDR64_NON_ENCAPSULATED_UNION -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Alignment; - NDR64_UINT8 Flags; - NDR64_FORMAT_CHAR SwitchType; - NDR64_UINT32 MemorySize; - PNDR64_FORMAT Switch; - NDR64_UINT32 Reserved; -} -NDR64_NON_ENCAPSULATED_UNION; - -typedef struct _NDR64_UNION_ARM_SELECTOR -{ - NDR64_UINT8 Reserved1; - NDR64_UINT8 Alignment; - NDR64_UINT16 Reserved2; - NDR64_UINT32 Arms; -} -NDR64_UNION_ARM_SELECTOR; - -typedef struct _NDR64_UNION_ARM -{ - NDR64_INT64 CaseValue; - PNDR64_FORMAT Type; - NDR64_UINT32 Reserved; -} -NDR64_UNION_ARM; - -/* -* Array related data -*/ - -typedef struct _NDR64_ARRAY_FLAGS -{ - NDR64_UINT8 HasPointerInfo : 1; /* 1 */ - NDR64_UINT8 HasElementInfo : 1; /* 2 */ - NDR64_UINT8 IsMultiDimensional : 1; /* 3 */ - NDR64_UINT8 IsArrayofStrings : 1; /* 4 */ - NDR64_UINT8 Reserved1 : 1; /* 5 */ - NDR64_UINT8 Reserved2 : 1; /* 6 */ - NDR64_UINT8 Reserved3 : 1; /* 7 */ - NDR64_UINT8 Reserved4 : 1; /* 8 */ -} NDR64_ARRAY_FLAGS; - -typedef struct _NDR64_ARRAY_ELEMENT_INFO -{ - NDR64_UINT32 ElementMemSize; - PNDR64_FORMAT Element; -} NDR64_ARRAY_ELEMENT_INFO; - -typedef struct _NDR64_FIX_ARRAY_HEADER_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_ALIGNMENT Alignment; - NDR64_ARRAY_FLAGS Flags; - NDR64_UINT8 Reserved; - NDR64_UINT32 TotalSize; -} NDR64_FIX_ARRAY_HEADER_FORMAT; - -typedef struct _NDR64_CONF_ARRAY_HEADER_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_ALIGNMENT Alignment; - NDR64_ARRAY_FLAGS Flags; - NDR64_UINT8 Reserved; - NDR64_UINT32 ElementSize; - PNDR64_FORMAT ConfDescriptor; -} NDR64_CONF_ARRAY_HEADER_FORMAT; - -typedef struct _NDR64_CONF_VAR_ARRAY_HEADER_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_ALIGNMENT Alignment; - NDR64_ARRAY_FLAGS Flags; - NDR64_UINT8 Reserved; - NDR64_UINT32 ElementSize; - PNDR64_FORMAT ConfDescriptor; - PNDR64_FORMAT VarDescriptor; -} NDR64_CONF_VAR_ARRAY_HEADER_FORMAT; - -typedef struct _NDR64_VAR_ARRAY_HEADER_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_ALIGNMENT Alignment; - NDR64_ARRAY_FLAGS Flags; - NDR64_UINT8 Reserved; - NDR64_UINT32 TotalSize; - NDR64_UINT32 ElementSize; - PNDR64_FORMAT VarDescriptor; -} NDR64_VAR_ARRAY_HEADER_FORMAT; - -typedef struct _NDR64_BOGUS_ARRAY_HEADER_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_ALIGNMENT Alignment; - NDR64_ARRAY_FLAGS Flags; - NDR64_UINT8 NumberDims; - NDR64_UINT32 NumberElements; - PNDR64_FORMAT Element; -} NDR64_BOGUS_ARRAY_HEADER_FORMAT; - -typedef struct _NDR64_CONF_VAR_BOGUS_ARRAY_HEADER_FORMAT -{ - NDR64_BOGUS_ARRAY_HEADER_FORMAT FixedArrayFormat; - PNDR64_FORMAT ConfDescription; - PNDR64_FORMAT VarDescription; - PNDR64_FORMAT OffsetDescription; -} NDR64_CONF_VAR_BOGUS_ARRAY_HEADER_FORMAT; - -/* -* String related data. -*/ - -typedef struct _NDR64_STRING_FLAGS -{ - NDR64_UINT8 IsSized : 1; - NDR64_UINT8 IsRanged : 1; - NDR64_UINT8 Reserved3 : 1; - NDR64_UINT8 Reserved4 : 1; - NDR64_UINT8 Reserved5 : 1; - NDR64_UINT8 Reserved6 : 1; - NDR64_UINT8 Reserved7 : 1; - NDR64_UINT8 Reserved8 : 1; -} NDR64_STRING_FLAGS; - -typedef struct NDR64_STRING_HEADER_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_STRING_FLAGS Flags; - NDR64_UINT16 ElementSize; -} NDR64_STRING_HEADER_FORMAT; - -typedef struct _NDR64_NON_CONFORMANT_STRING_FORMAT -{ - NDR64_STRING_HEADER_FORMAT Header; - NDR64_UINT32 TotalSize; -} NDR64_NON_CONFORMANT_STRING_FORMAT; - -#if NTDDI_VERSION >= NTDDI_VISTA -typedef struct _NDR64_RANGED_STRING_FORMAT -{ - NDR64_STRING_HEADER_FORMAT Header; - NDR64_UINT32 Reserved; - NDR64_UINT64 Min; - NDR64_UINT64 Max; -} NDR64_RANGED_STRING_FORMAT; -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - -typedef struct _NDR64_CONFORMANT_STRING_FORMAT -{ - NDR64_STRING_HEADER_FORMAT Header; -} NDR64_CONFORMANT_STRING_FORMAT; - -typedef struct NDR64_SIZED_CONFORMANT_STRING_FORMAT -{ - NDR64_STRING_HEADER_FORMAT Header; - PNDR64_FORMAT SizeDescription; -} NDR64_SIZED_CONFORMANT_STRING_FORMAT; - -// -// Correlation expressions -// - -typedef enum _tagEXPR_TOKEN -{ - FC_EXPR_START = 0, - FC_EXPR_ILLEGAL = FC_EXPR_START, - FC_EXPR_CONST32, - FC_EXPR_CONST64, - FC_EXPR_VAR, - FC_EXPR_OPER, - FC_EXPR_NOOP, // pad up the format string buffer. - FC_EXPR_END - -} EXPR_TOKEN; - -typedef struct _NDR64_EXPR_OPERATOR -{ - NDR64_FORMAT_CHAR ExprType; - NDR64_FORMAT_CHAR Operator; - NDR64_FORMAT_CHAR CastType; - NDR64_UINT8 Reserved; -} NDR64_EXPR_OPERATOR; - -typedef struct _NDR64_EXPR_CONST32 -{ - NDR64_FORMAT_CHAR ExprType; - NDR64_FORMAT_CHAR Reserved; - NDR64_UINT16 Reserved1; - NDR64_UINT32 ConstValue; -} NDR64_EXPR_CONST32; - -typedef struct _NDR64_EXPR_CONST64 -{ - NDR64_FORMAT_CHAR ExprType; - NDR64_FORMAT_CHAR Reserved; - NDR64_UINT16 Reserved1; - NDR64_INT64 ConstValue; -} NDR64_EXPR_CONST64; - -typedef struct _NDR64_EXPR_VAR -{ - NDR64_FORMAT_CHAR ExprType; - NDR64_FORMAT_CHAR VarType; - NDR64_UINT16 Reserved; - NDR64_UINT32 Offset; -} NDR64_EXPR_VAR; - -typedef struct _NDR64_EXPR_NOOP -{ - NDR64_FORMAT_CHAR ExprType; - NDR64_UINT8 Size; - NDR64_UINT16 Reserved; -} NDR64_EXPR_NOOP; - -// -// transmit_as, represent_as -// - -typedef struct _NDR64_TRANSMIT_AS_FLAGS -{ - NDR64_UINT8 PresentedTypeIsArray : 1; - NDR64_UINT8 PresentedTypeAlign4 : 1; - NDR64_UINT8 PresentedTypeAlign8 : 1; - NDR64_UINT8 Reserved : 5; -} NDR64_TRANSMIT_AS_FLAGS; - -typedef struct _NDR64_TRANSMIT_AS_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Flags; - NDR64_UINT16 RoutineIndex; - NDR64_UINT16 TransmittedTypeWireAlignment; - NDR64_UINT16 MemoryAlignment; - NDR64_UINT32 PresentedTypeMemorySize; - NDR64_UINT32 TransmittedTypeBufferSize; - PNDR64_FORMAT TransmittedType; -} NDR64_TRANSMIT_AS_FORMAT; - -typedef NDR64_TRANSMIT_AS_FORMAT NDR64_REPRESENT_AS_FORMAT; - -// -// user_marshal -// - -typedef struct _NDR64_USER_MARSHAL_FLAGS -{ - NDR64_UINT8 Reserved : 5; - NDR64_UINT8 IID : 1; - NDR64_UINT8 RefPointer : 1; - NDR64_UINT8 UniquePointer : 1; -} NDR64_USER_MARSHAL_FLAGS; - -typedef struct _NDR64_USER_MARSHAL_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Flags; - NDR64_UINT16 RoutineIndex; - NDR64_UINT16 TransmittedTypeWireAlignment; - NDR64_UINT16 MemoryAlignment; - NDR64_UINT32 UserTypeMemorySize; - NDR64_UINT32 TransmittedTypeBufferSize; - PNDR64_FORMAT TransmittedType; -} NDR64_USER_MARSHAL_FORMAT; - -// -// Pipes -// - -typedef struct NDR64_PIPE_FLAGS -{ - NDR64_UINT8 Reserved1 : 5; - NDR64_UINT8 HasRange : 1; - NDR64_UINT8 BlockCopy : 1; - NDR64_UINT8 Reserved2 : 1; -} NDR64_PIPE_FLAGS; - -typedef struct _NDR64_PIPE_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Flags; - NDR64_UINT8 Alignment; - NDR64_UINT8 Reserved; - PNDR64_FORMAT Type; - NDR64_UINT32 MemorySize; - NDR64_UINT32 BufferSize; -} NDR64_PIPE_FORMAT; - - -typedef struct _NDR64_RANGE_PIPE_FORMAT -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_UINT8 Flags; - NDR64_UINT8 Alignment; - NDR64_UINT8 Reserved; - PNDR64_FORMAT Type; - NDR64_UINT32 MemorySize; - NDR64_UINT32 BufferSize; - NDR64_UINT32 MinValue; - NDR64_UINT32 MaxValue; -} NDR64_RANGE_PIPE_FORMAT; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef struct _NDR64_TYPE_STRICT_CONTEXT_HANDLE -{ - NDR64_FORMAT_CHAR FormatCode; - NDR64_FORMAT_CHAR RealFormatCode; - NDR64_UINT16 Reserved; - PNDR64_FORMAT Type; - NDR64_UINT32 CtxtFlags; - NDR64_UINT32 CtxtID; -} NDR64_TYPE_STRICT_CONTEXT_HANDLE; -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - -#include - -#endif //_NDR64TYPES_H - - diff --git a/pub/ddk/netdma.h b/pub/ddk/netdma.h deleted file mode 100644 index c6dcf81..0000000 --- a/pub/ddk/netdma.h +++ /dev/null @@ -1,461 +0,0 @@ -/*++ - -Copyright (c) 2005-2006 Microsoft Corporation - -Module Name: - - netdma.h - -Abstract: - - This module contains function prototypes and definitons for memory to memory DMA - providers - -Author: - - -Revision history: - Nov 2006: Added support for a subset of IOAT V2 features (page break and descriptor ring) - Feb 2005: Original version - -Environment: - - kernel mode only - ---*/ -#ifndef _NET_DMA_H -#define _NET_DMA_H - -#if NTDDI_VERSION >= NTDDI_VISTASP1 - -#undef NET_DMA_EXPORT -#if defined(NET_DMA) -#define NET_DMA_EXPORT -#else -#define NET_DMA_EXPORT DECLSPEC_IMPORT -#endif - -// -// flags used in NET_DMA_DESCRIPTOR->ControlFlags -// -#define NET_DMA_INTERRUPT_ON_COMPLETION 0x00000001 -#define NET_DMA_SOURCE_NO_SNOOP 0x00000002 -#define NET_DMA_DESTINATION_NO_SNOOP 0x00000004 -#define NET_DMA_STATUS_UPDATE_ON_COMPLETION 0x00000008 -#define NET_DMA_SERIALIZE_TRANSFER 0x00000010 // fence bit -#define NET_DMA_NULL_TRANSFER 0x00000020 - -// -// new flags supported in NETDMA V2 -// - -#define NET_DMA_SOURCE_PAGE_BREAK 0x00000040 -#define NET_DMA_DESTINATION_PAGE_BREAK 0x00000080 -#define NET_DMA_DESTINATION_DCA_ENABLE 0x00000200 - -// -// flags used in NET_DMA_DESCRIPTOR->ControlFlags with NET_DMA_OP_TYPE_CONTEXT_CHANGE -// -#define NET_DMA_DCA_CONTEXT_CHANGE 0x00000001 - - -#define NET_DMA_OP_TYPE_STANDARD_DMA 0x00000000 -#define NET_DMA_OP_TYPE_CONTEXT_CHANGE 0xFF000000 - - -// -// The low 3 bits in "Completed Descriptor Address" are used -// to indicate the status of a DMA transfer. The physical and virtual address of -// "Completed Descriptor Address" of a DMA channel are specified -// by CompletionVirtualAddress and CompletionPhysicalAddress fields of -// NET_DMA_CHANNEL_PARAMETERS at the time of allocating a DMA channel -// -#define NET_DMA_TRANSFER_STATUS_MASK 0x00000007 - -typedef enum _NET_DMA_TRANSFER_STATUS -{ - NetDmaTransferStatusActive = 0, // 000 = Active, transfer completed successfully. This was -not- the last pending descriptor - NetDmaTransferStatusIdle = 1, // 001 = Idle, transfer completed successfully. This was the last pending descriptor - NetDmaTransferStatusSuspend = 2, // 010 = Suspend completed (no hard error). DMA channel is in Halt state - NetDmaTransferStatusHalted = 3, // 011 = Halted, operation aborted - NetDmaTransferStatusArmed = 4 // 100 = Armed, first descriptor has not yet completed and Completed Descriptor Address is not valid -} NET_DMA_TRANSFER_STATUS, *PNET_DMA_TRANSFER_STATUS; - - -// -// NET_DMA_DESCRIPTOR data structure is used to submit a dma transfer to DMA engine -// DMA descriptors can be chained together. Descriptor structure is modeled after -// CB DMA descriptors. DMA descriptors are aligned on 64 bit boundary -// -typedef struct _NET_DMA_DESCRIPTOR -{ - union - { - ULONG TransferSize; // DMA Transfer size - // DCA context = the APIC ID of the target CPU - struct - { - ULONG DCAContext:32; - }DCAContext32; - struct - { - ULONG DCAContext:16; - ULONG Reserved:16; - }DCAContext16; - struct - { - ULONG DCAContext:8; - ULONG Reserved:24; - }DCAContext8; - }; - - ULONG ControlFlags; // see NET_DMA_xxx flags - PHYSICAL_ADDRESS SourceAddress; // Source physical address - PHYSICAL_ADDRESS DestinationAddress; // Destination physical address - PHYSICAL_ADDRESS NextDescriptor; // Physical address of the next descriptor in the chain - union - { - ULONG64 Reserved1; // reserved for use by DMA engine (Provider) - PHYSICAL_ADDRESS NextSourceAddress; - }; - union - { - ULONG64 Reserved2; // reserved for use by DMA engine (Provider) - PHYSICAL_ADDRESS NextDestinationAddress; - }; - ULONG64 UserContext1; // Used by netdma driver and/or DMA client - ULONG64 UserContext2; // Used by netdma driver and/or DMA client -} NET_DMA_DESCRIPTOR, *PNET_DMA_DESCRIPTOR; - - -// -// DMA Provider entry points -// - -typedef struct _NET_DMA_CHANNEL_CPU_AFFINITY -{ - ULONG DmaChannel; - ULONG CpuNumber; -}NET_DMA_CHANNEL_CPU_AFFINITY,*PNET_DMA_CHANNEL_CPU_AFFINITY; - -// -// DMA channel CPU affinity handler. NETDMA calls this entry point to set the affinity -// policy of DMA channels -// -typedef -NTSTATUS -(*DMA_CHANNELS_CPU_AFFINITY_HANDLER)( - __in PVOID ProviderContext, // the Provider context passed to NetDmaRegisterProvider - __in PNET_DMA_CHANNEL_CPU_AFFINITY CpuAffinityArray, // see NET_DMA_CHANNEL_CPU_AFFINITY - __in ULONG CpuAffinityArraySize // size of CpuAffinityArray - ); - - -// -// NET_DMA_CHANNEL_PARAMETERS is used to set up a DMA channel -// at the time of allocating the channel -// - -#define NET_DMA_CHANNEL_REVISION_1 1 - -#define SIZEOF_NET_DMA_CHANNEL_PARAMETERS_REVISION_1 \ - RTL_SIZEOF_THROUGH_FIELD(NET_DMA_CHANNEL_PARAMETERS, CpuNumber) - -#if NTDDI_VERSION >= NTDDI_WIN7 - -#define NET_DMA_CHANNEL_REVISION_2 2 - -#define SIZEOF_NET_DMA_CHANNEL_PARAMETERS_REVISION_2 \ - RTL_SIZEOF_THROUGH_FIELD(NET_DMA_CHANNEL_PARAMETERS, ProcessorAffinityMaskEx) - -#endif - -typedef struct _NET_DMA_CHANNEL_PARAMETERS -{ - USHORT Revision; // Structure revision - USHORT Size; // size of this structure - ULONG Flags; // TBD - PVOID CompletionVirtualAddress; // the virtual address where the engine will write the completion status - PHYSICAL_ADDRESS CompletionPhysicalAddress; // the physical address where the engine will write the completion status - ULONG ProcessorAffinityMask; // bitmap of CPUs that this channel could be associated with (deprecated in Win7) - ULONG ChannelPriority; // per CB spec - ULONG CpuNumber; // provider will fill this with the CPU this channel is associated with -#if NTDDI_VERSION >= NTDDI_WIN7 - GROUP_AFFINITY ProcessorAffinityMaskEx; // group number and bitmap of CPUs that this channel could be associated with -#endif -} NET_DMA_CHANNEL_PARAMETERS, *PNET_DMA_CHANNEL_PARAMETERS; - -// -// DMA channel Allocate handler. NETDMA calls this entry point to allocate a DMA channel -// -typedef -NTSTATUS -(*DMA_CHANNEL_ALLOCATE_HANDLER)( - __in PVOID ProviderContext, // the Provider context passed to NetDmaRegisterProvider - __in PNET_DMA_CHANNEL_PARAMETERS ChannelParameters, // see NET_DMA_CHANNEL_PARAMETERS - __in PVOID NetDmaChannelHandle, // NETDMA handle for this channel. used by all calls from Provider to NETDMA regarding this channel - __deref_out PVOID * pProviderChannelContext // on return holds Provider context for this channel. used in all calls from NETDMA to provider regarding this channel - ); - -// -// NETDMA calls this entry point to free a DMA channel. When NETDMA calls this -// entry points, there are no outstanding DMA operations on this channel. Once -// NETDMA makes this call, it can not call the provider for any operation on the -// channel -// - -typedef -VOID -(*DMA_CHANNEL_FREE_HANDLER)( - __in PVOID ProviderChannelContext // Provider context for this channel (retuned from DMA_CHANNEL_ALLOCATE_HANDLER in pProviderChannelContext) - ); - -// -// NETDMA calls this entry point to start a DMA transfer -// -typedef -NTSTATUS -(*DMA_START_HANDLER)( - __in PVOID ProviderChannelContext, // Provider context for this channel - __in PNET_DMA_DESCRIPTOR DescriptorVirtualAddress, // pointer to the virtual address of the first descriptor - __in PHYSICAL_ADDRESS DescriptorPhysicalAddress, // pointer to the physical address of the first descriptor - __in ULONG DescriptorCount // number of descriptors - ); - -// -// NETDMA calls this entry point to suspend the DMA transfers -// currently in progress. The provider will return the -// physical address of the last DMA descriptor that it processed -// -typedef -NTSTATUS -(*DMA_SUSPEND_HANDLER)( - __in PVOID ProviderChannelContext, // Provider context for this channel - __deref_out PPHYSICAL_ADDRESS* pLastDescriptor // the physical address of the last processed descriptor - ); - -// -// NETDMA calls this entry point to resume DMA operations on -// a suspended DMA channel -// -typedef -NTSTATUS -(*DMA_RESUME_HANDLER)( - __in PVOID ProviderChannelContext // Provider context for this channel - ); - -// -// NETDMA calls this entry point to abort all DMA transfers -// that have been scheduled on a DMA channel -// -typedef -NTSTATUS -(*DMA_ABORT_HANDLER)( - __in PVOID ProviderChannelContext // Provider context for this channel - ); - -// -// NETDMA calls this entry point to append a chain of DMA descriptors -// to the last descriptor on a DMA channel -// -typedef -NTSTATUS -(*DMA_APPEND_HANDLER)( - __in PVOID ProviderChannelContext, // Provider context for this channel - __in PNET_DMA_DESCRIPTOR DescriptorVirtualAddress, // pointer to the virtual address of the first descriptor to append - __in PHYSICAL_ADDRESS DescriptorPhysicalAddress, // pointer to the physical address of the first descriptor to append - __in ULONG DescriptorCount // number of descriptors - ); - -// -// TBD: -// -typedef -NTSTATUS -(*DMA_RESET_HANDLER)( - __in PVOID ProviderChannelContext - ); - - -// -// DMA providers use NET_DMA_PROVIDER_CHARACTERISTICS structure in the call to -// NetDmaRegisterProvider -// -#define NET_DMA_PROVIDER_REVISION_1 1 -#define NET_DMA_PROVIDER_REVISION_2 2 - -// -// Flags for use in the NET_DMA_PROVIDER_CHARACTERISTICS structure -// -#define NET_DMA_PROVIDER_CHARACTERISTICS_DCA_SUPPORTED 0x00000001 - -#if NTDDI_VERSION >= NTDDI_WIN7 -#define NET_DMA_PROVIDER_SUPPORTS_PROC_GROUPS 0x00000002 -#endif - -// -// For back-compat with Vista headers -// -#if NTDDI_VERSION < NTDDI_WIN7 -#define NET_DMA_PROVIDER_ATTRIBUTES_DCA_SUPPORTED NET_DMA_PROVIDER_CHARACTERISTICS_DCA_SUPPORTED -#endif - - - -typedef struct _NET_DMA_PROVIDER_CHARACTERISTICS -{ - UCHAR MajorVersion; // Major version of the DMA provider - UCHAR MinorVersion; // Minor version of the DMA provider - USHORT Size; // the size of this structure - ULONG Flags; // Possible values listed below - PDEVICE_OBJECT PhysicalDeviceObject; // The physical device object PnP associates with this device - ULONG MaxDmaChannelCount; // Maximum number of DMA channels - DMA_CHANNELS_CPU_AFFINITY_HANDLER SetDmaChannelCpuAffinity; // Set channel CPU affinity handler - DMA_CHANNEL_ALLOCATE_HANDLER AllocateDmaChannel; // Allocate DMA channel handler - DMA_CHANNEL_FREE_HANDLER FreeDmaChannel; // Free DMA channel handler - DMA_START_HANDLER StartDma; // Start DMA handler - DMA_SUSPEND_HANDLER SuspendDma; // Suspend DMA handler - DMA_RESUME_HANDLER ResumeDma; // Resume DMA handler - DMA_ABORT_HANDLER AbortDma; // Abort DMA handler - DMA_APPEND_HANDLER AppendDma; // Append DMA handler - DMA_RESET_HANDLER ResetChannel; // Reset channel handler - UNICODE_STRING FriendlyName; // Provider's friendly name -} NET_DMA_PROVIDER_CHARACTERISTICS, *PNET_DMA_PROVIDER_CHARACTERISTICS; - -// -// DMA providers call NetDmaRegisterProvider to register an instance of a -// DMA provider. An instance of a DMA provider is associated with a device -// (DMA engine). Providers usually make this call in their AddDevice entry point. -// Note: the reason that the call has to be made during AddDevice and not -// START IRP is because allocating MSI-X resources has to be done in -// FILTER_RESOURCE_REQUIREMENTS that is sent to the device drivers before -// the START IRP -// -__drv_requiresIRQL(PASSIVE_LEVEL) -NET_DMA_EXPORT -NTSTATUS -NetDmaRegisterProvider( - __in PVOID ProviderContext, // Provider context for this device - __in PVOID * pNetDmaProviderHandle, // upon return, this will hold NETDMA handle for this device - __in PNET_DMA_PROVIDER_CHARACTERISTICS ProviderCharacteristics // provider's characteristics - ); - -// -// DMA providers call NetDmaDeregisterProvider to deregister a provider -// that was previously registered by a call to NetDmaRegisterProvider -// the call is usually made while handling REMOVE IRP. -// -__drv_requiresIRQL(PASSIVE_LEVEL) -NET_DMA_EXPORT -VOID -NetDmaDeregisterProvider( - __in PVOID NetDmaProviderHandle // Handle obtained by the call to NetDmaRegisterProvider - ); - -// -// DMA providers use this structure in the call to NetDmaProviderStart -// - -typedef struct _NET_DMA_PROVIDER_ATTRIBUTES -{ - UCHAR MajorHwVersion; // Major version of the DMA provider - UCHAR MinorHwVersion; // Minor version of the DMA provider - USHORT Size; // the size of this structure - ULONG Flags; // TBD - ULONG VendorId; // vendor ID - ULONG DmaChannelCount; // number of DMA channels - ULONG MaximumTransferSize; // Maximum DMA transfer size (minimum of 4K) - PHYSICAL_ADDRESS MaximumAddressSpace; // Maximum physical adddress that can be addressed by this device -} NET_DMA_PROVIDER_ATTRIBUTES, *PNET_DMA_PROVIDER_ATTRIBUTES; - -// -// DMA providers call NetDmaProviderStart to notify NETDMA that all the DMA channels -// on a provider are initialized and ready to be used. DMA providers call this API in the -// context of handling START IRP. -// -NET_DMA_EXPORT -VOID -NetDmaProviderStart( - __in PVOID NetDmaProviderHandle, // Handle obtained by the call to NetDmaRegisterProvider - __in PNET_DMA_PROVIDER_ATTRIBUTES ProviderAttributes // the provider's device attributes - ); - -// -// DMA providers call NetDmaProviderStop to notify NETDMA that a previously started -// DMA engine is no longer available. -// DMA providers call this API in the context of handling REMOVE or STOP IRP. NETDMA will wait -// for outstanding DMA operations to complete and frees all the DMA channels -// before returning back from this API -// -NET_DMA_EXPORT -VOID -NetDmaProviderStop( - __in PVOID NetDmaProviderHandle // Handle obtained by the call to NetDmaRegisterProvider - ); - -// -// DMA providers call NetDmaIsr in their ISR handler -// -NET_DMA_EXPORT -VOID -NetDmaIsr( - __in PVOID NetDmaChannelHandle, - __in PHYSICAL_ADDRESS DmaDescriptor, - __out PULONG pCpuNumber - ); - -// -// DMA providers call NetDmaInterruptDpc in their interrupt DPC handler -// -NET_DMA_EXPORT -VOID -NetDmaInterruptDpc( - __in PVOID NetDmaChannelHandle, // DMA channel - __in_opt PHYSICAL_ADDRESS DmaDescriptor // optional if this is called for reasons other DMA completion - ); - - -NET_DMA_EXPORT -UINT -NetDmaGetVersion( - VOID - ); - - -typedef enum _NET_DMA_PNP_NOTIFICATION_CODE -{ - NetDmaNotificationProviderRegistered = 1, // a provider has registered. not used by providers - NetDmaNotificationProviderArrival, // a provider is ready for use. not used by providers - NetDmaNotificationProviderRemoval, // a provider is about to be removed. not used by providers - NetDmaNotificationChannelArrival, // a DMA channel has become available. not used by providers - NetDmaNotificationProviderPowerDown, // the DMA provider is going to D3. - NetDmaNotificationProviderPowerUp, // the DMA provider is back to D0 - NetDmaNotificationMax -}NET_DMA_PNP_NOTIFICATION_CODE, *PNET_DMA_PNP_NOTIFICATION_CODE; - -#define NET_DMA_PNP_NOTIFICATION_REVISION_1 1 - -typedef struct _NET_DMA_PNP_NOTIFICATION -{ - ULONG StructureRevision; - ULONG StructureSize; - NET_DMA_PNP_NOTIFICATION_CODE NotificationCode; - PVOID Buffer; - ULONG BufferLength; -}NET_DMA_PNP_NOTIFICATION, *PNET_DMA_PNP_NOTIFICATION; - -// -// this API is available to Providers version 1.1 and above -// -NET_DMA_EXPORT -VOID -NetDmaPnPEventNotify( - __in PVOID NetDmaProviderHandle, // Provider handle - __in PNET_DMA_PNP_NOTIFICATION PnPEvent // PnP and Power Management event - ); - -#endif // NTDDI_VISTASP1 - -#endif //_NET_DMA_H - - diff --git a/pub/ddk/netioddk.h b/pub/ddk/netioddk.h deleted file mode 100644 index 622cc15..0000000 --- a/pub/ddk/netioddk.h +++ /dev/null @@ -1,254 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - netioddk.h - -Abstract: - - This module contains the DDK definitions and structures for the - network I/O subsystem. - -Environment: - - kernel mode only - ---*/ - -#ifndef _NETIODDK_ -#define _NETIODDK_ -#pragma once - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#pragma warning(push) -#pragma warning(disable:4200) // zero-sized array in struct/union - - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// -// These types define the pointers to constant data supplied by a client -// or provider during its registration. The data pointed to must be -// kept valid for the life of the registration. -// - -typedef CONST struct _NPI_CLIENT_CHARACTERISTICS * PNPI_CLIENT_CHARACTERISTICS; -typedef CONST struct _NPI_PROVIDER_CHARACTERISTICS * PNPI_PROVIDER_CHARACTERISTICS; -typedef CONST struct _NPI_REGISTRATION_INSTANCE * PNPI_REGISTRATION_INSTANCE; - -// -// Network Programming Interface Registration Instance: represents a -// registration of an implementation of a specific network programming -// interface by a specific network module. The information in this structure -// is specified by the module implementing an instance of a network -// programming interface. -// - -typedef struct _NPI_REGISTRATION_INSTANCE { - USHORT Version; - USHORT Size; - PNPIID NpiId; - PNPI_MODULEID ModuleId; - ULONG Number; - CONST VOID *NpiSpecificCharacteristics OPTIONAL; -} NPI_REGISTRATION_INSTANCE; - - -// -// A Network Programming Interface (NPI) is a well-defined table of function -// pointers and a caller-specific handle representing the caller of the -// functions. The handle is usually passed as a parameter to the functions -// as defined by the specific network programming interface definition. -// This structure is a place holder to opaquely describe network programming -// interfaces. It is usually cast to a specific NPI structure for use. -// -typedef struct _NPI { - HANDLE Handle; - CONST VOID* Dispatch; -} NPI; - - -typedef -NTSTATUS -(NTAPI NPI_CLIENT_ATTACH_PROVIDER_FN)( - __in HANDLE NmrBindingHandle, - __in PVOID ClientContext, - __in PNPI_REGISTRATION_INSTANCE ProviderRegistrationInstance - ); -typedef NPI_CLIENT_ATTACH_PROVIDER_FN *PNPI_CLIENT_ATTACH_PROVIDER_FN; - - -typedef -NTSTATUS -(NTAPI NPI_CLIENT_DETACH_PROVIDER_FN )( - __in PVOID ClientBindingContext - ); -typedef NPI_CLIENT_DETACH_PROVIDER_FN *PNPI_CLIENT_DETACH_PROVIDER_FN; - - -typedef -VOID -(NTAPI NPI_CLIENT_CLEANUP_BINDING_CONTEXT_FN)( - __in PVOID ClientBindingContext - ); -typedef NPI_CLIENT_CLEANUP_BINDING_CONTEXT_FN *PNPI_CLIENT_CLEANUP_BINDING_CONTEXT_FN; - - -typedef struct _NPI_CLIENT_CHARACTERISTICS { - USHORT Version; - USHORT Length; - PNPI_CLIENT_ATTACH_PROVIDER_FN ClientAttachProvider; - PNPI_CLIENT_DETACH_PROVIDER_FN ClientDetachProvider; - PNPI_CLIENT_CLEANUP_BINDING_CONTEXT_FN ClientCleanupBindingContext; - NPI_REGISTRATION_INSTANCE ClientRegistrationInstance; -} NPI_CLIENT_CHARACTERISTICS; - - -// -// Definition for provider side of structures and prototypes. -// -typedef -NTSTATUS -(NTAPI NPI_PROVIDER_ATTACH_CLIENT_FN)( - __in HANDLE NmrBindingHandle, - __in PVOID ProviderContext, - __in PNPI_REGISTRATION_INSTANCE ClientRegistrationInstance, - __in PVOID ClientBindingContext, - __in CONST VOID *ClientDispatch, - __out PVOID *ProviderBindingContext, - __out CONST VOID* *ProviderDispatch - ); -typedef NPI_PROVIDER_ATTACH_CLIENT_FN *PNPI_PROVIDER_ATTACH_CLIENT_FN; - - -typedef -NTSTATUS -(NTAPI NPI_PROVIDER_DETACH_CLIENT_FN)( - __in PVOID ProviderBindingContext - ); -typedef NPI_PROVIDER_DETACH_CLIENT_FN *PNPI_PROVIDER_DETACH_CLIENT_FN; - - -typedef -VOID -(NTAPI NPI_PROVIDER_CLEANUP_BINDING_CONTEXT_FN)( - __in PVOID ProviderBindingContext - ); -typedef NPI_PROVIDER_CLEANUP_BINDING_CONTEXT_FN *PNPI_PROVIDER_CLEANUP_BINDING_CONTEXT_FN; - - -typedef struct _NPI_PROVIDER_CHARACTERISTICS { - USHORT Version; - USHORT Length; - PNPI_PROVIDER_ATTACH_CLIENT_FN ProviderAttachClient; - PNPI_PROVIDER_DETACH_CLIENT_FN ProviderDetachClient; - PNPI_PROVIDER_CLEANUP_BINDING_CONTEXT_FN ProviderCleanupBindingContext; - NPI_REGISTRATION_INSTANCE ProviderRegistrationInstance; -} NPI_PROVIDER_CHARACTERISTICS; - - -// -// Called by a module to register an instance of an implementation of the -// client side of a particular network programming interface. -// -NTSTATUS -NmrRegisterClient( - __in PNPI_CLIENT_CHARACTERISTICS ClientCharacteristics, - __in PVOID ClientContext, - __out PHANDLE NmrClientHandle - ); - -// -// Called by a module to un-register an instance of an implementation of the -// client side of a particular network programming interface. -// -NTSTATUS -NmrDeregisterClient( - __in HANDLE NmrClientHandle - ); - -// -// Called by a client to close a registration. -// -NTSTATUS -NmrWaitForClientDeregisterComplete( - __in HANDLE NmrClientHandle - ); - -// -// Called by a client module to attach itself to a provider. -// -NTSTATUS -NmrClientAttachProvider( - __in HANDLE NmrBindingHandle, - __in PVOID ClientBindingContext, - __in CONST VOID *ClientDispatch, - __out PVOID *ProviderBindingContext, - __out CONST VOID* *ProviderDispatch - ); - -// -// Called by a client module to indicate detach to a provider is -// complete. -// -VOID -NmrClientDetachProviderComplete( - __in HANDLE NmrBindingHandle - ); - - -// -// Called by a module to register an instance of an implementation of the -// provider side of a particular network programming interface. -// -NTSTATUS -NmrRegisterProvider( - __in PNPI_PROVIDER_CHARACTERISTICS ProviderCharacteristics, - __in PVOID ProviderContext, - __out PHANDLE NmrProviderHandle - ); - -// -// Called by a module to un-register an instance of an implementation of the -// provider side of a particular network programming interface. -// -NTSTATUS -NmrDeregisterProvider( - __in HANDLE NmrProviderHandle - ); - -// -// Called by a provider to close a registration. -// -NTSTATUS -NmrWaitForProviderDeregisterComplete( - __in HANDLE NmrProviderHandle - ); - -// -// Called by a provider module to notify NMR that a detach from client -// is complete. -// -VOID -NmrProviderDetachClientComplete( - __in HANDLE NmrBindingHandle - ); - -#endif // if (NTDDI_VERSION >= NTDDI_VISTA) - - -#pragma warning(pop) - -#ifdef __cplusplus -} -#endif - -#endif // _NETIODDK_ - diff --git a/pub/ddk/netpnp.h b/pub/ddk/netpnp.h deleted file mode 100644 index 9a0fa45..0000000 --- a/pub/ddk/netpnp.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef __NET_PNP__ -#define __NET_PNP__ - -#pragma once - -// -// PnP and PM event codes that can be indicated up to transports -// and clients. -// -typedef enum _NET_PNP_EVENT_CODE -{ - NetEventSetPower, - NetEventQueryPower, - NetEventQueryRemoveDevice, - NetEventCancelRemoveDevice, - NetEventReconfigure, - NetEventBindList, - NetEventBindsComplete, - NetEventPnPCapabilities, - NetEventPause, - NetEventRestart, - NetEventPortActivation, - NetEventPortDeactivation, - NetEventIMReEnableDevice, - NetEventMaximum -} NET_PNP_EVENT_CODE, *PNET_PNP_EVENT_CODE; - -// -// Networking PnP event indication structure. -// -typedef struct _NET_PNP_EVENT -{ - // - // Event code describing action to take. - // - NET_PNP_EVENT_CODE NetEvent; - - // - // Event specific data. - // - PVOID Buffer; - - // - // Length of event specific data. - // - ULONG BufferLength; - - // - // Reserved values are for use by respective components only. - // - // Note: these reserved areas must be pointer aligned. - // - - ULONG_PTR NdisReserved[4]; - ULONG_PTR TransportReserved[4]; - ULONG_PTR TdiReserved[4]; - ULONG_PTR TdiClientReserved[4]; -} NET_PNP_EVENT, *PNET_PNP_EVENT; - -// -// The following structure defines the device power states. -// -typedef enum _NET_DEVICE_POWER_STATE -{ - NetDeviceStateUnspecified = 0, - NetDeviceStateD0, - NetDeviceStateD1, - NetDeviceStateD2, - NetDeviceStateD3, - NetDeviceStateMaximum -} NET_DEVICE_POWER_STATE, *PNET_DEVICE_POWER_STATE; - -#endif // __NET_PNP__ - diff --git a/pub/ddk/nodetype.h b/pub/ddk/nodetype.h deleted file mode 100644 index 6cb5b16..0000000 --- a/pub/ddk/nodetype.h +++ /dev/null @@ -1,243 +0,0 @@ -/*++ - -Copyright (c) 1989 Microsoft Corporation - -Module Name: - - NodeType.h - -Abstract: - - This module defines all of the node type codes used in the RDBSS. - Every major data structure in the file system is assigned a node - type code that is. This code is the first CSHORT in the structure and is - followed by a CSHORT containing the size, in bytes, of the structure. - -Author: -Revision History: - ---*/ - -#ifndef _NODETYPE_INCLUDED_ -#define _NODETYPE_INCLUDED_ - - -typedef USHORT NODE_TYPE_CODE; -typedef NODE_TYPE_CODE *PNODE_TYPE_CODE; -typedef CSHORT NODE_BYTE_SIZE; - -// -// So all records start with -// -// typedef struct _RECORD_NAME { -// NODE_TYPE_CODE NodeTypeCode; -// NODE_BYTE_SIZE NodeByteSize; -// : -// } RECORD_NAME, *PRECORD_NAME; -// - -#ifndef NodeType -#define NodeType(Ptr) (*((PNODE_TYPE_CODE)(Ptr))) -#endif - - -typedef struct _NODE_TYPE_CODE_AND_SIZE_NO_REFCOUNT { - NODE_TYPE_CODE NodeTypeCode; - NODE_BYTE_SIZE NodeByteSize; -} NODE_TYPE_CODE_AND_SIZE_NO_REFCOUNT; - -#ifdef __cplusplus -typedef struct _NODE_TYPE_CODE_AND_SIZE : public NODE_TYPE_CODE_AND_SIZE_NO_REFCOUNT { -#else // !__cplusplus -typedef struct _NODE_TYPE_CODE_AND_SIZE { - NODE_TYPE_CODE_AND_SIZE_NO_REFCOUNT; -#endif // __cplusplus - - // - // this is for guys with reference counts....not everyone has one - // - - __volatile ULONG NodeReferenceCount; -} NODE_TYPE_CODE_AND_SIZE, *PNODE_TYPE_AND_SIZE; - - -#define ZeroAndInitializeNodeType(Ptr,TType,Size) {\ - RtlZeroMemory( Ptr, Size ); \ - ((NODE_TYPE_CODE_AND_SIZE *)(Ptr))->NodeTypeCode = TType; \ - ((NODE_TYPE_CODE_AND_SIZE *)(Ptr))->NodeByteSize = (CSHORT)Size; \ - } - - -// -// N O D E T Y P E S -// - - -// -// 0xeb00 was selected as being far from the other codes -// 0xec00 was added so that we could encode the structure type in the code. -// - -#define NTC_UNDEFINED ((NODE_TYPE_CODE)0x0000) - - - -#define RDBSS_STORAGE_NTC(x) (0xec00+(x)) - -// -// these are here to ensure that we don't use any of the old cairo storage types. -// - -#define StorageTypeDirectory (@@@) -#define StorageTypeFile (@@@) - -typedef enum _RX_FILE_TYPE { - FileTypeNotYetKnown = 0, - FileTypeDirectory = 2, - FileTypeFile = 3 -} RX_FILE_TYPE; - -// -// according to markz, i should plan on the number of STORAGE_NTCs growing to bytesize!! -// - -#define RDBSS_NTC_STORAGE_TYPE_UNKNOWN ((NODE_TYPE_CODE)0xec00) -#define RDBSS_NTC_STORAGE_TYPE_DIRECTORY ((NODE_TYPE_CODE)0xec02) -#define RDBSS_NTC_STORAGE_TYPE_FILE ((NODE_TYPE_CODE)0xec03) - -#define RDBSS_NTC_OPENTARGETDIR_FCB ((NODE_TYPE_CODE)0xecff) // must be an fcb type and not the same -#define RDBSS_NTC_IPC_SHARE ((NODE_TYPE_CODE)0xecfe) -#define RDBSS_NTC_MAILSLOT ((NODE_TYPE_CODE)0xecfd) -#define RDBSS_NTC_SPOOLFILE ((NODE_TYPE_CODE)0xecfc) - -#define RDBSS_NTC_SRVCALL ((NODE_TYPE_CODE)0xeb10) -#define RDBSS_NTC_NETROOT ((NODE_TYPE_CODE)0xeb11) -#define RDBSS_NTC_V_NETROOT ((NODE_TYPE_CODE)0xeb12) - -// -// Local filesystems sometimes need volume opens. these are not yet -// implemented but we reserve the nodetype now. -// - -#define RDBSS_NTC_VOLUME_FCB ((NODE_TYPE_CODE)0xeb1f) - -#define RDBSS_NTC_SRVOPEN ((NODE_TYPE_CODE)0xeb1c) -#define RDBSS_NTC_INTERNAL_SRVOPEN ((NODE_TYPE_CODE)0xeb1d) -#define RDBSS_NTC_DEVICE_FCB ((NODE_TYPE_CODE)0xeb9a) - -#define RDBSS_NTC_DATA_HEADER ((NODE_TYPE_CODE)0xeb00) -#define RDBSS_NTC_VCB ((NODE_TYPE_CODE)0xeb01) -#define RDBSS_NTC_FOBX ((NODE_TYPE_CODE)0xeb07) -#define RDBSS_NTC_RX_CONTEXT ((NODE_TYPE_CODE)0xeb08) - -#define RDBSS_NTC_PREFIX_TABLE ((NODE_TYPE_CODE)0xeb0d) -#define RDBSS_NTC_PREFIX_ENTRY ((NODE_TYPE_CODE)0xeb0e) - -#define RDBSS_NTC_FCB_TABLE ((NODE_TYPE_CODE)0xeb09) -#define RDBSS_NTC_FCB_TABLE_ENTRY ((NODE_TYPE_CODE)0xeb0a) - -#define RDBSS_NTC_RXCE_TRANSPORT ((NODE_TYPE_CODE)0xeb71) -#define RDBSS_NTC_RXCE_ADDRESS ((NODE_TYPE_CODE)0xeb72) -#define RDBSS_NTC_RXCE_CONNECTION ((NODE_TYPE_CODE)0xeb73) -#define RDBSS_NTC_RXCE_VC ((NODE_TYPE_CODE)0xeb74) - -#define RDBSS_NTC_NONPAGED_FCB ((NODE_TYPE_CODE)0xebfd) -#define RDBSS_NTC_COMMON_DISPATCH ((NODE_TYPE_CODE)0xebfe) -#define RDBSS_NTC_MINIRDR_DISPATCH ((NODE_TYPE_CODE)0xebff) - -typedef USHORT RDBSS_STORAGE_TYPE_CODES; - -#define RDBSS_NTC_FCB RDBSS_NTC_STORAGE_TYPE_FILE - -#define NodeTypeIsFcb( FCB ) \ - ((((NodeType(FCB) & 0xff00) == RDBSS_NTC_STORAGE_TYPE_UNKNOWN)) || ((NodeType( FCB ) & 0xfff0) == 0xeb90)) - -// -// a mask to alter the type of a data structure once it is marked for scavenging so -// that subsequent tests will fail. -// - -#define RX_SCAVENGER_MASK (0x1000) - - -// -// The following definitions are used to generate meaningful blue bugcheck -// screens. On a bugcheck the file system can output 4 ulongs of useful -// information. The first ulong will have encoded the line number of the -// bugcheck call in the low order 16 bits. The high order bits can be whatever -// the caller wants. In the wrapper, we actually define file identifiers as well. -// However, the system also displays quire a but of the backtrace; this shows -// the .sys file of the caller and it is frequently the case that the linenumber -// is completely disambiguating. -// - -// -// Each individual wrapper file that calls bugcheck has defined at the -// start of the file a constant called BugCheckFileId with one of the -// RDBSS_BUG_CHECK_ values defined below and then use RxBugCheck to bugcheck -// the system. -// - - -typedef enum _RDBSS_BUG_CHECK_CODES { - - RDBSS_BUG_CHECK_FCBSTRUC = 0xfcb00000, - RDBSS_BUG_CHECK_CACHESUP = 0xca550000, - RDBSS_BUG_CHECK_CLEANUP = 0xc1ee0000, - RDBSS_BUG_CHECK_CLOSE = 0xc10e0000, - RDBSS_BUG_CHECK_NTEXCEPT = 0xbaad0000, - -} RDBSS_BUG_CHECK_CODES; - -// we overload on the original redirector's bugcheck code using the stack -// backtrace to differentiate among consumers - -#define RDBSS_FILE_SYSTEM RDR_FILE_SYSTEM -#define RxBugCheck(A,B,C) { \ - KeBugCheckEx(RDBSS_FILE_SYSTEM, \ - BugCheckFileId | ((ULONG)(__LINE__)), \ - A, B, C ); \ - } - - -// -// In this module we'll also define some globally known constants -// - -#define UCHAR_NUL 0x00 -#define UCHAR_SOH 0x01 -#define UCHAR_STX 0x02 -#define UCHAR_ETX 0x03 -#define UCHAR_EOT 0x04 -#define UCHAR_ENQ 0x05 -#define UCHAR_ACK 0x06 -#define UCHAR_BEL 0x07 -#define UCHAR_BS 0x08 -#define UCHAR_HT 0x09 -#define UCHAR_LF 0x0a -#define UCHAR_VT 0x0b -#define UCHAR_FF 0x0c -#define UCHAR_CR 0x0d -#define UCHAR_SO 0x0e -#define UCHAR_SI 0x0f -#define UCHAR_DLE 0x10 -#define UCHAR_DC1 0x11 -#define UCHAR_DC2 0x12 -#define UCHAR_DC3 0x13 -#define UCHAR_DC4 0x14 -#define UCHAR_NAK 0x15 -#define UCHAR_SYN 0x16 -#define UCHAR_ETB 0x17 -#define UCHAR_CAN 0x18 -#define UCHAR_EM 0x19 -#define UCHAR_SUB 0x1a -#define UCHAR_ESC 0x1b -#define UCHAR_FS 0x1c -#define UCHAR_GS 0x1d -#define UCHAR_RS 0x1e -#define UCHAR_US 0x1f -#define UCHAR_SP 0x20 - -#endif // _NODETYPE_INCLUDED_ - - diff --git a/pub/ddk/notesdeviceservice.h b/pub/ddk/notesdeviceservice.h deleted file mode 100644 index a91afc9..0000000 --- a/pub/ddk/notesdeviceservice.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * NotesDeviceService.h - * - * Contains declarations for the Notes Device Service - * - * Copyright (c) Microsoft Corporation, All Rights Reserved. - * - */ - -#ifndef _NOTESDEVICESERVICE_H_ -#define _NOTESDEVICESERVICE_H_ - -#include -#include - - -/*****************************************************************************/ -/* Notes Service Info */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(SERVICE_Notes, - 0x5c017aea, 0xe706, 0x4719, 0x8c, 0xc0, 0xa3, 0x03, 0x83, 0x6f, 0xd3, 0x21); - -#define NAME_NotesSvc L"Notes" -#define TYPE_NotesSvc DEVSVCTYPE_DEFAULT - - -/*****************************************************************************/ -/* Notes Service Object Formats */ -/*****************************************************************************/ - -/* FORMAT_AbstractNote - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractNote, - 0xb3d1b688, 0x39f6, 0x4703, 0xb3, 0x39, 0xc6, 0x9b, 0x7d, 0x2a, 0xbb, 0x3f); - -#define NAME_AbstractNote L"AbstractNote" - - -/*****************************************************************************/ -/* Notes Service Object Property Keys */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(NAMESPACE_NotesObj, - 0x5FFBFC7B, 0x7483, 0x41AD, 0xAF, 0xB9, 0xDA, 0x3F, 0x4E, 0x59, 0x2B, 0x8D); - -#endif /* _NOTESDEVICESERVICE_H_ */ - - diff --git a/pub/ddk/npapi.h b/pub/ddk/npapi.h deleted file mode 100644 index b6e8823..0000000 --- a/pub/ddk/npapi.h +++ /dev/null @@ -1,609 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - npapi.h - -Abstract: - - Network Provider API prototypes and manifests. A network provider - is a client of the Win32 WNet APIs. See the "NT/Win32 Network - Provider API Specification" document for further details. - -Environment: - - User Mode -Win32 - ---*/ - -#ifndef _NPAPI_INCLUDED -#define _NPAPI_INCLUDED - -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// -// CONNECTIONS -// - -DWORD APIENTRY -NPAddConnection ( - __in LPNETRESOURCEW lpNetResource, - __in_opt LPWSTR lpPassword, - __in_opt LPWSTR lpUserName - ); - -typedef DWORD (APIENTRY *PF_NPAddConnection) ( - __in LPNETRESOURCEW lpNetResource, - __in_opt LPWSTR lpPassword, - __in_opt LPWSTR lpUserName - ); - - -DWORD APIENTRY -NPAddConnection3 ( - __in_opt HWND hwndOwner, - __in LPNETRESOURCEW lpNetResource, - __in_opt LPWSTR lpPassword, - __in_opt LPWSTR lpUserName, - __in DWORD dwFlags - ); - -typedef DWORD (APIENTRY *PF_NPAddConnection3) ( - __in_opt HWND hwndOwner, - __in LPNETRESOURCEW lpNetResource, - __in_opt LPWSTR lpPassword, - __in_opt LPWSTR lpUserName, - __in DWORD dwFlags - ); - - -DWORD APIENTRY -NPCancelConnection ( - __in LPWSTR lpName, - __in BOOL fForce - ); - -typedef DWORD (APIENTRY *PF_NPCancelConnection) ( - __in LPWSTR lpName, - __in BOOL fForce - ); - - -DWORD APIENTRY -NPGetConnection ( - __in LPWSTR lpLocalName, - __out_ecount_opt(*lpnBufferLen) LPWSTR lpRemoteName, - __inout LPDWORD lpnBufferLen - ); - -typedef DWORD (APIENTRY *PF_NPGetConnection) ( - __in LPWSTR lpLocalName, - __out_ecount_opt(*lpnBufferLen) LPWSTR lpRemoteName, - __inout LPDWORD lpnBufferLen - ); - - -#define WNGETCON_CONNECTED 0x00000000 -#define WNGETCON_DISCONNECTED 0x00000001 - -DWORD APIENTRY -NPGetConnection3 ( - __in LPCWSTR lpLocalName, - __in DWORD dwLevel, - __out_bcount(*lpBufferSize) LPVOID lpBuffer, - __inout LPDWORD lpBufferSize - ); - -typedef DWORD (APIENTRY *PF_NPGetConnection3) ( - __in LPCWSTR lpLocalName, - __in DWORD dwLevel, - __out_bcount(*lpBufferSize) LPVOID lpBuffer, - __inout LPDWORD lpBufferSize - ); - - -DWORD APIENTRY -NPGetUniversalName ( - __in LPCWSTR lpLocalPath, - __in DWORD dwInfoLevel, - __out_bcount(*lpBufferSize) LPVOID lpBuffer, - __inout LPDWORD lpBufferSize - ); - -typedef DWORD (APIENTRY *PF_NPGetUniversalName) ( - __in LPCWSTR lpLocalPath, - __in DWORD dwInfoLevel, - __out_bcount(*lpnBufferSize) LPVOID lpBuffer, - __inout LPDWORD lpnBufferSize - ); - -DWORD APIENTRY -NPGetConnectionPerformance ( - __in LPCWSTR lpRemoteName, - __out LPNETCONNECTINFOSTRUCT lpNetConnectInfo - ); - -typedef DWORD (APIENTRY *PF_NPGetConnectionPerformance) ( - __in LPCWSTR lpRemoteName, - __out LPNETCONNECTINFOSTRUCT lpNetConnectInfo - ); - - -DWORD APIENTRY -NPOpenEnum ( - __in DWORD dwScope, - __in DWORD dwType, - __in DWORD dwUsage, - __in_opt LPNETRESOURCEW lpNetResource, - __out LPHANDLE lphEnum - ); - -typedef DWORD (APIENTRY *PF_NPOpenEnum) ( - __in DWORD dwScope, - __in DWORD dwType, - __in DWORD dwUsage, - __in_opt LPNETRESOURCEW lpNetResource, - __out LPHANDLE lphEnum - ); - -DWORD APIENTRY -NPEnumResource ( - __in HANDLE hEnum, - __inout LPDWORD lpcCount, - __out_bcount(*lpBufferSize) LPVOID lpBuffer, - __inout LPDWORD lpBufferSize - ); - -typedef DWORD (APIENTRY *PF_NPEnumResource) ( - __in HANDLE hEnum, - __inout LPDWORD lpcCount, - __out_bcount(*lpbufferSize) LPVOID lpBuffer, - __inout LPDWORD lpBufferSize - ); - -DWORD APIENTRY -NPCloseEnum ( - __in HANDLE hEnum - ); - -typedef DWORD (APIENTRY *PF_NPCloseEnum) ( - __in HANDLE hEnum - ); - - -// -// CAPABILITIES -// - -#define WNNC_SPEC_VERSION 0x00000001 -#define WNNC_SPEC_VERSION51 0x00050001 - -#define WNNC_NET_TYPE 0x00000002 -#define WNNC_NET_NONE 0x00000000 - -#define WNNC_DRIVER_VERSION 0x00000003 - -#define WNNC_USER 0x00000004 -#define WNNC_USR_GETUSER 0x00000001 - -#define WNNC_CONNECTION 0x00000006 -#define WNNC_CON_ADDCONNECTION 0x00000001 -#define WNNC_CON_CANCELCONNECTION 0x00000002 -#define WNNC_CON_GETCONNECTIONS 0x00000004 -#define WNNC_CON_ADDCONNECTION3 0x00000008 -#define WNNC_CON_GETPERFORMANCE 0x00000040 -#define WNNC_CON_DEFER 0x00000080 - -#define WNNC_DIALOG 0x00000008 -#define WNNC_DLG_DEVICEMODE 0x00000001 -#define WNNC_DLG_PROPERTYDIALOG 0x00000020 -#define WNNC_DLG_SEARCHDIALOG 0x00000040 -#define WNNC_DLG_FORMATNETWORKNAME 0x00000080 -#define WNNC_DLG_PERMISSIONEDITOR 0x00000100 -#define WNNC_DLG_GETRESOURCEPARENT 0x00000200 -#define WNNC_DLG_GETRESOURCEINFORMATION 0x00000800 - -#define WNNC_ADMIN 0x00000009 -#define WNNC_ADM_GETDIRECTORYTYPE 0x00000001 -#define WNNC_ADM_DIRECTORYNOTIFY 0x00000002 - -#define WNNC_ENUMERATION 0x0000000B -#define WNNC_ENUM_GLOBAL 0x00000001 -#define WNNC_ENUM_LOCAL 0x00000002 -#define WNNC_ENUM_CONTEXT 0x00000004 -#define WNNC_ENUM_SHAREABLE 0x00000008 - -#define WNNC_START 0x0000000C -#define WNNC_WAIT_FOR_START 0x00000001 - -#define WNNC_CONNECTION_FLAGS 0x0000000D -#define WNNC_CF_DEFAULT ( CONNECT_TEMPORARY | CONNECT_INTERACTIVE | CONNECT_PROMPT ) -#define WNNC_CF_MAXIMUM (WNNC_CF_DEFAULT | CONNECT_DEFERRED | CONNECT_COMMANDLINE | CONNECT_CMD_SAVECRED | CONNECT_CRED_RESET) - - - -DWORD APIENTRY -NPGetCaps ( - __in DWORD ndex - ); - -typedef DWORD (APIENTRY *PF_NPGetCaps) ( - __in DWORD ndex - ); - -// -// OTHER -// - -DWORD APIENTRY -NPGetUser ( - __in LPWSTR lpName, - __out_ecount(*lpnBufferLen) LPWSTR lpUserName, - __inout LPDWORD lpnBufferLen - ); - -typedef DWORD (APIENTRY *PF_NPGetUser) ( - __in LPWSTR lpName, - __out_ecount(*lpnBufferLen) LPWSTR lpUserName, - __inout LPDWORD lpnBufferLen - ); - -#define WNTYPE_DRIVE 1 -#define WNTYPE_FILE 2 -#define WNTYPE_PRINTER 3 -#define WNTYPE_COMM 4 - -#define WNPS_FILE 0 -#define WNPS_DIR 1 -#define WNPS_MULT 2 - -DWORD APIENTRY -NPDeviceMode( - __in HWND hParent - ); - -typedef DWORD (APIENTRY *PF_NPDeviceMode) ( - __in HWND hParent - ); - -// flag for search dialog -#define WNSRCH_REFRESH_FIRST_LEVEL 0x00000001 - -DWORD APIENTRY -NPSearchDialog( - __in HWND hwndParent, - __in_opt LPNETRESOURCEW lpNetResource, - __out_ecount(cbBuffer) LPVOID lpBuffer, - __in DWORD cbBuffer, - __out LPDWORD lpnFlags - ); - -typedef DWORD (APIENTRY *PF_NPSearchDialog) ( - __in HWND hwndParent, - __in_opt LPNETRESOURCEW lpNetResource, - __out_ecount(cbBuffer) LPVOID lpBuffer, - __in DWORD cbBuffer, - __out LPDWORD lpnFlags - ); - -DWORD APIENTRY -NPGetResourceParent( - __in LPNETRESOURCEW lpNetResource, - __out_bcount(*lpBufferSize) LPVOID lpBuffer, - __inout LPDWORD lpBufferSize - ); - -typedef DWORD (APIENTRY *PF_NPGetResourceParent) ( - __in LPNETRESOURCEW lpNetResource, - __out_bcount(*lpBufferSize) LPVOID lpBuffer, - __inout LPDWORD lpBufferSize - ); - -DWORD APIENTRY NPGetResourceInformation( - __in LPNETRESOURCEW lpNetResource, - __out_bcount(*lpBufferSize) LPVOID lpBuffer, - __inout LPDWORD lpBufferSize, - __deref_out LPWSTR *lplpSystem - ); - -typedef DWORD (APIENTRY *PF_NPGetResourceInformation) ( - __in LPNETRESOURCEW lpNetResource, - __out_bcount(*lpBufferSize) LPVOID lpBuffer, - __inout LPDWORD lpBufferSize, - __deref_out LPWSTR *lplpSystem - ); - -DWORD APIENTRY -NPFormatNetworkName( - __in LPWSTR lpRemoteName, - __out_ecount(*lpnLength) LPWSTR lpFormattedName, - __inout LPDWORD lpnLength, - __in DWORD dwFlags, - __in DWORD dwAveCharPerLine - ); - -typedef DWORD (APIENTRY *PF_NPFormatNetworkName) ( - __in LPWSTR lpRemoteName, - __out_ecount(*lpnLength) LPWSTR lpFormattedName, - __inout LPDWORD lpnLength, - __in DWORD dwFlags, - __in DWORD dwAveCharPerLine - ); - -DWORD APIENTRY -NPGetPropertyText( - __in DWORD iButton, - __in DWORD nPropSel, - __in LPWSTR lpName, - __out_ecount(nButtonNameLen) LPWSTR lpButtonName, - __in DWORD nButtonNameLen, - __in DWORD nType - ); - -typedef DWORD (APIENTRY *PF_NPGetPropertyText) ( - __in DWORD iButton, - __in DWORD nPropSel, - __in LPWSTR lpName, - __out_ecount(nButtonNameLen) LPWSTR lpButtonName, - __in DWORD nButtonNameLen, - __in DWORD nType - ); - -DWORD APIENTRY -NPPropertyDialog( - __in HWND hwndParent, - __in DWORD iButtonDlg, - __in DWORD nPropSel, - __in LPWSTR lpFileName, - __in DWORD nType - ); - -typedef DWORD (APIENTRY *PF_NPPropertyDialog) ( - __in HWND hwndParent, - __in DWORD iButtonDlg, - __in DWORD nPropSel, - __in LPWSTR lpFileName, - __in DWORD nType - ); - - -// -// ADMIN -// - -#define WNDT_NORMAL 0 -#define WNDT_NETWORK 1 - -#define WNDN_MKDIR 1 -#define WNDN_RMDIR 2 -#define WNDN_MVDIR 3 - -DWORD APIENTRY -NPGetDirectoryType ( - __in LPWSTR lpName, - __in LPINT lpType, - __in BOOL bFlushCache - ); - -typedef DWORD (APIENTRY *PF_NPGetDirectoryType) ( - __in LPWSTR lpName, - __in LPINT lpType, - __in BOOL bFlushCache - ); - -DWORD APIENTRY -NPDirectoryNotify ( - __in HWND hwnd, - __in LPWSTR lpDir, - __in DWORD dwOper - ); - -typedef DWORD (APIENTRY *PF_NPDirectoryNotify) ( - __in HWND hwnd, - __in LPWSTR lpDir, - __in DWORD dwOper - ); - -VOID -WNetSetLastErrorA( - __in DWORD err, - __in LPSTR lpError, - __in LPSTR lpProviders - ); - -VOID -WNetSetLastErrorW( - __in DWORD err, - __in LPWSTR lpError, - __in LPWSTR lpProviders - ); - -#ifdef UNICODE -#define WNetSetLastError WNetSetLastErrorW -#else -#define WNetSetLastError WNetSetLastErrorA -#endif // UNICODE - -// -// CREDENTIAL MANAGEMENT and other classes of providers -// - - -// Define the Net/Authentication and othr Provider Classes -#define WN_NETWORK_CLASS 0x00000001 -#define WN_CREDENTIAL_CLASS 0x00000002 -#define WN_PRIMARY_AUTHENT_CLASS 0x00000004 -#define WN_SERVICE_CLASS 0x00000008 - -#define WN_VALID_LOGON_ACCOUNT 0x00000001 -#define WN_NT_PASSWORD_CHANGED 0x00000002 - -DWORD APIENTRY -NPLogonNotify ( - __in PLUID lpLogonId, - __in LPCWSTR lpAuthentInfoType, - __in LPVOID lpAuthentInfo, - __in_opt LPCWSTR lpPreviousAuthentInfoType, - __in_opt LPVOID lpPreviousAuthentInfo, - __in LPWSTR lpStationName, - __in_opt LPVOID StationHandle, - __out LPWSTR *lpLogonScript - ); - -typedef DWORD (APIENTRY *PF_NPLogonNotify) ( - __in PLUID lpLogonId, - __in LPCWSTR lpAuthentInfoType, - __in LPVOID lpAuthentInfo, - __in_opt LPCWSTR lpPreviousAuthentInfoType, - __in_opt LPVOID lpPreviousAuthentInfo, - __in LPWSTR lpStationName, - __in_opt LPVOID StationHandle, - __out LPWSTR *lpLogonScript - ); - -DWORD APIENTRY -NPPasswordChangeNotify ( - __in LPCWSTR lpAuthentInfoType, - __in LPVOID lpAuthentInfo, - __in LPCWSTR lpPreviousAuthentInfoType, - __in LPVOID lpPreviousAuthentInfo, - __in LPWSTR lpStationName, - __in_opt LPVOID StationHandle, - __in DWORD dwChangeInfo - ); - -typedef DWORD (APIENTRY *PF_NPPasswordChangeNotify) ( - __in LPCWSTR lpAuthentInfoType, - __in LPVOID lpAuthentInfo, - __in LPCWSTR lpPreviousAuthentInfoType, - __in LPVOID lpPreviousAuthentInfo, - __in LPWSTR lpStationName, - __in_opt LPVOID StationHandle, - __in DWORD dwChangeInfo - ); - -// -// CONNECTION NOTIFICATION -// - -// -// NotifyStatus -// -#define NOTIFY_PRE 0x00000001 -#define NOTIFY_POST 0x00000002 - -typedef struct _NOTIFYINFO { - DWORD dwNotifyStatus; - DWORD dwOperationStatus; - LPVOID lpContext; -} NOTIFYINFO, *LPNOTIFYINFO; - -typedef struct _NOTIFYADD { - HWND hwndOwner; - NETRESOURCE NetResource; - DWORD dwAddFlags; -} NOTIFYADD, *LPNOTIFYADD; - -typedef struct _NOTIFYCANCEL { - LPWSTR lpName; - LPWSTR lpProvider; - DWORD dwFlags; - BOOL fForce; -} NOTIFYCANCEL, *LPNOTIFYCANCEL; - - -DWORD APIENTRY -AddConnectNotify ( - __inout LPNOTIFYINFO lpNotifyInfo, - __in LPNOTIFYADD lpAddInfo - ); - -typedef DWORD (APIENTRY *PF_AddConnectNotify) ( - __inout LPNOTIFYINFO lpNotifyInfo, - __in LPNOTIFYADD lpAddInfo - ); - -DWORD APIENTRY -CancelConnectNotify ( - __inout LPNOTIFYINFO lpNotifyInfo, - __in LPNOTIFYCANCEL lpCancelInfo - ); - -typedef DWORD (APIENTRY *PF_CancelConnectNotify) ( - __inout LPNOTIFYINFO lpNotifyInfo, - __in LPNOTIFYCANCEL lpCancelInfo - ); - -// -// Permission editor dialogs -// - -// -// Capabilities bits of permission editor dialogs -// -#define WNPERMC_PERM 0x00000001 -#define WNPERMC_AUDIT 0x00000002 -#define WNPERMC_OWNER 0x00000004 - -DWORD APIENTRY -NPFMXGetPermCaps ( - __in LPWSTR lpDriveName - ); - -typedef DWORD (APIENTRY *PF_NPFMXGetPermCaps) ( - __in LPWSTR lpDriveName - ); - -// -// Type of security dialog -// -#define WNPERM_DLG_PERM 0 -#define WNPERM_DLG_AUDIT 1 -#define WNPERM_DLG_OWNER 2 - -DWORD APIENTRY -NPFMXEditPerm ( - __in LPWSTR lpDriveName, - __in HWND hwndFMX, - __in DWORD nDialogType - ); - -typedef DWORD (APIENTRY *PF_NPFMXEditPerm) ( - __in LPWSTR lpDriveName, - __in HWND hwndFMX, - __in DWORD nDialogType - ); - -DWORD APIENTRY -NPFMXGetPermHelp ( - __in LPWSTR lpDriveName, - __in DWORD nDialogType, - __in BOOL fDirectory, - __out_ecount(*lpBufferSize) LPVOID lpFileNameBuffer, - __inout LPDWORD lpBufferSize, - __out LPDWORD lpnHelpContext - ); - -typedef DWORD (APIENTRY *PF_NPFMXGetPermHelp) ( - __in LPWSTR lpDriveName, - __in DWORD nDialogType, - __in BOOL fDirectory, - __out_ecount(*lpBufferSize) LPVOID lpFileNameBuffer, - __inout LPDWORD lpBufferSize, - __out LPDWORD lpnHelpContext - ); - -#ifdef __cplusplus -} -#endif - -#endif // _NPAPI_INCLUDED - diff --git a/pub/ddk/npivwmi.h b/pub/ddk/npivwmi.h deleted file mode 100644 index 407517b..0000000 --- a/pub/ddk/npivwmi.h +++ /dev/null @@ -1,203 +0,0 @@ -#ifndef _npivwmi_h_ -#define _npivwmi_h_ - -// MSFC_FibrePortNPIVMethods - MSFC_FibrePortNPIVMethods -#define MSFC_FibrePortNPIVMethodsGuid \ - { 0x8d49ef4c,0xc172,0x45d8, { 0xa3,0x03,0xc5,0xfb,0xc5,0x60,0x1f,0x37 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_FibrePortNPIVMethods_GUID, \ - 0x8d49ef4c,0xc172,0x45d8,0xa3,0x03,0xc5,0xfb,0xc5,0x60,0x1f,0x37); -#endif - -// -// Method id definitions for MSFC_FibrePortNPIVMethods -#define CreateVirtualPort 1 -typedef struct _CreateVirtualPort_IN -{ - // - UCHAR WWPN[8]; - #define CreateVirtualPort_IN_WWPN_SIZE sizeof(UCHAR[8]) - #define CreateVirtualPort_IN_WWPN_ID 2 - - // - UCHAR WWNN[8]; - #define CreateVirtualPort_IN_WWNN_SIZE sizeof(UCHAR[8]) - #define CreateVirtualPort_IN_WWNN_ID 3 - - // - UCHAR Tag[16]; - #define CreateVirtualPort_IN_Tag_SIZE sizeof(UCHAR[16]) - #define CreateVirtualPort_IN_Tag_ID 4 - - // - USHORT VirtualName[64]; - #define CreateVirtualPort_IN_VirtualName_SIZE sizeof(USHORT[64]) - #define CreateVirtualPort_IN_VirtualName_ID 5 - -} CreateVirtualPort_IN, *PCreateVirtualPort_IN; - -#define CreateVirtualPort_IN_SIZE (FIELD_OFFSET(CreateVirtualPort_IN, VirtualName) + CreateVirtualPort_IN_VirtualName_SIZE) - -typedef struct _CreateVirtualPort_OUT -{ - // - ULONG Status; - #define CreateVirtualPort_OUT_Status_SIZE sizeof(ULONG) - #define CreateVirtualPort_OUT_Status_ID 1 - -} CreateVirtualPort_OUT, *PCreateVirtualPort_OUT; - -#define CreateVirtualPort_OUT_SIZE (FIELD_OFFSET(CreateVirtualPort_OUT, Status) + CreateVirtualPort_OUT_Status_SIZE) - -#define RemoveVirtualPort 2 -typedef struct _RemoveVirtualPort_IN -{ - // - UCHAR WWPN[8]; - #define RemoveVirtualPort_IN_WWPN_SIZE sizeof(UCHAR[8]) - #define RemoveVirtualPort_IN_WWPN_ID 2 - -} RemoveVirtualPort_IN, *PRemoveVirtualPort_IN; - -#define RemoveVirtualPort_IN_SIZE (FIELD_OFFSET(RemoveVirtualPort_IN, WWPN) + RemoveVirtualPort_IN_WWPN_SIZE) - -typedef struct _RemoveVirtualPort_OUT -{ - // - ULONG Status; - #define RemoveVirtualPort_OUT_Status_SIZE sizeof(ULONG) - #define RemoveVirtualPort_OUT_Status_ID 1 - -} RemoveVirtualPort_OUT, *PRemoveVirtualPort_OUT; - -#define RemoveVirtualPort_OUT_SIZE (FIELD_OFFSET(RemoveVirtualPort_OUT, Status) + RemoveVirtualPort_OUT_Status_SIZE) - - -// MSFC_VirtualFibrePortAttributes - MSFC_VirtualFibrePortAttributes -#define MSFC_VirtualFibrePortAttributesGuid \ - { 0x3574bc0b,0x6f5f,0x4baf, { 0xaf,0x67,0xc4,0x8c,0xc7,0x9f,0xe9,0x57 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_VirtualFibrePortAttributes_GUID, \ - 0x3574bc0b,0x6f5f,0x4baf,0xaf,0x67,0xc4,0x8c,0xc7,0x9f,0xe9,0x57); -#endif - - -typedef struct _MSFC_VirtualFibrePortAttributes -{ - // - ULONG Status; - #define MSFC_VirtualFibrePortAttributes_Status_SIZE sizeof(ULONG) - #define MSFC_VirtualFibrePortAttributes_Status_ID 1 - - // - ULONG FCId; - #define MSFC_VirtualFibrePortAttributes_FCId_SIZE sizeof(ULONG) - #define MSFC_VirtualFibrePortAttributes_FCId_ID 2 - - // - USHORT VirtualName[64]; - #define MSFC_VirtualFibrePortAttributes_VirtualName_SIZE sizeof(USHORT[64]) - #define MSFC_VirtualFibrePortAttributes_VirtualName_ID 3 - - // - UCHAR Tag[16]; - #define MSFC_VirtualFibrePortAttributes_Tag_SIZE sizeof(UCHAR[16]) - #define MSFC_VirtualFibrePortAttributes_Tag_ID 4 - - // - UCHAR WWPN[8]; - #define MSFC_VirtualFibrePortAttributes_WWPN_SIZE sizeof(UCHAR[8]) - #define MSFC_VirtualFibrePortAttributes_WWPN_ID 5 - - // - UCHAR WWNN[8]; - #define MSFC_VirtualFibrePortAttributes_WWNN_SIZE sizeof(UCHAR[8]) - #define MSFC_VirtualFibrePortAttributes_WWNN_ID 6 - - // - UCHAR FabricWWN[8]; - #define MSFC_VirtualFibrePortAttributes_FabricWWN_SIZE sizeof(UCHAR[8]) - #define MSFC_VirtualFibrePortAttributes_FabricWWN_ID 7 - -} MSFC_VirtualFibrePortAttributes, *PMSFC_VirtualFibrePortAttributes; - -#define MSFC_VirtualFibrePortAttributes_SIZE (FIELD_OFFSET(MSFC_VirtualFibrePortAttributes, FabricWWN) + MSFC_VirtualFibrePortAttributes_FabricWWN_SIZE) - -// MSFC_FibrePortNPIVAttributes - MSFC_FibrePortNPIVAttributes -#define MSFC_FibrePortNPIVAttributesGuid \ - { 0x66902796,0x54f4,0x4e24, { 0xad,0x91,0x0a,0xb3,0xb1,0xad,0x65,0xaf } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_FibrePortNPIVAttributes_GUID, \ - 0x66902796,0x54f4,0x4e24,0xad,0x91,0x0a,0xb3,0xb1,0xad,0x65,0xaf); -#endif - - -typedef struct _MSFC_FibrePortNPIVAttributes -{ - // - UCHAR WWPN[8]; - #define MSFC_FibrePortNPIVAttributes_WWPN_SIZE sizeof(UCHAR[8]) - #define MSFC_FibrePortNPIVAttributes_WWPN_ID 1 - - // - UCHAR WWNN[8]; - #define MSFC_FibrePortNPIVAttributes_WWNN_SIZE sizeof(UCHAR[8]) - #define MSFC_FibrePortNPIVAttributes_WWNN_ID 2 - - // - ULONG NumberVirtualPorts; - #define MSFC_FibrePortNPIVAttributes_NumberVirtualPorts_SIZE sizeof(ULONG) - #define MSFC_FibrePortNPIVAttributes_NumberVirtualPorts_ID 3 - - // - MSFC_VirtualFibrePortAttributes VirtualPorts[1]; - #define MSFC_FibrePortNPIVAttributes_VirtualPorts_ID 4 - -} MSFC_FibrePortNPIVAttributes, *PMSFC_FibrePortNPIVAttributes; - -// MSFC_NPIVLUNMappingInformation - MSFC_NPIVLUNMappingInformation -#define MSFC_NPIVLUNMappingInformationGuid \ - { 0x21763208,0xfeb5,0x49bc, { 0xa4,0xe6,0xf5,0x6f,0xdd,0x8c,0xcb,0xd4 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSFC_NPIVLUNMappingInformation_GUID, \ - 0x21763208,0xfeb5,0x49bc,0xa4,0xe6,0xf5,0x6f,0xdd,0x8c,0xcb,0xd4); -#endif - - -typedef struct _MSFC_NPIVLUNMappingInformation -{ - // - UCHAR WWPNVirtualPort[8]; - #define MSFC_NPIVLUNMappingInformation_WWPNVirtualPort_SIZE sizeof(UCHAR[8]) - #define MSFC_NPIVLUNMappingInformation_WWPNVirtualPort_ID 1 - - // - UCHAR WWPNPhysicalPort[8]; - #define MSFC_NPIVLUNMappingInformation_WWPNPhysicalPort_SIZE sizeof(UCHAR[8]) - #define MSFC_NPIVLUNMappingInformation_WWPNPhysicalPort_ID 2 - - // - UCHAR OSBus; - #define MSFC_NPIVLUNMappingInformation_OSBus_SIZE sizeof(UCHAR) - #define MSFC_NPIVLUNMappingInformation_OSBus_ID 3 - - // - UCHAR OSTarget; - #define MSFC_NPIVLUNMappingInformation_OSTarget_SIZE sizeof(UCHAR) - #define MSFC_NPIVLUNMappingInformation_OSTarget_ID 4 - - // - UCHAR OSLUN; - #define MSFC_NPIVLUNMappingInformation_OSLUN_SIZE sizeof(UCHAR) - #define MSFC_NPIVLUNMappingInformation_OSLUN_ID 5 - -} MSFC_NPIVLUNMappingInformation, *PMSFC_NPIVLUNMappingInformation; - -#define MSFC_NPIVLUNMappingInformation_SIZE (FIELD_OFFSET(MSFC_NPIVLUNMappingInformation, OSLUN) + MSFC_NPIVLUNMappingInformation_OSLUN_SIZE) - -#endif - diff --git a/pub/ddk/ntagp.h b/pub/ddk/ntagp.h deleted file mode 100644 index e956bca..0000000 --- a/pub/ddk/ntagp.h +++ /dev/null @@ -1,289 +0,0 @@ -/*++ - -Copyright (c) 1997-1999 Microsoft Corporation - -Module Name: - - ntagp.h - -Abstract: - - This file defines the external interface for the AGP bus filter driver - - -Revision History: - ---*/ -#ifndef _NTAGP_ -#define _NTAGP_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -typedef struct _AGP_INFO_COMMON -{ - PCI_AGP_CAPABILITY MasterCap; - PCI_AGP_CAPABILITY TargetCap; - USHORT DeviceId; - USHORT VendorId; - USHORT SubVendorId; - USHORT SubSystemId; - UCHAR HwRevisionId; - ULONG VerifierFlags; - BOOLEAN GuardPageCorruption; -}AGP_INFO_COMMON, *PAGP_INFO_COMMON; - -typedef struct _AGP_INFO_DRIVER -{ - ULONG AGPReg1; - ULONG AGPReg2; - PHYSICAL_ADDRESS ApertureStart; - PHYSICAL_ADDRESS GartTranslationTable; - ULONG ApertureLength; -}AGP_INFO_DRIVER, *PAGP_INFO_DRIVER; - -typedef struct -{ - // - // This is gerneic info collected by the AgpLib - // - AGP_INFO_COMMON CommonInfo; - - // - // The following data is collected differently by each AGP driver - // - AGP_INFO_DRIVER DriverInfo; -}AGP_INFO, *PAGP_INFO; - -DEFINE_GUID(GUID_AGP_BUS_INTERFACE_STANDARD, 0x2ef74803, 0xd8d3, 0x11d1, 0x9c, 0xaa, 0x00, 0xc0, 0xf0, 0x16, 0x56, 0x36 ); -// -// Define AGP Interface version -// -#define AGP_BUS_INTERFACE_V1 1 -#define AGP_BUS_INTERFACE_V2 2 -#define AGP_BUS_INTERFACE_V3 3 -#define AGP_BUS_INTERFACE_V4 4 -#define AGP_BUS_INTERFACE_V5 5 - -// -// Define AGP Capabilities field -// -#define AGP_CAPABILITIES_MAP_PHYSICAL 0x00000001 -#define AGP_CAPABILITIES_CACHE_COHERENT 0x00000002 -#define AGP_CAPABILITIES_REQUIRES_GPU_FLUSH 0x00000004 - -// -// Video can disable SBA and/or FW by OR'ing these into AgpSetRate's AgpRate -// parameter -// -#define AGP_SET_RATE_DISABLE_SBA 0x00010000 -#define AGP_SET_RATE_DISABLE_FW 0x00020000 - -typedef -NTSTATUS -(*PAGP_BUS_SET_RATE)( - IN PVOID AgpContext, - IN ULONG AgpRate - ); - -typedef -NTSTATUS -(*PAGP_BUS_RESERVE_MEMORY)( - IN PVOID AgpContext, - IN ULONG NumberOfPages, - IN MEMORY_CACHING_TYPE MemoryType, - OUT PVOID *MapHandle, - OUT OPTIONAL PHYSICAL_ADDRESS *PhysicalAddress - ); - -typedef -NTSTATUS -(*PAGP_BUS_RELEASE_MEMORY)( - IN PVOID AgpContext, - IN PVOID MapHandle - ); - -typedef -NTSTATUS -(*PAGP_BUS_COMMIT_MEMORY)( - IN PVOID AgpContext, - IN PVOID MapHandle, - IN ULONG NumberOfPages, - IN ULONG OffsetInPages, - IN OUT PMDL Mdl OPTIONAL, - OUT PHYSICAL_ADDRESS *MemoryBase - ); - -typedef -NTSTATUS -(*PAGP_BUS_FREE_MEMORY)( - IN PVOID AgpContext, - IN PVOID MapHandle, - IN ULONG NumberOfPages, - IN ULONG OffsetInPages - ); - -typedef -NTSTATUS -(*PAGP_GET_MAPPED_PAGES)( - IN PVOID AgpContext, - IN PVOID MapHandle, - IN ULONG NumberOfPages, - IN ULONG OffsetInPages, - OUT PMDL Mld - ); - -typedef -NTSTATUS -(*PAGP_MAP_MEMORY)( - IN PVOID AgpContext, - IN PVOID MapHandle, - IN ULONG NumberOfPages, - IN ULONG OffsetInPages, - IN PMDL Mdl, - OUT PHYSICAL_ADDRESS *MemoryBase - ); - -typedef -NTSTATUS -(*PAGP_UNMAP_MEMORY)( - IN PVOID AgpContext, - IN PVOID MapHandle, - IN ULONG NumberOfPages, - IN ULONG OffsetInPages, - IN PMDL Mdl - ); - -typedef -NTSTATUS -(*PAGP_FLUSH_CHIPSET_CACHES)( - IN PVOID AgpContext - ); - -typedef -NTSTATUS -(*PAGP_CHECK_INTEGRITY)( - IN PVOID AgpContext - ); - -typedef -NTSTATUS -(*PAGP_MAP_MEMORY_EX)( - IN PVOID AgpContext, - IN PVOID MapHandle, - IN ULONG NumberOfPages, - IN ULONG OffsetInPages, - IN PMDL Mdl, - IN OPTIONAL MEMORY_CACHING_TYPE *CacheTypeOverride, - OUT PHYSICAL_ADDRESS *MemoryBase - ); - -typedef -NTSTATUS -(*PAGP_UNMAP_MEMORY_EX)( - IN PVOID AgpContext, - IN PVOID MapHandle, - IN ULONG NumberOfPages, - IN ULONG OffsetInPages, - IN PMDL Mdl - ); - -typedef -NTSTATUS -(*PAGP_FLUSH_GART_TLB)( - IN PVOID AgpContext - ); - -typedef -NTSTATUS -(*PAGP_CHECK_GUARD_PAGE)( - IN PVOID AgpContext, - IN ULONG Flags, - IN ULONG ULongsToCheck - ); - -typedef -VOID -(*PAGP_GET_INFO)( - IN PVOID AgpContext, - OUT PAGP_INFO AgpInfo - ); - - -#define AGP_GUARD_PAGE_CHECK_FIRST_ULONG 0x00000001 -#define AGP_GUARD_PAGE_CHECK_USE_SAME_OFFSET 0x00000002 -#define AGP_GUARD_PAGE_CHECK_DO_NOT_BUGCHECK 0x00000004 - -typedef struct _AGP_BUS_INTERFACE_STANDARD { - // - // generic interface header - // - USHORT Size; - USHORT Version; - PVOID AgpContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // - // AGP bus interfaces (Version 1.0) - // - - ULONG Capabilities; - PAGP_BUS_RESERVE_MEMORY ReserveMemory; - PAGP_BUS_RELEASE_MEMORY ReleaseMemory; - PAGP_BUS_COMMIT_MEMORY CommitMemory; - PAGP_BUS_FREE_MEMORY FreeMemory; - PAGP_GET_MAPPED_PAGES GetMappedPages; - - // - // New functionnality in Version 2.0 of the interface. - // - - PAGP_BUS_SET_RATE SetRate; - - // - // New functionnality in Version 3.0 of the interface. - // - - SIZE_T AgpSize; - PHYSICAL_ADDRESS AgpBase; - PHYSICAL_ADDRESS MaxPhysicalAddress; - PAGP_MAP_MEMORY MapMemory; - PAGP_UNMAP_MEMORY UnMapMemory; - - // - // New functionnality in Version 4.0 of the interface. - // - - PAGP_FLUSH_CHIPSET_CACHES FlushChipsetCaches; - PAGP_CHECK_INTEGRITY CheckIntegrity; - - // - // New functionnality in Version 5.0 of the interface. - // - PAGP_MAP_MEMORY_EX MapMemoryEx; - PAGP_UNMAP_MEMORY_EX UnMapMemoryEx; - PAGP_FLUSH_GART_TLB FlushGartTLB; - PAGP_CHECK_GUARD_PAGE CheckGuardPage; - PAGP_GET_INFO GetAgpInfo; -} AGP_BUS_INTERFACE_STANDARD, *PAGP_BUS_INTERFACE_STANDARD; - -// -// Support for older version of the interface. -// - -#define AGP_BUS_INTERFACE_V1_SIZE \ - (FIELD_OFFSET(AGP_BUS_INTERFACE_STANDARD,SetRate)) - -#define AGP_BUS_INTERFACE_V2_SIZE \ - (FIELD_OFFSET(AGP_BUS_INTERFACE_STANDARD, AgpSize)) - -#define AGP_BUS_INTERFACE_V3_SIZE \ - (FIELD_OFFSET(AGP_BUS_INTERFACE_STANDARD, FlushChipsetCaches)) - -#define AGP_BUS_INTERFACE_V4_SIZE \ - (FIELD_OFFSET(AGP_BUS_INTERFACE_STANDARD, MapMemoryEx)) - -#endif - diff --git a/pub/ddk/ntdddump.h b/pub/ddk/ntdddump.h deleted file mode 100644 index 68f79af..0000000 --- a/pub/ddk/ntdddump.h +++ /dev/null @@ -1,176 +0,0 @@ -/*++ - -Copyright (c) 2003 Microsoft Corporation - -Module Name: - - ntdddump.h - -Abstract: - - Definitions required for filter drivers on the dump path. - -Environment: - - Kernel mode - -Revision History: - - ---*/ - -#include - -#ifndef __NTDDDUMP_H__ -#define __NTDDDUMP_H__ - -#define DUMP_FILTER_MAJOR_VERSION 1 -#define DUMP_FILTER_MINOR_VERSION 0 - -#define DUMP_FILTER_CRITICAL 0x00000001 - -typedef enum _FILTER_DUMP_TYPE { - DumpTypeUndefined, - DumpTypeCrashdump, - DumpTypeHibernation -} FILTER_DUMP_TYPE, *PFILTER_DUMP_TYPE; - -typedef enum _FILTER_CALLBACK { - CallbackDumpInit, - CallbackDumpStart, - CallbackDumpWrite, - CallbackDumpFinish, - CallbackMaxCallback -} FILTER_CALLBACK, *PFILTER_CALLBACK; - -// -// Define the filter driver extension structure -// - -typedef struct _FILTER_EXTENSION { - - // - // Dump type - // - FILTER_DUMP_TYPE DumpType; - - // - // Pointer to dump volume object - // - PDEVICE_OBJECT DeviceObject; - - // - // Dump device geometry - // - DISK_GEOMETRY Geometry; - - // - // Dump disk size - // - LARGE_INTEGER DiskSize; - - // - // Dump partition Information - // Contains dump partition offset - // - DISK_PARTITION_INFO PartitionInfo; - - // - // Filter driver specific data - // - PVOID DumpData; - -} FILTER_EXTENSION, *PFILTER_EXTENSION; - - -typedef -NTSTATUS -(*PDUMP_START) ( - __in PFILTER_EXTENSION FilterExtension - ); - -typedef -NTSTATUS -(*PDUMP_WRITE) ( - __in PFILTER_EXTENSION FilterExtension, - __in PLARGE_INTEGER DiskByteOffset, - __in PMDL Mdl - ); - -typedef -NTSTATUS -(*PDUMP_FINISH) ( - __in PFILTER_EXTENSION FilterExtension - ); - -typedef -NTSTATUS -(*PDUMP_UNLOAD) ( - __in PFILTER_EXTENSION FilterExtension - ); - - -// -// Define the filter driver call table structure -// - -typedef struct _FILTER_INITIALIZATION_DATA { - - // - // Major version of the structure - // Set to DUMP_FILTER_MAJOR_VERSION - // - ULONG MajorVersion; - - // - // Major version of the structure - // Set to DUMP_FILTER_MINOR_VERSION - // - ULONG MinorVersion; - - // - // Pointer to the dump init routine - // This will be called when the dump starts - // - PDUMP_START DumpStart; - - // - // Pointer to the write routine - // This will be called before every write - // - PDUMP_WRITE DumpWrite; - - // - // Pointer to the dump finish routine - // This will be called when the dump completes - // - PDUMP_FINISH DumpFinish; - - // - // Pointer to the dump unload routine - // This will be called before unloading the driver - // - PDUMP_UNLOAD DumpUnload; - - // - // Filter driver specific data - // - PVOID DumpData; - - // - // Maximum number of pages per dump write. - // - ULONG MaxPagesPerWrite; - - // - // Flags. - // - ULONG Flags; - -} FILTER_INITIALIZATION_DATA, *PFILTER_INITIALIZATION_DATA; - - -#endif // __NTDDDUMP_H__ - - - diff --git a/pub/ddk/ntddk.h b/pub/ddk/ntddk.h deleted file mode 100644 index e6fbb86..0000000 --- a/pub/ddk/ntddk.h +++ /dev/null @@ -1,16070 +0,0 @@ -/*++ BUILD Version: 0184 // Increment this if a change has global effects - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ntddk.h - -Abstract: - - This module defines the NT types, constants, and functions that are - exposed to device drivers. - -Revision History: - ---*/ - -#ifndef _NTDDK_ -#define _NTDDK_ - -#if !defined(_NTHAL_) && !defined(_NTIFS_) -#define _NTDDK_INCLUDED_ -#define _DDK_DRIVER_ -#endif - -#ifndef RC_INVOKED -#if _MSC_VER < 1300 -#error Compiler version not supported by Windows DDK -#endif -#endif // RC_INVOKED - -#define NT_INCLUDED -#define _CTYPE_DISABLE_MACROS - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif - -#pragma warning(disable:4115) // named type definition in parentheses -#pragma warning(disable:4201) // nameless struct/union -#pragma warning(disable:4214) // bit field types other than int - -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Define types that are not exported. -// - -typedef struct _BUS_HANDLER *PBUS_HANDLER; -typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT; -typedef struct _DEVICE_HANDLER_OBJECT *PDEVICE_HANDLER_OBJECT; -#if defined(_NTHAL_INCLUDED_) -typedef struct _KPROCESS *PEPROCESS; -typedef struct _ETHREAD *PETHREAD; -typedef struct _KAFFINITY_EX *PKAFFINITY_EX; -#elif defined(_NTIFS_INCLUDED_) -typedef struct _KPROCESS *PEPROCESS; -typedef struct _KTHREAD *PETHREAD; -#else -typedef struct _EPROCESS *PEPROCESS; -typedef struct _ETHREAD *PETHREAD; -#endif -typedef struct _IO_TIMER *PIO_TIMER; -typedef struct _KINTERRUPT *PKINTERRUPT; -typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD; -typedef struct _OBJECT_TYPE *POBJECT_TYPE; -typedef struct _PEB *PPEB; -typedef struct _IMAGE_NT_HEADERS *PIMAGE_NT_HEADERS32; -typedef struct _IMAGE_NT_HEADERS64 *PIMAGE_NT_HEADERS64; -#ifdef _WIN64 -typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS; -#else -typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS; -#endif - -#define PsGetCurrentProcess IoGetCurrentProcess - -#if (NTDDI_VERSION >= NTDDI_VISTA) -extern NTSYSAPI volatile CCHAR KeNumberProcessors; -#elif (NTDDI_VERSION >= NTDDI_WINXP) -extern NTSYSAPI CCHAR KeNumberProcessors; -#else -extern PCCHAR KeNumberProcessors; -#endif - -#include - -#ifndef FAR -#define FAR -#endif - -#ifdef _X86_ - -// -// Disable these two pragmas that evaluate to "sti" "cli" on x86 so that driver -// writers to not leave them inadvertantly in their code. -// - -#if !defined(MIDL_PASS) -#if !defined(RC_INVOKED) - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4164) // disable C4164 warning so that apps that - // build with /Od don't get weird errors ! -#ifdef _M_IX86 -#pragma function(_enable) -#pragma function(_disable) -#endif - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4164) // reenable C4164 warning -#endif - -#endif -#endif - -// -// Size of kernel mode stack. -// - -#define KERNEL_STACK_SIZE 12288 - -// -// Define size of large kernel mode stack for callbacks. -// - -#define KERNEL_LARGE_STACK_SIZE 61440 - -// -// Define number of pages to initialize in a large kernel stack. -// - -#define KERNEL_LARGE_STACK_COMMIT 12288 - -#ifdef _X86_ - -#if !defined(MIDL_PASS) && defined(_M_IX86) - -#if !defined(_M_CEE_PURE) - -#pragma warning( push ) -#pragma warning( disable : 4793 ) -FORCEINLINE -VOID -MemoryBarrier ( - VOID - ) -{ - LONG Barrier; - __asm { - xchg Barrier, eax - } -} -#pragma warning( pop ) - -#endif /* _M_CEE_PURE */ -// -// Prefetch is not supported on all x86 procssors. -// - -#define PreFetchCacheLine(l, a) -#define PrefetchForWrite(p) -#define ReadForWriteAccess(p) (*(p)) - -// -// PreFetchCacheLine level defines. -// - -#define PF_TEMPORAL_LEVEL_1 -#define PF_NON_TEMPORAL_LEVEL_ALL - -// -// Define function to read the value of a performance counter. -// - -#if _MSC_FULL_VER >= 140050727 - -#define ReadPMC __readpmc - -ULONG64 -__readpmc ( - __in ULONG Counter - ); - -#pragma intrinsic(__readpmc) - -#else - -FORCEINLINE -ULONG64 -ReadPMC ( - __in ULONG Counter - ) - -{ - __asm { - mov ecx, Counter - rdpmc - }; -} - -#endif - -// -// Define function to read the value of the time stamp counter -// - -#if _MSC_FULL_VER >= 140040310 - -#define ReadTimeStampCounter() __rdtsc() - -ULONG64 -__rdtsc ( - VOID - ); - -#pragma intrinsic(__rdtsc) - -#else - -FORCEINLINE -ULONG64 -ReadTimeStampCounter ( - VOID - ) - -{ - __asm rdtsc -} - -#endif - -#endif // !defined(MIDL_PASS) && defined(_M_IX86) - -// -// Define the size of the 80387 save area, which is in the context frame. -// - -#define SIZE_OF_80387_REGISTERS 80 - -// -// The following flags control the contents of the CONTEXT structure. -// - -#if !defined(RC_INVOKED) - -#define CONTEXT_i386 0x00010000 // this assumes that i386 and -#define CONTEXT_i486 0x00010000 // i486 have identical context records - - - -#define CONTEXT_CONTROL (CONTEXT_i386 | 0x00000001L) // SS:SP, CS:IP, FLAGS, BP -#define CONTEXT_INTEGER (CONTEXT_i386 | 0x00000002L) // AX, BX, CX, DX, SI, DI -#define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x00000004L) // DS, ES, FS, GS -#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x00000008L) // 387 state -#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x00000010L) // DB 0-3,6,7 -#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x00000020L) // cpu specific extensions - -#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER |\ - CONTEXT_SEGMENTS) - -#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \ - CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | \ - CONTEXT_EXTENDED_REGISTERS) - -#define CONTEXT_XSTATE (CONTEXT_i386 | 0x00000040L) - - - -#endif // !defined(RC_INVOKED) - -typedef struct _FLOATING_SAVE_AREA { - ULONG ControlWord; - ULONG StatusWord; - ULONG TagWord; - ULONG ErrorOffset; - ULONG ErrorSelector; - ULONG DataOffset; - ULONG DataSelector; - UCHAR RegisterArea[SIZE_OF_80387_REGISTERS]; - ULONG Cr0NpxState; -} FLOATING_SAVE_AREA; - -typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA; - - - -#include "pshpack4.h" - -// -// Context Frame -// -// This frame has a several purposes: 1) it is used as an argument to -// NtContinue, 2) is is used to constuct a call frame for APC delivery, -// and 3) it is used in the user level thread creation routines. -// -// The layout of the record conforms to a standard call frame. -// - -typedef struct _CONTEXT { - - // - // The flags values within this flag control the contents of - // a CONTEXT record. - // - // If the context record is used as an input parameter, then - // for each portion of the context record controlled by a flag - // whose value is set, it is assumed that that portion of the - // context record contains valid context. If the context record - // is being used to modify a threads context, then only that - // portion of the threads context will be modified. - // - // If the context record is used as an IN OUT parameter to capture - // the context of a thread, then only those portions of the thread's - // context corresponding to set flags will be returned. - // - // The context record is never used as an OUT only parameter. - // - - ULONG ContextFlags; - - // - // This section is specified/returned if CONTEXT_DEBUG_REGISTERS is - // set in ContextFlags. Note that CONTEXT_DEBUG_REGISTERS is NOT - // included in CONTEXT_FULL. - // - - ULONG Dr0; - ULONG Dr1; - ULONG Dr2; - ULONG Dr3; - ULONG Dr6; - ULONG Dr7; - - // - // This section is specified/returned if the - // ContextFlags word contians the flag CONTEXT_FLOATING_POINT. - // - - FLOATING_SAVE_AREA FloatSave; - - // - // This section is specified/returned if the - // ContextFlags word contians the flag CONTEXT_SEGMENTS. - // - - ULONG SegGs; - ULONG SegFs; - ULONG SegEs; - ULONG SegDs; - - // - // This section is specified/returned if the - // ContextFlags word contians the flag CONTEXT_INTEGER. - // - - ULONG Edi; - ULONG Esi; - ULONG Ebx; - ULONG Edx; - ULONG Ecx; - ULONG Eax; - - // - // This section is specified/returned if the - // ContextFlags word contians the flag CONTEXT_CONTROL. - // - - ULONG Ebp; - ULONG Eip; - ULONG SegCs; // MUST BE SANITIZED - ULONG EFlags; // MUST BE SANITIZED - ULONG Esp; - ULONG SegSs; - - // - // This section is specified/returned if the ContextFlags word - // contains the flag CONTEXT_EXTENDED_REGISTERS. - // The format and contexts are processor specific - // - - UCHAR ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION]; - -} CONTEXT; - -typedef CONTEXT *PCONTEXT; - -#include "poppack.h" - - -#endif //_X86_ - -#endif // _X86_ - -#ifdef _AMD64_ - -// -// Size of kernel mode stack. -// - -#define KERNEL_STACK_SIZE 0x6000 - -// -// Define size of large kernel mode stack for callbacks. -// - -#define KERNEL_LARGE_STACK_SIZE 0x12000 - -// -// Define number of pages to initialize in a large kernel stack. -// - -#define KERNEL_LARGE_STACK_COMMIT KERNEL_STACK_SIZE - -// -// Define the size of the stack used for processing an MCA exception. -// - -#define KERNEL_MCA_EXCEPTION_STACK_SIZE 0x2000 - -// -// The following values specify the type of access in the first parameter -// of the exception record whan the exception code specifies an access -// violation. -// - -#define EXCEPTION_READ_FAULT 0 // exception caused by a read -#define EXCEPTION_WRITE_FAULT 1 // exception caused by a write -#define EXCEPTION_EXECUTE_FAULT 8 // exception caused by an instruction fetch - - -// -// The following flags control the contents of the CONTEXT structure. -// - -#if !defined(RC_INVOKED) - -#define CONTEXT_AMD64 0x100000 - - - -#define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L) -#define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L) -#define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L) -#define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L) -#define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L) - -#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT) - -#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS) - -#define CONTEXT_XSTATE (CONTEXT_AMD64 | 0x20L) - -#define CONTEXT_EXCEPTION_ACTIVE 0x8000000 -#define CONTEXT_SERVICE_ACTIVE 0x10000000 -#define CONTEXT_EXCEPTION_REQUEST 0x40000000 -#define CONTEXT_EXCEPTION_REPORTING 0x80000000 - - - -#endif // !defined(RC_INVOKED) - -// -// Define initial MxCsr and FpCsr control. -// - -#define INITIAL_MXCSR 0x1f80 // initial MXCSR value -#define INITIAL_FPCSR 0x027f // initial FPCSR value - - -// -// Context Frame -// -// This frame has a several purposes: 1) it is used as an argument to -// NtContinue, 2) it is used to constuct a call frame for APC delivery, -// and 3) it is used in the user level thread creation routines. -// -// -// The flags field within this record controls the contents of a CONTEXT -// record. -// -// If the context record is used as an input parameter, then for each -// portion of the context record controlled by a flag whose value is -// set, it is assumed that that portion of the context record contains -// valid context. If the context record is being used to modify a threads -// context, then only that portion of the threads context is modified. -// -// If the context record is used as an output parameter to capture the -// context of a thread, then only those portions of the thread's context -// corresponding to set flags will be returned. -// -// CONTEXT_CONTROL specifies SegSs, Rsp, SegCs, Rip, and EFlags. -// -// CONTEXT_INTEGER specifies Rax, Rcx, Rdx, Rbx, Rbp, Rsi, Rdi, and R8-R15. -// -// CONTEXT_SEGMENTS specifies SegDs, SegEs, SegFs, and SegGs. -// -// CONTEXT_FLOATING_POINT specifies Xmm0-Xmm15. -// -// CONTEXT_DEBUG_REGISTERS specifies Dr0-Dr3 and Dr6-Dr7. -// - -typedef struct DECLSPEC_ALIGN(16) _CONTEXT { - - // - // Register parameter home addresses. - // - // N.B. These fields are for convience - they could be used to extend the - // context record in the future. - // - - ULONG64 P1Home; - ULONG64 P2Home; - ULONG64 P3Home; - ULONG64 P4Home; - ULONG64 P5Home; - ULONG64 P6Home; - - // - // Control flags. - // - - ULONG ContextFlags; - ULONG MxCsr; - - // - // Segment Registers and processor flags. - // - - USHORT SegCs; - USHORT SegDs; - USHORT SegEs; - USHORT SegFs; - USHORT SegGs; - USHORT SegSs; - ULONG EFlags; - - // - // Debug registers - // - - ULONG64 Dr0; - ULONG64 Dr1; - ULONG64 Dr2; - ULONG64 Dr3; - ULONG64 Dr6; - ULONG64 Dr7; - - // - // Integer registers. - // - - ULONG64 Rax; - ULONG64 Rcx; - ULONG64 Rdx; - ULONG64 Rbx; - ULONG64 Rsp; - ULONG64 Rbp; - ULONG64 Rsi; - ULONG64 Rdi; - ULONG64 R8; - ULONG64 R9; - ULONG64 R10; - ULONG64 R11; - ULONG64 R12; - ULONG64 R13; - ULONG64 R14; - ULONG64 R15; - - // - // Program counter. - // - - ULONG64 Rip; - - // - // Floating point state. - // - - union { - XMM_SAVE_AREA32 FltSave; - struct { - M128A Header[2]; - M128A Legacy[8]; - M128A Xmm0; - M128A Xmm1; - M128A Xmm2; - M128A Xmm3; - M128A Xmm4; - M128A Xmm5; - M128A Xmm6; - M128A Xmm7; - M128A Xmm8; - M128A Xmm9; - M128A Xmm10; - M128A Xmm11; - M128A Xmm12; - M128A Xmm13; - M128A Xmm14; - M128A Xmm15; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; - - // - // Vector registers. - // - - M128A VectorRegister[26]; - ULONG64 VectorControl; - - // - // Special debug control registers. - // - - ULONG64 DebugControl; - ULONG64 LastBranchToRip; - ULONG64 LastBranchFromRip; - ULONG64 LastExceptionToRip; - ULONG64 LastExceptionFromRip; -} CONTEXT, *PCONTEXT; - - -#endif // _AMD64_ - - -#ifdef _IA64_ - -// -// Define size of kernel mode stack. -// - -#define KERNEL_STACK_SIZE 0x8000 - -// -// Define size of large kernel mode stack for callbacks. -// - -#define KERNEL_LARGE_STACK_SIZE 0x1A000 - -// -// Define number of pages to initialize in a large kernel stack. -// - -#define KERNEL_LARGE_STACK_COMMIT 0x8000 - -// -// Define size of kernel mode backing store stack. -// - -#define KERNEL_BSTORE_SIZE 0x8000 - -// -// Define size of large kernel mode backing store for callbacks. -// - -#define KERNEL_LARGE_BSTORE_SIZE 0x10000 - -// -// Define number of pages to initialize in a large kernel backing store. -// - -#define KERNEL_LARGE_BSTORE_COMMIT 0x8000 - -// -// Define base address for kernel and user space. -// - -#define UREGION_INDEX 0 - -#define KREGION_INDEX 7 - -#define UADDRESS_BASE ((ULONGLONG)UREGION_INDEX << 61) - - -#define KADDRESS_BASE ((ULONGLONG)KREGION_INDEX << 61) - - -#if defined(_M_IA64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Define bit test intrinsics. -// - -#define BitTest _bittest -#define BitTestAndComplement _bittestandcomplement -#define BitTestAndSet _bittestandset -#define BitTestAndReset _bittestandreset - -#define BitTest64 _bittest64 -#define BitTestAndComplement64 _bittestandcomplement64 -#define BitTestAndSet64 _bittestandset64 -#define BitTestAndReset64 _bittestandreset64 - -__checkReturn -BOOLEAN -_bittest ( - __in_bcount((Offset+7)/8) LONG const *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandcomplement ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandreset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -__checkReturn -BOOLEAN -_bittest64 ( - __in_bcount((Offset+7)/8) LONG64 const *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandcomplement64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandset64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandreset64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -#pragma intrinsic(_bittest) -#pragma intrinsic(_bittestandcomplement) -#pragma intrinsic(_bittestandset) -#pragma intrinsic(_bittestandreset) - -#pragma intrinsic(_bittest64) -#pragma intrinsic(_bittestandcomplement64) -#pragma intrinsic(_bittestandset64) -#pragma intrinsic(_bittestandreset64) - -// -// Define bit scan intrinsics. -// - -#define BitScanForward _BitScanForward -#define BitScanReverse _BitScanReverse -#define BitScanForward64 _BitScanForward64 -#define BitScanReverse64 _BitScanReverse64 - -__success(return!=0) -BOOLEAN -_BitScanForward ( - __out ULONG *Index, - __in ULONG Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanReverse ( - __out ULONG *Index, - __in ULONG Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanForward64 ( - __out ULONG *Index, - __in ULONG64 Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanReverse64 ( - __out ULONG *Index, - __in ULONG64 Mask - ); - -#pragma intrinsic(_BitScanForward) -#pragma intrinsic(_BitScanReverse) -#pragma intrinsic(_BitScanForward64) -#pragma intrinsic(_BitScanReverse64) - -#define InterlockedCompareExchange16 _InterlockedCompareExchange16 - -SHORT -_InterlockedCompareExchange16 ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT ExChange, - __in SHORT Comperand - ); - -#pragma intrinsic(_InterlockedCompareExchange16) - -#ifdef __cplusplus -} -#endif - -#define InterlockedAdd _InterlockedAdd -#define InterlockedAddAcquire _InterlockedAdd_acq -#define InterlockedAddRelease _InterlockedAdd_rel - -#define InterlockedIncrement _InterlockedIncrement -#define InterlockedIncrementAcquire _InterlockedIncrement_acq -#define InterlockedIncrementRelease _InterlockedIncrement_rel - -#define InterlockedDecrement _InterlockedDecrement -#define InterlockedDecrementAcquire _InterlockedDecrement_acq -#define InterlockedDecrementRelease _InterlockedDecrement_rel - -#define InterlockedExchange _InterlockedExchange -#define InterlockedExchangeAcquire _InterlockedExchange_acq - -#define InterlockedExchangeAdd _InterlockedExchangeAdd -#define InterlockedExchangeAddAcquire _InterlockedExchangeAdd_acq -#define InterlockedExchangeAddRelease _InterlockedExchangeAdd_rel - -#define InterlockedAdd64 _InterlockedAdd64 -#define InterlockedAddAcquire64 _InterlockedAdd64_acq -#define InterlockedAddRelease64 _InterlockedAdd64_rel - -#define InterlockedIncrement64 _InterlockedIncrement64 -#define InterlockedIncrementAcquire64 _InterlockedIncrement64_acq -#define InterlockedIncrementRelease64 _InterlockedIncrement64_rel - -#define InterlockedDecrement64 _InterlockedDecrement64 -#define InterlockedDecrementAcquire64 _InterlockedDecrement64_acq -#define InterlockedDecrementRelease64 _InterlockedDecrement64_rel - -#define InterlockedExchange64 _InterlockedExchange64 -#define InterlockedExchangeAcquire64 _InterlockedExchange64_acq - -#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 -#define InterlockedExchangeAddAcquire64 _InterlockedExchangeAdd64_acq -#define InterlockedExchangeAddRelease64 _InterlockedExchangeAdd64_rel - -#define InterlockedCompareExchange64 _InterlockedCompareExchange64 -#define InterlockedCompareExchangeAcquire64 _InterlockedCompareExchange64_acq -#define InterlockedCompareExchangeRelease64 _InterlockedCompareExchange64_rel - -#define InterlockedCompare64Exchange128 _InterlockedCompare64Exchange128 -#define InterlockedCompare64ExchangeAcquire128 _InterlockedCompare64Exchange128_acq -#define InterlockedCompare64ExchangeRelease128 _InterlockedCompare64Exchange128_rel - -#define InterlockedCompareExchange _InterlockedCompareExchange -#define InterlockedCompareExchangeAcquire _InterlockedCompareExchange_acq -#define InterlockedCompareExchangeRelease _InterlockedCompareExchange_rel - -#define InterlockedExchangePointer _InterlockedExchangePointer -#define InterlockedExchangePointerAcquire _InterlockedExchangePointer_acq - -#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer_rel -#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer_acq - - -#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONG64 *)a, b) -#define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONG64 *)a) -#define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONG64 *)a) - -#define InterlockedOr _InterlockedOr -#define InterlockedOrAcquire _InterlockedOr_acq -#define InterlockedOrRelease _InterlockedOr_rel -#define InterlockedOr8 _InterlockedOr8 -#define InterlockedOr8Acquire _InterlockedOr8_acq -#define InterlockedOr8Release _InterlockedOr8_rel -#define InterlockedOr16 _InterlockedOr16 -#define InterlockedOr16Acquire _InterlockedOr16_acq -#define InterlockedOr16Release _InterlockedOr16_rel -#define InterlockedOr64 _InterlockedOr64 -#define InterlockedOr64Acquire _InterlockedOr64_acq -#define InterlockedOr64Release _InterlockedOr64_rel -#define InterlockedXor _InterlockedXor -#define InterlockedXorAcquire _InterlockedXor_acq -#define InterlockedXorRelease _InterlockedXor_rel -#define InterlockedXor8 _InterlockedXor8 -#define InterlockedXor8Acquire _InterlockedXor8_acq -#define InterlockedXor8Release _InterlockedXor8_rel -#define InterlockedXor16 _InterlockedXor16 -#define InterlockedXor16Acquire _InterlockedXor16_acq -#define InterlockedXor16Release _InterlockedXor16_rel -#define InterlockedXor64 _InterlockedXor64 -#define InterlockedXor64Acquire _InterlockedXor64_acq -#define InterlockedXor64Release _InterlockedXor64_rel -#define InterlockedAnd _InterlockedAnd -#define InterlockedAndAcquire _InterlockedAnd_acq -#define InterlockedAndRelease _InterlockedAnd_rel -#define InterlockedAnd8 _InterlockedAnd8 -#define InterlockedAnd8Acquire _InterlockedAnd8_acq -#define InterlockedAnd8Release _InterlockedAnd8_rel -#define InterlockedAnd16 _InterlockedAnd16 -#define InterlockedAnd16Acquire _InterlockedAnd16_acq -#define InterlockedAnd16Release _InterlockedAnd16_rel -#define InterlockedAnd64 _InterlockedAnd64 -#define InterlockedAnd64Acquire _InterlockedAnd64_acq -#define InterlockedAnd64Release _InterlockedAnd64_rel - -#ifdef __cplusplus -extern "C" { -#endif - -LONG -__cdecl -InterlockedAdd ( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedAddAcquire ( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedAddRelease ( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONGLONG -__cdecl -InterlockedAdd64 ( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedAddAcquire64 ( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - - -LONGLONG -__cdecl -InterlockedAddRelease64 ( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONG -__cdecl -InterlockedIncrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedDecrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedIncrementAcquire( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedDecrementAcquire( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedIncrementRelease( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedDecrementRelease( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedExchange( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Value - ); - -LONG -__cdecl -InterlockedExchangeAcquire( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Value - ); - -LONG -__cdecl -InterlockedExchangeAdd( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedExchangeAddAcquire( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedExchangeAddRelease( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedCompareExchange ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - - -LONG -__cdecl -InterlockedCompareExchangeRelease ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - - -LONG -__cdecl -InterlockedCompareExchangeAcquire ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - - -LONGLONG -__cdecl -InterlockedIncrement64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedIncrementAcquire64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedIncrementRelease64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedDecrement64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedDecrementAcquire64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedDecrementRelease64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedExchange64( - __inout __drv_interlocked LONGLONG volatile *Target, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedExchangeAcquire64( - __inout __drv_interlocked LONGLONG volatile *Target, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedExchangeAdd64( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedExchangeAddAcquire64( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedExchangeAddRelease64( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedCompareExchange64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG ExChange, - __in LONGLONG Comperand - ); - -LONGLONG -__cdecl -InterlockedCompareExchangeAcquire64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG ExChange, - __in LONGLONG Comperand - ); - -LONGLONG -__cdecl -InterlockedCompareExchangeRelease64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG ExChange, - __in LONGLONG Comperand - ); - -LONG64 -__cdecl -InterlockedCompare64Exchange128( - __inout_bcount(16) __drv_interlocked LONG64 volatile *Destination, - __in LONG64 ExchangeHigh, - __in LONG64 ExchangeLow, - __in LONG64 Comperand - ); - -LONG64 -__cdecl -InterlockedCompare64ExchangeAcquire128( - __inout_bcount(16) __drv_interlocked LONG64 volatile *Destination, - __in LONG64 ExchangeHigh, - __in LONG64 ExchangeLow, - __in LONG64 Comperand - ); - -LONG64 -__cdecl -InterlockedCompare64ExchangeRelease128( - __inout_bcount(16) __drv_interlocked LONG64 volatile *Destination, - __in LONG64 ExchangeHigh, - __in LONG64 ExchangeLow, - __in LONG64 Comperand - ); - -PVOID -__cdecl -InterlockedCompareExchangePointer ( - __inout __drv_interlocked PVOID volatile *Destination, - __in PVOID Exchange, - __in PVOID Comperand - ); - -PVOID -__cdecl -InterlockedCompareExchangePointerAcquire ( - __inout __drv_interlocked PVOID volatile *Destination, - __in PVOID Exchange, - __in PVOID Comperand - ); - -PVOID -__cdecl -InterlockedCompareExchangePointerRelease ( - __inout __drv_interlocked PVOID volatile *Destination, - __in PVOID Exchange, - __in PVOID Comperand - ); - -PVOID -__cdecl -InterlockedExchangePointer( - __inout __drv_interlocked PVOID volatile *Target, - __in PVOID Value - ); - -PVOID -__cdecl -InterlockedExchangePointerAcquire( - __inout __drv_interlocked PVOID volatile *Target, - __in PVOID Value - ); - -LONG -__cdecl -InterlockedOr ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedOrAcquire ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedOrRelease ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -CHAR -__cdecl -InterlockedOr8 ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedOr8Acquire ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedOr8Release ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -SHORT -__cdecl -InterlockedOr16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedOr16Acquire ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedOr16Release ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -LONGLONG -__cdecl -InterlockedOr64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedOr64Acquire ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedOr64Release ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONG -__cdecl -InterlockedXor ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedXorAcquire ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedXorRelease ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -CHAR -__cdecl -InterlockedXor8 ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedXor8Acquire ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedXor8Release ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -SHORT -__cdecl -InterlockedXor16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedXor16Acquire ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedXor16Release ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -LONGLONG -__cdecl -InterlockedXor64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedXor64Acquire ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedXor64Release ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONG -__cdecl -InterlockedAnd ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedAndAcquire ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedAndRelease ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -CHAR -__cdecl -InterlockedAnd8 ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedAnd8Acquire ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedAnd8Release ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -SHORT -__cdecl -InterlockedAnd16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedAnd16Acquire ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedAnd16Release ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -LONGLONG -__cdecl -InterlockedAnd64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedAnd64Acquire ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedAnd64Release ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -#pragma intrinsic(_InterlockedAdd) -#pragma intrinsic(_InterlockedIncrement) -#pragma intrinsic(_InterlockedIncrement_acq) -#pragma intrinsic(_InterlockedIncrement_rel) -#pragma intrinsic(_InterlockedDecrement) -#pragma intrinsic(_InterlockedDecrement_acq) -#pragma intrinsic(_InterlockedDecrement_rel) -#pragma intrinsic(_InterlockedExchange) -#pragma intrinsic(_InterlockedCompareExchange) -#pragma intrinsic(_InterlockedCompareExchange_acq) -#pragma intrinsic(_InterlockedCompareExchange_rel) -#pragma intrinsic(_InterlockedExchangeAdd) -#pragma intrinsic(_InterlockedAdd64) -#pragma intrinsic(_InterlockedIncrement64) -#pragma intrinsic(_InterlockedDecrement64) -#pragma intrinsic(_InterlockedExchange64) -#pragma intrinsic(_InterlockedExchange64_acq) -#pragma intrinsic(_InterlockedCompareExchange64) -#pragma intrinsic(_InterlockedCompareExchange64_acq) -#pragma intrinsic(_InterlockedCompareExchange64_rel) -#pragma intrinsic(_InterlockedCompare64Exchange128) -#pragma intrinsic(_InterlockedCompare64Exchange128_acq) -#pragma intrinsic(_InterlockedCompare64Exchange128_rel) -#pragma intrinsic(_InterlockedExchangeAdd64) -#pragma intrinsic(_InterlockedExchangePointer) -#pragma intrinsic(_InterlockedCompareExchangePointer) -#pragma intrinsic(_InterlockedCompareExchangePointer_acq) -#pragma intrinsic(_InterlockedCompareExchangePointer_rel) -#pragma intrinsic(_InterlockedAdd_acq) -#pragma intrinsic(_InterlockedAdd_rel) -#pragma intrinsic(_InterlockedExchange_acq) -#pragma intrinsic(_InterlockedExchangeAdd_acq) -#pragma intrinsic(_InterlockedExchangeAdd_rel) -#pragma intrinsic(_InterlockedAdd64_acq) -#pragma intrinsic(_InterlockedAdd64_rel) -#pragma intrinsic(_InterlockedIncrement64_acq) -#pragma intrinsic(_InterlockedIncrement64_rel) -#pragma intrinsic(_InterlockedDecrement64_acq) -#pragma intrinsic(_InterlockedDecrement64_rel) -#pragma intrinsic(_InterlockedExchangeAdd64_acq) -#pragma intrinsic(_InterlockedExchangeAdd64_rel) -#pragma intrinsic(_InterlockedExchangePointer_acq) -#pragma intrinsic (_InterlockedOr) -#pragma intrinsic (_InterlockedOr_acq) -#pragma intrinsic (_InterlockedOr_rel) -#pragma intrinsic (_InterlockedOr8) -#pragma intrinsic (_InterlockedOr8_acq) -#pragma intrinsic (_InterlockedOr8_rel) -#pragma intrinsic (_InterlockedOr16) -#pragma intrinsic (_InterlockedOr16_acq) -#pragma intrinsic (_InterlockedOr16_rel) -#pragma intrinsic (_InterlockedOr64) -#pragma intrinsic (_InterlockedOr64_acq) -#pragma intrinsic (_InterlockedOr64_rel) -#pragma intrinsic (_InterlockedXor) -#pragma intrinsic (_InterlockedXor_acq) -#pragma intrinsic (_InterlockedXor_rel) -#pragma intrinsic (_InterlockedXor8) -#pragma intrinsic (_InterlockedXor8_acq) -#pragma intrinsic (_InterlockedXor8_rel) -#pragma intrinsic (_InterlockedXor16) -#pragma intrinsic (_InterlockedXor16_acq) -#pragma intrinsic (_InterlockedXor16_rel) -#pragma intrinsic (_InterlockedXor64) -#pragma intrinsic (_InterlockedXor64_acq) -#pragma intrinsic (_InterlockedXor64_rel) -#pragma intrinsic (_InterlockedAnd) -#pragma intrinsic (_InterlockedAnd_acq) -#pragma intrinsic (_InterlockedAnd_rel) -#pragma intrinsic (_InterlockedAnd8) -#pragma intrinsic (_InterlockedAnd8_acq) -#pragma intrinsic (_InterlockedAnd8_rel) -#pragma intrinsic (_InterlockedAnd16) -#pragma intrinsic (_InterlockedAnd16_acq) -#pragma intrinsic (_InterlockedAnd16_rel) -#pragma intrinsic (_InterlockedAnd64) -#pragma intrinsic (_InterlockedAnd64_acq) -#pragma intrinsic (_InterlockedAnd64_rel) - -#if !defined (InterlockedAnd64) - -#define InterlockedAnd64 InterlockedAnd64_Inline - -LONGLONG -FORCEINLINE -InterlockedAnd64_Inline ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Destination; - } while (InterlockedCompareExchange64(Destination, - Old & Value, - Old) != Old); - - return Old; -} - -#endif - -#define InterlockedAndAffinity InterlockedAnd64 - -#if !defined (InterlockedOr64) - -#define InterlockedOr64 InterlockedOr64_Inline - -LONGLONG -FORCEINLINE -InterlockedOr64_Inline ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Destination; - } while (InterlockedCompareExchange64(Destination, - Old | Value, - Old) != Old); - - return Old; -} - -#endif - -#define InterlockedOrAffinity InterlockedOr64 - -#if !defined (InterlockedXor64) - -#define InterlockedXor64 InterlockedXor64_Inline - -LONGLONG -FORCEINLINE -InterlockedXor64_Inline ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Destination; - } while (InterlockedCompareExchange64(Destination, - Old ^ Value, - Old) != Old); - - return Old; -} - -#endif - -#if !defined (InterlockedBitTestAndSet) - -#define InterlockedBitTestAndSet InterlockedBitTestAndSet_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndSet_Inline ( - __inout __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - LONG tBit; - - tBit = 1<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedOr (&Base[Bit/(sizeof (*Base)*8)], tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndReset) - -#define InterlockedBitTestAndReset InterlockedBitTestAndReset_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndReset_Inline ( - __inout __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - LONG tBit; - - tBit = 1<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedAnd (&Base[Bit/(sizeof (*Base)*8)], ~tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndSet64) - -#define InterlockedBitTestAndSet64 InterlockedBitTestAndSet64_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndSet64_Inline ( - __inout __drv_interlocked LONG64 volatile *Base, - __in LONG64 Bit - ) -{ - LONG64 tBit; - - tBit = 1i64<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedOr64 (&Base[Bit/(sizeof (*Base)*8)], tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndReset64) - -#define InterlockedBitTestAndReset64 InterlockedBitTestAndReset64_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndReset64_Inline ( - __inout __drv_interlocked LONG64 volatile *Base, - __in LONG64 Bit - ) -{ - LONG64 tBit; - - tBit = 1i64<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedAnd64 (&Base[Bit/(sizeof (*Base)*8)], ~tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndComplement) - -#define InterlockedBitTestAndComplement InterlockedBitTestAndComplement_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndComplement_Inline ( - __inout __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - LONG tBit; - - tBit = 1<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedXor (&Base[Bit/(sizeof (*Base)*8)], tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndComplement64) - -#define InterlockedBitTestAndComplement64 InterlockedBitTestAndComplement64_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndComplement64_Inline ( - __inout __drv_interlocked LONG64 volatile *Base, - __in LONG64 Bit - ) -{ - LONG64 tBit; - - tBit = 1i64<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedXor64 (&Base[Bit/(sizeof (*Base)*8)], tBit)&tBit) != 0); -} - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* defined(_M_IA64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -void -__yield( - void - ); - -void -__mf( - void - ); - -void -__lfetch( - int Level, - __in volatile VOID CONST *Address - ); - -void -__lfetchfault( - __in int Level, - __in volatile VOID CONST *Address - ); - -void -__lfetch_excl( - __in int Level, - __in volatile VOID CONST *Address - ); - -void -__lfetchfault_excl( - __in int Level, - __in volatile VOID CONST *Address - ); - -// -// __lfetch control defines. -// - -#define MD_LFHINT_NONE 0x00 -#define MD_LFHINT_NT1 0x01 -#define MD_LFHINT_NT2 0x02 -#define MD_LFHINT_NTA 0x03 - -#pragma intrinsic (__yield) -#pragma intrinsic (__lfetch) -#pragma intrinsic (__lfetchfault) -#pragma intrinsic (__lfetchfault_excl) -#pragma intrinsic (__lfetch_excl) -#pragma intrinsic (__mf) - -// -// Define function to read the value of the time stamp counter -// -// N.B. The register number for the time stamp counter is CV_IA64_ApITC which -// is 3116. -// - -#define ReadTimeStampCounter() __getReg(3116) - -unsigned __int64 -__getReg ( - __in int Number - ); - -#pragma intrinsic(__getReg) - -#define YieldProcessor __yield -#define MemoryBarrier __mf -#define PreFetchCacheLine __lfetch -#define PrefetchForWrite(p) -#define ReadForWriteAccess(p) (__lfetch_excl(MD_LFHINT_NONE, (p)), (*(p))) - - -// -// PreFetchCacheLine level defines. -// - -#define PF_TEMPORAL_LEVEL_1 MD_LFHINT_NONE -#define PF_TEMPORAL_LEVEL_2 MD_LFHINT_NT1 -#define PF_TEMPORAL_LEVEL_3 MD_LFHINT_NT2 -#define PF_NON_TEMPORAL_LEVEL_ALL MD_LFHINT_NTA - -// -// Define functions to capture the high 64-bits of a 128-bit multiply. -// - -#define UnsignedMultiplyHigh __UMULH - -ULONGLONG -UnsignedMultiplyHigh ( - __in ULONGLONG Multiplier, - __in ULONGLONG Multiplicand - ); - -#pragma intrinsic(__UMULH) - -#if (_MSC_VER >= 1400) - -#define UnsignedMultiply128 _umul128 - -ULONG64 -UnsignedMultiply128 ( - __in unsigned __int64 Multiplier, - __in unsigned __int64 Multiplicand, - __out __deref_out_range(==,Multiplier * Multiplicand) unsigned __int64 *HighProduct - ); - -#pragma intrinsic(_umul128) - -#endif - -#ifdef __cplusplus -} -#endif - - -// -// The following values specify the type of failing access when the status is -// STATUS_ACCESS_VIOLATION and the first parameter in the exception record. -// - -#define EXCEPTION_READ_FAULT 0 // Access violation was caused by a read -#define EXCEPTION_WRITE_FAULT 1 // Access violation was caused by a write -#define EXCEPTION_EXECUTE_FAULT 2 // Access violation was caused by an instruction fetch - -// -// The following flags control the contents of the CONTEXT structure. -// - -#if !defined(RC_INVOKED) - -#define CONTEXT_IA64 0x00080000 - -#define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001L) -#define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002L) -#define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004L) -#define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008L) -#define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010L) -#define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020L) // Includes StIPSR - - -#define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT) -#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL) -#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL) - -#define CONTEXT_EXCEPTION_ACTIVE 0x8000000 -#define CONTEXT_SERVICE_ACTIVE 0x10000000 -#define CONTEXT_EXCEPTION_REQUEST 0x40000000 -#define CONTEXT_EXCEPTION_REPORTING 0x80000000 - -#endif // !defined(RC_INVOKED) - -// -// Context Frame -// -// This frame has a several purposes: 1) it is used as an argument to -// NtContinue, 2) it is used to construct a call frame for APC delivery, -// 3) it is used to construct a call frame for exception dispatching -// in user mode, 4) it is used in the user level thread creation -// routines, and 5) it is used to to pass thread state to debuggers. -// -// N.B. Because this record is used as a call frame, it must be EXACTLY -// a multiple of 16 bytes in length and aligned on a 16-byte boundary. -// - -typedef struct _CONTEXT { - - // - // The flags values within this flag control the contents of - // a CONTEXT record. - // - // If the context record is used as an input parameter, then - // for each portion of the context record controlled by a flag - // whose value is set, it is assumed that that portion of the - // context record contains valid context. If the context record - // is being used to modify a thread's context, then only that - // portion of the threads context will be modified. - // - // If the context record is used as an __inout parameter to capture - // the context of a thread, then only those portions of the thread's - // context corresponding to set flags will be returned. - // - // The context record is never used as an __out only parameter. - // - - ULONG ContextFlags; - ULONG Fill1[3]; // for alignment of following on 16-byte boundary - - // - // This section is specified/returned if the ContextFlags word contains - // the flag CONTEXT_DEBUG. - // - // N.B. CONTEXT_DEBUG is *not* part of CONTEXT_FULL. - // - - ULONGLONG DbI0; - ULONGLONG DbI1; - ULONGLONG DbI2; - ULONGLONG DbI3; - ULONGLONG DbI4; - ULONGLONG DbI5; - ULONGLONG DbI6; - ULONGLONG DbI7; - - ULONGLONG DbD0; - ULONGLONG DbD1; - ULONGLONG DbD2; - ULONGLONG DbD3; - ULONGLONG DbD4; - ULONGLONG DbD5; - ULONGLONG DbD6; - ULONGLONG DbD7; - - // - // This section is specified/returned if the ContextFlags word contains - // the flag CONTEXT_LOWER_FLOATING_POINT. - // - - FLOAT128 FltS0; - FLOAT128 FltS1; - FLOAT128 FltS2; - FLOAT128 FltS3; - FLOAT128 FltT0; - FLOAT128 FltT1; - FLOAT128 FltT2; - FLOAT128 FltT3; - FLOAT128 FltT4; - FLOAT128 FltT5; - FLOAT128 FltT6; - FLOAT128 FltT7; - FLOAT128 FltT8; - FLOAT128 FltT9; - - // - // This section is specified/returned if the ContextFlags word contains - // the flag CONTEXT_HIGHER_FLOATING_POINT. - // - - FLOAT128 FltS4; - FLOAT128 FltS5; - FLOAT128 FltS6; - FLOAT128 FltS7; - FLOAT128 FltS8; - FLOAT128 FltS9; - FLOAT128 FltS10; - FLOAT128 FltS11; - FLOAT128 FltS12; - FLOAT128 FltS13; - FLOAT128 FltS14; - FLOAT128 FltS15; - FLOAT128 FltS16; - FLOAT128 FltS17; - FLOAT128 FltS18; - FLOAT128 FltS19; - - FLOAT128 FltF32; - FLOAT128 FltF33; - FLOAT128 FltF34; - FLOAT128 FltF35; - FLOAT128 FltF36; - FLOAT128 FltF37; - FLOAT128 FltF38; - FLOAT128 FltF39; - - FLOAT128 FltF40; - FLOAT128 FltF41; - FLOAT128 FltF42; - FLOAT128 FltF43; - FLOAT128 FltF44; - FLOAT128 FltF45; - FLOAT128 FltF46; - FLOAT128 FltF47; - FLOAT128 FltF48; - FLOAT128 FltF49; - - FLOAT128 FltF50; - FLOAT128 FltF51; - FLOAT128 FltF52; - FLOAT128 FltF53; - FLOAT128 FltF54; - FLOAT128 FltF55; - FLOAT128 FltF56; - FLOAT128 FltF57; - FLOAT128 FltF58; - FLOAT128 FltF59; - - FLOAT128 FltF60; - FLOAT128 FltF61; - FLOAT128 FltF62; - FLOAT128 FltF63; - FLOAT128 FltF64; - FLOAT128 FltF65; - FLOAT128 FltF66; - FLOAT128 FltF67; - FLOAT128 FltF68; - FLOAT128 FltF69; - - FLOAT128 FltF70; - FLOAT128 FltF71; - FLOAT128 FltF72; - FLOAT128 FltF73; - FLOAT128 FltF74; - FLOAT128 FltF75; - FLOAT128 FltF76; - FLOAT128 FltF77; - FLOAT128 FltF78; - FLOAT128 FltF79; - - FLOAT128 FltF80; - FLOAT128 FltF81; - FLOAT128 FltF82; - FLOAT128 FltF83; - FLOAT128 FltF84; - FLOAT128 FltF85; - FLOAT128 FltF86; - FLOAT128 FltF87; - FLOAT128 FltF88; - FLOAT128 FltF89; - - FLOAT128 FltF90; - FLOAT128 FltF91; - FLOAT128 FltF92; - FLOAT128 FltF93; - FLOAT128 FltF94; - FLOAT128 FltF95; - FLOAT128 FltF96; - FLOAT128 FltF97; - FLOAT128 FltF98; - FLOAT128 FltF99; - - FLOAT128 FltF100; - FLOAT128 FltF101; - FLOAT128 FltF102; - FLOAT128 FltF103; - FLOAT128 FltF104; - FLOAT128 FltF105; - FLOAT128 FltF106; - FLOAT128 FltF107; - FLOAT128 FltF108; - FLOAT128 FltF109; - - FLOAT128 FltF110; - FLOAT128 FltF111; - FLOAT128 FltF112; - FLOAT128 FltF113; - FLOAT128 FltF114; - FLOAT128 FltF115; - FLOAT128 FltF116; - FLOAT128 FltF117; - FLOAT128 FltF118; - FLOAT128 FltF119; - - FLOAT128 FltF120; - FLOAT128 FltF121; - FLOAT128 FltF122; - FLOAT128 FltF123; - FLOAT128 FltF124; - FLOAT128 FltF125; - FLOAT128 FltF126; - FLOAT128 FltF127; - - // - // This section is specified/returned if the ContextFlags word contains - // the flag CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT | CONTEXT_CONTROL. - // - - ULONGLONG StFPSR; // FP status - - // - // This section is specified/returned if the ContextFlags word contains - // the flag CONTEXT_INTEGER. - // - // N.B. The registers gp, sp, rp are part of the control context - // - - ULONGLONG IntGp; // r1, volatile - ULONGLONG IntT0; // r2-r3, volatile - ULONGLONG IntT1; // - ULONGLONG IntS0; // r4-r7, preserved - ULONGLONG IntS1; - ULONGLONG IntS2; - ULONGLONG IntS3; - ULONGLONG IntV0; // r8, volatile - ULONGLONG IntT2; // r9-r11, volatile - ULONGLONG IntT3; - ULONGLONG IntT4; - ULONGLONG IntSp; // stack pointer (r12), special - ULONGLONG IntTeb; // teb (r13), special - ULONGLONG IntT5; // r14-r31, volatile - ULONGLONG IntT6; - ULONGLONG IntT7; - ULONGLONG IntT8; - ULONGLONG IntT9; - ULONGLONG IntT10; - ULONGLONG IntT11; - ULONGLONG IntT12; - ULONGLONG IntT13; - ULONGLONG IntT14; - ULONGLONG IntT15; - ULONGLONG IntT16; - ULONGLONG IntT17; - ULONGLONG IntT18; - ULONGLONG IntT19; - ULONGLONG IntT20; - ULONGLONG IntT21; - ULONGLONG IntT22; - - ULONGLONG IntNats; // Nat bits for r1-r31 - // r1-r31 in bits 1 thru 31. - ULONGLONG Preds; // predicates, preserved - - ULONGLONG BrRp; // return pointer, b0, preserved - ULONGLONG BrS0; // b1-b5, preserved - ULONGLONG BrS1; - ULONGLONG BrS2; - ULONGLONG BrS3; - ULONGLONG BrS4; - ULONGLONG BrT0; // b6-b7, volatile - ULONGLONG BrT1; - - // - // This section is specified/returned if the ContextFlags word contains - // the flag CONTEXT_CONTROL. - // - - // Other application registers - ULONGLONG ApUNAT; // User Nat collection register, preserved - ULONGLONG ApLC; // Loop counter register, preserved - ULONGLONG ApEC; // Epilog counter register, preserved - ULONGLONG ApCCV; // CMPXCHG value register, volatile - ULONGLONG ApDCR; // Default control register (TBD) - - // Register stack info - ULONGLONG RsPFS; // Previous function state, preserved - ULONGLONG RsBSP; // Backing store pointer, preserved - ULONGLONG RsBSPSTORE; - ULONGLONG RsRSC; // RSE configuration, volatile - ULONGLONG RsRNAT; // RSE Nat collection register, preserved - - // Trap Status Information - ULONGLONG StIPSR; // Interruption Processor Status - ULONGLONG StIIP; // Interruption IP - ULONGLONG StIFS; // Interruption Function State - - // iA32 related control registers - ULONGLONG StFCR; // copy of Ar21 - ULONGLONG Eflag; // Eflag copy of Ar24 - ULONGLONG SegCSD; // iA32 CSDescriptor (Ar25) - ULONGLONG SegSSD; // iA32 SSDescriptor (Ar26) - ULONGLONG Cflag; // Cr0+Cr4 copy of Ar27 - ULONGLONG StFSR; // x86 FP status (copy of AR28) - ULONGLONG StFIR; // x86 FP status (copy of AR29) - ULONGLONG StFDR; // x86 FP status (copy of AR30) - - ULONGLONG UNUSEDPACK; // added to pack StFDR to 16-bytes - -} CONTEXT, *PCONTEXT; - -// -// Plabel descriptor structure definition -// - -typedef struct _PLABEL_DESCRIPTOR { - ULONGLONG EntryPoint; - ULONGLONG GlobalPointer; -} PLABEL_DESCRIPTOR, *PPLABEL_DESCRIPTOR; - - - -#endif // _IA64_ - - -// -// Well known SID definitions for lookup. -// - -typedef enum { - - WinNullSid = 0, - WinWorldSid = 1, - WinLocalSid = 2, - WinCreatorOwnerSid = 3, - WinCreatorGroupSid = 4, - WinCreatorOwnerServerSid = 5, - WinCreatorGroupServerSid = 6, - WinNtAuthoritySid = 7, - WinDialupSid = 8, - WinNetworkSid = 9, - WinBatchSid = 10, - WinInteractiveSid = 11, - WinServiceSid = 12, - WinAnonymousSid = 13, - WinProxySid = 14, - WinEnterpriseControllersSid = 15, - WinSelfSid = 16, - WinAuthenticatedUserSid = 17, - WinRestrictedCodeSid = 18, - WinTerminalServerSid = 19, - WinRemoteLogonIdSid = 20, - WinLogonIdsSid = 21, - WinLocalSystemSid = 22, - WinLocalServiceSid = 23, - WinNetworkServiceSid = 24, - WinBuiltinDomainSid = 25, - WinBuiltinAdministratorsSid = 26, - WinBuiltinUsersSid = 27, - WinBuiltinGuestsSid = 28, - WinBuiltinPowerUsersSid = 29, - WinBuiltinAccountOperatorsSid = 30, - WinBuiltinSystemOperatorsSid = 31, - WinBuiltinPrintOperatorsSid = 32, - WinBuiltinBackupOperatorsSid = 33, - WinBuiltinReplicatorSid = 34, - WinBuiltinPreWindows2000CompatibleAccessSid = 35, - WinBuiltinRemoteDesktopUsersSid = 36, - WinBuiltinNetworkConfigurationOperatorsSid = 37, - WinAccountAdministratorSid = 38, - WinAccountGuestSid = 39, - WinAccountKrbtgtSid = 40, - WinAccountDomainAdminsSid = 41, - WinAccountDomainUsersSid = 42, - WinAccountDomainGuestsSid = 43, - WinAccountComputersSid = 44, - WinAccountControllersSid = 45, - WinAccountCertAdminsSid = 46, - WinAccountSchemaAdminsSid = 47, - WinAccountEnterpriseAdminsSid = 48, - WinAccountPolicyAdminsSid = 49, - WinAccountRasAndIasServersSid = 50, - WinNTLMAuthenticationSid = 51, - WinDigestAuthenticationSid = 52, - WinSChannelAuthenticationSid = 53, - WinThisOrganizationSid = 54, - WinOtherOrganizationSid = 55, - WinBuiltinIncomingForestTrustBuildersSid = 56, - WinBuiltinPerfMonitoringUsersSid = 57, - WinBuiltinPerfLoggingUsersSid = 58, - WinBuiltinAuthorizationAccessSid = 59, - WinBuiltinTerminalServerLicenseServersSid = 60, - WinBuiltinDCOMUsersSid = 61, - WinBuiltinIUsersSid = 62, - WinIUserSid = 63, - WinBuiltinCryptoOperatorsSid = 64, - WinUntrustedLabelSid = 65, - WinLowLabelSid = 66, - WinMediumLabelSid = 67, - WinHighLabelSid = 68, - WinSystemLabelSid = 69, - WinWriteRestrictedCodeSid = 70, - WinCreatorOwnerRightsSid = 71, - WinCacheablePrincipalsGroupSid = 72, - WinNonCacheablePrincipalsGroupSid = 73, - WinEnterpriseReadonlyControllersSid = 74, - WinAccountReadonlyControllersSid = 75, - WinBuiltinEventLogReadersGroup = 76, - WinNewEnterpriseReadonlyControllersSid = 77, - WinBuiltinCertSvcDComAccessGroup = 78, - WinMediumPlusLabelSid = 79, - WinLocalLogonSid = 80, - WinConsoleLogonSid = 81, - WinThisOrganizationCertificateSid = 82, -} WELL_KNOWN_SID_TYPE; - -// -// Unsolicited Input is obsolete and unused. -// - -#define SE_UNSOLICITED_INPUT_PRIVILEGE (6L) - - -#ifndef _NTLSA_IFS_ - - -// -// All of this stuff (between the Ifndef _NTLSA_AUDIT_ and its endif) were not -// present in NTIFS prior to Windows Server 2003 SP1. All of the definitions however -// exist down to windows 2000 (except for the few exceptions noted in the code). -// - -#ifndef _NTLSA_AUDIT_ -#define _NTLSA_AUDIT_ - -///////////////////////////////////////////////////////////////////////// -// // -// Data types related to Auditing // -// // -///////////////////////////////////////////////////////////////////////// - - -// -// The following enumerated type is used between the reference monitor and -// LSA in the generation of audit messages. It is used to indicate the -// type of data being passed as a parameter from the reference monitor -// to LSA. LSA is responsible for transforming the specified data type -// into a set of unicode strings that are added to the event record in -// the audit log. -// - -typedef enum _SE_ADT_PARAMETER_TYPE { - - SeAdtParmTypeNone = 0, //Produces 1 parameter - //Received value: - // - // None. - // - //Results in: - // - // a unicode string containing "-". - // - //Note: This is typically used to - // indicate that a parameter value - // was not available. - // - - SeAdtParmTypeString, //Produces 1 parameter. - //Received Value: - // - // Unicode String (variable length) - // - //Results in: - // - // No transformation. The string - // entered into the event record as - // received. - // - // The Address value of the audit info - // should be a pointer to a UNICODE_STRING - // structure. - - - - SeAdtParmTypeFileSpec, //Produces 1 parameter. - //Received value: - // - // Unicode string containing a file or - // directory name. - // - //Results in: - // - // Unicode string with the prefix of the - // file's path replaced by a drive letter - // if possible. - // - - - - - SeAdtParmTypeUlong, //Produces 1 parameter - //Received value: - // - // Ulong - // - //Results in: - // - // Unicode string representation of - // unsigned integer value. - - - SeAdtParmTypeSid, //Produces 1 parameter. - //Received value: - // - // SID (variable length) - // - //Results in: - // - // String representation of SID - // - - - - - SeAdtParmTypeLogonId, //Produces 4 parameters. - //Received Value: - // - // LUID (fixed length) - // - //Results in: - // - // param 1: Sid string - // param 2: Username string - // param 3: domain name string - // param 4: Logon ID (Luid) string - - - SeAdtParmTypeNoLogonId, //Produces 3 parameters. - //Received value: - // - // None. - // - //Results in: - // - // param 1: "-" - // param 2: "-" - // param 3: "-" - // param 4: "-" - // - //Note: - // - // This type is used when a logon ID - // is needed, but one is not available - // to pass. For example, if an - // impersonation logon ID is expected - // but the subject is not impersonating - // anyone. - // - - SeAdtParmTypeAccessMask, //Produces 1 parameter with formatting. - //Received value: - // - // ACCESS_MASK followed by - // a Unicode string. The unicode - // string contains the name of the - // type of object the access mask - // applies to. The event's source - // further qualifies the object type. - // - //Results in: - // - // formatted unicode string built to - // take advantage of the specified - // source's parameter message file. - // - //Note: - // - // An access mask containing three - // access types for a Widget object - // type (defined by the Foozle source) - // might end up looking like: - // - // %%1062\n\t\t%1066\n\t\t%%601 - // - // The %%numbers are signals to the - // event viewer to perform parameter - // substitution before display. - // - - - - SeAdtParmTypePrivs, //Produces 1 parameter with formatting. - //Received value: - // - //Results in: - // - // formatted unicode string similar to - // that for access types. Each priv - // will be formatted to be displayed - // on its own line. E.g., - // - // %%642\n\t\t%%651\n\t\t%%655 - // - - SeAdtParmTypeObjectTypes, //Produces 10 parameters with formatting. - //Received value: - // - // Produces a list a stringized GUIDS along - // with information similar to that for - // an access mask. - - SeAdtParmTypeHexUlong, //Produces 1 parameter - //Received value: - // - // Ulong - // - //Results in: - // - // Unicode string representation of - // unsigned integer value in hexadecimal. - -// In W2k this value did not exist, it was ParmTypeLUID - - SeAdtParmTypePtr, //Produces 1 parameter - //Received value: - // - // pointer - // - //Results in: - // - // Unicode string representation of - // unsigned integer value in hexadecimal. - -// -// Everything below exists only in Windows XP and greater -// - - SeAdtParmTypeTime, //Produces 2 parameters - //Received value: - // - // LARGE_INTEGER - // - //Results in: - // - // Unicode string representation of - // date and time. - - // - SeAdtParmTypeGuid, //Produces 1 parameter - //Received value: - // - // GUID pointer - // - //Results in: - // - // Unicode string representation of GUID - // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - // - -// -// Everything below exists only in Windows Server 2003 and Greater -// - - SeAdtParmTypeLuid, // - //Produces 1 parameter - //Received value: - // - // LUID - // - //Results in: - // - // Hex LUID - // - - SeAdtParmTypeHexInt64, //Produces 1 parameter - //Received value: - // - // 64 bit integer - // - //Results in: - // - // Unicode string representation of - // unsigned integer value in hexadecimal. - - SeAdtParmTypeStringList, //Produces 1 parameter - //Received value: - // - // ptr to LSAP_ADT_STRING_LIST - // - //Results in: - // - // Unicode string representation of - // concatenation of the strings in the list - - SeAdtParmTypeSidList, //Produces 1 parameter - //Received value: - // - // ptr to LSAP_ADT_SID_LIST - // - //Results in: - // - // Unicode string representation of - // concatenation of the SIDs in the list - - SeAdtParmTypeDuration, //Produces 1 parameters - //Received value: - // - // LARGE_INTEGER - // - //Results in: - // - // Unicode string representation of - // a duration. - - SeAdtParmTypeUserAccountControl,//Produces 3 parameters - //Received value: - // - // old and new UserAccountControl values - // - //Results in: - // - // Unicode string representations of - // the flags in UserAccountControl. - // 1 - old value in hex - // 2 - new value in hex - // 3 - difference as strings - - SeAdtParmTypeNoUac, //Produces 3 parameters - //Received value: - // - // none - // - //Results in: - // - // Three dashes ('-') as unicode strings. - - SeAdtParmTypeMessage, //Produces 1 Parameter - //Received value: - // - // ULONG (MessageNo from msobjs.mc) - // - //Results in: - // - // Unicode string representation of - // %%MessageNo which the event viewer - // will replace with the message string - // from msobjs.mc - - SeAdtParmTypeDateTime, //Produces 1 Parameter - //Received value: - // - // LARGE_INTEGER - // - //Results in: - // - // Unicode string representation of - // date and time (in _one_ string). - - SeAdtParmTypeSockAddr, // Produces 2 parameters - // - // Received value: - // - // pointer to SOCKADDR_IN/SOCKADDR_IN6 - // structure - // - // Results in: - // - // param 1: IP address string - // param 2: Port number string - // - -// -// Everything below this exists only in Windows Server 2008 and greater -// - - SeAdtParmTypeSD, // Produces 1 parameters - // - // Received value: - // - // pointer to SECURITY_DESCRIPTOR - // structure - // - // Results in: - // - // SDDL string representation of SD - // - - SeAdtParmTypeLogonHours, // Produces 1 parameters - // - // Received value: - // - // pointer to LOGON_HOURS - // structure - // - // Results in: - // - // String representation of allowed logon hours - // - - SeAdtParmTypeLogonIdNoSid, //Produces 3 parameters. - //Received Value: - // - // LUID (fixed length) - // - //Results in: - // - // param 1: Username string - // param 2: domain name string - // param 3: Logon ID (Luid) string - - SeAdtParmTypeUlongNoConv, // Produces 1 parameter. - // Received Value: - // Ulong - // - //Results in: - // Not converted to string - // - - SeAdtParmTypeSockAddrNoPort, // Produces 1 parameter - // - // Received value: - // - // pointer to SOCKADDR_IN/SOCKADDR_IN6 - // structure - // - // Results in: - // - // param 1: IPv4/IPv6 address string - // -// -// Everything below this exists only in Windows Server 2008 and greater -// - - SeAdtParmTypeAccessReason // Produces 1 parameters - // - // Received value: - // - // pointer to SECURITY_DESCRIPTOR - // structure followed by the reason code. - // The reason code could be the index - // of the ACE in the SD or privilege ID or - // other reason codes. - // - // Results in: - // - // String representation of the access reason. - // - -} SE_ADT_PARAMETER_TYPE, *PSE_ADT_PARAMETER_TYPE; - -#ifndef GUID_DEFINED -#include -#endif /* GUID_DEFINED */ - -typedef struct _SE_ADT_OBJECT_TYPE { - GUID ObjectType; - USHORT Flags; -#define SE_ADT_OBJECT_ONLY 0x1 - USHORT Level; - ACCESS_MASK AccessMask; -} SE_ADT_OBJECT_TYPE, *PSE_ADT_OBJECT_TYPE; - -typedef struct _SE_ADT_PARAMETER_ARRAY_ENTRY { - - SE_ADT_PARAMETER_TYPE Type; - ULONG Length; - ULONG_PTR Data[2]; - PVOID Address; - -} SE_ADT_PARAMETER_ARRAY_ENTRY, *PSE_ADT_PARAMETER_ARRAY_ENTRY; - - -typedef struct _SE_ADT_ACCESS_REASON{ - ACCESS_MASK AccessMask; - ULONG AccessReasons[32]; - ULONG ObjectTypeIndex; - ULONG AccessGranted; - PSECURITY_DESCRIPTOR SecurityDescriptor; // multple SDs may be stored here in self-relative way. -} SE_ADT_ACCESS_REASON, *PSE_ADT_ACCESS_REASON; - - - -// -// Structure that will be passed between the Reference Monitor and LSA -// to transmit auditing information. -// - -#define SE_MAX_AUDIT_PARAMETERS 32 -#define SE_MAX_GENERIC_AUDIT_PARAMETERS 28 - -typedef struct _SE_ADT_PARAMETER_ARRAY { - - ULONG CategoryId; - ULONG AuditId; - ULONG ParameterCount; - ULONG Length; - USHORT FlatSubCategoryId; - USHORT Type; - ULONG Flags; - SE_ADT_PARAMETER_ARRAY_ENTRY Parameters[ SE_MAX_AUDIT_PARAMETERS ]; - -} SE_ADT_PARAMETER_ARRAY, *PSE_ADT_PARAMETER_ARRAY; - - -#define SE_ADT_PARAMETERS_SELF_RELATIVE 0x00000001 -#define SE_ADT_PARAMETERS_SEND_TO_LSA 0x00000002 -#define SE_ADT_PARAMETER_EXTENSIBLE_AUDIT 0x00000004 -#define SE_ADT_PARAMETER_GENERIC_AUDIT 0x00000008 -#define SE_ADT_PARAMETER_WRITE_SYNCHRONOUS 0x00000010 - - -// -// This macro only existed in Windows Server 2008 and after -// - -#define LSAP_SE_ADT_PARAMETER_ARRAY_TRUE_SIZE(AuditParameters) \ - ( sizeof(SE_ADT_PARAMETER_ARRAY) - \ - sizeof(SE_ADT_PARAMETER_ARRAY_ENTRY) * \ - (SE_MAX_AUDIT_PARAMETERS - AuditParameters->ParameterCount) ) - -#endif // _NTLSA_AUDIT_ - - -#endif // _NTLSA_IFS_ - - -#ifndef _RTL_RUN_ONCE_DEF -#define _RTL_RUN_ONCE_DEF - -// -// Run once -// - -#define RTL_RUN_ONCE_INIT {0} // Static initializer - -// -// Run once flags -// - -#define RTL_RUN_ONCE_CHECK_ONLY 0x00000001UL -#define RTL_RUN_ONCE_ASYNC 0x00000002UL -#define RTL_RUN_ONCE_INIT_FAILED 0x00000004UL - -// -// The context stored in the run once structure must leave the following number -// of low order bits unused. -// - -#define RTL_RUN_ONCE_CTX_RESERVED_BITS 2 - -typedef union _RTL_RUN_ONCE { - PVOID Ptr; -} RTL_RUN_ONCE, *PRTL_RUN_ONCE; - -typedef -__drv_functionClass(RTL_RUN_ONCE_INIT_FN) -__drv_sameIRQL -ULONG /* LOGICAL */ -NTAPI -RTL_RUN_ONCE_INIT_FN ( - __inout PRTL_RUN_ONCE RunOnce, - __inout_opt PVOID Parameter, - __deref_opt_inout_opt PVOID *Context - ); -typedef RTL_RUN_ONCE_INIT_FN *PRTL_RUN_ONCE_INIT_FN; - -#endif // _RTL_RUN_ONCE_DEF - -#if (NTDDI_VERSION >= NTDDI_LONGHORN) - -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlRunOnceInitialize ( - __out PRTL_RUN_ONCE RunOnce - ); - -__drv_maxIRQL(APC_LEVEL) -__drv_inTry -NTSYSAPI -NTSTATUS -NTAPI -RtlRunOnceExecuteOnce ( - __inout PRTL_RUN_ONCE RunOnce, - __in __callback PRTL_RUN_ONCE_INIT_FN InitFn, - __inout_opt PVOID Parameter, - __deref_opt_out_opt PVOID *Context - ); - -__drv_maxIRQL(APC_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlRunOnceBeginInitialize ( - __inout PRTL_RUN_ONCE RunOnce, - __in ULONG Flags, - __deref_opt_out_opt PVOID *Context - ); - -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlRunOnceComplete ( - __inout PRTL_RUN_ONCE RunOnce, - __in ULONG Flags, - __in_opt PVOID Context - ); - -#endif // NTDDI_VERSION >= NTDDI_LONGHORN - - -// -// This enumerated type is used as the function return value of the function -// that is used to search the tree for a key. FoundNode indicates that the -// function found the key. Insert as left indicates that the key was not found -// and the node should be inserted as the left child of the parent. Insert as -// right indicates that the key was not found and the node should be inserted -// as the right child of the parent. -// -typedef enum _TABLE_SEARCH_RESULT{ - TableEmptyTree, - TableFoundNode, - TableInsertAsLeft, - TableInsertAsRight -} TABLE_SEARCH_RESULT; - -// -// The results of a compare can be less than, equal, or greater than. -// - -typedef enum _RTL_GENERIC_COMPARE_RESULTS { - GenericLessThan, - GenericGreaterThan, - GenericEqual -} RTL_GENERIC_COMPARE_RESULTS; - -// -// Define the Avl version of the generic table package. Note a generic table -// should really be an opaque type. We provide routines to manipulate the structure. -// -// A generic table is package for inserting, deleting, and looking up elements -// in a table (e.g., in a symbol table). To use this package the user -// defines the structure of the elements stored in the table, provides a -// comparison function, a memory allocation function, and a memory -// deallocation function. -// -// Note: the user compare function must impose a complete ordering among -// all of the elements, and the table does not allow for duplicate entries. -// - -// -// Add an empty typedef so that functions can reference the -// a pointer to the generic table struct before it is declared. -// - -struct _RTL_AVL_TABLE; - -// -// The comparison function takes as input pointers to elements containing -// user defined structures and returns the results of comparing the two -// elements. -// - -typedef -__drv_sameIRQL -__drv_functionClass(RTL_AVL_COMPARE_ROUTINE) -RTL_GENERIC_COMPARE_RESULTS -NTAPI -RTL_AVL_COMPARE_ROUTINE ( - __in struct _RTL_AVL_TABLE *Table, - __in PVOID FirstStruct, - __in PVOID SecondStruct - ); -typedef RTL_AVL_COMPARE_ROUTINE *PRTL_AVL_COMPARE_ROUTINE; - -// -// The allocation function is called by the generic table package whenever -// it needs to allocate memory for the table. -// - -typedef -__drv_sameIRQL -__drv_functionClass(RTL_AVL_ALLOCATE_ROUTINE) -__drv_allocatesMem(Mem) -PVOID -NTAPI -RTL_AVL_ALLOCATE_ROUTINE ( - __in struct _RTL_AVL_TABLE *Table, - __in CLONG ByteSize - ); -typedef RTL_AVL_ALLOCATE_ROUTINE *PRTL_AVL_ALLOCATE_ROUTINE; - -// -// The deallocation function is called by the generic table package whenever -// it needs to deallocate memory from the table that was allocated by calling -// the user supplied allocation function. -// - -typedef -__drv_sameIRQL -__drv_functionClass(RTL_AVL_FREE_ROUTINE) -VOID -NTAPI -RTL_AVL_FREE_ROUTINE ( - __in struct _RTL_AVL_TABLE *Table, - __in __drv_freesMem(Mem) __post_invalid PVOID Buffer - ); -typedef RTL_AVL_FREE_ROUTINE *PRTL_AVL_FREE_ROUTINE; - -// -// The match function takes as input the user data to be matched and a pointer -// to some match data, which was passed along with the function pointer. It -// returns TRUE for a match and FALSE for no match. -// -// RTL_AVL_MATCH_FUNCTION returns -// STATUS_SUCCESS if the IndexRow matches -// STATUS_NO_MATCH if the IndexRow does not match, but the enumeration should -// continue -// STATUS_NO_MORE_MATCHES if the IndexRow does not match, and the enumeration -// should terminate -// - - -typedef -__drv_sameIRQL -__drv_functionClass(RTL_AVL_MATCH_FUNCTION) -NTSTATUS -NTAPI -RTL_AVL_MATCH_FUNCTION ( - __in struct _RTL_AVL_TABLE *Table, - __in PVOID UserData, - __in PVOID MatchData - ); -typedef RTL_AVL_MATCH_FUNCTION *PRTL_AVL_MATCH_FUNCTION; - -// -// Define the balanced tree links and Balance field. (No Rank field -// defined at this time.) -// -// Callers should treat this structure as opaque! -// -// The root of a balanced binary tree is not a real node in the tree -// but rather points to a real node which is the root. It is always -// in the table below, and its fields are used as follows: -// -// Parent Pointer to self, to allow for detection of the root. -// LeftChild NULL -// RightChild Pointer to real root -// Balance Undefined, however it is set to a convenient value -// (depending on the algorithm) prior to rebalancing -// in insert and delete routines. -// - -typedef struct _RTL_BALANCED_LINKS { - struct _RTL_BALANCED_LINKS *Parent; - struct _RTL_BALANCED_LINKS *LeftChild; - struct _RTL_BALANCED_LINKS *RightChild; - CHAR Balance; - UCHAR Reserved[3]; -} RTL_BALANCED_LINKS; -typedef RTL_BALANCED_LINKS *PRTL_BALANCED_LINKS; - -// -// To use the generic table package the user declares a variable of type -// GENERIC_TABLE and then uses the routines described below to initialize -// the table and to manipulate the table. Note that the generic table -// should really be an opaque type. -// - -typedef struct _RTL_AVL_TABLE { - RTL_BALANCED_LINKS BalancedRoot; - PVOID OrderedPointer; - ULONG WhichOrderedElement; - ULONG NumberGenericTableElements; - ULONG DepthOfTree; - PRTL_BALANCED_LINKS RestartKey; - ULONG DeleteCount; - PRTL_AVL_COMPARE_ROUTINE CompareRoutine; - PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine; - PRTL_AVL_FREE_ROUTINE FreeRoutine; - PVOID TableContext; -} RTL_AVL_TABLE; -typedef RTL_AVL_TABLE *PRTL_AVL_TABLE; - -// -// The procedure InitializeGenericTable takes as input an uninitialized -// generic table variable and pointers to the three user supplied routines. -// This must be called for every individual generic table variable before -// it can be used. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -VOID -NTAPI -RtlInitializeGenericTableAvl ( - __out PRTL_AVL_TABLE Table, - __in PRTL_AVL_COMPARE_ROUTINE CompareRoutine, - __in PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine, - __in PRTL_AVL_FREE_ROUTINE FreeRoutine, - __in_opt PVOID TableContext - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// The function InsertElementGenericTable will insert a new element -// in a table. It does this by allocating space for the new element -// (this includes AVL links), inserting the element in the table, and -// then returning to the user a pointer to the new element. If an element -// with the same key already exists in the table the return value is a pointer -// to the old element. The optional output parameter NewElement is used -// to indicate if the element previously existed in the table. Note: the user -// supplied Buffer is only used for searching the table, upon insertion its -// contents are copied to the newly created element. This means that -// pointer to the input buffer will not point to the new element. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -PVOID -NTAPI -RtlInsertElementGenericTableAvl ( - __in PRTL_AVL_TABLE Table, - __in_bcount(BufferSize) PVOID Buffer, - __in CLONG BufferSize, - __out_opt PBOOLEAN NewElement - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// The function InsertElementGenericTableFull will insert a new element -// in a table. It does this by allocating space for the new element -// (this includes AVL links), inserting the element in the table, and -// then returning to the user a pointer to the new element. If an element -// with the same key already exists in the table the return value is a pointer -// to the old element. The optional output parameter NewElement is used -// to indicate if the element previously existed in the table. Note: the user -// supplied Buffer is only used for searching the table, upon insertion its -// contents are copied to the newly created element. This means that -// pointer to the input buffer will not point to the new element. -// This routine is passed the NodeOrParent and SearchResult from a -// previous RtlLookupElementGenericTableFull. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -PVOID -NTAPI -RtlInsertElementGenericTableFullAvl ( - __in PRTL_AVL_TABLE Table, - __in_bcount(BufferSize) PVOID Buffer, - __in CLONG BufferSize, - __out_opt PBOOLEAN NewElement, - __in PVOID NodeOrParent, - __in TABLE_SEARCH_RESULT SearchResult - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// The function DeleteElementGenericTable will find and delete an element -// from a generic table. If the element is located and deleted the return -// value is TRUE, otherwise if the element is not located the return value -// is FALSE. The user supplied input buffer is only used as a key in -// locating the element in the table. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -BOOLEAN -NTAPI -RtlDeleteElementGenericTableAvl ( - __in PRTL_AVL_TABLE Table, - __in PVOID Buffer - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// The function LookupElementGenericTable will find an element in a generic -// table. If the element is located the return value is a pointer to -// the user defined structure associated with the element, otherwise if -// the element is not located the return value is NULL. The user supplied -// input buffer is only used as a key in locating the element in the table. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -NTSYSAPI -PVOID -NTAPI -RtlLookupElementGenericTableAvl ( - __in PRTL_AVL_TABLE Table, - __in PVOID Buffer - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// The function LookupElementGenericTableFull will find an element in a generic -// table. If the element is located the return value is a pointer to -// the user defined structure associated with the element. If the element is not -// located then a pointer to the parent for the insert location is returned. The -// user must look at the SearchResult value to determine which is being returned. -// The user can use the SearchResult and parent for a subsequent FullInsertElement -// call to optimize the insert. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -PVOID -NTAPI -RtlLookupElementGenericTableFullAvl ( - __in PRTL_AVL_TABLE Table, - __in PVOID Buffer, - __out PVOID *NodeOrParent, - __out TABLE_SEARCH_RESULT *SearchResult - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// The function EnumerateGenericTable will return to the caller one-by-one -// the elements of of a table. The return value is a pointer to the user -// defined structure associated with the element. The input parameter -// Restart indicates if the enumeration should start from the beginning -// or should return the next element. If the are no more new elements to -// return the return value is NULL. As an example of its use, to enumerate -// all of the elements in a table the user would write: -// -// for (ptr = EnumerateGenericTable(Table, TRUE); -// ptr != NULL; -// ptr = EnumerateGenericTable(Table, FALSE)) { -// : -// } -// -// NOTE: This routine does not modify the structure of the tree, but saves -// the last node returned in the generic table itself, and for this -// reason requires exclusive access to the table for the duration of -// the enumeration. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -NTSYSAPI -PVOID -NTAPI -RtlEnumerateGenericTableAvl ( - __in PRTL_AVL_TABLE Table, - __in BOOLEAN Restart - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// The function EnumerateGenericTableWithoutSplaying will return to the -// caller one-by-one the elements of of a table. The return value is a -// pointer to the user defined structure associated with the element. -// The input parameter RestartKey indicates if the enumeration should -// start from the beginning or should return the next element. If the -// are no more new elements to return the return value is NULL. As an -// example of its use, to enumerate all of the elements in a table the -// user would write: -// -// RestartKey = NULL; -// for (ptr = EnumerateGenericTableWithoutSplaying(Table, &RestartKey); -// ptr != NULL; -// ptr = EnumerateGenericTableWithoutSplaying(Table, &RestartKey)) { -// : -// } -// -// If RestartKey is NULL, the package will start from the least entry in the -// table, otherwise it will start from the last entry returned. -// -// NOTE: This routine does not modify either the structure of the tree -// or the generic table itself, but must insure that no deletes -// occur for the duration of the enumeration, typically by having -// at least shared access to the table for the duration. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -NTSYSAPI -PVOID -NTAPI -RtlEnumerateGenericTableWithoutSplayingAvl ( - __in PRTL_AVL_TABLE Table, - __inout PVOID *RestartKey - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// RtlLookupFirstMatchingElementGenericTableAvl will return the left-most -// element in the tree matching the data in Buffer. If, for example, the tree -// contains filenames there may exist several that differ only in case. A case- -// blind searcher can use this routine to position himself in the tree at the -// first match, and use an enumeration routine (such as RtlEnumerateGenericTableWithoutSplayingAvl -// to return each subsequent match. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -NTSYSAPI -PVOID -NTAPI -RtlLookupFirstMatchingElementGenericTableAvl ( - __in PRTL_AVL_TABLE Table, - __in PVOID Buffer, - __out PVOID *RestartKey - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// The function EnumerateGenericTableLikeADirectory will return to the -// caller one-by-one the elements of of a table. The return value is a -// pointer to the user defined structure associated with the element. -// The input parameter RestartKey indicates if the enumeration should -// start from the beginning or should return the next element. If the -// are no more new elements to return the return value is NULL. As an -// example of its use, to enumerate all of the elements in a table the -// user would write: -// -// RestartKey = NULL; -// for (ptr = EnumerateGenericTableLikeADirectory(Table, &RestartKey, ...); -// ptr != NULL; -// ptr = EnumerateGenericTableLikeADirectory(Table, &RestartKey, ...)) { -// : -// } -// -// If RestartKey is NULL, the package will start from the least entry in the -// table, otherwise it will start from the last entry returned. -// -// NOTE: This routine does not modify either the structure of the tree -// or the generic table itself. The table must only be acquired -// shared for the duration of this call, and all synchronization -// may optionally be dropped between calls. Enumeration is always -// correctly resumed in the most efficient manner possible via the -// IN OUT parameters provided. -// -// ****** Explain NextFlag. Directory enumeration resumes from a key -// requires more thought. Also need the match pattern and IgnoreCase. -// Should some structure be introduced to carry it all? -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -NTSYSAPI -PVOID -NTAPI -RtlEnumerateGenericTableLikeADirectory ( - __in PRTL_AVL_TABLE Table, - __in_opt PRTL_AVL_MATCH_FUNCTION MatchFunction, - __in_opt PVOID MatchData, - __in ULONG NextFlag, - __inout PVOID *RestartKey, - __inout PULONG DeleteCount, - __in PVOID Buffer - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// The function GetElementGenericTable will return the i'th element -// inserted in the generic table. I = 0 implies the first element, -// I = (RtlNumberGenericTableElements(Table)-1) will return the last element -// inserted into the generic table. The type of I is ULONG. Values -// of I > than (NumberGenericTableElements(Table)-1) will return NULL. If -// an arbitrary element is deleted from the generic table it will cause -// all elements inserted after the deleted element to "move up". - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -NTSYSAPI -PVOID -NTAPI -RtlGetElementGenericTableAvl ( - __in PRTL_AVL_TABLE Table, - __in ULONG I - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// The function NumberGenericTableElements returns a ULONG value -// which is the number of generic table elements currently inserted -// in the generic table. - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -ULONG -NTAPI -RtlNumberGenericTableElementsAvl ( - __in PRTL_AVL_TABLE Table - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// The function IsGenericTableEmpty will return to the caller TRUE if -// the input table is empty (i.e., does not contain any elements) and -// FALSE otherwise. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlIsGenericTableEmptyAvl ( - __in PRTL_AVL_TABLE Table - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// As an aid to allowing existing generic table users to do (in most -// cases) a single-line edit to switch over to Avl table use, we -// have the following defines and inline routine definitions which -// redirect calls and types. Note that the type override (performed -// by #define below) will not work in the unexpected event that someone -// has used a pointer or type specifier in their own #define, since -// #define processing is one pass and does not nest. The __inline -// declarations below do not have this limitation, however. -// -// To switch to using Avl tables, add the following line before your -// includes: -// -// #define RTL_USE_AVL_TABLES 0 -// - -#ifdef RTL_USE_AVL_TABLES - -#undef PRTL_GENERIC_COMPARE_ROUTINE -#undef RTL_GENERIC_COMPARE_ROUTINE -#undef PRTL_GENERIC_ALLOCATE_ROUTINE -#undef RTL_GENERIC_ALLOCATE_ROUTINE -#undef PRTL_GENERIC_FREE_ROUTINE -#undef RTL_GENERIC_FREE_ROUTINE -#undef RTL_GENERIC_TABLE -#undef PRTL_GENERIC_TABLE - -#define PRTL_GENERIC_COMPARE_ROUTINE PRTL_AVL_COMPARE_ROUTINE -#define RTL_GENERIC_COMPARE_ROUTINE RTL_AVL_COMPARE_ROUTINE -#define PRTL_GENERIC_ALLOCATE_ROUTINE PRTL_AVL_ALLOCATE_ROUTINE -#define RTL_GENERIC_ALLOCATE_ROUTINE RTL_AVL_ALLOCATE_ROUTINE -#define PRTL_GENERIC_FREE_ROUTINE PRTL_AVL_FREE_ROUTINE -#define RTL_GENERIC_FREE_ROUTINE RTL_AVL_FREE_ROUTINE -#define RTL_GENERIC_TABLE RTL_AVL_TABLE -#define PRTL_GENERIC_TABLE PRTL_AVL_TABLE - -#define RtlInitializeGenericTable RtlInitializeGenericTableAvl -#define RtlInsertElementGenericTable RtlInsertElementGenericTableAvl -#define RtlInsertElementGenericTableFull RtlInsertElementGenericTableFullAvl -#define RtlDeleteElementGenericTable RtlDeleteElementGenericTableAvl -#define RtlLookupElementGenericTable RtlLookupElementGenericTableAvl -#define RtlLookupElementGenericTableFull RtlLookupElementGenericTableFullAvl -#define RtlEnumerateGenericTable RtlEnumerateGenericTableAvl -#define RtlEnumerateGenericTableWithoutSplaying RtlEnumerateGenericTableWithoutSplayingAvl -#define RtlGetElementGenericTable RtlGetElementGenericTableAvl -#define RtlNumberGenericTableElements RtlNumberGenericTableElementsAvl -#define RtlIsGenericTableEmpty RtlIsGenericTableEmptyAvl - -#endif // RTL_USE_AVL_TABLES - - -// -// Define the splay links and the associated manipuliation macros and -// routines. Note that the splay_links should be an opaque type. -// Routine are provided to traverse and manipulate the structure. -// - -typedef struct _RTL_SPLAY_LINKS { - struct _RTL_SPLAY_LINKS *Parent; - struct _RTL_SPLAY_LINKS *LeftChild; - struct _RTL_SPLAY_LINKS *RightChild; -} RTL_SPLAY_LINKS; -typedef RTL_SPLAY_LINKS *PRTL_SPLAY_LINKS; - -// -// The macro procedure InitializeSplayLinks takes as input a pointer to -// splay link and initializes its substructure. All splay link nodes must -// be initialized before they are used in the different splay routines and -// macros. -// -// VOID -// RtlInitializeSplayLinks ( -// PRTL_SPLAY_LINKS Links -// ); -// - -#define RtlInitializeSplayLinks(Links) { \ - PRTL_SPLAY_LINKS _SplayLinks; \ - _SplayLinks = (PRTL_SPLAY_LINKS)(Links); \ - _SplayLinks->Parent = _SplayLinks; \ - _SplayLinks->LeftChild = NULL; \ - _SplayLinks->RightChild = NULL; \ - } - -// -// The macro function Parent takes as input a pointer to a splay link in a -// tree and returns a pointer to the splay link of the parent of the input -// node. If the input node is the root of the tree the return value is -// equal to the input value. -// -// PRTL_SPLAY_LINKS -// RtlParent ( -// PRTL_SPLAY_LINKS Links -// ); -// - -#define RtlParent(Links) ( \ - (PRTL_SPLAY_LINKS)(Links)->Parent \ - ) - -// -// The macro function LeftChild takes as input a pointer to a splay link in -// a tree and returns a pointer to the splay link of the left child of the -// input node. If the left child does not exist, the return value is NULL. -// -// PRTL_SPLAY_LINKS -// RtlLeftChild ( -// PRTL_SPLAY_LINKS Links -// ); -// - -#define RtlLeftChild(Links) ( \ - (PRTL_SPLAY_LINKS)(Links)->LeftChild \ - ) - -// -// The macro function RightChild takes as input a pointer to a splay link -// in a tree and returns a pointer to the splay link of the right child of -// the input node. If the right child does not exist, the return value is -// NULL. -// -// PRTL_SPLAY_LINKS -// RtlRightChild ( -// PRTL_SPLAY_LINKS Links -// ); -// - -#define RtlRightChild(Links) ( \ - (PRTL_SPLAY_LINKS)(Links)->RightChild \ - ) - -// -// The macro function IsRoot takes as input a pointer to a splay link -// in a tree and returns TRUE if the input node is the root of the tree, -// otherwise it returns FALSE. -// -// BOOLEAN -// RtlIsRoot ( -// PRTL_SPLAY_LINKS Links -// ); -// - -#define RtlIsRoot(Links) ( \ - (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links)) \ - ) - -// -// The macro function IsLeftChild takes as input a pointer to a splay link -// in a tree and returns TRUE if the input node is the left child of its -// parent, otherwise it returns FALSE. -// -// BOOLEAN -// RtlIsLeftChild ( -// PRTL_SPLAY_LINKS Links -// ); -// - -#define RtlIsLeftChild(Links) ( \ - (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links)) \ - ) - -// -// The macro function IsRightChild takes as input a pointer to a splay link -// in a tree and returns TRUE if the input node is the right child of its -// parent, otherwise it returns FALSE. -// -// BOOLEAN -// RtlIsRightChild ( -// PRTL_SPLAY_LINKS Links -// ); -// - -#define RtlIsRightChild(Links) ( \ - (RtlRightChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links)) \ - ) - -// -// The macro procedure InsertAsLeftChild takes as input a pointer to a splay -// link in a tree and a pointer to a node not in a tree. It inserts the -// second node as the left child of the first node. The first node must not -// already have a left child, and the second node must not already have a -// parent. -// -// VOID -// RtlInsertAsLeftChild ( -// PRTL_SPLAY_LINKS ParentLinks, -// PRTL_SPLAY_LINKS ChildLinks -// ); -// - -#define RtlInsertAsLeftChild(ParentLinks,ChildLinks) { \ - PRTL_SPLAY_LINKS _SplayParent; \ - PRTL_SPLAY_LINKS _SplayChild; \ - _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \ - _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \ - _SplayParent->LeftChild = _SplayChild; \ - _SplayChild->Parent = _SplayParent; \ - } - -// -// The macro procedure InsertAsRightChild takes as input a pointer to a splay -// link in a tree and a pointer to a node not in a tree. It inserts the -// second node as the right child of the first node. The first node must not -// already have a right child, and the second node must not already have a -// parent. -// -// VOID -// RtlInsertAsRightChild ( -// PRTL_SPLAY_LINKS ParentLinks, -// PRTL_SPLAY_LINKS ChildLinks -// ); -// - -#define RtlInsertAsRightChild(ParentLinks,ChildLinks) { \ - PRTL_SPLAY_LINKS _SplayParent; \ - PRTL_SPLAY_LINKS _SplayChild; \ - _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \ - _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \ - _SplayParent->RightChild = _SplayChild; \ - _SplayChild->Parent = _SplayParent; \ - } - -// -// The Splay function takes as input a pointer to a splay link in a tree -// and splays the tree. Its function return value is a pointer to the -// root of the splayed tree. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -PRTL_SPLAY_LINKS -NTAPI -RtlSplay ( - __inout PRTL_SPLAY_LINKS Links - ); -#endif - -// -// The Delete function takes as input a pointer to a splay link in a tree -// and deletes that node from the tree. Its function return value is a -// pointer to the root of the tree. If the tree is now empty, the return -// value is NULL. -// - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -PRTL_SPLAY_LINKS -NTAPI -RtlDelete ( - __in PRTL_SPLAY_LINKS Links - ); -#endif - -// -// The DeleteNoSplay function takes as input a pointer to a splay link in a tree, -// the caller's pointer to the root of the tree and deletes that node from the -// tree. Upon return the caller's pointer to the root node will correctly point -// at the root of the tree. -// -// It operationally differs from RtlDelete only in that it will not splay the tree. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlDeleteNoSplay ( - __in PRTL_SPLAY_LINKS Links, - __inout PRTL_SPLAY_LINKS *Root - ); -#endif - -// -// The SubtreeSuccessor function takes as input a pointer to a splay link -// in a tree and returns a pointer to the successor of the input node of -// the substree rooted at the input node. If there is not a successor, the -// return value is NULL. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -PRTL_SPLAY_LINKS -NTAPI -RtlSubtreeSuccessor ( - __in PRTL_SPLAY_LINKS Links - ); -#endif - -// -// The SubtreePredecessor function takes as input a pointer to a splay link -// in a tree and returns a pointer to the predecessor of the input node of -// the substree rooted at the input node. If there is not a predecessor, -// the return value is NULL. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -PRTL_SPLAY_LINKS -NTAPI -RtlSubtreePredecessor ( - __in PRTL_SPLAY_LINKS Links - ); -#endif - -// -// The RealSuccessor function takes as input a pointer to a splay link -// in a tree and returns a pointer to the successor of the input node within -// the entire tree. If there is not a successor, the return value is NULL. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -PRTL_SPLAY_LINKS -NTAPI -RtlRealSuccessor ( - __in PRTL_SPLAY_LINKS Links - ); -#endif - -// -// The RealPredecessor function takes as input a pointer to a splay link -// in a tree and returns a pointer to the predecessor of the input node -// within the entire tree. If there is not a predecessor, the return value -// is NULL. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -PRTL_SPLAY_LINKS -NTAPI -RtlRealPredecessor ( - __in PRTL_SPLAY_LINKS Links - ); -#endif - - -// -// Define the generic table package. Note a generic table should really -// be an opaque type. We provide routines to manipulate the structure. -// -// A generic table is package for inserting, deleting, and looking up elements -// in a table (e.g., in a symbol table). To use this package the user -// defines the structure of the elements stored in the table, provides a -// comparison function, a memory allocation function, and a memory -// deallocation function. -// -// Note: the user compare function must impose a complete ordering among -// all of the elements, and the table does not allow for duplicate entries. -// - -// -// Do not do the following defines if using Avl -// - -#ifndef RTL_USE_AVL_TABLES - -// -// Add an empty typedef so that functions can reference the -// a pointer to the generic table struct before it is declared. -// - -struct _RTL_GENERIC_TABLE; - -// -// The comparison function takes as input pointers to elements containing -// user defined structures and returns the results of comparing the two -// elements. -// - -typedef -__drv_sameIRQL -__drv_functionClass(RTL_GENERIC_COMPARE_ROUTINE) -RTL_GENERIC_COMPARE_RESULTS -NTAPI -RTL_GENERIC_COMPARE_ROUTINE ( - __in struct _RTL_GENERIC_TABLE *Table, - __in PVOID FirstStruct, - __in PVOID SecondStruct - ); -typedef RTL_GENERIC_COMPARE_ROUTINE *PRTL_GENERIC_COMPARE_ROUTINE; - -// -// The allocation function is called by the generic table package whenever -// it needs to allocate memory for the table. -// - -typedef -__drv_sameIRQL -__drv_functionClass(RTL_GENERIC_ALLOCATE_ROUTINE) -__drv_allocatesMem(Mem) -PVOID -NTAPI -RTL_GENERIC_ALLOCATE_ROUTINE ( - __in struct _RTL_GENERIC_TABLE *Table, - __in CLONG ByteSize - ); -typedef RTL_GENERIC_ALLOCATE_ROUTINE *PRTL_GENERIC_ALLOCATE_ROUTINE; - -// -// The deallocation function is called by the generic table package whenever -// it needs to deallocate memory from the table that was allocated by calling -// the user supplied allocation function. -// - -typedef -__drv_sameIRQL -__drv_functionClass(RTL_GENERIC_FREE_ROUTINE) -VOID -NTAPI -RTL_GENERIC_FREE_ROUTINE ( - __in struct _RTL_GENERIC_TABLE *Table, - __in __drv_freesMem(Mem) __post_invalid PVOID Buffer - ); -typedef RTL_GENERIC_FREE_ROUTINE *PRTL_GENERIC_FREE_ROUTINE; - -// -// To use the generic table package the user declares a variable of type -// GENERIC_TABLE and then uses the routines described below to initialize -// the table and to manipulate the table. Note that the generic table -// should really be an opaque type. -// - -typedef struct _RTL_GENERIC_TABLE { - PRTL_SPLAY_LINKS TableRoot; - LIST_ENTRY InsertOrderList; - PLIST_ENTRY OrderedPointer; - ULONG WhichOrderedElement; - ULONG NumberGenericTableElements; - PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine; - PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine; - PRTL_GENERIC_FREE_ROUTINE FreeRoutine; - PVOID TableContext; -} RTL_GENERIC_TABLE; -typedef RTL_GENERIC_TABLE *PRTL_GENERIC_TABLE; - -// -// The procedure InitializeGenericTable takes as input an uninitialized -// generic table variable and pointers to the three user supplied routines. -// This must be called for every individual generic table variable before -// it can be used. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlInitializeGenericTable ( - __out PRTL_GENERIC_TABLE Table, - __in PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine, - __in PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine, - __in PRTL_GENERIC_FREE_ROUTINE FreeRoutine, - __in_opt PVOID TableContext - ); -#endif - -// -// The function InsertElementGenericTable will insert a new element -// in a table. It does this by allocating space for the new element -// (this includes splay links), inserting the element in the table, and -// then returning to the user a pointer to the new element. If an element -// with the same key already exists in the table the return value is a pointer -// to the old element. The optional output parameter NewElement is used -// to indicate if the element previously existed in the table. Note: the user -// supplied Buffer is only used for searching the table, upon insertion its -// contents are copied to the newly created element. This means that -// pointer to the input buffer will not point to the new element. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -PVOID -NTAPI -RtlInsertElementGenericTable ( - __in PRTL_GENERIC_TABLE Table, - __in_bcount(BufferSize) PVOID Buffer, - __in CLONG BufferSize, - __out_opt PBOOLEAN NewElement - ); -#endif - -// -// The function InsertElementGenericTableFull will insert a new element -// in a table. It does this by allocating space for the new element -// (this includes splay links), inserting the element in the table, and -// then returning to the user a pointer to the new element. If an element -// with the same key already exists in the table the return value is a pointer -// to the old element. The optional output parameter NewElement is used -// to indicate if the element previously existed in the table. Note: the user -// supplied Buffer is only used for searching the table, upon insertion its -// contents are copied to the newly created element. This means that -// pointer to the input buffer will not point to the new element. -// This routine is passed the NodeOrParent and SearchResult from a -// previous RtlLookupElementGenericTableFull. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -PVOID -NTAPI -RtlInsertElementGenericTableFull ( - __in PRTL_GENERIC_TABLE Table, - __in_bcount(BufferSize) PVOID Buffer, - __in CLONG BufferSize, - __out_opt PBOOLEAN NewElement, - __in PVOID NodeOrParent, - __in TABLE_SEARCH_RESULT SearchResult - ); -#endif - -// -// The function DeleteElementGenericTable will find and delete an element -// from a generic table. If the element is located and deleted the return -// value is TRUE, otherwise if the element is not located the return value -// is FALSE. The user supplied input buffer is only used as a key in -// locating the element in the table. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -BOOLEAN -NTAPI -RtlDeleteElementGenericTable ( - __in PRTL_GENERIC_TABLE Table, - __in PVOID Buffer - ); -#endif - -// -// The function LookupElementGenericTable will find an element in a generic -// table. If the element is located the return value is a pointer to -// the user defined structure associated with the element, otherwise if -// the element is not located the return value is NULL. The user supplied -// input buffer is only used as a key in locating the element in the table. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -PVOID -NTAPI -RtlLookupElementGenericTable ( - __in PRTL_GENERIC_TABLE Table, - __in PVOID Buffer - ); -#endif - -// -// The function LookupElementGenericTableFull will find an element in a generic -// table. If the element is located the return value is a pointer to -// the user defined structure associated with the element. If the element is not -// located then a pointer to the parent for the insert location is returned. The -// user must look at the SearchResult value to determine which is being returned. -// The user can use the SearchResult and parent for a subsequent FullInsertElement -// call to optimize the insert. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -PVOID -NTAPI -RtlLookupElementGenericTableFull ( - __in PRTL_GENERIC_TABLE Table, - __in PVOID Buffer, - __out PVOID *NodeOrParent, - __out TABLE_SEARCH_RESULT *SearchResult - ); -#endif - -// -// The function EnumerateGenericTable will return to the caller one-by-one -// the elements of of a table. The return value is a pointer to the user -// defined structure associated with the element. The input parameter -// Restart indicates if the enumeration should start from the beginning -// or should return the next element. If the are no more new elements to -// return the return value is NULL. As an example of its use, to enumerate -// all of the elements in a table the user would write: -// -// for (ptr = EnumerateGenericTable(Table, TRUE); -// ptr != NULL; -// ptr = EnumerateGenericTable(Table, FALSE)) { -// : -// } -// -// -// PLEASE NOTE: -// -// If you enumerate a GenericTable using RtlEnumerateGenericTable, you -// will flatten the table, turning it into a sorted linked list. -// To enumerate the table without perturbing the splay links, use -// RtlEnumerateGenericTableWithoutSplaying - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -PVOID -NTAPI -RtlEnumerateGenericTable ( - __in PRTL_GENERIC_TABLE Table, - __in BOOLEAN Restart - ); -#endif - -// -// The function EnumerateGenericTableWithoutSplaying will return to the -// caller one-by-one the elements of of a table. The return value is a -// pointer to the user defined structure associated with the element. -// The input parameter RestartKey indicates if the enumeration should -// start from the beginning or should return the next element. If the -// are no more new elements to return the return value is NULL. As an -// example of its use, to enumerate all of the elements in a table the -// user would write: -// -// RestartKey = NULL; -// for (ptr = EnumerateGenericTableWithoutSplaying(Table, &RestartKey); -// ptr != NULL; -// ptr = EnumerateGenericTableWithoutSplaying(Table, &RestartKey)) { -// : -// } -// -// If RestartKey is NULL, the package will start from the least entry in the -// table, otherwise it will start from the last entry returned. -// -// -// Note that unlike RtlEnumerateGenericTable, this routine will NOT perturb -// the splay order of the tree. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -PVOID -NTAPI -RtlEnumerateGenericTableWithoutSplaying ( - __in PRTL_GENERIC_TABLE Table, - __inout PVOID *RestartKey - ); -#endif - -// -// The function GetElementGenericTable will return the i'th element -// inserted in the generic table. I = 0 implies the first element, -// I = (RtlNumberGenericTableElements(Table)-1) will return the last element -// inserted into the generic table. The type of I is ULONG. Values -// of I > than (NumberGenericTableElements(Table)-1) will return NULL. If -// an arbitrary element is deleted from the generic table it will cause -// all elements inserted after the deleted element to "move up". - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -PVOID -NTAPI -RtlGetElementGenericTable( - __in PRTL_GENERIC_TABLE Table, - __in ULONG I - ); -#endif - -// -// The function NumberGenericTableElements returns a ULONG value -// which is the number of generic table elements currently inserted -// in the generic table. - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONG -NTAPI -RtlNumberGenericTableElements( - __in PRTL_GENERIC_TABLE Table - ); -#endif - -// -// The function IsGenericTableEmpty will return to the caller TRUE if -// the input table is empty (i.e., does not contain any elements) and -// FALSE otherwise. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlIsGenericTableEmpty ( - __in PRTL_GENERIC_TABLE Table - ); -#endif - -#endif // RTL_USE_AVL_TABLES - - - -// -// The hash table header structure can either be allocated -// by the caller, or by the hash table creation function itself. -// This flag indicates what was done at creation time. -// -#define RTL_HASH_ALLOCATED_HEADER 0x00000001 - - -// -// The RTL_HASH_RESERVED_SIGNATURE is the signature used internally for -// enumerators. A caller can never assign this signature to -// valid entries. -// -#define RTL_HASH_RESERVED_SIGNATURE 0 - - -typedef struct _RTL_DYNAMIC_HASH_TABLE_ENTRY { - LIST_ENTRY Linkage; - ULONG_PTR Signature; -} RTL_DYNAMIC_HASH_TABLE_ENTRY, *PRTL_DYNAMIC_HASH_TABLE_ENTRY; - - -// -// Some components want to see the actual signature and can use -// this macro to encapsulate that operation. -// -#define HASH_ENTRY_KEY(x) ((x)->Signature) - - -// -// Brief background on each of the parameters and their -// justification: -// 1. ChainHead stores the pointer to a bucket. This is needed since -// our hash chains are doubly-linked circular lists, and there is -// is no way to determine whether we've reached the end of the -// chain unless we store the pointer to the bucket itself. This -// is particularly used in walking the sub-list of entries returned -// by a lookup. We need to know when the sub-list has been -// completely returned. -// 2. PrevLinkage stores a pointer to the entry before the entry -// under consideration. The reason for storing the previous entry -// instead of the entry itself is for cases where a lookup fails -// and PrevLinkage actually stores the entry that would have been -// the previous entry, had the looked up entry existed. This can -// then be used to actually insert the entry at that place. -// 3. Signature is used primarily as a safety check in insertion. -// This field must match the Signature of the entry being inserted. -// - -typedef struct _RTL_DYNAMIC_HASH_TABLE_CONTEXT { - PLIST_ENTRY ChainHead; - PLIST_ENTRY PrevLinkage; - ULONG_PTR Signature; -} RTL_DYNAMIC_HASH_TABLE_CONTEXT, *PRTL_DYNAMIC_HASH_TABLE_CONTEXT; - -typedef struct _RTL_DYNAMIC_HASH_TABLE_ENUMERATOR { - RTL_DYNAMIC_HASH_TABLE_ENTRY HashEntry; - PLIST_ENTRY ChainHead; - ULONG BucketIndex; -} RTL_DYNAMIC_HASH_TABLE_ENUMERATOR, *PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR; - -typedef struct _RTL_DYNAMIC_HASH_TABLE { - - // Entries initialized at creation - ULONG Flags; - ULONG Shift; - - // Entries used in bucket computation. - ULONG TableSize; - ULONG Pivot; - ULONG DivisorMask; - - // Counters - ULONG NumEntries; - ULONG NonEmptyBuckets; - ULONG NumEnumerators; - - // The directory. This field is for internal use only. - PVOID Directory; - -} RTL_DYNAMIC_HASH_TABLE, *PRTL_DYNAMIC_HASH_TABLE; - - -// -// Inline functions first. -// -#if !defined(MIDL_PASS) && !defined(SORTPP_PASS) - -#if (NTDDI_VERSION >= NTDDI_WIN7) -FORCEINLINE -VOID -RtlInitHashTableContext( - __inout PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context - ) -{ - Context->ChainHead = NULL; - Context->PrevLinkage = NULL; -} -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -FORCEINLINE -VOID -RtlInitHashTableContextFromEnumerator( - __inout PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context, - __in PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator - ) -{ - Context->ChainHead = Enumerator->ChainHead; - Context->PrevLinkage = Enumerator->HashEntry.Linkage.Blink; -} -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -FORCEINLINE -void -RtlReleaseHashTableContext( - __inout PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context - ) -{ - UNREFERENCED_PARAMETER(Context); - return; -} -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -FORCEINLINE -ULONG -RtlTotalBucketsHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable - ) -{ - return HashTable->TableSize; -} -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -FORCEINLINE -ULONG -RtlNonEmptyBucketsHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable - ) -{ - return HashTable->NonEmptyBuckets; -} -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -FORCEINLINE -ULONG -RtlEmptyBucketsHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable - ) -{ - return HashTable->TableSize - HashTable->NonEmptyBuckets; -} -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -FORCEINLINE -ULONG -RtlTotalEntriesHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable - ) -{ - return HashTable->NumEntries; -} -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -FORCEINLINE -ULONG -RtlActiveEnumeratorsHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable - ) -{ - return HashTable->NumEnumerators; -} -#endif - -#endif // !defined(MIDL_PASS) && !defined(SORTPP_PASS) - -// -// Almost all the hash functions take in a Context. -// If a valid context is passed in, it will be used -// in executing the operation if possible. If a -// blank context is passed in, it will be initialized -// appropriately. -// - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlCreateHashTable( - __deref_inout_opt __drv_when(NULL == *HashTable, __drv_allocatesMem(Mem)) - PRTL_DYNAMIC_HASH_TABLE *HashTable, - __in ULONG Shift, - __in __reserved ULONG Flags - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTSYSAPI -VOID -NTAPI -RtlDeleteHashTable( - __in __drv_when((HashTable->Flags & RTL_HASH_ALLOCATED_HEADER), __drv_freesMem(Mem) __post_invalid) - PRTL_DYNAMIC_HASH_TABLE HashTable - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTSYSAPI -BOOLEAN -NTAPI -RtlInsertEntryHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable, - __in __drv_aliasesMem PRTL_DYNAMIC_HASH_TABLE_ENTRY Entry, - __in ULONG_PTR Signature, - __inout_opt PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTSYSAPI -BOOLEAN -NTAPI -RtlRemoveEntryHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable, - __in PRTL_DYNAMIC_HASH_TABLE_ENTRY Entry, - __inout_opt PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__checkReturn -NTSYSAPI -PRTL_DYNAMIC_HASH_TABLE_ENTRY -NTAPI -RtlLookupEntryHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable, - __in ULONG_PTR Signature, - __out_opt PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__checkReturn -NTSYSAPI -PRTL_DYNAMIC_HASH_TABLE_ENTRY -NTAPI -RtlGetNextEntryHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable, - __in PRTL_DYNAMIC_HASH_TABLE_CONTEXT Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTSYSAPI -BOOLEAN -NTAPI -RtlInitEnumerationHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable, - __out PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__checkReturn -NTSYSAPI -PRTL_DYNAMIC_HASH_TABLE_ENTRY -NTAPI -RtlEnumerateEntryHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable, - __inout PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTSYSAPI -VOID -NTAPI -RtlEndEnumerationHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable, - __inout PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTSYSAPI -BOOLEAN -NTAPI -RtlInitWeakEnumerationHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable, - __out PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__checkReturn -NTSYSAPI -PRTL_DYNAMIC_HASH_TABLE_ENTRY -NTAPI -RtlWeaklyEnumerateEntryHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable, - __inout PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTSYSAPI -VOID -NTAPI -RtlEndWeakEnumerationHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable, - __inout PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR Enumerator - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTSYSAPI -BOOLEAN -NTAPI -RtlExpandHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTSYSAPI -BOOLEAN -NTAPI -RtlContractHashTable( - __in PRTL_DYNAMIC_HASH_TABLE HashTable - ); -#endif - - - -#if defined (_MSC_VER) && ( _MSC_VER >= 900 ) - -PVOID -_ReturnAddress ( - VOID - ); - -#pragma intrinsic(_ReturnAddress) - -#endif - -#if (defined(_M_AMD64) || defined(_M_IA64)) && !defined(_REALLY_GET_CALLERS_CALLER_) - -#define RtlGetCallersAddress(CallersAddress, CallersCaller) \ - *CallersAddress = (PVOID)_ReturnAddress(); \ - *CallersCaller = NULL; - -#else - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlGetCallersAddress( - __out PVOID *CallersAddress, - __out PVOID *CallersCaller - ); - -#endif - -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -// -// Reserve byte 1 of the RtlWalkFrameChain flags for -// specifying a number of frames to skip. -// - -#define RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT 8 - -NTSYSAPI -ULONG -NTAPI -RtlWalkFrameChain ( - __out_ecount(Count - (Flags >> RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT)) PVOID *Callers, - __in ULONG Count, - __in ULONG Flags - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlCharToInteger ( - __in_z PCSZ String, - __in_opt ULONG Base, - __out PULONG Value - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlCopyString( - __out PSTRING DestinationString, - __in_opt const STRING * SourceString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -CHAR -NTAPI -RtlUpperChar ( - __in CHAR Character - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -LONG -NTAPI -RtlCompareString( - __in const STRING * String1, - __in const STRING * String2, - __in BOOLEAN CaseInSensitive - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlEqualString( - __in const STRING * String1, - __in const STRING * String2, - __in BOOLEAN CaseInSensitive - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlUpperString( - __inout PSTRING DestinationString, - __in const STRING * SourceString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlPrefixUnicodeString( - __in PCUNICODE_STRING String1, - __in PCUNICODE_STRING String2, - __in BOOLEAN CaseInSensitive - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when(AllocateDestinationString, __checkReturn) -NTSYSAPI -NTSTATUS -NTAPI -RtlUpcaseUnicodeString( - __drv_when(AllocateDestinationString, __out __drv_at(DestinationString->Buffer, __drv_allocatesMem(Mem))) - __drv_when(!AllocateDestinationString, __inout) - PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in BOOLEAN AllocateDestinationString - ); -#endif - -#if !defined(MIDL_PASS) -#if defined(_AMD64_) || defined(_IA64_) -// -// Large Integer divide - 64-bits / 64-bits -> 64-bits -// - -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlLargeIntegerDivide ( - __in LARGE_INTEGER Dividend, - __in LARGE_INTEGER Divisor, - __out_opt PLARGE_INTEGER Remainder - ) -{ - LARGE_INTEGER Quotient; - - Quotient.QuadPart = Dividend.QuadPart / Divisor.QuadPart; - if (ARGUMENT_PRESENT(Remainder)) { - Remainder->QuadPart = Dividend.QuadPart % Divisor.QuadPart; - } - - return Quotient; -} - -#else -// -// Large Integer divide - 64-bits / 64-bits -> 64-bits -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -NTSYSAPI -LARGE_INTEGER -NTAPI -RtlLargeIntegerDivide ( - __in LARGE_INTEGER Dividend, - __in LARGE_INTEGER Divisor, - __out_opt PLARGE_INTEGER Remainder - ); -#endif - -#endif // defined(_AMD64_) || defined(_IA64_) -#endif // !defined(MIDL_PASS) - - -// -// BOOLEAN -// RtlEqualLuid( -// PLUID L1, -// PLUID L2 -// ); - -#define RtlEqualLuid(L1, L2) (((L1)->LowPart == (L2)->LowPart) && \ - ((L1)->HighPart == (L2)->HighPart)) - -// -// BOOLEAN -// RtlIsZeroLuid( -// PLUID L1 -// ); -// -#define RtlIsZeroLuid(L1) ((BOOLEAN) (((L1)->LowPart | (L1)->HighPart) == 0)) - - - -#if !defined(MIDL_PASS) - -FORCEINLINE -LUID -NTAPI_INLINE -RtlConvertLongToLuid( - __in LONG Long - ) -{ - LUID TempLuid; - LARGE_INTEGER TempLi; - - TempLi.QuadPart = Long; - TempLuid.LowPart = TempLi.u.LowPart; - TempLuid.HighPart = TempLi.u.HighPart; - return(TempLuid); -} - -FORCEINLINE -LUID -NTAPI_INLINE -RtlConvertUlongToLuid( - __in ULONG Ulong - ) -{ - LUID TempLuid; - - TempLuid.LowPart = Ulong; - TempLuid.HighPart = 0; - return(TempLuid); -} -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlMapGenericMask( - __inout PACCESS_MASK AccessMask, - __in PGENERIC_MAPPING GenericMapping - ); -#endif - -// -// Routine for converting from a volume device object to a DOS name. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_when(NTDDI_VERSION >= NTDDI_WINXP, - __drv_preferredFunction("IoVolumeDeviceToDosName", - "Obsolete on WINXP and above")) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlVolumeDeviceToDosName( - __in PVOID VolumeDeviceObject, - __out PUNICODE_STRING DosName - ); -#endif - -typedef struct _OSVERSIONINFOA { - ULONG dwOSVersionInfoSize; - ULONG dwMajorVersion; - ULONG dwMinorVersion; - ULONG dwBuildNumber; - ULONG dwPlatformId; - CHAR szCSDVersion[ 128 ]; // Maintenance string for PSS usage -} OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA; - -typedef struct _OSVERSIONINFOW { - ULONG dwOSVersionInfoSize; - ULONG dwMajorVersion; - ULONG dwMinorVersion; - ULONG dwBuildNumber; - ULONG dwPlatformId; - WCHAR szCSDVersion[ 128 ]; // Maintenance string for PSS usage -} OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW; -#ifdef UNICODE -typedef OSVERSIONINFOW OSVERSIONINFO; -typedef POSVERSIONINFOW POSVERSIONINFO; -typedef LPOSVERSIONINFOW LPOSVERSIONINFO; -#else -typedef OSVERSIONINFOA OSVERSIONINFO; -typedef POSVERSIONINFOA POSVERSIONINFO; -typedef LPOSVERSIONINFOA LPOSVERSIONINFO; -#endif // UNICODE - -typedef struct _OSVERSIONINFOEXA { - ULONG dwOSVersionInfoSize; - ULONG dwMajorVersion; - ULONG dwMinorVersion; - ULONG dwBuildNumber; - ULONG dwPlatformId; - CHAR szCSDVersion[ 128 ]; // Maintenance string for PSS usage - USHORT wServicePackMajor; - USHORT wServicePackMinor; - USHORT wSuiteMask; - UCHAR wProductType; - UCHAR wReserved; -} OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA; -typedef struct _OSVERSIONINFOEXW { - ULONG dwOSVersionInfoSize; - ULONG dwMajorVersion; - ULONG dwMinorVersion; - ULONG dwBuildNumber; - ULONG dwPlatformId; - WCHAR szCSDVersion[ 128 ]; // Maintenance string for PSS usage - USHORT wServicePackMajor; - USHORT wServicePackMinor; - USHORT wSuiteMask; - UCHAR wProductType; - UCHAR wReserved; -} OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW; -#ifdef UNICODE -typedef OSVERSIONINFOEXW OSVERSIONINFOEX; -typedef POSVERSIONINFOEXW POSVERSIONINFOEX; -typedef LPOSVERSIONINFOEXW LPOSVERSIONINFOEX; -#else -typedef OSVERSIONINFOEXA OSVERSIONINFOEX; -typedef POSVERSIONINFOEXA POSVERSIONINFOEX; -typedef LPOSVERSIONINFOEXA LPOSVERSIONINFOEX; -#endif // UNICODE - -// -// RtlVerifyVersionInfo() conditions -// - -#define VER_EQUAL 1 -#define VER_GREATER 2 -#define VER_GREATER_EQUAL 3 -#define VER_LESS 4 -#define VER_LESS_EQUAL 5 -#define VER_AND 6 -#define VER_OR 7 - -#define VER_CONDITION_MASK 7 -#define VER_NUM_BITS_PER_CONDITION_MASK 3 - -// -// RtlVerifyVersionInfo() type mask bits -// - -#define VER_MINORVERSION 0x0000001 -#define VER_MAJORVERSION 0x0000002 -#define VER_BUILDNUMBER 0x0000004 -#define VER_PLATFORMID 0x0000008 -#define VER_SERVICEPACKMINOR 0x0000010 -#define VER_SERVICEPACKMAJOR 0x0000020 -#define VER_SUITENAME 0x0000040 -#define VER_PRODUCT_TYPE 0x0000080 - -// -// RtlVerifyVersionInfo() os product type values -// - -#define VER_NT_WORKSTATION 0x0000001 -#define VER_NT_DOMAIN_CONTROLLER 0x0000002 -#define VER_NT_SERVER 0x0000003 - -// -// dwPlatformId defines: -// - -#define VER_PLATFORM_WIN32s 0 -#define VER_PLATFORM_WIN32_WINDOWS 1 -#define VER_PLATFORM_WIN32_NT 2 - - -// -// -// VerifyVersionInfo() macro to set the condition mask -// -// For documentation sakes here's the old version of the macro that got -// changed to call an API -// #define VER_SET_CONDITION(_m_,_t_,_c_) _m_=(_m_|(_c_<<(1<<_t_))) -// - -#define VER_SET_CONDITION(_m_,_t_,_c_) \ - ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_))) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONGLONG -NTAPI -VerSetConditionMask( - __in ULONGLONG ConditionMask, - __in ULONG TypeMask, - __in UCHAR Condition - ); -#endif - -// - -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlGetVersion( - __out __drv_at(lpVersionInformation->dwOSVersionInfoSize, __inout) - PRTL_OSVERSIONINFOW lpVersionInformation - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlVerifyVersionInfo( - __in PRTL_OSVERSIONINFOEXW VersionInfo, - __in ULONG TypeMask, - __in ULONGLONG ConditionMask - ); -#endif - -NTSYSAPI -ULONG -NTAPI -DbgPrompt ( - __in_z PCCH Prompt, - __out_bcount(Length) PCH Response, - __in ULONG Length - ); - -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -NTSYSAPI -BOOLEAN -NTAPI -RtlGetProductInfo( - __in ULONG OSMajorVersion, - __in ULONG OSMinorVersion, - __in ULONG SpMajorVersion, - __in ULONG SpMinorVersion, - __out PULONG ReturnedProductType - ); - -#endif - -// -// Define the various device type values. Note that values used by Microsoft -// Corporation are in the range 0-32767, and 32768-65535 are reserved for use -// by customers. -// - -#define DEVICE_TYPE ULONG - -#define FILE_DEVICE_BEEP 0x00000001 -#define FILE_DEVICE_CD_ROM 0x00000002 -#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 -#define FILE_DEVICE_CONTROLLER 0x00000004 -#define FILE_DEVICE_DATALINK 0x00000005 -#define FILE_DEVICE_DFS 0x00000006 -#define FILE_DEVICE_DISK 0x00000007 -#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 -#define FILE_DEVICE_FILE_SYSTEM 0x00000009 -#define FILE_DEVICE_INPORT_PORT 0x0000000a -#define FILE_DEVICE_KEYBOARD 0x0000000b -#define FILE_DEVICE_MAILSLOT 0x0000000c -#define FILE_DEVICE_MIDI_IN 0x0000000d -#define FILE_DEVICE_MIDI_OUT 0x0000000e -#define FILE_DEVICE_MOUSE 0x0000000f -#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 -#define FILE_DEVICE_NAMED_PIPE 0x00000011 -#define FILE_DEVICE_NETWORK 0x00000012 -#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 -#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 -#define FILE_DEVICE_NULL 0x00000015 -#define FILE_DEVICE_PARALLEL_PORT 0x00000016 -#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 -#define FILE_DEVICE_PRINTER 0x00000018 -#define FILE_DEVICE_SCANNER 0x00000019 -#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a -#define FILE_DEVICE_SERIAL_PORT 0x0000001b -#define FILE_DEVICE_SCREEN 0x0000001c -#define FILE_DEVICE_SOUND 0x0000001d -#define FILE_DEVICE_STREAMS 0x0000001e -#define FILE_DEVICE_TAPE 0x0000001f -#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 -#define FILE_DEVICE_TRANSPORT 0x00000021 -#define FILE_DEVICE_UNKNOWN 0x00000022 -#define FILE_DEVICE_VIDEO 0x00000023 -#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 -#define FILE_DEVICE_WAVE_IN 0x00000025 -#define FILE_DEVICE_WAVE_OUT 0x00000026 -#define FILE_DEVICE_8042_PORT 0x00000027 -#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 -#define FILE_DEVICE_BATTERY 0x00000029 -#define FILE_DEVICE_BUS_EXTENDER 0x0000002a -#define FILE_DEVICE_MODEM 0x0000002b -#define FILE_DEVICE_VDM 0x0000002c -#define FILE_DEVICE_MASS_STORAGE 0x0000002d -#define FILE_DEVICE_SMB 0x0000002e -#define FILE_DEVICE_KS 0x0000002f -#define FILE_DEVICE_CHANGER 0x00000030 -#define FILE_DEVICE_SMARTCARD 0x00000031 -#define FILE_DEVICE_ACPI 0x00000032 -#define FILE_DEVICE_DVD 0x00000033 -#define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034 -#define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035 -#define FILE_DEVICE_DFS_VOLUME 0x00000036 -#define FILE_DEVICE_SERENUM 0x00000037 -#define FILE_DEVICE_TERMSRV 0x00000038 -#define FILE_DEVICE_KSEC 0x00000039 -#define FILE_DEVICE_FIPS 0x0000003A -#define FILE_DEVICE_INFINIBAND 0x0000003B -#define FILE_DEVICE_VMBUS 0x0000003E -#define FILE_DEVICE_CRYPT_PROVIDER 0x0000003F -#define FILE_DEVICE_WPD 0x00000040 -#define FILE_DEVICE_BLUETOOTH 0x00000041 -#define FILE_DEVICE_MT_COMPOSITE 0x00000042 -#define FILE_DEVICE_MT_TRANSPORT 0x00000043 -#define FILE_DEVICE_BIOMETRIC 0x00000044 -#define FILE_DEVICE_PMI 0x00000045 - -// -// 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) \ -) - -// -// Macro to extract device type out of the device io control code -// -#define DEVICE_TYPE_FROM_CTL_CODE(ctrlCode) (((ULONG)(ctrlCode & 0xffff0000)) >> 16) - -// -// Macro to extract buffering method out of the device io control code -// -#define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3)) - -// -// 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 some easier to comprehend aliases: -// METHOD_DIRECT_TO_HARDWARE (writes, aka METHOD_IN_DIRECT) -// METHOD_DIRECT_FROM_HARDWARE (reads, aka METHOD_OUT_DIRECT) -// - -#define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT -#define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT - -// -// 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. -// -// -// FILE_SPECIAL_ACCESS is checked by the NT I/O system the same as FILE_ANY_ACCESS. -// The file systems, however, may add additional access checks for I/O and FS controls -// that use this value. -// - - -#define FILE_ANY_ACCESS 0 -#define FILE_SPECIAL_ACCESS (FILE_ANY_ACCESS) -#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe -#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe - - -#if (NTDDI_VERSION >= NTDDI_WIN7) -#define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_EX 0x00004000 -#define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_EX 0x00008000 -#define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK_EX \ - (FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_EX | \ - FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_EX) - -#define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_DEPRECATED 0x00000200 -#define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_DEPRECATED 0x00000300 -#define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK_DEPRECATED 0x00000300 - -#else -#define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL 0x00000200 -#define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL 0x00000300 -#define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK 0x00000300 - -#define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_EX FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL -#define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_EX FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL -#define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK_EX FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK -#endif - -// -// flags specified here will be propagated up and down a device stack -// after FDO and all filter devices are added, but before the device -// stack is started -// - -#define FILE_CHARACTERISTICS_PROPAGATED ( FILE_REMOVABLE_MEDIA | \ - FILE_READ_ONLY_DEVICE | \ - FILE_FLOPPY_DISKETTE | \ - FILE_WRITE_ONCE_MEDIA | \ - FILE_DEVICE_SECURE_OPEN ) - - -typedef struct _FILE_ALIGNMENT_INFORMATION { - ULONG AlignmentRequirement; -} FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION; - -// -// This is also used for FileNormalizedNameInformation -// - -typedef struct _FILE_NAME_INFORMATION { - ULONG FileNameLength; - WCHAR FileName[1]; -} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION; - -typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION { - ULONG FileAttributes; - ULONG ReparseTag; -} FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION; - -typedef struct _FILE_DISPOSITION_INFORMATION { - BOOLEAN DeleteFile; -} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION; - -typedef struct _FILE_END_OF_FILE_INFORMATION { - LARGE_INTEGER EndOfFile; -} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION; - -typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION { - LARGE_INTEGER ValidDataLength; -} FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION; - -// -// NtQuery[Set]VolumeInformationFile types: -// -// FILE_FS_LABEL_INFORMATION -// FILE_FS_VOLUME_INFORMATION -// FILE_FS_SIZE_INFORMATION -// FILE_FS_DEVICE_INFORMATION -// FILE_FS_ATTRIBUTE_INFORMATION -// FILE_FS_CONTROL_INFORMATION -// FILE_FS_OBJECTID_INFORMATION -// - -typedef struct _FILE_FS_LABEL_INFORMATION { - ULONG VolumeLabelLength; - WCHAR VolumeLabel[1]; -} FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION; - -typedef struct _FILE_FS_VOLUME_INFORMATION { - LARGE_INTEGER VolumeCreationTime; - ULONG VolumeSerialNumber; - ULONG VolumeLabelLength; - BOOLEAN SupportsObjects; - WCHAR VolumeLabel[1]; -} FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION; - -typedef struct _FILE_FS_SIZE_INFORMATION { - LARGE_INTEGER TotalAllocationUnits; - LARGE_INTEGER AvailableAllocationUnits; - ULONG SectorsPerAllocationUnit; - ULONG BytesPerSector; -} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION; - -typedef struct _FILE_FS_FULL_SIZE_INFORMATION { - LARGE_INTEGER TotalAllocationUnits; - LARGE_INTEGER CallerAvailableAllocationUnits; - LARGE_INTEGER ActualAvailableAllocationUnits; - ULONG SectorsPerAllocationUnit; - ULONG BytesPerSector; -} FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION; - -typedef struct _FILE_FS_OBJECTID_INFORMATION { - UCHAR ObjectId[16]; - UCHAR ExtendedInfo[48]; -} FILE_FS_OBJECTID_INFORMATION, *PFILE_FS_OBJECTID_INFORMATION; - - -// -// Define segement buffer structure for scatter/gather read/write. -// - -typedef union _FILE_SEGMENT_ELEMENT { - PVOID64 Buffer; - ULONGLONG Alignment; -}FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT; - -// -// AVIO IOCTLS. -// - -#define IOCTL_AVIO_ALLOCATE_STREAM CTL_CODE(FILE_DEVICE_AVIO, 1, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) -#define IOCTL_AVIO_FREE_STREAM CTL_CODE(FILE_DEVICE_AVIO, 2, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) -#define IOCTL_AVIO_MODIFY_STREAM CTL_CODE(FILE_DEVICE_AVIO, 3, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) - - -// -// Define types of bus information. -// - -typedef enum _BUS_DATA_TYPE { - ConfigurationSpaceUndefined = -1, - Cmos, - EisaConfiguration, - Pos, - CbusConfiguration, - PCIConfiguration, - VMEConfiguration, - NuBusConfiguration, - PCMCIAConfiguration, - MPIConfiguration, - MPSAConfiguration, - PNPISAConfiguration, - SgiInternalConfiguration, - MaximumBusDataType -} BUS_DATA_TYPE, *PBUS_DATA_TYPE; - -typedef struct _KEY_NAME_INFORMATION { - ULONG NameLength; - WCHAR Name[1]; // Variable length string -} KEY_NAME_INFORMATION, *PKEY_NAME_INFORMATION; - -typedef struct _KEY_CACHED_INFORMATION { - LARGE_INTEGER LastWriteTime; - ULONG TitleIndex; - ULONG SubKeys; - ULONG MaxNameLen; - ULONG Values; - ULONG MaxValueNameLen; - ULONG MaxValueDataLen; - ULONG NameLength; -} KEY_CACHED_INFORMATION, *PKEY_CACHED_INFORMATION; - -typedef struct _KEY_VIRTUALIZATION_INFORMATION { - ULONG VirtualizationCandidate : 1; // Tells whether the key is part of the virtualization namespace scope (only HKLM\Software for now) - ULONG VirtualizationEnabled : 1; // Tells whether virtualization is enabled on this key. Can be 1 only if above flag is 1. - ULONG VirtualTarget : 1; // Tells if the key is a virtual key. Can be 1 only if above 2 are 0. Valid only on the virtual store key handles. - ULONG VirtualStore : 1; // Tells if the key is a part of the virtual sore path. Valid only on the virtual store key handles. - ULONG VirtualSource : 1; // Tells if the key has ever been virtualized, Can be 1 only if VirtualizationCandidate is 1 - ULONG Reserved : 27; -} KEY_VIRTUALIZATION_INFORMATION, *PKEY_VIRTUALIZATION_INFORMATION; - -// -// Thread Environment Block (and portable part of Thread Information Block) -// - -// -// NT_TIB - Thread Information Block - Portable part. -// -// This is the subsystem portable part of the Thread Information Block. -// It appears as the first part of the TEB for all threads which have -// a user mode component. -// -// - - - -typedef struct _NT_TIB { - struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList; - PVOID StackBase; - PVOID StackLimit; - PVOID SubSystemTib; -#if defined(_MSC_EXTENSIONS) - union { - PVOID FiberData; - ULONG Version; - }; -#else - PVOID FiberData; -#endif - PVOID ArbitraryUserPointer; - struct _NT_TIB *Self; -} NT_TIB; -typedef NT_TIB *PNT_TIB; - -// -// 32 and 64 bit specific version for wow64 and the debugger -// -typedef struct _NT_TIB32 { - ULONG ExceptionList; - ULONG StackBase; - ULONG StackLimit; - ULONG SubSystemTib; - -#if defined(_MSC_EXTENSIONS) - union { - ULONG FiberData; - ULONG Version; - }; -#else - ULONG FiberData; -#endif - - ULONG ArbitraryUserPointer; - ULONG Self; -} NT_TIB32, *PNT_TIB32; - -typedef struct _NT_TIB64 { - ULONG64 ExceptionList; - ULONG64 StackBase; - ULONG64 StackLimit; - ULONG64 SubSystemTib; - -#if defined(_MSC_EXTENSIONS) - union { - ULONG64 FiberData; - ULONG Version; - }; - -#else - ULONG64 FiberData; -#endif - - ULONG64 ArbitraryUserPointer; - ULONG64 Self; -} NT_TIB64, *PNT_TIB64; - -// -// Process Information Classes -// - -typedef enum _PROCESSINFOCLASS { - ProcessBasicInformation, - ProcessQuotaLimits, - ProcessIoCounters, - ProcessVmCounters, - ProcessTimes, - ProcessBasePriority, - ProcessRaisePriority, - ProcessDebugPort, - ProcessExceptionPort, - ProcessAccessToken, - ProcessLdtInformation, - ProcessLdtSize, - ProcessDefaultHardErrorMode, - ProcessIoPortHandlers, // Note: this is kernel mode only - ProcessPooledUsageAndLimits, - ProcessWorkingSetWatch, - ProcessUserModeIOPL, - ProcessEnableAlignmentFaultFixup, - ProcessPriorityClass, - ProcessWx86Information, - ProcessHandleCount, - ProcessAffinityMask, - ProcessPriorityBoost, - ProcessDeviceMap, - ProcessSessionInformation, - ProcessForegroundInformation, - ProcessWow64Information, - ProcessImageFileName, - ProcessLUIDDeviceMapsEnabled, - ProcessBreakOnTermination, - ProcessDebugObjectHandle, - ProcessDebugFlags, - ProcessHandleTracing, - ProcessIoPriority, - ProcessExecuteFlags, - ProcessTlsInformation, - ProcessCookie, - ProcessImageInformation, - ProcessCycleTime, - ProcessPagePriority, - ProcessInstrumentationCallback, - ProcessThreadStackAllocation, - ProcessWorkingSetWatchEx, - ProcessImageFileNameWin32, - ProcessImageFileMapping, - ProcessAffinityUpdateMode, - ProcessMemoryAllocationMode, - ProcessGroupInformation, - ProcessTokenVirtualizationEnabled, - ProcessConsoleHostProcess, - ProcessWindowInformation, - MaxProcessInfoClass // MaxProcessInfoClass should always be the last enum -} PROCESSINFOCLASS; - -// -// Thread Information Classes -// - -typedef enum _THREADINFOCLASS { - ThreadBasicInformation, - ThreadTimes, - ThreadPriority, - ThreadBasePriority, - ThreadAffinityMask, - ThreadImpersonationToken, - ThreadDescriptorTableEntry, - ThreadEnableAlignmentFaultFixup, - ThreadEventPair_Reusable, - ThreadQuerySetWin32StartAddress, - ThreadZeroTlsCell, - ThreadPerformanceCount, - ThreadAmILastThread, - ThreadIdealProcessor, - ThreadPriorityBoost, - ThreadSetTlsArrayAddress, // Obsolete - ThreadIsIoPending, - ThreadHideFromDebugger, - ThreadBreakOnTermination, - ThreadSwitchLegacyState, - ThreadIsTerminated, - ThreadLastSystemCall, - ThreadIoPriority, - ThreadCycleTime, - ThreadPagePriority, - ThreadActualBasePriority, - ThreadTebInformation, - ThreadCSwitchMon, // Obsolete - ThreadCSwitchPmu, - ThreadWow64Context, - ThreadGroupInformation, - ThreadUmsInformation, // UMS - ThreadCounterProfiling, - ThreadIdealProcessorEx, - MaxThreadInfoClass -} THREADINFOCLASS; - -#define THREAD_CSWITCH_PMU_DISABLE FALSE -#define THREAD_CSWITCH_PMU_ENABLE TRUE - - -// -// Process Information Structures -// - -// -// Working set page priority information. -// Used with ProcessPagePriority and ThreadPagePriority -// - -typedef struct _PAGE_PRIORITY_INFORMATION { - ULONG PagePriority; -} PAGE_PRIORITY_INFORMATION, *PPAGE_PRIORITY_INFORMATION; - -// -// PageFaultHistory Information -// NtQueryInformationProcess using ProcessWorkingSetWatch -// -typedef struct _PROCESS_WS_WATCH_INFORMATION { - PVOID FaultingPc; - PVOID FaultingVa; -} PROCESS_WS_WATCH_INFORMATION, *PPROCESS_WS_WATCH_INFORMATION; - -// -// Basic and Extended Basic Process Information -// NtQueryInformationProcess using ProcessBasicInformation -// - -typedef struct _PROCESS_BASIC_INFORMATION { - NTSTATUS ExitStatus; - PPEB PebBaseAddress; - ULONG_PTR AffinityMask; - KPRIORITY BasePriority; - ULONG_PTR UniqueProcessId; - ULONG_PTR InheritedFromUniqueProcessId; -} PROCESS_BASIC_INFORMATION,*PPROCESS_BASIC_INFORMATION; - -typedef struct _PROCESS_EXTENDED_BASIC_INFORMATION { - SIZE_T Size; // Must be set to structure size on input - PROCESS_BASIC_INFORMATION BasicInfo; - union { - ULONG Flags; - struct { - ULONG IsProtectedProcess : 1; - ULONG IsWow64Process : 1; - ULONG IsProcessDeleting : 1; - ULONG IsCrossSessionCreate : 1; - ULONG SpareBits : 28; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; -} PROCESS_EXTENDED_BASIC_INFORMATION, *PPROCESS_EXTENDED_BASIC_INFORMATION; - - -// -// Process Device Map information -// NtQueryInformationProcess using ProcessDeviceMap -// NtSetInformationProcess using ProcessDeviceMap -// - -typedef struct _PROCESS_DEVICEMAP_INFORMATION { - union { - struct { - HANDLE DirectoryHandle; - } Set; - struct { - ULONG DriveMap; - UCHAR DriveType[ 32 ]; - } Query; - } DUMMYUNIONNAME; -} PROCESS_DEVICEMAP_INFORMATION, *PPROCESS_DEVICEMAP_INFORMATION; - -typedef struct _PROCESS_DEVICEMAP_INFORMATION_EX { - union { - struct { - HANDLE DirectoryHandle; - } Set; - struct { - ULONG DriveMap; - UCHAR DriveType[ 32 ]; - } Query; - } DUMMYUNIONNAME; - ULONG Flags; // specifies that the query type -} PROCESS_DEVICEMAP_INFORMATION_EX, *PPROCESS_DEVICEMAP_INFORMATION_EX; - -// -// PROCESS_DEVICEMAP_INFORMATION_EX flags -// -#define PROCESS_LUID_DOSDEVICES_ONLY 0x00000001 - -// -// Multi-User Session specific Process Information -// NtQueryInformationProcess using ProcessSessionInformation -// - -typedef struct _PROCESS_SESSION_INFORMATION { - ULONG SessionId; -} PROCESS_SESSION_INFORMATION, *PPROCESS_SESSION_INFORMATION; - -typedef struct _PROCESS_HANDLE_TRACING_ENABLE { - ULONG Flags; -} PROCESS_HANDLE_TRACING_ENABLE, *PPROCESS_HANDLE_TRACING_ENABLE; - -typedef struct _PROCESS_HANDLE_TRACING_ENABLE_EX { - ULONG Flags; - ULONG TotalSlots; -} PROCESS_HANDLE_TRACING_ENABLE_EX, *PPROCESS_HANDLE_TRACING_ENABLE_EX; - - -#define PROCESS_HANDLE_TRACING_MAX_STACKS 16 - -typedef struct _PROCESS_HANDLE_TRACING_ENTRY { - HANDLE Handle; - CLIENT_ID ClientId; - ULONG Type; - PVOID Stacks[PROCESS_HANDLE_TRACING_MAX_STACKS]; -} PROCESS_HANDLE_TRACING_ENTRY, *PPROCESS_HANDLE_TRACING_ENTRY; - -typedef struct _PROCESS_HANDLE_TRACING_QUERY { - HANDLE Handle; - ULONG TotalTraces; - PROCESS_HANDLE_TRACING_ENTRY HandleTrace[1]; -} PROCESS_HANDLE_TRACING_QUERY, *PPROCESS_HANDLE_TRACING_QUERY; - -// -// Process Quotas -// NtQueryInformationProcess using ProcessQuotaLimits -// NtQueryInformationProcess using ProcessPooledQuotaLimits -// NtSetInformationProcess using ProcessQuotaLimits -// - - - -typedef struct _QUOTA_LIMITS { - SIZE_T PagedPoolLimit; - SIZE_T NonPagedPoolLimit; - SIZE_T MinimumWorkingSetSize; - SIZE_T MaximumWorkingSetSize; - SIZE_T PagefileLimit; - LARGE_INTEGER TimeLimit; -} QUOTA_LIMITS, *PQUOTA_LIMITS; - -#define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001 -#define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002 -#define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004 -#define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008 -#define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010 - -typedef union _RATE_QUOTA_LIMIT { - ULONG RateData; - struct { - ULONG RatePercent : 7; - ULONG Reserved0 : 25; - } DUMMYSTRUCTNAME; -} RATE_QUOTA_LIMIT, *PRATE_QUOTA_LIMIT; - -typedef struct _QUOTA_LIMITS_EX { - SIZE_T PagedPoolLimit; - SIZE_T NonPagedPoolLimit; - SIZE_T MinimumWorkingSetSize; - SIZE_T MaximumWorkingSetSize; - SIZE_T PagefileLimit; // Limit expressed in pages - LARGE_INTEGER TimeLimit; - SIZE_T WorkingSetLimit; // Limit expressed in pages - SIZE_T Reserved2; - SIZE_T Reserved3; - SIZE_T Reserved4; - ULONG Flags; - RATE_QUOTA_LIMIT CpuRateLimit; -} QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX; - - - -// -// Process I/O Counters -// NtQueryInformationProcess using ProcessIoCounters -// - - -typedef struct _IO_COUNTERS { - ULONGLONG ReadOperationCount; - ULONGLONG WriteOperationCount; - ULONGLONG OtherOperationCount; - ULONGLONG ReadTransferCount; - ULONGLONG WriteTransferCount; - ULONGLONG OtherTransferCount; -} IO_COUNTERS; -typedef IO_COUNTERS *PIO_COUNTERS; - - - -// -// Process Virtual Memory Counters -// NtQueryInformationProcess using ProcessVmCounters -// - -typedef struct _VM_COUNTERS { - SIZE_T PeakVirtualSize; - SIZE_T VirtualSize; - ULONG PageFaultCount; - SIZE_T PeakWorkingSetSize; - SIZE_T WorkingSetSize; - SIZE_T QuotaPeakPagedPoolUsage; - SIZE_T QuotaPagedPoolUsage; - SIZE_T QuotaPeakNonPagedPoolUsage; - SIZE_T QuotaNonPagedPoolUsage; - SIZE_T PagefileUsage; - SIZE_T PeakPagefileUsage; -} VM_COUNTERS; -typedef VM_COUNTERS *PVM_COUNTERS; - -typedef struct _VM_COUNTERS_EX { - SIZE_T PeakVirtualSize; - SIZE_T VirtualSize; - ULONG PageFaultCount; - SIZE_T PeakWorkingSetSize; - SIZE_T WorkingSetSize; - SIZE_T QuotaPeakPagedPoolUsage; - SIZE_T QuotaPagedPoolUsage; - SIZE_T QuotaPeakNonPagedPoolUsage; - SIZE_T QuotaNonPagedPoolUsage; - SIZE_T PagefileUsage; - SIZE_T PeakPagefileUsage; - SIZE_T PrivateUsage; -} VM_COUNTERS_EX; - -typedef VM_COUNTERS_EX *PVM_COUNTERS_EX; - - -#define MAX_HW_COUNTERS 16 -#define THREAD_PROFILING_FLAG_DISPATCH 0x00000001 - -typedef enum _HARDWARE_COUNTER_TYPE { - PMCCounter, - MaxHardwareCounterType -} HARDWARE_COUNTER_TYPE, *PHARDWARE_COUNTER_TYPE; - - -typedef struct _HARDWARE_COUNTER { - HARDWARE_COUNTER_TYPE Type; - ULONG Reserved; - ULONG64 Index; -} HARDWARE_COUNTER, *PHARDWARE_COUNTER; - -// -// Process Pooled Quota Usage and Limits -// NtQueryInformationProcess using ProcessPooledUsageAndLimits -// - -typedef struct _POOLED_USAGE_AND_LIMITS { - SIZE_T PeakPagedPoolUsage; - SIZE_T PagedPoolUsage; - SIZE_T PagedPoolLimit; - SIZE_T PeakNonPagedPoolUsage; - SIZE_T NonPagedPoolUsage; - SIZE_T NonPagedPoolLimit; - SIZE_T PeakPagefileUsage; - SIZE_T PagefileUsage; - SIZE_T PagefileLimit; -} POOLED_USAGE_AND_LIMITS; -typedef POOLED_USAGE_AND_LIMITS *PPOOLED_USAGE_AND_LIMITS; - -// -// Process Security Context Information -// NtSetInformationProcess using ProcessAccessToken -// PROCESS_SET_ACCESS_TOKEN access to the process is needed -// to use this info level. -// - -typedef struct _PROCESS_ACCESS_TOKEN { - - // - // Handle to Primary token to assign to the process. - // TOKEN_ASSIGN_PRIMARY access to this token is needed. - // - - HANDLE Token; - - // - // Handle to the initial thread of the process. - // A process's access token can only be changed if the process has - // no threads or a single thread that has not yet begun execution. - // - // N.B. This field is unused. - // - - HANDLE Thread; - -} PROCESS_ACCESS_TOKEN, *PPROCESS_ACCESS_TOKEN; - -// -// Process Exception Port Information -// NtSetInformationProcess using ProcessExceptionPort -// PROCESS_SET_PORT access to the process is needed -// to use this info level. -// - -#define PROCESS_EXCEPTION_PORT_ALL_STATE_BITS 0x00000003UL -#define PROCESS_EXCEPTION_PORT_ALL_STATE_FLAGS ((ULONG_PTR)((1UL << PROCESS_EXCEPTION_PORT_ALL_STATE_BITS) - 1)) - -typedef struct _PROCESS_EXCEPTION_PORT { - - // - // Handle to the exception port. No particular access required. - // - - __in HANDLE ExceptionPortHandle; - - // - // Miscellaneous state flags to be cached along with the exception - // port in the kernel. - // - - __inout ULONG StateFlags; - -} PROCESS_EXCEPTION_PORT, *PPROCESS_EXCEPTION_PORT; - -// -// Process/Thread System and User Time -// NtQueryInformationProcess using ProcessTimes -// NtQueryInformationThread using ThreadTimes -// - -typedef struct _KERNEL_USER_TIMES { - LARGE_INTEGER CreateTime; - LARGE_INTEGER ExitTime; - LARGE_INTEGER KernelTime; - LARGE_INTEGER UserTime; -} KERNEL_USER_TIMES; -typedef KERNEL_USER_TIMES *PKERNEL_USER_TIMES; - - -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtOpenProcess ( - __out PHANDLE ProcessHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt PCLIENT_ID ClientId - ); - - -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtQueryInformationProcess ( - __in HANDLE ProcessHandle, - __in PROCESSINFOCLASS ProcessInformationClass, - __out_bcount_opt(ProcessInformationLength) PVOID ProcessInformation, - __in ULONG ProcessInformationLength, - __out_opt PULONG ReturnLength - ); - -#define NTKERNELAPI DECLSPEC_IMPORT - -#if defined(_X86_) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_savesIRQL -__drv_setsIRQL(DISPATCH_LEVEL) -_DECL_HAL_KE_IMPORT -KIRQL -KeRaiseIrqlToDpcLevel ( - VOID - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_savesIRQL -_DECL_HAL_KE_IMPORT -KIRQL -KeRaiseIrqlToSynchLevel ( - VOID - ); -#endif - - -#if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) - - - -#define KeQueryTickCount(CurrentCount) { \ - KSYSTEM_TIME volatile *_TickCount = *((PKSYSTEM_TIME *)(&KeTickCount)); \ - for (;;) { \ - (CurrentCount)->HighPart = _TickCount->High1Time; \ - (CurrentCount)->LowPart = _TickCount->LowPart; \ - if ((CurrentCount)->HighPart == _TickCount->High2Time) break; \ - YieldProcessor(); \ - } \ -} - - - -#else - -VOID -NTAPI -KeQueryTickCount ( - __out PLARGE_INTEGER CurrentCount - ); - -#endif // defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) - - - -// -// Processor Control Region Structure Definition -// - -#define PCR_MINOR_VERSION 1 -#define PCR_MAJOR_VERSION 1 - -typedef struct _KPCR { - -// -// Start of the architecturally defined section of the PCR. This section -// may be directly addressed by vendor/platform specific HAL code and will -// not change from version to version of NT. -// -// Certain fields in the TIB are not used in kernel mode. These include the -// stack limit, subsystem TIB, fiber data, arbitrary user pointer, and the -// self address of then PCR itself (another field has been added for that -// purpose). Therefore, these fields are overlaid with other data to get -// better cache locality. -// - - union { - NT_TIB NtTib; - struct { - struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList; - PVOID Used_StackBase; - PVOID Spare2; - PVOID TssCopy; - ULONG ContextSwitches; - KAFFINITY SetMemberCopy; - PVOID Used_Self; - }; - }; - - struct _KPCR *SelfPcr; // flat address of this PCR - struct _KPRCB *Prcb; // pointer to Prcb - KIRQL Irql; // do not use 3 bytes after this as - // HALs assume they are zero. - ULONG IRR; - ULONG IrrActive; - ULONG IDR; - PVOID KdVersionBlock; - - struct _KIDTENTRY *IDT; - struct _KGDTENTRY *GDT; - struct _KTSS *TSS; - USHORT MajorVersion; - USHORT MinorVersion; - KAFFINITY SetMember; - ULONG StallScaleFactor; - UCHAR SpareUnused; - UCHAR Number; - - - - UCHAR Spare0; - UCHAR SecondLevelCacheAssociativity; - ULONG VdmAlert; - ULONG KernelReserved[14]; // For use by the kernel - ULONG SecondLevelCacheSize; - ULONG HalReserved[16]; // For use by Hal - - -} KPCR, *PKPCR; - -// -// Define the number of bits to shift to right justify the Page Directory Index -// field of a PTE. -// - -#define PDI_SHIFT_X86 22 -#define PDI_SHIFT_X86PAE 21 - -#if !defined (_X86PAE_) -#define PDI_SHIFT PDI_SHIFT_X86 -#else -#define PDI_SHIFT PDI_SHIFT_X86PAE -#define PPI_SHIFT 30 -#endif - -#define GUARD_PAGE_SIZE (PAGE_SIZE * 1) - -// -// Define the number of bits to shift to right justify the Page Table Index -// field of a PTE. -// - -#define PTI_SHIFT 12 - -// -// Define the highest user address and user probe address. -// - -extern NTKERNELAPI PVOID MmHighestUserAddress; -extern NTKERNELAPI PVOID MmSystemRangeStart; -extern NTKERNELAPI ULONG MmUserProbeAddress; - -#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress -#define MM_SYSTEM_RANGE_START MmSystemRangeStart - -#if defined(_LOCAL_COPY_USER_PROBE_ADDRESS_) - -#define MM_USER_PROBE_ADDRESS _LOCAL_COPY_USER_PROBE_ADDRESS_ - -extern ULONG _LOCAL_COPY_USER_PROBE_ADDRESS_; - -#else - -#define MM_USER_PROBE_ADDRESS MmUserProbeAddress - -#endif - -#define MM_KSEG0_BASE MM_SYSTEM_RANGE_START -#define MM_SYSTEM_SPACE_END 0xFFFFFFFF - -// -// The lowest user address reserves the low 64k. -// - -#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000 - -// -// The lowest address for system space. -// - -#if !defined (_X86PAE_) -#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0800000 -#else -#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0C00000 -#endif - - -// -// Prototypes for architectural specific versions of Exi386 Api -// - -// -// Interlocked result type is portable, but its values are machine specific. -// Constants for value are in i386.h, mips.h, etc. -// - -typedef enum _INTERLOCKED_RESULT { - ResultNegative = RESULT_NEGATIVE, - ResultZero = RESULT_ZERO, - ResultPositive = RESULT_POSITIVE -} INTERLOCKED_RESULT; - -NTKERNELAPI -INTERLOCKED_RESULT -FASTCALL -Exfi386InterlockedIncrementLong ( - __inout __drv_interlocked LONG volatile *Addend - ); - -NTKERNELAPI -INTERLOCKED_RESULT -FASTCALL -Exfi386InterlockedDecrementLong ( - __inout __drv_interlocked LONG volatile *Addend - ); - -NTKERNELAPI -ULONG -FASTCALL -Exfi386InterlockedExchangeUlong ( - __inout __drv_interlocked ULONG volatile *Target, - __in ULONG Value - ); - - -// -// Turn these instrinsics off until the compiler can handle them -// - -#if (_MSC_FULL_VER > 13009037) - -LONG -_InterlockedOr ( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Set - ); - -#pragma intrinsic(_InterlockedOr) - -#define InterlockedOr _InterlockedOr -#define InterlockedOrAffinity InterlockedOr - -LONG -_InterlockedAnd ( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Set - ); - -#pragma intrinsic(_InterlockedAnd) - -#define InterlockedAnd _InterlockedAnd -#define InterlockedAndAffinity InterlockedAnd - -LONG -_InterlockedXor ( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Set - ); - -#pragma intrinsic(_InterlockedXor) - -#define InterlockedXor _InterlockedXor - -#if !defined(_WINBASE_) && !defined(NONTOSPINTERLOCK) - -FORCEINLINE -LONGLONG -_InterlockedAnd64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Destination; - } while (InterlockedCompareExchange64(Destination, - Old & Value, - Old) != Old); - - return Old; -} - -#define InterlockedAnd64 _InterlockedAnd64 - -LONGLONG -FORCEINLINE -_InterlockedOr64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Destination; - } while (InterlockedCompareExchange64(Destination, - Old | Value, - Old) != Old); - - return Old; -} - -#define InterlockedOr64 _InterlockedOr64 - -FORCEINLINE -LONGLONG -_InterlockedXor64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Destination; - } while (InterlockedCompareExchange64(Destination, - Old ^ Value, - Old) != Old); - - return Old; -} - -#define InterlockedXor64 _InterlockedXor64 - -LONGLONG -FORCEINLINE -_InterlockedIncrement64 ( - __inout __drv_interlocked LONGLONG volatile *Addend - ) -{ - LONGLONG Old; - - do { - Old = *Addend; - } while (InterlockedCompareExchange64(Addend, - Old + 1, - Old) != Old); - - return Old + 1; -} - -#define InterlockedIncrement64 _InterlockedIncrement64 - -FORCEINLINE -LONGLONG -_InterlockedDecrement64 ( - __inout __drv_interlocked LONGLONG volatile *Addend - ) -{ - LONGLONG Old; - - do { - Old = *Addend; - } while (InterlockedCompareExchange64(Addend, - Old - 1, - Old) != Old); - - return Old - 1; -} - -#define InterlockedDecrement64 _InterlockedDecrement64 - -FORCEINLINE -LONGLONG -_InterlockedExchange64 ( - __inout __drv_interlocked LONGLONG volatile *Target, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Target; - } while (InterlockedCompareExchange64(Target, - Value, - Old) != Old); - - return Old; -} - -#define InterlockedExchange64 _InterlockedExchange64 - -FORCEINLINE -LONGLONG -_InterlockedExchangeAdd64 ( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Addend; - } while (InterlockedCompareExchange64(Addend, - Old + Value, - Old) != Old); - - return Old; -} - -#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 - -#endif // !defined(_WINBASE_) && !defined(NONTOSPINTERLOCK) - -#else // compiler version - -FORCEINLINE -LONG -InterlockedAnd ( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Set - ) -{ - LONG i; - LONG j; - - j = *Target; - do { - i = j; - j = InterlockedCompareExchange(Target, - i & Set, - i); - - } while (i != j); - - return j; -} - -FORCEINLINE -LONG -InterlockedOr ( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Set - ) -{ - LONG i; - LONG j; - - j = *Target; - do { - i = j; - j = InterlockedCompareExchange(Target, - i | Set, - i); - - } while (i != j); - - return j; -} - -#endif // compiler version - - -#if !defined(MIDL_PASS) && defined(_M_IX86) - -// -// i386 function definitions -// - - - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4035) // re-enable below - -#define _PCR fs:[0] - -// -// Get the current processor number -// - -FORCEINLINE -ULONG -NTAPI -KeGetCurrentProcessorNumber(VOID) -{ -#if (_MSC_FULL_VER >= 13012035) - return (ULONG) __readfsbyte (FIELD_OFFSET (KPCR, Number)); -#else - __asm { movzx eax, _PCR KPCR.Number } -#endif -} - - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4035) -#endif - - -#endif // !defined(MIDL_PASS) && defined(_M_IX86) - - -#endif // defined(_X86_) - - -// Use the following for kernel mode runtime checks of X86 system architecture - -#ifdef _X86_ - -#ifdef IsNEC_98 -#undef IsNEC_98 -#endif - -#ifdef IsNotNEC_98 -#undef IsNotNEC_98 -#endif - -#ifdef SetNEC_98 -#undef SetNEC_98 -#endif - -#ifdef SetNotNEC_98 -#undef SetNotNEC_98 -#endif - -#define IsNEC_98 (SharedUserData->AlternativeArchitecture == NEC98x86) -#define IsNotNEC_98 (SharedUserData->AlternativeArchitecture != NEC98x86) -#define SetNEC_98 SharedUserData->AlternativeArchitecture = NEC98x86 -#define SetNotNEC_98 SharedUserData->AlternativeArchitecture = StandardDesign - -#endif - -#if defined(_AMD64_) - -// -// Processor Control Region Structure Definition -// - -#define PCR_MINOR_VERSION 1 -#define PCR_MAJOR_VERSION 1 - -typedef struct _KPCR { - -// -// Start of the architecturally defined section of the PCR. This section -// may be directly addressed by vendor/platform specific HAL code and will -// not change from version to version of NT. -// -// Certain fields in the TIB are not used in kernel mode. These include the -// exception list, stack base, stack limit, subsystem TIB, fiber data, and -// the arbitrary user pointer. Therefore, these fields are overlaid with -// other data to get better cache locality. -// -// N.B. The offset to the PRCB in the PCR is fixed for all time. -// - - union { - NT_TIB NtTib; - struct { - union _KGDTENTRY64 *GdtBase; - struct _KTSS64 *TssBase; - ULONG64 UserRsp; - struct _KPCR *Self; - struct _KPRCB *CurrentPrcb; - PKSPIN_LOCK_QUEUE LockArray; - PVOID Used_Self; - }; - }; - - union _KIDTENTRY64 *IdtBase; - ULONG64 Unused[2]; - KIRQL Irql; - UCHAR SecondLevelCacheAssociativity; - UCHAR ObsoleteNumber; - UCHAR Fill0; - ULONG Unused0[3]; - USHORT MajorVersion; - USHORT MinorVersion; - ULONG StallScaleFactor; - PVOID Unused1[3]; - - ULONG KernelReserved[15]; - ULONG SecondLevelCacheSize; - ULONG HalReserved[16]; - ULONG Unused2; - PVOID KdVersionBlock; - PVOID Unused3; - ULONG PcrAlign1[24]; - - -} KPCR, *PKPCR; - -// -// Exception frame -// -// This frame is established when handling an exception. It provides a place -// to save all nonvolatile registers. The volatile registers will already -// have been saved in a trap frame. -// -// N.B. The exception frame has a built in exception record capable of -// storing information for four parameter values. This exception -// record is used exclusively within the trap handling code. -// - -typedef struct _KEXCEPTION_FRAME { - -// -// Home address for the parameter registers. -// - - ULONG64 P1Home; - ULONG64 P2Home; - ULONG64 P3Home; - ULONG64 P4Home; - ULONG64 P5; - -// -// Kernel callout initial stack value. -// - - ULONG64 InitialStack; - -// -// Saved nonvolatile floating registers. -// - - M128A Xmm6; - M128A Xmm7; - M128A Xmm8; - M128A Xmm9; - M128A Xmm10; - M128A Xmm11; - M128A Xmm12; - M128A Xmm13; - M128A Xmm14; - M128A Xmm15; - -// -// Kernel callout frame variables. -// - - ULONG64 TrapFrame; - ULONG64 CallbackStack; - ULONG64 OutputBuffer; - ULONG64 OutputLength; - -// -// Saved MXCSR when a thread is interrupted in kernel mode via a dispatch -// interrupt. -// - - ULONG64 MxCsr; - -// -// Saved nonvolatile register - not always saved. -// - - ULONG64 Rbp; - -// -// Saved nonvolatile registers. -// - - ULONG64 Rbx; - ULONG64 Rdi; - ULONG64 Rsi; - ULONG64 R12; - ULONG64 R13; - ULONG64 R14; - ULONG64 R15; - -// -// EFLAGS and return address. -// - - ULONG64 Return; -} KEXCEPTION_FRAME, *PKEXCEPTION_FRAME; - -// -// Trap frame -// -// This frame is established when handling a trap. It provides a place to -// save all volatile registers. The nonvolatile registers are saved in an -// exception frame or through the normal C calling conventions for saved -// registers. -// - -typedef struct _KTRAP_FRAME { - -// -// Home address for the parameter registers. -// - - ULONG64 P1Home; - ULONG64 P2Home; - ULONG64 P3Home; - ULONG64 P4Home; - ULONG64 P5; - -// -// Previous processor mode (system services only) and previous IRQL -// (interrupts only). -// - - KPROCESSOR_MODE PreviousMode; - KIRQL PreviousIrql; - -// -// Page fault load/store indicator. -// - - UCHAR FaultIndicator; - -// -// Exception active indicator. -// -// 0 - interrupt frame. -// 1 - exception frame. -// 2 - service frame. -// - - UCHAR ExceptionActive; - -// -// Floating point state. -// - - ULONG MxCsr; - -// -// Volatile registers. -// -// N.B. These registers are only saved on exceptions and interrupts. They -// are not saved for system calls. -// - - ULONG64 Rax; - ULONG64 Rcx; - ULONG64 Rdx; - ULONG64 R8; - ULONG64 R9; - ULONG64 R10; - ULONG64 R11; - -// -// Gsbase is only used if the previous mode was kernel. -// -// GsSwap is only used if the previous mode was user. -// - - union { - ULONG64 GsBase; - ULONG64 GsSwap; - }; - -// -// Volatile floating registers. -// -// N.B. These registers are only saved on exceptions and interrupts. They -// are not saved for system calls. -// - - M128A Xmm0; - M128A Xmm1; - M128A Xmm2; - M128A Xmm3; - M128A Xmm4; - M128A Xmm5; - -// -// First parameter, page fault address, context record address if user APC -// bypass, or time stamp value. -// - - union { - ULONG64 FaultAddress; - ULONG64 ContextRecord; - ULONG64 TimeStampCKCL; - }; - -// -// Debug registers. -// - - ULONG64 Dr0; - ULONG64 Dr1; - ULONG64 Dr2; - ULONG64 Dr3; - ULONG64 Dr6; - ULONG64 Dr7; - -// -// Special debug registers. -// -// N.B. Either AMD64 or EM64T information is stored in the following locations. -// - - union { - struct { - ULONG64 DebugControl; - ULONG64 LastBranchToRip; - ULONG64 LastBranchFromRip; - ULONG64 LastExceptionToRip; - ULONG64 LastExceptionFromRip; - }; - - struct { - ULONG64 LastBranchControl; - ULONG LastBranchMSR; - }; - }; - -// -// Segment registers -// - - USHORT SegDs; - USHORT SegEs; - USHORT SegFs; - USHORT SegGs; - -// -// Previous trap frame address. -// - - ULONG64 TrapFrame; - -// -// Saved nonvolatile registers RBX, RDI and RSI. These registers are only -// saved in system service trap frames. -// - - ULONG64 Rbx; - ULONG64 Rdi; - ULONG64 Rsi; - -// -// Saved nonvolatile register RBP. This register is used as a frame -// pointer during trap processing and is saved in all trap frames. -// - - ULONG64 Rbp; - -// -// Information pushed by hardware. -// -// N.B. The error code is not always pushed by hardware. For those cases -// where it is not pushed by hardware a dummy error code is allocated -// on the stack. -// - - union { - ULONG64 ErrorCode; - ULONG64 ExceptionFrame; - ULONG64 TimeStampKlog; - }; - - ULONG64 Rip; - USHORT SegCs; - UCHAR Fill0; - UCHAR Logging; - USHORT Fill1[2]; - ULONG EFlags; - ULONG Fill2; - ULONG64 Rsp; - USHORT SegSs; - USHORT Fill3; - -// -// Copy of the global patch cycle at the time of the fault. Filled in by the -// invalid opcode and general protection fault routines. -// - - LONG CodePatchCycle; -} KTRAP_FRAME, *PKTRAP_FRAME; - -typedef struct _KUMS_CONTEXT_HEADER { - ULONG64 P1Home; - ULONG64 P2Home; - ULONG64 P3Home; - ULONG64 P4Home; - PVOID StackTop; - ULONG64 StackSize; - ULONG64 RspOffset; - ULONG64 Rip; - PXMM_SAVE_AREA32 FltSave; -#define KUMS_UCH_VOLATILE_BIT (0) -#define KUMS_UCH_VOLATILE_MASK (1ULL << KUMS_UCH_VOLATILE_BIT) - union { - struct { - ULONG64 Volatile : 1; - ULONG64 Reserved : 63; - }; - ULONG64 Flags; - }; - PKTRAP_FRAME TrapFrame; - PKEXCEPTION_FRAME ExceptionFrame; - struct _KTHREAD *SourceThread; - ULONG64 Return; -} KUMS_CONTEXT_HEADER, *PKUMS_CONTEXT_HEADER; - - -#define PXE_BASE 0xFFFFF6FB7DBED000UI64 -#define PXE_SELFMAP 0xFFFFF6FB7DBEDF68UI64 -#define PPE_BASE 0xFFFFF6FB7DA00000UI64 -#define PDE_BASE 0xFFFFF6FB40000000UI64 -#define PTE_BASE 0xFFFFF68000000000UI64 - -#define PXE_TOP 0xFFFFF6FB7DBEDFFFUI64 -#define PPE_TOP 0xFFFFF6FB7DBFFFFFUI64 -#define PDE_TOP 0xFFFFF6FB7FFFFFFFUI64 -#define PTE_TOP 0xFFFFF6FFFFFFFFFFUI64 - -#define PDE_KTBASE_AMD64 PPE_BASE - -#define PTI_SHIFT 12 -#define PDI_SHIFT 21 -#define PPI_SHIFT 30 -#define PXI_SHIFT 39 - -#define PTE_PER_PAGE 512 -#define PDE_PER_PAGE 512 -#define PPE_PER_PAGE 512 -#define PXE_PER_PAGE 512 - -#define PTI_MASK_AMD64 (PTE_PER_PAGE - 1) -#define PDI_MASK_AMD64 (PDE_PER_PAGE - 1) -#define PPI_MASK (PPE_PER_PAGE - 1) -#define PXI_MASK (PXE_PER_PAGE - 1) - -#define GUARD_PAGE_SIZE (PAGE_SIZE * 2) - -// -// Define the last branch control MSR address. -// - -extern NTKERNELAPI ULONG KeLastBranchMSR; - -// -// Define the highest user address and user probe address. -// - -extern NTKERNELAPI PVOID MmHighestUserAddress; -extern NTKERNELAPI PVOID MmSystemRangeStart; -extern NTKERNELAPI ULONG64 MmUserProbeAddress; - -#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress -#define MM_SYSTEM_RANGE_START MmSystemRangeStart - -// -// Allow non-kernel components to capture the user probe address and use a -// local copy for efficiency. -// - -#if defined(_LOCAL_COPY_USER_PROBE_ADDRESS_) - -#define MM_USER_PROBE_ADDRESS _LOCAL_COPY_USER_PROBE_ADDRESS_ - -extern ULONG64 _LOCAL_COPY_USER_PROBE_ADDRESS_; - -#else - -#define MM_USER_PROBE_ADDRESS MmUserProbeAddress - -#endif - -// -// The lowest user address reserves the low 64k. -// - -#define MM_LOWEST_USER_ADDRESS (PVOID)(LONG_PTR)0x10000 - -// -// The lowest address for system space. -// - -#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xFFFF080000000000 - - -// -// Intrinsic functions -// - -#if defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -// -// The following routines are provided for backward compatibility with old -// code. They are no longer the preferred way to accomplish these functions. -// - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(ExInterlockedIncrementLong) // Use InterlockedIncrement -#pragma deprecated(ExInterlockedDecrementLong) // Use InterlockedDecrement -#pragma deprecated(ExInterlockedExchangeUlong) // Use InterlockedExchange -#endif - -#define RESULT_ZERO 0 -#define RESULT_NEGATIVE 1 -#define RESULT_POSITIVE 2 - -typedef enum _INTERLOCKED_RESULT { - ResultNegative = RESULT_NEGATIVE, - ResultZero = RESULT_ZERO, - ResultPositive = RESULT_POSITIVE -} INTERLOCKED_RESULT; - -#define ExInterlockedDecrementLong(Addend, Lock) \ - _ExInterlockedDecrementLong(Addend) - -__drv_valueIs(==0;==1;==2) -__forceinline -LONG -_ExInterlockedDecrementLong ( - __inout __drv_interlocked PLONG Addend - ) - -{ - - LONG Result; - - Result = InterlockedDecrement(Addend); - if (Result < 0) { - return ResultNegative; - - } else if (Result > 0) { - return ResultPositive; - - } else { - return ResultZero; - } -} - -#define ExInterlockedIncrementLong(Addend, Lock) \ - _ExInterlockedIncrementLong(Addend) - -__drv_valueIs(==0;==1;==2) -__forceinline -LONG -_ExInterlockedIncrementLong ( - __inout __drv_interlocked PLONG Addend - ) - -{ - - LONG Result; - - Result = InterlockedIncrement(Addend); - if (Result < 0) { - return ResultNegative; - - } else if (Result > 0) { - return ResultPositive; - - } else { - return ResultZero; - } -} - -#define ExInterlockedExchangeUlong(Target, Value, Lock) \ - _ExInterlockedExchangeUlong(Target, Value) - -__forceinline -ULONG -_ExInterlockedExchangeUlong ( - __inout __drv_interlocked PULONG Target, - __in ULONG Value - ) - -{ - - return (ULONG)InterlockedExchange((PLONG)Target, (LONG)Value); -} - -#endif // defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - - -#if !defined(MIDL_PASS) && defined(_M_AMD64) - -// -// AMD646 function prototype definitions -// - - -// -// Get address of current processor block. -// - -__forceinline -PKPCR -KeGetPcr ( - VOID - ) - -{ - return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self)); -} - - -#if (NTDDI_VERSION < NTDDI_WIN7) || !defined(NT_PROCESSOR_GROUPS) - -// -// Get the current processor number -// - -__forceinline -ULONG -KeGetCurrentProcessorNumber ( - VOID - ) - -{ - return (ULONG)__readgsbyte(0x184); -} - -#endif - - -#endif // !defined(MIDL_PASS) && defined(_M_AMD64) - - -#endif // defined(_AMD64_) - - -// -// Platform specific kernel fucntions to raise and lower IRQL. -// - - -#if defined(_AMD64_) && !defined(MIDL_PASS) - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_savesIRQL -__drv_setsIRQL(DISPATCH_LEVEL) -__forceinline -KIRQL -KeRaiseIrqlToDpcLevel ( - VOID - ) - -/*++ - -Routine Description: - - This function raises the current IRQL to DPC_LEVEL and returns the - previous IRQL. - -Arguments: - - None. - -Return Value: - - The previous IRQL is retured as the function value. - ---*/ - -{ - - return KfRaiseIrql(DISPATCH_LEVEL); -} - -__drv_savesIRQL -__drv_setsIRQL(12) -__forceinline -KIRQL -KeRaiseIrqlToSynchLevel ( - VOID - ) - -/*++ - -Routine Description: - - This function raises the current IRQL to SYNCH_LEVEL and returns the - previous IRQL. - -Arguments: - -Return Value: - - The previous IRQL is retured as the function value. - ---*/ - -{ - - return KfRaiseIrql(12); -} - - -#endif // defined(_AMD64_) && !defined(MIDL_PASS) - - -#if defined(_IA64_) - -// -// IA64 specific interlocked operation result values. -// - -#define RESULT_ZERO 0 -#define RESULT_NEGATIVE 1 -#define RESULT_POSITIVE 2 - -// -// Interlocked result type is portable, but its values are machine specific. -// Constants for values are in i386.h, mips.h, etc. -// - -typedef enum _INTERLOCKED_RESULT { - ResultNegative = RESULT_NEGATIVE, - ResultZero = RESULT_ZERO, - ResultPositive = RESULT_POSITIVE -} INTERLOCKED_RESULT; - -// -// Convert portable interlock interfaces to architecture specific interfaces. -// - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(ExInterlockedIncrementLong) // Use InterlockedIncrement -#pragma deprecated(ExInterlockedDecrementLong) // Use InterlockedDecrement -#pragma deprecated(ExInterlockedExchangeUlong) // Use InterlockedExchange -#endif - -#define ExInterlockedIncrementLong(Addend, Lock) \ - ExIa64InterlockedIncrementLong(Addend) - -#define ExInterlockedDecrementLong(Addend, Lock) \ - ExIa64InterlockedDecrementLong(Addend) - -#define ExInterlockedExchangeUlong(Target, Value, Lock) \ - ExIa64InterlockedExchangeUlong(Target, Value) - -NTKERNELAPI -INTERLOCKED_RESULT -ExIa64InterlockedIncrementLong ( - IN PLONG Addend - ); - -NTKERNELAPI -INTERLOCKED_RESULT -ExIa64InterlockedDecrementLong ( - IN PLONG Addend - ); - -NTKERNELAPI -ULONG -ExIa64InterlockedExchangeUlong ( - IN PULONG Target, - IN ULONG Value - ); - -// -// Get address of processor control region. -// - -#define KeGetPcr() PCR - -// -// Get address of current kernel thread object. -// - -#if defined(_M_IA64) -#define KeGetCurrentThread() PCR->CurrentThread -#endif - -#if (NTDDI_VERSION < NTDDI_WIN7) || !defined(NT_PROCESSOR_GROUPS) - -// -// Get current processor number. -// - -#define KeGetCurrentProcessorNumber() ((ULONG)(PCR->LegacyNumber)) - -#endif - -// -// Get data cache fill size. -// - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(KeGetDcacheFillSize) // Use GetDmaAlignment -#endif - -#define KeGetDcacheFillSize() PCR->DcacheFillSize - -// -// Exception frame -// -// This frame is established when handling an exception. It provides a place -// to save all preserved registers. The volatile registers will already -// have been saved in a trap frame. Also used as part of switch frame built -// at thread switch. -// -// The frame is 16-byte aligned to maintain 16-byte alignment for the stack, -// - -typedef struct _KEXCEPTION_FRAME { - - - // Preserved application registers - ULONGLONG ApEC; // epilogue count - ULONGLONG ApLC; // loop count - ULONGLONG IntNats; // Nats for S0-S3; i.e. ar.UNAT after spill - - // Preserved (saved) interger registers, s0-s3 - ULONGLONG IntS0; - ULONGLONG IntS1; - ULONGLONG IntS2; - ULONGLONG IntS3; - - // Preserved (saved) branch registers, bs0-bs4 - ULONGLONG BrS0; - ULONGLONG BrS1; - ULONGLONG BrS2; - ULONGLONG BrS3; - ULONGLONG BrS4; - - // Preserved (saved) floating point registers, f2 - f5, f16 - f31 - FLOAT128 FltS0; - FLOAT128 FltS1; - FLOAT128 FltS2; - FLOAT128 FltS3; - FLOAT128 FltS4; - FLOAT128 FltS5; - FLOAT128 FltS6; - FLOAT128 FltS7; - FLOAT128 FltS8; - FLOAT128 FltS9; - FLOAT128 FltS10; - FLOAT128 FltS11; - FLOAT128 FltS12; - FLOAT128 FltS13; - FLOAT128 FltS14; - FLOAT128 FltS15; - FLOAT128 FltS16; - FLOAT128 FltS17; - FLOAT128 FltS18; - FLOAT128 FltS19; - - -} KEXCEPTION_FRAME, *PKEXCEPTION_FRAME; - -// -// Trap frame -// This frame is established when handling a trap. It provides a place to -// save all volatile registers. The nonvolatile registers are saved in an -// exception frame or through the normal C calling conventions for saved -// registers. Its size must be a multiple of 16 bytes. -// -// N.B - the 16-byte alignment is required to maintain the stack alignment. -// - -#define KTRAP_FRAME_ARGUMENTS (8 * 8) // up to 8 in-memory syscall args - - -typedef struct _KTRAP_FRAME { - - // - // Reserved for additional memory arguments and stack scratch area - // The size of Reserved[] must be a multiple of 16 bytes. - // - - ULONGLONG Reserved[(KTRAP_FRAME_ARGUMENTS+16)/8]; - - // Temporary (volatile) FP registers - f6-f15 (don't use f32+ in kernel) - FLOAT128 FltT0; - FLOAT128 FltT1; - FLOAT128 FltT2; - FLOAT128 FltT3; - FLOAT128 FltT4; - FLOAT128 FltT5; - FLOAT128 FltT6; - FLOAT128 FltT7; - FLOAT128 FltT8; - FLOAT128 FltT9; - - // Temporary (volatile) interger registers - ULONGLONG IntGp; // global pointer (r1) - ULONGLONG IntT0; - ULONGLONG IntT1; - // The following 4 registers fill in space of preserved (S0-S3) to align Nats - ULONGLONG ApUNAT; // ar.UNAT on kernel entry - ULONGLONG ApCCV; // ar.CCV - ULONGLONG SegCSD; // Second register for 16 byte values - ULONGLONG Preds; // Predicates - - ULONGLONG IntV0; // return value (r8) - ULONGLONG IntT2; - ULONGLONG IntT3; - ULONGLONG IntT4; - ULONGLONG IntSp; // stack pointer (r12) - ULONGLONG IntTeb; // teb (r13) - ULONGLONG IntT5; - ULONGLONG IntT6; - ULONGLONG IntT7; - ULONGLONG IntT8; - ULONGLONG IntT9; - ULONGLONG IntT10; - ULONGLONG IntT11; - ULONGLONG IntT12; - ULONGLONG IntT13; - ULONGLONG IntT14; - ULONGLONG IntT15; - ULONGLONG IntT16; - ULONGLONG IntT17; - ULONGLONG IntT18; - ULONGLONG IntT19; - ULONGLONG IntT20; - ULONGLONG IntT21; - ULONGLONG IntT22; - - ULONGLONG IntNats; // Temporary (volatile) registers' Nats directly from ar.UNAT at point of spill - - ULONGLONG BrRp; // Return pointer on kernel entry - - ULONGLONG BrT0; // Temporary (volatile) branch registers (b6-b7) - ULONGLONG BrT1; - - // Register stack info - ULONGLONG RsRSC; // RSC on kernel entry - ULONGLONG RsBSP; // BSP on kernel entry - ULONGLONG RsBSPSTORE; // User BSP Store at point of switch to kernel backing store - ULONGLONG RsRNAT; // old RNAT at point of switch to kernel backing store - ULONGLONG RsPFS; // PFS on kernel entry - - // Trap Status Information - ULONGLONG StIPSR; // Interruption Processor Status Register - ULONGLONG StIIP; // Interruption IP - ULONGLONG StIFS; // Interruption Function State - ULONGLONG StFPSR; // FP status - ULONGLONG StISR; // Interruption Status Register - ULONGLONG StIFA; // Interruption Data Address - ULONGLONG StIIPA; // Last executed bundle address - ULONGLONG StIIM; // Interruption Immediate - ULONGLONG StIHA; // Interruption Hash Address - - ULONG OldIrql; // Previous Irql. - ULONG PreviousMode; // Previous Mode. - ULONGLONG TrapFrame;// Previous Trap Frame - - // - // Exception record - // - UCHAR ExceptionRecord[(sizeof(EXCEPTION_RECORD) + 15) & (~15)]; - - // End of frame marker (for debugging) - - ULONGLONG NewBSP; // NewBSP When a stack switch occur this is the value of the new BSP - ULONGLONG EOFMarker; - - ULONGLONG SegSSD; // IA32 SSDescriptor (Ar26) - -} KTRAP_FRAME, *PKTRAP_FRAME; - -typedef struct _KUMS_CONTEXT_HEADER { - ULONGLONG Scratch[2]; - PVOID StackTop; - ULONGLONG StackSize; - ULONGLONG IntSpOffset; - PVOID BStoreBottom; - ULONGLONG RsBspOffset; - ULONGLONG RsPFS; - ULONGLONG RsRNAT; - ULONGLONG BrRp; - ULONGLONG IntTeb; - -#define KUMS_UCH_VOLATILE_BIT 0 - - union { - struct { - ULONG64 Volatile : 1; - ULONG64 Reserved : 63; - }; - ULONG64 Flags; - }; - PKTRAP_FRAME TrapFrame; - PKEXCEPTION_FRAME ExceptionFrame; - struct _KTHREAD *SourceThread; -} KUMS_CONTEXT_HEADER, *PKUMS_CONTEXT_HEADER; - -// -// OS_MCA, OS_INIT HandOff State definitions -// -// Note: The following definitions *must* match the definions of the -// corresponding SAL Revision Hand-Off structures. -// - -typedef struct _SAL_HANDOFF_STATE { - ULONGLONG PalProcEntryPoint; - ULONGLONG SalProcEntryPoint; - ULONGLONG SalGlobalPointer; - LONGLONG RendezVousResult; - ULONGLONG SalReturnAddress; - ULONGLONG MinStateSavePtr; -} SAL_HANDOFF_STATE, *PSAL_HANDOFF_STATE; - -typedef struct _OS_HANDOFF_STATE { - ULONGLONG Result; - ULONGLONG SalGlobalPointer; - ULONGLONG MinStateSavePtr; - ULONGLONG SalReturnAddress; - ULONGLONG NewContextFlag; -} OS_HANDOFF_STATE, *POS_HANDOFF_STATE; - -// -// per processor OS_MCA and OS_INIT resource structure -// - - -#define SER_EVENT_STACK_FRAME_ENTRIES 8 - -typedef struct _SAL_EVENT_RESOURCES { - - SAL_HANDOFF_STATE SalToOsHandOff; - OS_HANDOFF_STATE OsToSalHandOff; - PVOID StateDump; - ULONGLONG StateDumpPhysical; - PVOID BackStore; - ULONGLONG BackStoreLimit; - PVOID Stack; - ULONGLONG StackLimit; - PULONGLONG PTOM; - ULONGLONG StackFrame[SER_EVENT_STACK_FRAME_ENTRIES]; - PVOID EventPool; - ULONG EventPoolSize; - PVOID ErrorSummarySection; - ULONGLONG PoisonPageAddress; -} SAL_EVENT_RESOURCES, *PSAL_EVENT_RESOURCES; - -// -// Define Processor Control Region Structure. -// - -#define PCR_MINOR_VERSION 1 -#define PCR_MAJOR_VERSION 1 - -typedef struct _KPCR { - -// -// Major and minor version numbers of the PCR. -// - ULONG MinorVersion; - ULONG MajorVersion; - -// -// Start of the architecturally defined section of the PCR. This section -// may be directly addressed by vendor/platform specific HAL code and will -// not change from version to version of NT. -// - -// -// First and second level cache parameters. -// - - ULONG FirstLevelDcacheSize; - ULONG FirstLevelDcacheFillSize; - ULONG FirstLevelIcacheSize; - ULONG FirstLevelIcacheFillSize; - ULONG SecondLevelDcacheSize; - ULONG SecondLevelDcacheFillSize; - ULONG SecondLevelIcacheSize; - ULONG SecondLevelIcacheFillSize; - -// -// Data cache alignment and fill size used for cache flushing and alignment. -// These fields are set to the larger of the first and second level data -// cache fill sizes. -// - - ULONG DcacheAlignment; - ULONG DcacheFillSize; - -// -// Instruction cache alignment and fill size used for cache flushing and -// alignment. These fields are set to the larger of the first and second -// level data cache fill sizes. -// - - ULONG IcacheAlignment; - ULONG IcacheFillSize; - -// -// Processor identification from PrId register. -// - - ULONG ProcessorId; - -// -// Profiling data. -// - - ULONG ProfileInterval; - ULONG ProfileCount; - -// -// Stall execution count and scale factor. -// - - ULONG StallExecutionCount; - ULONG StallScaleFactor; - - ULONG InterruptionCount; - -// -// Space reserved for the system. -// - - ULONGLONG SystemReserved[6]; - -// -// Space reserved for the HAL -// - - ULONGLONG HalReserved[64]; - -// -// IRQL mapping tables. -// - - UCHAR IrqlMask[64]; - UCHAR IrqlTable[64]; - -// -// External Interrupt vectors. -// - - PKINTERRUPT_ROUTINE InterruptRoutine[MAXIMUM_VECTOR]; - -// -// Reserved interrupt vector mask. -// - - ULONG ReservedVectors; - -// -// Group relative processor affinity mask. -// - - KAFFINITY GroupSetMember; - -// -// Complement of the group relative processor affinity mask. -// - - KAFFINITY NotGroupMember; - -// -// Pointer to processor control block. -// - - struct _KPRCB *Prcb; - -// -// Shadow copy of Prcb->CurrentThread for fast access -// - - struct _KTHREAD *CurrentThread; - -// -// Processor number. -// - - CCHAR LegacyNumber; // Legacy Processor Number. - CCHAR Pad1[3]; - ULONG Number; // Processor Number. - - - - CCHAR Pad2; - CCHAR PollSlot; // Used by the clock routine track when we should break in. - UCHAR KernelDebugActive; // debug register active in kernel flag - UCHAR CurrentIrql; // Current IRQL - union { - USHORT SoftwareInterruptPending; // Software Interrupt Pending Flag - struct { - UCHAR ApcInterrupt; // 0x01 if APC int pending - UCHAR DispatchInterrupt; // 0x01 if dispatch int pending - }; - }; - -// -// Address of per processor SAPIC EOI Table -// - - PVOID EOITable; - -// -// IA-64 Machine Check Events trackers -// - - UCHAR InOsMca; - UCHAR InOsInit; - UCHAR InOsCmc; - UCHAR InOsCpe; - ULONG InOsULONG_Spare; // Spare ULONG - PSAL_EVENT_RESOURCES OsMcaResourcePtr; - PSAL_EVENT_RESOURCES OsInitResourcePtr; - - UCHAR AlternateStack; - UCHAR Pad[7]; - -// -// End of the architecturally defined section of the PCR. This section -// may be directly addressed by vendor/platform specific HAL code and will -// not change from version to version of NT. -// - - -} KPCR, *PKPCR; - - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_savesIRQL -__drv_setsIRQL(DISPATCH_LEVEL) -NTKERNELAPI -KIRQL -KeRaiseIrqlToDpcLevel ( - VOID - ); - -NTKERNELAPI -KIRQL -KeRaiseIrqlToSynchLevel ( - VOID - ); - - -// -// The highest user address reserves 64K bytes for a guard page. This -// the probing of address from kernel mode to only have to check the -// starting address for structures of 64k bytes or less. -// - -extern NTKERNELAPI PVOID MmHighestUserAddress; -extern NTKERNELAPI PVOID MmSystemRangeStart; -extern NTKERNELAPI ULONG_PTR MmUserProbeAddress; - - -#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress -#define MM_USER_PROBE_ADDRESS MmUserProbeAddress -#define MM_SYSTEM_RANGE_START MmSystemRangeStart - -#define MM_KSEG0_BASE 0xE000000080000000UI64 -#define MM_SYSTEM_SPACE_END (KADDRESS_BASE + 0x70000000000UI64) - -// -// The lowest user address reserves the low 64k. -// - -#define MM_LOWEST_USER_ADDRESS (PVOID)((ULONG_PTR)(UADDRESS_BASE+0x00010000)) - -#endif // defined(_IA64_) - -// -// Firmware Table provider definitions -// - -typedef enum _SYSTEM_FIRMWARE_TABLE_ACTION { - SystemFirmwareTable_Enumerate, - SystemFirmwareTable_Get -} SYSTEM_FIRMWARE_TABLE_ACTION; - -typedef struct _SYSTEM_FIRMWARE_TABLE_INFORMATION { - ULONG ProviderSignature; - SYSTEM_FIRMWARE_TABLE_ACTION Action; - ULONG TableID; - ULONG TableBufferLength; - UCHAR TableBuffer[ANYSIZE_ARRAY]; -} SYSTEM_FIRMWARE_TABLE_INFORMATION, *PSYSTEM_FIRMWARE_TABLE_INFORMATION; - -typedef -NTSTATUS -(__cdecl *PFNFTH) ( - __inout PSYSTEM_FIRMWARE_TABLE_INFORMATION SystemFirmwareTableInfo - ); - -typedef struct _SYSTEM_FIRMWARE_TABLE_HANDLER { - ULONG ProviderSignature; - BOOLEAN Register; - PFNFTH FirmwareTableHandler; - PVOID DriverObject; -} SYSTEM_FIRMWARE_TABLE_HANDLER, *PSYSTEM_FIRMWARE_TABLE_HANDLER; - - -// -// Timer APC routine definition. -// - -typedef -VOID -(*PTIMER_APC_ROUTINE) ( - __in PVOID TimerContext, - __in ULONG TimerLowValue, - __in LONG TimerHighValue - ); - -// -// Data structures used by NtSetTimerEx -// - -typedef enum _TIMER_SET_INFORMATION_CLASS { - TimerSetCoalescableTimer, - MaxTimerInfoClass // MaxTimerInfoClass should always be the last enum -} TIMER_SET_INFORMATION_CLASS; - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -typedef struct _TIMER_SET_COALESCABLE_TIMER_INFO { - __in LARGE_INTEGER DueTime; - __in_opt PTIMER_APC_ROUTINE TimerApcRoutine; - __in_opt PVOID TimerContext; - __in_opt struct _COUNTED_REASON_CONTEXT *WakeContext; - __in_opt ULONG Period; - __in ULONG TolerableDelay; - __out_opt PBOOLEAN PreviousState; -} TIMER_SET_COALESCABLE_TIMER_INFO, *PTIMER_SET_COALESCABLE_TIMER_INFO; - -#endif // (NTDDI_VERSION >= NTDDI_WIN7) - - -// -// Driver Verifier Definitions -// - -typedef -ULONG_PTR -(*PDRIVER_VERIFIER_THUNK_ROUTINE) ( - __in PVOID Context - ); - -// -// This structure is passed in by drivers that want to thunk callers of -// their exports. -// - -typedef struct _DRIVER_VERIFIER_THUNK_PAIRS { - PDRIVER_VERIFIER_THUNK_ROUTINE PristineRoutine; - PDRIVER_VERIFIER_THUNK_ROUTINE NewRoutine; -} DRIVER_VERIFIER_THUNK_PAIRS, *PDRIVER_VERIFIER_THUNK_PAIRS; - -// -// Driver Verifier flags. -// - -#define DRIVER_VERIFIER_SPECIAL_POOLING 0x0001 -#define DRIVER_VERIFIER_FORCE_IRQL_CHECKING 0x0002 -#define DRIVER_VERIFIER_INJECT_ALLOCATION_FAILURES 0x0004 -#define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS 0x0008 -#define DRIVER_VERIFIER_IO_CHECKING 0x0010 - - -// -// Known extended CPU state feature IDs -// - -#define XSTATE_LEGACY_FLOATING_POINT 0 -#define XSTATE_LEGACY_SSE 1 -#define XSTATE_GSSE 2 - -#define XSTATE_MASK_LEGACY_FLOATING_POINT (1i64 << (XSTATE_LEGACY_FLOATING_POINT)) -#define XSTATE_MASK_LEGACY_SSE (1i64 << (XSTATE_LEGACY_SSE)) -#define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE) -#define XSTATE_MASK_GSSE (1i64 << (XSTATE_GSSE)) - -#define MAXIMUM_XSTATE_FEATURES 64 - -// -// Extended processor state configuration -// - -typedef struct _XSTATE_FEATURE { - ULONG Offset; - ULONG Size; -} XSTATE_FEATURE, *PXSTATE_FEATURE; - -typedef struct _XSTATE_CONFIGURATION { - // Mask of enabled features - ULONG64 EnabledFeatures; - - // Total size of the save area - ULONG Size; - - ULONG OptimizedSave : 1; - - // List of features ( - XSTATE_FEATURE Features[MAXIMUM_XSTATE_FEATURES]; - -} XSTATE_CONFIGURATION, *PXSTATE_CONFIGURATION; - - -// -// Define data shared between kernel and user mode. -// -// N.B. User mode has read only access to this data -// - -#ifdef _MAC -#pragma warning( disable : 4121) -#endif - -#define MAX_WOW64_SHARED_ENTRIES 16 - -// -// WARNING: This structure must have exactly the same layout for 32- and -// 64-bit systems. The layout of this structure cannot change and new -// fields can only be added at the end of the structure (unless a gap -// can be exploited). Deprecated fields cannot be deleted. Platform -// specific fields are included on all systems. -// -// Layout exactness is required for Wow64 support of 32-bit applications -// on Win64 systems. -// -// The layout itself cannot change since this structure has been exported -// in ntddk, ntifs.h, and nthal.h for some time. -// -// Define NX support policy values. -// - -#define NX_SUPPORT_POLICY_ALWAYSOFF 0 -#define NX_SUPPORT_POLICY_ALWAYSON 1 -#define NX_SUPPORT_POLICY_OPTIN 2 -#define NX_SUPPORT_POLICY_OPTOUT 3 - -// -// Global shared data flags and manipulation macros. -// - -#define SHARED_GLOBAL_FLAGS_ERROR_PORT_V 0x0 -#define SHARED_GLOBAL_FLAGS_ERROR_PORT (1UL << SHARED_GLOBAL_FLAGS_ERROR_PORT_V) - -#define SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED_V 0x1 -#define SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED (1UL << SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED_V) - -#define SHARED_GLOBAL_FLAGS_VIRT_ENABLED_V 0x2 -#define SHARED_GLOBAL_FLAGS_VIRT_ENABLED (1UL << SHARED_GLOBAL_FLAGS_VIRT_ENABLED_V) - -#define SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED_V 0x3 -#define SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED \ - (1UL << SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED_V) - -#define SHARED_GLOBAL_FLAGS_SPARE_V 0x4 -#define SHARED_GLOBAL_FLAGS_SPARE \ - (1UL << SHARED_GLOBAL_FLAGS_SPARE_V) - -#define SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED_V 0x5 -#define SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED \ - (1UL << SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED_V) - -#define SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED_V 0x6 -#define SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED \ - (1UL << SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED_V) - -#define EX_INIT_BITS(Flags, Bit) \ - *((Flags)) |= (Bit) // Safe to use before concurrently accessible - -#define EX_TEST_SET_BIT(Flags, Bit) \ - InterlockedBitTestAndSet ((PLONG)(Flags), (Bit)) - -#define EX_TEST_CLEAR_BIT(Flags, Bit) \ - InterlockedBitTestAndReset ((PLONG)(Flags), (Bit)) - -typedef struct _KUSER_SHARED_DATA { - - // - // Current low 32-bit of tick count and tick count multiplier. - // - // N.B. The tick count is updated each time the clock ticks. - // - - ULONG TickCountLowDeprecated; - ULONG TickCountMultiplier; - - // - // Current 64-bit interrupt time in 100ns units. - // - - volatile KSYSTEM_TIME InterruptTime; - - // - // Current 64-bit system time in 100ns units. - // - - volatile KSYSTEM_TIME SystemTime; - - // - // Current 64-bit time zone bias. - // - - volatile KSYSTEM_TIME TimeZoneBias; - - // - // Support image magic number range for the host system. - // - // N.B. This is an inclusive range. - // - - USHORT ImageNumberLow; - USHORT ImageNumberHigh; - - // - // Copy of system root in unicode. - // - - WCHAR NtSystemRoot[260]; - - // - // Maximum stack trace depth if tracing enabled. - // - - ULONG MaxStackTraceDepth; - - // - // Crypto exponent value. - // - - ULONG CryptoExponent; - - // - // Time zone ID. - // - - ULONG TimeZoneId; - ULONG LargePageMinimum; - ULONG Reserved2[7]; - - // - // Product type. - // - - NT_PRODUCT_TYPE NtProductType; - BOOLEAN ProductTypeIsValid; - - // - // three bytes of padding here -- offsets 0x269, 0x26A, 0x26B - // - - // - // The NT Version. - // - // N. B. Note that each process sees a version from its PEB, but if the - // process is running with an altered view of the system version, - // the following two fields are used to correctly identify the - // version - // - - ULONG NtMajorVersion; - ULONG NtMinorVersion; - - // - // Processor features. - // - - BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX]; - - // - // Reserved fields - do not use. - // - - ULONG Reserved1; - ULONG Reserved3; - - // - // Time slippage while in debugger. - // - - volatile ULONG TimeSlip; - - // - // Alternative system architecture, e.g., NEC PC98xx on x86. - // - - ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture; - - // - // four bytes of padding here -- offsets 0x2c4, 0x2c5, 0x2c6, 0x2c7 - // - - ULONG AltArchitecturePad[1]; - - // - // If the system is an evaluation unit, the following field contains the - // date and time that the evaluation unit expires. A value of 0 indicates - // that there is no expiration. A non-zero value is the UTC absolute time - // that the system expires. - // - - LARGE_INTEGER SystemExpirationDate; - - // - // Suite support. - // - - ULONG SuiteMask; - - // - // TRUE if a kernel debugger is connected/enabled. - // - - BOOLEAN KdDebuggerEnabled; - - // - // NX support policy. - // - - UCHAR NXSupportPolicy; - - // - // two bytes of padding here -- offsets 0x2d6, 0x2d7 - // - - // - // Current console session Id. Always zero on non-TS systems. - // - - volatile ULONG ActiveConsoleId; - - // - // Force-dismounts cause handles to become invalid. Rather than always - // probe handles, a serial number of dismounts is maintained that clients - // can use to see if they need to probe handles. - // - - volatile ULONG DismountCount; - - // - // This field indicates the status of the 64-bit COM+ package on the - // system. It indicates whether the Itermediate Language (IL) COM+ - // images need to use the 64-bit COM+ runtime or the 32-bit COM+ runtime. - // - - ULONG ComPlusPackage; - - // - // Time in tick count for system-wide last user input across all terminal - // sessions. For MP performance, it is not updated all the time (e.g. once - // a minute per session). It is used for idle detection. - // - - ULONG LastSystemRITEventTickCount; - - // - // Number of physical pages in the system. This can dynamically change as - // physical memory can be added or removed from a running system. - // - - ULONG NumberOfPhysicalPages; - - // - // True if the system was booted in safe boot mode. - // - - BOOLEAN SafeBootMode; - - // - // The following byte is consumed by the user-mode performance counter - // routines to improve latency when the source is the processor's cycle - // counter. - // - - union { - UCHAR TscQpcData; - struct { - UCHAR TscQpcEnabled : 1; - UCHAR TscQpcSpareFlag : 1; - UCHAR TscQpcShift : 6; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; - - // - // two bytes of padding here -- offsets 0x2ee, 0x2ef - // - - UCHAR TscQpcPad[2]; - -#if 0 // pre-Vista - ULONG TraceLogging; -#endif - - // - // This is a packed bitfield that contains various flags concerning - // the system state. They must be manipulated using interlocked - // operations. - // - - union { - ULONG SharedDataFlags; - struct { - - // - // The following bit fields are for the debugger only. Do not use. - // Use the bit definitions instead. - // - - ULONG DbgErrorPortPresent : 1; - ULONG DbgElevationEnabled : 1; - ULONG DbgVirtEnabled : 1; - ULONG DbgInstallerDetectEnabled : 1; - ULONG DbgSystemDllRelocated : 1; - ULONG DbgDynProcessorEnabled : 1; - ULONG DbgSEHValidationEnabled : 1; - ULONG SpareBits : 25; - } DUMMYSTRUCTNAME2; - } DUMMYUNIONNAME2; - - ULONG DataFlagsPad[1]; - - // - // Depending on the processor, the code for fast system call will differ, - // Stub code is provided pointers below to access the appropriate code. - // - // N.B. The following two fields are only used on 32-bit systems. - // - - ULONGLONG TestRetInstruction; - ULONG SystemCall; - ULONG SystemCallReturn; - ULONGLONG SystemCallPad[3]; - - // - // The 64-bit tick count. - // - - union { - volatile KSYSTEM_TIME TickCount; - volatile ULONG64 TickCountQuad; - struct { - ULONG ReservedTickCountOverlay[3]; - ULONG TickCountPad[1]; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME3; - - // - // Cookie for encoding pointers system wide. - // - - ULONG Cookie; - ULONG CookiePad[1]; - - // - // Client id of the process having the focus in the current - // active console session id. - // - - LONGLONG ConsoleSessionForegroundProcessId; - - // - // Shared information for Wow64 processes. - // - - ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES]; - - // - // The following field is used for ETW user mode global logging - // (UMGL). - // - - USHORT UserModeGlobalLogger[16]; - - // - // Settings that can enable the use of Image File Execution Options - // from HKCU in addition to the original HKLM. - // - - ULONG ImageFileExecutionOptions; - -#if 0 - // - // pre-Vista Service Pack 1, four bytes of padding here -- offsets 0x3a4, 0x3a5, 0x3a6, 0x3a7 - // - -#else - // - // Generation of the kernel structure holding system language information - // - ULONG LangGenerationCount; -#endif - - // - // Reserved. - // - - ULONGLONG Reserved5; - - // - // Current 64-bit interrupt time bias in 100ns units. - // - - volatile ULONG64 InterruptTimeBias; - - // - // Current 64-bit performance counter bias in processor cycles. - // - - volatile ULONG64 TscQpcBias; - - // - // Number of active processors and groups. - // - - volatile ULONG ActiveProcessorCount; - volatile USHORT ActiveGroupCount; - USHORT Reserved4; - - // - // This value controls the AIT Sampling rate. - // - - volatile ULONG AitSamplingValue; - volatile ULONG AppCompatFlag; - - // - // Relocation diff for ntdll (native and wow64). - // - - ULONGLONG SystemDllNativeRelocation; - ULONG SystemDllWowRelocation; - - // - // Extended processor state configuration - // - - ULONG XStatePad[1]; - XSTATE_CONFIGURATION XState; - -} KUSER_SHARED_DATA, *PKUSER_SHARED_DATA; - -// -// Mostly enforce earlier comment about the stability and -// architecture-neutrality of this struct. -// - -#if !defined(__midl) && !defined(MIDL_PASS) - -// -// The overall size can change, but it must be the same for all architectures. -// - -C_ASSERT(sizeof(KUSER_SHARED_DATA) == 0x5F0); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, TickCountLowDeprecated) == 0x0); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, TickCountMultiplier) == 0x4); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, InterruptTime) == 0x08); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SystemTime) == 0x014); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, TimeZoneBias) == 0x020); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, ImageNumberLow) == 0x02c); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, ImageNumberHigh) == 0x02e); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, NtSystemRoot) == 0x030); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, MaxStackTraceDepth) == 0x238); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, CryptoExponent) == 0x23c); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, TimeZoneId) == 0x240); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, LargePageMinimum) == 0x244); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, Reserved2) == 0x248); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, NtProductType) == 0x264); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, ProductTypeIsValid) == 0x268); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, NtMajorVersion) == 0x26c); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, NtMinorVersion) == 0x270); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, ProcessorFeatures) == 0x274); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, Reserved1) == 0x2b4); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, Reserved3) == 0x2b8); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, TimeSlip) == 0x2bc); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, AlternativeArchitecture) == 0x2c0); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SystemExpirationDate) == 0x2c8); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SuiteMask) == 0x2d0); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, KdDebuggerEnabled) == 0x2d4); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, NXSupportPolicy) == 0x2d5); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, ActiveConsoleId) == 0x2d8); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, DismountCount) == 0x2dc); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, ComPlusPackage) == 0x2e0); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, LastSystemRITEventTickCount) == 0x2e4); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, NumberOfPhysicalPages) == 0x2e8); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SafeBootMode) == 0x2ec); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, TscQpcData) == 0x2ed); - -C_ASSERT(__alignof(KSYSTEM_TIME) == 4); - -#if 0 // pre-Vista - -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, TraceLogging) == 0x2f0); - -#else - -#if defined(_MSC_EXTENSIONS) - -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SharedDataFlags) == 0x2f0); - -#endif - -#endif - -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, TestRetInstruction) == 0x2f8); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SystemCall) == 0x300); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SystemCallReturn) == 0x304); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SystemCallPad) == 0x308); - -#if defined(_MSC_EXTENSIONS) - -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, TickCount) == 0x320); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, TickCountQuad) == 0x320); - -#endif - -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, Cookie) == 0x330); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, ConsoleSessionForegroundProcessId) == 0x338); - -#if 0 // pre-Vista - -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, Wow64SharedInformation) == 0x334); - -#else - -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, Wow64SharedInformation) == 0x340); - -#endif - -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, UserModeGlobalLogger) == 0x380); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, ImageFileExecutionOptions) == 0x3a0); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, LangGenerationCount) == 0x3a4); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, InterruptTimeBias) == 0x3b0); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, UserModeGlobalLogger) == 0x380); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, ImageFileExecutionOptions) == 0x3a0); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, LangGenerationCount) == 0x3a4); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, Reserved5) == 0x3a8); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, InterruptTimeBias) == 0x3b0); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, TscQpcBias) == 0x3b8); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, ActiveProcessorCount) == 0x3c0); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, ActiveGroupCount) == 0x3c4); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, Reserved4) == 0x3c6); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, AitSamplingValue) == 0x3c8); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, AppCompatFlag) == 0x3cc); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SystemDllNativeRelocation) == 0x3d0); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SystemDllWowRelocation) == 0x3d8); -C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, XState) == 0x3e0); - -#endif /* __midl | MIDL_PASS */ - -#ifdef _MAC -#pragma warning(default:4121) -#endif - -#define CmResourceTypeMaximum 8 -// -// Declaration of the structure for the PcCard ISA IRQ map -// - -typedef struct _CM_PCCARD_DEVICE_DATA { - UCHAR Flags; - UCHAR ErrorCode; - USHORT Reserved; - ULONG BusData; - ULONG DeviceId; - ULONG LegacyBaseAddress; - UCHAR IRQMap[16]; -} CM_PCCARD_DEVICE_DATA, *PCM_PCCARD_DEVICE_DATA; - -// Definitions for Flags - -#define PCCARD_MAP_ERROR 0x01 -#define PCCARD_DEVICE_PCI 0x10 - -#define PCCARD_SCAN_DISABLED 0x01 -#define PCCARD_MAP_ZERO 0x02 -#define PCCARD_NO_TIMER 0x03 -#define PCCARD_NO_PIC 0x04 -#define PCCARD_NO_LEGACY_BASE 0x05 -#define PCCARD_DUP_LEGACY_BASE 0x06 -#define PCCARD_NO_CONTROLLERS 0x07 - -#ifndef _ARC_DDK_ -#define _ARC_DDK_ - -// -// Define configuration routine types. -// -// Configuration information. -// - -typedef enum _CONFIGURATION_TYPE { - ArcSystem, - CentralProcessor, - FloatingPointProcessor, - PrimaryIcache, - PrimaryDcache, - SecondaryIcache, - SecondaryDcache, - SecondaryCache, - EisaAdapter, - TcAdapter, - ScsiAdapter, - DtiAdapter, - MultiFunctionAdapter, - DiskController, - TapeController, - CdromController, - WormController, - SerialController, - NetworkController, - DisplayController, - ParallelController, - PointerController, - KeyboardController, - AudioController, - OtherController, - DiskPeripheral, - FloppyDiskPeripheral, - TapePeripheral, - ModemPeripheral, - MonitorPeripheral, - PrinterPeripheral, - PointerPeripheral, - KeyboardPeripheral, - TerminalPeripheral, - OtherPeripheral, - LinePeripheral, - NetworkPeripheral, - SystemMemory, - DockingInformation, - RealModeIrqRoutingTable, - RealModePCIEnumeration, - MaximumType -} CONFIGURATION_TYPE, *PCONFIGURATION_TYPE; - -#endif // _ARC_DDK_ - -// -// Several routines have an architecture specific implementation. Generate -// an error if a supported target is not defined. -// - -#if !(defined(_X86_) || defined(_AMD64_) || defined(_IA64_)) - -#error "No target architecture defined" - -#endif - -#if (NTDDI_VERSION < NTDDI_WIN7) || defined(_X86_) || !defined(NT_PROCESSOR_GROUPS) - -#define SINGLE_GROUP_LEGACY_API 1 - -#endif - - -// - -#if defined(_X86_) || defined(_AMD64_) - -#define PAUSE_PROCESSOR YieldProcessor(); - -#elif defined(_IA64_) - -#define PAUSE_PROCESSOR __yield(); - -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -KeSetImportanceDpc ( - __inout PRKDPC Dpc, - __in KDPC_IMPORTANCE Importance - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) && defined(SINGLE_GROUP_LEGACY_API) -NTKERNELAPI -VOID -KeSetTargetProcessorDpc ( - __inout PRKDPC Dpc, - __in CCHAR Number - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG -KePulseEvent ( - __inout PRKEVENT Event, - __in KPRIORITY Increment, - __in BOOLEAN Wait - ); -#endif - - - -#define MAXIMUM_EXPANSION_SIZE (KERNEL_LARGE_STACK_SIZE - (PAGE_SIZE / 2)) - -typedef -__drv_sameIRQL -__drv_functionClass(EXPAND_STACK_CALLOUT) -VOID -(NTAPI EXPAND_STACK_CALLOUT) ( - __in_opt PVOID Parameter - ); - -typedef EXPAND_STACK_CALLOUT *PEXPAND_STACK_CALLOUT; - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_reportError("DISPATCH_LEVEL is only supported on Windows 7 or later.") -NTKERNELAPI -NTSTATUS -KeExpandKernelStackAndCallout ( - __in PEXPAND_STACK_CALLOUT Callout, - __in_opt PVOID Parameter, - __in SIZE_T Size - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG -KeSetBasePriorityThread ( - __inout PKTHREAD Thread, - __in LONG Increment - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_neverHoldCriticalRegion -__drv_acquiresCriticalRegion -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeEnterCriticalRegion ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_mustHoldCriticalRegion -__drv_releasesCriticalRegion -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeLeaveCriticalRegion ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_neverHoldCriticalRegion -__drv_acquiresCriticalRegion -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeEnterGuardedRegion ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_mustHoldCriticalRegion -__drv_releasesCriticalRegion -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeLeaveGuardedRegion ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -KeAreApcsDisabled ( - VOID - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_preferredFunction("error logging or driver shutdown", - "Whenever possible, all kernel-mode components should log an error and " - "continue to run, rather than calling KeBugCheck") -NTKERNELAPI -DECLSPEC_NORETURN -VOID -NTAPI -KeBugCheck ( - __in ULONG BugCheckCode - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -KeInvalidateAllCaches ( - VOID - ); -#endif - -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -FASTCALL -KeInvalidateRangeAllCaches ( - __in PVOID BaseAddress, - __in ULONG Length - ); - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) && defined(SINGLE_GROUP_LEGACY_API) -NTKERNELAPI -KAFFINITY -KeQueryActiveProcessors ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) && defined(SINGLE_GROUP_LEGACY_API) -NTKERNELAPI -ULONG -KeQueryActiveProcessorCount ( - __out_opt PKAFFINITY ActiveProcessors - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -ULONG -KeQueryActiveProcessorCountEx ( - __in USHORT GroupNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_LONGHORN) && defined(SINGLE_GROUP_LEGACY_API) -NTKERNELAPI -ULONG -KeQueryMaximumProcessorCount ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -ULONG -KeQueryMaximumProcessorCountEx ( - __in USHORT GroupNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -USHORT -KeQueryActiveGroupCount ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -USHORT -KeQueryMaximumGroupCount ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -KAFFINITY -KeQueryGroupAffinity ( - __in USHORT GroupNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -ULONG -KeGetCurrentProcessorNumberEx ( - __out_opt PPROCESSOR_NUMBER ProcNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -VOID -KeQueryNodeActiveAffinity ( - __in USHORT NodeNumber, - __out_opt PGROUP_AFFINITY Affinity, - __out_opt PUSHORT Count - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -USHORT -KeQueryNodeMaximumProcessorCount ( - __in USHORT NodeNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -USHORT -KeQueryHighestNodeNumber ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -USHORT -KeGetCurrentNodeNumber ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -KeQueryLogicalProcessorRelationship ( - __in_opt PPROCESSOR_NUMBER ProcessorNumber, - __in LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType, - __out_bcount_opt(*Length) PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Information, - __inout PULONG Length - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -KeSetHardwareCounterConfiguration ( - __in_ecount(Count) PHARDWARE_COUNTER CounterArray, - __in ULONG Count - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -KeQueryHardwareCounterConfiguration ( - __out_ecount_part(MaximumCount, *Count) PHARDWARE_COUNTER CounterArray, - __in ULONG MaximumCount, - __out PULONG Count - ); -#endif - - -#if defined(POOL_TAGGING) -#define ExFreePool(a) ExFreePoolWithTag(a,0) -#endif - -// -// If high order bit in Pool tag is set, then must use ExFreePoolWithTag to free -// - -#define PROTECTED_POOL 0x80000000 - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -DECLSPEC_NORETURN -VOID -ExRaiseDatatypeMisalignment ( - VOID - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -DECLSPEC_NORETURN -VOID -ExRaiseAccessViolation ( - VOID - ); - -#endif - - -// -// Zone Allocation -// - -typedef struct _ZONE_SEGMENT_HEADER { - SINGLE_LIST_ENTRY SegmentList; - PVOID Reserved; -} ZONE_SEGMENT_HEADER, *PZONE_SEGMENT_HEADER; - -typedef struct _ZONE_HEADER { - SINGLE_LIST_ENTRY FreeList; - SINGLE_LIST_ENTRY SegmentList; - ULONG BlockSize; - ULONG TotalSegmentSize; -} ZONE_HEADER, *PZONE_HEADER; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_preferredFunction("lookaside lists instead", "Obsolete") -DECLSPEC_DEPRECATED_DDK -NTKERNELAPI -NTSTATUS -ExInitializeZone( - __out PZONE_HEADER Zone, - __in ULONG BlockSize, - __inout PVOID InitialSegment, - __in ULONG InitialSegmentSize - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_preferredFunction("lookaside lists instead", "Obsolete") -DECLSPEC_DEPRECATED_DDK -NTKERNELAPI -NTSTATUS -ExExtendZone( - __inout PZONE_HEADER Zone, - __inout PVOID Segment, - __in ULONG SegmentSize - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_preferredFunction("lookaside lists instead", "Obsolete") -DECLSPEC_DEPRECATED_DDK -NTKERNELAPI -NTSTATUS -ExInterlockedExtendZone( - __inout PZONE_HEADER Zone, - __inout PVOID Segment, - __in ULONG SegmentSize, - __inout __deref __drv_neverHold(KeSpinLockType) PKSPIN_LOCK Lock - ); - -#endif - -//++ -// -// PVOID -// ExAllocateFromZone( -// IN PZONE_HEADER Zone -// ) -// -// Routine Description: -// -// This routine removes an entry from the zone and returns a pointer to it. -// -// Arguments: -// -// Zone - Pointer to the zone header controlling the storage from which the -// entry is to be allocated. -// -// Return Value: -// -// The function value is a pointer to the storage allocated from the zone. -// -//-- - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(ExAllocateFromZone) -#endif - -#define ExAllocateFromZone(Zone) \ - (PVOID)((Zone)->FreeList.Next); \ - if ( (Zone)->FreeList.Next ) (Zone)->FreeList.Next = (Zone)->FreeList.Next->Next - -//++ -// -// PVOID -// ExFreeToZone( -// IN PZONE_HEADER Zone, -// IN PVOID Block -// ) -// -// Routine Description: -// -// This routine places the specified block of storage back onto the free -// list in the specified zone. -// -// Arguments: -// -// Zone - Pointer to the zone header controlling the storage to which the -// entry is to be inserted. -// -// Block - Pointer to the block of storage to be freed back to the zone. -// -// Return Value: -// -// Pointer to previous block of storage that was at the head of the free -// list. NULL implies the zone went from no available free blocks to -// at least one free block. -// -//-- - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(ExFreeToZone) -#endif - -#define ExFreeToZone(Zone,Block) \ - ( ((PSINGLE_LIST_ENTRY)(Block))->Next = (Zone)->FreeList.Next, \ - (Zone)->FreeList.Next = ((PSINGLE_LIST_ENTRY)(Block)), \ - ((PSINGLE_LIST_ENTRY)(Block))->Next \ - ) - -//++ -// -// BOOLEAN -// ExIsFullZone( -// IN PZONE_HEADER Zone -// ) -// -// Routine Description: -// -// This routine determines if the specified zone is full or not. A zone -// is considered full if the free list is empty. -// -// Arguments: -// -// Zone - Pointer to the zone header to be tested. -// -// Return Value: -// -// TRUE if the zone is full and FALSE otherwise. -// -//-- - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(ExIsFullZone) -#endif - -#define ExIsFullZone(Zone) \ - ( (Zone)->FreeList.Next == (PSINGLE_LIST_ENTRY)NULL ) - -//++ -// -// PVOID -// ExInterlockedAllocateFromZone( -// IN PZONE_HEADER Zone, -// IN PKSPIN_LOCK Lock -// ) -// -// Routine Description: -// -// This routine removes an entry from the zone and returns a pointer to it. -// The removal is performed with the specified lock owned for the sequence -// to make it MP-safe. -// -// Arguments: -// -// Zone - Pointer to the zone header controlling the storage from which the -// entry is to be allocated. -// -// Lock - Pointer to the spin lock which should be obtained before removing -// the entry from the allocation list. The lock is released before -// returning to the caller. -// -// Return Value: -// -// The function value is a pointer to the storage allocated from the zone. -// -//-- - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(ExInterlockedAllocateFromZone) -#endif - -#define ExInterlockedAllocateFromZone(Zone,Lock) \ - (PVOID) ExInterlockedPopEntryList( &(Zone)->FreeList, Lock ) - -//++ -// -// PVOID -// ExInterlockedFreeToZone( -// IN PZONE_HEADER Zone, -// IN PVOID Block, -// IN PKSPIN_LOCK Lock -// ) -// -// Routine Description: -// -// This routine places the specified block of storage back onto the free -// list in the specified zone. The insertion is performed with the lock -// owned for the sequence to make it MP-safe. -// -// Arguments: -// -// Zone - Pointer to the zone header controlling the storage to which the -// entry is to be inserted. -// -// Block - Pointer to the block of storage to be freed back to the zone. -// -// Lock - Pointer to the spin lock which should be obtained before inserting -// the entry onto the free list. The lock is released before returning -// to the caller. -// -// Return Value: -// -// Pointer to previous block of storage that was at the head of the free -// list. NULL implies the zone went from no available free blocks to -// at least one free block. -// -//-- - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(ExInterlockedFreeToZone) -#endif - -#define ExInterlockedFreeToZone(Zone,Block,Lock) \ - ExInterlockedPushEntryList( &(Zone)->FreeList, ((PSINGLE_LIST_ENTRY) (Block)), Lock ) - - -//++ -// -// BOOLEAN -// ExIsObjectInFirstZoneSegment( -// IN PZONE_HEADER Zone, -// IN PVOID Object -// ) -// -// Routine Description: -// -// This routine determines if the specified pointer lives in the zone. -// -// Arguments: -// -// Zone - Pointer to the zone header controlling the storage to which the -// object may belong. -// -// Object - Pointer to the object in question. -// -// Return Value: -// -// TRUE if the Object came from the first segment of zone. -// -//-- - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(ExIsObjectInFirstZoneSegment) -#endif - -#define ExIsObjectInFirstZoneSegment(Zone,Object) ((BOOLEAN) \ - (((PUCHAR)(Object) >= (PUCHAR)(Zone)->SegmentList.Next) && \ - ((PUCHAR)(Object) < (PUCHAR)(Zone)->SegmentList.Next + \ - (Zone)->TotalSegmentSize)) \ -) - - -// -// ntddk.h stole the entrypoints we wanted so fix them up here. -// - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(ExInitializeResource) // use ExInitializeResourceLite -#pragma deprecated(ExAcquireResourceShared) // use ExAcquireResourceSharedLite -#pragma deprecated(ExAcquireResourceExclusive) // use ExAcquireResourceExclusiveLite -#pragma deprecated(ExReleaseResourceForThread) // use ExReleaseResourceForThreadLite -#pragma deprecated(ExConvertExclusiveToShared) // use ExConvertExclusiveToSharedLite -#pragma deprecated(ExDeleteResource) // use ExDeleteResourceLite -#pragma deprecated(ExIsResourceAcquiredExclusive) // use ExIsResourceAcquiredExclusiveLite -#pragma deprecated(ExIsResourceAcquiredShared) // use ExIsResourceAcquiredSharedLite -#pragma deprecated(ExIsResourceAcquired) // use ExIsResourceAcquiredSharedLite -#endif -#define ExInitializeResource ExInitializeResourceLite -#define ExAcquireResourceShared ExAcquireResourceSharedLite -#define ExAcquireResourceExclusive ExAcquireResourceExclusiveLite -#define ExReleaseResourceForThread ExReleaseResourceForThreadLite -#define ExConvertExclusiveToShared ExConvertExclusiveToSharedLite -#define ExDeleteResource ExDeleteResourceLite -#define ExIsResourceAcquiredExclusive ExIsResourceAcquiredExclusiveLite -#define ExIsResourceAcquiredShared ExIsResourceAcquiredSharedLite -#define ExIsResourceAcquired ExIsResourceAcquiredSharedLite - - -// -// UUID Generation -// - -typedef GUID UUID; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -ExUuidCreate( - __out UUID *Uuid - ); - -#endif - -// -// Priority increment definitions. The comment for each definition gives -// the names of the system services that use the definition when satisfying -// a wait. -// - -// -// Priority increment used when satisfying a wait on an executive event -// (NtPulseEvent and NtSetEvent) -// - -#define EVENT_INCREMENT 1 - -// -// Priority increment when no I/O has been done. This is used by device -// and file system drivers when completing an IRP (IoCompleteRequest). -// - -#define IO_NO_INCREMENT 0 - - -// -// Priority increment for completing CD-ROM I/O. This is used by CD-ROM device -// and file system drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_CD_ROM_INCREMENT 1 - -// -// Priority increment for completing disk I/O. This is used by disk device -// and file system drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_DISK_INCREMENT 1 - - - -// -// Priority increment for completing keyboard I/O. This is used by keyboard -// device drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_KEYBOARD_INCREMENT 6 - - -// -// Priority increment for completing mailslot I/O. This is used by the mail- -// slot file system driver when completing an IRP (IoCompleteRequest). -// - -#define IO_MAILSLOT_INCREMENT 2 - - -// -// Priority increment for completing mouse I/O. This is used by mouse device -// drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_MOUSE_INCREMENT 6 - - -// -// Priority increment for completing named pipe I/O. This is used by the -// named pipe file system driver when completing an IRP (IoCompleteRequest). -// - -#define IO_NAMED_PIPE_INCREMENT 2 - -// -// Priority increment for completing network I/O. This is used by network -// device and network file system drivers when completing an IRP -// (IoCompleteRequest). -// - -#define IO_NETWORK_INCREMENT 2 - - -// -// Priority increment for completing parallel I/O. This is used by parallel -// device drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_PARALLEL_INCREMENT 1 - -// -// Priority increment for completing serial I/O. This is used by serial device -// drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_SERIAL_INCREMENT 2 - -// -// Priority increment for completing sound I/O. This is used by sound device -// drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_SOUND_INCREMENT 8 - -// -// Priority increment for completing video I/O. This is used by video device -// drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_VIDEO_INCREMENT 1 - -// -// Priority increment used when satisfying a wait on an executive semaphore -// (NtReleaseSemaphore) -// - -#define SEMAPHORE_INCREMENT 1 - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -MmIsThisAnNtAsSystem ( - VOID - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -MmMapUserAddressesToPage ( - __in_bcount(NumberOfBytes) PVOID BaseAddress, - __in SIZE_T NumberOfBytes, - __in PVOID PageAddress - ); -#endif - - -typedef struct _PHYSICAL_MEMORY_RANGE { - PHYSICAL_ADDRESS BaseAddress; - LARGE_INTEGER NumberOfBytes; -} PHYSICAL_MEMORY_RANGE, *PPHYSICAL_MEMORY_RANGE; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -MmAddPhysicalMemory ( - __in PPHYSICAL_ADDRESS StartAddress, - __inout PLARGE_INTEGER NumberOfBytes - ); -#endif - -typedef NTSTATUS (*PMM_ROTATE_COPY_CALLBACK_FUNCTION) ( - __in PMDL DestinationMdl, - __in PMDL SourceMdl, - __in PVOID Context - ); - -typedef enum _MM_ROTATE_DIRECTION { - MmToFrameBuffer, - MmToFrameBufferNoCopy, - MmToRegularMemory, - MmToRegularMemoryNoCopy, - MmMaximumRotateDirection -} MM_ROTATE_DIRECTION, *PMM_ROTATE_DIRECTION; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSTATUS -MmRotatePhysicalView ( - __in PVOID VirtualAddress, - __inout PSIZE_T NumberOfBytes, - __in_opt PMDLX NewMdl, - __in MM_ROTATE_DIRECTION Direction, - __in PMM_ROTATE_COPY_CALLBACK_FUNCTION CopyFunction, - __in_opt PVOID Context - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -MmRemovePhysicalMemory ( - __in PPHYSICAL_ADDRESS StartAddress, - __inout PLARGE_INTEGER NumberOfBytes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (PASSIVE_LEVEL) -NTKERNELAPI -PPHYSICAL_MEMORY_RANGE -MmGetPhysicalMemoryRanges ( - VOID - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -__out_bcount_opt (NumberOfBytes) PVOID -MmMapVideoDisplay ( - __in PHYSICAL_ADDRESS PhysicalAddress, - __in SIZE_T NumberOfBytes, - __in MEMORY_CACHING_TYPE CacheType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -VOID -MmUnmapVideoDisplay ( - __in_bcount (NumberOfBytes) PVOID BaseAddress, - __in SIZE_T NumberOfBytes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PHYSICAL_ADDRESS -MmGetPhysicalAddress ( - __in PVOID BaseAddress - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PVOID -MmGetVirtualForPhysical ( - __in PHYSICAL_ADDRESS PhysicalAddress - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -__bcount (NumberOfBytes) PVOID -MmAllocateContiguousMemory ( - __in SIZE_T NumberOfBytes, - __in PHYSICAL_ADDRESS HighestAcceptableAddress - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -__out_bcount_opt (NumberOfBytes) PVOID -MmAllocateContiguousMemorySpecifyCache ( - __in SIZE_T NumberOfBytes, - __in PHYSICAL_ADDRESS LowestAcceptableAddress, - __in PHYSICAL_ADDRESS HighestAcceptableAddress, - __in_opt PHYSICAL_ADDRESS BoundaryAddressMultiple, - __in MEMORY_CACHING_TYPE CacheType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - - - -typedef ULONG NODE_REQUIREMENT; - -#define MM_ANY_NODE_OK 0x80000000 - - - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -__out_bcount_opt (NumberOfBytes) PVOID -MmAllocateContiguousMemorySpecifyCacheNode ( - __in SIZE_T NumberOfBytes, - __in PHYSICAL_ADDRESS LowestAcceptableAddress, - __in PHYSICAL_ADDRESS HighestAcceptableAddress, - __in_opt PHYSICAL_ADDRESS BoundaryAddressMultiple, - __in MEMORY_CACHING_TYPE CacheType, - __in NODE_REQUIREMENT PreferredNode - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -MmFreeContiguousMemory ( - __in PVOID BaseAddress - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (DISPATCH_LEVEL) -NTKERNELAPI -VOID -MmFreeContiguousMemorySpecifyCache ( - __in_bcount (NumberOfBytes) PVOID BaseAddress, - __in SIZE_T NumberOfBytes, - __in MEMORY_CACHING_TYPE CacheType - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -__out_bcount_opt (NumberOfBytes) PVOID -MmAllocateNonCachedMemory ( - __in SIZE_T NumberOfBytes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -MmFreeNonCachedMemory ( - __in_bcount (NumberOfBytes) PVOID BaseAddress, - __in SIZE_T NumberOfBytes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -MmIsAddressValid ( - __in PVOID VirtualAddress - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_preferredFunction("(see documentation)", "Obsolete") -DECLSPEC_DEPRECATED_DDK -NTKERNELAPI -BOOLEAN -MmIsNonPagedSystemAddressValid ( - __in PVOID VirtualAddress - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -MmLockPagableSectionByHandle ( - __in PVOID ImageSectionHandle - ); -#endif - - -// -// Note that even though this function prototype -// says "HANDLE", MmSecureVirtualMemory does NOT return -// anything resembling a Win32-style handle. The return -// value from this function can ONLY be used with MmUnsecureVirtualMemory. -// -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -__drv_reportError("Caution: MmSecureVirtualMemory ensures the specified VA " - "range protections cannot be tightened - but accesses to the memory can " - "still fail and so they must be protected by try-except.") -NTKERNELAPI -HANDLE -MmSecureVirtualMemory ( - __in_data_source(USER_MODE) __out_validated(MEMORY) __in_bcount (Size) PVOID Address, - __in __in_data_source(USER_MODE) SIZE_T Size, - __in ULONG ProbeMode - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -MmUnsecureVirtualMemory ( - __in HANDLE SecureHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -MmMapViewInSystemSpace ( - __in PVOID Section, - __deref_out_bcount (*ViewSize) PVOID *MappedBase, - __inout PSIZE_T ViewSize - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -MmUnmapViewInSystemSpace ( - __in PVOID MappedBase - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -MmMapViewInSessionSpace ( - __in PVOID Section, - __deref_out_bcount (*ViewSize) PVOID *MappedBase, - __inout PSIZE_T ViewSize - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -MmUnmapViewInSessionSpace ( - __in PVOID MappedBase - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WS03) -__checkReturn -__drv_maxIRQL (PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -MmCreateMirror ( - VOID - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -BOOLEAN -SeSinglePrivilegeCheck( - __in LUID PrivilegeValue, - __in KPROCESSOR_MODE PreviousMode - ); -#endif - - -extern NTKERNELAPI PEPROCESS PsInitialSystemProcess; - - -#if !defined(_PSGETCURRENTTHREAD_) - -#define _PSGETCURRENTTHREAD_ - -__drv_maxIRQL(DISPATCH_LEVEL) -FORCEINLINE -PETHREAD -PsGetCurrentThread ( - VOID - ) - -/*++ - -Routine Description: - - This function returns a pointer to the current executive thread object. - -Arguments: - - None. - -Return Value: - - A pointer to the current executive thread object. - ---*/ - -{ - - return (PETHREAD)KeGetCurrentThread(); -} - -#endif - - -typedef -VOID -(*PCREATE_PROCESS_NOTIFY_ROUTINE)( - __in HANDLE ParentId, - __in HANDLE ProcessId, - __in BOOLEAN Create - ); - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -PsSetCreateProcessNotifyRoutine( - __in PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine, - __in BOOLEAN Remove - ); -#endif - -typedef struct _PS_CREATE_NOTIFY_INFO { - __in SIZE_T Size; - union { - __in ULONG Flags; - struct { - __in ULONG FileOpenNameAvailable : 1; - __in ULONG Reserved : 31; - }; - }; - __in HANDLE ParentProcessId; - __in CLIENT_ID CreatingThreadId; - __inout struct _FILE_OBJECT *FileObject; - __in PCUNICODE_STRING ImageFileName; - __in_opt PCUNICODE_STRING CommandLine; - __inout NTSTATUS CreationStatus; -} PS_CREATE_NOTIFY_INFO, *PPS_CREATE_NOTIFY_INFO; - -typedef -VOID -(*PCREATE_PROCESS_NOTIFY_ROUTINE_EX) ( - __inout PEPROCESS Process, - __in HANDLE ProcessId, - __in_opt PPS_CREATE_NOTIFY_INFO CreateInfo - ); - -#if (NTDDI_VERSION >= NTDDI_VISTASP1) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -PsSetCreateProcessNotifyRoutineEx ( - __in PCREATE_PROCESS_NOTIFY_ROUTINE_EX NotifyRoutine, - __in BOOLEAN Remove - ); -#endif - -typedef -VOID -(*PCREATE_THREAD_NOTIFY_ROUTINE)( - __in HANDLE ProcessId, - __in HANDLE ThreadId, - __in BOOLEAN Create - ); - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -PsSetCreateThreadNotifyRoutine( - __in PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -PsRemoveCreateThreadNotifyRoutine ( - __in PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine - ); -#endif - -// -// Structures for Load Image Notify -// - -#define IMAGE_ADDRESSING_MODE_32BIT 3 - -typedef struct _IMAGE_INFO { - union { - ULONG Properties; - struct { - ULONG ImageAddressingMode : 8; // Code addressing mode - ULONG SystemModeImage : 1; // System mode image - ULONG ImageMappedToAllPids : 1; // Image mapped into all processes - ULONG ExtendedInfoPresent : 1; // IMAGE_INFO_EX available - ULONG Reserved : 21; - }; - }; - PVOID ImageBase; - ULONG ImageSelector; - SIZE_T ImageSize; - ULONG ImageSectionNumber; -} IMAGE_INFO, *PIMAGE_INFO; - -typedef struct _IMAGE_INFO_EX { - SIZE_T Size; - IMAGE_INFO ImageInfo; - struct _FILE_OBJECT *FileObject; -} IMAGE_INFO_EX, *PIMAGE_INFO_EX; - -typedef -VOID -(*PLOAD_IMAGE_NOTIFY_ROUTINE)( - __in PUNICODE_STRING FullImageName, - __in HANDLE ProcessId, // pid into which image is being mapped - __in PIMAGE_INFO ImageInfo - ); - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -PsSetLoadImageNotifyRoutine( - __in PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -PsRemoveLoadImageNotifyRoutine( - __in PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -HANDLE -PsGetCurrentProcessId( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -HANDLE -PsGetCurrentThreadId( - VOID - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("RtlGetVersion", "Obsolete") -NTKERNELAPI -BOOLEAN -PsGetVersion( - __out_opt PULONG MajorVersion, - __out_opt PULONG MinorVersion, - __out_opt PULONG BuildNumber, - __out_opt PUNICODE_STRING CSDVersion - ); -#endif - -// -// Prefetch information. -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -PsSetCurrentThreadPrefetching ( - __in BOOLEAN Prefetching - ); - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -PsIsCurrentThreadPrefetching ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONGLONG -PsGetProcessCreateTimeQuadPart( - __in PEPROCESS Process - ); -#endif -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -HANDLE -PsGetProcessId( - __in PEPROCESS Process - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -HANDLE -PsGetThreadId( - __in PETHREAD Thread - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -NTKERNELAPI -HANDLE -PsGetThreadProcessId( - __in PETHREAD Thread - ); -#endif - -// -// Directory control minor function codes -// - -#define IRP_MN_QUERY_DIRECTORY 0x01 -#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 - -// -// File system control minor function codes. Note that "user request" is -// assumed to be zero by both the I/O system and file systems. Do not change -// this value. -// - -#define IRP_MN_USER_FS_REQUEST 0x00 -#define IRP_MN_MOUNT_VOLUME 0x01 -#define IRP_MN_VERIFY_VOLUME 0x02 -#define IRP_MN_LOAD_FILE_SYSTEM 0x03 -#define IRP_MN_TRACK_LINK 0x04 // To be obsoleted soon -#define IRP_MN_KERNEL_CALL 0x04 - -// -// Lock control minor function codes -// - -#define IRP_MN_LOCK 0x01 -#define IRP_MN_UNLOCK_SINGLE 0x02 -#define IRP_MN_UNLOCK_ALL 0x03 -#define IRP_MN_UNLOCK_ALL_BY_KEY 0x04 - -// -// Flush minor function codes -// - -#define IRP_MN_FLUSH_AND_PURGE 0x01 - -// -// Read and Write minor function codes for file systems supporting Lan Manager -// software. All of these subfunction codes are invalid if the file has been -// opened with FO_NO_INTERMEDIATE_BUFFERING. They are also invalid in combi- -// nation with synchronous calls (Irp Flag or file open option). -// -// Note that "normal" is assumed to be zero by both the I/O system and file -// systems. Do not change this value. -// - -#define IRP_MN_NORMAL 0x00 -#define IRP_MN_DPC 0x01 -#define IRP_MN_MDL 0x02 -#define IRP_MN_COMPLETE 0x04 -#define IRP_MN_COMPRESSED 0x08 - -#define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC) -#define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL) -#define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC) - -#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18 - -#define IO_CHECK_CREATE_PARAMETERS 0x0200 -#define IO_ATTACH_DEVICE 0x0400 - -// -// This flag is only meaningful to IoCreateFileSpecifyDeviceObjectHint. -// FileHandles created using IoCreateFileSpecifyDeviceObjectHint with this -// flag set will bypass ShareAccess checks on this file. -// - -#define IO_IGNORE_SHARE_ACCESS_CHECK 0x0800 // Ignores share access checks on opens. - -// -// Define callout routine type for use in IoQueryDeviceDescription(). -// - -typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)( - __in PVOID Context, - __in PUNICODE_STRING PathName, - __in INTERFACE_TYPE BusType, - __in ULONG BusNumber, - __in PKEY_VALUE_FULL_INFORMATION *BusInformation, - __in CONFIGURATION_TYPE ControllerType, - __in ULONG ControllerNumber, - __in PKEY_VALUE_FULL_INFORMATION *ControllerInformation, - __in CONFIGURATION_TYPE PeripheralType, - __in ULONG PeripheralNumber, - __in PKEY_VALUE_FULL_INFORMATION *PeripheralInformation - ); - - -// Defines the order of the information in the array of -// PKEY_VALUE_FULL_INFORMATION. -// - -typedef enum _IO_QUERY_DEVICE_DATA_FORMAT { - IoQueryDeviceIdentifier = 0, - IoQueryDeviceConfigurationData, - IoQueryDeviceComponentInformation, - IoQueryDeviceMaxData -} IO_QUERY_DEVICE_DATA_FORMAT, *PIO_QUERY_DEVICE_DATA_FORMAT; - -// -// Define driver reinitialization routine type. -// - -typedef -VOID -DRIVER_REINITIALIZE ( - __in struct _DRIVER_OBJECT *DriverObject, - __in_opt PVOID Context, - __in ULONG Count - ); - -typedef DRIVER_REINITIALIZE *PDRIVER_REINITIALIZE; - - -typedef struct _CONTROLLER_OBJECT { - CSHORT Type; - CSHORT Size; - PVOID ControllerExtension; - KDEVICE_QUEUE DeviceWaitQueue; - - ULONG Spare1; - LARGE_INTEGER Spare2; - -} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT; - -#define DO_VERIFY_VOLUME 0x00000002 -#define DO_BUFFERED_IO 0x00000004 -#define DO_EXCLUSIVE 0x00000008 -#define DO_DIRECT_IO 0x00000010 -#define DO_MAP_IO_BUFFER 0x00000020 -#define DO_DEVICE_HAS_NAME 0x00000040 -#define DO_DEVICE_INITIALIZING 0x00000080 -#define DO_SYSTEM_BOOT_PARTITION 0x00000100 -#define DO_LONG_TERM_REQUESTS 0x00000200 -#define DO_NEVER_LAST_DEVICE 0x00000400 -#define DO_SHUTDOWN_REGISTERED 0x00000800 -#define DO_BUS_ENUMERATED_DEVICE 0x00001000 -#define DO_POWER_PAGABLE 0x00002000 -#define DO_POWER_INRUSH 0x00004000 -#define DO_LOW_PRIORITY_FILESYSTEM 0x00010000 -#define DO_SUPPORTS_TRANSACTIONS 0x00040000 -#define DO_FORCE_NEITHER_IO 0x00080000 -#define DO_VOLUME_DEVICE_OBJECT 0x00100000 -#define DO_SYSTEM_SYSTEM_PARTITION 0x00200000 -#define DO_SYSTEM_CRITICAL_PARTITION 0x00400000 -#define DO_DISALLOW_EXECUTE 0x00800000 -#define DRVO_REINIT_REGISTERED 0x00000008 -#define DRVO_INITIALIZED 0x00000010 -#define DRVO_BOOTREINIT_REGISTERED 0x00000020 -#define DRVO_LEGACY_RESOURCES 0x00000040 - -// -// The following structure is used by drivers that are initializing to -// determine the number of devices of a particular type that have already -// been initialized. It is also used to track whether or not the AtDisk -// address range has already been claimed. Finally, it is used by the -// NtQuerySystemInformation system service to return device type counts. -// - -typedef struct _CONFIGURATION_INFORMATION { - - // - // This field indicates the total number of disks in the system. This - // number should be used by the driver to determine the name of new - // disks. This field should be updated by the driver as it finds new - // disks. - // - - ULONG DiskCount; // Count of hard disks thus far - ULONG FloppyCount; // Count of floppy disks thus far - ULONG CdRomCount; // Count of CD-ROM drives thus far - ULONG TapeCount; // Count of tape drives thus far - ULONG ScsiPortCount; // Count of SCSI port adapters thus far - ULONG SerialCount; // Count of serial devices thus far - ULONG ParallelCount; // Count of parallel devices thus far - - // - // These next two fields indicate ownership of one of the two IO address - // spaces that are used by WD1003-compatable disk controllers. - // - - BOOLEAN AtDiskPrimaryAddressClaimed; // 0x1F0 - 0x1FF - BOOLEAN AtDiskSecondaryAddressClaimed; // 0x170 - 0x17F - - // - // Indicates the structure version, as anything value belong this will have been added. - // Use the structure size as the version. - // - - ULONG Version; - - // - // Indicates the total number of medium changer devices in the system. - // This field will be updated by the drivers as it determines that - // new devices have been found and will be supported. - // - - ULONG MediumChangerCount; - -} CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION; - -#if !(defined(USE_DMA_MACROS) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use AllocateAdapterChannel -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -__drv_preferredFunction("AllocateAdapterChannel","obsolete") -NTKERNELAPI -NTSTATUS -IoAllocateAdapterChannel( - __in PADAPTER_OBJECT AdapterObject, - __in PDEVICE_OBJECT DeviceObject, - __in ULONG NumberOfMapRegisters, - __in PDRIVER_CONTROL ExecutionRoutine, - __in PVOID Context - ); -#endif - -#endif // !(defined(USE_DMA_MACROS) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoAllocateController( - __in PCONTROLLER_OBJECT ControllerObject, - __in PDEVICE_OBJECT DeviceObject, - __in PDRIVER_CONTROL ExecutionRoutine, - __in_opt PVOID Context - ); -#endif - -//++ -// -// VOID -// IoAssignArcName( -// __in PUNICODE_STRING ArcName, -// __in PUNICODE_STRING DeviceName -// ) -// -// Routine Description: -// -// This routine is invoked by drivers of bootable media to create a symbolic -// link between the ARC name of their device and its NT name. This allows -// the system to determine which device in the system was actually booted -// from since the ARC firmware only deals in ARC names, and NT only deals -// in NT names. -// -// Arguments: -// -// ArcName - Supplies the Unicode string representing the ARC name. -// -// DeviceName - Supplies the name to which the ARCname refers. -// -// Return Value: -// -// None. -// -//-- - -#define IoAssignArcName( ArcName, DeviceName ) ( \ - IoCreateSymbolicLink( (ArcName), (DeviceName) ) ) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use Pnp or IoReprtDetectedDevice -__drv_preferredFunction("(see documentation)", "Obsolete") -NTKERNELAPI -NTSTATUS -IoAssignResources ( - __in PUNICODE_STRING RegistryPath, - __in_opt PUNICODE_STRING DriverClassName, - __in PDRIVER_OBJECT DriverObject, - __in_opt PDEVICE_OBJECT DeviceObject, - __in_opt PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources, - __inout PCM_RESOURCE_LIST *AllocatedResources - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use IoAttachDeviceToDeviceStack -__drv_preferredFunction("IoAttachDeviceToDeviceStack", "Obsolete") -NTKERNELAPI -NTSTATUS -IoAttachDeviceByPointer( - __in PDEVICE_OBJECT SourceDevice, - __in PDEVICE_OBJECT TargetDevice - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -PCONTROLLER_OBJECT -IoCreateController( - __in ULONG Size - ); -#endif - - -//++ -// -// VOID -// IoDeassignArcName( -// __in PUNICODE_STRING ArcName -// ) -// -// Routine Description: -// -// This routine is invoked by drivers to deassign an ARC name that they -// created to a device. This is generally only called if the driver is -// deleting the device object, which means that the driver is probably -// unloading. -// -// Arguments: -// -// ArcName - Supplies the ARC name to be removed. -// -// Return Value: -// -// None. -// -//-- - -#define IoDeassignArcName( ArcName ) ( \ - IoDeleteSymbolicLink( (ArcName) ) ) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -IoDeleteController( - __in PCONTROLLER_OBJECT ControllerObject - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoFreeController( - __in PCONTROLLER_OBJECT ControllerObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PCONFIGURATION_INFORMATION -__drv_maxIRQL(PASSIVE_LEVEL) -IoGetConfigurationInformation( VOID ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -PDEVICE_OBJECT -IoGetDeviceToVerify( - __in PETHREAD Thread - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -PGENERIC_MAPPING -IoGetFileObjectGenericMapping( - VOID - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -IoCancelFileOpen( - __in PDEVICE_OBJECT DeviceObject, - __in PFILE_OBJECT FileObject - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PIRP -IoMakeAssociatedIrp( - __in PIRP Irp, - __in CCHAR StackSize - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use IoGetDeviceProperty -__drv_preferredFunction("IoGetDeviceProperty", "Obsolete") -NTKERNELAPI -NTSTATUS -IoQueryDeviceDescription( - __in_opt PINTERFACE_TYPE BusType, - __in_opt PULONG BusNumber, - __in_opt PCONFIGURATION_TYPE ControllerType, - __in_opt PULONG ControllerNumber, - __in_opt PCONFIGURATION_TYPE PeripheralType, - __in_opt PULONG PeripheralNumber, - __in PIO_QUERY_DEVICE_ROUTINE CalloutRoutine, - __inout_opt PVOID Context - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -IoRaiseHardError( - __in PIRP Irp, - __in_opt PVPB Vpb, - __in PDEVICE_OBJECT RealDeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -IoRaiseInformationalHardError( - __in NTSTATUS ErrorStatus, - __in_opt PUNICODE_STRING String, - __in_opt PKTHREAD Thread - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -IoSetThreadHardErrorMode( - __in BOOLEAN EnableHardErrors - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -IoRegisterBootDriverReinitialization( - __in PDRIVER_OBJECT DriverObject, - __in PDRIVER_REINITIALIZE DriverReinitializationRoutine, - __in_opt PVOID Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -IoRegisterDriverReinitialization( - __in PDRIVER_OBJECT DriverObject, - __in PDRIVER_REINITIALIZE DriverReinitializationRoutine, - __in_opt PVOID Context - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use IoReportResourceForDetection -__drv_preferredFunction("IoReportResourceForDetection if needed", "Obsolete") -NTKERNELAPI -NTSTATUS -IoReportResourceUsage( - __in_opt PUNICODE_STRING DriverClassName, - __in PDRIVER_OBJECT DriverObject, - __in_opt PCM_RESOURCE_LIST DriverList, - __in_opt ULONG DriverListSize, - __in PDEVICE_OBJECT DeviceObject, - __in_opt PCM_RESOURCE_LIST DeviceList, - __in_opt ULONG DeviceListSize, - __in BOOLEAN OverrideConflict, - __out PBOOLEAN ConflictDetected - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -BOOLEAN -IoTranslateBusAddress( - __in INTERFACE_TYPE InterfaceType, - __in ULONG BusNumber, - __in PHYSICAL_ADDRESS BusAddress, - __inout PULONG AddressSpace, - __out PPHYSICAL_ADDRESS TranslatedAddress - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoSetHardErrorOrVerifyDevice( - __in PIRP Irp, - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -FASTCALL -HalExamineMBR( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG SectorSize, - __in ULONG MBRTypeIdentifier, - __out PVOID *Buffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -DECLSPEC_DEPRECATED_DDK // Use IoReadPartitionTableEx -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("IoReadPartitionTableEx", "Obsolete") -NTKERNELAPI -NTSTATUS -FASTCALL -IoReadPartitionTable( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG SectorSize, - __in BOOLEAN ReturnRecognizedPartitions, - __out struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -DECLSPEC_DEPRECATED_DDK // Use IoSetPartitionInformationEx -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("IoSetPartitionInformationEx", "Obsolete") -NTKERNELAPI -NTSTATUS -FASTCALL -IoSetPartitionInformation( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG SectorSize, - __in ULONG PartitionNumber, - __in ULONG PartitionType - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -DECLSPEC_DEPRECATED_DDK // Use IoWritePartitionTableEx -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("IoWritePartitionTableEx", "Obsolete") -NTKERNELAPI -NTSTATUS -FASTCALL -IoWritePartitionTable( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG SectorSize, - __in ULONG SectorsPerTrack, - __in ULONG NumberOfHeads, - __in struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoCreateDisk( - __in PDEVICE_OBJECT DeviceObject, - __in_opt struct _CREATE_DISK* Disk - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoReadPartitionTableEx( - __in PDEVICE_OBJECT DeviceObject, - __out struct _DRIVE_LAYOUT_INFORMATION_EX** DriveLayout - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoWritePartitionTableEx( - __in PDEVICE_OBJECT DeviceObject, - __in_xcount(FIELD_OFFSET(DRIVE_LAYOUT_INFORMATION_EX, PartitionEntry[0])) struct _DRIVE_LAYOUT_INFORMATION_EX* DriveLayout - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoSetPartitionInformationEx( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG PartitionNumber, - __in struct _SET_PARTITION_INFORMATION_EX* PartitionInfo - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -NTSTATUS -IoUpdateDiskGeometry( - __in PDEVICE_OBJECT DeviceObject, - __in struct _DISK_GEOMETRY_EX* OldDiskGeometry, - __in struct _DISK_GEOMETRY_EX* NewDiskGeometry - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoVerifyPartitionTable( - __in PDEVICE_OBJECT DeviceObject, - __in BOOLEAN FixErrors - ); -#endif - -typedef struct _DISK_SIGNATURE { - ULONG PartitionStyle; - union { - struct { - ULONG Signature; - ULONG CheckSum; - } Mbr; - - struct { - GUID DiskId; - } Gpt; - }; -} DISK_SIGNATURE, *PDISK_SIGNATURE; - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoReadDiskSignature( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG BytesPerSector, - __out PDISK_SIGNATURE Signature - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoVolumeDeviceToDosName( - __in PVOID VolumeDeviceObject, - __out PUNICODE_STRING DosName - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoSetSystemPartition( - __in PUNICODE_STRING VolumeNameString - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoCreateFileSpecifyDeviceObjectHint( - __out PHANDLE FileHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_opt PLARGE_INTEGER AllocationSize, - __in ULONG FileAttributes, - __in ULONG ShareAccess, - __in ULONG Disposition, - __in ULONG CreateOptions, - __in_opt PVOID EaBuffer, - __in ULONG EaLength, - __in CREATE_FILE_TYPE CreateFileType, - __in_opt PVOID InternalParameters, - __in ULONG Options, - __in_opt PVOID DeviceObject - ); -#endif - -typedef struct _TXN_PARAMETER_BLOCK { - - USHORT Length; // sizeof( TXN_PARAMETER_BLOCK ) - USHORT TxFsContext; // this is mini version of the requested file - PVOID TransactionObject; // referenced pointer to KTRANSACTION - -} TXN_PARAMETER_BLOCK, *PTXN_PARAMETER_BLOCK; - -// -// This value should be used in the TxFsContext member of the -// TXN_PARAMETER_BLOCK in the absence of a specific miniversion. -// - -#define TXF_MINIVERSION_DEFAULT_VIEW (0xFFFE) - -#if (NTDDI_VERSION >= NTDDI_VISTA) -PTXN_PARAMETER_BLOCK -IoGetTransactionParameterBlock ( - __in PFILE_OBJECT FileObject - ); -#endif - -typedef struct _IO_DRIVER_CREATE_CONTEXT { - CSHORT Size; - struct _ECP_LIST *ExtraCreateParameter; - PVOID DeviceObjectHint; - PTXN_PARAMETER_BLOCK TxnParameters; -} IO_DRIVER_CREATE_CONTEXT, *PIO_DRIVER_CREATE_CONTEXT; - -VOID -FORCEINLINE -IoInitializeDriverCreateContext( - PIO_DRIVER_CREATE_CONTEXT DriverContext - ) -{ - // Initialize the context - RtlZeroMemory(DriverContext, sizeof(IO_DRIVER_CREATE_CONTEXT)); - DriverContext->Size = sizeof(IO_DRIVER_CREATE_CONTEXT); -} - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -NTSTATUS -IoCreateFileEx( - __out PHANDLE FileHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_opt PLARGE_INTEGER AllocationSize, - __in ULONG FileAttributes, - __in ULONG ShareAccess, - __in ULONG Disposition, - __in ULONG CreateOptions, - __in_opt PVOID EaBuffer, - __in ULONG EaLength, - __in CREATE_FILE_TYPE CreateFileType, - __in_opt PVOID InternalParameters, - __in ULONG Options, - __in_opt PIO_DRIVER_CREATE_CONTEXT DriverContext - ); - -NTSTATUS -IoSetIrpExtraCreateParameter( - __inout PIRP Irp, - __in struct _ECP_LIST *ExtraCreateParameter - ); - -VOID -IoClearIrpExtraCreateParameter( - __inout PIRP Irp - ); - -NTSTATUS -IoGetIrpExtraCreateParameter( - __in PIRP Irp, - __deref_out_opt struct _ECP_LIST **ExtraCreateParameter - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoAttachDeviceToDeviceStackSafe( - __in PDEVICE_OBJECT SourceDevice, - __in PDEVICE_OBJECT TargetDevice, - __deref_out PDEVICE_OBJECT *AttachedToDeviceObject - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WIN2KSP3) -NTKERNELAPI -BOOLEAN -IoIsFileOriginRemote( - __in PFILE_OBJECT FileObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2KSP3) -NTKERNELAPI -NTSTATUS -IoSetFileOrigin( - __in PFILE_OBJECT FileObject, - __in BOOLEAN Remote - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -BOOLEAN -IoIsFileObjectIgnoringSharing ( - __in PFILE_OBJECT FileObject -); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTSTATUS -IoSetFileObjectIgnoreSharing ( - __in PFILE_OBJECT FileObject -); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WS03) -NTKERNELAPI -IO_PAGING_PRIORITY -FASTCALL -IoGetPagingIoPriority( - __in PIRP Irp - ); -#endif - - -typedef struct _AGP_TARGET_BUS_INTERFACE_STANDARD { - // - // generic interface header - // - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // - // config munging routines - // - PGET_SET_DEVICE_DATA SetBusData; - PGET_SET_DEVICE_DATA GetBusData; - UCHAR CapabilityID; // 2 (AGPv2 host) or new 0xE (AGPv3 bridge) - -} AGP_TARGET_BUS_INTERFACE_STANDARD, *PAGP_TARGET_BUS_INTERFACE_STANDARD; - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTKERNELAPI -NTSTATUS -IoReportDetectedDevice( - __in PDRIVER_OBJECT DriverObject, - __in INTERFACE_TYPE LegacyBusType, - __in ULONG BusNumber, - __in ULONG SlotNumber, - __in_opt PCM_RESOURCE_LIST ResourceList, - __in_opt PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements, - __in BOOLEAN ResourceAssigned, - __deref_inout_opt PDEVICE_OBJECT *DeviceObject - ); -#endif - -// -// Device location interface declarations -// -typedef -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSTATUS -(*PGET_LOCATION_STRING) ( - __inout_opt PVOID Context, - __deref_out - __drv_deref(__drv_when(return==0, - __drv_allocatesMem(Mem) __drv_valueIs(!=0))) - PWCHAR *LocationStrings - ); - -typedef struct _PNP_LOCATION_INTERFACE { - // - // generic interface header - // - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // - // interface specific entry - // - PGET_LOCATION_STRING GetLocationString; - -} PNP_LOCATION_INTERFACE, *PPNP_LOCATION_INTERFACE; - -// -// Resource arbiter declarations -// - -typedef enum _ARBITER_ACTION { - ArbiterActionTestAllocation, - ArbiterActionRetestAllocation, - ArbiterActionCommitAllocation, - ArbiterActionRollbackAllocation, - ArbiterActionQueryAllocatedResources, - ArbiterActionWriteReservedResources, - ArbiterActionQueryConflict, - ArbiterActionQueryArbitrate, - ArbiterActionAddReserved, - ArbiterActionBootAllocation -} ARBITER_ACTION, *PARBITER_ACTION; - -typedef struct _ARBITER_CONFLICT_INFO { - // - // The device object owning the device that is causing the conflict - // - PDEVICE_OBJECT OwningObject; - - // - // The start of the conflicting range - // - ULONGLONG Start; - - // - // The end of the conflicting range - // - ULONGLONG End; - -} ARBITER_CONFLICT_INFO, *PARBITER_CONFLICT_INFO; - -// -// The parameters for those actions -// - -typedef struct _ARBITER_TEST_ALLOCATION_PARAMETERS { - - // - // Doubly linked list of ARBITER_LIST_ENTRY's - // - __inout PLIST_ENTRY ArbitrationList; - - // - // The size of the AllocateFrom array - // - __in ULONG AllocateFromCount; - - // - // Array of resource descriptors describing the resources available - // to the arbiter for it to arbitrate - // - __in PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom; - -} ARBITER_TEST_ALLOCATION_PARAMETERS, *PARBITER_TEST_ALLOCATION_PARAMETERS; - - -typedef struct _ARBITER_RETEST_ALLOCATION_PARAMETERS { - - // - // Doubly linked list of ARBITER_LIST_ENTRY's - // - __inout PLIST_ENTRY ArbitrationList; - - // - // The size of the AllocateFrom array - // - __in ULONG AllocateFromCount; - - // - // Array of resource descriptors describing the resources available - // to the arbiter for it to arbitrate - // - __in PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom; - -} ARBITER_RETEST_ALLOCATION_PARAMETERS, *PARBITER_RETEST_ALLOCATION_PARAMETERS; - -typedef struct _ARBITER_BOOT_ALLOCATION_PARAMETERS { - - // - // Doubly linked list of ARBITER_LIST_ENTRY's - // - __inout PLIST_ENTRY ArbitrationList; - -} ARBITER_BOOT_ALLOCATION_PARAMETERS, *PARBITER_BOOT_ALLOCATION_PARAMETERS; - - -typedef struct _ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS { - - // - // The resources that are currently allocated - // - __out PCM_PARTIAL_RESOURCE_LIST *AllocatedResources; - -} ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS, *PARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS; - -typedef struct _ARBITER_QUERY_CONFLICT_PARAMETERS { - - // - // This is the device we are trying to find a conflict for - // - __in PDEVICE_OBJECT PhysicalDeviceObject; - - // - // This is the resource to find the conflict for - // - __in PIO_RESOURCE_DESCRIPTOR ConflictingResource; - - // - // Number of devices conflicting on the resource - // - __out PULONG ConflictCount; - - // - // Pointer to array describing the conflicting device objects and ranges - // - __out PARBITER_CONFLICT_INFO *Conflicts; - -} ARBITER_QUERY_CONFLICT_PARAMETERS, *PARBITER_QUERY_CONFLICT_PARAMETERS; - -typedef struct _ARBITER_QUERY_ARBITRATE_PARAMETERS { - - // - // Doubly linked list of ARBITER_LIST_ENTRY's - should have - // only one entry - // - __in PLIST_ENTRY ArbitrationList; - -} ARBITER_QUERY_ARBITRATE_PARAMETERS, *PARBITER_QUERY_ARBITRATE_PARAMETERS; - -typedef struct _ARBITER_ADD_RESERVED_PARAMETERS { - - // - // Doubly linked list of ARBITER_LIST_ENTRY's - should have - // only one entry - // - __in PDEVICE_OBJECT ReserveDevice; - -} ARBITER_ADD_RESERVED_PARAMETERS, *PARBITER_ADD_RESERVED_PARAMETERS; - - -typedef struct _ARBITER_PARAMETERS { - - union { - - ARBITER_TEST_ALLOCATION_PARAMETERS TestAllocation; - ARBITER_RETEST_ALLOCATION_PARAMETERS RetestAllocation; - ARBITER_BOOT_ALLOCATION_PARAMETERS BootAllocation; - ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS QueryAllocatedResources; - ARBITER_QUERY_CONFLICT_PARAMETERS QueryConflict; - ARBITER_QUERY_ARBITRATE_PARAMETERS QueryArbitrate; - ARBITER_ADD_RESERVED_PARAMETERS AddReserved; - - } Parameters; - -} ARBITER_PARAMETERS, *PARBITER_PARAMETERS; - -typedef enum _ARBITER_REQUEST_SOURCE { - - ArbiterRequestUndefined = -1, - ArbiterRequestLegacyReported, // IoReportResourceUsage - ArbiterRequestHalReported, // IoReportHalResourceUsage - ArbiterRequestLegacyAssigned, // IoAssignResources - ArbiterRequestPnpDetected, // IoReportResourceForDetection - ArbiterRequestPnpEnumerated // IRP_MN_QUERY_RESOURCE_REQUIREMENTS - -} ARBITER_REQUEST_SOURCE; - - -typedef enum _ARBITER_RESULT { - - ArbiterResultUndefined = -1, - ArbiterResultSuccess, - ArbiterResultExternalConflict, // This indicates that the request can never be solved for devices in this list - ArbiterResultNullRequest // The request was for length zero and thus no translation should be attempted - -} ARBITER_RESULT; - -// -// ARBITER_FLAG_BOOT_CONFIG - this indicates that the request is for the -// resources assigned by the firmware/BIOS. It should be succeeded even if -// it conflicts with another devices boot config. -// - -#define ARBITER_FLAG_BOOT_CONFIG 0x00000001 - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoReportResourceForDetection( - __in PDRIVER_OBJECT DriverObject, - __in_bcount_opt(DriverListSize) PCM_RESOURCE_LIST DriverList, - __in_opt ULONG DriverListSize, - __in_opt PDEVICE_OBJECT DeviceObject, - __in_bcount_opt(DeviceListSize) PCM_RESOURCE_LIST DeviceList, - __in_opt ULONG DeviceListSize, - __out PBOOLEAN ConflictDetected - ); -#endif - -typedef struct _ARBITER_LIST_ENTRY { - - // - // This is a doubly linked list of entries for easy sorting - // - LIST_ENTRY ListEntry; - - // - // The number of alternative allocation - // - ULONG AlternativeCount; - - // - // Pointer to an array of resource descriptors for the possible allocations - // - PIO_RESOURCE_DESCRIPTOR Alternatives; - - // - // The device object of the device requesting these resources. - // - PDEVICE_OBJECT PhysicalDeviceObject; - - // - // Indicates where the request came from - // - ARBITER_REQUEST_SOURCE RequestSource; - - // - // Flags these indicate a variety of things (use ARBITER_FLAG_*) - // - ULONG Flags; - - // - // Space to aid the arbiter in processing the list it is initialized to 0 when - // the entry is created. The system will not attempt to interpret it. - // - LONG_PTR WorkSpace; - - // - // Interface Type, Slot Number and Bus Number from Resource Requirements list, - // used only for reverse identification. - // - INTERFACE_TYPE InterfaceType; - ULONG SlotNumber; - ULONG BusNumber; - - // - // A pointer to a descriptor to indicate the resource that was allocated. - // This is allocated by the system and filled in by the arbiter in response to an - // ArbiterActionTestAllocation. - // - PCM_PARTIAL_RESOURCE_DESCRIPTOR Assignment; - - // - // Pointer to the alternative that was chosen from to provide the assignment. - // This is filled in by the arbiter in response to an ArbiterActionTestAllocation. - // - PIO_RESOURCE_DESCRIPTOR SelectedAlternative; - - // - // The result of the operation - // This is filled in by the arbiter in response to an ArbiterActionTestAllocation. - // - ARBITER_RESULT Result; - -} ARBITER_LIST_ENTRY, *PARBITER_LIST_ENTRY; - -// -// The arbiter's entry point -// - -typedef -NTSTATUS -(*PARBITER_HANDLER) ( - __inout_opt PVOID Context, - __in ARBITER_ACTION Action, - __inout PARBITER_PARAMETERS Parameters - ); - -// -// Arbiter interface -// - -#define ARBITER_PARTIAL 0x00000001 - - -typedef struct _ARBITER_INTERFACE { - - // - // Generic interface header - // - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // - // Entry point to the arbiter - // - PARBITER_HANDLER ArbiterHandler; - - // - // Other information about the arbiter, use ARBITER_* flags - // - ULONG Flags; - -} ARBITER_INTERFACE, *PARBITER_INTERFACE; - -// -// The directions translation can take place in -// - -typedef enum _RESOURCE_TRANSLATION_DIRECTION { - TranslateChildToParent, - TranslateParentToChild -} RESOURCE_TRANSLATION_DIRECTION; - -// -// Translation functions -// - -typedef -NTSTATUS -(*PTRANSLATE_RESOURCE_HANDLER)( - __inout_opt PVOID Context, - __in PCM_PARTIAL_RESOURCE_DESCRIPTOR Source, - __in RESOURCE_TRANSLATION_DIRECTION Direction, - __in_opt ULONG AlternativesCount, - __in_ecount_opt(AlternativesCount) IO_RESOURCE_DESCRIPTOR Alternatives[], - __in PDEVICE_OBJECT PhysicalDeviceObject, - __out PCM_PARTIAL_RESOURCE_DESCRIPTOR Target -); - -typedef -NTSTATUS -(*PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER)( - __inout_opt PVOID Context, - __in PIO_RESOURCE_DESCRIPTOR Source, - __in PDEVICE_OBJECT PhysicalDeviceObject, - __out PULONG TargetCount, - __out_ecount(TargetCount) PIO_RESOURCE_DESCRIPTOR *Target -); - -// -// Translator Interface -// - -typedef struct _TRANSLATOR_INTERFACE { - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - PTRANSLATE_RESOURCE_HANDLER TranslateResources; - PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER TranslateResourceRequirements; -} TRANSLATOR_INTERFACE, *PTRANSLATOR_INTERFACE; - -// -// The following function prototypes are for HAL routines with a prefix of Hal. -// -// General functions. -// - -typedef -BOOLEAN -(*PHAL_RESET_DISPLAY_PARAMETERS) ( - __in ULONG Columns, - __in ULONG Rows - ); - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK -NTHALAPI -VOID -HalAcquireDisplayOwnership ( - __in PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters - ); -#endif - -#if defined(_IA64_) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use GetDmaRequirement -__drv_preferredFunction("GetDmaAlignment", "Obsolete") -NTHALAPI -ULONG -HalGetDmaAlignmentRequirement ( - VOID - ); -#endif - -#endif - -#if defined(_M_IX86) || defined(_M_AMD64) - -#define HalGetDmaAlignmentRequirement() 1L -#endif - -// -// I/O driver configuration functions. -// -#if !defined(NO_LEGACY_DRIVERS) -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use Pnp or IoReportDetectedDevice -__drv_preferredFunction("(see documentation)", "Obsolete") -NTHALAPI -NTSTATUS -HalAssignSlotResources ( - __in PUNICODE_STRING RegistryPath, - __in PUNICODE_STRING DriverClassName OPTIONAL, - __in PDRIVER_OBJECT DriverObject, - __in PDEVICE_OBJECT DeviceObject, - __in INTERFACE_TYPE BusType, - __in ULONG BusNumber, - __in ULONG SlotNumber, - __inout PCM_RESOURCE_LIST *AllocatedResources - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use Pnp or IoReportDetectedDevice -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction( - "IoReportDetectedDevice and IoReportResourceForDetection", "Obsolete") -NTHALAPI -ULONG -HalGetInterruptVector ( - __in INTERFACE_TYPE InterfaceType, - __in ULONG BusNumber, - __in ULONG BusInterruptLevel, - __in ULONG BusInterruptVector, - __out PKIRQL Irql, - __out PKAFFINITY Affinity - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use IRP_MN_QUERY_INTERFACE and IRP_MN_READ_CONFIG -__drv_when(BusDataType!=0, /* Cmos == 0 */ - __drv_preferredFunction( - "IRP_MN_QUERY_INTERFACE and IRP_MN_WRITE_CONFIG requests", - "Obsolete except for BusDataType==Cmos")) -NTHALAPI -ULONG -HalSetBusData ( - __in BUS_DATA_TYPE BusDataType, - __in ULONG BusNumber, - __in ULONG SlotNumber, - __in_bcount(Length) PVOID Buffer, - __in ULONG Length - ); -#endif - -#endif // NO_LEGACY_DRIVERS - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use IRP_MN_QUERY_INTERFACE and IRP_MN_READ_CONFIG -__drv_when(BusDataType!=0, /* Cmos == 0 */ - __drv_preferredFunction( - "IRP_MN_QUERY_INTERFACE and IRP_MN_WRITE_CONFIG requests", - "Obsolete except for BusDataType==Cmos")) -NTHALAPI -ULONG -HalSetBusDataByOffset ( - __in BUS_DATA_TYPE BusDataType, - __in ULONG BusNumber, - __in ULONG SlotNumber, - __in_bcount(Length) PVOID Buffer, - __in ULONG Offset, - __in ULONG Length - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use IRP_MN_QUERY_INTERFACE and IRP_MN_READ_CONFIG -__drv_preferredFunction("(see documentation)", "Obsolete") -NTHALAPI -BOOLEAN -HalTranslateBusAddress ( - __in INTERFACE_TYPE InterfaceType, - __in ULONG BusNumber, - __in PHYSICAL_ADDRESS BusAddress, - __inout PULONG AddressSpace, - __out PPHYSICAL_ADDRESS TranslatedAddress - ); -#endif - -// -// Values for AddressSpace parameter of HalTranslateBusAddress -// -// 0x0 - Memory space -// 0x1 - Port space -// 0x2 - 0x1F - Address spaces specific for Alpha -// 0x2 - UserMode view of memory space -// 0x3 - UserMode view of port space -// 0x4 - Dense memory space -// 0x5 - reserved -// 0x6 - UserMode view of dense memory space -// 0x7 - 0x1F - reserved -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTHALAPI -PVOID -HalAllocateCrashDumpRegisters ( - __in PADAPTER_OBJECT AdapterObject, - __inout PULONG NumberOfMapRegisters - ); -#endif - -#if !defined(NO_LEGACY_DRIVERS) -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use IRP_MN_QUERY_INTERFACE and IRP_MN_READ_CONFIG -__drv_when(BusDataType!=0, - __drv_preferredFunction( - "IRP_MN_QUERY_INTERFACE and IRP_MN_READ_CONFIG requests", - "Obsolete except for BusDataType==Cmos")) -NTHALAPI -ULONG -HalGetBusData ( - __in BUS_DATA_TYPE BusDataType, - __in ULONG BusNumber, - __in ULONG SlotNumber, - __out_bcount(Length) PVOID Buffer, - __in ULONG Length - ); -#endif -#endif // NO_LEGACY_DRIVERS - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use IRP_MN_QUERY_INTERFACE and IRP_MN_READ_CONFIG -__drv_when(BusDataType!=0, - __drv_preferredFunction("IRP_MN_QUERY_INTERFACE", - "Obsolete except for BusDataType==Cmos")) -NTHALAPI -ULONG -HalGetBusDataByOffset ( - __in BUS_DATA_TYPE BusDataType, - __in ULONG BusNumber, - __in ULONG SlotNumber, - __out_bcount(Length) PVOID Buffer, - __in ULONG Offset, - __in ULONG Length - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use IoGetDmaAdapter -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("IoGetDmaAdapter", "Obsolete") -NTHALAPI -PADAPTER_OBJECT -HalGetAdapter ( - __in PDEVICE_DESCRIPTION DeviceDescription, - __out PULONG NumberOfMapRegisters - ); -#endif - -// -// System beep functions. -// -#if !defined(NO_LEGACY_DRIVERS) -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK -NTHALAPI -BOOLEAN -HalMakeBeep( - __in ULONG Frequency - ); -#endif -#endif // NO_LEGACY_DRIVERS - -// -// The following function prototypes are for HAL routines with a prefix of Io. -// -// DMA adapter object functions. -// - -typedef -PBUS_HANDLER -(FASTCALL *pHalHandlerForBus) ( - __in INTERFACE_TYPE InterfaceType, - __in ULONG BusNumber - ); -typedef -VOID -(FASTCALL *pHalReferenceBusHandler) ( - __in PBUS_HANDLER BusHandler - ); - -//----------------------------------------------------------------------------- -// HAL Function dispatch -// - -typedef enum _HAL_QUERY_INFORMATION_CLASS { - HalInstalledBusInformation, - HalProfileSourceInformation, - HalInformationClassUnused1, - HalPowerInformation, - HalProcessorSpeedInformation, - HalCallbackInformation, - HalMapRegisterInformation, - HalMcaLogInformation, // Machine Check Abort Information - HalFrameBufferCachingInformation, - HalDisplayBiosInformation, - HalProcessorFeatureInformation, - HalNumaTopologyInterface, - HalErrorInformation, // General MCA, CMC, CPE Error Information. - HalCmcLogInformation, // Processor Corrected Machine Check Information - HalCpeLogInformation, // Corrected Platform Error Information - HalQueryMcaInterface, - HalQueryAMLIIllegalIOPortAddresses, - HalQueryMaxHotPlugMemoryAddress, - HalPartitionIpiInterface, - HalPlatformInformation, - HalQueryProfileSourceList, - HalInitLogInformation, - HalFrequencyInformation, - HalProcessorBrandString, - HalHypervisorInformation, - HalPlatformTimerInformation, - HalAcpiAuditInformation, - // information levels >= 0x8000000 reserved for OEM use -} HAL_QUERY_INFORMATION_CLASS, *PHAL_QUERY_INFORMATION_CLASS; - - -typedef enum _HAL_SET_INFORMATION_CLASS { - HalProfileSourceInterval, - HalProfileSourceInterruptHandler, // Register performance monitor interrupt callback - HalMcaRegisterDriver, // Register Machine Check Abort driver - HalKernelErrorHandler, - HalCmcRegisterDriver, // Register Processor Corrected Machine Check driver - HalCpeRegisterDriver, // Register Corrected Platform Error driver - HalMcaLog, - HalCmcLog, - HalCpeLog, - HalGenerateCmcInterrupt, // Used to test CMC - HalProfileSourceTimerHandler, // Resister profile timer interrupt callback - HalEnlightenment, - HalProfileDpgoSourceInterruptHandler // Register performance monitor interrupt callback for dpgo -} HAL_SET_INFORMATION_CLASS, *PHAL_SET_INFORMATION_CLASS; - - - -typedef -NTSTATUS -(*pHalQuerySystemInformation)( - __in HAL_QUERY_INFORMATION_CLASS InformationClass, - __in ULONG BufferSize, - __inout PVOID Buffer, - __out PULONG ReturnedLength - ); - - -typedef -NTSTATUS -(*pHalSetSystemInformation)( - __in HAL_SET_INFORMATION_CLASS InformationClass, - __in ULONG BufferSize, - __in PVOID Buffer - ); - - -typedef -VOID -(FASTCALL *pHalExamineMBR)( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG SectorSize, - __in ULONG MBRTypeIdentifier, - __out PVOID *Buffer - ); - -typedef -NTSTATUS -(FASTCALL *pHalIoReadPartitionTable)( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG SectorSize, - __in BOOLEAN ReturnRecognizedPartitions, - __out struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer - ); - -typedef -NTSTATUS -(FASTCALL *pHalIoSetPartitionInformation)( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG SectorSize, - __in ULONG PartitionNumber, - __in ULONG PartitionType - ); - -typedef -NTSTATUS -(FASTCALL *pHalIoWritePartitionTable)( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG SectorSize, - __in ULONG SectorsPerTrack, - __in ULONG NumberOfHeads, - __in struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer - ); - -typedef -NTSTATUS -(*pHalQueryBusSlots)( - __in PBUS_HANDLER BusHandler, - __in ULONG BufferSize, - __out PULONG SlotNumbers, - __out PULONG ReturnedLength - ); - -typedef -NTSTATUS -(*pHalInitPnpDriver)( - VOID - ); - - -typedef struct _PM_DISPATCH_TABLE { - ULONG Signature; - ULONG Version; - PVOID Function[1]; -} PM_DISPATCH_TABLE, *PPM_DISPATCH_TABLE; - - - -typedef -NTSTATUS -(*pHalInitPowerManagement)( - __in PPM_DISPATCH_TABLE PmDriverDispatchTable, - __out PPM_DISPATCH_TABLE *PmHalDispatchTable - ); - - -typedef -struct _DMA_ADAPTER * -(*pHalGetDmaAdapter)( - __in PVOID Context, - __in struct _DEVICE_DESCRIPTION *DeviceDescriptor, - __out PULONG NumberOfMapRegisters - ); - - -typedef -NTSTATUS -(*pHalGetInterruptTranslator)( - __in INTERFACE_TYPE ParentInterfaceType, - __in ULONG ParentBusNumber, - __in INTERFACE_TYPE BridgeInterfaceType, - __in USHORT Size, - __in USHORT Version, - __out PTRANSLATOR_INTERFACE Translator, - __out PULONG BridgeBusNumber - ); - - -typedef -BOOLEAN -(*pHalTranslateBusAddress)( - __in INTERFACE_TYPE InterfaceType, - __in ULONG BusNumber, - __in PHYSICAL_ADDRESS BusAddress, - __inout PULONG AddressSpace, - __out PPHYSICAL_ADDRESS TranslatedAddress - ); - -typedef -NTSTATUS -(*pHalAssignSlotResources) ( - __in PUNICODE_STRING RegistryPath, - __in PUNICODE_STRING DriverClassName OPTIONAL, - __in PDRIVER_OBJECT DriverObject, - __in PDEVICE_OBJECT DeviceObject, - __in INTERFACE_TYPE BusType, - __in ULONG BusNumber, - __in ULONG SlotNumber, - __inout PCM_RESOURCE_LIST *AllocatedResources - ); - -typedef -VOID -(*pHalHaltSystem) ( - VOID - ); - -typedef -BOOLEAN -(*pHalResetDisplay) ( - VOID - ); - - - -typedef struct _MAP_REGISTER_ENTRY { - PVOID MapRegister; - BOOLEAN WriteToDevice; -} MAP_REGISTER_ENTRY, *PMAP_REGISTER_ENTRY; - - - - -typedef -UCHAR -(*pHalVectorToIDTEntry) ( - ULONG Vector -); - -typedef -BOOLEAN -(*pHalFindBusAddressTranslation) ( - __in PHYSICAL_ADDRESS BusAddress, - __inout PULONG AddressSpace, - __out PPHYSICAL_ADDRESS TranslatedAddress, - __inout PULONG_PTR Context, - __in BOOLEAN NextBus - ); - -typedef -NTSTATUS -(*pHalStartMirroring)( - VOID - ); - -typedef -NTSTATUS -(*pHalEndMirroring)( - __in ULONG PassNumber - ); - -typedef -NTSTATUS -(*pHalMirrorPhysicalMemory)( - __in PHYSICAL_ADDRESS PhysicalAddress, - __in LARGE_INTEGER NumberOfBytes - ); - -typedef -NTSTATUS -(*pHalMirrorVerify)( - __in PHYSICAL_ADDRESS PhysicalAddress, - __in LARGE_INTEGER NumberOfBytes - ); - - -typedef struct { - UCHAR Type; //CmResourceType - BOOLEAN Valid; - UCHAR Reserved[2]; - PUCHAR TranslatedAddress; - ULONG Length; -} DEBUG_DEVICE_ADDRESS, *PDEBUG_DEVICE_ADDRESS; - -typedef struct { - PHYSICAL_ADDRESS Start; - PHYSICAL_ADDRESS MaxEnd; - PVOID VirtualAddress; - ULONG Length; - BOOLEAN Cached; - BOOLEAN Aligned; -} DEBUG_MEMORY_REQUIREMENTS, *PDEBUG_MEMORY_REQUIREMENTS; - -typedef struct { - ULONG Bus; - USHORT Segment; - ULONG Slot; - USHORT VendorID; - USHORT DeviceID; - UCHAR BaseClass; - UCHAR SubClass; - UCHAR ProgIf; - BOOLEAN Initialized; - BOOLEAN Configured; - DEBUG_DEVICE_ADDRESS BaseAddress[6]; - DEBUG_MEMORY_REQUIREMENTS Memory; -} DEBUG_DEVICE_DESCRIPTOR, *PDEBUG_DEVICE_DESCRIPTOR; - - - -typedef -NTSTATUS -(*pKdSetupPciDeviceForDebugging)( - __in PVOID LoaderBlock, OPTIONAL - __inout PDEBUG_DEVICE_DESCRIPTOR PciDevice -); - -typedef -NTSTATUS -(*pKdReleasePciDeviceForDebugging)( - __inout PDEBUG_DEVICE_DESCRIPTOR PciDevice -); - -typedef -PVOID -(*pKdGetAcpiTablePhase0)( - __in struct _LOADER_PARAMETER_BLOCK *LoaderBlock, - __in ULONG Signature - ); - -typedef -VOID -(*pKdCheckPowerButton)( - VOID - ); - -typedef -VOID -(*pHalEndOfBoot)( - VOID - ); - -typedef -PVOID -(*pKdMapPhysicalMemory64)( - __in PHYSICAL_ADDRESS PhysicalAddress, - __in ULONG NumberPages, - __in BOOLEAN FlushCurrentTLB - ); - -typedef -VOID -(*pKdUnmapVirtualAddress)( - __in PVOID VirtualAddress, - __in ULONG NumberPages, - __in BOOLEAN FlushCurrentTLB - ); - -typedef -ULONG -(*pKdGetPciDataByOffset)( - __in ULONG BusNumber, - __in ULONG SlotNumber, - __out_bcount(Length) PVOID Buffer, - __in ULONG Offset, - __in ULONG Length - ); - -typedef -ULONG -(*pKdSetPciDataByOffset)( - __in ULONG BusNumber, - __in ULONG SlotNumber, - __in_bcount(Length) PVOID Buffer, - __in ULONG Offset, - __in ULONG Length - ); - -typedef -PVOID -(*pHalGetAcpiTable)( - __in ULONG Signature, - __in_opt PCSTR OemId, - __in_opt PCSTR OemTableId - ); - -#if defined(_IA64_) -typedef -NTSTATUS -(*pHalGetErrorCapList)( - __inout PULONG CapsListLength, - __inout_bcount(*CapsListLength) PUCHAR ErrorCapList - ); - -typedef -NTSTATUS -(*pHalInjectError)( - __in ULONG BufferLength, - __in_bcount(BufferLength) PUCHAR Buffer - ); -#endif - -typedef -VOID -(*PCI_ERROR_HANDLER_CALLBACK)( - VOID - ); - -typedef -VOID -(*pHalSetPciErrorHandlerCallback)( - __in PCI_ERROR_HANDLER_CALLBACK Callback - ); - - - - -typedef struct { - ULONG Version; - pHalQuerySystemInformation HalQuerySystemInformation; - pHalSetSystemInformation HalSetSystemInformation; - pHalQueryBusSlots HalQueryBusSlots; - ULONG Spare1; - pHalExamineMBR HalExamineMBR; - pHalIoReadPartitionTable HalIoReadPartitionTable; - pHalIoSetPartitionInformation HalIoSetPartitionInformation; - pHalIoWritePartitionTable HalIoWritePartitionTable; - - pHalHandlerForBus HalReferenceHandlerForBus; - pHalReferenceBusHandler HalReferenceBusHandler; - pHalReferenceBusHandler HalDereferenceBusHandler; - - pHalInitPnpDriver HalInitPnpDriver; - pHalInitPowerManagement HalInitPowerManagement; - - pHalGetDmaAdapter HalGetDmaAdapter; - pHalGetInterruptTranslator HalGetInterruptTranslator; - - pHalStartMirroring HalStartMirroring; - pHalEndMirroring HalEndMirroring; - pHalMirrorPhysicalMemory HalMirrorPhysicalMemory; - pHalEndOfBoot HalEndOfBoot; - pHalMirrorVerify HalMirrorVerify; - - pHalGetAcpiTable HalGetCachedAcpiTable; - pHalSetPciErrorHandlerCallback HalSetPciErrorHandlerCallback; - -#if defined(_IA64_) - pHalGetErrorCapList HalGetErrorCapList; - pHalInjectError HalInjectError; -#endif - -} HAL_DISPATCH, *PHAL_DISPATCH; - - - -#if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_) - -extern PHAL_DISPATCH HalDispatchTable; -#define HALDISPATCH HalDispatchTable - -#else - -extern HAL_DISPATCH HalDispatchTable; -#define HALDISPATCH (&HalDispatchTable) - -#endif - -#define HAL_DISPATCH_VERSION 4 - -#define HalDispatchTableVersion HALDISPATCH->Version -#define HalQuerySystemInformation HALDISPATCH->HalQuerySystemInformation -#define HalSetSystemInformation HALDISPATCH->HalSetSystemInformation -#define HalQueryBusSlots HALDISPATCH->HalQueryBusSlots - -#define HalReferenceHandlerForBus HALDISPATCH->HalReferenceHandlerForBus -#define HalReferenceBusHandler HALDISPATCH->HalReferenceBusHandler -#define HalDereferenceBusHandler HALDISPATCH->HalDereferenceBusHandler - -#define HalInitPnpDriver HALDISPATCH->HalInitPnpDriver -#define HalInitPowerManagement HALDISPATCH->HalInitPowerManagement - -#define HalGetDmaAdapter HALDISPATCH->HalGetDmaAdapter -#define HalGetInterruptTranslator HALDISPATCH->HalGetInterruptTranslator - -#define HalStartMirroring HALDISPATCH->HalStartMirroring -#define HalEndMirroring HALDISPATCH->HalEndMirroring -#define HalMirrorPhysicalMemory HALDISPATCH->HalMirrorPhysicalMemory -#define HalEndOfBoot HALDISPATCH->HalEndOfBoot -#define HalMirrorVerify HALDISPATCH->HalMirrorVerify - -#define HalGetCachedAcpiTable HALDISPATCH->HalGetCachedAcpiTable -#define HalSetPciErrorHandlerCallback HALDISPATCH->HalSetPciErrorHandlerCallback - -#if defined(_IA64_) -#define HalGetErrorCapList HALDISPATCH->HalGetErrorCapList -#define HalInjectError HALDISPATCH->HalInjectError -#endif - - -// -// HAL System Information Structures. -// - -// for the information class "HalInstalledBusInformation" -typedef struct _HAL_BUS_INFORMATION{ - INTERFACE_TYPE BusType; - BUS_DATA_TYPE ConfigurationType; - ULONG BusNumber; - ULONG Reserved; -} HAL_BUS_INFORMATION, *PHAL_BUS_INFORMATION; - -// for the information class "HalProfileSourceInformation" -typedef struct _HAL_PROFILE_SOURCE_INFORMATION { - KPROFILE_SOURCE Source; - BOOLEAN Supported; - ULONG Interval; -} HAL_PROFILE_SOURCE_INFORMATION, *PHAL_PROFILE_SOURCE_INFORMATION; - -// for the information class "HalProfileSourceInformation" -typedef struct _HAL_PROFILE_SOURCE_INFORMATION_EX { - KPROFILE_SOURCE Source; - BOOLEAN Supported; - ULONG_PTR Interval; - ULONG_PTR DefInterval; - ULONG_PTR MaxInterval; - ULONG_PTR MinInterval; -} HAL_PROFILE_SOURCE_INFORMATION_EX, *PHAL_PROFILE_SOURCE_INFORMATION_EX; - -// for the information class "HalProfileSourceInterval" -typedef struct _HAL_PROFILE_SOURCE_INTERVAL { - KPROFILE_SOURCE Source; - ULONG_PTR Interval; -} HAL_PROFILE_SOURCE_INTERVAL, *PHAL_PROFILE_SOURCE_INTERVAL; - -// for the information class "HalQueryProfileSourceList" -typedef struct _HAL_PROFILE_SOURCE_LIST { - KPROFILE_SOURCE Source; - PWSTR Description; -} HAL_PROFILE_SOURCE_LIST, *PHAL_PROFILE_SOURCE_LIST; - -// for the information class "HalDispayBiosInformation" -typedef enum _HAL_DISPLAY_BIOS_INFORMATION { - HalDisplayInt10Bios, - HalDisplayEmulatedBios, - HalDisplayNoBios -} HAL_DISPLAY_BIOS_INFORMATION, *PHAL_DISPLAY_BIOS_INFORMATION; - -// for the information class "HalPowerInformation" -typedef struct _HAL_POWER_INFORMATION { - ULONG TBD; -} HAL_POWER_INFORMATION, *PHAL_POWER_INFORMATION; - -// for the information class "HalProcessorSpeedInformation" -typedef struct _HAL_PROCESSOR_SPEED_INFO { - ULONG ProcessorSpeed; -} HAL_PROCESSOR_SPEED_INFORMATION, *PHAL_PROCESSOR_SPEED_INFORMATION; - -// for the information class "HalCallbackInformation" -typedef struct _HAL_CALLBACKS { - PCALLBACK_OBJECT SetSystemInformation; - PCALLBACK_OBJECT BusCheck; -} HAL_CALLBACKS, *PHAL_CALLBACKS; - -// for the information class "HalProcessorFeatureInformation" -typedef struct _HAL_PROCESSOR_FEATURE { - ULONG UsableFeatureBits; -} HAL_PROCESSOR_FEATURE; - - -typedef -NTSTATUS -(*PHALIOREADWRITEHANDLER)( - __in BOOLEAN fRead, - __in ULONG dwAddr, - __in ULONG dwSize, - __inout PULONG pdwData - ); - - - -// for the information class "HalQueryIllegalIOPortAddresses" -typedef struct _HAL_AMLI_BAD_IO_ADDRESS_LIST -{ - ULONG BadAddrBegin; - ULONG BadAddrSize; - ULONG OSVersionTrigger; - PHALIOREADWRITEHANDLER IOHandler; -} HAL_AMLI_BAD_IO_ADDRESS_LIST, *PHAL_AMLI_BAD_IO_ADDRESS_LIST; - - - - -#if defined(_X86_) || defined(_IA64_) || defined(_AMD64_) - -// -// HalQueryMcaInterface -// - -typedef -VOID -(*PHALMCAINTERFACELOCK)( - VOID - ); - -typedef -VOID -(*PHALMCAINTERFACEUNLOCK)( - VOID - ); - -typedef -NTSTATUS -(*PHALMCAINTERFACEREADREGISTER)( - __in UCHAR BankNumber, - __inout PVOID Exception - ); - - -typedef struct _HAL_MCA_INTERFACE { - PHALMCAINTERFACELOCK Lock; - PHALMCAINTERFACEUNLOCK Unlock; - PHALMCAINTERFACEREADREGISTER ReadRegister; -} HAL_MCA_INTERFACE; - -typedef enum { - ApicDestinationModePhysical = 1, - ApicDestinationModeLogicalFlat, - ApicDestinationModeLogicalClustered, - ApicDestinationModeUnknown -} HAL_APIC_DESTINATION_MODE, *PHAL_APIC_DESTINATION_MODE; - - -#if defined(_AMD64_) - -struct _KTRAP_FRAME; -struct _KEXCEPTION_FRAME; - -typedef -ERROR_SEVERITY -(*PDRIVER_EXCPTN_CALLBACK) ( - __in PVOID Context, - __in struct _KTRAP_FRAME *TrapFrame, - __in struct _KEXCEPTION_FRAME *ExceptionFrame, - __in PMCA_EXCEPTION Exception -); - -#endif - -#if defined(_X86_) || defined(_IA64_) - -typedef -#if defined(_IA64_) -ERROR_SEVERITY -#else -VOID -#endif -(*PDRIVER_EXCPTN_CALLBACK) ( - __in PVOID Context, - __in PMCA_EXCEPTION BankLog -); - -#endif - -typedef PDRIVER_EXCPTN_CALLBACK PDRIVER_MCA_EXCEPTION_CALLBACK; - - -// -// Structure to record the callbacks from driver -// - -typedef struct _MCA_DRIVER_INFO { - PDRIVER_MCA_EXCEPTION_CALLBACK ExceptionCallback; - PKDEFERRED_ROUTINE DpcCallback; - PVOID DeviceContext; -} MCA_DRIVER_INFO, *PMCA_DRIVER_INFO; - - - -typedef struct _HAL_ERROR_INFO { - ULONG Version; // Version of this structure - ULONG InitMaxSize; // Maximum size of the INIT record. - ULONG McaMaxSize; // Maximum size of a Machine Check Abort record - ULONG McaPreviousEventsCount; // Flag indicating previous or early-boot MCA event logs. - ULONG McaCorrectedEventsCount; // Number of corrected MCA events since boot. approx. - ULONG McaKernelDeliveryFails; // Number of Kernel callback failures. approx. - ULONG McaDriverDpcQueueFails; // Number of OEM MCA Driver Dpc queueing failures. approx. - ULONG McaReserved; - ULONG CmcMaxSize; // Maximum size of a Corrected Machine Check record - ULONG CmcPollingInterval; // In units of seconds - ULONG CmcInterruptsCount; // Number of CMC interrupts. approx. - ULONG CmcKernelDeliveryFails; // Number of Kernel callback failures. approx. - ULONG CmcDriverDpcQueueFails; // Number of OEM CMC Driver Dpc queueing failures. approx. - ULONG CmcGetStateFails; // Number of failures in getting the log from FW. - ULONG CmcClearStateFails; // Number of failures in clearing the log from FW. - ULONG CmcReserved; - ULONGLONG CmcLogId; // Last seen record identifier. - ULONG CpeMaxSize; // Maximum size of a Corrected Platform Event record - ULONG CpePollingInterval; // In units of seconds - ULONG CpeInterruptsCount; // Number of CPE interrupts. approx. - ULONG CpeKernelDeliveryFails; // Number of Kernel callback failures. approx. - ULONG CpeDriverDpcQueueFails; // Number of OEM CPE Driver Dpc queueing failures. approx. - ULONG CpeGetStateFails; // Number of failures in getting the log from FW. - ULONG CpeClearStateFails; // Number of failures in clearing the log from FW. - ULONG CpeInterruptSources; // Number of SAPIC Platform Interrupt Sources - ULONGLONG CpeLogId; // Last seen record identifier. - ULONGLONG KernelReserved[4]; -} HAL_ERROR_INFO, *PHAL_ERROR_INFO; - - - -#define HAL_MCE_INTERRUPTS_BASED ((ULONG)-1) -#define HAL_MCE_DISABLED ((ULONG)0) - -// -// Known values for HAL_ERROR_INFO.CmcPollingInterval. -// - -#define HAL_CMC_INTERRUPTS_BASED HAL_MCE_INTERRUPTS_BASED -#define HAL_CMC_DISABLED HAL_MCE_DISABLED - -// -// Known values for HAL_ERROR_INFO.CpePollingInterval. -// - -#define HAL_CPE_INTERRUPTS_BASED HAL_MCE_INTERRUPTS_BASED -#define HAL_CPE_DISABLED HAL_MCE_DISABLED - -#define HAL_MCA_INTERRUPTS_BASED HAL_MCE_INTERRUPTS_BASED -#define HAL_MCA_DISABLED HAL_MCE_DISABLED - - - -// -// Driver Callback type for the information class "HalCmcRegisterDriver" -// - -typedef -VOID -(*PDRIVER_CMC_EXCEPTION_CALLBACK) ( - __in PVOID Context, - __in PCMC_EXCEPTION CmcLog -); - -// -// Driver Callback type for the information class "HalCpeRegisterDriver" -// - -typedef -VOID -(*PDRIVER_CPE_EXCEPTION_CALLBACK) ( - __in PVOID Context, - __in PCPE_EXCEPTION CmcLog -); - - -// -// -// Structure to record the callbacks from driver -// - -typedef struct _CMC_DRIVER_INFO { - PDRIVER_CMC_EXCEPTION_CALLBACK ExceptionCallback; - PKDEFERRED_ROUTINE DpcCallback; - PVOID DeviceContext; -} CMC_DRIVER_INFO, *PCMC_DRIVER_INFO; - -typedef struct _CPE_DRIVER_INFO { - PDRIVER_CPE_EXCEPTION_CALLBACK ExceptionCallback; - PKDEFERRED_ROUTINE DpcCallback; - PVOID DeviceContext; -} CPE_DRIVER_INFO, *PCPE_DRIVER_INFO; - - - -#endif // defined(_X86_) || defined(_IA64_) || defined(_AMD64_) - - - -#if defined(_IA64_) - -typedef -NTSTATUS -(*HALSENDCROSSPARTITIONIPI)( - __in USHORT ProcessorID, - __in UCHAR HardwareVector - ); - -typedef -NTSTATUS -(*HALRESERVECROSSPARTITIONINTERRUPTVECTOR)( - __out PULONG Vector, - __out PKIRQL Irql, - __inout PGROUP_AFFINITY Affinity, - __out PUCHAR HardwareVector - ); - -typedef -VOID -(*HALFREECROSSPARTITIONINTERRUPTVECTOR)( - __in ULONG Vector, - __in PGROUP_AFFINITY Affinity - ); - -typedef struct _HAL_CROSS_PARTITION_IPI_INTERFACE { - HALSENDCROSSPARTITIONIPI HalSendCrossPartitionIpi; - HALRESERVECROSSPARTITIONINTERRUPTVECTOR HalReserveCrossPartitionInterruptVector; - HALFREECROSSPARTITIONINTERRUPTVECTOR HalFreeCrossPartitionInterruptVector; -} HAL_CROSS_PARTITION_IPI_INTERFACE; - -#define HAL_CROSS_PARTITION_IPI_INTERFACE_MINIMUM_SIZE \ - FIELD_OFFSET(HAL_CROSS_PARTITION_IPI_INTERFACE, \ - HalFreeCrossPartitionInterruptVector) - -#endif - -typedef struct _HAL_PLATFORM_INFORMATION { - ULONG PlatformFlags; -} HAL_PLATFORM_INFORMATION, *PHAL_PLATFORM_INFORMATION; - - - -// -// These platform flags are carried over from the IPPT table -// definition if appropriate. -// - -#define HAL_PLATFORM_DISABLE_WRITE_COMBINING 0x01L -#define HAL_PLATFORM_DISABLE_PTCG 0x04L -#define HAL_PLATFORM_DISABLE_UC_MAIN_MEMORY 0x08L -#define HAL_PLATFORM_ENABLE_WRITE_COMBINING_MMIO 0x10L -#define HAL_PLATFORM_ACPI_TABLES_CACHED 0x20L - - - -#if defined(_WIN64) - -// -// Use __inline DMA macros (hal.h) -// -#ifndef USE_DMA_MACROS -#define USE_DMA_MACROS -#endif - -// -// Only PnP drivers! -// -#ifndef NO_LEGACY_DRIVERS -#define NO_LEGACY_DRIVERS -#endif - -#endif // _WIN64 - -#if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_) - -#else - -// -// DMA adapter object functions. -// -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use AllocateAdapterChannel -NTHALAPI -NTSTATUS -HalAllocateAdapterChannel( - __in PADAPTER_OBJECT AdapterObject, - __in PWAIT_CONTEXT_BLOCK Wcb, - __in ULONG NumberOfMapRegisters, - __in PDRIVER_CONTROL ExecutionRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use AllocateCommonBuffer -__drv_preferredFunction("AllocateCommonBuffer","Obsolete") -NTHALAPI -PVOID -HalAllocateCommonBuffer( - __in PADAPTER_OBJECT AdapterObject, - __in ULONG Length, - __out PPHYSICAL_ADDRESS LogicalAddress, - __in BOOLEAN CacheEnabled - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use FreeCommonBuffer -__drv_preferredFunction("FreeCommonBuffer","Obsolete") -NTHALAPI -VOID -HalFreeCommonBuffer( - __in PADAPTER_OBJECT AdapterObject, - __in ULONG Length, - __in PHYSICAL_ADDRESS LogicalAddress, - __in PVOID VirtualAddress, - __in BOOLEAN CacheEnabled - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use ReadDmaCounter -__drv_preferredFunction("ReadDmaCounter","Obsolete") -NTHALAPI -ULONG -HalReadDmaCounter( - __in PADAPTER_OBJECT AdapterObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use FlushAdapterBuffers -__drv_preferredFunction("FlushAdapterBuffers","Obsolete") -NTHALAPI -BOOLEAN -IoFlushAdapterBuffers( - __in PADAPTER_OBJECT AdapterObject, - __in PMDL Mdl, - __in PVOID MapRegisterBase, - __in PVOID CurrentVa, - __in ULONG Length, - __in BOOLEAN WriteToDevice - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use FreeAdapterChannel -__drv_preferredFunction("FreeAdapterChannel","Obsolete") -NTHALAPI -VOID -IoFreeAdapterChannel( - __in PADAPTER_OBJECT AdapterObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use FreeMapRegisters -__drv_preferredFunction("FreeMapRegisters","Obsolete") -NTHALAPI -VOID -IoFreeMapRegisters( - __in PADAPTER_OBJECT AdapterObject, - __in PVOID MapRegisterBase, - __in ULONG NumberOfMapRegisters - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use MapTransfer -__drv_preferredFunction("MapTransfer","Obsolete") -NTHALAPI -PHYSICAL_ADDRESS -IoMapTransfer( - __in PADAPTER_OBJECT AdapterObject, - __in PMDL Mdl, - __in PVOID MapRegisterBase, - __in PVOID CurrentVa, - __inout PULONG Length, - __in BOOLEAN WriteToDevice - ); -#endif - -#endif // USE_DMA_MACROS && (_NTDDK_ || _NTDRIVER_) - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK -NTSTATUS -HalGetScatterGatherList ( // Use GetScatterGatherList - __in PADAPTER_OBJECT DmaAdapter, - __in PDEVICE_OBJECT DeviceObject, - __in PMDL Mdl, - __in PVOID CurrentVa, - __in ULONG Length, - __in PDRIVER_LIST_CONTROL ExecutionRoutine, - __in PVOID Context, - __in BOOLEAN WriteToDevice - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use PutScatterGatherList -VOID -HalPutScatterGatherList ( - __in PADAPTER_OBJECT DmaAdapter, - __in PSCATTER_GATHER_LIST ScatterGather, - __in BOOLEAN WriteToDevice - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use PutDmaAdapter -VOID -HalPutDmaAdapter( - __in PADAPTER_OBJECT DmaAdapter - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -typedef struct _WHEA_ERROR_SOURCE_DESCRIPTOR *PWHEA_ERROR_SOURCE_DESCRIPTOR; -typedef struct _WHEA_ERROR_RECORD *PWHEA_ERROR_RECORD; - -NTHALAPI -VOID -HalBugCheckSystem ( - __in PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource, - __in PWHEA_ERROR_RECORD ErrorRecord - ); - -#else - -typedef struct _WHEA_ERROR_RECORD *PWHEA_ERROR_RECORD; - -NTHALAPI -VOID -HalBugCheckSystem ( - __in PWHEA_ERROR_RECORD ErrorRecord - ); - -#endif - - -typedef enum _PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE { - ResourceTypeSingle = 0, - ResourceTypeRange, - ResourceTypeExtendedCounterConfiguration, - ResourceTypeOverflow, - ResourceTypeMax -} PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE; - -/*++ - -Physical Counter Resource Descriptor Types: - - Describes the format of a physical counter resource. - - PhysicalCounterResourceTypeSingle - The decriptor specifies a single - physical counter in the the u.CounterIndex member. - - PhysicalCounterResourceTypeRange - The descriptor specifies a range of - counter indices in the u.Range member. - - PhysicalCounterResourceTypeExtendedConfiguration - The descriptor specifies - an extended counter configuration register address in in the - u.ExtendedRegisterAddress member. Only used on Intel NetBurst systems. - - PhysicalCounterResourceTypeOverflow - The descriptor specifies a counter - overflow interrupt. - ---*/ - -typedef struct _PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR { - PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE Type; - ULONG Flags; - union { - ULONG CounterIndex; - ULONG ExtendedRegisterAddress; - struct { - ULONG Begin; - ULONG End; - } Range; - } u; -} PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR, *PPHYSICAL_COUNTER_RESOURCE_DESCRIPTOR; - -/*++ - -Physical Counter Resource Descriptor: - - Data structure used to describe physical counter resources on the platform. - -Fields: - - Type - Supplies the type of counter resource described. - - Flags - Reserved for future use. - - CounterIndex - Supplies a physical counter index. - - ExtendedRegisterAddress - Supplies an extended configuration register index. - - Range - Supplies a range of counter indices or register addresses. - ---*/ - -typedef struct _PHYSICAL_COUNTER_RESOURCE_LIST { - ULONG Count; - PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR Descriptors[ANYSIZE_ARRAY]; -} PHYSICAL_COUNTER_RESOURCE_LIST, *PPHYSICAL_COUNTER_RESOURCE_LIST; - -/*++ - -Physical Counter Resource List: - - Data structure used to report or request a set of physical counter - resources on the platform. - -Fields: - - Count - Supplies the number of physical counter resources in the list. - - Descriptors - Supplies the a variable length array of physical counter - descriptors. - ---*/ - -NTSTATUS -HalAllocateHardwareCounters ( - __in_ecount(GroupCount) PGROUP_AFFINITY GroupAffinty, - __in ULONG GroupCount, - __in PPHYSICAL_COUNTER_RESOURCE_LIST ResourceList, - __out PHANDLE CounterSetHandle - ); - -NTSTATUS -HalFreeHardwareCounters ( - __in HANDLE CounterSetHandle - ); - -// -// Determine if there is a complete device failure on an error. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTKERNELAPI -BOOLEAN -FsRtlIsTotalDeviceFailure( - __in NTSTATUS Status - ); -#endif - - -// -// AGP Capabilities -// -typedef struct _PCI_AGP_CAPABILITY { - - PCI_CAPABILITIES_HEADER Header; - - USHORT Minor:4; - USHORT Major:4; - USHORT Rsvd1:8; - - struct _PCI_AGP_STATUS { - ULONG Rate:3; - ULONG Agp3Mode:1; - ULONG FastWrite:1; - ULONG FourGB:1; - ULONG HostTransDisable:1; - ULONG Gart64:1; - ULONG ITA_Coherent:1; - ULONG SideBandAddressing:1; // SBA - ULONG CalibrationCycle:3; - ULONG AsyncRequestSize:3; - ULONG Rsvd1:1; - ULONG Isoch:1; - ULONG Rsvd2:6; - ULONG RequestQueueDepthMaximum:8; // RQ - } AGPStatus; - - struct _PCI_AGP_COMMAND { - ULONG Rate:3; - ULONG Rsvd1:1; - ULONG FastWriteEnable:1; - ULONG FourGBEnable:1; - ULONG Rsvd2:1; - ULONG Gart64:1; - ULONG AGPEnable:1; - ULONG SBAEnable:1; - ULONG CalibrationCycle:3; - ULONG AsyncReqSize:3; - ULONG Rsvd3:8; - ULONG RequestQueueDepth:8; - } AGPCommand; - -} PCI_AGP_CAPABILITY, *PPCI_AGP_CAPABILITY; - -// -// An AGPv3 Target must have an extended capability, -// but it's only present for a Master when the Isoch -// bit is set in its status register -// -typedef enum _EXTENDED_AGP_REGISTER { - IsochStatus, - AgpControl, - ApertureSize, - AperturePageSize, - GartLow, - GartHigh, - IsochCommand -} EXTENDED_AGP_REGISTER, *PEXTENDED_AGP_REGISTER; - -typedef struct _PCI_AGP_ISOCH_STATUS { - ULONG ErrorCode: 2; - ULONG Rsvd1: 1; - ULONG Isoch_L: 3; - ULONG Isoch_Y: 2; - ULONG Isoch_N: 8; - ULONG Rsvd2: 16; -} PCI_AGP_ISOCH_STATUS, *PPCI_AGP_ISOCH_STATUS; - -typedef struct _PCI_AGP_CONTROL { - ULONG Rsvd1: 7; - ULONG GTLB_Enable: 1; - ULONG AP_Enable: 1; - ULONG CAL_Disable: 1; - ULONG Rsvd2: 22; -} PCI_AGP_CONTROL, *PPCI_AGP_CONTROL; - -typedef struct _PCI_AGP_APERTURE_PAGE_SIZE { - USHORT PageSizeMask: 11; - USHORT Rsvd1: 1; - USHORT PageSizeSelect: 4; -} PCI_AGP_APERTURE_PAGE_SIZE, *PPCI_AGP_APERTURE_PAGE_SIZE; - -typedef struct _PCI_AGP_ISOCH_COMMAND { - USHORT Rsvd1: 6; - USHORT Isoch_Y: 2; - USHORT Isoch_N: 8; -} PCI_AGP_ISOCH_COMMAND, *PPCI_AGP_ISOCH_COMMAND; - -typedef struct PCI_AGP_EXTENDED_CAPABILITY { - - PCI_AGP_ISOCH_STATUS IsochStatus; - -// -// Target only ----------------<<-begin->> -// - PCI_AGP_CONTROL AgpControl; - USHORT ApertureSize; - PCI_AGP_APERTURE_PAGE_SIZE AperturePageSize; - ULONG GartLow; - ULONG GartHigh; -// -// ------------------------------<<-end->> -// - - PCI_AGP_ISOCH_COMMAND IsochCommand; - -} PCI_AGP_EXTENDED_CAPABILITY, *PPCI_AGP_EXTENDED_CAPABILITY; - - -#define PCI_AGP_RATE_1X 0x1 -#define PCI_AGP_RATE_2X 0x2 -#define PCI_AGP_RATE_4X 0x4 - - -// -// PCI-X Bridge Capability -// - -// -// Values for BusModeFrequency in the SecondaryStatus register -// -#define PCIX_MODE_CONVENTIONAL_PCI 0x0 -#define PCIX_MODE1_66MHZ 0x1 -#define PCIX_MODE1_100MHZ 0x2 -#define PCIX_MODE1_133MHZ 0x3 -#define PCIX_MODE2_266_66MHZ 0x9 -#define PCIX_MODE2_266_100MHZ 0xA -#define PCIX_MODE2_266_133MHZ 0xB -#define PCIX_MODE2_533_66MHZ 0xD -#define PCIX_MODE2_533_100MHZ 0xE -#define PCIX_MODE2_533_133MHZ 0xF - -// -// Values for the Version in the SecondaryStatus register -// -#define PCIX_VERSION_MODE1_ONLY 0x0 -#define PCIX_VERSION_MODE2_ECC 0x1 -#define PCIX_VERSION_DUAL_MODE_ECC 0x2 - -typedef struct _PCIX_BRIDGE_CAPABILITY { - - PCI_CAPABILITIES_HEADER Header; - - union { - struct { - USHORT Bus64Bit:1; - USHORT Bus133MHzCapable:1; - USHORT SplitCompletionDiscarded:1; - USHORT UnexpectedSplitCompletion:1; - USHORT SplitCompletionOverrun:1; - USHORT SplitRequestDelayed:1; - USHORT BusModeFrequency:4; // PCIX_MODE_x - USHORT Rsvd:2; - USHORT Version:2; // PCIX_VERSION_x - USHORT Bus266MHzCapable:1; - USHORT Bus533MHzCapable:1; - } DUMMYSTRUCTNAME; - USHORT AsUSHORT; - } SecondaryStatus; - - union { - struct { - ULONG FunctionNumber:3; - ULONG DeviceNumber:5; - ULONG BusNumber:8; - ULONG Device64Bit:1; - ULONG Device133MHzCapable:1; - ULONG SplitCompletionDiscarded:1; - ULONG UnexpectedSplitCompletion:1; - ULONG SplitCompletionOverrun:1; - ULONG SplitRequestDelayed:1; - ULONG Rsvd:7; - ULONG DIMCapable:1; - ULONG Device266MHzCapable:1; - ULONG Device533MHzCapable:1; - } DUMMYSTRUCTNAME; - ULONG AsULONG; - } BridgeStatus; - - USHORT UpstreamSplitTransactionCapacity; - USHORT UpstreamSplitTransactionLimit; - - USHORT DownstreamSplitTransactionCapacity; - USHORT DownstreamSplitTransactionLimit; - - union { - struct { - ULONG SelectSecondaryRegisters:1; - ULONG ErrorPresentInOtherBank:1; - ULONG AdditionalCorrectableError:1; - ULONG AdditionalUncorrectableError:1; - ULONG ErrorPhase:3; - ULONG ErrorCorrected:1; - ULONG Syndrome:8; - ULONG ErrorFirstCommand:4; - ULONG ErrorSecondCommand:4; - ULONG ErrorUpperAttributes:4; - ULONG ControlUpdateEnable:1; - ULONG Rsvd:1; - ULONG DisableSingleBitCorrection:1; - ULONG EccMode:1; - } DUMMYSTRUCTNAME; - ULONG AsULONG; - } EccControlStatus; - - ULONG EccFirstAddress; - ULONG EccSecondAddress; - ULONG EccAttribute; - -} PCIX_BRIDGE_CAPABILITY, *PPCIX_BRIDGE_CAPABILITY; - -// -// PCI to PCI Bridge Subsystem ID Capability -// -typedef struct _PCI_SUBSYSTEM_IDS_CAPABILITY { - - PCI_CAPABILITIES_HEADER Header; - USHORT Reserved; - USHORT SubVendorID; - USHORT SubSystemID; - -} PCI_SUBSYSTEM_IDS_CAPABILITY, *PPCI_SUBSYSTEM_IDS_CAPABILITY; - -// -// _OSC is used by OSPM to query the capabilities of a device and to -// communicate the features supported by the device driver to the platform. -// The _OSC interface for PCI host bridge devices that originate PCI, PCI-X or -// PCI Express hierarchies is identified by a UUID of {33db4d5b-1ff7-401c-9657- -// 7441c03dd766}. A revision ID of 1 indicates that the capabilities buffer is -// composed of 3 DWORDs. -// The first DWORD is common across all OSC implementations and includes status -// and error information. -// The second DWORD (Support Field) provides information regarding OS supported -// features. -// The third DWORD (Control Field) is used to submit request for control of -// associated features. If any bits in the control field are returned cleared, -// then the respective feature is unsupported by the platform and must not be -// enabled. -// According to the PCI Firmware Specification a machine with multiple host -// bridge devices should report the same capabilities for all host bridges -// and also negotiate control of the features in the same way. -// - -#define OSC_FIRMWARE_FAILURE 0x02 -#define OSC_UNRECOGNIZED_UUID 0x04 -#define OSC_UNRECOGNIZED_REVISION 0x08 -#define OSC_CAPABILITIES_MASKED 0x10 - -#define PCI_ROOT_BUS_OSC_METHOD_CAPABILITY_REVISION 0x01 - -// -// The following declarations pertain to the second and third DWORD in -// evaluation of _OSC for PCI host bridge devices. -// - -typedef struct _PCI_ROOT_BUS_OSC_SUPPORT_FIELD { - union { - struct { - ULONG ExtendedConfigOpRegions:1; - ULONG ActiveStatePowerManagement:1; - ULONG ClockPowerManagement:1; - ULONG SegmentGroups:1; - ULONG MessageSignaledInterrupts:1; - ULONG WindowsHardwareErrorArchitecture:1; - ULONG Reserved:26; - } DUMMYSTRUCTNAME; - ULONG AsULONG; - } u; -} PCI_ROOT_BUS_OSC_SUPPORT_FIELD, *PPCI_ROOT_BUS_OSC_SUPPORT_FIELD; - -typedef struct _PCI_ROOT_BUS_OSC_CONTROL_FIELD { - union { - struct { - ULONG ExpressNativeHotPlug:1; - ULONG ShpcNativeHotPlug:1; - ULONG ExpressNativePME:1; - ULONG ExpressAdvancedErrorReporting:1; - ULONG ExpressCapabilityStructure:1; - ULONG Reserved:27; - } DUMMYSTRUCTNAME; - ULONG AsULONG; - } u; -} PCI_ROOT_BUS_OSC_CONTROL_FIELD, *PPCI_ROOT_BUS_OSC_CONTROL_FIELD; - -// -// An enumerator for the PCI physical and electrical interface. -// - -typedef enum _PCI_HARDWARE_INTERFACE { - - PciConventional, - PciXMode1, - PciXMode2, - PciExpress - -} PCI_HARDWARE_INTERFACE, *PPCI_HARDWARE_INTERFACE; - -typedef enum { - - BusWidth32Bits, - BusWidth64Bits - -} PCI_BUS_WIDTH; - -typedef struct _PCI_ROOT_BUS_HARDWARE_CAPABILITY { - - // - // Describes the secondary side of a PCI root bus. - // - - PCI_HARDWARE_INTERFACE SecondaryInterface; - - // - // These additional capabilities are available when each of the following - // is true. - // 1. The secondary side of a PCI root bus operates in conventional or - // PCI-X mode. - // 2. The PCI root bus has a hardware ID or compatible ID of PNP0A03. - // 3. A _DSM function 4 is defined for the root bus. - // - - struct { - - // - // This boolean indicates if the remaining fields describing the bus - // capabilities are valid or not. - // - - BOOLEAN BusCapabilitiesFound; - - - // - // Provides information on current and supported speeds/modes. - // - - ULONG CurrentSpeedAndMode; - ULONG SupportedSpeedsAndModes; - - // - // Describes the root bus capability on forwarding of Device ID message - // transactions. - // - - BOOLEAN DeviceIDMessagingCapable; - - // - // Provides the width for a PCI interface. - // - - PCI_BUS_WIDTH SecondaryBusWidth; - } DUMMYSTRUCTNAME; - - // - // Fields describing features supported as well as control for them from - // the bios. - // - - PCI_ROOT_BUS_OSC_SUPPORT_FIELD OscFeatureSupport; - PCI_ROOT_BUS_OSC_CONTROL_FIELD OscControlRequest; - PCI_ROOT_BUS_OSC_CONTROL_FIELD OscControlGranted; - -} PCI_ROOT_BUS_HARDWARE_CAPABILITY, *PPCI_ROOT_BUS_HARDWARE_CAPABILITY; - -// -// PCI Express Capability -// - -typedef union _PCI_EXPRESS_CAPABILITIES_REGISTER { - - struct { - - USHORT CapabilityVersion:4; - USHORT DeviceType:4; // PCI_EXPRESS_DEVICE_TYPE - USHORT SlotImplemented:1; - USHORT InterruptMessageNumber:5; - USHORT Rsvd:2; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_CAPABILITIES_REGISTER, *PPCI_EXPRESS_CAPABILITIES_REGISTER; - -typedef union _PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER { - - struct { - - ULONG MaxPayloadSizeSupported:3; // EXPRESS_MAX_PAYLOAD_SIZE - ULONG PhantomFunctionsSupported:2; - ULONG ExtendedTagSupported:1; - ULONG L0sAcceptableLatency:3; // EXPRESS_L0S_LATENCY - ULONG L1AcceptableLatency:3; // EXPRESS_L1_LATENCY - ULONG Undefined:3; - ULONG RoleBasedErrorReporting:1; - ULONG Rsvd1:2; - ULONG CapturedSlotPowerLimit:8; - ULONG CapturedSlotPowerLimitScale:2; - ULONG Rsvd2:4; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER, *PPCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER; - -// -// The low 3 bits of the PCI Express device control register dictate whether -// a device that implements AER routes error messages to the root complex. -// This mask is used when programming the AER bits in the device control -// register. -// - -#define PCI_EXPRESS_AER_DEVICE_CONTROL_MASK 0x07; - -typedef union _PCI_EXPRESS_DEVICE_CONTROL_REGISTER { - - struct { - - USHORT CorrectableErrorEnable:1; - USHORT NonFatalErrorEnable:1; - USHORT FatalErrorEnable:1; - USHORT UnsupportedRequestErrorEnable:1; - USHORT EnableRelaxedOrder:1; - USHORT MaxPayloadSize:3; // EXPRESS_MAX_PAYLOAD_SIZE - USHORT ExtendedTagEnable:1; - USHORT PhantomFunctionsEnable:1; - USHORT AuxPowerEnable:1; - USHORT NoSnoopEnable:1; - USHORT MaxReadRequestSize:3; // EXPRESS_MAX_PAYLOAD_SIZE - USHORT BridgeConfigRetryEnable:1; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_DEVICE_CONTROL_REGISTER, *PPCI_EXPRESS_DEVICE_CONTROL_REGISTER; - -// -// The low 4 bits of the PCI Express device status register hold AER device -// status. This mask is used when programming the AER bits in the device status -// register. -// - -#define PCI_EXPRESS_AER_DEVICE_STATUS_MASK 0x0F; - -typedef union _PCI_EXPRESS_DEVICE_STATUS_REGISTER { - - struct { - - USHORT CorrectableErrorDetected:1; - USHORT NonFatalErrorDetected:1; - USHORT FatalErrorDetected:1; - USHORT UnsupportedRequestDetected:1; - USHORT AuxPowerDetected:1; - USHORT TransactionsPending:1; - USHORT Rsvd:10; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_DEVICE_STATUS_REGISTER, *PPCI_EXPRESS_DEVICE_STATUS_REGISTER; - -typedef union _PCI_EXPRESS_LINK_CAPABILITIES_REGISTER { - - struct { - - ULONG MaximumLinkSpeed:4; - ULONG MaximumLinkWidth:6; - ULONG ActiveStatePMSupport:2; // EXPRESS_ASPM_CONFIG - ULONG L0sExitLatency:3; // EXPRESS_L0S_LATENCY - ULONG L1ExitLatency:3; // EXPRESS_L1_LATENCY - ULONG ClockPowerManagement:1; - ULONG SurpriseDownErrorReportingCapable:1; - ULONG DataLinkLayerActiveReportingCapable:1; - ULONG Rsvd:3; - ULONG PortNumber:8; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_LINK_CAPABILITIES_REGISTER, *PPCI_EXPRESS_LINK_CAPABILITIES_REGISTER; - -typedef union _PCI_EXPRESS_LINK_CONTROL_REGISTER { - - struct { - - USHORT ActiveStatePMControl:2; // EXPRESS_ASPM_CONFIG - USHORT Rsvd1:1; - USHORT ReadCompletionBoundary:1; // EXPRESS_RCB - USHORT LinkDisable:1; - USHORT RetrainLink:1; - USHORT CommonClockConfig:1; - USHORT ExtendedSynch:1; - USHORT EnableClockPowerManagement:1; - USHORT Rsvd2:7; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_LINK_CONTROL_REGISTER, *PPCI_EXPRESS_LINK_CONTROL_REGISTER; - -typedef union _PCI_EXPRESS_LINK_STATUS_REGISTER { - - struct { - - USHORT LinkSpeed:4; - USHORT LinkWidth:6; - USHORT Undefined:1; - USHORT LinkTraining:1; - USHORT SlotClockConfig:1; - USHORT DataLinkLayerActive:1; - USHORT Rsvd:2; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_LINK_STATUS_REGISTER, *PPCI_EXPRESS_LINK_STATUS_REGISTER; - -typedef union _PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER { - - struct { - - ULONG AttentionButtonPresent:1; - ULONG PowerControllerPresent:1; - ULONG MRLSensorPresent:1; - ULONG AttentionIndicatorPresent:1; - ULONG PowerIndicatorPresent:1; - ULONG HotPlugSurprise:1; - ULONG HotPlugCapable:1; - ULONG SlotPowerLimit:8; - ULONG SlotPowerLimitScale:2; - ULONG ElectromechanicalLockPresent:1; - ULONG NoCommandCompletedSupport:1; - ULONG PhysicalSlotNumber:13; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER, *PPCI_EXPRESS_SLOT_CAPABILITIES_REGISTER; - -typedef union _PCI_EXPRESS_SLOT_CONTROL_REGISTER { - - struct { - - USHORT AttentionButtonEnable:1; - USHORT PowerFaultDetectEnable:1; - USHORT MRLSensorEnable:1; - USHORT PresenceDetectEnable:1; - USHORT CommandCompletedEnable:1; - USHORT HotPlugInterruptEnable:1; - USHORT AttentionIndicatorControl:2; // EXPRESS_INDICATOR_STATE - USHORT PowerIndicatorControl:2; // EXPRESS_INDICATOR_STATE - USHORT PowerControllerControl:1; // EXPRESS_POWER_STATE - USHORT ElectromechanicalLockControl:1; - USHORT DataLinkStateChangeEnable:1; - USHORT Rsvd:3; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_SLOT_CONTROL_REGISTER, *PPCI_EXPRESS_SLOT_CONTROL_REGISTER; - -typedef union _PCI_EXPRESS_SLOT_STATUS_REGISTER { - - struct { - - USHORT AttentionButtonPressed:1; - USHORT PowerFaultDetected:1; - USHORT MRLSensorChanged:1; - USHORT PresenceDetectChanged:1; - USHORT CommandCompleted:1; - USHORT MRLSensorState:1; // EXPRESS_MRL_STATE - USHORT PresenceDetectState:1; // EXPRESS_CARD_PRESENCE - USHORT ElectromechanicalLockEngaged:1; - USHORT DataLinkStateChanged:1; - USHORT Rsvd:7; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_SLOT_STATUS_REGISTER, *PPCI_EXPRESS_SLOT_STATUS_REGISTER; - -typedef union _PCI_EXPRESS_ROOT_CONTROL_REGISTER { - - struct { - - USHORT CorrectableSerrEnable:1; - USHORT NonFatalSerrEnable:1; - USHORT FatalSerrEnable:1; - USHORT PMEInterruptEnable:1; - USHORT CRSSoftwareVisibilityEnable:1; - USHORT Rsvd:11; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_ROOT_CONTROL_REGISTER, *PPCI_EXPRESS_ROOT_CONTROL_REGISTER; - -typedef union _PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER { - - struct { - - USHORT CRSSoftwareVisibility:1; - USHORT Rsvd:15; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER, *PPCI_EXPRESS_ROOT_CAPABILITIES_REGISTER; - -typedef union _PCI_EXPRESS_ROOT_STATUS_REGISTER { - - struct { - - ULONG PMERequestorId:16; // PCI_EXPRESS_REQUESTOR_ID - ULONG PMEStatus:1; - ULONG PMEPending:1; - ULONG Rsvd:14; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_ROOT_STATUS_REGISTER, *PPCI_EXPRESS_ROOT_STATUS_REGISTER; - -// -// PCI Express Capability -// - -typedef struct _PCI_EXPRESS_CAPABILITY { - - PCI_CAPABILITIES_HEADER Header; - PCI_EXPRESS_CAPABILITIES_REGISTER ExpressCapabilities; - - PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER DeviceCapabilities; - - PCI_EXPRESS_DEVICE_CONTROL_REGISTER DeviceControl; - PCI_EXPRESS_DEVICE_STATUS_REGISTER DeviceStatus; - - PCI_EXPRESS_LINK_CAPABILITIES_REGISTER LinkCapabilities; - - PCI_EXPRESS_LINK_CONTROL_REGISTER LinkControl; - PCI_EXPRESS_LINK_STATUS_REGISTER LinkStatus; - - PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER SlotCapabilities; - - PCI_EXPRESS_SLOT_CONTROL_REGISTER SlotControl; - PCI_EXPRESS_SLOT_STATUS_REGISTER SlotStatus; - - PCI_EXPRESS_ROOT_CONTROL_REGISTER RootControl; - PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER RootCapabilities; - - PCI_EXPRESS_ROOT_STATUS_REGISTER RootStatus; - -} PCI_EXPRESS_CAPABILITY, *PPCI_EXPRESS_CAPABILITY; - -typedef enum { - - MRLClosed = 0, - MRLOpen - -} PCI_EXPRESS_MRL_STATE; - -typedef enum { - - SlotEmpty = 0, - CardPresent - -} PCI_EXPRESS_CARD_PRESENCE; - -typedef enum { - - IndicatorOn = 1, - IndicatorBlink, - IndicatorOff - -} PCI_EXPRESS_INDICATOR_STATE; - -typedef enum { - - PowerOn = 0, - PowerOff - -} PCI_EXPRESS_POWER_STATE; - -typedef enum { - - L0sEntrySupport = 1, - L0sAndL1EntrySupport = 3 - -} PCI_EXPRESS_ASPM_SUPPORT; - -typedef enum { - - L0sAndL1EntryDisabled, - L0sEntryEnabled, - L1EntryEnabled, - L0sAndL1EntryEnabled - -} PCI_EXPRESS_ASPM_CONTROL; - -typedef enum { - - L0s_Below64ns = 0, - L0s_64ns_128ns, - L0s_128ns_256ns, - L0s_256ns_512ns, - L0s_512ns_1us, - L0s_1us_2us, - L0s_2us_4us, - L0s_Above4us - -} PCI_EXPRESS_L0s_EXIT_LATENCY; - -typedef enum { - - L1_Below1us = 0, - L1_1us_2us, - L1_2us_4us, - L1_4us_8us, - L1_8us_16us, - L1_16us_32us, - L1_32us_64us, - L1_Above64us - -} PCI_EXPRESS_L1_EXIT_LATENCY; - -typedef enum { - - PciExpressEndpoint = 0, - PciExpressLegacyEndpoint, - PciExpressRootPort = 4, - PciExpressUpstreamSwitchPort, - PciExpressDownstreamSwitchPort, - PciExpressToPciXBridge, - PciXToExpressBridge, - PciExpressRootComplexIntegratedEndpoint, - PciExpressRootComplexEventCollector - -} PCI_EXPRESS_DEVICE_TYPE; - -typedef enum { - - MaxPayload128Bytes = 0, - MaxPayload256Bytes, - MaxPayload512Bytes, - MaxPayload1024Bytes, - MaxPayload2048Bytes, - MaxPayload4096Bytes - -} PCI_EXPRESS_MAX_PAYLOAD_SIZE; - -typedef union _PCI_EXPRESS_PME_REQUESTOR_ID { - - struct { - - USHORT FunctionNumber:3; - USHORT DeviceNumber:5; - USHORT BusNumber:8; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_PME_REQUESTOR_ID, *PPCI_EXPRESS_PME_REQUESTOR_ID; - - -// -// Portable portion of HAL & HAL bus extender definitions for BUSHANDLER -// BusData for installed PCI buses. -// - -typedef VOID -(*PciPin2Line) ( - __in struct _BUS_HANDLER *BusHandler, - __in struct _BUS_HANDLER *RootHandler, - __in PCI_SLOT_NUMBER SlotNumber, - __in PPCI_COMMON_CONFIG PciData - ); - -typedef VOID -(*PciLine2Pin) ( - __in struct _BUS_HANDLER *BusHandler, - __in struct _BUS_HANDLER *RootHandler, - __in PCI_SLOT_NUMBER SlotNumber, - __in PPCI_COMMON_CONFIG PciNewData, - __in PPCI_COMMON_CONFIG PciOldData - ); - -typedef VOID -(*PciReadWriteConfig) ( - __in struct _BUS_HANDLER *BusHandler, - __in PCI_SLOT_NUMBER Slot, - __in_bcount(Length) PVOID Buffer, - __in ULONG Offset, - __in ULONG Length - ); - -#define PCI_DATA_TAG ' ICP' -#define PCI_DATA_VERSION 1 - -typedef struct _PCIBUSDATA { - ULONG Tag; - ULONG Version; - PciReadWriteConfig ReadConfig; - PciReadWriteConfig WriteConfig; - PciPin2Line Pin2Line; - PciLine2Pin Line2Pin; - PCI_SLOT_NUMBER ParentSlot; - PVOID Reserved[4]; -} PCIBUSDATA, *PPCIBUSDATA; - - -#ifndef _PCIINTRF_X_ -#define _PCIINTRF_X_ - -// -// PCI Bus interface -// - -typedef ULONG (*PCI_READ_WRITE_CONFIG)( - __in PVOID Context, - __in ULONG BusOffset, - __in ULONG Slot, - __in_bcount(Length) PVOID Buffer, - __in ULONG Offset, - __in ULONG Length - ); - -typedef VOID (*PCI_PIN_TO_LINE)( - __in PVOID Context, - __in PPCI_COMMON_CONFIG PciData - ); - -typedef VOID (*PCI_LINE_TO_PIN)( - __in PVOID Context, - __in PPCI_COMMON_CONFIG PciNewData, - __in PPCI_COMMON_CONFIG PciOldData - ); - -typedef VOID (*PCI_ROOT_BUS_CAPABILITY) ( - __in PVOID Context, - __out PPCI_ROOT_BUS_HARDWARE_CAPABILITY HardwareCapability - ); - -typedef VOID (*PCI_EXPRESS_WAKE_CONTROL) ( - __in PVOID Context, - __in BOOLEAN EnableWake - ); - -typedef struct _PCI_BUS_INTERFACE_STANDARD { - // - // generic interface header - // - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - // - // standard PCI bus interfaces - // - PCI_READ_WRITE_CONFIG ReadConfig; - PCI_READ_WRITE_CONFIG WriteConfig; - PCI_PIN_TO_LINE PinToLine; - PCI_LINE_TO_PIN LineToPin; - PCI_ROOT_BUS_CAPABILITY RootBusCapability; - PCI_EXPRESS_WAKE_CONTROL ExpressWakeControl; - -} PCI_BUS_INTERFACE_STANDARD, *PPCI_BUS_INTERFACE_STANDARD; - -#define PCI_BUS_INTERFACE_STANDARD_VERSION 1 - - -#endif - -// -// Define exported ZwXxx routines to device drivers. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwSetInformationThread ( - __in HANDLE ThreadHandle, - __in THREADINFOCLASS ThreadInformationClass, - __in_bcount(ThreadInformationLength) PVOID ThreadInformation, - __in ULONG ThreadInformationLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when(return=0, __drv_allocatesMem(TimerObject)) -NTSTATUS -ZwCreateTimer ( - __out PHANDLE TimerHandle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in TIMER_TYPE TimerType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -ZwOpenTimer ( - __out PHANDLE TimerHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -ZwCancelTimer ( - __in HANDLE TimerHandle, - __out_opt PBOOLEAN CurrentState - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -ZwSetTimer ( - __in HANDLE TimerHandle, - __in PLARGE_INTEGER DueTime, - __in_opt PTIMER_APC_ROUTINE TimerApcRoutine, - __in_opt PVOID TimerContext, - __in BOOLEAN ResumeTimer, - __in_opt LONG Period, - __out_opt PBOOLEAN PreviousState - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -ZwSetTimerEx ( - __in HANDLE TimerHandle, - __in TIMER_SET_INFORMATION_CLASS TimerSetInformationClass, - __inout_bcount_opt(TimerSetInformationLength) PVOID TimerSetInformation, - __in ULONG TimerSetInformationLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwQueryVolumeInformationFile( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __out_bcount(Length) PVOID FsInformation, - __in ULONG Length, - __in FS_INFORMATION_CLASS FsInformationClass - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwDeviceIoControlFile( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in ULONG IoControlCode, - __in_bcount_opt(InputBufferLength) PVOID InputBuffer, - __in ULONG InputBufferLength, - __out_bcount_opt(OutputBufferLength) PVOID OutputBuffer, - __in ULONG OutputBufferLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwDisplayString( - __in PUNICODE_STRING String - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwPowerInformation( - __in POWER_INFORMATION_LEVEL InformationLevel, - __in_bcount_opt(InputBufferLength) PVOID InputBuffer, - __in ULONG InputBufferLength, - __out_bcount_opt(OutputBufferLength) PVOID OutputBuffer, - __in ULONG OutputBufferLength - ); -#endif - - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwAllocateLocallyUniqueId( - __out PLUID Luid - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwTerminateProcess ( - __in_opt HANDLE ProcessHandle, - __in NTSTATUS ExitStatus - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwOpenProcess ( - __out PHANDLE ProcessHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt PCLIENT_ID ClientId - ); - - -//------------------------------------------------------ WHEA_ERROR_SOURCE_TYPE - -#define WHEA_PHYSICAL_ADDRESS LARGE_INTEGER - -// -// This enumeration defines the various types of error sources that a platform -// can expose to the operating system. -// - -typedef enum _WHEA_ERROR_SOURCE_TYPE { - WheaErrSrcTypeMCE = 0x00, // Machine Check Exception - WheaErrSrcTypeCMC = 0x01, // Corrected Machine Check - WheaErrSrcTypeCPE = 0x02, // Corrected Platform Error - WheaErrSrcTypeNMI = 0x03, // Non-Maskable Interrupt - WheaErrSrcTypePCIe = 0x04, // PCI Express Error - WheaErrSrcTypeGeneric = 0x05, // Other types of error sources - WheaErrSrcTypeINIT = 0x06, // IA64 INIT Error Source - WheaErrSrcTypeBOOT = 0x07, // BOOT Error Source - WheaErrSrcTypeSCIGeneric = 0x08, // SCI-based generic error source - WheaErrSrcTypeIPFMCA = 0x09, // Itanium Machine Check Abort - WheaErrSrcTypeIPFCMC = 0x0a, // Itanium Machine check - WheaErrSrcTypeIPFCPE = 0x0b, // Itanium Corrected Platform Error - WheaErrSrcTypeMax -} WHEA_ERROR_SOURCE_TYPE, *PWHEA_ERROR_SOURCE_TYPE; - -// -// Error sources have a runtime state associated with them. The following are -// the valid states for an error source. -// - -typedef enum _WHEA_ERROR_SOURCE_STATE { - WheaErrSrcStateStopped = 0x01, - WheaErrSrcStateStarted = 0x02 -} WHEA_ERROR_SOURCE_STATE, *PWHEA_ERROR_SOURCE_STATE; - -#define WHEA_ERROR_SOURCE_DESCRIPTOR_VERSION_10 10 - -#define WHEA_MAX_MC_BANKS 32 - -#define WHEA_ERROR_SOURCE_FLAG_FIRMWAREFIRST 0x00000001 -#define WHEA_ERROR_SOURCE_FLAG_GLOBAL 0x00000002 -#define WHEA_ERROR_SOURCE_FLAG_PREALLOCATE_PER_PROCESSOR 0x00000004 -#define WHEA_ERROR_SOURCE_FLAG_DEFAULTSOURCE 0x80000000 - -#define WHEA_ERROR_SOURCE_DESCRIPTOR_TYPE_XPFMCE 0 -#define WHEA_ERROR_SOURCE_DESCRIPTOR_TYPE_XPFCMC 1 -#define WHEA_ERROR_SOURCE_DESCRIPTOR_TYPE_XPFNMI 2 -#define WHEA_ERROR_SOURCE_DESCRIPTOR_TYPE_IPFMCA 3 -#define WHEA_ERROR_SOURCE_DESCRIPTOR_TYPE_IPFCMC 4 -#define WHEA_ERROR_SOURCE_DESCRIPTOR_TYPE_IPFCPE 5 -#define WHEA_ERROR_SOURCE_DESCRIPTOR_TYPE_AERROOTPORT 6 -#define WHEA_ERROR_SOURCE_DESCRIPTOR_TYPE_AERENDPOINT 7 -#define WHEA_ERROR_SOURCE_DESCRIPTOR_TYPE_AERBRIDGE 8 -#define WHEA_ERROR_SOURCE_DESCRIPTOR_TYPE_GENERIC 9 - -#define WHEA_XPF_MC_BANK_STATUSFORMAT_IA32MCA 0 -#define WHEA_XPF_MC_BANK_STATUSFORMAT_Intel64MCA 1 -#define WHEA_XPF_MC_BANK_STATUSFORMAT_AMD64MCA 2 - -#define WHEA_NOTIFICATION_TYPE_POLLED 0 -#define WHEA_NOTIFICATION_TYPE_EXTERNALINTERRUPT 1 -#define WHEA_NOTIFICATION_TYPE_LOCALINTERRUPT 2 -#define WHEA_NOTIFICATION_TYPE_SCI 3 -#define WHEA_NOTIFICATION_TYPE_NMI 4 - -#include - -//------------------------------------------------ WHEA_ERROR_SOURCE_DESCRIPTOR - -typedef union _WHEA_NOTIFICATION_FLAGS { - struct { - USHORT PollIntervalRW:1; - USHORT SwitchToPollingThresholdRW:1; - USHORT SwitchToPollingWindowRW:1; - USHORT ErrorThresholdRW:1; - USHORT ErrorThresholdWindowRW:1; - USHORT Reserved:11; - } DUMMYSTRUCTNAME; - USHORT AsUSHORT; -} WHEA_NOTIFICATION_FLAGS, *PWHEA_NOTIFICATION_FLAGS; - -typedef union _XPF_MC_BANK_FLAGS { - struct { - UCHAR ClearOnInitializationRW:1; - UCHAR ControlDataRW:1; - UCHAR Reserved:6; - } DUMMYSTRUCTNAME; - UCHAR AsUCHAR; -} XPF_MC_BANK_FLAGS, *PXPF_MC_BANK_FLAGS; - -typedef union _XPF_MCE_FLAGS { - struct { - ULONG MCG_CapabilityRW:1; - ULONG MCG_GlobalControlRW:1; - ULONG Reserved:30; - } DUMMYSTRUCTNAME; - ULONG AsULONG; -} XPF_MCE_FLAGS, *PXPF_MCE_FLAGS; - -typedef union _AER_ROOTPORT_DESCRIPTOR_FLAGS { - struct { - USHORT UncorrectableErrorMaskRW:1; - USHORT UncorrectableErrorSeverityRW:1; - USHORT CorrectableErrorMaskRW:1; - USHORT AdvancedCapsAndControlRW:1; - USHORT RootErrorCommandRW:1; - USHORT Reserved:11; - } DUMMYSTRUCTNAME; - USHORT AsUSHORT; -} AER_ROOTPORT_DESCRIPTOR_FLAGS, *PAER_ROOTPORT_DESCRIPTOR_FLAGS; - -typedef union _AER_ENDPOINT_DESCRIPTOR_FLAGS { - struct { - USHORT UncorrectableErrorMaskRW:1; - USHORT UncorrectableErrorSeverityRW:1; - USHORT CorrectableErrorMaskRW:1; - USHORT AdvancedCapsAndControlRW:1; - USHORT Reserved:12; - } DUMMYSTRUCTNAME; - USHORT AsUSHORT; -} AER_ENDPOINT_DESCRIPTOR_FLAGS, *PAER_ENDPOINT_DESCRIPTOR_FLAGS; - -typedef union _AER_BRIDGE_DESCRIPTOR_FLAGS { - struct { - USHORT UncorrectableErrorMaskRW:1; - USHORT UncorrectableErrorSeverityRW:1; - USHORT CorrectableErrorMaskRW:1; - USHORT AdvancedCapsAndControlRW:1; - USHORT SecondaryUncorrectableErrorMaskRW:1; - USHORT SecondaryUncorrectableErrorSevRW:1; - USHORT SecondaryCapsAndControlRW:1; - USHORT Reserved:9; - } DUMMYSTRUCTNAME; - USHORT AsUSHORT; -} AER_BRIDGE_DESCRIPTOR_FLAGS, *PAER_BRIDGE_DESCRIPTOR_FLAGS; - -// -// The following structure is used to describe how a given error source reports -// errors to the OS. -// - -typedef struct _WHEA_NOTIFICATION_DESCRIPTOR { - UCHAR Type; - UCHAR Length; - WHEA_NOTIFICATION_FLAGS Flags; - - union { - struct { - ULONG PollInterval; - } Polled; - - struct { - ULONG PollInterval; - ULONG Vector; - ULONG SwitchToPollingThreshold; - ULONG SwitchToPollingWindow; - ULONG ErrorThreshold; - ULONG ErrorThresholdWindow; - } Interrupt; - - struct { - ULONG PollInterval; - ULONG Vector; - ULONG SwitchToPollingThreshold; - ULONG SwitchToPollingWindow; - ULONG ErrorThreshold; - ULONG ErrorThresholdWindow; - } LocalInterrupt; - - struct { - ULONG PollInterval; - ULONG Vector; - ULONG SwitchToPollingThreshold; - ULONG SwitchToPollingWindow; - ULONG ErrorThreshold; - ULONG ErrorThresholdWindow; - } Sci; - - struct { - ULONG PollInterval; - ULONG Vector; - ULONG SwitchToPollingThreshold; - ULONG SwitchToPollingWindow; - ULONG ErrorThreshold; - ULONG ErrorThresholdWindow; - } Nmi; - } u; -} WHEA_NOTIFICATION_DESCRIPTOR, *PWHEA_NOTIFICATION_DESCRIPTOR; - -// -// The following structure describes an XPF machine check bank. It identifies -// the bank with a BankNumber and it contains information that is used to -// configure the bank. MCE and CMC error sources make use of this descriptor -// to describe and configure each bank. -// - -typedef struct _WHEA_XPF_MC_BANK_DESCRIPTOR { - UCHAR BankNumber; - BOOLEAN ClearOnInitialization; - UCHAR StatusDataFormat; - XPF_MC_BANK_FLAGS Flags; - ULONG ControlMsr; - ULONG StatusMsr; - ULONG AddressMsr; - ULONG MiscMsr; - ULONGLONG ControlData; -} WHEA_XPF_MC_BANK_DESCRIPTOR, *PWHEA_XPF_MC_BANK_DESCRIPTOR; - -// -// The following structure describes an XPF platform's machine check exception -// error source mechanism. The information represented in this structure tells -// the OS how to configure the platform's MCE error source. -// - -typedef struct _WHEA_XPF_MCE_DESCRIPTOR { - USHORT Type; - UCHAR Enabled; - UCHAR NumberOfBanks; - XPF_MCE_FLAGS Flags; - ULONGLONG MCG_Capability; - ULONGLONG MCG_GlobalControl; - WHEA_XPF_MC_BANK_DESCRIPTOR Banks[WHEA_MAX_MC_BANKS]; -} WHEA_XPF_MCE_DESCRIPTOR, *PWHEA_XPF_MCE_DESCRIPTOR; - -// -// The following structure describes an XPF platform's corrected machine check -// error source mechanism. The information represented in this structure tells -// the OS how to configure the platform's CMC error source. -// - -typedef struct _WHEA_XPF_CMC_DESCRIPTOR { - USHORT Type; - BOOLEAN Enabled; - UCHAR NumberOfBanks; - ULONG Reserved; - WHEA_NOTIFICATION_DESCRIPTOR Notify; - WHEA_XPF_MC_BANK_DESCRIPTOR Banks[WHEA_MAX_MC_BANKS]; -} WHEA_XPF_CMC_DESCRIPTOR, *PWHEA_XPF_CMC_DESCRIPTOR; - -typedef struct _WHEA_PCI_SLOT_NUMBER { - union { - struct { - ULONG DeviceNumber:5; - ULONG FunctionNumber:3; - ULONG Reserved:24; - } bits; - ULONG AsULONG; - } u; -} WHEA_PCI_SLOT_NUMBER, *PWHEA_PCI_SLOT_NUMBER; - -// -// The following structure describes an XPF platform's non-maskable interrupt -// error source mechanism. The information represented in this structure tells -// the OS how to configure the platform's NMI error source. -// - -typedef struct _WHEA_XPF_NMI_DESCRIPTOR { - USHORT Type; - BOOLEAN Enabled; -} WHEA_XPF_NMI_DESCRIPTOR, *PWHEA_XPF_NMI_DESCRIPTOR; - -// -// The following structure describes a platform's PCI Express AER root port -// error source. The information represented in this structure tells the OS how -// to configure the root port's AER settings. -// - -typedef struct _WHEA_AER_ROOTPORT_DESCRIPTOR { - USHORT Type; - BOOLEAN Enabled; - UCHAR Reserved; - ULONG BusNumber; - WHEA_PCI_SLOT_NUMBER Slot; - USHORT DeviceControl; - AER_ROOTPORT_DESCRIPTOR_FLAGS Flags; - ULONG UncorrectableErrorMask; - ULONG UncorrectableErrorSeverity; - ULONG CorrectableErrorMask; - ULONG AdvancedCapsAndControl; - ULONG RootErrorCommand; -} WHEA_AER_ROOTPORT_DESCRIPTOR, *PWHEA_AER_ROOTPORT_DESCRIPTOR; - -// -// The following structure describes a platform's PCI Express AER endpoint -// error source. The information represented in this structure tells the OS how -// to configure the device's AER settings. -// - -typedef struct _WHEA_AER_ENDPOINT_DESCRIPTOR { - USHORT Type; - BOOLEAN Enabled; - UCHAR Reserved; - ULONG BusNumber; - WHEA_PCI_SLOT_NUMBER Slot; - USHORT DeviceControl; - AER_ENDPOINT_DESCRIPTOR_FLAGS Flags; - ULONG UncorrectableErrorMask; - ULONG UncorrectableErrorSeverity; - ULONG CorrectableErrorMask; - ULONG AdvancedCapsAndControl; -} WHEA_AER_ENDPOINT_DESCRIPTOR, *PWHEA_AER_ENDPOINT_DESCRIPTOR; - -// -// The following structure describes a platform's PCI Express AER bridge -// error source. The information represented in this structure tells the OS how -// to configure the bridge's AER settings. -// - -typedef struct _WHEA_AER_BRIDGE_DESCRIPTOR { - USHORT Type; - BOOLEAN Enabled; - UCHAR Reserved; - ULONG BusNumber; - WHEA_PCI_SLOT_NUMBER Slot; - USHORT DeviceControl; - AER_BRIDGE_DESCRIPTOR_FLAGS Flags; - ULONG UncorrectableErrorMask; - ULONG UncorrectableErrorSeverity; - ULONG CorrectableErrorMask; - ULONG AdvancedCapsAndControl; - ULONG SecondaryUncorrectableErrorMask; - ULONG SecondaryUncorrectableErrorSev; - ULONG SecondaryCapsAndControl; -} WHEA_AER_BRIDGE_DESCRIPTOR, *PWHEA_AER_BRIDGE_DESCRIPTOR; - -// -// The following structure describes a generic error source to the OS. Using -// the information in this structure the OS is able to configure a handler for -// the generic error source. -// - -typedef struct _WHEA_GENERIC_ERROR_DESCRIPTOR { - - // - // Type is WHEA_ERROR_SOURCE_DESCRIPTOR_TYPE_GENERIC. - // - - USHORT Type; - - // - // This field is reserved. - // - - UCHAR Reserved; - - // - // Indicates whether the generic error source is to be enabled. - // - - UCHAR Enabled; - - // - // Length of the error status block. - // - - ULONG ErrStatusBlockLength; - - // - // If this generic error source relates back to another error source, keep - // it's identifier here. - // - - ULONG RelatedErrorSourceId; - - // - // The following 5 fields have the same layout as a GEN_ADDR structure. They - // describe the address at which the OS reads error status information - // from the error source. - // - - UCHAR ErrStatusAddressSpaceID; - UCHAR ErrStatusAddressBitWidth; - UCHAR ErrStatusAddressBitOffset; - UCHAR ErrStatusAddressAccessSize; - WHEA_PHYSICAL_ADDRESS ErrStatusAddress; - - // - // Notify describes how the generic error source notifies the OS that error - // information is available. - // - - WHEA_NOTIFICATION_DESCRIPTOR Notify; - -} WHEA_GENERIC_ERROR_DESCRIPTOR, *PWHEA_GENERIC_ERROR_DESCRIPTOR; - -typedef struct _WHEA_IPF_MCA_DESCRIPTOR { - USHORT Type; - UCHAR Enabled; - UCHAR Reserved; -} WHEA_IPF_MCA_DESCRIPTOR, *PWHEA_IPF_MCA_DESCRIPTOR; - -typedef struct _WHEA_IPF_CMC_DESCRIPTOR { - USHORT Type; - UCHAR Enabled; - UCHAR Reserved; -} WHEA_IPF_CMC_DESCRIPTOR, *PWHEA_IPF_CMC_DESCRIPTOR; - -typedef struct _WHEA_IPF_CPE_DESCRIPTOR { - USHORT Type; - UCHAR Enabled; - UCHAR Reserved; -} WHEA_IPF_CPE_DESCRIPTOR, *PWHEA_IPF_CPE_DESCRIPTOR; - -typedef struct _WHEA_ERROR_SOURCE_DESCRIPTOR { - ULONG Length; // +00 (0) - ULONG Version; // +04 (4) - WHEA_ERROR_SOURCE_TYPE Type; // +08 (8) - WHEA_ERROR_SOURCE_STATE State; // +0C (12) - ULONG MaxRawDataLength; // +10 (16) - ULONG NumRecordsToPreallocate; // +14 (20) - ULONG MaxSectionsPerRecord; // +18 (24) - ULONG ErrorSourceId; // +1C (28) - ULONG PlatformErrorSourceId; // +20 (32) - ULONG Flags; // +24 (36) - - union { // +28 (40) - WHEA_XPF_MCE_DESCRIPTOR XpfMceDescriptor; - WHEA_XPF_CMC_DESCRIPTOR XpfCmcDescriptor; - WHEA_XPF_NMI_DESCRIPTOR XpfNmiDescriptor; - WHEA_IPF_MCA_DESCRIPTOR IpfMcaDescriptor; - WHEA_IPF_CMC_DESCRIPTOR IpfCmcDescriptor; - WHEA_IPF_CPE_DESCRIPTOR IpfCpeDescriptor; - WHEA_AER_ROOTPORT_DESCRIPTOR AerRootportDescriptor; - WHEA_AER_ENDPOINT_DESCRIPTOR AerEndpointDescriptor; - WHEA_AER_BRIDGE_DESCRIPTOR AerBridgeDescriptor; - WHEA_GENERIC_ERROR_DESCRIPTOR GenErrDescriptor; - } Info; - -} WHEA_ERROR_SOURCE_DESCRIPTOR, *PWHEA_ERROR_SOURCE_DESCRIPTOR; - -#include - - -// -// The general format of the common platform error record is illustrated below. -// A record consists of a header; followed by one or more section descriptors; -// and for each descriptor, an associated section which may contain either error -// or informational data. -// -// The record may include extra buffer space to allow for the dynamic addition -// of error sections descriptors and bodies, as well as for dynamically -// increasing the size of existing sections. -// -// +---------------------------------------------+ -// | Record Header | -// | SectionCount == N | -// +---------------------------------------------+ -// | Section Descriptor 1 | -// | Offset, size | ---+ -// +---------------------------------------------+ | -// | Section Descriptor 2 | | -// | Offset, size | ---+---+ -// +---------------------------------------------+ | | -// | | | | -// | .... | | | -// | | | | -// +---------------------------------------------+ | | -// | Section Descriptor N | ---+---+---+ -// | Offset, size | | | | -// +---------------------------------------------+ | | | -// | Buffer space for adding | | | | -// | more section descriptors. | | | | -// +---------------------------------------------| | | | -// | Section 1 | <--+ | | -// | | | | -// +---------------------------------------------+ | | -// | Section 2 | <------+ | -// | | | -// +---------------------------------------------+ | -// | | | -// | | | -// | .... | | -// | | | -// | | | -// +---------------------------------------------+ | -// | Section N | <----------+ -// | | -// +---------------------------------------------+ -// | | -// | | -// | | -// | Buffer space for adding | -// | more section bodies. | -// | | -// | | -// | | -// +---------------------------------------------+ -// - -// -------------------------------------------- Specification validation macros - -// -// The following macro implements a compile-time check for the offset and length -// of the specified structure member. This can be used to validate the defined -// structures against the specification. -// - -#define CPER_FIELD_CHECK(type, field, offset, length) \ - C_ASSERT(((FIELD_OFFSET(type, field) == (offset)) && \ - (RTL_FIELD_SIZE(type, field) == (length)))) - -#include - -//---------------------------------- Downlevel GUID variable name compatibility - -#if WHEA_DOWNLEVEL_TYPE_NAMES - -#define PROCESSOR_GENERIC_SECTION_GUID PROCESSOR_GENERIC_ERROR_SECTION_GUID -#define X86_PROCESSOR_SPECIFIC_SECTION_GUID XPF_PROCESSOR_ERROR_SECTION_GUID -#define IPF_PROCESSOR_SPECIFIC_SECTION_GUID IPF_PROCESSOR_ERROR_SECTION_GUID -#define PLATFORM_MEMORY_SECTION_GUID MEMORY_ERROR_SECTION_GUID -#define PCIEXPRESS_SECTION_GUID PCIEXPRESS_ERROR_SECTION_GUID -#define PCIX_BUS_SECTION_GUID PCIXBUS_ERROR_SECTION_GUID -#define PCIX_COMPONENT_SECTION_GUID PCIXDEVICE_ERROR_SECTION_GUID -#define IPF_SAL_RECORD_REFERENCE_SECTION_GUID FIRMWARE_ERROR_RECORD_REFERENCE_GUID - -#endif - -//------------------------------------------ Common Platform Error Record types - -// -// These types are used in several of the common platform error record -// structures. -// - -typedef union _WHEA_REVISION { - struct { - UCHAR MinorRevision; - UCHAR MajorRevision; - } DUMMYSTRUCTNAME; - USHORT AsUSHORT; -} WHEA_REVISION, *PWHEA_REVISION; - -typedef enum _WHEA_ERROR_SEVERITY { - WheaErrSevRecoverable = 0, - WheaErrSevFatal = 1, - WheaErrSevCorrected = 2, - WheaErrSevInformational = 3 -} WHEA_ERROR_SEVERITY, *PWHEA_ERROR_SEVERITY; - -typedef union _WHEA_TIMESTAMP { - struct { - ULONGLONG Seconds:8; - ULONGLONG Minutes:8; - ULONGLONG Hours:8; - ULONGLONG Precise:1; - ULONGLONG Reserved:7; - ULONGLONG Day:8; - ULONGLONG Month:8; - ULONGLONG Year:8; - ULONGLONG Century:8; - } DUMMYSTRUCTNAME; - LARGE_INTEGER AsLARGE_INTEGER; -} WHEA_TIMESTAMP, *PWHEA_TIMESTAMP; - -typedef union _WHEA_PERSISTENCE_INFO { - struct { - ULONGLONG Signature:16; - ULONGLONG Length:24; - ULONGLONG Identifier:16; - ULONGLONG Attributes:2; - ULONGLONG DoNotLog:1; - ULONGLONG Reserved:5; - } DUMMYSTRUCTNAME; - ULONGLONG AsULONGLONG; -} WHEA_PERSISTENCE_INFO, *PWHEA_PERSISTENCE_INFO; - -#define ERRTYP_INTERNAL 0x01 // 1 -#define ERRTYP_BUS 0x10 // 16 -#define ERRTYP_MEM 0x04 // 4 -#define ERRTYP_TLB 0x05 // 5 -#define ERRTYP_CACHE 0x06 // 6 -#define ERRTYP_FUNCTION 0x07 // 7 -#define ERRTYP_SELFTEST 0x08 // 8 -#define ERRTYP_FLOW 0x09 // 9 -#define ERRTYP_MAP 0x11 // 17 -#define ERRTYP_IMPROPER 0x12 // 18 -#define ERRTYP_UNIMPL 0x13 // 19 -#define ERRTYP_LOSSOFLOCKSTEP 0x14 // 20 -#define ERRTYP_RESPONSE 0x15 // 21 -#define ERRTYP_PARITY 0x16 // 22 -#define ERRTYP_PROTOCOL 0x17 // 23 -#define ERRTYP_PATHERROR 0x18 // 24 -#define ERRTYP_TIMEOUT 0x19 // 25 -#define ERRTYP_POISONED 0x1A // 26 - -typedef union _WHEA_ERROR_STATUS { - ULONGLONG ErrorStatus; - struct { - ULONGLONG Reserved1:8; - ULONGLONG ErrorType:8; - ULONGLONG Address:1; - ULONGLONG Control:1; - ULONGLONG Data:1; - ULONGLONG Responder:1; - ULONGLONG Requester:1; - ULONGLONG FirstError:1; - ULONGLONG Overflow:1; - ULONGLONG Reserved2:41; - } DUMMYSTRUCTNAME; -} WHEA_ERROR_STATUS, *PWHEA_ERROR_STATUS; - -//---------------------------------------------------- WHEA_ERROR_RECORD_HEADER - -typedef union _WHEA_ERROR_RECORD_HEADER_VALIDBITS { - struct { - ULONG PlatformId:1; - ULONG Timestamp:1; - ULONG PartitionId:1; - ULONG Reserved:29; - } DUMMYSTRUCTNAME; - ULONG AsULONG; -} WHEA_ERROR_RECORD_HEADER_VALIDBITS, *PWHEA_ERROR_RECORD_HEADER_VALIDBITS; - -#define WHEA_ERROR_RECORD_VALID_PLATFORMID 0x00000001 -#define WHEA_ERROR_RECORD_VALID_TIMESTAMP 0x00000002 -#define WHEA_ERROR_RECORD_VALID_PARTITIONID 0x00000004 - -typedef union _WHEA_ERROR_RECORD_HEADER_FLAGS { - struct { - ULONG Recovered:1; - ULONG PreviousError:1; - ULONG Simulated:1; - ULONG Reserved:29; - } DUMMYSTRUCTNAME; - ULONG AsULONG; -} WHEA_ERROR_RECORD_HEADER_FLAGS, *PWHEA_ERROR_RECORD_HEADER_FLAGS; - -#define WHEA_ERROR_RECORD_FLAGS_RECOVERED 0x00000001 -#define WHEA_ERROR_RECORD_FLAGS_PREVIOUSERROR 0x00000002 -#define WHEA_ERROR_RECORD_FLAGS_SIMULATED 0x00000004 - -typedef struct _WHEA_ERROR_RECORD_HEADER { - ULONG Signature; - WHEA_REVISION Revision; - ULONG SignatureEnd; - USHORT SectionCount; - WHEA_ERROR_SEVERITY Severity; - WHEA_ERROR_RECORD_HEADER_VALIDBITS ValidBits; - ULONG Length; - WHEA_TIMESTAMP Timestamp; - GUID PlatformId; - GUID PartitionId; - GUID CreatorId; - GUID NotifyType; - ULONGLONG RecordId; - WHEA_ERROR_RECORD_HEADER_FLAGS Flags; - WHEA_PERSISTENCE_INFO PersistenceInfo; - UCHAR Reserved[12]; -} WHEA_ERROR_RECORD_HEADER, *PWHEA_ERROR_RECORD_HEADER; - -// -// Distinguished values used in the common platform error record header -// signature. -// - -#define WHEA_ERROR_RECORD_SIGNATURE 'REPC' -#define WHEA_ERROR_RECORD_REVISION 0x0210 -#define WHEA_ERROR_RECORD_SIGNATURE_END 0xFFFFFFFF - -// -// Validate the error record header structure against the definitions in the -// UEFI specification. -// - -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, Signature, 0, 4); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, Revision, 4, 2); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, SignatureEnd, 6, 4); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, SectionCount, 10, 2); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, Severity, 12, 4); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, ValidBits, 16, 4); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, Length, 20, 4); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, Timestamp, 24, 8); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, PlatformId, 32, 16); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, PartitionId, 48, 16); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, CreatorId, 64, 16); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, NotifyType, 80, 16); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, RecordId, 96, 8); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, Flags, 104, 4); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, PersistenceInfo, 108, 8); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_HEADER, Reserved, 116, 12); - -//---------------------------------------- WHEA_ERROR_RECORD_SECTION_DESCRIPTOR - -typedef union _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_FLAGS { - struct { - ULONG Primary:1; - ULONG ContainmentWarning:1; - ULONG Reset:1; - ULONG ThresholdExceeded:1; - ULONG ResourceNotAvailable:1; - ULONG LatentError:1; - ULONG Reserved:26; - } DUMMYSTRUCTNAME; - ULONG AsULONG; -} WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_FLAGS, - *PWHEA_ERROR_RECORD_SECTION_DESCRIPTOR_FLAGS; - -#define WHEA_SECTION_DESCRIPTOR_FLAGS_PRIMARY 0x00000001 -#define WHEA_SECTION_DESCRIPTOR_FLAGS_CONTAINMENTWRN 0x00000002 -#define WHEA_SECTION_DESCRIPTOR_FLAGS_RESET 0x00000004 -#define WHEA_SECTION_DESCRIPTOR_FLAGS_THRESHOLDEXCEEDED 0x00000008 -#define WHEA_SECTION_DESCRIPTOR_FLAGS_RESOURCENA 0x00000010 -#define WHEA_SECTION_DESCRIPTOR_FLAGS_LATENTERROR 0x00000020 - -typedef union _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_VALIDBITS { - struct { - UCHAR FRUId:1; - UCHAR FRUText:1; - UCHAR Reserved:6; - } DUMMYSTRUCTNAME; - UCHAR AsUCHAR; -} WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_VALIDBITS, - *PWHEA_ERROR_RECORD_SECTION_DESCRIPTOR_VALIDBITS; - -typedef struct _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR { - ULONG SectionOffset; - ULONG SectionLength; - WHEA_REVISION Revision; - WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_VALIDBITS ValidBits; - UCHAR Reserved; - WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_FLAGS Flags; - GUID SectionType; - GUID FRUId; - WHEA_ERROR_SEVERITY SectionSeverity; - CCHAR FRUText[20]; -} WHEA_ERROR_RECORD_SECTION_DESCRIPTOR, *PWHEA_ERROR_RECORD_SECTION_DESCRIPTOR; - -#define WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_REVISION 0x0201 - -#if WHEA_DOWNLEVEL_TYPE_NAMES - -#define WHEA_SECTION_DESCRIPTOR_REVISION \ - WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_REVISION - -#endif - -// -// Validate the error record section descriptor structure against the -// definitions in the UEFI specification. -// - -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR, SectionOffset, 0, 4); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR, SectionLength, 4, 4); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR, Revision, 8, 2); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR, ValidBits, 10, 1); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR, Reserved, 11, 1); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR, Flags, 12, 4); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR, SectionType, 16, 16); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR, FRUId, 32, 16); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR, SectionSeverity, 48, 4); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR, FRUText, 52, 20); - -//----------------------------------------------------------- WHEA_ERROR_RECORD - -typedef struct _WHEA_ERROR_RECORD { - WHEA_ERROR_RECORD_HEADER Header; - WHEA_ERROR_RECORD_SECTION_DESCRIPTOR SectionDescriptor[ANYSIZE_ARRAY]; -} WHEA_ERROR_RECORD, *PWHEA_ERROR_RECORD; - -// -// Validate the error record structure against the definitions in the UEFI -// specification. -// - -CPER_FIELD_CHECK(WHEA_ERROR_RECORD, Header, 0, 128); -CPER_FIELD_CHECK(WHEA_ERROR_RECORD, SectionDescriptor, 128, 72); - -//---------------------------------------- WHEA_PROCESSOR_GENERIC_ERROR_SECTION - -#define GENPROC_PROCTYPE_XPF 0 -#define GENPROC_PROCTYPE_IPF 1 - -#define GENPROC_PROCISA_X86 0 -#define GENPROC_PROCISA_IPF 1 -#define GENPROC_PROCISA_X64 2 - -#define GENPROC_PROCERRTYPE_UNKNOWN 0 -#define GENPROC_PROCERRTYPE_CACHE 1 -#define GENPROC_PROCERRTYPE_TLB 2 -#define GENPROC_PROCERRTYPE_BUS 4 -#define GENPROC_PROCERRTYPE_MAE 8 - -#define GENPROC_OP_GENERIC 0 -#define GENPROC_OP_DATAREAD 1 -#define GENPROC_OP_DATAWRITE 2 -#define GENPROC_OP_INSTRUCTIONEXE 3 - -#define GENPROC_FLAGS_RESTARTABLE 0x01 -#define GENPROC_FLAGS_PRECISEIP 0x02 -#define GENPROC_FLAGS_OVERFLOW 0x04 -#define GENPROC_FLAGS_CORRECTED 0x08 - -typedef union _WHEA_PROCESSOR_FAMILY_INFO { - struct { - ULONG Stepping:4; - ULONG Model:4; - ULONG Family:4; - ULONG ProcessorType:2; - ULONG Reserved1:2; - ULONG ExtendedModel:4; - ULONG ExtendedFamily:8; - ULONG Reserved2:4; - ULONG Reserved3; - } DUMMYSTRUCTNAME; - ULONGLONG AsULONGLONG; -} WHEA_PROCESSOR_FAMILY_INFO, *PWHEA_PROCESSOR_FAMILY_INFO; - -typedef union _WHEA_PROCESSOR_GENERIC_ERROR_SECTION_VALIDBITS { - struct { - ULONGLONG ProcessorType:1; - ULONGLONG InstructionSet:1; - ULONGLONG ErrorType:1; - ULONGLONG Operation:1; - ULONGLONG Flags:1; - ULONGLONG Level:1; - ULONGLONG CPUVersion:1; - ULONGLONG CPUBrandString:1; - ULONGLONG ProcessorId:1; - ULONGLONG TargetAddress:1; - ULONGLONG RequesterId:1; - ULONGLONG ResponderId:1; - ULONGLONG InstructionPointer:1; - ULONGLONG Reserved:51; - } DUMMYSTRUCTNAME; - ULONGLONG ValidBits; -} WHEA_PROCESSOR_GENERIC_ERROR_SECTION_VALIDBITS, - *PWHEA_PROCESSOR_GENERIC_ERROR_SECTION_VALIDBITS; - -typedef struct _WHEA_PROCESSOR_GENERIC_ERROR_SECTION { - WHEA_PROCESSOR_GENERIC_ERROR_SECTION_VALIDBITS ValidBits; - UCHAR ProcessorType; - UCHAR InstructionSet; - UCHAR ErrorType; - UCHAR Operation; - UCHAR Flags; - UCHAR Level; - USHORT Reserved; - ULONGLONG CPUVersion; - UCHAR CPUBrandString[128]; - ULONGLONG ProcessorId; - ULONGLONG TargetAddress; - ULONGLONG RequesterId; - ULONGLONG ResponderId; - ULONGLONG InstructionPointer; -} WHEA_PROCESSOR_GENERIC_ERROR_SECTION, *PWHEA_PROCESSOR_GENERIC_ERROR_SECTION; - -// -// Define alternate type name for downlevel source compatibility. -// - -#if WHEA_DOWNLEVEL_TYPE_NAMES - -typedef WHEA_PROCESSOR_GENERIC_ERROR_SECTION_VALIDBITS - WHEA_GENERIC_PROCESSOR_ERROR_VALIDBITS, - *PWHEA_GENERIC_PROCESSOR_ERROR_VALIDBITS; - -typedef WHEA_PROCESSOR_GENERIC_ERROR_SECTION - WHEA_GENERIC_PROCESSOR_ERROR, *PWHEA_GENERIC_PROCESSOR_ERROR; - -#endif - -// -// Validate the processor generic error section structure against the -// definitions in the UEFI specification. -// - -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, ValidBits, 0, 8); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, ProcessorType, 8, 1); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, InstructionSet, 9, 1); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, ErrorType, 10, 1); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, Operation, 11, 1); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, Flags, 12, 1); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, Level, 13, 1); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, Reserved, 14, 2); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, CPUVersion, 16, 8); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, CPUBrandString, 24, 128); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, ProcessorId, 152, 8); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, TargetAddress, 160, 8); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, RequesterId, 168, 8); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, ResponderId, 176, 8); -CPER_FIELD_CHECK(WHEA_PROCESSOR_GENERIC_ERROR_SECTION, InstructionPointer, 184, 8); - -//-------------------------------------------- WHEA_XPF_PROCESSOR_ERROR_SECTION - -// -// x86/x64 cache check structure. -// - -#define XPF_CACHE_CHECK_TRANSACTIONTYPE_INSTRUCTION 0 -#define XPF_CACHE_CHECK_TRANSACTIONTYPE_DATAACCESS 1 -#define XPF_CACHE_CHECK_TRANSACTIONTYPE_GENERIC 2 - -#define XPF_CACHE_CHECK_OPERATION_GENERIC 0 -#define XPF_CACHE_CHECK_OPERATION_GENREAD 1 -#define XPF_CACHE_CHECK_OPERATION_GENWRITE 2 -#define XPF_CACHE_CHECK_OPERATION_DATAREAD 3 -#define XPF_CACHE_CHECK_OPERATION_DATAWRITE 4 -#define XPF_CACHE_CHECK_OPERATION_INSTRUCTIONFETCH 5 -#define XPF_CACHE_CHECK_OPERATION_PREFETCH 6 -#define XPF_CACHE_CHECK_OPERATION_EVICTION 7 -#define XPF_CACHE_CHECK_OPERATION_SNOOP 8 - -typedef union _WHEA_XPF_CACHE_CHECK { - struct { - ULONGLONG TransactionTypeValid:1; - ULONGLONG OperationValid:1; - ULONGLONG LevelValid:1; - ULONGLONG ProcessorContextCorruptValid:1; - ULONGLONG UncorrectedValid:1; - ULONGLONG PreciseIPValid:1; - ULONGLONG RestartableIPValid:1; - ULONGLONG OverflowValid:1; - ULONGLONG ReservedValid:8; - - ULONGLONG TransactionType:2; - ULONGLONG Operation:4; - ULONGLONG Level:3; - ULONGLONG ProcessorContextCorrupt:1; - ULONGLONG Uncorrected:1; - ULONGLONG PreciseIP:1; - ULONGLONG RestartableIP:1; - ULONGLONG Overflow:1; - - ULONGLONG Reserved:34; - } DUMMYSTRUCTNAME; - ULONGLONG XpfCacheCheck; -} WHEA_XPF_CACHE_CHECK, *PWHEA_XPF_CACHE_CHECK; - -// -// x86/x64 TLB check structure. -// - -#define XPF_TLB_CHECK_TRANSACTIONTYPE_INSTRUCTION 0 -#define XPF_TLB_CHECK_TRANSACTIONTYPE_DATAACCESS 1 -#define XPF_TLB_CHECK_TRANSACTIONTYPE_GENERIC 2 - -#define XPF_TLB_CHECK_OPERATION_GENERIC 0 -#define XPF_TLB_CHECK_OPERATION_GENREAD 1 -#define XPF_TLB_CHECK_OPERATION_GENWRITE 2 -#define XPF_TLB_CHECK_OPERATION_DATAREAD 3 -#define XPF_TLB_CHECK_OPERATION_DATAWRITE 4 -#define XPF_TLB_CHECK_OPERATION_INSTRUCTIONFETCH 5 -#define XPF_TLB_CHECK_OPERATION_PREFETCH 6 - -typedef union _WHEA_XPF_TLB_CHECK { - struct { - ULONGLONG TransactionTypeValid:1; - ULONGLONG OperationValid:1; - ULONGLONG LevelValid:1; - ULONGLONG ProcessorContextCorruptValid:1; - ULONGLONG UncorrectedValid:1; - ULONGLONG PreciseIPValid:1; - ULONGLONG RestartableIPValid:1; - ULONGLONG OverflowValid:1; - ULONGLONG ReservedValid:8; - - ULONGLONG TransactionType:2; - ULONGLONG Operation:4; - ULONGLONG Level:3; - ULONGLONG ProcessorContextCorrupt:1; - ULONGLONG Uncorrected:1; - ULONGLONG PreciseIP:1; - ULONGLONG RestartableIP:1; - ULONGLONG Overflow:1; - ULONGLONG Reserved:34; - } DUMMYSTRUCTNAME; - ULONGLONG XpfTLBCheck; -} WHEA_XPF_TLB_CHECK, *PWHEA_XPF_TLB_CHECK; - -// -// x86/x64 bus check structure. -// - -#define XPF_BUS_CHECK_TRANSACTIONTYPE_INSTRUCTION 0 -#define XPF_BUS_CHECK_TRANSACTIONTYPE_DATAACCESS 1 -#define XPF_BUS_CHECK_TRANSACTIONTYPE_GENERIC 2 - -#define XPF_BUS_CHECK_OPERATION_GENERIC 0 -#define XPF_BUS_CHECK_OPERATION_GENREAD 1 -#define XPF_BUS_CHECK_OPERATION_GENWRITE 2 -#define XPF_BUS_CHECK_OPERATION_DATAREAD 3 -#define XPF_BUS_CHECK_OPERATION_DATAWRITE 4 -#define XPF_BUS_CHECK_OPERATION_INSTRUCTIONFETCH 5 -#define XPF_BUS_CHECK_OPERATION_PREFETCH 6 - -#define XPF_BUS_CHECK_PARTICIPATION_PROCORIGINATED 0 -#define XPF_BUS_CHECK_PARTICIPATION_PROCRESPONDED 1 -#define XPF_BUS_CHECK_PARTICIPATION_PROCOBSERVED 2 -#define XPF_BUS_CHECK_PARTICIPATION_GENERIC 3 - -#define XPF_BUS_CHECK_ADDRESS_MEMORY 0 -#define XPF_BUS_CHECK_ADDRESS_RESERVED 1 -#define XPF_BUS_CHECK_ADDRESS_IO 2 -#define XPF_BUS_CHECK_ADDRESS_OTHER 3 - -typedef union _WHEA_XPF_BUS_CHECK { - struct { - ULONGLONG TransactionTypeValid:1; - ULONGLONG OperationValid:1; - ULONGLONG LevelValid:1; - ULONGLONG ProcessorContextCorruptValid:1; - ULONGLONG UncorrectedValid:1; - ULONGLONG PreciseIPValid:1; - ULONGLONG RestartableIPValid:1; - ULONGLONG OverflowValid:1; - ULONGLONG ParticipationValid:1; - ULONGLONG TimeoutValid:1; - ULONGLONG AddressSpaceValid:1; - ULONGLONG ReservedValid:5; - - ULONGLONG TransactionType:2; - ULONGLONG Operation:4; - ULONGLONG Level:3; - ULONGLONG ProcessorContextCorrupt:1; - ULONGLONG Uncorrected:1; - ULONGLONG PreciseIP:1; - ULONGLONG RestartableIP:1; - ULONGLONG Overflow:1; - ULONGLONG Participation:2; - ULONGLONG Timeout:1; - ULONGLONG AddressSpace:2; - ULONGLONG Reserved:29; - } DUMMYSTRUCTNAME; - ULONGLONG XpfBusCheck; -} WHEA_XPF_BUS_CHECK, *PWHEA_XPF_BUS_CHECK; - -// -// x86/x64 micro-architecture specific check structure. -// - -#define XPF_MS_CHECK_ERRORTYPE_NOERROR 0 -#define XPF_MS_CHECK_ERRORTYPE_UNCLASSIFIED 1 -#define XPF_MS_CHECK_ERRORTYPE_MCROMPARITY 2 -#define XPF_MS_CHECK_ERRORTYPE_EXTERNAL 3 -#define XPF_MS_CHECK_ERRORTYPE_FRC 4 -#define XPF_MS_CHECK_ERRORTYPE_INTERNALUNCLASSIFIED 5 - -typedef union _WHEA_XPF_MS_CHECK { - struct { - ULONGLONG ErrorTypeValid:1; - ULONGLONG ProcessorContextCorruptValid:1; - ULONGLONG UncorrectedValid:1; - ULONGLONG PreciseIPValid:1; - ULONGLONG RestartableIPValid:1; - ULONGLONG OverflowValid:1; - ULONGLONG ReservedValue:10; - - ULONGLONG ErrorType:3; - ULONGLONG ProcessorContextCorrupt:1; - ULONGLONG Uncorrected:1; - ULONGLONG PreciseIP:1; - ULONGLONG RestartableIP:1; - ULONGLONG Overflow:1; - ULONGLONG Reserved:40; - } DUMMYSTRUCTNAME; - ULONGLONG XpfMsCheck; -} WHEA_XPF_MS_CHECK, *PWHEA_XPF_MS_CHECK; - -// -// x86/x64 Processor Error Information Structure. -// - -typedef union _WHEA_XPF_PROCINFO_VALIDBITS { - struct { - ULONGLONG CheckInfo:1; - ULONGLONG TargetId:1; - ULONGLONG RequesterId:1; - ULONGLONG ResponderId:1; - ULONGLONG InstructionPointer:1; - ULONGLONG Reserved:59; - } DUMMYSTRUCTNAME; - ULONGLONG ValidBits; -} WHEA_XPF_PROCINFO_VALIDBITS, *PWHEA_XPF_PROCINFO_VALIDBITS; - -typedef struct _WHEA_XPF_PROCINFO { - GUID CheckInfoId; - WHEA_XPF_PROCINFO_VALIDBITS ValidBits; - union { - WHEA_XPF_CACHE_CHECK CacheCheck; - WHEA_XPF_TLB_CHECK TlbCheck; - WHEA_XPF_BUS_CHECK BusCheck; - WHEA_XPF_MS_CHECK MsCheck; - ULONGLONG AsULONGLONG; - } CheckInfo; - ULONGLONG TargetId; - ULONGLONG RequesterId; - ULONGLONG ResponderId; - ULONGLONG InstructionPointer; -} WHEA_XPF_PROCINFO, *PWHEA_XPF_PROCINFO; - -// -// x86/x64 Processor Context Information Structure. -// - -typedef struct _WHEA_X86_REGISTER_STATE { - ULONG Eax; - ULONG Ebx; - ULONG Ecx; - ULONG Edx; - ULONG Esi; - ULONG Edi; - ULONG Ebp; - ULONG Esp; - USHORT Cs; - USHORT Ds; - USHORT Ss; - USHORT Es; - USHORT Fs; - USHORT Gs; - ULONG Eflags; - ULONG Eip; - ULONG Cr0; - ULONG Cr1; - ULONG Cr2; - ULONG Cr3; - ULONG Cr4; - ULONGLONG Gdtr; - ULONGLONG Idtr; - USHORT Ldtr; - USHORT Tr; -} WHEA_X86_REGISTER_STATE, *PWHEA_X86_REGISTER_STATE; - -typedef struct DECLSPEC_ALIGN(16) _WHEA128A { - ULONGLONG Low; - LONGLONG High; -} WHEA128A, *PWHEA128A; - -#if defined(_MSC_VER) -#if (_MSC_VER >= 1200) -#pragma warning(push) -#pragma warning(disable:4324) // structure padded due to __declspec(align()) -#endif -#endif - -typedef struct _WHEA_X64_REGISTER_STATE { - ULONGLONG Rax; - ULONGLONG Rbx; - ULONGLONG Rcx; - ULONGLONG Rdx; - ULONGLONG Rsi; - ULONGLONG Rdi; - ULONGLONG Rbp; - ULONGLONG Rsp; - ULONGLONG R8; - ULONGLONG R9; - ULONGLONG R10; - ULONGLONG R11; - ULONGLONG R12; - ULONGLONG R13; - ULONGLONG R14; - ULONGLONG R15; - USHORT Cs; - USHORT Ds; - USHORT Ss; - USHORT Es; - USHORT Fs; - USHORT Gs; - ULONG Reserved; - ULONGLONG Rflags; - ULONGLONG Eip; - ULONGLONG Cr0; - ULONGLONG Cr1; - ULONGLONG Cr2; - ULONGLONG Cr3; - ULONGLONG Cr4; - ULONGLONG Cr8; - WHEA128A Gdtr; - WHEA128A Idtr; - USHORT Ldtr; - USHORT Tr; -} WHEA_X64_REGISTER_STATE, *PWHEA_X64_REGISTER_STATE; - -#if defined(_MSC_VER) -#if (_MSC_VER >= 1200) -#pragma warning(pop) -#endif -#endif - -#define XPF_CONTEXT_INFO_UNCLASSIFIEDDATA 0 -#define XPF_CONTEXT_INFO_MSRREGISTERS 1 -#define XPF_CONTEXT_INFO_32BITCONTEXT 2 -#define XPF_CONTEXT_INFO_64BITCONTEXT 3 -#define XPF_CONTEXT_INFO_FXSAVE 4 -#define XPF_CONTEXT_INFO_32BITDEBUGREGS 5 -#define XPF_CONTEXT_INFO_64BITDEBUGREGS 6 -#define XPF_CONTEXT_INFO_MMREGISTERS 7 - -typedef struct _WHEA_XPF_CONTEXT_INFO { - USHORT RegisterContextType; - USHORT RegisterDataSize; - ULONG MSRAddress; - ULONGLONG MmRegisterAddress; - - // - // UCHAR RegisterData[ANYSIZE_ARRAY]; - // - -} WHEA_XPF_CONTEXT_INFO, *PWHEA_XPF_CONTEXT_INFO; - -// -// x86/x64 Processor Error Section -// - -typedef union _WHEA_XPF_PROCESSOR_ERROR_SECTION_VALIDBITS { - struct { - ULONGLONG LocalAPICId:1; - ULONGLONG CpuId:1; - ULONGLONG ProcInfoCount:6; - ULONGLONG ContextInfoCount:6; - ULONGLONG Reserved:50; - } DUMMYSTRUCTNAME; - ULONGLONG ValidBits; -} WHEA_XPF_PROCESSOR_ERROR_SECTION_VALIDBITS, - *PWHEA_XPF_PROCESSOR_ERROR_SECTION_VALIDBITS; - -typedef struct _WHEA_XPF_PROCESSOR_ERROR_SECTION { - WHEA_XPF_PROCESSOR_ERROR_SECTION_VALIDBITS ValidBits; - ULONGLONG LocalAPICId; - UCHAR CpuId[48]; - - // - // WHEA_XPF_PROCINFO ProcInfo[ANYSIZE_ARRAY]; - // WHEA_XPF_CONTEXT_INFO ContextInfo[ANYSIZE_ARRAY]; - // - - UCHAR VariableInfo[ANYSIZE_ARRAY]; -} WHEA_XPF_PROCESSOR_ERROR_SECTION, *PWHEA_XPF_PROCESSOR_ERROR_SECTION; - -// -// Define alternate type names for downlevel source compatibility. -// - -#if WHEA_DOWNLEVEL_TYPE_NAMES - -typedef struct WHEA_XPF_PROCESSOR_ERROR_SECTION_VALIDBITS - WHEA_XPF_PROCESSOR_ERROR_VALIDBITS, *PWHEA_XPF_PROCESSOR_ERROR_VALIDBITS; - -typedef struct WHEA_XPF_PROCESSOR_ERROR_SECTION - WHEA_XPF_PROCESSOR_ERROR, *PWHEA_XPF_PROCESSOR_ERROR; - -#endif - -// -// Validate the x86/x64 processor error section structures against the -// definitions in the UEFI specification. -// - -CPER_FIELD_CHECK(WHEA_XPF_PROCINFO, CheckInfoId, 0, 16); -CPER_FIELD_CHECK(WHEA_XPF_PROCINFO, ValidBits, 16, 8); -CPER_FIELD_CHECK(WHEA_XPF_PROCINFO, CheckInfo, 24, 8); -CPER_FIELD_CHECK(WHEA_XPF_PROCINFO, TargetId, 32, 8); -CPER_FIELD_CHECK(WHEA_XPF_PROCINFO, RequesterId, 40, 8); -CPER_FIELD_CHECK(WHEA_XPF_PROCINFO, ResponderId, 48, 8); -CPER_FIELD_CHECK(WHEA_XPF_PROCINFO, InstructionPointer, 56, 8); - -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Eax, 0, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Ebx, 4, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Ecx, 8, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Edx, 12, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Esi, 16, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Edi, 20, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Ebp, 24, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Esp, 28, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Cs, 32, 2); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Ds, 34, 2); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Ss, 36, 2); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Es, 38, 2); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Fs, 40, 2); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Gs, 42, 2); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Eflags, 44, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Eip, 48, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Cr0, 52, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Cr1, 56, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Cr2, 60, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Cr3, 64, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Cr4, 68, 4); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Gdtr, 72, 8); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Idtr, 80, 8); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Ldtr, 88, 2); -CPER_FIELD_CHECK(WHEA_X86_REGISTER_STATE, Tr, 90, 2); - -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Rax, 0, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Rbx, 8, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Rcx, 16, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Rdx, 24, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Rsi, 32, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Rdi, 40, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Rbp, 48, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Rsp, 56, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, R8, 64, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, R9, 72, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, R10, 80, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, R11, 88, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, R12, 96, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, R13, 104, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, R14, 112, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, R15, 120, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Cs, 128, 2); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Ds, 130, 2); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Ss, 132, 2); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Es, 134, 2); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Fs, 136, 2); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Gs, 138, 2); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Reserved, 140, 4); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Rflags, 144, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Eip, 152, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Cr0, 160, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Cr1, 168, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Cr2, 176, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Cr3, 184, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Cr4, 192, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Cr8, 200, 8); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Gdtr, 208, 16); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Idtr, 224, 16); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Ldtr, 240, 2); -CPER_FIELD_CHECK(WHEA_X64_REGISTER_STATE, Tr, 242, 2); - -CPER_FIELD_CHECK(WHEA_XPF_CONTEXT_INFO, RegisterContextType, 0, 2); -CPER_FIELD_CHECK(WHEA_XPF_CONTEXT_INFO, RegisterDataSize, 2, 2); -CPER_FIELD_CHECK(WHEA_XPF_CONTEXT_INFO, MSRAddress, 4, 4); -CPER_FIELD_CHECK(WHEA_XPF_CONTEXT_INFO, MmRegisterAddress, 8, 8); - -CPER_FIELD_CHECK(WHEA_XPF_PROCESSOR_ERROR_SECTION, ValidBits, 0, 8); -CPER_FIELD_CHECK(WHEA_XPF_PROCESSOR_ERROR_SECTION, LocalAPICId, 8, 8); -CPER_FIELD_CHECK(WHEA_XPF_PROCESSOR_ERROR_SECTION, CpuId, 16, 48); -CPER_FIELD_CHECK(WHEA_XPF_PROCESSOR_ERROR_SECTION, VariableInfo, 64, ANYSIZE_ARRAY); - -//--------------------------------------------------- WHEA_MEMORY_ERROR_SECTION - -typedef union _WHEA_MEMORY_ERROR_SECTION_VALIDBITS { - struct { - ULONGLONG ErrorStatus:1; - ULONGLONG PhysicalAddress:1; - ULONGLONG PhysicalAddressMask:1; - ULONGLONG Node:1; - ULONGLONG Card:1; - ULONGLONG Module:1; - ULONGLONG Bank:1; - ULONGLONG Device:1; - ULONGLONG Row:1; - ULONGLONG Column:1; - ULONGLONG BitPosition:1; - ULONGLONG RequesterId:1; - ULONGLONG ResponderId:1; - ULONGLONG TargetId:1; - ULONGLONG ErrorType:1; - ULONGLONG Reserved:49; - } DUMMYSTRUCTNAME; - ULONGLONG ValidBits; -} WHEA_MEMORY_ERROR_SECTION_VALIDBITS, - *PWHEA_MEMORY_ERROR_SECTION_VALIDBITS; - -#define WHEA_MEMERRTYPE_UNKNOWN 0x00 -#define WHEA_MEMERRTYPE_NOERROR 0x01 -#define WHEA_MEMERRTYPE_SINGLEBITECC 0x02 -#define WHEA_MEMERRTYPE_MULTIBITECC 0x03 -#define WHEA_MEMERRTYPE_SINGLESYMCHIPKILL 0x04 -#define WHEA_MEMERRTYPE_MULTISYMCHIPKILL 0x05 -#define WHEA_MEMERRTYPE_MASTERABORT 0x06 -#define WHEA_MEMERRTYPE_TARGETABORT 0x07 -#define WHEA_MEMERRTYPE_PARITYERROR 0x08 -#define WHEA_MEMERRTYPE_WATCHDOGTIMEOUT 0x09 -#define WHEA_MEMERRTYPE_INVALIDADDRESS 0x0A -#define WHEA_MEMERRTYPE_MIRRORBROKEN 0x0B -#define WHEA_MEMERRTYPE_MEMORYSPARING 0x0C - -typedef struct _WHEA_MEMORY_ERROR_SECTION { - WHEA_MEMORY_ERROR_SECTION_VALIDBITS ValidBits; - WHEA_ERROR_STATUS ErrorStatus; - ULONGLONG PhysicalAddress; - ULONGLONG PhysicalAddressMask; - USHORT Node; - USHORT Card; - USHORT Module; - USHORT Bank; - USHORT Device; - USHORT Row; - USHORT Column; - USHORT BitPosition; - ULONGLONG RequesterId; - ULONGLONG ResponderId; - ULONGLONG TargetId; - UCHAR ErrorType; -} WHEA_MEMORY_ERROR_SECTION, *PWHEA_MEMORY_ERROR_SECTION; - -// -// Define alternate names allowing for downlevel source compatibility. -// - -#if WHEA_DOWNLEVEL_TYPE_NAMES - -typedef WHEA_MEMORY_ERROR_SECTION_VALIDBITS - WHEA_MEMORY_ERROR_VALIDBITS, *PWHEA_MEMORY_ERROR_VALIDBITS; - -typedef WHEA_MEMORY_ERROR_SECTION - WHEA_MEMORY_ERROR, *PWHEA_MEMORY_ERROR; - -#endif - -// -// Validate the memory error section structures against the definitions in the -// UEFI specification. -// - -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, ValidBits, 0, 8); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, ErrorStatus, 8, 8); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, PhysicalAddress, 16, 8); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, PhysicalAddressMask, 24, 8); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, Node, 32, 2); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, Card, 34, 2); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, Module, 36, 2); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, Bank, 38, 2); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, Device, 40, 2); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, Row, 42, 2); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, Column, 44, 2); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, BitPosition, 46, 2); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, RequesterId, 48, 8); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, ResponderId, 56, 8); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, TargetId, 64, 8); -CPER_FIELD_CHECK(WHEA_MEMORY_ERROR_SECTION, ErrorType, 72, 1); - -//----------------------------------------------- WHEA_PCIEXPRESS_ERROR_SECTION - -typedef union _WHEA_PCIEXPRESS_ERROR_SECTION_VALIDBITS { - struct { - ULONGLONG PortType:1; - ULONGLONG Version:1; - ULONGLONG CommandStatus:1; - ULONGLONG DeviceId:1; - ULONGLONG DeviceSerialNumber:1; - ULONGLONG BridgeControlStatus:1; - ULONGLONG ExpressCapability:1; - ULONGLONG AerInfo:1; - ULONGLONG Reserved:56; - } DUMMYSTRUCTNAME; - ULONGLONG ValidBits; -} WHEA_PCIEXPRESS_ERROR_SECTION_VALIDBITS, - *PWHEA_PCIEXPRESS_ERROR_SECTION_VALIDBITS; - -typedef struct _WHEA_PCIEXPRESS_DEVICE_ID { - USHORT VendorID; - USHORT DeviceID; - ULONG ClassCode:24; - ULONG FunctionNumber:8; - ULONG DeviceNumber:8; - ULONG Segment:16; - ULONG PrimaryBusNumber:8; - ULONG SecondaryBusNumber:8; - ULONG Reserved1:3; - ULONG SlotNumber:13; - ULONG Reserved2:8; -} WHEA_PCIEXPRESS_DEVICE_ID, *PWHEA_PCIEXPRESS_DEVICE_ID; - -typedef union _WHEA_PCIEXPRESS_VERSION { - struct { - UCHAR MinorVersion; - UCHAR MajorVersion; - USHORT Reserved; - } DUMMYSTRUCTNAME; - ULONG AsULONG; -} WHEA_PCIEXPRESS_VERSION, *PWHEA_PCIEXPRESS_VERSION; - -typedef union _WHEA_PCIEXPRESS_COMMAND_STATUS { - struct { - USHORT Command; - USHORT Status; - } DUMMYSTRUCTNAME; - ULONG AsULONG; -} WHEA_PCIEXPRESS_COMMAND_STATUS, *PWHEA_PCIEXPRESS_COMMAND_STATUS; - -typedef union _WHEA_PCIEXPRESS_BRIDGE_CONTROL_STATUS { - struct { - USHORT BridgeSecondaryStatus; - USHORT BridgeControl; - } DUMMYSTRUCTNAME; - ULONG AsULONG; -} WHEA_PCIEXPRESS_BRIDGE_CONTROL_STATUS, - *PWHEA_PCIEXPRESS_BRIDGE_CONTROL_STATUS; - -typedef enum _WHEA_PCIEXPRESS_DEVICE_TYPE { - WheaPciExpressEndpoint = 0, - WheaPciExpressLegacyEndpoint, - WheaPciExpressRootPort = 4, - WheaPciExpressUpstreamSwitchPort, - WheaPciExpressDownstreamSwitchPort, - WheaPciExpressToPciXBridge, - WheaPciXToExpressBridge, - WheaPciExpressRootComplexIntegratedEndpoint, - WheaPciExpressRootComplexEventCollector -} WHEA_PCIEXPRESS_DEVICE_TYPE; - -typedef struct _WHEA_PCIEXPRESS_ERROR_SECTION { - WHEA_PCIEXPRESS_ERROR_SECTION_VALIDBITS ValidBits; - WHEA_PCIEXPRESS_DEVICE_TYPE PortType; - WHEA_PCIEXPRESS_VERSION Version; - WHEA_PCIEXPRESS_COMMAND_STATUS CommandStatus; - ULONG Reserved; - WHEA_PCIEXPRESS_DEVICE_ID DeviceId; - ULONGLONG DeviceSerialNumber; - WHEA_PCIEXPRESS_BRIDGE_CONTROL_STATUS BridgeControlStatus; - UCHAR ExpressCapability[60]; - UCHAR AerInfo[96]; -} WHEA_PCIEXPRESS_ERROR_SECTION, *PWHEA_PCIEXPRESS_ERROR_SECTION; - -#if WHEA_DOWNLEVEL_TYPE_NAMES - -typedef WHEA_PCIEXPRESS_ERROR_SECTION_VALIDBITS - WHEA_PCIEXPRESS_ERROR_VALIDBITS, - *PWHEA_PCIEXPRESS_ERROR_VALIDBITS; - -typedef WHEA_PCIEXPRESS_ERROR_SECTION - WHEA_PCIEXPRESS_ERROR, *PWHEA_PCIEXPRESS_ERROR; - -#endif - -// -// Validate the PCI Express error section structures against the definitions -// in the UEFI specification. -// - -CPER_FIELD_CHECK(WHEA_PCIEXPRESS_ERROR_SECTION, ValidBits, 0, 8); -CPER_FIELD_CHECK(WHEA_PCIEXPRESS_ERROR_SECTION, PortType, 8, 4); -CPER_FIELD_CHECK(WHEA_PCIEXPRESS_ERROR_SECTION, Version, 12, 4); -CPER_FIELD_CHECK(WHEA_PCIEXPRESS_ERROR_SECTION, CommandStatus, 16, 4); -CPER_FIELD_CHECK(WHEA_PCIEXPRESS_ERROR_SECTION, Reserved, 20, 4); -CPER_FIELD_CHECK(WHEA_PCIEXPRESS_ERROR_SECTION, DeviceId, 24, 16); -CPER_FIELD_CHECK(WHEA_PCIEXPRESS_ERROR_SECTION, DeviceSerialNumber, 40, 8); -CPER_FIELD_CHECK(WHEA_PCIEXPRESS_ERROR_SECTION, BridgeControlStatus, 48, 4); -CPER_FIELD_CHECK(WHEA_PCIEXPRESS_ERROR_SECTION, ExpressCapability, 52, 60); -CPER_FIELD_CHECK(WHEA_PCIEXPRESS_ERROR_SECTION, AerInfo, 112, 96); - -//-------------------------------------------------- WHEA_PCIXBUS_ERROR_SECTION - -#define PCIXBUS_ERRTYPE_UNKNOWN 0x0000 -#define PCIXBUS_ERRTYPE_DATAPARITY 0x0001 -#define PCIXBUS_ERRTYPE_SYSTEM 0x0002 -#define PCIXBUS_ERRTYPE_MASTERABORT 0x0003 -#define PCIXBUS_ERRTYPE_BUSTIMEOUT 0x0004 -#define PCIXBUS_ERRTYPE_MASTERDATAPARITY 0x0005 -#define PCIXBUS_ERRTYPE_ADDRESSPARITY 0x0006 -#define PCIXBUS_ERRTYPE_COMMANDPARITY 0x0007 - -typedef union _WHEA_PCIXBUS_ERROR_SECTION_VALIDBITS { - struct { - ULONGLONG ErrorStatus:1; - ULONGLONG ErrorType:1; - ULONGLONG BusId:1; - ULONGLONG BusAddress:1; - ULONGLONG BusData:1; - ULONGLONG BusCommand:1; - ULONGLONG RequesterId:1; - ULONGLONG CompleterId:1; - ULONGLONG TargetId:1; - ULONGLONG Reserved:55; - } DUMMYSTRUCTNAME; - ULONGLONG ValidBits; -} WHEA_PCIXBUS_ERROR_SECTION_VALIDBITS, *PWHEA_PCIXBUS_ERROR_SECTION_VALIDBITS; - -typedef union _WHEA_PCIXBUS_ID { - struct { - UCHAR BusNumber; - UCHAR BusSegment; - } DUMMYSTRUCTNAME; - USHORT AsUSHORT; -} WHEA_PCIXBUS_ID, *PWHEA_PCIXBUS_ID; - -typedef union _WHEA_PCIXBUS_COMMAND { - struct { - ULONGLONG Command:56; - ULONGLONG PCIXCommand:1; - ULONGLONG Reserved:7; - } DUMMYSTRUCTNAME; - ULONGLONG AsULONGLONG; -} WHEA_PCIXBUS_COMMAND, *PWHEA_PCIXBUS_COMMAND; - -typedef struct _WHEA_PCIXBUS_ERROR_SECTION { - WHEA_PCIXBUS_ERROR_SECTION_VALIDBITS ValidBits; - WHEA_ERROR_STATUS ErrorStatus; - USHORT ErrorType; - WHEA_PCIXBUS_ID BusId; - ULONG Reserved; - ULONGLONG BusAddress; - ULONGLONG BusData; - WHEA_PCIXBUS_COMMAND BusCommand; - ULONGLONG RequesterId; - ULONGLONG CompleterId; - ULONGLONG TargetId; -} WHEA_PCIXBUS_ERROR_SECTION, *PWHEA_PCIXBUS_ERROR_SECTION; - -#if WHEA_DOWNLEVEL_TYPE_NAMES - -typedef WHEA_PCIXBUS_ERROR_SECTION_VALIDBITS - WHEA_PCIXBUS_ERROR_VALIDBITS, - *PWHEA_PCIXBUS_ERROR_VALIDBITS; - -typedef WHEA_PCIXBUS_ERROR_SECTION - WHEA_PCIXBUS_ERROR, *PWHEA_PCIXBUS_ERROR; - -#endif - -CPER_FIELD_CHECK(WHEA_PCIXBUS_ERROR_SECTION, ValidBits, 0, 8); -CPER_FIELD_CHECK(WHEA_PCIXBUS_ERROR_SECTION, ErrorStatus, 8, 8); -CPER_FIELD_CHECK(WHEA_PCIXBUS_ERROR_SECTION, ErrorType, 16, 2); -CPER_FIELD_CHECK(WHEA_PCIXBUS_ERROR_SECTION, BusId, 18, 2); -CPER_FIELD_CHECK(WHEA_PCIXBUS_ERROR_SECTION, Reserved, 20, 4); -CPER_FIELD_CHECK(WHEA_PCIXBUS_ERROR_SECTION, BusAddress, 24, 8); -CPER_FIELD_CHECK(WHEA_PCIXBUS_ERROR_SECTION, BusData, 32, 8); -CPER_FIELD_CHECK(WHEA_PCIXBUS_ERROR_SECTION, BusCommand, 40, 8); -CPER_FIELD_CHECK(WHEA_PCIXBUS_ERROR_SECTION, RequesterId, 48, 8); -CPER_FIELD_CHECK(WHEA_PCIXBUS_ERROR_SECTION, CompleterId, 56, 8); -CPER_FIELD_CHECK(WHEA_PCIXBUS_ERROR_SECTION, TargetId, 64, 8); - -//----------------------------------------------- WHEA_PCIXDEVICE_ERROR_SECTION - -typedef union _WHEA_PCIXDEVICE_ERROR_SECTION_VALIDBITS { - struct { - ULONGLONG ErrorStatus:1; - ULONGLONG IdInfo:1; - ULONGLONG MemoryNumber:1; - ULONGLONG IoNumber:1; - ULONGLONG RegisterDataPairs:1; - ULONGLONG Reserved:59; - } DUMMYSTRUCTNAME; - ULONGLONG ValidBits; -} WHEA_PCIXDEVICE_ERROR_SECTION_VALIDBITS, - *PWHEA_PCIXDEVICE_ERROR_SECTION_VALIDBITS; - -typedef struct _WHEA_PCIXDEVICE_ID { - USHORT VendorId; - USHORT DeviceId; - ULONG ClassCode:24; - ULONG FunctionNumber:8; - ULONG DeviceNumber:8; - ULONG BusNumber:8; - ULONG SegmentNumber:8; - ULONG Reserved1:8; - ULONG Reserved2; -} WHEA_PCIXDEVICE_ID, *PWHEA_PCIXDEVICE_ID; - -typedef struct WHEA_PCIXDEVICE_REGISTER_PAIR { - ULONGLONG Register; - ULONGLONG Data; -} WHEA_PCIXDEVICE_REGISTER_PAIR, *PWHEA_PCIXDEVICE_REGISTER_PAIR; - -typedef struct _WHEA_PCIXDEVICE_ERROR_SECTION { - WHEA_PCIXDEVICE_ERROR_SECTION_VALIDBITS ValidBits; - WHEA_ERROR_STATUS ErrorStatus; - WHEA_PCIXDEVICE_ID IdInfo; - ULONG MemoryNumber; - ULONG IoNumber; - WHEA_PCIXDEVICE_REGISTER_PAIR RegisterDataPairs[ANYSIZE_ARRAY]; -} WHEA_PCIXDEVICE_ERROR_SECTION, *PWHEA_PCIXDEVICE_ERROR_SECTION; - -#if WHEA_DOWNLEVEL_TYPE_NAMES - -typedef WHEA_PCIXDEVICE_ERROR_SECTION_VALIDBITS - WHEA_PCIXDEVICE_ERROR_VALIDBITS, *PWHEA_PCIXDEVICE_ERROR_VALIDBITS; - -typedef WHEA_PCIXDEVICE_ERROR_SECTION - WHEA_PCIXDEVICE_ERROR, *PWHEA_PCIXDEVICE_ERROR; - -#endif - -CPER_FIELD_CHECK(WHEA_PCIXDEVICE_ERROR_SECTION, ValidBits, 0, 8); -CPER_FIELD_CHECK(WHEA_PCIXDEVICE_ERROR_SECTION, ErrorStatus, 8, 8); -CPER_FIELD_CHECK(WHEA_PCIXDEVICE_ERROR_SECTION, IdInfo, 16, 16); -CPER_FIELD_CHECK(WHEA_PCIXDEVICE_ERROR_SECTION, MemoryNumber, 32, 4); -CPER_FIELD_CHECK(WHEA_PCIXDEVICE_ERROR_SECTION, IoNumber, 36, 4); -CPER_FIELD_CHECK(WHEA_PCIXDEVICE_ERROR_SECTION, RegisterDataPairs, 40, 16); - -//---------------------------------------- WHEA_FIRMWARE_ERROR_RECORD_REFERENCE - -#define WHEA_FIRMWARE_RECORD_TYPE_IPFSAL 0 - -typedef struct _WHEA_FIRMWARE_ERROR_RECORD_REFERENCE { - UCHAR Type; - UCHAR Reserved[7]; - ULONGLONG FirmwareRecordId; -} WHEA_FIRMWARE_ERROR_RECORD_REFERENCE, *PWHEA_FIRMWARE_ERROR_RECORD_REFERENCE; - -#if WHEA_DOWNLEVEL_TYPE_NAMES - -typedef WHEA_FIRMWARE_ERROR_RECORD_REFERENCE - WHEA_FIRMWARE_RECORD, *PWHEA_FIRMWARE_RECORD; - -#endif - -CPER_FIELD_CHECK(WHEA_FIRMWARE_ERROR_RECORD_REFERENCE, Type, 0, 1); -CPER_FIELD_CHECK(WHEA_FIRMWARE_ERROR_RECORD_REFERENCE, Reserved, 1, 7); -CPER_FIELD_CHECK(WHEA_FIRMWARE_ERROR_RECORD_REFERENCE, FirmwareRecordId, 8, 8); - -// -// This is the start of the Microsoft specific extensions to the Common Platform -// Error Record specification. This is in accordance with Appendix N, section -// 2.3 of the Unified Extensible Firware Interface specification, which allows -// the specification of non-standard section bodies. -// - -//------------------------------------------------------------- XPF_MCA_SECTION - -typedef union _MCG_STATUS { - struct { - ULONG RestartIpValid:1; - ULONG ErrorIpValid:1; - ULONG MachineCheckInProgress:1; - ULONG Reserved1:29; - ULONG Reserved2; - } DUMMYSTRUCTNAME; - ULONGLONG QuadPart; -} MCG_STATUS, *PMCG_STATUS; - -typedef union _MCI_STATUS { - struct { - USHORT McaErrorCode; - USHORT ModelErrorCode; - ULONG OtherInformation : 23; - ULONG ActionRequired : 1; - ULONG Signalling : 1; - ULONG ContextCorrupt : 1; - ULONG AddressValid : 1; - ULONG MiscValid : 1; - ULONG ErrorEnabled : 1; - ULONG UncorrectedError : 1; - ULONG StatusOverFlow : 1; - ULONG Valid : 1; - } DUMMYSTRUCTNAME; - ULONG64 QuadPart; -} MCI_STATUS, *PMCI_STATUS; - -typedef enum _WHEA_CPU_VENDOR { - WheaCpuVendorOther = 0, - WheaCpuVendorIntel, - WheaCpuVendorAmd -} WHEA_CPU_VENDOR, *PWHEA_CPU_VENDOR; - -#define WHEA_XPF_MCA_EXTREG_MAX_COUNT 24 -#define WHEA_XPF_MCA_SECTION_VERSION 1 - -typedef struct _WHEA_XPF_MCA_SECTION { - ULONG VersionNumber; - WHEA_CPU_VENDOR CpuVendor; - LARGE_INTEGER Timestamp; - ULONG ProcessorNumber; - MCG_STATUS GlobalStatus; - ULONGLONG InstructionPointer; - ULONG BankNumber; - MCI_STATUS Status; - ULONGLONG Address; - ULONGLONG Misc; - ULONG ExtendedRegisterCount; - ULONG Reserved2; - ULONGLONG ExtendedRegisters[WHEA_XPF_MCA_EXTREG_MAX_COUNT]; -} WHEA_XPF_MCA_SECTION, *PWHEA_XPF_MCA_SECTION; - -//------------------------------------------------------ WHEA_NMI_ERROR_SECTION - -typedef union _WHEA_NMI_ERROR_SECTION_FLAGS { - struct { - ULONG HypervisorError:1; - ULONG Reserved:31; - } DUMMYSTRUCTNAME; - ULONG AsULONG; -} WHEA_NMI_ERROR_SECTION_FLAGS, *PWHEA_NMI_ERROR_SECTION_FLAGS; - -typedef struct _WHEA_NMI_ERROR_SECTION { - UCHAR Data[8]; - WHEA_NMI_ERROR_SECTION_FLAGS Flags; -} WHEA_NMI_ERROR_SECTION, *PWHEA_NMI_ERROR_SECTION; - -#include - - -//-------------------------------------- Standard Error Notification Type GUIDs - -/* 2dce8bb1-bdd7-450e-b9ad-9cf4ebd4f890 */ -DEFINE_GUID(CMC_NOTIFY_TYPE_GUID, - 0x2dce8bb1, 0xbdd7, 0x450e, 0xb9, 0xad, - 0x9c, 0xf4, 0xeb, 0xd4, 0xf8, 0x90); - -/* 4e292f96-d843-4a55-a8c2-d481f27ebeee */ -DEFINE_GUID(CPE_NOTIFY_TYPE_GUID, - 0x4e292f96, 0xd843, 0x4a55, 0xa8, 0xc2, - 0xd4, 0x81, 0xf2, 0x7e, 0xbe, 0xee); - -/* e8f56ffe-919c-4cc5-ba88-65abe14913bb */ -DEFINE_GUID(MCE_NOTIFY_TYPE_GUID, - 0xe8f56ffe, 0x919c, 0x4cc5, 0xba, 0x88, - 0x65, 0xab, 0xe1, 0x49, 0x13, 0xbb); - -/* cf93c01f-1a16-4dfc-b8bc-9c4daf67c104 */ -DEFINE_GUID(PCIe_NOTIFY_TYPE_GUID, - 0xcf93c01f, 0x1a16, 0x4dfc, 0xb8, 0xbc, - 0x9c, 0x4d, 0xaf, 0x67, 0xc1, 0x04); - -/* cc5263e8-9308-454a-89d0-340bd39bc98e */ -DEFINE_GUID(INIT_NOTIFY_TYPE_GUID, - 0xcc5263e8, 0x9308, 0x454a, 0x89, 0xd0, - 0x34, 0x0b, 0xd3, 0x9b, 0xc9, 0x8e); - -/* 5bad89ff-b7e6-42c9-814a-cf2485d6e98a */ -DEFINE_GUID(NMI_NOTIFY_TYPE_GUID, - 0x5bad89ff, 0xb7e6, 0x42c9, 0x81, 0x4a, - 0xcf, 0x24, 0x85, 0xd6, 0xe9, 0x8a); - -/* 3d61a466-ab40-409a-a698-f362d464b38f */ -DEFINE_GUID(BOOT_NOTIFY_TYPE_GUID, - 0x3d61a466, 0xab40, 0x409a, 0xa6, 0x98, - 0xf3, 0x62, 0xd4, 0x64, 0xb3, 0x8f); - -//------------------------------------------- Standard Error Section type GUIDs - -/* 9876ccad-47b4-4bdb-b65e-16f193c4f3db */ -DEFINE_GUID(PROCESSOR_GENERIC_ERROR_SECTION_GUID, - 0x9876ccad, 0x47b4, 0x4bdb, 0xb6, 0x5e, - 0x16, 0xf1, 0x93, 0xc4, 0xf3, 0xdb); - -/* dc3ea0b0-a144-4797-b95b-53fa242b6e1d */ -DEFINE_GUID(XPF_PROCESSOR_ERROR_SECTION_GUID, - 0xdc3ea0b0, 0xa144, 0x4797, 0xb9, 0x5b, - 0x53, 0xfa, 0x24, 0x2b, 0x6e, 0x1d); - -/* e429faf1-3cb7-11d4-bca7-0080c73c8881 */ -DEFINE_GUID(IPF_PROCESSOR_ERROR_SECTION_GUID, - 0xe429faf1, 0x3cb7, 0x11d4, 0xbc, 0xa7, - 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81); - -/* a5bc1114-6f64-4ede-b863-3e83ed7c83b1 */ -DEFINE_GUID(MEMORY_ERROR_SECTION_GUID, - 0xa5bc1114, 0x6f64, 0x4ede, 0xb8, 0x63, - 0x3e, 0x83, 0xed, 0x7c, 0x83, 0xb1); - -/* d995e954-bbc1-430f-ad91-b44dcb3c6f35 */ -DEFINE_GUID(PCIEXPRESS_ERROR_SECTION_GUID, - 0xd995e954, 0xbbc1, 0x430f, 0xad, 0x91, - 0xb4, 0x4d, 0xcb, 0x3c, 0x6f, 0x35); - -/* c5753963-3b84-4095-bf78-eddad3f9c9dd */ -DEFINE_GUID(PCIXBUS_ERROR_SECTION_GUID, - 0xc5753963, 0x3b84, 0x4095, 0xbf, 0x78, - 0xed, 0xda, 0xd3, 0xf9, 0xc9, 0xdd); - -/* eb5e4685-ca66-4769-b6a2-26068b001326 */ -DEFINE_GUID(PCIXDEVICE_ERROR_SECTION_GUID, - 0xeb5e4685, 0xca66, 0x4769, 0xb6, 0xa2, - 0x26, 0x06, 0x8b, 0x00, 0x13, 0x26); - -/* 81212a96-09ed-4996-9471-8d729c8e69ed */ -DEFINE_GUID(FIRMWARE_ERROR_RECORD_REFERENCE_GUID, - 0x81212a96, 0x09ed, 0x4996, 0x94, 0x71, - 0x8d, 0x72, 0x9c, 0x8e, 0x69, 0xed); - -//-------------------------------------- Processor check information type GUIDs - -/* a55701f5-e3ef-43de-ac72-249b573fad2c */ -DEFINE_GUID(WHEA_CACHECHECK_GUID, - 0xa55701f5, 0xe3ef, 0x43de, 0xac, 0x72, - 0x24, 0x9b, 0x57, 0x3f, 0xad, 0x2c); - -/* fc06b535-5e1f-4562-9f25-0a3b9adb63c3 */ -DEFINE_GUID(WHEA_TLBCHECK_GUID, - 0xfc06b535, 0x5e1f, 0x4562, 0x9f, 0x25, - 0x0a, 0x3b, 0x9a, 0xdb, 0x63, 0xc3); - -/* 1cf3f8b3-c5b1-49a2-aa59-5eef92ffa63c */ -DEFINE_GUID(WHEA_BUSCHECK_GUID, - 0x1cf3f8b3, 0xc5b1, 0x49a2, 0xaa, 0x59, - 0x5e, 0xef, 0x92, 0xff, 0xa6, 0x3c); - -/* 48ab7f57-dc34-4f6c-a7d3-b0b5b0a74314 */ -DEFINE_GUID(WHEA_MSCHECK_GUID, - 0x48ab7f57, 0xdc34, 0x4f6c, 0xa7, 0xd3, - 0xb0, 0xb5, 0xb0, 0xa7, 0x43, 0x14); - -// -// This is the start of the Microsoft specific extensions to the Common Platform -// Error Record specification. This is in accordance with Appendix N, section -// 2.3 of the Unified Extensible Firware Interface specification, which allows -// the specification of non-standard section bodies. -// - -//---------------------------------------------------- Microsoft record creator - -/* cf07c4bd-b789-4e18-b3c4-1f732cb57131 */ -DEFINE_GUID(WHEA_RECORD_CREATOR_GUID, - 0xcf07c4bd, - 0xb789, 0x4e18, - 0xb3, 0xc4, 0x1f, 0x73, 0x2c, 0xb5, 0x71, 0x31); - -//--------------------------------------- Microsoft specific notification types - -/* 3e62a467-ab40-409a-a698-f362d464b38f */ -DEFINE_GUID(GENERIC_NOTIFY_TYPE_GUID, - 0x3e62a467, - 0xab40, 0x409a, - 0xa6, 0x98, 0xf3, 0x62, 0xd4, 0x64, 0xb3, 0x8f); - -//-------------------------------------- Microsoft specific error section types - -/* 6f3380d1-6eb0-497f-a578-4d4c65a71617 */ -DEFINE_GUID(IPF_SAL_RECORD_SECTION_GUID, - 0x6f3380d1, - 0x6eb0, 0x497f, - 0xa5, 0x78, 0x4d, 0x4c, 0x65, 0xa7, 0x16, 0x17); - -/* 8a1e1d01-42f9-4557-9c33-565e5cc3f7e8 */ -DEFINE_GUID(XPF_MCA_SECTION_GUID, - 0x8a1e1d01, - 0x42f9, 0x4557, - 0x9c, 0x33, 0x56, 0x5e, 0x5c, 0xc3, 0xf7, 0xe8); - -/* e71254e7-c1b9-4940-ab76-909703a4320f */ -DEFINE_GUID(NMI_SECTION_GUID, - 0xe71254e7, - 0xc1b9, 0x4940, - 0xab, 0x76, 0x90, 0x97, 0x03, 0xa4, 0x32, 0x0f); - -/* e71254e8-c1b9-4940-ab76-909703a4320f */ -DEFINE_GUID(GENERIC_SECTION_GUID, - 0xe71254e8, - 0xc1b9, 0x4940, - 0xab, 0x76, 0x90, 0x97, 0x03, 0xa4, 0x32, 0x0f); - -/* e71254e9-c1b9-4940-ab76-909703a4320f */ -DEFINE_GUID(WHEA_ERROR_PACKET_SECTION_GUID, - 0xe71254e9, - 0xc1b9, 0x4940, - 0xab, 0x76, 0x90, 0x97, 0x03, 0xa4, 0x32, 0x0f); - - -#include - -//----------------------------------------------------------- WHEA_ERROR_PACKET - -typedef enum _WHEA_ERROR_TYPE { - WheaErrTypeProcessor = 0, - WheaErrTypeMemory, - WheaErrTypePCIExpress, - WheaErrTypeNMI, - WheaErrTypePCIXBus, - WheaErrTypePCIXDevice, - WheaErrTypeGeneric -} WHEA_ERROR_TYPE, *PWHEA_ERROR_TYPE; - -typedef union _WHEA_ERROR_PACKET_FLAGS { - struct { - ULONG PreviousError:1; - ULONG Reserved1:1; - ULONG HypervisorError:1; - ULONG Simulated:1; - ULONG PlatformPfaControl:1; - ULONG PlatformDirectedOffline:1; - ULONG Reserved2:26; - } DUMMYSTRUCTNAME; - ULONG AsULONG; -} WHEA_ERROR_PACKET_FLAGS, *PWHEA_ERROR_PACKET_FLAGS; - -typedef enum _WHEA_ERROR_PACKET_DATA_FORMAT { - WheaDataFormatIPFSalRecord = 0, - WheaDataFormatXPFMCA, - WheaDataFormatMemory, - WheaDataFormatPCIExpress, - WheaDataFormatNMIPort, - WheaDataFormatPCIXBus, - WheaDataFormatPCIXDevice, - WheaDataFormatGeneric, - WheaDataFormatMax -} WHEA_ERROR_PACKET_DATA_FORMAT, *PWHEA_ERROR_PACKET_DATA_FORMAT; - -typedef enum _WHEA_RAW_DATA_FORMAT { - WheaRawDataFormatIPFSalRecord = 0x00, - WheaRawDataFormatIA32MCA, - WheaRawDataFormatIntel64MCA, - WheaRawDataFormatAMD64MCA, - WheaRawDataFormatMemory, - WheaRawDataFormatPCIExpress, - WheaRawDataFormatNMIPort, - WheaRawDataFormatPCIXBus, - WheaRawDataFormatPCIXDevice, - WheaRawDataFormatGeneric, - WheaRawDataFormatMax -} WHEA_RAW_DATA_FORMAT, *PWHEA_RAW_DATA_FORMAT; - -typedef struct _WHEA_ERROR_PACKET_V1 { - ULONG Signature; // +0x00 (0) - WHEA_ERROR_PACKET_FLAGS Flags; // +0x04 (4) - ULONG Size; // +0x08 (8) - ULONG RawDataLength; // +0x0C (12) - ULONGLONG Reserved1; // +0x10 (16) - ULONGLONG Context; // +0x18 (24) - WHEA_ERROR_TYPE ErrorType; // +0x20 (32) - WHEA_ERROR_SEVERITY ErrorSeverity; // +0x24 (36) - ULONG ErrorSourceId; // +0x28 (40) - WHEA_ERROR_SOURCE_TYPE ErrorSourceType; // +0x2C (44) - ULONG Reserved2; // +0x30 (48) - ULONG Version; // +0x34 (52) - ULONGLONG Cpu; // +0x38 (56) - union { - WHEA_PROCESSOR_GENERIC_ERROR_SECTION ProcessorError; // +0x40 (64) - WHEA_MEMORY_ERROR_SECTION MemoryError; - WHEA_NMI_ERROR_SECTION NmiError; - WHEA_PCIEXPRESS_ERROR_SECTION PciExpressError; - WHEA_PCIXBUS_ERROR_SECTION PciXBusError; - WHEA_PCIXDEVICE_ERROR_SECTION PciXDeviceError; - } u; - WHEA_RAW_DATA_FORMAT RawDataFormat; // +0x110 (272) - ULONG RawDataOffset; // +0x114 (276) - UCHAR RawData[1]; // +0x118 (280) - -} WHEA_ERROR_PACKET_V1, *PWHEA_ERROR_PACKET_V1; - -#define WHEA_ERROR_PACKET_V1_SIGNATURE 'tPrE' -#define WHEA_ERROR_PACKET_V1_VERSION 2 - -typedef struct _WHEA_ERROR_PACKET_V2 { - ULONG Signature; - ULONG Version; - ULONG Length; - WHEA_ERROR_PACKET_FLAGS Flags; - WHEA_ERROR_TYPE ErrorType; - WHEA_ERROR_SEVERITY ErrorSeverity; - ULONG ErrorSourceId; - WHEA_ERROR_SOURCE_TYPE ErrorSourceType; - GUID NotifyType; - ULONGLONG Context; - WHEA_ERROR_PACKET_DATA_FORMAT DataFormat; - ULONG Reserved1; - ULONG DataOffset; - ULONG DataLength; - ULONG PshedDataOffset; - ULONG PshedDataLength; - // UCHAR Data[ANYSIZE_ARRAY]; - // UCHAR PshedData[ANYSIZE_ARRAY]; -} WHEA_ERROR_PACKET_V2, *PWHEA_ERROR_PACKET_V2; - -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, Signature, 0, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, Version, 4, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, Length, 8, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, Flags, 12, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, ErrorType, 16, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, ErrorSeverity, 20, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, ErrorSourceId, 24, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, ErrorSourceType, 28, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, NotifyType, 32, 16); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, Context, 48, 8); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, DataFormat, 56, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, Reserved1, 60, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, DataOffset, 64, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, DataLength, 68, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, PshedDataOffset, 72, 4); -CPER_FIELD_CHECK(WHEA_ERROR_PACKET_V2, PshedDataLength, 76, 4); - -#define WHEA_ERROR_PACKET_V2_SIGNATURE 'AEHW' -#define WHEA_ERROR_PACKET_V2_VERSION 3 - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -#define WHEA_ERROR_PACKET_SIGNATURE WHEA_ERROR_PACKET_V2_SIGNATURE -#define WHEA_ERROR_PACKET_VERSION WHEA_ERROR_PACKET_V2_VERSION -typedef struct _WHEA_ERROR_PACKET_V2 WHEA_ERROR_PACKET, *PWHEA_ERROR_PACKET; - -#else - -#define WHEA_ERROR_PACKET_SIGNATURE WHEA_ERROR_PACKET_V1_SIGNATURE -#define WHEA_ERROR_PACKET_VERSION WHEA_ERROR_PACKET_V1_VERSION -#define WHEA_ERROR_PKT_SIGNATURE WHEA_ERROR_PACKET_SIGNATURE -#define WHEA_ERROR_PKT_VERSION WHEA_ERROR_PACKET_VERSION -typedef struct _WHEA_ERROR_PACKET_V1 WHEA_ERROR_PACKET, *PWHEA_ERROR_PACKET; - -#endif - -//---------------------------------------------------------- WHEA_GENERIC_ERROR - -// -// These structure define the data format that must be used by error sources -// when reporting errors of the generic error type. -// - -typedef union _WHEA_GENERIC_ERROR_BLOCKSTATUS { - struct { - ULONG UncorrectableError:1; - ULONG CorrectableError:1; - ULONG MultipleUncorrectableErrors:1; - ULONG MultipleCorrectableErrors:1; - ULONG ErrorDataEntryCount:10; - ULONG Reserved:18; - } DUMMYSTRUCTNAME; - ULONG AsULONG; -} WHEA_GENERIC_ERROR_BLOCKSTATUS, *PWHEA_GENERIC_ERROR_BLOCKSTATUS; - -typedef struct _WHEA_GENERIC_ERROR { - WHEA_GENERIC_ERROR_BLOCKSTATUS BlockStatus; - ULONG RawDataOffset; - ULONG RawDataLength; - ULONG DataLength; - WHEA_ERROR_SEVERITY ErrorSeverity; - UCHAR Data[1]; -} WHEA_GENERIC_ERROR, *PWHEA_GENERIC_ERROR; - -typedef struct _WHEA_GENERIC_ERROR_DATA_ENTRY { - GUID SectionType; - WHEA_ERROR_SEVERITY ErrorSeverity; - WHEA_REVISION Revision; - UCHAR ValidBits; - UCHAR Flags; - ULONG ErrorDataLength; - GUID FRUId; - UCHAR FRUText[20]; - UCHAR Data[1]; -} WHEA_GENERIC_ERROR_DATA_ENTRY, *PWHEA_GENERIC_ERROR_DATA_ENTRY; - -#include - - -//----------------------------------------------- WheaGetErrPacketFromErrRecord - -__checkReturn -FORCEINLINE -PWHEA_ERROR_PACKET -WheaGetErrPacketFromErrRecord ( - __in PWHEA_ERROR_RECORD Record - ) - -/*++ - -Routine Description: - - This routine will search out the error packet contained within an error - record and return a reference to it. - -Arguments: - - Record - Supplies a pointer to the error record to be searched. - -Return Value: - - If successful, a pointer to the error packet. - - NULL otherwise. - ---*/ - -{ - - PWHEA_ERROR_PACKET Packet; - PWHEA_ERROR_RECORD_SECTION_DESCRIPTOR Descriptor; - ULONG Section; - ULONG SizeRequired; - - Packet = NULL; - if (Record->Header.Signature != WHEA_ERROR_RECORD_SIGNATURE) { - goto GetErrPacketFromErrRecordEnd; - } - - // - // Calculate the size required for the header and section descriptors. - // Ensure that at least these will be properly contained within the extent - // of the error record. - // - - SizeRequired = sizeof(WHEA_ERROR_RECORD_HEADER) + - (sizeof(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR) * - Record->Header.SectionCount); - - if (Record->Header.Length < SizeRequired) { - goto GetErrPacketFromErrRecordEnd; - } - - // - // Step through the section descriptors looking for the error packet. If the - // error packet descriptor is found, ensure that the error packet section is - // properly contained within the extent of the error record. - // - - Descriptor = &Record->SectionDescriptor[0]; - for (Section = 0; Section < Record->Header.SectionCount; Section += 1) { - - if (RtlCompareMemory(&Descriptor->SectionType, - &WHEA_ERROR_PACKET_SECTION_GUID, - sizeof(GUID)) == sizeof(GUID)) { - - SizeRequired = Descriptor->SectionOffset + - Descriptor->SectionLength; - - if (Record->Header.Length < SizeRequired) { - goto GetErrPacketFromErrRecordEnd; - } - - Packet = (PWHEA_ERROR_PACKET) - (((PUCHAR)Record) + Descriptor->SectionOffset); - - if (Packet->Signature != WHEA_ERROR_PACKET_SIGNATURE) { - Packet = NULL; - } - - goto GetErrPacketFromErrRecordEnd; - } - - Descriptor += 1; - } - -GetErrPacketFromErrRecordEnd: - return Packet; -} - -//------------------------------------------- WHEA_ERROR_INJECTION_CAPABILITIES - -// -// PSHED plug-ins use this structure to communicate error injection capabilities -// to the operating system. -// - -typedef union _WHEA_ERROR_INJECTION_CAPABILITIES { - struct { - ULONG ProcessorCorrectable:1; // 0x00000001 - ULONG ProcessorUncorrectableNonFatal:1; // 0x00000002 - ULONG ProcessorUncorrectableFatal:1; // 0x00000004 - ULONG MemoryCorrectable:1; // 0x00000008 - ULONG MemoryUncorrectableNonFatal:1; // 0x00000010 - ULONG MemoryUncorrectableFatal:1; // 0x00000020 - ULONG PCIExpressCorrectable:1; // 0x00000040 - ULONG PCIExpressUncorrectableNonFatal:1; // 0x00000080 - ULONG PCIExpressUncorrectableFatal:1; // 0x00000100 - ULONG PlatformCorrectable:1; // 0x00000200 - ULONG PlatformUncorrectableNonFatal:1; // 0x00000400 - ULONG PlatformUncorrectableFatal:1; // 0x00000800 - ULONG IA64Corrected:1; // 0x00001000 - ULONG IA64Recoverable:1; // 0x00002000 - ULONG IA64Fatal:1; // 0x00004000 - ULONG IA64RecoverableCache:1; // 0x00008000 - ULONG IA64RecoverableRegFile:1; // 0x00010000 - ULONG Reserved:15; - } DUMMYSTRUCTNAME; - ULONG AsULONG; -} WHEA_ERROR_INJECTION_CAPABILITIES, *PWHEA_ERROR_INJECTION_CAPABILITIES; - -#define INJECT_ERRTYPE_PROCESSOR_CORRECTABLE 0x00000001 -#define INJECT_ERRTYPE_PROCESSOR_UNCORRECTABLENONFATAL 0x00000002 -#define INJECT_ERRTYPE_PROCESSOR_UNCORRECTABLEFATAL 0x00000004 -#define INJECT_ERRTYPE_MEMORY_CORRECTABLE 0x00000008 -#define INJECT_ERRTYPE_MEMORY_UNCORRECTABLENONFATAL 0x00000010 -#define INJECT_ERRTYPE_MEMORY_UNCORRECTABLEFATAL 0x00000020 -#define INJECT_ERRTYPE_PCIEXPRESS_CORRECTABLE 0x00000040 -#define INJECT_ERRTYPE_PCIEXPRESS_UNCORRECTABLENONFATAL 0x00000080 -#define INJECT_ERRTYPE_PCIEXPRESS_UNCORRECTABLEFATAL 0x00000100 -#define INJECT_ERRTYPE_PLATFORM_CORRECTABLE 0x00000200 -#define INJECT_ERRTYPE_PLATFORM_UNCORRECTABLENONFATAL 0x00000400 -#define INJECT_ERRTYPE_PLATFORM_UNCORRECTABLEFATAL 0x00000800 - - -//------------------------------------------------ PSHED Plug-in Callback Types - -__checkReturn -typedef -NTSTATUS -(*PSHED_PI_GET_ALL_ERROR_SOURCES) ( - __inout_opt PVOID PluginContext, - __inout PULONG Count, - __inout_bcount(*Length) PWHEA_ERROR_SOURCE_DESCRIPTOR *ErrorSrcs, - __inout PULONG Length - ); - -__checkReturn -typedef -NTSTATUS -(*PSHED_PI_GET_ERROR_SOURCE_INFO) ( - __inout_opt PVOID PluginContext, - __inout PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource - ); - -__checkReturn -typedef -NTSTATUS -(*PSHED_PI_SET_ERROR_SOURCE_INFO) ( - __inout_opt PVOID PluginContext, - __in PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource - ); - -typedef -NTSTATUS - (*PSHED_PI_ENABLE_ERROR_SOURCE) ( - __inout_opt PVOID PluginContext, - __in PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource - ); - -typedef -NTSTATUS - (*PSHED_PI_DISABLE_ERROR_SOURCE) ( - __inout_opt PVOID PluginContext, - __in PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource - ); - -typedef -NTSTATUS -(*PSHED_PI_WRITE_ERROR_RECORD) ( - __inout_opt PVOID PluginContext, - __in ULONG Flags, - __in ULONG RecordLength, - __in_bcount(RecordLength) PWHEA_ERROR_RECORD ErrorRecord - ); - -__checkReturn -typedef -NTSTATUS -(*PSHED_PI_READ_ERROR_RECORD) ( - __inout_opt PVOID PluginContext, - __in ULONG Flags, - __in ULONGLONG ErrorRecordId, - __out PULONGLONG NextErrorRecordId, - __inout PULONG RecordLength, - __out_bcount(*RecordLength) PWHEA_ERROR_RECORD ErrorRecord - ); - -typedef -NTSTATUS -(*PSHED_PI_CLEAR_ERROR_RECORD) ( - __inout_opt PVOID PluginContext, - __in ULONG Flags, - __in ULONGLONG ErrorRecordId - ); - -typedef -NTSTATUS -(*PSHED_PI_RETRIEVE_ERROR_INFO) ( - __inout_opt PVOID PluginContext, - __in PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource, - __in ULONGLONG BufferLength, - __inout_bcount(BufferLength) PWHEA_ERROR_PACKET Packet - ); - -typedef -NTSTATUS -(*PSHED_PI_FINALIZE_ERROR_RECORD) ( - __inout_opt PVOID PluginContext, - __in PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource, - __in ULONG BufferLength, - __inout_bcount(BufferLength) PWHEA_ERROR_RECORD ErrorRecord - ); - -typedef -NTSTATUS -(*PSHED_PI_CLEAR_ERROR_STATUS) ( - __inout_opt PVOID PluginContext, - __in PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource, - __in ULONG BufferLength, - __in_bcount(BufferLength) PWHEA_ERROR_RECORD ErrorRecord - ); - -__checkReturn -typedef -NTSTATUS -(*PSHED_PI_ATTEMPT_ERROR_RECOVERY) ( - __inout_opt PVOID PluginContext, - __in ULONG BufferLength, - __in_bcount(BufferLength) PWHEA_ERROR_RECORD ErrorRecord - ); - -__checkReturn -typedef -NTSTATUS -(*PSHED_PI_GET_INJECTION_CAPABILITIES) ( - __inout_opt PVOID PluginContext, - __out PWHEA_ERROR_INJECTION_CAPABILITIES Capabilities - ); - -__checkReturn -typedef -NTSTATUS -(*PSHED_PI_INJECT_ERROR) ( - __inout_opt PVOID PluginContext, - __in ULONGLONG ErrorType, - __in ULONGLONG Parameter1, - __in ULONGLONG Parameter2, - __in ULONGLONG Parameter3, - __in ULONGLONG Parameter4 - ); - -//--------------------------------------- WHEA_PSHED_PLUGIN_REGISTRATION_PACKET - -typedef struct _WHEA_PSHED_PLUGIN_CALLBACKS { - PSHED_PI_GET_ALL_ERROR_SOURCES GetAllErrorSources; - PVOID Reserved; - PSHED_PI_GET_ERROR_SOURCE_INFO GetErrorSourceInfo; - PSHED_PI_SET_ERROR_SOURCE_INFO SetErrorSourceInfo; - PSHED_PI_ENABLE_ERROR_SOURCE EnableErrorSource; - PSHED_PI_DISABLE_ERROR_SOURCE DisableErrorSource; - PSHED_PI_WRITE_ERROR_RECORD WriteErrorRecord; - PSHED_PI_READ_ERROR_RECORD ReadErrorRecord; - PSHED_PI_CLEAR_ERROR_RECORD ClearErrorRecord; - PSHED_PI_RETRIEVE_ERROR_INFO RetrieveErrorInfo; - PSHED_PI_FINALIZE_ERROR_RECORD FinalizeErrorRecord; - PSHED_PI_CLEAR_ERROR_STATUS ClearErrorStatus; - PSHED_PI_ATTEMPT_ERROR_RECOVERY AttemptRecovery; - PSHED_PI_GET_INJECTION_CAPABILITIES GetInjectionCapabilities; - PSHED_PI_INJECT_ERROR InjectError; -} WHEA_PSHED_PLUGIN_CALLBACKS, *PWHEA_PSHED_PLUGIN_CALLBACKS; - -typedef struct _WHEA_PSHED_PLUGIN_REGISTRATION_PACKET { - ULONG Length; - ULONG Version; - PVOID Context; - ULONG FunctionalAreaMask; - ULONG Reserved; - WHEA_PSHED_PLUGIN_CALLBACKS Callbacks; -} WHEA_PSHED_PLUGIN_REGISTRATION_PACKET, - *PWHEA_PSHED_PLUGIN_REGISTRATION_PACKET; - -#define WHEA_PLUGIN_REGISTRATION_PACKET_VERSION 0x00010000 - -// -// These defines specify the values of the bits in the functional area mask -// field of the PSHED plug-in registration packet. -// - -#define PshedFADiscovery 0x00000001 -#define PshedFAErrorSourceControl 0x00000002 -#define PshedFAErrorRecordPersistence 0x00000004 -#define PshedFAErrorInfoRetrieval 0x00000008 -#define PshedFAErrorRecovery 0x00000010 -#define PshedFAErrorInjection 0x00000020 - -//------------------------------------------------------ PSHED Plug-in services - -#define WHEA_WRITE_FLAG_DUMMY 0x00000001 - -// -// The following services are exported by the PSHED for use by PSHED plug-ins. -// - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_allocatesMem(Mem) -__bcount(Size) -__checkReturn -PVOID -PshedAllocateMemory ( - __in ULONG Size - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -PshedFreeMemory ( - __in __drv_freesMem(Mem) PVOID Address - ); - -BOOLEAN -PshedIsSystemWheaEnabled ( - VOID - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -PshedRegisterPlugin ( - __inout PWHEA_PSHED_PLUGIN_REGISTRATION_PACKET Packet - ); - -BOOLEAN -PshedSynchronizeExecution ( - __in PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource, - __in PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, - __in PVOID SynchronizeContext - ); - -//----------------------------------------------- Error record access functions - -__checkReturn -FORCEINLINE -BOOLEAN -WheaIsValidErrorRecordSignature ( - __in PWHEA_ERROR_RECORD Record - ) - -/*++ - -Routine Description: - - This routine will compare the error record signature with the proper values - and signal whether it is correct or not. - -Arguments: - - Record - Supplies a pointer to the error record. - -Return Value: - - TRUE if the error record signature is correct. - - FALSE otherwise. - ---*/ - -{ - - BOOLEAN Valid; - - if ((Record->Header.Signature == WHEA_ERROR_RECORD_SIGNATURE) && - (Record->Header.Revision.AsUSHORT == WHEA_ERROR_RECORD_REVISION) && - (Record->Header.SignatureEnd == WHEA_ERROR_RECORD_SIGNATURE_END)) { - - Valid = TRUE; - - } else { - Valid = FALSE; - } - - return Valid; -} - -__checkReturn -FORCEINLINE -NTSTATUS -WheaFindErrorRecordSection ( - __in PWHEA_ERROR_RECORD Record, - __in const GUID *SectionType, - __out PWHEA_ERROR_RECORD_SECTION_DESCRIPTOR *SectionDescriptor, - __out_opt PVOID *SectionData - ) - -/*++ - -Routine Description: - - This routine provides a means to search an error record for a specific - section. - -Arguments: - - Record - Supplies a pointer to the error record. - - SectionType - Supplies a GUID specifying the section being sought. This may - be any standard common platform error record or implementation specific - section type. - - Descriptor - Supplies a location in which a pointer to the descriptor for - the found section is returned. - - Section - Supplies an optional location in which a pointer to the found - section is returned. - -Return Value: - - STATUS_SUCCESS if the specified section is found. - - STATUS_NOT_FOUND if the specified section is not found. - - STATUS_INVALID_PARAMETER if the record does not appear well formed or the - context parameter is null in cases where it is required. - ---*/ - -{ - - NTSTATUS Status; - PWHEA_ERROR_RECORD_SECTION_DESCRIPTOR Descriptor; - ULONG Index; - ULONG MinimumLength; - - if ((Record == NULL) || - (SectionType == NULL) || - (SectionDescriptor == NULL) || - (WheaIsValidErrorRecordSignature(Record) == FALSE) || - (Record->Header.SectionCount == 0)) { - - Status = STATUS_INVALID_PARAMETER; - goto FindErrorRecordSectionEnd; - } - - // - // Ensure that the supplied record is at least as long as required to store - // the descriptors for the sections supposedly in the record. - // - - MinimumLength = sizeof(WHEA_ERROR_RECORD_HEADER) + - (Record->Header.SectionCount * - sizeof(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR)); - - if (Record->Header.Length < MinimumLength) { - Status = STATUS_INVALID_PARAMETER; - goto FindErrorRecordSectionEnd; - } - - // - // Iterate through the record searching for the section in question. - // - - Descriptor = &Record->SectionDescriptor[0]; - for (Index = 0; Index < Record->Header.SectionCount; Index += 1) { - if (RtlCompareMemory(&Descriptor->SectionType, - SectionType, - sizeof(GUID)) == sizeof(GUID)) { - - break; - } - - Descriptor += 1; - } - - if (Index >= Record->Header.SectionCount) { - Status = STATUS_NOT_FOUND; - goto FindErrorRecordSectionEnd; - } - - // - // If the descriptor describes a section that is not completely contained - // within the record then the record is invalid. - // - - if ((Descriptor->SectionOffset + Descriptor->SectionLength) > - Record->Header.Length) { - - Status = STATUS_INVALID_PARAMETER; - goto FindErrorRecordSectionEnd; - } - - // - // Return the descriptor and optionally a pointer to the section itself. - // - - *SectionDescriptor = Descriptor; - if (SectionData != NULL) { - *SectionData = (PVOID)(((PUCHAR)Record) + Descriptor->SectionOffset); - } - - Status = STATUS_SUCCESS; - -FindErrorRecordSectionEnd: - return Status; -} - -__checkReturn -FORCEINLINE -NTSTATUS -WheaFindNextErrorRecordSection ( - __in PWHEA_ERROR_RECORD Record, - __inout ULONG *Context, - __out PWHEA_ERROR_RECORD_SECTION_DESCRIPTOR *SectionDescriptor, - __out_opt PVOID *SectionData - ) - -/*++ - -Routine Description: - - This routine allows the caller to iterate through the sections in an error - record. - -Arguments: - - Record - Supplies a pointer to the error record. - - Context - Supplies a pointer to a variable that maintains the current state - of the search. This variable should be zero for the first call, and the - same variable should be used in subsequent calls to enumerate the next - sections in the record. - - Descriptor - Supplies a location in which a pointer to the descriptor for - the found section is returned. - - Section - Supplies an optional location in which a pointer to the found - section is returned. - -Return Value: - - STATUS_SUCCESS if the specified section is found. - - STATUS_NOT_FOUND if the specified section is not found. - - STATUS_INVALID_PARAMETER if the record does not appear well formed or a - required parameter is null. - ---*/ - -{ - - NTSTATUS Status; - PWHEA_ERROR_RECORD_SECTION_DESCRIPTOR Descriptor; - ULONG Index; - ULONG MinimumLength; - - if ((Record == NULL) || - (Context == NULL) || - (SectionDescriptor == NULL) || - (WheaIsValidErrorRecordSignature(Record) == FALSE) || - (Record->Header.SectionCount == 0)) { - - Status = STATUS_INVALID_PARAMETER; - goto FindNextErrorRecordSectionEnd; - } - - // - // Ensure that the supplied record is at least as long as required to store - // the descriptors for the sections supposedly in the record. - // - - MinimumLength = sizeof(WHEA_ERROR_RECORD_HEADER) + - (Record->Header.SectionCount * - sizeof(WHEA_ERROR_RECORD_SECTION_DESCRIPTOR)); - - if (Record->Header.Length < MinimumLength) { - Status = STATUS_INVALID_PARAMETER; - goto FindNextErrorRecordSectionEnd; - } - - // - // If the index is greater than the number of sections, then it has been - // incorrectly fabricated by the caller or the record had section removed - // during the enumeration. Either way, this is different to the case where - // there are no sections left. - // - - Index = *Context; - if (Index > Record->Header.SectionCount) { - Status = STATUS_INVALID_PARAMETER; - goto FindNextErrorRecordSectionEnd; - } - - if (Index == Record->Header.SectionCount) { - Status = STATUS_NOT_FOUND; - goto FindNextErrorRecordSectionEnd; - } - - Descriptor = &Record->SectionDescriptor[Index]; - - // - // If the descriptor describes a section that is not completely contained - // within the record then the record is invalid. - // - - if ((Descriptor->SectionOffset + Descriptor->SectionLength) > - Record->Header.Length) { - - Status = STATUS_INVALID_PARAMETER; - goto FindNextErrorRecordSectionEnd; - } - - *Context = Index + 1; - *SectionDescriptor = Descriptor; - if (SectionData != NULL) { - *SectionData = (PVOID)(((PUCHAR)Record) + Descriptor->SectionOffset); - } - - Status = STATUS_SUCCESS; - -FindNextErrorRecordSectionEnd: - return Status; -} - - - -#ifdef __cplusplus -} -#endif - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4115) -#pragma warning(default:4201) -#pragma warning(default:4214) -#endif - -#endif // _NTDDK_ - diff --git a/pub/ddk/ntddnlb.h b/pub/ddk/ntddnlb.h deleted file mode 100644 index 06462b0..0000000 --- a/pub/ddk/ntddnlb.h +++ /dev/null @@ -1,778 +0,0 @@ -/*++ - -Copyright (c) 2001 Microsoft Corporation - -Module Name: - - ntddnlb.h - -Abstract: - - This header describes the structures and interfaces required to interact - with the NLB intermediate device driver. - -Revision History: - ---*/ - -#ifndef __NTDDNLB_H__ -#define __NTDDNLB_H__ - -#pragma once - -#if (NTDDI_VERSION >= NTDDI_WS03) - -/* - * Note: This file is intended for inclusion by kernel-mode components that - * wish to utilize the public kernel-mode NLB connection notification - * interface or the public kernel-mode NLB hook IOCTLs. In order to - * include only those definitions that are relevant to user-level - * programs (i.e., registry key names), ensure that the following - * macro is defined prior to including this file either via the - * compiler command line: - * - * -DNTDDNLB_USER_MODE_DEFINITIONS_ONLY=1 - * - * or in the source file(s) before inclusion of this file: - * - * #define NTDDNLB_USER_MODE_DEFINITIONS_ONLY - * - * Failing to define this macro before including this file in a user- - * level program will otherwise result in compilation failure. - */ - -/* - This registry key can be used to configure NLB to allow inter-host - communication in a unicast cluster under the following conditions: - - (i) EVERY host in the cluster is properly configured with a Dedicated - IP address, where "properly configured" implies: - - (a) The Dedicated IP address configured in NLB is valid - (b) The Dedicated IP address configured in NLB has been added to - to the TCP/IP properties IP address list OF THE NLB ADAPTER - (c) The Dedicated IP address is the FIRST IP address listed in - the TCP/IP properties IP address list OF THE NLB ADAPTER - - If any of these conditions is not met, do not expect inter-host - communication to work between all hosts, nor under all circumstances. - - (ii) The host is operating in unicast mode - - If the host is operating in eith multicast mode (multicast or IGMP multicast, - this feature is not needed, as hosts can already communication between one - another without additional support. - - This registry key will not exist by default, but can be created and - set on a per-adapter basis under the following registry hive: - - HKLM\System\CurrentControlSet\Services\WLBS\Parameters\Interface\{GUID}\ - - where {GUID} is the GUID of the particular NLB instance (use the "ClusterIP - Address" key in this hive to identify clusters). This key is boolean in - nature and is interpreted as follows: - - = 0 -> The feature is not active - > 0 -> The feature is active - - ** This feature is intended solely for the purpose of inter-host communication - within a clustered firewall application (for example, Microsoft ISA Server). - Though its use outside of these types of applications is not precluded, ITS - USE OUTSIDE OF THESE APPLICATIONS IS EXPLICITLY NOT SUPPORTED BY MICROSOFT. -*/ -#define NLB_INTERHOST_COMM_SUPPORT_KEY L"UnicastInterHostCommSupport" - -/* - These registry keys instruct NLB on which notification mechanism to use. - When deciding what notifications to use for a given type of notification X, - NLB checks the following, in this order: - - (i) NLB first looks for the Enable[X]Notification registry key under - - HKLM\System\CurrentControlSet\Services\WLBS\Parameters\Global\ - - This key has three possible values that instruct NLB on which - notifications to listen for. They are: - - 0 = Do not use any notifications. - 1 = Use the TCP/IP stack's internal notifications. - 2 = Use the NLB public callback notifications. - - (ii) If the Enable[X]Notification registry key is not present, NLB - defaults to using the internal TCP/IP notifications. - - Note: The EnableSYNAttackNotification and EnableTimerStarvationNotification - keys are not available in Windows Server 2003. Also, post-Windows Server - 2003, a value of 0 is not permitted for the EnableTCPNotification key. -*/ -#define NLB_CONNECTION_CALLBACK_KEY L"EnableTCPNotification" -#define NLB_SYN_ATTACK_CALLBACK_KEY L"EnableSYNAttackNotification" -#define NLB_TIMER_STARVATION_CALLBACK_KEY L"EnableTimerStarvationNotification" - -/* Each of the above keys can be set to one of the values listed below. */ -#if (NTDDI_VERSION >= NTDDI_VISTA) -#define NLB_NOTIFICATION_NONE 0 -#define NLB_NOTIFICATION_TCPIP 1 -#define NLB_NOTIFICATION_ALTERNATE 2 -#else -/* The following are legacy definitions from Windows Server 2003. */ -#define NLB_CONNECTION_CALLBACK_NONE 0 -#define NLB_CONNECTION_CALLBACK_TCP 1 -#define NLB_CONNECTION_CALLBACK_ALTERNATE 2 -#endif - -/* This is the public callback object on which NLB will listen for all - public notifications. Currently, the types of notifications accepted by - NLB are session state notifications for TCP (protocol=6), SYN attack - notifications, and timer starvation notifications (*). - - To notify NLB of the beginning/end of a SYN attack or timer starvation, - open the callback object and call ExNotifyCallback with the following - parameters: - - CallbackObject - The handle to the NLB public callback object. - Argument1 - A callback code of type NLB_PUBLIC_CALLBACK_CODE, set to the - NLBSYNAttackBegins[Ends] or NLBTimerStarvationBegins[Ends] - value. - Argument2 - NULL (this parameter is unused) - - NLB requires that each begin notification is accompanied by a - corresponding end notification. Furthermore, NLB makes no guarantees as - to the order in which multiple begin/end notifications are processed; it - is up to the caller to provide any necessary serialization. - - To notify NLB when connections change state, open the callback object, - and call ExNotifyCallback with the following parameters (**): - - CallbackObject - The handle to the NLB public callback object. - Argument1 - A callback code of type NLB_PUBLIC_CALLBACK_CODE, set to the - NLBSessionStateChange value. - Argument2 - A pointer to an NLBConnectionInfo block, defined below. - - For TCP connections, NLB needs to be notified of the following state - changes: - - CLOSED -> SYN_RCVD: A new incoming connection is being established. This - notification requires the IP interface index on which the SYN was - received. NLB will create state on the appropriate interface to track - this TCP connection. - - CLOSED -> SYN_SENT: A new outgoing connection is being established. At - this time, it is unknown on which interface the connection will - ultimately be established, so the IP interface index is NOT required for - this notification. NLB will create temporary state to track this - connection should it return on an NLB interface. - - SYN_SENT -> ESTAB: An outgoing connection has been established. This - nofication requires the IP interface index on which the connection was - ultimately established. If the interface was NLB, state will be created - to track the new connection; if the interface was not NLB, the temporary - state created by the SYN_SENT notification is cleaned up. - - SYN_RCVD -> ESTAB: An incoming connection has been established. This - notification is not currently required by NLB. - - SYN_SENT -> CLOSED: An outgoing connection has been prematurely - terminated (the connection never reached the ESTABlished state). This - notification does not require the IP interface index. NLB will destroy - any state created to track this connection. - - SYN_RCVD -> CLOSED: An outgoing connection has been prematurely - terminated (the connection never reached the ESTABlished state). This - notification does not require the IP interface index. NLB will destroy - any state created to track this connection. - - ESTAB -> CLOSED: A connection has been *completely* terminated (i.e., the - connection has gone through TIME_WAIT, if necessary, already). This - notification does not require the IP interface index. NLB will destroy - any state created to track this connection. - - (*) SYN attack and timer starvation notifications are not available in - Windows Server 2003. - - (**) In Windows Server 2003, the pointer to the NLBConnectionInfo block - is passed in Argument1 and Argument2 is set to NULL (unused). -*/ -#if (NTDDI_VERSION >= NTDDI_VISTA) -#define NLB_PUBLIC_CALLBACK_NAME L"\\Callback\\NLBPublicCallback" -#else -/* The following are legacy definitions from Windows Server 2003. */ -#define NLB_CONNECTION_CALLBACK_NAME L"\\Callback\\NLBConnectionCallback" -#endif - -/* Starting from V3 NLB hooks support versioning to allow writing backward and - forward compatible code. Now all the structures passed as a parameter to the - call backs start from the Version field. - To prevent legacy code (V1 or V2) from registering for the hooks - we are adding Version field to the call-back registration structure. Moving - forward this also will allow NLB to gracefully handle binaries that are compiled - for a different version of the hook. -*/ -typedef enum { - NLBHookApiInvalid = 0, - NLBHookApiV3 = 3, - NLBHookApiMax = 0xFFFF, -} NLB_HOOK_API_VERSION; - - -/* This enumerated type is used to indicate the type of notification that is - being sent to the NLB connection callback object. -*/ -typedef enum { - NLBSessionStateChange, /* The state of a session (e.g. a TCP connection) has changed. */ - NLBSYNAttackBegins, /* A SYN attack has begun on the machine. */ - NLBSYNAttackEnds, /* A SYN attack has ended on the machine. */ - NLBTimerStarvationBegins, /* Timer starvation has begun on the machine. */ - NLBTimerStarvationEnds /* Timer starvation has ended on the machine. */ -} NLB_PUBLIC_CALLBACK_CODE; - -#define NLB_TCPIP_PROTOCOL_TCP 6 /* IP protocol ID for TCP. */ - -#define NLB_TCP_CLOSED 1 /* The TCP connection is/was CLOSED. */ -#define NLB_TCP_SYN_SENT 3 /* The TCP connection is/was in SYN_SENT. */ -#define NLB_TCP_SYN_RCVD 4 /* The TCP connection is/was in SYN_RCVD. */ -#define NLB_TCP_ESTAB 5 /* The TCP connection is/was ESTABlished. */ - -/* Force default alignment on the callback buffers. */ -#pragma pack(push) -#pragma pack() -typedef struct NLBTCPAddressInfo_v1 { - ULONG RemoteIPAddress; /* The remote (client) IP address, in network byte order. */ - ULONG LocalIPAddress; /* The local (server) IP address, in network byte order. */ - USHORT RemotePort; /* The remote (client) TCP port, in network byte order. */ - USHORT LocalPort; /* The local (server) TCP port, in network byte order. */ -} NLBTCPAddressInfo_v1; - -typedef struct NLBTCPAddressInfo_v2 { - ADDRESS_FAMILY AddressFamily; /* The address family of the remote/local IP addresses (AF_INET or AF_INET6). */ - const UCHAR * RemoteIPAddress; /* The remote (client) IP address, in network byte order. */ - const UCHAR * LocalIPAddress; /* The local (server) IP address, in network byte order. */ - USHORT RemotePort; /* The remote (client) TCP port, in network byte order. */ - USHORT LocalPort; /* The local (server) TCP port, in network byte order. */ -} NLBTCPAddressInfo_v2; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef NLBTCPAddressInfo_v2 NLBTCPAddressInfo; -#else -typedef NLBTCPAddressInfo_v1 NLBTCPAddressInfo; -#endif - -typedef struct NLBTCPConnectionInfo { - ULONG PreviousState; /* The previous state for the connection, as defined above. */ - ULONG CurrentState; /* The new state for the connection, as defined above. */ - ULONG IPInterface; /* The IP interface index on which the connection was, or is being, established. */ - NLBTCPAddressInfo Address; /* A pointer to a block containing the IP tuple for the connection. */ -} NLBTCPConnectionInfo; - -typedef struct NLBConnectionInfo { - UCHAR Protocol; /* The protocol of the connection (currently, only TCP is supported). */ - union { - NLBTCPConnectionInfo * pTCPInfo; /* A pointer to the TCP connection information block. */ - }; -} NLBConnectionInfo; - -#pragma pack(pop) - -#if !defined (NTDDNLB_USER_MODE_DEFINITIONS_ONLY) - -//#include -//#include -//#include - -#define NLB_DEVICE_NAME L"\\Device\\WLBS" /* The NLB device name for use in ZwCreateFile, for instance. */ - -/* - This IOCTL registers or de-registers a kernel-mode hook with NLB. The - IOCTL must be called at IRQL = PASSIVE_LEVEL. - - Returns: - o STATUS_SUCCESS - if the (de)registration succeeds. - o STATUS_INVALID_PARAMETER - if a parameter is invalid. E.g., - - The I/O buffers are missing or the incorrect size. - - The HookIdentifier does not match a known NLB hook GUID. - - The HookTable entry is non-NULL, but the DeregisterCallback is NULL. - - The HookTable entry is non-NULL, but all hook function pointers are NULL. - - The HookTable entry is NULL, but no function is registered for this hook. - o STATUS_ACCESS_DENIED - if the operation will NOT be permitted by NLB. E.g., - - The request to (de)register a hook does not come from kernel-mode. - - The request to (de)register a hook is called at an IRQL > PASSIVE_LEVEL. - - The de-register information provided is for a hook that was registered - by a different component, as identified by the RegisteringEntity. - - The specified hook has already been registered by somebody (anybody). - Components wishing to change their hook must first de-register it. -*/ -#define NLB_IOCTL_REGISTER_HOOK CTL_CODE(0xc0c0, 18, METHOD_BUFFERED, FILE_WRITE_ACCESS) - -#define NLB_HOOK_IDENTIFIER_LENGTH 39 /* 39 is sufficient for {GUID}. */ - -#define NLB_FILTER_HOOK_INTERFACE L"{069267c4-7eee-4aff-832c-02e22e00f96f}" /* The filter interface includes hooks for influencing the NLB - load-balancing decision on either the send path, receive path, - or both. This hook will be called for any packet for which - NLB would normally apply load-balancing policy. Components - registering this interface should use an NLB_FILTER_HOOK_TABLE - as the hook table in the NLB_IOCTL_REGISTER_HOOK_REQUEST. */ - -/* The de-register callback must be specifed for all register - operations. This function is called by NLB whenever a - registered hook is de-registered, either gracefully by the - registrar, or forcefully by NLB itself (as a result of the - NLB device driver getting unloaded). - */ -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef VOID (* NLBHookDeregister) ( - __in_z const PWCHAR pHookIdentifier, - __in HANDLE RegisteringEntity, - __in ULONG Flags); - -/* Bit settings for the Flags field of the de-register callback. */ -#define NLB_HOOK_DEREGISTER_FLAGS_FORCED 0x00000001 - -/* This enumerated type is the feedback for all filter hooks. */ -typedef enum { - NLB_FILTER_HOOK_PROCEED_WITH_HASH, /* Continue to load-balance normally; i.e., the hook has no specific feedback. */ - NLB_FILTER_HOOK_REVERSE_HASH, /* Use reverse hashing (use destination parameters, rather than source). */ - NLB_FILTER_HOOK_FORWARD_HASH, /* Use conventional forward hashing (use source parameters). */ - NLB_FILTER_HOOK_ACCEPT_UNCONDITIONALLY, /* By-pass load-balancing and accept the packet unconditionally. */ - NLB_FILTER_HOOK_REJECT_UNCONDITIONALLY, /* By-pass load-balancing and reject the packet unconditionally. */ - NLB_FILTER_HOOK_USE_MODIFIED_TUPLE /* Use the NewTuple provided by the Client for Load Balancing. */ -}NLB_FILTER_HOOK_DIRECTIVE; - -#define HOOK_IPv6_ADDRESS_NUM_FIELDS 16 -#define HOOK_IPv4_ADDRESS_NUM_FIELDS 4 - -//typedef UINT32 HOOK_IP_ADDRESS_V4; -//typedef USHORT HOOK_IP_ADDRESS_V6[IPv6_ADDRESS_NUM_FIELDS]; -typedef UCHAR HOOK_IP_ADDRESS_V4[HOOK_IPv4_ADDRESS_NUM_FIELDS]; /* Accepts IP Address in NETWORK BYTE ORDER */ -typedef UCHAR HOOK_IP_ADDRESS_V6[HOOK_IPv6_ADDRESS_NUM_FIELDS]; /* Accepts IP Address in NETWORK BYTE ORDER */ - -/* IP Address Types supported by NLB; - Both your Source IP and Destination IP needs to be of the same type. -*/ -typedef enum { - IP_INVALID = 0, - IP_v4, - IP_v6 -} HOOK_IP_ADDRESS_TYPE; - -/* Represents IP Address in NLBHookIPTuple */ -typedef struct _HOOK_IP_ADDRESS { - HOOK_IP_ADDRESS_TYPE Type; - union - { - UCHAR Address; - HOOK_IP_ADDRESS_V4 v4; /* Accepts IP Address in NETWORK BYTE ORDER. */ - HOOK_IP_ADDRESS_V6 v6; /* Accepts IP Address in NETWORK BYTE ORDER. */ - }; -} HOOK_IP_ADDRESS, * PHOOK_IP_ADDRESS; - -/* Flags for the NLB_HOOK_IP_TUPLE. - Only TCP or UDP protocol(s) supported. - For TCP, indicate whether it is a first packet. - */ -#define NLB_HOOK_FLAGS_PROTOCOL_IS_TCP 0x00000100 /* To be set in case of TCP; If not set, the protocol is assumed to be UDP */ -#define NLB_HOOK_FLAGS_CONNECTION_UP 0x00000002 /* TCP/UDP connection UP (equivalent of TCP SYN or UDP IPSec Initial Contact) */ -#define NLB_HOOK_FLAGS_CONNECTION_DOWN 0x00000004 /* TCP/UDP connection DOWN (equivalent of TCP FIN) - can be used for UDP IPSec connections as well */ - -/* NLB Tuple is represented by a combination of: - "Protocol, Source IP, Source Port, Destination IP, Destination Port"; - This NLB Tuple is used by NLB to make load balancing decisions. - Client can now modify the Tuple used by NLB to make load balancing decisions. - As part of the Send, Receive and Query Hooks, NLB provides a new structure: - "NewTuple of type NLBHookIPTuple"; - Note: - Client would have to update the complete Tuple; - Incomplete Tuple or Incorrectly filled up Tuples can lead to the packet being possibly dropped by NLB; - Source IP and Destination IP are "required" to be of the same Type. Refer to HOOK_IP_ADDRESS_TYPE enum. -*/ -typedef struct _NLB_HOOK_IP_TUPLE { - struct { - HOOK_IP_ADDRESS IP; /* Source IP used by NLB to make load balancing decisions */ - USHORT Port; /* Source Port - Accepts Port in HOST BYTE ORDER. */ - } Source; - - struct { - HOOK_IP_ADDRESS IP; /* Destination IP */ - USHORT Port; /* Destination Port - Accepts Port in HOST BYTE ORDER. */ - } Destination; - - ULONG Flags; /* Flag to indicate Protocol (TCP or UDP Only). If TCP Protocol, also indicate whether it is a SYN packet or not. */ -} NLB_HOOK_IP_TUPLE, * PNLB_HOOK_IP_TUPLE; - -/* This structure is used as a single parameter in the New Send and Receive Hook functions. - This has the same parameters as the Send and Receive Hooks of version 2 (v2) - along with NewTuple that should be populated by Client who wishes to modify the IP/Port/Protocol information used by NLB. - Refer to NLBHookIPTuple for more information. -*/ -typedef struct _SEND_RECEIVE_HOOK_INFO { - __in NLB_HOOK_API_VERSION Version; /* Version of the structure. For the V3 hooks it has to be set to NLBHookApiV3 */ - __in_z const WCHAR * pAdapter; /* The GUID of the adapter on which the packet was received. */ - __in IF_INDEX IFIndex; /* The interface index of the adapter on which the packet was received/sent. */ - __in_opt const NET_BUFFER * pPacket; /* A pointer to the NDIS packet, which CAN be NULL if not available. */ - __in_bcount(cMediaHeaderLength) const UCHAR * pMediaHeader; /* A pointer to the media header (ethernet, since NLB supports only ethernet). */ - __in ULONG cMediaHeaderLength; /* The length of contiguous memory accessible from the media header pointer. */ - __in_bcount(cPayloadLength) const UCHAR * pPayload; /* A pointer to the payload of the packet. */ - __in ULONG cPayloadLength; /* The length of contiguous memory accesible from the payload pointer. */ - __in ULONG Flags; /* Hook-related flags including whether or not the cluster is stopped. */ - __in VOID * Reserved; /* This field is reserved for future use. */ - __in NLB_HOOK_IP_TUPLE NewTuple; /* This should be populated with new tuple values */ -} SEND_RECEIVE_HOOK_INFO, * PSEND_RECEIVE_HOOK_INFO; - -/* This structure is used as a single parameter in the New Query Hook function. - This has the same parameters as the Query Hook of version 2 (v2) - along with NewTuple that should be populated by Client who wishes to modify the IP/Port/Protocol information used by NLB. - Refer to NLBHookIPTuple for more information. -*/ -typedef struct _QUERY_HOOK_INFO { - __in NLB_HOOK_API_VERSION Version; /* Version of the structure. For the V3 hooks it has to be set to NLBHookApiV3 */ - __in_z const WCHAR * pAdapter; /* The GUID of the adapter on which the packet was received. */ - __in IF_INDEX IFIndex; /* The interface index of the adapter on which the new connection would be established. */ - __in ADDRESS_FAMILY AddressFamily; /* The address family of the server/client IP addresses (AF_INET or AF_INET6). */ - __drv_when(AddressFamily==2, __in_bcount(4)) /* AF_INET == 2, address is 4 bytes */ - __drv_when(AddressFamily==23, __in_bcount(16)) /* AF_INET6 == 23, address is 16 bytes */ - const UCHAR * ServerIPAddress; /* The server IP address of the "packet" in NETWORK byte order. */ - __in USHORT ServerPort; /* The server port of the "packet" (if applicable to the Protocol) in HOST byte order. */ - __drv_when(AddressFamily==2, __in_bcount(4)) /* AF_INET == 2, address is 4 bytes */ - __drv_when(AddressFamily==23, __in_bcount(16)) /* AF_INET6 == 23, address is 16 bytes */ - const UCHAR * ClientIPAddress; /* The client IP address of the "packet" in NETWORK byte order. */ - __in USHORT ClientPort; /* The client port of the "packet" (if applicable to the Protocol) in HOST byte order. */ - __in USHORT Protocol; /* The IP protocol of the "packet"; TCP, UDP, ICMP, GRE, etc. */ - __in BOOLEAN bReceiveContext; /* A boolean to indicate whether the packet is being processed in send or receive context. */ - __in ULONG Flags; /* Hook-related flags including whether or not the cluster is stopped. */ - __in VOID * Reserved; /* This field is reserved for future use. */ - __in NLB_HOOK_IP_TUPLE NewTuple; /* This should be populated with new tuple values */ -} QUERY_HOOK_INFO, * PQUERY_HOOK_INFO; - -/* This structure is used as a single parameter in the NotifyClearClientStickinessHook. - This hook would get called for each port rule that is affected. If all of the port rules are affected, then the hook would be called for each of those port rules. - pAdapter - Miniport GUID whose port rule is affected. In case of BDA, only the Master miniport is set. The hook implementation should then map this to the corresponding slave(s) as well. - PortRuleIndex - Index of the port rule which is affected. - BDATeaming - Set to TRUE in case of BDATeaming. This would be useful since inside the hook the pAdapter should be mapped to master and the slave(s). -*/ -typedef struct _CLEAR_CLIENT_STICKINESS_HOOK_INFO { - __in NLB_HOOK_API_VERSION Version; /* Version of the structure. For the V3 hooks it has to be set to NLBHookApiV3 */ - __in_z const WCHAR * pAdapter; /* The GUID of the adapter whose connections would be affected due to change in the client stickiness state. */ - __in ULONG PortRuleIndex; /* Index of the Port Rule whose Client Stickiness List would be flushed. */ - __in BOOLEAN BDATeaming; /* This Flag would be set, when BDA Teaming is enabled. */ -} CLEAR_CLIENT_STICKINESS_HOOK_INFO, * PCLEAR_CLIENT_STICKINESS_HOOK_INFO; - -/* - Filter hooks: - - The adapter GUID (1st parameter) will allow the hook consumer to - determine the adapter on which the packet is being sent or received. - Note that the length parameters are not necesarily indicative of the - actual length of the media header or payload themselves, but rather - indicate how much of the buffers pointed to are contiguously - accessible from the provided pointer. For instance, the payload - length may just be the length of an IP header, meaning that only - the IP header can be found at that pointer. However, it might - be equal to the total size of the packet payload, in which case, - that pointer can be used to access subsequent pieces of the - packet, such as the TCP header. If the payload length provided - is not sufficient to find all necessary packet information, the - packet pointer can be used to traverse the packet buffers manually - to try and find the information needed. However, note that the - packet may not always be available (it may be NULL). -*/ - -/* The send filter hook is invoked for every packet sent on any - adapter to which NLB is bound for which NLB would normally - apply load-balancing policy. ARPs, for instance, are not - filtered by NLB, so such packets would not be indicated to - this hook. -*/ -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef NLB_FILTER_HOOK_DIRECTIVE (* NLBSendFilterHook_v1) ( - __in_z const WCHAR * pAdapter, /* The GUID of the adapter on which the packet is being sent. */ -/* Even though this type is versioned, a compile error occurs if the - NDIS_PACKET type is referenced from a non-legacy (NDIS 6.0+) driver. */ -#ifndef NDIS60 - __in_opt const NDIS_PACKET * pPacket, /* A pointer to the NDIS packet, which CAN be NULL if not available. */ -#else - __in_opt const VOID * pPacket, -#endif - __in_bcount(cMediaHeaderLength) const UCHAR * pMediaHeader, /* A pointer to the media header (ethernet, since NLB supports only ethernet). */ - __in ULONG cMediaHeaderLength, /* The length of contiguous memory accessible from the media header pointer. */ - __in_bcount(cPayloadLength) const UCHAR * pPayload, /* A pointer to the payload of the packet. */ - __in ULONG cPayloadLength, /* The length of contiguous memory accesible from the payload pointer. */ - __in ULONG Flags); /* Hook-related flags including whether or not the cluster is stopped. */ - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef NLB_FILTER_HOOK_DIRECTIVE (* NLBSendFilterHook_v2) ( - __in_z const WCHAR * pAdapter, /* The GUID of the adapter on which the packet is being sent. */ - __in_opt const NET_BUFFER * pPacket, /* A pointer to the NDIS packet, which CAN be NULL if not available. */ - __in_bcount(cMediaHeaderLength) const UCHAR * pMediaHeader, /* A pointer to the media header (ethernet, since NLB supports only ethernet). */ - __in ULONG cMediaHeaderLength, /* The length of contiguous memory accessible from the media header pointer. */ - __in_bcount(cPayloadLength) const UCHAR * pPayload, /* A pointer to the payload of the packet. */ - __in ULONG cPayloadLength, /* The length of contiguous memory accesible from the payload pointer. */ - __in ULONG Flags); /* Hook-related flags including whether or not the cluster is stopped. */ - -/* In v3, all the arguments passed to the Send Hook would be consolidated within the SendReceiveHookInfo structure. - Any future changes to the arguments would be made in the structure so that the signature of the hook interface doesn't need to change. -*/ -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef NLB_FILTER_HOOK_DIRECTIVE (* NLBSendFilterHook_v3) ( - __in PSEND_RECEIVE_HOOK_INFO SendReceiveInfoPtr); /* The SendReceiveHookInfo structure would be used to pass all arguments in Send Hook. */ - - -/* The receive filter hook is invoked for every packet received - on any adapter to which NLB is bound for which NLB would - normally apply load-balancing policy. Some protocols, such - as ARP, or NLB-specific packets not normally seen by the - protocol(s) bound to NLB (heartbeats, remote control requests) - are not filtered by NLB and will not be indicated to the hook. -*/ -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef NLB_FILTER_HOOK_DIRECTIVE (* NLBReceiveFilterHook_v1) ( - __in_z const WCHAR * pAdapter, /* The GUID of the adapter on which the packet was received. */ -/* Even though this type is versioned, a compile error occurs if the - NDIS_PACKET type is referenced from a non-legacy (NDIS 6.0+) driver. */ -#ifndef NDIS60 - __in_opt const NDIS_PACKET * pPacket, /* A pointer to the NDIS packet, which CAN be NULL if not available. */ -#else - __in_opt const VOID * pPacket, -#endif - __in_bcount(cMediaHeaderLength) const UCHAR * pMediaHeader, /* A pointer to the media header (ethernet, since NLB supports only ethernet). */ - __in ULONG cMediaHeaderLength, /* The length of contiguous memory accessible from the media header pointer. */ - __in_bcount(cPayloadLength) const UCHAR * pPayload, /* A pointer to the payload of the packet. */ - __in ULONG cPayloadLength, /* The length of contiguous memory accesible from the payload pointer. */ - __in ULONG Flags); /* Hook-related flags including whether or not the cluster is stopped. */ - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef NLB_FILTER_HOOK_DIRECTIVE (* NLBReceiveFilterHook_v2) ( - __in_z const WCHAR * pAdapter, /* The GUID of the adapter on which the packet was received. */ - __in_opt const NET_BUFFER * pPacket, /* A pointer to the NDIS packet, which CAN be NULL if not available. */ - __in_bcount(cMediaHeaderLength) const UCHAR * pMediaHeader, /* A pointer to the media header (ethernet, since NLB supports only ethernet). */ - __in ULONG cMediaHeaderLength, /* The length of contiguous memory accessible from the media header pointer. */ - __in_bcount(cPayloadLength) const UCHAR * pPayload, /* A pointer to the payload of the packet. */ - __in ULONG cPayloadLength, /* The length of contiguous memory accesible from the payload pointer. */ - __in ULONG Flags); /* Hook-related flags including whether or not the cluster is stopped. */ - -/* In v3, all the arguments passed to the Receive Hook would be consolidated within the SendReceiveHookInfo structure. - Any future changes to the arguments would be made in the structure so that the signature of the hook interface doesn't need to change. -*/ -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef NLB_FILTER_HOOK_DIRECTIVE (* NLBReceiveFilterHook_v3) ( - __in PSEND_RECEIVE_HOOK_INFO SendReceiveInfoPtr); /* The SendReceiveHookInfo structure would be used to pass all arguments in Receive Hook. */ - - -/* The query filter hook is invoked in cases where the NLB driver - needs to invoke its hashing algorithm and therefore needs to - know whether or not the hook will influence the way in which - manner NLB performs the hash, if at all. -*/ -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef NLB_FILTER_HOOK_DIRECTIVE (* NLBQueryFilterHook_v1) ( - __in_z const WCHAR * pAdapter, /* The GUID of the adapter on which the packet was received. */ - __in ULONG ServerIPAddress, /* The server IP address of the "packet" in NETWORK byte order. */ - __in USHORT ServerPort, /* The server port of the "packet" (if applicable to the Protocol) in HOST byte order. */ - __in ULONG ClientIPAddress, /* The client IP address of the "packet" in NETWORK byte order. */ - __in USHORT ClientPort, /* The client port of the "packet" (if applicable to the Protocol) in HOST byte order. */ - __in UCHAR Protocol, /* The IP protocol of the "packet"; TCP, UDP, ICMP, GRE, etc. */ - __in BOOLEAN bReceiveContext, /* A boolean to indicate whether the packet is being processed in send or receive context. */ - __in ULONG Flags); /* Hook-related flags including whether or not the cluster is stopped. */ - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef NLB_FILTER_HOOK_DIRECTIVE (* NLBQueryFilterHook_v2) ( - __in_z const WCHAR * pAdapter, /* The GUID of the adapter on which the packet was received. */ - __in ADDRESS_FAMILY AddressFamily, /* The address family of the server/client IP addresses (AF_INET or AF_INET6). */ - __drv_when(AddressFamily==2, __in_bcount(4)) /* AF_INET == 2, address is 4 bytes */ - __drv_when(AddressFamily==23, __in_bcount(16)) /* AF_INET6 == 23, address is 16 bytes */ - const UCHAR * ServerIPAddress, /* The server IP address of the "packet" in NETWORK byte order. */ - __in USHORT ServerPort, /* The server port of the "packet" (if applicable to the Protocol) in HOST byte order. */ - __drv_when(AddressFamily==2, __in_bcount(4)) /* AF_INET == 2, address is 4 bytes */ - __drv_when(AddressFamily==23, __in_bcount(16)) /* AF_INET6 == 23, address is 16 bytes */ - const UCHAR * ClientIPAddress, /* The client IP address of the "packet" in NETWORK byte order. */ - __in USHORT ClientPort, /* The client port of the "packet" (if applicable to the Protocol) in HOST byte order. */ - __in UCHAR Protocol, /* The IP protocol of the "packet"; TCP, UDP, ICMP, GRE, etc. */ - __in BOOLEAN bReceiveContext, /* A boolean to indicate whether the packet is being processed in send or receive context. */ - __in ULONG Flags); /* Hook-related flags including whether or not the cluster is stopped. */ - -/* In v3, all the arguments passed to the Query Hook would be consolidated within the QueryHookInfo structure. - Any future changes to the arguments would be made in the structure so that the signature of the hook interface doesn't need to change. -*/ -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef NLB_FILTER_HOOK_DIRECTIVE (* NLBQueryFilterHook_v3) ( - __in PQUERY_HOOK_INFO QueryHookInfoPtr); /* The QueryHookInfo structure would be used to pass all arguments in Query Hook. */ - -/* The purpose of this hook is to synchronize the NLB's Client Stickiness state (built up by the Client Stickiness Notify IOCTL) with the 3rd party application's own state (if any). - The NotifyClearClientStickinessHook gets invoked when NLB flushes its client stickiness state for all or a specific port rule(s). - This hook should be registered to receive notifications for client stickiness state being cleared. - This hook would get called for each port rule that is affected. If all of the port rules are affected, then the hook would be called for each of those port rules. - This hook would also be called every time a NLB Load module is started for each of the port rules configured on that load module. - - Note: When the NLB is in the transient state of stopping or draining load module or a specific port rule, the Client Stickiness Notify IOCTL would return "STATUS_RETRY" error. - The caller then may decide to call the IOCTL after delay or at a later time. - Once the 3rd party application is notified of this change, after that Client Stickiness IOCTL should function as expected. -*/ -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef void (* NLBClearClientStickinessFilterHook_v3) ( - __in PCLEAR_CLIENT_STICKINESS_HOOK_INFO ClearClientStickinessHookInfoPtr); - -#if (NTDDI_VERSION >= NTDDI_WIN7) -typedef NLBSendFilterHook_v3 NLBSendFilterHook; -typedef NLBReceiveFilterHook_v3 NLBReceiveFilterHook; -typedef NLBQueryFilterHook_v3 NLBQueryFilterHook; -typedef NLBClearClientStickinessFilterHook_v3 NLBClearClientStickinessFilterHook; -#else - #if (NTDDI_VERSION >= NTDDI_VISTA) - typedef NLBSendFilterHook_v2 NLBSendFilterHook; - typedef NLBReceiveFilterHook_v2 NLBReceiveFilterHook; - typedef NLBQueryFilterHook_v2 NLBQueryFilterHook; - #else - typedef NLBSendFilterHook_v1 NLBSendFilterHook; - typedef NLBReceiveFilterHook_v1 NLBReceiveFilterHook; - typedef NLBQueryFilterHook_v1 NLBQueryFilterHook; - #endif -#endif - -/* Bit settings for the Flags field of the filter hooks. */ -#define NLB_FILTER_HOOK_FLAGS_STOPPED 0x00000001 -#define NLB_FILTER_HOOK_FLAGS_DRAINING 0x00000002 - -/* Force default alignment on the IOCTL buffers. */ -#pragma pack(push) -#pragma pack() -/* This table contains function pointers to register or de-register - a packet filter hook. To register a hook, set the appropriate - function pointer. Those not being specified (for instance if - you want to register a receive hook, but not a send hook) should - be set to NULL. The QueryHook should ONLY be specified if in - conjunction with setting either the send or receive hook; i.e. - a user may not ONLY register the QueryHook. Further, if regis- - tering a send or receive hook (or both), the QueryHook MUST be - provided in order for NLB to query the hook response for cases - where a hashing decision is needed, but we are not in the context - of sending or receiving a packet; most notably, in a connection - up or down notification from IPSec or TCP. -*/ -typedef struct { - __in ULONG Reserved; /* This field must be set to 0 */ - __in NLB_HOOK_API_VERSION Version; /* Version of the structure. For the V3 hooks it has to be set to NLBHookApiV3 */ - __in NLBSendFilterHook SendHook; - __in NLBQueryFilterHook QueryHook; - __in NLBReceiveFilterHook ReceiveHook; - __in NLBClearClientStickinessFilterHook ClearClientStickinessHook; -} NLB_FILTER_HOOK_TABLE, * PNLB_FILTER_HOOK_TABLE; - -/* This is the input buffer for the hook (de)register IOCTL. There is - no corresponding output buffer. This structure identifies the hook - interface being (de)registered, the entity registering the hook and - all appropriate function pointers (callbacks). Note that hooks are - registered in groups, called interfaces, which prevents different - related hooks from being owned by different entities (for example, - it prevents one entity owned the send hook, but another owned the - receive hook). Interfaces are identified by a GUID, and to set any - hook in the interface requires ownership of the entire interface - - even if not all hooks in the interface are being specified. The hook - table should be a pointer to a hook table of the type required by the - specified hook identifier. To de-register a hook, set the hook table - pointer to NULL. - - Note: The HookTable pointer does NOT need to be valid following the - completion of the IOCTL. That is, this pointer is only referenced - within the context of the IOCTL. -*/ -typedef struct { - WCHAR HookIdentifier[NLB_HOOK_IDENTIFIER_LENGTH]; /* The GUID identifying the hook interface being registered. */ - HANDLE RegisteringEntity; /* The open file handle on the NLB driver, which uniquely identifies the registrar. */ - PVOID HookTable; /* A pointer to the appropriate hook table containing the hook function pointers. */ - NLBHookDeregister DeregisterCallback; /* The de-register callback function, which MUST be non-NULL if the operation is a registration. */ -} NLB_IOCTL_REGISTER_HOOK_REQUEST, * PNLB_IOCTL_REGISTER_HOOK_REQUEST; - - -/* These define which IOCTLs would be published to the Client Apps of NLB. - Currently, only Kernel mode components can call the IOCTLs. - All the IOCTLs originating from user-mode components would be rejected. -*/ -#define NLB_PUBLIC_DEVICE_TYPE_CORE 0xc0c0 -#define NLB_PUBLIC_DEVICE_NAME L"\\Device\\WLBS" -#define NLB_PUBLIC_IOCTL_MINIPORT_NAME_LENGTH 48 - -/* These values are used by ClientStickinessNotify structure. */ -#define START_CLIENT_STICKINESS 0 -#define STOP_CLIENT_STICKINESS 1 - -#define NLB_PUBLIC_IOCTL_CLIENT_STICKINESS_NOTIFY CTL_CODE(NLB_PUBLIC_DEVICE_TYPE_CORE, 21, METHOD_BUFFERED, FILE_WRITE_ACCESS) - -/* All NLB IOCTLs expect the following structure as input. */ -typedef struct _NLB_PUBLIC_IOCTL_INPUT -{ - /* The MiniPortName (adapter GUID) field needs to be filled out for all - IOCTLs. */ - WCHAR MiniportName[NLB_PUBLIC_IOCTL_MINIPORT_NAME_LENGTH]; - - union - { - /* NLB IOCTLS may fill out IOCTL-specific fields below to identify - a particular target of the IOCTL. */ - - /* Is used to start/stop client stickiness for connectionless protocols (like UDP) - Currently, only UDP is supported. - Parameters: - a) RequestType: Indicate whether it's a start/stop request - Accepted values: - START_CLIENT_STICKINESS - STOP_CLIENT_STICKINESS - b) ClientIPAddress: Client IP for which stickiness needs to start/stop. - c) Protocol: Used to identify Port Rule. Currently Unused. Defaults to UDP. - d) UsePortIndex: - TRUE: Use PortIndex for identifying port rule - FALSE: Use ServerTuple for identifying port rule - e) PortIndex: Port Rule Index - f) ServerTuple: IP and Port of Server used to identify PortRule - - It applies to IOCTL: - NLB_PUBLIC_IOCTL_CLIENT_STICKINESS_NOTIFY - */ - struct - { - USHORT RequestType; /* Indicate request type (start/stop) */ - HOOK_IP_ADDRESS ClientIPAddress; /* Client IP and it's type for the stickiness is to be started/stopped. Accepts IP Address in NETWORK BYTE ORDER. */ - USHORT Protocol; /* For future use. Currently ignored. This should be set to 0. Only UDP protocol is supported. */ - BOOLEAN UsePortIndex; /* Indicate which type of port rule identification is specified. */ - union - { - ULONG PortIndex; /* Port Rule Index. */ - struct - { - HOOK_IP_ADDRESS IP; /* Server IP and Type - Accepts IP Address in NETWORK BYTE ORDER. */ - USHORT Port; /* Server Port - Accepts Port in HOST BYTE ORDER. */ - } - ServerTuple; /* Required to identify the Port Rule */ - }; - } - ClientStickinessNotify; - }; -} NLB_PUBLIC_IOCTL_INPUT, * PNLB_PUBLIC_IOCTL_INPUT; - -#pragma pack(pop) - -#endif /* !USER_MODE_DEFINITIONS_ONLY */ - -#endif /* (NTDDI_VERSION >= NTDDI_WS03) */ - -#endif /* __NTDDNLB_H__ */ - diff --git a/pub/ddk/ntddpcm.h b/pub/ddk/ntddpcm.h deleted file mode 100644 index acf96e3..0000000 --- a/pub/ddk/ntddpcm.h +++ /dev/null @@ -1,245 +0,0 @@ -/*++ - -Copyright (c) 1994-1999 Microsoft Corporation - -Module Name: - - ntddpcm.h - -Abstract: - - This is the include file that defines all constants and types for - accessing the PCMCIA Adapters. - ---*/ - -#ifndef _NTDDPCMH_ -#define _NTDDPCMH_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Device Name - this string is the name of the device. It is the name -// that should be passed to NtOpenFile when accessing the device. -// -// Note: For devices that support multiple units, it should be suffixed -// with the Ascii representation of the unit number. -// -// Note: The IOCTL interface to pcmcia host controllers is turned off by -// default. These IOCTLs are provided for testing purposes only. To -// turn on this interface, add the following registry value: -// HKLM\SYSTEM\CurrentControlSet\Services\Pcmcia\Parameters\IoctlInterface : REG_DWORD : 1 -// - -#define IOCTL_PCMCIA_BASE FILE_DEVICE_CONTROLLER - -#define DD_PCMCIA_DEVICE_NAME "\\\\.\\Pcmcia" - -// -// IoControlCode values for this device. -// - -#define IOCTL_GET_TUPLE_DATA CTL_CODE(IOCTL_PCMCIA_BASE, 3000, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_SOCKET_INFORMATION CTL_CODE(IOCTL_PCMCIA_BASE, 3004, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PCMCIA_HIDE_DEVICE CTL_CODE(IOCTL_PCMCIA_BASE, 3010, METHOD_BUFFERED, FILE_WRITE_ACCESS) -#define IOCTL_PCMCIA_REVEAL_DEVICE CTL_CODE(IOCTL_PCMCIA_BASE, 3011, METHOD_BUFFERED, FILE_WRITE_ACCESS) - -// -// Tuple request parameters. -// - -typedef struct _PCMCIA_SOCKET_REQUEST { - USHORT Socket; -} PCMCIA_SOCKET_REQUEST, *PPCMCIA_SOCKET_REQUEST; - -typedef struct _TUPLE_REQUEST { - USHORT Socket; -} TUPLE_REQUEST, *PTUPLE_REQUEST; - -#define MANUFACTURER_NAME_LENGTH 64 -#define DEVICE_IDENTIFIER_LENGTH 64 -#define DRIVER_NAME_LENGTH 32 - -#define PcmciaInvalidControllerType 0xffffffff - -// -// Controller classes returned in socket information structure. -// - -typedef enum _PCMCIA_CONTROLLER_CLASS { - PcmciaInvalidControllerClass = -1, - PcmciaIntelCompatible, - PcmciaCardBusCompatible, - PcmciaElcController, - PcmciaDatabook, - PcmciaPciPcmciaBridge, - PcmciaCirrusLogic, - PcmciaTI, - PcmciaTopic, - PcmciaRicoh, - PcmciaDatabookCB, - PcmciaOpti, - PcmciaTrid, - PcmciaO2Micro, - PcmciaNEC, - PcmciaNEC_98 -} PCMCIA_CONTROLLER_CLASS, *PPCMCIA_CONTROLLER_CLASS; - - -typedef struct _PCMCIA_SOCKET_INFORMATION { - USHORT Socket; - USHORT TupleCrc; - UCHAR Manufacturer[MANUFACTURER_NAME_LENGTH]; - UCHAR Identifier[DEVICE_IDENTIFIER_LENGTH]; - UCHAR DriverName[DRIVER_NAME_LENGTH]; - UCHAR DeviceFunctionId; - UCHAR Reserved; - UCHAR CardInSocket; - UCHAR CardEnabled; - ULONG ControllerType; -} PCMCIA_SOCKET_INFORMATION, *PPCMCIA_SOCKET_INFORMATION; - -// -// macros to crack the ControllerId field of the socket info structure -// -#define PcmciaClassFromControllerType(type) ((PCMCIA_CONTROLLER_CLASS)((type) & 0xff)) -#define PcmciaModelFromControllerType(type) (((type) >> 8) & 0x3ffff) -#define PcmciaRevisionFromControllerType(type) ((type) >> 26) - -// -// Begin pcmcia exported interfaces to other drivers -// - -#ifdef _NTDDK_ - -DEFINE_GUID( GUID_PCMCIA_INTERFACE_STANDARD, 0xbed5dadfL, 0x38fb, 0x11d1, 0x94, 0x62, 0x00, 0xc0, 0x4f, 0xb9, 0x60, 0xee); - -#define PCMCIA_MEMORY_8BIT_ACCESS 0 -#define PCMCIA_MEMORY_16BIT_ACCESS 1 - -typedef -__drv_functionClass(PCMCIA_MODIFY_MEMORY_WINDOW) -BOOLEAN -PCMCIA_MODIFY_MEMORY_WINDOW( - __in_opt PVOID Context, - __in ULONGLONG HostBase, - __in ULONGLONG CardBase, - __in BOOLEAN Enable, - __in_opt ULONG WindowSize, - __in_opt UCHAR AccessSpeed, - __in_opt UCHAR BusWidth, - __in_opt BOOLEAN IsAttributeMemory - ); -typedef PCMCIA_MODIFY_MEMORY_WINDOW *PPCMCIA_MODIFY_MEMORY_WINDOW; - -#define PCMCIA_VPP_0V 0 -#define PCMCIA_VPP_12V 1 -#define PCMCIA_VPP_IS_VCC 2 - -typedef -__drv_functionClass(PCMCIA_SET_VPP) -BOOLEAN -PCMCIA_SET_VPP( - __in_opt PVOID Context, - __in UCHAR VppLevel - ); -typedef PCMCIA_SET_VPP *PPCMCIA_SET_VPP; - -typedef -__drv_functionClass(PCMCIA_IS_WRITE_PROTECTED) -BOOLEAN -PCMCIA_IS_WRITE_PROTECTED( - __in_opt PVOID Context - ); -typedef PCMCIA_IS_WRITE_PROTECTED *PPCMCIA_IS_WRITE_PROTECTED; - -// -// These are interfaces for manipulating memory windows, setting Vpp etc., -// primarily used by flash memory card drivers -// -typedef struct _PCMCIA_INTERFACE_STANDARD { - USHORT Size; - USHORT Version; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - PVOID Context; - PPCMCIA_MODIFY_MEMORY_WINDOW ModifyMemoryWindow; - PPCMCIA_SET_VPP SetVpp; - PPCMCIA_IS_WRITE_PROTECTED IsWriteProtected; -} PCMCIA_INTERFACE_STANDARD, *PPCMCIA_INTERFACE_STANDARD; - -// -// Definitions for PCMCIA_BUS_INTERFACE_STANDARD. -// This interface is obtained using GUID_PCMCIA_BUS_INTERFACE_STANDARD -// and is used for reading/writing to PCMCIA config. space -// - -typedef -__drv_functionClass(PCMCIA_READ_CONFIG) -ULONG -PCMCIA_READ_CONFIG( - __in_opt PVOID Context, - __in ULONG WhichSpace, - __out_bcount_full(Length) PUCHAR Buffer, - __in ULONG Offset, - __in ULONG Length - ); -typedef PCMCIA_READ_CONFIG *PPCMCIA_READ_CONFIG; - -typedef -__drv_functionClass(PCMCIA_WRITE_CONFIG) -ULONG -PCMCIA_WRITE_CONFIG( - __in_opt PVOID Context, - __in ULONG WhichSpace, - __in_bcount(Length) PUCHAR Buffer, - __in ULONG Offset, - __in ULONG Length - ); -typedef PCMCIA_WRITE_CONFIG *PPCMCIA_WRITE_CONFIG; - -// -// WhichSpace for IRP_MN_READ_CONFIG/WRITE_CONFIG -// and PCMCIA_BUS_INTERFACE_STANDARD -// -typedef ULONG MEMORY_SPACE; - -#define PCCARD_PCI_CONFIGURATION_SPACE 0 // for cardbus cards -#define PCCARD_ATTRIBUTE_MEMORY 1 -#define PCCARD_COMMON_MEMORY 2 -#define PCCARD_ATTRIBUTE_MEMORY_INDIRECT 3 -#define PCCARD_COMMON_MEMORY_INDIRECT 4 - -// Legacy support -// -#define PCMCIA_CONFIG_SPACE PCCARD_ATTRIBUTE_MEMORY - -typedef struct _PCMCIA_BUS_INTERFACE_STANDARD { - // - // generic interface header - // - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - // - // standard PCMCIA bus interfaces - // - PPCMCIA_READ_CONFIG ReadConfig; - PPCMCIA_WRITE_CONFIG WriteConfig; -} PCMCIA_BUS_INTERFACE_STANDARD, *PPCMCIA_BUS_INTERFACE_STANDARD; - -#endif - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/pub/ddk/ntddsd.h b/pub/ddk/ntddsd.h deleted file mode 100644 index 5328ed4..0000000 --- a/pub/ddk/ntddsd.h +++ /dev/null @@ -1,468 +0,0 @@ -/*++ - -Copyright (c) 2002 Microsoft Corporation - -Module Name: - - ntddsd.h - -Abstract: - - This is the include file that defines the SD (aka Secure Digital) - bus driver interface. - - ---*/ - -#ifndef _NTDDSDH_ -#define _NTDDSDH_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif - -// -// Disable warning: named type definition in parentheses -// - -#pragma warning(disable:4201) - - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Use this version in the interface_data structure -// - -#define SDBUS_INTERFACE_VERSION 0x101 - -// -// Prototype of the callback routine which is called for SDIO -// devices to reflect device interrupts. -// - -__drv_functionClass(SDBUS_CALLBACK_ROUTINE) -__drv_sameIRQL -__drv_maxIRQL(DISPATCH_LEVEL) -typedef -VOID -SDBUS_CALLBACK_ROUTINE( - __in PVOID CallbackRoutineContext, - __in ULONG InterruptType - ); - -typedef SDBUS_CALLBACK_ROUTINE *PSDBUS_CALLBACK_ROUTINE; - - -#define SDBUS_INTTYPE_DEVICE 0 - -// -// The interface parameters structure is passed to the InitializeInterface -// function in the SDBUS_INTERFACE_STANDARD -// - -typedef struct _SDBUS_INTERFACE_PARAMETERS { - USHORT Size; - USHORT Reserved; - - // - // Points to next lower device object in the device stack. - // - PDEVICE_OBJECT TargetObject; - - // - // This flag indicates whether the caller expects any device - // interrupts from the device. - // - BOOLEAN DeviceGeneratesInterrupts; - - // - // The caller can specify here the IRQL at which the callback - // function is entered. If this value is TRUE, the callback will - // be entered at DPC level. If this value is FALSE, the callback - // will be entered at passive level. - // - // Specifying TRUE will generally lower latency time of the interrupt - // delivery, at the cost of complicating the device driver, which - // must then deal with running at different IRQLs. - // - BOOLEAN CallbackAtDpcLevel; - - // - // When an IO device interrupts, the SD bus driver will generate a - // callback to this routine. The caller must supply this pointer if - // the field DeviceGeneratesInterrupts was set to TRUE; - // - PSDBUS_CALLBACK_ROUTINE CallbackRoutine; - - // - // The caller can specify here a context value which will be passed - // to the device interrupt callback routine. - // - PVOID CallbackRoutineContext; - -} SDBUS_INTERFACE_PARAMETERS, *PSDBUS_INTERFACE_PARAMETERS; - -// -// Prototype of function used to initialize the the interface once -// it has been opened. -// - -__checkReturn -__drv_sameIRQL -__drv_maxIRQL(DISPATCH_LEVEL) -typedef -NTSTATUS -(*PSDBUS_INITIALIZE_INTERFACE_ROUTINE)( - __in PVOID Context, - __in PSDBUS_INTERFACE_PARAMETERS InterfaceParameters - ); - - -// -// Prototype of routine that the function driver must call -// when the function driver has completed its interrupt processing -// - -__drv_sameIRQL -__drv_maxIRQL(DISPATCH_LEVEL) -typedef -NTSTATUS -(*PSDBUS_ACKNOWLEDGE_INT_ROUTINE)( - __in PVOID Context - ); - - -// -// SDBUS_INTERFACE_STANDARD -// -// Interface Data structure used in the SdBusOpenInterface call. This -// structure defines the communication path between the SD function -// driver and the bus driver. -// - -DEFINE_GUID( GUID_SDBUS_INTERFACE_STANDARD, 0x6bb24d81L, 0xe924, 0x4825, 0xaf, 0x49, 0x3a, 0xcd, 0x33, 0xc1, 0xd8, 0x20 ); - - -typedef struct _SDBUS_INTERFACE_STANDARD { - USHORT Size; - USHORT Version; - // - // Interface Context - // - // This context pointer is filled in by the bus driver during the call - // to SdBusOpenInterface(). This data must be passed as a parameter to - // the other interface functions. - // - PVOID Context; - - // - // Interface Reference/Dereference maintain the interface's reference - // count. The reference count is automatically incremented to 1 when - // the interface is opened. The caller must dereference the interface - // under the following circumstances: - // a) the function driver receives a query_remove IRP - // b) the function driver receives a surprise_remove IRP - // c) the function driver receives a remove IRP without either a - // query_remove or a surprise_remove. - // - // In all cases, the function driver should dereference the interface - // before passing the respective IRP down to the bus driver. - // - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // - // After the interface has been opened, the bus driver will have filled - // in the pointer to the following routine which allows the function - // driver to set the parameters of the interface. - // - - PSDBUS_INITIALIZE_INTERFACE_ROUTINE InitializeInterface; - - // - // NTSTATUS SdBusAcknowledgeInterrupt(InterfaceContext) - // - // This routine is filled in by the call to SdBusOpenInterface(), - // and is used by the function driver to indicate when processing - // of an IO device interrupt is complete. - // - // When an IO function of an SD device asserts an interrupt, the bus - // driver will disable that interrupt to allow I/O operations to be - // sent to the device at a reasonable IRQL (that is, <=DISPATCH_LEVEL). - // - // When the function driver's callback routine, which is equivalent to - // an ISR, is done clearing the function's interrupt, this routine should - // be called to re-enable the IRQ for card interrupts. - // - // Callers must be running at IRQL <= DISPATCH_LEVEL. - // - // Returns STATUS_UNSUCCESSFUL if the InterfaceContext pointer is invalid. - // - - PSDBUS_ACKNOWLEDGE_INT_ROUTINE AcknowledgeInterrupt; - -} SDBUS_INTERFACE_STANDARD, *PSDBUS_INTERFACE_STANDARD; - - -// -// SdBusOpenInterface() -// -// This routine establishes a connection to the SD bus driver. -// It should be called in the AddDevice routine with the FDO for -// the device stack is created. -// -// If STATUS_SUCCESS is returned, then the InterfaceData structure -// is filled in with valid function pointers and an interface context -// parameter. The context pointer must be used in all other SD bus -// driver calls. -// -// Callers must be running at IRQL < DISPATCH_LEVEL. -// - -__checkReturn -__drv_sameIRQL -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -SdBusOpenInterface( - __in PDEVICE_OBJECT Pdo, - __out PSDBUS_INTERFACE_STANDARD InterfaceStandard, - __in USHORT Size, - __in USHORT Version - ); - - -// -// Definitions for properties used in Get/Set Property requests -// -// The bus driver version where any given property was introduced is -// indicated as a comment to the right of the property. Note that the -// property to retrieve the version was not introduced until v2.0. -// Callers can determine the bus driver is at version 1.0 by looking -// for a STATUS_INVALID_PARAMETER return from an get property call on -// SDP_BUS_DRIVER_VERSION. -// - -typedef enum { - SDP_MEDIA_CHANGECOUNT = 0, // v1.0 ULONG - SDP_MEDIA_STATE, // v1.0 SDPROP_MEDIA_STATE - SDP_WRITE_PROTECTED, // v1.0 BOOLEAN - SDP_FUNCTION_NUMBER, // v1.0 UCHAR - SDP_FUNCTION_TYPE, // v2.0 SDBUS_FUNCTION_TYPE - SDP_BUS_DRIVER_VERSION, // v2.0 USHORT - SDP_BUS_WIDTH, // v2.0 UCHAR - SDP_BUS_CLOCK, // v2.0 ULONG - SDP_BUS_INTERFACE_CONTROL, // v2.0 UCHAR - SDP_HOST_BLOCK_LENGTH, // v2.0 USHORT - SDP_FUNCTION_BLOCK_LENGTH, // v2.0 USHORT - SDP_FN0_BLOCK_LENGTH, // v2.0 USHORT - SDP_FUNCTION_INT_ENABLE, // v2.0 BOOLEAN -} SDBUS_PROPERTY; - -// -// Bus driver versions -// - -#define SDBUS_DRIVER_VERSION_1 0x100 -#define SDBUS_DRIVER_VERSION_2 0x200 - -// -// Media states defined for SDP_MEDIA_STATE -// - -typedef enum { - SDPMS_NO_MEDIA = 0, - SDPMS_MEDIA_INSERTED -} SDPROP_MEDIA_STATE; - - -// -// Values defined for SDP_FUNCTION_TYPE -// - -typedef enum { - SDBUS_FUNCTION_TYPE_UNKNOWN = 0, - SDBUS_FUNCTION_TYPE_SDIO, - SDBUS_FUNCTION_TYPE_SD_MEMORY, - SDBUS_FUNCTION_TYPE_MMC_MEMORY, -} SDBUS_FUNCTION_TYPE; - -#define IsTypeMemory(type) ((type == SDBUS_FUNCTION_TYPE_SD_MEMORY) || \ - (type == SDBUS_FUNCTION_TYPE_MMC_MEMORY)) -#define IsTypeIo(type) (type == SDBUS_FUNCTION_TYPE_SDIO) - - -// -// Data structures for request packets -// - -typedef enum { - SDRF_GET_PROPERTY, - SDRF_SET_PROPERTY, - SDRF_DEVICE_COMMAND -} SD_REQUEST_FUNCTION; - - -// -// SDBUS_REQUEST_PACKET -// -// This structure specifies parameters for individual requests -// and commands sent to the bus driver by SdBusSubmitRequest() -// - -typedef struct _SDBUS_REQUEST_PACKET { - - // - // specifies the parameters for the operation, and how they - // are interpreted - // - SD_REQUEST_FUNCTION RequestFunction; - - // - // These context fields are provided for the optional use of the caller. - // They are not referenced by the bus driver - // - PVOID UserContext[3]; - - // - // Information from the operation. Its usage is equivalent to - // the Irp->IoStatus.Information field. For example, the length - // of data transmitted for read/write operations will be filled - // in here by the bus driver. - // - ULONG_PTR Information; - - // - // Response data and length is returned by the device. Maximum - // returned is 16 bytes. The content of this field is defined - // in the SD spec. - // - union { - UCHAR AsUCHAR[16]; - ULONG AsULONG[4]; - SDRESP_TYPE3 Type3; - } ResponseData; - UCHAR ResponseLength; - - // - // Parameters to the individual functions - // - union { - - // - // The property functions allow the caller to control aspects of - // bus driver operation. - // - - struct { - SDBUS_PROPERTY Property; - PVOID Buffer; - ULONG Length; - } GetSetProperty; - - // - // DeviceCommand is the 'pipe' that allows SD device codes and arguments - // to be executed. These codes are either defined in the SD spec, - // can be based per device class, or can also be proprietary. - // - - struct { - SDCMD_DESCRIPTOR CmdDesc; - ULONG Argument; - PMDL Mdl; - ULONG Length; - } DeviceCommand; - - } Parameters; - - -} SDBUS_REQUEST_PACKET, *PSDBUS_REQUEST_PACKET; - - - -// -// SdBusSubmitRequest() -// SdBusSubmitRequestAsync() -// -// These routines send SD request packets to the bus driver. The SubmitRequest -// version is synchronous, and must be called at IRQL < DISPATCH_LEVEL. The -// SubmitRequestAsync version is asynchronous, and the user must supply an IRP -// and completion routine. -// -// Arguments: -// -// InterfaceContext - this is the context pointer returned by the -// SdBusOpenInterface() call. -// -// Packet - The parameters of the request are specified in this -// SDBUS_REQUEST_PACKET, which is allocated by the caller. -// -// Irp - The passed IRP will be used to transfer the request -// packet to the bus driver. It can either be a new irp -// allocated by the caller just for this request, or it can -// also be an IRP the caller is processing. The packet will -// be placed in the Parameters.Others.Argument1 of the IRP. -// -// CompletionRoutine- When the request is completed by the bus driver, this -// completion routine will be called. -// -// UserContext - This context will be passed to the specified CompletionRoutine -// -// Notes: -// -// Callers of SdBusSubmitRequest must be running at IRQL < DISPATCH_LEVEL. -// Callers of SdBusSubmitRequestAsync must be running at IRQL <= DISPATCH_LEVEL. -// - -__checkReturn -__drv_sameIRQL -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -SdBusSubmitRequest( - __in PVOID InterfaceContext, - __in PSDBUS_REQUEST_PACKET Packet - ); - - -__checkReturn -__drv_sameIRQL -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -SdBusSubmitRequestAsync( - __in PVOID InterfaceContext, - __in PSDBUS_REQUEST_PACKET Packet, - __in PIRP Irp, - __in PIO_COMPLETION_ROUTINE CompletionRoutine, - __in PVOID UserContext - ); - - -// -// IoControlCode values used in this interface. There normally should be no -// need to use these values directly, as SDBUS.LIB provides the support routines -// which issue these IOCTLs to the bus driver. -// -// - -#define IOCTL_SDBUS_BASE FILE_DEVICE_CONTROLLER -#define IOCTL_SD_SUBMIT_REQUEST CTL_CODE(IOCTL_SDBUS_BASE, 3100, METHOD_NEITHER, FILE_ANY_ACCESS) - - -#ifdef __cplusplus -} -#endif - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - -#endif - diff --git a/pub/ddk/ntddsfio.h b/pub/ddk/ntddsfio.h deleted file mode 100644 index 307d7b4..0000000 --- a/pub/ddk/ntddsfio.h +++ /dev/null @@ -1,60 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ntddsfio.h - -Abstract: - - This is the include file that defines all common constants, ioctls and types - for Scheduled File I/O (SFIO). - -Revision History: - ---*/ -#if (NTDDI_VERSION >= NTDDI_VISTA) - -#pragma once - -typedef enum _IO_ACCESS_TYPE { - - // - // Indicates that the Io will - // be comprised solely of reads - // - ReadAccess, - - // - // Indicates that the Io will - // be comprised solely of writes - // - WriteAccess, - - // - // Indicates that the Io will be - // comprised of reads and writes - // - ModifyAccess - -} IO_ACCESS_TYPE; - -typedef enum _IO_ACCESS_MODE { - - // - // Indicates that the Io will be - // sent down in a sequential order - // - SequentialAccess, - - // - // Indicates that the Io might - // not be in a predictable order - // - RandomAccess - -} IO_ACCESS_MODE; - -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - diff --git a/pub/ddk/ntifs.h b/pub/ddk/ntifs.h deleted file mode 100644 index 91d4630..0000000 --- a/pub/ddk/ntifs.h +++ /dev/null @@ -1,18685 +0,0 @@ -/*++ BUILD Version: 0146 // Increment this if a change has global effects - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ntifs.h - -Abstract: - - This module defines the NT types, constants, and functions that are - exposed to file system drivers. - -Revision History: - ---*/ - -#ifndef _NTIFS_ -#define _NTIFS_ - -#define _NTIFS_INCLUDED_ - -#ifndef RC_INVOKED -#if _MSC_VER < 1300 -#error Compiler version not supported by Windows DDK -#endif -#endif // RC_INVOKED - -#ifndef __cplusplus -#pragma warning(disable:4116) // TYPE_ALIGNMENT generates this - move it - // outside the warning push/pop scope. -#endif - -#define NT_INCLUDED -#define _NTMSV1_0_ -#define _CTYPE_DISABLE_MACROS - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif - -#pragma warning(disable:4115) // named type definition in parentheses -#pragma warning(disable:4201) // nameless struct/union -#pragma warning(disable:4214) // bit field types other than int - - -#include -#include -#include -#include -#include -#include -#include - - -// -// These macros are used to test, set and clear flags respectivly -// - -#ifndef FlagOn -#define FlagOn(_F,_SF) ((_F) & (_SF)) -#endif - -#ifndef BooleanFlagOn -#define BooleanFlagOn(F,SF) ((BOOLEAN)(((F) & (SF)) != 0)) -#endif - -#ifndef SetFlag -#define SetFlag(_F,_SF) ((_F) |= (_SF)) -#endif - -#ifndef ClearFlag -#define ClearFlag(_F,_SF) ((_F) &= ~(_SF)) -#endif - -// -// Define types that are not exported. -// - -typedef struct _BUS_HANDLER *PBUS_HANDLER; -typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT; -typedef struct _DEVICE_HANDLER_OBJECT *PDEVICE_HANDLER_OBJECT; -typedef struct _IO_TIMER *PIO_TIMER; -typedef struct _KINTERRUPT *PKINTERRUPT; -typedef struct _KPROCESS *PKPROCESS ,*PRKPROCESS, *PEPROCESS; -typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD, *PETHREAD; -typedef struct _OBJECT_TYPE *POBJECT_TYPE; -typedef struct _PEB *PPEB; -typedef struct _ACL *PACL; - -#ifdef __cplusplus -extern "C" { -#endif - -#define PsGetCurrentProcess IoGetCurrentProcess - -#if (NTDDI_VERSION >= NTDDI_VISTA) -extern NTSYSAPI volatile CCHAR KeNumberProcessors; -#elif (NTDDI_VERSION >= NTDDI_WINXP) -extern NTSYSAPI CCHAR KeNumberProcessors; -#else -extern PCCHAR KeNumberProcessors; -#endif - -typedef UNICODE_STRING LSA_UNICODE_STRING, *PLSA_UNICODE_STRING; -typedef STRING LSA_STRING, *PLSA_STRING; -typedef OBJECT_ATTRIBUTES LSA_OBJECT_ATTRIBUTES, *PLSA_OBJECT_ATTRIBUTES; - -#ifndef SID_IDENTIFIER_AUTHORITY_DEFINED -#define SID_IDENTIFIER_AUTHORITY_DEFINED -typedef struct _SID_IDENTIFIER_AUTHORITY { - UCHAR Value[6]; -} SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY; -#endif - - -#ifndef SID_DEFINED -#define SID_DEFINED -typedef struct _SID { - UCHAR Revision; - UCHAR SubAuthorityCount; - SID_IDENTIFIER_AUTHORITY IdentifierAuthority; -#ifdef MIDL_PASS - [size_is(SubAuthorityCount)] ULONG SubAuthority[*]; -#else // MIDL_PASS - ULONG SubAuthority[ANYSIZE_ARRAY]; -#endif // MIDL_PASS -} SID, *PISID; -#endif - -#define SID_REVISION (1) // Current revision level -#define SID_MAX_SUB_AUTHORITIES (15) -#define SID_RECOMMENDED_SUB_AUTHORITIES (1) // Will change to around 6 - - // in a future release. -#ifndef MIDL_PASS -#define SECURITY_MAX_SID_SIZE \ - (sizeof(SID) - sizeof(ULONG) + (SID_MAX_SUB_AUTHORITIES * sizeof(ULONG))) -#endif // MIDL_PASS - - -typedef enum _SID_NAME_USE { - SidTypeUser = 1, - SidTypeGroup, - SidTypeDomain, - SidTypeAlias, - SidTypeWellKnownGroup, - SidTypeDeletedAccount, - SidTypeInvalid, - SidTypeUnknown, - SidTypeComputer, - SidTypeLabel -} SID_NAME_USE, *PSID_NAME_USE; - -typedef struct _SID_AND_ATTRIBUTES { -#ifdef MIDL_PASS - PISID Sid; -#else // MIDL_PASS - PSID Sid; -#endif // MIDL_PASS - ULONG Attributes; - } SID_AND_ATTRIBUTES, * PSID_AND_ATTRIBUTES; - -typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; -typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY; - -#define SID_HASH_SIZE 32 -typedef ULONG_PTR SID_HASH_ENTRY, *PSID_HASH_ENTRY; - -typedef struct _SID_AND_ATTRIBUTES_HASH { - ULONG SidCount; - PSID_AND_ATTRIBUTES SidAttr; - SID_HASH_ENTRY Hash[SID_HASH_SIZE]; -} SID_AND_ATTRIBUTES_HASH, *PSID_AND_ATTRIBUTES_HASH; - - -///////////////////////////////////////////////////////////////////////////// -// // -// Universal well-known SIDs // -// // -// Null SID S-1-0-0 // -// World S-1-1-0 // -// Local S-1-2-0 // -// Creator Owner ID S-1-3-0 // -// Creator Group ID S-1-3-1 // -// Creator Owner Server ID S-1-3-2 // -// Creator Group Server ID S-1-3-3 // -// // -// (Non-unique IDs) S-1-4 // -// // -///////////////////////////////////////////////////////////////////////////// - -#define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0} -#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1} -#define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2} -#define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3} -#define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4} -#define SECURITY_RESOURCE_MANAGER_AUTHORITY {0,0,0,0,0,9} - - -#define SECURITY_NULL_RID (0x00000000L) -#define SECURITY_WORLD_RID (0x00000000L) -#define SECURITY_LOCAL_RID (0x00000000L) -#define SECURITY_LOCAL_LOGON_RID (0x00000001L) - -#define SECURITY_CREATOR_OWNER_RID (0x00000000L) -#define SECURITY_CREATOR_GROUP_RID (0x00000001L) - -#define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L) -#define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L) - -#define SECURITY_CREATOR_OWNER_RIGHTS_RID (0x00000004L) - -/////////////////////////////////////////////////////////////////////////////// -// // -// NT well-known SIDs // -// // -// NT Authority S-1-5 // -// Dialup S-1-5-1 // -// // -// Network S-1-5-2 // -// Batch S-1-5-3 // -// Interactive S-1-5-4 // -// (Logon IDs) S-1-5-5-X-Y // -// Service S-1-5-6 // -// AnonymousLogon S-1-5-7 (aka null logon session) // -// Proxy S-1-5-8 // -// Enterprise DC (EDC) S-1-5-9 (aka domain controller account) // -// Self S-1-5-10 (self RID) // -// Authenticated User S-1-5-11 (Authenticated user somewhere) // -// Restricted Code S-1-5-12 (Running restricted code) // -// Terminal Server S-1-5-13 (Running on Terminal Server) // -// Remote Logon S-1-5-14 (Remote Interactive Logon) // -// This Organization S-1-5-15 // -// // -// IUser S-1-5-17 -// Local System S-1-5-18 // -// Local Service S-1-5-19 // -// Network Service S-1-5-20 // -// // -// (NT non-unique IDs) S-1-5-0x15-... (NT Domain Sids) // -// // -// (Built-in domain) S-1-5-0x20 // -// // -// (Security Package IDs) S-1-5-0x40 // -// NTLM Authentication S-1-5-0x40-10 // -// SChannel Authentication S-1-5-0x40-14 // -// Digest Authentication S-1-5-0x40-21 // -// // -// Other Organization S-1-5-1000 (>=1000 can not be filtered) // -// // -// // -// NOTE: the relative identifier values (RIDs) determine which security // -// boundaries the SID is allowed to cross. Before adding new RIDs, // -// a determination needs to be made regarding which range they should // -// be added to in order to ensure proper "SID filtering" // -// // -/////////////////////////////////////////////////////////////////////////////// - - -#define SECURITY_NT_AUTHORITY {0,0,0,0,0,5} // ntifs - -#define SECURITY_DIALUP_RID (0x00000001L) -#define SECURITY_NETWORK_RID (0x00000002L) -#define SECURITY_BATCH_RID (0x00000003L) -#define SECURITY_INTERACTIVE_RID (0x00000004L) -#define SECURITY_LOGON_IDS_RID (0x00000005L) -#define SECURITY_LOGON_IDS_RID_COUNT (3L) -#define SECURITY_SERVICE_RID (0x00000006L) -#define SECURITY_ANONYMOUS_LOGON_RID (0x00000007L) -#define SECURITY_PROXY_RID (0x00000008L) -#define SECURITY_ENTERPRISE_CONTROLLERS_RID (0x00000009L) -#define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID -#define SECURITY_PRINCIPAL_SELF_RID (0x0000000AL) -#define SECURITY_AUTHENTICATED_USER_RID (0x0000000BL) -#define SECURITY_RESTRICTED_CODE_RID (0x0000000CL) -#define SECURITY_TERMINAL_SERVER_RID (0x0000000DL) -#define SECURITY_REMOTE_LOGON_RID (0x0000000EL) -#define SECURITY_THIS_ORGANIZATION_RID (0x0000000FL) -#define SECURITY_IUSER_RID (0x00000011L) -#define SECURITY_LOCAL_SYSTEM_RID (0x00000012L) -#define SECURITY_LOCAL_SERVICE_RID (0x00000013L) -#define SECURITY_NETWORK_SERVICE_RID (0x00000014L) - -#define SECURITY_NT_NON_UNIQUE (0x00000015L) -#define SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT (3L) - -#define SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID (0x00000016L) - -#define SECURITY_BUILTIN_DOMAIN_RID (0x00000020L) -#define SECURITY_WRITE_RESTRICTED_CODE_RID (0x00000021L) - - -#define SECURITY_PACKAGE_BASE_RID (0x00000040L) -#define SECURITY_PACKAGE_RID_COUNT (2L) -#define SECURITY_PACKAGE_NTLM_RID (0x0000000AL) -#define SECURITY_PACKAGE_SCHANNEL_RID (0x0000000EL) -#define SECURITY_PACKAGE_DIGEST_RID (0x00000015L) - -#define SECURITY_CRED_TYPE_BASE_RID (0x00000041L) -#define SECURITY_CRED_TYPE_RID_COUNT (2L) -#define SECURITY_CRED_TYPE_THIS_ORG_CERT_RID (0x00000001L) - -#define SECURITY_MIN_BASE_RID (0x00000050L) - -#define SECURITY_SERVICE_ID_BASE_RID (0x00000050L) -#define SECURITY_SERVICE_ID_RID_COUNT (6L) - -#define SECURITY_RESERVED_ID_BASE_RID (0x00000051L) - -#define SECURITY_APPPOOL_ID_BASE_RID (0x00000052L) -#define SECURITY_APPPOOL_ID_RID_COUNT (6L) - -#define SECURITY_VIRTUALSERVER_ID_BASE_RID (0x00000053L) -#define SECURITY_VIRTUALSERVER_ID_RID_COUNT (6L) - -#define SECURITY_USERMODEDRIVERHOST_ID_BASE_RID (0x00000054L) -#define SECURITY_USERMODEDRIVERHOST_ID_RID_COUNT (6L) - -#define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_BASE_RID (0x00000055L) -#define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_RID_COUNT (6L) - -#define SECURITY_WMIHOST_ID_BASE_RID (0x00000056L) -#define SECURITY_WMIHOST_ID_RID_COUNT (6L) - -#define SECURITY_TASK_ID_BASE_RID (0x00000057L) - -#define SECURITY_NFS_ID_BASE_RID (0x00000058L) - -#define SECURITY_COM_ID_BASE_RID (0x00000059L) - -#define SECURITY_VIRTUALACCOUNT_ID_RID_COUNT (6L) - -#define SECURITY_MAX_BASE_RID (0x0000006FL) -#define SECURITY_MAX_ALWAYS_FILTERED (0x000003E7L) -#define SECURITY_MIN_NEVER_FILTERED (0x000003E8L) - -#define SECURITY_OTHER_ORGANIZATION_RID (0x000003E8L) - -// -//Service SID type RIDs are in the range 0x50- 0x6F. Therefore, we are giving the next available RID to Windows Mobile team. -// -#define SECURITY_WINDOWSMOBILE_ID_BASE_RID (0x00000070L) - - -///////////////////////////////////////////////////////////////////////////// -// // -// well-known domain relative sub-authority values (RIDs)... // -// // -///////////////////////////////////////////////////////////////////////////// - - - -#define DOMAIN_GROUP_RID_ENTERPRISE_READONLY_DOMAIN_CONTROLLERS (0x000001F2L) - -#define FOREST_USER_RID_MAX (0x000001F3L) - -// Well-known users ... - -#define DOMAIN_USER_RID_ADMIN (0x000001F4L) -#define DOMAIN_USER_RID_GUEST (0x000001F5L) -#define DOMAIN_USER_RID_KRBTGT (0x000001F6L) - -#define DOMAIN_USER_RID_MAX (0x000003E7L) - - -// well-known groups ... - -#define DOMAIN_GROUP_RID_ADMINS (0x00000200L) -#define DOMAIN_GROUP_RID_USERS (0x00000201L) -#define DOMAIN_GROUP_RID_GUESTS (0x00000202L) -#define DOMAIN_GROUP_RID_COMPUTERS (0x00000203L) -#define DOMAIN_GROUP_RID_CONTROLLERS (0x00000204L) -#define DOMAIN_GROUP_RID_CERT_ADMINS (0x00000205L) -#define DOMAIN_GROUP_RID_SCHEMA_ADMINS (0x00000206L) -#define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS (0x00000207L) -#define DOMAIN_GROUP_RID_POLICY_ADMINS (0x00000208L) -#define DOMAIN_GROUP_RID_READONLY_CONTROLLERS (0x00000209L) - -// well-known aliases ... - -#define DOMAIN_ALIAS_RID_ADMINS (0x00000220L) -#define DOMAIN_ALIAS_RID_USERS (0x00000221L) -#define DOMAIN_ALIAS_RID_GUESTS (0x00000222L) -#define DOMAIN_ALIAS_RID_POWER_USERS (0x00000223L) - -#define DOMAIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L) -#define DOMAIN_ALIAS_RID_SYSTEM_OPS (0x00000225L) -#define DOMAIN_ALIAS_RID_PRINT_OPS (0x00000226L) -#define DOMAIN_ALIAS_RID_BACKUP_OPS (0x00000227L) - -#define DOMAIN_ALIAS_RID_REPLICATOR (0x00000228L) -#define DOMAIN_ALIAS_RID_RAS_SERVERS (0x00000229L) -#define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS (0x0000022AL) -#define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS (0x0000022BL) -#define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS (0x0000022CL) -#define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS (0x0000022DL) - -#define DOMAIN_ALIAS_RID_MONITORING_USERS (0x0000022EL) -#define DOMAIN_ALIAS_RID_LOGGING_USERS (0x0000022FL) -#define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS (0x00000230L) -#define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS (0x00000231L) -#define DOMAIN_ALIAS_RID_DCOM_USERS (0x00000232L) -#define DOMAIN_ALIAS_RID_IUSERS (0x00000238L) -#define DOMAIN_ALIAS_RID_CRYPTO_OPERATORS (0x00000239L) -#define DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP (0x0000023BL) -#define DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP (0x0000023CL) -#define DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP (0x0000023DL) -#define DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP (0x0000023EL) - - -#define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16} -#define SECURITY_MANDATORY_UNTRUSTED_RID (0x00000000L) -#define SECURITY_MANDATORY_LOW_RID (0x00001000L) -#define SECURITY_MANDATORY_MEDIUM_RID (0x00002000L) -#define SECURITY_MANDATORY_MEDIUM_PLUS_RID (SECURITY_MANDATORY_MEDIUM_RID + 0x100) -#define SECURITY_MANDATORY_HIGH_RID (0x00003000L) -#define SECURITY_MANDATORY_SYSTEM_RID (0x00004000L) -#define SECURITY_MANDATORY_PROTECTED_PROCESS_RID (0x00005000L) - -// -// SECURITY_MANDATORY_MAXIMUM_USER_RID is the highest RID that -// can be set by a usermode caller. -// - -#define SECURITY_MANDATORY_MAXIMUM_USER_RID SECURITY_MANDATORY_SYSTEM_RID - -#define MANDATORY_LEVEL_TO_MANDATORY_RID(IL) (IL * 0x1000) - -// -// Allocate the System Luid. The first 1000 LUIDs are reserved. -// Use #999 here (0x3e7 = 999) -// - -#define SYSTEM_LUID { 0x3e7, 0x0 } -#define ANONYMOUS_LOGON_LUID { 0x3e6, 0x0 } -#define LOCALSERVICE_LUID { 0x3e5, 0x0 } -#define NETWORKSERVICE_LUID { 0x3e4, 0x0 } -#define IUSER_LUID { 0x3e3, 0x0 } - - -// -// The structure of an ACE is a common ace header followed by ace type -// specific data. Pictorally the structure of the common ace header is -// 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 -// +---------------+-------+-------+---------------+---------------+ -// | AceSize | AceFlags | AceType | -// +---------------+-------+-------+---------------+---------------+ -// -// AceType denotes the type of the ace, there are some predefined ace -// types -// -// AceSize is the size, in bytes, of ace. -// -// AceFlags are the Ace flags for audit and inheritance, defined shortly. - -typedef struct _ACE_HEADER { - UCHAR AceType; - UCHAR AceFlags; - USHORT AceSize; -} ACE_HEADER; -typedef ACE_HEADER *PACE_HEADER; - -// -// The following are the predefined ace types that go into the AceType -// field of an Ace header. -// - -#define ACCESS_MIN_MS_ACE_TYPE (0x0) -#define ACCESS_ALLOWED_ACE_TYPE (0x0) -#define ACCESS_DENIED_ACE_TYPE (0x1) -#define SYSTEM_AUDIT_ACE_TYPE (0x2) -#define SYSTEM_ALARM_ACE_TYPE (0x3) -#define ACCESS_MAX_MS_V2_ACE_TYPE (0x3) - -#define ACCESS_ALLOWED_COMPOUND_ACE_TYPE (0x4) -#define ACCESS_MAX_MS_V3_ACE_TYPE (0x4) - -#define ACCESS_MIN_MS_OBJECT_ACE_TYPE (0x5) -#define ACCESS_ALLOWED_OBJECT_ACE_TYPE (0x5) -#define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6) -#define SYSTEM_AUDIT_OBJECT_ACE_TYPE (0x7) -#define SYSTEM_ALARM_OBJECT_ACE_TYPE (0x8) -#define ACCESS_MAX_MS_OBJECT_ACE_TYPE (0x8) - -#define ACCESS_MAX_MS_V4_ACE_TYPE (0x8) -#define ACCESS_MAX_MS_ACE_TYPE (0x8) - -#define ACCESS_ALLOWED_CALLBACK_ACE_TYPE (0x9) -#define ACCESS_DENIED_CALLBACK_ACE_TYPE (0xA) -#define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE (0xB) -#define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE (0xC) -#define SYSTEM_AUDIT_CALLBACK_ACE_TYPE (0xD) -#define SYSTEM_ALARM_CALLBACK_ACE_TYPE (0xE) -#define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE (0xF) -#define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE (0x10) - -#define SYSTEM_MANDATORY_LABEL_ACE_TYPE (0x11) -#define ACCESS_MAX_MS_V5_ACE_TYPE (0x11) - -// end_winnt - - -// begin_winnt - -// -// The following are the inherit flags that go into the AceFlags field -// of an Ace header. -// - -#define OBJECT_INHERIT_ACE (0x1) -#define CONTAINER_INHERIT_ACE (0x2) -#define NO_PROPAGATE_INHERIT_ACE (0x4) -#define INHERIT_ONLY_ACE (0x8) -#define INHERITED_ACE (0x10) -#define VALID_INHERIT_FLAGS (0x1F) - - -// The following are the currently defined ACE flags that go into the -// AceFlags field of an ACE header. Each ACE type has its own set of -// AceFlags. -// -// SUCCESSFUL_ACCESS_ACE_FLAG - used only with system audit and alarm ACE -// types to indicate that a message is generated for successful accesses. -// -// FAILED_ACCESS_ACE_FLAG - used only with system audit and alarm ACE types -// to indicate that a message is generated for failed accesses. -// - -// -// SYSTEM_AUDIT and SYSTEM_ALARM AceFlags -// -// These control the signaling of audit and alarms for success or failure. -// - -#define SUCCESSFUL_ACCESS_ACE_FLAG (0x40) -#define FAILED_ACCESS_ACE_FLAG (0x80) - - -// -// We'll define the structure of the predefined ACE types. Pictorally -// the structure of the predefined ACE's is 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 -// +---------------+-------+-------+---------------+---------------+ -// | AceFlags | Resd |Inherit| AceSize | AceType | -// +---------------+-------+-------+---------------+---------------+ -// | Mask | -// +---------------------------------------------------------------+ -// | | -// + + -// | | -// + Sid + -// | | -// + + -// | | -// +---------------------------------------------------------------+ -// -// Mask is the access mask associated with the ACE. This is either the -// access allowed, access denied, audit, or alarm mask. -// -// Sid is the Sid associated with the ACE. -// - -// The following are the four predefined ACE types. - -// Examine the AceType field in the Header to determine -// which structure is appropriate to use for casting. - - -typedef struct _ACCESS_ALLOWED_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - ULONG SidStart; -} ACCESS_ALLOWED_ACE; - -typedef ACCESS_ALLOWED_ACE *PACCESS_ALLOWED_ACE; - -typedef struct _ACCESS_DENIED_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - ULONG SidStart; -} ACCESS_DENIED_ACE; -typedef ACCESS_DENIED_ACE *PACCESS_DENIED_ACE; - -typedef struct _SYSTEM_AUDIT_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - ULONG SidStart; -} SYSTEM_AUDIT_ACE; -typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE; - -typedef struct _SYSTEM_ALARM_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - ULONG SidStart; -} SYSTEM_ALARM_ACE; -typedef SYSTEM_ALARM_ACE *PSYSTEM_ALARM_ACE; - -typedef struct _SYSTEM_MANDATORY_LABEL_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - ULONG SidStart; -} SYSTEM_MANDATORY_LABEL_ACE, *PSYSTEM_MANDATORY_LABEL_ACE; - -#define SYSTEM_MANDATORY_LABEL_NO_WRITE_UP 0x1 -#define SYSTEM_MANDATORY_LABEL_NO_READ_UP 0x2 -#define SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP 0x4 - -#define SYSTEM_MANDATORY_LABEL_VALID_MASK (SYSTEM_MANDATORY_LABEL_NO_WRITE_UP | \ - SYSTEM_MANDATORY_LABEL_NO_READ_UP | \ - SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP) - -#define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR)) - - -typedef USHORT SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL; - -#define SE_OWNER_DEFAULTED (0x0001) -#define SE_GROUP_DEFAULTED (0x0002) -#define SE_DACL_PRESENT (0x0004) -#define SE_DACL_DEFAULTED (0x0008) -#define SE_SACL_PRESENT (0x0010) -#define SE_SACL_DEFAULTED (0x0020) -// end_winnt -#define SE_DACL_UNTRUSTED (0x0040) -#define SE_SERVER_SECURITY (0x0080) -// begin_winnt -#define SE_DACL_AUTO_INHERIT_REQ (0x0100) -#define SE_SACL_AUTO_INHERIT_REQ (0x0200) -#define SE_DACL_AUTO_INHERITED (0x0400) -#define SE_SACL_AUTO_INHERITED (0x0800) -#define SE_DACL_PROTECTED (0x1000) -#define SE_SACL_PROTECTED (0x2000) -#define SE_RM_CONTROL_VALID (0x4000) -#define SE_SELF_RELATIVE (0x8000) - -// -// Where: -// -// SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the -// SID pointed to by the Owner field was provided by a -// defaulting mechanism rather than explicitly provided by the -// original provider of the security descriptor. This may -// affect the treatment of the SID with respect to inheritence -// of an owner. -// -// SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the -// SID in the Group field was provided by a defaulting mechanism -// rather than explicitly provided by the original provider of -// the security descriptor. This may affect the treatment of -// the SID with respect to inheritence of a primary group. -// -// SE_DACL_PRESENT - This boolean flag, when set, indicates that the -// security descriptor contains a discretionary ACL. If this -// flag is set and the Dacl field of the SECURITY_DESCRIPTOR is -// null, then a null ACL is explicitly being specified. -// -// SE_DACL_DEFAULTED - This boolean flag, when set, indicates that the -// ACL pointed to by the Dacl field was provided by a defaulting -// mechanism rather than explicitly provided by the original -// provider of the security descriptor. This may affect the -// treatment of the ACL with respect to inheritence of an ACL. -// This flag is ignored if the DaclPresent flag is not set. -// -// SE_SACL_PRESENT - This boolean flag, when set, indicates that the -// security descriptor contains a system ACL pointed to by the -// Sacl field. If this flag is set and the Sacl field of the -// SECURITY_DESCRIPTOR is null, then an empty (but present) -// ACL is being specified. -// -// SE_SACL_DEFAULTED - This boolean flag, when set, indicates that the -// ACL pointed to by the Sacl field was provided by a defaulting -// mechanism rather than explicitly provided by the original -// provider of the security descriptor. This may affect the -// treatment of the ACL with respect to inheritence of an ACL. -// This flag is ignored if the SaclPresent flag is not set. -// -// end_winnt -// SE_DACL_TRUSTED - This boolean flag, when set, indicates that the -// ACL pointed to by the Dacl field was provided by a trusted source -// and does not require any editing of compound ACEs. If this flag -// is not set and a compound ACE is encountered, the system will -// substitute known valid SIDs for the server SIDs in the ACEs. -// -// SE_SERVER_SECURITY - This boolean flag, when set, indicates that the -// caller wishes the system to create a Server ACL based on the -// input ACL, regardess of its source (explicit or defaulting. -// This is done by replacing all of the GRANT ACEs with compound -// ACEs granting the current server. This flag is only -// meaningful if the subject is impersonating. -// -// begin_winnt -// SE_SELF_RELATIVE - This boolean flag, when set, indicates that the -// security descriptor is in self-relative form. In this form, -// all fields of the security descriptor are contiguous in memory -// and all pointer fields are expressed as offsets from the -// beginning of the security descriptor. This form is useful -// for treating security descriptors as opaque data structures -// for transmission in communication protocol or for storage on -// secondary media. -// -// -// -// Pictorially the structure of a security descriptor is 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 -// +---------------------------------------------------------------+ -// | Control |Reserved1 (SBZ)| Revision | -// +---------------------------------------------------------------+ -// | Owner | -// +---------------------------------------------------------------+ -// | Group | -// +---------------------------------------------------------------+ -// | Sacl | -// +---------------------------------------------------------------+ -// | Dacl | -// +---------------------------------------------------------------+ -// -// In general, this data structure should be treated opaquely to ensure future -// compatibility. -// -// - -typedef struct _SECURITY_DESCRIPTOR_RELATIVE { - UCHAR Revision; - UCHAR Sbz1; - SECURITY_DESCRIPTOR_CONTROL Control; - ULONG Owner; - ULONG Group; - ULONG Sacl; - ULONG Dacl; - } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE; - -typedef struct _SECURITY_DESCRIPTOR { - UCHAR Revision; - UCHAR Sbz1; - SECURITY_DESCRIPTOR_CONTROL Control; - PSID Owner; - PSID Group; - PACL Sacl; - PACL Dacl; - - } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR; - - - -//////////////////////////////////////////////////////////////////////// -// // -// Object Type list for AccessCheckByType // -// // -//////////////////////////////////////////////////////////////////////// - -typedef struct _OBJECT_TYPE_LIST { - USHORT Level; - USHORT Sbz; - GUID *ObjectType; -} OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST; - -// -// DS values for Level -// - -#define ACCESS_OBJECT_GUID 0 -#define ACCESS_PROPERTY_SET_GUID 1 -#define ACCESS_PROPERTY_GUID 2 - -#define ACCESS_MAX_LEVEL 4 - -// -// Parameters to NtAccessCheckByTypeAndAditAlarm -// - -typedef enum _AUDIT_EVENT_TYPE { - AuditEventObjectAccess, - AuditEventDirectoryServiceAccess -} AUDIT_EVENT_TYPE, *PAUDIT_EVENT_TYPE; - -#define AUDIT_ALLOW_NO_PRIVILEGE 0x1 - -// -// DS values for Source and ObjectTypeName -// - -#define ACCESS_DS_SOURCE_A "DS" -#define ACCESS_DS_SOURCE_W L"DS" -#define ACCESS_DS_OBJECT_TYPE_NAME_A "Directory Service Object" -#define ACCESS_DS_OBJECT_TYPE_NAME_W L"Directory Service Object" - -//////////////////////////////////////////////////////////////////////// -// // -// Privilege Related Data Structures // -// // -//////////////////////////////////////////////////////////////////////// - - - -// -// Values for different access granted\denied reasons: -// AccessReasonAceN = AccessReasonAce + N. -// AccessReasonPrivilegeN = AccessReasonPrivilege + N. -// - -#define ACCESS_REASON_TYPE_MASK 0xffff0000 -#define ACCESS_REASON_DATA_MASK 0x0000ffff - -typedef enum _ACCESS_REASON_TYPE{ - - AccessReasonNone = 0x00000000, // Indicate no reason for the bit. The bit may not be checked, or just no known reason. - - // - // The lowest 2 bytes store the index of the ACE that grant/deny this bit. - // If the corresponding access maskt is zero, then it is deny ACE; otherwise, - // it is allow ACE. - // - AccessReasonAllowedAce = 0x00010000, // Granted a permission. - AccessReasonDeniedAce = 0x00020000, // Denied a permission. - - AccessReasonAllowedParentAce = 0x00030000, // Granted a permission from parent ACE - AccessReasonDeniedParentAce = 0x00040000, // Denied a permission from parent ACE - - AccessReasonMissingPrivilege = 0x00100000, - AccessReasonFromPrivilege = 0x00200000, - - - AccessReasonIntegrityLevel = 0x00300000, - - AccessReasonOwnership = 0x00400000, - - AccessReasonNullDacl = 0x00500000, - AccessReasonEmptyDacl = 0x00600000, - - AccessReasonNoSD = 0x00700000, - AccessReasonNoGrant = 0x00800000 // this access bit is not granted by any ACE. -} ACCESS_REASON_TYPE; - - // -// Structure to hold access denied\granted reason for every bit of ACCESS_MASK. -// There are 32-bits in ACCESS_MASK and only 27-bits are actually valid on -// return from AccessCheck because MAXIMUM_ALLOWED, GENERIC_READ, -// GENERIC_WRITE, GENERIC_EXECUTE, and GENERIC_ALL are never returned. -// -// The content in Data fields depends on the Access Reason, for example, -// if the reason is AccessReasonAce, the Data will be the ACE ID. -// If there are more than one reason (more than one bit is set), the array size -// of the Data is equal to the number of bits set (or number of reasons). -// The Data could be null for a particular reason. -// - -typedef ULONG ACCESS_REASON; - -typedef struct _ACCESS_REASONS{ - ACCESS_REASON Data[32]; -} ACCESS_REASONS, *PACCESS_REASONS; - - -/* -The following data structures are defined to consolidate various falvors of -access check functions. In particular for Windows 7, the new access check -function will enable security attribute check, plus returning the reason -for a access check result. - -The new access check function based on these data structures will -form the foundation to reimplement other flavors of access check -functions. - -*/ - -// -// Structure to hold pointer to security descriptor and its unique id, which -// can be used for caching access check results. -// (NOTE NOTE) The cache key can be constructed by SecurityDescriptorId, Token and -// PrincipalSelfSid. Watch how GenericMapping affects the cache results. -// -#define SE_SECURITY_DESCRIPTOR_FLAG_NO_OWNER_ACE 0x00000001 -#define SE_SECURITY_DESCRIPTOR_FLAG_NO_LABEL_ACE 0x00000002 -#define SE_SECURITY_DESCRIPTOR_VALID_FLAGS 0x00000003 - -typedef struct _SE_SECURITY_DESCRIPTOR -{ - ULONG Size; - ULONG Flags; - PSECURITY_DESCRIPTOR SecurityDescriptor; -} SE_SECURITY_DESCRIPTOR, *PSE_SECURITY_DESCRIPTOR; - -typedef struct _SE_ACCESS_REQUEST -{ - ULONG Size; - PSE_SECURITY_DESCRIPTOR SeSecurityDescriptor; - ACCESS_MASK DesiredAccess; - ACCESS_MASK PreviouslyGrantedAccess; - PSID PrincipalSelfSid; // Need to watch how this field affects the cache. - PGENERIC_MAPPING GenericMapping; - ULONG ObjectTypeListCount; - POBJECT_TYPE_LIST ObjectTypeList; -} SE_ACCESS_REQUEST, *PSE_ACCESS_REQUEST; - - -typedef struct _SE_ACCESS_REPLY -{ - ULONG Size; - ULONG ResultListCount; // Indicate the array size of GrantedAccess and AccessStatus, it only can be either 1 or ObjectTypeListCount. - PACCESS_MASK GrantedAccess; - PNTSTATUS AccessStatus; - PACCESS_REASONS AccessReason; - PPRIVILEGE_SET* Privileges; -} SE_ACCESS_REPLY, *PSE_ACCESS_REPLY; - -// end_winnt - -typedef enum _SE_AUDIT_OPERATION -{ - AuditPrivilegeObject, - AuditPrivilegeService, - AuditAccessCheck, - AuditOpenObject, - AuditOpenObjectWithTransaction, - AuditCloseObject, - AuditDeleteObject, - AuditOpenObjectForDelete, - AuditOpenObjectForDeleteWithTransaction, - AuditCloseNonObject, - AuditOpenNonObject, - AuditObjectReference, - AuditHandleCreation, -} SE_AUDIT_OPERATION, *PSE_AUDIT_OPERATION; - - - -typedef struct _SE_AUDIT_INFO -{ - ULONG Size; - AUDIT_EVENT_TYPE AuditType; - SE_AUDIT_OPERATION AuditOperation; - ULONG AuditFlags; - UNICODE_STRING SubsystemName; - UNICODE_STRING ObjectTypeName; - UNICODE_STRING ObjectName; - PVOID HandleId; - GUID* TransactionId; - LUID* OperationId; - BOOLEAN ObjectCreation; - BOOLEAN GenerateOnClose; -} SE_AUDIT_INFO, *PSE_AUDIT_INFO; - - - -//////////////////////////////////////////////////////////////////// -// // -// Token Object Definitions // -// // -// // -//////////////////////////////////////////////////////////////////// - - -// -// Token Specific Access Rights. -// - -#define TOKEN_ASSIGN_PRIMARY (0x0001) -#define TOKEN_DUPLICATE (0x0002) -#define TOKEN_IMPERSONATE (0x0004) -#define TOKEN_QUERY (0x0008) -#define TOKEN_QUERY_SOURCE (0x0010) -#define TOKEN_ADJUST_PRIVILEGES (0x0020) -#define TOKEN_ADJUST_GROUPS (0x0040) -#define TOKEN_ADJUST_DEFAULT (0x0080) -#define TOKEN_ADJUST_SESSIONID (0x0100) - -#define TOKEN_ALL_ACCESS_P (STANDARD_RIGHTS_REQUIRED |\ - TOKEN_ASSIGN_PRIMARY |\ - TOKEN_DUPLICATE |\ - TOKEN_IMPERSONATE |\ - TOKEN_QUERY |\ - TOKEN_QUERY_SOURCE |\ - TOKEN_ADJUST_PRIVILEGES |\ - TOKEN_ADJUST_GROUPS |\ - TOKEN_ADJUST_DEFAULT ) - -#if ((defined(_WIN32_WINNT) && (_WIN32_WINNT > 0x0400)) || (!defined(_WIN32_WINNT))) -#define TOKEN_ALL_ACCESS (TOKEN_ALL_ACCESS_P |\ - TOKEN_ADJUST_SESSIONID ) -#else -#define TOKEN_ALL_ACCESS (TOKEN_ALL_ACCESS_P) -#endif - -#define TOKEN_READ (STANDARD_RIGHTS_READ |\ - TOKEN_QUERY) - - -#define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\ - TOKEN_ADJUST_PRIVILEGES |\ - TOKEN_ADJUST_GROUPS |\ - TOKEN_ADJUST_DEFAULT) - -#define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE) - -// -// -// Token Types -// - -typedef enum _TOKEN_TYPE { - TokenPrimary = 1, - TokenImpersonation - } TOKEN_TYPE; -typedef TOKEN_TYPE *PTOKEN_TYPE; - -// -// Token elevation values describe the relative strength of a given token. -// A full token is a token with all groups and privileges to which the principal -// is authorized. A limited token is one with some groups or privileges removed. -// - -typedef enum _TOKEN_ELEVATION_TYPE { - TokenElevationTypeDefault = 1, - TokenElevationTypeFull, - TokenElevationTypeLimited, -} TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE; - -// -// Token Information Classes. -// - - -typedef enum _TOKEN_INFORMATION_CLASS { - TokenUser = 1, - TokenGroups, - TokenPrivileges, - TokenOwner, - TokenPrimaryGroup, - TokenDefaultDacl, - TokenSource, - TokenType, - TokenImpersonationLevel, - TokenStatistics, - TokenRestrictedSids, - TokenSessionId, - TokenGroupsAndPrivileges, - TokenSessionReference, - TokenSandBoxInert, - TokenAuditPolicy, - TokenOrigin, - TokenElevationType, - TokenLinkedToken, - TokenElevation, - TokenHasRestrictions, - TokenAccessInformation, - TokenVirtualizationAllowed, - TokenVirtualizationEnabled, - TokenIntegrityLevel, - TokenUIAccess, - TokenMandatoryPolicy, - TokenLogonSid, - MaxTokenInfoClass // MaxTokenInfoClass should always be the last enum -} TOKEN_INFORMATION_CLASS, *PTOKEN_INFORMATION_CLASS; - -// -// Token information class structures -// - - -typedef struct _TOKEN_USER { - SID_AND_ATTRIBUTES User; -} TOKEN_USER, *PTOKEN_USER; - -typedef struct _TOKEN_GROUPS { - ULONG GroupCount; -#ifdef MIDL_PASS - [size_is(GroupCount)] SID_AND_ATTRIBUTES Groups[*]; -#else // MIDL_PASS - SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY]; -#endif // MIDL_PASS -} TOKEN_GROUPS, *PTOKEN_GROUPS; - - -typedef struct _TOKEN_PRIVILEGES { - ULONG PrivilegeCount; - LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]; -} TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES; - - -typedef struct _TOKEN_OWNER { - PSID Owner; -} TOKEN_OWNER, *PTOKEN_OWNER; - - -typedef struct _TOKEN_PRIMARY_GROUP { - PSID PrimaryGroup; -} TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP; - - -typedef struct _TOKEN_DEFAULT_DACL { - PACL DefaultDacl; -} TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL; - -typedef struct _TOKEN_GROUPS_AND_PRIVILEGES { - ULONG SidCount; - ULONG SidLength; - PSID_AND_ATTRIBUTES Sids; - ULONG RestrictedSidCount; - ULONG RestrictedSidLength; - PSID_AND_ATTRIBUTES RestrictedSids; - ULONG PrivilegeCount; - ULONG PrivilegeLength; - PLUID_AND_ATTRIBUTES Privileges; - LUID AuthenticationId; -} TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES; - -typedef struct _TOKEN_LINKED_TOKEN { - HANDLE LinkedToken; -} TOKEN_LINKED_TOKEN, *PTOKEN_LINKED_TOKEN; - -typedef struct _TOKEN_ELEVATION { - ULONG TokenIsElevated; -} TOKEN_ELEVATION, *PTOKEN_ELEVATION; - -typedef struct _TOKEN_MANDATORY_LABEL { - SID_AND_ATTRIBUTES Label; -} TOKEN_MANDATORY_LABEL, *PTOKEN_MANDATORY_LABEL; - -#define TOKEN_MANDATORY_POLICY_OFF 0x0 -#define TOKEN_MANDATORY_POLICY_NO_WRITE_UP 0x1 -#define TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN 0x2 - -#define TOKEN_MANDATORY_POLICY_VALID_MASK (TOKEN_MANDATORY_POLICY_NO_WRITE_UP | \ - TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN) - -typedef struct _TOKEN_MANDATORY_POLICY { - ULONG Policy; -} TOKEN_MANDATORY_POLICY, *PTOKEN_MANDATORY_POLICY; - -typedef struct _TOKEN_ACCESS_INFORMATION { - PSID_AND_ATTRIBUTES_HASH SidHash; - PSID_AND_ATTRIBUTES_HASH RestrictedSidHash; - PTOKEN_PRIVILEGES Privileges; - LUID AuthenticationId; - TOKEN_TYPE TokenType; - SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; - TOKEN_MANDATORY_POLICY MandatoryPolicy; - ULONG Flags; -} TOKEN_ACCESS_INFORMATION, *PTOKEN_ACCESS_INFORMATION; - -// -// Valid bits for each TOKEN_AUDIT_POLICY policy mask field. -// - -#define POLICY_AUDIT_SUBCATEGORY_COUNT (53) - -typedef struct _TOKEN_AUDIT_POLICY { - UCHAR PerUserPolicy[((POLICY_AUDIT_SUBCATEGORY_COUNT) >> 1) + 1]; -} TOKEN_AUDIT_POLICY, *PTOKEN_AUDIT_POLICY; - -#define TOKEN_SOURCE_LENGTH 8 - -typedef struct _TOKEN_SOURCE { - CHAR SourceName[TOKEN_SOURCE_LENGTH]; - LUID SourceIdentifier; -} TOKEN_SOURCE, *PTOKEN_SOURCE; - - -typedef struct _TOKEN_STATISTICS { - LUID TokenId; - LUID AuthenticationId; - LARGE_INTEGER ExpirationTime; - TOKEN_TYPE TokenType; - SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; - ULONG DynamicCharged; - ULONG DynamicAvailable; - ULONG GroupCount; - ULONG PrivilegeCount; - LUID ModifiedId; -} TOKEN_STATISTICS, *PTOKEN_STATISTICS; - - - -typedef struct _TOKEN_CONTROL { - LUID TokenId; - LUID AuthenticationId; - LUID ModifiedId; - TOKEN_SOURCE TokenSource; -} TOKEN_CONTROL, *PTOKEN_CONTROL; - -typedef struct _TOKEN_ORIGIN { - LUID OriginatingLogonSession ; -} TOKEN_ORIGIN, * PTOKEN_ORIGIN ; - - -typedef enum _MANDATORY_LEVEL { - MandatoryLevelUntrusted = 0, - MandatoryLevelLow, - MandatoryLevelMedium, - MandatoryLevelHigh, - MandatoryLevelSystem, - MandatoryLevelSecureProcess, - MandatoryLevelCount -} MANDATORY_LEVEL, *PMANDATORY_LEVEL; - - - - -// end_winnt - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtOpenThreadToken( - __in HANDLE ThreadHandle, - __in ACCESS_MASK DesiredAccess, - __in BOOLEAN OpenAsSelf, - __out PHANDLE TokenHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtOpenThreadTokenEx( - __in HANDLE ThreadHandle, - __in ACCESS_MASK DesiredAccess, - __in BOOLEAN OpenAsSelf, - __in ULONG HandleAttributes, - __out PHANDLE TokenHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtOpenProcessToken( - __in HANDLE ProcessHandle, - __in ACCESS_MASK DesiredAccess, - __out PHANDLE TokenHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtOpenProcessTokenEx( - __in HANDLE ProcessHandle, - __in ACCESS_MASK DesiredAccess, - __in ULONG HandleAttributes, - __out PHANDLE TokenHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -NtOpenJobObjectToken( - __in HANDLE JobHandle, - __in ACCESS_MASK DesiredAccess, - __out PHANDLE TokenHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtDuplicateToken( - __in HANDLE ExistingTokenHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in BOOLEAN EffectiveOnly, - __in TOKEN_TYPE TokenType, - __out PHANDLE NewTokenHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtFilterToken ( - __in HANDLE ExistingTokenHandle, - __in ULONG Flags, - __in_opt PTOKEN_GROUPS SidsToDisable, - __in_opt PTOKEN_PRIVILEGES PrivilegesToDelete, - __in_opt PTOKEN_GROUPS RestrictedSids, - __out PHANDLE NewTokenHandle - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtImpersonateAnonymousToken( - __in HANDLE ThreadHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtQueryInformationToken ( - __in HANDLE TokenHandle, - __in TOKEN_INFORMATION_CLASS TokenInformationClass, - __out_bcount_part_opt(TokenInformationLength, *ReturnLength) PVOID TokenInformation, - __in ULONG TokenInformationLength, - __out PULONG ReturnLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtSetInformationToken ( - __in HANDLE TokenHandle, - __in TOKEN_INFORMATION_CLASS TokenInformationClass, - __in_bcount(TokenInformationLength) PVOID TokenInformation, - __in ULONG TokenInformationLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtAdjustPrivilegesToken ( - __in HANDLE TokenHandle, - __in BOOLEAN DisableAllPrivileges, - __in_opt PTOKEN_PRIVILEGES NewState, - __in ULONG BufferLength, - __out_bcount_part_opt(BufferLength, *ReturnLength) PTOKEN_PRIVILEGES PreviousState, - __out __drv_when(PreviousState == NULL, __out_opt) PULONG ReturnLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtAdjustGroupsToken ( - __in HANDLE TokenHandle, - __in BOOLEAN ResetToDefault, - __in_opt PTOKEN_GROUPS NewState, - __in_opt ULONG BufferLength, - __out_bcount_part_opt(BufferLength, *ReturnLength) PTOKEN_GROUPS PreviousState, - __out PULONG ReturnLength - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtPrivilegeCheck ( - __in HANDLE ClientToken, - __inout PPRIVILEGE_SET RequiredPrivileges, - __out PBOOLEAN Result - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtAccessCheckAndAuditAlarm ( - __in PUNICODE_STRING SubsystemName, - __in_opt PVOID HandleId, - __in PUNICODE_STRING ObjectTypeName, - __in PUNICODE_STRING ObjectName, - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in ACCESS_MASK DesiredAccess, - __in PGENERIC_MAPPING GenericMapping, - __in BOOLEAN ObjectCreation, - __out PACCESS_MASK GrantedAccess, - __out PNTSTATUS AccessStatus, - __out PBOOLEAN GenerateOnClose - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtAccessCheckByTypeAndAuditAlarm ( - __in PUNICODE_STRING SubsystemName, - __in_opt PVOID HandleId, - __in PUNICODE_STRING ObjectTypeName, - __in PUNICODE_STRING ObjectName, - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in_opt PSID PrincipalSelfSid, - __in ACCESS_MASK DesiredAccess, - __in AUDIT_EVENT_TYPE AuditType, - __in ULONG Flags, - __in_ecount_opt(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList, - __in ULONG ObjectTypeListLength, - __in PGENERIC_MAPPING GenericMapping, - __in BOOLEAN ObjectCreation, - __out PACCESS_MASK GrantedAccess, - __out PNTSTATUS AccessStatus, - __out PBOOLEAN GenerateOnClose - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtAccessCheckByTypeResultListAndAuditAlarm ( - __in PUNICODE_STRING SubsystemName, - __in_opt PVOID HandleId, - __in PUNICODE_STRING ObjectTypeName, - __in PUNICODE_STRING ObjectName, - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in_opt PSID PrincipalSelfSid, - __in ACCESS_MASK DesiredAccess, - __in AUDIT_EVENT_TYPE AuditType, - __in ULONG Flags, - __in_ecount_opt(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList, - __in ULONG ObjectTypeListLength, - __in PGENERIC_MAPPING GenericMapping, - __in BOOLEAN ObjectCreation, - __out_ecount(ObjectTypeListLength) PACCESS_MASK GrantedAccess, - __out_ecount(ObjectTypeListLength) PNTSTATUS AccessStatus, - __out PBOOLEAN GenerateOnClose - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtAccessCheckByTypeResultListAndAuditAlarmByHandle ( - __in PUNICODE_STRING SubsystemName, - __in_opt PVOID HandleId, - __in HANDLE ClientToken, - __in PUNICODE_STRING ObjectTypeName, - __in PUNICODE_STRING ObjectName, - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in_opt PSID PrincipalSelfSid, - __in ACCESS_MASK DesiredAccess, - __in AUDIT_EVENT_TYPE AuditType, - __in ULONG Flags, - __in_ecount_opt(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList, - __in ULONG ObjectTypeListLength, - __in PGENERIC_MAPPING GenericMapping, - __in BOOLEAN ObjectCreation, - __out_ecount(ObjectTypeListLength) PACCESS_MASK GrantedAccess, - __out_ecount(ObjectTypeListLength) PNTSTATUS AccessStatus, - __out PBOOLEAN GenerateOnClose - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtOpenObjectAuditAlarm ( - __in PUNICODE_STRING SubsystemName, - __in_opt PVOID HandleId, - __in PUNICODE_STRING ObjectTypeName, - __in PUNICODE_STRING ObjectName, - __in_opt PSECURITY_DESCRIPTOR SecurityDescriptor, - __in HANDLE ClientToken, - __in ACCESS_MASK DesiredAccess, - __in ACCESS_MASK GrantedAccess, - __in_opt PPRIVILEGE_SET Privileges, - __in BOOLEAN ObjectCreation, - __in BOOLEAN AccessGranted, - __out PBOOLEAN GenerateOnClose - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtPrivilegeObjectAuditAlarm ( - __in PUNICODE_STRING SubsystemName, - __in_opt PVOID HandleId, - __in HANDLE ClientToken, - __in ACCESS_MASK DesiredAccess, - __in PPRIVILEGE_SET Privileges, - __in BOOLEAN AccessGranted - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtCloseObjectAuditAlarm ( - __in PUNICODE_STRING SubsystemName, - __in_opt PVOID HandleId, - __in BOOLEAN GenerateOnClose - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtDeleteObjectAuditAlarm ( - __in PUNICODE_STRING SubsystemName, - __in_opt PVOID HandleId, - __in BOOLEAN GenerateOnClose - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtPrivilegedServiceAuditAlarm ( - __in PUNICODE_STRING SubsystemName, - __in PUNICODE_STRING ServiceName, - __in HANDLE ClientToken, - __in PPRIVILEGE_SET Privileges, - __in BOOLEAN AccessGranted - ); -#endif - - -typedef -__drv_functionClass(RTL_HEAP_COMMIT_ROUTINE) -__drv_sameIRQL -NTSTATUS -NTAPI -RTL_HEAP_COMMIT_ROUTINE( - __in PVOID Base, - __inout PVOID *CommitAddress, - __inout PSIZE_T CommitSize - ); -typedef RTL_HEAP_COMMIT_ROUTINE *PRTL_HEAP_COMMIT_ROUTINE; - -typedef struct _RTL_HEAP_PARAMETERS { - ULONG Length; - SIZE_T SegmentReserve; - SIZE_T SegmentCommit; - SIZE_T DeCommitFreeBlockThreshold; - SIZE_T DeCommitTotalFreeThreshold; - SIZE_T MaximumAllocationSize; - SIZE_T VirtualMemoryThreshold; - SIZE_T InitialCommit; - SIZE_T InitialReserve; - PRTL_HEAP_COMMIT_ROUTINE CommitRoutine; - SIZE_T Reserved[ 2 ]; -} RTL_HEAP_PARAMETERS, *PRTL_HEAP_PARAMETERS; - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -NTSYSAPI -PVOID -NTAPI -RtlCreateHeap( - __in ULONG Flags, - __in_opt PVOID HeapBase, - __in_opt SIZE_T ReserveSize, - __in_opt SIZE_T CommitSize, - __in_opt PVOID Lock, - __in_opt PRTL_HEAP_PARAMETERS Parameters - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - - -#define HEAP_NO_SERIALIZE 0x00000001 // winnt -#define HEAP_GROWABLE 0x00000002 // winnt -#define HEAP_GENERATE_EXCEPTIONS 0x00000004 // winnt -#define HEAP_ZERO_MEMORY 0x00000008 // winnt -#define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010 // winnt -#define HEAP_TAIL_CHECKING_ENABLED 0x00000020 // winnt -#define HEAP_FREE_CHECKING_ENABLED 0x00000040 // winnt -#define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080 // winnt - -#define HEAP_CREATE_ALIGN_16 0x00010000 // winnt Create heap with 16 byte alignment (obsolete) -#define HEAP_CREATE_ENABLE_TRACING 0x00020000 // winnt Create heap call tracing enabled (obsolete) -#define HEAP_CREATE_ENABLE_EXECUTE 0x00040000 // winnt Create heap with executable pages - -#define HEAP_SETTABLE_USER_VALUE 0x00000100 -#define HEAP_SETTABLE_USER_FLAG1 0x00000200 -#define HEAP_SETTABLE_USER_FLAG2 0x00000400 -#define HEAP_SETTABLE_USER_FLAG3 0x00000800 -#define HEAP_SETTABLE_USER_FLAGS 0x00000E00 - -#define HEAP_CLASS_0 0x00000000 // process heap -#define HEAP_CLASS_1 0x00001000 // private heap -#define HEAP_CLASS_2 0x00002000 // Kernel Heap -#define HEAP_CLASS_3 0x00003000 // GDI heap -#define HEAP_CLASS_4 0x00004000 // User heap -#define HEAP_CLASS_5 0x00005000 // Console heap -#define HEAP_CLASS_6 0x00006000 // User Desktop heap -#define HEAP_CLASS_7 0x00007000 // Csrss Shared heap -#define HEAP_CLASS_8 0x00008000 // Csr Port heap -#define HEAP_CLASS_MASK 0x0000F000 - -#define HEAP_MAXIMUM_TAG 0x0FFF // winnt -#define HEAP_GLOBAL_TAG 0x0800 -#define HEAP_PSEUDO_TAG_FLAG 0x8000 // winnt -#define HEAP_TAG_SHIFT 18 // winnt -#define HEAP_TAG_MASK (HEAP_MAXIMUM_TAG << HEAP_TAG_SHIFT) - -#define HEAP_CREATE_VALID_MASK (HEAP_NO_SERIALIZE | \ - HEAP_GROWABLE | \ - HEAP_GENERATE_EXCEPTIONS | \ - HEAP_ZERO_MEMORY | \ - HEAP_REALLOC_IN_PLACE_ONLY | \ - HEAP_TAIL_CHECKING_ENABLED | \ - HEAP_FREE_CHECKING_ENABLED | \ - HEAP_DISABLE_COALESCE_ON_FREE | \ - HEAP_CLASS_MASK | \ - HEAP_CREATE_ALIGN_16 | \ - HEAP_CREATE_ENABLE_TRACING | \ - HEAP_CREATE_ENABLE_EXECUTE) - -// begin_winnt -#if !defined(MIDL_PASS) -FORCEINLINE -ULONG -HEAP_MAKE_TAG_FLAGS ( - __in ULONG TagBase, - __in ULONG Tag - ) - -{ - __assume_bound(TagBase); - return ((ULONG)((TagBase) + ((Tag) << HEAP_TAG_SHIFT))); -} -#endif -// end_winnt - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -PVOID -NTAPI -RtlDestroyHeap( - __in __post_invalid PVOID HeapHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -__checkReturn -__bcount_opt(Size) __allocator -PVOID -NTAPI -RtlAllocateHeap( - __in PVOID HeapHandle, - __in_opt ULONG Flags, - __in SIZE_T Size - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__success(return != 0) -NTSYSAPI -BOOLEAN -NTAPI -RtlFreeHeap( - __in PVOID HeapHandle, - __in_opt ULONG Flags, - __in __post_invalid PVOID BaseAddress - ); -#endif // NTDDI_VERSION >= NTDDI_WIN2K - - - -#if (NTDDI_VERSION > NTDDI_WINXP) -NTSYSAPI -USHORT -NTAPI -RtlCaptureStackBackTrace( - __in ULONG FramesToSkip, - __in ULONG FramesToCapture, - __out_ecount(FramesToCapture) PVOID *BackTrace, - __out_opt PULONG BackTraceHash - ); -#endif - -#if (NTDDI_VERSION > NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlCaptureContext ( - __out PCONTEXT ContextRecord - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__range(<, MAXLONG) -NTSYSAPI -ULONG -NTAPI -RtlRandom ( - __inout PULONG Seed - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__range(<, MAXLONG) -NTSYSAPI -ULONG -NTAPI -RtlRandomEx ( - __inout PULONG Seed - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(DISPATCH_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlInitUnicodeStringEx( - __out PUNICODE_STRING DestinationString, - __in_z_opt __drv_aliasesMem PCWSTR SourceString - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(DISPATCH_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlInitAnsiStringEx( - __out PANSI_STRING DestinationString, - __in_z_opt __drv_aliasesMem PCSZ SourceString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -__success(return != 0) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlCreateUnicodeString( - __out __drv_at(DestinationString->Buffer, __drv_allocatesMem(Mem)) - PUNICODE_STRING DestinationString, - __in_z PCWSTR SourceString - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlAppendStringToString ( - __inout PSTRING Destination, - __in const STRING * Source - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlOemStringToUnicodeString( - __drv_when(AllocateDestinationString, __out __drv_at(DestinationString->Buffer, __drv_allocatesMem(Mem))) - __drv_when(!AllocateDestinationString, __inout) - PUNICODE_STRING DestinationString, - __in PCOEM_STRING SourceString, - __in BOOLEAN AllocateDestinationString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlUnicodeStringToOemString( - __drv_when(AllocateDestinationString, __out __drv_at(DestinationString->Buffer, __drv_allocatesMem(Mem))) - __drv_when(!AllocateDestinationString, __inout) - POEM_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in BOOLEAN AllocateDestinationString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlUpcaseUnicodeStringToOemString( - __drv_when(AllocateDestinationString, __out __drv_at(DestinationString->Buffer, __drv_allocatesMem(Mem))) - __drv_when(!AllocateDestinationString, __inout) - POEM_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in BOOLEAN AllocateDestinationString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlOemStringToCountedUnicodeString( - __drv_when(AllocateDestinationString, __out __drv_at(DestinationString->Buffer, __drv_allocatesMem(Mem))) - __drv_when(!AllocateDestinationString, __inout) - PUNICODE_STRING DestinationString, - __in PCOEM_STRING SourceString, - __in BOOLEAN AllocateDestinationString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlUnicodeStringToCountedOemString( - __drv_when(AllocateDestinationString, __out __drv_at(DestinationString->Buffer, __drv_allocatesMem(Mem))) - __drv_when(!AllocateDestinationString, __inout) - POEM_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in BOOLEAN AllocateDestinationString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlUpcaseUnicodeStringToCountedOemString( - __drv_when(AllocateDestinationString, __out __drv_at(DestinationString->Buffer, __drv_allocatesMem(Mem))) - __drv_when(!AllocateDestinationString, __inout) - POEM_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in BOOLEAN AllocateDestinationString - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlValidateUnicodeString( - __in __reserved ULONG Flags, - __in PCUNICODE_STRING String - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - - -#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE (0x00000001) -#define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING (0x00000002) - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlDuplicateUnicodeString( - __in ULONG Flags, - __in PCUNICODE_STRING StringIn, - __out __drv_at(StringOut->Buffer, __drv_allocatesMem(Mem)) - PUNICODE_STRING StringOut - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when(AllocateDestinationString, __checkReturn) -NTSYSAPI -NTSTATUS -NTAPI -RtlDowncaseUnicodeString( - __drv_when(AllocateDestinationString, __out __drv_at(DestinationString->Buffer, __drv_allocatesMem(Mem))) - __drv_when(!AllocateDestinationString, __inout) - PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in BOOLEAN AllocateDestinationString - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlFreeOemString( - __inout __drv_at(OemString->Buffer, __drv_freesMem(Mem)) - POEM_STRING OemString - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -ULONG -NTAPI -RtlxUnicodeStringToOemSize( - __in PCUNICODE_STRING UnicodeString - ); -#endif - -// -// NTSYSAPI -// ULONG -// NTAPI -// RtlUnicodeStringToOemSize( -// PUNICODE_STRING UnicodeString -// ); -// - -#define RtlUnicodeStringToOemSize(STRING) ( \ - NLS_MB_OEM_CODE_PAGE_TAG ? \ - RtlxUnicodeStringToOemSize(STRING) : \ - ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \ -) - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -ULONG -NTAPI -RtlxOemStringToUnicodeSize( - __in PCOEM_STRING OemString - ); -#endif - -// -// NTSYSAPI -// ULONG -// NTAPI -// RtlOemStringToUnicodeSize( -// POEM_STRING OemString -// ); -// - -#define RtlOemStringToUnicodeSize(STRING) ( \ - NLS_MB_OEM_CODE_PAGE_TAG ? \ - RtlxOemStringToUnicodeSize(STRING) : \ - ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \ -) - -// -// ULONG -// RtlOemStringToCountedUnicodeSize( -// POEM_STRING OemString -// ); -// - -#define RtlOemStringToCountedUnicodeSize(STRING) ( \ - (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \ - ) - -// Use Unicode if possible -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlMultiByteToUnicodeN( - __out_bcount_part(MaxBytesInUnicodeString, *BytesInUnicodeString) PWCH UnicodeString, - __in ULONG MaxBytesInUnicodeString, - __out_opt PULONG BytesInUnicodeString, - __in_bcount(BytesInMultiByteString) const CHAR *MultiByteString, - __in ULONG BytesInMultiByteString - ); -#endif - -// Use Unicode if possible -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlMultiByteToUnicodeSize( - __out PULONG BytesInUnicodeString, - __in_bcount(BytesInMultiByteString) const CHAR *MultiByteString, - __in ULONG BytesInMultiByteString - ); -#endif - -// Use Unicode if possible -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlUnicodeToMultiByteSize( - __out PULONG BytesInMultiByteString, - __in_bcount(BytesInUnicodeString) PCWCH UnicodeString, - __in ULONG BytesInUnicodeString - ); -#endif - -// Use Unicode if possible -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlUnicodeToMultiByteN( - __out_bcount_part(MaxBytesInMultiByteString, *BytesInMultiByteString) PCHAR MultiByteString, - __in ULONG MaxBytesInMultiByteString, - __out_opt PULONG BytesInMultiByteString, - __in_bcount(BytesInUnicodeString) PCWCH UnicodeString, - __in ULONG BytesInUnicodeString - ); -#endif - -// UTF 8 conversion - -// begin_wdm -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlUnicodeToUTF8N( - __out_bcount_part(UTF8StringMaxByteCount, *UTF8StringActualByteCount) PCHAR UTF8StringDestination, - __in ULONG UTF8StringMaxByteCount, - __out PULONG UTF8StringActualByteCount, - __in_bcount(UnicodeStringByteCount) PCWCH UnicodeStringSource, - __in ULONG UnicodeStringByteCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlUTF8ToUnicodeN( - __out_bcount_part(UnicodeStringMaxByteCount, *UnicodeStringActualByteCount) PWSTR UnicodeStringDestination, - __in ULONG UnicodeStringMaxByteCount, - __out PULONG UnicodeStringActualByteCount, - __in_bcount(UTF8StringByteCount) PCCH UTF8StringSource, - __in ULONG UTF8StringByteCount - ); -#endif -// end_wdm - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlUpcaseUnicodeToMultiByteN( - __out_bcount_part(MaxBytesInMultiByteString, *BytesInMultiByteString) PCHAR MultiByteString, - __in ULONG MaxBytesInMultiByteString, - __out_opt PULONG BytesInMultiByteString, - __in_bcount(BytesInUnicodeString) PCWCH UnicodeString, - __in ULONG BytesInUnicodeString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlOemToUnicodeN( - __out_bcount_part(MaxBytesInUnicodeString, *BytesInUnicodeString) PWCH UnicodeString, - __in ULONG MaxBytesInUnicodeString, - __out_opt PULONG BytesInUnicodeString, - __in_bcount(BytesInOemString) PCCH OemString, - __in ULONG BytesInOemString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlUnicodeToOemN( - __out_bcount_part(MaxBytesInOemString, *BytesInOemString) PCHAR OemString, - __in ULONG MaxBytesInOemString, - __out_opt PULONG BytesInOemString, - __in_bcount(BytesInUnicodeString) PCWCH UnicodeString, - __in ULONG BytesInUnicodeString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlUpcaseUnicodeToOemN( - __out_bcount_part(MaxBytesInOemString, *BytesInOemString) PCHAR OemString, - __in ULONG MaxBytesInOemString, - __out_opt PULONG BytesInOemString, - __in_bcount(BytesInUnicodeString) PCWCH UnicodeString, - __in ULONG BytesInUnicodeString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -NTSTATUS -NTAPI -RtlNormalizeString( - __in ULONG NormForm, - __in PCWSTR SourceString, - __in LONG SourceStringLength, - __out_ecount_part(*DestinationStringLength, *DestinationStringLength) PWSTR DestinationString, - __inout PLONG DestinationStringLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -NTSTATUS -NTAPI -RtlIsNormalizedString( - __in ULONG NormForm, - __in PCWSTR SourceString, - __in LONG SourceStringLength, - __out PBOOLEAN Normalized - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -NTSTATUS -NTAPI -RtlIdnToAscii( - __in ULONG Flags, - __in PCWSTR SourceString, - __in LONG SourceStringLength, - __out_ecount_part(*DestinationStringLength, *DestinationStringLength) PWSTR DestinationString, - __inout PLONG DestinationStringLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -NTSTATUS -NTAPI -RtlIdnToUnicode( - __in ULONG Flags, - __in PCWSTR SourceString, - __in LONG SourceStringLength, - __out_ecount_part(*DestinationStringLength, *DestinationStringLength) PWSTR DestinationString, - __inout PLONG DestinationStringLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -NTSTATUS -NTAPI -RtlIdnToNameprepUnicode( - __in ULONG Flags, - __in PCWSTR SourceString, - __in LONG SourceStringLength, - __out_ecount_part(*DestinationStringLength, *DestinationStringLength) PWSTR DestinationString, - __inout PLONG DestinationStringLength - ); -#endif - - -typedef -__drv_functionClass(RTL_ALLOCATE_STRING_ROUTINE) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_allocatesMem(Mem) -PVOID -NTAPI -RTL_ALLOCATE_STRING_ROUTINE ( - __in SIZE_T NumberOfBytes - ); -typedef RTL_ALLOCATE_STRING_ROUTINE *PRTL_ALLOCATE_STRING_ROUTINE; - -#if _WIN32_WINNT >= 0x0600 - -typedef -__drv_functionClass(RTL_REALLOCATE_STRING_ROUTINE) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_allocatesMem(Mem) -PVOID -NTAPI -RTL_REALLOCATE_STRING_ROUTINE( - __in SIZE_T NumberOfBytes, - __in __drv_freesMem(Mem) __post_invalid PVOID Buffer - ); -typedef RTL_REALLOCATE_STRING_ROUTINE *PRTL_REALLOCATE_STRING_ROUTINE; - -#endif // _WIN32_WINNT >= 0x0600 - -typedef -__drv_functionClass(RTL_FREE_STRING_ROUTINE) -__drv_maxIRQL(PASSIVE_LEVEL) -VOID -NTAPI -RTL_FREE_STRING_ROUTINE ( - __in __drv_freesMem(Mem) __post_invalid PVOID Buffer - ); -typedef RTL_FREE_STRING_ROUTINE *PRTL_FREE_STRING_ROUTINE; - -extern const PRTL_ALLOCATE_STRING_ROUTINE RtlAllocateStringRoutine; -extern const PRTL_FREE_STRING_ROUTINE RtlFreeStringRoutine; - -#if _WIN32_WINNT >= 0x0600 -extern const PRTL_REALLOCATE_STRING_ROUTINE RtlReallocateStringRoutine; -#endif // _WIN32_WINNT >= 0x0600 - -// -// Defines and Routines for handling GUID's. -// - -// -// Routine for generating 8.3 names from long names. -// - -// -// The context structure is used when generating 8.3 names. The caller must -// always zero out the structure before starting a new generation sequence -// - -typedef struct _GENERATE_NAME_CONTEXT { - - // - // The structure is divided into two strings. The Name, and extension. - // Each part contains the value that was last inserted in the name. - // The length values are in terms of wchars and not bytes. We also - // store the last index value used in the generation collision algorithm. - // - - USHORT Checksum; - BOOLEAN ChecksumInserted; - - __field_range(<=, 8) UCHAR NameLength; // not including extension - WCHAR NameBuffer[8]; // e.g., "ntoskrnl" - - __field_range(<=, 4) ULONG ExtensionLength; // including dot - WCHAR ExtensionBuffer[4]; // e.g., ".exe" - - ULONG LastIndexValue; - -} GENERATE_NAME_CONTEXT; -typedef GENERATE_NAME_CONTEXT *PGENERATE_NAME_CONTEXT; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_VISTASP1) -// -// In Vista SP1 and beyond this routine now returns -// STATUS_FILE_SYSTEM_LIMITATION if the system can not generate a unique -// shortname for a given file. It returns this error after 1 million retry -// attempts for a single given longname. -// - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlGenerate8dot3Name ( - __in PCUNICODE_STRING Name, - __in BOOLEAN AllowExtendedCharacters, - __inout PGENERATE_NAME_CONTEXT Context, - __inout PUNICODE_STRING Name8dot3 - ); -#else // (NTDDI_VERSION < NTDDI_VISTASP1) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlGenerate8dot3Name ( - __in PCUNICODE_STRING Name, - __in BOOLEAN AllowExtendedCharacters, - __inout PGENERATE_NAME_CONTEXT Context, - __inout PUNICODE_STRING Name8dot3 - ); -#endif -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlIsNameLegalDOS8Dot3 ( - __in PCUNICODE_STRING Name, - __inout_opt POEM_STRING OemName, - __out_opt PBOOLEAN NameContainsSpaces - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlIsValidOemCharacter ( - __inout PWCHAR Char - ); -#endif - -// -// Prefix package types and procedures. -// -// Note that the following two record structures should really be opaque -// to the user of this package. The only information about the two -// structures available for the user should be the size and alignment -// of the structures. -// - -typedef struct _PREFIX_TABLE_ENTRY { - CSHORT NodeTypeCode; - CSHORT NameLength; - struct _PREFIX_TABLE_ENTRY *NextPrefixTree; - RTL_SPLAY_LINKS Links; - PSTRING Prefix; -} PREFIX_TABLE_ENTRY; -typedef PREFIX_TABLE_ENTRY *PPREFIX_TABLE_ENTRY; - -typedef struct _PREFIX_TABLE { - CSHORT NodeTypeCode; - CSHORT NameLength; - PPREFIX_TABLE_ENTRY NextPrefixTree; -} PREFIX_TABLE; -typedef PREFIX_TABLE *PPREFIX_TABLE; - -// -// The procedure prototypes for the prefix package -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -VOID -NTAPI -PfxInitialize ( - __out PPREFIX_TABLE PrefixTable - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -BOOLEAN -NTAPI -PfxInsertPrefix ( - __in PPREFIX_TABLE PrefixTable, - __in __drv_aliasesMem PSTRING Prefix, - __out PPREFIX_TABLE_ENTRY PrefixTableEntry - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -VOID -NTAPI -PfxRemovePrefix ( - __in PPREFIX_TABLE PrefixTable, - __in PPREFIX_TABLE_ENTRY PrefixTableEntry - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -PPREFIX_TABLE_ENTRY -NTAPI -PfxFindPrefix ( - __in PPREFIX_TABLE PrefixTable, - __in PSTRING FullName - ); -#endif - -// -// The following definitions are for the unicode version of the prefix -// package. -// - -typedef struct _UNICODE_PREFIX_TABLE_ENTRY { - CSHORT NodeTypeCode; - CSHORT NameLength; - struct _UNICODE_PREFIX_TABLE_ENTRY *NextPrefixTree; - struct _UNICODE_PREFIX_TABLE_ENTRY *CaseMatch; - RTL_SPLAY_LINKS Links; - PUNICODE_STRING Prefix; -} UNICODE_PREFIX_TABLE_ENTRY; -typedef UNICODE_PREFIX_TABLE_ENTRY *PUNICODE_PREFIX_TABLE_ENTRY; - -typedef struct _UNICODE_PREFIX_TABLE { - CSHORT NodeTypeCode; - CSHORT NameLength; - PUNICODE_PREFIX_TABLE_ENTRY NextPrefixTree; - PUNICODE_PREFIX_TABLE_ENTRY LastNextEntry; -} UNICODE_PREFIX_TABLE; -typedef UNICODE_PREFIX_TABLE *PUNICODE_PREFIX_TABLE; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlInitializeUnicodePrefix ( - __out PUNICODE_PREFIX_TABLE PrefixTable - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -BOOLEAN -NTAPI -RtlInsertUnicodePrefix ( - __in PUNICODE_PREFIX_TABLE PrefixTable, - __in __drv_aliasesMem PUNICODE_STRING Prefix, - __out PUNICODE_PREFIX_TABLE_ENTRY PrefixTableEntry - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlRemoveUnicodePrefix ( - __in PUNICODE_PREFIX_TABLE PrefixTable, - __in PUNICODE_PREFIX_TABLE_ENTRY PrefixTableEntry - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -PUNICODE_PREFIX_TABLE_ENTRY -NTAPI -RtlFindUnicodePrefix ( - __in PUNICODE_PREFIX_TABLE PrefixTable, - __in PCUNICODE_STRING FullName, - __in ULONG CaseInsensitiveIndex - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -PUNICODE_PREFIX_TABLE_ENTRY -NTAPI -RtlNextUnicodePrefix ( - __in PUNICODE_PREFIX_TABLE PrefixTable, - __in BOOLEAN Restart - ); -#endif - -// -// -// Compression package types and procedures. -// - -#define COMPRESSION_FORMAT_NONE (0x0000) // winnt -#define COMPRESSION_FORMAT_DEFAULT (0x0001) // winnt -#define COMPRESSION_FORMAT_LZNT1 (0x0002) // winnt - -#define COMPRESSION_ENGINE_STANDARD (0x0000) // winnt -#define COMPRESSION_ENGINE_MAXIMUM (0x0100) // winnt -#define COMPRESSION_ENGINE_HIBER (0x0200) // winnt - -// -// Compressed Data Information structure. This structure is -// used to describe the state of a compressed data buffer, -// whose uncompressed size is known. All compressed chunks -// described by this structure must be compressed with the -// same format. On compressed reads, this entire structure -// is an output, and on compressed writes the entire structure -// is an input. -// - -typedef struct _COMPRESSED_DATA_INFO { - - // - // Code for the compression format (and engine) as - // defined in ntrtl.h. Note that COMPRESSION_FORMAT_NONE - // and COMPRESSION_FORMAT_DEFAULT are invalid if - // any of the described chunks are compressed. - // - - USHORT CompressionFormatAndEngine; - - // - // Since chunks and compression units are expected to be - // powers of 2 in size, we express then log2. So, for - // example (1 << ChunkShift) == ChunkSizeInBytes. The - // ClusterShift indicates how much space must be saved - // to successfully compress a compression unit - each - // successfully compressed compression unit must occupy - // at least one cluster less in bytes than an uncompressed - // compression unit. - // - - UCHAR CompressionUnitShift; - UCHAR ChunkShift; - UCHAR ClusterShift; - UCHAR Reserved; - - // - // This is the number of entries in the CompressedChunkSizes - // array. - // - - USHORT NumberOfChunks; - - // - // This is an array of the sizes of all chunks resident - // in the compressed data buffer. There must be one entry - // in this array for each chunk possible in the uncompressed - // buffer size. A size of FSRTL_CHUNK_SIZE indicates the - // corresponding chunk is uncompressed and occupies exactly - // that size. A size of 0 indicates that the corresponding - // chunk contains nothing but binary 0's, and occupies no - // space in the compressed data. All other sizes must be - // less than FSRTL_CHUNK_SIZE, and indicate the exact size - // of the compressed data in bytes. - // - - ULONG CompressedChunkSizes[ANYSIZE_ARRAY]; - -} COMPRESSED_DATA_INFO; -typedef COMPRESSED_DATA_INFO *PCOMPRESSED_DATA_INFO; - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -NTSTATUS -NTAPI -RtlGetCompressionWorkSpaceSize ( - __in USHORT CompressionFormatAndEngine, - __out PULONG CompressBufferWorkSpaceSize, - __out PULONG CompressFragmentWorkSpaceSize - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -NTSTATUS -NTAPI -RtlCompressBuffer ( - __in USHORT CompressionFormatAndEngine, - __in_bcount(UncompressedBufferSize) PUCHAR UncompressedBuffer, - __in ULONG UncompressedBufferSize, - __out_bcount_part(CompressedBufferSize, *FinalCompressedSize) PUCHAR CompressedBuffer, - __in ULONG CompressedBufferSize, - __in ULONG UncompressedChunkSize, - __out PULONG FinalCompressedSize, - __in PVOID WorkSpace - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlDecompressBuffer ( - __in USHORT CompressionFormat, - __out_bcount_part(UncompressedBufferSize, *FinalUncompressedSize) PUCHAR UncompressedBuffer, - __in ULONG UncompressedBufferSize, - __in_bcount(CompressedBufferSize) PUCHAR CompressedBuffer, - __in ULONG CompressedBufferSize, - __out PULONG FinalUncompressedSize - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlDecompressFragment ( - __in USHORT CompressionFormat, - __out_bcount_part(UncompressedFragmentSize, *FinalUncompressedSize) PUCHAR UncompressedFragment, - __in ULONG UncompressedFragmentSize, - __in_bcount(CompressedBufferSize) PUCHAR CompressedBuffer, - __in ULONG CompressedBufferSize, - __in_range(<, CompressedBufferSize) ULONG FragmentOffset, - __out PULONG FinalUncompressedSize, - __in PVOID WorkSpace - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlDescribeChunk ( - __in USHORT CompressionFormat, - __inout PUCHAR *CompressedBuffer, - __in PUCHAR EndOfCompressedBufferPlus1, - __out PUCHAR *ChunkBuffer, - __out PULONG ChunkSize - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlReserveChunk ( - __in USHORT CompressionFormat, - __inout PUCHAR *CompressedBuffer, - __in PUCHAR EndOfCompressedBufferPlus1, - __out PUCHAR *ChunkBuffer, - __in ULONG ChunkSize - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlDecompressChunks ( - __out_bcount(UncompressedBufferSize) PUCHAR UncompressedBuffer, - __in ULONG UncompressedBufferSize, - __in_bcount(CompressedBufferSize) PUCHAR CompressedBuffer, - __in ULONG CompressedBufferSize, - __in_bcount(CompressedTailSize) PUCHAR CompressedTail, - __in ULONG CompressedTailSize, - __in PCOMPRESSED_DATA_INFO CompressedDataInfo - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlCompressChunks ( - __in_bcount(UncompressedBufferSize) PUCHAR UncompressedBuffer, - __in ULONG UncompressedBufferSize, - __out_bcount(CompressedBufferSize) PUCHAR CompressedBuffer, - __in_range(>=, (UncompressedBufferSize - (UncompressedBufferSize / 16))) ULONG CompressedBufferSize, - __inout_bcount(CompressedDataInfoLength) PCOMPRESSED_DATA_INFO CompressedDataInfo, - __in_range(>, sizeof(COMPRESSED_DATA_INFO)) ULONG CompressedDataInfoLength, - __in PVOID WorkSpace - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -SIZE_T -NTAPI -RtlCompareMemoryUlong ( - __in_bcount(Length) PVOID Source, - __in SIZE_T Length, - __in ULONG Pattern - ); - -#endif - -#if defined(_M_AMD64) - -#if !defined(MIDL_PASS) - -FORCEINLINE -VOID -RtlFillMemoryUlong ( - __out_bcount_full(Length) PVOID Destination, - __in SIZE_T Length, - __in ULONG Pattern - ) - -{ - - PULONG Address = (PULONG)Destination; - - // - // If the number of DWORDs is not zero, then fill the specified buffer - // with the specified pattern. - // - - if ((Length /= 4) != 0) { - - // - // If the destination is not quadword aligned (ignoring low bits), - // then align the destination by storing one DWORD. - // - - if (((ULONG64)Address & 4) != 0) { - *Address = Pattern; - if ((Length -= 1) == 0) { - return; - } - - Address += 1; - } - - // - // If the number of QWORDs is not zero, then fill the destination - // buffer a QWORD at a time. - // - - __stosq((PULONG64)(Address), - Pattern | ((ULONG64)Pattern << 32), - Length / 2); - - if ((Length & 1) != 0) { - Address[Length - 1] = Pattern; - } - } - - return; -} - -#define RtlFillMemoryUlonglong(Destination, Length, Pattern) \ - __stosq((PULONG64)(Destination), Pattern, (Length) / 8) - -#endif - -#else - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -VOID -NTAPI -RtlFillMemoryUlong ( - __out_bcount_full(Length) PVOID Destination, - __in SIZE_T Length, - __in ULONG Pattern - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -VOID -NTAPI -RtlFillMemoryUlonglong ( - __out_bcount_full(Length) PVOID Destination, - __in SIZE_T Length, - __in ULONGLONG Pattern - ); -#endif - -#endif // defined(_M_AMD64) - - - -// -// A 64 bit Time value -> Seconds since the start of 1980 -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__success(return != 0) -NTSYSAPI -BOOLEAN -NTAPI -RtlTimeToSecondsSince1980 ( - __in PLARGE_INTEGER Time, - __out PULONG ElapsedSeconds - ); -#endif - -// -// Seconds since the start of 1980 -> 64 bit Time value -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlSecondsSince1980ToTime ( - __in ULONG ElapsedSeconds, - __out PLARGE_INTEGER Time - ); -#endif - -// -// A 64 bit Time value -> Seconds since the start of 1970 -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__success(return != 0) -NTSYSAPI -BOOLEAN -NTAPI -RtlTimeToSecondsSince1970 ( - __in PLARGE_INTEGER Time, - __out PULONG ElapsedSeconds - ); -#endif - -// -// Seconds since the start of 1970 -> 64 bit Time value -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlSecondsSince1970ToTime ( - __in ULONG ElapsedSeconds, - __out PLARGE_INTEGER Time - ); -#endif - - -//++ -// -// PCHAR -// RtlOffsetToPointer ( -// PVOID Base, -// ULONG Offset -// ) -// -// Routine Description: -// -// This macro generates a pointer which points to the byte that is 'Offset' -// bytes beyond 'Base'. This is useful for referencing fields within -// self-relative data structures. -// -// Arguments: -// -// Base - The address of the base of the structure. -// -// Offset - An unsigned integer offset of the byte whose address is to -// be generated. -// -// Return Value: -// -// A PCHAR pointer to the byte that is 'Offset' bytes beyond 'Base'. -// -// -//-- - -#define RtlOffsetToPointer(B,O) ((PCHAR)( ((PCHAR)(B)) + ((ULONG_PTR)(O)) )) - - -//++ -// -// ULONG -// RtlPointerToOffset ( -// PVOID Base, -// PVOID Pointer -// ) -// -// Routine Description: -// -// This macro calculates the offset from Base to Pointer. This is useful -// for producing self-relative offsets for structures. -// -// Arguments: -// -// Base - The address of the base of the structure. -// -// Pointer - A pointer to a field, presumably within the structure -// pointed to by Base. This value must be larger than that specified -// for Base. -// -// Return Value: -// -// A ULONG offset from Base to Pointer. -// -// -//-- - -#define RtlPointerToOffset(B,P) ((ULONG)( ((PCHAR)(P)) - ((PCHAR)(B)) )) - -// -// Security ID RTL routine definitions -// - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlValidSid ( - __in PSID Sid - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlEqualSid ( - __in PSID Sid1, - __in PSID Sid2 - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlEqualPrefixSid ( - __in PSID Sid1, - __in PSID Sid2 - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -ULONG -NTAPI -RtlLengthRequiredSid ( - __in ULONG SubAuthorityCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -PVOID -NTAPI -RtlFreeSid( - __in __post_invalid PSID Sid - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlAllocateAndInitializeSid( - __in PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, - __in UCHAR SubAuthorityCount, - __in ULONG SubAuthority0, - __in ULONG SubAuthority1, - __in ULONG SubAuthority2, - __in ULONG SubAuthority3, - __in ULONG SubAuthority4, - __in ULONG SubAuthority5, - __in ULONG SubAuthority6, - __in ULONG SubAuthority7, - __deref_out PSID *Sid - ); -#endif // NTDDI_VERSION >= NTDDI_WIN2K - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlInitializeSid ( - __out PSID Sid, - __in PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, - __in UCHAR SubAuthorityCount - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -PSID_IDENTIFIER_AUTHORITY -NTAPI -RtlIdentifierAuthoritySid ( - __in PSID Sid - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -PULONG -NTAPI -RtlSubAuthoritySid ( - __in PSID Sid, - __in ULONG SubAuthority - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -PUCHAR -NTAPI -RtlSubAuthorityCountSid ( - __in PSID Sid - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONG -NTAPI -RtlLengthSid ( - __in PSID Sid - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlCopySid ( - __in ULONG DestinationSidLength, - __in_bcount(DestinationSidLength) PSID DestinationSid, - __in PSID SourceSid - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -NTSTATUS -NTAPI -RtlCreateServiceSid( - __in PUNICODE_STRING ServiceName, - __out_bcount(*ServiceSidLength) PSID ServiceSid, - __inout PULONG ServiceSidLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlGetSaclSecurityDescriptor ( - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __out PBOOLEAN SaclPresent, - __out PACL *Sacl, - __out PBOOLEAN SaclDefaulted - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlReplaceSidInSd( - __inout PSECURITY_DESCRIPTOR SecurityDescriptor, - __in PSID OldSid, - __in PSID NewSid, - __out ULONG *NumChanges - ); - -NTSYSAPI -NTSTATUS -NTAPI -RtlCreateVirtualAccountSid ( - __in PCUNICODE_STRING Name, - __in ULONG BaseSubAuthority, - __out_bcount(*SidLength) PSID Sid, - __inout PULONG SidLength - ); -#endif - -// -// MAX_UNICODE_STACK_BUFFER_LENGTH is the maximum stack buffer -// that RtlConvertSidToUnicodeString can fill if the caller -// specifies AllocateDestinationString = FALSE. -// - -#define MAX_UNICODE_STACK_BUFFER_LENGTH 256 - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlConvertSidToUnicodeString( - __inout PUNICODE_STRING UnicodeString, - __in PSID Sid, - __in BOOLEAN AllocateDestinationString - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlCopyLuid ( - __out PLUID DestinationLuid, - __in PLUID SourceLuid - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlCreateAcl ( - __out_bcount(AclLength) PACL Acl, - __in ULONG AclLength, - __in ULONG AclRevision - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlAddAce ( - __inout PACL Acl, - __in ULONG AceRevision, - __in ULONG StartingAceIndex, - __in_bcount(AceListLength) PVOID AceList, - __in ULONG AceListLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlDeleteAce ( - __inout PACL Acl, - __in ULONG AceIndex - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -NTSTATUS -NTAPI -RtlGetAce ( - __in PACL Acl, - __in ULONG AceIndex, - __deref_out PVOID *Ace - ); -#endif // NTDDI_VERSION >= NTDDI_WIN2K - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlAddAccessAllowedAce ( - __inout PACL Acl, - __in ULONG AceRevision, - __in ACCESS_MASK AccessMask, - __in PSID Sid - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlAddAccessAllowedAceEx ( - __inout PACL Acl, - __in ULONG AceRevision, - __in ULONG AceFlags, - __in ACCESS_MASK AccessMask, - __in PSID Sid - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlCreateSecurityDescriptorRelative ( - __out PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor, - __in ULONG Revision - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -NTSTATUS -NTAPI -RtlGetDaclSecurityDescriptor ( - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __out PBOOLEAN DaclPresent, - __out PACL *Dacl, - __out PBOOLEAN DaclDefaulted - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlSetOwnerSecurityDescriptor ( - __inout PSECURITY_DESCRIPTOR SecurityDescriptor, - __in_opt PSID Owner, - __in_opt BOOLEAN OwnerDefaulted - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlSetGroupSecurityDescriptor ( - __inout PSECURITY_DESCRIPTOR SecurityDescriptor, - __in_opt PSID Group, - __in_opt BOOLEAN GroupDefaulted - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlGetGroupSecurityDescriptor ( - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __out PSID *Group, - __out PBOOLEAN GroupDefaulted - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlAbsoluteToSelfRelativeSD ( - __in PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor, - __out_bcount_part_opt(*BufferLength, *BufferLength) PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor, - __inout PULONG BufferLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlSelfRelativeToAbsoluteSD ( - __in PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor, - __out_bcount_part_opt(*AbsoluteSecurityDescriptorSize, *AbsoluteSecurityDescriptorSize) PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor, - __inout PULONG AbsoluteSecurityDescriptorSize, - __out_bcount_part_opt(*DaclSize, *DaclSize) PACL Dacl, - __inout PULONG DaclSize, - __out_bcount_part_opt(*SaclSize, *SaclSize) PACL Sacl, - __inout PULONG SaclSize, - __out_bcount_part_opt(*OwnerSize, *OwnerSize) PSID Owner, - __inout PULONG OwnerSize, - __out_bcount_part_opt(*PrimaryGroupSize, *PrimaryGroupSize) PSID PrimaryGroup, - __inout PULONG PrimaryGroupSize - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlGetOwnerSecurityDescriptor ( - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __out PSID *Owner, - __out PBOOLEAN OwnerDefaulted - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -ULONG -NTAPI -RtlNtStatusToDosError ( - __in NTSTATUS Status - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -ULONG -NTAPI -RtlNtStatusToDosErrorNoTeb ( - __in NTSTATUS Status - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlCustomCPToUnicodeN( - __in PCPTABLEINFO CustomCP, - __out_bcount_part(MaxBytesInUnicodeString, *BytesInUnicodeString) PWCH UnicodeString, - __in ULONG MaxBytesInUnicodeString, - __out_opt PULONG BytesInUnicodeString, - __in_bcount(BytesInCustomCPString) PCH CustomCPString, - __in ULONG BytesInCustomCPString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlUnicodeToCustomCPN( - __in PCPTABLEINFO CustomCP, - __out_bcount_part(MaxBytesInCustomCPString, *BytesInCustomCPString) PCH CustomCPString, - __in ULONG MaxBytesInCustomCPString, - __out_opt PULONG BytesInCustomCPString, - __in_bcount(BytesInUnicodeString) PWCH UnicodeString, - __in ULONG BytesInUnicodeString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlUpcaseUnicodeToCustomCPN( - __in PCPTABLEINFO CustomCP, - __out_bcount_part(MaxBytesInCustomCPString, *BytesInCustomCPString) PCH CustomCPString, - __in ULONG MaxBytesInCustomCPString, - __out_opt PULONG BytesInCustomCPString, - __in_bcount(BytesInUnicodeString) PWCH UnicodeString, - __in ULONG BytesInUnicodeString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlInitCodePageTable( - __in PUSHORT TableBase, - __inout PCPTABLEINFO CodePageTable - ); -#endif - - -// -// Routine for verifying or creating the "System Volume Information" -// folder on NTFS volumes. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlCreateSystemVolumeInformationFolder( - __in PCUNICODE_STRING VolumeRootPath - ); -#endif - -#define RTL_SYSTEM_VOLUME_INFORMATION_FOLDER L"System Volume Information" - -// -// Altitude Routines -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -LONG -NTAPI -RtlCompareAltitudes( - __in PCUNICODE_STRING Altitude1, - __in PCUNICODE_STRING Altitude2 - ); -#endif - -// -// Define the various device type values. Note that values used by Microsoft -// Corporation are in the range 0-32767, and 32768-65535 are reserved for use -// by customers. -// - -#define DEVICE_TYPE ULONG - -#define FILE_DEVICE_BEEP 0x00000001 -#define FILE_DEVICE_CD_ROM 0x00000002 -#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 -#define FILE_DEVICE_CONTROLLER 0x00000004 -#define FILE_DEVICE_DATALINK 0x00000005 -#define FILE_DEVICE_DFS 0x00000006 -#define FILE_DEVICE_DISK 0x00000007 -#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 -#define FILE_DEVICE_FILE_SYSTEM 0x00000009 -#define FILE_DEVICE_INPORT_PORT 0x0000000a -#define FILE_DEVICE_KEYBOARD 0x0000000b -#define FILE_DEVICE_MAILSLOT 0x0000000c -#define FILE_DEVICE_MIDI_IN 0x0000000d -#define FILE_DEVICE_MIDI_OUT 0x0000000e -#define FILE_DEVICE_MOUSE 0x0000000f -#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 -#define FILE_DEVICE_NAMED_PIPE 0x00000011 -#define FILE_DEVICE_NETWORK 0x00000012 -#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 -#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 -#define FILE_DEVICE_NULL 0x00000015 -#define FILE_DEVICE_PARALLEL_PORT 0x00000016 -#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 -#define FILE_DEVICE_PRINTER 0x00000018 -#define FILE_DEVICE_SCANNER 0x00000019 -#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a -#define FILE_DEVICE_SERIAL_PORT 0x0000001b -#define FILE_DEVICE_SCREEN 0x0000001c -#define FILE_DEVICE_SOUND 0x0000001d -#define FILE_DEVICE_STREAMS 0x0000001e -#define FILE_DEVICE_TAPE 0x0000001f -#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 -#define FILE_DEVICE_TRANSPORT 0x00000021 -#define FILE_DEVICE_UNKNOWN 0x00000022 -#define FILE_DEVICE_VIDEO 0x00000023 -#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 -#define FILE_DEVICE_WAVE_IN 0x00000025 -#define FILE_DEVICE_WAVE_OUT 0x00000026 -#define FILE_DEVICE_8042_PORT 0x00000027 -#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 -#define FILE_DEVICE_BATTERY 0x00000029 -#define FILE_DEVICE_BUS_EXTENDER 0x0000002a -#define FILE_DEVICE_MODEM 0x0000002b -#define FILE_DEVICE_VDM 0x0000002c -#define FILE_DEVICE_MASS_STORAGE 0x0000002d -#define FILE_DEVICE_SMB 0x0000002e -#define FILE_DEVICE_KS 0x0000002f -#define FILE_DEVICE_CHANGER 0x00000030 -#define FILE_DEVICE_SMARTCARD 0x00000031 -#define FILE_DEVICE_ACPI 0x00000032 -#define FILE_DEVICE_DVD 0x00000033 -#define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034 -#define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035 -#define FILE_DEVICE_DFS_VOLUME 0x00000036 -#define FILE_DEVICE_SERENUM 0x00000037 -#define FILE_DEVICE_TERMSRV 0x00000038 -#define FILE_DEVICE_KSEC 0x00000039 -#define FILE_DEVICE_FIPS 0x0000003A -#define FILE_DEVICE_INFINIBAND 0x0000003B -#define FILE_DEVICE_VMBUS 0x0000003E -#define FILE_DEVICE_CRYPT_PROVIDER 0x0000003F -#define FILE_DEVICE_WPD 0x00000040 -#define FILE_DEVICE_BLUETOOTH 0x00000041 -#define FILE_DEVICE_MT_COMPOSITE 0x00000042 -#define FILE_DEVICE_MT_TRANSPORT 0x00000043 -#define FILE_DEVICE_BIOMETRIC 0x00000044 -#define FILE_DEVICE_PMI 0x00000045 - -// -// 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) \ -) - -// -// Macro to extract device type out of the device io control code -// -#define DEVICE_TYPE_FROM_CTL_CODE(ctrlCode) (((ULONG)(ctrlCode & 0xffff0000)) >> 16) - -// -// Macro to extract buffering method out of the device io control code -// -#define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3)) - -// -// 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 some easier to comprehend aliases: -// METHOD_DIRECT_TO_HARDWARE (writes, aka METHOD_IN_DIRECT) -// METHOD_DIRECT_FROM_HARDWARE (reads, aka METHOD_OUT_DIRECT) -// - -#define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT -#define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT - -// -// 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. -// -// -// FILE_SPECIAL_ACCESS is checked by the NT I/O system the same as FILE_ANY_ACCESS. -// The file systems, however, may add additional access checks for I/O and FS controls -// that use this value. -// - - -#define FILE_ANY_ACCESS 0 -#define FILE_SPECIAL_ACCESS (FILE_ANY_ACCESS) -#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe -#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtSetInformationThread ( - __in HANDLE ThreadHandle, - __in THREADINFOCLASS ThreadInformationClass, - __in_bcount(ThreadInformationLength) PVOID ThreadInformation, - __in ULONG ThreadInformationLength - ); - -#endif // NTDDI_VERSION >= NTDDI_WINXP - - -// -// Security operation mode of the system is held in a control -// longword. -// - -typedef ULONG LSA_OPERATIONAL_MODE, *PLSA_OPERATIONAL_MODE; - -// -// Used by a logon process to indicate what type of logon is being -// requested. -// - -typedef enum _SECURITY_LOGON_TYPE { - UndefinedLogonType = 0, // This is used to specify an undefied logon type - Interactive = 2, // Interactively logged on (locally or remotely) - Network, // Accessing system via network - Batch, // Started via a batch queue - Service, // Service started by service controller - Proxy, // Proxy logon - Unlock, // Unlock workstation - NetworkCleartext, // Network logon with cleartext credentials - NewCredentials, // Clone caller, new default credentials - //The types below only exist in Windows XP and greater -#if (_WIN32_WINNT >= 0x0501) - RemoteInteractive, // Remote, yet interactive. Terminal server - CachedInteractive, // Try cached credentials without hitting the net. - // The types below only exist in Windows Server 2003 and greater -#endif -#if (_WIN32_WINNT >= 0x0502) - CachedRemoteInteractive, // Same as RemoteInteractive, this is used internally for auditing purpose - CachedUnlock // Cached Unlock workstation -#endif -} SECURITY_LOGON_TYPE, *PSECURITY_LOGON_TYPE; - - -// -// All of this stuff (between the Ifndef _NTLSA_AUDIT_ and its endif) were not -// present in NTIFS prior to Windows Server 2003 SP1. All of the definitions however -// exist down to windows 2000 (except for the few exceptions noted in the code). -// - -#ifndef _NTLSA_AUDIT_ -#define _NTLSA_AUDIT_ - -///////////////////////////////////////////////////////////////////////// -// // -// Data types related to Auditing // -// // -///////////////////////////////////////////////////////////////////////// - - -// -// The following enumerated type is used between the reference monitor and -// LSA in the generation of audit messages. It is used to indicate the -// type of data being passed as a parameter from the reference monitor -// to LSA. LSA is responsible for transforming the specified data type -// into a set of unicode strings that are added to the event record in -// the audit log. -// - -typedef enum _SE_ADT_PARAMETER_TYPE { - - SeAdtParmTypeNone = 0, //Produces 1 parameter - //Received value: - // - // None. - // - //Results in: - // - // a unicode string containing "-". - // - //Note: This is typically used to - // indicate that a parameter value - // was not available. - // - - SeAdtParmTypeString, //Produces 1 parameter. - //Received Value: - // - // Unicode String (variable length) - // - //Results in: - // - // No transformation. The string - // entered into the event record as - // received. - // - // The Address value of the audit info - // should be a pointer to a UNICODE_STRING - // structure. - - - - SeAdtParmTypeFileSpec, //Produces 1 parameter. - //Received value: - // - // Unicode string containing a file or - // directory name. - // - //Results in: - // - // Unicode string with the prefix of the - // file's path replaced by a drive letter - // if possible. - // - - - - - SeAdtParmTypeUlong, //Produces 1 parameter - //Received value: - // - // Ulong - // - //Results in: - // - // Unicode string representation of - // unsigned integer value. - - - SeAdtParmTypeSid, //Produces 1 parameter. - //Received value: - // - // SID (variable length) - // - //Results in: - // - // String representation of SID - // - - - - - SeAdtParmTypeLogonId, //Produces 4 parameters. - //Received Value: - // - // LUID (fixed length) - // - //Results in: - // - // param 1: Sid string - // param 2: Username string - // param 3: domain name string - // param 4: Logon ID (Luid) string - - - SeAdtParmTypeNoLogonId, //Produces 3 parameters. - //Received value: - // - // None. - // - //Results in: - // - // param 1: "-" - // param 2: "-" - // param 3: "-" - // param 4: "-" - // - //Note: - // - // This type is used when a logon ID - // is needed, but one is not available - // to pass. For example, if an - // impersonation logon ID is expected - // but the subject is not impersonating - // anyone. - // - - SeAdtParmTypeAccessMask, //Produces 1 parameter with formatting. - //Received value: - // - // ACCESS_MASK followed by - // a Unicode string. The unicode - // string contains the name of the - // type of object the access mask - // applies to. The event's source - // further qualifies the object type. - // - //Results in: - // - // formatted unicode string built to - // take advantage of the specified - // source's parameter message file. - // - //Note: - // - // An access mask containing three - // access types for a Widget object - // type (defined by the Foozle source) - // might end up looking like: - // - // %%1062\n\t\t%1066\n\t\t%%601 - // - // The %%numbers are signals to the - // event viewer to perform parameter - // substitution before display. - // - - - - SeAdtParmTypePrivs, //Produces 1 parameter with formatting. - //Received value: - // - //Results in: - // - // formatted unicode string similar to - // that for access types. Each priv - // will be formatted to be displayed - // on its own line. E.g., - // - // %%642\n\t\t%%651\n\t\t%%655 - // - - SeAdtParmTypeObjectTypes, //Produces 10 parameters with formatting. - //Received value: - // - // Produces a list a stringized GUIDS along - // with information similar to that for - // an access mask. - - SeAdtParmTypeHexUlong, //Produces 1 parameter - //Received value: - // - // Ulong - // - //Results in: - // - // Unicode string representation of - // unsigned integer value in hexadecimal. - -// In W2k this value did not exist, it was ParmTypeLUID - - SeAdtParmTypePtr, //Produces 1 parameter - //Received value: - // - // pointer - // - //Results in: - // - // Unicode string representation of - // unsigned integer value in hexadecimal. - -// -// Everything below exists only in Windows XP and greater -// - - SeAdtParmTypeTime, //Produces 2 parameters - //Received value: - // - // LARGE_INTEGER - // - //Results in: - // - // Unicode string representation of - // date and time. - - // - SeAdtParmTypeGuid, //Produces 1 parameter - //Received value: - // - // GUID pointer - // - //Results in: - // - // Unicode string representation of GUID - // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - // - -// -// Everything below exists only in Windows Server 2003 and Greater -// - - SeAdtParmTypeLuid, // - //Produces 1 parameter - //Received value: - // - // LUID - // - //Results in: - // - // Hex LUID - // - - SeAdtParmTypeHexInt64, //Produces 1 parameter - //Received value: - // - // 64 bit integer - // - //Results in: - // - // Unicode string representation of - // unsigned integer value in hexadecimal. - - SeAdtParmTypeStringList, //Produces 1 parameter - //Received value: - // - // ptr to LSAP_ADT_STRING_LIST - // - //Results in: - // - // Unicode string representation of - // concatenation of the strings in the list - - SeAdtParmTypeSidList, //Produces 1 parameter - //Received value: - // - // ptr to LSAP_ADT_SID_LIST - // - //Results in: - // - // Unicode string representation of - // concatenation of the SIDs in the list - - SeAdtParmTypeDuration, //Produces 1 parameters - //Received value: - // - // LARGE_INTEGER - // - //Results in: - // - // Unicode string representation of - // a duration. - - SeAdtParmTypeUserAccountControl,//Produces 3 parameters - //Received value: - // - // old and new UserAccountControl values - // - //Results in: - // - // Unicode string representations of - // the flags in UserAccountControl. - // 1 - old value in hex - // 2 - new value in hex - // 3 - difference as strings - - SeAdtParmTypeNoUac, //Produces 3 parameters - //Received value: - // - // none - // - //Results in: - // - // Three dashes ('-') as unicode strings. - - SeAdtParmTypeMessage, //Produces 1 Parameter - //Received value: - // - // ULONG (MessageNo from msobjs.mc) - // - //Results in: - // - // Unicode string representation of - // %%MessageNo which the event viewer - // will replace with the message string - // from msobjs.mc - - SeAdtParmTypeDateTime, //Produces 1 Parameter - //Received value: - // - // LARGE_INTEGER - // - //Results in: - // - // Unicode string representation of - // date and time (in _one_ string). - - SeAdtParmTypeSockAddr, // Produces 2 parameters - // - // Received value: - // - // pointer to SOCKADDR_IN/SOCKADDR_IN6 - // structure - // - // Results in: - // - // param 1: IP address string - // param 2: Port number string - // - -// -// Everything below this exists only in Windows Server 2008 and greater -// - - SeAdtParmTypeSD, // Produces 1 parameters - // - // Received value: - // - // pointer to SECURITY_DESCRIPTOR - // structure - // - // Results in: - // - // SDDL string representation of SD - // - - SeAdtParmTypeLogonHours, // Produces 1 parameters - // - // Received value: - // - // pointer to LOGON_HOURS - // structure - // - // Results in: - // - // String representation of allowed logon hours - // - - SeAdtParmTypeLogonIdNoSid, //Produces 3 parameters. - //Received Value: - // - // LUID (fixed length) - // - //Results in: - // - // param 1: Username string - // param 2: domain name string - // param 3: Logon ID (Luid) string - - SeAdtParmTypeUlongNoConv, // Produces 1 parameter. - // Received Value: - // Ulong - // - //Results in: - // Not converted to string - // - - SeAdtParmTypeSockAddrNoPort, // Produces 1 parameter - // - // Received value: - // - // pointer to SOCKADDR_IN/SOCKADDR_IN6 - // structure - // - // Results in: - // - // param 1: IPv4/IPv6 address string - // -// -// Everything below this exists only in Windows Server 2008 and greater -// - - SeAdtParmTypeAccessReason // Produces 1 parameters - // - // Received value: - // - // pointer to SECURITY_DESCRIPTOR - // structure followed by the reason code. - // The reason code could be the index - // of the ACE in the SD or privilege ID or - // other reason codes. - // - // Results in: - // - // String representation of the access reason. - // - -} SE_ADT_PARAMETER_TYPE, *PSE_ADT_PARAMETER_TYPE; - -#ifndef GUID_DEFINED -#include -#endif /* GUID_DEFINED */ - -typedef struct _SE_ADT_OBJECT_TYPE { - GUID ObjectType; - USHORT Flags; -#define SE_ADT_OBJECT_ONLY 0x1 - USHORT Level; - ACCESS_MASK AccessMask; -} SE_ADT_OBJECT_TYPE, *PSE_ADT_OBJECT_TYPE; - -typedef struct _SE_ADT_PARAMETER_ARRAY_ENTRY { - - SE_ADT_PARAMETER_TYPE Type; - ULONG Length; - ULONG_PTR Data[2]; - PVOID Address; - -} SE_ADT_PARAMETER_ARRAY_ENTRY, *PSE_ADT_PARAMETER_ARRAY_ENTRY; - - -typedef struct _SE_ADT_ACCESS_REASON{ - ACCESS_MASK AccessMask; - ULONG AccessReasons[32]; - ULONG ObjectTypeIndex; - ULONG AccessGranted; - PSECURITY_DESCRIPTOR SecurityDescriptor; // multple SDs may be stored here in self-relative way. -} SE_ADT_ACCESS_REASON, *PSE_ADT_ACCESS_REASON; - - - -// -// Structure that will be passed between the Reference Monitor and LSA -// to transmit auditing information. -// - -#define SE_MAX_AUDIT_PARAMETERS 32 -#define SE_MAX_GENERIC_AUDIT_PARAMETERS 28 - -typedef struct _SE_ADT_PARAMETER_ARRAY { - - ULONG CategoryId; - ULONG AuditId; - ULONG ParameterCount; - ULONG Length; - USHORT FlatSubCategoryId; - USHORT Type; - ULONG Flags; - SE_ADT_PARAMETER_ARRAY_ENTRY Parameters[ SE_MAX_AUDIT_PARAMETERS ]; - -} SE_ADT_PARAMETER_ARRAY, *PSE_ADT_PARAMETER_ARRAY; - - -#define SE_ADT_PARAMETERS_SELF_RELATIVE 0x00000001 -#define SE_ADT_PARAMETERS_SEND_TO_LSA 0x00000002 -#define SE_ADT_PARAMETER_EXTENSIBLE_AUDIT 0x00000004 -#define SE_ADT_PARAMETER_GENERIC_AUDIT 0x00000008 -#define SE_ADT_PARAMETER_WRITE_SYNCHRONOUS 0x00000010 - - -// -// This macro only existed in Windows Server 2008 and after -// - -#define LSAP_SE_ADT_PARAMETER_ARRAY_TRUE_SIZE(AuditParameters) \ - ( sizeof(SE_ADT_PARAMETER_ARRAY) - \ - sizeof(SE_ADT_PARAMETER_ARRAY_ENTRY) * \ - (SE_MAX_AUDIT_PARAMETERS - AuditParameters->ParameterCount) ) - -#endif // _NTLSA_AUDIT_ - - -__drv_sameIRQL -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -NTAPI -LsaRegisterLogonProcess ( - __in PLSA_STRING LogonProcessName, - __out PHANDLE LsaHandle, - __out PLSA_OPERATIONAL_MODE SecurityMode - ); - -// -// The function below did not exist in NTIFS before windows XP -// However, the function has always been there, so it is okay to use -// even on w2k -// -__drv_sameIRQL -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -NTAPI -LsaLogonUser ( - __in HANDLE LsaHandle, - __in PLSA_STRING OriginName, - __in SECURITY_LOGON_TYPE LogonType, - __in ULONG AuthenticationPackage, - __in_bcount(AuthenticationInformationLength) PVOID AuthenticationInformation, - __in ULONG AuthenticationInformationLength, - __in_opt PTOKEN_GROUPS LocalGroups, - __in PTOKEN_SOURCE SourceContext, - __out PVOID *ProfileBuffer, - __out PULONG ProfileBufferLength, - __out PLUID LogonId, - __out PHANDLE Token, - __out PQUOTA_LIMITS Quotas, - __out PNTSTATUS SubStatus - ); - - - -__drv_sameIRQL -NTSTATUS -NTAPI -LsaFreeReturnBuffer ( - __in PVOID Buffer - ); - - -#ifndef _NTLSA_IFS_ -#define _NTLSA_IFS_ -#endif - -///////////////////////////////////////////////////////////////////////// -// // -// Name of the MSV1_0 authentication package // -// // -///////////////////////////////////////////////////////////////////////// - -#define MSV1_0_PACKAGE_NAME "MICROSOFT_AUTHENTICATION_PACKAGE_V1_0" -#define MSV1_0_PACKAGE_NAMEW L"MICROSOFT_AUTHENTICATION_PACKAGE_V1_0" -#define MSV1_0_PACKAGE_NAMEW_LENGTH sizeof(MSV1_0_PACKAGE_NAMEW) - sizeof(WCHAR) - -// -// Location of MSV authentication package data -// -#define MSV1_0_SUBAUTHENTICATION_KEY "SYSTEM\\CurrentControlSet\\Control\\Lsa\\MSV1_0" -#define MSV1_0_SUBAUTHENTICATION_VALUE "Auth" - - -///////////////////////////////////////////////////////////////////////// -// // -// Widely used MSV1_0 data types // -// // -///////////////////////////////////////////////////////////////////////// - - - -/////////////////////////////////////////////////////////////////////////////// -// // -// LOGON Related Data Structures -// -// // -/////////////////////////////////////////////////////////////////////////////// - -// -// When a LsaLogonUser() call is dispatched to the MsV1_0 authentication -// package, the beginning of the AuthenticationInformation buffer is -// cast to a MSV1_0_LOGON_SUBMIT_TYPE to determine the type of logon -// being requested. Similarly, upon return, the type of profile buffer -// can be determined by typecasting it to a MSV_1_0_PROFILE_BUFFER_TYPE. -// - -// -// MSV1.0 LsaLogonUser() submission message types. -// - -typedef enum _MSV1_0_LOGON_SUBMIT_TYPE { - MsV1_0InteractiveLogon = 2, - MsV1_0Lm20Logon, - MsV1_0NetworkLogon, - MsV1_0SubAuthLogon, - MsV1_0WorkstationUnlockLogon = 7, - // defined in Windows Server 2008 and up - MsV1_0S4ULogon = 12, - MsV1_0VirtualLogon = 82 -} MSV1_0_LOGON_SUBMIT_TYPE, *PMSV1_0_LOGON_SUBMIT_TYPE; - - -// -// MSV1.0 LsaLogonUser() profile buffer types. -// - -typedef enum _MSV1_0_PROFILE_BUFFER_TYPE { - MsV1_0InteractiveProfile = 2, - MsV1_0Lm20LogonProfile, - MsV1_0SmartCardProfile -} MSV1_0_PROFILE_BUFFER_TYPE, *PMSV1_0_PROFILE_BUFFER_TYPE; - -// -// MsV1_0InteractiveLogon -// -// The AuthenticationInformation buffer of an LsaLogonUser() call to -// perform an interactive logon contains the following data structure: -// - -typedef struct _MSV1_0_INTERACTIVE_LOGON { - MSV1_0_LOGON_SUBMIT_TYPE MessageType; - UNICODE_STRING LogonDomainName; - UNICODE_STRING UserName; - UNICODE_STRING Password; -} MSV1_0_INTERACTIVE_LOGON, *PMSV1_0_INTERACTIVE_LOGON; - -// -// Where: -// -// MessageType - Contains the type of logon being requested. This -// field must be set to MsV1_0InteractiveLogon. -// -// UserName - Is a string representing the user's account name. The -// name may be up to 255 characters long. The name is treated case -// insensitive. -// -// Password - Is a string containing the user's cleartext password. -// The password may be up to 255 characters long and contain any -// UNICODE value. -// -// - - -// -// The ProfileBuffer returned upon a successful logon of this type -// contains the following data structure: -// - -typedef struct _MSV1_0_INTERACTIVE_PROFILE { - MSV1_0_PROFILE_BUFFER_TYPE MessageType; - USHORT LogonCount; - USHORT BadPasswordCount; - LARGE_INTEGER LogonTime; - LARGE_INTEGER LogoffTime; - LARGE_INTEGER KickOffTime; - LARGE_INTEGER PasswordLastSet; - LARGE_INTEGER PasswordCanChange; - LARGE_INTEGER PasswordMustChange; - UNICODE_STRING LogonScript; - UNICODE_STRING HomeDirectory; - UNICODE_STRING FullName; - UNICODE_STRING ProfilePath; - UNICODE_STRING HomeDirectoryDrive; - UNICODE_STRING LogonServer; - ULONG UserFlags; -} MSV1_0_INTERACTIVE_PROFILE, *PMSV1_0_INTERACTIVE_PROFILE; - -// -// where: -// -// MessageType - Identifies the type of profile data being returned. -// Contains the type of logon being requested. This field must -// be set to MsV1_0InteractiveProfile. -// -// LogonCount - Number of times the user is currently logged on. -// -// BadPasswordCount - Number of times a bad password was applied to -// the account since last successful logon. -// -// LogonTime - Time when user last logged on. This is an absolute -// format NT standard time value. -// -// LogoffTime - Time when user should log off. This is an absolute -// format NT standard time value. -// -// KickOffTime - Time when system should force user logoff. This is -// an absolute format NT standard time value. -// -// PasswordLastChanged - Time and date the password was last -// changed. This is an absolute format NT standard time -// value. -// -// PasswordCanChange - Time and date when the user can change the -// password. This is an absolute format NT time value. To -// prevent a password from ever changing, set this field to a -// date very far into the future. -// -// PasswordMustChange - Time and date when the user must change the -// password. If the user can never change the password, this -// field is undefined. This is an absolute format NT time -// value. -// -// LogonScript - The (relative) path to the account's logon -// script. -// -// HomeDirectory - The home directory for the user. -// - - -// -// MsV1_0Lm20Logon and MsV1_0NetworkLogon -// -// The AuthenticationInformation buffer of an LsaLogonUser() call to -// perform an network logon contains the following data structure: -// -// MsV1_0NetworkLogon logon differs from MsV1_0Lm20Logon in that the -// ParameterControl field exists. -// - -#define MSV1_0_CHALLENGE_LENGTH 8 -#define MSV1_0_USER_SESSION_KEY_LENGTH 16 -#define MSV1_0_LANMAN_SESSION_KEY_LENGTH 8 - -// -// Values for ParameterControl. -// - -#define MSV1_0_CLEARTEXT_PASSWORD_ALLOWED 0x02 -#define MSV1_0_UPDATE_LOGON_STATISTICS 0x04 -#define MSV1_0_RETURN_USER_PARAMETERS 0x08 -#define MSV1_0_DONT_TRY_GUEST_ACCOUNT 0x10 -#define MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT 0x20 -#define MSV1_0_RETURN_PASSWORD_EXPIRY 0x40 -// this next flag says that CaseInsensitiveChallengeResponse -// (aka LmResponse) contains a client challenge in the first 8 bytes -#define MSV1_0_USE_CLIENT_CHALLENGE 0x80 -#define MSV1_0_TRY_GUEST_ACCOUNT_ONLY 0x100 -#define MSV1_0_RETURN_PROFILE_PATH 0x200 -#define MSV1_0_TRY_SPECIFIED_DOMAIN_ONLY 0x400 -#define MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT 0x800 -//#if (_WIN32_WINNT >= 0x0501) -- Disabled until IIS fixes their target version. -#define MSV1_0_DISABLE_PERSONAL_FALLBACK 0x00001000 -#define MSV1_0_ALLOW_FORCE_GUEST 0x00002000 -//#endif -#if (_WIN32_WINNT >= 0x0502) -#define MSV1_0_CLEARTEXT_PASSWORD_SUPPLIED 0x00004000 -// Start -// Doesnt exist in Windows XP but does exist in Windows 2000 Security Rollup and up -#define MSV1_0_USE_DOMAIN_FOR_ROUTING_ONLY 0x00008000 -#endif -#define MSV1_0_SUBAUTHENTICATION_DLL_EX 0x00100000 -// Defined in Windows Server 2003 SP1 and above -#define MSV1_0_ALLOW_MSVCHAPV2 0x00010000 - -#if (_WIN32_WINNT >= 0x0600) - -//Defined in Windows Server 2008 and up -#define MSV1_0_S4U2SELF 0x00020000 // no password is needed -#define MSV1_0_CHECK_LOGONHOURS_FOR_S4U 0x00040000 // check logon hours for S4U logon - -#endif - -// -// The high order byte is a value indicating the SubAuthentication DLL. -// Zero indicates no SubAuthentication DLL. -// -#define MSV1_0_SUBAUTHENTICATION_DLL 0xFF000000 -#define MSV1_0_SUBAUTHENTICATION_DLL_SHIFT 24 -#define MSV1_0_MNS_LOGON 0x01000000 - -// -// This is the list of subauthentication dlls used in MS -// - -#define MSV1_0_SUBAUTHENTICATION_DLL_RAS 2 -#define MSV1_0_SUBAUTHENTICATION_DLL_IIS 132 - -typedef struct _MSV1_0_LM20_LOGON { - MSV1_0_LOGON_SUBMIT_TYPE MessageType; - UNICODE_STRING LogonDomainName; - UNICODE_STRING UserName; - UNICODE_STRING Workstation; - UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH]; - STRING CaseSensitiveChallengeResponse; - STRING CaseInsensitiveChallengeResponse; - ULONG ParameterControl; -} MSV1_0_LM20_LOGON, * PMSV1_0_LM20_LOGON; - -// -// NT 5.0 SubAuth dlls can use this struct -// - -typedef struct _MSV1_0_SUBAUTH_LOGON{ - MSV1_0_LOGON_SUBMIT_TYPE MessageType; - UNICODE_STRING LogonDomainName; - UNICODE_STRING UserName; - UNICODE_STRING Workstation; - UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH]; - STRING AuthenticationInfo1; - STRING AuthenticationInfo2; - ULONG ParameterControl; - ULONG SubAuthPackageId; -} MSV1_0_SUBAUTH_LOGON, * PMSV1_0_SUBAUTH_LOGON; - -#if (_WIN32_WINNT >= 0x0600) - -// -// s4u2self logon -// -// Defined in Windows Server 2008 and above - -// -// request to enforce logon hours policy -// - -#define MSV1_0_S4U_LOGON_FLAG_CHECK_LOGONHOURS 0x2 - -typedef struct _MSV1_0_S4U_LOGON { - MSV1_0_LOGON_SUBMIT_TYPE MessageType; - ULONG Flags; - UNICODE_STRING UserPrincipalName; // username or username@domain - UNICODE_STRING DomainName; // Optional: if missing, using the local machine -} MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON; - -#endif - -// -// Values for UserFlags. -// - -#define LOGON_GUEST 0x01 -#define LOGON_NOENCRYPTION 0x02 -#define LOGON_CACHED_ACCOUNT 0x04 -#define LOGON_USED_LM_PASSWORD 0x08 -#define LOGON_EXTRA_SIDS 0x20 -#define LOGON_SUBAUTH_SESSION_KEY 0x40 -#define LOGON_SERVER_TRUST_ACCOUNT 0x80 -#define LOGON_NTLMV2_ENABLED 0x100 // says DC understands NTLMv2 -#define LOGON_RESOURCE_GROUPS 0x200 -#define LOGON_PROFILE_PATH_RETURNED 0x400 -// Defined in Windows Server 2008 and above -#define LOGON_NT_V2 0x800 // NT response was used for validation -#define LOGON_LM_V2 0x1000 // LM response was used for validation -#define LOGON_NTLM_V2 0x2000 // LM response was used to authenticate but NT response was used to derive the session key - -#if (_WIN32_WINNT >= 0x0600) - -#define LOGON_OPTIMIZED 0x4000 // this is an optimized logon -#define LOGON_WINLOGON 0x8000 // the logon session was created for winlogon -#define LOGON_PKINIT 0x10000 // Kerberos PKINIT extension was used to authenticate the user -#define LOGON_NO_OPTIMIZED 0x20000 // optimized logon has been disabled for this account - -#endif - -// -// The high order byte is reserved for return by SubAuthentication DLLs. -// - -#define MSV1_0_SUBAUTHENTICATION_FLAGS 0xFF000000 - -// Values returned by the MSV1_0_MNS_LOGON SubAuthentication DLL -#define LOGON_GRACE_LOGON 0x01000000 - -typedef struct _MSV1_0_LM20_LOGON_PROFILE { - MSV1_0_PROFILE_BUFFER_TYPE MessageType; - LARGE_INTEGER KickOffTime; - LARGE_INTEGER LogoffTime; - ULONG UserFlags; - UCHAR UserSessionKey[MSV1_0_USER_SESSION_KEY_LENGTH]; - UNICODE_STRING LogonDomainName; - UCHAR LanmanSessionKey[MSV1_0_LANMAN_SESSION_KEY_LENGTH]; - UNICODE_STRING LogonServer; - UNICODE_STRING UserParameters; -} MSV1_0_LM20_LOGON_PROFILE, * PMSV1_0_LM20_LOGON_PROFILE; - - -// -// Supplemental credentials structure used for passing credentials into -// MSV1_0 from other packages -// - -#define MSV1_0_OWF_PASSWORD_LENGTH 16 -#define MSV1_0_CRED_LM_PRESENT 0x1 -#define MSV1_0_CRED_NT_PRESENT 0x2 -#define MSV1_0_CRED_VERSION 0 - -typedef struct _MSV1_0_SUPPLEMENTAL_CREDENTIAL { - ULONG Version; - ULONG Flags; - UCHAR LmPassword[MSV1_0_OWF_PASSWORD_LENGTH]; - UCHAR NtPassword[MSV1_0_OWF_PASSWORD_LENGTH]; -} MSV1_0_SUPPLEMENTAL_CREDENTIAL, *PMSV1_0_SUPPLEMENTAL_CREDENTIAL; - - -// -// NTLM3 definitions. -// - -#define MSV1_0_NTLM3_RESPONSE_LENGTH 16 -#define MSV1_0_NTLM3_OWF_LENGTH 16 - -// -// this is the longest amount of time we'll allow challenge response -// pairs to be used. Note that this also has to allow for worst case clock skew -// -#if (_WIN32_WINNT == 0x0500) -#define MSV1_0_MAX_NTLM3_LIFE 1800 // 30 minutes (in seconds) -#else -#define MSV1_0_MAX_NTLM3_LIFE 129600 // 36 hours (in seconds) -#endif -#define MSV1_0_MAX_AVL_SIZE 64000 - -#if (_WIN32_WINNT >= 0x0501) -// -// MsvAvFlags bit values -// -// Exists only after Windows 2000 -// - -#define MSV1_0_AV_FLAG_FORCE_GUEST 0x00000001 -#if (_WIN32_WINNT >= 0x0600) -#define MSV1_0_AV_FLAG_MIC_HANDSHAKE_MESSAGES 0x00000002 // the client supports - // hand-shake messages integrity -#endif -#endif - -// this is an MSV1_0 private data structure, defining the layout of an NTLM3 response, as sent by a -// client in the NtChallengeResponse field of the NETLOGON_NETWORK_INFO structure. If can be differentiated -// from an old style NT response by its length. This is crude, but it needs to pass through servers and -// the servers' DCs that do not understand NTLM3 but that are willing to pass longer responses. -typedef struct _MSV1_0_NTLM3_RESPONSE { - UCHAR Response[MSV1_0_NTLM3_RESPONSE_LENGTH]; // hash of OWF of password with all the following fields - UCHAR RespType; // id number of response; current is 1 - UCHAR HiRespType; // highest id number understood by client - USHORT Flags; // reserved; must be sent as zero at this version - ULONG MsgWord; // 32 bit message from client to server (for use by auth protocol) - ULONGLONG TimeStamp; // time stamp when client generated response -- NT system time, quad part - UCHAR ChallengeFromClient[MSV1_0_CHALLENGE_LENGTH]; - ULONG AvPairsOff; // offset to start of AvPairs (to allow future expansion) - UCHAR Buffer[1]; // start of buffer with AV pairs (or future stuff -- so use the offset) -} MSV1_0_NTLM3_RESPONSE, *PMSV1_0_NTLM3_RESPONSE; - -#define MSV1_0_NTLM3_INPUT_LENGTH (sizeof(MSV1_0_NTLM3_RESPONSE) - MSV1_0_NTLM3_RESPONSE_LENGTH) -#if(_WIN32_WINNT >= 0x0502) -#define MSV1_0_NTLM3_MIN_NT_RESPONSE_LENGTH RTL_SIZEOF_THROUGH_FIELD(MSV1_0_NTLM3_RESPONSE, AvPairsOff) -#endif - -typedef enum { - MsvAvEOL, // end of list - MsvAvNbComputerName, // server's computer name -- NetBIOS - MsvAvNbDomainName, // server's domain name -- NetBIOS - MsvAvDnsComputerName, // server's computer name -- DNS - MsvAvDnsDomainName, // server's domain name -- DNS -#if (_WIN32_WINNT >= 0x0501) - MsvAvDnsTreeName, // server's tree name -- DNS - MsvAvFlags, // server's extended flags -- DWORD mask -#if (_WIN32_WINNT >= 0x0600) - MsvAvTimestamp, // contains the server's local time in FILETIME, - // (64 bit 100 ns ticks since 1602 - // (UTC)) in little endian byte order - MsvAvRestrictions, // token restrictions - MsvAvTargetName, - MsvAvChannelBindings, -#endif -#endif -} MSV1_0_AVID; - -typedef struct _MSV1_0_AV_PAIR { - USHORT AvId; - USHORT AvLen; - // Data is treated as byte array following structure -} MSV1_0_AV_PAIR, *PMSV1_0_AV_PAIR; - - - -/////////////////////////////////////////////////////////////////////////////// -// // -// CALL PACKAGE Related Data Structures // -// // -/////////////////////////////////////////////////////////////////////////////// - - -// -// MSV1.0 LsaCallAuthenticationPackage() submission and response -// message types. -// - -typedef enum _MSV1_0_PROTOCOL_MESSAGE_TYPE { - MsV1_0Lm20ChallengeRequest = 0, // Both submission and response - MsV1_0Lm20GetChallengeResponse, // Both submission and response - MsV1_0EnumerateUsers, // Both submission and response - MsV1_0GetUserInfo, // Both submission and response - MsV1_0ReLogonUsers, // Submission only - MsV1_0ChangePassword, // Both submission and response - MsV1_0ChangeCachedPassword, // Both submission and response - MsV1_0GenericPassthrough, // Both submission and response - MsV1_0CacheLogon, // Submission only, no response - MsV1_0SubAuth, // Both submission and response - MsV1_0DeriveCredential, // Both submission and response - MsV1_0CacheLookup, // Both submission and response -#if (_WIN32_WINNT >= 0x0501) - MsV1_0SetProcessOption, // Submission only, no response -#endif -#if (_WIN32_WINNT >= 0x0600) - MsV1_0ConfigLocalAliases, - MsV1_0ClearCachedCredentials, -#endif -} MSV1_0_PROTOCOL_MESSAGE_TYPE, *PMSV1_0_PROTOCOL_MESSAGE_TYPE; - -// end_ntsecapi - -// -// MsV1_0Lm20ChallengeRequest submit buffer and response -// - -typedef struct _MSV1_0_LM20_CHALLENGE_REQUEST { - MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; -} MSV1_0_LM20_CHALLENGE_REQUEST, *PMSV1_0_LM20_CHALLENGE_REQUEST; - -typedef struct _MSV1_0_LM20_CHALLENGE_RESPONSE { - MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; - UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH]; -} MSV1_0_LM20_CHALLENGE_RESPONSE, *PMSV1_0_LM20_CHALLENGE_RESPONSE; - -// -// MsV1_0Lm20GetChallengeResponse submit buffer and response -// - -#define USE_PRIMARY_PASSWORD 0x01 -#define RETURN_PRIMARY_USERNAME 0x02 -#define RETURN_PRIMARY_LOGON_DOMAINNAME 0x04 -#define RETURN_NON_NT_USER_SESSION_KEY 0x08 -#define GENERATE_CLIENT_CHALLENGE 0x10 -#define GCR_NTLM3_PARMS 0x20 -#define GCR_TARGET_INFO 0x40 // ServerName field contains target info AV pairs -#define RETURN_RESERVED_PARAMETER 0x80 // was 0x10 -#define GCR_ALLOW_NTLM 0x100 // allow the use of NTLM -// Exists in Windows XPSP2 and later -#define GCR_USE_OEM_SET 0x200 // response uses oem character set -#define GCR_MACHINE_CREDENTIAL 0x400 -#define GCR_USE_OWF_PASSWORD 0x800 // use owf passwords -#define GCR_ALLOW_LM 0x1000 // allow the use of LM -// Defined in Windows Server 2003 and above -#define GCR_ALLOW_NO_TARGET 0x2000 // allow no target server or target domain name - -// -// version 1 of the GETCHALLENRESP structure, which was used by RAS and others. -// compiled before the additional fields added to GETCHALLENRESP_REQUEST. -// here to allow sizing operations for backwards compatibility. -// - -typedef struct _MSV1_0_GETCHALLENRESP_REQUEST_V1 { - MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; - ULONG ParameterControl; - LUID LogonId; - UNICODE_STRING Password; - UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH]; -} MSV1_0_GETCHALLENRESP_REQUEST_V1, *PMSV1_0_GETCHALLENRESP_REQUEST_V1; - -typedef struct _MSV1_0_GETCHALLENRESP_REQUEST { - MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; - ULONG ParameterControl; - LUID LogonId; - UNICODE_STRING Password; - UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH]; - - // - // the following 3 fields are only present if GCR_NTLM3_PARMS is set in ParameterControl - // - - UNICODE_STRING UserName; - UNICODE_STRING LogonDomainName; - UNICODE_STRING ServerName; // server domain or target info AV pairs -} MSV1_0_GETCHALLENRESP_REQUEST, *PMSV1_0_GETCHALLENRESP_REQUEST; - -typedef struct _MSV1_0_GETCHALLENRESP_RESPONSE { - MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; - STRING CaseSensitiveChallengeResponse; - STRING CaseInsensitiveChallengeResponse; - UNICODE_STRING UserName; - UNICODE_STRING LogonDomainName; - UCHAR UserSessionKey[MSV1_0_USER_SESSION_KEY_LENGTH]; - UCHAR LanmanSessionKey[MSV1_0_LANMAN_SESSION_KEY_LENGTH]; -} MSV1_0_GETCHALLENRESP_RESPONSE, *PMSV1_0_GETCHALLENRESP_RESPONSE; - -// -// MsV1_0EnumerateUsers submit buffer and response -// - -typedef struct _MSV1_0_ENUMUSERS_REQUEST { - MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; -} MSV1_0_ENUMUSERS_REQUEST, *PMSV1_0_ENUMUSERS_REQUEST; - -typedef struct _MSV1_0_ENUMUSERS_RESPONSE { - MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; - ULONG NumberOfLoggedOnUsers; - PLUID LogonIds; - PULONG EnumHandles; -} MSV1_0_ENUMUSERS_RESPONSE, *PMSV1_0_ENUMUSERS_RESPONSE; - -// -// MsV1_0GetUserInfo submit buffer and response -// - -typedef struct _MSV1_0_GETUSERINFO_REQUEST { - MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; - LUID LogonId; -} MSV1_0_GETUSERINFO_REQUEST, *PMSV1_0_GETUSERINFO_REQUEST; - -typedef struct _MSV1_0_GETUSERINFO_RESPONSE { - MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; - PSID UserSid; - UNICODE_STRING UserName; - UNICODE_STRING LogonDomainName; - UNICODE_STRING LogonServer; - SECURITY_LOGON_TYPE LogonType; -} MSV1_0_GETUSERINFO_RESPONSE, *PMSV1_0_GETUSERINFO_RESPONSE; - - -// -// Define the I/O status information return values for requests for oplocks -// via NtFsControlFile -// - -#define FILE_OPLOCK_BROKEN_TO_LEVEL_2 0x00000007 -#define FILE_OPLOCK_BROKEN_TO_NONE 0x00000008 - -// -// Define the I/O status information return values for NtCreateFile/NtOpenFile -// when the sharing access fails but a batch oplock break is in progress -// - -#define FILE_OPBATCH_BREAK_UNDERWAY 0x00000009 - -// -// Define the filter flags for NtNotifyChangeDirectoryFile -// - -#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 // winnt -#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 // winnt -#define FILE_NOTIFY_CHANGE_NAME 0x00000003 -#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 // winnt -#define FILE_NOTIFY_CHANGE_SIZE 0x00000008 // winnt -#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 // winnt -#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 // winnt -#define FILE_NOTIFY_CHANGE_CREATION 0x00000040 // winnt -#define FILE_NOTIFY_CHANGE_EA 0x00000080 -#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 // winnt -#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 -#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 -#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 -#define FILE_NOTIFY_VALID_MASK 0x00000fff - -// -// Define the file action type codes for NtNotifyChangeDirectoryFile -// - -#define FILE_ACTION_ADDED 0x00000001 // winnt -#define FILE_ACTION_REMOVED 0x00000002 // winnt -#define FILE_ACTION_MODIFIED 0x00000003 // winnt -#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 // winnt -#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 // winnt -#define FILE_ACTION_ADDED_STREAM 0x00000006 -#define FILE_ACTION_REMOVED_STREAM 0x00000007 -#define FILE_ACTION_MODIFIED_STREAM 0x00000008 -#define FILE_ACTION_REMOVED_BY_DELETE 0x00000009 -#define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A -#define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B - -// -// Define the NamedPipeType flags for NtCreateNamedPipeFile -// - -#define FILE_PIPE_BYTE_STREAM_TYPE 0x00000000 -#define FILE_PIPE_MESSAGE_TYPE 0x00000001 - -#define FILE_PIPE_ACCEPT_REMOTE_CLIENTS 0x00000000 -#define FILE_PIPE_REJECT_REMOTE_CLIENTS 0x00000002 - -#define FILE_PIPE_TYPE_VALID_MASK 0x00000003 - -// -// Define the CompletionMode flags for NtCreateNamedPipeFile -// - -#define FILE_PIPE_QUEUE_OPERATION 0x00000000 -#define FILE_PIPE_COMPLETE_OPERATION 0x00000001 - -// -// Define the ReadMode flags for NtCreateNamedPipeFile -// - -#define FILE_PIPE_BYTE_STREAM_MODE 0x00000000 -#define FILE_PIPE_MESSAGE_MODE 0x00000001 - -// -// Define the NamedPipeConfiguration flags for NtQueryInformation -// - -#define FILE_PIPE_INBOUND 0x00000000 -#define FILE_PIPE_OUTBOUND 0x00000001 -#define FILE_PIPE_FULL_DUPLEX 0x00000002 - -// -// Define the NamedPipeState flags for NtQueryInformation -// - -#define FILE_PIPE_DISCONNECTED_STATE 0x00000001 -#define FILE_PIPE_LISTENING_STATE 0x00000002 -#define FILE_PIPE_CONNECTED_STATE 0x00000003 -#define FILE_PIPE_CLOSING_STATE 0x00000004 - -// -// Define the NamedPipeEnd flags for NtQueryInformation -// - -#define FILE_PIPE_CLIENT_END 0x00000000 -#define FILE_PIPE_SERVER_END 0x00000001 - - -// -// Define the file system attributes flags -// - -#define FILE_CASE_SENSITIVE_SEARCH 0x00000001 // winnt -#define FILE_CASE_PRESERVED_NAMES 0x00000002 // winnt -#define FILE_UNICODE_ON_DISK 0x00000004 // winnt -#define FILE_PERSISTENT_ACLS 0x00000008 // winnt -#define FILE_FILE_COMPRESSION 0x00000010 // winnt -#define FILE_VOLUME_QUOTAS 0x00000020 // winnt -#define FILE_SUPPORTS_SPARSE_FILES 0x00000040 // winnt -#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 // winnt -#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 // winnt -#define FILE_VOLUME_IS_COMPRESSED 0x00008000 // winnt -#define FILE_SUPPORTS_OBJECT_IDS 0x00010000 // winnt -#define FILE_SUPPORTS_ENCRYPTION 0x00020000 // winnt -#define FILE_NAMED_STREAMS 0x00040000 // winnt -#define FILE_READ_ONLY_VOLUME 0x00080000 // winnt -#define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000 // winnt -#define FILE_SUPPORTS_TRANSACTIONS 0x00200000 // winnt -#define FILE_SUPPORTS_HARD_LINKS 0x00400000 // winnt -#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000 // winnt -// -// When enabled this attribute implies that the FileID's for the supported -// file system are also durable. This means the FileID will not change due -// to other file system operations like rename or defrag. If a file -// is deleted and re-created the ID will change. -// -#define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000 // winnt -#define FILE_SUPPORTS_USN_JOURNAL 0x02000000 // winnt - - - -// -// Define the flags for NtSet(Query)EaFile service structure entries -// - -#define FILE_NEED_EA 0x00000080 - -// -// Define EA type values -// - -#define FILE_EA_TYPE_BINARY 0xfffe -#define FILE_EA_TYPE_ASCII 0xfffd -#define FILE_EA_TYPE_BITMAP 0xfffb -#define FILE_EA_TYPE_METAFILE 0xfffa -#define FILE_EA_TYPE_ICON 0xfff9 -#define FILE_EA_TYPE_EA 0xffee -#define FILE_EA_TYPE_MVMT 0xffdf -#define FILE_EA_TYPE_MVST 0xffde -#define FILE_EA_TYPE_ASN1 0xffdd -#define FILE_EA_TYPE_FAMILY_IDS 0xff01 - - -// -// Define the file notification information structure -// - -typedef struct _FILE_NOTIFY_INFORMATION { - ULONG NextEntryOffset; - ULONG Action; - ULONG FileNameLength; - WCHAR FileName[1]; -} FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION; - - -// -// NtQueryDirectoryFile return types: -// -// FILE_DIRECTORY_INFORMATION -// FILE_FULL_DIR_INFORMATION -// FILE_ID_FULL_DIR_INFORMATION -// FILE_BOTH_DIR_INFORMATION -// FILE_ID_BOTH_DIR_INFORMATION -// FILE_NAMES_INFORMATION -// FILE_OBJECTID_INFORMATION -// - -typedef struct _FILE_DIRECTORY_INFORMATION { - ULONG NextEntryOffset; - ULONG FileIndex; - LARGE_INTEGER CreationTime; - LARGE_INTEGER LastAccessTime; - LARGE_INTEGER LastWriteTime; - LARGE_INTEGER ChangeTime; - LARGE_INTEGER EndOfFile; - LARGE_INTEGER AllocationSize; - ULONG FileAttributes; - ULONG FileNameLength; - WCHAR FileName[1]; -} FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION; - -typedef struct _FILE_FULL_DIR_INFORMATION { - ULONG NextEntryOffset; - ULONG FileIndex; - LARGE_INTEGER CreationTime; - LARGE_INTEGER LastAccessTime; - LARGE_INTEGER LastWriteTime; - LARGE_INTEGER ChangeTime; - LARGE_INTEGER EndOfFile; - LARGE_INTEGER AllocationSize; - ULONG FileAttributes; - ULONG FileNameLength; - ULONG EaSize; - WCHAR FileName[1]; -} FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION; - -typedef struct _FILE_ID_FULL_DIR_INFORMATION { - ULONG NextEntryOffset; - ULONG FileIndex; - LARGE_INTEGER CreationTime; - LARGE_INTEGER LastAccessTime; - LARGE_INTEGER LastWriteTime; - LARGE_INTEGER ChangeTime; - LARGE_INTEGER EndOfFile; - LARGE_INTEGER AllocationSize; - ULONG FileAttributes; - ULONG FileNameLength; - ULONG EaSize; - LARGE_INTEGER FileId; - WCHAR FileName[1]; -} FILE_ID_FULL_DIR_INFORMATION, *PFILE_ID_FULL_DIR_INFORMATION; - -typedef struct _FILE_BOTH_DIR_INFORMATION { - ULONG NextEntryOffset; - ULONG FileIndex; - LARGE_INTEGER CreationTime; - LARGE_INTEGER LastAccessTime; - LARGE_INTEGER LastWriteTime; - LARGE_INTEGER ChangeTime; - LARGE_INTEGER EndOfFile; - LARGE_INTEGER AllocationSize; - ULONG FileAttributes; - ULONG FileNameLength; - ULONG EaSize; - CCHAR ShortNameLength; - WCHAR ShortName[12]; - WCHAR FileName[1]; -} FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION; - -typedef struct _FILE_ID_BOTH_DIR_INFORMATION { - ULONG NextEntryOffset; - ULONG FileIndex; - LARGE_INTEGER CreationTime; - LARGE_INTEGER LastAccessTime; - LARGE_INTEGER LastWriteTime; - LARGE_INTEGER ChangeTime; - LARGE_INTEGER EndOfFile; - LARGE_INTEGER AllocationSize; - ULONG FileAttributes; - ULONG FileNameLength; - ULONG EaSize; - CCHAR ShortNameLength; - WCHAR ShortName[12]; - LARGE_INTEGER FileId; - WCHAR FileName[1]; -} FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION; - -typedef struct _FILE_NAMES_INFORMATION { - ULONG NextEntryOffset; - ULONG FileIndex; - ULONG FileNameLength; - WCHAR FileName[1]; -} FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION; - -typedef struct _FILE_ID_GLOBAL_TX_DIR_INFORMATION { - ULONG NextEntryOffset; - ULONG FileIndex; - LARGE_INTEGER CreationTime; - LARGE_INTEGER LastAccessTime; - LARGE_INTEGER LastWriteTime; - LARGE_INTEGER ChangeTime; - LARGE_INTEGER EndOfFile; - LARGE_INTEGER AllocationSize; - ULONG FileAttributes; - ULONG FileNameLength; - LARGE_INTEGER FileId; - GUID LockingTransactionId; - ULONG TxInfoFlags; - WCHAR FileName[1]; -} FILE_ID_GLOBAL_TX_DIR_INFORMATION, *PFILE_ID_GLOBAL_TX_DIR_INFORMATION; - -#define FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_WRITELOCKED 0x00000001 -#define FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_VISIBLE_TO_TX 0x00000002 -#define FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_VISIBLE_OUTSIDE_TX 0x00000004 - -typedef struct _FILE_OBJECTID_INFORMATION { - LONGLONG FileReference; - UCHAR ObjectId[16]; - union { - struct { - UCHAR BirthVolumeId[16]; - UCHAR BirthObjectId[16]; - UCHAR DomainId[16]; - } DUMMYSTRUCTNAME; - UCHAR ExtendedInfo[48]; - } DUMMYUNIONNAME; -} FILE_OBJECTID_INFORMATION, *PFILE_OBJECTID_INFORMATION; - -// -// The following constants provide addition meta characters to fully -// support the more obscure aspects of DOS wild card processing. -// - -#define ANSI_DOS_STAR ('<') -#define ANSI_DOS_QM ('>') -#define ANSI_DOS_DOT ('"') - -#define DOS_STAR (L'<') -#define DOS_QM (L'>') -#define DOS_DOT (L'"') - -// -// NtQuery(Set)InformationFile return types: -// -// FILE_BASIC_INFORMATION -// FILE_STANDARD_INFORMATION -// FILE_INTERNAL_INFORMATION -// FILE_EA_INFORMATION -// FILE_ACCESS_INFORMATION -// FILE_POSITION_INFORMATION -// FILE_MODE_INFORMATION -// FILE_ALIGNMENT_INFORMATION -// FILE_NAME_INFORMATION -// FILE_ALL_INFORMATION -// -// FILE_NETWORK_OPEN_INFORMATION -// -// FILE_ALLOCATION_INFORMATION -// FILE_COMPRESSION_INFORMATION -// FILE_DISPOSITION_INFORMATION -// FILE_END_OF_FILE_INFORMATION -// FILE_LINK_INFORMATION -// FILE_MOVE_CLUSTER_INFORMATION -// FILE_RENAME_INFORMATION -// FILE_SHORT_NAME_INFORMATION -// FILE_STREAM_INFORMATION -// FILE_COMPLETION_INFORMATION -// -// FILE_PIPE_INFORMATION -// FILE_PIPE_LOCAL_INFORMATION -// FILE_PIPE_REMOTE_INFORMATION -// -// FILE_MAILSLOT_QUERY_INFORMATION -// FILE_MAILSLOT_SET_INFORMATION -// FILE_REPARSE_POINT_INFORMATION -// -// FILE_NETWORK_PHYSICAL_NAME_INFORMATION -// - - -typedef struct _FILE_INTERNAL_INFORMATION { - LARGE_INTEGER IndexNumber; -} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION; - -typedef struct _FILE_EA_INFORMATION { - ULONG EaSize; -} FILE_EA_INFORMATION, *PFILE_EA_INFORMATION; - -typedef struct _FILE_ACCESS_INFORMATION { - ACCESS_MASK AccessFlags; -} FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION; - -typedef struct _FILE_MODE_INFORMATION { - ULONG Mode; -} FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION; - -typedef struct _FILE_ALL_INFORMATION { - FILE_BASIC_INFORMATION BasicInformation; - FILE_STANDARD_INFORMATION StandardInformation; - FILE_INTERNAL_INFORMATION InternalInformation; - FILE_EA_INFORMATION EaInformation; - FILE_ACCESS_INFORMATION AccessInformation; - FILE_POSITION_INFORMATION PositionInformation; - FILE_MODE_INFORMATION ModeInformation; - FILE_ALIGNMENT_INFORMATION AlignmentInformation; - FILE_NAME_INFORMATION NameInformation; -} FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION; - - -typedef struct _FILE_ALLOCATION_INFORMATION { - LARGE_INTEGER AllocationSize; -} FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION; - - -typedef struct _FILE_COMPRESSION_INFORMATION { - LARGE_INTEGER CompressedFileSize; - USHORT CompressionFormat; - UCHAR CompressionUnitShift; - UCHAR ChunkShift; - UCHAR ClusterShift; - UCHAR Reserved[3]; -} FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION; - - -#ifdef _MAC -#pragma warning( disable : 4121) -#endif - -typedef struct _FILE_LINK_INFORMATION { - BOOLEAN ReplaceIfExists; - HANDLE RootDirectory; - ULONG FileNameLength; - WCHAR FileName[1]; -} FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION; - - -#ifdef _MAC -#pragma warning( default : 4121 ) -#endif - -typedef struct _FILE_MOVE_CLUSTER_INFORMATION { - ULONG ClusterCount; - HANDLE RootDirectory; - ULONG FileNameLength; - WCHAR FileName[1]; -} FILE_MOVE_CLUSTER_INFORMATION, *PFILE_MOVE_CLUSTER_INFORMATION; - -#ifdef _MAC -#pragma warning( disable : 4121) -#endif - -typedef struct _FILE_RENAME_INFORMATION { - BOOLEAN ReplaceIfExists; - HANDLE RootDirectory; - ULONG FileNameLength; - WCHAR FileName[1]; -} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION; - -#ifdef _MAC -#pragma warning( default : 4121 ) -#endif - -typedef struct _FILE_STREAM_INFORMATION { - ULONG NextEntryOffset; - ULONG StreamNameLength; - LARGE_INTEGER StreamSize; - LARGE_INTEGER StreamAllocationSize; - WCHAR StreamName[1]; -} FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION; - -typedef struct _FILE_TRACKING_INFORMATION { - HANDLE DestinationFile; - ULONG ObjectInformationLength; - CHAR ObjectInformation[1]; -} FILE_TRACKING_INFORMATION, *PFILE_TRACKING_INFORMATION; - -typedef struct _FILE_COMPLETION_INFORMATION { - HANDLE Port; - PVOID Key; -} FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION; - -typedef struct _FILE_PIPE_INFORMATION { - ULONG ReadMode; - ULONG CompletionMode; -} FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION; - -typedef struct _FILE_PIPE_LOCAL_INFORMATION { - ULONG NamedPipeType; - ULONG NamedPipeConfiguration; - ULONG MaximumInstances; - ULONG CurrentInstances; - ULONG InboundQuota; - ULONG ReadDataAvailable; - ULONG OutboundQuota; - ULONG WriteQuotaAvailable; - ULONG NamedPipeState; - ULONG NamedPipeEnd; -} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION; - -typedef struct _FILE_PIPE_REMOTE_INFORMATION { - LARGE_INTEGER CollectDataTime; - ULONG MaximumCollectionCount; -} FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION; - - -typedef struct _FILE_MAILSLOT_QUERY_INFORMATION { - ULONG MaximumMessageSize; - ULONG MailslotQuota; - ULONG NextMessageSize; - ULONG MessagesAvailable; - LARGE_INTEGER ReadTimeout; -} FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION; - -typedef struct _FILE_MAILSLOT_SET_INFORMATION { - PLARGE_INTEGER ReadTimeout; -} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION; - -typedef struct _FILE_REPARSE_POINT_INFORMATION { - LONGLONG FileReference; - ULONG Tag; -} FILE_REPARSE_POINT_INFORMATION, *PFILE_REPARSE_POINT_INFORMATION; - -typedef struct _FILE_LINK_ENTRY_INFORMATION { - ULONG NextEntryOffset; - LONGLONG ParentFileId; - ULONG FileNameLength; - WCHAR FileName[1]; -} FILE_LINK_ENTRY_INFORMATION, *PFILE_LINK_ENTRY_INFORMATION; - -typedef struct _FILE_LINKS_INFORMATION { - ULONG BytesNeeded; - ULONG EntriesReturned; - FILE_LINK_ENTRY_INFORMATION Entry; -} FILE_LINKS_INFORMATION, *PFILE_LINKS_INFORMATION; - -typedef struct _FILE_NETWORK_PHYSICAL_NAME_INFORMATION { - ULONG FileNameLength; - WCHAR FileName[1]; -} FILE_NETWORK_PHYSICAL_NAME_INFORMATION, *PFILE_NETWORK_PHYSICAL_NAME_INFORMATION; - -typedef struct _FILE_STANDARD_LINK_INFORMATION { - ULONG NumberOfAccessibleLinks; - ULONG TotalNumberOfLinks; - BOOLEAN DeletePending; - BOOLEAN Directory; -} FILE_STANDARD_LINK_INFORMATION, *PFILE_STANDARD_LINK_INFORMATION; - -// -// NtQuery(Set)EaFile -// -// The offset for the start of EaValue is EaName[EaNameLength + 1] -// -// begin_wdm - - -typedef struct _FILE_GET_EA_INFORMATION { - ULONG NextEntryOffset; - UCHAR EaNameLength; - CHAR EaName[1]; -} FILE_GET_EA_INFORMATION, *PFILE_GET_EA_INFORMATION; - - -// -// File Remote protocol information (FileRemoteProtocolInformation) -// - -#define REMOTE_PROTOCOL_FLAG_LOOPBACK 0x00000001 -#define REMOTE_PROTOCOL_FLAG_OFFLINE 0x00000002 - -typedef struct _FILE_REMOTE_PROTOCOL_INFORMATION -{ - // Structure Version - USHORT StructureVersion; // 1 - USHORT StructureSize; // sizeof(FILE_REMOTE_PROTOCOL_INFORMATION) - - ULONG Protocol; // Protocol (WNNC_NET_*) defined in winnetwk.h or ntifs.h. - - // Protocol Version & Type - USHORT ProtocolMajorVersion; - USHORT ProtocolMinorVersion; - USHORT ProtocolRevision; - - USHORT Reserved; - - // Protocol-Generic Information - ULONG Flags; - - struct { - ULONG Reserved[8]; - } GenericReserved; - - // Protocol specific information - - struct { - ULONG Reserved[16]; - } ProtocolSpecificReserved; - -} FILE_REMOTE_PROTOCOL_INFORMATION, *PFILE_REMOTE_PROTOCOL_INFORMATION; - -// -// NtQuery(Set)QuotaInformationFile -// - -typedef struct _FILE_GET_QUOTA_INFORMATION { - ULONG NextEntryOffset; - ULONG SidLength; - SID Sid; -} FILE_GET_QUOTA_INFORMATION, *PFILE_GET_QUOTA_INFORMATION; - -typedef struct _FILE_QUOTA_INFORMATION { - ULONG NextEntryOffset; - ULONG SidLength; - LARGE_INTEGER ChangeTime; - LARGE_INTEGER QuotaUsed; - LARGE_INTEGER QuotaThreshold; - LARGE_INTEGER QuotaLimit; - SID Sid; -} FILE_QUOTA_INFORMATION, *PFILE_QUOTA_INFORMATION; - - -typedef struct _FILE_FS_ATTRIBUTE_INFORMATION { - ULONG FileSystemAttributes; - LONG MaximumComponentNameLength; - ULONG FileSystemNameLength; - WCHAR FileSystemName[1]; -} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION; - -typedef struct _FILE_FS_DRIVER_PATH_INFORMATION { - BOOLEAN DriverInPath; - ULONG DriverNameLength; - WCHAR DriverName[1]; -} FILE_FS_DRIVER_PATH_INFORMATION, *PFILE_FS_DRIVER_PATH_INFORMATION; - -typedef struct _FILE_FS_VOLUME_FLAGS_INFORMATION { - ULONG Flags; -} FILE_FS_VOLUME_FLAGS_INFORMATION, *PFILE_FS_VOLUME_FLAGS_INFORMATION; - -// -// File system control flags -// - -#define FILE_VC_QUOTA_NONE 0x00000000 -#define FILE_VC_QUOTA_TRACK 0x00000001 -#define FILE_VC_QUOTA_ENFORCE 0x00000002 -#define FILE_VC_QUOTA_MASK 0x00000003 - -#define FILE_VC_CONTENT_INDEX_DISABLED 0x00000008 - -#define FILE_VC_LOG_QUOTA_THRESHOLD 0x00000010 -#define FILE_VC_LOG_QUOTA_LIMIT 0x00000020 -#define FILE_VC_LOG_VOLUME_THRESHOLD 0x00000040 -#define FILE_VC_LOG_VOLUME_LIMIT 0x00000080 - -#define FILE_VC_QUOTAS_INCOMPLETE 0x00000100 -#define FILE_VC_QUOTAS_REBUILDING 0x00000200 - -#define FILE_VC_VALID_MASK 0x000003ff - -typedef struct _FILE_FS_CONTROL_INFORMATION { - LARGE_INTEGER FreeSpaceStartFiltering; - LARGE_INTEGER FreeSpaceThreshold; - LARGE_INTEGER FreeSpaceStopFiltering; - LARGE_INTEGER DefaultQuotaThreshold; - LARGE_INTEGER DefaultQuotaLimit; - ULONG FileSystemControlFlags; -} FILE_FS_CONTROL_INFORMATION, *PFILE_FS_CONTROL_INFORMATION; - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtCreateFile ( - __out PHANDLE FileHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_opt PLARGE_INTEGER AllocationSize, - __in ULONG FileAttributes, - __in ULONG ShareAccess, - __in ULONG CreateDisposition, - __in ULONG CreateOptions, - __in_bcount_opt(EaLength) PVOID EaBuffer, - __in ULONG EaLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtDeviceIoControlFile ( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in ULONG IoControlCode, - __in_bcount_opt(InputBufferLength) PVOID InputBuffer, - __in ULONG InputBufferLength, - __out_bcount_opt(OutputBufferLength) PVOID OutputBuffer, - __in ULONG OutputBufferLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtFsControlFile ( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in ULONG FsControlCode, - __in_bcount_opt(InputBufferLength) PVOID InputBuffer, - __in ULONG InputBufferLength, - __out_bcount_opt(OutputBufferLength) PVOID OutputBuffer, - __in ULONG OutputBufferLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtLockFile ( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in PLARGE_INTEGER ByteOffset, - __in PLARGE_INTEGER Length, - __in ULONG Key, - __in BOOLEAN FailImmediately, - __in BOOLEAN ExclusiveLock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtOpenFile ( - __out PHANDLE FileHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in ULONG ShareAccess, - __in ULONG OpenOptions - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtQueryDirectoryFile ( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __out_bcount(Length) PVOID FileInformation, - __in ULONG Length, - __in FILE_INFORMATION_CLASS FileInformationClass, - __in BOOLEAN ReturnSingleEntry, - __in_opt PUNICODE_STRING FileName, - __in BOOLEAN RestartScan - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtQueryInformationFile ( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __out_bcount(Length) PVOID FileInformation, - __in ULONG Length, - __in FILE_INFORMATION_CLASS FileInformationClass - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtQueryQuotaInformationFile ( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __out_bcount(Length) PVOID Buffer, - __in ULONG Length, - __in BOOLEAN ReturnSingleEntry, - __in_bcount_opt(SidListLength) PVOID SidList, - __in ULONG SidListLength, - __in_opt PSID StartSid, - __in BOOLEAN RestartScan - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtQueryVolumeInformationFile ( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __out_bcount(Length) PVOID FsInformation, - __in ULONG Length, - __in FS_INFORMATION_CLASS FsInformationClass - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtReadFile ( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __out_bcount(Length) PVOID Buffer, - __in ULONG Length, - __in_opt PLARGE_INTEGER ByteOffset, - __in_opt PULONG Key - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtSetInformationFile ( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_bcount(Length) PVOID FileInformation, - __in ULONG Length, - __in FILE_INFORMATION_CLASS FileInformationClass - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtSetQuotaInformationFile ( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_bcount(Length) PVOID Buffer, - __in ULONG Length - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtSetVolumeInformationFile ( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_bcount(Length) PVOID FsInformation, - __in ULONG Length, - __in FS_INFORMATION_CLASS FsInformationClass - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtWriteFile ( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_bcount(Length) PVOID Buffer, - __in ULONG Length, - __in_opt PLARGE_INTEGER ByteOffset, - __in_opt PULONG Key - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtUnlockFile ( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in PLARGE_INTEGER ByteOffset, - __in PLARGE_INTEGER Length, - __in ULONG Key - ); -#endif - -// -// 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. -// -// These macros are defined in devioctl.h which contains the portable IO -// definitions (for use by both DOS and NT) -// - -// -// The IoGetFunctionCodeFromCtlCode( ControlCode ) Macro is defined in io.h -// This macro is used to extract the function code from an IOCTL (or FSCTL). -// The macro can only be used in kernel mode code. -// - -// -// General File System control codes - Note that these values are valid -// regardless of the actual file system type -// - -// -// IMPORTANT: These values have been arranged in order of increasing -// control codes. Do NOT breaks this!! Add all new codes -// at end of list regardless of functionality type. -// -// Note: FSCTL_QUERY_RETRIEVAL_POINTER and FSCTL_MARK_AS_SYSTEM_HIVE only -// work from Kernel mode on local paging files or the system hives. -// - -// begin_winioctl - -#ifndef _FILESYSTEMFSCTL_ -#define _FILESYSTEMFSCTL_ - -// -// The following is a list of the native file system fsctls followed by -// additional network file system fsctls. Some values have been -// decommissioned. -// - -#define FSCTL_REQUEST_OPLOCK_LEVEL_1 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_REQUEST_OPLOCK_LEVEL_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 1, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_REQUEST_BATCH_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_OPLOCK_BREAK_ACKNOWLEDGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 3, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_OPBATCH_ACK_CLOSE_PENDING CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 4, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_OPLOCK_BREAK_NOTIFY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 5, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS) -// decommissioned fsctl value 9 -#define FSCTL_IS_VOLUME_MOUNTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 10, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_IS_PATHNAME_VALID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 11, METHOD_BUFFERED, FILE_ANY_ACCESS) // PATHNAME_BUFFER, -#define FSCTL_MARK_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) -// decommissioned fsctl value 13 -#define FSCTL_QUERY_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 14, METHOD_NEITHER, FILE_ANY_ACCESS) -#define FSCTL_GET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_SET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA) -// decommissioned fsctl value 17 -// decommissioned fsctl value 18 -#define FSCTL_SET_BOOTLOADER_ACCESSED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 19, METHOD_NEITHER, FILE_ANY_ACCESS) -#define FSCTL_OPLOCK_BREAK_ACK_NO_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 20, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_INVALIDATE_VOLUMES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 21, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_QUERY_FAT_BPB CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 22, METHOD_BUFFERED, FILE_ANY_ACCESS) // FSCTL_QUERY_FAT_BPB_BUFFER -#define FSCTL_REQUEST_FILTER_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 23, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS) // FILESYSTEM_STATISTICS - -#if (_WIN32_WINNT >= 0x0400) -#define FSCTL_GET_NTFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 25, METHOD_BUFFERED, FILE_ANY_ACCESS) // NTFS_VOLUME_DATA_BUFFER -#define FSCTL_GET_NTFS_FILE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 26, METHOD_BUFFERED, FILE_ANY_ACCESS) // NTFS_FILE_RECORD_INPUT_BUFFER, NTFS_FILE_RECORD_OUTPUT_BUFFER -#define FSCTL_GET_VOLUME_BITMAP CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 27, METHOD_NEITHER, FILE_ANY_ACCESS) // STARTING_LCN_INPUT_BUFFER, VOLUME_BITMAP_BUFFER -#define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 28, METHOD_NEITHER, FILE_ANY_ACCESS) // STARTING_VCN_INPUT_BUFFER, RETRIEVAL_POINTERS_BUFFER -#define FSCTL_MOVE_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) // MOVE_FILE_DATA, -#define FSCTL_IS_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS) -// decomissioned fsctl value 31 -#define FSCTL_ALLOW_EXTENDED_DASD_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 32, METHOD_NEITHER, FILE_ANY_ACCESS) -#endif /* _WIN32_WINNT >= 0x0400 */ - -#if (_WIN32_WINNT >= 0x0500) -// decommissioned fsctl value 33 -// decommissioned fsctl value 34 -#define FSCTL_FIND_FILES_BY_SID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 35, METHOD_NEITHER, FILE_ANY_ACCESS) -// decommissioned fsctl value 36 -// decommissioned fsctl value 37 -#define FSCTL_SET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 38, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) // FILE_OBJECTID_BUFFER -#define FSCTL_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 39, METHOD_BUFFERED, FILE_ANY_ACCESS) // FILE_OBJECTID_BUFFER -#define FSCTL_DELETE_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 40, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) -#define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) // REPARSE_DATA_BUFFER, -#define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) // REPARSE_DATA_BUFFER -#define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) // REPARSE_DATA_BUFFER, -#define FSCTL_ENUM_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 44, METHOD_NEITHER, FILE_ANY_ACCESS) // MFT_ENUM_DATA, -#define FSCTL_SECURITY_ID_CHECK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 45, METHOD_NEITHER, FILE_READ_DATA) // BULK_SECURITY_TEST_DATA, -#define FSCTL_READ_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 46, METHOD_NEITHER, FILE_ANY_ACCESS) // READ_USN_JOURNAL_DATA, USN -#define FSCTL_SET_OBJECT_ID_EXTENDED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 47, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) -#define FSCTL_CREATE_OR_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 48, METHOD_BUFFERED, FILE_ANY_ACCESS) // FILE_OBJECTID_BUFFER -#define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) -#define FSCTL_SET_ZERO_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, FILE_WRITE_DATA) // FILE_ZERO_DATA_INFORMATION, -#define FSCTL_QUERY_ALLOCATED_RANGES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 51, METHOD_NEITHER, FILE_READ_DATA) // FILE_ALLOCATED_RANGE_BUFFER, FILE_ALLOCATED_RANGE_BUFFER -#define FSCTL_ENABLE_UPGRADE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 52, METHOD_BUFFERED, FILE_WRITE_DATA) -// decommissioned fsctl value 52 -#define FSCTL_SET_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 53, METHOD_NEITHER, FILE_ANY_ACCESS) // ENCRYPTION_BUFFER, DECRYPTION_STATUS_BUFFER -#define FSCTL_ENCRYPTION_FSCTL_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 54, METHOD_NEITHER, FILE_ANY_ACCESS) -#define FSCTL_WRITE_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 55, METHOD_NEITHER, FILE_SPECIAL_ACCESS) // ENCRYPTED_DATA_INFO, EXTENDED_ENCRYPTED_DATA_INFO -#define FSCTL_READ_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 56, METHOD_NEITHER, FILE_SPECIAL_ACCESS) // REQUEST_RAW_ENCRYPTED_DATA, ENCRYPTED_DATA_INFO, EXTENDED_ENCRYPTED_DATA_INFO -#define FSCTL_CREATE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 57, METHOD_NEITHER, FILE_ANY_ACCESS) // CREATE_USN_JOURNAL_DATA, -#define FSCTL_READ_FILE_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 58, METHOD_NEITHER, FILE_ANY_ACCESS) // Read the Usn Record for a file -#define FSCTL_WRITE_USN_CLOSE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 59, METHOD_NEITHER, FILE_ANY_ACCESS) // Generate Close Usn Record -#define FSCTL_EXTEND_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_QUERY_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 61, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_DELETE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 62, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_MARK_HANDLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 63, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_SIS_COPYFILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 64, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_SIS_LINK_FILES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 65, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA) -// decommissional fsctl value 66 -// decommissioned fsctl value 67 -// decommissioned fsctl value 68 -#define FSCTL_RECALL_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 69, METHOD_NEITHER, FILE_ANY_ACCESS) -// decommissioned fsctl value 70 -#define FSCTL_READ_FROM_PLEX CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 71, METHOD_OUT_DIRECT, FILE_READ_DATA) -#define FSCTL_FILE_PREFETCH CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 72, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) // FILE_PREFETCH -#endif /* _WIN32_WINNT >= 0x0500 */ - -#if (_WIN32_WINNT >= 0x0600) -#define FSCTL_MAKE_MEDIA_COMPATIBLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 76, METHOD_BUFFERED, FILE_WRITE_DATA) // UDFS R/W -#define FSCTL_SET_DEFECT_MANAGEMENT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 77, METHOD_BUFFERED, FILE_WRITE_DATA) // UDFS R/W -#define FSCTL_QUERY_SPARING_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 78, METHOD_BUFFERED, FILE_ANY_ACCESS) // UDFS R/W -#define FSCTL_QUERY_ON_DISK_VOLUME_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 79, METHOD_BUFFERED, FILE_ANY_ACCESS) // C/UDFS -#define FSCTL_SET_VOLUME_COMPRESSION_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 80, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) // VOLUME_COMPRESSION_STATE -// decommissioned fsctl value 80 -#define FSCTL_TXFS_MODIFY_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 81, METHOD_BUFFERED, FILE_WRITE_DATA) // TxF -#define FSCTL_TXFS_QUERY_RM_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 82, METHOD_BUFFERED, FILE_READ_DATA) // TxF -// decommissioned fsctl value 83 -#define FSCTL_TXFS_ROLLFORWARD_REDO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 84, METHOD_BUFFERED, FILE_WRITE_DATA) // TxF -#define FSCTL_TXFS_ROLLFORWARD_UNDO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 85, METHOD_BUFFERED, FILE_WRITE_DATA) // TxF -#define FSCTL_TXFS_START_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 86, METHOD_BUFFERED, FILE_WRITE_DATA) // TxF -#define FSCTL_TXFS_SHUTDOWN_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 87, METHOD_BUFFERED, FILE_WRITE_DATA) // TxF -#define FSCTL_TXFS_READ_BACKUP_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 88, METHOD_BUFFERED, FILE_READ_DATA) // TxF -#define FSCTL_TXFS_WRITE_BACKUP_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 89, METHOD_BUFFERED, FILE_WRITE_DATA) // TxF -#define FSCTL_TXFS_CREATE_SECONDARY_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 90, METHOD_BUFFERED, FILE_WRITE_DATA) // TxF -#define FSCTL_TXFS_GET_METADATA_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 91, METHOD_BUFFERED, FILE_READ_DATA) // TxF -#define FSCTL_TXFS_GET_TRANSACTED_VERSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 92, METHOD_BUFFERED, FILE_READ_DATA) // TxF -// decommissioned fsctl value 93 -#define FSCTL_TXFS_SAVEPOINT_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 94, METHOD_BUFFERED, FILE_WRITE_DATA) // TxF -#define FSCTL_TXFS_CREATE_MINIVERSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 95, METHOD_BUFFERED, FILE_WRITE_DATA) // TxF -// decommissioned fsctl value 96 -// decommissioned fsctl value 97 -// decommissioned fsctl value 98 -#define FSCTL_TXFS_TRANSACTION_ACTIVE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 99, METHOD_BUFFERED, FILE_READ_DATA) // TxF -#define FSCTL_SET_ZERO_ON_DEALLOCATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 101, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) -#define FSCTL_SET_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 102, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_GET_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 103, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_WAIT_FOR_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 104, METHOD_BUFFERED, FILE_ANY_ACCESS) -// decommissioned fsctl value 105 -#define FSCTL_INITIATE_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 106, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_CSC_INTERNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 107, METHOD_NEITHER, FILE_ANY_ACCESS) // CSC internal implementation -#define FSCTL_SHRINK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 108, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) // SHRINK_VOLUME_INFORMATION -#define FSCTL_SET_SHORT_NAME_BEHAVIOR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 109, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_DFSR_SET_GHOST_HANDLE_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 110, METHOD_BUFFERED, FILE_ANY_ACCESS) - -// -// Values 111 - 119 are reserved for FSRM. -// - -#define FSCTL_TXFS_LIST_TRANSACTION_LOCKED_FILES \ - CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 120, METHOD_BUFFERED, FILE_READ_DATA) // TxF -#define FSCTL_TXFS_LIST_TRANSACTIONS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 121, METHOD_BUFFERED, FILE_READ_DATA) // TxF -#define FSCTL_QUERY_PAGEFILE_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 122, METHOD_BUFFERED, FILE_ANY_ACCESS) -#endif /* _WIN32_WINNT >= 0x0600 */ - -#if (_WIN32_WINNT >= 0x0600) -#define FSCTL_RESET_VOLUME_ALLOCATION_HINTS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 123, METHOD_BUFFERED, FILE_ANY_ACCESS) -#endif /* _WIN32_WINNT >= 0x0600 */ - -#if (_WIN32_WINNT >= 0x0601) -#define FSCTL_QUERY_DEPENDENT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 124, METHOD_BUFFERED, FILE_ANY_ACCESS) // Dependency File System Filter -#define FSCTL_SD_GLOBAL_CHANGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 125, METHOD_BUFFERED, FILE_ANY_ACCESS) // Update NTFS Security Descriptors -#endif /* _WIN32_WINNT >= 0x0601 */ - -#if (_WIN32_WINNT >= 0x0600) -#define FSCTL_TXFS_READ_BACKUP_INFORMATION2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 126, METHOD_BUFFERED, FILE_ANY_ACCESS) // TxF -#endif /* _WIN32_WINNT >= 0x0600 */ - -#if (_WIN32_WINNT >= 0x0601) -#define FSCTL_LOOKUP_STREAM_FROM_CLUSTER CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 127, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_TXFS_WRITE_BACKUP_INFORMATION2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 128, METHOD_BUFFERED, FILE_ANY_ACCESS) // TxF -#define FSCTL_FILE_TYPE_NOTIFICATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 129, METHOD_BUFFERED, FILE_ANY_ACCESS) -#endif - - -// -// Values 130 - 130 are available -// - -// -// Values 131 - 139 are reserved for FSRM. -// - -#if (_WIN32_WINNT >= 0x0601) -#define FSCTL_GET_BOOT_AREA_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 140, METHOD_BUFFERED, FILE_ANY_ACCESS) // BOOT_AREA_INFO -#define FSCTL_GET_RETRIEVAL_POINTER_BASE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 141, METHOD_BUFFERED, FILE_ANY_ACCESS) // RETRIEVAL_POINTER_BASE -#define FSCTL_SET_PERSISTENT_VOLUME_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 142, METHOD_BUFFERED, FILE_ANY_ACCESS) // FILE_FS_PERSISTENT_VOLUME_INFORMATION -#define FSCTL_QUERY_PERSISTENT_VOLUME_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 143, METHOD_BUFFERED, FILE_ANY_ACCESS) // FILE_FS_PERSISTENT_VOLUME_INFORMATION - -#define FSCTL_REQUEST_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 144, METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define FSCTL_CSV_TUNNEL_REQUEST CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 145, METHOD_BUFFERED, FILE_ANY_ACCESS) // CSV_TUNNEL_REQUEST -#define FSCTL_IS_CSV_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 146, METHOD_BUFFERED, FILE_ANY_ACCESS) // IS_CSV_FILE - -#define FSCTL_QUERY_FILE_SYSTEM_RECOGNITION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 147, METHOD_BUFFERED, FILE_ANY_ACCESS) // -#define FSCTL_CSV_GET_VOLUME_PATH_NAME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 148, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_CSV_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 149, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_CSV_GET_VOLUME_PATH_NAMES_FOR_VOLUME_NAME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 150, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_IS_FILE_ON_CSV_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 151, METHOD_BUFFERED, FILE_ANY_ACCESS) - -#endif /* _WIN32_WINNT >= 0x0601 */ - -#define FSCTL_MARK_AS_SYSTEM_HIVE FSCTL_SET_BOOTLOADER_ACCESSED - - -#if(_WIN32_WINNT >= 0x0601) - -// -// Structure for FSCTL_IS_CSV_FILE -// - -typedef struct _CSV_NAMESPACE_INFO { - - ULONG Version; - ULONG DeviceNumber; - LARGE_INTEGER StartingOffset; - ULONG SectorSize; - -} CSV_NAMESPACE_INFO, *PCSV_NAMESPACE_INFO; - -#define CSV_NAMESPACE_INFO_V1 (sizeof(CSV_NAMESPACE_INFO)) -#define CSV_INVALID_DEVICE_NUMBER 0xFFFFFFFF - -#endif /* _WIN32_WINNT >= 0x0601 */ - -// -// The following long list of structs are associated with the preceeding -// file system fsctls. -// - -// -// Structure for FSCTL_IS_PATHNAME_VALID -// - -typedef struct _PATHNAME_BUFFER { - - ULONG PathNameLength; - WCHAR Name[1]; - -} PATHNAME_BUFFER, *PPATHNAME_BUFFER; - -// -// Structure for FSCTL_QUERY_BPB_INFO -// - -typedef struct _FSCTL_QUERY_FAT_BPB_BUFFER { - - UCHAR First0x24BytesOfBootSector[0x24]; - -} FSCTL_QUERY_FAT_BPB_BUFFER, *PFSCTL_QUERY_FAT_BPB_BUFFER; - -#if (_WIN32_WINNT >= 0x0400) -// -// Structures for FSCTL_GET_NTFS_VOLUME_DATA. -// The user must pass the basic buffer below. Ntfs -// will return as many fields as available in the extended -// buffer which follows immediately after the VOLUME_DATA_BUFFER. -// - -typedef struct { - - LARGE_INTEGER VolumeSerialNumber; - LARGE_INTEGER NumberSectors; - LARGE_INTEGER TotalClusters; - LARGE_INTEGER FreeClusters; - LARGE_INTEGER TotalReserved; - ULONG BytesPerSector; - ULONG BytesPerCluster; - ULONG BytesPerFileRecordSegment; - ULONG ClustersPerFileRecordSegment; - LARGE_INTEGER MftValidDataLength; - LARGE_INTEGER MftStartLcn; - LARGE_INTEGER Mft2StartLcn; - LARGE_INTEGER MftZoneStart; - LARGE_INTEGER MftZoneEnd; - -} NTFS_VOLUME_DATA_BUFFER, *PNTFS_VOLUME_DATA_BUFFER; - -typedef struct { - - ULONG ByteCount; - - USHORT MajorVersion; - USHORT MinorVersion; - -} NTFS_EXTENDED_VOLUME_DATA, *PNTFS_EXTENDED_VOLUME_DATA; -#endif /* _WIN32_WINNT >= 0x0400 */ - -#if (_WIN32_WINNT >= 0x0400) -// -// Structure for FSCTL_GET_VOLUME_BITMAP -// - -typedef struct { - - LARGE_INTEGER StartingLcn; - -} STARTING_LCN_INPUT_BUFFER, *PSTARTING_LCN_INPUT_BUFFER; - -typedef struct { - - LARGE_INTEGER StartingLcn; - LARGE_INTEGER BitmapSize; - UCHAR Buffer[1]; - -} VOLUME_BITMAP_BUFFER, *PVOLUME_BITMAP_BUFFER; -#endif /* _WIN32_WINNT >= 0x0400 */ - -#if (_WIN32_WINNT >= 0x0400) -// -// Structure for FSCTL_GET_RETRIEVAL_POINTERS -// - -typedef struct { - - LARGE_INTEGER StartingVcn; - -} STARTING_VCN_INPUT_BUFFER, *PSTARTING_VCN_INPUT_BUFFER; - -typedef struct RETRIEVAL_POINTERS_BUFFER { - - ULONG ExtentCount; - LARGE_INTEGER StartingVcn; - struct { - LARGE_INTEGER NextVcn; - LARGE_INTEGER Lcn; - } Extents[1]; - -} RETRIEVAL_POINTERS_BUFFER, *PRETRIEVAL_POINTERS_BUFFER; -#endif /* _WIN32_WINNT >= 0x0400 */ - -#if (_WIN32_WINNT >= 0x0400) -// -// Structures for FSCTL_GET_NTFS_FILE_RECORD -// - -typedef struct { - - LARGE_INTEGER FileReferenceNumber; - -} NTFS_FILE_RECORD_INPUT_BUFFER, *PNTFS_FILE_RECORD_INPUT_BUFFER; - -typedef struct { - - LARGE_INTEGER FileReferenceNumber; - ULONG FileRecordLength; - UCHAR FileRecordBuffer[1]; - -} NTFS_FILE_RECORD_OUTPUT_BUFFER, *PNTFS_FILE_RECORD_OUTPUT_BUFFER; -#endif /* _WIN32_WINNT >= 0x0400 */ - -#if (_WIN32_WINNT >= 0x0400) -// -// Structure for FSCTL_MOVE_FILE -// - -typedef struct { - - HANDLE FileHandle; - LARGE_INTEGER StartingVcn; - LARGE_INTEGER StartingLcn; - ULONG ClusterCount; - -} MOVE_FILE_DATA, *PMOVE_FILE_DATA; - -typedef struct { - - HANDLE FileHandle; - LARGE_INTEGER SourceFileRecord; - LARGE_INTEGER TargetFileRecord; - -} MOVE_FILE_RECORD_DATA, *PMOVE_FILE_RECORD_DATA; - - -#if defined(_WIN64) -// -// 32/64 Bit thunking support structure -// - -typedef struct _MOVE_FILE_DATA32 { - - UINT32 FileHandle; - LARGE_INTEGER StartingVcn; - LARGE_INTEGER StartingLcn; - ULONG ClusterCount; - -} MOVE_FILE_DATA32, *PMOVE_FILE_DATA32; -#endif -#endif /* _WIN32_WINNT >= 0x0400 */ - -#if (_WIN32_WINNT >= 0x0500) -// -// Structures for FSCTL_FIND_FILES_BY_SID -// - -typedef struct { - ULONG Restart; - SID Sid; -} FIND_BY_SID_DATA, *PFIND_BY_SID_DATA; - -typedef struct { - ULONG NextEntryOffset; - ULONG FileIndex; - ULONG FileNameLength; - WCHAR FileName[1]; -} FIND_BY_SID_OUTPUT, *PFIND_BY_SID_OUTPUT; - -#endif /* _WIN32_WINNT >= 0x0500 */ - -#if (_WIN32_WINNT >= 0x0500) -// -// The following structures apply to Usn operations. -// - -// -// Structure for FSCTL_ENUM_USN_DATA -// - -typedef struct { - - ULONGLONG StartFileReferenceNumber; - USN LowUsn; - USN HighUsn; - -} MFT_ENUM_DATA, *PMFT_ENUM_DATA; - -// -// Structure for FSCTL_CREATE_USN_JOURNAL -// - -typedef struct { - - ULONGLONG MaximumSize; - ULONGLONG AllocationDelta; - -} CREATE_USN_JOURNAL_DATA, *PCREATE_USN_JOURNAL_DATA; - -// -// Structure for FSCTL_READ_USN_JOURNAL -// - -typedef struct { - - USN StartUsn; - ULONG ReasonMask; - ULONG ReturnOnlyOnClose; - ULONGLONG Timeout; - ULONGLONG BytesToWaitFor; - ULONGLONG UsnJournalID; - -} READ_USN_JOURNAL_DATA, *PREAD_USN_JOURNAL_DATA; - -// -// The initial Major.Minor version of the Usn record will be 2.0. -// In general, the MinorVersion may be changed if fields are added -// to this structure in such a way that the previous version of the -// software can still correctly the fields it knows about. The -// MajorVersion should only be changed if the previous version of -// any software using this structure would incorrectly handle new -// records due to structure changes. -// -// The first update to this will force the structure to version 2.0. -// This will add the extended information about the source as -// well as indicate the file name offset within the structure. -// -// The following structure is returned with these fsctls. -// -// FSCTL_READ_USN_JOURNAL -// FSCTL_READ_FILE_USN_DATA -// FSCTL_ENUM_USN_DATA -// - -typedef struct { - - ULONG RecordLength; - USHORT MajorVersion; - USHORT MinorVersion; - ULONGLONG FileReferenceNumber; - ULONGLONG ParentFileReferenceNumber; - USN Usn; - LARGE_INTEGER TimeStamp; - ULONG Reason; - ULONG SourceInfo; - ULONG SecurityId; - ULONG FileAttributes; - USHORT FileNameLength; - USHORT FileNameOffset; - WCHAR FileName[1]; - -} USN_RECORD, *PUSN_RECORD; - -#define USN_PAGE_SIZE (0x1000) - -#define USN_REASON_DATA_OVERWRITE (0x00000001) -#define USN_REASON_DATA_EXTEND (0x00000002) -#define USN_REASON_DATA_TRUNCATION (0x00000004) -#define USN_REASON_NAMED_DATA_OVERWRITE (0x00000010) -#define USN_REASON_NAMED_DATA_EXTEND (0x00000020) -#define USN_REASON_NAMED_DATA_TRUNCATION (0x00000040) -#define USN_REASON_FILE_CREATE (0x00000100) -#define USN_REASON_FILE_DELETE (0x00000200) -#define USN_REASON_EA_CHANGE (0x00000400) -#define USN_REASON_SECURITY_CHANGE (0x00000800) -#define USN_REASON_RENAME_OLD_NAME (0x00001000) -#define USN_REASON_RENAME_NEW_NAME (0x00002000) -#define USN_REASON_INDEXABLE_CHANGE (0x00004000) -#define USN_REASON_BASIC_INFO_CHANGE (0x00008000) -#define USN_REASON_HARD_LINK_CHANGE (0x00010000) -#define USN_REASON_COMPRESSION_CHANGE (0x00020000) -#define USN_REASON_ENCRYPTION_CHANGE (0x00040000) -#define USN_REASON_OBJECT_ID_CHANGE (0x00080000) -#define USN_REASON_REPARSE_POINT_CHANGE (0x00100000) -#define USN_REASON_STREAM_CHANGE (0x00200000) -#define USN_REASON_TRANSACTED_CHANGE (0x00400000) -#define USN_REASON_CLOSE (0x80000000) - -// -// Structure for FSCTL_QUERY_USN_JOUNAL -// - -typedef struct { - - ULONGLONG UsnJournalID; - USN FirstUsn; - USN NextUsn; - USN LowestValidUsn; - USN MaxUsn; - ULONGLONG MaximumSize; - ULONGLONG AllocationDelta; - -} USN_JOURNAL_DATA, *PUSN_JOURNAL_DATA; - -// -// Structure for FSCTL_DELETE_USN_JOURNAL -// - -typedef struct { - - ULONGLONG UsnJournalID; - ULONG DeleteFlags; - -} DELETE_USN_JOURNAL_DATA, *PDELETE_USN_JOURNAL_DATA; - -#define USN_DELETE_FLAG_DELETE (0x00000001) -#define USN_DELETE_FLAG_NOTIFY (0x00000002) - -#define USN_DELETE_VALID_FLAGS (0x00000003) - -// -// Structure for FSCTL_MARK_HANDLE -// - -typedef struct { - - ULONG UsnSourceInfo; - HANDLE VolumeHandle; - ULONG HandleInfo; - -} MARK_HANDLE_INFO, *PMARK_HANDLE_INFO; - -#if defined(_WIN64) -// -// 32/64 Bit thunking support structure -// - -typedef struct { - - ULONG UsnSourceInfo; - UINT32 VolumeHandle; - ULONG HandleInfo; - -} MARK_HANDLE_INFO32, *PMARK_HANDLE_INFO32; -#endif - -// -// Flags for the additional source information above. -// -// USN_SOURCE_DATA_MANAGEMENT - Service is not modifying the external view -// of any part of the file. Typical case is HSM moving data to -// and from external storage. -// -// USN_SOURCE_AUXILIARY_DATA - Service is not modifying the external view -// of the file with regard to the application that created this file. -// Can be used to add private data streams to a file. -// -// USN_SOURCE_REPLICATION_MANAGEMENT - Service is modifying a file to match -// the contents of the same file which exists in another member of the -// replica set. -// - -#define USN_SOURCE_DATA_MANAGEMENT (0x00000001) -#define USN_SOURCE_AUXILIARY_DATA (0x00000002) -#define USN_SOURCE_REPLICATION_MANAGEMENT (0x00000004) - -// -// Flags for the HandleInfo field above -// -// MARK_HANDLE_PROTECT_CLUSTERS - disallow any defragmenting (FSCTL_MOVE_FILE) until the -// the handle is closed -// -// MARK_HANDLE_TXF_SYSTEM_LOG - indicates that this stream is being used as the Txf -// log for an RM on the volume. Must be called in the kernel using -// IRP_MN_KERNEL_CALL. -// -// MARK_HANDLE_NOT_TXF_SYSTEM_LOG - indicates that this user is no longer using this -// object as a log file. -// - -#define MARK_HANDLE_PROTECT_CLUSTERS (0x00000001) -#define MARK_HANDLE_TXF_SYSTEM_LOG (0x00000004) -#define MARK_HANDLE_NOT_TXF_SYSTEM_LOG (0x00000008) - -#endif /* _WIN32_WINNT >= 0x0500 */ - -#if (_WIN32_WINNT >= 0x0601) - -#define MARK_HANDLE_REALTIME (0x00000020) -#define MARK_HANDLE_NOT_REALTIME (0x00000040) - -#define NO_8DOT3_NAME_PRESENT (0x00000001) -#define REMOVED_8DOT3_NAME (0x00000002) - -#define PERSISTENT_VOLUME_STATE_SHORT_NAME_CREATION_DISABLED (0x00000001) - -#endif /* _WIN32_WINNT >= 0x0601 */ - - -#if (_WIN32_WINNT >= 0x0500) -// -// Structure for FSCTL_SECURITY_ID_CHECK -// - -typedef struct { - - ACCESS_MASK DesiredAccess; - ULONG SecurityIds[1]; - -} BULK_SECURITY_TEST_DATA, *PBULK_SECURITY_TEST_DATA; -#endif /* _WIN32_WINNT >= 0x0500 */ - -#if (_WIN32_WINNT >= 0x0500) -// -// Output flags for the FSCTL_IS_VOLUME_DIRTY -// - -#define VOLUME_IS_DIRTY (0x00000001) -#define VOLUME_UPGRADE_SCHEDULED (0x00000002) -#define VOLUME_SESSION_OPEN (0x00000004) -#endif /* _WIN32_WINNT >= 0x0500 */ - -#if (_WIN32_WINNT >= 0x0500) -// -// Structures for FSCTL_FILE_PREFETCH -// - -typedef struct _FILE_PREFETCH { - ULONG Type; - ULONG Count; - ULONGLONG Prefetch[1]; -} FILE_PREFETCH, *PFILE_PREFETCH; - -typedef struct _FILE_PREFETCH_EX { - ULONG Type; - ULONG Count; - PVOID Context; - ULONGLONG Prefetch[1]; -} FILE_PREFETCH_EX, *PFILE_PREFETCH_EX; - -#define FILE_PREFETCH_TYPE_FOR_CREATE 0x1 -#define FILE_PREFETCH_TYPE_FOR_DIRENUM 0x2 -#define FILE_PREFETCH_TYPE_FOR_CREATE_EX 0x3 -#define FILE_PREFETCH_TYPE_FOR_DIRENUM_EX 0x4 - -#define FILE_PREFETCH_TYPE_MAX 0x4 - -#endif /* _WIN32_WINNT >= 0x0500 */ - -// -// Structures for FSCTL_FILESYSTEM_GET_STATISTICS -// -// Filesystem performance counters -// - -typedef struct _FILESYSTEM_STATISTICS { - - USHORT FileSystemType; - USHORT Version; // currently version 1 - - ULONG SizeOfCompleteStructure; // must by a mutiple of 64 bytes - - ULONG UserFileReads; - ULONG UserFileReadBytes; - ULONG UserDiskReads; - ULONG UserFileWrites; - ULONG UserFileWriteBytes; - ULONG UserDiskWrites; - - ULONG MetaDataReads; - ULONG MetaDataReadBytes; - ULONG MetaDataDiskReads; - ULONG MetaDataWrites; - ULONG MetaDataWriteBytes; - ULONG MetaDataDiskWrites; - - // - // The file system's private structure is appended here. - // - -} FILESYSTEM_STATISTICS, *PFILESYSTEM_STATISTICS; - -// values for FS_STATISTICS.FileSystemType - -#define FILESYSTEM_STATISTICS_TYPE_NTFS 1 -#define FILESYSTEM_STATISTICS_TYPE_FAT 2 -#define FILESYSTEM_STATISTICS_TYPE_EXFAT 3 - -// -// File System Specific Statistics Data -// - -typedef struct _FAT_STATISTICS { - ULONG CreateHits; - ULONG SuccessfulCreates; - ULONG FailedCreates; - - ULONG NonCachedReads; - ULONG NonCachedReadBytes; - ULONG NonCachedWrites; - ULONG NonCachedWriteBytes; - - ULONG NonCachedDiskReads; - ULONG NonCachedDiskWrites; -} FAT_STATISTICS, *PFAT_STATISTICS; - -typedef struct _EXFAT_STATISTICS { - ULONG CreateHits; - ULONG SuccessfulCreates; - ULONG FailedCreates; - - ULONG NonCachedReads; - ULONG NonCachedReadBytes; - ULONG NonCachedWrites; - ULONG NonCachedWriteBytes; - - ULONG NonCachedDiskReads; - ULONG NonCachedDiskWrites; -} EXFAT_STATISTICS, *PEXFAT_STATISTICS; - -typedef struct _NTFS_STATISTICS { - - ULONG LogFileFullExceptions; - ULONG OtherExceptions; - - // - // Other meta data io's - // - - ULONG MftReads; - ULONG MftReadBytes; - ULONG MftWrites; - ULONG MftWriteBytes; - struct { - USHORT Write; - USHORT Create; - USHORT SetInfo; - USHORT Flush; - } MftWritesUserLevel; - - USHORT MftWritesFlushForLogFileFull; - USHORT MftWritesLazyWriter; - USHORT MftWritesUserRequest; - - ULONG Mft2Writes; - ULONG Mft2WriteBytes; - struct { - USHORT Write; - USHORT Create; - USHORT SetInfo; - USHORT Flush; - } Mft2WritesUserLevel; - - USHORT Mft2WritesFlushForLogFileFull; - USHORT Mft2WritesLazyWriter; - USHORT Mft2WritesUserRequest; - - ULONG RootIndexReads; - ULONG RootIndexReadBytes; - ULONG RootIndexWrites; - ULONG RootIndexWriteBytes; - - ULONG BitmapReads; - ULONG BitmapReadBytes; - ULONG BitmapWrites; - ULONG BitmapWriteBytes; - - USHORT BitmapWritesFlushForLogFileFull; - USHORT BitmapWritesLazyWriter; - USHORT BitmapWritesUserRequest; - - struct { - USHORT Write; - USHORT Create; - USHORT SetInfo; - } BitmapWritesUserLevel; - - ULONG MftBitmapReads; - ULONG MftBitmapReadBytes; - ULONG MftBitmapWrites; - ULONG MftBitmapWriteBytes; - - USHORT MftBitmapWritesFlushForLogFileFull; - USHORT MftBitmapWritesLazyWriter; - USHORT MftBitmapWritesUserRequest; - - struct { - USHORT Write; - USHORT Create; - USHORT SetInfo; - USHORT Flush; - } MftBitmapWritesUserLevel; - - ULONG UserIndexReads; - ULONG UserIndexReadBytes; - ULONG UserIndexWrites; - ULONG UserIndexWriteBytes; - - // - // Additions for NT 5.0 - // - - ULONG LogFileReads; - ULONG LogFileReadBytes; - ULONG LogFileWrites; - ULONG LogFileWriteBytes; - - struct { - ULONG Calls; // number of individual calls to allocate clusters - ULONG Clusters; // number of clusters allocated - ULONG Hints; // number of times a hint was specified - - ULONG RunsReturned; // number of runs used to satisify all the requests - - ULONG HintsHonored; // number of times the hint was useful - ULONG HintsClusters; // number of clusters allocated via the hint - ULONG Cache; // number of times the cache was useful other than the hint - ULONG CacheClusters; // number of clusters allocated via the cache other than the hint - ULONG CacheMiss; // number of times the cache wasn't useful - ULONG CacheMissClusters; // number of clusters allocated without the cache - } Allocate; - -} NTFS_STATISTICS, *PNTFS_STATISTICS; - -#if (_WIN32_WINNT >= 0x0500) -// -// Structure for FSCTL_SET_OBJECT_ID, FSCTL_GET_OBJECT_ID, and FSCTL_CREATE_OR_GET_OBJECT_ID -// - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4201) // unnamed struct - -typedef struct _FILE_OBJECTID_BUFFER { - - // - // This is the portion of the object id that is indexed. - // - - UCHAR ObjectId[16]; - - // - // This portion of the object id is not indexed, it's just - // some metadata for the user's benefit. - // - - union { - struct { - UCHAR BirthVolumeId[16]; - UCHAR BirthObjectId[16]; - UCHAR DomainId[16]; - } DUMMYSTRUCTNAME; - UCHAR ExtendedInfo[48]; - } DUMMYUNIONNAME; - -} FILE_OBJECTID_BUFFER, *PFILE_OBJECTID_BUFFER; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning( default : 4201 ) /* nonstandard extension used : nameless struct/union */ -#endif - -#endif /* _WIN32_WINNT >= 0x0500 */ - - -#if (_WIN32_WINNT >= 0x0500) -// -// Structure for FSCTL_SET_SPARSE -// - -typedef struct _FILE_SET_SPARSE_BUFFER { - BOOLEAN SetSparse; -} FILE_SET_SPARSE_BUFFER, *PFILE_SET_SPARSE_BUFFER; - - -#endif /* _WIN32_WINNT >= 0x0500 */ - - -#if (_WIN32_WINNT >= 0x0500) -// -// Structure for FSCTL_SET_ZERO_DATA -// - -typedef struct _FILE_ZERO_DATA_INFORMATION { - - LARGE_INTEGER FileOffset; - LARGE_INTEGER BeyondFinalZero; - -} FILE_ZERO_DATA_INFORMATION, *PFILE_ZERO_DATA_INFORMATION; -#endif /* _WIN32_WINNT >= 0x0500 */ - -#if (_WIN32_WINNT >= 0x0500) -// -// Structure for FSCTL_QUERY_ALLOCATED_RANGES -// - -// -// Querying the allocated ranges requires an output buffer to store the -// allocated ranges and an input buffer to specify the range to query. -// The input buffer contains a single entry, the output buffer is an -// array of the following structure. -// - -typedef struct _FILE_ALLOCATED_RANGE_BUFFER { - - LARGE_INTEGER FileOffset; - LARGE_INTEGER Length; - -} FILE_ALLOCATED_RANGE_BUFFER, *PFILE_ALLOCATED_RANGE_BUFFER; -#endif /* _WIN32_WINNT >= 0x0500 */ - - -#if (_WIN32_WINNT >= 0x0500) -// -// Structures for FSCTL_SET_ENCRYPTION, FSCTL_WRITE_RAW_ENCRYPTED, and FSCTL_READ_RAW_ENCRYPTED -// - -// -// The input buffer to set encryption indicates whether we are to encrypt/decrypt a file -// or an individual stream. -// - -typedef struct _ENCRYPTION_BUFFER { - - ULONG EncryptionOperation; - UCHAR Private[1]; - -} ENCRYPTION_BUFFER, *PENCRYPTION_BUFFER; - -#define FILE_SET_ENCRYPTION 0x00000001 -#define FILE_CLEAR_ENCRYPTION 0x00000002 -#define STREAM_SET_ENCRYPTION 0x00000003 -#define STREAM_CLEAR_ENCRYPTION 0x00000004 - -#define MAXIMUM_ENCRYPTION_VALUE 0x00000004 - -// -// The optional output buffer to set encryption indicates that the last encrypted -// stream in a file has been marked as decrypted. -// - -typedef struct _DECRYPTION_STATUS_BUFFER { - - BOOLEAN NoEncryptedStreams; - -} DECRYPTION_STATUS_BUFFER, *PDECRYPTION_STATUS_BUFFER; - -#define ENCRYPTION_FORMAT_DEFAULT (0x01) - -#define COMPRESSION_FORMAT_SPARSE (0x4000) - -// -// Request Encrypted Data structure. This is used to indicate -// the range of the file to read. It also describes the -// output buffer used to return the data. -// - -typedef struct _REQUEST_RAW_ENCRYPTED_DATA { - - // - // Requested file offset and requested length to read. - // The fsctl will round the starting offset down - // to a file system boundary. It will also - // round the length up to a file system boundary. - // - - LONGLONG FileOffset; - ULONG Length; - -} REQUEST_RAW_ENCRYPTED_DATA, *PREQUEST_RAW_ENCRYPTED_DATA; - -// -// Encrypted Data Information structure. This structure -// is used to return raw encrypted data from a file in -// order to perform off-line recovery. The data will be -// encrypted or encrypted and compressed. The off-line -// service will need to use the encryption and compression -// format information to recover the file data. In the -// event that the data is both encrypted and compressed then -// the decryption must occur before decompression. All -// the data units below must be encrypted and compressed -// with the same format. -// -// The data will be returned in units. The data unit size -// will be fixed per request. If the data is compressed -// then the data unit size will be the compression unit size. -// -// This structure is at the beginning of the buffer used to -// return the encrypted data. The actual raw bytes from -// the file will follow this buffer. The offset of the -// raw bytes from the beginning of this structure is -// specified in the REQUEST_RAW_ENCRYPTED_DATA structure -// described above. -// - -typedef struct _ENCRYPTED_DATA_INFO { - - // - // This is the file offset for the first entry in the - // data block array. The file system will round - // the requested start offset down to a boundary - // that is consistent with the format of the file. - // - - ULONGLONG StartingFileOffset; - - // - // Data offset in output buffer. The output buffer - // begins with an ENCRYPTED_DATA_INFO structure. - // The file system will then store the raw bytes from - // disk beginning at the following offset within the - // output buffer. - // - - ULONG OutputBufferOffset; - - // - // The number of bytes being returned that are within - // the size of the file. If this value is less than - // (NumberOfDataBlocks << DataUnitShift), it means the - // end of the file occurs within this transfer. Any - // data beyond file size is invalid and was never - // passed to the encryption driver. - // - - ULONG BytesWithinFileSize; - - // - // The number of bytes being returned that are below - // valid data length. If this value is less than - // (NumberOfDataBlocks << DataUnitShift), it means the - // end of the valid data occurs within this transfer. - // After decrypting the data from this transfer, any - // byte(s) beyond valid data length must be zeroed. - // - - ULONG BytesWithinValidDataLength; - - // - // Code for the compression format as defined in - // ntrtl.h. Note that COMPRESSION_FORMAT_NONE - // and COMPRESSION_FORMAT_DEFAULT are invalid if - // any of the described chunks are compressed. - // - - USHORT CompressionFormat; - - // - // The DataUnit is the granularity used to access the - // disk. It will be the same as the compression unit - // size for a compressed file. For an uncompressed - // file, it will be some cluster-aligned power of 2 that - // the file system deems convenient. A caller should - // not expect that successive calls will have the - // same data unit shift value as the previous call. - // - // Since chunks and compression units are expected to be - // powers of 2 in size, we express them log2. So, for - // example (1 << ChunkShift) == ChunkSizeInBytes. The - // ClusterShift indicates how much space must be saved - // to successfully compress a compression unit - each - // successfully compressed data unit must occupy - // at least one cluster less in bytes than an uncompressed - // data block unit. - // - - UCHAR DataUnitShift; - UCHAR ChunkShift; - UCHAR ClusterShift; - - // - // The format for the encryption. - // - - UCHAR EncryptionFormat; - - // - // This is the number of entries in the data block size - // array. - // - - USHORT NumberOfDataBlocks; - - // - // This is an array of sizes in the data block array. There - // must be one entry in this array for each data block - // read from disk. The size has a different meaning - // depending on whether the file is compressed. - // - // A size of zero always indicates that the final data consists entirely - // of zeroes. There is no decryption or decompression to - // perform. - // - // If the file is compressed then the data block size indicates - // whether this block is compressed. A size equal to - // the block size indicates that the corresponding block did - // not compress. Any other non-zero size indicates the - // size of the compressed data which needs to be - // decrypted/decompressed. - // - // If the file is not compressed then the data block size - // indicates the amount of data within the block that - // needs to be decrypted. Any other non-zero size indicates - // that the remaining bytes in the data unit within the file - // consists of zeros. An example of this is when the - // the read spans the valid data length of the file. There - // is no data to decrypt past the valid data length. - // - - ULONG DataBlockSize[ANYSIZE_ARRAY]; - -} ENCRYPTED_DATA_INFO; -typedef ENCRYPTED_DATA_INFO *PENCRYPTED_DATA_INFO; -#endif /* _WIN32_WINNT >= 0x0500 */ - - -#if (_WIN32_WINNT >= 0x0500) -// -// FSCTL_READ_FROM_PLEX support -// Request Plex Read Data structure. This is used to indicate -// the range of the file to read. It also describes -// which plex to perform the read from. -// - -typedef struct _PLEX_READ_DATA_REQUEST { - - // - // Requested offset and length to read. - // The offset can be the virtual offset (vbo) in to a file, - // or a volume. In the case of a file offset, - // the fsd will round the starting offset down - // to a file system boundary. It will also - // round the length up to a file system boundary and - // enforce any other applicable limits. - // - - LARGE_INTEGER ByteOffset; - ULONG ByteLength; - ULONG PlexNumber; - -} PLEX_READ_DATA_REQUEST, *PPLEX_READ_DATA_REQUEST; -#endif /* _WIN32_WINNT >= 0x0500 */ - -#if (_WIN32_WINNT >= 0x0500) -// -// FSCTL_SIS_COPYFILE support -// Source and destination file names are passed in the FileNameBuffer. -// Both strings are null terminated, with the source name starting at -// the beginning of FileNameBuffer, and the destination name immediately -// following. Length fields include terminating nulls. -// - -typedef struct _SI_COPYFILE { - ULONG SourceFileNameLength; - ULONG DestinationFileNameLength; - ULONG Flags; - WCHAR FileNameBuffer[1]; -} SI_COPYFILE, *PSI_COPYFILE; - -#define COPYFILE_SIS_LINK 0x0001 // Copy only if source is SIS -#define COPYFILE_SIS_REPLACE 0x0002 // Replace destination if it exists, otherwise don't. -#define COPYFILE_SIS_FLAGS 0x0003 -#endif /* _WIN32_WINNT >= 0x0500 */ - -#if (_WIN32_WINNT >= 0x0600) -// -// Input parameter structure for FSCTL_MAKE_COMPATIBLE -// - -typedef struct _FILE_MAKE_COMPATIBLE_BUFFER { - BOOLEAN CloseDisc; -} FILE_MAKE_COMPATIBLE_BUFFER, *PFILE_MAKE_COMPATIBLE_BUFFER; - -// -// Input parameter structure for FSCTL_SET_DEFECT_MANAGEMENT -// - -typedef struct _FILE_SET_DEFECT_MGMT_BUFFER { - BOOLEAN Disable; -} FILE_SET_DEFECT_MGMT_BUFFER, *PFILE_SET_DEFECT_MGMT_BUFFER; - -// -// Output structure for FSCTL_QUERY_SPARING_INFO -// - -typedef struct _FILE_QUERY_SPARING_BUFFER { - ULONG SparingUnitBytes; - BOOLEAN SoftwareSparing; - ULONG TotalSpareBlocks; - ULONG FreeSpareBlocks; -} FILE_QUERY_SPARING_BUFFER, *PFILE_QUERY_SPARING_BUFFER; - -// -// Output structure for FSCTL_QUERY_ON_DISK_VOLUME_INFO -// - -typedef struct _FILE_QUERY_ON_DISK_VOL_INFO_BUFFER { - LARGE_INTEGER DirectoryCount; // -1 = unknown - LARGE_INTEGER FileCount; // -1 = unknown - USHORT FsFormatMajVersion; // -1 = unknown or n/a - USHORT FsFormatMinVersion; // -1 = unknown or n/a - WCHAR FsFormatName[ 12]; - LARGE_INTEGER FormatTime; - LARGE_INTEGER LastUpdateTime; - WCHAR CopyrightInfo[ 34]; - WCHAR AbstractInfo[ 34]; - WCHAR FormattingImplementationInfo[ 34]; - WCHAR LastModifyingImplementationInfo[ 34]; -} FILE_QUERY_ON_DISK_VOL_INFO_BUFFER, *PFILE_QUERY_ON_DISK_VOL_INFO_BUFFER; - -// -// Input flags for FSCTL_SET_REPAIR -// - -#define SET_REPAIR_ENABLED (0x00000001) -#define SET_REPAIR_VOLUME_BITMAP_SCAN (0x00000002) -#define SET_REPAIR_DELETE_CROSSLINK (0x00000004) -#define SET_REPAIR_WARN_ABOUT_DATA_LOSS (0x00000008) -#define SET_REPAIR_DISABLED_AND_BUGCHECK_ON_CORRUPT (0x00000010) -#define SET_REPAIR_VALID_MASK (0x0000001F) - -// -// Input structures for FSCTL_SHRINK_VOLUME. -// - -typedef enum _SHRINK_VOLUME_REQUEST_TYPES -{ - ShrinkPrepare = 1, - ShrinkCommit, - ShrinkAbort - -} SHRINK_VOLUME_REQUEST_TYPES, *PSHRINK_VOLUME_REQUEST_TYPES; - -typedef struct _SHRINK_VOLUME_INFORMATION -{ - SHRINK_VOLUME_REQUEST_TYPES ShrinkRequestType; - ULONGLONG Flags; - LONGLONG NewNumberOfSectors; - -} SHRINK_VOLUME_INFORMATION, *PSHRINK_VOLUME_INFORMATION; - -// -// Structures for FSCTL_TXFS_MODIFY_RM and FSCTL_TXFS_QUERY_RM_INFORMATION -// -// For ModifyRM, TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS and -// TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT are mutually exclusive. -// You can specify the log growth amount in number of containers or as a percentage. -// -// For ModifyRM, TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MAX and -// TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX are mutually exclusive. -// -// For ModifyRM, TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MIN and -// TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN are mutually exclusive. -// -// For ModifyRM, TXFS_RM_FLAG_RESET_RM_AT_NEXT_START and -// TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START are mutually exclusive and only -// apply to default RMs. -// -// For ModifyRM, TXFS_RM_FLAG_PREFER_CONSISTENCY and -// TXFS_RM_FLAG_PREFER_AVAILABILITY are mutually exclusive. After calling ModifyRM -// with one of these flags set the RM must be restarted for the change to take effect. -// - -#define TXFS_RM_FLAG_LOGGING_MODE 0x00000001 -#define TXFS_RM_FLAG_RENAME_RM 0x00000002 -#define TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MAX 0x00000004 -#define TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MIN 0x00000008 -#define TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS 0x00000010 -#define TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT 0x00000020 -#define TXFS_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE 0x00000040 -#define TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX 0x00000080 -#define TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN 0x00000100 -#define TXFS_RM_FLAG_GROW_LOG 0x00000400 -#define TXFS_RM_FLAG_SHRINK_LOG 0x00000800 -#define TXFS_RM_FLAG_ENFORCE_MINIMUM_SIZE 0x00001000 -#define TXFS_RM_FLAG_PRESERVE_CHANGES 0x00002000 -#define TXFS_RM_FLAG_RESET_RM_AT_NEXT_START 0x00004000 -#define TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START 0x00008000 -#define TXFS_RM_FLAG_PREFER_CONSISTENCY 0x00010000 -#define TXFS_RM_FLAG_PREFER_AVAILABILITY 0x00020000 - -#define TXFS_LOGGING_MODE_SIMPLE (0x0001) -#define TXFS_LOGGING_MODE_FULL (0x0002) - -#define TXFS_TRANSACTION_STATE_NONE 0x00 -#define TXFS_TRANSACTION_STATE_ACTIVE 0x01 -#define TXFS_TRANSACTION_STATE_PREPARED 0x02 -#define TXFS_TRANSACTION_STATE_NOTACTIVE 0x03 - -#define TXFS_MODIFY_RM_VALID_FLAGS \ - (TXFS_RM_FLAG_LOGGING_MODE | \ - TXFS_RM_FLAG_RENAME_RM | \ - TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MAX | \ - TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MIN | \ - TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \ - TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \ - TXFS_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE | \ - TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \ - TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN | \ - TXFS_RM_FLAG_SHRINK_LOG | \ - TXFS_RM_FLAG_GROW_LOG | \ - TXFS_RM_FLAG_ENFORCE_MINIMUM_SIZE | \ - TXFS_RM_FLAG_PRESERVE_CHANGES | \ - TXFS_RM_FLAG_RESET_RM_AT_NEXT_START | \ - TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START | \ - TXFS_RM_FLAG_PREFER_CONSISTENCY | \ - TXFS_RM_FLAG_PREFER_AVAILABILITY) - -typedef struct _TXFS_MODIFY_RM { - - // - // TXFS_RM_FLAG_* flags - // - - ULONG Flags; - - // - // Maximum log container count if TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MAX is set. - // - - ULONG LogContainerCountMax; - - // - // Minimum log container count if TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MIN is set. - // - - ULONG LogContainerCountMin; - - // - // Target log container count for TXFS_RM_FLAG_SHRINK_LOG or _GROW_LOG. - // - - ULONG LogContainerCount; - - // - // When the log is full, increase its size by this much. Indicated as either a percent of - // the log size or absolute container count, depending on which of the TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_* - // flags is set. - // - - ULONG LogGrowthIncrement; - - // - // Sets autoshrink policy if TXFS_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE is set. Autoshrink - // makes the log shrink so that no more than this percentage of the log is free at any time. - // - - ULONG LogAutoShrinkPercentage; - - // - // Reserved. - // - - ULONGLONG Reserved; - - // - // If TXFS_RM_FLAG_LOGGING_MODE is set, this must contain one of TXFS_LOGGING_MODE_SIMPLE - // or TXFS_LOGGING_MODE_FULL. - // - - USHORT LoggingMode; - -} TXFS_MODIFY_RM, - *PTXFS_MODIFY_RM; - -#define TXFS_RM_STATE_NOT_STARTED 0 -#define TXFS_RM_STATE_STARTING 1 -#define TXFS_RM_STATE_ACTIVE 2 -#define TXFS_RM_STATE_SHUTTING_DOWN 3 - -// -// The flags field for query RM information is used for the following information: -// -// 1) To indicate whether the LogGrowthIncrement field is reported as a percent -// or as a number of containers. Possible flag values for this are: -// -// TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS xor TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT -// -// 2) To indicate that there is no set maximum or minimum container count. Possible -// flag values for this are: -// -// TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX -// TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN -// -// Note that these flags are not mutually exclusive. -// -// 2) To report whether the RM will be reset the next time it is started. Note that -// only the default RM will report a meaningful value (secondary RMs will always -// report DO_NOT_RESET) Possible flag values for this are: -// -// TXFS_RM_FLAG_RESET_RM_AT_NEXT_START xor TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START -// -// 3) To report whether the RM is in consistency mode or availability mode. Possible -// flag values for this are: -// -// TXFS_RM_FLAG_PREFER_CONSISTENCY xor TXFS_RM_FLAG_PREFER_AVAILABILITY -// -// The RmState field can have exactly one of the above-defined TXF_RM_STATE_ values. -// - -#define TXFS_QUERY_RM_INFORMATION_VALID_FLAGS \ - (TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \ - TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \ - TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \ - TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN | \ - TXFS_RM_FLAG_RESET_RM_AT_NEXT_START | \ - TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START | \ - TXFS_RM_FLAG_PREFER_CONSISTENCY | \ - TXFS_RM_FLAG_PREFER_AVAILABILITY) - -typedef struct _TXFS_QUERY_RM_INFORMATION { - - // - // If the return value is STATUS_BUFFER_OVERFLOW (ERROR_MORE_DATA), this - // will indicate how much space is required to hold everything. - // - - ULONG BytesRequired; - - // - // LSN of earliest available record in the RM's log. - // - - ULONGLONG TailLsn; - - // - // LSN of most recently-written record in the RM's log. - // - - ULONGLONG CurrentLsn; - - // - // LSN of the log's archive tail. - // - - ULONGLONG ArchiveTailLsn; - - // - // Size of a log container in bytes. - // - - ULONGLONG LogContainerSize; - - // - // Highest virtual clock value recorded in this RM's log. - // - - LARGE_INTEGER HighestVirtualClock; - - // - // Number of containers in this RM's log. - // - - ULONG LogContainerCount; - - // - // Maximum-allowed log container count. - // - - ULONG LogContainerCountMax; - - // - // Minimum-allowed log container count. - // - - ULONG LogContainerCountMin; - - // - // Amount by which log will grow when it gets full. Indicated as either a percent of - // the log size or absolute container count, depending on which of the TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_* - // flags is set. - // - - ULONG LogGrowthIncrement; - - // - // Reports on the autoshrink policy if. Autoshrink makes the log shrink so that no more than this - // percentage of the log is free at any time. A value of 0 indicates that autoshrink is off (i.e. - // the log will not automatically shrink). - // - - ULONG LogAutoShrinkPercentage; - - // - // TXFS_RM_FLAG_* flags. See the comment above at TXFS_QUERY_RM_INFORMATION_VALID_FLAGS to see - // what the flags here mean. - // - - ULONG Flags; - - // - // Exactly one of TXFS_LOGGING_MODE_SIMPLE or TXFS_LOGGING_MODE_FULL. - // - - USHORT LoggingMode; - - // - // Reserved. - // - - USHORT Reserved; - - // - // Activity state of the RM. May be exactly one of the above-defined TXF_RM_STATE_ values. - // - - ULONG RmState; - - // - // Total capacity of the log in bytes. - // - - ULONGLONG LogCapacity; - - // - // Amount of free space in the log in bytes. - // - - ULONGLONG LogFree; - - // - // Size of $Tops in bytes. - // - - ULONGLONG TopsSize; - - // - // Amount of space in $Tops in use. - // - - ULONGLONG TopsUsed; - - // - // Number of transactions active in the RM at the time of the call. - // - - ULONGLONG TransactionCount; - - // - // Total number of single-phase commits that have happened the RM. - // - - ULONGLONG OnePCCount; - - // - // Total number of two-phase commits that have happened the RM. - // - - ULONGLONG TwoPCCount; - - // - // Number of times the log has filled up. - // - - ULONGLONG NumberLogFileFull; - - // - // Age of oldest active transaction in the RM, in milliseconds. - // - - ULONGLONG OldestTransactionAge; - - // - // Name of the RM. - // - - GUID RMName; - - // - // Offset in bytes from the beginning of this structure to a NULL-terminated Unicode - // string indicating the path to the RM's transaction manager's log. - // - - ULONG TmLogPathOffset; - -} TXFS_QUERY_RM_INFORMATION, - *PTXFS_QUERY_RM_INFORMATION; - -// -// Structures for FSCTL_TXFS_ROLLFORWARD_REDO -// - -#define TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_REDO_LSN 0x01 -#define TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_VIRTUAL_CLOCK 0x02 - -#define TXFS_ROLLFORWARD_REDO_VALID_FLAGS \ - (TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_REDO_LSN | \ - TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_VIRTUAL_CLOCK) - -typedef struct _TXFS_ROLLFORWARD_REDO_INFORMATION { - LARGE_INTEGER LastVirtualClock; - ULONGLONG LastRedoLsn; - ULONGLONG HighestRecoveryLsn; - ULONG Flags; -} TXFS_ROLLFORWARD_REDO_INFORMATION, - *PTXFS_ROLLFORWARD_REDO_INFORMATION; - -// -// Structures for FSCTL_TXFS_START_RM -// -// Note that TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS and -// TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT are mutually exclusive. -// You can specify the log growth amount in number of containers or as a percentage. -// -// TXFS_START_RM_FLAG_CONTAINER_COUNT_MAX and TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX -// are mutually exclusive. -// -// TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MIN and TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN -// are mutually exclusive. -// -// TXFS_START_RM_FLAG_PREFER_CONSISTENCY and TXFS_START_RM_FLAG_PREFER_AVAILABILITY -// are mutually exclusive. -// -// Optional parameters will have system-supplied defaults applied if omitted. -// - -#define TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MAX 0x00000001 -#define TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MIN 0x00000002 -#define TXFS_START_RM_FLAG_LOG_CONTAINER_SIZE 0x00000004 -#define TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS 0x00000008 -#define TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT 0x00000010 -#define TXFS_START_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE 0x00000020 -#define TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX 0x00000040 -#define TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN 0x00000080 - -#define TXFS_START_RM_FLAG_RECOVER_BEST_EFFORT 0x00000200 -#define TXFS_START_RM_FLAG_LOGGING_MODE 0x00000400 -#define TXFS_START_RM_FLAG_PRESERVE_CHANGES 0x00000800 - -#define TXFS_START_RM_FLAG_PREFER_CONSISTENCY 0x00001000 -#define TXFS_START_RM_FLAG_PREFER_AVAILABILITY 0x00002000 - -#define TXFS_START_RM_VALID_FLAGS \ - (TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MAX | \ - TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MIN | \ - TXFS_START_RM_FLAG_LOG_CONTAINER_SIZE | \ - TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \ - TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \ - TXFS_START_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE | \ - TXFS_START_RM_FLAG_RECOVER_BEST_EFFORT | \ - TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \ - TXFS_START_RM_FLAG_LOGGING_MODE | \ - TXFS_START_RM_FLAG_PRESERVE_CHANGES | \ - TXFS_START_RM_FLAG_PREFER_CONSISTENCY | \ - TXFS_START_RM_FLAG_PREFER_AVAILABILITY) - -typedef struct _TXFS_START_RM_INFORMATION { - - // - // TXFS_START_RM_FLAG_* flags. - // - - ULONG Flags; - - // - // RM log container size, in bytes. This parameter is optional. - // - - ULONGLONG LogContainerSize; - - // - // RM minimum log container count. This parameter is optional. - // - - ULONG LogContainerCountMin; - - // - // RM maximum log container count. This parameter is optional. - // - - ULONG LogContainerCountMax; - - // - // RM log growth increment in number of containers or percent, as indicated - // by TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_* flag. This parameter is - // optional. - // - - ULONG LogGrowthIncrement; - - // - // RM log auto shrink percentage. This parameter is optional. - // - - ULONG LogAutoShrinkPercentage; - - // - // Offset from the beginning of this structure to the log path for the KTM - // instance to be used by this RM. This must be a two-byte (WCHAR) aligned - // value. This parameter is required. - // - - ULONG TmLogPathOffset; - - // - // Length in bytes of log path for the KTM instance to be used by this RM. - // This parameter is required. - // - - USHORT TmLogPathLength; - - // - // Logging mode for this RM. One of TXFS_LOGGING_MODE_SIMPLE or - // TXFS_LOGGING_MODE_FULL (mutually exclusive). This parameter is optional, - // and will default to TXFS_LOGGING_MODE_SIMPLE. - // - - USHORT LoggingMode; - - // - // Length in bytes of the path to the log to be used by the RM. This parameter - // is required. - // - - USHORT LogPathLength; - - // - // Reserved. - // - - USHORT Reserved; - - // - // The path to the log (in Unicode characters) to be used by the RM goes here. - // This parameter is required. - // - - WCHAR LogPath[1]; - -} TXFS_START_RM_INFORMATION, - *PTXFS_START_RM_INFORMATION; - -// -// Structures for FSCTL_TXFS_GET_METADATA_INFO -// - -typedef struct _TXFS_GET_METADATA_INFO_OUT { - - // - // Returns the TxfId of the file referenced by the handle used to call this routine. - // - - struct { - LONGLONG LowPart; - LONGLONG HighPart; - } TxfFileId; - - // - // The GUID of the transaction that has the file locked, if applicable. - // - - GUID LockingTransaction; - - // - // Returns the LSN for the most recent log record we've written for the file. - // - - ULONGLONG LastLsn; - - // - // Transaction state, a TXFS_TRANSACTION_STATE_* value. - // - - ULONG TransactionState; - -} TXFS_GET_METADATA_INFO_OUT, *PTXFS_GET_METADATA_INFO_OUT; - -// -// Structures for FSCTL_TXFS_LIST_TRANSACTION_LOCKED_FILES -// -// TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY_FLAG_CREATED means the reported name was created -// in the locking transaction. -// -// TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY_FLAG_DELETED means the reported name was deleted -// in the locking transaction. -// -// Note that both flags may appear if the name was both created and deleted in the same -// transaction. In that case the FileName[] member will contain only "\0", as there is -// no meaningful name to report. -// - -#define TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY_FLAG_CREATED 0x00000001 -#define TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY_FLAG_DELETED 0x00000002 - -typedef struct _TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY { - - // - // Offset in bytes from the beginning of the TXFS_LIST_TRANSACTION_LOCKED_FILES - // structure to the next TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY. - // - - ULONGLONG Offset; - - // - // TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY_FLAG_* flags to indicate whether the - // current name was deleted or created in the transaction. - // - - ULONG NameFlags; - - // - // NTFS File ID of the file. - // - - LONGLONG FileId; - - // - // Reserved. - // - - ULONG Reserved1; - ULONG Reserved2; - LONGLONG Reserved3; - - // - // NULL-terminated Unicode path to this file, relative to RM root. - // - - WCHAR FileName[1]; -} TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY, *PTXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY; - - -typedef struct _TXFS_LIST_TRANSACTION_LOCKED_FILES { - - // - // GUID name of the KTM transaction that files should be enumerated from. - // - - GUID KtmTransaction; - - // - // On output, the number of files involved in the transaction on this RM. - // - - ULONGLONG NumberOfFiles; - - // - // The length of the buffer required to obtain the complete list of files. - // This value may change from call to call as the transaction locks more files. - // - - ULONGLONG BufferSizeRequired; - - // - // Offset in bytes from the beginning of this structure to the first - // TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY. - // - - ULONGLONG Offset; -} TXFS_LIST_TRANSACTION_LOCKED_FILES, *PTXFS_LIST_TRANSACTION_LOCKED_FILES; - -// -// Structures for FSCTL_TXFS_LIST_TRANSACTIONS -// - -typedef struct _TXFS_LIST_TRANSACTIONS_ENTRY { - - // - // Transaction GUID. - // - - GUID TransactionId; - - // - // Transaction state, a TXFS_TRANSACTION_STATE_* value. - // - - ULONG TransactionState; - - // - // Reserved fields - // - - ULONG Reserved1; - ULONG Reserved2; - LONGLONG Reserved3; -} TXFS_LIST_TRANSACTIONS_ENTRY, *PTXFS_LIST_TRANSACTIONS_ENTRY; - -typedef struct _TXFS_LIST_TRANSACTIONS { - - // - // On output, the number of transactions involved in this RM. - // - - ULONGLONG NumberOfTransactions; - - // - // The length of the buffer required to obtain the complete list of - // transactions. Note that this value may change from call to call - // as transactions enter and exit the system. - // - - ULONGLONG BufferSizeRequired; -} TXFS_LIST_TRANSACTIONS, *PTXFS_LIST_TRANSACTIONS; - - -// -// Structures for FSCTL_TXFS_READ_BACKUP_INFORMATION -// - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4201) // unnamed struct - -typedef struct _TXFS_READ_BACKUP_INFORMATION_OUT { - union { - - // - // Used to return the required buffer size if return code is STATUS_BUFFER_OVERFLOW - // - - ULONG BufferLength; - - // - // On success the data is copied here. - // - - UCHAR Buffer[1]; - } DUMMYUNIONNAME; -} TXFS_READ_BACKUP_INFORMATION_OUT, *PTXFS_READ_BACKUP_INFORMATION_OUT; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning( default : 4201 ) -#endif - -// -// Structures for FSCTL_TXFS_WRITE_BACKUP_INFORMATION -// - -typedef struct _TXFS_WRITE_BACKUP_INFORMATION { - - // - // The data returned in the Buffer member of a previous call to - // FSCTL_TXFS_READ_BACKUP_INFORMATION goes here. - // - - UCHAR Buffer[1]; -} TXFS_WRITE_BACKUP_INFORMATION, *PTXFS_WRITE_BACKUP_INFORMATION; - -// -// Output structure for FSCTL_TXFS_GET_TRANSACTED_VERSION -// - -#define TXFS_TRANSACTED_VERSION_NONTRANSACTED 0xFFFFFFFE -#define TXFS_TRANSACTED_VERSION_UNCOMMITTED 0xFFFFFFFF - -typedef struct _TXFS_GET_TRANSACTED_VERSION { - - // - // The version that this handle is opened to. This will be - // TXFS_TRANSACTED_VERSION_UNCOMMITTED for nontransacted and - // transactional writer handles. - // - - ULONG ThisBaseVersion; - - // - // The most recent committed version available. - // - - ULONG LatestVersion; - - // - // If this is a handle to a miniversion, the ID of the miniversion. - // If it is not a handle to a minivers, this field will be 0. - // - - USHORT ThisMiniVersion; - - // - // The first available miniversion. Unless the miniversions are - // visible to the transaction bound to this handle, this field will be zero. - // - - USHORT FirstMiniVersion; - - // - // The latest available miniversion. Unless the miniversions are - // visible to the transaction bound to this handle, this field will be zero. - // - - USHORT LatestMiniVersion; - -} TXFS_GET_TRANSACTED_VERSION, *PTXFS_GET_TRANSACTED_VERSION; - -// -// Structures for FSCTL_TXFS_SAVEPOINT_INFORMATION -// -// Note that the TXFS_SAVEPOINT_INFORMATION structure is both and in and out structure. -// The KtmTransaction and ActionCode members are always in-parameters, and the SavepointId -// member is either an in-parameter, an out-parameter, or not used (see its definition below). -// - -// -// Create a new savepoint. -// - -#define TXFS_SAVEPOINT_SET 0x00000001 - -// -// Roll back to a specified savepoint. -// - -#define TXFS_SAVEPOINT_ROLLBACK 0x00000002 - -// -// Clear (make unavailable for rollback) the most recently set savepoint -// that has not yet been cleared. -// - -#define TXFS_SAVEPOINT_CLEAR 0x00000004 - -// -// Clear all savepoints from the transaction. -// - -#define TXFS_SAVEPOINT_CLEAR_ALL 0x00000010 - -typedef struct _TXFS_SAVEPOINT_INFORMATION { - - // - // Handle to the transaction on which to perform the savepoint operation. - // - - HANDLE KtmTransaction; - - // - // Specifies the savepoint action to take. A TXFS_SAVEPOINT_* value. - // - - ULONG ActionCode; - - // - // In-parameter for TXFS_ROLLBACK_TO_SAVEPOINT - specifies the savepoint to which - // to roll back. - // - // Out-parameter for TXFS_SET_SAVEPOINT - the newly-created savepoint ID will be - // returned here. - // - // Not used for TXFS_CLEAR_SAVEPOINT or TXFS_CLEAR_ALL_SAVEPOINTS. - // - - ULONG SavepointId; - -} TXFS_SAVEPOINT_INFORMATION, *PTXFS_SAVEPOINT_INFORMATION; - -// -// Structures for FSCTL_TXFS_CREATE_MINIVERSION -// -// Only an out parameter is necessary. That returns the identifier of the new miniversion created. -// - -typedef struct _TXFS_CREATE_MINIVERSION_INFO { - - USHORT StructureVersion; - - USHORT StructureLength; - - // - // The base version for the newly created miniversion. - // - - ULONG BaseVersion; - - // - // The miniversion that was just created. - // - - USHORT MiniVersion; - -} TXFS_CREATE_MINIVERSION_INFO, *PTXFS_CREATE_MINIVERSION_INFO; - -// -// Structure for FSCTL_TXFS_TRANSACTION_ACTIVE -// - -typedef struct _TXFS_TRANSACTION_ACTIVE_INFO { - - // - // Whether or not the volume had active transactions when this snapshot was taken. - // - - BOOLEAN TransactionsActiveAtSnapshot; - -} TXFS_TRANSACTION_ACTIVE_INFO, *PTXFS_TRANSACTION_ACTIVE_INFO; - -#endif /* _WIN32_WINNT >= 0x0600 */ - -#if (_WIN32_WINNT >= 0x0601) -// -// Output structure for FSCTL_GET_BOOT_AREA_INFO -// - -typedef struct _BOOT_AREA_INFO { - - ULONG BootSectorCount; // the count of boot sectors present on the file system - struct { - LARGE_INTEGER Offset; - } BootSectors[2]; // variable number of boot sectors. - -} BOOT_AREA_INFO, *PBOOT_AREA_INFO; - -// -// Output structure for FSCTL_GET_RETRIEVAL_POINTER_BASE -// - -typedef struct _RETRIEVAL_POINTER_BASE { - - LARGE_INTEGER FileAreaOffset; // sector offset to the first allocatable unit on the filesystem -} RETRIEVAL_POINTER_BASE, *PRETRIEVAL_POINTER_BASE; - -// -// Structure for FSCTL_SET_PERSISTENT_VOLUME_STATE and FSCTL_GET_PERSISTENT_VOLUME_STATE -// The initial version will be 1.0 -// - -typedef struct _FILE_FS_PERSISTENT_VOLUME_INFORMATION { - - ULONG VolumeFlags; - ULONG FlagMask; - ULONG Version; - ULONG Reserved; - -} FILE_FS_PERSISTENT_VOLUME_INFORMATION, *PFILE_FS_PERSISTENT_VOLUME_INFORMATION; - -// -// Structure for FSCTL_QUERY_FILE_SYSTEM_RECOGNITION -// - -typedef struct _FILE_SYSTEM_RECOGNITION_INFORMATION { - - CHAR FileSystem[9]; - -} FILE_SYSTEM_RECOGNITION_INFORMATION, *PFILE_SYSTEM_RECOGNITION_INFORMATION; - -// -// Structures for FSCTL_REQUEST_OPLOCK -// - -#define OPLOCK_LEVEL_CACHE_READ (0x00000001) -#define OPLOCK_LEVEL_CACHE_HANDLE (0x00000002) -#define OPLOCK_LEVEL_CACHE_WRITE (0x00000004) - -#define REQUEST_OPLOCK_INPUT_FLAG_REQUEST (0x00000001) -#define REQUEST_OPLOCK_INPUT_FLAG_ACK (0x00000002) -#define REQUEST_OPLOCK_INPUT_FLAG_COMPLETE_ACK_ON_CLOSE (0x00000004) - -#define REQUEST_OPLOCK_CURRENT_VERSION 1 - -typedef struct _REQUEST_OPLOCK_INPUT_BUFFER { - - // - // This should be set to REQUEST_OPLOCK_CURRENT_VERSION. - // - - USHORT StructureVersion; - - USHORT StructureLength; - - // - // One or more OPLOCK_LEVEL_CACHE_* values to indicate the desired level of the oplock. - // - - ULONG RequestedOplockLevel; - - // - // REQUEST_OPLOCK_INPUT_FLAG_* flags. - // - - ULONG Flags; - -} REQUEST_OPLOCK_INPUT_BUFFER, *PREQUEST_OPLOCK_INPUT_BUFFER; - -#define REQUEST_OPLOCK_OUTPUT_FLAG_ACK_REQUIRED (0x00000001) -#define REQUEST_OPLOCK_OUTPUT_FLAG_MODES_PROVIDED (0x00000002) - -typedef struct _REQUEST_OPLOCK_OUTPUT_BUFFER { - - // - // This should be set to REQUEST_OPLOCK_CURRENT_VERSION. - // - - USHORT StructureVersion; - - USHORT StructureLength; - - // - // One or more OPLOCK_LEVEL_CACHE_* values indicating the level of the oplock that - // was just broken. - // - - ULONG OriginalOplockLevel; - - // - // One or more OPLOCK_LEVEL_CACHE_* values indicating the level to which an oplock - // is being broken, or an oplock level that may be available for granting, depending - // on the operation returning this buffer. - // - - ULONG NewOplockLevel; - - // - // REQUEST_OPLOCK_OUTPUT_FLAG_* flags. - // - - ULONG Flags; - - // - // When REQUEST_OPLOCK_OUTPUT_FLAG_MODES_PROVIDED is set, and when the - // OPLOCK_LEVEL_CACHE_HANDLE level is being lost in an oplock break, these fields - // contain the access mode and share mode of the request that is causing the break. - // - - ACCESS_MASK AccessMode; - - USHORT ShareMode; - -} REQUEST_OPLOCK_OUTPUT_BUFFER, *PREQUEST_OPLOCK_OUTPUT_BUFFER; - -// -// Structures for FSCTL_SD_GLOBAL_CHANGE -// - -// -// list of operations supported -// - -#define SD_GLOBAL_CHANGE_TYPE_MACHINE_SID 1 - - -// -// Operation specific structures for SD_GLOBAL_CHANGE_TYPE_MACHINE_SID -// -// This con -// - -typedef struct _SD_CHANGE_MACHINE_SID_INPUT { - - // - // The current machine SID to change. - // This define the offset from the beginning of the SD_GLOBAL_CHANGE_INPUT - // structure of where the CurrentMachineSID to replace begins. This will - // be a SID structure. The length defines the length of the imbedded SID - // structure. - // - - USHORT CurrentMachineSIDOffset; - USHORT CurrentMachineSIDLength; - - // - // The new machine SID value to set inplace of the current machine SID - // This define the offset from the beginning of the SD_GLOBAL_CHANGE_INPUT - // structure of where the NewMachineSID to set begins. This will - // be a SID structure. The length defines the length of the imbedded SID - // structure. - // - - USHORT NewMachineSIDOffset; - USHORT NewMachineSIDLength; - -} SD_CHANGE_MACHINE_SID_INPUT, *PSD_CHANGE_MACHINE_SID_INPUT; - -typedef struct _SD_CHANGE_MACHINE_SID_OUTPUT { - - // - // How many entries were successfully changed in the $Secure stream - // - - ULONGLONG NumSDChangedSuccess; - - // - // How many entires failed the update in the $Secure stream - // - - ULONGLONG NumSDChangedFail; - - // - // How many entires are unused in the current security stream - // - - ULONGLONG NumSDUnused; - - // - // The total number of entries processed in the $Secure stream - // - - ULONGLONG NumSDTotal; - - // - // How many entries were successfully changed in the $MFT file - // - - ULONGLONG NumMftSDChangedSuccess; - - // - // How many entries failed the update in the $MFT file - // - - ULONGLONG NumMftSDChangedFail; - - // - // Total number of entriess process in the $MFT file - // - - ULONGLONG NumMftSDTotal; - -} SD_CHANGE_MACHINE_SID_OUTPUT, *PSD_CHANGE_MACHINE_SID_OUTPUT; - -// -// Generic INPUT & OUTPUT structures for FSCTL_SD_GLOBAL_CHANGE -// - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4201) // unnamed struct - -typedef struct _SD_GLOBAL_CHANGE_INPUT -{ - // - // Input flags (none currently defined) - // - - ULONG Flags; - - // - // Specifies which type of change we are doing and pics which member - // of the below union is in use. - // - - ULONG ChangeType; - - union { - - SD_CHANGE_MACHINE_SID_INPUT SdChange; - }; - -} SD_GLOBAL_CHANGE_INPUT, *PSD_GLOBAL_CHANGE_INPUT; - -typedef struct _SD_GLOBAL_CHANGE_OUTPUT -{ - - // - // Output State Flags (none currently defined) - // - - ULONG Flags; - - // - // Specifies which below union to use - // - - ULONG ChangeType; - - union { - - SD_CHANGE_MACHINE_SID_OUTPUT SdChange; - }; - -} SD_GLOBAL_CHANGE_OUTPUT, *PSD_GLOBAL_CHANGE_OUTPUT; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning( default : 4201 ) /* nonstandard extension used : nameless struct/union */ -#endif - -// -// Flag to indicate the encrypted file is sparse -// - -#define ENCRYPTED_DATA_INFO_SPARSE_FILE 1 - -typedef struct _EXTENDED_ENCRYPTED_DATA_INFO { - - // - // This is really a 4 byte character array which - // must have the value "EXTD". We use this - // to determine if we should read the extended data - // or not. - // - - ULONG ExtendedCode; - - // - // The length of the extended data structure - // - - ULONG Length; - - // - // Encrypted data flags (currently only sparse is defined) - // - - ULONG Flags; - ULONG Reserved; - -} EXTENDED_ENCRYPTED_DATA_INFO, *PEXTENDED_ENCRYPTED_DATA_INFO; - - -typedef struct _LOOKUP_STREAM_FROM_CLUSTER_INPUT { - - // - // Flags for the operation. Currently no flags are defined. - // - ULONG Flags; - - // - // Number of clusters in the following array of clusters. - // The input buffer must be large enough to contain this - // number or the operation will fail. - // - ULONG NumberOfClusters; - - // - // An array of one or more clusters to look up. - // - LARGE_INTEGER Cluster[1]; -} LOOKUP_STREAM_FROM_CLUSTER_INPUT, *PLOOKUP_STREAM_FROM_CLUSTER_INPUT; - -typedef struct _LOOKUP_STREAM_FROM_CLUSTER_OUTPUT { - // - // Offset from the beginning of this structure to the first entry - // returned. If no entries are returned, this value is zero. - // - ULONG Offset; - - // - // Number of matches to the input criteria. Note that more matches - // may be found than entries returned if the buffer is not large - // enough. - // - ULONG NumberOfMatches; - - // - // Minimum size of the buffer, in bytes, which would be needed to - // contain all matching entries to the input criteria. - // - ULONG BufferSizeRequired; -} LOOKUP_STREAM_FROM_CLUSTER_OUTPUT, *PLOOKUP_STREAM_FROM_CLUSTER_OUTPUT; - -#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_FLAG_PAGE_FILE 0x00000001 -#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_FLAG_DENY_DEFRAG_SET 0x00000002 -#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_FLAG_FS_SYSTEM_FILE 0x00000004 -#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_FLAG_TXF_SYSTEM_FILE 0x00000008 - -#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_ATTRIBUTE_MASK 0xff000000 -#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_ATTRIBUTE_DATA 0x01000000 -#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_ATTRIBUTE_INDEX 0x02000000 -#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_ATTRIBUTE_SYSTEM 0x03000000 - -typedef struct _LOOKUP_STREAM_FROM_CLUSTER_ENTRY { - // - // Offset from the beginning of this structure to the next entry - // returned. If there are no more entries, this value is zero. - // - ULONG OffsetToNext; - - // - // Flags describing characteristics about this stream. - // - ULONG Flags; - - // - // This value is reserved and is currently zero. - // - LARGE_INTEGER Reserved; - - // - // This is the cluster that this entry refers to. It will be one - // of the clusters passed in the input structure. - // - LARGE_INTEGER Cluster; - - // - // A NULL-terminated Unicode string containing the path of the - // object relative to the root of the volume. This string - // will refer to the attribute or stream represented by the - // cluster. - // - WCHAR FileName[1]; -} LOOKUP_STREAM_FROM_CLUSTER_ENTRY, *PLOOKUP_STREAM_FROM_CLUSTER_ENTRY; - -// -// This is the structure for the FSCTL_FILE_TYPE_NOTIFICATION operation. -// Its purpose is to notify the storage stack about the extents of certain -// types of files. This is only callable from kernel mode -// - -typedef struct _FILE_TYPE_NOTIFICATION_INPUT { - - // - // Flags for this operation - // FILE_TYPE_NOTIFICATION_FLAG_* - // - - ULONG Flags; - - // - // A count of how many FileTypeID guids are given - // - - ULONG NumFileTypeIDs; - - // - // This is a unique identifer for the type of file notification occuring - // - - GUID FileTypeID[1]; - -} FILE_TYPE_NOTIFICATION_INPUT, *PFILE_TYPE_NOTIFICATION_INPUT; - -// -// Flags for the given operation -// - -#define FILE_TYPE_NOTIFICATION_FLAG_USAGE_BEGIN 0x00000001 //Set when adding the specified usage on the given file -#define FILE_TYPE_NOTIFICATION_FLAG_USAGE_END 0x00000002 //Set when removing the specified usage on the given file - -// -// These are the globally defined file types -// - -DEFINE_GUID( FILE_TYPE_NOTIFICATION_GUID_PAGE_FILE, 0x0d0a64a1, 0x38fc, 0x4db8, 0x9f, 0xe7, 0x3f, 0x43, 0x52, 0xcd, 0x7c, 0x5c ); -DEFINE_GUID( FILE_TYPE_NOTIFICATION_GUID_HIBERNATION_FILE, 0xb7624d64, 0xb9a3, 0x4cf8, 0x80, 0x11, 0x5b, 0x86, 0xc9, 0x40, 0xe7, 0xb7 ); -DEFINE_GUID( FILE_TYPE_NOTIFICATION_GUID_CRASHDUMP_FILE, 0x9d453eb7, 0xd2a6, 0x4dbd, 0xa2, 0xe3, 0xfb, 0xd0, 0xed, 0x91, 0x09, 0xa9 ); -#endif /* _WIN32_WINNT >= 0x0601 */ - -#endif // _FILESYSTEMFSCTL_ - -// end_winioctl - -// -// Structures for FSCTL_SET_REPARSE_POINT, FSCTL_GET_REPARSE_POINT, and FSCTL_DELETE_REPARSE_POINT -// - -// -// The reparse structure is used by layered drivers to store data in a -// reparse point. The constraints on reparse tags are defined below. -// This version of the reparse data buffer is only for Microsoft tags. -// - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4201) // unnamed struct - -#define SYMLINK_FLAG_RELATIVE 1 - -typedef struct _REPARSE_DATA_BUFFER { - ULONG ReparseTag; - USHORT ReparseDataLength; - USHORT Reserved; - union { - struct { - USHORT SubstituteNameOffset; - USHORT SubstituteNameLength; - USHORT PrintNameOffset; - USHORT PrintNameLength; - ULONG Flags; - WCHAR PathBuffer[1]; - } SymbolicLinkReparseBuffer; - struct { - USHORT SubstituteNameOffset; - USHORT SubstituteNameLength; - USHORT PrintNameOffset; - USHORT PrintNameLength; - WCHAR PathBuffer[1]; - } MountPointReparseBuffer; - struct { - UCHAR DataBuffer[1]; - } GenericReparseBuffer; - } DUMMYUNIONNAME; -} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning( default : 4201 ) -#endif - -#define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer) - - -// begin_winnt -// -// The reparse GUID structure is used by all 3rd party layered drivers to -// store data in a reparse point. For non-Microsoft tags, The GUID field -// cannot be GUID_NULL. -// The constraints on reparse tags are defined below. -// Microsoft tags can also be used with this format of the reparse point buffer. -// - -typedef struct _REPARSE_GUID_DATA_BUFFER { - ULONG ReparseTag; - USHORT ReparseDataLength; - USHORT Reserved; - GUID ReparseGuid; - struct { - UCHAR DataBuffer[1]; - } GenericReparseBuffer; -} REPARSE_GUID_DATA_BUFFER, *PREPARSE_GUID_DATA_BUFFER; - -#define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer) - - - -// -// Maximum allowed size of the reparse data. -// - -#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 ) - -// -// Predefined reparse tags. -// These tags need to avoid conflicting with IO_REMOUNT defined in ntos\inc\io.h -// - -#define IO_REPARSE_TAG_RESERVED_ZERO (0) -#define IO_REPARSE_TAG_RESERVED_ONE (1) - -// -// The value of the following constant needs to satisfy the following conditions: -// (1) Be at least as large as the largest of the reserved tags. -// (2) Be strictly smaller than all the tags in use. -// - -#define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE - -// -// The reparse tags are a ULONG. The 32 bits are 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 -// +-+-+-+-+-----------------------+-------------------------------+ -// |M|R|N|R| Reserved bits | Reparse Tag Value | -// +-+-+-+-+-----------------------+-------------------------------+ -// -// M is the Microsoft bit. When set to 1, it denotes a tag owned by Microsoft. -// All ISVs must use a tag with a 0 in this position. -// Note: If a Microsoft tag is used by non-Microsoft software, the -// behavior is not defined. -// -// R is reserved. Must be zero for non-Microsoft tags. -// -// N is name surrogate. When set to 1, the file represents another named -// entity in the system. -// -// The M and N bits are OR-able. -// The following macros check for the M and N bit values: -// - -// -// Macro to determine whether a reparse point tag corresponds to a tag -// owned by Microsoft. -// - -#define IsReparseTagMicrosoft(_tag) ( \ - ((_tag) & 0x80000000) \ - ) - -// -// Macro to determine whether a reparse point tag is a name surrogate -// - -#define IsReparseTagNameSurrogate(_tag) ( \ - ((_tag) & 0x20000000) \ - ) - -// end_winnt - -// -// The following constant represents the bits that are valid to use in -// reparse tags. -// - -#define IO_REPARSE_TAG_VALID_VALUES (0xF000FFFF) - -// -// Macro to determine whether a reparse tag is a valid tag. -// - -#define IsReparseTagValid(_tag) ( \ - !((_tag) & ~IO_REPARSE_TAG_VALID_VALUES) && \ - ((_tag) > IO_REPARSE_TAG_RESERVED_RANGE) \ - ) - -/////////////////////////////////////////////////////////////////////////////// -// -// Microsoft tags for reparse points. -// -/////////////////////////////////////////////////////////////////////////////// - -#define IO_REPARSE_TAG_MOUNT_POINT (0xA0000003L) // winnt -#define IO_REPARSE_TAG_HSM (0xC0000004L) // winnt -#define IO_REPARSE_TAG_DRIVE_EXTENDER (0x80000005L) -#define IO_REPARSE_TAG_HSM2 (0x80000006L) // winnt -#define IO_REPARSE_TAG_SIS (0x80000007L) // winnt -#define IO_REPARSE_TAG_WIM (0x80000008L) // winnt -#define IO_REPARSE_TAG_CSV (0x80000009L) // winnt -#define IO_REPARSE_TAG_DFS (0x8000000AL) // winnt -#define IO_REPARSE_TAG_FILTER_MANAGER (0x8000000BL) -#define IO_REPARSE_TAG_SYMLINK (0xA000000CL) // winnt -#define IO_REPARSE_TAG_IIS_CACHE (0xA0000010L) -#define IO_REPARSE_TAG_DFSR (0x80000012L) // winnt - - - -/////////////////////////////////////////////////////////////////////////////// -// -// Non-Microsoft tags for reparse points -// -/////////////////////////////////////////////////////////////////////////////// - -// -// Tag allocated to CONGRUENT, May 2000. Used by IFSTEST -// - -#define IO_REPARSE_TAG_IFSTEST_CONGRUENT (0x00000009L) - -// -// Tag allocated to Moonwalk Univeral for HSM -// GUID: 257ABE42-5A28-4C8C-AC46-8FEA5619F18F -// - -#define IO_REPARSE_TAG_MOONWALK_HSM (0x0000000AL) - -// -// Tag allocated to Tsinghua Univeristy for Research purposes -// No released products should use this tag -// GUID: b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2 -// - -#define IO_REPARSE_TAG_TSINGHUA_UNIVERSITY_RESEARCH (0x0000000BL) - -// -// Tag allocated to ARKIVIO for HSM -// - -#define IO_REPARSE_TAG_ARKIVIO (0x0000000CL) - -// -// Tag allocated to SOLUTIONSOFT for name surrogate -// - -#define IO_REPARSE_TAG_SOLUTIONSOFT (0x2000000DL) - -// -// Tag allocated to COMMVAULT for HSM -// - -#define IO_REPARSE_TAG_COMMVAULT (0x0000000EL) - -// -// Tag allocated to Overtone Software for HSM -// - -#define IO_REPARSE_TAG_OVERTONE (0x0000000FL) - -// -// Tag allocated to Symantec (formerly to KVS Inc) for HSM -// GUID: A49F7BF6-77CA-493c-A0AA-18DBB28D1098 -// - -#define IO_REPARSE_TAG_SYMANTEC_HSM2 (0x00000010L) - -// -// Tag allocated to Enigma Data for HSM -// - -#define IO_REPARSE_TAG_ENIGMA_HSM (0x00000011L) - -// -// Tag allocated to Symantec for HSM -// GUID: B99F4235-CF1C-48dd-9E6C-459FA289F8C7 -// - -#define IO_REPARSE_TAG_SYMANTEC_HSM (0x00000012L) - -// -// Tag allocated to INTERCOPE for HSM -// GUID: F204BE2D-AEEB-4728-A31C-C7F4E9BEA758} -// - -#define IO_REPARSE_TAG_INTERCOPE_HSM (0x00000013L) - -// -// Tag allocated to KOM Networks for HSM -// - -#define IO_REPARSE_TAG_KOM_NETWORKS_HSM (0x00000014L) - -// -// Tag allocated to MEMORY_TECH for HSM -// GUID: E51BA456-046C-43ea-AEC7-DC1A87E1FD49 -// - -#define IO_REPARSE_TAG_MEMORY_TECH_HSM (0x00000015L) - -// -// Tag allocated to BridgeHead Software for HSM -// GUID: EBAFF6E3-F21D-4496-8342-58144B3D2BD0 -// - -#define IO_REPARSE_TAG_BRIDGEHEAD_HSM (0x00000016L) - -// -// Tag allocated to OSR for samples reparse point filter -// GUID: 3740c860-b19b-11d9-9669-0800200c9a66 -// - -#define IO_REPARSE_TAG_OSR_SAMPLE (0x20000017L) - -// -// Tag allocated to Global 360 for HSM -// GUID: C4B51F66-7F00-4c55-9441-8A1B159F209B -// - -#define IO_REPARSE_TAG_GLOBAL360_HSM (0x00000018L) - -// -// Tag allocated to Altiris for HSM -// GUID: fc1047eb-fb2d-45f2-a2f4-a71c1032fa2dB -// - -#define IO_REPARSE_TAG_ALTIRIS_HSM (0x00000019L) - -// -// Tag allocated to Hermes for HSM -// GUID: 437E0FD5-FCB4-42fe-877A-C785DA662AC2 -// - -#define IO_REPARSE_TAG_HERMES_HSM (0x0000001AL) - -// -// Tag allocated to PointSoft for HSM -// GUID: 547BC7FD-9604-4deb-AE07-B6514DF5FBC6 -// - -#define IO_REPARSE_TAG_POINTSOFT_HSM (0x0000001BL) - -// -// Tag allocated to GRAU Data Storage for HSM -// GUID: 6662D310-5653-4D10-8C31-F8E166D1A1BD -// - -#define IO_REPARSE_TAG_GRAU_DATASTORAGE_HSM (0x0000001CL) - -// -// Tag allocated to CommVault for HSM -// GUID: cc38adf3-c583-4efa-b183-72c1671941de -// - -#define IO_REPARSE_TAG_COMMVAULT_HSM (0x0000001DL) - - -// -// Tag allocated to Data Storage Group for single instance storage -// GUID: C1182673-0562-447a-8E40-4F0549FDF817 -// - -#define IO_REPARSE_TAG_DATASTOR_SIS (0x0000001EL) - - -// -// Tag allocated to Enterprise Data Solutions, Inc. for HSM -// GUID: EB63DF9D-8874-41cd-999A-A197542CDAFC -// - -#define IO_REPARSE_TAG_EDSI_HSM (0x0000001FL) - - -// -// Tag allocated to HP StorageWorks Reference Information Manager for Files (HSM) -// GUID: 3B0F6B23-0C2E-4281-9C19-C6AEEBC88CD8 -// - -#define IO_REPARSE_TAG_HP_HSM (0x00000020L) - - -// -// Tag allocated to SER Beteiligung Solutions Deutschland GmbH (HSM) -// GUID: 55B673F0-978E-41c5-9ADB-AF99640BE90E -// - -#define IO_REPARSE_TAG_SER_HSM (0x00000021L) - - -// -// Tag allocated to Double-Take Software (formerly NSI Software, Inc.) for HSM -// GUID: f7cb0ce8-453a-4ae1-9c56-db41b55f6ed4 -// - -#define IO_REPARSE_TAG_DOUBLE_TAKE_HSM (0x00000022L) - - -// -// Tag allocated to Beijing Wisdata Systems CO, LTD for HSM -// GUID: d546500a-2aeb-45f6-9482-f4b1799c3177 -// - -#define IO_REPARSE_TAG_WISDATA_HSM (0x00000023L) - - -// -// Tag allocated to Mimosa Systems Inc for HSM -// GUID: 8ddd4144-1a22-404b-8a5a-fcd91c6ee9f3 -// - -#define IO_REPARSE_TAG_MIMOSA_HSM (0x00000024L) - - -// -// Tag allocated to H&S Heilig und Schubert Software AG for HSM -// GUID: 77CA30C0-E5EC-43df-9E44-A4910378E284 -// - -#define IO_REPARSE_TAG_HSAG_HSM (0x00000025L) - - -// -// Tag allocated to Atempo Inc. (Atempo Digital Archive) for HSM -// GUID: 9B64518A-D6A4-495f-8D01-392F38862F0C -// - -#define IO_REPARSE_TAG_ADA_HSM (0x00000026L) - - -// -// Tag allocated to Autonomy Corporation for HSM -// GUID: EB112A57-10FC-4b42-B590-A61897FDC432 -// - -#define IO_REPARSE_TAG_AUTN_HSM (0x00000027L) - - -// -// Tag allocated to Nexsan for HSM -// GUID: d35eba9a-e722-445d-865f-dde1120acf16 -// - -#define IO_REPARSE_TAG_NEXSAN_HSM (0x00000028L) - - -// -// Tag allocated to Double-Take for SIS -// GUID: BDA506C2-F74D-4495-9A8D-44FD8D5B4F42 -// - -#define IO_REPARSE_TAG_DOUBLE_TAKE_SIS (0x00000029L) - - -// -// Tag allocated to Sony for HSM -// GUID: E95032E4-FD81-4e15-A8E2-A1F078061C4E -// - -#define IO_REPARSE_TAG_SONY_HSM (0x0000002AL) - - -// -// Tag allocated to Eltan Comm for HSM -// GUID: E1596D9F-44D8-43f4-A2D6-E9FE8D3E28FB -// - -#define IO_REPARSE_TAG_ELTAN_HSM (0x0000002BL) - - -// -// Tag allocated to Utixo LLC for HSM -// GUID: 5401F960-2F95-46D0-BBA6-052929FE2C32 -// - -#define IO_REPARSE_TAG_UTIXO_HSM (0x0000002CL) - - -// -// Tag allocated to Quest Software for HSM -// GUID: D546500A-2AEB-45F6-9482-F4B1799C3177 -// - -#define IO_REPARSE_TAG_QUEST_HSM (0x0000002DL) - - -// -// Tag allocated to DataGlobal GmbH for HSM -// GUID: 7A09CA83-B7B1-4614-ADFD-0BD5F4F989C9 -// - -#define IO_REPARSE_TAG_DATAGLOBAL_HSM (0x0000002EL) - - -// -// Tag allocated to Qi Tech LLC for HSM -// GUID: C8110B39-A4CE-432E-B58A-FBEAD296DF03 -// - -#define IO_REPARSE_TAG_QI_TECH_HSM (0x2000002FL) - -// -// Tag allocated to DataFirst Corporation for HSM -// GUID: E0E40591-6434-479f-94AC-DECF6DAEFB5C -// - -#define IO_REPARSE_TAG_DATAFIRST_HSM (0x00000030L) - -// -// Tag allocated to C2C Systems for HSM -// GUID: 6F2F829C-36AE-4E88-A3B6-E2C24377EA1C -// - -#define IO_REPARSE_TAG_C2CSYSTEMS_HSM (0x00000031L) - - -// -// Reparse point index keys. -// -// The index with all the reparse points that exist in a volume at a -// given time contains entries with keys of the form -// . -// The data part of these records is empty. -// - -#pragma pack(4) - -typedef struct _REPARSE_INDEX_KEY { - - // - // The tag of the reparse point. - // - - ULONG FileReparseTag; - - // - // The file record Id where the reparse point is set. - // - - LARGE_INTEGER FileId; - -} REPARSE_INDEX_KEY, *PREPARSE_INDEX_KEY; - -#pragma pack() - - - -// -// The following three FSCTLs are placed in this file to facilitate sharing -// between the redirector and the IO subsystem -// -// This FSCTL is used to garner the link tracking information for a file. -// The data structures used for retreving the information are -// LINK_TRACKING_INFORMATION defined further down in this file. -// - -#define FSCTL_LMR_GET_LINK_TRACKING_INFORMATION CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM,58,METHOD_BUFFERED,FILE_ANY_ACCESS) - -// -// This FSCTL is used to update the link tracking information on a server for -// an intra machine/ inter volume move on that server -// - -#define FSCTL_LMR_SET_LINK_TRACKING_INFORMATION CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM,59,METHOD_BUFFERED,FILE_ANY_ACCESS) - -// -// The following IOCTL is used in link tracking implementation. It determines if the -// two file objects passed in are on the same server. This IOCTL is available in -// kernel mode only since it accepts FILE_OBJECT as parameters -// - -#define IOCTL_LMR_ARE_FILE_OBJECTS_ON_SAME_SERVER CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM,60,METHOD_BUFFERED,FILE_ANY_ACCESS) - - - -// -// Named Pipe file control code and structure declarations -// - -// -// External named pipe file control operations -// - -#define FSCTL_PIPE_ASSIGN_EVENT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_DISCONNECT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_LISTEN CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_PEEK CTL_CODE(FILE_DEVICE_NAMED_PIPE, 3, METHOD_BUFFERED, FILE_READ_DATA) -#define FSCTL_PIPE_QUERY_EVENT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_TRANSCEIVE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 5, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA) -#define FSCTL_PIPE_WAIT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_SET_CLIENT_PROCESS CTL_CODE(FILE_DEVICE_NAMED_PIPE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_QUERY_CLIENT_PROCESS CTL_CODE(FILE_DEVICE_NAMED_PIPE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_GET_PIPE_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 10, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_SET_PIPE_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 11, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_GET_CONNECTION_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_SET_CONNECTION_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 13, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_GET_HANDLE_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 14, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_SET_HANDLE_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 15, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_PIPE_FLUSH CTL_CODE(FILE_DEVICE_NAMED_PIPE, 16, METHOD_BUFFERED, FILE_WRITE_DATA) - -// -// Internal named pipe file control operations -// - -#define FSCTL_PIPE_INTERNAL_READ CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2045, METHOD_BUFFERED, FILE_READ_DATA) -#define FSCTL_PIPE_INTERNAL_WRITE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2046, METHOD_BUFFERED, FILE_WRITE_DATA) -#define FSCTL_PIPE_INTERNAL_TRANSCEIVE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2047, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA) -#define FSCTL_PIPE_INTERNAL_READ_OVFLOW CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2048, METHOD_BUFFERED, FILE_READ_DATA) - -// -// Define entry types for query event information -// - -#define FILE_PIPE_READ_DATA 0x00000000 -#define FILE_PIPE_WRITE_SPACE 0x00000001 - -// -// Named pipe file system control structure declarations -// - -// Control structure for FSCTL_PIPE_ASSIGN_EVENT - -typedef struct _FILE_PIPE_ASSIGN_EVENT_BUFFER { - HANDLE EventHandle; - ULONG KeyValue; -} FILE_PIPE_ASSIGN_EVENT_BUFFER, *PFILE_PIPE_ASSIGN_EVENT_BUFFER; - -// Control structure for FSCTL_PIPE_PEEK - -typedef struct _FILE_PIPE_PEEK_BUFFER { - ULONG NamedPipeState; - ULONG ReadDataAvailable; - ULONG NumberOfMessages; - ULONG MessageLength; - CHAR Data[1]; -} FILE_PIPE_PEEK_BUFFER, *PFILE_PIPE_PEEK_BUFFER; - -// Control structure for FSCTL_PIPE_QUERY_EVENT - -typedef struct _FILE_PIPE_EVENT_BUFFER { - ULONG NamedPipeState; - ULONG EntryType; - ULONG ByteCount; - ULONG KeyValue; - ULONG NumberRequests; -} FILE_PIPE_EVENT_BUFFER, *PFILE_PIPE_EVENT_BUFFER; - -// Control structure for FSCTL_PIPE_WAIT - -typedef struct _FILE_PIPE_WAIT_FOR_BUFFER { - LARGE_INTEGER Timeout; - ULONG NameLength; - BOOLEAN TimeoutSpecified; - WCHAR Name[1]; -} FILE_PIPE_WAIT_FOR_BUFFER, *PFILE_PIPE_WAIT_FOR_BUFFER; - -// Control structure for FSCTL_PIPE_SET_CLIENT_PROCESS and FSCTL_PIPE_QUERY_CLIENT_PROCESS - -typedef struct _FILE_PIPE_CLIENT_PROCESS_BUFFER { -#if !defined(BUILD_WOW6432) - PVOID ClientSession; - PVOID ClientProcess; -#else - ULONGLONG ClientSession; - ULONGLONG ClientProcess; -#endif -} FILE_PIPE_CLIENT_PROCESS_BUFFER, *PFILE_PIPE_CLIENT_PROCESS_BUFFER; - -// This is an extension to the client process info buffer containing the client -// computer name - -#define FILE_PIPE_COMPUTER_NAME_LENGTH 15 - -typedef struct _FILE_PIPE_CLIENT_PROCESS_BUFFER_EX { -#if !defined(BUILD_WOW6432) - PVOID ClientSession; - PVOID ClientProcess; -#else - ULONGLONG ClientSession; - ULONGLONG ClientProcess; -#endif - USHORT ClientComputerNameLength; // in bytes - WCHAR ClientComputerBuffer[FILE_PIPE_COMPUTER_NAME_LENGTH+1]; // terminated -} FILE_PIPE_CLIENT_PROCESS_BUFFER_EX, *PFILE_PIPE_CLIENT_PROCESS_BUFFER_EX; - -// -// Mailslot file control operations. -// - -#define FSCTL_MAILSLOT_PEEK CTL_CODE(FILE_DEVICE_MAILSLOT, 0, METHOD_NEITHER, FILE_READ_DATA) // ntifs - -// -// Control structure for FSCTL_LMR_GET_LINK_TRACKING_INFORMATION -// - -// -// For links on DFS volumes the volume id and machine id are returned for -// link tracking -// - -typedef enum _LINK_TRACKING_INFORMATION_TYPE { - NtfsLinkTrackingInformation, - DfsLinkTrackingInformation -} LINK_TRACKING_INFORMATION_TYPE, *PLINK_TRACKING_INFORMATION_TYPE; - -typedef struct _LINK_TRACKING_INFORMATION { - LINK_TRACKING_INFORMATION_TYPE Type; - UCHAR VolumeId[16]; -} LINK_TRACKING_INFORMATION, *PLINK_TRACKING_INFORMATION; - -// -// Control structure for FSCTL_LMR_SET_LINK_TRACKING_INFORMATION -// - -typedef struct _REMOTE_LINK_TRACKING_INFORMATION_ { - PVOID TargetFileObject; - ULONG TargetLinkTrackingInformationLength; - UCHAR TargetLinkTrackingInformationBuffer[1]; -} REMOTE_LINK_TRACKING_INFORMATION, - *PREMOTE_LINK_TRACKING_INFORMATION; - - -#if (_WIN32_WINNT >= 0x0601) - -#pragma warning(push) -#pragma warning(disable : 4200) -#pragma warning(disable : 4201) - -#ifndef _VIRTUAL_STORAGE_TYPE_DEFINED -#define _VIRTUAL_STORAGE_TYPE_DEFINED -typedef struct _VIRTUAL_STORAGE_TYPE -{ - ULONG DeviceId; - GUID VendorId; -} VIRTUAL_STORAGE_TYPE, *PVIRTUAL_STORAGE_TYPE; -#endif - -// -// These structures are used by the FSCTL_QUERY_DEPENDENT_VOLUME -// - -typedef struct _STORAGE_QUERY_DEPENDENT_VOLUME_REQUEST { - ULONG RequestLevel; - ULONG RequestFlags; -} STORAGE_QUERY_DEPENDENT_VOLUME_REQUEST, *PSTORAGE_QUERY_DEPENDENT_VOLUME_REQUEST; - -#define QUERY_DEPENDENT_VOLUME_REQUEST_FLAG_HOST_VOLUMES 0x1 -#define QUERY_DEPENDENT_VOLUME_REQUEST_FLAG_GUEST_VOLUMES 0x2 - -typedef struct _STORAGE_QUERY_DEPENDENT_VOLUME_LEV1_ENTRY { - ULONG EntryLength; - ULONG DependencyTypeFlags; - ULONG ProviderSpecificFlags; - VIRTUAL_STORAGE_TYPE VirtualStorageType; -} STORAGE_QUERY_DEPENDENT_VOLUME_LEV1_ENTRY, *PSTORAGE_QUERY_DEPENDENT_VOLUME_LEV1_ENTRY; - -typedef struct _STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY { - ULONG EntryLength; - ULONG DependencyTypeFlags; - ULONG ProviderSpecificFlags; - VIRTUAL_STORAGE_TYPE VirtualStorageType; - ULONG AncestorLevel; // Root parent is 0, every child level after that is incremented - ULONG HostVolumeNameOffset; - ULONG HostVolumeNameSize; - ULONG DependentVolumeNameOffset; - ULONG DependentVolumeNameSize; - ULONG RelativePathOffset; - ULONG RelativePathSize; - ULONG DependentDeviceNameOffset; - ULONG DependentDeviceNameSize; -} STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY, *PSTORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY; - -typedef struct _STORAGE_QUERY_DEPENDENT_VOLUME_RESPONSE { - ULONG ResponseLevel; - ULONG NumberEntries; - union { - STORAGE_QUERY_DEPENDENT_VOLUME_LEV1_ENTRY Lev1Depends[]; - STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY Lev2Depends[]; - }; -} STORAGE_QUERY_DEPENDENT_VOLUME_RESPONSE, *PSTORAGE_QUERY_DEPENDENT_VOLUME_RESPONSE; - -#pragma warning(pop) - -#endif // WinVer >= 0x0601 - - -// -// Object Information Classes -// - -typedef enum _OBJECT_INFORMATION_CLASS { - ObjectBasicInformation = 0, - ObjectTypeInformation = 2 -} OBJECT_INFORMATION_CLASS; - -// -// Public Object Information definitions -// - -typedef struct _PUBLIC_OBJECT_BASIC_INFORMATION { - ULONG Attributes; - ACCESS_MASK GrantedAccess; - ULONG HandleCount; - ULONG PointerCount; - - ULONG Reserved[10]; // reserved for internal use - -} PUBLIC_OBJECT_BASIC_INFORMATION, *PPUBLIC_OBJECT_BASIC_INFORMATION; - -typedef struct __PUBLIC_OBJECT_TYPE_INFORMATION { - - UNICODE_STRING TypeName; - - ULONG Reserved [22]; // reserved for internal use - -} PUBLIC_OBJECT_TYPE_INFORMATION, *PPUBLIC_OBJECT_TYPE_INFORMATION; - -#if (NTDDI_VERSION >= NTDDI_NT4) -__drv_maxIRQL(PASSIVE_LEVEL) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtQueryObject ( - __in_opt HANDLE Handle, - __in OBJECT_INFORMATION_CLASS ObjectInformationClass, - __out_bcount_opt(ObjectInformationLength) PVOID ObjectInformation, - __in ULONG ObjectInformationLength, - __out_opt PULONG ReturnLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtSetSecurityObject ( - __in HANDLE Handle, - __in SECURITY_INFORMATION SecurityInformation, - __in PSECURITY_DESCRIPTOR SecurityDescriptor - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtQuerySecurityObject ( - __in HANDLE Handle, - __in SECURITY_INFORMATION SecurityInformation, - __out_bcount_opt(Length) PSECURITY_DESCRIPTOR SecurityDescriptor, - __in ULONG Length, - __out PULONG LengthNeeded - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtClose ( - __in HANDLE Handle - ); -#endif // NTDDI_VERSION >= NTDDI_WIN2K - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtCreateSection ( - __out PHANDLE SectionHandle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt PLARGE_INTEGER MaximumSize, - __in ULONG SectionPageProtection, - __in ULONG AllocationAttributes, - __in_opt HANDLE FileHandle - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_allocatesMem(Mem) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtAllocateVirtualMemory ( - __in HANDLE ProcessHandle, - __inout PVOID *BaseAddress, - __in ULONG_PTR ZeroBits, - __inout PSIZE_T RegionSize, - __in ULONG AllocationType, - __in ULONG Protect - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtFreeVirtualMemory ( - __in HANDLE ProcessHandle, - __inout __drv_freesMem(Mem) PVOID *BaseAddress, - __inout PSIZE_T RegionSize, - __in ULONG FreeType - ); -#endif // NTDDI_VERSION >= NTDDI_WIN2K - -// -// Data structure used to represent client security context for a thread. -// This data structure is used to support impersonation. -// -// THE FIELDS OF THIS DATA STRUCTURE SHOULD BE CONSIDERED OPAQUE -// BY ALL EXCEPT THE SECURITY ROUTINES. -// - -typedef struct _SECURITY_CLIENT_CONTEXT { - SECURITY_QUALITY_OF_SERVICE SecurityQos; - PACCESS_TOKEN ClientToken; - BOOLEAN DirectlyAccessClientToken; - BOOLEAN DirectAccessEffectiveOnly; - BOOLEAN ServerIsRemote; - TOKEN_CONTROL ClientTokenControl; - } SECURITY_CLIENT_CONTEXT, *PSECURITY_CLIENT_CONTEXT; - -// -// where -// -// SecurityQos - is the security quality of service information in effect -// for this client. This information is used when directly accessing -// the client's token. In this case, the information here over-rides -// the information in the client's token. If a copy of the client's -// token is requested, it must be generated using this information, -// not the information in the client's token. In all cases, this -// information may not provide greater access than the information -// in the client's token. In particular, if the client's token is -// an impersonation token with an impersonation level of -// "SecurityDelegation", but the information in this field indicates -// an impersonation level of "SecurityIdentification", then -// the server may only get a copy of the token with an Identification -// level of impersonation. -// -// ClientToken - If the DirectlyAccessClientToken field is FALSE, -// then this field contains a pointer to a duplicate of the -// client's token. Otherwise, this field points directly to -// the client's token. -// -// DirectlyAccessClientToken - This boolean flag indicates whether the -// token pointed to by ClientToken is a copy of the client's token -// or is a direct reference to the client's token. A value of TRUE -// indicates the client's token is directly accessed, FALSE indicates -// a copy has been made. -// -// DirectAccessEffectiveOnly - This boolean flag indicates whether the -// the disabled portions of the token that is currently directly -// referenced may be enabled. This field is only valid if the -// DirectlyAccessClientToken field is TRUE. In that case, this -// value supersedes the EffectiveOnly value in the SecurityQos -// FOR THE CURRENT TOKEN ONLY! If the client changes to impersonate -// another client, this value may change. This value is always -// minimized by the EffectiveOnly flag in the SecurityQos field. -// -// ServerIsRemote - If TRUE indicates that the server of the client's -// request is remote. This is used for determining the legitimacy -// of certain levels of impersonation and to determine how to -// track context. -// -// ClientTokenControl - If the ServerIsRemote flag is TRUE, and the -// tracking mode is DYNAMIC, then this field contains a copy of -// the TOKEN_SOURCE from the client's token to assist in deciding -// whether the information at the remote server needs to be -// updated to match the current state of the client's security -// context. -// -// -// NOTE: At some point, we may find it worthwhile to keep an array of -// elements in this data structure, where each element of the -// array contains {ClientToken, ClientTokenControl} fields. -// This would allow efficient handling of the case where a client -// thread was constantly switching between a couple different -// contexts - presumably impersonating client's of its own. -// -#define NTKERNELAPI DECLSPEC_IMPORT -#define NTHALAPI DECLSPEC_IMPORT -// -// Priority increment definitions. The comment for each definition gives -// the names of the system services that use the definition when satisfying -// a wait. -// - -// -// Priority increment used when satisfying a wait on an executive event -// (NtPulseEvent and NtSetEvent) -// - -#define EVENT_INCREMENT 1 - -// -// Priority increment when no I/O has been done. This is used by device -// and file system drivers when completing an IRP (IoCompleteRequest). -// - -#define IO_NO_INCREMENT 0 - - -// -// Priority increment for completing CD-ROM I/O. This is used by CD-ROM device -// and file system drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_CD_ROM_INCREMENT 1 - -// -// Priority increment for completing disk I/O. This is used by disk device -// and file system drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_DISK_INCREMENT 1 - -// -// Priority increment for completing mailslot I/O. This is used by the mail- -// slot file system driver when completing an IRP (IoCompleteRequest). -// - -#define IO_MAILSLOT_INCREMENT 2 - -// -// Priority increment for completing named pipe I/O. This is used by the -// named pipe file system driver when completing an IRP (IoCompleteRequest). -// - -#define IO_NAMED_PIPE_INCREMENT 2 - -// -// Priority increment for completing network I/O. This is used by network -// device and network file system drivers when completing an IRP -// (IoCompleteRequest). -// - -#define IO_NETWORK_INCREMENT 2 - -// -// Priority increment used when satisfying a wait on an executive semaphore -// (NtReleaseSemaphore) -// - -#define SEMAPHORE_INCREMENT 1 - - - -// -// Memory priority definitions. -// - -#define SYSTEM_PAGE_PRIORITY_BITS 3 -#define SYSTEM_PAGE_PRIORITY_LEVELS (1 << SYSTEM_PAGE_PRIORITY_BITS) - - -// -// Miscellaneous type definitions -// -// APC state -// -// N.B. The user APC pending field must be the last member of this structure. -// - -typedef struct _KAPC_STATE { - LIST_ENTRY ApcListHead[MaximumMode]; - struct _KPROCESS *Process; - BOOLEAN KernelApcInProgress; - BOOLEAN KernelApcPending; - BOOLEAN UserApcPending; -} KAPC_STATE, *PKAPC_STATE, *PRKAPC_STATE; - -#define KAPC_STATE_ACTUAL_LENGTH \ - (FIELD_OFFSET(KAPC_STATE, UserApcPending) + sizeof(BOOLEAN)) - -// -// Queue object -// - -#define ASSERT_QUEUE(Q) NT_ASSERT(KOBJECT_TYPE(Q) == QueueObject); - -// begin_ntosp - -typedef struct _KQUEUE { - DISPATCHER_HEADER Header; - LIST_ENTRY EntryListHead; // Object lock - volatile ULONG CurrentCount; // Interlocked - ULONG MaximumCount; - LIST_ENTRY ThreadListHead; // Object lock -} KQUEUE, *PKQUEUE, *PRKQUEUE; - -// end_ntosp - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -KeInitializeMutant ( - __out PRKMUTANT Mutant, - __in BOOLEAN InitialOwner - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -KeQueryOwnerMutant ( - __in PKMUTANT Mutant, - __out PCLIENT_ID ClientId - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG -KeReadStateMutant ( - __in PRKMUTANT Mutant - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_when(Wait==0, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(Wait==1, __drv_maxIRQL(APC_LEVEL)) -__drv_when(Wait==1, __drv_reportError("Caution: 'Wait' argument does not provide" - " any synchronization guarantees, only a hint" - " to the system that the thread will immediately" - " issue a wait operation")) -NTKERNELAPI -LONG -KeReleaseMutant ( - __inout PRKMUTANT Mutant, - __in KPRIORITY Increment, - __in BOOLEAN Abandoned, - __in BOOLEAN Wait - ); -#endif - -// -// Queue Object. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -KeInitializeQueue ( - __out PRKQUEUE Queue, - __in ULONG Count - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG -KeReadStateQueue ( - __in PRKQUEUE Queue - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG -KeInsertQueue ( - __inout PRKQUEUE Queue, - __inout PLIST_ENTRY Entry - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG -KeInsertHeadQueue ( - __inout PRKQUEUE Queue, - __inout PLIST_ENTRY Entry - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_when((Timeout==NULL || *Timeout!=0), __drv_maxIRQL(APC_LEVEL)) -__drv_when((Timeout!=NULL && *Timeout==0), __drv_maxIRQL(DISPATCH_LEVEL)) -NTKERNELAPI -PLIST_ENTRY -KeRemoveQueue ( - __inout PRKQUEUE Queue, - __in KPROCESSOR_MODE WaitMode, - __in_opt PLARGE_INTEGER Timeout - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_when((Timeout==NULL || *Timeout!=0), __drv_maxIRQL(APC_LEVEL)) -__drv_when((Timeout!=NULL && *Timeout==0), __drv_maxIRQL(DISPATCH_LEVEL)) -NTKERNELAPI -ULONG -KeRemoveQueueEx ( - __inout PKQUEUE Queue, - __in KPROCESSOR_MODE WaitMode, - __in BOOLEAN Alertable, - __in_opt PLARGE_INTEGER Timeout, - __out_ecount_part(Count, return) PLIST_ENTRY *EntryArray, - __in ULONG Count - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PLIST_ENTRY -KeRundownQueue ( - __inout PRKQUEUE Queue - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeAttachProcess ( - __inout PRKPROCESS Process - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeDetachProcess ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeStackAttachProcess ( - __inout PRKPROCESS PROCESS, - __out PRKAPC_STATE ApcState - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeUnstackDetachProcess ( - __in PRKAPC_STATE ApcState - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -UCHAR -KeSetIdealProcessorThread ( - __inout PKTHREAD Thread, - __in UCHAR Processor - ); -#endif - -// begin_ntosp -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -KeSetKernelStackSwapEnable ( - __in BOOLEAN Enable - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_raisesIRQL(DISPATCH_LEVEL) -_DECL_HAL_KE_IMPORT -KIRQL -FASTCALL -KeAcquireQueuedSpinLock ( - __inout __deref __drv_acquiresExclusiveResource(KeQueuedSpinLockType) - __in KSPIN_LOCK_QUEUE_NUMBER Number - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -_DECL_HAL_KE_IMPORT -VOID -FASTCALL -KeReleaseQueuedSpinLock ( - __inout __deref __drv_releasesExclusiveResource(KeQueuedSpinLockType) - __in KSPIN_LOCK_QUEUE_NUMBER Number, - __in KIRQL OldIrql - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__drv_valueIs(==1;==0) -_DECL_HAL_KE_IMPORT -LOGICAL -FASTCALL -KeTryToAcquireQueuedSpinLock ( - __in KSPIN_LOCK_QUEUE_NUMBER Number, - __out __deref __drv_savesIRQL - PKIRQL OldIrql - ); -#endif - -#if defined(_X86_) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_raisesIRQL(SYNCH_LEVEL) -__drv_savesIRQL -_DECL_HAL_KE_IMPORT -KIRQL -FASTCALL -KeAcquireSpinLockRaiseToSynch ( - __inout __deref __drv_acquiresExclusiveResource(KeSpinLockType) - __inout PKSPIN_LOCK SpinLock - ); -#endif - -#else - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_raisesIRQL(SYNCH_LEVEL) -__drv_savesIRQL -NTKERNELAPI -KIRQL -KeAcquireSpinLockRaiseToSynch ( - __inout __deref __drv_acquiresExclusiveResource(KeSpinLockType) - __inout PKSPIN_LOCK SpinLock - ); -#endif - -#endif - -#define INVALID_PROCESSOR_INDEX 0xffffffff - -NTSTATUS -KeGetProcessorNumberFromIndex ( - __in ULONG ProcIndex, - __out PPROCESSOR_NUMBER ProcNumber - ); - -ULONG -KeGetProcessorIndexFromNumber ( - __in PPROCESSOR_NUMBER ProcNumber - ); - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -SIZE_T -ExQueryPoolBlockSize( - __in PVOID PoolBlock, - __out PBOOLEAN QuotaCharged - ); - -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -PSLIST_ENTRY -FASTCALL -InterlockedPushListSList ( - __inout PSLIST_HEADER ListHead, - __inout __drv_aliasesMem PSLIST_ENTRY List, - __inout PSLIST_ENTRY ListEnd, - __in ULONG Count - ); - -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// Define interlocked lookaside list structure and allocation functions. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -ExAdjustLookasideDepth ( - VOID - ); - -#endif - - -#if !defined(_X86AMD64_) - -#if defined(_WIN64) - -C_ASSERT(sizeof(ERESOURCE) == 0x68); -C_ASSERT(FIELD_OFFSET(ERESOURCE,ActiveCount) == 0x18); -C_ASSERT(FIELD_OFFSET(ERESOURCE,Flag) == 0x1a); - -#else - -C_ASSERT(sizeof(ERESOURCE) == 0x38); -C_ASSERT(FIELD_OFFSET(ERESOURCE,ActiveCount) == 0x0c); -C_ASSERT(FIELD_OFFSET(ERESOURCE,Flag) == 0x0e); - -#endif - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -ExDisableResourceBoostLite ( - __in PERESOURCE Resource - ); - -#endif - - -#define ExDisableResourceBoost ExDisableResourceBoostLite - - -// -// Push lock definitions -// - - -#define EX_PUSH_LOCK ULONG_PTR -#define PEX_PUSH_LOCK PULONG_PTR - - -VOID -ExInitializePushLock ( - __out PEX_PUSH_LOCK PushLock - ); - -// -// Token Flags -// -// Flags that may be defined in the TokenFlags field of the token object, -// or in an ACCESS_STATE structure -// - -#define TOKEN_HAS_TRAVERSE_PRIVILEGE 0x0001 -#define TOKEN_HAS_BACKUP_PRIVILEGE 0x0002 -#define TOKEN_HAS_RESTORE_PRIVILEGE 0x0004 -#define TOKEN_WRITE_RESTRICTED 0x0008 -#define TOKEN_IS_RESTRICTED 0x0010 -#define TOKEN_SESSION_NOT_REFERENCED 0x0020 -#define TOKEN_SANDBOX_INERT 0x0040 -#define TOKEN_HAS_IMPERSONATE_PRIVILEGE 0x0080 -#define SE_BACKUP_PRIVILEGES_CHECKED 0x0100 -#define TOKEN_VIRTUALIZE_ALLOWED 0x0200 -#define TOKEN_VIRTUALIZE_ENABLED 0x0400 -#define TOKEN_IS_FILTERED 0x0800 -#define TOKEN_UIACCESS 0x1000 -#define TOKEN_NOT_LOW 0x2000 - - -typedef struct _SE_EXPORTS { - - // - // Privilege values - // - - LUID SeCreateTokenPrivilege; - LUID SeAssignPrimaryTokenPrivilege; - LUID SeLockMemoryPrivilege; - LUID SeIncreaseQuotaPrivilege; - LUID SeUnsolicitedInputPrivilege; - LUID SeTcbPrivilege; - LUID SeSecurityPrivilege; - LUID SeTakeOwnershipPrivilege; - LUID SeLoadDriverPrivilege; - LUID SeCreatePagefilePrivilege; - LUID SeIncreaseBasePriorityPrivilege; - LUID SeSystemProfilePrivilege; - LUID SeSystemtimePrivilege; - LUID SeProfileSingleProcessPrivilege; - LUID SeCreatePermanentPrivilege; - LUID SeBackupPrivilege; - LUID SeRestorePrivilege; - LUID SeShutdownPrivilege; - LUID SeDebugPrivilege; - LUID SeAuditPrivilege; - LUID SeSystemEnvironmentPrivilege; - LUID SeChangeNotifyPrivilege; - LUID SeRemoteShutdownPrivilege; - - - // - // Universally defined Sids - // - - - PSID SeNullSid; - PSID SeWorldSid; - PSID SeLocalSid; - PSID SeCreatorOwnerSid; - PSID SeCreatorGroupSid; - - - // - // Nt defined Sids - // - - - PSID SeNtAuthoritySid; - PSID SeDialupSid; - PSID SeNetworkSid; - PSID SeBatchSid; - PSID SeInteractiveSid; - PSID SeLocalSystemSid; - PSID SeAliasAdminsSid; - PSID SeAliasUsersSid; - PSID SeAliasGuestsSid; - PSID SeAliasPowerUsersSid; - PSID SeAliasAccountOpsSid; - PSID SeAliasSystemOpsSid; - PSID SeAliasPrintOpsSid; - PSID SeAliasBackupOpsSid; - - // - // New Sids defined for NT5 - // - - PSID SeAuthenticatedUsersSid; - - PSID SeRestrictedSid; - PSID SeAnonymousLogonSid; - - // - // New Privileges defined for NT5 - // - - LUID SeUndockPrivilege; - LUID SeSyncAgentPrivilege; - LUID SeEnableDelegationPrivilege; - - // - // New Sids defined for post-Windows 2000 - - PSID SeLocalServiceSid; - PSID SeNetworkServiceSid; - - // - // New Privileges defined for post-Windows 2000 - // - - LUID SeManageVolumePrivilege; - LUID SeImpersonatePrivilege; - LUID SeCreateGlobalPrivilege; - - // - // New Privileges defined for post Windows Server 2003 - // - - LUID SeTrustedCredManAccessPrivilege; - LUID SeRelabelPrivilege; - LUID SeIncreaseWorkingSetPrivilege; - - LUID SeTimeZonePrivilege; - LUID SeCreateSymbolicLinkPrivilege; - - // - // New Sids defined for post Windows Server 2003 - // - - PSID SeIUserSid; - - // - // Mandatory Sids, ordered lowest to highest. - // - - PSID SeUntrustedMandatorySid; - PSID SeLowMandatorySid; - PSID SeMediumMandatorySid; - PSID SeHighMandatorySid; - PSID SeSystemMandatorySid; - - PSID SeOwnerRightsSid; - -} SE_EXPORTS, *PSE_EXPORTS; - -/////////////////////////////////////////////////////////////////////////////// -// // -// Logon session notification callback routines // -// // -/////////////////////////////////////////////////////////////////////////////// - -// -// These callback routines are used to notify file systems that have -// registered of logon sessions being terminated, so they can cleanup state -// associated with this logon session -// - -typedef NTSTATUS -(*PSE_LOGON_SESSION_TERMINATED_ROUTINE)( - __in PLUID LogonId); - -//++ -// -// ULONG -// SeLengthSid( -// __in PSID Sid -// ); -// -// Routine Description: -// -// This routine computes the length of a SID. -// -// Arguments: -// -// Sid - Points to the SID whose length is to be returned. -// -// Return Value: -// -// The length, in bytes of the SID. -// -//-- - -#define SeLengthSid( Sid ) \ - (8 + (4 * ((SID *)Sid)->SubAuthorityCount)) - -// -//VOID -//SeDeleteClientSecurity( -// __in PSECURITY_CLIENT_CONTEXT ClientContext -// ) -// -///*++ -// -//Routine Description: -// -// This service deletes a client security context block, -// performing whatever cleanup might be necessary to do so. In -// particular, reference to any client token is removed. -// -//Arguments: -// -// ClientContext - Points to the client security context block to be -// deleted. -// -// -//Return Value: -// -// -// -//--*/ -//-- - -// begin_ntosp -#define SeDeleteClientSecurity(C) { \ - if (SeTokenType((C)->ClientToken) == TokenPrimary) { \ - PsDereferencePrimaryToken( (C)->ClientToken ); \ - } else { \ - PsDereferenceImpersonationToken( (C)->ClientToken ); \ - } \ - } - - -//++ -//VOID -//SeStopImpersonatingClient() -// -///*++ -// -//Routine Description: -// -// This service is used to stop impersonating a client using an -// impersonation token. This service must be called in the context -// of the server thread which wishes to stop impersonating its -// client. -// -// -//Arguments: -// -// None. -// -//Return Value: -// -// None. -// -//--*/ -//-- - -#define SeStopImpersonatingClient() PsRevertToSelf() - - -//++ -// -// PACCESS_TOKEN -// SeQuerySubjectContextToken( -// __in PSECURITY_SUBJECT_CONTEXT SubjectContext -// ); -// -// Routine Description: -// -// This routine returns the effective token from the subject context, -// either the client token, if present, or the process token. -// -// Arguments: -// -// SubjectContext - Context to query -// -// Return Value: -// -// This routine returns the PACCESS_TOKEN for the effective token. -// The pointer may be passed to SeQueryInformationToken. This routine -// does not affect the lock status of the token, i.e. the token is not -// locked. If the SubjectContext has been locked, the token remains locked, -// if not, the token remains unlocked. -// -//-- - -#define SeQuerySubjectContextToken( SubjectContext ) \ - ( ARGUMENT_PRESENT( ((PSECURITY_SUBJECT_CONTEXT) SubjectContext)->ClientToken) ? \ - ((PSECURITY_SUBJECT_CONTEXT) SubjectContext)->ClientToken : \ - ((PSECURITY_SUBJECT_CONTEXT) SubjectContext)->PrimaryToken ) - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeCaptureSubjectContext ( - __out PSECURITY_SUBJECT_CONTEXT SubjectContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeLockSubjectContext( - __in PSECURITY_SUBJECT_CONTEXT SubjectContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeUnlockSubjectContext( - __in PSECURITY_SUBJECT_CONTEXT SubjectContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeReleaseSubjectContext ( - __inout PSECURITY_SUBJECT_CONTEXT SubjectContext - ); -#endif - - -NTSTATUS -SeReportSecurityEventWithSubCategory( - __in ULONG Flags, - __in PUNICODE_STRING SourceName, - __in_opt PSID UserSid, - __in PSE_ADT_PARAMETER_ARRAY AuditParameters, - __in ULONG AuditSubcategoryId - ); - -BOOLEAN -SeAccessCheckFromState ( - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in PTOKEN_ACCESS_INFORMATION PrimaryTokenInformation, - __in_opt PTOKEN_ACCESS_INFORMATION ClientTokenInformation, - __in ACCESS_MASK DesiredAccess, - __in ACCESS_MASK PreviouslyGrantedAccess, - __deref_opt_out_opt PPRIVILEGE_SET *Privileges, - __in PGENERIC_MAPPING GenericMapping, - __in KPROCESSOR_MODE AccessMode, - __out PACCESS_MASK GrantedAccess, - __out PNTSTATUS AccessStatus - ); - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -SePrivilegeCheck( - __inout PPRIVILEGE_SET RequiredPrivileges, - __in PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext, - __in KPROCESSOR_MODE AccessMode - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeFreePrivileges( - __in PPRIVILEGE_SET Privileges - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeOpenObjectAuditAlarm ( - __in PUNICODE_STRING ObjectTypeName, - __in_opt PVOID Object, - __in_opt PUNICODE_STRING AbsoluteObjectName, - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in PACCESS_STATE AccessState, - __in BOOLEAN ObjectCreated, - __in BOOLEAN AccessGranted, - __in KPROCESSOR_MODE AccessMode, - __out PBOOLEAN GenerateOnClose - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -VOID -SeOpenObjectAuditAlarmWithTransaction ( - __in PUNICODE_STRING ObjectTypeName, - __in_opt PVOID Object, - __in_opt PUNICODE_STRING AbsoluteObjectName, - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in PACCESS_STATE AccessState, - __in BOOLEAN ObjectCreated, - __in BOOLEAN AccessGranted, - __in KPROCESSOR_MODE AccessMode, - __in_opt GUID *TransactionId, - __out PBOOLEAN GenerateOnClose - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeOpenObjectForDeleteAuditAlarm ( - __in PUNICODE_STRING ObjectTypeName, - __in_opt PVOID Object, - __in_opt PUNICODE_STRING AbsoluteObjectName, - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in PACCESS_STATE AccessState, - __in BOOLEAN ObjectCreated, - __in BOOLEAN AccessGranted, - __in KPROCESSOR_MODE AccessMode, - __out PBOOLEAN GenerateOnClose - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -VOID -SeOpenObjectForDeleteAuditAlarmWithTransaction ( - __in PUNICODE_STRING ObjectTypeName, - __in_opt PVOID Object, - __in_opt PUNICODE_STRING AbsoluteObjectName, - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in PACCESS_STATE AccessState, - __in BOOLEAN ObjectCreated, - __in BOOLEAN AccessGranted, - __in KPROCESSOR_MODE AccessMode, - __in_opt GUID *TransactionId, - __out PBOOLEAN GenerateOnClose - ); - -NTKERNELAPI -VOID -SeExamineSacl( - __in PACL Sacl, - __in PACCESS_TOKEN Token, - __in ACCESS_MASK DesiredAccess, - __in BOOLEAN AccessGranted, - __out PBOOLEAN GenerateAudit, - __out PBOOLEAN GenerateAlarm - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeDeleteObjectAuditAlarm( - __in PVOID Object, - __in HANDLE Handle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -VOID -SeDeleteObjectAuditAlarmWithTransaction( - __in PVOID Object, - __in HANDLE Handle, - __in_opt GUID *TransactionId - ); - - - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -TOKEN_TYPE -SeTokenType( - __in PACCESS_TOKEN Token - ); -#endif -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -SeTokenIsAdmin( - __in PACCESS_TOKEN Token - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -SeTokenIsRestricted( - __in PACCESS_TOKEN Token - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA || (NTDDI_VERSION >= NTDDI_WINXPSP2 && NTDDI_VERSION < NTDDI_WS03)) -NTKERNELAPI -BOOLEAN -SeTokenIsWriteRestricted( - __in PACCESS_TOKEN Token - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -SeFilterToken ( - __in PACCESS_TOKEN ExistingToken, - __in ULONG Flags, - __in_opt PTOKEN_GROUPS SidsToDisable, - __in_opt PTOKEN_PRIVILEGES PrivilegesToDelete, - __in_opt PTOKEN_GROUPS RestrictedSids, - __deref_out PACCESS_TOKEN * FilteredToken - ); -#endif - -// begin_ntosp -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeQueryAuthenticationIdToken( - __in PACCESS_TOKEN Token, - __out PLUID AuthenticationId - ); -#endif - -// end_ntosp - -// begin_ntosp -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -VOID -SeQueryTokenIntegrity( - __in PACCESS_TOKEN Token, - __inout PSID_AND_ATTRIBUTES IntegritySA - ); -#endif -// end_ntosp - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeQuerySessionIdToken( - __in PACCESS_TOKEN Token, - __out PULONG SessionId - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -NTSTATUS -SeSetSessionIdToken( - __in PACCESS_TOKEN Token, - __in ULONG SessionId - ); -#endif - -// begin_ntosp -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeCreateClientSecurity ( - __in PETHREAD ClientThread, - __in PSECURITY_QUALITY_OF_SERVICE ClientSecurityQos, - __in BOOLEAN RemoteSession, - __out PSECURITY_CLIENT_CONTEXT ClientContext - ); -#endif -// end_ntosp - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeImpersonateClient( - __in PSECURITY_CLIENT_CONTEXT ClientContext, - __in_opt PETHREAD ServerThread - ); -#endif - -// begin_ntosp -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeImpersonateClientEx( - __in PSECURITY_CLIENT_CONTEXT ClientContext, - __in_opt PETHREAD ServerThread - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeCreateClientSecurityFromSubjectContext ( - __in PSECURITY_SUBJECT_CONTEXT SubjectContext, - __in PSECURITY_QUALITY_OF_SERVICE ClientSecurityQos, - __in BOOLEAN ServerIsRemote, - __out PSECURITY_CLIENT_CONTEXT ClientContext - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeQuerySecurityDescriptorInfo ( - __in PSECURITY_INFORMATION SecurityInformation, - __out_bcount(*Length) PSECURITY_DESCRIPTOR SecurityDescriptor, - __inout PULONG Length, - __deref_inout PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeSetSecurityDescriptorInfo ( - __in_opt PVOID Object, - __in PSECURITY_INFORMATION SecurityInformation, - __in PSECURITY_DESCRIPTOR ModificationDescriptor, - __inout PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor, - __in POOL_TYPE PoolType, - __in PGENERIC_MAPPING GenericMapping - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeSetSecurityDescriptorInfoEx ( - __in_opt PVOID Object, - __in PSECURITY_INFORMATION SecurityInformation, - __in PSECURITY_DESCRIPTOR ModificationDescriptor, - __inout PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor, - __in ULONG AutoInheritFlags, - __in POOL_TYPE PoolType, - __in PGENERIC_MAPPING GenericMapping - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeAppendPrivileges( - __inout PACCESS_STATE AccessState, - __in PPRIVILEGE_SET Privileges - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -VOID -SeAuditHardLinkCreation( - __in __in PUNICODE_STRING FileName, - __in __in PUNICODE_STRING LinkName, - __in __in BOOLEAN bSuccess - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -VOID -SeAuditHardLinkCreationWithTransaction( - __in PUNICODE_STRING FileName, - __in PUNICODE_STRING LinkName, - __in BOOLEAN bSuccess, - __in_opt GUID *TransactionId - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -VOID -SeAuditTransactionStateChange( - __in GUID *TransactionId, - __in GUID *ResourceManagerId, - __in ULONG NewTransactionState - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -SeAuditingFileEvents( - __in BOOLEAN AccessGranted, - __in PSECURITY_DESCRIPTOR SecurityDescriptor - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXPSP2) -NTKERNELAPI -BOOLEAN -SeAuditingFileEventsWithContext( - __in BOOLEAN AccessGranted, - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in_opt PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -BOOLEAN -SeAuditingAnyFileEventsWithContext( - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in_opt PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2KSP3) -NTKERNELAPI -BOOLEAN -SeAuditingHardLinkEvents( - __in BOOLEAN AccessGranted, - __in PSECURITY_DESCRIPTOR SecurityDescriptor - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXPSP2) -NTKERNELAPI -BOOLEAN -SeAuditingHardLinkEventsWithContext( - __in BOOLEAN AccessGranted, - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in_opt PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -SeAuditingFileOrGlobalEvents( - __in BOOLEAN AccessGranted, - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -VOID -SeSetAccessStateGenericMapping ( - __inout PACCESS_STATE AccessState, - __in PGENERIC_MAPPING GenericMapping - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeRegisterLogonSessionTerminatedRoutine( - __in PSE_LOGON_SESSION_TERMINATED_ROUTINE CallbackRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeUnregisterLogonSessionTerminatedRoutine( - __in PSE_LOGON_SESSION_TERMINATED_ROUTINE CallbackRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeMarkLogonSessionForTerminationNotification( - __in PLUID LogonId - ); -#endif - -// begin_ntosp - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeQueryInformationToken ( - __in PACCESS_TOKEN Token, - __in TOKEN_INFORMATION_CLASS TokenInformationClass, - __deref_out PVOID *TokenInformation - ); -#endif - - -NTSTATUS -SeLocateProcessImageName( - __inout PEPROCESS Process, - __deref_out PUNICODE_STRING *pImageFileName - ); - -// -// Grants access to SeExports structure -// - -extern NTKERNELAPI PSE_EXPORTS SeExports; - - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -NTKERNELAPI -VOID -SeExamineGlobalSacl( - __in PUNICODE_STRING ObjectType, - __in PACCESS_TOKEN Token, - __in ACCESS_MASK DesiredAccess, - __in BOOLEAN AccessGranted, - __inout PBOOLEAN GenerateAudit, - __inout_opt PBOOLEAN GenerateAlarm -); - -NTKERNELAPI -VOID -SeMaximumAuditMaskFromGlobalSacl( - __in_opt PUNICODE_STRING ObjectTypeName, - __in ACCESS_MASK GrantedAccess, - __in PACCESS_TOKEN Token, - __inout PACCESS_MASK AuditMask - ); - -#endif - - -#if !defined(_PSGETCURRENTTHREAD_) - -#define _PSGETCURRENTTHREAD_ - -__drv_maxIRQL(DISPATCH_LEVEL) -FORCEINLINE -PETHREAD -PsGetCurrentThread ( - VOID - ) - -/*++ - -Routine Description: - - This function returns a pointer to the current executive thread object. - -Arguments: - - None. - -Return Value: - - A pointer to the current executive thread object. - ---*/ - -{ - - return (PETHREAD)KeGetCurrentThread(); -} - -#endif - - -// -// Security Support -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -PsAssignImpersonationToken( - __in PETHREAD Thread, - __in_opt HANDLE Token - ); -#endif - -// begin_ntosp - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -PACCESS_TOKEN -PsReferencePrimaryToken ( - __inout PEPROCESS Process - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -PsDereferencePrimaryToken( - __in PACCESS_TOKEN PrimaryToken - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -PsDereferenceImpersonationToken( - __in PACCESS_TOKEN ImpersonationToken - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PACCESS_TOKEN -PsReferenceImpersonationToken( - __inout PETHREAD Thread, - __out PBOOLEAN CopyOnOpen, - __out PBOOLEAN EffectiveOnly, - __out PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -LARGE_INTEGER -PsGetProcessExitTime( - VOID - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -PsIsThreadTerminating( - __in PETHREAD Thread - ); -#endif - -// begin_ntosp - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -PsImpersonateClient( - __inout PETHREAD Thread, - __in PACCESS_TOKEN Token, - __in BOOLEAN CopyOnOpen, - __in BOOLEAN EffectiveOnly, - __in SECURITY_IMPERSONATION_LEVEL ImpersonationLevel - ); -#endif - -// end_ntosp - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -BOOLEAN -PsDisableImpersonation( - __inout PETHREAD Thread, - __inout PSE_IMPERSONATION_STATE ImpersonationState - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -PsRestoreImpersonation( - __inout PETHREAD Thread, - __in PSE_IMPERSONATION_STATE ImpersonationState - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -PsRevertToSelf( - VOID - ); -#endif - - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -PsLookupProcessByProcessId( - __in HANDLE ProcessId, - __deref_out PEPROCESS *Process - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -PsLookupThreadByThreadId( - __in HANDLE ThreadId, - __deref_out PETHREAD *Thread - ); - -// -// Quota Operations -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -PsChargePoolQuota ( - __in PEPROCESS Process, - __in POOL_TYPE PoolType, - __in ULONG_PTR Amount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -PsChargeProcessPoolQuota ( - __in PEPROCESS Process, - __in POOL_TYPE PoolType, - __in ULONG_PTR Amount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -PsReturnPoolQuota( - __in PEPROCESS Process, - __in POOL_TYPE PoolType, - __in ULONG_PTR Amount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -BOOLEAN -PsIsSystemThread( - __in PETHREAD Thread - ); -#endif - -#define IO_OPEN_PAGING_FILE 0x0002 -#define IO_OPEN_TARGET_DIRECTORY 0x0004 - -#define IO_STOP_ON_SYMLINK 0x0008 - - -#define IO_MM_PAGING_FILE 0x0010 - - -// -// Define driver FS notification change routine type. -// - -typedef -VOID -DRIVER_FS_NOTIFICATION ( - __in struct _DEVICE_OBJECT *DeviceObject, - __in BOOLEAN FsActive - ); - -typedef DRIVER_FS_NOTIFICATION *PDRIVER_FS_NOTIFICATION; - - -// -// Valid values for FS_FILTER_PARAMETERS.AcquireForSectionSynchronization.SyncType -// - -typedef enum _FS_FILTER_SECTION_SYNC_TYPE { - SyncTypeOther = 0, - SyncTypeCreateSection -} FS_FILTER_SECTION_SYNC_TYPE, *PFS_FILTER_SECTION_SYNC_TYPE; - -// -// Valid values for FS_FILTER_PARAMETERS.NotifyStreamFileObject.NotificationType -// - -typedef enum _FS_FILTER_STREAM_FO_NOTIFICATION_TYPE { - NotifyTypeCreate = 0, - NotifyTypeRetired -} FS_FILTER_STREAM_FO_NOTIFICATION_TYPE, *PFS_FILTER_STREAM_FO_NOTIFICATION_TYPE; - -// -// Parameters union for the operations that -// are exposed to the filters through the -// FsFilterCallbacks registration mechanism. -// - -#if _MSC_VER >= 1200 -#pragma warning(push) -#pragma warning(disable:4324) // structure was padded due to __declspec(align()) -#endif - -typedef union _FS_FILTER_PARAMETERS { - - // - // AcquireForModifiedPageWriter - // - - struct { - PLARGE_INTEGER EndingOffset; - PERESOURCE *ResourceToRelease; - } AcquireForModifiedPageWriter; - - // - // ReleaseForModifiedPageWriter - // - - struct { - PERESOURCE ResourceToRelease; - } ReleaseForModifiedPageWriter; - - // - // AcquireForSectionSynchronization - // - - struct { - FS_FILTER_SECTION_SYNC_TYPE SyncType; - ULONG PageProtection; - } AcquireForSectionSynchronization; - - // - // NotifyStreamFileObjectCreation - // - - struct { - FS_FILTER_STREAM_FO_NOTIFICATION_TYPE NotificationType; - BOOLEAN POINTER_ALIGNMENT SafeToRecurse; - } NotifyStreamFileObject; - - // - // Other - // - - struct { - PVOID Argument1; - PVOID Argument2; - PVOID Argument3; - PVOID Argument4; - PVOID Argument5; - } Others; - -} FS_FILTER_PARAMETERS, *PFS_FILTER_PARAMETERS; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - -// -// These are the valid values for the Operation field -// of the FS_FILTER_CALLBACK_DATA structure. -// - -#define FS_FILTER_ACQUIRE_FOR_SECTION_SYNCHRONIZATION (UCHAR)-1 -#define FS_FILTER_RELEASE_FOR_SECTION_SYNCHRONIZATION (UCHAR)-2 -#define FS_FILTER_ACQUIRE_FOR_MOD_WRITE (UCHAR)-3 -#define FS_FILTER_RELEASE_FOR_MOD_WRITE (UCHAR)-4 -#define FS_FILTER_ACQUIRE_FOR_CC_FLUSH (UCHAR)-5 -#define FS_FILTER_RELEASE_FOR_CC_FLUSH (UCHAR)-6 - -typedef struct _FS_FILTER_CALLBACK_DATA { - - ULONG SizeOfFsFilterCallbackData; - UCHAR Operation; - UCHAR Reserved; - - struct _DEVICE_OBJECT *DeviceObject; - struct _FILE_OBJECT *FileObject; - - FS_FILTER_PARAMETERS Parameters; - -} FS_FILTER_CALLBACK_DATA, *PFS_FILTER_CALLBACK_DATA; - -// -// Prototype for the callbacks received before an operation -// is passed to the base file system. -// -// A filter can fail this operation, but consistant failure -// will halt system progress. -// - -typedef -NTSTATUS -(*PFS_FILTER_CALLBACK) ( - __in PFS_FILTER_CALLBACK_DATA Data, - __out PVOID *CompletionContext - ); - -// -// Prototype for the completion callback received after an -// operation is completed. -// - -typedef -VOID -(*PFS_FILTER_COMPLETION_CALLBACK) ( - __in PFS_FILTER_CALLBACK_DATA Data, - __in NTSTATUS OperationStatus, - __in PVOID CompletionContext - ); - -// -// This is the structure that the file system filter fills in to -// receive notifications for these locking operations. -// -// A filter should set the field to NULL for any notification callback -// it doesn't wish to receive. -// - -typedef struct _FS_FILTER_CALLBACKS { - - ULONG SizeOfFsFilterCallbacks; - ULONG Reserved; // For alignment - - PFS_FILTER_CALLBACK PreAcquireForSectionSynchronization; - PFS_FILTER_COMPLETION_CALLBACK PostAcquireForSectionSynchronization; - PFS_FILTER_CALLBACK PreReleaseForSectionSynchronization; - PFS_FILTER_COMPLETION_CALLBACK PostReleaseForSectionSynchronization; - PFS_FILTER_CALLBACK PreAcquireForCcFlush; - PFS_FILTER_COMPLETION_CALLBACK PostAcquireForCcFlush; - PFS_FILTER_CALLBACK PreReleaseForCcFlush; - PFS_FILTER_COMPLETION_CALLBACK PostReleaseForCcFlush; - PFS_FILTER_CALLBACK PreAcquireForModifiedPageWriter; - PFS_FILTER_COMPLETION_CALLBACK PostAcquireForModifiedPageWriter; - PFS_FILTER_CALLBACK PreReleaseForModifiedPageWriter; - PFS_FILTER_COMPLETION_CALLBACK PostReleaseForModifiedPageWriter; - -} FS_FILTER_CALLBACKS, *PFS_FILTER_CALLBACKS; - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -FsRtlRegisterFileSystemFilterCallbacks ( - __in struct _DRIVER_OBJECT *FilterDriverObject, - __in PFS_FILTER_CALLBACKS Callbacks - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -NTSTATUS -FsRtlNotifyStreamFileObject ( - __in struct _FILE_OBJECT * StreamFileObject, - __in_opt struct _DEVICE_OBJECT *DeviceObjectHint, - __in FS_FILTER_STREAM_FO_NOTIFICATION_TYPE NotificationType, - __in BOOLEAN SafeToRecurse - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - -#define DO_VERIFY_VOLUME 0x00000002 -#define DO_BUFFERED_IO 0x00000004 -#define DO_EXCLUSIVE 0x00000008 -#define DO_DIRECT_IO 0x00000010 -#define DO_MAP_IO_BUFFER 0x00000020 -#define DO_DEVICE_HAS_NAME 0x00000040 -#define DO_DEVICE_INITIALIZING 0x00000080 -#define DO_SYSTEM_BOOT_PARTITION 0x00000100 -#define DO_LONG_TERM_REQUESTS 0x00000200 -#define DO_NEVER_LAST_DEVICE 0x00000400 -#define DO_SHUTDOWN_REGISTERED 0x00000800 -#define DO_BUS_ENUMERATED_DEVICE 0x00001000 -#define DO_POWER_PAGABLE 0x00002000 -#define DO_POWER_INRUSH 0x00004000 -#define DO_LOW_PRIORITY_FILESYSTEM 0x00010000 -#define DO_SUPPORTS_TRANSACTIONS 0x00040000 -#define DO_FORCE_NEITHER_IO 0x00080000 -#define DO_VOLUME_DEVICE_OBJECT 0x00100000 -#define DO_SYSTEM_SYSTEM_PARTITION 0x00200000 -#define DO_SYSTEM_CRITICAL_PARTITION 0x00400000 -#define DO_DISALLOW_EXECUTE 0x00800000 - -// -// The following are global counters used by the I/O system to indicate the -// amount of I/O being performed in the system. The first three counters -// are just that, counts of operations that have been requested, while the -// last three counters track the amount of data transferred for each type -// of I/O request. -// - -extern KSPIN_LOCK IoStatisticsLock; -extern ULONG IoReadOperationCount; -extern ULONG IoWriteOperationCount; -extern ULONG IoOtherOperationCount; -extern LARGE_INTEGER IoReadTransferCount; -extern LARGE_INTEGER IoWriteTransferCount; -extern LARGE_INTEGER IoOtherTransferCount; - -// -// It is difficult for cached file systems to properly charge quota -// for the storage that they allocate on behalf of user file handles, -// so the following amount of additional quota is charged against each -// handle as a "best guess" as to the amount of quota the file system -// will allocate on behalf of this handle. -// - -// -// These numbers are totally arbitrary, and can be changed if it turns out -// that the file systems actually allocate more (or less) on behalf of -// their file objects. The non-paged pool charge constant is added to the -// size of a FILE_OBJECT to get the actual charge amount. -// - -#define IO_FILE_OBJECT_NON_PAGED_POOL_CHARGE 64 -#define IO_FILE_OBJECT_PAGED_POOL_CHARGE 1024 - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -IoAcquireVpbSpinLock( - __out PKIRQL Irql - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoCheckDesiredAccess( - __inout PACCESS_MASK DesiredAccess, - __in ACCESS_MASK GrantedAccess - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoCheckEaBufferValidity( - __in PFILE_FULL_EA_INFORMATION EaBuffer, - __in ULONG EaLength, - __out PULONG ErrorOffset - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoCheckFunctionAccess( - __in ACCESS_MASK GrantedAccess, - __in UCHAR MajorFunction, - __in UCHAR MinorFunction, - __in ULONG IoControlCode, - __in_opt PVOID Arg1, - __in_opt PVOID Arg2 - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoCheckQuerySetFileInformation( - __in FILE_INFORMATION_CLASS FileInformationClass, - __in ULONG Length, - __in BOOLEAN SetOperation - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoCheckQuerySetVolumeInformation( - __in FS_INFORMATION_CLASS FsInformationClass, - __in ULONG Length, - __in BOOLEAN SetOperation - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoCheckQuotaBufferValidity( - __in PFILE_QUOTA_INFORMATION QuotaBuffer, - __in ULONG QuotaLength, - __out PULONG ErrorOffset - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PFILE_OBJECT -IoCreateStreamFileObject( - __in_opt PFILE_OBJECT FileObject, - __in_opt PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -PFILE_OBJECT -IoCreateStreamFileObjectEx( - __in_opt PFILE_OBJECT FileObject, - __in_opt PDEVICE_OBJECT DeviceObject, - __out_opt PHANDLE FileObjectHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PFILE_OBJECT -IoCreateStreamFileObjectLite( - __in_opt PFILE_OBJECT FileObject, - __in_opt PDEVICE_OBJECT DeviceObject - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -IoFastQueryNetworkAttributes( - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in ACCESS_MASK DesiredAccess, - __in ULONG OpenOptions, - __out PIO_STATUS_BLOCK IoStatus, - __out PFILE_NETWORK_OPEN_INFORMATION Buffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoPageRead( - __in PFILE_OBJECT FileObject, - __in PMDL MemoryDescriptorList, - __in PLARGE_INTEGER StartingOffset, - __in PKEVENT Event, - __out PIO_STATUS_BLOCK IoStatusBlock - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PDEVICE_OBJECT -IoGetAttachedDevice( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) // wdm -NTKERNELAPI // wdm -PDEVICE_OBJECT // wdm -__drv_maxIRQL(DISPATCH_LEVEL) // wdm -IoGetAttachedDeviceReference( // wdm - __in PDEVICE_OBJECT DeviceObject // wdm - ); // wdm -#endif // wdm - // wdm -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PDEVICE_OBJECT -IoGetBaseFileSystemDeviceObject( - __in PFILE_OBJECT FileObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) // ntddk -NTKERNELAPI // ntddk ntosp -PCONFIGURATION_INFORMATION // ntddk ntosp -__drv_maxIRQL(PASSIVE_LEVEL) // ntddk ntosp -IoGetConfigurationInformation( VOID ); // ntddk ntosp -#endif // ntddk - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -ULONG -IoGetRequestorProcessId( - __in PIRP Irp - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PEPROCESS -IoGetRequestorProcess( - __in PIRP Irp - ); -#endif - -// begin_wdm - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PIRP -IoGetTopLevelIrp( - VOID - ); -#endif - - -//++ -// -// BOOLEAN -// IoIsFileOpenedExclusively( -// __in PFILE_OBJECT FileObject -// ) -// -// Routine Description: -// -// This routine is invoked to determine whether the file open represented -// by the specified file object is opened exclusively. -// -// Arguments: -// -// FileObject - Pointer to the file object that represents the open instance -// of the target file to be tested for exclusive access. -// -// Return Value: -// -// The function value is TRUE if the open instance of the file is exclusive; -// otherwise FALSE is returned. -// -//-- - -#define IoIsFileOpenedExclusively( FileObject ) (\ - (BOOLEAN) !((FileObject)->SharedRead || (FileObject)->SharedWrite || (FileObject)->SharedDelete)) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -IoIsOperationSynchronous( - __in PIRP Irp - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -IoIsSystemThread( - __in PETHREAD Thread - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -IoIsValidNameGraftingBuffer( - __in PIRP Irp, - __in PREPARSE_DATA_BUFFER ReparseBuffer - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoQueryFileDosDeviceName( - __in PFILE_OBJECT FileObject, - __out POBJECT_NAME_INFORMATION *ObjectNameInformation - ); -#endif - -// begin_ntosp -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoQueryFileInformation( - __in PFILE_OBJECT FileObject, - __in FILE_INFORMATION_CLASS FileInformationClass, - __in ULONG Length, - __out PVOID FileInformation, - __out PULONG ReturnedLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoQueryVolumeInformation( - __in PFILE_OBJECT FileObject, - __in FS_INFORMATION_CLASS FsInformationClass, - __in ULONG Length, - __out PVOID FsInformation, - __out PULONG ReturnedLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -IoQueueThreadIrp( - __in PIRP Irp - ); -#endif - -// end_ntosp - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -IoRegisterFileSystem( - __in __drv_aliasesMem PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoRegisterFsRegistrationChange( - __in PDRIVER_OBJECT DriverObject, - __in PDRIVER_FS_NOTIFICATION DriverNotificationRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -NTSTATUS -IoRegisterFsRegistrationChangeMountAware( - __in PDRIVER_OBJECT DriverObject, - __in PDRIVER_FS_NOTIFICATION DriverNotificationRoutine, - __in BOOLEAN SynchronizeWithMounts - ); -#endif - -#if (NTDDI_VERSION == NTDDI_WIN2K) -// This API only exists in W2K, it does not exist in any later OS -NTKERNELAPI -NTSTATUS -IoRegisterFsRegistrationChangeEx( - __in PDRIVER_OBJECT DriverObject, - __in PDRIVER_FS_NOTIFICATION DriverNotificationRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -NTKERNELAPI -NTSTATUS -IoEnumerateRegisteredFiltersList( - __out_bcount_part_opt(DriverObjectListSize,(*ActualNumberDriverObjects)*sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList, - __in ULONG DriverObjectListSize, //in bytes - __out PULONG ActualNumberDriverObjects //in elements - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -NTSTATUS -IoReplaceFileObjectName ( - __in PFILE_OBJECT FileObject, - __in_bcount(FileNameLength) PWSTR NewFileName, - __in USHORT FileNameLength - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -IoReleaseVpbSpinLock( - __in KIRQL Irql - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -IoSetDeviceToVerify( - __in PETHREAD Thread, - __in_opt PDEVICE_OBJECT DeviceObject - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoSetInformation( - __in PFILE_OBJECT FileObject, - __in FILE_INFORMATION_CLASS FileInformationClass, - __in ULONG Length, - __in PVOID FileInformation - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -IoSetTopLevelIrp( - __in_opt PIRP Irp - ); -#endif - - -//++ -// -// USHORT -// IoSizeOfIrp( -// __in CCHAR StackSize -// ) -// -// Routine Description: -// -// Determines the size of an IRP given the number of stack locations -// the IRP will have. -// -// Arguments: -// -// StackSize - Number of stack locations for the IRP. -// -// Return Value: -// -// Size in bytes of the IRP. -// -//-- - -#define IoSizeOfIrp( StackSize ) \ - ((USHORT) (sizeof( IRP ) + ((StackSize) * (sizeof( IO_STACK_LOCATION ))))) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) __drv_minIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoStartNextPacket( - __in PDEVICE_OBJECT DeviceObject, - __in BOOLEAN Cancelable - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoStartNextPacketByKey( - __in PDEVICE_OBJECT DeviceObject, - __in BOOLEAN Cancelable, - __in ULONG Key - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoStartPacket( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __in_opt PULONG Key, - __in_opt PDRIVER_CANCEL CancelFunction - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -VOID -IoSetStartIoAttributes( - __in PDEVICE_OBJECT DeviceObject, - __in BOOLEAN DeferredStartIo, - __in BOOLEAN NonCancelable - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoStartTimer( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoStopTimer( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -// end_wdm end_ntosp -// begin_ntifs - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoSynchronousPageWrite( - __in PFILE_OBJECT FileObject, - __in PMDL MemoryDescriptorList, - __in PLARGE_INTEGER StartingOffset, - __in PKEVENT Event, - __out PIO_STATUS_BLOCK IoStatusBlock - ); -#endif - -// begin_ntosp - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PEPROCESS -IoThreadToProcess( - __in PETHREAD Thread - ); -#endif -// end_ntosp - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -IoUnregisterFileSystem( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -IoUnregisterFsRegistrationChange( - __in PDRIVER_OBJECT DriverObject, - __in PDRIVER_FS_NOTIFICATION DriverNotificationRoutine - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoVerifyVolume( - __in PDEVICE_OBJECT DeviceObject, - __in BOOLEAN AllowRawMount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) // wdm -NTKERNELAPI // wdm -VOID // wdm -__drv_maxIRQL(DISPATCH_LEVEL) // wdm -IoWriteErrorLogEntry( // wdm - __in PVOID ElEntry // wdm - ); // wdm -#endif // wdm - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoGetRequestorSessionId( - __in PIRP Irp, - __out PULONG pSessionId - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoEnumerateDeviceObjectList( - __in PDRIVER_OBJECT DriverObject, - __out_bcount_part_opt(DeviceObjectListSize,(*ActualNumberDeviceObjects)*sizeof(PDEVICE_OBJECT)) PDEVICE_OBJECT *DeviceObjectList, - __in ULONG DeviceObjectListSize, - __out PULONG ActualNumberDeviceObjects - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -PDEVICE_OBJECT -IoGetLowerDeviceObject( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -PDEVICE_OBJECT -IoGetDeviceAttachmentBaseRef( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoGetDiskDeviceObject( - __in PDEVICE_OBJECT FileSystemDeviceObject, - __out PDEVICE_OBJECT *DiskDeviceObject - ); -#endif - - -// -// IoPrioirityHint support -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef struct _IO_PRIORITY_INFO { - ULONG Size; - ULONG ThreadPriority; - ULONG PagePriority; - IO_PRIORITY_HINT IoPriority; -} IO_PRIORITY_INFO, *PIO_PRIORITY_INFO; -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -VOID -FORCEINLINE -IoInitializePriorityInfo( - __in PIO_PRIORITY_INFO PriorityInfo - ) -{ - PriorityInfo->Size = sizeof(IO_PRIORITY_INFO); - PriorityInfo->ThreadPriority = 0xffff; - PriorityInfo->IoPriority = IoPriorityNormal; - PriorityInfo->PagePriority = 0; -} -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PVOID -PoRegisterSystemState ( - __inout_opt PVOID StateHandle, - __in EXECUTION_STATE Flags - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -PoCreatePowerRequest ( - __deref_out PVOID *PowerRequest, - __in PDEVICE_OBJECT DeviceObject, - __in PCOUNTED_REASON_CONTEXT Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -PoSetPowerRequest ( - __inout PVOID PowerRequest, - __in POWER_REQUEST_TYPE Type - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -PoClearPowerRequest ( - __inout PVOID PowerRequest, - __in POWER_REQUEST_TYPE Type - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -PoDeletePowerRequest ( - __inout PVOID PowerRequest - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -PoUnregisterSystemState ( - __inout PVOID StateHandle - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -POWER_STATE -PoSetPowerState ( - __in PDEVICE_OBJECT DeviceObject, - __in POWER_STATE_TYPE Type, - __in POWER_STATE State - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -PoCallDriver ( - __in PDEVICE_OBJECT DeviceObject, - __inout __drv_aliasesMem PIRP Irp - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -PoStartNextPowerIrp( - __inout PIRP Irp - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PULONG -PoRegisterDeviceForIdleDetection ( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG ConservationIdleTime, - __in ULONG PerformanceIdleTime, - __in DEVICE_POWER_STATE State - ); -#endif - -#define PoSetDeviceBusy(IdlePointer) \ - *IdlePointer = 0 - -#if (NTDDI_VERSION >= NTDDI_WIN6SP1) -NTKERNELAPI -VOID -PoSetDeviceBusyEx ( - __inout PULONG IdlePointer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -VOID -PoStartDeviceBusy ( - __inout PULONG IdlePointer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -VOID -PoEndDeviceBusy ( - __inout PULONG IdlePointer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -PoQueryWatchdogTime ( - __in PDEVICE_OBJECT Pdo, - __out PULONG SecondsRemaining - ); -#endif - -typedef -__drv_functionClass(POWER_SETTING_CALLBACK) -__drv_sameIRQL -NTSTATUS -POWER_SETTING_CALLBACK ( - __in LPCGUID SettingGuid, - __in_bcount(ValueLength) PVOID Value, - __in ULONG ValueLength, - __inout_opt PVOID Context -); - -typedef POWER_SETTING_CALLBACK *PPOWER_SETTING_CALLBACK; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -PoRegisterPowerSettingCallback ( - __in_opt PDEVICE_OBJECT DeviceObject, - __in LPCGUID SettingGuid, - __in PPOWER_SETTING_CALLBACK Callback, - __in_opt PVOID Context, - __deref_opt_out PVOID *Handle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -PoUnregisterPowerSettingCallback ( - __inout PVOID Handle - ); -#endif - -// -// \Callback\PowerState values -// - -#define PO_CB_SYSTEM_POWER_POLICY 0 -#define PO_CB_AC_STATUS 1 -#define PO_CB_BUTTON_COLLISION 2 // deprecated -#define PO_CB_SYSTEM_STATE_LOCK 3 -#define PO_CB_LID_SWITCH_STATE 4 -#define PO_CB_PROCESSOR_POWER_POLICY 5 // deprecated - - -// Used for queuing work items to be performed at shutdown time. Same -// rules apply as per Ex work queues. -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -PoQueueShutdownWorkItem( - __inout __drv_aliasesMem PWORK_QUEUE_ITEM WorkItem - ); -#endif - -#if defined(_IA64_) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use GetDmaRequirement -__drv_preferredFunction("GetDmaAlignment", "Obsolete") -NTHALAPI -ULONG -HalGetDmaAlignmentRequirement ( - VOID - ); -#endif - -#endif - -#if defined(_M_IX86) || defined(_M_AMD64) - -#define HalGetDmaAlignmentRequirement() 1L -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -MmIsRecursiveIoFault ( - VOID - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -BOOLEAN -MmForceSectionClosed ( - __in PSECTION_OBJECT_POINTERS SectionObjectPointer, - __in BOOLEAN DelayClose - ); -#endif - - -typedef enum _MMFLUSH_TYPE { - MmFlushForDelete, - MmFlushForWrite -} MMFLUSH_TYPE; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -BOOLEAN -MmFlushImageSection ( - __in PSECTION_OBJECT_POINTERS SectionObjectPointer, - __in MMFLUSH_TYPE FlushType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -BOOLEAN -MmCanFileBeTruncated ( - __in PSECTION_OBJECT_POINTERS SectionPointer, - __in_opt PLARGE_INTEGER NewFileSize - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -BOOLEAN -MmSetAddressRangeModified ( - __in_bcount (Length) PVOID Address, - __in SIZE_T Length - ); -#endif - - -// -// Prefetch public interface. -// - -typedef struct _READ_LIST { - PFILE_OBJECT FileObject; - ULONG NumberOfEntries; - LOGICAL IsImage; - FILE_SEGMENT_ELEMENT List[ANYSIZE_ARRAY]; -} READ_LIST, *PREAD_LIST; - -#if (NTDDI_VERSION >= NTDDI_WINXP) -typedef union _MM_PREFETCH_FLAGS { - struct { - ULONG Priority : SYSTEM_PAGE_PRIORITY_BITS; - ULONG RepurposePriority : SYSTEM_PAGE_PRIORITY_BITS; - } Flags; - ULONG AllFlags; - -} MM_PREFETCH_FLAGS, *PMM_PREFETCH_FLAGS; - -#define MM_PREFETCH_FLAGS_MASK ((1 << (2*SYSTEM_PAGE_PRIORITY_BITS)) - 1) - -__drv_maxIRQL (PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -MmPrefetchPages ( - __in ULONG NumberOfLists, - __in_ecount (NumberOfLists) PREAD_LIST *ReadLists - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -// -// This routine is used by local file systems to detect the case where the -// user has closed the file handles and the section handles, but still has -// open writable views to the file -// - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -ULONG -MmDoesFileHaveUserWritableReferences ( - __in PSECTION_OBJECT_POINTERS SectionPointer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -ObInsertObject( - __in PVOID Object, - __inout_opt PACCESS_STATE PassedAccessState, - __in_opt ACCESS_MASK DesiredAccess, - __in ULONG ObjectPointerBias, - __out_opt PVOID *NewObject, - __out_opt PHANDLE Handle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -ObOpenObjectByPointer( - __in PVOID Object, - __in ULONG HandleAttributes, - __in_opt PACCESS_STATE PassedAccessState, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_TYPE ObjectType, - __in KPROCESSOR_MODE AccessMode, - __out PHANDLE Handle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -NTSTATUS -ObOpenObjectByPointerWithTag( - __in PVOID Object, - __in ULONG HandleAttributes, - __in_opt PACCESS_STATE PassedAccessState, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_TYPE ObjectType, - __in KPROCESSOR_MODE AccessMode, - __in ULONG Tag, - __out PHANDLE Handle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -ObMakeTemporaryObject( - __in PVOID Object - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -ObQueryNameString( - __in PVOID Object, - __out_bcount_opt(Length) POBJECT_NAME_INFORMATION ObjectNameInfo, - __in ULONG Length, - __out PULONG ReturnLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -BOOLEAN -ObIsKernelHandle ( - __in HANDLE Handle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -ObQueryObjectAuditingByHandle( - __in HANDLE Handle, - __out PBOOLEAN GenerateOnClose - ); -#endif - - -// -// The following are globally used definitions for an LBN and a VBN -// - -typedef ULONG LBN; -typedef LBN *PLBN; - -typedef ULONG VBN; -typedef VBN *PVBN; - - -// -// Every file system that uses the cache manager must have FsContext -// of the file object point to a common fcb header structure. -// - -typedef enum _FAST_IO_POSSIBLE { - FastIoIsNotPossible = 0, - FastIoIsPossible, - FastIoIsQuestionable -} FAST_IO_POSSIBLE; - - -typedef struct _FSRTL_COMMON_FCB_HEADER { - - CSHORT NodeTypeCode; - CSHORT NodeByteSize; - - // - // General flags available to FsRtl. - // - - UCHAR Flags; - - // - // Indicates if fast I/O is possible or if we should be calling - // the check for fast I/O routine which is found via the driver - // object. - // - - UCHAR IsFastIoPossible; // really type FAST_IO_POSSIBLE - - // - // Second Flags Field - // - - UCHAR Flags2; - - // - // The following reserved field should always be 0 - // - - UCHAR Reserved : 4 ; - - // - // Indicates the version of this header - // - - UCHAR Version : 4 ; - - PERESOURCE Resource; - - PERESOURCE PagingIoResource; - - LARGE_INTEGER AllocationSize; - LARGE_INTEGER FileSize; - LARGE_INTEGER ValidDataLength; - -} FSRTL_COMMON_FCB_HEADER; -typedef FSRTL_COMMON_FCB_HEADER *PFSRTL_COMMON_FCB_HEADER; - - -// -// NodeTypeCode values used ranges -// -// CDFS - 0x0300 - 0x033F -// CLFS - 0x0400 - 0x043F -// WINFS - 0x0440 - 0x047F -// FASTFAT - 0x0500 - 0x053F -// RAW - 0x0600 - 0x063F -// NTFS - 0x0700 - 0x07FF -// UDFS - 0x0900 - 0x093F -// EXFAT - 0x0D00 - 0x0D3F -// - 0x8000 - 0xBFFF reserved for 3rd party file systems -// WIMFilter - 0x1000 - 0x103F -// NCFILTER - 0x2200 - 0x223F sample minifilter -// RDBSS - 0xEB00 - 0xECFF -// NULMRX - 0xFF00 - 0xFF3F sample redirector - - - -// -// This Fcb header is used for files which support caching -// of compressed data, and related new support. -// -// We start out by prefixing this structure with the normal -// FsRtl header from above, which we have to do two different -// ways for c++ or c. -// - -#ifdef __cplusplus -typedef struct _FSRTL_ADVANCED_FCB_HEADER:FSRTL_COMMON_FCB_HEADER { -#else // __cplusplus - -typedef struct _FSRTL_ADVANCED_FCB_HEADER { - - // - // Put in the standard FsRtl header fields - // - - FSRTL_COMMON_FCB_HEADER DUMMYSTRUCTNAME; - -#endif // __cplusplus - - // - // The following two fields are supported only if - // Flags2 contains FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS - // - - // - // This is a pointer to a Fast Mutex which may be used to - // properly synchronize access to the FsRtl header. The - // Fast Mutex must be nonpaged. - // - - PFAST_MUTEX FastMutex; - - // - // This is a pointer to a list of stream context structures belonging to - // filesystem filter drivers that are linked above the filesystem. - // Each structure is headed by FSRTL_FILTER_CONTEXT. - // - - LIST_ENTRY FilterContexts; - - -#if (NTDDI_VERSION >= NTDDI_VISTA) - // - // The following fields are valid only if the Version - // field in the FSRTL_COMMON_FCB_HEADER is greater than - // or equal to FSRTL_FCB_HEADER_V1 - // These fields are present in VISTA and beyond - // - - // - // This is a pushlock which is used to properly synchronize access - // to the list of stream contexts - // - - EX_PUSH_LOCK PushLock; - - // - // This is a pointer to a blob of information that is - // associated with the opened file in the filesystem - // corresponding to the structure containing this - // FSRTL_ADVANCED_FCB_HEADER. - // - - PVOID* FileContextSupportPointer; -#endif - -} FSRTL_ADVANCED_FCB_HEADER; -typedef FSRTL_ADVANCED_FCB_HEADER *PFSRTL_ADVANCED_FCB_HEADER; - -// -// Define FsRtl common header versions -// - -#define FSRTL_FCB_HEADER_V0 (0x00) -#define FSRTL_FCB_HEADER_V1 (0x01) - - -// -// Define FsRtl common header flags -// - -#define FSRTL_FLAG_FILE_MODIFIED (0x01) -#define FSRTL_FLAG_FILE_LENGTH_CHANGED (0x02) -#define FSRTL_FLAG_LIMIT_MODIFIED_PAGES (0x04) - -// -// Following flags determine how the modified page writer should -// acquire the file. These flags can't change while either resource -// is acquired. If neither of these flags is set then the -// modified/mapped page writer will attempt to acquire the paging io -// resource shared. -// - -#define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_EX (0x08) -#define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_SH (0x10) - -// -// This flag will be set by the Cache Manager if a view is mapped -// to a file. -// - -#define FSRTL_FLAG_USER_MAPPED_FILE (0x20) - -// This flag indicates that the file system is using the -// FSRTL_ADVANCED_FCB_HEADER structure instead of the FSRTL_COMMON_FCB_HEADER -// structure. -// - -#define FSRTL_FLAG_ADVANCED_HEADER (0x40) - -// This flag determines whether there currently is an Eof advance -// in progress. All such advances must be serialized. -// - -#define FSRTL_FLAG_EOF_ADVANCE_ACTIVE (0x80) - -// -// Flag values for Flags2 -// -// All unused bits are reserved and should NOT be modified. -// - -// -// If this flag is set, the Cache Manager will allow modified writing -// in spite of the value of FsContext2. -// - -#define FSRTL_FLAG2_DO_MODIFIED_WRITE (0x01) - -// -// If this flag is set, the additional fields FilterContexts and FastMutex -// are supported in FSRTL_COMMON_HEADER, and can be used to associate -// context for filesystem filters with streams. -// - -#define FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS (0x02) - -// -// If this flag is set, the cache manager will flush and purge the cache map when -// a user first maps a file -// - -#define FSRTL_FLAG2_PURGE_WHEN_MAPPED (0x04) - -// If set this represents a PAGING file -// - -#define FSRTL_FLAG2_IS_PAGING_FILE (0x08) - - -// begin_ntosp -// -// -// The following constants are used to block top level Irp processing when -// (in either the fast io or cc case) file system resources have been -// acquired above the file system, or we are in an Fsp thread. -// - -#define FSRTL_FSP_TOP_LEVEL_IRP ((LONG_PTR)0x01) -#define FSRTL_CACHE_TOP_LEVEL_IRP ((LONG_PTR)0x02) -#define FSRTL_MOD_WRITE_TOP_LEVEL_IRP ((LONG_PTR)0x03) -#define FSRTL_FAST_IO_TOP_LEVEL_IRP ((LONG_PTR)0x04) -#define FSRTL_NETWORK1_TOP_LEVEL_IRP ((LONG_PTR)0x05) -#define FSRTL_NETWORK2_TOP_LEVEL_IRP ((LONG_PTR)0x06) -#define FSRTL_MAX_TOP_LEVEL_IRP_FLAG ((LONG_PTR)0xFFFF) - -// end_ntosp - -// -// The following structure is used to synchronize Eof extends. -// - -typedef struct _EOF_WAIT_BLOCK { - - LIST_ENTRY EofWaitLinks; - KEVENT Event; - -} EOF_WAIT_BLOCK; - -typedef EOF_WAIT_BLOCK *PEOF_WAIT_BLOCK; - -// begin_ntosp -// -// Normal uncompressed Copy and Mdl Apis -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlCopyRead ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in BOOLEAN Wait, - __in ULONG LockKey, - __out_bcount(Length) PVOID Buffer, - __out PIO_STATUS_BLOCK IoStatus, - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlCopyWrite ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in BOOLEAN Wait, - __in ULONG LockKey, - __in_bcount(Length) PVOID Buffer, - __out PIO_STATUS_BLOCK IoStatus, - __in PDEVICE_OBJECT DeviceObject - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlMdlReadDev ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in ULONG LockKey, - __deref_out PMDL *MdlChain, - __out PIO_STATUS_BLOCK IoStatus, - __in_opt PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlMdlReadCompleteDev ( - __in PFILE_OBJECT FileObject, - __in PMDL MdlChain, - __in_opt PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlPrepareMdlWriteDev ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in ULONG LockKey, - __deref_out PMDL *MdlChain, - __out PIO_STATUS_BLOCK IoStatus, - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlMdlWriteCompleteDev ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in PMDL MdlChain, - __in_opt PDEVICE_OBJECT DeviceObject - ); -#endif - -// -// In Irps, compressed reads and writes are designated by the -// subfunction IRP_MN_COMPRESSED must be set and the Compressed -// Data Info buffer must be described by the following structure -// pointed to by Irp->Tail.Overlay.AuxiliaryBuffer. -// - -typedef struct _FSRTL_AUXILIARY_BUFFER { - - // - // Buffer description with length. - // - - PVOID Buffer; - ULONG Length; - - // - // Flags - // - - ULONG Flags; - - // - // Pointer to optional Mdl mapping buffer for file system use - // - - PMDL Mdl; - -} FSRTL_AUXILIARY_BUFFER; -typedef FSRTL_AUXILIARY_BUFFER *PFSRTL_AUXILIARY_BUFFER; - -// -// If this flag is set, the auxiliary buffer structure is -// deallocated on Irp completion. The caller has the -// option in this case of appending this structure to the -// structure being described, causing it all to be -// deallocated at once. If this flag is clear, no deallocate -// occurs. -// - -#define FSRTL_AUXILIARY_FLAG_DEALLOCATE 0x00000001 - -// -// The following two routines are called from NtCreateSection to avoid -// deadlocks with the file systems. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -FsRtlAcquireFileExclusive ( - __in PFILE_OBJECT FileObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlReleaseFile ( - __in PFILE_OBJECT FileObject - ); -#endif - -// -// These routines provide a simple interface for the common operations -// of query/set file size. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FsRtlGetFileSize( - __in PFILE_OBJECT FileObject, - __out PLARGE_INTEGER FileSize - ); -#endif - -// -// Determine if there is a complete device failure on an error. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTKERNELAPI -BOOLEAN -FsRtlIsTotalDeviceFailure( - __in NTSTATUS Status - ); -#endif - -// end_ntddk end_ntosp - -// -// Byte range file lock routines, implemented in FileLock.c -// -// The file lock info record is used to return enumerated information -// about a file lock -// - -typedef struct _FILE_LOCK_INFO { - - // - // A description of the current locked range, and if the lock - // is exclusive or shared - // - - LARGE_INTEGER StartingByte; - LARGE_INTEGER Length; - BOOLEAN ExclusiveLock; - - // - // The following fields describe the owner of the lock. - // - - ULONG Key; - PFILE_OBJECT FileObject; - PVOID ProcessId; - - // - // The following field is used internally by FsRtl - // - - LARGE_INTEGER EndingByte; - -} FILE_LOCK_INFO; -typedef FILE_LOCK_INFO *PFILE_LOCK_INFO; - -// -// The following two procedure prototypes are used by the caller of the -// file lock package to supply an alternate routine to call when -// completing an IRP and when unlocking a byte range. Note that the only -// utility to us this interface is currently the redirector, all other file -// system will probably let the IRP complete normally with IoCompleteRequest. -// The user supplied routine returns any value other than success then the -// lock package will remove any lock that we just inserted. -// - -typedef NTSTATUS (*PCOMPLETE_LOCK_IRP_ROUTINE) ( - __in PVOID Context, - __in PIRP Irp - ); - -typedef VOID (*PUNLOCK_ROUTINE) ( - __in PVOID Context, - __in PFILE_LOCK_INFO FileLockInfo - ); - -// -// A FILE_LOCK is an opaque structure but we need to declare the size of -// it here so that users can allocate space for one. -// - -typedef struct _FILE_LOCK { - - // - // The optional procedure to call to complete a request - // - - PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine; - - // - // The optional procedure to call when unlocking a byte range - // - - PUNLOCK_ROUTINE UnlockRoutine; - - // - // FastIoIsQuestionable is set to true whenever the filesystem require - // additional checking about whether the fast path can be taken. As an - // example Ntfs requires checking for disk space before the writes can - // occur. - // - - BOOLEAN FastIoIsQuestionable; - BOOLEAN SpareC[3]; - - // - // FsRtl lock information - // - - PVOID LockInformation; - - // - // Contains continuation information for FsRtlGetNextFileLock - // - - FILE_LOCK_INFO LastReturnedLockInfo; - PVOID LastReturnedLock; - - // - // Number of lock requests in progress. Used for synchronization purposes - // (so far, this only means byte range locks vs. oplocks). - // - - LONG volatile LockRequestsInProgress; - -} FILE_LOCK; -typedef FILE_LOCK *PFILE_LOCK; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PFILE_LOCK -FsRtlAllocateFileLock ( - __in_opt PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine, - __in_opt PUNLOCK_ROUTINE UnlockRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlFreeFileLock ( - __in PFILE_LOCK FileLock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlInitializeFileLock ( - __in PFILE_LOCK FileLock, - __in_opt PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine, - __in_opt PUNLOCK_ROUTINE UnlockRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlUninitializeFileLock ( - __in PFILE_LOCK FileLock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlProcessFileLock ( - __in PFILE_LOCK FileLock, - __in PIRP Irp, - __in_opt PVOID Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlCheckLockForReadAccess ( - __in PFILE_LOCK FileLock, - __in PIRP Irp - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlCheckLockForWriteAccess ( - __in PFILE_LOCK FileLock, - __in PIRP Irp - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlFastCheckLockForRead ( - __in PFILE_LOCK FileLock, - __in PLARGE_INTEGER StartingByte, - __in PLARGE_INTEGER Length, - __in ULONG Key, - __in PFILE_OBJECT FileObject, - __in PVOID ProcessId - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlFastCheckLockForWrite ( - __in PFILE_LOCK FileLock, - __in PLARGE_INTEGER StartingByte, - __in PLARGE_INTEGER Length, - __in ULONG Key, - __in PVOID FileObject, - __in PVOID ProcessId - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PFILE_LOCK_INFO -FsRtlGetNextFileLock ( - __in PFILE_LOCK FileLock, - __in BOOLEAN Restart - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlAreThereCurrentOrInProgressFileLocks ( - __in PFILE_LOCK FileLock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlFastUnlockSingle ( - __in PFILE_LOCK FileLock, - __in PFILE_OBJECT FileObject, - __in LARGE_INTEGER UNALIGNED *FileOffset, - __in PLARGE_INTEGER Length, - __in PEPROCESS ProcessId, - __in ULONG Key, - __in_opt PVOID Context, - __in BOOLEAN AlreadySynchronized - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlFastUnlockAll ( - __in PFILE_LOCK FileLock, - __in PFILE_OBJECT FileObject, - __in PEPROCESS ProcessId, - __in_opt PVOID Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlFastUnlockAllByKey ( - __in PFILE_LOCK FileLock, - __in PFILE_OBJECT FileObject, - __in PEPROCESS ProcessId, - __in ULONG Key, - __in_opt PVOID Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -__drv_preferredFunction(FsRtlFastLock, "Obsolete") -NTKERNELAPI -BOOLEAN -FsRtlPrivateLock ( - __in PFILE_LOCK FileLock, - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in PLARGE_INTEGER Length, - __in PEPROCESS ProcessId, - __in ULONG Key, - __in BOOLEAN FailImmediately, - __in BOOLEAN ExclusiveLock, - __out PIO_STATUS_BLOCK Iosb, - __in_opt PIRP Irp, - __in_opt __drv_aliasesMem PVOID Context, - __in BOOLEAN AlreadySynchronized - ); -#endif - -// -// BOOLEAN -// FsRtlFastLock ( -// __in PFILE_LOCK FileLock, -// __in PFILE_OBJECT FileObject, -// __in PLARGE_INTEGER FileOffset, -// __in PLARGE_INTEGER Length, -// __in PEPROCESS ProcessId, -// __in ULONG Key, -// __in BOOLEAN FailImmediately, -// __in BOOLEAN ExclusiveLock, -// __out PIO_STATUS_BLOCK Iosb, -// __in PVOID Context OPTIONAL, -// __in BOOLEAN AlreadySynchronized -// ); -// - -#define FsRtlFastLock(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) ( \ - FsRtlPrivateLock( A1, /* FileLock */ \ - A2, /* FileObject */ \ - A3, /* FileOffset */ \ - A4, /* Length */ \ - A5, /* ProcessId */ \ - A6, /* Key */ \ - A7, /* FailImmediately */ \ - A8, /* ExclusiveLock */ \ - A9, /* Iosb */ \ - NULL, /* Irp */ \ - A10, /* Context */ \ - A11 /* AlreadySynchronized */ ) \ -) - -// -// BOOLEAN -// FsRtlAreThereCurrentFileLocks ( -// __in PFILE_LOCK FileLock -// ); -// - -#define FsRtlAreThereCurrentFileLocks(FL) ( \ - ((FL)->FastIoIsQuestionable)) - -// -// These macros are used by file systems to increment or decrement the -// number of lock requests in progress, in order to prevent races with -// oplocks etc. -// - -#define FsRtlIncrementLockRequestsInProgress(FL) { \ - ASSERT( (FL)->LockRequestsInProgress >= 0 ); \ - (void) \ - (InterlockedIncrement((LONG volatile *)&((FL)->LockRequestsInProgress)));\ -} - -#define FsRtlDecrementLockRequestsInProgress(FL) { \ - ASSERT( (FL)->LockRequestsInProgress > 0 ); \ - (void) \ - (InterlockedDecrement((LONG volatile *)&((FL)->LockRequestsInProgress)));\ -} - - - -// -// Filesystem property tunneling, implemented in tunnel.c -// - -// -// Tunnel cache structure -// - -typedef struct { - - // - // Mutex for cache manipulation - // - - FAST_MUTEX Mutex; - - // - // Splay Tree of tunneled information keyed by - // DirKey ## Name - // - - PRTL_SPLAY_LINKS Cache; - - // - // Timer queue used to age entries out of the main cache - // - - LIST_ENTRY TimerQueue; - - // - // Keep track of the number of entries in the cache to prevent - // excessive use of memory - // - - USHORT NumEntries; - -} TUNNEL, *PTUNNEL; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlInitializeTunnelCache ( - __in TUNNEL *Cache - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlAddToTunnelCache ( - __in TUNNEL *Cache, - __in ULONGLONG DirectoryKey, - __in UNICODE_STRING *ShortName, - __in UNICODE_STRING *LongName, - __in BOOLEAN KeyByShortName, - __in ULONG DataLength, - __in_bcount(DataLength) VOID *Data - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlFindInTunnelCache ( - __in TUNNEL *Cache, - __in ULONGLONG DirectoryKey, - __in UNICODE_STRING *Name, - __out UNICODE_STRING *ShortName, - __out UNICODE_STRING *LongName, - __inout ULONG *DataLength, - __out_bcount_part(*DataLength, *DataLength) VOID *Data - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlDeleteKeyFromTunnelCache ( - __in TUNNEL *Cache, - __in ULONGLONG DirectoryKey - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlDeleteTunnelCache ( - __in TUNNEL *Cache - ); -#endif - - -// -// Dbcs name support routines, implemented in DbcsName.c -// - -// -// The following enumerated type is used to denote the result of name -// comparisons -// - -typedef enum _FSRTL_COMPARISON_RESULT { - LessThan = -1, - EqualTo = 0, - GreaterThan = 1 -} FSRTL_COMPARISON_RESULT; - -#ifdef NLS_MB_CODE_PAGE_TAG -#undef NLS_MB_CODE_PAGE_TAG -#endif // NLS_MB_CODE_PAGE_TAG - - -#define LEGAL_ANSI_CHARACTER_ARRAY (*FsRtlLegalAnsiCharacterArray) // ntosp -#define NLS_MB_CODE_PAGE_TAG (*NlsMbOemCodePageTag) -#define NLS_OEM_LEAD_BYTE_INFO (*NlsOemLeadByteInfo) // ntosp - - -extern UCHAR const* const LEGAL_ANSI_CHARACTER_ARRAY; -extern PUSHORT NLS_OEM_LEAD_BYTE_INFO; // Lead byte info. for ACP - -// -// These following bit values are set in the FsRtlLegalDbcsCharacterArray -// - -#define FSRTL_FAT_LEGAL 0x01 -#define FSRTL_HPFS_LEGAL 0x02 -#define FSRTL_NTFS_LEGAL 0x04 -#define FSRTL_WILD_CHARACTER 0x08 -#define FSRTL_OLE_LEGAL 0x10 -#define FSRTL_NTFS_STREAM_LEGAL (FSRTL_NTFS_LEGAL | FSRTL_OLE_LEGAL) - -// -// The following macro is used to determine if an Ansi character is wild. -// - -#define FsRtlIsAnsiCharacterWild(C) ( \ - FsRtlTestAnsiCharacter((C), FALSE, FALSE, FSRTL_WILD_CHARACTER) \ -) - -// -// The following macro is used to determine if an Ansi character is Fat legal. -// - -#define FsRtlIsAnsiCharacterLegalFat(C,WILD_OK) ( \ - FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_FAT_LEGAL) \ -) - -// -// The following macro is used to determine if an Ansi character is Hpfs legal. -// - -#define FsRtlIsAnsiCharacterLegalHpfs(C,WILD_OK) ( \ - FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_HPFS_LEGAL) \ -) - -// -// The following macro is used to determine if an Ansi character is Ntfs legal. -// - -#define FsRtlIsAnsiCharacterLegalNtfs(C,WILD_OK) ( \ - FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_NTFS_LEGAL) \ -) - -// -// The following macro is used to determine if an Ansi character is -// legal in an Ntfs stream name -// - -#define FsRtlIsAnsiCharacterLegalNtfsStream(C,WILD_OK) ( \ - FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_NTFS_STREAM_LEGAL) \ -) - -// -// The following macro is used to determine if an Ansi character is legal, -// according to the caller's specification. -// - -#define FsRtlIsAnsiCharacterLegal(C,FLAGS) ( \ - FsRtlTestAnsiCharacter((C), TRUE, FALSE, (FLAGS)) \ -) - -// -// The following macro is used to test attributes of an Ansi character, -// according to the caller's specified flags. -// - -#define FsRtlTestAnsiCharacter(C, DEFAULT_RET, WILD_OK, FLAGS) ( \ - ((SCHAR)(C) < 0) ? DEFAULT_RET : \ - FlagOn( LEGAL_ANSI_CHARACTER_ARRAY[(C)], \ - (FLAGS) | \ - ((WILD_OK) ? FSRTL_WILD_CHARACTER : 0) ) \ -) - - -// -// The following two macros use global data defined in ntos\rtl\nlsdata.c -// -// BOOLEAN -// FsRtlIsLeadDbcsCharacter ( -// __in UCHAR DbcsCharacter -// ); -// -// /*++ -// -// Routine Description: -// -// This routine takes the first bytes of a Dbcs character and -// returns whether it is a lead byte in the system code page. -// -// Arguments: -// -// DbcsCharacter - Supplies the input character being examined -// -// Return Value: -// -// BOOLEAN - TRUE if the input character is a dbcs lead and -// FALSE otherwise -// -// --*/ -// -// - -#define FsRtlIsLeadDbcsCharacter(DBCS_CHAR) ( \ - (BOOLEAN)((UCHAR)(DBCS_CHAR) < 0x80 ? FALSE : \ - (NLS_MB_CODE_PAGE_TAG && \ - (NLS_OEM_LEAD_BYTE_INFO[(UCHAR)(DBCS_CHAR)] != 0))) \ -) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlDissectDbcs ( - __in ANSI_STRING Path, - __out PANSI_STRING FirstName, - __out PANSI_STRING RemainingName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlDoesDbcsContainWildCards ( - __in PANSI_STRING Name - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlIsDbcsInExpression ( - __in PANSI_STRING Expression, - __in PANSI_STRING Name - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlIsFatDbcsLegal ( - __in ANSI_STRING DbcsName, - __in BOOLEAN WildCardsPermissible, - __in BOOLEAN PathNamePermissible, - __in BOOLEAN LeadingBackslashPermissible - ); -#endif - -// end_ntosp - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlIsHpfsDbcsLegal ( - __in ANSI_STRING DbcsName, - __in BOOLEAN WildCardsPermissible, - __in BOOLEAN PathNamePermissible, - __in BOOLEAN LeadingBackslashPermissible - ); -#endif - - -// -// Exception filter routines, implemented in Filter.c -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -FsRtlNormalizeNtstatus ( - __in NTSTATUS Exception, - __in NTSTATUS GenericException - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTKERNELAPI -BOOLEAN -FsRtlIsNtstatusExpected ( - __in NTSTATUS Exception - ); -#endif - -// -// The following procedures are used to allocate executive pool and raise -// insufficient resource status if pool isn't currently available. -// - -#define FsRtlAllocatePoolWithTag(PoolType, NumberOfBytes, Tag) \ - ExAllocatePoolWithTag((POOL_TYPE)((PoolType) | POOL_RAISE_IF_ALLOCATION_FAILURE), \ - NumberOfBytes, \ - Tag) - - -#define FsRtlAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, Tag) \ - ExAllocatePoolWithQuotaTag((POOL_TYPE)((PoolType) | POOL_RAISE_IF_ALLOCATION_FAILURE), \ - NumberOfBytes, \ - Tag) - -// -// The following function allocates a resource from the FsRtl pool. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -__drv_preferredFunction(ExAllocateFromNPagedLookasideList, "The FsRtlAllocateResource routine is obsolete, but is exported to support existing driver binaries. Use ExAllocateFromNPagedLookasideList and ExInitializeResourceLite instead.") -NTKERNELAPI -PERESOURCE -FsRtlAllocateResource ( - VOID - ); -#endif - - -// -// Large Integer Mapped Control Blocks routines, implemented in LargeMcb.c -// -// Originally this structure was truly opaque and code outside largemcb was -// never allowed to examine or alter the structures. However, for performance -// reasons we want to allow ntfs the ability to quickly truncate down the -// mcb without the overhead of an actual call to largemcb.c. So to do that we -// need to export the structure. This structure is not exact. The Mapping field -// is declared here as a pvoid but largemcb.c it is a pointer to mapping pairs. -// - -typedef struct _BASE_MCB { - ULONG MaximumPairCount; - ULONG PairCount; - USHORT PoolType; - USHORT Flags; - PVOID Mapping; -} BASE_MCB; -typedef BASE_MCB *PBASE_MCB; - -typedef struct _LARGE_MCB { - PKGUARDED_MUTEX GuardedMutex; - BASE_MCB BaseMcb; -} LARGE_MCB; -typedef LARGE_MCB *PLARGE_MCB; - -#define MCB_FLAG_RAISE_ON_ALLOCATION_FAILURE 1 - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlInitializeLargeMcb ( - __in PLARGE_MCB Mcb, - __in POOL_TYPE PoolType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlUninitializeLargeMcb ( - __in PLARGE_MCB Mcb - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlResetLargeMcb ( - __in PLARGE_MCB Mcb, - __in BOOLEAN SelfSynchronized - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlTruncateLargeMcb ( - __in PLARGE_MCB Mcb, - __in LONGLONG Vbn - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlAddLargeMcbEntry ( - __in PLARGE_MCB Mcb, - __in LONGLONG Vbn, - __in LONGLONG Lbn, - __in LONGLONG SectorCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlRemoveLargeMcbEntry ( - __in PLARGE_MCB Mcb, - __in LONGLONG Vbn, - __in LONGLONG SectorCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlLookupLargeMcbEntry ( - __in PLARGE_MCB Mcb, - __in LONGLONG Vbn, - __out_opt PLONGLONG Lbn, - __out_opt PLONGLONG SectorCountFromLbn, - __out_opt PLONGLONG StartingLbn, - __out_opt PLONGLONG SectorCountFromStartingLbn, - __out_opt PULONG Index - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlLookupLastLargeMcbEntry ( - __in PLARGE_MCB Mcb, - __out PLONGLONG Vbn, - __out PLONGLONG Lbn - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlLookupLastLargeMcbEntryAndIndex ( - __in PLARGE_MCB OpaqueMcb, - __out PLONGLONG LargeVbn, - __out PLONGLONG LargeLbn, - __out PULONG Index - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -ULONG -FsRtlNumberOfRunsInLargeMcb ( - __in PLARGE_MCB Mcb - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlGetNextLargeMcbEntry ( - __in PLARGE_MCB Mcb, - __in ULONG RunIndex, - __out PLONGLONG Vbn, - __out PLONGLONG Lbn, - __out PLONGLONG SectorCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlSplitLargeMcb ( - __in PLARGE_MCB Mcb, - __in LONGLONG Vbn, - __in LONGLONG Amount - ); -#endif - -// -// Unsynchronzied base mcb functions. There is one of these for every -// large mcb equivalent function - they are identical other than lack of -// synchronization -// - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlInitializeBaseMcb ( - __in PBASE_MCB Mcb, - __in POOL_TYPE PoolType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_when(!Flags & MCB_FLAG_RAISE_ON_ALLOCATION_FAILURE, __checkReturn) -__drv_maxIRQL(APC_LEVEL) -BOOLEAN -FsRtlInitializeBaseMcbEx ( - __in PBASE_MCB Mcb, - __in POOL_TYPE PoolType, - __in USHORT Flags - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlUninitializeBaseMcb ( - __in PBASE_MCB Mcb - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlResetBaseMcb ( - __in PBASE_MCB Mcb - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlTruncateBaseMcb ( - __in PBASE_MCB Mcb, - __in LONGLONG Vbn - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlAddBaseMcbEntry ( - __in PBASE_MCB Mcb, - __in LONGLONG Vbn, - __in LONGLONG Lbn, - __in LONGLONG SectorCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -FsRtlAddBaseMcbEntryEx ( - __in PBASE_MCB Mcb, - __in LONGLONG Vbn, - __in LONGLONG Lbn, - __in LONGLONG SectorCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlRemoveBaseMcbEntry ( - __in PBASE_MCB Mcb, - __in LONGLONG Vbn, - __in LONGLONG SectorCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlLookupBaseMcbEntry ( - __in PBASE_MCB Mcb, - __in LONGLONG Vbn, - __out_opt PLONGLONG Lbn, - __out_opt PLONGLONG SectorCountFromLbn, - __out_opt PLONGLONG StartingLbn, - __out_opt PLONGLONG SectorCountFromStartingLbn, - __out_opt PULONG Index - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlLookupLastBaseMcbEntry ( - __in PBASE_MCB Mcb, - __out PLONGLONG Vbn, - __out PLONGLONG Lbn - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlLookupLastBaseMcbEntryAndIndex ( - __in PBASE_MCB OpaqueMcb, - __inout PLONGLONG LargeVbn, - __inout PLONGLONG LargeLbn, - __inout PULONG Index - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -ULONG -FsRtlNumberOfRunsInBaseMcb ( - __in PBASE_MCB Mcb - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlGetNextBaseMcbEntry ( - __in PBASE_MCB Mcb, - __in ULONG RunIndex, - __out PLONGLONG Vbn, - __out PLONGLONG Lbn, - __out PLONGLONG SectorCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlSplitBaseMcb ( - __in PBASE_MCB Mcb, - __in LONGLONG Vbn, - __in LONGLONG Amount - ); -#endif - - -// -// Mapped Control Blocks routines, implemented in Mcb.c -// -// An MCB is an opaque structure but we need to declare the size of -// it here so that users can allocate space for one. Consequently the -// size computation here must be updated by hand if the MCB changes. -// - -typedef struct _MCB { - LARGE_MCB DummyFieldThatSizesThisStructureCorrectly; -} MCB; -typedef MCB *PMCB; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -__drv_preferredFunction(FsRtlInitializeLargeMcb, "Obsolete") -NTKERNELAPI -VOID -FsRtlInitializeMcb ( - __in PMCB Mcb, - __in POOL_TYPE PoolType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlUninitializeMcb ( - __in PMCB Mcb - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlTruncateMcb ( - __in PMCB Mcb, - __in VBN Vbn - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlAddMcbEntry ( - __in PMCB Mcb, - __in VBN Vbn, - __in LBN Lbn, - __in ULONG SectorCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlRemoveMcbEntry ( - __in PMCB Mcb, - __in VBN Vbn, - __in ULONG SectorCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlLookupMcbEntry ( - __in PMCB Mcb, - __in VBN Vbn, - __out PLBN Lbn, - __out_opt PULONG SectorCount, - __out PULONG Index - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlLookupLastMcbEntry ( - __in PMCB Mcb, - __out PVBN Vbn, - __out PLBN Lbn - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -ULONG -FsRtlNumberOfRunsInMcb ( - __in PMCB Mcb - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlGetNextMcbEntry ( - __in PMCB Mcb, - __in ULONG RunIndex, - __out PVBN Vbn, - __out PLBN Lbn, - __out PULONG SectorCount - ); -#endif - - -// -// Fault Tolerance routines, implemented in FaultTol.c -// -// The routines in this package implement routines that help file -// systems interact with the FT device drivers. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlBalanceReads ( - __in PDEVICE_OBJECT TargetDevice - ); -#endif - - -// -// Oplock routines, implemented in Oplock.c -// -// An OPLOCK is an opaque structure, we declare it as a PVOID and -// allocate the actual memory only when needed. -// - -typedef PVOID OPLOCK, *POPLOCK; - -typedef -VOID -(*POPLOCK_WAIT_COMPLETE_ROUTINE) ( - __in PVOID Context, - __in PIRP Irp - ); - -typedef -VOID -(*POPLOCK_FS_PREPOST_IRP) ( - __in PVOID Context, - __in PIRP Irp - ); - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlInitializeOplock ( - __inout POPLOCK Oplock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlUninitializeOplock ( - __inout POPLOCK Oplock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlOplockFsctrl ( - __in POPLOCK Oplock, - __in PIRP Irp, - __in ULONG OpenCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_when(CompletionRoutine != NULL, __checkReturn) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlCheckOplock ( - __in POPLOCK Oplock, - __in PIRP Irp, - __in_opt PVOID Context, - __in_opt POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine, - __in_opt POPLOCK_FS_PREPOST_IRP PostIrpRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTASP1) -// -// Flags for FsRtlCheckOplockEx. -// - -#define OPLOCK_FLAG_COMPLETE_IF_OPLOCKED 0x00000001 -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -#define OPLOCK_FLAG_OPLOCK_KEY_CHECK_ONLY 0x00000002 -#define OPLOCK_FLAG_BACK_OUT_ATOMIC_OPLOCK 0x00000004 -#define OPLOCK_FLAG_IGNORE_OPLOCK_KEYS 0x00000008 - -// -// Flags for FsRtlOplockFsctrlEx -// - -#define OPLOCK_FSCTRL_FLAG_ALL_KEYS_MATCH 0x00000001 -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTASP1) -__drv_when(Flags | OPLOCK_FLAG_BACK_OUT_ATOMIC_OPLOCK, __checkReturn) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlCheckOplockEx ( - __in POPLOCK Oplock, - __in PIRP Irp, - __in ULONG Flags, - __in_opt PVOID Context, - __in_opt POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine, - __in_opt POPLOCK_FS_PREPOST_IRP PostIrpRoutine - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlOplockIsFastIoPossible ( - __in POPLOCK Oplock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlCurrentBatchOplock ( - __in POPLOCK Oplock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlCurrentOplock ( - __in POPLOCK Oplock - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlOplockBreakToNone ( - __inout POPLOCK Oplock, - __in_opt PIO_STACK_LOCATION IrpSp, - __in PIRP Irp, - __in_opt PVOID Context, - __in_opt POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine, - __in_opt POPLOCK_FS_PREPOST_IRP PostIrpRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -// -// ECP context for an oplock key. -// - -typedef struct _OPLOCK_KEY_ECP_CONTEXT { - - // - // The caller places a GUID of their own devising here to serve as - // the oplock key. - // - - GUID OplockKey; - - // - // This must be set to zero. - // - - ULONG Reserved; - -} OPLOCK_KEY_ECP_CONTEXT, *POPLOCK_KEY_ECP_CONTEXT; - -// -// The GUID used for the OPLOCK_KEY_ECP_CONTEXT structure. -// -// {48850596-3050-4be7-9863-fec350ce8d7f} -// - -DEFINE_GUID( GUID_ECP_OPLOCK_KEY, 0x48850596, 0x3050, 0x4be7, 0x98, 0x63, 0xfe, 0xc3, 0x50, 0xce, 0x8d, 0x7f ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlOplockIsSharedRequest( - __in PIRP Irp - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlOplockBreakH ( - __in POPLOCK Oplock, - __in PIRP Irp, - __in ULONG Flags, - __in_opt PVOID Context, - __in_opt POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine, - __in_opt POPLOCK_FS_PREPOST_IRP PostIrpRoutine - ); - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlCurrentOplockH ( - __in POPLOCK Oplock - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlOplockBreakToNoneEx ( - __inout POPLOCK Oplock, - __in PIRP Irp, - __in ULONG Flags, - __in_opt PVOID Context, - __in_opt POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine, - __in_opt POPLOCK_FS_PREPOST_IRP PostIrpRoutine - ); - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlOplockFsctrlEx ( - __in POPLOCK Oplock, - __in PIRP Irp, - __in ULONG OpenCount, - __in ULONG Flags - ); - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlOplockKeysEqual ( - __in_opt PFILE_OBJECT Fo1, - __in_opt PFILE_OBJECT Fo2 - ); -#endif - - - -// -// Volume lock/unlock notification routines, implemented in PnP.c -// -// These routines provide PnP volume lock notification support -// for all filesystems. -// - -#define FSRTL_VOLUME_DISMOUNT 1 -#define FSRTL_VOLUME_DISMOUNT_FAILED 2 -#define FSRTL_VOLUME_LOCK 3 -#define FSRTL_VOLUME_LOCK_FAILED 4 -#define FSRTL_VOLUME_UNLOCK 5 -#define FSRTL_VOLUME_MOUNT 6 -#define FSRTL_VOLUME_NEEDS_CHKDSK 7 -#define FSRTL_VOLUME_WORM_NEAR_FULL 8 -#define FSRTL_VOLUME_WEARING_OUT 9 -#define FSRTL_VOLUME_FORCED_CLOSED 10 -#define FSRTL_VOLUME_INFO_MAKE_COMPAT 11 -#define FSRTL_VOLUME_PREPARING_EJECT 12 -#define FSRTL_VOLUME_CHANGE_SIZE 13 -#define FSRTL_VOLUME_BACKGROUND_FORMAT 14 - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlNotifyVolumeEvent ( - __in PFILE_OBJECT FileObject, - __in ULONG EventCode - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlNotifyVolumeEventEx ( - __in PFILE_OBJECT FileObject, - __in ULONG EventCode, - __in PTARGET_DEVICE_CUSTOM_NOTIFICATION Event - ); -#endif - - -// -// Notify Change routines, implemented in Notify.c -// -// These routines provide Notify Change support for all filesystems. -// Any of the 'Full' notify routines will support returning the -// change information into the user's buffer. -// - -typedef PVOID PNOTIFY_SYNC; - -typedef -BOOLEAN (*PCHECK_FOR_TRAVERSE_ACCESS) ( - __in PVOID NotifyContext, - __in_opt PVOID TargetContext, - __in PSECURITY_SUBJECT_CONTEXT SubjectContext - ); - -typedef -BOOLEAN (*PFILTER_REPORT_CHANGE) ( - __in PVOID NotifyContext, - __in PVOID FilterContext - ); - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlNotifyInitializeSync ( - __in PNOTIFY_SYNC *NotifySync - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlNotifyUninitializeSync ( - __in PNOTIFY_SYNC *NotifySync - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -FsRtlNotifyFullChangeDirectory ( - __in PNOTIFY_SYNC NotifySync, - __in PLIST_ENTRY NotifyList, - __in PVOID FsContext, - __in PSTRING FullDirectoryName, - __in BOOLEAN WatchTree, - __in BOOLEAN IgnoreBuffer, - __in ULONG CompletionFilter, - __in_opt PIRP NotifyIrp, - __in_opt PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback, - __in_opt PSECURITY_SUBJECT_CONTEXT SubjectContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -FsRtlNotifyFilterChangeDirectory ( - __in PNOTIFY_SYNC NotifySync, - __in PLIST_ENTRY NotifyList, - __in PVOID FsContext, - __in PSTRING FullDirectoryName, - __in BOOLEAN WatchTree, - __in BOOLEAN IgnoreBuffer, - __in ULONG CompletionFilter, - __in_opt PIRP NotifyIrp, - __in_opt PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback, - __in_opt PSECURITY_SUBJECT_CONTEXT SubjectContext, - __in_opt PFILTER_REPORT_CHANGE FilterCallback - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -FsRtlNotifyFilterReportChange ( - __in PNOTIFY_SYNC NotifySync, - __in PLIST_ENTRY NotifyList, - __in PSTRING FullTargetName, - __in USHORT TargetNameOffset, - __in_opt PSTRING StreamName, - __in_opt PSTRING NormalizedParentName, - __in ULONG FilterMatch, - __in ULONG Action, - __in_opt PVOID TargetContext, - __in_opt PVOID FilterContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -FsRtlNotifyFullReportChange ( - __in PNOTIFY_SYNC NotifySync, - __in PLIST_ENTRY NotifyList, - __in PSTRING FullTargetName, - __in USHORT TargetNameOffset, - __in_opt PSTRING StreamName, - __in_opt PSTRING NormalizedParentName, - __in ULONG FilterMatch, - __in ULONG Action, - __in_opt PVOID TargetContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlNotifyCleanup ( - __in PNOTIFY_SYNC NotifySync, - __in PLIST_ENTRY NotifyList, - __in PVOID FsContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlNotifyCleanupAll ( - __in PNOTIFY_SYNC NotifySync, - __in PLIST_ENTRY NotifyList - ); -#endif - - -// -// Unicode Name support routines, implemented in Name.c -// -// The routines here are used to manipulate unicode names -// - -// -// The following macro is used to determine if a character is wild. -// - -#define FsRtlIsUnicodeCharacterWild(C) ( \ - (((C) >= 0x40) ? FALSE : FlagOn( LEGAL_ANSI_CHARACTER_ARRAY[(C)], \ - FSRTL_WILD_CHARACTER ) ) \ -) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -FsRtlDissectName ( - __in UNICODE_STRING Path, - __out PUNICODE_STRING FirstName, - __out PUNICODE_STRING RemainingName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlDoesNameContainWildCards ( - __in PUNICODE_STRING Name - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlAreNamesEqual ( - __in PCUNICODE_STRING ConstantNameA, - __in PCUNICODE_STRING ConstantNameB, - __in BOOLEAN IgnoreCase, - __in_ecount_opt(0x10000) PCWCH UpcaseTable - ); -#endif - -// begin_ntosp - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlIsNameInExpression ( - __in PUNICODE_STRING Expression, - __in PUNICODE_STRING Name, - __in BOOLEAN IgnoreCase, - __in_opt PWCH UpcaseTable - ); -#endif - -// end_ntosp - - -// -// Stack Overflow support routine, implemented in StackOvf.c -// - -typedef -VOID -(*PFSRTL_STACK_OVERFLOW_ROUTINE) ( - __in PVOID Context, - __in PKEVENT Event - ); - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -FsRtlPostStackOverflow ( - __in PVOID Context, - __in PKEVENT Event, - __in PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -FsRtlPostPagingFileStackOverflow ( - __in PVOID Context, - __in PKEVENT Event, - __in PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine - ); -#endif - - -// -// UNC Provider support -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// -// Flags passed in to FsRtlRegisterUncProviderEx -// - -#define FSRTL_UNC_PROVIDER_FLAGS_MAILSLOTS_SUPPORTED 0x00000001 -#define FSRTL_UNC_PROVIDER_FLAGS_CSC_ENABLED 0x00000002 -#define FSRTL_UNC_PROVIDER_FLAGS_DOMAIN_SVC_AWARE 0x00000004 - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -FsRtlRegisterUncProviderEx( - __out PHANDLE MupHandle, - __in PUNICODE_STRING RedirDevName, - __in PDEVICE_OBJECT DeviceObject, - __in ULONG Flags - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlRegisterUncProvider( - __out PHANDLE MupHandle, - __in PUNICODE_STRING RedirectorDeviceName, - __in BOOLEAN MailslotsSupported - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -FsRtlDeregisterUncProvider( - __in HANDLE Handle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -__checkReturn -__drv_when(Irp!=NULL, __drv_maxIRQL(PASSIVE_LEVEL)) -__drv_when(Irp==NULL, __drv_maxIRQL(APC_LEVEL)) -NTKERNELAPI -NTSTATUS -FsRtlCancellableWaitForSingleObject( - __in PVOID Object, - __in_opt PLARGE_INTEGER Timeout, - __in_opt PIRP Irp - ); - -__checkReturn -__drv_when(Irp != NULL, __drv_maxIRQL(PASSIVE_LEVEL)) -__drv_when(Irp == NULL, __drv_maxIRQL(APC_LEVEL)) -NTKERNELAPI -NTSTATUS -FsRtlCancellableWaitForMultipleObjects( - __in ULONG Count, - __in_ecount(Count) PVOID ObjectArray[], - __in WAIT_TYPE WaitType, - __in_opt PLARGE_INTEGER Timeout, - __in_opt PKWAIT_BLOCK WaitBlockArray, - __in_opt PIRP Irp - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// -// For use by filter drivers to get information on provider corresponding to a given -// fileobject on the remote filesystem stack. Without this, filters will always end up -// getting \Device\Mup for providers registering with FsRtlRegisterUncProviderEx(). -// - - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlMupGetProviderInfoFromFileObject( - __in PFILE_OBJECT pFileObject, - __in ULONG Level, - __out_bcount(*pBufferSize) PVOID pBuffer, - __inout PULONG pBufferSize - ); - -// -// Format of output in pBuffer. -// - -// -// Level 1. -// - - -typedef struct _FSRTL_MUP_PROVIDER_INFO_LEVEL_1 { - ULONG32 ProviderId; // ID for quick comparison, stable across provider load/unload. - -} FSRTL_MUP_PROVIDER_INFO_LEVEL_1, *PFSRTL_MUP_PROVIDER_INFO_LEVEL_1; - -typedef struct _FSRTL_MUP_PROVIDER_INFO_LEVEL_2 { - ULONG32 ProviderId; // ID for quick comparison, stable across provider load/unload. - UNICODE_STRING ProviderName; // Device name of provider. - -} FSRTL_MUP_PROVIDER_INFO_LEVEL_2, *PFSRTL_MUP_PROVIDER_INFO_LEVEL_2; - - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlMupGetProviderIdFromName( - __in PUNICODE_STRING pProviderName, - __out PULONG32 pProviderId - ); - - -#endif - - - -// -// File System Filter PerFile Context Support -// - -// -// Filesystem filter drivers use these APIs to associate context -// with open files (for filesystems that support this). -// - -// -// OwnerId should uniquely identify a particular filter driver -// (e.g. the address of the driver's device object). -// InstanceId can be used to distinguish distinct contexts associated -// by a filter driver with a single file -// - -// -// This structure needs to be embedded within the users context that -// they want to associate with a given file -// - -typedef struct _FSRTL_PER_FILE_CONTEXT { - // - // This is linked into the FileContext list maintained by the - // kernel - // - - LIST_ENTRY Links; - - // - // A Unique ID for this filter (ex: address of Driver Object, Device - // Object, or Device Extension) - // - - PVOID OwnerId; - - // - // An optional ID to differentiate different contexts for the same - // filter. - // - - PVOID InstanceId; - - // - // A callback routine which is called by the underlying file system - // when the per-file structure is being torn down. When this routine is called - // the given context has already been removed from the context linked - // list. The callback routine cannot recursively call down into the - // filesystem or acquire any of their resources which they might hold - // when calling the filesystem outside of the callback. This must - // be defined. - // - - PFREE_FUNCTION FreeCallback; - -} FSRTL_PER_FILE_CONTEXT, *PFSRTL_PER_FILE_CONTEXT; - - -// -// This will initialize the given FSRTL_PER_FILE_CONTEXT structure. This -// should be used before calling "FsRtlInsertPerFileContext". -// - -#define FsRtlInitPerFileContext( _fc, _owner, _inst, _cb) \ - ((_fc)->OwnerId = (_owner), \ - (_fc)->InstanceId = (_inst), \ - (_fc)->FreeCallback = (_cb)) - -// -// Given a FileObject this will return the FileContext pointer that -// needs to be passed into the other FsRtl PerFile Context routines. -// If the file system does not support filter file contexts then -// NULL is returned -// - -#define FsRtlGetPerFileContextPointer(_fo) \ - (FsRtlSupportsPerFileContexts(_fo) ? \ - FsRtlGetPerStreamContextPointer(_fo)->FileContextSupportPointer : \ - NULL) - -// -// This will test to see if PerFile contexts are supported for the given -// FileObject -// - -#define FsRtlSupportsPerFileContexts(_fo) \ - ((FsRtlGetPerStreamContextPointer(_fo) != NULL) && \ - (FsRtlGetPerStreamContextPointer(_fo)->Version >= FSRTL_FCB_HEADER_V1) && \ - (FsRtlGetPerStreamContextPointer(_fo)->FileContextSupportPointer != NULL)) - - -// -// Associate the context at Ptr with the given file. The Ptr structure -// should be filled in by the caller before calling this routine (see -// FsRtlInitPerFileContext). If the underlying filesystem does not support -// filter file contexts, STATUS_INVALID_DEVICE_REQUEST will be returned. -// - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlInsertPerFileContext ( - __in PVOID* PerFileContextPointer, - __in PFSRTL_PER_FILE_CONTEXT Ptr - ); - -// -// Lookup a filter context associated with the file specified. The first -// context matching OwnerId (and InstanceId, if present) is returned. By not -// specifying InstanceId, a filter driver can search for any context that it -// has previously associated with a stream. If no matching context is found, -// NULL is returned. If the file system does not support filter contexts, -// NULL is returned. -// - - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PFSRTL_PER_FILE_CONTEXT -FsRtlLookupPerFileContext ( - __in PVOID* PerFileContextPointer, - __in_opt PVOID OwnerId, - __in_opt PVOID InstanceId - ); - - -// -// Normally, contexts should be deleted when the file system notifies the -// filter that the file is being closed. There are cases when a filter -// may want to remove all existing contexts for a specific volume. This -// routine should be called at those times. This routine should NOT be -// called for the following cases: -// - Inside your FreeCallback handler - The underlying file system has -// already removed it from the linked list). -// - Inside your IRP_CLOSE handler - If you do this then you will not -// be notified when the stream is torn down. -// -// This functions identically to FsRtlLookupPerFileContext, except that the -// returned context has been removed from the list. -// - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PFSRTL_PER_FILE_CONTEXT -FsRtlRemovePerFileContext ( - __in PVOID* PerFileContextPointer, - __in_opt PVOID OwnerId, - __in_opt PVOID InstanceId - ); - - -// -// APIs for file systems to use for initializing and cleaning up -// the Advaned FCB Header fields for PerStreamContext and -// PerFileContext support -// - -// -// This will properly initialize the advanced header so that it can be -// used with PerStream contexts and PerFile contexts. -// Note: A fast mutex must be placed in an advanced header. It is the -// caller's responsibility to properly create and initialize this -// mutex before calling this macro. The mutex field is only set -// if a non-NULL value is passed in. -// If the file system supports filter file contexts then it must -// initialize the FileContextSupportPointer field to point to a PVOID -// embedded in its per-file structure (FCB). If a NULL is passed in, -// then the macro assumes that the file system does not support filter -// file contexts -// - -#define FsRtlSetupAdvancedHeaderEx( _advhdr, _fmutx, _fctxptr ) \ -{ \ - FsRtlSetupAdvancedHeader( _advhdr, _fmutx ); \ - if ((_fctxptr) != NULL) { \ - (_advhdr)->FileContextSupportPointer = (_fctxptr); \ - } \ -} - -// -// File systems call this API to free any filter contexts still associated -// with a per-file structure (FCB) that they are tearing down. -// The FreeCallback routine for each filter context will be called. -// - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlTeardownPerFileContexts ( - __in PVOID* PerFileContextPointer - ); - - -// -// File System Filter PerStream Context Support -// - -// -// Filesystem filter drivers use these APIs to associate context -// with open streams (for filesystems that support this). -// - -// -// OwnerId should uniquely identify a particular filter driver -// (e.g. the address of the driver's device object). -// InstanceId can be used to distinguish distinct contexts associated -// by a filter driver with a single stream (e.g. the address of the -// PerStream Context structure). -// - -// -// This structure needs to be embedded within the users context that -// they want to associate with a given stream -// - -typedef struct _FSRTL_PER_STREAM_CONTEXT { - // - // This is linked into the StreamContext list inside the - // FSRTL_ADVANCED_FCB_HEADER structure. - // - - LIST_ENTRY Links; - - // - // A Unique ID for this filter (ex: address of Driver Object, Device - // Object, or Device Extension) - // - - PVOID OwnerId; - - // - // An optional ID to differentiate different contexts for the same - // filter. - // - - PVOID InstanceId; - - // - // A callback routine which is called by the underlying file system - // when the stream is being torn down. When this routine is called - // the given context has already been removed from the context linked - // list. The callback routine cannot recursively call down into the - // filesystem or acquire any of their resources which they might hold - // when calling the filesystem outside of the callback. This must - // be defined. - // - - PFREE_FUNCTION FreeCallback; - -} FSRTL_PER_STREAM_CONTEXT, *PFSRTL_PER_STREAM_CONTEXT; - - -// -// This will initialize the given FSRTL_PER_STREAM_CONTEXT structure. This -// should be used before calling "FsRtlInsertPerStreamContext". -// - -#define FsRtlInitPerStreamContext( _fc, _owner, _inst, _cb) \ - ((_fc)->OwnerId = (_owner), \ - (_fc)->InstanceId = (_inst), \ - (_fc)->FreeCallback = (_cb)) - -// -// Given a FileObject this will return the StreamContext pointer that -// needs to be passed into the other FsRtl PerStream Context routines. -// - -#define FsRtlGetPerStreamContextPointer(_fo) \ - ((PFSRTL_ADVANCED_FCB_HEADER)((_fo)->FsContext)) - -// -// This will test to see if PerStream contexts are supported for the given -// FileObject -// - -#define FsRtlSupportsPerStreamContexts(_fo) \ - ((NULL != FsRtlGetPerStreamContextPointer(_fo)) && \ - FlagOn(FsRtlGetPerStreamContextPointer(_fo)->Flags2, \ - FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS)) - -// -// Associate the context at Ptr with the given stream. The Ptr structure -// should be filled in by the caller before calling this routine (see -// FsRtlInitPerStreamContext). If the underlying filesystem does not support -// filter contexts, STATUS_INVALID_DEVICE_REQUEST will be returned. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlInsertPerStreamContext ( - __in PFSRTL_ADVANCED_FCB_HEADER PerStreamContext, - __in PFSRTL_PER_STREAM_CONTEXT Ptr - ); -#endif - -// -// Lookup a filter context associated with the stream specified. The first -// context matching OwnerId (and InstanceId, if present) is returned. By not -// specifying InstanceId, a filter driver can search for any context that it -// has previously associated with a stream. If no matching context is found, -// NULL is returned. If the file system does not support filter contexts, -// NULL is returned. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PFSRTL_PER_STREAM_CONTEXT -FsRtlLookupPerStreamContextInternal ( - __in PFSRTL_ADVANCED_FCB_HEADER StreamContext, - __in_opt PVOID OwnerId, - __in_opt PVOID InstanceId - ); -#endif - -#define FsRtlLookupPerStreamContext(_sc, _oid, _iid) \ - (((NULL != (_sc)) && \ - FlagOn((_sc)->Flags2,FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS) && \ - !IsListEmpty(&(_sc)->FilterContexts)) ? \ - FsRtlLookupPerStreamContextInternal((_sc), (_oid), (_iid)) : \ - NULL) - -// -// Normally, contexts should be deleted when the file system notifies the -// filter that the stream is being closed. There are cases when a filter -// may want to remove all existing contexts for a specific volume. This -// routine should be called at those times. This routine should NOT be -// called for the following cases: -// - Inside your FreeCallback handler - The underlying file system has -// already removed it from the linked list). -// - Inside your IRP_CLOSE handler - If you do this then you will not -// be notified when the stream is torn down. -// -// This functions identically to FsRtlLookupPerStreamContext, except that the -// returned context has been removed from the list. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PFSRTL_PER_STREAM_CONTEXT -FsRtlRemovePerStreamContext ( - __in PFSRTL_ADVANCED_FCB_HEADER StreamContext, - __in_opt PVOID OwnerId, - __in_opt PVOID InstanceId - ); -#endif - - -// -// APIs for file systems to use for initializing and cleaning up -// the Advaned FCB Header fields for PerStreamContext support -// - -// -// This will properly initialize the advanced header so that it can be -// used with PerStream contexts. -// Note: A fast mutex must be placed in an advanced header. It is the -// caller's responsibility to properly create and initialize this -// mutex before calling this macro. The mutex field is only set -// if a non-NULL value is passed in. -// - -__drv_maxIRQL(APC_LEVEL) -VOID -FORCEINLINE -FsRtlSetupAdvancedHeader( - __in PVOID AdvHdr, - __in PFAST_MUTEX FMutex ) - -/* - The AdvHdr parameter should have a type of PFSRTL_ADVANCED_FCB_HEADER but - I had to make it a PVOID because there are cases where this routine is - called where a different type is passed in (where the advanced header - is at the front of this other type). This routine used to be a macro and - I changed it to an INLINE so we could put the NTDDI_VERSION conditional into - it. To maintain compatiblity I made the AdvHdr parameter a PVOID and cast - it to the correct type internally. -*/ - -{ - PFSRTL_ADVANCED_FCB_HEADER localAdvHdr = (PFSRTL_ADVANCED_FCB_HEADER)AdvHdr; - - localAdvHdr->Flags |= FSRTL_FLAG_ADVANCED_HEADER; - localAdvHdr->Flags2 |= FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS; - -#if (NTDDI_VERSION >= NTDDI_VISTA) - localAdvHdr->Version = FSRTL_FCB_HEADER_V1; -#else - localAdvHdr->Version = FSRTL_FCB_HEADER_V0; -#endif - - InitializeListHead( &localAdvHdr->FilterContexts ); - - if (FMutex != NULL) { - - localAdvHdr->FastMutex = FMutex; - } - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// -// API not avaialble down level -// We want to support a driver compiled to the last version running downlevel, -// so continue to use use the direct init of the push lock and not call -// ExInitializePushLock. -// - - *((PULONG_PTR)(&localAdvHdr->PushLock)) = 0; - /*ExInitializePushLock( &localAdvHdr->PushLock ); API not avaialble down level*/ - - localAdvHdr->FileContextSupportPointer = NULL; -#endif -} - - -// -// File systems call this API to free any filter contexts still associated -// with an FSRTL_COMMON_FCB_HEADER that they are tearing down. -// The FreeCallback routine for each filter context will be called. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlTeardownPerStreamContexts ( - __in PFSRTL_ADVANCED_FCB_HEADER AdvancedHeader - ); - -// -// Function pointer to above routine for modules that need to dynamically import -// - -typedef VOID (*PFN_FSRTLTEARDOWNPERSTREAMCONTEXTS) (__in PFSRTL_ADVANCED_FCB_HEADER AdvancedHeader); -#endif - -// -// File System Filter PerFileObject Context Support -// - -// -// Filesystem filter drivers use these APIs to associate context -// with individual open files. For now these are only supported on file -// objects with a FileObject extension which are only created by using -// IoCreateFileSpecifyDeviceObjectHint. -// - -// -// OwnerId should uniquely identify a particular filter driver -// (e.g. the address of the driver's device object). -// InstanceId can be used to distinguish distinct contexts associated -// by a filter driver with a single stream (e.g. the address of the -// fileobject). -// - -// -// This structure needs to be embedded within the users context that -// they want to associate with a given stream -// - -typedef struct _FSRTL_PER_FILEOBJECT_CONTEXT { - // - // This is linked into the File Object - // - - LIST_ENTRY Links; - - // - // A Unique ID for this filter (ex: address of Driver Object, Device - // Object, or Device Extension) - // - - PVOID OwnerId; - - // - // An optional ID to differentiate different contexts for the same - // filter. - // - - PVOID InstanceId; - -} FSRTL_PER_FILEOBJECT_CONTEXT, *PFSRTL_PER_FILEOBJECT_CONTEXT; - - -// -// This will initialize the given FSRTL_PER_FILEOBJECT_CONTEXT structure. This -// should be used before calling "FsRtlInsertPerFileObjectContext". -// - -#define FsRtlInitPerFileObjectContext( _fc, _owner, _inst ) \ - ((_fc)->OwnerId = (_owner), \ - (_fc)->InstanceId = (_inst)) \ - -// -// Associate the context at Ptr with the given FileObject. The Ptr -// structure should be filled in by the caller before calling this -// routine (see FsRtlInitPerFileObjectContext). If this file object does not -// support filter contexts, STATUS_INVALID_DEVICE_REQUEST will be returned. -// - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlInsertPerFileObjectContext ( - __in PFILE_OBJECT FileObject, - __in PFSRTL_PER_FILEOBJECT_CONTEXT Ptr - ); - -// -// Lookup a filter context associated with the FileObject specified. The first -// context matching OwnerId (and InstanceId, if present) is returned. By not -// specifying InstanceId, a filter driver can search for any context that it -// has previously associated with a stream. If no matching context is found, -// NULL is returned. If the FileObject does not support contexts, -// NULL is returned. -// - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PFSRTL_PER_FILEOBJECT_CONTEXT -FsRtlLookupPerFileObjectContext ( - __in PFILE_OBJECT FileObject, - __in_opt PVOID OwnerId, - __in_opt PVOID InstanceId - ); - -// -// Normally, contexts should be deleted when the IoManager notifies the -// filter that the FileObject is being freed. There are cases when a filter -// may want to remove all existing contexts for a specific volume. This -// routine should be called at those times. This routine should NOT be -// called for the following case: -// - Inside your FreeCallback handler - The IoManager has already removed -// it from the linked list. -// -// This functions identically to FsRtlLookupPerFileObjectContext, except that -// the returned context has been removed from the list. -// - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PFSRTL_PER_FILEOBJECT_CONTEXT -FsRtlRemovePerFileObjectContext ( - __in PFILE_OBJECT FileObject, - __in_opt PVOID OwnerId, - __in_opt PVOID InstanceId - ); - -//++ -// -// VOID -// FsRtlCompleteRequest ( -// __in PIRP Irp, -// __in NTSTATUS Status -// ); -// -// Routine Description: -// -// This routine is used to complete an IRP with the indicated -// status. It does the necessary raise and lower of IRQL. -// -// Arguments: -// -// Irp - Supplies a pointer to the Irp to complete -// -// Status - Supplies the completion status for the Irp -// -// Return Value: -// -// None. -// -//-- - -#define FsRtlCompleteRequest(IRP,STATUS) { \ - (IRP)->IoStatus.Status = (STATUS); \ - IoCompleteRequest( (IRP), IO_DISK_INCREMENT ); \ -} - - -//++ -// -// VOID -// FsRtlEnterFileSystem ( -// ); -// -// Routine Description: -// -// This routine is used when entering a file system (e.g., through its -// Fsd entry point). It ensures that the file system cannot be suspended -// while running and thus block other file I/O requests. Upon exit -// the file system must call FsRtlExitFileSystem. -// -// Arguments: -// -// Return Value: -// -// None. -// -//-- - -#define FsRtlEnterFileSystem() { \ - KeEnterCriticalRegion(); \ -} - -//++ -// -// VOID -// FsRtlExitFileSystem ( -// ); -// -// Routine Description: -// -// This routine is used when exiting a file system (e.g., through its -// Fsd entry point). -// -// Arguments: -// -// Return Value: -// -// None. -// -//-- - -#define FsRtlExitFileSystem() { \ - KeLeaveCriticalRegion(); \ -} - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -VOID -FsRtlIncrementCcFastReadNotPossible( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -VOID -FsRtlIncrementCcFastReadWait( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -VOID -FsRtlIncrementCcFastReadNoWait( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -VOID -FsRtlIncrementCcFastReadResourceMiss( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -VOID -FsRtlIncrementCcFastMdlReadWait( - VOID - ); -#endif - -// -// Returns TRUE if the given fileObject represents a paging file, returns -// FALSE otherwise. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -LOGICAL -FsRtlIsPagingFile ( - __in PFILE_OBJECT FileObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -// -// This routine is available on: -// * Windows 2000 SP4 plus URP -// * Windows XP SP2 plus QFE ? -// * Windows Server 2003 SP1 -// -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlCreateSectionForDataScan( - __out PHANDLE SectionHandle, - __deref_out PVOID *SectionObject, - __out_opt PLARGE_INTEGER SectionFileSize, - __in PFILE_OBJECT FileObject, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt PLARGE_INTEGER MaximumSize, - __in ULONG SectionPageProtection, - __in ULONG AllocationAttributes, - __in ULONG Flags - ); -#endif - -// -// Reparse Routines -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlValidateReparsePointBuffer ( - __in ULONG BufferLength, - __in_bcount(BufferLength) PREPARSE_DATA_BUFFER ReparseBuffer -); - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlRemoveDotsFromPath( - __inout_bcount(PathLength) PWSTR OriginalString, - __in USHORT PathLength, - __out USHORT *NewLength -); -#endif - -// begin_ntosp -////////////////////////////////////////////////////////////////////////// -// -// Extra Create Parameter Support routines -// -// These routines are used when processing a create IRP to allow passing -// extra information up and down the file system stack. This is used by -// file system filters, Client Side Encryption, Transactions etc. -// -////////////////////////////////////////////////////////////////////////// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef struct _ECP_LIST ECP_LIST; -typedef struct _ECP_LIST *PECP_LIST; -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -typedef struct _ECP_HEADER ECP_HEADER; -typedef struct _ECP_HEADER *PECP_HEADER; -#endif - -// -// Prototype for the ECP cleanup routine callback -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef VOID -(*PFSRTL_EXTRA_CREATE_PARAMETER_CLEANUP_CALLBACK) ( - __inout PVOID EcpContext, - __in LPCGUID EcpType - ); -#endif - - - -// -// Basic ECP functions -// - -// -// Flags used by FsRtlAllocateExtraCreateParameterList -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef ULONG FSRTL_ALLOCATE_ECPLIST_FLAGS; - - // - // Charge this memory against the quota of the current process - // - - #define FSRTL_ALLOCATE_ECPLIST_FLAG_CHARGE_QUOTA 0x00000001 -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlAllocateExtraCreateParameterList ( - __in FSRTL_ALLOCATE_ECPLIST_FLAGS Flags, - __deref_out PECP_LIST *EcpList - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlFreeExtraCreateParameterList ( - __in PECP_LIST EcpList - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -NTSTATUS -FsRtlInitializeExtraCreateParameterList ( - __inout PECP_LIST EcpList - ); -#endif - -// -// Flags used by FsRtlAllocateExtraCreateParameter -// and FsRtlAllocateExtraCreateParameterFromLookasideList -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef ULONG FSRTL_ALLOCATE_ECP_FLAGS; - - // - // If set charage quota against the current process for this - // allocation. This flag is ignored if using a lookaside list - // - - #define FSRTL_ALLOCATE_ECP_FLAG_CHARGE_QUOTA 0x00000001 - - // - // If set allocate the ECP from non-paged pool - // Else use paged pool - // - - #define FSRTL_ALLOCATE_ECP_FLAG_NONPAGED_POOL 0x00000002 -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlAllocateExtraCreateParameter ( - __in LPCGUID EcpType, - __in ULONG SizeOfContext, - __in FSRTL_ALLOCATE_ECP_FLAGS Flags, - __in_opt PFSRTL_EXTRA_CREATE_PARAMETER_CLEANUP_CALLBACK CleanupCallback, - __in ULONG PoolTag, - __deref_out_bcount(SizeOfContext) PVOID *EcpContext - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlFreeExtraCreateParameter ( - __in PVOID EcpContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -VOID -FsRtlInitializeExtraCreateParameter( - __in PECP_HEADER Ecp, - __in ULONG EcpFlags, - __in_opt PFSRTL_EXTRA_CREATE_PARAMETER_CLEANUP_CALLBACK CleanupCallback, - __in ULONG TotalSize, - __in LPCGUID EcpType, - __in_opt PVOID ListAllocatedFrom - ); -#endif - -// -// Flags used by FsRtlInitExtraCreateParameterLookasideList -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef ULONG FSRTL_ECP_LOOKASIDE_FLAGS; - - // - // If set this is a NON-PAGED lookaside list - // ELSE this is a PAGED lookaside list - // - - #define FSRTL_ECP_LOOKASIDE_FLAG_NONPAGED_POOL 0x00000002 -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_when(Flags|FSRTL_ECP_LOOKASIDE_FLAG_NONPAGED_POOL, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(!(Flags|FSRTL_ECP_LOOKASIDE_FLAG_NONPAGED_POOL), __drv_maxIRQL(APC_LEVEL)) -NTKERNELAPI -VOID -FsRtlInitExtraCreateParameterLookasideList ( - __inout PVOID Lookaside, - __in FSRTL_ECP_LOOKASIDE_FLAGS Flags, - __in SIZE_T Size, - __in ULONG Tag - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_when(Flags|FSRTL_ECP_LOOKASIDE_FLAG_NONPAGED_POOL, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(!(Flags|FSRTL_ECP_LOOKASIDE_FLAG_NONPAGED_POOL), __drv_maxIRQL(APC_LEVEL)) -VOID -FsRtlDeleteExtraCreateParameterLookasideList ( - __inout PVOID Lookaside, - __in FSRTL_ECP_LOOKASIDE_FLAGS Flags - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlAllocateExtraCreateParameterFromLookasideList ( - __in LPCGUID EcpType, - __in_bound ULONG SizeOfContext, - __in FSRTL_ALLOCATE_ECP_FLAGS Flags, - __in_opt PFSRTL_EXTRA_CREATE_PARAMETER_CLEANUP_CALLBACK CleanupCallback, - __inout PVOID LookasideList, - __deref_out PVOID *EcpContext - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlInsertExtraCreateParameter ( - __inout PECP_LIST EcpList, - __inout PVOID EcpContext - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlFindExtraCreateParameter ( - __in PECP_LIST EcpList, - __in LPCGUID EcpType, - __deref_opt_out PVOID *EcpContext, - __out_opt ULONG *EcpContextSize - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlRemoveExtraCreateParameter ( - __inout PECP_LIST EcpList, - __in LPCGUID EcpType, - __deref_out PVOID *EcpContext, - __out_opt ULONG *EcpContextSize - ); -#endif - -// -// Functions to get and set Extra Create Parameters into/out of a create IRP -// - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlGetEcpListFromIrp ( - __in PIRP Irp, - __deref_out_opt PECP_LIST *EcpList - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlSetEcpListIntoIrp ( - __inout PIRP Irp, - __in PECP_LIST EcpList - ); -#endif - - -// -// Additional functions used for full functionality -// - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlGetNextExtraCreateParameter ( - __in PECP_LIST EcpList, - __in_opt PVOID CurrentEcpContext, - __out_opt LPGUID NextEcpType, - __deref_opt_out PVOID *NextEcpContext, - __out_opt ULONG *NextEcpContextSize - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FsRtlAcknowledgeEcp ( - __in PVOID EcpContext - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlIsEcpAcknowledged ( - __in PVOID EcpContext - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlIsEcpFromUserMode ( - __in PVOID EcpContext - ); -#endif - -// end_ntosp - -////////////////////////////////////////////////////////////////////////////// -// -// This contains public ECP definitions -// -////////////////////////////////////////////////////////////////////////////// - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// -// Start of NETWORK_OPEN_ECP_CONTEXT structures and definitions. -// This ECP can be used as a way to pass extra information at create time -// to network redirectors. -// - -typedef enum { - - NetworkOpenLocationAny, // No restrictions. - NetworkOpenLocationRemote, // Restrict to remote only. - NetworkOpenLocationLoopback // Restrict to local-machine only. - -} NETWORK_OPEN_LOCATION_QUALIFIER; - - -typedef enum { - - NetworkOpenIntegrityAny, // No restrictions on signing/encryption etc. - NetworkOpenIntegrityNone, // No signing/encryption. - NetworkOpenIntegritySigned, // Signed end to end. - NetworkOpenIntegrityEncrypted, // encrypted end-end. - NetworkOpenIntegrityMaximum // Best available. - -} NETWORK_OPEN_INTEGRITY_QUALIFIER; - - - - -// -// ECP context for network create parameters. -// - - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -// -// Below we have the structures and definitions for Win7 -// - -// in flags. - -#define NETWORK_OPEN_ECP_IN_FLAG_DISABLE_HANDLE_COLLAPSING 0x1 -#define NETWORK_OPEN_ECP_IN_FLAG_DISABLE_HANDLE_DURABILITY 0x2 -#define NETWORK_OPEN_ECP_IN_FLAG_FORCE_BUFFERED_SYNCHRONOUS_IO_HACK 0x80000000 - -typedef struct _NETWORK_OPEN_ECP_CONTEXT { - - USHORT Size; // Must be set to the size of this structure. - USHORT Reserved; // Must be set to zero. - - struct { - - // - // Pre-create restrictions - // - - struct { - - NETWORK_OPEN_LOCATION_QUALIFIER Location; - NETWORK_OPEN_INTEGRITY_QUALIFIER Integrity; - ULONG Flags; - - } in; - - // - // Post create information returned to the caller. - // - - struct { - - NETWORK_OPEN_LOCATION_QUALIFIER Location; - NETWORK_OPEN_INTEGRITY_QUALIFIER Integrity; - ULONG Flags; - - } out; - - } DUMMYSTRUCTNAME; - -} NETWORK_OPEN_ECP_CONTEXT, *PNETWORK_OPEN_ECP_CONTEXT; - -// -// This version of the NETWORK_OPEN_ECP_CONTEXT was used on -// Windows Vista. Drivers interpreting "Network ECP Contexts" on -// Vista OSes should use this version. -// - -typedef struct _NETWORK_OPEN_ECP_CONTEXT_V0 { - - USHORT Size; // Must be set to the size of this structure. - USHORT Reserved; // Must be set to zero. - - struct { - - // - // Pre-create restrictions - // - - struct { - - NETWORK_OPEN_LOCATION_QUALIFIER Location; - NETWORK_OPEN_INTEGRITY_QUALIFIER Integrity; - - } in; - - // - // Post create information returned to the caller. - // - - struct { - - NETWORK_OPEN_LOCATION_QUALIFIER Location; - NETWORK_OPEN_INTEGRITY_QUALIFIER Integrity; - - } out; - - } DUMMYSTRUCTNAME; - -} NETWORK_OPEN_ECP_CONTEXT_V0, *PNETWORK_OPEN_ECP_CONTEXT_V0; - -#elif (NTDDI_VERSION >= NTDDI_VISTA) - -// -// Here is the definition of Network Open ECP for native Vista Drivers. -// - -typedef struct _NETWORK_OPEN_ECP_CONTEXT { - - USHORT Size; // Must be set to the size of this structure. - USHORT Reserved; // Must be set to zero. - - struct { - - // - // Pre-create restrictions - // - - struct { - - NETWORK_OPEN_LOCATION_QUALIFIER Location; - NETWORK_OPEN_INTEGRITY_QUALIFIER Integrity; - - } in; - - // - // Post create information returned to the caller. - // - - struct { - - NETWORK_OPEN_LOCATION_QUALIFIER Location; - NETWORK_OPEN_INTEGRITY_QUALIFIER Integrity; - - } out; - - } DUMMYSTRUCTNAME; - -} NETWORK_OPEN_ECP_CONTEXT, *PNETWORK_OPEN_ECP_CONTEXT; -#endif - -// -// The GUID used for the NETWORK_OPEN_ECP_CONTEXT structure -// - -DEFINE_GUID( GUID_ECP_NETWORK_OPEN_CONTEXT, 0xc584edbf, 0x00df, 0x4d28, 0xb8, 0x84, 0x35, 0xba, 0xca, 0x89, 0x11, 0xe8 ); - -// -// End NETWORK_OPEN_ECP_CONTEXT definitions -// - -#endif //(NTDDI_VERSION >= NTDDI_VISTA) - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// -// Start of PREFETCH_OPEN_ECP_CONTEXT structures and definitions. -// This ECP is used to communicate the fact that a given open request is done -// by the prefetcher. -// - -// -// ECP structure for prefetcher opens. -// - -typedef struct _PREFETCH_OPEN_ECP_CONTEXT { - - PVOID Context; // Opaque context associated with the open. - -} PREFETCH_OPEN_ECP_CONTEXT, *PPREFETCH_OPEN_ECP_CONTEXT; - -// -// The GUID used for the PREFETCH_OPEN_ECP_CONTEXT structure -// - -DEFINE_GUID( GUID_ECP_PREFETCH_OPEN, 0xe1777b21, 0x847e, 0x4837, 0xaa, 0x45, 0x64, 0x16, 0x1d, 0x28, 0x6, 0x55 ); - -// -// End PREFETCH_OPEN_ECP_CONTEXT definitions -// - -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN7) -// -// The type GUID and structure for NFS (Network File System) extra create parameters -// -// -// {f326d30c-e5f8-4fe7-ab74-f5a3196d92db} -// - -typedef struct sockaddr_storage *PSOCKADDR_STORAGE_NFS; - - -DEFINE_GUID (GUID_ECP_NFS_OPEN, - 0xf326d30c, - 0xe5f8, - 0x4fe7, - 0xab, 0x74, 0xf5, 0xa3, 0x19, 0x6d, 0x92, 0xdb); - - -typedef struct _NFS_OPEN_ECP_CONTEXT { - - // - // Export alias (share name) for the create with type PUNICODE_STRING. This is a - // hint and may be a name, NULL or zero length string - // - PUNICODE_STRING ExportAlias; - - - // - // Socket address of client - // - PSOCKADDR_STORAGE_NFS ClientSocketAddress; - -} NFS_OPEN_ECP_CONTEXT, *PNFS_OPEN_ECP_CONTEXT, **PPNFS_OPEN_ECP_CONTEXT; - -// -// ECP context for SRV create parameters. -// - -// -// The GUID used for the SRV_OPEN_ECP_CONTEXT structure -// {BEBFAEBC-AABF-489d-9D2C-E9E361102853} -// -//typedef struct sockaddr_storage *PSOCKADDR_STORAGE_SMB; - -DEFINE_GUID( GUID_ECP_SRV_OPEN, - 0xbebfaebc, - 0xaabf, - 0x489d, - 0x9d, 0x2c, 0xe9, 0xe3, 0x61, 0x10, 0x28, 0x53 ); - -typedef struct _SRV_OPEN_ECP_CONTEXT { - - // - // Share name for the create with type PUNICODE_STRING - // - - PUNICODE_STRING ShareName; - - // - // Socket address of client - // - - PSOCKADDR_STORAGE_NFS SocketAddress; - - // - // Oplock state of open (for SMB/SMB2 oplock breaking logic) - // - - BOOLEAN OplockBlockState; - BOOLEAN OplockAppState; - BOOLEAN OplockFinalState; - -} SRV_OPEN_ECP_CONTEXT, *PSRV_OPEN_ECP_CONTEXT; - -// -// End SRV_OPEN_ECP_CONTEXT definitions -// - -#endif //(NTDDI_VERSION >= NTDDI_WIN7) - - - -// -// This routine allows the caller to change the referenced file object that -// is pointed to by either: -// - One of Mm's image control areas for this stream -// - Mm's data control area for this stream -// - Cc's shared cache map for this stream -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef enum _FSRTL_CHANGE_BACKING_TYPE { - - ChangeDataControlArea, - ChangeImageControlArea, - ChangeSharedCacheMap - -} FSRTL_CHANGE_BACKING_TYPE, *PFSRTL_CHANGE_BACKING_TYPE; - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlChangeBackingFileObject ( - __in_opt PFILE_OBJECT CurrentFileObject, - __in PFILE_OBJECT NewFileObject, - __in FSRTL_CHANGE_BACKING_TYPE ChangeBackingType, - __in ULONG Flags //reserved, must be zero - ); - -#endif - -// -// Flags for FsRtlLogCcFlushError -// - -#define FSRTL_CC_FLUSH_ERROR_FLAG_NO_HARD_ERROR 0x1 -#define FSRTL_CC_FLUSH_ERROR_FLAG_NO_LOG_ENTRY 0x2 - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -FsRtlLogCcFlushError( - __in PUNICODE_STRING FileName, - __in PDEVICE_OBJECT DeviceObject, - __in PSECTION_OBJECT_POINTERS SectionObjectPointer, - __in NTSTATUS FlushError, - __in ULONG Flags - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// -// Routine to query whether volume startup application such as autochk -// have completed. -// - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -FsRtlAreVolumeStartupApplicationsComplete( - VOID - ); - -#endif - -// begin_ntosp - -#if (NTDDI_VERSION > NTDDI_VISTA) - -// -// Routine to query maximum depth of virtual disk layering support. -// - -NTKERNELAPI -ULONG -FsRtlQueryMaximumVirtualDiskNestingLevel ( - VOID - ); - -// -// Routine to query virtual disk info for a given disk or volume object -// - -NTKERNELAPI -NTSTATUS -FsRtlGetVirtualDiskNestingLevel ( - __in PDEVICE_OBJECT DeviceObject, - __out PULONG NestingLevel, - __out_opt PULONG NestingFlags - ); - -// -// Current possible values for NestingFlags. -// - -#define FSRTL_VIRTDISK_FULLY_ALLOCATED 0x00000001 -#define FSRTL_VIRTDISK_NO_DRIVE_LETTER 0x00000002 - -#endif - -// -// Define two constants describing the view size (and alignment) -// that the Cache Manager uses to map files. -// - -#define VACB_MAPPING_GRANULARITY (0x40000) -#define VACB_OFFSET_SHIFT (18) - -// -// Public portion of BCB -// - -typedef struct _PUBLIC_BCB { - - // - // Type and size of this record - // - // NOTE: The first four fields must be the same as the BCB in cc.h. - // - - CSHORT NodeTypeCode; - CSHORT NodeByteSize; - - // - // Description of range of file which is currently mapped. - // - - ULONG MappedLength; - LARGE_INTEGER MappedFileOffset; -} PUBLIC_BCB, *PPUBLIC_BCB; - -// -// File Sizes structure. -// - -typedef struct _CC_FILE_SIZES { - - LARGE_INTEGER AllocationSize; - LARGE_INTEGER FileSize; - LARGE_INTEGER ValidDataLength; - -} CC_FILE_SIZES, *PCC_FILE_SIZES; - -// -// Define a Cache Manager callback structure. These routines are required -// by the Lazy Writer, so that it can acquire resources in the right order -// to avoid deadlocks. Note that otherwise you would have most FS requests -// acquiring FS resources first and caching structures second, while the -// Lazy Writer needs to acquire its own resources first, and then FS -// structures later as it calls the file system. -// - -// -// First define the procedure pointer typedefs -// - -// -// This routine is called by the Lazy Writer prior to doing a write, -// since this will require some file system resources associated with -// this cached file. The context parameter supplied is whatever the FS -// passed as the LazyWriteContext parameter when is called -// CcInitializeCacheMap. -// - -typedef -BOOLEAN (*PACQUIRE_FOR_LAZY_WRITE) ( - __in PVOID Context, - __in BOOLEAN Wait - ); - -// -// This routine releases the Context acquired above. -// - -typedef -VOID (*PRELEASE_FROM_LAZY_WRITE) ( - __in PVOID Context - ); - -// -// This routine is called by the Lazy Writer prior to doing a readahead. -// - -typedef -BOOLEAN (*PACQUIRE_FOR_READ_AHEAD) ( - __in PVOID Context, - __in BOOLEAN Wait - ); - -// -// This routine releases the Context acquired above. -// - -typedef -VOID (*PRELEASE_FROM_READ_AHEAD) ( - __in PVOID Context - ); - -typedef struct _CACHE_MANAGER_CALLBACKS { - - PACQUIRE_FOR_LAZY_WRITE AcquireForLazyWrite; - PRELEASE_FROM_LAZY_WRITE ReleaseFromLazyWrite; - PACQUIRE_FOR_READ_AHEAD AcquireForReadAhead; - PRELEASE_FROM_READ_AHEAD ReleaseFromReadAhead; - -} CACHE_MANAGER_CALLBACKS, *PCACHE_MANAGER_CALLBACKS; - -// -// This structure is passed into CcUninitializeCacheMap -// if the caller wants to know when the cache map is deleted. -// - -typedef struct _CACHE_UNINITIALIZE_EVENT { - struct _CACHE_UNINITIALIZE_EVENT *Next; - KEVENT Event; -} CACHE_UNINITIALIZE_EVENT, *PCACHE_UNINITIALIZE_EVENT; - -// -// Callback routine for retrieving dirty pages from Cache Manager. -// - -typedef -VOID (*PDIRTY_PAGE_ROUTINE) ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in PLARGE_INTEGER OldestLsn, - __in PLARGE_INTEGER NewestLsn, - __in PVOID Context1, - __in PVOID Context2 - ); - -// -// Callback routine for doing log file flushes to Lsn. -// - -typedef -VOID (*PFLUSH_TO_LSN) ( - __in PVOID LogHandle, - __in LARGE_INTEGER Lsn - ); - -// -// Macro to test whether a file is cached or not. -// - -#define CcIsFileCached(FO) ( \ - ((FO)->SectionObjectPointer != NULL) && \ - (((PSECTION_OBJECT_POINTERS)(FO)->SectionObjectPointer)->SharedCacheMap != NULL) \ -) - -extern ULONG CcFastMdlReadWait; - -// -// The following routines are intended for use by File Systems Only. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcInitializeCacheMap ( - __in PFILE_OBJECT FileObject, - __in PCC_FILE_SIZES FileSizes, - __in BOOLEAN PinAccess, - __in PCACHE_MANAGER_CALLBACKS Callbacks, - __in PVOID LazyWriteContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -CcUninitializeCacheMap ( - __in PFILE_OBJECT FileObject, - __in_opt PLARGE_INTEGER TruncateSize, - __in_opt PCACHE_UNINITIALIZE_EVENT UninitializeEvent - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcSetFileSizes ( - __in PFILE_OBJECT FileObject, - __in PCC_FILE_SIZES FileSizes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -NTSTATUS -CcSetFileSizesEx ( - __in PFILE_OBJECT FileObject, - __in PCC_FILE_SIZES FileSizes - ); -#endif - -#define CcGetFileSizePointer(FO) ( \ - ((PLARGE_INTEGER)((FO)->SectionObjectPointer->SharedCacheMap) + 1) \ -) - -// -// Flags for CcPurgeCacheSection -// - -// -// UNINITIALIZE_CACHE_MAPS - All private cache maps will be uninitialized -// before purging the data. This pattern may be specified as TRUE. -// - -#define UNINITIALIZE_CACHE_MAPS (1) - -// -// DO_NOT_RETRY_PURGE - CcPurgeCacheSection will not retry purging the file -// on purge failure even if Mm says the file can be truncated. The return -// value will specify whether or not the purge succeeded. -// - -#define DO_NOT_RETRY_PURGE (2) - -// -// DO_NOT_PURGE_DIRTY_PAGES - Instructs CcPurgeCacheSection to fail any -// purge requests that would cause the caller to throw away dirty data. This -// flag should be used when initiating a coherency flush/purge to ensure that -// the file system does not throw away data generated in the gap between a -// flush and purge. -// - -#define DO_NOT_PURGE_DIRTY_PAGES (0x4) - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -BOOLEAN -CcPurgeCacheSection ( - __in PSECTION_OBJECT_POINTERS SectionObjectPointer, - __in_opt PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in ULONG Flags - ); - -#elif (NTDDI_VERSION >= NTDDI_WIN2K) - -NTKERNELAPI -BOOLEAN -CcPurgeCacheSection ( - __in PSECTION_OBJECT_POINTERS SectionObjectPointer, - __in_opt PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in BOOLEAN UninitializeCacheMaps - ); -#endif - -#define CC_FLUSH_AND_PURGE_NO_PURGE (0x1) - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -VOID -CcCoherencyFlushAndPurgeCache ( - __in PSECTION_OBJECT_POINTERS SectionObjectPointer, - __in_opt PLARGE_INTEGER FileOffset, - __in ULONG Length, - __out PIO_STATUS_BLOCK IoStatus, - __in_opt ULONG Flags - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcSetDirtyPageThreshold ( - __in PFILE_OBJECT FileObject, - __in ULONG DirtyPageThreshold - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcFlushCache ( - __in PSECTION_OBJECT_POINTERS SectionObjectPointer, - __in_opt PLARGE_INTEGER FileOffset, - __in ULONG Length, - __out_opt PIO_STATUS_BLOCK IoStatus - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -LARGE_INTEGER -CcGetFlushedValidData ( - __in PSECTION_OBJECT_POINTERS SectionObjectPointer, - __in BOOLEAN BcbListHeld - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -CcZeroData ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER StartOffset, - __in PLARGE_INTEGER EndOffset, - __in BOOLEAN Wait - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PVOID -CcRemapBcb ( - __in PVOID Bcb - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcRepinBcb ( - __in PVOID Bcb - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcUnpinRepinnedBcb ( - __in PVOID Bcb, - __in BOOLEAN WriteThrough, - __out PIO_STATUS_BLOCK IoStatus - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PFILE_OBJECT -CcGetFileObjectFromSectionPtrs ( - __in PSECTION_OBJECT_POINTERS SectionObjectPointer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -PFILE_OBJECT -CcGetFileObjectFromSectionPtrsRef ( - __in PSECTION_OBJECT_POINTERS SectionObjectPointer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PFILE_OBJECT -CcGetFileObjectFromBcb ( - __in PVOID Bcb - ); -#endif - - -// -// These routines are implemented to support write throttling. -// - -// -// BOOLEAN -// CcCopyWriteWontFlush ( -// IN PFILE_OBJECT FileObject, -// IN PLARGE_INTEGER FileOffset, -// IN ULONG Length -// ); -// - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -BOOLEAN -CcCopyWriteWontFlush ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length - ); -#else -#define CcCopyWriteWontFlush(FO,FOFF,LEN) ((LEN) <= 0X1000000) -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -CcCanIWrite ( - __in PFILE_OBJECT FileObject, - __in ULONG BytesToWrite, - __in BOOLEAN Wait, - __in UCHAR Retrying - ); -#endif - -typedef -VOID (*PCC_POST_DEFERRED_WRITE) ( - __in PVOID Context1, - __in PVOID Context2 - ); - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcDeferWrite ( - __in PFILE_OBJECT FileObject, - __in PCC_POST_DEFERRED_WRITE PostRoutine, - __in PVOID Context1, - __in PVOID Context2, - __in ULONG BytesToWrite, - __in BOOLEAN Retrying - ); -#endif - -// -// The following routines provide a data copy interface to the cache, and -// are intended for use by File Servers and File Systems. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -CcCopyRead ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in BOOLEAN Wait, - __out_bcount(Length) PVOID Buffer, - __out PIO_STATUS_BLOCK IoStatus - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcFastCopyRead ( - __in PFILE_OBJECT FileObject, - __in ULONG FileOffset, - __in ULONG Length, - __in ULONG PageCount, - __out_bcount(Length) PVOID Buffer, - __out PIO_STATUS_BLOCK IoStatus - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -CcCopyWrite ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in BOOLEAN Wait, - __in_bcount(Length) PVOID Buffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcFastCopyWrite ( - __in PFILE_OBJECT FileObject, - __in ULONG FileOffset, - __in ULONG Length, - __in_bcount(Length) PVOID Buffer - ); -#endif - -// -// The following routines provide an Mdl interface for transfers to and -// from the cache, and are primarily intended for File Servers. -// -// NOBODY SHOULD BE CALLING THESE MDL ROUTINES DIRECTLY, USE FSRTL AND -// FASTIO INTERFACES. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcMdlRead ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __out PMDL *MdlChain, - __out PIO_STATUS_BLOCK IoStatus - ); -#endif - -// -// This routine is now a wrapper for FastIo if present or CcMdlReadComplete2 -// -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcMdlReadComplete ( - __in PFILE_OBJECT FileObject, - __in PMDL MdlChain - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcPrepareMdlWrite ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __out PMDL *MdlChain, - __out PIO_STATUS_BLOCK IoStatus - ); -#endif -// -// This routine is now a wrapper for FastIo if present or CcMdlWriteComplete2 -// -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcMdlWriteComplete ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in PMDL MdlChain - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -VOID -CcMdlWriteAbort ( - __in PFILE_OBJECT FileObject, - __in PMDL MdlChain - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -// -// Common ReadAhead call for Copy Read and Mdl Read. -// -// ReadAhead should always be invoked by calling the CcReadAhead macro, -// which tests first to see if the read is large enough to warrant read -// ahead. Measurements have shown that, calling the read ahead routine -// actually decreases performance for small reads, such as issued by -// many compilers and linkers. Compilers simply want all of the include -// files to stay in memory after being read the first time. -// - -#define CcReadAhead(FO,FOFF,LEN) { \ - if ((LEN) >= 256) { \ - CcScheduleReadAhead((FO),(FOFF),(LEN)); \ - } \ -} - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcScheduleReadAhead ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length - ); -#endif - -// -// The following routine allows a caller to wait for the next batch -// of lazy writer work to complete. In particular, this provides a -// mechanism for a caller to be sure that all avaliable lazy closes -// at the time of this call have issued. -// -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -CcWaitForCurrentLazyWriterActivity ( - VOID - ); -#endif - -// -// This routine changes the read ahead granularity for a file, which is -// PAGE_SIZE by default. -// -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcSetReadAheadGranularity ( - __in PFILE_OBJECT FileObject, - __in ULONG Granularity - ); -#endif - -// -// The following routines provide direct access data which is pinned in the -// cache, and is primarily intended for use by File Systems. In particular, -// this mode of access is ideal for dealing with volume structures. -// - -// -// Flags for pinning -// -// Note: The flags for pinning and the flags for mapping cannot overlap unless -// the flag has the same meaning. -// - -// -// Synchronous Wait - normally specified. This pattern may be specified as TRUE. -// - -#define PIN_WAIT (1) - -// -// Acquire metadata Bcb exclusive (default is shared, Lazy Writer uses exclusive). -// -// Must be set with PIN_WAIT. -// - -#define PIN_EXCLUSIVE (2) - -// -// Acquire metadata Bcb but do not fault data in. Default is to fault the data in. -// This unusual flag is only used by Ntfs for cache coherency synchronization between -// compressed and uncompressed streams for the same compressed file. -// -// Must be set with PIN_WAIT. -// - -#define PIN_NO_READ (4) - -// -// This option may be used to pin data only if the Bcb already exists. If the Bcb -// does not already exist - the pin is unsuccessful and no Bcb is returned. This routine -// provides a way to see if data is already pinned (and possibly dirty) in the cache, -// without forcing a fault if the data is not there. -// - -#define PIN_IF_BCB (8) - -// -// If this option is specified, the caller is responsible for tracking the -// dirty ranges and calling MmSetAddressRangeModified on these ranges before -// they are flushed. Ranges should only be pinned via this manner if the -// entire range will be written or purged (one or the other must occur). -// - -#define PIN_CALLER_TRACKS_DIRTY_DATA (32) - -// -// If this option is specified, Cc will used reserved views to map the data -// requested if Mm has no views to give Cc at the time of mapping the data. -// This flag should only be used for critical data, like file system metadata -// or other data critical to the file system remaining consistent. This is -// a best effort attempt to ensure that we have enough kernel VA space for -// critical system mappings, but once they are all gone, the call will fail -// with insufficient resources. -// -// - -#define PIN_HIGH_PRIORITY (64) - -// -// Flags for mapping -// - -// -// Synchronous Wait - normally specified. This pattern may be specified as TRUE. -// - -#define MAP_WAIT (1) - -// -// Acquire metadata Bcb but do not fault data in. Default is to fault the data in. -// This should not overlap with any of the PIN_ flags so they can be passed down to -// CcPinFileData -// - -#define MAP_NO_READ (16) - -// -// If this option is specified, Cc will used reserved views to map the data -// requested if Mm has no views to give Cc at the time of mapping the data. -// This flag should only be used for critical data, like file system metadata -// or other data critical to the file system remaining consistent. This is -// a best effort attempt to ensure that we have enough kernel VA space for -// critical system mappings, but once they are all gone, the call will fail -// with insufficient resources. -// -// - -#define MAP_HIGH_PRIORITY (64) - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -CcPinRead ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in ULONG Flags, - __deref_out PVOID *Bcb, - __deref_out_bcount(Length) PVOID *Buffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -BOOLEAN -CcMapData ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in ULONG Flags, - __deref_out PVOID *Bcb, - __deref_out_bcount(Length) PVOID *Buffer - ); -#elif (NTDDI_VERSION >= NTDDI_WIN2K) - -NTKERNELAPI -BOOLEAN -CcMapData ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in BOOLEAN Wait, - __deref_out PVOID *Bcb, - __deref_out_bcount(Length) PVOID *Buffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -CcPinMappedData ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in ULONG Flags, - __deref_inout PVOID *Bcb - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -CcPreparePinWrite ( - __in PFILE_OBJECT FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in BOOLEAN Zero, - __in ULONG Flags, - __deref_out PVOID *Bcb, - __deref_out_bcount(Length) PVOID *Buffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcSetDirtyPinnedData ( - __in PVOID BcbVoid, - __in_opt PLARGE_INTEGER Lsn - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcUnpinData ( - __in PVOID Bcb - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcSetBcbOwnerPointer ( - __in PVOID Bcb, - __in PVOID OwnerPointer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcUnpinDataForThread ( - __in PVOID Bcb, - __in ERESOURCE_THREAD ResourceThreadId - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -CcSetAdditionalCacheAttributes ( - __in PFILE_OBJECT FileObject, - __in BOOLEAN DisableReadAhead, - __in BOOLEAN DisableWriteBehind - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -VOID -CcSetParallelFlushFile ( - __in PFILE_OBJECT FileObject, - __in BOOLEAN EnableParallelFlush - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -VOID -CcSetLogHandleForFile ( - __in PFILE_OBJECT FileObject, - __in PVOID LogHandle, - __in PFLUSH_TO_LSN FlushToLsnRoutine - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -LARGE_INTEGER -CcGetDirtyPages ( - __in PVOID LogHandle, - __in PDIRTY_PAGE_ROUTINE DirtyPageRoutine, - __in PVOID Context1, - __in PVOID Context2 - ); -#endif // NTDDI_VERSION >= NTDDI_WINXP - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -CcIsThereDirtyData ( - __in PVPB Vpb - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -BOOLEAN -CcIsThereDirtyDataEx ( - __in PVPB Vpb, - __in_opt PULONG NumberOfDirtyPages - ); -#endif - -#ifndef __SSPI_H__ -#define __SSPI_H__ -#define ISSP_LEVEL 32 -#define ISSP_MODE 0 - -#if defined(_NO_KSECDD_IMPORT_) - -#define KSECDDDECLSPEC - -#else - -#define KSECDDDECLSPEC __declspec(dllimport) - -#endif - -typedef WCHAR SEC_WCHAR; -typedef CHAR SEC_CHAR; - -#ifndef __SECSTATUS_DEFINED__ -typedef LONG SECURITY_STATUS; -#define __SECSTATUS_DEFINED__ -#endif - -#define SEC_TEXT TEXT -#define SEC_FAR -#define SEC_ENTRY __stdcall - - -#ifndef __SECHANDLE_DEFINED__ -typedef struct _SecHandle -{ - ULONG_PTR dwLower ; - ULONG_PTR dwUpper ; -} SecHandle, * PSecHandle ; - -#define __SECHANDLE_DEFINED__ -#endif // __SECHANDLE_DEFINED__ - -#define SecInvalidateHandle( x ) \ - ((PSecHandle) (x))->dwLower = ((PSecHandle) (x))->dwUpper = ((ULONG_PTR) ((INT_PTR)-1)) ; - -#define SecIsValidHandle( x ) \ - ( ( ((PSecHandle) (x))->dwLower != ((ULONG_PTR) ((INT_PTR) -1 ))) && \ - ( ((PSecHandle) (x))->dwUpper != ((ULONG_PTR) ((INT_PTR) -1 ))) ) - -// -// pseudo handle value: the handle has already been deleted -// - -#define SEC_DELETED_HANDLE ((ULONG_PTR) (-2)) - -typedef SecHandle CredHandle; -typedef PSecHandle PCredHandle; - -typedef SecHandle CtxtHandle; -typedef PSecHandle PCtxtHandle; - -typedef LARGE_INTEGER _SECURITY_INTEGER, SECURITY_INTEGER, *PSECURITY_INTEGER; -typedef SECURITY_INTEGER TimeStamp; -typedef SECURITY_INTEGER * PTimeStamp; -typedef UNICODE_STRING SECURITY_STRING, *PSECURITY_STRING; - -// -// SecPkgInfo structure -// -// Provides general information about a security provider -// - -typedef struct _SecPkgInfoW -{ - unsigned long fCapabilities; // Capability bitmask - unsigned short wVersion; // Version of driver - unsigned short wRPCID; // ID for RPC Runtime - unsigned long cbMaxToken; // Size of authentication token (max) -#ifdef MIDL_PASS - [string] -#endif - SEC_WCHAR * Name; // Text name - -#ifdef MIDL_PASS - [string] -#endif - SEC_WCHAR * Comment; // Comment -} SecPkgInfoW, * PSecPkgInfoW; - -# define SecPkgInfo SecPkgInfoW -# define PSecPkgInfo PSecPkgInfoW - -// -// Security Package Capabilities -// -#define SECPKG_FLAG_INTEGRITY 0x00000001 // Supports integrity on messages -#define SECPKG_FLAG_PRIVACY 0x00000002 // Supports privacy (confidentiality) -#define SECPKG_FLAG_TOKEN_ONLY 0x00000004 // Only security token needed -#define SECPKG_FLAG_DATAGRAM 0x00000008 // Datagram RPC support -#define SECPKG_FLAG_CONNECTION 0x00000010 // Connection oriented RPC support -#define SECPKG_FLAG_MULTI_REQUIRED 0x00000020 // Full 3-leg required for re-auth. -#define SECPKG_FLAG_CLIENT_ONLY 0x00000040 // Server side functionality not available -#define SECPKG_FLAG_EXTENDED_ERROR 0x00000080 // Supports extended error msgs -#define SECPKG_FLAG_IMPERSONATION 0x00000100 // Supports impersonation -#define SECPKG_FLAG_ACCEPT_WIN32_NAME 0x00000200 // Accepts Win32 names -#define SECPKG_FLAG_STREAM 0x00000400 // Supports stream semantics -#define SECPKG_FLAG_NEGOTIABLE 0x00000800 // Can be used by the negotiate package -#define SECPKG_FLAG_GSS_COMPATIBLE 0x00001000 // GSS Compatibility Available -#define SECPKG_FLAG_LOGON 0x00002000 // Supports common LsaLogonUser -#define SECPKG_FLAG_ASCII_BUFFERS 0x00004000 // Token Buffers are in ASCII -#define SECPKG_FLAG_FRAGMENT 0x00008000 // Package can fragment to fit -#define SECPKG_FLAG_MUTUAL_AUTH 0x00010000 // Package can perform mutual authentication -#define SECPKG_FLAG_DELEGATION 0x00020000 // Package can delegate -#define SECPKG_FLAG_READONLY_WITH_CHECKSUM 0x00040000 // Package can delegate -#define SECPKG_FLAG_RESTRICTED_TOKENS 0x00080000 // Package supports restricted callers -#define SECPKG_FLAG_NEGO_EXTENDER 0x00100000 // this package extends SPNEGO, there is at most one -#define SECPKG_FLAG_NEGOTIABLE2 0x00200000 // this package is negotiated under the NegoExtender - -#define SECPKG_ID_NONE 0xFFFF - - -// -// SecBuffer -// -// Generic memory descriptors for buffers passed in to the security -// API -// - -typedef struct _SecBuffer { - unsigned long cbBuffer; // Size of the buffer, in bytes - unsigned long BufferType; // Type of the buffer (below) -#ifdef MIDL_PASS - [size_is(cbBuffer)] char * pvBuffer; // Pointer to the buffer -#else - __field_bcount(cbBuffer) void SEC_FAR * pvBuffer; // Pointer to the buffer -#endif -} SecBuffer, * PSecBuffer; - -typedef struct _SecBufferDesc { - unsigned long ulVersion; // Version number - unsigned long cBuffers; // Number of buffers -#ifdef MIDL_PASS - [size_is(cBuffers)] -#endif - __field_ecount(cBuffers) PSecBuffer pBuffers; // Pointer to array of buffers -} SecBufferDesc, SEC_FAR * PSecBufferDesc; - -#define SECBUFFER_VERSION 0 - -#define SECBUFFER_EMPTY 0 // Undefined, replaced by provider -#define SECBUFFER_DATA 1 // Packet data -#define SECBUFFER_TOKEN 2 // Security token -#define SECBUFFER_PKG_PARAMS 3 // Package specific parameters -#define SECBUFFER_MISSING 4 // Missing Data indicator -#define SECBUFFER_EXTRA 5 // Extra data -#define SECBUFFER_STREAM_TRAILER 6 // Security Trailer -#define SECBUFFER_STREAM_HEADER 7 // Security Header -#define SECBUFFER_NEGOTIATION_INFO 8 // Hints from the negotiation pkg -#define SECBUFFER_PADDING 9 // non-data padding -#define SECBUFFER_STREAM 10 // whole encrypted message -#define SECBUFFER_MECHLIST 11 -#define SECBUFFER_MECHLIST_SIGNATURE 12 -#define SECBUFFER_TARGET 13 // obsolete -#define SECBUFFER_CHANNEL_BINDINGS 14 -#define SECBUFFER_CHANGE_PASS_RESPONSE 15 -#define SECBUFFER_TARGET_HOST 16 -#define SECBUFFER_ALERT 17 - -#define SECBUFFER_ATTRMASK 0xF0000000 -#define SECBUFFER_READONLY 0x80000000 // Buffer is read-only, no checksum -#define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000 // Buffer is read-only, and checksummed -#define SECBUFFER_RESERVED 0x60000000 // Flags reserved to security system - - -typedef struct _SEC_NEGOTIATION_INFO { - unsigned long Size; // Size of this structure - unsigned long NameLength; // Length of name hint - SEC_WCHAR * Name; // Name hint - void * Reserved; // Reserved -} SEC_NEGOTIATION_INFO, * PSEC_NEGOTIATION_INFO ; - -typedef struct _SEC_CHANNEL_BINDINGS { - unsigned long dwInitiatorAddrType; - unsigned long cbInitiatorLength; - unsigned long dwInitiatorOffset; - unsigned long dwAcceptorAddrType; - unsigned long cbAcceptorLength; - unsigned long dwAcceptorOffset; - unsigned long cbApplicationDataLength; - unsigned long dwApplicationDataOffset; -} SEC_CHANNEL_BINDINGS, * PSEC_CHANNEL_BINDINGS ; - - -// -// Data Representation Constant: -// -#define SECURITY_NATIVE_DREP 0x00000010 -#define SECURITY_NETWORK_DREP 0x00000000 - -// -// Credential Use Flags -// -#define SECPKG_CRED_INBOUND 0x00000001 -#define SECPKG_CRED_OUTBOUND 0x00000002 -#define SECPKG_CRED_BOTH 0x00000003 -#define SECPKG_CRED_DEFAULT 0x00000004 -#define SECPKG_CRED_RESERVED 0xF0000000 - -// -// SSP SHOULD prompt the user for credentials/consent, independent -// of whether credentials to be used are the 'logged on' credentials -// or retrieved from credman. -// -// An SSP may choose not to prompt, however, in circumstances determined -// by the SSP. -// - -#define SECPKG_CRED_AUTOLOGON_RESTRICTED 0x00000010 - -// -// auth will always fail, ISC() is called to process policy data only -// - -#define SECPKG_CRED_PROCESS_POLICY_ONLY 0x00000020 - -// -// InitializeSecurityContext Requirement and return flags: -// - -#define ISC_REQ_DELEGATE 0x00000001 -#define ISC_REQ_MUTUAL_AUTH 0x00000002 -#define ISC_REQ_REPLAY_DETECT 0x00000004 -#define ISC_REQ_SEQUENCE_DETECT 0x00000008 -#define ISC_REQ_CONFIDENTIALITY 0x00000010 -#define ISC_REQ_USE_SESSION_KEY 0x00000020 -#define ISC_REQ_PROMPT_FOR_CREDS 0x00000040 -#define ISC_REQ_USE_SUPPLIED_CREDS 0x00000080 -#define ISC_REQ_ALLOCATE_MEMORY 0x00000100 -#define ISC_REQ_USE_DCE_STYLE 0x00000200 -#define ISC_REQ_DATAGRAM 0x00000400 -#define ISC_REQ_CONNECTION 0x00000800 -#define ISC_REQ_CALL_LEVEL 0x00001000 -#define ISC_REQ_FRAGMENT_SUPPLIED 0x00002000 -#define ISC_REQ_EXTENDED_ERROR 0x00004000 -#define ISC_REQ_STREAM 0x00008000 -#define ISC_REQ_INTEGRITY 0x00010000 -#define ISC_REQ_IDENTIFY 0x00020000 -#define ISC_REQ_NULL_SESSION 0x00040000 -#define ISC_REQ_MANUAL_CRED_VALIDATION 0x00080000 -#define ISC_REQ_RESERVED1 0x00100000 -#define ISC_REQ_FRAGMENT_TO_FIT 0x00200000 -// This exists only in Windows Vista and greater -#define ISC_REQ_FORWARD_CREDENTIALS 0x00400000 -#define ISC_REQ_NO_INTEGRITY 0x00800000 // honored only by SPNEGO -#define ISC_REQ_USE_HTTP_STYLE 0x01000000 - -#define ISC_RET_DELEGATE 0x00000001 -#define ISC_RET_MUTUAL_AUTH 0x00000002 -#define ISC_RET_REPLAY_DETECT 0x00000004 -#define ISC_RET_SEQUENCE_DETECT 0x00000008 -#define ISC_RET_CONFIDENTIALITY 0x00000010 -#define ISC_RET_USE_SESSION_KEY 0x00000020 -#define ISC_RET_USED_COLLECTED_CREDS 0x00000040 -#define ISC_RET_USED_SUPPLIED_CREDS 0x00000080 -#define ISC_RET_ALLOCATED_MEMORY 0x00000100 -#define ISC_RET_USED_DCE_STYLE 0x00000200 -#define ISC_RET_DATAGRAM 0x00000400 -#define ISC_RET_CONNECTION 0x00000800 -#define ISC_RET_INTERMEDIATE_RETURN 0x00001000 -#define ISC_RET_CALL_LEVEL 0x00002000 -#define ISC_RET_EXTENDED_ERROR 0x00004000 -#define ISC_RET_STREAM 0x00008000 -#define ISC_RET_INTEGRITY 0x00010000 -#define ISC_RET_IDENTIFY 0x00020000 -#define ISC_RET_NULL_SESSION 0x00040000 -#define ISC_RET_MANUAL_CRED_VALIDATION 0x00080000 -#define ISC_RET_RESERVED1 0x00100000 -#define ISC_RET_FRAGMENT_ONLY 0x00200000 -// This exists only in Windows Vista and greater -#define ISC_RET_FORWARD_CREDENTIALS 0x00400000 - -#define ISC_RET_USED_HTTP_STYLE 0x01000000 -#define ISC_RET_NO_ADDITIONAL_TOKEN 0x02000000 // *INTERNAL* -#define ISC_RET_REAUTHENTICATION 0x08000000 // *INTERNAL* - -#define ASC_REQ_DELEGATE 0x00000001 -#define ASC_REQ_MUTUAL_AUTH 0x00000002 -#define ASC_REQ_REPLAY_DETECT 0x00000004 -#define ASC_REQ_SEQUENCE_DETECT 0x00000008 -#define ASC_REQ_CONFIDENTIALITY 0x00000010 -#define ASC_REQ_USE_SESSION_KEY 0x00000020 -#define ASC_REQ_ALLOCATE_MEMORY 0x00000100 -#define ASC_REQ_USE_DCE_STYLE 0x00000200 -#define ASC_REQ_DATAGRAM 0x00000400 -#define ASC_REQ_CONNECTION 0x00000800 -#define ASC_REQ_CALL_LEVEL 0x00001000 -#define ASC_REQ_EXTENDED_ERROR 0x00008000 -#define ASC_REQ_STREAM 0x00010000 -#define ASC_REQ_INTEGRITY 0x00020000 -#define ASC_REQ_LICENSING 0x00040000 -#define ASC_REQ_IDENTIFY 0x00080000 -#define ASC_REQ_ALLOW_NULL_SESSION 0x00100000 -#define ASC_REQ_ALLOW_NON_USER_LOGONS 0x00200000 -#define ASC_REQ_ALLOW_CONTEXT_REPLAY 0x00400000 -#define ASC_REQ_FRAGMENT_TO_FIT 0x00800000 -#define ASC_REQ_FRAGMENT_SUPPLIED 0x00002000 -#define ASC_REQ_NO_TOKEN 0x01000000 -#define ASC_REQ_PROXY_BINDINGS 0x04000000 -// SSP_RET_REAUTHENTICATION 0x08000000 // *INTERNAL* -#define ASC_REQ_ALLOW_MISSING_BINDINGS 0x10000000 - -#define ASC_RET_DELEGATE 0x00000001 -#define ASC_RET_MUTUAL_AUTH 0x00000002 -#define ASC_RET_REPLAY_DETECT 0x00000004 -#define ASC_RET_SEQUENCE_DETECT 0x00000008 -#define ASC_RET_CONFIDENTIALITY 0x00000010 -#define ASC_RET_USE_SESSION_KEY 0x00000020 -#define ASC_RET_ALLOCATED_MEMORY 0x00000100 -#define ASC_RET_USED_DCE_STYLE 0x00000200 -#define ASC_RET_DATAGRAM 0x00000400 -#define ASC_RET_CONNECTION 0x00000800 -#define ASC_RET_CALL_LEVEL 0x00002000 // skipped 1000 to be like ISC_ -#define ASC_RET_THIRD_LEG_FAILED 0x00004000 -#define ASC_RET_EXTENDED_ERROR 0x00008000 -#define ASC_RET_STREAM 0x00010000 -#define ASC_RET_INTEGRITY 0x00020000 -#define ASC_RET_LICENSING 0x00040000 -#define ASC_RET_IDENTIFY 0x00080000 -#define ASC_RET_NULL_SESSION 0x00100000 -#define ASC_RET_ALLOW_NON_USER_LOGONS 0x00200000 -#define ASC_RET_ALLOW_CONTEXT_REPLAY 0x00400000 // deprecated - don't use this flag!!! -#define ASC_RET_FRAGMENT_ONLY 0x00800000 -#define ASC_RET_NO_TOKEN 0x01000000 -#define ASC_RET_NO_ADDITIONAL_TOKEN 0x02000000 // *INTERNAL* -#define ASC_RET_NO_PROXY_BINDINGS 0x04000000 -// SSP_RET_REAUTHENTICATION 0x08000000 // *INTERNAL* -#define ASC_RET_MISSING_BINDINGS 0x10000000 - -// -// Security Credentials Attributes: -// - -#define SECPKG_CRED_ATTR_NAMES 1 -#define SECPKG_CRED_ATTR_SSI_PROVIDER 2 - -typedef struct _SecPkgCredentials_NamesW -{ -#ifdef MIDL_PASS - [string] -#endif - SEC_WCHAR * sUserName; - -} SecPkgCredentials_NamesW, * PSecPkgCredentials_NamesW; - -# define SecPkgCredentials_Names SecPkgCredentials_NamesW -# define PSecPkgCredentials_Names PSecPkgCredentials_NamesW - -#if NTDDI_VERSION > NTDDI_WS03 -typedef struct _SecPkgCredentials_SSIProviderW -{ - SEC_WCHAR * sProviderName; - unsigned long ProviderInfoLength; - char * ProviderInfo; -} SecPkgCredentials_SSIProviderW, * PSecPkgCredentials_SSIProviderW; -#endif // End W2k3SP1 and greater -# define SecPkgCredentials_SSIProvider SecPkgCredentials_SSIProviderW -# define PSecPkgCredentials_SSIProvider PSecPkgCredentials_SSIProviderW - -// -// Security Context Attributes: -// - -#define SECPKG_ATTR_SIZES 0 -#define SECPKG_ATTR_NAMES 1 -#define SECPKG_ATTR_LIFESPAN 2 -#define SECPKG_ATTR_DCE_INFO 3 -#define SECPKG_ATTR_STREAM_SIZES 4 -#define SECPKG_ATTR_KEY_INFO 5 -#define SECPKG_ATTR_AUTHORITY 6 -#define SECPKG_ATTR_PROTO_INFO 7 -#define SECPKG_ATTR_PASSWORD_EXPIRY 8 -#define SECPKG_ATTR_SESSION_KEY 9 -#define SECPKG_ATTR_PACKAGE_INFO 10 -#define SECPKG_ATTR_USER_FLAGS 11 -#define SECPKG_ATTR_NEGOTIATION_INFO 12 -#define SECPKG_ATTR_NATIVE_NAMES 13 -#define SECPKG_ATTR_FLAGS 14 -// These attributes exist only in Win XP and greater -#define SECPKG_ATTR_USE_VALIDATED 15 -#define SECPKG_ATTR_CREDENTIAL_NAME 16 -#define SECPKG_ATTR_TARGET_INFORMATION 17 -#define SECPKG_ATTR_ACCESS_TOKEN 18 -// These attributes exist only in Win2K3 and greater -#define SECPKG_ATTR_TARGET 19 -#define SECPKG_ATTR_AUTHENTICATION_ID 20 -// These attributes exist only in Win2K3SP1 and greater -#define SECPKG_ATTR_LOGOFF_TIME 21 -// -// win7 or greater -// -#define SECPKG_ATTR_NEGO_KEYS 22 -#define SECPKG_ATTR_PROMPTING_NEEDED 24 -#define SECPKG_ATTR_UNIQUE_BINDINGS 25 -#define SECPKG_ATTR_ENDPOINT_BINDINGS 26 -#define SECPKG_ATTR_CLIENT_SPECIFIED_TARGET 27 - -#define SECPKG_ATTR_LAST_CLIENT_TOKEN_STATUS 30 -#define SECPKG_ATTR_NEGO_PKG_INFO 31 // contains nego info of packages -#define SECPKG_ATTR_NEGO_STATUS 32 // contains the last error -#define SECPKG_ATTR_CONTEXT_DELETED 33 // a context has been deleted - -#define SECPKG_ATTR_SUBJECT_SECURITY_ATTRIBUTES 128 - -typedef struct _SecPkgContext_SubjectAttributes { - void* AttributeInfo; // contains a PAUTHZ_SECURITY_ATTRIBUTES_INFORMATION structure -} SecPkgContext_SubjectAttributes, *PSecPkgContext_SubjectAttributes; - -#define SECPKG_ATTR_NEGO_INFO_FLAG_NO_KERBEROS 0x1 -#define SECPKG_ATTR_NEGO_INFO_FLAG_NO_NTLM 0x2 - -// -// types of credentials, used by SECPKG_ATTR_PROMPTING_NEEDED -// - -typedef enum _SECPKG_CRED_CLASS { - SecPkgCredClass_None = 0, // no creds - SecPkgCredClass_Ephemeral = 10, // logon creds - SecPkgCredClass_PersistedGeneric = 20, // saved creds, not target specific - SecPkgCredClass_PersistedSpecific = 30, // saved creds, target specific - SecPkgCredClass_Explicit = 40, // explicitly supplied creds -} SECPKG_CRED_CLASS, * PSECPKG_CRED_CLASS; - -typedef struct _SecPkgContext_CredInfo { - SECPKG_CRED_CLASS CredClass; - unsigned long IsPromptingNeeded; -} SecPkgContext_CredInfo, *PSecPkgContext_CredInfo; - -typedef struct _SecPkgContext_NegoPackageInfo -{ - unsigned long PackageMask; -} SecPkgContext_NegoPackageInfo, * PSecPkgContext_NegoPackageInfo; - -typedef struct _SecPkgContext_NegoStatus -{ - unsigned long LastStatus; -} SecPkgContext_NegoStatus, * PSecPkgContext_NegoStatus; - -typedef struct _SecPkgContext_Sizes -{ - unsigned long cbMaxToken; - unsigned long cbMaxSignature; - unsigned long cbBlockSize; - unsigned long cbSecurityTrailer; -} SecPkgContext_Sizes, * PSecPkgContext_Sizes; - -typedef struct _SecPkgContext_StreamSizes -{ - unsigned long cbHeader; - unsigned long cbTrailer; - unsigned long cbMaximumMessage; - unsigned long cBuffers; - unsigned long cbBlockSize; -} SecPkgContext_StreamSizes, * PSecPkgContext_StreamSizes; - -typedef struct _SecPkgContext_NamesW -{ - SEC_WCHAR * sUserName; -} SecPkgContext_NamesW, * PSecPkgContext_NamesW; - -# define SecPkgContext_Names SecPkgContext_NamesW -# define PSecPkgContext_Names PSecPkgContext_NamesW - -typedef struct _SecPkgContext_Lifespan -{ - TimeStamp tsStart; - TimeStamp tsExpiry; -} SecPkgContext_Lifespan, * PSecPkgContext_Lifespan; - -typedef struct _SecPkgContext_DceInfo -{ - unsigned long AuthzSvc; - void * pPac; -} SecPkgContext_DceInfo, * PSecPkgContext_DceInfo; - - -typedef struct _SecPkgContext_KeyInfoW -{ - SEC_WCHAR * sSignatureAlgorithmName; - SEC_WCHAR * sEncryptAlgorithmName; - unsigned long KeySize; - unsigned long SignatureAlgorithm; - unsigned long EncryptAlgorithm; -} SecPkgContext_KeyInfoW, * PSecPkgContext_KeyInfoW; - -#define SecPkgContext_KeyInfo SecPkgContext_KeyInfoW -#define PSecPkgContext_KeyInfo PSecPkgContext_KeyInfoW - -typedef struct _SecPkgContext_AuthorityW -{ - SEC_WCHAR * sAuthorityName; -} SecPkgContext_AuthorityW, * PSecPkgContext_AuthorityW; - -#define SecPkgContext_Authority SecPkgContext_AuthorityW -#define PSecPkgContext_Authority PSecPkgContext_AuthorityW - -typedef struct _SecPkgContext_ProtoInfoW -{ - SEC_WCHAR * sProtocolName; - unsigned long majorVersion; - unsigned long minorVersion; -} SecPkgContext_ProtoInfoW, * PSecPkgContext_ProtoInfoW; - -#define SecPkgContext_ProtoInfo SecPkgContext_ProtoInfoW -#define PSecPkgContext_ProtoInfo PSecPkgContext_ProtoInfoW - -typedef struct _SecPkgContext_PasswordExpiry -{ - TimeStamp tsPasswordExpires; -} SecPkgContext_PasswordExpiry, * PSecPkgContext_PasswordExpiry; - -#if NTDDI_VERSION > NTDDI_WS03 -typedef struct _SecPkgContext_LogoffTime -{ - TimeStamp tsLogoffTime; -} SecPkgContext_LogoffTime, * PSecPkgContext_LogoffTime; -#endif // Greater than Windows Server 2003 RTM (SP1 and greater contains this) - -typedef struct _SecPkgContext_SessionKey -{ - unsigned long SessionKeyLength; - __field_bcount(SessionKeyLength) unsigned char * SessionKey; -} SecPkgContext_SessionKey, *PSecPkgContext_SessionKey; - -// used by nego2 -typedef struct _SecPkgContext_NegoKeys -{ - unsigned long KeyType; - unsigned short KeyLength; - __field_bcount(KeyLength) unsigned char* KeyValue; - unsigned long VerifyKeyType; - unsigned short VerifyKeyLength; - __field_bcount(VerifyKeyLength) unsigned char* VerifyKeyValue; -} SecPkgContext_NegoKeys, * PSecPkgContext_NegoKeys; - -typedef struct _SecPkgContext_PackageInfoW -{ - PSecPkgInfoW PackageInfo; -} SecPkgContext_PackageInfoW, * PSecPkgContext_PackageInfoW; - - -typedef struct _SecPkgContext_UserFlags -{ - unsigned long UserFlags; -} SecPkgContext_UserFlags, * PSecPkgContext_UserFlags; - -typedef struct _SecPkgContext_Flags -{ - unsigned long Flags; -} SecPkgContext_Flags, * PSecPkgContext_Flags; - -#define SecPkgContext_PackageInfo SecPkgContext_PackageInfoW -#define PSecPkgContext_PackageInfo PSecPkgContext_PackageInfoW -typedef struct _SecPkgContext_NegotiationInfoW -{ - PSecPkgInfoW PackageInfo ; - unsigned long NegotiationState ; -} SecPkgContext_NegotiationInfoW, * PSecPkgContext_NegotiationInfoW ; - -# define SecPkgContext_NativeNames SecPkgContext_NativeNamesW -# define PSecPkgContext_NativeNames PSecPkgContext_NativeNamesW - -#if OSVER(NTDDI_VERSION) > NTDDI_WIN2K - -typedef struct _SecPkgContext_CredentialNameW -{ - unsigned long CredentialType; - SEC_WCHAR *sCredentialName; -} SecPkgContext_CredentialNameW, * PSecPkgContext_CredentialNameW; - -#endif // Later than win2k -# define SecPkgContext_CredentialName SecPkgContext_CredentialNameW -# define PSecPkgContext_CredentialName PSecPkgContext_CredentialNameW - -typedef void -(SEC_ENTRY * SEC_GET_KEY_FN) ( - void * Arg, // Argument passed in - void * Principal, // Principal ID - unsigned long KeyVer, // Key Version - void * * Key, // Returned ptr to key - SECURITY_STATUS * Status // returned status - ); - -// -// Flags for ExportSecurityContext -// - -#define SECPKG_CONTEXT_EXPORT_RESET_NEW 0x00000001 // New context is reset to initial state -#define SECPKG_CONTEXT_EXPORT_DELETE_OLD 0x00000002 // Old context is deleted during export -// This is only valid in W2K3SP1 and greater -#define SECPKG_CONTEXT_EXPORT_TO_KERNEL 0x00000004 // Context is to be transferred to the kernel - - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -AcquireCredentialsHandleW( -#if ISSP_MODE == 0 // For Kernel mode - __in_opt PSECURITY_STRING pPrincipal, - __in PSECURITY_STRING pPackage, -#else - __in_opt LPWSTR pszPrincipal, // Name of principal - __in LPWSTR pszPackage, // Name of package -#endif - __in unsigned long fCredentialUse, // Flags indicating use - __in_opt void * pvLogonId, // Pointer to logon ID - __in_opt void * pAuthData, // Package specific data - __in_opt SEC_GET_KEY_FN pGetKeyFn, // Pointer to GetKey() func - __in_opt void * pvGetKeyArgument, // Value to pass to GetKey() - __out PCredHandle phCredential, // (out) Cred Handle - __out_opt PTimeStamp ptsExpiry // (out) Lifetime (optional) - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * ACQUIRE_CREDENTIALS_HANDLE_FN_W)( -#if ISSP_MODE == 0 - PSECURITY_STRING, - PSECURITY_STRING, -#else - SEC_WCHAR *, - SEC_WCHAR *, -#endif - unsigned long, - void *, - void *, - SEC_GET_KEY_FN, - void *, - PCredHandle, - PTimeStamp); - -# define AcquireCredentialsHandle AcquireCredentialsHandleW -# define ACQUIRE_CREDENTIALS_HANDLE_FN ACQUIRE_CREDENTIALS_HANDLE_FN_W - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -FreeCredentialsHandle( - __in PCredHandle phCredential // Handle to free - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * FREE_CREDENTIALS_HANDLE_FN)( - PCredHandle ); - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -AddCredentialsW( - __in PCredHandle hCredentials, -#if ISSP_MODE == 0 // For Kernel mode - __in_opt PSECURITY_STRING pPrincipal, - __in PSECURITY_STRING pPackage, -#else - __in_opt LPWSTR pszPrincipal, // Name of principal - __in LPWSTR pszPackage, // Name of package -#endif - __in unsigned long fCredentialUse, // Flags indicating use - __in_opt void * pAuthData, // Package specific data - __in_opt SEC_GET_KEY_FN pGetKeyFn, // Pointer to GetKey() func - __in_opt void * pvGetKeyArgument, // Value to pass to GetKey() - __out_opt PTimeStamp ptsExpiry // (out) Lifetime (optional) - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * ADD_CREDENTIALS_FN_W)( - PCredHandle, -#if ISSP_MODE == 0 - PSECURITY_STRING, - PSECURITY_STRING, -#else - SEC_WCHAR *, - SEC_WCHAR *, -#endif - unsigned long, - void *, - SEC_GET_KEY_FN, - void *, - PTimeStamp); - -SECURITY_STATUS SEC_ENTRY -AddCredentialsA( - __in PCredHandle hCredentials, - __in_opt LPSTR pszPrincipal, // Name of principal - __in LPSTR pszPackage, // Name of package - __in unsigned long fCredentialUse, // Flags indicating use - __in_opt void * pAuthData, // Package specific data - __in_opt SEC_GET_KEY_FN pGetKeyFn, // Pointer to GetKey() func - __in_opt void * pvGetKeyArgument, // Value to pass to GetKey() - __out_opt PTimeStamp ptsExpiry // (out) Lifetime (optional) - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * ADD_CREDENTIALS_FN_A)( - PCredHandle, - SEC_CHAR *, - SEC_CHAR *, - unsigned long, - void *, - SEC_GET_KEY_FN, - void *, - PTimeStamp); - -#ifdef UNICODE -#define AddCredentials AddCredentialsW -#define ADD_CREDENTIALS_FN ADD_CREDENTIALS_FN_W -#else -#define AddCredentials AddCredentialsA -#define ADD_CREDENTIALS_FN ADD_CREDENTIALS_FN_A -#endif - -//////////////////////////////////////////////////////////////////////// -/// -/// Password Change Functions -/// -//////////////////////////////////////////////////////////////////////// - -#if ISSP_MODE != 0 - -SECURITY_STATUS SEC_ENTRY -ChangeAccountPasswordW( - __in SEC_WCHAR * pszPackageName, - __in SEC_WCHAR * pszDomainName, - __in SEC_WCHAR * pszAccountName, - __in SEC_WCHAR * pszOldPassword, - __in SEC_WCHAR * pszNewPassword, - __in BOOLEAN bImpersonating, - __in unsigned long dwReserved, - __inout PSecBufferDesc pOutput - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * CHANGE_PASSWORD_FN_W)( - SEC_WCHAR *, - SEC_WCHAR *, - SEC_WCHAR *, - SEC_WCHAR *, - SEC_WCHAR *, - BOOLEAN, - unsigned long, - PSecBufferDesc - ); - - - -SECURITY_STATUS SEC_ENTRY -ChangeAccountPasswordA( - __in SEC_CHAR * pszPackageName, - __in SEC_CHAR * pszDomainName, - __in SEC_CHAR * pszAccountName, - __in SEC_CHAR * pszOldPassword, - __in SEC_CHAR * pszNewPassword, - __in BOOLEAN bImpersonating, - __in unsigned long dwReserved, - __inout PSecBufferDesc pOutput - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * CHANGE_PASSWORD_FN_A)( - SEC_CHAR *, - SEC_CHAR *, - SEC_CHAR *, - SEC_CHAR *, - SEC_CHAR *, - BOOLEAN, - unsigned long, - PSecBufferDesc - ); - -#ifdef UNICODE -# define ChangeAccountPassword ChangeAccountPasswordW -# define CHANGE_PASSWORD_FN CHANGE_PASSWORD_FN_W -#else -# define ChangeAccountPassword ChangeAccountPasswordA -# define CHANGE_PASSWORD_FN CHANGE_PASSWORD_FN_A -#endif // !UNICODE - -#endif // ISSP_MODE - - -//////////////////////////////////////////////////////////////////////// -/// -/// Context Management Functions -/// -//////////////////////////////////////////////////////////////////////// - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -InitializeSecurityContextW( - __in_opt PCredHandle phCredential, // Cred to base context - __in_opt PCtxtHandle phContext, // Existing context (OPT) -#if ISSP_MODE == 0 - __in_opt PSECURITY_STRING pTargetName, -#else - __in_opt SEC_WCHAR * pszTargetName, // Name of target -#endif - __in unsigned long fContextReq, // Context Requirements - __in unsigned long Reserved1, // Reserved, MBZ - __in unsigned long TargetDataRep, // Data rep of target - __in_opt PSecBufferDesc pInput, // Input Buffers - __in unsigned long Reserved2, // Reserved, MBZ - __inout_opt PCtxtHandle phNewContext, // (out) New Context handle - __inout_opt PSecBufferDesc pOutput, // (inout) Output Buffers - __out unsigned long * pfContextAttr, // (out) Context attrs - __out_opt PTimeStamp ptsExpiry // (out) Life span (OPT) - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * INITIALIZE_SECURITY_CONTEXT_FN_W)( - PCredHandle, - PCtxtHandle, -#if ISSP_MODE == 0 - PSECURITY_STRING, -#else - SEC_WCHAR *, -#endif - unsigned long, - unsigned long, - unsigned long, - PSecBufferDesc, - unsigned long, - PCtxtHandle, - PSecBufferDesc, - unsigned long *, - PTimeStamp); - -# define InitializeSecurityContext InitializeSecurityContextW -# define INITIALIZE_SECURITY_CONTEXT_FN INITIALIZE_SECURITY_CONTEXT_FN_W - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -AcceptSecurityContext( - __in_opt PCredHandle phCredential, // Cred to base context - __in_opt PCtxtHandle phContext, // Existing context (OPT) - __in_opt PSecBufferDesc pInput, // Input buffer - __in unsigned long fContextReq, // Context Requirements - __in unsigned long TargetDataRep, // Target Data Rep - __in_opt PCtxtHandle phNewContext, // (out) New context handle - __in_opt PSecBufferDesc pOutput, // (inout) Output buffers - __out unsigned long * pfContextAttr, // (out) Context attributes - __out_opt PTimeStamp ptsExpiry // (out) Life span (OPT) - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * ACCEPT_SECURITY_CONTEXT_FN)( - PCredHandle, - PCtxtHandle, - PSecBufferDesc, - unsigned long, - unsigned long, - PCtxtHandle, - PSecBufferDesc, - unsigned long *, - PTimeStamp); - - - -SECURITY_STATUS SEC_ENTRY -CompleteAuthToken( - __in PCtxtHandle phContext, // Context to complete - __in PSecBufferDesc pToken // Token to complete - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * COMPLETE_AUTH_TOKEN_FN)( - PCtxtHandle, - PSecBufferDesc); - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -ImpersonateSecurityContext( - __in PCtxtHandle phContext // Context to impersonate - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * IMPERSONATE_SECURITY_CONTEXT_FN)( - PCtxtHandle); - - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -RevertSecurityContext( - __in PCtxtHandle phContext // Context from which to re - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * REVERT_SECURITY_CONTEXT_FN)( - PCtxtHandle); - - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -QuerySecurityContextToken( - __in PCtxtHandle phContext, - __out void * * Token - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * QUERY_SECURITY_CONTEXT_TOKEN_FN)( - PCtxtHandle, void * *); - - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -DeleteSecurityContext( - __in PCtxtHandle phContext // Context to delete - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * DELETE_SECURITY_CONTEXT_FN)( - PCtxtHandle); - - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -ApplyControlToken( - __in PCtxtHandle phContext, // Context to modify - __in PSecBufferDesc pInput // Input token to apply - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * APPLY_CONTROL_TOKEN_FN)( - PCtxtHandle, PSecBufferDesc); - - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -QueryContextAttributesW( - __in PCtxtHandle phContext, // Context to query - __in unsigned long ulAttribute, // Attribute to query - __out void * pBuffer // Buffer for attributes - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * QUERY_CONTEXT_ATTRIBUTES_FN_W)( - PCtxtHandle, - unsigned long, - void *); - -# define QueryContextAttributes QueryContextAttributesW -# define QUERY_CONTEXT_ATTRIBUTES_FN QUERY_CONTEXT_ATTRIBUTES_FN_W - -#if (OSVER(NTDDI_VERSION) > NTDDI_WIN2K) - -SECURITY_STATUS SEC_ENTRY -SetContextAttributesW( - __in PCtxtHandle phContext, // Context to Set - __in unsigned long ulAttribute, // Attribute to Set - __in_bcount(cbBuffer) void * pBuffer, // Buffer for attributes - __in unsigned long cbBuffer // Size (in bytes) of Buffer - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * SET_CONTEXT_ATTRIBUTES_FN_W)( - PCtxtHandle, - unsigned long, - void *, - unsigned long ); - -#endif // Greater than w2k - -# define SetContextAttributes SetContextAttributesW -# define SET_CONTEXT_ATTRIBUTES_FN SET_CONTEXT_ATTRIBUTES_FN_W - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -QueryCredentialsAttributesW( - __in PCredHandle phCredential, // Credential to query - __in unsigned long ulAttribute, // Attribute to query - __inout void * pBuffer // Buffer for attributes - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * QUERY_CREDENTIALS_ATTRIBUTES_FN_W)( - PCredHandle, - unsigned long, - void *); - -# define QueryCredentialsAttributes QueryCredentialsAttributesW -# define QUERY_CREDENTIALS_ATTRIBUTES_FN QUERY_CREDENTIALS_ATTRIBUTES_FN_W - -#if NTDDI_VERSION > NTDDI_WS03 - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -SetCredentialsAttributesW( - __in PCredHandle phCredential, // Credential to Set - __in unsigned long ulAttribute, // Attribute to Set - __in_bcount(cbBuffer) void * pBuffer, // Buffer for attributes - __in unsigned long cbBuffer // Size (in bytes) of Buffer - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * SET_CREDENTIALS_ATTRIBUTES_FN_W)( - PCredHandle, - unsigned long, - void *, - unsigned long ); - -#endif // For W2k3SP1 and greater - -# define SetCredentialsAttributes SetCredentialsAttributesW -# define SET_CREDENTIALS_ATTRIBUTES_FN SET_CREDENTIALS_ATTRIBUTES_FN_W - -SECURITY_STATUS SEC_ENTRY -FreeContextBuffer( - __inout PVOID pvContextBuffer // buffer to free - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * FREE_CONTEXT_BUFFER_FN)( - __inout PVOID - ); - -/////////////////////////////////////////////////////////////////// -//// -//// Message Support API -//// -////////////////////////////////////////////////////////////////// - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -MakeSignature( - __in PCtxtHandle phContext, // Context to use - __in unsigned long fQOP, // Quality of Protection - __in PSecBufferDesc pMessage, // Message to sign - __in unsigned long MessageSeqNo // Message Sequence Num. - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * MAKE_SIGNATURE_FN)( - PCtxtHandle, - unsigned long, - PSecBufferDesc, - unsigned long); - - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -VerifySignature( - __in PCtxtHandle phContext, // Context to use - __in PSecBufferDesc pMessage, // Message to verify - __in unsigned long MessageSeqNo, // Sequence Num. - __out unsigned long * pfQOP // QOP used - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * VERIFY_SIGNATURE_FN)( - PCtxtHandle, - PSecBufferDesc, - unsigned long, - unsigned long *); - -// This only exists win Win2k3 and Greater -#define SECQOP_WRAP_NO_ENCRYPT 0x80000001 -#define SECQOP_WRAP_OOB_DATA 0x40000000 - -SECURITY_STATUS SEC_ENTRY -EncryptMessage( __in PCtxtHandle phContext, - __in unsigned long fQOP, - __inout PSecBufferDesc pMessage, - __in unsigned long MessageSeqNo); - -typedef SECURITY_STATUS -(SEC_ENTRY * ENCRYPT_MESSAGE_FN)( - PCtxtHandle, unsigned long, PSecBufferDesc, unsigned long); - - -SECURITY_STATUS SEC_ENTRY -DecryptMessage( __in PCtxtHandle phContext, - __inout PSecBufferDesc pMessage, - __in unsigned long MessageSeqNo, - __out_opt unsigned long * pfQOP); - - -typedef SECURITY_STATUS -(SEC_ENTRY * DECRYPT_MESSAGE_FN)( - PCtxtHandle, PSecBufferDesc, unsigned long, - unsigned long *); - - -/////////////////////////////////////////////////////////////////////////// -//// -//// Misc. -//// -/////////////////////////////////////////////////////////////////////////// - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -EnumerateSecurityPackagesW( - __out unsigned long * pcPackages, // Receives num. packages - __deref_out PSecPkgInfoW * ppPackageInfo // Receives array of info - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * ENUMERATE_SECURITY_PACKAGES_FN_W)( - unsigned long *, - PSecPkgInfoW *); - -# define EnumerateSecurityPackages EnumerateSecurityPackagesW -# define ENUMERATE_SECURITY_PACKAGES_FN ENUMERATE_SECURITY_PACKAGES_FN_W - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -QuerySecurityPackageInfoW( -#if ISSP_MODE == 0 - __in PSECURITY_STRING pPackageName, -#else - __in LPWSTR pszPackageName, // Name of package -#endif - __deref_out PSecPkgInfoW *ppPackageInfo // Receives package info - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * QUERY_SECURITY_PACKAGE_INFO_FN_W)( -#if ISSP_MODE == 0 - PSECURITY_STRING, -#else - SEC_WCHAR *, -#endif - PSecPkgInfoW *); - -# define QuerySecurityPackageInfo QuerySecurityPackageInfoW -# define QUERY_SECURITY_PACKAGE_INFO_FN QUERY_SECURITY_PACKAGE_INFO_FN_W - -/////////////////////////////////////////////////////////////////////////// -//// -//// Context export/import -//// -/////////////////////////////////////////////////////////////////////////// - - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -ExportSecurityContext( - __in PCtxtHandle phContext, // (in) context to export - __in ULONG fFlags, // (in) option flags - __out PSecBuffer pPackedContext, // (out) marshalled context - __out void * * pToken // (out, optional) token handle for impersonation - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * EXPORT_SECURITY_CONTEXT_FN)( - PCtxtHandle, - ULONG, - PSecBuffer, - void * * - ); - -KSECDDDECLSPEC -SECURITY_STATUS SEC_ENTRY -ImportSecurityContextW( -#if ISSP_MODE == 0 - __in PSECURITY_STRING pszPackage, -#else - __in LPWSTR pszPackage, -#endif - __in PSecBuffer pPackedContext, // (in) marshalled context - __in void * Token, // (in, optional) handle to token for context - __out PCtxtHandle phContext // (out) new context handle - ); - -typedef SECURITY_STATUS -(SEC_ENTRY * IMPORT_SECURITY_CONTEXT_FN_W)( -#if ISSP_MODE == 0 - PSECURITY_STRING, -#else - SEC_WCHAR *, -#endif - PSecBuffer, - VOID *, - PCtxtHandle - ); - -# define ImportSecurityContext ImportSecurityContextW -# define IMPORT_SECURITY_CONTEXT_FN IMPORT_SECURITY_CONTEXT_FN_W - -#if ISSP_MODE == 0 -KSECDDDECLSPEC -NTSTATUS -NTAPI -SecMakeSPN( - IN PUNICODE_STRING ServiceClass, - IN PUNICODE_STRING ServiceName, - IN PUNICODE_STRING InstanceName OPTIONAL, - IN USHORT InstancePort OPTIONAL, - IN PUNICODE_STRING Referrer OPTIONAL, - IN OUT PUNICODE_STRING Spn, - OUT PULONG Length OPTIONAL, - IN BOOLEAN Allocate - ); - -#if OSVER(NTDDI_VERSION) > NTDD_WIN2K - -KSECDDDECLSPEC -NTSTATUS -NTAPI -SecMakeSPNEx( - IN PUNICODE_STRING ServiceClass, - IN PUNICODE_STRING ServiceName, - IN PUNICODE_STRING InstanceName OPTIONAL, - IN USHORT InstancePort OPTIONAL, - IN PUNICODE_STRING Referrer OPTIONAL, - IN PUNICODE_STRING TargetInfo OPTIONAL, - IN OUT PUNICODE_STRING Spn, - OUT PULONG Length OPTIONAL, - IN BOOLEAN Allocate - ); - -#if OSVER(NTDDI_VERSION) > NTDDI_WS03 - -KSECDDDECLSPEC -NTSTATUS -NTAPI -SecMakeSPNEx2( - IN PUNICODE_STRING ServiceClass, - IN PUNICODE_STRING ServiceName, - IN PUNICODE_STRING InstanceName OPTIONAL, - IN USHORT InstancePort OPTIONAL, - IN PUNICODE_STRING Referrer OPTIONAL, - IN PUNICODE_STRING InTargetInfo OPTIONAL, - IN OUT PUNICODE_STRING Spn, - OUT PULONG TotalSize OPTIONAL, - IN BOOLEAN Allocate, - IN BOOLEAN IsTargetInfoMarshaled - ); - -#endif // Windows Vista and greater - -KSECDDDECLSPEC -NTSTATUS -SEC_ENTRY -SecLookupAccountSid( - __in PSID Sid, - __out PULONG NameSize, - __inout PUNICODE_STRING NameBuffer, - __out PULONG DomainSize OPTIONAL, - __out_opt PUNICODE_STRING DomainBuffer OPTIONAL, - __out PSID_NAME_USE NameUse - ); - -KSECDDDECLSPEC -NTSTATUS -SEC_ENTRY -SecLookupAccountName( - __in PUNICODE_STRING Name, - __inout PULONG SidSize, - __out PSID Sid, - __out PSID_NAME_USE NameUse, - __out PULONG DomainSize OPTIONAL, - __inout_opt PUNICODE_STRING ReferencedDomain OPTIONAL - ); - -#endif // Greater than W2k - -#if OSVER(NTDDI_VERSION) > NTDDI_WINXP - -KSECDDDECLSPEC -NTSTATUS -SEC_ENTRY -SecLookupWellKnownSid( - __in WELL_KNOWN_SID_TYPE SidType, - __out PSID Sid, - __in ULONG SidBufferSize, - __inout_opt PULONG SidSize OPTIONAL - ); - -#endif // Greater than XP - - -#endif - -#define SECURITY_ENTRYPOINTW SEC_TEXT("InitSecurityInterfaceW") -# define SECURITY_ENTRYPOINT SECURITY_ENTRYPOINTW - -#define FreeCredentialHandle FreeCredentialsHandle - -typedef struct _SECURITY_FUNCTION_TABLE_W { - unsigned long dwVersion; - ENUMERATE_SECURITY_PACKAGES_FN_W EnumerateSecurityPackagesW; - QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW; - ACQUIRE_CREDENTIALS_HANDLE_FN_W AcquireCredentialsHandleW; - FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle; - void * Reserved2; - INITIALIZE_SECURITY_CONTEXT_FN_W InitializeSecurityContextW; - ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext; - COMPLETE_AUTH_TOKEN_FN CompleteAuthToken; - DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext; - APPLY_CONTROL_TOKEN_FN ApplyControlToken; - QUERY_CONTEXT_ATTRIBUTES_FN_W QueryContextAttributesW; - IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext; - REVERT_SECURITY_CONTEXT_FN RevertSecurityContext; - MAKE_SIGNATURE_FN MakeSignature; - VERIFY_SIGNATURE_FN VerifySignature; - FREE_CONTEXT_BUFFER_FN FreeContextBuffer; - QUERY_SECURITY_PACKAGE_INFO_FN_W QuerySecurityPackageInfoW; - void * Reserved3; - void * Reserved4; - EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext; - IMPORT_SECURITY_CONTEXT_FN_W ImportSecurityContextW; - ADD_CREDENTIALS_FN_W AddCredentialsW ; - void * Reserved8; - QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken; - ENCRYPT_MESSAGE_FN EncryptMessage; - DECRYPT_MESSAGE_FN DecryptMessage; -#if OSVER(NTDDI_VERSION) > NTDDI_WIN2K - // Fields below this are available in OSes after w2k - SET_CONTEXT_ATTRIBUTES_FN_W SetContextAttributesW; -#endif // greater thean 2K - -#if NTDDI_VERSION > NTDDI_WS03SP1 - // Fields below this are available in OSes after W2k3SP1 - SET_CREDENTIALS_ATTRIBUTES_FN_W SetCredentialsAttributesW; -#endif -#if ISSP_MODE != 0 - CHANGE_PASSWORD_FN_W ChangeAccountPasswordW; -#else - void * Reserved9; -#endif -} SecurityFunctionTableW, * PSecurityFunctionTableW; - -# define SecurityFunctionTable SecurityFunctionTableW -# define PSecurityFunctionTable PSecurityFunctionTableW -#define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION 1 -#define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 2 -#define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_3 3 -#define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_4 4 - -KSECDDDECLSPEC -PSecurityFunctionTableW SEC_ENTRY -InitSecurityInterfaceW( - void - ); - -typedef PSecurityFunctionTableW -(SEC_ENTRY * INIT_SECURITY_INTERFACE_W)(void); - -# define InitSecurityInterface InitSecurityInterfaceW -# define INIT_SECURITY_INTERFACE INIT_SECURITY_INTERFACE_W - -#ifndef _AUTH_IDENTITY_EX2_DEFINED -#define _AUTH_IDENTITY_EX2_DEFINED - -#define SEC_WINNT_AUTH_IDENTITY_VERSION_2 0x201 - -typedef struct _SEC_WINNT_AUTH_IDENTITY_EX2 { - unsigned long Version; // contains SEC_WINNT_AUTH_IDENTITY_VERSION_2 - unsigned short cbHeaderLength; - unsigned long cbStructureLength; - unsigned long UserOffset; // Non-NULL terminated string, unicode only - unsigned short UserLength; // # of bytes (NOT WCHARs), not including NULL. - unsigned long DomainOffset; // Non-NULL terminated string, unicode only - unsigned short DomainLength; // # of bytes (NOT WCHARs), not including NULL. - unsigned long PackedCredentialsOffset; // Non-NULL terminated string, unicode only - unsigned short PackedCredentialsLength; // # of bytes (NOT WCHARs), not including NULL. - unsigned long Flags; - unsigned long PackageListOffset; // Non-NULL terminated string, unicode only - unsigned short PackageListLength; -} SEC_WINNT_AUTH_IDENTITY_EX2, *PSEC_WINNT_AUTH_IDENTITY_EX2; - -#endif // _AUTH_IDENTITY_EX2_DEFINED - -#ifndef _AUTH_IDENTITY_DEFINED -#define _AUTH_IDENTITY_DEFINED - -// -// This was not defined in NTIFS.h for windows 2000 however -// this struct has always been there and are safe to use -// in windows 2000 and above. -// - -#define SEC_WINNT_AUTH_IDENTITY_ANSI 0x1 -#define SEC_WINNT_AUTH_IDENTITY_UNICODE 0x2 - -typedef struct _SEC_WINNT_AUTH_IDENTITY_W { - unsigned short *User; // Non-NULL terminated string. - unsigned long UserLength; // # of characters (NOT bytes), not including NULL. - unsigned short *Domain; // Non-NULL terminated string. - unsigned long DomainLength; // # of characters (NOT bytes), not including NULL. - unsigned short *Password; // Non-NULL terminated string. - unsigned long PasswordLength; // # of characters (NOT bytes), not including NULL. - unsigned long Flags; -} SEC_WINNT_AUTH_IDENTITY_W, *PSEC_WINNT_AUTH_IDENTITY_W; - -#define SEC_WINNT_AUTH_IDENTITY SEC_WINNT_AUTH_IDENTITY_W -#define PSEC_WINNT_AUTH_IDENTITY PSEC_WINNT_AUTH_IDENTITY_W -#define _SEC_WINNT_AUTH_IDENTITY _SEC_WINNT_AUTH_IDENTITY_W - -#endif //_AUTH_IDENTITY_DEFINED // ntifs - -// -// This is the combined authentication identity structure that may be -// used with the negotiate package, NTLM, Kerberos, or SCHANNEL -// - -#ifndef SEC_WINNT_AUTH_IDENTITY_VERSION -#define SEC_WINNT_AUTH_IDENTITY_VERSION 0x200 - -typedef struct _SEC_WINNT_AUTH_IDENTITY_EXW { - unsigned long Version; - unsigned long Length; - unsigned short *User; // Non-NULL terminated string. - unsigned long UserLength; // # of characters (NOT bytes), not including NULL. - unsigned short *Domain; // Non-NULL terminated string. - unsigned long DomainLength; // # of characters (NOT bytes), not including NULL. - unsigned short *Password; // Non-NULL terminated string. - unsigned long PasswordLength; // # of characters (NOT bytes), not including NULL. - unsigned long Flags; - unsigned short *PackageList; - unsigned long PackageListLength; -} SEC_WINNT_AUTH_IDENTITY_EXW, *PSEC_WINNT_AUTH_IDENTITY_EXW; - -#define SEC_WINNT_AUTH_IDENTITY_EX SEC_WINNT_AUTH_IDENTITY_EXW -#define PSEC_WINNT_AUTH_IDENTITY_EX PSEC_WINNT_AUTH_IDENTITY_EXW - -#endif // SEC_WINNT_AUTH_IDENTITY_VERSION - - -typedef PVOID PSEC_WINNT_AUTH_IDENTITY_OPAQUE; // the credential structure is opaque - - -#if (NTDDI_VERSION >= NTDDI_WIN7) -// -// Convert the _OPAQUE structure passed in to the -// 3 tuple . -// -// Note: The 'strings' returned need not necessarily be -// in user recognisable form. The purpose of this API -// is to 'flatten' the _OPAQUE structure into the 3 tuple. -// User recognisable can always be -// obtained by passing NULL to the pszPackedCredentialsString -// parameter. -// -// zero out the pszPackedCredentialsString then -// free the returned memory using SspiLocalFree() -// - -SECURITY_STATUS -SEC_ENTRY -SspiEncodeAuthIdentityAsStrings( - __in PSEC_WINNT_AUTH_IDENTITY_OPAQUE pAuthIdentity, - __deref_out_opt PCWSTR* ppszUserName, - __deref_out_opt PCWSTR* ppszDomainName, - __deref_opt_out_opt PCWSTR* ppszPackedCredentialsString - ); - -SECURITY_STATUS -SEC_ENTRY -SspiValidateAuthIdentity( - __in PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData - ); - -// -// free the returned memory using SspiFreeAuthIdentity() -// - -SECURITY_STATUS -SEC_ENTRY -SspiCopyAuthIdentity( - __in PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData, - __deref_out PSEC_WINNT_AUTH_IDENTITY_OPAQUE* AuthDataCopy - ); - -// -// use only for the memory returned by SspiCopyAuthIdentity(). -// Internally calls SspiZeroAuthIdentity(). -// - -VOID -SEC_ENTRY -SspiFreeAuthIdentity( - __in_opt PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData - ); - -VOID -SEC_ENTRY -SspiZeroAuthIdentity( - __in_opt PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData - ); - -VOID -SEC_ENTRY -SspiLocalFree( - __in_opt PVOID DataBuffer - ); - -// -// call SspiFreeAuthIdentity to free the returned AuthIdentity -// which zeroes out the credentials blob before freeing it -// - -SECURITY_STATUS -SEC_ENTRY -SspiEncodeStringsAsAuthIdentity( - __in_opt PCWSTR pszUserName, - __in_opt PCWSTR pszDomainName, - __in_opt PCWSTR pszPackedCredentialsString, - __deref_out PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppAuthIdentity - ); - -SECURITY_STATUS -SEC_ENTRY -SspiCompareAuthIdentities( - __in_opt PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity1, - __in_opt PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity2, - __out_opt PBOOLEAN SameSuppliedUser, - __out_opt PBOOLEAN SameSuppliedIdentity - ); - -// -// zero out the returned AuthIdentityByteArray then -// free the returned memory using SspiLocalFree() -// - -SECURITY_STATUS -SEC_ENTRY -SspiMarshalAuthIdentity( - __in PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity, - __out unsigned long* AuthIdentityLength, - __deref_out_bcount(*AuthIdentityLength) char** AuthIdentityByteArray - ); - -// -// free the returned auth identity using SspiFreeAuthIdentity() -// - -SECURITY_STATUS -SEC_ENTRY -SspiUnmarshalAuthIdentity( - __in unsigned long AuthIdentityLength, - __in_bcount(AuthIdentityLength) char* AuthIdentityByteArray, - __deref_out PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppAuthIdentity - ); - -BOOLEAN -SEC_ENTRY -SspiIsPromptingNeeded( - __in unsigned long ErrorOrNtStatus - ); - -SECURITY_STATUS -SEC_ENTRY -SspiGetTargetHostName( - __in PCWSTR pszTargetName, - __deref_out PWSTR* pszHostName - ); - -SECURITY_STATUS -SEC_ENTRY -SspiExcludePackage( - __in_opt PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity, - __in PCWSTR pszPackageName, - __deref_out PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppNewAuthIdentity - ); - -// -// Common types used by negotiable security packages -// -// These are defined after W2K -// - -#define SEC_WINNT_AUTH_IDENTITY_MARSHALLED 0x4 // all data is in one buffer -#define SEC_WINNT_AUTH_IDENTITY_ONLY 0x8 // these credentials are for identity only - no PAC needed - -#endif // NTDDI_VERSION -#endif // __SSPI_H__ - -#ifndef SECURITY_USER_DATA_DEFINED -#define SECURITY_USER_DATA_DEFINED - -typedef struct _SECURITY_USER_DATA { - SECURITY_STRING UserName; // User name - SECURITY_STRING LogonDomainName; // Domain the user logged on to - SECURITY_STRING LogonServer; // Server that logged the user on - PSID pSid; // SID of user -} SECURITY_USER_DATA, *PSECURITY_USER_DATA; - -typedef SECURITY_USER_DATA SecurityUserData, * PSecurityUserData; - - -#define UNDERSTANDS_LONG_NAMES 1 -#define NO_LONG_NAMES 2 - -#endif // SECURITY_USER_DATA_DEFINED - -NTSTATUS SEC_ENTRY -GetSecurityUserInfo( - __in_opt PLUID LogonId, - __in ULONG Flags, - __deref_out PSecurityUserData * UserInformation - ); - -NTSTATUS SEC_ENTRY -MapSecurityError( __in SECURITY_STATUS SecStatus ); - -#define DD_MUP_DEVICE_NAME L"\\Device\\Mup" - - -// -// The actual prefix resolution IOCTL issued by MUP to -// redirectors to determine who is responsible for a -// \\server\share prefix. -// - -// -// For use with legacy providers, which register with -// FsRtlRegisterUncProvider(). -// - -#define IOCTL_REDIR_QUERY_PATH CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 99, METHOD_NEITHER, FILE_ANY_ACCESS) - -// -// For use by redirectors conforming to the Vista redirector model. -// These register with FsRtlRegisterUncProviderEx(). -// - -#define IOCTL_REDIR_QUERY_PATH_EX CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 100, METHOD_NEITHER, FILE_ANY_ACCESS) - -// -// Used by MUP prefix resolution. -// For use with legacy providers, which register with -// FsRtlRegisterUncProvider(). -// - -typedef struct _QUERY_PATH_REQUEST { - ULONG PathNameLength; - PIO_SECURITY_CONTEXT SecurityContext; - WCHAR FilePathName[1]; -} QUERY_PATH_REQUEST, *PQUERY_PATH_REQUEST; - -// -// Used by MUP prefix resolution. -// Issued to providers which register with FsRtlRegisterUncProviderEx() -// These are providers conforming to the Vista redirector model. -// - -typedef struct _QUERY_PATH_REQUEST_EX { - PIO_SECURITY_CONTEXT pSecurityContext; - ULONG EaLength; - PVOID pEaBuffer; - - // - // Pointer to filename will be passed to provider. - // Providers MUST NOT modify this string. - // - - UNICODE_STRING PathName; - - // - // Pointer to optional domain service name. Only providers which - // register as FSRTL_UNC_PROVIDER_FLAGS_DOMAIN_SVC_AWARE will see - // domain service names. - // - // This consumes 2 of the 5 ULONG_PTRs initially reserved in the - // _EX query. New as of Windows 7. - // - - UNICODE_STRING DomainServiceName; - - // - // Reserved - // - - ULONG_PTR Reserved[ 3 ]; -} QUERY_PATH_REQUEST_EX, *PQUERY_PATH_REQUEST_EX; - -typedef struct _QUERY_PATH_RESPONSE { - ULONG LengthAccepted; -} QUERY_PATH_RESPONSE, *PQUERY_PATH_RESPONSE; - -#ifndef _WNNC_ -#define _WNNC_ - -// -// Network types -// - -#define WNNC_NET_MSNET 0x00010000 -#define WNNC_NET_SMB 0x00020000 -#define WNNC_NET_NETWARE 0x00030000 -#define WNNC_NET_VINES 0x00040000 -#define WNNC_NET_10NET 0x00050000 -#define WNNC_NET_LOCUS 0x00060000 -#define WNNC_NET_SUN_PC_NFS 0x00070000 -#define WNNC_NET_LANSTEP 0x00080000 -#define WNNC_NET_9TILES 0x00090000 -#define WNNC_NET_LANTASTIC 0x000A0000 -#define WNNC_NET_AS400 0x000B0000 -#define WNNC_NET_FTP_NFS 0x000C0000 -#define WNNC_NET_PATHWORKS 0x000D0000 -#define WNNC_NET_LIFENET 0x000E0000 -#define WNNC_NET_POWERLAN 0x000F0000 -#define WNNC_NET_BWNFS 0x00100000 -#define WNNC_NET_COGENT 0x00110000 -#define WNNC_NET_FARALLON 0x00120000 -#define WNNC_NET_APPLETALK 0x00130000 -#define WNNC_NET_INTERGRAPH 0x00140000 -#define WNNC_NET_SYMFONET 0x00150000 -#define WNNC_NET_CLEARCASE 0x00160000 -#define WNNC_NET_FRONTIER 0x00170000 -#define WNNC_NET_BMC 0x00180000 -#define WNNC_NET_DCE 0x00190000 -#define WNNC_NET_AVID 0x001A0000 -#define WNNC_NET_DOCUSPACE 0x001B0000 -#define WNNC_NET_MANGOSOFT 0x001C0000 -#define WNNC_NET_SERNET 0x001D0000 -#define WNNC_NET_RIVERFRONT1 0X001E0000 -#define WNNC_NET_RIVERFRONT2 0x001F0000 -#define WNNC_NET_DECORB 0x00200000 -#define WNNC_NET_PROTSTOR 0x00210000 -#define WNNC_NET_FJ_REDIR 0x00220000 -#define WNNC_NET_DISTINCT 0x00230000 -#define WNNC_NET_TWINS 0x00240000 -#define WNNC_NET_RDR2SAMPLE 0x00250000 -#define WNNC_NET_CSC 0x00260000 -#define WNNC_NET_3IN1 0x00270000 -#define WNNC_NET_EXTENDNET 0x00290000 -#define WNNC_NET_STAC 0x002A0000 -#define WNNC_NET_FOXBAT 0x002B0000 -#define WNNC_NET_YAHOO 0x002C0000 -#define WNNC_NET_EXIFS 0x002D0000 -#define WNNC_NET_DAV 0x002E0000 -#define WNNC_NET_KNOWARE 0x002F0000 -#define WNNC_NET_OBJECT_DIRE 0x00300000 -#define WNNC_NET_MASFAX 0x00310000 -#define WNNC_NET_HOB_NFS 0x00320000 -#define WNNC_NET_SHIVA 0x00330000 -#define WNNC_NET_IBMAL 0x00340000 -#define WNNC_NET_LOCK 0x00350000 -#define WNNC_NET_TERMSRV 0x00360000 -#define WNNC_NET_SRT 0x00370000 -#define WNNC_NET_QUINCY 0x00380000 -#define WNNC_NET_OPENAFS 0x00390000 -#define WNNC_NET_AVID1 0X003A0000 -#define WNNC_NET_DFS 0x003B0000 -#define WNNC_NET_KWNP 0x003C0000 -#define WNNC_NET_ZENWORKS 0x003D0000 -#define WNNC_NET_DRIVEONWEB 0x003E0000 -#define WNNC_NET_VMWARE 0x003F0000 -#define WNNC_NET_RSFX 0x00400000 -#define WNNC_NET_MFILES 0x00410000 -#define WNNC_NET_MS_NFS 0x00420000 -#define WNNC_NET_GOOGLE 0x00430000 - -#define WNNC_CRED_MANAGER 0xFFFF0000 - -// -// Network type aliases -// - -#define WNNC_NET_LANMAN WNNC_NET_SMB - - -#endif // _WNNC_ -#define VOLSNAPCONTROLTYPE 0x00000053 // 'S' -#define IOCTL_VOLSNAP_FLUSH_AND_HOLD_WRITES CTL_CODE(VOLSNAPCONTROLTYPE, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwQueryObject( - __in_opt HANDLE Handle, - __in OBJECT_INFORMATION_CLASS ObjectInformationClass, - __out_bcount_opt(ObjectInformationLength) PVOID ObjectInformation, - __in ULONG ObjectInformationLength, - __out_opt PULONG ReturnLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwNotifyChangeKey( - __in HANDLE KeyHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in ULONG CompletionFilter, - __in BOOLEAN WatchTree, - __out_bcount_opt(BufferSize) PVOID Buffer, - __in ULONG BufferSize, - __in BOOLEAN Asynchronous - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwCreateEvent ( - __out PHANDLE EventHandle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in EVENT_TYPE EventType, - __in BOOLEAN InitialState - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwDeleteFile( - __in POBJECT_ATTRIBUTES ObjectAttributes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwDeviceIoControlFile( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in ULONG IoControlCode, - __in_bcount_opt(InputBufferLength) PVOID InputBuffer, - __in ULONG InputBufferLength, - __out_bcount_opt(OutputBufferLength) PVOID OutputBuffer, - __in ULONG OutputBufferLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwQueryDirectoryFile( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __out_bcount(Length) PVOID FileInformation, - __in ULONG Length, - __in FILE_INFORMATION_CLASS FileInformationClass, - __in BOOLEAN ReturnSingleEntry, - __in_opt PUNICODE_STRING FileName, - __in BOOLEAN RestartScan - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwQueryVolumeInformationFile( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __out_bcount(Length) PVOID FsInformation, - __in ULONG Length, - __in FS_INFORMATION_CLASS FsInformationClass - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwSetVolumeInformationFile( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_bcount(Length) PVOID FsInformation, - __in ULONG Length, - __in FS_INFORMATION_CLASS FsInformationClass - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwFsControlFile( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in ULONG FsControlCode, - __in_bcount_opt(InputBufferLength) PVOID InputBuffer, - __in ULONG InputBufferLength, - __out_bcount_opt(OutputBufferLength) PVOID OutputBuffer, - __in ULONG OutputBufferLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwDuplicateObject( - __in HANDLE SourceProcessHandle, - __in HANDLE SourceHandle, - __in_opt HANDLE TargetProcessHandle, - __out_opt PHANDLE TargetHandle, - __in ACCESS_MASK DesiredAccess, - __in ULONG HandleAttributes, - __in ULONG Options - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwOpenDirectoryObject( - __out PHANDLE DirectoryHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when(return==0, __drv_allocatesMem(Region)) -NTSYSAPI -NTSTATUS -NTAPI -ZwAllocateVirtualMemory( - __in HANDLE ProcessHandle, - __inout PVOID *BaseAddress, - __in ULONG_PTR ZeroBits, - __inout PSIZE_T RegionSize, - __in ULONG AllocationType, - __in ULONG Protect - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when(return==0, __drv_freesMem(Region)) -NTSYSAPI -NTSTATUS -NTAPI -ZwFreeVirtualMemory( - __in HANDLE ProcessHandle, - __inout PVOID *BaseAddress, - __inout PSIZE_T RegionSize, - __in ULONG FreeType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_when(Timeout == NULL, __drv_maxIRQL(APC_LEVEL)) -__drv_when(Timeout->QuadPart != 0, __drv_maxIRQL(APC_LEVEL)) -__drv_when(Timeout->QuadPart == 0, __drv_maxIRQL(DISPATCH_LEVEL)) -NTSYSAPI -NTSTATUS -NTAPI -ZwWaitForSingleObject( - __in HANDLE Handle, - __in BOOLEAN Alertable, - __in_opt PLARGE_INTEGER Timeout - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwSetEvent ( - __in HANDLE EventHandle, - __out_opt PLONG PreviousState - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwFlushVirtualMemory( - __in HANDLE ProcessHandle, - __inout PVOID *BaseAddress, - __inout PSIZE_T RegionSize, - __out PIO_STATUS_BLOCK IoStatus - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwOpenProcessTokenEx( - __in HANDLE ProcessHandle, - __in ACCESS_MASK DesiredAccess, - __in ULONG HandleAttributes, - __out PHANDLE TokenHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwOpenThreadTokenEx( - __in HANDLE ThreadHandle, - __in ACCESS_MASK DesiredAccess, - __in BOOLEAN OpenAsSelf, - __in ULONG HandleAttributes, - __out PHANDLE TokenHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwQueryInformationToken ( - __in HANDLE TokenHandle, - __in TOKEN_INFORMATION_CLASS TokenInformationClass, - __out_bcount_part_opt(TokenInformationLength,*ReturnLength) PVOID TokenInformation, - __in ULONG TokenInformationLength, - __out PULONG ReturnLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwSetInformationToken ( - __in HANDLE TokenHandle, - __in TOKEN_INFORMATION_CLASS TokenInformationClass, - __in_bcount(TokenInformationLength) PVOID TokenInformation, - __in ULONG TokenInformationLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwSetSecurityObject( - __in HANDLE Handle, - __in SECURITY_INFORMATION SecurityInformation, - __in PSECURITY_DESCRIPTOR SecurityDescriptor - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwQuerySecurityObject( - __in HANDLE Handle, - __in SECURITY_INFORMATION SecurityInformation, - __out_bcount_part(Length,*LengthNeeded) PSECURITY_DESCRIPTOR SecurityDescriptor, - __in ULONG Length, - __out PULONG LengthNeeded - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwLockFile( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in PLARGE_INTEGER ByteOffset, - __in PLARGE_INTEGER Length, - __in ULONG Key, - __in BOOLEAN FailImmediately, - __in BOOLEAN ExclusiveLock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwUnlockFile( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in PLARGE_INTEGER ByteOffset, - __in PLARGE_INTEGER Length, - __in ULONG Key - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwQueryQuotaInformationFile( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __out_bcount(Length) PVOID Buffer, - __in ULONG Length, - __in BOOLEAN ReturnSingleEntry, - __in_bcount_opt(SidListLength) PVOID SidList, - __in ULONG SidListLength, - __in_opt PSID StartSid, - __in BOOLEAN RestartScan - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwSetQuotaInformationFile( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_bcount(Length) PVOID Buffer, - __in ULONG Length - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -ZwFlushBuffersFile( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock - ); -#endif - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -ZwQueryEaFile ( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __out_bcount(Length) PVOID Buffer, - __in ULONG Length, - __in BOOLEAN ReturnSingleEntry, - __in_bcount_opt(EaListLength) PVOID EaList, - __in ULONG EaListLength, - __in_opt PULONG EaIndex, - __in BOOLEAN RestartScan - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -ZwSetEaFile ( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_bcount(Length) PVOID Buffer, - __in ULONG Length - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwDuplicateToken( - __in HANDLE ExistingTokenHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in BOOLEAN EffectiveOnly, - __in TOKEN_TYPE TokenType, - __out PHANDLE NewTokenHandle - ); - - - -#ifdef __cplusplus -} -#endif - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4115) -#pragma warning(default:4201) -#pragma warning(default:4214) -#endif - -#endif // _NTIFS_ - diff --git a/pub/ddk/ntimage.h b/pub/ddk/ntimage.h deleted file mode 100644 index b1abde0..0000000 --- a/pub/ddk/ntimage.h +++ /dev/null @@ -1,2010 +0,0 @@ -/*++ BUILD Version: 0004 // Increment this if a change has global effects - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ntimage.h - -Abstract: - - This is the include file that describes all image structures. - ---*/ - -#ifndef _NTIMAGE_ -#define _NTIMAGE_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning (disable:4201) /* nonstandard extension used : nameless struct/union */ -#pragma warning (disable:4214) /* nonstandard extension used : bit field types other then int */ - -// -// Define the linker version number. This is temporary to aid -// in debugging with people trying to load images built with -// an older linker. This is not required in the final product. -// - -#define IMAGE_MAJOR_LINKER_VERSION 2 - -// begin_winnt - - -// -// Image Format -// - - -#ifndef _MAC - -#include "pshpack4.h" // 4 byte packing is the default - -#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ -#define IMAGE_OS2_SIGNATURE 0x454E // NE -#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE -#define IMAGE_VXD_SIGNATURE 0x454C // LE -#define IMAGE_NT_SIGNATURE 0x00004550 // PE00 - -#include "pshpack2.h" // 16 bit headers are 2 byte packed - -#else - -#include "pshpack1.h" - -#define IMAGE_DOS_SIGNATURE 0x4D5A // MZ -#define IMAGE_OS2_SIGNATURE 0x4E45 // NE -#define IMAGE_OS2_SIGNATURE_LE 0x4C45 // LE -#define IMAGE_NT_SIGNATURE 0x50450000 // PE00 -#endif - -typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header - USHORT e_magic; // Magic number - USHORT e_cblp; // Bytes on last page of file - USHORT e_cp; // Pages in file - USHORT e_crlc; // Relocations - USHORT e_cparhdr; // Size of header in paragraphs - USHORT e_minalloc; // Minimum extra paragraphs needed - USHORT e_maxalloc; // Maximum extra paragraphs needed - USHORT e_ss; // Initial (relative) SS value - USHORT e_sp; // Initial SP value - USHORT e_csum; // Checksum - USHORT e_ip; // Initial IP value - USHORT e_cs; // Initial (relative) CS value - USHORT e_lfarlc; // File address of relocation table - USHORT e_ovno; // Overlay number - USHORT e_res[4]; // Reserved words - USHORT e_oemid; // OEM identifier (for e_oeminfo) - USHORT e_oeminfo; // OEM information; e_oemid specific - USHORT e_res2[10]; // Reserved words - LONG e_lfanew; // File address of new exe header - } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; - -typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header - USHORT ne_magic; // Magic number - CHAR ne_ver; // Version number - CHAR ne_rev; // Revision number - USHORT ne_enttab; // Offset of Entry Table - USHORT ne_cbenttab; // Number of bytes in Entry Table - LONG ne_crc; // Checksum of whole file - USHORT ne_flags; // Flag word - USHORT ne_autodata; // Automatic data segment number - USHORT ne_heap; // Initial heap allocation - USHORT ne_stack; // Initial stack allocation - LONG ne_csip; // Initial CS:IP setting - LONG ne_sssp; // Initial SS:SP setting - USHORT ne_cseg; // Count of file segments - USHORT ne_cmod; // Entries in Module Reference Table - USHORT ne_cbnrestab; // Size of non-resident name table - USHORT ne_segtab; // Offset of Segment Table - USHORT ne_rsrctab; // Offset of Resource Table - USHORT ne_restab; // Offset of resident name table - USHORT ne_modtab; // Offset of Module Reference Table - USHORT ne_imptab; // Offset of Imported Names Table - LONG ne_nrestab; // Offset of Non-resident Names Table - USHORT ne_cmovent; // Count of movable entries - USHORT ne_align; // Segment alignment shift count - USHORT ne_cres; // Count of resource segments - UCHAR ne_exetyp; // Target Operating system - UCHAR ne_flagsothers; // Other .EXE flags - USHORT ne_pretthunks; // offset to return thunks - USHORT ne_psegrefbytes; // offset to segment ref. bytes - USHORT ne_swaparea; // Minimum code swap area size - USHORT ne_expver; // Expected Windows version number - } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER; - -typedef struct _IMAGE_VXD_HEADER { // Windows VXD header - USHORT e32_magic; // Magic number - UCHAR e32_border; // The byte ordering for the VXD - UCHAR e32_worder; // The word ordering for the VXD - ULONG e32_level; // The EXE format level for now = 0 - USHORT e32_cpu; // The CPU type - USHORT e32_os; // The OS type - ULONG e32_ver; // Module version - ULONG e32_mflags; // Module flags - ULONG e32_mpages; // Module # pages - ULONG e32_startobj; // Object # for instruction pointer - ULONG e32_eip; // Extended instruction pointer - ULONG e32_stackobj; // Object # for stack pointer - ULONG e32_esp; // Extended stack pointer - ULONG e32_pagesize; // VXD page size - ULONG e32_lastpagesize; // Last page size in VXD - ULONG e32_fixupsize; // Fixup section size - ULONG e32_fixupsum; // Fixup section checksum - ULONG e32_ldrsize; // Loader section size - ULONG e32_ldrsum; // Loader section checksum - ULONG e32_objtab; // Object table offset - ULONG e32_objcnt; // Number of objects in module - ULONG e32_objmap; // Object page map offset - ULONG e32_itermap; // Object iterated data map offset - ULONG e32_rsrctab; // Offset of Resource Table - ULONG e32_rsrccnt; // Number of resource entries - ULONG e32_restab; // Offset of resident name table - ULONG e32_enttab; // Offset of Entry Table - ULONG e32_dirtab; // Offset of Module Directive Table - ULONG e32_dircnt; // Number of module directives - ULONG e32_fpagetab; // Offset of Fixup Page Table - ULONG e32_frectab; // Offset of Fixup Record Table - ULONG e32_impmod; // Offset of Import Module Name Table - ULONG e32_impmodcnt; // Number of entries in Import Module Name Table - ULONG e32_impproc; // Offset of Import Procedure Name Table - ULONG e32_pagesum; // Offset of Per-Page Checksum Table - ULONG e32_datapage; // Offset of Enumerated Data Pages - ULONG e32_preload; // Number of preload pages - ULONG e32_nrestab; // Offset of Non-resident Names Table - ULONG e32_cbnrestab; // Size of Non-resident Name Table - ULONG e32_nressum; // Non-resident Name Table Checksum - ULONG e32_autodata; // Object # for automatic data object - ULONG e32_debuginfo; // Offset of the debugging information - ULONG e32_debuglen; // The length of the debugging info. in bytes - ULONG e32_instpreload; // Number of instance pages in preload section of VXD file - ULONG e32_instdemand; // Number of instance pages in demand load section of VXD file - ULONG e32_heapsize; // Size of heap - for 16-bit apps - UCHAR e32_res3[12]; // Reserved words - ULONG e32_winresoff; - ULONG e32_winreslen; - USHORT e32_devid; // Device ID for VxD - USHORT e32_ddkver; // DDK version for VxD - } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER; - -#ifndef _MAC -#include "poppack.h" // Back to 4 byte packing -#endif - -// -// File header format. -// - -typedef struct _IMAGE_FILE_HEADER { - USHORT Machine; - USHORT NumberOfSections; - ULONG TimeDateStamp; - ULONG PointerToSymbolTable; - ULONG NumberOfSymbols; - USHORT SizeOfOptionalHeader; - USHORT Characteristics; -} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; - -#define IMAGE_SIZEOF_FILE_HEADER 20 - -#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file. -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references). -#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file. -#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file. -#define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010 // Agressively trim working set -#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020 // App can handle >2gb addresses -#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed. -#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine. -#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file -#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400 // If Image is on removable media, copy and run from the swap file. -#define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800 // If Image is on Net, copy and run from the swap file. -#define IMAGE_FILE_SYSTEM 0x1000 // System File. -#define IMAGE_FILE_DLL 0x2000 // File is a DLL. -#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000 // File should only be run on a UP machine -#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed. - -#define IMAGE_FILE_MACHINE_UNKNOWN 0 -#define IMAGE_FILE_MACHINE_I386 0x014c // Intel 386. -#define IMAGE_FILE_MACHINE_R3000 0x0162 // MIPS little-endian, 0x160 big-endian -#define IMAGE_FILE_MACHINE_R4000 0x0166 // MIPS little-endian -#define IMAGE_FILE_MACHINE_R10000 0x0168 // MIPS little-endian -#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169 // MIPS little-endian WCE v2 -#define IMAGE_FILE_MACHINE_ALPHA 0x0184 // Alpha_AXP -#define IMAGE_FILE_MACHINE_SH3 0x01a2 // SH3 little-endian -#define IMAGE_FILE_MACHINE_SH3DSP 0x01a3 -#define IMAGE_FILE_MACHINE_SH3E 0x01a4 // SH3E little-endian -#define IMAGE_FILE_MACHINE_SH4 0x01a6 // SH4 little-endian -#define IMAGE_FILE_MACHINE_SH5 0x01a8 // SH5 -#define IMAGE_FILE_MACHINE_ARM 0x01c0 // ARM Little-Endian -#define IMAGE_FILE_MACHINE_THUMB 0x01c2 -#define IMAGE_FILE_MACHINE_AM33 0x01d3 -#define IMAGE_FILE_MACHINE_POWERPC 0x01F0 // IBM PowerPC Little-Endian -#define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1 -#define IMAGE_FILE_MACHINE_IA64 0x0200 // Intel 64 -#define IMAGE_FILE_MACHINE_MIPS16 0x0266 // MIPS -#define IMAGE_FILE_MACHINE_ALPHA64 0x0284 // ALPHA64 -#define IMAGE_FILE_MACHINE_MIPSFPU 0x0366 // MIPS -#define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466 // MIPS -#define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64 -#define IMAGE_FILE_MACHINE_TRICORE 0x0520 // Infineon -#define IMAGE_FILE_MACHINE_CEF 0x0CEF -#define IMAGE_FILE_MACHINE_EBC 0x0EBC // EFI Byte Code -#define IMAGE_FILE_MACHINE_AMD64 0x8664 // AMD64 (K8) -#define IMAGE_FILE_MACHINE_M32R 0x9041 // M32R little-endian -#define IMAGE_FILE_MACHINE_CEE 0xC0EE - -// -// Directory format. -// - -typedef struct _IMAGE_DATA_DIRECTORY { - ULONG VirtualAddress; - ULONG Size; -} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; - -#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 - -// -// Optional header format. -// - -typedef struct _IMAGE_OPTIONAL_HEADER { - // - // Standard fields. - // - - USHORT Magic; - UCHAR MajorLinkerVersion; - UCHAR MinorLinkerVersion; - ULONG SizeOfCode; - ULONG SizeOfInitializedData; - ULONG SizeOfUninitializedData; - ULONG AddressOfEntryPoint; - ULONG BaseOfCode; - ULONG BaseOfData; - - // - // NT additional fields. - // - - ULONG ImageBase; - ULONG SectionAlignment; - ULONG FileAlignment; - USHORT MajorOperatingSystemVersion; - USHORT MinorOperatingSystemVersion; - USHORT MajorImageVersion; - USHORT MinorImageVersion; - USHORT MajorSubsystemVersion; - USHORT MinorSubsystemVersion; - ULONG Win32VersionValue; - ULONG SizeOfImage; - ULONG SizeOfHeaders; - ULONG CheckSum; - USHORT Subsystem; - USHORT DllCharacteristics; - ULONG SizeOfStackReserve; - ULONG SizeOfStackCommit; - ULONG SizeOfHeapReserve; - ULONG SizeOfHeapCommit; - ULONG LoaderFlags; - ULONG NumberOfRvaAndSizes; - IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; -} IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32; - -typedef struct _IMAGE_ROM_OPTIONAL_HEADER { - USHORT Magic; - UCHAR MajorLinkerVersion; - UCHAR MinorLinkerVersion; - ULONG SizeOfCode; - ULONG SizeOfInitializedData; - ULONG SizeOfUninitializedData; - ULONG AddressOfEntryPoint; - ULONG BaseOfCode; - ULONG BaseOfData; - ULONG BaseOfBss; - ULONG GprMask; - ULONG CprMask[4]; - ULONG GpValue; -} IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER; - -typedef struct _IMAGE_OPTIONAL_HEADER64 { - USHORT Magic; - UCHAR MajorLinkerVersion; - UCHAR MinorLinkerVersion; - ULONG SizeOfCode; - ULONG SizeOfInitializedData; - ULONG SizeOfUninitializedData; - ULONG AddressOfEntryPoint; - ULONG BaseOfCode; - ULONGLONG ImageBase; - ULONG SectionAlignment; - ULONG FileAlignment; - USHORT MajorOperatingSystemVersion; - USHORT MinorOperatingSystemVersion; - USHORT MajorImageVersion; - USHORT MinorImageVersion; - USHORT MajorSubsystemVersion; - USHORT MinorSubsystemVersion; - ULONG Win32VersionValue; - ULONG SizeOfImage; - ULONG SizeOfHeaders; - ULONG CheckSum; - USHORT Subsystem; - USHORT DllCharacteristics; - ULONGLONG SizeOfStackReserve; - ULONGLONG SizeOfStackCommit; - ULONGLONG SizeOfHeapReserve; - ULONGLONG SizeOfHeapCommit; - ULONG LoaderFlags; - ULONG NumberOfRvaAndSizes; - IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; -} IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64; - -#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b -#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b -#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 - -#ifdef _WIN64 -typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER; -typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER; -#define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC -#else -typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER; -typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER; -#define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC -#endif - -typedef struct _IMAGE_NT_HEADERS64 { - ULONG Signature; - IMAGE_FILE_HEADER FileHeader; - IMAGE_OPTIONAL_HEADER64 OptionalHeader; -} IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64; - -typedef struct _IMAGE_NT_HEADERS { - ULONG Signature; - IMAGE_FILE_HEADER FileHeader; - IMAGE_OPTIONAL_HEADER32 OptionalHeader; -} IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32; - -typedef struct _IMAGE_ROM_HEADERS { - IMAGE_FILE_HEADER FileHeader; - IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; -} IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS; - -#ifdef _WIN64 -typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS; -typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS; -#else -typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS; -typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS; -#endif - -// IMAGE_FIRST_SECTION doesn't need 32/64 versions since the file header is the same either way. - -#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \ - ((ULONG_PTR)(ntheader) + \ - FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \ - ((ntheader))->FileHeader.SizeOfOptionalHeader \ - )) - -// Subsystem Values - -#define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem. -#define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem. -#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem. -#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem. -// end_winnt -// reserved 4 // Old Windows CE subsystem. -// begin_winnt -#define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem. -#define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image runs in the Posix character subsystem. -#define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 // image is a native Win9x driver. -#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 // Image runs in the Windows CE subsystem. -#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 // -#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11 // -#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 // -#define IMAGE_SUBSYSTEM_EFI_ROM 13 -#define IMAGE_SUBSYSTEM_XBOX 14 -#define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16 - -// DllCharacteristics Entries - -// IMAGE_LIBRARY_PROCESS_INIT 0x0001 // Reserved. -// IMAGE_LIBRARY_PROCESS_TERM 0x0002 // Reserved. -// IMAGE_LIBRARY_THREAD_INIT 0x0004 // Reserved. -// IMAGE_LIBRARY_THREAD_TERM 0x0008 // Reserved. -#define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040 // DLL can move. -#define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080 // Code Integrity Image -#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100 // Image is NX compatible -#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200 // Image understands isolation and doesn't want it -#define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400 // Image does not use SEH. No SE handler may reside in this image -#define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800 // Do not bind this image. -// 0x1000 // Reserved. -#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 // Driver uses WDM model -// 0x4000 // Reserved. -#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000 -// end_winnt -#define IMAGE_DLLCHARACTERISTICS_BROWSERHOSTED 0x1000 // Image is a browser hosted windows client executable -#define IMAGE_DLLCHARACTERISTICS_X86_THUNK 0x1000 // Image is a Wx86 Thunk DLL -// Note: The Borland linker sets IMAGE_LIBRARY_xxx flags in DllCharacteristics - -// LoaderFlags Values - -#define IMAGE_LOADER_FLAGS_COMPLUS 0x00000001 // COM+ image -#define IMAGE_LOADER_FLAGS_SYSTEM_GLOBAL 0x01000000 // Global subsections apply across TS sessions. - -// begin_winnt - -// Directory Entries - -#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory -#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory -#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory -#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory -#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory -#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table -#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory -// IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // (X86 usage) -#define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 7 // Architecture Specific Data -#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // RVA of GP -#define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory -#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory -#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11 // Bound Import Directory in headers -#define IMAGE_DIRECTORY_ENTRY_IAT 12 // Import Address Table -#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13 // Delay Load Import Descriptors -#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14 // COM Runtime descriptor - -// -// Non-COFF Object file header -// - -typedef struct ANON_OBJECT_HEADER { - USHORT Sig1; // Must be IMAGE_FILE_MACHINE_UNKNOWN - USHORT Sig2; // Must be 0xffff - USHORT Version; // >= 1 (implies the CLSID field is present) - USHORT Machine; - ULONG TimeDateStamp; - CLSID ClassID; // Used to invoke CoCreateInstance - ULONG SizeOfData; // Size of data that follows the header -} ANON_OBJECT_HEADER; - -typedef struct ANON_OBJECT_HEADER_V2 { - USHORT Sig1; // Must be IMAGE_FILE_MACHINE_UNKNOWN - USHORT Sig2; // Must be 0xffff - USHORT Version; // >= 2 (implies the Flags field is present - otherwise V1) - USHORT Machine; - ULONG TimeDateStamp; - CLSID ClassID; // Used to invoke CoCreateInstance - ULONG SizeOfData; // Size of data that follows the header - ULONG Flags; // 0x1 -> contains metadata - ULONG MetaDataSize; // Size of CLR metadata - ULONG MetaDataOffset; // Offset of CLR metadata -} ANON_OBJECT_HEADER_V2; - -typedef struct ANON_OBJECT_HEADER_BIGOBJ { - /* same as ANON_OBJECT_HEADER_V2 */ - USHORT Sig1; // Must be IMAGE_FILE_MACHINE_UNKNOWN - USHORT Sig2; // Must be 0xffff - USHORT Version; // >= 2 (implies the Flags field is present) - USHORT Machine; // Actual machine - IMAGE_FILE_MACHINE_xxx - ULONG TimeDateStamp; - CLSID ClassID; // {D1BAA1C7-BAEE-4ba9-AF20-FAF66AA4DCB8} - ULONG SizeOfData; // Size of data that follows the header - ULONG Flags; // 0x1 -> contains metadata - ULONG MetaDataSize; // Size of CLR metadata - ULONG MetaDataOffset; // Offset of CLR metadata - - /* bigobj specifics */ - ULONG NumberOfSections; // extended from WORD - ULONG PointerToSymbolTable; - ULONG NumberOfSymbols; -} ANON_OBJECT_HEADER_BIGOBJ; - -// -// Section header format. -// - -#define IMAGE_SIZEOF_SHORT_NAME 8 - -typedef struct _IMAGE_SECTION_HEADER { - UCHAR Name[IMAGE_SIZEOF_SHORT_NAME]; - union { - ULONG PhysicalAddress; - ULONG VirtualSize; - } Misc; - ULONG VirtualAddress; - ULONG SizeOfRawData; - ULONG PointerToRawData; - ULONG PointerToRelocations; - ULONG PointerToLinenumbers; - USHORT NumberOfRelocations; - USHORT NumberOfLinenumbers; - ULONG Characteristics; -} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; - -#define IMAGE_SIZEOF_SECTION_HEADER 40 - -// -// Section characteristics. -// -// IMAGE_SCN_TYPE_REG 0x00000000 // Reserved. -// IMAGE_SCN_TYPE_DSECT 0x00000001 // Reserved. -// IMAGE_SCN_TYPE_NOLOAD 0x00000002 // Reserved. -// IMAGE_SCN_TYPE_GROUP 0x00000004 // Reserved. -#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved. -// IMAGE_SCN_TYPE_COPY 0x00000010 // Reserved. - -#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code. -#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data. -#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data. - -#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved. -#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information. -// IMAGE_SCN_TYPE_OVER 0x00000400 // Reserved. -#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image. -#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat. -// 0x00002000 // Reserved. -// IMAGE_SCN_MEM_PROTECTED - Obsolete 0x00004000 -#define IMAGE_SCN_NO_DEFER_SPEC_EXC 0x00004000 // Reset speculative exceptions handling bits in the TLB entries for this section. -#define IMAGE_SCN_GPREL 0x00008000 // Section content can be accessed relative to GP -#define IMAGE_SCN_MEM_FARDATA 0x00008000 -// IMAGE_SCN_MEM_SYSHEAP - Obsolete 0x00010000 -#define IMAGE_SCN_MEM_PURGEABLE 0x00020000 -#define IMAGE_SCN_MEM_16BIT 0x00020000 -#define IMAGE_SCN_MEM_LOCKED 0x00040000 -#define IMAGE_SCN_MEM_PRELOAD 0x00080000 - -#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 // -#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 // -#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 // -#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 // -#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified. -#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 // -#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 // -#define IMAGE_SCN_ALIGN_128BYTES 0x00800000 // -#define IMAGE_SCN_ALIGN_256BYTES 0x00900000 // -#define IMAGE_SCN_ALIGN_512BYTES 0x00A00000 // -#define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000 // -#define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000 // -#define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000 // -#define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000 // -// Unused 0x00F00000 -#define IMAGE_SCN_ALIGN_MASK 0x00F00000 - -#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 // Section contains extended relocations. -#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded. -#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable. -#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable. -#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable. -#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable. -#define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable. -#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable. - -// -// TLS Chaacteristic Flags -// -#define IMAGE_SCN_SCALE_INDEX 0x00000001 // Tls index is scaled - -#ifndef _MAC -#include "pshpack2.h" // Symbols, relocs, and linenumbers are 2 byte packed -#endif - -// -// Symbol format. -// - -typedef struct _IMAGE_SYMBOL { - union { - UCHAR ShortName[8]; - struct { - ULONG Short; // if 0, use LongName - ULONG Long; // offset into string table - } Name; - ULONG LongName[2]; // PUCHAR[2] - } N; - ULONG Value; - SHORT SectionNumber; - USHORT Type; - UCHAR StorageClass; - UCHAR NumberOfAuxSymbols; -} IMAGE_SYMBOL; -typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL; - -#define IMAGE_SIZEOF_SYMBOL 18 - -typedef struct _IMAGE_SYMBOL_EX { - union { - UCHAR ShortName[8]; - struct { - ULONG Short; // if 0, use LongName - ULONG Long; // offset into string table - } Name; - ULONG LongName[2]; // PUCHAR [2] - } N; - ULONG Value; - LONG SectionNumber; - USHORT Type; - UCHAR StorageClass; - UCHAR NumberOfAuxSymbols; -} IMAGE_SYMBOL_EX; -typedef IMAGE_SYMBOL_EX UNALIGNED *PIMAGE_SYMBOL_EX; - -// -// Section values. -// -// Symbols have a section number of the section in which they are -// defined. Otherwise, section numbers have the following meanings: -// - -#define IMAGE_SYM_UNDEFINED (SHORT)0 // Symbol is undefined or is common. -#define IMAGE_SYM_ABSOLUTE (SHORT)-1 // Symbol is an absolute value. -#define IMAGE_SYM_DEBUG (SHORT)-2 // Symbol is a special debug item. -#define IMAGE_SYM_SECTION_MAX 0xFEFF // Values 0xFF00-0xFFFF are special -#define IMAGE_SYM_SECTION_MAX_EX MAXLONG - -// -// Type (fundamental) values. -// - -#define IMAGE_SYM_TYPE_NULL 0x0000 // no type. -#define IMAGE_SYM_TYPE_VOID 0x0001 // -#define IMAGE_SYM_TYPE_CHAR 0x0002 // type character. -#define IMAGE_SYM_TYPE_SHORT 0x0003 // type short integer. -#define IMAGE_SYM_TYPE_INT 0x0004 // -#define IMAGE_SYM_TYPE_LONG 0x0005 // -#define IMAGE_SYM_TYPE_FLOAT 0x0006 // -#define IMAGE_SYM_TYPE_DOUBLE 0x0007 // -#define IMAGE_SYM_TYPE_STRUCT 0x0008 // -#define IMAGE_SYM_TYPE_UNION 0x0009 // -#define IMAGE_SYM_TYPE_ENUM 0x000A // enumeration. -#define IMAGE_SYM_TYPE_MOE 0x000B // member of enumeration. -#define IMAGE_SYM_TYPE_UCHAR 0x000C // -#define IMAGE_SYM_TYPE_USHORT 0x000D // -#define IMAGE_SYM_TYPE_UINT 0x000E // -#define IMAGE_SYM_TYPE_ULONG 0x000F // -#define IMAGE_SYM_TYPE_PCODE 0x8000 // -// -// Type (derived) values. -// - -#define IMAGE_SYM_DTYPE_NULL 0 // no derived type. -#define IMAGE_SYM_DTYPE_POINTER 1 // pointer. -#define IMAGE_SYM_DTYPE_FUNCTION 2 // function. -#define IMAGE_SYM_DTYPE_ARRAY 3 // array. - -// -// Storage classes. -// -#define IMAGE_SYM_CLASS_END_OF_FUNCTION (UCHAR)-1 -#define IMAGE_SYM_CLASS_NULL 0x0000 -#define IMAGE_SYM_CLASS_AUTOMATIC 0x0001 -#define IMAGE_SYM_CLASS_EXTERNAL 0x0002 -#define IMAGE_SYM_CLASS_STATIC 0x0003 -#define IMAGE_SYM_CLASS_REGISTER 0x0004 -#define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005 -#define IMAGE_SYM_CLASS_LABEL 0x0006 -#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007 -#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008 -#define IMAGE_SYM_CLASS_ARGUMENT 0x0009 -#define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A -#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B -#define IMAGE_SYM_CLASS_UNION_TAG 0x000C -#define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D -#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E -#define IMAGE_SYM_CLASS_ENUM_TAG 0x000F -#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010 -#define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011 -#define IMAGE_SYM_CLASS_BIT_FIELD 0x0012 - -#define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044 // - -#define IMAGE_SYM_CLASS_BLOCK 0x0064 -#define IMAGE_SYM_CLASS_FUNCTION 0x0065 -#define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066 -#define IMAGE_SYM_CLASS_FILE 0x0067 -// new -#define IMAGE_SYM_CLASS_SECTION 0x0068 -#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069 - -#define IMAGE_SYM_CLASS_CLR_TOKEN 0x006B - -// type packing constants - -#define N_BTMASK 0x000F -#define N_TMASK 0x0030 -#define N_TMASK1 0x00C0 -#define N_TMASK2 0x00F0 -#define N_BTSHFT 4 -#define N_TSHIFT 2 -// MACROS - -// Basic Type of x -#define BTYPE(x) ((x) & N_BTMASK) - -// Is x a pointer? -#ifndef ISPTR -#define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT)) -#endif - -// Is x a function? -#ifndef ISFCN -#define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT)) -#endif - -// Is x an array? - -#ifndef ISARY -#define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT)) -#endif - -// Is x a structure, union, or enumeration TAG? -#ifndef ISTAG -#define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG) -#endif - -#ifndef INCREF -#define INCREF(x) ((((x)&~N_BTMASK)<>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) -#endif - -#include - -typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF { - UCHAR bAuxType; // IMAGE_AUX_SYMBOL_TYPE - UCHAR bReserved; // Must be 0 - ULONG SymbolTableIndex; - UCHAR rgbReserved[12]; // Must be 0 -} IMAGE_AUX_SYMBOL_TOKEN_DEF; - -typedef IMAGE_AUX_SYMBOL_TOKEN_DEF UNALIGNED *PIMAGE_AUX_SYMBOL_TOKEN_DEF; - -#include - -// -// Auxiliary entry format. -// - -typedef union _IMAGE_AUX_SYMBOL { - struct { - ULONG TagIndex; // struct, union, or enum tag index - union { - struct { - USHORT Linenumber; // declaration line number - USHORT Size; // size of struct, union, or enum - } LnSz; - ULONG TotalSize; - } Misc; - union { - struct { // if ISFCN, tag, or .bb - ULONG PointerToLinenumber; - ULONG PointerToNextFunction; - } Function; - struct { // if ISARY, up to 4 dimen. - USHORT Dimension[4]; - } Array; - } FcnAry; - USHORT TvIndex; // tv index - } Sym; - struct { - UCHAR Name[IMAGE_SIZEOF_SYMBOL]; - } File; - struct { - ULONG Length; // section length - USHORT NumberOfRelocations; // number of relocation entries - USHORT NumberOfLinenumbers; // number of line numbers - ULONG CheckSum; // checksum for communal - SHORT Number; // section number to associate with - UCHAR Selection; // communal selection type - UCHAR bReserved; - SHORT HighNumber; // high bits of the section number - } Section; - IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef; - struct { - ULONG crc; - UCHAR rgbReserved[14]; - } CRC; -} IMAGE_AUX_SYMBOL; -typedef IMAGE_AUX_SYMBOL UNALIGNED *PIMAGE_AUX_SYMBOL; - -typedef union _IMAGE_AUX_SYMBOL_EX { - struct { - ULONG WeakDefaultSymIndex; // the weak extern default symbol index - ULONG WeakSearchType; - UCHAR rgbReserved[12]; - } Sym; - struct { - UCHAR Name[sizeof(IMAGE_SYMBOL_EX)]; - } File; - struct { - ULONG Length; // section length - USHORT NumberOfRelocations; // number of relocation entries - USHORT NumberOfLinenumbers; // number of line numbers - ULONG CheckSum; // checksum for communal - SHORT Number; // section number to associate with - UCHAR Selection; // communal selection type - UCHAR bReserved; - SHORT HighNumber; // high bits of the section number - UCHAR rgbReserved[2]; - } Section; - struct{ - IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef; - UCHAR rgbReserved[2]; - }; - struct { - ULONG crc; - UCHAR rgbReserved[16]; - } CRC; -} IMAGE_AUX_SYMBOL_EX; -typedef IMAGE_AUX_SYMBOL_EX UNALIGNED *PIMAGE_AUX_SYMBOL_EX; - -typedef enum IMAGE_AUX_SYMBOL_TYPE { - IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1, -} IMAGE_AUX_SYMBOL_TYPE; - - -// -// Communal selection types. -// - -#define IMAGE_COMDAT_SELECT_NODUPLICATES 1 -#define IMAGE_COMDAT_SELECT_ANY 2 -#define IMAGE_COMDAT_SELECT_SAME_SIZE 3 -#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 -#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 -#define IMAGE_COMDAT_SELECT_LARGEST 6 -#define IMAGE_COMDAT_SELECT_NEWEST 7 - -#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 -#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 -#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 - -// -// Relocation format. -// - -typedef struct _IMAGE_RELOCATION { - union { - ULONG VirtualAddress; - ULONG RelocCount; // Set to the real count when IMAGE_SCN_LNK_NRELOC_OVFL is set - } DUMMYUNIONNAME; - ULONG SymbolTableIndex; - USHORT Type; -} IMAGE_RELOCATION; -typedef IMAGE_RELOCATION UNALIGNED *PIMAGE_RELOCATION; - -// -// I386 relocation types. -// -#define IMAGE_REL_I386_ABSOLUTE 0x0000 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_I386_DIR16 0x0001 // Direct 16-bit reference to the symbols virtual address -#define IMAGE_REL_I386_REL16 0x0002 // PC-relative 16-bit reference to the symbols virtual address -#define IMAGE_REL_I386_DIR32 0x0006 // Direct 32-bit reference to the symbols virtual address -#define IMAGE_REL_I386_DIR32NB 0x0007 // Direct 32-bit reference to the symbols virtual address, base not included -#define IMAGE_REL_I386_SEG12 0x0009 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address -#define IMAGE_REL_I386_SECTION 0x000A -#define IMAGE_REL_I386_SECREL 0x000B -#define IMAGE_REL_I386_TOKEN 0x000C // clr token -#define IMAGE_REL_I386_SECREL7 0x000D // 7 bit offset from base of section containing target -#define IMAGE_REL_I386_REL32 0x0014 // PC-relative 32-bit reference to the symbols virtual address - -// -// MIPS relocation types. -// -#define IMAGE_REL_MIPS_ABSOLUTE 0x0000 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_MIPS_REFHALF 0x0001 -#define IMAGE_REL_MIPS_REFWORD 0x0002 -#define IMAGE_REL_MIPS_JMPADDR 0x0003 -#define IMAGE_REL_MIPS_REFHI 0x0004 -#define IMAGE_REL_MIPS_REFLO 0x0005 -#define IMAGE_REL_MIPS_GPREL 0x0006 -#define IMAGE_REL_MIPS_LITERAL 0x0007 -#define IMAGE_REL_MIPS_SECTION 0x000A -#define IMAGE_REL_MIPS_SECREL 0x000B -#define IMAGE_REL_MIPS_SECRELLO 0x000C // Low 16-bit section relative referemce (used for >32k TLS) -#define IMAGE_REL_MIPS_SECRELHI 0x000D // High 16-bit section relative reference (used for >32k TLS) -#define IMAGE_REL_MIPS_TOKEN 0x000E // clr token -#define IMAGE_REL_MIPS_JMPADDR16 0x0010 -#define IMAGE_REL_MIPS_REFWORDNB 0x0022 -#define IMAGE_REL_MIPS_PAIR 0x0025 - -// -// Alpha Relocation types. -// -#define IMAGE_REL_ALPHA_ABSOLUTE 0x0000 -#define IMAGE_REL_ALPHA_REFLONG 0x0001 -#define IMAGE_REL_ALPHA_REFQUAD 0x0002 -#define IMAGE_REL_ALPHA_GPREL32 0x0003 -#define IMAGE_REL_ALPHA_LITERAL 0x0004 -#define IMAGE_REL_ALPHA_LITUSE 0x0005 -#define IMAGE_REL_ALPHA_GPDISP 0x0006 -#define IMAGE_REL_ALPHA_BRADDR 0x0007 -#define IMAGE_REL_ALPHA_HINT 0x0008 -#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009 -#define IMAGE_REL_ALPHA_REFHI 0x000A -#define IMAGE_REL_ALPHA_REFLO 0x000B -#define IMAGE_REL_ALPHA_PAIR 0x000C -#define IMAGE_REL_ALPHA_MATCH 0x000D -#define IMAGE_REL_ALPHA_SECTION 0x000E -#define IMAGE_REL_ALPHA_SECREL 0x000F -#define IMAGE_REL_ALPHA_REFLONGNB 0x0010 -#define IMAGE_REL_ALPHA_SECRELLO 0x0011 // Low 16-bit section relative reference -#define IMAGE_REL_ALPHA_SECRELHI 0x0012 // High 16-bit section relative reference -#define IMAGE_REL_ALPHA_REFQ3 0x0013 // High 16 bits of 48 bit reference -#define IMAGE_REL_ALPHA_REFQ2 0x0014 // Middle 16 bits of 48 bit reference -#define IMAGE_REL_ALPHA_REFQ1 0x0015 // Low 16 bits of 48 bit reference -#define IMAGE_REL_ALPHA_GPRELLO 0x0016 // Low 16-bit GP relative reference -#define IMAGE_REL_ALPHA_GPRELHI 0x0017 // High 16-bit GP relative reference - -// -// IBM PowerPC relocation types. -// -#define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP -#define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address -#define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address -#define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2 (branch absolute) -#define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address -#define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load doubleword) -#define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted left 2 (branch relative) -#define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted left 2 (br cond relative) -#define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base -#define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted left 2 (load doubleword) - -#define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base -#define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an image sectionhdr) -#define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number -#define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction iff symbol is glue code -#define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address is TOC restore instruction -#define IMAGE_REL_PPC_SECREL16 0x000F // va of containing section (limited to 16 bits) -#define IMAGE_REL_PPC_REFHI 0x0010 -#define IMAGE_REL_PPC_REFLO 0x0011 -#define IMAGE_REL_PPC_PAIR 0x0012 -#define IMAGE_REL_PPC_SECRELLO 0x0013 // Low 16-bit section relative reference (used for >32k TLS) -#define IMAGE_REL_PPC_SECRELHI 0x0014 // High 16-bit section relative reference (used for >32k TLS) -#define IMAGE_REL_PPC_GPREL 0x0015 -#define IMAGE_REL_PPC_TOKEN 0x0016 // clr token - -#define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in IMAGE_RELOCATION.Type - -// Flag bits in IMAGE_RELOCATION.TYPE - -#define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than adding it -#define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict branch taken -#define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict branch not taken -#define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data in toc) - -// -// Hitachi SH3 relocation types. -// -#define IMAGE_REL_SH3_ABSOLUTE 0x0000 // No relocation -#define IMAGE_REL_SH3_DIRECT16 0x0001 // 16 bit direct -#define IMAGE_REL_SH3_DIRECT32 0x0002 // 32 bit direct -#define IMAGE_REL_SH3_DIRECT8 0x0003 // 8 bit direct, -128..255 -#define IMAGE_REL_SH3_DIRECT8_WORD 0x0004 // 8 bit direct .W (0 ext.) -#define IMAGE_REL_SH3_DIRECT8_LONG 0x0005 // 8 bit direct .L (0 ext.) -#define IMAGE_REL_SH3_DIRECT4 0x0006 // 4 bit direct (0 ext.) -#define IMAGE_REL_SH3_DIRECT4_WORD 0x0007 // 4 bit direct .W (0 ext.) -#define IMAGE_REL_SH3_DIRECT4_LONG 0x0008 // 4 bit direct .L (0 ext.) -#define IMAGE_REL_SH3_PCREL8_WORD 0x0009 // 8 bit PC relative .W -#define IMAGE_REL_SH3_PCREL8_LONG 0x000A // 8 bit PC relative .L -#define IMAGE_REL_SH3_PCREL12_WORD 0x000B // 12 LSB PC relative .W -#define IMAGE_REL_SH3_STARTOF_SECTION 0x000C // Start of EXE section -#define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D // Size of EXE section -#define IMAGE_REL_SH3_SECTION 0x000E // Section table index -#define IMAGE_REL_SH3_SECREL 0x000F // Offset within section -#define IMAGE_REL_SH3_DIRECT32_NB 0x0010 // 32 bit direct not based -#define IMAGE_REL_SH3_GPREL4_LONG 0x0011 // GP-relative addressing -#define IMAGE_REL_SH3_TOKEN 0x0012 // clr token -#define IMAGE_REL_SHM_PCRELPT 0x0013 // Offset from current - // instruction in longwords - // if not NOMODE, insert the - // inverse of the low bit at - // bit 32 to select PTA/PTB -#define IMAGE_REL_SHM_REFLO 0x0014 // Low bits of 32-bit address -#define IMAGE_REL_SHM_REFHALF 0x0015 // High bits of 32-bit address -#define IMAGE_REL_SHM_RELLO 0x0016 // Low bits of relative reference -#define IMAGE_REL_SHM_RELHALF 0x0017 // High bits of relative reference -#define IMAGE_REL_SHM_PAIR 0x0018 // offset operand for relocation - -#define IMAGE_REL_SH_NOMODE 0x8000 // relocation ignores section mode - - -#define IMAGE_REL_ARM_ABSOLUTE 0x0000 // No relocation required -#define IMAGE_REL_ARM_ADDR32 0x0001 // 32 bit address -#define IMAGE_REL_ARM_ADDR32NB 0x0002 // 32 bit address w/o image base -#define IMAGE_REL_ARM_BRANCH24 0x0003 // 24 bit offset << 2 & sign ext. -#define IMAGE_REL_ARM_BRANCH11 0x0004 // Thumb: 2 11 bit offsets -#define IMAGE_REL_ARM_TOKEN 0x0005 // clr token -#define IMAGE_REL_ARM_GPREL12 0x0006 // GP-relative addressing (ARM) -#define IMAGE_REL_ARM_GPREL7 0x0007 // GP-relative addressing (Thumb) -#define IMAGE_REL_ARM_BLX24 0x0008 -#define IMAGE_REL_ARM_BLX11 0x0009 -#define IMAGE_REL_ARM_SECTION 0x000E // Section table index -#define IMAGE_REL_ARM_SECREL 0x000F // Offset within section - -#define IMAGE_REL_AM_ABSOLUTE 0x0000 -#define IMAGE_REL_AM_ADDR32 0x0001 -#define IMAGE_REL_AM_ADDR32NB 0x0002 -#define IMAGE_REL_AM_CALL32 0x0003 -#define IMAGE_REL_AM_FUNCINFO 0x0004 -#define IMAGE_REL_AM_REL32_1 0x0005 -#define IMAGE_REL_AM_REL32_2 0x0006 -#define IMAGE_REL_AM_SECREL 0x0007 -#define IMAGE_REL_AM_SECTION 0x0008 -#define IMAGE_REL_AM_TOKEN 0x0009 - -// -// x64 relocations -// -#define IMAGE_REL_AMD64_ABSOLUTE 0x0000 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_AMD64_ADDR64 0x0001 // 64-bit address (VA). -#define IMAGE_REL_AMD64_ADDR32 0x0002 // 32-bit address (VA). -#define IMAGE_REL_AMD64_ADDR32NB 0x0003 // 32-bit address w/o image base (RVA). -#define IMAGE_REL_AMD64_REL32 0x0004 // 32-bit relative address from byte following reloc -#define IMAGE_REL_AMD64_REL32_1 0x0005 // 32-bit relative address from byte distance 1 from reloc -#define IMAGE_REL_AMD64_REL32_2 0x0006 // 32-bit relative address from byte distance 2 from reloc -#define IMAGE_REL_AMD64_REL32_3 0x0007 // 32-bit relative address from byte distance 3 from reloc -#define IMAGE_REL_AMD64_REL32_4 0x0008 // 32-bit relative address from byte distance 4 from reloc -#define IMAGE_REL_AMD64_REL32_5 0x0009 // 32-bit relative address from byte distance 5 from reloc -#define IMAGE_REL_AMD64_SECTION 0x000A // Section index -#define IMAGE_REL_AMD64_SECREL 0x000B // 32 bit offset from base of section containing target -#define IMAGE_REL_AMD64_SECREL7 0x000C // 7 bit unsigned offset from base of section containing target -#define IMAGE_REL_AMD64_TOKEN 0x000D // 32 bit metadata token -#define IMAGE_REL_AMD64_SREL32 0x000E // 32 bit signed span-dependent value emitted into object -#define IMAGE_REL_AMD64_PAIR 0x000F -#define IMAGE_REL_AMD64_SSPAN32 0x0010 // 32 bit signed span-dependent value applied at link time - -// -// IA64 relocation types. -// -#define IMAGE_REL_IA64_ABSOLUTE 0x0000 -#define IMAGE_REL_IA64_IMM14 0x0001 -#define IMAGE_REL_IA64_IMM22 0x0002 -#define IMAGE_REL_IA64_IMM64 0x0003 -#define IMAGE_REL_IA64_DIR32 0x0004 -#define IMAGE_REL_IA64_DIR64 0x0005 -#define IMAGE_REL_IA64_PCREL21B 0x0006 -#define IMAGE_REL_IA64_PCREL21M 0x0007 -#define IMAGE_REL_IA64_PCREL21F 0x0008 -#define IMAGE_REL_IA64_GPREL22 0x0009 -#define IMAGE_REL_IA64_LTOFF22 0x000A -#define IMAGE_REL_IA64_SECTION 0x000B -#define IMAGE_REL_IA64_SECREL22 0x000C -#define IMAGE_REL_IA64_SECREL64I 0x000D -#define IMAGE_REL_IA64_SECREL32 0x000E -// -#define IMAGE_REL_IA64_DIR32NB 0x0010 -#define IMAGE_REL_IA64_SREL14 0x0011 -#define IMAGE_REL_IA64_SREL22 0x0012 -#define IMAGE_REL_IA64_SREL32 0x0013 -#define IMAGE_REL_IA64_UREL32 0x0014 -#define IMAGE_REL_IA64_PCREL60X 0x0015 // This is always a BRL and never converted -#define IMAGE_REL_IA64_PCREL60B 0x0016 // If possible, convert to MBB bundle with NOP.B in slot 1 -#define IMAGE_REL_IA64_PCREL60F 0x0017 // If possible, convert to MFB bundle with NOP.F in slot 1 -#define IMAGE_REL_IA64_PCREL60I 0x0018 // If possible, convert to MIB bundle with NOP.I in slot 1 -#define IMAGE_REL_IA64_PCREL60M 0x0019 // If possible, convert to MMB bundle with NOP.M in slot 1 -#define IMAGE_REL_IA64_IMMGPREL64 0x001A -#define IMAGE_REL_IA64_TOKEN 0x001B // clr token -#define IMAGE_REL_IA64_GPREL32 0x001C -#define IMAGE_REL_IA64_ADDEND 0x001F - -// -// CEF relocation types. -// -#define IMAGE_REL_CEF_ABSOLUTE 0x0000 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_CEF_ADDR32 0x0001 // 32-bit address (VA). -#define IMAGE_REL_CEF_ADDR64 0x0002 // 64-bit address (VA). -#define IMAGE_REL_CEF_ADDR32NB 0x0003 // 32-bit address w/o image base (RVA). -#define IMAGE_REL_CEF_SECTION 0x0004 // Section index -#define IMAGE_REL_CEF_SECREL 0x0005 // 32 bit offset from base of section containing target -#define IMAGE_REL_CEF_TOKEN 0x0006 // 32 bit metadata token - -// -// clr relocation types. -// -#define IMAGE_REL_CEE_ABSOLUTE 0x0000 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_CEE_ADDR32 0x0001 // 32-bit address (VA). -#define IMAGE_REL_CEE_ADDR64 0x0002 // 64-bit address (VA). -#define IMAGE_REL_CEE_ADDR32NB 0x0003 // 32-bit address w/o image base (RVA). -#define IMAGE_REL_CEE_SECTION 0x0004 // Section index -#define IMAGE_REL_CEE_SECREL 0x0005 // 32 bit offset from base of section containing target -#define IMAGE_REL_CEE_TOKEN 0x0006 // 32 bit metadata token - - -#define IMAGE_REL_M32R_ABSOLUTE 0x0000 // No relocation required -#define IMAGE_REL_M32R_ADDR32 0x0001 // 32 bit address -#define IMAGE_REL_M32R_ADDR32NB 0x0002 // 32 bit address w/o image base -#define IMAGE_REL_M32R_ADDR24 0x0003 // 24 bit address -#define IMAGE_REL_M32R_GPREL16 0x0004 // GP relative addressing -#define IMAGE_REL_M32R_PCREL24 0x0005 // 24 bit offset << 2 & sign ext. -#define IMAGE_REL_M32R_PCREL16 0x0006 // 16 bit offset << 2 & sign ext. -#define IMAGE_REL_M32R_PCREL8 0x0007 // 8 bit offset << 2 & sign ext. -#define IMAGE_REL_M32R_REFHALF 0x0008 // 16 MSBs -#define IMAGE_REL_M32R_REFHI 0x0009 // 16 MSBs; adj for LSB sign ext. -#define IMAGE_REL_M32R_REFLO 0x000A // 16 LSBs -#define IMAGE_REL_M32R_PAIR 0x000B // Link HI and LO -#define IMAGE_REL_M32R_SECTION 0x000C // Section table index -#define IMAGE_REL_M32R_SECREL32 0x000D // 32 bit section relative reference -#define IMAGE_REL_M32R_TOKEN 0x000E // clr token - -#define IMAGE_REL_EBC_ABSOLUTE 0x0000 // No relocation required -#define IMAGE_REL_EBC_ADDR32NB 0x0001 // 32 bit address w/o image base -#define IMAGE_REL_EBC_REL32 0x0002 // 32-bit relative address from byte following reloc -#define IMAGE_REL_EBC_SECTION 0x0003 // Section table index -#define IMAGE_REL_EBC_SECREL 0x0004 // Offset within section - -#define EXT_IMM64(Value, Address, Size, InstPos, ValPos) /* Intel-IA64-Filler */ \ - Value |= (((ULONGLONG)((*(Address) >> InstPos) & (((ULONGLONG)1 << Size) - 1))) << ValPos) // Intel-IA64-Filler - -#define INS_IMM64(Value, Address, Size, InstPos, ValPos) /* Intel-IA64-Filler */\ - *(PULONG)Address = (*(PULONG)Address & ~(((1 << Size) - 1) << InstPos)) | /* Intel-IA64-Filler */\ - ((ULONG)((((ULONGLONG)Value >> ValPos) & (((ULONGLONG)1 << Size) - 1))) << InstPos) // Intel-IA64-Filler - -#define EMARCH_ENC_I17_IMM7B_INST_WORD_X 3 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM7B_SIZE_X 7 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM7B_INST_WORD_POS_X 4 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM7B_VAL_POS_X 0 // Intel-IA64-Filler - -#define EMARCH_ENC_I17_IMM9D_INST_WORD_X 3 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM9D_SIZE_X 9 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM9D_INST_WORD_POS_X 18 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM9D_VAL_POS_X 7 // Intel-IA64-Filler - -#define EMARCH_ENC_I17_IMM5C_INST_WORD_X 3 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM5C_SIZE_X 5 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X 13 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM5C_VAL_POS_X 16 // Intel-IA64-Filler - -#define EMARCH_ENC_I17_IC_INST_WORD_X 3 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IC_SIZE_X 1 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IC_INST_WORD_POS_X 12 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IC_VAL_POS_X 21 // Intel-IA64-Filler - -#define EMARCH_ENC_I17_IMM41a_INST_WORD_X 1 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM41a_SIZE_X 10 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM41a_INST_WORD_POS_X 14 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM41a_VAL_POS_X 22 // Intel-IA64-Filler - -#define EMARCH_ENC_I17_IMM41b_INST_WORD_X 1 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM41b_SIZE_X 8 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM41b_INST_WORD_POS_X 24 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM41b_VAL_POS_X 32 // Intel-IA64-Filler - -#define EMARCH_ENC_I17_IMM41c_INST_WORD_X 2 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM41c_SIZE_X 23 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM41c_INST_WORD_POS_X 0 // Intel-IA64-Filler -#define EMARCH_ENC_I17_IMM41c_VAL_POS_X 40 // Intel-IA64-Filler - -#define EMARCH_ENC_I17_SIGN_INST_WORD_X 3 // Intel-IA64-Filler -#define EMARCH_ENC_I17_SIGN_SIZE_X 1 // Intel-IA64-Filler -#define EMARCH_ENC_I17_SIGN_INST_WORD_POS_X 27 // Intel-IA64-Filler -#define EMARCH_ENC_I17_SIGN_VAL_POS_X 63 // Intel-IA64-Filler - -#define X3_OPCODE_INST_WORD_X 3 // Intel-IA64-Filler -#define X3_OPCODE_SIZE_X 4 // Intel-IA64-Filler -#define X3_OPCODE_INST_WORD_POS_X 28 // Intel-IA64-Filler -#define X3_OPCODE_SIGN_VAL_POS_X 0 // Intel-IA64-Filler - -#define X3_I_INST_WORD_X 3 // Intel-IA64-Filler -#define X3_I_SIZE_X 1 // Intel-IA64-Filler -#define X3_I_INST_WORD_POS_X 27 // Intel-IA64-Filler -#define X3_I_SIGN_VAL_POS_X 59 // Intel-IA64-Filler - -#define X3_D_WH_INST_WORD_X 3 // Intel-IA64-Filler -#define X3_D_WH_SIZE_X 3 // Intel-IA64-Filler -#define X3_D_WH_INST_WORD_POS_X 24 // Intel-IA64-Filler -#define X3_D_WH_SIGN_VAL_POS_X 0 // Intel-IA64-Filler - -#define X3_IMM20_INST_WORD_X 3 // Intel-IA64-Filler -#define X3_IMM20_SIZE_X 20 // Intel-IA64-Filler -#define X3_IMM20_INST_WORD_POS_X 4 // Intel-IA64-Filler -#define X3_IMM20_SIGN_VAL_POS_X 0 // Intel-IA64-Filler - -#define X3_IMM39_1_INST_WORD_X 2 // Intel-IA64-Filler -#define X3_IMM39_1_SIZE_X 23 // Intel-IA64-Filler -#define X3_IMM39_1_INST_WORD_POS_X 0 // Intel-IA64-Filler -#define X3_IMM39_1_SIGN_VAL_POS_X 36 // Intel-IA64-Filler - -#define X3_IMM39_2_INST_WORD_X 1 // Intel-IA64-Filler -#define X3_IMM39_2_SIZE_X 16 // Intel-IA64-Filler -#define X3_IMM39_2_INST_WORD_POS_X 16 // Intel-IA64-Filler -#define X3_IMM39_2_SIGN_VAL_POS_X 20 // Intel-IA64-Filler - -#define X3_P_INST_WORD_X 3 // Intel-IA64-Filler -#define X3_P_SIZE_X 4 // Intel-IA64-Filler -#define X3_P_INST_WORD_POS_X 0 // Intel-IA64-Filler -#define X3_P_SIGN_VAL_POS_X 0 // Intel-IA64-Filler - -#define X3_TMPLT_INST_WORD_X 0 // Intel-IA64-Filler -#define X3_TMPLT_SIZE_X 4 // Intel-IA64-Filler -#define X3_TMPLT_INST_WORD_POS_X 0 // Intel-IA64-Filler -#define X3_TMPLT_SIGN_VAL_POS_X 0 // Intel-IA64-Filler - -#define X3_BTYPE_QP_INST_WORD_X 2 // Intel-IA64-Filler -#define X3_BTYPE_QP_SIZE_X 9 // Intel-IA64-Filler -#define X3_BTYPE_QP_INST_WORD_POS_X 23 // Intel-IA64-Filler -#define X3_BTYPE_QP_INST_VAL_POS_X 0 // Intel-IA64-Filler - -#define X3_EMPTY_INST_WORD_X 1 // Intel-IA64-Filler -#define X3_EMPTY_SIZE_X 2 // Intel-IA64-Filler -#define X3_EMPTY_INST_WORD_POS_X 14 // Intel-IA64-Filler -#define X3_EMPTY_INST_VAL_POS_X 0 // Intel-IA64-Filler - -// -// Line number format. -// - -typedef struct _IMAGE_LINENUMBER { - union { - ULONG SymbolTableIndex; // Symbol table index of function name if Linenumber is 0. - ULONG VirtualAddress; // Virtual address of line number. - } Type; - USHORT Linenumber; // Line number. -} IMAGE_LINENUMBER; -typedef IMAGE_LINENUMBER UNALIGNED *PIMAGE_LINENUMBER; - -#ifndef _MAC -#include "poppack.h" // Back to 4 byte packing -#endif - -// -// Based relocation format. -// - -typedef struct _IMAGE_BASE_RELOCATION { - ULONG VirtualAddress; - ULONG SizeOfBlock; -// USHORT TypeOffset[1]; -} IMAGE_BASE_RELOCATION; -typedef IMAGE_BASE_RELOCATION UNALIGNED * PIMAGE_BASE_RELOCATION; - -// -// Based relocation types. -// - -#define IMAGE_REL_BASED_ABSOLUTE 0 -#define IMAGE_REL_BASED_HIGH 1 -#define IMAGE_REL_BASED_LOW 2 -#define IMAGE_REL_BASED_HIGHLOW 3 -#define IMAGE_REL_BASED_HIGHADJ 4 -#define IMAGE_REL_BASED_MIPS_JMPADDR 5 -// end_winnt -#define IMAGE_REL_BASED_SECTION 6 -#define IMAGE_REL_BASED_REL32 7 -// IMAGE_REL_BASED_VXD_RELATIVE 8 -// begin_winnt -#define IMAGE_REL_BASED_MIPS_JMPADDR16 9 -#define IMAGE_REL_BASED_IA64_IMM64 9 -#define IMAGE_REL_BASED_DIR64 10 - - -// -// Archive format. -// - -#define IMAGE_ARCHIVE_START_SIZE 8 -#define IMAGE_ARCHIVE_START "!\n" -#define IMAGE_ARCHIVE_END "`\n" -#define IMAGE_ARCHIVE_PAD "\n" -#define IMAGE_ARCHIVE_LINKER_MEMBER "/ " -#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " - -typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { - UCHAR Name[16]; // File member name - `/' terminated. - UCHAR Date[12]; // File member date - decimal. - UCHAR UserID[6]; // File member user id - decimal. - UCHAR GroupID[6]; // File member group id - decimal. - UCHAR Mode[8]; // File member mode - octal. - UCHAR Size[10]; // File member size - decimal. - UCHAR EndHeader[2]; // String to end header. -} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; - -#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 - -// -// DLL support. -// - -// -// Export Format -// - -typedef struct _IMAGE_EXPORT_DIRECTORY { - ULONG Characteristics; - ULONG TimeDateStamp; - USHORT MajorVersion; - USHORT MinorVersion; - ULONG Name; - ULONG Base; - ULONG NumberOfFunctions; - ULONG NumberOfNames; - ULONG AddressOfFunctions; // RVA from base of image - ULONG AddressOfNames; // RVA from base of image - ULONG AddressOfNameOrdinals; // RVA from base of image -} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; - -// -// Import Format -// - -typedef struct _IMAGE_IMPORT_BY_NAME { - USHORT Hint; - UCHAR Name[1]; -} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME; - -#include "pshpack8.h" // Use align 8 for the 64-bit IAT. - -typedef struct _IMAGE_THUNK_DATA64 { - union { - ULONGLONG ForwarderString; // PUCHAR - ULONGLONG Function; // PULONG - ULONGLONG Ordinal; - ULONGLONG AddressOfData; // PIMAGE_IMPORT_BY_NAME - } u1; -} IMAGE_THUNK_DATA64; -typedef IMAGE_THUNK_DATA64 * PIMAGE_THUNK_DATA64; - -#include "poppack.h" // Back to 4 byte packing - -typedef struct _IMAGE_THUNK_DATA32 { - union { - ULONG ForwarderString; // PUCHAR - ULONG Function; // PULONG - ULONG Ordinal; - ULONG AddressOfData; // PIMAGE_IMPORT_BY_NAME - } u1; -} IMAGE_THUNK_DATA32; -typedef IMAGE_THUNK_DATA32 * PIMAGE_THUNK_DATA32; - -#define IMAGE_ORDINAL_FLAG64 0x8000000000000000 -#define IMAGE_ORDINAL_FLAG32 0x80000000 -#define IMAGE_ORDINAL64(Ordinal) (Ordinal & 0xffff) -#define IMAGE_ORDINAL32(Ordinal) (Ordinal & 0xffff) -#define IMAGE_SNAP_BY_ORDINAL64(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG64) != 0) -#define IMAGE_SNAP_BY_ORDINAL32(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG32) != 0) - -// -// Thread Local Storage -// - -typedef VOID -(NTAPI *PIMAGE_TLS_CALLBACK) ( - PVOID DllHandle, - ULONG Reason, - PVOID Reserved - ); - -typedef struct _IMAGE_TLS_DIRECTORY64 { - ULONGLONG StartAddressOfRawData; - ULONGLONG EndAddressOfRawData; - ULONGLONG AddressOfIndex; // PULONG - ULONGLONG AddressOfCallBacks; // PIMAGE_TLS_CALLBACK *; - ULONG SizeOfZeroFill; - ULONG Characteristics; -} IMAGE_TLS_DIRECTORY64; -typedef IMAGE_TLS_DIRECTORY64 * PIMAGE_TLS_DIRECTORY64; - -typedef struct _IMAGE_TLS_DIRECTORY32 { - ULONG StartAddressOfRawData; - ULONG EndAddressOfRawData; - ULONG AddressOfIndex; // PULONG - ULONG AddressOfCallBacks; // PIMAGE_TLS_CALLBACK * - ULONG SizeOfZeroFill; - ULONG Characteristics; -} IMAGE_TLS_DIRECTORY32; -typedef IMAGE_TLS_DIRECTORY32 * PIMAGE_TLS_DIRECTORY32; - -#ifdef _WIN64 -#define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64 -#define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal) -typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA; -typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA; -#define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal) -typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY; -typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY; -#else -#define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32 -#define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal) -typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA; -typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA; -#define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal) -typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY; -typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY; -#endif - -typedef struct _IMAGE_IMPORT_DESCRIPTOR { - union { - ULONG Characteristics; // 0 for terminating null import descriptor - ULONG OriginalFirstThunk; // RVA to original unbound IAT (PIMAGE_THUNK_DATA) - } DUMMYUNIONNAME; - ULONG TimeDateStamp; // 0 if not bound, - // -1 if bound, and real date\time stamp - // in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT (new BIND) - // O.W. date/time stamp of DLL bound to (Old BIND) - - ULONG ForwarderChain; // -1 if no forwarders - ULONG Name; - ULONG FirstThunk; // RVA to IAT (if bound this IAT has actual addresses) -} IMAGE_IMPORT_DESCRIPTOR; -typedef IMAGE_IMPORT_DESCRIPTOR UNALIGNED *PIMAGE_IMPORT_DESCRIPTOR; - -// -// New format import descriptors pointed to by DataDirectory[ IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT ] -// - -typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR { - ULONG TimeDateStamp; - USHORT OffsetModuleName; - USHORT NumberOfModuleForwarderRefs; -// Array of zero or more IMAGE_BOUND_FORWARDER_REF follows -} IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR; - -typedef struct _IMAGE_BOUND_FORWARDER_REF { - ULONG TimeDateStamp; - USHORT OffsetModuleName; - USHORT Reserved; -} IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF; - -// -// Resource Format. -// - -// -// Resource directory consists of two counts, following by a variable length -// array of directory entries. The first count is the number of entries at -// beginning of the array that have actual names associated with each entry. -// The entries are in ascending order, case insensitive strings. The second -// count is the number of entries that immediately follow the named entries. -// This second count identifies the number of entries that have 16-bit integer -// Ids as their name. These entries are also sorted in ascending order. -// -// This structure allows fast lookup by either name or number, but for any -// given resource entry only one form of lookup is supported, not both. -// This is consistant with the syntax of the .RC file and the .RES file. -// - -typedef struct _IMAGE_RESOURCE_DIRECTORY { - ULONG Characteristics; - ULONG TimeDateStamp; - USHORT MajorVersion; - USHORT MinorVersion; - USHORT NumberOfNamedEntries; - USHORT NumberOfIdEntries; -// IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; -} IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY; - -#define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000 -#define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000 -// -// Each directory contains the 32-bit Name of the entry and an offset, -// relative to the beginning of the resource directory of the data associated -// with this directory entry. If the name of the entry is an actual text -// string instead of an integer Id, then the high order bit of the name field -// is set to one and the low order 31-bits are an offset, relative to the -// beginning of the resource directory of the string, which is of type -// IMAGE_RESOURCE_DIRECTORY_STRING. Otherwise the high bit is clear and the -// low-order 16-bits are the integer Id that identify this resource directory -// entry. If the directory entry is yet another resource directory (i.e. a -// subdirectory), then the high order bit of the offset field will be -// set to indicate this. Otherwise the high bit is clear and the offset -// field points to a resource data entry. -// - -typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY { - union { - struct { - ULONG NameOffset:31; - ULONG NameIsString:1; - } DUMMYSTRUCTNAME; - ULONG Name; - USHORT Id; - } DUMMYUNIONNAME; - union { - ULONG OffsetToData; - struct { - ULONG OffsetToDirectory:31; - ULONG DataIsDirectory:1; - } DUMMYSTRUCTNAME2; - } DUMMYUNIONNAME2; -} IMAGE_RESOURCE_DIRECTORY_ENTRY, *PIMAGE_RESOURCE_DIRECTORY_ENTRY; - -// -// For resource directory entries that have actual string names, the Name -// field of the directory entry points to an object of the following type. -// All of these string objects are stored together after the last resource -// directory entry and before the first resource data object. This minimizes -// the impact of these variable length objects on the alignment of the fixed -// size directory entry objects. -// - -typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING { - USHORT Length; - CHAR NameString[ 1 ]; -} IMAGE_RESOURCE_DIRECTORY_STRING, *PIMAGE_RESOURCE_DIRECTORY_STRING; - - -typedef struct _IMAGE_RESOURCE_DIR_STRING_U { - USHORT Length; - WCHAR NameString[ 1 ]; -} IMAGE_RESOURCE_DIR_STRING_U, *PIMAGE_RESOURCE_DIR_STRING_U; - - -// -// Each resource data entry describes a leaf node in the resource directory -// tree. It contains an offset, relative to the beginning of the resource -// directory of the data for the resource, a size field that gives the number -// of bytes of data at that offset, a CodePage that should be used when -// decoding code point values within the resource data. Typically for new -// applications the code page would be the unicode code page. -// - -typedef struct _IMAGE_RESOURCE_DATA_ENTRY { - ULONG OffsetToData; - ULONG Size; - ULONG CodePage; - ULONG Reserved; -} IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY; - -// -// Load Configuration Directory Entry -// - -typedef struct { - ULONG Size; - ULONG TimeDateStamp; - USHORT MajorVersion; - USHORT MinorVersion; - ULONG GlobalFlagsClear; - ULONG GlobalFlagsSet; - ULONG CriticalSectionDefaultTimeout; - ULONG DeCommitFreeBlockThreshold; - ULONG DeCommitTotalFreeThreshold; - ULONG LockPrefixTable; // VA - ULONG MaximumAllocationSize; - ULONG VirtualMemoryThreshold; - ULONG ProcessHeapFlags; - ULONG ProcessAffinityMask; - USHORT CSDVersion; - USHORT Reserved1; - ULONG EditList; // VA - ULONG SecurityCookie; // VA - ULONG SEHandlerTable; // VA - ULONG SEHandlerCount; -} IMAGE_LOAD_CONFIG_DIRECTORY32, *PIMAGE_LOAD_CONFIG_DIRECTORY32; - -typedef struct { - ULONG Size; - ULONG TimeDateStamp; - USHORT MajorVersion; - USHORT MinorVersion; - ULONG GlobalFlagsClear; - ULONG GlobalFlagsSet; - ULONG CriticalSectionDefaultTimeout; - ULONGLONG DeCommitFreeBlockThreshold; - ULONGLONG DeCommitTotalFreeThreshold; - ULONGLONG LockPrefixTable; // VA - ULONGLONG MaximumAllocationSize; - ULONGLONG VirtualMemoryThreshold; - ULONGLONG ProcessAffinityMask; - ULONG ProcessHeapFlags; - USHORT CSDVersion; - USHORT Reserved1; - ULONGLONG EditList; // VA - ULONGLONG SecurityCookie; // VA - ULONGLONG SEHandlerTable; // VA - ULONGLONG SEHandlerCount; -} IMAGE_LOAD_CONFIG_DIRECTORY64, *PIMAGE_LOAD_CONFIG_DIRECTORY64; - -#ifdef _WIN64 -typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY; -typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY; -#else -typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY; -typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY; -#endif - -// -// WIN CE Exception table format -// - -// -// Function table entry format. Function table is pointed to by the -// IMAGE_DIRECTORY_ENTRY_EXCEPTION directory entry. -// - -typedef struct _IMAGE_CE_RUNTIME_FUNCTION_ENTRY { - ULONG FuncStart; - ULONG PrologLen : 8; - ULONG FuncLen : 22; - ULONG ThirtyTwoBit : 1; - ULONG ExceptionFlag : 1; -} IMAGE_CE_RUNTIME_FUNCTION_ENTRY, * PIMAGE_CE_RUNTIME_FUNCTION_ENTRY; - -typedef struct _IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY { - ULONGLONG BeginAddress; - ULONGLONG EndAddress; - ULONGLONG ExceptionHandler; - ULONGLONG HandlerData; - ULONGLONG PrologEndAddress; -} IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY, *PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY; - -typedef struct _IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY { - ULONG BeginAddress; - ULONG EndAddress; - ULONG ExceptionHandler; - ULONG HandlerData; - ULONG PrologEndAddress; -} IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY, *PIMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY; - -typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY { - ULONG BeginAddress; - ULONG EndAddress; - ULONG UnwindInfoAddress; -} _IMAGE_RUNTIME_FUNCTION_ENTRY, *_PIMAGE_RUNTIME_FUNCTION_ENTRY; - -typedef _IMAGE_RUNTIME_FUNCTION_ENTRY IMAGE_IA64_RUNTIME_FUNCTION_ENTRY; -typedef _PIMAGE_RUNTIME_FUNCTION_ENTRY PIMAGE_IA64_RUNTIME_FUNCTION_ENTRY; - -#if defined(_AXP64_) - -typedef IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY IMAGE_AXP64_RUNTIME_FUNCTION_ENTRY; -typedef PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY PIMAGE_AXP64_RUNTIME_FUNCTION_ENTRY; -typedef IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY IMAGE_RUNTIME_FUNCTION_ENTRY; -typedef PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY PIMAGE_RUNTIME_FUNCTION_ENTRY; - -#elif defined(_ALPHA_) - -typedef IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY IMAGE_RUNTIME_FUNCTION_ENTRY; -typedef PIMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY PIMAGE_RUNTIME_FUNCTION_ENTRY; - -#else - -typedef _IMAGE_RUNTIME_FUNCTION_ENTRY IMAGE_RUNTIME_FUNCTION_ENTRY; -typedef _PIMAGE_RUNTIME_FUNCTION_ENTRY PIMAGE_RUNTIME_FUNCTION_ENTRY; - -#endif - -// -// Debug Format -// - -typedef struct _IMAGE_DEBUG_DIRECTORY { - ULONG Characteristics; - ULONG TimeDateStamp; - USHORT MajorVersion; - USHORT MinorVersion; - ULONG Type; - ULONG SizeOfData; - ULONG AddressOfRawData; - ULONG PointerToRawData; -} IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY; - -#define IMAGE_DEBUG_TYPE_UNKNOWN 0 -#define IMAGE_DEBUG_TYPE_COFF 1 -#define IMAGE_DEBUG_TYPE_CODEVIEW 2 -#define IMAGE_DEBUG_TYPE_FPO 3 -#define IMAGE_DEBUG_TYPE_MISC 4 -#define IMAGE_DEBUG_TYPE_EXCEPTION 5 -#define IMAGE_DEBUG_TYPE_FIXUP 6 -#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7 -#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8 -#define IMAGE_DEBUG_TYPE_BORLAND 9 -#define IMAGE_DEBUG_TYPE_RESERVED10 10 -#define IMAGE_DEBUG_TYPE_CLSID 11 - -// end_winnt - -// IMAGE_DEBUG_TYPE values > 0x7FFFFFFF are reserved for BBT - -// begin_winnt - -typedef struct _IMAGE_COFF_SYMBOLS_HEADER { - ULONG NumberOfSymbols; - ULONG LvaToFirstSymbol; - ULONG NumberOfLinenumbers; - ULONG LvaToFirstLinenumber; - ULONG RvaToFirstByteOfCode; - ULONG RvaToLastByteOfCode; - ULONG RvaToFirstByteOfData; - ULONG RvaToLastByteOfData; -} IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER; - -#define FRAME_FPO 0 -#define FRAME_TRAP 1 -#define FRAME_TSS 2 -#define FRAME_NONFPO 3 - -typedef struct _FPO_DATA { - ULONG ulOffStart; // offset 1st byte of function code - ULONG cbProcSize; // # bytes in function - ULONG cdwLocals; // # bytes in locals/4 - USHORT cdwParams; // # bytes in params/4 - USHORT cbProlog : 8; // # bytes in prolog - USHORT cbRegs : 3; // # regs saved - USHORT fHasSEH : 1; // TRUE if SEH in func - USHORT fUseBP : 1; // TRUE if EBP has been allocated - USHORT reserved : 1; // reserved for future use - USHORT cbFrame : 2; // frame type -} FPO_DATA, *PFPO_DATA; -#define SIZEOF_RFPO_DATA 16 - - -#define IMAGE_DEBUG_MISC_EXENAME 1 - -typedef struct _IMAGE_DEBUG_MISC { - ULONG DataType; // type of misc data, see defines - ULONG Length; // total length of record, rounded to four - // byte multiple. - BOOLEAN Unicode; // TRUE if data is unicode string - UCHAR Reserved[ 3 ]; - UCHAR Data[ 1 ]; // Actual data -} IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC; - - -// -// Function table extracted from MIPS/ALPHA/IA64 images. Does not contain -// information needed only for runtime support. Just those fields for -// each entry needed by a debugger. -// - -typedef struct _IMAGE_FUNCTION_ENTRY { - ULONG StartingAddress; - ULONG EndingAddress; - ULONG EndOfPrologue; -} IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY; - -typedef struct _IMAGE_FUNCTION_ENTRY64 { - ULONGLONG StartingAddress; - ULONGLONG EndingAddress; - union { - ULONGLONG EndOfPrologue; - ULONGLONG UnwindInfoAddress; - } DUMMYUNIONNAME; -} IMAGE_FUNCTION_ENTRY64, *PIMAGE_FUNCTION_ENTRY64; - -// -// Debugging information can be stripped from an image file and placed -// in a separate .DBG file, whose file name part is the same as the -// image file name part (e.g. symbols for CMD.EXE could be stripped -// and placed in CMD.DBG). This is indicated by the IMAGE_FILE_DEBUG_STRIPPED -// flag in the Characteristics field of the file header. The beginning of -// the .DBG file contains the following structure which captures certain -// information from the image file. This allows a debug to proceed even if -// the original image file is not accessable. This header is followed by -// zero of more IMAGE_SECTION_HEADER structures, followed by zero or more -// IMAGE_DEBUG_DIRECTORY structures. The latter structures and those in -// the image file contain file offsets relative to the beginning of the -// .DBG file. -// -// If symbols have been stripped from an image, the IMAGE_DEBUG_MISC structure -// is left in the image file, but not mapped. This allows a debugger to -// compute the name of the .DBG file, from the name of the image in the -// IMAGE_DEBUG_MISC structure. -// - -typedef struct _IMAGE_SEPARATE_DEBUG_HEADER { - USHORT Signature; - USHORT Flags; - USHORT Machine; - USHORT Characteristics; - ULONG TimeDateStamp; - ULONG CheckSum; - ULONG ImageBase; - ULONG SizeOfImage; - ULONG NumberOfSections; - ULONG ExportedNamesSize; - ULONG DebugDirectorySize; - ULONG SectionAlignment; - ULONG Reserved[2]; -} IMAGE_SEPARATE_DEBUG_HEADER, *PIMAGE_SEPARATE_DEBUG_HEADER; - -typedef struct _NON_PAGED_DEBUG_INFO { - USHORT Signature; - USHORT Flags; - ULONG Size; - USHORT Machine; - USHORT Characteristics; - ULONG TimeDateStamp; - ULONG CheckSum; - ULONG SizeOfImage; - ULONGLONG ImageBase; - //DebugDirectorySize - //IMAGE_DEBUG_DIRECTORY -} NON_PAGED_DEBUG_INFO, *PNON_PAGED_DEBUG_INFO; - -#ifndef _MAC -#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944 -#define NON_PAGED_DEBUG_SIGNATURE 0x494E -#else -#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4449 // DI -#define NON_PAGED_DEBUG_SIGNATURE 0x4E49 // NI -#endif - -#define IMAGE_SEPARATE_DEBUG_FLAGS_MASK 0x8000 -#define IMAGE_SEPARATE_DEBUG_MISMATCH 0x8000 // when DBG was updated, the - // old checksum didn't match. - -// -// The .arch section is made up of headers, each describing an amask position/value -// pointing to an array of IMAGE_ARCHITECTURE_ENTRY's. Each "array" (both the header -// and entry arrays) are terminiated by a quadword of 0xffffffffL. -// -// NOTE: There may be quadwords of 0 sprinkled around and must be skipped. -// - -typedef struct _ImageArchitectureHeader { - unsigned int AmaskValue: 1; // 1 -> code section depends on mask bit - // 0 -> new instruction depends on mask bit - int :7; // MBZ - unsigned int AmaskShift: 8; // Amask bit in question for this fixup - int :16; // MBZ - ULONG FirstEntryRVA; // RVA into .arch section to array of ARCHITECTURE_ENTRY's -} IMAGE_ARCHITECTURE_HEADER, *PIMAGE_ARCHITECTURE_HEADER; - -typedef struct _ImageArchitectureEntry { - ULONG FixupInstRVA; // RVA of instruction to fixup - ULONG NewInst; // fixup instruction (see alphaops.h) -} IMAGE_ARCHITECTURE_ENTRY, *PIMAGE_ARCHITECTURE_ENTRY; - -#include "poppack.h" // Back to the initial value - -// The following structure defines the new import object. Note the values of the first two fields, -// which must be set as stated in order to differentiate old and new import members. -// Following this structure, the linker emits two null-terminated strings used to recreate the -// import at the time of use. The first string is the import's name, the second is the dll's name. - -#define IMPORT_OBJECT_HDR_SIG2 0xffff - -typedef struct IMPORT_OBJECT_HEADER { - USHORT Sig1; // Must be IMAGE_FILE_MACHINE_UNKNOWN - USHORT Sig2; // Must be IMPORT_OBJECT_HDR_SIG2. - USHORT Version; - USHORT Machine; - ULONG TimeDateStamp; // Time/date stamp - ULONG SizeOfData; // particularly useful for incremental links - - union { - USHORT Ordinal; // if grf & IMPORT_OBJECT_ORDINAL - USHORT Hint; - } DUMMYUNIONNAME; - - USHORT Type : 2; // IMPORT_TYPE - USHORT NameType : 3; // IMPORT_NAME_TYPE - USHORT Reserved : 11; // Reserved. Must be zero. -} IMPORT_OBJECT_HEADER; - -typedef enum IMPORT_OBJECT_TYPE -{ - IMPORT_OBJECT_CODE = 0, - IMPORT_OBJECT_DATA = 1, - IMPORT_OBJECT_CONST = 2, -} IMPORT_OBJECT_TYPE; - -typedef enum IMPORT_OBJECT_NAME_TYPE -{ - IMPORT_OBJECT_ORDINAL = 0, // Import by ordinal - IMPORT_OBJECT_NAME = 1, // Import name == public symbol name. - IMPORT_OBJECT_NAME_NO_PREFIX = 2, // Import name == public symbol name skipping leading ?, @, or optionally _. - IMPORT_OBJECT_NAME_UNDECORATE = 3, // Import name == public symbol name skipping leading ?, @, or optionally _ - // and truncating at first @ -} IMPORT_OBJECT_NAME_TYPE; - -// end_winnt - -// The structure is used by the NT loader for clr URT support. It -// is a duplicate of the definition in corhdr.h. - -// begin_winnt - -#ifndef __IMAGE_COR20_HEADER_DEFINED__ -#define __IMAGE_COR20_HEADER_DEFINED__ - -typedef enum ReplacesCorHdrNumericDefines -{ -// COM+ Header entry point flags. - COMIMAGE_FLAGS_ILONLY =0x00000001, - COMIMAGE_FLAGS_32BITREQUIRED =0x00000002, - COMIMAGE_FLAGS_IL_LIBRARY =0x00000004, - COMIMAGE_FLAGS_STRONGNAMESIGNED =0x00000008, - COMIMAGE_FLAGS_NATIVE_ENTRYPOINT =0x00000010, - COMIMAGE_FLAGS_TRACKDEBUGDATA =0x00010000, - -// Version flags for image. - COR_VERSION_MAJOR_V2 =2, - COR_VERSION_MAJOR =COR_VERSION_MAJOR_V2, - COR_VERSION_MINOR =0, - COR_DELETED_NAME_LENGTH =8, - COR_VTABLEGAP_NAME_LENGTH =8, - -// Maximum size of a NativeType descriptor. - NATIVE_TYPE_MAX_CB =1, - COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE=0xFF, - -// #defines for the MIH FLAGS - IMAGE_COR_MIH_METHODRVA =0x01, - IMAGE_COR_MIH_EHRVA =0x02, - IMAGE_COR_MIH_BASICBLOCK =0x08, - -// V-table constants - COR_VTABLE_32BIT =0x01, // V-table slots are 32-bits in size. - COR_VTABLE_64BIT =0x02, // V-table slots are 64-bits in size. - COR_VTABLE_FROM_UNMANAGED =0x04, // If set, transition from unmanaged. - COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN =0x08, // If set, transition from unmanaged with keeping the current appdomain. - COR_VTABLE_CALL_MOST_DERIVED =0x10, // Call most derived method described by - -// EATJ constants - IMAGE_COR_EATJ_THUNK_SIZE =32, // Size of a jump thunk reserved range. - -// Max name lengths - //@todo: Change to unlimited name lengths. - MAX_CLASS_NAME =1024, - MAX_PACKAGE_NAME =1024, -} ReplacesCorHdrNumericDefines; - -// CLR 2.0 header structure. -typedef struct IMAGE_COR20_HEADER -{ - // Header versioning - ULONG cb; - USHORT MajorRuntimeVersion; - USHORT MinorRuntimeVersion; - - // Symbol table and startup information - IMAGE_DATA_DIRECTORY MetaData; - ULONG Flags; - - // If COMIMAGE_FLAGS_NATIVE_ENTRYPOINT is not set, EntryPointToken represents a managed entrypoint. - // If COMIMAGE_FLAGS_NATIVE_ENTRYPOINT is set, EntryPointRVA represents an RVA to a native entrypoint. - union { - ULONG EntryPointToken; - ULONG EntryPointRVA; - } DUMMYUNIONNAME; - - // Binding information - IMAGE_DATA_DIRECTORY Resources; - IMAGE_DATA_DIRECTORY StrongNameSignature; - - // Regular fixup and binding information - IMAGE_DATA_DIRECTORY CodeManagerTable; - IMAGE_DATA_DIRECTORY VTableFixups; - IMAGE_DATA_DIRECTORY ExportAddressTableJumps; - - // Precompiled image info (internal use only - set to zero) - IMAGE_DATA_DIRECTORY ManagedNativeHeader; - -} IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER; - -#endif // __IMAGE_COR20_HEADER_DEFINED__ - -// -// End Image Format -// - -// end_winnt - -typedef IMAGE_OS2_HEADER UNALIGNED * PUIMAGE_OS2_HEADER; -typedef IMAGE_IMPORT_DESCRIPTOR UNALIGNED CONST *PCIMAGE_IMPORT_DESCRIPTOR; -typedef CONST IMAGE_BOUND_IMPORT_DESCRIPTOR *PCIMAGE_BOUND_IMPORT_DESCRIPTOR; -typedef CONST IMAGE_BOUND_FORWARDER_REF *PCIMAGE_BOUND_FORWARDER_REF; -typedef CONST IMAGE_IMPORT_BY_NAME *PCIMAGE_IMPORT_BY_NAME; -typedef CONST IMAGE_THUNK_DATA *PCIMAGE_THUNK_DATA; -typedef CONST IMAGE_THUNK_DATA32 *PCIMAGE_THUNK_DATA32; -typedef CONST IMAGE_THUNK_DATA64 *PCIMAGE_THUNK_DATA64; -typedef CONST IMAGE_TLS_DIRECTORY *PCIMAGE_TLS_DIRECTORY; -typedef CONST IMAGE_TLS_DIRECTORY32 *PCIMAGE_TLS_DIRECTORY32; -typedef CONST IMAGE_TLS_DIRECTORY64 *PCIMAGE_TLS_DIRECTORY64; -typedef CONST IMAGE_EXPORT_DIRECTORY *PCIMAGE_EXPORT_DIRECTORY; -typedef CONST IMAGE_SECTION_HEADER *PCIMAGE_SECTION_HEADER; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - -#endif // _NTIMAGE_ - diff --git a/pub/ddk/ntintsafe.h b/pub/ddk/ntintsafe.h deleted file mode 100644 index 0b75171..0000000 --- a/pub/ddk/ntintsafe.h +++ /dev/null @@ -1,8550 +0,0 @@ -/****************************************************************** -* * -* ntintsafe.h -- This module defines helper functions to prevent * -* integer overflow bugs for drivers. A similar * -* file, intsafe.h, is available for applications. * -* * -* Copyright (c) Microsoft Corp. All rights reserved. * -* * -******************************************************************/ -#ifndef _NTINTSAFE_H_INCLUDED_ -#define _NTINTSAFE_H_INCLUDED_ - -#if (_MSC_VER > 1000) -#pragma once -#endif - -#include // for __in, etc. - -#if !defined(_W64) -#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && (_MSC_VER >= 1300) -#define _W64 __w64 -#else -#define _W64 -#endif -#endif - -// -// typedefs -// -typedef char CHAR; -typedef signed char INT8; -typedef unsigned char UCHAR; -typedef unsigned char UINT8; -typedef unsigned char BYTE; -typedef short SHORT; -typedef signed short INT16; -typedef unsigned short USHORT; -typedef unsigned short UINT16; -typedef unsigned short WORD; -typedef int INT; -typedef signed int INT32; -typedef unsigned int UINT; -typedef unsigned int UINT32; -typedef long LONG; -typedef unsigned long ULONG; -typedef unsigned long DWORD; -typedef __int64 LONGLONG; -typedef __int64 LONG64; -typedef signed __int64 RtlINT64; -typedef unsigned __int64 ULONGLONG; -typedef unsigned __int64 DWORDLONG; -typedef unsigned __int64 ULONG64; -typedef unsigned __int64 DWORD64; -typedef unsigned __int64 UINT64; - -#if (__midl > 501) -typedef [public] __int3264 INT_PTR; -typedef [public] unsigned __int3264 UINT_PTR; -typedef [public] __int3264 LONG_PTR; -typedef [public] unsigned __int3264 ULONG_PTR; -#else -#ifdef _WIN64 -typedef __int64 INT_PTR; -typedef unsigned __int64 UINT_PTR; -typedef __int64 LONG_PTR; -typedef unsigned __int64 ULONG_PTR; -#else -typedef _W64 int INT_PTR; -typedef _W64 unsigned int UINT_PTR; -typedef _W64 long LONG_PTR; -typedef _W64 unsigned long ULONG_PTR; -#endif // WIN64 -#endif // (__midl > 501) - -#ifdef _WIN64 -typedef __int64 ptrdiff_t; -typedef unsigned __int64 size_t; -#else -typedef _W64 int ptrdiff_t; -typedef _W64 unsigned int size_t; -#endif - -typedef ULONG_PTR DWORD_PTR; -typedef LONG_PTR SSIZE_T; -typedef ULONG_PTR SIZE_T; - -#undef _USE_INTRINSIC_MULTIPLY128 - -#if !defined(_M_CEE) && (defined(_AMD64_) || (defined(_IA64_) && (_MSC_VER >= 1400))) -#define _USE_INTRINSIC_MULTIPLY128 -#endif - -#if defined(_USE_INTRINSIC_MULTIPLY128) -#ifdef __cplusplus -extern "C" { -#endif - -#define UnsignedMultiply128 _umul128 - -ULONG64 -UnsignedMultiply128( - __in ULONGLONG ullMultiplicand, - __in ULONGLONG ullMultiplier, - __out __deref_out_range(==, ullMultiplicand * ullMultiplier) ULONGLONG* pullResultHigh); -#pragma intrinsic(_umul128) - -#ifdef __cplusplus -} -#endif -#endif // _USE_INTRINSIC_MULTIPLY128 - - - -typedef __success(return >= 0) long NTSTATUS; - -#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0) - -#define STATUS_SUCCESS ((NTSTATUS)0x00000000L) -#ifndef SORTPP_PASS -// compiletime asserts (failure results in error C2118: negative subscript) -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#else -#define C_ASSERT(e) -#endif - -// -// UInt32x32To64 macro -// -#if defined(MIDL_PASS) || defined(RC_INVOKED) || defined(_M_CEE_PURE) \ - || defined(_68K_) || defined(_MPPC_) \ - || defined(_M_IA64) || defined(_M_AMD64) -#define UInt32x32To64(a, b) (((unsigned __int64)((unsigned int)(a))) * ((unsigned __int64)((unsigned int)(b)))) -#elif defined(_M_IX86) -#define UInt32x32To64(a, b) ((unsigned __int64)(((unsigned __int64)((unsigned int)(a))) * ((unsigned int)(b)))) -#else -#error Must define a target architecture. -#endif - -// -// Min/Max type values -// -#define INT8_MIN (-127i8 - 1) -#define SHORT_MIN (-32768) -#define INT16_MIN (-32767i16 - 1) -#define INT_MIN (-2147483647 - 1) -#define INT32_MIN (-2147483647i32 - 1) -#define LONG_MIN (-2147483647L - 1) -#define LONGLONG_MIN (-9223372036854775807i64 - 1) -#define LONG64_MIN (-9223372036854775807i64 - 1) -#define INT64_MIN (-9223372036854775807i64 - 1) -#define INT128_MIN (-170141183460469231731687303715884105727i128 - 1) - -#ifdef _WIN64 -#define INT_PTR_MIN (-9223372036854775807i64 - 1) -#define LONG_PTR_MIN (-9223372036854775807i64 - 1) -#define PTRDIFF_T_MIN (-9223372036854775807i64 - 1) -#define SSIZE_T_MIN (-9223372036854775807i64 - 1) -#else -#define INT_PTR_MIN (-2147483647 - 1) -#define LONG_PTR_MIN (-2147483647L - 1) -#define PTRDIFF_T_MIN (-2147483647 - 1) -#define SSIZE_T_MIN (-2147483647L - 1) -#endif - -#define INT8_MAX 127i8 -#define UINT8_MAX 0xffui8 -#define BYTE_MAX 0xff -#define SHORT_MAX 32767 -#define INT16_MAX 32767i16 -#define USHORT_MAX 0xffff -#define UINT16_MAX 0xffffui16 -#define WORD_MAX 0xffff -#define INT_MAX 2147483647 -#define INT32_MAX 2147483647i32 -#define UINT_MAX 0xffffffff -#define UINT32_MAX 0xffffffffui32 -#define LONG_MAX 2147483647L -#define ULONG_MAX 0xffffffffUL -#define DWORD_MAX 0xffffffffUL -#define LONGLONG_MAX 9223372036854775807i64 -#define LONG64_MAX 9223372036854775807i64 -#define INT64_MAX 9223372036854775807i64 -#define ULONGLONG_MAX 0xffffffffffffffffui64 -#define DWORDLONG_MAX 0xffffffffffffffffui64 -#define ULONG64_MAX 0xffffffffffffffffui64 -#define DWORD64_MAX 0xffffffffffffffffui64 -#define UINT64_MAX 0xffffffffffffffffui64 -#define INT128_MAX 170141183460469231731687303715884105727i128 -#define UINT128_MAX 0xffffffffffffffffffffffffffffffffui128 - -#undef SIZE_T_MAX - -#ifdef _WIN64 -#define INT_PTR_MAX 9223372036854775807i64 -#define UINT_PTR_MAX 0xffffffffffffffffui64 -#define LONG_PTR_MAX 9223372036854775807i64 -#define ULONG_PTR_MAX 0xffffffffffffffffui64 -#define DWORD_PTR_MAX 0xffffffffffffffffui64 -#define PTRDIFF_T_MAX 9223372036854775807i64 -#define SIZE_T_MAX 0xffffffffffffffffui64 -#define SSIZE_T_MAX 9223372036854775807i64 -#define _SIZE_T_MAX 0xffffffffffffffffui64 -#else -#define INT_PTR_MAX 2147483647 -#define UINT_PTR_MAX 0xffffffff -#define LONG_PTR_MAX 2147483647L -#define ULONG_PTR_MAX 0xffffffffUL -#define DWORD_PTR_MAX 0xffffffffUL -#define PTRDIFF_T_MAX 2147483647 -#define SIZE_T_MAX 0xffffffff -#define SSIZE_T_MAX 2147483647L -#define _SIZE_T_MAX 0xffffffffUL -#endif - - -// -// It is common for -1 to be used as an error value -// -#define INT8_ERROR (-1i8) -#define UINT8_ERROR 0xffui8 -#define BYTE_ERROR 0xff -#define SHORT_ERROR (-1) -#define INT16_ERROR (-1i16) -#define USHORT_ERROR 0xffff -#define UINT16_ERROR 0xffffui16 -#define WORD_ERROR 0xffff -#define INT_ERROR (-1) -#define INT32_ERROR (-1i32) -#define UINT_ERROR 0xffffffff -#define UINT32_ERROR 0xffffffffui32 -#define LONG_ERROR (-1L) -#define ULONG_ERROR 0xffffffffUL -#define DWORD_ERROR 0xffffffffUL -#define LONGLONG_ERROR (-1i64) -#define LONG64_ERROR (-1i64) -#define INT64_ERROR (-1i64) -#define ULONGLONG_ERROR 0xffffffffffffffffui64 -#define DWORDLONG_ERROR 0xffffffffffffffffui64 -#define ULONG64_ERROR 0xffffffffffffffffui64 -#define UINT64_ERROR 0xffffffffffffffffui64 - -#ifdef _WIN64 -#define INT_PTR_ERROR (-1i64) -#define UINT_PTR_ERROR 0xffffffffffffffffui64 -#define LONG_PTR_ERROR (-1i64) -#define ULONG_PTR_ERROR 0xffffffffffffffffui64 -#define DWORD_PTR_ERROR 0xffffffffffffffffui64 -#define PTRDIFF_T_ERROR (-1i64) -#define SIZE_T_ERROR 0xffffffffffffffffui64 -#define SSIZE_T_ERROR (-1i64) -#define _SIZE_T_ERROR 0xffffffffffffffffui64 -#else -#define INT_PTR_ERROR (-1) -#define UINT_PTR_ERROR 0xffffffff -#define LONG_PTR_ERROR (-1L) -#define ULONG_PTR_ERROR 0xffffffffUL -#define DWORD_PTR_ERROR 0xffffffffUL -#define PTRDIFF_T_ERROR (-1) -#define SIZE_T_ERROR 0xffffffff -#define SSIZE_T_ERROR (-1L) -#define _SIZE_T_ERROR 0xffffffffUL -#endif - - -// -// We make some assumptions about the sizes of various types. Let's be -// explicit about those assumptions and check them. -// -C_ASSERT(sizeof(USHORT) == 2); -C_ASSERT(sizeof(INT) == 4); -C_ASSERT(sizeof(UINT) == 4); -C_ASSERT(sizeof(LONG) == 4); -C_ASSERT(sizeof(ULONG) == 4); -C_ASSERT(sizeof(UINT_PTR) == sizeof(ULONG_PTR)); - - -//============================================================================= -// Conversion functions -// -// There are three reasons for having conversion functions: -// -// 1. We are converting from a signed type to an unsigned type of the same -// size, or vice-versa. -// -// Since we default to only having unsigned math functions, -// (see ENABLE_INTSAFE_SIGNED_FUNCTIONS below) we prefer people to convert -// to unsigned, do the math, and then convert back to signed. -// -// 2. We are converting to a smaller type, and we could therefore possibly -// overflow. -// -// 3. We are converting to a bigger type, and we are signed and the type we are -// converting to is unsigned. -// -//============================================================================= - - -// -// INT8 -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlInt8ToUChar( - __in INT8 i8Operand, - __out __deref_out_range(==, i8Operand) UCHAR* pch) -{ - NTSTATUS status; - - if (i8Operand >= 0) - { - *pch = (UCHAR)i8Operand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT8 -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlInt8ToUInt8( - __in INT8 i8Operand, - __out __deref_out_range(==, i8Operand) UINT8* pu8Result) -{ - NTSTATUS status; - - if (i8Operand >= 0) - { - *pu8Result = (UINT8)i8Operand; - status = STATUS_SUCCESS; - } - else - { - *pu8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT8 -> BYTE conversion -// -#define RtlInt8ToByte RtlInt8ToUInt8 - -// -// INT8 -> USHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlInt8ToUShort( - __in INT8 i8Operand, - __out __deref_out_range(==, i8Operand) USHORT* pusResult) -{ - NTSTATUS status; - - if (i8Operand >= 0) - { - *pusResult = (USHORT)i8Operand; - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT8 -> UINT16 conversion -// -#define RtlInt8ToUInt16 RtlInt8ToUShort - -// -// INT8 -> WORD conversion -// -#define RtlInt8ToWord RtlInt8ToUShort - -// -// INT8 -> UINT conversion -// -__checkReturn -__inline -NTSTATUS -RtlInt8ToUInt( - __in INT8 i8Operand, - __out __deref_out_range(==, i8Operand) UINT* puResult) -{ - NTSTATUS status; - - if (i8Operand >= 0) - { - *puResult = (UINT)i8Operand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT8 -> UINT32 conversion -// -#define RtlInt8ToUInt32 RtlInt8ToUInt - -// -// INT8 -> UINT_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlInt8ToUIntPtr( - __in INT8 i8Operand, - __out __deref_out_range(==, i8Operand) UINT_PTR* puResult) -{ - NTSTATUS status; - - if (i8Operand >= 0) - { - *puResult = (UINT_PTR)i8Operand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT8 -> ULONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlInt8ToULong( - __in INT8 i8Operand, - __out __deref_out_range(==, i8Operand) ULONG* pulResult) -{ - NTSTATUS status; - - if (i8Operand >= 0) - { - *pulResult = (ULONG)i8Operand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT8 -> ULONG_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlInt8ToULongPtr( - __in INT8 i8Operand, - __out __deref_out_range(==, i8Operand) ULONG_PTR* pulResult) -{ - NTSTATUS status; - - if (i8Operand >= 0) - { - *pulResult = (ULONG_PTR)i8Operand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT8 -> DWORD conversion -// -#define RtlInt8ToDWord RtlInt8ToULong - -// -// INT8 -> DWORD_PTR conversion -// -#define RtlInt8ToDWordPtr RtlInt8ToULongPtr - -// -// INT8 -> ULONGLONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlInt8ToULongLong( - __in INT8 i8Operand, - __out __deref_out_range(==, i8Operand) ULONGLONG* pullResult) -{ - NTSTATUS status; - - if (i8Operand >= 0) - { - *pullResult = (ULONGLONG)i8Operand; - status = STATUS_SUCCESS; - } - else - { - *pullResult = ULONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT8 -> DWORDLONG conversion -// -#define RtlInt8ToDWordLong RtlInt8ToULongLong - -// -// INT8 -> ULONG64 conversion -// -#define RtlInt8ToULong64 RtlInt8ToULongLong - -// -// INT8 -> DWORD64 conversion -// -#define RtlInt8ToDWord64 RtlInt8ToULongLong - -// -// INT8 -> UINT64 conversion -// -#define RtlInt8ToUInt64 RtlInt8ToULongLong - -// -// INT8 -> size_t conversion -// -#define RtlInt8ToSizeT RtlInt8ToUIntPtr - -// -// INT8 -> SIZE_T conversion -// -#define RtlInt8ToSIZET RtlInt8ToULongPtr - -// -// UINT8 -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlUInt8ToInt8( - __in UINT8 u8Operand, - __out __deref_out_range(==, u8Operand) INT8* pi8Result) -{ - NTSTATUS status; - - if (u8Operand <= INT8_MAX) - { - *pi8Result = (INT8)u8Operand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT8 -> CHAR conversion -// -__forceinline -NTSTATUS -RtlUInt8ToChar( - __in UINT8 u8Operand, - __out __deref_out_range(==, u8Operand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - *pch = (CHAR)u8Operand; - return STATUS_SUCCESS; -#else - return RtlUInt8ToInt8(u8Operand, (INT8*)pch); -#endif -} - -// -// BYTE -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlByteToInt8( - __in BYTE bOperand, - __out __deref_out_range(==, bOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if (bOperand <= INT8_MAX) - { - *pi8Result = (INT8)bOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// BYTE -> CHAR conversion -// -__forceinline -NTSTATUS -RtlByteToChar( - __in BYTE bOperand, - __out __deref_out_range(==, bOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - *pch = (CHAR)bOperand; - return STATUS_SUCCESS; -#else - return RtlByteToInt8(bOperand, (INT8*)pch); -#endif -} - -// -// SHORT -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlShortToInt8( - __in SHORT sOperand, - __out __deref_out_range(==, sOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if ((sOperand >= INT8_MIN) && (sOperand <= INT8_MAX)) - { - *pi8Result = (INT8)sOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// SHORT -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlShortToUChar( - __in SHORT sOperand, - __out __deref_out_range(==, sOperand) UCHAR* pch) -{ - NTSTATUS status; - - if ((sOperand >= 0) && (sOperand <= 255)) - { - *pch = (UCHAR)sOperand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// SHORT -> CHAR conversion -// -__forceinline -NTSTATUS -RtlShortToChar( - __in SHORT sOperand, - __out __deref_out_range(==, sOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - return RtlShortToUChar(sOperand, (UCHAR*)pch); -#else - return RtlShortToInt8(sOperand, (INT8*)pch); -#endif // _CHAR_UNSIGNED -} - -// -// SHORT -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlShortToUInt8( - __in SHORT sOperand, - __out __deref_out_range(==, sOperand) UINT8* pui8Result) -{ - NTSTATUS status; - - if ((sOperand >= 0) && (sOperand <= UINT8_MAX)) - { - *pui8Result = (UINT8)sOperand; - status = STATUS_SUCCESS; - } - else - { - *pui8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// SHORT -> BYTE conversion -// -#define RtlShortToByte RtlShortToUInt8 - -// -// SHORT -> USHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlShortToUShort( - __in SHORT sOperand, - __out __deref_out_range(==, sOperand) USHORT* pusResult) -{ - NTSTATUS status; - - if (sOperand >= 0) - { - *pusResult = (USHORT)sOperand; - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// SHORT -> UINT16 conversion -// -#define RtlShortToUInt16 RtlShortToUShort - -// -// SHORT -> WORD conversion -// -#define RtlShortToWord RtlShortToUShort - -// -// SHORT -> UINT conversion -// -__checkReturn -__inline -NTSTATUS -RtlShortToUInt( - __in SHORT sOperand, - __out __deref_out_range(==, sOperand) UINT* puResult) -{ - NTSTATUS status; - - if (sOperand >= 0) - { - *puResult = (UINT)sOperand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// SHORT -> UINT32 conversion -// -#define RtlShortToUInt32 RtlShortToUInt - -// -// SHORT -> UINT_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlShortToUIntPtr( - __in SHORT sOperand, - __out __deref_out_range(==, sOperand) UINT_PTR* puResult) -{ - NTSTATUS status; - - if (sOperand >= 0) - { - *puResult = (UINT_PTR)sOperand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// SHORT -> ULONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlShortToULong( - __in SHORT sOperand, - __out __deref_out_range(==, sOperand) ULONG* pulResult) -{ - NTSTATUS status; - - if (sOperand >= 0) - { - *pulResult = (ULONG)sOperand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// SHORT -> ULONG_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlShortToULongPtr( - __in SHORT sOperand, - __out __deref_out_range(==, sOperand) ULONG_PTR* pulResult) -{ - NTSTATUS status; - - if (sOperand >= 0) - { - *pulResult = (ULONG_PTR)sOperand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// SHORT -> DWORD conversion -// -#define RtlShortToDWord RtlShortToULong - -// -// SHORT -> DWORD_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlShortToDWordPtr( - __in SHORT sOperand, - __out __deref_out_range(==, sOperand) DWORD_PTR* pdwResult) -{ - NTSTATUS status; - - if (sOperand >= 0) - { - *pdwResult = (DWORD_PTR)sOperand; - status = STATUS_SUCCESS; - } - else - { - *pdwResult = DWORD_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// SHORT -> ULONGLONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlShortToULongLong( - __in SHORT sOperand, - __out __deref_out_range(==, sOperand) ULONGLONG* pullResult) -{ - NTSTATUS status; - - if (sOperand >= 0) - { - *pullResult = (ULONGLONG)sOperand; - status = STATUS_SUCCESS; - } - else - { - *pullResult = ULONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// SHORT -> DWORDLONG conversion -// -#define RtlShortToDWordLong RtlShortToULongLong - -// -// SHORT -> ULONG64 conversion -// -#define RtlShortToULong64 RtlShortToULongLong - -// -// SHORT -> DWORD64 conversion -// -#define RtlShortToDWord64 RtlShortToULongLong - -// -// SHORT -> UINT64 conversion -// -#define RtlShortToUInt64 RtlShortToULongLong - -// -// SHORT -> size_t conversion -// -#define RtlShortToSizeT RtlShortToUIntPtr - -// -// SHORT -> SIZE_T conversion -// -#define RtlShortToSIZET RtlShortToULongPtr - -// -// INT16 -> CHAR conversion -// -#define RtlInt16ToChar RtlShortToChar - -// -// INT16 -> INT8 conversion -// -#define RtlInt16ToInt8 RtlShortToInt8 - -// -// INT16 -> UCHAR conversion -// -#define RtlInt16ToUChar RtlShortToUChar - -// -// INT16 -> UINT8 conversion -// -#define RtlInt16ToUInt8 RtlShortToUInt8 - -// -// INT16 -> BYTE conversion -// -#define RtlInt16ToByte RtlShortToUInt8 - -// -// INT16 -> USHORT conversion -// -#define RtlInt16ToUShort RtlShortToUShort - -// -// INT16 -> UINT16 conversion -// -#define RtlInt16ToUInt16 RtlShortToUShort - -// -// INT16 -> WORD conversion -// -#define RtlInt16ToWord RtlShortToUShort - -// -// INT16 -> UINT conversion -// -#define RtlInt16ToUInt RtlShortToUInt - -// -// INT16 -> UINT32 conversion -// -#define RtlInt16ToUInt32 RtlShortToUInt - -// -// INT16 -> UINT_PTR conversion -// -#define RtlInt16ToUIntPtr RtlShortToUIntPtr - -// -// INT16 -> ULONG conversion -// -#define RtlInt16ToULong RtlShortToULong - -// -// INT16 -> ULONG_PTR conversion -// -#define RtlInt16ToULongPtr RtlShortToULongPtr - -// -// INT16 -> DWORD conversion -// -#define RtlInt16ToDWord RtlShortToULong - -// -// INT16 -> DWORD_PTR conversion -// -#define RtlInt16ToDWordPtr RtlShortToULongPtr - -// -// INT16 -> ULONGLONG conversion -// -#define RtlInt16ToULongLong RtlShortToULongLong - -// -// INT16 -> DWORDLONG conversion -// -#define RtlInt16ToDWordLong RtlShortToULongLong - -// -// INT16 -> ULONG64 conversion -// -#define RtlInt16ToULong64 RtlShortToULongLong - -// -// INT16 -> DWORD64 conversion -// -#define RtlInt16ToDWord64 RtlShortToULongLong - -// -// INT16 -> UINT64 conversion -// -#define RtlInt16ToUInt64 RtlShortToULongLong - -// -// INT16 -> size_t conversion -// -#define RtlInt16ToSizeT RtlShortToUIntPtr - -// -// INT16 -> SIZE_T conversion -// -#define RtlInt16ToSIZET RtlShortToULongPtr - -// -// USHORT -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlUShortToInt8( - __in USHORT usOperand, - __out __deref_out_range(==, usOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if (usOperand <= INT8_MAX) - { - *pi8Result = (INT8)usOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// USHORT -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlUShortToUChar( - __in USHORT usOperand, - __out __deref_out_range(==, usOperand) UCHAR* pch) -{ - NTSTATUS status; - - if (usOperand <= 255) - { - *pch = (UCHAR)usOperand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// USHORT -> CHAR conversion -// -__forceinline -NTSTATUS -RtlUShortToChar( - __in USHORT usOperand, - __out __deref_out_range(==, usOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - return RtlUShortToUChar(usOperand, (UCHAR*)pch); -#else - return RtlUShortToInt8(usOperand, (INT8*)pch); -#endif // _CHAR_UNSIGNED -} - -// -// USHORT -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlUShortToUInt8( - __in USHORT usOperand, - __out __deref_out_range(==, usOperand) UINT8* pui8Result) -{ - NTSTATUS status; - - if (usOperand <= UINT8_MAX) - { - *pui8Result = (UINT8)usOperand; - status = STATUS_SUCCESS; - } - else - { - *pui8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// USHORT -> BYTE conversion -// -#define RtlUShortToByte RtlUShortToUInt8 - -// -// USHORT -> SHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlUShortToShort( - __in USHORT usOperand, - __out __deref_out_range(==, usOperand) SHORT* psResult) -{ - NTSTATUS status; - - if (usOperand <= SHORT_MAX) - { - *psResult = (SHORT)usOperand; - status = STATUS_SUCCESS; - } - else - { - *psResult = SHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// USHORT -> INT16 conversion -// -#define RtlUShortToInt16 RtlUShortToShort - -// -// UINT16 -> CHAR conversion -// -#define RtlUInt16ToChar RtlUShortToChar - -// -// UINT16 -> INT8 conversion -// -#define RtlUInt16ToInt8 RtlUShortToInt8 - -// -// UINT16 -> UCHAR conversion -// -#define RtlUInt16ToUChar RtlUShortToUChar - -// -// UINT16 -> UINT8 conversion -// -#define RtlUInt16ToUInt8 RtlUShortToUInt8 - -// -// UINT16 -> BYTE conversion -// -#define RtlUInt16ToByte RtlUShortToUInt8 - -// -// UINT16 -> SHORT conversion -// -#define RtlUInt16ToShort RtlUShortToShort - -// -// UINT16 -> INT16 conversion -// -#define RtlUInt16ToInt16 RtlUShortToShort - -// -// WORD -> INT8 conversion -// -#define RtlWordToInt8 RtlUShortToInt8 - -// -// WORD -> CHAR conversion -// -#define RtlWordToChar RtlUShortToChar - -// -// WORD -> UCHAR conversion -// -#define RtlWordToUChar RtlUShortToUChar - -// -// WORD -> UINT8 conversion -// -#define RtlWordToUInt8 RtlUShortToUInt8 - -// -// WORD -> BYTE conversion -// -#define RtlWordToByte RtlUShortToUInt8 - -// -// WORD -> SHORT conversion -// -#define RtlWordToShort RtlUShortToShort - -// -// WORD -> INT16 conversion -// -#define RtlWordToInt16 RtlUShortToShort - -// -// INT -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntToInt8( - __in INT iOperand, - __out __deref_out_range(==, iOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if ((iOperand >= INT8_MIN) && (iOperand <= INT8_MAX)) - { - *pi8Result = (INT8)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntToUChar( - __in INT iOperand, - __out __deref_out_range(==, iOperand) UCHAR* pch) -{ - NTSTATUS status; - - if ((iOperand >= 0) && (iOperand <= 255)) - { - *pch = (UCHAR)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT -> CHAR conversion -// -__forceinline -NTSTATUS -RtlIntToChar( - __in INT iOperand, - __out __deref_out_range(==, iOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - return RtlIntToUChar(iOperand, (UCHAR*)pch); -#else - return RtlIntToInt8(iOperand, (INT8*)pch); -#endif // _CHAR_UNSIGNED -} - -// -// INT -> BYTE conversion -// -#define RtlIntToByte RtlIntToUInt8 - -// -// INT -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntToUInt8( - __in INT iOperand, - __out __deref_out_range(==, iOperand) UINT8* pui8Result) -{ - NTSTATUS status; - - if ((iOperand >= 0) && (iOperand <= UINT8_MAX)) - { - *pui8Result = (UINT8)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pui8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT -> SHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntToShort( - __in INT iOperand, - __out __deref_out_range(==, iOperand) SHORT* psResult) -{ - NTSTATUS status; - - if ((iOperand >= SHORT_MIN) && (iOperand <= SHORT_MAX)) - { - *psResult = (SHORT)iOperand; - status = STATUS_SUCCESS; - } - else - { - *psResult = SHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT -> INT16 conversion -// -#define RtlIntToInt16 RtlIntToShort - -// -// INT -> USHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntToUShort( - __in INT iOperand, - __out __deref_out_range(==, iOperand) USHORT* pusResult) -{ - NTSTATUS status; - - if ((iOperand >= 0) && (iOperand <= USHORT_MAX)) - { - *pusResult = (USHORT)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT -> UINT16 conversion -// -#define RtlIntToUInt16 RtlIntToUShort - -// -// INT -> WORD conversion -// -#define RtlIntToWord RtlIntToUShort - -// -// INT -> UINT conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntToUInt( - __in INT iOperand, - __out __deref_out_range(==, iOperand) UINT* puResult) -{ - NTSTATUS status; - - if (iOperand >= 0) - { - *puResult = (UINT)iOperand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT -> UINT_PTR conversion -// -#ifdef _WIN64 -#define RtlIntToUIntPtr RtlIntToULongLong -#else -#define RtlIntToUIntPtr RtlIntToUInt -#endif - -// -// INT -> ULONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntToULong( - __in INT iOperand, - __out __deref_out_range(==, iOperand) ULONG* pulResult) -{ - NTSTATUS status; - - if (iOperand >= 0) - { - *pulResult = (ULONG)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT -> ULONG_PTR conversion -// -#ifdef _WIN64 -#define RtlIntToULongPtr RtlIntToULongLong -#else -#define RtlIntToULongPtr RtlIntToULong -#endif - -// -// INT -> DWORD conversion -// -#define RtlIntToDWord RtlIntToULong - -// -// INT -> DWORD_PTR conversion -// -#define RtlIntToDWordPtr RtlIntToULongPtr - -// -// INT -> ULONGLONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntToULongLong( - __in INT iOperand, - __out __deref_out_range(==, iOperand) ULONGLONG* pullResult) -{ - NTSTATUS status; - - if (iOperand >= 0) - { - *pullResult = (ULONGLONG)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pullResult = ULONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT -> DWORDLONG conversion -// -#define RtlIntToDWordLong RtlIntToULongLong - -// -// INT -> ULONG64 conversion -// -#define RtlIntToULong64 RtlIntToULongLong - -// -// INT -> DWORD64 conversion -// -#define RtlIntToDWord64 RtlIntToULongLong - -// -// INT -> UINT64 conversion -// -#define RtlIntToUInt64 RtlIntToULongLong - -// -// INT -> size_t conversion -// -#define RtlIntToSizeT RtlIntToUIntPtr - -// -// INT -> SIZE_T conversion -// -#define RtlIntToSIZET RtlIntToULongPtr - -// -// INT32 -> CHAR conversion -// -#define RtlInt32ToChar RtlIntToChar - -// -// INT32 -> INT328 conversion -// -#define RtlInt32ToInt8 RtlIntToInt8 - -// -// INT32 -> UCHAR conversion -// -#define RtlInt32ToUChar RtlIntToUChar - -// -// INT32 -> BYTE conversion -// -#define RtlInt32ToByte RtlIntToUInt8 - -// -// INT32 -> UINT8 conversion -// -#define RtlInt32ToUInt8 RtlIntToUInt8 - -// -// INT32 -> SHORT conversion -// -#define RtlInt32ToShort RtlIntToShort - -// -// INT32 -> INT16 conversion -// -#define RtlInt32ToInt16 RtlIntToShort - -// -// INT32 -> USHORT conversion -// -#define RtlInt32ToUShort RtlIntToUShort - -// -// INT32 -> UINT16 conversion -// -#define RtlInt32ToUInt16 RtlIntToUShort - -// -// INT32 -> WORD conversion -// -#define RtlInt32ToWord RtlIntToUShort - -// -// INT32 -> UINT conversion -// -#define RtlInt32ToUInt RtlIntToUInt - -// -// INT32 -> UINT32 conversion -// -#define RtlInt32ToUInt32 RtlIntToUInt - -// -// INT32 -> UINT_PTR conversion -// -#define RtlInt32ToUIntPtr RtlIntToUIntPtr - -// -// INT32 -> ULONG conversion -// -#define RtlInt32ToULong RtlIntToULong - -// -// INT32 -> ULONG_PTR conversion -// -#define RtlInt32ToULongPtr RtlIntToULongPtr - -// -// INT32 -> DWORD conversion -// -#define RtlInt32ToDWord RtlIntToULong - -// -// INT32 -> DWORD_PTR conversion -// -#define RtlInt32ToDWordPtr RtlIntToULongPtr - -// -// INT32 -> ULONGLONG conversion -// -#define RtlInt32ToULongLong RtlIntToULongLong - -// -// INT32 -> DWORDLONG conversion -// -#define RtlInt32ToDWordLong RtlIntToULongLong - -// -// INT32 -> ULONG64 conversion -// -#define RtlInt32ToULong64 RtlIntToULongLong - -// -// INT32 -> DWORD64 conversion -// -#define RtlInt32ToDWord64 RtlIntToULongLong - -// -// INT32 -> UINT64 conversion -// -#define RtlInt32ToUInt64 RtlIntToULongLong - -// -// INT32 -> size_t conversion -// -#define RtlInt32ToSizeT RtlIntToUIntPtr - -// -// INT32 -> SIZE_T conversion -// -#define RtlInt32ToSIZET RtlIntToULongPtr - -// -// INT_PTR -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntPtrToInt8( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if ((iOperand >= INT8_MIN) && (iOperand <= INT8_MAX)) - { - *pi8Result = (INT8)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT_PTR -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntPtrToUChar( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) UCHAR* pch) -{ - NTSTATUS status; - - if ((iOperand >= 0) && (iOperand <= 255)) - { - *pch = (UCHAR)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT_PTR -> CHAR conversion -// -__forceinline -NTSTATUS -RtlIntPtrToChar( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - return RtlIntPtrToUChar(iOperand, (UCHAR*)pch); -#else - return RtlIntPtrToInt8(iOperand, (INT8*)pch); -#endif // _CHAR_UNSIGNED -} - -// -// INT_PTR -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntPtrToUInt8( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) UINT8* pui8Result) -{ - NTSTATUS status; - - if ((iOperand >= 0) && (iOperand <= UINT8_MAX)) - { - *pui8Result = (UINT8)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pui8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT_PTR -> BYTE conversion -// -#define RtlIntPtrToByte RtlIntPtrToUInt8 - -// -// INT_PTR -> SHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntPtrToShort( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) SHORT* psResult) -{ - NTSTATUS status; - - if ((iOperand >= SHORT_MIN) && (iOperand <= SHORT_MAX)) - { - *psResult = (SHORT)iOperand; - status = STATUS_SUCCESS; - } - else - { - *psResult = SHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT_PTR -> INT16 conversion -// -#define RtlIntPtrToInt16 RtlIntPtrToShort - -// -// INT_PTR -> USHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntPtrToUShort( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) USHORT* pusResult) -{ - NTSTATUS status; - - if ((iOperand >= 0) && (iOperand <= USHORT_MAX)) - { - *pusResult = (USHORT)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// INT_PTR -> UINT16 conversion -// -#define RtlIntPtrToUInt16 RtlIntPtrToUShort - -// -// INT_PTR -> WORD conversion -// -#define RtlIntPtrToWord RtlIntPtrToUShort - -// -// INT_PTR -> INT conversion -// -#ifdef _WIN64 -#define RtlIntPtrToInt RtlLongLongToInt -#else -__checkReturn -__inline -NTSTATUS -RtlIntPtrToInt( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) INT* piResult) -{ - *piResult = (INT)iOperand; - return STATUS_SUCCESS; -} -#endif - -// -// INT_PTR -> INT32 conversion -// -#define RtlIntPtrToInt32 RtlIntPtrToInt - -// -// INT_PTR -> UINT conversion -// -#ifdef _WIN64 -#define RtlIntPtrToUInt RtlLongLongToUInt -#else -__checkReturn -__inline -NTSTATUS -RtlIntPtrToUInt( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) UINT* puResult) -{ - NTSTATUS status; - - if (iOperand >= 0) - { - *puResult = (UINT)iOperand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif - -// -// INT_PTR -> UINT32 conversion -// -#define RtlIntPtrToUInt32 RtlIntPtrToUInt - -// -// INT_PTR -> UINT_PTR conversion -// -#ifdef _WIN64 -#define RtlIntPtrToUIntPtr RtlLongLongToULongLong -#else -__checkReturn -__inline -NTSTATUS -RtlIntPtrToUIntPtr( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) UINT_PTR* puResult) -{ - NTSTATUS status; - - if (iOperand >= 0) - { - *puResult = (UINT_PTR)iOperand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif - -// -// INT_PTR -> LONG conversion -// -#ifdef _WIN64 -#define RtlIntPtrToLong RtlLongLongToLong -#else -__checkReturn -__inline -NTSTATUS -RtlIntPtrToLong( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) LONG* plResult) -{ - *plResult = (LONG)iOperand; - return STATUS_SUCCESS; -} -#endif - -// -// INT_PTR -> LONG_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlIntPtrToLongPtr( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) LONG_PTR* plResult) -{ - *plResult = (LONG_PTR)iOperand; - return STATUS_SUCCESS; -} - -// -// INT_PTR -> ULONG conversion -// -#ifdef _WIN64 -#define RtlIntPtrToULong RtlLongLongToULong -#else -__checkReturn -__inline -NTSTATUS -RtlIntPtrToULong( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) ULONG* pulResult) -{ - NTSTATUS status; - - if (iOperand >= 0) - { - *pulResult = (ULONG)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif - -// -// INT_PTR -> ULONG_PTR conversion -// -#ifdef _WIN64 -#define RtlIntPtrToULongPtr RtlLongLongToULongLong -#else -__checkReturn -__inline -NTSTATUS -RtlIntPtrToULongPtr( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) ULONG_PTR* pulResult) -{ - NTSTATUS status; - - if (iOperand >= 0) - { - *pulResult = (ULONG_PTR)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif - -// -// INT_PTR -> DWORD conversion -// -#define RtlIntPtrToDWord RtlIntPtrToULong - -// -// INT_PTR -> DWORD_PTR conversion -// -#define RtlIntPtrToDWordPtr RtlIntPtrToULongPtr - -// -// INT_PTR -> ULONGLONG conversion -// -#ifdef _WIN64 -#define RtlIntPtrToULongLong RtlLongLongToULongLong -#else -__checkReturn -__inline -NTSTATUS -RtlIntPtrToULongLong( - __in INT_PTR iOperand, - __out __deref_out_range(==, iOperand) ULONGLONG* pullResult) -{ - NTSTATUS status; - - if (iOperand >= 0) - { - *pullResult = (ULONGLONG)iOperand; - status = STATUS_SUCCESS; - } - else - { - *pullResult = ULONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif - -// -// INT_PTR -> DWORDLONG conversion -// -#define RtlIntPtrToDWordLong RtlIntPtrToULongLong - -// -// INT_PTR -> ULONG64 conversion -// -#define RtlIntPtrToULong64 RtlIntPtrToULongLong - -// -// INT_PTR -> DWORD64 conversion -// -#define RtlIntPtrToDWord64 RtlIntPtrToULongLong - -// -// INT_PTR -> UINT64 conversion -// -#define RtlIntPtrToUInt64 RtlIntPtrToULongLong - -// -// INT_PTR -> size_t conversion -// -#define RtlIntPtrToSizeT RtlIntPtrToUIntPtr - -// -// INT_PTR -> SIZE_T conversion -// -#define RtlIntPtrToSIZET RtlIntPtrToULongPtr - -// -// UINT -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntToInt8( - __in UINT uOperand, - __out __deref_out_range(==, uOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if (uOperand <= INT8_MAX) - { - *pi8Result = (INT8)uOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntToUChar( - __in UINT uOperand, - __out __deref_out_range(==, uOperand) UCHAR* pch) -{ - NTSTATUS status; - - if (uOperand <= 255) - { - *pch = (UCHAR)uOperand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT -> CHAR conversion -// -__forceinline -NTSTATUS -RtlUIntToChar( - __in UINT uOperand, - __out __deref_out_range(==, uOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - return RtlUIntToUChar(uOperand, (UCHAR*)pch); -#else - return RtlUIntToInt8(uOperand, (INT8*)pch); -#endif -} - -// -// UINT -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntToUInt8( - __in UINT uOperand, - __out __deref_out_range(==, uOperand) UINT8* pui8Result) -{ - NTSTATUS status; - - if (uOperand <= UINT8_MAX) - { - *pui8Result = (UINT8)uOperand; - status = STATUS_SUCCESS; - } - else - { - *pui8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT -> BYTE conversion -// -#define RtlUIntToByte RtlUIntToUInt8 - -// -// UINT -> SHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntToShort( - __in UINT uOperand, - __out __deref_out_range(==, uOperand) SHORT* psResult) -{ - NTSTATUS status; - - if (uOperand <= SHORT_MAX) - { - *psResult = (SHORT)uOperand; - status = STATUS_SUCCESS; - } - else - { - *psResult = SHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT -> INT16 conversion -// -#define RtlUIntToInt16 RtlUIntToShort - -// -// UINT -> USHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntToUShort( - __in UINT uOperand, - __out __deref_out_range(==, uOperand) USHORT* pusResult) -{ - NTSTATUS status; - - if (uOperand <= USHORT_MAX) - { - *pusResult = (USHORT)uOperand; - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT -> UINT16 conversion -// -#define RtlUIntToUInt16 RtlUIntToUShort - -// -// UINT -> WORD conversion -// -#define RtlUIntToWord RtlUIntToUShort - -// -// UINT -> INT conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntToInt( - __in UINT uOperand, - __out __deref_out_range(==, uOperand) INT* piResult) -{ - NTSTATUS status; - - if (uOperand <= INT_MAX) - { - *piResult = (INT)uOperand; - status = STATUS_SUCCESS; - } - else - { - *piResult = INT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT -> INT32 conversion -// -#define RtlUIntToInt32 RtlUIntToInt - -// -// UINT -> INT_PTR conversion -// -#ifdef _WIN64 -__checkReturn -__inline -NTSTATUS -RtlUIntToIntPtr( - __in UINT uOperand, - __out __deref_out_range(==, uOperand) INT_PTR* piResult) -{ - *piResult = uOperand; - return STATUS_SUCCESS; -} -#else -#define RtlUIntToIntPtr RtlUIntToInt -#endif - -// -// UINT -> LONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntToLong( - __in UINT uOperand, - __out __deref_out_range(==, uOperand) LONG* plResult) -{ - NTSTATUS status; - - if (uOperand <= LONG_MAX) - { - *plResult = (LONG)uOperand; - status = STATUS_SUCCESS; - } - else - { - *plResult = LONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT -> LONG_PTR conversion -// -#ifdef _WIN64 -__checkReturn -__inline -NTSTATUS -RtlUIntToLongPtr( - __in UINT uOperand, - __out __deref_out_range(==, uOperand) LONG_PTR* plResult) -{ - *plResult = uOperand; - return STATUS_SUCCESS; -} -#else -#define RtlUIntToLongPtr RtlUIntToLong -#endif - -// -// UINT -> ptrdiff_t conversion -// -#define RtlUIntToPtrdiffT RtlUIntToIntPtr - -// -// UINT -> SSIZE_T conversion -// -#define RtlUIntToSSIZET RtlUIntToLongPtr - -// -// UINT32 -> CHAR conversion -// -#define RtlUInt32ToChar RtlUIntToChar - -// -// UINT32 -> INT8 conversion -// -#define RtlUInt32ToInt8 RtlUIntToInt8 - -// -// UINT32 -> UCHAR conversion -// -#define RtlUInt32ToUChar RtlUIntToUChar - -// -// UINT32 -> UINT8 conversion -// -#define RtlUInt32ToUInt8 RtlUIntToUInt8 - -// -// UINT32 -> BYTE conversion -// -#define RtlUInt32ToByte RtlUInt32ToUInt8 - -// -// UINT32 -> SHORT conversion -// -#define RtlUInt32ToShort RtlUIntToShort - -// -// UINT32 -> INT16 conversion -// -#define RtlUInt32ToInt16 RtlUIntToShort - -// -// UINT32 -> USHORT conversion -// -#define RtlUInt32ToUShort RtlUIntToUShort - -// -// UINT32 -> UINT16 conversion -// -#define RtlUInt32ToUInt16 RtlUIntToUShort - -// -// UINT32 -> WORD conversion -// -#define RtlUInt32ToWord RtlUIntToUShort - -// -// UINT32 -> INT conversion -// -#define RtlUInt32ToInt RtlUIntToInt - -// -// UINT32 -> INT_PTR conversion -// -#define RtlUInt32ToIntPtr RtlUIntToIntPtr - -// -// UINT32 -> INT32 conversion -// -#define RtlUInt32ToInt32 RtlUIntToInt - -// -// UINT32 -> LONG conversion -// -#define RtlUInt32ToLong RtlUIntToLong - -// -// UINT32 -> LONG_PTR conversion -// -#define RtlUInt32ToLongPtr RtlUIntToLongPtr - -// -// UINT32 -> ptrdiff_t conversion -// -#define RtlUInt32ToPtrdiffT RtlUIntToPtrdiffT - -// -// UINT32 -> SSIZE_T conversion -// -#define RtlUInt32ToSSIZET RtlUIntToSSIZET - -// -// UINT_PTR -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToInt8( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if (uOperand <= INT8_MAX) - { - *pi8Result = (INT8)uOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT_PTR -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToUChar( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) UCHAR* pch) -{ - NTSTATUS status; - - if (uOperand <= 255) - { - *pch = (UCHAR)uOperand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT_PTR -> CHAR conversion -// -__forceinline -NTSTATUS -RtlUIntPtrToChar( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - return RtlUIntPtrToUChar(uOperand, (UCHAR*)pch); -#else - return RtlUIntPtrToInt8(uOperand, (INT8*)pch); -#endif -} - -// -// UINT_PTR -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToUInt8( - __in UINT_PTR uOperand, - __out __deref_out_range(==,uOperand) UINT8* pu8Result) -{ - NTSTATUS status; - - if (uOperand <= UINT8_MAX) - { - *pu8Result = (UINT8)uOperand; - status = STATUS_SUCCESS; - } - else - { - *pu8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT_PTR -> BYTE conversion -// -#define RtlUIntPtrToByte RtlUIntPtrToUInt8 - -// -// UINT_PTR -> SHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToShort( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) SHORT* psResult) -{ - NTSTATUS status; - - if (uOperand <= SHORT_MAX) - { - *psResult = (SHORT)uOperand; - status = STATUS_SUCCESS; - } - else - { - *psResult = SHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT_PTR -> INT16 conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToInt16( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) INT16* pi16Result) -{ - NTSTATUS status; - - if (uOperand <= INT16_MAX) - { - *pi16Result = (INT16)uOperand; - status = STATUS_SUCCESS; - } - else - { - *pi16Result = INT16_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT_PTR -> USHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToUShort( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) USHORT* pusResult) -{ - NTSTATUS status; - - if (uOperand <= USHORT_MAX) - { - *pusResult = (USHORT)uOperand; - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT_PTR -> UINT16 conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToUInt16( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) UINT16* pu16Result) -{ - NTSTATUS status; - - if (uOperand <= UINT16_MAX) - { - *pu16Result = (UINT16)uOperand; - status = STATUS_SUCCESS; - } - else - { - *pu16Result = UINT16_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT_PTR -> WORD conversion -// -#define RtlUIntPtrToWord RtlUIntPtrToUShort - -// -// UINT_PTR -> INT conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToInt( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) INT* piResult) -{ - NTSTATUS status; - - if (uOperand <= INT_MAX) - { - *piResult = (INT)uOperand; - status = STATUS_SUCCESS; - } - else - { - *piResult = INT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT_PTR -> INT32 conversion -// -#define RtlUIntPtrToInt32 RtlUIntPtrToInt - -// -// UINT_PTR -> INT_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToIntPtr( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) INT_PTR* piResult) -{ - NTSTATUS status; - - if (uOperand <= INT_PTR_MAX) - { - *piResult = (INT_PTR)uOperand; - status = STATUS_SUCCESS; - } - else - { - *piResult = INT_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT_PTR -> UINT conversion -// -#ifdef _WIN64 -#define RtlUIntPtrToUInt RtlULongLongToUInt -#else -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToUInt( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) UINT* puResult) -{ - *puResult = (UINT)uOperand; - return STATUS_SUCCESS; -} -#endif - -// -// UINT_PTR -> UINT32 conversion -// -#define RtlUIntPtrToUInt32 RtlUIntPtrToUInt - -// -// UINT_PTR -> LONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToLong( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) LONG* plResult) -{ - NTSTATUS status; - - if (uOperand <= LONG_MAX) - { - *plResult = (LONG)uOperand; - status = STATUS_SUCCESS; - } - else - { - *plResult = LONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT_PTR -> LONG_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToLongPtr( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) LONG_PTR* plResult) -{ - NTSTATUS status; - - if (uOperand <= LONG_PTR_MAX) - { - *plResult = (LONG_PTR)uOperand; - status = STATUS_SUCCESS; - } - else - { - *plResult = LONG_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT_PTR -> ULONG conversion -// -#ifdef _WIN64 -#define RtlUIntPtrToULong RtlULongLongToULong -#else -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToULong( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) ULONG* pulResult) -{ - *pulResult = (ULONG)uOperand; - return STATUS_SUCCESS; -} -#endif - -// -// UINT_PTR -> DWORD conversion -// -#define RtlUIntPtrToDWord RtlUIntPtrToULong - -// -// UINT_PTR -> LONGLONG conversion -// -#ifdef _WIN64 -#define RtlUIntPtrToLongLong RtlULongLongToLongLong -#else -__checkReturn -__inline -NTSTATUS -RtlUIntPtrToLongLong( - __in UINT_PTR uOperand, - __out __deref_out_range(==, uOperand) LONGLONG* pllResult) -{ - *pllResult = (LONGLONG)uOperand; - return STATUS_SUCCESS; -} -#endif - -// -// UINT_PTR -> LONG64 conversion -// -#define RtlUIntPtrToLong64 RtlUIntPtrToLongLong - -// -// UINT_PTR -> RtlINT64 conversion -// -#define RtlUIntPtrToInt64 RtlUIntPtrToLongLong - -// -// UINT_PTR -> ptrdiff_t conversion -// -#define RtlUIntPtrToPtrdiffT RtlUIntPtrToIntPtr - -// -// UINT_PTR -> SSIZE_T conversion -// -#define RtlUIntPtrToSSIZET RtlUIntPtrToLongPtr - -// -// LONG -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongToInt8( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if ((lOperand >= INT8_MIN) && (lOperand <= INT8_MAX)) - { - *pi8Result = (INT8)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongToUChar( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) UCHAR* pch) -{ - NTSTATUS status; - - if ((lOperand >= 0) && (lOperand <= 255)) - { - *pch = (UCHAR)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG -> CHAR conversion -// -__forceinline -NTSTATUS -RtlLongToChar( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - return RtlLongToUChar(lOperand, (UCHAR*)pch); -#else - return RtlLongToInt8(lOperand, (INT8*)pch); -#endif -} - -// -// LONG -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongToUInt8( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) UINT8* pui8Result) -{ - NTSTATUS status; - - if ((lOperand >= 0) && (lOperand <= UINT8_MAX)) - { - *pui8Result = (UINT8)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pui8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG -> BYTE conversion -// -#define RtlLongToByte RtlLongToUInt8 - -// -// LONG -> SHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongToShort( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) SHORT* psResult) -{ - NTSTATUS status; - - if ((lOperand >= SHORT_MIN) && (lOperand <= SHORT_MAX)) - { - *psResult = (SHORT)lOperand; - status = STATUS_SUCCESS; - } - else - { - *psResult = SHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG -> INT16 conversion -// -#define RtlLongToInt16 RtlLongToShort - -// -// LONG -> USHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongToUShort( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) USHORT* pusResult) -{ - NTSTATUS status; - - if ((lOperand >= 0) && (lOperand <= USHORT_MAX)) - { - *pusResult = (USHORT)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG -> UINT16 conversion -// -#define RtlLongToUInt16 RtlLongToUShort - -// -// LONG -> WORD conversion -// -#define RtlLongToWord RtlLongToUShort - -// -// LONG -> INT conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongToInt( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) INT* piResult) -{ - C_ASSERT(sizeof(INT) == sizeof(LONG)); - *piResult = (INT)lOperand; - return STATUS_SUCCESS; -} - -// -// LONG -> INT32 conversion -// -#define RtlLongToInt32 RtlLongToInt - -// -// LONG -> INT_PTR conversion -// -#ifdef _WIN64 -__checkReturn -__inline -NTSTATUS -RtlLongToIntPtr( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) INT_PTR* piResult) -{ - *piResult = lOperand; - return STATUS_SUCCESS; -} -#else -#define RtlLongToIntPtr RtlLongToInt -#endif - -// -// LONG -> UINT conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongToUInt( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) UINT* puResult) -{ - NTSTATUS status; - - if (lOperand >= 0) - { - *puResult = (UINT)lOperand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG -> UINT32 conversion -// -#define RtlLongToUInt32 RtlLongToUInt - -// -// LONG -> UINT_PTR conversion -// -#ifdef _WIN64 -__checkReturn -__inline -NTSTATUS -RtlLongToUIntPtr( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) UINT_PTR* puResult) -{ - NTSTATUS status; - - if (lOperand >= 0) - { - *puResult = (UINT_PTR)lOperand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#else -#define RtlLongToUIntPtr RtlLongToUInt -#endif - -// -// LONG -> ULONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongToULong( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) ULONG* pulResult) -{ - NTSTATUS status; - - if (lOperand >= 0) - { - *pulResult = (ULONG)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG -> ULONG_PTR conversion -// -#ifdef _WIN64 -__checkReturn -__inline -NTSTATUS -RtlLongToULongPtr( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) ULONG_PTR* pulResult) -{ - NTSTATUS status; - - if (lOperand >= 0) - { - *pulResult = (ULONG_PTR)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#else -#define RtlLongToULongPtr RtlLongToULong -#endif - -// -// LONG -> DWORD conversion -// -#define RtlLongToDWord RtlLongToULong - -// -// LONG -> DWORD_PTR conversion -// -#define RtlLongToDWordPtr RtlLongToULongPtr - -// -// LONG -> ULONGLONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongToULongLong( - __in LONG lOperand, - __out __deref_out_range(==, lOperand) ULONGLONG* pullResult) -{ - NTSTATUS status; - - if (lOperand >= 0) - { - *pullResult = (ULONGLONG)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pullResult = ULONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG -> DWORDLONG conversion -// -#define RtlLongToDWordLong RtlLongToULongLong - -// -// LONG -> ULONG64 conversion -// -#define RtlLongToULong64 RtlLongToULongLong - -// -// LONG -> DWORD64 conversion -// -#define RtlLongToDWord64 RtlLongToULongLong - -// -// LONG -> UINT64 conversion -// -#define RtlLongToUInt64 RtlLongToULongLong - -// -// LONG -> ptrdiff_t conversion -// -#define RtlLongToPtrdiffT RtlLongToIntPtr - -// -// LONG -> size_t conversion -// -#define RtlLongToSizeT RtlLongToUIntPtr - -// -// LONG -> SIZE_T conversion -// -#define RtlLongToSIZET RtlLongToULongPtr - -// -// LONG_PTR -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongPtrToInt8( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if ((lOperand >= INT8_MIN) && (lOperand <= INT8_MAX)) - { - *pi8Result = (INT8)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG_PTR -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongPtrToUChar( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) UCHAR* pch) -{ - NTSTATUS status; - - if ((lOperand >= 0) && (lOperand <= 255)) - { - *pch = (UCHAR)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG_PTR -> CHAR conversion -// -__forceinline -NTSTATUS -RtlLongPtrToChar( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - return RtlLongPtrToUChar(lOperand, (UCHAR*)pch); -#else - return RtlLongPtrToInt8(lOperand, (INT8*)pch); -#endif -} - -// -// LONG_PTR -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongPtrToUInt8( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) UINT8* pui8Result) -{ - NTSTATUS status; - - if ((lOperand >= 0) && (lOperand <= UINT8_MAX)) - { - *pui8Result = (UINT8)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pui8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG_PTR -> BYTE conversion -// -#define RtlLongPtrToByte RtlLongPtrToUInt8 - -// -// LONG_PTR -> SHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongPtrToShort( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) SHORT* psResult) -{ - NTSTATUS status; - - if ((lOperand >= SHORT_MIN) && (lOperand <= SHORT_MAX)) - { - *psResult = (SHORT)lOperand; - status = STATUS_SUCCESS; - } - else - { - *psResult = SHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG_PTR -> INT16 conversion -// -#define RtlLongPtrToInt16 RtlLongPtrToShort - -// -// LONG_PTR -> USHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongPtrToUShort( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) USHORT* pusResult) -{ - NTSTATUS status; - - if ((lOperand >= 0) && (lOperand <= USHORT_MAX)) - { - *pusResult = (USHORT)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG_PTR -> UINT16 conversion -// -#define RtlLongPtrToUInt16 RtlLongPtrToUShort - -// -// LONG_PTR -> WORD conversion -// -#define RtlLongPtrToWord RtlLongPtrToUShort - -// -// LONG_PTR -> INT conversion -// -#ifdef _WIN64 -#define RtlLongPtrToInt RtlLongLongToInt -#else -__checkReturn -__inline -NTSTATUS -RtlLongPtrToInt( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) INT* piResult) -{ - C_ASSERT(sizeof(INT) == sizeof(LONG_PTR)); - *piResult = (INT)lOperand; - return STATUS_SUCCESS; -} -#endif - -// -// LONG_PTR -> INT32 conversion -// -#define RtlLongPtrToInt32 RtlLongPtrToInt - -// -// LONG_PTR -> INT_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongPtrToIntPtr( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) INT_PTR* piResult) -{ - C_ASSERT(sizeof(LONG_PTR) == sizeof(INT_PTR)); - *piResult = (INT_PTR)lOperand; - return STATUS_SUCCESS; -} - -// -// LONG_PTR -> UINT conversion -// -#ifdef _WIN64 -#define RtlLongPtrToUInt RtlLongLongToUInt -#else -__checkReturn -__inline -NTSTATUS -RtlLongPtrToUInt( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) UINT* puResult) -{ - NTSTATUS status; - - if (lOperand >= 0) - { - *puResult = (UINT)lOperand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif - -// -// LONG_PTR -> UINT32 conversion -// -#define RtlLongPtrToUInt32 RtlLongPtrToUInt - -// -// LONG_PTR -> UINT_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongPtrToUIntPtr( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) UINT_PTR* puResult) -{ - NTSTATUS status; - - if (lOperand >= 0) - { - *puResult = (UINT_PTR)lOperand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG_PTR -> LONG conversion -// -#ifdef _WIN64 -#define RtlLongPtrToLong RtlLongLongToLong -#else -__checkReturn -__inline -NTSTATUS -RtlLongPtrToLong( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) LONG* plResult) -{ - *plResult = (LONG)lOperand; - return STATUS_SUCCESS; -} -#endif - -// -// LONG_PTR -> ULONG conversion -// -#ifdef _WIN64 -#define RtlLongPtrToULong RtlLongLongToULong -#else -__checkReturn -__inline -NTSTATUS -RtlLongPtrToULong( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) ULONG* pulResult) -{ - NTSTATUS status; - - if (lOperand >= 0) - { - *pulResult = (ULONG)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif - -// -// LONG_PTR -> ULONG_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongPtrToULongPtr( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) ULONG_PTR* pulResult) -{ - NTSTATUS status; - - if (lOperand >= 0) - { - *pulResult = (ULONG_PTR)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG_PTR -> DWORD conversion -// -#define RtlLongPtrToDWord RtlLongPtrToULong - -// -// LONG_PTR -> DWORD_PTR conversion -// -#define RtlLongPtrToDWordPtr RtlLongPtrToULongPtr - -// -// LONG_PTR -> ULONGLONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongPtrToULongLong( - __in LONG_PTR lOperand, - __out __deref_out_range(==, lOperand) ULONGLONG* pullResult) -{ - NTSTATUS status; - - if (lOperand >= 0) - { - *pullResult = (ULONGLONG)lOperand; - status = STATUS_SUCCESS; - } - else - { - *pullResult = ULONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONG_PTR -> DWORDLONG conversion -// -#define RtlLongPtrToDWordLong RtlLongPtrToULongLong - -// -// LONG_PTR -> ULONG64 conversion -// -#define RtlLongPtrToULong64 RtlLongPtrToULongLong - -// -// LONG_PTR -> DWORD64 conversion -// -#define RtlLongPtrToDWord64 RtlLongPtrToULongLong - -// -// LONG_PTR -> UINT64 conversion -// -#define RtlLongPtrToUInt64 RtlLongPtrToULongLong - -// -// LONG_PTR -> size_t conversion -// -#define RtlLongPtrToSizeT RtlLongPtrToUIntPtr - -// -// LONG_PTR -> SIZE_T conversion -// -#define RtlLongPtrToSIZET RtlLongPtrToULongPtr - -// -// ULONG -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongToInt8( - __in ULONG ulOperand, - __out __deref_out_range(==, ulOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if (ulOperand <= INT8_MAX) - { - *pi8Result = (INT8)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongToUChar( - __in ULONG ulOperand, - __out __deref_out_range(==, ulOperand) UCHAR* pch) -{ - NTSTATUS status; - - if (ulOperand <= 255) - { - *pch = (UCHAR)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG -> CHAR conversion -// -__forceinline -NTSTATUS -RtlULongToChar( - __in ULONG ulOperand, - __out __deref_out_range(==, ulOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - return RtlULongToUChar(ulOperand, (UCHAR*)pch); -#else - return RtlULongToInt8(ulOperand, (INT8*)pch); -#endif -} - -// -// ULONG -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongToUInt8( - __in ULONG ulOperand, - __out __deref_out_range(==, ulOperand) UINT8* pui8Result) -{ - NTSTATUS status; - - if (ulOperand <= UINT8_MAX) - { - *pui8Result = (UINT8)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *pui8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG -> BYTE conversion -// -#define RtlULongToByte RtlULongToUInt8 - -// -// ULONG -> SHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongToShort( - __in ULONG ulOperand, - __out __deref_out_range(==, ulOperand) SHORT* psResult) -{ - NTSTATUS status; - - if (ulOperand <= SHORT_MAX) - { - *psResult = (SHORT)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *psResult = SHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG -> INT16 conversion -// -#define RtlULongToInt16 RtlULongToShort - -// -// ULONG -> USHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongToUShort( - __in ULONG ulOperand, - __out __deref_out_range(==, ulOperand) USHORT* pusResult) -{ - NTSTATUS status; - - if (ulOperand <= USHORT_MAX) - { - *pusResult = (USHORT)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG -> UINT16 conversion -// -#define RtlULongToUInt16 RtlULongToUShort - -// -// ULONG -> WORD conversion -// -#define RtlULongToWord RtlULongToUShort - -// -// ULONG -> INT conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongToInt( - __in ULONG ulOperand, - __out __deref_out_range(==, ulOperand) INT* piResult) -{ - NTSTATUS status; - - if (ulOperand <= INT_MAX) - { - *piResult = (INT)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *piResult = INT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG -> INT32 conversion -// -#define RtlULongToInt32 RtlULongToInt - -// -// ULONG -> INT_PTR conversion -// -#ifdef _WIN64 -__checkReturn -__inline -NTSTATUS -RtlULongToIntPtr( - __in ULONG ulOperand, - __out __deref_out_range(==, ulOperand) INT_PTR* piResult) -{ - *piResult = (INT_PTR)ulOperand; - return STATUS_SUCCESS; -} -#else -#define RtlULongToIntPtr RtlULongToInt -#endif - -// -// ULONG -> UINT conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongToUInt( - __in ULONG ulOperand, - __out __deref_out_range(==, ulOperand) UINT* puResult) -{ - C_ASSERT(sizeof(ULONG) == sizeof(UINT)); - *puResult = (UINT)ulOperand; - return STATUS_SUCCESS; -} - -// -// ULONG -> UINT32 conversion -// -#define RtlULongToUInt32 RtlULongToUInt - -// -// ULONG -> UINT_PTR conversion -// -#ifdef _WIN64 -__checkReturn -__inline -NTSTATUS -RtlULongToUIntPtr( - __in ULONG ulOperand, - __out __deref_out_range(==, ulOperand) UINT_PTR* puiResult) -{ - C_ASSERT(sizeof(UINT_PTR) > sizeof(ULONG)); - *puiResult = (UINT_PTR)ulOperand; - return STATUS_SUCCESS; -} -#else -#define RtlULongToUIntPtr RtlULongToUInt -#endif - -// -// ULONG -> LONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongToLong( - __in ULONG ulOperand, - __out __deref_out_range(==, ulOperand) LONG* plResult) -{ - NTSTATUS status; - - if (ulOperand <= LONG_MAX) - { - *plResult = (LONG)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *plResult = LONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG -> LONG_PTR conversion -// -#ifdef _WIN64 -__checkReturn -__inline -NTSTATUS -RtlULongToLongPtr( - __in ULONG ulOperand, - __out __deref_out_range(==, ulOperand) LONG_PTR* plResult) -{ - C_ASSERT(sizeof(LONG_PTR) > sizeof(ULONG)); - *plResult = (LONG_PTR)ulOperand; - return STATUS_SUCCESS; -} -#else -#define RtlULongToLongPtr RtlULongToLong -#endif - -// -// ULONG -> ptrdiff_t conversion -// -#define RtlULongToPtrdiffT RtlULongToIntPtr - -// -// ULONG -> SSIZE_T conversion -// -#define RtlULongToSSIZET RtlULongToLongPtr - -// -// ULONG_PTR -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongPtrToInt8( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if (ulOperand <= INT8_MAX) - { - *pi8Result = (INT8)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG_PTR -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongPtrToUChar( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) UCHAR* pch) -{ - NTSTATUS status; - - if (ulOperand <= 255) - { - *pch = (UCHAR)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG_PTR -> CHAR conversion -// -__forceinline -NTSTATUS -RtlULongPtrToChar( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - return RtlULongPtrToUChar(ulOperand, (UCHAR*)pch); -#else - return RtlULongPtrToInt8(ulOperand, (INT8*)pch); -#endif -} - -// -// ULONG_PTR -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongPtrToUInt8( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) UINT8* pui8Result) -{ - NTSTATUS status; - - if (ulOperand <= UINT8_MAX) - { - *pui8Result = (UINT8)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *pui8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG_PTR -> BYTE conversion -// -#define RtlULongPtrToByte RtlULongPtrToUInt8 - -// -// ULONG_PTR -> SHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongPtrToShort( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) SHORT* psResult) -{ - NTSTATUS status; - - if (ulOperand <= SHORT_MAX) - { - *psResult = (SHORT)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *psResult = SHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG_PTR -> INT16 conversion -// -#define RtlULongPtrToInt16 RtlULongPtrToShort - -// -// ULONG_PTR -> USHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongPtrToUShort( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) USHORT* pusResult) -{ - NTSTATUS status; - - if (ulOperand <= USHORT_MAX) - { - *pusResult = (USHORT)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG_PTR -> UINT16 conversion -// -#define RtlULongPtrToUInt16 RtlULongPtrToUShort - -// -// ULONG_PTR -> WORD conversion -// -#define RtlULongPtrToWord RtlULongPtrToUShort - -// -// ULONG_PTR -> INT conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongPtrToInt( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) INT* piResult) -{ - NTSTATUS status; - - if (ulOperand <= INT_MAX) - { - *piResult = (INT)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *piResult = INT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG_PTR -> INT32 conversion -// -#define RtlULongPtrToInt32 RtlULongPtrToInt - -// -// ULONG_PTR -> INT_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongPtrToIntPtr( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) INT_PTR* piResult) -{ - NTSTATUS status; - - if (ulOperand <= INT_PTR_MAX) - { - *piResult = (INT_PTR)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *piResult = INT_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG_PTR -> UINT conversion -// -#ifdef _WIN64 -#define RtlULongPtrToUInt RtlULongLongToUInt -#else -__checkReturn -__inline -NTSTATUS -RtlULongPtrToUInt( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) UINT* puResult) -{ - C_ASSERT(sizeof(ULONG_PTR) == sizeof(UINT)); - *puResult = (UINT)ulOperand; - return STATUS_SUCCESS; -} -#endif - -// -// ULONG_PTR -> UINT32 conversion -// -#define RtlULongPtrToUInt32 RtlULongPtrToUInt - -// -// ULONG_PTR -> UINT_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongPtrToUIntPtr( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) UINT_PTR* puResult) -{ - *puResult = (UINT_PTR)ulOperand; - return STATUS_SUCCESS; -} - -// -// ULONG_PTR -> LONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongPtrToLong( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) LONG* plResult) -{ - NTSTATUS status; - - if (ulOperand <= LONG_MAX) - { - *plResult = (LONG)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *plResult = LONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG_PTR -> LONG_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongPtrToLongPtr( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) LONG_PTR* plResult) -{ - NTSTATUS status; - - if (ulOperand <= LONG_PTR_MAX) - { - *plResult = (LONG_PTR)ulOperand; - status = STATUS_SUCCESS; - } - else - { - *plResult = LONG_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG_PTR -> ULONG conversion -// -#ifdef _WIN64 -#define RtlULongPtrToULong RtlULongLongToULong -#else -__checkReturn -__inline -NTSTATUS -RtlULongPtrToULong( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) ULONG* pulResult) -{ - *pulResult = (ULONG)ulOperand; - return STATUS_SUCCESS; -} -#endif - -// -// ULONG_PTR -> DWORD conversion -// -#define RtlULongPtrToDWord RtlULongPtrToULong - -// -// ULONG_PTR -> LONGLONG conversion -// -#ifdef _WIN64 -#define RtlULongPtrToLongLong RtlULongLongToLongLong -#else -__checkReturn -__inline -NTSTATUS -RtlULongPtrToLongLong( - __in ULONG_PTR ulOperand, - __out __deref_out_range(==, ulOperand) LONGLONG* pllResult) -{ - *pllResult = (LONGLONG)ulOperand; - return STATUS_SUCCESS; -} -#endif - -// -// ULONG_PTR -> LONG64 conversion -// -#define RtlULongPtrToLong64 RtlULongPtrToLongLong - -// -// ULONG_PTR -> RtlINT64 -// -#define RtlULongPtrToInt64 RtlULongPtrToLongLong - -// -// ULONG_PTR -> ptrdiff_t conversion -// -#define RtlULongPtrToPtrdiffT RtlULongPtrToIntPtr - -// -// ULONG_PTR -> SSIZE_T conversion -// -#define RtlULongPtrToSSIZET RtlULongPtrToLongPtr - -// -// DWORD -> INT8 conversion -// -#define RtlDWordToInt8 RtlULongToInt8 - -// -// DWORD -> CHAR conversion -// -#define RtlDWordToChar RtlULongToChar - -// -// DWORD -> UCHAR conversion -// -#define RtlDWordToUChar RtlULongToUChar - -// -// DWORD -> UINT8 conversion -// -#define RtlDWordToUInt8 RtlULongToUInt8 - -// -// DWORD -> BYTE conversion -// -#define RtlDWordToByte RtlULongToUInt8 - -// -// DWORD -> SHORT conversion -// -#define RtlDWordToShort RtlULongToShort - -// -// DWORD -> INT16 conversion -// -#define RtlDWordToInt16 RtlULongToShort - -// -// DWORD -> USHORT conversion -// -#define RtlDWordToUShort RtlULongToUShort - -// -// DWORD -> UINT16 conversion -// -#define RtlDWordToUInt16 RtlULongToUShort - -// -// DWORD -> WORD conversion -// -#define RtlDWordToWord RtlULongToUShort - -// -// DWORD -> INT conversion -// -#define RtlDWordToInt RtlULongToInt - -// -// DWORD -> INT32 conversion -// -#define RtlDWordToInt32 RtlULongToInt - -// -// DWORD -> INT_PTR conversion -// -#define RtlDWordToIntPtr RtlULongToIntPtr - -// -// DWORD -> UINT conversion -// -#define RtlDWordToUInt RtlULongToUInt - -// -// DWORD -> UINT32 conversion -// -#define RtlDWordToUInt32 RtlULongToUInt - -// -// DWORD -> UINT_PTR conversion -// -#define RtlDWordToUIntPtr RtlULongToUIntPtr - -// -// DWORD -> LONG conversion -// -#define RtlDWordToLong RtlULongToLong - -// -// DWORD -> LONG_PTR conversion -// -#define RtlDWordToLongPtr RtlULongToLongPtr - -// -// DWORD -> ptrdiff_t conversion -// -#define RtlDWordToPtrdiffT RtlULongToIntPtr - -// -// DWORD -> SSIZE_T conversion -// -#define RtlDWordToSSIZET RtlULongToLongPtr - -// -// DWORD_PTR -> INT8 conversion -// -#define RtlDWordPtrToInt8 RtlULongPtrToInt8 - -// -// DWORD_PTR -> UCHAR conversion -// -#define RtlDWordPtrToUChar RtlULongPtrToUChar - -// -// DWORD_PTR -> CHAR conversion -// -#define RtlDWordPtrToChar RtlULongPtrToChar - -// -// DWORD_PTR -> UINT8 conversion -// -#define RtlDWordPtrToUInt8 RtlULongPtrToUInt8 - -// -// DWORD_PTR -> BYTE conversion -// -#define RtlDWordPtrToByte RtlULongPtrToUInt8 - -// -// DWORD_PTR -> SHORT conversion -// -#define RtlDWordPtrToShort RtlULongPtrToShort - -// -// DWORD_PTR -> INT16 conversion -// -#define RtlDWordPtrToInt16 RtlULongPtrToShort - -// -// DWORD_PTR -> USHORT conversion -// -#define RtlDWordPtrToUShort RtlULongPtrToUShort - -// -// DWORD_PTR -> UINT16 conversion -// -#define RtlDWordPtrToUInt16 RtlULongPtrToUShort - -// -// DWORD_PTR -> WORD conversion -// -#define RtlDWordPtrToWord RtlULongPtrToUShort - -// -// DWORD_PTR -> INT conversion -// -#define RtlDWordPtrToInt RtlULongPtrToInt - -// -// DWORD_PTR -> INT32 conversion -// -#define RtlDWordPtrToInt32 RtlULongPtrToInt - -// -// DWORD_PTR -> INT_PTR conversion -// -#define RtlDWordPtrToIntPtr RtlULongPtrToIntPtr - -// -// DWORD_PTR -> UINT conversion -// -#define RtlDWordPtrToUInt RtlULongPtrToUInt - -// -// DWORD_PTR -> UINT32 conversion -// -#define RtlDWordPtrToUInt32 RtlULongPtrToUInt - -// -// DWODR_PTR -> UINT_PTR conversion -// -#define RtlDWordPtrToUIntPtr RtlULongPtrToUIntPtr - -// -// DWORD_PTR -> LONG conversion -// -#define RtlDWordPtrToLong RtlULongPtrToLong - -// -// DWORD_PTR -> LONG_PTR conversion -// -#define RtlDWordPtrToLongPtr RtlULongPtrToLongPtr - -// -// DWORD_PTR -> ULONG conversion -// -#define RtlDWordPtrToULong RtlULongPtrToULong - -// -// DWORD_PTR -> DWORD conversion -// -#define RtlDWordPtrToDWord RtlULongPtrToULong - -// -// DWORD_PTR -> LONGLONG conversion -// -#define RtlDWordPtrToLongLong RtlULongPtrToLongLong - -// -// DWORD_PTR -> LONG64 conversion -// -#define RtlDWordPtrToLong64 RtlULongPtrToLongLong - -// -// DWORD_PTR -> RtlINT64 conversion -// -#define RtlDWordPtrToInt64 RtlULongPtrToLongLong - -// -// DWORD_PTR -> ptrdiff_t conversion -// -#define RtlDWordPtrToPtrdiffT RtlULongPtrToIntPtr - -// -// DWORD_PTR -> SSIZE_T conversion -// -#define RtlDWordPtrToSSIZET RtlULongPtrToLongPtr - -// -// LONGLONG -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongLongToInt8( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if ((llOperand >= INT8_MIN) && (llOperand <= INT8_MAX)) - { - *pi8Result = (INT8)llOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONGLONG -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongLongToUChar( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) UCHAR* pch) -{ - NTSTATUS status; - - if ((llOperand >= 0) && (llOperand <= 255)) - { - *pch = (UCHAR)llOperand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONGLONG -> CHAR conversion -// -__forceinline -NTSTATUS -RtlLongLongToChar( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - return RtlLongLongToUChar(llOperand, (UCHAR*)pch); -#else - return RtlLongLongToInt8(llOperand, (INT8*)pch); -#endif -} - -// -// LONGLONG -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongLongToUInt8( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) UINT8* pu8Result) -{ - NTSTATUS status; - - if ((llOperand >= 0) && (llOperand <= UINT8_MAX)) - { - *pu8Result = (UINT8)llOperand; - status = STATUS_SUCCESS; - } - else - { - *pu8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONGLONG -> BYTE conversion -// -#define RtlLongLongToByte RtlLongLongToUInt8 - -// -// LONGLONG -> SHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongLongToShort( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) SHORT* psResult) -{ - NTSTATUS status; - - if ((llOperand >= SHORT_MIN) && (llOperand <= SHORT_MAX)) - { - *psResult = (SHORT)llOperand; - status = STATUS_SUCCESS; - } - else - { - *psResult = SHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONGLONG -> INT16 conversion -// -#define RtlLongLongToInt16 RtlLongLongToShort - -// -// LONGLONG -> USHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongLongToUShort( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) USHORT* pusResult) -{ - NTSTATUS status; - - if ((llOperand >= 0) && (llOperand <= USHORT_MAX)) - { - *pusResult = (USHORT)llOperand; - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONGLONG -> UINT16 conversion -// -#define RtlLongLongToUInt16 RtlLongLongToUShort - -// -// LONGLONG -> WORD conversion -// -#define RtlLongLongToWord RtlLongLongToUShort - -// -// LONGLONG -> INT conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongLongToInt( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) INT* piResult) -{ - NTSTATUS status; - - if ((llOperand >= INT_MIN) && (llOperand <= INT_MAX)) - { - *piResult = (INT)llOperand; - status = STATUS_SUCCESS; - } - else - { - *piResult = INT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONGLONG -> INT32 conversion -// -#define RtlLongLongToInt32 RtlLongLongToInt - -// -// LONGLONG -> INT_PTR conversion -// -#ifdef _WIN64 -__checkReturn -__inline -NTSTATUS -RtlLongLongToIntPtr( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) INT_PTR* piResult) -{ - *piResult = llOperand; - return STATUS_SUCCESS; -} -#else -#define RtlLongLongToIntPtr RtlLongLongToInt -#endif - -// -// LONGLONG -> UINT conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongLongToUInt( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) UINT* puResult) -{ - NTSTATUS status; - - if ((llOperand >= 0) && (llOperand <= UINT_MAX)) - { - *puResult = (UINT)llOperand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONGLONG -> UINT32 conversion -// -#define RtlLongLongToUInt32 RtlLongLongToUInt - -// -// LONGLONG -> UINT_PTR conversion -// -#ifdef _WIN64 -#define RtlLongLongToUIntPtr RtlLongLongToULongLong -#else -#define RtlLongLongToUIntPtr RtlLongLongToUInt -#endif - -// -// LONGLONG -> LONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongLongToLong( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) LONG* plResult) -{ - NTSTATUS status; - - if ((llOperand >= LONG_MIN) && (llOperand <= LONG_MAX)) - { - *plResult = (LONG)llOperand; - status = STATUS_SUCCESS; - } - else - { - *plResult = LONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONGLONG -> LONG_PTR conversion -// -#ifdef _WIN64 -__checkReturn -__inline -NTSTATUS -RtlLongLongToLongPtr( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) LONG_PTR* plResult) -{ - *plResult = (LONG_PTR)llOperand; - return STATUS_SUCCESS; -} -#else -#define RtlLongLongToLongPtr RtlLongLongToLong -#endif - -// -// LONGLONG -> ULONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongLongToULong( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) ULONG* pulResult) -{ - NTSTATUS status; - - if ((llOperand >= 0) && (llOperand <= ULONG_MAX)) - { - *pulResult = (ULONG)llOperand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONGLONG -> ULONG_PTR conversion -// -#ifdef _WIN64 -#define RtlLongLongToULongPtr RtlLongLongToULongLong -#else -#define RtlLongLongToULongPtr RtlLongLongToULong -#endif - -// -// LONGLONG -> DWORD conversion -// -#define RtlLongLongToDWord RtlLongLongToULong - -// -// LONGLONG -> DWORD_PTR conversion -// -#define RtlLongLongToDWordPtr RtlLongLongToULongPtr - -// -// LONGLONG -> ULONGLONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlLongLongToULongLong( - __in LONGLONG llOperand, - __out __deref_out_range(==, llOperand) ULONGLONG* pullResult) -{ - NTSTATUS status; - - if (llOperand >= 0) - { - *pullResult = (ULONGLONG)llOperand; - status = STATUS_SUCCESS; - } - else - { - *pullResult = ULONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// LONGLONG -> DWORDLONG conversion -// -#define RtlLongLongToDWordLong RtlLongLongToULongLong - -// -// LONGLONG -> ULONG64 conversion -// -#define RtlLongLongToULong64 RtlLongLongToULongLong - -// -// LONGLONG -> DWORD64 conversion -// -#define RtlLongLongToDWord64 RtlLongLongToULongLong - -// -// LONGLONG -> UINT64 conversion -// -#define RtlLongLongToUInt64 RtlLongLongToULongLong - -// -// LONGLONG -> ptrdiff_t conversion -// -#define RtlLongLongToPtrdiffT RtlLongLongToIntPtr - -// -// LONGLONG -> size_t conversion -// -#define RtlLongLongToSizeT RtlLongLongToUIntPtr - -// -// LONGLONG -> SSIZE_T conversion -// -#define RtlLongLongToSSIZET RtlLongLongToLongPtr - -// -// LONGLONG -> SIZE_T conversion -// -#define RtlLongLongToSIZET RtlLongLongToULongPtr - -// -// LONG64 -> CHAR conversion -// -#define RtlLong64ToChar RtlLongLongToChar - -// -// LONG64 -> INT8 conversion -// -#define RtlLong64ToInt8 RtlLongLongToInt8 - -// -// LONG64 -> UCHAR conversion -// -#define RtlLong64ToUChar RtlLongLongToUChar - -// -// LONG64 -> UINT8 conversion -// -#define RtlLong64ToUInt8 RtlLongLongToUInt8 - -// -// LONG64 -> BYTE conversion -// -#define RtlLong64ToByte RtlLongLongToUInt8 - -// -// LONG64 -> SHORT conversion -// -#define RtlLong64ToShort RtlLongLongToShort - -// -// LONG64 -> INT16 conversion -// -#define RtlLong64ToInt16 RtlLongLongToShort - -// -// LONG64 -> USHORT conversion -// -#define RtlLong64ToUShort RtlLongLongToUShort - -// -// LONG64 -> UINT16 conversion -// -#define RtlLong64ToUInt16 RtlLongLongToUShort - -// -// LONG64 -> WORD conversion -// -#define RtlLong64ToWord RtlLongLongToUShort - -// -// LONG64 -> INT conversion -// -#define RtlLong64ToInt RtlLongLongToInt - -// -// LONG64 -> INT32 conversion -// -#define RtlLong64ToInt32 RtlLongLongToInt - -// -// LONG64 -> INT_PTR conversion -// -#define RtlLong64ToIntPtr RtlLongLongToIntPtr - -// -// LONG64 -> UINT conversion -// -#define RtlLong64ToUInt RtlLongLongToUInt - -// -// LONG64 -> UINT32 conversion -// -#define RtlLong64ToUInt32 RtlLongLongToUInt - -// -// LONG64 -> UINT_PTR conversion -// -#define RtlLong64ToUIntPtr RtlLongLongToUIntPtr - -// -// LONG64 -> LONG conversion -// -#define RtlLong64ToLong RtlLongLongToLong - -// -// LONG64 -> LONG_PTR conversion -// -#define RtlLong64ToLongPtr RtlLongLongToLongPtr - -// -// LONG64 -> ULONG conversion -// -#define RtlLong64ToULong RtlLongLongToULong - -// -// LONG64 -> ULONG_PTR conversion -// -#define RtlLong64ToULongPtr RtlLongLongToULongPtr - -// -// LONG64 -> DWORD conversion -// -#define RtlLong64ToDWord RtlLongLongToULong - -// -// LONG64 -> DWORD_PTR conversion -// -#define RtlLong64ToDWordPtr RtlLongLongToULongPtr - -// -// LONG64 -> ULONGLONG conversion -// -#define RtlLong64ToULongLong RtlLongLongToULongLong - -// -// LONG64 -> ptrdiff_t conversion -// -#define RtlLong64ToPtrdiffT RtlLongLongToIntPtr - -// -// LONG64 -> size_t conversion -// -#define RtlLong64ToSizeT RtlLongLongToUIntPtr - -// -// LONG64 -> SSIZE_T conversion -// -#define RtlLong64ToSSIZET RtlLongLongToLongPtr - -// -// LONG64 -> SIZE_T conversion -// -#define RtlLong64ToSIZET RtlLongLongToULongPtr - -// -// RtlINT64 -> CHAR conversion -// -#define RtlInt64ToChar RtlLongLongToChar - -// -// RtlINT64 -> INT8 conversion -// -#define RtlInt64ToInt8 RtlLongLongToInt8 - -// -// RtlINT64 -> UCHAR conversion -// -#define RtlInt64ToUChar RtlLongLongToUChar - -// -// RtlINT64 -> UINT8 conversion -// -#define RtlInt64ToUInt8 RtlLongLongToUInt8 - -// -// RtlINT64 -> BYTE conversion -// -#define RtlInt64ToByte RtlLongLongToUInt8 - -// -// RtlINT64 -> SHORT conversion -// -#define RtlInt64ToShort RtlLongLongToShort - -// -// RtlINT64 -> INT16 conversion -// -#define RtlInt64ToInt16 RtlLongLongToShort - -// -// RtlINT64 -> USHORT conversion -// -#define RtlInt64ToUShort RtlLongLongToUShort - -// -// RtlINT64 -> UINT16 conversion -// -#define RtlInt64ToUInt16 RtlLongLongToUShort - -// -// RtlINT64 -> WORD conversion -// -#define RtlInt64ToWord RtlLongLongToUShort - -// -// RtlINT64 -> INT conversion -// -#define RtlInt64ToInt RtlLongLongToInt - -// -// RtlINT64 -> INT32 conversion -// -#define RtlInt64ToInt32 RtlLongLongToInt - -// -// RtlINT64 -> INT_PTR conversion -// -#define RtlInt64ToIntPtr RtlLongLongToIntPtr - -// -// RtlINT64 -> UINT conversion -// -#define RtlInt64ToUInt RtlLongLongToUInt - -// -// RtlINT64 -> UINT32 conversion -// -#define RtlInt64ToUInt32 RtlLongLongToUInt - -// -// RtlINT64 -> UINT_PTR conversion -// -#define RtlInt64ToUIntPtr RtlLongLongToUIntPtr - -// -// RtlINT64 -> LONG conversion -// -#define RtlInt64ToLong RtlLongLongToLong - -// -// RtlINT64 -> LONG_PTR conversion -// -#define RtlInt64ToLongPtr RtlLongLongToLongPtr - -// -// RtlINT64 -> ULONG conversion -// -#define RtlInt64ToULong RtlLongLongToULong - -// -// RtlINT64 -> ULONG_PTR conversion -// -#define RtlInt64ToULongPtr RtlLongLongToULongPtr - -// -// RtlINT64 -> DWORD conversion -// -#define RtlInt64ToDWord RtlLongLongToULong - -// -// RtlINT64 -> DWORD_PTR conversion -// -#define RtlInt64ToDWordPtr RtlLongLongToULongPtr - -// -// RtlINT64 -> ULONGLONG conversion -// -#define RtlInt64ToULongLong RtlLongLongToULongLong - -// -// RtlINT64 -> DWORDLONG conversion -// -#define RtlInt64ToDWordLong RtlLongLongToULongLong - -// -// RtlINT64 -> ULONG64 conversion -// -#define RtlInt64ToULong64 RtlLongLongToULongLong - -// -// RtlINT64 -> DWORD64 conversion -// -#define RtlInt64ToDWord64 RtlLongLongToULongLong - -// -// RtlINT64 -> UINT64 conversion -// -#define RtlInt64ToUInt64 RtlLongLongToULongLong - -// -// RtlINT64 -> ptrdiff_t conversion -// -#define RtlInt64ToPtrdiffT RtlLongLongToIntPtr - -// -// RtlINT64 -> size_t conversion -// -#define RtlInt64ToSizeT RtlLongLongToUIntPtr - -// -// RtlINT64 -> SSIZE_T conversion -// -#define RtlInt64ToSSIZET RtlLongLongToLongPtr - -// -// RtlINT64 -> SIZE_T conversion -// -#define RtlInt64ToSIZET RtlLongLongToULongPtr - -// -// ULONGLONG -> INT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongLongToInt8( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) INT8* pi8Result) -{ - NTSTATUS status; - - if (ullOperand <= INT8_MAX) - { - *pi8Result = (INT8)ullOperand; - status = STATUS_SUCCESS; - } - else - { - *pi8Result = INT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONGLONG -> UCHAR conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongLongToUChar( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) UCHAR* pch) -{ - NTSTATUS status; - - if (ullOperand <= 255) - { - *pch = (UCHAR)ullOperand; - status = STATUS_SUCCESS; - } - else - { - *pch = '\0'; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONGLONG -> CHAR conversion -// -__forceinline -NTSTATUS -RtlULongLongToChar( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) CHAR* pch) -{ -#ifdef _CHAR_UNSIGNED - return RtlULongLongToUChar(ullOperand, (UCHAR*)pch); -#else - return RtlULongLongToInt8(ullOperand, (INT8*)pch); -#endif -} - -// -// ULONGLONG -> UINT8 conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongLongToUInt8( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) UINT8* pu8Result) -{ - NTSTATUS status; - - if (ullOperand <= UINT8_MAX) - { - *pu8Result = (UINT8)ullOperand; - status = STATUS_SUCCESS; - } - else - { - *pu8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONGLONG -> BYTE conversion -// -#define RtlULongLongToByte RtlULongLongToUInt8 - -// -// ULONGLONG -> SHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongLongToShort( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) SHORT* psResult) -{ - NTSTATUS status; - - if (ullOperand <= SHORT_MAX) - { - *psResult = (SHORT)ullOperand; - status = STATUS_SUCCESS; - } - else - { - *psResult = SHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONGLONG -> INT16 conversion -// -#define RtlULongLongToInt16 RtlULongLongToShort - -// -// ULONGLONG -> USHORT conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongLongToUShort( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) USHORT* pusResult) -{ - NTSTATUS status; - - if (ullOperand <= USHORT_MAX) - { - *pusResult = (USHORT)ullOperand; - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONGLONG -> UINT16 conversion -// -#define RtlULongLongToUInt16 RtlULongLongToUShort - -// -// ULONGLONG -> WORD conversion -// -#define RtlULongLongToWord RtlULongLongToUShort - -// -// ULONGLONG -> INT conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongLongToInt( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) INT* piResult) -{ - NTSTATUS status; - - if (ullOperand <= INT_MAX) - { - *piResult = (INT)ullOperand; - status = STATUS_SUCCESS; - } - else - { - *piResult = INT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONGLONG -> INT32 conversion -// -#define RtlULongLongToInt32 RtlULongLongToInt - -// -// ULONGLONG -> INT_PTR conversion -// -#ifdef _WIN64 -#define RtlULongLongToIntPtr RtlULongLongToLongLong -#else -#define RtlULongLongToIntPtr RtlULongLongToInt -#endif - -// -// ULONGLONG -> UINT conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongLongToUInt( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) UINT* puResult) -{ - NTSTATUS status; - - if (ullOperand <= UINT_MAX) - { - *puResult = (UINT)ullOperand; - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONGLONG -> UINT32 conversion -// -#define RtlULongLongToUInt32 RtlULongLongToUInt - -// -// ULONGLONG -> UINT_PTR conversion -// -#ifdef _WIN64 -__checkReturn -__inline -NTSTATUS -RtlULongLongToUIntPtr( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) UINT_PTR* puResult) -{ - *puResult = ullOperand; - return STATUS_SUCCESS; -} -#else -#define RtlULongLongToUIntPtr RtlULongLongToUInt -#endif - -// -// ULONGLONG -> LONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongLongToLong( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) LONG* plResult) -{ - NTSTATUS status; - - if (ullOperand <= LONG_MAX) - { - *plResult = (LONG)ullOperand; - status = STATUS_SUCCESS; - } - else - { - *plResult = LONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONGLONG -> LONG_PTR conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongLongToLongPtr( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) LONG_PTR* plResult) -{ - NTSTATUS status; - - if (ullOperand <= LONG_PTR_MAX) - { - *plResult = (LONG_PTR)ullOperand; - status = STATUS_SUCCESS; - } - else - { - *plResult = LONG_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONGLONG -> ULONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongLongToULong( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) ULONG* pulResult) -{ - NTSTATUS status; - - if (ullOperand <= ULONG_MAX) - { - *pulResult = (ULONG)ullOperand; - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONGLONG -> ULONG_PTR conversion -// -#ifdef _WIN64 -__checkReturn -__inline -NTSTATUS -RtlULongLongToULongPtr( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) ULONG_PTR* pulResult) -{ - *pulResult = ullOperand; - return STATUS_SUCCESS; -} -#else -#define RtlULongLongToULongPtr RtlULongLongToULong -#endif - -// -// ULONGLONG -> DWORD conversion -// -#define RtlULongLongToDWord RtlULongLongToULong - -// -// ULONGLONG -> DWORD_PTR conversion -// -#define RtlULongLongToDWordPtr RtlULongLongToULongPtr - -// -// ULONGLONG -> LONGLONG conversion -// -__checkReturn -__inline -NTSTATUS -RtlULongLongToLongLong( - __in ULONGLONG ullOperand, - __out __deref_out_range(==, ullOperand) LONGLONG* pllResult) -{ - NTSTATUS status; - - if (ullOperand <= LONGLONG_MAX) - { - *pllResult = (LONGLONG)ullOperand; - status = STATUS_SUCCESS; - } - else - { - *pllResult = LONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONGLONG -> RtlINT64 conversion -// -#define RtlULongLongToInt64 RtlULongLongToLongLong - -// -// ULONGLONG -> LONG64 conversion -// -#define RtlULongLongToLong64 RtlULongLongToLongLong - -// -// ULONGLONG -> ptrdiff_t conversion -// -#define RtlULongLongToPtrdiffT RtlULongLongToIntPtr - -// -// ULONGLONG -> size_t conversion -// -#define RtlULongLongToSizeT RtlULongLongToUIntPtr - -// -// ULONGLONG -> SSIZE_T conversion -// -#define RtlULongLongToSSIZET RtlULongLongToLongPtr - -// -// ULONGLONG -> SIZE_T conversion -// -#define RtlULongLongToSIZET RtlULongLongToULongPtr - -// -// DWORDLONG -> CHAR conversion -// -#define RtlDWordLongToChar RtlULongLongToChar - -// -// DWORDLONG -> INT8 conversion -// -#define RtlDWordLongToInt8 RtlULongLongToInt8 - -// -// DWORDLONG -> UCHAR conversion -// -#define RtlDWordLongToUChar RtlULongLongToUChar - -// -// DWORDLONG -> UINT8 conversion -// -#define RtlDWordLongToUInt8 RtlULongLongToUInt8 - -// -// DWORDLONG -> BYTE conversion -// -#define RtlDWordLongToByte RtlULongLongToUInt8 - -// -// DWORDLONG -> SHORT conversion -// -#define RtlDWordLongToShort RtlULongLongToShort - -// -// DWORDLONG -> INT16 conversion -// -#define RtlDWordLongToInt16 RtlULongLongToShort - -// -// DWORDLONG -> USHORT conversion -// -#define RtlDWordLongToUShort RtlULongLongToUShort - -// -// DWORDLONG -> UINT16 conversion -// -#define RtlDWordLongToUInt16 RtlULongLongToUShort - -// -// DWORDLONG -> WORD conversion -// -#define RtlDWordLongToWord RtlULongLongToUShort - -// -// DWORDLONG -> INT conversion -// -#define RtlDWordLongToInt RtlULongLongToInt - -// -// DWORDLONG -> INT32 conversion -// -#define RtlDWordLongToInt32 RtlULongLongToInt - -// -// DWORDLONG -> INT_PTR conversion -// -#define RtlDWordLongToIntPtr RtlULongLongToIntPtr - -// -// DWORDLONG -> UINT conversion -// -#define RtlDWordLongToUInt RtlULongLongToUInt - -// -// DWORDLONG -> UINT32 conversion -// -#define RtlDWordLongToUInt32 RtlULongLongToUInt - -// -// DWORDLONG -> UINT_PTR conversion -// -#define RtlDWordLongToUIntPtr RtlULongLongToUIntPtr - -// -// DWORDLONG -> LONG conversion -// -#define RtlDWordLongToLong RtlULongLongToLong - -// -// DWORDLONG -> LONG_PTR conversion -// -#define RtlDWordLongToLongPtr RtlULongLongToLongPtr - -// -// DWORDLONG -> ULONG conversion -// -#define RtlDWordLongToULong RtlULongLongToULong - -// -// DWORDLONG -> ULONG_PTR conversion -// -#define RtlDWordLongToULongPtr RtlULongLongToULongPtr - -// -// DWORDLONG -> DWORD conversion -// -#define RtlDWordLongToDWord RtlULongLongToULong - -// -// DWORDLONG -> DWORD_PTR conversion -// -#define RtlDWordLongToDWordPtr RtlULongLongToULongPtr - -// -// DWORDLONG -> LONGLONG conversion -// -#define RtlDWordLongToLongLong RtlULongLongToLongLong - -// -// DWORDLONG -> LONG64 conversion -// -#define RtlDWordLongToLong64 RtlULongLongToLongLong - -// -// DWORDLONG -> RtlINT64 conversion -// -#define RtlDWordLongToInt64 RtlULongLongToLongLong - -// -// DWORDLONG -> ptrdiff_t conversion -// -#define RtlDWordLongToPtrdiffT RtlULongLongToIntPtr - -// -// DWORDLONG -> size_t conversion -// -#define RtlDWordLongToSizeT RtlULongLongToUIntPtr - -// -// DWORDLONG -> SSIZE_T conversion -// -#define RtlDWordLongToSSIZET RtlULongLongToLongPtr - -// -// DWORDLONG -> SIZE_T conversion -// -#define RtlDWordLongToSIZET RtlULongLongToULongPtr - -// -// ULONG64 -> CHAR conversion -// -#define RtlULong64ToChar RtlULongLongToChar - -// -// ULONG64 -> INT8 conversion -// -#define RtlULong64ToInt8 RtlULongLongToInt8 - -// -// ULONG64 -> UCHAR conversion -// -#define RtlULong64ToUChar RtlULongLongToUChar - -// -// ULONG64 -> UINT8 conversion -// -#define RtlULong64ToUInt8 RtlULongLongToUInt8 - -// -// ULONG64 -> BYTE conversion -// -#define RtlULong64ToByte RtlULongLongToUInt8 - -// -// ULONG64 -> SHORT conversion -// -#define RtlULong64ToShort RtlULongLongToShort - -// -// ULONG64 -> INT16 conversion -// -#define RtlULong64ToInt16 RtlULongLongToShort - -// -// ULONG64 -> USHORT conversion -// -#define RtlULong64ToUShort RtlULongLongToUShort - -// -// ULONG64 -> UINT16 conversion -// -#define RtlULong64ToUInt16 RtlULongLongToUShort - -// -// ULONG64 -> WORD conversion -// -#define RtlULong64ToWord RtlULongLongToUShort - -// -// ULONG64 -> INT conversion -// -#define RtlULong64ToInt RtlULongLongToInt - -// -// ULONG64 -> INT32 conversion -// -#define RtlULong64ToInt32 RtlULongLongToInt - -// -// ULONG64 -> INT_PTR conversion -// -#define RtlULong64ToIntPtr RtlULongLongToIntPtr - -// -// ULONG64 -> UINT conversion -// -#define RtlULong64ToUInt RtlULongLongToUInt - -// -// ULONG64 -> UINT32 conversion -// -#define RtlULong64ToUInt32 RtlULongLongToUInt - -// -// ULONG64 -> UINT_PTR conversion -// -#define RtlULong64ToUIntPtr RtlULongLongToUIntPtr - -// -// ULONG64 -> LONG conversion -// -#define RtlULong64ToLong RtlULongLongToLong - -// -// ULONG64 -> LONG_PTR conversion -// -#define RtlULong64ToLongPtr RtlULongLongToLongPtr - -// -// ULONG64 -> ULONG conversion -// -#define RtlULong64ToULong RtlULongLongToULong - -// -// ULONG64 -> ULONG_PTR conversion -// -#define RtlULong64ToULongPtr RtlULongLongToULongPtr - -// -// ULONG64 -> DWORD conversion -// -#define RtlULong64ToDWord RtlULongLongToULong - -// -// ULONG64 -> DWORD_PTR conversion -// -#define RtlULong64ToDWordPtr RtlULongLongToULongPtr - -// -// ULONG64 -> LONGLONG conversion -// -#define RtlULong64ToLongLong RtlULongLongToLongLong - -// -// ULONG64 -> LONG64 conversion -// -#define RtlULong64ToLong64 RtlULongLongToLongLong - -// -// ULONG64 -> RtlINT64 conversion -// -#define RtlULong64ToInt64 RtlULongLongToLongLong - -// -// ULONG64 -> ptrdiff_t conversion -// -#define RtlULong64ToPtrdiffT RtlULongLongToIntPtr - -// -// ULONG64 -> size_t conversion -// -#define RtlULong64ToSizeT RtlULongLongToUIntPtr - -// -// ULONG64 -> SSIZE_T conversion -// -#define RtlULong64ToSSIZET RtlULongLongToLongPtr - -// -// ULONG64 -> SIZE_T conversion -// -#define RtlULong64ToSIZET RtlULongLongToULongPtr - -// -// DWORD64 -> CHAR conversion -// -#define RtlDWord64ToChar RtlULongLongToChar - -// -// DWORD64 -> INT8 conversion -// -#define RtlDWord64ToInt8 RtlULongLongToInt8 - -// -// DWORD64 -> UCHAR conversion -// -#define RtlDWord64ToUChar RtlULongLongToUChar - -// -// DWORD64 -> UINT8 conversion -// -#define RtlDWord64ToUInt8 RtlULongLongToUInt8 - -// -// DWORD64 -> BYTE conversion -// -#define RtlDWord64ToByte RtlULongLongToUInt8 - -// -// DWORD64 -> SHORT conversion -// -#define RtlDWord64ToShort RtlULongLongToShort - -// -// DWORD64 -> INT16 conversion -// -#define RtlDWord64ToInt16 RtlULongLongToShort - -// -// DWORD64 -> USHORT conversion -// -#define RtlDWord64ToUShort RtlULongLongToUShort - -// -// DWORD64 -> UINT16 conversion -// -#define RtlDWord64ToUInt16 RtlULongLongToUShort - -// -// DWORD64 -> WORD conversion -// -#define RtlDWord64ToWord RtlULongLongToUShort - -// -// DWORD64 -> INT conversion -// -#define RtlDWord64ToInt RtlULongLongToInt - -// -// DWORD64 -> INT32 conversion -// -#define RtlDWord64ToInt32 RtlULongLongToInt - -// -// DWORD64 -> INT_PTR conversion -// -#define RtlDWord64ToIntPtr RtlULongLongToIntPtr - -// -// DWORD64 -> UINT conversion -// -#define RtlDWord64ToUInt RtlULongLongToUInt - -// -// DWORD64 -> UINT32 conversion -// -#define RtlDWord64ToUInt32 RtlULongLongToUInt - -// -// DWORD64 -> UINT_PTR conversion -// -#define RtlDWord64ToUIntPtr RtlULongLongToUIntPtr - -// -// DWORD64 -> LONG conversion -// -#define RtlDWord64ToLong RtlULongLongToLong - -// -// DWORD64 -> LONG_PTR conversion -// -#define RtlDWord64ToLongPtr RtlULongLongToLongPtr - -// -// DWORD64 -> ULONG conversion -// -#define RtlDWord64ToULong RtlULongLongToULong - -// -// DWORD64 -> ULONG_PTR conversion -// -#define RtlDWord64ToULongPtr RtlULongLongToULongPtr - -// -// DWORD64 -> DWORD conversion -// -#define RtlDWord64ToDWord RtlULongLongToULong - -// -// DWORD64 -> DWORD_PTR conversion -// -#define RtlDWord64ToDWordPtr RtlULongLongToULongPtr - -// -// DWORD64 -> LONGLONG conversion -// -#define RtlDWord64ToLongLong RtlULongLongToLongLong - -// -// DWORD64 -> LONG64 conversion -// -#define RtlDWord64ToLong64 RtlULongLongToLongLong - -// -// DWORD64 -> RtlINT64 conversion -// -#define RtlDWord64ToInt64 RtlULongLongToLongLong - -// -// DWORD64 -> ptrdiff_t conversion -// -#define RtlDWord64ToPtrdiffT RtlULongLongToIntPtr - -// -// DWORD64 -> size_t conversion -// -#define RtlDWord64ToSizeT RtlULongLongToUIntPtr - -// -// DWORD64 -> SSIZE_T conversion -// -#define RtlDWord64ToSSIZET RtlULongLongToLongPtr - -// -// DWORD64 -> SIZE_T conversion -// -#define RtlDWord64ToSIZET RtlULongLongToULongPtr - -// -// UINT64 -> CHAR conversion -// -#define RtlUInt64ToChar RtlULongLongToChar - -// -// UINT64 -> INT8 conversion -// -#define RtlUInt64ToInt8 RtlULongLongToInt8 - -// -// UINT64 -> UCHAR conversion -// -#define RtlUInt64ToUChar RtlULongLongToUChar - -// -// UINT64 -> UINT8 conversion -// -#define RtlUInt64ToUInt8 RtlULongLongToUInt8 - -// -// UINT64 -> BYTE conversion -// -#define RtlUInt64ToByte RtlULongLongToUInt8 - -// -// UINT64 -> SHORT conversion -// -#define RtlUInt64ToShort RtlULongLongToShort - -// -// UINT64 -> INT16 conversion -// -// -#define RtlUInt64ToInt16 RtlULongLongToShort - -// -// UINT64 -> USHORT conversion -// -#define RtlUInt64ToUShort RtlULongLongToUShort - -// -// UINT64 -> UINT16 conversion -// -#define RtlUInt64ToUInt16 RtlULongLongToUShort - -// -// UINT64 -> WORD conversion -// -#define RtlUInt64ToWord RtlULongLongToUShort - -// -// UINT64 -> INT conversion -// -#define RtlUInt64ToInt RtlULongLongToInt - -// -// UINT64 -> INT32 conversion -// -#define RtlUInt64ToInt32 RtlULongLongToInt - -// -// UINT64 -> INT_PTR conversion -// -#define RtlUInt64ToIntPtr RtlULongLongToIntPtr - -// -// UINT64 -> UINT conversion -// -#define RtlUInt64ToUInt RtlULongLongToUInt - -// -// UINT64 -> UINT32 conversion -// -#define RtlUInt64ToUInt32 RtlULongLongToUInt - -// -// UINT64 -> UINT_PTR conversion -// -#define RtlUInt64ToUIntPtr RtlULongLongToUIntPtr - -// -// UINT64 -> LONG conversion -// -#define RtlUInt64ToLong RtlULongLongToLong - -// -// UINT64 -> LONG_PTR conversion -// -#define RtlUInt64ToLongPtr RtlULongLongToLongPtr - -// -// UINT64 -> ULONG conversion -// -#define RtlUInt64ToULong RtlULongLongToULong - -// -// UINT64 -> ULONG_PTR conversion -// -#define RtlUInt64ToULongPtr RtlULongLongToULongPtr - -// -// UINT64 -> DWORD conversion -// -#define RtlUInt64ToDWord RtlULongLongToULong - -// -// UINT64 -> DWORD_PTR conversion -// -#define RtlUInt64ToDWordPtr RtlULongLongToULongPtr - -// -// UINT64 -> LONGLONG conversion -// -#define RtlUInt64ToLongLong RtlULongLongToLongLong - -// -// UINT64 -> LONG64 conversion -// -#define RtlUInt64ToLong64 RtlULongLongToLongLong - -// -// UINT64 -> RtlINT64 conversion -// -#define RtlUInt64ToInt64 RtlULongLongToLongLong - -// -// UINT64 -> ptrdiff_t conversion -// -#define RtlUInt64ToPtrdiffT RtlULongLongToIntPtr - -// -// UINT64 -> size_t conversion -// -#define RtlUInt64ToSizeT RtlULongLongToUIntPtr - -// -// UINT64 -> SSIZE_T conversion -// -#define RtlUInt64ToSSIZET RtlULongLongToLongPtr - -// -// UINT64 -> SIZE_T conversion -// -#define RtlUInt64ToSIZET RtlULongLongToULongPtr - -// -// ptrdiff_t -> CHAR conversion -// -#define RtlPtrdiffTToChar RtlIntPtrToChar - -// -// ptrdiff_t -> INT8 conversion -// -#define RtlPtrdiffTToInt8 RtlIntPtrToInt8 - -// -// ptrdiff_t -> UCHAR conversion -// -#define RtlPtrdiffTToUChar RtlIntPtrToUChar - -// -// ptrdiff_t -> UINT8 conversion -// -#define RtlPtrdiffTToUInt8 RtlIntPtrToUInt8 - -// -// ptrdiff_t -> BYTE conversion -// -#define RtlPtrdiffTToByte RtlIntPtrToUInt8 - -// -// ptrdiff_t -> SHORT conversion -// -#define RtlPtrdiffTToShort RtlIntPtrToShort - -// -// ptrdiff_t -> INT16 conversion -// -#define RtlPtrdiffTToInt16 RtlIntPtrToShort - -// -// ptrdiff_t -> USHORT conversion -// -#define RtlPtrdiffTToUShort RtlIntPtrToUShort - -// -// ptrdiff_t -> UINT16 conversion -// -#define RtlPtrdiffTToUInt16 RtlIntPtrToUShort - -// -// ptrdiff_t -> WORD conversion -// -#define RtlPtrdiffTToWord RtlIntPtrToUShort - -// -// ptrdiff_t -> INT conversion -// -#define RtlPtrdiffTToInt RtlIntPtrToInt - -// -// ptrdiff_t -> INT32 conversion -// -#define RtlPtrdiffTToInt32 RtlIntPtrToInt - -// -// ptrdiff_t -> UINT conversion -// -#define RtlPtrdiffTToUInt RtlIntPtrToUInt - -// -// ptrdiff_t -> UINT32 conversion -// -#define RtlPtrdiffTToUInt32 RtlIntPtrToUInt - -// -// ptrdiff_t -> UINT_PTR conversion -// -#define RtlPtrdiffTToUIntPtr RtlIntPtrToUIntPtr - -// -// ptrdiff_t -> LONG conversion -// -#define RtlPtrdiffTToLong RtlIntPtrToLong - -// -// ptrdiff_t -> LONG_PTR conversion -// -#define RtlPtrdiffTToLongPtr RtlIntPtrToLongPtr - -// -// ptrdiff_t -> ULONG conversion -// -#define RtlPtrdiffTToULong RtlIntPtrToULong - -// -// ptrdiff_t -> ULONG_PTR conversion -// -#define RtlPtrdiffTToULongPtr RtlIntPtrToULongPtr - -// -// ptrdiff_t -> DWORD conversion -// -#define RtlPtrdiffTToDWord RtlIntPtrToULong - -// -// ptrdiff_t -> DWORD_PTR conversion -// -#define RtlPtrdiffTToDWordPtr RtlIntPtrToULongPtr - -// -// ptrdiff_t -> ULONGLONG conversion -// -#define RtlPtrdiffTToULongLong RtlIntPtrToULongLong - -// -// ptrdiff_t -> DWORDLONG conversion -// -#define RtlPtrdiffTToDWordLong RtlIntPtrToULongLong - -// -// ptrdiff_t -> ULONG64 conversion -// -#define RtlPtrdiffTToULong64 RtlIntPtrToULongLong - -// -// ptrdiff_t -> DWORD64 conversion -// -#define RtlPtrdiffTToDWord64 RtlIntPtrToULongLong - -// -// ptrdiff_t -> UINT64 conversion -// -#define RtlPtrdiffTToUInt64 RtlIntPtrToULongLong - -// -// ptrdiff_t -> size_t conversion -// -#define RtlPtrdiffTToSizeT RtlIntPtrToUIntPtr - -// -// ptrdiff_t -> SIZE_T conversion -// -#define RtlPtrdiffTToSIZET RtlIntPtrToULongPtr - -// -// size_t -> INT8 conversion -// -#define RtlSizeTToInt8 RtlUIntPtrToInt8 - -// -// size_t -> UCHAR conversion -// -#define RtlSizeTToUChar RtlUIntPtrToUChar - -// -// size_t -> CHAR conversion -// -#define RtlSizeTToChar RtlUIntPtrToChar - -// -// size_t -> UINT8 conversion -// -#define RtlSizeTToUInt8 RtlUIntPtrToUInt8 - -// -// size_t -> BYTE conversion -// -#define RtlSizeTToByte RtlUIntPtrToUInt8 - -// -// size_t -> SHORT conversion -// -#define RtlSizeTToShort RtlUIntPtrToShort - -// -// size_t -> INT16 conversion -// -#define RtlSizeTToInt16 RtlUIntPtrToShort - -// -// size_t -> USHORT conversion -// -#define RtlSizeTToUShort RtlUIntPtrToUShort - -// -// size_t -> UINT16 conversion -// -#define RtlSizeTToUInt16 RtlUIntPtrToUShort - -// -// size_t -> WORD -// -#define RtlSizeTToWord RtlUIntPtrToUShort - -// -// size_t -> INT conversion -// -#define RtlSizeTToInt RtlUIntPtrToInt - -// -// size_t -> INT32 conversion -// -#define RtlSizeTToInt32 RtlUIntPtrToInt - -// -// size_t -> INT_PTR conversion -// -#define RtlSizeTToIntPtr RtlUIntPtrToIntPtr - -// -// size_t -> UINT conversion -// -#define RtlSizeTToUInt RtlUIntPtrToUInt - -// -// size_t -> UINT32 conversion -// -#define RtlSizeTToUInt32 RtlUIntPtrToUInt - -// -// size_t -> LONG conversion -// -#define RtlSizeTToLong RtlUIntPtrToLong - -// -// size_t -> LONG_PTR conversion -// -#define RtlSizeTToLongPtr RtlUIntPtrToLongPtr - -// -// size_t -> ULONG conversion -// -#define RtlSizeTToULong RtlUIntPtrToULong - -// -// size_t -> DWORD conversion -// -#define RtlSizeTToDWord RtlUIntPtrToULong - -// -// size_t -> LONGLONG conversion -// -#define RtlSizeTToLongLong RtlUIntPtrToLongLong - -// -// size_t -> LONG64 conversion -// -#define RtlSizeTToLong64 RtlUIntPtrToLongLong - -// -// size_t -> RtlINT64 -// -#define RtlSizeTToInt64 RtlUIntPtrToLongLong - -// -// size_t -> ptrdiff_t conversion -// -#define RtlSizeTToPtrdiffT RtlUIntPtrToIntPtr - -// -// size_t -> SSIZE_T conversion -// -#define RtlSizeTToSSIZET RtlUIntPtrToLongPtr - -// -// SSIZE_T -> INT8 conversion -// -#define RtlSSIZETToInt8 RtlLongPtrToInt8 - -// -// SSIZE_T -> UCHAR conversion -// -#define RtlSSIZETToUChar RtlLongPtrToUChar - -// -// SSIZE_T -> CHAR conversion -// -#define RtlSSIZETToChar RtlLongPtrToChar - -// -// SSIZE_T -> UINT8 conversion -// -#define RtlSSIZETToUInt8 RtlLongPtrToUInt8 - -// -// SSIZE_T -> BYTE conversion -// -#define RtlSSIZETToByte RtlLongPtrToUInt8 - -// -// SSIZE_T -> SHORT conversion -// -#define RtlSSIZETToShort RtlLongPtrToShort - -// -// SSIZE_T -> INT16 conversion -// -#define RtlSSIZETToInt16 RtlLongPtrToShort - -// -// SSIZE_T -> USHORT conversion -// -#define RtlSSIZETToUShort RtlLongPtrToUShort - -// -// SSIZE_T -> UINT16 conversion -// -#define RtlSSIZETToUInt16 RtlLongPtrToUShort - -// -// SSIZE_T -> WORD conversion -// -#define RtlSSIZETToWord RtlLongPtrToUShort - -// -// SSIZE_T -> INT conversion -// -#define RtlSSIZETToInt RtlLongPtrToInt - -// -// SSIZE_T -> INT32 conversion -// -#define RtlSSIZETToInt32 RtlLongPtrToInt - -// -// SSIZE_T -> INT_PTR conversion -// -#define RtlSSIZETToIntPtr RtlLongPtrToIntPtr - -// -// SSIZE_T -> UINT conversion -// -#define RtlSSIZETToUInt RtlLongPtrToUInt - -// -// SSIZE_T -> UINT32 conversion -// -#define RtlSSIZETToUInt32 RtlLongPtrToUInt - -// -// SSIZE_T -> UINT_PTR conversion -// -#define RtlSSIZETToUIntPtr RtlLongPtrToUIntPtr - -// -// SSIZE_T -> LONG conversion -// -#define RtlSSIZETToLong RtlLongPtrToLong - -// -// SSIZE_T -> ULONG conversion -// -#define RtlSSIZETToULong RtlLongPtrToULong - -// -// SSIZE_T -> ULONG_PTR conversion -// -#define RtlSSIZETToULongPtr RtlLongPtrToULongPtr - -// -// SSIZE_T -> DWORD conversion -// -#define RtlSSIZETToDWord RtlLongPtrToULong - -// -// SSIZE_T -> DWORD_PTR conversion -// -#define RtlSSIZETToDWordPtr RtlLongPtrToULongPtr - -// -// SSIZE_T -> ULONGLONG conversion -// -#define RtlSSIZETToULongLong RtlLongPtrToULongLong - -// -// SSIZE_T -> DWORDLONG conversion -// -#define RtlSSIZETToDWordLong RtlLongPtrToULongLong - -// -// SSIZE_T -> ULONG64 conversion -// -#define RtlSSIZETToULong64 RtlLongPtrToULongLong - -// -// SSIZE_T -> DWORD64 conversion -// -#define RtlSSIZETToDWord64 RtlLongPtrToULongLong - -// -// SSIZE_T -> UINT64 conversion -// -#define RtlSSIZETToUInt64 RtlLongPtrToULongLong - -// -// SSIZE_T -> size_t conversion -// -#define RtlSSIZETToSizeT RtlLongPtrToUIntPtr - -// -// SSIZE_T -> SIZE_T conversion -// -#define RtlSSIZETToSIZET RtlLongPtrToULongPtr - -// -// SIZE_T -> INT8 conversion -// -#define RtlSIZETToInt8 RtlULongPtrToInt8 - -// -// SIZE_T -> UCHAR conversion -// -#define RtlSIZETToUChar RtlULongPtrToUChar - -// -// SIZE_T -> CHAR conversion -// -#define RtlSIZETToChar RtlULongPtrToChar - -// -// SIZE_T -> UINT8 conversion -// -#define RtlSIZETToUInt8 RtlULongPtrToUInt8 - -// -// SIZE_T -> BYTE conversion -// -#define RtlSIZETToByte RtlULongPtrToUInt8 - -// -// SIZE_T -> SHORT conversion -// -#define RtlSIZETToShort RtlULongPtrToShort - -// -// SIZE_T -> INT16 conversion -// -#define RtlSIZETToInt16 RtlULongPtrToShort - -// -// SIZE_T -> USHORT conversion -// -#define RtlSIZETToUShort RtlULongPtrToUShort - -// -// SIZE_T -> UINT16 conversion -// -#define RtlSIZETToUInt16 RtlULongPtrToUShort - -// -// SIZE_T -> WORD -// -#define RtlSIZETToWord RtlULongPtrToUShort - -// -// SIZE_T -> INT conversion -// -#define RtlSIZETToInt RtlULongPtrToInt - -// -// SIZE_T -> INT32 conversion -// -#define RtlSIZETToInt32 RtlULongPtrToInt - -// -// SIZE_T -> INT_PTR conversion -// -#define RtlSIZETToIntPtr RtlULongPtrToIntPtr - -// -// SIZE_T -> UINT conversion -// -#define RtlSIZETToUInt RtlULongPtrToUInt - -// -// SIZE_T -> UINT32 conversion -// -#define RtlSIZETToUInt32 RtlULongPtrToUInt - -// -// SIZE_T -> UINT_PTR conversion -// -#define RtlSIZETToUIntPtr RtlULongPtrToUIntPtr - -// -// SIZE_T -> LONG conversion -// -#define RtlSIZETToLong RtlULongPtrToLong - -// -// SIZE_T -> LONG_PTR conversion -// -#define RtlSIZETToLongPtr RtlULongPtrToLongPtr - -// -// SIZE_T -> ULONG conversion -// -#define RtlSIZETToULong RtlULongPtrToULong - -// -// SIZE_T -> DWORD conversion -// -#define RtlSIZETToDWord RtlULongPtrToULong - -// -// SIZE_T -> LONGLONG conversion -// -#define RtlSIZETToLongLong RtlULongPtrToLongLong - -// -// SIZE_T -> LONG64 conversion -// -#define RtlSIZETToLong64 RtlULongPtrToLongLong - -// -// SIZE_T -> RtlINT64 -// -#define RtlSIZETToInt64 RtlULongPtrToLongLong - -// -// SIZE_T -> ptrdiff_t conversion -// -#define RtlSIZETToPtrdiffT RtlULongPtrToIntPtr - -// -// SIZE_T -> SSIZE_T conversion -// -#define RtlSIZETToSSIZET RtlULongPtrToLongPtr - - -//============================================================================= -// Addition functions -//============================================================================= - -// -// UINT8 addition -// -__checkReturn -__inline -NTSTATUS -RtlUInt8Add( - __in UINT8 u8Augend, - __in UINT8 u8Addend, - __out __deref_out_range(==, u8Augend + u8Addend) UINT8* pu8Result) -{ - NTSTATUS status; - - if (((UINT8)(u8Augend + u8Addend)) >= u8Augend) - { - *pu8Result = (UINT8)(u8Augend + u8Addend); - status = STATUS_SUCCESS; - } - else - { - *pu8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// USHORT addition -// -__checkReturn -__inline -NTSTATUS -RtlUShortAdd( - __in USHORT usAugend, - __in USHORT usAddend, - __out __deref_out_range(==, usAugend + usAddend) USHORT* pusResult) -{ - NTSTATUS status; - - if (((USHORT)(usAugend + usAddend)) >= usAugend) - { - *pusResult = (USHORT)(usAugend + usAddend); - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT16 addition -// -#define RtlUInt16Add RtlUShortAdd - -// -// WORD addtition -// -#define RtlWordAdd RtlUShortAdd - -// -// UINT addition -// -__checkReturn -__inline -NTSTATUS -RtlUIntAdd( - __in UINT uAugend, - __in UINT uAddend, - __out __deref_out_range(==, uAugend + uAddend) UINT* puResult) -{ - NTSTATUS status; - - if ((uAugend + uAddend) >= uAugend) - { - *puResult = (uAugend + uAddend); - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT32 addition -// -#define RtlUInt32Add RtlUIntAdd - -// -// UINT_PTR addition -// -#ifdef _WIN64 -#define RtlUIntPtrAdd RtlULongLongAdd -#else -__checkReturn -__inline -NTSTATUS -RtlUIntPtrAdd( - __in UINT_PTR uAugend, - __in UINT_PTR uAddend, - __out __deref_out_range(==, uAugend + uAddend) UINT_PTR* puResult) -{ - NTSTATUS status; - - if ((uAugend + uAddend) >= uAugend) - { - *puResult = (uAugend + uAddend); - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif // _WIN64 - -// -// ULONG addition -// -__checkReturn -__inline -NTSTATUS -RtlULongAdd( - __in ULONG ulAugend, - __in ULONG ulAddend, - __out __deref_out_range(==, ulAugend + ulAddend) ULONG* pulResult) -{ - NTSTATUS status; - - if ((ulAugend + ulAddend) >= ulAugend) - { - *pulResult = (ulAugend + ulAddend); - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG_PTR addition -// -#ifdef _WIN64 -#define RtlULongPtrAdd RtlULongLongAdd -#else -__checkReturn -__inline -NTSTATUS -RtlULongPtrAdd( - __in ULONG_PTR ulAugend, - __in ULONG_PTR ulAddend, - __out __deref_out_range(==, ulAugend + ulAddend) ULONG_PTR* pulResult) -{ - NTSTATUS status; - - if ((ulAugend + ulAddend) >= ulAugend) - { - *pulResult = (ulAugend + ulAddend); - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif // _WIN64 - -// -// DWORD addition -// -#define RtlDWordAdd RtlULongAdd - -// -// DWORD_PTR addition -// -#ifdef _WIN64 -#define RtlDWordPtrAdd RtlULongLongAdd -#else -__checkReturn -__inline -NTSTATUS -RtlDWordPtrAdd( - __in DWORD_PTR dwAugend, - __in DWORD_PTR dwAddend, - __out __deref_out_range(==, dwAugend + dwAddend) DWORD_PTR* pdwResult) -{ - NTSTATUS status; - - if ((dwAugend + dwAddend) >= dwAugend) - { - *pdwResult = (dwAugend + dwAddend); - status = STATUS_SUCCESS; - } - else - { - *pdwResult = DWORD_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif // _WIN64 - -// -// size_t addition -// -__checkReturn -__inline -NTSTATUS -RtlSizeTAdd( - __in size_t Augend, - __in size_t Addend, - __out __deref_out_range(==, Augend + Addend) size_t* pResult) -{ - NTSTATUS status; - - if ((Augend + Addend) >= Augend) - { - *pResult = (Augend + Addend); - status = STATUS_SUCCESS; - } - else - { - *pResult = SIZE_T_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// SIZE_T addition -// -#ifdef _WIN64 -#define RtlSIZETAdd RtlULongLongAdd -#else -__checkReturn -__inline -NTSTATUS -RtlSIZETAdd( - __in SIZE_T Augend, - __in SIZE_T Addend, - __out __deref_out_range(==, Augend + Addend) SIZE_T* pResult) -{ - NTSTATUS status; - - if ((Augend + Addend) >= Augend) - { - *pResult = (Augend + Addend); - status = STATUS_SUCCESS; - } - else - { - *pResult = _SIZE_T_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif // _WIN64 - -// -// ULONGLONG addition -// -__checkReturn -__inline -NTSTATUS -RtlULongLongAdd( - __in ULONGLONG ullAugend, - __in ULONGLONG ullAddend, - __out __deref_out_range(==, ullAugend + ullAddend) ULONGLONG* pullResult) -{ - NTSTATUS status; - - if ((ullAugend + ullAddend) >= ullAugend) - { - *pullResult = (ullAugend + ullAddend); - status = STATUS_SUCCESS; - } - else - { - *pullResult = ULONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// DWORDLONG addition -// -#define RtlDWordLongAdd RtlULongLongAdd - -// -// ULONG64 addition -// -#define RtlULong64Add RtlULongLongAdd - -// -// DWORD64 addition -// -#define RtlDWord64Add RtlULongLongAdd - -// -// UINT64 addition -// -#define RtlUInt64Add RtlULongLongAdd - - -//============================================================================= -// Subtraction functions -//============================================================================= - -// -// UINT8 subtraction -// -__checkReturn -__inline -NTSTATUS -RtlUInt8Sub( - __in UINT8 u8Minuend, - __in UINT8 u8Subtrahend, - __out __deref_out_range(==, u8Minuend - u8Subtrahend) UINT8* pu8Result) -{ - NTSTATUS status; - - if (u8Minuend >= u8Subtrahend) - { - *pu8Result = (UINT8)(u8Minuend - u8Subtrahend); - status = STATUS_SUCCESS; - } - else - { - *pu8Result = UINT8_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// USHORT subtraction -// -__checkReturn -__inline -NTSTATUS -RtlUShortSub( - __in USHORT usMinuend, - __in USHORT usSubtrahend, - __out __deref_out_range(==, usMinuend - usSubtrahend) USHORT* pusResult) -{ - NTSTATUS status; - - if (usMinuend >= usSubtrahend) - { - *pusResult = (USHORT)(usMinuend - usSubtrahend); - status = STATUS_SUCCESS; - } - else - { - *pusResult = USHORT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT16 subtraction -// -#define RtlUInt16Sub RtlUShortSub - -// -// WORD subtraction -// -#define RtlWordSub RtlUShortSub - - -// -// UINT subtraction -// -__checkReturn -__inline -NTSTATUS -RtlUIntSub( - __in UINT uMinuend, - __in UINT uSubtrahend, - __out __deref_out_range(==, uMinuend - uSubtrahend) UINT* puResult) -{ - NTSTATUS status; - - if (uMinuend >= uSubtrahend) - { - *puResult = (uMinuend - uSubtrahend); - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// UINT32 subtraction -// -#define RtlUInt32Sub RtlUIntSub - -// -// UINT_PTR subtraction -// -#ifdef _WIN64 -#define RtlUIntPtrSub RtlULongLongSub -#else -__checkReturn -__inline -NTSTATUS -RtlUIntPtrSub( - __in UINT_PTR uMinuend, - __in UINT_PTR uSubtrahend, - __out __deref_out_range(==, uMinuend - uSubtrahend) UINT_PTR* puResult) -{ - NTSTATUS status; - - if (uMinuend >= uSubtrahend) - { - *puResult = (uMinuend - uSubtrahend); - status = STATUS_SUCCESS; - } - else - { - *puResult = UINT_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif // _WIN64 - -// -// ULONG subtraction -// -__checkReturn -__inline -NTSTATUS -RtlULongSub( - __in ULONG ulMinuend, - __in ULONG ulSubtrahend, - __out __deref_out_range(==, ulMinuend - ulSubtrahend) ULONG* pulResult) -{ - NTSTATUS status; - - if (ulMinuend >= ulSubtrahend) - { - *pulResult = (ulMinuend - ulSubtrahend); - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// ULONG_PTR subtraction -// -#ifdef _WIN64 -#define RtlULongPtrSub RtlULongLongSub -#else -__checkReturn -__inline -NTSTATUS -RtlULongPtrSub( - __in ULONG_PTR ulMinuend, - __in ULONG_PTR ulSubtrahend, - __out __deref_out_range(==, ulMinuend - ulSubtrahend) ULONG_PTR* pulResult) -{ - NTSTATUS status; - - if (ulMinuend >= ulSubtrahend) - { - *pulResult = (ulMinuend - ulSubtrahend); - status = STATUS_SUCCESS; - } - else - { - *pulResult = ULONG_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif // _WIN64 - - -// -// DWORD subtraction -// -#define RtlDWordSub RtlULongSub - -// -// DWORD_PTR subtraction -// -#ifdef _WIN64 -#define RtlDWordPtrSub RtlULongLongSub -#else -__checkReturn -__inline -NTSTATUS -RtlDWordPtrSub( - __in DWORD_PTR dwMinuend, - __in DWORD_PTR dwSubtrahend, - __out __deref_out_range(==, dwMinuend - dwSubtrahend) DWORD_PTR* pdwResult) -{ - NTSTATUS status; - - if (dwMinuend >= dwSubtrahend) - { - *pdwResult = (dwMinuend - dwSubtrahend); - status = STATUS_SUCCESS; - } - else - { - *pdwResult = DWORD_PTR_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif // _WIN64 - -// -// size_t subtraction -// -__checkReturn -__inline -NTSTATUS -RtlSizeTSub( - __in size_t Minuend, - __in size_t Subtrahend, - __out __deref_out_range(==, Minuend - Subtrahend) size_t* pResult) -{ - NTSTATUS status; - - if (Minuend >= Subtrahend) - { - *pResult = (Minuend - Subtrahend); - status = STATUS_SUCCESS; - } - else - { - *pResult = SIZE_T_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// SIZE_T subtraction -// -#ifdef _WIN64 -#define RtlSIZETSub RtlULongLongSub -#else -__checkReturn -__inline -NTSTATUS -RtlSIZETSub( - __in SIZE_T Minuend, - __in SIZE_T Subtrahend, - __out __deref_out_range(==, Minuend - Subtrahend) SIZE_T* pResult) -{ - NTSTATUS status; - - if (Minuend >= Subtrahend) - { - *pResult = (Minuend - Subtrahend); - status = STATUS_SUCCESS; - } - else - { - *pResult = _SIZE_T_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} -#endif // _WIN64 - -// -// ULONGLONG subtraction -// -__checkReturn -__inline -NTSTATUS -RtlULongLongSub( - __in ULONGLONG ullMinuend, - __in ULONGLONG ullSubtrahend, - __out __deref_out_range(==, ullMinuend - ullSubtrahend) ULONGLONG* pullResult) -{ - NTSTATUS status; - - if (ullMinuend >= ullSubtrahend) - { - *pullResult = (ullMinuend - ullSubtrahend); - status = STATUS_SUCCESS; - } - else - { - *pullResult = ULONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - - return status; -} - -// -// DWORDLONG subtraction -// -#define RtlDWordLongSub RtlULongLongSub - -// -// ULONG64 subtraction -// -#define RtlULong64Sub RtlULongLongSub - -// -// DWORD64 subtraction -// -#define RtlDWord64Sub RtlULongLongSub - -// -// UINT64 subtraction -// -#define RtlUInt64Sub RtlULongLongSub - - -//============================================================================= -// Multiplication functions -//============================================================================= - -// -// UINT8 multiplication -// -__checkReturn -__inline -NTSTATUS -RtlUInt8Mult( - __in UINT8 u8Multiplicand, - __in UINT8 u8Multiplier, - __out __deref_out_range(==, u8Multiplicand * u8Multiplier) UINT8* pu8Result) -{ - UINT uResult = ((UINT)u8Multiplicand) * ((UINT)u8Multiplier); - - return RtlUIntToUInt8(uResult, pu8Result); -} - -// -// USHORT multiplication -// -__checkReturn -__inline -NTSTATUS -RtlUShortMult( - __in USHORT usMultiplicand, - __in USHORT usMultiplier, - __out __deref_out_range(==, usMultiplicand * usMultiplier) USHORT* pusResult) -{ - ULONG ulResult = ((ULONG)usMultiplicand) * ((ULONG)usMultiplier); - - return RtlULongToUShort(ulResult, pusResult); -} - -// -// UINT16 multiplication -// -#define RtlUInt16Mult RtlUShortMult - -// -// WORD multiplication -// -#define RtlWordMult RtlUShortMult - -// -// UINT multiplication -// -__checkReturn -__inline -NTSTATUS -RtlUIntMult( - __in UINT uMultiplicand, - __in UINT uMultiplier, - __out __deref_out_range(==, uMultiplicand * uMultiplier) UINT* puResult) -{ - ULONGLONG ull64Result = UInt32x32To64(uMultiplicand, uMultiplier); - - return RtlULongLongToUInt(ull64Result, puResult); -} - -// -// UINT32 multiplication -// -#define RtlUInt32Mult RtlUIntMult - -// -// UINT_PTR multiplication -// -#ifdef _WIN64 -#define RtlUIntPtrMult RtlULongLongMult -#else -__checkReturn -__inline -NTSTATUS -RtlUIntPtrMult( - __in UINT_PTR uMultiplicand, - __in UINT_PTR uMultiplier, - __out __deref_out_range(==, uMultiplicand * uMultiplier) UINT_PTR* puResult) -{ - ULONGLONG ull64Result = UInt32x32To64(uMultiplicand, uMultiplier); - - return RtlULongLongToUIntPtr(ull64Result, puResult); -} -#endif // _WIN64 - -// -// ULONG multiplication -// -__checkReturn -__inline -NTSTATUS -RtlULongMult( - __in ULONG ulMultiplicand, - __in ULONG ulMultiplier, - __out __deref_out_range(==, ulMultiplicand * ulMultiplier) ULONG* pulResult) -{ - ULONGLONG ull64Result = UInt32x32To64(ulMultiplicand, ulMultiplier); - - return RtlULongLongToULong(ull64Result, pulResult); -} - -// -// ULONG_PTR multiplication -// -#ifdef _WIN64 -#define RtlULongPtrMult RtlULongLongMult -#else -__checkReturn -__inline -NTSTATUS -RtlULongPtrMult( - __in ULONG_PTR ulMultiplicand, - __in ULONG_PTR ulMultiplier, - __out __deref_out_range(==, ulMultiplicand * ulMultiplier) ULONG_PTR* pulResult) -{ - ULONGLONG ull64Result = UInt32x32To64(ulMultiplicand, ulMultiplier); - - return RtlULongLongToULongPtr(ull64Result, pulResult); -} -#endif // _WIN64 - -// -// DWORD multiplication -// -#define RtlDWordMult RtlULongMult - -// -// DWORD_PTR multiplication -// -#ifdef _WIN64 -#define RtlDWordPtrMult RtlULongLongMult -#else -__checkReturn -__inline -NTSTATUS -RtlDWordPtrMult( - __in DWORD_PTR dwMultiplicand, - __in DWORD_PTR dwMultiplier, - __out __deref_out_range(==, dwMultiplicand * dwMultiplier) DWORD_PTR* pdwResult) -{ - ULONGLONG ull64Result = UInt32x32To64(dwMultiplicand, dwMultiplier); - - return RtlULongLongToDWordPtr(ull64Result, pdwResult); -} -#endif // _WIN64 - -// -// size_t multiplication -// - -#ifdef _WIN64 -#define RtlSizeTMult RtlULongLongMult -#else -__checkReturn -__inline -NTSTATUS -RtlSizeTMult( - __in size_t Multiplicand, - __in size_t Multiplier, - __out __deref_out_range(==, Multiplicand * Multiplier) size_t* pResult) -{ - ULONGLONG ull64Result = UInt32x32To64(Multiplicand, Multiplier); - - return RtlULongLongToSizeT(ull64Result, pResult); -} -#endif // _WIN64 - -// -// SIZE_T multiplication -// -#ifdef _WIN64 -#define RtlSIZETMult RtlULongLongMult -#else -__checkReturn -__inline -NTSTATUS -RtlSIZETMult( - __in SIZE_T Multiplicand, - __in SIZE_T Multiplier, - __out __deref_out_range(==, Multiplicand * Multiplier) SIZE_T* pResult) -{ - ULONGLONG ull64Result = UInt32x32To64(Multiplicand, Multiplier); - - return RtlULongLongToSIZET(ull64Result, pResult); -} -#endif // _WIN64 - -// -// ULONGLONG multiplication -// -__checkReturn -__inline -NTSTATUS -RtlULongLongMult( - __in ULONGLONG ullMultiplicand, - __in ULONGLONG ullMultiplier, - __out __deref_out_range(==, ullMultiplicand * ullMultiplier) ULONGLONG* pullResult) -{ - NTSTATUS status; -#if defined(_USE_INTRINSIC_MULTIPLY128) - ULONGLONG ullResultHigh; - ULONGLONG ullResultLow; - - ullResultLow = UnsignedMultiply128(ullMultiplicand, ullMultiplier, &ullResultHigh); - if (ullResultHigh == 0) - { - *pullResult = ullResultLow; - status = STATUS_SUCCESS; - } - else - { - *pullResult = ULONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } -#else - // 64x64 into 128 is like 32.32 x 32.32. - // - // a.b * c.d = a*(c.d) + .b*(c.d) = a*c + a*.d + .b*c + .b*.d - // back in non-decimal notation where A=a*2^32 and C=c*2^32: - // A*C + A*d + b*C + b*d - // So there are four components to add together. - // result = (a*c*2^64) + (a*d*2^32) + (b*c*2^32) + (b*d) - // - // a * c must be 0 or there would be bits in the high 64-bits - // a * d must be less than 2^32 or there would be bits in the high 64-bits - // b * c must be less than 2^32 or there would be bits in the high 64-bits - // then there must be no overflow of the resulting values summed up. - - ULONG dw_a; - ULONG dw_b; - ULONG dw_c; - ULONG dw_d; - ULONGLONG ad = 0; - ULONGLONG bc = 0; - ULONGLONG bd = 0; - ULONGLONG ullResult = 0; - - status = STATUS_INTEGER_OVERFLOW; - - dw_a = (ULONG)(ullMultiplicand >> 32); - dw_c = (ULONG)(ullMultiplier >> 32); - - // common case -- if high dwords are both zero, no chance for overflow - if ((dw_a == 0) && (dw_c == 0)) - { - dw_b = (DWORD)ullMultiplicand; - dw_d = (DWORD)ullMultiplier; - - *pullResult = (((ULONGLONG)dw_b) * (ULONGLONG)dw_d); - status = STATUS_SUCCESS; - } - else - { - // a * c must be 0 or there would be bits set in the high 64-bits - if ((dw_a == 0) || - (dw_c == 0)) - { - dw_d = (DWORD)ullMultiplier; - - // a * d must be less than 2^32 or there would be bits set in the high 64-bits - ad = (((ULONGLONG)dw_a) * (ULONGLONG)dw_d); - if ((ad & 0xffffffff00000000) == 0) - { - dw_b = (DWORD)ullMultiplicand; - - // b * c must be less than 2^32 or there would be bits set in the high 64-bits - bc = (((ULONGLONG)dw_b) * (ULONGLONG)dw_c); - if ((bc & 0xffffffff00000000) == 0) - { - // now sum them all up checking for overflow. - // shifting is safe because we already checked for overflow above - if (NT_SUCCESS(RtlULongLongAdd(bc << 32, ad << 32, &ullResult))) - { - // b * d - bd = (((ULONGLONG)dw_b) * (ULONGLONG)dw_d); - - if (NT_SUCCESS(RtlULongLongAdd(ullResult, bd, &ullResult))) - { - *pullResult = ullResult; - status = STATUS_SUCCESS; - } - } - } - } - } - } - - if (!NT_SUCCESS(status)) - { - *pullResult = ULONGLONG_ERROR; - } -#endif // _USE_INTRINSIC_MULTIPLY128 - - return status; -} - -// -// DWORDLONG multiplication -// -#define RtlDWordLongMult RtlULongLongMult - -// -// ULONG64 multiplication -// -#define RtlULong64Mult RtlULongLongMult - -// -// DWORD64 multiplication -// -#define RtlDWord64Mult RtlULongLongMult - -// -// UINT64 multiplication -// -#define RtlUInt64Mult RtlULongLongMult - - -///////////////////////////////////////////////////////////////////////// -// -// signed operations -// -// Strongly consider using unsigned numbers. -// -// Signed numbers are often used where unsigned numbers should be used. -// For example file sizes and array indices should always be unsigned. -// (File sizes should be 64bit integers; array indices should be size_t.) -// Subtracting a larger positive signed number from a smaller positive -// signed number with RtlIntSubwill succeed, producing a negative number, -// that then must not be used as an array index (but can occasionally be -// used as a pointer index.) Similarly for adding a larger magnitude -// negative number to a smaller magnitude positive number. -// -// intsafe.h does not protect you from such errors. It tells you if your -// integer operations overflowed, not if you are doing the right thing -// with your non-overflowed integers. -// -// Likewise you can overflow a buffer with a non-overflowed unsigned index. -// -#if defined(ENABLE_INTSAFE_SIGNED_FUNCTIONS) - -#if defined(_USE_INTRINSIC_MULTIPLY128) -#ifdef __cplusplus -extern "C" { -#endif - -#define Multiply128 _mul128 - -LONG64 -Multiply128( - __in LONG64 Multiplier, - __in LONG64 Multiplicand, - __out LONG64 *HighProduct - ); -#pragma intrinsic(_mul128) - -#ifdef __cplusplus -} -#endif -#endif // _USE_INTRINSIC_MULTIPLY128 - - -//============================================================================= -// Signed addition functions -//============================================================================= - -// -// INT8 Addition -// -__checkReturn -__inline -NTSTATUS -RtlInt8Add( - __in INT8 i8Augend, - __in INT8 i8Addend, - __out __deref_out_range(==, i8Augend + i8Addend) INT8* pi8Result - ) -{ - C_ASSERT(sizeof(LONG) > sizeof(INT8)); - return RtlLongToInt8(((LONG)i8Augend) + ((LONG)i8Addend), pi8Result); -} - -// -// SHORT Addition -// -__checkReturn -__inline -NTSTATUS -RtlShortAdd( - __in SHORT sAugend, - __in SHORT sAddend, - __out __deref_out_range(==, sAugend + sAddend) SHORT* psResult - ) -{ - C_ASSERT(sizeof(LONG) > sizeof(SHORT)); - return RtlLongToShort(((LONG)sAugend) + ((LONG)sAddend), psResult); -} - -// -// INT16 Addition -// -#define RtlInt16Add RtlShortAdd - -// -// INT Addition -// -__checkReturn -__inline -NTSTATUS -RtlIntAdd( - __in INT iAugend, - __in INT iAddend, - __out __deref_out_range(==, iAugend + iAddend) INT* piResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(INT)); - return RtlLongLongToInt(((LONGLONG)iAugend) + ((LONGLONG)iAddend), piResult); -} - -// -// INT32 Addition -// -#define RtlInt32Add RtlIntAdd - -// -// INT_PTR addition -// -#ifdef _WIN64 -#define RtlIntPtrAdd RtlLongLongAdd -#else -__checkReturn -__inline -NTSTATUS -RtlIntPtrAdd( - __in INT_PTR iAugend, - __in INT_PTR iAddend, - __out __deref_out_range(==, iAugend + iAddend) INT_PTR* piResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(INT_PTR)); - return RtlLongLongToIntPtr(((LONGLONG)iAugend) + ((LONGLONG)iAddend), piResult); -} -#endif - -// -// LONG Addition -// -__checkReturn -__inline -NTSTATUS -RtlLongAdd( - __in LONG lAugend, - __in LONG lAddend, - __out __deref_out_range(==, lAugend + lAddend) LONG* plResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(LONG)); - return RtlLongLongToLong(((LONGLONG)lAugend) + ((LONGLONG)lAddend), plResult); -} - -// -// LONG32 Addition -// -#define RtlLong32Add RtlIntAdd - -// -// LONG_PTR Addition -// -#ifdef _WIN64 -#define RtlLongPtrAdd RtlLongLongAdd -#else -__checkReturn -__inline -NTSTATUS -RtlLongPtrAdd( - __in LONG_PTR lAugend, - __in LONG_PTR lAddend, - __out __deref_out_range(==, lAugend + lAddend) LONG_PTR* plResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(LONG_PTR)); - return RtlLongLongToLongPtr(((LONGLONG)lAugend) + ((LONGLONG)lAddend), plResult); -} -#endif - -// -// LONGLONG Addition -// -__checkReturn -__inline -NTSTATUS -RtlLongLongAdd( - __in LONGLONG llAugend, - __in LONGLONG llAddend, - __out __deref_out_range(==, llAugend + llAddend) LONGLONG* pllResult - ) -{ - NTSTATUS status; - LONGLONG llResult = llAugend + llAddend; - - // - // Adding positive to negative never overflows. - // If you add two positive numbers, you expect a positive result. - // If you add two negative numbers, you expect a negative result. - // Overflow if inputs are the same sign and output is not that sign. - // - if (((llAugend < 0) == (llAddend < 0)) && - ((llAugend < 0) != (llResult < 0))) - { - *pllResult = LONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - else - { - *pllResult = llResult; - status = STATUS_SUCCESS; - } - - return status; -} - -// -// LONG64 Addition -// -#define RtlLong64Add RtlLongLongAdd - -// -// RtlINT64 Addition -// -#define RtlInt64Add RtlLongLongAdd - -// -// ptrdiff_t Addition -// -#ifdef _WIN64 -#define RtlPtrdiffTAdd RtlLongLongAdd -#else -__checkReturn -__inline -NTSTATUS -RtlPtrdiffTAdd( - __in ptrdiff_t Augend, - __in ptrdiff_t Addend, - __out __deref_out_range(==, Augend + Addend) ptrdiff_t* pResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(ptrdiff_t)); - return RtlLongLongToPtrdiffT(((LONGLONG)Augend) + ((LONGLONG)Addend), pResult); -} -#endif - -// -// SSIZE_T Addition -// -#ifdef _WIN64 -#define RtlSSIZETAdd RtlLongLongAdd -#else -__checkReturn -__inline -NTSTATUS -RtlSSIZETAdd( - __in SSIZE_T Augend, - __in SSIZE_T Addend, - __out __deref_out_range(==, Augend + Addend) SSIZE_T* pResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(SSIZE_T)); - return RtlLongLongToSSIZET(((LONGLONG)Augend) + ((LONGLONG)Addend), pResult); -} -#endif - - -//============================================================================= -// Signed subtraction functions -//============================================================================= - -// -// INT8 Subtraction -// -__checkReturn -__inline -NTSTATUS -RtlInt8Sub( - __in INT8 i8Minuend, - __in INT8 i8Subtrahend, - __out __deref_out_range(==, i8Minuend - i8Subtrahend) INT8* pi8Result - ) -{ - C_ASSERT(sizeof(LONG) > sizeof(INT8)); - return RtlLongToInt8(((LONG)i8Minuend) - ((LONG)i8Subtrahend), pi8Result); -} - -// -// SHORT Subtraction -// -__checkReturn -__inline -NTSTATUS -RtlShortSub( - __in SHORT sMinuend, - __in SHORT sSubtrahend, - __out __deref_out_range(==, sMinuend - sSubtrahend) SHORT* psResult - ) -{ - C_ASSERT(sizeof(LONG) > sizeof(SHORT)); - return RtlLongToShort(((LONG)sMinuend) - ((LONG)sSubtrahend), psResult); -} - -// -// INT16 Subtraction -// -#define RtlInt16Sub RtlShortSub - -// -// INT Subtraction -// -__checkReturn -__inline -NTSTATUS -RtlIntSub( - __in INT iMinuend, - __in INT iSubtrahend, - __out __deref_out_range(==, iMinuend - iSubtrahend) INT* piResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(INT)); - return RtlLongLongToInt(((LONGLONG)iMinuend) - ((LONGLONG)iSubtrahend), piResult); -} - -// -// INT32 Subtraction -// -#define RtlInt32Sub RtlIntSub - -// -// INT_PTR Subtraction -// -#ifdef _WIN64 -#define RtlIntPtrSub RtlLongLongSub -#else -__checkReturn -__inline -NTSTATUS -RtlIntPtrSub( - __in INT_PTR iMinuend, - __in INT_PTR iSubtrahend, - __out __deref_out_range(==, iMinuend - iSubtrahend) INT_PTR* piResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(INT_PTR)); - return RtlLongLongToIntPtr(((LONGLONG)iMinuend) - ((LONGLONG)iSubtrahend), piResult); -} -#endif - -// -// LONG Subtraction -// -__checkReturn -__inline -NTSTATUS -RtlLongSub( - __in LONG lMinuend, - __in LONG lSubtrahend, - __out __deref_out_range(==, lMinuend - lSubtrahend) LONG* plResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(LONG)); - return RtlLongLongToLong(((LONGLONG)lMinuend) - ((LONGLONG)lSubtrahend), plResult); -} - -// -// LONG32 Subtraction -// -#define RtlLong32Sub RtlIntSub - -// -// LONG_PTR Subtraction -// -#ifdef _WIN64 -#define RtlLongPtrSub RtlLongLongSub -#else -__checkReturn -__inline -NTSTATUS -RtlLongPtrSub( - __in LONG_PTR lMinuend, - __in LONG_PTR lSubtrahend, - __out __deref_out_range(==, lMinuend - lSubtrahend) LONG_PTR* plResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(LONG_PTR)); - return RtlLongLongToLongPtr(((LONGLONG)lMinuend) - ((LONGLONG)lSubtrahend), plResult); -} -#endif - -// -// RtlLongLongSub -// -__checkReturn -__inline -NTSTATUS -RtlLongLongSub( - __in LONGLONG llMinuend, - __in LONGLONG llSubtrahend, - __out __deref_out_range(==, llMinuend - llSubtrahend) LONGLONG* pllResult - ) -{ - NTSTATUS status; - LONGLONG llResult = llMinuend - llSubtrahend; - - // - // Subtracting a positive number from a positive number never overflows. - // Subtracting a negative number from a negative number never overflows. - // If you subtract a negative number from a positive number, you expect a positive result. - // If you subtract a positive number from a negative number, you expect a negative result. - // Overflow if inputs vary in sign and the output does not have the same sign as the first input. - // - if (((llMinuend < 0) != (llSubtrahend < 0)) && - ((llMinuend < 0) != (llResult < 0))) - { - *pllResult = LONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - else - { - *pllResult = llResult; - status = STATUS_SUCCESS; - } - - return status; -} - -// -// LONG64 Subtraction -// -#define RtlLong64Sub RtlLongLongSub - -// -// RtlINT64 Subtraction -// -#define RtlInt64Sub RtlLongLongSub - -// -// ptrdiff_t Subtraction -// -#ifdef _WIN64 -#define RtlPtrdiffTSub RtlLongLongSub -#else -__checkReturn -__inline -NTSTATUS -RtlPtrdiffTSub( - __in ptrdiff_t Minuend, - __in ptrdiff_t Subtrahend, - __out __deref_out_range(==, Minuend - Subtrahend) ptrdiff_t* pResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(ptrdiff_t)); - return RtlLongLongToPtrdiffT(((LONGLONG)Minuend) - ((LONGLONG)Subtrahend), pResult); -} -#endif - -// -// SSIZE_T Subtraction -// -#ifdef _WIN64 -#define RtlSSIZETSub RtlLongLongSub -#else -__checkReturn -__inline -NTSTATUS -RtlSSIZETSub( - __in SSIZE_T Minuend, - __in SSIZE_T Subtrahend, - __out __deref_out_range(==, Minuend - Subtrahend) SSIZE_T* pResult) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(SSIZE_T)); - return RtlLongLongToSSIZET(((LONGLONG)Minuend) - ((LONGLONG)Subtrahend), pResult); -} -#endif - - -//============================================================================= -// Signed multiplication functions -//============================================================================= - -// -// INT8 multiplication -// -__checkReturn -__inline -NTSTATUS -RtlInt8Mult( - __in INT8 i8Multiplicand, - __in INT8 i8Multiplier, - __out __deref_out_range(==, i8Multiplicand * i8Multiplier) INT8* pi8Result - ) -{ - C_ASSERT(sizeof(LONG) > sizeof(INT8)); - return RtlLongToInt8(((LONG)i8Multiplier) * ((LONG)i8Multiplicand), pi8Result); -} - -// -// SHORT multiplication -// -__checkReturn -__inline -NTSTATUS -RtlShortMult( - __in SHORT sMultiplicand, - __in SHORT sMultiplier, - __out __deref_out_range(==, sMultiplicand * sMultiplier) SHORT* psResult - ) -{ - C_ASSERT(sizeof(LONG) > sizeof(SHORT)); - return RtlLongToShort(((LONG)sMultiplicand) * ((LONG)sMultiplier), psResult); -} - -// -// INT16 multiplication -// -#define RtlInt16Mult RtlShortMult - -// -// INT multiplication -// -__checkReturn -__inline -NTSTATUS -RtlIntMult( - __in INT iMultiplicand, - __in INT iMultiplier, - __out __deref_out_range(==, iMultiplicand * iMultiplier) INT* piResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(INT)); - return RtlLongLongToInt(((LONGLONG)iMultiplicand) * ((LONGLONG)iMultiplier), piResult); -} - -// -// INT32 multiplication -// -#define RtlInt32Mult RtlIntMult - -// -// INT_PTR multiplication -// -#ifdef _WIN64 -#define RtlIntPtrMult RtlLongLongMult -#else -__checkReturn -__inline -NTSTATUS -RtlIntPtrMult( - __in INT_PTR iMultiplicand, - __in INT_PTR iMultiplier, - __out __deref_out_range(==, iMultiplicand * iMultiplier) INT_PTR* piResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(INT_PTR)); - return RtlLongLongToIntPtr(((LONGLONG)iMultiplicand) * ((LONGLONG)iMultiplier), piResult); -} -#endif - -// -// LONG multiplication -// -__checkReturn -__inline -NTSTATUS -RtlLongMult( - __in LONG lMultiplicand, - __in LONG lMultiplier, - __out __deref_out_range(==, lMultiplicand * lMultiplier) LONG* plResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(LONG)); - return RtlLongLongToLong(((LONGLONG)lMultiplicand) * ((LONGLONG)lMultiplier), plResult); -} - -// -// LONG32 multiplication -// -#define RtlLong32Mult RtlIntMult - -// -// LONG_PTR multiplication -// -#ifdef _WIN64 -#define RtlLongPtrMult RtlLongLongMult -#else -__checkReturn -__inline -NTSTATUS -RtlLongPtrMult( - __in LONG_PTR lMultiplicand, - __in LONG_PTR lMultiplier, - __out __deref_out_range(==, lMultiplicand * lMultiplier) LONG_PTR* plResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(LONG_PTR)); - return RtlLongLongToLongPtr(((LONGLONG)lMultiplicand) * ((LONGLONG)lMultiplier), plResult); -} -#endif - -// -// LONGLONG multiplication -// -__checkReturn -__inline -NTSTATUS -RtlLongLongMult( - __in LONGLONG llMultiplicand, - __in LONGLONG llMultiplier, - __out __deref_out_range(==, llMultiplicand * llMultiplier) LONGLONG* pllResult - ) -{ - NTSTATUS status; - -#if defined(_USE_INTRINSIC_MULTIPLY128) - LONGLONG llResultHigh; - LONGLONG llResultLow; - - llResultLow = Multiply128(llMultiplicand, llMultiplier, &llResultHigh); - - if (((llResultLow < 0) && (llResultHigh != -1)) || - ((llResultLow >= 0) && (llResultHigh != 0))) - { - *pllResult = LONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - else - { - *pllResult = llResultLow; - status = STATUS_SUCCESS; - } -#else // _USE_INTRINSIC_MULTIPLY128 - // - // Split into sign and magnitude, do unsigned operation, apply sign. - // - - ULONGLONG ullMultiplicand; - ULONGLONG ullMultiplier; - ULONGLONG ullResult; - const ULONGLONG LONGLONG_MIN_MAGNITUDE = ((((ULONGLONG) - (LONGLONG_MIN + 1))) + 1); - - if (llMultiplicand < 0) - { - // - // Avoid negating the most negative number. - // - ullMultiplicand = ((ULONGLONG)(- (llMultiplicand + 1))) + 1; - } - else - { - ullMultiplicand = (ULONGLONG)llMultiplicand; - } - - if (llMultiplier < 0) - { - // - // Avoid negating the most negative number. - // - ullMultiplier = ((ULONGLONG)(- (llMultiplier + 1))) + 1; - } - else - { - ullMultiplier = (ULONGLONG)llMultiplier; - } - - status = RtlULongLongMult(ullMultiplicand, ullMultiplier, &ullResult); - if (NT_SUCCESS(status)) - { - if ((llMultiplicand < 0) != (llMultiplier < 0)) - { - if (ullResult > LONGLONG_MIN_MAGNITUDE) - { - *pllResult = LONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - else - { - *pllResult = - ((LONGLONG)ullResult); - } - } - else - { - if (ullResult > LONGLONG_MAX) - { - *pllResult = LONGLONG_ERROR; - status = STATUS_INTEGER_OVERFLOW; - } - else - { - *pllResult = (LONGLONG)ullResult; - } - } - } - else - { - *pllResult = LONGLONG_ERROR; - } -#endif // _USE_INTRINSIC_MULTIPLY128 - - return status; -} - -// -// LONG64 multiplication -// -#define RtlLong64Mult RtlLongLongMult - -// -// RtlINT64 multiplication -// -#define RtlInt64Mult RtlLongLongMult - -// -// ptrdiff_t multiplication -// -#ifdef _WIN64 -#define RtlPtrdiffTMult RtlLongLongMult -#else -__checkReturn -__inline -NTSTATUS -RtlPtrdiffTMult( - __in ptrdiff_t Multiplicand, - __in ptrdiff_t Multiplier, - __out __deref_out_range(==, Multiplicand * Multiplier) ptrdiff_t* pResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(ptrdiff_t)); - return RtlLongLongToPtrdiffT(((LONGLONG)Multiplicand) * ((LONGLONG)Multiplier), pResult); -} -#endif - -// -// SSIZE_T multiplication -// -#ifdef _WIN64 -#define RtlSSIZETMult RtlLongLongMult -#else -__checkReturn -__inline -NTSTATUS -RtlSSIZETMult( - __in SSIZE_T Multiplicand, - __in SSIZE_T Multiplier, - __out __deref_out_range(==, Multiplicand * Multiplier) SSIZE_T* pResult - ) -{ - C_ASSERT(sizeof(LONGLONG) > sizeof(SSIZE_T)); - return RtlLongLongToSSIZET(((LONGLONG)Multiplicand) * ((LONGLONG)Multiplier), pResult); -} -#endif - -#endif // ENABLE_INTSAFE_SIGNED_FUNCTIONS - -// -// Macros that are no longer used in this header but which clients may -// depend on being defined here. -// -#define LOWORD(_dw) ((WORD)(((DWORD_PTR)(_dw)) & 0xffff)) -#define HIWORD(_dw) ((WORD)((((DWORD_PTR)(_dw)) >> 16) & 0xffff)) -#define LODWORD(_qw) ((DWORD)(_qw)) -#define HIDWORD(_qw) ((DWORD)(((_qw) >> 32) & 0xffffffff)) - -#endif // _NTINTSAFE_H_INCLUDED_ - diff --git a/pub/ddk/ntlmsp.h b/pub/ddk/ntlmsp.h deleted file mode 100644 index faadee2..0000000 --- a/pub/ddk/ntlmsp.h +++ /dev/null @@ -1,312 +0,0 @@ -//+------------------------------------------------------------------------- -// -// Microsoft Windows -// Copyright (C) Microsoft Corporation, 1992-1999. -// -// File: ntlmsp.h -// -// Contents: -// -// Classes: -// -// Functions: -// -// -//-------------------------------------------------------------------------- - -#ifndef _NTLMSP_H_ -#define _NTLMSP_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -//////////////////////////////////////////////////////////////////////// -// -// Name of the package to pass in to AcquireCredentialsHandle, etc. -// -//////////////////////////////////////////////////////////////////////// - -#ifndef NTLMSP_NAME_A - -#define NTLMSP_NAME_A "NTLM" -#define NTLMSP_NAME L"NTLM" // ntifs - -#endif // NTLMSP_NAME_A - -#define NTLMSP_NAME_SIZE (sizeof(NTLMSP_NAME) - sizeof(WCHAR)) // ntifs -#define NTLMSP_COMMENT_A "NTLM Security Package" -#define NTLMSP_COMMENT L"NTLM Security Package" -#define NTLMSP_CAPABILITIES (SECPKG_FLAG_TOKEN_ONLY | \ - SECPKG_FLAG_MULTI_REQUIRED | \ - SECPKG_FLAG_CONNECTION | \ - SECPKG_FLAG_INTEGRITY | \ - SECPKG_FLAG_PRIVACY) - -#define NTLMSP_VERSION 1 -#define NTLMSP_RPCID 10 // RPC_C_AUTHN_WINNT from rpcdce.h - -//////////////////////////////////////////////////////////////////////// -// -// Opaque Messages passed between client and server -// -//////////////////////////////////////////////////////////////////////// - -// begin_ntifs - -#define NTLMSSP_SIGNATURE "NTLMSSP" - -// -// GetKey argument for AcquireCredentialsHandle that indicates that -// old style LM is required: -// - -#define NTLMSP_NTLM_CREDENTIAL ((PVOID) 1) - -// -// MessageType for the following messages. -// - -typedef enum { - NtLmNegotiate = 1, - NtLmChallenge, - NtLmAuthenticate, - NtLmUnknown -} NTLM_MESSAGE_TYPE; - -// -// Valid values of NegotiateFlags -// - -#define NTLMSSP_NEGOTIATE_UNICODE 0x00000001 // Text strings are in unicode -#define NTLMSSP_NEGOTIATE_OEM 0x00000002 // Text strings are in OEM -#define NTLMSSP_REQUEST_TARGET 0x00000004 // Server should return its authentication realm - -#define NTLMSSP_NEGOTIATE_SIGN 0x00000010 // Request signature capability -#define NTLMSSP_NEGOTIATE_SEAL 0x00000020 // Request confidentiality -#define NTLMSSP_NEGOTIATE_DATAGRAM 0x00000040 // Use datagram style authentication -#define NTLMSSP_NEGOTIATE_LM_KEY 0x00000080 // Use LM session key for sign/seal - -#define NTLMSSP_NEGOTIATE_NETWARE 0x00000100 // NetWare authentication -#define NTLMSSP_NEGOTIATE_NTLM 0x00000200 // NTLM authentication -#define NTLMSSP_NEGOTIATE_NT_ONLY 0x00000400 // NT authentication only (no LM) -#define NTLMSSP_NEGOTIATE_NULL_SESSION 0x00000800 // NULL Sessions on NT 5.0 and beyand - -#define NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED 0x1000 // Domain Name supplied on negotiate -#define NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED 0x2000 // Workstation Name supplied on negotiate -#define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x00004000 // Indicates client/server are same machine -#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x00008000 // Sign for all security levels - -// -// Valid target types returned by the server in Negotiate Flags -// - -#define NTLMSSP_TARGET_TYPE_DOMAIN 0x00010000 // TargetName is a domain name -#define NTLMSSP_TARGET_TYPE_SERVER 0x00020000 // TargetName is a server name -#define NTLMSSP_TARGET_TYPE_SHARE 0x00040000 // TargetName is a share name -#define NTLMSSP_NEGOTIATE_NTLM2 0x00080000 // NTLM2 authentication added for NT4-SP4 - -#define NTLMSSP_NEGOTIATE_IDENTIFY 0x00100000 // Create identify level token - -// -// Valid requests for additional output buffers -// - -#define NTLMSSP_REQUEST_INIT_RESPONSE 0x00100000 // get back session keys -#define NTLMSSP_REQUEST_ACCEPT_RESPONSE 0x00200000 // get back session key, LUID -#define NTLMSSP_REQUEST_NON_NT_SESSION_KEY 0x00400000 // request non-nt session key -#define NTLMSSP_NEGOTIATE_TARGET_INFO 0x00800000 // target info present in challenge message - -#define NTLMSSP_NEGOTIATE_EXPORTED_CONTEXT 0x01000000 // It's an exported context -#define NTLMSSP_NEGOTIATE_VERSION 0x02000000 // version control - -#define NTLMSSP_NEGOTIATE_128 0x20000000 // negotiate 128 bit encryption -#define NTLMSSP_NEGOTIATE_KEY_EXCH 0x40000000 // exchange a key using key exchange key -#define NTLMSSP_NEGOTIATE_56 0x80000000 // negotiate 56 bit encryption - -// flags used in client space to control sign and seal; never appear on the wire -#define NTLMSSP_APP_SEQ 0x00000040 // Use application provided seq num - -// end_ntifs - -// -// Opaque message returned from first call to InitializeSecurityContext -// - -typedef struct _NEGOTIATE_MESSAGE { - UCHAR Signature[sizeof(NTLMSSP_SIGNATURE)]; - NTLM_MESSAGE_TYPE MessageType; - ULONG NegotiateFlags; - STRING32 OemDomainName; - STRING32 OemWorkstationName; - ULONG64 Version; -} NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE; - - -// -// Old version of the message, for old clients -// -// begin_ntifs - -typedef struct _OLD_NEGOTIATE_MESSAGE { - UCHAR Signature[sizeof(NTLMSSP_SIGNATURE)]; - NTLM_MESSAGE_TYPE MessageType; - ULONG NegotiateFlags; -} OLD_NEGOTIATE_MESSAGE, *POLD_NEGOTIATE_MESSAGE; - -// -// Opaque message returned from first call to AcceptSecurityContext -// -typedef struct _CHALLENGE_MESSAGE { - UCHAR Signature[sizeof(NTLMSSP_SIGNATURE)]; - NTLM_MESSAGE_TYPE MessageType; - STRING32 TargetName; - ULONG NegotiateFlags; - UCHAR Challenge[MSV1_0_CHALLENGE_LENGTH]; - ULONG64 ServerContextHandle; - STRING32 TargetInfo; - ULONG64 Version; -} CHALLENGE_MESSAGE, *PCHALLENGE_MESSAGE; - -// -// Old version of the challenge message -// - -typedef struct _OLD_CHALLENGE_MESSAGE { - UCHAR Signature[sizeof(NTLMSSP_SIGNATURE)]; - NTLM_MESSAGE_TYPE MessageType; - STRING32 TargetName; - ULONG NegotiateFlags; - UCHAR Challenge[MSV1_0_CHALLENGE_LENGTH]; -} OLD_CHALLENGE_MESSAGE, *POLD_CHALLENGE_MESSAGE; - -// -// Opaque message returned from second call to InitializeSecurityContext -// -typedef struct _AUTHENTICATE_MESSAGE { - UCHAR Signature[sizeof(NTLMSSP_SIGNATURE)]; - NTLM_MESSAGE_TYPE MessageType; - STRING32 LmChallengeResponse; - STRING32 NtChallengeResponse; - STRING32 DomainName; - STRING32 UserName; - STRING32 Workstation; - STRING32 SessionKey; - ULONG NegotiateFlags; - ULONG64 Version; - UCHAR HandShakeMessagesMIC[16]; // contains the HMAC-MD5 of all handshake messages, - // where MD5DIGESTLEN == 16 -} AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE; - -typedef struct _OLD_AUTHENTICATE_MESSAGE { - UCHAR Signature[sizeof(NTLMSSP_SIGNATURE)]; - NTLM_MESSAGE_TYPE MessageType; - STRING32 LmChallengeResponse; - STRING32 NtChallengeResponse; - STRING32 DomainName; - STRING32 UserName; - STRING32 Workstation; -} OLD_AUTHENTICATE_MESSAGE, *POLD_AUTHENTICATE_MESSAGE; - - -// -// Additional input message to Initialize for clients to provide a -// user-supplied password -// - -typedef struct _NTLM_CHALLENGE_MESSAGE { - UNICODE_STRING32 Password; - UNICODE_STRING32 UserName; - UNICODE_STRING32 DomainName; -} NTLM_CHALLENGE_MESSAGE, *PNTLM_CHALLENGE_MESSAGE; - - -// -// Non-opaque message returned from second call to InitializeSecurityContext -// - -typedef struct _NTLM_INITIALIZE_RESPONSE { - UCHAR UserSessionKey[MSV1_0_USER_SESSION_KEY_LENGTH]; - UCHAR LanmanSessionKey[MSV1_0_LANMAN_SESSION_KEY_LENGTH]; -} NTLM_INITIALIZE_RESPONSE, *PNTLM_INITIALIZE_RESPONSE; - -// -// Additional input message to Accept for trusted client skipping the first -// call to Accept and providing their own challenge -// - -typedef struct _NTLM_AUTHENTICATE_MESSAGE { - CHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH]; - ULONG ParameterControl; -} NTLM_AUTHENTICATE_MESSAGE, *PNTLM_AUTHENTICATE_MESSAGE; - - -// -// Non-opaque message returned from second call to AcceptSecurityContext -// - -typedef struct _NTLM_ACCEPT_RESPONSE { - LUID LogonId; - LARGE_INTEGER KickoffTime; - ULONG UserFlags; - UCHAR UserSessionKey[MSV1_0_USER_SESSION_KEY_LENGTH]; - UCHAR LanmanSessionKey[MSV1_0_LANMAN_SESSION_KEY_LENGTH]; -} NTLM_ACCEPT_RESPONSE, *PNTLM_ACCEPT_RESPONSE; - -// end_ntifs - -// -// Size of the largest message -// (The largest message is the AUTHENTICATE_MESSAGE) -// - -#define DNSLEN 256 // length of DNS name - -#define LSA_INFO_MAX_SIZE 20 // max LSA_INFO size - -// -// sizeof(ULONG64) is for MsvAvTimestamp -// - -#define TARGET_INFO_LEN ((3 * DNSLEN + DNLEN + CNLEN) * sizeof(WCHAR) + sizeof(ULONG64) + LSA_INFO_MAX_SIZE + \ - 9 * sizeof(MSV1_0_AV_PAIR) + sizeof(ULONG) * 2) - -// length of NTLM2 response -#define NTLM2_RESPONSE_LENGTH (sizeof(MSV1_0_NTLM3_RESPONSE) + \ - TARGET_INFO_LEN) - -#define NTLMSSP_MAX_MESSAGE_SIZE (sizeof(AUTHENTICATE_MESSAGE) + \ - LM_RESPONSE_LENGTH + \ - NTLM2_RESPONSE_LENGTH + \ - (DNSLEN + 1) * sizeof(WCHAR) + \ - (UNLEN + 1) * sizeof(WCHAR) + \ - (CNLEN + 1) * sizeof(WCHAR)) - -typedef struct _NTLMSSP_MESSAGE_SIGNATURE { - ULONG Version; - ULONG RandomPad; - ULONG CheckSum; - ULONG Nonce; -} NTLMSSP_MESSAGE_SIGNATURE, *PNTLMSSP_MESSAGE_SIGNATURE; - -#define NTLMSSP_MESSAGE_SIGNATURE_SIZE sizeof(NTLMSSP_MESSAGE_SIGNATURE) -// -// Version 1 is the structure above, using stream RC4 to encrypt the trailing -// 12 bytes. -// -#define NTLM_SIGN_VERSION 1 - - - -#ifdef __cplusplus -} -#endif - -#endif // _NTLMSP_H_ - diff --git a/pub/ddk/ntnls.h b/pub/ddk/ntnls.h deleted file mode 100644 index 7e3fc47..0000000 --- a/pub/ddk/ntnls.h +++ /dev/null @@ -1,58 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ntnls.h - -Abstract: - - NLS file formats and data types - - -Revision History: - ---*/ - -#ifndef _NTNLS_ -#define _NTNLS_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define MAXIMUM_LEADBYTES 12 - -typedef struct _CPTABLEINFO { - USHORT CodePage; // code page number - USHORT MaximumCharacterSize; // max length (bytes) of a char - USHORT DefaultChar; // default character (MB) - USHORT UniDefaultChar; // default character (Unicode) - USHORT TransDefaultChar; // translation of default char (Unicode) - USHORT TransUniDefaultChar; // translation of Unic default char (MB) - USHORT DBCSCodePage; // Non 0 for DBCS code pages - UCHAR LeadByte[MAXIMUM_LEADBYTES]; // lead byte ranges - PUSHORT MultiByteTable; // pointer to MB translation table - PVOID WideCharTable; // pointer to WC translation table - PUSHORT DBCSRanges; // pointer to DBCS ranges - PUSHORT DBCSOffsets; // pointer to DBCS offsets -} CPTABLEINFO, *PCPTABLEINFO; - -typedef struct _NLSTABLEINFO { - CPTABLEINFO OemTableInfo; - CPTABLEINFO AnsiTableInfo; - PUSHORT UpperCaseTable; // 844 format upcase table - PUSHORT LowerCaseTable; // 844 format lower case table -} NLSTABLEINFO, *PNLSTABLEINFO; - -#ifdef __cplusplus -} -#endif - -#endif // _NTNLS_ - diff --git a/pub/ddk/ntpoapi.h b/pub/ddk/ntpoapi.h deleted file mode 100644 index 42aa767..0000000 --- a/pub/ddk/ntpoapi.h +++ /dev/null @@ -1,2207 +0,0 @@ -/*++ BUILD Version: 0001 // Increment this if a change has global effects - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ntpoapi.h - -Abstract: - - This module contains the user APIs for the NT Power Management. - -Author: - -Revision History: - ---*/ - -#if (NTDDI_VERSION >= NTDDI_VISTA) -// begin_ntminiport begin_wdm begin_winnt - -// -// ========================================= -// Define GUIDs which represent well-known power schemes -// ========================================= -// - -// -// Maximum Power Savings - indicates that very aggressive power savings measures will be used to help -// stretch battery life. -// -// {a1841308-3541-4fab-bc81-f71556f20b4a} -// -DEFINE_GUID( GUID_MAX_POWER_SAVINGS, 0xA1841308, 0x3541, 0x4FAB, 0xBC, 0x81, 0xF7, 0x15, 0x56, 0xF2, 0x0B, 0x4A ); - -// -// No Power Savings - indicates that almost no power savings measures will be used. -// -// {8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c} -// -DEFINE_GUID( GUID_MIN_POWER_SAVINGS, 0x8C5E7FDA, 0xE8BF, 0x4A96, 0x9A, 0x85, 0xA6, 0xE2, 0x3A, 0x8C, 0x63, 0x5C ); - -// -// Typical Power Savings - indicates that fairly aggressive power savings measures will be used. -// -// {381b4222-f694-41f0-9685-ff5bb260df2e} -// -DEFINE_GUID( GUID_TYPICAL_POWER_SAVINGS, 0x381B4222, 0xF694, 0x41F0, 0x96, 0x85, 0xFF, 0x5B, 0xB2, 0x60, 0xDF, 0x2E ); - -// -// This is a special GUID that represents "no subgroup" of settings. That is, it indicates -// that settings that are in the root of the power policy hierarchy as opposed to settings -// that are buried under a subgroup of settings. This should be used when querying for -// power settings that may not fall into a subgroup. -// -DEFINE_GUID( NO_SUBGROUP_GUID, 0xFEA3413E, 0x7E05, 0x4911, 0x9A, 0x71, 0x70, 0x03, 0x31, 0xF1, 0xC2, 0x94 ); - -// -// This is a special GUID that represents "every power scheme". That is, it indicates -// that any write to this power scheme should be reflected to every scheme present. -// This allows users to write a single setting once and have it apply to all schemes. They -// can then apply custom settings to specific power schemes that they care about. -// -DEFINE_GUID( ALL_POWERSCHEMES_GUID, 0x68A1E95E, 0x13EA, 0x41E1, 0x80, 0x11, 0x0C, 0x49, 0x6C, 0xA4, 0x90, 0xB0 ); - -// -// This is a special GUID that represents a 'personality' that each power scheme will have. -// In other words, each power scheme will have this key indicating "I'm most like *this* base -// power scheme." This individual setting will have one of three settings: -// GUID_MAX_POWER_SAVINGS -// GUID_MIN_POWER_SAVINGS -// GUID_TYPICAL_POWER_SAVINGS -// -// This allows several features: -// 1. Drivers and applications can register for notification of this GUID. So when this power -// scheme is activiated, this GUID's setting will be sent across the system and drivers/applications -// can see "GUID_MAX_POWER_SAVINGS" which will tell them in a generic fashion "get real aggressive -// about conserving power". -// 2. UserB may install a driver or application which creates power settings, and UserB may modify -// those power settings. Now UserA logs in. How does he see those settings? They simply don't -// exist in his private power key. Well they do exist over in the system power key. When we -// enumerate all the power settings in this system power key and don't find a corresponding entry -// in the user's private power key, then we can go look at this "personality" key in the users -// power scheme. We can then go get a default value for the power setting, depending on which -// "personality" power scheme is being operated on. Here's an example: -// A. UserB installs an application that creates a power setting Seetting1 -// B. UserB changes Setting1 to have a value of 50 because that's one of the possible settings -// available for setting1. -// C. UserB logs out -// D. UserA logs in and his active power scheme is some custom scheme that was derived from -// the GUID_TYPICAL_POWER_SAVINGS. But remember that UserA has no setting1 in his -// private power key. -// E. When activating UserA's selected power scheme, all power settings in the system power key will -// be enumerated (including Setting1). -// F. The power manager will see that UserA has no Setting1 power setting in his private power scheme. -// G. The power manager will query UserA's power scheme for its personality and retrieve -// GUID_TYPICAL_POWER_SAVINGS. -// H. The power manager then looks in Setting1 in the system power key and looks in its set of default -// values for the corresponding value for GUID_TYPICAL_POWER_SAVINGS power schemes. -// I. This derived power setting is applied. -DEFINE_GUID( GUID_POWERSCHEME_PERSONALITY, 0x245D8541, 0x3943, 0x4422, 0xB0, 0x25, 0x13, 0xA7, 0x84, 0xF6, 0x79, 0xB7 ); - -// -// Define a special GUID which will be used to define the active power scheme. -// User will register for this power setting GUID, and when the active power -// scheme changes, they'll get a callback where the payload is the GUID -// representing the active powerscheme. -// ( 31F9F286-5084-42FE-B720-2B0264993763 } -// -DEFINE_GUID( GUID_ACTIVE_POWERSCHEME, 0x31F9F286, 0x5084, 0x42FE, 0xB7, 0x20, 0x2B, 0x02, 0x64, 0x99, 0x37, 0x63 ); - -// -// ========================================= -// Define GUIDs which represent well-known power settings -// ========================================= -// - -// Video settings -// -------------- -// -// Specifies the subgroup which will contain all of the video -// settings for a single policy. -// -DEFINE_GUID( GUID_VIDEO_SUBGROUP, 0x7516B95F, 0xF776, 0x4464, 0x8C, 0x53, 0x06, 0x16, 0x7F, 0x40, 0xCC, 0x99 ); - -// -// Specifies (in seconds) how long we wait after the last user input has been -// recieved before we power off the video. -// -DEFINE_GUID( GUID_VIDEO_POWERDOWN_TIMEOUT, 0x3C0BC021, 0xC8A8, 0x4E07, 0xA9, 0x73, 0x6B, 0x14, 0xCB, 0xCB, 0x2B, 0x7E ); - -// -// Specifies whether adaptive display dimming is turned on or off. -// 82DBCF2D-CD67-40C5-BFDC-9F1A5CCD4663 -// -DEFINE_GUID( GUID_VIDEO_ANNOYANCE_TIMEOUT, 0x82DBCF2D, 0xCD67, 0x40C5, 0xBF, 0xDC, 0x9F, 0x1A, 0x5C, 0xCD, 0x46, 0x63 ); - -// -// Specifies how much adaptive dim time out will be increased by. -// EED904DF-B142-4183-B10B-5A1197A37864 -// -DEFINE_GUID( GUID_VIDEO_ADAPTIVE_PERCENT_INCREASE, 0xEED904DF, 0xB142, 0x4183, 0xB1, 0x0B, 0x5A, 0x11, 0x97, 0xA3, 0x78, 0x64 ); - -// -// Specifies (in seconds) how long we wait after the last user input has been -// recieved before we dim the video. -// -DEFINE_GUID( GUID_VIDEO_DIM_TIMEOUT, 0x17aaa29b, 0x8b43, 0x4b94, 0xaa, 0xfe, 0x35, 0xf6, 0x4d, 0xaa, 0xf1, 0xee); - -// -// Specifies if the operating system should use adaptive timers (based on -// previous behavior) to power down the video, -// -DEFINE_GUID( GUID_VIDEO_ADAPTIVE_POWERDOWN, 0x90959D22, 0xD6A1, 0x49B9, 0xAF, 0x93, 0xBC, 0xE8, 0x85, 0xAD, 0x33, 0x5B ); - -// -// Specifies if the monitor is currently being powered or not. -// 02731015-4510-4526-99E6-E5A17EBD1AEA -// -DEFINE_GUID( GUID_MONITOR_POWER_ON, 0x02731015, 0x4510, 0x4526, 0x99, 0xE6, 0xE5, 0xA1, 0x7E, 0xBD, 0x1A, 0xEA ); - -// -// Monitor brightness policy when in normal state -// {aded5e82-b909-4619-9949-f5d71dac0bcb} -DEFINE_GUID(GUID_DEVICE_POWER_POLICY_VIDEO_BRIGHTNESS, 0xaded5e82L, 0xb909, 0x4619, 0x99, 0x49, 0xf5, 0xd7, 0x1d, 0xac, 0x0b, 0xcb); - -// -// -// Monitor brightness policy when in dim state -// {f1fbfde2-a960-4165-9f88-50667911ce96} -DEFINE_GUID(GUID_DEVICE_POWER_POLICY_VIDEO_DIM_BRIGHTNESS, 0xf1fbfde2, 0xa960, 0x4165, 0x9f, 0x88, 0x50, 0x66, 0x79, 0x11, 0xce, 0x96); - -// -// Current Monitor brightness -// {8ffee2c6-2d01-46be-adb9-398addc5b4ff} -DEFINE_GUID(GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS, 0x8ffee2c6, 0x2d01, 0x46be, 0xad, 0xb9, 0x39, 0x8a, 0xdd, 0xc5, 0xb4, 0xff); - - -// -// Specifies if the operating system should use ambient light sensor to change -// disply brightness adatively. -// {FBD9AA66-9553-4097-BA44-ED6E9D65EAB8} -DEFINE_GUID(GUID_VIDEO_ADAPTIVE_DISPLAY_BRIGHTNESS, 0xFBD9AA66, 0x9553, 0x4097, 0xBA, 0x44, 0xED, 0x6E, 0x9D, 0x65, 0xEA, 0xB8); - -// -// Specifies a change in the session's display state. -// 73A5E93A-5BB1-4F93-895B-DBD0DA855967 -// -// N.B. This is a session-specific notification, sent only to interactive -// session registrants. Session 0 and kernel mode consumers do not receive -// this notification. -DEFINE_GUID( GUID_SESSION_DISPLAY_STATE, 0x73A5E93A, 0x5BB1, 0x4F93, 0x89, 0x5B, 0xDB, 0xD0, 0xDA, 0x85, 0x59, 0x67 ); - -// -// Specifies a change in the current monitor's display state. -// 6fe69556-704a-47a0-8f24-c28d936fda47 -// -DEFINE_GUID(GUID_CONSOLE_DISPLAY_STATE, 0x6fe69556, 0x704a, 0x47a0, 0x8f, 0x24, 0xc2, 0x8d, 0x93, 0x6f, 0xda, 0x47); - -// -// Defines a guid for enabling/disabling the ability to create display required -// power requests. -// -// {A9CEB8DA-CD46-44FB-A98B-02AF69DE4623} -// -DEFINE_GUID( GUID_ALLOW_DISPLAY_REQUIRED, 0xA9CEB8DA, 0xCD46, 0x44FB, 0xA9, 0x8B, 0x02, 0xAF, 0x69, 0xDE, 0x46, 0x23 ); - -// Harddisk settings -// ----------------- -// -// Specifies the subgroup which will contain all of the harddisk -// settings for a single policy. -// -DEFINE_GUID( GUID_DISK_SUBGROUP, 0x0012EE47, 0x9041, 0x4B5D, 0x9B, 0x77, 0x53, 0x5F, 0xBA, 0x8B, 0x14, 0x42 ); - -// -// Specifies (in seconds) how long we wait after the last disk access -// before we power off the disk. -// -DEFINE_GUID( GUID_DISK_POWERDOWN_TIMEOUT, 0x6738E2C4, 0xE8A5, 0x4A42, 0xB1, 0x6A, 0xE0, 0x40, 0xE7, 0x69, 0x75, 0x6E ); - -// -// Specifies the amount of contiguous disk activity time to ignore when -// calculating disk idleness. -// -// 80e3c60e-bb94-4ad8-bbe0-0d3195efc663 -// - -DEFINE_GUID( GUID_DISK_BURST_IGNORE_THRESHOLD, 0x80e3c60e, 0xbb94, 0x4ad8, 0xbb, 0xe0, 0x0d, 0x31, 0x95, 0xef, 0xc6, 0x63 ); - -// -// Specifies if the operating system should use adaptive timers (based on -// previous behavior) to power down the disk, -// -DEFINE_GUID( GUID_DISK_ADAPTIVE_POWERDOWN, 0x396A32E1, 0x499A, 0x40B2, 0x91, 0x24, 0xA9, 0x6A, 0xFE, 0x70, 0x76, 0x67 ); - -// System sleep settings -// --------------------- -// -// Specifies the subgroup which will contain all of the sleep -// settings for a single policy. -// { 238C9FA8-0AAD-41ED-83F4-97BE242C8F20 } -// -DEFINE_GUID( GUID_SLEEP_SUBGROUP, 0x238C9FA8, 0x0AAD, 0x41ED, 0x83, 0xF4, 0x97, 0xBE, 0x24, 0x2C, 0x8F, 0x20 ); - -// -// Specifies an idle treshold percentage (0-100). The system must be this idle -// over a period of time in order to idle to sleep. -// -// N.B. DEPRECATED IN WINDOWS 6.1 -// -DEFINE_GUID( GUID_SLEEP_IDLE_THRESHOLD, 0x81cd32e0, 0x7833, 0x44f3, 0x87, 0x37, 0x70, 0x81, 0xf3, 0x8d, 0x1f, 0x70 ); - -// -// Specifies (in seconds) how long we wait after the system is deemed -// "idle" before moving to standby (S1, S2 or S3). -// -DEFINE_GUID( GUID_STANDBY_TIMEOUT, 0x29F6C1DB, 0x86DA, 0x48C5, 0x9F, 0xDB, 0xF2, 0xB6, 0x7B, 0x1F, 0x44, 0xDA ); - -// -// Specifies (in seconds) how long the system should go back to sleep after -// waking unattended. 0 indicates that the standard standby/hibernate idle -// policy should be used instead. -// -// {7bc4a2f9-d8fc-4469-b07b-33eb785aaca0} -// -DEFINE_GUID( GUID_UNATTEND_SLEEP_TIMEOUT, 0x7bc4a2f9, 0xd8fc, 0x4469, 0xb0, 0x7b, 0x33, 0xeb, 0x78, 0x5a, 0xac, 0xa0 ); - -// -// Specifies (in seconds) how long we wait after the system is deemed -// "idle" before moving to hibernate (S4). -// -DEFINE_GUID( GUID_HIBERNATE_TIMEOUT, 0x9D7815A6, 0x7EE4, 0x497E, 0x88, 0x88, 0x51, 0x5A, 0x05, 0xF0, 0x23, 0x64 ); - -// -// Specifies whether or not Fast S4 should be enabled if the system supports it -// 94AC6D29-73CE-41A6-809F-6363BA21B47E -// -DEFINE_GUID( GUID_HIBERNATE_FASTS4_POLICY, 0x94AC6D29, 0x73CE, 0x41A6, 0x80, 0x9F, 0x63, 0x63, 0xBA, 0x21, 0xB4, 0x7E ); - -// -// Define a GUID for controlling the criticality of sleep state transitions. -// Critical sleep transitions do not query applications, services or drivers -// before transitioning the platform to a sleep state. -// -// {B7A27025-E569-46c2-A504-2B96CAD225A1} -// -DEFINE_GUID( GUID_CRITICAL_POWER_TRANSITION, 0xB7A27025, 0xE569, 0x46c2, 0xA5, 0x04, 0x2B, 0x96, 0xCA, 0xD2, 0x25, 0xA1); - -// -// Specifies if the system is entering or exiting 'away mode'. -// 98A7F580-01F7-48AA-9C0F-44352C29E5C0 -// -DEFINE_GUID( GUID_SYSTEM_AWAYMODE, 0x98A7F580, 0x01F7, 0x48AA, 0x9C, 0x0F, 0x44, 0x35, 0x2C, 0x29, 0xE5, 0xC0 ); - -// Specify whether away mode is allowed -// -// {25DFA149-5DD1-4736-B5AB-E8A37B5B8187} -// -DEFINE_GUID( GUID_ALLOW_AWAYMODE, 0x25dfa149, 0x5dd1, 0x4736, 0xb5, 0xab, 0xe8, 0xa3, 0x7b, 0x5b, 0x81, 0x87 ); - -// -// Defines a guid for enabling/disabling standby (S1-S3) states. This does not -// affect hibernation (S4). -// -// {abfc2519-3608-4c2a-94ea-171b0ed546ab} -// -DEFINE_GUID( GUID_ALLOW_STANDBY_STATES, 0xabfc2519, 0x3608, 0x4c2a, 0x94, 0xea, 0x17, 0x1b, 0x0e, 0xd5, 0x46, 0xab ); - -// -// Defines a guid for enabling/disabling the ability to wake via RTC. -// -// {BD3B718A-0680-4D9D-8AB2-E1D2B4AC806D} -// -DEFINE_GUID( GUID_ALLOW_RTC_WAKE, 0xBD3B718A, 0x0680, 0x4D9D, 0x8A, 0xB2, 0xE1, 0xD2, 0xB4, 0xAC, 0x80, 0x6D ); - -// -// Defines a guid for enabling/disabling the ability to create system required -// power requests. -// -// {A4B195F5-8225-47D8-8012-9D41369786E2} -// -DEFINE_GUID( GUID_ALLOW_SYSTEM_REQUIRED, 0xA4B195F5, 0x8225, 0x47D8, 0x80, 0x12, 0x9D, 0x41, 0x36, 0x97, 0x86, 0xE2 ); - -// System button actions -// --------------------- -// -// -// Specifies the subgroup which will contain all of the system button -// settings for a single policy. -// -DEFINE_GUID( GUID_SYSTEM_BUTTON_SUBGROUP, 0x4F971E89, 0xEEBD, 0x4455, 0xA8, 0xDE, 0x9E, 0x59, 0x04, 0x0E, 0x73, 0x47 ); - -// Specifies (in a POWER_ACTION_POLICY structure) the appropriate action to -// take when the system power button is pressed. -// -DEFINE_GUID( GUID_POWERBUTTON_ACTION, 0x7648EFA3, 0xDD9C, 0x4E3E, 0xB5, 0x66, 0x50, 0xF9, 0x29, 0x38, 0x62, 0x80 ); -DEFINE_GUID( GUID_POWERBUTTON_ACTION_FLAGS, 0x857E7FAC, 0x034B, 0x4704, 0xAB, 0xB1, 0xBC, 0xA5, 0x4A, 0xA3, 0x14, 0x78 ); - -// -// Specifies (in a POWER_ACTION_POLICY structure) the appropriate action to -// take when the system sleep button is pressed. -// -DEFINE_GUID( GUID_SLEEPBUTTON_ACTION, 0x96996BC0, 0xAD50, 0x47EC, 0x92, 0x3B, 0x6F, 0x41, 0x87, 0x4D, 0xD9, 0xEB ); -DEFINE_GUID( GUID_SLEEPBUTTON_ACTION_FLAGS, 0x2A160AB1, 0xB69D, 0x4743, 0xB7, 0x18, 0xBF, 0x14, 0x41, 0xD5, 0xE4, 0x93 ); - -// -// Specifies (in a POWER_ACTION_POLICY structure) the appropriate action to -// take when the system sleep button is pressed. -// { A7066653-8D6C-40A8-910E-A1F54B84C7E5 } -// -DEFINE_GUID( GUID_USERINTERFACEBUTTON_ACTION, 0xA7066653, 0x8D6C, 0x40A8, 0x91, 0x0E, 0xA1, 0xF5, 0x4B, 0x84, 0xC7, 0xE5 ); - -// -// Specifies (in a POWER_ACTION_POLICY structure) the appropriate action to -// take when the system lid is closed. -// -DEFINE_GUID( GUID_LIDCLOSE_ACTION, 0x5CA83367, 0x6E45, 0x459F, 0xA2, 0x7B, 0x47, 0x6B, 0x1D, 0x01, 0xC9, 0x36 ); -DEFINE_GUID( GUID_LIDCLOSE_ACTION_FLAGS, 0x97E969AC, 0x0D6C, 0x4D08, 0x92, 0x7C, 0xD7, 0xBD, 0x7A, 0xD7, 0x85, 0x7B ); -DEFINE_GUID( GUID_LIDOPEN_POWERSTATE, 0x99FF10E7, 0x23B1, 0x4C07, 0xA9, 0xD1, 0x5C, 0x32, 0x06, 0xD7, 0x41, 0xB4 ); - - -// Battery Discharge Settings -// -------------------------- -// -// Specifies the subgroup which will contain all of the battery discharge -// settings for a single policy. -// -DEFINE_GUID( GUID_BATTERY_SUBGROUP, 0xE73A048D, 0xBF27, 0x4F12, 0x97, 0x31, 0x8B, 0x20, 0x76, 0xE8, 0x89, 0x1F ); - -// -// 4 battery discharge alarm settings. -// -// GUID_BATTERY_DISCHARGE_ACTION_x - This is the action to take. It is a value -// of type POWER_ACTION -// GUID_BATTERY_DISCHARGE_LEVEL_x - This is the battery level (%) -// GUID_BATTERY_DISCHARGE_FLAGS_x - Flags defined below: -// POWER_ACTION_POLICY->EventCode flags -// BATTERY_DISCHARGE_FLAGS_EVENTCODE_MASK -// BATTERY_DISCHARGE_FLAGS_ENABLE -DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_0, 0x637EA02F, 0xBBCB, 0x4015, 0x8E, 0x2C, 0xA1, 0xC7, 0xB9, 0xC0, 0xB5, 0x46 ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_0, 0x9A66D8D7, 0x4FF7, 0x4EF9, 0xB5, 0xA2, 0x5A, 0x32, 0x6C, 0xA2, 0xA4, 0x69 ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_0, 0x5dbb7c9f, 0x38e9, 0x40d2, 0x97, 0x49, 0x4f, 0x8a, 0x0e, 0x9f, 0x64, 0x0f ); - -DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_1, 0xD8742DCB, 0x3E6A, 0x4B3C, 0xB3, 0xFE, 0x37, 0x46, 0x23, 0xCD, 0xCF, 0x06 ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_1, 0x8183BA9A, 0xE910, 0x48DA, 0x87, 0x69, 0x14, 0xAE, 0x6D, 0xC1, 0x17, 0x0A ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_1, 0xbcded951, 0x187b, 0x4d05, 0xbc, 0xcc, 0xf7, 0xe5, 0x19, 0x60, 0xc2, 0x58 ); - -DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_2, 0x421CBA38, 0x1A8E, 0x4881, 0xAC, 0x89, 0xE3, 0x3A, 0x8B, 0x04, 0xEC, 0xE4 ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_2, 0x07A07CA2, 0xADAF, 0x40D7, 0xB0, 0x77, 0x53, 0x3A, 0xAD, 0xED, 0x1B, 0xFA ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_2, 0x7fd2f0c4, 0xfeb7, 0x4da3, 0x81, 0x17, 0xe3, 0xfb, 0xed, 0xc4, 0x65, 0x82 ); - -DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_3, 0x80472613, 0x9780, 0x455E, 0xB3, 0x08, 0x72, 0xD3, 0x00, 0x3C, 0xF2, 0xF8 ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_3, 0x58AFD5A6, 0xC2DD, 0x47D2, 0x9F, 0xBF, 0xEF, 0x70, 0xCC, 0x5C, 0x59, 0x65 ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_3, 0x73613ccf, 0xdbfa, 0x4279, 0x83, 0x56, 0x49, 0x35, 0xf6, 0xbf, 0x62, 0xf3 ); - -// Processor power settings -// ------------------------ -// - -// Specifies the subgroup which will contain all of the processor -// settings for a single policy. -// -DEFINE_GUID( GUID_PROCESSOR_SETTINGS_SUBGROUP, 0x54533251, 0x82BE, 0x4824, 0x96, 0xC1, 0x47, 0xB6, 0x0B, 0x74, 0x0D, 0x00 ); - -// -// Specifies various attributes that control processor performance/throttle -// states. -// -DEFINE_GUID( GUID_PROCESSOR_THROTTLE_POLICY, 0x57027304, 0x4AF6, 0x4104, 0x92, 0x60, 0xE3, 0xD9, 0x52, 0x48, 0xFC, 0x36 ); - -#define PERFSTATE_POLICY_CHANGE_IDEAL 0 -#define PERFSTATE_POLICY_CHANGE_SINGLE 1 -#define PERFSTATE_POLICY_CHANGE_ROCKET 2 -#define PERFSTATE_POLICY_CHANGE_MAX PERFSTATE_POLICY_CHANGE_ROCKET - -// -// Specifies a percentage (between 0 and 100) that the processor frequency -// should never go above. For example, if this value is set to 80, then -// the processor frequency will never be throttled above 80 percent of its -// maximum frequency by the system. -// -DEFINE_GUID( GUID_PROCESSOR_THROTTLE_MAXIMUM, 0xBC5038F7, 0x23E0, 0x4960, 0x96, 0xDA, 0x33, 0xAB, 0xAF, 0x59, 0x35, 0xEC ); - -// -// Specifies a percentage (between 0 and 100) that the processor frequency -// should not drop below. For example, if this value is set to 50, then the -// processor frequency will never be throttled below 50 percent of its -// maximum frequency by the system. -// -DEFINE_GUID( GUID_PROCESSOR_THROTTLE_MINIMUM, 0x893DEE8E, 0x2BEF, 0x41E0, 0x89, 0xC6, 0xB5, 0x5D, 0x09, 0x29, 0x96, 0x4C ); - -// -// Specifies whether throttle states are allowed to be used even when -// performance states are available. -// -// {3b04d4fd-1cc7-4f23-ab1c-d1337819c4bb} -// -DEFINE_GUID( GUID_PROCESSOR_ALLOW_THROTTLING, 0x3b04d4fd, 0x1cc7, 0x4f23, 0xab, 0x1c, 0xd1, 0x33, 0x78, 0x19, 0xc4, 0xbb ); - -// -// Specifies processor power settings for CState policy data -// {68F262A7-F621-4069-B9A5-4874169BE23C} -// -DEFINE_GUID( GUID_PROCESSOR_IDLESTATE_POLICY, 0x68f262a7, 0xf621, 0x4069, 0xb9, 0xa5, 0x48, 0x74, 0x16, 0x9b, 0xe2, 0x3c); - -// -// Specifies processor power settings for PerfState policy data -// {BBDC3814-18E9-4463-8A55-D197327C45C0} -// -DEFINE_GUID( GUID_PROCESSOR_PERFSTATE_POLICY, 0xBBDC3814, 0x18E9, 0x4463, 0x8A, 0x55, 0xD1, 0x97, 0x32, 0x7C, 0x45, 0xC0); - -// -// Specifies the increase busy percentage threshold that must be met before -// increasing the processor performance state. -// -// {06cadf0e-64ed-448a-8927-ce7bf90eb35d} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_INCREASE_THRESHOLD, 0x06cadf0e, 0x64ed, 0x448a, 0x89, 0x27, 0xce, 0x7b, 0xf9, 0x0e, 0xb3, 0x5d ); - -// -// Specifies the decrease busy percentage threshold that must be met before -// decreasing the processor performance state. -// -// {12a0ab44-fe28-4fa9-b3bd-4b64f44960a6} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_DECREASE_THRESHOLD, 0x12a0ab44, 0xfe28, 0x4fa9, 0xb3, 0xbd, 0x4b, 0x64, 0xf4, 0x49, 0x60, 0xa6 ); - -// -// Specifies, either as ideal, single or rocket, how aggressive performance -// states should be selected when increasing the processor performance state. -// -// {465E1F50-B610-473a-AB58-00D1077DC418} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_INCREASE_POLICY, 0x465e1f50, 0xb610, 0x473a, 0xab, 0x58, 0x0, 0xd1, 0x7, 0x7d, 0xc4, 0x18); - -// -// Specifies, either as ideal, single or rocket, how aggressive performance -// states should be selected when decreasing the processor performance state. -// -// {40FBEFC7-2E9D-4d25-A185-0CFD8574BAC6} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_DECREASE_POLICY, 0x40fbefc7, 0x2e9d, 0x4d25, 0xa1, 0x85, 0xc, 0xfd, 0x85, 0x74, 0xba, 0xc6); - -// -// Specifies, in milliseconds, the minimum amount of time that must elapse after -// the last processor performance state change before increasing the processor -// performance state. -// -// {984CF492-3BED-4488-A8F9-4286C97BF5AA} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_INCREASE_TIME, 0x984cf492, 0x3bed, 0x4488, 0xa8, 0xf9, 0x42, 0x86, 0xc9, 0x7b, 0xf5, 0xaa); - -// -// Specifies, in milliseconds, the minimum amount of time that must elapse after -// the last processor performance state change before increasing the processor -// performance state. -// -// {D8EDEB9B-95CF-4f95-A73C-B061973693C8} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_DECREASE_TIME, 0xd8edeb9b, 0x95cf, 0x4f95, 0xa7, 0x3c, 0xb0, 0x61, 0x97, 0x36, 0x93, 0xc8); - -// -// Specifies the time, in milliseconds, that must expire before considering -// a change in the processor performance states or parked core set. -// -// {4D2B0152-7D5C-498b-88E2-34345392A2C5} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_TIME_CHECK, 0x4d2b0152, 0x7d5c, 0x498b, 0x88, 0xe2, 0x34, 0x34, 0x53, 0x92, 0xa2, 0xc5); - -// -// Specifies whether a processor may opportunistically increase frequency above -// the maximum when operating contitions allow it to do so safely. -// -// {45BCC044-D885-43e2-8605-EE0EC6E96B59} -// -DEFINE_GUID(GUID_PROCESSOR_PERF_BOOST_POLICY, -0x45bcc044, 0xd885, 0x43e2, 0x86, 0x5, 0xee, 0xe, 0xc6, 0xe9, 0x6b, 0x59); - -#define PROCESSOR_PERF_BOOST_POLICY_DISABLED 0 -#define PROCESSOR_PERF_BOOST_POLICY_MAX 100 - -// -// Specifies if idle state promotion and demotion values should be scaled based -// on the current peformance state. -// -// {6C2993B0-8F48-481f-BCC6-00DD2742AA06} -// -DEFINE_GUID( GUID_PROCESSOR_IDLE_ALLOW_SCALING, 0x6c2993b0, 0x8f48, 0x481f, 0xbc, 0xc6, 0x0, 0xdd, 0x27, 0x42, 0xaa, 0x6); - -// -// Specifies if idle states should be disabled. -// -// {5D76A2CA-E8C0-402f-A133-2158492D58AD} -// -DEFINE_GUID( GUID_PROCESSOR_IDLE_DISABLE, 0x5d76a2ca, 0xe8c0, 0x402f, 0xa1, 0x33, 0x21, 0x58, 0x49, 0x2d, 0x58, 0xad); - -// -// Specifies the time that elapsed since the last idle state promotion or -// demotion before idle states may be promoted or demoted again (in -// microseconds). -// -// {C4581C31-89AB-4597-8E2B-9C9CAB440E6B} -// -DEFINE_GUID( GUID_PROCESSOR_IDLE_TIME_CHECK, 0xc4581c31, 0x89ab, 0x4597, 0x8e, 0x2b, 0x9c, 0x9c, 0xab, 0x44, 0xe, 0x6b); - - -// -// Specifies the upper busy threshold that must be met before demoting the -// processor to a lighter idle state (in percentage). -// -// {4B92D758-5A24-4851-A470-815D78AEE119} -// -DEFINE_GUID( GUID_PROCESSOR_IDLE_DEMOTE_THRESHOLD, 0x4b92d758, 0x5a24, 0x4851, 0xa4, 0x70, 0x81, 0x5d, 0x78, 0xae, 0xe1, 0x19); - -// -// Specifies the lower busy threshold that must be met before promoting the -// processor to a deeper idle state (in percentage). -// -// {7B224883-B3CC-4d79-819F-8374152CBE7C} -// -DEFINE_GUID( GUID_PROCESSOR_IDLE_PROMOTE_THRESHOLD, 0x7b224883, 0xb3cc, 0x4d79, 0x81, 0x9f, 0x83, 0x74, 0x15, 0x2c, 0xbe, 0x7c); - -// -// Specifies the utilization threshold in percent that must be crossed in order to un-park cores. -// -// {df142941-20f3-4edf-9a4a-9c83d3d717d1} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_INCREASE_THRESHOLD, 0xdf142941, 0x20f3, 0x4edf, 0x9a, 0x4a, 0x9c, 0x83, 0xd3, 0xd7, 0x17, 0xd1 ); - -// -// Specifies the utilization threshold in percent that must be crossed in order to park cores. -// -// {68dd2f27-a4ce-4e11-8487-3794e4135dfa} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_DECREASE_THRESHOLD, 0x68dd2f27, 0xa4ce, 0x4e11, 0x84, 0x87, 0x37, 0x94, 0xe4, 0x13, 0x5d, 0xfa); - -// -// Specifies, either as ideal, single or rocket, how aggressive core parking is when cores must be unparked. -// -// {c7be0679-2817-4d69-9d02-519a537ed0c6} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_INCREASE_POLICY, 0xc7be0679, 0x2817, 0x4d69, 0x9d, 0x02, 0x51, 0x9a, 0x53, 0x7e, 0xd0, 0xc6); - -#define CORE_PARKING_POLICY_CHANGE_IDEAL 0 -#define CORE_PARKING_POLICY_CHANGE_SINGLE 1 -#define CORE_PARKING_POLICY_CHANGE_ROCKET 2 -#define CORE_PARKING_POLICY_CHANGE_MAX CORE_PARKING_POLICY_CHANGE_ROCKET - -// -// Specifies, either as ideal, single or rocket, how aggressive core parking is when cores must be parked. -// -// {71021b41-c749-4d21-be74-a00f335d582b} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_DECREASE_POLICY, 0x71021b41, 0xc749, 0x4d21, 0xbe, 0x74, 0xa0, 0x0f, 0x33, 0x5d, 0x58, 0x2b); - -// -// Specifies, on a per processor group basis, the maximum number of cores that can be kept unparked. -// -// {ea062031-0e34-4ff1-9b6d-eb1059334028} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_MAX_CORES, 0xea062031, 0x0e34, 0x4ff1, 0x9b, 0x6d, 0xeb, 0x10, 0x59, 0x33, 0x40, 0x28); - -// -// Specifies, on a per processor group basis, the minimum number of cores that must be kept unparked. -// -// {0cc5b647-c1df-4637-891a-dec35c318583} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_MIN_CORES, 0x0cc5b647, 0xc1df, 0x4637, 0x89, 0x1a, 0xde, 0xc3, 0x5c, 0x31, 0x85, 0x83); - -// -// Specifies, in milliseconds, the minimum amount of time a core must be parked before it can be unparked. -// -// {2ddd5a84-5a71-437e-912a-db0b8c788732} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_INCREASE_TIME, 0x2ddd5a84, 0x5a71, 0x437e, 0x91, 0x2a, 0xdb, 0x0b, 0x8c, 0x78, 0x87, 0x32); - -// -// Specifies, in milliseconds, the minimum amount of time a core must be unparked before it can be parked. -// -// {dfd10d17-d5eb-45dd-877a-9a34ddd15c82} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_DECREASE_TIME, 0xdfd10d17, 0xd5eb, 0x45dd, 0x87, 0x7a, 0x9a, 0x34, 0xdd, 0xd1, 0x5c, 0x82); - -// -// Specifies the factor by which to decrease affinity history on each core after each check. -// -// {8f7b45e3-c393-480a-878c-f67ac3d07082} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_AFFINITY_HISTORY_DECREASE_FACTOR, 0x8f7b45e3, 0xc393, 0x480a, 0x87, 0x8c, 0xf6, 0x7a, 0xc3, 0xd0, 0x70, 0x82); - -// -// Specifies the threshold above which a core is considered to have had significant affinitized work scheduled to it while parked. -// -// {5b33697b-e89d-4d38-aa46-9e7dfb7cd2f9} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_AFFINITY_HISTORY_THRESHOLD, 0x5b33697b, 0xe89d, 0x4d38, 0xaa, 0x46, 0x9e, 0x7d, 0xfb, 0x7c, 0xd2, 0xf9); - -// -// Specifies the weighting given to each occurence where affinitized work was scheduled to a parked core. -// -// {e70867f1-fa2f-4f4e-aea1-4d8a0ba23b20} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_AFFINITY_WEIGHTING, 0xe70867f1, 0xfa2f, 0x4f4e, 0xae, 0xa1, 0x4d, 0x8a, 0x0b, 0xa2, 0x3b, 0x20); - -// -// Specifies the factor by which to decrease the over utilization history on each core after the current performance check. -// -// {1299023c-bc28-4f0a-81ec-d3295a8d815d} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_DECREASE_FACTOR, 0x1299023c, 0xbc28, 0x4f0a, 0x81, 0xec, 0xd3, 0x29, 0x5a, 0x8d, 0x81, 0x5d); - -// -// Specifies the threshold above which a core is considered to have been recently over utilized while parked. -// -// {9ac18e92-aa3c-4e27-b307-01ae37307129} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_THRESHOLD, 0x9ac18e92, 0xaa3c, 0x4e27, 0xb3, 0x07, 0x01, 0xae, 0x37, 0x30, 0x71, 0x29); - -// -// Specifies the weighting given to each occurence where a parked core is found to be over utilized. -// -// {8809c2d8-b155-42d4-bcda-0d345651b1db} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_WEIGHTING, 0x8809c2d8, 0xb155, 0x42d4, 0xbc, 0xda, 0x0d, 0x34, 0x56, 0x51, 0xb1, 0xdb); - -// -// Specifies, in percentage, the busy threshold that must be met before a parked core is considered over utilized. -// -// {943c8cb6-6f93-4227-ad87-e9a3feec08d1} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_THRESHOLD, 0x943c8cb6, 0x6f93, 0x4227, 0xad, 0x87, 0xe9, 0xa3, 0xfe, 0xec, 0x08, 0xd1); - -// -// Specifies if at least one processor per core should always remain unparked. -// -// {a55612aa-f624-42c6-a443-7397d064c04f} -// - -DEFINE_GUID( GUID_PROCESSOR_PARKING_CORE_OVERRIDE, 0xa55612aa, 0xf624, 0x42c6, 0xa4, 0x43, 0x73, 0x97, 0xd0, 0x64, 0xc0, 0x4f); - -// -// Specifies what performance state a processor should enter when first parked. -// -// {447235c7-6a8d-4cc0-8e24-9eaf70b96e2b} -// - -DEFINE_GUID( GUID_PROCESSOR_PARKING_PERF_STATE, 0x447235c7, 0x6a8d, 0x4cc0, 0x8e, 0x24, 0x9e, 0xaf, 0x70, 0xb9, 0x6e, 0x2b); - -// -// Specifies the number of perf time check intervals to average utility over. -// -// {7d24baa7-0b84-480f-840c-1b0743c00f5f} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_HISTORY, 0x7d24baa7, 0x0b84, 0x480f, 0x84, 0x0c, 0x1b, 0x07, 0x43, 0xc0, 0x0f, 0x5f); - -// -// Specifies active vs passive cooling. Although not directly related to -// processor settings, it is the processor that gets throttled if we're doing -// passive cooling, so it is fairly strongly related. -// {94D3A615-A899-4AC5-AE2B-E4D8F634367F} -// -DEFINE_GUID( GUID_SYSTEM_COOLING_POLICY, 0x94D3A615, 0xA899, 0x4AC5, 0xAE, 0x2B, 0xE4, 0xD8, 0xF6, 0x34, 0x36, 0x7F); - -// Lock Console on Wake -// -------------------- -// - -// Specifies the behavior of the system when we wake from standby or -// hibernate. If this is set, then we will cause the console to lock -// after we resume. -// -DEFINE_GUID( GUID_LOCK_CONSOLE_ON_WAKE, 0x0E796BDB, 0x100D, 0x47D6, 0xA2, 0xD5, 0xF7, 0xD2, 0xDA, 0xA5, 0x1F, 0x51 ); - -// Device idle characteristics -// --------------------------- -// -// Specifies whether to use the "performance" or "conservative" timeouts for -// device idle management. -// -// 4faab71a-92e5-4726-b531-224559672d19 -// -DEFINE_GUID( GUID_DEVICE_IDLE_POLICY, 0x4faab71a, 0x92e5, 0x4726, 0xb5, 0x31, 0x22, 0x45, 0x59, 0x67, 0x2d, 0x19 ); - -#define POWER_DEVICE_IDLE_POLICY_PERFORMANCE 0 -#define POWER_DEVICE_IDLE_POLICY_CONSERVATIVE 1 - -// AC/DC power source -// ------------------ -// - -// Specifies the power source for the system. consumers may register for -// notification when the power source changes and will be notified with -// one of 3 values: -// 0 - Indicates the system is being powered by an AC power source. -// 1 - Indicates the system is being powered by a DC power source. -// 2 - Indicates the system is being powered by a short-term DC power -// source. For example, this would be the case if the system is -// being powed by a short-term battery supply in a backing UPS -// system. When this value is recieved, the consumer should make -// preparations for either a system hibernate or system shutdown. -// -// { 5D3E9A59-E9D5-4B00-A6BD-FF34FF516548 } -DEFINE_GUID( GUID_ACDC_POWER_SOURCE, 0x5D3E9A59, 0xE9D5, 0x4B00, 0xA6, 0xBD, 0xFF, 0x34, 0xFF, 0x51, 0x65, 0x48 ); - -// Lid state changes -// ----------------- -// -// Specifies the current state of the lid (open or closed). The callback won't -// be called at all until a lid device is found and its current state is known. -// -// Values: -// -// 0 - closed -// 1 - opened -// -// { BA3E0F4D-B817-4094-A2D1-D56379E6A0F3 } -// - -DEFINE_GUID( GUID_LIDSWITCH_STATE_CHANGE, 0xBA3E0F4D, 0xB817, 0x4094, 0xA2, 0xD1, 0xD5, 0x63, 0x79, 0xE6, 0xA0, 0xF3 ); - -// Battery life remaining -// ---------------------- -// - -// Specifies the percentage of battery life remaining. The consumer -// may register for notification in order to track battery life in -// a fine-grained manner. -// -// Once registered, the consumer can expect to be notified as the battery -// life percentage changes. -// -// The consumer will recieve a value between 0 and 100 (inclusive) which -// indicates percent battery life remaining. -// -// { A7AD8041-B45A-4CAE-87A3-EECBB468A9E1 } -DEFINE_GUID( GUID_BATTERY_PERCENTAGE_REMAINING, 0xA7AD8041, 0xB45A, 0x4CAE, 0x87, 0xA3, 0xEE, 0xCB, 0xB4, 0x68, 0xA9, 0xE1 ); - - -// Notification to listeners that the system is fairly busy and won't be moving -// into an idle state any time soon. This can be used as a hint to listeners -// that now might be a good time to do background tasks. -// -DEFINE_GUID( GUID_IDLE_BACKGROUND_TASK, 0x515C31D8, 0xF734, 0x163D, 0xA0, 0xFD, 0x11, 0xA0, 0x8C, 0x91, 0xE8, 0xF1 ); - -// Notification to listeners that the system is fairly busy and won't be moving -// into an idle state any time soon. This can be used as a hint to listeners -// that now might be a good time to do background tasks. -// -// { CF23F240-2A54-48D8-B114-DE1518FF052E } -DEFINE_GUID( GUID_BACKGROUND_TASK_NOTIFICATION, 0xCF23F240, 0x2A54, 0x48D8, 0xB1, 0x14, 0xDE, 0x15, 0x18, 0xFF, 0x05, 0x2E ); - -// Define a GUID that will represent the action of a direct experience button -// on the platform. Users will register for this DPPE setting and recieve -// notification when the h/w button is pressed. -// -// { 1A689231-7399-4E9A-8F99-B71F999DB3FA } -// -DEFINE_GUID( GUID_APPLAUNCH_BUTTON, 0x1A689231, 0x7399, 0x4E9A, 0x8F, 0x99, 0xB7, 0x1F, 0x99, 0x9D, 0xB3, 0xFA ); - -// PCI Express power settings -// ------------------------ -// - -// Specifies the subgroup which will contain all of the PCI Express -// settings for a single policy. -// -// {501a4d13-42af-4429-9fd1-a8218c268e20} -// -DEFINE_GUID( GUID_PCIEXPRESS_SETTINGS_SUBGROUP, 0x501a4d13, 0x42af,0x4429, 0x9f, 0xd1, 0xa8, 0x21, 0x8c, 0x26, 0x8e, 0x20 ); - -// Specifies the PCI Express ASPM power policy. -// -// {ee12f906-d277-404b-b6da-e5fa1a576df5} -// -DEFINE_GUID( GUID_PCIEXPRESS_ASPM_POLICY, 0xee12f906, 0xd277, 0x404b, 0xb6, 0xda, 0xe5, 0xfa, 0x1a, 0x57, 0x6d, 0xf5 ); - -// POWER Shutdown settings -// ------------------------ -// - -// Specifies if forced shutdown should be used for all button and lid initiated -// shutdown actions. -// -// {833a6b62-dfa4-46d1-82f8-e09e34d029d6} -// - -DEFINE_GUID( GUID_ENABLE_SWITCH_FORCED_SHUTDOWN, 0x833a6b62, 0xdfa4, 0x46d1, 0x82, 0xf8, 0xe0, 0x9e, 0x34, 0xd0, 0x29, 0xd6 ); - -// end_winnt end_wdm end_ntminiport -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - - - - -#ifndef _NTPOAPI_ -#define _NTPOAPI_ - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4201) // nameless struct/union -#pragma warning(disable:4214) // bit field types other than int - - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Power Management user APIs -// - -// begin_ntminiport begin_wdm - -#ifndef _PO_DDK_ -#define _PO_DDK_ - -// begin_winnt - -typedef enum _SYSTEM_POWER_STATE { - PowerSystemUnspecified = 0, - PowerSystemWorking = 1, - PowerSystemSleeping1 = 2, - PowerSystemSleeping2 = 3, - PowerSystemSleeping3 = 4, - PowerSystemHibernate = 5, - PowerSystemShutdown = 6, - PowerSystemMaximum = 7 -} SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE; - -#define POWER_SYSTEM_MAXIMUM 7 - -typedef enum { - PowerActionNone = 0, - PowerActionReserved, - PowerActionSleep, - PowerActionHibernate, - PowerActionShutdown, - PowerActionShutdownReset, - PowerActionShutdownOff, - PowerActionWarmEject -} POWER_ACTION, *PPOWER_ACTION; - -typedef enum _DEVICE_POWER_STATE { - PowerDeviceUnspecified = 0, - PowerDeviceD0, - PowerDeviceD1, - PowerDeviceD2, - PowerDeviceD3, - PowerDeviceMaximum -} DEVICE_POWER_STATE, *PDEVICE_POWER_STATE; - -typedef enum _MONITOR_DISPLAY_STATE { - PowerMonitorOff = 0, - PowerMonitorOn, - PowerMonitorDim -} MONITOR_DISPLAY_STATE, *PMONITOR_DISPLAY_STATE; - -// end_winnt - -typedef union _POWER_STATE { - SYSTEM_POWER_STATE SystemState; - DEVICE_POWER_STATE DeviceState; -} POWER_STATE, *PPOWER_STATE; - -typedef enum _POWER_STATE_TYPE { - SystemPowerState = 0, - DevicePowerState -} POWER_STATE_TYPE, *PPOWER_STATE_TYPE; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef struct _SYSTEM_POWER_STATE_CONTEXT { - union { - struct { - ULONG Reserved1 : 8; - ULONG TargetSystemState : 4; - ULONG EffectiveSystemState : 4; - ULONG CurrentSystemState : 4; - ULONG IgnoreHibernationPath : 1; - ULONG PseudoTransition : 1; - ULONG Reserved2 : 10; - } DUMMYSTRUCTNAME; - - ULONG ContextAsUlong; - } DUMMYUNIONNAME; -} SYSTEM_POWER_STATE_CONTEXT, *PSYSTEM_POWER_STATE_CONTEXT; -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -typedef struct _COUNTED_REASON_CONTEXT { - ULONG Version; - ULONG Flags; - union { - struct { - UNICODE_STRING ResourceFileName; - USHORT ResourceReasonId; - ULONG StringCount; - PUNICODE_STRING __field_ecount(StringCount) ReasonStrings; - } DUMMYSTRUCTNAME; - - UNICODE_STRING SimpleString; - } DUMMYUNIONNAME; -} COUNTED_REASON_CONTEXT, *PCOUNTED_REASON_CONTEXT; - -#endif // (NTDDI_VERSION >= NTDDI_WIN7) - -// -// Generic power related IOCTLs -// - -#define IOCTL_QUERY_DEVICE_POWER_STATE \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x0, METHOD_BUFFERED, FILE_READ_ACCESS) - -#define IOCTL_SET_DEVICE_WAKE \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x1, METHOD_BUFFERED, FILE_WRITE_ACCESS) - -#define IOCTL_CANCEL_DEVICE_WAKE \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x2, METHOD_BUFFERED, FILE_WRITE_ACCESS) - - -// -// Defines for W32 interfaces -// - -// begin_winnt - -#define ES_SYSTEM_REQUIRED ((ULONG)0x00000001) -#define ES_DISPLAY_REQUIRED ((ULONG)0x00000002) -#define ES_USER_PRESENT ((ULONG)0x00000004) -#define ES_AWAYMODE_REQUIRED ((ULONG)0x00000040) -#define ES_CONTINUOUS ((ULONG)0x80000000) - -typedef ULONG EXECUTION_STATE, *PEXECUTION_STATE; - -typedef enum { - LT_DONT_CARE, - LT_LOWEST_LATENCY -} LATENCY_TIME; - -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN7) - -#define DIAGNOSTIC_REASON_VERSION 0 - -#define DIAGNOSTIC_REASON_SIMPLE_STRING 0x00000001 -#define DIAGNOSTIC_REASON_DETAILED_STRING 0x00000002 -#define DIAGNOSTIC_REASON_NOT_SPECIFIED 0x80000000 -#define DIAGNOSTIC_REASON_INVALID_FLAGS (~0x80000003) - -#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN7) - -// -// Defines for power request APIs -// - -#define POWER_REQUEST_CONTEXT_VERSION 0 - -#define POWER_REQUEST_CONTEXT_SIMPLE_STRING 0x00000001 -#define POWER_REQUEST_CONTEXT_DETAILED_STRING 0x00000002 - -// -// N.B. The maximum is a macro (rather than part of enum) for cgen to be able -// to parse power.h correctly. When a new power request type is added, the -// PowerRequestMaximum should be manually incremented. -// - -typedef enum _POWER_REQUEST_TYPE { - PowerRequestDisplayRequired, - PowerRequestSystemRequired, - PowerRequestAwayModeRequired -} POWER_REQUEST_TYPE, *PPOWER_REQUEST_TYPE; - -#define PowerRequestMaximum 3 - -// end_ntminiport - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -//----------------------------------------------------------------------------- -// Device Power Information -// Accessable via CM_Get_DevInst_Registry_Property_Ex(CM_DRP_DEVICE_POWER_DATA) -//----------------------------------------------------------------------------- - -#define PDCAP_D0_SUPPORTED 0x00000001 -#define PDCAP_D1_SUPPORTED 0x00000002 -#define PDCAP_D2_SUPPORTED 0x00000004 -#define PDCAP_D3_SUPPORTED 0x00000008 -#define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010 -#define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020 -#define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040 -#define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080 -#define PDCAP_WARM_EJECT_SUPPORTED 0x00000100 - -typedef struct CM_Power_Data_s { - ULONG PD_Size; - DEVICE_POWER_STATE PD_MostRecentPowerState; - ULONG PD_Capabilities; - ULONG PD_D1Latency; - ULONG PD_D2Latency; - ULONG PD_D3Latency; - DEVICE_POWER_STATE PD_PowerStateMapping[POWER_SYSTEM_MAXIMUM]; - SYSTEM_POWER_STATE PD_DeepestSystemWake; -} CM_POWER_DATA, *PCM_POWER_DATA; - -#endif // (NTDDI_VERSION >= NTDDI_WINXP) - -// begin_wdm - -typedef enum { - SystemPowerPolicyAc, - SystemPowerPolicyDc, - VerifySystemPolicyAc, - VerifySystemPolicyDc, - SystemPowerCapabilities, - SystemBatteryState, - SystemPowerStateHandler, - ProcessorStateHandler, - SystemPowerPolicyCurrent, - AdministratorPowerPolicy, - SystemReserveHiberFile, - ProcessorInformation, - SystemPowerInformation, - ProcessorStateHandler2, - LastWakeTime, // Compare with KeQueryInterruptTime() - LastSleepTime, // Compare with KeQueryInterruptTime() - SystemExecutionState, - SystemPowerStateNotifyHandler, - ProcessorPowerPolicyAc, - ProcessorPowerPolicyDc, - VerifyProcessorPowerPolicyAc, - VerifyProcessorPowerPolicyDc, - ProcessorPowerPolicyCurrent, - SystemPowerStateLogging, - SystemPowerLoggingEntry, - SetPowerSettingValue, - NotifyUserPowerSetting, - PowerInformationLevelUnused0, - PowerInformationLevelUnused1, - SystemVideoState, - TraceApplicationPowerMessage, - TraceApplicationPowerMessageEnd, - ProcessorPerfStates, - ProcessorIdleStates, - ProcessorCap, - SystemWakeSource, - SystemHiberFileInformation, - TraceServicePowerMessage, - ProcessorLoad, - PowerShutdownNotification, - MonitorCapabilities, - SessionPowerInit, - SessionDisplayState, - PowerRequestCreate, - PowerRequestAction, - GetPowerRequestList, - ProcessorInformationEx, - NotifyUserModeLegacyPowerEvent, - GroupPark, - ProcessorIdleDomains, - WakeTimerList, - SystemHiberFileSize, - PowerInformationLevelMaximum -} POWER_INFORMATION_LEVEL; - -// -// Power Setting definitions -// - -typedef enum { - PoAc, - PoDc, - PoHot, - PoConditionMaximum -} SYSTEM_POWER_CONDITION; - -typedef struct { - - // - // Version of this structure. Currently should be set to - // POWER_SETTING_VALUE_VERSION. - // - ULONG Version; - - - // - // GUID representing the power setting being applied. - // - GUID Guid; - - - // - // What power state should this setting be applied to? E.g. - // AC, DC, thermal, ... - // - SYSTEM_POWER_CONDITION PowerCondition; - - // - // Length (in bytes) of the 'Data' member. - // - ULONG DataLength; - - // - // Data which contains the actual setting value. - // - UCHAR Data[ANYSIZE_ARRAY]; -} SET_POWER_SETTING_VALUE, *PSET_POWER_SETTING_VALUE; - -#define POWER_SETTING_VALUE_VERSION (0x1) - -typedef struct { - GUID Guid; -} NOTIFY_USER_POWER_SETTING, *PNOTIFY_USER_POWER_SETTING; - -// -// Package definition for an experience button device notification. When -// someone registers for GUID_EXPERIENCE_BUTTON, this is the definition of -// the setting data they'll get. -// -typedef struct _APPLICATIONLAUNCH_SETTING_VALUE { - - // - // System time when the most recent button press ocurred. Note that this is - // specified in 100ns internvals since January 1, 1601. - // - LARGE_INTEGER ActivationTime; - - // - // Reserved for internal use. - // - ULONG Flags; - - // - // which instance of this device was pressed? - // - ULONG ButtonInstanceID; - - -} APPLICATIONLAUNCH_SETTING_VALUE, *PAPPLICATIONLAUNCH_SETTING_VALUE; - -// -// define platform roles -// - -typedef enum { - PlatformRoleUnspecified = 0, - PlatformRoleDesktop, - PlatformRoleMobile, - PlatformRoleWorkstation, - PlatformRoleEnterpriseServer, - PlatformRoleSOHOServer, - PlatformRoleAppliancePC, - PlatformRolePerformanceServer, - PlatformRoleMaximum -} POWER_PLATFORM_ROLE; - -// -// System power manager capabilities -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) || !defined(_BATCLASS_) -typedef struct { - ULONG Granularity; - ULONG Capacity; -} BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE; -#endif // (NTDDI_VERSION >= NTDDI_WINXP) || !defined(_BATCLASS_) - -// end_winnt -#endif // !_PO_DDK_ -// end_wdm end_ntminiport -// begin_nthal - -#define POWER_PERF_SCALE 100 -#define PERF_LEVEL_TO_PERCENT(_x_) ((_x_ * 1000) / (POWER_PERF_SCALE * 10)) -#define PERCENT_TO_PERF_LEVEL(_x_) ((_x_ * POWER_PERF_SCALE * 10) / 1000) - -// -// Policy manager state handler interfaces -// - -// power state handlers - -typedef enum { - PowerStateSleeping1 = 0, - PowerStateSleeping2 = 1, - PowerStateSleeping3 = 2, - PowerStateSleeping4 = 3, - PowerStateShutdownOff = 4, - PowerStateShutdownReset = 5, - PowerStateSleeping4Firmware = 6, - PowerStateMaximum = 7 -} POWER_STATE_HANDLER_TYPE, *PPOWER_STATE_HANDLER_TYPE; - -#define POWER_STATE_HANDLER_TYPE_MAX 8 - -__drv_functionClass(ENTER_STATE_SYSTEM_HANDLER) -__drv_sameIRQL -typedef -NTSTATUS -(ENTER_STATE_SYSTEM_HANDLER)( - __in PVOID SystemContext - ); - -typedef ENTER_STATE_SYSTEM_HANDLER *PENTER_STATE_SYSTEM_HANDLER; - -__drv_functionClass(ENTER_STATE_HANDLER) -__drv_sameIRQL -typedef -NTSTATUS -(ENTER_STATE_HANDLER)( - __in_opt PVOID Context, - __in_opt PENTER_STATE_SYSTEM_HANDLER SystemHandler, - __in_opt PVOID SystemContext, - __in LONG NumberProcessors, - __in_opt LONG volatile *Number - ); - -typedef ENTER_STATE_HANDLER *PENTER_STATE_HANDLER; - -typedef struct { - POWER_STATE_HANDLER_TYPE Type; - BOOLEAN RtcWake; - UCHAR Spare[3]; - PENTER_STATE_HANDLER Handler; - PVOID Context; -} POWER_STATE_HANDLER, *PPOWER_STATE_HANDLER; - - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -__drv_functionClass(ENTER_STATE_NOTIFY_HANDLER) -__drv_sameIRQL -typedef -NTSTATUS -(ENTER_STATE_NOTIFY_HANDLER)( - __in POWER_STATE_HANDLER_TYPE State, - __in PVOID Context, - __in BOOLEAN Entering - ); - -typedef ENTER_STATE_NOTIFY_HANDLER *PENTER_STATE_NOTIFY_HANDLER; - -typedef struct { - PENTER_STATE_NOTIFY_HANDLER Handler; - PVOID Context; -} POWER_STATE_NOTIFY_HANDLER, *PPOWER_STATE_NOTIFY_HANDLER; - -#endif // (NTDDI_VERSION >= NTDDI_WINXP) - -__drv_maxIRQL(APC_LEVEL) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtPowerInformation( - __in POWER_INFORMATION_LEVEL InformationLevel, - __in_bcount_opt(InputBufferLength) PVOID InputBuffer, - __in ULONG InputBufferLength, - __out_bcount_opt(OutputBufferLength) PVOID OutputBuffer, - __in ULONG OutputBufferLength - ); - -// -// Processor Power Management external interface definitions / info. -// - -typedef struct { - ULONG64 StartTime; - ULONG64 EndTime; - ULONG Reserved[4]; -} PROCESSOR_IDLE_TIMES, *PPROCESSOR_IDLE_TIMES; - -__drv_functionClass(PROCESSOR_IDLE_HANDLER) -typedef -NTSTATUS -(FASTCALL PROCESSOR_IDLE_HANDLER) ( - __in ULONG_PTR Context, - __inout PPROCESSOR_IDLE_TIMES IdleTimes - ); - -typedef PROCESSOR_IDLE_HANDLER *PPROCESSOR_IDLE_HANDLER; - -// -// PROCESSOR_IDLE_STATE "StateFlags" definitions. -// - -#define IDLE_STATE_FLAGS_C1_HLT 0x01 // describes C1 only -#define IDLE_STATE_FLAGS_C1_IO_HLT 0x02 // describes C1 only -#define IDLE_STATE_FLAGS_IO 0x04 // describes C2 and C3 only -#define IDLE_STATE_FLAGS_MWAIT 0x08 // describes C1, C2, C3, C4, ... - -typedef struct _PROCESSOR_IDLE_STATE { - UCHAR StateType; - ULONG StateFlags; - ULONG HardwareLatency; - ULONG Power; - ULONG_PTR Context; - PPROCESSOR_IDLE_HANDLER Handler; -} PROCESSOR_IDLE_STATE, *PPROCESSOR_IDLE_STATE; - -typedef struct _PROCESSOR_IDLE_STATES { - ULONG Size; - ULONG Revision; - ULONG Count; - ULONG Type; - KAFFINITY TargetProcessors; - PROCESSOR_IDLE_STATE State[ANYSIZE_ARRAY]; -} PROCESSOR_IDLE_STATES, *PPROCESSOR_IDLE_STATES; - -// PPM Perf. - -#define PROCESSOR_STATE_TYPE_PERFORMANCE 0x1 -#define PROCESSOR_STATE_TYPE_THROTTLE 0x2 - - -// -// begin_winnt -// - -typedef struct { - ULONG Frequency; - ULONG Flags; - ULONG PercentFrequency; -} PPM_WMI_LEGACY_PERFSTATE, *PPPM_WMI_LEGACY_PERFSTATE; - -typedef struct { - ULONG Latency; - ULONG Power; - ULONG TimeCheck; - UCHAR PromotePercent; - UCHAR DemotePercent; - UCHAR StateType; - UCHAR Reserved; - ULONG StateFlags; - ULONG Context; - ULONG IdleHandler; - ULONG Reserved1; // reserved for future use -} PPM_WMI_IDLE_STATE, *PPPM_WMI_IDLE_STATE; - -typedef struct { - ULONG Type; - ULONG Count; - ULONG TargetState; // current idle state - ULONG OldState; // previous idle state - ULONG64 TargetProcessors; - PPM_WMI_IDLE_STATE State[ANYSIZE_ARRAY]; -} PPM_WMI_IDLE_STATES, *PPPM_WMI_IDLE_STATES; - -typedef struct { - ULONG Type; - ULONG Count; - ULONG TargetState; // current idle state - ULONG OldState; // previous idle state - PVOID TargetProcessors; - PPM_WMI_IDLE_STATE State[ANYSIZE_ARRAY]; -} PPM_WMI_IDLE_STATES_EX, *PPPM_WMI_IDLE_STATES_EX; - -typedef struct { - ULONG Frequency; // in Mhz - ULONG Power; // in milliwatts - UCHAR PercentFrequency; - UCHAR IncreaseLevel; // goto higher state - UCHAR DecreaseLevel; // goto lower state - UCHAR Type; // performance or throttle - ULONG IncreaseTime; // in tick counts - ULONG DecreaseTime; // in tick counts - ULONG64 Control; // control value - ULONG64 Status; // control value - ULONG HitCount; - ULONG Reserved1; // reserved for future use - ULONG64 Reserved2; - ULONG64 Reserved3; -} PPM_WMI_PERF_STATE, *PPPM_WMI_PERF_STATE; - -typedef struct { - ULONG Count; - ULONG MaxFrequency; - ULONG CurrentState; // current state - ULONG MaxPerfState; // fastest state considering policy restrictions - ULONG MinPerfState; // slowest state considering policy restrictions - ULONG LowestPerfState; // slowest perf state, fixed, aka the "knee" - ULONG ThermalConstraint; - UCHAR BusyAdjThreshold; - UCHAR PolicyType; // domain coordination - UCHAR Type; - UCHAR Reserved; - ULONG TimerInterval; - ULONG64 TargetProcessors; // domain affinity - ULONG PStateHandler; - ULONG PStateContext; - ULONG TStateHandler; - ULONG TStateContext; - ULONG FeedbackHandler; - ULONG Reserved1; - ULONG64 Reserved2; - PPM_WMI_PERF_STATE State[ANYSIZE_ARRAY]; -} PPM_WMI_PERF_STATES, *PPPM_WMI_PERF_STATES; - -typedef struct { - ULONG Count; - ULONG MaxFrequency; - ULONG CurrentState; // current state - ULONG MaxPerfState; // fastest state considering policy restrictions - ULONG MinPerfState; // slowest state considering policy restrictions - ULONG LowestPerfState; // slowest perf state, fixed, aka the "knee" - ULONG ThermalConstraint; - UCHAR BusyAdjThreshold; - UCHAR PolicyType; // domain coordination - UCHAR Type; - UCHAR Reserved; - ULONG TimerInterval; - PVOID TargetProcessors; // domain affinity - ULONG PStateHandler; - ULONG PStateContext; - ULONG TStateHandler; - ULONG TStateContext; - ULONG FeedbackHandler; - ULONG Reserved1; - ULONG64 Reserved2; - PPM_WMI_PERF_STATE State[ANYSIZE_ARRAY]; -} PPM_WMI_PERF_STATES_EX, *PPPM_WMI_PERF_STATES_EX; - -// -// Legacy processor idle accounting. -// - -#define PROC_IDLE_BUCKET_COUNT 6 - -typedef struct { - ULONG IdleTransitions; - ULONG FailedTransitions; - ULONG InvalidBucketIndex; - ULONG64 TotalTime; - ULONG IdleTimeBuckets[PROC_IDLE_BUCKET_COUNT]; -} PPM_IDLE_STATE_ACCOUNTING, *PPPM_IDLE_STATE_ACCOUNTING; - -typedef struct { - ULONG StateCount; - ULONG TotalTransitions; - ULONG ResetCount; - ULONG64 StartTime; - PPM_IDLE_STATE_ACCOUNTING State[ANYSIZE_ARRAY]; -} PPM_IDLE_ACCOUNTING, *PPPM_IDLE_ACCOUNTING; - -// -// Processor idle accounting. -// - -#define PROC_IDLE_BUCKET_COUNT_EX 16 - -typedef struct { - ULONG64 TotalTimeUs; - ULONG MinTimeUs; - ULONG MaxTimeUs; - ULONG Count; -} PPM_IDLE_STATE_BUCKET_EX, *PPPM_IDLE_STATE_BUCKET_EX; - -typedef struct { - ULONG64 TotalTime; - ULONG IdleTransitions; - ULONG FailedTransitions; - ULONG InvalidBucketIndex; - ULONG MinTimeUs; - ULONG MaxTimeUs; - PPM_IDLE_STATE_BUCKET_EX IdleTimeBuckets[PROC_IDLE_BUCKET_COUNT_EX]; -} PPM_IDLE_STATE_ACCOUNTING_EX, *PPPM_IDLE_STATE_ACCOUNTING_EX; - -typedef struct { - ULONG StateCount; - ULONG TotalTransitions; - ULONG ResetCount; - ULONG64 StartTime; - __field_ecount(StateCount) PPM_IDLE_STATE_ACCOUNTING_EX State[ANYSIZE_ARRAY]; -} PPM_IDLE_ACCOUNTING_EX, *PPPM_IDLE_ACCOUNTING_EX; - -// -// Definitions of coordination types for _PSD, _TSD, and _CSD BIOS objects from -// the Acpi 3.0 specification -// - -#define ACPI_PPM_SOFTWARE_ALL 0xFC -#define ACPI_PPM_SOFTWARE_ANY 0xFD -#define ACPI_PPM_HARDWARE_ALL 0xFE - -// -// Definition of Microsoft PPM coordination types. -// - -#define MS_PPM_SOFTWARE_ALL 0x1 - -// -// Processor firmware rundown feature bit definitions. -// - -#define PPM_FIRMWARE_ACPI1C2 0x00000001 -#define PPM_FIRMWARE_ACPI1C3 0x00000002 -#define PPM_FIRMWARE_ACPI1TSTATES 0x00000004 -#define PPM_FIRMWARE_CST 0x00000008 -#define PPM_FIRMWARE_CSD 0x00000010 -#define PPM_FIRMWARE_PCT 0x00000020 -#define PPM_FIRMWARE_PSS 0x00000040 -#define PPM_FIRMWARE_XPSS 0x00000080 -#define PPM_FIRMWARE_PPC 0x00000100 -#define PPM_FIRMWARE_PSD 0x00000200 -#define PPM_FIRMWARE_PTC 0x00000400 -#define PPM_FIRMWARE_TSS 0x00000800 -#define PPM_FIRMWARE_TPC 0x00001000 -#define PPM_FIRMWARE_TSD 0x00002000 -#define PPM_FIRMWARE_PCCH 0x00004000 -#define PPM_FIRMWARE_PCCP 0x00008000 - -// -// Processor Power Management WMI interface. -// - -// {A5B32DDD-7F39-4abc-B892-900E43B59EBB} -DEFINE_GUID(PPM_PERFSTATE_CHANGE_GUID, -0xa5b32ddd, 0x7f39, 0x4abc, 0xb8, 0x92, 0x90, 0xe, 0x43, 0xb5, 0x9e, 0xbb); - -// {995e6b7f-d653-497a-b978-36a30c29bf01} -DEFINE_GUID(PPM_PERFSTATE_DOMAIN_CHANGE_GUID, -0x995e6b7f, 0xd653, 0x497a, 0xb9, 0x78, 0x36, 0xa3, 0xc, 0x29, 0xbf, 0x1); - -// {4838fe4f-f71c-4e51-9ecc-8430a7ac4c6c} -DEFINE_GUID(PPM_IDLESTATE_CHANGE_GUID, -0x4838fe4f, 0xf71c, 0x4e51, 0x9e, 0xcc, 0x84, 0x30, 0xa7, 0xac, 0x4c, 0x6c); - -// {5708cc20-7d40-4bf4-b4aa-2b01338d0126} -DEFINE_GUID(PPM_PERFSTATES_DATA_GUID, -0x5708cc20, 0x7d40, 0x4bf4, 0xb4, 0xaa, 0x2b, 0x01, 0x33, 0x8d, 0x01, 0x26); - -// {ba138e10-e250-4ad7-8616-cf1a7ad410e7} -DEFINE_GUID(PPM_IDLESTATES_DATA_GUID, -0xba138e10, 0xe250, 0x4ad7, 0x86, 0x16, 0xcf, 0x1a, 0x7a, 0xd4, 0x10, 0xe7); - -// {e2a26f78-ae07-4ee0-a30f-ce354f5a94cd} -DEFINE_GUID(PPM_IDLE_ACCOUNTING_GUID, -0xe2a26f78, 0xae07, 0x4ee0, 0xa3, 0x0f, 0xce, 0x54, 0xf5, 0x5a, 0x94, 0xcd); - -// {d67abd39-81f8-4a5e-8152-72e31ec912ee} -DEFINE_GUID(PPM_IDLE_ACCOUNTING_EX_GUID, -0xd67abd39, 0x81f8, 0x4a5e, 0x81, 0x52, 0x72, 0xe3, 0x1e, 0xc9, 0x12, 0xee); - -// {a852c2c8-1a4c-423b-8c2c-f30d82931a88} -DEFINE_GUID(PPM_THERMALCONSTRAINT_GUID, -0xa852c2c8, 0x1a4c, 0x423b, 0x8c, 0x2c, 0xf3, 0x0d, 0x82, 0x93, 0x1a, 0x88); - -// {7fd18652-0cfe-40d2-b0a1-0b066a87759e} -DEFINE_GUID(PPM_PERFMON_PERFSTATE_GUID, -0x7fd18652, 0xcfe, 0x40d2, 0xb0, 0xa1, 0xb, 0x6, 0x6a, 0x87, 0x75, 0x9e); - -// {48f377b8-6880-4c7b-8bdc-380176c6654d} -DEFINE_GUID(PPM_THERMAL_POLICY_CHANGE_GUID, -0x48f377b8, 0x6880, 0x4c7b, 0x8b, 0xdc, 0x38, 0x1, 0x76, 0xc6, 0x65, 0x4d); - - -typedef struct { - ULONG State; - ULONG Status; - ULONG Latency; - ULONG Speed; - ULONG Processor; -} PPM_PERFSTATE_EVENT, *PPPM_PERFSTATE_EVENT; - -typedef struct { - ULONG State; - ULONG Latency; - ULONG Speed; - ULONG64 Processors; -} PPM_PERFSTATE_DOMAIN_EVENT, *PPPM_PERFSTATE_DOMAIN_EVENT; - -typedef struct { - ULONG NewState; - ULONG OldState; - ULONG64 Processors; -} PPM_IDLESTATE_EVENT, *PPPM_IDLESTATE_EVENT; - -typedef struct { - ULONG ThermalConstraint; - ULONG64 Processors; -} PPM_THERMALCHANGE_EVENT, *PPPM_THERMALCHANGE_EVENT; - -#pragma warning(push) -#pragma warning(disable:4121) - -typedef struct { - UCHAR Mode; - ULONG64 Processors; -} PPM_THERMAL_POLICY_EVENT, *PPPM_THERMAL_POLICY_EVENT; - -#pragma warning(pop) - -// Power Policy Management interfaces -// - -typedef struct { - POWER_ACTION Action; - ULONG Flags; - ULONG EventCode; -} POWER_ACTION_POLICY, *PPOWER_ACTION_POLICY; - -// POWER_ACTION_POLICY->Flags: -#define POWER_ACTION_QUERY_ALLOWED 0x00000001 -#define POWER_ACTION_UI_ALLOWED 0x00000002 -#define POWER_ACTION_OVERRIDE_APPS 0x00000004 -#define POWER_ACTION_PSEUDO_TRANSITION 0x08000000 -#define POWER_ACTION_LIGHTEST_FIRST 0x10000000 -#define POWER_ACTION_LOCK_CONSOLE 0x20000000 -#define POWER_ACTION_DISABLE_WAKES 0x40000000 -#define POWER_ACTION_CRITICAL 0x80000000 - -// POWER_ACTION_POLICY->EventCode flags -#define POWER_LEVEL_USER_NOTIFY_TEXT 0x00000001 -#define POWER_LEVEL_USER_NOTIFY_SOUND 0x00000002 -#define POWER_LEVEL_USER_NOTIFY_EXEC 0x00000004 -#define POWER_USER_NOTIFY_BUTTON 0x00000008 -#define POWER_USER_NOTIFY_SHUTDOWN 0x00000010 -#define POWER_USER_NOTIFY_FORCED_SHUTDOWN 0x00000020 -#define POWER_FORCE_TRIGGER_RESET 0x80000000 - -// Note: for battery alarm EventCodes, the ID of the battery alarm << 16 is ORed -// into the flags. For example: DISCHARGE_POLICY_LOW << 16 - -// -// The GUID_BATTERY_DISCHARGE_FLAGS_x power settings use a subset of EventCode -// flags. The POWER_FORCE_TRIGGER_RESET flag doesn't make sense for a battery -// alarm so it is overloaded for other purposes (gerneral enable/disable). -#define BATTERY_DISCHARGE_FLAGS_EVENTCODE_MASK 0x00000007 -#define BATTERY_DISCHARGE_FLAGS_ENABLE 0x80000000 - -// system battery drain policies -typedef struct { - BOOLEAN Enable; - UCHAR Spare[3]; - ULONG BatteryLevel; - POWER_ACTION_POLICY PowerPolicy; - SYSTEM_POWER_STATE MinSystemState; -} SYSTEM_POWER_LEVEL, *PSYSTEM_POWER_LEVEL; - -// Discharge policy constants -#define NUM_DISCHARGE_POLICIES 4 -#define DISCHARGE_POLICY_CRITICAL 0 -#define DISCHARGE_POLICY_LOW 1 - - -// system power policies -typedef struct _SYSTEM_POWER_POLICY { - ULONG Revision; // 1 - - // events - POWER_ACTION_POLICY PowerButton; - POWER_ACTION_POLICY SleepButton; - POWER_ACTION_POLICY LidClose; - SYSTEM_POWER_STATE LidOpenWake; - ULONG Reserved; - - // "system idle" detection - POWER_ACTION_POLICY Idle; - ULONG IdleTimeout; - UCHAR IdleSensitivity; - - UCHAR DynamicThrottle; - UCHAR Spare2[2]; - - // meaning of power action "sleep" - SYSTEM_POWER_STATE MinSleep; - SYSTEM_POWER_STATE MaxSleep; - SYSTEM_POWER_STATE ReducedLatencySleep; - ULONG WinLogonFlags; - - ULONG Spare3; - - // parameters for dozing - // - ULONG DozeS4Timeout; - - // battery policies - ULONG BroadcastCapacityResolution; - SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES]; - - // video policies - ULONG VideoTimeout; - BOOLEAN VideoDimDisplay; - ULONG VideoReserved[3]; - - // hard disk policies - ULONG SpindownTimeout; - - // processor policies - BOOLEAN OptimizeForPower; - UCHAR FanThrottleTolerance; - UCHAR ForcedThrottle; - UCHAR MinThrottle; - POWER_ACTION_POLICY OverThrottled; - -} SYSTEM_POWER_POLICY, *PSYSTEM_POWER_POLICY; - - -// processor power policy state - -// -// Processor Idle State Policy. -// - -#define PROCESSOR_IDLESTATE_POLICY_COUNT 0x3 - -typedef struct { - ULONG TimeCheck; - UCHAR DemotePercent; - UCHAR PromotePercent; - UCHAR Spare[2]; -} PROCESSOR_IDLESTATE_INFO, *PPROCESSOR_IDLESTATE_INFO; - -typedef struct { - USHORT Revision; - union { - USHORT AsUSHORT; - struct { - USHORT AllowScaling : 1; - USHORT Disabled : 1; - USHORT Reserved : 14; - } DUMMYSTRUCTNAME; - } Flags; - - ULONG PolicyCount; - PROCESSOR_IDLESTATE_INFO Policy[PROCESSOR_IDLESTATE_POLICY_COUNT]; -} PROCESSOR_IDLESTATE_POLICY, *PPROCESSOR_IDLESTATE_POLICY; - -// -// Legacy Processor Policy. This is only provided to allow legacy -// applications to compile. New applications must use -// PROCESSOR_IDLESTATE_POLICY. -// - -#define PO_THROTTLE_NONE 0 -#define PO_THROTTLE_CONSTANT 1 -#define PO_THROTTLE_DEGRADE 2 -#define PO_THROTTLE_ADAPTIVE 3 -#define PO_THROTTLE_MAXIMUM 4 // not a policy, just a limit - - -typedef struct _PROCESSOR_POWER_POLICY_INFO { - - // Time based information (will be converted to kernel units) - ULONG TimeCheck; // in US - ULONG DemoteLimit; // in US - ULONG PromoteLimit; // in US - - // Percentage based information - UCHAR DemotePercent; - UCHAR PromotePercent; - UCHAR Spare[2]; - - // Flags - ULONG AllowDemotion:1; - ULONG AllowPromotion:1; - ULONG Reserved:30; - -} PROCESSOR_POWER_POLICY_INFO, *PPROCESSOR_POWER_POLICY_INFO; - -// processor power policy -typedef struct _PROCESSOR_POWER_POLICY { - ULONG Revision; // 1 - - // Dynamic Throttling Policy - UCHAR DynamicThrottle; - UCHAR Spare[3]; - - // Flags - ULONG DisableCStates:1; - ULONG Reserved:31; - - // System policy information - // The Array is last, in case it needs to be grown and the structure - // revision incremented. - ULONG PolicyCount; - PROCESSOR_POWER_POLICY_INFO Policy[3]; - -} PROCESSOR_POWER_POLICY, *PPROCESSOR_POWER_POLICY; - -// -// Processor Perf State Policy. -// - -typedef struct { - ULONG Revision; - UCHAR MaxThrottle; - UCHAR MinThrottle; - UCHAR BusyAdjThreshold; - union { - UCHAR Spare; - union { - UCHAR AsUCHAR; - struct { - UCHAR NoDomainAccounting : 1; - UCHAR IncreasePolicy: 2; - UCHAR DecreasePolicy: 2; - UCHAR Reserved : 3; - } DUMMYSTRUCTNAME; - } Flags; - } DUMMYUNIONNAME; - - ULONG TimeCheck; - ULONG IncreaseTime; - ULONG DecreaseTime; - ULONG IncreasePercent; - ULONG DecreasePercent; -} PROCESSOR_PERFSTATE_POLICY, *PPROCESSOR_PERFSTATE_POLICY; - -// administrator power policy overrides -typedef struct _ADMINISTRATOR_POWER_POLICY { - - // meaning of power action "sleep" - SYSTEM_POWER_STATE MinSleep; - SYSTEM_POWER_STATE MaxSleep; - - // video policies - ULONG MinVideoTimeout; - ULONG MaxVideoTimeout; - - // disk policies - ULONG MinSpindownTimeout; - ULONG MaxSpindownTimeout; -} ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY; - -// end_winnt - -__drv_maxIRQL(APC_LEVEL) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtSetThreadExecutionState( - __in EXECUTION_STATE NewFlags, // ES_xxx flags - __out PEXECUTION_STATE PreviousFlags - ); - -__drv_maxIRQL(APC_LEVEL) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtInitiatePowerAction( - __in POWER_ACTION SystemAction, - __in SYSTEM_POWER_STATE LightestSystemState, - __in ULONG Flags, // POWER_ACTION_xxx flags - __in BOOLEAN Asynchronous - ); - -__drv_maxIRQL(APC_LEVEL) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtSetSystemPowerState ( - __in POWER_ACTION SystemAction, - __in SYSTEM_POWER_STATE LightestSystemState, - __in ULONG Flags // POWER_ACTION_xxx flags - ); - -__drv_maxIRQL(APC_LEVEL) -__kernel_entry NTSYSCALLAPI -NTSTATUS -NTAPI -NtGetDevicePowerState( - __in HANDLE Device, - __out PDEVICE_POWER_STATE State - ); - -__drv_maxIRQL(APC_LEVEL) -__kernel_entry NTSYSCALLAPI -BOOLEAN -NTAPI -NtIsSystemResumeAutomatic( - VOID - ); - -// WinLogonFlags: -#define WINLOGON_LOCK_ON_SLEEP 0x00000001 - -// begin_winnt - -typedef struct { - // Misc supported system features - BOOLEAN PowerButtonPresent; - BOOLEAN SleepButtonPresent; - BOOLEAN LidPresent; - BOOLEAN SystemS1; - BOOLEAN SystemS2; - BOOLEAN SystemS3; - BOOLEAN SystemS4; // hibernate - BOOLEAN SystemS5; // off - BOOLEAN HiberFilePresent; - BOOLEAN FullWake; - BOOLEAN VideoDimPresent; - BOOLEAN ApmPresent; - BOOLEAN UpsPresent; - - // Processors - BOOLEAN ThermalControl; - BOOLEAN ProcessorThrottle; - UCHAR ProcessorMinThrottle; - -#if (NTDDI_VERSION < NTDDI_WINXP) - UCHAR ProcessorThrottleScale; - UCHAR spare2[4]; -#else - UCHAR ProcessorMaxThrottle; - BOOLEAN FastSystemS4; - UCHAR spare2[3]; -#endif // (NTDDI_VERSION < NTDDI_WINXP) - - // Disk - BOOLEAN DiskSpinDown; - UCHAR spare3[8]; - - // System Battery - BOOLEAN SystemBatteriesPresent; - BOOLEAN BatteriesAreShortTerm; - BATTERY_REPORTING_SCALE BatteryScale[3]; - - // Wake - SYSTEM_POWER_STATE AcOnLineWake; - SYSTEM_POWER_STATE SoftLidWake; - SYSTEM_POWER_STATE RtcWake; - SYSTEM_POWER_STATE MinDeviceWakeState; // note this may change on driver load - SYSTEM_POWER_STATE DefaultLowLatencyWake; -} SYSTEM_POWER_CAPABILITIES, *PSYSTEM_POWER_CAPABILITIES; - -typedef struct { - BOOLEAN AcOnLine; - BOOLEAN BatteryPresent; - BOOLEAN Charging; - BOOLEAN Discharging; - BOOLEAN Spare1[4]; - - ULONG MaxCapacity; - ULONG RemainingCapacity; - ULONG Rate; - ULONG EstimatedTime; - - ULONG DefaultAlert1; - ULONG DefaultAlert2; -} SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE; - -// end_winnt - -// -// valid flags for SYSTEM_POWER_STATE_DISABLE_REASON.PowerReasonCode -// -#define SPSD_REASON_NONE 0x00000000 -#define SPSD_REASON_NOBIOSSUPPORT 0x00000001 -#define SPSD_REASON_BIOSINCOMPATIBLE 0x00000002 -#define SPSD_REASON_NOOSPM 0x00000003 -#define SPSD_REASON_LEGACYDRIVER 0x00000004 -#define SPSD_REASON_HIBERSTACK 0x00000005 -#define SPSD_REASON_HIBERFILE 0x00000006 -#define SPSD_REASON_POINTERNAL 0x00000007 -#define SPSD_REASON_MEMORYLIMIT 0x00000008 -#define SPSD_REASON_MPOVERRIDE 0x00000009 -#define SPSD_REASON_DRIVERDOWNGRADE 0x0000000A -#define SPSD_REASON_PREVIOUSATTEMPTFAILED 0x0000000B -#define SPSD_REASON_UNKNOWN 0x0000000C -#define SPSD_REASON_INTERNALLYDISABLED 0x0000000D -#define SPSD_REASON_DISABLEDBYPOLICY 0x0000000E -#define SPSD_REASON_UPGRADEINPROGRESS 0x0000000F - -__struct_bcount(sizeof(SYSTEM_POWER_STATE_DISABLE_REASON) + PowerReasonLength) -typedef struct _SYSTEM_POWER_STATE_DISABLE_REASON { - BOOLEAN AffectedState[POWER_STATE_HANDLER_TYPE_MAX]; - ULONG PowerReasonCode; - ULONG PowerReasonLength; - //UCHAR PowerReasonInfo[ANYSIZE_ARRAY]; -} SYSTEM_POWER_STATE_DISABLE_REASON, *PSYSTEM_POWER_STATE_DISABLE_REASON; - -// -// valid flags for SYSTEM_POWER_LOGGING_ENTRY.LoggingType -// -#define LOGGING_TYPE_SPSD 0x00000001 -#define LOGGING_TYPE_POWERTRANSITION 0x00000002 - -typedef struct _SYSTEM_POWER_LOGGING_ENTRY { - ULONG LoggingType; - PVOID LoggingEntry; -} SYSTEM_POWER_LOGGING_ENTRY, *PSYSTEM_POWER_LOGGING_ENTRY; - -#if (NTDDI_VERSION < NTDDI_WINXP) // win2k only - -// -// Power structure in each processors PRCB -// -struct _PROCESSOR_POWER_STATE; // forward ref - -__drv_functionClass(PROCESSOR_IDLE_FUNCTION) -typedef -VOID -(FASTCALL PROCESSOR_IDLE_FUNCTION) ( - __inout struct _PROCESSOR_POWER_STATE *PState - ); - -typedef PROCESSOR_IDLE_FUNCTION *PPROCESSOR_IDLE_FUNCTION; - -typedef struct _PROCESSOR_POWER_STATE { - PPROCESSOR_IDLE_FUNCTION IdleFunction; - ULONG Idle0KernelTimeLimit; - ULONG Idle0LastTime; - - PVOID IdleState; - ULONGLONG LastCheck; - PROCESSOR_IDLE_TIMES IdleTimes; - - ULONG IdleTime1; - ULONG PromotionCheck; - ULONG IdleTime2; - - UCHAR CurrentThrottle; // current throttle setting - UCHAR ThrottleLimit; // max available throttle setting - UCHAR Spare1[2]; - - ULONG SetMember; - PVOID AbortThrottle; - -// temp for debugging - ULONGLONG DebugDelta; - ULONG DebugCount; - - ULONG LastSysTime; - ULONG Spare2[10]; - - -} PROCESSOR_POWER_STATE, *PPROCESSOR_POWER_STATE; - -#endif // (NTDDI_VERSION < NTDDI_WINXP) - -typedef struct _PROCESSOR_POWER_INFORMATION { - ULONG Number; - ULONG MaxMhz; - ULONG CurrentMhz; - ULONG MhzLimit; - ULONG MaxIdleState; - ULONG CurrentIdleState; -} PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION; - -typedef struct _SYSTEM_POWER_INFORMATION { - ULONG MaxIdlenessAllowed; - ULONG Idleness; - ULONG TimeRemaining; - UCHAR CoolingMode; -} SYSTEM_POWER_INFORMATION, *PSYSTEM_POWER_INFORMATION; - -// end_nthal - -typedef struct _SYSTEM_HIBERFILE_INFORMATION { - ULONG NumberOfMcbPairs; - LARGE_INTEGER Mcb[1]; -} SYSTEM_HIBERFILE_INFORMATION, *PSYSTEM_HIBERFILE_INFORMATION; - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -typedef enum _REQUESTER_TYPE { - KernelRequester, - UserProcessRequester, - UserSharedServiceRequester -} REQUESTER_TYPE, *PREQUESTER_TYPE; - -typedef struct _REASON_BUFFER { - ULONG Flags; - union { - struct { - SIZE_T ResourceFileNameOffset; - USHORT ResourceReasonId; - ULONG StringCount; - SIZE_T SubstitutionStringsOffset; - } DUMMYSTRUCTNAME; - - SIZE_T SimpleStringOffset; - } DUMMYUNIONNAME; -} REASON_BUFFER, *PREASON_BUFFER; - -typedef struct _DIAGNOSTIC_BUFFER { - SIZE_T Size; - REQUESTER_TYPE CallerType; - union { - struct { - SIZE_T ProcessImageNameOffset; - ULONG ProcessId; - ULONG ServiceTag; - } DUMMYSTRUCTNAME; - - struct { - SIZE_T DeviceDescriptionOffset; - SIZE_T DevicePathOffset; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; - - SIZE_T ReasonOffset; -} DIAGNOSTIC_BUFFER, *PDIAGNOSTIC_BUFFER; - -typedef struct _WAKE_TIMER_INFO { - SIZE_T OffsetToNext; - ULARGE_INTEGER DueTime; - ULONG Period; - DIAGNOSTIC_BUFFER ReasonContext; -} WAKE_TIMER_INFO, *PWAKE_TIMER_INFO; - -#endif // (NTDDI_VERSION >= NTDDI_WIN7) - -// -// Wake source tracking -// - -typedef enum { - DeviceWakeSourceType, - FixedWakeSourceType, - TimerWakeSourceType -} PO_WAKE_SOURCE_TYPE, *PPO_WAKE_SOURCE_TYPE; - -typedef enum { - FixedWakeSourcePowerButton, - FixedWakeSourceSleepButton, - FixedWakeSourceRtc, - FixedWakeSourceDozeToHibernate -} PO_FIXED_WAKE_SOURCE_TYPE, *PPO_FIXED_WAKE_SOURCE_TYPE; - -typedef struct _PO_WAKE_SOURCE_HEADER { - PO_WAKE_SOURCE_TYPE Type; - ULONG Size; -} PO_WAKE_SOURCE_HEADER, *PPO_WAKE_SOURCE_HEADER; - -typedef struct _PO_WAKE_SOURCE_DEVICE { - PO_WAKE_SOURCE_HEADER Header; - WCHAR InstancePath[ANYSIZE_ARRAY]; -} PO_WAKE_SOURCE_DEVICE, *PPO_WAKE_SOURCE_DEVICE; - -typedef struct _PO_WAKE_SOURCE_FIXED { - PO_WAKE_SOURCE_HEADER Header; - PO_FIXED_WAKE_SOURCE_TYPE FixedWakeSourceType; -} PO_WAKE_SOURCE_FIXED, *PPO_WAKE_SOURCE_FIXED; - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -typedef struct _PO_WAKE_SOURCE_TIMER { - PO_WAKE_SOURCE_HEADER Header; - DIAGNOSTIC_BUFFER Reason; -} PO_WAKE_SOURCE_TIMER, *PPO_WAKE_SOURCE_TIMER; - -#endif // (NTDDI_VERSION >= NTDDI_WIN7) - -typedef struct _PO_WAKE_SOURCE_INFO { - ULONG Count; - ULONG Offsets[ANYSIZE_ARRAY]; -} PO_WAKE_SOURCE_INFO, *PPO_WAKE_SOURCE_INFO; - -typedef struct _PO_WAKE_SOURCE_HISTORY { - ULONG Count; - ULONG Offsets[ANYSIZE_ARRAY]; -} PO_WAKE_SOURCE_HISTORY, *PPO_WAKE_SOURCE_HISTORY; - -#ifdef __cplusplus -} -#endif - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4201) -#pragma warning(default:4214) -#endif - -#endif // _NTPOAPI_ - diff --git a/pub/ddk/ntrxdef.h b/pub/ddk/ntrxdef.h deleted file mode 100644 index 3686399..0000000 --- a/pub/ddk/ntrxdef.h +++ /dev/null @@ -1,237 +0,0 @@ -/*++ - -Copyright (c) 1994 Microsoft Corporation - -Module Name: - - NtRxDef.h - -Abstract: - - This module defines a whole host of macros that orient the code towards NT - as opposed to Win9x. - -Author: ---*/ - -#ifndef _RX_NTDEFS_DEFINED_ -#define _RX_NTDEFS_DEFINED_ - -#define INLINE __inline - -// -// from winbase.h: -// - -#ifndef INVALID_HANDLE_VALUE -#define INVALID_HANDLE_VALUE ((HANDLE)-1) -#endif // ifndef INVALID_HANDLE_VALUE - -#define RxDeviceType(__xxx) ((DEVICE_TYPE)FILE_DEVICE_##__xxx) - -// -// this macro is used in various places to assist in defining sets of constants -// that can be used to set/clear/test specific bits in a flags-type field -// - -#define RX_DEFINE_FLAG(a,c,d) a = ((1<Fcb?" A: it is done this way to help with optimization. when you make -// the RxGetFcb() call, the Fcb will have to be reloaded from the RxContext if you have called any procs; however, -// it will not have to be reloaded with the capture technique. -// - -#ifndef MINIRDR__NAME -#define RxCaptureFcb PFCB __C_Fcb = (PFCB)(RxContext->pFcb) -#define RxCaptureFobx PFOBX __C_Fobx = (PFOBX)(RxContext->pFobx) -#else -#define RxCaptureFcb PMRX_FCB __C_Fcb = (RxContext->pFcb) -#define RxCaptureFobx PMRX_FOBX __C_Fobx = (RxContext->pFobx) -#endif - -#define RxCaptureRequestPacket PIRP __C_Irp = RxContext->CurrentIrp -#define RxCaptureParamBlock PIO_STACK_LOCATION __C_IrpSp = RxContext->CurrentIrpSp -#define RxCaptureFileObject PFILE_OBJECT __C_FileObject = __C_IrpSp-> FileObject - -// -// the "cap" prefix means "Captured from the RxContext....."; it's ok after you get used to it -// - -#define capFcb __C_Fcb -#define capFobx __C_Fobx -#define capPARAMS __C_IrpSp -#define capReqPacket __C_Irp -#define capFileObject __C_FileObject - -#define RxAllocatePool ExAllocatePool -#define RxAllocatePoolWithTag ExAllocatePoolWithTag -#define RxFreePool ExFreePool - - -extern -NTSTATUS -RxDuplicateString( - PUNICODE_STRING *Copy, - PUNICODE_STRING Original, - POOL_TYPE PoolType - ); - -#define RxIsResourceOwnershipStateExclusive(__r) (FlagOn((__r)->Flag, ResourceOwnedExclusive)) - -#define RxProtectMdlFromFree( Mdl ) {NOTHING;} -#define RxUnprotectMdlFromFree( Mdl ) {NOTHING;} -#define RxMdlIsProtected( Mdl ) (FALSE) -#define RxTakeOwnershipOfMdl( Mdl ) {NOTHING;} -#define RxDisownMdl( Mdl ) {NOTHING;} -#define RxMdlIsOwned( Mdl ) (TRUE) - -#define RxAllocateMdl( Buffer, BufferSize ) \ - IoAllocateMdl( Buffer, BufferSize, FALSE, FALSE, NULL ) - -#define RxMdlIsLocked( Mdl ) ((Mdl)->MdlFlags & MDL_PAGES_LOCKED) -#define RxMdlSourceIsNonPaged( Mdl ) ((Mdl)->MdlFlags & MDL_SOURCE_IS_NONPAGED_POOL) -#define RxMdlIsPartial( Mdl ) ((Mdl)->MdlFlags & MDL_PARTIAL) - -#undef RxProbeAndLockPages -#define RxProbeAndLockPages( Mdl, Mode, Access, Status ) \ - Status = STATUS_SUCCESS; \ - try { \ - MmProbeAndLockPages((Mdl), (Mode), (Access)); \ - } except (EXCEPTION_EXECUTE_HANDLER) { \ - Status = GetExceptionCode(); \ - } - -// -// Macros for dealing with network header MDLs -// - -// -// This is the amount of space we preallocate in front of the smb header to hold -// transport headers. This number came from the server. I suspect it is a worse case -// value for all the transports that support MDL_NETWORK_HEADER -// - -#define TRANSPORT_HEADER_SIZE 128 // IPX_HEADER_SIZE+MAC_HEADER_SIZE - -// -// Mdls that are marked with the MDL_NETWORK_HEADER flag have extra space allocated before -// the current start address that can be used for prepending lower-level headers. The idea -// is that when we want to prepend another header, we take the current mdl and adjust it to -// include this extra header at the front of the message. This is not strictly kosher and relies -// on the behavior that the page the current header is on, and the page that the prepended header -// is on, is the same page. The way the macros work is that if they are not on the same page, -// we don't set the NETWORK_HEADER flag, and the transport will use a second Mdl for the header. -// -// Note that the other wierd thing about this is that we don't use the true buffer sizes. The -// buffer address is really offset TRANSPORT_HEADER_SIZE into the buffer. The buffer size passed -// in the buffer size without the TRANSPORT_HEADER_SIZE included. Thus if the addition of the -// TRANSPORT_HEADER_SIZE would cause the Mdl to span an additonal page, this optimization won't -// work. -// - -#define RxInitializeHeaderMdl( Mdl, Va, Len ) { \ - MmInitializeMdl( Mdl, Va, Len ); \ - if (Mdl->ByteOffset >= TRANSPORT_HEADER_SIZE) { \ - Mdl->MdlFlags |= MDL_NETWORK_HEADER; \ - } \ - } - -#define RxAllocateHeaderMdl( Buffer, BufferSize, Mdl ) { \ - Mdl = RxAllocateMdl( Buffer, BufferSize ); \ - if ((Mdl) && (Mdl->ByteOffset >= TRANSPORT_HEADER_SIZE) ) { \ - SetFlag( Mdl->MdlFlags, MDL_NETWORK_HEADER ); \ - } \ - } - -#define RxMdlIsHeader( Mdl ) (FlagOn( Mdl )->MdlFlags, MDL_NETWORK_HEADER) - -#define RxBuildPartialHeaderMdl( SourceMdl, TargetMdl, Va, Len ) { \ - IoBuildPartialMdl( SourceMdl, TargetMdl, Va, Len ); \ - if (FlagOn(SourceMdl->MdlFlags, MDL_NETWORK_HEADER ) && \ - (TargetMdl->ByteOffset >= TRANSPORT_HEADER_SIZE)) { \ - SetFlag( TargetMdl->MdlFlags, MDL_NETWORK_HEADER ); \ - } \ -} - -#define RxBuildHeaderMdlForNonPagedPool( Mdl) MmBuildMdlForNonPagedPool( Mdl ) - -#define RxProbeAndLockHeaderPages( Mdl, Mode, Access, Status ) \ - RxProbeAndLockPages( Mdl, Mode, Access, Status ) - -#define RxUnlockHeaderPages( Mdl ) MmUnlockPages( Mdl ) - - -// -// the next set of macros defines the prototype and the argument list for the toplevel (Common) -// routines. these routines are just below the dispatch level and this is where the commonality -// between win9x and NT begins. In addition, the IN PRX_CONTEXT RxContext and accompanying capture macros -// could be platform specific as well. We must pass at least the RxContext; but on a RISC machine with -// lots of registers we could pass a lot more. An adjustment would have to be made in the -// RxFsdCommonDispatch in this case since the parameters are not yet captured at that point. -// - -// -// the reason why to say "RXSTATUS RxCommonRead (IN PRX_CONTEXT RxContext)" instead -// of "RxCommon(Read)" is so that the standard tags programs will work. "RxCommon(Read): -// doesn't look like a procedure definition -// - -#define RXCOMMON_SIGNATURE \ - PRX_CONTEXT RxContext - -#define RXCOMMON_ARGUMENTS \ - RxContext - -#define RxGetRequestorProcess( RXCONTEXT ) IoGetRequestorProcess( RXCONTEXT->CurrentIrp ) - -// -// RxGetRequestorProcess() returns what IoGetRequestorProcess() returns, which -// is a pointer to a process structure. Truncating this to 32 bits does -// not yield a value that is unique to the process. -// -// When a 32 bit value that is unique to the process is desired, -// RxGetRequestorProcessId() must be used instead. -// - -#define RxGetRequestorProcessId( RXCONTEXT ) IoGetRequestorProcessId( (RXCONTEXT)->CurrentIrp ) - -#define RxMarkContextPending( RXCONTEXT ) IoMarkIrpPending( (RXCONTEXT)->CurrentIrp ) - -#define RxSetCancelRoutine( Irp, CancelRoutine ) IoSetCancelRoutine( Irp, CancelRoutine ); - -// -// we do this as a macro because we may want to record that we did this adjustment so that -// people who QFI for standardinfo will be forced to the net to get the right answer and that would -// probably be better as a routine -// - -#define RxAdjustAllocationSizeforCC( FCB ) {\ - if ((FCB)->Header.FileSize.QuadPart > (FCB)->Header.AllocationSize.QuadPart) { \ - PMRX_NET_ROOT NetRoot = (FCB)->pNetRoot; \ - ULONGLONG ClusterSize = NetRoot->DiskParameters.ClusterSize; \ - ULONGLONG FileSize = (FCB)->Header.FileSize.QuadPart; \ - ASSERT(ClusterSize!=0); \ - (FCB)->Header.AllocationSize.QuadPart = (FileSize+ClusterSize)&~(ClusterSize-1); \ - } \ - ASSERT ( (FCB)->Header.ValidDataLength.QuadPart <= (FCB)->Header.FileSize.QuadPart ); \ - } - - -#endif // _RX_NTDEFS_DEFINED_ - diff --git a/pub/ddk/ntsam.h b/pub/ddk/ntsam.h deleted file mode 100644 index 532fe35..0000000 --- a/pub/ddk/ntsam.h +++ /dev/null @@ -1,2381 +0,0 @@ -/*++ BUILD Version: 0006 // Increment this if a change has global effects - -Copyright (c) 1989-1999 Microsoft Corporation - -Module Name: - - ntsam.h - -Abstract: - - This module describes the data types and procedure prototypes - that make up the NT Security Accounts Manager. This includes - API's exported by SAM and related subsystems. - -Author: - ---*/ - -#ifndef _NTSAM_ -#define _NTSAM_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef PPULONG -typedef PULONG *PPULONG; -#endif //PPULONG - -// -// An attempt to lookup more than this number of names or SIDs in -// a single call will be rejected with an INSUFFICIENT_RESOURCES -// status. -// - -#define SAM_MAXIMUM_LOOKUP_COUNT (1000) - - -// -// An attempt to pass names totalling more than the following number -// of bytes in length will be rejected with an INSUFFICIENT_RESOURCES -// status. -// - -#define SAM_MAXIMUM_LOOKUP_LENGTH (32000) - -// -// An attempt to set a password longer than this number of characters -// will fail. -// - -#define SAM_MAX_PASSWORD_LENGTH (256) - - -// -// Length of the salt used in the clear password encryption -// - -#define SAM_PASSWORD_ENCRYPTION_SALT_LEN (16) - - - - - - -#ifndef _NTSAM_SAM_HANDLE_ // ntsubauth -typedef PVOID SAM_HANDLE, *PSAM_HANDLE; // ntsubauth -#define _NTSAM_SAM_HANDLE_ // ntsubauth -#endif // ntsubauth - -typedef ULONG SAM_ENUMERATE_HANDLE, *PSAM_ENUMERATE_HANDLE; - -typedef struct _SAM_RID_ENUMERATION { - ULONG RelativeId; - UNICODE_STRING Name; -} SAM_RID_ENUMERATION, *PSAM_RID_ENUMERATION; - -typedef struct _SAM_SID_ENUMERATION { - PSID Sid; - UNICODE_STRING Name; -} SAM_SID_ENUMERATION, *PSAM_SID_ENUMERATION; - -#ifdef MIDL_PASS -#define SIZE_IS(x) [size_is(x)] -#define SWITCH_IS(x) [switch_is(x)] -#define SWITCH_TYPE(x) [switch_type(x)] -#define CASE(x) [case(x)] -#define RANGE(x,y) [range(x,y)] -#define VAR_SIZE_ARRAY -#else -#define SIZE_IS(x) -#define SWITCH_IS(x) -#define SWITCH_TYPE(x) -#define CASE(x) -#define RANGE(x,y) __in_range(x,y) -#define VAR_SIZE_ARRAY (1) -#endif - -typedef struct _SAM_BYTE_ARRAY { - - ULONG Size; - SIZE_IS( Size ) PUCHAR Data; - -} SAM_BYTE_ARRAY, *PSAM_BYTE_ARRAY; - -typedef struct _SAM_BYTE_ARRAY_32K { - - RANGE( 0, MAXSHORT ) ULONG Size; - SIZE_IS( Size ) PUCHAR Data; - -} SAM_BYTE_ARRAY_32K, *PSAM_BYTE_ARRAY_32K; - -typedef SAM_BYTE_ARRAY_32K SAM_SHELL_OBJECT_PROPERTIES, *PSAM_SHELL_OBJECT_PROPERTIES; - -///////////////////////////////////////////////////////////////////////////// -// // -// obsolete well-known account names. // -// These became obsolete with the flexadmin model. // -// These will be deleted shortly - DON'T USE THESE // -// // -///////////////////////////////////////////////////////////////////////////// - -#define DOMAIN_ADMIN_USER_NAME "ADMIN" -#define DOMAIN_ADMIN_NAME "D_ADMIN" -#define DOMAIN_ADMIN_NAMEW L"D_ADMIN" -#define DOMAIN_USERS_NAME "D_USERS" -#define DOMAIN_USERS_NAMEW L"D_USERS" -#define DOMAIN_GUESTS_NAME "D_GUESTS" -#define DOMAIN_ACCOUNT_OPERATORS_NAME "D_ACCOUN" -#define DOMAIN_ACCOUNT_OPERATORS_NAMEW L"D_ACCOUN" -#define DOMAIN_SERVER_OPERATORS_NAME "D_SERVER" -#define DOMAIN_SERVER_OPERATORS_NAMEW L"D_SERVER" -#define DOMAIN_PRINT_OPERATORS_NAME "D_PRINT" -#define DOMAIN_PRINT_OPERATORS_NAMEW L"D_PRINT" -#define DOMAIN_COMM_OPERATORS_NAME "D_COMM" -#define DOMAIN_COMM_OPERATORS_NAMEW L"D_COMM" -#define DOMAIN_BACKUP_OPERATORS_NAME "D_BACKUP" -#define DOMAIN_RESTORE_OPERATORS_NAME "D_RESTOR" - - - - - -/////////////////////////////////////////////////////////////////////////////// -// // -// Server Object Related Definitions // -// // -/////////////////////////////////////////////////////////////////////////////// - -// -// Access rights for server object -// - -#define SAM_SERVER_CONNECT 0x0001 -#define SAM_SERVER_SHUTDOWN 0x0002 -#define SAM_SERVER_INITIALIZE 0x0004 -#define SAM_SERVER_CREATE_DOMAIN 0x0008 -#define SAM_SERVER_ENUMERATE_DOMAINS 0x0010 -#define SAM_SERVER_LOOKUP_DOMAIN 0x0020 - - -#define SAM_SERVER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ - SAM_SERVER_CONNECT |\ - SAM_SERVER_INITIALIZE |\ - SAM_SERVER_CREATE_DOMAIN |\ - SAM_SERVER_SHUTDOWN |\ - SAM_SERVER_ENUMERATE_DOMAINS |\ - SAM_SERVER_LOOKUP_DOMAIN) - -#define SAM_SERVER_READ (STANDARD_RIGHTS_READ |\ - SAM_SERVER_ENUMERATE_DOMAINS) - -#define SAM_SERVER_WRITE (STANDARD_RIGHTS_WRITE |\ - SAM_SERVER_INITIALIZE |\ - SAM_SERVER_CREATE_DOMAIN |\ - SAM_SERVER_SHUTDOWN) - -#define SAM_SERVER_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ - SAM_SERVER_CONNECT |\ - SAM_SERVER_LOOKUP_DOMAIN) - - - - - - -/////////////////////////////////////////////////////////////////////////////// -// // -// Domain Object Related Definitions // -// // -/////////////////////////////////////////////////////////////////////////////// - - -// -// Access rights for domain object -// - -#define DOMAIN_READ_PASSWORD_PARAMETERS 0x0001 -#define DOMAIN_WRITE_PASSWORD_PARAMS 0x0002 -#define DOMAIN_READ_OTHER_PARAMETERS 0x0004 -#define DOMAIN_WRITE_OTHER_PARAMETERS 0x0008 -#define DOMAIN_CREATE_USER 0x0010 -#define DOMAIN_CREATE_GROUP 0x0020 -#define DOMAIN_CREATE_ALIAS 0x0040 -#define DOMAIN_GET_ALIAS_MEMBERSHIP 0x0080 -#define DOMAIN_LIST_ACCOUNTS 0x0100 -#define DOMAIN_LOOKUP 0x0200 -#define DOMAIN_ADMINISTER_SERVER 0x0400 - -#define DOMAIN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ - DOMAIN_READ_OTHER_PARAMETERS |\ - DOMAIN_WRITE_OTHER_PARAMETERS |\ - DOMAIN_WRITE_PASSWORD_PARAMS |\ - DOMAIN_CREATE_USER |\ - DOMAIN_CREATE_GROUP |\ - DOMAIN_CREATE_ALIAS |\ - DOMAIN_GET_ALIAS_MEMBERSHIP |\ - DOMAIN_LIST_ACCOUNTS |\ - DOMAIN_READ_PASSWORD_PARAMETERS |\ - DOMAIN_LOOKUP |\ - DOMAIN_ADMINISTER_SERVER) - -#define DOMAIN_READ (STANDARD_RIGHTS_READ |\ - DOMAIN_GET_ALIAS_MEMBERSHIP |\ - DOMAIN_READ_OTHER_PARAMETERS) - - -#define DOMAIN_WRITE (STANDARD_RIGHTS_WRITE |\ - DOMAIN_WRITE_OTHER_PARAMETERS |\ - DOMAIN_WRITE_PASSWORD_PARAMS |\ - DOMAIN_CREATE_USER |\ - DOMAIN_CREATE_GROUP |\ - DOMAIN_CREATE_ALIAS |\ - DOMAIN_ADMINISTER_SERVER) - -#define DOMAIN_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ - DOMAIN_READ_PASSWORD_PARAMETERS |\ - DOMAIN_LIST_ACCOUNTS |\ - DOMAIN_LOOKUP) - - - -// -// Normal modifications cause a domain's ModifiedCount to be -// incremented by 1. Domain promotion to Primary domain controller -// cause the ModifiedCount to be incremented by the following -// amount. This causes the upper 24-bits of the ModifiedCount -// to be a promotion count and the lower 40-bits as a modification -// count. -// - -#define DOMAIN_PROMOTION_INCREMENT {0x0,0x10} -#define DOMAIN_PROMOTION_MASK {0x0,0xFFFFFFF0} - -// -// Domain information classes and their corresponding data structures -// - -typedef enum _DOMAIN_INFORMATION_CLASS { - DomainPasswordInformation = 1, - DomainGeneralInformation, - DomainLogoffInformation, - DomainOemInformation, - DomainNameInformation, - DomainReplicationInformation, - DomainServerRoleInformation, - DomainModifiedInformation, - DomainStateInformation, - DomainUasInformation, - DomainGeneralInformation2, - DomainLockoutInformation, - DomainModifiedInformation2 -} DOMAIN_INFORMATION_CLASS; - -typedef enum _DOMAIN_SERVER_ENABLE_STATE { - DomainServerEnabled = 1, - DomainServerDisabled -} DOMAIN_SERVER_ENABLE_STATE, *PDOMAIN_SERVER_ENABLE_STATE; - -typedef enum _DOMAIN_SERVER_ROLE { - DomainServerRoleBackup = 2, - DomainServerRolePrimary -} DOMAIN_SERVER_ROLE, *PDOMAIN_SERVER_ROLE; - -#include "pshpack4.h" -typedef struct _DOMAIN_GENERAL_INFORMATION { - LARGE_INTEGER ForceLogoff; - UNICODE_STRING OemInformation; - UNICODE_STRING DomainName; - UNICODE_STRING ReplicaSourceNodeName; - LARGE_INTEGER DomainModifiedCount; - DOMAIN_SERVER_ENABLE_STATE DomainServerState; - DOMAIN_SERVER_ROLE DomainServerRole; - BOOLEAN UasCompatibilityRequired; - ULONG UserCount; - ULONG GroupCount; - ULONG AliasCount; -} DOMAIN_GENERAL_INFORMATION, *PDOMAIN_GENERAL_INFORMATION; -#include "poppack.h" - -#include "pshpack4.h" -typedef struct _DOMAIN_GENERAL_INFORMATION2 { - - DOMAIN_GENERAL_INFORMATION I1; - - // - // New fields added for this structure (NT1.0A). - // - - LARGE_INTEGER LockoutDuration; //Must be a Delta time - LARGE_INTEGER LockoutObservationWindow; //Must be a Delta time - USHORT LockoutThreshold; -} DOMAIN_GENERAL_INFORMATION2, *PDOMAIN_GENERAL_INFORMATION2; -#include "poppack.h" - -typedef struct _DOMAIN_UAS_INFORMATION { - BOOLEAN UasCompatibilityRequired; -} DOMAIN_UAS_INFORMATION; - -// -// This needs to be guarded, because ntsecapi.h is a generated -// public file, and ntsam.h is an internal file, but people like -// to mix and match them anyway. -// - -// begin_ntsecapi -#ifndef _DOMAIN_PASSWORD_INFORMATION_DEFINED -#define _DOMAIN_PASSWORD_INFORMATION_DEFINED -typedef struct _DOMAIN_PASSWORD_INFORMATION { - USHORT MinPasswordLength; - USHORT PasswordHistoryLength; - ULONG PasswordProperties; -#if defined(MIDL_PASS) - OLD_LARGE_INTEGER MaxPasswordAge; - OLD_LARGE_INTEGER MinPasswordAge; -#else - LARGE_INTEGER MaxPasswordAge; - LARGE_INTEGER MinPasswordAge; -#endif -} DOMAIN_PASSWORD_INFORMATION, *PDOMAIN_PASSWORD_INFORMATION; -#endif - -#if (_WIN32_WINNT >= 0x0501) -// -// PasswordProperties flags -// - -#define DOMAIN_PASSWORD_COMPLEX 0x00000001L -#define DOMAIN_PASSWORD_NO_ANON_CHANGE 0x00000002L -#define DOMAIN_PASSWORD_NO_CLEAR_CHANGE 0x00000004L -#define DOMAIN_LOCKOUT_ADMINS 0x00000008L -#define DOMAIN_PASSWORD_STORE_CLEARTEXT 0x00000010L -#define DOMAIN_REFUSE_PASSWORD_CHANGE 0x00000020L -#if(_WIN32_WINNT >= 0x0502) -#define DOMAIN_NO_LM_OWF_CHANGE 0x00000040L -#endif -#endif - -// end_ntsecapi - -typedef enum _DOMAIN_PASSWORD_CONSTRUCTION { - DomainPasswordSimple = 1, - DomainPasswordComplex -} DOMAIN_PASSWORD_CONSTRUCTION; - -typedef struct _DOMAIN_LOGOFF_INFORMATION { -#if defined(MIDL_PASS) - OLD_LARGE_INTEGER ForceLogoff; -#else - LARGE_INTEGER ForceLogoff; -#endif -} DOMAIN_LOGOFF_INFORMATION, *PDOMAIN_LOGOFF_INFORMATION; - -typedef struct _DOMAIN_OEM_INFORMATION { - UNICODE_STRING OemInformation; -} DOMAIN_OEM_INFORMATION, *PDOMAIN_OEM_INFORMATION; - -typedef struct _DOMAIN_NAME_INFORMATION { - UNICODE_STRING DomainName; -} DOMAIN_NAME_INFORMATION, *PDOMAIN_NAME_INFORMATION; - -typedef struct _DOMAIN_SERVER_ROLE_INFORMATION { - DOMAIN_SERVER_ROLE DomainServerRole; -} DOMAIN_SERVER_ROLE_INFORMATION, *PDOMAIN_SERVER_ROLE_INFORMATION; - -typedef struct _DOMAIN_REPLICATION_INFORMATION { - UNICODE_STRING ReplicaSourceNodeName; -} DOMAIN_REPLICATION_INFORMATION, *PDOMAIN_REPLICATION_INFORMATION; - -typedef struct _DOMAIN_MODIFIED_INFORMATION { -#if defined(MIDL_PASS) - OLD_LARGE_INTEGER DomainModifiedCount; - OLD_LARGE_INTEGER CreationTime; -#else - LARGE_INTEGER DomainModifiedCount; - LARGE_INTEGER CreationTime; -#endif -} DOMAIN_MODIFIED_INFORMATION, *PDOMAIN_MODIFIED_INFORMATION; - -typedef struct _DOMAIN_MODIFIED_INFORMATION2 { -#if defined(MIDL_PASS) - OLD_LARGE_INTEGER DomainModifiedCount; - OLD_LARGE_INTEGER CreationTime; - OLD_LARGE_INTEGER ModifiedCountAtLastPromotion; -#else - LARGE_INTEGER DomainModifiedCount; - LARGE_INTEGER CreationTime; - LARGE_INTEGER ModifiedCountAtLastPromotion; -#endif -} DOMAIN_MODIFIED_INFORMATION2, *PDOMAIN_MODIFIED_INFORMATION2; - -typedef struct _DOMAIN_STATE_INFORMATION { - DOMAIN_SERVER_ENABLE_STATE DomainServerState; -} DOMAIN_STATE_INFORMATION, *PDOMAIN_STATE_INFORMATION; - -typedef struct _DOMAIN_LOCKOUT_INFORMATION { -#if defined(MIDL_PASS) - OLD_LARGE_INTEGER LockoutDuration; //Must be a Delta time - OLD_LARGE_INTEGER LockoutObservationWindow; //Must be a Delta time -#else - LARGE_INTEGER LockoutDuration; //Must be a Delta time - LARGE_INTEGER LockoutObservationWindow; //Must be a Delta time -#endif - USHORT LockoutThreshold; //Zero means no lockout -} DOMAIN_LOCKOUT_INFORMATION, *PDOMAIN_LOCKOUT_INFORMATION; - - -// -// Types used by the SamQueryDisplayInformation API -// - -typedef enum _DOMAIN_DISPLAY_INFORMATION { - DomainDisplayUser = 1, - DomainDisplayMachine, - DomainDisplayGroup, // Added in NT1.0A - DomainDisplayOemUser, // Added in NT1.0A - DomainDisplayOemGroup, // Added in NT1.0A - DomainDisplayServer // Added in NT5 to support query of servers -} DOMAIN_DISPLAY_INFORMATION, *PDOMAIN_DISPLAY_INFORMATION; - - -typedef struct _DOMAIN_DISPLAY_USER { - ULONG Index; - ULONG Rid; - ULONG AccountControl; - UNICODE_STRING LogonName; - UNICODE_STRING AdminComment; - UNICODE_STRING FullName; -} DOMAIN_DISPLAY_USER, *PDOMAIN_DISPLAY_USER; - -typedef struct _DOMAIN_DISPLAY_MACHINE { - ULONG Index; - ULONG Rid; - ULONG AccountControl; - UNICODE_STRING Machine; - UNICODE_STRING Comment; -} DOMAIN_DISPLAY_MACHINE, *PDOMAIN_DISPLAY_MACHINE; - -typedef struct _DOMAIN_DISPLAY_GROUP { // Added in NT1.0A - ULONG Index; - ULONG Rid; - ULONG Attributes; - UNICODE_STRING Group; - UNICODE_STRING Comment; -} DOMAIN_DISPLAY_GROUP, *PDOMAIN_DISPLAY_GROUP; - -typedef struct _DOMAIN_DISPLAY_OEM_USER { // Added in NT1.0A - ULONG Index; - OEM_STRING User; -} DOMAIN_DISPLAY_OEM_USER, *PDOMAIN_DISPLAY_OEM_USER; - -typedef struct _DOMAIN_DISPLAY_OEM_GROUP { // Added in NT1.0A - ULONG Index; - OEM_STRING Group; -} DOMAIN_DISPLAY_OEM_GROUP, *PDOMAIN_DISPLAY_OEM_GROUP; - -// -// Types for SamQueryLocalizableAccountsInDomain -// - -typedef enum _DOMAIN_LOCALIZABLE_ACCOUNTS_INFORMATION { - DomainLocalizableAccountsBasic = 1, -} DOMAIN_LOCALIZABLE_ACCOUNTS_INFORMATION, *PDOMAIN_LOCALIZABLE_ACCOUNTS_INFORMATION; - -typedef struct _DOMAIN_LOCALIZABLE_ACCOUNTS_ENTRY { - ULONG Rid; - SID_NAME_USE Use; - UNICODE_STRING Name; - UNICODE_STRING AdminComment; -} DOMAIN_LOCALIZABLE_ACCOUNT_ENTRY, *PDOMAIN_LOCALIZABLE_ACCOUNT_ENTRY; - -typedef struct _DOMAIN_LOCALIZABLE_ACCOUNTS { - ULONG Count; -#ifdef MIDL_PASS - [size_is(Count)] -#endif - __ecount(Count) DOMAIN_LOCALIZABLE_ACCOUNT_ENTRY *Entries; -} DOMAIN_LOCALIZABLE_ACCOUNTS_BASIC, *PDOMAIN_LOCALIZABLE_ACCOUNTS_BASIC; - - -typedef -#ifdef MIDL_PASS - [switch_type(DOMAIN_LOCALIZABLE_ACCOUNTS_INFORMATION)] -#endif - union _DOMAIN_LOCALIZABLE_INFO_BUFFER { -#ifdef MIDL_PASS - [case(DomainLocalizableAccountsBasic)] -#endif - DOMAIN_LOCALIZABLE_ACCOUNTS_BASIC Basic; -} DOMAIN_LOCALIZABLE_ACCOUNTS_INFO_BUFFER, *PDOMAIN_LOCALIZABLE_ACCOUNTS_INFO_BUFFER; - - -/////////////////////////////////////////////////////////////////////////////// -// // -// Group Object Related Definitions // -// // -/////////////////////////////////////////////////////////////////////////////// - - -// -// Access rights for group object -// - -#define GROUP_READ_INFORMATION 0x0001 -#define GROUP_WRITE_ACCOUNT 0x0002 -#define GROUP_ADD_MEMBER 0x0004 -#define GROUP_REMOVE_MEMBER 0x0008 -#define GROUP_LIST_MEMBERS 0x0010 - -#define GROUP_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ - GROUP_LIST_MEMBERS |\ - GROUP_WRITE_ACCOUNT |\ - GROUP_ADD_MEMBER |\ - GROUP_REMOVE_MEMBER |\ - GROUP_READ_INFORMATION) - - -#define GROUP_READ (STANDARD_RIGHTS_READ |\ - GROUP_LIST_MEMBERS) - - -#define GROUP_WRITE (STANDARD_RIGHTS_WRITE |\ - GROUP_WRITE_ACCOUNT |\ - GROUP_ADD_MEMBER |\ - GROUP_REMOVE_MEMBER) - -#define GROUP_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ - GROUP_READ_INFORMATION) - - -// -// Group object types -// - -typedef struct _GROUP_MEMBERSHIP { - ULONG RelativeId; - ULONG Attributes; -} GROUP_MEMBERSHIP, *PGROUP_MEMBERSHIP; - - -typedef enum _GROUP_INFORMATION_CLASS { - GroupGeneralInformation = 1, - GroupNameInformation, - GroupAttributeInformation, - GroupAdminCommentInformation, - GroupReplicationInformation -} GROUP_INFORMATION_CLASS; - -typedef struct _GROUP_GENERAL_INFORMATION { - UNICODE_STRING Name; - ULONG Attributes; - ULONG MemberCount; - UNICODE_STRING AdminComment; -} GROUP_GENERAL_INFORMATION, *PGROUP_GENERAL_INFORMATION; - -typedef struct _GROUP_NAME_INFORMATION { - UNICODE_STRING Name; -} GROUP_NAME_INFORMATION, *PGROUP_NAME_INFORMATION; - -typedef struct _GROUP_ATTRIBUTE_INFORMATION { - ULONG Attributes; -} GROUP_ATTRIBUTE_INFORMATION, *PGROUP_ATTRIBUTE_INFORMATION; - -typedef struct _GROUP_ADM_COMMENT_INFORMATION { - UNICODE_STRING AdminComment; -} GROUP_ADM_COMMENT_INFORMATION, *PGROUP_ADM_COMMENT_INFORMATION; - - - -/////////////////////////////////////////////////////////////////////////////// -// // -// Alias Object Related Definitions // -// // -/////////////////////////////////////////////////////////////////////////////// - -// -// Access rights for alias object -// - -#define ALIAS_ADD_MEMBER 0x0001 -#define ALIAS_REMOVE_MEMBER 0x0002 -#define ALIAS_LIST_MEMBERS 0x0004 -#define ALIAS_READ_INFORMATION 0x0008 -#define ALIAS_WRITE_ACCOUNT 0x0010 - -#define ALIAS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ - ALIAS_READ_INFORMATION |\ - ALIAS_WRITE_ACCOUNT |\ - ALIAS_LIST_MEMBERS |\ - ALIAS_ADD_MEMBER |\ - ALIAS_REMOVE_MEMBER) - - -#define ALIAS_READ (STANDARD_RIGHTS_READ |\ - ALIAS_LIST_MEMBERS) - - -#define ALIAS_WRITE (STANDARD_RIGHTS_WRITE |\ - ALIAS_WRITE_ACCOUNT |\ - ALIAS_ADD_MEMBER |\ - ALIAS_REMOVE_MEMBER) - -#define ALIAS_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ - ALIAS_READ_INFORMATION) - -// -// Alias object types -// - -typedef enum _ALIAS_INFORMATION_CLASS { - AliasGeneralInformation = 1, - AliasNameInformation, - AliasAdminCommentInformation, - AliasReplicationInformation, - AliasExtendedInformation, -} ALIAS_INFORMATION_CLASS; - -typedef struct _ALIAS_GENERAL_INFORMATION { - UNICODE_STRING Name; - ULONG MemberCount; - UNICODE_STRING AdminComment; -} ALIAS_GENERAL_INFORMATION, *PALIAS_GENERAL_INFORMATION; - -typedef struct _ALIAS_NAME_INFORMATION { - UNICODE_STRING Name; -} ALIAS_NAME_INFORMATION, *PALIAS_NAME_INFORMATION; - -typedef struct _ALIAS_ADM_COMMENT_INFORMATION { - UNICODE_STRING AdminComment; -} ALIAS_ADM_COMMENT_INFORMATION, *PALIAS_ADM_COMMENT_INFORMATION; - -#define ALIAS_ALL_NAME (0x00000001L) -#define ALIAS_ALL_MEMBER_COUNT (0x00000002L) -#define ALIAS_ALL_ADMIN_COMMENT (0x00000004L) -#define ALIAS_ALL_SHELL_ADMIN_OBJECT_PROPERTIES (0x00000008L) - -typedef struct _ALIAS_EXTENDED_INFORMATION { - - ULONG WhichFields; - SAM_SHELL_OBJECT_PROPERTIES ShellAdminObjectProperties; - -} ALIAS_EXTENDED_INFORMATION, *PALIAS_EXTENDED_INFORMATION; - - -////////////////////////////////////////////////////////////////////////////// -// // -// NT5+ Limited Groups Related Definitions // -// // -////////////////////////////////////////////////////////////////////////////// - -// -// Group Flag Definitions to determine Type of Group -// - -#define GROUP_TYPE_BUILTIN_LOCAL_GROUP 0x00000001 -#define GROUP_TYPE_ACCOUNT_GROUP 0x00000002 -#define GROUP_TYPE_RESOURCE_GROUP 0x00000004 -#define GROUP_TYPE_UNIVERSAL_GROUP 0x00000008 -#define GROUP_TYPE_APP_BASIC_GROUP 0x00000010 -#define GROUP_TYPE_APP_QUERY_GROUP 0x00000020 -#define GROUP_TYPE_SECURITY_ENABLED 0x80000000 - - -#define GROUP_TYPE_RESOURCE_BEHAVOIR (GROUP_TYPE_RESOURCE_GROUP | \ - GROUP_TYPE_APP_BASIC_GROUP | \ - GROUP_TYPE_APP_QUERY_GROUP) - - - -/////////////////////////////////////////////////////////////////////////////// -// // -// User Object Related Definitions // -// // -/////////////////////////////////////////////////////////////////////////////// - - - -// -// Access rights for user object -// - -#define USER_READ_GENERAL 0x0001 -#define USER_READ_PREFERENCES 0x0002 -#define USER_WRITE_PREFERENCES 0x0004 -#define USER_READ_LOGON 0x0008 -#define USER_READ_ACCOUNT 0x0010 -#define USER_WRITE_ACCOUNT 0x0020 -#define USER_CHANGE_PASSWORD 0x0040 -#define USER_FORCE_PASSWORD_CHANGE 0x0080 -#define USER_LIST_GROUPS 0x0100 -#define USER_READ_GROUP_INFORMATION 0x0200 -#define USER_WRITE_GROUP_INFORMATION 0x0400 - -#define USER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ - USER_READ_PREFERENCES |\ - USER_READ_LOGON |\ - USER_LIST_GROUPS |\ - USER_READ_GROUP_INFORMATION |\ - USER_WRITE_PREFERENCES |\ - USER_CHANGE_PASSWORD |\ - USER_FORCE_PASSWORD_CHANGE |\ - USER_READ_GENERAL |\ - USER_READ_ACCOUNT |\ - USER_WRITE_ACCOUNT |\ - USER_WRITE_GROUP_INFORMATION) - - - -#define USER_READ (STANDARD_RIGHTS_READ |\ - USER_READ_PREFERENCES |\ - USER_READ_LOGON |\ - USER_READ_ACCOUNT |\ - USER_LIST_GROUPS |\ - USER_READ_GROUP_INFORMATION) - - -#define USER_WRITE (STANDARD_RIGHTS_WRITE |\ - USER_WRITE_PREFERENCES |\ - USER_CHANGE_PASSWORD) - -#define USER_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ - USER_READ_GENERAL |\ - USER_CHANGE_PASSWORD) - - -// -// User object types -// - -// begin_ntsubauth -#ifndef _NTSAM_USER_ACCOUNT_FLAGS_ - -// -// User account control flags... -// - -#define USER_ACCOUNT_DISABLED (0x00000001) -#define USER_HOME_DIRECTORY_REQUIRED (0x00000002) -#define USER_PASSWORD_NOT_REQUIRED (0x00000004) -#define USER_TEMP_DUPLICATE_ACCOUNT (0x00000008) -#define USER_NORMAL_ACCOUNT (0x00000010) -#define USER_MNS_LOGON_ACCOUNT (0x00000020) -#define USER_INTERDOMAIN_TRUST_ACCOUNT (0x00000040) -#define USER_WORKSTATION_TRUST_ACCOUNT (0x00000080) -#define USER_SERVER_TRUST_ACCOUNT (0x00000100) -#define USER_DONT_EXPIRE_PASSWORD (0x00000200) -#define USER_ACCOUNT_AUTO_LOCKED (0x00000400) -#define USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED (0x00000800) -#define USER_SMARTCARD_REQUIRED (0x00001000) -#define USER_TRUSTED_FOR_DELEGATION (0x00002000) -#define USER_NOT_DELEGATED (0x00004000) -#define USER_USE_DES_KEY_ONLY (0x00008000) -#define USER_DONT_REQUIRE_PREAUTH (0x00010000) -#define USER_PASSWORD_EXPIRED (0x00020000) -#define USER_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION (0x00040000) -#define USER_NO_AUTH_DATA_REQUIRED (0x00080000) -#define USER_PARTIAL_SECRETS_ACCOUNT (0x00100000) -#define USER_USE_AES_KEYS (0x00200000) -// end_ntsubauth - -// -// The previous bit (USER_USE_AES_KEYS) is not used in the product. -// To be clearer, this bit is stored and retrieved but is never -// used by any component. -// We've shipped Vista with it, therefore we have to leave it behind. -// -// !!!! <<<<< DO NOT, AGAIN DO NOT INTRODUCE ANY NEW BITS >>>>> !!!! -// See Windows OS Bug 1962665 and Windows SE Bug 201918 -// -// Also see the use of begin_ntsubauth and end_ntsubauth which is used -// for generating ntsubauth.h file -// - -// begin_ntsubauth -#define NEXT_FREE_ACCOUNT_CONTROL_BIT (USER_USE_AES_KEYS << 1) - -#define USER_MACHINE_ACCOUNT_MASK \ - ( USER_INTERDOMAIN_TRUST_ACCOUNT |\ - USER_WORKSTATION_TRUST_ACCOUNT |\ - USER_SERVER_TRUST_ACCOUNT) - -#define USER_ACCOUNT_TYPE_MASK \ - ( USER_TEMP_DUPLICATE_ACCOUNT |\ - USER_NORMAL_ACCOUNT |\ - USER_MACHINE_ACCOUNT_MASK ) - -#define USER_COMPUTED_ACCOUNT_CONTROL_BITS \ - (USER_ACCOUNT_AUTO_LOCKED | \ - USER_PASSWORD_EXPIRED ) - - - -// -// Logon times may be expressed in day, hour, or minute granularity. -// -// Days per week = 7 -// Hours per week = 168 -// Minutes per week = 10080 -// - -#define SAM_DAYS_PER_WEEK (7) -#define SAM_HOURS_PER_WEEK (24 * SAM_DAYS_PER_WEEK) -#define SAM_MINUTES_PER_WEEK (60 * SAM_HOURS_PER_WEEK) - -typedef struct _LOGON_HOURS { - - USHORT UnitsPerWeek; - - // - // UnitsPerWeek is the number of equal length time units the week is - // divided into. This value is used to compute the length of the bit - // string in logon_hours. Must be less than or equal to - // SAM_UNITS_PER_WEEK (10080) for this release. - // - // LogonHours is a bit map of valid logon times. Each bit represents - // a unique division in a week. The largest bit map supported is 1260 - // bytes (10080 bits), which represents minutes per week. In this case - // the first bit (bit 0, byte 0) is Sunday, 00:00:00 - 00-00:59; bit 1, - // byte 0 is Sunday, 00:01:00 - 00:01:59, etc. A NULL pointer means - // DONT_CHANGE for SamSetInformationUser() calls. - // - - PUCHAR LogonHours; - -} LOGON_HOURS, *PLOGON_HOURS; - -typedef struct _SR_SECURITY_DESCRIPTOR { - ULONG Length; - PUCHAR SecurityDescriptor; -} SR_SECURITY_DESCRIPTOR, *PSR_SECURITY_DESCRIPTOR; - -#define _NTSAM_USER_ACCOUNT_FLAG_ -#endif -// end_ntsubauth - -typedef enum _USER_INFORMATION_CLASS { - UserGeneralInformation = 1, - UserPreferencesInformation, - UserLogonInformation, - UserLogonHoursInformation, - UserAccountInformation, - UserNameInformation, - UserAccountNameInformation, - UserFullNameInformation, - UserPrimaryGroupInformation, - UserHomeInformation, - UserScriptInformation, - UserProfileInformation, - UserAdminCommentInformation, - UserWorkStationsInformation, - UserSetPasswordInformation, - UserControlInformation, - UserExpiresInformation, - UserInternal1Information, - UserInternal2Information, - UserParametersInformation, - UserAllInformation, - UserInternal3Information, - UserInternal4Information, - UserInternal5Information, - UserInternal4InformationNew, - UserInternal5InformationNew, - UserInternal6Information, - UserExtendedInformation, - UserLogonUIInformation, -} USER_INFORMATION_CLASS, *PUSER_INFORMATION_CLASS; - -// begin_ntsubauth -#ifndef _NTSAM_USER_ALL_INFO_ -#include "pshpack4.h" -typedef struct _USER_ALL_INFORMATION { - LARGE_INTEGER LastLogon; - LARGE_INTEGER LastLogoff; - LARGE_INTEGER PasswordLastSet; - LARGE_INTEGER AccountExpires; - LARGE_INTEGER PasswordCanChange; - LARGE_INTEGER PasswordMustChange; - UNICODE_STRING UserName; - UNICODE_STRING FullName; - UNICODE_STRING HomeDirectory; - UNICODE_STRING HomeDirectoryDrive; - UNICODE_STRING ScriptPath; - UNICODE_STRING ProfilePath; - UNICODE_STRING AdminComment; - UNICODE_STRING WorkStations; - UNICODE_STRING UserComment; - UNICODE_STRING Parameters; - UNICODE_STRING LmPassword; - UNICODE_STRING NtPassword; - UNICODE_STRING PrivateData; - SR_SECURITY_DESCRIPTOR SecurityDescriptor; - ULONG UserId; - ULONG PrimaryGroupId; - ULONG UserAccountControl; - ULONG WhichFields; - LOGON_HOURS LogonHours; - USHORT BadPasswordCount; - USHORT LogonCount; - USHORT CountryCode; - USHORT CodePage; - BOOLEAN LmPasswordPresent; - BOOLEAN NtPasswordPresent; - BOOLEAN PasswordExpired; - BOOLEAN PrivateDataSensitive; -} USER_ALL_INFORMATION, *PUSER_ALL_INFORMATION; -#include "poppack.h" -#define _NTSAM_USER_ALL_INFO_ -#endif -// end_ntsubauth - -// -// Bits to be used in UserAllInformation's WhichFields field (to indicate -// which items were queried or set). -// - -#define USER_ALL_USERNAME 0x00000001 -#define USER_ALL_FULLNAME 0x00000002 -#define USER_ALL_USERID 0x00000004 -#define USER_ALL_PRIMARYGROUPID 0x00000008 -#define USER_ALL_ADMINCOMMENT 0x00000010 -#define USER_ALL_USERCOMMENT 0x00000020 -#define USER_ALL_HOMEDIRECTORY 0x00000040 -#define USER_ALL_HOMEDIRECTORYDRIVE 0x00000080 -#define USER_ALL_SCRIPTPATH 0x00000100 -#define USER_ALL_PROFILEPATH 0x00000200 -#define USER_ALL_WORKSTATIONS 0x00000400 -#define USER_ALL_LASTLOGON 0x00000800 -#define USER_ALL_LASTLOGOFF 0x00001000 -#define USER_ALL_LOGONHOURS 0x00002000 -#define USER_ALL_BADPASSWORDCOUNT 0x00004000 -#define USER_ALL_LOGONCOUNT 0x00008000 -#define USER_ALL_PASSWORDCANCHANGE 0x00010000 -#define USER_ALL_PASSWORDMUSTCHANGE 0x00020000 -#define USER_ALL_PASSWORDLASTSET 0x00040000 -#define USER_ALL_ACCOUNTEXPIRES 0x00080000 -#define USER_ALL_USERACCOUNTCONTROL 0x00100000 -#ifndef _NTSAM_SAM_USER_PARMS_ // ntsubauth -#define USER_ALL_PARAMETERS 0x00200000 // ntsubauth -#define _NTSAM_SAM_USER_PARMS_ // ntsubauth -#endif // ntsubauth -#define USER_ALL_COUNTRYCODE 0x00400000 -#define USER_ALL_CODEPAGE 0x00800000 -#define USER_ALL_NTPASSWORDPRESENT 0x01000000 // field AND boolean -#define USER_ALL_LMPASSWORDPRESENT 0x02000000 // field AND boolean -#define USER_ALL_PRIVATEDATA 0x04000000 // field AND boolean -#define USER_ALL_PASSWORDEXPIRED 0x08000000 -#define USER_ALL_SECURITYDESCRIPTOR 0x10000000 -#define USER_ALL_OWFPASSWORD 0x20000000 // boolean - -#define USER_ALL_UNDEFINED_MASK 0xC0000000 - -// -// Now define masks for fields that are accessed for read by the same -// access type. -// -// Fields that require READ_GENERAL access to read. -// - -#define USER_ALL_READ_GENERAL_MASK (USER_ALL_USERNAME | \ - USER_ALL_FULLNAME | \ - USER_ALL_USERID | \ - USER_ALL_PRIMARYGROUPID | \ - USER_ALL_ADMINCOMMENT | \ - USER_ALL_USERCOMMENT) - -// -// Fields that require READ_LOGON access to read. -// - -#define USER_ALL_READ_LOGON_MASK (USER_ALL_HOMEDIRECTORY | \ - USER_ALL_HOMEDIRECTORYDRIVE | \ - USER_ALL_SCRIPTPATH | \ - USER_ALL_PROFILEPATH | \ - USER_ALL_WORKSTATIONS | \ - USER_ALL_LASTLOGON | \ - USER_ALL_LASTLOGOFF | \ - USER_ALL_LOGONHOURS | \ - USER_ALL_BADPASSWORDCOUNT | \ - USER_ALL_LOGONCOUNT | \ - USER_ALL_PASSWORDCANCHANGE | \ - USER_ALL_PASSWORDMUSTCHANGE) - -// -// Fields that require READ_ACCOUNT access to read. -// - -#define USER_ALL_READ_ACCOUNT_MASK (USER_ALL_PASSWORDLASTSET | \ - USER_ALL_ACCOUNTEXPIRES | \ - USER_ALL_USERACCOUNTCONTROL | \ - USER_ALL_PARAMETERS) - -// -// Fields that require READ_PREFERENCES access to read. -// - -#define USER_ALL_READ_PREFERENCES_MASK (USER_ALL_COUNTRYCODE | \ - USER_ALL_CODEPAGE) - -// -// Fields that can only be read by trusted clients. -// - -#define USER_ALL_READ_TRUSTED_MASK (USER_ALL_NTPASSWORDPRESENT | \ - USER_ALL_LMPASSWORDPRESENT | \ - USER_ALL_PASSWORDEXPIRED | \ - USER_ALL_SECURITYDESCRIPTOR | \ - USER_ALL_PRIVATEDATA) - -// -// Fields that can't be read. -// - -#define USER_ALL_READ_CANT_MASK USER_ALL_UNDEFINED_MASK - - -// -// Now define masks for fields that are accessed for write by the same -// access type. -// -// Fields that require WRITE_ACCOUNT access to write. -// - -#define USER_ALL_WRITE_ACCOUNT_MASK (USER_ALL_USERNAME | \ - USER_ALL_FULLNAME | \ - USER_ALL_PRIMARYGROUPID | \ - USER_ALL_HOMEDIRECTORY | \ - USER_ALL_HOMEDIRECTORYDRIVE | \ - USER_ALL_SCRIPTPATH | \ - USER_ALL_PROFILEPATH | \ - USER_ALL_ADMINCOMMENT | \ - USER_ALL_WORKSTATIONS | \ - USER_ALL_LOGONHOURS | \ - USER_ALL_ACCOUNTEXPIRES | \ - USER_ALL_USERACCOUNTCONTROL | \ - USER_ALL_PARAMETERS) - -// -// Fields that require WRITE_PREFERENCES access to write. -// - -#define USER_ALL_WRITE_PREFERENCES_MASK (USER_ALL_USERCOMMENT | \ - USER_ALL_COUNTRYCODE | \ - USER_ALL_CODEPAGE) - -// -// Fields that require FORCE_PASSWORD_CHANGE access to write. -// -// Note that non-trusted clients only set the NT password as a -// UNICODE string. The wrapper will convert it to an LM password, -// OWF and encrypt both versions. Trusted clients can pass in OWF -// versions of either or both. -// - -#define USER_ALL_WRITE_FORCE_PASSWORD_CHANGE_MASK \ - (USER_ALL_NTPASSWORDPRESENT | \ - USER_ALL_LMPASSWORDPRESENT | \ - USER_ALL_PASSWORDEXPIRED) - -// -// Fields that can only be written by trusted clients. -// - -#define USER_ALL_WRITE_TRUSTED_MASK (USER_ALL_LASTLOGON | \ - USER_ALL_LASTLOGOFF | \ - USER_ALL_BADPASSWORDCOUNT | \ - USER_ALL_LOGONCOUNT | \ - USER_ALL_PASSWORDLASTSET | \ - USER_ALL_SECURITYDESCRIPTOR | \ - USER_ALL_PRIVATEDATA) - -// -// Fields that can't be written. -// - -#define USER_ALL_WRITE_CANT_MASK (USER_ALL_USERID | \ - USER_ALL_PASSWORDCANCHANGE | \ - USER_ALL_PASSWORDMUSTCHANGE | \ - USER_ALL_UNDEFINED_MASK) - - -typedef struct _USER_GENERAL_INFORMATION { - UNICODE_STRING UserName; - UNICODE_STRING FullName; - ULONG PrimaryGroupId; - UNICODE_STRING AdminComment; - UNICODE_STRING UserComment; -} USER_GENERAL_INFORMATION, *PUSER_GENERAL_INFORMATION; - -typedef struct _USER_PREFERENCES_INFORMATION { - UNICODE_STRING UserComment; - UNICODE_STRING Reserved1; - USHORT CountryCode; - USHORT CodePage; -} USER_PREFERENCES_INFORMATION, *PUSER_PREFERENCES_INFORMATION; - -typedef struct _USER_PARAMETERS_INFORMATION { - UNICODE_STRING Parameters; -} USER_PARAMETERS_INFORMATION, *PUSER_PARAMETERS_INFORMATION; - -#include "pshpack4.h" -typedef struct _USER_LOGON_INFORMATION { - UNICODE_STRING UserName; - UNICODE_STRING FullName; - ULONG UserId; - ULONG PrimaryGroupId; - UNICODE_STRING HomeDirectory; - UNICODE_STRING HomeDirectoryDrive; - UNICODE_STRING ScriptPath; - UNICODE_STRING ProfilePath; - UNICODE_STRING WorkStations; - LARGE_INTEGER LastLogon; - LARGE_INTEGER LastLogoff; - LARGE_INTEGER PasswordLastSet; - LARGE_INTEGER PasswordCanChange; - LARGE_INTEGER PasswordMustChange; - LOGON_HOURS LogonHours; - USHORT BadPasswordCount; - USHORT LogonCount; - ULONG UserAccountControl; -} USER_LOGON_INFORMATION, *PUSER_LOGON_INFORMATION; -#include "poppack.h" - -#include "pshpack4.h" -typedef struct _USER_ACCOUNT_INFORMATION { - UNICODE_STRING UserName; - UNICODE_STRING FullName; - ULONG UserId; - ULONG PrimaryGroupId; - UNICODE_STRING HomeDirectory; - UNICODE_STRING HomeDirectoryDrive; - UNICODE_STRING ScriptPath; - UNICODE_STRING ProfilePath; - UNICODE_STRING AdminComment; - UNICODE_STRING WorkStations; - LARGE_INTEGER LastLogon; - LARGE_INTEGER LastLogoff; - LOGON_HOURS LogonHours; - USHORT BadPasswordCount; - USHORT LogonCount; - LARGE_INTEGER PasswordLastSet; - LARGE_INTEGER AccountExpires; - ULONG UserAccountControl; -} USER_ACCOUNT_INFORMATION, *PUSER_ACCOUNT_INFORMATION; -#include "poppack.h" - -typedef struct _USER_ACCOUNT_NAME_INFORMATION { - UNICODE_STRING UserName; -} USER_ACCOUNT_NAME_INFORMATION, *PUSER_ACCOUNT_NAME_INFORMATION; - -typedef struct _USER_FULL_NAME_INFORMATION { - UNICODE_STRING FullName; -} USER_FULL_NAME_INFORMATION, *PUSER_FULL_NAME_INFORMATION; - -typedef struct _USER_NAME_INFORMATION { - UNICODE_STRING UserName; - UNICODE_STRING FullName; -} USER_NAME_INFORMATION, *PUSER_NAME_INFORMATION; - -typedef struct _USER_PRIMARY_GROUP_INFORMATION { - ULONG PrimaryGroupId; -} USER_PRIMARY_GROUP_INFORMATION, *PUSER_PRIMARY_GROUP_INFORMATION; - -typedef struct _USER_HOME_INFORMATION { - UNICODE_STRING HomeDirectory; - UNICODE_STRING HomeDirectoryDrive; -} USER_HOME_INFORMATION, *PUSER_HOME_INFORMATION; - -typedef struct _USER_SCRIPT_INFORMATION { - UNICODE_STRING ScriptPath; -} USER_SCRIPT_INFORMATION, *PUSER_SCRIPT_INFORMATION; - -typedef struct _USER_PROFILE_INFORMATION { - UNICODE_STRING ProfilePath; -} USER_PROFILE_INFORMATION, *PUSER_PROFILE_INFORMATION; - -typedef struct _USER_ADMIN_COMMENT_INFORMATION { - UNICODE_STRING AdminComment; -} USER_ADMIN_COMMENT_INFORMATION, *PUSER_ADMIN_COMMENT_INFORMATION; - -typedef struct _USER_WORKSTATIONS_INFORMATION { - UNICODE_STRING WorkStations; -} USER_WORKSTATIONS_INFORMATION, *PUSER_WORKSTATIONS_INFORMATION; - -typedef struct _USER_SET_PASSWORD_INFORMATION { - UNICODE_STRING Password; - BOOLEAN PasswordExpired; -} USER_SET_PASSWORD_INFORMATION, *PUSER_SET_PASSWORD_INFORMATION; - -typedef struct _USER_CONTROL_INFORMATION { - ULONG UserAccountControl; -} USER_CONTROL_INFORMATION, *PUSER_CONTROL_INFORMATION; - -typedef struct _USER_EXPIRES_INFORMATION { -#if defined(MIDL_PASS) - OLD_LARGE_INTEGER AccountExpires; -#else - LARGE_INTEGER AccountExpires; -#endif -} USER_EXPIRES_INFORMATION, *PUSER_EXPIRES_INFORMATION; - -typedef struct _USER_LOGON_HOURS_INFORMATION { - LOGON_HOURS LogonHours; -} USER_LOGON_HOURS_INFORMATION, *PUSER_LOGON_HOURS_INFORMATION; - -typedef SAM_BYTE_ARRAY_32K SAM_USER_TILE, *PSAM_USER_TILE; - -// 0xFF000FFF is reserved for internal callers and implementation - -#define USER_EXTENDED_FIELD_USER_TILE (0x00001000L) -#define USER_EXTENDED_FIELD_PASSWORD_HINT (0x00002000L) -#define USER_EXTENDED_FIELD_DONT_SHOW_IN_LOGON_UI (0x00004000L) -#define USER_EXTENDED_FIELD_SHELL_ADMIN_OBJECT_PROPERTIES (0x00008000L) - -typedef struct _USER_EXTENDED_INFORMATION { - - ULONG ExtendedWhichFields; - SAM_USER_TILE UserTile; - UNICODE_STRING PasswordHint; - BOOLEAN DontShowInLogonUI; - SAM_SHELL_OBJECT_PROPERTIES ShellAdminObjectProperties; - -} USER_EXTENDED_INFORMATION, *PUSER_EXTENDED_INFORMATION; - -// For local callers only -typedef struct _USER_LOGON_UI_INFORMATION { - - BOOLEAN PasswordIsBlank; - BOOLEAN AccountIsDisabled; - -} USER_LOGON_UI_INFORMATION, *PUSER_LOGON_UI_INFORMATION; - -/////////////////////////////////////////////////////////////////////////// -// // -// Data type used by SamChangePasswordUser3 for better error // -// reporting of password change change failures // -// // -// The field definitions are as follows: // -// // -// ExtendedFailureReason -- Indicates the reason // -// why the new password was not // -// accepted // -// // -// FilterModuleName -- If the password change was failed // -// by a password filter , the name of // -// of the filter DLL is returned in // -// here // -// // -// The following error codes are defined // -// // -// SAM_PWD_CHANGE_NO_ERROR // -// No error, cannot be returned alongwith a failure code for // -// password change // -// // -// SAM_PWD_CHANGE_PASSWORD_TOO_SHORT // -// // -// Supplied password did not meet password length policy // -// // -// SAM_PWD_CHANGE_PWD_IN_HISTORY // -// // -// History restrictions were not met // -// // -// SAM_PWD_CHANGE_USERNAME_IN_PASSWORD // -// Complexity check could not be met because the user // -// name was part of the password // -// // -// SAM_PWD_CHANGE_FULLNAME_IN_PASSWORD // -// // -// Complexity check could not be met because the user's // -// full name was part of the password // -// // -// SAM_PWD_CHANGE_MACHINE_PASSWORD_NOT_DEFAULT // -// // -// The domain has the refuse password change setting // -// enabled. This disallows machine accounts from having // -// anything other than the default password // -// // -// SAM_PWD_CHANGE_FAILED_BY_FILTER // -// // -// The supplied new password failed by a password filter // -// the name of the filter DLL is indicated // -// // -// // -/////////////////////////////////////////////////////////////////////////// - -typedef struct _USER_PWD_CHANGE_FAILURE_INFORMATION { - ULONG ExtendedFailureReason; - UNICODE_STRING FilterModuleName; -} USER_PWD_CHANGE_FAILURE_INFORMATION,*PUSER_PWD_CHANGE_FAILURE_INFORMATION; - -// -// Currently defined values for ExtendedFailureReason are as follows -// - - -#define SAM_PWD_CHANGE_NO_ERROR 0 -#define SAM_PWD_CHANGE_PASSWORD_TOO_SHORT 1 -#define SAM_PWD_CHANGE_PWD_IN_HISTORY 2 -#define SAM_PWD_CHANGE_USERNAME_IN_PASSWORD 3 -#define SAM_PWD_CHANGE_FULLNAME_IN_PASSWORD 4 -#define SAM_PWD_CHANGE_NOT_COMPLEX 5 -#define SAM_PWD_CHANGE_MACHINE_PASSWORD_NOT_DEFAULT 6 -#define SAM_PWD_CHANGE_FAILED_BY_FILTER 7 -#define SAM_PWD_CHANGE_PASSWORD_TOO_LONG 8 -#define SAM_PWD_CHANGE_FAILURE_REASON_MAX 8 - - -///////////////////////////////////////////////////////////////////////////// -// // -// Data types used by SAM and Netlogon for database replication // -// // -///////////////////////////////////////////////////////////////////////////// - - -typedef enum _SECURITY_DB_DELTA_TYPE { - SecurityDbNew = 1, - SecurityDbRename, - SecurityDbDelete, - SecurityDbChangeMemberAdd, - SecurityDbChangeMemberSet, - SecurityDbChangeMemberDel, - SecurityDbChange, - SecurityDbChangePassword -} SECURITY_DB_DELTA_TYPE, *PSECURITY_DB_DELTA_TYPE; - -typedef enum _SECURITY_DB_OBJECT_TYPE { - SecurityDbObjectSamDomain = 1, - SecurityDbObjectSamUser, - SecurityDbObjectSamGroup, - SecurityDbObjectSamAlias, - SecurityDbObjectLsaPolicy, - SecurityDbObjectLsaTDomain, - SecurityDbObjectLsaAccount, - SecurityDbObjectLsaSecret -} SECURITY_DB_OBJECT_TYPE, *PSECURITY_DB_OBJECT_TYPE; - -// -// Account types -// -// Both enumerated types and flag definitions are provided. -// The flag definitions are used in places where more than -// one type of account may be specified together. -// - -typedef enum _SAM_ACCOUNT_TYPE { - SamObjectUser = 1, - SamObjectGroup , - SamObjectAlias -} SAM_ACCOUNT_TYPE, *PSAM_ACCOUNT_TYPE; - - -#define SAM_USER_ACCOUNT (0x00000001) -#define SAM_GLOBAL_GROUP_ACCOUNT (0x00000002) -#define SAM_LOCAL_GROUP_ACCOUNT (0x00000004) - - - -// -// Define the data type used to pass netlogon information on the account -// that was added or deleted from a group. -// - -typedef struct _SAM_GROUP_MEMBER_ID { - ULONG MemberRid; -} SAM_GROUP_MEMBER_ID, *PSAM_GROUP_MEMBER_ID; - - -// -// Define the data type used to pass netlogon information on the account -// that was added or deleted from an alias. -// - -typedef struct _SAM_ALIAS_MEMBER_ID { - PSID MemberSid; -} SAM_ALIAS_MEMBER_ID, *PSAM_ALIAS_MEMBER_ID; - - - - -// -// Define the data type used to pass netlogon information on a delta -// - -typedef union _SAM_DELTA_DATA { - - // - // Delta type ChangeMember{Add/Del/Set} and account type group - // - - SAM_GROUP_MEMBER_ID GroupMemberId; - - // - // Delta type ChangeMember{Add/Del/Set} and account type alias - // - - SAM_ALIAS_MEMBER_ID AliasMemberId; - - // - // Delta type AddOrChange and account type User - // - - ULONG AccountControl; - -} SAM_DELTA_DATA, *PSAM_DELTA_DATA; - - -// -// Prototype for delta notification routine. -// - -typedef NTSTATUS (*PSAM_DELTA_NOTIFICATION_ROUTINE) ( - __in PSID DomainSid, - __in SECURITY_DB_DELTA_TYPE DeltaType, - __in SECURITY_DB_OBJECT_TYPE ObjectType, - __in ULONG ObjectRid, - __in_opt PUNICODE_STRING ObjectName, - __in PLARGE_INTEGER ModifiedCount, - __in_opt PSAM_DELTA_DATA DeltaData - ); - -#define SAM_DELTA_NOTIFY_ROUTINE "DeltaNotify" - - -////////////////////////////////////////////////////////////////// -// // -// Structure and ProtoType for RAS User Parameters // -// // -////////////////////////////////////////////////////////////////// - -// Flags used by SAM UserParms Migration -// indicate UserParmsConvert is called during upgrade. - -#define SAM_USERPARMS_DURING_UPGRADE 0x00000001 - - -typedef struct _SAM_USERPARMS_ATTRVALS { - ULONG length; // length of the attribute. - __field_bcount(length) PVOID value; // pointer to the value. -} SAM_USERPARMS_ATTRVALS, *PSAM_USERPARMS_ATTRVALS; // describes one value of the attribute. - - -typedef enum _SAM_USERPARMS_ATTRSYNTAX { - Syntax_Attribute = 1, - Syntax_EncryptedAttribute -} SAM_USERPARMS_ATTRSYNTAX; // indicates whether attributes are encrypted or not. - - -typedef struct _SAM_USERPARMS_ATTR { - UNICODE_STRING AttributeIdentifier; // This will be the LDAP display name of the attribute. - // SAM will perform the translation to attribute ID. - // unless the specified syntax is type EncryptedAttribute, - // in which case it is packaged as part of supplemental - // credentials blob and the name identifes the package name. - // Encrypted attribute will be supplied in the clear ie decrypted. - SAM_USERPARMS_ATTRSYNTAX Syntax; - ULONG CountOfValues; // The count of values in the attribute. - __ecount(CountOfValues) SAM_USERPARMS_ATTRVALS * Values; - // pointer to an array of values representing the data - // values of the attribute. -} SAM_USERPARMS_ATTR, *PSAM_USERPARMS_ATTR; // describes an attribute and the set of values associated with it. - - -typedef struct _SAM_USERPARMS_ATTRBLOCK { - ULONG attCount; - __ecount(attCount) SAM_USERPARMS_ATTR * UserParmsAttr; -} SAM_USERPARMS_ATTRBLOCK, *PSAM_USERPARMS_ATTRBLOCK; // describes an array of attributes - - -typedef NTSTATUS (*PSAM_USERPARMS_CONVERT_NOTIFICATION_ROUTINE) ( - __in ULONG Flags, - __in PSID DomainSid, - __in ULONG ObjectRid, // identifies the object - __in ULONG UserParmsLengthOrig, - __in_bcount(UserParmsLengthOrig) PVOID UserParmsOrig, - __in ULONG UserParmsLengthNew, - __in_bcount(UserParmsLengthNew) PVOID UserParmsNew, - __deref_out PSAM_USERPARMS_ATTRBLOCK * UserParmsAttrBlock -); - -#define SAM_USERPARMS_CONVERT_NOTIFICATION_ROUTINE "UserParmsConvert" - - -typedef VOID (*PSAM_USERPARMS_ATTRBLOCK_FREE_ROUTINE) ( - IN PSAM_USERPARMS_ATTRBLOCK UserParmsAttrBlock -); - -#define SAM_USERPARMS_ATTRBLOCK_FREE_ROUTINE "UserParmsFree" - - -////////////////////////////////////////////////////////////////// -// // -// Return Values for Compatiblity Mode // -// // -////////////////////////////////////////////////////////////////// - -// All SAM attributes are accessible -#define SAM_SID_COMPATIBILITY_ALL 0 - -// Rid field can be returned to caller as 0 -// No writes to PrimaryGroupId allowed -#define SAM_SID_COMPATIBILITY_LAX 1 - -// NET API Information levels that ask for RID are to failed -// No writes to PrimaryGroupId allowed -#define SAM_SID_COMPATIBILITY_STRICT 2 - - -// -// ************************************* -// -// Internal Password Checking API structures -// -// ************************************* -// - -// -// What kind of password checking is to be performed? -// SamValidateAuthentication : Check if the authentication can be done -// SamValidatePasswordChange: Check if the password can be changed -// SamValidatePasswordReset: Reset the password to the given value -// -typedef enum _PASSWORD_POLICY_VALIDATION_TYPE{ - SamValidateAuthentication = 1, - SamValidatePasswordChange, - SamValidatePasswordReset -} PASSWORD_POLICY_VALIDATION_TYPE; - -// -// Structure to keep the password hash -// -typedef struct _SAM_VALIDATE_PASSWORD_HASH{ - ULONG Length; -#ifdef MIDL_PASS - [unique,size_is(Length)] -#endif - PUCHAR Hash; -} SAM_VALIDATE_PASSWORD_HASH, *PSAM_VALIDATE_PASSWORD_HASH; - - -// To be used with PresentFields member of SAM_VALIDATE_PERSISTED_FIELDS -#define SAM_VALIDATE_PASSWORD_LAST_SET 0x00000001 -#define SAM_VALIDATE_BAD_PASSWORD_TIME 0x00000002 -#define SAM_VALIDATE_LOCKOUT_TIME 0x00000004 -#define SAM_VALIDATE_BAD_PASSWORD_COUNT 0x00000008 -#define SAM_VALIDATE_PASSWORD_HISTORY_LENGTH 0x00000010 -#define SAM_VALIDATE_PASSWORD_HISTORY 0x00000020 - -// -// Structure to keep information about the password and related things. -// Present Fields: (used only in output args) which fields are changed. -// See the constants above. -// PasswordLastSet: When the password is last set. -// BadPasswordTime: When the password was incorrect for the last time. -// LockoutTime: When the account is locked out. If the account is not locked out -// it is 0. -// BadPasswordCount: How many times the password has given incorrectly in the -// Observation Window. -// PasswordHistoryLength: How many passwords are kept in the history -// PasswordHistory: Password hashes that are in the history -// -typedef struct _SAM_VALIDATE_PERSISTED_FIELDS{ - ULONG PresentFields; - LARGE_INTEGER PasswordLastSet; - LARGE_INTEGER BadPasswordTime; - LARGE_INTEGER LockoutTime; - ULONG BadPasswordCount; - ULONG PasswordHistoryLength; -#ifdef MIDL_PASS - [unique,size_is(PasswordHistoryLength)] -#endif - PSAM_VALIDATE_PASSWORD_HASH PasswordHistory; -} SAM_VALIDATE_PERSISTED_FIELDS, *PSAM_VALIDATE_PERSISTED_FIELDS; - -// -// Validation Status of the password check: -// Names are self-explaining so I think there is no need to explain them here. -// -typedef enum _SAM_VALIDATE_VALIDATION_STATUS{ - SamValidateSuccess = 0, - SamValidatePasswordMustChange, - SamValidateAccountLockedOut, - SamValidatePasswordExpired, - SamValidatePasswordIncorrect, - SamValidatePasswordIsInHistory, - SamValidatePasswordTooShort, - SamValidatePasswordTooLong, - SamValidatePasswordNotComplexEnough, - SamValidatePasswordTooRecent, - SamValidatePasswordFilterError -}SAM_VALIDATE_VALIDATION_STATUS, *PSAM_VALIDATE_VALIDATION_STATUS; - -// -// Output Arg -// ChangedPersistedFields: Any changes to the password related info -// ValidationStatus: Shows the result of the request -// -typedef struct _SAM_VALIDATE_STANDARD_OUTPUT_ARG{ - SAM_VALIDATE_PERSISTED_FIELDS ChangedPersistedFields; - SAM_VALIDATE_VALIDATION_STATUS ValidationStatus; -} SAM_VALIDATE_STANDARD_OUTPUT_ARG, *PSAM_VALIDATE_STANDARD_OUTPUT_ARG; - -// -// If authentication type of password check is to be made, -// this kind of input must be used -// -// InputPersistedFields: Information about the account to be logged into -// PasswordMatched: Indicates the result of the application's authentication of the supplied password - -typedef struct _SAM_VALIDATE_AUTHENTICATION_INPUT_ARG{ - SAM_VALIDATE_PERSISTED_FIELDS InputPersistedFields; - BOOLEAN PasswordMatched; // indicates the result of the application's authentication of the supplied password -} SAM_VALIDATE_AUTHENTICATION_INPUT_ARG, *PSAM_VALIDATE_AUTHENTICATION_INPUT_ARG; - -// -// If password change type of check is to be made, -// this kind of input must be used -// -// InputPersistedFields: Information about the account to be logged into -// ClearPassword: The string which password is going to be -// UserAccountName: Name of the user account -// HashedPassword: Hash of the string that the password is going to be -// PasswordMatch: denotes if the old password supplied by user matched or not -// -typedef struct _SAM_VALIDATE_PASSWORD_CHANGE_INPUT_ARG{ - SAM_VALIDATE_PERSISTED_FIELDS InputPersistedFields; - UNICODE_STRING ClearPassword; - UNICODE_STRING UserAccountName; - SAM_VALIDATE_PASSWORD_HASH HashedPassword; - BOOLEAN PasswordMatch; // denotes if the old password supplied by user matched or not. -} SAM_VALIDATE_PASSWORD_CHANGE_INPUT_ARG, *PSAM_VALIDATE_PASSWORD_CHANGE_INPUT_ARG; - -// -// If password reset type of check is to be made, -// this kind of input must be used -// -// InputPersistedFields: Information about the account to be logged into -// ClearPassword: The string which password is going to be -// UserAccountName: Name of the user account -// HashedPassword: Hash of the string that the password is going to be -// PasswordMustChangeAtNextLogon: Password must change for the user to be logged in -// ClearLockout: If the account was locked out, this field can be used to clear lockout -// -typedef struct _SAM_VALIDATE_PASSWORD_RESET_INPUT_ARG{ - SAM_VALIDATE_PERSISTED_FIELDS InputPersistedFields; - UNICODE_STRING ClearPassword; - UNICODE_STRING UserAccountName; - SAM_VALIDATE_PASSWORD_HASH HashedPassword; - BOOLEAN PasswordMustChangeAtNextLogon; // looked at only for password reset - BOOLEAN ClearLockout; // can be used clear user account lockout -- -}SAM_VALIDATE_PASSWORD_RESET_INPUT_ARG, *PSAM_VALIDATE_PASSWORD_RESET_INPUT_ARG; - - -// -// A union to encapsulate all kinds of inputs -// -typedef -#ifdef MIDL_PASS - [switch_type(PASSWORD_POLICY_VALIDATION_TYPE)] -#endif - union _SAM_VALIDATE_INPUT_ARG{ -#ifdef MIDL_PASS - [case(SamValidateAuthentication)] -#endif - SAM_VALIDATE_AUTHENTICATION_INPUT_ARG ValidateAuthenticationInput; -#ifdef MIDL_PASS - [case(SamValidatePasswordChange)] -#endif - SAM_VALIDATE_PASSWORD_CHANGE_INPUT_ARG ValidatePasswordChangeInput; -#ifdef MIDL_PASS - [case(SamValidatePasswordReset)] -#endif - SAM_VALIDATE_PASSWORD_RESET_INPUT_ARG ValidatePasswordResetInput; -} SAM_VALIDATE_INPUT_ARG, *PSAM_VALIDATE_INPUT_ARG; - -// -// A union to encapsulate all kinds of outputs -// Actually, currently there is only one type of output, -// but this can be used when there is a need for another -// type of output. -// -typedef -#ifdef MIDL_PASS - [switch_type(PASSWORD_POLICY_VALIDATION_TYPE)] -#endif - union _SAM_VALIDATE_OUTPUT_ARG{ -#ifdef MIDL_PASS - [case(SamValidateAuthentication)] -#endif - SAM_VALIDATE_STANDARD_OUTPUT_ARG ValidateAuthenticationOutput; -#ifdef MIDL_PASS - [case(SamValidatePasswordChange)] -#endif - SAM_VALIDATE_STANDARD_OUTPUT_ARG ValidatePasswordChangeOutput; -#ifdef MIDL_PASS - [case(SamValidatePasswordReset)] -#endif - SAM_VALIDATE_STANDARD_OUTPUT_ARG ValidatePasswordResetOutput; -} SAM_VALIDATE_OUTPUT_ARG, *PSAM_VALIDATE_OUTPUT_ARG; - -// -// Internal Password Checking API structures end here! -// - -// -// Generic operation API structures start here -// - -typedef enum _SAM_GENERIC_OPERATION_TYPE { - - SamObjectChangeNotificationOperation, - -} SAM_GENERIC_OPERATION_TYPE, *PSAM_GENERIC_OPERATION_TYPE; - -typedef struct _SAM_OPERATION_OBJCHG_INPUT { - - BOOLEAN Register; - ULONG64 EventHandle; - SECURITY_DB_OBJECT_TYPE ObjectType; - ULONG ProcessID; - -} SAM_OPERATION_OBJCHG_INPUT, *PSAM_OPERATION_OBJCHG_INPUT; - -typedef struct _SAM_OPERATION_OBJCHG_OUTPUT { - - ULONG Reserved; - -} SAM_OPERATION_OBJCHG_OUTPUT, *PSAM_OPERATION_OBJCHG_OUTPUT; - -typedef SWITCH_TYPE( SAM_GENERIC_OPERATION_TYPE ) union _SAM_GENERIC_OPERATION_INPUT { - - CASE( SamObjectChangeNotificationOperation ) SAM_OPERATION_OBJCHG_INPUT ObjChangeIn; - -} SAM_GENERIC_OPERATION_INPUT, *PSAM_GENERIC_OPERATION_INPUT; - -typedef SWITCH_TYPE( SAM_GENERIC_OPERATION_TYPE ) union _SAM_GENERIC_OPERATION_OUTPUT { - - CASE( SamObjectChangeNotificationOperation ) SAM_OPERATION_OBJCHG_OUTPUT ObjChangeOut; - -} SAM_GENERIC_OPERATION_OUTPUT, *PSAM_GENERIC_OPERATION_OUTPUT; - -// -// Generic operation API structures end here -// - - -/////////////////////////////////////////////////////////////////////////////// -// // -// APIs Exported By SAM // -// // -/////////////////////////////////////////////////////////////////////////////// - - -NTSTATUS -SamFreeMemory( - __in PVOID Buffer - ); - - -__checkReturn -NTSTATUS -SamSetSecurityObject( - __in SAM_HANDLE ObjectHandle, - __in SECURITY_INFORMATION SecurityInformation, - __in PSECURITY_DESCRIPTOR SecurityDescriptor - ); - -__checkReturn -NTSTATUS -SamQuerySecurityObject( - __in SAM_HANDLE ObjectHandle, - __in SECURITY_INFORMATION SecurityInformation, - __deref_out PSECURITY_DESCRIPTOR *SecurityDescriptor - ); - -NTSTATUS -SamCloseHandle( - __in SAM_HANDLE SamHandle - ); - -__checkReturn -NTSTATUS -SamConnect( - __in_opt PUNICODE_STRING ServerName, - __out PSAM_HANDLE ServerHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes - ); - -__checkReturn -NTSTATUS -SamShutdownSamServer( - __in SAM_HANDLE ServerHandle - ); - -__checkReturn -NTSTATUS -SamLookupDomainInSamServer( - __in SAM_HANDLE ServerHandle, - __in PUNICODE_STRING Name, - __deref_out PSID * DomainId - ); - -__checkReturn -NTSTATUS -SamEnumerateDomainsInSamServer( - __in SAM_HANDLE ServerHandle, - __inout PSAM_ENUMERATE_HANDLE EnumerationContext, - __deref_out PVOID *Buffer, - __in ULONG PreferedMaximumLength, - __out PULONG CountReturned - ); - -__checkReturn -NTSTATUS -SamOpenDomain( - __in SAM_HANDLE ServerHandle, - __in ACCESS_MASK DesiredAccess, - __in PSID DomainId, - __out PSAM_HANDLE DomainHandle - ); - -__checkReturn -NTSTATUS -SamQueryInformationDomain( - __in SAM_HANDLE DomainHandle, - __in DOMAIN_INFORMATION_CLASS DomainInformationClass, - __deref_out PVOID *Buffer - ); - -__checkReturn -NTSTATUS -SamSetInformationDomain( - __in SAM_HANDLE DomainHandle, - __in DOMAIN_INFORMATION_CLASS DomainInformationClass, - __in PVOID DomainInformation - ); - -__checkReturn -NTSTATUS -SamCreateGroupInDomain( - __in SAM_HANDLE DomainHandle, - __in PUNICODE_STRING AccountName, - __in ACCESS_MASK DesiredAccess, - __out PSAM_HANDLE GroupHandle, - __out PULONG RelativeId - ); - - -__checkReturn -NTSTATUS -SamEnumerateGroupsInDomain( - __in SAM_HANDLE DomainHandle, - __inout PSAM_ENUMERATE_HANDLE EnumerationContext, - __deref_out PVOID *Buffer, - __in ULONG PreferedMaximumLength, - __out PULONG CountReturned - ); - -__checkReturn -NTSTATUS -SamCreateUser2InDomain( - __in SAM_HANDLE DomainHandle, - __in PUNICODE_STRING AccountName, - __in ULONG AccountType, - __in ACCESS_MASK DesiredAccess, - __out PSAM_HANDLE UserHandle, - __out PULONG GrantedAccess, - __out PULONG RelativeId - ); - -__checkReturn -NTSTATUS -SamCreateUserInDomain( - __in SAM_HANDLE DomainHandle, - __in PUNICODE_STRING AccountName, - __in ACCESS_MASK DesiredAccess, - __out PSAM_HANDLE UserHandle, - __out PULONG RelativeId - ); - -__checkReturn -NTSTATUS -SamEnumerateUsersInDomain( - __in SAM_HANDLE DomainHandle, - __inout PSAM_ENUMERATE_HANDLE EnumerationContext, - __in ULONG UserAccountControl, - __deref_out PVOID *Buffer, - __in ULONG PreferedMaximumLength, - __out PULONG CountReturned - ); - -__checkReturn -NTSTATUS -SamCreateAliasInDomain( - __in SAM_HANDLE DomainHandle, - __in PUNICODE_STRING AccountName, - __in ACCESS_MASK DesiredAccess, - __out PSAM_HANDLE AliasHandle, - __out PULONG RelativeId - ); - -__checkReturn -NTSTATUS -SamEnumerateAliasesInDomain( - __in SAM_HANDLE DomainHandle, - __inout PSAM_ENUMERATE_HANDLE EnumerationContext, - __deref_out PVOID *Buffer, - __in ULONG PreferedMaximumLength, - __out PULONG CountReturned - ); - -__checkReturn -NTSTATUS -SamGetAliasMembership( - __in SAM_HANDLE DomainHandle, - __in ULONG PassedCount, - __in_ecount(PassedCount) PSID *Sids, - __out PULONG MembershipCount, - __deref_out_ecount(*MembershipCount) PULONG *Aliases - ); - -__checkReturn -NTSTATUS -SamLookupNamesInDomain( - __in SAM_HANDLE DomainHandle, - __in ULONG Count, - __in_ecount(Count) PUNICODE_STRING Names, - __deref_out_ecount(Count) PULONG *RelativeIds, - __deref_out_ecount(Count) PSID_NAME_USE *Use - ); - -__checkReturn -NTSTATUS -SamLookupIdsInDomain( - __in SAM_HANDLE DomainHandle, - __in ULONG Count, - __in_ecount(Count) PULONG RelativeIds, - __deref_out_ecount(Count) PUNICODE_STRING *Names, - __deref_opt_out_ecount(Count) PSID_NAME_USE *Use - ); - -__checkReturn -NTSTATUS -SamOpenGroup( - __in SAM_HANDLE DomainHandle, - __in ACCESS_MASK DesiredAccess, - __in ULONG GroupId, - __out PSAM_HANDLE GroupHandle - ); - -__checkReturn -NTSTATUS -SamQueryInformationGroup( - __in SAM_HANDLE GroupHandle, - __in GROUP_INFORMATION_CLASS GroupInformationClass, - __deref_out PVOID *Buffer - ); - -__checkReturn -NTSTATUS -SamSetInformationGroup( - __in SAM_HANDLE GroupHandle, - __in GROUP_INFORMATION_CLASS GroupInformationClass, - __in PVOID Buffer - ); - -__checkReturn -NTSTATUS -SamAddMemberToGroup( - __in SAM_HANDLE GroupHandle, - __in ULONG MemberId, - __in ULONG Attributes - ); - -__checkReturn -NTSTATUS -SamDeleteGroup( - __in SAM_HANDLE GroupHandle - ); - -__checkReturn -NTSTATUS -SamRemoveMemberFromGroup( - __in SAM_HANDLE GroupHandle, - __in ULONG MemberId - ); - -__checkReturn -NTSTATUS -SamGetMembersInGroup( - __in SAM_HANDLE GroupHandle, - __deref_out_ecount(*MemberCount) PULONG * MemberIds, - __deref_out_ecount(*MemberCount) PULONG * Attributes, - __out PULONG MemberCount - ); - -__checkReturn -NTSTATUS -SamSetMemberAttributesOfGroup( - __in SAM_HANDLE GroupHandle, - __in ULONG MemberId, - __in ULONG Attributes - ); - -__checkReturn -NTSTATUS -SamOpenAlias( - __in SAM_HANDLE DomainHandle, - __in ACCESS_MASK DesiredAccess, - __in ULONG AliasId, - __out PSAM_HANDLE AliasHandle - ); - -__checkReturn -NTSTATUS -SamQueryInformationAlias( - __in SAM_HANDLE AliasHandle, - __in ALIAS_INFORMATION_CLASS AliasInformationClass, - __deref_out PVOID *Buffer - ); - -__checkReturn -NTSTATUS -SamSetInformationAlias( - __in SAM_HANDLE AliasHandle, - __in ALIAS_INFORMATION_CLASS AliasInformationClass, - __in PVOID Buffer - ); - -__checkReturn -NTSTATUS -SamDeleteAlias( - __in SAM_HANDLE AliasHandle - ); - -__checkReturn -NTSTATUS -SamAddMemberToAlias( - __in SAM_HANDLE AliasHandle, - __in PSID MemberId - ); - -__checkReturn -NTSTATUS -SamAddMultipleMembersToAlias( - __in SAM_HANDLE AliasHandle, - __in_ecount(MemberCount) PSID *MemberIds, - __in ULONG MemberCount - ); - -__checkReturn -NTSTATUS -SamRemoveMemberFromAlias( - __in SAM_HANDLE AliasHandle, - __in PSID MemberId - ); - -__checkReturn -NTSTATUS -SamRemoveMultipleMembersFromAlias( - __in SAM_HANDLE AliasHandle, - __in_ecount(MemberCount) PSID *MemberIds, - __in ULONG MemberCount - ); - -__checkReturn -NTSTATUS -SamRemoveMemberFromForeignDomain( - __in SAM_HANDLE DomainHandle, - __in PSID MemberId - ); - -__checkReturn -NTSTATUS -SamGetMembersInAlias( - __in SAM_HANDLE AliasHandle, - __deref_out_ecount(*MemberCount) PSID **MemberIds, - __out PULONG MemberCount - ); - -__checkReturn -NTSTATUS -SamOpenUser( - __in SAM_HANDLE DomainHandle, - __in ACCESS_MASK DesiredAccess, - __in ULONG UserId, - __out PSAM_HANDLE UserHandle - ); - -__checkReturn -NTSTATUS -SamDeleteUser( - __in SAM_HANDLE UserHandle - ); - -__checkReturn -NTSTATUS -SamQueryInformationUser( - __in SAM_HANDLE UserHandle, - __in USER_INFORMATION_CLASS UserInformationClass, - __deref_out PVOID * Buffer - ); - -__checkReturn -NTSTATUS -SamSetInformationUser( - __in SAM_HANDLE UserHandle, - __in USER_INFORMATION_CLASS UserInformationClass, - __in PVOID Buffer - ); - -__checkReturn -NTSTATUS -SamChangePasswordUser( - __in SAM_HANDLE UserHandle, - __in PUNICODE_STRING OldPassword, - __in PUNICODE_STRING NewPassword - ); - -__checkReturn -NTSTATUS -SamChangePasswordUser2( - __in PUNICODE_STRING ServerName, - __in PUNICODE_STRING UserName, - __in PUNICODE_STRING OldPassword, - __in PUNICODE_STRING NewPassword - ); - - -__checkReturn -NTSTATUS -SamChangePasswordUser3( - __in PUNICODE_STRING ServerName, - __in PUNICODE_STRING UserName, - __in PUNICODE_STRING OldPassword, - __in PUNICODE_STRING NewPassword, - __deref_out PDOMAIN_PASSWORD_INFORMATION * EffectivePasswordPolicy, - __deref_out PUSER_PWD_CHANGE_FAILURE_INFORMATION *PasswordChangeFailureInfo - ); - - -__checkReturn -NTSTATUS -SamGetGroupsForUser( - __in SAM_HANDLE UserHandle, - __deref_out_ecount(*MembershipCount) PGROUP_MEMBERSHIP * Groups, - __out PULONG MembershipCount - ); - -__checkReturn -NTSTATUS -SamQueryDisplayInformation ( - __in SAM_HANDLE DomainHandle, - __in DOMAIN_DISPLAY_INFORMATION DisplayInformation, - __in ULONG Index, - __in ULONG EntryCount, - __in ULONG PreferredMaximumLength, - __in PULONG TotalAvailable, - __out PULONG TotalReturned, - __out PULONG ReturnedEntryCount, - __deref_out PVOID *SortedBuffer - ); - -__checkReturn -NTSTATUS -SamGetDisplayEnumerationIndex ( - __in SAM_HANDLE DomainHandle, - __in DOMAIN_DISPLAY_INFORMATION DisplayInformation, - __in PUNICODE_STRING Prefix, - __out PULONG Index - ); - -__checkReturn -NTSTATUS -SamRidToSid( - __in SAM_HANDLE ObjectHandle, - __in ULONG Rid, - __deref_out PSID* Sid - ); - -__checkReturn -NTSTATUS -SamGetCompatibilityMode( - __in SAM_HANDLE ObjectHandle, - __out ULONG* Mode - ); - -__checkReturn -NTSTATUS -SamValidatePassword( - __in_opt PUNICODE_STRING ServerName, - __in PASSWORD_POLICY_VALIDATION_TYPE ValidationType, - __in PSAM_VALIDATE_INPUT_ARG InputArg, - __out PSAM_VALIDATE_OUTPUT_ARG *OutputArg - ); - -__checkReturn -NTSTATUS -SamQueryLocalizableAccountsInDomain( - __in SAM_HANDLE Domain, - __in ULONG Flags, - __in ULONG LanguageId, - __in DOMAIN_LOCALIZABLE_ACCOUNTS_INFORMATION Class, - __deref_out PVOID *Buffer - ); - -__checkReturn -NTSTATUS -SamRegisterObjectChangeNotification( - __in SECURITY_DB_OBJECT_TYPE ObjectType, - __in HANDLE NotificationEventHandle - ); - -NTSTATUS -SamUnregisterObjectChangeNotification( - __in SECURITY_DB_OBJECT_TYPE ObjectType, - __in HANDLE NotificationEventHandle - ); - -__checkReturn -NTSTATUS -SamPerformGenericOperation( - __in_opt PWSTR ServerName, - __in SAM_GENERIC_OPERATION_TYPE OperationType, - __in PSAM_GENERIC_OPERATION_INPUT OperationIn, - __out PSAM_GENERIC_OPERATION_OUTPUT *OperationOut - ); - - -//////////////////////////////////////////////////////////////////////////// -// // -// Interface definitions of services provided by a password filter DLL // -// // -//////////////////////////////////////////////////////////////////////////// - - - - -// -// Routine names -// -// The routines provided by the DLL must be assigned the following names -// so that their addresses can be retrieved when the DLL is loaded. -// - - -// -// routine templates -// - - -// -// These guards are in place to allow ntsam.h and ntsecapi.h -// to be included in the same file. -// - -// begin_ntsecapi - -#ifndef _PASSWORD_NOTIFICATION_DEFINED -#define _PASSWORD_NOTIFICATION_DEFINED -typedef NTSTATUS (*PSAM_PASSWORD_NOTIFICATION_ROUTINE) ( - PUNICODE_STRING UserName, - ULONG RelativeId, - PUNICODE_STRING NewPassword -); - -#define SAM_PASSWORD_CHANGE_NOTIFY_ROUTINE "PasswordChangeNotify" - -typedef BOOLEAN (*PSAM_INIT_NOTIFICATION_ROUTINE) ( -); - -#define SAM_INIT_NOTIFICATION_ROUTINE "InitializeChangeNotify" - -#define SAM_PASSWORD_FILTER_ROUTINE "PasswordFilter" - -typedef BOOLEAN (*PSAM_PASSWORD_FILTER_ROUTINE) ( - __in PUNICODE_STRING AccountName, - __in PUNICODE_STRING FullName, - __in PUNICODE_STRING Password, - __in BOOLEAN SetOperation - ); - - -#endif // _PASSWORD_NOTIFICATION_DEFINED - -// end_ntsecapi - -// begin_ntsecpkg - -#ifndef _SAM_CREDENTIAL_UPDATE_DEFINED -#define _SAM_CREDENTIAL_UPDATE_DEFINED - -typedef NTSTATUS (*PSAM_CREDENTIAL_UPDATE_NOTIFY_ROUTINE) ( - __in PUNICODE_STRING ClearPassword, - __in_bcount(OldCredentialSize) PVOID OldCredentials, - __in ULONG OldCredentialSize, - __in ULONG UserAccountControl, - __in_opt PUNICODE_STRING UPN, - __in PUNICODE_STRING UserName, - __in PUNICODE_STRING NetbiosDomainName, - __in PUNICODE_STRING DnsDomainName, - __deref_out_bcount(*NewCredentialSize) PVOID * NewCredentials, - __out ULONG * NewCredentialSize - ); - -#define SAM_CREDENTIAL_UPDATE_NOTIFY_ROUTINE "CredentialUpdateNotify" - -typedef BOOLEAN (*PSAM_CREDENTIAL_UPDATE_REGISTER_ROUTINE) ( - __out PUNICODE_STRING CredentialName - ); - -#define SAM_CREDENTIAL_UPDATE_REGISTER_ROUTINE "CredentialUpdateRegister" - -typedef VOID (*PSAM_CREDENTIAL_UPDATE_FREE_ROUTINE) ( - __in PVOID p - ); - -#define SAM_CREDENTIAL_UPDATE_FREE_ROUTINE "CredentialUpdateFree" - -typedef struct { - PSTR Original; - PSTR Mapped; - BOOLEAN Continuable; // only honored for some operations -} SAM_REGISTER_MAPPING_ELEMENT, *PSAM_REGISTER_MAPPING_ELEMENT; - -typedef struct { - ULONG Count; - __ecount(Count) PSAM_REGISTER_MAPPING_ELEMENT Elements; -} SAM_REGISTER_MAPPING_LIST, *PSAM_REGISTER_MAPPING_LIST; - -typedef struct { - ULONG Count; - __ecount(Count) PSAM_REGISTER_MAPPING_LIST Lists; -} SAM_REGISTER_MAPPING_TABLE, *PSAM_REGISTER_MAPPING_TABLE; - -typedef NTSTATUS (*PSAM_CREDENTIAL_UPDATE_REGISTER_MAPPED_ENTRYPOINTS_ROUTINE) ( - __out SAM_REGISTER_MAPPING_TABLE *Table - ); - -#define SAM_CREDENTIAL_UPDATE_REGISTER_MAPPED_ENTRYPOINTS_ROUTINE "RegisterMappedEntrypoints" - -#endif // _SAM_CREDENTIAL_UPDATE_DEFINED - -// end_ntsecpkg - -#undef SIZE_IS -#undef SWITCH_IS -#undef SWITCH_TYPE -#undef CASE -#undef VAR_SIZE_ARRAY -#undef RANGE - -#ifdef __cplusplus -} -#endif - -#endif // _NTSAM_ - diff --git a/pub/ddk/ntstrsafe.h b/pub/ddk/ntstrsafe.h deleted file mode 100644 index 1e84af3..0000000 --- a/pub/ddk/ntstrsafe.h +++ /dev/null @@ -1,12594 +0,0 @@ -/****************************************************************** -* * -* ntstrsafe.h -- This module defines safer C library string * -* routine replacements for drivers. These are * -* meant to make C a bit more safe in reference * -* to security and robustness. A similar file, * -* strsafe.h, is available for applications. * -* * -* Copyright (c) Microsoft Corp. All rights reserved. * -* * -******************************************************************/ -#ifndef _NTSTRSAFE_H_INCLUDED_ -#define _NTSTRSAFE_H_INCLUDED_ -#if (_MSC_VER > 1000) -#pragma once -#endif - - -#include // for _vsnprintf, _vsnwprintf, getc, getwc -#include // for memset -#include // for va_start, etc. -#include // for __in, etc. - -#ifndef NTSTRSAFE_NO_UNICODE_STRING_FUNCTIONS -#include // for UNICODE_STRING, etc. -#endif - -#if !defined(_W64) -#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && (_MSC_VER >= 1300) -#define _W64 __w64 -#else -#define _W64 -#endif -#endif - -#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64) -#define ALIGNMENT_MACHINE -#define UNALIGNED __unaligned -#if defined(_WIN64) -#define UNALIGNED64 __unaligned -#else -#define UNALIGNED64 -#endif -#else -#undef ALIGNMENT_MACHINE -#define UNALIGNED -#define UNALIGNED64 -#endif - -// typedefs -#ifdef _WIN64 -typedef unsigned __int64 size_t; -#else -typedef _W64 unsigned int size_t; -#endif - -#ifndef _NTSTATUS_DEFINED -#define _NTSTATUS_DEFINED -typedef __success(return >= 0) long NTSTATUS; -#endif - -typedef unsigned long DWORD; - - -#ifndef SORTPP_PASS -// compiletime asserts (failure results in error C2118: negative subscript) -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#else -#define C_ASSERT(e) -#endif - -#ifdef __cplusplus -#define EXTERN_C extern "C" -#else -#define EXTERN_C extern -#endif - -// use the new secure crt functions if available -#ifndef NTSTRSAFE_USE_SECURE_CRT -#if defined(__GOT_SECURE_LIB__) && (__GOT_SECURE_LIB__ >= 200402L) -#define NTSTRSAFE_USE_SECURE_CRT 0 -#else -#define NTSTRSAFE_USE_SECURE_CRT 0 -#endif -#endif // !NTSTRSAFE_USE_SECURE_CRT - -#ifdef _M_CEE_PURE -#define NTSTRSAFEDDI __inline NTSTATUS __clrcall -#else -#define NTSTRSAFEDDI __inline NTSTATUS __stdcall -#endif - -#if defined(NTSTRSAFE_LIB_IMPL) || defined(NTSTRSAFE_LIB) -#define NTSTRSAFEWORKERDDI EXTERN_C NTSTATUS __stdcall -#else -#define NTSTRSAFEWORKERDDI static NTSTRSAFEDDI -#endif - -// The following steps are *REQUIRED* if ntstrsafe.h is used for drivers on: -// Windows 2000 -// Windows Millennium Edition -// Windows 98 Second Edition -// Windows 98 -// -// 1. #define NTSTRSAFE_LIB before including the ntstrsafe.h header file. -// 2. Add ntstrsafe.lib to the TARGET_LIBS line in SOURCES -// -// Drivers running on XP and later can skip these steps to create a smaller -// driver by running the functions inline. -#if defined(NTSTRSAFE_LIB) -#pragma comment(lib, "ntstrsafe.lib") -#endif - -// The user can request no "Cb" or no "Cch" fuctions, but not both -#if defined(NTSTRSAFE_NO_CB_FUNCTIONS) && defined(NTSTRSAFE_NO_CCH_FUNCTIONS) -#error cannot specify both NTSTRSAFE_NO_CB_FUNCTIONS and NTSTRSAFE_NO_CCH_FUNCTIONS !! -#endif - -// The user may override NTSTRSAFE_MAX_CCH, but it must always be less than INT_MAX -#ifndef NTSTRSAFE_MAX_CCH -#define NTSTRSAFE_MAX_CCH 2147483647 // max buffer size, in characters, that we support (same as INT_MAX) -#endif -C_ASSERT(NTSTRSAFE_MAX_CCH <= 2147483647); -C_ASSERT(NTSTRSAFE_MAX_CCH > 1); - -#define NTSTRSAFE_MAX_LENGTH (NTSTRSAFE_MAX_CCH - 1) // max buffer length, in characters, that we support - -// The user may override NTSTRSAFE_UNICODE_STRING_MAX_CCH, but it must always be less than (USHORT_MAX / sizeof(wchar_t)) -#ifndef NTSTRSAFE_UNICODE_STRING_MAX_CCH -#define NTSTRSAFE_UNICODE_STRING_MAX_CCH (0xffff / sizeof(wchar_t)) // max buffer size, in characters, for a UNICODE_STRING -#endif -C_ASSERT(NTSTRSAFE_UNICODE_STRING_MAX_CCH <= (0xffff / sizeof(wchar_t))); -C_ASSERT(NTSTRSAFE_UNICODE_STRING_MAX_CCH > 1); - - -// Flags for controling the Ex functions -// -// STRSAFE_FILL_BYTE(0xFF) 0x000000FF // bottom byte specifies fill pattern -#define STRSAFE_IGNORE_NULLS 0x00000100 // treat null string pointers as TEXT("") -- don't fault on NULL buffers -#define STRSAFE_FILL_BEHIND_NULL 0x00000200 // on success, fill in extra space behind the null terminator with fill pattern -#define STRSAFE_FILL_ON_FAILURE 0x00000400 // on failure, overwrite pszDest with fill pattern and null terminate it -#define STRSAFE_NULL_ON_FAILURE 0x00000800 // on failure, set *pszDest = TEXT('\0') -#define STRSAFE_NO_TRUNCATION 0x00001000 // instead of returning a truncated result, copy/append nothing to pszDest and null terminate it - -// Flags for controling UNICODE_STRING Ex functions -// -// STRSAFE_FILL_BYTE(0xFF) 0x000000FF // bottom byte specifies fill pattern -// STRSAFE_IGNORE_NULLS 0x00000100 // don't fault on NULL UNICODE_STRING pointers, and treat null pszSrc as L"" -#define STRSAFE_FILL_BEHIND 0x00000200 // on success, fill in extra space at the end of the UNICODE_STRING Buffer with fill pattern -// STRSAFE_FILL_ON_FAILURE 0x00000400 // on failure, fill the UNICODE_STRING Buffer with fill pattern and set the Length to 0 -#define STRSAFE_ZERO_LENGTH_ON_FAILURE 0x00000800 // on failure, set the UNICODE_STRING Length to 0 -// STRSAFE_NO_TRUNCATION 0x00001000 // instead of returning a truncated result, copy/append nothing to UNICODE_STRING Buffer - - -#define STRSAFE_VALID_FLAGS (0x000000FF | STRSAFE_IGNORE_NULLS | STRSAFE_FILL_BEHIND_NULL | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION) -#define STRSAFE_UNICODE_STRING_VALID_FLAGS (0x000000FF | STRSAFE_IGNORE_NULLS | STRSAFE_FILL_BEHIND | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE | STRSAFE_NO_TRUNCATION) - -// helper macro to set the fill character and specify buffer filling -#define STRSAFE_FILL_BYTE(x) ((DWORD)((x & 0x000000FF) | STRSAFE_FILL_BEHIND_NULL)) -#define STRSAFE_FAILURE_BYTE(x) ((DWORD)((x & 0x000000FF) | STRSAFE_FILL_ON_FAILURE)) - -#define STRSAFE_GET_FILL_PATTERN(dwFlags) ((int)(dwFlags & 0x000000FF)) - - -// -// These typedefs are used in places where the string is guaranteed to -// be null terminated. -// -typedef __nullterminated char* NTSTRSAFE_PSTR; -typedef __nullterminated const char* NTSTRSAFE_PCSTR; -typedef __nullterminated wchar_t* NTSTRSAFE_PWSTR; -typedef __nullterminated const wchar_t* NTSTRSAFE_PCWSTR; -typedef __nullterminated const wchar_t UNALIGNED* NTSTRSAFE_PCUWSTR; - -// -// These typedefs are used in places where the string is NOT guaranteed to -// be null terminated. -// -typedef __possibly_notnullterminated const char* STRSAFE_PCNZCH; -typedef __possibly_notnullterminated const wchar_t* STRSAFE_PCNZWCH; -typedef __possibly_notnullterminated const wchar_t UNALIGNED* STRSAFE_PCUNZWCH; - - -// prototypes for the worker functions - -NTSTRSAFEWORKERDDI -RtlStringLengthWorkerA( - __in STRSAFE_PCNZCH psz, - __in __in_range(<=, NTSTRSAFE_MAX_CCH) size_t cchMax, - __out_opt __deref_out_range(<, cchMax) size_t* pcchLength); - -NTSTRSAFEWORKERDDI -RtlStringLengthWorkerW( - __in STRSAFE_PCNZWCH psz, - __in __in_range(<=, NTSTRSAFE_MAX_CCH) size_t cchMax, - __out_opt __deref_out_range(<, cchMax) size_t* pcchLength); - -#ifdef ALIGNMENT_MACHINE -NTSTRSAFEWORKERDDI -RtlUnalignedStringLengthWorkerW( - __in STRSAFE_PCUNZWCH psz, - __in __in_range(<=, NTSTRSAFE_MAX_CCH) size_t cchMax, - __out_opt __deref_out_range(<, cchMax) size_t* pcchLength); -#endif // ALIGNMENT_MACHINE - -NTSTRSAFEWORKERDDI -RtlStringExValidateSrcA( - __deref_in_opt_out NTSTRSAFE_PCSTR* ppszSrc, - __inout_opt __deref_out_range(<, cchMax) size_t* pcchToRead, - __in const size_t cchMax, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlStringExValidateSrcW( - __deref_in_opt_out NTSTRSAFE_PCWSTR* ppszSrc, - __inout_opt __deref_out_range(<, cchMax) size_t* pcchToRead, - __in const size_t cchMax, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlStringValidateDestA( - __in_ecount_opt(cchDest) STRSAFE_PCNZCH pszDest, - __in size_t cchDest, - __in const size_t cchMax); - -NTSTRSAFEWORKERDDI -RtlStringValidateDestAndLengthA( - __in_ecount_opt(cchDest) NTSTRSAFE_PCSTR pszDest, - __in size_t cchDest, - __out __deref_out_range(<, cchDest) size_t* pcchDestLength, - __in const size_t cchMax); - -NTSTRSAFEWORKERDDI -RtlStringValidateDestW( - __in_ecount_opt(cchDest) STRSAFE_PCNZWCH pszDest, - __in size_t cchDest, - __in const size_t cchMax); - -NTSTRSAFEWORKERDDI -RtlStringValidateDestAndLengthW( - __in_ecount_opt(cchDest) NTSTRSAFE_PCWSTR pszDest, - __in size_t cchDest, - __out __deref_out_range(<, cchDest) size_t* pcchDestLength, - __in const size_t cchMax); - -NTSTRSAFEWORKERDDI -RtlStringExValidateDestA( - __in_ecount_opt(cchDest) STRSAFE_PCNZCH pszDest, - __in size_t cchDest, - __in const size_t cchMax, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlStringExValidateDestAndLengthA( - __in_ecount_opt(cchDest) NTSTRSAFE_PCSTR pszDest, - __in size_t cchDest, - __out __deref_out_range(<, cchDest) size_t* pcchDestLength, - __in const size_t cchMax, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlStringExValidateDestW( - __in_ecount_opt(cchDest) STRSAFE_PCNZWCH pszDest, - __in size_t cchDest, - __in const size_t cchMax, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlStringExValidateDestAndLengthW( - __in_ecount_opt(cchDest) NTSTRSAFE_PCWSTR pszDest, - __in size_t cchDest, - __out __deref_out_range(<, cchDest) size_t* pcchDestLength, - __in const size_t cchMax, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlStringCopyWorkerA( - __out_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchDest, - __out_opt __deref_out_range(<=, (cchToCopy < cchDest) ? cchToCopy : cchDest - 1) size_t* pcchNewDestLength, - __in_xcount(cchToCopy) STRSAFE_PCNZCH pszSrc, - __in __in_range(<, NTSTRSAFE_MAX_CCH) size_t cchToCopy); - -NTSTRSAFEWORKERDDI -RtlStringCopyWorkerW( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchDest, - __out_opt __deref_out_range(<=, (cchToCopy < cchDest) ? cchToCopy : cchDest - 1) size_t* pcchNewDestLength, - __in_xcount(cchToCopy) STRSAFE_PCNZWCH pszSrc, - __in __in_range(<, NTSTRSAFE_MAX_CCH) size_t cchToCopy); - -NTSTRSAFEWORKERDDI -RtlStringVPrintfWorkerA( - __out_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchDest, - __out_opt __deref_out_range(<=, cchDest - 1) size_t* pcchNewDestLength, - __in __format_string NTSTRSAFE_PCSTR pszFormat, - __in va_list argList); - -NTSTRSAFEWORKERDDI -RtlStringVPrintfWorkerW( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchDest, - __out_opt __deref_out_range(<=, cchDest - 1) size_t* pcchNewDestLength, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - __in va_list argList); - -NTSTRSAFEWORKERDDI -RtlStringExHandleFillBehindNullA( - __inout_bcount(cbRemaining) NTSTRSAFE_PSTR pszDestEnd, - __in size_t cbRemaining, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlStringExHandleFillBehindNullW( - __inout_bcount(cbRemaining) NTSTRSAFE_PWSTR pszDestEnd, - __in size_t cbRemaining, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlStringExHandleOtherFlagsA( - __inout_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in __in_range(sizeof(char), NTSTRSAFE_MAX_CCH * sizeof(char)) size_t cbDest, - __in __in_range(<, cbDest / sizeof(char)) size_t cchOriginalDestLength, - __deref_inout_ecount(*pcchRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out __deref_out_range(<=, cbDest / sizeof(char)) size_t* pcchRemaining, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlStringExHandleOtherFlagsW( - __inout_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in __in_range(sizeof(wchar_t), NTSTRSAFE_MAX_CCH * sizeof(wchar_t)) size_t cbDest, - __in __in_range(<, cbDest / sizeof(wchar_t)) size_t cchOriginalDestLength, - __deref_inout_ecount(*pcchRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out __deref_out_range(<=, cbDest / sizeof(wchar_t)) size_t* pcchRemaining, - __in DWORD dwFlags); - -#ifndef NTSTRSAFE_NO_UNICODE_STRING_FUNCTIONS - -NTSTRSAFEWORKERDDI -RtlUnicodeStringInitWorker( - __out PUNICODE_STRING DestinationString, - __in_opt NTSTRSAFE_PCWSTR pszSrc, - __in const size_t cchMax, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlUnicodeStringValidateWorker( - __in_opt PCUNICODE_STRING SourceString, - __in const size_t cchMax, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlUnicodeStringValidateSrcWorker( - __in PCUNICODE_STRING SourceString, - __deref_out_ecount(*pcchSrcLength) wchar_t** ppszSrc, - __out size_t* pcchSrcLength, - __in const size_t cchMax, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlUnicodeStringValidateDestWorker( - __in PCUNICODE_STRING DestinationString, - __deref_out_ecount(*pcchDest) wchar_t** ppszDest, - __out size_t* pcchDest, - __out_opt size_t* pcchDestLength, - __in const size_t cchMax, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlStringCopyWideCharArrayWorker( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __out_opt size_t* pcchNewDestLength, - __in_ecount(cchSrcLength) const wchar_t* pszSrc, - __in size_t cchSrcLength); - -NTSTRSAFEWORKERDDI -RtlWideCharArrayCopyStringWorker( - __out_ecount(cchDest) wchar_t* pszDest, - __in size_t cchDest, - __out size_t* pcchNewDestLength, - __in NTSTRSAFE_PCWSTR pszSrc, - __in size_t cchToCopy); - -NTSTRSAFEWORKERDDI -RtlWideCharArrayCopyWorker( - __out_ecount(cchDest) wchar_t* pszDest, - __in size_t cchDest, - __out size_t* pcchNewDestLength, - __in_ecount(cchSrcLength) const wchar_t* pszSrc, - __in size_t cchSrcLength); - -NTSTRSAFEWORKERDDI -RtlWideCharArrayVPrintfWorker( - __out_ecount(cchDest) wchar_t* pszDest, - __in size_t cchDest, - __out size_t* pcchNewDestLength, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - __in va_list argList); - -NTSTRSAFEWORKERDDI -RtlUnicodeStringExHandleFill( - __out_ecount(cchRemaining) wchar_t* pszDestEnd, - __in size_t cchRemaining, - __in DWORD dwFlags); - -NTSTRSAFEWORKERDDI -RtlUnicodeStringExHandleOtherFlags( - __inout_ecount(cchDest) wchar_t* pszDest, - __in size_t cchDest, - __in size_t cchOriginalDestLength, - __out size_t* pcchNewDestLength, - __deref_out_ecount(*pcchRemaining) wchar_t** ppszDestEnd, - __out size_t* pcchRemaining, - __in DWORD dwFlags); - -#endif // !NTSTRSAFE_NO_UNICODE_STRING_FUNCTIONS - - -// To allow this to stand alone. -#define __WARNING_CYCLOMATIC_COMPLEXITY 28734 -#define __WARNING_DEREF_NULL_PTR 6011 -#define __WARNING_INVALID_PARAM_VALUE_1 6387 -#define __WARNING_POTENTIAL_BUFFER_OVERFLOW_HIGH_PRIORITY 26015 -#define __WARNING_RETURNING_BAD_RESULT 28196 -#define __WARNING_BANNED_API_USAGE 28719 - -#pragma warning(push) -#if _MSC_VER <= 1400 -#pragma warning(disable: 4616) // turn off warning out of range so prefast pragmas won't show - // show up in build.wrn/build.err -#endif -#pragma warning(disable : 4996) // 'function': was declared deprecated -#pragma warning(disable : 4995) // name was marked as #pragma deprecated -#pragma warning(disable : 4793) // vararg causes native code generation -#pragma warning(disable : __WARNING_CYCLOMATIC_COMPLEXITY) - - -#ifndef NTSTRSAFE_LIB_IMPL - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchCopy( - __out_ecount(cchDest) LPTSTR pszDest, - __in size_t cchDest, - __in LPCTSTR pszSrc - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcpy'. - The size of the destination buffer (in characters) is a parameter and - this function will not write past the end of this buffer and it will - ALWAYS null terminate the destination buffer (unless it is zero length). - - This routine is not a replacement for strncpy. That function will pad the - destination string with extra null termination characters if the count is - greater than the length of the source string, and it will fail to null - terminate the destination string if the source string length is greater - than or equal to the count. You can not blindly use this instead of strncpy: - it is common for code to use it to "patch" strings and you would introduce - errors if the code started null terminating in the middle of the string. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was copied without truncation and null terminated, - otherwise it will return a failure code. In failure cases as much of - pszSrc will be copied to pszDest as possible, and pszDest will be null - terminated. - -Arguments: - - pszDest - destination string - - cchDest - size of destination buffer in characters. - length must be = (_tcslen(src) + 1) to hold all of the - source including the null terminator - - pszSrc - source string which must be null terminated - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL. See RtlStringCchCopyEx if you require - the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied and the - resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlStringCchCopyA( - __out_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in size_t cchDest, - __in NTSTRSAFE_PCSTR pszSrc) -{ - NTSTATUS status; - - status = RtlStringValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - status = RtlStringCopyWorkerA(pszDest, - cchDest, - NULL, - pszSrc, - NTSTRSAFE_MAX_LENGTH); - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCchCopyW( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __in NTSTRSAFE_PCWSTR pszSrc) -{ - NTSTATUS status; - - status = RtlStringValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - status = RtlStringCopyWorkerW(pszDest, - cchDest, - NULL, - pszSrc, - NTSTRSAFE_MAX_LENGTH); - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbCopy( - __out_bcount(cbDest) LPTSTR pszDest, - __in size_t cbDest, - __in LPCTSTR pszSrc - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcpy'. - The size of the destination buffer (in bytes) is a parameter and this - function will not write past the end of this buffer and it will ALWAYS - null terminate the destination buffer (unless it is zero length). - - This routine is not a replacement for strncpy. That function will pad the - destination string with extra null termination characters if the count is - greater than the length of the source string, and it will fail to null - terminate the destination string if the source string length is greater - than or equal to the count. You can not blindly use this instead of strncpy: - it is common for code to use it to "patch" strings and you would introduce - errors if the code started null terminating in the middle of the string. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was copied without truncation and null terminated, - otherwise it will return a failure code. In failure cases as much of pszSrc - will be copied to pszDest as possible, and pszDest will be null terminated. - -Arguments: - - pszDest - destination string - - cbDest - size of destination buffer in bytes. - length must be = ((_tcslen(src) + 1) * sizeof(TCHAR)) to - hold all of the source including the null terminator - - pszSrc - source string which must be null terminated - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL. See RtlStringCbCopyEx if you require - the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied and the - resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlStringCbCopyA( - __out_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in size_t cbDest, - __in NTSTRSAFE_PCSTR pszSrc) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(char); - - status = RtlStringValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - status = RtlStringCopyWorkerA(pszDest, - cchDest, - NULL, - pszSrc, - NTSTRSAFE_MAX_LENGTH); - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCbCopyW( - __out_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __in NTSTRSAFE_PCWSTR pszSrc) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - - status = RtlStringValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - status = RtlStringCopyWorkerW(pszDest, - cchDest, - NULL, - pszSrc, - NTSTRSAFE_MAX_LENGTH); - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchCopyEx( - __out_ecount(cchDest) LPTSTR pszDest OPTIONAL, - __in size_t cchDest, - __in LPCTSTR pszSrc OPTIONAL, - __deref_opt_out_ecount(*pcchRemaining) LPTSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcchRemaining OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcpy' with - some additional parameters. In addition to functionality provided by - RtlStringCchCopy, this routine also returns a pointer to the end of the - destination string and the number of characters left in the destination string - including the null terminator. The flags parameter allows additional controls. - -Arguments: - - pszDest - destination string - - cchDest - size of destination buffer in characters. - length must be = (_tcslen(pszSrc) + 1) to hold all of - the source including the null terminator - - pszSrc - source string which must be null terminated - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function copied any data, the result will point to the - null termination character - - pcchRemaining - if pcchRemaining is non-null, the function will return the - number of characters left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")). - this flag is useful for emulating functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any truncated - string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied and the - resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCchCopyExA( - __out_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in size_t cchDest, - __in NTSTRSAFE_PCSTR pszSrc, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - - status = RtlStringExValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcA(&pszSrc, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if (*pszSrc != '\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerA(pszDest, - cchDest, - &cchCopied, - pszSrc, - NTSTRSAFE_MAX_LENGTH); - - pszDestEnd = pszDest + cchCopied; - cchRemaining = cchDest - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbRemaining = cchRemaining * sizeof(char); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullA(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(char) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbDest = cchDest * sizeof(char); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsA(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCchCopyExW( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __in NTSTRSAFE_PCWSTR pszSrc, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - - status = RtlStringExValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PWSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcW(&pszSrc, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if (*pszSrc != L'\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerW(pszDest, - cchDest, - &cchCopied, - pszSrc, - NTSTRSAFE_MAX_LENGTH); - - pszDestEnd = pszDest + cchCopied; - cchRemaining = cchDest - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = cchRemaining * sizeof(wchar_t); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(wchar_t) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbDest = cchDest * sizeof(wchar_t); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbCopyEx( - __out_bcount(cbDest) LPTSTR pszDest OPTIONAL, - __in size_t cbDest, - __in LPCTSTR pszSrc OPTIONAL, - __deref_opt_out_bcount(*pcbRemaining) LPTSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcbRemaining OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcpy' with - some additional parameters. In addition to functionality provided by - RtlStringCbCopy, this routine also returns a pointer to the end of the - destination string and the number of bytes left in the destination string - including the null terminator. The flags parameter allows additional controls. - -Arguments: - - pszDest - destination string - - cbDest - size of destination buffer in bytes. - length must be ((_tcslen(pszSrc) + 1) * sizeof(TCHAR)) to - hold all of the source including the null terminator - - pszSrc - source string which must be null terminated - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function copied any data, the result will point to the - null termination character - - pcbRemaining - pcbRemaining is non-null,the function will return the - number of bytes left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")). - this flag is useful for emulating functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any truncated - string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied and the - resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCbCopyExA( - __out_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in size_t cbDest, - __in NTSTRSAFE_PCSTR pszSrc, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(char); - - status = RtlStringExValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcA(&pszSrc, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if (*pszSrc != '\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerA(pszDest, - cchDest, - &cchCopied, - pszSrc, - NTSTRSAFE_MAX_LENGTH); - - pszDestEnd = pszDest + cchCopied; - cchRemaining = cchDest - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullA(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsA(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - } - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCbCopyExW( - __out_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __in NTSTRSAFE_PCWSTR pszSrc, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - - status = RtlStringExValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PWSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcW(&pszSrc, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if (*pszSrc != L'\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerW(pszDest, - cchDest, - &cchCopied, - pszSrc, - NTSTRSAFE_MAX_LENGTH); - - pszDestEnd = pszDest + cchCopied; - cchRemaining = cchDest - cchCopied; - - if (NT_SUCCESS(status) && (dwFlags & STRSAFE_FILL_BEHIND_NULL)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchCopyN( - __out_ecount(cchDest) LPTSTR pszDest, - __in size_t cchDest, - __in LPCTSTR pszSrc, - __in size_t cchToCopy - ); - - -Routine Description: - - This routine is a safer version of the C built-in function 'strncpy'. - The size of the destination buffer (in characters) is a parameter and - this function will not write past the end of this buffer and it will - ALWAYS null terminate the destination buffer (unless it is zero length). - - This routine is meant as a replacement for strncpy, but it does behave - differently. This function will not pad the destination buffer with extra - null termination characters if cchToCopy is greater than the length of pszSrc. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the entire string or the first cchToCopy characters were copied - without truncation and the resultant destination string was null terminated, - otherwise it will return a failure code. In failure cases as much of pszSrc - will be copied to pszDest as possible, and pszDest will be null terminated. - -Arguments: - - pszDest - destination string - - cchDest - size of destination buffer in characters. - length must be = (_tcslen(src) + 1) to hold all of the - source including the null terminator - - pszSrc - source string - - cchToCopy - maximum number of characters to copy from source string, - not including the null terminator. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL. See RtlStringCchCopyNEx if you require - the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied and the - resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlStringCchCopyNA( - __out_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in size_t cchDest, - __in_ecount(cchToCopy) STRSAFE_PCNZCH pszSrc, - __in size_t cchToCopy) -{ - NTSTATUS status; - - status = RtlStringValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - if (cchToCopy > NTSTRSAFE_MAX_LENGTH) - { - status = STATUS_INVALID_PARAMETER; - - *pszDest = '\0'; - } - else - { - status = RtlStringCopyWorkerA(pszDest, - cchDest, - NULL, - pszSrc, - cchToCopy); - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCchCopyNW( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __in_ecount(cchToCopy) STRSAFE_PCNZWCH pszSrc, - __in size_t cchToCopy) -{ - NTSTATUS status; - - status = RtlStringValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - if (cchToCopy > NTSTRSAFE_MAX_LENGTH) - { - status = STATUS_INVALID_PARAMETER; - - *pszDest = L'\0'; - } - else - { - status = RtlStringCopyWorkerW(pszDest, - cchDest, - NULL, - pszSrc, - cchToCopy); - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbCopyN( - __out_bcount(cbDest) LPTSTR pszDest, - __in size_t cbDest, - __in LPCTSTR pszSrc, - __in size_t cbToCopy - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncpy'. - The size of the destination buffer (in bytes) is a parameter and this - function will not write past the end of this buffer and it will ALWAYS - null terminate the destination buffer (unless it is zero length). - - This routine is meant as a replacement for strncpy, but it does behave - differently. This function will not pad the destination buffer with extra - null termination characters if cbToCopy is greater than the size of pszSrc. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the entire string or the first cbToCopy characters were - copied without truncation and the resultant destination string was null - terminated, otherwise it will return a failure code. In failure cases as - much of pszSrc will be copied to pszDest as possible, and pszDest will be - null terminated. - -Arguments: - - pszDest - destination string - - cbDest - size of destination buffer in bytes. - length must be = ((_tcslen(src) + 1) * sizeof(TCHAR)) to - hold all of the source including the null terminator - - pszSrc - source string - - cbToCopy - maximum number of bytes to copy from source string, - not including the null terminator. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL. See RtlStringCbCopyEx if you require - the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied and the - resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlStringCbCopyNA( - __out_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in size_t cbDest, - __in_bcount(cbToCopy) STRSAFE_PCNZCH pszSrc, - __in size_t cbToCopy) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(char); - - status = RtlStringValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - size_t cchToCopy = cbToCopy / sizeof(char); - - if (cchToCopy > NTSTRSAFE_MAX_LENGTH) - { - status = STATUS_INVALID_PARAMETER; - - *pszDest = '\0'; - } - else - { - status = RtlStringCopyWorkerA(pszDest, - cchDest, - NULL, - pszSrc, - cchToCopy); - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCbCopyNW( - __out_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __in_bcount(cbToCopy) STRSAFE_PCNZWCH pszSrc, - __in size_t cbToCopy) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - - status = RtlStringValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - size_t cchToCopy = cbToCopy / sizeof(wchar_t); - - if (cchToCopy > NTSTRSAFE_MAX_LENGTH) - { - status = STATUS_INVALID_PARAMETER; - - // Suppress espx false positive - cchDest cannot be 0 here -#pragma warning(push) -#pragma warning(disable : __WARNING_POTENTIAL_BUFFER_OVERFLOW_HIGH_PRIORITY) - *pszDest = L'\0'; -#pragma warning(pop) - } - else - { - status = RtlStringCopyWorkerW(pszDest, - cchDest, - NULL, - pszSrc, - cchToCopy); - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchCopyNEx( - __out_ecount(cchDest) LPTSTR pszDest OPTIONAL, - __in size_t cchDest, - __in LPCTSTR pszSrc OPTIONAL, - __in size_t cchToCopy, - __deref_opt_out_ecount(*pcchRemaining) LPTSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcchRemaining OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncpy' with - some additional parameters. In addition to functionality provided by - RtlStringCchCopyN, this routine also returns a pointer to the end of the - destination string and the number of characters left in the destination - string including the null terminator. The flags parameter allows - additional controls. - - This routine is meant as a replacement for strncpy, but it does behave - differently. This function will not pad the destination buffer with extra - null termination characters if cchToCopy is greater than the length of pszSrc. - -Arguments: - - pszDest - destination string - - cchDest - size of destination buffer in characters. - length must be = (_tcslen(pszSrc) + 1) to hold all of - the source including the null terminator - - pszSrc - source string - - cchToCopy - maximum number of characters to copy from the source - string - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function copied any data, the result will point to the - null termination character - - pcchRemaining - if pcchRemaining is non-null, the function will return the - number of characters left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")). - this flag is useful for emulating functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any truncated - string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied and the - resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCchCopyNExA( - __out_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in size_t cchDest, - __in_ecount(cchToCopy) STRSAFE_PCNZCH pszSrc, - __in size_t cchToCopy, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - - status = RtlStringExValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcA(&pszSrc, &cchToCopy, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if ((cchToCopy != 0) && (*pszSrc != '\0')) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerA(pszDest, - cchDest, - &cchCopied, - pszSrc, - cchToCopy); - - pszDestEnd = pszDest + cchCopied; - cchRemaining = cchDest - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbRemaining = cchRemaining * sizeof(char); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullA(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(char) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbDest = cchDest * sizeof(char); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsA(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCchCopyNExW( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __in_ecount(cchToCopy) STRSAFE_PCNZWCH pszSrc, - __in size_t cchToCopy, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - - status = RtlStringExValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PWSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcW(&pszSrc, &cchToCopy, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if ((cchToCopy != 0) && (*pszSrc != L'\0')) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerW(pszDest, - cchDest, - &cchCopied, - pszSrc, - cchToCopy); - - pszDestEnd = pszDest + cchCopied; - cchRemaining = cchDest - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = cchRemaining * sizeof(wchar_t); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(wchar_t) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbDest = cchDest * sizeof(wchar_t); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbCopyNEx( - __out_bcount(cbDest) LPTSTR pszDest OPTIONAL, - __in size_t cbDest, - __in LPCTSTR pszSrc OPTIONAL, - __in size_t cbToCopy, - __deref_opt_out_bcount(*pcbRemaining) LPTSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcbRemaining OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncpy' with - some additional parameters. In addition to functionality provided by - RtlStringCbCopyN, this routine also returns a pointer to the end of the - destination string and the number of bytes left in the destination string - including the null terminator. The flags parameter allows additional controls. - - This routine is meant as a replacement for strncpy, but it does behave - differently. This function will not pad the destination buffer with extra - null termination characters if cbToCopy is greater than the size of pszSrc. - -Arguments: - - pszDest - destination string - - cbDest - size of destination buffer in bytes. - length must be ((_tcslen(pszSrc) + 1) * sizeof(TCHAR)) to - hold all of the source including the null terminator - - pszSrc - source string - - cbToCopy - maximum number of bytes to copy from source string - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function copied any data, the result will point to the - null termination character - - pcbRemaining - pcbRemaining is non-null,the function will return the - number of bytes left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")). - this flag is useful for emulating functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any truncated - string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied and the - resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCbCopyNExA( - __out_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in size_t cbDest, - __in_bcount(cbToCopy) STRSAFE_PCNZCH pszSrc, - __in size_t cbToCopy, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(char); - - status = RtlStringExValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - size_t cchToCopy = cbToCopy / sizeof(char); - - status = RtlStringExValidateSrcA(&pszSrc, &cchToCopy, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if ((cchToCopy != 0) && (*pszSrc != '\0')) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerA(pszDest, - cchDest, - &cchCopied, - pszSrc, - cchToCopy); - - pszDestEnd = pszDest + cchCopied; - cchRemaining = cchDest - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullA(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsA(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - } - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCbCopyNExW( - __out_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __in_bcount(cbToCopy) STRSAFE_PCNZWCH pszSrc, - __in size_t cbToCopy, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - - status = RtlStringExValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PWSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - size_t cchToCopy = cbToCopy / sizeof(wchar_t); - -#pragma warning(push) -#pragma warning(disable : __WARNING_POTENTIAL_BUFFER_OVERFLOW_HIGH_PRIORITY) - status = RtlStringExValidateSrcW(&pszSrc, &cchToCopy, NTSTRSAFE_MAX_CCH, dwFlags); -#pragma warning(pop) - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if ((cchToCopy != 0) && (*pszSrc != L'\0')) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerW(pszDest, - cchDest, - &cchCopied, - pszSrc, - cchToCopy); - - pszDestEnd = pszDest + cchCopied; - cchRemaining = cchDest - cchCopied; - - if (NT_SUCCESS(status) && (dwFlags & STRSAFE_FILL_BEHIND_NULL)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchCat( - __inout_ecount(cchDest) LPTSTR pszDest, - __in size_t cchDest, - __in LPCTSTR pszSrc - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcat'. - The size of the destination buffer (in characters) is a parameter and this - function will not write past the end of this buffer and it will ALWAYS - null terminate the destination buffer (unless it is zero length). - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was concatenated without truncation and null terminated, - otherwise it will return a failure code. In failure cases as much of pszSrc - will be appended to pszDest as possible, and pszDest will be null - terminated. - -Arguments: - - pszDest - destination string which must be null terminated - - cchDest - size of destination buffer in characters. - length must be = (_tcslen(pszDest) + _tcslen(pszSrc) + 1) - to hold all of the combine string plus the null - terminator - - pszSrc - source string which must be null terminated - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL. See RtlStringCchCatEx if you require - the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all concatenated and - the resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the operation - failed due to insufficient space. When this error occurs, - the destination buffer is modified to contain a truncated - version of the ideal result and is null terminated. This - is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCchCatA( - __inout_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in size_t cchDest, - __in NTSTRSAFE_PCSTR pszSrc) -{ - NTSTATUS status; - size_t cchDestLength; - - status = RtlStringValidateDestAndLengthA(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - status = RtlStringCopyWorkerA(pszDest + cchDestLength, - cchDest - cchDestLength, - NULL, - pszSrc, - NTSTRSAFE_MAX_CCH); - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCchCatW( - __inout_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __in NTSTRSAFE_PCWSTR pszSrc) -{ - NTSTATUS status; - size_t cchDestLength; - - status = RtlStringValidateDestAndLengthW(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - status = RtlStringCopyWorkerW(pszDest + cchDestLength, - cchDest - cchDestLength, - NULL, - pszSrc, - NTSTRSAFE_MAX_CCH); - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbCat( - __inout_bcount(cbDest) LPTSTR pszDest, - __in size_t cbDest, - __in LPCTSTR pszSrc - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcat'. - The size of the destination buffer (in bytes) is a parameter and this - function will not write past the end of this buffer and it will ALWAYS - null terminate the destination buffer (unless it is zero length). - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was concatenated without truncation and null terminated, - otherwise it will return a failure code. In failure cases as much of pszSrc - will be appended to pszDest as possible, and pszDest will be null - terminated. - -Arguments: - - pszDest - destination string which must be null terminated - - cbDest - size of destination buffer in bytes. - length must be = ((_tcslen(pszDest) + _tcslen(pszSrc) + 1) * sizeof(TCHAR) - to hold all of the combine string plus the null - terminator - - pszSrc - source string which must be null terminated - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL. See RtlStringCbCatEx if you require - the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all concatenated and - the resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the operation - failed due to insufficient space. When this error occurs, - the destination buffer is modified to contain a truncated - version of the ideal result and is null terminated. This - is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCbCatA( - __inout_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in size_t cbDest, - __in NTSTRSAFE_PCSTR pszSrc) -{ - NTSTATUS status; - size_t cchDestLength; - size_t cchDest = cbDest / sizeof(char); - - status = RtlStringValidateDestAndLengthA(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - status = RtlStringCopyWorkerA(pszDest + cchDestLength, - cchDest - cchDestLength, - NULL, - pszSrc, - NTSTRSAFE_MAX_CCH); - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCbCatW( - __inout_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __in NTSTRSAFE_PCWSTR pszSrc) -{ - NTSTATUS status; - size_t cchDestLength; - size_t cchDest = cbDest / sizeof(wchar_t); - - status = RtlStringValidateDestAndLengthW(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - status = RtlStringCopyWorkerW(pszDest + cchDestLength, - cchDest - cchDestLength, - NULL, - pszSrc, - NTSTRSAFE_MAX_CCH); - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchCatEx( - __inout_ecount(cchDest) LPTSTR pszDest OPTIONAL, - __in size_t cchDest, - __in LPCTSTR pszSrc OPTIONAL, - __deref_opt_out_ecount(*pcchRemaining) LPTSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcchRemaining OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcat' with - some additional parameters. In addition to functionality provided by - RtlStringCchCat, this routine also returns a pointer to the end of the - destination string and the number of characters left in the destination string - including the null terminator. The flags parameter allows additional controls. - -Arguments: - - pszDest - destination string which must be null terminated - - cchDest - size of destination buffer in characters - length must be (_tcslen(pszDest) + _tcslen(pszSrc) + 1) - to hold all of the combine string plus the null - terminator. - - pszSrc - source string which must be null terminated - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function appended any data, the result will point to the - null termination character - - pcchRemaining - if pcchRemaining is non-null, the function will return the - number of characters left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")). - this flag is useful for emulating functions like lstrcat - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any pre-existing - or truncated string - - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any pre-existing or - truncated string - - STRSAFE_NO_TRUNCATION - if the function returns STATUS_BUFFER_OVERFLOW, pszDest - will not contain a truncated string, it will remain unchanged. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all concatenated and - the resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the operation - failed due to insufficient space. When this error - occurs, the destination buffer is modified to contain - a truncated version of the ideal result and is null - terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCchCatExA( - __inout_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in size_t cchDest, - __in NTSTRSAFE_PCSTR pszSrc, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDestLength; - - status = RtlStringExValidateDestAndLengthA(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PSTR pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - - status = RtlStringExValidateSrcA(&pszSrc, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining <= 1) - { - // only fail if there was actually src data to append - if (*pszSrc != '\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerA(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - NTSTRSAFE_MAX_LENGTH); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbRemaining = cchRemaining * sizeof(char); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullA(pszDestEnd, cbRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(char) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbDest = cchDest * sizeof(char); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsA(pszDest, - cbDest, - cchDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCchCatExW( - __inout_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __in NTSTRSAFE_PCWSTR pszSrc, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDestLength; - - status = RtlStringExValidateDestAndLengthW(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PWSTR pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - - status = RtlStringExValidateSrcW(&pszSrc, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining <= 1) - { - // only fail if there was actually src data to append - if (*pszSrc != L'\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerW(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - NTSTRSAFE_MAX_LENGTH); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = cchRemaining * sizeof(wchar_t); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(char) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbDest = cchDest * sizeof(wchar_t); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - cchDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbCatEx( - __inout_bcount(cbDest) LPTSTR pszDest OPTIONAL, - __in size_t cbDest, - __in LPCTSTR pszSrc OPTIONAL, - __deref_opt_out_bcount(*pcbRemaining) LPTSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcbRemaining OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcat' with - some additional parameters. In addition to functionality provided by - RtlStringCbCat, this routine also returns a pointer to the end of the - destination string and the number of bytes left in the destination string - including the null terminator. The flags parameter allows additional controls. - -Arguments: - - pszDest - destination string which must be null terminated - - cbDest - size of destination buffer in bytes. - length must be ((_tcslen(pszDest) + _tcslen(pszSrc) + 1) * sizeof(TCHAR) - to hold all of the combine string plus the null - terminator. - - pszSrc - source string which must be null terminated - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function appended any data, the result will point to the - null termination character - - pcbRemaining - if pcbRemaining is non-null, the function will return - the number of bytes left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")). - this flag is useful for emulating functions like lstrcat - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any pre-existing - or truncated string - - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any pre-existing or - truncated string - - STRSAFE_NO_TRUNCATION - if the function returns STATUS_BUFFER_OVERFLOW, pszDest - will not contain a truncated string, it will remain unchanged. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all concatenated - and the resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the operation - failed due to insufficient space. When this error - occurs, the destination buffer is modified to contain - a truncated version of the ideal result and is null - terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCbCatExA( - __inout_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in size_t cbDest, - __in NTSTRSAFE_PCSTR pszSrc, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(char); - size_t cchDestLength; - - status = RtlStringExValidateDestAndLengthA(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PSTR pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - - status = RtlStringExValidateSrcA(&pszSrc, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining <= 1) - { - // only fail if there was actually src data to append - if (*pszSrc != '\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerA(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - NTSTRSAFE_MAX_LENGTH); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullA(pszDestEnd, cbRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsA(pszDest, - cbDest, - cchDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - } - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCbCatExW( - __inout_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __in NTSTRSAFE_PCWSTR pszSrc, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - size_t cchDestLength; - - status = RtlStringExValidateDestAndLengthW(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PWSTR pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - - status = RtlStringExValidateSrcW(&pszSrc, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining <= 1) - { - // only fail if there was actually src data to append - if (*pszSrc != L'\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerW(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - NTSTRSAFE_MAX_LENGTH); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - if (NT_SUCCESS(status) && (dwFlags & STRSAFE_FILL_BEHIND_NULL)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - cchDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchCatN( - __inout_ecount(cchDest) LPTSTR pszDest, - __in size_t cchDest, - __in LPCTSTR pszSrc, - __in size_t cchToAppend - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncat'. - The size of the destination buffer (in characters) is a parameter as well as - the maximum number of characters to append, excluding the null terminator. - This function will not write past the end of the destination buffer and it will - ALWAYS null terminate pszDest (unless it is zero length). - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if all of pszSrc or the first cchToAppend characters were appended - to the destination string and it was null terminated, otherwise it will - return a failure code. In failure cases as much of pszSrc will be appended - to pszDest as possible, and pszDest will be null terminated. - -Arguments: - - pszDest - destination string which must be null terminated - - cchDest - size of destination buffer in characters. - length must be (_tcslen(pszDest) + min(cchToAppend, _tcslen(pszSrc)) + 1) - to hold all of the combine string plus the null - terminator. - - pszSrc - source string - - cchToAppend - maximum number of characters to append - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL. See RtlStringCchCatNEx if you require - the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if all of pszSrc or the first cchToAppend characters - were concatenated to pszDest and the resultant dest - string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the operation - failed due to insufficient space. When this error - occurs, the destination buffer is modified to contain - a truncated version of the ideal result and is null - terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCchCatNA( - __inout_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in size_t cchDest, - __in_ecount(cchToAppend) STRSAFE_PCNZCH pszSrc, - __in size_t cchToAppend) -{ - NTSTATUS status; - size_t cchDestLength; - - status = RtlStringValidateDestAndLengthA(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - if (cchToAppend > NTSTRSAFE_MAX_LENGTH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlStringCopyWorkerA(pszDest + cchDestLength, - cchDest - cchDestLength, - NULL, - pszSrc, - cchToAppend); - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCchCatNW( - __inout_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __in_ecount(cchToAppend) STRSAFE_PCNZWCH pszSrc, - __in size_t cchToAppend) -{ - NTSTATUS status; - size_t cchDestLength; - - status = RtlStringValidateDestAndLengthW(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - if (cchToAppend > NTSTRSAFE_MAX_LENGTH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlStringCopyWorkerW(pszDest + cchDestLength, - cchDest - cchDestLength, - NULL, - pszSrc, - cchToAppend); - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbCatN( - __inout_bcount(cbDest) LPTSTR pszDest, - __in size_t cbDest, - __in LPCTSTR pszSrc, - __in size_t cbToAppend - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncat'. - The size of the destination buffer (in bytes) is a parameter as well as - the maximum number of bytes to append, excluding the null terminator. - This function will not write past the end of the destination buffer and it will - ALWAYS null terminate pszDest (unless it is zero length). - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if all of pszSrc or the first cbToAppend bytes were appended - to the destination string and it was null terminated, otherwise it will - return a failure code. In failure cases as much of pszSrc will be appended - to pszDest as possible, and pszDest will be null terminated. - -Arguments: - - pszDest - destination string which must be null terminated - - cbDest - size of destination buffer in bytes. - length must be ((_tcslen(pszDest) + min(cbToAppend / sizeof(TCHAR), _tcslen(pszSrc)) + 1) * sizeof(TCHAR) - to hold all of the combine string plus the null - terminator. - - pszSrc - source string - - cbToAppend - maximum number of bytes to append - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL. See RtlStringCbCatNEx if you require - the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if all of pszSrc or the first cbToAppend bytes were - concatenated to pszDest and the resultant dest string - was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the operation - failed due to insufficient space. When this error - occurs, the destination buffer is modified to contain - a truncated version of the ideal result and is null - terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCbCatNA( - __inout_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in size_t cbDest, - __in_bcount(cbToAppend) STRSAFE_PCNZCH pszSrc, - __in size_t cbToAppend) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(char); - size_t cchDestLength; - - status = RtlStringValidateDestAndLengthA(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - size_t cchToAppend = cbToAppend / sizeof(char); - - if (cchToAppend > NTSTRSAFE_MAX_LENGTH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlStringCopyWorkerA(pszDest + cchDestLength, - cchDest - cchDestLength, - NULL, - pszSrc, - cchToAppend); - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCbCatNW( - __inout_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __in_bcount(cbToAppend) STRSAFE_PCNZWCH pszSrc, - __in size_t cbToAppend) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - size_t cchDestLength; - - status = RtlStringValidateDestAndLengthW(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - size_t cchToAppend = cbToAppend / sizeof(wchar_t); - - if (cchToAppend > NTSTRSAFE_MAX_LENGTH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlStringCopyWorkerW(pszDest + cchDestLength, - cchDest - cchDestLength, - NULL, - pszSrc, - cchToAppend); - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchCatNEx( - __inout_ecount(cchDest) LPTSTR pszDest OPTIONAL, - __in size_t cchDest, - __in LPCTSTR pszSrc OPTIONAL, - __in size_t cchToAppend, - __deref_opt_out_ecount(*pcchRemaining) LPTSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcchRemaining OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncat', with - some additional parameters. In addition to functionality provided by - RtlStringCchCatN, this routine also returns a pointer to the end of the - destination string and the number of characters left in the destination string - including the null terminator. The flags parameter allows additional controls. - -Arguments: - - pszDest - destination string which must be null terminated - - cchDest - size of destination buffer in characters. - length must be (_tcslen(pszDest) + min(cchToAppend, _tcslen(pszSrc)) + 1) - to hold all of the combine string plus the null - terminator. - - pszSrc - source string - - cchToAppend - maximum number of characters to append - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function appended any data, the result will point to the - null termination character - - pcchRemaining - if pcchRemaining is non-null, the function will return the - number of characters left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")) - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any pre-existing - or truncated string - - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any pre-existing or - truncated string - - STRSAFE_NO_TRUNCATION - if the function returns STATUS_BUFFER_OVERFLOW, pszDest - will not contain a truncated string, it will remain unchanged. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if all of pszSrc or the first cchToAppend characters - were concatenated to pszDest and the resultant dest - string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the operation - failed due to insufficient space. When this error - occurs, the destination buffer is modified to contain - a truncated version of the ideal result and is null - terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCchCatNExA( - __inout_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in size_t cchDest, - __in_ecount(cchToAppend) STRSAFE_PCNZCH pszSrc, - __in size_t cchToAppend, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDestLength; - - status = RtlStringExValidateDestAndLengthA(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PSTR pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - - status = RtlStringExValidateSrcA(&pszSrc, &cchToAppend, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining <= 1) - { - // only fail if there was actually src data to append - if ((cchToAppend != 0) && (*pszSrc != '\0')) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerA(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - cchToAppend); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbRemaining = cchRemaining * sizeof(char); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullA(pszDestEnd, cbRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(char) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbDest = cchDest * sizeof(char); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsA(pszDest, - cbDest, - cchDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCchCatNExW( - __inout_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __in_ecount(cchToAppend) STRSAFE_PCNZWCH pszSrc, - __in size_t cchToAppend, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDestLength; - - status = RtlStringExValidateDestAndLengthW(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PWSTR pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - - status = RtlStringExValidateSrcW(&pszSrc, &cchToAppend, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining <= 1) - { - // only fail if there was actually src data to append - if ((cchToAppend != 0) && (*pszSrc != L'\0')) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerW(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - cchToAppend); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = cchRemaining * sizeof(wchar_t); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(wchar_t) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbDest = cchDest * sizeof(wchar_t); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - cchDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbCatNEx( - __inout_bcount(cbDest) LPTSTR pszDest OPTIONAL, - __in size_t cbDest, - __in LPCTSTR pszSrc OPTIONAL, - __in size_t cbToAppend, - __deref_opt_out_bcount(*pcbRemaining) LPTSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcchRemaining OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncat', with - some additional parameters. In addition to functionality provided by - RtlStringCbCatN, this routine also returns a pointer to the end of the - destination string and the number of bytes left in the destination string - including the null terminator. The flags parameter allows additional controls. - -Arguments: - - pszDest - destination string which must be null terminated - - cbDest - size of destination buffer in bytes. - length must be ((_tcslen(pszDest) + min(cbToAppend / sizeof(TCHAR), _tcslen(pszSrc)) + 1) * sizeof(TCHAR) - to hold all of the combine string plus the null - terminator. - - pszSrc - source string - - cbToAppend - maximum number of bytes to append - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function appended any data, the result will point to the - null termination character - - pcbRemaining - if pcbRemaining is non-null, the function will return the - number of bytes left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")) - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any pre-existing - or truncated string - - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any pre-existing or - truncated string - - STRSAFE_NO_TRUNCATION - if the function returns STATUS_BUFFER_OVERFLOW, pszDest - will not contain a truncated string, it will remain unchanged. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if all of pszSrc or the first cbToAppend bytes were - concatenated to pszDest and the resultant dest string - was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the operation - failed due to insufficient space. When this error - occurs, the destination buffer is modified to contain - a truncated version of the ideal result and is null - terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCbCatNExA( - __inout_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in size_t cbDest, - __in_bcount(cbToAppend) STRSAFE_PCNZCH pszSrc, - __in size_t cbToAppend, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(char); - size_t cchDestLength; - - status = RtlStringExValidateDestAndLengthA(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PSTR pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - size_t cchToAppend = cbToAppend / sizeof(char); - - status = RtlStringExValidateSrcA(&pszSrc, &cchToAppend, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining <= 1) - { - // only fail if there was actually src data to append - if ((cchToAppend != 0) && (*pszSrc != '\0')) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerA(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - cchToAppend); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullA(pszDestEnd, cbRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsA(pszDest, - cbDest, - cchDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - } - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCbCatNExW( - __inout_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __in_bcount(cbToAppend) STRSAFE_PCNZWCH pszSrc, - __in size_t cbToAppend, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - size_t cchDestLength; - - status = RtlStringExValidateDestAndLengthW(pszDest, - cchDest, - &cchDestLength, - NTSTRSAFE_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PWSTR pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - size_t cchToAppend = cbToAppend / sizeof(wchar_t); - -#pragma warning(push) -#pragma warning(disable : __WARNING_POTENTIAL_BUFFER_OVERFLOW_HIGH_PRIORITY) - status = RtlStringExValidateSrcW(&pszSrc, &cchToAppend, NTSTRSAFE_MAX_CCH, dwFlags); -#pragma warning(pop) - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining <= 1) - { - // only fail if there was actually src data to append - if ((cchToAppend != 0) && (*pszSrc != L'\0')) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWorkerW(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - cchToAppend); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - if (NT_SUCCESS(status) && (dwFlags & STRSAFE_FILL_BEHIND_NULL)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - cchDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchVPrintf( - __out_ecount(cchDest) LPTSTR pszDest, - __in size_t cchDest, - __in __format_string LPCTSTR pszFormat, - __in va_list argList - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'vsprintf'. - The size of the destination buffer (in characters) is a parameter and - this function will not write past the end of this buffer and it will - ALWAYS null terminate the destination buffer (unless it is zero length). - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was printed without truncation and null terminated, - otherwise it will return a failure code. In failure cases it will return - a truncated version of the ideal result. - -Arguments: - - pszDest - destination string - - cchDest - size of destination buffer in characters - length must be sufficient to hold the resulting formatted - string, including the null terminator. - - pszFormat - format string which must be null terminated - - argList - va_list from the variable arguments according to the - stdarg.h convention - -Notes: - Behavior is undefined if destination, format strings or any arguments - strings overlap. - - pszDest and pszFormat should not be NULL. See RtlStringCchVPrintfEx if you - require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was sufficient space in the dest buffer for - the resultant string and it was null terminated. - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the print - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCchVPrintfA( - __out_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in size_t cchDest, - __in __format_string NTSTRSAFE_PCSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status; - - status = RtlStringValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - status = RtlStringVPrintfWorkerA(pszDest, - cchDest, - NULL, - pszFormat, - argList); - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCchVPrintfW( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status; - - status = RtlStringValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - status = RtlStringVPrintfWorkerW(pszDest, - cchDest, - NULL, - pszFormat, - argList); - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbVPrintf( - __out_bcount(cbDest) LPTSTR pszDest, - __in size_t cbDest, - __in __format_string LPCTSTR pszFormat, - __in va_list argList - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'vsprintf'. - The size of the destination buffer (in bytes) is a parameter and - this function will not write past the end of this buffer and it will - ALWAYS null terminate the destination buffer (unless it is zero length). - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was printed without truncation and null terminated, - otherwise it will return a failure code. In failure cases it will return - a truncated version of the ideal result. - -Arguments: - - pszDest - destination string - - cbDest - size of destination buffer in bytes - length must be sufficient to hold the resulting formatted - string, including the null terminator. - - pszFormat - format string which must be null terminated - - argList - va_list from the variable arguments according to the - stdarg.h convention - -Notes: - Behavior is undefined if destination, format strings or any arguments - strings overlap. - - pszDest and pszFormat should not be NULL. See RtlStringCbVPrintfEx if you - require the handling of NULL values. - - -Return Value: - - STATUS_SUCCESS - if there was sufficient space in the dest buffer for - the resultant string and it was null terminated. - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the print - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCbVPrintfA( - __out_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in size_t cbDest, - __in __format_string NTSTRSAFE_PCSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(char); - - status = RtlStringValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - status = RtlStringVPrintfWorkerA(pszDest, - cchDest, - NULL, - pszFormat, - argList); - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCbVPrintfW( - __out_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - - status = RtlStringValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - status = RtlStringVPrintfWorkerW(pszDest, - cchDest, - NULL, - pszFormat, - argList); - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef _M_CEE_PURE - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchPrintf( - __out_ecount(cchDest) LPTSTR pszDest, - __in size_t cchDest, - __in __format_string LPCTSTR pszFormat, - ... - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'sprintf'. - The size of the destination buffer (in characters) is a parameter and - this function will not write past the end of this buffer and it will - ALWAYS null terminate the destination buffer (unless it is zero length). - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was printed without truncation and null terminated, - otherwise it will return a failure code. In failure cases it will return - a truncated version of the ideal result. - -Arguments: - - pszDest - destination string - - cchDest - size of destination buffer in characters - length must be sufficient to hold the resulting formatted - string, including the null terminator. - - pszFormat - format string which must be null terminated - - ... - additional parameters to be formatted according to - the format string - -Notes: - Behavior is undefined if destination, format strings or any arguments - strings overlap. - - pszDest and pszFormat should not be NULL. See RtlStringCchPrintfEx if you - require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was sufficient space in the dest buffer for - the resultant string and it was null terminated. - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the print - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCchPrintfA( - __out_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in size_t cchDest, - __in __format_string NTSTRSAFE_PCSTR pszFormat, - ...) -{ - NTSTATUS status; - - status = RtlStringValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - va_list argList; - - va_start(argList, pszFormat); - - status = RtlStringVPrintfWorkerA(pszDest, - cchDest, - NULL, - pszFormat, - argList); - - va_end(argList); - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCchPrintfW( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - ...) -{ - NTSTATUS status; - - status = RtlStringValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - va_list argList; - - va_start(argList, pszFormat); - - status = RtlStringVPrintfWorkerW(pszDest, - cchDest, - NULL, - pszFormat, - argList); - - va_end(argList); - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbPrintf( - __out_bcount(cbDest) LPTSTR pszDest, - __in size_t cbDest, - __in __format_string LPCTSTR pszFormat, - ... - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'sprintf'. - The size of the destination buffer (in bytes) is a parameter and - this function will not write past the end of this buffer and it will - ALWAYS null terminate the destination buffer (unless it is zero length). - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was printed without truncation and null terminated, - otherwise it will return a failure code. In failure cases it will return - a truncated version of the ideal result. - -Arguments: - - pszDest - destination string - - cbDest - size of destination buffer in bytes - length must be sufficient to hold the resulting formatted - string, including the null terminator. - - pszFormat - format string which must be null terminated - - ... - additional parameters to be formatted according to - the format string - -Notes: - Behavior is undefined if destination, format strings or any arguments - strings overlap. - - pszDest and pszFormat should not be NULL. See RtlStringCbPrintfEx if you - require the handling of NULL values. - - -Return Value: - - STATUS_SUCCESS - if there was sufficient space in the dest buffer for - the resultant string and it was null terminated. - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the print - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCbPrintfA( - __out_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in size_t cbDest, - __in __format_string NTSTRSAFE_PCSTR pszFormat, - ...) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(char); - - status = RtlStringValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - va_list argList; - - va_start(argList, pszFormat); - - status = RtlStringVPrintfWorkerA(pszDest, - cchDest, - NULL, - pszFormat, - argList); - - va_end(argList); - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCbPrintfW( - __out_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - ...) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - - status = RtlStringValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH); - - if (NT_SUCCESS(status)) - { - va_list argList; - - va_start(argList, pszFormat); - - status = RtlStringVPrintfWorkerW(pszDest, - cchDest, - NULL, - pszFormat, - argList); - - va_end(argList); - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchPrintfEx( - __out_ecount(cchDest) LPTSTR pszDest OPTIONAL, - __in size_t cchDest, - __deref_opt_out_ecount(*pcchRemaining) LPTSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcchRemaining OPTIONAL, - __in DWORD dwFlags, - __in __format_string LPCTSTR pszFormat OPTIONAL, - ... - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'sprintf' with - some additional parameters. In addition to functionality provided by - RtlStringCchPrintf, this routine also returns a pointer to the end of the - destination string and the number of characters left in the destination string - including the null terminator. The flags parameter allows additional controls. - -Arguments: - - pszDest - destination string - - cchDest - size of destination buffer in characters. - length must be sufficient to contain the resulting - formatted string plus the null terminator. - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function printed any data, the result will point to the - null termination character - - pcchRemaining - if pcchRemaining is non-null, the function will return - the number of characters left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")) - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any truncated - string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - pszFormat - format string which must be null terminated - - ... - additional parameters to be formatted according to - the format string - -Notes: - Behavior is undefined if destination, format strings or any arguments - strings overlap. - - pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS - flag is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and - pszFormat may be NULL. An error may still be returned even though NULLS - are ignored due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was sufficient space in the dest buffer for - the resultant string and it was null terminated. - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the print - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCchPrintfExA( - __out_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in size_t cchDest, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags, - __in __format_string NTSTRSAFE_PCSTR pszFormat, - ...) -{ - NTSTATUS status; - - status = RtlStringExValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcA(&pszFormat, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually a non-empty format string - if (*pszFormat != '\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchNewDestLength = 0; - va_list argList; - - va_start(argList, pszFormat); - - status = RtlStringVPrintfWorkerA(pszDest, - cchDest, - &cchNewDestLength, - pszFormat, - argList); - - va_end(argList); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbRemaining = cchRemaining * sizeof(char); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullA(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(char) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbDest = cchDest * sizeof(char); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsA(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCchPrintfExW( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - ...) -{ - NTSTATUS status; - - status = RtlStringExValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PWSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcW(&pszFormat, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually a non-empty format string - if (*pszFormat != L'\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchNewDestLength = 0; - va_list argList; - - va_start(argList, pszFormat); - - status = RtlStringVPrintfWorkerW(pszDest, - cchDest, - &cchNewDestLength, - pszFormat, - argList); - - va_end(argList); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = cchRemaining * sizeof(wchar_t); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(wchar_t) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbDest = cchDest * sizeof(wchar_t); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbPrintfEx( - __out_bcount(cbDest) LPTSTR pszDest OPTIONAL, - __in size_t cbDest, - __deref_opt_out_bcount(*pcbRemaining) LPTSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcbRemaining OPTIONAL, - __in DWORD dwFlags, - __in __format_string LPCTSTR pszFormat OPTIONAL, - ... - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'sprintf' with - some additional parameters. In addition to functionality provided by - RtlStringCbPrintf, this routine also returns a pointer to the end of the - destination string and the number of bytes left in the destination string - including the null terminator. The flags parameter allows additional controls. - -Arguments: - - pszDest - destination string - - cbDest - size of destination buffer in bytes. - length must be sufficient to contain the resulting - formatted string plus the null terminator. - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function printed any data, the result will point to the - null termination character - - pcbRemaining - if pcbRemaining is non-null, the function will return - the number of bytes left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")) - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any truncated - string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - pszFormat - format string which must be null terminated - - ... - additional parameters to be formatted according to - the format string - -Notes: - Behavior is undefined if destination, format strings or any arguments - strings overlap. - - pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS - flag is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and - pszFormat may be NULL. An error may still be returned even though NULLS - are ignored due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all concatenated and - the resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the print - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCbPrintfExA( - __out_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in size_t cbDest, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags, - __in __format_string NTSTRSAFE_PCSTR pszFormat, - ...) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(char); - - status = RtlStringExValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcA(&pszFormat, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually a non-empty format string - if (*pszFormat != '\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchNewDestLength = 0; - va_list argList; - - va_start(argList, pszFormat); - - status = RtlStringVPrintfWorkerA(pszDest, - cchDest, - &cchNewDestLength, - pszFormat, - argList); - - va_end(argList); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullA(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsA(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - } - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCbPrintfExW( - __out_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - ...) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - - status = RtlStringExValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PWSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcW(&pszFormat, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually a non-empty format string - if (*pszFormat != L'\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchNewDestLength = 0; - va_list argList; - - va_start(argList, pszFormat); - - status = RtlStringVPrintfWorkerW(pszDest, - cchDest, - &cchNewDestLength, - pszFormat, - argList); - - va_end(argList); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && (dwFlags & STRSAFE_FILL_BEHIND_NULL)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - -#endif // !_M_CEE_PURE - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchVPrintfEx( - __out_ecount(cchDest) LPTSTR pszDest OPTIONAL, - __in size_t cchDest, - __deref_opt_out_ecount(*pcchRemaining) LPTSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcchRemaining OPTIONAL, - __in DWORD dwFlags, - __in __format_string LPCTSTR pszFormat OPTIONAL, - __in va_list argList - ); - - -Routine Description: - - This routine is a safer version of the C built-in function 'vsprintf' with - some additional parameters. In addition to functionality provided by - RtlStringCchVPrintf, this routine also returns a pointer to the end of the - destination string and the number of characters left in the destination string - including the null terminator. The flags parameter allows additional controls. - -Arguments: - - pszDest - destination string - - cchDest - size of destination buffer in characters. - length must be sufficient to contain the resulting - formatted string plus the null terminator. - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function printed any data, the result will point to the - null termination character - - pcchRemaining - if pcchRemaining is non-null, the function will return - the number of characters left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")) - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any truncated - string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - pszFormat - format string which must be null terminated - - argList - va_list from the variable arguments according to the - stdarg.h convention - -Notes: - Behavior is undefined if destination, format strings or any arguments - strings overlap. - - pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS - flag is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and - pszFormat may be NULL. An error may still be returned even though NULLS - are ignored due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all concatenated and - the resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the print - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCchVPrintfExA( - __out_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in size_t cchDest, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags, - __in __format_string NTSTRSAFE_PCSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status; - - status = RtlStringExValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcA(&pszFormat, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually a non-empty format string - if (*pszFormat != '\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchNewDestLength = 0; - - status = RtlStringVPrintfWorkerA(pszDest, - cchDest, - &cchNewDestLength, - pszFormat, - argList); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbRemaining = cchRemaining * sizeof(char); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullA(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(char) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbDest = cchDest * sizeof(char); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsA(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCchVPrintfExW( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status; - - status = RtlStringExValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PWSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcW(&pszFormat, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually a non-empty format string - if (*pszFormat != L'\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchNewDestLength = 0; - - status = RtlStringVPrintfWorkerW(pszDest, - cchDest, - &cchNewDestLength, - pszFormat, - argList); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = cchRemaining * sizeof(wchar_t); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(wchar_t) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbDest = cchDest * sizeof(wchar_t); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbVPrintfEx( - __out_bcount(cbDest) LPTSTR pszDest OPTIONAL, - __in size_t cbDest, - __deref_opt_out_bcount(*pcbRemaining) LPTSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcbRemaining OPTIONAL, - __in DWORD dwFlags, - __in __format_string LPCTSTR pszFormat OPTIONAL, - __in va_list argList - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'vsprintf' with - some additional parameters. In addition to functionality provided by - RtlStringCbVPrintf, this routine also returns a pointer to the end of the - destination string and the number of characters left in the destination string - including the null terminator. The flags parameter allows additional controls. - -Arguments: - - pszDest - destination string - - cbDest - size of destination buffer in bytes. - length must be sufficient to contain the resulting - formatted string plus the null terminator. - - ppszDestEnd - if ppszDestEnd is non-null, the function will return - a pointer to the end of the destination string. If the - function printed any data, the result will point to the - null termination character - - pcbRemaining - if pcbRemaining is non-null, the function will return - the number of bytes left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")) - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any truncated - string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - pszFormat - format string which must be null terminated - - argList - va_list from the variable arguments according to the - stdarg.h convention - -Notes: - Behavior is undefined if destination, format strings or any arguments - strings overlap. - - pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS - flag is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and - pszFormat may be NULL. An error may still be returned even though NULLS - are ignored due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all concatenated and - the resultant dest string was null terminated - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the print - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlStringCbVPrintfExA( - __out_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in size_t cbDest, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags, - __in __format_string NTSTRSAFE_PCSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(char); - - status = RtlStringExValidateDestA(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcA(&pszFormat, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually a non-empty format string - if (*pszFormat != '\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchNewDestLength = 0; - - status = RtlStringVPrintfWorkerA(pszDest, - cchDest, - &cchNewDestLength, - pszFormat, - argList); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - cbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullA(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = '\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsA(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - } - } - } - - return status; -} - -NTSTRSAFEDDI -RtlStringCbVPrintfExW( - __out_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - - status = RtlStringExValidateDestW(pszDest, cchDest, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - NTSTRSAFE_PWSTR pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlStringExValidateSrcW(&pszFormat, NULL, NTSTRSAFE_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually a non-empty format string - if (*pszFormat != L'\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchNewDestLength = 0; - - status = RtlStringVPrintfWorkerW(pszDest, - cchDest, - &cchNewDestLength, - pszFormat, - argList); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && (dwFlags & STRSAFE_FILL_BEHIND_NULL)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCchLength( - __in LPCTSTR psz, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchMax, - __out_opt __deref_out_range(<, cchMax) size_t* pcchLength OPTIONAL - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strlen'. - It is used to make sure a string is not larger than a given length, and - it optionally returns the current length in characters not including - the null terminator. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string is non-null and the length including the null - terminator is less than or equal to cchMax characters. - -Arguments: - - psz - string to check the length of - - cchMax - maximum number of characters including the null terminator - that psz is allowed to contain - - pcch - if the function succeeds and pcch is non-null, the current length - in characters of psz excluding the null terminator will be returned. - This out parameter is equivalent to the return value of strlen(psz) - -Notes: - psz can be null but the function will fail - - cchMax should be greater than zero or the function will fail - -Return Value: - - STATUS_SUCCESS - psz is non-null and the length including the null - terminator is less than or equal to cchMax characters - - failure - the operation did not succeed - - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -__checkReturn -NTSTRSAFEDDI -RtlStringCchLengthA( - __in STRSAFE_PCNZCH psz, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchMax, - __out_opt __deref_out_range(<, cchMax) size_t* pcchLength) -{ - NTSTATUS status; - - if ((psz == NULL) || (cchMax > NTSTRSAFE_MAX_CCH)) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlStringLengthWorkerA(psz, cchMax, pcchLength); - } - - if (!NT_SUCCESS(status) && pcchLength) - { - *pcchLength = 0; - } - - return status; -} - -__checkReturn -NTSTRSAFEDDI -RtlStringCchLengthW( - __in STRSAFE_PCNZWCH psz, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchMax, - __out_opt __deref_out_range(<, cchMax) size_t* pcchLength) -{ - NTSTATUS status; - - if ((psz == NULL) || (cchMax > NTSTRSAFE_MAX_CCH)) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlStringLengthWorkerW(psz, cchMax, pcchLength); - } - - if (!NT_SUCCESS(status) && pcchLength) - { - *pcchLength = 0; - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlStringCbLength( - __in LPCTSTR psz, - __in __in_range(1, NTSTRSAFE_MAX_CCH * sizeof(TCHAR)) size_t cbMax, - __out_opt __deref_out_range(<, cbMax) size_t* pcbLength OPTIONAL - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strlen'. - It is used to make sure a string is not larger than a given length, and - it optionally returns the current length in bytes not including - the null terminator. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string is non-null and the length including the null - terminator is less than or equal to cbMax bytes. - -Arguments: - - psz - string to check the length of - - cbMax - maximum number of bytes including the null terminator - that psz is allowed to contain - - pcb - if the function succeeds and pcb is non-null, the current length - in bytes of psz excluding the null terminator will be returned. - This out parameter is equivalent to the return value of strlen(psz) * sizeof(TCHAR) - -Notes: - psz can be null but the function will fail - - cbMax should be greater than or equal to sizeof(TCHAR) or the function will fail - -Return Value: - - STATUS_SUCCESS - psz is non-null and the length including the null - terminator is less than or equal to cbMax bytes - - failure - the operation did not succeed - - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -__checkReturn -NTSTRSAFEDDI -RtlStringCbLengthA( - __in STRSAFE_PCNZCH psz, - __in __in_range(1, NTSTRSAFE_MAX_CCH * sizeof(char)) size_t cbMax, - __out_opt __deref_out_range(<, cbMax) size_t* pcbLength) -{ - NTSTATUS status; - size_t cchMax = cbMax / sizeof(char); - size_t cchLength = 0; - - if ((psz == NULL) || (cchMax > NTSTRSAFE_MAX_CCH)) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlStringLengthWorkerA(psz, cchMax, &cchLength); - } - - if (pcbLength) - { - if (NT_SUCCESS(status)) - { - // safe to multiply cchLength * sizeof(char) since cchLength < NTSTRSAFE_MAX_CCH and sizeof(char) is 1 - *pcbLength = cchLength * sizeof(char); - } - else - { - *pcbLength = 0; - } - } - - return status; -} - -__checkReturn -NTSTRSAFEDDI -RtlStringCbLengthW( - __in STRSAFE_PCNZWCH psz, - __in __in_range(1, NTSTRSAFE_MAX_CCH * sizeof(wchar_t)) size_t cbMax, - __out_opt __deref_out_range(<, cbMax - 1) size_t* pcbLength) -{ - NTSTATUS status; - size_t cchMax = cbMax / sizeof(wchar_t); - size_t cchLength = 0; - - if ((psz == NULL) || (cchMax > NTSTRSAFE_MAX_CCH)) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlStringLengthWorkerW(psz, cchMax, &cchLength); - } - - if (pcbLength) - { - if (NT_SUCCESS(status)) - { - // safe to multiply cchLength * sizeof(wchar_t) since cchLength < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - *pcbLength = cchLength * sizeof(wchar_t); - } - else - { - *pcbLength = 0; - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlUnalignedStringCchLength( - __in LPCUTSTR psz, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchMax, - __out_opt __deref_out_range(<, cchMax) size_t* pcchLength OPTIONAL - ); - -Routine Description: - - This routine is a version of RtlStringCchLength that accepts an unaligned string pointer. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string is non-null and the length including the null - terminator is less than or equal to cchMax characters. - -Arguments: - - psz - string to check the length of - - cchMax - maximum number of characters including the null terminator - that psz is allowed to contain - - pcch - if the function succeeds and pcch is non-null, the current length - in characters of psz excluding the null terminator will be returned. - This out parameter is equivalent to the return value of strlen(psz) - -Notes: - psz can be null but the function will fail - - cchMax should be greater than zero or the function will fail - -Return Value: - - STATUS_SUCCESS - psz is non-null and the length including the null - terminator is less than or equal to cchMax characters - - failure - the operation did not succeed - - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -#ifdef ALIGNMENT_MACHINE -__checkReturn -NTSTRSAFEDDI -RtlUnalignedStringCchLengthW( - __in STRSAFE_PCUNZWCH psz, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchMax, - __out_opt __deref_out_range(<, cchMax) size_t* pcchLength) -{ - NTSTATUS status; - - if ((psz == NULL) || (cchMax > NTSTRSAFE_MAX_CCH)) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlUnalignedStringLengthWorkerW(psz, cchMax, pcchLength); - } - - if (!NT_SUCCESS(status) && pcchLength) - { - *pcchLength = 0; - } - - return status; -} -#else -#define RtlUnalignedStringCchLengthW RtlStringCchLengthW -#endif // !ALIGNMENT_MACHINE -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlUnalignedStringCbLength( - __in LPCUTSTR psz, - __in __in_range(1, NTSTRSAFE_MAX_CCH * sizeof(TCHAR)) size_t cbMax, - __out_opt __deref_out_range(<, cbMax) size_t* pcbLength OPTIONAL - ); - -Routine Description: - - This routine is a version of RtlStringCbLength that accepts an unaligned string pointer. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string is non-null and the length including the null - terminator is less than or equal to cbMax bytes. - -Arguments: - - psz - string to check the length of - - cbMax - maximum number of bytes including the null terminator - that psz is allowed to contain - - pcb - if the function succeeds and pcb is non-null, the current length - in bytes of psz excluding the null terminator will be returned. - This out parameter is equivalent to the return value of strlen(psz) * sizeof(TCHAR) - -Notes: - psz can be null but the function will fail - - cbMax should be greater than or equal to sizeof(TCHAR) or the function will fail - -Return Value: - - STATUS_SUCCESS - psz is non-null and the length including the null - terminator is less than or equal to cbMax bytes - - failure - the operation did not succeed - - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -#ifdef ALIGNMENT_MACHINE -__checkReturn -NTSTRSAFEDDI -RtlUnalignedStringCbLengthW( - __in STRSAFE_PCUNZWCH psz, - __in __in_range(1, NTSTRSAFE_MAX_CCH * sizeof(wchar_t)) size_t cbMax, - __out_opt __deref_out_range(<, cbMax - 1) size_t* pcbLength) -{ - NTSTATUS status; - size_t cchMax = cbMax / sizeof(wchar_t); - size_t cchLength = 0; - - if ((psz == NULL) || (cchMax > NTSTRSAFE_MAX_CCH)) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlUnalignedStringLengthWorkerW(psz, cchMax, &cchLength); - } - - if (pcbLength) - { - if (NT_SUCCESS(status)) - { - // safe to multiply cchLength * sizeof(wchar_t) since cchLength < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - *pcbLength = cchLength * sizeof(wchar_t); - } - else - { - *pcbLength = 0; - } - } - - return status; -} -#else -#define RtlUnalignedStringCbLengthW RtlStringCbLengthW -#endif // !ALIGNMENT_MACHINE -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - -#ifndef NTSTRSAFE_NO_UNICODE_STRING_FUNCTIONS - -/*++ - -NTSTATUS -RtlUnicodeStringInit( - __out PUNICODE_STRING DestinationString, - __in_opt NTSTRSAFE_PCWSTR pszSrc OPTIONAL - ); - -Routine Description: - - The RtlUnicodeStringInit function initializes a counted unicode string from - pszSrc. - - This function returns an NTSTATUS value. It returns STATUS_SUCCESS if the - counted unicode string was sucessfully initialized from pszSrc. In failure - cases the unicode string buffer will be set to NULL, and the Length and - MaximumLength members will be set to zero. - -Arguments: - - DestinationString - pointer to the counted unicode string to be initialized - - pszSrc - source string which must be null or null terminated - -Notes: - DestinationString should not be NULL. See RtlUnicodeStringInitEx if you require - the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - - - failure - the operation did not succeed - - STATUS_INVALID_PARAMETER - - this return value is an indication that the source string - was too large and DestinationString could not be initialized - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringInit( - __out PUNICODE_STRING DestinationString, - __in_opt NTSTRSAFE_PCWSTR pszSrc) -{ - return RtlUnicodeStringInitWorker(DestinationString, - pszSrc, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); -} - - -/*++ - -NTSTATUS -RtlUnicodeStringInitEx( - __out PUNICODE_STRING DestinationString, - __in_opt NTSTRSAFE_PCWSTR pszSrc OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - In addition to functionality provided by RtlUnicodeStringInit, this routine - includes the flags parameter allows additional controls. - - This function returns an NTSTATUS value. It returns STATUS_SUCCESS if the - counted unicode string was sucessfully initialized from pszSrc. In failure - cases the unicode string buffer will be set to NULL, and the Length and - MaximumLength members will be set to zero. - -Arguments: - - DestinationString - pointer to the counted unicode string to be initialized - - pszSrc - source string which must be null terminated - - dwFlags - controls some details of the initialization: - - STRSAFE_IGNORE_NULLS - do not fault on a NULL DestinationString pointer - -Return Value: - - STATUS_SUCCESS - - - failure - the operation did not succeed - - STATUS_INVALID_PARAMETER - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringInitEx( - __out PUNICODE_STRING DestinationString, - __in_opt NTSTRSAFE_PCWSTR pszSrc, - __in DWORD dwFlags) -{ - NTSTATUS status; - - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlUnicodeStringInitWorker(DestinationString, - pszSrc, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - } - - if (!NT_SUCCESS(status) && DestinationString) - { - DestinationString->Length = 0; - DestinationString->MaximumLength = 0; - DestinationString->Buffer = NULL; - } - - return status; -} - - -/*++ - -NTSTATUS -RtlUnicodeStringValidate( - __in PCUNICODE_STRING SourceString - ); - -Routine Description: - - The RtlUnicodeStringValidate function checks the counted unicode string to make - sure that is is valid. - - This function returns an NTSTATUS value. It returns STATUS_SUCCESS if the - counted unicode string is valid. - -Arguments: - - SourceString - pointer to the counted unicode string to be checked - -Notes: - SourceString should not be NULL. See RtlUnicodeStringValidateEx if you require - the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - SourceString is a valid counted unicode string - - failure - the operation did not succeed - - STATUS_INVALID_PARAMETER - - this return value is an indication that SourceString is not a valid - counted unicode string - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringValidate( - __in PCUNICODE_STRING SourceString) -{ - return RtlUnicodeStringValidateWorker(SourceString, NTSTRSAFE_UNICODE_STRING_MAX_CCH, 0); -} - - -/*++ - -NTSTATUS -RtlUnicodeStringValidateEx( - __in PCUNICODE_STRING SourceString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - In addition to functionality provided by RtlUnicodeStringValidate, this routine - includes the flags parameter allows additional controls. - - This function returns an NTSTATUS value. It returns STATUS_SUCCESS if the - counted unicode string is valid. - -Arguments: - - SourceString - pointer to the counted unicode string to be checked - - dwFlags - controls some details of the validation: - - STRSAFE_IGNORE_NULLS - allows SourceString to be NULL (will return STATUS_SUCCESS for this case). - -Return Value: - - STATUS_SUCCESS - SourceString is a valid counted unicode string - - failure - the operation did not succeed - - STATUS_INVALID_PARAMETER - - this return value is an indication that the source string - is not a valide counted unicode string given the flags passed. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringValidateEx( - __in PCUNICODE_STRING SourceString, - __in DWORD dwFlags) -{ - NTSTATUS status; - - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlUnicodeStringValidateWorker(SourceString, NTSTRSAFE_UNICODE_STRING_MAX_CCH, dwFlags); - } - - return status; -} - - -/*++ - -NTSTATUS -RtlStringCchCopyUnicodeString( - __out_ecount(cchDest) PWSTR pszDest, - __in size_t cchDest, - __in PCUNICODE_STRING SourceString, - ); - -Routine Description: - - This routine copies a PUNICODE_STRING to a PWSTR. This function will not - write past the end of this buffer and it will ALWAYS null terminate the - destination buffer (unless it is zero length). - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was copied without truncation, otherwise it - will return a failure code. In failure cases as much of SourceString will be - copied to pszDest as possible. - -Arguments: - - pszDest - destination string - - cchDest - size of destination buffer in characters. - length must be = ((DestinationString->Length / sizeof(wchar_t)) + 1) - to hold all of the source and null terminate the string. - - SourceString - pointer to the counted unicode source string - -Notes: - Behavior is undefined if source and destination strings overlap. - - SourceString and pszDest should not be NULL. See RtlStringCchCopyUnicodeStringEx - if you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied and the - resultant dest string was null terminated - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlStringCchCopyUnicodeString( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __in PCUNICODE_STRING SourceString) -{ - NTSTATUS status; - - status = RtlStringValidateDestW(pszDest, - cchDest, - NTSTRSAFE_UNICODE_STRING_MAX_CCH); - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - status = RtlStringCopyWideCharArrayWorker(pszDest, - cchDest, - NULL, - pszSrc, - cchSrcLength); - } - else - { - *pszDest = L'\0'; - } - } - - return status; -} - - -/*++ - -NTSTATUS -RtlStringCbCopyUnicodeString( - __out_bcount(cbDest) PWSTR pszDest, - __in size_t cbDest, - __in PCUNICODE_STRING SourceString, - ); - -Routine Description: - - This routine copies a PUNICODE_STRING to a PWSTR. This function will not - write past the end of this buffer and it will ALWAYS null terminate the - destination buffer (unless it is zero length). - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was copied without truncation, otherwise it - will return a failure code. In failure cases as much of SourceString will be - copied to pszDest as possible. - -Arguments: - - pszDest - destination string - - cbDest - size of destination buffer in bytes. - length must be = (DestinationString->Length + sizeof(wchar_t)) - to hold all of the source and null terminate the string. - - SourceString - pointer to the counted unicode source string - -Notes: - Behavior is undefined if source and destination strings overlap. - - SourceString and pszDest should not be NULL. See RtlStringCbCopyUnicodeStringEx - if you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied and the - resultant dest string was null terminated - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result and is - null terminated. This is useful for situations where - truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlStringCbCopyUnicodeString( - __out_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __in PCUNICODE_STRING SourceString) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - - status = RtlStringValidateDestW(pszDest, - cchDest, - NTSTRSAFE_UNICODE_STRING_MAX_CCH); - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - status = RtlStringCopyWideCharArrayWorker(pszDest, - cchDest, - NULL, - pszSrc, - cchSrcLength); - } - else - { - // Suppress espx false positive - cchDest cannot be 0 here -#pragma warning(push) -#pragma warning(disable : __WARNING_POTENTIAL_BUFFER_OVERFLOW_HIGH_PRIORITY) - *pszDest = L'\0'; -#pragma warning(pop) - } - } - - return status; -} - - -/*++ - -NTSTATUS -RtlStringCchCopyUnicodeStringEx( - __out_ecount(cchDest) PWSTR pszDest OPTIONAL, - __in size_t cchDest, - __in PCUNICODE_STRING SourceString OPTIONAL, - __deref_opt_out_ecount(*pcchRemaining) PWSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcchRemaining OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine copies a PUNICODE_STRING to a PWSTR. In addition to - functionality provided by RtlStringCchCopyUnicodeString, this routine also - returns a pointer to the end of the destination string and the number of - characters left in the destination string including the null terminator. - The flags parameter allows additional controls. - -Arguments: - - pszDest - destination string - - cchDest - size of destination buffer in characters. - length must be = ((DestinationString->Length / sizeof(wchar_t)) + 1) - to hold all of the source and null terminate the string. - - SourceString - pointer to the counted unicode source string - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function copied any data, the result will point to the - null termination character - - pcchRemaining - if pcchRemaining is non-null, the function will return the - number of characters left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")). - this flag is useful for emulating functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any truncated - string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and SourceString should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and SourceString - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied and the - resultant dest string was null terminated - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlStringCchCopyUnicodeStringEx( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __in PCUNICODE_STRING SourceString, - __deref_opt_out_ecount(*pcchRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcchRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - - status = RtlStringExValidateDestW(pszDest, - cchDest, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - wchar_t* pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if (cchSrcLength != 0) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWideCharArrayWorker(pszDest, - cchDest, - &cchCopied, - pszSrc, - cchSrcLength); - - pszDestEnd = pszDest + cchCopied; - cchRemaining = cchDest - cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND_NULL) && - (cchRemaining > 1)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = cchRemaining * sizeof(wchar_t); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cchDest != 0)) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(wchar_t) since cchDest < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbDest = cchDest * sizeof(wchar_t); - - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - } - - return status; -} - - -/*++ - -NTSTATUS -RtlStringCbCopyUnicodeStringEx( - __out_bcount(cbDest) PWSTR pszDest OPTIONAL, - __in size_t cbDest, - __in PCUNICODE_STRING SourceString OPTIONAL, - __deref_opt_out_bcount(*pcbRemaining) PWSTR* ppszDestEnd OPTIONAL, - __out_opt size_t* pcbRemaining OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine copies a PUNICODE_STRING to a PWSTR. In addition to - functionality provided by RtlStringCbCopyUnicodeString, this routine also - returns a pointer to the end of the destination string and the number of - characters left in the destination string including the null terminator. - The flags parameter allows additional controls. - -Arguments: - - pszDest - destination string - - cchDest - size of destination buffer in characters. - length must be = ((DestinationString->Length / sizeof(wchar_t)) + 1) - to hold all of the source and null terminate the string. - - SourceString - pointer to the counted unicode source string - - ppszDestEnd - if ppszDestEnd is non-null, the function will return a - pointer to the end of the destination string. If the - function copied any data, the result will point to the - null termination character - - pcbRemaining - pcbRemaining is non-null,the function will return the - number of bytes left in the destination string, - including the null terminator - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND_NULL - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - behind the null terminator - - STRSAFE_IGNORE_NULLS - treat NULL string pointers like empty strings (TEXT("")). - this flag is useful for emulating functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer, and it will - be null terminated. This will overwrite any truncated - string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_NULL_ON_FAILURE - if the function fails, the destination buffer will be set - to the empty string. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and SourceString should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and SourceString - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied and the - resultant dest string was null terminated - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlStringCbCopyUnicodeStringEx( - __out_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cbDest, - __in PCUNICODE_STRING SourceString, - __deref_opt_out_bcount(*pcbRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out_opt size_t* pcbRemaining, - __in DWORD dwFlags) -{ - NTSTATUS status; - size_t cchDest = cbDest / sizeof(wchar_t); - - status = RtlStringExValidateDestW(pszDest, - cchDest, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - wchar_t* pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if (cchSrcLength != 0) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlStringCopyWideCharArrayWorker(pszDest, - cchDest, - &cchCopied, - pszSrc, - cchSrcLength); - - pszDestEnd = pszDest + cchCopied; - cchRemaining = cchDest - cchCopied; - - if (NT_SUCCESS(status) && (dwFlags & STRSAFE_FILL_BEHIND_NULL)) - { - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - - // handle the STRSAFE_FILL_BEHIND_NULL flag - RtlStringExHandleFillBehindNullW(pszDestEnd, cbRemaining, dwFlags); - } - } - } - else - { - if (cchDest != 0) - { - *pszDest = L'\0'; - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)) && - (cbDest != 0)) - { - // handle the STRSAFE_FILL_ON_FAILURE, STRSAFE_NULL_ON_FAILURE, and STRSAFE_NO_TRUNCATION flags - RtlStringExHandleOtherFlagsW(pszDest, - cbDest, - 0, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_MAX_CCH and sizeof(wchar_t) is 2 - *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); - } - } - } - - return status; -} - - -/*++ - -NTSTATUS -RtlUnicodeStringCopyString( - __out PUNICODE_STRING DestinationString, - __in LPCTSTR pszSrc - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcpy' for - UNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was copied without truncation, otherwise it - will return a failure code. In failure cases as much of pszSrc will be - copied to DestinationString as possible. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszSrc - source string which must be null terminated - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and pszSrc should not be NULL. See RtlUnicodeStringCopyStringEx - if you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCopyString( - __out PUNICODE_STRING DestinationString, - __in NTSTRSAFE_PCWSTR pszSrc) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - size_t cchNewDestLength = 0; - - status = RtlWideCharArrayCopyStringWorker(pszDest, - cchDest, - &cchNewDestLength, - pszSrc, - NTSTRSAFE_UNICODE_STRING_MAX_CCH); - - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - return status; -} - - -/*++ - -NTSTATUS -RtlUnicodeStringCopy( - __out PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcpy' for - UNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was copied without truncation, otherwise it - will return a failure code. In failure cases as much of SourceString - will be copied to Dest as possible. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - SourceString - pointer to the counted unicode source string - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and SourceString should not be NULL. See RtlUnicodeStringCopyEx - if you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCopy( - __out PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - size_t cchNewDestLength = 0; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - status = RtlWideCharArrayCopyWorker(pszDest, - cchDest, - &cchNewDestLength, - pszSrc, - cchSrcLength); - } - - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - return status; -} - - -/*++ - -NTSTATUS -RtlUnicodeStringCopyStringEx( - __out PUNICODE_STRING DestinationString OPTIONAL, - __in LPCTSTR pszSrc OPTIONAL, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcpy' for - UNICODE_STRINGs with some additional parameters. In addition to the - functionality provided by RtlUnicodeStringCopyString, this routine also - returns a PUNICODE_STRING which points to the end of the destination - string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszSrc - source string which must be null terminated - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL pszSrc like - empty strings (L""). This flag is useful for emulating - functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored. - - Behavior is undefined if DestinationString and RemainingString are the same pointer. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCopyStringEx( - __out PUNICODE_STRING DestinationString, - __in NTSTRSAFE_PCWSTR pszSrc, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - size_t cchNewDestLength = 0; - - status = RtlStringExValidateSrcW(&pszSrc, NULL, NTSTRSAFE_UNICODE_STRING_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if (*pszSrc != L'\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - status = RtlWideCharArrayCopyStringWorker(pszDest, - cchDest, - &cchNewDestLength, - pszSrc, - NTSTRSAFE_UNICODE_STRING_MAX_CCH); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - 0, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} - - -/*++ - -NTSTATUS -RtlUnicodeStringCopyEx( - __out PUNICODE_STRING DestinationString OPTIONAL, - __in PCUNICODE_STRING SourceString OPTIONAL, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcpy' for - UNICODE_STRINGs with some additional parameters. In addition to the - functionality provided by RtlUnicodeStringCopy, this routine - also returns a PUNICODE_STRING which points to the end of the destination - string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - SourceString - pointer to the counted unicode source string - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL pszSrc like - empty strings (L""). This flag is useful for emulating - functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and SourceString should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and SourceString - may be NULL. An error may still be returned even though NULLS are ignored. - - Behavior is undefined if DestinationString and RemainingString are the same pointer. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCopyEx( - __out PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - wchar_t* pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - size_t cchNewDestLength = 0; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if (cchSrcLength != 0) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - status = RtlWideCharArrayCopyWorker(pszDest, - cchDest, - &cchNewDestLength, - pszSrc, - cchSrcLength); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - 0, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCchCopyStringN( - __out PUNICODE_STRING DestinationString, - __in LPCTSTR pszSrc, - __in size_t cchToCopy - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncpy' for - PUNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the entire string or the first cchToCopy characters were - copied without truncation, otherwise it will return a failure code. In - failure cases as much of pszSrc will be copied to DestinationString as possible. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszSrc - source string - - cchToCopy - maximum number of characters to copy from source string, - not including the null terminator. - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and pszSrc should not be NULL. See RtlUnicodeStringCchCopyStringNEx if - you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCchCopyStringN( - __out PUNICODE_STRING DestinationString, - __in NTSTRSAFE_PCWSTR pszSrc, - __in size_t cchToCopy) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - size_t cchNewDestLength = 0; - - if (cchToCopy > NTSTRSAFE_UNICODE_STRING_MAX_CCH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlWideCharArrayCopyStringWorker(pszDest, - cchDest, - &cchNewDestLength, - pszSrc, - cchToCopy); - } - - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCbCopyStringN( - __out PUNICODE_STRING DestinationString, - __in LPCTSTR pszSrc, - __in size_t cbToCopy - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncpy' for - PUNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the entire string or the first cbToCopy bytes were - copied without truncation, otherwise it will return a failure code. In - failure cases as much of pszSrc will be copied to DestinationString as possible. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszSrc - source string - - cbToCopy - maximum number of bytes to copy from source string, - not including the null terminator. - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and pszSrc should not be NULL. See RtlUnicodeStringCopyCbStringEx if you require - the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCbCopyStringN( - __out PUNICODE_STRING DestinationString, - __in NTSTRSAFE_PCWSTR pszSrc, - __in size_t cbToCopy) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - size_t cchNewDestLength = 0; - size_t cchToCopy = cbToCopy / sizeof(wchar_t); - - if (cchToCopy > NTSTRSAFE_UNICODE_STRING_MAX_CCH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = RtlWideCharArrayCopyStringWorker(pszDest, - cchDest, - &cchNewDestLength, - pszSrc, - cchToCopy); - } - - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCchCopyN( - __out PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in size_t cchToCopy - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncpy' for - PUNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the entire string or the first cchToCopy characters were - copied without truncation, otherwise it will return a failure code. In - failure cases as much of SourceString will be copied to DestinationString as possible. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - SourceString - pointer to the counted unicode source string - - cchToCopy - maximum number of characters to copy from source string, - not including the null terminator. - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and SourceString should not be NULL. See RtlUnicodeStringCchCopyNEx - if you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCchCopyN( - __out PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in size_t cchToCopy) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - size_t cchNewDestLength = 0; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - if (cchToCopy > NTSTRSAFE_UNICODE_STRING_MAX_CCH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - if (cchSrcLength < cchToCopy) - { - cchToCopy = cchSrcLength; - } - - status = RtlWideCharArrayCopyWorker(pszDest, - cchDest, - &cchNewDestLength, - pszSrc, - cchToCopy); - } - } - - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCbCopyN( - __out PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in size_t cbToCopy - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncpy' for - PUNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the entire string or the first cbToCopy bytes were - copied without truncation, otherwise it will return a failure code. In - failure cases as much of SourceString will be copied to DestinationString as possible. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - SourceString - pointer to the counted unicode source string - - cbToCopy - maximum number of bytes to copy from source string, - not including the null terminator. - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and SourceString should not be NULL. See RtlUnicodeStringCbCopyNEx - if you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - - -NTSTRSAFEDDI -RtlUnicodeStringCbCopyN( - __out PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in size_t cbToCopy) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - size_t cchNewDestLength = 0; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - size_t cchToCopy = cbToCopy / sizeof(wchar_t); - - if (cchToCopy > NTSTRSAFE_UNICODE_STRING_MAX_CCH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - if (cchSrcLength < cchToCopy) - { - cchToCopy = cchSrcLength; - } - - status = RtlWideCharArrayCopyWorker(pszDest, - cchDest, - &cchNewDestLength, - pszSrc, - cchToCopy); - } - } - - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCchCopyStringNEx( - __out PUNICODE_STRING DestinationString OPTIONAL, - __in LPCTSTR pszSrc OPTIONAL, - __in size_t cchToCopy, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncpy' with - some additional parameters and for PUNICODE_STRINGs. In addition to the - functionality provided by RtlUnicodeStringCchCopyStringN, this routine also - returns a PUNICODE_STRING which points to the end of the destination - string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszSrc - source string - - cchToCopy - maximum number of characters to copy from source string - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL pszSrc like - empty strings (L""). This flag is useful for emulating - functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - -Notes: - Behavior is undefined if source and destination strings overlap. - - pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCchCopyStringNEx( - __out PUNICODE_STRING DestinationString, - __in NTSTRSAFE_PCWSTR pszSrc, - __in size_t cchToCopy, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - size_t cchNewDestLength = 0; - - status = RtlStringExValidateSrcW(&pszSrc, &cchToCopy, NTSTRSAFE_UNICODE_STRING_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if ((cchToCopy != 0) && (*pszSrc != L'\0')) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - status = RtlWideCharArrayCopyStringWorker(pszDest, - cchDest, - &cchNewDestLength, - pszSrc, - cchToCopy); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - 0, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCbCopyStringNEx( - __out PUNICODE_STRING DestinationString OPTIONAL, - __in LPCTSTR pszSrc OPTIONAL, - __in size_t cbToCopy, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncpy' with - some additional parameters and for PUNICODE_STRINGs. In addition to the - functionality provided by RtlUnicodeStringCbCopyStringN, this routine also - returns a PUNICODE_STRING which points to the end of the destination - string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszSrc - source string - - cbToCopy - maximum number of bytes to copy from source string - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL pszSrc like - empty strings (L""). This flag is useful for emulating - functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCbCopyStringNEx( - __out PUNICODE_STRING DestinationString, - __in NTSTRSAFE_PCWSTR pszSrc, - __in size_t cbToCopy, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - size_t cchNewDestLength = 0; - size_t cchToCopy = cbToCopy / sizeof(wchar_t); - - status = RtlStringExValidateSrcW(&pszSrc, &cchToCopy, NTSTRSAFE_UNICODE_STRING_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if ((cchToCopy != 0) && (*pszSrc != L'\0')) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - status = RtlWideCharArrayCopyStringWorker(pszDest, - cchDest, - &cchNewDestLength, - pszSrc, - cchToCopy); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - 0, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCchCopyNEx( - __out PUNICODE_STRING DestinationString OPTIONAL, - __in PCUNICODE_STRING SourceString OPTIONAL, - __in size_t cchToCopy, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncpy' with - some additional parameters and for PUNICODE_STRINGs. In addition to the - functionality provided by RtlUnicodeStringCchCopyN, this - routine also returns a PUNICODE_STRING which points to the end of the - destination string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - SourceString - pointer to the counted unicode source string - - cchToCopy - maximum number of characters to copy from source string - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL SourceString like - empty strings (L""). This flag is useful for emulating - functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and SourceString should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and SourceString - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCchCopyNEx( - __out PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in size_t cchToCopy, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - wchar_t* pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - size_t cchNewDestLength = 0; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - if (cchToCopy > NTSTRSAFE_UNICODE_STRING_MAX_CCH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - if (cchSrcLength < cchToCopy) - { - cchToCopy = cchSrcLength; - } - - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if (cchToCopy != 0) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - status = RtlWideCharArrayCopyWorker(pszDest, - cchDest, - &cchNewDestLength, - pszSrc, - cchToCopy); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - 0, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCbCopyNEx( - __out PUNICODE_STRING DestinationString OPTIONAL, - __in PCUNICODE_STRING SourceString OPTIONAL, - __in size_t cbToCopy, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncpy' with - some additional parameters and for PUNICODE_STRINGs. In addition to the - functionality provided by RtlUnicodeStringCbCopyN, this - routine also returns a PUNICODE_STRING which points to the end of the - destination string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - SourceString - pointer to the counted unicode source string - - cbToCopy - maximum number of bytes to copy from source string - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL SourceString like - empty strings (L""). This flag is useful for emulating - functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and SourceString should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and SourceString - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all copied - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the copy - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCbCopyNEx( - __out PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in size_t cbToCopy, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - wchar_t* pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - size_t cchNewDestLength = 0; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - size_t cchToCopy = cbToCopy / sizeof(wchar_t); - - if (cchToCopy > NTSTRSAFE_UNICODE_STRING_MAX_CCH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - if (cchSrcLength < cchToCopy) - { - cchToCopy = cchSrcLength; - } - - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchDest == 0) - { - // only fail if there was actually src data to copy - if (cchToCopy != 0) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - status = RtlWideCharArrayCopyWorker(pszDest, - cchDest, - &cchNewDestLength, - pszSrc, - cchToCopy); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - 0, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -/*++ - -NTSTATUS -RtlUnicodeStringCatString( - __inout PUNICODE_STRING DestinationString, - __in LPCTSTR pszSrc - ); - - Routine Description: - - This routine is a safer version of the C built-in function 'strcat' for - UNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was concatenated without truncation, otherwise - it will return a failure code. In failure cases as much of pszSrc will be - appended to DestinationString as possible. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszSrc - source string which must be null terminated - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and pszSrc should not be NULL. See RtlUnicodeStringCatStringEx - if you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all concatenated - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCatString( - __inout PUNICODE_STRING DestinationString, - __in NTSTRSAFE_PCWSTR pszSrc) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - size_t cchDestLength; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - &cchDestLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - size_t cchCopied = 0; - - status = RtlWideCharArrayCopyStringWorker(pszDest + cchDestLength, - cchDest - cchDestLength, - &cchCopied, - pszSrc, - NTSTRSAFE_UNICODE_STRING_MAX_CCH); - - // safe to multiply (cchDestLength + cchCopied) * sizeof(wchar_t) since (cchDestLength + cchCopied) < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)((cchDestLength + cchCopied) * sizeof(wchar_t)); - } - - return status; -} - - -/*++ - -NTSTATUS -RtlUnicodeStringCat( - __inout PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString - ); - - Routine Description: - - This routine is a safer version of the C built-in function 'strcat' for - UNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was concatenated without truncation, otherwise - it will return a failure code. In failure cases as much of SourceString will be - appended to DestinationString as possible. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - SourceString - pointer to the counted unicode source string - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and pszSrc should not be NULL. See RtlUnicodeStringCatEx - if you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all concatenated - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function. - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCat( - __inout PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - size_t cchDestLength; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - &cchDestLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - size_t cchCopied = 0; - - status = RtlWideCharArrayCopyWorker(pszDest + cchDestLength, - cchDest - cchDestLength, - &cchCopied, - pszSrc, - cchSrcLength); - - // safe to multiply (cchDestLength + cchCopied) * sizeof(wchar_t) since (cchDestLength + cchCopied) < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)((cchDestLength + cchCopied) * sizeof(wchar_t)); - } - } - - return status; -} - - -/*++ - -NTSTATUS -RtlUnicodeStringCatStringEx( - __inout PUNICODE_STRING DestinationString OPTTONAL, - __in LPCTSTR pszSrc OPTIONAL, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcat' for - PUNICODE_STRINGs with some additional parameters. In addition to the - functionality provided by RtlUnicodeStringCatString, this routine - also returns a PUNICODE_STRING which points to the end of the destination - string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszSrc - source string which must be null terminated - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL pszSrc like - empty strings (L""). This flag is useful for emulating - functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - STRSAFE_NO_TRUNCATION - if the function returns STATUS_BUFFER_OVERFLOW, pszDest - will not contain a truncated string, it will remain unchanged. - -Notes: - Behavior is undefined if source and destination strings overlap or if - DestinationString and RemainingString are the same pointer. - - DestinationString and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all concatenated - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCatStringEx( - __inout PUNICODE_STRING DestinationString, - __in NTSTRSAFE_PCWSTR pszSrc, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - size_t cchDestLength; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - &cchDestLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - size_t cchNewDestLength = cchDestLength; - - status = RtlStringExValidateSrcW(&pszSrc, NULL, NTSTRSAFE_UNICODE_STRING_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining == 0) - { - // only fail if there was actually src data to append - if (*pszSrc != L'\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlWideCharArrayCopyStringWorker(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - NTSTRSAFE_UNICODE_STRING_MAX_CCH); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - cchNewDestLength = cchDestLength + cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - cchDestLength, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} - - -/*++ - -NTSTATUS -RtlUnicodeStringCatEx( - __inout PUNICODE_STRING DestinationString OPTIONAL, - __in PCUNICODE_STRING SourceString OPTIONAL, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strcat' for - PUNICODE_STRINGs with some additional parameters. In addition to the - functionality provided by RtlUnicodeStringCat, this routine - also returns a PUNICODE_STRING which points to the end of the destination - string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - SourceString - pointer to the counted unicode source string - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL pszSrc like - empty strings (L""). This flag is useful for emulating - functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - STRSAFE_NO_TRUNCATION - if the function returns STATUS_BUFFER_OVERFLOW, pszDest - will not contain a truncated string, it will remain unchanged. - -Notes: - Behavior is undefined if source and destination strings overlap or if - DestinationString and RemainingString are the same pointer. - - DestinationString and SourceString should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and SourceString - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was source data and it was all concatenated - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCatEx( - __inout PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - size_t cchDestLength; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - &cchDestLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - wchar_t* pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - size_t cchNewDestLength = cchDestLength; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining == 0) - { - // only fail if there was actually src data to append - if (cchSrcLength != 0) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlWideCharArrayCopyWorker(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - cchSrcLength); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - cchNewDestLength = cchDestLength + cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - cchDestLength, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCchCatStringN( - __inout PUNICODE_STRING DestinationString, - __in LPCTSTR pszSrc, - __in size_t cchToAppend - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncat' for - PUNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if all of pszSrc or the first cchToAppend characters were - appended to the destination string, otherwise it will return a failure - code. In failure cases as much of pszSrc will be appended to DestinationString as - possible. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszSrc - source string - - cchToAppend - maximum number of characters to append - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and pszSrc should not be NULL. See RtlUnicodeStringCchCatStringNEx if - you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if all of pszSrc or the first cchToAppend characters were - concatenated to DestinationString - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCchCatStringN( - __inout PUNICODE_STRING DestinationString, - __in NTSTRSAFE_PCWSTR pszSrc, - __in size_t cchToAppend) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - size_t cchDestLength; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - &cchDestLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - if (cchToAppend > NTSTRSAFE_UNICODE_STRING_MAX_CCH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - size_t cchCopied = 0; - - status = RtlWideCharArrayCopyStringWorker(pszDest + cchDestLength, - cchDest - cchDestLength, - &cchCopied, - pszSrc, - cchToAppend); - - // safe to multiply (cchDestLength + cchCopied) * sizeof(wchar_t) since (cchDestLength + cchCopied) < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)((cchDestLength + cchCopied) * sizeof(wchar_t)); - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCbCatStringN( - __inout PUNICODE_STRING DestinationString, - __in LPCTSTR pszSrc, - __in size_t cbToAppend - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncat' for - PUNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if all of pszSrc or the first cbToAppend bytes were - appended to the destination string, otherwise it will return a failure - code. In failure cases as much of pszSrc will be appended to DestinationString as - possible. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszSrc - source string - - cbToAppend - maximum number of bytes to append - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and pszSrc should not be NULL. See RtlUnicodeStringCbCatStringNEx if - you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if all of pszSrc or the first cbToAppend bytes were - concatenated to pszDest - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCbCatStringN( - __inout PUNICODE_STRING DestinationString, - __in NTSTRSAFE_PCWSTR pszSrc, - __in size_t cbToAppend) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - size_t cchDestLength; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - &cchDestLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - size_t cchToAppend = cbToAppend / sizeof(wchar_t); - - if (cchToAppend > NTSTRSAFE_UNICODE_STRING_MAX_CCH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - size_t cchCopied = 0; - - status = RtlWideCharArrayCopyStringWorker(pszDest + cchDestLength, - cchDest - cchDestLength, - &cchCopied, - pszSrc, - cchToAppend); - - // safe to multiply (cchDestLength + cchCopied) * sizeof(wchar_t) since (cchDestLength + cchCopied) < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)((cchDestLength + cchCopied) * sizeof(wchar_t)); - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCchCatN( - __inout PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in size_t cchToAppend - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncat' for - PUNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if all of SourceString or the first cchToAppend characters were - appended to the destination string, otherwise it will return a failure - code. In failure cases as much of SourceString will be appended to DestinationString as - possible. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - SourceString - pointer to the counted unicode source string - - cchToAppend - maximum number of characters to append - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and SourceString should not be NULL. See RtlUnicodeStringCchCatNEx if - you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if all of SourceString or the first cchToAppend characters were - concatenated to DestinationString - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCchCatN( - __inout PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in size_t cchToAppend) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - size_t cchDestLength; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - &cchDestLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - if (cchToAppend > NTSTRSAFE_UNICODE_STRING_MAX_CCH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - size_t cchCopied = 0; - - if (cchSrcLength < cchToAppend) - { - cchToAppend = cchSrcLength; - } - - status = RtlWideCharArrayCopyWorker(pszDest + cchDestLength, - cchDest - cchDestLength, - &cchCopied, - pszSrc, - cchToAppend); - - // safe to multiply (cchDestLength + cchCopied) * sizeof(wchar_t) since (cchDestLength + cchCopied) < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)((cchDestLength + cchCopied) * sizeof(wchar_t)); - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCbCatN( - __inout PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in size_t cbToAppend - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncat' for - PUNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if all of SourceString or the first cbToAppend bytes were - appended to the destination string, otherwise it will return a failure - code. In failure cases as much of SourceString will be appended to DestinationString as - possible. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - SourceString - pointer to the counted unicode source string - - cbToAppend - maximum number of bytes to append - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and SourceString should not be NULL. See RtlUnicodeStringCbCatNEx if - you require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if all of SourceString or the first cbToAppend bytes were - concatenated to pszDest - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCbCatN( - __inout PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in size_t cbToAppend) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - size_t cchDestLength; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - &cchDestLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - size_t cchToAppend = cbToAppend / sizeof(wchar_t); - - if (cchToAppend > NTSTRSAFE_UNICODE_STRING_MAX_CCH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - size_t cchCopied = 0; - - if (cchSrcLength < cchToAppend) - { - cchToAppend = cchSrcLength; - } - - status = RtlWideCharArrayCopyWorker(pszDest + cchDestLength, - cchDest - cchDestLength, - &cchCopied, - pszSrc, - cchToAppend); - - // safe to multiply (cchDestLength + cchCopied) * sizeof(wchar_t) since (cchDestLength + cchCopied) < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)((cchDestLength + cchCopied) * sizeof(wchar_t)); - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCchCatStringNEx( - __inout PUNICODE_STRING DestinationString OPTIONAL, - __in LPCTSTR pszSrc OPTIONAL, - __in size_t cchToAppend, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncat', with - some additional parameters and for PUNICODE_STRINGs. In addition to the - functionality provided by RtlUnicodeStringCchCatStringN, this routine - also returns a PUNICODE_STRING which points to the end of the destination - string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszSrc - source string - - cchToAppend - maximum number of characters to append - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL pszSrc like - empty strings (L""). This flag is useful for emulating - functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - STRSAFE_NO_TRUNCATION - if the function returns STATUS_BUFFER_OVERFLOW, pszDest - will not contain a truncated string, it will remain unchanged. - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if all of pszSrc or the first cchToAppend characters were - concatenated to DestinationString - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCchCatStringNEx( - __inout PUNICODE_STRING DestinationString, - __in NTSTRSAFE_PCWSTR pszSrc, - __in size_t cchToAppend, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - size_t cchDestLength; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - &cchDestLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - size_t cchNewDestLength = cchDestLength; - - status = RtlStringExValidateSrcW(&pszSrc, &cchToAppend, NTSTRSAFE_UNICODE_STRING_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining == 0) - { - // only fail if there was actually src data to append - if ((cchToAppend != 0) && (*pszSrc != L'\0')) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlWideCharArrayCopyStringWorker(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - cchToAppend); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - cchNewDestLength = cchDestLength + cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - cchDestLength, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCbCatStringNEx( - __inout PUNICODE_STRING DestinationString OPTIONAL, - __in LPCTSTR pszSrc OPTIONAL, - __in size_t cbToAppend, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncat', with - some additional parameters and for PUNICODE_STRINGs. In addition to the - functionality provided by RtlUnicodeStringCbCatStringN, this routine - also returns a PUNICODE_STRING which points to the end of the destination - string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszSrc - source string - - cbToAppend - maximum number of bytes to append - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL pszSrc like - empty strings (L""). This flag is useful for emulating - functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - STRSAFE_NO_TRUNCATION - if the function returns STATUS_BUFFER_OVERFLOW, pszDest - will not contain a truncated string, it will remain unchanged. - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and pszSrc - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if all of pszSrc or the first cbToAppend bytes were - concatenated to pszDest - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCbCatStringNEx( - __inout PUNICODE_STRING DestinationString, - __in NTSTRSAFE_PCWSTR pszSrc, - __in size_t cbToAppend, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - size_t cchDestLength; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - &cchDestLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - size_t cchNewDestLength = cchDestLength; - size_t cchToAppend = cbToAppend / sizeof(wchar_t); - - status = RtlStringExValidateSrcW(&pszSrc, &cchToAppend, NTSTRSAFE_UNICODE_STRING_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining == 0) - { - // only fail if there was actually src data to append - if ((cchToAppend != 0) && (*pszSrc != L'\0')) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlWideCharArrayCopyStringWorker(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - cchToAppend); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - cchNewDestLength = cchDestLength + cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - cchDestLength, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CCH_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCchCatNEx( - __inout PUNICODE_STRING DestinationString OPTIONAL, - __in PCUNICODE_STRING SourceString OPTIONAL, - __in size_t cchToAppend, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncat', with - some additional parameters and for PUNICODE_STRINGs. In addition to the - functionality provided by RtlUnicodeStringCchCatN, this routine - also returns a PUNICODE_STRING which points to the end of the destination - string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - SourceString - pointer to the counted unicode source string - - cchToAppend - maximum number of characters to append - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL SourceString like - empty strings (L""). This flag is useful for emulating - functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - STRSAFE_NO_TRUNCATION - if the function returns STATUS_BUFFER_OVERFLOW, pszDest - will not contain a truncated string, it will remain unchanged. - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and SourceString should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and SourceString - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if all of SourceString or the first cchToAppend characters were - concatenated to DestinationString - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCchCatNEx( - __inout PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in size_t cchToAppend, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - size_t cchDestLength; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - &cchDestLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - wchar_t* pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - size_t cchNewDestLength = cchDestLength; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - if (cchToAppend > NTSTRSAFE_UNICODE_STRING_MAX_CCH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - if (cchSrcLength < cchToAppend) - { - cchToAppend = cchSrcLength; - } - - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining == 0) - { - // only fail if there was actually src data to append - if (cchToAppend != 0) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlWideCharArrayCopyStringWorker(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - cchToAppend); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - cchNewDestLength = cchDestLength + cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - cchDestLength, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CCH_FUNCTIONS - - -#ifndef NTSTRSAFE_NO_CB_FUNCTIONS -/*++ - -NTSTATUS -RtlUnicodeStringCbCatNEx( - __inout PUNICODE_STRING DestinationString OPTIONAL, - __in PCUNICODE_STRING SourceString OPTIONAL, - __in size_t cbToAppend, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'strncat', with - some additional parameters and for PUNICODE_STRINGs. In addition to the - functionality provided by RtlUnicodeStringCbCatN, this routine - also returns a PUNICODE_STRING which points to the end of the destination - string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - SourceString - pointer to the counted unicode source string - - cbToAppend - maximum number of bytes to append - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL SourceString like - empty strings (L""). This flag is useful for emulating - functions like lstrcpy - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - STRSAFE_NO_TRUNCATION - if the function returns STATUS_BUFFER_OVERFLOW, pszDest - will not contain a truncated string, it will remain unchanged. - -Notes: - Behavior is undefined if source and destination strings overlap. - - DestinationString and SourceString should not be NULL unless the STRSAFE_IGNORE_NULLS flag - is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and SourceString - may be NULL. An error may still be returned even though NULLS are ignored - due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if all of SourceString or the first cbToAppend bytes were - concatenated to DestinationString - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. - This is useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringCbCatNEx( - __inout PUNICODE_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in size_t cbToAppend, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - size_t cchDestLength; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - &cchDestLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszSrc; - size_t cchSrcLength; - wchar_t* pszDestEnd = pszDest + cchDestLength; - size_t cchRemaining = cchDest - cchDestLength; - size_t cchNewDestLength = cchDestLength; - - status = RtlUnicodeStringValidateSrcWorker(SourceString, - &pszSrc, - &cchSrcLength, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - size_t cchToAppend = cbToAppend / sizeof(wchar_t); - - if (cchToAppend > NTSTRSAFE_UNICODE_STRING_MAX_CCH) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - if (cchSrcLength < cchToAppend) - { - cchToAppend = cchSrcLength; - } - - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchRemaining == 0) - { - // only fail if there was actually src data to append - if (cchToAppend != 0) - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - size_t cchCopied = 0; - - status = RtlWideCharArrayCopyWorker(pszDestEnd, - cchRemaining, - &cchCopied, - pszSrc, - cchToAppend); - - pszDestEnd = pszDestEnd + cchCopied; - cchRemaining = cchRemaining - cchCopied; - - cchNewDestLength = cchDestLength + cchCopied; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - cchDestLength, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} -#endif // !NTSTRSAFE_NO_CB_FUNCTIONS - - -/*++ - -NTSTATUS -RtlUnicodeStringVPrintf( - __out PUNICODE_STRING DestinationString, - __in __format_string PCWSTR pszFormat, - __in va_list argList - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'vsprintf' for - PUNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was printed without truncation, otherwise it - will return a failure code. In failure cases it will return a truncated - version of the ideal result. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszFormat - format string which must be null terminated - - argList - va_list from the variable arguments according to the - stdarg.h convention - -Notes: - Behavior is undefined if destination, format strings or any arguments - strings overlap. - - DestinationString and pszFormat should not be NULL. See RtlUnicodeStringVPrintfEx if you - require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was sufficient space in the dest buffer for - the resultant string - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the print - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringVPrintf( - __out PUNICODE_STRING DestinationString, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - size_t cchNewDestLength = 0; - - status = RtlWideCharArrayVPrintfWorker(pszDest, - cchDest, - &cchNewDestLength, - pszFormat, - argList); - - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - return status; -} - - -/*++ - -NTSTATUS -RtlUnicodeStringVPrintfEx( - __out PUNICODE_STRING DestinationString OPTIONAL, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags, - __in __format_string PCWSTR pszFormat OPTIONAL, - __in va_list argList - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'vsprintf' with - some additional parameters for PUNICODE_STRING. In addition to the - functionality provided by RtlUnicodeStringVPrintf, this routine also - returns a PUNICODE_STRING which points to the end of the destination - string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL pszFormat like - empty strings (L""). - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - pszFormat - format string which must be null terminated - - argList - va_list from the variable arguments according to the - stdarg.h convention - -Notes: - Behavior is undefined if destination, format strings or any arguments - strings overlap. - - DestinationString and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS - flag is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and - pszFormat may be NULL. An error may still be returned even though NULLS - are ignored due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was sufficient space in the dest buffer for - the resultant string - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the print - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringVPrintfEx( - __out PUNICODE_STRING DestinationString, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - size_t cchNewDestLength = 0; - - status = RtlStringExValidateSrcW(&pszFormat, NULL, NTSTRSAFE_UNICODE_STRING_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchDest == 0) - { - // only fail if there was actually a non-empty format string - if (*pszFormat != L'\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - status = RtlWideCharArrayVPrintfWorker(pszDest, - cchDest, - &cchNewDestLength, - pszFormat, - argList); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - 0, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} - - -#ifndef _M_CEE_PURE - -/*++ - -NTSTATUS -RtlUnicodeStringPrintf( - __out PUNICODE_STRING DestinationString, - __in __format_string PCWSTR pszFormat, - ... - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'sprintf' for - PUNICODE_STRINGs. - - This function returns an NTSTATUS value, and not a pointer. It returns - STATUS_SUCCESS if the string was printed without truncation, otherwise it - will return a failure code. In failure cases it will return a truncated - version of the ideal result. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - pszFormat - format string which must be null terminated - - ... - additional parameters to be formatted according to - the format string - -Notes: - Behavior is undefined if destination, format strings or any arguments - strings overlap. - - DestinationString and pszFormat should not be NULL. See RtlUnicodeStringPrintfEx if you - require the handling of NULL values. - -Return Value: - - STATUS_SUCCESS - if there was sufficient space in the dest buffer for - the resultant string - - failure - the operation did not succeed - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the print - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringPrintf( - __out PUNICODE_STRING DestinationString, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - ...) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - 0); - - if (NT_SUCCESS(status)) - { - va_list argList; - size_t cchNewDestLength = 0; - - va_start(argList, pszFormat); - - status = RtlWideCharArrayVPrintfWorker(pszDest, - cchDest, - &cchNewDestLength, - pszFormat, - argList); - - va_end(argList); - - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - return status; -} - - -/*++ - -NTSTATUS -RtlUnicodeStringPrintfEx( - __out PUNICODE_STRING DestinationString OPTIONAL, - __out_opt PUNICODE_STRING RemainingString OPTIONAL, - __in DWORD dwFlags, - __in __format_string PCWSTR pszFormat OPTIONAL, - ... - ); - -Routine Description: - - This routine is a safer version of the C built-in function 'sprintf' with - some additional parameters for PUNICODE_STRINGs. In addition to the - functionality provided by RtlUnicodeStringPrintf, this routine also - returns a PUNICODE_STRING which points to the end of the destination - string. The flags parameter allows additional controls. - -Arguments: - - DestinationString - pointer to the counted unicode destination string - - RemainingString - if RemainingString is non-null, the function will format - the pointer with the remaining buffer and number of - bytes left in the destination string - - dwFlags - controls some details of the string copy: - - STRSAFE_FILL_BEHIND - if the function succeeds, the low byte of dwFlags will be - used to fill the uninitialize part of destination buffer - - STRSAFE_IGNORE_NULLS - do not fault if DestinationString is null and treat NULL pszFormat like - empty strings (L""). - - STRSAFE_FILL_ON_FAILURE - if the function fails, the low byte of dwFlags will be - used to fill all of the destination buffer. This will - overwrite any truncated string returned when the failure is - STATUS_BUFFER_OVERFLOW - - STRSAFE_NO_TRUNCATION / - STRSAFE_ZERO_LENGTH_ON_FAILURE - if the function fails, the destination Length will be set - to zero. This will overwrite any truncated string - returned when the failure is STATUS_BUFFER_OVERFLOW. - - pszFormat - format string which must be null terminated - - ... - additional parameters to be formatted according to - the format string - -Notes: - Behavior is undefined if destination, format strings or any arguments - strings overlap. - - DestinationString and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS - flag is specified. If STRSAFE_IGNORE_NULLS is passed, both DestinationString and - pszFormat may be NULL. An error may still be returned even though NULLS - are ignored due to insufficient space. - -Return Value: - - STATUS_SUCCESS - if there was sufficient space in the dest buffer for - the resultant string - - failure - the operation did not succeed - - - STATUS_BUFFER_OVERFLOW - Note: This status has the severity class Warning - IRPs completed with this - status do have their data copied back to user mode - - this return value is an indication that the print - operation failed due to insufficient space. When this - error occurs, the destination buffer is modified to - contain a truncated version of the ideal result. This is - useful for situations where truncation is ok. - - It is strongly recommended to use the NT_SUCCESS() macro to test the - return value of this function - ---*/ - -NTSTRSAFEDDI -RtlUnicodeStringPrintfEx( - __out PUNICODE_STRING DestinationString, - __out_opt PUNICODE_STRING RemainingString, - __in DWORD dwFlags, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - ...) -{ - NTSTATUS status; - wchar_t* pszDest; - size_t cchDest; - - status = RtlUnicodeStringValidateDestWorker(DestinationString, - &pszDest, - &cchDest, - NULL, - NTSTRSAFE_UNICODE_STRING_MAX_CCH, - dwFlags); - - if (NT_SUCCESS(status)) - { - wchar_t* pszDestEnd = pszDest; - size_t cchRemaining = cchDest; - size_t cchNewDestLength = 0; - - status = RtlStringExValidateSrcW(&pszFormat, NULL, NTSTRSAFE_UNICODE_STRING_MAX_CCH, dwFlags); - - if (NT_SUCCESS(status)) - { - if (dwFlags & (~STRSAFE_UNICODE_STRING_VALID_FLAGS)) - { - status = STATUS_INVALID_PARAMETER; - } - else if (cchDest == 0) - { - // only fail if there was actually a non-empty format string - if (*pszFormat != L'\0') - { - if (pszDest == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else - { - status = STATUS_BUFFER_OVERFLOW; - } - } - } - else - { - va_list argList; - - va_start(argList, pszFormat); - - status = RtlWideCharArrayVPrintfWorker(pszDest, - cchDest, - &cchNewDestLength, - pszFormat, - argList); - - va_end(argList); - - pszDestEnd = pszDest + cchNewDestLength; - cchRemaining = cchDest - cchNewDestLength; - - if (NT_SUCCESS(status) && - (dwFlags & STRSAFE_FILL_BEHIND) && - (cchRemaining != 0)) - { - // handle the STRSAFE_FILL_BEHIND flag - RtlUnicodeStringExHandleFill(pszDestEnd, cchRemaining, dwFlags); - } - } - } - - if (!NT_SUCCESS(status) && - (dwFlags & (STRSAFE_NO_TRUNCATION | STRSAFE_FILL_ON_FAILURE | STRSAFE_ZERO_LENGTH_ON_FAILURE)) && - (cchDest != 0)) - { - // handle the STRSAFE_NO_TRUNCATION, STRSAFE_FILL_ON_FAILURE, and STRSAFE_ZERO_LENGTH_ON_FAILURE flags - RtlUnicodeStringExHandleOtherFlags(pszDest, - cchDest, - 0, - &cchNewDestLength, - &pszDestEnd, - &cchRemaining, - dwFlags); - } - - if (DestinationString) - { - // safe to multiply cchNewDestLength * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - DestinationString->Length = (USHORT)(cchNewDestLength * sizeof(wchar_t)); - } - - if (NT_SUCCESS(status) || (status == STATUS_BUFFER_OVERFLOW)) - { - if (RemainingString) - { - RemainingString->Length = 0; - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - RemainingString->MaximumLength = (USHORT)(cchRemaining * sizeof(wchar_t)); - RemainingString->Buffer = pszDestEnd; - } - } - } - - return status; -} - -#endif // !_M_CEE_PURE - -#endif // !NTSTRSAFE_NO_UNICODE_STRING_FUNCTIONS - -#endif // !NTSTRSAFE_LIB_IMPL - - -// Below here are the worker functions that actually do the work - -#if defined(NTSTRSAFE_LIB_IMPL) || !defined(NTSTRSAFE_LIB) - -NTSTRSAFEWORKERDDI -RtlStringLengthWorkerA( - __in STRSAFE_PCNZCH psz, - __in __in_range(<=, NTSTRSAFE_MAX_CCH) size_t cchMax, - __out_opt __deref_out_range(<, cchMax) size_t* pcchLength) -{ - NTSTATUS status = STATUS_SUCCESS; - size_t cchOriginalMax = cchMax; - - while (cchMax && (*psz != '\0')) - { - psz++; - cchMax--; - } - - if (cchMax == 0) - { - // the string is longer than cchMax - status = STATUS_INVALID_PARAMETER; - } - - if (pcchLength) - { - if (NT_SUCCESS(status)) - { - *pcchLength = cchOriginalMax - cchMax; - } - else - { - *pcchLength = 0; - } - } - - return status; -} - -NTSTRSAFEWORKERDDI -RtlStringLengthWorkerW( - __in STRSAFE_PCNZWCH psz, - __in __in_range(<=, NTSTRSAFE_MAX_CCH) size_t cchMax, - __out_opt __deref_out_range(<, cchMax) size_t* pcchLength) -{ - NTSTATUS status = STATUS_SUCCESS; - size_t cchOriginalMax = cchMax; - - while (cchMax && (*psz != L'\0')) - { - psz++; - cchMax--; - } - - if (cchMax == 0) - { - // the string is longer than cchMax - status = STATUS_INVALID_PARAMETER; - } - - if (pcchLength) - { - if (NT_SUCCESS(status)) - { - *pcchLength = cchOriginalMax - cchMax; - } - else - { - *pcchLength = 0; - } - } - - return status; -} - -#ifdef ALIGNMENT_MACHINE -NTSTRSAFEWORKERDDI -RtlUnalignedStringLengthWorkerW( - __in STRSAFE_PCUNZWCH psz, - __in __in_range(<=, NTSTRSAFE_MAX_CCH) size_t cchMax, - __out_opt __deref_out_range(<, cchMax) size_t* pcchLength) -{ - NTSTATUS status = STATUS_SUCCESS; - size_t cchOriginalMax = cchMax; - - while (cchMax && (*psz != L'\0')) - { - psz++; - cchMax--; - } - - if (cchMax == 0) - { - // the string is longer than cchMax - status = STATUS_INVALID_PARAMETER; - } - - if (pcchLength) - { - if (NT_SUCCESS(status)) - { - *pcchLength = cchOriginalMax - cchMax; - } - else - { - *pcchLength = 0; - } - } - - return status; -} -#endif // ALIGNMENT_MACHINE - -// Intentionally allow null deref when STRSAFE_IGNORE_NULLS is not present. -#pragma warning(push) -#pragma warning(disable : __WARNING_DEREF_NULL_PTR) -#pragma warning(disable : __WARNING_INVALID_PARAM_VALUE_1) -#pragma warning(disable : __WARNING_RETURNING_BAD_RESULT) - -NTSTRSAFEWORKERDDI -RtlStringExValidateSrcA( - __deref_in_opt_out NTSTRSAFE_PCSTR* ppszSrc, - __inout_opt __deref_out_range(<, cchMax) size_t* pcchToRead, - __in const size_t cchMax, - __in DWORD dwFlags) -{ - NTSTATUS status = STATUS_SUCCESS; - - if (pcchToRead && (*pcchToRead >= cchMax)) - { - status = STATUS_INVALID_PARAMETER; - } - else if ((dwFlags & STRSAFE_IGNORE_NULLS) && (*ppszSrc == NULL)) - { - *ppszSrc = ""; - - if (pcchToRead) - { - *pcchToRead = 0; - } - } - - return status; -} - -NTSTRSAFEWORKERDDI -RtlStringExValidateSrcW( - __deref_in_opt_out NTSTRSAFE_PCWSTR* ppszSrc, - __inout_opt __deref_out_range(<, cchMax) size_t* pcchToRead, - __in const size_t cchMax, - __in DWORD dwFlags) -{ - NTSTATUS status = STATUS_SUCCESS; - - if (pcchToRead && (*pcchToRead >= cchMax)) - { - status = STATUS_INVALID_PARAMETER; - } - else if ((dwFlags & STRSAFE_IGNORE_NULLS) && (*ppszSrc == NULL)) - { - *ppszSrc = L""; - - if (pcchToRead) - { - *pcchToRead = 0; - } - } - - return status; -} - -#pragma warning(pop) // allow null deref - -#pragma warning(push) -#pragma warning(disable : 4100) // Unused parameter (pszDest) -NTSTRSAFEWORKERDDI -RtlStringValidateDestA( - __in_ecount_opt(cchDest) STRSAFE_PCNZCH pszDest, - __in size_t cchDest, - __in const size_t cchMax) -{ - NTSTATUS status = STATUS_SUCCESS; - - if ((cchDest == 0) || (cchDest > cchMax)) - { - status = STATUS_INVALID_PARAMETER; - } - - return status; -} -#pragma warning(pop) - -// Intentionally allow null deref when STRSAFE_IGNORE_NULLS is not present. -#pragma warning(push) -#pragma warning(disable : __WARNING_DEREF_NULL_PTR) -#pragma warning(disable : __WARNING_INVALID_PARAM_VALUE_1) -NTSTRSAFEWORKERDDI -RtlStringValidateDestAndLengthA( - __in_ecount_opt(cchDest) NTSTRSAFE_PCSTR pszDest, - __in size_t cchDest, - __out __deref_out_range(<, cchDest) size_t* pcchDestLength, - __in const size_t cchMax) -{ - NTSTATUS status; - - status = RtlStringValidateDestA(pszDest, cchDest, cchMax); - - if (NT_SUCCESS(status)) - { - status = RtlStringLengthWorkerA(pszDest, cchDest, pcchDestLength); - } - else - { - *pcchDestLength = 0; - } - - return status; -} -// End intentionally allow null deref. -#pragma warning(pop) - -#pragma warning(push) -#pragma warning(disable : 4100) // Unused parameter (pszDest) -NTSTRSAFEWORKERDDI -RtlStringValidateDestW( - __in_ecount_opt(cchDest) STRSAFE_PCNZWCH pszDest, - __in size_t cchDest, - __in const size_t cchMax) -{ - NTSTATUS status = STATUS_SUCCESS; - - if ((cchDest == 0) || (cchDest > cchMax)) - { - status = STATUS_INVALID_PARAMETER; - } - - return status; -} -#pragma warning(pop) - -// Intentionally allow null deref when STRSAFE_IGNORE_NULLS is not present. -#pragma warning(push) -#pragma warning(disable : __WARNING_DEREF_NULL_PTR) -#pragma warning(disable : __WARNING_INVALID_PARAM_VALUE_1) -NTSTRSAFEWORKERDDI -RtlStringValidateDestAndLengthW( - __in_ecount_opt(cchDest) NTSTRSAFE_PCWSTR pszDest, - __in size_t cchDest, - __out __deref_out_range(<, cchDest) size_t* pcchDestLength, - __in const size_t cchMax) -{ - NTSTATUS status; - - status = RtlStringValidateDestW(pszDest, cchDest, cchMax); - - if (NT_SUCCESS(status)) - { - status = RtlStringLengthWorkerW(pszDest, cchDest, pcchDestLength); - } - else - { - *pcchDestLength = 0; - } - - return status; -} -// End intentionally allow null deref. -#pragma warning(pop) - -NTSTRSAFEWORKERDDI -RtlStringExValidateDestA( - __in_ecount_opt(cchDest) STRSAFE_PCNZCH pszDest, - __in size_t cchDest, - __in const size_t cchMax, - __in DWORD dwFlags) -{ - NTSTATUS status = STATUS_SUCCESS; - - if (dwFlags & STRSAFE_IGNORE_NULLS) - { - if (((pszDest == NULL) && (cchDest != 0)) || - (cchDest > cchMax)) - { - status = STATUS_INVALID_PARAMETER; - } - } - else - { - status = RtlStringValidateDestA(pszDest, cchDest, cchMax); - } - - return status; -} - -// Intentionally allow null deref when STRSAFE_IGNORE_NULLS is not present. -#pragma warning(push) -#pragma warning(disable : __WARNING_DEREF_NULL_PTR) -#pragma warning(disable : __WARNING_INVALID_PARAM_VALUE_1) -NTSTRSAFEWORKERDDI -RtlStringExValidateDestAndLengthA( - __in_ecount_opt(cchDest) NTSTRSAFE_PCSTR pszDest, - __in size_t cchDest, - __out __deref_out_range(<, cchDest) size_t* pcchDestLength, - __in const size_t cchMax, - __in DWORD dwFlags) -{ - NTSTATUS status; - - if (dwFlags & STRSAFE_IGNORE_NULLS) - { - status = RtlStringExValidateDestA(pszDest, cchDest, cchMax, dwFlags); - - if (!NT_SUCCESS(status) || (cchDest == 0)) - { - *pcchDestLength = 0; - } - else - { - status = RtlStringLengthWorkerA(pszDest, cchDest, pcchDestLength); - } - } - else - { - status = RtlStringValidateDestAndLengthA(pszDest, - cchDest, - pcchDestLength, - cchMax); - } - - return status; -} -// End intentionally allow null deref. -#pragma warning(pop) - -NTSTRSAFEWORKERDDI -RtlStringExValidateDestW( - __in_ecount_opt(cchDest) STRSAFE_PCNZWCH pszDest, - __in size_t cchDest, - __in const size_t cchMax, - __in DWORD dwFlags) -{ - NTSTATUS status = STATUS_SUCCESS; - - if (dwFlags & STRSAFE_IGNORE_NULLS) - { - if (((pszDest == NULL) && (cchDest != 0)) || - (cchDest > cchMax)) - { - status = STATUS_INVALID_PARAMETER; - } - } - else - { - status = RtlStringValidateDestW(pszDest, cchDest, cchMax); - } - - return status; -} - -// Intentionally allow null deref when STRSAFE_IGNORE_NULLS is not present. -#pragma warning(push) -#pragma warning(disable : __WARNING_DEREF_NULL_PTR) -#pragma warning(disable : __WARNING_INVALID_PARAM_VALUE_1) -NTSTRSAFEWORKERDDI -RtlStringExValidateDestAndLengthW( - __in_ecount_opt(cchDest) NTSTRSAFE_PCWSTR pszDest, - __in size_t cchDest, - __out __deref_out_range(<, cchDest) size_t* pcchDestLength, - __in const size_t cchMax, - __in DWORD dwFlags) -{ - NTSTATUS status; - - if (dwFlags & STRSAFE_IGNORE_NULLS) - { - status = RtlStringExValidateDestW(pszDest, cchDest, cchMax, dwFlags); - - if (!NT_SUCCESS(status) || (cchDest == 0)) - { - *pcchDestLength = 0; - } - else - { - status = RtlStringLengthWorkerW(pszDest, cchDest, pcchDestLength); - } - } - else - { - status = RtlStringValidateDestAndLengthW(pszDest, - cchDest, - pcchDestLength, - cchMax); - } - - return status; -} -// End intentionally allow null deref. -#pragma warning(pop) - -NTSTRSAFEWORKERDDI -RtlStringCopyWorkerA( - __out_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchDest, - __out_opt __deref_out_range(<=, (cchToCopy < cchDest) ? cchToCopy : cchDest - 1) size_t* pcchNewDestLength, - __in_xcount(cchToCopy) STRSAFE_PCNZCH pszSrc, - __in __in_range(<, NTSTRSAFE_MAX_CCH) size_t cchToCopy) -{ - NTSTATUS status = STATUS_SUCCESS; - size_t cchNewDestLength = 0; - - // ASSERT(cchDest != 0); - - while (cchDest && cchToCopy && (*pszSrc != '\0')) - { - *pszDest++ = *pszSrc++; - cchDest--; - cchToCopy--; - - cchNewDestLength++; - } - - if (cchDest == 0) - { - // we are going to truncate pszDest - pszDest--; - cchNewDestLength--; - - status = STATUS_BUFFER_OVERFLOW; - } - - *pszDest = '\0'; - - if (pcchNewDestLength) - { - *pcchNewDestLength = cchNewDestLength; - } - - return status; -} - -NTSTRSAFEWORKERDDI -RtlStringCopyWorkerW( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchDest, - __out_opt __deref_out_range(<=, (cchToCopy < cchDest) ? cchToCopy : cchDest - 1) size_t* pcchNewDestLength, - __in_xcount(cchToCopy) STRSAFE_PCNZWCH pszSrc, - __in __in_range(<, NTSTRSAFE_MAX_CCH) size_t cchToCopy) -{ - NTSTATUS status = STATUS_SUCCESS; - size_t cchNewDestLength = 0; - - // ASSERT(cchDest != 0); - - while (cchDest && cchToCopy && (*pszSrc != L'\0')) - { - *pszDest++ = *pszSrc++; - cchDest--; - cchToCopy--; - - cchNewDestLength++; - } - - if (cchDest == 0) - { - // we are going to truncate pszDest - pszDest--; - cchNewDestLength--; - - status = STATUS_BUFFER_OVERFLOW; - } - - *pszDest = L'\0'; - - if (pcchNewDestLength) - { - *pcchNewDestLength = cchNewDestLength; - } - - return status; -} - -NTSTRSAFEWORKERDDI -RtlStringVPrintfWorkerA( - __out_ecount(cchDest) NTSTRSAFE_PSTR pszDest, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchDest, - __out_opt __deref_out_range(<=, cchDest - 1) size_t* pcchNewDestLength, - __in __format_string NTSTRSAFE_PCSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status = STATUS_SUCCESS; - int iRet; - size_t cchMax; - size_t cchNewDestLength = 0; - - // leave the last space for the null terminator - cchMax = cchDest - 1; - -#if (NTSTRSAFE_USE_SECURE_CRT == 1) && !defined(NTSTRSAFE_LIB_IMPL) - iRet = _vsnprintf_s(pszDest, cchDest, cchMax, pszFormat, argList); -#else - #pragma warning(push) - #pragma warning(disable: __WARNING_BANNED_API_USAGE)// "STRSAFE not included" - iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList); - #pragma warning(pop) -#endif - // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax)); - - if ((iRet < 0) || (((size_t)iRet) > cchMax)) - { - // need to null terminate the string - pszDest += cchMax; - *pszDest = '\0'; - - cchNewDestLength = cchMax; - - // we have truncated pszDest - status = STATUS_BUFFER_OVERFLOW; - } - else if (((size_t)iRet) == cchMax) - { - // need to null terminate the string - pszDest += cchMax; - *pszDest = '\0'; - - cchNewDestLength = cchMax; - } - else - { - cchNewDestLength = (size_t)iRet; - } - - if (pcchNewDestLength) - { - *pcchNewDestLength = cchNewDestLength; - } - - return status; -} - -NTSTRSAFEWORKERDDI -RtlStringVPrintfWorkerW( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in __in_range(1, NTSTRSAFE_MAX_CCH) size_t cchDest, - __out_opt __deref_out_range(<=, cchDest - 1) size_t* pcchNewDestLength, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status = STATUS_SUCCESS; - int iRet; - size_t cchMax; - size_t cchNewDestLength = 0; - - // leave the last space for the null terminator - cchMax = cchDest - 1; - -#if (NTSTRSAFE_USE_SECURE_CRT == 1) && !defined(NTSTRSAFE_LIB_IMPL) - iRet = _vsnwprintf_s(pszDest, cchDest, cchMax, pszFormat, argList); -#else - #pragma warning(push) - #pragma warning(disable: __WARNING_BANNED_API_USAGE)// "STRSAFE not included" - iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList); - #pragma warning(pop) -#endif - // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax)); - - if ((iRet < 0) || (((size_t)iRet) > cchMax)) - { - // need to null terminate the string - pszDest += cchMax; - *pszDest = L'\0'; - - cchNewDestLength = cchMax; - - // we have truncated pszDest - status = STATUS_BUFFER_OVERFLOW; - } - else if (((size_t)iRet) == cchMax) - { - // need to null terminate the string - pszDest += cchMax; - *pszDest = L'\0'; - - cchNewDestLength = cchMax; - } - else - { - cchNewDestLength = (size_t)iRet; - } - - if (pcchNewDestLength) - { - *pcchNewDestLength = cchNewDestLength; - } - - return status; -} - - -NTSTRSAFEWORKERDDI -RtlStringExHandleFillBehindNullA( - __inout_bcount(cbRemaining) NTSTRSAFE_PSTR pszDestEnd, - __in size_t cbRemaining, - __in DWORD dwFlags) -{ - if (cbRemaining > sizeof(char)) - { - memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), cbRemaining - sizeof(char)); - } - - return STATUS_SUCCESS; -} - -NTSTRSAFEWORKERDDI -RtlStringExHandleFillBehindNullW( - __inout_bcount(cbRemaining) NTSTRSAFE_PWSTR pszDestEnd, - __in size_t cbRemaining, - __in DWORD dwFlags) -{ - if (cbRemaining > sizeof(wchar_t)) - { - memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), cbRemaining - sizeof(wchar_t)); - } - - return STATUS_SUCCESS; -} - -NTSTRSAFEWORKERDDI -RtlStringExHandleOtherFlagsA( - __inout_bcount(cbDest) NTSTRSAFE_PSTR pszDest, - __in __in_range(sizeof(char), NTSTRSAFE_MAX_CCH * sizeof(char)) size_t cbDest, - __in __in_range(<, cbDest / sizeof(char)) size_t cchOriginalDestLength, - __deref_inout_ecount(*pcchRemaining) NTSTRSAFE_PSTR* ppszDestEnd, - __out __deref_out_range(<=, cbDest / sizeof(char)) size_t* pcchRemaining, - __in DWORD dwFlags) -{ - size_t cchDest = cbDest / sizeof(char); - - if ((cchDest > 0) && (dwFlags & STRSAFE_NO_TRUNCATION)) - { - char* pszOriginalDestEnd; - - pszOriginalDestEnd = pszDest + cchOriginalDestLength; - - *ppszDestEnd = pszOriginalDestEnd; - *pcchRemaining = cchDest - cchOriginalDestLength; - - // null terminate the end of the original string - *pszOriginalDestEnd = '\0'; - } - - if (dwFlags & STRSAFE_FILL_ON_FAILURE) - { - memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); - - if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) - { - *ppszDestEnd = pszDest; - *pcchRemaining = cchDest; - } - else if (cchDest > 0) - { - char* pszDestEnd; - - pszDestEnd = pszDest + cchDest - 1; - - *ppszDestEnd = pszDestEnd; - *pcchRemaining = 1; - - // null terminate the end of the string - *pszDestEnd = L'\0'; - } - } - - if ((cchDest > 0) && (dwFlags & STRSAFE_NULL_ON_FAILURE)) - { - *ppszDestEnd = pszDest; - *pcchRemaining = cchDest; - - // null terminate the beginning of the string - *pszDest = '\0'; - } - - return STATUS_SUCCESS; -} - -NTSTRSAFEWORKERDDI -RtlStringExHandleOtherFlagsW( - __inout_bcount(cbDest) NTSTRSAFE_PWSTR pszDest, - __in __in_range(sizeof(wchar_t), NTSTRSAFE_MAX_CCH * sizeof(wchar_t)) size_t cbDest, - __in __in_range(<, cbDest / sizeof(wchar_t)) size_t cchOriginalDestLength, - __deref_inout_ecount(*pcchRemaining) NTSTRSAFE_PWSTR* ppszDestEnd, - __out __deref_out_range(<=, cbDest / sizeof(wchar_t)) size_t* pcchRemaining, - __in DWORD dwFlags) -{ - size_t cchDest = cbDest / sizeof(wchar_t); - - if ((cchDest > 0) && (dwFlags & STRSAFE_NO_TRUNCATION)) - { - wchar_t* pszOriginalDestEnd; - - pszOriginalDestEnd = pszDest + cchOriginalDestLength; - - *ppszDestEnd = pszOriginalDestEnd; - *pcchRemaining = cchDest - cchOriginalDestLength; - - // null terminate the end of the original string - *pszOriginalDestEnd = L'\0'; - } - - if (dwFlags & STRSAFE_FILL_ON_FAILURE) - { - memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); - - if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) - { - *ppszDestEnd = pszDest; - *pcchRemaining = cchDest; - } - else if (cchDest > 0) - { - wchar_t* pszDestEnd; - - pszDestEnd = pszDest + cchDest - 1; - - *ppszDestEnd = pszDestEnd; - *pcchRemaining = 1; - - // null terminate the end of the string - *pszDestEnd = L'\0'; - } - } - - if ((cchDest > 0) && (dwFlags & STRSAFE_NULL_ON_FAILURE)) - { - *ppszDestEnd = pszDest; - *pcchRemaining = cchDest; - - // null terminate the beginning of the string - *pszDest = L'\0'; - } - - return STATUS_SUCCESS; -} - -#ifndef NTSTRSAFE_NO_UNICODE_STRING_FUNCTIONS - -NTSTRSAFEWORKERDDI -RtlUnicodeStringInitWorker( - __out PUNICODE_STRING DestinationString, - __in_opt NTSTRSAFE_PCWSTR pszSrc, - __in const size_t cchMax, - __in DWORD dwFlags) -{ - NTSTATUS status = STATUS_SUCCESS; - - if (DestinationString || !(dwFlags & STRSAFE_IGNORE_NULLS)) - { - DestinationString->Length = 0; - DestinationString->MaximumLength = 0; - DestinationString->Buffer = NULL; - } - - if (pszSrc) - { - size_t cchSrcLength; - - status = RtlStringLengthWorkerW(pszSrc, cchMax, &cchSrcLength); - - if (NT_SUCCESS(status)) - { - if (DestinationString) - { - size_t cbLength; - - // safe to multiply cchSrcLength * sizeof(wchar_t) since cchSrcLength < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - cbLength = cchSrcLength * sizeof(wchar_t); - - DestinationString->Length = (USHORT)cbLength; - // safe to add cbLength + sizeof(wchar_t) since cchSrcLength < NTSTRSAFE_UNICODE_STRING_MAX_CCH - DestinationString->MaximumLength = (USHORT)(cbLength + sizeof(wchar_t)); - DestinationString->Buffer = (PWSTR)pszSrc; - } - else - { - status = STATUS_INVALID_PARAMETER; - } - } - } - - return status; -} - -// Intentionally allow null deref in error cases. -#pragma warning(push) -#pragma warning(disable : __WARNING_DEREF_NULL_PTR) -#pragma warning(disable : __WARNING_INVALID_PARAM_VALUE_1) -#pragma warning(disable : __WARNING_RETURNING_BAD_RESULT) - -NTSTRSAFEWORKERDDI -RtlUnicodeStringValidateWorker( - __in_opt PCUNICODE_STRING SourceString, - __in const size_t cchMax, - __in DWORD dwFlags) -{ - NTSTATUS status = STATUS_SUCCESS; - - if (SourceString || !(dwFlags & STRSAFE_IGNORE_NULLS)) - { - if (((SourceString->Length % sizeof(wchar_t)) != 0) || - ((SourceString->MaximumLength % sizeof(wchar_t)) != 0) || - (SourceString->Length > SourceString->MaximumLength) || - (SourceString->MaximumLength > (cchMax * sizeof(wchar_t)))) - { - status = STATUS_INVALID_PARAMETER; - } - else if ((SourceString->Buffer == NULL) && - ((SourceString->Length != 0) || (SourceString->MaximumLength != 0))) - { - status = STATUS_INVALID_PARAMETER; - } - } - - return status; -} - -NTSTRSAFEWORKERDDI -RtlUnicodeStringValidateSrcWorker( - __in PCUNICODE_STRING SourceString, - __deref_out_ecount(*pcchSrcLength) wchar_t** ppszSrc, - __out size_t* pcchSrcLength, - __in const size_t cchMax, - __in DWORD dwFlags) -{ - NTSTATUS status; - - *ppszSrc = NULL; - *pcchSrcLength = 0; - - status = RtlUnicodeStringValidateWorker(SourceString, cchMax, dwFlags); - - if (NT_SUCCESS(status)) - { - if (SourceString) - { - *ppszSrc = SourceString->Buffer; - *pcchSrcLength = SourceString->Length / sizeof(wchar_t); - } - - if ((*ppszSrc == NULL) && (dwFlags & STRSAFE_IGNORE_NULLS)) - { - *ppszSrc = L""; - } - } - - return status; -} -// End intentionally allow null deref. -#pragma warning(pop) - -NTSTRSAFEWORKERDDI -RtlUnicodeStringValidateDestWorker( - __in PCUNICODE_STRING DestinationString, - __deref_out_ecount(*pcchDest) wchar_t** ppszDest, - __out size_t* pcchDest, - __out_opt size_t* pcchDestLength, - __in const size_t cchMax, - __in DWORD dwFlags) -{ - NTSTATUS status; - - *ppszDest = NULL; - *pcchDest = 0; - - if (pcchDestLength) - { - *pcchDestLength = 0; - } - - status = RtlUnicodeStringValidateWorker(DestinationString, cchMax, dwFlags); - - if (NT_SUCCESS(status) && DestinationString) - { - *ppszDest = DestinationString->Buffer; - *pcchDest = DestinationString->MaximumLength / sizeof(wchar_t); - - if (pcchDestLength) - { - *pcchDestLength = DestinationString->Length / sizeof(wchar_t); - } - } - - return status; -} - -NTSTRSAFEWORKERDDI -RtlStringCopyWideCharArrayWorker( - __out_ecount(cchDest) NTSTRSAFE_PWSTR pszDest, - __in size_t cchDest, - __out_opt size_t* pcchNewDestLength, - __in_ecount(cchSrcLength) const wchar_t* pszSrc, - __in size_t cchSrcLength) -{ - NTSTATUS status = STATUS_SUCCESS; - size_t cchNewDestLength = 0; - - // ASSERT(cchDest != 0); - - while (cchDest && cchSrcLength) - { - *pszDest++ = *pszSrc++; - cchDest--; - cchSrcLength--; - - cchNewDestLength++; - } - - if (cchDest == 0) - { - // we are going to truncate pszDest - pszDest--; - cchNewDestLength--; - - status = STATUS_BUFFER_OVERFLOW; - } - - *pszDest = L'\0'; - - if (pcchNewDestLength) - { - *pcchNewDestLength = cchNewDestLength; - } - - return status; -} - -NTSTRSAFEWORKERDDI -RtlWideCharArrayCopyStringWorker( - __out_ecount(cchDest) wchar_t* pszDest, - __in size_t cchDest, - __out size_t* pcchNewDestLength, - __in NTSTRSAFE_PCWSTR pszSrc, - __in size_t cchToCopy) -{ - NTSTATUS status = STATUS_SUCCESS; - size_t cchNewDestLength = 0; - - while (cchDest && cchToCopy && (*pszSrc != L'\0')) - { - *pszDest++ = *pszSrc++; - cchDest--; - cchToCopy--; - - cchNewDestLength++; - } - - if ((cchDest == 0) && (cchToCopy != 0) && (*pszSrc != L'\0')) - { - // we are going to truncate pszDest - status = STATUS_BUFFER_OVERFLOW; - } - - *pcchNewDestLength = cchNewDestLength; - - return status; -} - -NTSTRSAFEWORKERDDI -RtlWideCharArrayCopyWorker( - __out_ecount(cchDest) wchar_t* pszDest, - __in size_t cchDest, - __out size_t* pcchNewDestLength, - __in_ecount(cchSrcLength) const wchar_t* pszSrc, - __in size_t cchSrcLength) -{ - NTSTATUS status = STATUS_SUCCESS; - size_t cchNewDestLength = 0; - - while (cchDest && cchSrcLength) - { - *pszDest++ = *pszSrc++; - cchDest--; - cchSrcLength--; - - cchNewDestLength++; - } - - if ((cchDest == 0) && (cchSrcLength != 0)) - { - // we are going to truncate pszDest - status = STATUS_BUFFER_OVERFLOW; - } - - *pcchNewDestLength = cchNewDestLength; - - return status; -} - -NTSTRSAFEWORKERDDI -RtlWideCharArrayVPrintfWorker( - __out_ecount(cchDest) wchar_t* pszDest, - __in size_t cchDest, - __out size_t* pcchNewDestLength, - __in __format_string NTSTRSAFE_PCWSTR pszFormat, - __in va_list argList) -{ - NTSTATUS status = STATUS_SUCCESS; - int iRet; - - #pragma warning(push) - #pragma warning(disable: __WARNING_BANNED_API_USAGE)// "STRSAFE not included" - iRet = _vsnwprintf(pszDest, cchDest, pszFormat, argList); - #pragma warning(pop) - // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax)); - - if ((iRet < 0) || (((size_t)iRet) > cchDest)) - { - *pcchNewDestLength = cchDest; - - // we have truncated pszDest - status = STATUS_BUFFER_OVERFLOW; - } - else - { - *pcchNewDestLength = (size_t)iRet; - } - - return status; -} - -NTSTRSAFEWORKERDDI -RtlUnicodeStringExHandleFill( - __out_ecount(cchRemaining) wchar_t* pszDestEnd, - __in size_t cchRemaining, - __in DWORD dwFlags) -{ - size_t cbRemaining; - - // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - cbRemaining = cchRemaining * sizeof(wchar_t); - - memset(pszDestEnd, STRSAFE_GET_FILL_PATTERN(dwFlags), cbRemaining); - - return STATUS_SUCCESS; -} - -NTSTRSAFEWORKERDDI -RtlUnicodeStringExHandleOtherFlags( - __inout_ecount(cchDest) wchar_t* pszDest, - __in size_t cchDest, - __in size_t cchOriginalDestLength, - __out size_t* pcchNewDestLength, - __deref_out_ecount(*pcchRemaining) wchar_t** ppszDestEnd, - __out size_t* pcchRemaining, - __in DWORD dwFlags) -{ - if (dwFlags & STRSAFE_NO_TRUNCATION) - { - *ppszDestEnd = pszDest + cchOriginalDestLength; - *pcchRemaining = cchDest - cchOriginalDestLength; - - *pcchNewDestLength = cchOriginalDestLength; - } - - if (dwFlags & STRSAFE_FILL_ON_FAILURE) - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2 - cbDest = cchDest * sizeof(wchar_t); - - memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); - - *ppszDestEnd = pszDest; - *pcchRemaining = cchDest; - - *pcchNewDestLength = 0; - } - - if (dwFlags & STRSAFE_ZERO_LENGTH_ON_FAILURE) - { - *ppszDestEnd = pszDest; - *pcchRemaining = cchDest; - - *pcchNewDestLength = 0; - } - - return STATUS_SUCCESS; -} - -#endif // !NTSTRSAFE_NO_UNICODE_STRING_FUNCTIONS - -#endif // defined(NTSTRSAFE_LIB_IMPL) || !defined(NTSTRSAFE_LIB) - - -// Do not call these functions, they are worker functions for internal use within this file -#ifdef DEPRECATE_SUPPORTED -#pragma deprecated(RtlStringLengthWorkerA) -#pragma deprecated(RtlStringLengthWorkerW) -#pragma deprecated(RtlUnalignedStringLengthWorkerW) -#pragma deprecated(RtlStringExValidateSrcA) -#pragma deprecated(RtlStringExValidateSrcW) -#pragma deprecated(RtlStringValidateDestA) -#pragma deprecated(RtlStringValidateDestAndLengthA) -#pragma deprecated(RtlStringValidateDestW) -#pragma deprecated(RtlStringValidateDestAndLengthW) -#pragma deprecated(RtlStringExValidateDestA) -#pragma deprecated(RtlStringExValidateDestAndLengthA) -#pragma deprecated(RtlStringExValidateDestW) -#pragma deprecated(RtlStringExValidateDestAndLengthW) -#pragma deprecated(RtlStringCopyWorkerA) -#pragma deprecated(RtlStringCopyWorkerW) -#pragma deprecated(RtlStringVPrintfWorkerA) -#pragma deprecated(RtlStringVPrintfWorkerW) -#pragma deprecated(RtlStringExHandleFillBehindNullA) -#pragma deprecated(RtlStringExHandleFillBehindNullW) -#pragma deprecated(RtlStringExHandleOtherFlagsA) -#pragma deprecated(RtlStringExHandleOtherFlagsW) -#pragma deprecated(RtlUnicodeStringInitWorker) -#pragma deprecated(RtlUnicodeStringValidateWorker) -#pragma deprecated(RtlUnicodeStringValidateSrcWorker) -#pragma deprecated(RtlUnicodeStringValidateDestWorker) -#pragma deprecated(RtlStringCopyWideCharArrayWorker) -#pragma deprecated(RtlWideCharArrayCopyStringWorker) -#pragma deprecated(RtlWideCharArrayCopyWorker) -#pragma deprecated(RtlWideCharArrayVPrintfWorker) -#pragma deprecated(RtlUnicodeStringExHandleFill) -#pragma deprecated(RtlUnicodeStringExHandleOtherFlags) -#else -#define RtlStringLengthWorkerA RtlStringLengthWorkerA_instead_use_StringCchLengthA_or_StringCbLengthA -#define RtlStringLengthWorkerW RtlStringLengthWorkerW_instead_use_StringCchLengthW_or_StringCbLengthW -#define RtlUnalignedStringLengthWorkerW RtlUnalignedStringLengthWorkerW_instead_use_UnalignedStringCchLengthW -#define RtlStringExValidateSrcA RtlStringExValidateSrcA_do_not_call_this_function -#define RtlStringExValidateSrcW RtlStringExValidateSrcW_do_not_call_this_function -#define RtlStringValidateDestA RtlStringValidateDestA_do_not_call_this_function -#define RtlStringValidateDestAndLengthA RtlStringValidateDestAndLengthA_do_not_call_this_function -#define RtlStringValidateDestW RtlStringValidateDestW_do_not_call_this_function -#define RtlStringValidateDestAndLengthW RtlStringValidateDestAndLengthW_do_not_call_this_function -#define RtlStringExValidateDestA RtlStringExValidateDestA_do_not_call_this_function -#define RtlStringExValidateDestAndLengthA RtlStringExValidateDestAndLengthA_do_not_call_this_function -#define RtlStringExValidateDestW RtlStringExValidateDestW_do_not_call_this_function -#define RtlStringExValidateDestAndLengthW RtlStringExValidateDestAndLengthW_do_not_call_this_function -#define RtlStringCopyWorkerA RtlStringCopyWorkerA_instead_use_StringCchCopyA_or_StringCbCopyA -#define RtlStringCopyWorkerW RtlStringCopyWorkerW_instead_use_StringCchCopyW_or_StringCbCopyW -#define RtlStringVPrintfWorkerA RtlStringVPrintfWorkerA_instead_use_StringCchVPrintfA_or_StringCbVPrintfA -#define RtlStringVPrintfWorkerW RtlStringVPrintfWorkerW_instead_use_StringCchVPrintfW_or_StringCbVPrintfW -#define RtlStringExHandleFillBehindNullA RtlStringExHandleFillBehindNullA_do_not_call_this_function -#define RtlStringExHandleFillBehindNullW RtlStringExHandleFillBehindNullW_do_not_call_this_function -#define RtlStringExHandleOtherFlagsA RtlStringExHandleOtherFlagsA_do_not_call_this_function -#define RtlStringExHandleOtherFlagsW RtlStringExHandleOtherFlagsW_do_not_call_this_function -#define RtlUnicodeStringInitWorker RtlUnicodeStringInitWorker_instead_use_RtlUnicodeStringInit_or_RtlUnicodeStringInitEx -#define RtlUnicodeStringValidateWorker RtlUnicodeStringValidateWorker_instead_use_RtlUnicodeStringValidate_or_RtlUnicodeStringValidateEx -#define RtlUnicodeStringValidateSrcWorker RtlUnicodeStringValidateSrcWorker_do_not_call_this_function -#define RtlUnicodeStringValidateDestWorker RtlUnicodeStringValidateDestWorker_do_not_call_this_function -#define RtlStringCopyWideCharArrayWorker RtlStringCopyWideCharArrayWorker_instead_use_RtlStringCchCopyUnicodeString_or_RtlStringCbCopyUnicodeString -#define RtlWideCharArrayCopyStringWorker RtlWideCharArrayCopyStringWorker_instead_use_RtlUnicodeStringCopyString_or_RtlUnicodeStringCopyStringEx -#define RtlWideCharArrayCopyWorker RtlWideCharArrayCopyWorker_instead_use_RtlUnicodeStringCopy_or_RtlUnicodeStringCopyEx -#define RtlWideCharArrayVPrintfWorker RtlWideCharArrayVPrintfWorker_instead_use_RtlUnicodeStringVPrintf_or_RtlUnicodeStringPrintf -#define RtlUnicodeStringExHandleFill RtlUnicodeStringExHandleFill_do_not_call_this_function -#define RtlUnicodeStringExHandleOtherFlags RtlUnicodeStringExHandleOtherFlags_do_not_call_this_function -#endif // !DEPRECATE_SUPPORTED - - -#ifndef NTSTRSAFE_NO_DEPRECATE -// Deprecate all of the unsafe functions to generate compiletime errors. If you do not want -// this then you can #define NTSTRSAFE_NO_DEPRECATE before including this file -#ifdef DEPRECATE_SUPPORTED - -#pragma deprecated(strcpy) -#pragma deprecated(wcscpy) -#pragma deprecated(strcat) -#pragma deprecated(wcscat) -#pragma deprecated(sprintf) -#pragma deprecated(swprintf) -#pragma deprecated(vsprintf) -#pragma deprecated(vswprintf) -#pragma deprecated(_snprintf) -#pragma deprecated(_snwprintf) -#pragma deprecated(_vsnprintf) -#pragma deprecated(_vsnwprintf) - -#else // DEPRECATE_SUPPORTED - -#undef strcpy -#define strcpy strcpy_instead_use_StringCchCopyA_or_StringCbCopyA; - -#undef wcscpy -#define wcscpy wcscpy_instead_use_StringCchCopyW_or_StringCbCopyW; - -#undef strcat -#define strcat strcat_instead_use_StringCchCatA_or_StringCbCatA; - -#undef wcscat -#define wcscat wcscat_instead_use_StringCchCatW_or_StringCbCatW; - -#undef sprintf -#define sprintf sprintf_instead_use_StringCchPrintfA_or_StringCbPrintfA; - -#undef swprintf -#define swprintf swprintf_instead_use_StringCchPrintfW_or_StringCbPrintfW; - -#undef vsprintf -#define vsprintf vsprintf_instead_use_StringCchVPrintfA_or_StringCbVPrintfA; - -#undef vswprintf -#define vswprintf vswprintf_instead_use_StringCchVPrintfW_or_StringCbVPrintfW; - -#undef _snprintf -#define _snprintf _snprintf_instead_use_StringCchPrintfA_or_StringCbPrintfA; - -#undef _snwprintf -#define _snwprintf _snwprintf_instead_use_StringCchPrintfW_or_StringCbPrintfW; - -#undef _vsnprintf -#define _vsnprintf _vsnprintf_instead_use_StringCchVPrintfA_or_StringCbVPrintfA; - -#undef _vsnwprintf -#define _vsnwprintf _vsnwprintf_instead_use_StringCchVPrintfW_or_StringCbVPrintfW; - -#endif // DEPRECATE_SUPPORTED -#endif // !NTSTRSAFE_NO_DEPRECATE - -#pragma warning(pop) - -#endif // _NTSTRSAFE_H_INCLUDED_ - diff --git a/pub/ddk/offreg.h b/pub/ddk/offreg.h deleted file mode 100644 index 36ef21d..0000000 --- a/pub/ddk/offreg.h +++ /dev/null @@ -1,214 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation - -Module Name: - - offreg.h - -Abstract: - - This module contains the header file for the - offreg utility. - ---*/ - -#pragma once - -#ifndef __OFFREG_H__ -#define __OFFREG_H__ - -#ifdef __cplusplus -extern "C" -{ -#endif - - -#if defined(OFFREG_DLL) -#define ORAPI _declspec(dllexport) __stdcall -#else -#define ORAPI _declspec(dllimport) __stdcall -#endif - -typedef PVOID ORHKEY; -typedef ORHKEY *PORHKEY; - -VOID -ORAPI -ORGetVersion( - __out PDWORD pdwMajorVersion, - __out PDWORD pdwMinorVersion - ); - -DWORD -ORAPI -OROpenHive ( - __in PCWSTR lpHivePath, - __out PORHKEY phkResult - ); - -DWORD -ORAPI -ORCreateHive ( - __out PORHKEY phkResult - ); - -DWORD -ORAPI -ORCloseHive ( - __in ORHKEY Handle - ); - -DWORD -ORAPI -ORSaveHive ( - __in ORHKEY Handle, - __in PCWSTR lpHivePath, - __in DWORD dwOsMajorVersion, - __in DWORD dwOsMinorVersion - ); - -DWORD -ORAPI -OROpenKey ( - __in ORHKEY Handle, - __in_opt PCWSTR lpSubKeyName, - __out PORHKEY phkResult - ); - -DWORD -ORAPI -ORCloseKey ( - __in ORHKEY Handle - ); - -DWORD -ORAPI -ORCreateKey ( - __in ORHKEY Handle, - __in PCWSTR lpSubKey, - __in_opt PWSTR lpClass, - __in_opt DWORD dwOptions, - __in_opt PSECURITY_DESCRIPTOR pSecurityDescriptor, - __out PORHKEY phkResult, - __out_opt PDWORD pdwDisposition - ); - -DWORD -ORAPI -ORDeleteKey ( - __in ORHKEY Handle, - __in_opt PCWSTR lpSubKey - ); - -DWORD -ORAPI -ORQueryInfoKey ( - __in ORHKEY Handle, - __out_ecount_opt(*lpcClass) PWSTR lpClass, - __inout_opt PDWORD lpcClass, - __out_opt PDWORD lpcSubKeys, - __out_opt PDWORD lpcMaxSubKeyLen, - __out_opt PDWORD lpcMaxClassLen, - __out_opt PDWORD lpcValues, - __out_opt PDWORD lpcMaxValueNameLen, - __out_opt PDWORD lpcMaxValueLen, - __out_opt PDWORD lpcbSecurityDescriptor, - __out_opt PFILETIME lpftLastWriteTime - ); - -DWORD -ORAPI -OREnumKey ( - __in ORHKEY Handle, - __in DWORD dwIndex, - __out_ecount(*lpcName) PWSTR lpName, - __inout PDWORD lpcName, - __out_ecount_opt(*lpcClass) PWSTR lpClass, - __inout_opt PDWORD lpcClass, - __out_opt PFILETIME lpftLastWriteTime - ); - -DWORD -ORAPI -ORGetKeySecurity ( - __in ORHKEY Handle, - __in SECURITY_INFORMATION SecurityInformation, - __out_opt PSECURITY_DESCRIPTOR pSecurityDescriptor, - __inout PDWORD lpcbSecurityDescriptor - ); - -DWORD -ORAPI -ORSetKeySecurity ( - __in ORHKEY Handle, - __in SECURITY_INFORMATION SecurityInformation, - __in PSECURITY_DESCRIPTOR pSecurityDescriptor - ); - -DWORD -ORAPI -ORGetVirtualFlags ( - __in ORHKEY Handle, - __out PDWORD pdwFlags - ); - -DWORD -ORAPI -ORSetVirtualFlags ( - __in ORHKEY Handle, - __in DWORD dwFlags - ); - -DWORD -ORAPI -ORDeleteValue ( - __in ORHKEY Handle, - __in_opt PCWSTR lpValueName - ); - -DWORD -ORAPI -ORGetValue ( - __in ORHKEY Handle, - __in_opt PCWSTR lpSubKey, - __in_opt PCWSTR lpValue, - __out_opt PDWORD pdwType, - __out_bcount_opt(*pcbData) PVOID pvData, - __inout_opt PDWORD pcbData - ); - -DWORD -ORAPI -ORSetValue ( - __in ORHKEY Handle, - __in_opt PCWSTR lpValueName, - __in DWORD dwType, - __in_bcount_opt(cbData) const BYTE * lpData, - __in DWORD cbData - ); - -DWORD -ORAPI -OREnumValue ( - __in ORHKEY Handle, - __in DWORD dwIndex, - __out_ecount(*lpcValueName) PWSTR lpValueName, - __inout PDWORD lpcValueName, - __out_opt PDWORD lpType, - __out_bcount_opt(*lpcbData) PBYTE lpData, - __inout_opt PDWORD lpcbData - ); - -VOID -ORShutdown ( - VOID - ); - - -#ifdef __cplusplus -} -#endif - -#endif //__OFFREG_H__ - diff --git a/pub/ddk/oledberr.h b/pub/ddk/oledberr.h deleted file mode 100644 index fbac962..0000000 --- a/pub/ddk/oledberr.h +++ /dev/null @@ -1,1829 +0,0 @@ -//----------------------------------------------------------------------------- -// File: OledbErr.mc -// -// Copyright: Copyright (c) Microsoft Corporation -// -// Contents: -// -// Comments: -// -// -//----------------------------------------------------------------------------- -#ifndef _MSADERR_H_ -#define _MSADERR_H_ -#ifndef FACILITY_WINDOWS -// -// 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_WINDOWS 0x8 -#define FACILITY_STORAGE 0x3 -#define FACILITY_ITF 0x4 - - -// -// Define the severity codes -// -#define STATUS_SEVERITY_SUCCESS 0x0 -#define STATUS_SEVERITY_COERROR 0x2 - - -// -// MessageId: DB_E_BOGUS -// -// MessageText: -// -// Dummy error - need this error so that mc puts the above defines -// inside the FACILITY_WINDOWS guard, instead of leaving it empty -// -#define DB_E_BOGUS ((HRESULT)0x80040EFFL) - -#endif // FACILITY_WINDOWS - -// -// Codes 0x0e00-0x0eff are reserved for the OLE DB group of -// interfaces. -// -// Free codes are: -// -// Error: -// -// -// Success: -// 0x0eea -// -// - - -// -// OLEDBVER -// OLE DB version number (0x0270); this can be overridden with an older -// version number if necessary -// - -// If OLEDBVER is not defined, assume version 2.7 -#ifndef OLEDBVER -#define OLEDBVER 0x0270 -#endif - -// -// MessageId: DB_E_BADACCESSORHANDLE -// -// MessageText: -// -// Accessor is invalid. -// -#define DB_E_BADACCESSORHANDLE ((HRESULT)0x80040E00L) - -// -// MessageId: DB_E_ROWLIMITEXCEEDED -// -// MessageText: -// -// Row could not be inserted into the rowset without exceeding provider's maximum number of active rows. -// -#define DB_E_ROWLIMITEXCEEDED ((HRESULT)0x80040E01L) - -// -// MessageId: DB_E_READONLYACCESSOR -// -// MessageText: -// -// Accessor is read-only. Operation failed. -// -#define DB_E_READONLYACCESSOR ((HRESULT)0x80040E02L) - -// -// MessageId: DB_E_SCHEMAVIOLATION -// -// MessageText: -// -// Values violate the database schema. -// -#define DB_E_SCHEMAVIOLATION ((HRESULT)0x80040E03L) - -// -// MessageId: DB_E_BADROWHANDLE -// -// MessageText: -// -// Row handle is invalid. -// -#define DB_E_BADROWHANDLE ((HRESULT)0x80040E04L) - -// -// MessageId: DB_E_OBJECTOPEN -// -// MessageText: -// -// Object was open. -// -#define DB_E_OBJECTOPEN ((HRESULT)0x80040E05L) - -//@@@+ V1.5 -#if( OLEDBVER >= 0x0150 ) -// -// MessageId: DB_E_BADCHAPTER -// -// MessageText: -// -// Chapter is invalid. -// -#define DB_E_BADCHAPTER ((HRESULT)0x80040E06L) - -#endif // OLEDBVER >= 0x0150 -//@@@- V1.5 - -// -// MessageId: DB_E_CANTCONVERTVALUE -// -// MessageText: -// -// Data or literal value could not be converted to the type of the column in the data source, and the provider was unable to determine which columns could not be converted. Data overflow or sign mismatch was not the cause. -// -#define DB_E_CANTCONVERTVALUE ((HRESULT)0x80040E07L) - -// -// MessageId: DB_E_BADBINDINFO -// -// MessageText: -// -// Binding information is invalid. -// -#define DB_E_BADBINDINFO ((HRESULT)0x80040E08L) - -// -// MessageId: DB_SEC_E_PERMISSIONDENIED -// -// MessageText: -// -// Permission denied. -// -#define DB_SEC_E_PERMISSIONDENIED ((HRESULT)0x80040E09L) - -// -// MessageId: DB_E_NOTAREFERENCECOLUMN -// -// MessageText: -// -// Column does not contain bookmarks or chapters. -// -#define DB_E_NOTAREFERENCECOLUMN ((HRESULT)0x80040E0AL) - -//@@@+ V2.5 -#if( OLEDBVER >= 0x0250 ) -// -// MessageId: DB_E_LIMITREJECTED -// -// MessageText: -// -// Cost limits were rejected. -// -#define DB_E_LIMITREJECTED ((HRESULT)0x80040E0BL) - -#endif // OLEDBVER >= 0x0250 -//@@@- V2.5 - -// -// MessageId: DB_E_NOCOMMAND -// -// MessageText: -// -// Command text was not set for the command object. -// -#define DB_E_NOCOMMAND ((HRESULT)0x80040E0CL) - -//@@@+ V2.5 -#if( OLEDBVER >= 0x0250 ) -// -// MessageId: DB_E_COSTLIMIT -// -// MessageText: -// -// Query plan within the cost limit cannot be found. -// -#define DB_E_COSTLIMIT ((HRESULT)0x80040E0DL) - -#endif // OLEDBVER >= 0x0250 -//@@@- V2.5 - -// -// MessageId: DB_E_BADBOOKMARK -// -// MessageText: -// -// Bookmark is invalid. -// -#define DB_E_BADBOOKMARK ((HRESULT)0x80040E0EL) - -// -// MessageId: DB_E_BADLOCKMODE -// -// MessageText: -// -// Lock mode is invalid. -// -#define DB_E_BADLOCKMODE ((HRESULT)0x80040E0FL) - -// -// MessageId: DB_E_PARAMNOTOPTIONAL -// -// MessageText: -// -// No value given for one or more required parameters. -// -#define DB_E_PARAMNOTOPTIONAL ((HRESULT)0x80040E10L) - -// -// MessageId: DB_E_BADCOLUMNID -// -// MessageText: -// -// Column ID is invalid. -// -#define DB_E_BADCOLUMNID ((HRESULT)0x80040E11L) - -// -// MessageId: DB_E_BADRATIO -// -// MessageText: -// -// Numerator was greater than denominator. Values must express ratio between zero and 1. -// -#define DB_E_BADRATIO ((HRESULT)0x80040E12L) - -//@@@+ V2.0 -#if( OLEDBVER >= 0x0200 ) -// -// MessageId: DB_E_BADVALUES -// -// MessageText: -// -// Value is invalid. -// -#define DB_E_BADVALUES ((HRESULT)0x80040E13L) - -#endif // OLEDBVER >= 0x0200 -//@@@- V2.0 - -// -// MessageId: DB_E_ERRORSINCOMMAND -// -// MessageText: -// -// One or more errors occurred during processing of command. -// -#define DB_E_ERRORSINCOMMAND ((HRESULT)0x80040E14L) - -// -// MessageId: DB_E_CANTCANCEL -// -// MessageText: -// -// Command cannot be canceled. -// -#define DB_E_CANTCANCEL ((HRESULT)0x80040E15L) - -// -// MessageId: DB_E_DIALECTNOTSUPPORTED -// -// MessageText: -// -// Command dialect is not supported by this provider. -// -#define DB_E_DIALECTNOTSUPPORTED ((HRESULT)0x80040E16L) - -// -// MessageId: DB_E_DUPLICATEDATASOURCE -// -// MessageText: -// -// Data source object could not be created because the named data source already exists. -// -#define DB_E_DUPLICATEDATASOURCE ((HRESULT)0x80040E17L) - -// -// MessageId: DB_E_CANNOTRESTART -// -// MessageText: -// -// Rowset position cannot be restarted. -// -#define DB_E_CANNOTRESTART ((HRESULT)0x80040E18L) - -// -// MessageId: DB_E_NOTFOUND -// -// MessageText: -// -// Object or data matching the name, range, or selection criteria was not found within the scope of this operation. -// -#define DB_E_NOTFOUND ((HRESULT)0x80040E19L) - -// -// MessageId: DB_E_NEWLYINSERTED -// -// MessageText: -// -// Identity cannot be determined for newly inserted rows. -// -#define DB_E_NEWLYINSERTED ((HRESULT)0x80040E1BL) - -//@@@+ V2.5 -#if( OLEDBVER >= 0x0250 ) -// -// MessageId: DB_E_CANNOTFREE -// -// MessageText: -// -// Provider has ownership of this tree. -// -#define DB_E_CANNOTFREE ((HRESULT)0x80040E1AL) - -// -// MessageId: DB_E_GOALREJECTED -// -// MessageText: -// -// Goal was rejected because no nonzero weights were specified for any goals supported. Current goal was not changed. -// -#define DB_E_GOALREJECTED ((HRESULT)0x80040E1CL) - -#endif // OLEDBVER >= 0x0250 -//@@@- V2.5 - -// -// MessageId: DB_E_UNSUPPORTEDCONVERSION -// -// MessageText: -// -// Requested conversion is not supported. -// -#define DB_E_UNSUPPORTEDCONVERSION ((HRESULT)0x80040E1DL) - -// -// MessageId: DB_E_BADSTARTPOSITION -// -// MessageText: -// -// No rows were returned because the offset value moves the position before the beginning or after the end of the rowset. -// -#define DB_E_BADSTARTPOSITION ((HRESULT)0x80040E1EL) - -//@@@+ V2.0 -#if( OLEDBVER >= 0x0200 ) -// -// MessageId: DB_E_NOQUERY -// -// MessageText: -// -// Information was requested for a query and the query was not set. -// -#define DB_E_NOQUERY ((HRESULT)0x80040E1FL) - -#endif // OLEDBVER >= 0x0200 -//@@@- V2.0 - -// -// MessageId: DB_E_NOTREENTRANT -// -// MessageText: -// -// Consumer's event handler called a non-reentrant method in the provider. -// -#define DB_E_NOTREENTRANT ((HRESULT)0x80040E20L) - -// -// MessageId: DB_E_ERRORSOCCURRED -// -// MessageText: -// -// Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. -// -#define DB_E_ERRORSOCCURRED ((HRESULT)0x80040E21L) - -// -// MessageId: DB_E_NOAGGREGATION -// -// MessageText: -// -// Non-NULL controlling IUnknown was specified, and either the requested interface was not -// IUnknown, or the provider does not support COM aggregation. -// -#define DB_E_NOAGGREGATION ((HRESULT)0x80040E22L) - -// -// MessageId: DB_E_DELETEDROW -// -// MessageText: -// -// Row handle referred to a deleted row or a row marked for deletion. -// -#define DB_E_DELETEDROW ((HRESULT)0x80040E23L) - -// -// MessageId: DB_E_CANTFETCHBACKWARDS -// -// MessageText: -// -// Rowset does not support fetching backward. -// -#define DB_E_CANTFETCHBACKWARDS ((HRESULT)0x80040E24L) - -// -// MessageId: DB_E_ROWSNOTRELEASED -// -// MessageText: -// -// Row handles must all be released before new ones can be obtained. -// -#define DB_E_ROWSNOTRELEASED ((HRESULT)0x80040E25L) - -// -// MessageId: DB_E_BADSTORAGEFLAG -// -// MessageText: -// -// One or more storage flags are not supported. -// -#define DB_E_BADSTORAGEFLAG ((HRESULT)0x80040E26L) - -//@@@+ V1.5 -#if( OLEDBVER >= 0x0150 ) -// -// MessageId: DB_E_BADCOMPAREOP -// -// MessageText: -// -// Comparison operator is invalid. -// -#define DB_E_BADCOMPAREOP ((HRESULT)0x80040E27L) - -#endif // OLEDBVER >= 0x0150 -//@@@- V1.5 - -// -// MessageId: DB_E_BADSTATUSVALUE -// -// MessageText: -// -// Status flag was neither DBCOLUMNSTATUS_OK nor -// DBCOLUMNSTATUS_ISNULL. -// -#define DB_E_BADSTATUSVALUE ((HRESULT)0x80040E28L) - -// -// MessageId: DB_E_CANTSCROLLBACKWARDS -// -// MessageText: -// -// Rowset does not support scrolling backward. -// -#define DB_E_CANTSCROLLBACKWARDS ((HRESULT)0x80040E29L) - -//@@@+ V2.5 -#if( OLEDBVER >= 0x0250 ) -// -// MessageId: DB_E_BADREGIONHANDLE -// -// MessageText: -// -// Region handle is invalid. -// -#define DB_E_BADREGIONHANDLE ((HRESULT)0x80040E2AL) - -// -// MessageId: DB_E_NONCONTIGUOUSRANGE -// -// MessageText: -// -// Set of rows is not contiguous to, or does not overlap, the rows in the watch region. -// -#define DB_E_NONCONTIGUOUSRANGE ((HRESULT)0x80040E2BL) - -// -// MessageId: DB_E_INVALIDTRANSITION -// -// MessageText: -// -// Transition from ALL* to MOVE* or EXTEND* was specified. -// -#define DB_E_INVALIDTRANSITION ((HRESULT)0x80040E2CL) - -// -// MessageId: DB_E_NOTASUBREGION -// -// MessageText: -// -// Region is not a proper subregion of the region identified by the watch region handle. -// -#define DB_E_NOTASUBREGION ((HRESULT)0x80040E2DL) - -#endif // OLEDBVER >= 0x0250 -//@@@- V2.5 - -// -// MessageId: DB_E_MULTIPLESTATEMENTS -// -// MessageText: -// -// Multiple-statement commands are not supported by this provider. -// -#define DB_E_MULTIPLESTATEMENTS ((HRESULT)0x80040E2EL) - -// -// MessageId: DB_E_INTEGRITYVIOLATION -// -// MessageText: -// -// Value violated the integrity constraints for a column or table. -// -#define DB_E_INTEGRITYVIOLATION ((HRESULT)0x80040E2FL) - -// -// MessageId: DB_E_BADTYPENAME -// -// MessageText: -// -// Type name is invalid. -// -#define DB_E_BADTYPENAME ((HRESULT)0x80040E30L) - -// -// MessageId: DB_E_ABORTLIMITREACHED -// -// MessageText: -// -// Execution stopped because a resource limit was reached. No results were returned. -// -#define DB_E_ABORTLIMITREACHED ((HRESULT)0x80040E31L) - -//@@@+ V2.0 -#if( OLEDBVER >= 0x0200 ) -// -// MessageId: DB_E_ROWSETINCOMMAND -// -// MessageText: -// -// Command object whose command tree contains a rowset or rowsets cannot be cloned. -// -#define DB_E_ROWSETINCOMMAND ((HRESULT)0x80040E32L) - -// -// MessageId: DB_E_CANTTRANSLATE -// -// MessageText: -// -// Current tree cannot be represented as text. -// -#define DB_E_CANTTRANSLATE ((HRESULT)0x80040E33L) - -#endif // OLEDBVER >= 0x0200 -//@@@- V2.0 - -// -// MessageId: DB_E_DUPLICATEINDEXID -// -// MessageText: -// -// Index already exists. -// -#define DB_E_DUPLICATEINDEXID ((HRESULT)0x80040E34L) - -// -// MessageId: DB_E_NOINDEX -// -// MessageText: -// -// Index does not exist. -// -#define DB_E_NOINDEX ((HRESULT)0x80040E35L) - -// -// MessageId: DB_E_INDEXINUSE -// -// MessageText: -// -// Index is in use. -// -#define DB_E_INDEXINUSE ((HRESULT)0x80040E36L) - -// -// MessageId: DB_E_NOTABLE -// -// MessageText: -// -// Table does not exist. -// -#define DB_E_NOTABLE ((HRESULT)0x80040E37L) - -// -// MessageId: DB_E_CONCURRENCYVIOLATION -// -// MessageText: -// -// Rowset used optimistic concurrency and the value of a column has changed since it was last read. -// -#define DB_E_CONCURRENCYVIOLATION ((HRESULT)0x80040E38L) - -// -// MessageId: DB_E_BADCOPY -// -// MessageText: -// -// Errors detected during the copy. -// -#define DB_E_BADCOPY ((HRESULT)0x80040E39L) - -// -// MessageId: DB_E_BADPRECISION -// -// MessageText: -// -// Precision is invalid. -// -#define DB_E_BADPRECISION ((HRESULT)0x80040E3AL) - -// -// MessageId: DB_E_BADSCALE -// -// MessageText: -// -// Scale is invalid. -// -#define DB_E_BADSCALE ((HRESULT)0x80040E3BL) - -// -// MessageId: DB_E_BADTABLEID -// -// MessageText: -// -// Table ID is invalid. -// -#define DB_E_BADTABLEID ((HRESULT)0x80040E3CL) - -// DB_E_BADID is deprecated; use DB_E_BADTABLEID instead -#define DB_E_BADID DB_E_BADTABLEID - -// -// MessageId: DB_E_BADTYPE -// -// MessageText: -// -// Type is invalid. -// -#define DB_E_BADTYPE ((HRESULT)0x80040E3DL) - -// -// MessageId: DB_E_DUPLICATECOLUMNID -// -// MessageText: -// -// Column ID already exists or occurred more than once in the array of columns. -// -#define DB_E_DUPLICATECOLUMNID ((HRESULT)0x80040E3EL) - -// -// MessageId: DB_E_DUPLICATETABLEID -// -// MessageText: -// -// Table already exists. -// -#define DB_E_DUPLICATETABLEID ((HRESULT)0x80040E3FL) - -// -// MessageId: DB_E_TABLEINUSE -// -// MessageText: -// -// Table is in use. -// -#define DB_E_TABLEINUSE ((HRESULT)0x80040E40L) - -// -// MessageId: DB_E_NOLOCALE -// -// MessageText: -// -// Locale ID is not supported. -// -#define DB_E_NOLOCALE ((HRESULT)0x80040E41L) - -// -// MessageId: DB_E_BADRECORDNUM -// -// MessageText: -// -// Record number is invalid. -// -#define DB_E_BADRECORDNUM ((HRESULT)0x80040E42L) - -// -// MessageId: DB_E_BOOKMARKSKIPPED -// -// MessageText: -// -// Form of bookmark is valid, but no row was found to match it. -// -#define DB_E_BOOKMARKSKIPPED ((HRESULT)0x80040E43L) - -// -// MessageId: DB_E_BADPROPERTYVALUE -// -// MessageText: -// -// Property value is invalid. -// -#define DB_E_BADPROPERTYVALUE ((HRESULT)0x80040E44L) - -// -// MessageId: DB_E_INVALID -// -// MessageText: -// -// Rowset is not chaptered. -// -#define DB_E_INVALID ((HRESULT)0x80040E45L) - -// -// MessageId: DB_E_BADACCESSORFLAGS -// -// MessageText: -// -// One or more accessor flags were invalid. -// -#define DB_E_BADACCESSORFLAGS ((HRESULT)0x80040E46L) - -// -// MessageId: DB_E_BADSTORAGEFLAGS -// -// MessageText: -// -// One or more storage flags are invalid. -// -#define DB_E_BADSTORAGEFLAGS ((HRESULT)0x80040E47L) - -// -// MessageId: DB_E_BYREFACCESSORNOTSUPPORTED -// -// MessageText: -// -// Reference accessors are not supported by this provider. -// -#define DB_E_BYREFACCESSORNOTSUPPORTED ((HRESULT)0x80040E48L) - -// -// MessageId: DB_E_NULLACCESSORNOTSUPPORTED -// -// MessageText: -// -// Null accessors are not supported by this provider. -// -#define DB_E_NULLACCESSORNOTSUPPORTED ((HRESULT)0x80040E49L) - -// -// MessageId: DB_E_NOTPREPARED -// -// MessageText: -// -// Command was not prepared. -// -#define DB_E_NOTPREPARED ((HRESULT)0x80040E4AL) - -// -// MessageId: DB_E_BADACCESSORTYPE -// -// MessageText: -// -// Accessor is not a parameter accessor. -// -#define DB_E_BADACCESSORTYPE ((HRESULT)0x80040E4BL) - -// -// MessageId: DB_E_WRITEONLYACCESSOR -// -// MessageText: -// -// Accessor is write-only. -// -#define DB_E_WRITEONLYACCESSOR ((HRESULT)0x80040E4CL) - -// -// MessageId: DB_SEC_E_AUTH_FAILED -// -// MessageText: -// -// Authentication failed. -// -#define DB_SEC_E_AUTH_FAILED ((HRESULT)0x80040E4DL) - -// -// MessageId: DB_E_CANCELED -// -// MessageText: -// -// Operation was canceled. -// -#define DB_E_CANCELED ((HRESULT)0x80040E4EL) - -//@@@+ V2.0 -#if( OLEDBVER >= 0x0200 ) -// -// MessageId: DB_E_CHAPTERNOTRELEASED -// -// MessageText: -// -// Rowset is single-chaptered. The chapter was not released. -// -#define DB_E_CHAPTERNOTRELEASED ((HRESULT)0x80040E4FL) - -#endif // OLEDBVER >= 0x0200 -//@@@- V2.0 - -// -// MessageId: DB_E_BADSOURCEHANDLE -// -// MessageText: -// -// Source handle is invalid. -// -#define DB_E_BADSOURCEHANDLE ((HRESULT)0x80040E50L) - -// -// MessageId: DB_E_PARAMUNAVAILABLE -// -// MessageText: -// -// Provider cannot derive parameter information and SetParameterInfo has not been called. -// -#define DB_E_PARAMUNAVAILABLE ((HRESULT)0x80040E51L) - -// -// MessageId: DB_E_ALREADYINITIALIZED -// -// MessageText: -// -// Data source object is already initialized. -// -#define DB_E_ALREADYINITIALIZED ((HRESULT)0x80040E52L) - -// -// MessageId: DB_E_NOTSUPPORTED -// -// MessageText: -// -// Method is not supported by this provider. -// -#define DB_E_NOTSUPPORTED ((HRESULT)0x80040E53L) - -// -// MessageId: DB_E_MAXPENDCHANGESEXCEEDED -// -// MessageText: -// -// Number of rows with pending changes exceeded the limit. -// -#define DB_E_MAXPENDCHANGESEXCEEDED ((HRESULT)0x80040E54L) - -// -// MessageId: DB_E_BADORDINAL -// -// MessageText: -// -// Column does not exist. -// -#define DB_E_BADORDINAL ((HRESULT)0x80040E55L) - -// -// MessageId: DB_E_PENDINGCHANGES -// -// MessageText: -// -// Pending changes exist on a row with a reference count of zero. -// -#define DB_E_PENDINGCHANGES ((HRESULT)0x80040E56L) - -// -// MessageId: DB_E_DATAOVERFLOW -// -// MessageText: -// -// Literal value in the command exceeded the range of the type of the associated column. -// -#define DB_E_DATAOVERFLOW ((HRESULT)0x80040E57L) - -// -// MessageId: DB_E_BADHRESULT -// -// MessageText: -// -// HRESULT is invalid. -// -#define DB_E_BADHRESULT ((HRESULT)0x80040E58L) - -// -// MessageId: DB_E_BADLOOKUPID -// -// MessageText: -// -// Lookup ID is invalid. -// -#define DB_E_BADLOOKUPID ((HRESULT)0x80040E59L) - -// -// MessageId: DB_E_BADDYNAMICERRORID -// -// MessageText: -// -// DynamicError ID is invalid. -// -#define DB_E_BADDYNAMICERRORID ((HRESULT)0x80040E5AL) - -// -// MessageId: DB_E_PENDINGINSERT -// -// MessageText: -// -// Most recent data for a newly inserted row could not be retrieved because the insert is pending. -// -#define DB_E_PENDINGINSERT ((HRESULT)0x80040E5BL) - -// -// MessageId: DB_E_BADCONVERTFLAG -// -// MessageText: -// -// Conversion flag is invalid. -// -#define DB_E_BADCONVERTFLAG ((HRESULT)0x80040E5CL) - -// -// MessageId: DB_E_BADPARAMETERNAME -// -// MessageText: -// -// Parameter name is unrecognized. -// -#define DB_E_BADPARAMETERNAME ((HRESULT)0x80040E5DL) - -// -// MessageId: DB_E_MULTIPLESTORAGE -// -// MessageText: -// -// Multiple storage objects cannot be open simultaneously. -// -#define DB_E_MULTIPLESTORAGE ((HRESULT)0x80040E5EL) - -// -// MessageId: DB_E_CANTFILTER -// -// MessageText: -// -// Filter cannot be opened. -// -#define DB_E_CANTFILTER ((HRESULT)0x80040E5FL) - -// -// MessageId: DB_E_CANTORDER -// -// MessageText: -// -// Order cannot be opened. -// -#define DB_E_CANTORDER ((HRESULT)0x80040E60L) - -//@@@+ V2.0 -#if( OLEDBVER >= 0x0200 ) -// -// MessageId: MD_E_BADTUPLE -// -// MessageText: -// -// Tuple is invalid. -// -#define MD_E_BADTUPLE ((HRESULT)0x80040E61L) - -// -// MessageId: MD_E_BADCOORDINATE -// -// MessageText: -// -// Coordinate is invalid. -// -#define MD_E_BADCOORDINATE ((HRESULT)0x80040E62L) - -// -// MessageId: MD_E_INVALIDAXIS -// -// MessageText: -// -// Axis is invalid. -// -#define MD_E_INVALIDAXIS ((HRESULT)0x80040E63L) - -// -// MessageId: MD_E_INVALIDCELLRANGE -// -// MessageText: -// -// One or more cell ordinals is invalid. -// -#define MD_E_INVALIDCELLRANGE ((HRESULT)0x80040E64L) - -// -// MessageId: DB_E_NOCOLUMN -// -// MessageText: -// -// Column ID is invalid. -// -#define DB_E_NOCOLUMN ((HRESULT)0x80040E65L) - -// -// MessageId: DB_E_COMMANDNOTPERSISTED -// -// MessageText: -// -// Command does not have a DBID. -// -#define DB_E_COMMANDNOTPERSISTED ((HRESULT)0x80040E67L) - -// -// MessageId: DB_E_DUPLICATEID -// -// MessageText: -// -// DBID already exists. -// -#define DB_E_DUPLICATEID ((HRESULT)0x80040E68L) - -// -// MessageId: DB_E_OBJECTCREATIONLIMITREACHED -// -// MessageText: -// -// Session cannot be created because maximum number of active sessions was already reached. Consumer must release one or more sessions before creating a new session object. -// -#define DB_E_OBJECTCREATIONLIMITREACHED ((HRESULT)0x80040E69L) - -// -// MessageId: DB_E_BADINDEXID -// -// MessageText: -// -// Index ID is invalid. -// -#define DB_E_BADINDEXID ((HRESULT)0x80040E72L) - -// -// MessageId: DB_E_BADINITSTRING -// -// MessageText: -// -// Format of the initialization string does not conform to the OLE DB specification. -// -#define DB_E_BADINITSTRING ((HRESULT)0x80040E73L) - -// -// MessageId: DB_E_NOPROVIDERSREGISTERED -// -// MessageText: -// -// No OLE DB providers of this source type are registered. -// -#define DB_E_NOPROVIDERSREGISTERED ((HRESULT)0x80040E74L) - -// -// MessageId: DB_E_MISMATCHEDPROVIDER -// -// MessageText: -// -// Initialization string specifies a provider that does not match the active provider. -// -#define DB_E_MISMATCHEDPROVIDER ((HRESULT)0x80040E75L) - -// -// MessageId: DB_E_BADCOMMANDID -// -// MessageText: -// -// DBID is invalid. -// -#define DB_E_BADCOMMANDID ((HRESULT)0x80040E76L) - -#endif // OLEDBVER >= 0x0200 -//@@@- V2.0 -//@@@+ V2.1 -#if( OLEDBVER >= 0x0210 ) -#define SEC_E_PERMISSIONDENIED DB_SEC_E_PERMISSIONDENIED -// -// MessageId: SEC_E_BADTRUSTEEID -// -// MessageText: -// -// Trustee is invalid. -// -#define SEC_E_BADTRUSTEEID ((HRESULT)0x80040E6AL) - -// -// MessageId: SEC_E_NOTRUSTEEID -// -// MessageText: -// -// Trustee was not recognized for this data source. -// -#define SEC_E_NOTRUSTEEID ((HRESULT)0x80040E6BL) - -// -// MessageId: SEC_E_NOMEMBERSHIPSUPPORT -// -// MessageText: -// -// Trustee does not support memberships or collections. -// -#define SEC_E_NOMEMBERSHIPSUPPORT ((HRESULT)0x80040E6CL) - -// -// MessageId: SEC_E_INVALIDOBJECT -// -// MessageText: -// -// Object is invalid or unknown to the provider. -// -#define SEC_E_INVALIDOBJECT ((HRESULT)0x80040E6DL) - -// -// MessageId: SEC_E_NOOWNER -// -// MessageText: -// -// Object does not have an owner. -// -#define SEC_E_NOOWNER ((HRESULT)0x80040E6EL) - -// -// MessageId: SEC_E_INVALIDACCESSENTRYLIST -// -// MessageText: -// -// Access entry list is invalid. -// -#define SEC_E_INVALIDACCESSENTRYLIST ((HRESULT)0x80040E6FL) - -// -// MessageId: SEC_E_INVALIDOWNER -// -// MessageText: -// -// Trustee supplied as owner is invalid or unknown to the provider. -// -#define SEC_E_INVALIDOWNER ((HRESULT)0x80040E70L) - -// -// MessageId: SEC_E_INVALIDACCESSENTRY -// -// MessageText: -// -// Permission in the access entry list is invalid. -// -#define SEC_E_INVALIDACCESSENTRY ((HRESULT)0x80040E71L) - -// -// MessageId: DB_E_BADCONSTRAINTTYPE -// -// MessageText: -// -// ConstraintType is invalid or not supported by the provider. -// -#define DB_E_BADCONSTRAINTTYPE ((HRESULT)0x80040E77L) - -// -// MessageId: DB_E_BADCONSTRAINTFORM -// -// MessageText: -// -// ConstraintType is not DBCONSTRAINTTYPE_FOREIGNKEY and cForeignKeyColumns is not zero. -// -#define DB_E_BADCONSTRAINTFORM ((HRESULT)0x80040E78L) - -// -// MessageId: DB_E_BADDEFERRABILITY -// -// MessageText: -// -// Specified deferrability flag is invalid or not supported by the provider. -// -#define DB_E_BADDEFERRABILITY ((HRESULT)0x80040E79L) - -// -// MessageId: DB_E_BADMATCHTYPE -// -// MessageText: -// -// MatchType is invalid or the value is not supported by the provider. -// -#define DB_E_BADMATCHTYPE ((HRESULT)0x80040E80L) - -// -// MessageId: DB_E_BADUPDATEDELETERULE -// -// MessageText: -// -// Constraint update rule or delete rule is invalid. -// -#define DB_E_BADUPDATEDELETERULE ((HRESULT)0x80040E8AL) - -// -// MessageId: DB_E_BADCONSTRAINTID -// -// MessageText: -// -// Constraint ID is invalid. -// -#define DB_E_BADCONSTRAINTID ((HRESULT)0x80040E8BL) - -// -// MessageId: DB_E_BADCOMMANDFLAGS -// -// MessageText: -// -// Command persistence flag is invalid. -// -#define DB_E_BADCOMMANDFLAGS ((HRESULT)0x80040E8CL) - -// -// MessageId: DB_E_OBJECTMISMATCH -// -// MessageText: -// -// rguidColumnType points to a GUID that does not match the object type of this column, or this column was not set. -// -#define DB_E_OBJECTMISMATCH ((HRESULT)0x80040E8DL) - -// -// MessageId: DB_E_NOSOURCEOBJECT -// -// MessageText: -// -// Source row does not exist. -// -#define DB_E_NOSOURCEOBJECT ((HRESULT)0x80040E91L) - -// -// MessageId: DB_E_RESOURCELOCKED -// -// MessageText: -// -// OLE DB object represented by this URL is locked by one or more other processes. -// -#define DB_E_RESOURCELOCKED ((HRESULT)0x80040E92L) - -// -// MessageId: DB_E_NOTCOLLECTION -// -// MessageText: -// -// Client requested an object type that is valid only for a collection. -// -#define DB_E_NOTCOLLECTION ((HRESULT)0x80040E93L) - -// -// MessageId: DB_E_READONLY -// -// MessageText: -// -// Caller requested write access to a read-only object. -// -#define DB_E_READONLY ((HRESULT)0x80040E94L) - -// -// MessageId: DB_E_ASYNCNOTSUPPORTED -// -// MessageText: -// -// Asynchronous binding is not supported by this provider. -// -#define DB_E_ASYNCNOTSUPPORTED ((HRESULT)0x80040E95L) - -// -// MessageId: DB_E_CANNOTCONNECT -// -// MessageText: -// -// Connection to the server for this URL cannot be established. -// -#define DB_E_CANNOTCONNECT ((HRESULT)0x80040E96L) - -// -// MessageId: DB_E_TIMEOUT -// -// MessageText: -// -// Timeout occurred when attempting to bind to the object. -// -#define DB_E_TIMEOUT ((HRESULT)0x80040E97L) - -// -// MessageId: DB_E_RESOURCEEXISTS -// -// MessageText: -// -// Object cannot be created at this URL because an object named by this URL already exists. -// -#define DB_E_RESOURCEEXISTS ((HRESULT)0x80040E98L) - -// -// MessageId: DB_E_RESOURCEOUTOFSCOPE -// -// MessageText: -// -// URL is outside of scope. -// -#define DB_E_RESOURCEOUTOFSCOPE ((HRESULT)0x80040E8EL) - -// -// MessageId: DB_E_DROPRESTRICTED -// -// MessageText: -// -// Column or constraint could not be dropped because it is referenced by a dependent view or constraint. -// -#define DB_E_DROPRESTRICTED ((HRESULT)0x80040E90L) - -// -// MessageId: DB_E_DUPLICATECONSTRAINTID -// -// MessageText: -// -// Constraint already exists. -// -#define DB_E_DUPLICATECONSTRAINTID ((HRESULT)0x80040E99L) - -// -// MessageId: DB_E_OUTOFSPACE -// -// MessageText: -// -// Object cannot be created at this URL because the server is out of physical storage. -// -#define DB_E_OUTOFSPACE ((HRESULT)0x80040E9AL) - -#define SEC_E_PERMISSIONDENIED DB_SEC_E_PERMISSIONDENIED -#endif // OLEDBVER >= 0x0210 -//@@@- V2.1 -//@@@+ V2.5 -#if( OLEDBVER >= 0x0250 ) -// -// MessageId: DB_SEC_E_SAFEMODE_DENIED -// -// MessageText: -// -// Safety settings on this computer prohibit accessing a data source on another domain. -// -#define DB_SEC_E_SAFEMODE_DENIED ((HRESULT)0x80040E9BL) - -#endif // OLEDBVER >= 0x0250 -//@@@- V2.5 - -//@@@+ V2.6 -#if( OLEDBVER >= 0x0260 ) -// -// MessageId: DB_E_NOSTATISTIC -// -// MessageText: -// -// The specified statistic does not exist in the current data source or did not apply to the specified table or it does not support a histogram. -// -#define DB_E_NOSTATISTIC ((HRESULT)0x80040E9CL) - -// -// MessageId: DB_E_ALTERRESTRICTED -// -// MessageText: -// -// Column or table could not be altered because it is referenced by a constraint. -// -#define DB_E_ALTERRESTRICTED ((HRESULT)0x80040E9DL) - -// -// MessageId: DB_E_RESOURCENOTSUPPORTED -// -// MessageText: -// -// Requested object type is not supported by the provider. -// -#define DB_E_RESOURCENOTSUPPORTED ((HRESULT)0x80040E9EL) - -// -// MessageId: DB_E_NOCONSTRAINT -// -// MessageText: -// -// Constraint does not exist. -// -#define DB_E_NOCONSTRAINT ((HRESULT)0x80040E9FL) - -// -// MessageId: DB_E_COLUMNUNAVAILABLE -// -// MessageText: -// -// Requested column is valid, but could not be retrieved. This could be due to a forward only cursor attempting to go backwards in a row. -// -#define DB_E_COLUMNUNAVAILABLE ((HRESULT)0x80040EA0L) - -#endif // OLEDBVER >= 0x0260 -//@@@- V2.6 -// -// MessageId: DB_S_ROWLIMITEXCEEDED -// -// MessageText: -// -// Fetching requested number of rows will exceed total number of active rows supported by the rowset. -// -#define DB_S_ROWLIMITEXCEEDED ((HRESULT)0x00040EC0L) - -// -// MessageId: DB_S_COLUMNTYPEMISMATCH -// -// MessageText: -// -// One or more column types are incompatible. Conversion errors will occur during copying. -// -#define DB_S_COLUMNTYPEMISMATCH ((HRESULT)0x00040EC1L) - -// -// MessageId: DB_S_TYPEINFOOVERRIDDEN -// -// MessageText: -// -// Parameter type information was overridden by caller. -// -#define DB_S_TYPEINFOOVERRIDDEN ((HRESULT)0x00040EC2L) - -// -// MessageId: DB_S_BOOKMARKSKIPPED -// -// MessageText: -// -// Bookmark was skipped for deleted or nonmember row. -// -#define DB_S_BOOKMARKSKIPPED ((HRESULT)0x00040EC3L) - -//@@@+ V2.0 -#if( OLEDBVER >= 0x0200 ) -// -// MessageId: DB_S_NONEXTROWSET -// -// MessageText: -// -// No more rowsets. -// -#define DB_S_NONEXTROWSET ((HRESULT)0x00040EC5L) - -#endif // OLEDBVER >= 0x0200 -//@@@- V2.0 - -// -// MessageId: DB_S_ENDOFROWSET -// -// MessageText: -// -// Start or end of rowset or chapter was reached. -// -#define DB_S_ENDOFROWSET ((HRESULT)0x00040EC6L) - -// -// MessageId: DB_S_COMMANDREEXECUTED -// -// MessageText: -// -// Command was reexecuted. -// -#define DB_S_COMMANDREEXECUTED ((HRESULT)0x00040EC7L) - -// -// MessageId: DB_S_BUFFERFULL -// -// MessageText: -// -// Operation succeeded, but status array or string buffer could not be allocated. -// -#define DB_S_BUFFERFULL ((HRESULT)0x00040EC8L) - -// -// MessageId: DB_S_NORESULT -// -// MessageText: -// -// No more results. -// -#define DB_S_NORESULT ((HRESULT)0x00040EC9L) - -// -// MessageId: DB_S_CANTRELEASE -// -// MessageText: -// -// Server cannot release or downgrade a lock until the end of the transaction. -// -#define DB_S_CANTRELEASE ((HRESULT)0x00040ECAL) - -//@@@+ V2.5 -#if( OLEDBVER >= 0x0250 ) -// -// MessageId: DB_S_GOALCHANGED -// -// MessageText: -// -// Weight is not supported or exceeded the supported limit, and was set to 0 or the supported limit. -// -#define DB_S_GOALCHANGED ((HRESULT)0x00040ECBL) - -#endif // OLEDBVER >= 0x0250 -//@@@- V2.5 - -//@@@+ V1.5 -#if( OLEDBVER >= 0x0150 ) -// -// MessageId: DB_S_UNWANTEDOPERATION -// -// MessageText: -// -// Consumer does not want to receive further notification calls for this operation. -// -#define DB_S_UNWANTEDOPERATION ((HRESULT)0x00040ECCL) - -#endif // OLEDBVER >= 0x0150 -//@@@- V1.5 - -// -// MessageId: DB_S_DIALECTIGNORED -// -// MessageText: -// -// Input dialect was ignored and command was processed using default dialect. -// -#define DB_S_DIALECTIGNORED ((HRESULT)0x00040ECDL) - -// -// MessageId: DB_S_UNWANTEDPHASE -// -// MessageText: -// -// Consumer does not want to receive further notification calls for this phase. -// -#define DB_S_UNWANTEDPHASE ((HRESULT)0x00040ECEL) - -// -// MessageId: DB_S_UNWANTEDREASON -// -// MessageText: -// -// Consumer does not want to receive further notification calls for this reason. -// -#define DB_S_UNWANTEDREASON ((HRESULT)0x00040ECFL) - -//@@@+ V1.5 -#if( OLEDBVER >= 0x0150 ) -// -// MessageId: DB_S_ASYNCHRONOUS -// -// MessageText: -// -// Operation is being processed asynchronously. -// -#define DB_S_ASYNCHRONOUS ((HRESULT)0x00040ED0L) - -#endif // OLEDBVER >= 0x0150 -//@@@- V1.5 - -// -// MessageId: DB_S_COLUMNSCHANGED -// -// MessageText: -// -// Command was executed to reposition to the start of the rowset. Either the order of the columns changed, or columns were added to or removed from the rowset. -// -#define DB_S_COLUMNSCHANGED ((HRESULT)0x00040ED1L) - -// -// MessageId: DB_S_ERRORSRETURNED -// -// MessageText: -// -// Method had some errors, which were returned in the error array. -// -#define DB_S_ERRORSRETURNED ((HRESULT)0x00040ED2L) - -// -// MessageId: DB_S_BADROWHANDLE -// -// MessageText: -// -// Row handle is invalid. -// -#define DB_S_BADROWHANDLE ((HRESULT)0x00040ED3L) - -// -// MessageId: DB_S_DELETEDROW -// -// MessageText: -// -// Row handle referred to a deleted row. -// -#define DB_S_DELETEDROW ((HRESULT)0x00040ED4L) - -//@@@+ V2.5 -#if( OLEDBVER >= 0x0250 ) -// -// MessageId: DB_S_TOOMANYCHANGES -// -// MessageText: -// -// Provider cannot keep track of all the changes. Client must refetch the data associated with the watch region by using another method. -// -#define DB_S_TOOMANYCHANGES ((HRESULT)0x00040ED5L) - -#endif // OLEDBVER >= 0x0250 -//@@@- V2.5 - -// -// MessageId: DB_S_STOPLIMITREACHED -// -// MessageText: -// -// Execution stopped because a resource limit was reached. Results obtained so far were returned, but execution cannot resume. -// -#define DB_S_STOPLIMITREACHED ((HRESULT)0x00040ED6L) - -// -// MessageId: DB_S_LOCKUPGRADED -// -// MessageText: -// -// Lock was upgraded from the value specified. -// -#define DB_S_LOCKUPGRADED ((HRESULT)0x00040ED8L) - -// -// MessageId: DB_S_PROPERTIESCHANGED -// -// MessageText: -// -// One or more properties were changed as allowed by provider. -// -#define DB_S_PROPERTIESCHANGED ((HRESULT)0x00040ED9L) - -// -// MessageId: DB_S_ERRORSOCCURRED -// -// MessageText: -// -// Multiple-step operation completed with one or more errors. Check each status value. -// -#define DB_S_ERRORSOCCURRED ((HRESULT)0x00040EDAL) - -// -// MessageId: DB_S_PARAMUNAVAILABLE -// -// MessageText: -// -// Parameter is invalid. -// -#define DB_S_PARAMUNAVAILABLE ((HRESULT)0x00040EDBL) - -// -// MessageId: DB_S_MULTIPLECHANGES -// -// MessageText: -// -// Updating a row caused more than one row to be updated in the data source. -// -#define DB_S_MULTIPLECHANGES ((HRESULT)0x00040EDCL) - -//@@@+ V2.1 -#if( OLEDBVER >= 0x0210 ) -// -// MessageId: DB_S_NOTSINGLETON -// -// MessageText: -// -// Row object was requested on a non-singleton result. First row was returned. -// -#define DB_S_NOTSINGLETON ((HRESULT)0x00040ED7L) - -// -// MessageId: DB_S_NOROWSPECIFICCOLUMNS -// -// MessageText: -// -// Row has no row-specific columns. -// -#define DB_S_NOROWSPECIFICCOLUMNS ((HRESULT)0x00040EDDL) - -#endif // OLEDBVER >= 0x0210 -//@@@- V2.1 -// To help DSL display more meaningful error message, we need to overwrite system error message -// in the following two cases. -#ifdef MESSAGESANDHEADERS -//(0x80030002L)STG_E_FILENOTFOUND -// -// MessageId: STG_E_FILENOTFOUND -// -// MessageText: -// -// The file could not be found. -// -#define STG_E_FILENOTFOUND ((HRESULT)0x80030002L) - -//(0x80030003L)STG_E_PATHNOTFOUND -// -// MessageId: STG_E_PATHNOTFOUND -// -// MessageText: -// -// The path could not be found. -// -#define STG_E_PATHNOTFOUND ((HRESULT)0x80030003L) - -//(0x80030050L)STG_E_FILEALREADYEXISTS -// -// MessageId: STG_E_FILEALREADYEXISTS -// -// MessageText: -// -// The file already exists. -// -#define STG_E_FILEALREADYEXISTS ((HRESULT)0x80030050L) - -//(0x800300fbL)STG_E_INVALIDHEADER -// -// MessageId: STG_E_INVALIDHEADER -// -// MessageText: -// -// The file is not a valid compound file. -// -#define STG_E_INVALIDHEADER ((HRESULT)0x800300FBL) - -//(0x800300fcL)STG_E_INVALIDNAME -// -// MessageId: STG_E_INVALIDNAME -// -// MessageText: -// -// The name is not valid. -// -#define STG_E_INVALIDNAME ((HRESULT)0x800300FCL) - -//(0x80030104L)STG_E_OLDFORMAT -// -// MessageId: STG_E_OLDFORMAT -// -// MessageText: -// -// The compound file was produced with an incompatible version of storage. -// -#define STG_E_OLDFORMAT ((HRESULT)0x80030104L) - -//(0x80030105L)STG_E_OLDDLL -// -// MessageId: STG_E_OLDDLL -// -// MessageText: -// -// The compound file was produced with an incompatible version of storage. -// -#define STG_E_OLDDLL ((HRESULT)0x80030105L) - -#endif //MESSAGESANDHEADERS -#endif // _OLEDBERR_H_ - diff --git a/pub/ddk/oprghdlr.h b/pub/ddk/oprghdlr.h deleted file mode 100644 index 93d7563..0000000 --- a/pub/ddk/oprghdlr.h +++ /dev/null @@ -1,135 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - oprghdlr.h - -Abstract: - - This header file contains the shared structures for the ACPI op region - registration DLL. - -Author: - - Vincent Geglia 09-Feb-2000 - -Environment: - - Kernel mode - -Notes: - - -Revision History: - - ---*/ - -#include "wdm.h" - -// -// Make sure that we define the right calling convention -// - -#ifdef EXPORT - #undef EXPORT -#endif -#define EXPORT __cdecl - -// -// Op region handler and callback function prototypes -// - -__drv_functionClass(ACPI_OP_REGION_CALLBACK) -__drv_sameIRQL -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -typedef -VOID -EXPORT -ACPI_OP_REGION_CALLBACK ( - ); - -typedef ACPI_OP_REGION_CALLBACK *PACPI_OP_REGION_CALLBACK; - -__drv_functionClass(ACPI_OP_REGION_HANDLER) -__drv_sameIRQL -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -typedef -NTSTATUS -EXPORT -ACPI_OP_REGION_HANDLER ( - ULONG AccessType, - PVOID OperationRegionObject, - ULONG Address, - ULONG Size, - PULONG Data, - ULONG_PTR Context, - PACPI_OP_REGION_CALLBACK CompletionHandler, - PVOID CompletionContext - ); - -typedef ACPI_OP_REGION_HANDLER *PACPI_OP_REGION_HANDLER; - -// -// Exposed function prototypes -// - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSTATUS -RegisterOpRegionHandler ( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG AccessType, - __in ULONG RegionSpace, - __in PACPI_OP_REGION_HANDLER Handler, - __in PVOID Context, - __in ULONG Flags, - __out PVOID *OperationRegionObject - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSTATUS -DeRegisterOpRegionHandler ( - __in PDEVICE_OBJECT DeviceObject, - __in PVOID OperationRegionObject - ); - -// -// Exposed definitions -// - -// -// Access types for OpRegions -// -#define ACPI_OPREGION_ACCESS_AS_RAW 0x1 -#define ACPI_OPREGION_ACCESS_AS_COOKED 0x2 - -// -// Allowable region spaces -// -#define ACPI_OPREGION_REGION_SPACE_MEMORY 0x0 -#define ACPI_OPREGION_REGION_SPACE_IO 0x1 -#define ACPI_OPREGION_REGION_SPACE_PCI_CONFIG 0x2 -#define ACPI_OPREGION_REGION_SPACE_EC 0x3 -#define ACPI_OPREGION_REGION_SPACE_SMB 0x4 -#define ACPI_OPREGION_REGION_SPACE_CMOS_CONFIG 0x5 -#define ACPI_OPREGION_REGION_SPACE_PCIBARTARGET 0x6 - -// -// Operation to perform on region -// -#define ACPI_OPREGION_READ 0x0 -#define ACPI_OPREGION_WRITE 0x1 - -// -// Flag definitions for op region registration -// - -#define ACPI_OPREGION_ACCESS_AT_HIGH_LEVEL 0x1 // Indicates the handler function can be called at HIGH_LEVEL IRQL - - diff --git a/pub/ddk/parallel.h b/pub/ddk/parallel.h deleted file mode 100644 index 9675e68..0000000 --- a/pub/ddk/parallel.h +++ /dev/null @@ -1,755 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - parallel.h - -Abstract: - - This file defines the services supplied by the ParPort driver. - -Revision History: - ---*/ - -#ifndef _PARALLEL_ -#define _PARALLEL_ - -#include - -// -// Define the parallel port device name strings. -// - -#define DD_PARALLEL_PORT_BASE_NAME_U L"ParallelPort" - -// -// IEEE 1284.3 Daisy Chain (DC) Device ID's range from 0 to 3. Devices -// are identified based on their connection order in the daisy chain -// relative to the other 1284.3 DC devices. Device 0 is the 1284.3 DC -// device that is closest to host port. -// -#define IEEE_1284_3_DAISY_CHAIN_MAX_ID 3 - -// -// NtDeviceIoControlFile internal IoControlCode values for parallel device. -// - -// Legacy - acquires entire parallel "bus" -#define IOCTL_INTERNAL_PARALLEL_PORT_ALLOCATE CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 11, METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define IOCTL_INTERNAL_GET_PARALLEL_PORT_INFO CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_PARALLEL_CONNECT_INTERRUPT CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 13, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_PARALLEL_DISCONNECT_INTERRUPT CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 14, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_RELEASE_PARALLEL_PORT_INFO CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 15, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_GET_MORE_PARALLEL_PORT_INFO CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 17, METHOD_BUFFERED, FILE_ANY_ACCESS) - -// Saves current chipset mode - puts the chipset into Specified mode (implemented in filter) -#define IOCTL_INTERNAL_PARCHIP_CONNECT CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 18, METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 19, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_PARALLEL_CLEAR_CHIP_MODE CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 20, METHOD_BUFFERED, FILE_ANY_ACCESS) - -// New parport IOCTLs -#define IOCTL_INTERNAL_GET_PARALLEL_PNP_INFO CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 21, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_INIT_1284_3_BUS CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 22, METHOD_BUFFERED, FILE_ANY_ACCESS) -// Takes a flat namespace Id for the device, also acquires the port -#define IOCTL_INTERNAL_SELECT_DEVICE CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 23, METHOD_BUFFERED, FILE_ANY_ACCESS) -// Takes a flat namespace Id for the device, also releases the port -#define IOCTL_INTERNAL_DESELECT_DEVICE CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 24, METHOD_BUFFERED, FILE_ANY_ACCESS) - -// New parclass IOCTLs -#if (NTDDI_VERSION >= NTDDI_WINXP) // Windows XP -#define IOCTL_INTERNAL_GET_PARPORT_FDO CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 29, METHOD_BUFFERED, FILE_ANY_ACCESS) -#endif -#define IOCTL_INTERNAL_PARCLASS_CONNECT CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 30, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_PARCLASS_DISCONNECT CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 31, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_DISCONNECT_IDLE CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 32, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_LOCK_PORT CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 37, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_UNLOCK_PORT CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 38, METHOD_BUFFERED, FILE_ANY_ACCESS) - -// IOCTL version of call to ParPort's FreePort function -#define IOCTL_INTERNAL_PARALLEL_PORT_FREE CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 40, METHOD_BUFFERED, FILE_ANY_ACCESS) - -// IOCTLs for IEEE1284.3 -#define IOCTL_INTERNAL_PARDOT3_CONNECT CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 41, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_PARDOT3_DISCONNECT CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_PARDOT3_RESET CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 43, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_PARDOT3_SIGNAL CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 44, METHOD_BUFFERED, FILE_ANY_ACCESS) - - -// -// IOCTLs for registering/unregistering for ParPort's RemovalRelations -// -// - A device object should register for removal relations with a -// parport device if the device is physically connected to the -// parallel port. -// -// - Parport will report all devices that have registered with it for -// removal relations in response to a PnP QUERY_DEVICE_RELATIONS of -// type RemovalRelations. This allows PnP to remove all device stacks -// that depend on the parport device prior to removing the parport -// device itself. -// -// - The single Input parameter is a PARPORT_REMOVAL_RELATIONS -// structure that is defined below -// -#define IOCTL_INTERNAL_REGISTER_FOR_REMOVAL_RELATIONS CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 50, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_UNREGISTER_FOR_REMOVAL_RELATIONS CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 51, METHOD_BUFFERED, FILE_ANY_ACCESS) - -typedef struct _PARPORT_REMOVAL_RELATIONS { - PDEVICE_OBJECT DeviceObject; // device object that is registering w/Parport - ULONG Flags; // Flags - reserved - set to 0 for now - PUNICODE_STRING DeviceName; // DeviceName identifier of device registering for removal relations - used for debugging - // - printed in parport's debug spew - convention is to use same DeviceName that was passed to - // IoCreateDevice -} PARPORT_REMOVAL_RELATIONS, *PPARPORT_REMOVAL_RELATIONS; - -#if (NTDDI_VERSION >= NTDDI_WINXP) // Windows XP -#define IOCTL_INTERNAL_LOCK_PORT_NO_SELECT CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 52, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_UNLOCK_PORT_NO_DESELECT CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 53, METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define IOCTL_INTERNAL_DISABLE_END_OF_CHAIN_BUS_RESCAN CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 54, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_INTERNAL_ENABLE_END_OF_CHAIN_BUS_RESCAN CTL_CODE(FILE_DEVICE_PARALLEL_PORT, 55, METHOD_BUFFERED, FILE_ANY_ACCESS) -#endif - - -// Define 1284.3 command qualifiers -#define MODE_LEN_1284_3 7 // # of magic sequence bytes -static UCHAR ModeQualifier[MODE_LEN_1284_3] = { 0xAA, 0x55, 0x00, 0xFF, 0x87, 0x78, 0xFF }; - -#define LEGACYZIP_MODE_LEN 3 -static UCHAR LegacyZipModeQualifier[LEGACYZIP_MODE_LEN] = { 0x00, 0x3c, 0x20 }; - -typedef enum { - P12843DL_OFF, - P12843DL_DOT3_DL, - P12843DL_MLC_DL, - P12843DL_DOT4_DL -} P12843_DL_MODES; - -// Define 1284.3 Commands -#define CPP_ASSIGN_ADDR 0x00 -#define CPP_SELECT 0xE0 -#define CPP_DESELECT 0x30 -#define CPP_QUERY_INT 0x08 -#define CPP_DISABLE_INT 0x40 -#define CPP_ENABLE_INT 0x48 -#define CPP_CLEAR_INT_LAT 0x50 -#define CPP_SET_INT_LAT 0x58 -#define CPP_COMMAND_FILTER 0xF8 - - -typedef -BOOLEAN -(*PPARALLEL_TRY_ALLOCATE_ROUTINE) ( - __in PVOID TryAllocateContext - ); - -typedef -VOID -(*PPARALLEL_FREE_ROUTINE) ( - __in PVOID FreeContext - ); - -typedef -ULONG -(*PPARALLEL_QUERY_WAITERS_ROUTINE) ( - __in PVOID QueryAllocsContext - ); - -typedef -NTSTATUS -(*PPARALLEL_SET_CHIP_MODE) ( - __in PVOID SetChipContext, - __in UCHAR ChipMode - ); - -typedef -NTSTATUS -(*PPARALLEL_CLEAR_CHIP_MODE) ( - __in PVOID ClearChipContext, - __in UCHAR ChipMode - ); - -typedef -NTSTATUS -(*PPARALLEL_TRY_SELECT_ROUTINE) ( - __in PVOID TrySelectContext, - __in PVOID TrySelectCommand - ); - -typedef -NTSTATUS -(*PPARALLEL_DESELECT_ROUTINE) ( - __in PVOID DeselectContext, - __in PVOID DeselectCommand - ); - -typedef -NTSTATUS -(*PPARCHIP_SET_CHIP_MODE) ( - __in PVOID SetChipContext, - __in UCHAR ChipMode - ); - -typedef -NTSTATUS -(*PPARCHIP_CLEAR_CHIP_MODE) ( - __in PVOID ClearChipContext, - __in UCHAR ChipMode - ); - -// -// Hardware Capabilities -// -#define PPT_NO_HARDWARE_PRESENT 0x00000000 -#define PPT_ECP_PRESENT 0x00000001 -#define PPT_EPP_PRESENT 0x00000002 -#define PPT_EPP_32_PRESENT 0x00000004 -#define PPT_BYTE_PRESENT 0x00000008 -#define PPT_BIDI_PRESENT 0x00000008 // deprecated - will be removed soon! dvdf -#define PPT_1284_3_PRESENT 0x00000010 - -// Added DVDR 10-6-98 - -// Structure passed to the ParChip Filter when calling it -// with the IOCTL_INTERNAL_CHIP_FILTER_CONNECT ioctl -typedef struct _PARALLEL_PARCHIP_INFO { - PUCHAR Controller; - PUCHAR EcrController; - ULONG HardwareModes; - PPARCHIP_SET_CHIP_MODE ParChipSetMode; - PPARCHIP_CLEAR_CHIP_MODE ParChipClearMode; - PVOID Context; - BOOLEAN success; -} PARALLEL_PARCHIP_INFO, *PPARALLEL_PARCHIP_INFO; - -// End Added by DVDR 10-6-1998 - - -typedef struct _PARALLEL_PORT_INFORMATION { - PHYSICAL_ADDRESS OriginalController; - PUCHAR Controller; - ULONG SpanOfController; - PPARALLEL_TRY_ALLOCATE_ROUTINE TryAllocatePort; // nonblocking callback to allocate port - PPARALLEL_FREE_ROUTINE FreePort; // callback to free port - PPARALLEL_QUERY_WAITERS_ROUTINE QueryNumWaiters; // callback to query number of waiters for port allocation - PVOID Context; // context for callbacks to ParPort device -} PARALLEL_PORT_INFORMATION, *PPARALLEL_PORT_INFORMATION; - -typedef struct _PARALLEL_PNP_INFORMATION { - PHYSICAL_ADDRESS OriginalEcpController; - PUCHAR EcpController; - ULONG SpanOfEcpController; - ULONG PortNumber; // deprecated - do not use - ULONG HardwareCapabilities; - PPARALLEL_SET_CHIP_MODE TrySetChipMode; - PPARALLEL_CLEAR_CHIP_MODE ClearChipMode; - ULONG FifoDepth; - ULONG FifoWidth; - PHYSICAL_ADDRESS EppControllerPhysicalAddress; - ULONG SpanOfEppController; - ULONG Ieee1284_3DeviceCount; // number of .3 daisy chain devices connected to this ParPort - PPARALLEL_TRY_SELECT_ROUTINE TrySelectDevice; - PPARALLEL_DESELECT_ROUTINE DeselectDevice; - PVOID Context; - ULONG CurrentMode; - PWSTR PortName; // symbolic link name for legacy device object -} PARALLEL_PNP_INFORMATION, *PPARALLEL_PNP_INFORMATION; - -// Start Added by DVDR 2-19-1998 - -// -// PARALLEL_1284_COMMAND CommandFlags -// - -// this flag is deprecated - use 1284.3 daisy chain ID == 4 to indicate End-Of-Chain device -#define PAR_END_OF_CHAIN_DEVICE ((ULONG)0x00000001) // The target device for this command - // is an End-Of-Chain device, the - // contents of the ID field are - // undefined and should be ignored - -#define PAR_HAVE_PORT_KEEP_PORT ((ULONG)0x00000002) // Indicates that the requesting driver - // has previously acquired the parallel port - // and does is not ready to release it yet. - // - // On a SELECT_DEVICE ParPort should NOT - // try to acquire the port before selecting - // the device. - // - // On a DESELECT_DEVICE ParPort should NOT - // free the port after deselecting the device. - -#define PAR_LEGACY_ZIP_DRIVE ((ULONG)0x00000004) // The target device for this command - // is a Legacy Iomega Zip drive, the - // contents of the ID field are - // undefined and should be ignored - - -#define PAR_LEGACY_ZIP_DRIVE_STD_MODE ((ULONG)0x00000010) // The target device for these commands -#define PAR_LEGACY_ZIP_DRIVE_EPP_MODE ((ULONG)0x00000020) // are a Legacy Iomega Zip drive, the - // contents of the ID field are - // undefined and should be ignored - // This will select the Zip into DISK or EPP Mode - -#define DOT3_END_OF_CHAIN_ID 4 // this ID used in a 1284.3 SELECT or DESELECT means the End-Of-Chain device -#define DOT3_LEGACY_ZIP_ID 5 // this ID used in a 1284.3 SELECT or DESELECT means Legacy Zip drive - -// -// The following structure is passed in on an -// IOCTL_INTERNAL_SELECT_DEVICE and on an -// IOCTL_INTERNAL_DESELECT_DEVICE -typedef struct _PARALLEL_1284_COMMAND { - UCHAR ID; // 0..3 for 1284.3 daisy chain device, 4 for End-Of-Chain device, 5 for Legacy Zip - UCHAR Port; // reserved ( set == 0 ) - ULONG CommandFlags; // see above -} PARALLEL_1284_COMMAND, *PPARALLEL_1284_COMMAND; - - -// -// Hardware Modes -// -#define INITIAL_MODE 0x00000000 - -// Disable Parchip and ECR arbitrator -// 0 - Parchip and ecr arbritrator is off -// 1 - Parchip and ecr arbitrator is on -#define PARCHIP_ECR_ARBITRATOR 1 - -// -// The following structure is passed in on an -// IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE and on an -// IOCTL_INTERNAL_PARALLEL_CLEAR_CHIP_MODE -// -typedef struct _PARALLEL_CHIP_MODE { - UCHAR ModeFlags; - BOOLEAN success; -} PARALLEL_CHIP_MODE, *PPARALLEL_CHIP_MODE; - -// End Added by DVDR 2-19-1998 - -// -// The following structure is passed in on an -// IOCTL_INTERNAL_PARALLEL_CONNECT_INTERRUPT and on an -// IOCTL_INTERNAL_PARALLEL_DISCONNECT_INTERRUPT request. -// - -typedef -VOID -(*PPARALLEL_DEFERRED_ROUTINE) ( - __in PVOID DeferredContext - ); - -typedef struct _PARALLEL_INTERRUPT_SERVICE_ROUTINE { - PKSERVICE_ROUTINE InterruptServiceRoutine; - PVOID InterruptServiceContext; - PPARALLEL_DEFERRED_ROUTINE DeferredPortCheckRoutine; /* OPTIONAL */ - PVOID DeferredPortCheckContext; /* OPTIONAL */ -} PARALLEL_INTERRUPT_SERVICE_ROUTINE, *PPARALLEL_INTERRUPT_SERVICE_ROUTINE; - -// -// The following structure is returned on an -// IOCTL_INTERNAL_PARALLEL_CONNECT_INTERRUPT request; -// - -typedef struct _PARALLEL_INTERRUPT_INFORMATION { - PKINTERRUPT InterruptObject; - PPARALLEL_TRY_ALLOCATE_ROUTINE TryAllocatePortAtInterruptLevel; - PPARALLEL_FREE_ROUTINE FreePortFromInterruptLevel; - PVOID Context; -} PARALLEL_INTERRUPT_INFORMATION, *PPARALLEL_INTERRUPT_INFORMATION; - -// -// The following structure is returned on an -// IOCTL_INTERNAL_GET_MORE_PARALLEL_PORT_INFO. -// - -typedef struct _MORE_PARALLEL_PORT_INFORMATION { - INTERFACE_TYPE InterfaceType; - ULONG BusNumber; - ULONG InterruptLevel; - ULONG InterruptVector; - KAFFINITY InterruptAffinity; - KINTERRUPT_MODE InterruptMode; -} MORE_PARALLEL_PORT_INFORMATION, *PMORE_PARALLEL_PORT_INFORMATION; - -typedef enum { - SAFE_MODE, - UNSAFE_MODE // Available only through kernel. Your driver - // will be humiliated if you choose UNSAFE_MODE and - // then "make a mistake". - dvrh (PCized by dvdf) -} PARALLEL_SAFETY; - -// -// The following structure is returned by -// IOCTL_INTERNAL_PARCLASS_CONNECT. -// - -typedef -USHORT -(*PDETERMINE_IEEE_MODES) ( - __in PVOID Context - ); - -#define OLD_PARCLASS 0 - -#if OLD_PARCLASS -typedef -NTSTATUS -(*PNEGOTIATE_IEEE_MODE) ( - __in PVOID Extension, - __in UCHAR Extensibility - ); -#else -typedef -NTSTATUS -(*PNEGOTIATE_IEEE_MODE) ( - __in PVOID Context, - __in USHORT ModeMaskFwd, - __in USHORT ModeMaskRev, - __in PARALLEL_SAFETY ModeSafety, - __in BOOLEAN IsForward - ); -#endif - -typedef -NTSTATUS -(*PTERMINATE_IEEE_MODE) ( - __in PVOID Context - ); - -typedef -NTSTATUS -(*PPARALLEL_IEEE_FWD_TO_REV)( - __in PVOID Context - ); - -typedef -NTSTATUS -(*PPARALLEL_IEEE_REV_TO_FWD)( - __in PVOID Context - ); - -typedef -NTSTATUS -(*PPARALLEL_READ) ( - __in PVOID Context, - __out_bcount_part(NumBytesToRead,*NumBytesRead) PVOID Buffer, - __in ULONG NumBytesToRead, - __out PULONG NumBytesRead, - __in UCHAR Channel - ); - -typedef -NTSTATUS -(*PPARALLEL_WRITE) ( - __in PVOID Context, - __in_bcount(NumBytesToWrite) PVOID Buffer, - __in ULONG NumBytesToWrite, - __out PULONG NumBytesWritten, - __in UCHAR Channel - ); - -typedef -NTSTATUS -(*PPARALLEL_TRYSELECT_DEVICE) ( - __in PVOID Context, - __in PARALLEL_1284_COMMAND Command - ); - -typedef -NTSTATUS -(*PPARALLEL_DESELECT_DEVICE) ( - __in PVOID Context, - __in PARALLEL_1284_COMMAND Command - ); - -typedef struct _PARCLASS_INFORMATION { - PUCHAR Controller; - PUCHAR EcrController; - ULONG SpanOfController; - PDETERMINE_IEEE_MODES DetermineIeeeModes; - PNEGOTIATE_IEEE_MODE NegotiateIeeeMode; - PTERMINATE_IEEE_MODE TerminateIeeeMode; - PPARALLEL_IEEE_FWD_TO_REV IeeeFwdToRevMode; - PPARALLEL_IEEE_REV_TO_FWD IeeeRevToFwdMode; - PPARALLEL_READ ParallelRead; - PPARALLEL_WRITE ParallelWrite; - PVOID ParclassContext; - ULONG HardwareCapabilities; - ULONG FifoDepth; - ULONG FifoWidth; - PPARALLEL_TRYSELECT_DEVICE ParallelTryselect; - PPARALLEL_DESELECT_DEVICE ParallelDeSelect; -} PARCLASS_INFORMATION, *PPARCLASS_INFORMATION; - -// -// Standard and ECP parallel port offsets. -// - -#define DATA_OFFSET 0 -#define OFFSET_ECP_AFIFO 0x0000 // ECP Mode Address FIFO -#define AFIFO_OFFSET OFFSET_ECP_AFIFO // ECP Mode Address FIFO -#define DSR_OFFSET 1 -#define DCR_OFFSET 2 -#define EPP_OFFSET 4 - -// default to the old defines - note that the old defines break on PCI cards -#ifndef DVRH_USE_PARPORT_ECP_ADDR - #define DVRH_USE_PARPORT_ECP_ADDR 0 -#endif - -// DVRH_USE_PARPORT_ECP_ADDR settings -// 0 - ECP registers are hardcoded to -// Controller + 0x400 -// 1 - ECP registers are pulled from -// Parport which hopefully got -// them from PnP. - -#if (0 == DVRH_USE_PARPORT_ECP_ADDR) -// ***Note: These do not hold for PCI parallel ports - #define ECP_OFFSET 0x400 - #define CNFGB_OFFSET 0x401 - #define ECR_OFFSET 0x402 -#else - #define ECP_OFFSET 0x0 - #define CNFGB_OFFSET 0x1 - #define ECR_OFFSET 0x2 -#endif - -#define FIFO_OFFSET ECP_OFFSET -#define CFIFO_OFFSET ECP_OFFSET -#define CNFGA_OFFSET ECP_OFFSET -#define ECP_DFIFO_OFFSET ECP_OFFSET // ECP Mode Data FIFO -#define TFIFO_OFFSET ECP_OFFSET -#define OFFSET_ECP_DFIFO ECP_OFFSET // ECP Mode Data FIFO -#define OFFSET_TFIFO ECP_OFFSET // Test FIFO -#define OFFSET_CFIFO ECP_OFFSET // Fast Centronics Data FIFO -#define OFFSET_ECR ECR_OFFSET // Extended Control Register - -#define OFFSET_PARALLEL_REGISTER_SPAN 0x0003 - -#define ECP_SPAN 3 -#define EPP_SPAN 4 - -// -// Bit definitions for the DSR. -// - -#define DSR_NOT_BUSY 0x80 -#define DSR_NOT_ACK 0x40 -#define DSR_PERROR 0x20 -#define DSR_SELECT 0x10 -#define DSR_NOT_FAULT 0x08 - -// -// More bit definitions for the DSR. -// - -#define DSR_NOT_PTR_BUSY 0x80 -#define DSR_NOT_PERIPH_ACK 0x80 -#define DSR_WAIT 0x80 -#define DSR_PTR_CLK 0x40 -#define DSR_PERIPH_CLK 0x40 -#define DSR_INTR 0x40 -#define DSR_ACK_DATA_REQ 0x20 -#define DSR_NOT_ACK_REVERSE 0x20 -#define DSR_XFLAG 0x10 -#define DSR_NOT_DATA_AVAIL 0x08 -#define DSR_NOT_PERIPH_REQUEST 0x08 - -// -// Bit definitions for the DCR. -// - -#define DCR_RESERVED 0xC0 -#define DCR_DIRECTION 0x20 -#define DCR_ACKINT_ENABLED 0x10 -#define DCR_SELECT_IN 0x08 -#define DCR_NOT_INIT 0x04 -#define DCR_AUTOFEED 0x02 -#define DCR_STROBE 0x01 - -// -// More bit definitions for the DCR. -// - -#define DCR_NOT_1284_ACTIVE 0x08 -#define DCR_ASTRB 0x08 -#define DCR_NOT_REVERSE_REQUEST 0x04 -#define DCR_NULL 0x04 -#define DCR_NOT_HOST_BUSY 0x02 -#define DCR_NOT_HOST_ACK 0x02 -#define DCR_DSTRB 0x02 -#define DCR_NOT_HOST_CLK 0x01 -#define DCR_WRITE 0x01 - -// -// Bit definitions for configuration register A. -// - -#define CNFGA_IMPID_MASK 0x70 -#define CNFGA_IMPID_16BIT 0x00 -#define CNFGA_IMPID_8BIT 0x10 -#define CNFGA_IMPID_32BIT 0x20 - -#define CNFGA_NO_TRANS_BYTE 0x04 - -//////////////////////////////////////////////////////////////////////////////// -// ECR values that establish basic hardware modes. In each case, the default -// is to disable error interrupts, DMA, and service interrupts. -//////////////////////////////////////////////////////////////////////////////// - -#if (0 == PARCHIP_ECR_ARBITRATOR) - #define DEFAULT_ECR_PS2 0x34 - #define DEFAULT_ECR_ECP 0x74 -#endif - -// -// Bit definitions for ECR register. -// - -#define ECR_ERRINT_DISABLED 0x10 -#define ECR_DMA_ENABLED 0x08 -#define ECR_SVC_INT_DISABLED 0x04 - -#define ECR_MODE_MASK 0x1F -#define ECR_SPP_MODE 0x00 -#define ECR_BYTE_MODE 0x20 // PS/2 -#define ECR_BYTE_PIO_MODE (ECR_BYTE_MODE | ECR_ERRINT_DISABLED | ECR_SVC_INT_DISABLED) - -#define ECR_FASTCENT_MODE 0x40 -#define ECR_ECP_MODE 0x60 -#define ECR_ECP_PIO_MODE (ECR_ECP_MODE | ECR_ERRINT_DISABLED | ECR_SVC_INT_DISABLED) - -#define ECR_EPP_MODE 0x80 -#define ECR_EPP_PIO_MODE (ECR_EPP_MODE | ECR_ERRINT_DISABLED | ECR_SVC_INT_DISABLED) - -#define ECR_RESERVED_MODE 0x10 -#define ECR_TEST_MODE 0xC0 -#define ECR_CONFIG_MODE 0xE0 - -#define DEFAULT_ECR_TEST 0xD4 -#define DEFAULT_ECR_COMPATIBILITY 0x14 - -#define DEFAULT_ECR_CONFIGURATION 0xF4 - -#define ECR_FIFO_MASK 0x03 // Mask to isolate FIFO bits -#define ECR_FIFO_FULL 0x02 // FIFO completely full -#define ECR_FIFO_EMPTY 0x01 // FIFO completely empty -#define ECR_FIFO_SOME_DATA 0x00 // FIFO has some data in it - -#define ECP_MAX_FIFO_DEPTH 4098 // Likely max for ECP HW FIFO size - -//------------------------------------------------------------------------ -// Mask and test values for extracting the Implementation ID from the -// ConfigA register -//------------------------------------------------------------------------ - -#define CNFGA_IMPID_MASK 0x70 -#define CNFGA_IMPID_SHIFT 4 - -#define FIFO_PWORD_8BIT 1 -#define FIFO_PWORD_16BIT 0 -#define FIFO_PWORD_32BIT 2 - - -#define TEST_ECR_FIFO(registerValue,testValue) \ - ( ( (registerValue) & ECR_FIFO_MASK ) == testValue ) - -////////////////////////////////////////////////////////////////////////////// -// The following BIT_x definitions provide a generic bit shift value -// based upon the bit's position in a hardware register or byte of -// memory. These constants are used by some of the macros that are -// defined below. -////////////////////////////////////////////////////////////////////////////// - -#define BIT_7 7 -#define BIT_6 6 -#define BIT_5 5 -#define BIT_4 4 -#define BIT_3 3 -#define BIT_2 2 -#define BIT_1 1 -#define BIT_0 0 - -#define BIT_7_SET 0x80 -#define BIT_6_SET 0x40 -#define BIT_5_SET 0x20 -#define BIT_4_SET 0x10 -#define BIT_3_SET 0x8 -#define BIT_2_SET 0x4 -#define BIT_1_SET 0x2 -#define BIT_0_SET 0x1 - -////////////////////////////////////////////////////////////////////////////// -// The following defines and macros may be used to set, test, and -// update the Device Control Register (DCR). -////////////////////////////////////////////////////////////////////////////// -#define DIR_READ 1 -#define DIR_WRITE 0 - -#define IRQEN_ENABLE 1 -#define IRQEN_DISABLE 0 - -#define ACTIVE 1 -#define INACTIVE 0 -#define DONT_CARE 2 - -#define DVRH_USE_FAST_MACROS 1 -#define DVRH_USE_NIBBLE_MACROS 1 -////////////////////////////////////////////////////////////////////////////// -// The following defines may be used generically in any of the SET_xxx, -// TEST_xxx, or UPDATE_xxx macros that follow. -////////////////////////////////////////////////////////////////////////////// -#if (1 == DVRH_USE_FAST_MACROS) - #define SET_DCR(b5,b4,b3,b2,b1,b0) \ - ((UCHAR)((b5==ACTIVE? BIT_5_SET : 0) | \ - (b4==ACTIVE? BIT_4_SET : 0) | \ - (b3==ACTIVE? 0 : BIT_3_SET) | \ - (b2==ACTIVE? BIT_2_SET : 0) | \ - (b1==ACTIVE? 0 : BIT_1_SET) | \ - (b0==ACTIVE? 0 : BIT_0_SET) ) ) -#else - #define SET_DCR(b5,b4,b3,b2,b1,b0) \ - ((UCHAR)(((b5==ACTIVE?1:0)<> 8) & 0xFF) -#define DevProp_PciDevice_32BitPrefetchable_MemoryBarCount(_PropertyData) (((_PropertyData) >> 16) & 0xFF) -#define DevProp_PciDevice_64BitPrefetchable_MemoryBarCount(_PropertyData) (((_PropertyData) >> 24) & 0xFF) - -DEFINE_PCI_DEVICE_DEVPKEY(DEVPKEY_PciDevice_BarTypes, 16); - -// -// This property is a BOOLEAN indicating if AER capability is present on an -// endpoint. -// - -DEFINE_PCI_DEVICE_DEVPKEY(DEVPKEY_PciDevice_AERCapabilityPresent, 17); - -// -// This property indicates if a device is configured for a firmware first -// error handling. -// - -DEFINE_PCI_DEVICE_DEVPKEY(DEVPKEY_PciDevice_FirmwareErrorHandling, 18); - -// -// This property provides the uncorrectable error mask for an endpoint. This -// field is interpreted in accordance to its definition in the PCI Express -// Base spec. -// - -DEFINE_PCI_DEVICE_DEVPKEY(DEVPKEY_PciDevice_Uncorrectable_Error_Mask, 19); - -// -// This property provides the uncorrectable error severity for an endpoint. -// This field is interpreted in accordance to its definition in the PCI Express -// Base spec. -// - -DEFINE_PCI_DEVICE_DEVPKEY(DEVPKEY_PciDevice_Uncorrectable_Error_Severity, 20); - -// -// This property provides the correctable error mask for an endpoint. This -// field is interpreted in accordance to its definition in the PCI Express -// Base spec. -// - -DEFINE_PCI_DEVICE_DEVPKEY(DEVPKEY_PciDevice_Correctable_Error_Mask, 21); - -// -// This property indicates if a device is capable of ECRC generation and -// checking. This field is interpreted in according to the advanced error -// capabilities and control register value in the PCI Express Base spec. -// - -DEFINE_PCI_DEVICE_DEVPKEY(DEVPKEY_PciDevice_ECRC_Errors, 22); - -// -// This property indicates if an endpoint is enabled for reporting different -// types of error messages. This field is interpreted in accordance to the -// device control register value as described in the PCI Express Base spec. -// - -DEFINE_PCI_DEVICE_DEVPKEY(DEVPKEY_PciDevice_Error_Reporting, 23); - -// -// This property indicates if a root port is enabled for reporting different -// types of error messages. This field is interpreted in accordance to the -// root control register value as described in the PCI Express Base spec. -// - -DEFINE_PCI_DEVICE_DEVPKEY(DEVPKEY_PciDevice_RootError_Reporting, 24); - -// -// This property indicates if a device can wake up via PME while the system is -// in S0. Some platforms do not support runtime wakeup on some device types. -// - -DEFINE_PCI_DEVICE_DEVPKEY(DEVPKEY_PciDevice_S0WakeupSupported, 25); - -#endif - diff --git a/pub/ddk/pfhook.h b/pub/ddk/pfhook.h deleted file mode 100644 index 2e70c0f..0000000 --- a/pub/ddk/pfhook.h +++ /dev/null @@ -1,70 +0,0 @@ -/*++ - -Copyright (c) 1999 Microsoft Corporation - -Module Name: - - pfhook.h - -Abstract: - - Header file for Packet Filter driver extension hook. - ---*/ - -#ifndef _PF_EXTEND_DEFS_H_ -#define _PF_EXTEND_DEFS_H_ - -#define INVALID_PF_IF_INDEX 0xffffffff -#define ZERO_PF_IP_ADDR 0 - -// -// Enumeration constants for values that may be returned by an extension -// routine. -// - -typedef enum _PF_FORWARD_ACTION -{ - PF_FORWARD = 0, - PF_DROP = 1, - PF_PASS = 2, - PF_ICMP_ON_DROP = 3 -} PF_FORWARD_ACTION; - -// -// Definiton for a filter routine callout. -// - -typedef PF_FORWARD_ACTION (*PacketFilterExtensionPtr)( - unsigned char *PacketHeader, - unsigned char *Packet, - unsigned int PacketLength, - unsigned int RecvInterfaceIndex, - unsigned int SendInterfaceIndex, - IPAddr RecvLinkNextHop, - IPAddr SendLinkNextHop - ); - - -// -// Structure to be passed to the IOCTL_PF_SET_EXTENSION_POINTER call -// - -typedef struct _PF_SET_EXTENSION_HOOK_INFO -{ - PacketFilterExtensionPtr ExtensionPointer; -} PF_SET_EXTENSION_HOOK_INFO, *PPF_SET_EXTENSION_HOOK_INFO; - - -#define DD_IPFLTRDRVR_DEVICE_NAME L"\\Device\\IPFILTERDRIVER" - -#define FSCTL_IPFLTRDRVR_BASE FILE_DEVICE_NETWORK - -#define _IPFLTRDRVR_CTL_CODE(function, method, access) \ - CTL_CODE(FSCTL_IPFLTRDRVR_BASE, function, method, access) - -#define IOCTL_PF_SET_EXTENSION_POINTER \ - _IPFLTRDRVR_CTL_CODE(22, METHOD_BUFFERED, FILE_WRITE_ACCESS) - -#endif // _PF_EXTEND_DEFS_H_ - diff --git a/pub/ddk/poclass.h b/pub/ddk/poclass.h deleted file mode 100644 index 0573df0..0000000 --- a/pub/ddk/poclass.h +++ /dev/null @@ -1,589 +0,0 @@ -/*++ BUILD Version: 0001 // Increment this if a change has global effects - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - poclass.h - -Abstract: - - Defines power policy device driver interfaces. - - - -Revision History: - ---*/ - -// -// GUIDs are defined outside ifdef __POCLASS_ so that they can be instantiated -// easily using . -// - -// -// Custom device properties... -// - -#include - -// -// This is of type DEVPROP_TYPE_UINT32 and represents the NT processor -// number. -// - -DEFINE_DEVPROPKEY(PROCESSOR_NUMBER_PKEY, - 0x5724c81d, - 0xd5af, - 0x4c1f, - 0xa1, 0x03, 0xa0, 0x6e, 0x28, 0xf2, 0x04, 0xc6, - 1); - - -// -// Power management policy device GUIDs -// - -DEFINE_GUID( GUID_DEVICE_BATTERY, 0x72631e54L, 0x78A4, 0x11d0, 0xbc, 0xf7, 0x00, 0xaa, 0x00, 0xb7, 0xb3, 0x2a ); -DEFINE_GUID( GUID_DEVICE_APPLICATIONLAUNCH_BUTTON, 0x629758eel, 0x986e, 0x4d9e, 0x8e, 0x47, 0xde, 0x27, 0xf8, 0xab, 0x05, 0x4d ); -DEFINE_GUID( GUID_DEVICE_SYS_BUTTON, 0x4AFA3D53L, 0x74A7, 0x11d0, 0xbe, 0x5e, 0x00, 0xA0, 0xC9, 0x06, 0x28, 0x57 ); -DEFINE_GUID( GUID_DEVICE_LID, 0x4AFA3D52L, 0x74A7, 0x11d0, 0xbe, 0x5e, 0x00, 0xA0, 0xC9, 0x06, 0x28, 0x57 ); -DEFINE_GUID( GUID_DEVICE_THERMAL_ZONE, 0x4AFA3D51L, 0x74A7, 0x11d0, 0xbe, 0x5e, 0x00, 0xA0, 0xC9, 0x06, 0x28, 0x57 ); -DEFINE_GUID( GUID_DEVICE_PROCESSOR, 0x97fadb10L, 0x4e33, 0x40ae, 0x35, 0x9c, 0x8b, 0xef, 0x02, 0x9d, 0xbd, 0xd0 ); -DEFINE_GUID( GUID_DEVICE_MEMORY, 0x3fd0f03dL, 0x92e0, 0x45fb, 0xb7, 0x5c, 0x5e, 0xd8, 0xff, 0xb0, 0x10, 0x21 ); -DEFINE_GUID( GUID_DEVICE_MESSAGE_INDICATOR, 0XCD48A365L, 0xfa94, 0x4ce2, 0xa2, 0x32, 0xa1, 0xb7, 0x64, 0xe5, 0xd8, 0xb4 ); -// copied from hidclass.h -DEFINE_GUID( GUID_CLASS_INPUT, 0x4D1E55B2L, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 ); - -#ifndef _POCLASS_ -#define _POCLASS_ - -// -// Battery driver interface (devices of registrying as GUID_DEVICE_BATTERY) -// - -typedef enum { - BatteryInformation, - BatteryGranularityInformation, - BatteryTemperature, - BatteryEstimatedTime, - BatteryDeviceName, - BatteryManufactureDate, - BatteryManufactureName, - BatteryUniqueID -} BATTERY_QUERY_INFORMATION_LEVEL; - -typedef struct _BATTERY_QUERY_INFORMATION { - ULONG BatteryTag; - BATTERY_QUERY_INFORMATION_LEVEL InformationLevel; - ULONG AtRate; -} BATTERY_QUERY_INFORMATION, *PBATTERY_QUERY_INFORMATION; - -typedef struct _BATTERY_INFORMATION { - ULONG Capabilities; - UCHAR Technology; - UCHAR Reserved[3]; - UCHAR Chemistry[4]; - ULONG DesignedCapacity; - ULONG FullChargedCapacity; - ULONG DefaultAlert1; - ULONG DefaultAlert2; - ULONG CriticalBias; - ULONG CycleCount; -} BATTERY_INFORMATION, *PBATTERY_INFORMATION; - -// BATTERY_INFORMATION.*Capacity constants -#define UNKNOWN_CAPACITY 0xFFFFFFFF - -// BATTERY_INFORMATION.Capabilities flags -#define BATTERY_SYSTEM_BATTERY 0x80000000 -#define BATTERY_CAPACITY_RELATIVE 0x40000000 -#define BATTERY_IS_SHORT_TERM 0x20000000 -#define BATTERY_SET_CHARGE_SUPPORTED 0x00000001 -#define BATTERY_SET_DISCHARGE_SUPPORTED 0x00000002 -#define BATTERY_SET_RESUME_SUPPORTED 0x00000004 - -typedef enum { - BatteryCriticalBias, - BatteryCharge, - BatteryDischarge -} BATTERY_SET_INFORMATION_LEVEL; - -typedef struct _BATTERY_SET_INFORMATION { - ULONG BatteryTag; - BATTERY_SET_INFORMATION_LEVEL InformationLevel; - UCHAR Buffer[1]; -} BATTERY_SET_INFORMATION, *PBATTERY_SET_INFORMATION; - -typedef struct _BATTERY_WAIT_STATUS { - ULONG BatteryTag; - ULONG Timeout; - ULONG PowerState; - ULONG LowCapacity; - ULONG HighCapacity; -} BATTERY_WAIT_STATUS, *PBATTERY_WAIT_STATUS; - -typedef struct _BATTERY_STATUS { - ULONG PowerState; - ULONG Capacity; - ULONG Voltage; - LONG Current; -} BATTERY_STATUS, *PBATTERY_STATUS; - -// Battery Status Constants -#define UNKNOWN_RATE 0xFFFFFFFF -#define UNKNOWN_VOLTAGE 0xFFFFFFFF - - -// PowerState flags - -#define BATTERY_POWER_ON_LINE 0x00000001 -#define BATTERY_DISCHARGING 0x00000002 -#define BATTERY_CHARGING 0x00000004 -#define BATTERY_CRITICAL 0x00000008 - -// Max battery driver BATTERY_QUERY_INFORMATION_LEVEL string storage -// size in bytes. -#define MAX_BATTERY_STRING_SIZE 128 - -// Struct for accessing the packed date format in BatteryManufactureDate. -typedef struct _BATTERY_MANUFACTURE_DATE -{ - UCHAR Day; - UCHAR Month; - USHORT Year; -} BATTERY_MANUFACTURE_DATE, *PBATTERY_MANUFACTURE_DATE; - -// battery - -#define IOCTL_BATTERY_QUERY_TAG \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x10, METHOD_BUFFERED, FILE_READ_ACCESS) - -#define IOCTL_BATTERY_QUERY_INFORMATION \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x11, METHOD_BUFFERED, FILE_READ_ACCESS) - -#define IOCTL_BATTERY_SET_INFORMATION \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x12, METHOD_BUFFERED, FILE_WRITE_ACCESS) - -#define IOCTL_BATTERY_QUERY_STATUS \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x13, METHOD_BUFFERED, FILE_READ_ACCESS) - -#define BATTERY_TAG_INVALID 0 - -#ifndef _WINDOWS_ - -// -// Battery Class-Miniport interfaces -// - -__drv_functionClass(BCLASS_QUERY_TAG_CALLBACK) -__drv_sameIRQL -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -typedef -NTSTATUS -(BCLASS_QUERY_TAG_CALLBACK)( - __in PVOID Context, - __out PULONG BatteryTag - ); - -typedef BCLASS_QUERY_TAG_CALLBACK *PBCLASS_QUERY_TAG_CALLBACK; - -__drv_functionClass(BCLASS_QUERY_INFORMATION_CALLBACK) -__drv_sameIRQL -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -typedef -NTSTATUS -(BCLASS_QUERY_INFORMATION_CALLBACK)( - __in PVOID Context, - __in ULONG BatteryTag, - __in BATTERY_QUERY_INFORMATION_LEVEL Level, - __in LONG AtRate, - __out_bcount_part(BufferLength, *ReturnedLength) PVOID Buffer, - __in ULONG BufferLength, - __out PULONG ReturnedLength - ); - -typedef BCLASS_QUERY_INFORMATION_CALLBACK *PBCLASS_QUERY_INFORMATION_CALLBACK; - - -__drv_functionClass(BCLASS_QUERY_STATUS_CALLBACK) -__drv_sameIRQL -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -typedef -NTSTATUS -(BCLASS_QUERY_STATUS_CALLBACK)( - __in PVOID Context, - __in ULONG BatteryTag, - __out PBATTERY_STATUS BatteryStatus - ); - -typedef BCLASS_QUERY_STATUS_CALLBACK *PBCLASS_QUERY_STATUS_CALLBACK; - -typedef struct { - ULONG PowerState; - ULONG LowCapacity; - ULONG HighCapacity; -} BATTERY_NOTIFY, *PBATTERY_NOTIFY; - -__drv_functionClass(BCLASS_SET_STATUS_NOTIFY_CALLBACK) -__drv_sameIRQL -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -typedef -NTSTATUS -(BCLASS_SET_STATUS_NOTIFY_CALLBACK)( - __in PVOID Context, - __in ULONG BatteryTag, - __in PBATTERY_NOTIFY BatteryNotify - ); - -typedef BCLASS_SET_STATUS_NOTIFY_CALLBACK *PBCLASS_SET_STATUS_NOTIFY_CALLBACK; - -__drv_functionClass(BCLASS_SET_INFORMATION_CALLBACK) -__drv_sameIRQL -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -typedef -NTSTATUS -(BCLASS_SET_INFORMATION_CALLBACK)( - __in PVOID Context, - __in ULONG BatteryTag, - __in BATTERY_SET_INFORMATION_LEVEL Level, - __in_opt PVOID Buffer - ); - -typedef BCLASS_SET_INFORMATION_CALLBACK *PBCLASS_SET_INFORMATION_CALLBACK; - - -__drv_functionClass(BCLASS_DISABLE_STATUS_NOTIFY_CALLBACK) -__drv_sameIRQL -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -typedef -NTSTATUS -(BCLASS_DISABLE_STATUS_NOTIFY_CALLBACK)( - __in PVOID Context - ); - -typedef BCLASS_DISABLE_STATUS_NOTIFY_CALLBACK - *PBCLASS_DISABLE_STATUS_NOTIFY_CALLBACK; - -typedef PBCLASS_QUERY_TAG_CALLBACK BCLASS_QUERY_TAG; -typedef PBCLASS_QUERY_INFORMATION_CALLBACK BCLASS_QUERY_INFORMATION; -typedef PBCLASS_QUERY_STATUS_CALLBACK BCLASS_QUERY_STATUS; -typedef PBCLASS_SET_STATUS_NOTIFY_CALLBACK BCLASS_SET_STATUS_NOTIFY; -typedef PBCLASS_SET_INFORMATION_CALLBACK BCLASS_SET_INFORMATION; -typedef PBCLASS_DISABLE_STATUS_NOTIFY_CALLBACK BCLASS_DISABLE_STATUS_NOTIFY; - -typedef struct { - USHORT MajorVersion; - USHORT MinorVersion; - - PVOID Context; // Miniport context - - BCLASS_QUERY_TAG QueryTag; - BCLASS_QUERY_INFORMATION QueryInformation; - BCLASS_SET_INFORMATION SetInformation; - BCLASS_QUERY_STATUS QueryStatus; - BCLASS_SET_STATUS_NOTIFY SetStatusNotify; - BCLASS_DISABLE_STATUS_NOTIFY DisableStatusNotify; - PDEVICE_OBJECT Pdo; - PUNICODE_STRING DeviceName; -} BATTERY_MINIPORT_INFO, *PBATTERY_MINIPORT_INFO; - - - -#define BATTERY_CLASS_MAJOR_VERSION 0x0001 -#define BATTERY_CLASS_MINOR_VERSION 0x0000 - - -// -// Battery class driver functions -// - -#if !defined(BATTERYCLASS) - #define BATTERYCLASSAPI DECLSPEC_IMPORT -#else - #define BATTERYCLASSAPI -#endif - - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSTATUS -BATTERYCLASSAPI -BatteryClassInitializeDevice ( - __in PBATTERY_MINIPORT_INFO MiniportInfo, - __out PVOID *ClassData - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -BATTERYCLASSAPI -BatteryClassUnload ( - __in PVOID ClassData - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSTATUS -BATTERYCLASSAPI -BatteryClassIoctl ( - __in PVOID ClassData, - __inout PIRP Irp - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -BATTERYCLASSAPI -BatteryClassStatusNotify ( - __in PVOID ClassData - ); - -#endif // _WINDOWS_ - -// -// Thermal Zone driver interface (devices of registrying as GUID_DEVICE_THERMAL_ZONE) -// - -#define MAX_ACTIVE_COOLING_LEVELS 10 - -// -// This structure has been depricated and the THERMAL_INFORMATION_EX -// structure should be used. THERMAL_INFORMATION has been left here for -// backward compatibility with the thermal WMI interface. -// -typedef struct _THERMAL_INFORMATION { - ULONG ThermalStamp; - ULONG ThermalConstant1; - ULONG ThermalConstant2; - KAFFINITY Processors; - ULONG SamplingPeriod; - ULONG CurrentTemperature; - ULONG PassiveTripPoint; - ULONG CriticalTripPoint; - UCHAR ActiveTripPointCount; - ULONG ActiveTripPoint[MAX_ACTIVE_COOLING_LEVELS]; -} THERMAL_INFORMATION, *PTHERMAL_INFORMATION; - -#define ACTIVE_COOLING 0x0 -#define PASSIVE_COOLING 0x1 - -// thermal - -#define IOCTL_THERMAL_QUERY_INFORMATION \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x20, METHOD_BUFFERED, FILE_READ_ACCESS) - -#define IOCTL_THERMAL_SET_COOLING_POLICY\ - CTL_CODE(FILE_DEVICE_BATTERY, 0x21, METHOD_BUFFERED, FILE_WRITE_ACCESS) - -#define IOCTL_RUN_ACTIVE_COOLING_METHOD\ - CTL_CODE(FILE_DEVICE_BATTERY, 0x22, METHOD_BUFFERED, FILE_WRITE_ACCESS) - - -// -// Lid class driver functions -// - -#define IOCTL_QUERY_LID\ - CTL_CODE(FILE_DEVICE_BATTERY, 0x30, METHOD_BUFFERED, FILE_READ_ACCESS) - -// -// Switch class driver functions -// - -#define IOCTL_NOTIFY_SWITCH_EVENT\ - CTL_CODE(FILE_DEVICE_BATTERY, 0x40, METHOD_BUFFERED, FILE_READ_ACCESS) - -// -// System button class driver functions -// - -#define IOCTL_GET_SYS_BUTTON_CAPS \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x50, METHOD_BUFFERED, FILE_READ_ACCESS) - -#define IOCTL_GET_SYS_BUTTON_EVENT \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x51, METHOD_BUFFERED, FILE_READ_ACCESS) - -#define SYS_BUTTON_POWER 0x00000001 -#define SYS_BUTTON_SLEEP 0x00000002 -#define SYS_BUTTON_LID 0x00000004 -#define SYS_BUTTON_WAKE 0x80000000 - -// -// Lid-specific state embedded in the button event irp. -// - -#define SYS_BUTTON_LID_STATE_MASK 0x00030000 -#define SYS_BUTTON_LID_OPEN 0x00010000 -#define SYS_BUTTON_LID_CLOSED 0x00020000 -#define SYS_BUTTON_LID_INITIAL 0x00040000 -#define SYS_BUTTON_LID_CHANGED 0x00080000 - -// -// Processor object class driver functions -// - -typedef struct { - ULONG PhysicalID; - ULONG PBlkAddress; - UCHAR PBlkLength; -} PROCESSOR_OBJECT_INFO, *PPROCESSOR_OBJECT_INFO; - -typedef struct { - ULONG PhysicalID; - ULONG PBlkAddress; - UCHAR PBlkLength; - ULONG InitialApicId; -} PROCESSOR_OBJECT_INFO_EX, *PPROCESSOR_OBJECT_INFO_EX; - - - -#define IOCTL_GET_PROCESSOR_OBJ_INFO \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x60, METHOD_BUFFERED, FILE_READ_ACCESS) - - -#ifndef _WINDOWS_ - -// -// PCC processor power management interface -// - -#pragma warning(push) -#pragma warning(disable:4201) // anonymous unions warning -#pragma warning(disable:4214) // bit field other than int -#pragma pack(push,1) - -typedef struct _PCC_HEADER { - ULONG Signature; - USHORT HeaderLength; - UCHAR MajorVersion; - UCHAR MinorVersion; - union { - struct { - ULONG SciDoorbell:1; // 0 - ULONG Reserved:31; // 31:1 - }; - - ULONG AsULong; - } SupportedFeatures; - - union { - struct { - USHORT CommandCode:8; // 7:0 - USHORT ReservedZ:7; // 14:8 - USHORT SciDoorbell:1; // 15 - }; - - USHORT AsUShort; - } Command; - - union { - struct { - USHORT CommandComplete:1; // 0 - USHORT SciReceived:1; // 1 - USHORT Error:1; // 2 - USHORT Reserved:13; // 15:3 - }; - - USHORT AsUShort; - } Status; - - ULONG Latency; - ULONG MinimumCommandInterval; - ULONG MaximumCommandInterval; - ULONG NominalFrequency; - ULONG MinimumFrequency; - ULONG MinimumUnthrottledFrequency; -} PCC_HEADER, *PPCC_HEADER; - -typedef struct _PCC_INPUT_BUFFER { - UCHAR ControlEnabled; - union { - struct { - UCHAR ReservedZ[3]; - } GetAverageFrequency; - - struct { - UCHAR DesiredFrequency; - UCHAR ReservedZ[2]; - } SetDesiredFrequency; - - }; -} PCC_INPUT_BUFFER, *PPCC_INPUT_BUFFER; - -typedef union _PCC_OUTPUT_BUFFER { - struct { - UCHAR AverageFrequency; - UCHAR FrequencyLimit; - UCHAR Reserved[2]; - } GetAverageFrequency; - - struct { - UCHAR Reserved[4]; - } SetDesiredFrequency; - -} PCC_OUTPUT_BUFFER, *PPCC_OUTPUT_BUFFER; - -#pragma pack(pop) -#pragma warning(pop) - -__drv_functionClass(PROCESSOR_PCC_DOORBELL_CALLBACK) -__drv_sameIRQL -typedef -VOID -(PROCESSOR_PCC_DOORBELL_CALLBACK)( - __in ULONG Status, - __in ULONG_PTR Context - ); - -typedef PROCESSOR_PCC_DOORBELL_CALLBACK *PPROCESSOR_PCC_DOORBELL_CALLBACK; - -#define PROCESSOR_PCC_COMMAND_GET_AVERAGE_FREQUENCY 0x00 -#define PROCESSOR_PCC_COMMAND_SET_DESIRED_FREQUENCY 0x01 - -__drv_functionClass(PROCESSOR_PCC_RING_DOORBELL) -__drv_sameIRQL -typedef -NTSTATUS -(PROCESSOR_PCC_RING_DOORBELL)( - __in UCHAR Command, - __in PPROCESSOR_PCC_DOORBELL_CALLBACK Callback, - __in ULONG_PTR Context - ); - -typedef PROCESSOR_PCC_RING_DOORBELL *PPROCESSOR_PCC_RING_DOORBELL; - -typedef struct _PROCESSOR_PCC_INTERFACE_STANDARD { - // - // Generic interface header - // - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - // - // PCC interfaces - // - PPROCESSOR_PCC_RING_DOORBELL PccRingDoorbell; - PPCC_HEADER PccHeader; - ULONG PccHeaderLength; - -} PROCESSOR_PCC_INTERFACE_STANDARD, *PPROCESSOR_PCC_INTERFACE_STANDARD; - -#define PROCESSOR_PCC_INTERFACE_STANDARD_VERSION 1 - -#endif // _WINDOWS_ - -// -// Message indicator class driver functions -// -#define IOCTL_SET_SYS_MESSAGE_INDICATOR \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x70, METHOD_BUFFERED, FILE_WRITE_ACCESS) - -#endif // _POCLASS_ - diff --git a/pub/ddk/portabledevice.h b/pub/ddk/portabledevice.h deleted file mode 100644 index 06b2c59..0000000 --- a/pub/ddk/portabledevice.h +++ /dev/null @@ -1,4438 +0,0 @@ -/**************************************************************************** -* Copyright (c) Microsoft Corporation. All rights reserved. -****************************************************************************/ -#pragma once -// Windows XP SP2, Windows Vista, or later (excluding Windows Server 2003) -#if ((NTDDI_VERSION >= NTDDI_WINXPSP2 && NTDDI_VERSION < NTDDI_WS03) || (NTDDI_VERSION >= NTDDI_WINLH)) -#include "propkeydef.h" - -/**************************************************************************** -* This section declares WPD guids used in PnP -****************************************************************************/ -// -// GUID_DEVINTERFACE_WPD -// This GUID is used to identify devices / drivers that support the WPD DDI. -// The WPD Class Extension component enables this device interface for WPD Drivers that use it. Clients use this PnP interface when registering for PnP device arrival messages for WPD devices. -DEFINE_GUID(GUID_DEVINTERFACE_WPD, 0x6AC27878, 0xA6FA, 0x4155, 0xBA, 0x85, 0xF9, 0x8F, 0x49, 0x1D, 0x4F, 0x33 ); -// -// GUID_DEVINTERFACE_WPD_PRIVATE -// This GUID is used to identify devices / drivers that can be used only by a specialized WPD client and will not show up in normal WPD enumeration. -// Devices identified with this interface cannot be used with normal WPD applications. Generic WPD drivers and clients should not use this interface. -DEFINE_GUID(GUID_DEVINTERFACE_WPD_PRIVATE, 0xBA0C718F, 0x4DED, 0x49B7, 0xBD, 0xD3, 0xFA, 0xBE, 0x28, 0x66, 0x12, 0x11 ); -// -// GUID_DEVINTERFACE_WPD_SERVICE -// This GUID is used to identify services that support the WPD Services DDI. -// The WPD Class Extension component enables this device interface for WPD Services that use it. Clients use this PnP interface when registering for PnP device arrival messages for ALL WPD services. To register for specific categories of services, client should use the service category or service implements GUID. -DEFINE_GUID(GUID_DEVINTERFACE_WPD_SERVICE, 0x9EF44F80, 0x3D64, 0x4246, 0xA6, 0xAA, 0x20, 0x6F, 0x32, 0x8D, 0x1E, 0xDC ); - -/**************************************************************************** -* This section declares WPD defines -****************************************************************************/ -// WPD specific function number used to construct WPD I/O control codes. Drivers should not use this define directly. -// -#define WPD_CONTROL_FUNCTION_GENERIC_MESSAGE 0x42 - -// Defines WPD specific IOCTL number used by drivers to detect WPD requests that may require READ and WRITE access to the device. -// -#define IOCTL_WPD_MESSAGE_READWRITE_ACCESS CTL_CODE(FILE_DEVICE_WPD, WPD_CONTROL_FUNCTION_GENERIC_MESSAGE, METHOD_BUFFERED, (FILE_READ_ACCESS | FILE_WRITE_ACCESS)) - -// Defines WPD specific IOCTL number used by drivers to detect WPD requests that require READ-only access to the device. -// -#define IOCTL_WPD_MESSAGE_READ_ACCESS CTL_CODE(FILE_DEVICE_WPD, WPD_CONTROL_FUNCTION_GENERIC_MESSAGE, METHOD_BUFFERED, FILE_READ_ACCESS) - -// Drivers can use this macro to detect whether the incoming IOCTL is a WPD message or not. -// -#define IS_WPD_IOCTL(ControlCode) ((ControlCode == IOCTL_WPD_MESSAGE_READWRITE_ACCESS) || (ControlCode == IOCTL_WPD_MESSAGE_READ_ACCESS)) - -// Pre-defined ObjectID for the DEVICE object. -// -#define WPD_DEVICE_OBJECT_ID L"DEVICE" - -// Pre-defined IWMDMDevice for the IWMDRMDeviceApp license/metering APIs. -// -#define WMDRMDEVICEAPP_USE_WPD_DEVICE_PTR ((ULONG_PTR)-1) - -// Pre-defined name of a REG_DWORD value that defines the device type, used for representation purposes only. Functional characteristics of the device are decided through functional objects. -// This value can be retrieved using IPortableDeviceManager::GetDeviceProperty(...). See WPD_DEVICE_TYPES enumeration for possible values. -#define PORTABLE_DEVICE_TYPE L"PortableDeviceType" - -// Pre-defined name of a REG_SZ/REG_EXPAND_SZ/REG_MULTI_SZ value that indicates the location of the device icon file or device icon resource. -// This value can be retrieved using IPortableDeviceManager::GetDeviceProperty(...). This REG_SZ/REG_EXPAND_SZ/REG_MULTI_SZ value is either in the form "file.dll, resourceID" or a full file path to an icon file. e.g.: "x:\file.ico" -#define PORTABLE_DEVICE_ICON L"Icons" - -// Pre-defined name of a REG_DWORD value that indicates the amount of time in milliseconds the WPD Namespace Extension will keep its reference to the device open under idle conditions. -// This value can be retrieved using IPortableDeviceManager::GetDeviceProperty(...). -#define PORTABLE_DEVICE_NAMESPACE_TIMEOUT L"PortableDeviceNameSpaceTimeout" - -// Pre-defined name of a REG_DWORD value that is used as a flag to indicate whether the device should, or should not, be shown in the Explorer view. -// This value can be retrieved using IPortableDeviceManager::GetDeviceProperty(...). Meaning of values are: 0 = include, 1 = exclude. 0 is assumed if this value doesn't exist. -#define PORTABLE_DEVICE_NAMESPACE_EXCLUDE_FROM_SHELL L"PortableDeviceNameSpaceExcludeFromShell" - -// Pre-defined name of a REG_SZ or REG_MULTI_SZ value containing content type guids that are used indicate for what content types the portable device namespace should attempt to automatically generate a thumbnail when placing new content on the device. -// This value can be retrieved using IPortableDeviceManager::GetDeviceProperty(...). Values should be a string representation of a GUID, in the form '{00000000-0000-0000-0000-000000000000}'. By default the portable device namespace attempts to automatically generate thumbnails for WPD_CONTENT_TYPE_IMAGE, if a device does not want this behavior it can set this value to an empty string. -#define PORTABLE_DEVICE_NAMESPACE_THUMBNAIL_CONTENT_TYPES L"PortableDeviceNameSpaceThumbnailContentTypes" - -// Pre-defined name of a REG_DWORD value that indicates whether a Portable Device is a Mass Storage Class (MSC) device. This is used to avoid duplication of the device in certain views and scenarios that include both file system and Portable Devices. -// This value can be retrieved using IPortableDeviceManager::GetDeviceProperty(...). Meaning of values are: 0 = device is not mass storage, 1 = device is mass storage. 0 is assumed if this value doesn't exist. -#define PORTABLE_DEVICE_IS_MASS_STORAGE L"PortableDeviceIsMassStorage" - -// Pre-defined value identifying the "Windows Media Digital Rights Management 10 for Portable Devices" scheme for protecting content. -// This value can be used by drivers to indicate they support WMDRM10-PD. See WPD_DEVICE_SUPPORTED_DRM_SCHEMES. -#define PORTABLE_DEVICE_DRM_SCHEME_WMDRM10_PD L"WMDRM10-PD" - -// Pre-defined value identifying the "Portable Device Digital Rights Management" scheme for protecting content. -// This value can be used by drivers to indicate they support PDDRM. See WPD_DEVICE_SUPPORTED_DRM_SCHEMES. -#define PORTABLE_DEVICE_DRM_SCHEME_PDDRM L"PDDRM" - - -/**************************************************************************** -* This section defines flags used in API arguments -****************************************************************************/ - -// Indicates whether the delete request should recursively delete any children. -typedef enum tagDELETE_OBJECT_OPTIONS -{ - PORTABLE_DEVICE_DELETE_NO_RECURSION = 0, - PORTABLE_DEVICE_DELETE_WITH_RECURSION = 1 -} DELETE_OBJECT_OPTIONS; - -// Possible values for PORTABLE_DEVICE_TYPE registry value. -typedef enum tagWPD_DEVICE_TYPES -{ - WPD_DEVICE_TYPE_GENERIC = 0, - WPD_DEVICE_TYPE_CAMERA = 1, - WPD_DEVICE_TYPE_MEDIA_PLAYER = 2, - WPD_DEVICE_TYPE_PHONE = 3, - WPD_DEVICE_TYPE_VIDEO = 4, - WPD_DEVICE_TYPE_PERSONAL_INFORMATION_MANAGER = 5, - WPD_DEVICE_TYPE_AUDIO_RECORDER = 6 -} WPD_DEVICE_TYPES; - -// Possible values for WPD_PROPERTY_ATTRIBUTE_FORM -typedef enum tagWpdAttributeForm -{ - WPD_PROPERTY_ATTRIBUTE_FORM_UNSPECIFIED = 0, - WPD_PROPERTY_ATTRIBUTE_FORM_RANGE = 1, - WPD_PROPERTY_ATTRIBUTE_FORM_ENUMERATION = 2, - WPD_PROPERTY_ATTRIBUTE_FORM_REGULAR_EXPRESSION = 3, - WPD_PROPERTY_ATTRIBUTE_FORM_OBJECT_IDENTIFIER = 4 -} WpdAttributeForm; - -// Possible values for WPD_PARAMETER_ATTRIBUTE_FORM -typedef enum tagWpdParameterAttributeForm -{ - WPD_PARAMETER_ATTRIBUTE_FORM_UNSPECIFIED = 0, - WPD_PARAMETER_ATTRIBUTE_FORM_RANGE = 1, - WPD_PARAMETER_ATTRIBUTE_FORM_ENUMERATION = 2, - WPD_PARAMETER_ATTRIBUTE_FORM_REGULAR_EXPRESSION = 3, - WPD_PARAMETER_ATTRIBUTE_FORM_OBJECT_IDENTIFIER = 4 -} WpdParameterAttributeForm; - -// Possible values for WPD_DEVICE_TRANSPORT property. -typedef enum tagWPD_DEVICE_TRANSPORTS -{ - WPD_DEVICE_TRANSPORT_UNSPECIFIED = 0, - WPD_DEVICE_TRANSPORT_USB = 1, - WPD_DEVICE_TRANSPORT_IP = 2, - WPD_DEVICE_TRANSPORT_BLUETOOTH = 3 -} WPD_DEVICE_TRANSPORTS; - -// Indicates the type of storage. -typedef enum tagWPD_STORAGE_TYPE_VALUES -{ - WPD_STORAGE_TYPE_UNDEFINED = 0, - WPD_STORAGE_TYPE_FIXED_ROM = 1, - WPD_STORAGE_TYPE_REMOVABLE_ROM = 2, - WPD_STORAGE_TYPE_FIXED_RAM = 3, - WPD_STORAGE_TYPE_REMOVABLE_RAM = 4 -} WPD_STORAGE_TYPE_VALUES; - -// Indicates write-protection that globally affects the storage. -typedef enum tagWPD_STORAGE_ACCESS_CAPABILITY_VALUES -{ - WPD_STORAGE_ACCESS_CAPABILITY_READWRITE = 0, - WPD_STORAGE_ACCESS_CAPABILITY_READ_ONLY_WITHOUT_OBJECT_DELETION = 1, - WPD_STORAGE_ACCESS_CAPABILITY_READ_ONLY_WITH_OBJECT_DELETION = 2 -} WPD_STORAGE_ACCESS_CAPABILITY_VALUES; - -// Possible values for WPD_SMS_ENCODING -typedef enum tagWPD_SMS_ENCODING_TYPES -{ - SMS_ENCODING_7_BIT = 0, - SMS_ENCODING_8_BIT = 1, - SMS_ENCODING_UTF_16 = 2 -} WPD_SMS_ENCODING_TYPES; - -// Possible values for WPD_PROPERTY_SMS_MESSAGE_TYPE -typedef enum tagSMS_MESSAGE_TYPES -{ - SMS_TEXT_MESSAGE = 0, - SMS_BINARY_MESSAGE = 1 -} SMS_MESSAGE_TYPES; - -// Indicates whether the device is on battery power or external power. -typedef enum tagWPD_POWER_SOURCES -{ - WPD_POWER_SOURCE_BATTERY = 0, - WPD_POWER_SOURCE_EXTERNAL = 1 -} WPD_POWER_SOURCES; - -// Indicates the way the device weighs color channels. -typedef enum tagWPD_WHITE_BALANCE_SETTINGS -{ - WPD_WHITE_BALANCE_UNDEFINED = 0, - WPD_WHITE_BALANCE_MANUAL = 1, - WPD_WHITE_BALANCE_AUTOMATIC = 2, - WPD_WHITE_BALANCE_ONE_PUSH_AUTOMATIC = 3, - WPD_WHITE_BALANCE_DAYLIGHT = 4, - WPD_WHITE_BALANCE_FLORESCENT = 5, - WPD_WHITE_BALANCE_TUNGSTEN = 6, - WPD_WHITE_BALANCE_FLASH = 7 -} WPD_WHITE_BALANCE_SETTINGS; - -// Indicates the focus mode of the device. -typedef enum tagWPD_FOCUS_MODES -{ - WPD_FOCUS_UNDEFINED = 0, - WPD_FOCUS_MANUAL = 1, - WPD_FOCUS_AUTOMATIC = 2, - WPD_FOCUS_AUTOMATIC_MACRO = 3 -} WPD_FOCUS_MODES; - -// Indicates the metering mode of the device. -typedef enum tagWPD_EXPOSURE_METERING_MODES -{ - WPD_EXPOSURE_METERING_MODE_UNDEFINED = 0, - WPD_EXPOSURE_METERING_MODE_AVERAGE = 1, - WPD_EXPOSURE_METERING_MODE_CENTER_WEIGHTED_AVERAGE = 2, - WPD_EXPOSURE_METERING_MODE_MULTI_SPOT = 3, - WPD_EXPOSURE_METERING_MODE_CENTER_SPOT = 4 -} WPD_EXPOSURE_METERING_MODES; - -// Indicates the flash mode of the device. -typedef enum tagWPD_FLASH_MODES -{ - WPD_FLASH_MODE_UNDEFINED = 0, - WPD_FLASH_MODE_AUTO = 1, - WPD_FLASH_MODE_OFF = 2, - WPD_FLASH_MODE_FILL = 3, - WPD_FLASH_MODE_RED_EYE_AUTO = 4, - WPD_FLASH_MODE_RED_EYE_FILL = 5, - WPD_FLASH_MODE_EXTERNAL_SYNC = 6 -} WPD_FLASH_MODES; - -// Indicates the exposure program mode of the device. -typedef enum tagWPD_EXPOSURE_PROGRAM_MODES -{ - WPD_EXPOSURE_PROGRAM_MODE_UNDEFINED = 0, - WPD_EXPOSURE_PROGRAM_MODE_MANUAL = 1, - WPD_EXPOSURE_PROGRAM_MODE_AUTO = 2, - WPD_EXPOSURE_PROGRAM_MODE_APERTURE_PRIORITY = 3, - WPD_EXPOSURE_PROGRAM_MODE_SHUTTER_PRIORITY = 4, - WPD_EXPOSURE_PROGRAM_MODE_CREATIVE = 5, - WPD_EXPOSURE_PROGRAM_MODE_ACTION = 6, - WPD_EXPOSURE_PROGRAM_MODE_PORTRAIT = 7 -} WPD_EXPOSURE_PROGRAM_MODES; - -// Indicates the capture mode of the device. -typedef enum tagWPD_CAPTURE_MODES -{ - WPD_CAPTURE_MODE_UNDEFINED = 0, - WPD_CAPTURE_MODE_NORMAL = 1, - WPD_CAPTURE_MODE_BURST = 2, - WPD_CAPTURE_MODE_TIMELAPSE = 3 -} WPD_CAPTURE_MODES; - -// Indicates the effect mode of the capture device. -typedef enum tagWPD_EFFECT_MODES -{ - WPD_EFFECT_MODE_UNDEFINED = 0, - WPD_EFFECT_MODE_COLOR = 1, - WPD_EFFECT_MODE_BLACK_AND_WHITE = 2, - WPD_EFFECT_MODE_SEPIA = 3 -} WPD_EFFECT_MODES; - -// Indicates the metering mode of the capture device. -typedef enum tagWPD_FOCUS_METERING_MODES -{ - WPD_FOCUS_METERING_MODE_UNDEFINED = 0, - WPD_FOCUS_METERING_MODE_CENTER_SPOT = 1, - WPD_FOCUS_METERING_MODE_MULTI_SPOT = 2 -} WPD_FOCUS_METERING_MODES; - -// Indicates the type of bitrate for the audio/video data. -typedef enum tagWPD_BITRATE_TYPES -{ - WPD_BITRATE_TYPE_UNUSED = 0, - WPD_BITRATE_TYPE_DISCRETE = 1, - WPD_BITRATE_TYPE_VARIABLE = 2, - WPD_BITRATE_TYPE_FREE = 3 -} WPD_BITRATE_TYPES; - -// Qualifies the object data in a contextual way. -typedef enum tagWPD_META_GENRES -{ - WPD_META_GENRE_UNUSED = 0x0, - WPD_META_GENRE_GENERIC_MUSIC_AUDIO_FILE = 0x1, - WPD_META_GENRE_GENERIC_NON_MUSIC_AUDIO_FILE = 0x11, - WPD_META_GENRE_SPOKEN_WORD_AUDIO_BOOK_FILES = 0x12, - WPD_META_GENRE_SPOKEN_WORD_FILES_NON_AUDIO_BOOK = 0x13, - WPD_META_GENRE_SPOKEN_WORD_NEWS = 0x14, - WPD_META_GENRE_SPOKEN_WORD_TALK_SHOWS = 0x15, - WPD_META_GENRE_GENERIC_VIDEO_FILE = 0x21, - WPD_META_GENRE_NEWS_VIDEO_FILE = 0x22, - WPD_META_GENRE_MUSIC_VIDEO_FILE = 0x23, - WPD_META_GENRE_HOME_VIDEO_FILE = 0x24, - WPD_META_GENRE_FEATURE_FILM_VIDEO_FILE = 0x25, - WPD_META_GENRE_TELEVISION_VIDEO_FILE = 0x26, - WPD_META_GENRE_TRAINING_EDUCATIONAL_VIDEO_FILE = 0x27, - WPD_META_GENRE_PHOTO_MONTAGE_VIDEO_FILE = 0x28, - WPD_META_GENRE_GENERIC_NON_AUDIO_NON_VIDEO = 0x30, - WPD_META_GENRE_AUDIO_PODCAST = 0x40, - WPD_META_GENRE_VIDEO_PODCAST = 0x41, - WPD_META_GENRE_MIXED_PODCAST = 0x42 -} WPD_META_GENRES; - -// Indicates the cropped status of an image. -typedef enum tagWPD_CROPPED_STATUS_VALUES -{ - WPD_CROPPED_STATUS_NOT_CROPPED = 0, - WPD_CROPPED_STATUS_CROPPED = 1, - WPD_CROPPED_STATUS_SHOULD_NOT_BE_CROPPED = 2 -} WPD_CROPPED_STATUS_VALUES; - -// Indicates the color corrected status of an image. -typedef enum tagWPD_COLOR_CORRECTED_STATUS_VALUES -{ - WPD_COLOR_CORRECTED_STATUS_NOT_CORRECTED = 0, - WPD_COLOR_CORRECTED_STATUS_CORRECTED = 1, - WPD_COLOR_CORRECTED_STATUS_SHOULD_NOT_BE_CORRECTED = 2 -} WPD_COLOR_CORRECTED_STATUS_VALUES; - -// Identifies the video scan-type information. -typedef enum tagWPD_VIDEO_SCAN_TYPES -{ - WPD_VIDEO_SCAN_TYPE_UNUSED = 0, - WPD_VIDEO_SCAN_TYPE_PROGRESSIVE = 1, - WPD_VIDEO_SCAN_TYPE_FIELD_INTERLEAVED_UPPER_FIRST = 2, - WPD_VIDEO_SCAN_TYPE_FIELD_INTERLEAVED_LOWER_FIRST = 3, - WPD_VIDEO_SCAN_TYPE_FIELD_SINGLE_UPPER_FIRST = 4, - WPD_VIDEO_SCAN_TYPE_FIELD_SINGLE_LOWER_FIRST = 5, - WPD_VIDEO_SCAN_TYPE_MIXED_INTERLACE = 6, - WPD_VIDEO_SCAN_TYPE_MIXED_INTERLACE_AND_PROGRESSIVE = 7 -} WPD_VIDEO_SCAN_TYPES; - -// Indicates the current state of the operation in progress. -typedef enum tagWPD_OPERATION_STATES -{ - WPD_OPERATION_STATE_UNSPECIFIED = 0, - WPD_OPERATION_STATE_STARTED = 1, - WPD_OPERATION_STATE_RUNNING = 2, - WPD_OPERATION_STATE_PAUSED = 3, - WPD_OPERATION_STATE_CANCELLED = 4, - WPD_OPERATION_STATE_FINISHED = 5, - WPD_OPERATION_STATE_ABORTED = 6 -} WPD_OPERATION_STATES; - -// Indicates the units for a referenced section of data. -typedef enum tagWPD_SECTION_DATA_UNITS_VALUES -{ - WPD_SECTION_DATA_UNITS_BYTES = 0, - WPD_SECTION_DATA_UNITS_MILLISECONDS = 1 -} WPD_SECTION_DATA_UNITS_VALUES; - -// Indicates whether the rendering information profile entry corresponds to an Object or a Resource. -typedef enum tagWPD_RENDERING_INFORMATION_PROFILE_ENTRY_TYPES -{ - WPD_RENDERING_INFORMATION_PROFILE_ENTRY_TYPE_OBJECT = 0, - WPD_RENDERING_INFORMATION_PROFILE_ENTRY_TYPE_RESOURCE = 1 -} WPD_RENDERING_INFORMATION_PROFILE_ENTRY_TYPES; - -// Indicates the type of access the command requires. This is only used internally by the command access lookup table. There is no need to use these values directly. -typedef enum tagWPD_COMMAND_ACCESS_TYPES -{ - WPD_COMMAND_ACCESS_READ = 1, - WPD_COMMAND_ACCESS_READWRITE = 3, - WPD_COMMAND_ACCESS_FROM_PROPERTY_WITH_STGM_ACCESS = 4, - WPD_COMMAND_ACCESS_FROM_PROPERTY_WITH_FILE_ACCESS = 8, - WPD_COMMAND_ACCESS_FROM_ATTRIBUTE_WITH_METHOD_ACCESS = 16 -} WPD_COMMAND_ACCESS_TYPES; - -// Indicates the inheritance relationship to query for this service. -typedef enum tagWPD_SERVICE_INHERITANCE_TYPES -{ - WPD_SERVICE_INHERITANCE_IMPLEMENTATION = 0 -} WPD_SERVICE_INHERITANCE_TYPES; - -// Indicates the usage of a parameter. -typedef enum tagWPD_PARAMETER_USAGE_TYPES -{ - WPD_PARAMETER_USAGE_RETURN = 0, - WPD_PARAMETER_USAGE_IN = 1, - WPD_PARAMETER_USAGE_OUT = 2, - WPD_PARAMETER_USAGE_INOUT = 3 -} WPD_PARAMETER_USAGE_TYPES; - -/**************************************************************************** -* This section declares WPD specific Errors -****************************************************************************/ -#define FACILITY_WPD 42 - -#define E_WPD_DEVICE_ALREADY_OPENED MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 1 ) /* 0x802A0001 */ -#define E_WPD_DEVICE_NOT_OPEN MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 2 ) /* 0x802A0002 */ -#define E_WPD_OBJECT_ALREADY_ATTACHED_TO_DEVICE MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 3 ) /* 0x802A0003 */ -#define E_WPD_OBJECT_NOT_ATTACHED_TO_DEVICE MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 4 ) /* 0x802A0004 */ -#define E_WPD_OBJECT_NOT_COMMITED MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 5 ) /* 0x802A0005 */ -#define E_WPD_DEVICE_IS_HUNG MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 6 ) /* 0x802A0006 */ -#define E_WPD_SMS_INVALID_RECIPIENT MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 100 ) /* 0x802A0064 */ -#define E_WPD_SMS_INVALID_MESSAGE_BODY MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 101 ) /* 0x802A0065 */ -#define E_WPD_SMS_SERVICE_UNAVAILABLE MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 102 ) /* 0x802A0066 */ -#define E_WPD_SERVICE_ALREADY_OPENED MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 200 ) /* 0x802A00C8 */ -#define E_WPD_SERVICE_NOT_OPEN MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 201 ) /* 0x802A00C9 */ -#define E_WPD_OBJECT_ALREADY_ATTACHED_TO_SERVICE MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 202 ) /* 0x802A00CA */ -#define E_WPD_OBJECT_NOT_ATTACHED_TO_SERVICE MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 203 ) /* 0x802A00CB */ -#define E_WPD_SERVICE_BAD_PARAMETER_ORDER MAKE_HRESULT( SEVERITY_ERROR , FACILITY_WPD, 204 ) /* 0x802A00CC */ - -/**************************************************************************** -* This section defines all WPD Events -****************************************************************************/ -// -// WPD_EVENT_NOTIFICATION -// This GUID is used to identify all WPD driver events to the event sub-system. The driver uses this as the GUID identifier when it queues an event with IWdfDevice::PostEvent(). Applications never use this value. -DEFINE_GUID(WPD_EVENT_NOTIFICATION, 0x2BA2E40A, 0x6B4C, 0x4295, 0xBB, 0x43, 0x26, 0x32, 0x2B, 0x99, 0xAE, 0xB2 ); -// -// WPD_EVENT_OBJECT_ADDED -// This event is sent after a new object is available on the device. -DEFINE_GUID(WPD_EVENT_OBJECT_ADDED, 0xA726DA95, 0xE207, 0x4B02, 0x8D, 0x44, 0xBE, 0xF2, 0xE8, 0x6C, 0xBF, 0xFC ); -// -// WPD_EVENT_OBJECT_REMOVED -// This event is sent after a previously existing object has been removed from the device. -DEFINE_GUID(WPD_EVENT_OBJECT_REMOVED, 0xBE82AB88, 0xA52C, 0x4823, 0x96, 0xE5, 0xD0, 0x27, 0x26, 0x71, 0xFC, 0x38 ); -// -// WPD_EVENT_OBJECT_UPDATED -// This event is sent after an object has been updated such that any connected client should refresh its view of that object. -DEFINE_GUID(WPD_EVENT_OBJECT_UPDATED, 0x1445A759, 0x2E01, 0x485D, 0x9F, 0x27, 0xFF, 0x07, 0xDA, 0xE6, 0x97, 0xAB ); -// -// WPD_EVENT_DEVICE_RESET -// This event indicates that the device is about to be reset, and all connected clients should close their connection to the device. -DEFINE_GUID(WPD_EVENT_DEVICE_RESET, 0x7755CF53, 0xC1ED, 0x44F3, 0xB5, 0xA2, 0x45, 0x1E, 0x2C, 0x37, 0x6B, 0x27 ); -// -// WPD_EVENT_DEVICE_CAPABILITIES_UPDATED -// This event indicates that the device capabilities have changed. Clients should re-query the device if they have made any decisions based on device capabilities. -DEFINE_GUID(WPD_EVENT_DEVICE_CAPABILITIES_UPDATED, 0x36885AA1, 0xCD54, 0x4DAA, 0xB3, 0xD0, 0xAF, 0xB3, 0xE0, 0x3F, 0x59, 0x99 ); -// -// WPD_EVENT_STORAGE_FORMAT -// This event indicates the progress of a format operation on a storage object. -DEFINE_GUID(WPD_EVENT_STORAGE_FORMAT, 0x3782616B, 0x22BC, 0x4474, 0xA2, 0x51, 0x30, 0x70, 0xF8, 0xD3, 0x88, 0x57 ); -// -// WPD_EVENT_OBJECT_TRANSFER_REQUESTED -// This event is sent to request an application to transfer a particular object from the device. -DEFINE_GUID(WPD_EVENT_OBJECT_TRANSFER_REQUESTED, 0x8D16A0A1, 0xF2C6, 0x41DA, 0x8F, 0x19, 0x5E, 0x53, 0x72, 0x1A, 0xDB, 0xF2 ); -// -// WPD_EVENT_DEVICE_REMOVED -// This event is sent when a driver for a device is being unloaded. This is typically a result of the device being unplugged. -DEFINE_GUID(WPD_EVENT_DEVICE_REMOVED, 0xE4CBCA1B, 0x6918, 0x48B9,0x85, 0xEE, 0x02, 0xBE, 0x7C, 0x85, 0x0A, 0xF9 ); -// -// WPD_EVENT_SERVICE_METHOD_COMPLETE -// This event is sent when a driver has completed invoking a service method. This event must be sent even when the method fails. -DEFINE_GUID(WPD_EVENT_SERVICE_METHOD_COMPLETE, 0x8A33F5F8, 0x0ACC, 0x4D9B, 0x9C, 0xC4, 0x11, 0x2D, 0x35, 0x3B, 0x86, 0xCA ); - -/**************************************************************************** -* This section defines all WPD content types -****************************************************************************/ -// -// WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT -// Indicates this object represents a functional object, not content data on the device. -DEFINE_GUID(WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT, 0x99ED0160, 0x17FF, 0x4C44, 0x9D, 0x98, 0x1D, 0x7A, 0x6F, 0x94, 0x19, 0x21 ); -// -// WPD_CONTENT_TYPE_FOLDER -// Indicates this object is a folder. -DEFINE_GUID(WPD_CONTENT_TYPE_FOLDER, 0x27E2E392, 0xA111, 0x48E0, 0xAB, 0x0C, 0xE1, 0x77, 0x05, 0xA0, 0x5F, 0x85 ); -// -// WPD_CONTENT_TYPE_IMAGE -// Indicates this object represents image data (e.g. a JPEG file) -DEFINE_GUID(WPD_CONTENT_TYPE_IMAGE, 0xef2107d5, 0xa52a, 0x4243, 0xa2, 0x6b, 0x62, 0xd4, 0x17, 0x6d, 0x76, 0x03 ); -// -// WPD_CONTENT_TYPE_DOCUMENT -// Indicates this object represents document data (e.g. a MS WORD file, TEXT file, etc.) -DEFINE_GUID(WPD_CONTENT_TYPE_DOCUMENT, 0x680ADF52, 0x950A, 0x4041, 0x9B, 0x41, 0x65, 0xE3, 0x93, 0x64, 0x81, 0x55 ); -// -// WPD_CONTENT_TYPE_CONTACT -// Indicates this object represents contact data (e.g. name/number, or a VCARD file) -DEFINE_GUID(WPD_CONTENT_TYPE_CONTACT, 0xEABA8313, 0x4525, 0x4707, 0x9F, 0x0E, 0x87, 0xC6, 0x80, 0x8E, 0x94, 0x35 ); -// -// WPD_CONTENT_TYPE_CONTACT_GROUP -// Indicates this object represents a group of contacts. -DEFINE_GUID(WPD_CONTENT_TYPE_CONTACT_GROUP, 0x346B8932, 0x4C36, 0x40D8, 0x94, 0x15, 0x18, 0x28, 0x29, 0x1F, 0x9D, 0xE9 ); -// -// WPD_CONTENT_TYPE_AUDIO -// Indicates this object represents audio data (e.g. a WMA or MP3 file) -DEFINE_GUID(WPD_CONTENT_TYPE_AUDIO, 0x4AD2C85E, 0x5E2D, 0x45E5, 0x88, 0x64, 0x4F, 0x22, 0x9E, 0x3C, 0x6C, 0xF0 ); -// -// WPD_CONTENT_TYPE_VIDEO -// Indicates this object represents video data (e.g. a WMV or AVI file) -DEFINE_GUID(WPD_CONTENT_TYPE_VIDEO, 0x9261B03C, 0x3D78, 0x4519, 0x85, 0xE3, 0x02, 0xC5, 0xE1, 0xF5, 0x0B, 0xB9 ); -// -// WPD_CONTENT_TYPE_TELEVISION -// Indicates this object represents a television recording. -DEFINE_GUID(WPD_CONTENT_TYPE_TELEVISION, 0x60A169CF, 0xF2AE, 0x4E21, 0x93, 0x75, 0x96, 0x77, 0xF1, 0x1C, 0x1C, 0x6E ); -// -// WPD_CONTENT_TYPE_PLAYLIST -// Indicates this object represents a playlist. -DEFINE_GUID(WPD_CONTENT_TYPE_PLAYLIST, 0x1A33F7E4, 0xAF13, 0x48F5, 0x99, 0x4E, 0x77, 0x36, 0x9D, 0xFE, 0x04, 0xA3 ); -// -// WPD_CONTENT_TYPE_MIXED_CONTENT_ALBUM -// Indicates this object represents an album, which may contain objects of different content types (typically, MUSIC, IMAGE and VIDEO). -DEFINE_GUID(WPD_CONTENT_TYPE_MIXED_CONTENT_ALBUM, 0x00F0C3AC, 0xA593, 0x49AC, 0x92, 0x19, 0x24, 0xAB, 0xCA, 0x5A, 0x25, 0x63 ); -// -// WPD_CONTENT_TYPE_AUDIO_ALBUM -// Indicates this object represents an audio album. -DEFINE_GUID(WPD_CONTENT_TYPE_AUDIO_ALBUM, 0xAA18737E, 0x5009, 0x48FA, 0xAE, 0x21, 0x85, 0xF2, 0x43, 0x83, 0xB4, 0xE6 ); -// -// WPD_CONTENT_TYPE_IMAGE_ALBUM -// Indicates this object represents an image album. -DEFINE_GUID(WPD_CONTENT_TYPE_IMAGE_ALBUM, 0x75793148, 0x15F5, 0x4A30, 0xA8, 0x13, 0x54, 0xED, 0x8A, 0x37, 0xE2, 0x26 ); -// -// WPD_CONTENT_TYPE_VIDEO_ALBUM -// Indicates this object represents a video album. -DEFINE_GUID(WPD_CONTENT_TYPE_VIDEO_ALBUM, 0x012B0DB7, 0xD4C1, 0x45D6, 0xB0, 0x81, 0x94, 0xB8, 0x77, 0x79, 0x61, 0x4F ); -// -// WPD_CONTENT_TYPE_MEMO -// Indicates this object represents memo data -DEFINE_GUID(WPD_CONTENT_TYPE_MEMO, 0x9CD20ECF, 0x3B50, 0x414F, 0xA6, 0x41, 0xE4, 0x73, 0xFF, 0xE4, 0x57, 0x51 ); -// -// WPD_CONTENT_TYPE_EMAIL -// Indicates this object represents e-mail data -DEFINE_GUID(WPD_CONTENT_TYPE_EMAIL, 0x8038044A, 0x7E51, 0x4F8F, 0x88, 0x3D, 0x1D, 0x06, 0x23, 0xD1, 0x45, 0x33 ); -// -// WPD_CONTENT_TYPE_APPOINTMENT -// Indicates this object represents an appointment in a calendar -DEFINE_GUID(WPD_CONTENT_TYPE_APPOINTMENT, 0x0FED060E, 0x8793, 0x4B1E, 0x90, 0xC9, 0x48, 0xAC, 0x38, 0x9A, 0xC6, 0x31 ); -// -// WPD_CONTENT_TYPE_TASK -// Indicates this object represents a task for tracking (e.g. a TODO list) -DEFINE_GUID(WPD_CONTENT_TYPE_TASK, 0x63252F2C, 0x887F, 0x4CB6, 0xB1, 0xAC, 0xD2, 0x98, 0x55, 0xDC, 0xEF, 0x6C ); -// -// WPD_CONTENT_TYPE_PROGRAM -// Indicates this object represents a file that can be run. This could be a script, executable and so on. -DEFINE_GUID(WPD_CONTENT_TYPE_PROGRAM, 0xD269F96A, 0x247C, 0x4BFF, 0x98, 0xFB, 0x97, 0xF3, 0xC4, 0x92, 0x20, 0xE6 ); -// -// WPD_CONTENT_TYPE_GENERIC_FILE -// Indicates this object represents a file that does not fall into any of the other predefined WPD types for files. -DEFINE_GUID(WPD_CONTENT_TYPE_GENERIC_FILE, 0x0085E0A6, 0x8D34, 0x45D7, 0xBC, 0x5C, 0x44, 0x7E, 0x59, 0xC7, 0x3D, 0x48 ); -// -// WPD_CONTENT_TYPE_CALENDAR -// Indicates this object represents a calender -DEFINE_GUID(WPD_CONTENT_TYPE_CALENDAR, 0xA1FD5967, 0x6023, 0x49A0, 0x9D, 0xF1, 0xF8, 0x06, 0x0B, 0xE7, 0x51, 0xB0 ); -// -// WPD_CONTENT_TYPE_GENERIC_MESSAGE -// Indicates this object represents a message (e.g. SMS message, E-Mail message, etc.) -DEFINE_GUID(WPD_CONTENT_TYPE_GENERIC_MESSAGE, 0xE80EAAF8, 0xB2DB, 0x4133, 0xB6, 0x7E, 0x1B, 0xEF, 0x4B, 0x4A, 0x6E, 0x5F ); -// -// WPD_CONTENT_TYPE_NETWORK_ASSOCIATION -// Indicates this object represents an association between a host and a device. -DEFINE_GUID(WPD_CONTENT_TYPE_NETWORK_ASSOCIATION, 0x031DA7EE, 0x18C8, 0x4205, 0x84, 0x7E, 0x89, 0xA1, 0x12, 0x61, 0xD0, 0xF3 ); -// -// WPD_CONTENT_TYPE_CERTIFICATE -// Indicates this object represents certificate used for authentication. -DEFINE_GUID(WPD_CONTENT_TYPE_CERTIFICATE, 0xDC3876E8, 0xA948, 0x4060, 0x90, 0x50, 0xCB, 0xD7, 0x7E, 0x8A, 0x3D, 0x87 ); -// -// WPD_CONTENT_TYPE_WIRELESS_PROFILE -// Indicates this object represents wireless network access information. -DEFINE_GUID(WPD_CONTENT_TYPE_WIRELESS_PROFILE, 0x0BAC070A, 0x9F5F, 0x4DA4, 0xA8, 0xF6, 0x3D, 0xE4, 0x4D, 0x68, 0xFD, 0x6C ); -// -// WPD_CONTENT_TYPE_MEDIA_CAST -// Indicates this object represents a media cast. A media cast object can be though 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_GUID(WPD_CONTENT_TYPE_MEDIA_CAST, 0x5E88B3CC, 0x3E65, 0x4E62, 0xBF, 0xFF, 0x22, 0x94, 0x95, 0x25, 0x3A, 0xB0 ); -// -// WPD_CONTENT_TYPE_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_GUID(WPD_CONTENT_TYPE_SECTION, 0x821089F5, 0x1D91, 0x4DC9, 0xBE, 0x3C, 0xBB, 0xB1, 0xB3, 0x5B, 0x18, 0xCE ); -// -// WPD_CONTENT_TYPE_UNSPECIFIED -// Indicates this object doesn't fall into the predefined WPD content types -DEFINE_GUID(WPD_CONTENT_TYPE_UNSPECIFIED, 0x28D8D31E, 0x249C, 0x454E, 0xAA, 0xBC, 0x34, 0x88, 0x31, 0x68, 0xE6, 0x34 ); -// -// WPD_CONTENT_TYPE_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_GUID(WPD_CONTENT_TYPE_ALL, 0x80E170D2, 0x1055, 0x4A3E, 0xB9, 0x52, 0x82, 0xCC, 0x4F, 0x8A, 0x86, 0x89 ); - -/**************************************************************************** -* This section defines all WPD Functional Categories -****************************************************************************/ - -#ifndef WPD_SERVICES_STRICT -// -// WPD_FUNCTIONAL_CATEGORY_DEVICE -// Used for the device object, which is always the top-most object of the device. -DEFINE_GUID(WPD_FUNCTIONAL_CATEGORY_DEVICE, 0x08EA466B, 0xE3A4, 0x4336, 0xA1, 0xF3, 0xA4, 0x4D, 0x2B, 0x5C, 0x43, 0x8C ); -// -// WPD_FUNCTIONAL_CATEGORY_STORAGE -// Indicates this object encapsulates storage functionality on the device (e.g. memory cards, internal memory) -DEFINE_GUID(WPD_FUNCTIONAL_CATEGORY_STORAGE, 0x23F05BBC, 0x15DE, 0x4C2A, 0xA5, 0x5B, 0xA9, 0xAF, 0x5C, 0xE4, 0x12, 0xEF ); -// -// WPD_FUNCTIONAL_CATEGORY_STILL_IMAGE_CAPTURE -// Indicates this object encapsulates still image capture functionality on the device (e.g. camera or camera attachment) -DEFINE_GUID(WPD_FUNCTIONAL_CATEGORY_STILL_IMAGE_CAPTURE, 0x613CA327, 0xAB93, 0x4900, 0xB4, 0xFA, 0x89, 0x5B, 0xB5, 0x87, 0x4B, 0x79 ); -// -// WPD_FUNCTIONAL_CATEGORY_AUDIO_CAPTURE -// Indicates this object encapsulates audio capture functionality on the device (e.g. voice recorder or other audio recording component) -DEFINE_GUID(WPD_FUNCTIONAL_CATEGORY_AUDIO_CAPTURE, 0x3F2A1919, 0xC7C2, 0x4A00, 0x85, 0x5D, 0xF5, 0x7C, 0xF0, 0x6D, 0xEB, 0xBB ); -// -// WPD_FUNCTIONAL_CATEGORY_VIDEO_CAPTURE -// Indicates this object encapsulates video capture functionality on the device (e.g. video recorder or video recording component) -DEFINE_GUID(WPD_FUNCTIONAL_CATEGORY_VIDEO_CAPTURE, 0xE23E5F6B, 0x7243, 0x43AA, 0x8D, 0xF1, 0x0E, 0xB3, 0xD9, 0x68, 0xA9, 0x18 ); -// -// WPD_FUNCTIONAL_CATEGORY_SMS -// Indicates this object encapsulates SMS sending functionality on the device (not the receiving or saved SMS messages since those are represented as content objects on the device) -DEFINE_GUID(WPD_FUNCTIONAL_CATEGORY_SMS, 0x0044A0B1, 0xC1E9, 0x4AFD, 0xB3, 0x58, 0xA6, 0x2C, 0x61, 0x17, 0xC9, 0xCF ); -// -// WPD_FUNCTIONAL_CATEGORY_RENDERING_INFORMATION -// Indicates this object provides information about the rendering characteristics of the device. -DEFINE_GUID(WPD_FUNCTIONAL_CATEGORY_RENDERING_INFORMATION, 0x08600BA4, 0xA7BA, 0x4A01, 0xAB, 0x0E, 0x00, 0x65, 0xD0, 0xA3, 0x56, 0xD3 ); -// -// WPD_FUNCTIONAL_CATEGORY_NETWORK_CONFIGURATION -// Indicates this object encapsulates network configuration functionality on the device (e.g. WiFi Profiles, Partnerships). -DEFINE_GUID(WPD_FUNCTIONAL_CATEGORY_NETWORK_CONFIGURATION, 0x48F4DB72, 0x7C6A, 0x4AB0, 0x9E, 0x1A, 0x47, 0x0E, 0x3C, 0xDB, 0xF2, 0x6A ); -// -// WPD_FUNCTIONAL_CATEGORY_ALL -// This functional category is only valid as a parameter to API functions and driver commands. It should not be reported as a supported functional category by the driver. -DEFINE_GUID(WPD_FUNCTIONAL_CATEGORY_ALL, 0x2D8A6512, 0xA74C, 0x448E, 0xBA, 0x8A, 0xF4, 0xAC, 0x07, 0xC4, 0x93, 0x99 ); - -#endif // WPD_SERVICES_STRICT -/**************************************************************************** -* This section defines all WPD Formats -****************************************************************************/ - -#ifndef WPD_SERVICES_STRICT -// -// WPD_OBJECT_FORMAT_PROPERTIES_ONLY -// This object has no data stream and is completely specified by properties only. -DEFINE_GUID(WPD_OBJECT_FORMAT_PROPERTIES_ONLY, 0x30010000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_UNSPECIFIED -// An undefined object format on the device (e.g. objects that can not be classified by the other defined WPD format codes) -DEFINE_GUID(WPD_OBJECT_FORMAT_UNSPECIFIED, 0x30000000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_SCRIPT -// A device model-specific script -DEFINE_GUID(WPD_OBJECT_FORMAT_SCRIPT, 0x30020000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_EXECUTABLE -// A device model-specific binary executable -DEFINE_GUID(WPD_OBJECT_FORMAT_EXECUTABLE, 0x30030000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_TEXT -// A text file -DEFINE_GUID(WPD_OBJECT_FORMAT_TEXT, 0x30040000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_HTML -// A HyperText Markup Language file (text) -DEFINE_GUID(WPD_OBJECT_FORMAT_HTML, 0x30050000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_DPOF -// A Digital Print Order File (text) -DEFINE_GUID(WPD_OBJECT_FORMAT_DPOF, 0x30060000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_AIFF -// Audio file format -DEFINE_GUID(WPD_OBJECT_FORMAT_AIFF, 0x30070000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_WAVE -// Audio file format -DEFINE_GUID(WPD_OBJECT_FORMAT_WAVE, 0x30080000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_MP3 -// Audio file format -DEFINE_GUID(WPD_OBJECT_FORMAT_MP3, 0x30090000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_AVI -// Video file format -DEFINE_GUID(WPD_OBJECT_FORMAT_AVI, 0x300A0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_MPEG -// Video file format -DEFINE_GUID(WPD_OBJECT_FORMAT_MPEG, 0x300B0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_ASF -// Video file format (Microsoft Advanced Streaming Format) -DEFINE_GUID(WPD_OBJECT_FORMAT_ASF, 0x300C0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_EXIF -// Image file format (Exchangeable File Format), JEIDA standard -DEFINE_GUID(WPD_OBJECT_FORMAT_EXIF, 0x38010000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_TIFFEP -// Image file format (Tag Image File Format for Electronic Photography) -DEFINE_GUID(WPD_OBJECT_FORMAT_TIFFEP, 0x38020000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_FLASHPIX -// Image file format (Structured Storage Image Format) -DEFINE_GUID(WPD_OBJECT_FORMAT_FLASHPIX, 0x38030000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_BMP -// Image file format (Microsoft Windows Bitmap file) -DEFINE_GUID(WPD_OBJECT_FORMAT_BMP, 0x38040000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_CIFF -// Image file format (Canon Camera Image File Format) -DEFINE_GUID(WPD_OBJECT_FORMAT_CIFF, 0x38050000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_GIF -// Image file format (Graphics Interchange Format) -DEFINE_GUID(WPD_OBJECT_FORMAT_GIF, 0x38070000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_JFIF -// Image file format (JPEG Interchange Format) -DEFINE_GUID(WPD_OBJECT_FORMAT_JFIF, 0x38080000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_PCD -// Image file format (PhotoCD Image Pac) -DEFINE_GUID(WPD_OBJECT_FORMAT_PCD, 0x38090000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_PICT -// Image file format (Quickdraw Image Format) -DEFINE_GUID(WPD_OBJECT_FORMAT_PICT, 0x380A0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_PNG -// Image file format (Portable Network Graphics) -DEFINE_GUID(WPD_OBJECT_FORMAT_PNG, 0x380B0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_TIFF -// Image file format (Tag Image File Format) -DEFINE_GUID(WPD_OBJECT_FORMAT_TIFF, 0x380D0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_TIFFIT -// Image file format (Tag Image File Format for Informational Technology) Graphic Arts -DEFINE_GUID(WPD_OBJECT_FORMAT_TIFFIT, 0x380E0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_JP2 -// Image file format (JPEG2000 Baseline File Format) -DEFINE_GUID(WPD_OBJECT_FORMAT_JP2, 0x380F0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_JPX -// Image file format (JPEG2000 Extended File Format) -DEFINE_GUID(WPD_OBJECT_FORMAT_JPX, 0x38100000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_WINDOWSIMAGEFORMAT -// Image file format -DEFINE_GUID(WPD_OBJECT_FORMAT_WINDOWSIMAGEFORMAT, 0xB8810000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_WMA -// Audio file format (Windows Media Audio) -DEFINE_GUID(WPD_OBJECT_FORMAT_WMA, 0xB9010000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_WMV -// Video file format (Windows Media Video) -DEFINE_GUID(WPD_OBJECT_FORMAT_WMV, 0xB9810000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_WPLPLAYLIST -// Playlist file format -DEFINE_GUID(WPD_OBJECT_FORMAT_WPLPLAYLIST, 0xBA100000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_M3UPLAYLIST -// Playlist file format -DEFINE_GUID(WPD_OBJECT_FORMAT_M3UPLAYLIST, 0xBA110000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_MPLPLAYLIST -// Playlist file format -DEFINE_GUID(WPD_OBJECT_FORMAT_MPLPLAYLIST, 0xBA120000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_ASXPLAYLIST -// Playlist file format -DEFINE_GUID(WPD_OBJECT_FORMAT_ASXPLAYLIST, 0xBA130000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_PLSPLAYLIST -// Playlist file format -DEFINE_GUID(WPD_OBJECT_FORMAT_PLSPLAYLIST, 0xBA140000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_ABSTRACT_CONTACT_GROUP -// Generic format for contact group objects -DEFINE_GUID(WPD_OBJECT_FORMAT_ABSTRACT_CONTACT_GROUP, 0xBA060000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_ABSTRACT_MEDIA_CAST -// MediaCast file format -DEFINE_GUID(WPD_OBJECT_FORMAT_ABSTRACT_MEDIA_CAST, 0xBA0B0000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_VCALENDAR1 -// VCALENDAR file format (VCALENDAR Version 1) -DEFINE_GUID(WPD_OBJECT_FORMAT_VCALENDAR1, 0xBE020000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_ICALENDAR -// ICALENDAR file format (VCALENDAR Version 2) -DEFINE_GUID(WPD_OBJECT_FORMAT_ICALENDAR, 0xBE030000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_ABSTRACT_CONTACT -// Abstract contact file format -DEFINE_GUID(WPD_OBJECT_FORMAT_ABSTRACT_CONTACT, 0xBB810000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_VCARD2 -// VCARD file format (VCARD Version 2) -DEFINE_GUID(WPD_OBJECT_FORMAT_VCARD2, 0xBB820000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_VCARD3 -// VCARD file format (VCARD Version 3) -DEFINE_GUID(WPD_OBJECT_FORMAT_VCARD3, 0xBB830000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_ICON -// Standard Windows ICON format -DEFINE_GUID(WPD_OBJECT_FORMAT_ICON, 0x077232ED, 0x102C, 0x4638, 0x9C, 0x22, 0x83, 0xF1, 0x42, 0xBF, 0xC8, 0x22 ); -// -// WPD_OBJECT_FORMAT_XML -// XML file format. -DEFINE_GUID(WPD_OBJECT_FORMAT_XML, 0xBA820000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_AAC -// Audio file format -DEFINE_GUID(WPD_OBJECT_FORMAT_AAC, 0xB9030000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_AUDIBLE -// Audio file format -DEFINE_GUID(WPD_OBJECT_FORMAT_AUDIBLE, 0xB9040000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_FLAC -// Audio file format -DEFINE_GUID(WPD_OBJECT_FORMAT_FLAC, 0xB9060000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_OGG -// Audio file format -DEFINE_GUID(WPD_OBJECT_FORMAT_OGG, 0xB9020000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_MP4 -// Audio or Video file format -DEFINE_GUID(WPD_OBJECT_FORMAT_MP4, 0xB9820000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_M4A -// Audio file format -DEFINE_GUID(WPD_OBJECT_FORMAT_M4A, 0x30ABA7AC, 0x6FFD, 0x4C23, 0xA3, 0x59, 0x3E, 0x9B, 0x52, 0xF3, 0xF1, 0xC8 ); -// -// WPD_OBJECT_FORMAT_MP2 -// Audio or Video file format -DEFINE_GUID(WPD_OBJECT_FORMAT_MP2, 0xB9830000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_MICROSOFT_WORD -// Microsoft Office Word Document file format. -DEFINE_GUID(WPD_OBJECT_FORMAT_MICROSOFT_WORD, 0xBA830000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_MHT_COMPILED_HTML -// MHT Compiled HTML Document file format. -DEFINE_GUID(WPD_OBJECT_FORMAT_MHT_COMPILED_HTML, 0xBA840000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_MICROSOFT_EXCEL -// Microsoft Office Excel Document file format. -DEFINE_GUID(WPD_OBJECT_FORMAT_MICROSOFT_EXCEL, 0xBA850000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_MICROSOFT_POWERPOINT -// Microsoft Office PowerPoint Document file format. -DEFINE_GUID(WPD_OBJECT_FORMAT_MICROSOFT_POWERPOINT, 0xBA860000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_NETWORK_ASSOCIATION -// Network Association file format. -DEFINE_GUID(WPD_OBJECT_FORMAT_NETWORK_ASSOCIATION, 0xB1020000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_X509V3CERTIFICATE -// X.509 V3 Certificate file format. -DEFINE_GUID(WPD_OBJECT_FORMAT_X509V3CERTIFICATE, 0xB1030000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_MICROSOFT_WFC -// Windows Connect Now file format. -DEFINE_GUID(WPD_OBJECT_FORMAT_MICROSOFT_WFC, 0xB1040000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_3GP -// Audio or Video file format -DEFINE_GUID(WPD_OBJECT_FORMAT_3GP, 0xB9840000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7 ); -// -// WPD_OBJECT_FORMAT_3GPA -// Audio file format -DEFINE_GUID(WPD_OBJECT_FORMAT_3GPA, 0xE5172730, 0xF971, 0x41EF, 0xA1, 0x0B, 0x22, 0x71, 0xA0, 0x01, 0x9D, 0x7A ); -#define WPD_OBJECT_FORMAT_VCALENDAR2 WPD_OBJECT_FORMAT_ICALENDAR - -#endif // WPD_SERVICES_STRICT - -// -// WPD_OBJECT_FORMAT_ALL -// This format is only valid as a parameter to API functions and driver commands. It should not be reported as a supported format by the driver. -DEFINE_GUID(WPD_OBJECT_FORMAT_ALL, 0xC1F62EB2, 0x4BB3, 0x479C, 0x9C, 0xFA, 0x05, 0xB5, 0xF3, 0xA5, 0x7B, 0x22 ); - -#ifndef WPD_SERVICES_STRICT -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_OBJECT_PROPERTIES_V1 -* -* This category is for all common object properties. -****************************************************************************/ -DEFINE_GUID( WPD_OBJECT_PROPERTIES_V1 , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C ); - -// -// WPD_OBJECT_ID -// [ VT_LPWSTR ] Uniquely identifies object on the Portable Device. -DEFINE_PROPERTYKEY( WPD_OBJECT_ID , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 2 ); -// -// WPD_OBJECT_PARENT_ID -// [ VT_LPWSTR ] Object identifier indicating the parent object. -DEFINE_PROPERTYKEY( WPD_OBJECT_PARENT_ID , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 3 ); -// -// WPD_OBJECT_NAME -// [ VT_LPWSTR ] The display name for this object. -DEFINE_PROPERTYKEY( WPD_OBJECT_NAME , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 4 ); -// -// WPD_OBJECT_PERSISTENT_UNIQUE_ID -// [ VT_LPWSTR ] Uniquely identifies the object on the Portable Device, similar to WPD_OBJECT_ID, but this ID will not change between sessions. -DEFINE_PROPERTYKEY( WPD_OBJECT_PERSISTENT_UNIQUE_ID , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 5 ); -// -// WPD_OBJECT_FORMAT -// [ VT_CLSID ] Indicates the format of the object's data. -DEFINE_PROPERTYKEY( WPD_OBJECT_FORMAT , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 6 ); - -#endif // WPD_SERVICES_STRICT -// -// WPD_OBJECT_CONTENT_TYPE -// [ VT_CLSID ] The abstract type for the object content, indicating the kinds of properties and data that may be supported on the object. -DEFINE_PROPERTYKEY( WPD_OBJECT_CONTENT_TYPE , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 7 ); - -#ifndef WPD_SERVICES_STRICT -// -// WPD_OBJECT_ISHIDDEN -// [ VT_BOOL ] Indicates whether the object should be hidden. -DEFINE_PROPERTYKEY( WPD_OBJECT_ISHIDDEN , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 9 ); -// -// WPD_OBJECT_ISSYSTEM -// [ VT_BOOL ] Indicates whether the object represents system data. -DEFINE_PROPERTYKEY( WPD_OBJECT_ISSYSTEM , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 10 ); -// -// WPD_OBJECT_SIZE -// [ VT_UI8 ] The size of the object data. -DEFINE_PROPERTYKEY( WPD_OBJECT_SIZE , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 11 ); -// -// WPD_OBJECT_ORIGINAL_FILE_NAME -// [ VT_LPWSTR ] Contains the name of the file this object represents. -DEFINE_PROPERTYKEY( WPD_OBJECT_ORIGINAL_FILE_NAME , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 12 ); -// -// WPD_OBJECT_NON_CONSUMABLE -// [ VT_BOOL ] This property determines whether or not this object is intended to be understood by the device, or whether it has been placed on the device just for storage. -DEFINE_PROPERTYKEY( WPD_OBJECT_NON_CONSUMABLE , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 13 ); - -#endif // WPD_SERVICES_STRICT -// -// WPD_OBJECT_REFERENCES -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection of type VT_LPWSTR indicating a list of ObjectIDs. -DEFINE_PROPERTYKEY( WPD_OBJECT_REFERENCES , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 14 ); - -#ifndef WPD_SERVICES_STRICT -// -// WPD_OBJECT_KEYWORDS -// [ VT_LPWSTR ] String containing a list of keywords associated with this object. -DEFINE_PROPERTYKEY( WPD_OBJECT_KEYWORDS , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 15 ); -// -// WPD_OBJECT_SYNC_ID -// [ VT_LPWSTR ] Opaque string set by client to retain state between sessions without retaining a catalogue of connected device content. -DEFINE_PROPERTYKEY( WPD_OBJECT_SYNC_ID , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 16 ); -// -// WPD_OBJECT_IS_DRM_PROTECTED -// [ VT_BOOL ] Indicates whether the media data is DRM protected. -DEFINE_PROPERTYKEY( WPD_OBJECT_IS_DRM_PROTECTED , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 17 ); -// -// WPD_OBJECT_DATE_CREATED -// [ VT_DATE ] Indicates the date and time the object was created on the device. -DEFINE_PROPERTYKEY( WPD_OBJECT_DATE_CREATED , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 18 ); -// -// WPD_OBJECT_DATE_MODIFIED -// [ VT_DATE ] Indicates the date and time the object was modified on the device. -DEFINE_PROPERTYKEY( WPD_OBJECT_DATE_MODIFIED , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 19 ); -// -// WPD_OBJECT_DATE_AUTHORED -// [ VT_DATE ] Indicates the date and time the object was authored (e.g. for music, this would be the date the music was recorded). -DEFINE_PROPERTYKEY( WPD_OBJECT_DATE_AUTHORED , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 20 ); -// -// WPD_OBJECT_BACK_REFERENCES -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection of type VT_LPWSTR indicating a list of ObjectIDs. -DEFINE_PROPERTYKEY( WPD_OBJECT_BACK_REFERENCES , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 21 ); - -#endif // WPD_SERVICES_STRICT -// -// WPD_OBJECT_CONTAINER_FUNCTIONAL_OBJECT_ID -// [ VT_LPWSTR ] Indicates the Object ID of the closest functional object ancestor. For example, objects that represent files/folders under a Storage functional object, will have this property set to the object ID of the storage functional object. -DEFINE_PROPERTYKEY( WPD_OBJECT_CONTAINER_FUNCTIONAL_OBJECT_ID , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 23 ); - -#ifndef WPD_SERVICES_STRICT -// -// WPD_OBJECT_GENERATE_THUMBNAIL_FROM_RESOURCE -// [ VT_BOOL ] Indicates whether the thumbnail for this object should be generated from the default resource. -DEFINE_PROPERTYKEY( WPD_OBJECT_GENERATE_THUMBNAIL_FROM_RESOURCE , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 24 ); -// -// WPD_OBJECT_HINT_LOCATION_DISPLAY_NAME -// [ VT_LPWSTR ] If this object appears as a hint location, this property indicates the hint-specific name to display instead of the object name. -DEFINE_PROPERTYKEY( WPD_OBJECT_HINT_LOCATION_DISPLAY_NAME , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 25 ); -// -// WPD_OBJECT_CAN_DELETE -// [ VT_BOOL ] Indicates whether the object can be deleted, or not. -DEFINE_PROPERTYKEY( WPD_OBJECT_CAN_DELETE , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 26 ); -// -// WPD_OBJECT_LANGUAGE_LOCALE -// [ VT_LPWSTR ] Identifies the language of this object. If multiple languages are contained in this object, it should identify the primary language (if any). -DEFINE_PROPERTYKEY( WPD_OBJECT_LANGUAGE_LOCALE , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 27 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_FOLDER_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all folder objects. -****************************************************************************/ -DEFINE_GUID( WPD_FOLDER_OBJECT_PROPERTIES_V1 , 0x7E9A7ABF, 0xE568, 0x4B34, 0xAA, 0x2F, 0x13, 0xBB, 0x12, 0xAB, 0x17, 0x7D ); - -// -// WPD_FOLDER_CONTENT_TYPES_ALLOWED -// [ VT_UNKNOWN ] Indicates the subset of content types that can be created in this folder directly (i.e. children may have different restrictions). -DEFINE_PROPERTYKEY( WPD_FOLDER_CONTENT_TYPES_ALLOWED , 0x7E9A7ABF, 0xE568, 0x4B34, 0xAA, 0x2F, 0x13, 0xBB, 0x12, 0xAB, 0x17, 0x7D , 2 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_IMAGE_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all image objects. -****************************************************************************/ -DEFINE_GUID( WPD_IMAGE_OBJECT_PROPERTIES_V1 , 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB ); - -// -// WPD_IMAGE_BITDEPTH -// [ VT_UI4 ] Indicates the bitdepth of an image -DEFINE_PROPERTYKEY( WPD_IMAGE_BITDEPTH , 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB , 3 ); -// -// WPD_IMAGE_CROPPED_STATUS -// [ VT_UI4 ] Signals whether the file has been cropped. -DEFINE_PROPERTYKEY( WPD_IMAGE_CROPPED_STATUS , 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB , 4 ); -// -// WPD_IMAGE_COLOR_CORRECTED_STATUS -// [ VT_UI4 ] Signals whether the file has been color corrected. -DEFINE_PROPERTYKEY( WPD_IMAGE_COLOR_CORRECTED_STATUS , 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB , 5 ); -// -// WPD_IMAGE_FNUMBER -// [ VT_UI4 ] Identifies the aperture setting of the lens when this image was captured. -DEFINE_PROPERTYKEY( WPD_IMAGE_FNUMBER , 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB , 6 ); -// -// WPD_IMAGE_EXPOSURE_TIME -// [ VT_UI4 ] Identifies the shutter speed of the device when this image was captured. -DEFINE_PROPERTYKEY( WPD_IMAGE_EXPOSURE_TIME , 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB , 7 ); -// -// WPD_IMAGE_EXPOSURE_INDEX -// [ VT_UI4 ] Identifies the emulation of film speed settings when this image was captured. -DEFINE_PROPERTYKEY( WPD_IMAGE_EXPOSURE_INDEX , 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB , 8 ); -// -// WPD_IMAGE_HORIZONTAL_RESOLUTION -// [ VT_R8 ] Indicates the horizontal resolution (DPI) of an image -DEFINE_PROPERTYKEY( WPD_IMAGE_HORIZONTAL_RESOLUTION , 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB , 9 ); -// -// WPD_IMAGE_VERTICAL_RESOLUTION -// [ VT_R8 ] Indicates the vertical resolution (DPI) of an image -DEFINE_PROPERTYKEY( WPD_IMAGE_VERTICAL_RESOLUTION , 0x63D64908, 0x9FA1, 0x479F, 0x85, 0xBA, 0x99, 0x52, 0x21, 0x64, 0x47, 0xDB , 10 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_DOCUMENT_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all document objects. -****************************************************************************/ -DEFINE_GUID( WPD_DOCUMENT_OBJECT_PROPERTIES_V1 , 0x0B110203, 0xEB95, 0x4F02, 0x93, 0xE0, 0x97, 0xC6, 0x31, 0x49, 0x3A, 0xD5 ); - - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_MEDIA_PROPERTIES_V1 -* -* This category is for properties common to media objects (e.g. audio and video). -****************************************************************************/ -DEFINE_GUID( WPD_MEDIA_PROPERTIES_V1 , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 ); - -// -// WPD_MEDIA_TOTAL_BITRATE -// [ VT_UI4 ] The total number of bits that one second will consume. -DEFINE_PROPERTYKEY( WPD_MEDIA_TOTAL_BITRATE , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 2 ); -// -// WPD_MEDIA_BITRATE_TYPE -// [ VT_UI4 ] Further qualifies the bitrate of audio or video data. -DEFINE_PROPERTYKEY( WPD_MEDIA_BITRATE_TYPE , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 3 ); -// -// WPD_MEDIA_COPYRIGHT -// [ VT_LPWSTR ] Indicates the copyright information. -DEFINE_PROPERTYKEY( WPD_MEDIA_COPYRIGHT , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 4 ); -// -// WPD_MEDIA_SUBSCRIPTION_CONTENT_ID -// [ VT_LPWSTR ] Provides additional information to identify a piece of content relative to an online subscription service. -DEFINE_PROPERTYKEY( WPD_MEDIA_SUBSCRIPTION_CONTENT_ID , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 5 ); -// -// WPD_MEDIA_USE_COUNT -// [ VT_UI4 ] Indicates the total number of times this media has been played or viewed on the device. -DEFINE_PROPERTYKEY( WPD_MEDIA_USE_COUNT , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 6 ); -// -// WPD_MEDIA_SKIP_COUNT -// [ VT_UI4 ] Indicates the total number of times this media was setup to be played or viewed but was manually skipped by the user. -DEFINE_PROPERTYKEY( WPD_MEDIA_SKIP_COUNT , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 7 ); -// -// WPD_MEDIA_LAST_ACCESSED_TIME -// [ VT_DATE ] Indicates the date and time the media was last accessed on the device. -DEFINE_PROPERTYKEY( WPD_MEDIA_LAST_ACCESSED_TIME , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 8 ); -// -// WPD_MEDIA_PARENTAL_RATING -// [ VT_LPWSTR ] Indicates the parental rating of the media file. -DEFINE_PROPERTYKEY( WPD_MEDIA_PARENTAL_RATING , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 9 ); -// -// WPD_MEDIA_META_GENRE -// [ VT_UI4 ] Further qualifies a piece of media in a contextual way. -DEFINE_PROPERTYKEY( WPD_MEDIA_META_GENRE , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 10 ); -// -// WPD_MEDIA_COMPOSER -// [ VT_LPWSTR ] Identifies the composer when the composer is not the artist who performed it. -DEFINE_PROPERTYKEY( WPD_MEDIA_COMPOSER , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 11 ); -// -// WPD_MEDIA_EFFECTIVE_RATING -// [ VT_UI4 ] Contains an assigned rating for media not set by the user, but is generated based upon usage statistics. -DEFINE_PROPERTYKEY( WPD_MEDIA_EFFECTIVE_RATING , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 12 ); -// -// WPD_MEDIA_SUB_TITLE -// [ VT_LPWSTR ] Further qualifies the title when the title is ambiguous or general. -DEFINE_PROPERTYKEY( WPD_MEDIA_SUB_TITLE , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 13 ); -// -// WPD_MEDIA_RELEASE_DATE -// [ VT_DATE ] Indicates when the media was released. -DEFINE_PROPERTYKEY( WPD_MEDIA_RELEASE_DATE , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 14 ); -// -// WPD_MEDIA_SAMPLE_RATE -// [ VT_UI4 ] Indicates the number of times media selection was sampled per second during encoding. -DEFINE_PROPERTYKEY( WPD_MEDIA_SAMPLE_RATE , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 15 ); -// -// WPD_MEDIA_STAR_RATING -// [ VT_UI4 ] Indicates the star rating for this media. -DEFINE_PROPERTYKEY( WPD_MEDIA_STAR_RATING , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 16 ); -// -// WPD_MEDIA_USER_EFFECTIVE_RATING -// [ VT_UI4 ] Indicates the rating for this media. -DEFINE_PROPERTYKEY( WPD_MEDIA_USER_EFFECTIVE_RATING , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 17 ); -// -// WPD_MEDIA_TITLE -// [ VT_LPWSTR ] Indicates the title of this media. -DEFINE_PROPERTYKEY( WPD_MEDIA_TITLE , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 18 ); -// -// WPD_MEDIA_DURATION -// [ VT_UI8 ] Indicates the duration of this media in milliseconds. -DEFINE_PROPERTYKEY( WPD_MEDIA_DURATION , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 19 ); -// -// WPD_MEDIA_BUY_NOW -// [ VT_BOOL ] TBD -DEFINE_PROPERTYKEY( WPD_MEDIA_BUY_NOW , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 20 ); -// -// WPD_MEDIA_ENCODING_PROFILE -// [ VT_LPWSTR ] Media codecs may be encoded in accordance with a profile, which defines a particular encoding algorithm or optimization process. -DEFINE_PROPERTYKEY( WPD_MEDIA_ENCODING_PROFILE , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 21 ); -// -// WPD_MEDIA_WIDTH -// [ VT_UI4 ] Indicates the width of an object in pixels -DEFINE_PROPERTYKEY( WPD_MEDIA_WIDTH , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 22 ); -// -// WPD_MEDIA_HEIGHT -// [ VT_UI4 ] Indicates the height of an object in pixels -DEFINE_PROPERTYKEY( WPD_MEDIA_HEIGHT , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 23 ); -// -// WPD_MEDIA_ARTIST -// [ VT_LPWSTR ] Indicates the artist for this media. -DEFINE_PROPERTYKEY( WPD_MEDIA_ARTIST , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 24 ); -// -// WPD_MEDIA_ALBUM_ARTIST -// [ VT_LPWSTR ] Indicates the artist of the entire album rather than for a particular track. -DEFINE_PROPERTYKEY( WPD_MEDIA_ALBUM_ARTIST , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 25 ); -// -// WPD_MEDIA_OWNER -// [ VT_LPWSTR ] Indicates the e-mail address of the owner for this media. -DEFINE_PROPERTYKEY( WPD_MEDIA_OWNER , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 26 ); -// -// WPD_MEDIA_MANAGING_EDITOR -// [ VT_LPWSTR ] Indicates the e-mail address of the managing editor for this media. -DEFINE_PROPERTYKEY( WPD_MEDIA_MANAGING_EDITOR , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 27 ); -// -// WPD_MEDIA_WEBMASTER -// [ VT_LPWSTR ] Indicates the e-mail address of the Webmaster for this media. -DEFINE_PROPERTYKEY( WPD_MEDIA_WEBMASTER , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 28 ); -// -// WPD_MEDIA_SOURCE_URL -// [ VT_LPWSTR ] Identifies the source URL for this object. -DEFINE_PROPERTYKEY( WPD_MEDIA_SOURCE_URL , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 29 ); -// -// WPD_MEDIA_DESTINATION_URL -// [ VT_LPWSTR ] Identifies the URL that an object is linked to if a user clicks on it. -DEFINE_PROPERTYKEY( WPD_MEDIA_DESTINATION_URL , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 30 ); -// -// WPD_MEDIA_DESCRIPTION -// [ VT_LPWSTR ] Contains a description of the media content for this object. -DEFINE_PROPERTYKEY( WPD_MEDIA_DESCRIPTION , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 31 ); -// -// WPD_MEDIA_GENRE -// [ VT_LPWSTR ] A text field indicating the genre this media belongs to. -DEFINE_PROPERTYKEY( WPD_MEDIA_GENRE , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 32 ); -// -// WPD_MEDIA_TIME_BOOKMARK -// [ VT_UI8 ] Indicates a bookmark (in milliseconds) of the last position played or viewed on media that have duration. -DEFINE_PROPERTYKEY( WPD_MEDIA_TIME_BOOKMARK , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 33 ); -// -// WPD_MEDIA_OBJECT_BOOKMARK -// [ VT_LPWSTR ] Indicates a WPD_OBJECT_ID of the last object viewed or played for those objects that refer to a list of objects (such as playlists or media casts). -DEFINE_PROPERTYKEY( WPD_MEDIA_OBJECT_BOOKMARK , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 34 ); -// -// WPD_MEDIA_LAST_BUILD_DATE -// [ VT_DATE ] Indicates the last time a series in a media cast was changed or edited. -DEFINE_PROPERTYKEY( WPD_MEDIA_LAST_BUILD_DATE , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 35 ); -// -// WPD_MEDIA_BYTE_BOOKMARK -// [ VT_UI8 ] Indicates a bookmark (as a zero-based byte offset) of the last position played or viewed on this media object. -DEFINE_PROPERTYKEY( WPD_MEDIA_BYTE_BOOKMARK , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 36 ); -// -// WPD_MEDIA_TIME_TO_LIVE -// [ VT_UI8 ] It is the number of minutes that indicates how long a channel can be cached before refreshing from the source. Applies to WPD_CONTENT_TYPE_MEDIA_CAST objects. -DEFINE_PROPERTYKEY( WPD_MEDIA_TIME_TO_LIVE , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 37 ); -// -// WPD_MEDIA_GUID -// [ VT_LPWSTR ] A text field indicating the GUID of this media. -DEFINE_PROPERTYKEY( WPD_MEDIA_GUID , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 38 ); -// -// WPD_MEDIA_SUB_DESCRIPTION -// [ VT_LPWSTR ] Contains a sub description of the media content for this object. -DEFINE_PROPERTYKEY( WPD_MEDIA_SUB_DESCRIPTION , 0x2ED8BA05, 0x0AD3, 0x42DC, 0xB0, 0xD0, 0xBC, 0x95, 0xAC, 0x39, 0x6A, 0xC8 , 39 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CONTACT_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all contact objects. -****************************************************************************/ -DEFINE_GUID( WPD_CONTACT_OBJECT_PROPERTIES_V1 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B ); - -// -// WPD_CONTACT_DISPLAY_NAME -// [ VT_LPWSTR ] Indicates the display name of the contact (e.g "John Doe") -DEFINE_PROPERTYKEY( WPD_CONTACT_DISPLAY_NAME , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 2 ); -// -// WPD_CONTACT_FIRST_NAME -// [ VT_LPWSTR ] Indicates the first name of the contact (e.g. "John") -DEFINE_PROPERTYKEY( WPD_CONTACT_FIRST_NAME , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 3 ); -// -// WPD_CONTACT_MIDDLE_NAMES -// [ VT_LPWSTR ] Indicates the middle name of the contact -DEFINE_PROPERTYKEY( WPD_CONTACT_MIDDLE_NAMES , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 4 ); -// -// WPD_CONTACT_LAST_NAME -// [ VT_LPWSTR ] Indicates the last name of the contact (e.g. "Doe") -DEFINE_PROPERTYKEY( WPD_CONTACT_LAST_NAME , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 5 ); -// -// WPD_CONTACT_PREFIX -// [ VT_LPWSTR ] Indicates the prefix of the name of the contact (e.g. "Mr.") -DEFINE_PROPERTYKEY( WPD_CONTACT_PREFIX , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 6 ); -// -// WPD_CONTACT_SUFFIX -// [ VT_LPWSTR ] Indicates the suffix of the name of the contact (e.g. "Jr.") -DEFINE_PROPERTYKEY( WPD_CONTACT_SUFFIX , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 7 ); -// -// WPD_CONTACT_PHONETIC_FIRST_NAME -// [ VT_LPWSTR ] The phonetic guide for pronouncing the contact's first name. -DEFINE_PROPERTYKEY( WPD_CONTACT_PHONETIC_FIRST_NAME , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 8 ); -// -// WPD_CONTACT_PHONETIC_LAST_NAME -// [ VT_LPWSTR ] The phonetic guide for pronouncing the contact's last name. -DEFINE_PROPERTYKEY( WPD_CONTACT_PHONETIC_LAST_NAME , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 9 ); -// -// WPD_CONTACT_PERSONAL_FULL_POSTAL_ADDRESS -// [ VT_LPWSTR ] Indicates the full postal address of the contact (e.g. "555 Dial Drive, PhoneLand, WA 12345") -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_FULL_POSTAL_ADDRESS , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 10 ); -// -// WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_LINE1 -// [ VT_LPWSTR ] Indicates the first line of a postal address of the contact (e.g. "555 Dial Drive") -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_LINE1 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 11 ); -// -// WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_LINE2 -// [ VT_LPWSTR ] Indicates the second line of a postal address of the contact -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_LINE2 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 12 ); -// -// WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_CITY -// [ VT_LPWSTR ] Indicates the city of a postal address of the contact (e.g. "PhoneLand") -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_CITY , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 13 ); -// -// WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_REGION -// [ VT_LPWSTR ] Indicates the region of a postal address of the contact -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_REGION , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 14 ); -// -// WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_POSTAL_CODE -// [ VT_LPWSTR ] Indicates the postal code of the address. -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_POSTAL_CODE , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 15 ); -// -// WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_COUNTRY -// [ VT_LPWSTR ] -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_COUNTRY , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 16 ); -// -// WPD_CONTACT_BUSINESS_FULL_POSTAL_ADDRESS -// [ VT_LPWSTR ] Indicates the full postal address of the contact (e.g. "555 Dial Drive, PhoneLand, WA 12345") -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_FULL_POSTAL_ADDRESS , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 17 ); -// -// WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_LINE1 -// [ VT_LPWSTR ] Indicates the first line of a postal address of the contact (e.g. "555 Dial Drive") -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_LINE1 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 18 ); -// -// WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_LINE2 -// [ VT_LPWSTR ] Indicates the second line of a postal address of the contact -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_LINE2 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 19 ); -// -// WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_CITY -// [ VT_LPWSTR ] Indicates the city of a postal address of the contact (e.g. "PhoneLand") -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_CITY , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 20 ); -// -// WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_REGION -// [ VT_LPWSTR ] Indicates the region of a postal address of the contact -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_REGION , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 21 ); -// -// WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_POSTAL_CODE -// [ VT_LPWSTR ] Indicates the postal code of the address. -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_POSTAL_CODE , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 22 ); -// -// WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_COUNTRY -// [ VT_LPWSTR ] -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_COUNTRY , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 23 ); -// -// WPD_CONTACT_OTHER_FULL_POSTAL_ADDRESS -// [ VT_LPWSTR ] Indicates the full postal address of the contact (e.g. "555 Dial Drive, PhoneLand, WA 12345"). -DEFINE_PROPERTYKEY( WPD_CONTACT_OTHER_FULL_POSTAL_ADDRESS , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 24 ); -// -// WPD_CONTACT_OTHER_POSTAL_ADDRESS_LINE1 -// [ VT_LPWSTR ] Indicates the first line of a postal address of the contact (e.g. "555 Dial Drive"). -DEFINE_PROPERTYKEY( WPD_CONTACT_OTHER_POSTAL_ADDRESS_LINE1 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 25 ); -// -// WPD_CONTACT_OTHER_POSTAL_ADDRESS_LINE2 -// [ VT_LPWSTR ] Indicates the second line of a postal address of the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_OTHER_POSTAL_ADDRESS_LINE2 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 26 ); -// -// WPD_CONTACT_OTHER_POSTAL_ADDRESS_CITY -// [ VT_LPWSTR ] Indicates the city of a postal address of the contact (e.g. "PhoneLand"). -DEFINE_PROPERTYKEY( WPD_CONTACT_OTHER_POSTAL_ADDRESS_CITY , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 27 ); -// -// WPD_CONTACT_OTHER_POSTAL_ADDRESS_REGION -// [ VT_LPWSTR ] Indicates the region of a postal address of the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_OTHER_POSTAL_ADDRESS_REGION , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 28 ); -// -// WPD_CONTACT_OTHER_POSTAL_ADDRESS_POSTAL_CODE -// [ VT_LPWSTR ] Indicates the postal code of the address. -DEFINE_PROPERTYKEY( WPD_CONTACT_OTHER_POSTAL_ADDRESS_POSTAL_CODE , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 29 ); -// -// WPD_CONTACT_OTHER_POSTAL_ADDRESS_POSTAL_COUNTRY -// [ VT_LPWSTR ] Indicates the country of the postal address. -DEFINE_PROPERTYKEY( WPD_CONTACT_OTHER_POSTAL_ADDRESS_POSTAL_COUNTRY , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 30 ); -// -// WPD_CONTACT_PRIMARY_EMAIL_ADDRESS -// [ VT_LPWSTR ] Indicates the primary email address for the contact e.g. "someone@example.com" -DEFINE_PROPERTYKEY( WPD_CONTACT_PRIMARY_EMAIL_ADDRESS , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 31 ); -// -// WPD_CONTACT_PERSONAL_EMAIL -// [ VT_LPWSTR ] Indicates the personal email address for the contact e.g. "someone@example.com" -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_EMAIL , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 32 ); -// -// WPD_CONTACT_PERSONAL_EMAIL2 -// [ VT_LPWSTR ] Indicates an alternate personal email address for the contact e.g. "someone@example.com" -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_EMAIL2 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 33 ); -// -// WPD_CONTACT_BUSINESS_EMAIL -// [ VT_LPWSTR ] Indicates the business email address for the contact e.g. "someone@example.com" -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_EMAIL , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 34 ); -// -// WPD_CONTACT_BUSINESS_EMAIL2 -// [ VT_LPWSTR ] Indicates an alternate business email address for the contact e.g. "someone@example.com" -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_EMAIL2 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 35 ); -// -// WPD_CONTACT_OTHER_EMAILS -// [ VT_UNKNOWN ] An IPortableDevicePropVariantCollection of type VT_LPWSTR, where each element is an alternate email addresses for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_OTHER_EMAILS , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 36 ); -// -// WPD_CONTACT_PRIMARY_PHONE -// [ VT_LPWSTR ] Indicates the primary phone number for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_PRIMARY_PHONE , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 37 ); -// -// WPD_CONTACT_PERSONAL_PHONE -// [ VT_LPWSTR ] Indicates the personal phone number for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_PHONE , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 38 ); -// -// WPD_CONTACT_PERSONAL_PHONE2 -// [ VT_LPWSTR ] Indicates an alternate personal phone number for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_PHONE2 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 39 ); -// -// WPD_CONTACT_BUSINESS_PHONE -// [ VT_LPWSTR ] Indicates the business phone number for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_PHONE , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 40 ); -// -// WPD_CONTACT_BUSINESS_PHONE2 -// [ VT_LPWSTR ] Indicates an alternate business phone number for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_PHONE2 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 41 ); -// -// WPD_CONTACT_MOBILE_PHONE -// [ VT_LPWSTR ] Indicates the mobile phone number for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_MOBILE_PHONE , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 42 ); -// -// WPD_CONTACT_MOBILE_PHONE2 -// [ VT_LPWSTR ] Indicates an alternate mobile phone number for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_MOBILE_PHONE2 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 43 ); -// -// WPD_CONTACT_PERSONAL_FAX -// [ VT_LPWSTR ] Indicates the personal fax number for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_FAX , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 44 ); -// -// WPD_CONTACT_BUSINESS_FAX -// [ VT_LPWSTR ] Indicates the business fax number for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_FAX , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 45 ); -// -// WPD_CONTACT_PAGER -// [ VT_LPWSTR ] Indicates the pager number for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_PAGER , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 46 ); -// -// WPD_CONTACT_OTHER_PHONES -// [ VT_UNKNOWN ] An IPortableDevicePropVariantCollection of type VT_LPWSTR, where each element is an alternate phone number for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_OTHER_PHONES , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 47 ); -// -// WPD_CONTACT_PRIMARY_WEB_ADDRESS -// [ VT_LPWSTR ] Indicates the primary web address for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_PRIMARY_WEB_ADDRESS , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 48 ); -// -// WPD_CONTACT_PERSONAL_WEB_ADDRESS -// [ VT_LPWSTR ] Indicates the personal web address for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_PERSONAL_WEB_ADDRESS , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 49 ); -// -// WPD_CONTACT_BUSINESS_WEB_ADDRESS -// [ VT_LPWSTR ] Indicates the business web address for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_BUSINESS_WEB_ADDRESS , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 50 ); -// -// WPD_CONTACT_INSTANT_MESSENGER -// [ VT_LPWSTR ] Indicates the instant messenger address for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_INSTANT_MESSENGER , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 51 ); -// -// WPD_CONTACT_INSTANT_MESSENGER2 -// [ VT_LPWSTR ] Indicates an alternate instant messenger address for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_INSTANT_MESSENGER2 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 52 ); -// -// WPD_CONTACT_INSTANT_MESSENGER3 -// [ VT_LPWSTR ] Indicates an alternate instant messenger address for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_INSTANT_MESSENGER3 , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 53 ); -// -// WPD_CONTACT_COMPANY_NAME -// [ VT_LPWSTR ] Indicates the company name for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_COMPANY_NAME , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 54 ); -// -// WPD_CONTACT_PHONETIC_COMPANY_NAME -// [ VT_LPWSTR ] The phonetic guide for pronouncing the contact's company name. -DEFINE_PROPERTYKEY( WPD_CONTACT_PHONETIC_COMPANY_NAME , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 55 ); -// -// WPD_CONTACT_ROLE -// [ VT_LPWSTR ] Indicates the role for the contact e.g. "Software Engineer". -DEFINE_PROPERTYKEY( WPD_CONTACT_ROLE , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 56 ); -// -// WPD_CONTACT_BIRTHDATE -// [ VT_DATE ] Indicates the birthdate for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_BIRTHDATE , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 57 ); -// -// WPD_CONTACT_PRIMARY_FAX -// [ VT_LPWSTR ] Indicates the primary fax number for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_PRIMARY_FAX , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 58 ); -// -// WPD_CONTACT_SPOUSE -// [ VT_LPWSTR ] Indicates the full name of the spouse/domestic partner for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_SPOUSE , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 59 ); -// -// WPD_CONTACT_CHILDREN -// [ VT_UNKNOWN ] An IPortableDevicePropVariantCollection of type VT_LPWSTR, where each element is the full name of a child of the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_CHILDREN , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 60 ); -// -// WPD_CONTACT_ASSISTANT -// [ VT_LPWSTR ] Indicates the full name of the assistant for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_ASSISTANT , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 61 ); -// -// WPD_CONTACT_ANNIVERSARY_DATE -// [ VT_DATE ] Indicates the anniversary date for the contact. -DEFINE_PROPERTYKEY( WPD_CONTACT_ANNIVERSARY_DATE , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 62 ); -// -// WPD_CONTACT_RINGTONE -// [ VT_LPWSTR ] Indicates an object id of a ringtone file on the device. -DEFINE_PROPERTYKEY( WPD_CONTACT_RINGTONE , 0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B , 63 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_MUSIC_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all music objects. -****************************************************************************/ -DEFINE_GUID( WPD_MUSIC_OBJECT_PROPERTIES_V1 , 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6 ); - -// -// WPD_MUSIC_ALBUM -// [ VT_LPWSTR ] Indicates the album of the music file. -DEFINE_PROPERTYKEY( WPD_MUSIC_ALBUM , 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6 , 3 ); -// -// WPD_MUSIC_TRACK -// [ VT_UI4 ] Indicates the track number for the music file. -DEFINE_PROPERTYKEY( WPD_MUSIC_TRACK , 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6 , 4 ); -// -// WPD_MUSIC_LYRICS -// [ VT_LPWSTR ] Indicates the lyrics for the music file. -DEFINE_PROPERTYKEY( WPD_MUSIC_LYRICS , 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6 , 6 ); -// -// WPD_MUSIC_MOOD -// [ VT_LPWSTR ] Indicates the mood for the music file. -DEFINE_PROPERTYKEY( WPD_MUSIC_MOOD , 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6 , 8 ); -// -// WPD_AUDIO_BITRATE -// [ VT_UI4 ] Indicates the bit rate for the audio data, specified in bits per second. -DEFINE_PROPERTYKEY( WPD_AUDIO_BITRATE , 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6 , 9 ); -// -// WPD_AUDIO_CHANNEL_COUNT -// [ VT_R4 ] Indicates the number of channels in this audio file e.g. 1, 2, 5.1 etc. -DEFINE_PROPERTYKEY( WPD_AUDIO_CHANNEL_COUNT , 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6 , 10 ); -// -// WPD_AUDIO_FORMAT_CODE -// [ VT_UI4 ] Indicates the registered WAVE format code. -DEFINE_PROPERTYKEY( WPD_AUDIO_FORMAT_CODE , 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6 , 11 ); -// -// WPD_AUDIO_BIT_DEPTH -// [ VT_UI4 ] This property identifies the bit-depth of the audio. -DEFINE_PROPERTYKEY( WPD_AUDIO_BIT_DEPTH , 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6 , 12 ); -// -// WPD_AUDIO_BLOCK_ALIGNMENT -// [ VT_UI4 ] This property identifies the audio block alignment -DEFINE_PROPERTYKEY( WPD_AUDIO_BLOCK_ALIGNMENT , 0xB324F56A, 0xDC5D, 0x46E5, 0xB6, 0xDF, 0xD2, 0xEA, 0x41, 0x48, 0x88, 0xC6 , 13 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_VIDEO_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all video objects. -****************************************************************************/ -DEFINE_GUID( WPD_VIDEO_OBJECT_PROPERTIES_V1 , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A ); - -// -// WPD_VIDEO_AUTHOR -// [ VT_LPWSTR ] Indicates the author of the video file. -DEFINE_PROPERTYKEY( WPD_VIDEO_AUTHOR , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A , 2 ); -// -// WPD_VIDEO_RECORDEDTV_STATION_NAME -// [ VT_LPWSTR ] Indicates the TV station the video was recorded from. -DEFINE_PROPERTYKEY( WPD_VIDEO_RECORDEDTV_STATION_NAME , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A , 4 ); -// -// WPD_VIDEO_RECORDEDTV_CHANNEL_NUMBER -// [ VT_UI4 ] Indicates the TV channel number the video was recorded from. -DEFINE_PROPERTYKEY( WPD_VIDEO_RECORDEDTV_CHANNEL_NUMBER , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A , 5 ); -// -// WPD_VIDEO_RECORDEDTV_REPEAT -// [ VT_BOOL ] Indicates whether the recorded TV program was a repeat showing. -DEFINE_PROPERTYKEY( WPD_VIDEO_RECORDEDTV_REPEAT , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A , 7 ); -// -// WPD_VIDEO_BUFFER_SIZE -// [ VT_UI4 ] Indicates the video buffer size. -DEFINE_PROPERTYKEY( WPD_VIDEO_BUFFER_SIZE , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A , 8 ); -// -// WPD_VIDEO_CREDITS -// [ VT_LPWSTR ] Indicates the credit text for the video file. -DEFINE_PROPERTYKEY( WPD_VIDEO_CREDITS , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A , 9 ); -// -// WPD_VIDEO_KEY_FRAME_DISTANCE -// [ VT_UI4 ] Indicates the interval between key frames in milliseconds. -DEFINE_PROPERTYKEY( WPD_VIDEO_KEY_FRAME_DISTANCE , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A , 10 ); -// -// WPD_VIDEO_QUALITY_SETTING -// [ VT_UI4 ] Indicates the quality setting for the video file. -DEFINE_PROPERTYKEY( WPD_VIDEO_QUALITY_SETTING , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A , 11 ); -// -// WPD_VIDEO_SCAN_TYPE -// [ VT_UI4 ] This property identifies the video scan information. -DEFINE_PROPERTYKEY( WPD_VIDEO_SCAN_TYPE , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A , 12 ); -// -// WPD_VIDEO_BITRATE -// [ VT_UI4 ] Indicates the bitrate for the video data. -DEFINE_PROPERTYKEY( WPD_VIDEO_BITRATE , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A , 13 ); -// -// WPD_VIDEO_FOURCC_CODE -// [ VT_UI4 ] The registered FourCC code indicating the codec used for the video file. -DEFINE_PROPERTYKEY( WPD_VIDEO_FOURCC_CODE , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A , 14 ); -// -// WPD_VIDEO_FRAMERATE -// [ VT_UI4 ] Indicates the frame rate for the video data. -DEFINE_PROPERTYKEY( WPD_VIDEO_FRAMERATE , 0x346F2163, 0xF998, 0x4146, 0x8B, 0x01, 0xD1, 0x9B, 0x4C, 0x00, 0xDE, 0x9A , 15 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_COMMON_INFORMATION_OBJECT_PROPERTIES_V1 -* -* This category is properties that pertain to informational objects such as appointments, tasks, memos and even documents. -****************************************************************************/ -DEFINE_GUID( WPD_COMMON_INFORMATION_OBJECT_PROPERTIES_V1 , 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F ); - -// -// WPD_COMMON_INFORMATION_SUBJECT -// [ VT_LPWSTR ] Indicates the subject field of this object. -DEFINE_PROPERTYKEY( WPD_COMMON_INFORMATION_SUBJECT , 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F , 2 ); -// -// WPD_COMMON_INFORMATION_BODY_TEXT -// [ VT_LPWSTR ] This property contains the body text of an object, in plaintext or HTML format. -DEFINE_PROPERTYKEY( WPD_COMMON_INFORMATION_BODY_TEXT , 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F , 3 ); -// -// WPD_COMMON_INFORMATION_PRIORITY -// [ VT_UI4 ] Indicates the priority of this object. -DEFINE_PROPERTYKEY( WPD_COMMON_INFORMATION_PRIORITY , 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F , 4 ); -// -// WPD_COMMON_INFORMATION_START_DATETIME -// [ VT_DATE ] For appointments, tasks and similar objects, this indicates the date/time that this item is scheduled to start. -DEFINE_PROPERTYKEY( WPD_COMMON_INFORMATION_START_DATETIME , 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F , 5 ); -// -// WPD_COMMON_INFORMATION_END_DATETIME -// [ VT_DATE ] For appointments, tasks and similar objects, this indicates the date/time that this item is scheduled to end. -DEFINE_PROPERTYKEY( WPD_COMMON_INFORMATION_END_DATETIME , 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F , 6 ); -// -// WPD_COMMON_INFORMATION_NOTES -// [ VT_LPWSTR ] For appointments, tasks and similar objects, this indicates any notes for this object. -DEFINE_PROPERTYKEY( WPD_COMMON_INFORMATION_NOTES , 0xB28AE94B, 0x05A4, 0x4E8E, 0xBE, 0x01, 0x72, 0xCC, 0x7E, 0x09, 0x9D, 0x8F , 7); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_MEMO_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all memo objects. -****************************************************************************/ -DEFINE_GUID( WPD_MEMO_OBJECT_PROPERTIES_V1 , 0x5FFBFC7B, 0x7483, 0x41AD, 0xAF, 0xB9, 0xDA, 0x3F, 0x4E, 0x59, 0x2B, 0x8D ); - - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_EMAIL_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all email objects. -****************************************************************************/ -DEFINE_GUID( WPD_EMAIL_OBJECT_PROPERTIES_V1 , 0x41F8F65A, 0x5484, 0x4782, 0xB1, 0x3D, 0x47, 0x40, 0xDD, 0x7C, 0x37, 0xC5 ); - -// -// WPD_EMAIL_TO_LINE -// [ VT_LPWSTR ] Indicates the normal recipients for the message. -DEFINE_PROPERTYKEY( WPD_EMAIL_TO_LINE , 0x41F8F65A, 0x5484, 0x4782, 0xB1, 0x3D, 0x47, 0x40, 0xDD, 0x7C, 0x37, 0xC5 , 2 ); -// -// WPD_EMAIL_CC_LINE -// [ VT_LPWSTR ] Indicates the copied recipients for the message. -DEFINE_PROPERTYKEY( WPD_EMAIL_CC_LINE , 0x41F8F65A, 0x5484, 0x4782, 0xB1, 0x3D, 0x47, 0x40, 0xDD, 0x7C, 0x37, 0xC5 , 3 ); -// -// WPD_EMAIL_BCC_LINE -// [ VT_LPWSTR ] Indicates the recipients for the message who receive a "blind copy". -DEFINE_PROPERTYKEY( WPD_EMAIL_BCC_LINE , 0x41F8F65A, 0x5484, 0x4782, 0xB1, 0x3D, 0x47, 0x40, 0xDD, 0x7C, 0x37, 0xC5 , 4 ); -// -// WPD_EMAIL_HAS_BEEN_READ -// [ VT_BOOL ] Indicates whether the user has read this message. -DEFINE_PROPERTYKEY( WPD_EMAIL_HAS_BEEN_READ , 0x41F8F65A, 0x5484, 0x4782, 0xB1, 0x3D, 0x47, 0x40, 0xDD, 0x7C, 0x37, 0xC5 , 7 ); -// -// WPD_EMAIL_RECEIVED_TIME -// [ VT_DATE ] Indicates at what time the message was received. -DEFINE_PROPERTYKEY( WPD_EMAIL_RECEIVED_TIME , 0x41F8F65A, 0x5484, 0x4782, 0xB1, 0x3D, 0x47, 0x40, 0xDD, 0x7C, 0x37, 0xC5 , 8 ); -// -// WPD_EMAIL_HAS_ATTACHMENTS -// [ VT_BOOL ] Indicates whether this message has attachments. -DEFINE_PROPERTYKEY( WPD_EMAIL_HAS_ATTACHMENTS , 0x41F8F65A, 0x5484, 0x4782, 0xB1, 0x3D, 0x47, 0x40, 0xDD, 0x7C, 0x37, 0xC5 , 9 ); -// -// WPD_EMAIL_SENDER_ADDRESS -// [ VT_LPWSTR ] Indicates who sent the message. -DEFINE_PROPERTYKEY( WPD_EMAIL_SENDER_ADDRESS , 0x41F8F65A, 0x5484, 0x4782, 0xB1, 0x3D, 0x47, 0x40, 0xDD, 0x7C, 0x37, 0xC5 , 10 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_APPOINTMENT_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all appointment objects. -****************************************************************************/ -DEFINE_GUID( WPD_APPOINTMENT_OBJECT_PROPERTIES_V1 , 0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3 ); - -// -// WPD_APPOINTMENT_LOCATION -// [ VT_LPWSTR ] Indicates the location of the appointment e.g. "Building 5, Conf. room 7". -DEFINE_PROPERTYKEY( WPD_APPOINTMENT_LOCATION , 0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3 , 3 ); -// -// WPD_APPOINTMENT_TYPE -// [ VT_LPWSTR ] Indicates the type of appointment e.g. "Personal", "Business" etc. -DEFINE_PROPERTYKEY( WPD_APPOINTMENT_TYPE , 0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3 , 7 ); -// -// WPD_APPOINTMENT_REQUIRED_ATTENDEES -// [ VT_LPWSTR ] Semi-colon separated list of required attendees. -DEFINE_PROPERTYKEY( WPD_APPOINTMENT_REQUIRED_ATTENDEES , 0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3 , 8 ); -// -// WPD_APPOINTMENT_OPTIONAL_ATTENDEES -// [ VT_LPWSTR ] Semi-colon separated list of optional attendees. -DEFINE_PROPERTYKEY( WPD_APPOINTMENT_OPTIONAL_ATTENDEES , 0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3 , 9 ); -// -// WPD_APPOINTMENT_ACCEPTED_ATTENDEES -// [ VT_LPWSTR ] Semi-colon separated list of attendees who have accepted the appointment. -DEFINE_PROPERTYKEY( WPD_APPOINTMENT_ACCEPTED_ATTENDEES , 0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3 , 10 ); -// -// WPD_APPOINTMENT_RESOURCES -// [ VT_LPWSTR ] Semi-colon separated list of resources needed for the appointment. -DEFINE_PROPERTYKEY( WPD_APPOINTMENT_RESOURCES , 0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3 , 11 ); -// -// WPD_APPOINTMENT_TENTATIVE_ATTENDEES -// [ VT_LPWSTR ] Semi-colon separated list of attendees who have tentatively accepted the appointment. -DEFINE_PROPERTYKEY( WPD_APPOINTMENT_TENTATIVE_ATTENDEES , 0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3 , 12 ); -// -// WPD_APPOINTMENT_DECLINED_ATTENDEES -// [ VT_LPWSTR ] Semi-colon separated list of attendees who have declined the appointment. -DEFINE_PROPERTYKEY( WPD_APPOINTMENT_DECLINED_ATTENDEES , 0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3 , 13 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_TASK_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all task objects. -****************************************************************************/ -DEFINE_GUID( WPD_TASK_OBJECT_PROPERTIES_V1 , 0xE354E95E, 0xD8A0, 0x4637, 0xA0, 0x3A, 0x0C, 0xB2, 0x68, 0x38, 0xDB, 0xC7 ); - -// -// WPD_TASK_STATUS -// [ VT_LPWSTR ] Indicates the status of the task e.g. "In Progress". -DEFINE_PROPERTYKEY( WPD_TASK_STATUS , 0xE354E95E, 0xD8A0, 0x4637, 0xA0, 0x3A, 0x0C, 0xB2, 0x68, 0x38, 0xDB, 0xC7 , 6 ); -// -// WPD_TASK_PERCENT_COMPLETE -// [ VT_UI4 ] Indicates how much of the task has been completed. -DEFINE_PROPERTYKEY( WPD_TASK_PERCENT_COMPLETE , 0xE354E95E, 0xD8A0, 0x4637, 0xA0, 0x3A, 0x0C, 0xB2, 0x68, 0x38, 0xDB, 0xC7 , 8 ); -// -// WPD_TASK_REMINDER_DATE -// [ VT_DATE ] Indicates the date and time set for the reminder. If this value is 0, then it is assumed that this task has no reminder. -DEFINE_PROPERTYKEY( WPD_TASK_REMINDER_DATE , 0xE354E95E, 0xD8A0, 0x4637, 0xA0, 0x3A, 0x0C, 0xB2, 0x68, 0x38, 0xDB, 0xC7 , 10 ); -// -// WPD_TASK_OWNER -// [ VT_LPWSTR ] Indicates the owner of the task. -DEFINE_PROPERTYKEY( WPD_TASK_OWNER , 0xE354E95E, 0xD8A0, 0x4637, 0xA0, 0x3A, 0x0C, 0xB2, 0x68, 0x38, 0xDB, 0xC7 , 11 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_NETWORK_ASSOCIATION_PROPERTIES_V1 -* -* This category is for properties common to all network association objects. -****************************************************************************/ -DEFINE_GUID( WPD_NETWORK_ASSOCIATION_PROPERTIES_V1 , 0xE4C93C1F, 0xB203, 0x43F1, 0xA1, 0x00, 0x5A, 0x07, 0xD1, 0x1B, 0x02, 0x74 ); - -// -// WPD_NETWORK_ASSOCIATION_HOST_NETWORK_IDENTIFIERS -// [ VT_VECTOR | VT_UI1 ] The list of EUI-64 host identifiers valid for this association. -DEFINE_PROPERTYKEY( WPD_NETWORK_ASSOCIATION_HOST_NETWORK_IDENTIFIERS , 0xE4C93C1F, 0xB203, 0x43F1, 0xA1, 0x00, 0x5A, 0x07, 0xD1, 0x1B, 0x02, 0x74 , 2 ); -// -// WPD_NETWORK_ASSOCIATION_X509V3SEQUENCE -// [ VT_VECTOR | VT_UI1 ] The sequence of X.509 v3 certificates to be provided for TLS server authentication. -DEFINE_PROPERTYKEY( WPD_NETWORK_ASSOCIATION_X509V3SEQUENCE , 0xE4C93C1F, 0xB203, 0x43F1, 0xA1, 0x00, 0x5A, 0x07, 0xD1, 0x1B, 0x02, 0x74 , 3 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_STILL_IMAGE_CAPTURE_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all objects whose functional category is WPD_FUNCTIONAL_CATEGORY_STILL_IMAGE_CAPTURE -****************************************************************************/ -DEFINE_GUID( WPD_STILL_IMAGE_CAPTURE_OBJECT_PROPERTIES_V1 , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 ); - -// -// WPD_STILL_IMAGE_CAPTURE_RESOLUTION -// [ VT_LPWSTR ] Controls the size of the image dimensions to capture in pixel width and height. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_CAPTURE_RESOLUTION , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 2 ); -// -// WPD_STILL_IMAGE_CAPTURE_FORMAT -// [ VT_CLSID ] Controls the format of the image to capture. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_CAPTURE_FORMAT , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 3 ); -// -// WPD_STILL_IMAGE_COMPRESSION_SETTING -// [ VT_UI8 ] Controls the device-specific quality setting. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_COMPRESSION_SETTING , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 4 ); -// -// WPD_STILL_IMAGE_WHITE_BALANCE -// [ VT_UI4 ] Controls how the device weights color channels. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_WHITE_BALANCE , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 5 ); -// -// WPD_STILL_IMAGE_RGB_GAIN -// [ VT_LPWSTR ] Controls the RGB gain. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_RGB_GAIN , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 6 ); -// -// WPD_STILL_IMAGE_FNUMBER -// [ VT_UI4 ] Controls the aperture of the lens. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_FNUMBER , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 7 ); -// -// WPD_STILL_IMAGE_FOCAL_LENGTH -// [ VT_UI4 ] Controls the 35mm equivalent focal length. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_FOCAL_LENGTH , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 8 ); -// -// WPD_STILL_IMAGE_FOCUS_DISTANCE -// [ VT_UI4 ] This property corresponds to the focus distance in millimeters -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_FOCUS_DISTANCE , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 9 ); -// -// WPD_STILL_IMAGE_FOCUS_MODE -// [ VT_UI4 ] Identifies the focusing mode used by the device for image capture. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_FOCUS_MODE , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 10 ); -// -// WPD_STILL_IMAGE_EXPOSURE_METERING_MODE -// [ VT_UI4 ] Identifies the exposure metering mode used by the device for image capture. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_EXPOSURE_METERING_MODE , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 11 ); -// -// WPD_STILL_IMAGE_FLASH_MODE -// [ VT_UI4 ] -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_FLASH_MODE , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 12 ); -// -// WPD_STILL_IMAGE_EXPOSURE_TIME -// [ VT_UI4 ] Controls the shutter speed of the device. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_EXPOSURE_TIME , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 13 ); -// -// WPD_STILL_IMAGE_EXPOSURE_PROGRAM_MODE -// [ VT_UI4 ] Controls the exposure program mode of the device. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_EXPOSURE_PROGRAM_MODE , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 14 ); -// -// WPD_STILL_IMAGE_EXPOSURE_INDEX -// [ VT_UI4 ] Controls the emulation of film speed settings. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_EXPOSURE_INDEX , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 15 ); -// -// WPD_STILL_IMAGE_EXPOSURE_BIAS_COMPENSATION -// [ VT_I4 ] Controls the adjustment of the auto exposure control. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_EXPOSURE_BIAS_COMPENSATION , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 16 ); -// -// WPD_STILL_IMAGE_CAPTURE_DELAY -// [ VT_UI4 ] Controls the amount of time delay between the capture trigger and the actual data capture (in milliseconds). -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_CAPTURE_DELAY , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 17 ); -// -// WPD_STILL_IMAGE_CAPTURE_MODE -// [ VT_UI4 ] Controls the type of still image capture. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_CAPTURE_MODE , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 18 ); -// -// WPD_STILL_IMAGE_CONTRAST -// [ VT_UI4 ] Controls the perceived contrast of captured images. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_CONTRAST , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 19 ); -// -// WPD_STILL_IMAGE_SHARPNESS -// [ VT_UI4 ] Controls the perceived sharpness of the captured image. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_SHARPNESS , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 20 ); -// -// WPD_STILL_IMAGE_DIGITAL_ZOOM -// [ VT_UI4 ] Controls the effective zoom ratio of a digital camera's acquired image scaled by a factor of 10. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_DIGITAL_ZOOM , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 21 ); -// -// WPD_STILL_IMAGE_EFFECT_MODE -// [ VT_UI4 ] Controls the special effect mode of the capture. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_EFFECT_MODE , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 22 ); -// -// WPD_STILL_IMAGE_BURST_NUMBER -// [ VT_UI4 ] Controls the number of images that the device will attempt to capture upon initiation of a burst operation. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_BURST_NUMBER , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 23 ); -// -// WPD_STILL_IMAGE_BURST_INTERVAL -// [ VT_UI4 ] Controls the time delay between captures upon initiation of a burst operation. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_BURST_INTERVAL , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 24 ); -// -// WPD_STILL_IMAGE_TIMELAPSE_NUMBER -// [ VT_UI4 ] Controls the number of images that the device will attempt to capture upon initiation of a time-lapse capture. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_TIMELAPSE_NUMBER , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 25 ); -// -// WPD_STILL_IMAGE_TIMELAPSE_INTERVAL -// [ VT_UI4 ] Controls the time delay between captures upon initiation of a time-lapse operation. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_TIMELAPSE_INTERVAL , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 26 ); -// -// WPD_STILL_IMAGE_FOCUS_METERING_MODE -// [ VT_UI4 ] Controls which automatic focus mechanism is used by the device. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_FOCUS_METERING_MODE , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 27 ); -// -// WPD_STILL_IMAGE_UPLOAD_URL -// [ VT_LPWSTR ] Used to describe the URL that the device may use to upload images upon capture. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_UPLOAD_URL , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 28 ); -// -// WPD_STILL_IMAGE_ARTIST -// [ VT_LPWSTR ] Contains the owner/user of the device, which may be inserted as meta-data into any images that are captured. -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_ARTIST , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 29 ); -// -// WPD_STILL_IMAGE_CAMERA_MODEL -// [ VT_LPWSTR ] Contains the model of the device -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_CAMERA_MODEL , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 30 ); -// -// WPD_STILL_IMAGE_CAMERA_MANUFACTURER -// [ VT_LPWSTR ] Contains the manufacturer of the device -DEFINE_PROPERTYKEY( WPD_STILL_IMAGE_CAMERA_MANUFACTURER , 0x58C571EC, 0x1BCB, 0x42A7, 0x8A, 0xC5, 0xBB, 0x29, 0x15, 0x73, 0xA2, 0x60 , 31 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_SMS_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all objects whose functional category is WPD_FUNCTIONAL_CATEGORY_SMS -****************************************************************************/ -DEFINE_GUID( WPD_SMS_OBJECT_PROPERTIES_V1 , 0x7E1074CC, 0x50FF, 0x4DD1, 0xA7, 0x42, 0x53, 0xBE, 0x6F, 0x09, 0x3A, 0x0D ); - -// -// WPD_SMS_PROVIDER -// [ VT_LPWSTR ] Indicates the service provider name. -DEFINE_PROPERTYKEY( WPD_SMS_PROVIDER , 0x7E1074CC, 0x50FF, 0x4DD1, 0xA7, 0x42, 0x53, 0xBE, 0x6F, 0x09, 0x3A, 0x0D , 2 ); -// -// WPD_SMS_TIMEOUT -// [ VT_UI4 ] Indicates the number of milliseconds until a timeout is returned. -DEFINE_PROPERTYKEY( WPD_SMS_TIMEOUT , 0x7E1074CC, 0x50FF, 0x4DD1, 0xA7, 0x42, 0x53, 0xBE, 0x6F, 0x09, 0x3A, 0x0D , 3 ); -// -// WPD_SMS_MAX_PAYLOAD -// [ VT_UI4 ] Indicates the maximum number of bytes that can be contained in a message. -DEFINE_PROPERTYKEY( WPD_SMS_MAX_PAYLOAD , 0x7E1074CC, 0x50FF, 0x4DD1, 0xA7, 0x42, 0x53, 0xBE, 0x6F, 0x09, 0x3A, 0x0D , 4 ); -// -// WPD_SMS_ENCODING -// [ VT_UI4 ] Indicates how the driver will encode the text message sent by the client. -DEFINE_PROPERTYKEY( WPD_SMS_ENCODING , 0x7E1074CC, 0x50FF, 0x4DD1, 0xA7, 0x42, 0x53, 0xBE, 0x6F, 0x09, 0x3A, 0x0D , 5 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_SECTION_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all objects whose content type is WPD_CONTENT_TYPE_SECTION -****************************************************************************/ -DEFINE_GUID( WPD_SECTION_OBJECT_PROPERTIES_V1 , 0x516AFD2B, 0xC64E, 0x44F0, 0x98, 0xDC, 0xBE, 0xE1, 0xC8, 0x8F, 0x7D, 0x66 ); - -// -// WPD_SECTION_DATA_OFFSET -// [ VT_UI8 ] Indicates the zero-based offset of the data for the referenced object. -DEFINE_PROPERTYKEY( WPD_SECTION_DATA_OFFSET , 0x516AFD2B, 0xC64E, 0x44F0, 0x98, 0xDC, 0xBE, 0xE1, 0xC8, 0x8F, 0x7D, 0x66 , 2 ); -// -// WPD_SECTION_DATA_LENGTH -// [ VT_UI8 ] Indicates the length of data for the referenced object. -DEFINE_PROPERTYKEY( WPD_SECTION_DATA_LENGTH , 0x516AFD2B, 0xC64E, 0x44F0, 0x98, 0xDC, 0xBE, 0xE1, 0xC8, 0x8F, 0x7D, 0x66 , 3 ); -// -// WPD_SECTION_DATA_UNITS -// [ VT_UI4 ] Indicates the units for WPD_SECTION_DATA_OFFSET and WPD_SECTION_DATA_LENGTH properties on this object (e.g. offset in bytes, offset in milliseconds etc.). -DEFINE_PROPERTYKEY( WPD_SECTION_DATA_UNITS , 0x516AFD2B, 0xC64E, 0x44F0, 0x98, 0xDC, 0xBE, 0xE1, 0xC8, 0x8F, 0x7D, 0x66 , 4 ); -// -// WPD_SECTION_DATA_REFERENCED_OBJECT_RESOURCE -// [ VT_UNKNOWN ] This is an IPortableDeviceKeyCollection containing a single value, which is the key identifying the resource on the referenced object which the WPD_SECTION_DATA_OFFSET and WPD_SECTION_DATA_LENGTH apply to. -DEFINE_PROPERTYKEY( WPD_SECTION_DATA_REFERENCED_OBJECT_RESOURCE , 0x516AFD2B, 0xC64E, 0x44F0, 0x98, 0xDC, 0xBE, 0xE1, 0xC8, 0x8F, 0x7D, 0x66 , 5 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_RENDERING_INFORMATION_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all objects whose functional category is WPD_FUNCTIONAL_CATEGORY_AUDIO_RENDERING_INFORMATION -****************************************************************************/ -DEFINE_GUID( WPD_RENDERING_INFORMATION_OBJECT_PROPERTIES_V1 , 0xC53D039F, 0xEE23, 0x4A31, 0x85, 0x90, 0x76, 0x39, 0x87, 0x98, 0x70, 0xB4 ); - -// -// WPD_RENDERING_INFORMATION_PROFILES -// [ VT_UNKNOWN ] IPortableDeviceValuesCollection, where each element indicates the property settings for a supported profile. -DEFINE_PROPERTYKEY( WPD_RENDERING_INFORMATION_PROFILES , 0xC53D039F, 0xEE23, 0x4A31, 0x85, 0x90, 0x76, 0x39, 0x87, 0x98, 0x70, 0xB4 , 2 ); -// -// WPD_RENDERING_INFORMATION_PROFILE_ENTRY_TYPE -// [ VT_UI4 ] Indicates whether a given entry (i.e. an IPortableDeviceValues) in WPD_RENDERING_INFORMATION_PROFILES relates to an Object or a Resource. -DEFINE_PROPERTYKEY( WPD_RENDERING_INFORMATION_PROFILE_ENTRY_TYPE , 0xC53D039F, 0xEE23, 0x4A31, 0x85, 0x90, 0x76, 0x39, 0x87, 0x98, 0x70, 0xB4 , 3 ); -// -// WPD_RENDERING_INFORMATION_PROFILE_ENTRY_CREATABLE_RESOURCES -// [ VT_UNKNOWN ] This is an IPortableDeviceKeyCollection identifying the resources that can be created on an object with this rendering profile. -DEFINE_PROPERTYKEY( WPD_RENDERING_INFORMATION_PROFILE_ENTRY_CREATABLE_RESOURCES , 0xC53D039F, 0xEE23, 0x4A31, 0x85, 0x90, 0x76, 0x39, 0x87, 0x98, 0x70, 0xB4 , 4 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_STORAGE -* -* This category is for commands and parameters for storage functional objects. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_STORAGE , 0xD8F907A6, 0x34CC, 0x45FA, 0x97, 0xFB, 0xD0, 0x07, 0xFA, 0x47, 0xEC, 0x94 ); - -// ======== Commands ======== - -// -// WPD_COMMAND_STORAGE_FORMAT -// This command will format the storage. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_STORAGE_OBJECT_ID -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_STORAGE_FORMAT , 0xD8F907A6, 0x34CC, 0x45FA, 0x97, 0xFB, 0xD0, 0x07, 0xFA, 0x47, 0xEC, 0x94 , 2 ); -// -// WPD_COMMAND_STORAGE_EJECT -// This will eject the storage, if it is a removable store and is capable of being ejected by the device. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_STORAGE_OBJECT_ID -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_STORAGE_EJECT , 0xD8F907A6, 0x34CC, 0x45FA, 0x97, 0xFB, 0xD0, 0x07, 0xFA, 0x47, 0xEC, 0x94 , 4 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_STORAGE_OBJECT_ID -// [ VT_LPWSTR ] Indicates the object to format, move or eject. -DEFINE_PROPERTYKEY( WPD_PROPERTY_STORAGE_OBJECT_ID , 0xD8F907A6, 0x34CC, 0x45FA, 0x97, 0xFB, 0xD0, 0x07, 0xFA, 0x47, 0xEC, 0x94 , 1001 ); -// -// WPD_PROPERTY_STORAGE_DESTINATION_OBJECT_ID -// [ VT_LPWSTR ] Indicates the (folder) object destination for a move operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_STORAGE_DESTINATION_OBJECT_ID , 0xD8F907A6, 0x34CC, 0x45FA, 0x97, 0xFB, 0xD0, 0x07, 0xFA, 0x47, 0xEC, 0x94 , 1002 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_SMS -* -* The commands in this category relate to Short-Message-Service functionality, typically exposed on mobile phones. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_SMS , 0xAFC25D66, 0xFE0D, 0x4114, 0x90, 0x97, 0x97, 0x0C, 0x93, 0xE9, 0x20, 0xD1 ); - -// ======== Commands ======== - -// -// WPD_COMMAND_SMS_SEND -// This command is used to initiate the sending of an SMS message. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_COMMON_COMMAND_TARGET -// [ Required ] WPD_PROPERTY_SMS_RECIPIENT -// [ Required ] WPD_PROPERTY_SMS_MESSAGE_TYPE -// [ Optional ] WPD_PROPERTY_SMS_TEXT_MESSAGE -// [ Optional ] WPD_PROPERTY_SMS_BINARY_MESSAGE -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_SMS_SEND , 0xAFC25D66, 0xFE0D, 0x4114, 0x90, 0x97, 0x97, 0x0C, 0x93, 0xE9, 0x20, 0xD1 , 2 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_SMS_RECIPIENT -// [ VT_LPWSTR ] Indicates the recipient's address. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SMS_RECIPIENT , 0xAFC25D66, 0xFE0D, 0x4114, 0x90, 0x97, 0x97, 0x0C, 0x93, 0xE9, 0x20, 0xD1 , 1001 ); -// -// WPD_PROPERTY_SMS_MESSAGE_TYPE -// [ VT_UI4 ] Indicates whether the message is binary or text. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SMS_MESSAGE_TYPE , 0xAFC25D66, 0xFE0D, 0x4114, 0x90, 0x97, 0x97, 0x0C, 0x93, 0xE9, 0x20, 0xD1 , 1002 ); -// -// WPD_PROPERTY_SMS_TEXT_MESSAGE -// [ VT_LPWSTR ] if WPD_PROPERTY_SMS_MESSAGE_TYPE == SMS_TEXT_MESSAGE, then this will contain the message body. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SMS_TEXT_MESSAGE , 0xAFC25D66, 0xFE0D, 0x4114, 0x90, 0x97, 0x97, 0x0C, 0x93, 0xE9, 0x20, 0xD1 , 1003 ); -// -// WPD_PROPERTY_SMS_BINARY_MESSAGE -// [ VT_VECTOR|VT_UI1 ] if WPD_PROPERTY_SMS_MESSAGE_TYPE == SMS_BINARY_MESSAGE, then this will contain the binary message body. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SMS_BINARY_MESSAGE , 0xAFC25D66, 0xFE0D, 0x4114, 0x90, 0x97, 0x97, 0x0C, 0x93, 0xE9, 0x20, 0xD1 , 1004 ); - -// ======== Command Options ======== - -// -// WPD_OPTION_SMS_BINARY_MESSAGE_SUPPORTED -// [ VT_BOOL ] Indicates whether the driver can support binary messages as well as text messages. -DEFINE_PROPERTYKEY( WPD_OPTION_SMS_BINARY_MESSAGE_SUPPORTED , 0xAFC25D66, 0xFE0D, 0x4114, 0x90, 0x97, 0x97, 0x0C, 0x93, 0xE9, 0x20, 0xD1 , 5001 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_STILL_IMAGE_CAPTURE -* -* -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_STILL_IMAGE_CAPTURE , 0x4FCD6982, 0x22A2, 0x4B05, 0xA4, 0x8B, 0x62, 0xD3, 0x8B, 0xF2, 0x7B, 0x32 ); - -// ======== Commands ======== - -// -// WPD_COMMAND_STILL_IMAGE_CAPTURE_INITIATE -// Initiates a still image capture. This is processed as a single command i.e. there is no start or stop required. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_COMMON_COMMAND_TARGET -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_STILL_IMAGE_CAPTURE_INITIATE , 0x4FCD6982, 0x22A2, 0x4B05, 0xA4, 0x8B, 0x62, 0xD3, 0x8B, 0xF2, 0x7B, 0x32 , 2 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_MEDIA_CAPTURE -* -* -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_MEDIA_CAPTURE , 0x59B433BA, 0xFE44, 0x4D8D, 0x80, 0x8C, 0x6B, 0xCB, 0x9B, 0x0F, 0x15, 0xE8 ); - -// ======== Commands ======== - -// -// WPD_COMMAND_MEDIA_CAPTURE_START -// Initiates a media capture operation that will only be ended by a subsequent WPD_COMMAND_MEDIA_CAPTURE_STOP command. Typically used to capture media streams such as audio and video. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_COMMON_COMMAND_TARGET -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_MEDIA_CAPTURE_START , 0x59B433BA, 0xFE44, 0x4D8D, 0x80, 0x8C, 0x6B, 0xCB, 0x9B, 0x0F, 0x15, 0xE8 , 2 ); -// -// WPD_COMMAND_MEDIA_CAPTURE_STOP -// Ends a media capture operation started by a WPD_COMMAND_MEDIA_CAPTURE_START command. Typically used to end capture of media streams such as audio and video. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_COMMON_COMMAND_TARGET -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_MEDIA_CAPTURE_STOP , 0x59B433BA, 0xFE44, 0x4D8D, 0x80, 0x8C, 0x6B, 0xCB, 0x9B, 0x0F, 0x15, 0xE8 , 3 ); -// -// WPD_COMMAND_MEDIA_CAPTURE_PAUSE -// Pauses a media capture operation started by a WPD_COMMAND_MEDIA_CAPTURE_START command. Typically used to pause capture of media streams such as audio and video. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_COMMON_COMMAND_TARGET -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_MEDIA_CAPTURE_PAUSE , 0x59B433BA, 0xFE44, 0x4D8D, 0x80, 0x8C, 0x6B, 0xCB, 0x9B, 0x0F, 0x15, 0xE8 , 4 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_DEVICE_HINTS -* -* The commands in this category relate to hints that a device can provide to improve end-user experience. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_DEVICE_HINTS , 0x0D5FB92B, 0xCB46, 0x4C4F, 0x83, 0x43, 0x0B, 0xC3, 0xD3, 0xF1, 0x7C, 0x84 ); - -// ======== Commands ======== - -// -// WPD_COMMAND_DEVICE_HINTS_GET_CONTENT_LOCATION -// This command is used to retrieve the ObjectIDs of folders that contain the specified content type. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_DEVICE_HINTS_CONTENT_TYPE -// Results: -// [ Required ] WPD_PROPERTY_DEVICE_HINTS_CONTENT_LOCATIONS -DEFINE_PROPERTYKEY( WPD_COMMAND_DEVICE_HINTS_GET_CONTENT_LOCATION , 0x0D5FB92B, 0xCB46, 0x4C4F, 0x83, 0x43, 0x0B, 0xC3, 0xD3, 0xF1, 0x7C, 0x84 , 2 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_DEVICE_HINTS_CONTENT_TYPE -// [ VT_CLSID ] Indicates the WPD content type that the caller is looking for. For example, to get the top-level folder objects that contain images, this parameter would be WPD_CONTENT_TYPE_IMAGE. -DEFINE_PROPERTYKEY( WPD_PROPERTY_DEVICE_HINTS_CONTENT_TYPE , 0x0D5FB92B, 0xCB46, 0x4C4F, 0x83, 0x43, 0x0B, 0xC3, 0xD3, 0xF1, 0x7C, 0x84 , 1001 ); -// -// WPD_PROPERTY_DEVICE_HINTS_CONTENT_LOCATIONS -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection of type VT_LPWSTR indicating a list of folder ObjectIDs. -DEFINE_PROPERTYKEY( WPD_PROPERTY_DEVICE_HINTS_CONTENT_LOCATIONS , 0x0D5FB92B, 0xCB46, 0x4C4F, 0x83, 0x43, 0x0B, 0xC3, 0xD3, 0xF1, 0x7C, 0x84 , 1002 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_NETWORK_CONFIGURATION -* -* The commands in this category are used for Network Association and WiFi Configuration. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_NETWORK_CONFIGURATION , 0x78F9C6FC, 0x79B8, 0x473C, 0x90, 0x60, 0x6B, 0xD2, 0x3D, 0xD0, 0x72, 0xC4 ); - -// ======== Commands ======== - -// -// WPD_COMMAND_GENERATE_KEYPAIR -// Initiates the generation of a public/private key pair and returns the public key. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// None -// Results: -// [ Required ] WPD_PROPERTY_PUBLIC_KEY -DEFINE_PROPERTYKEY( WPD_COMMAND_GENERATE_KEYPAIR , 0x78F9C6FC, 0x79B8, 0x473C, 0x90, 0x60, 0x6B, 0xD2, 0x3D, 0xD0, 0x72, 0xC4 , 2 ); -// -// WPD_COMMAND_COMMIT_KEYPAIR -// Commits a public/private key pair. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// None -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_COMMIT_KEYPAIR , 0x78F9C6FC, 0x79B8, 0x473C, 0x90, 0x60, 0x6B, 0xD2, 0x3D, 0xD0, 0x72, 0xC4 , 3 ); -// -// WPD_COMMAND_PROCESS_WIRELESS_PROFILE -// Initiates the processing of a Wireless Profile file. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_OBJECT_ID -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_PROCESS_WIRELESS_PROFILE , 0x78F9C6FC, 0x79B8, 0x473C, 0x90, 0x60, 0x6B, 0xD2, 0x3D, 0xD0, 0x72, 0xC4 , 4 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_PUBLIC_KEY -// [ VT_VECTOR|VT_UI1 ] A public key generated for RSA key exchange. -DEFINE_PROPERTYKEY( WPD_PROPERTY_PUBLIC_KEY , 0x78F9C6FC, 0x79B8, 0x473C, 0x90, 0x60, 0x6B, 0xD2, 0x3D, 0xD0, 0x72, 0xC4 , 1001 ); - - -#endif // WPD_SERVICES_STRICT - -/**************************************************************************** -* This section defines all Resource keys. Resources are place-holders for -* binary data. -* -****************************************************************************/ -// -// WPD_RESOURCE_DEFAULT -// Represents the entire object's data. There can be only one default resource on an object. -DEFINE_PROPERTYKEY( WPD_RESOURCE_DEFAULT , 0xE81E79BE, 0x34F0, 0x41BF, 0xB5, 0x3F, 0xF1, 0xA0, 0x6A, 0xE8, 0x78, 0x42 , 0 ); -// -// WPD_RESOURCE_CONTACT_PHOTO -// Represents the contact's photo data. -DEFINE_PROPERTYKEY( WPD_RESOURCE_CONTACT_PHOTO , 0x2C4D6803, 0x80EA, 0x4580, 0xAF, 0x9A, 0x5B, 0xE1, 0xA2, 0x3E, 0xDD, 0xCB , 0 ); -// -// WPD_RESOURCE_THUMBNAIL -// Represents the thumbnail data for an object. -DEFINE_PROPERTYKEY( WPD_RESOURCE_THUMBNAIL , 0xC7C407BA, 0x98FA, 0x46B5, 0x99, 0x60, 0x23, 0xFE, 0xC1, 0x24, 0xCF, 0xDE , 0 ); -// -// WPD_RESOURCE_ICON -// Represents the icon data for an object. -DEFINE_PROPERTYKEY( WPD_RESOURCE_ICON , 0xF195FED8, 0xAA28, 0x4EE3, 0xB1, 0x53, 0xE1, 0x82, 0xDD, 0x5E, 0xDC, 0x39 , 0 ); -// -// WPD_RESOURCE_AUDIO_CLIP -// Represents an audio sample data for an object. -DEFINE_PROPERTYKEY( WPD_RESOURCE_AUDIO_CLIP , 0x3BC13982, 0x85B1, 0x48E0, 0x95, 0xA6, 0x8D, 0x3A, 0xD0, 0x6B, 0xE1, 0x17 , 0 ); -// -// WPD_RESOURCE_ALBUM_ART -// Represents the album artwork this media originated from. -DEFINE_PROPERTYKEY( WPD_RESOURCE_ALBUM_ART , 0xF02AA354, 0x2300, 0x4E2D, 0xA1, 0xB9, 0x3B, 0x67, 0x30, 0xF7, 0xFA, 0x21 , 0 ); -// -// WPD_RESOURCE_GENERIC -// Represents an arbitrary binary blob associated with this object. -DEFINE_PROPERTYKEY( WPD_RESOURCE_GENERIC , 0xB9B9F515, 0xBA70, 0x4647, 0x94, 0xDC, 0xFA, 0x49, 0x25, 0xE9, 0x5A, 0x07 , 0 ); -// -// WPD_RESOURCE_VIDEO_CLIP -// Represents a video sample for an object. -DEFINE_PROPERTYKEY( WPD_RESOURCE_VIDEO_CLIP , 0xB566EE42, 0x6368, 0x4290, 0x86, 0x62, 0x70, 0x18, 0x2F, 0xB7, 0x9F, 0x20 , 0 ); -// -// WPD_RESOURCE_BRANDING_ART -// Represents the product branding artwork or logo for an object. This resource is typically found on, but not limited to the device object. -DEFINE_PROPERTYKEY( WPD_RESOURCE_BRANDING_ART , 0xB633B1AE, 0x6CAF, 0x4A87, 0x95, 0x89, 0x22, 0xDE, 0xD6, 0xDD, 0x58, 0x99 , 0 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_NULL -* -* This category is used exclusively for the NULL property key define. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_NULL , 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); - -// -// WPD_PROPERTY_NULL -// [ VT_EMPTY ] A NULL property key. -DEFINE_PROPERTYKEY( WPD_PROPERTY_NULL , 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 , 0 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_FUNCTIONAL_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all functional objects. -****************************************************************************/ -DEFINE_GUID( WPD_FUNCTIONAL_OBJECT_PROPERTIES_V1 , 0x8F052D93, 0xABCA, 0x4FC5, 0xA5, 0xAC, 0xB0, 0x1D, 0xF4, 0xDB, 0xE5, 0x98 ); - -// -// WPD_FUNCTIONAL_OBJECT_CATEGORY -// [ VT_CLSID ] Indicates the object's functional category. -DEFINE_PROPERTYKEY( WPD_FUNCTIONAL_OBJECT_CATEGORY , 0x8F052D93, 0xABCA, 0x4FC5, 0xA5, 0xAC, 0xB0, 0x1D, 0xF4, 0xDB, 0xE5, 0x98 , 2 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_STORAGE_OBJECT_PROPERTIES_V1 -* -* This category is for properties common to all objects whose functional category is WPD_FUNCTIONAL_CATEGORY_STORAGE. -****************************************************************************/ -DEFINE_GUID( WPD_STORAGE_OBJECT_PROPERTIES_V1 , 0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A ); - -// -// WPD_STORAGE_TYPE -// [ VT_UI4 ] Indicates the type of storage e.g. fixed, removable etc. -DEFINE_PROPERTYKEY( WPD_STORAGE_TYPE , 0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A , 2 ); -// -// WPD_STORAGE_FILE_SYSTEM_TYPE -// [ VT_LPWSTR ] Indicates the file system type e.g. "FAT32" or "NTFS" or "My Special File System" -DEFINE_PROPERTYKEY( WPD_STORAGE_FILE_SYSTEM_TYPE , 0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A , 3 ); -// -// WPD_STORAGE_CAPACITY -// [ VT_UI8 ] Indicates the total storage capacity in bytes. -DEFINE_PROPERTYKEY( WPD_STORAGE_CAPACITY , 0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A , 4 ); -// -// WPD_STORAGE_FREE_SPACE_IN_BYTES -// [ VT_UI8 ] Indicates the available space in bytes. -DEFINE_PROPERTYKEY( WPD_STORAGE_FREE_SPACE_IN_BYTES , 0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A , 5 ); -// -// WPD_STORAGE_FREE_SPACE_IN_OBJECTS -// [ VT_UI8 ] Indicates the available space in objects e.g. available slots on a SIM card. -DEFINE_PROPERTYKEY( WPD_STORAGE_FREE_SPACE_IN_OBJECTS , 0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A , 6 ); -// -// WPD_STORAGE_DESCRIPTION -// [ VT_LPWSTR ] Contains a description of the storage. -DEFINE_PROPERTYKEY( WPD_STORAGE_DESCRIPTION , 0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A , 7 ); -// -// WPD_STORAGE_SERIAL_NUMBER -// [ VT_LPWSTR ] Contains the serial number of the storage. -DEFINE_PROPERTYKEY( WPD_STORAGE_SERIAL_NUMBER , 0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A , 8 ); -// -// WPD_STORAGE_MAX_OBJECT_SIZE -// [ VT_UI8 ] Specifies the maximum size of a single object (in bytes) that can be placed on this storage. -DEFINE_PROPERTYKEY( WPD_STORAGE_MAX_OBJECT_SIZE , 0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A , 9 ); -// -// WPD_STORAGE_CAPACITY_IN_OBJECTS -// [ VT_UI8 ] Indicates the total storage capacity in objects e.g. available slots on a SIM card. -DEFINE_PROPERTYKEY( WPD_STORAGE_CAPACITY_IN_OBJECTS , 0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A , 10 ); -// -// WPD_STORAGE_ACCESS_CAPABILITY -// [ VT_UI4 ] This property identifies any write-protection that globally affects this storage. This takes precedence over access specified on individual objects. -DEFINE_PROPERTYKEY( WPD_STORAGE_ACCESS_CAPABILITY , 0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A , 11 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CLIENT_INFORMATION_PROPERTIES_V1 -* -* -****************************************************************************/ -DEFINE_GUID( WPD_CLIENT_INFORMATION_PROPERTIES_V1 , 0x204D9F0C, 0x2292, 0x4080, 0x9F, 0x42, 0x40, 0x66, 0x4E, 0x70, 0xF8, 0x59 ); - -// -// WPD_CLIENT_NAME -// [ VT_LPWSTR ] Specifies the name the client uses to identify itself. -DEFINE_PROPERTYKEY( WPD_CLIENT_NAME , 0x204D9F0C, 0x2292, 0x4080, 0x9F, 0x42, 0x40, 0x66, 0x4E, 0x70, 0xF8, 0x59 , 2 ); -// -// WPD_CLIENT_MAJOR_VERSION -// [ VT_UI4 ] Specifies the major version of the client. -DEFINE_PROPERTYKEY( WPD_CLIENT_MAJOR_VERSION , 0x204D9F0C, 0x2292, 0x4080, 0x9F, 0x42, 0x40, 0x66, 0x4E, 0x70, 0xF8, 0x59 , 3 ); -// -// WPD_CLIENT_MINOR_VERSION -// [ VT_UI4 ] Specifies the major version of the client. -DEFINE_PROPERTYKEY( WPD_CLIENT_MINOR_VERSION , 0x204D9F0C, 0x2292, 0x4080, 0x9F, 0x42, 0x40, 0x66, 0x4E, 0x70, 0xF8, 0x59 , 4 ); -// -// WPD_CLIENT_REVISION -// [ VT_UI4 ] Specifies the revision (or build number) of the client. -DEFINE_PROPERTYKEY( WPD_CLIENT_REVISION , 0x204D9F0C, 0x2292, 0x4080, 0x9F, 0x42, 0x40, 0x66, 0x4E, 0x70, 0xF8, 0x59 , 5 ); -// -// WPD_CLIENT_WMDRM_APPLICATION_PRIVATE_KEY -// [ VT_VECTOR | VT_UI1 ] Specifies the Windows Media DRM application private key of the client. -DEFINE_PROPERTYKEY( WPD_CLIENT_WMDRM_APPLICATION_PRIVATE_KEY , 0x204D9F0C, 0x2292, 0x4080, 0x9F, 0x42, 0x40, 0x66, 0x4E, 0x70, 0xF8, 0x59 , 6 ); -// -// WPD_CLIENT_WMDRM_APPLICATION_CERTIFICATE -// [ VT_VECTOR | VT_UI1 ] Specifies the Windows Media DRM application certificate of the client. -DEFINE_PROPERTYKEY( WPD_CLIENT_WMDRM_APPLICATION_CERTIFICATE , 0x204D9F0C, 0x2292, 0x4080, 0x9F, 0x42, 0x40, 0x66, 0x4E, 0x70, 0xF8, 0x59 , 7 ); -// -// WPD_CLIENT_SECURITY_QUALITY_OF_SERVICE -// [ VT_UI4 ] Specifies the Security Quality of Service for the connection to the driver. This relates to the Security Quality of Service flags for CreateFile. For example, these allow or disallow a driver to impersonate the client. -DEFINE_PROPERTYKEY( WPD_CLIENT_SECURITY_QUALITY_OF_SERVICE , 0x204D9F0C, 0x2292, 0x4080, 0x9F, 0x42, 0x40, 0x66, 0x4E, 0x70, 0xF8, 0x59 , 8 ); -// -// WPD_CLIENT_DESIRED_ACCESS -// [ VT_UI4 ] Specifies the desired access the client is requesting to this driver. The possible values are the same as for CreateFile (e.g. GENERIC_READ, GENERIC_WRITE etc.). -DEFINE_PROPERTYKEY( WPD_CLIENT_DESIRED_ACCESS , 0x204D9F0C, 0x2292, 0x4080, 0x9F, 0x42, 0x40, 0x66, 0x4E, 0x70, 0xF8, 0x59 , 9 ); -// -// WPD_CLIENT_SHARE_MODE -// [ VT_UI4 ] Specifies the share mode the client is requesting to this driver. The possible values are the same as for CreateFile (e.g. FILE_SHARE_READ, FILE_SHARE_WRITE etc.). -DEFINE_PROPERTYKEY( WPD_CLIENT_SHARE_MODE , 0x204D9F0C, 0x2292, 0x4080, 0x9F, 0x42, 0x40, 0x66, 0x4E, 0x70, 0xF8, 0x59 , 10 ); -// -// WPD_CLIENT_EVENT_COOKIE -// [ VT_LPWSTR ] Client supplied cookie returned by the driver in events posted as a direct result of operations issued by this client. -DEFINE_PROPERTYKEY( WPD_CLIENT_EVENT_COOKIE , 0x204D9F0C, 0x2292, 0x4080, 0x9F, 0x42, 0x40, 0x66, 0x4E, 0x70, 0xF8, 0x59 , 11 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_PROPERTY_ATTRIBUTES_V1 -* -* -****************************************************************************/ -DEFINE_GUID( WPD_PROPERTY_ATTRIBUTES_V1 , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 ); - -// -// WPD_PROPERTY_ATTRIBUTE_FORM -// [ VT_UI4 ] Specifies the form of the valid values allowed for this property. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_FORM , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 , 2 ); -// -// WPD_PROPERTY_ATTRIBUTE_CAN_READ -// [ VT_BOOL ] Indicates whether client applications have permission to Read the property. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_CAN_READ , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 , 3 ); -// -// WPD_PROPERTY_ATTRIBUTE_CAN_WRITE -// [ VT_BOOL ] Indicates whether client applications have permission to Write the property. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_CAN_WRITE , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 , 4 ); -// -// WPD_PROPERTY_ATTRIBUTE_CAN_DELETE -// [ VT_BOOL ] Indicates whether client applications have permission to Delete the property. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_CAN_DELETE , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 , 5 ); -// -// WPD_PROPERTY_ATTRIBUTE_DEFAULT_VALUE -// [ VT_XXXX ] Specifies the default value for a write-able property. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_DEFAULT_VALUE , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 , 6 ); -// -// WPD_PROPERTY_ATTRIBUTE_FAST_PROPERTY -// [ VT_BOOL ] If True, then this property belongs to the PORTABLE_DEVICE_FAST_PROPERTIES group. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_FAST_PROPERTY , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 , 7 ); -// -// WPD_PROPERTY_ATTRIBUTE_RANGE_MIN -// [ VT_XXXX ] The minimum value for a property whose form is of WPD_PROPERTY_ATTRIBUTE_FORM_RANGE. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_RANGE_MIN , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 , 8 ); -// -// WPD_PROPERTY_ATTRIBUTE_RANGE_MAX -// [ VT_XXXX ] The maximum value for a property whose form is of WPD_PROPERTY_ATTRIBUTE_FORM_RANGE. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_RANGE_MAX , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 , 9 ); -// -// WPD_PROPERTY_ATTRIBUTE_RANGE_STEP -// [ VT_XXXX ] The step value for a property whose form is of WPD_PROPERTY_ATTRIBUTE_FORM_RANGE. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_RANGE_STEP , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 , 10 ); -// -// WPD_PROPERTY_ATTRIBUTE_ENUMERATION_ELEMENTS -// [ VT_UNKNOWN ] An IPortableDevicePropVariantCollection containing the enumeration values. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_ENUMERATION_ELEMENTS , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 , 11 ); -// -// WPD_PROPERTY_ATTRIBUTE_REGULAR_EXPRESSION -// [ VT_LPWSTR ] A regular expression string indicating acceptable values for properties whose form is WPD_PROPERTY_ATTRIBUTE_FORM_REGULAR_EXPRESSION. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_REGULAR_EXPRESSION , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 , 12 ); -// -// WPD_PROPERTY_ATTRIBUTE_MAX_SIZE -// [ VT_UI8 ] This indicates the maximum size (in bytes) for the value of this property. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_MAX_SIZE , 0xAB7943D8, 0x6332, 0x445F, 0xA0, 0x0D, 0x8D, 0x5E, 0xF1, 0xE9, 0x6F, 0x37 , 13 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_PROPERTY_ATTRIBUTES_V2 -* -* This category defines additional property attributes used by device services. -****************************************************************************/ -DEFINE_GUID( WPD_PROPERTY_ATTRIBUTES_V2 , 0x5D9DA160, 0x74AE, 0x43CC, 0x85, 0xA9, 0xFE, 0x55, 0x5A, 0x80, 0x79, 0x8E ); - -// -// WPD_PROPERTY_ATTRIBUTE_NAME -// [ VT_LPWSTR ] Contains the name of the property. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_NAME , 0x5D9DA160, 0x74AE, 0x43CC, 0x85, 0xA9, 0xFE, 0x55, 0x5A, 0x80, 0x79, 0x8E , 2 ); -// -// WPD_PROPERTY_ATTRIBUTE_VARTYPE -// [ VT_UI4 ] Contains the VARTYPE of the property. -DEFINE_PROPERTYKEY( WPD_PROPERTY_ATTRIBUTE_VARTYPE , 0x5D9DA160, 0x74AE, 0x43CC, 0x85, 0xA9, 0xFE, 0x55, 0x5A, 0x80, 0x79, 0x8E , 3 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CLASS_EXTENSION_OPTIONS_V1 -* -* This category of properties relates to options used for the WPD device class extension -****************************************************************************/ -DEFINE_GUID( WPD_CLASS_EXTENSION_OPTIONS_V1 , 0x6309FFEF, 0xA87C, 0x4CA7, 0x84, 0x34, 0x79, 0x75, 0x76, 0xE4, 0x0A, 0x96 ); - -// -// WPD_CLASS_EXTENSION_OPTIONS_SUPPORTED_CONTENT_TYPES -// [ VT_UNKNOWN ] Indicates the (super-set) list of content types supported by the driver (similar to calling WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_CONTENT_TYPES on WPD_FUNCTIONAL_CATEGORY_ALL). -DEFINE_PROPERTYKEY( WPD_CLASS_EXTENSION_OPTIONS_SUPPORTED_CONTENT_TYPES , 0x6309FFEF, 0xA87C, 0x4CA7, 0x84, 0x34, 0x79, 0x75, 0x76, 0xE4, 0x0A, 0x96 , 2 ); -// -// WPD_CLASS_EXTENSION_OPTIONS_DONT_REGISTER_WPD_DEVICE_INTERFACE -// [ VT_BOOL ] Indicates that the caller does not want the WPD class extension library to register the WPD Device Class interface. The caller will take responsibility for doing it. -DEFINE_PROPERTYKEY( WPD_CLASS_EXTENSION_OPTIONS_DONT_REGISTER_WPD_DEVICE_INTERFACE , 0x6309FFEF, 0xA87C, 0x4CA7, 0x84, 0x34, 0x79, 0x75, 0x76, 0xE4, 0x0A, 0x96 , 3 ); -// -// WPD_CLASS_EXTENSION_OPTIONS_REGISTER_WPD_PRIVATE_DEVICE_INTERFACE -// [ VT_BOOL ] Indicates that the caller wants the WPD class extension library to register the private WPD Device Class interface. -DEFINE_PROPERTYKEY( WPD_CLASS_EXTENSION_OPTIONS_REGISTER_WPD_PRIVATE_DEVICE_INTERFACE , 0x6309FFEF, 0xA87C, 0x4CA7, 0x84, 0x34, 0x79, 0x75, 0x76, 0xE4, 0x0A, 0x96 , 4 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CLASS_EXTENSION_OPTIONS_V2 -* -* This category of properties relates to options used for the WPD device class extension -****************************************************************************/ -DEFINE_GUID( WPD_CLASS_EXTENSION_OPTIONS_V2 , 0X3E3595DA, 0X4D71, 0X49FE, 0XA0, 0XB4, 0XD4, 0X40, 0X6C, 0X3A, 0XE9, 0X3F ); - -// -// WPD_CLASS_EXTENSION_OPTIONS_MULTITRANSPORT_MODE -// [ VT_BOOL ] Indicates that the caller wants the WPD class extension library to go into Multi-Transport mode (if TRUE). -DEFINE_PROPERTYKEY( WPD_CLASS_EXTENSION_OPTIONS_MULTITRANSPORT_MODE , 0X3E3595DA, 0X4D71, 0X49FE, 0XA0, 0XB4, 0XD4, 0X40, 0X6C, 0X3A, 0XE9, 0X3F , 2 ); -// -// WPD_CLASS_EXTENSION_OPTIONS_DEVICE_IDENTIFICATION_VALUES -// [ VT_UNKNOWN ] This is an IPortableDeviceValues which contains the device identification values (WPD_DEVICE_MANUFACTURER, WPD_DEVICE_MODEL, WPD_DEVICE_FIRMWARE_VERSION and WPD_DEVICE_FUNCTIONAL_UNIQUE_ID). Include this with other Class Extension options when initializing. -DEFINE_PROPERTYKEY( WPD_CLASS_EXTENSION_OPTIONS_DEVICE_IDENTIFICATION_VALUES , 0X3E3595DA, 0X4D71, 0X49FE, 0XA0, 0XB4, 0XD4, 0X40, 0X6C, 0X3A, 0XE9, 0X3F , 3 ); -// -// WPD_CLASS_EXTENSION_OPTIONS_TRANSPORT_BANDWIDTH -// [ VT_UI4 ] Indicates the theoretical maximum bandwidth of the transport in kilobits per second. -DEFINE_PROPERTYKEY( WPD_CLASS_EXTENSION_OPTIONS_TRANSPORT_BANDWIDTH , 0X3E3595DA, 0X4D71, 0X49FE, 0XA0, 0XB4, 0XD4, 0X40, 0X6C, 0X3A, 0XE9, 0X3F , 4 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_RESOURCE_ATTRIBUTES_V1 -* -* -****************************************************************************/ -DEFINE_GUID( WPD_RESOURCE_ATTRIBUTES_V1 , 0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6 ); - -// -// WPD_RESOURCE_ATTRIBUTE_TOTAL_SIZE -// [ VT_UI8 ] Total size in bytes of the resource data. -DEFINE_PROPERTYKEY( WPD_RESOURCE_ATTRIBUTE_TOTAL_SIZE , 0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6 , 2 ); -// -// WPD_RESOURCE_ATTRIBUTE_CAN_READ -// [ VT_BOOL ] Indicates whether client applications have permission to open the resource for Read access. -DEFINE_PROPERTYKEY( WPD_RESOURCE_ATTRIBUTE_CAN_READ , 0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6 , 3 ); -// -// WPD_RESOURCE_ATTRIBUTE_CAN_WRITE -// [ VT_BOOL ] Indicates whether client applications have permission to open the resource for Write access. -DEFINE_PROPERTYKEY( WPD_RESOURCE_ATTRIBUTE_CAN_WRITE , 0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6 , 4 ); -// -// WPD_RESOURCE_ATTRIBUTE_CAN_DELETE -// [ VT_BOOL ] Indicates whether client applications have permission to Delete a resource from the device. -DEFINE_PROPERTYKEY( WPD_RESOURCE_ATTRIBUTE_CAN_DELETE , 0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6 , 5 ); -// -// WPD_RESOURCE_ATTRIBUTE_OPTIMAL_READ_BUFFER_SIZE -// [ VT_UI4 ] The recommended buffer size a caller should use when doing buffered reads on the resource. -DEFINE_PROPERTYKEY( WPD_RESOURCE_ATTRIBUTE_OPTIMAL_READ_BUFFER_SIZE , 0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6 , 6 ); -// -// WPD_RESOURCE_ATTRIBUTE_OPTIMAL_WRITE_BUFFER_SIZE -// [ VT_UI4 ] The recommended buffer size a caller should use when doing buffered writes on the resource. -DEFINE_PROPERTYKEY( WPD_RESOURCE_ATTRIBUTE_OPTIMAL_WRITE_BUFFER_SIZE , 0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6 , 7 ); -// -// WPD_RESOURCE_ATTRIBUTE_FORMAT -// [ VT_CLSID ] Indicates the format of the resource data. -DEFINE_PROPERTYKEY( WPD_RESOURCE_ATTRIBUTE_FORMAT , 0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6 , 8 ); -// -// WPD_RESOURCE_ATTRIBUTE_RESOURCE_KEY -// [ VT_UNKNOWN ] This is an IPortableDeviceKeyCollection containing a single value, which is the key identifying the resource. -DEFINE_PROPERTYKEY( WPD_RESOURCE_ATTRIBUTE_RESOURCE_KEY , 0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6 , 9 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_DEVICE_PROPERTIES_V1 -* -* -****************************************************************************/ -DEFINE_GUID( WPD_DEVICE_PROPERTIES_V1 , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC ); - -// -// WPD_DEVICE_SYNC_PARTNER -// [ VT_LPWSTR ] Indicates a human-readable description of a synchronization partner for the device. -DEFINE_PROPERTYKEY( WPD_DEVICE_SYNC_PARTNER , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 2 ); -// -// WPD_DEVICE_FIRMWARE_VERSION -// [ VT_LPWSTR ] Indicates the firmware version for the device. -DEFINE_PROPERTYKEY( WPD_DEVICE_FIRMWARE_VERSION , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 3 ); -// -// WPD_DEVICE_POWER_LEVEL -// [ VT_UI4 ] Indicates the power level of the device's battery. -DEFINE_PROPERTYKEY( WPD_DEVICE_POWER_LEVEL , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 4 ); -// -// WPD_DEVICE_POWER_SOURCE -// [ VT_UI4 ] Indicates the power source of the device e.g. whether it is battery or external. -DEFINE_PROPERTYKEY( WPD_DEVICE_POWER_SOURCE , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 5 ); -// -// WPD_DEVICE_PROTOCOL -// [ VT_LPWSTR ] Identifies the device protocol being used. -DEFINE_PROPERTYKEY( WPD_DEVICE_PROTOCOL , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 6 ); -// -// WPD_DEVICE_MANUFACTURER -// [ VT_LPWSTR ] Identifies the device manufacturer. -DEFINE_PROPERTYKEY( WPD_DEVICE_MANUFACTURER , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 7 ); -// -// WPD_DEVICE_MODEL -// [ VT_LPWSTR ] Identifies the device model. -DEFINE_PROPERTYKEY( WPD_DEVICE_MODEL , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 8 ); -// -// WPD_DEVICE_SERIAL_NUMBER -// [ VT_LPWSTR ] Identifies the serial number of the device. -DEFINE_PROPERTYKEY( WPD_DEVICE_SERIAL_NUMBER , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 9 ); -// -// WPD_DEVICE_SUPPORTS_NON_CONSUMABLE -// [ VT_BOOL ] Indicates whether the device supports non-consumable objects. -DEFINE_PROPERTYKEY( WPD_DEVICE_SUPPORTS_NON_CONSUMABLE , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 10 ); -// -// WPD_DEVICE_DATETIME -// [ VT_DATE ] Represents the current date and time settings of the device. -DEFINE_PROPERTYKEY( WPD_DEVICE_DATETIME , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 11 ); -// -// WPD_DEVICE_FRIENDLY_NAME -// [ VT_LPWSTR ] Represents the friendly name set by the user on the device. -DEFINE_PROPERTYKEY( WPD_DEVICE_FRIENDLY_NAME , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 12 ); -// -// WPD_DEVICE_SUPPORTED_DRM_SCHEMES -// [ VT_UNKNOWN ] An IPortableDevicePropVariantCollection of VT_LPWSTR values indicating the Digital Rights Management schemes supported by the driver. -DEFINE_PROPERTYKEY( WPD_DEVICE_SUPPORTED_DRM_SCHEMES , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 13 ); -// -// WPD_DEVICE_SUPPORTED_FORMATS_ARE_ORDERED -// [ VT_BOOL ] Indicates whether the supported formats returned from the device are in a preferred order. (First format in the list is most preferred by the device, while the last is the least preferred.) -DEFINE_PROPERTYKEY( WPD_DEVICE_SUPPORTED_FORMATS_ARE_ORDERED , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 14 ); -// -// WPD_DEVICE_TYPE -// [ VT_UI4 ] Indicates the device type, used for representation purposes only. Functional characteristics of the device are decided through functional objects. -DEFINE_PROPERTYKEY( WPD_DEVICE_TYPE , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 15 ); -// -// WPD_DEVICE_NETWORK_IDENTIFIER -// [ VT_UI8 ] Indicates the EUI-64 network identifier of the device, used for out-of-band Network Association operations. -DEFINE_PROPERTYKEY( WPD_DEVICE_NETWORK_IDENTIFIER , 0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B, 0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC , 16 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_DEVICE_PROPERTIES_V2 -* -* -****************************************************************************/ -DEFINE_GUID( WPD_DEVICE_PROPERTIES_V2 , 0x463DD662, 0x7FC4, 0x4291, 0x91, 0x1C, 0x7F, 0x4C, 0x9C, 0xCA, 0x97, 0x99 ); - -// -// WPD_DEVICE_FUNCTIONAL_UNIQUE_ID -// [ VT_VECTOR | VT_UI1 ] Indicates a unique 16 byte identifier common across multiple transports supported by the device. -DEFINE_PROPERTYKEY( WPD_DEVICE_FUNCTIONAL_UNIQUE_ID , 0x463DD662, 0x7FC4, 0x4291, 0x91, 0x1C, 0x7F, 0x4C, 0x9C, 0xCA, 0x97, 0x99 , 2 ); -// -// WPD_DEVICE_MODEL_UNIQUE_ID -// [ VT_VECTOR | VT_UI1 ] Indicates a unique 16 byte identifier for cosmetic differentiation among different models of the device. -DEFINE_PROPERTYKEY( WPD_DEVICE_MODEL_UNIQUE_ID , 0x463DD662, 0x7FC4, 0x4291, 0x91, 0x1C, 0x7F, 0x4C, 0x9C, 0xCA, 0x97, 0x99 , 3 ); -// -// WPD_DEVICE_TRANSPORT -// [ VT_UI4 ] Indicates the transport type (USB, IP, Bluetooth, etc.). -DEFINE_PROPERTYKEY( WPD_DEVICE_TRANSPORT , 0x463DD662, 0x7FC4, 0x4291, 0x91, 0x1C, 0x7F, 0x4C, 0x9C, 0xCA, 0x97, 0x99 , 4 ); -// -// WPD_DEVICE_USE_DEVICE_STAGE -// [ VT_BOOL ] If this property exists and is set to TRUE, the device can be used with Device Stage. -DEFINE_PROPERTYKEY( WPD_DEVICE_USE_DEVICE_STAGE , 0x463DD662, 0x7FC4, 0x4291, 0x91, 0x1C, 0x7F, 0x4C, 0x9C, 0xCA, 0x97, 0x99 , 5 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_SERVICE_PROPERTIES_V1 -* -* -****************************************************************************/ -DEFINE_GUID( WPD_SERVICE_PROPERTIES_V1 , 0x7510698A, 0xCB54, 0x481C, 0xB8, 0xDB, 0x0D, 0x75, 0xC9, 0x3F, 0x1C, 0x06 ); - -// -// WPD_SERVICE_VERSION -// [ VT_LPWSTR ] Indicates the implementation version of a service. -DEFINE_PROPERTYKEY( WPD_SERVICE_VERSION , 0x7510698A, 0xCB54, 0x481C, 0xB8, 0xDB, 0x0D, 0x75, 0xC9, 0x3F, 0x1C, 0x06 , 2 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_EVENT_PROPERTIES_V1 -* -* The properties in this category are for properties that may be needed for event processing, but do not have object property equivalents (i.e. they are not exposed as object properties, but rather, used only as event parameters). -****************************************************************************/ -DEFINE_GUID( WPD_EVENT_PROPERTIES_V1 , 0x15AB1953, 0xF817, 0x4FEF, 0xA9, 0x21, 0x56, 0x76, 0xE8, 0x38, 0xF6, 0xE0 ); - -// -// WPD_EVENT_PARAMETER_PNP_DEVICE_ID -// [ VT_LPWSTR ] Indicates the device that originated the event. -DEFINE_PROPERTYKEY( WPD_EVENT_PARAMETER_PNP_DEVICE_ID , 0x15AB1953, 0xF817, 0x4FEF, 0xA9, 0x21, 0x56, 0x76, 0xE8, 0x38, 0xF6, 0xE0 , 2 ); -// -// WPD_EVENT_PARAMETER_EVENT_ID -// [ VT_CLSID ] Indicates the event sent. -DEFINE_PROPERTYKEY( WPD_EVENT_PARAMETER_EVENT_ID , 0x15AB1953, 0xF817, 0x4FEF, 0xA9, 0x21, 0x56, 0x76, 0xE8, 0x38, 0xF6, 0xE0 , 3 ); -// -// WPD_EVENT_PARAMETER_OPERATION_STATE -// [ VT_UI4 ] Indicates the current state of the operation (e.g. started, running, stopped etc.). -DEFINE_PROPERTYKEY( WPD_EVENT_PARAMETER_OPERATION_STATE , 0x15AB1953, 0xF817, 0x4FEF, 0xA9, 0x21, 0x56, 0x76, 0xE8, 0x38, 0xF6, 0xE0 , 4 ); -// -// WPD_EVENT_PARAMETER_OPERATION_PROGRESS -// [ VT_UI4 ] Indicates the progress of a currently executing operation. Value is from 0 to 100, with 100 indicating that the operation is complete. -DEFINE_PROPERTYKEY( WPD_EVENT_PARAMETER_OPERATION_PROGRESS , 0x15AB1953, 0xF817, 0x4FEF, 0xA9, 0x21, 0x56, 0x76, 0xE8, 0x38, 0xF6, 0xE0 , 5 ); -// -// WPD_EVENT_PARAMETER_OBJECT_PARENT_PERSISTENT_UNIQUE_ID -// [ VT_LPWSTR ] Uniquely identifies the parent object, similar to WPD_OBJECT_PARENT_ID, but this ID will not change between sessions. -DEFINE_PROPERTYKEY( WPD_EVENT_PARAMETER_OBJECT_PARENT_PERSISTENT_UNIQUE_ID , 0x15AB1953, 0xF817, 0x4FEF, 0xA9, 0x21, 0x56, 0x76, 0xE8, 0x38, 0xF6, 0xE0 , 6 ); -// -// WPD_EVENT_PARAMETER_OBJECT_CREATION_COOKIE -// [ VT_LPWSTR ] This is the cookie handed back to a client when it requested an object creation using the IPortableDeviceContent::CreateObjectWithPropertiesAndData method. -DEFINE_PROPERTYKEY( WPD_EVENT_PARAMETER_OBJECT_CREATION_COOKIE , 0x15AB1953, 0xF817, 0x4FEF, 0xA9, 0x21, 0x56, 0x76, 0xE8, 0x38, 0xF6, 0xE0 , 7 ); -// -// WPD_EVENT_PARAMETER_CHILD_HIERARCHY_CHANGED -// [ VT_BOOL ] Indicates that the child hiearchy for the object has changed. -DEFINE_PROPERTYKEY( WPD_EVENT_PARAMETER_CHILD_HIERARCHY_CHANGED , 0x15AB1953, 0xF817, 0x4FEF, 0xA9, 0x21, 0x56, 0x76, 0xE8, 0x38, 0xF6, 0xE0 , 8 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_EVENT_PROPERTIES_V2 -* -* The properties in this category are for properties that may be needed for event processing, but do not have object property equivalents (i.e. they are not exposed as object properties, but rather, used only as event parameters). -****************************************************************************/ -DEFINE_GUID( WPD_EVENT_PROPERTIES_V2 , 0x52807B8A, 0x4914, 0x4323, 0x9B, 0x9A, 0x74, 0xF6, 0x54, 0xB2, 0xB8, 0x46 ); - -// -// WPD_EVENT_PARAMETER_SERVICE_METHOD_CONTEXT -// [ VT_LPWSTR ] Indicates the service method invocation context. -DEFINE_PROPERTYKEY( WPD_EVENT_PARAMETER_SERVICE_METHOD_CONTEXT , 0x52807B8A, 0x4914, 0x4323, 0x9B, 0x9A, 0x74, 0xF6, 0x54, 0xB2, 0xB8, 0x46 , 2 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_EVENT_OPTIONS_V1 -* -* The properties in this category describe event options. -****************************************************************************/ -DEFINE_GUID( WPD_EVENT_OPTIONS_V1 , 0xB3D8DAD7, 0xA361, 0x4B83, 0x8A, 0x48, 0x5B, 0x02, 0xCE, 0x10, 0x71, 0x3B ); - -// -// WPD_EVENT_OPTION_IS_BROADCAST_EVENT -// [ VT_BOOL ] Indicates that the event is broadcast to all clients. -DEFINE_PROPERTYKEY( WPD_EVENT_OPTION_IS_BROADCAST_EVENT , 0xB3D8DAD7, 0xA361, 0x4B83, 0x8A, 0x48, 0x5B, 0x02, 0xCE, 0x10, 0x71, 0x3B , 2 ); -// -// WPD_EVENT_OPTION_IS_AUTOPLAY_EVENT -// [ VT_BOOL ] Indicates that the event is sent to and handled by Autoplay. -DEFINE_PROPERTYKEY( WPD_EVENT_OPTION_IS_AUTOPLAY_EVENT , 0xB3D8DAD7, 0xA361, 0x4B83, 0x8A, 0x48, 0x5B, 0x02, 0xCE, 0x10, 0x71, 0x3B , 3 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_EVENT_ATTRIBUTES_V1 -* -* The properties in this category describe event attributes. -****************************************************************************/ -DEFINE_GUID( WPD_EVENT_ATTRIBUTES_V1 , 0x10C96578, 0x2E81, 0x4111, 0xAD, 0xDE, 0xE0, 0x8C, 0xA6, 0x13, 0x8F, 0x6D ); - -// -// WPD_EVENT_ATTRIBUTE_NAME -// [ VT_LPWSTR ] Contains the name of the event. -DEFINE_PROPERTYKEY( WPD_EVENT_ATTRIBUTE_NAME , 0x10C96578, 0x2E81, 0x4111, 0xAD, 0xDE, 0xE0, 0x8C, 0xA6, 0x13, 0x8F, 0x6D , 2 ); -// -// WPD_EVENT_ATTRIBUTE_PARAMETERS -// [ VT_UNKNOWN ] IPortableDeviceKeyCollection containing the event parameters. -DEFINE_PROPERTYKEY( WPD_EVENT_ATTRIBUTE_PARAMETERS , 0x10C96578, 0x2E81, 0x4111, 0xAD, 0xDE, 0xE0, 0x8C, 0xA6, 0x13, 0x8F, 0x6D , 3 ); -// -// WPD_EVENT_ATTRIBUTE_OPTIONS -// [ VT_UNKNOWN ] IPortableDeviceValues containing the event options. -DEFINE_PROPERTYKEY( WPD_EVENT_ATTRIBUTE_OPTIONS , 0x10C96578, 0x2E81, 0x4111, 0xAD, 0xDE, 0xE0, 0x8C, 0xA6, 0x13, 0x8F, 0x6D , 4 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_API_OPTIONS_V1 -* -* The properties in this category describe API options. -****************************************************************************/ -DEFINE_GUID( WPD_API_OPTIONS_V1 , 0x10E54A3E, 0x052D, 0x4777, 0xA1, 0x3C, 0xDE, 0x76, 0x14, 0xBE, 0x2B, 0xC4 ); - -// -// WPD_API_OPTION_USE_CLEAR_DATA_STREAM -// [ VT_BOOL ] Indicates that the data stream created for data transfer will be clear only (i.e. No DRM will be involved). -DEFINE_PROPERTYKEY( WPD_API_OPTION_USE_CLEAR_DATA_STREAM , 0x10E54A3E, 0x052D, 0x4777, 0xA1, 0x3C, 0xDE, 0x76, 0x14, 0xBE, 0x2B, 0xC4 , 2 ); -// -// WPD_API_OPTION_IOCTL_ACCESS -// [ VT_UI4 ] An optional property that clients can add to the IN parameter set of IPortableDevice::SendCommand to specify the access required for the command. The Portable Device API uses this to identify whether the IOCTL sent to the driver is sent with FILE_READ_ACCESS or (FILE_READ_ACCESS | FILE_WRITE_ACCESS) access flags. -DEFINE_PROPERTYKEY( WPD_API_OPTION_IOCTL_ACCESS , 0x10E54A3E, 0x052D, 0x4777, 0xA1, 0x3C, 0xDE, 0x76, 0x14, 0xBE, 0x2B, 0xC4 , 3 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_FORMAT_ATTRIBUTES_V1 -* -* The properties in this category describe format attributes. -****************************************************************************/ -DEFINE_GUID( WPD_FORMAT_ATTRIBUTES_V1 , 0xA0A02000, 0xBCAF, 0x4BE8, 0xB3, 0xF5, 0x23, 0x3F, 0x23, 0x1C, 0xF5, 0x8F ); - -// -// WPD_FORMAT_ATTRIBUTE_NAME -// [ VT_LPWSTR ] Contains the name of the format. -DEFINE_PROPERTYKEY( WPD_FORMAT_ATTRIBUTE_NAME , 0xA0A02000, 0xBCAF, 0x4BE8, 0xB3, 0xF5, 0x23, 0x3F, 0x23, 0x1C, 0xF5, 0x8F , 2 ); -// -// WPD_FORMAT_ATTRIBUTE_MIMETYPE -// [ VT_LPWSTR ] Contains the MIME type of the format. -DEFINE_PROPERTYKEY( WPD_FORMAT_ATTRIBUTE_MIMETYPE , 0xA0A02000, 0xBCAF, 0x4BE8, 0xB3, 0xF5, 0x23, 0x3F, 0x23, 0x1C, 0xF5, 0x8F , 3 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_METHOD_ATTRIBUTES_V1 -* -* The properties in this category describe method attributes. -****************************************************************************/ -DEFINE_GUID( WPD_METHOD_ATTRIBUTES_V1 , 0xF17A5071, 0xF039, 0x44AF, 0x8E, 0xFE, 0x43, 0x2C, 0xF3, 0x2E, 0x43, 0x2A ); - -// -// WPD_METHOD_ATTRIBUTE_NAME -// [ VT_LPWSTR ] Contains the name of the method. -DEFINE_PROPERTYKEY( WPD_METHOD_ATTRIBUTE_NAME , 0xF17A5071, 0xF039, 0x44AF, 0x8E, 0xFE, 0x43, 0x2C, 0xF3, 0x2E, 0x43, 0x2A , 2 ); -// -// WPD_METHOD_ATTRIBUTE_ASSOCIATED_FORMAT -// [ VT_CLSID ] Contains the format this method applies to. This is GUID_NULL if the method does not apply to a format. -DEFINE_PROPERTYKEY( WPD_METHOD_ATTRIBUTE_ASSOCIATED_FORMAT , 0xF17A5071, 0xF039, 0x44AF, 0x8E, 0xFE, 0x43, 0x2C, 0xF3, 0x2E, 0x43, 0x2A , 3 ); -// -// WPD_METHOD_ATTRIBUTE_ACCESS -// [ VT_UI4 ] Indicates the required access for a method. -DEFINE_PROPERTYKEY( WPD_METHOD_ATTRIBUTE_ACCESS , 0xF17A5071, 0xF039, 0x44AF, 0x8E, 0xFE, 0x43, 0x2C, 0xF3, 0x2E, 0x43, 0x2A , 4 ); -// -// WPD_METHOD_ATTRIBUTE_PARAMETERS -// [ VT_UNKNOWN ] This is an IPortableDeviceKeyCollection containing the method parameters. -DEFINE_PROPERTYKEY( WPD_METHOD_ATTRIBUTE_PARAMETERS , 0xF17A5071, 0xF039, 0x44AF, 0x8E, 0xFE, 0x43, 0x2C, 0xF3, 0x2E, 0x43, 0x2A , 5 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_PARAMETER_ATTRIBUTES_V1 -* -* The properties in this category describe parameter attributes. -****************************************************************************/ -DEFINE_GUID( WPD_PARAMETER_ATTRIBUTES_V1 , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 ); - -// -// WPD_PARAMETER_ATTRIBUTE_ORDER -// [ VT_UI4 ] The order (starting from 0) of a method parameter. -DEFINE_PROPERTYKEY( WPD_PARAMETER_ATTRIBUTE_ORDER , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 , 2 ); -// -// WPD_PARAMETER_ATTRIBUTE_USAGE -// [ VT_UI4 ] The usage of the method parameter. -DEFINE_PROPERTYKEY( WPD_PARAMETER_ATTRIBUTE_USAGE , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 , 3 ); -// -// WPD_PARAMETER_ATTRIBUTE_FORM -// [ VT_UI4 ] Specifies the form of the valid values allowed for this parameter. -DEFINE_PROPERTYKEY( WPD_PARAMETER_ATTRIBUTE_FORM , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 , 4 ); -// -// WPD_PARAMETER_ATTRIBUTE_DEFAULT_VALUE -// [ VT_XXXX ] Specifies the default value for this parameter. -DEFINE_PROPERTYKEY( WPD_PARAMETER_ATTRIBUTE_DEFAULT_VALUE , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 , 5 ); -// -// WPD_PARAMETER_ATTRIBUTE_RANGE_MIN -// [ VT_XXXX ] The minimum value for a parameter whose form is of WPD_PARAMETER_ATTRIBUTE_FORM_RANGE. -DEFINE_PROPERTYKEY( WPD_PARAMETER_ATTRIBUTE_RANGE_MIN , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 , 6 ); -// -// WPD_PARAMETER_ATTRIBUTE_RANGE_MAX -// [ VT_XXXX ] The maximum value for a parameter whose form is of WPD_PARAMETER_ATTRIBUTE_FORM_RANGE. -DEFINE_PROPERTYKEY( WPD_PARAMETER_ATTRIBUTE_RANGE_MAX , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 , 7 ); -// -// WPD_PARAMETER_ATTRIBUTE_RANGE_STEP -// [ VT_XXXX ] The step value for a parameter whose form is of WPD_PARAMETER_ATTRIBUTE_FORM_RANGE. -DEFINE_PROPERTYKEY( WPD_PARAMETER_ATTRIBUTE_RANGE_STEP , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 , 8 ); -// -// WPD_PARAMETER_ATTRIBUTE_ENUMERATION_ELEMENTS -// [ VT_UNKNOWN ] An IPortableDevicePropVariantCollection containing the enumeration values. -DEFINE_PROPERTYKEY( WPD_PARAMETER_ATTRIBUTE_ENUMERATION_ELEMENTS , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 , 9 ); -// -// WPD_PARAMETER_ATTRIBUTE_REGULAR_EXPRESSION -// [ VT_LPWSTR ] A regular expression string indicating acceptable values for parameters whose form is WPD_PARAMETER_ATTRIBUTE_FORM_REGULAR_EXPRESSION. -DEFINE_PROPERTYKEY( WPD_PARAMETER_ATTRIBUTE_REGULAR_EXPRESSION , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 , 10 ); -// -// WPD_PARAMETER_ATTRIBUTE_MAX_SIZE -// [ VT_UI8 ] This indicates the maximum size (in bytes) for the value of this parameter. -DEFINE_PROPERTYKEY( WPD_PARAMETER_ATTRIBUTE_MAX_SIZE , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 , 11 ); -// -// WPD_PARAMETER_ATTRIBUTE_VARTYPE -// [ VT_UI4 ] Contains the VARTYPE of the parameter. -DEFINE_PROPERTYKEY( WPD_PARAMETER_ATTRIBUTE_VARTYPE , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 , 12 ); -// -// WPD_PARAMETER_ATTRIBUTE_NAME -// [ VT_LPWSTR ] Contains the parameter name. -DEFINE_PROPERTYKEY( WPD_PARAMETER_ATTRIBUTE_NAME , 0xE6864DD7, 0xF325, 0x45EA, 0xA1, 0xD5, 0x97, 0xCF, 0x73, 0xB6, 0xCA, 0x58 , 13 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_COMMON -* -* -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_COMMON , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A ); - -// ======== Commands ======== - -// -// WPD_COMMAND_COMMON_RESET_DEVICE -// This command is sent by clients to reset the device. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// None -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_COMMON_RESET_DEVICE , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 2 ); -// -// WPD_COMMAND_COMMON_GET_OBJECT_IDS_FROM_PERSISTENT_UNIQUE_IDS -// This command is sent when a client wants to get current ObjectIDs representing objects specified by previously acquired Persistent Unique IDs. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_COMMON_PERSISTENT_UNIQUE_IDS -// Results: -// [ Required ] WPD_PROPERTY_COMMON_OBJECT_IDS -DEFINE_PROPERTYKEY( WPD_COMMAND_COMMON_GET_OBJECT_IDS_FROM_PERSISTENT_UNIQUE_IDS , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 3 ); -// -// WPD_COMMAND_COMMON_SAVE_CLIENT_INFORMATION -// This command is sent when a client first connects to a device. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_COMMON_CLIENT_INFORMATION -// Results: -// [ Optional ] WPD_PROPERTY_COMMON_CLIENT_INFORMATION_CONTEXT -DEFINE_PROPERTYKEY( WPD_COMMAND_COMMON_SAVE_CLIENT_INFORMATION , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 4 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_COMMON_COMMAND_CATEGORY -// [ VT_CLSID ] Specifies the command Category (i.e. the GUID portion of the PROPERTYKEY indicating the command). -DEFINE_PROPERTYKEY( WPD_PROPERTY_COMMON_COMMAND_CATEGORY , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 1001 ); -// -// WPD_PROPERTY_COMMON_COMMAND_ID -// [ VT_UI4 ] Specifies the command ID, which is the PID portion of the PROPERTYKEY indicating the command. -DEFINE_PROPERTYKEY( WPD_PROPERTY_COMMON_COMMAND_ID , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 1002 ); -// -// WPD_PROPERTY_COMMON_HRESULT -// [ VT_ERROR ] The driver sets this to be the HRESULT of the requested operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_COMMON_HRESULT , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 1003 ); -// -// WPD_PROPERTY_COMMON_DRIVER_ERROR_CODE -// [ VT_UI4 ] Special driver specific code which driver may return on error. Typically only for use with diagnostic tools or vertical solutions. -DEFINE_PROPERTYKEY( WPD_PROPERTY_COMMON_DRIVER_ERROR_CODE , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 1004 ); -// -// WPD_PROPERTY_COMMON_COMMAND_TARGET -// [ VT_LPWSTR ] Identifies the object which the command is intended for. -DEFINE_PROPERTYKEY( WPD_PROPERTY_COMMON_COMMAND_TARGET , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 1006 ); -// -// WPD_PROPERTY_COMMON_PERSISTENT_UNIQUE_IDS -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection of type VT_LPWSTR specifying list of Persistent Unique IDs. -DEFINE_PROPERTYKEY( WPD_PROPERTY_COMMON_PERSISTENT_UNIQUE_IDS , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 1007 ); -// -// WPD_PROPERTY_COMMON_OBJECT_IDS -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection of type VT_LPWSTR specifying list of Objects IDs. -DEFINE_PROPERTYKEY( WPD_PROPERTY_COMMON_OBJECT_IDS , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 1008 ); -// -// WPD_PROPERTY_COMMON_CLIENT_INFORMATION -// [ VT_UNKNOWN ] IPortableDeviceValues used to identify itself to the driver. -DEFINE_PROPERTYKEY( WPD_PROPERTY_COMMON_CLIENT_INFORMATION , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 1009 ); -// -// WPD_PROPERTY_COMMON_CLIENT_INFORMATION_CONTEXT -// [ VT_LPWSTR ] Driver specified context which will be sent for the particular client on all subsequent operations. -DEFINE_PROPERTYKEY( WPD_PROPERTY_COMMON_CLIENT_INFORMATION_CONTEXT , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 1010 ); - -// ======== Command Options ======== - -// -// WPD_OPTION_VALID_OBJECT_IDS -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection of type VT_LPWSTR specifying list of Objects IDs of the objects that support the command. -DEFINE_PROPERTYKEY( WPD_OPTION_VALID_OBJECT_IDS , 0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A , 5001 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_OBJECT_ENUMERATION -* -* The commands in this category are used for basic object enumeration. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_OBJECT_ENUMERATION , 0xB7474E91, 0xE7F8, 0x4AD9, 0xB4, 0x00, 0xAD, 0x1A, 0x4B, 0x58, 0xEE, 0xEC ); - -// ======== Commands ======== - -// -// WPD_COMMAND_OBJECT_ENUMERATION_START_FIND -// The driver receives this command when a client wishes to start enumeration. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_ENUMERATION_PARENT_ID -// [ Optional ] WPD_PROPERTY_OBJECT_ENUMERATION_FILTER -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_ENUMERATION_CONTEXT -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_ENUMERATION_START_FIND , 0xB7474E91, 0xE7F8, 0x4AD9, 0xB4, 0x00, 0xAD, 0x1A, 0x4B, 0x58, 0xEE, 0xEC , 2 ); -// -// WPD_COMMAND_OBJECT_ENUMERATION_FIND_NEXT -// This command is used when the client requests the next batch of ObjectIDs during enumeration. Only objects that match the constraints set up in WPD_COMMAND_OBJECT_ENUMERATION_START_FIND should be returned. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_ENUMERATION_CONTEXT -// [ Required ] WPD_PROPERTY_OBJECT_ENUMERATION_NUM_OBJECTS_REQUESTED -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_ENUMERATION_OBJECT_IDS -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_ENUMERATION_FIND_NEXT , 0xB7474E91, 0xE7F8, 0x4AD9, 0xB4, 0x00, 0xAD, 0x1A, 0x4B, 0x58, 0xEE, 0xEC , 3 ); -// -// WPD_COMMAND_OBJECT_ENUMERATION_END_FIND -// The driver should destroy any resources associated with this enumeration context. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_ENUMERATION_CONTEXT -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_ENUMERATION_END_FIND , 0xB7474E91, 0xE7F8, 0x4AD9, 0xB4, 0x00, 0xAD, 0x1A, 0x4B, 0x58, 0xEE, 0xEC , 4 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_OBJECT_ENUMERATION_PARENT_ID -// [ VT_LPWSTR ] The ObjectID specifying the parent object where enumeration should start. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_ENUMERATION_PARENT_ID , 0xB7474E91, 0xE7F8, 0x4AD9, 0xB4, 0x00, 0xAD, 0x1A, 0x4B, 0x58, 0xEE, 0xEC , 1001 ); -// -// WPD_PROPERTY_OBJECT_ENUMERATION_FILTER -// [ VT_UNKNOWN ] This is an IPortableDeviceValues which specifies the properties used to filter on. If the caller does not want filtering, then this value will not be set. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_ENUMERATION_FILTER , 0xB7474E91, 0xE7F8, 0x4AD9, 0xB4, 0x00, 0xAD, 0x1A, 0x4B, 0x58, 0xEE, 0xEC , 1002 ); -// -// WPD_PROPERTY_OBJECT_ENUMERATION_OBJECT_IDS -// [ VT_UNKNOWN ] This is an IPortableDevicePropVariantCollection of ObjectIDs (of type VT_LPWSTR). If 0 objects are returned, this should be an empty collection, not NULL. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_ENUMERATION_OBJECT_IDS , 0xB7474E91, 0xE7F8, 0x4AD9, 0xB4, 0x00, 0xAD, 0x1A, 0x4B, 0x58, 0xEE, 0xEC , 1003 ); -// -// WPD_PROPERTY_OBJECT_ENUMERATION_CONTEXT -// [ VT_LPWSTR ] This is a driver-specified identifier for the context associated with this enumeration. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_ENUMERATION_CONTEXT , 0xB7474E91, 0xE7F8, 0x4AD9, 0xB4, 0x00, 0xAD, 0x1A, 0x4B, 0x58, 0xEE, 0xEC , 1004 ); -// -// WPD_PROPERTY_OBJECT_ENUMERATION_NUM_OBJECTS_REQUESTED -// [ VT_UI4 ] The maximum number of ObjectIDs to return back to the client. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_ENUMERATION_NUM_OBJECTS_REQUESTED , 0xB7474E91, 0xE7F8, 0x4AD9, 0xB4, 0x00, 0xAD, 0x1A, 0x4B, 0x58, 0xEE, 0xEC , 1005 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_OBJECT_PROPERTIES -* -* This category of commands is used to perform basic property operations such as Reading/Writing values, listing supported values and so on. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_OBJECT_PROPERTIES , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 ); - -// ======== Commands ======== - -// -// WPD_COMMAND_OBJECT_PROPERTIES_GET_SUPPORTED -// This command is used when the client requests the list of properties supported by the specified object. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_OBJECT_ID -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_KEYS -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_GET_SUPPORTED , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 , 2 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_GET_ATTRIBUTES -// This command is used when the client requests the property attributes for the specified object properties. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_OBJECT_ID -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_KEYS -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_ATTRIBUTES -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_GET_ATTRIBUTES , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 , 3 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_GET -// This command is used when the client requests a set of property values for the specified object. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_OBJECT_ID -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_KEYS -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_VALUES -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_GET , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 , 4 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_SET -// This command is used when the client requests to write a set of property values on the specified object. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_OBJECT_ID -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_VALUES -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_WRITE_RESULTS -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_SET , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 , 5 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_GET_ALL -// This command is used when the client requests all property values for the specified object. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_OBJECT_ID -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_VALUES -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_GET_ALL , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 , 6 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_DELETE -// This command is sent when the caller wants to delete properties from the specified object. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_OBJECT_ID -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_KEYS -// Results: -// [ Optional ] WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_DELETE_RESULTS -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_DELETE , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 , 7 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_OBJECT_PROPERTIES_OBJECT_ID -// [ VT_LPWSTR ] The ObjectID specifying the object whose properties are being queried/manipulated. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_OBJECT_ID , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 , 1001 ); -// -// WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_KEYS -// [ VT_UNKNOWN ] An IPortableDeviceKeyCollection identifying which specific property values we are querying/manipulating. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_KEYS , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 , 1002 ); -// -// WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_ATTRIBUTES -// [ VT_UNKNOWN ] This is an IPortableDeviceValues which contains the attributes for each property requested. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_ATTRIBUTES , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 , 1003 ); -// -// WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_VALUES -// [ VT_UNKNOWN ] This is an IPortableDeviceValues which contains the values read. For any property whose value could not be read, the type must be set to VT_ERROR, and the 'scode' field must contain the failure HRESULT. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_VALUES , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 , 1004 ); -// -// WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_WRITE_RESULTS -// [ VT_UNKNOWN ] This is an IPortableDeviceValues which contains the result of each property write operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_WRITE_RESULTS , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 , 1005 ); -// -// WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_DELETE_RESULTS -// [ VT_UNKNOWN ] This is an IPortableDeviceValues which contains the result of each property delete operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_DELETE_RESULTS , 0x9E5582E4, 0x0814, 0x44E6, 0x98, 0x1A, 0xB2, 0x99, 0x8D, 0x58, 0x38, 0x04 , 1006 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_OBJECT_PROPERTIES_BULK -* -* This category contains commands and properties for property operations across multiple objects. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_OBJECT_PROPERTIES_BULK , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E ); - -// ======== Commands ======== - -// -// WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_LIST_START -// Initializes the operation to get the property values for all caller-specified objects. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_OBJECT_IDS -// [ Optional ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_PROPERTY_KEYS -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_CONTEXT -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_LIST_START , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 2 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_LIST_NEXT -// Get the next set of property values. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_CONTEXT -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_VALUES -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_LIST_NEXT , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 3 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_LIST_END -// Ends the bulk property operation for getting property values by object list. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_CONTEXT -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_LIST_END , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 4 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_FORMAT_START -// Initializes the operation to get the property values for objects of the specified format -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_OBJECT_FORMAT -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_PARENT_OBJECT_ID -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_DEPTH -// [ Optional ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_PROPERTY_KEYS -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_CONTEXT -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_FORMAT_START , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 5 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_FORMAT_NEXT -// Get the next set of property values. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_CONTEXT -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_VALUES -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_FORMAT_NEXT , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 6 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_FORMAT_END -// Ends the bulk property operation for getting property values by object format. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_CONTEXT -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_FORMAT_END , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 7 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_BULK_SET_VALUES_BY_OBJECT_LIST_START -// Initializes the operation to set the property values for specified objects. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_VALUES -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_CONTEXT -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_SET_VALUES_BY_OBJECT_LIST_START , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 8 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_BULK_SET_VALUES_BY_OBJECT_LIST_NEXT -// Set the next set of property values. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_CONTEXT -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_WRITE_RESULTS -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_SET_VALUES_BY_OBJECT_LIST_NEXT , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 9 ); -// -// WPD_COMMAND_OBJECT_PROPERTIES_BULK_SET_VALUES_BY_OBJECT_LIST_END -// Ends the bulk property operation for setting property values by object list. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_PROPERTIES_BULK_CONTEXT -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_SET_VALUES_BY_OBJECT_LIST_END , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 10 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_OBJECT_PROPERTIES_BULK_OBJECT_IDS -// [ VT_UNKNOWN ] A collection of ObjectIDs for which supported property list must be returned. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_BULK_OBJECT_IDS , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 1001 ); -// -// WPD_PROPERTY_OBJECT_PROPERTIES_BULK_CONTEXT -// [ VT_LPWSTR ] The driver-specified context identifying this particular bulk operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_BULK_CONTEXT , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 1002 ); -// -// WPD_PROPERTY_OBJECT_PROPERTIES_BULK_VALUES -// [ VT_UNKNOWN ] Contains an IPortableDeviceValuesCollection specifying the next set of IPortableDeviceValues elements. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_BULK_VALUES , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 1003 ); -// -// WPD_PROPERTY_OBJECT_PROPERTIES_BULK_PROPERTY_KEYS -// [ VT_UNKNOWN ] Contains an IPortableDeviceKeyCollection specifying which properties the caller wants to return. May not exist, which indicates caller wants ALL properties. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_BULK_PROPERTY_KEYS , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 1004 ); -// -// WPD_PROPERTY_OBJECT_PROPERTIES_BULK_DEPTH -// [ VT_UI4 ] Contains a value specifying the hierarchical depth from the parent to include in this operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_BULK_DEPTH , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 1005 ); -// -// WPD_PROPERTY_OBJECT_PROPERTIES_BULK_PARENT_OBJECT_ID -// [ VT_LPWSTR ] Contains the ObjectID of the object to start the operation from. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_BULK_PARENT_OBJECT_ID , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 1006 ); -// -// WPD_PROPERTY_OBJECT_PROPERTIES_BULK_OBJECT_FORMAT -// [ VT_CLSID ] Specifies the object format the client is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_BULK_OBJECT_FORMAT , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 1007 ); -// -// WPD_PROPERTY_OBJECT_PROPERTIES_BULK_WRITE_RESULTS -// [ VT_UNKNOWN ] Contains an IPortableDeviceValuesCollection specifying the set of IPortableDeviceValues elements indicating the write results for each property set. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_PROPERTIES_BULK_WRITE_RESULTS , 0x11C824DD, 0x04CD, 0x4E4E, 0x8C, 0x7B, 0xF6, 0xEF, 0xB7, 0x94, 0xD8, 0x4E , 1008 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_OBJECT_RESOURCES -* -* The commands in this category are used for basic object resource enumeration and transfer. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_OBJECT_RESOURCES , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A ); - -// ======== Commands ======== - -// -// WPD_COMMAND_OBJECT_RESOURCES_GET_SUPPORTED -// This command is sent when a client wants to get the list of resources supported on a particular object. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_OBJECT_ID -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_KEYS -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_RESOURCES_GET_SUPPORTED , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 2 ); -// -// WPD_COMMAND_OBJECT_RESOURCES_GET_ATTRIBUTES -// This command is used when the client requests the attributes for the specified object resource. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_OBJECT_ID -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_KEYS -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_ATTRIBUTES -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_RESOURCES_GET_ATTRIBUTES , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 3 ); -// -// WPD_COMMAND_OBJECT_RESOURCES_OPEN -// This command is sent when a client wants to use a particular resource on an object. -// Access: -// Dependent on the value of WPD_PROPERTY_OBJECT_RESOURCES_ACCESS_MODE. STGM_READ will indicate FILE_READ_ACCESS for the command, anything else will indicate (FILE_READ_ACCESS | FILE_WRITE_ACCESS). -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_OBJECT_ID -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_KEYS -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_ACCESS_MODE -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_CONTEXT -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_OPTIMAL_TRANSFER_BUFFER_SIZE -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_RESOURCES_OPEN , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 4 ); -// -// WPD_COMMAND_OBJECT_RESOURCES_READ -// This command is sent when a client wants to read the next band of data from a previously opened object resource. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_CONTEXT -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_TO_READ -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_DATA -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_READ -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_DATA -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_RESOURCES_READ , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 5 ); -// -// WPD_COMMAND_OBJECT_RESOURCES_WRITE -// This command is sent when a client wants to write the next band of data to a previously opened object resource. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_CONTEXT -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_TO_WRITE -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_DATA -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_WRITTEN -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_RESOURCES_WRITE , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 6 ); -// -// WPD_COMMAND_OBJECT_RESOURCES_CLOSE -// This command is sent when a client is finished transferring data to a previously opened object resource. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_CONTEXT -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_RESOURCES_CLOSE , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 7 ); -// -// WPD_COMMAND_OBJECT_RESOURCES_DELETE -// This command is sent when the client wants to delete the data associated with the specified resources from the specified object. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_OBJECT_ID -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_KEYS -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_RESOURCES_DELETE , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 8 ); -// -// WPD_COMMAND_OBJECT_RESOURCES_CREATE_RESOURCE -// This command is sent when a client wants to create a new object resource on the device. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_ATTRIBUTES -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_CONTEXT -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_OPTIMAL_TRANSFER_BUFFER_SIZE -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_RESOURCES_CREATE_RESOURCE , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 9 ); -// -// WPD_COMMAND_OBJECT_RESOURCES_REVERT -// This command is sent when a client wants to cancel the resource creation request that is currently still in progress. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_CONTEXT -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_RESOURCES_REVERT , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 10 ); -// -// WPD_COMMAND_OBJECT_RESOURCES_SEEK -// This command is sent when a client wants to seek to a specific offset in the data stream. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_CONTEXT -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_SEEK_OFFSET -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_SEEK_ORIGIN_FLAG -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_RESOURCES_POSITION_FROM_START -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_RESOURCES_SEEK , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 11 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_OBJECT_RESOURCES_OBJECT_ID -// [ VT_LPWSTR ] -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_OBJECT_ID , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1001 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_ACCESS_MODE -// [ VT_UI4 ] Specifies the type of access the client is requesting for the resource. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_ACCESS_MODE , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1002 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_KEYS -// [ VT_UNKNOWN ] -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_KEYS , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1003 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_ATTRIBUTES -// [ VT_UNKNOWN ] This is an IPortableDeviceValues which contains the attributes for the resource requested. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_ATTRIBUTES , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1004 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_CONTEXT -// [ VT_LPWSTR] This is a driver-specified identifier for the context associated with the resource operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_CONTEXT , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1005 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_TO_READ -// [ VT_UI4 ] Specifies the number of bytes the client is requesting to read. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_TO_READ , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1006 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_READ -// [ VT_UI4 ] Specifies the number of bytes actually read from the resource. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_READ , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1007 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_TO_WRITE -// [ VT_UI4 ] Specifies the number of bytes the client is requesting to write. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_TO_WRITE , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1008 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_WRITTEN -// [ VT_UI4 ] Driver sets this to let caller know how many bytes were actually written. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_WRITTEN , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1009 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_DATA -// [ VT_VECTOR|VT_UI1 ] -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_DATA , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1010 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_OPTIMAL_TRANSFER_BUFFER_SIZE -// [ VT_UI4 ] Indicates the optimal transfer buffer size (in bytes) that clients should use when reading/writing this resource. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_OPTIMAL_TRANSFER_BUFFER_SIZE , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1011 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_SEEK_OFFSET -// [ VT_I8 ] Displacement to be added to the location indicated by the WPD_PROPERTY_OBJECT_RESOURCES_SEEK_ORIGIN_FLAG parameter. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_SEEK_OFFSET , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1012 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_SEEK_ORIGIN_FLAG -// [ VT_UI4 ] Specifies the origin of the displacement for the seek operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_SEEK_ORIGIN_FLAG , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1013 ); -// -// WPD_PROPERTY_OBJECT_RESOURCES_POSITION_FROM_START -// [ VT_UI8 ] Value of the new seek pointer from the beginning of the data stream. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_RESOURCES_POSITION_FROM_START , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 1014 ); - -// ======== Command Options ======== - -// -// WPD_OPTION_OBJECT_RESOURCES_SEEK_ON_READ_SUPPORTED -// [ VT_BOOL ] Indicates whether the driver can Seek on a resource opened for Read access. -DEFINE_PROPERTYKEY( WPD_OPTION_OBJECT_RESOURCES_SEEK_ON_READ_SUPPORTED , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 5001 ); -// -// WPD_OPTION_OBJECT_RESOURCES_SEEK_ON_WRITE_SUPPORTED -// [ VT_BOOL ] Indicates whether the driver can Seek on a resource opened for Write access. -DEFINE_PROPERTYKEY( WPD_OPTION_OBJECT_RESOURCES_SEEK_ON_WRITE_SUPPORTED , 0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A , 5002 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_OBJECT_MANAGEMENT -* -* The commands specified in this category are used to Create/Delete objects on the device. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_OBJECT_MANAGEMENT , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 ); - -// ======== Commands ======== - -// -// WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_ONLY -// This command is sent when a client wants to create a new object on the device, specified only by properties. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_CREATION_PROPERTIES -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_ID -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_ONLY , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 2 ); -// -// WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_AND_DATA -// This command is sent when a client wants to create a new object on the device, specified by properties and data. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_CREATION_PROPERTIES -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_CONTEXT -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_AND_DATA , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 3 ); -// -// WPD_COMMAND_OBJECT_MANAGEMENT_WRITE_OBJECT_DATA -// This command is sent when a client wants to write the next band of data to a newly created object or an object being updated. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_CONTEXT -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_NUM_BYTES_TO_WRITE -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_DATA -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_NUM_BYTES_WRITTEN -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_MANAGEMENT_WRITE_OBJECT_DATA , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 4 ); -// -// WPD_COMMAND_OBJECT_MANAGEMENT_COMMIT_OBJECT -// This command is sent when a client has finished sending all the data associated with an object creation or update request, and wishes to ensure that the object is saved to the device. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_CONTEXT -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_ID -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_MANAGEMENT_COMMIT_OBJECT , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 5 ); -// -// WPD_COMMAND_OBJECT_MANAGEMENT_REVERT_OBJECT -// This command is sent when a client wants to cancel the object creation or update request that is currently still in progress. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_CONTEXT -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_MANAGEMENT_REVERT_OBJECT , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 6 ); -// -// WPD_COMMAND_OBJECT_MANAGEMENT_DELETE_OBJECTS -// This command is sent when the client wishes to remove a set of objects from the device. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_DELETE_OPTIONS -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_IDS -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_DELETE_RESULTS -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_MANAGEMENT_DELETE_OBJECTS , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 7 ); -// -// WPD_COMMAND_OBJECT_MANAGEMENT_MOVE_OBJECTS -// This command will move the specified objects to the destination folder. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_IDS -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_DESTINATION_FOLDER_OBJECT_ID -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_MOVE_RESULTS -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_MANAGEMENT_MOVE_OBJECTS , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 8 ); -// -// WPD_COMMAND_OBJECT_MANAGEMENT_COPY_OBJECTS -// This command will copy the specified objects to the destination folder. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_IDS -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_DESTINATION_FOLDER_OBJECT_ID -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_COPY_RESULTS -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_MANAGEMENT_COPY_OBJECTS , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 9 ); -// -// WPD_COMMAND_OBJECT_MANAGEMENT_UPDATE_OBJECT_WITH_PROPERTIES_AND_DATA -// This command is sent when a client wants to update the object's data and dependent properties simultaneously. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_ID -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_UPDATE_PROPERTIES -// Results: -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_CONTEXT -// [ Required ] WPD_PROPERTY_OBJECT_MANAGEMENT_OPTIMAL_TRANSFER_BUFFER_SIZE -DEFINE_PROPERTYKEY( WPD_COMMAND_OBJECT_MANAGEMENT_UPDATE_OBJECT_WITH_PROPERTIES_AND_DATA , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 10 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_CREATION_PROPERTIES -// [ VT_UNKNOWN ] This is an IPortableDeviceValues which specifies the properties used to create the new object. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_CREATION_PROPERTIES , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1001 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_CONTEXT -// [ VT_LPWSTR ] This is a driver-specified identifier for the context associated with this 'create object' operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_CONTEXT , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1002 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_NUM_BYTES_TO_WRITE -// [ VT_UI4 ] Specifies the number of bytes the client is requesting to write. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_NUM_BYTES_TO_WRITE , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1003 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_NUM_BYTES_WRITTEN -// [ VT_UI4 ] Indicates the number of bytes written for the object. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_NUM_BYTES_WRITTEN , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1004 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_DATA -// [ VT_VECTOR|VT_UI1 ] Indicates binary data of the object being created on the device. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_DATA , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1005 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_ID -// [ VT_LPWSTR ] Identifies a newly created object on the device. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_ID , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1006 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_DELETE_OPTIONS -// [ VT_UI4 ] Indicates if the delete operation should be recursive or not. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_DELETE_OPTIONS , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1007 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_OPTIMAL_TRANSFER_BUFFER_SIZE -// [ VT_UI4 ] Indicates the optimal transfer buffer size (in bytes) that clients should use when writing this object's data. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_OPTIMAL_TRANSFER_BUFFER_SIZE , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1008 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_IDS -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection of type VT_LPWSTR, containing the ObjectIDs to delete. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_IDS , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1009 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_DELETE_RESULTS -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection of type VT_ERROR, where each element is the HRESULT indicating the success or failure of the operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_DELETE_RESULTS , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1010 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_DESTINATION_FOLDER_OBJECT_ID -// [ VT_LPWSTR ] Indicates the destination folder for the move operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_DESTINATION_FOLDER_OBJECT_ID , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1011 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_MOVE_RESULTS -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection of type VT_ERROR, where each element is the HRESULT indicating the success or failure of the operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_MOVE_RESULTS , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1012 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_COPY_RESULTS -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection of type VT_ERROR, where each element is the HRESULT indicating the success or failure of the operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_COPY_RESULTS , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1013 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_UPDATE_PROPERTIES -// [ VT_UNKNOWN ] IPortableDeviceValues containing the object properties to update. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_UPDATE_PROPERTIES , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1014 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_PROPERTY_KEYS -// [ VT_UNKNOWN ] IPortableDeviceKeyCollection containing the property keys required to update this object. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_PROPERTY_KEYS , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1015 ); -// -// WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_FORMAT -// [ VT_CLSID ] Indicates the object format the caller is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_FORMAT , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 1016 ); - -// ======== Command Options ======== - -// -// WPD_OPTION_OBJECT_MANAGEMENT_RECURSIVE_DELETE_SUPPORTED -// [ VT_BOOL ] Indicates whether the driver supports recursive deletion. -DEFINE_PROPERTYKEY( WPD_OPTION_OBJECT_MANAGEMENT_RECURSIVE_DELETE_SUPPORTED , 0xEF1E43DD, 0xA9ED, 0x4341, 0x8B, 0xCC, 0x18, 0x61, 0x92, 0xAE, 0xA0, 0x89 , 5001 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_CAPABILITIES -* -* This command category is used to query capabilities of the device. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_CAPABILITIES , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 ); - -// ======== Commands ======== - -// -// WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_COMMANDS -// Return all commands supported by this driver. This includes custom commands, if any. -// Access: -// FILE_READ_ACCESS -// Parameters: -// None -// Results: -// [ Required ] WPD_PROPERTY_CAPABILITIES_SUPPORTED_COMMANDS -DEFINE_PROPERTYKEY( WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_COMMANDS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 2 ); -// -// WPD_COMMAND_CAPABILITIES_GET_COMMAND_OPTIONS -// Returns the supported options for the specified command. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_CAPABILITIES_COMMAND -// Results: -// [ Required ] WPD_PROPERTY_CAPABILITIES_COMMAND_OPTIONS -DEFINE_PROPERTYKEY( WPD_COMMAND_CAPABILITIES_GET_COMMAND_OPTIONS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 3 ); -// -// WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FUNCTIONAL_CATEGORIES -// This command is used by clients to query the functional categories supported by the driver. -// Access: -// FILE_READ_ACCESS -// Parameters: -// None -// Results: -// [ Required ] WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_CATEGORIES -DEFINE_PROPERTYKEY( WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FUNCTIONAL_CATEGORIES , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 4 ); -// -// WPD_COMMAND_CAPABILITIES_GET_FUNCTIONAL_OBJECTS -// Retrieves the ObjectIDs of the objects belonging to the specified functional category. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_CATEGORY -// Results: -// [ Required ] WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_OBJECTS -DEFINE_PROPERTYKEY( WPD_COMMAND_CAPABILITIES_GET_FUNCTIONAL_OBJECTS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 5 ); -// -// WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_CONTENT_TYPES -// Retrieves the list of content types supported by this driver for the specified functional category. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_CATEGORY -// Results: -// [ Required ] WPD_PROPERTY_CAPABILITIES_CONTENT_TYPES -DEFINE_PROPERTYKEY( WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_CONTENT_TYPES , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 6 ); -// -// WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FORMATS -// This command is used to query the possible formats supported by the specified content type (e.g. for image objects, the driver may choose to support JPEG and BMP files). -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_CAPABILITIES_CONTENT_TYPE -// Results: -// [ Required ] WPD_PROPERTY_CAPABILITIES_FORMATS -DEFINE_PROPERTYKEY( WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FORMATS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 7 ); -// -// WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FORMAT_PROPERTIES -// Get the list of properties that an object of the given format supports. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_CAPABILITIES_FORMAT -// Results: -// [ Required ] WPD_PROPERTY_CAPABILITIES_PROPERTY_KEYS -DEFINE_PROPERTYKEY( WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FORMAT_PROPERTIES , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 8 ); -// -// WPD_COMMAND_CAPABILITIES_GET_FIXED_PROPERTY_ATTRIBUTES -// Returns the property attributes that are the same for all objects of the given format. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_CAPABILITIES_FORMAT -// [ Required ] WPD_PROPERTY_CAPABILITIES_PROPERTY_KEYS -// Results: -// [ Required ] WPD_PROPERTY_CAPABILITIES_PROPERTY_ATTRIBUTES -DEFINE_PROPERTYKEY( WPD_COMMAND_CAPABILITIES_GET_FIXED_PROPERTY_ATTRIBUTES , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 9 ); -// -// WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_EVENTS -// Return all events supported by this driver. This includes custom events, if any. -// Access: -// FILE_READ_ACCESS -// Parameters: -// None -// Results: -// [ Required ] WPD_PROPERTY_CAPABILITIES_SUPPORTED_EVENTS -DEFINE_PROPERTYKEY( WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_EVENTS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 10 ); -// -// WPD_COMMAND_CAPABILITIES_GET_EVENT_OPTIONS -// Return extra information about a specified event, such as whether the event is for notification or action purposes. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_CAPABILITIES_EVENT -// Results: -// [ Required ] WPD_PROPERTY_CAPABILITIES_EVENT_OPTIONS -DEFINE_PROPERTYKEY( WPD_COMMAND_CAPABILITIES_GET_EVENT_OPTIONS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 11 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_CAPABILITIES_SUPPORTED_COMMANDS -// [ VT_UNKNOWN ] IPortableDeviceKeyCollection containing all commands a driver supports. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_SUPPORTED_COMMANDS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1001 ); -// -// WPD_PROPERTY_CAPABILITIES_COMMAND -// [ VT_UNKNOWN ] Indicates the command whose options the caller is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_COMMAND , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1002 ); -// -// WPD_PROPERTY_CAPABILITIES_COMMAND_OPTIONS -// [ VT_UNKNOWN ] Contains an IPortableDeviceValues with the relevant command options. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_COMMAND_OPTIONS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1003 ); -// -// WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_CATEGORIES -// [ VT_UNKNOWN ] An IPortableDevicePropVariantCollection of type VT_CLSID which indicates the functional categories supported by the driver. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_CATEGORIES , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1004 ); -// -// WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_CATEGORY -// [ VT_CLSID ] The category the caller is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_CATEGORY , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1005 ); -// -// WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_OBJECTS -// [ VT_UNKNOWN ] An IPortableDevicePropVariantCollection (of type VT_LPWSTR) containing the ObjectIDs of the functional objects who belong to the specified functional category. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_OBJECTS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1006 ); -// -// WPD_PROPERTY_CAPABILITIES_CONTENT_TYPES -// [ VT_UNKNOWN ] Indicates list of content types supported for the specified functional category. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_CONTENT_TYPES , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1007 ); -// -// WPD_PROPERTY_CAPABILITIES_CONTENT_TYPE -// [ VT_CLSID ] Indicates the content type whose formats the caller is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_CONTENT_TYPE , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1008 ); -// -// WPD_PROPERTY_CAPABILITIES_FORMATS -// [ VT_UNKNOWN ] An IPortableDevicePropVariantCollection of VT_CLSID values indicating the formats supported for the specified content type. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_FORMATS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1009 ); -// -// WPD_PROPERTY_CAPABILITIES_FORMAT -// [ VT_CLSID ] Specifies the format the caller is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_FORMAT , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1010 ); -// -// WPD_PROPERTY_CAPABILITIES_PROPERTY_KEYS -// [ VT_UNKNOWN ] An IPortableDeviceKeyCollection containing the property keys. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_PROPERTY_KEYS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1011 ); -// -// WPD_PROPERTY_CAPABILITIES_PROPERTY_ATTRIBUTES -// [ VT_UNKNOWN ] An IPortableDeviceValues containing the property attributes. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_PROPERTY_ATTRIBUTES , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1012 ); -// -// WPD_PROPERTY_CAPABILITIES_SUPPORTED_EVENTS -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection of VT_CLSID values containing all events a driver supports. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_SUPPORTED_EVENTS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1013 ); -// -// WPD_PROPERTY_CAPABILITIES_EVENT -// [ VT_CLSID ] Indicates the event the caller is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_EVENT , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1014 ); -// -// WPD_PROPERTY_CAPABILITIES_EVENT_OPTIONS -// [ VT_UNKNOWN ] Contains an IPortableDeviceValues with the relevant event options. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CAPABILITIES_EVENT_OPTIONS , 0x0CABEC78, 0x6B74, 0x41C6, 0x92, 0x16, 0x26, 0x39, 0xD1, 0xFC, 0xE3, 0x56 , 1015 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CLASS_EXTENSION_V1 -* -* The commands in this category relate to the WPD device class extension. -****************************************************************************/ -DEFINE_GUID( WPD_CLASS_EXTENSION_V1 , 0x33FB0D11, 0x64A3, 0x4FAC, 0xB4, 0xC7, 0x3D, 0xFE, 0xAA, 0x99, 0xB0, 0x51 ); - -// ======== Commands ======== - -// -// WPD_COMMAND_CLASS_EXTENSION_WRITE_DEVICE_INFORMATION -// This command is used to update the a cache of device-specific information. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_CLASS_EXTENSION_DEVICE_INFORMATION_VALUES -// Results: -// [ Required ] WPD_PROPERTY_CLASS_EXTENSION_DEVICE_INFORMATION_WRITE_RESULTS -DEFINE_PROPERTYKEY( WPD_COMMAND_CLASS_EXTENSION_WRITE_DEVICE_INFORMATION , 0x33FB0D11, 0x64A3, 0x4FAC, 0xB4, 0xC7, 0x3D, 0xFE, 0xAA, 0x99, 0xB0, 0x51 , 2 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_CLASS_EXTENSION_DEVICE_INFORMATION_VALUES -// [ VT_UNKNOWN ] This is an IPortableDeviceValues which contains the values. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CLASS_EXTENSION_DEVICE_INFORMATION_VALUES , 0x33FB0D11, 0x64A3, 0x4FAC, 0xB4, 0xC7, 0x3D, 0xFE, 0xAA, 0x99, 0xB0, 0x51 , 1001 ); -// -// WPD_PROPERTY_CLASS_EXTENSION_DEVICE_INFORMATION_WRITE_RESULTS -// [ VT_UNKNOWN ] This is an IPortableDeviceValues which contains the result of each value write operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CLASS_EXTENSION_DEVICE_INFORMATION_WRITE_RESULTS , 0x33FB0D11, 0x64A3, 0x4FAC, 0xB4, 0xC7, 0x3D, 0xFE, 0xAA, 0x99, 0xB0, 0x51 , 1002 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CLASS_EXTENSION_V2 -* -* The commands in this category relate to the WPD device class extension. -****************************************************************************/ -DEFINE_GUID( WPD_CLASS_EXTENSION_V2 , 0x7F0779B5, 0xFA2B, 0x4766, 0x9C, 0xB2, 0xF7, 0x3B, 0xA3, 0x0B, 0x67, 0x58 ); - -// ======== Commands ======== - -// -// WPD_COMMAND_CLASS_EXTENSION_REGISTER_SERVICE_INTERFACES -// This command is used to register a service's Plug and Play interfaces. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_CLASS_EXTENSION_SERVICE_OBJECT_ID -// [ Required ] WPD_PROPERTY_CLASS_EXTENSION_SERVICE_INTERFACES -// Results: -// [ Required ] WPD_PROPERTY_CLASS_EXTENSION_SERVICE_REGISTRATION_RESULTS -DEFINE_PROPERTYKEY( WPD_COMMAND_CLASS_EXTENSION_REGISTER_SERVICE_INTERFACES , 0x7F0779B5, 0xFA2B, 0x4766, 0x9C, 0xB2, 0xF7, 0x3B, 0xA3, 0x0B, 0x67, 0x58 , 2 ); -// -// WPD_COMMAND_CLASS_EXTENSION_UNREGISTER_SERVICE_INTERFACES -// This command is used to unregister a service's Plug and Play interfaces. -// Access: -// (FILE_READ_ACCESS | FILE_WRITE_ACCESS) -// Parameters: -// [ Required ] WPD_PROPERTY_CLASS_EXTENSION_SERVICE_OBJECT_ID -// [ Required ] WPD_PROPERTY_CLASS_EXTENSION_SERVICE_INTERFACES -// Results: -// [ Required ] WPD_PROPERTY_CLASS_EXTENSION_SERVICE_REGISTRATION_RESULTS -DEFINE_PROPERTYKEY( WPD_COMMAND_CLASS_EXTENSION_UNREGISTER_SERVICE_INTERFACES , 0x7F0779B5, 0xFA2B, 0x4766, 0x9C, 0xB2, 0xF7, 0x3B, 0xA3, 0x0B, 0x67, 0x58 , 3 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_CLASS_EXTENSION_SERVICE_OBJECT_ID -// [ VT_LPWSTR ] The Object ID of the service. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CLASS_EXTENSION_SERVICE_OBJECT_ID , 0x7F0779B5, 0xFA2B, 0x4766, 0x9C, 0xB2, 0xF7, 0x3B, 0xA3, 0x0B, 0x67, 0x58 , 1001 ); -// -// WPD_PROPERTY_CLASS_EXTENSION_SERVICE_INTERFACES -// [ VT_UNKNOWN ] This is an IPortablePropVariantCollection of type VT_CLSID which contains the interface GUIDs that this service implements, including the service type GUID. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CLASS_EXTENSION_SERVICE_INTERFACES , 0x7F0779B5, 0xFA2B, 0x4766, 0x9C, 0xB2, 0xF7, 0x3B, 0xA3, 0x0B, 0x67, 0x58 , 1002 ); -// -// WPD_PROPERTY_CLASS_EXTENSION_SERVICE_REGISTRATION_RESULTS -// [ VT_UNKNOWN ] This is an IPortablePropVariantCollection of type VT_ERROR, where each element is the HRESULT indicating the success or failure of the operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_CLASS_EXTENSION_SERVICE_REGISTRATION_RESULTS , 0x7F0779B5, 0xFA2B, 0x4766, 0x9C, 0xB2, 0xF7, 0x3B, 0xA3, 0x0B, 0x67, 0x58 , 1003 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_SERVICE_COMMON -* -* The commands in this category relate to a device service. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_SERVICE_COMMON , 0x322F071D, 0x36EF, 0x477F, 0xB4, 0xB5, 0x6F, 0x52, 0xD7, 0x34, 0xBA, 0xEE ); - -// ======== Commands ======== - -// -// WPD_COMMAND_SERVICE_COMMON_GET_SERVICE_OBJECT_ID -// This command is used to get the service object identifier. -// Access: -// FILE_READ_ACCESS -// Parameters: -// None -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_OBJECT_ID -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_COMMON_GET_SERVICE_OBJECT_ID , 0x322F071D, 0x36EF, 0x477F, 0xB4, 0xB5, 0x6F, 0x52, 0xD7, 0x34, 0xBA, 0xEE , 2 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_SERVICE_OBJECT_ID -// [ VT_LPWSTR ] Contains the service object identifier. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_OBJECT_ID , 0x322F071D, 0x36EF, 0x477F, 0xB4, 0xB5, 0x6F, 0x52, 0xD7, 0x34, 0xBA, 0xEE , 1001 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_SERVICE_CAPABILITIES -* -* The commands in this category relate to capabilities of a device service. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_SERVICE_CAPABILITIES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 ); - -// ======== Commands ======== - -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_METHODS -// This command is used to get the methods that apply to a service. -// Access: -// FILE_READ_ACCESS -// Parameters: -// None -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_METHODS -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_METHODS , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 2 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_METHODS_BY_FORMAT -// This command is used to get the methods that apply to a format of a service. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_METHODS -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_METHODS_BY_FORMAT , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 3 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_METHOD_ATTRIBUTES -// This command is used to get the attributes of a method. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_METHOD -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_METHOD_ATTRIBUTES -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_METHOD_ATTRIBUTES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 4 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_METHOD_PARAMETER_ATTRIBUTES -// This command is used to get the attributes of a parameter used in a method. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_METHOD -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_PARAMETER -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_PARAMETER_ATTRIBUTES -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_METHOD_PARAMETER_ATTRIBUTES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 5 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_FORMATS -// This command is used to get formats supported by this service. -// Access: -// FILE_READ_ACCESS -// Parameters: -// None -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_FORMATS -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_FORMATS , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 6 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_ATTRIBUTES -// This command is used to get attributes of a format, such as the format name. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT_ATTRIBUTES -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_ATTRIBUTES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 7 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_FORMAT_PROPERTIES -// This command is used to get supported properties of a format. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_PROPERTY_KEYS -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_FORMAT_PROPERTIES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 8 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_PROPERTY_ATTRIBUTES -// This command is used to get the property attributes that are same for all objects of a given format on the service. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_PROPERTY_KEYS -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_PROPERTY_ATTRIBUTES -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_PROPERTY_ATTRIBUTES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 9 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_EVENTS -// This command is used to get the supported events of the service. -// Access: -// FILE_READ_ACCESS -// Parameters: -// None -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_EVENTS -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_EVENTS , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 10 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_EVENT_ATTRIBUTES -// This command is used to get the attributes of an event. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_EVENT -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_EVENT_ATTRIBUTES -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_EVENT_ATTRIBUTES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 11 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_EVENT_PARAMETER_ATTRIBUTES -// This command is used to get the attributes of a parameter used in an event. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_EVENT -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_PARAMETER -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_PARAMETER_ATTRIBUTES -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_EVENT_PARAMETER_ATTRIBUTES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 12 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_INHERITED_SERVICES -// This command is used to get the inherited services. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_INHERITANCE_TYPE -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_INHERITED_SERVICES -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_INHERITED_SERVICES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 13 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_RENDERING_PROFILES -// This command is used to get the resource rendering profiles for a format. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_RENDERING_PROFILES -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_RENDERING_PROFILES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 14 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_COMMANDS -// Return all commands supported by this driver for a service. This includes custom commands, if any. -// Access: -// FILE_READ_ACCESS -// Parameters: -// None -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_COMMANDS -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_COMMANDS , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 15 ); -// -// WPD_COMMAND_SERVICE_CAPABILITIES_GET_COMMAND_OPTIONS -// Returns the supported options for the specified command. -// Access: -// FILE_READ_ACCESS -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_COMMAND -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_CAPABILITIES_COMMAND_OPTIONS -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_COMMAND_OPTIONS , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 16 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_METHODS -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection (of type VT_CLSID) containing methods that apply to a service. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_METHODS , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1001 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT -// [ VT_CLSID ] Indicates the format the caller is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1002 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_METHOD -// [ VT_CLSID ] Indicates the method the caller is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_METHOD , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1003 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_METHOD_ATTRIBUTES -// [ VT_UNKNOWN ] IPortableDeviceValues containing the method attributes. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_METHOD_ATTRIBUTES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1004 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_PARAMETER -// [ VT_UNKNOWN ] IPortableDeviceKeyCollection containing the parameter the caller is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_PARAMETER , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1005 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_PARAMETER_ATTRIBUTES -// [ VT_UNKNOWN ] IPortableDeviceValues containing the parameter attributes. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_PARAMETER_ATTRIBUTES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1006 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_FORMATS -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection (of type VT_CLSID) containing the formats. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_FORMATS , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1007 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT_ATTRIBUTES -// [ VT_UNKNOWN ] IPortableDeviceValues containing the format attributes, such as the format name and MIME Type. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT_ATTRIBUTES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1008 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_PROPERTY_KEYS -// [ VT_UNKNOWN ] IPortableDeviceKeyCollection containing the supported property keys. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_PROPERTY_KEYS , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1009 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_PROPERTY_ATTRIBUTES -// [ VT_UNKNOWN ] IPortableDeviceValues containing the property attributes. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_PROPERTY_ATTRIBUTES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1010 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_EVENTS -// [ VT_UNKNOWN ] IPortableDevicePropVariantCollection (of type VT_CLSID) containing all events supported by the service. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_EVENTS , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1011 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_EVENT -// [ VT_CLSID ] Indicates the event the caller is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_EVENT , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1012 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_EVENT_ATTRIBUTES -// [ VT_UNKNOWN ] IPortableDeviceValues containing the event attributes. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_EVENT_ATTRIBUTES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1013 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_INHERITANCE_TYPE -// [ VT_UI4 ] Indicates the inheritance type the caller is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_INHERITANCE_TYPE , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1014 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_INHERITED_SERVICES -// [ VT_UNKNOWN ] Contains the list of inherited services. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_INHERITED_SERVICES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1015 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_RENDERING_PROFILES -// [ VT_UNKNOWN ] Contains the list of format rendering profiles. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_RENDERING_PROFILES , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1016 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_COMMANDS -// [ VT_UNKNOWN ] IPortableDeviceKeyCollection containing all commands a driver supports for a service. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_COMMANDS , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1017 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_COMMAND -// [ VT_UNKNOWN ] Indicates the command whose options the caller is interested in. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_COMMAND , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1018 ); -// -// WPD_PROPERTY_SERVICE_CAPABILITIES_COMMAND_OPTIONS -// [ VT_UNKNOWN ] Contains an IPortableDeviceValues with the relevant command options. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_CAPABILITIES_COMMAND_OPTIONS , 0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89 , 1019 ); - -/**************************************************************************** -* This section defines all Commands, Parameters and Options associated with: -* WPD_CATEGORY_SERVICE_METHODS -* -* The commands in this category relate to methods of a device service. -****************************************************************************/ -DEFINE_GUID( WPD_CATEGORY_SERVICE_METHODS , 0x2D521CA8,0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC ); - -// ======== Commands ======== - -// -// WPD_COMMAND_SERVICE_METHODS_START_INVOKE -// Invokes a service method. -// Access: -// Dependent on the value of WPD_METHOD_ATTRIBUTE_ACCESS. -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_METHOD -// [ Required ] WPD_PROPERTY_SERVICE_METHOD_PARAMETER_VALUES -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_METHOD_CONTEXT -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_METHODS_START_INVOKE , 0x2D521CA8,0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC , 2 ); -// -// WPD_COMMAND_SERVICE_METHODS_CANCEL_INVOKE -// This command is sent when a client wants to cancel a method that is currently still in progress. -// Access: -// Dependent on the value of WPD_METHOD_ATTRIBUTE_ACCESS. -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_METHOD_CONTEXT -// Results: -// None -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_METHODS_CANCEL_INVOKE , 0x2D521CA8,0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC , 3 ); -// -// WPD_COMMAND_SERVICE_METHODS_END_INVOKE -// This command is sent in response to a WPD_EVENT_SERVICE_METHOD_COMPLETE event from the driver to retrieve the method results. -// Access: -// Dependent on the value of WPD_METHOD_ATTRIBUTE_ACCESS. -// Parameters: -// [ Required ] WPD_PROPERTY_SERVICE_METHOD_CONTEXT -// Results: -// [ Required ] WPD_PROPERTY_SERVICE_METHOD_RESULT_VALUES -// [ Required ] WPD_PROPERTY_SERVICE_METHOD_HRESULT -DEFINE_PROPERTYKEY( WPD_COMMAND_SERVICE_METHODS_END_INVOKE , 0x2D521CA8,0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC , 4 ); - -// ======== Command Parameters ======== - -// -// WPD_PROPERTY_SERVICE_METHOD -// [ VT_CLSID ] Indicates the method to invoke. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_METHOD , 0x2D521CA8,0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC , 1001 ); -// -// WPD_PROPERTY_SERVICE_METHOD_PARAMETER_VALUES -// [ VT_UNKNOWN ] IPortableDeviceValues containing the method parameters. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_METHOD_PARAMETER_VALUES , 0x2D521CA8,0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC , 1002 ); -// -// WPD_PROPERTY_SERVICE_METHOD_RESULT_VALUES -// [ VT_UNKNOWN ] IPortableDeviceValues containing the method results. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_METHOD_RESULT_VALUES , 0x2D521CA8,0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC , 1003 ); -// -// WPD_PROPERTY_SERVICE_METHOD_CONTEXT -// [ VT_LPWSTR ] The unique context identifying this method operation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_METHOD_CONTEXT , 0x2D521CA8,0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC , 1004 ); -// -// WPD_PROPERTY_SERVICE_METHOD_HRESULT -// [ VT_ERROR ] Contains the status HRESULT of this method invocation. -DEFINE_PROPERTYKEY( WPD_PROPERTY_SERVICE_METHOD_HRESULT , 0x2D521CA8,0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC , 1005 ); - -/**************************************************************************** -* This section defines Structures and Macros used by driver writers to -* simplify Wpd Command Access checks. -* Sample Usage: -* -* - Add table used to lookup the Access required for Wpd Commands -* BEGIN_WPD_COMMAND_ACCESS_MAP(g_WpdCommandAccessMap) -* DECLARE_WPD_STANDARD_COMMAND_ACCESS_ENTRIES -* - Add any custom commands here e.g. -* WPD_COMMAND_ACCESS_ENTRY(MyCustomCommand, WPD_COMMAND_ACCESS_READWRITE) -* END_WPD_COMMAND_ACCESS_MAP -* - This enables the driver to use VERIFY_WPD_COMMAND_ACCESS to check command access function for us. -* DECLARE_VERIFY_WPD_COMMAND_ACCESS; -* ... -* - When the driver receives a WPD IOCTL, it can check that the IOCTL specified matches -* the command payload with: -* hr = VERIFY_WPD_COMMAND_ACCESS(ControlCode, pParams, g_WpdCommandAccessMap); -****************************************************************************/ - -// Structure used as an entry in the Command / Access lookup table. -typedef struct tagWPD_COMMAND_ACCESS_LOOKUP_ENTRY -{ - PROPERTYKEY Command; - DWORD AccessType; - PROPERTYKEY AccessProperty; -} WPD_COMMAND_ACCESS_LOOKUP_ENTRY; - -// Used to start a declaration of a WPD Command Access Lookup Map. This macro is usually followed by: -// DECLARE_WPD_STANDARD_COMMAND_ACCESS_ENTRIES -// Zero or more WPD_COMMAND_ACCESS_ENTRY or WPD_COMMAND_ACCESS_PROPERTY_ENTRY macros (one for every custom command). -// The Map is ended with END_WPD_COMMAND_ACCESS_MAP. -#define BEGIN_WPD_COMMAND_ACCESS_MAP(x) static WPD_COMMAND_ACCESS_LOOKUP_ENTRY x[] = { - -// Ends a WPD Command Access Lookup Map started with BEGIN_WPD_COMMAND_ACCESS_MAP -#define END_WPD_COMMAND_ACCESS_MAP { WPD_PROPERTY_NULL, 0, WPD_PROPERTY_NULL }, }; - -// Adds a custom entry to a WPD Command Access Lookup Map started with BEGIN_WPD_COMMAND_ACCESS_MAP -#define WPD_COMMAND_ACCESS_ENTRY(WpdCommand, WpdCommandAccessType) { WpdCommand, WpdCommandAccessType, WPD_PROPERTY_NULL }, - -// Adds a custom entry to a WPD Command Access Lookup Map started with BEGIN_WPD_COMMAND_ACCESS_MAP -#define WPD_COMMAND_ACCESS_PROPERTY_ENTRY(WpdCommand, WpdCommandAccessType, WpdAccessProperty) { WpdCommand, WpdCommandAccessType, WpdAccessProperty }, - -#ifdef WPD_SERVICES_STRICT -#define DECLARE_WPD_LEGACY_COMMAND_ACCESS_ENTRIES -#else -#define DECLARE_WPD_LEGACY_COMMAND_ACCESS_ENTRIES \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_STORAGE_FORMAT, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_STORAGE_EJECT, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SMS_SEND, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_STILL_IMAGE_CAPTURE_INITIATE, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_MEDIA_CAPTURE_START, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_MEDIA_CAPTURE_STOP, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_MEDIA_CAPTURE_PAUSE, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_DEVICE_HINTS_GET_CONTENT_LOCATION, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_GENERATE_KEYPAIR, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_COMMIT_KEYPAIR, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_PROCESS_WIRELESS_PROFILE, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - -#endif // WPD_SERVICES_STRICT - -// Declares entries for all the WPD Commands contained in this header file. Used after BEGIN_WPD_COMMAND_ACCESS_MAP. -#define DECLARE_WPD_STANDARD_COMMAND_ACCESS_ENTRIES \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_COMMON_RESET_DEVICE, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_COMMON_GET_OBJECT_IDS_FROM_PERSISTENT_UNIQUE_IDS, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_COMMON_SAVE_CLIENT_INFORMATION, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_ENUMERATION_START_FIND, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_ENUMERATION_FIND_NEXT, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_ENUMERATION_END_FIND, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_GET_SUPPORTED, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_GET_ATTRIBUTES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_GET, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_SET, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_GET_ALL, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_DELETE, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_LIST_START, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_LIST_NEXT, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_LIST_END, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_FORMAT_START, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_FORMAT_NEXT, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_FORMAT_END, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_SET_VALUES_BY_OBJECT_LIST_START, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_SET_VALUES_BY_OBJECT_LIST_NEXT, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_PROPERTIES_BULK_SET_VALUES_BY_OBJECT_LIST_END, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_RESOURCES_GET_SUPPORTED, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_RESOURCES_GET_ATTRIBUTES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_RESOURCES_OPEN, WPD_COMMAND_ACCESS_FROM_PROPERTY_WITH_STGM_ACCESS, WPD_PROPERTY_OBJECT_RESOURCES_ACCESS_MODE ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_RESOURCES_READ, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_RESOURCES_WRITE, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_RESOURCES_CLOSE, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_RESOURCES_DELETE, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_RESOURCES_CREATE_RESOURCE, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_RESOURCES_REVERT, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_RESOURCES_SEEK, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_ONLY, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_AND_DATA, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_MANAGEMENT_WRITE_OBJECT_DATA, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_MANAGEMENT_COMMIT_OBJECT, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_MANAGEMENT_REVERT_OBJECT, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_MANAGEMENT_DELETE_OBJECTS, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_MANAGEMENT_MOVE_OBJECTS, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_MANAGEMENT_COPY_OBJECTS, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_OBJECT_MANAGEMENT_UPDATE_OBJECT_WITH_PROPERTIES_AND_DATA, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_COMMANDS, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CAPABILITIES_GET_COMMAND_OPTIONS, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FUNCTIONAL_CATEGORIES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CAPABILITIES_GET_FUNCTIONAL_OBJECTS, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_CONTENT_TYPES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FORMATS, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FORMAT_PROPERTIES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CAPABILITIES_GET_FIXED_PROPERTY_ATTRIBUTES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_EVENTS, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CAPABILITIES_GET_EVENT_OPTIONS, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CLASS_EXTENSION_WRITE_DEVICE_INFORMATION, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CLASS_EXTENSION_REGISTER_SERVICE_INTERFACES, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_CLASS_EXTENSION_UNREGISTER_SERVICE_INTERFACES, WPD_COMMAND_ACCESS_READWRITE, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_COMMON_GET_SERVICE_OBJECT_ID, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_METHODS, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_METHODS_BY_FORMAT, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_METHOD_ATTRIBUTES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_METHOD_PARAMETER_ATTRIBUTES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_FORMATS, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_ATTRIBUTES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_FORMAT_PROPERTIES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_PROPERTY_ATTRIBUTES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_EVENTS, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_EVENT_ATTRIBUTES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_EVENT_PARAMETER_ATTRIBUTES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_INHERITED_SERVICES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_RENDERING_PROFILES, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_COMMANDS, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_CAPABILITIES_GET_COMMAND_OPTIONS, WPD_COMMAND_ACCESS_READ, WPD_PROPERTY_NULL ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_METHODS_START_INVOKE, WPD_COMMAND_ACCESS_FROM_ATTRIBUTE_WITH_METHOD_ACCESS, WPD_METHOD_ATTRIBUTE_ACCESS ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_METHODS_CANCEL_INVOKE, WPD_COMMAND_ACCESS_FROM_ATTRIBUTE_WITH_METHOD_ACCESS, WPD_METHOD_ATTRIBUTE_ACCESS ) \ - WPD_COMMAND_ACCESS_PROPERTY_ENTRY( WPD_COMMAND_SERVICE_METHODS_END_INVOKE, WPD_COMMAND_ACCESS_FROM_ATTRIBUTE_WITH_METHOD_ACCESS, WPD_METHOD_ATTRIBUTE_ACCESS ) \ - DECLARE_WPD_LEGACY_COMMAND_ACCESS_ENTRIES - - -// Declares an instance of the function used to check whether a WPD Command is in the driver's WPD Command Access Map. -// Driver writers should not call this function directly, but should instead use the IS_COMMAND_IN_WPD_COMMAND_ACCESS_MAP alias. -#define DECLARE_IS_COMMAND_IN_WPD_COMMAND_ACCESS_MAP() \ -BOOL IsCommandInWpdCommandAccessMap( \ - REFPROPERTYKEY WpdCommand, \ - __in WPD_COMMAND_ACCESS_LOOKUP_ENTRY *pCommandAccessLookupMap) \ -{ \ - BOOL bRet = FALSE; \ - if(pCommandParams == NULL) \ - { \ - return E_POINTER; \ - } \ - while(pCommandAccessLookupMap[dwMapIndex++].Command != WPD_PROPERTY_NULL) \ - { \ - if(IsEqualPropertyKey(pCommandAccessLookupMap[dwMapIndex].Command), WpdCommand) \ - { \ - bRet = TRUE; \ - break; \ - } \ - dwMapIndex++; \ - } \ - return bRet; \ -}; - -// This macro is an alias for the function used to check whether a WPD Command is in the driver's WPD Command Access Map (see BEGIN_WPD_COMMAND_ACCESS_MAP) -#define IS_COMMAND_IN_WPD_COMMAND_ACCESS_MAP IsCommandInWpdCommandAccessMap - - -// Declares an instance of the function used to verify that WPD Commands are sent with the appropriate Access Flags in the IOCTL. -// Driver writers should not call this function directly, but should instead use the VERIFY_WPD_COMMAND_ACCESS alias. -#define DECLARE_VERIFY_WPD_COMMAND_ACCESS \ -HRESULT VerifyWpdCommandAccessFromMap( \ - const DWORD ControlCode, \ - __in IPortableDeviceValues *pCommandParams, \ - __in WPD_COMMAND_ACCESS_LOOKUP_ENTRY *pCommandAccessLookupMap) \ -{ \ - HRESULT hr = S_OK; \ - DWORD dwMapIndex = 0; \ - PROPERTYKEY WpdCommand = WPD_PROPERTY_NULL; \ - DWORD dwExpectedControlCode = IOCTL_WPD_MESSAGE_READWRITE_ACCESS; \ - if((pCommandParams == NULL) || (pCommandAccessLookupMap == NULL)) \ - { \ - return E_POINTER; \ - } \ - if(ControlCode == IOCTL_WPD_MESSAGE_READWRITE_ACCESS) \ - { \ - return S_OK; \ - } \ - hr = pCommandParams->GetGuidValue(WPD_PROPERTY_COMMON_COMMAND_CATEGORY, &WpdCommand.fmtid); \ - if(SUCCEEDED(hr)) \ - { \ - hr = pCommandParams->GetUnsignedIntegerValue(WPD_PROPERTY_COMMON_COMMAND_ID, &WpdCommand.pid); \ - if(SUCCEEDED(hr)) \ - { \ - while(!IsEqualPropertyKey(pCommandAccessLookupMap[dwMapIndex].Command, WPD_PROPERTY_NULL)) \ - { \ - if(IsEqualPropertyKey(pCommandAccessLookupMap[dwMapIndex].Command, WpdCommand)) \ - { \ - switch(pCommandAccessLookupMap[dwMapIndex].AccessType) \ - { \ - case WPD_COMMAND_ACCESS_READ: \ - { \ - dwExpectedControlCode = IOCTL_WPD_MESSAGE_READ_ACCESS; \ - } \ - break; \ - case WPD_COMMAND_ACCESS_READWRITE: \ - { \ - dwExpectedControlCode = IOCTL_WPD_MESSAGE_READWRITE_ACCESS; \ - } \ - break; \ - case WPD_COMMAND_ACCESS_FROM_PROPERTY_WITH_STGM_ACCESS: \ - { \ - DWORD dwAccessPropVal = STGM_READWRITE; \ - HRESULT hrTemp = S_OK; \ - hrTemp = pCommandParams->GetUnsignedIntegerValue(pCommandAccessLookupMap[dwMapIndex].AccessProperty, &dwAccessPropVal); \ - if(dwAccessPropVal == STGM_READ) \ - { \ - dwExpectedControlCode = IOCTL_WPD_MESSAGE_READ_ACCESS; \ - } \ - else \ - { \ - dwExpectedControlCode = IOCTL_WPD_MESSAGE_READWRITE_ACCESS; \ - } \ - } \ - break; \ - case WPD_COMMAND_ACCESS_FROM_PROPERTY_WITH_FILE_ACCESS: \ - { \ - DWORD dwAccessPropVal = FILE_READ_ACCESS; \ - HRESULT hrTemp = S_OK; \ - hrTemp = pCommandParams->GetUnsignedIntegerValue(pCommandAccessLookupMap[dwMapIndex].AccessProperty, &dwAccessPropVal); \ - if(dwAccessPropVal == FILE_READ_ACCESS) \ - { \ - dwExpectedControlCode = IOCTL_WPD_MESSAGE_READ_ACCESS; \ - } \ - else \ - { \ - dwExpectedControlCode = IOCTL_WPD_MESSAGE_READWRITE_ACCESS; \ - } \ - } \ - break; \ - default: \ - { \ - dwExpectedControlCode = IOCTL_WPD_MESSAGE_READWRITE_ACCESS; \ - } \ - break; \ - } \ - break; \ - } \ - dwMapIndex++; \ - } \ - } \ - } \ - if(SUCCEEDED(hr)) \ - { \ - if(ControlCode != dwExpectedControlCode) \ - { \ - return E_INVALIDARG; \ - } \ - } \ - return hr; \ -}; - -// This macro is an alias for the function used to verify that WPD Commands are sent with the appropriate Access Flags in the IOCTL -#define VERIFY_WPD_COMMAND_ACCESS VerifyWpdCommandAccessFromMap - -/**************************************************************************** -* This section defines the inline helper functions -****************************************************************************/ - -// This function can be used after IPortableDeviceManager::GetDevices(..) and IPortableDeviceServiceManager::GetDeviceServices(..) -// to free the elements of the pPnPIDs array. The caller is responsible for freeing pPnPIDs when this function completes. -inline void FreePortableDevicePnPIDs(__in_ecount(cPnPIDs) LPWSTR* pPnPIDs, DWORD cPnPIDs) -{ - if (pPnPIDs != NULL) - { - for (DWORD i=0; i= NTDDI_WINXPSP2 && NTDDI_VERSION < NTDDI_WS03) || (NTDDI_VERSION >= NTDDI_WINLH)) - diff --git a/pub/ddk/portabledeviceclassextension.h b/pub/ddk/portabledeviceclassextension.h deleted file mode 100644 index 7cdc320..0000000 --- a/pub/ddk/portabledeviceclassextension.h +++ /dev/null @@ -1,229 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for PortableDeviceClassExtension.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __PortableDeviceClassExtension_h__ -#define __PortableDeviceClassExtension_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IPortableDeviceClassExtension_FWD_DEFINED__ -#define __IPortableDeviceClassExtension_FWD_DEFINED__ -typedef interface IPortableDeviceClassExtension IPortableDeviceClassExtension; -#endif /* __IPortableDeviceClassExtension_FWD_DEFINED__ */ - - -#ifndef __PortableDeviceClassExtension_FWD_DEFINED__ -#define __PortableDeviceClassExtension_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class PortableDeviceClassExtension PortableDeviceClassExtension; -#else -typedef struct PortableDeviceClassExtension PortableDeviceClassExtension; -#endif /* __cplusplus */ - -#endif /* __PortableDeviceClassExtension_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" -#include "ocidl.h" -#include "propidl.h" -#include "PortableDeviceTypes.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_PortableDeviceClassExtension_0000_0000 */ -/* [local] */ - -#if (_WIN32_WINNT >= 0x0501) // XP and later - - -extern RPC_IF_HANDLE __MIDL_itf_PortableDeviceClassExtension_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_PortableDeviceClassExtension_0000_0000_v0_0_s_ifspec; - -#ifndef __IPortableDeviceClassExtension_INTERFACE_DEFINED__ -#define __IPortableDeviceClassExtension_INTERFACE_DEFINED__ - -/* interface IPortableDeviceClassExtension */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IPortableDeviceClassExtension; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("bc08386a-9952-40cd-ba50-9541d64a4b4e") - IPortableDeviceClassExtension : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Initialize( - __RPC__in_opt IUnknown *pWdfDeviceUnknown, - __RPC__in_opt IPortableDeviceValues *pOptions) = 0; - - virtual HRESULT STDMETHODCALLTYPE Uninitialize( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE ProcessLibraryMessage( - __RPC__in_opt IPortableDeviceValues *pParams, - __RPC__in_opt IPortableDeviceValues *pResults) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPortableDeviceClassExtensionVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IPortableDeviceClassExtension * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IPortableDeviceClassExtension * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IPortableDeviceClassExtension * This); - - HRESULT ( STDMETHODCALLTYPE *Initialize )( - __RPC__in IPortableDeviceClassExtension * This, - __RPC__in_opt IUnknown *pWdfDeviceUnknown, - __RPC__in_opt IPortableDeviceValues *pOptions); - - HRESULT ( STDMETHODCALLTYPE *Uninitialize )( - __RPC__in IPortableDeviceClassExtension * This); - - HRESULT ( STDMETHODCALLTYPE *ProcessLibraryMessage )( - __RPC__in IPortableDeviceClassExtension * This, - __RPC__in_opt IPortableDeviceValues *pParams, - __RPC__in_opt IPortableDeviceValues *pResults); - - END_INTERFACE - } IPortableDeviceClassExtensionVtbl; - - interface IPortableDeviceClassExtension - { - CONST_VTBL struct IPortableDeviceClassExtensionVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPortableDeviceClassExtension_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPortableDeviceClassExtension_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPortableDeviceClassExtension_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPortableDeviceClassExtension_Initialize(This,pWdfDeviceUnknown,pOptions) \ - ( (This)->lpVtbl -> Initialize(This,pWdfDeviceUnknown,pOptions) ) - -#define IPortableDeviceClassExtension_Uninitialize(This) \ - ( (This)->lpVtbl -> Uninitialize(This) ) - -#define IPortableDeviceClassExtension_ProcessLibraryMessage(This,pParams,pResults) \ - ( (This)->lpVtbl -> ProcessLibraryMessage(This,pParams,pResults) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPortableDeviceClassExtension_INTERFACE_DEFINED__ */ - - - -#ifndef __PortableDeviceClassExtension_LIBRARY_DEFINED__ -#define __PortableDeviceClassExtension_LIBRARY_DEFINED__ - -/* library PortableDeviceClassExtension */ -/* [helpstring][version][uuid] */ - - -EXTERN_C const IID LIBID_PortableDeviceClassExtension; - -EXTERN_C const CLSID CLSID_PortableDeviceClassExtension; - -#ifdef __cplusplus - -class DECLSPEC_UUID("4cadfae1-5512-456a-9d65-5b5e7e9ca9a3") -PortableDeviceClassExtension; -#endif -#endif /* __PortableDeviceClassExtension_LIBRARY_DEFINED__ */ - -/* interface __MIDL_itf_PortableDeviceClassExtension_0000_0001 */ -/* [local] */ - -#endif // (_WIN32_WINNT >= 0x0501) - - -extern RPC_IF_HANDLE __MIDL_itf_PortableDeviceClassExtension_0000_0001_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_PortableDeviceClassExtension_0000_0001_v0_0_s_ifspec; - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/portabledeviceclassextension.idl b/pub/ddk/portabledeviceclassextension.idl deleted file mode 100644 index 8df8eaf..0000000 --- a/pub/ddk/portabledeviceclassextension.idl +++ /dev/null @@ -1,66 +0,0 @@ -//----------------------------------------------------------------------------- -// -// @module PortableDeviceClassExtension.idl -// -// @abstract This file contains help interface desc for drivers installed under -// the Portable Device Class. -// -// @copyright (C) COPYRIGHT MICROSOFT CORPORATION -// -//----------------------------------------------------------------------------- - -cpp_quote("#if (_WIN32_WINNT >= 0x0501) // XP and later") - -import "oaidl.idl"; -import "ocidl.idl"; -import "propidl.idl"; -import "wtypes.idl"; - -import "PortableDeviceTypes.idl"; - -/////////////////////////////////////////////////////////// -// IWpdSerializer -//--------------------------------------------------------- -//--------------------------------------------------------- -// -[ - object, - uuid(bc08386a-9952-40cd-ba50-9541d64a4b4e), - helpstring("IPortableDeviceDriverLibrary Interface"), - pointer_default(unique) -] -interface IPortableDeviceClassExtension : IUnknown -{ - HRESULT Initialize(IUnknown* pWdfDeviceUnknown, IPortableDeviceValues* pOptions); - HRESULT Uninitialize(); - HRESULT ProcessLibraryMessage(IPortableDeviceValues* pParams, IPortableDeviceValues* pResults); -}; - -/////////////////////////////////////////////////////////// -// PortableDeviceClassExtension -//--------------------------------------------------------- -//--------------------------------------------------------- -// -[ - uuid(c0ffa723-ff4c-4983-8565-66d78e73036e), - version(1.0), - helpstring("PortableDeviceClassExtension 1.0 Type Library") -] -library PortableDeviceClassExtension -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - - [ - uuid(4cadfae1-5512-456a-9d65-5b5e7e9ca9a3), - helpstring("PortableDeviceClassExtension Class") - ] - coclass PortableDeviceClassExtension - { - [default] interface IPortableDeviceClassExtension; - }; - -}; - -cpp_quote("#endif // (_WIN32_WINNT >= 0x0501)") - diff --git a/pub/ddk/portabledevicetypes.h b/pub/ddk/portabledevicetypes.h deleted file mode 100644 index afdb66b..0000000 --- a/pub/ddk/portabledevicetypes.h +++ /dev/null @@ -1,1301 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for PortableDeviceTypes.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __PortableDeviceTypes_h__ -#define __PortableDeviceTypes_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IWpdSerializer_FWD_DEFINED__ -#define __IWpdSerializer_FWD_DEFINED__ -typedef interface IWpdSerializer IWpdSerializer; -#endif /* __IWpdSerializer_FWD_DEFINED__ */ - - -#ifndef __IPortableDeviceValues_FWD_DEFINED__ -#define __IPortableDeviceValues_FWD_DEFINED__ -typedef interface IPortableDeviceValues IPortableDeviceValues; -#endif /* __IPortableDeviceValues_FWD_DEFINED__ */ - - -#ifndef __IPortableDeviceKeyCollection_FWD_DEFINED__ -#define __IPortableDeviceKeyCollection_FWD_DEFINED__ -typedef interface IPortableDeviceKeyCollection IPortableDeviceKeyCollection; -#endif /* __IPortableDeviceKeyCollection_FWD_DEFINED__ */ - - -#ifndef __IPortableDevicePropVariantCollection_FWD_DEFINED__ -#define __IPortableDevicePropVariantCollection_FWD_DEFINED__ -typedef interface IPortableDevicePropVariantCollection IPortableDevicePropVariantCollection; -#endif /* __IPortableDevicePropVariantCollection_FWD_DEFINED__ */ - - -#ifndef __IPortableDeviceValuesCollection_FWD_DEFINED__ -#define __IPortableDeviceValuesCollection_FWD_DEFINED__ -typedef interface IPortableDeviceValuesCollection IPortableDeviceValuesCollection; -#endif /* __IPortableDeviceValuesCollection_FWD_DEFINED__ */ - - -#ifndef __WpdSerializer_FWD_DEFINED__ -#define __WpdSerializer_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class WpdSerializer WpdSerializer; -#else -typedef struct WpdSerializer WpdSerializer; -#endif /* __cplusplus */ - -#endif /* __WpdSerializer_FWD_DEFINED__ */ - - -#ifndef __PortableDeviceValues_FWD_DEFINED__ -#define __PortableDeviceValues_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class PortableDeviceValues PortableDeviceValues; -#else -typedef struct PortableDeviceValues PortableDeviceValues; -#endif /* __cplusplus */ - -#endif /* __PortableDeviceValues_FWD_DEFINED__ */ - - -#ifndef __PortableDeviceKeyCollection_FWD_DEFINED__ -#define __PortableDeviceKeyCollection_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class PortableDeviceKeyCollection PortableDeviceKeyCollection; -#else -typedef struct PortableDeviceKeyCollection PortableDeviceKeyCollection; -#endif /* __cplusplus */ - -#endif /* __PortableDeviceKeyCollection_FWD_DEFINED__ */ - - -#ifndef __PortableDevicePropVariantCollection_FWD_DEFINED__ -#define __PortableDevicePropVariantCollection_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class PortableDevicePropVariantCollection PortableDevicePropVariantCollection; -#else -typedef struct PortableDevicePropVariantCollection PortableDevicePropVariantCollection; -#endif /* __cplusplus */ - -#endif /* __PortableDevicePropVariantCollection_FWD_DEFINED__ */ - - -#ifndef __PortableDeviceValuesCollection_FWD_DEFINED__ -#define __PortableDeviceValuesCollection_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class PortableDeviceValuesCollection PortableDeviceValuesCollection; -#else -typedef struct PortableDeviceValuesCollection PortableDeviceValuesCollection; -#endif /* __cplusplus */ - -#endif /* __PortableDeviceValuesCollection_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" -#include "ocidl.h" -#include "propsys.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_PortableDeviceTypes_0000_0000 */ -/* [local] */ - -#if (_WIN32_WINNT >= 0x0501) // XP and later - - - - - - - -extern RPC_IF_HANDLE __MIDL_itf_PortableDeviceTypes_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_PortableDeviceTypes_0000_0000_v0_0_s_ifspec; - -#ifndef __IWpdSerializer_INTERFACE_DEFINED__ -#define __IWpdSerializer_INTERFACE_DEFINED__ - -/* interface IWpdSerializer */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWpdSerializer; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("b32f4002-bb27-45ff-af4f-06631c1e8dad") - IWpdSerializer : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetIPortableDeviceValuesFromBuffer( - /* [size_is][in] */ __RPC__in_ecount_full(dwInputBufferLength) BYTE *pBuffer, - /* [in] */ DWORD dwInputBufferLength, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValues **ppParams) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteIPortableDeviceValuesToBuffer( - /* [in] */ DWORD dwOutputBufferLength, - /* [in] */ __RPC__in_opt IPortableDeviceValues *pResults, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(dwOutputBufferLength, *pdwBytesWritten) BYTE *pBuffer, - /* [out] */ __RPC__out DWORD *pdwBytesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferFromIPortableDeviceValues( - /* [in] */ __RPC__in_opt IPortableDeviceValues *pSource, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pdwBufferSize) BYTE **ppBuffer, - /* [out] */ __RPC__out DWORD *pdwBufferSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSerializedSize( - /* [in] */ __RPC__in_opt IPortableDeviceValues *pSource, - /* [out] */ __RPC__out DWORD *pdwSize) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWpdSerializerVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWpdSerializer * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWpdSerializer * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWpdSerializer * This); - - HRESULT ( STDMETHODCALLTYPE *GetIPortableDeviceValuesFromBuffer )( - __RPC__in IWpdSerializer * This, - /* [size_is][in] */ __RPC__in_ecount_full(dwInputBufferLength) BYTE *pBuffer, - /* [in] */ DWORD dwInputBufferLength, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValues **ppParams); - - HRESULT ( STDMETHODCALLTYPE *WriteIPortableDeviceValuesToBuffer )( - __RPC__in IWpdSerializer * This, - /* [in] */ DWORD dwOutputBufferLength, - /* [in] */ __RPC__in_opt IPortableDeviceValues *pResults, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(dwOutputBufferLength, *pdwBytesWritten) BYTE *pBuffer, - /* [out] */ __RPC__out DWORD *pdwBytesWritten); - - HRESULT ( STDMETHODCALLTYPE *GetBufferFromIPortableDeviceValues )( - __RPC__in IWpdSerializer * This, - /* [in] */ __RPC__in_opt IPortableDeviceValues *pSource, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pdwBufferSize) BYTE **ppBuffer, - /* [out] */ __RPC__out DWORD *pdwBufferSize); - - HRESULT ( STDMETHODCALLTYPE *GetSerializedSize )( - __RPC__in IWpdSerializer * This, - /* [in] */ __RPC__in_opt IPortableDeviceValues *pSource, - /* [out] */ __RPC__out DWORD *pdwSize); - - END_INTERFACE - } IWpdSerializerVtbl; - - interface IWpdSerializer - { - CONST_VTBL struct IWpdSerializerVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWpdSerializer_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWpdSerializer_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWpdSerializer_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWpdSerializer_GetIPortableDeviceValuesFromBuffer(This,pBuffer,dwInputBufferLength,ppParams) \ - ( (This)->lpVtbl -> GetIPortableDeviceValuesFromBuffer(This,pBuffer,dwInputBufferLength,ppParams) ) - -#define IWpdSerializer_WriteIPortableDeviceValuesToBuffer(This,dwOutputBufferLength,pResults,pBuffer,pdwBytesWritten) \ - ( (This)->lpVtbl -> WriteIPortableDeviceValuesToBuffer(This,dwOutputBufferLength,pResults,pBuffer,pdwBytesWritten) ) - -#define IWpdSerializer_GetBufferFromIPortableDeviceValues(This,pSource,ppBuffer,pdwBufferSize) \ - ( (This)->lpVtbl -> GetBufferFromIPortableDeviceValues(This,pSource,ppBuffer,pdwBufferSize) ) - -#define IWpdSerializer_GetSerializedSize(This,pSource,pdwSize) \ - ( (This)->lpVtbl -> GetSerializedSize(This,pSource,pdwSize) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWpdSerializer_INTERFACE_DEFINED__ */ - - -#ifndef __IPortableDeviceValues_INTERFACE_DEFINED__ -#define __IPortableDeviceValues_INTERFACE_DEFINED__ - -/* interface IPortableDeviceValues */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IPortableDeviceValues; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6848f6f2-3155-4f86-b6f5-263eeeab3143") - IPortableDeviceValues : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetCount( - /* [in] */ __RPC__in DWORD *pcelt) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAt( - /* [in] */ const DWORD index, - /* [unique][out][in] */ __RPC__inout_opt PROPERTYKEY *pKey, - /* [unique][out][in] */ __RPC__inout_opt PROPVARIANT *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in const PROPVARIANT *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out PROPVARIANT *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetStringValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in LPCWSTR Value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStringValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__deref_out_opt LPWSTR *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetUnsignedIntegerValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const ULONG Value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetUnsignedIntegerValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out ULONG *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetSignedIntegerValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const LONG Value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSignedIntegerValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out LONG *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetUnsignedLargeIntegerValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const ULONGLONG Value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetUnsignedLargeIntegerValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out ULONGLONG *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetSignedLargeIntegerValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const LONGLONG Value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSignedLargeIntegerValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out LONGLONG *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloatValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const FLOAT Value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloatValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out FLOAT *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetErrorValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const HRESULT Value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetErrorValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out HRESULT *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetKeyValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in REFPROPERTYKEY Value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetKeyValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out PROPERTYKEY *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetBoolValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const BOOL Value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBoolValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out BOOL *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetIUnknownValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in_opt IUnknown *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetIUnknownValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__deref_out_opt IUnknown **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetGuidValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in REFGUID Value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGuidValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out GUID *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetBufferValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [size_is][in] */ __RPC__in_ecount_full(cbValue) BYTE *pValue, - /* [in] */ DWORD cbValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pcbValue) BYTE **ppValue, - /* [out] */ __RPC__out DWORD *pcbValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetIPortableDeviceValuesValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in_opt IPortableDeviceValues *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetIPortableDeviceValuesValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValues **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetIPortableDevicePropVariantCollectionValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in_opt IPortableDevicePropVariantCollection *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetIPortableDevicePropVariantCollectionValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__deref_out_opt IPortableDevicePropVariantCollection **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetIPortableDeviceKeyCollectionValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in_opt IPortableDeviceKeyCollection *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetIPortableDeviceKeyCollectionValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__deref_out_opt IPortableDeviceKeyCollection **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetIPortableDeviceValuesCollectionValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in_opt IPortableDeviceValuesCollection *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetIPortableDeviceValuesCollectionValue( - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValuesCollection **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemoveValue( - /* [in] */ __RPC__in REFPROPERTYKEY key) = 0; - - virtual HRESULT STDMETHODCALLTYPE CopyValuesFromPropertyStore( - /* [in] */ __RPC__in_opt IPropertyStore *pStore) = 0; - - virtual HRESULT STDMETHODCALLTYPE CopyValuesToPropertyStore( - /* [in] */ __RPC__in_opt IPropertyStore *pStore) = 0; - - virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPortableDeviceValuesVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IPortableDeviceValues * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IPortableDeviceValues * This); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in DWORD *pcelt); - - HRESULT ( STDMETHODCALLTYPE *GetAt )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ const DWORD index, - /* [unique][out][in] */ __RPC__inout_opt PROPERTYKEY *pKey, - /* [unique][out][in] */ __RPC__inout_opt PROPVARIANT *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in const PROPVARIANT *pValue); - - HRESULT ( STDMETHODCALLTYPE *GetValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out PROPVARIANT *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetStringValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in LPCWSTR Value); - - HRESULT ( STDMETHODCALLTYPE *GetStringValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__deref_out_opt LPWSTR *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetUnsignedIntegerValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const ULONG Value); - - HRESULT ( STDMETHODCALLTYPE *GetUnsignedIntegerValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out ULONG *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetSignedIntegerValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const LONG Value); - - HRESULT ( STDMETHODCALLTYPE *GetSignedIntegerValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out LONG *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetUnsignedLargeIntegerValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const ULONGLONG Value); - - HRESULT ( STDMETHODCALLTYPE *GetUnsignedLargeIntegerValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out ULONGLONG *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetSignedLargeIntegerValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const LONGLONG Value); - - HRESULT ( STDMETHODCALLTYPE *GetSignedLargeIntegerValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out LONGLONG *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetFloatValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const FLOAT Value); - - HRESULT ( STDMETHODCALLTYPE *GetFloatValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out FLOAT *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetErrorValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const HRESULT Value); - - HRESULT ( STDMETHODCALLTYPE *GetErrorValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out HRESULT *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetKeyValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in REFPROPERTYKEY Value); - - HRESULT ( STDMETHODCALLTYPE *GetKeyValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out PROPERTYKEY *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetBoolValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ const BOOL Value); - - HRESULT ( STDMETHODCALLTYPE *GetBoolValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out BOOL *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetIUnknownValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in_opt IUnknown *pValue); - - HRESULT ( STDMETHODCALLTYPE *GetIUnknownValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__deref_out_opt IUnknown **ppValue); - - HRESULT ( STDMETHODCALLTYPE *SetGuidValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in REFGUID Value); - - HRESULT ( STDMETHODCALLTYPE *GetGuidValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__out GUID *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetBufferValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [size_is][in] */ __RPC__in_ecount_full(cbValue) BYTE *pValue, - /* [in] */ DWORD cbValue); - - HRESULT ( STDMETHODCALLTYPE *GetBufferValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pcbValue) BYTE **ppValue, - /* [out] */ __RPC__out DWORD *pcbValue); - - HRESULT ( STDMETHODCALLTYPE *SetIPortableDeviceValuesValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in_opt IPortableDeviceValues *pValue); - - HRESULT ( STDMETHODCALLTYPE *GetIPortableDeviceValuesValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValues **ppValue); - - HRESULT ( STDMETHODCALLTYPE *SetIPortableDevicePropVariantCollectionValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in_opt IPortableDevicePropVariantCollection *pValue); - - HRESULT ( STDMETHODCALLTYPE *GetIPortableDevicePropVariantCollectionValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__deref_out_opt IPortableDevicePropVariantCollection **ppValue); - - HRESULT ( STDMETHODCALLTYPE *SetIPortableDeviceKeyCollectionValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in_opt IPortableDeviceKeyCollection *pValue); - - HRESULT ( STDMETHODCALLTYPE *GetIPortableDeviceKeyCollectionValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__deref_out_opt IPortableDeviceKeyCollection **ppValue); - - HRESULT ( STDMETHODCALLTYPE *SetIPortableDeviceValuesCollectionValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [in] */ __RPC__in_opt IPortableDeviceValuesCollection *pValue); - - HRESULT ( STDMETHODCALLTYPE *GetIPortableDeviceValuesCollectionValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValuesCollection **ppValue); - - HRESULT ( STDMETHODCALLTYPE *RemoveValue )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in REFPROPERTYKEY key); - - HRESULT ( STDMETHODCALLTYPE *CopyValuesFromPropertyStore )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in_opt IPropertyStore *pStore); - - HRESULT ( STDMETHODCALLTYPE *CopyValuesToPropertyStore )( - __RPC__in IPortableDeviceValues * This, - /* [in] */ __RPC__in_opt IPropertyStore *pStore); - - HRESULT ( STDMETHODCALLTYPE *Clear )( - __RPC__in IPortableDeviceValues * This); - - END_INTERFACE - } IPortableDeviceValuesVtbl; - - interface IPortableDeviceValues - { - CONST_VTBL struct IPortableDeviceValuesVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPortableDeviceValues_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPortableDeviceValues_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPortableDeviceValues_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPortableDeviceValues_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) - -#define IPortableDeviceValues_GetAt(This,index,pKey,pValue) \ - ( (This)->lpVtbl -> GetAt(This,index,pKey,pValue) ) - -#define IPortableDeviceValues_SetValue(This,key,pValue) \ - ( (This)->lpVtbl -> SetValue(This,key,pValue) ) - -#define IPortableDeviceValues_GetValue(This,key,pValue) \ - ( (This)->lpVtbl -> GetValue(This,key,pValue) ) - -#define IPortableDeviceValues_SetStringValue(This,key,Value) \ - ( (This)->lpVtbl -> SetStringValue(This,key,Value) ) - -#define IPortableDeviceValues_GetStringValue(This,key,pValue) \ - ( (This)->lpVtbl -> GetStringValue(This,key,pValue) ) - -#define IPortableDeviceValues_SetUnsignedIntegerValue(This,key,Value) \ - ( (This)->lpVtbl -> SetUnsignedIntegerValue(This,key,Value) ) - -#define IPortableDeviceValues_GetUnsignedIntegerValue(This,key,pValue) \ - ( (This)->lpVtbl -> GetUnsignedIntegerValue(This,key,pValue) ) - -#define IPortableDeviceValues_SetSignedIntegerValue(This,key,Value) \ - ( (This)->lpVtbl -> SetSignedIntegerValue(This,key,Value) ) - -#define IPortableDeviceValues_GetSignedIntegerValue(This,key,pValue) \ - ( (This)->lpVtbl -> GetSignedIntegerValue(This,key,pValue) ) - -#define IPortableDeviceValues_SetUnsignedLargeIntegerValue(This,key,Value) \ - ( (This)->lpVtbl -> SetUnsignedLargeIntegerValue(This,key,Value) ) - -#define IPortableDeviceValues_GetUnsignedLargeIntegerValue(This,key,pValue) \ - ( (This)->lpVtbl -> GetUnsignedLargeIntegerValue(This,key,pValue) ) - -#define IPortableDeviceValues_SetSignedLargeIntegerValue(This,key,Value) \ - ( (This)->lpVtbl -> SetSignedLargeIntegerValue(This,key,Value) ) - -#define IPortableDeviceValues_GetSignedLargeIntegerValue(This,key,pValue) \ - ( (This)->lpVtbl -> GetSignedLargeIntegerValue(This,key,pValue) ) - -#define IPortableDeviceValues_SetFloatValue(This,key,Value) \ - ( (This)->lpVtbl -> SetFloatValue(This,key,Value) ) - -#define IPortableDeviceValues_GetFloatValue(This,key,pValue) \ - ( (This)->lpVtbl -> GetFloatValue(This,key,pValue) ) - -#define IPortableDeviceValues_SetErrorValue(This,key,Value) \ - ( (This)->lpVtbl -> SetErrorValue(This,key,Value) ) - -#define IPortableDeviceValues_GetErrorValue(This,key,pValue) \ - ( (This)->lpVtbl -> GetErrorValue(This,key,pValue) ) - -#define IPortableDeviceValues_SetKeyValue(This,key,Value) \ - ( (This)->lpVtbl -> SetKeyValue(This,key,Value) ) - -#define IPortableDeviceValues_GetKeyValue(This,key,pValue) \ - ( (This)->lpVtbl -> GetKeyValue(This,key,pValue) ) - -#define IPortableDeviceValues_SetBoolValue(This,key,Value) \ - ( (This)->lpVtbl -> SetBoolValue(This,key,Value) ) - -#define IPortableDeviceValues_GetBoolValue(This,key,pValue) \ - ( (This)->lpVtbl -> GetBoolValue(This,key,pValue) ) - -#define IPortableDeviceValues_SetIUnknownValue(This,key,pValue) \ - ( (This)->lpVtbl -> SetIUnknownValue(This,key,pValue) ) - -#define IPortableDeviceValues_GetIUnknownValue(This,key,ppValue) \ - ( (This)->lpVtbl -> GetIUnknownValue(This,key,ppValue) ) - -#define IPortableDeviceValues_SetGuidValue(This,key,Value) \ - ( (This)->lpVtbl -> SetGuidValue(This,key,Value) ) - -#define IPortableDeviceValues_GetGuidValue(This,key,pValue) \ - ( (This)->lpVtbl -> GetGuidValue(This,key,pValue) ) - -#define IPortableDeviceValues_SetBufferValue(This,key,pValue,cbValue) \ - ( (This)->lpVtbl -> SetBufferValue(This,key,pValue,cbValue) ) - -#define IPortableDeviceValues_GetBufferValue(This,key,ppValue,pcbValue) \ - ( (This)->lpVtbl -> GetBufferValue(This,key,ppValue,pcbValue) ) - -#define IPortableDeviceValues_SetIPortableDeviceValuesValue(This,key,pValue) \ - ( (This)->lpVtbl -> SetIPortableDeviceValuesValue(This,key,pValue) ) - -#define IPortableDeviceValues_GetIPortableDeviceValuesValue(This,key,ppValue) \ - ( (This)->lpVtbl -> GetIPortableDeviceValuesValue(This,key,ppValue) ) - -#define IPortableDeviceValues_SetIPortableDevicePropVariantCollectionValue(This,key,pValue) \ - ( (This)->lpVtbl -> SetIPortableDevicePropVariantCollectionValue(This,key,pValue) ) - -#define IPortableDeviceValues_GetIPortableDevicePropVariantCollectionValue(This,key,ppValue) \ - ( (This)->lpVtbl -> GetIPortableDevicePropVariantCollectionValue(This,key,ppValue) ) - -#define IPortableDeviceValues_SetIPortableDeviceKeyCollectionValue(This,key,pValue) \ - ( (This)->lpVtbl -> SetIPortableDeviceKeyCollectionValue(This,key,pValue) ) - -#define IPortableDeviceValues_GetIPortableDeviceKeyCollectionValue(This,key,ppValue) \ - ( (This)->lpVtbl -> GetIPortableDeviceKeyCollectionValue(This,key,ppValue) ) - -#define IPortableDeviceValues_SetIPortableDeviceValuesCollectionValue(This,key,pValue) \ - ( (This)->lpVtbl -> SetIPortableDeviceValuesCollectionValue(This,key,pValue) ) - -#define IPortableDeviceValues_GetIPortableDeviceValuesCollectionValue(This,key,ppValue) \ - ( (This)->lpVtbl -> GetIPortableDeviceValuesCollectionValue(This,key,ppValue) ) - -#define IPortableDeviceValues_RemoveValue(This,key) \ - ( (This)->lpVtbl -> RemoveValue(This,key) ) - -#define IPortableDeviceValues_CopyValuesFromPropertyStore(This,pStore) \ - ( (This)->lpVtbl -> CopyValuesFromPropertyStore(This,pStore) ) - -#define IPortableDeviceValues_CopyValuesToPropertyStore(This,pStore) \ - ( (This)->lpVtbl -> CopyValuesToPropertyStore(This,pStore) ) - -#define IPortableDeviceValues_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPortableDeviceValues_INTERFACE_DEFINED__ */ - - -#ifndef __IPortableDeviceKeyCollection_INTERFACE_DEFINED__ -#define __IPortableDeviceKeyCollection_INTERFACE_DEFINED__ - -/* interface IPortableDeviceKeyCollection */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IPortableDeviceKeyCollection; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("dada2357-e0ad-492e-98db-dd61c53ba353") - IPortableDeviceKeyCollection : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetCount( - /* [in] */ __RPC__in DWORD *pcElems) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAt( - /* [in] */ const DWORD dwIndex, - /* [in] */ __RPC__in PROPERTYKEY *pKey) = 0; - - virtual HRESULT STDMETHODCALLTYPE Add( - /* [in] */ __RPC__in REFPROPERTYKEY Key) = 0; - - virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemoveAt( - /* [in] */ const DWORD dwIndex) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPortableDeviceKeyCollectionVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IPortableDeviceKeyCollection * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IPortableDeviceKeyCollection * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IPortableDeviceKeyCollection * This); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IPortableDeviceKeyCollection * This, - /* [in] */ __RPC__in DWORD *pcElems); - - HRESULT ( STDMETHODCALLTYPE *GetAt )( - __RPC__in IPortableDeviceKeyCollection * This, - /* [in] */ const DWORD dwIndex, - /* [in] */ __RPC__in PROPERTYKEY *pKey); - - HRESULT ( STDMETHODCALLTYPE *Add )( - __RPC__in IPortableDeviceKeyCollection * This, - /* [in] */ __RPC__in REFPROPERTYKEY Key); - - HRESULT ( STDMETHODCALLTYPE *Clear )( - __RPC__in IPortableDeviceKeyCollection * This); - - HRESULT ( STDMETHODCALLTYPE *RemoveAt )( - __RPC__in IPortableDeviceKeyCollection * This, - /* [in] */ const DWORD dwIndex); - - END_INTERFACE - } IPortableDeviceKeyCollectionVtbl; - - interface IPortableDeviceKeyCollection - { - CONST_VTBL struct IPortableDeviceKeyCollectionVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPortableDeviceKeyCollection_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPortableDeviceKeyCollection_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPortableDeviceKeyCollection_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPortableDeviceKeyCollection_GetCount(This,pcElems) \ - ( (This)->lpVtbl -> GetCount(This,pcElems) ) - -#define IPortableDeviceKeyCollection_GetAt(This,dwIndex,pKey) \ - ( (This)->lpVtbl -> GetAt(This,dwIndex,pKey) ) - -#define IPortableDeviceKeyCollection_Add(This,Key) \ - ( (This)->lpVtbl -> Add(This,Key) ) - -#define IPortableDeviceKeyCollection_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#define IPortableDeviceKeyCollection_RemoveAt(This,dwIndex) \ - ( (This)->lpVtbl -> RemoveAt(This,dwIndex) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPortableDeviceKeyCollection_INTERFACE_DEFINED__ */ - - -#ifndef __IPortableDevicePropVariantCollection_INTERFACE_DEFINED__ -#define __IPortableDevicePropVariantCollection_INTERFACE_DEFINED__ - -/* interface IPortableDevicePropVariantCollection */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IPortableDevicePropVariantCollection; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("89b2e422-4f1b-4316-bcef-a44afea83eb3") - IPortableDevicePropVariantCollection : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetCount( - /* [in] */ __RPC__in DWORD *pcElems) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAt( - /* [in] */ const DWORD dwIndex, - /* [in] */ __RPC__in PROPVARIANT *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE Add( - /* [in] */ __RPC__in const PROPVARIANT *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetType( - /* [out] */ __RPC__out VARTYPE *pvt) = 0; - - virtual HRESULT STDMETHODCALLTYPE ChangeType( - /* [in] */ const VARTYPE vt) = 0; - - virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemoveAt( - /* [in] */ const DWORD dwIndex) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPortableDevicePropVariantCollectionVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IPortableDevicePropVariantCollection * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IPortableDevicePropVariantCollection * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IPortableDevicePropVariantCollection * This); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IPortableDevicePropVariantCollection * This, - /* [in] */ __RPC__in DWORD *pcElems); - - HRESULT ( STDMETHODCALLTYPE *GetAt )( - __RPC__in IPortableDevicePropVariantCollection * This, - /* [in] */ const DWORD dwIndex, - /* [in] */ __RPC__in PROPVARIANT *pValue); - - HRESULT ( STDMETHODCALLTYPE *Add )( - __RPC__in IPortableDevicePropVariantCollection * This, - /* [in] */ __RPC__in const PROPVARIANT *pValue); - - HRESULT ( STDMETHODCALLTYPE *GetType )( - __RPC__in IPortableDevicePropVariantCollection * This, - /* [out] */ __RPC__out VARTYPE *pvt); - - HRESULT ( STDMETHODCALLTYPE *ChangeType )( - __RPC__in IPortableDevicePropVariantCollection * This, - /* [in] */ const VARTYPE vt); - - HRESULT ( STDMETHODCALLTYPE *Clear )( - __RPC__in IPortableDevicePropVariantCollection * This); - - HRESULT ( STDMETHODCALLTYPE *RemoveAt )( - __RPC__in IPortableDevicePropVariantCollection * This, - /* [in] */ const DWORD dwIndex); - - END_INTERFACE - } IPortableDevicePropVariantCollectionVtbl; - - interface IPortableDevicePropVariantCollection - { - CONST_VTBL struct IPortableDevicePropVariantCollectionVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPortableDevicePropVariantCollection_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPortableDevicePropVariantCollection_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPortableDevicePropVariantCollection_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPortableDevicePropVariantCollection_GetCount(This,pcElems) \ - ( (This)->lpVtbl -> GetCount(This,pcElems) ) - -#define IPortableDevicePropVariantCollection_GetAt(This,dwIndex,pValue) \ - ( (This)->lpVtbl -> GetAt(This,dwIndex,pValue) ) - -#define IPortableDevicePropVariantCollection_Add(This,pValue) \ - ( (This)->lpVtbl -> Add(This,pValue) ) - -#define IPortableDevicePropVariantCollection_GetType(This,pvt) \ - ( (This)->lpVtbl -> GetType(This,pvt) ) - -#define IPortableDevicePropVariantCollection_ChangeType(This,vt) \ - ( (This)->lpVtbl -> ChangeType(This,vt) ) - -#define IPortableDevicePropVariantCollection_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#define IPortableDevicePropVariantCollection_RemoveAt(This,dwIndex) \ - ( (This)->lpVtbl -> RemoveAt(This,dwIndex) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPortableDevicePropVariantCollection_INTERFACE_DEFINED__ */ - - -#ifndef __IPortableDeviceValuesCollection_INTERFACE_DEFINED__ -#define __IPortableDeviceValuesCollection_INTERFACE_DEFINED__ - -/* interface IPortableDeviceValuesCollection */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IPortableDeviceValuesCollection; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6e3f2d79-4e07-48c4-8208-d8c2e5af4a99") - IPortableDeviceValuesCollection : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetCount( - /* [in] */ __RPC__in DWORD *pcElems) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAt( - /* [in] */ const DWORD dwIndex, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValues **ppValues) = 0; - - virtual HRESULT STDMETHODCALLTYPE Add( - /* [in] */ __RPC__in_opt IPortableDeviceValues *pValues) = 0; - - virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemoveAt( - /* [in] */ const DWORD dwIndex) = 0; - - }; - -#else /* C style interface */ - - typedef struct IPortableDeviceValuesCollectionVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IPortableDeviceValuesCollection * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IPortableDeviceValuesCollection * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IPortableDeviceValuesCollection * This); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IPortableDeviceValuesCollection * This, - /* [in] */ __RPC__in DWORD *pcElems); - - HRESULT ( STDMETHODCALLTYPE *GetAt )( - __RPC__in IPortableDeviceValuesCollection * This, - /* [in] */ const DWORD dwIndex, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValues **ppValues); - - HRESULT ( STDMETHODCALLTYPE *Add )( - __RPC__in IPortableDeviceValuesCollection * This, - /* [in] */ __RPC__in_opt IPortableDeviceValues *pValues); - - HRESULT ( STDMETHODCALLTYPE *Clear )( - __RPC__in IPortableDeviceValuesCollection * This); - - HRESULT ( STDMETHODCALLTYPE *RemoveAt )( - __RPC__in IPortableDeviceValuesCollection * This, - /* [in] */ const DWORD dwIndex); - - END_INTERFACE - } IPortableDeviceValuesCollectionVtbl; - - interface IPortableDeviceValuesCollection - { - CONST_VTBL struct IPortableDeviceValuesCollectionVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IPortableDeviceValuesCollection_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IPortableDeviceValuesCollection_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IPortableDeviceValuesCollection_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IPortableDeviceValuesCollection_GetCount(This,pcElems) \ - ( (This)->lpVtbl -> GetCount(This,pcElems) ) - -#define IPortableDeviceValuesCollection_GetAt(This,dwIndex,ppValues) \ - ( (This)->lpVtbl -> GetAt(This,dwIndex,ppValues) ) - -#define IPortableDeviceValuesCollection_Add(This,pValues) \ - ( (This)->lpVtbl -> Add(This,pValues) ) - -#define IPortableDeviceValuesCollection_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#define IPortableDeviceValuesCollection_RemoveAt(This,dwIndex) \ - ( (This)->lpVtbl -> RemoveAt(This,dwIndex) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IPortableDeviceValuesCollection_INTERFACE_DEFINED__ */ - - - -#ifndef __PortableDeviceTypesLib_LIBRARY_DEFINED__ -#define __PortableDeviceTypesLib_LIBRARY_DEFINED__ - -/* library PortableDeviceTypesLib */ -/* [helpstring][version][uuid] */ - - -EXTERN_C const IID LIBID_PortableDeviceTypesLib; - -EXTERN_C const CLSID CLSID_WpdSerializer; - -#ifdef __cplusplus - -class DECLSPEC_UUID("0b91a74b-ad7c-4a9d-b563-29eef9167172") -WpdSerializer; -#endif - -EXTERN_C const CLSID CLSID_PortableDeviceValues; - -#ifdef __cplusplus - -class DECLSPEC_UUID("0c15d503-d017-47ce-9016-7b3f978721cc") -PortableDeviceValues; -#endif - -EXTERN_C const CLSID CLSID_PortableDeviceKeyCollection; - -#ifdef __cplusplus - -class DECLSPEC_UUID("de2d022d-2480-43be-97f0-d1fa2cf98f4f") -PortableDeviceKeyCollection; -#endif - -EXTERN_C const CLSID CLSID_PortableDevicePropVariantCollection; - -#ifdef __cplusplus - -class DECLSPEC_UUID("08a99e2f-6d6d-4b80-af5a-baf2bcbe4cb9") -PortableDevicePropVariantCollection; -#endif - -EXTERN_C const CLSID CLSID_PortableDeviceValuesCollection; - -#ifdef __cplusplus - -class DECLSPEC_UUID("3882134d-14cf-4220-9cb4-435f86d83f60") -PortableDeviceValuesCollection; -#endif -#endif /* __PortableDeviceTypesLib_LIBRARY_DEFINED__ */ - -/* interface __MIDL_itf_PortableDeviceTypes_0000_0005 */ -/* [local] */ - -#endif // (_WIN32_WINNT >= 0x0501) - - -extern RPC_IF_HANDLE __MIDL_itf_PortableDeviceTypes_0000_0005_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_PortableDeviceTypes_0000_0005_v0_0_s_ifspec; - -/* Additional Prototypes for ALL interfaces */ - -unsigned long __RPC_USER BSTR_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); -void __RPC_USER BSTR_UserFree( __RPC__in unsigned long *, __RPC__in BSTR * ); - -unsigned long __RPC_USER LPSAFEARRAY_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * ); -void __RPC_USER LPSAFEARRAY_UserFree( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * ); - -unsigned long __RPC_USER BSTR_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); -void __RPC_USER BSTR_UserFree64( __RPC__in unsigned long *, __RPC__in BSTR * ); - -unsigned long __RPC_USER LPSAFEARRAY_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * ); -void __RPC_USER LPSAFEARRAY_UserFree64( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * ); - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/portabledevicetypes.idl b/pub/ddk/portabledevicetypes.idl deleted file mode 100644 index 9a3ddd0..0000000 --- a/pub/ddk/portabledevicetypes.idl +++ /dev/null @@ -1,400 +0,0 @@ -//----------------------------------------------------------------------------- -// -// @module PortableDeviceTypes.idl -// -// @abstract This file contains interface desc for interfaces used in passing -// parameters between applications and drivers. -// -// @copyright (C) COPYRIGHT MICROSOFT CORPORATION -// -//----------------------------------------------------------------------------- - -cpp_quote("#if (_WIN32_WINNT >= 0x0501) // XP and later") - -import "oaidl.idl"; -import "ocidl.idl"; -import "propsys.idl"; -import "wtypes.idl"; - -// -// We are defining VARIANT_FALSE/TRUE here because they are not defined in any -// public .idl that we can import. -// - -#define VARIANT_FALSE ( (VARIANT_BOOL) 0 ) -#define VARIANT_TRUE ( (VARIANT_BOOL) -1 ) - -interface IWpdSerializer; -interface IPortableDeviceValues; -interface IPortableDeviceKeyCollection; -interface IPortableDevicePropVariantCollection; -interface IPortableDeviceValuesCollection; - -/////////////////////////////////////////////////////////// -// IWpdSerializer -//--------------------------------------------------------- -//--------------------------------------------------------- -// -[ - object, - uuid(b32f4002-bb27-45ff-af4f-06631c1e8dad), - helpstring("IWpdSerializer Interface"), - pointer_default(unique) -] -interface IWpdSerializer : IUnknown -{ - HRESULT GetIPortableDeviceValuesFromBuffer( - [in, size_is(dwInputBufferLength)] - BYTE* pBuffer, - [in] DWORD dwInputBufferLength, - [out] IPortableDeviceValues** ppParams); - - HRESULT WriteIPortableDeviceValuesToBuffer( - [in] DWORD dwOutputBufferLength, - [in] IPortableDeviceValues* pResults, - [out, size_is(dwOutputBufferLength), length_is(*pdwBytesWritten)] - BYTE* pBuffer, - [out] DWORD* pdwBytesWritten); - - HRESULT GetBufferFromIPortableDeviceValues( - [in] IPortableDeviceValues* pSource, - [out, size_is(, *pdwBufferSize)] - BYTE** ppBuffer, - [out] DWORD* pdwBufferSize); - - HRESULT GetSerializedSize( - [in] IPortableDeviceValues* pSource, - [out] DWORD* pdwSize); -}; - -/////////////////////////////////////////////////////////// -// IPortableDeviceValues -//--------------------------------------------------------- -// A collection of property/value pairs. Used to get/set -// properties. -//--------------------------------------------------------- -// -[ - object, - uuid(6848f6f2-3155-4f86-b6f5-263eeeab3143), - helpstring("IPortableDeviceValues Interface"), - pointer_default(unique) -] -interface IPortableDeviceValues : IUnknown -{ - HRESULT GetCount( - [in] DWORD* pcelt); - - HRESULT GetAt( - [in] const DWORD index, - [in, out, unique] PROPERTYKEY* pKey, - [in, out, unique] PROPVARIANT* pValue); - - HRESULT SetValue( - [in] REFPROPERTYKEY key, - [in] const PROPVARIANT* pValue); - - HRESULT GetValue( - [in] REFPROPERTYKEY key, - [out] PROPVARIANT* pValue); - - HRESULT SetStringValue( - [in] REFPROPERTYKEY key, - [in] LPCWSTR Value); - - HRESULT GetStringValue( - [in] REFPROPERTYKEY key, - [out] LPWSTR* pValue); - - HRESULT SetUnsignedIntegerValue( - [in] REFPROPERTYKEY key, - [in] const ULONG Value); - - HRESULT GetUnsignedIntegerValue( - [in] REFPROPERTYKEY key, - [out] ULONG* pValue); - - HRESULT SetSignedIntegerValue( - [in] REFPROPERTYKEY key, - [in] const LONG Value); - - HRESULT GetSignedIntegerValue( - [in] REFPROPERTYKEY key, - [out] LONG* pValue); - - HRESULT SetUnsignedLargeIntegerValue( - [in] REFPROPERTYKEY key, - [in] const ULONGLONG Value); - - HRESULT GetUnsignedLargeIntegerValue( - [in] REFPROPERTYKEY key, - [out] ULONGLONG* pValue); - - HRESULT SetSignedLargeIntegerValue( - [in] REFPROPERTYKEY key, - [in] const LONGLONG Value); - - HRESULT GetSignedLargeIntegerValue( - [in] REFPROPERTYKEY key, - [out] LONGLONG* pValue); - - HRESULT SetFloatValue( - [in] REFPROPERTYKEY key, - [in] const FLOAT Value); - - HRESULT GetFloatValue( - [in] REFPROPERTYKEY key, - [out] FLOAT* pValue); - - HRESULT SetErrorValue( - [in] REFPROPERTYKEY key, - [in] const HRESULT Value); - - HRESULT GetErrorValue( - [in] REFPROPERTYKEY key, - [out] HRESULT* pValue); - - HRESULT SetKeyValue( - [in] REFPROPERTYKEY key, - [in] REFPROPERTYKEY Value); - - HRESULT GetKeyValue( - [in] REFPROPERTYKEY key, - [out] PROPERTYKEY* pValue); - - HRESULT SetBoolValue( - [in] REFPROPERTYKEY key, - [in] const BOOL Value); - - HRESULT GetBoolValue( - [in] REFPROPERTYKEY key, - [out] BOOL* pValue); - - HRESULT SetIUnknownValue( - [in] REFPROPERTYKEY key, - [in] IUnknown* pValue); - - HRESULT GetIUnknownValue( - [in] REFPROPERTYKEY key, - [out] IUnknown** ppValue); - - HRESULT SetGuidValue( - [in] REFPROPERTYKEY key, - [in] REFGUID Value); - - HRESULT GetGuidValue( - [in] REFPROPERTYKEY key, - [out] GUID* pValue); - - HRESULT SetBufferValue( - [in] REFPROPERTYKEY key, - [in, size_is(cbValue)] - BYTE* pValue, - [in] DWORD cbValue); - - HRESULT GetBufferValue( - [in] REFPROPERTYKEY key, - [out, size_is(, *pcbValue)] - BYTE** ppValue, - [out] DWORD* pcbValue); - - HRESULT SetIPortableDeviceValuesValue( - [in] REFPROPERTYKEY key, - [in] IPortableDeviceValues* pValue); - - HRESULT GetIPortableDeviceValuesValue( - [in] REFPROPERTYKEY key, - [out] IPortableDeviceValues** ppValue); - - HRESULT SetIPortableDevicePropVariantCollectionValue( - [in] REFPROPERTYKEY key, - [in] IPortableDevicePropVariantCollection* pValue); - - HRESULT GetIPortableDevicePropVariantCollectionValue( - [in] REFPROPERTYKEY key, - [out] IPortableDevicePropVariantCollection** ppValue); - - HRESULT SetIPortableDeviceKeyCollectionValue( - [in] REFPROPERTYKEY key, - [in] IPortableDeviceKeyCollection* pValue); - - HRESULT GetIPortableDeviceKeyCollectionValue( - [in] REFPROPERTYKEY key, - [out] IPortableDeviceKeyCollection** ppValue); - - HRESULT SetIPortableDeviceValuesCollectionValue( - [in] REFPROPERTYKEY key, - [in] IPortableDeviceValuesCollection* pValue); - - HRESULT GetIPortableDeviceValuesCollectionValue( - [in] REFPROPERTYKEY key, - [out] IPortableDeviceValuesCollection** ppValue); - - HRESULT RemoveValue( - [in] REFPROPERTYKEY key); - - HRESULT CopyValuesFromPropertyStore( - [in] IPropertyStore* pStore); - - HRESULT CopyValuesToPropertyStore( - [in] IPropertyStore* pStore); - - HRESULT Clear(); -}; - -/////////////////////////////////////////////////////////// -// IPortableDeviceKeyCollection -//--------------------------------------------------------- -//--------------------------------------------------------- -// -[ - object, - uuid(dada2357-e0ad-492e-98db-dd61c53ba353), - helpstring("IPortableDeviceKeyCollection Interface"), - pointer_default(unique) -] -interface IPortableDeviceKeyCollection : IUnknown -{ - HRESULT GetCount( - [in] DWORD* pcElems); - - HRESULT GetAt( - [in] const DWORD dwIndex, - [in] PROPERTYKEY* pKey); - - HRESULT Add( - [in] REFPROPERTYKEY Key); - - HRESULT Clear(); - - HRESULT RemoveAt( - [in] const DWORD dwIndex); -}; - -/////////////////////////////////////////////////////////// -// IPortableDevicePropVariantCollection -//--------------------------------------------------------- -//--------------------------------------------------------- -// -[ - object, - uuid(89b2e422-4f1b-4316-bcef-a44afea83eb3), - helpstring("IPortableDevicePropVariantCollection Interface"), - pointer_default(unique) -] -interface IPortableDevicePropVariantCollection : IUnknown -{ - HRESULT GetCount( - [in] DWORD* pcElems); - - HRESULT GetAt( - [in] const DWORD dwIndex, - [in] PROPVARIANT* pValue); - - HRESULT Add( - [in] const PROPVARIANT* pValue); - - HRESULT GetType( - [out] VARTYPE* pvt); - - HRESULT ChangeType( - [in] const VARTYPE vt); - - HRESULT Clear(); - - HRESULT RemoveAt( - [in] const DWORD dwIndex); -}; - -/////////////////////////////////////////////////////////// -// IPortableDeviceValuesCollection -//--------------------------------------------------------- -//--------------------------------------------------------- -// -[ - object, - uuid(6e3f2d79-4e07-48c4-8208-d8c2e5af4a99), - helpstring("IPortableDeviceValuesCollection Interface"), - pointer_default(unique) -] -interface IPortableDeviceValuesCollection : IUnknown -{ - HRESULT GetCount( - [in] DWORD* pcElems); - - HRESULT GetAt( - [in] const DWORD dwIndex, - [out] IPortableDeviceValues** ppValues); - - HRESULT Add( - [in] IPortableDeviceValues* pValues); - - HRESULT Clear(); - - HRESULT RemoveAt( - [in] const DWORD dwIndex); -}; - -/////////////////////////////////////////////////////////// -// PortableDeviceTypesLib -//--------------------------------------------------------- -//--------------------------------------------------------- -// -[ - uuid(2B00BA2F-E750-4beb-9235-97142EDE1D3E), - version(1.0), - helpstring("PortableDeviceTypes 1.0 Type Library") -] -library PortableDeviceTypesLib -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - - [ - uuid(0b91a74b-ad7c-4a9d-b563-29eef9167172), - helpstring("WpdSerializer Class") - ] - coclass WpdSerializer - { - [default] interface IWpdSerializer; - }; - - [ - uuid(0c15d503-d017-47ce-9016-7b3f978721cc), - helpstring("Portable Device Values Class") - ] - coclass PortableDeviceValues - { - [default] interface IPortableDeviceValues; - }; - - [ - uuid(de2d022d-2480-43be-97f0-d1fa2cf98f4f), - helpstring("Portable Device PROPERTYKEY collection") - ] - coclass PortableDeviceKeyCollection - { - [default] interface IPortableDeviceKeyCollection; - }; - - [ - uuid(08a99e2f-6d6d-4b80-af5a-baf2bcbe4cb9), - helpstring("Portable Device PROPVARIANT collection") - ] - coclass PortableDevicePropVariantCollection - { - [default] interface IPortableDevicePropVariantCollection; - }; - - [ - uuid(3882134d-14cf-4220-9cb4-435f86d83f60), - helpstring("Portable Device Values collection") - ] - coclass PortableDeviceValuesCollection - { - [default] interface IPortableDeviceValuesCollection; - }; -}; - -cpp_quote("#endif // (_WIN32_WINNT >= 0x0501)") - diff --git a/pub/ddk/portcls.h b/pub/ddk/portcls.h deleted file mode 100644 index 7c3ee7b..0000000 --- a/pub/ddk/portcls.h +++ /dev/null @@ -1,3555 +0,0 @@ -/***************************************************************************** - * portcls.h - WDM Streaming port class driver - ***************************************************************************** - * Copyright (c) Microsoft Corporation. All rights reserved. - */ - -#ifndef _PORTCLS_H_ -#define _PORTCLS_H_ - -#ifdef __cplusplus -// WDM.H does not play well with C++. -extern "C" -{ -#include -} -#else -#include -#endif - -#ifndef IRP_MN_FILTER_RESOURCE_REQUIREMENTS -#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D -#endif - -#include -#define NOBITMAP -#include -#undef NOBITMAP -#include -#include -#include - -#if (NTDDI_VERSION >= NTDDI_WINXP) -#include -#endif - -#if defined(PC_NO_IMPORTS) -#define PORTCLASSAPI EXTERN_C -#else -#define PORTCLASSAPI EXTERN_C __declspec(dllimport) -#endif - -#define _100NS_UNITS_PER_SECOND 10000000L -#define PORT_CLASS_DEVICE_EXTENSION_SIZE (64*sizeof(ULONG_PTR)) - -#if (NTDDI_VERSION >= NTDDI_WINXP) -// -// N.B.: If you are having problems building your driver, -// #define PC_OLD_NAMES in your sources file. -// This flag is no longer turned on by default. -// -//#ifndef PC_NEW_NAMES -//#define PC_OLD_NAMES -//#endif -#elif (NTDDI_VERSION >= NTDDI_WIN2K) -#ifndef PC_NEW_NAMES -#define PC_OLD_NAMES -#endif -#endif - -#define IID_IAdapterPowerManagment IID_IAdapterPowerManagement -#define IID_IAdapterPowerManagment2 IID_IAdapterPowerManagement2 -#define PADAPTERPOWERMANAGMENT PADAPTERPOWERMANAGEMENT -#define PADAPTERPOWERMANAGMENT2 PADAPTERPOWERMANAGEMENT2 - -/***************************************************************************** - * Interface identifiers. - */ - -DEFINE_GUID(IID_IMiniport, -0xb4c90a24L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IPort, -0xb4c90a25L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IResourceList, -0x22C6AC60L, 0x851B, 0x11D0, 0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE); - -#if (NTDDI_VERSION >= NTDDI_WINXP) -DEFINE_GUID(IID_IMusicTechnology, -0x80396C3CL, 0xCBCB, 0x409B, 0x9F, 0x65, 0x4F, 0x1E, 0x74, 0x67, 0xCD, 0xAF); -#endif - -DEFINE_GUID(IID_IDmaChannel, -0x22C6AC61L, 0x851B, 0x11D0, 0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE); - -// -// Take out IDmaChannelSlave for compilations. -// -#if (NTDDI_VERSION < NTDDI_VISTA) -DEFINE_GUID(IID_IDmaChannelSlave, -0x22C6AC62L, 0x851B, 0x11D0, 0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE); -#endif - -DEFINE_GUID(IID_IInterruptSync, -0x22C6AC63L, 0x851B, 0x11D0, 0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE); -DEFINE_GUID(IID_IServiceSink, -0x22C6AC64L, 0x851B, 0x11D0, 0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE); -DEFINE_GUID(IID_IServiceGroup, -0x22C6AC65L, 0x851B, 0x11D0, 0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE); -DEFINE_GUID(IID_IRegistryKey, -0xE8DA4302l, 0xF304, 0x11D0, 0x95, 0x8B, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3); -DEFINE_GUID(IID_IPortMidi, -0xb4c90a40L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IMiniportMidi, -0xb4c90a41L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IMiniportMidiStream, -0xb4c90a42L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IPortTopology, -0xb4c90a30L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IMiniportTopology, -0xb4c90a31L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IPortWaveCyclic, -0xb4c90a26L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IMiniportWaveCyclic, -0xb4c90a27L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IMiniportWaveCyclicStream, -0xb4c90a28L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IPortWavePci, -0xb4c90a50L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IPortWavePciStream, -0xb4c90a51L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IMiniportWavePci, -0xb4c90a52L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(IID_IMiniportWavePciStream, -0xb4c90a53L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); - -#if (NTDDI_VERSION >= NTDDI_VISTA) -DEFINE_GUID(IID_IPortWaveRT, -0x339ff909, 0x68a9, 0x4310, 0xb0, 0x9b, 0x27, 0x4e, 0x96, 0xee, 0x4c, 0xbd); -DEFINE_GUID(IID_IPortWaveRTStream, -0x1809ce5a, 0x64bc, 0x4e62, 0xbd, 0x7d, 0x95, 0xbc, 0xe4, 0x3d, 0xe3, 0x93); -DEFINE_GUID(IID_IMiniportWaveRT, -0xf9fc4d6, 0x6061, 0x4f3c, 0xb1, 0xfc, 0x7, 0x5e, 0x35, 0xf7, 0x96, 0xa); -DEFINE_GUID(IID_IMiniportWaveRTStream, -0xac9ab, 0xfaab, 0x4f3d, 0x94, 0x55, 0x6f, 0xf8, 0x30, 0x6a, 0x74, 0xa0); -DEFINE_GUID(IID_IMiniportWaveRTStreamNotification, -0x23759128, 0x96f1, 0x423b, 0xab, 0x4d, 0x81, 0x63, 0x5b, 0xcf, 0x8c, 0xa1); - -// Need compile only for post vista case -// Not sure what NTDDI_xxxx for Windows 7 -DEFINE_GUID(IID_IPortWMIRegistration, -0xd80b18e7, 0x804c, 0x4e1e, 0x82, 0xd3, 0x24, 0x61, 0xec, 0x6, 0xe7, 0xc7); - -// {C3D5E80C-7F55-40c5-88B2-6210D0CB2B59} -DEFINE_GUID(IID_IPortClsSubdeviceEx, -0xc3d5e80c, 0x7f55, 0x40c5, 0x88, 0xb2, 0x62, 0x10, 0xd0, 0xcb, 0x2b, 0x59); - -// {47BA0351-BC4B-4869-8134-B74FE17852D8} -DEFINE_GUID(IID_IPortClsPower, -0x47ba0351, 0xbc4b, 0x4869, 0x81, 0x34, 0xb7, 0x4f, 0xe1, 0x78, 0x52, 0xd8); - - - -// {29CC9AB1-E89D-413c-B6B2-F6D50005D063} -DEFINE_GUID(IID_IPinName, -0x29cc9ab1, 0xe89d, 0x413c, 0xb6, 0xb2, 0xf6, 0xd5, 0x0, 0x5, 0xd0, 0x63); - - -#endif - -DEFINE_GUID(IID_IAdapterPowerManagement, -0x793417D0L, 0x35FE, 0x11D1, 0xAD, 0x08, 0x00, 0xA0, 0xC9, 0x0A, 0xB1, 0xB0); -DEFINE_GUID(IID_IAdapterPowerManagement2, -0xE0F92E5DL, 0x67F5, 0x48EE, 0xB5, 0x7A, 0x7D, 0x1E, 0x90, 0xC5, 0xF4, 0x3D); -DEFINE_GUID(IID_IPowerNotify, -0x3DD648B8L, 0x969F, 0x11D1, 0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3); -DEFINE_GUID(IID_IWaveCyclicClock, -0xdec1ec78L, 0x419a, 0x11d1, 0xad, 0x09, 0x00, 0xc0, 0x4f, 0xb9, 0x1b, 0xc4); -DEFINE_GUID(IID_IWavePciClock, -0xd5d7a256L, 0x5d10, 0x11d1, 0xad, 0xae, 0x00, 0xc0, 0x4f, 0xb9, 0x1b, 0xc4); -DEFINE_GUID(IID_IPortEvents, -0xA80F29C4L, 0x5498, 0x11D2, 0x95, 0xD9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3); - -#if (NTDDI_VERSION >= NTDDI_WINXP) -DEFINE_GUID(IID_IDrmPort, -0x286D3DF8L, 0xCA22, 0x4E2E, 0xB9, 0xBC, 0x20, 0xB4, 0xF0, 0xE2, 0x01, 0xCE); -DEFINE_GUID(IID_IDrmPort2, -0x1ACCE59CL, 0x7311, 0x4B6B, 0x9F, 0xBA, 0xCC, 0x3B, 0xA5, 0x9A, 0xCD, 0xCE); -DEFINE_GUID(IID_IPortClsVersion, -0x7D89A7BBL, 0x869B, 0x4567, 0x8D, 0xBE, 0x1E, 0x16, 0x8C, 0xC8, 0x53, 0xDE); -DEFINE_GUID(IID_IPinCount, -0x5dadb7dcL, 0xa2cb, 0x4540, 0xa4, 0xa8, 0x42, 0x5e, 0xe4, 0xae, 0x90, 0x51); -DEFINE_GUID(IID_IPreFetchOffset, -0x7000f480L, 0xed44, 0x4e8b, 0xb3, 0x8a, 0x41, 0x2f, 0x8d, 0x7a, 0x50, 0x4d); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2003) -DEFINE_GUID(IID_IUnregisterSubdevice, -0x16738177L, 0xe199, 0x41f9, 0x9a, 0x87, 0xab, 0xb2, 0xa5, 0x43, 0x2f, 0x21); -DEFINE_GUID(IID_IUnregisterPhysicalConnection, -0x6c38e231L, 0x2a0d, 0x428d, 0x81, 0xf8, 0x07, 0xcc, 0x42, 0x8b, 0xb9, 0xa4); -#endif - - -/***************************************************************************** - * Class identifiers. - */ - -DEFINE_GUID(CLSID_PortMidi, -0xb4c90a43L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(CLSID_PortTopology, -0xb4c90a32L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(CLSID_PortWaveCyclic, -0xb4c90a2aL, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(CLSID_PortWavePci, -0xb4c90a54L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); - -#if (NTDDI_VERSION >= NTDDI_VISTA) -DEFINE_GUID(CLSID_PortWaveRT, -0xcc9be57a, 0xeb9e, 0x42b4, 0x94, 0xfc, 0xc, 0xad, 0x3d, 0xbc, 0xe7, 0xfa); -#endif - -DEFINE_GUID(CLSID_MiniportDriverFmSynth, -0xb4c90ae0L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(CLSID_MiniportDriverUart, -0xb4c90ae1L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44); -DEFINE_GUID(CLSID_MiniportDriverFmSynthWithVol, -0xe5a3c139L, 0xf0f2, 0x11d1, 0x81, 0xaf, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1); - - -/***************************************************************************** - * Interfaces - */ - -#if !defined(DEFINE_ABSTRACT_UNKNOWN) - -#define DEFINE_ABSTRACT_UNKNOWN() \ - STDMETHOD_(NTSTATUS, QueryInterface)(THIS_ \ - REFIID InterfaceId, \ - PVOID* Interface \ - ) PURE; \ - STDMETHOD_(ULONG,AddRef)(THIS) PURE; \ - STDMETHOD_(ULONG,Release)(THIS) PURE; - -#endif //!defined(DEFINE_ABSTRACT_UNKNOWN) - -#if !defined(DEFINE_ABSTRACT_PORT) - -#ifdef PC_OLD_NAMES - -#define DEFINE_ABSTRACT_PORT() \ - STDMETHOD_(NTSTATUS,Init) \ - ( THIS_ \ - __in PVOID DeviceObject, \ - __in_opt PVOID Irp, \ - __in PUNKNOWN UnknownMiniport, \ - __in_opt PUNKNOWN UnknownAdapter, \ - __in PRESOURCELIST ResourceList \ - ) PURE; \ - STDMETHOD_(NTSTATUS,GetDeviceProperty) \ - ( THIS_ \ - __in DEVICE_REGISTRY_PROPERTY DeviceProperty, \ - __in ULONG BufferLength, \ - __out PVOID PropertyBuffer, \ - __out PULONG ResultLength \ - ) PURE; \ - STDMETHOD_(NTSTATUS,NewRegistryKey) \ - ( THIS_ \ - __out PREGISTRYKEY * OutRegistryKey, \ - __in_opt PUNKNOWN OuterUnknown, \ - __in ULONG RegistryKeyType, \ - __in ACCESS_MASK DesiredAccess, \ - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, \ - __in_opt ULONG CreateOptions, \ - __out_opt PULONG Disposition \ - ) PURE; - -#else // !PC_OLD_NAMES - -#define DEFINE_ABSTRACT_PORT() \ - STDMETHOD_(NTSTATUS,Init) \ - ( THIS_ \ - __in PDEVICE_OBJECT DeviceObject, \ - __in_opt PIRP Irp, \ - __in PUNKNOWN UnknownMiniport, \ - __in_opt PUNKNOWN UnknownAdapter, \ - __in PRESOURCELIST ResourceList \ - ) PURE; \ - STDMETHOD_(NTSTATUS,GetDeviceProperty) \ - ( THIS_ \ - __in DEVICE_REGISTRY_PROPERTY DeviceProperty, \ - __in ULONG BufferLength, \ - __out PVOID PropertyBuffer, \ - __out PULONG ResultLength \ - ) PURE; \ - STDMETHOD_(NTSTATUS,NewRegistryKey) \ - ( THIS_ \ - __out PREGISTRYKEY * OutRegistryKey, \ - __in_opt PUNKNOWN OuterUnknown, \ - __in ULONG RegistryKeyType, \ - __in ACCESS_MASK DesiredAccess, \ - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, \ - __in_opt ULONG CreateOptions, \ - __out_opt PULONG Disposition \ - ) PURE; - -#endif // !PC_OLD_NAMES - -#endif //!defined(DEFINE_ABSTRACT_PORT) - - -#if !defined(DEFINE_ABSTRACT_MINIPORT) - -#define DEFINE_ABSTRACT_MINIPORT() \ - STDMETHOD_(NTSTATUS,GetDescription) \ - ( THIS_ \ - __out PPCFILTER_DESCRIPTOR * Description \ - ) PURE; \ - STDMETHOD_(NTSTATUS,DataRangeIntersection) \ - ( THIS_ \ - __in ULONG PinId, \ - __in PKSDATARANGE DataRange, \ - __in PKSDATARANGE MatchingDataRange, \ - __in ULONG OutputBufferLength, \ - __out_opt PVOID ResultantFormat, \ - __out PULONG ResultantFormatLength \ - ) PURE; - -#endif //!defined(DEFINE_ABSTRACT_MINIPORT) - -#if !defined(DEFINE_ABSTRACT_DMACHANNEL) - -#define DEFINE_ABSTRACT_DMACHANNEL() \ - STDMETHOD_(NTSTATUS,AllocateBuffer) \ - ( THIS_ \ - __in ULONG BufferSize, \ - __in_opt PPHYSICAL_ADDRESS PhysicalAddressConstraint \ - ) PURE; \ - STDMETHOD_(void,FreeBuffer) \ - ( THIS \ - ) PURE; \ - STDMETHOD_(ULONG,TransferCount) \ - ( THIS \ - ) PURE; \ - STDMETHOD_(ULONG,MaximumBufferSize) \ - ( THIS \ - ) PURE; \ - STDMETHOD_(ULONG,AllocatedBufferSize) \ - ( THIS \ - ) PURE; \ - STDMETHOD_(ULONG,BufferSize) \ - ( THIS \ - ) PURE; \ - STDMETHOD_(void,SetBufferSize) \ - ( THIS_ \ - __in ULONG BufferSize \ - ) PURE; \ - STDMETHOD_(PVOID,SystemAddress) \ - ( THIS \ - ) PURE; \ - STDMETHOD_(PHYSICAL_ADDRESS,PhysicalAddress) \ - ( THIS \ - ) PURE; \ - STDMETHOD_(PADAPTER_OBJECT,GetAdapterObject) \ - ( THIS \ - ) PURE; \ - STDMETHOD_(void,CopyTo) \ - ( THIS_ \ - __inout_bcount(ByteCount) PVOID Destination, \ - __in PVOID Source, \ - __in ULONG ByteCount \ - ) PURE; \ - STDMETHOD_(void,CopyFrom) \ - ( THIS_ \ - __inout_bcount(ByteCount) PVOID Destination, \ - __in PVOID Source, \ - __in ULONG ByteCount \ - ) PURE; - -#endif //!defined(DEFINE_ABSTRACT_DMACHANNEL) - -// -// Take out definitions of IDmaChannelSlave. -// -#if (NTDDI_VERSION < NTDDI_VISTA) -#if !defined(DEFINE_ABSTRACT_DMACHANNELSLAVE) - -#define DEFINE_ABSTRACT_DMACHANNELSLAVE() \ - STDMETHOD_(NTSTATUS,Start) \ - ( THIS_ \ - __in ULONG MapSize, \ - __in BOOLEAN WriteToDevice \ - ) PURE; \ - STDMETHOD_(NTSTATUS,Stop) \ - ( THIS \ - ) PURE; \ - STDMETHOD_(ULONG,ReadCounter) \ - ( THIS \ - ) PURE; \ - STDMETHOD_(NTSTATUS,WaitForTC) \ - ( THIS_ \ - ULONG Timeout \ - ) PURE; - -#endif //!defined(DEFINE_ABSTRACT_DMACHANNELSLAVE) -#endif - -#if !defined(DEFINE_ABSTRACT_DRMPORT) - -#define DEFINE_ABSTRACT_DRMPORT() \ - STDMETHOD_(NTSTATUS,CreateContentMixed) \ - ( THIS_ \ - __in PULONG paContentId, \ - __in ULONG cContentId, \ - __out PULONG pMixedContentId \ - ) PURE; \ - STDMETHOD_(NTSTATUS,DestroyContent) \ - ( THIS_ \ - __in ULONG ContentId \ - ) PURE; \ - STDMETHOD_(NTSTATUS,ForwardContentToFileObject) \ - ( THIS_ \ - __in ULONG ContentId, \ - __in PFILE_OBJECT FileObject \ - ) PURE; \ - STDMETHOD_(NTSTATUS,ForwardContentToInterface) \ - ( THIS_ \ - __in ULONG ContentId, \ - __in PUNKNOWN pUnknown, \ - __in ULONG NumMethods \ - ) PURE; \ - STDMETHOD_(NTSTATUS,GetContentRights) \ - ( THIS_ \ - __in ULONG ContentId, \ - __out PDRMRIGHTS DrmRights \ - ) PURE; - -#endif //!defined(DEFINE_ABSTRACT_DRMPORT) - -#if !defined(DEFINE_ABSTRACT_MINIPORTWAVERTSTREAM) - -#define DEFINE_ABSTRACT_MINIPORTWAVERTSTREAM() \ - STDMETHOD_(NTSTATUS,SetFormat) \ - ( THIS_ \ - __in PKSDATAFORMAT DataFormat \ - ) PURE; \ - STDMETHOD_(NTSTATUS,SetState) \ - ( THIS_ \ - __in KSSTATE State \ - ) PURE; \ - STDMETHOD_(NTSTATUS,GetPosition) \ - ( THIS_ \ - __out PKSAUDIO_POSITION Position \ - ) PURE; \ - STDMETHOD_(NTSTATUS,AllocateAudioBuffer) \ - ( THIS_ \ - __in ULONG RequestedSize, \ - __out PMDL *AudioBufferMdl, \ - __out ULONG *ActualSize, \ - __out ULONG *OffsetFromFirstPage, \ - __out MEMORY_CACHING_TYPE *CacheType \ - ) PURE; \ - STDMETHOD_(VOID,FreeAudioBuffer) \ - ( THIS_ \ - __in_opt PMDL AudioBufferMdl, \ - __in ULONG BufferSize \ - ) PURE; \ - STDMETHOD_(VOID,GetHWLatency) \ - ( THIS_ \ - __out KSRTAUDIO_HWLATENCY *hwLatency \ - ) PURE; \ - STDMETHOD_(NTSTATUS,GetPositionRegister) \ - ( THIS_ \ - __out KSRTAUDIO_HWREGISTER *Register \ - ) PURE; \ - STDMETHOD_(NTSTATUS,GetClockRegister) \ - ( THIS_ \ - __out KSRTAUDIO_HWREGISTER *Register \ - ) PURE; - -#endif //!defined(DEFINE_ABSTRACT_MINIPORTWAVERTSTREAM) - -#if !defined(DEFINE_ABSTRACT_ADAPTERPOWERMANAGEMENT) - -#define DEFINE_ABSTRACT_ADAPTERPOWERMANAGEMENT() \ - STDMETHOD_(void,PowerChangeState) \ - ( THIS_ \ - __in POWER_STATE NewState \ - ) PURE; \ - STDMETHOD_(NTSTATUS,QueryPowerChangeState) \ - ( THIS_ \ - __in POWER_STATE NewStateQuery \ - ) PURE; \ - STDMETHOD_(NTSTATUS,QueryDeviceCapabilities) \ - ( THIS_ \ - __in PDEVICE_CAPABILITIES PowerDeviceCaps \ - ) PURE; - -#endif //!defined(DEFINE_ABSTRACT_ADAPTERPOWERMANAGEMENT) - -/***************************************************************************** - * IResourceList - ***************************************************************************** - * List of resources. - */ -DECLARE_INTERFACE_(IResourceList,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(ULONG,NumberOfEntries) - ( THIS - ) PURE; - - STDMETHOD_(ULONG,NumberOfEntriesOfType) - ( THIS_ - __in CM_RESOURCE_TYPE Type - ) PURE; - - STDMETHOD_(PCM_PARTIAL_RESOURCE_DESCRIPTOR,FindTranslatedEntry) - ( THIS_ - __in CM_RESOURCE_TYPE Type, - __in ULONG Index - ) PURE; - - STDMETHOD_(PCM_PARTIAL_RESOURCE_DESCRIPTOR,FindUntranslatedEntry) - ( THIS_ - __in CM_RESOURCE_TYPE Type, - __in ULONG Index - ) PURE; - - STDMETHOD_(NTSTATUS,AddEntry) - ( THIS_ - __in PCM_PARTIAL_RESOURCE_DESCRIPTOR Translated, - __in PCM_PARTIAL_RESOURCE_DESCRIPTOR Untranslated - ) PURE; - - STDMETHOD_(NTSTATUS,AddEntryFromParent) - ( THIS_ - __in struct IResourceList * Parent, - __in CM_RESOURCE_TYPE Type, - __in ULONG Index - ) PURE; - - STDMETHOD_(PCM_RESOURCE_LIST,TranslatedList) - ( THIS - ) PURE; - - STDMETHOD_(PCM_RESOURCE_LIST,UntranslatedList) - ( THIS - ) PURE; -}; - -typedef IResourceList *PRESOURCELIST; - -#ifdef PC_IMPLEMENTATION -#define IMP_IResourceList\ - STDMETHODIMP_(ULONG)NumberOfEntries\ - ( void\ - );\ - STDMETHODIMP_(ULONG) NumberOfEntriesOfType\ - ( __in CM_RESOURCE_TYPE Type\ - );\ - STDMETHODIMP_(PCM_PARTIAL_RESOURCE_DESCRIPTOR) FindTranslatedEntry\ - ( __in CM_RESOURCE_TYPE Type,\ - __in ULONG Index\ - );\ - STDMETHODIMP_(PCM_PARTIAL_RESOURCE_DESCRIPTOR) FindUntranslatedEntry\ - ( __in CM_RESOURCE_TYPE Type,\ - __in ULONG Index\ - );\ - STDMETHODIMP_(NTSTATUS) AddEntry\ - ( __in PCM_PARTIAL_RESOURCE_DESCRIPTOR Translated,\ - __in PCM_PARTIAL_RESOURCE_DESCRIPTOR Untranslated\ - );\ - STDMETHODIMP_(NTSTATUS) AddEntryFromParent\ - ( __in struct IResourceList * Parent,\ - __in CM_RESOURCE_TYPE Type,\ - __in ULONG Index\ - );\ - STDMETHODIMP_(PCM_RESOURCE_LIST) TranslatedList\ - ( void\ - );\ - STDMETHODIMP_(PCM_RESOURCE_LIST) UntranslatedList\ - ( void\ - ) -#endif - - -#define NumberOfPorts() NumberOfEntriesOfType(CmResourceTypePort) -#define FindTranslatedPort(n) FindTranslatedEntry(CmResourceTypePort,(n)) -#define FindUntranslatedPort(n) FindUntranslatedEntry(CmResourceTypePort,(n)) -#define AddPortFromParent(p,n) AddEntryFromParent((p),CmResourceTypePort,(n)) - -#define NumberOfInterrupts() NumberOfEntriesOfType(CmResourceTypeInterrupt) -#define FindTranslatedInterrupt(n) FindTranslatedEntry(CmResourceTypeInterrupt,(n)) -#define FindUntranslatedInterrupt(n) FindUntranslatedEntry(CmResourceTypeInterrupt,(n)) -#define AddInterruptFromParent(p,n) AddEntryFromParent((p),CmResourceTypeInterrupt,(n)) - -#define NumberOfMemories() NumberOfEntriesOfType(CmResourceTypeMemory) -#define FindTranslatedMemory(n) FindTranslatedEntry(CmResourceTypeMemory,(n)) -#define FindUntranslatedMemory(n) FindUntranslatedEntry(CmResourceTypeMemory,(n)) -#define AddMemoryFromParent(p,n) AddEntryFromParent((p),CmResourceTypeMemory,(n)) - -#define NumberOfDmas() NumberOfEntriesOfType(CmResourceTypeDma) -#define FindTranslatedDma(n) FindTranslatedEntry(CmResourceTypeDma,(n)) -#define FindUntranslatedDma(n) FindUntranslatedEntry(CmResourceTypeDma,(n)) -#define AddDmaFromParent(p,n) AddEntryFromParent((p),CmResourceTypeDma,(n)) - -#define NumberOfDeviceSpecifics() NumberOfEntriesOfType(CmResourceTypeDeviceSpecific) -#define FindTranslatedDeviceSpecific(n) FindTranslatedEntry(CmResourceTypeDeviceSpecific,(n)) -#define FindUntranslatedDeviceSpecific(n) FindUntranslatedEntry(CmResourceTypeDeviceSpecific,(n)) -#define AddDeviceSpecificFromParent(p,n) AddEntryFromParent((p),CmResourceTypeDeviceSpecific,(n)) - -#define NumberOfBusNumbers() NumberOfEntriesOfType(CmResourceTypeBusNumber) -#define FindTranslatedBusNumber(n) FindTranslatedEntry(CmResourceTypeBusNumber,(n)) -#define FindUntranslatedBusNumber(n) FindUntranslatedEntry(CmResourceTypeBusNumber,(n)) -#define AddBusNumberFromParent(p,n) AddEntryFromParent((p),CmResourceTypeBusNumber,(n)) - -#define NumberOfDevicePrivates() NumberOfEntriesOfType(CmResourceTypeDevicePrivate) -#define FindTranslatedDevicePrivate(n) FindTranslatedEntry(CmResourceTypeDevicePrivate,(n)) -#define FindUntranslatedDevicePrivate(n) FindUntranslatedEntry(CmResourceTypeDevicePrivate,(n)) -#define AddDevicePrivateFromParent(p,n) AddEntryFromParent((p),CmResourceTypeDevicePrivate,(n)) - -#define NumberOfAssignedResources() NumberOfEntriesOfType(CmResourceTypeAssignedResource) -#define FindTranslatedAssignedResource(n) FindTranslatedEntry(CmResourceTypeAssignedResource,(n)) -#define FindUntranslatedAssignedResource(n) FindUntranslatedEntry(CmResourceTypeAssignedResource,(n)) -#define AddAssignedResourceFromParent(p,n) AddEntryFromParent((p),CmResourceTypeAssignedResource,(n)) - -#define NumberOfSubAllocateFroms() NumberOfEntriesOfType(CmResourceTypeSubAllocateFrom) -#define FindTranslatedSubAllocateFrom(n) FindTranslatedEntry(CmResourceTypeSubAllocateFrom,(n)) -#define FindUntranslatedSubAllocateFrom(n) FindUntranslatedEntry(CmResourceTypeSubAllocateFrom,(n)) -#define AddSubAllocateFromFromParent(p,n) AddEntryFromParent((p),CmResourceTypeSubAllocateFrom,(n)) - -/***************************************************************************** - * IDmaChannel - ***************************************************************************** - * Interface for DMA channel. - */ -DECLARE_INTERFACE_(IDmaChannel,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_DMACHANNEL() // For IDmaChannel -}; - -typedef IDmaChannel *PDMACHANNEL; - -#ifdef PC_IMPLEMENTATION -#define IMP_IDmaChannel\ - STDMETHODIMP_(NTSTATUS) AllocateBuffer\ - ( __in ULONG BufferSize,\ - __in_opt PPHYSICAL_ADDRESS PhysicalAddressConstraint\ - );\ - STDMETHODIMP_(void) FreeBuffer\ - ( void\ - );\ - STDMETHODIMP_(ULONG) TransferCount\ - ( void\ - );\ - STDMETHODIMP_(ULONG) MaximumBufferSize\ - ( void\ - );\ - STDMETHODIMP_(ULONG) AllocatedBufferSize\ - ( void\ - );\ - STDMETHODIMP_(ULONG) BufferSize\ - ( void\ - );\ - STDMETHODIMP_(void) SetBufferSize\ - ( __in ULONG BufferSize\ - );\ - STDMETHODIMP_(PVOID) SystemAddress\ - ( void\ - );\ - STDMETHODIMP_(PHYSICAL_ADDRESS) PhysicalAddress\ - ( void\ - );\ - STDMETHODIMP_(PADAPTER_OBJECT) GetAdapterObject\ - ( void\ - );\ - STDMETHODIMP_(void) CopyTo\ - ( __inout_bcount(ByteCount) PVOID Destination,\ - __in PVOID Source,\ - __in ULONG ByteCount\ - );\ - STDMETHODIMP_(void) CopyFrom\ - ( __inout_bcount(ByteCount) PVOID Destination,\ - __in PVOID Source,\ - __in ULONG ByteCount\ - ) -#endif - -// -// For Longhorn we don't support DMA channel slave functions, but we need -// to define PDMACHANNELSLAVE so that we can compile NewSlaveDmaChannel -// which we need for forward compatibility. -// -#if (NTDDI_VERSION < NTDDI_VISTA) -/***************************************************************************** - * IDmaChannelSlave - ***************************************************************************** - * Interface for slave DMA channel. - */ -DECLARE_INTERFACE_(IDmaChannelSlave,IDmaChannel) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_DMACHANNEL() // For IDmaChannel - - DEFINE_ABSTRACT_DMACHANNELSLAVE() // For IDmaChannelSlave -}; - -typedef IDmaChannelSlave *PDMACHANNELSLAVE; - -#ifdef PC_IMPLEMENTATION -#define IMP_IDmaChannelSlave\ - IMP_IDmaChannel;\ - STDMETHODIMP_(NTSTATUS) Start\ - ( __in ULONG MapSize,\ - __in BOOLEAN WriteToDevice\ - );\ - STDMETHODIMP_(NTSTATUS) Stop\ - ( void\ - );\ - STDMETHODIMP_(ULONG) ReadCounter\ - ( void\ - );\ - STDMETHODIMP_(NTSTATUS) WaitForTC\ - ( ULONG Timeout\ - ) -#endif -#else // NTDDI_VERSION < NTDDI_VISTA -// -// This is a dummy definition for PDMACHANNELSLAVE. -// -typedef PVOID PDMACHANNELSLAVE; -#endif // NTDDI_VERSION < NTDDI_VISTA - -/***************************************************************************** - * INTERRUPTSYNCMODE - ***************************************************************************** - * Interrupt sync mode of operation. - */ -typedef enum -{ - InterruptSyncModeNormal = 1, // One pass, stop when successful. - InterruptSyncModeAll, // One pass regardless of success. - InterruptSyncModeRepeat // Repeat until all return unsuccessful. -} INTERRUPTSYNCMODE; - -/***************************************************************************** - * PINTERRUPTSYNCROUTINE - ***************************************************************************** - * Pointer to an interrupt synchronization routine. Both interrupt service - * routines and routines that are synchronized with ISRs use this type. - */ -typedef NTSTATUS -(*PINTERRUPTSYNCROUTINE) -( - __in struct IInterruptSync * InterruptSync, - __in PVOID DynamicContext -); - -/***************************************************************************** - * IInterruptSync - ***************************************************************************** - * Interface for objects providing access synchronization with interrupts. - */ -DECLARE_INTERFACE_(IInterruptSync,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(NTSTATUS,CallSynchronizedRoutine) - ( THIS_ - __in PINTERRUPTSYNCROUTINE Routine, - __in PVOID DynamicContext - ) PURE; - STDMETHOD_(PKINTERRUPT,GetKInterrupt) - ( THIS - ) PURE; - STDMETHOD_(NTSTATUS,Connect) - ( THIS - ) PURE; - STDMETHOD_(void,Disconnect) - ( THIS - ) PURE; - STDMETHOD_(NTSTATUS,RegisterServiceRoutine) - ( THIS_ - __in PINTERRUPTSYNCROUTINE Routine, - __in PVOID DynamicContext, - __in BOOLEAN First - ) PURE; -}; - -typedef IInterruptSync *PINTERRUPTSYNC; - -#ifdef PC_IMPLEMENTATION -#define IMP_IInterruptSync\ - STDMETHODIMP_(NTSTATUS) CallSynchronizedRoutine\ - ( __in PINTERRUPTSYNCROUTINE Routine,\ - __in PVOID DynamicContext\ - );\ - STDMETHODIMP_(PKINTERRUPT) GetKInterrupt\ - ( void\ - );\ - STDMETHODIMP_(NTSTATUS) Connect\ - ( void\ - );\ - STDMETHODIMP_(void) Disconnect\ - ( void\ - );\ - STDMETHODIMP_(NTSTATUS) RegisterServiceRoutine\ - ( __in PINTERRUPTSYNCROUTINE Routine,\ - __in PVOID DynamicContext,\ - __in BOOLEAN First\ - ) -#endif - -/***************************************************************************** - * IServiceSink - ***************************************************************************** - * Interface for notification sinks for service groups. - */ -DECLARE_INTERFACE_(IServiceSink,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - // For IServiceSink - STDMETHOD_(void,RequestService) - ( THIS - ) PURE; -}; - -typedef IServiceSink *PSERVICESINK; - -#ifdef PC_IMPLEMENTATION -#define IMP_IServiceSink\ - STDMETHODIMP_(void) RequestService\ - ( void\ - ) -#endif - -/***************************************************************************** - * IServiceGroup - ***************************************************************************** - * Interface for objects representing a group that is serviced collectively. - */ -DECLARE_INTERFACE_(IServiceGroup,IServiceSink) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - // For IServiceSink - STDMETHOD_(void,RequestService) - ( THIS - ) PURE; - - // For IServiceGroup - STDMETHOD_(NTSTATUS,AddMember) - ( THIS_ - __in PSERVICESINK pServiceSink - ) PURE; - - STDMETHOD_(void,RemoveMember) - ( THIS_ - __in PSERVICESINK pServiceSink - ) PURE; - - STDMETHOD_(void,SupportDelayedService) - ( THIS - ) PURE; - - STDMETHOD_(void,RequestDelayedService) - ( THIS_ - __in ULONGLONG ullDelay - ) PURE; - - STDMETHOD_(void,CancelDelayedService) - ( THIS - ) PURE; -}; - -typedef IServiceGroup *PSERVICEGROUP; - -#ifdef PC_IMPLEMENTATION -#define IMP_IServiceGroup\ - IMP_IServiceSink;\ - STDMETHODIMP_(NTSTATUS) AddMember\ - ( __in PSERVICESINK pServiceSink\ - );\ - STDMETHODIMP_(void) RemoveMember\ - ( __in PSERVICESINK pServiceSink\ - );\ - STDMETHODIMP_(void) SupportDelayedService\ - ( void\ - );\ - STDMETHODIMP_(void) RequestDelayedService\ - ( __in ULONGLONG ullDelay\ - );\ - STDMETHODIMP_(void) CancelDelayedService\ - ( void\ - ) -#endif - -/***************************************************************************** - * IRegistryKey - ***************************************************************************** - * Interface for objects providing access to a registry key. - */ -DECLARE_INTERFACE_(IRegistryKey,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(NTSTATUS,QueryKey) - ( THIS_ - __in KEY_INFORMATION_CLASS KeyInformationClass, - __out PVOID KeyInformation, - __in ULONG Length, - __out PULONG ResultLength - ) PURE; - - STDMETHOD_(NTSTATUS,EnumerateKey) - ( THIS_ - __in ULONG Index, - __in KEY_INFORMATION_CLASS KeyInformationClass, - __out PVOID KeyInformation, - __in ULONG Length, - __out PULONG ResultLength - ) PURE; - - STDMETHOD_(NTSTATUS,QueryValueKey) - ( THIS_ - __in PUNICODE_STRING ValueName, - __in KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, - __out PVOID KeyValueInformation, - __in ULONG Length, - __out PULONG ResultLength - ) PURE; - - STDMETHOD_(NTSTATUS,EnumerateValueKey) - ( THIS_ - __in ULONG Index, - __in KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, - __out PVOID KeyValueInformation, - __in ULONG Length, - __out PULONG ResultLength - ) PURE; - - STDMETHOD_(NTSTATUS,SetValueKey) - ( THIS_ - __in_opt PUNICODE_STRING ValueName, - __in ULONG Type, - __in PVOID Data, - __in ULONG DataSize - ) PURE; - - STDMETHOD_(NTSTATUS,QueryRegistryValues) - ( THIS_ - __in PRTL_QUERY_REGISTRY_TABLE QueryTable, - __in_opt PVOID Context - ) PURE; - - STDMETHOD_(NTSTATUS,NewSubKey) - ( THIS_ - __out IRegistryKey ** RegistrySubKey, - __in PUNKNOWN OuterUnknown, - __in ACCESS_MASK DesiredAccess, - __in PUNICODE_STRING SubKeyName, - __in ULONG CreateOptions, - __out_opt PULONG Disposition - ) PURE; - - STDMETHOD_(NTSTATUS,DeleteKey) - ( THIS - ) PURE; -}; - -typedef IRegistryKey *PREGISTRYKEY; - -#ifdef PC_IMPLEMENTATION -#define IMP_IRegistryKey\ - STDMETHODIMP_(NTSTATUS) QueryKey\ - ( __in KEY_INFORMATION_CLASS KeyInformationClass,\ - __out PVOID KeyInformation,\ - __in ULONG Length,\ - __out PULONG ResultLength\ - );\ - STDMETHODIMP_(NTSTATUS) EnumerateKey\ - ( __in ULONG Index,\ - __in KEY_INFORMATION_CLASS KeyInformationClass,\ - __out PVOID KeyInformation,\ - __in ULONG Length,\ - __out PULONG ResultLength\ - );\ - STDMETHODIMP_(NTSTATUS) QueryValueKey\ - ( __in PUNICODE_STRING ValueName,\ - __in KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,\ - __out PVOID KeyValueInformation,\ - __in ULONG Length,\ - __out PULONG ResultLength\ - );\ - STDMETHODIMP_(NTSTATUS) EnumerateValueKey\ - ( __in ULONG Index,\ - __in KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,\ - __out PVOID KeyValueInformation,\ - __in ULONG Length,\ - __out PULONG ResultLength\ - );\ - STDMETHODIMP_(NTSTATUS) SetValueKey\ - ( __in_opt PUNICODE_STRING ValueName,\ - __in ULONG Type,\ - __in PVOID Data,\ - __in ULONG DataSize\ - );\ - STDMETHODIMP_(NTSTATUS) QueryRegistryValues\ - ( __in PRTL_QUERY_REGISTRY_TABLE QueryTable,\ - __in_opt PVOID Context\ - );\ - STDMETHODIMP_(NTSTATUS) NewSubKey\ - ( __out IRegistryKey ** RegistrySubKey,\ - __in PUNKNOWN OuterUnknown,\ - __in ACCESS_MASK DesiredAccess,\ - __in PUNICODE_STRING SubKeyName,\ - __in ULONG CreateOptions,\ - __out_opt PULONG Disposition\ - );\ - STDMETHODIMP_(NTSTATUS) DeleteKey\ - ( void\ - ) -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -/***************************************************************************** - * IMusicTechnology - ***************************************************************************** - * Interface for setting MusicTechnology. - */ -DECLARE_INTERFACE_(IMusicTechnology,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - // For IMusicTechnology - STDMETHOD_(NTSTATUS,SetTechnology) - ( THIS_ - __in const GUID * Technology - ) PURE; -}; - -typedef IMusicTechnology *PMUSICTECHNOLOGY; - -#define IMP_IMusicTechnology\ - STDMETHODIMP_(NTSTATUS) SetTechnology\ - ( __in const GUID * Technology\ - ) -#endif - -typedef struct _PCPROPERTY_REQUEST PCPROPERTY_REQUEST, *PPCPROPERTY_REQUEST; -typedef struct _PCMETHOD_REQUEST PCMETHOD_REQUEST, *PPCMETHOD_REQUEST; -typedef struct _PCEVENT_REQUEST PCEVENT_REQUEST, *PPCEVENT_REQUEST; - -/***************************************************************************** - * PCPFNPROPERTY_HANDLER - ***************************************************************************** - * Property handler function prototype. - * - * All property accesses and support queries for a given property on a given - * filter, pin or node are routed to a single handler. The parameter contains - * complete information regarding the request. The handler may return - * STATUS_PENDING, in which case it must eventually call - * PcCompletePendingPropertyRequest() to complete the request. - */ -typedef -NTSTATUS -(*PCPFNPROPERTY_HANDLER) -( - __in PPCPROPERTY_REQUEST PropertyRequest -); - -/***************************************************************************** - * PCPFNMETHOD_HANDLER - ***************************************************************************** - * Method handler function prototype. - * - * All method calls and support queries for a given method on a given filter, - * pin or node are routed to a single handler. The parameter contains - * complete information regarding the request. The handler may return - * STATUS_PENDING, in which case it must eventually call - * PcCompletePendingMethodRequest() to complete the request. - */ -typedef -NTSTATUS -(*PCPFNMETHOD_HANDLER) -( - __in PPCMETHOD_REQUEST MethodRequest -); - -/***************************************************************************** - * PCPFNEVENT_HANDLER - ***************************************************************************** - * Event handler function prototype. - * - * All event add and remove requests and all event support queries for a - * given event on a given filter, pin or node are routed to a single handler. - * The parameter contains complete information regarding the request. The - * handler may return STATUS_PENDING, in which case it must eventually call - * PcCompletePendingEventRequest() to complete the request. - */ -typedef -NTSTATUS -(*PCPFNEVENT_HANDLER) -( - __in PPCEVENT_REQUEST EventRequest -); - -/***************************************************************************** - * PCPROPERTY_ITEM - ***************************************************************************** - * Property table entry. - * - * A property item describes a property supported by a given filter, pin or - * node. The flags indicate what operations regarding the property are - * supported and specify selected options with respect to the port's handling - * of property requests. - */ -typedef struct -{ - const GUID * Set; - ULONG Id; - ULONG Flags; -#define PCPROPERTY_ITEM_FLAG_GET KSPROPERTY_TYPE_GET -#define PCPROPERTY_ITEM_FLAG_SET KSPROPERTY_TYPE_SET -#define PCPROPERTY_ITEM_FLAG_BASICSUPPORT KSPROPERTY_TYPE_BASICSUPPORT -//not supported #define PCPROPERTY_ITEM_FLAG_RELATIONS KSPROPERTY_TYPE_RELATIONS -#define PCPROPERTY_ITEM_FLAG_SERIALIZERAW KSPROPERTY_TYPE_SERIALIZERAW -#define PCPROPERTY_ITEM_FLAG_UNSERIALIZERAW KSPROPERTY_TYPE_UNSERIALIZERAW -#define PCPROPERTY_ITEM_FLAG_SERIALIZESIZE KSPROPERTY_TYPE_SERIALIZESIZE -#define PCPROPERTY_ITEM_FLAG_SERIALIZE\ - (PCPROPERTY_ITEM_FLAG_SERIALIZERAW\ - |PCPROPERTY_ITEM_FLAG_UNSERIALIZERAW\ - |PCPROPERTY_ITEM_FLAG_SERIALIZESIZE\ - ) -#define PCPROPERTY_ITEM_FLAG_DEFAULTVALUES KSPROPERTY_TYPE_DEFAULTVALUES - PCPFNPROPERTY_HANDLER Handler; -} -PCPROPERTY_ITEM, *PPCPROPERTY_ITEM; - -/***************************************************************************** - * PCMETHOD_ITEM - ***************************************************************************** - * Method table entry. - * - * A method item describes a method supported by a given filter, pin or node. - * The flags indicate what operations regarding the method are supported and - * specify selected options with respect to the port's handling of method - * requests. - */ -typedef struct -{ - const GUID * Set; - ULONG Id; - ULONG Flags; -#define PCMETHOD_ITEM_FLAG_NONE KSMETHOD_TYPE_NONE -#define PCMETHOD_ITEM_FLAG_READ KSMETHOD_TYPE_READ -#define PCMETHOD_ITEM_FLAG_WRITE KSMETHOD_TYPE_WRITE -#define PCMETHOD_ITEM_FLAG_MODIFY KSMETHOD_TYPE_MODIFY -#define PCMETHOD_ITEM_FLAG_SOURCE KSMETHOD_TYPE_SOURCE -#define PCMETHOD_ITEM_FLAG_BASICSUPPORT KSMETHOD_TYPE_BASICSUPPORT - PCPFNMETHOD_HANDLER Handler; -} -PCMETHOD_ITEM, *PPCMETHOD_ITEM; - -/***************************************************************************** - * PCEVENT_ITEM - ***************************************************************************** - * Event table entry. - * - * An event item describes an event supported by a given filter, pin or node. - * The flags indicate what operations regarding the event are supported and - * specify selected options with respect to the port's handling of event - * requests. - */ -typedef struct -{ - const GUID * Set; - ULONG Id; - ULONG Flags; -#define PCEVENT_ITEM_FLAG_ENABLE KSEVENT_TYPE_ENABLE -#define PCEVENT_ITEM_FLAG_ONESHOT KSEVENT_TYPE_ONESHOT -#define PCEVENT_ITEM_FLAG_BASICSUPPORT KSEVENT_TYPE_BASICSUPPORT - PCPFNEVENT_HANDLER Handler; -} -PCEVENT_ITEM, *PPCEVENT_ITEM; - -/***************************************************************************** - * PCPROPERTY_REQUEST - ***************************************************************************** - * Property request submitted to a property handler. - * - * This is the form that a property request takes. Although the major target - * is generic, in the case of miniports, it will be a pointer to the miniport - * object. Likewise, the minor target is the stream or voice if the request - * is specific to a stream or voice. Otherwise, the minor target is NULL. - * If the request is targeted at a node, the Node parameter will specify which - * one, otherwise it will be ULONG(-1). If the target is a node, the minor - * target may be specified to indicate the stream or voice with which the - * targeted node instance is associated. - */ -typedef struct _PCPROPERTY_REQUEST -{ - PUNKNOWN MajorTarget; - PUNKNOWN MinorTarget; - ULONG Node; - const PCPROPERTY_ITEM * PropertyItem; - ULONG Verb; - ULONG InstanceSize; - PVOID Instance; - ULONG ValueSize; - PVOID Value; - PIRP Irp; -} -PCPROPERTY_REQUEST, *PPCPROPERTY_REQUEST; - -/***************************************************************************** - * PCMETHOD_REQUEST - ***************************************************************************** - * Method request submitted to a property handler. - * - * Comments in the description of PCPROPERTY_REQUEST regarding the target - * fields apply to this structure as well. - */ -typedef struct _PCMETHOD_REQUEST -{ - PUNKNOWN MajorTarget; - PUNKNOWN MinorTarget; - ULONG Node; - const PCMETHOD_ITEM * MethodItem; - ULONG Verb; - // TODO -} -PCMETHOD_REQUEST, *PPCMETHOD_REQUEST; - -/***************************************************************************** - * PCEVENT_REQUEST - ***************************************************************************** - * Event request submitted to a property handler. - * - * Comments in the description of PCPROPERTY_REQUEST regarding the target - * fields apply to this structure as well. - */ -typedef struct _PCEVENT_REQUEST -{ - PUNKNOWN MajorTarget; - PUNKNOWN MinorTarget; - ULONG Node; - const PCEVENT_ITEM * EventItem; - PKSEVENT_ENTRY EventEntry; - ULONG Verb; - PIRP Irp; -} -PCEVENT_REQUEST, *PPCEVENT_REQUEST; - -#define PCEVENT_VERB_NONE 0 -#define PCEVENT_VERB_ADD 1 -#define PCEVENT_VERB_REMOVE 2 -#define PCEVENT_VERB_SUPPORT 4 - -/***************************************************************************** - * PCAUTOMATION_TABLE - ***************************************************************************** - * Master table of properties, methods and events. - * - * Any of the item pointers may be NULL, in which case, corresponding counts - * must be zero. For item tables that are not zero length, the item size must - * not be smaller than the size of the item structure defined by port class. - * The item size may be larger, in which case the port class item structure is - * assumed to be followed by private data. Item sizes must be a multiple of - * 8. - */ -typedef struct -{ - ULONG PropertyItemSize; - ULONG PropertyCount; - const PCPROPERTY_ITEM * Properties; - ULONG MethodItemSize; - ULONG MethodCount; - const PCMETHOD_ITEM * Methods; - ULONG EventItemSize; - ULONG EventCount; - const PCEVENT_ITEM * Events; - ULONG Reserved; -} -PCAUTOMATION_TABLE, *PPCAUTOMATION_TABLE; - -#define DEFINE_PCAUTOMATION_TABLE_PROP(AutomationTable,PropertyTable)\ -const PCAUTOMATION_TABLE AutomationTable =\ -{\ - sizeof(PropertyTable[0]),\ - SIZEOF_ARRAY(PropertyTable),\ - (const PCPROPERTY_ITEM *) PropertyTable,\ - 0,0,NULL,\ - 0,0,NULL,\ - 0\ -} - -#define DEFINE_PCAUTOMATION_TABLE_PROP_EVENT(AutomationTable,PropertyTable,EventTable)\ -const PCAUTOMATION_TABLE AutomationTable =\ -{\ - sizeof(PropertyTable[0]),\ - SIZEOF_ARRAY(PropertyTable),\ - (const PCPROPERTY_ITEM *) PropertyTable,\ - 0,0,NULL,\ - sizeof(EventTable[0]),\ - SIZEOF_ARRAY(EventTable),\ - (const PCEVENT_ITEM *) EventTable,\ - 0\ -} - -#define DEFINE_PCAUTOMATION_TABLE_EVENT(AutomationTable,EventTable)\ -const PCAUTOMATION_TABLE AutomationTable =\ -{\ - 0,0,NULL,\ - 0,0,NULL,\ - sizeof(EventTable[0]),\ - SIZEOF_ARRAY(EventTable),\ - (const PCEVENT_ITEM *) EventTable,\ - 0\ -} - -/***************************************************************************** - * PCPIN_DESCRIPTOR for IMiniport::GetDescription() - ***************************************************************************** - * Description of a pin on the filter implemented by the miniport. - * - * MaxGlobalInstanceCount and MaxFilterInstanceCount may be zero to indicate - * that the pin may not be instantiated, ULONG(-1) to indicate the pin may be - * allocated any number of times, or any other value to indicate a specific - * number of times the pin may be allocated. MinFilterInstanceCount may not - * be ULONG(-1) because it specifies a definite lower bound on the number of - * instances of a pin that must exist in order for a filter to function. - * - * The KS pin descriptor may have zero interfaces and zero mediums. The list - * of interfaces is ignored in all cases. The medium list will default to - * a list containing only the standard medium (device I/O). - * - * The automation table pointer may be NULL indicating that no automation is - * supported. - */ -typedef struct -{ - ULONG MaxGlobalInstanceCount; - ULONG MaxFilterInstanceCount; - ULONG MinFilterInstanceCount; - const PCAUTOMATION_TABLE * AutomationTable; - KSPIN_DESCRIPTOR KsPinDescriptor; -} -PCPIN_DESCRIPTOR, *PPCPIN_DESCRIPTOR; - -/***************************************************************************** - * PCNODE_DESCRIPTOR for IMiniport::GetDescription() - ***************************************************************************** - * Description of a node in the filter implemented by the miniport. - * - * The automation table pointer may be NULL indicating that no automation is - * supported. The name GUID pointer may be NULL indicating that the type GUID - * should be used to determine the node name. - */ -typedef struct -{ - ULONG Flags; - const PCAUTOMATION_TABLE * AutomationTable; - const GUID * Type; - const GUID * Name; -} -PCNODE_DESCRIPTOR, *PPCNODE_DESCRIPTOR; - -/***************************************************************************** - * PCCONNECTION_DESCRIPTOR for IMiniport::GetDescription() - ***************************************************************************** - * Description of a node connection in the topology of the filter implemented - * by the miniport. - */ -typedef KSTOPOLOGY_CONNECTION -PCCONNECTION_DESCRIPTOR, *PPCCONNECTION_DESCRIPTOR; - -/***************************************************************************** - * PCFILTER_DESCRIPTOR for IMiniport::GetDescription() - ***************************************************************************** - * Description of the of the filter implemented by a miniport, including - * pins, nodes, connections and properties. - * - * The version number should be zero. - */ -typedef struct -{ - ULONG Version; - const PCAUTOMATION_TABLE * AutomationTable; - ULONG PinSize; - ULONG PinCount; - const PCPIN_DESCRIPTOR * Pins; - ULONG NodeSize; - ULONG NodeCount; - const PCNODE_DESCRIPTOR * Nodes; - ULONG ConnectionCount; - const PCCONNECTION_DESCRIPTOR * Connections; - ULONG CategoryCount; - const GUID * Categories; -} -PCFILTER_DESCRIPTOR, *PPCFILTER_DESCRIPTOR; - -/***************************************************************************** - * PCFILTER_NODE for IMiniport::GetTopology() - ***************************************************************************** - * The placeholder for the FromNode or ToNode fields in connections which - * describe connections to the filter's pins. - */ -#define PCFILTER_NODE KSFILTER_NODE - -/***************************************************************************** - * IMiniport - ***************************************************************************** - * Interface common to all miniports. - */ -DECLARE_INTERFACE_(IMiniport,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_MINIPORT() // For IMiniport -}; - -typedef IMiniport *PMINIPORT; - -#define IMP_IMiniport\ - STDMETHODIMP_(NTSTATUS) GetDescription\ - ( __out PPCFILTER_DESCRIPTOR * Description\ - );\ - STDMETHODIMP_(NTSTATUS) DataRangeIntersection\ - ( __in ULONG PinId,\ - __in PKSDATARANGE DataRange,\ - __in PKSDATARANGE MatchingDataRange,\ - __in ULONG OutputBufferLength,\ - __out_opt PVOID ResultantFormat,\ - __out PULONG ResultantFormatLength\ - ) - -/***************************************************************************** - * IPort - ***************************************************************************** - * Interface common to all port lower edges. - */ -DECLARE_INTERFACE_(IPort,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_PORT() // For IPort -}; - -typedef IPort *PPORT; - -#ifdef PC_IMPLEMENTATION -#define IMP_IPort\ - STDMETHODIMP_(NTSTATUS) Init\ - ( __in PDEVICE_OBJECT DeviceObject,\ - __in_opt PIRP Irp,\ - __in PUNKNOWN UnknownMiniport,\ - __in_opt PUNKNOWN UnknownAdapter,\ - __in PRESOURCELIST ResourceList\ - );\ - STDMETHODIMP_(NTSTATUS) GetDeviceProperty\ - ( __in DEVICE_REGISTRY_PROPERTY DeviceProperty,\ - __in ULONG BufferLength,\ - __out PVOID PropertyBuffer,\ - __out PULONG ResultLength\ - );\ - STDMETHODIMP_(NTSTATUS) NewRegistryKey\ - ( __out PREGISTRYKEY * OutRegistryKey,\ - __in_opt PUNKNOWN OuterUnknown,\ - __in ULONG RegistryKeyType,\ - __in ACCESS_MASK DesiredAccess,\ - __in_opt POBJECT_ATTRIBUTES ObjectAttributes,\ - __in_opt ULONG CreateOptions,\ - __out_opt PULONG Disposition\ - ) -#endif - -/***************************************************************************** - * IPortMidi - ***************************************************************************** - * Interface for MIDI port lower edge. - */ -DECLARE_INTERFACE_(IPortMidi,IPort) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_PORT() // For IPort - - // For IPortMidi - STDMETHOD_(void,Notify) - ( THIS_ - __in_opt PSERVICEGROUP ServiceGroup - ) PURE; - - STDMETHOD_(void,RegisterServiceGroup) - ( THIS_ - __in PSERVICEGROUP ServiceGroup - ) PURE; -}; - -typedef IPortMidi *PPORTMIDI; - -#ifdef PC_IMPLEMENTATION -#define IMP_IPortMidi\ - IMP_IPort;\ - STDMETHODIMP_(void) Notify\ - ( __in_opt PSERVICEGROUP ServiceGroup\ - );\ - STDMETHODIMP_(void) RegisterServiceGroup\ - ( __in PSERVICEGROUP ServiceGroup\ - ) -#endif - -/***************************************************************************** - * IMiniportMidiStream - ***************************************************************************** - * Interface for MIDI miniport streams. - */ -DECLARE_INTERFACE_(IMiniportMidiStream,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(NTSTATUS,SetFormat) - ( THIS_ - __in PKSDATAFORMAT DataFormat - ) PURE; - - STDMETHOD_(NTSTATUS,SetState) - ( THIS_ - __in KSSTATE State - ) PURE; - - STDMETHOD_(NTSTATUS,Read) - ( THIS_ - __in PVOID BufferAddress, - __in ULONG BufferLength, - __out PULONG BytesRead - ) PURE; - - STDMETHOD_(NTSTATUS,Write) - ( THIS_ - __in PVOID BufferAddress, - __in ULONG BytesToWrite, - __out PULONG BytesWritten - ) PURE; -}; - -typedef IMiniportMidiStream *PMINIPORTMIDISTREAM; - -#define IMP_IMiniportMidiStream\ - STDMETHODIMP_(NTSTATUS) SetFormat\ - ( __in PKSDATAFORMAT DataFormat\ - );\ - STDMETHODIMP_(NTSTATUS) SetState\ - ( __in KSSTATE State\ - );\ - STDMETHODIMP_(NTSTATUS) Read\ - ( __in PVOID BufferAddress,\ - __in ULONG BufferLength,\ - __out PULONG BytesRead\ - );\ - STDMETHODIMP_(NTSTATUS) Write\ - ( __in PVOID BufferAddress,\ - __in ULONG BytesToWrite,\ - __out PULONG BytesWritten\ - ) - -/***************************************************************************** - * IMiniportMidi - ***************************************************************************** - * Interface for MIDI miniports. - */ -DECLARE_INTERFACE_(IMiniportMidi,IMiniport) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_MINIPORT() // For IMiniport - - // For IMiniportMidi - STDMETHOD_(NTSTATUS,Init) - ( THIS_ - __in PUNKNOWN UnknownAdapter, - __in PRESOURCELIST ResourceList, - __in PPORTMIDI Port, - __out PSERVICEGROUP * ServiceGroup - ) PURE; - - STDMETHOD_(void,Service) - ( THIS - ) PURE; - - STDMETHOD_(NTSTATUS,NewStream) - ( THIS_ - __out PMINIPORTMIDISTREAM * Stream, - __in_opt PUNKNOWN OuterUnknown, - __in POOL_TYPE PoolType, - __in ULONG Pin, - __in BOOLEAN Capture, - __in PKSDATAFORMAT DataFormat, - __out PSERVICEGROUP * ServiceGroup - ) PURE; -}; - -typedef IMiniportMidi *PMINIPORTMIDI; - -#define IMP_IMiniportMidi\ - IMP_IMiniport;\ - STDMETHODIMP_(NTSTATUS) Init\ - ( __in PUNKNOWN UnknownAdapter,\ - __in PRESOURCELIST ResourceList,\ - __in PPORTMIDI Port,\ - __out PSERVICEGROUP * ServiceGroup\ - );\ - STDMETHODIMP_(void) Service\ - ( void\ - );\ - STDMETHODIMP_(NTSTATUS) NewStream\ - ( __out PMINIPORTMIDISTREAM * Stream,\ - __in_opt PUNKNOWN OuterUnknown,\ - __in POOL_TYPE PoolType,\ - __in ULONG Pin,\ - __in BOOLEAN Capture,\ - __in PKSDATAFORMAT DataFormat,\ - __out PSERVICEGROUP * ServiceGroup\ - ) - -/***************************************************************************** - * IPortDMus - ***************************************************************************** - * See DMusicKS.h - */ - -/***************************************************************************** - * IMXF - ***************************************************************************** - * See DMusicKS.h - */ - -/***************************************************************************** - * IAllocatorMXF - ***************************************************************************** - * See DMusicKS.h - */ - -/***************************************************************************** - * IMiniportDMus - ***************************************************************************** - * See DMusicKS.h - */ - - -/***************************************************************************** - * IPortTopology - ***************************************************************************** - * Interface for topology port lower edge. - */ -DECLARE_INTERFACE_(IPortTopology,IPort) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_PORT() // For IPort -}; - -typedef IPortTopology *PPORTTOPOLOGY; - -#ifdef PC_IMPLEMENTATION -#define IMP_IPortTopology IMP_IPort -#endif - -/***************************************************************************** - * IMiniportTopology - ***************************************************************************** - * Interface for topology miniports. - */ -DECLARE_INTERFACE_(IMiniportTopology,IMiniport) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_MINIPORT() // For IMiniport - - // For IMiniportTopology - STDMETHOD_(NTSTATUS,Init) - ( THIS_ - __in PUNKNOWN UnknownAdapter, - __in PRESOURCELIST ResourceList, - __in PPORTTOPOLOGY Port - ) PURE; -}; - -typedef IMiniportTopology *PMINIPORTTOPOLOGY; - -#define IMP_IMiniportTopology\ - IMP_IMiniport;\ - STDMETHODIMP_(NTSTATUS) Init\ - ( __in PUNKNOWN UnknownAdapter,\ - __in PRESOURCELIST ResourceList,\ - __in PPORTTOPOLOGY Port\ - ) - -/***************************************************************************** - * IPortWaveCyclic - ***************************************************************************** - * Interface for cyclic wave port lower edge. - */ -DECLARE_INTERFACE_(IPortWaveCyclic,IPort) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_PORT() // For IPort - - // For IPortWaveCyclic - STDMETHOD_(void,Notify) - ( THIS_ - __in PSERVICEGROUP ServiceGroup - ) PURE; - - STDMETHOD_(NTSTATUS,NewSlaveDmaChannel) - ( THIS_ - __out PDMACHANNELSLAVE * DmaChannel, - __in PUNKNOWN OuterUnknown, - __in PRESOURCELIST ResourceList, - __in ULONG DmaIndex, - __in ULONG MaximumLength, - __in BOOLEAN DemandMode, - __in DMA_SPEED DmaSpeed - ) PURE; - - STDMETHOD_(NTSTATUS,NewMasterDmaChannel) - ( THIS_ - __out PDMACHANNEL * DmaChannel, - __in PUNKNOWN OuterUnknown, - __in_opt PRESOURCELIST ResourceList, - __in ULONG MaximumLength, - __in BOOLEAN Dma32BitAddresses, - __in BOOLEAN Dma64BitAddresses, - __in DMA_WIDTH DmaWidth, - __in DMA_SPEED DmaSpeed - ) PURE; -}; - -typedef IPortWaveCyclic *PPORTWAVECYCLIC; - -#ifdef PC_IMPLEMENTATION -#define IMP_IPortWaveCyclic\ - IMP_IPort;\ - STDMETHODIMP_(void) Notify\ - ( __in PSERVICEGROUP ServiceGroup\ - );\ - STDMETHODIMP_(NTSTATUS) NewSlaveDmaChannel\ - ( __out PDMACHANNELSLAVE * DmaChannel,\ - __in PUNKNOWN OuterUnknown,\ - __in PRESOURCELIST ResourceList,\ - __in ULONG DmaIndex,\ - __in ULONG MaximumLength,\ - __in BOOLEAN DemandMode,\ - __in DMA_SPEED DmaSpeed\ - );\ - STDMETHODIMP_(NTSTATUS) NewMasterDmaChannel\ - ( __out PDMACHANNEL * DmaChannel,\ - __in PUNKNOWN OuterUnknown,\ - __in_opt PRESOURCELIST ResourceList,\ - __in ULONG MaximumLength,\ - __in BOOLEAN Dma32BitAddresses,\ - __in BOOLEAN Dma64BitAddresses,\ - __in DMA_WIDTH DmaWidth,\ - __in DMA_SPEED DmaSpeed\ - ) -#endif - -/***************************************************************************** - * IMiniportWaveCyclicStream - ***************************************************************************** - * Interface for cyclic wave miniport streams. - */ -DECLARE_INTERFACE_(IMiniportWaveCyclicStream,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(NTSTATUS,SetFormat) - ( THIS_ - __in PKSDATAFORMAT DataFormat - ) PURE; - - STDMETHOD_(ULONG,SetNotificationFreq) - ( THIS_ - __in ULONG Interval, - __out PULONG FrameSize - ) PURE; - - STDMETHOD_(NTSTATUS,SetState) - ( THIS_ - __in KSSTATE State - ) PURE; - - STDMETHOD_(NTSTATUS,GetPosition) - ( THIS_ - __out PULONG Position - ) PURE; - - STDMETHOD_(NTSTATUS,NormalizePhysicalPosition) - ( THIS_ - __inout PLONGLONG PhysicalPosition - ) PURE; - - STDMETHOD_(void,Silence) - ( THIS_ - __in PVOID Buffer, - __in ULONG ByteCount - ) PURE; -}; - -typedef IMiniportWaveCyclicStream *PMINIPORTWAVECYCLICSTREAM; - -#define IMP_IMiniportWaveCyclicStream\ - STDMETHODIMP_(NTSTATUS) SetFormat\ - ( __in PKSDATAFORMAT DataFormat\ - );\ - STDMETHODIMP_(ULONG) SetNotificationFreq\ - ( __in ULONG Interval,\ - __out PULONG FrameSize\ - );\ - STDMETHODIMP_(NTSTATUS) SetState\ - ( __in KSSTATE State\ - );\ - STDMETHODIMP_(NTSTATUS) GetPosition\ - ( __out PULONG Position\ - );\ - STDMETHODIMP_(NTSTATUS) NormalizePhysicalPosition\ - ( __inout PLONGLONG PhysicalPosition\ - );\ - STDMETHODIMP_(void) Silence\ - ( __in PVOID Buffer,\ - __in ULONG ByteCount\ - ) - -/***************************************************************************** - * IMiniportWaveCyclic - ***************************************************************************** - * Interface for cyclic wave miniports. - */ -DECLARE_INTERFACE_(IMiniportWaveCyclic,IMiniport) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_MINIPORT() // For IMiniport - - // For IMiniportWaveCyclic - STDMETHOD_(NTSTATUS,Init) - ( THIS_ - __in PUNKNOWN UnknownAdapter, - __in PRESOURCELIST ResourceList, - __in PPORTWAVECYCLIC Port - ) PURE; - - STDMETHOD_(NTSTATUS,NewStream) - ( THIS_ - __out PMINIPORTWAVECYCLICSTREAM * Stream, - __in_opt PUNKNOWN OuterUnknown, - __in POOL_TYPE PoolType, - __in ULONG Pin, - __in BOOLEAN Capture, - __in PKSDATAFORMAT DataFormat, - __out PDMACHANNEL * DmaChannel, - __out PSERVICEGROUP * ServiceGroup - ) PURE; -}; - -typedef IMiniportWaveCyclic *PMINIPORTWAVECYCLIC; - -#define IMP_IMiniportWaveCyclic\ - IMP_IMiniport;\ - STDMETHODIMP_(NTSTATUS) Init\ - ( __in PUNKNOWN UnknownAdapter,\ - __in PRESOURCELIST ResourceList,\ - __in PPORTWAVECYCLIC Port\ - );\ - STDMETHODIMP_(NTSTATUS) NewStream\ - ( __out PMINIPORTWAVECYCLICSTREAM * Stream,\ - __in_opt PUNKNOWN OuterUnknown,\ - __in POOL_TYPE PoolType,\ - __in ULONG Pin,\ - __in BOOLEAN Capture,\ - __in PKSDATAFORMAT DataFormat,\ - __out PDMACHANNEL * DmaChannel,\ - __out PSERVICEGROUP * ServiceGroup\ - ) - -/***************************************************************************** - * IPortWavePci - ***************************************************************************** - * Interface for PCI wave port lower edge. - */ -DECLARE_INTERFACE_(IPortWavePci,IPort) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_PORT() // For IPort - - // For IPortWavePci - STDMETHOD_(void,Notify) - ( THIS_ - __in PSERVICEGROUP ServiceGroup - ) PURE; - - STDMETHOD_(NTSTATUS,NewMasterDmaChannel) - ( THIS_ - __out PDMACHANNEL * OutDmaChannel, - __in_opt PUNKNOWN OuterUnknown, - __in POOL_TYPE PoolType, - __in_opt PRESOURCELIST ResourceList, - __in BOOLEAN ScatterGather, - __in BOOLEAN Dma32BitAddresses, - __in BOOLEAN Dma64BitAddresses, - __in BOOLEAN IgnoreCount, - __in DMA_WIDTH DmaWidth, - __in DMA_SPEED DmaSpeed, - __in ULONG MaximumLength, - __in ULONG DmaPort - ) PURE; -}; - -typedef IPortWavePci *PPORTWAVEPCI; - -#ifdef PC_IMPLEMENTATION -#define IMP_IPortWavePci\ - IMP_IPort;\ - STDMETHODIMP_(void) Notify\ - ( __in PSERVICEGROUP ServiceGroup\ - );\ - STDMETHODIMP_(NTSTATUS) NewMasterDmaChannel\ - ( __out PDMACHANNEL * OutDmaChannel,\ - __in_opt PUNKNOWN OuterUnknown,\ - __in POOL_TYPE PoolType,\ - __in_opt PRESOURCELIST ResourceList,\ - __in BOOLEAN ScatterGather,\ - __in BOOLEAN Dma32BitAddresses,\ - __in BOOLEAN Dma64BitAddresses,\ - __in BOOLEAN IgnoreCount,\ - __in DMA_WIDTH DmaWidth,\ - __in DMA_SPEED DmaSpeed,\ - __in ULONG MaximumLength,\ - __in ULONG DmaPort\ - ) -#endif - -/***************************************************************************** - * IPortWavePciStream - ***************************************************************************** - * Interface for PCI wave port pin lower edge. - */ -DECLARE_INTERFACE_(IPortWavePciStream,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(NTSTATUS,GetMapping) - ( THIS_ - __in PVOID Tag, - __out PPHYSICAL_ADDRESS PhysicalAddress, - __out PVOID * VirtualAddress, - __out PULONG ByteCount, - __out PULONG Flags - ) PURE; - - STDMETHOD_(NTSTATUS,ReleaseMapping) - ( THIS_ - __in PVOID Tag - ) PURE; - - STDMETHOD_(NTSTATUS,TerminatePacket) - ( THIS - ) PURE; -}; - -typedef IPortWavePciStream *PPORTWAVEPCISTREAM; - -#ifdef PC_IMPLEMENTATION -#define IMP_IPortWavePciStream\ - STDMETHODIMP_(NTSTATUS) GetMapping\ - ( __in PVOID Tag,\ - __out PPHYSICAL_ADDRESS PhysicalAddress,\ - __out PVOID * VirtualAddress,\ - __out PULONG ByteCount,\ - __out PULONG Flags\ - );\ - STDMETHODIMP_(NTSTATUS) ReleaseMapping\ - ( __in PVOID Tag\ - );\ - STDMETHODIMP_(NTSTATUS) TerminatePacket\ - ( void\ - ) -#endif - -/***************************************************************************** - * IMiniportWavePciStream - ***************************************************************************** - * Interface for PCI wave miniport streams. - */ -DECLARE_INTERFACE_(IMiniportWavePciStream,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(NTSTATUS,SetFormat) - ( THIS_ - __in PKSDATAFORMAT DataFormat - ) PURE; - - STDMETHOD_(NTSTATUS,SetState) - ( THIS_ - __in KSSTATE State - ) PURE; - - STDMETHOD_(NTSTATUS,GetPosition) - ( THIS_ - __out PULONGLONG Position - ) PURE; - - STDMETHOD_(NTSTATUS,NormalizePhysicalPosition) - ( - THIS_ - __inout PLONGLONG PhysicalPosition - ) PURE; - - STDMETHOD_(NTSTATUS,GetAllocatorFraming) - ( - THIS_ - __out PKSALLOCATOR_FRAMING AllocatorFraming - ) PURE; - - STDMETHOD_(NTSTATUS,RevokeMappings) - ( THIS_ - __in PVOID FirstTag, - __in PVOID LastTag, - __out PULONG MappingsRevoked - ) PURE; - - STDMETHOD_(void,MappingAvailable) - ( THIS - ) PURE; - - STDMETHOD_(void,Service) - ( THIS - ) PURE; -}; - -typedef IMiniportWavePciStream *PMINIPORTWAVEPCISTREAM; - -#define IMP_IMiniportWavePciStream\ - STDMETHODIMP_(NTSTATUS) SetFormat\ - ( __in PKSDATAFORMAT DataFormat\ - );\ - STDMETHODIMP_(NTSTATUS) SetState\ - ( __in KSSTATE State\ - );\ - STDMETHODIMP_(NTSTATUS) GetPosition\ - ( __out PULONGLONG Position\ - );\ - STDMETHODIMP_(NTSTATUS) NormalizePhysicalPosition\ - ( __inout PLONGLONG PhysicalPosition\ - );\ - STDMETHODIMP_(NTSTATUS) GetAllocatorFraming\ - ( __out PKSALLOCATOR_FRAMING AllocatorFraming\ - );\ - STDMETHODIMP_(NTSTATUS) RevokeMappings\ - ( __in PVOID FirstTag,\ - __in PVOID LastTag,\ - __out PULONG MappingsRevoked\ - );\ - STDMETHODIMP_(void) MappingAvailable\ - ( void\ - );\ - STDMETHODIMP_(void) Service\ - ( void\ - ) - -/***************************************************************************** - * IMiniportWavePci - ***************************************************************************** - * Interface for PCI wave miniports. - */ -DECLARE_INTERFACE_(IMiniportWavePci,IMiniport) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_MINIPORT() // For IMiniport - - // For IMiniportWavePci - STDMETHOD_(NTSTATUS,Init) - ( THIS_ - __in PUNKNOWN UnknownAdapter, - __in PRESOURCELIST ResourceList, - __in PPORTWAVEPCI Port, - __out PSERVICEGROUP * ServiceGroup - ) PURE; - - STDMETHOD_(NTSTATUS,NewStream) - ( THIS_ - __out PMINIPORTWAVEPCISTREAM * Stream, - __in_opt PUNKNOWN OuterUnknown, - __in POOL_TYPE PoolType, - __in PPORTWAVEPCISTREAM PortStream, - __in ULONG Pin, - __in BOOLEAN Capture, - __in PKSDATAFORMAT DataFormat, - __out PDMACHANNEL * DmaChannel, - __out PSERVICEGROUP * ServiceGroup - ) PURE; - - STDMETHOD_(void,Service) - ( THIS - ) PURE; -}; - -typedef IMiniportWavePci *PMINIPORTWAVEPCI; - -#define IMP_IMiniportWavePci\ - IMP_IMiniport;\ - STDMETHODIMP_(NTSTATUS) Init\ - ( __in PUNKNOWN UnknownAdapter,\ - __in PRESOURCELIST ResourceList,\ - __in PPORTWAVEPCI Port,\ - __out PSERVICEGROUP * ServiceGroup\ - );\ - STDMETHODIMP_(NTSTATUS) NewStream\ - ( __out PMINIPORTWAVEPCISTREAM * Stream,\ - __in_opt PUNKNOWN OuterUnknown,\ - __in POOL_TYPE PoolType,\ - __in PPORTWAVEPCISTREAM PortStream,\ - __in ULONG Pin,\ - __in BOOLEAN Capture,\ - __in PKSDATAFORMAT DataFormat,\ - __out PDMACHANNEL * DmaChannel,\ - __out PSERVICEGROUP * ServiceGroup\ - );\ - STDMETHODIMP_(void) Service\ - ( void\ - ) - -#if (NTDDI_VERSION >= NTDDI_VISTA) -/***************************************************************************** - * IPortWaveRT - ***************************************************************************** - * Interface for WaveRT port lower edge. - */ -DECLARE_INTERFACE_(IPortWaveRT,IPort) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_PORT() // For IPort -}; - -typedef IPortWaveRT *PPORTWAVERT; - -#ifdef PC_IMPLEMENTATION -#define IMP_IPortWaveRT\ - IMP_IPort -#endif - -/***************************************************************************** - * IPortWaveRTStream - ***************************************************************************** - * Interface for WaveRT stream port lower edge. - */ -DECLARE_INTERFACE_(IPortWaveRTStream,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(PMDL, AllocatePagesForMdl) - ( THIS_ - __in PHYSICAL_ADDRESS HighAddress, - __in SIZE_T TotalBytes - ) PURE; - - STDMETHOD_(PMDL, AllocateContiguousPagesForMdl) - ( THIS_ - __in PHYSICAL_ADDRESS LowAddress, - __in PHYSICAL_ADDRESS HighAddress, - __in SIZE_T TotalBytes - ) PURE; - - STDMETHOD_(PVOID, MapAllocatedPages) - ( THIS_ - __in PMDL MemoryDescriptorList, - __in MEMORY_CACHING_TYPE CacheType - ) PURE; - - STDMETHOD_(VOID, UnmapAllocatedPages) - ( THIS_ - __in PVOID BaseAddress, - __in PMDL MemoryDescriptorList - ) PURE; - - STDMETHOD_(VOID, FreePagesFromMdl) - ( THIS_ - __in PMDL MemoryDescriptorList - ) PURE; - - STDMETHOD_(ULONG, GetPhysicalPagesCount) - ( THIS_ - __in PMDL MemoryDescriptorList - ) PURE; - - STDMETHOD_(PHYSICAL_ADDRESS, GetPhysicalPageAddress) - ( THIS_ - __in PMDL MemoryDescriptorList, - __in ULONG Index - ) PURE; -}; - -typedef IPortWaveRTStream *PPORTWAVERTSTREAM; - -#ifdef PC_IMPLEMENTATION -#define IMP_IPortWaveRTStream\ - STDMETHODIMP_(PMDL) AllocatePagesForMdl\ - (\ - __in PHYSICAL_ADDRESS HighAddress,\ - __in SIZE_T TotalBytes\ - );\ - STDMETHODIMP_(PMDL) AllocateContiguousPagesForMdl\ - (\ - __in PHYSICAL_ADDRESS LowAddress,\ - __in PHYSICAL_ADDRESS HighAddress,\ - __in SIZE_T TotalBytes\ - );\ - STDMETHODIMP_(PVOID) MapAllocatedPages\ - (\ - __in PMDL MemoryDescriptorList,\ - __in MEMORY_CACHING_TYPE CacheType\ - );\ - STDMETHODIMP_(VOID) UnmapAllocatedPages\ - (\ - __in PVOID BaseAddress,\ - __in PMDL MemoryDescriptorList\ - );\ - STDMETHODIMP_(VOID) FreePagesFromMdl\ - (\ - __in PMDL MemoryDescriptorList\ - );\ - STDMETHODIMP_(ULONG) GetPhysicalPagesCount\ - (\ - __in PMDL MemoryDescriptorList\ - );\ - STDMETHODIMP_(PHYSICAL_ADDRESS) GetPhysicalPageAddress\ - (\ - __in PMDL MemoryDescriptorList,\ - __in ULONG Index\ - ) -#endif - -/***************************************************************************** - * IMiniportWaveRTStream - ***************************************************************************** - * Interface for WaveRT miniport stream. - */ -DECLARE_INTERFACE_(IMiniportWaveRTStream,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - DEFINE_ABSTRACT_MINIPORTWAVERTSTREAM() // For IMiniportWaveRTStream -}; - -typedef IMiniportWaveRTStream *PMINIPORTWAVERTSTREAM; - -#define IMP_IMiniportWaveRTStream\ - STDMETHODIMP_(NTSTATUS) SetFormat\ - ( __in PKSDATAFORMAT DataFormat\ - );\ - STDMETHODIMP_(NTSTATUS) SetState\ - ( __in KSSTATE State\ - );\ - STDMETHODIMP_(NTSTATUS) GetPosition\ - ( __out PKSAUDIO_POSITION Position\ - );\ - STDMETHODIMP_(NTSTATUS) AllocateAudioBuffer\ - (\ - __in ULONG RequestedSize,\ - __out PMDL *AudioBufferMdl,\ - __out ULONG *ActualSize,\ - __out ULONG *OffsetFromFirstPage,\ - __out MEMORY_CACHING_TYPE *CacheType\ - );\ - STDMETHODIMP_(VOID) FreeAudioBuffer\ - (\ - __in_opt PMDL AudioBufferMdl,\ - __in ULONG BufferSize\ - );\ - STDMETHODIMP_(VOID) GetHWLatency\ - (\ - __out KSRTAUDIO_HWLATENCY *hwLatency\ - );\ - STDMETHODIMP_(NTSTATUS) GetPositionRegister\ - (\ - __out KSRTAUDIO_HWREGISTER *Register\ - );\ - STDMETHODIMP_(NTSTATUS) GetClockRegister\ - (\ - __out KSRTAUDIO_HWREGISTER *Register\ - ) - - -/***************************************************************************** - * IMiniportWaveRTStreamNotification - ***************************************************************************** - * Interface for WaveRT miniport stream buffer notification extensions. - */ -DECLARE_INTERFACE_(IMiniportWaveRTStreamNotification,IMiniportWaveRTStream) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_MINIPORTWAVERTSTREAM() // For IMiniportWaveRTStream - - STDMETHOD_(NTSTATUS,AllocateBufferWithNotification) - ( THIS_ - __in ULONG NotificationCount, - __in ULONG RequestedSize, - __out PMDL *AudioBufferMdl, - __out ULONG *ActualSize, - __out ULONG *OffsetFromFirstPage, - __out MEMORY_CACHING_TYPE *CacheType - ) PURE; - - STDMETHOD_(VOID,FreeBufferWithNotification) - ( THIS_ - __in PMDL AudioBufferMdl, - __in ULONG BufferSize - ) PURE; - - STDMETHOD_(NTSTATUS,RegisterNotificationEvent) - ( THIS_ - __in PKEVENT NotificationEvent - ) PURE; - - STDMETHOD_(NTSTATUS,UnregisterNotificationEvent) - ( THIS_ - __in PKEVENT NotificationEvent - ) PURE; -}; - -typedef IMiniportWaveRTStreamNotification *PMINIPORTWAVERTSTREAMNOTIFICATION; - -#define IMP_IMiniportWaveRTStreamNotification\ - STDMETHODIMP_(NTSTATUS) AllocateBufferWithNotification\ - (\ - __in ULONG NotificationCount,\ - __in ULONG RequestedSize,\ - __out PMDL *AudioBufferMdl,\ - __out ULONG *ActualSize,\ - __out ULONG *OffsetFromFirstPage,\ - __out MEMORY_CACHING_TYPE *CacheType\ - );\ - STDMETHODIMP_(VOID) FreeBufferWithNotification\ - (\ - __in PMDL AudioBufferMdl,\ - __in ULONG BufferSize\ - );\ - STDMETHODIMP_(NTSTATUS) RegisterNotificationEvent\ - (\ - __in PKEVENT NotificationEvent\ - );\ - STDMETHODIMP_(NTSTATUS) UnregisterNotificationEvent\ - (\ - __in PKEVENT NotificationEvent\ - ) - -/***************************************************************************** - * IMiniportWaveRT - ***************************************************************************** - * Interface for WaveRT miniports. - */ -DECLARE_INTERFACE_(IMiniportWaveRT,IMiniport) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_MINIPORT() // For IMiniport - - // For IMiniportWaveRT - STDMETHOD_(NTSTATUS,Init) - ( THIS_ - __in PUNKNOWN UnknownAdapter, - __in PRESOURCELIST ResourceList, - __in PPORTWAVERT Port - ) PURE; - - STDMETHOD_(NTSTATUS,NewStream) - ( THIS_ - __out PMINIPORTWAVERTSTREAM * Stream, - __in PPORTWAVERTSTREAM PortStream, - __in ULONG Pin, - __in BOOLEAN Capture, - __in PKSDATAFORMAT DataFormat - ) PURE; - - STDMETHOD_(NTSTATUS,GetDeviceDescription) - ( THIS_ - __out PDEVICE_DESCRIPTION DeviceDescription - ) PURE; -}; - -typedef IMiniportWaveRT *PMINIPORTWAVERT; - -#define IMP_IMiniportWaveRT\ - IMP_IMiniport;\ - STDMETHODIMP_(NTSTATUS) Init\ - ( __in PUNKNOWN UnknownAdapter,\ - __in PRESOURCELIST ResourceList,\ - __in PPORTWAVERT Port\ - );\ - STDMETHODIMP_(NTSTATUS) NewStream\ - ( __out PMINIPORTWAVERTSTREAM * Stream,\ - __in PPORTWAVERTSTREAM PortStream,\ - __in ULONG Pin,\ - __in BOOLEAN Capture,\ - __in PKSDATAFORMAT DataFormat\ - );\ - STDMETHODIMP_(NTSTATUS) GetDeviceDescription\ - ( __out PDEVICE_DESCRIPTION DeviceDescription\ - ) -#endif - -/***************************************************************************** - * IAdapterPowerManagement - ***************************************************************************** - * An interface that adapters should implement and - * register if they want power management messages. - * Register this interface with PortCls via the - * PcRegisterAdapterPowerManagement() call. - * - * NOTE: If you want to fill in the caps struct - * for your device, register the interface - * with PortCls in or before your AddDevice() - * function. The OS queries devices before - * StartDevice() gets called. - */ -DECLARE_INTERFACE_(IAdapterPowerManagement,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - // Called by PortCls to tell the device - // to change to the new power state. - // - STDMETHOD_(void,PowerChangeState) - ( THIS_ - __in POWER_STATE NewState - ) PURE; - - // Called by PortCls to ask whether the device - // can change to the requested power state. - // - STDMETHOD_(NTSTATUS,QueryPowerChangeState) - ( THIS_ - __in POWER_STATE NewStateQuery - ) PURE; - - // Called by PortCls to get the power management - // capabilities of the device. See ACPI documentation - // for data about the DEVICE_CAPABILITIES struct. - // - STDMETHOD_(NTSTATUS,QueryDeviceCapabilities) - ( THIS_ - __in PDEVICE_CAPABILITIES PowerDeviceCaps - ) PURE; -}; - -typedef IAdapterPowerManagement *PADAPTERPOWERMANAGEMENT; - -#define IMP_IAdapterPowerManagement\ - STDMETHODIMP_(void) PowerChangeState\ - ( __in POWER_STATE NewState\ - );\ - STDMETHODIMP_(NTSTATUS) QueryPowerChangeState\ - ( __in POWER_STATE NewStateQuery\ - );\ - STDMETHODIMP_(NTSTATUS) QueryDeviceCapabilities\ - ( __in PDEVICE_CAPABILITIES PowerDeviceCaps\ - ) - -/***************************************************************************** - * IAdapterPowerManagement2 - ***************************************************************************** - * An interface that adapters should implement and - * register if they want power management messages. - * Register this interface with PortCls via the - * PcRegisterAdapterPowerManagement() call. - * - * NOTE: If you want to fill in the caps struct - * for your device, register the interface - * with PortCls in or before your AddDevice() - * function. The OS queries devices before - * StartDevice() gets called. - */ -DECLARE_INTERFACE_(IAdapterPowerManagement2,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - DEFINE_ABSTRACT_ADAPTERPOWERMANAGEMENT() - - // Called by PortCls to tell the device - // to change to the new power state. - // - STDMETHOD_(void,PowerChangeState2) - ( THIS_ - __in DEVICE_POWER_STATE NewDeviceState, - __in SYSTEM_POWER_STATE NewSystemState - ) PURE; -}; - -typedef IAdapterPowerManagement2 *PADAPTERPOWERMANAGEMENT2; - -#define IMP_IAdapterPowerManagement2\ - IMP_IAdapterPowerManagement;\ - STDMETHODIMP_(void) PowerChangeState2\ - ( __in DEVICE_POWER_STATE NewDeviceState,\ - __in SYSTEM_POWER_STATE NewSystemState\ - );\ - -/***************************************************************************** - * IPowerNotify - ***************************************************************************** - * An OPTIONAL interface for miniports and pins to implement to - * enable them to get device power state change notifications. - */ -DECLARE_INTERFACE_(IPowerNotify,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - // Called by the port to notify registered miniports - // and pins of device power state changes, so that - // appropriate context save/restore can take place. - // - STDMETHOD_(void,PowerChangeNotify) - ( THIS_ - __in POWER_STATE PowerState - ) PURE; -}; - -typedef IPowerNotify *PPOWERNOTIFY; - -#define IMP_IPowerNotify\ - STDMETHODIMP_(void) PowerChangeNotify\ - ( __in POWER_STATE PowerState\ - ) - -#if (NTDDI_VERSION >= NTDDI_WINXP) -/***************************************************************************** - * IPinCount - ***************************************************************************** - * An OPTIONAL interface for miniports to implement to - * enable them to get pin count queries, for dynamic pin counts. - */ -DECLARE_INTERFACE_(IPinCount,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - // Called by the port to notify registered miniports - // of pin count queries, so that appropriate pin - // count manipulation can take place. - // - STDMETHOD_(void,PinCount) - ( THIS_ - __in ULONG PinId, - __inout PULONG FilterNecessary, - __inout PULONG FilterCurrent, - __inout PULONG FilterPossible, - __inout PULONG GlobalCurrent, - __inout PULONG GlobalPossible - ) PURE; -}; - -typedef IPinCount *PPINCOUNT; - -#define IMP_IPinCount \ - STDMETHODIMP_(void) PinCount \ - ( __in ULONG PinId, \ - __inout PULONG FilterNecessary, \ - __inout PULONG FilterCurrent, \ - __inout PULONG FilterPossible, \ - __inout PULONG GlobalCurrent, \ - __inout PULONG GlobalPossible \ - ) -#endif - -/***************************************************************************** - * IPortEvents - ***************************************************************************** - * An interface implemented by ports to provide - * notification event helpers to miniports. - */ -DECLARE_INTERFACE_(IPortEvents,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(void,AddEventToEventList) - ( THIS_ - __in PKSEVENT_ENTRY EventEntry - ) PURE; - STDMETHOD_(void,GenerateEventList) - ( THIS_ - __in_opt GUID* Set, - __in ULONG EventId, - __in BOOL PinEvent, - __in ULONG PinId, - __in BOOL NodeEvent, - __in ULONG NodeId - ) PURE; -}; - -typedef IPortEvents *PPORTEVENTS; - -#define IMP_IPortEvents\ - STDMETHODIMP_(void) AddEventToEventList\ - ( __in PKSEVENT_ENTRY EventEntry\ - );\ - STDMETHODIMP_(void) GenerateEventList\ - ( __in_opt GUID* Set,\ - __in ULONG EventId,\ - __in BOOL PinEvent,\ - __in ULONG PinId,\ - __in BOOL NodeEvent,\ - __in ULONG NodeId\ - ) - -#if (NTDDI_VERSION >= NTDDI_WINXP) -/***************************************************************************** - * IDrmPort - ***************************************************************************** - * An optional interface implemented by ports - * to provide DRM functionality to miniports. - */ -DECLARE_INTERFACE_(IDrmPort,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_DRMPORT() // For IDrmPort -}; - -typedef IDrmPort *PDRMPORT; - -#define IMP_IDrmPort\ - STDMETHODIMP_(NTSTATUS) CreateContentMixed \ - ( __in PULONG paContentId, \ - __in ULONG cContentId, \ - __out PULONG pMixedContentId \ - ); \ - STDMETHODIMP_(NTSTATUS) DestroyContent \ - ( __in ULONG ContentId \ - ); \ - STDMETHODIMP_(NTSTATUS) ForwardContentToFileObject \ - ( __in ULONG ContentId, \ - __in PFILE_OBJECT FileObject \ - ); \ - STDMETHODIMP_(NTSTATUS) ForwardContentToInterface \ - ( __in ULONG ContentId, \ - __in PUNKNOWN pUnknown, \ - __in ULONG NumMethods \ - ); \ - STDMETHODIMP_(NTSTATUS) GetContentRights \ - ( __in ULONG ContentId, \ - __out PDRMRIGHTS DrmRights \ - ) - -/***************************************************************************** - * IDrmPort2 - ***************************************************************************** - * An optional interface implemented by ports - * to provide DRM functionality to miniports. - * This is identical to IDrmPort with the - * addition of two new routines. - */ -DECLARE_INTERFACE_(IDrmPort2,IDrmPort) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - DEFINE_ABSTRACT_DRMPORT() // For IDrmPort - - STDMETHOD_(NTSTATUS,AddContentHandlers) - ( THIS_ - __in ULONG ContentId, - __in PVOID * paHandlers, - __in ULONG NumHandlers - ) PURE; - STDMETHOD_(NTSTATUS,ForwardContentToDeviceObject) - ( THIS_ - __in ULONG ContentId, - __in PVOID Reserved, - __in PCDRMFORWARD DrmForward - ) PURE; -}; - -typedef IDrmPort2 *PDRMPORT2; - -#define IMP_IDrmPort2 \ - IMP_IDrmPort; \ - STDMETHODIMP_(NTSTATUS) AddContentHandlers \ - ( __in ULONG ContentId, \ - __in PVOID * paHandlers, \ - __in ULONG NumHandlers \ - ); \ - STDMETHODIMP_(NTSTATUS) ForwardContentToDeviceObject\ - ( __in ULONG ContentId, \ - __in PVOID Reserved, \ - __in PCDRMFORWARD DrmForward \ - ) - -/***************************************************************************** - * IPortClsVersion - ***************************************************************************** - * What version of PortCls is this? - */ -DECLARE_INTERFACE_(IPortClsVersion,IUnknown) -{ - STDMETHOD_(DWORD,GetVersion) - ( THIS - ) PURE; -}; - -typedef IPortClsVersion *PPORTCLSVERSION; - - -/***************************************************************************** - * IPortClsSubdeviceEx - ***************************************************************************** - * Provide access to new subdevice registration APIs - * PcRegisterSubdeviceEx and PcEnableSubDeviceInterfaces - */ -DECLARE_INTERFACE_(IPortClsSubdeviceEx,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(NTSTATUS, UpdatePinDescriptor) - ( - __in ULONG _ulPinId, - __in ULONG _ulFlags, - __in PPCPIN_DESCRIPTOR _pPinDescriptor - ) PURE; -}; - -#define PCUPDATE_PIN_DESC_FLAG_DATARANGES 0x00000001 - -typedef IPortClsSubdeviceEx *PPORTCLSSubdeviceEx; - -/***************************************************************************** - * IPortClsPower - ***************************************************************************** - * Used to access the adapter power management functions. - */ -DECLARE_INTERFACE_(IPortClsPower,IUnknown) -{ - STDMETHOD_(NTSTATUS,RegisterAdapterPowerManagement) - ( - __in PUNKNOWN _pUnknown, - __in PDEVICE_OBJECT _DeviceObject - ) PURE; - STDMETHOD_(NTSTATUS,UnregisterAdapterPowerManagement) - ( - __in PDEVICE_OBJECT _DeviceObject - ) PURE; - STDMETHOD_(NTSTATUS,SetIdlePowerManagement) - ( - __in PDEVICE_OBJECT _DeviceObject, - __in BOOLEAN _bEnabled - ) PURE; -}; - -typedef IPortClsPower *PPORTCLSPOWER; - -// DO NOT ASSUME THAT EACH SUCCESSIVE ENUM IMPLIES A FEATURE SUPERSET! -// Example: Win2K has more audio features than Win98SE_QFE2. -// -enum -{ - kVersionInvalid = -1, - - kVersionWin98, // IPortClsVersion is unsupported - kVersionWin98SE, // IPortClsVersion is unsupported - kVersionWin2K, // IPortClsVersion is unsupported - - kVersionWin98SE_QFE2, // IPortClsVersion is unsupported - // Hotfix Package 269601 (contains 242937 and 247565) - - kVersionWin2K_SP2, // IPortClsVersion is supported - - kVersionWinME, // IPortClsVersion is unsupported - - kVersionWin98SE_QFE3, // IPortClsVersion is supported - // Hotfix Package (not yet released, as of 6/15/2001) - - kVersionWinME_QFE1, // IPortClsVersion is supported - // Hotfix Package (not yet released, as of 6/15/2001) - - kVersionWinXP, // IPortClsVersion is supported - kVersionWinXPSP1, // IPortClsVersion is supported - - kVersionWinServer2003,// IPortClsVersion is supported - - kVersionWin2K_UAAQFE, // IPortClsVersion is supported - kVersionWinXP_UAAQFE, // IPortClsVersion is supported - kVersionWinServer2003_UAAQFE, // IPortClsVersion is supported - - kVersionWindowsLonghorn // IPortClsVersion is supported - - // Additional enum values will be added here, in - // *roughly* chronological (not feature set) order. -}; - -/***************************************************************************** - * IPortWMIRegistration - *****************************************************************************/ -DECLARE_INTERFACE_(IPortWMIRegistration,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(NTSTATUS,RegisterWMIProvider) - ( THIS_ - PDEVICE_OBJECT, - PVOID - ) PURE; - STDMETHOD_(NTSTATUS,UnregisterWMIProvider) - ( - THIS_ - PDEVICE_OBJECT - ) PURE; -}; - -typedef IPortWMIRegistration *PPORTWMIREGISTRATION; - -/***************************************************************************** - * IPreFetchOffset - ***************************************************************************** - * An interface implemented by the pin to implement prefetch characteristics - * of bus master hardware - to specify the hardware queue size, determining - * the pad between play cursor and write cursor. - */ -DECLARE_INTERFACE_(IPreFetchOffset,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(VOID,SetPreFetchOffset) - ( THIS_ - __in ULONG PreFetchOffset - ) PURE; -}; - -typedef IPreFetchOffset *PPREFETCHOFFSET; - -#define IMP_IPreFetchOffset\ - STDMETHODIMP_(VOID) SetPreFetchOffset\ - (\ - __in ULONG PreFetchOffset\ - ) -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2003) -/***************************************************************************** - * IUnregisterSubdevice - ***************************************************************************** - * An interface implemented by the port to implement a method to remove the - * registered subdevice. - */ -DECLARE_INTERFACE_(IUnregisterSubdevice,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(NTSTATUS,UnregisterSubdevice) - ( THIS_ - __in PDEVICE_OBJECT DeviceObject, - __in PUNKNOWN Unknown - ) PURE; -}; - -typedef IUnregisterSubdevice *PUNREGISTERSUBDEVICE; - -#define IMP_IUnregisterSubdevice\ - STDMETHODIMP_(NTSTATUS) UnregisterSubdevice\ - (\ - __in PDEVICE_OBJECT DeviceObject,\ - __in PUNKNOWN Unknown\ - ) - -/***************************************************************************** - * IUnregisterPhysicalConnection - ***************************************************************************** - * An interface implemented by the port to implement a method to remove the - * registered physical connections. - */ -DECLARE_INTERFACE_(IUnregisterPhysicalConnection,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - STDMETHOD_(NTSTATUS,UnregisterPhysicalConnection) - ( THIS_ - __in PDEVICE_OBJECT DeviceObject, - __in PUNKNOWN FromUnknown, - __in ULONG FromPin, - __in PUNKNOWN ToUnknown, - __in ULONG ToPin - ) PURE; - - STDMETHOD_(NTSTATUS,UnregisterPhysicalConnectionToExternal) - ( THIS_ - __in PDEVICE_OBJECT DeviceObject, - __in PUNKNOWN FromUnknown, - __in ULONG FromPin, - __in PUNICODE_STRING ToString, - __in ULONG ToPin - ) PURE; - - STDMETHOD_(NTSTATUS,UnregisterPhysicalConnectionFromExternal) - ( THIS_ - __in PDEVICE_OBJECT DeviceObject, - __in PUNICODE_STRING FromString, - __in ULONG FromPin, - __in PUNKNOWN ToUnknown, - __in ULONG ToPin - ) PURE; -}; - -typedef IUnregisterPhysicalConnection *PUNREGISTERPHYSICALCONNECTION; - -#define IMP_IUnregisterPhysicalConnection\ - STDMETHODIMP_(NTSTATUS) UnregisterPhysicalConnection\ - (\ - __in PDEVICE_OBJECT DeviceObject,\ - __in PUNKNOWN FromUnknown,\ - __in ULONG FromPin,\ - __in PUNKNOWN ToUnknown,\ - __in ULONG ToPin\ - );\ - STDMETHODIMP_(NTSTATUS) UnregisterPhysicalConnectionToExternal\ - (\ - __in PDEVICE_OBJECT DeviceObject,\ - __in PUNKNOWN FromUnknown,\ - __in ULONG FromPin,\ - __in PUNICODE_STRING ToString,\ - __in ULONG ToPin\ - );\ - STDMETHODIMP_(NTSTATUS) UnregisterPhysicalConnectionFromExternal\ - (\ - __in PDEVICE_OBJECT DeviceObject,\ - __in PUNICODE_STRING FromString,\ - __in ULONG FromPin,\ - __in PUNKNOWN ToUnknown,\ - __in ULONG ToPin\ - ) -#endif - - -/***************************************************************************** - * IPinName, - ***************************************************************************** - * An OPTIONAL interface for miniports to implement to - * enable them to get pin name from miniport driver - */ -DECLARE_INTERFACE_(IPinName,IUnknown) -{ - DEFINE_ABSTRACT_UNKNOWN() // For IUnknown - - // Called by the port to notify registered miniports - // for servicing verndor defined pin property - // - STDMETHOD_(NTSTATUS,GetPinName) - ( THIS_ - __in PIRP Irp, - __in PKSP_PIN Pin, - __out PVOID Data - ) PURE; -}; - -typedef IPinName *PIPINNAME; - -#define IMP_IPinName \ - STDMETHODIMP_(NTSTATUS) GetPinName \ - ( __in PIRP Irp, \ - __in PKSP_PIN Pin, \ - __out PVOID Data \ - ); - - -/***************************************************************************** - * Functions. - */ - -/***************************************************************************** - * PCPFNSTARTDEVICE - ***************************************************************************** - * Type for start device callback. - */ -typedef -NTSTATUS -(*PCPFNSTARTDEVICE) -( -#ifdef PC_OLD_NAMES - __in PVOID DeviceObject, - __in PVOID Irp, -#else - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, -#endif - __in PRESOURCELIST ResourceList -); - -#if (NTDDI_VERSION < NTDDI_WINXP) -/***************************************************************************** - * PCPFNIRPHANDLER - ***************************************************************************** - * Type for IRP handlers. - */ -typedef -NTSTATUS -(*PCPFNIRPHANDLER) -( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __out PULONG Action -#define IRP_HANDLER_ACTION_DEFAULT 0 -#define IRP_HANDLER_ACTION_FINISH 1 -#define IRP_HANDLER_ACTION_FORWARD 2 -); -#endif - -/***************************************************************************** - * PcInitializeAdapterDriver() - ***************************************************************************** - * Initializes an adapter driver. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcInitializeAdapterDriver -( - __in PDRIVER_OBJECT DriverObject, - __in PUNICODE_STRING RegistryPathName, - __in PDRIVER_ADD_DEVICE AddDevice -); - -/***************************************************************************** - * PcDispatchIrp() - ***************************************************************************** - * Dispatch an IRP. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcDispatchIrp -( - __in PDEVICE_OBJECT pDeviceObject, - __in PIRP pIrp -); - -/***************************************************************************** - * PcAddAdapterDevice() - ***************************************************************************** - * Adds an adapter device. DeviceExtensionSize may be zero for default size. - */ -PORTCLASSAPI -NTSTATUS -__drv_fun(__drv_clearDoInit(yes)) -NTAPI -PcAddAdapterDevice -( - __in PDRIVER_OBJECT DriverObject, - __in PDEVICE_OBJECT PhysicalDeviceObject, - __in PCPFNSTARTDEVICE StartDevice, - __in ULONG MaxObjects, - __in ULONG DeviceExtensionSize -); - -/***************************************************************************** - * PcCompleteIrp() - ***************************************************************************** - * Complete an IRP unless status is STATUS_PENDING. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcCompleteIrp -( - __in PDEVICE_OBJECT pDeviceObject, - __in PIRP pIrp, - __in NTSTATUS ntStatus -); - -/***************************************************************************** - * PcForwardIrpSynchronous() - ***************************************************************************** - * Forward a PnP IRP to the PDO. The IRP is not completed at this level, - * this function does not return until the lower driver has completed the IRP, - * and DecrementPendingIrpCount() is not called. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcForwardIrpSynchronous -( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp -); - -/***************************************************************************** - * PcRegisterSubdevice() - ***************************************************************************** - * Registers a subdevice. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcRegisterSubdevice -( - __in PDEVICE_OBJECT DeviceObject, - __in PWSTR Name, - __in PUNKNOWN Unknown -); - -/***************************************************************************** - * PcRegisterPhysicalConnection() - ***************************************************************************** - * Registers a physical connection between subdevices. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcRegisterPhysicalConnection -( - __in PDEVICE_OBJECT DeviceObject, - __in PUNKNOWN FromUnknown, - __in ULONG FromPin, - __in PUNKNOWN ToUnknown, - __in ULONG ToPin -); - -/***************************************************************************** - * PcRegisterPhysicalConnectionToExternal() - ***************************************************************************** - * Registers a physical connection from a subdevice to an external device. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcRegisterPhysicalConnectionToExternal -( - __in PDEVICE_OBJECT DeviceObject, - __in PUNKNOWN FromUnknown, - __in ULONG FromPin, - __in PUNICODE_STRING ToString, - __in ULONG ToPin -); - -/***************************************************************************** - * PcRegisterPhysicalConnectionFromExternal() - ***************************************************************************** - * Registers a physical connection to a subdevice from an external device. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcRegisterPhysicalConnectionFromExternal -( - __in PDEVICE_OBJECT DeviceObject, - __in PUNICODE_STRING FromString, - __in ULONG FromPin, - __in PUNKNOWN ToUnknown, - __in ULONG ToPin -); - -/***************************************************************************** - * PcNewPort() - ***************************************************************************** - * Creates an instance of a port driver. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcNewPort -( - __out PPORT * OutPort, - __in REFCLSID ClassID -); - -/***************************************************************************** - * PcNewMiniport() - ***************************************************************************** - * Creates an instance of a system-supplied miniport driver. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcNewMiniport -( - __out PMINIPORT * OutMiniPort, - __in REFCLSID ClassID -); - -#if (NTDDI_VERSION >= NTDDI_WINXP) -/***************************************************************************** - * PcNewDmaChannel() - ***************************************************************************** - * Creates a DMA channel. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcNewDmaChannel -( - __out PDMACHANNEL * OutDmaChannel, - __in_opt PUNKNOWN OuterUnknown, - __in POOL_TYPE PoolType, - __in PDEVICE_DESCRIPTION DeviceDescription, - __in PDEVICE_OBJECT DeviceObject -); -#endif - -/***************************************************************************** - * PcCompletePendingPropertyRequest() - ***************************************************************************** - * Completes a pending property request. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcCompletePendingPropertyRequest -( - __in PPCPROPERTY_REQUEST PropertyRequest, - __in NTSTATUS NtStatus -); - -/***************************************************************************** - * PcGetTimeInterval - ***************************************************************************** - * Gets the system time interval - */ -PORTCLASSAPI -ULONGLONG -NTAPI -PcGetTimeInterval -( - __in ULONGLONG Since -); - -#define GTI_SECONDS(t) (ULONGLONG(t)*10000000) -#define GTI_MILLISECONDS(t) (ULONGLONG(t)*10000) -#define GTI_MICROSECONDS(t) (ULONGLONG(t)*10) - -/***************************************************************************** - * PcNewResourceList() - ***************************************************************************** - * Creates and initializes a resource list. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcNewResourceList -( - __out PRESOURCELIST * OutResourceList, - __in_opt PUNKNOWN OuterUnknown, - __in POOL_TYPE PoolType, - __in PCM_RESOURCE_LIST TranslatedResources, - __in PCM_RESOURCE_LIST UntranslatedResources -); - -/***************************************************************************** - * PcNewResourceSublist() - ***************************************************************************** - * Creates and initializes an empty resource list derived from another - * resource list. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcNewResourceSublist -( - __out PRESOURCELIST * OutResourceList, - __in_opt PUNKNOWN OuterUnknown, - __in POOL_TYPE PoolType, - __in PRESOURCELIST ParentList, - __in ULONG MaximumEntries -); - -/***************************************************************************** - * PcNewInterruptSync() - ***************************************************************************** - * Creates and initializes an interrupt-level synchronization object. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcNewInterruptSync -( - __out PINTERRUPTSYNC * OutInterruptSync, - __in_opt PUNKNOWN OuterUnknown, - __in PRESOURCELIST ResourceList, - __in ULONG ResourceIndex, - __in INTERRUPTSYNCMODE Mode -); - -/***************************************************************************** - * PcNewServiceGroup() - ***************************************************************************** - * Creates and initializes a service group object. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcNewServiceGroup -( - __out PSERVICEGROUP * OutServiceGroup, - __in_opt PUNKNOWN OuterUnknown -); - -/***************************************************************************** - * PcNewRegistryKey() - ***************************************************************************** - * Creates and initializes a registry key object. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcNewRegistryKey -( - __out PREGISTRYKEY * OutRegistryKey, - __in_opt PUNKNOWN OuterUnknown, - __in ULONG RegistryKeyType, - __in ACCESS_MASK DesiredAccess, - __in_opt PVOID DeviceObject, - __in_opt PVOID SubDevice, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt ULONG CreateOptions, - __out_opt PULONG Disposition -); - -/***************************************************************************** - * RegistryKeyType for NewRegistryKey() - ***************************************************************************** - * Enumeration of key types. - */ -enum -{ - GeneralRegistryKey, // ObjectAttributes and CreateOptions are req'd. - DeviceRegistryKey, // Device Object is required - DriverRegistryKey, // Device Object is required - HwProfileRegistryKey, // Device Object is required - DeviceInterfaceRegistryKey // Device Object and SubDevice are required -}; - -/***************************************************************************** - * PcGetDeviceProperty() - ***************************************************************************** - * This returns the requested device property from the registry. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcGetDeviceProperty -( - __in PVOID DeviceObject, - __in DEVICE_REGISTRY_PROPERTY DeviceProperty, - __in ULONG BufferLength, - __out PVOID PropertyBuffer, - __out PULONG ResultLength -); - -/***************************************************************************** - * PcRegisterAdapterPowerManagement() - ***************************************************************************** - * Register the adapter's power management interface with PortCls. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcRegisterAdapterPowerManagement -( - __in PUNKNOWN Unknown, - __in PVOID pvContext1 -); - -/***************************************************************************** - * PcUnregisterAdapterPowerManagement() - ***************************************************************************** - * Unregister the adapter's power management interface with PortCls. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcUnregisterAdapterPowerManagement -( - __in PDEVICE_OBJECT pDeviceObject -); - -/***************************************************************************** - * PcRequestNewPowerState() - ***************************************************************************** - * This routine is used to request a new power state for the device. It is - * normally not needed by adapter drivers but is exported in order to - * support unusual circumstances. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcRequestNewPowerState -( - __in PDEVICE_OBJECT pDeviceObject, - __in DEVICE_POWER_STATE RequestedNewState -); - -/***************************************************************************** - * PcRegisterIoTimeout() - ***************************************************************************** - * This routine registers a driver-supplied callback associated with a given - * device object (see IoInitializeTimer in the DDK). This callback that will - * be called approximately once per second while the device is active (see - * IoStartTimer, and IoStopTimer in the DDK - these are called upon device - * START and STOP). - * - * This routine must be called at PASSIVE_LEVEL. - * pTimerRoutine can and will be called at DISPATCH_LEVEL; it must be non-paged. - * - */ -__drv_maxIRQL(PASSIVE_LEVEL) -PORTCLASSAPI -NTSTATUS -NTAPI -PcRegisterIoTimeout -( - __in PDEVICE_OBJECT pDeviceObject, - __in PIO_TIMER_ROUTINE pTimerRoutine, - __in PVOID pContext -); - -/***************************************************************************** - * PcUnregisterIoTimeout() - ***************************************************************************** - * This routine unregisters a driver-supplied callback associated with a given - * device object. This callback must have been previously registered with - * PcRegisterIoTimeout (with the same device object, timer routine and context). - * - * This routine must be called at PASSIVE_LEVEL. - * pTimerRoutine can and will be called at DISPATCH_LEVEL; it must be non-paged. - * - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcUnregisterIoTimeout -( - __in PDEVICE_OBJECT pDeviceObject, - __in PIO_TIMER_ROUTINE pTimerRoutine, - __in PVOID pContext -); - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -/***************************************************************************** - * Pc DRM functions - ***************************************************************************** - * These functions link directly to the kernel-mode Digital Rights Management - * module. They all must be called at PASSIVE_LEVEL. - */ -PORTCLASSAPI -NTSTATUS -NTAPI -PcAddContentHandlers -( - __in ULONG ContentId, - __in PVOID * paHandlers, - __in ULONG NumHandlers -); - -PORTCLASSAPI -NTSTATUS -NTAPI -PcCreateContentMixed -( - __in PULONG paContentId, - __in ULONG cContentId, - __out PULONG pMixedContentId -); - -PORTCLASSAPI -NTSTATUS -NTAPI -PcDestroyContent -( - __in ULONG ContentId -); - -PORTCLASSAPI -NTSTATUS -NTAPI -PcForwardContentToDeviceObject -( - __in ULONG ContentId, - __in PVOID Reserved, - __in PCDRMFORWARD DrmForward -); - -__drv_preferredFunction("DrmForwardContentToDeviceObject", "Obsolete") -PORTCLASSAPI -NTSTATUS -NTAPI -PcForwardContentToFileObject -( - __in ULONG ContentId, - __in PFILE_OBJECT FileObject -); - -PORTCLASSAPI -NTSTATUS -NTAPI -PcForwardContentToInterface -( - __in ULONG ContentId, - __in PUNKNOWN pUnknown, - __in ULONG NumMethods -); - -PORTCLASSAPI -NTSTATUS -NTAPI -PcGetContentRights -( - __in ULONG ContentId, - __out PDRMRIGHTS DrmRights -); -#endif - -#ifdef PC_OLD_NAMES - -#define InitializeAdapterDriver(c1,c2,a) \ - PcInitializeAdapterDriver(PDRIVER_OBJECT(c1),PUNICODE_STRING(c2),PDRIVER_ADD_DEVICE(a)) -#define AddAdapterDevice(c1,c2,s,m) \ - PcAddAdapterDevice(PDRIVER_OBJECT(c1),PDEVICE_OBJECT(c2),s,m,0) -#define RegisterSubdevice(c1,c2,n,u) \ - PcRegisterSubdevice(PDEVICE_OBJECT(c1),n,u) -#define RegisterPhysicalConnection(c1,c2,fs,fp,ts,tp) \ - PcRegisterPhysicalConnection(PDEVICE_OBJECT(c1),fs,fp,ts,tp) -#define RegisterPhysicalConnectionToExternal(c1,c2,fs,fp,ts,tp) \ - PcRegisterPhysicalConnectionToExternal(PDEVICE_OBJECT(c1),fs,fp,ts,tp) -#define RegisterPhysicalConnectionFromExternal(c1,c2,fs,fp,ts,tp) \ - PcRegisterPhysicalConnectionFromExternal(PDEVICE_OBJECT(c1),fs,fp,ts,tp) - -#define NewPort PcNewPort -#define NewMiniport PcNewMiniport -#define CompletePendingPropertyRequest PcCompletePendingPropertyRequest - -#if (NTDDI_VERSION < NTDDI_WINXP) -#define NewIrpStreamVirtual PcNewIrpStreamVirtual -#define NewIrpStreamPhysical PcNewIrpStreamPhysical -#endif - -#define NewResourceList PcNewResourceList -#define NewResourceSublist PcNewResourceSublist -#define NewDmaChannel PcNewDmaChannel -#define NewServiceGroup PcNewServiceGroup -#define GetTimeInterval PcGetTimeInterval - -#define WIN95COMPAT_ReadPortUChar(Port) READ_PORT_UCHAR(Port) -#define WIN95COMPAT_WritePortUChar(Port,Value) WRITE_PORT_UCHAR(Port,Value) -#define WIN95COMPAT_ReadPortUShort(Port) READ_PORT_USHORT(Port) -#define WIN95COMPAT_WritePortUShort(Port,Value) WRITE_PORT_USHORT(Port,Value) - -#endif //PC_OLD_NAMES - - - -#endif //_PORTCLS_H_ - diff --git a/pub/ddk/prefix.h b/pub/ddk/prefix.h deleted file mode 100644 index 0a93024..0000000 --- a/pub/ddk/prefix.h +++ /dev/null @@ -1,305 +0,0 @@ -/*++ - -Copyright (c) 1989 Microsoft Corporation - -Module Name: - - prefix.h - -Abstract: - - This module defines the data structures that enable the RDBSS to use the prefix package - to catalog its server and netroot names. For the moment, file/directory names use the same stuff. - -Author: -Revision History: - ---*/ - -#ifndef _RXPREFIX_ -#define _RXPREFIX_ - -// this stuff is implemented in prefix.c - -/* - The current implementation uses a table that has as components: - - 1) a prefix table - 2) a queue - 3) a version - 4) a lock - - You use the lock in the normal way: shared to lookup; eclusive to change. the version changes - eith each change. The reason that we have the queue is that the prefix table package allows - caller to be enumerating at a time..... the Q/version approach allows multiple guys at a time. - The Q could be used as a faster lookup for filenames but the prefix table is definitely the - right thing for netroots. - -*/ - -typedef struct _RX_CONNECTION_ID { - union { - ULONG SessionID; - LUID Luid; - }; -} RX_CONNECTION_ID, *PRX_CONNECTION_ID; - -ULONG -RxTableComputeHashValue ( - IN PUNICODE_STRING Name - ); - -PVOID -RxPrefixTableLookupName ( - IN PRX_PREFIX_TABLE ThisTable, - IN PUNICODE_STRING CanonicalName, - OUT PUNICODE_STRING RemainingName, - IN PRX_CONNECTION_ID ConnectionId - ); - -PRX_PREFIX_ENTRY -RxPrefixTableInsertName ( - IN OUT PRX_PREFIX_TABLE ThisTable, - IN OUT PRX_PREFIX_ENTRY ThisEntry, - IN PVOID Container, - IN PULONG ContainerRefCount, - IN USHORT CaseInsensitiveLength, - IN PRX_CONNECTION_ID ConnectionId - ); - -VOID -RxRemovePrefixTableEntry ( - IN OUT PRX_PREFIX_TABLE ThisTable, - IN OUT PRX_PREFIX_ENTRY Entry - ); - -VOID -RxDereferenceEntryContainer ( - IN OUT PRX_PREFIX_ENTRY Entry, - IN PRX_PREFIX_TABLE PrefixTable - ); - -BOOLEAN -RxIsNameTableEmpty ( - IN PRX_PREFIX_TABLE ThisTable - ); - -VOID -RxInitializePrefixTable ( - IN OUT PRX_PREFIX_TABLE ThisTable, - IN ULONG TableSize OPTIONAL, - IN BOOLEAN CaseInsensitiveMatch - ); - -VOID -RxFinalizePrefixTable ( - IN OUT PRX_PREFIX_TABLE ThisTable - ); - -// -// Rx form of a table entry. -// - -typedef struct _RX_PREFIX_ENTRY { - - // - // Normal Header for Refcounted Structure - // - - NODE_TYPE_CODE NodeTypeCode; - NODE_BYTE_SIZE NodeByteSize; - - // - // the initial part of the name that is always case insensitive - // - - USHORT CaseInsensitiveLength; - USHORT Spare1; - - ULONG SavedHashValue; - LIST_ENTRY HashLinks; - - // - // queue of the set members - // - - LIST_ENTRY MemberQLinks; - - // - // Name of the entry - // - - UNICODE_STRING Prefix; - - // - // Pointer to the reference count of the container - // - - PULONG ContainerRefCount; - - // - // don't know the parent type...nor do all callers! - // thus, i need this backptr. - // - - PVOID ContainingRecord; - - // - // some space that alternate table routines can use - // - - PVOID Context; - - // - // Used for controlled multiplexing - // - - RX_CONNECTION_ID ConnectionId; - -} RX_PREFIX_ENTRY, *PRX_PREFIX_ENTRY; - -// -// Rx form of name table. wraps in a lock and a queue. Originally, this implementation used the prefix tables -// in Rtl which don't allow an empty string entry. so, we special case this. -// - -#define RX_PREFIX_TABLE_DEFAULT_LENGTH 32 - -typedef -PVOID -(*PRX_TABLE_LOOKUPNAME) ( - IN PRX_PREFIX_TABLE ThisTable, - IN PUNICODE_STRING CanonicalName, - OUT PUNICODE_STRING RemainingName - ); - -typedef -PRX_PREFIX_ENTRY -(*PRX_TABLE_INSERTENTRY) ( - IN OUT PRX_PREFIX_TABLE ThisTable, - IN OUT PRX_PREFIX_ENTRY ThisEntry - ); - -typedef -VOID -(*PRX_TABLE_REMOVEENTRY) ( - IN OUT PRX_PREFIX_TABLE ThisTable, - IN OUT PRX_PREFIX_ENTRY Entry - ); - -typedef struct _RX_PREFIX_TABLE { - - // - // Normal Header - // - - NODE_TYPE_CODE NodeTypeCode; - NODE_BYTE_SIZE NodeByteSize; - - // - // version stamp changes on each insertion/removal - // - - ULONG Version; - - // - // queue of the inserted names - // - - LIST_ENTRY MemberQueue; - - // - // Resource used to control table access - // - - ERESOURCE TableLock; - - // - // PrefixEntry for the Null string - // - - PRX_PREFIX_ENTRY TableEntryForNull; - - BOOLEAN CaseInsensitiveMatch; - - // - // we may act differently for this....esp for debug! - // - - BOOLEAN IsNetNameTable; - ULONG TableSize; - -#if DBG - ULONG Lookups; - ULONG FailedLookups; - ULONG Considers; - ULONG Compares; -#endif - - LIST_ENTRY HashBuckets[RX_PREFIX_TABLE_DEFAULT_LENGTH]; - -} RX_PREFIX_TABLE, *PRX_PREFIX_TABLE; - - -#if 0 - -#define RxAcquirePrefixTableLockShared(PrefixTable,Wait) \ - RxpAcquirePrefixTableLockShared((PrefixTable),(Wait),TRUE, __FILE__,__LINE__ ) - -#define RxAcquirePrefixTableLockExclusive(PrefixTable,Wait) \ - RxpAcquirePrefixTableLockExclusive((PrefixTable),(Wait),TRUE, __FILE__,__LINE__ ) - -#define RxReleasePrefixTableLock(PrefixTable) \ - RxpReleasePrefixTableLock((PrefixTable),TRUE, __FILE__,__LINE__ ) - -extern -BOOLEAN -RxpAcquirePrefixTableLockShared ( - PRX_PREFIX_TABLE pTable, - BOOLEAN Wait, - BOOLEAN ProcessBufferingStateChangeRequests, - PSZ FileName, - ULONG LineNumber ); - -extern -BOOLEAN -RxpAcquirePrefixTableLockExclusive ( - PRX_PREFIX_TABLE pTable, - BOOLEAN Wait, - BOOLEAN ProcessBufferingStateChangeRequests, - PSZ FileName, - ULONG LineNumber - ); - -extern -VOID -RxpReleasePrefixTableLock ( - PRX_PREFIX_TABLE pTable, - BOOLEAN ProcessBufferingStateChangeRequests, - PSZ FileName, - ULONG LineNumber - ); - -#else - -#define RxAcquirePrefixTableLockShared(TABLE,WAIT) ExAcquireResourceSharedLite( &(TABLE)->TableLock, (WAIT) ) -#define RxAcquirePrefixTableLockExclusive(TABLE,WAIT) ExAcquireResourceExclusiveLite( &(TABLE)->TableLock, (WAIT) ) -#define RxReleasePrefixTableLock(TABLE) ExReleaseResourceLite( &(TABLE)->TableLock ) - - -#endif - -extern -VOID -RxExclusivePrefixTableLockToShared ( - PRX_PREFIX_TABLE Table - ); - -#define RxIsPrefixTableLockExclusive(TABLE) ExIsResourceAcquiredExclusiveLite(&(TABLE)->TableLock) -#define RxIsPrefixTableLockAcquired(TABLE) ( ExIsResourceAcquiredSharedLite(&(TABLE)->TableLock) || \ - ExIsResourceAcquiredExclusiveLite(&(TABLE)->TableLock) ) - - - -#endif // _RXPREFIX_ - diff --git a/pub/ddk/prnasnot.h b/pub/ddk/prnasnot.h deleted file mode 100644 index 4446363..0000000 --- a/pub/ddk/prnasnot.h +++ /dev/null @@ -1,232 +0,0 @@ -/*++ - -Copyright (c) 2001 Microsoft Corporation - -Module Name: - - prnasnot.h - -Abstract: - - Header file for Print APIs - -Revision History: - ---*/ -#ifndef _PRINTASYNCNOTIFY_H_ -#define _PRINTASYNCNOTIFY_H_ - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -#include "initguid.h" -#include - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif - -DEFINE_GUID(IID_IPrintAsyncNotifyChannel, 0x4a5031b1, 0x1f3f, 0x4db0, 0xa4, 0x62, 0x45, 0x30, 0xed, 0x8b, 0x04, 0x51); -DEFINE_GUID(IID_IPrintAsyncNotifyCallback, 0x7def34c1, 0x9d92, 0x4c99, 0xb3, 0xb3, 0xdb, 0x94, 0xa9, 0xd4, 0x19, 0x1b); -DEFINE_GUID(IID_IPrintAsyncNotifyDataObject, 0x77cf513e, 0x5d49, 0x4789, 0x9f, 0x30, 0xd0, 0x82, 0x2b, 0x33, 0x5c, 0x0d); - -DEFINE_GUID(NOTIFICATION_RELEASE, 0xba9a5027, 0xa70e, 0x4ae7, 0x9b, 0x7d, 0xeb, 0x3e, 0x06, 0xad, 0x41, 0x57); - -// -// Global Application Bidi Notification Channel -// All Apps interested in Bidi Notifications from the Print subsystem should register for -// notifications on this Channel GUID -// -// {2ABAD223-B994-4aca-82FC-4571B1B585AC} -DEFINE_GUID(PRINT_APP_BIDI_NOTIFY_CHANNEL, 0x2ABAD223, 0xB994, 0x4aca, 0x82, 0xFC, 0x45, 0x71, 0xB1, 0xB5, 0x85, 0xAC); - -// -// Global Port Monitor Bidi Notification Channel -// This is the Global Channel GUID that all Bidi enabled Port Monitor should open to send -// Bidi Schema notifications up -// -// {25DF3B0E-74A9-47f5-80CE-79B4B1EB5C58} -DEFINE_GUID(PRINT_PORT_MONITOR_NOTIFY_CHANNEL, 0x25df3b0e, 0x74a9, 0x47f5, 0x80, 0xce, 0x79, 0xb4, 0xb1, 0xeb, 0x5c, 0x58); - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum -{ - kPerUser, - kAllUsers, - -} PrintAsyncNotifyUserFilter; - -typedef enum -{ - kBiDirectional, - kUniDirectional - -} PrintAsyncNotifyConversationStyle; - -typedef GUID PrintAsyncNotificationType; - -//#undef IUnknown - -#undef INTERFACE -#define INTERFACE IPrintAsyncNotifyDataObject -DECLARE_INTERFACE_(IPrintAsyncNotifyDataObject, IUnknown) -{ - STDMETHOD(QueryInterface)( - THIS_ - __in REFIID riid, - __deref_out void **ppvObj - ) PURE; - - STDMETHOD_(ULONG, AddRef)( - THIS - ) PURE; - - STDMETHOD_(ULONG, Release)( - THIS - ) PURE; - - STDMETHOD(AcquireData)( - THIS_ - __deref_out_ecount_opt(*pSize) BYTE **ppNotificationData, - __out_opt ULONG *pSize, - __deref_out_opt PrintAsyncNotificationType **ppSchema - ) PURE; - - STDMETHOD(ReleaseData)( - THIS - ) PURE; -}; - -typedef interface IPrintAsyncNotifyCallback IPrintAsyncNotifyCallback; - -#undef INTERFACE -#define INTERFACE IPrintAsyncNotifyChannel -DECLARE_INTERFACE_(IPrintAsyncNotifyChannel, IUnknown) -{ - STDMETHOD(QueryInterface)( - THIS_ - __in REFIID riid, - __deref_out void **ppvObj - ) PURE; - - STDMETHOD_(ULONG, AddRef)( - THIS - ) PURE; - - STDMETHOD_(ULONG, Release)( - THIS - ) PURE; - - STDMETHOD(SendNotification)( - THIS_ - __in IPrintAsyncNotifyDataObject *pData - ) PURE; - - STDMETHOD(CloseChannel)( - THIS_ - __in IPrintAsyncNotifyDataObject *pData - ) PURE; -}; - - -#undef INTERFACE -#define INTERFACE IPrintAsyncNotifyCallback -DECLARE_INTERFACE_(IPrintAsyncNotifyCallback, IUnknown) -{ - STDMETHOD(QueryInterface)( - THIS_ - __in REFIID riid, - __deref_out void **ppvObj - ) PURE; - - STDMETHOD_(ULONG, AddRef)( - THIS - ) PURE; - - STDMETHOD_(ULONG, Release)( - THIS - ) PURE; - - STDMETHOD(OnEventNotify)( - THIS_ - __in IPrintAsyncNotifyChannel *pChannel, - __in IPrintAsyncNotifyDataObject *pData - ) PURE; - - STDMETHOD(ChannelClosed)( - THIS_ - __in IPrintAsyncNotifyChannel *pChannel, - __in IPrintAsyncNotifyDataObject *pData - ) PURE; -}; - -#undef INTERFACE - -HRESULT -WINAPI -RegisterForPrintAsyncNotifications( - __in_opt PCWSTR pszName, - __in PrintAsyncNotificationType* pNotificationType, - PrintAsyncNotifyUserFilter eUserFilter, - PrintAsyncNotifyConversationStyle eConversationStyle, - __in IPrintAsyncNotifyCallback* pCallback, - __out HANDLE* phNotify - ); - -HRESULT -WINAPI -UnRegisterForPrintAsyncNotifications( - __in HANDLE - ); - -HRESULT -WINAPI -CreatePrintAsyncNotifyChannel( - __in_opt PCWSTR pszName, - __in PrintAsyncNotificationType* pNotificationType, - PrintAsyncNotifyUserFilter eUserFilter, - PrintAsyncNotifyConversationStyle eConversationStyle, - __in_opt IPrintAsyncNotifyCallback* pCallback, - __out IPrintAsyncNotifyChannel** ppIAsynchNotification - ); - -typedef enum -{ - CHANNEL_CLOSED_BY_SERVER = 0x01, - CHANNEL_CLOSED_BY_ANOTHER_LISTENER = 0x02, - CHANNEL_CLOSED_BY_SAME_LISTENER = 0x03, - CHANNEL_RELEASED_BY_LISTENER = 0x04, - UNIRECTIONAL_NOTIFICATION_LOST = 0x05, - ASYNC_NOTIFICATION_FAILURE = 0x06, - NO_LISTENERS = 0x07, - CHANNEL_ALREADY_CLOSED = 0x08, - CHANNEL_ALREADY_OPENED = 0x09, - CHANNEL_WAITING_FOR_CLIENT_NOTIFICATION = 0x0a, - CHANNEL_NOT_OPENED = 0x0b, - ASYNC_CALL_ALREADY_PARKED = 0x0c, - NOT_REGISTERED = 0x0d, - ALREADY_UNREGISTERED = 0x0e, - ALREADY_REGISTERED = 0x0f, - CHANNEL_ACQUIRED = 0x10, - ASYNC_CALL_IN_PROGRESS = 0x11, - MAX_NOTIFICATION_SIZE_EXCEEDED = 0x12, - INTERNAL_NOTIFICATION_QUEUE_IS_FULL = 0x13, - INVALID_NOTIFICATION_TYPE = 0x14, - MAX_REGISTRATION_COUNT_EXCEEDED = 0x15, - MAX_CHANNEL_COUNT_EXCEEDED = 0x16, - LOCAL_ONLY_REGISTRATION = 0x17, - REMOTE_ONLY_REGISTRATION = 0x18, - -} PrintAsyncNotifyError; - -#ifdef __cplusplus -} -#endif - -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - -#endif // _PRINTASYNCNOTIFY_H_ - diff --git a/pub/ddk/procgrp.h b/pub/ddk/procgrp.h deleted file mode 100644 index ae69328..0000000 --- a/pub/ddk/procgrp.h +++ /dev/null @@ -1,240 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - procgrp.h - -Abstract: - - This header exposes the new kernel APIs to device drivers in a - manner that makes it possible for drivers referencing these new - APIs to run on downlevel systems. - ---*/ - -#ifndef _WDMLIB_PROCGRP_H_ -#define _WDMLIB_PROCGRP_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Initialization function of the compatibility library. This function -// must be called at PASSIVE_LEVEL prior to calling any of the APIs in -// this library. -// - -VOID -WdmlibProcgrpInitialize ( - VOID - ); - -// -// Supply an overrideable library implementation of -// KeGetCurrentProcessorNumberEx. See DDK documentation for more details -// on this API. -// - -#undef KeGetCurrentProcessorNumberEx -#define KeGetCurrentProcessorNumberEx WdmlibKeGetCurrentProcessorNumberEx - -ULONG -WdmlibKeGetCurrentProcessorNumberEx ( - __out_opt PPROCESSOR_NUMBER ProcNumber - ); - -// -// Supply an overrideable library implementation of -// KeQueryActiveProcessorCountEx. See DDK documentation for more details -// on this API. -// - -#undef KeQueryActiveProcessorCountEx -#define KeQueryActiveProcessorCountEx WdmlibKeQueryActiveProcessorCountEx - -ULONG -WdmlibKeQueryActiveProcessorCountEx ( - __in USHORT GroupNumber - ); - -// -// Supply an overrideable library implementation of -// KeQueryMaximumProcessorCountEx. See DDK documentation for more details -// on this API. -// - -#undef KeQueryMaximumProcessorCountEx -#define KeQueryMaximumProcessorCountEx WdmlibKeQueryMaximumProcessorCountEx - -ULONG -WdmlibKeQueryMaximumProcessorCountEx ( - __in USHORT GroupNumber - ); - -// -// Supply an overrideable library implementation of -// KeQueryMaximumProcessorCount. See DDK documentation for more details -// on this API. -// - -#undef KeQueryMaximumProcessorCount -#define KeQueryMaximumProcessorCount WdmlibKeQueryMaximumProcessorCount - -ULONG -WdmlibKeQueryMaximumProcessorCount ( - VOID - ); - -// -// Supply an overrideable library implementation of KeQueryGroupAffinity. -// See DDK documentation for more details on this API. -// - -#undef KeQueryGroupAffinity -#define KeQueryGroupAffinity WdmlibKeQueryGroupAffinity - -KAFFINITY -WdmlibKeQueryGroupAffinity ( - __in USHORT GroupNumber - ); - -// -// Supply an overrideable library implementation of -// KeQueryActiveGroupCount. See DDK documentation for more details -// on this API. -// - -#undef KeQueryActiveGroupCount -#define KeQueryActiveGroupCount WdmlibKeQueryActiveGroupCount - -USHORT -WdmlibKeQueryActiveGroupCount ( - VOID - ); - -// -// Supply an overrideable library implementation of -// KeQueryMaximumGroupCount. See DDK documentation for more details -// on this API. -// - -#undef KeQueryMaximumGroupCount -#define KeQueryMaximumGroupCount WdmlibKeQueryMaximumGroupCount - -USHORT -WdmlibKeQueryMaximumGroupCount ( - VOID - ); - -// -// Supply an overrideable library implementation of -// KeGetProcessorNumberFromIndex. See DDK documentation for more details -// on this API. -// - -#undef KeGetProcessorNumberFromIndex -#define KeGetProcessorNumberFromIndex WdmlibKeGetProcessorNumberFromIndex - -NTSTATUS -WdmlibKeGetProcessorNumberFromIndex ( - __in ULONG ProcIndex, - __out PPROCESSOR_NUMBER ProcNumber - ); - -// -// Supply an overrideable library implementation of -// KeGetProcessorIndexFromNumber. See DDK documentation for more details -// on this API. -// - -#undef KeGetProcessorIndexFromNumber -#define KeGetProcessorIndexFromNumber WdmlibKeGetProcessorIndexFromNumber - -ULONG -WdmlibKeGetProcessorIndexFromNumber ( - __in PPROCESSOR_NUMBER ProcNumber - ); - -// -// Supply an overrideable library implementation of -// KeSetSystemAffinityThreadEx. See DDK documentation for more details -// on this API. -// - -#undef KeSetSystemAffinityThreadEx -#define KeSetSystemAffinityThreadEx WdmlibKeSetSystemAffinityThreadEx - -KAFFINITY -WdmlibKeSetSystemAffinityThreadEx ( - __in KAFFINITY Affinity - ); - -// -// Supply an overrideable library implementation of -// KeSetSystemGroupAffinityThread. See DDK documentation for more details -// on this API. -// - -#undef KeSetSystemGroupAffinityThread -#define KeSetSystemGroupAffinityThread WdmlibKeSetSystemGroupAffinityThread - -VOID -WdmlibKeSetSystemGroupAffinityThread ( - __in PGROUP_AFFINITY NewAffinity, - __out_opt PGROUP_AFFINITY PreviousAffinity - ); - -// -// Supply an overrideable library implementation of -// KeRevertToUserAffinityThreadEx. See DDK documentation for more details -// on this API. -// - -#undef KeRevertToUserAffinityThreadEx -#define KeRevertToUserAffinityThreadEx WdmlibKeRevertToUserAffinityThreadEx - -VOID -WdmlibKeRevertToUserAffinityThreadEx ( - __in KAFFINITY Affinity - ); - -// -// Supply an overrideable library implementation of -// KeRevertToUserGroupAffinityThread. See DDK documentation for more details -// on this API. -// - -#undef KeRevertToUserGroupAffinityThread -#define KeRevertToUserGroupAffinityThread \ - WdmlibKeRevertToUserGroupAffinityThread - -VOID -WdmlibKeRevertToUserGroupAffinityThread ( - __in PGROUP_AFFINITY PreviousAffinity - ); - -// -// Supply an overrideable library implementation of -// KeSetTargetProcessorDpcEx. See DDK documentation for more details -// on this API. -// - -#undef KeSetTargetProcessorDpcEx -#define KeSetTargetProcessorDpcEx WdmlibKeSetTargetProcessorDpcEx - -NTSTATUS -WdmlibKeSetTargetProcessorDpcEx ( - __inout PKDPC Dpc, - __in PPROCESSOR_NUMBER ProcNumber - ); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // !defined(_WDMLIB_PROCGRP_H_) - diff --git a/pub/ddk/ptpusd.h b/pub/ddk/ptpusd.h deleted file mode 100644 index 0ef9f3c..0000000 --- a/pub/ddk/ptpusd.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -* -* (C) COPYRIGHT 2000, MICROSOFT CORP. -* -* FILE: ptpusd.h -* -* VERSION: 1.0 -* -* DATE: 12/12/2000 -* -* AUTHOR: Dave Parsons -* -* DESCRIPTION: -* Structures and constants needed to issue vendor-specific Picture -* Transfer Protocol (PIMA 15740 - digital still camera command -* protocol) commands through the WIA PTP driver. -* -*****************************************************************************/ - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -// -// Pass this value in the dwEscapeCode argument of IWiaItemExtras::Escape -// to execute a PTP vendor command -// -const DWORD ESCAPE_PTP_CLEAR_STALLS = 0x0200; -const DWORD ESCAPE_PTP_VENDOR_COMMAND = 0x0100; -const DWORD ESCAPE_PTP_ADD_OBJ_CMD = 0x0010; -const DWORD ESCAPE_PTP_REM_OBJ_CMD = 0x0020; -const DWORD ESCAPE_PTP_ADD_OBJ_RESP = 0x0040; -const DWORD ESCAPE_PTP_REM_OBJ_RESP = 0x0080; -const DWORD ESCAPE_PTP_ADDREM_PARM1 = 0x0000; -const DWORD ESCAPE_PTP_ADDREM_PARM2 = 0x0001; -const DWORD ESCAPE_PTP_ADDREM_PARM3 = 0x0002; -const DWORD ESCAPE_PTP_ADDREM_PARM4 = 0x0003; -const DWORD ESCAPE_PTP_ADDREM_PARM5 = 0x0004; - -// -// PTP command request -// -const DWORD PTP_MAX_PARAMS = 5; - -#pragma pack(push, Old, 1) - -typedef struct _PTP_VENDOR_DATA_IN -{ - WORD OpCode; // Opcode - DWORD SessionId; // Session id - DWORD TransactionId; // Transaction id - DWORD Params[PTP_MAX_PARAMS]; // Parameters to the command - DWORD NumParams; // Number of parameters passed in - DWORD NextPhase; // Indicates whether to read data, - BYTE VendorWriteData[1]; // Optional first byte of data to - // write to the device - -} PTP_VENDOR_DATA_IN, *PPTP_VENDOR_DATA_IN; - -// -// PTP response block -// -typedef struct _PTP_VENDOR_DATA_OUT -{ - WORD ResponseCode; // Response code - DWORD SessionId; // Session id - DWORD TransactionId; // Transaction id - DWORD Params[PTP_MAX_PARAMS]; // Parameters of the response - BYTE VendorReadData[1]; // Optional first byte of data to - // read from the device - -} PTP_VENDOR_DATA_OUT, *PPTP_VENDOR_DATA_OUT; - -#pragma pack(pop, Old) - -// -// Handy structure size constants -// -const DWORD SIZEOF_REQUIRED_VENDOR_DATA_IN = sizeof(PTP_VENDOR_DATA_IN) - 1; -const DWORD SIZEOF_REQUIRED_VENDOR_DATA_OUT = sizeof(PTP_VENDOR_DATA_OUT) - 1; - -// -// NextPhase constants -// -const DWORD PTP_NEXTPHASE_READ_DATA = 3; -const DWORD PTP_NEXTPHASE_WRITE_DATA = 4; -const DWORD PTP_NEXTPHASE_NO_DATA = 5; - -#endif // (NTDDI_VERSION >= NTDDI_WINXP) - - diff --git a/pub/ddk/punknown.h b/pub/ddk/punknown.h deleted file mode 100644 index c12e4e9..0000000 --- a/pub/ddk/punknown.h +++ /dev/null @@ -1,76 +0,0 @@ -/***************************************************************************** - * punknown.h - IUnknown definitions - ***************************************************************************** - * Copyright (c) Microsoft Corporation. All rights reserved. - */ - -#ifndef _UNKNOWN_H_ -#define _UNKNOWN_H_ - -#ifdef __cplusplus -extern "C" { -#include -} -#else -#include -#endif - -#include -#define COM_NO_WINDOWS_H -#include -#ifdef PUT_GUIDS_HERE -#include -#endif - - -DEFINE_GUID(IID_IUnknown, -0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x46); - -/***************************************************************************** - * IUnknown - ***************************************************************************** - * Base interface for otherwise unknown objects. - */ -#undef INTERFACE -#define INTERFACE IUnknown -DECLARE_INTERFACE(IUnknown) -{ - STDMETHOD_(NTSTATUS,QueryInterface) - ( THIS_ - __in REFIID, - __out PVOID * - ) PURE; - - STDMETHOD_(ULONG,AddRef) - ( THIS - ) PURE; - - STDMETHOD_(ULONG,Release) - ( THIS - ) PURE; -}; -#undef INTERFACE - -typedef IUnknown *PUNKNOWN; - -/***************************************************************************** - * PFNCREATEINSTANCE - ***************************************************************************** - * Type for object create function. - */ -typedef -HRESULT -(*PFNCREATEINSTANCE) -( - __out PUNKNOWN * Unknown, - __in REFCLSID ClassId, - __in PUNKNOWN OuterUnknown, - __in POOL_TYPE PoolType -); - - - - - -#endif - diff --git a/pub/ddk/richedit.h b/pub/ddk/richedit.h deleted file mode 100644 index 40fcf68..0000000 --- a/pub/ddk/richedit.h +++ /dev/null @@ -1,1311 +0,0 @@ -/* - * RICHEDIT.H - * - * Purpose: - * RICHEDIT v2.0/3.0/4.0 public definitions - * functionality available for v2.0 and 3.0 that is not in the original - * Windows 95 release. - * - * Copyright (c) Microsoft Corporation. All rights reserved. - */ - -#ifndef _RICHEDIT_ -#define _RICHEDIT_ -#pragma once - -#ifdef _WIN32 -#include -#elif !defined(RC_INVOKED) -#pragma pack(4) -#endif - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// To mimic older RichEdit behavior, set _RICHEDIT_VER to appropriate value -// Version 1.0 0x0100 -// Version 2.0 0x0200 -// Version 2.1 0x0210 -#ifndef _RICHEDIT_VER -#define _RICHEDIT_VER 0x0300 -#endif - -#define cchTextLimitDefault 32767 - -#define MSFTEDIT_CLASS L"RICHEDIT50W" -// NOTE: MSFTEDIT.DLL only registers MSFTEDIT_CLASS. If an application wants -// to use the following Richedit classes, it needs to load the riched20.dll. -// Otherwise, CreateWindow with RICHEDIT_CLASS would fail. -// This also applies to any dialog that uses RICHEDIT_CLASS, - -// RichEdit 2.0 Window Class -// On Windows CE, avoid possible conflicts on Win95 -#define CERICHEDIT_CLASSA "RichEditCEA" -#define CERICHEDIT_CLASSW L"RichEditCEW" - -#define RICHEDIT_CLASSA "RichEdit20A" -#define RICHEDIT_CLASS10A "RICHEDIT" // Richedit 1.0 - -#ifndef MACPORT -#define RICHEDIT_CLASSW L"RichEdit20W" -#else //----------------------MACPORT -#define RICHEDIT_CLASSW TEXT("RichEdit20W") // MACPORT change -#endif // MACPORT - -#if (_RICHEDIT_VER >= 0x0200 ) -#ifdef UNICODE -#define RICHEDIT_CLASS RICHEDIT_CLASSW -#else -#define RICHEDIT_CLASS RICHEDIT_CLASSA -#endif // UNICODE -#else -#define RICHEDIT_CLASS RICHEDIT_CLASS10A -#endif // _RICHEDIT_VER >= 0x0200 - -// RichEdit messages - -#ifndef WM_CONTEXTMENU -#define WM_CONTEXTMENU 0x007B -#endif - -#ifndef WM_UNICHAR -#define WM_UNICHAR 0x0109 -#endif - -#ifndef WM_PRINTCLIENT -#define WM_PRINTCLIENT 0x0318 -#endif - -#ifndef EM_GETLIMITTEXT -#define EM_GETLIMITTEXT (WM_USER + 37) -#endif - -#ifndef EM_POSFROMCHAR -#define EM_POSFROMCHAR (WM_USER + 38) -#define EM_CHARFROMPOS (WM_USER + 39) -#endif - -#ifndef EM_SCROLLCARET -#define EM_SCROLLCARET (WM_USER + 49) -#endif -#define EM_CANPASTE (WM_USER + 50) -#define EM_DISPLAYBAND (WM_USER + 51) -#define EM_EXGETSEL (WM_USER + 52) -#define EM_EXLIMITTEXT (WM_USER + 53) -#define EM_EXLINEFROMCHAR (WM_USER + 54) -#define EM_EXSETSEL (WM_USER + 55) -#define EM_FINDTEXT (WM_USER + 56) -#define EM_FORMATRANGE (WM_USER + 57) -#define EM_GETCHARFORMAT (WM_USER + 58) -#define EM_GETEVENTMASK (WM_USER + 59) -#define EM_GETOLEINTERFACE (WM_USER + 60) -#define EM_GETPARAFORMAT (WM_USER + 61) -#define EM_GETSELTEXT (WM_USER + 62) -#define EM_HIDESELECTION (WM_USER + 63) -#define EM_PASTESPECIAL (WM_USER + 64) -#define EM_REQUESTRESIZE (WM_USER + 65) -#define EM_SELECTIONTYPE (WM_USER + 66) -#define EM_SETBKGNDCOLOR (WM_USER + 67) -#define EM_SETCHARFORMAT (WM_USER + 68) -#define EM_SETEVENTMASK (WM_USER + 69) -#define EM_SETOLECALLBACK (WM_USER + 70) -#define EM_SETPARAFORMAT (WM_USER + 71) -#define EM_SETTARGETDEVICE (WM_USER + 72) -#define EM_STREAMIN (WM_USER + 73) -#define EM_STREAMOUT (WM_USER + 74) -#define EM_GETTEXTRANGE (WM_USER + 75) -#define EM_FINDWORDBREAK (WM_USER + 76) -#define EM_SETOPTIONS (WM_USER + 77) -#define EM_GETOPTIONS (WM_USER + 78) -#define EM_FINDTEXTEX (WM_USER + 79) -#ifdef _WIN32 -#define EM_GETWORDBREAKPROCEX (WM_USER + 80) -#define EM_SETWORDBREAKPROCEX (WM_USER + 81) -#endif - -// RichEdit 2.0 messages -#define EM_SETUNDOLIMIT (WM_USER + 82) -#define EM_REDO (WM_USER + 84) -#define EM_CANREDO (WM_USER + 85) -#define EM_GETUNDONAME (WM_USER + 86) -#define EM_GETREDONAME (WM_USER + 87) -#define EM_STOPGROUPTYPING (WM_USER + 88) - -#define EM_SETTEXTMODE (WM_USER + 89) -#define EM_GETTEXTMODE (WM_USER + 90) - -// enum for use with EM_GET/SETTEXTMODE -typedef enum tagTextMode -{ - TM_PLAINTEXT = 1, - TM_RICHTEXT = 2, // Default behavior - TM_SINGLELEVELUNDO = 4, - TM_MULTILEVELUNDO = 8, // Default behavior - TM_SINGLECODEPAGE = 16, - TM_MULTICODEPAGE = 32 // Default behavior -} TEXTMODE; - -#define EM_AUTOURLDETECT (WM_USER + 91) -#define EM_GETAUTOURLDETECT (WM_USER + 92) -#define EM_SETPALETTE (WM_USER + 93) -#define EM_GETTEXTEX (WM_USER + 94) -#define EM_GETTEXTLENGTHEX (WM_USER + 95) -#define EM_SHOWSCROLLBAR (WM_USER + 96) -#define EM_SETTEXTEX (WM_USER + 97) - -// East Asia specific messages -#define EM_SETPUNCTUATION (WM_USER + 100) -#define EM_GETPUNCTUATION (WM_USER + 101) -#define EM_SETWORDWRAPMODE (WM_USER + 102) -#define EM_GETWORDWRAPMODE (WM_USER + 103) -#define EM_SETIMECOLOR (WM_USER + 104) -#define EM_GETIMECOLOR (WM_USER + 105) -#define EM_SETIMEOPTIONS (WM_USER + 106) -#define EM_GETIMEOPTIONS (WM_USER + 107) -#define EM_CONVPOSITION (WM_USER + 108) - -#define EM_SETLANGOPTIONS (WM_USER + 120) -#define EM_GETLANGOPTIONS (WM_USER + 121) -#define EM_GETIMECOMPMODE (WM_USER + 122) - -#define EM_FINDTEXTW (WM_USER + 123) -#define EM_FINDTEXTEXW (WM_USER + 124) - -// RE3.0 FE messages -#define EM_RECONVERSION (WM_USER + 125) -#define EM_SETIMEMODEBIAS (WM_USER + 126) -#define EM_GETIMEMODEBIAS (WM_USER + 127) - -// BiDi specific messages -#define EM_SETBIDIOPTIONS (WM_USER + 200) -#define EM_GETBIDIOPTIONS (WM_USER + 201) - -#define EM_SETTYPOGRAPHYOPTIONS (WM_USER + 202) -#define EM_GETTYPOGRAPHYOPTIONS (WM_USER + 203) - -// Extended edit style specific messages -#define EM_SETEDITSTYLE (WM_USER + 204) -#define EM_GETEDITSTYLE (WM_USER + 205) - -// Extended edit style masks -#define SES_EMULATESYSEDIT 1 -#define SES_BEEPONMAXTEXT 2 -#define SES_EXTENDBACKCOLOR 4 -#define SES_MAPCPS 8 // (obsolete) -#define SES_EMULATE10 16 // (obsolete) -#define SES_USECRLF 32 // (obsolete) -#define SES_NOXLTSYMBOLRANGE 32 -#define SES_USEAIMM 64 -#define SES_NOIME 128 - -#define SES_ALLOWBEEPS 256 -#define SES_UPPERCASE 512 -#define SES_LOWERCASE 1024 -#define SES_NOINPUTSEQUENCECHK 2048 -#define SES_BIDI 4096 -#define SES_SCROLLONKILLFOCUS 8192 -#define SES_XLTCRCRLFTOCR 16384 -#define SES_DRAFTMODE 32768 - -#define SES_USECTF 0x0010000 -#define SES_HIDEGRIDLINES 0x0020000 -#define SES_USEATFONT 0x0040000 -#define SES_CUSTOMLOOK 0x0080000 -#define SES_LBSCROLLNOTIFY 0x0100000 -#define SES_CTFALLOWEMBED 0x0200000 -#define SES_CTFALLOWSMARTTAG 0x0400000 -#define SES_CTFALLOWPROOFING 0x0800000 - -// Options for EM_SETLANGOPTIONS and EM_GETLANGOPTIONS -#define IMF_AUTOKEYBOARD 0x0001 -#define IMF_AUTOFONT 0x0002 -#define IMF_IMECANCELCOMPLETE 0x0004 // High completes comp string when aborting, low cancels -#define IMF_IMEALWAYSSENDNOTIFY 0x0008 -#define IMF_AUTOFONTSIZEADJUST 0x0010 -#define IMF_UIFONTS 0x0020 -#define IMF_DUALFONT 0x0080 -#define IMF_NORTFFONTSUBSTITUTE 0x0400 - - -// Values for EM_GETIMECOMPMODE -#define ICM_NOTOPEN 0x0000 -#define ICM_LEVEL3 0x0001 -#define ICM_LEVEL2 0x0002 -#define ICM_LEVEL2_5 0x0003 -#define ICM_LEVEL2_SUI 0x0004 -#define ICM_CTF 0x0005 - -// Options for EM_SETTYPOGRAPHYOPTIONS -#define TO_ADVANCEDTYPOGRAPHY 1 -#define TO_SIMPLELINEBREAK 2 -#define TO_DISABLECUSTOMTEXTOUT 4 -#define TO_ADVANCEDLAYOUT 8 - -// Pegasus outline mode messages (RE 3.0) - -// Outline mode message -#define EM_OUTLINE (WM_USER + 220) -// Message for getting and restoring scroll pos -#define EM_GETSCROLLPOS (WM_USER + 221) -#define EM_SETSCROLLPOS (WM_USER + 222) -// Change fontsize in current selection by wParam -#define EM_SETFONTSIZE (WM_USER + 223) -#define EM_GETZOOM (WM_USER + 224) -#define EM_SETZOOM (WM_USER + 225) -#define EM_GETVIEWKIND (WM_USER + 226) -#define EM_SETVIEWKIND (WM_USER + 227) - -// RichEdit 4.0 messages -#define EM_GETPAGE (WM_USER + 228) -#define EM_SETPAGE (WM_USER + 229) -#define EM_GETHYPHENATEINFO (WM_USER + 230) -#define EM_SETHYPHENATEINFO (WM_USER + 231) -#define EM_GETPAGEROTATE (WM_USER + 235) -#define EM_SETPAGEROTATE (WM_USER + 236) -#define EM_GETCTFMODEBIAS (WM_USER + 237) -#define EM_SETCTFMODEBIAS (WM_USER + 238) -#define EM_GETCTFOPENSTATUS (WM_USER + 240) -#define EM_SETCTFOPENSTATUS (WM_USER + 241) -#define EM_GETIMECOMPTEXT (WM_USER + 242) -#define EM_ISIME (WM_USER + 243) -#define EM_GETIMEPROPERTY (WM_USER + 244) - -// These messages control what rich edit does when it comes accross -// OLE objects during RTF stream in. Normally rich edit queries the client -// application only after OleLoad has been called. With these messages it is possible to -// set the rich edit control to a mode where it will query the client application before -// OleLoad is called -#define EM_GETQUERYRTFOBJ (WM_USER + 269) -#define EM_SETQUERYRTFOBJ (WM_USER + 270) - -// EM_SETPAGEROTATE wparam values -#define EPR_0 0 // Text flows left to right and top to bottom -#define EPR_270 1 // Text flows top to bottom and right to left -#define EPR_180 2 // Text flows right to left and bottom to top -#define EPR_90 3 // Text flows bottom to top and left to right - -// EM_SETCTFMODEBIAS wparam values -#define CTFMODEBIAS_DEFAULT 0x0000 -#define CTFMODEBIAS_FILENAME 0x0001 -#define CTFMODEBIAS_NAME 0x0002 -#define CTFMODEBIAS_READING 0x0003 -#define CTFMODEBIAS_DATETIME 0x0004 -#define CTFMODEBIAS_CONVERSATION 0x0005 -#define CTFMODEBIAS_NUMERIC 0x0006 -#define CTFMODEBIAS_HIRAGANA 0x0007 -#define CTFMODEBIAS_KATAKANA 0x0008 -#define CTFMODEBIAS_HANGUL 0x0009 -#define CTFMODEBIAS_HALFWIDTHKATAKANA 0x000A -#define CTFMODEBIAS_FULLWIDTHALPHANUMERIC 0x000B -#define CTFMODEBIAS_HALFWIDTHALPHANUMERIC 0x000C - -// EM_SETIMEMODEBIAS lparam values -#define IMF_SMODE_PLAURALCLAUSE 0x0001 -#define IMF_SMODE_NONE 0x0002 - -// EM_GETIMECOMPTEXT wparam structure -typedef struct _imecomptext { - LONG cb; // count of bytes in the output buffer. - DWORD flags; // value specifying the composition string type. - // Currently only support ICT_RESULTREADSTR -} IMECOMPTEXT; -#define ICT_RESULTREADSTR 1 - -// Outline mode wparam values -#define EMO_EXIT 0 // Enter normal mode, lparam ignored -#define EMO_ENTER 1 // Enter outline mode, lparam ignored -#define EMO_PROMOTE 2 // LOWORD(lparam) == 0 ==> - // promote to body-text - // LOWORD(lparam) != 0 ==> - // promote/demote current selection - // by indicated number of levels -#define EMO_EXPAND 3 // HIWORD(lparam) = EMO_EXPANDSELECTION - // -> expands selection to level - // indicated in LOWORD(lparam) - // LOWORD(lparam) = -1/+1 corresponds - // to collapse/expand button presses - // in winword (other values are - // equivalent to having pressed these - // buttons more than once) - // HIWORD(lparam) = EMO_EXPANDDOCUMENT - // -> expands whole document to - // indicated level -#define EMO_MOVESELECTION 4 // LOWORD(lparam) != 0 -> move current - // selection up/down by indicated amount -#define EMO_GETVIEWMODE 5 // Returns VM_NORMAL or VM_OUTLINE - -// EMO_EXPAND options -#define EMO_EXPANDSELECTION 0 -#define EMO_EXPANDDOCUMENT 1 - -#define VM_NORMAL 4 // Agrees with RTF \viewkindN -#define VM_OUTLINE 2 -#define VM_PAGE 9 // Screen page view (not print layout) - -// New notifications -#define EN_MSGFILTER 0x0700 -#define EN_REQUESTRESIZE 0x0701 -#define EN_SELCHANGE 0x0702 -#define EN_DROPFILES 0x0703 -#define EN_PROTECTED 0x0704 -#define EN_CORRECTTEXT 0x0705 // PenWin specific -#define EN_STOPNOUNDO 0x0706 -#define EN_IMECHANGE 0x0707 // East Asia specific -#define EN_SAVECLIPBOARD 0x0708 -#define EN_OLEOPFAILED 0x0709 -#define EN_OBJECTPOSITIONS 0x070a -#define EN_LINK 0x070b -#define EN_DRAGDROPDONE 0x070c -#define EN_PARAGRAPHEXPANDED 0x070d -#define EN_PAGECHANGE 0x070e -#define EN_LOWFIRTF 0x070f -#define EN_ALIGNLTR 0x0710 // BiDi specific notification -#define EN_ALIGNRTL 0x0711 // BiDi specific notification - -// Event notification masks -#define ENM_NONE 0x00000000 -#define ENM_CHANGE 0x00000001 -#define ENM_UPDATE 0x00000002 -#define ENM_SCROLL 0x00000004 -#define ENM_SCROLLEVENTS 0x00000008 -#define ENM_DRAGDROPDONE 0x00000010 -#define ENM_PARAGRAPHEXPANDED 0x00000020 -#define ENM_PAGECHANGE 0x00000040 -#define ENM_KEYEVENTS 0x00010000 -#define ENM_MOUSEEVENTS 0x00020000 -#define ENM_REQUESTRESIZE 0x00040000 -#define ENM_SELCHANGE 0x00080000 -#define ENM_DROPFILES 0x00100000 -#define ENM_PROTECTED 0x00200000 -#define ENM_CORRECTTEXT 0x00400000 // PenWin specific -#define ENM_IMECHANGE 0x00800000 // Used by RE1.0 compatibility -#define ENM_LANGCHANGE 0x01000000 -#define ENM_OBJECTPOSITIONS 0x02000000 -#define ENM_LINK 0x04000000 -#define ENM_LOWFIRTF 0x08000000 - - -// New edit control styles -#define ES_SAVESEL 0x00008000 -#define ES_SUNKEN 0x00004000 -#define ES_DISABLENOSCROLL 0x00002000 -// Same as WS_MAXIMIZE, but that doesn't make sense so we re-use the value -#define ES_SELECTIONBAR 0x01000000 -// Same as ES_UPPERCASE, but re-used to completely disable OLE drag'n'drop -#define ES_NOOLEDRAGDROP 0x00000008 - -// New edit control extended style -#if (_WIN32_WINNT > 0x0400) || (WINVER > 0x0400) -#define ES_EX_NOCALLOLEINIT 0x00000000 // Not supported in RE 2.0/3.0 -#else -#ifdef _WIN32 -#define ES_EX_NOCALLOLEINIT 0x01000000 -#endif -#endif - -// These flags are used in FE Windows -#define ES_VERTICAL 0x00400000 // Not supported in RE 2.0/3.0 -#define ES_NOIME 0x00080000 -#define ES_SELFIME 0x00040000 - -// Edit control options -#define ECO_AUTOWORDSELECTION 0x00000001 -#define ECO_AUTOVSCROLL 0x00000040 -#define ECO_AUTOHSCROLL 0x00000080 -#define ECO_NOHIDESEL 0x00000100 -#define ECO_READONLY 0x00000800 -#define ECO_WANTRETURN 0x00001000 -#define ECO_SAVESEL 0x00008000 -#define ECO_SELECTIONBAR 0x01000000 -#define ECO_VERTICAL 0x00400000 // FE specific - - -// ECO operations -#define ECOOP_SET 0x0001 -#define ECOOP_OR 0x0002 -#define ECOOP_AND 0x0003 -#define ECOOP_XOR 0x0004 - -// New word break function actions -#define WB_CLASSIFY 3 -#define WB_MOVEWORDLEFT 4 -#define WB_MOVEWORDRIGHT 5 -#define WB_LEFTBREAK 6 -#define WB_RIGHTBREAK 7 - -// East Asia specific flags -#define WB_MOVEWORDPREV 4 -#define WB_MOVEWORDNEXT 5 -#define WB_PREVBREAK 6 -#define WB_NEXTBREAK 7 - -#define PC_FOLLOWING 1 -#define PC_LEADING 2 -#define PC_OVERFLOW 3 -#define PC_DELIMITER 4 -#define WBF_WORDWRAP 0x010 -#define WBF_WORDBREAK 0x020 -#define WBF_OVERFLOW 0x040 -#define WBF_LEVEL1 0x080 -#define WBF_LEVEL2 0x100 -#define WBF_CUSTOM 0x200 - -// East Asia specific flags -#define IMF_FORCENONE 0x0001 -#define IMF_FORCEENABLE 0x0002 -#define IMF_FORCEDISABLE 0x0004 -#define IMF_CLOSESTATUSWINDOW 0x0008 -#define IMF_VERTICAL 0x0020 -#define IMF_FORCEACTIVE 0x0040 -#define IMF_FORCEINACTIVE 0x0080 -#define IMF_FORCEREMEMBER 0x0100 -#define IMF_MULTIPLEEDIT 0x0400 - -// Word break flags (used with WB_CLASSIFY) -#define WBF_CLASS ((BYTE) 0x0F) -#define WBF_ISWHITE ((BYTE) 0x10) -#define WBF_BREAKLINE ((BYTE) 0x20) -#define WBF_BREAKAFTER ((BYTE) 0x40) - - -// Data types - -#ifdef _WIN32 -// Extended edit word break proc (character set aware) -typedef LONG (*EDITWORDBREAKPROCEX)(char *pchText, LONG cchText, BYTE bCharSet, INT action); -#endif - -// All character format measurements are in twips -typedef struct _charformat -{ - UINT cbSize; - DWORD dwMask; - DWORD dwEffects; - LONG yHeight; - LONG yOffset; - COLORREF crTextColor; - BYTE bCharSet; - BYTE bPitchAndFamily; - char szFaceName[LF_FACESIZE]; -} CHARFORMATA; - -typedef struct _charformatw -{ - UINT cbSize; - DWORD dwMask; - DWORD dwEffects; - LONG yHeight; - LONG yOffset; - COLORREF crTextColor; - BYTE bCharSet; - BYTE bPitchAndFamily; - WCHAR szFaceName[LF_FACESIZE]; -} CHARFORMATW; - -#if (_RICHEDIT_VER >= 0x0200) -#ifdef UNICODE -#define CHARFORMAT CHARFORMATW -#else -#define CHARFORMAT CHARFORMATA -#endif // UNICODE -#else -#define CHARFORMAT CHARFORMATA -#endif // _RICHEDIT_VER >= 0x0200 - -// CHARFORMAT2 structure - -#ifdef __cplusplus - -struct CHARFORMAT2W : _charformatw -{ - WORD wWeight; // Font weight (LOGFONT value) - SHORT sSpacing; // Amount to space between letters - COLORREF crBackColor; // Background color - LCID lcid; // Locale ID - DWORD dwReserved; // Reserved. Must be 0 - SHORT sStyle; // Style handle - WORD wKerning; // Twip size above which to kern char pair - BYTE bUnderlineType; // Underline type - BYTE bAnimation; // Animated text like marching ants - BYTE bRevAuthor; // Revision author index -}; - -struct CHARFORMAT2A : _charformat -{ - WORD wWeight; // Font weight (LOGFONT value) - SHORT sSpacing; // Amount to space between letters - COLORREF crBackColor; // Background color - LCID lcid; // Locale ID - DWORD dwReserved; // Reserved. Must be 0 - SHORT sStyle; // Style handle - WORD wKerning; // Twip size above which to kern char pair - BYTE bUnderlineType; // Underline type - BYTE bAnimation; // Animated text like marching ants - BYTE bRevAuthor; // Revision author index -}; - -#else // regular C-style - -typedef struct _charformat2w -{ - UINT cbSize; - DWORD dwMask; - DWORD dwEffects; - LONG yHeight; - LONG yOffset; // > 0 for superscript, < 0 for subscript - COLORREF crTextColor; - BYTE bCharSet; - BYTE bPitchAndFamily; - WCHAR szFaceName[LF_FACESIZE]; - WORD wWeight; // Font weight (LOGFONT value) - SHORT sSpacing; // Amount to space between letters - COLORREF crBackColor; // Background color - LCID lcid; // Locale ID - DWORD dwReserved; // Reserved. Must be 0 - SHORT sStyle; // Style handle - WORD wKerning; // Twip size above which to kern char pair - BYTE bUnderlineType; // Underline type - BYTE bAnimation; // Animated text like marching ants - BYTE bRevAuthor; // Revision author index - BYTE bReserved1; -} CHARFORMAT2W; - -typedef struct _charformat2a -{ - UINT cbSize; - DWORD dwMask; - DWORD dwEffects; - LONG yHeight; - LONG yOffset; // > 0 for superscript, < 0 for subscript - COLORREF crTextColor; - BYTE bCharSet; - BYTE bPitchAndFamily; - char szFaceName[LF_FACESIZE]; - WORD wWeight; // Font weight (LOGFONT value) - SHORT sSpacing; // Amount to space between letters - COLORREF crBackColor; // Background color - LCID lcid; // Locale ID - DWORD dwReserved; // Reserved. Must be 0 - SHORT sStyle; // Style handle - WORD wKerning; // Twip size above which to kern char pair - BYTE bUnderlineType; // Underline type - BYTE bAnimation; // Animated text like marching ants - BYTE bRevAuthor; // Revision author index -} CHARFORMAT2A; - -#endif // C++ - -#ifdef UNICODE -#define CHARFORMAT2 CHARFORMAT2W -#else -#define CHARFORMAT2 CHARFORMAT2A -#endif - -#define CHARFORMATDELTA (sizeof(CHARFORMAT2) - sizeof(CHARFORMAT)) - - -// CFM_COLOR mirrors CFE_AUTOCOLOR, a little hack to easily deal with autocolor - -// CHARFORMAT masks -#define CFM_BOLD 0x00000001 -#define CFM_ITALIC 0x00000002 -#define CFM_UNDERLINE 0x00000004 -#define CFM_STRIKEOUT 0x00000008 -#define CFM_PROTECTED 0x00000010 -#define CFM_LINK 0x00000020 // Exchange hyperlink extension -#define CFM_SIZE 0x80000000 -#define CFM_COLOR 0x40000000 -#define CFM_FACE 0x20000000 -#define CFM_OFFSET 0x10000000 -#define CFM_CHARSET 0x08000000 - -// CHARFORMAT effects -#define CFE_BOLD 0x0001 -#define CFE_ITALIC 0x0002 -#define CFE_UNDERLINE 0x0004 -#define CFE_STRIKEOUT 0x0008 -#define CFE_PROTECTED 0x0010 -#define CFE_LINK 0x0020 -#define CFE_AUTOCOLOR 0x40000000 // NOTE: this corresponds to - // CFM_COLOR, which controls it -// Masks and effects defined for CHARFORMAT2 -- an (*) indicates -// that the data is stored by RichEdit 2.0/3.0, but not displayed -#define CFM_SMALLCAPS 0x0040 // (*) -#define CFM_ALLCAPS 0x0080 // Displayed by 3.0 -#define CFM_HIDDEN 0x0100 // Hidden by 3.0 -#define CFM_OUTLINE 0x0200 // (*) -#define CFM_SHADOW 0x0400 // (*) -#define CFM_EMBOSS 0x0800 // (*) -#define CFM_IMPRINT 0x1000 // (*) -#define CFM_DISABLED 0x2000 -#define CFM_REVISED 0x4000 - -#define CFM_BACKCOLOR 0x04000000 -#define CFM_LCID 0x02000000 -#define CFM_UNDERLINETYPE 0x00800000 // Many displayed by 3.0 -#define CFM_WEIGHT 0x00400000 -#define CFM_SPACING 0x00200000 // Displayed by 3.0 -#define CFM_KERNING 0x00100000 // (*) -#define CFM_STYLE 0x00080000 // (*) -#define CFM_ANIMATION 0x00040000 // (*) -#define CFM_REVAUTHOR 0x00008000 - -#define CFE_SUBSCRIPT 0x00010000 // Superscript and subscript are -#define CFE_SUPERSCRIPT 0x00020000 // mutually exclusive - -#define CFM_SUBSCRIPT (CFE_SUBSCRIPT | CFE_SUPERSCRIPT) -#define CFM_SUPERSCRIPT CFM_SUBSCRIPT - -// CHARFORMAT "ALL" masks -#define CFM_EFFECTS (CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | \ - CFM_STRIKEOUT | CFE_PROTECTED | CFM_LINK) -#define CFM_ALL (CFM_EFFECTS | CFM_SIZE | CFM_FACE | CFM_OFFSET | CFM_CHARSET) - -#define CFM_EFFECTS2 (CFM_EFFECTS | CFM_DISABLED | CFM_SMALLCAPS | CFM_ALLCAPS \ - | CFM_HIDDEN | CFM_OUTLINE | CFM_SHADOW | CFM_EMBOSS \ - | CFM_IMPRINT | CFM_DISABLED | CFM_REVISED \ - | CFM_SUBSCRIPT | CFM_SUPERSCRIPT | CFM_BACKCOLOR) - -#define CFM_ALL2 (CFM_ALL | CFM_EFFECTS2 | CFM_BACKCOLOR | CFM_LCID \ - | CFM_UNDERLINETYPE | CFM_WEIGHT | CFM_REVAUTHOR \ - | CFM_SPACING | CFM_KERNING | CFM_STYLE | CFM_ANIMATION) - -#define CFE_SMALLCAPS CFM_SMALLCAPS -#define CFE_ALLCAPS CFM_ALLCAPS -#define CFE_HIDDEN CFM_HIDDEN -#define CFE_OUTLINE CFM_OUTLINE -#define CFE_SHADOW CFM_SHADOW -#define CFE_EMBOSS CFM_EMBOSS -#define CFE_IMPRINT CFM_IMPRINT -#define CFE_DISABLED CFM_DISABLED -#define CFE_REVISED CFM_REVISED - -// CFE_AUTOCOLOR and CFE_AUTOBACKCOLOR correspond to CFM_COLOR and -// CFM_BACKCOLOR, respectively, which control them -#define CFE_AUTOBACKCOLOR CFM_BACKCOLOR - -// Underline types. RE 1.0 displays only CFU_UNDERLINE -#define CFU_CF1UNDERLINE 0xFF // Map charformat's bit underline to CF2 -#define CFU_INVERT 0xFE // For IME composition fake a selection -#define CFU_UNDERLINETHICKLONGDASH 18 // (*) display as dash -#define CFU_UNDERLINETHICKDOTTED 17 // (*) display as dot -#define CFU_UNDERLINETHICKDASHDOTDOT 16 // (*) display as dash dot dot -#define CFU_UNDERLINETHICKDASHDOT 15 // (*) display as dash dot -#define CFU_UNDERLINETHICKDASH 14 // (*) display as dash -#define CFU_UNDERLINELONGDASH 13 // (*) display as dash -#define CFU_UNDERLINEHEAVYWAVE 12 // (*) display as wave -#define CFU_UNDERLINEDOUBLEWAVE 11 // (*) display as wave -#define CFU_UNDERLINEHAIRLINE 10 // (*) display as single -#define CFU_UNDERLINETHICK 9 -#define CFU_UNDERLINEWAVE 8 -#define CFU_UNDERLINEDASHDOTDOT 7 -#define CFU_UNDERLINEDASHDOT 6 -#define CFU_UNDERLINEDASH 5 -#define CFU_UNDERLINEDOTTED 4 -#define CFU_UNDERLINEDOUBLE 3 // (*) display as single -#define CFU_UNDERLINEWORD 2 // (*) display as single -#define CFU_UNDERLINE 1 -#define CFU_UNDERLINENONE 0 - -#define yHeightCharPtsMost 1638 - -// EM_SETCHARFORMAT wParam masks -#define SCF_SELECTION 0x0001 -#define SCF_WORD 0x0002 -#define SCF_DEFAULT 0x0000 // Set default charformat or paraformat -#define SCF_ALL 0x0004 // Not valid with SCF_SELECTION or SCF_WORD -#define SCF_USEUIRULES 0x0008 // Modifier for SCF_SELECTION; says that - // format came from a toolbar, etc., and - // hence UI formatting rules should be - // used instead of literal formatting -#define SCF_ASSOCIATEFONT 0x0010 // Associate fontname with bCharSet (one - // possible for each of Western, ME, FE, - // Thai) -#define SCF_NOKBUPDATE 0x0020 // Do not update KB layput for this change - // even if autokeyboard is on -#define SCF_ASSOCIATEFONT2 0x0040 // Associate plane-2 (surrogate) font - -typedef struct _charrange -{ - LONG cpMin; - LONG cpMax; -} CHARRANGE; - -typedef struct _textrange -{ - CHARRANGE chrg; - LPSTR lpstrText; // Allocated by caller, zero terminated by RichEdit -} TEXTRANGEA; - -typedef struct _textrangew -{ - CHARRANGE chrg; - LPWSTR lpstrText; // Allocated by caller, zero terminated by RichEdit -} TEXTRANGEW; - -#if (_RICHEDIT_VER >= 0x0200) -#ifdef UNICODE -#define TEXTRANGE TEXTRANGEW -#else -#define TEXTRANGE TEXTRANGEA -#endif // UNICODE -#else -#define TEXTRANGE TEXTRANGEA -#endif // _RICHEDIT_VER >= 0x0200 - -typedef DWORD (CALLBACK *EDITSTREAMCALLBACK)(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb); - -typedef struct _editstream -{ - DWORD_PTR dwCookie; // User value passed to callback as first parameter - DWORD dwError; // Last error - EDITSTREAMCALLBACK pfnCallback; -} EDITSTREAM; - -// Stream formats. Flags are all in low word, since high word -// gives possible codepage choice. -#define SF_TEXT 0x0001 -#define SF_RTF 0x0002 -#define SF_RTFNOOBJS 0x0003 // Write only -#define SF_TEXTIZED 0x0004 // Write only - -#define SF_UNICODE 0x0010 // Unicode file (UCS2 little endian) -#define SF_USECODEPAGE 0x0020 // CodePage given by high word -#define SF_NCRFORNONASCII 0x40 // Output /uN for nonASCII -#define SFF_WRITEXTRAPAR 0x80 // Output \par at end - -// Flag telling stream operations to operate on selection only -// EM_STREAMIN replaces current selection -// EM_STREAMOUT streams out current selection -#define SFF_SELECTION 0x8000 - -// Flag telling stream operations to ignore some FE control words -// having to do with FE word breaking and horiz vs vertical text. -// Not used in RichEdit 2.0 and later -#define SFF_PLAINRTF 0x4000 - -// Flag telling file stream output (SFF_SELECTION flag not set) to persist -// \viewscaleN control word. -#define SFF_PERSISTVIEWSCALE 0x2000 - -// Flag telling file stream input with SFF_SELECTION flag not set not to -// close the document -#define SFF_KEEPDOCINFO 0x1000 - -// Flag telling stream operations to output in Pocket Word format -#define SFF_PWD 0x0800 - -// 3-bit field specifying the value of N - 1 to use for \rtfN or \pwdN -#define SF_RTFVAL 0x0700 - -typedef struct _findtext -{ - CHARRANGE chrg; - LPCSTR lpstrText; -} FINDTEXTA; - -typedef struct _findtextw -{ - CHARRANGE chrg; - LPCWSTR lpstrText; -} FINDTEXTW; - -#if (_RICHEDIT_VER >= 0x0200) -#ifdef UNICODE -#define FINDTEXT FINDTEXTW -#else -#define FINDTEXT FINDTEXTA -#endif // UNICODE -#else -#define FINDTEXT FINDTEXTA -#endif // _RICHEDIT_VER >= 0x0200 - -typedef struct _findtextexa -{ - CHARRANGE chrg; - LPCSTR lpstrText; - CHARRANGE chrgText; -} FINDTEXTEXA; - -typedef struct _findtextexw -{ - CHARRANGE chrg; - LPCWSTR lpstrText; - CHARRANGE chrgText; -} FINDTEXTEXW; - -#if (_RICHEDIT_VER >= 0x0200) -#ifdef UNICODE -#define FINDTEXTEX FINDTEXTEXW -#else -#define FINDTEXTEX FINDTEXTEXA -#endif // UNICODE -#else -#define FINDTEXTEX FINDTEXTEXA -#endif // _RICHEDIT_VER >= 0x0200 - - -typedef struct _formatrange -{ - HDC hdc; - HDC hdcTarget; - RECT rc; - RECT rcPage; - CHARRANGE chrg; -} FORMATRANGE; - -// All paragraph measurements are in twips - -#define MAX_TAB_STOPS 32 -#define lDefaultTab 720 -#define MAX_TABLE_CELLS 63 - -typedef struct _paraformat -{ - UINT cbSize; - DWORD dwMask; - WORD wNumbering; - WORD wEffects; - LONG dxStartIndent; - LONG dxRightIndent; - LONG dxOffset; - WORD wAlignment; - SHORT cTabCount; - LONG rgxTabs[MAX_TAB_STOPS]; -} PARAFORMAT; - -#ifdef __cplusplus -struct PARAFORMAT2 : _paraformat -{ - LONG dySpaceBefore; // Vertical spacing before para - LONG dySpaceAfter; // Vertical spacing after para - LONG dyLineSpacing; // Line spacing depending on Rule - SHORT sStyle; // Style handle - BYTE bLineSpacingRule; // Rule for line spacing (see tom.doc) - BYTE bOutlineLevel; // Outline level - WORD wShadingWeight; // Shading in hundredths of a per cent - WORD wShadingStyle; // Nibble 0: style, 1: cfpat, 2: cbpat - WORD wNumberingStart; // Starting value for numbering - WORD wNumberingStyle; // Alignment, roman/arabic, (), ), ., etc. - WORD wNumberingTab; // Space bet FirstIndent & 1st-line text - WORD wBorderSpace; // Border-text spaces (nbl/bdr in pts) - WORD wBorderWidth; // Pen widths (nbl/bdr in half pts) - WORD wBorders; // Border styles (nibble/border) -}; - -#else // Regular C-style - -typedef struct _paraformat2 -{ - UINT cbSize; - DWORD dwMask; - WORD wNumbering; - WORD wReserved; - LONG dxStartIndent; - LONG dxRightIndent; - LONG dxOffset; - WORD wAlignment; - SHORT cTabCount; - LONG rgxTabs[MAX_TAB_STOPS]; - LONG dySpaceBefore; // Vertical spacing before para - LONG dySpaceAfter; // Vertical spacing after para - LONG dyLineSpacing; // Line spacing depending on Rule - SHORT sStyle; // Style handle - BYTE bLineSpacingRule; // Rule for line spacing (see tom.doc) - BYTE bOutlineLevel; // Outline Level - WORD wShadingWeight; // Shading in hundredths of a per cent - WORD wShadingStyle; // Byte 0: style, nib 2: cfpat, 3: cbpat - WORD wNumberingStart; // Starting value for numbering - WORD wNumberingStyle; // Alignment, Roman/Arabic, (), ), ., etc. - WORD wNumberingTab; // Space bet 1st indent and 1st-line text - WORD wBorderSpace; // Border-text spaces (nbl/bdr in pts) - WORD wBorderWidth; // Pen widths (nbl/bdr in half twips) - WORD wBorders; // Border styles (nibble/border) -} PARAFORMAT2; - -#endif // C++ - - -// PARAFORMAT mask values -#define PFM_STARTINDENT 0x00000001 -#define PFM_RIGHTINDENT 0x00000002 -#define PFM_OFFSET 0x00000004 -#define PFM_ALIGNMENT 0x00000008 -#define PFM_TABSTOPS 0x00000010 -#define PFM_NUMBERING 0x00000020 -#define PFM_OFFSETINDENT 0x80000000 - -// PARAFORMAT 2.0 masks and effects -#define PFM_SPACEBEFORE 0x00000040 -#define PFM_SPACEAFTER 0x00000080 -#define PFM_LINESPACING 0x00000100 -#define PFM_STYLE 0x00000400 -#define PFM_BORDER 0x00000800 // (*) -#define PFM_SHADING 0x00001000 // (*) -#define PFM_NUMBERINGSTYLE 0x00002000 // RE 3.0 -#define PFM_NUMBERINGTAB 0x00004000 // RE 3.0 -#define PFM_NUMBERINGSTART 0x00008000 // RE 3.0 - -#define PFM_RTLPARA 0x00010000 -#define PFM_KEEP 0x00020000 // (*) -#define PFM_KEEPNEXT 0x00040000 // (*) -#define PFM_PAGEBREAKBEFORE 0x00080000 // (*) -#define PFM_NOLINENUMBER 0x00100000 // (*) -#define PFM_NOWIDOWCONTROL 0x00200000 // (*) -#define PFM_DONOTHYPHEN 0x00400000 // (*) -#define PFM_SIDEBYSIDE 0x00800000 // (*) -#define PFM_TABLE 0x40000000 // RE 3.0 -#define PFM_TEXTWRAPPINGBREAK 0x20000000 // RE 3.0 -#define PFM_TABLEROWDELIMITER 0x10000000 // RE 4.0 - -// The following three properties are read only -#define PFM_COLLAPSED 0x01000000 // RE 3.0 -#define PFM_OUTLINELEVEL 0x02000000 // RE 3.0 -#define PFM_BOX 0x04000000 // RE 3.0 -#define PFM_RESERVED2 0x08000000 // RE 4.0 - - -// PARAFORMAT "ALL" masks -#define PFM_ALL (PFM_STARTINDENT | PFM_RIGHTINDENT | PFM_OFFSET | \ - PFM_ALIGNMENT | PFM_TABSTOPS | PFM_NUMBERING | \ - PFM_OFFSETINDENT| PFM_RTLPARA) - -// Note: PARAFORMAT has no effects (BiDi RichEdit 1.0 does have PFE_RTLPARA) -#define PFM_EFFECTS (PFM_RTLPARA | PFM_KEEP | PFM_KEEPNEXT | PFM_TABLE \ - | PFM_PAGEBREAKBEFORE | PFM_NOLINENUMBER \ - | PFM_NOWIDOWCONTROL | PFM_DONOTHYPHEN | PFM_SIDEBYSIDE \ - | PFM_TABLE | PFM_TABLEROWDELIMITER) - -#define PFM_ALL2 (PFM_ALL | PFM_EFFECTS | PFM_SPACEBEFORE | PFM_SPACEAFTER \ - | PFM_LINESPACING | PFM_STYLE | PFM_SHADING | PFM_BORDER \ - | PFM_NUMBERINGTAB | PFM_NUMBERINGSTART | PFM_NUMBERINGSTYLE) - -#define PFE_RTLPARA (PFM_RTLPARA >> 16) -#define PFE_KEEP (PFM_KEEP >> 16) // (*) -#define PFE_KEEPNEXT (PFM_KEEPNEXT >> 16) // (*) -#define PFE_PAGEBREAKBEFORE (PFM_PAGEBREAKBEFORE >> 16) // (*) -#define PFE_NOLINENUMBER (PFM_NOLINENUMBER >> 16) // (*) -#define PFE_NOWIDOWCONTROL (PFM_NOWIDOWCONTROL >> 16) // (*) -#define PFE_DONOTHYPHEN (PFM_DONOTHYPHEN >> 16) // (*) -#define PFE_SIDEBYSIDE (PFM_SIDEBYSIDE >> 16) // (*) -#define PFE_TEXTWRAPPINGBREAK (PFM_TEXTWRAPPINGBREAK>>16) // (*) - -// The following four effects are read only -#define PFE_COLLAPSED (PFM_COLLAPSED >> 16) // (+) -#define PFE_BOX (PFM_BOX >> 16) // (+) -#define PFE_TABLE (PFM_TABLE >> 16) // Inside table row. RE 3.0 -#define PFE_TABLEROWDELIMITER (PFM_TABLEROWDELIMITER>>16) // Table row start. RE 4.0 - -// PARAFORMAT numbering options -#define PFN_BULLET 1 // tomListBullet - -// PARAFORMAT2 wNumbering options -#define PFN_ARABIC 2 // tomListNumberAsArabic: 0, 1, 2, ... -#define PFN_LCLETTER 3 // tomListNumberAsLCLetter: a, b, c, ... -#define PFN_UCLETTER 4 // tomListNumberAsUCLetter: A, B, C, ... -#define PFN_LCROMAN 5 // tomListNumberAsLCRoman: i, ii, iii, ... -#define PFN_UCROMAN 6 // tomListNumberAsUCRoman: I, II, III, ... - -// PARAFORMAT2 wNumberingStyle options -#define PFNS_PAREN 0x000 // default, e.g., 1) -#define PFNS_PARENS 0x100 // tomListParentheses/256, e.g., (1) -#define PFNS_PERIOD 0x200 // tomListPeriod/256, e.g., 1. -#define PFNS_PLAIN 0x300 // tomListPlain/256, e.g., 1 -#define PFNS_NONUMBER 0x400 // Used for continuation w/o number - -#define PFNS_NEWNUMBER 0x8000 // Start new number with wNumberingStart - // (can be combined with other PFNS_xxx) -// PARAFORMAT alignment options -#define PFA_LEFT 1 -#define PFA_RIGHT 2 -#define PFA_CENTER 3 - -// PARAFORMAT2 alignment options -#define PFA_JUSTIFY 4 // New paragraph-alignment option 2.0 (*) -#define PFA_FULL_INTERWORD 4 // These are supported in 3.0 with advanced -#define PFA_FULL_INTERLETTER 5 // typography enabled -#define PFA_FULL_SCALED 6 -#define PFA_FULL_GLYPHS 7 -#define PFA_SNAP_GRID 8 - - -// Notification structures -#ifndef WM_NOTIFY -#define WM_NOTIFY 0x004E - -typedef struct _nmhdr -{ - HWND hwndFrom; - UINT idFrom; - UINT code; -} NMHDR; -#endif // !WM_NOTIFY - -typedef struct _msgfilter -{ - NMHDR nmhdr; - UINT msg; - WPARAM wParam; - LPARAM lParam; -} MSGFILTER; - -typedef struct _reqresize -{ - NMHDR nmhdr; - RECT rc; -} REQRESIZE; - -typedef struct _selchange -{ - NMHDR nmhdr; - CHARRANGE chrg; - WORD seltyp; -} SELCHANGE; - - -#define SEL_EMPTY 0x0000 -#define SEL_TEXT 0x0001 -#define SEL_OBJECT 0x0002 -#define SEL_MULTICHAR 0x0004 -#define SEL_MULTIOBJECT 0x0008 - -// Used with IRichEditOleCallback::GetContextMenu, this flag will be -// passed as a "selection type". It indicates that a context menu for -// a right-mouse drag drop should be generated. The IOleObject parameter -// will really be the IDataObject for the drop -#define GCM_RIGHTMOUSEDROP 0x8000 - -typedef struct _endropfiles -{ - NMHDR nmhdr; - HANDLE hDrop; - LONG cp; - BOOL fProtected; -} ENDROPFILES; - -typedef struct _enprotected -{ - NMHDR nmhdr; - UINT msg; - WPARAM wParam; - LPARAM lParam; - CHARRANGE chrg; -} ENPROTECTED; - -typedef struct _ensaveclipboard -{ - NMHDR nmhdr; - LONG cObjectCount; - LONG cch; -} ENSAVECLIPBOARD; - -#ifndef MACPORT -typedef struct _enoleopfailed -{ - NMHDR nmhdr; - LONG iob; - LONG lOper; - HRESULT hr; -} ENOLEOPFAILED; -#endif - -#define OLEOP_DOVERB 1 - -typedef struct _objectpositions -{ - NMHDR nmhdr; - LONG cObjectCount; - LONG *pcpPositions; -} OBJECTPOSITIONS; - -typedef struct _enlink -{ - NMHDR nmhdr; - UINT msg; - WPARAM wParam; - LPARAM lParam; - CHARRANGE chrg; -} ENLINK; - -typedef struct _enlowfirtf -{ - NMHDR nmhdr; - char *szControl; -} ENLOWFIRTF; - -// PenWin specific -typedef struct _encorrecttext -{ - NMHDR nmhdr; - CHARRANGE chrg; - WORD seltyp; -} ENCORRECTTEXT; - -// East Asia specific -typedef struct _punctuation -{ - UINT iSize; - LPSTR szPunctuation; -} PUNCTUATION; - -// East Asia specific -typedef struct _compcolor -{ - COLORREF crText; - COLORREF crBackground; - DWORD dwEffects; -}COMPCOLOR; - - -// Clipboard formats - use as parameter to RegisterClipboardFormat() -#define CF_RTF TEXT("Rich Text Format") -#define CF_RTFNOOBJS TEXT("Rich Text Format Without Objects") -#define CF_RETEXTOBJ TEXT("RichEdit Text and Objects") - -// Paste Special -typedef struct _repastespecial -{ - DWORD dwAspect; - DWORD_PTR dwParam; -} REPASTESPECIAL; - -// UndoName info -typedef enum _undonameid -{ - UID_UNKNOWN = 0, - UID_TYPING = 1, - UID_DELETE = 2, - UID_DRAGDROP = 3, - UID_CUT = 4, - UID_PASTE = 5, - UID_AUTOCORRECT = 6 -} UNDONAMEID; - -// Flags for the SETEXTEX data structure -#define ST_DEFAULT 0 -#define ST_KEEPUNDO 1 -#define ST_SELECTION 2 -#define ST_NEWCHARS 4 - -// EM_SETTEXTEX info; this struct is passed in the wparam of the message -typedef struct _settextex -{ - DWORD flags; // Flags (see the ST_XXX defines) - UINT codepage; // Code page for translation (CP_ACP for sys default, - // 1200 for Unicode, -1 for control default) -} SETTEXTEX; - -// Flags for the GETEXTEX data structure -#define GT_DEFAULT 0 -#define GT_USECRLF 1 -#define GT_SELECTION 2 -#define GT_RAWTEXT 4 -#define GT_NOHIDDENTEXT 8 - -// EM_GETTEXTEX info; this struct is passed in the wparam of the message -typedef struct _gettextex -{ - DWORD cb; // Count of bytes in the string - DWORD flags; // Flags (see the GT_XXX defines - UINT codepage; // Code page for translation (CP_ACP for sys default, - // 1200 for Unicode, -1 for control default) - LPCSTR lpDefaultChar; // Replacement for unmappable chars - LPBOOL lpUsedDefChar; // Pointer to flag set when def char used -} GETTEXTEX; - -// Flags for the GETTEXTLENGTHEX data structure -#define GTL_DEFAULT 0 // Do default (return # of chars) -#define GTL_USECRLF 1 // Compute answer using CRLFs for paragraphs -#define GTL_PRECISE 2 // Compute a precise answer -#define GTL_CLOSE 4 // Fast computation of a "close" answer -#define GTL_NUMCHARS 8 // Return number of characters -#define GTL_NUMBYTES 16 // Return number of _bytes_ - -// EM_GETTEXTLENGTHEX info; this struct is passed in the wparam of the msg -typedef struct _gettextlengthex -{ - DWORD flags; // Flags (see GTL_XXX defines) - UINT codepage; // Code page for translation (CP_ACP for default, - // 1200 for Unicode) -} GETTEXTLENGTHEX; - -// BiDi specific features -typedef struct _bidioptions -{ - UINT cbSize; - WORD wMask; - WORD wEffects; -} BIDIOPTIONS; - -// BIDIOPTIONS masks -#if (_RICHEDIT_VER == 0x0100) -#define BOM_DEFPARADIR 0x0001 // Default paragraph direction (implies alignment) (obsolete) -#define BOM_PLAINTEXT 0x0002 // Use plain text layout (obsolete) -#endif // _RICHEDIT_VER == 0x0100 -#define BOM_NEUTRALOVERRIDE 0x0004 // Override neutral layout (obsolete) -#define BOM_CONTEXTREADING 0x0008 // Context reading order -#define BOM_CONTEXTALIGNMENT 0x0010 // Context alignment -#define BOM_LEGACYBIDICLASS 0x0040 // Legacy Bidi classification - -// BIDIOPTIONS effects -#if (_RICHEDIT_VER == 0x0100) -#define BOE_RTLDIR 0x0001 // Default paragraph direction (implies alignment) (obsolete) -#define BOE_PLAINTEXT 0x0002 // Use plain text layout (obsolete) -#endif // _RICHEDIT_VER == 0x0100 -#define BOE_NEUTRALOVERRIDE 0x0004 // Override neutral layout (obsolete) -#define BOE_CONTEXTREADING 0x0008 // Context reading order -#define BOE_CONTEXTALIGNMENT 0x0010 // Context alignment -#define BOE_LEGACYBIDICLASS 0x0040 // Legacy Bidi classification - -// Additional EM_FINDTEXT[EX] flags -#define FR_MATCHDIAC 0x20000000 -#define FR_MATCHKASHIDA 0x40000000 -#define FR_MATCHALEFHAMZA 0x80000000 - -// UNICODE embedding character -#ifndef WCH_EMBEDDING -#define WCH_EMBEDDING (WCHAR)0xFFFC -#endif // WCH_EMBEDDING - -// khyph - Kind of hyphenation -typedef enum tagKHYPH -{ - khyphNil, // No Hyphenation - khyphNormal, // Normal Hyphenation - khyphAddBefore, // Add letter before hyphen - khyphChangeBefore, // Change letter before hyphen - khyphDeleteBefore, // Delete letter before hyphen - khyphChangeAfter, // Change letter after hyphen - khyphDelAndChange // Delete letter before hyphen and change - // letter preceding hyphen -} KHYPH; - -typedef struct hyphresult -{ - KHYPH khyph; // Kind of hyphenation - long ichHyph; // Character which was hyphenated - WCHAR chHyph; // Depending on hyphenation type, character added, changed, etc. -} HYPHRESULT; - -void WINAPI HyphenateProc(__in WCHAR *pszWord, LANGID langid, long ichExceed, HYPHRESULT *phyphresult); -typedef struct tagHyphenateInfo -{ - SHORT cbSize; // Size of HYPHENATEINFO structure - SHORT dxHyphenateZone; // If a space character is closer to the margin - // than this value, don't hyphenate (in TWIPs) - void (WINAPI* pfnHyphenate)(WCHAR*, LANGID, long, HYPHRESULT*); -} HYPHENATEINFO; - -#ifdef _WIN32 -#include -#elif !defined(RC_INVOKED) -#pragma pack() -#endif - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // !_RICHEDIT_ - diff --git a/pub/ddk/richole.h b/pub/ddk/richole.h deleted file mode 100644 index 9301e14..0000000 --- a/pub/ddk/richole.h +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef _RICHOLE_ -#define _RICHOLE_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -/* - * RICHOLE.H - * - * Purpose: - * OLE Extensions to the Rich Text Editor - * - * Copyright (c) 1985-1999, Microsoft Corporation - */ - -// Structure passed to GetObject and InsertObject -typedef struct _reobject -{ - DWORD cbStruct; // Size of structure - LONG cp; // Character position of object - CLSID clsid; // Class ID of object - LPOLEOBJECT poleobj; // OLE object interface - LPSTORAGE pstg; // Associated storage interface - LPOLECLIENTSITE polesite; // Associated client site interface - SIZEL sizel; // Size of object (may be 0,0) - DWORD dvaspect; // Display aspect to use - DWORD dwFlags; // Object status flags - DWORD dwUser; // Dword for user's use -} REOBJECT; - -// Flags to specify which interfaces should be returned in the structure above -#define REO_GETOBJ_NO_INTERFACES (0x00000000L) -#define REO_GETOBJ_POLEOBJ (0x00000001L) -#define REO_GETOBJ_PSTG (0x00000002L) -#define REO_GETOBJ_POLESITE (0x00000004L) -#define REO_GETOBJ_ALL_INTERFACES (0x00000007L) - -// Place object at selection -#define REO_CP_SELECTION ((ULONG) -1L) - -// Use character position to specify object instead of index -#define REO_IOB_SELECTION ((ULONG) -1L) -#define REO_IOB_USE_CP ((ULONG) -2L) - -// Object flags -#define REO_NULL (0x00000000L) // No flags -#define REO_READWRITEMASK (0x0000003FL) // Mask out RO bits -#define REO_DONTNEEDPALETTE (0x00000020L) // Object doesn't need palette -#define REO_BLANK (0x00000010L) // Object is blank -#define REO_DYNAMICSIZE (0x00000008L) // Object defines size always -#define REO_INVERTEDSELECT (0x00000004L) // Object drawn all inverted if sel -#define REO_BELOWBASELINE (0x00000002L) // Object sits below the baseline -#define REO_RESIZABLE (0x00000001L) // Object may be resized -#define REO_LINK (0x80000000L) // Object is a link (RO) -#define REO_STATIC (0x40000000L) // Object is static (RO) -#define REO_SELECTED (0x08000000L) // Object selected (RO) -#define REO_OPEN (0x04000000L) // Object open in its server (RO) -#define REO_INPLACEACTIVE (0x02000000L) // Object in place active (RO) -#define REO_HILITED (0x01000000L) // Object is to be hilited (RO) -#define REO_LINKAVAILABLE (0x00800000L) // Link believed available (RO) -#define REO_GETMETAFILE (0x00400000L) // Object requires metafile (RO) - -// flags for IRichEditOle::GetClipboardData(), -// IRichEditOleCallback::GetClipboardData() and -// IRichEditOleCallback::QueryAcceptData() -#define RECO_PASTE (0x00000000L) // paste from clipboard -#define RECO_DROP (0x00000001L) // drop -#define RECO_COPY (0x00000002L) // copy to the clipboard -#define RECO_CUT (0x00000003L) // cut to the clipboard -#define RECO_DRAG (0x00000004L) // drag - -/* - * IRichEditOle - * - * Purpose: - * Interface used by the client of RichEdit to perform OLE-related - * operations. - * - * //$ REVIEW: - * The methods herein may just want to be regular Windows messages. - */ -#undef INTERFACE -#define INTERFACE IRichEditOle - -DECLARE_INTERFACE_(IRichEditOle, IUnknown) -{ - // *** IUnknown methods *** - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * lplpObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - // *** IRichEditOle methods *** - STDMETHOD(GetClientSite) (THIS_ LPOLECLIENTSITE FAR * lplpolesite) PURE; - STDMETHOD_(LONG,GetObjectCount) (THIS) PURE; - STDMETHOD_(LONG,GetLinkCount) (THIS) PURE; - STDMETHOD(GetObject) (THIS_ LONG iob, REOBJECT FAR * lpreobject, - DWORD dwFlags) PURE; - STDMETHOD(InsertObject) (THIS_ REOBJECT FAR * lpreobject) PURE; - STDMETHOD(ConvertObject) (THIS_ LONG iob, REFCLSID rclsidNew, - LPCSTR lpstrUserTypeNew) PURE; - STDMETHOD(ActivateAs) (THIS_ REFCLSID rclsid, REFCLSID rclsidAs) PURE; - STDMETHOD(SetHostNames) (THIS_ LPCSTR lpstrContainerApp, - LPCSTR lpstrContainerObj) PURE; - STDMETHOD(SetLinkAvailable) (THIS_ LONG iob, BOOL fAvailable) PURE; - STDMETHOD(SetDvaspect) (THIS_ LONG iob, DWORD dvaspect) PURE; - STDMETHOD(HandsOffStorage) (THIS_ LONG iob) PURE; - STDMETHOD(SaveCompleted) (THIS_ LONG iob, LPSTORAGE lpstg) PURE; - STDMETHOD(InPlaceDeactivate) (THIS) PURE; - STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE; - STDMETHOD(GetClipboardData) (THIS_ CHARRANGE FAR * lpchrg, DWORD reco, - LPDATAOBJECT FAR * lplpdataobj) PURE; - STDMETHOD(ImportDataObject) (THIS_ LPDATAOBJECT lpdataobj, - CLIPFORMAT cf, HGLOBAL hMetaPict) PURE; -}; -typedef IRichEditOle FAR * LPRICHEDITOLE; - -/* - * IRichEditOleCallback - * - * Purpose: - * Interface used by the RichEdit to get OLE-related stuff from the - * application using RichEdit. - */ -#undef INTERFACE -#define INTERFACE IRichEditOleCallback - -DECLARE_INTERFACE_(IRichEditOleCallback, IUnknown) -{ - // *** IUnknown methods *** - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * lplpObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - // *** IRichEditOleCallback methods *** - STDMETHOD(GetNewStorage) (THIS_ LPSTORAGE FAR * lplpstg) PURE; - STDMETHOD(GetInPlaceContext) (THIS_ LPOLEINPLACEFRAME FAR * lplpFrame, - LPOLEINPLACEUIWINDOW FAR * lplpDoc, - LPOLEINPLACEFRAMEINFO lpFrameInfo) PURE; - STDMETHOD(ShowContainerUI) (THIS_ BOOL fShow) PURE; - STDMETHOD(QueryInsertObject) (THIS_ LPCLSID lpclsid, LPSTORAGE lpstg, - LONG cp) PURE; - STDMETHOD(DeleteObject) (THIS_ LPOLEOBJECT lpoleobj) PURE; - STDMETHOD(QueryAcceptData) (THIS_ LPDATAOBJECT lpdataobj, - CLIPFORMAT FAR * lpcfFormat, DWORD reco, - BOOL fReally, HGLOBAL hMetaPict) PURE; - STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE; - STDMETHOD(GetClipboardData) (THIS_ CHARRANGE FAR * lpchrg, DWORD reco, - LPDATAOBJECT FAR * lplpdataobj) PURE; - STDMETHOD(GetDragDropEffect) (THIS_ BOOL fDrag, DWORD grfKeyState, - LPDWORD pdwEffect) PURE; - STDMETHOD(GetContextMenu) (THIS_ WORD seltype, LPOLEOBJECT lpoleobj, - CHARRANGE FAR * lpchrg, - HMENU FAR * lphmenu) PURE; -}; -typedef IRichEditOleCallback FAR * LPRICHEDITOLECALLBACK; - -#ifndef MAC -// RichEdit interface GUIDs -DEFINE_GUID(IID_IRichEditOle, 0x00020D00, 0, 0, 0xC0,0,0,0,0,0,0,0x46); -DEFINE_GUID(IID_IRichEditOleCallback, 0x00020D03, 0, 0, 0xC0,0,0,0,0,0,0,0x46); -#endif // !MAC - -#endif // _RICHOLE_ - diff --git a/pub/ddk/ringtonedeviceservice.h b/pub/ddk/ringtonedeviceservice.h deleted file mode 100644 index 80f783d..0000000 --- a/pub/ddk/ringtonedeviceservice.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * RingtoneDeviceService.h - * - * Contains declarations for the Ringtone Device Service - * - * Copyright (c) Microsoft Corporation, All Rights Reserved. - * - */ - -#ifndef _RINGTONEDEVICESERVICE_H_ -#define _RINGTONEDEVICESERVICE_H_ - -#include -#include - - -/*****************************************************************************/ -/* Ringtone Service Info */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(SERVICE_Ringtones, - 0xd0eace0e, 0x707d, 0x4106, 0x8d, 0x38, 0x4f, 0x56, 0xe, 0x6a, 0x9f, 0x8e); - -#define NAME_RingtonesSvc L"Ringtones" -#define TYPE_RingtonesSvc DEVSVCTYPE_DEFAULT - - -/*****************************************************************************/ -/* Ringtone Service Properties */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(NAMESPACE_RingtonesSvc, - 0x7d05d925, 0x32e6, 0x4790, 0x92, 0x05, 0x54, 0x76, 0x4b, 0xb3, 0xcb, 0x74); - -/* PKEY_RingtonesSvc_DefaultRingtone - * - * Indicates the objectID of the default ringtone for incoming calls - * - * Type: UInt32 - * Form: ObjectID - */ - -DEFINE_DEVSVCPROPKEY(PKEY_RingtonesSvc_DefaultRingtone, - 0x7d05d925, 0x32e6, 0x4790, 0x92, 0x05, 0x54, 0x76, 0x4b, 0xb3, 0xcb, 0x74, - 2); - -#define NAME_RingtonesSvc_DefaultRingtone L"DefaultRingtone" - - -/*****************************************************************************/ -/* Ringtone Service Object Properties */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(NAMESPACE_RingtonesObj, - 0x8d943c78, 0x2c7d, 0x4c74, 0x94, 0x5a, 0x42, 0xd8, 0x3c, 0xb5, 0x8b, 0x5a); - -#endif /* _RINGTONEDEVICESERVICE_H_ */ - - - diff --git a/pub/ddk/rx.h b/pub/ddk/rx.h deleted file mode 100644 index e6a98a9..0000000 --- a/pub/ddk/rx.h +++ /dev/null @@ -1,107 +0,0 @@ -/*++ BUILD Version: 0009 // Increment this if a change has global effects -Copyright (c) 1987-1993 Microsoft Corporation - -Module Name: - - rx.h - -Abstract: - - This module is the overall h-file-wrapper for RDBSS. - -Revision History: -Notes: - - ---*/ - -#ifndef _RX_H_ -#define _RX_H_ - -#include "rxovride.h" // common compile environment -#include "ntifs.h" // NT file system driver include file. - -#ifdef RX_PRIVATE_BUILD - -// -// no one should be using these -// - -#ifdef IoGetTopLevelIrp -#error IoGetTopLevelIrp is deffed -#else -#define IoGetTopLevelIrp() IoxxxxxxGetTopLevelIrp() -#endif -#ifdef IoSetTopLevelIrp -#error IoSetTopLevelIrp is deffed -#else -#define IoSetTopLevelIrp(irp) IoxxxxxxSetTopLevelIrp(irp) -#endif -#endif // ifdef RX_PRIVATE_BUILD - - -// -// These macros sugarcoat flag manipulation just a bit -// - -#ifndef BooleanFlagOn -#define BooleanFlagOn(Flags,SingleFlag) ((BOOLEAN)((((Flags) & (SingleFlag)) != 0))) -#endif - -#ifndef SetFlag -#define SetFlag(Flags,SetOfFlags) { \ - (Flags) |= (SetOfFlags); \ -} -#endif - -#ifndef FlagOn - -// -// This macro returns TRUE if a flag in a set of flags is on and FALSE -// otherwise -// - -#define FlagOn(Flags,SingleFlag) ((Flags) & (SingleFlag)) -#endif - -#ifndef ClearFlag -#define ClearFlag(Flags,SetOfFlags) { \ - (Flags) &= ~(SetOfFlags); \ -} -#endif - -#define Add2Ptr(P,I) ((PVOID)((PUCHAR)(P) + (I))) - -// -// define INLINE to be the appropriate keyword for ANSI C -// - -#define INLINE __inline - -#include "rxtypes.h" - -#ifndef MINIRDR__NAME -#include "rxpooltg.h" // RX pool tag macros -#endif - -#include "ntrxdef.h" -#include "rxce.h" // RxCe functions -#include "rxcehdlr.h" // RxCe event handler specifications -#include "fcbtable.h" // FCB table data structures -#include "midatlax.h" // mid atlas structures -#include "mrxfcb.h" -#include "namcache.h" // structs and func defs for name cache routines -#include "rxworkq.h" -#include "rxprocs.h" -#include "rxexcept.h" - -#ifndef MINIRDR__NAME -#include "rxdata.h" -#include "buffring.h" -#endif - -#define MAKE_RESOURCE_OWNER(X) (((ERESOURCE_THREAD)(X)) | 0x3) -#define RESOURCE_OWNER_SET(X) (((X) & 0x3) == 0x3) - -#endif // #ifdef _RX_H_ - diff --git a/pub/ddk/rxce.h b/pub/ddk/rxce.h deleted file mode 100644 index c44086b..0000000 --- a/pub/ddk/rxce.h +++ /dev/null @@ -1,387 +0,0 @@ -/*++ BUILD Version: 0009 // Increment this if a change has global effects -Copyright (c) 1987-1993 Microsoft Corporation - -Module Name: - - rxce.h - -Abstract: - - This is the include file that defines all constants and types for - accessing the redirector file system connection engine. - -Revision History: -Notes: - - The Connection engine is designed to map and emulate the TDI specs. as closely - as possible. This implies that on NT we will have a very efficient mechanism - which fully exploits the underlying TDI implementation. - - There are four important data structures that are created/manipulated by the - various functions associated with the connection engine. Thesr are - RXCE_TRANSPORT,RXCE_ADDRESS,RXCE_CONNECTION and RXCE_VC. - - The mini redirector writers can embed these data structures in the corresponding - definitions and invoke the two routines provided for each type to build and - tear down the connection engine portions. These routines do not allocate/free - the memory associated with these instances. This provides a flexible mechanism - for the mini redirector writers to manage instances. - ---*/ - -#ifndef _RXCE_H_ -#define _RXCE_H_ - -#include -#include // TDI related definitions. -#include -// -// The connection engine deals with three kinds of entities, transports, transport -// addresses and transport connections. The transports are bindings to the various -// transport service providers on any system. The transport addresses are the -// local connection end points. The connections are transport connections between -// endpoints. Each connection encapsulates a number of virtual circuits -// ( typically 1 ). -// - -// All the four node types are tagged with the following signature which is used -// extensively in validating them - -typedef struct _RXCE_SIGNATURE_ { - union { - struct { - USHORT Type; - CSHORT Size; - }; - - ULONG Signature; - }; -} RXCE_SIGNATURE, *PRXCE_SIGNATURE; - -// -// RXCE_TRANSPORT encapsulates all the parameters w.r.t. a TRANSPORT -// as regards the connection engine. -// - -#ifdef __cplusplus -typedef struct _RXCE_TRANSPORT_ : public RXCE_SIGNATURE { -#else // !__cplusplus -typedef struct _RXCE_TRANSPORT_ { - RXCE_SIGNATURE; -#endif // __cplusplus - - UNICODE_STRING Name; - - PDEVICE_OBJECT pDeviceObject; // Device object for transport - HANDLE ControlChannel; // Control Channel - PFILE_OBJECT pControlChannelFileObject; // File object for the control channel - - PRXCE_TRANSPORT_PROVIDER_INFO pProviderInfo; // Transport Provider Information. - - LONG ConnectionCount; // Number of connections on xport. - LONG VirtualCircuitCount; // no. of connections - ULONG QualityOfService; // quality of service provided. -} RXCE_TRANSPORT; - -#define RXCE_TRANSPORT_SIGNATURE ((sizeof(RXCE_TRANSPORT) << 16) | RDBSS_NTC_RXCE_TRANSPORT) - -#define RxCeIsTransportValid(pTransport) \ - ((pTransport)->Signature == RXCE_TRANSPORT_SIGNATURE) - -extern NTSTATUS -NTAPI -RxCeBuildTransport( - IN PRXCE_TRANSPORT pRxCeTransport, - IN PUNICODE_STRING pTransportName, - IN ULONG QualityOfService); - -extern NTSTATUS -NTAPI -RxCeTearDownTransport( - IN PRXCE_TRANSPORT pTransport); - -extern NTSTATUS -RxCeQueryAdapterStatus( - PRXCE_TRANSPORT pTransport, - struct _ADAPTER_STATUS *pAdapterStatus); - -extern NTSTATUS -RxCeQueryTransportInformation( - PRXCE_TRANSPORT pTransport, - PRXCE_TRANSPORT_INFORMATION pTransportInformation); - -// -// RXCE_ADDRESS encapsulates all the parameters w.r.t. a local transport address -// as regards the connection engine. -// - -#ifdef __cplusplus -typedef struct _RXCE_ADDRESS_ : public RXCE_SIGNATURE { -#else // !__cplusplus -typedef struct _RXCE_ADDRESS_ { - RXCE_SIGNATURE; -#endif // __cplusplus - - PRXCE_TRANSPORT pTransport; // the transport handle - PTRANSPORT_ADDRESS pTransportAddress; // the transport address - PVOID pContext; // the context used in event dispatch - PRXCE_ADDRESS_EVENT_HANDLER pHandler; // the address event handler - PMDL pReceiveMdl; // the MDL for handling Receives Supplied by client - HANDLE hAddress; // handle to the address object - PFILE_OBJECT pFileObject; // the file object for the address - LONG ConnectionCount; // no. of connections - LONG VirtualCircuitCount; // no. of vcs -} RXCE_ADDRESS; - -#define RXCE_ADDRESS_SIGNATURE ((sizeof(RXCE_ADDRESS) << 16) | RDBSS_NTC_RXCE_ADDRESS) - -#define RxCeIsAddressValid(pAddress) \ - ((pAddress)->Signature == RXCE_ADDRESS_SIGNATURE) - -extern NTSTATUS -NTAPI -RxCeBuildAddress( - IN OUT PRXCE_ADDRESS pAddress, - IN PRXCE_TRANSPORT pTransport, - IN PTRANSPORT_ADDRESS pTransportAddress, - IN PRXCE_ADDRESS_EVENT_HANDLER pHandler, - IN PVOID pEventContext); - -extern NTSTATUS -NTAPI -RxCeTearDownAddress( - IN PRXCE_ADDRESS pAddress); - -// -// RxCe Connection Establishment methods .... -// -// -// RXCE_CONNECTION encapsulates all the information w.r.t. a connection -// as regards the connection engine. -// - -#ifdef __cplusplus -typedef struct _RXCE_CONNECTION_ : public RXCE_SIGNATURE { -#else // !__cplusplus -typedef struct _RXCE_CONNECTION_ { - RXCE_SIGNATURE; -#endif // __cplusplus - - PRXCE_ADDRESS pAddress; // the local address for this connection - ULONG VirtualCircuitCount; // the number of virtual circuits associated with the connection - PVOID pContext; // the context used in event dispatch - PRXCE_CONNECTION_EVENT_HANDLER pHandler; // the event handler for the connection - PRXCE_CONNECTION_INFORMATION pConnectionInformation; // the remote address ... -} RXCE_CONNECTION; - -#define RXCE_CONNECTION_SIGNATURE ((sizeof(RXCE_CONNECTION) << 16) | RDBSS_NTC_RXCE_CONNECTION) - -#define RxCeIsConnectionValid(pConnection) \ - ((pConnection)->Signature == RXCE_CONNECTION_SIGNATURE) - -// -// The following enumerated type defines the various choices presented for -// selecting the transport over which a connection should be established -// - -typedef enum _RXCE_CONNECTION_CREATE_OPTIONS_ { - RxCeSelectFirstSuccessfulTransport, - RxCeSelectBestSuccessfulTransport, - RxCeSelectAllSuccessfulTransports -} RXCE_CONNECTION_CREATE_OPTIONS, - *PRXCE_CONNECTION_CREATE_OPTIONS; - -typedef struct _RXCE_CONNECTION_COMPLETION_CONTEXT_ { - NTSTATUS Status; - ULONG AddressIndex; - PRXCE_CONNECTION pConnection; - PRXCE_VC pVc; - RX_WORK_QUEUE_ITEM WorkQueueItem; - - // This is used to pass the UNICODE DNS name returned back from TDI - PRXCE_CONNECTION_INFORMATION pConnectionInformation; -} RXCE_CONNECTION_COMPLETION_CONTEXT, - *PRXCE_CONNECTION_COMPLETION_CONTEXT; - -typedef -NTSTATUS -(*PRXCE_CONNECTION_COMPLETION_ROUTINE)( - PRXCE_CONNECTION_COMPLETION_CONTEXT pCompletionContext); - -extern NTSTATUS -NTAPI -RxCeBuildConnection( - IN PRXCE_ADDRESS pLocalAddress, - IN PRXCE_CONNECTION_INFORMATION pConnectionInformation, - IN PRXCE_CONNECTION_EVENT_HANDLER pHandler, - IN PVOID pEventContext, - IN OUT PRXCE_CONNECTION pConnection, - IN OUT PRXCE_VC pVc); - -extern NTSTATUS -NTAPI -RxCeBuildConnectionOverMultipleTransports( - IN OUT PRDBSS_DEVICE_OBJECT pMiniRedirectorDeviceObject, - IN RXCE_CONNECTION_CREATE_OPTIONS CreateOption, - IN ULONG NumberOfAddresses, - IN PRXCE_ADDRESS *pLocalAddressPointers, - IN PUNICODE_STRING pServerName, - IN PRXCE_CONNECTION_INFORMATION pConnectionInformation, - IN PRXCE_CONNECTION_EVENT_HANDLER pHandler, - IN PVOID pEventContext, - IN PRXCE_CONNECTION_COMPLETION_ROUTINE pCompletionRoutine, - IN OUT PRXCE_CONNECTION_COMPLETION_CONTEXT pCompletionContext); - -extern NTSTATUS -NTAPI -RxCeTearDownConnection( - IN PRXCE_CONNECTION pConnection); - - -extern NTSTATUS -NTAPI -RxCeCancelConnectRequest( - IN PRXCE_ADDRESS pLocalAddress, - IN PUNICODE_STRING pServerName, - IN PRXCE_CONNECTION_INFORMATION pConnectionInformation); - - -// -// RXCE_VC encapsulates all the information w.r.t a virtual circuit (VC) -// connection to a particular server as regards the connection engine. -// -// Typically one VC is associated with a connection. However, there are instances in -// which more than one VC can be associated with a connection. In order to efficiently -// handle the common case well and at the same time provide an extensible mechanism we -// define a collection data structure ( a list ) which subsumes the allocation for -// one virtual circuit. It is also imperative that we restrict the knowledge of -// how this collection is organized to as few methods as possible in order to -// enable optimization/restructuring of this data structure at a later time. -// - -#define RXCE_VC_ACTIVE ((LONG)0xaa) -#define RXCE_VC_DISCONNECTED ((LONG)0xdd) -#define RXCE_VC_TEARDOWN ((LONG)0xbb) - -#ifdef __cplusplus -typedef struct _RXCE_VC_ : public RXCE_SIGNATURE { -#else // !__cplusplus -typedef struct _RXCE_VC_ { - RXCE_SIGNATURE; -#endif // __cplusplus - - PRXCE_CONNECTION pConnection; // the referenced connection instance - HANDLE hEndpoint; // local endpoint for the connection - PFILE_OBJECT pEndpointFileObject; // the end point file object. - __volatile LONG State; // status of the Vc. - CONNECTION_CONTEXT ConnectionId; // local endpoint for the connection. - PMDL pReceiveMdl; // the MDl for handling receives. - PKEVENT pCleanUpEvent; // sychronize event for clean up transports -} RXCE_VC; - -#define RXCE_VC_SIGNATURE ((sizeof(RXCE_VC) << 16) | RDBSS_NTC_RXCE_VC) - -#define RxCeIsVcValid(pVc) \ - ((pVc)->Signature == RXCE_VC_SIGNATURE) - -extern NTSTATUS -NTAPI -RxCeBuildVC( - IN OUT PRXCE_VC pVc, - IN PRXCE_CONNECTION Connection); - -extern NTSTATUS -NTAPI -RxCeTearDownVC( - IN PRXCE_VC pVc); - -extern NTSTATUS -NTAPI -RxCeInitiateVCDisconnect( - IN PRXCE_VC pVc); - -extern NTSTATUS -NTAPI -RxCeQueryInformation( - IN PRXCE_VC pVc, - IN RXCE_CONNECTION_INFORMATION_CLASS InformationClass, - OUT PVOID pInformation, - IN ULONG Length); - -// -// RxCe Data transmission methods -// - -// -// Send options -// -// The following flags are equivalent to the TDI flags. In addition -// there are RXCE specific flags which are defined from the other end of -// a dword. -// - -#define RXCE_SEND_EXPEDITED TDI_SEND_EXPEDITED -#define RXCE_SEND_NO_RESPONSE_EXPECTED TDI_SEND_NO_RESPONSE_EXPECTED -#define RXCE_SEND_NON_BLOCKING TDI_SEND_NON_BLOCKING - -// -// The ASYNCHRONOUS and SYNCHRONOUS option available RxCeSend and RxCeSendDatagram -// distinguish between two situations. In the asynchronous case control returns to -// the caller once the request has been successfully submitted to the underlying -// transport. The results for any given request are communicated back using the -// SendCompletion callback routine. The pCompletionContext parameter in RxCeSend and -// RxCeSendDatagram is passed back in the callback routine to assist the caller in -// disambiguating the requests. -// -// In the synchronous case the request is submitted to the underlying transport and the -// control does not return to the caller till the request completes. -// -// Note that in the synchrnous case the pCompletionContext parameter is ignored and the -// status that is returned correpsonds to the completion status of the operations. -// -// The benefit of ASYNCHRONOUS and SYNCHRONOUS options depends on the underlying -// transport. In a Virtual Circuit environment a SYNCHRONOUS option implies that the -// control does not return till the data reaches the server. On the other hand -// for datagram oriented transports there is very little difference between the two. -// - -#define RXCE_FLAGS_MASK (0xff000000) - -#define RXCE_SEND_SYNCHRONOUS (0x10000000) - -// The following bit signifies if an RX_MEM_DESC(MDL) is to be sent in its entirety -// or only portions of it need to be sent. - -#define RXCE_SEND_PARTIAL (0x20000000) - -extern NTSTATUS -NTAPI -RxCeSend( - IN PRXCE_VC pVc, - IN ULONG SendOptions, - IN PMDL pMdl, - IN ULONG SendLength, - IN PVOID pCompletionContext); - -extern NTSTATUS -NTAPI -RxCeSendDatagram( - IN PRXCE_ADDRESS hAddress, - IN PRXCE_CONNECTION_INFORMATION pConnectionInformation, - IN ULONG SendOptions, - IN PMDL pMdl, - IN ULONG SendLength, - IN PVOID pCompletionContext); - -extern PIRP -RxCeAllocateIrpWithMDL( - IN CCHAR StackSize, - IN BOOLEAN ChargeQuota, - IN PMDL Buffer); - -extern VOID -RxCeFreeIrp(PIRP pIrp); - - -#endif // _RXCE_H_ - diff --git a/pub/ddk/rxcehdlr.h b/pub/ddk/rxcehdlr.h deleted file mode 100644 index 12bb2c6..0000000 --- a/pub/ddk/rxcehdlr.h +++ /dev/null @@ -1,309 +0,0 @@ -/*++ BUILD Version: 0009 // Increment this if a change has global effects -Copyright (c) 1987-1993 Microsoft Corporation - -Module Name: - - rxcehdlr.h - -Abstract: - - This is the include file that defines all constants and types for - accessing the redirector file system connection engine. - -Revision History: -Notes: - - The Connection engine is designed to map and emulate the TDI specs. as closely - as possible. This implies that on NT we will have a very efficient mechanism - which fully exploits the underlying TDI implementation. - - All the necessary types can be redefined in terms of the types defined in - \nt\private\inc\tdi.h in the case of NT. For Win95 we will provide the - appropriate definitions. - ---*/ - -#ifndef _RXCEHDLR_H_ -#define _RXCEHDLR_H_ - -#include "tdi.h" - -typedef TDI_PROVIDER_INFO RXCE_TRANSPORT_PROVIDER_INFO; -typedef RXCE_TRANSPORT_PROVIDER_INFO* PRXCE_TRANSPORT_PROVIDER_INFO; - -typedef TDI_CONNECTION_INFORMATION RXCE_CONNECTION_INFORMATION; -typedef RXCE_CONNECTION_INFORMATION* PRXCE_CONNECTION_INFORMATION; - -typedef TDI_CONNECTION_INFORMATION RXCE_CONNECTION_INFORMATION; -typedef RXCE_CONNECTION_INFORMATION* PRXCE_CONNECTION_INFORMATION; - -typedef TDI_CONNECTION_INFO RXCE_CONNECTION_INFO; -typedef RXCE_CONNECTION_INFO* PRXCE_CONNECTION_INFO; - -#ifdef __cplusplus -typedef struct _RXCE_TRANSPORT_INFORMATION_ : public RXCE_TRANSPORT_PROVIDER_INFO { -#else // !__cplusplus -typedef struct _RXCE_TRANSPORT_INFORMATION_ { - RXCE_TRANSPORT_PROVIDER_INFO; -#endif // __cplusplus - - ULONG ConnectionCount; - ULONG QualityOfService; -} RXCE_TRANSPORT_INFORMATION, *PRXCE_TRANSPORT_INFORMATION; - -typedef enum _RXCE_CONNECTION_INFORMATION_CLASS_ { - RxCeTransportProviderInformation = 1, - RxCeConnectionInformation, - RxCeConnectionEndpointInformation, - RxCeRemoteAddressInformation -} RXCE_CONNECTION_INFORMATION_CLASS, - *PRXCE_CONNECTION_INFORMATION_CLASS; - -typedef struct _RXCE_VC_ *PRXCE_VC; -typedef struct _RXCE_CONNECTION_ *PRXCE_CONNECTION; -typedef struct _RXCE_ADDRESS_ *PRXCE_ADDRESS; -typedef struct _RXCE_TRANSPORT_ *PRXCE_TRANSPORT; - -// -// Disconnection indication prototype. This is invoked when a connection is -// being disconnected for a reason other than the user requesting it. -// - -typedef -NTSTATUS -(*PRXCE_IND_DISCONNECT)( - IN PVOID pRxCeEventContext, - IN PRXCE_VC pVc, - IN int DisconnectDataLength, - IN PVOID DisconnectData, - IN int DisconnectInformationLength, - IN PVOID DisconnectInformation, - IN ULONG DisconnectFlags - ); - -// -// A protocol error has occurred when this indication happens. This indication -// occurs only for errors of the worst type; the address this indication is -// delivered to is no longer usable for protocol-related operations, and -// should not be used for operations henceforth. All connections associated -// it are invalid. -// - -typedef -NTSTATUS -(*PRXCE_IND_ENDPOINT_ERROR)( - IN PVOID pRxCeEventContext, // the event context. - IN NTSTATUS Status // status code indicating error type. - ); - - -typedef -NTSTATUS -(*PRXCE_IND_CONNECTION_ERROR)( - IN PVOID pRxCeEventContext, // the event context. - PRXCE_VC pVc, // the associated VC handle - IN NTSTATUS Status // status code indicating error type. - ); - -// -// RXCE_IND_RECEIVE indication handler definition. This client routine is -// called by the transport provider when a connection-oriented TSDU is received -// that should be presented to the client. -// -// A Receive event handler can return one of three distinguished error codes to -// initiate a different course of action in the connection engine. -// -// STATUS_SUCCESS -- Data was copied directly from the TSDU. The amout of data that -// was taken is indicated in the parameter BytesTaken. -// -// STATUS_MORE_PROCESSING_REQUIRED -- The client has returned a buffer into which the -// data should be copied. This is typically the case when BytesAvailable is greater than -// BytesIndicated. In such cases the RxCe will copy the remaining data into the buffer -// that is specified. Note that when this status code is returned from the client it is -// conceivable that the client can demand more data than is available to be copied into -// the buffer. In such cases the subsequent indications till this criterion is met is not -// passed back to the user till the copy is completed. On completion of this copy the -// RxCe notifies the client by invoking the RxCeDataReadyEventHandler. -// -// STATUS_DATA_NOT_ACCEPTED - The client has refused the data. -// - -typedef -NTSTATUS -(*PRXCE_IND_RECEIVE)( - IN PVOID pRxCeEventContext, // the context provided during registration - IN PRXCE_VC pVc, // the associated VC handle - IN ULONG ReceiveFlags, // the receive flags - IN ULONG BytesIndicated, // the number of received bytes indicated - IN ULONG BytesAvailable, // the total number of bytes available - OUT ULONG *BytesTaken, // return indication of the bytes consumed - IN PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes - OUT PMDL *pDataBufferPointer, // the buffer for copying the bytes not indicated. - OUT PULONG pDataBufferSize // amount of data to copy - ); - - -// -// RXCE_IND_RECEIVE_DATAGRAM indication handler definition. This client routine -// is called by the transport provider when a connectionless TSDU is received -// that should be presented to the client. -// -// A Receive event handler can return one of three distinguished error codes to -// initiate a different course of action in the connection engine. -// -// STATUS_SUCCESS -- Data was copied directly from the TSDU. The amout of data that -// was taken is indicated in the parameter BytesTaken. -// -// STATUS_MORE_PROCESSING_REQUIRED -- The client has returned a buffer into which the -// data should be copied. This is typically the case when BytesAvailable is greater than -// BytesIndicated. In such cases the RxCe will copy the remaining data into the buffer -// that is specified. Note that when this status code is returned from the client it is -// conceivable that the client can demand more data than is available to be copied into -// the buffer. In such cases the subsequent indications till this criterion is met is not -// passed back to the user till the copy is completed. On completion of this copy the -// RxCe notifies the client by invoking the RxCeDataReadyEventHandler. -// -// STATUS_DATA_NOT_ACCEPTED - The client has refused the data. -// -// - -typedef -NTSTATUS -(*PRXCE_IND_RECEIVE_DATAGRAM)( - IN PVOID pRxCeEventContext, // the event context - IN int SourceAddressLength, // length of the originator of the datagram - IN PVOID SourceAddress, // string describing the originator of the datagram - IN int OptionsLength, // options for the receive - IN PVOID Options, // - IN ULONG ReceiveDatagramFlags, // - IN ULONG BytesIndicated, // number of bytes this indication - IN ULONG BytesAvailable, // number of bytes in complete Tsdu - OUT ULONG *BytesTaken, // number of bytes used - IN PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes - OUT PMDL *pDataBufferPointer, // the buffer in which data is to be copied. - OUT PULONG pDataBufferSize // amount of data to copy - ); - -// -// This indication is delivered if expedited data is received on the connection. -// This will only occur in providers that support expedited data. -// -// A Receive event handler can return one of three distinguished error codes to -// initiate a different course of action in the connection engine. -// -// STATUS_SUCCESS -- Data was copied directly from the TSDU. The amout of data that -// was taken is indicated in the parameter BytesTaken. -// -// STATUS_MORE_PROCESSING_REQUIRED -- The client has returned a buffer into which the -// data should be copied. This is typically the case when BytesAvailable is greater than -// BytesIndicated. In such cases the RxCe will copy the remaining data into the buffer -// that is specified. Note that when this status code is returned from the client it is -// conceivable that the client can demand more data than is available to be copied into -// the buffer. In such cases the subsequent indications till this criterion is met is not -// passed back to the user till the copy is completed. On completion of this copy the -// RxCe notifies the client by invoking the RxCeDataReadyEventHandler. -// -// STATUS_DATA_NOT_ACCEPTED - The client has refused the data. -// - -typedef -NTSTATUS -(*PRXCE_IND_RECEIVE_EXPEDITED)( - IN PVOID pRxCeEventContext, // the context provided during registration - IN PRXCE_VC pVc, // the associated VC handle - IN ULONG ReceiveFlags, // - IN ULONG BytesIndicated, // number of bytes in this indication - IN ULONG BytesAvailable, // number of bytes in complete Tsdu - OUT ULONG *BytesTaken, // number of bytes used by indication routine - IN PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes - OUT PMDL *pDataBufferPointer, // the buffer in which data is to be copied. - OUT PULONG pDataBufferSize // amount of data to copy - ); - -// -// This indication is delivered if there is room for a send in the buffer of -// a buffering protocol. -// - -typedef -NTSTATUS -(*PRXCE_IND_SEND_POSSIBLE)( - IN PVOID pRxCeEventContext, - IN PRXCE_VC pVc, - IN ULONG BytesAvailable); - -// -// RxCeDataReadyEventHandler -- This is invoked when the desired data is available -// for client consumption. This always follows a receive indication in which the -// client returns a buffer for copying the remaining data -// - -typedef -NTSTATUS -(*PRXCE_IND_DATA_READY)( - IN PVOID pEventContext, - IN PMDL pBuffer, - IN ULONG CopiedDataSize, - IN NTSTATUS CopyDataStatus); - - -// -// RxCeSendCompleteEventHandler -- This is invoked when the send has been successfully completed -// The buffer and the length sent are passed in as parameters -// - -typedef -NTSTATUS -(*PRXCE_IND_SEND_COMPLETE)( - IN PVOID pEventContext, - IN PVOID pCompletionContext, - IN NTSTATUS Status); - - -typedef -NTSTATUS -(*PRXCE_IND_CONNECTION_SEND_COMPLETE)( - IN PVOID pEventContext, - IN PRXCE_VC pVc, - IN PVOID pCompletionContext, - IN NTSTATUS Status); - -// -// RxCeSendSubmittedEventHandler -- This is invoked when the send has been successfully -// submitted to the transport. -// - -typedef -NTSTATUS -(*PRXCE_IND_CONNECTION_SEND_SUBMITTED)( - IN PVOID pEventContext, - IN PRXCE_VC pVc, - IN PVOID pCompletionContext, - IN NTSTATUS Status); - -// -// Event Handler Dispatch Vector definitions .... -// - -typedef struct _RXCE_ADDRESS_EVENT_HANDLER_ { - PRXCE_IND_ENDPOINT_ERROR RxCeErrorEventHandler; - PRXCE_IND_RECEIVE_DATAGRAM RxCeReceiveDatagramEventHandler; - PRXCE_IND_DATA_READY RxCeDataReadyEventHandler; - PRXCE_IND_SEND_POSSIBLE RxCeSendPossibleEventHandler; - PRXCE_IND_SEND_COMPLETE RxCeSendCompleteEventHandler; -} RXCE_ADDRESS_EVENT_HANDLER, *PRXCE_ADDRESS_EVENT_HANDLER; - -typedef struct _RXCE_CONNECTION_EVENT_HANDLER_ { - PRXCE_IND_DISCONNECT RxCeDisconnectEventHandler; - PRXCE_IND_CONNECTION_ERROR RxCeErrorEventHandler; - PRXCE_IND_RECEIVE RxCeReceiveEventHandler; - PRXCE_IND_RECEIVE_DATAGRAM RxCeReceiveDatagramEventHandler; - PRXCE_IND_RECEIVE_EXPEDITED RxCeReceiveExpeditedEventHandler; - PRXCE_IND_SEND_POSSIBLE RxCeSendPossibleEventHandler; - PRXCE_IND_DATA_READY RxCeDataReadyEventHandler; - PRXCE_IND_CONNECTION_SEND_COMPLETE RxCeSendCompleteEventHandler; - PRXCE_IND_CONNECTION_SEND_SUBMITTED RxCeSendSubmittedEventHandler; -} RXCE_CONNECTION_EVENT_HANDLER, *PRXCE_CONNECTION_EVENT_HANDLER; - -#endif // _RXCEHDLR_H_ - diff --git a/pub/ddk/rxcontx.h b/pub/ddk/rxcontx.h deleted file mode 100644 index 5f7256a..0000000 --- a/pub/ddk/rxcontx.h +++ /dev/null @@ -1,826 +0,0 @@ -/*++ - -Copyright (c) 1994 Microsoft Corporation - -Module Name: - - RxContx.h - -Abstract: - - This module defines RxContext data structure. This structure is used to - describe an Irp whil it is being processed and contains state information - that allows global resources to be released as the irp is completed. - -Author: -Notes: - - The RX_CONTEXT is a data structure to which additional information provided - by the various mini redirectors need to be attached. This can be done in one - of the following three ways - - 1) Allow for context pointers to be defined as part of the RX_CONTEXT which - the mini redirectors can use to squirrel away their information. This - implies that every time an RX_CONTEXT is allocated/destroyed the mini - redirector has to perform an associated allocation/destruction. - - Since RX_CONTEXT's are created/destroyed in great numbers, this is not an - acceptable solution. - - 2) The second approach consists of over allocating RX_CONTEXT's by a - prespecified amount for each mini redirector which is then reserved for - use by the mini redirector. Such an approach avoids the additional - allocation/destruction but complicates the RX_CONTEXT management code in - the wrapper. - - 3) The third approach ( the one that is implemented ) consists of allocating - a prespecfied area which is the same for all mini redirectors as part of - each RX_CONTEXT. This is an unformatted area on top of which any desired - structure can be imposed by the various mini redirectors. Such an approach - overcomes the disadvantages associated with (1) and (2). - - All mini redirector writers must try and define the associated mini redirector - contexts to fit into this area. Those mini redirectors who violate this - rule will incur a significant performance penalty. - ---*/ - -#ifndef _RX_CONTEXT_STRUCT_DEFINED_ -#define _RX_CONTEXT_STRUCT_DEFINED_ -#ifndef RDBSS_TRACKER -#error tracker must be defined right now -#endif - -#define RX_TOPLEVELIRP_CONTEXT_SIGNATURE ('LTxR') -typedef struct _RX_TOPLEVELIRP_CONTEXT { - union { -#ifndef __cplusplus - LIST_ENTRY; -#endif // __cplusplus - LIST_ENTRY ListEntry; - }; - ULONG Signature; - PRDBSS_DEVICE_OBJECT RxDeviceObject; - PRX_CONTEXT RxContext; - PIRP Irp; - ULONG Flags; - PVOID Previous; - PETHREAD Thread; -} RX_TOPLEVELIRP_CONTEXT, *PRX_TOPLEVELIRP_CONTEXT; - -BOOLEAN -RxTryToBecomeTheTopLevelIrp ( - IN OUT PRX_TOPLEVELIRP_CONTEXT TopLevelContext, - IN PIRP Irp, - IN PRDBSS_DEVICE_OBJECT RxDeviceObject, - IN BOOLEAN ForceTopLevel - ); - -VOID -__RxInitializeTopLevelIrpContext ( - IN OUT PRX_TOPLEVELIRP_CONTEXT TopLevelContext, - IN PIRP Irp, - IN PRDBSS_DEVICE_OBJECT RxDeviceObject, - IN ULONG Flags - ); -#define RxInitializeTopLevelIrpContext(a,b,c) {__RxInitializeTopLevelIrpContext(a,b,c,0);} - -PIRP -RxGetTopIrpIfRdbssIrp ( - VOID - ); - -PRDBSS_DEVICE_OBJECT -RxGetTopDeviceObjectIfRdbssIrp ( - VOID - ); - -VOID -RxUnwindTopLevelIrp ( - IN OUT PRX_TOPLEVELIRP_CONTEXT TopLevelContext - ); - -BOOLEAN -RxIsThisTheTopLevelIrp ( - IN PIRP Irp - ); - -#ifdef RDBSS_TRACKER -typedef struct _RX_FCBTRACKER_CALLINFO { - ULONG AcquireRelease; - USHORT SavedTrackerValue; - USHORT LineNumber; - PSZ FileName; - ULONG Flags; -} RX_FCBTRACKER_CALLINFO, *PRX_FCBTRACKER_CALLINFO; -#define RDBSS_TRACKER_HISTORY_SIZE 32 -#endif - -#define MRX_CONTEXT_FIELD_COUNT 4 -#define MRX_CONTEXT_SIZE (sizeof(PVOID) * MRX_CONTEXT_FIELD_COUNT) - -// -// Define rxdriver dispatch routine type....almost all of the important routine -// will have this type. -// - -typedef -NTSTATUS -(NTAPI *PRX_DISPATCH) ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp - ); - -// -// predeclare dfs types -// - -typedef struct _DFS_NAME_CONTEXT_ *PDFS_NAME_CONTEXT; - -typedef struct _NT_CREATE_PARAMETERS { - ACCESS_MASK DesiredAccess; - LARGE_INTEGER AllocationSize; - ULONG FileAttributes; - ULONG ShareAccess; - ULONG Disposition; - ULONG CreateOptions; - PIO_SECURITY_CONTEXT SecurityContext; - SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; - PVOID DfsContext; - PDFS_NAME_CONTEXT DfsNameContext; -} NT_CREATE_PARAMETERS, *PNT_CREATE_PARAMETERS; - -typedef struct _RX_CONTEXT { - - // - // the node type, size and reference count, aka standard header - // - - NODE_TYPE_CODE NodeTypeCode; - NODE_BYTE_SIZE NodeByteSize; - __volatile ULONG ReferenceCount; - - // - // the list entry to wire the context to the list of active contexts - // - - LIST_ENTRY ContextListEntry; - - // - // Major and minor function of the IRP associated with the context - // - - UCHAR MajorFunction; - UCHAR MinorFunction; - - // - // this is similar to the same field in Irps; it - // allows callback routines for async operations - // to know whether to do asynchronous work or not - // - - BOOLEAN PendingReturned; - - // - // indicates if the associated request is to be posted to a RDBSS worker thread. - // - - BOOLEAN PostRequest; - - // - // Originating Device (required for workque algorithms) - // not currently used but could be used for local minis - // - - PDEVICE_OBJECT RealDevice; - - // - // ptr to the originating Irp - // - - PIRP CurrentIrp; - - // - // ptr to the IRP stack location - // - - PIO_STACK_LOCATION CurrentIrpSp; - - // - // ptr to the FCB and FOBX, derived from the context pointers in the - // file object associated with the IRP - // - - PMRX_FCB pFcb; - PMRX_FOBX pFobx; - PMRX_SRV_OPEN pRelevantSrvOpen; - PNON_PAGED_FCB NonPagedFcb; - - // - // device object calldown (not irpsp.....) - // - - PRDBSS_DEVICE_OBJECT RxDeviceObject; - - // - // The original thread in which the request was initiated and the last - // thread in which some processing associated with the context was done - // - - PETHREAD OriginalThread; - PETHREAD LastExecutionThread; - - __volatile PVOID LockManagerContext; - - // - // One word of the context is given to rdbss for dbg information - // - - PVOID RdbssDbgExtension; - - RX_SCAVENGER_ENTRY ScavengerEntry; - - // - // global serial number for this operation - // - - ULONG SerialNumber; - - // - // used by minirdrs to see if multiple calls are part - // of the same larger operation and (therefore) more cacheable - // - - ULONG FobxSerialNumber; - - ULONG Flags; - - BOOLEAN FcbResourceAcquired; - BOOLEAN FcbPagingIoResourceAcquired; - UCHAR MustSucceedDescriptorNumber; - - // - // mostly you want the individual components...sometimes it's nice as a pair - // used to record the status when you can't just return it; e.g., when - // RXSTATUS is not an appropriate return type or if the consumer of the - // status didn't call directly (lowiocompletions). minirdrs will not need - // to set the information directly - // - - union { - struct { - union { - NTSTATUS StoredStatus; - PVOID StoredStatusAlignment; - }; - ULONG_PTR InformationToReturn; - }; - IO_STATUS_BLOCK IoStatusBlock; - }; - - // - // the context fields provided for use by the mini redirectors - // this is defined as a union to force longlong alignment - // - - union { - ULONGLONG ForceLonglongAligmentDummyField; - PVOID MRxContext[MRX_CONTEXT_FIELD_COUNT]; - }; - - // - // The following field is included to fix the problem related to write only - // opens. This introduces a new field for the mini redirector to squirrel - // some state. This is redundant and should be removed after Windows 2000. - // Having a unique field reduces the impact of the change that we are making - // to the specific code path. It will be ideal to use one of the MRXContext - // fields defined above - // - - PVOID WriteOnlyOpenRetryContext; - - // - // the cancellation routine to be invoked, set by the mini redirector - // - - PMRX_CALLDOWN MRxCancelRoutine; - - // - // private dispatch, if any. used in fspdisp - // - - PRX_DISPATCH ResumeRoutine; - - // - // for posting to worker threads - // the minirdr can use this for posting within the minirdr - // a potential problem can arise if the minirdr relies on this both - // for queueing async stuff and for queueing cancel stuff - // - - // - // The OverflowListEntry is used for queueing items to the overflow queue. - // This is seperate now to allow us to distinguish between an item in the overflow - // queue and one in the active work queue (for cancellation logic) - // - - RX_WORK_QUEUE_ITEM WorkQueueItem; - LIST_ENTRY OverflowListEntry; - - // - // this event is used for synchronous operations - // that have to i/f with an underlying async service. it can be used - // by the minirdr with the following provisions: - // 1) on entering the minirdr through lowio, it is set to the - // nonsignaled state (but a wise user will reset it before using - // it....particularly if it's used multiple times. - // 2) if you are returning STATUS_PENDING on a sync operation, you must - // return with it set to the nonsignaled state; that is, either - // you don't use it or you reset it in this case - // - - KEVENT SyncEvent; - - // - // this is a list head of operations that are to be released on completion - // - - LIST_ENTRY BlockedOperations; - - // - // this is the mutex that controls serialization of the blocked operations - // - - PFAST_MUTEX BlockedOpsMutex; - - // - // these links are used to serialize pipe operations on a - // per-file-object basis AND FOR LOTS OF OTHER STUFF - // - - LIST_ENTRY RxContextSerializationQLinks; - - union { - struct { - union { - FS_INFORMATION_CLASS FsInformationClass; - FILE_INFORMATION_CLASS FileInformationClass; - }; - PVOID Buffer; - union { - LONG Length; - LONG LengthRemaining; - }; - BOOLEAN ReplaceIfExists; - BOOLEAN AdvanceOnly; - } Info; - - struct { - UNICODE_STRING SuppliedPathName; - NET_ROOT_TYPE NetRootType; - PIO_SECURITY_CONTEXT pSecurityContext; - } PrefixClaim; - }; - - // - // THIS UNION MUST BE LAST....AT SOME POINT, WE MAY START ALLOCATING - // SMALLER PER OPERATION! - // - - union{ - struct { - NT_CREATE_PARAMETERS NtCreateParameters; // a copy of the createparameters - ULONG ReturnedCreateInformation; - PWCH CanonicalNameBuffer; // if the canonical name is larger than available buffer - PRX_PREFIX_ENTRY NetNamePrefixEntry; // the entry returned by the lookup....for dereferencing - - PMRX_SRV_CALL pSrvCall; // Server Call being used - PMRX_NET_ROOT pNetRoot; // Net Root being used - PMRX_V_NET_ROOT pVNetRoot; // Virtual Net Root - //PMRX_SRV_OPEN pSrvOpen; // Server Open - - PVOID EaBuffer; - ULONG EaLength; - - ULONG SdLength; - - ULONG PipeType; - ULONG PipeReadMode; - ULONG PipeCompletionMode; - - USHORT Flags; - NET_ROOT_TYPE Type; // Type of Net Root(Pipe/File/Mailslot..) - UCHAR RdrFlags; // Flags for use by the RDR while processing the request. - - BOOLEAN FcbAcquired; - BOOLEAN TryForScavengingOnSharingViolation; - BOOLEAN ScavengingAlreadyTried; - - BOOLEAN ThisIsATreeConnectOpen; - BOOLEAN TreeConnectOpenDeferred; - UNICODE_STRING TransportName; - UNICODE_STRING UserName; - UNICODE_STRING Password; - UNICODE_STRING UserDomainName; - } Create; - struct { - ULONG FileIndex; - BOOLEAN RestartScan; - BOOLEAN ReturnSingleEntry; - BOOLEAN IndexSpecified; - BOOLEAN InitialQuery; - } QueryDirectory; - struct { - PMRX_V_NET_ROOT pVNetRoot; - } NotifyChangeDirectory; - struct { - PUCHAR UserEaList; - ULONG UserEaListLength; - ULONG UserEaIndex; - BOOLEAN RestartScan; - BOOLEAN ReturnSingleEntry; - BOOLEAN IndexSpecified; - } QueryEa; - struct { - SECURITY_INFORMATION SecurityInformation; - ULONG Length; - } QuerySecurity; - struct { - SECURITY_INFORMATION SecurityInformation; - PSECURITY_DESCRIPTOR SecurityDescriptor; - } SetSecurity; - struct { - ULONG Length; - PSID StartSid; - PFILE_GET_QUOTA_INFORMATION SidList; - ULONG SidListLength; - BOOLEAN RestartScan; - BOOLEAN ReturnSingleEntry; - BOOLEAN IndexSpecified; - } QueryQuota; - struct { - ULONG Length; - - } SetQuota; - struct { - PV_NET_ROOT VNetRoot; - PSRV_CALL SrvCall; - PNET_ROOT NetRoot; - } DosVolumeFunction; - struct { - ULONG FlagsForLowIo; - LOWIO_CONTEXT LowIoContext; // the LOWIO parameters - }; // no name here.... - LUID FsdUid; - } ; - - // - // CODE.IMPROVEMENT remove this to wrapperdbgprivates - // - - PWCH AlsoCanonicalNameBuffer; // if the canonical name is larger than available buffer - PUNICODE_STRING LoudCompletionString; - -#ifdef RDBSS_TRACKER - __volatile LONG AcquireReleaseFcbTrackerX; - __volatile ULONG TrackerHistoryPointer; - RX_FCBTRACKER_CALLINFO TrackerHistory[RDBSS_TRACKER_HISTORY_SIZE]; -#endif - -#if DBG - ULONG ShadowCritOwner; -#endif - -} RX_CONTEXT, *PRX_CONTEXT; - -typedef enum { - RX_CONTEXT_FLAG_FROM_POOL = 0x00000001, - RX_CONTEXT_FLAG_WAIT = 0x00000002, - RX_CONTEXT_FLAG_WRITE_THROUGH = 0x00000004, - RX_CONTEXT_FLAG_FLOPPY = 0x00000008, - RX_CONTEXT_FLAG_RECURSIVE_CALL = 0x00000010, - RX_CONTEXT_FLAG_THIS_DEVICE_TOP_LEVEL = 0x00000020, - RX_CONTEXT_FLAG_DEFERRED_WRITE = 0x00000040, - RX_CONTEXT_FLAG_VERIFY_READ = 0x00000080, - RX_CONTEXT_FLAG_STACK_IO_CONTEZT = 0x00000100, - RX_CONTEXT_FLAG_IN_FSP = 0x00000200, - RX_CONTEXT_FLAG_CREATE_MAILSLOT = 0x00000400, - RX_CONTEXT_FLAG_MAILSLOT_REPARSE = 0x00000800, - RX_CONTEXT_FLAG_ASYNC_OPERATION = 0x00001000, - RX_CONTEXT_FLAG_NO_COMPLETE_FROM_FSP = 0x00002000, - RX_CONTEXT_FLAG_POST_ON_STABLE_CONDITION = 0x00004000, - RX_CONTEXT_FLAG_FSP_DELAYED_OVERFLOW_QUEUE = 0x00008000, - RX_CONTEXT_FLAG_FSP_CRITICAL_OVERFLOW_QUEUE = 0x00010000, - RX_CONTEXT_FLAG_MINIRDR_INVOKED = 0x00020000, - RX_CONTEXT_FLAG_WAITING_FOR_RESOURCE = 0x00040000, - RX_CONTEXT_FLAG_CANCELLED = 0x00080000, - RX_CONTEXT_FLAG_SYNC_EVENT_WAITERS = 0x00100000, - RX_CONTEXT_FLAG_NO_PREPOSTING_NEEDED = 0x00200000, - RX_CONTEXT_FLAG_BYPASS_VALIDOP_CHECK = 0x00400000, - RX_CONTEXT_FLAG_BLOCKED_PIPE_RESUME = 0x00800000, - RX_CONTEXT_FLAG_IN_SERIALIZATION_QUEUE = 0x01000000, - RX_CONTEXT_FLAG_NO_EXCEPTION_BREAKPOINT = 0x02000000, - RX_CONTEXT_FLAG_NEEDRECONNECT = 0x04000000, - RX_CONTEXT_FLAG_MUST_SUCCEED = 0x08000000, - RX_CONTEXT_FLAG_MUST_SUCCEED_NONBLOCKING = 0x10000000, - RX_CONTEXT_FLAG_MUST_SUCCEED_ALLOCATED = 0x20000000, - RX_CONTEXT_FLAG_MINIRDR_INITIATED = 0x80000000, -} RX_CONTEXT_FLAGS; - -#define RX_CONTEXT_PRESERVED_FLAGS (RX_CONTEXT_FLAG_FROM_POOL | \ - RX_CONTEXT_FLAG_MUST_SUCCEED_ALLOCATED | \ - RX_CONTEXT_FLAG_IN_FSP) - -#define RX_CONTEXT_INITIALIZATION_FLAGS (RX_CONTEXT_FLAG_WAIT | \ - RX_CONTEXT_FLAG_MUST_SUCCEED | \ - RX_CONTEXT_FLAG_MUST_SUCCEED_NONBLOCKING) - -typedef enum { - RX_CONTEXT_CREATE_FLAG_UNC_NAME = 0x1, - RX_CONTEXT_CREATE_FLAG_STRIPPED_TRAILING_BACKSLASH = 0x2, - RX_CONTEXT_CREATE_FLAG_ADDEDBACKSLASH = 0x4, - RX_CONTEXT_CREATE_FLAG_REPARSE = 0x8, - RX_CONTEXT_CREATE_FLAG_SPECIAL_PATH = 0x10, -} RX_CONTEXT_CREATE_FLAGS; - -typedef enum { - RXCONTEXT_FLAG4LOWIO_PIPE_OPERATION = 0x1, - RXCONTEXT_FLAG4LOWIO_PIPE_SYNC_OPERATION = 0x2, - RXCONTEXT_FLAG4LOWIO_READAHEAD = 0x4, - RXCONTEXT_FLAG4LOWIO_THIS_READ_ENLARGED = 0x8, - RXCONTEXT_FLAG4LOWIO_THIS_IO_BUFFERED = 0x10, - RXCONTEXT_FLAG4LOWIO_LOCK_FCB_RESOURCE_HELD = 0x20, - RXCONTEXT_FLAG4LOWIO_LOCK_WAS_QUEUED_IN_LOCKMANAGER = 0x40, - RXCONTEXT_FLAG4LOWIO_THIS_IO_FAST = 0x80, - RXCONTEXT_FLAG4LOWIO_LOCK_OPERATION_COMPLETED = 0x100, - RXCONTEXT_FLAG4LOWIO_LOCK_BUFFERED_ON_ENTRY = 0x200 - -#ifdef __cplusplus -} RX_CONTEXT_LOWIO_FLAGS; -#else // !__cplusplus -} RX_CONTEXT_CREATE_FLAGS; -#endif // __cplusplus - -// -// Macros used to control whether the wrapper breakpoints on an exception -// - -#if DBG -#define RxSaveAndSetExceptionNoBreakpointFlag( RXCONTEXT,OLDFLAG ) { \ - OLDFLAG = FlagOn( RxContext->Flags, RX_CONTEXT_FLAG_NO_EXCEPTION_BREAKPOINT );\ - SetFlag( RxContext->Flags, RX_CONTEXT_FLAG_NO_EXCEPTION_BREAKPOINT ); \ -} -#define RxRestoreExceptionNoBreakpointFlag( RXCONTEXT,OLDFLAG ) { \ - ClearFlag( RxContext->Flags, RX_CONTEXT_FLAG_NO_EXCEPTION_BREAKPOINT ); \ - SetFlag( RxContext->Flags, OLDFLAG ); \ -} -#else -#define RxSaveAndSetExceptionNoBreakpointFlag(RXCONTEXT,OLDFLAG) -#define RxRestoreExceptionNoBreakpointFlag(RXCONTEXT,OLDFLAG) -#endif - -// -// a macro used to ensure that a context hasn't been freed during a wait -// - -#if DBG -VOID -__RxItsTheSameContext( - __in PRX_CONTEXT RxContext, - __in ULONG CapturedRxContextSerialNumber, - __in ULONG Line, - __in PCSTR File - ); -#define RxItsTheSameContext() {__RxItsTheSameContext(RxContext,CapturedRxContextSerialNumber,__LINE__,__FILE__);} -#else -#define RxItsTheSameContext() {NOTHING;} -#endif - -extern NPAGED_LOOKASIDE_LIST RxContextLookasideList; - -// -// Macros used in the RDBSS to wrap mini rdr calldowns -// - -#define MINIRDR_CALL_THROUGH(STATUS,DISPATCH,FUNC,ARGLIST) \ - { \ - ASSERT(DISPATCH); \ - ASSERT( NodeType(DISPATCH) == RDBSS_NTC_MINIRDR_DISPATCH ); \ - if (DISPATCH->FUNC == NULL) { \ - STATUS = STATUS_NOT_IMPLEMENTED; \ - } else { \ - RxDbgTrace(0, Dbg, ("MiniRdr Calldown - %s\n",#FUNC)); \ - STATUS = DISPATCH->FUNC ARGLIST; \ - } \ - } - -#define MINIRDR_CALL(STATUS,CONTEXT,DISPATCH,FUNC,ARGLIST) \ - { \ - ASSERT(DISPATCH); \ - ASSERT( NodeType(DISPATCH) == RDBSS_NTC_MINIRDR_DISPATCH ); \ - if ( DISPATCH->FUNC == NULL) { \ - STATUS = STATUS_NOT_IMPLEMENTED; \ - } else { \ - if (!BooleanFlagOn((CONTEXT)->Flags,RX_CONTEXT_FLAG_CANCELLED)) { \ - RxDbgTrace(0, Dbg, ("MiniRdr Calldown - %s\n",#FUNC)); \ - RtlZeroMemory(&((CONTEXT)->MRxContext[0]), \ - sizeof((CONTEXT)->MRxContext)); \ - STATUS = DISPATCH->FUNC ARGLIST; \ - } else { \ - STATUS = STATUS_CANCELLED; \ - } \ - } \ - } - - -// -// VOID -// RxWaitSync ( -// IN PRX_CONTEXT RxContext -// ) -// - -#define RxWaitSync( RxContext ) \ - RxDbgTrace(+1, Dbg, ("RxWaitSync, RxContext = %08lx\n", (RxContext))); \ - (RxContext)->Flags |= RX_CONTEXT_FLAG_SYNC_EVENT_WAITERS; \ - KeWaitForSingleObject( &(RxContext)->SyncEvent, \ - Executive, KernelMode, FALSE, NULL ); \ - RxDbgTrace(-1, Dbg, ("RxWaitSync -> VOID\n", 0 )) - -// -// VOID -// RxSignalSynchronousWaiter ( -// IN PRX_CONTEXT RxContext -// ) -// - -#define RxSignalSynchronousWaiter( RxContext ) \ - (RxContext)->Flags &= ~RX_CONTEXT_FLAG_SYNC_EVENT_WAITERS; \ - KeSetEvent( &(RxContext)->SyncEvent, 0, FALSE ) - - -#define RxInsertContextInSerializationQueue( SerializationQueue, RxContext ) \ - (RxContext)->Flags |= RX_CONTEXT_FLAG_IN_SERIALIZATION_QUEUE; \ - InsertTailList( SerializationQueue, &((RxContext)->RxContextSerializationQLinks )) - -INLINE -PRX_CONTEXT -RxRemoveFirstContextFromSerializationQueue ( - PLIST_ENTRY SerializationQueue - ) -{ - if (IsListEmpty( SerializationQueue )) { - return NULL; - } else { - PRX_CONTEXT Context = (PRX_CONTEXT)(CONTAINING_RECORD( SerializationQueue->Flink, - RX_CONTEXT, - RxContextSerializationQLinks )); - - RemoveEntryList( SerializationQueue->Flink ); - - Context->RxContextSerializationQLinks.Flink = NULL; - Context->RxContextSerializationQLinks.Blink = NULL; - return Context; - } -} - -// -// The following macros provide a mechanism for doing an en masse transfer -// from one list onto another. This provides a powerful paradigm for dealing -// with DPC level processing of lists. -// - -#define RxTransferList( Destination, Source ) \ - if (IsListEmpty( (Source) )) { \ - InitializeListHead( (Destination) ); \ - } else { \ - *(Destination) = *(Source); \ - (Destination)->Flink->Blink = (Destination); \ - (Destination)->Blink->Flink = (Destination); \ - InitializeListHead( (Source) ); \ - } - -#define RxTransferListWithMutex( Destination, Source, Mutex ) \ - { \ - ExAcquireFastMutex( Mutex ); \ - RxTransferList( Destination, Source ); \ - ExReleaseFastMutex( Mutex ); \ - } - - -VOID -RxInitializeRxContexter ( - VOID - ); - -VOID -RxUninitializeRxContexter ( - VOID - ); - -NTSTATUS -RxCancelNotifyChangeDirectoryRequestsForVNetRoot ( - PV_NET_ROOT VNetRoot, - BOOLEAN ForceFilesClosed - ); - -VOID -RxCancelNotifyChangeDirectoryRequestsForFobx ( - PFOBX Fobx - ); - -NTSTATUS -NTAPI -RxSetMinirdrCancelRoutine ( - IN OUT PRX_CONTEXT RxContext, - IN PMRX_CALLDOWN MRxCancelRoutine - ); - -VOID -NTAPI -RxInitializeContext ( - IN PIRP Irp, - IN PRDBSS_DEVICE_OBJECT RxDeviceObject, - IN ULONG InitialContextFlags, - IN OUT PRX_CONTEXT RxContext - ); - -PRX_CONTEXT -NTAPI -RxCreateRxContext ( - IN PIRP Irp, - IN PRDBSS_DEVICE_OBJECT RxDeviceObject, - IN ULONG InitialContextFlags - ); - -VOID -NTAPI -RxPrepareContextForReuse ( - IN OUT PRX_CONTEXT RxContext - ); - -VOID -NTAPI -RxDereferenceAndDeleteRxContext_Real ( - IN PRX_CONTEXT RxContext - ); - -VOID -NTAPI -RxReinitializeContext ( - IN OUT PRX_CONTEXT RxContext - ); - -#if DBG -#define RxDereferenceAndDeleteRxContext(RXCONTEXT) { \ - RxDereferenceAndDeleteRxContext_Real((RXCONTEXT)); \ - (RXCONTEXT) = NULL; \ -} -#else -#define RxDereferenceAndDeleteRxContext(RXCONTEXT) { \ - RxDereferenceAndDeleteRxContext_Real((RXCONTEXT)); \ -} -#endif // - -extern FAST_MUTEX RxContextPerFileSerializationMutex; - -NTSTATUS -NTAPI -__RxSynchronizeBlockingOperations ( - IN OUT PRX_CONTEXT RxContext, - IN PFCB Fcb, - IN OUT PLIST_ENTRY BlockingIoQ, - IN BOOLEAN DropFcbLock - ); -#define RxSynchronizeBlockingOperationsAndDropFcbLock(RXCONTEXT,FCB,IOQUEUE) \ - __RxSynchronizeBlockingOperations(RXCONTEXT,FCB,IOQUEUE,TRUE) -#define RxSynchronizeBlockingOperations(RXCONTEXT,FCB,IOQUEUE) \ - __RxSynchronizeBlockingOperations(RXCONTEXT,FCB,IOQUEUE,FALSE) - -VOID -NTAPI -RxResumeBlockedOperations_Serially ( - IN OUT PRX_CONTEXT RxContext, - IN OUT PLIST_ENTRY BlockingIoQ - ); - -VOID -RxResumeBlockedOperations_ALL ( - IN OUT PRX_CONTEXT RxContext - ); - - -VOID -RxCancelBlockingOperation ( - IN OUT PRX_CONTEXT RxContext, - IN PIRP Irp - ); - -VOID -RxRemoveOperationFromBlockingQueue ( - IN OUT PRX_CONTEXT RxContext - ); - -#endif // _RX_CONTEXT_STRUCT_DEFINED_ - - diff --git a/pub/ddk/rxdata.h b/pub/ddk/rxdata.h deleted file mode 100644 index e0c284e..0000000 --- a/pub/ddk/rxdata.h +++ /dev/null @@ -1,144 +0,0 @@ -/*++ - -Copyright (c) 1989 Microsoft Corporation - -Module Name: - - RxData.h - -Abstract: - - This module declares the global data used by the RDBSS file system. - -Author: -Revision History: - ---*/ - -#ifndef _RDBSSDATA_ -#define _RDBSSDATA_ - -// - -#ifndef MONOLITHIC_MINIRDR -extern PIO_WORKITEM RxIoWorkItem; -#endif - -extern RX_DISPATCHER RxDispatcher; -extern RX_WORK_QUEUE_DISPATCHER RxDispatcherWorkQueues; - -//this constants are the same as the versions in ntexapi.h -// but drivers are not supposed to import that! - -#define RX_PROCESSOR_ARCHITECTURE_INTEL 0 -#define RX_PROCESSOR_ARCHITECTURE_MIPS 1 -#define RX_PROCESSOR_ARCHITECTURE_ALPHA 2 -#define RX_PROCESSOR_ARCHITECTURE_PPC 3 -#define RX_PROCESSOR_ARCHITECTURE_UNKNOWN 0xffff - -// RX_CONTEXT serialization - -extern KMUTEX RxSerializationMutex; - -#define RxAcquireSerializationMutex() \ - KeWaitForSingleObject(&RxSerializationMutex,Executive,KernelMode,FALSE,NULL) - -#define RxReleaseSerializationMutex() \ - KeReleaseMutex(&RxSerializationMutex,FALSE) - -// -// The global fsd data record, and global large integer constants -// - -extern ULONG RxElapsedSecondsSinceStart; -extern NTSTATUS RxStubStatus; - -extern PRDBSS_DEVICE_OBJECT RxFileSystemDeviceObject; - -extern LARGE_INTEGER RxLargeZero; -extern LARGE_INTEGER RxMaxLarge; -extern LARGE_INTEGER Rx30Milliseconds; -extern LARGE_INTEGER RxOneSecond; -extern LARGE_INTEGER RxOneDay; -extern LARGE_INTEGER RxJanOne1980; -extern LARGE_INTEGER RxDecThirtyOne1979; - -// -// The status actually returned by the FsdDispatchStub.....usually not implemented -// - -extern NTSTATUS RxStubStatus; - -// -// The FCB for opens that refer to the device object directly or -// for file objects that reference nonFcbs (like treecons) -// - -extern FCB RxDeviceFCB; - - -#if 0 -// -// Define maximum number of parallel Reads or Writes that will be generated -// per one request. -// - -#define RDBSS_MAX_IO_RUNS_ON_STACK ((ULONG) 5) - -// -// Define the maximum number of delayed closes. -// - -#define RDBSS_MAX_DELAYED_CLOSES ((ULONG)16) - -extern ULONG RxMaxDelayedCloseCount; - -#endif //0 - -#if DBG - -// -// The following variables are used to keep track of the total amount -// of requests processed by the file system, and the number of requests -// that end up being processed by the Fsp thread. The first variable -// is incremented whenever an Irp context is created (which is always -// at the start of an Fsd entry point) and the second is incremented -// by read request. -// - -extern ULONG RxFsdEntryCount; -//extern ULONG RxFspEntryCount; -//extern ULONG RxIoCallDriverCount; -//extern ULONG RxTotalTicks[]; -extern ULONG RxIrpCodeCount[]; - - -#endif - - -// The list of active RxContexts being processed by the RDBSS - -extern LIST_ENTRY RxSrvCalldownList; -extern LIST_ENTRY RxActiveContexts; -__volatile extern LONG RxNumberOfActiveFcbs; - - -extern UNICODE_STRING s_PipeShareName; -extern UNICODE_STRING s_MailSlotShareName; -extern UNICODE_STRING s_MailSlotServerPrefix; -extern UNICODE_STRING s_IpcShareName; - -extern UNICODE_STRING s_PrimaryDomainName; - -// -// To allow NFS to run RDBSS on W2K, we now look up the kenel routine -// FsRtlTeardownPerStreamContexts dynamically at run time. -// This is the global variable that contains the function pointer or NULL -// if the routine could not be found (as on W2K. -// - -extern VOID (*RxTeardownPerStreamContexts)(IN PFSRTL_ADVANCED_FCB_HEADER AdvancedHeader); - -#endif // _RDBSSDATA_ - - diff --git a/pub/ddk/rxexcept.h b/pub/ddk/rxexcept.h deleted file mode 100644 index af5e071..0000000 --- a/pub/ddk/rxexcept.h +++ /dev/null @@ -1,140 +0,0 @@ -/*++ - -Copyright (c) 1994 Microsoft Corporation - -Module Name: - - Except.h - -Abstract: - - This module prototypes the macros and routines used for exception handling. - -Author: -Revision History: - ---*/ - -#ifndef _EXCEPTION_STUFF_DEFINED_ -#define _EXCEPTION_STUFF_DEFINED_ - - -// -// The following two macro are used by the Fsd/Fsp exception handlers to -// process an exception. The first macro is the exception filter used in the -// Fsd/Fsp to decide if an exception should be handled at this level. -// The second macro decides if the exception is to be finished off by -// completing the IRP, and cleaning up the Irp Context, or if we should -// bugcheck. Exception values such as RxStatus(FILE_INVALID) (raised by -// VerfySup.c) cause us to complete the Irp and cleanup, while exceptions -// such as accvio cause us to bugcheck. -// -// The basic structure for fsd/fsp exception handling is as follows: -// -// RxFsdXxx(...) -// { -// try { -// -// ... -// -// } except(RxExceptionFilter( RxContext, GetExceptionCode() )) { -// -// Status = RxProcessException( RxContext, GetExceptionCode() ); -// } -// -// Return Status; -// } -// -// To explicitly raise an exception that we expect, such as -// RxStatus(FILE_INVALID), use the below macro RxRaiseStatus(). To raise a -// status from an unknown origin (such as CcFlushCache()), use the macro -// RxNormalizeAndRaiseStatus. This will raise the status if it is expected, -// or raise RxStatus(UNEXPECTED_IO_ERROR) if it is not. -// -// Note that when using these two macros, the original status is placed in -// RxContext->ExceptionStatus, signaling RxExceptionFilter and -// RxProcessException that the status we actually raise is by definition -// expected. -// - -LONG -RxExceptionFilter ( - IN PRX_CONTEXT RxContext, - IN PEXCEPTION_POINTERS ExceptionPointer - ); - -NTSTATUS -RxProcessException ( - IN PRX_CONTEXT RxContext, - IN NTSTATUS ExceptionCode - ); - -#define CATCH_EXPECTED_EXCEPTIONS (FsRtlIsNtstatusExpected(GetExceptionCode()) ? \ - EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) - - -// -// VOID -// RxRaiseStatus ( -// IN PRIP_CONTEXT RxContext, -// IN NT_STATUS Status -// ); -// -// - -#define RxRaiseStatus(RXCONTEXT,STATUS) { \ - ASSERT((RXCONTEXT)!=NULL); \ - if (RxContext!=NULL) {(RXCONTEXT)->StoredStatus = (STATUS); } \ - ExRaiseStatus( (STATUS) ); \ -} - -// -// VOID -// RxNormalAndRaiseStatus ( -// IN PRIP_CONTEXT RxContext, -// IN NT_STATUS Status -// ); -// - -#define RxNormalizeAndRaiseStatus(RXCONTEXT,STATUS) { \ - ASSERT((RXCONTEXT)!=NULL); \ - if (RxContext!=NULL) {(RXCONTEXT)->StoredStatus = (STATUS); } \ - if ((STATUS) == (STATUS_VERIFY_REQUIRED)) { ExRaiseStatus((STATUS)); } \ - ExRaiseStatus(FsRtlNormalizeNtstatus((STATUS),(STATUS_UNEXPECTED_IO_ERROR))); \ -} - - -// -// The following macros are used to establish the semantics needed -// to do a return from within a try-finally clause. As a rule every -// try clause must end with a label call try_exit. For example, -// -// try { -// : -// : -// -// try_exit: NOTHING; -// } finally { -// -// : -// : -// } -// -// Every return statement executed inside of a try clause should use the -// try_return macro. If the compiler fully supports the try-finally construct -// then the macro should be -// -// #define try_return(S) { return(S); } -// -// If the compiler does not support the try-finally construct then the macro -// should be -// -// #define try_return(S) { S; goto try_exit; } -// - -#define try_return(S) { S; goto try_exit; } - - - -#endif // _EXCEPTION_STUFF_DEFINED_ - diff --git a/pub/ddk/rxlog.h b/pub/ddk/rxlog.h deleted file mode 100644 index 87c964f..0000000 --- a/pub/ddk/rxlog.h +++ /dev/null @@ -1,141 +0,0 @@ -/*++ - -Copyright (c) 1989 Microsoft Corporation - -Module Name: - - RxLog.h - -Abstract: - - This module declares the prototypes and global data used by the RDBSS debug logging facilities. - -Author: -Notes: - - The log records are stored in a circular buffer. Each record is bounded on either side by - a record descriptor. This record descriptor is four bytes long. - ---*/ - -#ifndef _RDBSSLOG_INCLUDED_ -#define _RDBSSLOG_INCLUDED_ - - -typedef enum { - RX_LOG_UNINITIALIZED, - RX_LOG_ENABLED, - RX_LOG_DISABLED, - RX_LOG_ERROR -} RX_LOGGING_STATE; - -typedef struct RX_LOG_ENTRY_HEADER { - PCHAR Buffer; -} RX_LOG_ENTRY_HEADER, *PRX_LOG_ENTRY_HEADER; - - -typedef struct RX_LOG { - RX_SPIN_LOCK SpinLock; - RX_LOGGING_STATE State; - PRX_LOG_ENTRY_HEADER CurrentEntry; - PRX_LOG_ENTRY_HEADER BaseEntry; - PRX_LOG_ENTRY_HEADER EntryLimit; - ULONG LogBufferSizeInEntries; - ULONG NumberOfEntriesIgnored; - ULONG NumberOfLogWriteAttempts; - ULONG NumberOfLogWraps; -} RX_LOG, *PRX_LOG; - - -//the logging facilities are always present. what RDBSSLOG does is to enable generation -//of the calls! on checked builds, you even get the calls unless NO_RDBSSLOG is set. - -//extern -//VOID -//RxLogInterlockedAddUlong( -// PULONG Result, -// PULONG Counter, -// ULONG Addend); - -extern -VOID -RxDebugControlCommand ( - __in PSTR ControlString - ); - -extern -NTSTATUS -RxInitializeLog(void); - -extern -VOID -RxUninitializeLog(void); - -extern -VOID -_RxPrintLog(IN ULONG EntriesToPrint OPTIONAL); - -extern -VOID -_RxPauseLog(void); - -extern -VOID -_RxResumeLog (void); - -extern -VOID -_RxLog(PCSTR format, ...); - - -#define MAX_RX_LOG_ENTRY_SIZE (48) - -#define RDBSSLOG_ASYNC_NAME_PREFIX "[nowait]" -#define RXCONTX_OPERATION_NAME(MajorFunction,Wait) \ - (RxContxOperationNames[(MajorFunction)]+((Wait)?(sizeof(RDBSSLOG_ASYNC_NAME_PREFIX)-1):0)) -extern PUCHAR RxContxOperationNames[]; - -#ifdef RDBSSLOG - - // -// The arguments to RxLog must be enclosed with an additional pair of parenthesis to enable -// transalation into a null call when logging should be turned off. -// e.g. RxLog(("%s %d", FILE, LINE)) -#if DBG -#define RxLog(Args) _RxLog##Args -#define RxLogRetail(Args) _RxLog##Args -#else -#define RxLogRetail(Args) _RxLog##Args -#define RxLog(Args) {NOTHING;} -#endif - -#define RxPauseLog() _RxPauseLog() -#define RxResumeLog() _RxResumeLog() - -#else //if notdef RDBSSLOG - -#define RxLog(Args) {NOTHING;} -#define RxLogRetail(Args) {NOTHING;} -#define RxPauseLog() {NOTHING;} -#define RxResumeLog() {NOTHING;} - -#endif - -#if DBG -#define RxDbgPrint(Args) DbgPrint##Args -#else -#define RxDbgPrint(Args) NOTHING -#endif - -extern LIST_ENTRY RxIrpsList; -extern KSPIN_LOCK RxIrpsListSpinLock; - -typedef struct _RX_IRP_LIST_ITEM { - LIST_ENTRY IrpsList; - PIRP pIrp; - PMDL CopyDataBuffer; - ULONG Completed; -} RX_IRP_LIST_ITEM, *PRX_IRP_LIST_ITEM; - -#endif // _RDBSSLOG_INCLUDED_ - diff --git a/pub/ddk/rxovride.h b/pub/ddk/rxovride.h deleted file mode 100644 index bf7587c..0000000 --- a/pub/ddk/rxovride.h +++ /dev/null @@ -1,73 +0,0 @@ -/*++ - -Copyright (c) 1989 Microsoft Corporation - -Module Name: - - rxovride.h - -Abstract: - - This file has two purposes. First, things that are absolutely global are included here; a macro - NO_RXOVRIDE_GLOBAL maybe defined to get only the second behaviour. - - Second, this file is used as a shortterm expedient to ensure that the logging version of the wrapper, - smbmini and rdr2kd is built irrespective of the build environment. indeed, all of the debugging issues - can be enabled disabled from here instead of juggling all of the sources files. to override what it says - in this file...define RX_BUILD_FREE_ANYWAY. - -Author: -Revision History: - -Notes: - - - ---*/ -#ifndef NO_RXOVRIDE_GLOBAL - -// define pointer types for all of the important structures.......... -#include // RDBSS related definitions - -#endif //ifndef NO_RXOVRIDE_GLOBAL - - -//control the debugging state of the built components -#define RDBSS_TRACKER 1 - -#if !DBG -#define RX_ORIGINAL_DBG 0 -#else -#define RX_ORIGINAL_DBG 1 -#endif - -#if 0 -#ifndef RDBSSTRACE -#define RDBSSTRACE 1 -#endif //ifndef RDBSSTRACE -#endif - -#ifndef RX_POOL_WRAPPER -#define RX_POOL_WRAPPER 1 -#endif //ifndef RX_POOL_WRAPPER - -#ifndef RDBSS_ASSERTS -#define RDBSS_ASSERTS 1 -#endif //ifndef RDBSS_ASSERTS - -#if DBG - -#ifndef RDBSSLOG -#define RDBSSLOG 1 -#endif //ifndef RDBSSLOG - -#else // DBG - -#if PRERELEASE -#ifndef RDBSSLOG -#define RDBSSLOG 1 -#endif //ifndef RDBSSLOG -#endif // if PRERELEASE - -#endif // if DBG - diff --git a/pub/ddk/rxprocs.h b/pub/ddk/rxprocs.h deleted file mode 100644 index 32f15fa..0000000 --- a/pub/ddk/rxprocs.h +++ /dev/null @@ -1,1541 +0,0 @@ - -/*++ - -Copyright (c) 1989 Microsoft Corporation - -Module Name: - - RxProcs.h - -Abstract: - - This module defines all of the globally used procedures in the RDBSS - file system. - -Author: -Revision History: - ---*/ - -#ifndef _RDBSSPROCS_ -#define _RDBSSPROCS_ - -#include "rx.h" -#include "backpack.h" -#include "RxTypes.h" -#include "RxLog.h" -#include "RxTrace.h" -#include "RxTimer.h" -#include "RxStruc.h" - -extern PVOID RxNull; - -// -// The following macro is for all people who compile with the DBG switch -// set, not just rdbss dbg users -// - -#if DBG - -#define DbgDoit(X) {X;} -#define DebugDoit(X) {X;} -#define DEBUG_ONLY_DECL(X) X - -#else - -#define DbgDoit(X) {NOTHING;} -#define DebugDoit(X) {NOTHING;} -#define DEBUG_ONLY_DECL(X) - -#endif // DBG - - -// -// utilities -// - - -// -// Routines for writing error log entries. -// - -/*++ - - RxLogFailure, RxLogFailureWithBuffer can be used to record an event in - the log. The RxLogFailure, RxLogFailureWithBuffer captures the line - number alongwith the supplied information and writes it to the log. This - is useful in debugging. RxLogFailureDirect, RxLogBufferDirect do not - capture the line number - - RxlogEvent is useful for writing events into the log. - ---*/ -#define RxLogFailure( _DeviceObject, _OriginatorId, _EventId, _Status ) \ - RxLogEventDirect( _DeviceObject, _OriginatorId, _EventId, _Status, __LINE__ ) - -#define RxLogFailureWithBuffer( _DeviceObject, _OriginatorId, _EventId, _Status, _Buffer, _Length ) \ - RxLogEventWithBufferDirect( _DeviceObject, _OriginatorId, _EventId, _Status, _Buffer, _Length, __LINE__ ) - -#define RxLogEvent( _DeviceObject, _OriginatorId, _EventId, _Status) \ - RxLogEventDirect(_DeviceObject, _OriginatorId, _EventId, _Status, __LINE__) - -VOID -RxLogEventDirect ( - IN PRDBSS_DEVICE_OBJECT DeviceObject, - IN PUNICODE_STRING OriginatorId, - IN ULONG EventId, - IN NTSTATUS Status, - IN ULONG Line - ); - -VOID -RxLogEventWithBufferDirect ( - IN PVOID DeviceOrDriverObject, - IN PUNICODE_STRING OriginatorId, - IN ULONG EventId, - IN NTSTATUS Status, - IN PVOID DataBuffer, - IN USHORT DataBufferLength, - IN ULONG LineNumber - ); - -VOID -RxLogEventWithAnnotation ( - IN PRDBSS_DEVICE_OBJECT DeviceObject, - IN ULONG EventId, - IN NTSTATUS Status, - IN PVOID DataBuffer, - IN USHORT DataBufferLength, - IN PUNICODE_STRING Annotation, - IN ULONG AnnotationCount - ); - -BOOLEAN -RxCcLogError ( - IN PDEVICE_OBJECT DeviceObject, - IN PUNICODE_STRING FileName, - IN NTSTATUS Error, - IN NTSTATUS DeviceError, - IN UCHAR IrpMajorCode, - IN PVOID Context - ); - -// -// in create.c -// - -NTSTATUS -RxPrefixClaim ( - IN PRX_CONTEXT RxContext - ); - -VOID -RxpPrepareCreateContextForReuse ( - PRX_CONTEXT RxContext - ); - -// -// in devfcb.c -// - -LUID -RxGetUid ( - IN PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext - ); - -ULONG -RxGetSessionId ( - IN PIO_STACK_LOCATION IrpSp - ); - -NTSTATUS -RxFindOrCreateConnections ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp, - IN PUNICODE_STRING CanonicalName, - IN NET_ROOT_TYPE NetRootType, - IN BOOLEAN TreeConnect, - OUT PUNICODE_STRING LocalNetRootName, - OUT PUNICODE_STRING FilePathName, - IN OUT PLOCK_HOLDING_STATE LockHoldingState, - IN PRX_CONNECTION_ID RxConnectionId - ); - -NTSTATUS -RxFindOrCreateVNetRoot ( - PRX_CONTEXT RxContext, - PUNICODE_STRING CanonicalName, - NET_ROOT_TYPE NetRootType, - PV_NET_ROOT *VirtualNetRootPointer, - PLOCK_HOLDING_STATE *LockHoldingState - ); - -// -// in fileinfo.c -// - -typedef enum _RX_NAME_CONJURING_METHODS { - VNetRoot_As_Prefix, - VNetRoot_As_UNC_Name, - VNetRoot_As_DriveLetter -} RX_NAME_CONJURING_METHODS; - - -VOID -RxConjureOriginalName ( - __inout PFCB Fcb, - __inout PFOBX Fobx, - __out PULONG ActualNameLength, - __out_bcount( *LengthRemaining) PWCHAR OriginalName, - __inout PLONG LengthRemaining, - __in RX_NAME_CONJURING_METHODS NameConjuringMethod - ); - -// -// A function that returns finished denotes if it was able to complete the -// operation (TRUE) or could not complete the operation (FALSE) because the -// wait value stored in the irp context was false and we would have had -// to block for a resource or I/O -// - -// -// Buffer control routines for data caching, implemented in CacheSup.c -// - -BOOLEAN -RxZeroData ( - IN PRX_CONTEXT RxContext, - IN PVCB Vcb, - IN PFILE_OBJECT FileObject, - IN ULONG StartingZero, - IN ULONG ByteCount - ); - -NTSTATUS -RxCompleteMdl ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp - ); - - -VOID -RxSyncUninitializeCacheMap ( - IN PRX_CONTEXT RxContext, - IN PFILE_OBJECT FileObject - ); - -VOID -RxLockUserBuffer ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp, - IN LOCK_OPERATION Operation, - IN ULONG BufferLength - ); - -PVOID -RxMapSystemBuffer ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp - ); - -PVOID -RxMapUserBuffer ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp - ); - -#define RxUpcaseEaName(RXCONTEXT,NAME,UPCASEDNAME) \ - RtlUpperString( UPCASEDNAME, NAME ) - - -#ifdef RDBSS_TRACKER -#define RX_FCBTRACKER_PARAMS ,ULONG LineNumber,PSZ FileName,ULONG SerialNumber -#else -#define RX_FCBTRACKER_PARAMS -#endif - -#define FCB_MODE_EXCLUSIVE (1) -#define FCB_MODE_SHARED (2) -#define FCB_MODE_SHARED_WAIT_FOR_EXCLUSIVE (3) -#define FCB_MODE_SHARED_STARVE_EXCLUSIVE (4) - -#define CHANGE_BUFFERING_STATE_CONTEXT ((PRX_CONTEXT)IntToPtr(0xffffffff)) -#define CHANGE_BUFFERING_STATE_CONTEXT_WAIT ((PRX_CONTEXT)IntToPtr(0xfffffffe)) - -// -// NOTE: even though the following routine pass a serial number, this parameter is not used -// - -NTSTATUS -__RxAcquireFcb( - __inout PFCB Fcb, - __inout_opt PRX_CONTEXT RxContext OPTIONAL, - __in ULONG Mode - -#ifdef RDBSS_TRACKER - , - __in ULONG LineNumber, - __in PCSTR FileName, - __in ULONG SerialNumber -#endif - - ); - - -#ifdef RDBSS_TRACKER -#define RxAcquireExclusiveFcb(RXCONTEXT,FCB) \ - __RxAcquireFcb((FCB),(RXCONTEXT),FCB_MODE_EXCLUSIVE,__LINE__,__FILE__,0) -#else -#define RxAcquireExclusiveFcb(RXCONTEXT,FCB) \ - __RxAcquireFcb((FCB),(RXCONTEXT),FCB_MODE_EXCLUSIVE) -#endif - -#define RX_GET_MRX_FCB(FCB) ((PMRX_FCB)((FCB))) - -#ifdef RDBSS_TRACKER -#define RxAcquireSharedFcb(RXCONTEXT,FCB) \ - __RxAcquireFcb((FCB),(RXCONTEXT),FCB_MODE_SHARED,__LINE__,__FILE__,0) -#else -#define RxAcquireSharedFcb(RXCONTEXT,FCB) \ - __RxAcquireFcb((FCB),(RXCONTEXT),FCB_MODE_SHARED) -#endif - -#ifdef RDBSS_TRACKER -#define RxAcquireSharedFcbWaitForEx(RXCONTEXT,FCB) \ - __RxAcquireFcb((FCB),(RXCONTEXT),FCB_MODE_SHARED_WAIT_FOR_EXCLUSIVE,__LINE__,__FILE__,0) -#else -#define RxAcquireSharedFcbWaitForEx(RXCONTEXT,FCB) \ - __RxAcquireFcb((FCB),(RXCONTEXT),FCB_MODE_SHARED_WAIT_FOR_EXCLUSIVE) -#endif - -#ifdef RDBSS_TRACKER -#define RxAcquireSharedFcbStarveEx(RXCONTEXT,FCB) \ - __RxAcquireFcb((FCB),(RXCONTEXT),FCB_MODE_SHARED_STARVE_EXCLUSIVE,__LINE__,__FILE__,0) -#else -#define RxAcquireSharedFcbStarveEx(RXCONTEXT,FCB) \ - __RxAcquireFcb((FCB),(RXCONTEXT),FCB_MODE_SHARED_STARVE_EXCLUSIVE) -#endif - -VOID -__RxReleaseFcb( - __inout_opt PRX_CONTEXT RxContext, - __inout PMRX_FCB MrxFcb - -#ifdef RDBSS_TRACKER - , - __in ULONG LineNumber, - __in PCSTR FileName, - __in ULONG SerialNumber -#endif - - ); - -#ifdef RDBSS_TRACKER -#define RxReleaseFcb(RXCONTEXT,FCB) \ - __RxReleaseFcb((RXCONTEXT),RX_GET_MRX_FCB(FCB),__LINE__,__FILE__,0) -#else -#define RxReleaseFcb(RXCONTEXT,FCB) \ - __RxReleaseFcb((RXCONTEXT),RX_GET_MRX_FCB(FCB)) -#endif - - -VOID -__RxReleaseFcbForThread( - __inout_opt PRX_CONTEXT RxContext, - __inout PMRX_FCB MrxFcb, - __in ERESOURCE_THREAD ResourceThreadId - -#ifdef RDBSS_TRACKER - , - __in ULONG LineNumber, - __in PCSTR FileName, - __in ULONG SerialNumber -#endif - - ); - -#ifdef RDBSS_TRACKER -#define RxReleaseFcbForThread(RXCONTEXT,FCB,THREAD) \ - __RxReleaseFcbForThread((RXCONTEXT),RX_GET_MRX_FCB(FCB),(THREAD),__LINE__,__FILE__,0) -#else -#define RxReleaseFcbForThread(RXCONTEXT,FCB,THREAD) \ - __RxReleaseFcbForThread((RXCONTEXT),RX_GET_MRX_FCB(FCB),(THREAD)) -#endif - - -#ifdef RDBSS_TRACKER -VOID RxTrackerUpdateHistory ( - __inout_opt PRX_CONTEXT RxContext, - __inout PMRX_FCB MrxFcb, - __in ULONG Operation, - __in ULONG LineNumber, - __in PCSTR FileName, - __in ULONG SerialNumber - ); -#else -#define RxTrackerUpdateHistory(xRXCONTEXT,xFCB,xOPERATION,xLINENUM,xFILENAME,xSERIALNUMBER) {NOTHING;} -#endif - -VOID -RxTrackPagingIoResource ( - __inout PVOID Instance, - __in ULONG Type, - __in ULONG Line, - __in PCSTR File - ); - -// -// this definition is old......i don't like the format -// - -#define RxFcbAcquiredShared( RXCONTEXT, FCB ) ( \ - ExIsResourceAcquiredSharedLite( (FCB)->Header.Resource ) \ -) - -#define RxIsFcbAcquiredShared( FCB ) ( \ - ExIsResourceAcquiredSharedLite( (FCB)->Header.Resource ) \ -) - -#define RxIsFcbAcquiredExclusive( FCB ) ( \ - ExIsResourceAcquiredExclusiveLite( (FCB)->Header.Resource ) \ -) - -#define RxIsFcbAcquired( FCB) ( \ - ExIsResourceAcquiredSharedLite( (FCB)->Header.Resource ) | \ - ExIsResourceAcquiredExclusiveLite( (FCB)->Header.Resource ) \ -) - -#define RxAcquirePagingIoResource( RXCONTEXT, FCB ) \ - ExAcquireResourceExclusiveLite( (FCB)->Header.PagingIoResource, TRUE ); \ - if (RXCONTEXT) { \ - ((PRX_CONTEXT)RXCONTEXT)->FcbPagingIoResourceAcquired = TRUE; \ - } \ - RxTrackPagingIoResource( FCB, 1, __LINE__, __FILE__ ) \ - -#define RxAcquirePagingIoResourceShared( RXCONTEXT, FCB, FLAG ) \ - ExAcquireResourceSharedLite( (FCB)->Header.PagingIoResource, FLAG ); \ - if (AcquiredFile) { \ - if (RXCONTEXT) { \ - ((PRX_CONTEXT)RXCONTEXT)->FcbPagingIoResourceAcquired = TRUE; \ - } \ - RxTrackPagingIoResource( FCB, 2, __LINE__, __FILE__ ); \ - } - -#define RxReleasePagingIoResource( RXCONTEXT, FCB ) \ - RxTrackPagingIoResource( FCB, 3, __LINE__, __FILE__ ); \ - if (RXCONTEXT) { \ - ((PRX_CONTEXT)RXCONTEXT)->FcbPagingIoResourceAcquired = FALSE; \ - } \ - ExReleaseResourceLite( (FCB)->Header.PagingIoResource ) - -#define RxReleasePagingIoResourceForThread( RXCONTEXT, FCB, THREAD ) \ - RxTrackPagingIoResource( FCB, 3, __LINE__, __FILE__ ); \ - if (RXCONTEXT) { \ - ((PRX_CONTEXT)RXCONTEXT)->FcbPagingIoResourceAcquired = FALSE; \ - } \ - ExReleaseResourceForThreadLite( (FCB)->Header.PagingIoResource, (THREAD) ) - - -// The following are cache manager call backs - -BOOLEAN -RxAcquireFcbForLazyWrite ( - IN PVOID Null, - IN BOOLEAN Wait - ); - -VOID -RxReleaseFcbFromLazyWrite ( - IN PVOID Null - ); - -BOOLEAN -RxAcquireFcbForReadAhead ( - IN PVOID Null, - IN BOOLEAN Wait - ); - -VOID -RxReleaseFcbFromReadAhead ( - IN PVOID Null - ); - -BOOLEAN -RxNoOpAcquire ( - IN PVOID Fcb, - IN BOOLEAN Wait - ); - -VOID -RxNoOpRelease ( - IN PVOID Fcb - ); - -NTSTATUS -RxAcquireForCcFlush ( - IN PFILE_OBJECT FileObject, - IN PDEVICE_OBJECT DeviceObject - ); - -NTSTATUS -RxReleaseForCcFlush ( - IN PFILE_OBJECT FileObject, - IN PDEVICE_OBJECT DeviceObject - ); - -// -// VOID -// RxConvertToSharedFcb ( -// IN PRX_CONTEXT RxContext, -// IN PFCB Fcb -// ); -// - -#define RxConvertToSharedFcb(RXCONTEXT,FCB) { \ - ExConvertExclusiveToSharedLite( RX_GET_MRX_FCB(FCB)->Header.Resource ); \ - } - -VOID -RxVerifyOperationIsLegal ( - IN PRX_CONTEXT RxContext - ); - -// -// Work queue routines for posting and retrieving an Irp, implemented in -// workque.c -// - -VOID -RxPrePostIrp ( - IN PVOID Context, - IN PIRP Irp - ); - -VOID -RxAddToWorkque ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp - ); - -NTSTATUS -RxFsdPostRequest ( - IN PRX_CONTEXT RxContext - ); - -#define RxFsdPostRequestWithResume(RXCONTEXT,RESUMEROUTINE) \ - (((RXCONTEXT)->ResumeRoutine = (RESUMEROUTINE)), \ - RxFsdPostRequest( (RXCONTEXT) ) \ - ) - -VOID -RxInitializeMRxCalldownContext ( - PMRX_CALLDOWN_CONTEXT Context, - PRDBSS_DEVICE_OBJECT MRxDeviceObject, - PMRX_CALLDOWN_ROUTINE Routine, - PVOID Parameter - ); - -NTSTATUS -RxCalldownMiniRedirectors ( - LONG NumberOfMiniRdrs, - PMRX_CALLDOWN_CONTEXT CalldownContext, - BOOLEAN PostCalldowns - ); - -// -// This macro takes a ulong and returns its rounded up word value -// - -#define WordAlign(Val) ( \ - ALIGN_UP( Val, WORD ) \ - ) - -// -// This macro takes a pointer and returns a ULONG_PTR representation of -// its rounded up word value -// - -#define WordAlignPtr(Ptr) ( \ - ALIGN_UP_POINTER( Ptr, WORD ) \ - ) - -// -// This macro takes a ulong and returns its rounded up longword value -// - -#define LongAlign(Val) ( \ - ALIGN_UP( Val, LONG ) \ - ) - -// -// This macro takes a pointer and returns a ULONG_PTR representation of -// its rounded up word value -// - -#define LongAlignPtr(Ptr) ( \ - ALIGN_UP_POINTER( Ptr, LONG ) \ - ) - -// -// This macro takes a ulong and returns its rounded up quadword -// value -// - -#define QuadAlign(Val) ( \ - ALIGN_UP( Val, ULONGLONG ) \ - ) - -// -// This macro takes a pointer and returns a ULONG_PTR representation of -// its rounded up quadword value -// - -#define QuadAlignPtr(Ptr) ( \ - ALIGN_UP_POINTER( Ptr, ULONGLONG ) \ - ) - -// -// This macro takes a pointer and returns whether it's quadword-aligned -// - -#define IsPtrQuadAligned(Ptr) ( \ - QuadAlignPtr(Ptr) == (PVOID)(Ptr) \ - ) - -// -// The following types and macros are used to help unpack the packed and -// misaligned fields found in the Bios parameter block -// - -typedef union _UCHAR1 { - UCHAR Uchar[1]; - UCHAR ForceAlignment; -} UCHAR1, *PUCHAR1; - -typedef union _UCHAR2 { - UCHAR Uchar[2]; - USHORT ForceAlignment; -} UCHAR2, *PUCHAR2; - -typedef union _UCHAR4 { - UCHAR Uchar[4]; - ULONG ForceAlignment; -} UCHAR4, *PUCHAR4; - -// -// This macro copies an unaligned src byte to an aligned dst byte -// - -#define CopyUchar1(Dst,Src) { \ - *((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \ - } - -// -// This macro copies an unaligned src word to an aligned dst word -// - -#define CopyUchar2(Dst,Src) { \ - *((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \ - } - -// -// This macro copies an unaligned src longword to an aligned dsr longword -// - -#define CopyUchar4(Dst,Src) { \ - *((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \ - } - -#define CopyU4char(Dst,Src) { \ - *((UNALIGNED UCHAR4 *)(Dst)) = *((UCHAR4 *)(Src)); \ - } - -// -// the wrapper doesn't yet implement notify and oplock. rather than remove the code -// we define the calls in such a way as to Noop the effects so that we'll have a head -// start on putting it back later... -// - - -/* this is a macro definition we'll reenable when we implement oplocks and notifies -// -// VOID -// RxNotifyReportChange ( -// IN PRX_CONTEXT RxContext, -// IN PVCB Vcb, -// IN PFCB Fcb, -// IN ULONG Filter, -// IN ULONG Action -// ); -// - -#define RxNotifyReportChange(I,V,F,FL,A) { \ - if ((F)->FullFileName.Buffer == NULL) { \ - RxSetFullFileNameInFcb((I),(F)); \ - } \ - FsRtlNotifyFullReportChange( (V)->NotifySync, \ - &(V)->DirNotifyList, \ - (PSTRING)&(F)->FullFileName, \ - (USHORT) ((F)->FullFileName.Length - \ - (F)->FinalNameLength), \ - (PSTRING)NULL, \ - (PSTRING)NULL, \ - (ULONG)FL, \ - (ULONG)A, \ - (PVOID)NULL ); \ -} -*/ -#define RxNotifyReportChange(I,V,F,FL,A) \ - RxDbgTrace(0, Dbg, ("RxNotifyReportChange PRETENDING Fcb %08lx %wZ Filter/Action = %08lx/%08lx\n", \ - (F),&((F)->FcbTableEntry.Path),(FL),(A))) - -#if 0 -#define FsRtlNotifyFullChangeDirectory(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) \ - RxDbgTrace(0, Dbg, ("FsRtlNotifyFullReportChange PRETENDING ............\n",0)) -#endif - -#define FsRtlCheckOplock(A1,A2,A3,A4,A5) \ - (STATUS_SUCCESS) - -#define FsRtlOplockIsFastIoPossible(__a) (TRUE) - -// -// The following procedure is used by the FSP and FSD routines to complete -// an IRP. -// -// Note that this macro allows either the Irp or the RxContext to be -// null, however the only legal order to do this in is: -// -// RxCompleteRequest_OLD( NULL, Irp, Status ); // completes Irp & preserves context -// ... -// RxCompleteRequest_OLD( RxContext, NULL, DontCare ); // deallocates context -// -// This would typically be done in order to pass a "naked" RxContext off to -// the Fsp for post processing, such as read ahead. -// -// The new way is to pass just the RxContext.......... -// - -VOID -RxCompleteRequest_Real ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp, - IN NTSTATUS Status - ); - -#if DBG -#define RxCompleteRequest_OLD(RXCONTEXT,IRP,STATUS) { \ - RxCompleteRequest_Real( RXCONTEXT, IRP, STATUS); \ - (IRP) = NULL; \ - (RXCONTEXT) = NULL; \ -} -#else -#define RxCompleteRequest_OLD(RXCONTEXT,IRP,STATUS ) { \ - RxCompleteRequest_Real( RXCONTEXT, IRP, STATUS ); \ -} -#endif - -NTSTATUS -RxCompleteRequest( - PRX_CONTEXT pContext, - NTSTATUS Status); - -#define RxCompleteAsynchronousRequest(RXCONTEXT,STATUS) \ - RxCompleteRequest(RXCONTEXT,STATUS) - -#define RxCompleteContextAndReturn(STATUS) { \ - NTSTATUS __sss = (STATUS); \ - RxCompleteRequest(RxContext,__sss); \ - return(__sss);} -#define RxCompleteContext(STATUS) { \ - NTSTATUS __sss = (STATUS); \ - RxCompleteRequest(RxContext,__sss);} \ - -// -// The Following routine makes a popup -// - -VOID -RxPopUpFileCorrupt ( - IN PRX_CONTEXT RxContext, - IN PFCB Fcb - ); - -NTSTATUS -RxConstructSrvCall ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp, - IN PSRV_CALL SrvCall, - OUT PLOCK_HOLDING_STATE LockHoldingState - ); - -NTSTATUS -RxSetSrvCallDomainName ( - IN PMRX_SRV_CALL SrvCall, - IN PUNICODE_STRING DomainName - ); - -NTSTATUS -RxConstructNetRoot ( - IN PRX_CONTEXT RxContext, - IN PSRV_CALL SrvCall, - IN PNET_ROOT NetRoot, - IN PV_NET_ROOT VirtualNetRoot, - OUT PLOCK_HOLDING_STATE LockHoldingState - ); - -NTSTATUS -RxConstructVirtualNetRoot ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp, - IN PUNICODE_STRING CanonicalName, - IN NET_ROOT_TYPE NetRootType, - IN BOOLEAN TreeConnect, - OUT PV_NET_ROOT *VirtualNetRootPointer, - OUT PLOCK_HOLDING_STATE LockHoldingState, - OUT PRX_CONNECTION_ID RxConnectionId - ); - -NTSTATUS -RxFindOrConstructVirtualNetRoot ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp, - IN PUNICODE_STRING CanonicalName, - IN NET_ROOT_TYPE NetRootType, - IN PUNICODE_STRING RemainingName - ); - -NTSTATUS -RxLowIoFsCtlShell ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp, - IN PFCB Fcb, - IN PFOBX Fobx - ); - -NTSTATUS -RxLowIoFsCtlShellCompletion ( - IN PRX_CONTEXT RxContext - ); - - -NTSTATUS -RxLowIoLockControlShell ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp, - IN PFCB Fcb - ); - -NTSTATUS -RxShadowLowIo ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp, - IN PFCB Fcb - ); - -NTSTATUS -RxShadowFastLowIo ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp - ); - -NTSTATUS -RxChangeBufferingState ( - PSRV_OPEN SrvOpen, - PVOID Context, - BOOLEAN ComputeNewState - ); - -VOID -RxAssociateSrvOpenKey ( - PMRX_SRV_OPEN MRxSrvOpen, - PVOID SrvOpenKey - ); - -VOID -RxIndicateChangeOfBufferingState ( - PMRX_SRV_CALL SrvCall, - PVOID SrvOpenKey, - PVOID Context - ); - -VOID -RxIndicateChangeOfBufferingStateForSrvOpen ( - PMRX_SRV_CALL SrvCall, - PMRX_SRV_OPEN SrvOpen, - PVOID SrvOpenKey, - PVOID Context - ); - -NTSTATUS -RxPrepareToReparseSymbolicLink ( - PRX_CONTEXT RxContext, - BOOLEAN SymbolicLinkEmbeddedInOldPath, - PUNICODE_STRING NewPath, - BOOLEAN NewPathIsAbsolute, - PBOOLEAN ReparseRequired - ); - -BOOLEAN -RxLockEnumerator ( - IN OUT PMRX_SRV_OPEN SrvOpen, - IN OUT PVOID *ContinuationHandle, - OUT PLARGE_INTEGER FileOffset, - OUT PLARGE_INTEGER LockRange, - OUT PBOOLEAN IsLockExclusive - ); - -// -// Routines for transitioning data structures to stable states. -// - -VOID -RxReference ( - IN OUT PVOID Instance - ); - -VOID -RxDereference ( - IN OUT PVOID Instance, - IN LOCK_HOLDING_STATE LockHoldingState - ); - -VOID -RxWaitForStableCondition ( - IN PRX_BLOCK_CONDITION Condition, - IN OUT PLIST_ENTRY TransitionWaitList, - IN OUT PRX_CONTEXT RxContext, - OUT NTSTATUS *AsyncStatus OPTIONAL - ); - -VOID -RxUpdateCondition ( - IN RX_BLOCK_CONDITION NewConditionValue, - OUT PRX_BLOCK_CONDITION Condition, - IN OUT PLIST_ENTRY TransitionWaitList - ); - -VOID -RxFinalizeNetTable ( - IN PRDBSS_DEVICE_OBJECT RxDeviceObject, - IN BOOLEAN ForceFinalization - ); - -#define RxForceNetTableFinalization(RxDeviceObject) RxFinalizeNetTable( RxDeviceObject, TRUE ) - -NTSTATUS -RxCloseAssociatedSrvOpen ( - IN PRX_CONTEXT RxContext OPTIONAL, - IN PFOBX Fobx - ); - -NTSTATUS -RxFinalizeConnection ( - IN OUT PNET_ROOT NetRoot, - IN OUT PV_NET_ROOT VNetRoot OPTIONAL, - IN LOGICAL ForceFilesClosed - ); - -// -// routines for manipulating the user's view and the server's view of SHARE_ACCESS. -// the user's view is supported by routines exported by Io...the wrappers just allow -// us to get a msg. the server's view is supported by routines that are essential just -// copies of the Io routines EXCEPT that the Io routines work directly on fileobjects and -// as such cannot be used directly. the routines mentioned are implemented in create.c -// - -#if DBG -VOID -RxDumpWantedAccess ( - PSZ where1, - PSZ where2, - PSZ wherelogtag, - IN ACCESS_MASK DesiredAccess, - IN ULONG DesiredShareAccess - ); - -VOID -RxDumpCurrentAccess ( - PSZ where1, - PSZ where2, - PSZ wherelogtag, - PSHARE_ACCESS ShareAccess - ); - -#else -#define RxDumpWantedAccess(w1,w2,wlt,DA,DSA) {NOTHING;} -#define RxDumpCurrentAccess(w1,w2,wlt,SA) {NOTHING;} -#endif - -NTSTATUS -RxCheckShareAccessPerSrvOpens ( - IN PFCB Fcb, - IN ACCESS_MASK DesiredAccess, - IN ULONG DesiredShareAccess - ); - - -VOID -RxUpdateShareAccessPerSrvOpens ( - IN PSRV_OPEN SrvOpen - ); - -VOID -RxRemoveShareAccessPerSrvOpens ( - IN OUT PSRV_OPEN SrvOpen - ); - -VOID -RxRemoveShareAccessPerSrvOpens ( - IN OUT PSRV_OPEN SrvOpen - ); - - -#if DBG -NTSTATUS -RxCheckShareAccess ( - IN ACCESS_MASK DesiredAccess, - IN ULONG DesiredShareAccess, - IN OUT PFILE_OBJECT FileObject, - IN OUT PSHARE_ACCESS ShareAccess, - IN BOOLEAN Update, - IN PSZ where, - IN PSZ wherelogtag - ); - -VOID -RxRemoveShareAccess ( - IN PFILE_OBJECT FileObject, - IN OUT PSHARE_ACCESS ShareAccess, - IN PSZ where, - IN PSZ wherelogtag - ); - -VOID -RxSetShareAccess ( - IN ACCESS_MASK DesiredAccess, - IN ULONG DesiredShareAccess, - IN OUT PFILE_OBJECT FileObject, - OUT PSHARE_ACCESS ShareAccess, - IN PSZ where, - IN PSZ wherelogtag - ); - -VOID -RxUpdateShareAccess ( - IN PFILE_OBJECT FileObject, - IN OUT PSHARE_ACCESS ShareAccess, - IN PSZ where, - IN PSZ wherelogtag - ); -#else -#define RxCheckShareAccess(a1,a2,a3,a4,a5,a6,a7) \ - IoCheckShareAccess(a1,a2,a3,a4,a5) - -#define RxRemoveShareAccess(a1,a2,a3,a4) \ - IoRemoveShareAccess(a1,a2) - -#define RxSetShareAccess(a1,a2,a3,a4,a5,a6) \ - IoSetShareAccess(a1,a2,a3,a4) - -#define RxUpdateShareAccess(a1,a2,a3,a4) \ - IoUpdateShareAccess(a1,a2) -#endif - -// -// LoadUnload -// - -NTSTATUS -RxDriverEntry ( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath - ); - -VOID -RxUnload ( - IN PDRIVER_OBJECT DriverObject - ); - -// -// minirdr support -// - -VOID -RxInitializeMinirdrDispatchTable ( - IN PDRIVER_OBJECT DriverObject - ); - -ULONG -RxGetNetworkProviderPriority( - PUNICODE_STRING DeviceName - ); - -VOID -RxExtractServerName( - IN PUNICODE_STRING FilePathName, - OUT PUNICODE_STRING SrvCallName, - OUT PUNICODE_STRING RestOfName - ); - -VOID -RxCreateNetRootCallBack ( - IN PMRX_CREATENETROOT_CONTEXT CreateNetRootContext - ); - -NTSTATUS -DuplicateTransportAddress ( - PTRANSPORT_ADDRESS *Copy, - PTRANSPORT_ADDRESS Original, - POOL_TYPE PoolType); - -NTSTATUS -RxCepInitializeVC ( - PRXCE_VC Vc, - PRXCE_CONNECTION Connection - ); - -NTSTATUS -DuplicateConnectionInformation ( - PRXCE_CONNECTION_INFORMATION *Copy, - PRXCE_CONNECTION_INFORMATION Original, - POOL_TYPE PoolType - ); - -NTSTATUS -RxCepInitializeConnection ( - IN OUT PRXCE_CONNECTION Connection, - IN PRXCE_ADDRESS Address, - IN PRXCE_CONNECTION_INFORMATION ConnectionInformation, - IN PRXCE_CONNECTION_EVENT_HANDLER Handler, - IN PVOID EventContext - ); - -typedef struct _RX_CALLOUT_PARAMETERS_BLOCK_ * PRX_CALLOUT_PARAMETERS_BLOCK; -typedef struct _RX_CREATE_CONNECTION_CALLOUT_CONTEXT_ *PRX_CREATE_CONNECTION_CALLOUT_CONTEXT; - -NTSTATUS -RxCeInitiateConnectRequest ( - IN PRX_CALLOUT_PARAMETERS_BLOCK ParameterBlock - ); - -VOID -RxCeCleanupConnectCallOutContext ( - PRX_CREATE_CONNECTION_CALLOUT_CONTEXT CreateConnectionContext - ); - -PVOID -RxAllocateObject ( - NODE_TYPE_CODE NodeType, - PMINIRDR_DISPATCH MRxDispatch, - ULONG NameLength - ); - -VOID -RxFreeObject ( - PVOID pObject - ); - -NTSTATUS -RxInitializeSrvCallParameters ( - IN PRX_CONTEXT RxContext, - IN OUT PSRV_CALL SrvCall - ); - -VOID -RxAddVirtualNetRootToNetRoot ( - PNET_ROOT NetRoot, - PV_NET_ROOT VNetRoot - ); - -VOID -RxRemoveVirtualNetRootFromNetRoot ( - PNET_ROOT NetRoot, - PV_NET_ROOT VNetRoot - ); - -VOID -RxOrphanFcbsFromThisVNetRoot ( - IN PV_NET_ROOT ThisVNetRoot - ); - -PVOID -RxAllocateFcbObject ( - PRDBSS_DEVICE_OBJECT RxDeviceObject, - NODE_TYPE_CODE NodeType, - POOL_TYPE PoolType, - ULONG NameSize, - PVOID AlreadyAllocatedObject - ); - -VOID -RxFreeFcbObject ( - PVOID Object - ); - -VOID -RxPurgeFcb ( - IN PFCB Fcb - ); - -BOOLEAN -RxFinalizeNetFcb ( - OUT PFCB ThisFcb, - IN BOOLEAN RecursiveFinalize, - IN BOOLEAN ForceFinalize, - IN LONG ReferenceCount - ); - -BOOLEAN -RxIsThisACscAgentOpen ( - IN PRX_CONTEXT RxContext - ); - -VOID -RxCheckFcbStructuresForAlignment ( - VOID - ); - -VOID -RxpPrepareCreateContextForReuse ( - PRX_CONTEXT RxContext - ); - -NTSTATUS -RxLowIoSubmitRETRY ( - IN PRX_CONTEXT RxContext, - IN PIRP Irp - ); - -NTSTATUS -RxLowIoCompletionTail ( - IN PRX_CONTEXT RxContext - ); - -VOID -RxRecurrentTimerWorkItemDispatcher ( - IN PVOID Context - ); - -NTSTATUS -RxInitializeWorkQueueDispatcher ( - PRX_WORK_QUEUE_DISPATCHER Dispatcher - ); - -VOID -RxInitializeWorkQueue ( - PRX_WORK_QUEUE WorkQueue, - WORK_QUEUE_TYPE WorkQueueType, - ULONG MaximumNumberOfWorkerThreads, - ULONG MinimumNumberOfWorkerThreads - ); - -VOID -RxTearDownWorkQueueDispatcher ( - PRX_WORK_QUEUE_DISPATCHER Dispatcher - ); - -VOID -RxTearDownWorkQueue ( - PRX_WORK_QUEUE WorkQueue - ); - -NTSTATUS -RxSpinUpWorkerThread ( - PRX_WORK_QUEUE WorkQueue, - PRX_WORKERTHREAD_ROUTINE Routine, - PVOID Parameter - ); - -VOID -RxSpinUpWorkerThreads ( - PRX_WORK_QUEUE WorkQueue - ); - -VOID -RxSpinUpRequestsDispatcher ( - PRX_DISPATCHER Dispatcher - ); - -VOID -RxpSpinUpWorkerThreads ( - PRX_WORK_QUEUE WorkQueue - ); - -VOID -RxpWorkerThreadDispatcher ( - IN PRX_WORK_QUEUE WorkQueue, - IN PLARGE_INTEGER WaitInterval - ); - -VOID -RxBootstrapWorkerThreadDispatcher ( - IN PRX_WORK_QUEUE WorkQueue - ); - -VOID -RxWorkerThreadDispatcher ( - IN PRX_WORK_QUEUE WorkQueue - ); - -VOID -RxWorkItemDispatcher ( - PVOID Context - ); - -BOOLEAN -RxIsPrefixTableEmpty ( - IN PRX_PREFIX_TABLE ThisTable - ); - -PRX_PREFIX_ENTRY -RxTableLookupName_ExactLengthMatch ( - IN PRX_PREFIX_TABLE ThisTable, - IN PUNICODE_STRING Name, - IN ULONG HashValue, - IN PRX_CONNECTION_ID OPTIONAL RxConnectionId - ); - -PVOID -RxTableLookupName ( - IN PRX_PREFIX_TABLE ThisTable, - IN PUNICODE_STRING Name, - OUT PUNICODE_STRING RemainingName, - IN PRX_CONNECTION_ID OPTIONAL RxConnectionId - ); - -VOID -RxAcquireFileForNtCreateSection ( - IN PFILE_OBJECT FileObject - ); - -VOID -RxReleaseFileForNtCreateSection ( - IN PFILE_OBJECT FileObject - ); - -NTSTATUS -RxPrepareRequestForHandling ( - PCHANGE_BUFFERING_STATE_REQUEST Request - ); - -VOID -RxPrepareRequestForReuse ( - PCHANGE_BUFFERING_STATE_REQUEST Request - ); - -VOID -RxpDiscardChangeBufferingStateRequests ( - IN OUT PLIST_ENTRY DiscardedRequests - ); - -VOID -RxGatherRequestsForSrvOpen ( - IN OUT PSRV_CALL SrvCall, - IN PSRV_OPEN SrvOpen, - IN OUT PLIST_ENTRY RequestsListHead - ); - -NTSTATUS -RxpLookupSrvOpenForRequestLite ( - IN PSRV_CALL SrvCall, - IN OUT PCHANGE_BUFFERING_STATE_REQUEST Request - ); - -BOOLEAN -RxContextCheckToFailThisAttempt ( - IN PIRP Irp, - IN OUT PULONG InitialContextFlags - ); - -ULONG -RxAssignMustSucceedContext ( - IN PIRP Irp, - IN ULONG InitialContextFlags - ); - -PRX_CONTEXT -RxAllocateMustSucceedContext ( - PIRP Irp, - IN PRDBSS_DEVICE_OBJECT RxDeviceObject, - IN ULONG InitialContextFlags, - OUT PUCHAR MustSucceedDescriptorNumber - ); - -VOID -RxFreeMustSucceedContext ( - PRX_CONTEXT RxContext - ); - -PRX_LOG_ENTRY_HEADER -RxGetNextLogEntry ( - VOID - ); - -VOID -RxPrintLog ( - IN ULONG EntriesToPrint OPTIONAL - ); - -VOID -RxProcessChangeBufferingStateRequestsForSrvOpen ( - PSRV_OPEN SrvOpen - ); - -NTSTATUS -RxPurgeFobxFromCache ( - PFOBX FobxToBePurged - ); - -BOOLEAN -RxPurgeFobx ( - PFOBX pFobx - ); - -VOID -RxPurgeAllFobxs ( - PRDBSS_DEVICE_OBJECT RxDeviceObject - ); - -VOID -RxUndoScavengerFinalizationMarking ( - PVOID Instance - ); - -VOID -RxScavengeAllFobxs ( - PRDBSS_DEVICE_OBJECT RxDeviceObject - ); - -ULONG -RxTableComputePathHashValue ( - IN PUNICODE_STRING Name - ); - -VOID -RxExtractServerName ( - IN PUNICODE_STRING FilePathName, - OUT PUNICODE_STRING SrvCallName, - OUT PUNICODE_STRING RestOfName - ); - -VOID -RxCreateNetRootCallBack ( - IN PMRX_CREATENETROOT_CONTEXT CreateNetRootContext - ); - -VOID -RxSpinDownOutstandingAsynchronousRequests ( - IN PRDBSS_DEVICE_OBJECT RxDeviceObject - ); - -NTSTATUS -RxRegisterAsynchronousRequest ( - IN PRDBSS_DEVICE_OBJECT RxDeviceObject - ); - -VOID -RxDeregisterAsynchronousRequest ( - IN PRDBSS_DEVICE_OBJECT RxDeviceObject - ); - -BOOLEAN -RxCancelOperationInOverflowQueue ( - IN PRX_CONTEXT RxContext - ); - -VOID -RxOrphanSrvOpens ( - IN PV_NET_ROOT ThisVNetRoot - ); - -VOID -RxOrphanThisFcb ( - PFCB Fcb - ); - -VOID -RxOrphanSrvOpensForThisFcb ( - IN PFCB Fcb, - IN PV_NET_ROOT ThisVNetRoot, - IN BOOLEAN OrphanAll - ); - -VOID -RxForceFinalizeAllVNetRoots ( - PNET_ROOT NetRoot - ); - -#define RxEqualConnectionId( P1, P2 ) RtlEqualMemory( P1, P2, sizeof( RX_CONNECTION_ID ) ) - - -// -// FsRtl lock package callbacks referenced in fcbstruc.c -// - -NTSTATUS -RxLockOperationCompletion ( - IN PVOID Context, - IN PIRP Irp - ); - -VOID -RxUnlockOperation ( - IN PVOID Context, - IN PFILE_LOCK_INFO LockInfo - ); - -// -// some read routines that need headers -// - -VOID -RxStackOverflowRead ( - IN PVOID Context, - IN PKEVENT Event - ); - -NTSTATUS -RxPostStackOverflowRead ( - IN PRX_CONTEXT RxContext, - IN PFCB Fcb - ); - -// -// the cancel routine -// - -VOID -RxCancelRoutine ( - PDEVICE_OBJECT DeviceObject, - PIRP Irp - ); - - -INLINE -TYPE_OF_OPEN -RxDecodeFileObject ( - IN PFILE_OBJECT FileObject, - OUT PFCB *Fcb, - OUT PFOBX *Fobx - ) { - - if (FileObject) { - *Fcb = (PFCB)FileObject->FsContext; - *Fobx = (PFOBX)FileObject->FsContext2; - - return NodeType( *Fcb ); - } else { - - *Fcb = NULL; - *Fobx = NULL; - return RDBSS_NTC_STORAGE_TYPE_UNKNOWN; - } -} - - -#endif // _RDBSSPROCS_ - - - - diff --git a/pub/ddk/rxstruc.h b/pub/ddk/rxstruc.h deleted file mode 100644 index 68edcc0..0000000 --- a/pub/ddk/rxstruc.h +++ /dev/null @@ -1,369 +0,0 @@ -/*++ - -Copyright (c) 1989 Microsoft Corporation - -Module Name: - - RxStruc.h - -Abstract: - - This module defines the data structures that make up the major internal - part of the Rx file system. - -Author: ---*/ - -#ifndef _RDBSSSTRUC_ -#define _RDBSSSTRUC_ - -#include "prefix.h" -#include "lowio.h" -#include "scavengr.h" // scavenger related definitions. -#include "RxContx.h" -#include "mrx.h" -#include "Fcb.h" - -// -// define our byte offsets to be the full 64 bits -// - -typedef LONGLONG RXVBO; - -#if 0 - -// -// Define who many freed structures we are willing to keep around -// - -#define FREE_FOBX_SIZE (8) -#define FREE_FCB_SIZE (8) -#define FREE_NON_PAGED_FCB_SIZE (8) - -#define FREE_128_BYTE_SIZE (16) -#define FREE_256_BYTE_SIZE (16) -#define FREE_512_BYTE_SIZE (16) - -#endif // 0 - - -// -// We will use both a common and private dispatch tables on a per FCB basis to (a) get -// some encapsulation and (b) [less important] go a little faster. The driver table then gets -// optimized for the most common case. Right now we just use the common dispatch...later and -// Eventually, all the FCBs will have pointers to optimized dispatch tables. -// - -// -// used to synchronize access to rxcontxs and structures -// - -extern RX_SPIN_LOCK RxStrucSupSpinLock; - -typedef struct _RDBSS_EXPORTS { - PRX_SPIN_LOCK pRxStrucSupSpinLock; - PLONG pRxDebugTraceIndent; -} RDBSS_EXPORTS, *PRDBSS_EXPORTS; - -extern RDBSS_EXPORTS RxExports; - -// -// this type is used with table locks to track whether or not the lock -// should be released -// - -typedef enum _LOCK_HOLDING_STATE { - LHS_LockNotHeld, - LHS_SharedLockHeld, - LHS_ExclusiveLockHeld -} LOCK_HOLDING_STATE, *PLOCK_HOLDING_STATE; - -// -// The RDBSS_DATA record is the top record in the Rx file system in-memory -// data structure. This structure must be allocated from non-paged pool. -// - -typedef struct _RDBSS_DATA { - - // - // The type and size of this record (must be RDBSS_NTC_DATA_HEADER) - // - - NODE_TYPE_CODE NodeTypeCode; - NODE_BYTE_SIZE NodeByteSize; - - // - // The Driver object we were initialized with - // - - PDRIVER_OBJECT DriverObject; - - // - // Mini Rdr registration related fields - // - - __volatile LONG NumberOfMinirdrsStarted; - - FAST_MUTEX MinirdrRegistrationMutex; - LIST_ENTRY RegisteredMiniRdrs; //protected by the mutex - LONG NumberOfMinirdrsRegistered; //protected by the mutex - - // - // A pointer to our EPROCESS struct, which is a required input to the - // Cache Management subsystem. - // - - PEPROCESS OurProcess; - - // - // Cache manager call back structures, which must be passed on each call - // to CcInitializeCacheMap. - // - - CACHE_MANAGER_CALLBACKS CacheManagerCallbacks; - - // - // To control access to the global Rx data record - // - - ERESOURCE Resource; - -} RDBSS_DATA; -typedef RDBSS_DATA *PRDBSS_DATA; - -extern RDBSS_DATA RxData; - -PEPROCESS -RxGetRDBSSProcess ( - VOID - ); - -// -// Note: A Strategy needs to be in place to deal with requests for stopping the -// RDBSS when requests are active. -// - -typedef enum _RX_RDBSS_STATE_ { - RDBSS_STARTABLE = 0, - RDBSS_STARTED, - RDBSS_STOP_IN_PROGRESS - - // - // this state deleted with cause! RDBSS_STOPPED - // - -} RX_RDBSS_STATE, *PRX_RDBSS_STATE; - -typedef struct _RDBSS_STARTSTOP_CONTEXT_ { - - RX_RDBSS_STATE State; - ULONG Version; - PRX_CONTEXT pStopContext; - -} RDBSS_STARTSTOP_CONTEXT, *PRDBSS_STARTSTOP_CONTEXT; - -typedef struct _MRX_CALLDOWN_COMPLETION_CONTEXT_ { - - LONG WaitCount; - KEVENT Event; - -} MRX_CALLDOWN_COMPLETION_CONTEXT, *PMRX_CALLDOWN_COMPLETION_CONTEXT; - -typedef -NTSTATUS -(NTAPI *PMRX_CALLDOWN_ROUTINE) ( - IN OUT PVOID CalldownParameter - ); - - -typedef struct _MRX_CALLDOWN_CONTEXT_ { - - RX_WORK_QUEUE_ITEM WorkQueueItem; - PRDBSS_DEVICE_OBJECT pMRxDeviceObject; - PMRX_CALLDOWN_COMPLETION_CONTEXT pCompletionContext; - PMRX_CALLDOWN_ROUTINE pRoutine; - NTSTATUS CompletionStatus; - PVOID pParameter; - -} MRX_CALLDOWN_CONTEXT, *PMRX_CALLDOWN_CONTEXT; - -typedef struct _RX_DISPATCHER_CONTEXT_ { - - __volatile LONG NumberOfWorkerThreads; - __volatile PKEVENT pTearDownEvent; - -} RX_DISPATCHER_CONTEXT, *PRX_DISPATCHER_CONTEXT; - -#define RxSetRdbssState(RxDeviceObject,NewState) \ - { \ - KIRQL SavedIrql; \ - KeAcquireSpinLock( &RxStrucSupSpinLock,&SavedIrql ); \ - RxDeviceObject->StartStopContext.State = (NewState); \ - KeReleaseSpinLock( &RxStrucSupSpinLock, SavedIrql ); \ - } - -#define RxGetRdbssState(RxDeviceObject) \ - (RxDeviceObject)->StartStopContext.State - -BOOLEAN -RxIsOperationCompatibleWithRdbssState ( - PIRP Irp - ); - -// -// The RDBSS Device Object is an I/O system device object with additions for -// the various structures needed by each minirdr: the dispatch, export-to-minirdr -// structure, MUP call characteristics, list of active operations, etc. -// - -typedef struct _RDBSS_DEVICE_OBJECT { - - union { - DEVICE_OBJECT DeviceObject; -#ifndef __cplusplus - DEVICE_OBJECT; -#endif // __cplusplus - }; - - ULONG RegistrationControls; - - // - // stuff that the minirdr needs to know - // - - PRDBSS_EXPORTS RdbssExports; - - // - // set to NULL if monolithic - // - - PDEVICE_OBJECT RDBSSDeviceObject; - - // - // the mini rdr dispatch vector - // - - PMINIRDR_DISPATCH Dispatch; - UNICODE_STRING DeviceName; - - ULONG NetworkProviderPriority; - - HANDLE MupHandle; - - BOOLEAN RegisterUncProvider; - BOOLEAN RegisterMailSlotProvider; - BOOLEAN RegisteredAsFileSystem; - BOOLEAN Unused; - - LIST_ENTRY MiniRdrListLinks; - - __volatile ULONG NumberOfActiveFcbs; - __volatile ULONG NumberOfActiveContexts; - - struct { - - LARGE_INTEGER PagingReadBytesRequested; - LARGE_INTEGER NonPagingReadBytesRequested; - LARGE_INTEGER CacheReadBytesRequested; - LARGE_INTEGER FastReadBytesRequested; - LARGE_INTEGER NetworkReadBytesRequested; - __volatile ULONG ReadOperations; - ULONG FastReadOperations; - __volatile ULONG RandomReadOperations; - - LARGE_INTEGER PagingWriteBytesRequested; - LARGE_INTEGER NonPagingWriteBytesRequested; - LARGE_INTEGER CacheWriteBytesRequested; - LARGE_INTEGER FastWriteBytesRequested; - LARGE_INTEGER NetworkWriteBytesRequested; - __volatile ULONG WriteOperations; - ULONG FastWriteOperations; - __volatile ULONG RandomWriteOperations; - }; - - // - // The following field tells how many requests for this volume have - // either been enqueued to ExWorker threads or are currently being - // serviced by ExWorker threads. If the number goes above - // a certain threshold, put the request on the overflow queue to be - // executed later. - // - - __deref_volatile LONG PostedRequestCount[MaximumWorkQueue]; - - // - // The following field indicates the number of IRP's waiting - // to be serviced in the overflow queue. - // - - LONG OverflowQueueCount[MaximumWorkQueue]; - - // - // The following field contains the queue header of the overflow queue. - // The Overflow queue is a list of IRP's linked via the IRP's ListEntry - // field. - // - - LIST_ENTRY OverflowQueue[MaximumWorkQueue]; - - // - // The following spinlock protects access to all the above fields. - // - - RX_SPIN_LOCK OverflowQueueSpinLock; - - // - // The following fields are required for synchronization with async. - // requests issued by the RDBSS on behalf of this mini redirector on - // on shutdown. - // - - LONG AsynchronousRequestsPending; - - PKEVENT pAsynchronousRequestsCompletionEvent; - - RDBSS_STARTSTOP_CONTEXT StartStopContext; - - RX_DISPATCHER_CONTEXT DispatcherContext; - - // - // some guys may want to share - // - - PRX_PREFIX_TABLE pRxNetNameTable; - RX_PREFIX_TABLE RxNetNameTableInDeviceObject; - - - // - // for sharing - // - - PRDBSS_SCAVENGER pRdbssScavenger; - RDBSS_SCAVENGER RdbssScavengerInDeviceObject; - -} RDBSS_DEVICE_OBJECT, *PRDBSS_DEVICE_OBJECT; - -INLINE -VOID -NTAPI -RxUnregisterMinirdr ( - IN PRDBSS_DEVICE_OBJECT RxDeviceObject - ) -{ - PDEVICE_OBJECT RDBSSDeviceObject; - - RDBSSDeviceObject = RxDeviceObject->RDBSSDeviceObject; - - RxpUnregisterMinirdr( RxDeviceObject ); - - if (RDBSSDeviceObject != NULL) { - ObDereferenceObject( RDBSSDeviceObject ); - } -} - -extern FAST_MUTEX RxMinirdrRegistrationMutex; -extern LIST_ENTRY RxRegisteredMiniRdrs; -extern ULONG RxNumberOfMinirdrs; - -#endif // _RDBSSSTRUC_ - diff --git a/pub/ddk/rxtimer.h b/pub/ddk/rxtimer.h deleted file mode 100644 index be09ee6..0000000 --- a/pub/ddk/rxtimer.h +++ /dev/null @@ -1,75 +0,0 @@ -/*++ - -Copyright (c) 1994 Microsoft Corporation - -Module Name: - - RxTimer.h - -Abstract: - - This module defines the prototypes and structures for the timer on the rdbss architecture. - What is provided is a 55ms timer...that is, if you register a routine then you get a call - every 55ms. On NT, you're at DPC level. - - Also contained here are the routines for posting to a thread from DPC level. - - -Author: ---*/ - -#ifndef _RXTIMER_H_ -#define _RXTIMER_H_ - -// -// The RX_WORK_ITEM encapsulates the context for posting to a worker thread as well as -// a timer routine to be triggered after a specific interval. -// - -typedef struct _RX_WORK_ITEM_ { - RX_WORK_QUEUE_ITEM WorkQueueItem; - ULONG LastTick; - ULONG Options; -} RX_WORK_ITEM, *PRX_WORK_ITEM; - -extern NTSTATUS -NTAPI -RxPostOneShotTimerRequest( - IN PRDBSS_DEVICE_OBJECT pDeviceObject, - IN PRX_WORK_ITEM pWorkItem, - IN PRX_WORKERTHREAD_ROUTINE Routine, - IN PVOID pContext, - IN LARGE_INTEGER TimeInterval); - -extern NTSTATUS -NTAPI -RxPostRecurrentTimerRequest( - IN PRDBSS_DEVICE_OBJECT pDeviceObject, - IN PRX_WORKERTHREAD_ROUTINE Routine, - IN PVOID pContext, - IN LARGE_INTEGER TimeInterval); - - -extern NTSTATUS -NTAPI -RxCancelTimerRequest( - IN PRDBSS_DEVICE_OBJECT pDeviceObject, - IN PRX_WORKERTHREAD_ROUTINE Routine, - IN PVOID pContext - ); - - -// -// Routines for initializing and tearing down the timer service in RDBSS -// - -extern NTSTATUS -NTAPI -RxInitializeRxTimer(); - -extern VOID -NTAPI -RxTearDownRxTimer(void); - -#endif // _RXTIMER_STUFF_DEFINED_ - diff --git a/pub/ddk/rxtrace.h b/pub/ddk/rxtrace.h deleted file mode 100644 index 8675960..0000000 --- a/pub/ddk/rxtrace.h +++ /dev/null @@ -1,292 +0,0 @@ -/*++ - -Copyright (c) 1989 Microsoft Corporation - -Module Name: - - rxtrace.h - -Abstract: - - This module defines the macros which provide debugging support ( tracing ). - -Author: -Revision History: - ---*/ - -#ifndef _RDBSSTRACE_INCLUDED_ -#define _RDBSSTRACE_INCLUDED_ - -#if !DBG -#undef RDBSSTRACE -#endif // !DBG - -typedef struct _DEBUG_TRACE_CONTROLPOINT{ - ULONG ControlPointNumber; - PSZ Name; -} DEBUG_TRACE_CONTROLPOINT, *PDEBUG_TRACE_CONTROLPOINT; - -typedef struct { - LONG PrintLevel; - ULONG BreakMask; - PSZ Name; -} RX_DEBUG_TRACE_CONTROL, *PRX_DEBUG_TRACE_CONTROL; - - -#ifdef RDBSSTRACE - -//define so that &RX_DEBUG_TRACE_CONTROL is NULL -typedef struct { - RX_DEBUG_TRACE_CONTROL Junk; -} rxrxrx_AlwaysHelper; - - -#define RX_DEBUG_TRACE_ALWAYS (((rxrxrx_AlwaysHelper*)0)->Junk) - -// The following macros provide fine grained control for selectively enabling -// and disabling tracing. - -#define RXDT_Extern(__x) extern DEBUG_TRACE_CONTROLPOINT RX_DEBUG_TRACE_##__x -#define RXDT_DeclareCategory(__x) extern DEBUG_TRACE_CONTROLPOINT RX_DEBUG_TRACE_##__x -#define RXDT_DefineCategory(__x) DEBUG_TRACE_CONTROLPOINT RX_DEBUG_TRACE_##__x = {0,#__x} - -RXDT_Extern(ERROR); -RXDT_Extern(HOOKS); -RXDT_Extern(CATCH_EXCEPTIONS); -RXDT_Extern(UNWIND); -RXDT_Extern(CLEANUP); -RXDT_Extern(CLOSE); -RXDT_Extern(CREATE); -RXDT_Extern(DIRCTRL); -RXDT_Extern(EA); -RXDT_Extern(FILEINFO); -RXDT_Extern(FSCTRL); -RXDT_Extern(LOCKCTRL); -RXDT_Extern(READ); -RXDT_Extern(VOLINFO); -RXDT_Extern(WRITE); -RXDT_Extern(FLUSH); -RXDT_Extern(DEVCTRL); -RXDT_Extern(SHUTDOWN); -RXDT_Extern(PREFIX); -RXDT_Extern(DEVFCB); -RXDT_Extern(ACCHKSUP); -RXDT_Extern(ALLOCSUP); -RXDT_Extern(DIRSUP); -RXDT_Extern(FILOBSUP); -RXDT_Extern(NAMESUP); -RXDT_Extern(VERFYSUP); -RXDT_Extern(CACHESUP); -RXDT_Extern(SPLAYSUP); -RXDT_Extern(DEVIOSUP); -RXDT_Extern(FCBSTRUCTS); -RXDT_Extern(STRUCSUP); -RXDT_Extern(FSP_DISPATCHER); -RXDT_Extern(FSP_DUMP); -RXDT_Extern(RXCONTX); -RXDT_Extern(DISPATCH); -RXDT_Extern(NTFASTIO); -RXDT_Extern(LOWIO); -RXDT_Extern(MINIRDR); -RXDT_Extern(DISCCODE); //for the browser interface stuff -RXDT_Extern(BROWSER); -RXDT_Extern(CONNECT); -RXDT_Extern(NTTIMER); -RXDT_Extern(SCAVTHRD); -RXDT_Extern(SCAVENGER); -RXDT_Extern(SHAREACCESS); -RXDT_Extern(NAMECACHE); - -//connection engines categories - -RXDT_Extern(RXCEBINDING); -RXDT_Extern(RXCEDBIMPLEMENTATION); -RXDT_Extern(RXCEMANAGEMENT); -RXDT_Extern(RXCEXMIT); -RXDT_Extern(RXCEPOOL); -RXDT_Extern(RXCETDI); - -#else //RDBSSTRACE - -#define RXDT_Extern(__x) -#define RXDT_DeclareCategory(__x) -#define RXDT_DefineCategory(__x) - -#endif //RDBSSTRACE - -#ifdef RDBSSTRACE -extern BOOLEAN RxGlobalTraceSuppress, RxNextGlobalTraceSuppress; -extern ULONG RxGlobalTraceIrpCount; -VOID RxInitializeDebugTrace(void); -#define RxDbgTraceDoit(___x) ___x - -#ifndef MINIRDR__NAME -extern LONG RxDebugTraceIndent; -#else -#define RxDebugTraceIndent (*(*___MINIRDR_IMPORTS_NAME).pRxDebugTraceIndent) -#endif - -#else - -#define RxInitializeDebugTrace() -#define RxDbgTraceDoit(___x) - -#endif //RDBSSTRACE - - - -#if DBG - -#define RxDT_INDENT_EXCESS 16 //this is the offset for excess-n for the indent -#define RxDT_INDENT_SHIFT 20 -#define RxDT_INDENT_MASK 0x3f -#define RxDT_LEVEL_MASK ((1<BreakMask & (1<<((MASKBIT)-1)) )) { \ - DbgBreakPoint(); \ - } \ -} - -#define DebugUnwind(X) { \ - if (AbnormalTermination()) { \ - RxDbgTrace(0, (DEBUG_TRACE_UNWIND), ( #X ", Abnormal termination.\n", 0)); \ - } \ -} - -#ifdef RX_PERFPORMANCE_TIMER -extern LONG RxPerformanceTimerLevel; - -#define TimerStart(LEVEL) { \ - LARGE_INTEGER TStart, TEnd; \ - LARGE_INTEGER TElapsed; \ - TStart = KeQueryPerformanceCounter( NULL ); \ - -#define TimerStop(LEVEL,s) \ - TEnd = KeQueryPerformanceCounter( NULL ); \ - TElapsed.QuadPart = TEnd.QuadPart - TStart.QuadPart; \ - RxTotalTicks[RxLogOf(LEVEL)] += TElapsed.LowPart; \ - if (FlagOn( RxPerformanceTimerLevel, (LEVEL))) { \ - DbgPrint("Time of %s %ld\n", (s), TElapsed.LowPart ); \ - } \ -} -#endif //RX_PERFPORMANCE_TIMER - -#else // RDBSSTRACE - -#define RxDbgTraceLV__norx_reverseaction(INDENT,CONTROLPOINT,LEVEL,Z) {NOTHING;} -#define RxDbgTraceLV(INDENT,CONTROLPOINTNUM,LEVEL,Z) {NOTHING;} -#define RxDbgTraceLVUnIndent(INDENT,CONTROLPOINTNUM,LEVEL) {NOTHING;} -#define RxDbgTrace(INDENT,CONTROLPOINTNUM,Z) {NOTHING;} -#define RxDbgTraceUnIndent(INDENT,CONTROLPOINTNUM) {NOTHING;} -#define DebugBreakPoint(CONTROLPOINTNUM,MASKBIT) {NOTHING;} -#define DebugUnwind(X) {NOTHING;} -#define RxDbgTraceDisableGlobally() FALSE -#define RxDbgTraceEnableGlobally(f) {NOTHING;} - -#ifdef RX_PERFPORMANCE_TIMER -#define TimerStart(LEVEL) -#define TimerStop(LEVEL,s) -#endif - -#endif // RDBSSTRACE - - -#endif // _RDBSSTRACE_INCLUDED_ - - diff --git a/pub/ddk/rxtypes.h b/pub/ddk/rxtypes.h deleted file mode 100644 index f4a6d3c..0000000 --- a/pub/ddk/rxtypes.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _RXTYPES_INCL -#define _RXTYPES_INCL - -#include "nodetype.h" - -typedef PVOID RX_HANDLE, *PRX_HANDLE; -typedef KSPIN_LOCK RX_SPIN_LOCK; -typedef PKSPIN_LOCK PRX_SPIN_LOCK; - - -// String definitions -// The RX_STRING type corresponds to a UNICODE_STRING and all the Rtl functions that are -// available to manipulate Unicode strings can be used to manipulate the strings -// - -typedef struct _BINDING_HANDLE { - RX_HANDLE pTdiEmulationContext; // Win9X net structure - RX_HANDLE pTransportInformation; // tdi transport information. -} RX_BINDING_HANDLE, *PRX_BINDING_HANDLE; - -typedef UNICODE_STRING UNICODE_STRING; -typedef UNICODE_STRING* PUNICODE_STRING; - - -// This structure is transient. Most fields in this structure allow us to -// move through the bind/addname part of activating a net. Runtime info -// for the rxce and long term context is kept elsewhere. - -typedef struct _RX_BINDING_CONTEXT { - PUNICODE_STRING pTransportName; // Transport Name (unicode string). - ULONG QualityOfService; // Requested QOS. - // Common fields. - PRX_BINDING_HANDLE pBindHandle; // Handle to transport bind info. - } RX_BINDING_CONTEXT, *PRX_BINDING_CONTEXT; -#endif // _RXTYPES_INCL - - diff --git a/pub/ddk/rxworkq.h b/pub/ddk/rxworkq.h deleted file mode 100644 index 171f062..0000000 --- a/pub/ddk/rxworkq.h +++ /dev/null @@ -1,249 +0,0 @@ -/*++ - -Copyright (c) 1994 Microsoft Corporation - -Module Name: - - rxworkq.h - -Abstract: - - This module defines the data structures required to implement the dispatching - mechanism in RDBSS for use by RDBSS as well as all the mini redirectors. - -Author: ---*/ - -#ifndef _RXWORKQ_H_ -#define _RXWORKQ_H_ - -// -// The worker thread routine prototype definition. -// - -typedef -VOID -(NTAPI *PRX_WORKERTHREAD_ROUTINE) ( - IN PVOID Context - ); - -// -// The RDBSS needs to keep track of the work items on a per device object basis. -// This enables the race conditions associated with loading/unloading as well as -// a mechanism for preventing a single mini redirector from unfairly hogging all -// the resources. -// - -#ifdef __cplusplus -typedef struct _RX_WORK_QUEUE_ITEM_ : public WORK_QUEUE_ITEM { - // the work queue item as defined in NTOS -#else // !__cplusplus -typedef struct _RX_WORK_QUEUE_ITEM_ { - WORK_QUEUE_ITEM; // the work queue item as defined in NTOS -#endif // __cplusplus - - PRDBSS_DEVICE_OBJECT pDeviceObject; -} RX_WORK_QUEUE_ITEM, *PRX_WORK_QUEUE_ITEM; - -// -// There are certain scenarios in which dispatching of work items is inevitable. -// In such instance the WORK_QUEUE_ITEM is allocated as part of another data -// structure to avoid frequent allocation/freeing. In other scenarios where -// dispatching is rare it pays to avoid the allocation of the memory till it -// is rquired. The RDBSS work queue implementations provide for both these -// scenarios in the form of dispatching and posting work queue requests. In -// the case of dispatching no memory for the WORK_QUEUE_ITEM need be allocated -// by the caller while for posting the memory for WORK_QUEUE_ITEM needs to be -// allocated by the caller. -// - -typedef struct _RX_WORK_DISPATCH_ITEM_ { - RX_WORK_QUEUE_ITEM WorkQueueItem; - PRX_WORKERTHREAD_ROUTINE DispatchRoutine; - PVOID DispatchRoutineParameter; -} RX_WORK_DISPATCH_ITEM, *PRX_WORK_DISPATCH_ITEM; - -// -// The work queues typically come up in a active state and continue till either -// a non recoverable situation is encountered ( lack of system resources ) when -// it transitions to the Inactive state. When a rundown is initiated it transitions -// to the rundown in progress state. -// - -typedef enum _RX_WORK_QUEUE_STATE_ { - RxWorkQueueActive, - RxWorkQueueInactive, - RxWorkQueueRundownInProgress -} RX_WORK_QUEUE_STATE, *PRX_WORK_QUEUE_STATE; - -// -// The rundown of work queues is not complete when the threads have been spun down. -// The termination of the threads needs to be ensured before the data structures -// can be torn down. The work queue implementation follows a protocol in which -// each of the threads being spundown stashes a reference to the thread object -// in the rundown context. The rundown issuing thread ( which does not belong to -// the work queue ) waits for the completion of all the threads spundown before -// tearing down the data structures. -// - -typedef struct _RX_WORK_QUEUE_RUNDOWN_CONTEXT_ { - KEVENT RundownCompletionEvent; - LONG NumberOfThreadsSpunDown; - PETHREAD *ThreadPointers; -} RX_WORK_QUEUE_RUNDOWN_CONTEXT, *PRX_WORK_QUEUE_RUNDOWN_CONTEXT; - -// -// The work queue implementation is built around a KQUEUE implementation. The -// additional support involves the regulation of number of threads that are -// actively waiting for the work items. Each work queue data structure is -// allocated in nonpaged pool and has its own synchronization mechanism ( spinlock). -// -// In addition to the bookkeeing information, i.e., state, type etc. it also includes -// statistics that are gathered over the lifetime of the queue. This will -// provide valuable information in tuning a work queue instance. The number of items -// that have been processed , the number of items that have to be processed and -// the cumulative queue length is recorded. The cumulative queue length is the -// intersiting metric, it is the sum of the number of items awaiting to be processed -// each time an additional work item was queued. The cumulative queue length -// divided by the sum of the total number of items processed and the anumber of -// items to be processed gives an indication of the average length of the -// queue. A value much greater than one signifies that the minimum number of -// worker threads associated with the work queue can be increased. A value much -// less than one signifies that the maximum number of work threads associated -// with the queue can be decreased. -// - -typedef struct _RX_WORK_QUEUE_ { - USHORT State; - BOOLEAN SpinUpRequestPending; - UCHAR Type; - - KSPIN_LOCK SpinLock; - - PRX_WORK_QUEUE_RUNDOWN_CONTEXT pRundownContext; - - __volatile LONG NumberOfWorkItemsDispatched; - __volatile LONG NumberOfWorkItemsToBeDispatched; - LONG CumulativeQueueLength; - - LONG NumberOfSpinUpRequests; - LONG MaximumNumberOfWorkerThreads; - LONG MinimumNumberOfWorkerThreads; - __volatile LONG NumberOfActiveWorkerThreads; - __volatile LONG NumberOfIdleWorkerThreads; - LONG NumberOfFailedSpinUpRequests; - __volatile LONG WorkQueueItemForSpinUpWorkerThreadInUse; - - RX_WORK_QUEUE_ITEM WorkQueueItemForTearDownWorkQueue; - RX_WORK_QUEUE_ITEM WorkQueueItemForSpinUpWorkerThread; - RX_WORK_QUEUE_ITEM WorkQueueItemForSpinDownWorkerThread; - - KQUEUE Queue; - - // The next field is for debugging purposes and will be removed from the - // FREE build. - PETHREAD *ThreadPointers; - -} RX_WORK_QUEUE, *PRX_WORK_QUEUE; - -// -// The dispatching mechanism in RDBSS provides for multiple levels of work queues -// on a per processor basis. There are three levels of work queues currently -// supported, Critical,Delayed and HyperCritical. The distinction between Critical -// and delayed is one of priority where as HyperCritical iss different from the -// other two in that the routines should not block, i.e., wait for any resource. -// This requirement cannot be enforced hence the effectiveness of the dispatching -// mechanism relies on the implicit cooperation of the clients. -// - -typedef struct _RX_WORK_QUEUE_DISPATCHER_ { - RX_WORK_QUEUE WorkQueue[MaximumWorkQueue]; -} RX_WORK_QUEUE_DISPATCHER, *PRX_WORK_QUEUE_DISPATCHER; - -// -// The dispatcher typically come up in a active state and continue till either -// a non recoverable situation is encountered ( lack of system resources ) when -// it transitions to the Inactive state. When a rundown is initiated it transitions -// to the rundown in progress state. -// - -typedef enum _RX_DISPATCHER_STATE_ { - RxDispatcherActive, - RxDispatcherInactive -} RX_DISPATCHER_STATE, *PRX_DISPATCHER_STATE; - - -// -// The RDBSS dispatching mechanism on any machine is an array of the dispatchers -// associated with each processor. When a work queue item is queued a best effort -// is made to contain the work emanating from a processor onto the same processor. -// This ensures that processor affinities setup by the NT dispatcher are not -// destroyed by the RDBSS dispatching mechanism as this could lead to excessive -// sloshing. When the work needs to be moved there are two metrics that will be -// useful in making the decision, teh amount of delay that will be experienced -// by the work item in the current queue and the effort involved in moving the -// work item to the other queue. It is very easy to quantify the former but very -// difficult to quantify the later. -// - -typedef struct _RX_DISPATCHER_ { - LONG NumberOfProcessors; - PEPROCESS OwnerProcess; - PRX_WORK_QUEUE_DISPATCHER pWorkQueueDispatcher; - - RX_DISPATCHER_STATE State; - - LIST_ENTRY SpinUpRequests; - KSPIN_LOCK SpinUpRequestsLock; - KEVENT SpinUpRequestsEvent; - KEVENT SpinUpRequestsTearDownEvent; -} RX_DISPATCHER, *PRX_DISPATCHER; - -// -// The function prototypes used for dispatching/posting work queue items -// - -extern NTSTATUS -NTAPI -RxPostToWorkerThread ( - IN PRDBSS_DEVICE_OBJECT pMRxDeviceObject, - IN WORK_QUEUE_TYPE WorkQueueType, - IN PRX_WORK_QUEUE_ITEM pWorkQueueItem, - IN PRX_WORKERTHREAD_ROUTINE Routine, - IN PVOID pContext - ); - -extern NTSTATUS -NTAPI -RxDispatchToWorkerThread( - IN PRDBSS_DEVICE_OBJECT pMRxDeviceObject, - IN WORK_QUEUE_TYPE WorkQueueType, - IN PRX_WORKERTHREAD_ROUTINE Routine, - IN PVOID pContext); - -extern BOOLEAN //should only be called from raised IRQL -NTAPI -RxIsWorkItemQueued( - IN OUT PWORK_QUEUE_ITEM WorkItem - ); - -// -// The routines for initializing/tearing down the dispatching mechanism -// - -extern NTSTATUS -RxInitializeDispatcher(); - -extern NTSTATUS -RxTearDownDispatcher(); - -extern NTSTATUS -RxInitializeMRxDispatcher( - IN OUT PRDBSS_DEVICE_OBJECT pMRxDeviceObject); - -extern NTSTATUS -RxSpinDownMRxDispatcher( - IN OUT PRDBSS_DEVICE_OBJECT pMRxDeviceObject); - -#endif _RXWORKQ_H_ - diff --git a/pub/ddk/scavengr.h b/pub/ddk/scavengr.h deleted file mode 100644 index 15a7b3a..0000000 --- a/pub/ddk/scavengr.h +++ /dev/null @@ -1,276 +0,0 @@ -/*++ - -Copyright (c) 1994 Microsoft Corporation - -Module Name: - - scavengr.h - -Abstract: - - This module defines data structures related to scavenging in the RDBSS - -Author: -Revision History: - - -Notes: - - The dormant file limit must be made configurable on a per server basis - ---*/ - -#ifndef _SCAVENGR_H_ -#define _SCAVENGR_H_ - -// -// currently, only a single scavengermutex is across all scavenging operations -// for all underlying deviceobjects -// - -extern KMUTEX RxScavengerMutex; - -// -// by default the scavenger will run once every 10 seconds -// -#define RX_SCAVENGER_FINALIZATION_TIME_INTERVAL (10 * 1000 * 1000 * 10) - -// -// scavenger must run at least once every 2 minutes -// -#define RX_MAX_SCAVENGER_TIME_INTERVAL 120 - - -// -// An instance of this data structure is embedded as part of those data structures -// that are scavenged, i.e., FCB, RX_CONTEXT, etc. -// - -#define RX_SCAVENGER_ENTRY_TYPE_MARKER (0x0001) -#define RX_SCAVENGER_ENTRY_TYPE_FCB (0x0002) - -#define RX_SCAVENGER_OP_PURGE (0x0001) -#define RX_SCAVENGER_OP_CLOSE (0x0002) - -#define RX_SCAVENGER_INITIATED_OPERATION (0x0001) - -typedef enum _RX_SCAVENGER_ENTRY_STATE { - RX_SCAVENGING_INACTIVE, - RX_SCAVENGING_PENDING, - RX_SCAVENGING_IN_PROGRESS, - RX_SCAVENGING_AWAITING_RESPONSE -} RX_SCAVENGER_ENTRY_STATE, *PRX_SCAVENGER_ENTRY_STATE; - -typedef struct _RX_SCAVENGER_ENTRY { - - // - // List of related items to be scavenged - // - - LIST_ENTRY List; - - UCHAR Type; - UCHAR Operation; - UCHAR State; - UCHAR Flags; - - struct _RX_SCAVENGER_ENTRY *pContinuationEntry; - -} RX_SCAVENGER_ENTRY, *PRX_SCAVENGER_ENTRY; - - -#define RxInitializeScavengerEntry(ScavengerEntry) \ - (ScavengerEntry)->State = 0; \ - (ScavengerEntry)->Flags = 0; \ - (ScavengerEntry)->Type = 0; \ - (ScavengerEntry)->Operation = 0; \ - InitializeListHead(&(ScavengerEntry)->List); \ - (ScavengerEntry)->pContinuationEntry = NULL - -#define RX_SCAVENGER_MUTEX_ACQUIRED (1) - -typedef enum _RDBSS_SCAVENGER_STATE { - RDBSS_SCAVENGER_INACTIVE, - RDBSS_SCAVENGER_DORMANT, - RDBSS_SCAVENGER_ACTIVE, - RDBSS_SCAVENGER_SUSPENDED -} RDBSS_SCAVENGER_STATE, *PRDBSS_SCAVENGER_STATE; - -typedef struct _RDBSS_SCAVENGER { - - RDBSS_SCAVENGER_STATE State; - - LONG MaximumNumberOfDormantFiles; - __volatile LONG NumberOfDormantFiles; - - LARGE_INTEGER TimeLimit; - - ULONG SrvCallsToBeFinalized; - ULONG NetRootsToBeFinalized; - ULONG VNetRootsToBeFinalized; - ULONG FcbsToBeFinalized; - ULONG SrvOpensToBeFinalized; - ULONG FobxsToBeFinalized; - - LIST_ENTRY SrvCallFinalizationList; - LIST_ENTRY NetRootFinalizationList; - LIST_ENTRY VNetRootFinalizationList; - LIST_ENTRY FcbFinalizationList; - LIST_ENTRY SrvOpenFinalizationList; - LIST_ENTRY FobxFinalizationList; - - LIST_ENTRY ClosePendingFobxsList; - - RX_WORK_ITEM WorkItem; - KEVENT SyncEvent; - KEVENT ScavengeEvent; - - PETHREAD CurrentScavengerThread; - PNET_ROOT CurrentNetRootForClosePendingProcessing; - PFCB CurrentFcbForClosePendingProcessing; - KEVENT ClosePendingProcessingSyncEvent; - -} RDBSS_SCAVENGER, *PRDBSS_SCAVENGER; - -#define RxInitializeRdbssScavenger(Scavenger, ScavengerTimeLimit) \ - (Scavenger)->State = RDBSS_SCAVENGER_INACTIVE; \ - (Scavenger)->SrvCallsToBeFinalized = 0; \ - (Scavenger)->NetRootsToBeFinalized = 0; \ - (Scavenger)->VNetRootsToBeFinalized = 0; \ - (Scavenger)->FcbsToBeFinalized = 0; \ - (Scavenger)->SrvOpensToBeFinalized = 0; \ - (Scavenger)->FobxsToBeFinalized = 0; \ - (Scavenger)->NumberOfDormantFiles = 0; \ - (Scavenger)->MaximumNumberOfDormantFiles = 50; \ - (Scavenger)->CurrentFcbForClosePendingProcessing = NULL; \ - (Scavenger)->CurrentNetRootForClosePendingProcessing = NULL; \ - if( (ScavengerTimeLimit).QuadPart == 0 ) { \ - (Scavenger)->TimeLimit.QuadPart = RX_SCAVENGER_FINALIZATION_TIME_INTERVAL; \ - } else { \ - (Scavenger)->TimeLimit.QuadPart = (ScavengerTimeLimit).QuadPart; \ - } \ - KeInitializeEvent(&((Scavenger)->SyncEvent),NotificationEvent,FALSE); \ - KeInitializeEvent(&((Scavenger)->ScavengeEvent),SynchronizationEvent,TRUE); \ - KeInitializeEvent(&((Scavenger)->ClosePendingProcessingSyncEvent),NotificationEvent,FALSE); \ - InitializeListHead(&(Scavenger)->SrvCallFinalizationList); \ - InitializeListHead(&(Scavenger)->NetRootFinalizationList); \ - InitializeListHead(&(Scavenger)->VNetRootFinalizationList); \ - InitializeListHead(&(Scavenger)->SrvOpenFinalizationList); \ - InitializeListHead(&(Scavenger)->FcbFinalizationList); \ - InitializeListHead(&(Scavenger)->FobxFinalizationList); \ - InitializeListHead(&(Scavenger)->ClosePendingFobxsList) - - -#define RxAcquireScavengerMutex() \ - KeWaitForSingleObject( &RxScavengerMutex, Executive, KernelMode, FALSE, NULL ) - -#define RxReleaseScavengerMutex() \ - KeReleaseMutex( &RxScavengerMutex, FALSE ) - -NTSTATUS -RxMarkFcbForScavengingAtCleanup ( - PFCB Fcb - ); - -NTSTATUS -RxMarkFcbForScavengingAtClose ( - PFCB - Fcb - ); - -VOID -RxUpdateScavengerOnCloseCompletion ( - PFCB - Fcb - ); - -VOID -RxMarkFobxOnCleanup ( - PFOBX pFobx, - PBOOLEAN NeedPurge - ); - -VOID -RxMarkFobxOnClose ( - PFOBX Fobx - ); - -NTSTATUS -RxPurgeRelatedFobxs ( - PNET_ROOT NetRoot, - PRX_CONTEXT RxContext, - BOOLEAN AttemptFinalization, - PFCB PurgingFcb - ); - -#define DONT_ATTEMPT_FINALIZE_ON_PURGE FALSE -#define ATTEMPT_FINALIZE_ON_PURGE TRUE - -// -// the purge_sync context is used to synchronize contexts that are attempting to purge... -// notatbly creates and dirctrls. these are planted in various structures because various minirdrs -// require different granularity of purge operations -// - - -typedef struct _PURGE_SYNCHRONIZATION_CONTEXT { - - // - // the list of purge requests active for this netroot. - // - - LIST_ENTRY ContextsAwaitingPurgeCompletion; - BOOLEAN PurgeInProgress; -} PURGE_SYNCHRONIZATION_CONTEXT, *PPURGE_SYNCHRONIZATION_CONTEXT; - -VOID -RxInitializePurgeSyncronizationContext ( - PPURGE_SYNCHRONIZATION_CONTEXT PurgeSyncronizationContext - ); - -NTSTATUS -RxScavengeRelatedFcbs ( - PRX_CONTEXT RxContext - ); - -BOOLEAN -RxScavengeRelatedFobxs ( - PFCB Fcb - ); - -VOID -RxScavengeFobxsForNetRoot ( - PNET_ROOT NetRoot, - PFCB PurgingFcb, - BOOLEAN SynchronizeWithScavenger - ); - -VOID -RxpMarkInstanceForScavengedFinalization ( - PVOID Instance - ); - -VOID -RxpUndoScavengerFinalizationMarking ( - PVOID Instance - ); - -VOID -RxTerminateScavenging ( - PRX_CONTEXT RxContext - ); - -BOOLEAN -RxScavengeVNetRoots ( - PRDBSS_DEVICE_OBJECT RxDeviceObject - ); - -VOID -RxSynchronizeWithScavenger ( - IN PRX_CONTEXT RxContext, - IN PFCB Fcb - ); - -#endif // _SCAVENGR_H_ - - diff --git a/pub/ddk/scsi.h b/pub/ddk/scsi.h deleted file mode 100644 index 9c0657b..0000000 --- a/pub/ddk/scsi.h +++ /dev/null @@ -1,3666 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - scsi.h - -Abstract: - - These are the structures and defines that are used in the - SCSI port and class drivers. - -Authors: - -Revision History: - ---*/ -#ifndef _NTSCSI_ -#define _NTSCSI_ - -#ifndef _NTSCSI_USER_MODE_ - #include "srb.h" -#endif // !defined _NTSCSI_USER_MODE_ - - -#pragma warning(push) -#pragma warning(disable:4200) // array[0] is not a warning for this file -#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union -#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int - -#pragma pack(push, _scsi_) -// begin_ntminitape - -// begin_storport - -// -// Command Descriptor Block. Passed by SCSI controller chip over the SCSI bus -// - -#pragma pack(push, cdb, 1) -typedef union _CDB { - - // - // Generic 6-Byte CDB - // - - struct _CDB6GENERIC { - UCHAR OperationCode; - UCHAR Immediate : 1; - UCHAR CommandUniqueBits : 4; - UCHAR LogicalUnitNumber : 3; - UCHAR CommandUniqueBytes[3]; - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved : 4; - UCHAR VendorUnique : 2; - } CDB6GENERIC; - - // - // Standard 6-byte CDB - // - - struct _CDB6READWRITE { - UCHAR OperationCode; // 0x08, 0x0A - SCSIOP_READ, SCSIOP_WRITE - UCHAR LogicalBlockMsb1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlockMsb0; - UCHAR LogicalBlockLsb; - UCHAR TransferBlocks; - UCHAR Control; - } CDB6READWRITE; - - // - // SCSI-1 Inquiry CDB - // - - struct _CDB6INQUIRY { - UCHAR OperationCode; // 0x12 - SCSIOP_INQUIRY - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR PageCode; - UCHAR IReserved; - UCHAR AllocationLength; - UCHAR Control; - } CDB6INQUIRY; - - // - // SCSI-3 Inquiry CDB - // - - struct _CDB6INQUIRY3 { - UCHAR OperationCode; // 0x12 - SCSIOP_INQUIRY - UCHAR EnableVitalProductData : 1; - UCHAR CommandSupportData : 1; - UCHAR Reserved1 : 6; - UCHAR PageCode; - UCHAR Reserved2; - UCHAR AllocationLength; - UCHAR Control; - } CDB6INQUIRY3; - - struct _CDB6VERIFY { - UCHAR OperationCode; // 0x13 - SCSIOP_VERIFY - UCHAR Fixed : 1; - UCHAR ByteCompare : 1; - UCHAR Immediate : 1; - UCHAR Reserved : 2; - UCHAR LogicalUnitNumber : 3; - UCHAR VerificationLength[3]; - UCHAR Control; - } CDB6VERIFY; - - // - // SCSI Format CDB - // - - struct _CDB6FORMAT { - UCHAR OperationCode; // 0x04 - SCSIOP_FORMAT_UNIT - UCHAR FormatControl : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR FReserved1; - UCHAR InterleaveMsb; - UCHAR InterleaveLsb; - UCHAR FReserved2; - } CDB6FORMAT; - - // - // Standard 10-byte CDB - - struct _CDB10 { - UCHAR OperationCode; - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 2; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlockByte0; - UCHAR LogicalBlockByte1; - UCHAR LogicalBlockByte2; - UCHAR LogicalBlockByte3; - UCHAR Reserved2; - UCHAR TransferBlocksMsb; - UCHAR TransferBlocksLsb; - UCHAR Control; - } CDB10; - - // - // Standard 12-byte CDB - // - - struct _CDB12 { - UCHAR OperationCode; - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 2; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlock[4]; - UCHAR TransferLength[4]; - UCHAR Reserved2; - UCHAR Control; - } CDB12; - - - - // - // Standard 16-byte CDB - // - - struct _CDB16 { - UCHAR OperationCode; - UCHAR Reserved1 : 3; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR Protection : 3; - UCHAR LogicalBlock[8]; - UCHAR TransferLength[4]; - UCHAR Reserved2; - UCHAR Control; - } CDB16; - - - // - // CD Rom Audio CDBs - // - - struct _PAUSE_RESUME { - UCHAR OperationCode; // 0x4B - SCSIOP_PAUSE_RESUME - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[6]; - UCHAR Action; - UCHAR Control; - } PAUSE_RESUME; - - // - // Read Table of Contents - // - - struct _READ_TOC { - UCHAR OperationCode; // 0x43 - SCSIOP_READ_TOC - UCHAR Reserved0 : 1; - UCHAR Msf : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR Format2 : 4; - UCHAR Reserved2 : 4; - UCHAR Reserved3[3]; - UCHAR StartingTrack; - UCHAR AllocationLength[2]; - UCHAR Control : 6; - UCHAR Format : 2; - } READ_TOC; - - struct _READ_DISK_INFORMATION { - UCHAR OperationCode; // 0x51 - SCSIOP_READ_DISC_INFORMATION - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[5]; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_DISK_INFORMATION, READ_DISC_INFORMATION; - - struct _READ_TRACK_INFORMATION { - UCHAR OperationCode; // 0x52 - SCSIOP_READ_TRACK_INFORMATION - UCHAR Track : 2; - UCHAR Reserved4 : 3; - UCHAR Lun : 3; - UCHAR BlockAddress[4]; // or Track Number - UCHAR Reserved3; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_TRACK_INFORMATION; - - struct _RESERVE_TRACK_RZONE { - UCHAR OperationCode; // 0x53 - SCSIOP_RESERVE_TRACK_RZONE - UCHAR Reserved1[4]; - UCHAR ReservationSize[4]; - UCHAR Control; - } RESERVE_TRACK_RZONE; - - struct _SEND_OPC_INFORMATION { - UCHAR OperationCode; // 0x54 - SCSIOP_SEND_OPC_INFORMATION - UCHAR DoOpc : 1; // perform OPC - UCHAR Reserved1 : 7; - UCHAR Exclude0 : 1; // exclude layer 0 - UCHAR Exclude1 : 1; // exclude layer 1 - UCHAR Reserved2 : 6; - UCHAR Reserved3[4]; - UCHAR ParameterListLength[2]; - UCHAR Reserved4; - } SEND_OPC_INFORMATION; - - struct _REPAIR_TRACK { - UCHAR OperationCode; // 0x58 - SCSIOP_REPAIR_TRACK - UCHAR Immediate : 1; - UCHAR Reserved1 : 7; - UCHAR Reserved2[2]; - UCHAR TrackNumber[2]; - UCHAR Reserved3[3]; - UCHAR Control; - } REPAIR_TRACK; - - struct _CLOSE_TRACK { - UCHAR OperationCode; // 0x5B - SCSIOP_CLOSE_TRACK_SESSION - UCHAR Immediate : 1; - UCHAR Reserved1 : 7; - UCHAR Track : 1; - UCHAR Session : 1; - UCHAR Reserved2 : 6; - UCHAR Reserved3; - UCHAR TrackNumber[2]; - UCHAR Reserved4[3]; - UCHAR Control; - } CLOSE_TRACK; - - struct _READ_BUFFER_CAPACITY { - UCHAR OperationCode; // 0x5C - SCSIOP_READ_BUFFER_CAPACITY - UCHAR BlockInfo : 1; - UCHAR Reserved1 : 7; - UCHAR Reserved2[5]; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_BUFFER_CAPACITY; - - struct _SEND_CUE_SHEET { - UCHAR OperationCode; // 0x5D - SCSIOP_SEND_CUE_SHEET - UCHAR Reserved[5]; - UCHAR CueSheetSize[3]; - UCHAR Control; - } SEND_CUE_SHEET; - - struct _READ_HEADER { - UCHAR OperationCode; // 0x44 - SCSIOP_READ_HEADER - UCHAR Reserved1 : 1; - UCHAR Msf : 1; - UCHAR Reserved2 : 3; - UCHAR Lun : 3; - UCHAR LogicalBlockAddress[4]; - UCHAR Reserved3; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_HEADER; - - struct _PLAY_AUDIO { - UCHAR OperationCode; // 0x45 - SCSIOP_PLAY_AUDIO - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR StartingBlockAddress[4]; - UCHAR Reserved2; - UCHAR PlayLength[2]; - UCHAR Control; - } PLAY_AUDIO; - - struct _PLAY_AUDIO_MSF { - UCHAR OperationCode; // 0x47 - SCSIOP_PLAY_AUDIO_MSF - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2; - UCHAR StartingM; - UCHAR StartingS; - UCHAR StartingF; - UCHAR EndingM; - UCHAR EndingS; - UCHAR EndingF; - UCHAR Control; - } PLAY_AUDIO_MSF; - - struct _BLANK_MEDIA { - UCHAR OperationCode; // 0xA1 - SCSIOP_BLANK - UCHAR BlankType : 3; - UCHAR Reserved1 : 1; - UCHAR Immediate : 1; - UCHAR Reserved2 : 3; - UCHAR AddressOrTrack[4]; - UCHAR Reserved3[5]; - UCHAR Control; - } BLANK_MEDIA; - - struct _PLAY_CD { - UCHAR OperationCode; // 0xBC - SCSIOP_PLAY_CD - UCHAR Reserved1 : 1; - UCHAR CMSF : 1; // LBA = 0, MSF = 1 - UCHAR ExpectedSectorType : 3; - UCHAR Lun : 3; - - union { - struct _LBA { - UCHAR StartingBlockAddress[4]; - UCHAR PlayLength[4]; - } LBA; - - struct _MSF { - UCHAR Reserved1; - UCHAR StartingM; - UCHAR StartingS; - UCHAR StartingF; - UCHAR EndingM; - UCHAR EndingS; - UCHAR EndingF; - UCHAR Reserved2; - } MSF; - }; - - UCHAR Audio : 1; - UCHAR Composite : 1; - UCHAR Port1 : 1; - UCHAR Port2 : 1; - UCHAR Reserved2 : 3; - UCHAR Speed : 1; - UCHAR Control; - } PLAY_CD; - - struct _SCAN_CD { - UCHAR OperationCode; // 0xBA - SCSIOP_SCAN_CD - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 3; - UCHAR Direct : 1; - UCHAR Lun : 3; - UCHAR StartingAddress[4]; - UCHAR Reserved2[3]; - UCHAR Reserved3 : 6; - UCHAR Type : 2; - UCHAR Reserved4; - UCHAR Control; - } SCAN_CD; - - struct _STOP_PLAY_SCAN { - UCHAR OperationCode; // 0x4E - SCSIOP_STOP_PLAY_SCAN - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[7]; - UCHAR Control; - } STOP_PLAY_SCAN; - - - // - // Read SubChannel Data - // - - struct _SUBCHANNEL { - UCHAR OperationCode; // 0x42 - SCSIOP_READ_SUB_CHANNEL - UCHAR Reserved0 : 1; - UCHAR Msf : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2 : 6; - UCHAR SubQ : 1; - UCHAR Reserved3 : 1; - UCHAR Format; - UCHAR Reserved4[2]; - UCHAR TrackNumber; - UCHAR AllocationLength[2]; - UCHAR Control; - } SUBCHANNEL; - - // - // Read CD. Used by Atapi for raw sector reads. - // - - struct _READ_CD { - UCHAR OperationCode; // 0xBE - SCSIOP_READ_CD - UCHAR RelativeAddress : 1; - UCHAR Reserved0 : 1; - UCHAR ExpectedSectorType : 3; - UCHAR Lun : 3; - UCHAR StartingLBA[4]; - UCHAR TransferBlocks[3]; - UCHAR Reserved2 : 1; - UCHAR ErrorFlags : 2; - UCHAR IncludeEDC : 1; - UCHAR IncludeUserData : 1; - UCHAR HeaderCode : 2; - UCHAR IncludeSyncData : 1; - UCHAR SubChannelSelection : 3; - UCHAR Reserved3 : 5; - UCHAR Control; - } READ_CD; - - struct _READ_CD_MSF { - UCHAR OperationCode; // 0xB9 - SCSIOP_READ_CD_MSF - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 1; - UCHAR ExpectedSectorType : 3; - UCHAR Lun : 3; - UCHAR Reserved2; - UCHAR StartingM; - UCHAR StartingS; - UCHAR StartingF; - UCHAR EndingM; - UCHAR EndingS; - UCHAR EndingF; - UCHAR Reserved4 : 1; - UCHAR ErrorFlags : 2; - UCHAR IncludeEDC : 1; - UCHAR IncludeUserData : 1; - UCHAR HeaderCode : 2; - UCHAR IncludeSyncData : 1; - UCHAR SubChannelSelection : 3; - UCHAR Reserved5 : 5; - UCHAR Control; - } READ_CD_MSF; - - // - // Plextor Read CD-DA - // - - struct _PLXTR_READ_CDDA { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR Reserved0 : 5; - UCHAR LogicalUnitNumber :3; - UCHAR LogicalBlockByte0; - UCHAR LogicalBlockByte1; - UCHAR LogicalBlockByte2; - UCHAR LogicalBlockByte3; - UCHAR TransferBlockByte0; - UCHAR TransferBlockByte1; - UCHAR TransferBlockByte2; - UCHAR TransferBlockByte3; - UCHAR SubCode; - UCHAR Control; - } PLXTR_READ_CDDA; - - // - // NEC Read CD-DA - // - - struct _NEC_READ_CDDA { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR Reserved0; - UCHAR LogicalBlockByte0; - UCHAR LogicalBlockByte1; - UCHAR LogicalBlockByte2; - UCHAR LogicalBlockByte3; - UCHAR Reserved1; - UCHAR TransferBlockByte0; - UCHAR TransferBlockByte1; - UCHAR Control; - } NEC_READ_CDDA; - - // - // Mode sense - // - - struct _MODE_SENSE { - UCHAR OperationCode; // 0x1A - SCSIOP_MODE_SENSE - UCHAR Reserved1 : 3; - UCHAR Dbd : 1; - UCHAR Reserved2 : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR PageCode : 6; - UCHAR Pc : 2; - UCHAR Reserved3; - UCHAR AllocationLength; - UCHAR Control; - } MODE_SENSE; - - struct _MODE_SENSE10 { - UCHAR OperationCode; // 0x5A - SCSIOP_MODE_SENSE10 - UCHAR Reserved1 : 3; - UCHAR Dbd : 1; - UCHAR Reserved2 : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR PageCode : 6; - UCHAR Pc : 2; - UCHAR Reserved3[4]; - UCHAR AllocationLength[2]; - UCHAR Control; - } MODE_SENSE10; - - // - // Mode select - // - - struct _MODE_SELECT { - UCHAR OperationCode; // 0x15 - SCSIOP_MODE_SELECT - UCHAR SPBit : 1; - UCHAR Reserved1 : 3; - UCHAR PFBit : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[2]; - UCHAR ParameterListLength; - UCHAR Control; - } MODE_SELECT; - - struct _MODE_SELECT10 { - UCHAR OperationCode; // 0x55 - SCSIOP_MODE_SELECT10 - UCHAR SPBit : 1; - UCHAR Reserved1 : 3; - UCHAR PFBit : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[5]; - UCHAR ParameterListLength[2]; - UCHAR Control; - } MODE_SELECT10; - - struct _LOCATE { - UCHAR OperationCode; // 0x2B - SCSIOP_LOCATE - UCHAR Immediate : 1; - UCHAR CPBit : 1; - UCHAR BTBit : 1; - UCHAR Reserved1 : 2; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved3; - UCHAR LogicalBlockAddress[4]; - UCHAR Reserved4; - UCHAR Partition; - UCHAR Control; - } LOCATE; - - struct _LOGSENSE { - UCHAR OperationCode; // 0x4D - SCSIOP_LOG_SENSE - UCHAR SPBit : 1; - UCHAR PPCBit : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR PageCode : 6; - UCHAR PCBit : 2; - UCHAR Reserved2; - UCHAR Reserved3; - UCHAR ParameterPointer[2]; - UCHAR AllocationLength[2]; - UCHAR Control; - } LOGSENSE; - - struct _LOGSELECT { - UCHAR OperationCode; // 0x4C - SCSIOP_LOG_SELECT - UCHAR SPBit : 1; - UCHAR PCRBit : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved : 6; - UCHAR PCBit : 2; - UCHAR Reserved2[4]; - UCHAR ParameterListLength[2]; - UCHAR Control; - } LOGSELECT; - - struct _PRINT { - UCHAR OperationCode; // 0x0A - SCSIOP_PRINT - UCHAR Reserved : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR TransferLength[3]; - UCHAR Control; - } PRINT; - - struct _SEEK { - UCHAR OperationCode; // 0x2B - SCSIOP_SEEK - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlockAddress[4]; - UCHAR Reserved2[3]; - UCHAR Control; - } SEEK; - - struct _ERASE { - UCHAR OperationCode; // 0x19 - SCSIOP_ERASE - UCHAR Long : 1; - UCHAR Immediate : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[3]; - UCHAR Control; - } ERASE; - - struct _START_STOP { - UCHAR OperationCode; // 0x1B - SCSIOP_START_STOP_UNIT - UCHAR Immediate: 1; - UCHAR Reserved1 : 4; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[2]; - UCHAR Start : 1; - UCHAR LoadEject : 1; - UCHAR Reserved3 : 6; - UCHAR Control; - } START_STOP; - - struct _MEDIA_REMOVAL { - UCHAR OperationCode; // 0x1E - SCSIOP_MEDIUM_REMOVAL - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[2]; - - UCHAR Prevent : 1; - UCHAR Persistant : 1; - UCHAR Reserved3 : 6; - - UCHAR Control; - } MEDIA_REMOVAL; - - // - // Tape CDBs - // - - struct _SEEK_BLOCK { - UCHAR OperationCode; // 0x0C - SCSIOP_SEEK_BLOCK - UCHAR Immediate : 1; - UCHAR Reserved1 : 7; - UCHAR BlockAddress[3]; - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved2 : 4; - UCHAR VendorUnique : 2; - } SEEK_BLOCK; - - struct _REQUEST_BLOCK_ADDRESS { - UCHAR OperationCode; // 0x02 - SCSIOP_REQUEST_BLOCK_ADDR - UCHAR Reserved1[3]; - UCHAR AllocationLength; - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved2 : 4; - UCHAR VendorUnique : 2; - } REQUEST_BLOCK_ADDRESS; - - struct _PARTITION { - UCHAR OperationCode; // 0x0D - SCSIOP_PARTITION - UCHAR Immediate : 1; - UCHAR Sel: 1; - UCHAR PartitionSelect : 6; - UCHAR Reserved1[3]; - UCHAR Control; - } PARTITION; - - struct _WRITE_TAPE_MARKS { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR Immediate : 1; - UCHAR WriteSetMarks: 1; - UCHAR Reserved : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR TransferLength[3]; - UCHAR Control; - } WRITE_TAPE_MARKS; - - struct _SPACE_TAPE_MARKS { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR Code : 3; - UCHAR Reserved : 2; - UCHAR LogicalUnitNumber : 3; - UCHAR NumMarksMSB ; - UCHAR NumMarks; - UCHAR NumMarksLSB; - union { - UCHAR value; - struct { - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved : 4; - UCHAR VendorUnique : 2; - } Fields; - } Byte6; - } SPACE_TAPE_MARKS; - - // - // Read tape position - // - - struct _READ_POSITION { - UCHAR Operation; // 0x43 - SCSIOP_READ_POSITION - UCHAR BlockType:1; - UCHAR Reserved1:4; - UCHAR Lun:3; - UCHAR Reserved2[7]; - UCHAR Control; - } READ_POSITION; - - // - // ReadWrite for Tape - // - - struct _CDB6READWRITETAPE { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR VendorSpecific : 5; - UCHAR Reserved : 3; - UCHAR TransferLenMSB; - UCHAR TransferLen; - UCHAR TransferLenLSB; - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved1 : 4; - UCHAR VendorUnique : 2; - } CDB6READWRITETAPE; - - // - // Medium changer CDB's - // - - struct _INIT_ELEMENT_STATUS { - UCHAR OperationCode; // 0x07 - SCSIOP_INIT_ELEMENT_STATUS - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNubmer : 3; - UCHAR Reserved2[3]; - UCHAR Reserved3 : 7; - UCHAR NoBarCode : 1; - } INIT_ELEMENT_STATUS; - - struct _INITIALIZE_ELEMENT_RANGE { - UCHAR OperationCode; // 0xE7 - SCSIOP_INIT_ELEMENT_RANGE - UCHAR Range : 1; - UCHAR Reserved1 : 4; - UCHAR LogicalUnitNubmer : 3; - UCHAR FirstElementAddress[2]; - UCHAR Reserved2[2]; - UCHAR NumberOfElements[2]; - UCHAR Reserved3; - UCHAR Reserved4 : 7; - UCHAR NoBarCode : 1; - } INITIALIZE_ELEMENT_RANGE; - - struct _POSITION_TO_ELEMENT { - UCHAR OperationCode; // 0x2B - SCSIOP_POSITION_TO_ELEMENT - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR TransportElementAddress[2]; - UCHAR DestinationElementAddress[2]; - UCHAR Reserved2[2]; - UCHAR Flip : 1; - UCHAR Reserved3 : 7; - UCHAR Control; - } POSITION_TO_ELEMENT; - - struct _MOVE_MEDIUM { - UCHAR OperationCode; // 0xA5 - SCSIOP_MOVE_MEDIUM - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR TransportElementAddress[2]; - UCHAR SourceElementAddress[2]; - UCHAR DestinationElementAddress[2]; - UCHAR Reserved2[2]; - UCHAR Flip : 1; - UCHAR Reserved3 : 7; - UCHAR Control; - } MOVE_MEDIUM; - - struct _EXCHANGE_MEDIUM { - UCHAR OperationCode; // 0xA6 - SCSIOP_EXCHANGE_MEDIUM - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR TransportElementAddress[2]; - UCHAR SourceElementAddress[2]; - UCHAR Destination1ElementAddress[2]; - UCHAR Destination2ElementAddress[2]; - UCHAR Flip1 : 1; - UCHAR Flip2 : 1; - UCHAR Reserved3 : 6; - UCHAR Control; - } EXCHANGE_MEDIUM; - - struct _READ_ELEMENT_STATUS { - UCHAR OperationCode; // 0xB8 - SCSIOP_READ_ELEMENT_STATUS - UCHAR ElementType : 4; - UCHAR VolTag : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR StartingElementAddress[2]; - UCHAR NumberOfElements[2]; - UCHAR Reserved1; - UCHAR AllocationLength[3]; - UCHAR Reserved2; - UCHAR Control; - } READ_ELEMENT_STATUS; - - struct _SEND_VOLUME_TAG { - UCHAR OperationCode; // 0xB6 - SCSIOP_SEND_VOLUME_TAG - UCHAR ElementType : 4; - UCHAR Reserved1 : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR StartingElementAddress[2]; - UCHAR Reserved2; - UCHAR ActionCode : 5; - UCHAR Reserved3 : 3; - UCHAR Reserved4[2]; - UCHAR ParameterListLength[2]; - UCHAR Reserved5; - UCHAR Control; - } SEND_VOLUME_TAG; - - struct _REQUEST_VOLUME_ELEMENT_ADDRESS { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR ElementType : 4; - UCHAR VolTag : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR StartingElementAddress[2]; - UCHAR NumberElements[2]; - UCHAR Reserved1; - UCHAR AllocationLength[3]; - UCHAR Reserved2; - UCHAR Control; - } REQUEST_VOLUME_ELEMENT_ADDRESS; - - // - // Atapi 2.5 Changer 12-byte CDBs - // - - struct _LOAD_UNLOAD { - UCHAR OperationCode; // 0xA6 - SCSIOP_LOAD_UNLOAD_SLOT - UCHAR Immediate : 1; - UCHAR Reserved1 : 4; - UCHAR Lun : 3; - UCHAR Reserved2[2]; - UCHAR Start : 1; - UCHAR LoadEject : 1; - UCHAR Reserved3: 6; - UCHAR Reserved4[3]; - UCHAR Slot; - UCHAR Reserved5[3]; - } LOAD_UNLOAD; - - struct _MECH_STATUS { - UCHAR OperationCode; // 0xBD - SCSIOP_MECHANISM_STATUS - UCHAR Reserved : 5; - UCHAR Lun : 3; - UCHAR Reserved1[6]; - UCHAR AllocationLength[2]; - UCHAR Reserved2[1]; - UCHAR Control; - } MECH_STATUS; - - // - // C/DVD 0.9 CDBs - // - - struct _SYNCHRONIZE_CACHE10 { - - UCHAR OperationCode; // 0x35 - SCSIOP_SYNCHRONIZE_CACHE - - UCHAR RelAddr : 1; - UCHAR Immediate : 1; - UCHAR Reserved : 3; - UCHAR Lun : 3; - - UCHAR LogicalBlockAddress[4]; // Unused - set to zero - UCHAR Reserved2; - UCHAR BlockCount[2]; // Unused - set to zero - UCHAR Control; - } SYNCHRONIZE_CACHE10; - - struct _GET_EVENT_STATUS_NOTIFICATION { - UCHAR OperationCode; // 0x4A - SCSIOP_GET_EVENT_STATUS_NOTIFICATION - - UCHAR Immediate : 1; - UCHAR Reserved : 4; - UCHAR Lun : 3; - - UCHAR Reserved2[2]; - UCHAR NotificationClassRequest; - UCHAR Reserved3[2]; - UCHAR EventListLength[2]; - - UCHAR Control; - } GET_EVENT_STATUS_NOTIFICATION; - - struct _GET_PERFORMANCE { - UCHAR OperationCode; // 0xAC - SCSIOP_GET_PERFORMANCE - UCHAR Except : 2; - UCHAR Write : 1; - UCHAR Tolerance : 2; - UCHAR Reserved0 : 3; - UCHAR StartingLBA[4]; - UCHAR Reserved1[2]; - UCHAR MaximumNumberOfDescriptors[2]; - UCHAR Type; - UCHAR Control; - } GET_PERFORMANCE; - - struct _READ_DVD_STRUCTURE { - UCHAR OperationCode; // 0xAD - SCSIOP_READ_DVD_STRUCTURE - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR RMDBlockNumber[4]; - UCHAR LayerNumber; - UCHAR Format; - UCHAR AllocationLength[2]; - UCHAR Reserved3 : 6; - UCHAR AGID : 2; - UCHAR Control; - } READ_DVD_STRUCTURE; - - struct _SET_STREAMING { - UCHAR OperationCode; // 0xB6 - SCSIOP_SET_STREAMING - UCHAR Reserved[8]; - UCHAR ParameterListLength[2]; - UCHAR Control; - } SET_STREAMING; - - struct _SEND_DVD_STRUCTURE { - UCHAR OperationCode; // 0xBF - SCSIOP_SEND_DVD_STRUCTURE - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[5]; - UCHAR Format; - UCHAR ParameterListLength[2]; - UCHAR Reserved3; - UCHAR Control; - } SEND_DVD_STRUCTURE; - - struct _SEND_KEY { - UCHAR OperationCode; // 0xA3 - SCSIOP_SEND_KEY - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[6]; - UCHAR ParameterListLength[2]; - UCHAR KeyFormat : 6; - UCHAR AGID : 2; - UCHAR Control; - } SEND_KEY; - - struct _REPORT_KEY { - UCHAR OperationCode; // 0xA4 - SCSIOP_REPORT_KEY - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR LogicalBlockAddress[4]; // for title key - UCHAR Reserved2[2]; - UCHAR AllocationLength[2]; - UCHAR KeyFormat : 6; - UCHAR AGID : 2; - UCHAR Control; - } REPORT_KEY; - - struct _SET_READ_AHEAD { - UCHAR OperationCode; // 0xA7 - SCSIOP_SET_READ_AHEAD - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR TriggerLBA[4]; - UCHAR ReadAheadLBA[4]; - UCHAR Reserved2; - UCHAR Control; - } SET_READ_AHEAD; - - struct _READ_FORMATTED_CAPACITIES { - UCHAR OperationCode; // 0x23 - SCSIOP_READ_FORMATTED_CAPACITY - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[5]; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_FORMATTED_CAPACITIES; - - // - // SCSI-3 - // - - struct _REPORT_LUNS { - UCHAR OperationCode; // 0xA0 - SCSIOP_REPORT_LUNS - UCHAR Reserved1[5]; - UCHAR AllocationLength[4]; - UCHAR Reserved2[1]; - UCHAR Control; - } REPORT_LUNS; - - struct _PERSISTENT_RESERVE_IN { - UCHAR OperationCode; // 0x5E - SCSIOP_PERSISTENT_RESERVE_IN - UCHAR ServiceAction : 5; - UCHAR Reserved1 : 3; - UCHAR Reserved2[5]; - UCHAR AllocationLength[2]; - UCHAR Control; - } PERSISTENT_RESERVE_IN; - - struct _PERSISTENT_RESERVE_OUT { - UCHAR OperationCode; // 0x5F - SCSIOP_PERSISTENT_RESERVE_OUT - UCHAR ServiceAction : 5; - UCHAR Reserved1 : 3; - UCHAR Type : 4; - UCHAR Scope : 4; - UCHAR Reserved2[4]; - UCHAR ParameterListLength[2]; // 0x18 - UCHAR Control; - } PERSISTENT_RESERVE_OUT; - - // - // MMC / SFF-8090 commands - // - - struct _GET_CONFIGURATION { - UCHAR OperationCode; // 0x46 - SCSIOP_GET_CONFIGURATION - UCHAR RequestType : 2; // SCSI_GET_CONFIGURATION_REQUEST_TYPE_* - UCHAR Reserved1 : 6; // includes obsolete LUN field - UCHAR StartingFeature[2]; - UCHAR Reserved2[3]; - UCHAR AllocationLength[2]; - UCHAR Control; - } GET_CONFIGURATION; - - struct _SET_CD_SPEED { - UCHAR OperationCode; // 0xB8 - SCSIOP_SET_CD_SPEED - union { - UCHAR Reserved1; - struct { - UCHAR RotationControl : 2; - UCHAR Reserved3 : 6; - }; - }; - UCHAR ReadSpeed[2]; // 1x == (75 * 2352) - UCHAR WriteSpeed[2]; // 1x == (75 * 2352) - UCHAR Reserved2[5]; - UCHAR Control; - } SET_CD_SPEED; - - struct _READ12 { - UCHAR OperationCode; // 0xA8 - SCSIOP_READ12 - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 2; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlock[4]; - UCHAR TransferLength[4]; - UCHAR Reserved2 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } READ12; - - struct _WRITE12 { - UCHAR OperationCode; // 0xAA - SCSIOP_WRITE12 - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 1; - UCHAR EBP : 1; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlock[4]; - UCHAR TransferLength[4]; - UCHAR Reserved2 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } WRITE12; - - // - // 16-byte CDBs - // - - struct _READ16 { - UCHAR OperationCode; // 0x88 - SCSIOP_READ16 - UCHAR Reserved1 : 3; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR ReadProtect : 3; - UCHAR LogicalBlock[8]; - UCHAR TransferLength[4]; - UCHAR Reserved2 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } READ16; - - struct _WRITE16 { - UCHAR OperationCode; // 0x8A - SCSIOP_WRITE16 - UCHAR Reserved1 : 3; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR WriteProtect : 3; - UCHAR LogicalBlock[8]; - UCHAR TransferLength[4]; - UCHAR Reserved2 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } WRITE16; - - struct _VERIFY16 { - UCHAR OperationCode; // 0x8F - SCSIOP_VERIFY16 - UCHAR Reserved1 : 1; - UCHAR ByteCheck : 1; - UCHAR BlockVerify : 1; - UCHAR Reserved2 : 1; - UCHAR DisablePageOut : 1; - UCHAR VerifyProtect : 3; - UCHAR LogicalBlock[8]; - UCHAR VerificationLength[4]; - UCHAR Reserved3 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } VERIFY16; - - struct _SYNCHRONIZE_CACHE16 { - UCHAR OperationCode; // 0x91 - SCSIOP_SYNCHRONIZE_CACHE16 - UCHAR Reserved1 : 1; - UCHAR Immediate : 1; - UCHAR Reserved2 : 6; - UCHAR LogicalBlock[8]; - UCHAR BlockCount[4]; - UCHAR Reserved3; - UCHAR Control; - } SYNCHRONIZE_CACHE16; - - struct _READ_CAPACITY16 { - UCHAR OperationCode; // 0x9E - SCSIOP_READ_CAPACITY16 - UCHAR ServiceAction : 5; - UCHAR Reserved1 : 3; - UCHAR LogicalBlock[8]; - UCHAR BlockCount[4]; - UCHAR PMI : 1; - UCHAR Reserved2 : 7; - UCHAR Control; - } READ_CAPACITY16; - - ULONG AsUlong[4]; - UCHAR AsByte[16]; - -} CDB, *PCDB; -#pragma pack(pop, cdb) - -//////////////////////////////////////////////////////////////////////////////// -// -// GET_EVENT_STATUS_NOTIFICATION -// - - -#define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_MASK 0x02 -#define NOTIFICATION_POWER_MANAGEMENT_CLASS_MASK 0x04 -#define NOTIFICATION_EXTERNAL_REQUEST_CLASS_MASK 0x08 -#define NOTIFICATION_MEDIA_STATUS_CLASS_MASK 0x10 -#define NOTIFICATION_MULTI_HOST_CLASS_MASK 0x20 -#define NOTIFICATION_DEVICE_BUSY_CLASS_MASK 0x40 - - -#define NOTIFICATION_NO_CLASS_EVENTS 0x0 -#define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_EVENTS 0x1 -#define NOTIFICATION_POWER_MANAGEMENT_CLASS_EVENTS 0x2 -#define NOTIFICATION_EXTERNAL_REQUEST_CLASS_EVENTS 0x3 -#define NOTIFICATION_MEDIA_STATUS_CLASS_EVENTS 0x4 -#define NOTIFICATION_MULTI_HOST_CLASS_EVENTS 0x5 -#define NOTIFICATION_DEVICE_BUSY_CLASS_EVENTS 0x6 - -#pragma pack(push, not_header, 1) -typedef struct _NOTIFICATION_EVENT_STATUS_HEADER { - UCHAR EventDataLength[2]; - - UCHAR NotificationClass : 3; - UCHAR Reserved : 4; - UCHAR NEA : 1; - - UCHAR SupportedEventClasses; -#if !defined(__midl) - UCHAR ClassEventData[0]; -#endif -} NOTIFICATION_EVENT_STATUS_HEADER, *PNOTIFICATION_EVENT_STATUS_HEADER; -#pragma pack(pop, not_header) - -#define NOTIFICATION_OPERATIONAL_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_REQUESTED 0x1 -#define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_OCCURRED 0x2 - -#define NOTIFICATION_OPERATIONAL_STATUS_AVAILABLE 0x0 -#define NOTIFICATION_OPERATIONAL_STATUS_TEMPORARY_BUSY 0x1 -#define NOTIFICATION_OPERATIONAL_STATUS_EXTENDED_BUSY 0x2 - -#define NOTIFICATION_OPERATIONAL_OPCODE_NONE 0x0 -#define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_CHANGE 0x1 -#define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_ADDED 0x2 -#define NOTIFICATION_OPERATIONAL_OPCODE_UNIT_RESET 0x3 -#define NOTIFICATION_OPERATIONAL_OPCODE_FIRMWARE_CHANGED 0x4 -#define NOTIFICATION_OPERATIONAL_OPCODE_INQUIRY_CHANGED 0x5 - -// -// Class event data may be one (or none) of the following: -// - -#pragma pack(push, not_op, 1) -typedef struct _NOTIFICATION_OPERATIONAL_STATUS { // event class == 0x1 - UCHAR OperationalEvent : 4; - UCHAR Reserved1 : 4; - UCHAR OperationalStatus : 4; - UCHAR Reserved2 : 3; - UCHAR PersistentPrevented : 1; - UCHAR Operation[2]; -} NOTIFICATION_OPERATIONAL_STATUS, *PNOTIFICATION_OPERATIONAL_STATUS; -#pragma pack(pop, not_op) - - -#define NOTIFICATION_POWER_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_POWER_EVENT_CHANGE_SUCCEEDED 0x1 -#define NOTIFICATION_POWER_EVENT_CHANGE_FAILED 0x2 - -#define NOTIFICATION_POWER_STATUS_ACTIVE 0x1 -#define NOTIFICATION_POWER_STATUS_IDLE 0x2 -#define NOTIFICATION_POWER_STATUS_STANDBY 0x3 -#define NOTIFICATION_POWER_STATUS_SLEEP 0x4 - -#pragma pack(push, not_power, 1) -typedef struct _NOTIFICATION_POWER_STATUS { // event class == 0x2 - UCHAR PowerEvent : 4; - UCHAR Reserved : 4; - UCHAR PowerStatus; - UCHAR Reserved2[2]; -} NOTIFICATION_POWER_STATUS, *PNOTIFICATION_POWER_STATUS; -#pragma pack(pop, not_power) - -#define NOTIFICATION_MEDIA_EVENT_NO_EVENT 0x0 -#define NOTIFICATION_EXTERNAL_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_EXTERNAL_EVENT_BUTTON_DOWN 0x1 -#define NOTIFICATION_EXTERNAL_EVENT_BUTTON_UP 0x2 -#define NOTIFICATION_EXTERNAL_EVENT_EXTERNAL 0x3 // respond with GET_CONFIGURATION? - -#define NOTIFICATION_EXTERNAL_STATUS_READY 0x0 -#define NOTIFICATION_EXTERNAL_STATUS_PREVENT 0x1 - -#define NOTIFICATION_EXTERNAL_REQUEST_NONE 0x0000 -#define NOTIFICATION_EXTERNAL_REQUEST_QUEUE_OVERRUN 0x0001 -#define NOTIFICATION_EXTERNAL_REQUEST_PLAY 0x0101 -#define NOTIFICATION_EXTERNAL_REQUEST_REWIND_BACK 0x0102 -#define NOTIFICATION_EXTERNAL_REQUEST_FAST_FORWARD 0x0103 -#define NOTIFICATION_EXTERNAL_REQUEST_PAUSE 0x0104 -#define NOTIFICATION_EXTERNAL_REQUEST_STOP 0x0106 -#define NOTIFICATION_EXTERNAL_REQUEST_ASCII_LOW 0x0200 -#define NOTIFICATION_EXTERNAL_REQUEST_ASCII_HIGH 0x02ff - -#pragma pack(push, not_extern, 1) -typedef struct _NOTIFICATION_EXTERNAL_STATUS { // event class == 0x3 - UCHAR ExternalEvent : 4; - UCHAR Reserved1 : 4; - UCHAR ExternalStatus : 4; - UCHAR Reserved2 : 3; - UCHAR PersistentPrevented : 1; - UCHAR Request[2]; -} NOTIFICATION_EXTERNAL_STATUS, *PNOTIFICATION_EXTERNAL_STATUS; -#pragma pack(pop, not_extern) - -#define NOTIFICATION_MEDIA_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_MEDIA_EVENT_EJECT_REQUEST 0x1 -#define NOTIFICATION_MEDIA_EVENT_NEW_MEDIA 0x2 -#define NOTIFICATION_MEDIA_EVENT_MEDIA_REMOVAL 0x3 -#define NOTIFICATION_MEDIA_EVENT_MEDIA_CHANGE 0x4 - -#pragma pack(push, not_media, 1) -typedef struct _NOTIFICATION_MEDIA_STATUS { // event class == 0x4 - UCHAR MediaEvent : 4; - UCHAR Reserved : 4; - - union { - UCHAR PowerStatus; // OBSOLETE -- was improperly named in NT5 headers - UCHAR MediaStatus; // Use this for currently reserved fields - struct { - UCHAR DoorTrayOpen : 1; - UCHAR MediaPresent : 1; - UCHAR ReservedX : 6; // do not reference this directly! - }; - }; - UCHAR StartSlot; - UCHAR EndSlot; -} NOTIFICATION_MEDIA_STATUS, *PNOTIFICATION_MEDIA_STATUS; -#pragma pack(pop, not_media) - -#define NOTIFICATION_BUSY_EVENT_NO_EVENT 0x0 -#define NOTIFICATION_MULTI_HOST_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_REQUEST 0x1 -#define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_GRANT 0x2 -#define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_RELEASE 0x3 - -#define NOTIFICATION_MULTI_HOST_STATUS_READY 0x0 -#define NOTIFICATION_MULTI_HOST_STATUS_PREVENT 0x1 - -#define NOTIFICATION_MULTI_HOST_PRIORITY_NO_REQUESTS 0x0 -#define NOTIFICATION_MULTI_HOST_PRIORITY_LOW 0x1 -#define NOTIFICATION_MULTI_HOST_PRIORITY_MEDIUM 0x2 -#define NOTIFICATION_MULTI_HOST_PRIORITY_HIGH 0x3 - -#pragma pack(push, not_multi, 1) -typedef struct _NOTIFICATION_MULTI_HOST_STATUS { // event class == 0x5 - UCHAR MultiHostEvent : 4; - UCHAR Reserved1 : 4; - UCHAR MultiHostStatus : 4; - UCHAR Reserved2 : 3; - UCHAR PersistentPrevented : 1; - UCHAR Priority[2]; -} NOTIFICATION_MULTI_HOST_STATUS, *PNOTIFICATION_MULTI_HOST_STATUS; -#pragma pack(pop, not_multi) - -#define NOTIFICATION_BUSY_EVENT_NO_EVENT 0x0 -#define NOTIFICATION_BUSY_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_BUSY_EVENT_BUSY 0x1 - -#define NOTIFICATION_BUSY_STATUS_NO_EVENT 0x0 -#define NOTIFICATION_BUSY_STATUS_POWER 0x1 -#define NOTIFICATION_BUSY_STATUS_IMMEDIATE 0x2 -#define NOTIFICATION_BUSY_STATUS_DEFERRED 0x3 - -#pragma pack(push, not_busy, 1) -typedef struct _NOTIFICATION_BUSY_STATUS { // event class == 0x6 - UCHAR DeviceBusyEvent : 4; - UCHAR Reserved : 4; - - UCHAR DeviceBusyStatus; - UCHAR Time[2]; -} NOTIFICATION_BUSY_STATUS, *PNOTIFICATION_BUSY_STATUS; -#pragma pack(pop, not_busy) - -//////////////////////////////////////////////////////////////////////////////// - -// -// Read DVD Structure Definitions and Constants -// - -#define DVD_FORMAT_LEAD_IN 0x00 -#define DVD_FORMAT_COPYRIGHT 0x01 -#define DVD_FORMAT_DISK_KEY 0x02 -#define DVD_FORMAT_BCA 0x03 -#define DVD_FORMAT_MANUFACTURING 0x04 - -#pragma pack(push, dvd_struct_header, 1) -typedef struct _READ_DVD_STRUCTURES_HEADER { - UCHAR Length[2]; - UCHAR Reserved[2]; - -#if !defined(__midl) - UCHAR Data[0]; -#endif -} READ_DVD_STRUCTURES_HEADER, *PREAD_DVD_STRUCTURES_HEADER; -#pragma pack(pop, dvd_struct_header) - -// -// DiskKey, BCA & Manufacturer information will provide byte arrays as their -// data. -// - -// -// CDVD 0.9 Send & Report Key Definitions and Structures -// - -#define DVD_REPORT_AGID 0x00 -#define DVD_CHALLENGE_KEY 0x01 -#define DVD_KEY_1 0x02 -#define DVD_KEY_2 0x03 -#define DVD_TITLE_KEY 0x04 -#define DVD_REPORT_ASF 0x05 -#define DVD_INVALIDATE_AGID 0x3F - -#pragma pack(push, dvdstuff, 1) -typedef struct _CDVD_KEY_HEADER { - UCHAR DataLength[2]; - UCHAR Reserved[2]; -#if !defined(__midl) - UCHAR Data[0]; -#endif -} CDVD_KEY_HEADER, *PCDVD_KEY_HEADER; - -typedef struct _CDVD_REPORT_AGID_DATA { - UCHAR Reserved1[3]; - UCHAR Reserved2 : 6; - UCHAR AGID : 2; -} CDVD_REPORT_AGID_DATA, *PCDVD_REPORT_AGID_DATA; - -typedef struct _CDVD_CHALLENGE_KEY_DATA { - UCHAR ChallengeKeyValue[10]; - UCHAR Reserved[2]; -} CDVD_CHALLENGE_KEY_DATA, *PCDVD_CHALLENGE_KEY_DATA; - -typedef struct _CDVD_KEY_DATA { - UCHAR Key[5]; - UCHAR Reserved[3]; -} CDVD_KEY_DATA, *PCDVD_KEY_DATA; - -typedef struct _CDVD_REPORT_ASF_DATA { - UCHAR Reserved1[3]; - UCHAR Success : 1; - UCHAR Reserved2 : 7; -} CDVD_REPORT_ASF_DATA, *PCDVD_REPORT_ASF_DATA; - -typedef struct _CDVD_TITLE_KEY_HEADER { - UCHAR DataLength[2]; - UCHAR Reserved1[1]; - UCHAR Reserved2 : 3; - UCHAR CGMS : 2; - UCHAR CP_SEC : 1; - UCHAR CPM : 1; - UCHAR Zero : 1; - CDVD_KEY_DATA TitleKey; -} CDVD_TITLE_KEY_HEADER, *PCDVD_TITLE_KEY_HEADER; -#pragma pack(pop, dvdstuff) - - -// -// Format Unit Data definitions and structures -// - -#pragma pack(push, format_unit, 1) -typedef struct _FORMAT_DESCRIPTOR { - UCHAR NumberOfBlocks[4]; - UCHAR FormatSubType : 2; - UCHAR FormatType : 6; - UCHAR BlockLength[3]; -} FORMAT_DESCRIPTOR, *PFORMAT_DESCRIPTOR; - -typedef struct _FORMAT_LIST_HEADER { - UCHAR Reserved; - UCHAR VendorSpecific : 1; - UCHAR Immediate : 1; - UCHAR TryOut : 1; - UCHAR IP : 1; - UCHAR STPF : 1; - UCHAR DCRT : 1; - UCHAR DPRY : 1; - UCHAR FOV : 1; - UCHAR FormatDescriptorLength[2]; -#if !defined(__midl) - FORMAT_DESCRIPTOR Descriptors[0]; -#endif -} FORMAT_LIST_HEADER, *PFORMAT_LIST_HEADER; -#pragma pack(pop, format_unit) - -// -// Read Formatted Capacity Data - returned in Big Endian Format -// - - -#pragma pack(push, formatted_capacity, 1) -typedef struct _FORMATTED_CAPACITY_DESCRIPTOR { - UCHAR NumberOfBlocks[4]; - UCHAR Maximum : 1; - UCHAR Valid : 1; - UCHAR FormatType : 6; - UCHAR BlockLength[3]; -} FORMATTED_CAPACITY_DESCRIPTOR, *PFORMATTED_CAPACITY_DESCRIPTOR; - -typedef struct _FORMATTED_CAPACITY_LIST { - UCHAR Reserved[3]; - UCHAR CapacityListLength; -#if !defined(__midl) - FORMATTED_CAPACITY_DESCRIPTOR Descriptors[0]; -#endif -} FORMATTED_CAPACITY_LIST, *PFORMATTED_CAPACITY_LIST; -#pragma pack(pop, formatted_capacity) - -// -// BLANK command blanking type codes -// - -#define BLANK_FULL 0x0 -#define BLANK_MINIMAL 0x1 -#define BLANK_TRACK 0x2 -#define BLANK_UNRESERVE_TRACK 0x3 -#define BLANK_TAIL 0x4 -#define BLANK_UNCLOSE_SESSION 0x5 -#define BLANK_SESSION 0x6 - -// -// PLAY_CD definitions and constants -// - -#define CD_EXPECTED_SECTOR_ANY 0x0 -#define CD_EXPECTED_SECTOR_CDDA 0x1 -#define CD_EXPECTED_SECTOR_MODE1 0x2 -#define CD_EXPECTED_SECTOR_MODE2 0x3 -#define CD_EXPECTED_SECTOR_MODE2_FORM1 0x4 -#define CD_EXPECTED_SECTOR_MODE2_FORM2 0x5 - -// -// Read Disk Information Definitions and Capabilities -// - -#define DISK_STATUS_EMPTY 0x00 -#define DISK_STATUS_INCOMPLETE 0x01 -#define DISK_STATUS_COMPLETE 0x02 -#define DISK_STATUS_OTHERS 0x03 - -#define LAST_SESSION_EMPTY 0x00 -#define LAST_SESSION_INCOMPLETE 0x01 -#define LAST_SESSION_RESERVED_DAMAGED 0x02 -#define LAST_SESSION_COMPLETE 0x03 - -#define DISK_TYPE_CDDA 0x00 -#define DISK_TYPE_CDI 0x10 -#define DISK_TYPE_XA 0x20 -#define DISK_TYPE_UNDEFINED 0xFF - -// -// Values for MrwStatus field. -// - -#define DISC_BGFORMAT_STATE_NONE 0x0 -#define DISC_BGFORMAT_STATE_INCOMPLETE 0x1 -#define DISC_BGFORMAT_STATE_RUNNING 0x2 -#define DISC_BGFORMAT_STATE_COMPLETE 0x3 - - -#pragma pack(push, discinfo, 1) -typedef struct _OPC_TABLE_ENTRY { - UCHAR Speed[2]; - UCHAR OPCValue[6]; -} OPC_TABLE_ENTRY, *POPC_TABLE_ENTRY; - -typedef struct _DISC_INFORMATION { - - UCHAR Length[2]; - UCHAR DiscStatus : 2; - UCHAR LastSessionStatus : 2; - UCHAR Erasable : 1; - UCHAR Reserved1 : 3; - UCHAR FirstTrackNumber; - - UCHAR NumberOfSessionsLsb; - UCHAR LastSessionFirstTrackLsb; - UCHAR LastSessionLastTrackLsb; - UCHAR MrwStatus : 2; - UCHAR MrwDirtyBit : 1; - UCHAR Reserved2 : 2; - UCHAR URU : 1; - UCHAR DBC_V : 1; - UCHAR DID_V : 1; - - UCHAR DiscType; - UCHAR NumberOfSessionsMsb; - UCHAR LastSessionFirstTrackMsb; - UCHAR LastSessionLastTrackMsb; - - UCHAR DiskIdentification[4]; - UCHAR LastSessionLeadIn[4]; // HMSF - UCHAR LastPossibleLeadOutStartTime[4]; // HMSF - UCHAR DiskBarCode[8]; - - UCHAR Reserved4; - UCHAR NumberOPCEntries; - OPC_TABLE_ENTRY OPCTable[ 1 ]; // can be many of these here.... - -} DISC_INFORMATION, *PDISC_INFORMATION; - -// TODO: Deprecate DISK_INFORMATION -//#if PRAGMA_DEPRECATED_DDK -//#pragma deprecated(_DISK_INFORMATION) // Use DISC_INFORMATION, note size change -//#pragma deprecated( DISK_INFORMATION) // Use DISC_INFORMATION, note size change -//#pragma deprecated(PDISK_INFORMATION) // Use DISC_INFORMATION, note size change -//#endif - -typedef struct _DISK_INFORMATION { - UCHAR Length[2]; - - UCHAR DiskStatus : 2; - UCHAR LastSessionStatus : 2; - UCHAR Erasable : 1; - UCHAR Reserved1 : 3; - - UCHAR FirstTrackNumber; - UCHAR NumberOfSessions; - UCHAR LastSessionFirstTrack; - UCHAR LastSessionLastTrack; - - UCHAR Reserved2 : 5; - UCHAR GEN : 1; - UCHAR DBC_V : 1; - UCHAR DID_V : 1; - - UCHAR DiskType; - UCHAR Reserved3[3]; - - UCHAR DiskIdentification[4]; - UCHAR LastSessionLeadIn[4]; // MSF - UCHAR LastPossibleStartTime[4]; // MSF - UCHAR DiskBarCode[8]; - - UCHAR Reserved4; - UCHAR NumberOPCEntries; -#if !defined(__midl) - OPC_TABLE_ENTRY OPCTable[0]; -#endif -} DISK_INFORMATION, *PDISK_INFORMATION; -#pragma pack(pop, discinfo) - - -// -// Read Header definitions and structures -// -#pragma pack(push, cdheader, 1) -typedef struct _DATA_BLOCK_HEADER { - UCHAR DataMode; - UCHAR Reserved[4]; - union { - UCHAR LogicalBlockAddress[4]; - struct { - UCHAR Reserved; - UCHAR M; - UCHAR S; - UCHAR F; - } MSF; - }; -} DATA_BLOCK_HEADER, *PDATA_BLOCK_HEADER; -#pragma pack(pop, cdheader) - - -#define DATA_BLOCK_MODE0 0x0 -#define DATA_BLOCK_MODE1 0x1 -#define DATA_BLOCK_MODE2 0x2 - -// -// Read TOC Format Codes -// - -#define READ_TOC_FORMAT_TOC 0x00 -#define READ_TOC_FORMAT_SESSION 0x01 -#define READ_TOC_FORMAT_FULL_TOC 0x02 -#define READ_TOC_FORMAT_PMA 0x03 -#define READ_TOC_FORMAT_ATIP 0x04 - -// TODO: Deprecate TRACK_INFORMATION structure, use TRACK_INFORMATION2 instead -#pragma pack(push, track_info, 1) -typedef struct _TRACK_INFORMATION { - UCHAR Length[2]; - UCHAR TrackNumber; - UCHAR SessionNumber; - UCHAR Reserved1; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR Damage : 1; - UCHAR Reserved2 : 2; - UCHAR DataMode : 4; - UCHAR FP : 1; - UCHAR Packet : 1; - UCHAR Blank : 1; - UCHAR RT : 1; - UCHAR NWA_V : 1; - UCHAR Reserved3 : 7; - UCHAR TrackStartAddress[4]; - UCHAR NextWritableAddress[4]; - UCHAR FreeBlocks[4]; - UCHAR FixedPacketSize[4]; -} TRACK_INFORMATION, *PTRACK_INFORMATION; - -// Second Revision Modifies: -// * Longer names for some fields -// * LSB to track/session number fields -// * LRA_V bit -// Second Revision Adds: -// * TrackSize -// * LastRecordedAddress -// * MSB to track/session -// * Two reserved bytes -// Total structure size increased by 12 (0x0C) bytes -typedef struct _TRACK_INFORMATION2 { - - UCHAR Length[2]; - UCHAR TrackNumberLsb; - UCHAR SessionNumberLsb; - - UCHAR Reserved4; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR Damage : 1; - UCHAR Reserved5 : 2; - UCHAR DataMode : 4; - UCHAR FixedPacket : 1; - UCHAR Packet : 1; - UCHAR Blank : 1; - UCHAR ReservedTrack : 1; - UCHAR NWA_V : 1; - UCHAR LRA_V : 1; - UCHAR Reserved6 : 6; - - UCHAR TrackStartAddress[4]; - UCHAR NextWritableAddress[4]; - UCHAR FreeBlocks[4]; - UCHAR FixedPacketSize[4]; // blocking factor - UCHAR TrackSize[4]; - UCHAR LastRecordedAddress[4]; - - UCHAR TrackNumberMsb; - UCHAR SessionNumberMsb; - UCHAR Reserved7[2]; - -} TRACK_INFORMATION2, *PTRACK_INFORMATION2; - -// Third Revision Adds -// * ReadCompatibilityLBA -// Total structure size increased by 4 bytes -typedef struct _TRACK_INFORMATION3 { - - UCHAR Length[2]; - UCHAR TrackNumberLsb; - UCHAR SessionNumberLsb; - - UCHAR Reserved4; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR Damage : 1; - UCHAR Reserved5 : 2; - UCHAR DataMode : 4; - UCHAR FixedPacket : 1; - UCHAR Packet : 1; - UCHAR Blank : 1; - UCHAR ReservedTrack : 1; - UCHAR NWA_V : 1; - UCHAR LRA_V : 1; - UCHAR Reserved6 : 6; - - UCHAR TrackStartAddress[4]; - UCHAR NextWritableAddress[4]; - UCHAR FreeBlocks[4]; - UCHAR FixedPacketSize[4]; // blocking factor - UCHAR TrackSize[4]; - UCHAR LastRecordedAddress[4]; - - UCHAR TrackNumberMsb; - UCHAR SessionNumberMsb; - UCHAR Reserved7[2]; - UCHAR ReadCompatibilityLba[4]; - -} TRACK_INFORMATION3, *PTRACK_INFORMATION3; - -#pragma pack(pop, track_info) - -#pragma pack(push, perf_descriptor, 1) -typedef struct _PERFORMANCE_DESCRIPTOR { - - UCHAR RandomAccess : 1; - UCHAR Exact : 1; - UCHAR RestoreDefaults : 1; - UCHAR WriteRotationControl : 2; - UCHAR Reserved1 : 3; - - UCHAR Reserved[3]; - UCHAR StartLba[4]; - UCHAR EndLba[4]; - UCHAR ReadSize[4]; - UCHAR ReadTime[4]; - UCHAR WriteSize[4]; - UCHAR WriteTime[4]; - -} PERFORMANCE_DESCRIPTOR, *PPERFORMANCE_DESCRIPTOR; -#pragma pack(pop, perf_descriptor) - -// -// Command Descriptor Block constants. -// - -#define CDB6GENERIC_LENGTH 6 -#define CDB10GENERIC_LENGTH 10 -#define CDB12GENERIC_LENGTH 12 - -#define SETBITON 1 -#define SETBITOFF 0 - -// -// Mode Sense/Select page constants. -// - -#define MODE_PAGE_VENDOR_SPECIFIC 0x00 -#define MODE_PAGE_ERROR_RECOVERY 0x01 -#define MODE_PAGE_DISCONNECT 0x02 -#define MODE_PAGE_FORMAT_DEVICE 0x03 // disk -#define MODE_PAGE_MRW 0x03 // cdrom -#define MODE_PAGE_RIGID_GEOMETRY 0x04 -#define MODE_PAGE_FLEXIBILE 0x05 // disk -#define MODE_PAGE_WRITE_PARAMETERS 0x05 // cdrom -#define MODE_PAGE_VERIFY_ERROR 0x07 -#define MODE_PAGE_CACHING 0x08 -#define MODE_PAGE_PERIPHERAL 0x09 -#define MODE_PAGE_CONTROL 0x0A -#define MODE_PAGE_MEDIUM_TYPES 0x0B -#define MODE_PAGE_NOTCH_PARTITION 0x0C -#define MODE_PAGE_CD_AUDIO_CONTROL 0x0E -#define MODE_PAGE_DATA_COMPRESS 0x0F -#define MODE_PAGE_DEVICE_CONFIG 0x10 -#define MODE_PAGE_XOR_CONTROL 0x10 // disk -#define MODE_PAGE_MEDIUM_PARTITION 0x11 -#define MODE_PAGE_ENCLOSURE_SERVICES_MANAGEMENT 0x14 -#define MODE_PAGE_EXTENDED 0x15 -#define MODE_PAGE_EXTENDED_DEVICE_SPECIFIC 0x16 -#define MODE_PAGE_CDVD_FEATURE_SET 0x18 -#define MODE_PAGE_PROTOCOL_SPECIFIC_LUN 0x18 -#define MODE_PAGE_PROTOCOL_SPECIFIC_PORT 0x19 -#define MODE_PAGE_POWER_CONDITION 0x1A -#define MODE_PAGE_LUN_MAPPING 0x1B -#define MODE_PAGE_FAULT_REPORTING 0x1C -#define MODE_PAGE_CDVD_INACTIVITY 0x1D // cdrom -#define MODE_PAGE_ELEMENT_ADDRESS 0x1D -#define MODE_PAGE_TRANSPORT_GEOMETRY 0x1E -#define MODE_PAGE_DEVICE_CAPABILITIES 0x1F -#define MODE_PAGE_CAPABILITIES 0x2A // cdrom - -#define MODE_SENSE_RETURN_ALL 0x3f - -#define MODE_SENSE_CURRENT_VALUES 0x00 -#define MODE_SENSE_CHANGEABLE_VALUES 0x40 -#define MODE_SENSE_DEFAULT_VAULES 0x80 -#define MODE_SENSE_SAVED_VALUES 0xc0 - - -// -// SCSI CDB operation codes -// - -// 6-byte commands: -#define SCSIOP_TEST_UNIT_READY 0x00 -#define SCSIOP_REZERO_UNIT 0x01 -#define SCSIOP_REWIND 0x01 -#define SCSIOP_REQUEST_BLOCK_ADDR 0x02 -#define SCSIOP_REQUEST_SENSE 0x03 -#define SCSIOP_FORMAT_UNIT 0x04 -#define SCSIOP_READ_BLOCK_LIMITS 0x05 -#define SCSIOP_REASSIGN_BLOCKS 0x07 -#define SCSIOP_INIT_ELEMENT_STATUS 0x07 -#define SCSIOP_READ6 0x08 -#define SCSIOP_RECEIVE 0x08 -#define SCSIOP_WRITE6 0x0A -#define SCSIOP_PRINT 0x0A -#define SCSIOP_SEND 0x0A -#define SCSIOP_SEEK6 0x0B -#define SCSIOP_TRACK_SELECT 0x0B -#define SCSIOP_SLEW_PRINT 0x0B -#define SCSIOP_SET_CAPACITY 0x0B // tape -#define SCSIOP_SEEK_BLOCK 0x0C -#define SCSIOP_PARTITION 0x0D -#define SCSIOP_READ_REVERSE 0x0F -#define SCSIOP_WRITE_FILEMARKS 0x10 -#define SCSIOP_FLUSH_BUFFER 0x10 -#define SCSIOP_SPACE 0x11 -#define SCSIOP_INQUIRY 0x12 -#define SCSIOP_VERIFY6 0x13 -#define SCSIOP_RECOVER_BUF_DATA 0x14 -#define SCSIOP_MODE_SELECT 0x15 -#define SCSIOP_RESERVE_UNIT 0x16 -#define SCSIOP_RELEASE_UNIT 0x17 -#define SCSIOP_COPY 0x18 -#define SCSIOP_ERASE 0x19 -#define SCSIOP_MODE_SENSE 0x1A -#define SCSIOP_START_STOP_UNIT 0x1B -#define SCSIOP_STOP_PRINT 0x1B -#define SCSIOP_LOAD_UNLOAD 0x1B -#define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C -#define SCSIOP_SEND_DIAGNOSTIC 0x1D -#define SCSIOP_MEDIUM_REMOVAL 0x1E - -// 10-byte commands -#define SCSIOP_READ_FORMATTED_CAPACITY 0x23 -#define SCSIOP_READ_CAPACITY 0x25 -#define SCSIOP_READ 0x28 -#define SCSIOP_WRITE 0x2A -#define SCSIOP_SEEK 0x2B -#define SCSIOP_LOCATE 0x2B -#define SCSIOP_POSITION_TO_ELEMENT 0x2B -#define SCSIOP_WRITE_VERIFY 0x2E -#define SCSIOP_VERIFY 0x2F -#define SCSIOP_SEARCH_DATA_HIGH 0x30 -#define SCSIOP_SEARCH_DATA_EQUAL 0x31 -#define SCSIOP_SEARCH_DATA_LOW 0x32 -#define SCSIOP_SET_LIMITS 0x33 -#define SCSIOP_READ_POSITION 0x34 -#define SCSIOP_SYNCHRONIZE_CACHE 0x35 -#define SCSIOP_COMPARE 0x39 -#define SCSIOP_COPY_COMPARE 0x3A -#define SCSIOP_WRITE_DATA_BUFF 0x3B -#define SCSIOP_READ_DATA_BUFF 0x3C -#define SCSIOP_WRITE_LONG 0x3F -#define SCSIOP_CHANGE_DEFINITION 0x40 -#define SCSIOP_WRITE_SAME 0x41 -#define SCSIOP_READ_SUB_CHANNEL 0x42 -#define SCSIOP_READ_TOC 0x43 -#define SCSIOP_READ_HEADER 0x44 -#define SCSIOP_REPORT_DENSITY_SUPPORT 0x44 // tape -#define SCSIOP_PLAY_AUDIO 0x45 -#define SCSIOP_GET_CONFIGURATION 0x46 -#define SCSIOP_PLAY_AUDIO_MSF 0x47 -#define SCSIOP_PLAY_TRACK_INDEX 0x48 -#define SCSIOP_PLAY_TRACK_RELATIVE 0x49 -#define SCSIOP_GET_EVENT_STATUS 0x4A -#define SCSIOP_PAUSE_RESUME 0x4B -#define SCSIOP_LOG_SELECT 0x4C -#define SCSIOP_LOG_SENSE 0x4D -#define SCSIOP_STOP_PLAY_SCAN 0x4E -#define SCSIOP_XDWRITE 0x50 -#define SCSIOP_XPWRITE 0x51 -#define SCSIOP_READ_DISK_INFORMATION 0x51 -#define SCSIOP_READ_DISC_INFORMATION 0x51 // proper use of disc over disk -#define SCSIOP_READ_TRACK_INFORMATION 0x52 -#define SCSIOP_XDWRITE_READ 0x53 -#define SCSIOP_RESERVE_TRACK_RZONE 0x53 -#define SCSIOP_SEND_OPC_INFORMATION 0x54 // optimum power calibration -#define SCSIOP_MODE_SELECT10 0x55 -#define SCSIOP_RESERVE_UNIT10 0x56 -#define SCSIOP_RESERVE_ELEMENT 0x56 -#define SCSIOP_RELEASE_UNIT10 0x57 -#define SCSIOP_RELEASE_ELEMENT 0x57 -#define SCSIOP_REPAIR_TRACK 0x58 -#define SCSIOP_MODE_SENSE10 0x5A -#define SCSIOP_CLOSE_TRACK_SESSION 0x5B -#define SCSIOP_READ_BUFFER_CAPACITY 0x5C -#define SCSIOP_SEND_CUE_SHEET 0x5D -#define SCSIOP_PERSISTENT_RESERVE_IN 0x5E -#define SCSIOP_PERSISTENT_RESERVE_OUT 0x5F - -// 12-byte commands -#define SCSIOP_REPORT_LUNS 0xA0 -#define SCSIOP_BLANK 0xA1 -#define SCSIOP_ATA_PASSTHROUGH12 0xA1 -#define SCSIOP_SEND_EVENT 0xA2 -#define SCSIOP_SEND_KEY 0xA3 -#define SCSIOP_MAINTENANCE_IN 0xA3 -#define SCSIOP_REPORT_KEY 0xA4 -#define SCSIOP_MAINTENANCE_OUT 0xA4 -#define SCSIOP_MOVE_MEDIUM 0xA5 -#define SCSIOP_LOAD_UNLOAD_SLOT 0xA6 -#define SCSIOP_EXCHANGE_MEDIUM 0xA6 -#define SCSIOP_SET_READ_AHEAD 0xA7 -#define SCSIOP_MOVE_MEDIUM_ATTACHED 0xA7 -#define SCSIOP_READ12 0xA8 -#define SCSIOP_GET_MESSAGE 0xA8 -#define SCSIOP_SERVICE_ACTION_OUT12 0xA9 -#define SCSIOP_WRITE12 0xAA -#define SCSIOP_SEND_MESSAGE 0xAB -#define SCSIOP_SERVICE_ACTION_IN12 0xAB -#define SCSIOP_GET_PERFORMANCE 0xAC -#define SCSIOP_READ_DVD_STRUCTURE 0xAD -#define SCSIOP_WRITE_VERIFY12 0xAE -#define SCSIOP_VERIFY12 0xAF -#define SCSIOP_SEARCH_DATA_HIGH12 0xB0 -#define SCSIOP_SEARCH_DATA_EQUAL12 0xB1 -#define SCSIOP_SEARCH_DATA_LOW12 0xB2 -#define SCSIOP_SET_LIMITS12 0xB3 -#define SCSIOP_READ_ELEMENT_STATUS_ATTACHED 0xB4 -#define SCSIOP_REQUEST_VOL_ELEMENT 0xB5 -#define SCSIOP_SEND_VOLUME_TAG 0xB6 -#define SCSIOP_SET_STREAMING 0xB6 // C/DVD -#define SCSIOP_READ_DEFECT_DATA 0xB7 -#define SCSIOP_READ_ELEMENT_STATUS 0xB8 -#define SCSIOP_READ_CD_MSF 0xB9 -#define SCSIOP_SCAN_CD 0xBA -#define SCSIOP_REDUNDANCY_GROUP_IN 0xBA -#define SCSIOP_SET_CD_SPEED 0xBB -#define SCSIOP_REDUNDANCY_GROUP_OUT 0xBB -#define SCSIOP_PLAY_CD 0xBC -#define SCSIOP_SPARE_IN 0xBC -#define SCSIOP_MECHANISM_STATUS 0xBD -#define SCSIOP_SPARE_OUT 0xBD -#define SCSIOP_READ_CD 0xBE -#define SCSIOP_VOLUME_SET_IN 0xBE -#define SCSIOP_SEND_DVD_STRUCTURE 0xBF -#define SCSIOP_VOLUME_SET_OUT 0xBF -#define SCSIOP_INIT_ELEMENT_RANGE 0xE7 - -// 16-byte commands -#define SCSIOP_XDWRITE_EXTENDED16 0x80 // disk -#define SCSIOP_WRITE_FILEMARKS16 0x80 // tape -#define SCSIOP_REBUILD16 0x81 // disk -#define SCSIOP_READ_REVERSE16 0x81 // tape -#define SCSIOP_REGENERATE16 0x82 // disk -#define SCSIOP_EXTENDED_COPY 0x83 -#define SCSIOP_RECEIVE_COPY_RESULTS 0x84 -#define SCSIOP_ATA_PASSTHROUGH16 0x85 -#define SCSIOP_ACCESS_CONTROL_IN 0x86 -#define SCSIOP_ACCESS_CONTROL_OUT 0x87 -#define SCSIOP_READ16 0x88 -#define SCSIOP_WRITE16 0x8A -#define SCSIOP_READ_ATTRIBUTES 0x8C -#define SCSIOP_WRITE_ATTRIBUTES 0x8D -#define SCSIOP_WRITE_VERIFY16 0x8E -#define SCSIOP_VERIFY16 0x8F -#define SCSIOP_PREFETCH16 0x90 -#define SCSIOP_SYNCHRONIZE_CACHE16 0x91 -#define SCSIOP_SPACE16 0x91 // tape -#define SCSIOP_LOCK_UNLOCK_CACHE16 0x92 -#define SCSIOP_LOCATE16 0x92 // tape -#define SCSIOP_WRITE_SAME16 0x93 -#define SCSIOP_ERASE16 0x93 // tape -#define SCSIOP_READ_CAPACITY16 0x9E -#define SCSIOP_SERVICE_ACTION_IN16 0x9E -#define SCSIOP_SERVICE_ACTION_OUT16 0x9F - - -// -// If the IMMED bit is 1, status is returned as soon -// as the operation is initiated. If the IMMED bit -// is 0, status is not returned until the operation -// is completed. -// - -#define CDB_RETURN_ON_COMPLETION 0 -#define CDB_RETURN_IMMEDIATE 1 - -// end_ntminitape - -// -// CDB Force media access used in extended read and write commands. -// - -#define CDB_FORCE_MEDIA_ACCESS 0x08 - -// -// Denon CD ROM operation codes -// - -#define SCSIOP_DENON_EJECT_DISC 0xE6 -#define SCSIOP_DENON_STOP_AUDIO 0xE7 -#define SCSIOP_DENON_PLAY_AUDIO 0xE8 -#define SCSIOP_DENON_READ_TOC 0xE9 -#define SCSIOP_DENON_READ_SUBCODE 0xEB - -// -// SCSI Bus Messages -// - -#define SCSIMESS_ABORT 0x06 -#define SCSIMESS_ABORT_WITH_TAG 0x0D -#define SCSIMESS_BUS_DEVICE_RESET 0X0C -#define SCSIMESS_CLEAR_QUEUE 0X0E -#define SCSIMESS_COMMAND_COMPLETE 0X00 -#define SCSIMESS_DISCONNECT 0X04 -#define SCSIMESS_EXTENDED_MESSAGE 0X01 -#define SCSIMESS_IDENTIFY 0X80 -#define SCSIMESS_IDENTIFY_WITH_DISCON 0XC0 -#define SCSIMESS_IGNORE_WIDE_RESIDUE 0X23 -#define SCSIMESS_INITIATE_RECOVERY 0X0F -#define SCSIMESS_INIT_DETECTED_ERROR 0X05 -#define SCSIMESS_LINK_CMD_COMP 0X0A -#define SCSIMESS_LINK_CMD_COMP_W_FLAG 0X0B -#define SCSIMESS_MESS_PARITY_ERROR 0X09 -#define SCSIMESS_MESSAGE_REJECT 0X07 -#define SCSIMESS_NO_OPERATION 0X08 -#define SCSIMESS_HEAD_OF_QUEUE_TAG 0X21 -#define SCSIMESS_ORDERED_QUEUE_TAG 0X22 -#define SCSIMESS_SIMPLE_QUEUE_TAG 0X20 -#define SCSIMESS_RELEASE_RECOVERY 0X10 -#define SCSIMESS_RESTORE_POINTERS 0X03 -#define SCSIMESS_SAVE_DATA_POINTER 0X02 -#define SCSIMESS_TERMINATE_IO_PROCESS 0X11 - -// -// SCSI Extended Message operation codes -// - -#define SCSIMESS_MODIFY_DATA_POINTER 0X00 -#define SCSIMESS_SYNCHRONOUS_DATA_REQ 0X01 -#define SCSIMESS_WIDE_DATA_REQUEST 0X03 - -// -// SCSI Extended Message Lengths -// - -#define SCSIMESS_MODIFY_DATA_LENGTH 5 -#define SCSIMESS_SYNCH_DATA_LENGTH 3 -#define SCSIMESS_WIDE_DATA_LENGTH 2 - -// -// SCSI extended message structure -// - -#pragma pack(push, scsi_mess, 1) -typedef struct _SCSI_EXTENDED_MESSAGE { - UCHAR InitialMessageCode; - UCHAR MessageLength; - UCHAR MessageType; - union _EXTENDED_ARGUMENTS { - - struct { - UCHAR Modifier[4]; - } Modify; - - struct { - UCHAR TransferPeriod; - UCHAR ReqAckOffset; - } Synchronous; - - struct{ - UCHAR Width; - } Wide; - }ExtendedArguments; -}SCSI_EXTENDED_MESSAGE, *PSCSI_EXTENDED_MESSAGE; -#pragma pack(pop, scsi_mess) - -// -// SCSI bus status codes. -// - -#define SCSISTAT_GOOD 0x00 -#define SCSISTAT_CHECK_CONDITION 0x02 -#define SCSISTAT_CONDITION_MET 0x04 -#define SCSISTAT_BUSY 0x08 -#define SCSISTAT_INTERMEDIATE 0x10 -#define SCSISTAT_INTERMEDIATE_COND_MET 0x14 -#define SCSISTAT_RESERVATION_CONFLICT 0x18 -#define SCSISTAT_COMMAND_TERMINATED 0x22 -#define SCSISTAT_QUEUE_FULL 0x28 - -// -// Enable Vital Product Data Flag (EVPD) -// used with INQUIRY command. -// - -#define CDB_INQUIRY_EVPD 0x01 - -// -// Defines for format CDB -// - -#define LUN0_FORMAT_SAVING_DEFECT_LIST 0 -#define USE_DEFAULTMSB 0 -#define USE_DEFAULTLSB 0 - -#define START_UNIT_CODE 0x01 -#define STOP_UNIT_CODE 0x00 - -// begin_ntminitape - -// -// Inquiry buffer structure. This is the data returned from the target -// after it receives an inquiry. -// -// This structure may be extended by the number of bytes specified -// in the field AdditionalLength. The defined size constant only -// includes fields through ProductRevisionLevel. -// -// The NT SCSI drivers are only interested in the first 36 bytes of data. -// - -#define INQUIRYDATABUFFERSIZE 36 - -#if (NTDDI_VERSION < NTDDI_WINXP) -typedef struct _INQUIRYDATA { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR DeviceTypeModifier : 7; - UCHAR RemovableMedia : 1; - UCHAR Versions; - UCHAR ResponseDataFormat : 4; - UCHAR HiSupport : 1; - UCHAR NormACA : 1; - UCHAR ReservedBit : 1; - UCHAR AERC : 1; - UCHAR AdditionalLength; - UCHAR Reserved[2]; - UCHAR SoftReset : 1; - UCHAR CommandQueue : 1; - UCHAR Reserved2 : 1; - UCHAR LinkedCommands : 1; - UCHAR Synchronous : 1; - UCHAR Wide16Bit : 1; - UCHAR Wide32Bit : 1; - UCHAR RelativeAddressing : 1; - UCHAR VendorId[8]; - UCHAR ProductId[16]; - UCHAR ProductRevisionLevel[4]; - UCHAR VendorSpecific[20]; - UCHAR Reserved3[40]; -} INQUIRYDATA, *PINQUIRYDATA; -#else -#pragma pack(push, inquiry, 1) -typedef struct _INQUIRYDATA { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR DeviceTypeModifier : 7; - UCHAR RemovableMedia : 1; - union { - UCHAR Versions; - struct { - UCHAR ANSIVersion : 3; - UCHAR ECMAVersion : 3; - UCHAR ISOVersion : 2; - }; - }; - UCHAR ResponseDataFormat : 4; - UCHAR HiSupport : 1; - UCHAR NormACA : 1; - UCHAR TerminateTask : 1; - UCHAR AERC : 1; - UCHAR AdditionalLength; - UCHAR Reserved; - UCHAR Addr16 : 1; // defined only for SIP devices. - UCHAR Addr32 : 1; // defined only for SIP devices. - UCHAR AckReqQ: 1; // defined only for SIP devices. - UCHAR MediumChanger : 1; - UCHAR MultiPort : 1; - UCHAR ReservedBit2 : 1; - UCHAR EnclosureServices : 1; - UCHAR ReservedBit3 : 1; - UCHAR SoftReset : 1; - UCHAR CommandQueue : 1; - UCHAR TransferDisable : 1; // defined only for SIP devices. - UCHAR LinkedCommands : 1; - UCHAR Synchronous : 1; // defined only for SIP devices. - UCHAR Wide16Bit : 1; // defined only for SIP devices. - UCHAR Wide32Bit : 1; // defined only for SIP devices. - UCHAR RelativeAddressing : 1; - UCHAR VendorId[8]; - UCHAR ProductId[16]; - UCHAR ProductRevisionLevel[4]; - UCHAR VendorSpecific[20]; - UCHAR Reserved3[40]; -} INQUIRYDATA, *PINQUIRYDATA; -#pragma pack(pop, inquiry) -#endif - -// -// Inquiry defines. Used to interpret data returned from target as result -// of inquiry command. -// -// DeviceType field -// - -#define DIRECT_ACCESS_DEVICE 0x00 // disks -#define SEQUENTIAL_ACCESS_DEVICE 0x01 // tapes -#define PRINTER_DEVICE 0x02 // printers -#define PROCESSOR_DEVICE 0x03 // scanners, printers, etc -#define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04 // worms -#define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05 // cdroms -#define SCANNER_DEVICE 0x06 // scanners -#define OPTICAL_DEVICE 0x07 // optical disks -#define MEDIUM_CHANGER 0x08 // jukebox -#define COMMUNICATION_DEVICE 0x09 // network -// 0xA and 0xB are obsolete -#define ARRAY_CONTROLLER_DEVICE 0x0C -#define SCSI_ENCLOSURE_DEVICE 0x0D -#define REDUCED_BLOCK_DEVICE 0x0E // e.g., 1394 disk -#define OPTICAL_CARD_READER_WRITER_DEVICE 0x0F -#define BRIDGE_CONTROLLER_DEVICE 0x10 -#define OBJECT_BASED_STORAGE_DEVICE 0x11 // OSD -#define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F - -#define DEVICE_QUALIFIER_ACTIVE 0x00 -#define DEVICE_QUALIFIER_NOT_ACTIVE 0x01 -#define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03 - -// -// DeviceTypeQualifier field -// - -#define DEVICE_CONNECTED 0x00 - -// -// Vital Product Data Pages -// - -// -// Unit Serial Number Page (page code 0x80) -// -// Provides a product serial number for the target or the logical unit. -// -#pragma pack(push, vpd_media_sn, 1) -typedef struct _VPD_MEDIA_SERIAL_NUMBER_PAGE { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR PageCode; - UCHAR Reserved; - UCHAR PageLength; -#if !defined(__midl) - UCHAR SerialNumber[0]; -#endif -} VPD_MEDIA_SERIAL_NUMBER_PAGE, *PVPD_MEDIA_SERIAL_NUMBER_PAGE; -#pragma pack(pop, vpd_media_sn) - -#pragma pack(push, vpd_sn, 1) -typedef struct _VPD_SERIAL_NUMBER_PAGE { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR PageCode; - UCHAR Reserved; - UCHAR PageLength; -#if !defined(__midl) - UCHAR SerialNumber[0]; -#endif -} VPD_SERIAL_NUMBER_PAGE, *PVPD_SERIAL_NUMBER_PAGE; -#pragma pack(pop, vpd_sn) - -// -// Device Identification Page (page code 0x83) -// Provides the means to retrieve zero or more identification descriptors -// applying to the logical unit. -// - -#pragma pack(push, vpd_stuff, 1) -typedef enum _VPD_CODE_SET { - VpdCodeSetReserved = 0, - VpdCodeSetBinary = 1, - VpdCodeSetAscii = 2, - VpdCodeSetUTF8 = 3 -} VPD_CODE_SET, *PVPD_CODE_SET; - -typedef enum _VPD_ASSOCIATION { - VpdAssocDevice = 0, - VpdAssocPort = 1, - VpdAssocTarget = 2, - VpdAssocReserved1 = 3, - VpdAssocReserved2 = 4 // bogus, only two bits -} VPD_ASSOCIATION, *PVPD_ASSOCIATION; - -typedef enum _VPD_IDENTIFIER_TYPE { - VpdIdentifierTypeVendorSpecific = 0, - VpdIdentifierTypeVendorId = 1, - VpdIdentifierTypeEUI64 = 2, - VpdIdentifierTypeFCPHName = 3, - VpdIdentifierTypePortRelative = 4, - VpdIdentifierTypeTargetPortGroup = 5, - VpdIdentifierTypeLogicalUnitGroup = 6, - VpdIdentifierTypeMD5LogicalUnitId = 7, - VpdIdentifierTypeSCSINameString = 8 -} VPD_IDENTIFIER_TYPE, *PVPD_IDENTIFIER_TYPE; - -typedef struct _VPD_IDENTIFICATION_DESCRIPTOR { - UCHAR CodeSet : 4; // VPD_CODE_SET - UCHAR Reserved : 4; - UCHAR IdentifierType : 4; // VPD_IDENTIFIER_TYPE - UCHAR Association : 2; - UCHAR Reserved2 : 2; - UCHAR Reserved3; - UCHAR IdentifierLength; -#if !defined(__midl) - UCHAR Identifier[0]; -#endif -} VPD_IDENTIFICATION_DESCRIPTOR, *PVPD_IDENTIFICATION_DESCRIPTOR; - -typedef struct _VPD_IDENTIFICATION_PAGE { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR PageCode; - UCHAR Reserved; - UCHAR PageLength; - - - // - // The following field is actually a variable length array of identification - // descriptors. Unfortunately there's no C notation for an array of - // variable length structures so we're forced to just pretend. - // - -#if !defined(__midl) - // VPD_IDENTIFICATION_DESCRIPTOR Descriptors[0]; - UCHAR Descriptors[0]; -#endif -} VPD_IDENTIFICATION_PAGE, *PVPD_IDENTIFICATION_PAGE; - -// -// Supported Vital Product Data Pages Page (page code 0x00) -// Contains a list of the vital product data page cods supported by the target -// or logical unit. -// - -typedef struct _VPD_SUPPORTED_PAGES_PAGE { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR PageCode; - UCHAR Reserved; - UCHAR PageLength; -#if !defined(__midl) - UCHAR SupportedPageList[0]; -#endif -} VPD_SUPPORTED_PAGES_PAGE, *PVPD_SUPPORTED_PAGES_PAGE; -#pragma pack(pop, vpd_stuff) - - -#define VPD_MAX_BUFFER_SIZE 0xff - -#define VPD_SUPPORTED_PAGES 0x00 -#define VPD_SERIAL_NUMBER 0x80 -#define VPD_DEVICE_IDENTIFIERS 0x83 -#define VPD_MEDIA_SERIAL_NUMBER 0x84 -#define VPD_SOFTWARE_INTERFACE_IDENTIFIERS 0x84 -#define VPD_NETWORK_MANAGEMENT_ADDRESSES 0x85 -#define VPD_EXTENDED_INQUIRY_DATA 0x86 -#define VPD_MODE_PAGE_POLICY 0x87 -#define VPD_SCSI_PORTS 0x88 - - -// -// Persistent Reservation Definitions. -// - -// -// PERSISTENT_RESERVE_* definitions -// - -#define RESERVATION_ACTION_READ_KEYS 0x00 -#define RESERVATION_ACTION_READ_RESERVATIONS 0x01 - -#define RESERVATION_ACTION_REGISTER 0x00 -#define RESERVATION_ACTION_RESERVE 0x01 -#define RESERVATION_ACTION_RELEASE 0x02 -#define RESERVATION_ACTION_CLEAR 0x03 -#define RESERVATION_ACTION_PREEMPT 0x04 -#define RESERVATION_ACTION_PREEMPT_ABORT 0x05 -#define RESERVATION_ACTION_REGISTER_IGNORE_EXISTING 0x06 - -#define RESERVATION_SCOPE_LU 0x00 -#define RESERVATION_SCOPE_ELEMENT 0x02 - -#define RESERVATION_TYPE_WRITE_EXCLUSIVE 0x01 -#define RESERVATION_TYPE_EXCLUSIVE 0x03 -#define RESERVATION_TYPE_WRITE_EXCLUSIVE_REGISTRANTS 0x05 -#define RESERVATION_TYPE_EXCLUSIVE_REGISTRANTS 0x06 - -// -// Structures for reserve in command. -// - -#pragma pack(push, reserve_in_stuff, 1) -typedef struct { - UCHAR Generation[4]; - UCHAR AdditionalLength[4]; -#if !defined(__midl) - UCHAR ReservationKeyList[0][8]; -#endif -} PRI_REGISTRATION_LIST, *PPRI_REGISTRATION_LIST; - -typedef struct { - UCHAR ReservationKey[8]; - UCHAR ScopeSpecificAddress[4]; - UCHAR Reserved; - UCHAR Type : 4; - UCHAR Scope : 4; - UCHAR Obsolete[2]; -} PRI_RESERVATION_DESCRIPTOR, *PPRI_RESERVATION_DESCRIPTOR; - -typedef struct { - UCHAR Generation[4]; - UCHAR AdditionalLength[4]; -#if !defined(__midl) - PRI_RESERVATION_DESCRIPTOR Reservations[0]; -#endif -} PRI_RESERVATION_LIST, *PPRI_RESERVATION_LIST; -#pragma pack(pop, reserve_in_stuff) - -// -// Structures for reserve out command. -// - -#pragma pack(push, reserve_out_stuff, 1) -typedef struct { - UCHAR ReservationKey[8]; - UCHAR ServiceActionReservationKey[8]; - UCHAR ScopeSpecificAddress[4]; - UCHAR ActivatePersistThroughPowerLoss : 1; - UCHAR Reserved1 : 7; - UCHAR Reserved2; - UCHAR Obsolete[2]; -} PRO_PARAMETER_LIST, *PPRO_PARAMETER_LIST; -#pragma pack(pop, reserve_out_stuff) - - -// -// Sense Data Format -// - -#pragma pack(push, sensedata, 1) -typedef struct _SENSE_DATA { - UCHAR ErrorCode:7; - UCHAR Valid:1; - UCHAR SegmentNumber; - UCHAR SenseKey:4; - UCHAR Reserved:1; - UCHAR IncorrectLength:1; - UCHAR EndOfMedia:1; - UCHAR FileMark:1; - UCHAR Information[4]; - UCHAR AdditionalSenseLength; - UCHAR CommandSpecificInformation[4]; - UCHAR AdditionalSenseCode; - UCHAR AdditionalSenseCodeQualifier; - UCHAR FieldReplaceableUnitCode; - UCHAR SenseKeySpecific[3]; -} SENSE_DATA, *PSENSE_DATA; -#pragma pack(pop, sensedata) - -// -// Default request sense buffer size -// - -#define SENSE_BUFFER_SIZE 18 - -// -// Maximum request sense buffer size -// - -#define MAX_SENSE_BUFFER_SIZE 255 - -// -// Maximum number of additional sense bytes. -// - -#define MAX_ADDITIONAL_SENSE_BYTES (MAX_SENSE_BUFFER_SIZE - SENSE_BUFFER_SIZE) - -// -// Sense codes -// - -#define SCSI_SENSE_NO_SENSE 0x00 -#define SCSI_SENSE_RECOVERED_ERROR 0x01 -#define SCSI_SENSE_NOT_READY 0x02 -#define SCSI_SENSE_MEDIUM_ERROR 0x03 -#define SCSI_SENSE_HARDWARE_ERROR 0x04 -#define SCSI_SENSE_ILLEGAL_REQUEST 0x05 -#define SCSI_SENSE_UNIT_ATTENTION 0x06 -#define SCSI_SENSE_DATA_PROTECT 0x07 -#define SCSI_SENSE_BLANK_CHECK 0x08 -#define SCSI_SENSE_UNIQUE 0x09 -#define SCSI_SENSE_COPY_ABORTED 0x0A -#define SCSI_SENSE_ABORTED_COMMAND 0x0B -#define SCSI_SENSE_EQUAL 0x0C -#define SCSI_SENSE_VOL_OVERFLOW 0x0D -#define SCSI_SENSE_MISCOMPARE 0x0E -#define SCSI_SENSE_RESERVED 0x0F - -// -// Additional tape bit -// - -#define SCSI_ILLEGAL_LENGTH 0x20 -#define SCSI_EOM 0x40 -#define SCSI_FILE_MARK 0x80 - -// -// Additional Sense codes -// - -#define SCSI_ADSENSE_NO_SENSE 0x00 -#define SCSI_ADSENSE_NO_SEEK_COMPLETE 0x02 -#define SCSI_ADSENSE_LUN_NOT_READY 0x04 -#define SCSI_ADSENSE_LUN_COMMUNICATION 0x08 -#define SCSI_ADSENSE_WRITE_ERROR 0x0C -#define SCSI_ADSENSE_TRACK_ERROR 0x14 -#define SCSI_ADSENSE_SEEK_ERROR 0x15 -#define SCSI_ADSENSE_REC_DATA_NOECC 0x17 -#define SCSI_ADSENSE_REC_DATA_ECC 0x18 -#define SCSI_ADSENSE_PARAMETER_LIST_LENGTH 0x1A -#define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20 -#define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21 -#define SCSI_ADSENSE_INVALID_CDB 0x24 -#define SCSI_ADSENSE_INVALID_LUN 0x25 -#define SCSI_ADSENSE_INVALID_FIELD_PARAMETER_LIST 0x26 -#define SCSI_ADSENSE_WRITE_PROTECT 0x27 -#define SCSI_ADSENSE_MEDIUM_CHANGED 0x28 -#define SCSI_ADSENSE_BUS_RESET 0x29 -#define SCSI_ADSENSE_PARAMETERS_CHANGED 0x2A -#define SCSI_ADSENSE_INSUFFICIENT_TIME_FOR_OPERATION 0x2E -#define SCSI_ADSENSE_INVALID_MEDIA 0x30 -#define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3a -#define SCSI_ADSENSE_POSITION_ERROR 0x3b -#define SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED 0x3f -#define SCSI_ADSENSE_OPERATOR_REQUEST 0x5a // see below -#define SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x5d -#define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK 0x64 -#define SCSI_ADSENSE_COPY_PROTECTION_FAILURE 0x6f -#define SCSI_ADSENSE_POWER_CALIBRATION_ERROR 0x73 -#define SCSI_ADSENSE_VENDOR_UNIQUE 0x80 // and higher -#define SCSI_ADSENSE_MUSIC_AREA 0xA0 -#define SCSI_ADSENSE_DATA_AREA 0xA1 -#define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7 - -// for legacy apps: -#define SCSI_ADWRITE_PROTECT SCSI_ADSENSE_WRITE_PROTECT -#define SCSI_FAILURE_PREDICTION_THRESHOLD_EXCEEDED SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED - - -// -// SCSI_ADSENSE_LUN_NOT_READY (0x04) qualifiers -// - -#define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00 -#define SCSI_SENSEQ_BECOMING_READY 0x01 -#define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02 -#define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03 -#define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04 -#define SCSI_SENSEQ_REBUILD_IN_PROGRESS 0x05 -#define SCSI_SENSEQ_RECALCULATION_IN_PROGRESS 0x06 -#define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07 -#define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08 - -// -// SCSI_ADSENSE_LUN_COMMUNICATION (0x08) qualifiers -// - -#define SCSI_SENSEQ_COMM_FAILURE 0x00 -#define SCSI_SENSEQ_COMM_TIMEOUT 0x01 -#define SCSI_SENSEQ_COMM_PARITY_ERROR 0x02 -#define SCSI_SESNEQ_COMM_CRC_ERROR 0x03 -#define SCSI_SENSEQ_UNREACHABLE_TARGET 0x04 - -// -// SCSI_ADSENSE_WRITE_ERROR (0x0C) qualifiers -// -#define SCSI_SENSEQ_LOSS_OF_STREAMING 0x09 -#define SCSI_SENSEQ_PADDING_BLOCKS_ADDED 0x0A - - -// -// SCSI_ADSENSE_NO_SENSE (0x00) qualifiers -// - -#define SCSI_SENSEQ_FILEMARK_DETECTED 0x01 -#define SCSI_SENSEQ_END_OF_MEDIA_DETECTED 0x02 -#define SCSI_SENSEQ_SETMARK_DETECTED 0x03 -#define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED 0x04 - -// -// SCSI_ADSENSE_ILLEGAL_BLOCK (0x21) qualifiers -// - -#define SCSI_SENSEQ_ILLEGAL_ELEMENT_ADDR 0x01 - -// -// SCSI_ADSENSE_POSITION_ERROR (0x3b) qualifiers -// - -#define SCSI_SENSEQ_DESTINATION_FULL 0x0d -#define SCSI_SENSEQ_SOURCE_EMPTY 0x0e - -// -// SCSI_ADSENSE_INVALID_MEDIA (0x30) qualifiers -// - -#define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00 -#define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01 -#define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02 -#define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03 - - -// -// SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED (0x3f) qualifiers -// - -#define SCSI_SENSEQ_TARGET_OPERATING_CONDITIONS_CHANGED 0x00 -#define SCSI_SENSEQ_MICROCODE_CHANGED 0x01 -#define SCSI_SENSEQ_OPERATING_DEFINITION_CHANGED 0x02 -#define SCSI_SENSEQ_INQUIRY_DATA_CHANGED 0x03 -#define SCSI_SENSEQ_COMPONENT_DEVICE_ATTACHED 0x04 -#define SCSI_SENSEQ_DEVICE_IDENTIFIER_CHANGED 0x05 -#define SCSI_SENSEQ_REDUNDANCY_GROUP_MODIFIED 0x06 -#define SCSI_SENSEQ_REDUNDANCY_GROUP_DELETED 0x07 -#define SCSI_SENSEQ_SPARE_MODIFIED 0x08 -#define SCSI_SENSEQ_SPARE_DELETED 0x09 -#define SCSI_SENSEQ_VOLUME_SET_MODIFIED 0x0A -#define SCSI_SENSEQ_VOLUME_SET_DELETED 0x0B -#define SCSI_SENSEQ_VOLUME_SET_DEASSIGNED 0x0C -#define SCSI_SENSEQ_VOLUME_SET_REASSIGNED 0x0D -#define SCSI_SENSEQ_REPORTED_LUNS_DATA_CHANGED 0x0E -#define SCSI_SENSEQ_ECHO_BUFFER_OVERWRITTEN 0x0F -#define SCSI_SENSEQ_MEDIUM_LOADABLE 0x10 -#define SCSI_SENSEQ_MEDIUM_AUXILIARY_MEMORY_ACCESSIBLE 0x11 - - -// -// SCSI_ADSENSE_OPERATOR_REQUEST (0x5a) qualifiers -// - -#define SCSI_SENSEQ_STATE_CHANGE_INPUT 0x00 // generic request -#define SCSI_SENSEQ_MEDIUM_REMOVAL 0x01 -#define SCSI_SENSEQ_WRITE_PROTECT_ENABLE 0x02 -#define SCSI_SENSEQ_WRITE_PROTECT_DISABLE 0x03 - -// -// SCSI_ADSENSE_COPY_PROTECTION_FAILURE (0x6f) qualifiers -// -#define SCSI_SENSEQ_AUTHENTICATION_FAILURE 0x00 -#define SCSI_SENSEQ_KEY_NOT_PRESENT 0x01 -#define SCSI_SENSEQ_KEY_NOT_ESTABLISHED 0x02 -#define SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION 0x03 -#define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT 0x04 -#define SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR 0x05 - -// -// SCSI_ADSENSE_POWER_CALIBRATION_ERROR (0x73) qualifiers -// - -#define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ALMOST_FULL 0x01 -#define SCSI_SENSEQ_POWER_CALIBRATION_AREA_FULL 0x02 -#define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ERROR 0x03 -#define SCSI_SENSEQ_PMA_RMA_UPDATE_FAILURE 0x04 -#define SCSI_SENSEQ_PMA_RMA_IS_FULL 0x05 -#define SCSI_SENSEQ_PMA_RMA_ALMOST_FULL 0x06 - - -// end_ntminitape - -// -// SCSI IO Device Control Codes -// - -#define FILE_DEVICE_SCSI 0x0000001b - -#define IOCTL_SCSI_EXECUTE_IN ((FILE_DEVICE_SCSI << 16) + 0x0011) -#define IOCTL_SCSI_EXECUTE_OUT ((FILE_DEVICE_SCSI << 16) + 0x0012) -#define IOCTL_SCSI_EXECUTE_NONE ((FILE_DEVICE_SCSI << 16) + 0x0013) - -// -// SMART support in atapi -// - -#define IOCTL_SCSI_MINIPORT_SMART_VERSION ((FILE_DEVICE_SCSI << 16) + 0x0500) -#define IOCTL_SCSI_MINIPORT_IDENTIFY ((FILE_DEVICE_SCSI << 16) + 0x0501) -#define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS ((FILE_DEVICE_SCSI << 16) + 0x0502) -#define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS ((FILE_DEVICE_SCSI << 16) + 0x0503) -#define IOCTL_SCSI_MINIPORT_ENABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0504) -#define IOCTL_SCSI_MINIPORT_DISABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0505) -#define IOCTL_SCSI_MINIPORT_RETURN_STATUS ((FILE_DEVICE_SCSI << 16) + 0x0506) -#define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE ((FILE_DEVICE_SCSI << 16) + 0x0507) -#define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES ((FILE_DEVICE_SCSI << 16) + 0x0508) -#define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS ((FILE_DEVICE_SCSI << 16) + 0x0509) -#define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTO_OFFLINE ((FILE_DEVICE_SCSI << 16) + 0x050a) -#define IOCTL_SCSI_MINIPORT_READ_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050b) -#define IOCTL_SCSI_MINIPORT_WRITE_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050c) - -// -// CLUSTER support -// deliberately skipped some values to allow for expansion above. -// -#define IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0520) -#define IOCTL_SCSI_MINIPORT_NOT_CLUSTER_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0521) - - -// begin_ntminitape - -// -// Read Capacity Data - returned in Big Endian format -// - -#pragma pack(push, read_capacity, 1) -typedef struct _READ_CAPACITY_DATA { - ULONG LogicalBlockAddress; - ULONG BytesPerBlock; -} READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA; -#pragma pack(pop, read_capacity) - - -#pragma pack(push, read_capacity_ex, 1) -typedef struct _READ_CAPACITY_DATA_EX { - LARGE_INTEGER LogicalBlockAddress; - ULONG BytesPerBlock; -} READ_CAPACITY_DATA_EX, *PREAD_CAPACITY_DATA_EX; -#pragma pack(pop, read_capacity_ex) - - -// -// Read Block Limits Data - returned in Big Endian format -// This structure returns the maximum and minimum block -// size for a TAPE device. -// - -#pragma pack(push, read_block_limits, 1) -typedef struct _READ_BLOCK_LIMITS { - UCHAR Reserved; - UCHAR BlockMaximumSize[3]; - UCHAR BlockMinimumSize[2]; -} READ_BLOCK_LIMITS_DATA, *PREAD_BLOCK_LIMITS_DATA; -#pragma pack(pop, read_block_limits) - -#pragma pack(push, read_buffer_capacity, 1) -typedef struct _READ_BUFFER_CAPACITY_DATA { - UCHAR DataLength[2]; - UCHAR Reserved1; - UCHAR BlockDataReturned : 1; - UCHAR Reserved4 : 7; - UCHAR TotalBufferSize[4]; - UCHAR AvailableBufferSize[4]; -} READ_BUFFER_CAPACITY_DATA, *PREAD_BUFFER_CAPACITY_DATA; -#pragma pack(pop, read_buffer_capacity) - -// -// Mode data structures. -// - -// -// Define Mode parameter header. -// - -#pragma pack(push, mode_params, 1) -typedef struct _MODE_PARAMETER_HEADER { - UCHAR ModeDataLength; - UCHAR MediumType; - UCHAR DeviceSpecificParameter; - UCHAR BlockDescriptorLength; -}MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER; - -typedef struct _MODE_PARAMETER_HEADER10 { - UCHAR ModeDataLength[2]; - UCHAR MediumType; - UCHAR DeviceSpecificParameter; - UCHAR Reserved[2]; - UCHAR BlockDescriptorLength[2]; -}MODE_PARAMETER_HEADER10, *PMODE_PARAMETER_HEADER10; -#pragma pack(pop, mode_params) - -#define MODE_FD_SINGLE_SIDE 0x01 -#define MODE_FD_DOUBLE_SIDE 0x02 -#define MODE_FD_MAXIMUM_TYPE 0x1E -#define MODE_DSP_FUA_SUPPORTED 0x10 -#define MODE_DSP_WRITE_PROTECT 0x80 - -// -// Define the mode parameter block. -// - -#pragma pack(push, mode_params_block, 1) -typedef struct _MODE_PARAMETER_BLOCK { - UCHAR DensityCode; - UCHAR NumberOfBlocks[3]; - UCHAR Reserved; - UCHAR BlockLength[3]; -}MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK; -#pragma pack(pop, mode_params_block) - -// -// Define Disconnect-Reconnect page. -// - - -#pragma pack(push, mode_page_disconnect, 1) -typedef struct _MODE_DISCONNECT_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR BufferFullRatio; - UCHAR BufferEmptyRatio; - UCHAR BusInactivityLimit[2]; - UCHAR BusDisconnectTime[2]; - UCHAR BusConnectTime[2]; - UCHAR MaximumBurstSize[2]; - UCHAR DataTransferDisconnect : 2; - UCHAR Reserved2[3]; -}MODE_DISCONNECT_PAGE, *PMODE_DISCONNECT_PAGE; -#pragma pack(pop, mode_page_disconnect) - -// -// Define mode caching page. -// - -#pragma pack(push, mode_page_caching, 1) -typedef struct _MODE_CACHING_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR ReadDisableCache : 1; - UCHAR MultiplicationFactor : 1; - UCHAR WriteCacheEnable : 1; - UCHAR Reserved2 : 5; - UCHAR WriteRetensionPriority : 4; - UCHAR ReadRetensionPriority : 4; - UCHAR DisablePrefetchTransfer[2]; - UCHAR MinimumPrefetch[2]; - UCHAR MaximumPrefetch[2]; - UCHAR MaximumPrefetchCeiling[2]; -}MODE_CACHING_PAGE, *PMODE_CACHING_PAGE; -#pragma pack(pop, mode_page_caching) - -// -// Define write parameters cdrom page -// -#pragma pack(push, mode_page_wp2, 1) -typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE2 { - UCHAR PageCode : 6; // 0x05 - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; // 0x32 ?? - UCHAR WriteType : 4; - UCHAR TestWrite : 1; - UCHAR LinkSizeValid : 1; - UCHAR BufferUnderrunFreeEnabled : 1; - UCHAR Reserved2 : 1; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR FixedPacket : 1; - UCHAR MultiSession : 2; - UCHAR DataBlockType : 4; - UCHAR Reserved3 : 4; - UCHAR LinkSize; - UCHAR Reserved4; - UCHAR HostApplicationCode : 6; - UCHAR Reserved5 : 2; - UCHAR SessionFormat; - UCHAR Reserved6; - UCHAR PacketSize[4]; - UCHAR AudioPauseLength[2]; - UCHAR MediaCatalogNumber[16]; - UCHAR ISRC[16]; - UCHAR SubHeaderData[4]; -} MODE_CDROM_WRITE_PARAMETERS_PAGE2, *PMODE_CDROM_WRITE_PARAMETERS_PAGE2; -#pragma pack(pop, mode_page_wp2) - -#ifndef DEPRECATE_DDK_FUNCTIONS -// this structure is being retired due to missing fields and overly -// complex data definitions for the MCN and ISRC. -#pragma pack(push, mode_page_wp, 1) -typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE { - UCHAR PageLength; // 0x32 ?? - UCHAR WriteType : 4; - UCHAR TestWrite : 1; - UCHAR LinkSizeValid : 1; - UCHAR BufferUnderrunFreeEnabled : 1; - UCHAR Reserved2 : 1; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR FixedPacket : 1; - UCHAR MultiSession : 2; - UCHAR DataBlockType : 4; - UCHAR Reserved3 : 4; - UCHAR LinkSize; - UCHAR Reserved4; - UCHAR HostApplicationCode : 6; - UCHAR Reserved5 : 2; - UCHAR SessionFormat; - UCHAR Reserved6; - UCHAR PacketSize[4]; - UCHAR AudioPauseLength[2]; - UCHAR Reserved7 : 7; - UCHAR MediaCatalogNumberValid : 1; - UCHAR MediaCatalogNumber[13]; - UCHAR MediaCatalogNumberZero; - UCHAR MediaCatalogNumberAFrame; - UCHAR Reserved8 : 7; - UCHAR ISRCValid : 1; - UCHAR ISRCCountry[2]; - UCHAR ISRCOwner[3]; - UCHAR ISRCRecordingYear[2]; - UCHAR ISRCSerialNumber[5]; - UCHAR ISRCZero; - UCHAR ISRCAFrame; - UCHAR ISRCReserved; - UCHAR SubHeaderData[4]; -} MODE_CDROM_WRITE_PARAMETERS_PAGE, *PMODE_CDROM_WRITE_PARAMETERS_PAGE; -#pragma pack(pop, mode_page_wp) -#endif //ifndef DEPRECATE_DDK_FUNCTIONS - -// -// Define the MRW mode page for CDROM device types -// -#pragma pack(push, mode_page_mrw, 1) -typedef struct _MODE_MRW_PAGE { - UCHAR PageCode : 6; // 0x03 - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; //0x06 - UCHAR Reserved1; - UCHAR LbaSpace : 1; - UCHAR Reserved2 : 7; - UCHAR Reserved3[4]; -} MODE_MRW_PAGE, *PMODE_MRW_PAGE; -#pragma pack(pop, mode_page_mrw) - -// -// Define mode flexible disk page. -// - -#pragma pack(push, mode_page_flex, 1) -typedef struct _MODE_FLEXIBLE_DISK_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR TransferRate[2]; - UCHAR NumberOfHeads; - UCHAR SectorsPerTrack; - UCHAR BytesPerSector[2]; - UCHAR NumberOfCylinders[2]; - UCHAR StartWritePrecom[2]; - UCHAR StartReducedCurrent[2]; - UCHAR StepRate[2]; - UCHAR StepPluseWidth; - UCHAR HeadSettleDelay[2]; - UCHAR MotorOnDelay; - UCHAR MotorOffDelay; - UCHAR Reserved2 : 5; - UCHAR MotorOnAsserted : 1; - UCHAR StartSectorNumber : 1; - UCHAR TrueReadySignal : 1; - UCHAR StepPlusePerCyclynder : 4; - UCHAR Reserved3 : 4; - UCHAR WriteCompenstation; - UCHAR HeadLoadDelay; - UCHAR HeadUnloadDelay; - UCHAR Pin2Usage : 4; - UCHAR Pin34Usage : 4; - UCHAR Pin1Usage : 4; - UCHAR Pin4Usage : 4; - UCHAR MediumRotationRate[2]; - UCHAR Reserved4[2]; -} MODE_FLEXIBLE_DISK_PAGE, *PMODE_FLEXIBLE_DISK_PAGE; -#pragma pack(pop, mode_page_flex) - -// -// Define mode format page. -// - -#pragma pack(push, mode_page_format, 1) -typedef struct _MODE_FORMAT_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR TracksPerZone[2]; - UCHAR AlternateSectorsPerZone[2]; - UCHAR AlternateTracksPerZone[2]; - UCHAR AlternateTracksPerLogicalUnit[2]; - UCHAR SectorsPerTrack[2]; - UCHAR BytesPerPhysicalSector[2]; - UCHAR Interleave[2]; - UCHAR TrackSkewFactor[2]; - UCHAR CylinderSkewFactor[2]; - UCHAR Reserved2 : 4; - UCHAR SurfaceFirst : 1; - UCHAR RemovableMedia : 1; - UCHAR HardSectorFormating : 1; - UCHAR SoftSectorFormating : 1; - UCHAR Reserved3[3]; -} MODE_FORMAT_PAGE, *PMODE_FORMAT_PAGE; -#pragma pack(pop, mode_page_format) - -// -// Define rigid disk driver geometry page. -// - -#pragma pack(push, mode_page_geometry, 1) -typedef struct _MODE_RIGID_GEOMETRY_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR NumberOfCylinders[3]; - UCHAR NumberOfHeads; - UCHAR StartWritePrecom[3]; - UCHAR StartReducedCurrent[3]; - UCHAR DriveStepRate[2]; - UCHAR LandZoneCyclinder[3]; - UCHAR RotationalPositionLock : 2; - UCHAR Reserved2 : 6; - UCHAR RotationOffset; - UCHAR Reserved3; - UCHAR RoataionRate[2]; - UCHAR Reserved4[2]; -}MODE_RIGID_GEOMETRY_PAGE, *PMODE_RIGID_GEOMETRY_PAGE; -#pragma pack(pop, mode_page_geometry) - -// -// Define read write recovery page -// - -#pragma pack(push, mode_page_rw_recovery, 1) -typedef struct _MODE_READ_WRITE_RECOVERY_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PSBit : 1; - UCHAR PageLength; - UCHAR DCRBit : 1; - UCHAR DTEBit : 1; - UCHAR PERBit : 1; - UCHAR EERBit : 1; - UCHAR RCBit : 1; - UCHAR TBBit : 1; - UCHAR ARRE : 1; - UCHAR AWRE : 1; - UCHAR ReadRetryCount; - UCHAR Reserved4[4]; - UCHAR WriteRetryCount; - UCHAR Reserved5[3]; - -} MODE_READ_WRITE_RECOVERY_PAGE, *PMODE_READ_WRITE_RECOVERY_PAGE; -#pragma pack(pop, mode_page_rw_recovery) - -// -// Define read recovery page - cdrom -// - -#pragma pack(push, mode_page_r_recovery, 1) -typedef struct _MODE_READ_RECOVERY_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PSBit : 1; - UCHAR PageLength; - UCHAR DCRBit : 1; - UCHAR DTEBit : 1; - UCHAR PERBit : 1; - UCHAR Reserved2 : 1; - UCHAR RCBit : 1; - UCHAR TBBit : 1; - UCHAR Reserved3 : 2; - UCHAR ReadRetryCount; - UCHAR Reserved4[4]; - -} MODE_READ_RECOVERY_PAGE, *PMODE_READ_RECOVERY_PAGE; -#pragma pack(pop, mode_page_r_recovery) - - -// -// Define Informational Exception Control Page. Used for failure prediction -// - -#pragma pack(push, mode_page_xcpt, 1) -typedef struct _MODE_INFO_EXCEPTIONS -{ - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PSBit : 1; - - UCHAR PageLength; - - union - { - UCHAR Flags; - struct - { - UCHAR LogErr : 1; - UCHAR Reserved2 : 1; - UCHAR Test : 1; - UCHAR Dexcpt : 1; - UCHAR Reserved3 : 3; - UCHAR Perf : 1; - }; - }; - - UCHAR ReportMethod : 4; - UCHAR Reserved4 : 4; - - UCHAR IntervalTimer[4]; - UCHAR ReportCount[4]; - -} MODE_INFO_EXCEPTIONS, *PMODE_INFO_EXCEPTIONS; -#pragma pack(pop, mode_page_xcpt) - -// -// Begin C/DVD 0.9 definitions -// - -// -// Power Condition Mode Page Format -// - -#pragma pack(push, mode_page_power, 1) -typedef struct _POWER_CONDITION_PAGE { - UCHAR PageCode : 6; // 0x1A - UCHAR Reserved : 1; - UCHAR PSBit : 1; - UCHAR PageLength; // 0x0A - UCHAR Reserved2; - - UCHAR Standby : 1; - UCHAR Idle : 1; - UCHAR Reserved3 : 6; - - UCHAR IdleTimer[4]; - UCHAR StandbyTimer[4]; -} POWER_CONDITION_PAGE, *PPOWER_CONDITION_PAGE; -#pragma pack(pop, mode_page_power) - -// -// CD-Audio Control Mode Page Format -// - -#pragma pack(push, mode_page_cdaudio, 1) -typedef struct _CDDA_OUTPUT_PORT { - UCHAR ChannelSelection : 4; - UCHAR Reserved : 4; - UCHAR Volume; -} CDDA_OUTPUT_PORT, *PCDDA_OUTPUT_PORT; - -typedef struct _CDAUDIO_CONTROL_PAGE { - UCHAR PageCode : 6; // 0x0E - UCHAR Reserved : 1; - UCHAR PSBit : 1; - - UCHAR PageLength; // 0x0E - - UCHAR Reserved2 : 1; - UCHAR StopOnTrackCrossing : 1; // Default 0 - UCHAR Immediate : 1; // Always 1 - UCHAR Reserved3 : 5; - - UCHAR Reserved4[3]; - UCHAR Obsolete[2]; - - CDDA_OUTPUT_PORT CDDAOutputPorts[4]; - -} CDAUDIO_CONTROL_PAGE, *PCDAUDIO_CONTROL_PAGE; -#pragma pack(pop, mode_page_cdaudio) - -#define CDDA_CHANNEL_MUTED 0x0 -#define CDDA_CHANNEL_ZERO 0x1 -#define CDDA_CHANNEL_ONE 0x2 -#define CDDA_CHANNEL_TWO 0x4 -#define CDDA_CHANNEL_THREE 0x8 - -// -// C/DVD Feature Set Support & Version Page -// - -#pragma pack(push, mode_page_features, 1) -typedef struct _CDVD_FEATURE_SET_PAGE { - UCHAR PageCode : 6; // 0x18 - UCHAR Reserved : 1; - UCHAR PSBit : 1; - - UCHAR PageLength; // 0x16 - - UCHAR CDAudio[2]; - UCHAR EmbeddedChanger[2]; - UCHAR PacketSMART[2]; - UCHAR PersistantPrevent[2]; - UCHAR EventStatusNotification[2]; - UCHAR DigitalOutput[2]; - UCHAR CDSequentialRecordable[2]; - UCHAR DVDSequentialRecordable[2]; - UCHAR RandomRecordable[2]; - UCHAR KeyExchange[2]; - UCHAR Reserved2[2]; -} CDVD_FEATURE_SET_PAGE, *PCDVD_FEATURE_SET_PAGE; -#pragma pack(pop, mode_page_features) - -// -// CDVD Inactivity Time-out Page Format -// - -#pragma pack(push, mode_page_timeout, 1) -typedef struct _CDVD_INACTIVITY_TIMEOUT_PAGE { - UCHAR PageCode : 6; // 0x1D - UCHAR Reserved : 1; - UCHAR PSBit : 1; - - UCHAR PageLength; // 0x08 - UCHAR Reserved2[2]; - - UCHAR SWPP : 1; - UCHAR DISP : 1; - UCHAR Reserved3 : 6; - - UCHAR Reserved4; - UCHAR GroupOneMinimumTimeout[2]; - UCHAR GroupTwoMinimumTimeout[2]; -} CDVD_INACTIVITY_TIMEOUT_PAGE, *PCDVD_INACTIVITY_TIMEOUT_PAGE; -#pragma pack(pop, mode_page_timeout) - -// -// CDVD Capabilities & Mechanism Status Page -// - -#define CDVD_LMT_CADDY 0 -#define CDVD_LMT_TRAY 1 -#define CDVD_LMT_POPUP 2 -#define CDVD_LMT_RESERVED1 3 -#define CDVD_LMT_CHANGER_INDIVIDUAL 4 -#define CDVD_LMT_CHANGER_CARTRIDGE 5 -#define CDVD_LMT_RESERVED2 6 -#define CDVD_LMT_RESERVED3 7 - - -#pragma pack(push, mode_page_capabilities, 1) -typedef struct _CDVD_CAPABILITIES_PAGE { - UCHAR PageCode : 6; // 0x2A - UCHAR Reserved : 1; - UCHAR PSBit : 1; // offset 0 - - UCHAR PageLength; // >= 0x18 // offset 1 - - UCHAR CDRRead : 1; - UCHAR CDERead : 1; - UCHAR Method2 : 1; - UCHAR DVDROMRead : 1; - UCHAR DVDRRead : 1; - UCHAR DVDRAMRead : 1; - UCHAR Reserved2 : 2; // offset 2 - - UCHAR CDRWrite : 1; - UCHAR CDEWrite : 1; - UCHAR TestWrite : 1; - UCHAR Reserved3 : 1; - UCHAR DVDRWrite : 1; - UCHAR DVDRAMWrite : 1; - UCHAR Reserved4 : 2; // offset 3 - - UCHAR AudioPlay : 1; - UCHAR Composite : 1; - UCHAR DigitalPortOne : 1; - UCHAR DigitalPortTwo : 1; - UCHAR Mode2Form1 : 1; - UCHAR Mode2Form2 : 1; - UCHAR MultiSession : 1; - UCHAR BufferUnderrunFree : 1; // offset 4 - - UCHAR CDDA : 1; - UCHAR CDDAAccurate : 1; - UCHAR RWSupported : 1; - UCHAR RWDeinterleaved : 1; - UCHAR C2Pointers : 1; - UCHAR ISRC : 1; - UCHAR UPC : 1; - UCHAR ReadBarCodeCapable : 1; // offset 5 - - UCHAR Lock : 1; - UCHAR LockState : 1; - UCHAR PreventJumper : 1; - UCHAR Eject : 1; - UCHAR Reserved6 : 1; - UCHAR LoadingMechanismType : 3; // offset 6 - - UCHAR SeparateVolume : 1; - UCHAR SeperateChannelMute : 1; - UCHAR SupportsDiskPresent : 1; - UCHAR SWSlotSelection : 1; - UCHAR SideChangeCapable : 1; - UCHAR RWInLeadInReadable : 1; - UCHAR Reserved7 : 2; // offset 7 - - union { - UCHAR ReadSpeedMaximum[2]; - UCHAR ObsoleteReserved[2]; // offset 8 - }; - - UCHAR NumberVolumeLevels[2]; // offset 10 - UCHAR BufferSize[2]; // offset 12 - - union { - UCHAR ReadSpeedCurrent[2]; - UCHAR ObsoleteReserved2[2]; // offset 14 - }; - UCHAR ObsoleteReserved3; // offset 16 - - UCHAR Reserved8 : 1; - UCHAR BCK : 1; - UCHAR RCK : 1; - UCHAR LSBF : 1; - UCHAR Length : 2; - UCHAR Reserved9 : 2; // offset 17 - - union { - UCHAR WriteSpeedMaximum[2]; - UCHAR ObsoleteReserved4[2]; // offset 18 - }; - union { - UCHAR WriteSpeedCurrent[2]; - UCHAR ObsoleteReserved11[2]; // offset 20 - }; - - // - // NOTE: This mode page is two bytes too small in the release - // version of the Windows2000 DDK. it also incorrectly - // put the CopyManagementRevision at offset 20 instead - // of offset 22, so fix that with a nameless union (for - // backwards-compatibility with those who "fixed" it on - // their own by looking at Reserved10[]). - // - - union { - UCHAR CopyManagementRevision[2]; // offset 22 - UCHAR Reserved10[2]; - }; - //UCHAR Reserved12[2]; // offset 24 - -} CDVD_CAPABILITIES_PAGE, *PCDVD_CAPABILITIES_PAGE; -#pragma pack(pop, mode_page_capabilities) - -#pragma pack(push, lun_list, 1) -typedef struct _LUN_LIST { - UCHAR LunListLength[4]; // sizeof LunSize * 8 - UCHAR Reserved[4]; -#if !defined(__midl) - UCHAR Lun[0][8]; // 4 level of addressing. 2 bytes each. -#endif -} LUN_LIST, *PLUN_LIST; -#pragma pack(pop, lun_list) - - -#define LOADING_MECHANISM_CADDY 0x00 -#define LOADING_MECHANISM_TRAY 0x01 -#define LOADING_MECHANISM_POPUP 0x02 -#define LOADING_MECHANISM_INDIVIDUAL_CHANGER 0x04 -#define LOADING_MECHANISM_CARTRIDGE_CHANGER 0x05 - -// -// end C/DVD 0.9 mode page definitions - -// -// Mode parameter list block descriptor - -// set the block length for reading/writing -// -// - -#define MODE_BLOCK_DESC_LENGTH 8 -#define MODE_HEADER_LENGTH 4 -#define MODE_HEADER_LENGTH10 8 - -#pragma pack(push, mode_parm_rw, 1) -typedef struct _MODE_PARM_READ_WRITE { - - MODE_PARAMETER_HEADER ParameterListHeader; // List Header Format - MODE_PARAMETER_BLOCK ParameterListBlock; // List Block Descriptor - -} MODE_PARM_READ_WRITE_DATA, *PMODE_PARM_READ_WRITE_DATA; -#pragma pack(pop, mode_parm_rw) - -// end_ntminitape - -// -// CDROM audio control (0x0E) -// - -#define CDB_AUDIO_PAUSE 0 -#define CDB_AUDIO_RESUME 1 - -#define CDB_DEVICE_START 0x11 -#define CDB_DEVICE_STOP 0x10 - -#define CDB_EJECT_MEDIA 0x10 -#define CDB_LOAD_MEDIA 0x01 - -#define CDB_SUBCHANNEL_HEADER 0x00 -#define CDB_SUBCHANNEL_BLOCK 0x01 - -#define CDROM_AUDIO_CONTROL_PAGE 0x0E -#define MODE_SELECT_IMMEDIATE 0x04 -#define MODE_SELECT_PFBIT 0x10 - -#define CDB_USE_MSF 0x01 - -#pragma pack(push, audio_output, 1) -typedef struct _PORT_OUTPUT { - UCHAR ChannelSelection; - UCHAR Volume; -} PORT_OUTPUT, *PPORT_OUTPUT; - -typedef struct _AUDIO_OUTPUT { - UCHAR CodePage; - UCHAR ParameterLength; - UCHAR Immediate; - UCHAR Reserved[2]; - UCHAR LbaFormat; - UCHAR LogicalBlocksPerSecond[2]; - PORT_OUTPUT PortOutput[4]; -} AUDIO_OUTPUT, *PAUDIO_OUTPUT; -#pragma pack(pop, audio_output) - -// -// Multisession CDROM -// - -#define GET_LAST_SESSION 0x01 -#define GET_SESSION_DATA 0x02; - -// -// Atapi 2.5 changer -// - -#pragma pack(push, chgr_stuff, 1) -typedef struct _MECHANICAL_STATUS_INFORMATION_HEADER { - UCHAR CurrentSlot : 5; - UCHAR ChangerState : 2; - UCHAR Fault : 1; - UCHAR Reserved : 5; - UCHAR MechanismState : 3; - UCHAR CurrentLogicalBlockAddress[3]; - UCHAR NumberAvailableSlots; - UCHAR SlotTableLength[2]; -} MECHANICAL_STATUS_INFORMATION_HEADER, *PMECHANICAL_STATUS_INFORMATION_HEADER; - -typedef struct _SLOT_TABLE_INFORMATION { - UCHAR DiscChanged : 1; - UCHAR Reserved : 6; - UCHAR DiscPresent : 1; - UCHAR Reserved2[3]; -} SLOT_TABLE_INFORMATION, *PSLOT_TABLE_INFORMATION; - -typedef struct _MECHANICAL_STATUS { - MECHANICAL_STATUS_INFORMATION_HEADER MechanicalStatusHeader; - SLOT_TABLE_INFORMATION SlotTableInfo[1]; -} MECHANICAL_STATUS, *PMECHANICAL_STATUS; -#pragma pack(pop, chgr_stuff) - - -// begin_ntminitape - -// -// Tape definitions -// - -#pragma pack(push, tape_position, 1) -typedef struct _TAPE_POSITION_DATA { - UCHAR Reserved1:2; - UCHAR BlockPositionUnsupported:1; - UCHAR Reserved2:3; - UCHAR EndOfPartition:1; - UCHAR BeginningOfPartition:1; - UCHAR PartitionNumber; - USHORT Reserved3; - UCHAR FirstBlock[4]; - UCHAR LastBlock[4]; - UCHAR Reserved4; - UCHAR NumberOfBlocks[3]; - UCHAR NumberOfBytes[4]; -} TAPE_POSITION_DATA, *PTAPE_POSITION_DATA; -#pragma pack(pop, tape_position) - -// -// This structure is used to convert little endian -// ULONGs to SCSI CDB big endians values. -// - -#pragma pack(push, byte_stuff, 1) -typedef union _EIGHT_BYTE { - - struct { - UCHAR Byte0; - UCHAR Byte1; - UCHAR Byte2; - UCHAR Byte3; - UCHAR Byte4; - UCHAR Byte5; - UCHAR Byte6; - UCHAR Byte7; - }; - - ULONGLONG AsULongLong; -} EIGHT_BYTE, *PEIGHT_BYTE; - -typedef union _FOUR_BYTE { - - struct { - UCHAR Byte0; - UCHAR Byte1; - UCHAR Byte2; - UCHAR Byte3; - }; - - ULONG AsULong; -} FOUR_BYTE, *PFOUR_BYTE; - -typedef union _TWO_BYTE { - - struct { - UCHAR Byte0; - UCHAR Byte1; - }; - - USHORT AsUShort; -} TWO_BYTE, *PTWO_BYTE; -#pragma pack(pop, byte_stuff) - -// -// Byte reversing macro for converting -// between big- and little-endian formats -// - -#define REVERSE_BYTES_QUAD(Destination, Source) { \ - PEIGHT_BYTE d = (PEIGHT_BYTE)(Destination); \ - PEIGHT_BYTE s = (PEIGHT_BYTE)(Source); \ - d->Byte7 = s->Byte0; \ - d->Byte6 = s->Byte1; \ - d->Byte5 = s->Byte2; \ - d->Byte4 = s->Byte3; \ - d->Byte3 = s->Byte4; \ - d->Byte2 = s->Byte5; \ - d->Byte1 = s->Byte6; \ - d->Byte0 = s->Byte7; \ -} - -#define REVERSE_BYTES(Destination, Source) { \ - PFOUR_BYTE d = (PFOUR_BYTE)(Destination); \ - PFOUR_BYTE s = (PFOUR_BYTE)(Source); \ - d->Byte3 = s->Byte0; \ - d->Byte2 = s->Byte1; \ - d->Byte1 = s->Byte2; \ - d->Byte0 = s->Byte3; \ -} - -#define REVERSE_BYTES_SHORT(Destination, Source) { \ - PTWO_BYTE d = (PTWO_BYTE)(Destination); \ - PTWO_BYTE s = (PTWO_BYTE)(Source); \ - d->Byte1 = s->Byte0; \ - d->Byte0 = s->Byte1; \ -} - -// -// Byte reversing macro for converting -// USHORTS from big to little endian in place -// - -#define REVERSE_SHORT(Short) { \ - UCHAR tmp; \ - PTWO_BYTE w = (PTWO_BYTE)(Short); \ - tmp = w->Byte0; \ - w->Byte0 = w->Byte1; \ - w->Byte1 = tmp; \ - } - -// -// Byte reversing macro for convering -// ULONGS between big & little endian in place -// - -#define REVERSE_LONG(Long) { \ - UCHAR tmp; \ - PFOUR_BYTE l = (PFOUR_BYTE)(Long); \ - tmp = l->Byte3; \ - l->Byte3 = l->Byte0; \ - l->Byte0 = tmp; \ - tmp = l->Byte2; \ - l->Byte2 = l->Byte1; \ - l->Byte1 = tmp; \ - } - -// -// This macro has the effect of Bit = log2(Data) -// - -#define WHICH_BIT(Data, Bit) { \ - UCHAR tmp; \ - for (tmp = 0; tmp < 32; tmp++) { \ - if (((Data) >> tmp) == 1) { \ - break; \ - } \ - } \ - ASSERT(tmp != 32); \ - (Bit) = tmp; \ -} - -// end_storport - -// end_ntminitape - -#pragma pack(pop, _scsi_) // restore original packing level - -#pragma warning(pop) // un-sets any local warning changes - -#endif // !defined _NTSCSI_ - diff --git a/pub/ddk/scsiscan.h b/pub/ddk/scsiscan.h deleted file mode 100644 index 6c49a57..0000000 --- a/pub/ddk/scsiscan.h +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -* -* (C) COPYRIGHT 1996-2000, MICROSOFT CORP. -* -* FILE: scsiscan.h -* -* VERSION: 1.0 -* -* DATE: 2/11/1997 -* -* DESCRIPTION: -* IOCTL definitions for the SCSI scanner device driver. -* -*****************************************************************************/ - -// -// Turns off [] -// -#pragma warning(disable : 4200) - -#ifndef _SCSISCAN_H_ -#define _SCSISCAN_H_ - -// SCSISCAN_CMD.SrbFlags - -#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008 -#define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020 -#define SRB_FLAGS_DATA_IN 0x00000040 -#define SRB_FLAGS_DATA_OUT 0x00000080 -#define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000 - -// SCSISCAN_CMD.SrbStatus definitions - -#define SRB_STATUS_PENDING 0x00 -#define SRB_STATUS_SUCCESS 0x01 -#define SRB_STATUS_ABORTED 0x02 -#define SRB_STATUS_ABORT_FAILED 0x03 -#define SRB_STATUS_ERROR 0x04 -#define SRB_STATUS_BUSY 0x05 -#define SRB_STATUS_INVALID_REQUEST 0x06 -#define SRB_STATUS_INVALID_PATH_ID 0x07 -#define SRB_STATUS_NO_DEVICE 0x08 -#define SRB_STATUS_TIMEOUT 0x09 -#define SRB_STATUS_SELECTION_TIMEOUT 0x0A -#define SRB_STATUS_COMMAND_TIMEOUT 0x0B -#define SRB_STATUS_MESSAGE_REJECTED 0x0D -#define SRB_STATUS_BUS_RESET 0x0E -#define SRB_STATUS_PARITY_ERROR 0x0F -#define SRB_STATUS_REQUEST_SENSE_FAILED 0x10 -#define SRB_STATUS_NO_HBA 0x11 -#define SRB_STATUS_DATA_OVERRUN 0x12 -#define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13 -#define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14 -#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15 -#define SRB_STATUS_REQUEST_FLUSHED 0x16 -#define SRB_STATUS_INVALID_LUN 0x20 -#define SRB_STATUS_INVALID_TARGET_ID 0x21 -#define SRB_STATUS_BAD_FUNCTION 0x22 -#define SRB_STATUS_ERROR_RECOVERY 0x23 - -#define SRB_STATUS_QUEUE_FROZEN 0x40 -#define SRB_STATUS_AUTOSENSE_VALID 0x80 - -#define SRB_STATUS(Status) (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN)) - -typedef struct _SCSISCAN_CMD { - ULONG Reserved1; - ULONG Size; - ULONG SrbFlags; - UCHAR CdbLength; - UCHAR SenseLength; - UCHAR Reserved2; - UCHAR Reserved3; - ULONG TransferLength; - UCHAR Cdb[16]; - PUCHAR pSrbStatus; - PUCHAR pSenseBuffer; -} SCSISCAN_CMD, *PSCSISCAN_CMD; - -// Temporarily set to 128. Should be determined by other definition. -#define MAX_STRING 128 - -typedef struct _SCSISCAN_INFO{ - ULONG Size; - ULONG Flags; - UCHAR PortNumber; - UCHAR PathId; - UCHAR TargetId; - UCHAR Lun; - UCHAR AdapterName[MAX_STRING]; - ULONG Reserved; -} SCSISCAN_INFO, *PSCSISCAN_INFO; - -#define SCSISCAN_RESERVED 0x000 -#define SCSISCAN_CMD_CODE 0x004 -#define SCSISCAN_LOCKDEVICE 0x005 -#define SCSISCAN_UNLOCKDEVICE 0x006 -#define SCSISCAN_SET_TIMEOUT 0x007 -#define SCSISCAN_GET_INFO 0x008 - -//--------------------------------------------------------------------------- -// IOCTL definitions. -// Use these definitions when calling DeviceIoControl -//--------------------------------------------------------------------------- -#define IOCTL_SCSISCAN_CMD CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_CMD_CODE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) -#define IOCTL_SCSISCAN_LOCKDEVICE CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_LOCKDEVICE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) -#define IOCTL_SCSISCAN_UNLOCKDEVICE CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_UNLOCKDEVICE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) -#define IOCTL_SCSISCAN_SET_TIMEOUT CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_SET_TIMEOUT, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_SCSISCAN_GET_INFO CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_GET_INFO , METHOD_OUT_DIRECT, FILE_ANY_ACCESS) - -#endif - diff --git a/pub/ddk/scsiwmi.h b/pub/ddk/scsiwmi.h deleted file mode 100644 index 8c19770..0000000 --- a/pub/ddk/scsiwmi.h +++ /dev/null @@ -1,782 +0,0 @@ -/*++ BUILD Version: 0000 // Increment this if a change has global effects - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - scsiwmi.h - -Abstract: - - This module contains the internal structure definitions and APIs used by - the SCSI WMILIB helper functions - - -Revision History: - - ---*/ - -#ifndef _SCSIWMI_ -#define _SCSIWMI_ - -#if defined (_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// -// This is a per-request context buffer that is needed for every wmi srb. -// The request context must remain valid throughout the entire processing -// of the srb, at least until ScsiPortWmiPostProcess returns with the -// final srb return status and buffer size. If the srb can -// pend then memory for this buffer should be allocated from the SRB -// extension. If not then the memory can be allocated from a stack frame that -// does not go out of scope. -// -typedef struct -{ - PVOID UserContext; // Available for miniport use - - ULONG BufferSize; // Reserved for SCSIWMI use - PUCHAR Buffer; // Reserved for SCSIWMI use - UCHAR MinorFunction;// Reserved for SCSIWMI use - - UCHAR ReturnStatus; // Available to miniport after ScsiPortWmiPostProcess - ULONG ReturnSize; // Available to miniport after ScsiPortWmiPostProcess - -} SCSIWMI_REQUEST_CONTEXT, *PSCSIWMI_REQUEST_CONTEXT; - - -#define ScsiPortWmiGetReturnStatus(RequestContext) ((RequestContext)->ReturnStatus) -#define ScsiPortWmiGetReturnSize(RequestContext) ((RequestContext)->ReturnSize) - -// -// This defines a guid to be registered with WMI. -// -typedef struct -{ - LPCGUID Guid; // Guid representing data block - ULONG InstanceCount; // Count of Instances of Datablock. If - // this count is 0xffffffff then the guid - // is assumed to be dynamic instance names - ULONG Flags; // Additional flags (see WMIREGINFO in wmistr.h) -} SCSIWMIGUIDREGINFO, *PSCSIWMIGUIDREGINFO; - -// -// If this is set then the guid is registered as having dynamic -// instance names. -// -#define WMIREG_FLAG_CALL_BY_NAME 0x40000000 - -typedef -__checkReturn -UCHAR -(*PSCSIWMI_QUERY_REGINFO) ( - __in PVOID DeviceContext, - __in PSCSIWMI_REQUEST_CONTEXT RequestContext, - __out PWCHAR *MofResourceName - ); -/*++ - -Routine Description: - - This routine is a callback into the miniport to retrieve information about - the guids being registered. - - This callback is synchronous and may not be pended. Also - ScsiPortWmiPostProcess should not be called from within this callback. - -Arguments: - - DeviceContext is a caller specified context value originally passed to - ScsiPortWmiDispatchFunction. - - RequestContext is a context associated with the srb being processed. - - MofResourceName returns with a pointer to a WCHAR string with name of - the MOF resource attached to the miniport binary image file. If - the driver does not have a mof resource attached then this can - be returned as NULL. - -Return Value: - - TRUE if request is pending else FALSE - ---*/ - -typedef -__checkReturn -BOOLEAN -(*PSCSIWMI_QUERY_DATABLOCK) ( - __in PVOID Context, - __in PSCSIWMI_REQUEST_CONTEXT DispatchContext, - __in ULONG GuidIndex, - __in ULONG InstanceIndex, - __in ULONG InstanceCount, - __inout PULONG InstanceLengthArray, - __in ULONG BufferAvail, - __out_bcount(BufferAvail) PUCHAR Buffer - ); -/*++ - -Routine Description: - - This routine is a callback into the miniport to query for the contents of - one or more instances of a data block. This callback may be called with - an output buffer that is too small to return all of the data queried. - In this case the callback is responsible to report the correct output - buffer size needed. - - If the request can be completed immediately without pending, - ScsiPortWmiPostProcess should be called from within this callback and - FALSE returned. - - If the request cannot be completed within this callback then TRUE should - be returned. Once the pending operations are finished the miniport should - call ScsiPortWmiPostProcess and then complete the srb. - -Arguments: - - DeviceContext is a caller specified context value originally passed to - ScsiPortWmiDispatchFunction. - - RequestContext is a context associated with the srb being processed. - - GuidIndex is the index into the list of guids provided when the - miniport registered - - InstanceIndex is the index that denotes first instance of the data block - is being queried. - - InstanceCount is the number of instances expected to be returned for - the data block. - - InstanceLengthArray is a pointer to an array of ULONG that returns the - lengths of each instance of the data block. This may be NULL when - there is not enough space in the output buffer to fufill the request. - In this case the miniport should call ScsiPortWmiPostProcess with - a status of SRB_STATUS_DATA_OVERRUN and the size of the output buffer - needed to fufill the request. - - BufferAvail on entry has the maximum size available to write the data - blocks in the output buffer. If the output buffer is not large enough - to return all of the data blocks then the miniport should call - ScsiPortWmiPostProcess with a status of SRB_STATUS_DATA_OVERRUN - and the size of the output buffer needed to fufill the request. - - Buffer on return is filled with the returned data blocks. Note that each - instance of the data block must be aligned on a 8 byte boundry. This - may be NULL when there is not enough space in the output buffer to - fufill the request. In this case the miniport should call - ScsiPortWmiPostProcess with a status of SRB_STATUS_DATA_OVERRUN and - the size of the output buffer needed to fufill the request. - - -Return Value: - - TRUE if request is pending else FALSE - ---*/ - -typedef -__checkReturn -BOOLEAN -(*PSCSIWMI_SET_DATABLOCK) ( - __in PVOID DeviceContext, - __in PSCSIWMI_REQUEST_CONTEXT RequestContext, - __in ULONG GuidIndex, - __in ULONG InstanceIndex, - __in ULONG BufferSize, - __in_bcount(BufferSize) PUCHAR Buffer - ); -/*++ - -Routine Description: - - This routine is a callback into the miniport to set the contents of an - entire instance of a data block. - - If the request can be completed immediately without pending, - ScsiPortWmiPostProcess should be called from within this callback and - FALSE returned. - - If the request cannot be completed within this callback then TRUE should - be returned. Once the pending operations are finished the miniport should - call ScsiPortWmiPostProcess and then complete the srb. - -Arguments: - - DeviceContext is a caller specified context value originally passed to - ScsiPortWmiDispatchFunction. - - RequestContext is a context associated with the srb being processed. - - GuidIndex is the index into the list of guids provided when the - miniport registered - - InstanceIndex is the index that denotes which instance of the data block - is being set. - - BufferSize has the size of the data block passed - - Buffer has the new values for the data block - - -Return Value: - - TRUE if request is pending else FALSE - ---*/ - -typedef -__checkReturn -BOOLEAN -(*PSCSIWMI_SET_DATAITEM) ( - __in PVOID DeviceContext, - __in PSCSIWMI_REQUEST_CONTEXT RequestContext, - __in ULONG GuidIndex, - __in ULONG InstanceIndex, - __in ULONG DataItemId, - __in ULONG BufferSize, - __in_bcount(BufferSize) PUCHAR Buffer - ); -/*++ - -Routine Description: - - This routine is a callback into the miniport to set a single data item - in a single instance of a data block. - - If the request can be completed immediately without pending, - ScsiPortWmiPostProcess should be called from within this callback and - FALSE returned. - - If the request cannot be completed within this callback then TRUE should - be returned. Once the pending operations are finished the miniport should - call ScsiPortWmiPostProcess and then complete the srb. - -Arguments: - - DeviceContext is a caller specified context value originally passed to - ScsiPortWmiDispatchFunction. - - RequestContext is a context associated with the srb being processed. - - GuidIndex is the index into the list of guids provided when the - miniport registered - - InstanceIndex is the index that denotes which instance of the data block - is being set. - - DataItemId has the id of the data item being set - - BufferSize has the size of the data item passed - - Buffer has the new values for the data item - - -Return Value: - - TRUE if request is pending else FALSE - ---*/ - -typedef -__checkReturn -BOOLEAN -(*PSCSIWMI_EXECUTE_METHOD) ( - __in PVOID DeviceContext, - __in PSCSIWMI_REQUEST_CONTEXT RequestContext, - __in ULONG GuidIndex, - __in ULONG InstanceIndex, - __in ULONG MethodId, - __in ULONG InBufferSize, - __in ULONG OutBufferSize, - __inout_bcount_part(InBufferSize, OutBufferSize) PUCHAR Buffer - ); -/*++ - -Routine Description: - - This routine is a callback into the miniport to execute a method. - - If the request can be completed immediately without pending, - ScsiPortWmiPostProcess should be called from within this callback and - FALSE returned. - - If the request cannot be completed within this callback then TRUE should - be returned. Once the pending operations are finished the miniport should - call ScsiPortWmiPostProcess and then complete the srb. - -Arguments: - - Context is a caller specified context value originally passed to - ScsiPortWmiDispatchFunction. - - RequestContext is a context associated with the srb being processed. - - GuidIndex is the index into the list of guids provided when the - miniport registered - - InstanceIndex is the index that denotes which instance of the data block - is being called. - - MethodId has the id of the method being called - - InBufferSize has the size of the data block passed in as the input to - the method. - - OutBufferSize on entry has the maximum size available to write the - returned data block. If the output buffer is not large enough - to return all of the data blocks then the miniport should call - ScsiPortWmiPostProcess with a status of SRB_STATUS_DATA_OVERRUN - and the size of the output buffer needed to fufill the request. - It is important to check that there is sufficient room in the - output buffer before performing any operations that may have - side effects. - - Buffer on entry has the input data block and on return has the output - output data block. - - -Return Value: - - TRUE if request is pending else FALSE - ---*/ - -typedef enum -{ - ScsiWmiEventControl, // Enable or disable an event - ScsiWmiDataBlockControl // Enable or disable data block collection -} SCSIWMI_ENABLE_DISABLE_CONTROL; - -typedef -__checkReturn -BOOLEAN -(*PSCSIWMI_FUNCTION_CONTROL) ( - __in PVOID DeviceContext, - __in PSCSIWMI_REQUEST_CONTEXT RequestContext, - __in ULONG GuidIndex, - __in SCSIWMI_ENABLE_DISABLE_CONTROL Function, - __in BOOLEAN Enable - ); -/*++ - -Routine Description: - - This routine is a callback into the miniport to enabled or disable event - generation or data block collection. Since WMI manages reference counting - for each of the data blocks or events, a miniport should only expect a - single enable followed by a single disable. Data blocks will only - receive collection enable/disable if they were registered as requiring - it, that is include the WMIREG_FLAG_EXPENSIVE flag. - - If the request can be completed immediately without pending, - ScsiPortWmiPostProcess should be called from within this callback and - FALSE returned. - - If the request cannot be completed within this callback then TRUE should - be returned. Once the pending operations are finished the miniport should - call ScsiPortWmiPostProcess and then complete the srb. - -Arguments: - - DeviceContext is a caller specified context value originally passed to - ScsiPortWmiDispatchFunction. - - RequestContext is a context associated with the srb being processed. - - Function specifies which functionality is being enabled or disabled - - Enable is TRUE then the function is being enabled else disabled - -Return Value: - - TRUE if request is pending else FALSE - ---*/ - -// -// This structure supplies context information for SCSIWMILIB to process the -// WMI srbs. -// -typedef struct _SCSIWMILIB_CONTEXT -{ - // - // WMI data block guid registration info - ULONG GuidCount; - PSCSIWMIGUIDREGINFO GuidList; - - // - // WMI functionality callbacks - PSCSIWMI_QUERY_REGINFO QueryWmiRegInfo; - PSCSIWMI_QUERY_DATABLOCK QueryWmiDataBlock; - PSCSIWMI_SET_DATABLOCK SetWmiDataBlock; - PSCSIWMI_SET_DATAITEM SetWmiDataItem; - PSCSIWMI_EXECUTE_METHOD ExecuteWmiMethod; - PSCSIWMI_FUNCTION_CONTROL WmiFunctionControl; -} SCSI_WMILIB_CONTEXT, *PSCSI_WMILIB_CONTEXT; - -VOID -ScsiPortWmiPostProcess( - __in PSCSIWMI_REQUEST_CONTEXT RequestContext, - __in UCHAR SrbStatus, - __in ULONG BufferUsed - ); -/*++ - -Routine Description: - - - This routine will do the work of post-processing a WMI srb. - -Arguments: - - RequestContext is a context associated with the srb being processed. After - this api returns the ReturnStatus and ReturnSize fields are updated. - - SrbStatus has the return status code for the srb. If a query or method - callback was passed an output buffer that was not large enough - then SrbStatus should be SRB_STATUS_DATA_OVERRUN and BufferUsed - should be the number of bytes needed in the output buffer. - - BufferUsed has the number of bytes required by the miniport to return the - data requested in the WMI srb. If SRB_STATUS_DATA_OVERRUN was passed - in SrbStatus then BufferUsed has the number of needed in the output - buffer. If SRB_STATUS_SUCCESS is passed in SrbStatus then BufferUsed - has the actual number of bytes used in the output buffer. - -Return Value: - - ---*/ - -__checkReturn -BOOLEAN -ScsiPortWmiDispatchFunction( - __in PSCSI_WMILIB_CONTEXT WmiLibInfo, - __in UCHAR MinorFunction, - __in PVOID DeviceContext, - __in PSCSIWMI_REQUEST_CONTEXT RequestContext, - __in PVOID DataPath, - __in ULONG BufferSize, - __in PVOID Buffer - ); -/*++ - -Routine Description: - - Dispatch helper routine for WMI srb requests. Based on the Minor - function passed the WMI request is processed and this routine - invokes the appropriate callback in the WMILIB structure. - -Arguments: - - WmiLibInfo has the SCSI WMILIB information control block associated - with the adapter or logical unit - - DeviceContext is miniport defined context value passed on to the callbacks - invoked by this api. - - RequestContext is a pointer to a context structure that maintains - information about this WMI srb. This request context must remain - valid throughout the entire processing of the srb, at least until - ScsiPortWmiPostProcess returns with the final srb return status and - buffer size. If the srb can pend then memory for this buffer should - be allocated from the SRB extension. If not then the memory can be - allocated from a stack frame that does not go out of scope, perhaps - that of the caller to this api. - - DataPath is value passed in wmi request - - BufferSize is value passed in wmi request - - Buffer is value passed in wmi request - -Return Value: - - TRUE if request is pending else FALSE - ---*/ - -#define ScsiPortWmiFireAdapterEvent( \ - HwDeviceExtension, \ - Guid, \ - InstanceIndex, \ - EventDataSize, \ - EventData \ - ) \ - ScsiPortWmiFireLogicalUnitEvent(\ - HwDeviceExtension, \ - 0xff, \ - 0, \ - 0, \ - Guid, \ - InstanceIndex, \ - EventDataSize, \ - EventData) -/*++ - -Routine Description: - - This routine will fire a WMI event associated with an adapter using - the data buffer passed. This routine may be called at or below DPC level. - -Arguments: - - HwDeviceExtension is the adapter device extension - - Guid is pointer to the GUID that represents the event - - InstanceIndex is the index of the instance of the event - - EventDataSize is the number of bytes of data that is being fired with - with the event. This size specifies the size of the event data only - and does NOT include the 0x40 bytes of preceeding padding. - - EventData is the data that is fired with the events. There must be exactly - 0x40 bytes of padding preceeding the event data. - -Return Value: - ---*/ - -VOID -ScsiPortWmiFireLogicalUnitEvent( - __in PVOID HwDeviceExtension, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun, - __in LPGUID Guid, - __in ULONG InstanceIndex, - __in ULONG EventDataSize, - __in PVOID EventData - ); -/*++ - -Routine Description: - - This routine will fire a WMI event using the data buffer passed. This - routine may be called at or below DPC level - -Arguments: - - HwDeviceExtension is the adapter device extension - - PathId identifies the SCSI bus if a logical unit is firing the event - or is 0xff if the adapter is firing the event. - - TargetId identifies the target controller or device on the bus - - Lun identifies the logical unit number of the target device - - Guid is pointer to the GUID that represents the event - - InstanceIndex is the index of the instance of the event - - EventDataSize is the number of bytes of data that is being fired with - with the event. This size specifies the size of the event data only - and does NOT include the 0x40 bytes of preceeding padding. - - EventData is the data that is fired with the events. There must be exactly - 0x40 bytes of padding preceeding the event data. - -Return Value: - ---*/ - -#if (NTDDI_VERSION >= NTDDI_WS03) -// -// This macro determines if the WMI request is a QueryAllData request -// or a different request -// -#define ScsiPortWmiIsQueryAllData(RequestContext) \ - ( (RequestContext)->MinorFunction == WMI_GET_ALL_DATA ) - -__checkReturn -PWCHAR ScsiPortWmiGetInstanceName( - __in PSCSIWMI_REQUEST_CONTEXT RequestContext - ); -/*++ - -Routine Description: - - This routine will return a pointer to the instance name that was - used to pass the request. If the request type is one that does not - use an instance name then NULL is retuened. The instance name is a - counted string. - -Arguments: - - RequestContext is a pointer to a context structure that maintains - information about this WMI srb. This request context must remain - valid throughout the entire processing of the srb, at least until - ScsiPortWmiPostProcess returns with the final srb return status and - buffer size. If the srb can pend then memory for this buffer should - be allocated from the SRB extension. If not then the memory can be - allocated from a stack frame that does not go out of scope, perhaps - that of the caller to this api. - -Return Value: - - Pointer to instance name or NULL if no instance name is available - ---*/ - -__checkReturn -BOOLEAN ScsiPortWmiSetInstanceCount( - __in PSCSIWMI_REQUEST_CONTEXT RequestContext, - __in ULONG InstanceCount, - __out PULONG BufferAvail, - __out PULONG SizeNeeded - ); -/*++ - -Routine Description: - - This routine will update the wnode to indicate the number of - instances that will be returned by the driver. Note that the values - for BufferAvail may change after this call. This routine - may only be called for a WNODE_ALL_DATA. This routine must be - called before calling ScsiPortWmiSetInstanceName or - ScsiPortWmiSetData - -Arguments: - - RequestContext is a pointer to a context structure that maintains - information about this WMI srb. This request context must remain - valid throughout the entire processing of the srb, at least until - ScsiPortWmiPostProcess returns with the final srb return status and - buffer size. If the srb can pend then memory for this buffer should - be allocated from the SRB extension. If not then the memory can be - allocated from a stack frame that does not go out of scope, perhaps - that of the caller to this api. - - InstanceCount is the number of instances to be returned by the - driver. - - *BufferAvail returns with the number of bytes available for - instance names and data in the buffer. This may be 0 if there - is not enough room for all instances. - - *SizeNeeded returns with the number of bytes that are needed so far - to build the output wnode - -Return Value: - - TRUE if successful else FALSE. If FALSE wnode is not a - WNODE_ALL_DATA or does not have dynamic instance names. - ---*/ - -__checkReturn -PWCHAR ScsiPortWmiSetInstanceName( - __in PSCSIWMI_REQUEST_CONTEXT RequestContext, - __in ULONG InstanceIndex, - __in ULONG InstanceNameLength, - __out PULONG BufferAvail, - __inout PULONG SizeNeeded - ); -/*++ - -Routine Description: - - This routine will update the wnode header to include the position where an - instance name is to be written. Note that the values - for BufferAvail may change after this call. This routine - may only be called for a WNODE_ALL_DATA. - -Arguments: - - RequestContext is a pointer to a context structure that maintains - information about this WMI srb. This request context must remain - valid throughout the entire processing of the srb, at least until - ScsiPortWmiPostProcess returns with the final srb return status and - buffer size. If the srb can pend then memory for this buffer should - be allocated from the SRB extension. If not then the memory can be - allocated from a stack frame that does not go out of scope, perhaps - that of the caller to this api. - - InstanceIndex is the index to the instance name being filled in - - InstanceNameLength is the number of bytes (including count) needed - to write the instance name. - - *BufferAvail returns with the number of bytes available for - instance names and data in the buffer. This may be 0 if there - is not enough room for the instance name. - - *SizeNeeded on entry has the number of bytes needed so far to build - the WNODE and on return has the number of bytes needed to build - the wnode after including the instance name - -Return Value: - - pointer to where the instance name should be filled in. If NULL - then the wnode is not a WNODE_ALL_DATA or does not have dynamic - instance names - ---*/ - -__checkReturn -PVOID ScsiPortWmiSetData( - __in PSCSIWMI_REQUEST_CONTEXT RequestContext, - __in ULONG InstanceIndex, - __in ULONG DataLength, - __out PULONG BufferAvail, - __inout PULONG SizeNeeded - ); -/*++ - -Routine Description: - - This routine will update the wnode to indicate the position of the - data for an instance that will be returned by the driver. Note that - the values for BufferAvail may change after this call. This routine - may only be called for a WNODE_ALL_DATA. - -Arguments: - - RequestContext is a pointer to a context structure that maintains - information about this WMI srb. This request context must remain - valid throughout the entire processing of the srb, at least until - ScsiPortWmiPostProcess returns with the final srb return status and - buffer size. If the srb can pend then memory for this buffer should - be allocated from the SRB extension. If not then the memory can be - allocated from a stack frame that does not go out of scope, perhaps - that of the caller to this api. - - InstanceIndex is the index to the instance name being filled in - - DataLength is the number of bytes needed to write the data. - - *BufferAvail returns with the number of bytes available for - instance names and data in the buffer. This may be 0 if there - is not enough room for the data. - - *SizeNeeded on entry has the number of bytes needed so far to build - the WNODE and on return has the number of bytes needed to build - the wnode after including the data - -Return Value: - - pointer to where the data should be filled in. If NULL - then the wnode is not a WNODE_ALL_DATA or does not have dynamic - instance names - ---*/ -#endif - - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/pub/ddk/sddef.h b/pub/ddk/sddef.h deleted file mode 100644 index 8e99bf8..0000000 --- a/pub/ddk/sddef.h +++ /dev/null @@ -1,226 +0,0 @@ -/*++ - -Copyright (c) 2003 Microsoft Corporation - -Module Name: - - sddef.h - -Abstract: - - This is the include file that defines the basic types used - in the SD (Secure Digital) driver stack interface. These types - are used in conjuction with header files NTDDSD.H or SFFDISK.H. - ---*/ - -#ifndef _SDDEFH_ -#define _SDDEFH_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif - -// -// Disable warning: nonstandard extension used : bit field types other than int -// - -#pragma warning(disable:4214) - -#ifdef __cplusplus -extern "C" { -#endif - - -// -// SD device commands codes either refer to the standard command -// set (0-63), or to the "App Cmd" set, which have the same value range, -// but are preceded by the app_cmd escape (55). -// - -typedef UCHAR SD_COMMAND_CODE; - -typedef enum { - SDCC_STANDARD = 0, - SDCC_APP_CMD -} SD_COMMAND_CLASS; -// -// SDTD_READ indicates data transfer from the SD device to the host -// SDTD_WRITE indicates data transfer from the SD host to the device -// - -typedef enum { - SDTD_UNSPECIFIED = 0, - SDTD_READ, - SDTD_WRITE -} SD_TRANSFER_DIRECTION; - - -// -// Transfer type refers to the style of data transfer of the SD data -// lines. Note that a command may have a response, but still not use -// the data lines (no_data). -// - -typedef enum { - SDTT_UNSPECIFIED = 0, - SDTT_CMD_ONLY, - SDTT_SINGLE_BLOCK, - SDTT_MULTI_BLOCK, - SDTT_MULTI_BLOCK_NO_CMD12 -} SD_TRANSFER_TYPE; - - -// -// SD transfer responses are defined in the SD spec. A given command -// will only exhibit one of these responses. But because the interface -// allows function drivers to issue undefined commands, the transfer -// response may also need to be specified. -// - -typedef enum { - SDRT_UNSPECIFIED = 0, - SDRT_NONE, - SDRT_1, - SDRT_1B, - SDRT_2, - SDRT_3, - SDRT_4, - SDRT_5, - SDRT_5B, - SDRT_6 -} SD_RESPONSE_TYPE; - -// -// Response structures are mapped into the response data field in the -// request packet -// - -typedef struct _SDRESP_TYPE3 { - ULONG Reserved1:4; - ULONG VoltageProfile:20; - ULONG Reserved2:7; - ULONG PowerState:1; -} SDRESP_TYPE3, *PSDRESP_TYPE3; - -// -// OCR Register structure for Physical Specification Version 2.00 or higher -// -typedef struct _OCR_REGISTER_V2 { - ULONG Reserved1:7; - ULONG VoltageProfile1:1; - ULONG Reserved2:7; - ULONG VoltageProfile2:9; - ULONG Reserved3:6; - ULONG CardCapacityStatus:1; - ULONG PowerState:1; -} OCR_REGISTER_V2, *POCR_REGISTER_V2; - -// -// This structure defines a specific SD device command. Function drivers -// must build this structure to pass as a parameter to the DeviceCommand request. -// -// Cmd - SD device code -// CmdClass - specifies whether the command is a standard or APP command -// TransferDirection - direction of data on SD data lines -// TransferType - 3 types of commands: CmdOnly, SingleBlock or MultiBlock -// ResponseType - SD response type -// -// For example, a driver can issue single byte (direct) I/O reads -// to an SDIO function by first defining the following structure: -// -// const SDCMD_DESCRIPTOR ReadIoDirectDesc = -// {SDCMD_IO_RW_DIRECT, SDTD_STANDARD, SDTD_READ, SDTT_CMD_ONLY, SDRT_5}; -// -// Then, before the call to SdbusSubmitRequest(), copy this structure -// and the argument of the command to the request packet: -// -// sdrp->RequestFunction = SDRF_DEVICE_COMMAND; -// sdrp->Parameters.DeviceCommand.CmdDesc = ReadIoDirectDesc; -// sdrp->Parameters.DeviceCommand.Argument = argument; -// status = SdBusSubmitRequest(interfaceContext, sdrp); -// -// - -typedef struct _SDCMD_DESCRIPTOR { - - SD_COMMAND_CODE Cmd; - SD_COMMAND_CLASS CmdClass; - - SD_TRANSFER_DIRECTION TransferDirection; - SD_TRANSFER_TYPE TransferType; - SD_RESPONSE_TYPE ResponseType; - -} SDCMD_DESCRIPTOR, *PSDCMD_DESCRIPTOR; - - -// -// Class-neutral SD device definitions -// -// Note that the SDIO arguments may be validated by the bus driver. For -// example, the bus driver will reject attempts to write into the function -// space of a different function on an SD combo card. -// - -typedef struct _SD_RW_DIRECT_ARGUMENT { - - union { - struct { - ULONG Data:8; - ULONG Reserved1:1; - ULONG Address:17; - ULONG Reserved2:1; - ULONG ReadAfterWrite:1; - ULONG Function:3; - ULONG WriteToDevice:1; - } bits; - - ULONG AsULONG; - } u; - -} SD_RW_DIRECT_ARGUMENT, *PSD_RW_DIRECT_ARGUMENT; - -typedef struct _SD_RW_EXTENDED_ARGUMENT { - - union { - struct { - ULONG Count:9; - ULONG Address:17; - ULONG OpCode:1; - ULONG BlockMode:1; - ULONG Function:3; - ULONG WriteToDevice:1; - } bits; - - ULONG AsULONG; - } u; - -} SD_RW_EXTENDED_ARGUMENT, *PSD_RW_EXTENDED_ARGUMENT; - - -// -// Class-neutral SD codes -// -// provided here are SD command codes that are not class specific. -// Typically other codes are defined in the class driver for the -// respective device class. -// - -#define SDCMD_IO_RW_DIRECT 52 -#define SDCMD_IO_RW_EXTENDED 53 - - -#ifdef __cplusplus -} -#endif - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - -#endif - diff --git a/pub/ddk/sdplib.h b/pub/ddk/sdplib.h deleted file mode 100644 index 2c17323..0000000 --- a/pub/ddk/sdplib.h +++ /dev/null @@ -1,366 +0,0 @@ -#ifndef __SDPLIB_H__ -#define __SDPLIB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "sdpnode.h" - -#ifndef NTSTATUS -typedef LONG NTSTATUS; -#endif - -#ifdef _NTDDK_ -#define SDPLIB_KERNEL -#endif - -#ifdef SDPLIB_KERNEL -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_TREE_ROOT_NODE -SdpCreateNodeTree( - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeNil( - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeUInt128( - __in PSDP_ULARGE_INTEGER_16 puli16Val, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeUInt64( - __in ULONGLONG ullVal, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeUInt32( - __in ULONG ulVal, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeUInt16( - __in USHORT usVal, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeUInt8( - __in UCHAR ucVal, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeInt128( - __in PSDP_LARGE_INTEGER_16 uil16Val, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeInt64( - __in LONGLONG llVal, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeInt32( - __in LONG lVal, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeInt16( - __in SHORT sVal, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeInt8( - __in CHAR cVal, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeUUID128( - __in const GUID *uuid, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeUUID32( - __in ULONG uuidVal4, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeUUID16( - __in USHORT uuidVal2, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeBoolean( - __in SDP_BOOLEAN bVal, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeSequence( - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeAlternative( - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeUrl( - __in_bcount(UrlLength) PCHAR url, - __in_bound ULONG urlLength, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -NTSTATUS -SdpAddAttributeToTree( - __in PSDP_TREE_ROOT_NODE Tree, - __in USHORT AttribId, - __in __drv_when(return==0, __drv_aliasesMem) PSDP_NODE AttribValue, - __in ULONG tag - ); - -__checkReturn -__drv_sameIRQL -__drv_when(return!=0, __drv_allocatesMem(Mem)) -PSDP_NODE -SdpCreateNodeString( - __in_bcount(StringLength) PCHAR string, - __in_bound ULONG stringLength, - __in ULONG tag - ); - -#else //SDPLIB_KERNEL - -__checkReturn -PSDP_TREE_ROOT_NODE -SdpCreateNodeTree(); - -__checkReturn -PSDP_NODE -SdpCreateNodeNil(); - -__checkReturn -PSDP_NODE -SdpCreateNodeUInt128( - __in PSDP_ULARGE_INTEGER_16 puli16Val - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeUInt64( - __in ULONGLONG ullVal - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeUInt32( - __in ULONG ulVal - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeUInt16( - __in USHORT usVal - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeUInt8( - __in UCHAR ucVal - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeInt128( - __in PSDP_LARGE_INTEGER_16 uil16Val - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeInt64( - __in LONGLONG llVal - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeInt32( - __in LONG lVal - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeInt16( - __in SHORT sVal - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeInt8( - __in CHAR cVal - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeUUID128( - __in const GUID *uuid - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeUUID32( - __in ULONG uuidVal4 - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeUUID16( - __in USHORT uuidVal2 - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeBoolean( - __in SDP_BOOLEAN bVal - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeSequence(); - -__checkReturn -PSDP_NODE -SdpCreateNodeAlternative(); - -__checkReturn -PSDP_NODE -SdpCreateNodeUrl( - __in_bcount(UrlLength) PCHAR url, - __in_bound ULONG urlLength - ); - -__checkReturn -NTSTATUS -SdpAddAttributeToTree( - __in PSDP_TREE_ROOT_NODE Tree, - __in USHORT AttribId, - __in PSDP_NODE AttribValue - ); - -__checkReturn -PSDP_NODE -SdpCreateNodeString( - __in_bcount(StringLength) PCHAR string, - __in_bound ULONG stringLength - ); - -#endif //SDPLIB_KERNEL - -__drv_sameIRQL -__success(TRUE) -NTSTATUS -SdpFreeTree( - __in __drv_freesMem(Mem) PSDP_TREE_ROOT_NODE Tree - ); - -#define SdpCreateNodeUUID SdpCreateNodeUUID128 - -__checkReturn -__drv_sameIRQL -NTSTATUS -SdpAppendNodeToContainerNode( - __in PSDP_NODE Parent, - __in __drv_aliasesMem PSDP_NODE Node - ); - -__checkReturn -__drv_sameIRQL -NTSTATUS -SdpFindAttributeInTree( - __in PSDP_TREE_ROOT_NODE Tree, - __in USHORT AttribId, - __out PSDP_NODE *Attribute - ); - -#ifdef __cplusplus -}; -#endif - - -#endif - - diff --git a/pub/ddk/sdpnode.h b/pub/ddk/sdpnode.h deleted file mode 100644 index dac397b..0000000 --- a/pub/ddk/sdpnode.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef __SDPNODE_H__ -#define __SDPNODE_H__ - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4201) // nameless struct/union - -#if (NTDDI_VERSION >= NTDDI_VISTA) - - -#ifdef __cplusplus -extern "C" { -#endif - - - typedef UCHAR SDP_BOOLEAN; - -typedef struct ISdpNodeContainer ISdpNodeContainer; - -typedef struct _SDP_NODE_HEADER { - LIST_ENTRY Link; - USHORT Type; - USHORT SpecificType; -} SDP_NODE_HEADER, *PSDP_NODE_HEADER; - -typedef union _SDP_NODE_DATA { - // the nil type contains no data, so no storage is necessary - - // 16 byte integers - // - // ISSUE is there a better way to represent a 16 byte int??? - // - SDP_LARGE_INTEGER_16 int128; - SDP_ULARGE_INTEGER_16 uint128; - - // UUID - GUID uuid128; - ULONG uuid32; - USHORT uuid16; - - // 8 byte integers - LONGLONG int64; - ULONGLONG uint64; - - // 4 byte integers - LONG int32; - ULONG uint32; - - // 2 byte integers - SHORT int16; - USHORT uint16; - - // 1 bytes integers - CHAR int8; - UCHAR uint8; - - // Boolean - SDP_BOOLEAN boolean; - - // string - PCHAR string; - - // URL - PCHAR url; - - // Sequence - SDP_NODE_HEADER sequence; - - // Alt list - SDP_NODE_HEADER alternative; - - ISdpNodeContainer *container; - - struct { - PUCHAR stream; - ULONG streamLength; - }; - -} SDP_NODE_DATA, *PSDP_NODE_DATA; - -typedef struct _SDP_NODE { - SDP_NODE_HEADER hdr; - - ULONG DataSize; - - SDP_NODE_DATA u; - - PVOID Reserved; -} SDP_NODE, *PSDP_NODE; - -typedef struct _SDP_TREE_ROOT_NODE { - SDP_NODE RootNode; -} SDP_TREE_ROOT_NODE, *PSDP_TREE_ROOT_NODE; - - - - - -#ifdef __cplusplus -} - -#endif -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4201) -#endif - -#endif // __SDPNODE_H__ - - diff --git a/pub/ddk/sdv_driverspecs.h b/pub/ddk/sdv_driverspecs.h deleted file mode 100644 index ca61caa..0000000 --- a/pub/ddk/sdv_driverspecs.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef SDV -// general purpose save -//----------------------- -#define __sdv_save_request(r) -// general purpose retrieve -//----------------------- -#define __sdv_retrieve_request(r) - -// NDIS AdapterContext save -//----------------------- -#define __sdv_save_adapter_context(c) - -#else -// general purpose save -//----------------------- -//#define __sdv_save sdv_save -//void sdv_save(void *r){;} -// general purpose retrieve macros -//----------------------- -//#define __sdv_retrieve sdv_retrieve -//void sdv_retrieve(void *r){;} -#endif - diff --git a/pub/ddk/sensorsclassextension.h b/pub/ddk/sensorsclassextension.h deleted file mode 100644 index 3f6aa10..0000000 --- a/pub/ddk/sensorsclassextension.h +++ /dev/null @@ -1,516 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for windowssensorclassextension.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __windowssensorclassextension_h__ -#define __windowssensorclassextension_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __ISensorDriver_FWD_DEFINED__ -#define __ISensorDriver_FWD_DEFINED__ -typedef interface ISensorDriver ISensorDriver; -#endif /* __ISensorDriver_FWD_DEFINED__ */ - - -#ifndef __ISensorClassExtension_FWD_DEFINED__ -#define __ISensorClassExtension_FWD_DEFINED__ -typedef interface ISensorClassExtension ISensorClassExtension; -#endif /* __ISensorClassExtension_FWD_DEFINED__ */ - - -#ifndef __SensorClassExtension_FWD_DEFINED__ -#define __SensorClassExtension_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SensorClassExtension SensorClassExtension; -#else -typedef struct SensorClassExtension SensorClassExtension; -#endif /* __cplusplus */ - -#endif /* __SensorClassExtension_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "propidl.h" -#include "wudfddi.h" -#include "PortableDeviceTypes.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_windowssensorclassextension_0000_0000 */ -/* [local] */ - -#if (_WIN32_WINNT >= 0x0600) // Windows Vista and later -typedef /* [public][public] */ -enum __MIDL___MIDL_itf_windowssensorclassextension_0000_0000_0001 - { SENSOR_STATE_MIN = 0, - SENSOR_STATE_READY = SENSOR_STATE_MIN, - SENSOR_STATE_NOT_AVAILABLE = ( SENSOR_STATE_READY + 1 ) , - SENSOR_STATE_NO_DATA = ( SENSOR_STATE_NOT_AVAILABLE + 1 ) , - SENSOR_STATE_INITIALIZING = ( SENSOR_STATE_NO_DATA + 1 ) , - SENSOR_STATE_ACCESS_DENIED = ( SENSOR_STATE_INITIALIZING + 1 ) , - SENSOR_STATE_ERROR = ( SENSOR_STATE_ACCESS_DENIED + 1 ) , - SENSOR_STATE_MAX = SENSOR_STATE_ERROR - } SensorState; - -typedef /* [public] */ -enum __MIDL___MIDL_itf_windowssensorclassextension_0000_0000_0002 - { SENSOR_CONNECTION_TYPE_PC_INTEGRATED = 0, - SENSOR_CONNECTION_TYPE_PC_ATTACHED = ( SENSOR_CONNECTION_TYPE_PC_INTEGRATED + 1 ) , - SENSOR_CONNECTION_TYPE_PC_EXTERNAL = ( SENSOR_CONNECTION_TYPE_PC_ATTACHED + 1 ) - } SensorConnectionType; - -typedef -enum LOCATION_DESIRED_ACCURACY - { LOCATION_DESIRED_ACCURACY_DEFAULT = 0, - LOCATION_DESIRED_ACCURACY_HIGH = ( LOCATION_DESIRED_ACCURACY_DEFAULT + 1 ) - } LOCATION_DESIRED_ACCURACY; - - - -extern RPC_IF_HANDLE __MIDL_itf_windowssensorclassextension_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_windowssensorclassextension_0000_0000_v0_0_s_ifspec; - -#ifndef __ISensorDriver_INTERFACE_DEFINED__ -#define __ISensorDriver_INTERFACE_DEFINED__ - -/* interface ISensorDriver */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_ISensorDriver; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("D262B6BA-87CC-495D-B639-939EF853BD3B") - ISensorDriver : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE OnGetSupportedSensorObjects( - /* [out] */ __RPC__deref_out_opt IPortableDeviceValuesCollection **ppSensorObjectCollection) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnGetSupportedProperties( - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [out] */ __RPC__deref_out_opt IPortableDeviceKeyCollection **ppSupportedProperties) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnGetSupportedDataFields( - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [out] */ __RPC__deref_out_opt IPortableDeviceKeyCollection **ppSupportedDataFields) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnGetSupportedEvents( - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pulEventCount) GUID **ppSupportedEvents, - /* [out] */ __RPC__out ULONG *pulEventCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnGetProperties( - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [in] */ __RPC__in_opt IPortableDeviceKeyCollection *pProperties, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValues **ppPropertyValues) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnGetDataFields( - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [in] */ __RPC__in_opt IPortableDeviceKeyCollection *pDataFields, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValues **ppDataValues) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnSetProperties( - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [in] */ __RPC__in_opt IPortableDeviceValues *pPropertiesToSet, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValues **ppResults) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnClientConnect( - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnClientDisconnect( - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnClientSubscribeToEvents( - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnClientUnsubscribeFromEvents( - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnProcessWpdMessage( - /* [in] */ __RPC__in_opt IUnknown *pUnkPortableDeviceValuesParams, - /* [in] */ __RPC__in_opt IUnknown *pUnkPortableDeviceValuesResults) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISensorDriverVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISensorDriver * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISensorDriver * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISensorDriver * This); - - HRESULT ( STDMETHODCALLTYPE *OnGetSupportedSensorObjects )( - __RPC__in ISensorDriver * This, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValuesCollection **ppSensorObjectCollection); - - HRESULT ( STDMETHODCALLTYPE *OnGetSupportedProperties )( - __RPC__in ISensorDriver * This, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [out] */ __RPC__deref_out_opt IPortableDeviceKeyCollection **ppSupportedProperties); - - HRESULT ( STDMETHODCALLTYPE *OnGetSupportedDataFields )( - __RPC__in ISensorDriver * This, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [out] */ __RPC__deref_out_opt IPortableDeviceKeyCollection **ppSupportedDataFields); - - HRESULT ( STDMETHODCALLTYPE *OnGetSupportedEvents )( - __RPC__in ISensorDriver * This, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pulEventCount) GUID **ppSupportedEvents, - /* [out] */ __RPC__out ULONG *pulEventCount); - - HRESULT ( STDMETHODCALLTYPE *OnGetProperties )( - __RPC__in ISensorDriver * This, - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [in] */ __RPC__in_opt IPortableDeviceKeyCollection *pProperties, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValues **ppPropertyValues); - - HRESULT ( STDMETHODCALLTYPE *OnGetDataFields )( - __RPC__in ISensorDriver * This, - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [in] */ __RPC__in_opt IPortableDeviceKeyCollection *pDataFields, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValues **ppDataValues); - - HRESULT ( STDMETHODCALLTYPE *OnSetProperties )( - __RPC__in ISensorDriver * This, - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [in] */ __RPC__in_opt IPortableDeviceValues *pPropertiesToSet, - /* [out] */ __RPC__deref_out_opt IPortableDeviceValues **ppResults); - - HRESULT ( STDMETHODCALLTYPE *OnClientConnect )( - __RPC__in ISensorDriver * This, - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID); - - HRESULT ( STDMETHODCALLTYPE *OnClientDisconnect )( - __RPC__in ISensorDriver * This, - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID); - - HRESULT ( STDMETHODCALLTYPE *OnClientSubscribeToEvents )( - __RPC__in ISensorDriver * This, - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID); - - HRESULT ( STDMETHODCALLTYPE *OnClientUnsubscribeFromEvents )( - __RPC__in ISensorDriver * This, - /* [in] */ __RPC__in_opt IWDFFile *pClientFile, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID); - - HRESULT ( STDMETHODCALLTYPE *OnProcessWpdMessage )( - __RPC__in ISensorDriver * This, - /* [in] */ __RPC__in_opt IUnknown *pUnkPortableDeviceValuesParams, - /* [in] */ __RPC__in_opt IUnknown *pUnkPortableDeviceValuesResults); - - END_INTERFACE - } ISensorDriverVtbl; - - interface ISensorDriver - { - CONST_VTBL struct ISensorDriverVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISensorDriver_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISensorDriver_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISensorDriver_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISensorDriver_OnGetSupportedSensorObjects(This,ppSensorObjectCollection) \ - ( (This)->lpVtbl -> OnGetSupportedSensorObjects(This,ppSensorObjectCollection) ) - -#define ISensorDriver_OnGetSupportedProperties(This,pwszSensorID,ppSupportedProperties) \ - ( (This)->lpVtbl -> OnGetSupportedProperties(This,pwszSensorID,ppSupportedProperties) ) - -#define ISensorDriver_OnGetSupportedDataFields(This,pwszSensorID,ppSupportedDataFields) \ - ( (This)->lpVtbl -> OnGetSupportedDataFields(This,pwszSensorID,ppSupportedDataFields) ) - -#define ISensorDriver_OnGetSupportedEvents(This,pwszSensorID,ppSupportedEvents,pulEventCount) \ - ( (This)->lpVtbl -> OnGetSupportedEvents(This,pwszSensorID,ppSupportedEvents,pulEventCount) ) - -#define ISensorDriver_OnGetProperties(This,pClientFile,pwszSensorID,pProperties,ppPropertyValues) \ - ( (This)->lpVtbl -> OnGetProperties(This,pClientFile,pwszSensorID,pProperties,ppPropertyValues) ) - -#define ISensorDriver_OnGetDataFields(This,pClientFile,pwszSensorID,pDataFields,ppDataValues) \ - ( (This)->lpVtbl -> OnGetDataFields(This,pClientFile,pwszSensorID,pDataFields,ppDataValues) ) - -#define ISensorDriver_OnSetProperties(This,pClientFile,pwszSensorID,pPropertiesToSet,ppResults) \ - ( (This)->lpVtbl -> OnSetProperties(This,pClientFile,pwszSensorID,pPropertiesToSet,ppResults) ) - -#define ISensorDriver_OnClientConnect(This,pClientFile,pwszSensorID) \ - ( (This)->lpVtbl -> OnClientConnect(This,pClientFile,pwszSensorID) ) - -#define ISensorDriver_OnClientDisconnect(This,pClientFile,pwszSensorID) \ - ( (This)->lpVtbl -> OnClientDisconnect(This,pClientFile,pwszSensorID) ) - -#define ISensorDriver_OnClientSubscribeToEvents(This,pClientFile,pwszSensorID) \ - ( (This)->lpVtbl -> OnClientSubscribeToEvents(This,pClientFile,pwszSensorID) ) - -#define ISensorDriver_OnClientUnsubscribeFromEvents(This,pClientFile,pwszSensorID) \ - ( (This)->lpVtbl -> OnClientUnsubscribeFromEvents(This,pClientFile,pwszSensorID) ) - -#define ISensorDriver_OnProcessWpdMessage(This,pUnkPortableDeviceValuesParams,pUnkPortableDeviceValuesResults) \ - ( (This)->lpVtbl -> OnProcessWpdMessage(This,pUnkPortableDeviceValuesParams,pUnkPortableDeviceValuesResults) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISensorDriver_INTERFACE_DEFINED__ */ - - -#ifndef __ISensorClassExtension_INTERFACE_DEFINED__ -#define __ISensorClassExtension_INTERFACE_DEFINED__ - -/* interface ISensorClassExtension */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_ISensorClassExtension; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("A31253BA-6F73-4BC9-ABAA-26C8833C58FF") - ISensorClassExtension : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Initialize( - /* [in] */ __RPC__in_opt IUnknown *pWdfDeviceUnknown, - /* [in] */ __RPC__in_opt IUnknown *pSensorDriverUnknown) = 0; - - virtual HRESULT STDMETHODCALLTYPE Uninitialize( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE ProcessIoControl( - /* [in] */ __RPC__in_opt IWDFIoRequest *pRequest) = 0; - - virtual HRESULT STDMETHODCALLTYPE PostEvent( - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [in] */ __RPC__in_opt IPortableDeviceValuesCollection *pEventCollection) = 0; - - virtual HRESULT STDMETHODCALLTYPE PostStateChange( - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [in] */ SensorState state) = 0; - - virtual HRESULT STDMETHODCALLTYPE CleanupFile( - /* [in] */ __RPC__in_opt IWDFFile *pWdfFile) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISensorClassExtensionVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISensorClassExtension * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISensorClassExtension * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISensorClassExtension * This); - - HRESULT ( STDMETHODCALLTYPE *Initialize )( - __RPC__in ISensorClassExtension * This, - /* [in] */ __RPC__in_opt IUnknown *pWdfDeviceUnknown, - /* [in] */ __RPC__in_opt IUnknown *pSensorDriverUnknown); - - HRESULT ( STDMETHODCALLTYPE *Uninitialize )( - __RPC__in ISensorClassExtension * This); - - HRESULT ( STDMETHODCALLTYPE *ProcessIoControl )( - __RPC__in ISensorClassExtension * This, - /* [in] */ __RPC__in_opt IWDFIoRequest *pRequest); - - HRESULT ( STDMETHODCALLTYPE *PostEvent )( - __RPC__in ISensorClassExtension * This, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [in] */ __RPC__in_opt IPortableDeviceValuesCollection *pEventCollection); - - HRESULT ( STDMETHODCALLTYPE *PostStateChange )( - __RPC__in ISensorClassExtension * This, - /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID, - /* [in] */ SensorState state); - - HRESULT ( STDMETHODCALLTYPE *CleanupFile )( - __RPC__in ISensorClassExtension * This, - /* [in] */ __RPC__in_opt IWDFFile *pWdfFile); - - END_INTERFACE - } ISensorClassExtensionVtbl; - - interface ISensorClassExtension - { - CONST_VTBL struct ISensorClassExtensionVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISensorClassExtension_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISensorClassExtension_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISensorClassExtension_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISensorClassExtension_Initialize(This,pWdfDeviceUnknown,pSensorDriverUnknown) \ - ( (This)->lpVtbl -> Initialize(This,pWdfDeviceUnknown,pSensorDriverUnknown) ) - -#define ISensorClassExtension_Uninitialize(This) \ - ( (This)->lpVtbl -> Uninitialize(This) ) - -#define ISensorClassExtension_ProcessIoControl(This,pRequest) \ - ( (This)->lpVtbl -> ProcessIoControl(This,pRequest) ) - -#define ISensorClassExtension_PostEvent(This,pwszSensorID,pEventCollection) \ - ( (This)->lpVtbl -> PostEvent(This,pwszSensorID,pEventCollection) ) - -#define ISensorClassExtension_PostStateChange(This,pwszSensorID,state) \ - ( (This)->lpVtbl -> PostStateChange(This,pwszSensorID,state) ) - -#define ISensorClassExtension_CleanupFile(This,pWdfFile) \ - ( (This)->lpVtbl -> CleanupFile(This,pWdfFile) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISensorClassExtension_INTERFACE_DEFINED__ */ - - - -#ifndef __WindowsSensorClassExtensionLibrary_LIBRARY_DEFINED__ -#define __WindowsSensorClassExtensionLibrary_LIBRARY_DEFINED__ - -/* library WindowsSensorClassExtensionLibrary */ -/* [helpstring][version][uuid] */ - - -EXTERN_C const IID LIBID_WindowsSensorClassExtensionLibrary; - -EXTERN_C const CLSID CLSID_SensorClassExtension; - -#ifdef __cplusplus - -class DECLSPEC_UUID("6101F767-998E-452B-B54A-E836DD486BAD") -SensorClassExtension; -#endif -#endif /* __WindowsSensorClassExtensionLibrary_LIBRARY_DEFINED__ */ - -/* interface __MIDL_itf_windowssensorclassextension_0000_0002 */ -/* [local] */ - -#endif // (_WIN32_WINNT >= 0x0600) - - -extern RPC_IF_HANDLE __MIDL_itf_windowssensorclassextension_0000_0002_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_windowssensorclassextension_0000_0002_v0_0_s_ifspec; - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/sffdisk.h b/pub/ddk/sffdisk.h deleted file mode 100644 index 5239670..0000000 --- a/pub/ddk/sffdisk.h +++ /dev/null @@ -1,202 +0,0 @@ -/*++ - -Copyright (c) 1993-2003 Microsoft Corporation - -Module Name: - - sffdisk.h - -Abstract: - - This header file defines constants and types for accessing functionality - specific to SFF (Small Form Factor) storage devices. - - ---*/ - -#ifndef _SFFDISK_H_ -#define _SFFDISK_H_ - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4200) // array[0] is not a warning for this file - - -// -// IOCTL codes. -// - -#define IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL \ - CTL_CODE( FILE_DEVICE_DISK, 0x7a0, METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define IOCTL_SFFDISK_DEVICE_COMMAND \ - CTL_CODE( FILE_DEVICE_DISK, 0x7a1, METHOD_BUFFERED, FILE_WRITE_ACCESS) - -#define IOCTL_SFFDISK_DEVICE_PASSWORD \ - CTL_CODE( FILE_DEVICE_DISK, 0x7a2, METHOD_BUFFERED, FILE_WRITE_ACCESS) - -// -// Protocol GUIDs that are returned in SFFDISK_QUERY_DEVICE_PROTOCOL_DATA structure -// -#define GUID_SFF_PROTOCOL_SD { 0xAD7536A8, 0xD055, 0x4c40, { 0xAA, 0x4D, 0x96, 0x31, 0x2D, 0xDB, 0x6B, 0x38 } } - -#define GUID_SFF_PROTOCOL_MMC { 0x77274D3F, 0x2365, 0x4491, { 0xA0, 0x30, 0x8B, 0xB4, 0x4A, 0xE6, 0x00, 0x97 } } - -// -// Structures -// - - -// -// Structure used in IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL -// - -typedef struct _SFFDISK_QUERY_DEVICE_PROTOCOL_DATA { - // - // size of this structure in bytes to be filled in by the caller - // - USHORT Size; - USHORT Reserved; - - // - // This GUID is returned by the protocol which uniquely identifies it. - // - - GUID ProtocolGUID; - -} SFFDISK_QUERY_DEVICE_PROTOCOL_DATA, *PSFFDISK_QUERY_DEVICE_PROTOCOL_DATA; - - -// -// Structure used in IOCTL_SFFDISK_DEVICE_COMMAND -// The layout of the buffer passed to this IOCTL is as follows: -// -// +-----------------------------+ -// | header (this structure) | -// +-----------------------------+ -// | protocol arguments | -// +-----------------------------+ -// | device data buffer | -// +-----------------------------+ -// -// The actual layout of the protocol arguments depends on the protocol of -// the target device. So as an example, if the target device an SD (Secure Digital) -// storage device, then the protocol arguments would consist of an SDCMD_DESCRIPTOR, -// which is defined in SDDEF.H. The SD argument for the command should be stored -// in the "Information" field of this structure. In that case, ProtocolArgumentSize -// would be sizeof(SDCMD_DESCRIPTOR). -// -// The three size fields in the structure (HeaderSize, ProtocolArgumentSize, -// DeviceDataBufferSize) each hold the length in bytes of each respective area as -// described by the diagram above. Thus, the entire length of the buffer must be -// at least as large as the sum of these three fields. -// - - -typedef enum { - SFFDISK_DC_GET_VERSION = 0, - SFFDISK_DC_LOCK_CHANNEL, - SFFDISK_DC_UNLOCK_CHANNEL, - SFFDISK_DC_DEVICE_COMMAND, -} SFFDISK_DCMD; - - -typedef struct _SFFDISK_DEVICE_COMMAND_DATA { - - // - // size of this structure in bytes to be filled in by the caller. - // This size does not include any data concatenated at the end. - // - USHORT HeaderSize; - - USHORT Reserved; - - // - // command defines the type of operation - // - - SFFDISK_DCMD Command; - - // - // ProtocolArgumentSize is the length in bytes of the device command - // arguments specific to the protocol of the device. This data is appended - // to the structure after the field member "Data". - // - USHORT ProtocolArgumentSize; - - // - // DeviceDataBufferSize defines the length of data being sent to, or received - // from the device. - // - - ULONG DeviceDataBufferSize; - - // - // Information is a parameter or return value for the operation - // - - ULONG_PTR Information; - - // - // Beginning of data. - // - - UCHAR Data[0]; - -} SFFDISK_DEVICE_COMMAND_DATA, *PSFFDISK_DEVICE_COMMAND_DATA; - - - - -// -// Structure used in IOCTL_SFFDISK_DEVICE_PASSWORD -// - -typedef enum { - SFFDISK_DP_IS_SUPPORTED = 0, - SFFDISK_DP_SET_PASSWORD, - SFFDISK_DP_LOCK_DEVICE, - SFFDISK_DP_UNLOCK_DEVICE, - SFFDISK_DP_RESET_DEVICE_ALL_DATA -} SFFDISK_DPCMD; - -typedef struct _SFFDISK_DEVICE_PASSWORD_DATA { - // - // size of this structure in bytes to be filled in by the caller - // - USHORT Size; - USHORT Reserved; - - // - // command defines the type of operation - // - - SFFDISK_DPCMD Command; - - // - // Information is a parameter or return value for the operation - // - - ULONG_PTR Information; - - // - // Password length and data supplied depend on the operation - // - - UCHAR PasswordLength; - UCHAR NewPasswordLength; - UCHAR Data[0]; - -} SFFDISK_DEVICE_PASSWORD_DATA, *PSFFDISK_DEVICE_PASSWORD_DATA; - - - -#if _MSC_VER >= 1200 -#pragma warning(pop) // un-sets any local warning changes -#endif -#pragma warning(default:4200) // array[0] is not a warning for this file - - -#endif // _SFFDISK_H_ - diff --git a/pub/ddk/sffprtcl.h b/pub/ddk/sffprtcl.h deleted file mode 100644 index 3a3a2d0..0000000 --- a/pub/ddk/sffprtcl.h +++ /dev/null @@ -1,144 +0,0 @@ -/*++ - -Copyright (c) 1991 - 1993 Microsoft Corporation - -Module Name: - - sffprtcl.h - -Abstract: - - Definition for Small Form Factor disk (SFFDISK) protocol layer interface - - -Notes: - - ---*/ - -#ifndef _SFFPRTCL_H_ -#define _SFFPRTCL_H_ - - -DEFINE_GUID(GUID_SFF_PROTOCOL_INTERFACE_STANDARD, 0xc7ec8da0L, 0xdbe3, 0x43fd, 0xa9, 0xeb, 0x7e, 0x4c, 0x70, 0x7c, 0x35, 0xac); - -#define SFF_PROTOCOL_INTERFACE_VERSION 0x0102 - -// -// Property types used in SFFPROT_Get/Set_Property -// - -typedef enum { - SFFP_PROP_MEDIA_CAPACITY, - SFFP_PROP_PARTITION_SIZE, - SFFP_PROP_WRITE_PROTECTED, - SFFP_PROP_MEDIA_STATE, - SFFP_PROP_MEDIA_CHANGECOUNT, - SFFP_PROP_MEDIA_ID, - SFFP_PROP_PROTOCOL_GUID, - SFFP_PROP_VERIFY_STATE, - SFFP_PROP_PARTITION_START_OFFSET -} SFFPROT_PROPERTY; - -// -// Media states defined for SFFP_PROP_MEDIA_STATE -// - -typedef enum { - SFFMS_NO_MEDIA = 0, - SFFMS_MEDIA_PRESENT -} SFFPROT_MEDIA_STATE; - -// -// Media states defined for SFFP_PROP_MEDIA_STATE -// - -typedef enum { - SFFVS_VERIFY_REQUIRED = 0, // the bus interface layer has noticed the media changed - SFFVS_VERIFY_ACKNOWLEDGED // the file system has started the verify -} SFFPROT_VERIFY_STATE; - -// -// types used in DeviceControl -// - -typedef enum { - SFFDC_DEVICE_COMMAND, - SFFDC_DEVICE_PASSWORD -} SFFPROT_DCTYPE; - -// -// Prototypes for the get/set property calls -// - -typedef -NTSTATUS -(*PSFFPROT_GET_PROPERTY)( - IN PVOID Context, - IN SFFPROT_PROPERTY Property, - IN ULONG BufferLength, - OUT PVOID PropertyBuffer, - OUT PULONG ResultLength - ); - -typedef -NTSTATUS -(*PSFFPROT_SET_PROPERTY)( - IN PVOID Context, - IN SFFPROT_PROPERTY Property, - IN ULONG BufferLength, - IN PVOID PropertyBuffer - ); - -typedef -NTSTATUS -(*PSFFPROT_DEVICE_CONTROL)( - IN PVOID Context, - IN SFFPROT_DCTYPE Type, - IN PVOID Buffer, - IN ULONG Length, - OUT PULONG LengthReturned - ); - -typedef -NTSTATUS -(*PSFFPROT_READ)( - IN PVOID Context, - IN PMDL Mdl, - IN ULONGLONG Offset, - IN ULONG Length, - OUT PULONG LengthReturned - ); - -typedef -NTSTATUS -(*PSFFPROT_WRITE)( - IN PVOID Context, - IN PMDL Mdl, - IN ULONGLONG Offset, - IN ULONG Length, - OUT PULONG LengthReturned - ); - -// -// This typedef defines the interface structure to be returned by -// the pnp QUERY_INTERFACE call. -// - - -typedef struct _SFF_PROTOCOL_INTERFACE_STANDARD { - USHORT Size; - USHORT Version; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - PVOID Context; - PSFFPROT_GET_PROPERTY GetProperty; - PSFFPROT_SET_PROPERTY SetProperty; - PSFFPROT_READ Read; - PSFFPROT_WRITE Write; - PSFFPROT_DEVICE_CONTROL DeviceControl; -} SFF_PROTOCOL_INTERFACE_STANDARD, *PSFF_PROTOCOL_INTERFACE_STANDARD; - - -#endif // _SFFPRTCL_H_ - diff --git a/pub/ddk/softehciif.h b/pub/ddk/softehciif.h deleted file mode 100644 index 01985a8..0000000 --- a/pub/ddk/softehciif.h +++ /dev/null @@ -1,972 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for softehciif.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - - -#ifndef __softehciif_h__ -#define __softehciif_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __ISoftEHCI_FWD_DEFINED__ -#define __ISoftEHCI_FWD_DEFINED__ -typedef interface ISoftEHCI ISoftEHCI; -#endif /* __ISoftEHCI_FWD_DEFINED__ */ - - -#ifndef __SoftEHCI_FWD_DEFINED__ -#define __SoftEHCI_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftEHCI SoftEHCI; -#else -typedef struct SoftEHCI SoftEHCI; -#endif /* __cplusplus */ - -#endif /* __SoftEHCI_FWD_DEFINED__ */ - - -#ifndef __ISoftEHCICtrlr_FWD_DEFINED__ -#define __ISoftEHCICtrlr_FWD_DEFINED__ -typedef interface ISoftEHCICtrlr ISoftEHCICtrlr; -#endif /* __ISoftEHCICtrlr_FWD_DEFINED__ */ - - -#ifndef __SoftEHCICtrlr_FWD_DEFINED__ -#define __SoftEHCICtrlr_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftEHCICtrlr SoftEHCICtrlr; -#else -typedef struct SoftEHCICtrlr SoftEHCICtrlr; -#endif /* __cplusplus */ - -#endif /* __SoftEHCICtrlr_FWD_DEFINED__ */ - - -#ifndef __ISoftEHCIRootHubPorts_FWD_DEFINED__ -#define __ISoftEHCIRootHubPorts_FWD_DEFINED__ -typedef interface ISoftEHCIRootHubPorts ISoftEHCIRootHubPorts; -#endif /* __ISoftEHCIRootHubPorts_FWD_DEFINED__ */ - - -#ifndef __SoftEHCIRootHubPorts_FWD_DEFINED__ -#define __SoftEHCIRootHubPorts_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftEHCIRootHubPorts SoftEHCIRootHubPorts; -#else -typedef struct SoftEHCIRootHubPorts SoftEHCIRootHubPorts; -#endif /* __cplusplus */ - -#endif /* __SoftEHCIRootHubPorts_FWD_DEFINED__ */ - - -#ifndef __ISoftEHCIRootHubPort_FWD_DEFINED__ -#define __ISoftEHCIRootHubPort_FWD_DEFINED__ -typedef interface ISoftEHCIRootHubPort ISoftEHCIRootHubPort; -#endif /* __ISoftEHCIRootHubPort_FWD_DEFINED__ */ - - -#ifndef __SoftEHCIRootHubPort_FWD_DEFINED__ -#define __SoftEHCIRootHubPort_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftEHCIRootHubPort SoftEHCIRootHubPort; -#else -typedef struct SoftEHCIRootHubPort SoftEHCIRootHubPort; -#endif /* __cplusplus */ - -#endif /* __SoftEHCIRootHubPort_FWD_DEFINED__ */ - - -#ifdef __cplusplus -extern "C"{ -#endif - - - -#ifndef __SoftEHCI_LIBRARY_DEFINED__ -#define __SoftEHCI_LIBRARY_DEFINED__ - -/* library SoftEHCI */ -/* [helpstringcontext][helpcontext][helpstring][version][lcid][uuid] */ - - - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("01647E9C-2B10-4620-BE92-758093F3C31A") -enum EHCIRootHubIndicator - { EHCIRootHubOff = 0, - EHCIRootHubAmber = 1, - EHCIRootHubGreen = 2, - EHCIRootHubUndefined = 3 - } EHCIRootHubIndicator; - - -EXTERN_C const IID LIBID_SoftEHCI; - -#ifndef __ISoftEHCI_INTERFACE_DEFINED__ -#define __ISoftEHCI_INTERFACE_DEFINED__ - -/* interface ISoftEHCI */ -/* [object][helpstring][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftEHCI; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E99BC1D0-088B-4bd2-AE94-6DA3F2861FA2") - ISoftEHCI : public IDispatch - { - public: - }; - -#else /* C style interface */ - - typedef struct ISoftEHCIVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftEHCI * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftEHCI * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftEHCI * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftEHCI * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftEHCI * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftEHCI * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftEHCI * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - END_INTERFACE - } ISoftEHCIVtbl; - - interface ISoftEHCI - { - CONST_VTBL struct ISoftEHCIVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftEHCI_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftEHCI_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftEHCI_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftEHCI_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftEHCI_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftEHCI_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftEHCI_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftEHCI_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_SoftEHCI; - -#ifdef __cplusplus - -class DECLSPEC_UUID("3676BB7A-1618-4bfc-855C-63C92FD54ACD") -SoftEHCI; -#endif - -#ifndef __ISoftEHCICtrlr_INTERFACE_DEFINED__ -#define __ISoftEHCICtrlr_INTERFACE_DEFINED__ - -/* interface ISoftEHCICtrlr */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftEHCICtrlr; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("16017C34-A2BA-480B-8DE8-CD08756AD1F8") - ISoftEHCICtrlr : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Ports( - /* [retval][out] */ __RPC__deref_out_opt SoftEHCIRootHubPorts **ppPorts) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftEHCICtrlrVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftEHCICtrlr * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftEHCICtrlr * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftEHCICtrlr * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftEHCICtrlr * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftEHCICtrlr * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftEHCICtrlr * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftEHCICtrlr * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Ports )( - __RPC__in ISoftEHCICtrlr * This, - /* [retval][out] */ __RPC__deref_out_opt SoftEHCIRootHubPorts **ppPorts); - - END_INTERFACE - } ISoftEHCICtrlrVtbl; - - interface ISoftEHCICtrlr - { - CONST_VTBL struct ISoftEHCICtrlrVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftEHCICtrlr_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftEHCICtrlr_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftEHCICtrlr_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftEHCICtrlr_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftEHCICtrlr_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftEHCICtrlr_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftEHCICtrlr_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftEHCICtrlr_get_Ports(This,ppPorts) \ - ( (This)->lpVtbl -> get_Ports(This,ppPorts) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftEHCICtrlr_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_SoftEHCICtrlr; - -#ifdef __cplusplus - -class DECLSPEC_UUID("C2B7819E-632F-4ADD-A450-62E6F324DC70") -SoftEHCICtrlr; -#endif - -#ifndef __ISoftEHCIRootHubPorts_INTERFACE_DEFINED__ -#define __ISoftEHCIRootHubPorts_INTERFACE_DEFINED__ - -/* interface ISoftEHCIRootHubPorts */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftEHCIRootHubPorts; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("8202B252-20C9-47A1-9448-B8621D985CA1") - ISoftEHCIRootHubPorts : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Count( - /* [retval][out] */ __RPC__out long *plCount) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Item( - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt SoftEHCIRootHubPort **ppSoftEHCIRootHubPort) = 0; - - virtual /* [hidden][propget][id] */ HRESULT __stdcall get__NewEnum( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftEHCIRootHubPortsVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftEHCIRootHubPorts * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftEHCIRootHubPorts * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftEHCIRootHubPorts * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftEHCIRootHubPorts * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftEHCIRootHubPorts * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftEHCIRootHubPorts * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftEHCIRootHubPorts * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Count )( - __RPC__in ISoftEHCIRootHubPorts * This, - /* [retval][out] */ __RPC__out long *plCount); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Item )( - __RPC__in ISoftEHCIRootHubPorts * This, - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt SoftEHCIRootHubPort **ppSoftEHCIRootHubPort); - - /* [hidden][propget][id] */ HRESULT ( __stdcall *get__NewEnum )( - __RPC__in ISoftEHCIRootHubPorts * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum); - - END_INTERFACE - } ISoftEHCIRootHubPortsVtbl; - - interface ISoftEHCIRootHubPorts - { - CONST_VTBL struct ISoftEHCIRootHubPortsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftEHCIRootHubPorts_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftEHCIRootHubPorts_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftEHCIRootHubPorts_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftEHCIRootHubPorts_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftEHCIRootHubPorts_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftEHCIRootHubPorts_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftEHCIRootHubPorts_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftEHCIRootHubPorts_get_Count(This,plCount) \ - ( (This)->lpVtbl -> get_Count(This,plCount) ) - -#define ISoftEHCIRootHubPorts_get_Item(This,Index,ppSoftEHCIRootHubPort) \ - ( (This)->lpVtbl -> get_Item(This,Index,ppSoftEHCIRootHubPort) ) - -#define ISoftEHCIRootHubPorts_get__NewEnum(This,ppunkEnum) \ - ( (This)->lpVtbl -> get__NewEnum(This,ppunkEnum) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftEHCIRootHubPorts_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_SoftEHCIRootHubPorts; - -#ifdef __cplusplus - -class DECLSPEC_UUID("00DC66FB-A2E1-4BF9-9E6C-C3A1A60130EC") -SoftEHCIRootHubPorts; -#endif - -#ifndef __ISoftEHCIRootHubPort_INTERFACE_DEFINED__ -#define __ISoftEHCIRootHubPort_INTERFACE_DEFINED__ - -/* interface ISoftEHCIRootHubPort */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftEHCIRootHubPort; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9A80EBED-8173-4417-9830-405EF2F0167A") - ISoftEHCIRootHubPort : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_WakeOnOverCurrentEnable( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWake) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_WakeOnDisconnectEnable( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWake) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_WakeOnConnectEnable( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWake) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_TestCtrl( - /* [retval][out] */ __RPC__out BYTE *pbTestCtrl) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Indicator( - /* [retval][out] */ __RPC__out EHCIRootHubIndicator *pIndicator) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Owner( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOwner) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Power( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarPower) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Power( - /* [in] */ VARIANT_BOOL fvarPower) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_LineStatus( - /* [retval][out] */ __RPC__out BYTE *pbLineStatus) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_LineStatus( - /* [in] */ BYTE bLineStatus) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Reset( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarReset) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Suspend( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarSuspend) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Suspend( - /* [in] */ VARIANT_BOOL fvarSuspend) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_ForcePortResume( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarForcePortResume) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_ForcePortResume( - /* [in] */ VARIANT_BOOL fvarForcePortResume) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_OverCurrentChange( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOverCurrentChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_OverCurrentChange( - /* [in] */ VARIANT_BOOL fvarOverCurrentChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_OverCurrent( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOverCurrent) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_OverCurrent( - /* [in] */ VARIANT_BOOL fvarOverCurrent) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_EnableChange( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEnableChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_EnableChange( - /* [in] */ VARIANT_BOOL fvarEnableChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Enabled( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEnabled) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Enabled( - /* [in] */ VARIANT_BOOL fvarEnabled) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_ConnectStatusChange( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarConnectStatusChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_ConnectStatusChange( - /* [in] */ VARIANT_BOOL fvarConnectStatusChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_CurrentConnectStatus( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarStatus) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Status( - /* [retval][out] */ __RPC__out long *plStatus) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Device( - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFDevice **ppDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall HotPlug( - /* [in] */ __RPC__in /* external definition not present */ DSFDevice *pDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Unplug( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftEHCIRootHubPortVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftEHCIRootHubPort * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftEHCIRootHubPort * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftEHCIRootHubPort * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_WakeOnOverCurrentEnable )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWake); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_WakeOnDisconnectEnable )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWake); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_WakeOnConnectEnable )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarWake); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_TestCtrl )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out BYTE *pbTestCtrl); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Indicator )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out EHCIRootHubIndicator *pIndicator); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Owner )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOwner); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Power )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarPower); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Power )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ VARIANT_BOOL fvarPower); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_LineStatus )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out BYTE *pbLineStatus); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_LineStatus )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ BYTE bLineStatus); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Reset )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarReset); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Suspend )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarSuspend); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Suspend )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ VARIANT_BOOL fvarSuspend); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_ForcePortResume )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarForcePortResume); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_ForcePortResume )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ VARIANT_BOOL fvarForcePortResume); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_OverCurrentChange )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOverCurrentChange); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_OverCurrentChange )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ VARIANT_BOOL fvarOverCurrentChange); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_OverCurrent )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOverCurrent); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_OverCurrent )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ VARIANT_BOOL fvarOverCurrent); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_EnableChange )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEnableChange); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_EnableChange )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ VARIANT_BOOL fvarEnableChange); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Enabled )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEnabled); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Enabled )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ VARIANT_BOOL fvarEnabled); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_ConnectStatusChange )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarConnectStatusChange); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_ConnectStatusChange )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ VARIANT_BOOL fvarConnectStatusChange); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_CurrentConnectStatus )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarStatus); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Status )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__out long *plStatus); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Device )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFDevice **ppDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *HotPlug )( - __RPC__in ISoftEHCIRootHubPort * This, - /* [in] */ __RPC__in /* external definition not present */ DSFDevice *pDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Unplug )( - __RPC__in ISoftEHCIRootHubPort * This); - - END_INTERFACE - } ISoftEHCIRootHubPortVtbl; - - interface ISoftEHCIRootHubPort - { - CONST_VTBL struct ISoftEHCIRootHubPortVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftEHCIRootHubPort_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftEHCIRootHubPort_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftEHCIRootHubPort_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftEHCIRootHubPort_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftEHCIRootHubPort_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftEHCIRootHubPort_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftEHCIRootHubPort_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftEHCIRootHubPort_get_WakeOnOverCurrentEnable(This,pfvarWake) \ - ( (This)->lpVtbl -> get_WakeOnOverCurrentEnable(This,pfvarWake) ) - -#define ISoftEHCIRootHubPort_get_WakeOnDisconnectEnable(This,pfvarWake) \ - ( (This)->lpVtbl -> get_WakeOnDisconnectEnable(This,pfvarWake) ) - -#define ISoftEHCIRootHubPort_get_WakeOnConnectEnable(This,pfvarWake) \ - ( (This)->lpVtbl -> get_WakeOnConnectEnable(This,pfvarWake) ) - -#define ISoftEHCIRootHubPort_get_TestCtrl(This,pbTestCtrl) \ - ( (This)->lpVtbl -> get_TestCtrl(This,pbTestCtrl) ) - -#define ISoftEHCIRootHubPort_get_Indicator(This,pIndicator) \ - ( (This)->lpVtbl -> get_Indicator(This,pIndicator) ) - -#define ISoftEHCIRootHubPort_get_Owner(This,pfvarOwner) \ - ( (This)->lpVtbl -> get_Owner(This,pfvarOwner) ) - -#define ISoftEHCIRootHubPort_get_Power(This,pfvarPower) \ - ( (This)->lpVtbl -> get_Power(This,pfvarPower) ) - -#define ISoftEHCIRootHubPort_put_Power(This,fvarPower) \ - ( (This)->lpVtbl -> put_Power(This,fvarPower) ) - -#define ISoftEHCIRootHubPort_get_LineStatus(This,pbLineStatus) \ - ( (This)->lpVtbl -> get_LineStatus(This,pbLineStatus) ) - -#define ISoftEHCIRootHubPort_put_LineStatus(This,bLineStatus) \ - ( (This)->lpVtbl -> put_LineStatus(This,bLineStatus) ) - -#define ISoftEHCIRootHubPort_get_Reset(This,pfvarReset) \ - ( (This)->lpVtbl -> get_Reset(This,pfvarReset) ) - -#define ISoftEHCIRootHubPort_get_Suspend(This,pfvarSuspend) \ - ( (This)->lpVtbl -> get_Suspend(This,pfvarSuspend) ) - -#define ISoftEHCIRootHubPort_put_Suspend(This,fvarSuspend) \ - ( (This)->lpVtbl -> put_Suspend(This,fvarSuspend) ) - -#define ISoftEHCIRootHubPort_get_ForcePortResume(This,pfvarForcePortResume) \ - ( (This)->lpVtbl -> get_ForcePortResume(This,pfvarForcePortResume) ) - -#define ISoftEHCIRootHubPort_put_ForcePortResume(This,fvarForcePortResume) \ - ( (This)->lpVtbl -> put_ForcePortResume(This,fvarForcePortResume) ) - -#define ISoftEHCIRootHubPort_get_OverCurrentChange(This,pfvarOverCurrentChange) \ - ( (This)->lpVtbl -> get_OverCurrentChange(This,pfvarOverCurrentChange) ) - -#define ISoftEHCIRootHubPort_put_OverCurrentChange(This,fvarOverCurrentChange) \ - ( (This)->lpVtbl -> put_OverCurrentChange(This,fvarOverCurrentChange) ) - -#define ISoftEHCIRootHubPort_get_OverCurrent(This,pfvarOverCurrent) \ - ( (This)->lpVtbl -> get_OverCurrent(This,pfvarOverCurrent) ) - -#define ISoftEHCIRootHubPort_put_OverCurrent(This,fvarOverCurrent) \ - ( (This)->lpVtbl -> put_OverCurrent(This,fvarOverCurrent) ) - -#define ISoftEHCIRootHubPort_get_EnableChange(This,pfvarEnableChange) \ - ( (This)->lpVtbl -> get_EnableChange(This,pfvarEnableChange) ) - -#define ISoftEHCIRootHubPort_put_EnableChange(This,fvarEnableChange) \ - ( (This)->lpVtbl -> put_EnableChange(This,fvarEnableChange) ) - -#define ISoftEHCIRootHubPort_get_Enabled(This,pfvarEnabled) \ - ( (This)->lpVtbl -> get_Enabled(This,pfvarEnabled) ) - -#define ISoftEHCIRootHubPort_put_Enabled(This,fvarEnabled) \ - ( (This)->lpVtbl -> put_Enabled(This,fvarEnabled) ) - -#define ISoftEHCIRootHubPort_get_ConnectStatusChange(This,pfvarConnectStatusChange) \ - ( (This)->lpVtbl -> get_ConnectStatusChange(This,pfvarConnectStatusChange) ) - -#define ISoftEHCIRootHubPort_put_ConnectStatusChange(This,fvarConnectStatusChange) \ - ( (This)->lpVtbl -> put_ConnectStatusChange(This,fvarConnectStatusChange) ) - -#define ISoftEHCIRootHubPort_get_CurrentConnectStatus(This,pfvarStatus) \ - ( (This)->lpVtbl -> get_CurrentConnectStatus(This,pfvarStatus) ) - -#define ISoftEHCIRootHubPort_get_Status(This,plStatus) \ - ( (This)->lpVtbl -> get_Status(This,plStatus) ) - -#define ISoftEHCIRootHubPort_get_Device(This,ppDSFDevice) \ - ( (This)->lpVtbl -> get_Device(This,ppDSFDevice) ) - -#define ISoftEHCIRootHubPort_HotPlug(This,pDSFDevice) \ - ( (This)->lpVtbl -> HotPlug(This,pDSFDevice) ) - -#define ISoftEHCIRootHubPort_Unplug(This) \ - ( (This)->lpVtbl -> Unplug(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftEHCIRootHubPort_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_SoftEHCIRootHubPort; - -#ifdef __cplusplus - -class DECLSPEC_UUID("6FD5902A-DC5A-4AB4-B9B0-B44D70930C9B") -SoftEHCIRootHubPort; -#endif -#endif /* __SoftEHCI_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/softhidusbif.h b/pub/ddk/softhidusbif.h deleted file mode 100644 index 39e5e54..0000000 --- a/pub/ddk/softhidusbif.h +++ /dev/null @@ -1,2246 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for softhidusbkif.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - - -#ifndef __softhidusbkif_h__ -#define __softhidusbkif_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __ISoftHIDProtocolXlator_FWD_DEFINED__ -#define __ISoftHIDProtocolXlator_FWD_DEFINED__ -typedef interface ISoftHIDProtocolXlator ISoftHIDProtocolXlator; -#endif /* __ISoftHIDProtocolXlator_FWD_DEFINED__ */ - - -#ifndef __ISoftHidUsbDevice_FWD_DEFINED__ -#define __ISoftHidUsbDevice_FWD_DEFINED__ -typedef interface ISoftHidUsbDevice ISoftHidUsbDevice; -#endif /* __ISoftHidUsbDevice_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBHidDescriptor_FWD_DEFINED__ -#define __ISoftUSBHidDescriptor_FWD_DEFINED__ -typedef interface ISoftUSBHidDescriptor ISoftUSBHidDescriptor; -#endif /* __ISoftUSBHidDescriptor_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBPhysicalDescriptorSet0_FWD_DEFINED__ -#define __ISoftUSBPhysicalDescriptorSet0_FWD_DEFINED__ -typedef interface ISoftUSBPhysicalDescriptorSet0 ISoftUSBPhysicalDescriptorSet0; -#endif /* __ISoftUSBPhysicalDescriptorSet0_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBPhysicalDescriptorSet_FWD_DEFINED__ -#define __ISoftUSBPhysicalDescriptorSet_FWD_DEFINED__ -typedef interface ISoftUSBPhysicalDescriptorSet ISoftUSBPhysicalDescriptorSet; -#endif /* __ISoftUSBPhysicalDescriptorSet_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBPhysicalDescriptorItem_FWD_DEFINED__ -#define __ISoftUSBPhysicalDescriptorItem_FWD_DEFINED__ -typedef interface ISoftUSBPhysicalDescriptorItem ISoftUSBPhysicalDescriptorItem; -#endif /* __ISoftUSBPhysicalDescriptorItem_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBPhysicalDescriptor_FWD_DEFINED__ -#define __ISoftUSBPhysicalDescriptor_FWD_DEFINED__ -typedef interface ISoftUSBPhysicalDescriptor ISoftUSBPhysicalDescriptor; -#endif /* __ISoftUSBPhysicalDescriptor_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBPhysicalDescriptorSetList_FWD_DEFINED__ -#define __ISoftUSBPhysicalDescriptorSetList_FWD_DEFINED__ -typedef interface ISoftUSBPhysicalDescriptorSetList ISoftUSBPhysicalDescriptorSetList; -#endif /* __ISoftUSBPhysicalDescriptorSetList_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBPhysicalDescriptorItemList_FWD_DEFINED__ -#define __ISoftUSBPhysicalDescriptorItemList_FWD_DEFINED__ -typedef interface ISoftUSBPhysicalDescriptorItemList ISoftUSBPhysicalDescriptorItemList; -#endif /* __ISoftUSBPhysicalDescriptorItemList_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBHidFaultInjection_FWD_DEFINED__ -#define __ISoftUSBHidFaultInjection_FWD_DEFINED__ -typedef interface ISoftUSBHidFaultInjection ISoftUSBHidFaultInjection; -#endif /* __ISoftUSBHidFaultInjection_FWD_DEFINED__ */ - - -#ifndef __SoftHIDProtocolXlator_FWD_DEFINED__ -#define __SoftHIDProtocolXlator_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftHIDProtocolXlator SoftHIDProtocolXlator; -#else -typedef struct SoftHIDProtocolXlator SoftHIDProtocolXlator; -#endif /* __cplusplus */ - -#endif /* __SoftHIDProtocolXlator_FWD_DEFINED__ */ - - -#ifndef __SoftHidUsbDevice_FWD_DEFINED__ -#define __SoftHidUsbDevice_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftHidUsbDevice SoftHidUsbDevice; -#else -typedef struct SoftHidUsbDevice SoftHidUsbDevice; -#endif /* __cplusplus */ - -#endif /* __SoftHidUsbDevice_FWD_DEFINED__ */ - - -#ifndef __SoftUSBHidDescriptor_FWD_DEFINED__ -#define __SoftUSBHidDescriptor_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBHidDescriptor SoftUSBHidDescriptor; -#else -typedef struct SoftUSBHidDescriptor SoftUSBHidDescriptor; -#endif /* __cplusplus */ - -#endif /* __SoftUSBHidDescriptor_FWD_DEFINED__ */ - - -#ifndef __SoftUSBPhysicalDescriptor_FWD_DEFINED__ -#define __SoftUSBPhysicalDescriptor_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBPhysicalDescriptor SoftUSBPhysicalDescriptor; -#else -typedef struct SoftUSBPhysicalDescriptor SoftUSBPhysicalDescriptor; -#endif /* __cplusplus */ - -#endif /* __SoftUSBPhysicalDescriptor_FWD_DEFINED__ */ - - -#ifndef __SoftUSBPhysicalDescriptorSet0_FWD_DEFINED__ -#define __SoftUSBPhysicalDescriptorSet0_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBPhysicalDescriptorSet0 SoftUSBPhysicalDescriptorSet0; -#else -typedef struct SoftUSBPhysicalDescriptorSet0 SoftUSBPhysicalDescriptorSet0; -#endif /* __cplusplus */ - -#endif /* __SoftUSBPhysicalDescriptorSet0_FWD_DEFINED__ */ - - -#ifndef __SoftUSBPhysicalDescriptorSet_FWD_DEFINED__ -#define __SoftUSBPhysicalDescriptorSet_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBPhysicalDescriptorSet SoftUSBPhysicalDescriptorSet; -#else -typedef struct SoftUSBPhysicalDescriptorSet SoftUSBPhysicalDescriptorSet; -#endif /* __cplusplus */ - -#endif /* __SoftUSBPhysicalDescriptorSet_FWD_DEFINED__ */ - - -#ifndef __SoftUSBPhysicalDescriptorItem_FWD_DEFINED__ -#define __SoftUSBPhysicalDescriptorItem_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBPhysicalDescriptorItem SoftUSBPhysicalDescriptorItem; -#else -typedef struct SoftUSBPhysicalDescriptorItem SoftUSBPhysicalDescriptorItem; -#endif /* __cplusplus */ - -#endif /* __SoftUSBPhysicalDescriptorItem_FWD_DEFINED__ */ - - -#ifndef __SoftUSBPhysicalDescriptorSetList_FWD_DEFINED__ -#define __SoftUSBPhysicalDescriptorSetList_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBPhysicalDescriptorSetList SoftUSBPhysicalDescriptorSetList; -#else -typedef struct SoftUSBPhysicalDescriptorSetList SoftUSBPhysicalDescriptorSetList; -#endif /* __cplusplus */ - -#endif /* __SoftUSBPhysicalDescriptorSetList_FWD_DEFINED__ */ - - -#ifndef __SoftUSBPhysicalDescriptorItemList_FWD_DEFINED__ -#define __SoftUSBPhysicalDescriptorItemList_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBPhysicalDescriptorItemList SoftUSBPhysicalDescriptorItemList; -#else -typedef struct SoftUSBPhysicalDescriptorItemList SoftUSBPhysicalDescriptorItemList; -#endif /* __cplusplus */ - -#endif /* __SoftUSBPhysicalDescriptorItemList_FWD_DEFINED__ */ - - -#ifndef __SoftUSBHidFaultInjection_FWD_DEFINED__ -#define __SoftUSBHidFaultInjection_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBHidFaultInjection SoftUSBHidFaultInjection; -#else -typedef struct SoftUSBHidFaultInjection SoftUSBHidFaultInjection; -#endif /* __cplusplus */ - -#endif /* __SoftUSBHidFaultInjection_FWD_DEFINED__ */ - - -#ifdef __cplusplus -extern "C"{ -#endif - - - -#ifndef __SOFTHIDUSBK_LIBRARY_DEFINED__ -#define __SOFTHIDUSBK_LIBRARY_DEFINED__ - -/* library SOFTHIDUSBK */ -/* [helpstringcontext][helpcontext][helpstring][helpstringdll][helpfile][version][lcid][uuid] */ - - - - - - - - - - - - - - - - - - - - - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("1E4B562C-9C5D-4506-8FFA-F87CC84CF588") -enum HID_DEVICETYPE - { DEVICE_TYPE_NONE = 0, - DEVICE_TYPE_KEYBOARD = 1, - DEVICE_TYPE_MOUSE = 2 - } HID_DEVICETYPE; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("4486D19F-E669-4C26-8F30-30584B071AF1") -enum HID_PHYSICAL_BIAS - { BIAS_NA = 0, - RIGHT_HAND = 1, - LEFT_HAND = 2, - BOTH_HANDS = 3, - EITHER_HAND = 4 - } HID_PHYSICAL_BIAS; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("5B428086-ACA1-4051-A41A-F4768BDFF6D6") -enum HID_PHYSICAL_DESIGNATOR - { NONE = 0, - HAND = 0x1, - EYEBALL = 0x2, - EYEBROW = 0x3, - EYELID = 0x4, - EAR = 0x5, - NOSE = 0x6, - MOUTH = 0x7, - UPPER_LIP = 0x8, - LOWER_LIP = 0x9, - JAW = 0xa, - NECK = 0xb, - UPPER_ARM = 0xc, - ELBOW = 0xd, - FOREARM = 0xe, - WRIST = 0xf, - PALM = 0x10, - THUMB = 0x11, - INDEX_FINGER = 0x12, - MIDDLE_FINGER = 0x13, - RING_FINGER = 0x14, - LITTLE_FINGER = 0x15, - HEAD = 0x16, - SHOULDER = 0x17, - HIP = 0x18, - WAIST = 0x19, - THIGH = 0x1a, - KNEE = 0x1b, - CALF = 0x1c, - ANKLE = 0x1d, - FOOT = 0x1e, - HEEL = 0x1f, - BALL_OF_FOOT = 0x20, - BIG_TOE = 0x21, - SECOND_TOE = 0x22, - THIRD_TOE = 0x23, - FOURTH_TOE = 0x24, - LITTLE_TOE = 0x25, - BROW = 0x26, - CHEEK = 0x27 - } HID_PHYSICAL_DESIGNATOR; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("4531738B-4AAC-48E2-9B8E-F97A98AA2967") -enum HID_PHYSICAL_QUALIFIER - { QUALIFIER_NA = 0, - RIGHT = 1, - LEFT = 2, - BOTH = 3, - EITHER = 4, - CENTER = 5 - } HID_PHYSICAL_QUALIFIER; - - -EXTERN_C const IID LIBID_SOFTHIDUSBK; - -#ifndef __ISoftHIDProtocolXlator_INTERFACE_DEFINED__ -#define __ISoftHIDProtocolXlator_INTERFACE_DEFINED__ - -/* interface ISoftHIDProtocolXlator */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftHIDProtocolXlator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("78C6932B-1B53-469F-9DE3-38114BE3B41E") - ISoftHIDProtocolXlator : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceType( - /* [retval][out] */ __RPC__out HID_DEVICETYPE *pDevType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceType( - /* [in] */ HID_DEVICETYPE DevType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DSFDevice( - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ IDSFDevice **ppiDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_HIDDescriptor( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBHidDescriptor **ppSoftUSBHIDDescriptor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_HIDDescriptor( - /* [in] */ __RPC__in_opt ISoftUSBHidDescriptor *pSoftUSBHIDDescriptor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT __stdcall putref_HIDDescriptor( - /* [in] */ __RPC__in_opt ISoftUSBHidDescriptor *pSoftUSBHIDDescriptor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall WriteReportDescriptor( - /* [in] */ __RPC__in SAFEARRAY * psaReportDescriptor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall ReadOutputReport( - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaOutputReport) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall WriteInputReport( - /* [in] */ __RPC__in SAFEARRAY * psaInputReport) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall WriteFeatureReport( - /* [in] */ __RPC__in SAFEARRAY * psaFeatureReport) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftHIDProtocolXlatorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftHIDProtocolXlator * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftHIDProtocolXlator * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftHIDProtocolXlator * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceType )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [retval][out] */ __RPC__out HID_DEVICETYPE *pDevType); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceType )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [in] */ HID_DEVICETYPE DevType); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DSFDevice )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ IDSFDevice **ppiDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_HIDDescriptor )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBHidDescriptor **ppSoftUSBHIDDescriptor); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_HIDDescriptor )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [in] */ __RPC__in_opt ISoftUSBHidDescriptor *pSoftUSBHIDDescriptor); - - /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT ( __stdcall *putref_HIDDescriptor )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [in] */ __RPC__in_opt ISoftUSBHidDescriptor *pSoftUSBHIDDescriptor); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *WriteReportDescriptor )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [in] */ __RPC__in SAFEARRAY * psaReportDescriptor); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *ReadOutputReport )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaOutputReport); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *WriteInputReport )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [in] */ __RPC__in SAFEARRAY * psaInputReport); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *WriteFeatureReport )( - __RPC__in ISoftHIDProtocolXlator * This, - /* [in] */ __RPC__in SAFEARRAY * psaFeatureReport); - - END_INTERFACE - } ISoftHIDProtocolXlatorVtbl; - - interface ISoftHIDProtocolXlator - { - CONST_VTBL struct ISoftHIDProtocolXlatorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftHIDProtocolXlator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftHIDProtocolXlator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftHIDProtocolXlator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftHIDProtocolXlator_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftHIDProtocolXlator_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftHIDProtocolXlator_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftHIDProtocolXlator_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftHIDProtocolXlator_get_DeviceType(This,pDevType) \ - ( (This)->lpVtbl -> get_DeviceType(This,pDevType) ) - -#define ISoftHIDProtocolXlator_put_DeviceType(This,DevType) \ - ( (This)->lpVtbl -> put_DeviceType(This,DevType) ) - -#define ISoftHIDProtocolXlator_get_DSFDevice(This,ppiDSFDevice) \ - ( (This)->lpVtbl -> get_DSFDevice(This,ppiDSFDevice) ) - -#define ISoftHIDProtocolXlator_get_HIDDescriptor(This,ppSoftUSBHIDDescriptor) \ - ( (This)->lpVtbl -> get_HIDDescriptor(This,ppSoftUSBHIDDescriptor) ) - -#define ISoftHIDProtocolXlator_put_HIDDescriptor(This,pSoftUSBHIDDescriptor) \ - ( (This)->lpVtbl -> put_HIDDescriptor(This,pSoftUSBHIDDescriptor) ) - -#define ISoftHIDProtocolXlator_putref_HIDDescriptor(This,pSoftUSBHIDDescriptor) \ - ( (This)->lpVtbl -> putref_HIDDescriptor(This,pSoftUSBHIDDescriptor) ) - -#define ISoftHIDProtocolXlator_WriteReportDescriptor(This,psaReportDescriptor) \ - ( (This)->lpVtbl -> WriteReportDescriptor(This,psaReportDescriptor) ) - -#define ISoftHIDProtocolXlator_ReadOutputReport(This,ppsaOutputReport) \ - ( (This)->lpVtbl -> ReadOutputReport(This,ppsaOutputReport) ) - -#define ISoftHIDProtocolXlator_WriteInputReport(This,psaInputReport) \ - ( (This)->lpVtbl -> WriteInputReport(This,psaInputReport) ) - -#define ISoftHIDProtocolXlator_WriteFeatureReport(This,psaFeatureReport) \ - ( (This)->lpVtbl -> WriteFeatureReport(This,psaFeatureReport) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftHIDProtocolXlator_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftHidUsbDevice_INTERFACE_DEFINED__ -#define __ISoftHidUsbDevice_INTERFACE_DEFINED__ - -/* interface ISoftHidUsbDevice */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftHidUsbDevice; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("45332C25-A9E0-457B-AA5D-897A36B92ACB") - ISoftHidUsbDevice : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_PhysicalDescriptor( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBPhysicalDescriptor **ppSoftUSBPhyDescriptor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_PhysicalDescriptor( - /* [in] */ __RPC__in_opt ISoftUSBPhysicalDescriptor *pSoftUSBPhyDescriptor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT __stdcall putref_PhysicalDescriptor( - /* [in] */ __RPC__in_opt ISoftUSBPhysicalDescriptor *pSoftUSBPhyDescriptor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_ReportDescriptor( - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaSoftUSBReportDescriptor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_ReportDescriptor( - /* [in] */ __RPC__in SAFEARRAY * psaSoftUSBReportDescriptor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall QueueInputReport( - /* [in] */ ULONG cbData, - /* [in] */ __RPC__in BYTE *pbData) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall DequeueOutputReport( - /* [out] */ __RPC__out ULONG *pcbData, - /* [out] */ __RPC__deref_out_opt BYTE **ppbData) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall QueueFeatureReport( - /* [in] */ ULONG cbData, - /* [in] */ __RPC__in BYTE *pbData) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftHidUsbDeviceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftHidUsbDevice * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftHidUsbDevice * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftHidUsbDevice * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftHidUsbDevice * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftHidUsbDevice * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftHidUsbDevice * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftHidUsbDevice * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_PhysicalDescriptor )( - __RPC__in ISoftHidUsbDevice * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBPhysicalDescriptor **ppSoftUSBPhyDescriptor); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_PhysicalDescriptor )( - __RPC__in ISoftHidUsbDevice * This, - /* [in] */ __RPC__in_opt ISoftUSBPhysicalDescriptor *pSoftUSBPhyDescriptor); - - /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT ( __stdcall *putref_PhysicalDescriptor )( - __RPC__in ISoftHidUsbDevice * This, - /* [in] */ __RPC__in_opt ISoftUSBPhysicalDescriptor *pSoftUSBPhyDescriptor); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_ReportDescriptor )( - __RPC__in ISoftHidUsbDevice * This, - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaSoftUSBReportDescriptor); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_ReportDescriptor )( - __RPC__in ISoftHidUsbDevice * This, - /* [in] */ __RPC__in SAFEARRAY * psaSoftUSBReportDescriptor); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *QueueInputReport )( - __RPC__in ISoftHidUsbDevice * This, - /* [in] */ ULONG cbData, - /* [in] */ __RPC__in BYTE *pbData); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *DequeueOutputReport )( - __RPC__in ISoftHidUsbDevice * This, - /* [out] */ __RPC__out ULONG *pcbData, - /* [out] */ __RPC__deref_out_opt BYTE **ppbData); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *QueueFeatureReport )( - __RPC__in ISoftHidUsbDevice * This, - /* [in] */ ULONG cbData, - /* [in] */ __RPC__in BYTE *pbData); - - END_INTERFACE - } ISoftHidUsbDeviceVtbl; - - interface ISoftHidUsbDevice - { - CONST_VTBL struct ISoftHidUsbDeviceVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftHidUsbDevice_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftHidUsbDevice_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftHidUsbDevice_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftHidUsbDevice_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftHidUsbDevice_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftHidUsbDevice_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftHidUsbDevice_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftHidUsbDevice_get_PhysicalDescriptor(This,ppSoftUSBPhyDescriptor) \ - ( (This)->lpVtbl -> get_PhysicalDescriptor(This,ppSoftUSBPhyDescriptor) ) - -#define ISoftHidUsbDevice_put_PhysicalDescriptor(This,pSoftUSBPhyDescriptor) \ - ( (This)->lpVtbl -> put_PhysicalDescriptor(This,pSoftUSBPhyDescriptor) ) - -#define ISoftHidUsbDevice_putref_PhysicalDescriptor(This,pSoftUSBPhyDescriptor) \ - ( (This)->lpVtbl -> putref_PhysicalDescriptor(This,pSoftUSBPhyDescriptor) ) - -#define ISoftHidUsbDevice_get_ReportDescriptor(This,ppsaSoftUSBReportDescriptor) \ - ( (This)->lpVtbl -> get_ReportDescriptor(This,ppsaSoftUSBReportDescriptor) ) - -#define ISoftHidUsbDevice_put_ReportDescriptor(This,psaSoftUSBReportDescriptor) \ - ( (This)->lpVtbl -> put_ReportDescriptor(This,psaSoftUSBReportDescriptor) ) - -#define ISoftHidUsbDevice_QueueInputReport(This,cbData,pbData) \ - ( (This)->lpVtbl -> QueueInputReport(This,cbData,pbData) ) - -#define ISoftHidUsbDevice_DequeueOutputReport(This,pcbData,ppbData) \ - ( (This)->lpVtbl -> DequeueOutputReport(This,pcbData,ppbData) ) - -#define ISoftHidUsbDevice_QueueFeatureReport(This,cbData,pbData) \ - ( (This)->lpVtbl -> QueueFeatureReport(This,cbData,pbData) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftHidUsbDevice_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBHidDescriptor_INTERFACE_DEFINED__ -#define __ISoftUSBHidDescriptor_INTERFACE_DEFINED__ - -/* interface ISoftUSBHidDescriptor */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBHidDescriptor; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("7E4BAE25-09D9-4DB8-8CEC-6D089D87F5EE") - ISoftUSBHidDescriptor : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Length( - /* [retval][out] */ __RPC__out BYTE *pbyLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DescriptorType( - /* [retval][out] */ __RPC__out BYTE *pbyDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_HID( - /* [retval][out] */ __RPC__out SHORT *psHID) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_HID( - /* [in] */ SHORT sHID) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_CountryCode( - /* [retval][out] */ __RPC__out BYTE *pbyCountryCode) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_CountryCode( - /* [in] */ BYTE byCountryCode) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_NumDescriptors( - /* [retval][out] */ __RPC__out BYTE *pbyNumDescriptors) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_NumDescriptors( - /* [in] */ BYTE byNumDescriptors) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_ClassDescriptorType( - /* [in] */ BYTE byIndex, - /* [retval][out] */ __RPC__out BYTE *pbyClassDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_ClassDescriptorType( - /* [in] */ BYTE byIndex, - /* [in] */ BYTE byClassDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DescriptorLength( - /* [in] */ BYTE byIndex, - /* [retval][out] */ __RPC__out SHORT *psDescriptorLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DescriptorLength( - /* [in] */ BYTE byIndex, - /* [in] */ SHORT sDescriptorLength) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBHidDescriptorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBHidDescriptor * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBHidDescriptor * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBHidDescriptor * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Length )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [retval][out] */ __RPC__out BYTE *pbyLength); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DescriptorType )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [retval][out] */ __RPC__out BYTE *pbyDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_HID )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [retval][out] */ __RPC__out SHORT *psHID); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_HID )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [in] */ SHORT sHID); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_CountryCode )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [retval][out] */ __RPC__out BYTE *pbyCountryCode); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_CountryCode )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [in] */ BYTE byCountryCode); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_NumDescriptors )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [retval][out] */ __RPC__out BYTE *pbyNumDescriptors); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_NumDescriptors )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [in] */ BYTE byNumDescriptors); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_ClassDescriptorType )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [in] */ BYTE byIndex, - /* [retval][out] */ __RPC__out BYTE *pbyClassDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_ClassDescriptorType )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [in] */ BYTE byIndex, - /* [in] */ BYTE byClassDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DescriptorLength )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [in] */ BYTE byIndex, - /* [retval][out] */ __RPC__out SHORT *psDescriptorLength); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DescriptorLength )( - __RPC__in ISoftUSBHidDescriptor * This, - /* [in] */ BYTE byIndex, - /* [in] */ SHORT sDescriptorLength); - - END_INTERFACE - } ISoftUSBHidDescriptorVtbl; - - interface ISoftUSBHidDescriptor - { - CONST_VTBL struct ISoftUSBHidDescriptorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBHidDescriptor_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBHidDescriptor_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBHidDescriptor_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBHidDescriptor_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBHidDescriptor_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBHidDescriptor_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBHidDescriptor_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBHidDescriptor_get_Length(This,pbyLength) \ - ( (This)->lpVtbl -> get_Length(This,pbyLength) ) - -#define ISoftUSBHidDescriptor_get_DescriptorType(This,pbyDescriptorType) \ - ( (This)->lpVtbl -> get_DescriptorType(This,pbyDescriptorType) ) - -#define ISoftUSBHidDescriptor_get_HID(This,psHID) \ - ( (This)->lpVtbl -> get_HID(This,psHID) ) - -#define ISoftUSBHidDescriptor_put_HID(This,sHID) \ - ( (This)->lpVtbl -> put_HID(This,sHID) ) - -#define ISoftUSBHidDescriptor_get_CountryCode(This,pbyCountryCode) \ - ( (This)->lpVtbl -> get_CountryCode(This,pbyCountryCode) ) - -#define ISoftUSBHidDescriptor_put_CountryCode(This,byCountryCode) \ - ( (This)->lpVtbl -> put_CountryCode(This,byCountryCode) ) - -#define ISoftUSBHidDescriptor_get_NumDescriptors(This,pbyNumDescriptors) \ - ( (This)->lpVtbl -> get_NumDescriptors(This,pbyNumDescriptors) ) - -#define ISoftUSBHidDescriptor_put_NumDescriptors(This,byNumDescriptors) \ - ( (This)->lpVtbl -> put_NumDescriptors(This,byNumDescriptors) ) - -#define ISoftUSBHidDescriptor_get_ClassDescriptorType(This,byIndex,pbyClassDescriptorType) \ - ( (This)->lpVtbl -> get_ClassDescriptorType(This,byIndex,pbyClassDescriptorType) ) - -#define ISoftUSBHidDescriptor_put_ClassDescriptorType(This,byIndex,byClassDescriptorType) \ - ( (This)->lpVtbl -> put_ClassDescriptorType(This,byIndex,byClassDescriptorType) ) - -#define ISoftUSBHidDescriptor_get_DescriptorLength(This,byIndex,psDescriptorLength) \ - ( (This)->lpVtbl -> get_DescriptorLength(This,byIndex,psDescriptorLength) ) - -#define ISoftUSBHidDescriptor_put_DescriptorLength(This,byIndex,sDescriptorLength) \ - ( (This)->lpVtbl -> put_DescriptorLength(This,byIndex,sDescriptorLength) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBHidDescriptor_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBPhysicalDescriptorSet0_INTERFACE_DEFINED__ -#define __ISoftUSBPhysicalDescriptorSet0_INTERFACE_DEFINED__ - -/* interface ISoftUSBPhysicalDescriptorSet0 */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBPhysicalDescriptorSet0; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("F9573761-15AA-46D1-9FE0-16254E001F4C") - ISoftUSBPhysicalDescriptorSet0 : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Number( - /* [retval][out] */ __RPC__out BYTE *pNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Number( - /* [in] */ BYTE Number) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Length( - /* [retval][out] */ __RPC__out BYTE *pLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Length( - /* [in] */ BYTE Length) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBPhysicalDescriptorSet0Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBPhysicalDescriptorSet0 * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBPhysicalDescriptorSet0 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBPhysicalDescriptorSet0 * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBPhysicalDescriptorSet0 * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBPhysicalDescriptorSet0 * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBPhysicalDescriptorSet0 * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBPhysicalDescriptorSet0 * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Number )( - __RPC__in ISoftUSBPhysicalDescriptorSet0 * This, - /* [retval][out] */ __RPC__out BYTE *pNumber); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Number )( - __RPC__in ISoftUSBPhysicalDescriptorSet0 * This, - /* [in] */ BYTE Number); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Length )( - __RPC__in ISoftUSBPhysicalDescriptorSet0 * This, - /* [retval][out] */ __RPC__out BYTE *pLength); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Length )( - __RPC__in ISoftUSBPhysicalDescriptorSet0 * This, - /* [in] */ BYTE Length); - - END_INTERFACE - } ISoftUSBPhysicalDescriptorSet0Vtbl; - - interface ISoftUSBPhysicalDescriptorSet0 - { - CONST_VTBL struct ISoftUSBPhysicalDescriptorSet0Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBPhysicalDescriptorSet0_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBPhysicalDescriptorSet0_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBPhysicalDescriptorSet0_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBPhysicalDescriptorSet0_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBPhysicalDescriptorSet0_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBPhysicalDescriptorSet0_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBPhysicalDescriptorSet0_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBPhysicalDescriptorSet0_get_Number(This,pNumber) \ - ( (This)->lpVtbl -> get_Number(This,pNumber) ) - -#define ISoftUSBPhysicalDescriptorSet0_put_Number(This,Number) \ - ( (This)->lpVtbl -> put_Number(This,Number) ) - -#define ISoftUSBPhysicalDescriptorSet0_get_Length(This,pLength) \ - ( (This)->lpVtbl -> get_Length(This,pLength) ) - -#define ISoftUSBPhysicalDescriptorSet0_put_Length(This,Length) \ - ( (This)->lpVtbl -> put_Length(This,Length) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBPhysicalDescriptorSet0_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBPhysicalDescriptorSet_INTERFACE_DEFINED__ -#define __ISoftUSBPhysicalDescriptorSet_INTERFACE_DEFINED__ - -/* interface ISoftUSBPhysicalDescriptorSet */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBPhysicalDescriptorSet; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1FB119F2-5613-4D6E-AE93-87584F8C4401") - ISoftUSBPhysicalDescriptorSet : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Bias( - /* [retval][out] */ __RPC__out HID_PHYSICAL_BIAS *pBias) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Bias( - /* [in] */ HID_PHYSICAL_BIAS Bias) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Preference( - /* [retval][out] */ __RPC__out BYTE *pPreference) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Preference( - /* [in] */ BYTE Preference) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Items( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBPhysicalDescriptorItemList **ppItems) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBPhysicalDescriptorSetVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBPhysicalDescriptorSet * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBPhysicalDescriptorSet * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBPhysicalDescriptorSet * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBPhysicalDescriptorSet * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBPhysicalDescriptorSet * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBPhysicalDescriptorSet * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBPhysicalDescriptorSet * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Bias )( - __RPC__in ISoftUSBPhysicalDescriptorSet * This, - /* [retval][out] */ __RPC__out HID_PHYSICAL_BIAS *pBias); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Bias )( - __RPC__in ISoftUSBPhysicalDescriptorSet * This, - /* [in] */ HID_PHYSICAL_BIAS Bias); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Preference )( - __RPC__in ISoftUSBPhysicalDescriptorSet * This, - /* [retval][out] */ __RPC__out BYTE *pPreference); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Preference )( - __RPC__in ISoftUSBPhysicalDescriptorSet * This, - /* [in] */ BYTE Preference); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Items )( - __RPC__in ISoftUSBPhysicalDescriptorSet * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBPhysicalDescriptorItemList **ppItems); - - END_INTERFACE - } ISoftUSBPhysicalDescriptorSetVtbl; - - interface ISoftUSBPhysicalDescriptorSet - { - CONST_VTBL struct ISoftUSBPhysicalDescriptorSetVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBPhysicalDescriptorSet_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBPhysicalDescriptorSet_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBPhysicalDescriptorSet_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBPhysicalDescriptorSet_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBPhysicalDescriptorSet_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBPhysicalDescriptorSet_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBPhysicalDescriptorSet_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBPhysicalDescriptorSet_get_Bias(This,pBias) \ - ( (This)->lpVtbl -> get_Bias(This,pBias) ) - -#define ISoftUSBPhysicalDescriptorSet_put_Bias(This,Bias) \ - ( (This)->lpVtbl -> put_Bias(This,Bias) ) - -#define ISoftUSBPhysicalDescriptorSet_get_Preference(This,pPreference) \ - ( (This)->lpVtbl -> get_Preference(This,pPreference) ) - -#define ISoftUSBPhysicalDescriptorSet_put_Preference(This,Preference) \ - ( (This)->lpVtbl -> put_Preference(This,Preference) ) - -#define ISoftUSBPhysicalDescriptorSet_get_Items(This,ppItems) \ - ( (This)->lpVtbl -> get_Items(This,ppItems) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBPhysicalDescriptorSet_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBPhysicalDescriptorItem_INTERFACE_DEFINED__ -#define __ISoftUSBPhysicalDescriptorItem_INTERFACE_DEFINED__ - -/* interface ISoftUSBPhysicalDescriptorItem */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBPhysicalDescriptorItem; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("904F9501-5208-409E-9F6C-67416876964A") - ISoftUSBPhysicalDescriptorItem : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Designator( - /* [retval][out] */ __RPC__out HID_PHYSICAL_DESIGNATOR *pDesignator) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Designator( - /* [in] */ HID_PHYSICAL_DESIGNATOR Designator) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Flags( - /* [retval][out] */ __RPC__out BYTE *pFlags) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Flags( - /* [in] */ BYTE Flags) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Qualifier( - /* [retval][out] */ __RPC__out HID_PHYSICAL_QUALIFIER *pQualifier) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Qualifier( - /* [in] */ HID_PHYSICAL_QUALIFIER Qualifier) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Effort( - /* [retval][out] */ __RPC__out BYTE *pEffort) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Effort( - /* [in] */ BYTE Effort) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBPhysicalDescriptorItemVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBPhysicalDescriptorItem * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Designator )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This, - /* [retval][out] */ __RPC__out HID_PHYSICAL_DESIGNATOR *pDesignator); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Designator )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This, - /* [in] */ HID_PHYSICAL_DESIGNATOR Designator); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Flags )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This, - /* [retval][out] */ __RPC__out BYTE *pFlags); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Flags )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This, - /* [in] */ BYTE Flags); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Qualifier )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This, - /* [retval][out] */ __RPC__out HID_PHYSICAL_QUALIFIER *pQualifier); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Qualifier )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This, - /* [in] */ HID_PHYSICAL_QUALIFIER Qualifier); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Effort )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This, - /* [retval][out] */ __RPC__out BYTE *pEffort); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Effort )( - __RPC__in ISoftUSBPhysicalDescriptorItem * This, - /* [in] */ BYTE Effort); - - END_INTERFACE - } ISoftUSBPhysicalDescriptorItemVtbl; - - interface ISoftUSBPhysicalDescriptorItem - { - CONST_VTBL struct ISoftUSBPhysicalDescriptorItemVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBPhysicalDescriptorItem_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBPhysicalDescriptorItem_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBPhysicalDescriptorItem_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBPhysicalDescriptorItem_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBPhysicalDescriptorItem_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBPhysicalDescriptorItem_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBPhysicalDescriptorItem_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBPhysicalDescriptorItem_get_Designator(This,pDesignator) \ - ( (This)->lpVtbl -> get_Designator(This,pDesignator) ) - -#define ISoftUSBPhysicalDescriptorItem_put_Designator(This,Designator) \ - ( (This)->lpVtbl -> put_Designator(This,Designator) ) - -#define ISoftUSBPhysicalDescriptorItem_get_Flags(This,pFlags) \ - ( (This)->lpVtbl -> get_Flags(This,pFlags) ) - -#define ISoftUSBPhysicalDescriptorItem_put_Flags(This,Flags) \ - ( (This)->lpVtbl -> put_Flags(This,Flags) ) - -#define ISoftUSBPhysicalDescriptorItem_get_Qualifier(This,pQualifier) \ - ( (This)->lpVtbl -> get_Qualifier(This,pQualifier) ) - -#define ISoftUSBPhysicalDescriptorItem_put_Qualifier(This,Qualifier) \ - ( (This)->lpVtbl -> put_Qualifier(This,Qualifier) ) - -#define ISoftUSBPhysicalDescriptorItem_get_Effort(This,pEffort) \ - ( (This)->lpVtbl -> get_Effort(This,pEffort) ) - -#define ISoftUSBPhysicalDescriptorItem_put_Effort(This,Effort) \ - ( (This)->lpVtbl -> put_Effort(This,Effort) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBPhysicalDescriptorItem_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBPhysicalDescriptor_INTERFACE_DEFINED__ -#define __ISoftUSBPhysicalDescriptor_INTERFACE_DEFINED__ - -/* interface ISoftUSBPhysicalDescriptor */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBPhysicalDescriptor; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("0C192F43-ACC3-4CF7-A823-B14FCFF082A1") - ISoftUSBPhysicalDescriptor : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Set0( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBPhysicalDescriptorSet0 **ppSet0) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Set0( - /* [in] */ __RPC__in_opt ISoftUSBPhysicalDescriptorSet0 *pSet0) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT __stdcall putref_Set0( - /* [in] */ __RPC__in_opt ISoftUSBPhysicalDescriptorSet0 *pSet0) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Sets( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBPhysicalDescriptorSetList **ppSets) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBPhysicalDescriptorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBPhysicalDescriptor * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBPhysicalDescriptor * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBPhysicalDescriptor * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBPhysicalDescriptor * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBPhysicalDescriptor * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBPhysicalDescriptor * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBPhysicalDescriptor * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Set0 )( - __RPC__in ISoftUSBPhysicalDescriptor * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBPhysicalDescriptorSet0 **ppSet0); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Set0 )( - __RPC__in ISoftUSBPhysicalDescriptor * This, - /* [in] */ __RPC__in_opt ISoftUSBPhysicalDescriptorSet0 *pSet0); - - /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT ( __stdcall *putref_Set0 )( - __RPC__in ISoftUSBPhysicalDescriptor * This, - /* [in] */ __RPC__in_opt ISoftUSBPhysicalDescriptorSet0 *pSet0); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Sets )( - __RPC__in ISoftUSBPhysicalDescriptor * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBPhysicalDescriptorSetList **ppSets); - - END_INTERFACE - } ISoftUSBPhysicalDescriptorVtbl; - - interface ISoftUSBPhysicalDescriptor - { - CONST_VTBL struct ISoftUSBPhysicalDescriptorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBPhysicalDescriptor_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBPhysicalDescriptor_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBPhysicalDescriptor_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBPhysicalDescriptor_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBPhysicalDescriptor_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBPhysicalDescriptor_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBPhysicalDescriptor_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBPhysicalDescriptor_get_Set0(This,ppSet0) \ - ( (This)->lpVtbl -> get_Set0(This,ppSet0) ) - -#define ISoftUSBPhysicalDescriptor_put_Set0(This,pSet0) \ - ( (This)->lpVtbl -> put_Set0(This,pSet0) ) - -#define ISoftUSBPhysicalDescriptor_putref_Set0(This,pSet0) \ - ( (This)->lpVtbl -> putref_Set0(This,pSet0) ) - -#define ISoftUSBPhysicalDescriptor_get_Sets(This,ppSets) \ - ( (This)->lpVtbl -> get_Sets(This,ppSets) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBPhysicalDescriptor_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBPhysicalDescriptorSetList_INTERFACE_DEFINED__ -#define __ISoftUSBPhysicalDescriptorSetList_INTERFACE_DEFINED__ - -/* interface ISoftUSBPhysicalDescriptorSetList */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBPhysicalDescriptorSetList; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4CC5D8E4-49F4-4C34-ADA7-B81B4BC5C4D6") - ISoftUSBPhysicalDescriptorSetList : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Count( - /* [retval][out] */ __RPC__out long *plCount) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Item( - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBPhysicalDescriptorSet **ppSet) = 0; - - virtual /* [hidden][propget][id] */ HRESULT __stdcall get__NewEnum( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Add( - /* [in] */ __RPC__in_opt ISoftUSBPhysicalDescriptorSet *pSet, - /* [optional][in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Remove( - /* [in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Clear( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBPhysicalDescriptorSetListVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBPhysicalDescriptorSetList * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBPhysicalDescriptorSetList * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBPhysicalDescriptorSetList * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBPhysicalDescriptorSetList * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBPhysicalDescriptorSetList * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBPhysicalDescriptorSetList * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBPhysicalDescriptorSetList * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Count )( - __RPC__in ISoftUSBPhysicalDescriptorSetList * This, - /* [retval][out] */ __RPC__out long *plCount); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Item )( - __RPC__in ISoftUSBPhysicalDescriptorSetList * This, - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBPhysicalDescriptorSet **ppSet); - - /* [hidden][propget][id] */ HRESULT ( __stdcall *get__NewEnum )( - __RPC__in ISoftUSBPhysicalDescriptorSetList * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Add )( - __RPC__in ISoftUSBPhysicalDescriptorSetList * This, - /* [in] */ __RPC__in_opt ISoftUSBPhysicalDescriptorSet *pSet, - /* [optional][in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Remove )( - __RPC__in ISoftUSBPhysicalDescriptorSetList * This, - /* [in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Clear )( - __RPC__in ISoftUSBPhysicalDescriptorSetList * This); - - END_INTERFACE - } ISoftUSBPhysicalDescriptorSetListVtbl; - - interface ISoftUSBPhysicalDescriptorSetList - { - CONST_VTBL struct ISoftUSBPhysicalDescriptorSetListVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBPhysicalDescriptorSetList_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBPhysicalDescriptorSetList_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBPhysicalDescriptorSetList_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBPhysicalDescriptorSetList_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBPhysicalDescriptorSetList_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBPhysicalDescriptorSetList_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBPhysicalDescriptorSetList_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBPhysicalDescriptorSetList_get_Count(This,plCount) \ - ( (This)->lpVtbl -> get_Count(This,plCount) ) - -#define ISoftUSBPhysicalDescriptorSetList_get_Item(This,Index,ppSet) \ - ( (This)->lpVtbl -> get_Item(This,Index,ppSet) ) - -#define ISoftUSBPhysicalDescriptorSetList_get__NewEnum(This,ppunkEnum) \ - ( (This)->lpVtbl -> get__NewEnum(This,ppunkEnum) ) - -#define ISoftUSBPhysicalDescriptorSetList_Add(This,pSet,Index) \ - ( (This)->lpVtbl -> Add(This,pSet,Index) ) - -#define ISoftUSBPhysicalDescriptorSetList_Remove(This,Index) \ - ( (This)->lpVtbl -> Remove(This,Index) ) - -#define ISoftUSBPhysicalDescriptorSetList_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBPhysicalDescriptorSetList_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBPhysicalDescriptorItemList_INTERFACE_DEFINED__ -#define __ISoftUSBPhysicalDescriptorItemList_INTERFACE_DEFINED__ - -/* interface ISoftUSBPhysicalDescriptorItemList */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBPhysicalDescriptorItemList; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("24939051-5A21-432B-BF7C-D05037C116A4") - ISoftUSBPhysicalDescriptorItemList : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Count( - /* [retval][out] */ __RPC__out long *plCount) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Item( - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBPhysicalDescriptorItem **ppItem) = 0; - - virtual /* [hidden][propget][id] */ HRESULT __stdcall get__NewEnum( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Add( - /* [in] */ __RPC__in_opt ISoftUSBPhysicalDescriptorItem *pItem, - /* [optional][in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Remove( - /* [in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Clear( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBPhysicalDescriptorItemListVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBPhysicalDescriptorItemList * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBPhysicalDescriptorItemList * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBPhysicalDescriptorItemList * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBPhysicalDescriptorItemList * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBPhysicalDescriptorItemList * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBPhysicalDescriptorItemList * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBPhysicalDescriptorItemList * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Count )( - __RPC__in ISoftUSBPhysicalDescriptorItemList * This, - /* [retval][out] */ __RPC__out long *plCount); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Item )( - __RPC__in ISoftUSBPhysicalDescriptorItemList * This, - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBPhysicalDescriptorItem **ppItem); - - /* [hidden][propget][id] */ HRESULT ( __stdcall *get__NewEnum )( - __RPC__in ISoftUSBPhysicalDescriptorItemList * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Add )( - __RPC__in ISoftUSBPhysicalDescriptorItemList * This, - /* [in] */ __RPC__in_opt ISoftUSBPhysicalDescriptorItem *pItem, - /* [optional][in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Remove )( - __RPC__in ISoftUSBPhysicalDescriptorItemList * This, - /* [in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Clear )( - __RPC__in ISoftUSBPhysicalDescriptorItemList * This); - - END_INTERFACE - } ISoftUSBPhysicalDescriptorItemListVtbl; - - interface ISoftUSBPhysicalDescriptorItemList - { - CONST_VTBL struct ISoftUSBPhysicalDescriptorItemListVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBPhysicalDescriptorItemList_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBPhysicalDescriptorItemList_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBPhysicalDescriptorItemList_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBPhysicalDescriptorItemList_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBPhysicalDescriptorItemList_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBPhysicalDescriptorItemList_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBPhysicalDescriptorItemList_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBPhysicalDescriptorItemList_get_Count(This,plCount) \ - ( (This)->lpVtbl -> get_Count(This,plCount) ) - -#define ISoftUSBPhysicalDescriptorItemList_get_Item(This,Index,ppItem) \ - ( (This)->lpVtbl -> get_Item(This,Index,ppItem) ) - -#define ISoftUSBPhysicalDescriptorItemList_get__NewEnum(This,ppunkEnum) \ - ( (This)->lpVtbl -> get__NewEnum(This,ppunkEnum) ) - -#define ISoftUSBPhysicalDescriptorItemList_Add(This,pItem,Index) \ - ( (This)->lpVtbl -> Add(This,pItem,Index) ) - -#define ISoftUSBPhysicalDescriptorItemList_Remove(This,Index) \ - ( (This)->lpVtbl -> Remove(This,Index) ) - -#define ISoftUSBPhysicalDescriptorItemList_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBPhysicalDescriptorItemList_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBHidFaultInjection_INTERFACE_DEFINED__ -#define __ISoftUSBHidFaultInjection_INTERFACE_DEFINED__ - -/* interface ISoftUSBHidFaultInjection */ -/* [object][helpstringcontext][helpcontext][helpstring][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBHidFaultInjection; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("36D2CC56-B545-4F13-BAEF-425F87E5BB37") - ISoftUSBHidFaultInjection : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring] */ HRESULT __stdcall StartFaultInjection( void) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring] */ HRESULT __stdcall StopFaultInjection( void) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring] */ HRESULT __stdcall FaultNextNRequests( - /* [in] */ BYTE bRequests, - /* [in] */ ULONG nTimesToFail) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring] */ HRESULT __stdcall FaultNextNIOPackets( - /* [in] */ BYTE bEpNumber, - /* [in] */ BYTE bFlag, - /* [in] */ ULONG nTimesToFail) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring] */ HRESULT __stdcall ChangeNextNIOPackets( - /* [in] */ BYTE bEpNumber, - /* [in] */ BYTE bFlags, - /* [in] */ SHORT wOffset, - /* [in] */ __RPC__in BYTE *pBuffer, - /* [in] */ SHORT wSize, - /* [in] */ BYTE bMask, - /* [in] */ ULONG nTimesToFail) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBHidFaultInjectionVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBHidFaultInjection * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBHidFaultInjection * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBHidFaultInjection * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBHidFaultInjection * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBHidFaultInjection * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBHidFaultInjection * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBHidFaultInjection * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring] */ HRESULT ( __stdcall *StartFaultInjection )( - __RPC__in ISoftUSBHidFaultInjection * This); - - /* [helpstringcontext][helpcontext][helpstring] */ HRESULT ( __stdcall *StopFaultInjection )( - __RPC__in ISoftUSBHidFaultInjection * This); - - /* [helpstringcontext][helpcontext][helpstring] */ HRESULT ( __stdcall *FaultNextNRequests )( - __RPC__in ISoftUSBHidFaultInjection * This, - /* [in] */ BYTE bRequests, - /* [in] */ ULONG nTimesToFail); - - /* [helpstringcontext][helpcontext][helpstring] */ HRESULT ( __stdcall *FaultNextNIOPackets )( - __RPC__in ISoftUSBHidFaultInjection * This, - /* [in] */ BYTE bEpNumber, - /* [in] */ BYTE bFlag, - /* [in] */ ULONG nTimesToFail); - - /* [helpstringcontext][helpcontext][helpstring] */ HRESULT ( __stdcall *ChangeNextNIOPackets )( - __RPC__in ISoftUSBHidFaultInjection * This, - /* [in] */ BYTE bEpNumber, - /* [in] */ BYTE bFlags, - /* [in] */ SHORT wOffset, - /* [in] */ __RPC__in BYTE *pBuffer, - /* [in] */ SHORT wSize, - /* [in] */ BYTE bMask, - /* [in] */ ULONG nTimesToFail); - - END_INTERFACE - } ISoftUSBHidFaultInjectionVtbl; - - interface ISoftUSBHidFaultInjection - { - CONST_VTBL struct ISoftUSBHidFaultInjectionVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBHidFaultInjection_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBHidFaultInjection_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBHidFaultInjection_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBHidFaultInjection_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBHidFaultInjection_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBHidFaultInjection_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBHidFaultInjection_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBHidFaultInjection_StartFaultInjection(This) \ - ( (This)->lpVtbl -> StartFaultInjection(This) ) - -#define ISoftUSBHidFaultInjection_StopFaultInjection(This) \ - ( (This)->lpVtbl -> StopFaultInjection(This) ) - -#define ISoftUSBHidFaultInjection_FaultNextNRequests(This,bRequests,nTimesToFail) \ - ( (This)->lpVtbl -> FaultNextNRequests(This,bRequests,nTimesToFail) ) - -#define ISoftUSBHidFaultInjection_FaultNextNIOPackets(This,bEpNumber,bFlag,nTimesToFail) \ - ( (This)->lpVtbl -> FaultNextNIOPackets(This,bEpNumber,bFlag,nTimesToFail) ) - -#define ISoftUSBHidFaultInjection_ChangeNextNIOPackets(This,bEpNumber,bFlags,wOffset,pBuffer,wSize,bMask,nTimesToFail) \ - ( (This)->lpVtbl -> ChangeNextNIOPackets(This,bEpNumber,bFlags,wOffset,pBuffer,wSize,bMask,nTimesToFail) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBHidFaultInjection_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_SoftHIDProtocolXlator; - -#ifdef __cplusplus - -class DECLSPEC_UUID("887C935C-84F7-4252-BFE3-33CBC16F3D47") -SoftHIDProtocolXlator; -#endif - -EXTERN_C const CLSID CLSID_SoftHidUsbDevice; - -#ifdef __cplusplus - -class DECLSPEC_UUID("56545816-6EFE-45D0-BA2E-AC4426878CD5") -SoftHidUsbDevice; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBHidDescriptor; - -#ifdef __cplusplus - -class DECLSPEC_UUID("3FB17F94-282C-4091-BCAA-EAA0AC104946") -SoftUSBHidDescriptor; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBPhysicalDescriptor; - -#ifdef __cplusplus - -class DECLSPEC_UUID("D5DF9D05-B55C-45EC-BDC2-A9CC318CBBAB") -SoftUSBPhysicalDescriptor; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBPhysicalDescriptorSet0; - -#ifdef __cplusplus - -class DECLSPEC_UUID("921F4757-CD5A-4935-BB3E-616ABFE18BEA") -SoftUSBPhysicalDescriptorSet0; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBPhysicalDescriptorSet; - -#ifdef __cplusplus - -class DECLSPEC_UUID("EF7BF7AD-83D0-4160-9C07-39AD92A08A8D") -SoftUSBPhysicalDescriptorSet; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBPhysicalDescriptorItem; - -#ifdef __cplusplus - -class DECLSPEC_UUID("18217BCD-1DC8-4737-A0A3-95EC3432DBFE") -SoftUSBPhysicalDescriptorItem; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBPhysicalDescriptorSetList; - -#ifdef __cplusplus - -class DECLSPEC_UUID("E280E977-BD59-48A0-9B91-10D312157393") -SoftUSBPhysicalDescriptorSetList; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBPhysicalDescriptorItemList; - -#ifdef __cplusplus - -class DECLSPEC_UUID("8F779698-A4E3-47FE-8542-C312FE1F748A") -SoftUSBPhysicalDescriptorItemList; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBHidFaultInjection; - -#ifdef __cplusplus - -class DECLSPEC_UUID("D775D2E8-F328-43F4-B680-80DF4AE0CB6A") -SoftUSBHidFaultInjection; -#endif -#endif /* __SOFTHIDUSBK_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/softusbif.h b/pub/ddk/softusbif.h deleted file mode 100644 index 72b3f94..0000000 --- a/pub/ddk/softusbif.h +++ /dev/null @@ -1,4424 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for softusbif.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - - -#ifndef __softusbif_h__ -#define __softusbif_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __ISoftUSBConfigurations_FWD_DEFINED__ -#define __ISoftUSBConfigurations_FWD_DEFINED__ -typedef interface ISoftUSBConfigurations ISoftUSBConfigurations; -#endif /* __ISoftUSBConfigurations_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBConfiguration_FWD_DEFINED__ -#define __ISoftUSBConfiguration_FWD_DEFINED__ -typedef interface ISoftUSBConfiguration ISoftUSBConfiguration; -#endif /* __ISoftUSBConfiguration_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBInterface_FWD_DEFINED__ -#define __ISoftUSBInterface_FWD_DEFINED__ -typedef interface ISoftUSBInterface ISoftUSBInterface; -#endif /* __ISoftUSBInterface_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBEndpoint_FWD_DEFINED__ -#define __ISoftUSBEndpoint_FWD_DEFINED__ -typedef interface ISoftUSBEndpoint ISoftUSBEndpoint; -#endif /* __ISoftUSBEndpoint_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBDeviceQualifier_FWD_DEFINED__ -#define __ISoftUSBDeviceQualifier_FWD_DEFINED__ -typedef interface ISoftUSBDeviceQualifier ISoftUSBDeviceQualifier; -#endif /* __ISoftUSBDeviceQualifier_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBEndpointEvents_FWD_DEFINED__ -#define __ISoftUSBEndpointEvents_FWD_DEFINED__ -typedef interface ISoftUSBEndpointEvents ISoftUSBEndpointEvents; -#endif /* __ISoftUSBEndpointEvents_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBStrings_FWD_DEFINED__ -#define __ISoftUSBStrings_FWD_DEFINED__ -typedef interface ISoftUSBStrings ISoftUSBStrings; -#endif /* __ISoftUSBStrings_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBInterfaces_FWD_DEFINED__ -#define __ISoftUSBInterfaces_FWD_DEFINED__ -typedef interface ISoftUSBInterfaces ISoftUSBInterfaces; -#endif /* __ISoftUSBInterfaces_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBEndpoints_FWD_DEFINED__ -#define __ISoftUSBEndpoints_FWD_DEFINED__ -typedef interface ISoftUSBEndpoints ISoftUSBEndpoints; -#endif /* __ISoftUSBEndpoints_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBHub_FWD_DEFINED__ -#define __ISoftUSBHub_FWD_DEFINED__ -typedef interface ISoftUSBHub ISoftUSBHub; -#endif /* __ISoftUSBHub_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBHubPorts_FWD_DEFINED__ -#define __ISoftUSBHubPorts_FWD_DEFINED__ -typedef interface ISoftUSBHubPorts ISoftUSBHubPorts; -#endif /* __ISoftUSBHubPorts_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBHubPort_FWD_DEFINED__ -#define __ISoftUSBHubPort_FWD_DEFINED__ -typedef interface ISoftUSBHubPort ISoftUSBHubPort; -#endif /* __ISoftUSBHubPort_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBDevice_FWD_DEFINED__ -#define __ISoftUSBDevice_FWD_DEFINED__ -typedef interface ISoftUSBDevice ISoftUSBDevice; -#endif /* __ISoftUSBDevice_FWD_DEFINED__ */ - - -#ifndef __SoftUSBDevice_FWD_DEFINED__ -#define __SoftUSBDevice_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBDevice SoftUSBDevice; -#else -typedef struct SoftUSBDevice SoftUSBDevice; -#endif /* __cplusplus */ - -#endif /* __SoftUSBDevice_FWD_DEFINED__ */ - - -#ifndef __SoftUSBDeviceQualifier_FWD_DEFINED__ -#define __SoftUSBDeviceQualifier_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBDeviceQualifier SoftUSBDeviceQualifier; -#else -typedef struct SoftUSBDeviceQualifier SoftUSBDeviceQualifier; -#endif /* __cplusplus */ - -#endif /* __SoftUSBDeviceQualifier_FWD_DEFINED__ */ - - -#ifndef __SoftUSBConfiguration_FWD_DEFINED__ -#define __SoftUSBConfiguration_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBConfiguration SoftUSBConfiguration; -#else -typedef struct SoftUSBConfiguration SoftUSBConfiguration; -#endif /* __cplusplus */ - -#endif /* __SoftUSBConfiguration_FWD_DEFINED__ */ - - -#ifndef __SoftUSBInterface_FWD_DEFINED__ -#define __SoftUSBInterface_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBInterface SoftUSBInterface; -#else -typedef struct SoftUSBInterface SoftUSBInterface; -#endif /* __cplusplus */ - -#endif /* __SoftUSBInterface_FWD_DEFINED__ */ - - -#ifndef __SoftUSBEndpoint_FWD_DEFINED__ -#define __SoftUSBEndpoint_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBEndpoint SoftUSBEndpoint; -#else -typedef struct SoftUSBEndpoint SoftUSBEndpoint; -#endif /* __cplusplus */ - -#endif /* __SoftUSBEndpoint_FWD_DEFINED__ */ - - -#ifndef __SoftUSBConfigurations_FWD_DEFINED__ -#define __SoftUSBConfigurations_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBConfigurations SoftUSBConfigurations; -#else -typedef struct SoftUSBConfigurations SoftUSBConfigurations; -#endif /* __cplusplus */ - -#endif /* __SoftUSBConfigurations_FWD_DEFINED__ */ - - -#ifndef __SoftUSBInterfaces_FWD_DEFINED__ -#define __SoftUSBInterfaces_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBInterfaces SoftUSBInterfaces; -#else -typedef struct SoftUSBInterfaces SoftUSBInterfaces; -#endif /* __cplusplus */ - -#endif /* __SoftUSBInterfaces_FWD_DEFINED__ */ - - -#ifndef __SoftUSBEndpoints_FWD_DEFINED__ -#define __SoftUSBEndpoints_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBEndpoints SoftUSBEndpoints; -#else -typedef struct SoftUSBEndpoints SoftUSBEndpoints; -#endif /* __cplusplus */ - -#endif /* __SoftUSBEndpoints_FWD_DEFINED__ */ - - -#ifndef __SoftUSBStrings_FWD_DEFINED__ -#define __SoftUSBStrings_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBStrings SoftUSBStrings; -#else -typedef struct SoftUSBStrings SoftUSBStrings; -#endif /* __cplusplus */ - -#endif /* __SoftUSBStrings_FWD_DEFINED__ */ - - -#ifndef __ISoftUSBString_FWD_DEFINED__ -#define __ISoftUSBString_FWD_DEFINED__ -typedef interface ISoftUSBString ISoftUSBString; -#endif /* __ISoftUSBString_FWD_DEFINED__ */ - - -#ifndef __SoftUSBString_FWD_DEFINED__ -#define __SoftUSBString_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBString SoftUSBString; -#else -typedef struct SoftUSBString SoftUSBString; -#endif /* __cplusplus */ - -#endif /* __SoftUSBString_FWD_DEFINED__ */ - - -#ifndef __SoftUSBHub_FWD_DEFINED__ -#define __SoftUSBHub_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBHub SoftUSBHub; -#else -typedef struct SoftUSBHub SoftUSBHub; -#endif /* __cplusplus */ - -#endif /* __SoftUSBHub_FWD_DEFINED__ */ - - -#ifndef __SoftUSBHubPorts_FWD_DEFINED__ -#define __SoftUSBHubPorts_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBHubPorts SoftUSBHubPorts; -#else -typedef struct SoftUSBHubPorts SoftUSBHubPorts; -#endif /* __cplusplus */ - -#endif /* __SoftUSBHubPorts_FWD_DEFINED__ */ - - -#ifndef __SoftUSBHubPort_FWD_DEFINED__ -#define __SoftUSBHubPort_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SoftUSBHubPort SoftUSBHubPort; -#else -typedef struct SoftUSBHubPort SoftUSBHubPort; -#endif /* __cplusplus */ - -#endif /* __SoftUSBHubPort_FWD_DEFINED__ */ - - -#ifdef __cplusplus -extern "C"{ -#endif - - - -#ifndef __SOFTUSB_LIBRARY_DEFINED__ -#define __SOFTUSB_LIBRARY_DEFINED__ - -/* library SOFTUSB */ -/* [helpstringcontext][helpcontext][helpstring][helpstringdll][helpfile][version][lcid][uuid] */ - - - - - - - - - - - - - - - - -#if defined (MIDL_PASS) -typedef struct LIST_ENTRY - { - struct LIST_ENTRY *Flink; - struct LIST_ENTRY *Blink; - } LIST_ENTRY; - -#endif -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("A0E64F57-5D2D-4EE2-A257-227A575ACC60") struct SOFTUSB_OUT_TRANSFER - { - BYTE bStatus; - BYTE DataToggle; - ULONG cbData; - ULARGE_INTEGER uliQueuedTime; - LIST_ENTRY NextTransfer; - BYTE Data[ 1 ]; - } SOFTUSB_OUT_TRANSFER; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("17C3648C-CE1B-41EE-86CE-C681264A8336") -enum RequestMatchOpts - { MatchExactLength = 0, - MatchAnyLength = 1 - } RequestMatchOpts; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("550F7244-399C-4155-ADF0-2CCD83BB00F0") -enum SoftUSBHubPowerSwitchingMode - { GangedPowerSwitching = 0, - IndividualPowerSwitching = 1, - NoPowerSwitching = 2 - } SoftUSBHubPowerSwitchingMode; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("5BEA0626-9743-4517-8283-ECFAD924F4DB") -enum SoftUSBHubOverCurrentProtectionMode - { GlobalOverCurrentProtection = 0, - IndividualOverCurrentProtection = 1, - NoOverCurrentProtection = 2 - } SoftUSBHubOverCurrentProtectionMode; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("2A3C8E65-6335-4920-AFEA-DF6ED9B02760") -enum SoftUSBHubSpeed - { SoftUSBHubSpeedLow = 0, - SoftUSBHubSpeedFull = 1, - SoftUSBHubSpeedHigh = 2, - SoftUSBHubNotConnected = 3 - } SoftUSBHubSpeed; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("07B2373A-6942-491E-9BF7-CACF68A454F5") -enum SoftUSBHubIndicator - { SoftUSBHubOff = 0, - SoftUSBHubAmber = 1, - SoftUSBHubGreen = 2, - SoftUSBHubBlinkingOffGreen = 3, - SoftUSBHubBlinkingOffAmber = 4, - SoftUSBHubBlinkingGreenAmber = 5 - } SoftUSBHubIndicator; - -typedef /* [helpstringcontext][helpcontext][helpstring][uuid] */ DECLSPEC_UUID("2A3A45AE-3650-4922-8502-BA5960186974") -enum SoftUSBDeviceState - { SoftUSBDeviceStateDetached = 0, - SoftUSBDeviceStateAttached = 1, - SoftUSBDeviceStatePowered = 2, - SoftUSBDeviceStateDefault = 3, - SoftWUSBDeviceStateUnconnected = 4, - SoftWUSBDeviceStateUnauthenticated = 5, - SoftUSBDeviceStateAddress = 6, - SoftUSBDeviceStateConfigured = 7, - SoftUSBDeviceStateSuspended = 8 - } SoftUSBDeviceState; - -#define SOFTUSB_FOREVER ( ( ULONG )-1 ) - -#define SOFTUSB_ALL ( ( ULONG )-1 ) - -#define SOFTUSBENDPOINT_OBJECTFLAGS ( 100 ) - -#define SOFTUSBENDPOINT_DONOTTRACETRANSFERS ( 0 ) - -#define SOFTUSBENDPOINT_TRACETRANSFERINPUT ( 0x1 ) - -#define SOFTUSBENDPOINT_TRACETRANSFEROUPUT ( 0x2 ) - -#define SOFTUSBENDPOINT_TRACETRANSFERINPUTANDOUPUT ( 0x3 ) - -#define SOFTUSBENDPOINT_TRACEOUTLISTOVERFLOW ( 0x20 ) - - -EXTERN_C const IID LIBID_SOFTUSB; - -#ifndef __ISoftUSBConfigurations_INTERFACE_DEFINED__ -#define __ISoftUSBConfigurations_INTERFACE_DEFINED__ - -/* interface ISoftUSBConfigurations */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBConfigurations; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("15482CE8-BA91-4CEC-9D42-62C8390C3EAC") - ISoftUSBConfigurations : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Count( - /* [retval][out] */ __RPC__out long *plCount) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Item( - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt SoftUSBConfiguration **ppSOFTUSBConfig) = 0; - - virtual /* [hidden][propget][id] */ HRESULT __stdcall get__NewEnum( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Add( - /* [in] */ __RPC__in SoftUSBConfiguration *ppSOFTUSBConfig, - /* [optional][in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Remove( - /* [in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Clear( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBConfigurationsVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBConfigurations * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBConfigurations * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBConfigurations * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBConfigurations * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBConfigurations * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBConfigurations * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBConfigurations * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Count )( - __RPC__in ISoftUSBConfigurations * This, - /* [retval][out] */ __RPC__out long *plCount); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Item )( - __RPC__in ISoftUSBConfigurations * This, - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt SoftUSBConfiguration **ppSOFTUSBConfig); - - /* [hidden][propget][id] */ HRESULT ( __stdcall *get__NewEnum )( - __RPC__in ISoftUSBConfigurations * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Add )( - __RPC__in ISoftUSBConfigurations * This, - /* [in] */ __RPC__in SoftUSBConfiguration *ppSOFTUSBConfig, - /* [optional][in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Remove )( - __RPC__in ISoftUSBConfigurations * This, - /* [in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Clear )( - __RPC__in ISoftUSBConfigurations * This); - - END_INTERFACE - } ISoftUSBConfigurationsVtbl; - - interface ISoftUSBConfigurations - { - CONST_VTBL struct ISoftUSBConfigurationsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBConfigurations_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBConfigurations_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBConfigurations_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBConfigurations_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBConfigurations_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBConfigurations_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBConfigurations_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBConfigurations_get_Count(This,plCount) \ - ( (This)->lpVtbl -> get_Count(This,plCount) ) - -#define ISoftUSBConfigurations_get_Item(This,Index,ppSOFTUSBConfig) \ - ( (This)->lpVtbl -> get_Item(This,Index,ppSOFTUSBConfig) ) - -#define ISoftUSBConfigurations_get__NewEnum(This,ppunkEnum) \ - ( (This)->lpVtbl -> get__NewEnum(This,ppunkEnum) ) - -#define ISoftUSBConfigurations_Add(This,ppSOFTUSBConfig,Index) \ - ( (This)->lpVtbl -> Add(This,ppSOFTUSBConfig,Index) ) - -#define ISoftUSBConfigurations_Remove(This,Index) \ - ( (This)->lpVtbl -> Remove(This,Index) ) - -#define ISoftUSBConfigurations_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBConfigurations_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBConfiguration_INTERFACE_DEFINED__ -#define __ISoftUSBConfiguration_INTERFACE_DEFINED__ - -/* interface ISoftUSBConfiguration */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBConfiguration; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("2043f5a3-28de-4618-a5a6-519cefe62d96") - ISoftUSBConfiguration : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Length( - /* [retval][out] */ __RPC__out BYTE *pbLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Length( - /* [in] */ BYTE bLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DescriptorType( - /* [retval][out] */ __RPC__out BYTE *pbDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DescriptorType( - /* [in] */ BYTE bDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_TotalLength( - /* [retval][out] */ __RPC__out SHORT *psTotalLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_NumInterfaces( - /* [retval][out] */ __RPC__out BYTE *pbNumInterfaces) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_ConfigurationValue( - /* [retval][out] */ __RPC__out BYTE *pbConfigValue) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_ConfigurationValue( - /* [in] */ BYTE bConfigValue) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Configuration( - /* [retval][out] */ __RPC__out BYTE *pbConfig) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Configuration( - /* [in] */ BYTE bConfig) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Attributes( - /* [retval][out] */ __RPC__out BYTE *pbAttributes) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Attributes( - /* [in] */ BYTE bAttributes) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_MaxPower( - /* [retval][out] */ __RPC__out BYTE *pbMaxPower) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_MaxPower( - /* [in] */ BYTE bMaxPower) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Interfaces( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBInterfaces **ppiInterfaces) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_AlternateForInterface( - /* [in] */ BYTE bInterface, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBInterface **ppiInterface) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceSpecificDescriptor( - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaDevSpecData) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceSpecificDescriptor( - /* [in] */ __RPC__in SAFEARRAY * psaDevSpecData) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Context( - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFPropertyBag **ppContext) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBConfigurationVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBConfiguration * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBConfiguration * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBConfiguration * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBConfiguration * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBConfiguration * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBConfiguration * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBConfiguration * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Length )( - __RPC__in ISoftUSBConfiguration * This, - /* [retval][out] */ __RPC__out BYTE *pbLength); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Length )( - __RPC__in ISoftUSBConfiguration * This, - /* [in] */ BYTE bLength); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DescriptorType )( - __RPC__in ISoftUSBConfiguration * This, - /* [retval][out] */ __RPC__out BYTE *pbDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DescriptorType )( - __RPC__in ISoftUSBConfiguration * This, - /* [in] */ BYTE bDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_TotalLength )( - __RPC__in ISoftUSBConfiguration * This, - /* [retval][out] */ __RPC__out SHORT *psTotalLength); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_NumInterfaces )( - __RPC__in ISoftUSBConfiguration * This, - /* [retval][out] */ __RPC__out BYTE *pbNumInterfaces); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_ConfigurationValue )( - __RPC__in ISoftUSBConfiguration * This, - /* [retval][out] */ __RPC__out BYTE *pbConfigValue); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_ConfigurationValue )( - __RPC__in ISoftUSBConfiguration * This, - /* [in] */ BYTE bConfigValue); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Configuration )( - __RPC__in ISoftUSBConfiguration * This, - /* [retval][out] */ __RPC__out BYTE *pbConfig); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Configuration )( - __RPC__in ISoftUSBConfiguration * This, - /* [in] */ BYTE bConfig); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Attributes )( - __RPC__in ISoftUSBConfiguration * This, - /* [retval][out] */ __RPC__out BYTE *pbAttributes); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Attributes )( - __RPC__in ISoftUSBConfiguration * This, - /* [in] */ BYTE bAttributes); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_MaxPower )( - __RPC__in ISoftUSBConfiguration * This, - /* [retval][out] */ __RPC__out BYTE *pbMaxPower); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_MaxPower )( - __RPC__in ISoftUSBConfiguration * This, - /* [in] */ BYTE bMaxPower); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Interfaces )( - __RPC__in ISoftUSBConfiguration * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBInterfaces **ppiInterfaces); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_AlternateForInterface )( - __RPC__in ISoftUSBConfiguration * This, - /* [in] */ BYTE bInterface, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBInterface **ppiInterface); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceSpecificDescriptor )( - __RPC__in ISoftUSBConfiguration * This, - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaDevSpecData); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceSpecificDescriptor )( - __RPC__in ISoftUSBConfiguration * This, - /* [in] */ __RPC__in SAFEARRAY * psaDevSpecData); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Context )( - __RPC__in ISoftUSBConfiguration * This, - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFPropertyBag **ppContext); - - END_INTERFACE - } ISoftUSBConfigurationVtbl; - - interface ISoftUSBConfiguration - { - CONST_VTBL struct ISoftUSBConfigurationVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBConfiguration_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBConfiguration_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBConfiguration_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBConfiguration_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBConfiguration_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBConfiguration_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBConfiguration_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBConfiguration_get_Length(This,pbLength) \ - ( (This)->lpVtbl -> get_Length(This,pbLength) ) - -#define ISoftUSBConfiguration_put_Length(This,bLength) \ - ( (This)->lpVtbl -> put_Length(This,bLength) ) - -#define ISoftUSBConfiguration_get_DescriptorType(This,pbDescriptorType) \ - ( (This)->lpVtbl -> get_DescriptorType(This,pbDescriptorType) ) - -#define ISoftUSBConfiguration_put_DescriptorType(This,bDescriptorType) \ - ( (This)->lpVtbl -> put_DescriptorType(This,bDescriptorType) ) - -#define ISoftUSBConfiguration_get_TotalLength(This,psTotalLength) \ - ( (This)->lpVtbl -> get_TotalLength(This,psTotalLength) ) - -#define ISoftUSBConfiguration_get_NumInterfaces(This,pbNumInterfaces) \ - ( (This)->lpVtbl -> get_NumInterfaces(This,pbNumInterfaces) ) - -#define ISoftUSBConfiguration_get_ConfigurationValue(This,pbConfigValue) \ - ( (This)->lpVtbl -> get_ConfigurationValue(This,pbConfigValue) ) - -#define ISoftUSBConfiguration_put_ConfigurationValue(This,bConfigValue) \ - ( (This)->lpVtbl -> put_ConfigurationValue(This,bConfigValue) ) - -#define ISoftUSBConfiguration_get_Configuration(This,pbConfig) \ - ( (This)->lpVtbl -> get_Configuration(This,pbConfig) ) - -#define ISoftUSBConfiguration_put_Configuration(This,bConfig) \ - ( (This)->lpVtbl -> put_Configuration(This,bConfig) ) - -#define ISoftUSBConfiguration_get_Attributes(This,pbAttributes) \ - ( (This)->lpVtbl -> get_Attributes(This,pbAttributes) ) - -#define ISoftUSBConfiguration_put_Attributes(This,bAttributes) \ - ( (This)->lpVtbl -> put_Attributes(This,bAttributes) ) - -#define ISoftUSBConfiguration_get_MaxPower(This,pbMaxPower) \ - ( (This)->lpVtbl -> get_MaxPower(This,pbMaxPower) ) - -#define ISoftUSBConfiguration_put_MaxPower(This,bMaxPower) \ - ( (This)->lpVtbl -> put_MaxPower(This,bMaxPower) ) - -#define ISoftUSBConfiguration_get_Interfaces(This,ppiInterfaces) \ - ( (This)->lpVtbl -> get_Interfaces(This,ppiInterfaces) ) - -#define ISoftUSBConfiguration_get_AlternateForInterface(This,bInterface,ppiInterface) \ - ( (This)->lpVtbl -> get_AlternateForInterface(This,bInterface,ppiInterface) ) - -#define ISoftUSBConfiguration_get_DeviceSpecificDescriptor(This,ppsaDevSpecData) \ - ( (This)->lpVtbl -> get_DeviceSpecificDescriptor(This,ppsaDevSpecData) ) - -#define ISoftUSBConfiguration_put_DeviceSpecificDescriptor(This,psaDevSpecData) \ - ( (This)->lpVtbl -> put_DeviceSpecificDescriptor(This,psaDevSpecData) ) - -#define ISoftUSBConfiguration_get_Context(This,ppContext) \ - ( (This)->lpVtbl -> get_Context(This,ppContext) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBConfiguration_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBInterface_INTERFACE_DEFINED__ -#define __ISoftUSBInterface_INTERFACE_DEFINED__ - -/* interface ISoftUSBInterface */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBInterface; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("62bb9c16-8608-4f32-8f8a-ace032f38628") - ISoftUSBInterface : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Length( - /* [retval][out] */ __RPC__out BYTE *pbLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Length( - /* [in] */ BYTE bLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DescriptorType( - /* [retval][out] */ __RPC__out BYTE *pbDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DescriptorType( - /* [in] */ BYTE bDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_InterfaceNumber( - /* [retval][out] */ __RPC__out BYTE *pbInterfaceNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_InterfaceNumber( - /* [in] */ BYTE bInterfaceNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_AlternateSetting( - /* [retval][out] */ __RPC__out BYTE *pbAlternateSetting) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_AlternateSetting( - /* [in] */ BYTE bAlternateSetting) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_NumEndpoints( - /* [retval][out] */ __RPC__out BYTE *pbNumEndpoints) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_InterfaceClass( - /* [retval][out] */ __RPC__out BYTE *pbClass) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_InterfaceClass( - /* [in] */ BYTE bClass) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_InterfaceSubClass( - /* [retval][out] */ __RPC__out BYTE *pbSubClass) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_InterfaceSubClass( - /* [in] */ BYTE bSubClass) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_InterfaceProtocol( - /* [retval][out] */ __RPC__out BYTE *pbProtocol) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_InterfaceProtocol( - /* [in] */ BYTE bProtocol) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Interface( - /* [retval][out] */ __RPC__out BYTE *pbInterface) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Interface( - /* [in] */ BYTE bInterface) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Endpoints( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBEndpoints **ppiEndPoints) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceSpecificDescriptor( - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaDevSpecData) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceSpecificDescriptor( - /* [in] */ __RPC__in SAFEARRAY * psaDevSpecData) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Context( - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFPropertyBag **ppContext) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBInterfaceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBInterface * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBInterface * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBInterface * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBInterface * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBInterface * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBInterface * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBInterface * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Length )( - __RPC__in ISoftUSBInterface * This, - /* [retval][out] */ __RPC__out BYTE *pbLength); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Length )( - __RPC__in ISoftUSBInterface * This, - /* [in] */ BYTE bLength); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DescriptorType )( - __RPC__in ISoftUSBInterface * This, - /* [retval][out] */ __RPC__out BYTE *pbDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DescriptorType )( - __RPC__in ISoftUSBInterface * This, - /* [in] */ BYTE bDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_InterfaceNumber )( - __RPC__in ISoftUSBInterface * This, - /* [retval][out] */ __RPC__out BYTE *pbInterfaceNumber); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_InterfaceNumber )( - __RPC__in ISoftUSBInterface * This, - /* [in] */ BYTE bInterfaceNumber); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_AlternateSetting )( - __RPC__in ISoftUSBInterface * This, - /* [retval][out] */ __RPC__out BYTE *pbAlternateSetting); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_AlternateSetting )( - __RPC__in ISoftUSBInterface * This, - /* [in] */ BYTE bAlternateSetting); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_NumEndpoints )( - __RPC__in ISoftUSBInterface * This, - /* [retval][out] */ __RPC__out BYTE *pbNumEndpoints); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_InterfaceClass )( - __RPC__in ISoftUSBInterface * This, - /* [retval][out] */ __RPC__out BYTE *pbClass); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_InterfaceClass )( - __RPC__in ISoftUSBInterface * This, - /* [in] */ BYTE bClass); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_InterfaceSubClass )( - __RPC__in ISoftUSBInterface * This, - /* [retval][out] */ __RPC__out BYTE *pbSubClass); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_InterfaceSubClass )( - __RPC__in ISoftUSBInterface * This, - /* [in] */ BYTE bSubClass); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_InterfaceProtocol )( - __RPC__in ISoftUSBInterface * This, - /* [retval][out] */ __RPC__out BYTE *pbProtocol); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_InterfaceProtocol )( - __RPC__in ISoftUSBInterface * This, - /* [in] */ BYTE bProtocol); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Interface )( - __RPC__in ISoftUSBInterface * This, - /* [retval][out] */ __RPC__out BYTE *pbInterface); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Interface )( - __RPC__in ISoftUSBInterface * This, - /* [in] */ BYTE bInterface); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Endpoints )( - __RPC__in ISoftUSBInterface * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBEndpoints **ppiEndPoints); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceSpecificDescriptor )( - __RPC__in ISoftUSBInterface * This, - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaDevSpecData); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceSpecificDescriptor )( - __RPC__in ISoftUSBInterface * This, - /* [in] */ __RPC__in SAFEARRAY * psaDevSpecData); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Context )( - __RPC__in ISoftUSBInterface * This, - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFPropertyBag **ppContext); - - END_INTERFACE - } ISoftUSBInterfaceVtbl; - - interface ISoftUSBInterface - { - CONST_VTBL struct ISoftUSBInterfaceVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBInterface_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBInterface_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBInterface_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBInterface_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBInterface_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBInterface_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBInterface_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBInterface_get_Length(This,pbLength) \ - ( (This)->lpVtbl -> get_Length(This,pbLength) ) - -#define ISoftUSBInterface_put_Length(This,bLength) \ - ( (This)->lpVtbl -> put_Length(This,bLength) ) - -#define ISoftUSBInterface_get_DescriptorType(This,pbDescriptorType) \ - ( (This)->lpVtbl -> get_DescriptorType(This,pbDescriptorType) ) - -#define ISoftUSBInterface_put_DescriptorType(This,bDescriptorType) \ - ( (This)->lpVtbl -> put_DescriptorType(This,bDescriptorType) ) - -#define ISoftUSBInterface_get_InterfaceNumber(This,pbInterfaceNumber) \ - ( (This)->lpVtbl -> get_InterfaceNumber(This,pbInterfaceNumber) ) - -#define ISoftUSBInterface_put_InterfaceNumber(This,bInterfaceNumber) \ - ( (This)->lpVtbl -> put_InterfaceNumber(This,bInterfaceNumber) ) - -#define ISoftUSBInterface_get_AlternateSetting(This,pbAlternateSetting) \ - ( (This)->lpVtbl -> get_AlternateSetting(This,pbAlternateSetting) ) - -#define ISoftUSBInterface_put_AlternateSetting(This,bAlternateSetting) \ - ( (This)->lpVtbl -> put_AlternateSetting(This,bAlternateSetting) ) - -#define ISoftUSBInterface_get_NumEndpoints(This,pbNumEndpoints) \ - ( (This)->lpVtbl -> get_NumEndpoints(This,pbNumEndpoints) ) - -#define ISoftUSBInterface_get_InterfaceClass(This,pbClass) \ - ( (This)->lpVtbl -> get_InterfaceClass(This,pbClass) ) - -#define ISoftUSBInterface_put_InterfaceClass(This,bClass) \ - ( (This)->lpVtbl -> put_InterfaceClass(This,bClass) ) - -#define ISoftUSBInterface_get_InterfaceSubClass(This,pbSubClass) \ - ( (This)->lpVtbl -> get_InterfaceSubClass(This,pbSubClass) ) - -#define ISoftUSBInterface_put_InterfaceSubClass(This,bSubClass) \ - ( (This)->lpVtbl -> put_InterfaceSubClass(This,bSubClass) ) - -#define ISoftUSBInterface_get_InterfaceProtocol(This,pbProtocol) \ - ( (This)->lpVtbl -> get_InterfaceProtocol(This,pbProtocol) ) - -#define ISoftUSBInterface_put_InterfaceProtocol(This,bProtocol) \ - ( (This)->lpVtbl -> put_InterfaceProtocol(This,bProtocol) ) - -#define ISoftUSBInterface_get_Interface(This,pbInterface) \ - ( (This)->lpVtbl -> get_Interface(This,pbInterface) ) - -#define ISoftUSBInterface_put_Interface(This,bInterface) \ - ( (This)->lpVtbl -> put_Interface(This,bInterface) ) - -#define ISoftUSBInterface_get_Endpoints(This,ppiEndPoints) \ - ( (This)->lpVtbl -> get_Endpoints(This,ppiEndPoints) ) - -#define ISoftUSBInterface_get_DeviceSpecificDescriptor(This,ppsaDevSpecData) \ - ( (This)->lpVtbl -> get_DeviceSpecificDescriptor(This,ppsaDevSpecData) ) - -#define ISoftUSBInterface_put_DeviceSpecificDescriptor(This,psaDevSpecData) \ - ( (This)->lpVtbl -> put_DeviceSpecificDescriptor(This,psaDevSpecData) ) - -#define ISoftUSBInterface_get_Context(This,ppContext) \ - ( (This)->lpVtbl -> get_Context(This,ppContext) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBInterface_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBEndpoint_INTERFACE_DEFINED__ -#define __ISoftUSBEndpoint_INTERFACE_DEFINED__ - -/* interface ISoftUSBEndpoint */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][dual][nonextensible][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBEndpoint; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("fd6ea833-81cb-4065-a219-8528bdcdc2e6") - ISoftUSBEndpoint : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Length( - /* [retval][out] */ __RPC__out BYTE *pbLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Length( - /* [in] */ BYTE bLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DescriptorType( - /* [retval][out] */ __RPC__out BYTE *pbDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DescriptorType( - /* [in] */ BYTE bDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_EndpointAddress( - /* [retval][out] */ __RPC__out BYTE *pbAddress) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_EndpointAddress( - /* [in] */ BYTE bAddress) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Attributes( - /* [retval][out] */ __RPC__out BYTE *pbAttributes) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Attributes( - /* [in] */ BYTE bAttributes) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_MaxPacketSize( - /* [retval][out] */ __RPC__out SHORT *psMaxPacket) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_MaxPacketSize( - /* [in] */ SHORT sMaxPacketSize) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Interval( - /* [retval][out] */ __RPC__out BYTE *pbInterval) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Interval( - /* [in] */ BYTE bInterval) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Halted( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pHalted) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Halted( - /* [in] */ VARIANT_BOOL Halted) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_MarshalEvents( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pMarshalEvents) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_MarshalEvents( - /* [in] */ VARIANT_BOOL MarshalEvents) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_OutQueueSize( - /* [retval][out] */ __RPC__out long *plOutQueueSize) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_OutQueueSize( - /* [in] */ long lOutQueueSize) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_LoopbackEndpoint( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBEndpoint **ppiSoftUSBEndpoint) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_LoopbackEndpoint( - /* [in] */ __RPC__in_opt ISoftUSBEndpoint *piSoftUSBEndpoint) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT __stdcall putref_LoopbackEndpoint( - /* [in] */ __RPC__in_opt ISoftUSBEndpoint *piSoftUSBEndpoint) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_HandleStdDeviceRequests( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pHandleStdRequests) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_HandleStdDeviceRequests( - /* [in] */ VARIANT_BOOL HandleStdRequests) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceSpecificDescriptor( - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaDevSpecData) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceSpecificDescriptor( - /* [in] */ __RPC__in SAFEARRAY * psaDevSpecData) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Context( - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFPropertyBag **ppContext) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring] */ HRESULT __stdcall QueueINData( - /* [in] */ __RPC__in BYTE *pbDataBuffer, - /* [in] */ ULONG cbDataBuffer, - /* [in] */ BYTE bStatus, - /* [in] */ ULONG ulTimeToLive) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall DrainOUTQueue( - /* [in] */ ULONG cMaxTransfers, - /* [out] */ __RPC__out ULONG *pcTransfersRemaining, - /* [out] */ __RPC__deref_out_opt SOFTUSB_OUT_TRANSFER **ppTransfers) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ void __stdcall FreeOUTQueue( - /* [in] */ __RPC__in void *pTransfers) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall QueueDeviceRequestResponse( - /* [in] */ __RPC__in USBSETUPREQUEST *pRequest, - /* [in] */ RequestMatchOpts MatchOpt, - /* [in] */ __RPC__in BYTE *pbResponseData, - /* [in] */ ULONG cbResponseData, - /* [in] */ BYTE FinalRequestStatus, - /* [in] */ ULONG ulTimeToLive) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall PurgeINQueue( void) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall PurgeOUTQueue( void) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall PurgeOUTQueueOlderThan( - /* [in] */ ULONG ulOlderThan) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_InQueueLength( - /* [retval][out] */ __RPC__out long *plInQueueLength) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBEndpointVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBEndpoint * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBEndpoint * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBEndpoint * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBEndpoint * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Length )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__out BYTE *pbLength); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Length )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ BYTE bLength); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DescriptorType )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__out BYTE *pbDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DescriptorType )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ BYTE bDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_EndpointAddress )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__out BYTE *pbAddress); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_EndpointAddress )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ BYTE bAddress); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Attributes )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__out BYTE *pbAttributes); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Attributes )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ BYTE bAttributes); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_MaxPacketSize )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__out SHORT *psMaxPacket); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_MaxPacketSize )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ SHORT sMaxPacketSize); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Interval )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__out BYTE *pbInterval); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Interval )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ BYTE bInterval); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Halted )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pHalted); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Halted )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ VARIANT_BOOL Halted); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_MarshalEvents )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pMarshalEvents); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_MarshalEvents )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ VARIANT_BOOL MarshalEvents); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_OutQueueSize )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__out long *plOutQueueSize); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_OutQueueSize )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ long lOutQueueSize); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_LoopbackEndpoint )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBEndpoint **ppiSoftUSBEndpoint); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_LoopbackEndpoint )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ __RPC__in_opt ISoftUSBEndpoint *piSoftUSBEndpoint); - - /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT ( __stdcall *putref_LoopbackEndpoint )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ __RPC__in_opt ISoftUSBEndpoint *piSoftUSBEndpoint); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_HandleStdDeviceRequests )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pHandleStdRequests); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_HandleStdDeviceRequests )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ VARIANT_BOOL HandleStdRequests); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceSpecificDescriptor )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__deref_out_opt SAFEARRAY * *ppsaDevSpecData); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceSpecificDescriptor )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ __RPC__in SAFEARRAY * psaDevSpecData); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Context )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFPropertyBag **ppContext); - - /* [helpstringcontext][helpcontext][helpstring] */ HRESULT ( __stdcall *QueueINData )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ __RPC__in BYTE *pbDataBuffer, - /* [in] */ ULONG cbDataBuffer, - /* [in] */ BYTE bStatus, - /* [in] */ ULONG ulTimeToLive); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *DrainOUTQueue )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ ULONG cMaxTransfers, - /* [out] */ __RPC__out ULONG *pcTransfersRemaining, - /* [out] */ __RPC__deref_out_opt SOFTUSB_OUT_TRANSFER **ppTransfers); - - /* [helpstringcontext][helpcontext][helpstring][id] */ void ( __stdcall *FreeOUTQueue )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ __RPC__in void *pTransfers); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *QueueDeviceRequestResponse )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ __RPC__in USBSETUPREQUEST *pRequest, - /* [in] */ RequestMatchOpts MatchOpt, - /* [in] */ __RPC__in BYTE *pbResponseData, - /* [in] */ ULONG cbResponseData, - /* [in] */ BYTE FinalRequestStatus, - /* [in] */ ULONG ulTimeToLive); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *PurgeINQueue )( - __RPC__in ISoftUSBEndpoint * This); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *PurgeOUTQueue )( - __RPC__in ISoftUSBEndpoint * This); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *PurgeOUTQueueOlderThan )( - __RPC__in ISoftUSBEndpoint * This, - /* [in] */ ULONG ulOlderThan); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_InQueueLength )( - __RPC__in ISoftUSBEndpoint * This, - /* [retval][out] */ __RPC__out long *plInQueueLength); - - END_INTERFACE - } ISoftUSBEndpointVtbl; - - interface ISoftUSBEndpoint - { - CONST_VTBL struct ISoftUSBEndpointVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBEndpoint_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBEndpoint_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBEndpoint_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBEndpoint_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBEndpoint_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBEndpoint_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBEndpoint_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBEndpoint_get_Length(This,pbLength) \ - ( (This)->lpVtbl -> get_Length(This,pbLength) ) - -#define ISoftUSBEndpoint_put_Length(This,bLength) \ - ( (This)->lpVtbl -> put_Length(This,bLength) ) - -#define ISoftUSBEndpoint_get_DescriptorType(This,pbDescriptorType) \ - ( (This)->lpVtbl -> get_DescriptorType(This,pbDescriptorType) ) - -#define ISoftUSBEndpoint_put_DescriptorType(This,bDescriptorType) \ - ( (This)->lpVtbl -> put_DescriptorType(This,bDescriptorType) ) - -#define ISoftUSBEndpoint_get_EndpointAddress(This,pbAddress) \ - ( (This)->lpVtbl -> get_EndpointAddress(This,pbAddress) ) - -#define ISoftUSBEndpoint_put_EndpointAddress(This,bAddress) \ - ( (This)->lpVtbl -> put_EndpointAddress(This,bAddress) ) - -#define ISoftUSBEndpoint_get_Attributes(This,pbAttributes) \ - ( (This)->lpVtbl -> get_Attributes(This,pbAttributes) ) - -#define ISoftUSBEndpoint_put_Attributes(This,bAttributes) \ - ( (This)->lpVtbl -> put_Attributes(This,bAttributes) ) - -#define ISoftUSBEndpoint_get_MaxPacketSize(This,psMaxPacket) \ - ( (This)->lpVtbl -> get_MaxPacketSize(This,psMaxPacket) ) - -#define ISoftUSBEndpoint_put_MaxPacketSize(This,sMaxPacketSize) \ - ( (This)->lpVtbl -> put_MaxPacketSize(This,sMaxPacketSize) ) - -#define ISoftUSBEndpoint_get_Interval(This,pbInterval) \ - ( (This)->lpVtbl -> get_Interval(This,pbInterval) ) - -#define ISoftUSBEndpoint_put_Interval(This,bInterval) \ - ( (This)->lpVtbl -> put_Interval(This,bInterval) ) - -#define ISoftUSBEndpoint_get_Halted(This,pHalted) \ - ( (This)->lpVtbl -> get_Halted(This,pHalted) ) - -#define ISoftUSBEndpoint_put_Halted(This,Halted) \ - ( (This)->lpVtbl -> put_Halted(This,Halted) ) - -#define ISoftUSBEndpoint_get_MarshalEvents(This,pMarshalEvents) \ - ( (This)->lpVtbl -> get_MarshalEvents(This,pMarshalEvents) ) - -#define ISoftUSBEndpoint_put_MarshalEvents(This,MarshalEvents) \ - ( (This)->lpVtbl -> put_MarshalEvents(This,MarshalEvents) ) - -#define ISoftUSBEndpoint_get_OutQueueSize(This,plOutQueueSize) \ - ( (This)->lpVtbl -> get_OutQueueSize(This,plOutQueueSize) ) - -#define ISoftUSBEndpoint_put_OutQueueSize(This,lOutQueueSize) \ - ( (This)->lpVtbl -> put_OutQueueSize(This,lOutQueueSize) ) - -#define ISoftUSBEndpoint_get_LoopbackEndpoint(This,ppiSoftUSBEndpoint) \ - ( (This)->lpVtbl -> get_LoopbackEndpoint(This,ppiSoftUSBEndpoint) ) - -#define ISoftUSBEndpoint_put_LoopbackEndpoint(This,piSoftUSBEndpoint) \ - ( (This)->lpVtbl -> put_LoopbackEndpoint(This,piSoftUSBEndpoint) ) - -#define ISoftUSBEndpoint_putref_LoopbackEndpoint(This,piSoftUSBEndpoint) \ - ( (This)->lpVtbl -> putref_LoopbackEndpoint(This,piSoftUSBEndpoint) ) - -#define ISoftUSBEndpoint_get_HandleStdDeviceRequests(This,pHandleStdRequests) \ - ( (This)->lpVtbl -> get_HandleStdDeviceRequests(This,pHandleStdRequests) ) - -#define ISoftUSBEndpoint_put_HandleStdDeviceRequests(This,HandleStdRequests) \ - ( (This)->lpVtbl -> put_HandleStdDeviceRequests(This,HandleStdRequests) ) - -#define ISoftUSBEndpoint_get_DeviceSpecificDescriptor(This,ppsaDevSpecData) \ - ( (This)->lpVtbl -> get_DeviceSpecificDescriptor(This,ppsaDevSpecData) ) - -#define ISoftUSBEndpoint_put_DeviceSpecificDescriptor(This,psaDevSpecData) \ - ( (This)->lpVtbl -> put_DeviceSpecificDescriptor(This,psaDevSpecData) ) - -#define ISoftUSBEndpoint_get_Context(This,ppContext) \ - ( (This)->lpVtbl -> get_Context(This,ppContext) ) - -#define ISoftUSBEndpoint_QueueINData(This,pbDataBuffer,cbDataBuffer,bStatus,ulTimeToLive) \ - ( (This)->lpVtbl -> QueueINData(This,pbDataBuffer,cbDataBuffer,bStatus,ulTimeToLive) ) - -#define ISoftUSBEndpoint_DrainOUTQueue(This,cMaxTransfers,pcTransfersRemaining,ppTransfers) \ - ( (This)->lpVtbl -> DrainOUTQueue(This,cMaxTransfers,pcTransfersRemaining,ppTransfers) ) - -#define ISoftUSBEndpoint_FreeOUTQueue(This,pTransfers) \ - ( (This)->lpVtbl -> FreeOUTQueue(This,pTransfers) ) - -#define ISoftUSBEndpoint_QueueDeviceRequestResponse(This,pRequest,MatchOpt,pbResponseData,cbResponseData,FinalRequestStatus,ulTimeToLive) \ - ( (This)->lpVtbl -> QueueDeviceRequestResponse(This,pRequest,MatchOpt,pbResponseData,cbResponseData,FinalRequestStatus,ulTimeToLive) ) - -#define ISoftUSBEndpoint_PurgeINQueue(This) \ - ( (This)->lpVtbl -> PurgeINQueue(This) ) - -#define ISoftUSBEndpoint_PurgeOUTQueue(This) \ - ( (This)->lpVtbl -> PurgeOUTQueue(This) ) - -#define ISoftUSBEndpoint_PurgeOUTQueueOlderThan(This,ulOlderThan) \ - ( (This)->lpVtbl -> PurgeOUTQueueOlderThan(This,ulOlderThan) ) - -#define ISoftUSBEndpoint_get_InQueueLength(This,plInQueueLength) \ - ( (This)->lpVtbl -> get_InQueueLength(This,plInQueueLength) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBEndpoint_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBDeviceQualifier_INTERFACE_DEFINED__ -#define __ISoftUSBDeviceQualifier_INTERFACE_DEFINED__ - -/* interface ISoftUSBDeviceQualifier */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBDeviceQualifier; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("a445e2cb-401f-4ac7-850f-579185d65140") - ISoftUSBDeviceQualifier : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Length( - /* [retval][out] */ __RPC__out BYTE *pbLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Length( - /* [in] */ BYTE bLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DescriptorType( - /* [retval][out] */ __RPC__out BYTE *pbDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DescriptorType( - /* [in] */ BYTE bDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_USB( - /* [retval][out] */ __RPC__out SHORT *psUSB) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_USB( - /* [in] */ SHORT sUSB) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceClass( - /* [retval][out] */ __RPC__out BYTE *pbDeviceClass) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceClass( - /* [in] */ BYTE bDeviceClass) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceSubClass( - /* [retval][out] */ __RPC__out BYTE *pbDeviceSubClass) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceSubClass( - /* [in] */ BYTE bDeviceSubClass) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceProtocol( - /* [retval][out] */ __RPC__out BYTE *pbProtocol) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceProtocol( - /* [in] */ BYTE bProtocol) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_MaxPacketSize0( - /* [retval][out] */ __RPC__out BYTE *pbMaxPacket) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_MaxPacketSize0( - /* [in] */ BYTE bMaxPacket) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_NumConfigurations( - /* [retval][out] */ __RPC__out BYTE *pbNumConfigs) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_NumConfigurations( - /* [in] */ BYTE bNumConfigs) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Reserved( - /* [retval][out] */ __RPC__out BYTE *pbReserved) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Reserved( - /* [in] */ BYTE bReserved) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBDeviceQualifierVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBDeviceQualifier * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBDeviceQualifier * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBDeviceQualifier * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Length )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [retval][out] */ __RPC__out BYTE *pbLength); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Length )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [in] */ BYTE bLength); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DescriptorType )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [retval][out] */ __RPC__out BYTE *pbDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DescriptorType )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [in] */ BYTE bDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_USB )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [retval][out] */ __RPC__out SHORT *psUSB); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_USB )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [in] */ SHORT sUSB); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceClass )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [retval][out] */ __RPC__out BYTE *pbDeviceClass); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceClass )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [in] */ BYTE bDeviceClass); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceSubClass )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [retval][out] */ __RPC__out BYTE *pbDeviceSubClass); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceSubClass )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [in] */ BYTE bDeviceSubClass); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceProtocol )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [retval][out] */ __RPC__out BYTE *pbProtocol); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceProtocol )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [in] */ BYTE bProtocol); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_MaxPacketSize0 )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [retval][out] */ __RPC__out BYTE *pbMaxPacket); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_MaxPacketSize0 )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [in] */ BYTE bMaxPacket); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_NumConfigurations )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [retval][out] */ __RPC__out BYTE *pbNumConfigs); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_NumConfigurations )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [in] */ BYTE bNumConfigs); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Reserved )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [retval][out] */ __RPC__out BYTE *pbReserved); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Reserved )( - __RPC__in ISoftUSBDeviceQualifier * This, - /* [in] */ BYTE bReserved); - - END_INTERFACE - } ISoftUSBDeviceQualifierVtbl; - - interface ISoftUSBDeviceQualifier - { - CONST_VTBL struct ISoftUSBDeviceQualifierVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBDeviceQualifier_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBDeviceQualifier_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBDeviceQualifier_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBDeviceQualifier_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBDeviceQualifier_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBDeviceQualifier_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBDeviceQualifier_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBDeviceQualifier_get_Length(This,pbLength) \ - ( (This)->lpVtbl -> get_Length(This,pbLength) ) - -#define ISoftUSBDeviceQualifier_put_Length(This,bLength) \ - ( (This)->lpVtbl -> put_Length(This,bLength) ) - -#define ISoftUSBDeviceQualifier_get_DescriptorType(This,pbDescriptorType) \ - ( (This)->lpVtbl -> get_DescriptorType(This,pbDescriptorType) ) - -#define ISoftUSBDeviceQualifier_put_DescriptorType(This,bDescriptorType) \ - ( (This)->lpVtbl -> put_DescriptorType(This,bDescriptorType) ) - -#define ISoftUSBDeviceQualifier_get_USB(This,psUSB) \ - ( (This)->lpVtbl -> get_USB(This,psUSB) ) - -#define ISoftUSBDeviceQualifier_put_USB(This,sUSB) \ - ( (This)->lpVtbl -> put_USB(This,sUSB) ) - -#define ISoftUSBDeviceQualifier_get_DeviceClass(This,pbDeviceClass) \ - ( (This)->lpVtbl -> get_DeviceClass(This,pbDeviceClass) ) - -#define ISoftUSBDeviceQualifier_put_DeviceClass(This,bDeviceClass) \ - ( (This)->lpVtbl -> put_DeviceClass(This,bDeviceClass) ) - -#define ISoftUSBDeviceQualifier_get_DeviceSubClass(This,pbDeviceSubClass) \ - ( (This)->lpVtbl -> get_DeviceSubClass(This,pbDeviceSubClass) ) - -#define ISoftUSBDeviceQualifier_put_DeviceSubClass(This,bDeviceSubClass) \ - ( (This)->lpVtbl -> put_DeviceSubClass(This,bDeviceSubClass) ) - -#define ISoftUSBDeviceQualifier_get_DeviceProtocol(This,pbProtocol) \ - ( (This)->lpVtbl -> get_DeviceProtocol(This,pbProtocol) ) - -#define ISoftUSBDeviceQualifier_put_DeviceProtocol(This,bProtocol) \ - ( (This)->lpVtbl -> put_DeviceProtocol(This,bProtocol) ) - -#define ISoftUSBDeviceQualifier_get_MaxPacketSize0(This,pbMaxPacket) \ - ( (This)->lpVtbl -> get_MaxPacketSize0(This,pbMaxPacket) ) - -#define ISoftUSBDeviceQualifier_put_MaxPacketSize0(This,bMaxPacket) \ - ( (This)->lpVtbl -> put_MaxPacketSize0(This,bMaxPacket) ) - -#define ISoftUSBDeviceQualifier_get_NumConfigurations(This,pbNumConfigs) \ - ( (This)->lpVtbl -> get_NumConfigurations(This,pbNumConfigs) ) - -#define ISoftUSBDeviceQualifier_put_NumConfigurations(This,bNumConfigs) \ - ( (This)->lpVtbl -> put_NumConfigurations(This,bNumConfigs) ) - -#define ISoftUSBDeviceQualifier_get_Reserved(This,pbReserved) \ - ( (This)->lpVtbl -> get_Reserved(This,pbReserved) ) - -#define ISoftUSBDeviceQualifier_put_Reserved(This,bReserved) \ - ( (This)->lpVtbl -> put_Reserved(This,bReserved) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBDeviceQualifier_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBEndpointEvents_INTERFACE_DEFINED__ -#define __ISoftUSBEndpointEvents_INTERFACE_DEFINED__ - -/* interface ISoftUSBEndpointEvents */ -/* [helpstringcontext][helpcontext][helpstring][object][nonextensible][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBEndpointEvents; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E6000897-6A14-4C06-A950-D069B8667091") - ISoftUSBEndpointEvents : public IUnknown - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall OnSetupTransfer( - /* [in] */ BYTE DataToggle, - /* [in] */ __RPC__in BYTE *pbDataBuffer, - /* [in] */ ULONG cbDataBuffer, - /* [out] */ __RPC__out BYTE *pbStatus) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall OnWriteTransfer( - /* [in] */ BYTE DataToggle, - /* [in] */ __RPC__in BYTE *pbDataBuffer, - /* [in] */ ULONG cbDataBuffer, - /* [out] */ __RPC__out BYTE *pbStatus) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall OnReadTransfer( - /* [in] */ BYTE DataToggle, - /* [out] */ __RPC__out BYTE *pbDataBuffer, - /* [in] */ ULONG cbDataBuffer, - /* [out] */ __RPC__out ULONG *cbDataWritten, - /* [out] */ __RPC__out BYTE *pbStatus) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall OnDeviceRequest( - /* [in] */ __RPC__in USBSETUPREQUEST *pSetupRequest, - /* [out] */ __RPC__out ULONG *RequestHandle, - /* [in] */ __RPC__in BYTE *pbRequestData, - /* [in] */ ULONG cbRequestData, - /* [out] */ __RPC__deref_out_opt BYTE **ppbResponseData, - /* [out] */ __RPC__out ULONG *pcbResponseData, - /* [out] */ __RPC__out BYTE *pbSetupStatus) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall OnDeviceRequestComplete( - /* [in] */ ULONG RequestHandle, - /* [out] */ __RPC__out BYTE *pbFinalRequestStatus) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBEndpointEventsVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBEndpointEvents * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBEndpointEvents * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBEndpointEvents * This); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *OnSetupTransfer )( - __RPC__in ISoftUSBEndpointEvents * This, - /* [in] */ BYTE DataToggle, - /* [in] */ __RPC__in BYTE *pbDataBuffer, - /* [in] */ ULONG cbDataBuffer, - /* [out] */ __RPC__out BYTE *pbStatus); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *OnWriteTransfer )( - __RPC__in ISoftUSBEndpointEvents * This, - /* [in] */ BYTE DataToggle, - /* [in] */ __RPC__in BYTE *pbDataBuffer, - /* [in] */ ULONG cbDataBuffer, - /* [out] */ __RPC__out BYTE *pbStatus); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *OnReadTransfer )( - __RPC__in ISoftUSBEndpointEvents * This, - /* [in] */ BYTE DataToggle, - /* [out] */ __RPC__out BYTE *pbDataBuffer, - /* [in] */ ULONG cbDataBuffer, - /* [out] */ __RPC__out ULONG *cbDataWritten, - /* [out] */ __RPC__out BYTE *pbStatus); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *OnDeviceRequest )( - __RPC__in ISoftUSBEndpointEvents * This, - /* [in] */ __RPC__in USBSETUPREQUEST *pSetupRequest, - /* [out] */ __RPC__out ULONG *RequestHandle, - /* [in] */ __RPC__in BYTE *pbRequestData, - /* [in] */ ULONG cbRequestData, - /* [out] */ __RPC__deref_out_opt BYTE **ppbResponseData, - /* [out] */ __RPC__out ULONG *pcbResponseData, - /* [out] */ __RPC__out BYTE *pbSetupStatus); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *OnDeviceRequestComplete )( - __RPC__in ISoftUSBEndpointEvents * This, - /* [in] */ ULONG RequestHandle, - /* [out] */ __RPC__out BYTE *pbFinalRequestStatus); - - END_INTERFACE - } ISoftUSBEndpointEventsVtbl; - - interface ISoftUSBEndpointEvents - { - CONST_VTBL struct ISoftUSBEndpointEventsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBEndpointEvents_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBEndpointEvents_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBEndpointEvents_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBEndpointEvents_OnSetupTransfer(This,DataToggle,pbDataBuffer,cbDataBuffer,pbStatus) \ - ( (This)->lpVtbl -> OnSetupTransfer(This,DataToggle,pbDataBuffer,cbDataBuffer,pbStatus) ) - -#define ISoftUSBEndpointEvents_OnWriteTransfer(This,DataToggle,pbDataBuffer,cbDataBuffer,pbStatus) \ - ( (This)->lpVtbl -> OnWriteTransfer(This,DataToggle,pbDataBuffer,cbDataBuffer,pbStatus) ) - -#define ISoftUSBEndpointEvents_OnReadTransfer(This,DataToggle,pbDataBuffer,cbDataBuffer,cbDataWritten,pbStatus) \ - ( (This)->lpVtbl -> OnReadTransfer(This,DataToggle,pbDataBuffer,cbDataBuffer,cbDataWritten,pbStatus) ) - -#define ISoftUSBEndpointEvents_OnDeviceRequest(This,pSetupRequest,RequestHandle,pbRequestData,cbRequestData,ppbResponseData,pcbResponseData,pbSetupStatus) \ - ( (This)->lpVtbl -> OnDeviceRequest(This,pSetupRequest,RequestHandle,pbRequestData,cbRequestData,ppbResponseData,pcbResponseData,pbSetupStatus) ) - -#define ISoftUSBEndpointEvents_OnDeviceRequestComplete(This,RequestHandle,pbFinalRequestStatus) \ - ( (This)->lpVtbl -> OnDeviceRequestComplete(This,RequestHandle,pbFinalRequestStatus) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBEndpointEvents_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBStrings_INTERFACE_DEFINED__ -#define __ISoftUSBStrings_INTERFACE_DEFINED__ - -/* interface ISoftUSBStrings */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBStrings; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("B8714568-8ED3-4FE9-ADED-82EAA467956A") - ISoftUSBStrings : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Count( - /* [retval][out] */ __RPC__out long *plCount) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Item( - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt SoftUSBString **ppSOFTUSBString) = 0; - - virtual /* [hidden][propget][id] */ HRESULT __stdcall get__NewEnum( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Add( - /* [in] */ __RPC__in SoftUSBString *pSOFTUSBString, - /* [optional][in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Remove( - /* [in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Clear( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBStringsVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBStrings * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBStrings * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBStrings * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBStrings * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBStrings * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBStrings * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBStrings * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Count )( - __RPC__in ISoftUSBStrings * This, - /* [retval][out] */ __RPC__out long *plCount); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Item )( - __RPC__in ISoftUSBStrings * This, - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt SoftUSBString **ppSOFTUSBString); - - /* [hidden][propget][id] */ HRESULT ( __stdcall *get__NewEnum )( - __RPC__in ISoftUSBStrings * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Add )( - __RPC__in ISoftUSBStrings * This, - /* [in] */ __RPC__in SoftUSBString *pSOFTUSBString, - /* [optional][in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Remove )( - __RPC__in ISoftUSBStrings * This, - /* [in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Clear )( - __RPC__in ISoftUSBStrings * This); - - END_INTERFACE - } ISoftUSBStringsVtbl; - - interface ISoftUSBStrings - { - CONST_VTBL struct ISoftUSBStringsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBStrings_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBStrings_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBStrings_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBStrings_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBStrings_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBStrings_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBStrings_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBStrings_get_Count(This,plCount) \ - ( (This)->lpVtbl -> get_Count(This,plCount) ) - -#define ISoftUSBStrings_get_Item(This,Index,ppSOFTUSBString) \ - ( (This)->lpVtbl -> get_Item(This,Index,ppSOFTUSBString) ) - -#define ISoftUSBStrings_get__NewEnum(This,ppunkEnum) \ - ( (This)->lpVtbl -> get__NewEnum(This,ppunkEnum) ) - -#define ISoftUSBStrings_Add(This,pSOFTUSBString,Index) \ - ( (This)->lpVtbl -> Add(This,pSOFTUSBString,Index) ) - -#define ISoftUSBStrings_Remove(This,Index) \ - ( (This)->lpVtbl -> Remove(This,Index) ) - -#define ISoftUSBStrings_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBStrings_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBInterfaces_INTERFACE_DEFINED__ -#define __ISoftUSBInterfaces_INTERFACE_DEFINED__ - -/* interface ISoftUSBInterfaces */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBInterfaces; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("450274FA-92A8-4FB1-A447-2CD3A45465A8") - ISoftUSBInterfaces : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Count( - /* [retval][out] */ __RPC__out long *plCount) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Item( - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt SoftUSBInterface **ppSOFTUSBInterface) = 0; - - virtual /* [hidden][propget][id] */ HRESULT __stdcall get__NewEnum( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Add( - /* [in] */ __RPC__in SoftUSBInterface *ppSOFTUSBInterface, - /* [optional][in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Remove( - /* [in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Clear( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBInterfacesVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBInterfaces * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBInterfaces * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBInterfaces * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBInterfaces * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBInterfaces * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBInterfaces * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBInterfaces * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Count )( - __RPC__in ISoftUSBInterfaces * This, - /* [retval][out] */ __RPC__out long *plCount); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Item )( - __RPC__in ISoftUSBInterfaces * This, - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt SoftUSBInterface **ppSOFTUSBInterface); - - /* [hidden][propget][id] */ HRESULT ( __stdcall *get__NewEnum )( - __RPC__in ISoftUSBInterfaces * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Add )( - __RPC__in ISoftUSBInterfaces * This, - /* [in] */ __RPC__in SoftUSBInterface *ppSOFTUSBInterface, - /* [optional][in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Remove )( - __RPC__in ISoftUSBInterfaces * This, - /* [in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Clear )( - __RPC__in ISoftUSBInterfaces * This); - - END_INTERFACE - } ISoftUSBInterfacesVtbl; - - interface ISoftUSBInterfaces - { - CONST_VTBL struct ISoftUSBInterfacesVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBInterfaces_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBInterfaces_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBInterfaces_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBInterfaces_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBInterfaces_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBInterfaces_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBInterfaces_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBInterfaces_get_Count(This,plCount) \ - ( (This)->lpVtbl -> get_Count(This,plCount) ) - -#define ISoftUSBInterfaces_get_Item(This,Index,ppSOFTUSBInterface) \ - ( (This)->lpVtbl -> get_Item(This,Index,ppSOFTUSBInterface) ) - -#define ISoftUSBInterfaces_get__NewEnum(This,ppunkEnum) \ - ( (This)->lpVtbl -> get__NewEnum(This,ppunkEnum) ) - -#define ISoftUSBInterfaces_Add(This,ppSOFTUSBInterface,Index) \ - ( (This)->lpVtbl -> Add(This,ppSOFTUSBInterface,Index) ) - -#define ISoftUSBInterfaces_Remove(This,Index) \ - ( (This)->lpVtbl -> Remove(This,Index) ) - -#define ISoftUSBInterfaces_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBInterfaces_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBEndpoints_INTERFACE_DEFINED__ -#define __ISoftUSBEndpoints_INTERFACE_DEFINED__ - -/* interface ISoftUSBEndpoints */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBEndpoints; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("797C784C-C45E-4DDD-9F21-5CBE273FA778") - ISoftUSBEndpoints : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Count( - /* [retval][out] */ __RPC__out long *plCount) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Item( - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt SoftUSBEndpoint **ppSOFTUSBEndpoint) = 0; - - virtual /* [hidden][propget][id] */ HRESULT __stdcall get__NewEnum( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Add( - /* [in] */ __RPC__in SoftUSBEndpoint *ppSOFTUSBEndpoint, - /* [optional][in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Remove( - /* [in] */ VARIANT Index) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Clear( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBEndpointsVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBEndpoints * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBEndpoints * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBEndpoints * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBEndpoints * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBEndpoints * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBEndpoints * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBEndpoints * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Count )( - __RPC__in ISoftUSBEndpoints * This, - /* [retval][out] */ __RPC__out long *plCount); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Item )( - __RPC__in ISoftUSBEndpoints * This, - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt SoftUSBEndpoint **ppSOFTUSBEndpoint); - - /* [hidden][propget][id] */ HRESULT ( __stdcall *get__NewEnum )( - __RPC__in ISoftUSBEndpoints * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Add )( - __RPC__in ISoftUSBEndpoints * This, - /* [in] */ __RPC__in SoftUSBEndpoint *ppSOFTUSBEndpoint, - /* [optional][in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Remove )( - __RPC__in ISoftUSBEndpoints * This, - /* [in] */ VARIANT Index); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Clear )( - __RPC__in ISoftUSBEndpoints * This); - - END_INTERFACE - } ISoftUSBEndpointsVtbl; - - interface ISoftUSBEndpoints - { - CONST_VTBL struct ISoftUSBEndpointsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBEndpoints_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBEndpoints_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBEndpoints_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBEndpoints_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBEndpoints_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBEndpoints_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBEndpoints_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBEndpoints_get_Count(This,plCount) \ - ( (This)->lpVtbl -> get_Count(This,plCount) ) - -#define ISoftUSBEndpoints_get_Item(This,Index,ppSOFTUSBEndpoint) \ - ( (This)->lpVtbl -> get_Item(This,Index,ppSOFTUSBEndpoint) ) - -#define ISoftUSBEndpoints_get__NewEnum(This,ppunkEnum) \ - ( (This)->lpVtbl -> get__NewEnum(This,ppunkEnum) ) - -#define ISoftUSBEndpoints_Add(This,ppSOFTUSBEndpoint,Index) \ - ( (This)->lpVtbl -> Add(This,ppSOFTUSBEndpoint,Index) ) - -#define ISoftUSBEndpoints_Remove(This,Index) \ - ( (This)->lpVtbl -> Remove(This,Index) ) - -#define ISoftUSBEndpoints_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBEndpoints_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBHub_INTERFACE_DEFINED__ -#define __ISoftUSBHub_INTERFACE_DEFINED__ - -/* interface ISoftUSBHub */ -/* [object][helpstringcontext][helpcontext][helpstring][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBHub; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("0442b742-2bd3-4b07-99d8-65b6395bcdb0") - ISoftUSBHub : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_NbrPorts( - /* [retval][out] */ __RPC__out BYTE *pbPorts) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_NbrPorts( - /* [in] */ BYTE bPorts) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_LogicalPowerSwitchingMode( - /* [retval][out] */ __RPC__out SoftUSBHubPowerSwitchingMode *pMode) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_LogicalPowerSwitchingMode( - /* [in] */ SoftUSBHubPowerSwitchingMode Mode) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_CompoundDevice( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarCompound) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_CompoundDevice( - /* [in] */ VARIANT_BOOL fvarCompound) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_OverCurrentProtectMode( - /* [retval][out] */ __RPC__out SoftUSBHubOverCurrentProtectionMode *pMode) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_OverCurrentProtectMode( - /* [in] */ SoftUSBHubOverCurrentProtectionMode Mode) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_TTThinkTime( - /* [retval][out] */ __RPC__out BYTE *pbThinkTime) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_TTThinkTime( - /* [in] */ BYTE bThinkTime) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_PortIndicatorsSupported( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarSupported) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_PortIndicatorsSupported( - /* [in] */ VARIANT_BOOL fvarSupported) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_PwrOn2PwrGood( - /* [retval][out] */ __RPC__out BYTE *pbTime2PwrGood) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_PwrOn2PwrGood( - /* [in] */ BYTE bTime2PwrGood) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_ContrCurrent( - /* [retval][out] */ __RPC__out BYTE *pbContrCurrent) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_ContrCurrent( - /* [in] */ BYTE bContrCurrent) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_LocalPowerSourceChange( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_LocalPowerSourceChange( - /* [in] */ VARIANT_BOOL fvarChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_OverCurrent( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOverCurrent) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_OverCurrent( - /* [in] */ VARIANT_BOOL fvarOverCurrent) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_OverCurrentChange( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOverCurrentChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_OverCurrentChange( - /* [in] */ VARIANT_BOOL fvarOverCurrentChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Status( - /* [retval][out] */ __RPC__out long *plStatus) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_RootHubPortNumber( - /* [retval][out] */ __RPC__out BYTE *pbPort) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_SoftUSBDevice( - /* [retval][out] */ __RPC__deref_out_opt SoftUSBDevice **ppSoftUSBDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Ports( - /* [retval][out] */ __RPC__deref_out_opt SoftUSBHubPorts **ppPorts) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Destroy( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBHubVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBHub * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBHub * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBHub * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBHub * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBHub * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBHub * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBHub * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_NbrPorts )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out BYTE *pbPorts); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_NbrPorts )( - __RPC__in ISoftUSBHub * This, - /* [in] */ BYTE bPorts); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_LogicalPowerSwitchingMode )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out SoftUSBHubPowerSwitchingMode *pMode); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_LogicalPowerSwitchingMode )( - __RPC__in ISoftUSBHub * This, - /* [in] */ SoftUSBHubPowerSwitchingMode Mode); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_CompoundDevice )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarCompound); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_CompoundDevice )( - __RPC__in ISoftUSBHub * This, - /* [in] */ VARIANT_BOOL fvarCompound); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_OverCurrentProtectMode )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out SoftUSBHubOverCurrentProtectionMode *pMode); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_OverCurrentProtectMode )( - __RPC__in ISoftUSBHub * This, - /* [in] */ SoftUSBHubOverCurrentProtectionMode Mode); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_TTThinkTime )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out BYTE *pbThinkTime); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_TTThinkTime )( - __RPC__in ISoftUSBHub * This, - /* [in] */ BYTE bThinkTime); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_PortIndicatorsSupported )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarSupported); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_PortIndicatorsSupported )( - __RPC__in ISoftUSBHub * This, - /* [in] */ VARIANT_BOOL fvarSupported); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_PwrOn2PwrGood )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out BYTE *pbTime2PwrGood); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_PwrOn2PwrGood )( - __RPC__in ISoftUSBHub * This, - /* [in] */ BYTE bTime2PwrGood); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_ContrCurrent )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out BYTE *pbContrCurrent); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_ContrCurrent )( - __RPC__in ISoftUSBHub * This, - /* [in] */ BYTE bContrCurrent); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_LocalPowerSourceChange )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarChange); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_LocalPowerSourceChange )( - __RPC__in ISoftUSBHub * This, - /* [in] */ VARIANT_BOOL fvarChange); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_OverCurrent )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOverCurrent); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_OverCurrent )( - __RPC__in ISoftUSBHub * This, - /* [in] */ VARIANT_BOOL fvarOverCurrent); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_OverCurrentChange )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOverCurrentChange); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_OverCurrentChange )( - __RPC__in ISoftUSBHub * This, - /* [in] */ VARIANT_BOOL fvarOverCurrentChange); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Status )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out long *plStatus); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_RootHubPortNumber )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__out BYTE *pbPort); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_SoftUSBDevice )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__deref_out_opt SoftUSBDevice **ppSoftUSBDevice); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Ports )( - __RPC__in ISoftUSBHub * This, - /* [retval][out] */ __RPC__deref_out_opt SoftUSBHubPorts **ppPorts); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Destroy )( - __RPC__in ISoftUSBHub * This); - - END_INTERFACE - } ISoftUSBHubVtbl; - - interface ISoftUSBHub - { - CONST_VTBL struct ISoftUSBHubVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBHub_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBHub_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBHub_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBHub_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBHub_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBHub_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBHub_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBHub_get_NbrPorts(This,pbPorts) \ - ( (This)->lpVtbl -> get_NbrPorts(This,pbPorts) ) - -#define ISoftUSBHub_put_NbrPorts(This,bPorts) \ - ( (This)->lpVtbl -> put_NbrPorts(This,bPorts) ) - -#define ISoftUSBHub_get_LogicalPowerSwitchingMode(This,pMode) \ - ( (This)->lpVtbl -> get_LogicalPowerSwitchingMode(This,pMode) ) - -#define ISoftUSBHub_put_LogicalPowerSwitchingMode(This,Mode) \ - ( (This)->lpVtbl -> put_LogicalPowerSwitchingMode(This,Mode) ) - -#define ISoftUSBHub_get_CompoundDevice(This,pfvarCompound) \ - ( (This)->lpVtbl -> get_CompoundDevice(This,pfvarCompound) ) - -#define ISoftUSBHub_put_CompoundDevice(This,fvarCompound) \ - ( (This)->lpVtbl -> put_CompoundDevice(This,fvarCompound) ) - -#define ISoftUSBHub_get_OverCurrentProtectMode(This,pMode) \ - ( (This)->lpVtbl -> get_OverCurrentProtectMode(This,pMode) ) - -#define ISoftUSBHub_put_OverCurrentProtectMode(This,Mode) \ - ( (This)->lpVtbl -> put_OverCurrentProtectMode(This,Mode) ) - -#define ISoftUSBHub_get_TTThinkTime(This,pbThinkTime) \ - ( (This)->lpVtbl -> get_TTThinkTime(This,pbThinkTime) ) - -#define ISoftUSBHub_put_TTThinkTime(This,bThinkTime) \ - ( (This)->lpVtbl -> put_TTThinkTime(This,bThinkTime) ) - -#define ISoftUSBHub_get_PortIndicatorsSupported(This,pfvarSupported) \ - ( (This)->lpVtbl -> get_PortIndicatorsSupported(This,pfvarSupported) ) - -#define ISoftUSBHub_put_PortIndicatorsSupported(This,fvarSupported) \ - ( (This)->lpVtbl -> put_PortIndicatorsSupported(This,fvarSupported) ) - -#define ISoftUSBHub_get_PwrOn2PwrGood(This,pbTime2PwrGood) \ - ( (This)->lpVtbl -> get_PwrOn2PwrGood(This,pbTime2PwrGood) ) - -#define ISoftUSBHub_put_PwrOn2PwrGood(This,bTime2PwrGood) \ - ( (This)->lpVtbl -> put_PwrOn2PwrGood(This,bTime2PwrGood) ) - -#define ISoftUSBHub_get_ContrCurrent(This,pbContrCurrent) \ - ( (This)->lpVtbl -> get_ContrCurrent(This,pbContrCurrent) ) - -#define ISoftUSBHub_put_ContrCurrent(This,bContrCurrent) \ - ( (This)->lpVtbl -> put_ContrCurrent(This,bContrCurrent) ) - -#define ISoftUSBHub_get_LocalPowerSourceChange(This,pfvarChange) \ - ( (This)->lpVtbl -> get_LocalPowerSourceChange(This,pfvarChange) ) - -#define ISoftUSBHub_put_LocalPowerSourceChange(This,fvarChange) \ - ( (This)->lpVtbl -> put_LocalPowerSourceChange(This,fvarChange) ) - -#define ISoftUSBHub_get_OverCurrent(This,pfvarOverCurrent) \ - ( (This)->lpVtbl -> get_OverCurrent(This,pfvarOverCurrent) ) - -#define ISoftUSBHub_put_OverCurrent(This,fvarOverCurrent) \ - ( (This)->lpVtbl -> put_OverCurrent(This,fvarOverCurrent) ) - -#define ISoftUSBHub_get_OverCurrentChange(This,pfvarOverCurrentChange) \ - ( (This)->lpVtbl -> get_OverCurrentChange(This,pfvarOverCurrentChange) ) - -#define ISoftUSBHub_put_OverCurrentChange(This,fvarOverCurrentChange) \ - ( (This)->lpVtbl -> put_OverCurrentChange(This,fvarOverCurrentChange) ) - -#define ISoftUSBHub_get_Status(This,plStatus) \ - ( (This)->lpVtbl -> get_Status(This,plStatus) ) - -#define ISoftUSBHub_get_RootHubPortNumber(This,pbPort) \ - ( (This)->lpVtbl -> get_RootHubPortNumber(This,pbPort) ) - -#define ISoftUSBHub_get_SoftUSBDevice(This,ppSoftUSBDevice) \ - ( (This)->lpVtbl -> get_SoftUSBDevice(This,ppSoftUSBDevice) ) - -#define ISoftUSBHub_get_Ports(This,ppPorts) \ - ( (This)->lpVtbl -> get_Ports(This,ppPorts) ) - -#define ISoftUSBHub_Destroy(This) \ - ( (This)->lpVtbl -> Destroy(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBHub_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBHubPorts_INTERFACE_DEFINED__ -#define __ISoftUSBHubPorts_INTERFACE_DEFINED__ - -/* interface ISoftUSBHubPorts */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBHubPorts; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("DBC9054B-5F42-459C-96EE-182073F8BD3E") - ISoftUSBHubPorts : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Count( - /* [retval][out] */ __RPC__out long *plCount) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Item( - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt SoftUSBHubPort **ppSoftUSBHubPort) = 0; - - virtual /* [hidden][propget][id] */ HRESULT __stdcall get__NewEnum( - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBHubPortsVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBHubPorts * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBHubPorts * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBHubPorts * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBHubPorts * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBHubPorts * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBHubPorts * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBHubPorts * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Count )( - __RPC__in ISoftUSBHubPorts * This, - /* [retval][out] */ __RPC__out long *plCount); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Item )( - __RPC__in ISoftUSBHubPorts * This, - /* [in] */ VARIANT Index, - /* [retval][out] */ __RPC__deref_out_opt SoftUSBHubPort **ppSoftUSBHubPort); - - /* [hidden][propget][id] */ HRESULT ( __stdcall *get__NewEnum )( - __RPC__in ISoftUSBHubPorts * This, - /* [retval][out] */ __RPC__deref_out_opt IUnknown **ppunkEnum); - - END_INTERFACE - } ISoftUSBHubPortsVtbl; - - interface ISoftUSBHubPorts - { - CONST_VTBL struct ISoftUSBHubPortsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBHubPorts_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBHubPorts_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBHubPorts_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBHubPorts_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBHubPorts_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBHubPorts_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBHubPorts_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBHubPorts_get_Count(This,plCount) \ - ( (This)->lpVtbl -> get_Count(This,plCount) ) - -#define ISoftUSBHubPorts_get_Item(This,Index,ppSoftUSBHubPort) \ - ( (This)->lpVtbl -> get_Item(This,Index,ppSoftUSBHubPort) ) - -#define ISoftUSBHubPorts_get__NewEnum(This,ppunkEnum) \ - ( (This)->lpVtbl -> get__NewEnum(This,ppunkEnum) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBHubPorts_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBHubPort_INTERFACE_DEFINED__ -#define __ISoftUSBHubPort_INTERFACE_DEFINED__ - -/* interface ISoftUSBHubPort */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBHubPort; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("11AE2FF8-4F47-4A14-85CA-0D13AC9F4A5A") - ISoftUSBHubPort : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceRemovable( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarRemovable) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceRemovable( - /* [in] */ VARIANT_BOOL fvarRemovable) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_PwrCtrl( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarPwrCtrl) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_PwrCtrl( - /* [in] */ VARIANT_BOOL fvarPwrCtrl) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_CurrentConnectStatus( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarStatus) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Enabled( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEnabled) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Enabled( - /* [in] */ VARIANT_BOOL fvarEnabled) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Suspend( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarSuspend) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Suspend( - /* [in] */ VARIANT_BOOL fvarSuspend) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_OverCurrent( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOverCurrent) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_OverCurrent( - /* [in] */ VARIANT_BOOL fvarOverCurrent) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Reset( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarReset) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Power( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarPower) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_AttachedDeviceSpeed( - /* [retval][out] */ __RPC__out SoftUSBHubSpeed *pSpeed) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_TestMode( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarTestMode) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_IndicatorControl( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarIndicatorControl) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Indicator( - /* [retval][out] */ __RPC__out SoftUSBHubIndicator *pIndicator) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_ConnectStatusChange( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarConnectStatusChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_ConnectStatusChange( - /* [in] */ VARIANT_BOOL fvarConnectStatusChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_EnableChange( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEnableChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_EnableChange( - /* [in] */ VARIANT_BOOL fvarEnableChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_SuspendChange( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarSuspendChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_SuspendChange( - /* [in] */ VARIANT_BOOL fvarSuspendChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_OverCurrentChange( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOverCurrentChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_OverCurrentChange( - /* [in] */ VARIANT_BOOL fvarOverCurrentChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_ResetChange( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarResetChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_ResetChange( - /* [in] */ VARIANT_BOOL fvarResetChange) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Status( - /* [retval][out] */ __RPC__out long *plStatus) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Device( - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFDevice **ppDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall HotPlug( - /* [in] */ __RPC__in /* external definition not present */ DSFDevice *pDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Unplug( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBHubPortVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBHubPort * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBHubPort * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBHubPort * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBHubPort * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceRemovable )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarRemovable); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceRemovable )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ VARIANT_BOOL fvarRemovable); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_PwrCtrl )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarPwrCtrl); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_PwrCtrl )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ VARIANT_BOOL fvarPwrCtrl); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_CurrentConnectStatus )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarStatus); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Enabled )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEnabled); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Enabled )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ VARIANT_BOOL fvarEnabled); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Suspend )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarSuspend); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Suspend )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ VARIANT_BOOL fvarSuspend); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_OverCurrent )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOverCurrent); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_OverCurrent )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ VARIANT_BOOL fvarOverCurrent); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Reset )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarReset); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Power )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarPower); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_AttachedDeviceSpeed )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out SoftUSBHubSpeed *pSpeed); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_TestMode )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarTestMode); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_IndicatorControl )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarIndicatorControl); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Indicator )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out SoftUSBHubIndicator *pIndicator); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_ConnectStatusChange )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarConnectStatusChange); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_ConnectStatusChange )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ VARIANT_BOOL fvarConnectStatusChange); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_EnableChange )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarEnableChange); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_EnableChange )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ VARIANT_BOOL fvarEnableChange); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_SuspendChange )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarSuspendChange); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_SuspendChange )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ VARIANT_BOOL fvarSuspendChange); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_OverCurrentChange )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarOverCurrentChange); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_OverCurrentChange )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ VARIANT_BOOL fvarOverCurrentChange); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_ResetChange )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarResetChange); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_ResetChange )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ VARIANT_BOOL fvarResetChange); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Status )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__out long *plStatus); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Device )( - __RPC__in ISoftUSBHubPort * This, - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFDevice **ppDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *HotPlug )( - __RPC__in ISoftUSBHubPort * This, - /* [in] */ __RPC__in /* external definition not present */ DSFDevice *pDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Unplug )( - __RPC__in ISoftUSBHubPort * This); - - END_INTERFACE - } ISoftUSBHubPortVtbl; - - interface ISoftUSBHubPort - { - CONST_VTBL struct ISoftUSBHubPortVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBHubPort_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBHubPort_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBHubPort_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBHubPort_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBHubPort_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBHubPort_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBHubPort_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBHubPort_get_DeviceRemovable(This,pfvarRemovable) \ - ( (This)->lpVtbl -> get_DeviceRemovable(This,pfvarRemovable) ) - -#define ISoftUSBHubPort_put_DeviceRemovable(This,fvarRemovable) \ - ( (This)->lpVtbl -> put_DeviceRemovable(This,fvarRemovable) ) - -#define ISoftUSBHubPort_get_PwrCtrl(This,pfvarPwrCtrl) \ - ( (This)->lpVtbl -> get_PwrCtrl(This,pfvarPwrCtrl) ) - -#define ISoftUSBHubPort_put_PwrCtrl(This,fvarPwrCtrl) \ - ( (This)->lpVtbl -> put_PwrCtrl(This,fvarPwrCtrl) ) - -#define ISoftUSBHubPort_get_CurrentConnectStatus(This,pfvarStatus) \ - ( (This)->lpVtbl -> get_CurrentConnectStatus(This,pfvarStatus) ) - -#define ISoftUSBHubPort_get_Enabled(This,pfvarEnabled) \ - ( (This)->lpVtbl -> get_Enabled(This,pfvarEnabled) ) - -#define ISoftUSBHubPort_put_Enabled(This,fvarEnabled) \ - ( (This)->lpVtbl -> put_Enabled(This,fvarEnabled) ) - -#define ISoftUSBHubPort_get_Suspend(This,pfvarSuspend) \ - ( (This)->lpVtbl -> get_Suspend(This,pfvarSuspend) ) - -#define ISoftUSBHubPort_put_Suspend(This,fvarSuspend) \ - ( (This)->lpVtbl -> put_Suspend(This,fvarSuspend) ) - -#define ISoftUSBHubPort_get_OverCurrent(This,pfvarOverCurrent) \ - ( (This)->lpVtbl -> get_OverCurrent(This,pfvarOverCurrent) ) - -#define ISoftUSBHubPort_put_OverCurrent(This,fvarOverCurrent) \ - ( (This)->lpVtbl -> put_OverCurrent(This,fvarOverCurrent) ) - -#define ISoftUSBHubPort_get_Reset(This,pfvarReset) \ - ( (This)->lpVtbl -> get_Reset(This,pfvarReset) ) - -#define ISoftUSBHubPort_get_Power(This,pfvarPower) \ - ( (This)->lpVtbl -> get_Power(This,pfvarPower) ) - -#define ISoftUSBHubPort_get_AttachedDeviceSpeed(This,pSpeed) \ - ( (This)->lpVtbl -> get_AttachedDeviceSpeed(This,pSpeed) ) - -#define ISoftUSBHubPort_get_TestMode(This,pfvarTestMode) \ - ( (This)->lpVtbl -> get_TestMode(This,pfvarTestMode) ) - -#define ISoftUSBHubPort_get_IndicatorControl(This,pfvarIndicatorControl) \ - ( (This)->lpVtbl -> get_IndicatorControl(This,pfvarIndicatorControl) ) - -#define ISoftUSBHubPort_get_Indicator(This,pIndicator) \ - ( (This)->lpVtbl -> get_Indicator(This,pIndicator) ) - -#define ISoftUSBHubPort_get_ConnectStatusChange(This,pfvarConnectStatusChange) \ - ( (This)->lpVtbl -> get_ConnectStatusChange(This,pfvarConnectStatusChange) ) - -#define ISoftUSBHubPort_put_ConnectStatusChange(This,fvarConnectStatusChange) \ - ( (This)->lpVtbl -> put_ConnectStatusChange(This,fvarConnectStatusChange) ) - -#define ISoftUSBHubPort_get_EnableChange(This,pfvarEnableChange) \ - ( (This)->lpVtbl -> get_EnableChange(This,pfvarEnableChange) ) - -#define ISoftUSBHubPort_put_EnableChange(This,fvarEnableChange) \ - ( (This)->lpVtbl -> put_EnableChange(This,fvarEnableChange) ) - -#define ISoftUSBHubPort_get_SuspendChange(This,pfvarSuspendChange) \ - ( (This)->lpVtbl -> get_SuspendChange(This,pfvarSuspendChange) ) - -#define ISoftUSBHubPort_put_SuspendChange(This,fvarSuspendChange) \ - ( (This)->lpVtbl -> put_SuspendChange(This,fvarSuspendChange) ) - -#define ISoftUSBHubPort_get_OverCurrentChange(This,pfvarOverCurrentChange) \ - ( (This)->lpVtbl -> get_OverCurrentChange(This,pfvarOverCurrentChange) ) - -#define ISoftUSBHubPort_put_OverCurrentChange(This,fvarOverCurrentChange) \ - ( (This)->lpVtbl -> put_OverCurrentChange(This,fvarOverCurrentChange) ) - -#define ISoftUSBHubPort_get_ResetChange(This,pfvarResetChange) \ - ( (This)->lpVtbl -> get_ResetChange(This,pfvarResetChange) ) - -#define ISoftUSBHubPort_put_ResetChange(This,fvarResetChange) \ - ( (This)->lpVtbl -> put_ResetChange(This,fvarResetChange) ) - -#define ISoftUSBHubPort_get_Status(This,plStatus) \ - ( (This)->lpVtbl -> get_Status(This,plStatus) ) - -#define ISoftUSBHubPort_get_Device(This,ppDSFDevice) \ - ( (This)->lpVtbl -> get_Device(This,ppDSFDevice) ) - -#define ISoftUSBHubPort_HotPlug(This,pDSFDevice) \ - ( (This)->lpVtbl -> HotPlug(This,pDSFDevice) ) - -#define ISoftUSBHubPort_Unplug(This) \ - ( (This)->lpVtbl -> Unplug(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBHubPort_INTERFACE_DEFINED__ */ - - -#ifndef __ISoftUSBDevice_INTERFACE_DEFINED__ -#define __ISoftUSBDevice_INTERFACE_DEFINED__ - -/* interface ISoftUSBDevice */ -/* [helpstringcontext][helpcontext][helpstring][object][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBDevice; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9ac61697-81ae-459a-8629-bf5d5a838519") - ISoftUSBDevice : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Endpoint0( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBEndpoint **ppiEndpoint0) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Length( - /* [retval][out] */ __RPC__out BYTE *pbLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Length( - /* [in] */ BYTE bLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DescriptorType( - /* [retval][out] */ __RPC__out BYTE *pbDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DescriptorType( - /* [in] */ BYTE bDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_USB( - /* [retval][out] */ __RPC__out SHORT *psUSB) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_USB( - /* [in] */ SHORT sUSB) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceClass( - /* [retval][out] */ __RPC__out BYTE *pbDeviceClass) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceClass( - /* [in] */ BYTE bDeviceClass) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceSubClass( - /* [retval][out] */ __RPC__out BYTE *pbDeviceSubClass) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceSubClass( - /* [in] */ BYTE bDeviceSubClass) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceProtocol( - /* [retval][out] */ __RPC__out BYTE *pbProtocol) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceProtocol( - /* [in] */ BYTE bProtocol) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_MaxPacketSize0( - /* [retval][out] */ __RPC__out BYTE *pbMaxPacket) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_MaxPacketSize0( - /* [in] */ BYTE bMaxPacket) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Vendor( - /* [retval][out] */ __RPC__out SHORT *psVendor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Vendor( - /* [in] */ SHORT sVendor) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Product( - /* [retval][out] */ __RPC__out SHORT *psProduct) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Product( - /* [in] */ SHORT sProduct) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Device( - /* [retval][out] */ __RPC__out SHORT *psDeviceNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Device( - /* [in] */ SHORT sDeviceNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Manufacturer( - /* [retval][out] */ __RPC__out BYTE *pbManufacturer) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Manufacturer( - /* [in] */ BYTE bManufacturer) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_ProductDesc( - /* [retval][out] */ __RPC__out BYTE *pbProductDesc) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_ProductDesc( - /* [in] */ BYTE bProductDesc) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_SerialNumber( - /* [retval][out] */ __RPC__out BYTE *pbSerialNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_SerialNumber( - /* [in] */ BYTE bSerialNumber) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_NumConfigurations( - /* [retval][out] */ __RPC__out BYTE *pbNumConfigs) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DeviceQualifier( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBDeviceQualifier **ppiDeviceQualifier) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DeviceQualifier( - /* [in] */ __RPC__in_opt ISoftUSBDeviceQualifier *piDeviceQualifier) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT __stdcall putref_DeviceQualifier( - /* [in] */ __RPC__in_opt ISoftUSBDeviceQualifier *piDeviceQualifier) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Configurations( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBConfigurations **ppiConfigurations) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_USB1xConfigurations( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBConfigurations **ppiUSB1xConfigurations) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_RemoteWakeup( - /* [in] */ VARIANT_BOOL RemoteWakeup) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_RemoteWakeup( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pRemoteWakeup) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Address( - /* [retval][out] */ __RPC__out BYTE *pbAddress) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_HasExternalPower( - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarPowered) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_HasExternalPower( - /* [in] */ VARIANT_BOOL fvarPowered) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_OperatingSpeed( - /* [retval][out] */ __RPC__out SoftUSBHubSpeed *pSpeed) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Configuration( - /* [retval][out] */ __RPC__out BYTE *pbConfig) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Strings( - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBStrings **ppiStrings) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DSFDevice( - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFDevice **ppDSFDevice) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Context( - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFPropertyBag **ppContext) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_State( - /* [retval][out] */ __RPC__out SoftUSBDeviceState *pState) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Resume( void) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT __stdcall Destroy( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBDeviceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBDevice * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBDevice * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBDevice * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBDevice * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Endpoint0 )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBEndpoint **ppiEndpoint0); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Length )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out BYTE *pbLength); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Length )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ BYTE bLength); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DescriptorType )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out BYTE *pbDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DescriptorType )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ BYTE bDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_USB )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out SHORT *psUSB); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_USB )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ SHORT sUSB); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceClass )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out BYTE *pbDeviceClass); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceClass )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ BYTE bDeviceClass); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceSubClass )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out BYTE *pbDeviceSubClass); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceSubClass )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ BYTE bDeviceSubClass); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceProtocol )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out BYTE *pbProtocol); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceProtocol )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ BYTE bProtocol); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_MaxPacketSize0 )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out BYTE *pbMaxPacket); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_MaxPacketSize0 )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ BYTE bMaxPacket); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Vendor )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out SHORT *psVendor); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Vendor )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ SHORT sVendor); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Product )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out SHORT *psProduct); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Product )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ SHORT sProduct); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Device )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out SHORT *psDeviceNumber); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Device )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ SHORT sDeviceNumber); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Manufacturer )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out BYTE *pbManufacturer); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Manufacturer )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ BYTE bManufacturer); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_ProductDesc )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out BYTE *pbProductDesc); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_ProductDesc )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ BYTE bProductDesc); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_SerialNumber )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out BYTE *pbSerialNumber); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_SerialNumber )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ BYTE bSerialNumber); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_NumConfigurations )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out BYTE *pbNumConfigs); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DeviceQualifier )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBDeviceQualifier **ppiDeviceQualifier); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DeviceQualifier )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ __RPC__in_opt ISoftUSBDeviceQualifier *piDeviceQualifier); - - /* [helpstringcontext][helpcontext][helpstring][propputref][id] */ HRESULT ( __stdcall *putref_DeviceQualifier )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ __RPC__in_opt ISoftUSBDeviceQualifier *piDeviceQualifier); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Configurations )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBConfigurations **ppiConfigurations); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_USB1xConfigurations )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBConfigurations **ppiUSB1xConfigurations); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_RemoteWakeup )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ VARIANT_BOOL RemoteWakeup); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_RemoteWakeup )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pRemoteWakeup); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Address )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out BYTE *pbAddress); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_HasExternalPower )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out VARIANT_BOOL *pfvarPowered); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_HasExternalPower )( - __RPC__in ISoftUSBDevice * This, - /* [in] */ VARIANT_BOOL fvarPowered); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_OperatingSpeed )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out SoftUSBHubSpeed *pSpeed); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Configuration )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out BYTE *pbConfig); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Strings )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__deref_out_opt ISoftUSBStrings **ppiStrings); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DSFDevice )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFDevice **ppDSFDevice); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Context )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__deref_out_opt /* external definition not present */ DSFPropertyBag **ppContext); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_State )( - __RPC__in ISoftUSBDevice * This, - /* [retval][out] */ __RPC__out SoftUSBDeviceState *pState); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Resume )( - __RPC__in ISoftUSBDevice * This); - - /* [helpstringcontext][helpcontext][helpstring][id] */ HRESULT ( __stdcall *Destroy )( - __RPC__in ISoftUSBDevice * This); - - END_INTERFACE - } ISoftUSBDeviceVtbl; - - interface ISoftUSBDevice - { - CONST_VTBL struct ISoftUSBDeviceVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBDevice_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBDevice_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBDevice_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBDevice_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBDevice_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBDevice_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBDevice_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBDevice_get_Endpoint0(This,ppiEndpoint0) \ - ( (This)->lpVtbl -> get_Endpoint0(This,ppiEndpoint0) ) - -#define ISoftUSBDevice_get_Length(This,pbLength) \ - ( (This)->lpVtbl -> get_Length(This,pbLength) ) - -#define ISoftUSBDevice_put_Length(This,bLength) \ - ( (This)->lpVtbl -> put_Length(This,bLength) ) - -#define ISoftUSBDevice_get_DescriptorType(This,pbDescriptorType) \ - ( (This)->lpVtbl -> get_DescriptorType(This,pbDescriptorType) ) - -#define ISoftUSBDevice_put_DescriptorType(This,bDescriptorType) \ - ( (This)->lpVtbl -> put_DescriptorType(This,bDescriptorType) ) - -#define ISoftUSBDevice_get_USB(This,psUSB) \ - ( (This)->lpVtbl -> get_USB(This,psUSB) ) - -#define ISoftUSBDevice_put_USB(This,sUSB) \ - ( (This)->lpVtbl -> put_USB(This,sUSB) ) - -#define ISoftUSBDevice_get_DeviceClass(This,pbDeviceClass) \ - ( (This)->lpVtbl -> get_DeviceClass(This,pbDeviceClass) ) - -#define ISoftUSBDevice_put_DeviceClass(This,bDeviceClass) \ - ( (This)->lpVtbl -> put_DeviceClass(This,bDeviceClass) ) - -#define ISoftUSBDevice_get_DeviceSubClass(This,pbDeviceSubClass) \ - ( (This)->lpVtbl -> get_DeviceSubClass(This,pbDeviceSubClass) ) - -#define ISoftUSBDevice_put_DeviceSubClass(This,bDeviceSubClass) \ - ( (This)->lpVtbl -> put_DeviceSubClass(This,bDeviceSubClass) ) - -#define ISoftUSBDevice_get_DeviceProtocol(This,pbProtocol) \ - ( (This)->lpVtbl -> get_DeviceProtocol(This,pbProtocol) ) - -#define ISoftUSBDevice_put_DeviceProtocol(This,bProtocol) \ - ( (This)->lpVtbl -> put_DeviceProtocol(This,bProtocol) ) - -#define ISoftUSBDevice_get_MaxPacketSize0(This,pbMaxPacket) \ - ( (This)->lpVtbl -> get_MaxPacketSize0(This,pbMaxPacket) ) - -#define ISoftUSBDevice_put_MaxPacketSize0(This,bMaxPacket) \ - ( (This)->lpVtbl -> put_MaxPacketSize0(This,bMaxPacket) ) - -#define ISoftUSBDevice_get_Vendor(This,psVendor) \ - ( (This)->lpVtbl -> get_Vendor(This,psVendor) ) - -#define ISoftUSBDevice_put_Vendor(This,sVendor) \ - ( (This)->lpVtbl -> put_Vendor(This,sVendor) ) - -#define ISoftUSBDevice_get_Product(This,psProduct) \ - ( (This)->lpVtbl -> get_Product(This,psProduct) ) - -#define ISoftUSBDevice_put_Product(This,sProduct) \ - ( (This)->lpVtbl -> put_Product(This,sProduct) ) - -#define ISoftUSBDevice_get_Device(This,psDeviceNumber) \ - ( (This)->lpVtbl -> get_Device(This,psDeviceNumber) ) - -#define ISoftUSBDevice_put_Device(This,sDeviceNumber) \ - ( (This)->lpVtbl -> put_Device(This,sDeviceNumber) ) - -#define ISoftUSBDevice_get_Manufacturer(This,pbManufacturer) \ - ( (This)->lpVtbl -> get_Manufacturer(This,pbManufacturer) ) - -#define ISoftUSBDevice_put_Manufacturer(This,bManufacturer) \ - ( (This)->lpVtbl -> put_Manufacturer(This,bManufacturer) ) - -#define ISoftUSBDevice_get_ProductDesc(This,pbProductDesc) \ - ( (This)->lpVtbl -> get_ProductDesc(This,pbProductDesc) ) - -#define ISoftUSBDevice_put_ProductDesc(This,bProductDesc) \ - ( (This)->lpVtbl -> put_ProductDesc(This,bProductDesc) ) - -#define ISoftUSBDevice_get_SerialNumber(This,pbSerialNumber) \ - ( (This)->lpVtbl -> get_SerialNumber(This,pbSerialNumber) ) - -#define ISoftUSBDevice_put_SerialNumber(This,bSerialNumber) \ - ( (This)->lpVtbl -> put_SerialNumber(This,bSerialNumber) ) - -#define ISoftUSBDevice_get_NumConfigurations(This,pbNumConfigs) \ - ( (This)->lpVtbl -> get_NumConfigurations(This,pbNumConfigs) ) - -#define ISoftUSBDevice_get_DeviceQualifier(This,ppiDeviceQualifier) \ - ( (This)->lpVtbl -> get_DeviceQualifier(This,ppiDeviceQualifier) ) - -#define ISoftUSBDevice_put_DeviceQualifier(This,piDeviceQualifier) \ - ( (This)->lpVtbl -> put_DeviceQualifier(This,piDeviceQualifier) ) - -#define ISoftUSBDevice_putref_DeviceQualifier(This,piDeviceQualifier) \ - ( (This)->lpVtbl -> putref_DeviceQualifier(This,piDeviceQualifier) ) - -#define ISoftUSBDevice_get_Configurations(This,ppiConfigurations) \ - ( (This)->lpVtbl -> get_Configurations(This,ppiConfigurations) ) - -#define ISoftUSBDevice_get_USB1xConfigurations(This,ppiUSB1xConfigurations) \ - ( (This)->lpVtbl -> get_USB1xConfigurations(This,ppiUSB1xConfigurations) ) - -#define ISoftUSBDevice_put_RemoteWakeup(This,RemoteWakeup) \ - ( (This)->lpVtbl -> put_RemoteWakeup(This,RemoteWakeup) ) - -#define ISoftUSBDevice_get_RemoteWakeup(This,pRemoteWakeup) \ - ( (This)->lpVtbl -> get_RemoteWakeup(This,pRemoteWakeup) ) - -#define ISoftUSBDevice_get_Address(This,pbAddress) \ - ( (This)->lpVtbl -> get_Address(This,pbAddress) ) - -#define ISoftUSBDevice_get_HasExternalPower(This,pfvarPowered) \ - ( (This)->lpVtbl -> get_HasExternalPower(This,pfvarPowered) ) - -#define ISoftUSBDevice_put_HasExternalPower(This,fvarPowered) \ - ( (This)->lpVtbl -> put_HasExternalPower(This,fvarPowered) ) - -#define ISoftUSBDevice_get_OperatingSpeed(This,pSpeed) \ - ( (This)->lpVtbl -> get_OperatingSpeed(This,pSpeed) ) - -#define ISoftUSBDevice_get_Configuration(This,pbConfig) \ - ( (This)->lpVtbl -> get_Configuration(This,pbConfig) ) - -#define ISoftUSBDevice_get_Strings(This,ppiStrings) \ - ( (This)->lpVtbl -> get_Strings(This,ppiStrings) ) - -#define ISoftUSBDevice_get_DSFDevice(This,ppDSFDevice) \ - ( (This)->lpVtbl -> get_DSFDevice(This,ppDSFDevice) ) - -#define ISoftUSBDevice_get_Context(This,ppContext) \ - ( (This)->lpVtbl -> get_Context(This,ppContext) ) - -#define ISoftUSBDevice_get_State(This,pState) \ - ( (This)->lpVtbl -> get_State(This,pState) ) - -#define ISoftUSBDevice_Resume(This) \ - ( (This)->lpVtbl -> Resume(This) ) - -#define ISoftUSBDevice_Destroy(This) \ - ( (This)->lpVtbl -> Destroy(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBDevice_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_SoftUSBDevice; - -#ifdef __cplusplus - -class DECLSPEC_UUID("23f4a589-a546-4ed4-b18b-fa427cde2ac5") -SoftUSBDevice; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBDeviceQualifier; - -#ifdef __cplusplus - -class DECLSPEC_UUID("97353e3a-cb00-4242-aaa7-b5efae55aab0") -SoftUSBDeviceQualifier; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBConfiguration; - -#ifdef __cplusplus - -class DECLSPEC_UUID("92cf5e08-ac7b-4100-8ef8-4f2487fc8b90") -SoftUSBConfiguration; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBInterface; - -#ifdef __cplusplus - -class DECLSPEC_UUID("e9b15f26-b117-4f4c-9489-26cf8041bf4d") -SoftUSBInterface; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBEndpoint; - -#ifdef __cplusplus - -class DECLSPEC_UUID("56D58287-C835-48A4-86A9-A0CBF8A8384A") -SoftUSBEndpoint; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBConfigurations; - -#ifdef __cplusplus - -class DECLSPEC_UUID("89D25542-A41B-49E1-9B80-2D3D28656541") -SoftUSBConfigurations; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBInterfaces; - -#ifdef __cplusplus - -class DECLSPEC_UUID("8BACAC01-DD39-4D96-88DC-25411C409E86") -SoftUSBInterfaces; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBEndpoints; - -#ifdef __cplusplus - -class DECLSPEC_UUID("5B538872-325E-48E6-8F83-EA5F1273A38E") -SoftUSBEndpoints; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBStrings; - -#ifdef __cplusplus - -class DECLSPEC_UUID("BA8EDA13-3019-4F40-8AEB-83051C28F313") -SoftUSBStrings; -#endif - -#ifndef __ISoftUSBString_INTERFACE_DEFINED__ -#define __ISoftUSBString_INTERFACE_DEFINED__ - -/* interface ISoftUSBString */ -/* [object][helpstringcontext][helpcontext][helpstring][hidden][nonextensible][oleautomation][dual][uuid] */ - - -EXTERN_C const IID IID_ISoftUSBString; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("3D6CC2C8-7EF0-40DD-9999-3071A7D3E6E0") - ISoftUSBString : public IDispatch - { - public: - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Value( - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrString) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Value( - /* [in] */ __RPC__in BSTR bstrString) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_Length( - /* [retval][out] */ __RPC__out BYTE *pbLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_Length( - /* [in] */ BYTE bLength) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT __stdcall get_DescriptorType( - /* [retval][out] */ __RPC__out BYTE *pbDescriptorType) = 0; - - virtual /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT __stdcall put_DescriptorType( - /* [in] */ BYTE bDescriptorType) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISoftUSBStringVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISoftUSBString * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISoftUSBString * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISoftUSBString * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - __RPC__in ISoftUSBString * This, - /* [out] */ __RPC__out UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - __RPC__in ISoftUSBString * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - __RPC__in ISoftUSBString * This, - /* [in] */ __RPC__in REFIID riid, - /* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames, - /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - ISoftUSBString * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Value )( - __RPC__in ISoftUSBString * This, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrString); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Value )( - __RPC__in ISoftUSBString * This, - /* [in] */ __RPC__in BSTR bstrString); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_Length )( - __RPC__in ISoftUSBString * This, - /* [retval][out] */ __RPC__out BYTE *pbLength); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_Length )( - __RPC__in ISoftUSBString * This, - /* [in] */ BYTE bLength); - - /* [helpstringcontext][helpcontext][helpstring][propget][id] */ HRESULT ( __stdcall *get_DescriptorType )( - __RPC__in ISoftUSBString * This, - /* [retval][out] */ __RPC__out BYTE *pbDescriptorType); - - /* [helpstringcontext][helpcontext][helpstring][propput][id] */ HRESULT ( __stdcall *put_DescriptorType )( - __RPC__in ISoftUSBString * This, - /* [in] */ BYTE bDescriptorType); - - END_INTERFACE - } ISoftUSBStringVtbl; - - interface ISoftUSBString - { - CONST_VTBL struct ISoftUSBStringVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISoftUSBString_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISoftUSBString_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISoftUSBString_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISoftUSBString_GetTypeInfoCount(This,pctinfo) \ - ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) - -#define ISoftUSBString_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) - -#define ISoftUSBString_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) - -#define ISoftUSBString_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) - - -#define ISoftUSBString_get_Value(This,pbstrString) \ - ( (This)->lpVtbl -> get_Value(This,pbstrString) ) - -#define ISoftUSBString_put_Value(This,bstrString) \ - ( (This)->lpVtbl -> put_Value(This,bstrString) ) - -#define ISoftUSBString_get_Length(This,pbLength) \ - ( (This)->lpVtbl -> get_Length(This,pbLength) ) - -#define ISoftUSBString_put_Length(This,bLength) \ - ( (This)->lpVtbl -> put_Length(This,bLength) ) - -#define ISoftUSBString_get_DescriptorType(This,pbDescriptorType) \ - ( (This)->lpVtbl -> get_DescriptorType(This,pbDescriptorType) ) - -#define ISoftUSBString_put_DescriptorType(This,bDescriptorType) \ - ( (This)->lpVtbl -> put_DescriptorType(This,bDescriptorType) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISoftUSBString_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_SoftUSBString; - -#ifdef __cplusplus - -class DECLSPEC_UUID("4D45AEA4-6FBE-4D81-B600-7511648520C7") -SoftUSBString; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBHub; - -#ifdef __cplusplus - -class DECLSPEC_UUID("4195454B-4ACE-44CD-B4B9-30CEE8D8951B") -SoftUSBHub; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBHubPorts; - -#ifdef __cplusplus - -class DECLSPEC_UUID("364C8DB9-665B-428A-840B-1D0CE777F05F") -SoftUSBHubPorts; -#endif - -EXTERN_C const CLSID CLSID_SoftUSBHubPort; - -#ifdef __cplusplus - -class DECLSPEC_UUID("736CD631-7F9D-4625-B693-F278E119FAD8") -SoftUSBHubPort; -#endif -#endif /* __SOFTUSB_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/srb.h b/pub/ddk/srb.h deleted file mode 100644 index c0473d2..0000000 --- a/pub/ddk/srb.h +++ /dev/null @@ -1,1521 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - srb.h - -Abstract: - - This file defines the interface between SCSI mini-port drivers and the - SCSI port driver. It is also used by SCSI class drivers to talk to the - SCSI port driver. - -Revision History: - ---*/ - -#ifndef _NTSRB_ -#define _NTSRB_ - -#pragma warning(push) -#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int -#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union - -#if DBG -#define DebugPrint(x) ScsiDebugPrint x -#else -#define DebugPrint(x) -#endif - -// begin_storport - -// -// Define SCSI maximum configuration parameters. -// - -#define SCSI_MAXIMUM_LOGICAL_UNITS 8 -#define SCSI_MAXIMUM_TARGETS_PER_BUS 128 -#define SCSI_MAXIMUM_LUNS_PER_TARGET 255 -#define SCSI_MAXIMUM_BUSES 8 -#define SCSI_MINIMUM_PHYSICAL_BREAKS 16 -#define SCSI_MAXIMUM_PHYSICAL_BREAKS 255 - -#define SCSI_COMBINE_BUS_TARGET( Bus, Target ) ( \ - ((((UCHAR) (Target)) & ~(0x20 - 1)) << 8) | \ - (((UCHAR) (Bus)) << 5) | \ - (((UCHAR) (Target)) & (0x20 - 1))) - -#define SCSI_DECODE_BUS_TARGET( Value, Bus, Target ) ( \ - Bus = (UCHAR) ((Value) >> 5), \ - Target = (UCHAR) ((((Value) >> 8) & ~(0x20 - 1)) | ((Value) & (0x20 - 1)))) - -// -// This constant is for backward compatibility. -// This use to be the maximum number of targets supported. -// - -#define SCSI_MAXIMUM_TARGETS 8 - -//end_storport - -typedef PHYSICAL_ADDRESS SCSI_PHYSICAL_ADDRESS, *PSCSI_PHYSICAL_ADDRESS; - -typedef struct _ACCESS_RANGE { - SCSI_PHYSICAL_ADDRESS RangeStart; - ULONG RangeLength; - BOOLEAN RangeInMemory; -}ACCESS_RANGE, *PACCESS_RANGE; - -// -// Configuration information structure. Contains the information necessary -// to initialize the adapter. NOTE: This structure's must be a multiple of -// quadwords. -// - -typedef struct _PORT_CONFIGURATION_INFORMATION { - - // - // Length of port configuation information strucuture. - // - - ULONG Length; - - // - // IO bus number (0 for machines that have only 1 IO bus - // - - ULONG SystemIoBusNumber; - - // - // EISA, MCA or ISA - // - - INTERFACE_TYPE AdapterInterfaceType; - - // - // Interrupt request level for device - // - - ULONG BusInterruptLevel; - - // - // Bus interrupt vector used with hardware buses which use as vector as - // well as level, such as internal buses. - // - - ULONG BusInterruptVector; - - // - // Interrupt mode (level-sensitive or edge-triggered) - // - - KINTERRUPT_MODE InterruptMode; - - // - // Maximum number of bytes that can be transferred in a single SRB - // - - ULONG MaximumTransferLength; - - // - // Number of contiguous blocks of physical memory - // - - ULONG NumberOfPhysicalBreaks; - - // - // DMA channel for devices using system DMA - // - - ULONG DmaChannel; - ULONG DmaPort; - DMA_WIDTH DmaWidth; - DMA_SPEED DmaSpeed; - - // - // Alignment masked required by the adapter for data transfers. - // - - ULONG AlignmentMask; - - // - // Number of access range elements which have been allocated. - // - - ULONG NumberOfAccessRanges; - - // - // Pointer to array of access range elements. - // - - ACCESS_RANGE (*AccessRanges)[]; - - // - // Reserved field. - // - - PVOID Reserved; - - // - // Number of SCSI buses attached to the adapter. - // - - UCHAR NumberOfBuses; - - // - // SCSI bus ID for adapter - // - - UCHAR InitiatorBusId[8]; - - // - // Indicates that the adapter does scatter/gather - // - - BOOLEAN ScatterGather; - - // - // Indicates that the adapter is a bus master - // - - BOOLEAN Master; - - // - // Host caches data or state. - // - - BOOLEAN CachesData; - - // - // Host adapter scans down for bios devices. - // - - BOOLEAN AdapterScansDown; - - // - // Primary at disk address (0x1F0) claimed. - // - - BOOLEAN AtdiskPrimaryClaimed; - - // - // Secondary at disk address (0x170) claimed. - // - - BOOLEAN AtdiskSecondaryClaimed; - - // - // The master uses 32-bit DMA addresses. - // - - BOOLEAN Dma32BitAddresses; - - // - // Use Demand Mode DMA rather than Single Request. - // - - BOOLEAN DemandMode; - - // - // Data buffers must be mapped into virtual address space. - // - - BOOLEAN MapBuffers; - - // - // The driver will need to tranlate virtual to physical addresses. - // - - BOOLEAN NeedPhysicalAddresses; - - // - // Supports tagged queuing - // - - BOOLEAN TaggedQueuing; - - // - // Supports auto request sense. - // - - BOOLEAN AutoRequestSense; - - // - // Supports multiple requests per logical unit. - // - - BOOLEAN MultipleRequestPerLu; - - // - // Support receive event function. - // - - BOOLEAN ReceiveEvent; - - // - // Indicates the real-mode driver has initialized the card. - // - - BOOLEAN RealModeInitialized; - - // - // Indicate that the miniport will not touch the data buffers directly. - // - - BOOLEAN BufferAccessScsiPortControlled; - - // - // Indicator for wide scsi. - // - - UCHAR MaximumNumberOfTargets; - - // - // Ensure quadword alignment. - // - - UCHAR ReservedUchars[2]; - - // - // Adapter slot number - // - - ULONG SlotNumber; - - // - // Interrupt information for a second IRQ. - // - - ULONG BusInterruptLevel2; - ULONG BusInterruptVector2; - KINTERRUPT_MODE InterruptMode2; - - // - // DMA information for a second channel. - // - - ULONG DmaChannel2; - ULONG DmaPort2; - DMA_WIDTH DmaWidth2; - DMA_SPEED DmaSpeed2; - - // - // Fields added to allow for the miniport - // to update these sizes based on requirements - // for large transfers ( > 64K); - // - - ULONG DeviceExtensionSize; - ULONG SpecificLuExtensionSize; - ULONG SrbExtensionSize; - - // - // Used to determine whether the system and/or the miniport support - // 64-bit physical addresses. See SCSI_DMA64_* flags below. - // - - UCHAR Dma64BitAddresses; /* New */ - - // - // Indicates that the miniport can accept a SRB_FUNCTION_RESET_DEVICE - // to clear all requests to a particular LUN. - // - - BOOLEAN ResetTargetSupported; /* New */ - - // - // Indicates that the miniport can support more than 8 logical units per - // target (maximum LUN number is one less than this field). - // - - UCHAR MaximumNumberOfLogicalUnits; /* New */ - - // - // Supports WMI? - // - - BOOLEAN WmiDataProvider; - -} PORT_CONFIGURATION_INFORMATION, *PPORT_CONFIGURATION_INFORMATION; - -// -// Version control for ConfigInfo structure. -// - -#define CONFIG_INFO_VERSION_2 sizeof(PORT_CONFIGURATION_INFORMATION) - - -// -// Flags for controlling 64-bit DMA use (PORT_CONFIGURATION_INFORMATION field -// Dma64BitAddresses) -// - -// -// Set by scsiport on entering HwFindAdapter if the system can support 64-bit -// physical addresses. The miniport can use this information before calling -// ScsiPortGetUncachedExtension to modify the DeviceExtensionSize, -// SpecificLuExtensionSize & SrbExtensionSize fields to account for the extra -// size of the scatter gather list. -// - -#define SCSI_DMA64_SYSTEM_SUPPORTED 0x80 - -// -// Set by the miniport before calling ScsiPortGetUncachedExtension to indicate -// that scsiport should provide it with 64-bit physical addresses. If the -// system does not support 64-bit PA's then this bit will be ignored. -// - -#define SCSI_DMA64_MINIPORT_SUPPORTED 0x01 - -#if (NTDDI_VERSION > NTDDI_WS03SP1) -// -// Set by the miniport before calling ScsiPortGetUncachedExtension to indicate -// that scsiport should provide it with 64-bit physical addresses. -// In addition to I/O requests being handled with > 4GB physical addresses, -// the uncached extension, SenseInof and Srb Extension may all lie above 4GB. -// If the system does not support 64-bit PA's then this bit will be ignored. -// - -#define SCSI_DMA64_MINIPORT_FULL64BIT_SUPPORTED 0x02 -#endif - - -// -// Command type (and parameter) definition(s) for AdapterControl requests. -// - -typedef enum _SCSI_ADAPTER_CONTROL_TYPE { - ScsiQuerySupportedControlTypes = 0, - ScsiStopAdapter, - ScsiRestartAdapter, - ScsiSetBootConfig, - ScsiSetRunningConfig, - ScsiAdapterControlMax, - MakeAdapterControlTypeSizeOfUlong = 0xffffffff -} SCSI_ADAPTER_CONTROL_TYPE, *PSCSI_ADAPTER_CONTROL_TYPE; - -// -// Adapter control status values -// - -typedef enum _SCSI_ADAPTER_CONTROL_STATUS { - ScsiAdapterControlSuccess = 0, - ScsiAdapterControlUnsuccessful -} SCSI_ADAPTER_CONTROL_STATUS, *PSCSI_ADAPTER_CONTROL_STATUS; - -// -// Parameters for Adapter Control Functions: -// - -// -// ScsiQuerySupportedControlTypes: -// - -#pragma warning(disable:4200) -typedef struct _SCSI_SUPPORTED_CONTROL_TYPE_LIST { - - // - // Specifies the number of entries in the adapter control type list. - // - - IN ULONG MaxControlType; - - // - // The miniport will set TRUE for each control type it supports. - // The number of entries in this array is defined by MaxAdapterControlType - // - the miniport must not attempt to set any AC types beyond the maximum - // value specified. - // - - OUT BOOLEAN SupportedTypeList[0]; - -} SCSI_SUPPORTED_CONTROL_TYPE_LIST, *PSCSI_SUPPORTED_CONTROL_TYPE_LIST; -#pragma warning(default:4200) - -// begin_storport - -// -// Uninitialized flag value. -// - -#define SP_UNINITIALIZED_VALUE ((ULONG) ~0) -#define SP_UNTAGGED ((UCHAR) ~0) - -// -// Set asynchronous events. -// - -#define SRBEV_BUS_RESET 0x0001 -#define SRBEV_SCSI_ASYNC_NOTIFICATION 0x0002 - -// begin_ntminitape - -#define MAXIMUM_CDB_SIZE 12 - -// -// SCSI I/O Request Block -// - -typedef struct _SCSI_REQUEST_BLOCK { - USHORT Length; // offset 0 - UCHAR Function; // offset 2 - UCHAR SrbStatus; // offset 3 - UCHAR ScsiStatus; // offset 4 - UCHAR PathId; // offset 5 - UCHAR TargetId; // offset 6 - UCHAR Lun; // offset 7 - UCHAR QueueTag; // offset 8 - UCHAR QueueAction; // offset 9 - UCHAR CdbLength; // offset a - UCHAR SenseInfoBufferLength; // offset b - ULONG SrbFlags; // offset c - ULONG DataTransferLength; // offset 10 - ULONG TimeOutValue; // offset 14 - __field_bcount(DataTransferLength) \ - PVOID DataBuffer; // offset 18 - PVOID SenseInfoBuffer; // offset 1c - struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20 - PVOID OriginalRequest; // offset 24 - PVOID SrbExtension; // offset 28 - union { - ULONG InternalStatus; // offset 2c - ULONG QueueSortKey; // offset 2c - ULONG LinkTimeoutValue; // offset 2c - }; - -#if defined(_WIN64) - - // - // Force PVOID alignment of Cdb - // - - ULONG Reserved; - -#endif - - UCHAR Cdb[16]; // offset 30 -} SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK; - -#define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK) - -// -// SCSI I/O Request Block for WMI Requests -// - -typedef struct _SCSI_WMI_REQUEST_BLOCK { - USHORT Length; - UCHAR Function; // SRB_FUNCTION_WMI - UCHAR SrbStatus; - UCHAR WMISubFunction; - UCHAR PathId; // If SRB_WMI_FLAGS_ADAPTER_REQUEST is set in - UCHAR TargetId; // WMIFlags then PathId, TargetId and Lun are - UCHAR Lun; // reserved fields. - UCHAR Reserved1; - UCHAR WMIFlags; - UCHAR Reserved2[2]; - ULONG SrbFlags; - ULONG DataTransferLength; - ULONG TimeOutValue; - PVOID DataBuffer; - PVOID DataPath; - PVOID Reserved3; - PVOID OriginalRequest; - PVOID SrbExtension; - ULONG Reserved4; - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -#if defined(_WIN64) - - // - // Force PVOID alignment of Cdb - // - - ULONG Reserved6; - -#endif -#endif - - UCHAR Reserved5[16]; -} SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK; - -typedef enum _STOR_DEVICE_POWER_STATE { - StorPowerDeviceUnspecified = 0, - StorPowerDeviceD0, - StorPowerDeviceD1, - StorPowerDeviceD2, - StorPowerDeviceD3, - StorPowerDeviceMaximum -} STOR_DEVICE_POWER_STATE, *PSTOR_DEVICE_POWER_STATE; - -typedef enum { - StorPowerActionNone = 0, - StorPowerActionReserved, - StorPowerActionSleep, - StorPowerActionHibernate, - StorPowerActionShutdown, - StorPowerActionShutdownReset, - StorPowerActionShutdownOff, - StorPowerActionWarmEject -} STOR_POWER_ACTION, *PSTOR_POWER_ACTION; - -typedef struct _SCSI_POWER_REQUEST_BLOCK { - USHORT Length; // offset 0 - UCHAR Function; // offset 2 - UCHAR SrbStatus; // offset 3 - UCHAR SrbPowerFlags; // offset 4 - UCHAR PathId; // offset 5 - UCHAR TargetId; // offset 6 - UCHAR Lun; // offset 7 - STOR_DEVICE_POWER_STATE DevicePowerState; // offset 8 - ULONG SrbFlags; // offset c - ULONG DataTransferLength; // offset 10 - ULONG TimeOutValue; // offset 14 - PVOID DataBuffer; // offset 18 - PVOID SenseInfoBuffer; // offset 1c - struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20 - PVOID OriginalRequest; // offset 24 - PVOID SrbExtension; // offset 28 - STOR_POWER_ACTION PowerAction; // offset 2c - -#if defined(_WIN64) - - // - // Force PVOID alignment of Cdb - // - - ULONG Reserved; - -#endif - - UCHAR Reserved5[16]; // offset 30 -} SCSI_POWER_REQUEST_BLOCK, *PSCSI_POWER_REQUEST_BLOCK; - -// -// PNP minor function codes. -// -typedef enum { - StorStartDevice = 0x0, - StorRemoveDevice = 0x2, - StorStopDevice = 0x4, - StorQueryCapabilities = 0x9, - StorQueryResourceRequirements = 0xB, - StorFilterResourceRequirements = 0xD, - StorSurpriseRemoval = 0x17 -} STOR_PNP_ACTION, *PSTOR_PNP_ACTION; - -typedef struct _STOR_DEVICE_CAPABILITIES { - USHORT Version; - ULONG DeviceD1:1; - ULONG DeviceD2:1; - ULONG LockSupported:1; - ULONG EjectSupported:1; - ULONG Removable:1; - ULONG DockDevice:1; - ULONG UniqueID:1; - ULONG SilentInstall:1; - ULONG SurpriseRemovalOK:1; - ULONG NoDisplayInUI:1; - -} STOR_DEVICE_CAPABILITIES, *PSTOR_DEVICE_CAPABILITIES; - -typedef struct _SCSI_PNP_REQUEST_BLOCK { - USHORT Length; // offset 0 - UCHAR Function; // offset 2 - UCHAR SrbStatus; // offset 3 - UCHAR PnPSubFunction; // offset 4 - UCHAR PathId; // offset 5 - UCHAR TargetId; // offset 6 - UCHAR Lun; // offset 7 - STOR_PNP_ACTION PnPAction; // offset 8 - ULONG SrbFlags; // offset c - ULONG DataTransferLength; // offset 10 - ULONG TimeOutValue; // offset 14 - PVOID DataBuffer; // offset 18 - PVOID SenseInfoBuffer; // offset 1c - struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20 - PVOID OriginalRequest; // offset 24 - PVOID SrbExtension; // offset 28 - ULONG SrbPnPFlags; // offset 2c - -#if defined(_WIN64) - - // - // Force PVOID alignment of Cdb - // - - ULONG Reserved; - -#endif - UCHAR Reserved4[16]; // offset 30 -} SCSI_PNP_REQUEST_BLOCK, *PSCSI_PNP_REQUEST_BLOCK; - - -// -// SRB Functions -// - -#define SRB_FUNCTION_EXECUTE_SCSI 0x00 -#define SRB_FUNCTION_CLAIM_DEVICE 0x01 -#define SRB_FUNCTION_IO_CONTROL 0x02 -#define SRB_FUNCTION_RECEIVE_EVENT 0x03 -#define SRB_FUNCTION_RELEASE_QUEUE 0x04 -#define SRB_FUNCTION_ATTACH_DEVICE 0x05 -#define SRB_FUNCTION_RELEASE_DEVICE 0x06 -#define SRB_FUNCTION_SHUTDOWN 0x07 -#define SRB_FUNCTION_FLUSH 0x08 -#define SRB_FUNCTION_ABORT_COMMAND 0x10 -#define SRB_FUNCTION_RELEASE_RECOVERY 0x11 -#define SRB_FUNCTION_RESET_BUS 0x12 -#define SRB_FUNCTION_RESET_DEVICE 0x13 -#define SRB_FUNCTION_TERMINATE_IO 0x14 -#define SRB_FUNCTION_FLUSH_QUEUE 0x15 -#define SRB_FUNCTION_REMOVE_DEVICE 0x16 -#define SRB_FUNCTION_WMI 0x17 -#define SRB_FUNCTION_LOCK_QUEUE 0x18 -#define SRB_FUNCTION_UNLOCK_QUEUE 0x19 -#define SRB_FUNCTION_RESET_LOGICAL_UNIT 0x20 -#define SRB_FUNCTION_SET_LINK_TIMEOUT 0x21 -#define SRB_FUNCTION_LINK_TIMEOUT_OCCURRED 0x22 -#define SRB_FUNCTION_LINK_TIMEOUT_COMPLETE 0x23 -#define SRB_FUNCTION_POWER 0x24 -#define SRB_FUNCTION_PNP 0x25 -#define SRB_FUNCTION_DUMP_POINTERS 0x26 -// -// SRB Status -// - -#define SRB_STATUS_PENDING 0x00 -#define SRB_STATUS_SUCCESS 0x01 -#define SRB_STATUS_ABORTED 0x02 -#define SRB_STATUS_ABORT_FAILED 0x03 -#define SRB_STATUS_ERROR 0x04 -#define SRB_STATUS_BUSY 0x05 -#define SRB_STATUS_INVALID_REQUEST 0x06 -#define SRB_STATUS_INVALID_PATH_ID 0x07 -#define SRB_STATUS_NO_DEVICE 0x08 -#define SRB_STATUS_TIMEOUT 0x09 -#define SRB_STATUS_SELECTION_TIMEOUT 0x0A -#define SRB_STATUS_COMMAND_TIMEOUT 0x0B -#define SRB_STATUS_MESSAGE_REJECTED 0x0D -#define SRB_STATUS_BUS_RESET 0x0E -#define SRB_STATUS_PARITY_ERROR 0x0F -#define SRB_STATUS_REQUEST_SENSE_FAILED 0x10 -#define SRB_STATUS_NO_HBA 0x11 -#define SRB_STATUS_DATA_OVERRUN 0x12 -#define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13 -#define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14 -#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15 -#define SRB_STATUS_REQUEST_FLUSHED 0x16 -#define SRB_STATUS_INVALID_LUN 0x20 -#define SRB_STATUS_INVALID_TARGET_ID 0x21 -#define SRB_STATUS_BAD_FUNCTION 0x22 -#define SRB_STATUS_ERROR_RECOVERY 0x23 -#define SRB_STATUS_NOT_POWERED 0x24 -#define SRB_STATUS_LINK_DOWN 0x25 - -// -// This value is used by the port driver to indicate that a non-scsi-related -// error occured. Miniports must never return this status. -// - -#define SRB_STATUS_INTERNAL_ERROR 0x30 - -// -// Srb status values 0x38 through 0x3f are reserved for internal port driver -// use. -// - - - -// -// SRB Status Masks -// - -#define SRB_STATUS_QUEUE_FROZEN 0x40 -#define SRB_STATUS_AUTOSENSE_VALID 0x80 - -#define SRB_STATUS(Status) (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN)) - -// -// SRB Flag Bits -// - -#define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002 -#define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004 -#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008 - -#define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010 -#define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020 -#define SRB_FLAGS_DATA_IN 0x00000040 -#define SRB_FLAGS_DATA_OUT 0x00000080 -#define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000 -#define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT) - -#define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100 -#define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200 -#define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400 - -#define SRB_FLAGS_IS_ACTIVE 0x00010000 -#define SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000 -#define SRB_FLAGS_SGLIST_FROM_POOL 0x00040000 -#define SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000 - -#define SRB_FLAGS_NO_KEEP_AWAKE 0x00100000 -#define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000 - -#define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000 -#define SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000 - -#define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000 -#define SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000 - -#if DBG==1 -// -// A signature used to validate the scsi port number -// at the end of a sense buffer. -// -#define SCSI_PORT_SIGNATURE 0x54524f50 -#endif - -// -// Queue Action -// - -#define SRB_SIMPLE_TAG_REQUEST 0x20 -#define SRB_HEAD_OF_QUEUE_TAG_REQUEST 0x21 -#define SRB_ORDERED_QUEUE_TAG_REQUEST 0x22 - -#define SRB_WMI_FLAGS_ADAPTER_REQUEST 0x01 -#define SRB_POWER_FLAGS_ADAPTER_REQUEST 0x01 -#define SRB_PNP_FLAGS_ADAPTER_REQUEST 0x01 - -// end_ntminitape - -// end_storport - -// -// SCSI Adapter Dependent Routines -// - -typedef -__checkReturn -BOOLEAN -(*PHW_INITIALIZE) ( - __in PVOID DeviceExtension - ); - -typedef -__checkReturn -BOOLEAN -(*PHW_STARTIO) ( - __in PVOID DeviceExtension, - __in PSCSI_REQUEST_BLOCK Srb - ); - -typedef -__checkReturn -BOOLEAN -(*PHW_INTERRUPT) ( - __in PVOID DeviceExtension - ); - -typedef -VOID -(*PHW_TIMER) ( - __in PVOID DeviceExtension - ); - -typedef -VOID -(*PHW_DMA_STARTED) ( - __in PVOID DeviceExtension - ); - -typedef -__checkReturn -ULONG -(*PHW_FIND_ADAPTER) ( - __in PVOID DeviceExtension, - __in PVOID HwContext, - __in PVOID BusInformation, - __in PCHAR ArgumentString, - __inout PPORT_CONFIGURATION_INFORMATION ConfigInfo, - __out PBOOLEAN Again - ); - -typedef -__checkReturn -BOOLEAN -(*PHW_RESET_BUS) ( - __in PVOID DeviceExtension, - __in ULONG PathId - ); - -typedef -__checkReturn -BOOLEAN -(*PHW_ADAPTER_STATE) ( - __in PVOID DeviceExtension, - __in PVOID Context, - __in BOOLEAN SaveState - ); - -typedef -__checkReturn -SCSI_ADAPTER_CONTROL_STATUS -(*PHW_ADAPTER_CONTROL) ( - __in PVOID DeviceExtension, - __in SCSI_ADAPTER_CONTROL_TYPE ControlType, - __in PVOID Parameters - ); - -// -// Port driver error codes -// - -#define SP_BUS_PARITY_ERROR 0x0001 -#define SP_UNEXPECTED_DISCONNECT 0x0002 -#define SP_INVALID_RESELECTION 0x0003 -#define SP_BUS_TIME_OUT 0x0004 -#define SP_PROTOCOL_ERROR 0x0005 -#define SP_INTERNAL_ADAPTER_ERROR 0x0006 -#define SP_REQUEST_TIMEOUT 0x0007 -#define SP_IRQ_NOT_RESPONDING 0x0008 -#define SP_BAD_FW_WARNING 0x0009 -#define SP_BAD_FW_ERROR 0x000a -#define SP_LOST_WMI_MINIPORT_REQUEST 0x000b - -// -// Port driver version flags -// -#define SP_VER_TRACE_SUPPORT 0x0010 - -// -// Return values for SCSI_HW_FIND_ADAPTER. -// - -#define SP_RETURN_NOT_FOUND 0 -#define SP_RETURN_FOUND 1 -#define SP_RETURN_ERROR 2 -#define SP_RETURN_BAD_CONFIG 3 - -// -// Notification Event Types -// - -typedef enum _SCSI_NOTIFICATION_TYPE { - RequestComplete, - NextRequest, - NextLuRequest, - ResetDetected, - CallDisableInterrupts, - CallEnableInterrupts, - RequestTimerCall, - BusChangeDetected, /* New */ - WMIEvent, - WMIReregister, - LinkUp, - LinkDown, - QueryTickCount, - BufferOverrunDetected, - TraceNotification /* New */ -} SCSI_NOTIFICATION_TYPE, *PSCSI_NOTIFICATION_TYPE; - -// -// Structure passed between miniport initialization -// and SCSI port initialization -// - -typedef struct _HW_INITIALIZATION_DATA { - - ULONG HwInitializationDataSize; - - // - // Adapter interface type: - // - // Internal - // Isa - // Eisa - // MicroChannel - // TurboChannel - // PCIBus - // VMEBus - // NuBus - // PCMCIABus - // CBus - // MPIBus - // MPSABus - // - - INTERFACE_TYPE AdapterInterfaceType; - - // - // Miniport driver routines - // - - PHW_INITIALIZE HwInitialize; - - PHW_STARTIO HwStartIo; - - PHW_INTERRUPT HwInterrupt; - - PHW_FIND_ADAPTER HwFindAdapter; - - PHW_RESET_BUS HwResetBus; - - PHW_DMA_STARTED HwDmaStarted; - - PHW_ADAPTER_STATE HwAdapterState; - - // - // Miniport driver resources - // - - ULONG DeviceExtensionSize; - - ULONG SpecificLuExtensionSize; - - ULONG SrbExtensionSize; - - ULONG NumberOfAccessRanges; - - PVOID Reserved; - - // - // Data buffers must be mapped into virtual address space. - // - - BOOLEAN MapBuffers; - - // - // The driver will need to tranlate virtual to physical addresses. - // - - BOOLEAN NeedPhysicalAddresses; - - // - // Supports tagged queuing - // - - BOOLEAN TaggedQueuing; - - // - // Supports auto request sense. - // - - BOOLEAN AutoRequestSense; - - // - // Supports multiple requests per logical unit. - // - - BOOLEAN MultipleRequestPerLu; - - // - // Support receive event function. - // - - BOOLEAN ReceiveEvent; - - // - // Vendor identification length - // - - USHORT VendorIdLength; - - // - // Vendor identification - // - - PVOID VendorId; - - // - // Pad for alignment and future use. - // - - union { - - USHORT ReservedUshort; - - // - // Flags to indicate supported features - // - USHORT PortVersionFlags; - }; - - // - // Device identification length - // - - USHORT DeviceIdLength; - - // - // Device identification - // - - PVOID DeviceId; - - // - // Stop adapter routine. - // - - PHW_ADAPTER_CONTROL HwAdapterControl; - -} HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA; - -// begin_ntminitape - -#ifndef _NTDDK_ -#define SCSIPORT_API DECLSPEC_IMPORT -#else -#define SCSIPORT_API -#endif - -// end_ntminitape - -// -// Port driver routines called by miniport driver -// - -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -SCSIPORT_API -ULONG -ScsiPortInitialize( - __in PVOID Argument1, - __in PVOID Argument2, - __in struct _HW_INITIALIZATION_DATA *HwInitializationData, - __in PVOID HwContext - ); - -SCSIPORT_API -VOID -ScsiPortFreeDeviceBase( - __in PVOID HwDeviceExtension, - __in PVOID MappedAddress - ); - -__checkReturn -SCSIPORT_API -ULONG -ScsiPortGetBusData( - __in PVOID DeviceExtension, - __in ULONG BusDataType, - __in ULONG SystemIoBusNumber, - __in ULONG SlotNumber, - __in_bcount(Length) PVOID Buffer, - __in ULONG Length - ); - -__checkReturn -SCSIPORT_API -ULONG -ScsiPortSetBusDataByOffset( - __in PVOID DeviceExtension, - __in ULONG BusDataType, - __in ULONG SystemIoBusNumber, - __in ULONG SlotNumber, - __in_bcount(Length) PVOID Buffer, - __in ULONG Offset, - __in ULONG Length - ); - -__checkReturn -SCSIPORT_API -PVOID -ScsiPortGetDeviceBase( - __in PVOID HwDeviceExtension, - __in INTERFACE_TYPE BusType, - __in ULONG SystemIoBusNumber, - __in SCSI_PHYSICAL_ADDRESS IoAddress, - __in ULONG NumberOfBytes, - __in BOOLEAN InIoSpace - ); - -__checkReturn -SCSIPORT_API -PVOID -ScsiPortGetLogicalUnit( - __in PVOID HwDeviceExtension, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun - ); - -__checkReturn -SCSIPORT_API -PSCSI_REQUEST_BLOCK -ScsiPortGetSrb( - __in PVOID DeviceExtension, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun, - __in LONG QueueTag - ); - -__checkReturn -SCSIPORT_API -SCSI_PHYSICAL_ADDRESS -ScsiPortGetPhysicalAddress( - __in PVOID HwDeviceExtension, - __in PSCSI_REQUEST_BLOCK Srb, - __in PVOID VirtualAddress, - __out ULONG *Length - ); - -__checkReturn -SCSIPORT_API -PVOID -ScsiPortGetVirtualAddress( - __in PVOID HwDeviceExtension, - __in SCSI_PHYSICAL_ADDRESS PhysicalAddress - ); - -__checkReturn -SCSIPORT_API -PVOID -ScsiPortGetUncachedExtension( - __in PVOID HwDeviceExtension, - __in PPORT_CONFIGURATION_INFORMATION ConfigInfo, - __in ULONG NumberOfBytes - ); - -SCSIPORT_API -VOID -ScsiPortFlushDma( - __in PVOID DeviceExtension - ); - -SCSIPORT_API -VOID -ScsiPortIoMapTransfer( - __in PVOID HwDeviceExtension, - __in PSCSI_REQUEST_BLOCK Srb, - __in PVOID LogicalAddress, - __in ULONG Length - ); - -SCSIPORT_API -VOID -ScsiPortNotification( - __in SCSI_NOTIFICATION_TYPE NotificationType, - __in PVOID HwDeviceExtension, - ... - ); - -SCSIPORT_API -VOID -ScsiPortLogError( - __in PVOID HwDeviceExtension, - __in PSCSI_REQUEST_BLOCK Srb OPTIONAL, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun, - __in ULONG ErrorCode, - __in ULONG UniqueId - ); - -SCSIPORT_API -VOID -ScsiPortCompleteRequest( - __in PVOID HwDeviceExtension, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun, - __in UCHAR SrbStatus - ); - -SCSIPORT_API -VOID -ScsiPortStallExecution( - __in ULONG Delay - ); - -#if defined(_M_AMD64) - -#define ScsiPortReadPortUchar READ_PORT_UCHAR -#define ScsiPortReadPortUshort READ_PORT_USHORT -#define ScsiPortReadPortUlong READ_PORT_ULONG - -#define ScsiPortReadPortBufferUchar READ_PORT_BUFFER_UCHAR -#define ScsiPortReadPortBufferUshort READ_PORT_BUFFER_USHORT -#define ScsiPortReadPortBufferUlong READ_PORT_BUFFER_ULONG - -#define ScsiPortReadRegisterUchar READ_REGISTER_UCHAR -#define ScsiPortReadRegisterUshort READ_REGISTER_USHORT -#define ScsiPortReadRegisterUlong READ_REGISTER_ULONG - -#define ScsiPortReadRegisterBufferUchar READ_REGISTER_BUFFER_UCHAR -#define ScsiPortReadRegisterBufferUshort READ_REGISTER_BUFFER_USHORT -#define ScsiPortReadRegisterBufferUlong READ_REGISTER_BUFFER_ULONG - -#define ScsiPortWritePortUchar WRITE_PORT_UCHAR -#define ScsiPortWritePortUshort WRITE_PORT_USHORT -#define ScsiPortWritePortUlong WRITE_PORT_ULONG - -#define ScsiPortWritePortBufferUchar WRITE_PORT_BUFFER_UCHAR -#define ScsiPortWritePortBufferUshort WRITE_PORT_BUFFER_USHORT -#define ScsiPortWritePortBufferUlong WRITE_PORT_BUFFER_ULONG - -#define ScsiPortWriteRegisterUchar WRITE_REGISTER_UCHAR -#define ScsiPortWriteRegisterUshort WRITE_REGISTER_USHORT -#define ScsiPortWriteRegisterUlong WRITE_REGISTER_ULONG - -#define ScsiPortWriteRegisterBufferUchar WRITE_REGISTER_BUFFER_UCHAR -#define ScsiPortWriteRegisterBufferUshort WRITE_REGISTER_BUFFER_USHORT -#define ScsiPortWriteRegisterBufferUlong WRITE_REGISTER_BUFFER_ULONG - -#define ScsiPortMoveMemory memmove - -#else - -__checkReturn -SCSIPORT_API -UCHAR -ScsiPortReadPortUchar( - __in PUCHAR Port - ); - -__checkReturn -SCSIPORT_API -USHORT -ScsiPortReadPortUshort( - __in PUSHORT Port - ); - -__checkReturn -SCSIPORT_API -ULONG -ScsiPortReadPortUlong( - __in PULONG Port - ); - -SCSIPORT_API -VOID -ScsiPortReadPortBufferUchar( - __in PUCHAR Port, - __in PUCHAR Buffer, - __in ULONG Count - ); - -SCSIPORT_API -VOID -ScsiPortReadPortBufferUshort( - __in PUSHORT Port, - __in PUSHORT Buffer, - __in ULONG Count - ); - -SCSIPORT_API -VOID -ScsiPortReadPortBufferUlong( - __in PULONG Port, - __in PULONG Buffer, - __in ULONG Count - ); - -__checkReturn -SCSIPORT_API -UCHAR -ScsiPortReadRegisterUchar( - __in PUCHAR Register - ); - -__checkReturn -SCSIPORT_API -USHORT -ScsiPortReadRegisterUshort( - __in PUSHORT Register - ); - -__checkReturn -SCSIPORT_API -ULONG -ScsiPortReadRegisterUlong( - __in PULONG Register - ); - -SCSIPORT_API -VOID -ScsiPortReadRegisterBufferUchar( - __in PUCHAR Register, - __in PUCHAR Buffer, - __in ULONG Count - ); - -SCSIPORT_API -VOID -ScsiPortReadRegisterBufferUshort( - __in PUSHORT Register, - __in PUSHORT Buffer, - __in ULONG Count - ); - -SCSIPORT_API -VOID -ScsiPortReadRegisterBufferUlong( - __in PULONG Register, - __in PULONG Buffer, - __in ULONG Count - ); - -SCSIPORT_API -VOID -ScsiPortWritePortUchar( - __in PUCHAR Port, - __in UCHAR Value - ); - -SCSIPORT_API -VOID -ScsiPortWritePortUshort( - __in PUSHORT Port, - __in USHORT Value - ); - -SCSIPORT_API -VOID -ScsiPortWritePortUlong( - __in PULONG Port, - __in ULONG Value - ); - -SCSIPORT_API -VOID -ScsiPortWritePortBufferUchar( - __in PUCHAR Port, - __in PUCHAR Buffer, - __in ULONG Count - ); - -SCSIPORT_API -VOID -ScsiPortWritePortBufferUshort( - __in PUSHORT Port, - __in PUSHORT Buffer, - __in ULONG Count - ); - -SCSIPORT_API -VOID -ScsiPortWritePortBufferUlong( - __in PULONG Port, - __in PULONG Buffer, - __in ULONG Count - ); - -SCSIPORT_API -VOID -ScsiPortWriteRegisterUchar( - __in PUCHAR Register, - __in UCHAR Value - ); - -SCSIPORT_API -VOID -ScsiPortWriteRegisterUshort( - __in PUSHORT Register, - __in USHORT Value - ); - -SCSIPORT_API -VOID -ScsiPortWriteRegisterUlong( - __in PULONG Register, - __in ULONG Value - ); - -SCSIPORT_API -VOID -ScsiPortWriteRegisterBufferUchar( - __in PUCHAR Register, - __in PUCHAR Buffer, - __in ULONG Count - ); - -SCSIPORT_API -VOID -ScsiPortWriteRegisterBufferUshort( - __in PUSHORT Register, - __in PUSHORT Buffer, - __in ULONG Count - ); - -SCSIPORT_API -VOID -ScsiPortWriteRegisterBufferUlong( - __in PULONG Register, - __in PULONG Buffer, - __in ULONG Count - ); - -SCSIPORT_API -VOID -ScsiPortMoveMemory( - __in PVOID WriteBuffer, - __in PVOID ReadBuffer, - __in ULONG Length - ); - -#endif - -__checkReturn -SCSIPORT_API -SCSI_PHYSICAL_ADDRESS -ScsiPortConvertUlongToPhysicalAddress( - __in ULONG_PTR UlongAddress - ); - -__checkReturn -SCSIPORT_API -ULONG -ScsiPortConvertPhysicalAddressToUlong( - __in SCSI_PHYSICAL_ADDRESS Address - ); - -SCSIPORT_API -VOID -ScsiPortQuerySystemTime( - __out PLARGE_INTEGER CurrentTime - ); - -#define ScsiPortConvertPhysicalAddressToUlong(Address) ((Address).LowPart) - -// -// Sundown Note: -// For now, ScsiPortConvertPhysicalAddressToULongPtr() exists only as a macro. -// - -#define ScsiPortConvertPhysicalAddressToULongPtr(Address) ((ULONG_PTR)((Address).QuadPart)) - -__checkReturn -SCSIPORT_API -BOOLEAN -ScsiPortValidateRange( - __in PVOID HwDeviceExtension, - __in INTERFACE_TYPE BusType, - __in ULONG SystemIoBusNumber, - __in SCSI_PHYSICAL_ADDRESS IoAddress, - __in ULONG NumberOfBytes, - __in BOOLEAN InIoSpace - ); - -// begin_ntminitape - -SCSIPORT_API -VOID -ScsiDebugPrint( - ULONG DebugPrintLevel, - PCCHAR DebugMessage, - ... - ); - -// end_ntminitape - -#pragma warning(pop) // un-sets any local warning changes - -#endif // - diff --git a/pub/ddk/statusdeviceservice.h b/pub/ddk/statusdeviceservice.h deleted file mode 100644 index ffe0dc5..0000000 --- a/pub/ddk/statusdeviceservice.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - * StatusDeviceService.h - * - * Contains definitions of the Status Device Service - * - * Copyright (c) Microsoft Corporation, All Rights Reserved. - * - */ - -#ifndef _STATUSDEVICESERVICE_H_ -#define _STATUSDEVICESERVICE_H_ - -#include - -/*****************************************************************************/ -/* Status Service Info */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(SERVICE_Status, - 0x0B9F1048, 0xB94B, 0xDC9A, 0x4e, 0xd7, 0xfe, 0x4f, 0xed, 0x3a, 0x0d, 0xeb); - -#define NAME_StatusSvc L"Status" -#define TYPE_StatusSvc DEVSVCTYPE_DEFAULT - -/*****************************************************************************/ -/* Status Service Property Keys */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(NAMESPACE_StatusSvc, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13); - - -/* PKEY_StatusSvc_SignalStrength - * - * Signal strength in "bars" from 0 (no signal) to 4 (excellent signal) - * - * Type: UInt8 - * Form: Range - */ - -DEFINE_DEVSVCPROPKEY(PKEY_StatusSvc_SignalStrength, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13, - 2); - -#define NAME_StatusSvc_SignalStrength L"SignalStrength" - -#define RANGEMIN_StatusSvc_SignalStrength 0 -#define RANGEMAX_StatusSvc_SignalStrength 4 -#define RANGESTEP_StatusSvc_SignalStrength 1 - -/* PKEY_StatusSvc_TextMessages - * - * Number of unread text messages (255 max) - * - * Type: UInt8 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_StatusSvc_TextMessages, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13, - 3); - -#define NAME_StatusSvc_TextMessages L"TextMessages" -#define RANGEMAX_StatusSvc_TextMessages 255 - -/* PKEY_StatusSvc_NewPictures - * - * Number of "new" pictures on the device (65535 max) - * - * Type: UInt16 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_StatusSvc_NewPictures, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13, - 4); - -#define NAME_StatusSvc_NewPictures L"NewPictures" -#define RANGEMAX_StatusSvc_NewPictures 65535 - -/* PKEY_StatusSvc_MissedCalls - * - * Number of missed calls on the device (255 max) - * - * Type: UInt8 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_StatusSvc_MissedCalls, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13, - 5); - -#define NAME_StatusSvc_MissedCalls L"MissedCalls" -#define RANGEMAX_StatusSvc_MissedCalls 255 - - -/* PKEY_StatusSvc_VoiceMail - * - * Number of "available" voice mail messages (255 max) - * - * Type: UInt8 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_StatusSvc_VoiceMail, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13, - 6); - -#define NAME_StatusSvc_VoiceMail L"VoiceMail" -#define RANGEMAX_StatusSvc_VoiceMail 255 - - -/* PKEY_StatusSvc_NetworkName - * - * Network provider network name - * - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_StatusSvc_NetworkName, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13, - 7); - -#define NAME_StatusSvc_NetworkName L"NetworkName" - - -/* PKEY_StatusSvc_NetworkType - * - * Network "type" (e.g. GPRS, EDGE, UMTS, 1xRTT, EVDO, or operator branded) - * - * Type: String - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_StatusSvc_NetworkType, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13, - 8); - -#define NAME_StatusSvc_NetworkType L"NetworkType" - - -/* PKEY_StatusSvc_Roaming - * - * Current network roaming state - * - * Type: UInt8 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_StatusSvc_Roaming, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13, - 9); - -#define NAME_StatusSvc_Roaming L"Roaming" - -#define ENUM_StatusSvc_RoamingInactive 0x00 -#define ENUM_StatusSvc_RoamingActive 0x01 -#define ENUM_StatusSvc_RoamingUnknown 0x02 - - -/* PKEY_StatusSvc_BatteryLife - * - * Remaining battery life on the device as a percentage between 100 and 0. - * - * Type: UInt8 - * Form: Range - */ - -DEFINE_DEVSVCPROPKEY(PKEY_StatusSvc_BatteryLife, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13, - 10); - -#define NAME_StatusSvc_BatteryLife L"BatteryLife" - -#define RANGEMIN_StatusSvc_BatteryLife 0 -#define RANGEMAX_StatusSvc_BatteryLife 100 -#define RANGESTEP_StatusSvc_BatteryLife 1 - - -/* PKEY_StatusSvc_ChargingState - * - * Current charging state of the device - * - * Type: UInt8 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_StatusSvc_ChargingState, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13, - 11); - -#define NAME_StatusSvc_ChargingState L"ChargingState" - -#define ENUM_StatusSvc_ChargingInactive 0x00 -#define ENUM_StatusSvc_ChargingActive 0x01 -#define ENUM_StatusSvc_ChargingUnknown 0x02 - - -/* PKEY_StatusSvc_StorageCapacity - * - * Total storage capacity on the device (across all storages) - * - * Type: UInt64 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_StatusSvc_StorageCapacity, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13, - 12); - -#define NAME_StatusSvc_StorageCapacity L"StorageCapacity" - - -/* PKEY_StatusSvc_StorageFreeSpace - * - * Total free storage capacity on the device (across all storages) - * - * Type: UInt64 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_StatusSvc_StorageFreeSpace, - 0x49cd1f76, 0x5626, 0x4b17, 0xa4, 0xe8, 0x18, 0xb4, 0xaa, 0x1a, 0x22, 0x13, - 13); - -#define NAME_StatusSvc_StorageFreeSpace L"StorageFreeSpace" - -#endif /* _STATUSDEVICESERVICE_H_ */ - - diff --git a/pub/ddk/stdcall.inc b/pub/ddk/stdcall.inc deleted file mode 100644 index 31d4702..0000000 --- a/pub/ddk/stdcall.inc +++ /dev/null @@ -1,366 +0,0 @@ -;****************************Public Macro************************************ -; -; ComposeInst Inst,p1,p2,p3,p4,p5,p6,p7,p8,p9 -; -; This macro simply concatenates all arguments into one string. -; -; -;**************************************************************************** - -ComposeInst macro Inst,p1,p2,p3,p4,p5,p6,p7,p8,p9 - &Inst &p1&p2&p3&p4&p5&p6&p7&p8&p9 -endm - -;****************************Public Macro************************************ -; -; CountArg cCount,ArgList -; -; This macro count the number of arguments in the ArgList and returns -; the value in cCount. -; -; History: -; Thu 15-Aug-1991 16:21:14 -by- Viroon Touranachun [viroont] -; Created -; -;**************************************************************************** - -CountArg macro cCount,ArgList - - cCount = 0 - - irp arg, - cCount = cCount+1 - endm -endm - -;****************************Public Macro************************************ -; -; RevPush ArgList,cCount -; -; This macro pushes the arguments in ArgList in the reverse order -; and returns the number of arguments in cCount. -; -; History: -; Thu 15-Aug-1991 16:21:14 -by- Viroon Touranachun [viroont] -; Created -; -;**************************************************************************** - -RevPush macro ArgList,cCount - Local index,x - - CountArg cCount, - - index = cCount - rept cCount - x = 0 - irp arg, - x = x+1 - ife index-x - push arg - exitm - endif - endm - index = index-1 - endm -endm - -;****************************Public Macro************************************ -; -; The following sections contain calling-convention related macros for: -; -; PUBLICP Func,N -; to define a public label -; -; EXTRNP Func,N -; to define a external near label -; -; LABELP Func,N -; to label an address as a routine entry point -; -; cProc Func,N,ArgList -; to declare a routine header -; -; ProcName Name,Func,N -; to rename a function Func to Name. Using it in conjunction with -; normal function declaration (with the new name) will solve an error -; caused by a long parameter list routine that exhausts page width. -; -; cRet Func -; to return from Func routines (declared with cProc or ProcName.) -; -; endProc Func -; to declare the end of routine (declared with cProc or ProcName.) -; -; endMod Func -; to declare the end of module with an entry point at Func (declared -; with cProc or ProcName.) -; -; cCall Func,ArgList -; to call to a routine--Func--with the arguments pushed on the stack -; -; ptrCall Func,ArgList -; to call through a pointer with the arguments pushed on the stack -; -; MovAddr dest,Func,n -; to move the address of the routine--Func--into dest. -; -; Note that for the standard calling convention all the function names, -; Func, are automatically converted to Func@N where N is the number of -; bytes in the argument list. -; -; History: -; Thu 15-Aug-1991 16:21:14 -by- Viroon Touranachun [viroont] -; Created -; -;**************************************************************************** - -IFNDEF DOS_PLATFORM -IFNDEF STD_CALL - -;**************************************************************************** -; -; This section is used exclusively for C calling convention. -; -;**************************************************************************** - -PUBLICP macro Func,N - - public &Func -endm - -EXTRNP macro Func,N - - extrn &Func:NEAR -endm - -LABELP macro Func,N - - &Func LABEL NEAR -endm - -ProcName macro Name,Func,N - - &Name EQU <&Func> -endm - -cProc macro Func,N,ArgList - - ProcName xxx&Func,Func,N - - xxx&Func proc &ArgList -endm - -cRet macro Func - - ret -endm - -endProc macro Func - - xxx&Func endp -endm - -endMod macro Func - -end xxx&Func - -endm - -ptrCall macro Func,ArgList - Local Bytes - - RevPush ,Bytes - Bytes = Bytes*4 - - call &Func - - if Bytes GT 0 - add esp,Bytes - endif -endm - -cCall macro Func,ArgList - Local Bytes - - RevPush ,Bytes - Bytes = Bytes*4 - - call &Func - - if Bytes GT 0 - add esp,Bytes - endif - -endm - -MovAddr macro dest,addr,n - - mov dest,offset FLAT:&addr -endm - -ENDIF ; STD_CALL - -ELSE - -IFNDEF STD_CALL - -;**************************************************************************** -; -; This section is used exclusively for Pascal calling convention. -; -;**************************************************************************** - -PUBLICP macro Func,N - - public &Func -endm - -EXTRNP macro Func,N - - extrn &Func:NEAR -endm - -LABELP macro Func,N - - &Func LABEL NEAR -endm - -ProcName macro Name,Func,N - - &Name EQU <&Func> -endm - -cProc macro Func,N,ArgList - - ProcName xxx&Func,Func,N - - xxx&Func proc &ArgList -endm - -cRet macro Func - - ret -endm - -endProc macro Func - - xxx&Func endp -endm - -endMod macro Func - -end xxx&Func - -endm - -cCall macro Func,ArgList - irp arg, - push arg - endm - - call &Func -endm - -MovAddr macro dest,addr,n - - mov dest,offset FLAT:&addr -endm - -ENDIF : ~STD_CALL -ENDIF ; DOS_PLATFORM - -IFDEF STD_CALL -;**************************************************************************** -; -; This section is used exclusively for the standard calling convention. -; -;**************************************************************************** - -PUBLICP macro Func,N - - ifb - public &Func&@0 - else - public &Func&@&N - endif -endm - -EXTRNP macro Func,N - - ifb - extrn &Func&@0:NEAR - else - extrn &Func&@&N:NEAR - endif -endm - -LABELP macro Func,N - - ifb - &Func&@0 LABEL NEAR - else - &Func&@&N LABEL NEAR - endif -endm - -ProcName macro Name,Func,N - - ifb - cByte&Func EQU 0 - &Name EQU <&Func&@0> - else - cByte&Func EQU N - &Name EQU <&Func&@&N> - endif -endm - -cProc macro Func,N,ArgList - - ProcName xxx&Func,Func,N - - xxx&Func proc &ArgList -endm - -cRet macro Func - - ret cByte&Func - -endm - - -endProc macro Func - - xxx&Func endp - -endm - -endMod macro Func - -end xxx&Func - -endm - -ptrCall macro Func,ArgList - Local Bytes - - RevPush ,Bytes - call &Func -endm - -cCall macro Func,ArgList - Local Bytes - - RevPush ,Bytes - Bytes = Bytes*4 - - ComposeInst ,&Func,<@>,%(Bytes) -endm - -MovAddr macro dest,addr,n - - ComposeInst ,dest,<,offset FLAT:>,addr,<@>,n -endm - -ENDIF ;STD_CALL - diff --git a/pub/ddk/stdunk.h b/pub/ddk/stdunk.h deleted file mode 100644 index 12d0099..0000000 --- a/pub/ddk/stdunk.h +++ /dev/null @@ -1,255 +0,0 @@ -/***************************************************************************** - * stdunk.h - standard IUnknown implementaton definitions - ***************************************************************************** - * Copyright (c) Microsoft Corporation. All rights reserved. - */ - -#ifndef _STDUNK_H_ -#define _STDUNK_H_ - -#include "punknown.h" - - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -/***************************************************************************** - * Interfaces - */ - -/***************************************************************************** - * INonDelegatingUnknown - ***************************************************************************** - * Non-delegating unknown interface. - */ -DECLARE_INTERFACE(INonDelegatingUnknown) -{ - STDMETHOD_(NTSTATUS,NonDelegatingQueryInterface) - ( THIS_ - __in REFIID, - __out PVOID * - ) PURE; - - STDMETHOD_(ULONG,NonDelegatingAddRef) - ( THIS - ) PURE; - - STDMETHOD_(ULONG,NonDelegatingRelease) - ( THIS - ) PURE; -}; - -typedef INonDelegatingUnknown *PNONDELEGATINGUNKNOWN; - - - - - -/***************************************************************************** - * Classes - */ - -/***************************************************************************** - * CUnknown - ***************************************************************************** - * Base INonDelegatingUnknown implementation. - */ -class CUnknown : public INonDelegatingUnknown -{ -private: - - LONG m_lRefCount; // Reference count. - PUNKNOWN m_pUnknownOuter; // Outer IUnknown. - -public: - - /************************************************************************* - * CUnknown methods. - */ - CUnknown(PUNKNOWN pUnknownOuter); - virtual ~CUnknown(void); - PUNKNOWN GetOuterUnknown(void) - { - return m_pUnknownOuter; - } - - /************************************************************************* - * INonDelegatingUnknown methods. - */ - STDMETHODIMP_(ULONG) NonDelegatingAddRef - ( void - ); - STDMETHODIMP_(ULONG) NonDelegatingRelease - ( void - ); - STDMETHODIMP_(NTSTATUS) NonDelegatingQueryInterface - ( - __in REFIID rIID, - __out PVOID * ppVoid - ); -}; - - - - - -/***************************************************************************** - * Macros - */ - -/***************************************************************************** - * DECLARE_STD_UNKNOWN - ***************************************************************************** - * Various declarations for standard objects based on CUnknown. - */ -#define DECLARE_STD_UNKNOWN() \ - STDMETHODIMP_(NTSTATUS) NonDelegatingQueryInterface \ - ( \ - __in REFIID iid, \ - __out PVOID * ppvObject \ - ); \ - STDMETHODIMP_(NTSTATUS) QueryInterface(REFIID riid, void **ppv) \ - { \ - return GetOuterUnknown()->QueryInterface(riid,ppv); \ - }; \ - STDMETHODIMP_(ULONG) AddRef() \ - { \ - return GetOuterUnknown()->AddRef(); \ - }; \ - STDMETHODIMP_(ULONG) Release() \ - { \ - return GetOuterUnknown()->Release(); \ - }; - -#define DEFINE_STD_CONSTRUCTOR(Class) \ - Class(PUNKNOWN pUnknownOuter) \ - : CUnknown(pUnknownOuter) \ - { \ - } - -#define QICAST(Type) \ - PVOID((Type)(this)) - -#define QICASTUNKNOWN(Type) \ - PVOID(PUNKNOWN((Type)(this))) - -#define STD_CREATE_BODY_WITH_TAG_(Class,ppUnknown,pUnknownOuter,poolType,tag,base) \ - NTSTATUS ntStatus; \ - Class *p = new(poolType,tag) Class(pUnknownOuter); \ - if (p) \ - { \ - *ppUnknown = PUNKNOWN((base)(p)); \ - (*ppUnknown)->AddRef(); \ - ntStatus = STATUS_SUCCESS; \ - } \ - else \ - { \ - ntStatus = STATUS_INSUFFICIENT_RESOURCES; \ - } \ - return ntStatus - -#define STD_CREATE_BODY_WITH_TAG(Class,ppUnknown,pUnknownOuter,poolType,tag) \ - STD_CREATE_BODY_WITH_TAG_(Class,ppUnknown,pUnknownOuter,poolType,tag,PUNKNOWN) - -#define STD_CREATE_BODY_(Class,ppUnknown,pUnknownOuter,poolType,base) \ - STD_CREATE_BODY_WITH_TAG_(Class,ppUnknown,pUnknownOuter,poolType,'rCcP',base) - -#define STD_CREATE_BODY(Class,ppUnknown,pUnknownOuter,poolType) \ - STD_CREATE_BODY_(Class,ppUnknown,pUnknownOuter,poolType,PUNKNOWN) - - - - - - -/***************************************************************************** - * Functions - */ -#ifndef PC_KDEXT // this is not needed for the KD extensions. -#ifndef _NEW_DELETE_OPERATORS_ -#define _NEW_DELETE_OPERATORS_ - -/***************************************************************************** - * ::new() - ***************************************************************************** - * New function for creating objects with a specified allocation tag. - */ -inline PVOID operator new -( - size_t iSize, - POOL_TYPE poolType -) -{ - PVOID result = ExAllocatePoolWithTag(poolType,iSize,'wNcP'); - - if (result) - { - RtlZeroMemory(result,iSize); - } - - return result; -} - -/***************************************************************************** - * ::new() - ***************************************************************************** - * New function for creating objects with a specified allocation tag. - */ -inline PVOID operator new -( - size_t iSize, - POOL_TYPE poolType, - ULONG tag -) -{ - PVOID result = ExAllocatePoolWithTag(poolType,iSize,tag); - - if (result) - { - RtlZeroMemory(result,iSize); - } - - return result; -} - -/***************************************************************************** - * ::delete() - ***************************************************************************** - * Delete function. - */ -inline void __cdecl operator delete -( - PVOID pVoid -) -{ - if (pVoid) - { - ExFreePool(pVoid); - } -} - -/***************************************************************************** - * ::delete() - ***************************************************************************** - * Delete function. - */ -inline void __cdecl operator delete -( - PVOID pVoid, - ULONG tag -) -{ - if (pVoid) - { - ExFreePoolWithTag(pVoid,tag); - } -} - -#endif //!_NEW_DELETE_OPERATORS_ - -#endif // PC_KDEXT - - -#endif // NTDDI -#endif - diff --git a/pub/ddk/stiusd.h b/pub/ddk/stiusd.h deleted file mode 100644 index f51cee6..0000000 --- a/pub/ddk/stiusd.h +++ /dev/null @@ -1,222 +0,0 @@ -/*++ - -Copyright (c) 1986-1997 Microsoft Corporation - -Module Name: - - stiusd.h - -Abstract: - - Definitions file for creating STI User-mode Still-image Drivers ( USD). - -Author: - - -Revision History: - - ---*/ - -#ifndef _STIUSD_ -#define _STIUSD_ - -// Include COM definitions -#define COM_NO_WINDOWS_H - -// -#pragma intrinsic(memcmp,memset) - -// -// Include COM definitions -// -#ifndef _NO_COM -#include -#endif - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Class IID's - */ - - -/* - * Interface IID's - */ -#if defined( _WIN32 ) && !defined( _NO_COM) - -// {0C9BB460-51AC-11D0-90EA-00AA0060F86C} -DEFINE_GUID(IID_IStiUSD, 0x0C9BB460L, 0x51AC, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6C); - -// {128A9860-52DC-11D0-9EDF-444553540000} -DEFINE_GUID(IID_IStiDeviceControl, 0x128A9860L, 0x52DC, 0x11D0, 0x9E, 0xDF, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); - -#endif - -/* - * Data structures - */ - -typedef struct _STI_USD_CAPS { - - DWORD dwVersion; // STI version used to build this USD - - DWORD dwGenericCaps; - -} STI_USD_CAPS,*PSTI_USD_CAPS; - - -// -// Claims to support device notifications asyncronously ( without polling) -// -#define STI_USD_GENCAP_NATIVE_PUSHSUPPORT STI_GENCAP_NOTIFICATIONS - -// -// Asks to open device automatically ( not implemented now) -// -// #define STI_USD_GENCAP_OPEN_DEVICE_FOR_ME 0x00000002 - -typedef DWORD USD_CONTROL_CODE; - -/* - * Generic constants and definitions - */ - -// -// Internally used flags for open device mode. - -// USD receives this bit only when associated device instance is created by monitor process -// -#define STI_DEVICE_CREATE_FOR_MONITOR 0x01000000 - - -#ifdef __cplusplus - -struct IStiUSD; -struct IStiDeviceControl; - -#endif - -typedef struct IStiUSD *PSTIUSD; -typedef struct IStiDeviceControl *PSTIDEVICECONTROL; - - -/* - * IStiDeviceControl interface - * - * Instance of object supporting this interface is passed to USD at the moment - * of device object initialization. - */ -#undef INTERFACE -#define INTERFACE IStiDeviceControl -DECLARE_INTERFACE_(IStiDeviceControl, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; - STDMETHOD_(ULONG, AddRef) (THIS) PURE; - STDMETHOD_(ULONG, Release) (THIS) PURE; - - /*** IStiDeviceControl methods ***/ - STDMETHOD(Initialize) (THIS_ DWORD dwDeviceType,DWORD dwMode,LPCWSTR pwszPortName,DWORD dwFlags )PURE; - STDMETHOD(RawReadData)(THIS_ LPVOID lpBuffer,LPDWORD lpdwNumberOfBytes,LPOVERLAPPED lpOverlapped) PURE; - STDMETHOD(RawWriteData)(THIS_ LPVOID lpBuffer,DWORD nNumberOfBytes,LPOVERLAPPED lpOverlapped) PURE; - STDMETHOD(RawReadCommand)(THIS_ LPVOID lpBuffer,LPDWORD lpdwNumberOfBytes,LPOVERLAPPED lpOverlapped) PURE; - STDMETHOD(RawWriteCommand)(THIS_ LPVOID lpBuffer,DWORD nNumberOfBytes,LPOVERLAPPED lpOverlapped) PURE; - STDMETHOD(RawDeviceControl)(THIS_ USD_CONTROL_CODE EscapeFunction,LPVOID lpInData,DWORD cbInDataSize,LPVOID pOutData,DWORD dwOutDataSize,LPDWORD pdwActualData) PURE ; - STDMETHOD(GetLastError)(THIS_ LPDWORD lpdwLastError) PURE; - STDMETHOD(GetMyDevicePortName)(THIS_ __out_ecount(cwDevicePathSize) LPWSTR lpszDevicePath, DWORD cwDevicePathSize ) PURE; - STDMETHOD(GetMyDeviceHandle)(THIS_ LPHANDLE lph) PURE; - STDMETHOD(GetMyDeviceOpenMode)(THIS_ LPDWORD pdwOpenMode ) PURE; - STDMETHOD(WriteToErrorLog)(THIS_ DWORD dwMessageType,LPCWSTR pszMessage,DWORD dwErrorCode) PURE; -} ; - -#if !defined(__cplusplus) || defined(CINTERFACE) - -#define IStiDeviceControl_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IStiDeviceControl_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IStiDeviceControl_Release(p) (p)->lpVtbl->Release(p) -#define IStiDeviceControl_Initialize(p,a,b,c,d) (p)->lpVtbl->Initialize(p,a,b,c,d) - -#define IStiDeviceControl_RawReadData(p,a,b,c) (p)->lpVtbl->RawReadData(p,a,b,c) -#define IStiDeviceControl_RawWriteData(p,a,b,c) (p)->lpVtbl->RawWriteData(p,a,b,c) -#define IStiDeviceControl_RawReadCommand(p,a,b,c) (p)->lpVtbl->RawReadCommand(p,a,b,c) -#define IStiDeviceControl_RawWriteCommand(p,a,b,c) (p)->lpVtbl->RawWriteCommand(p,a,b,c) -#define IStiDeviceControl_RawDeviceControl(p,a,b,c,d,e,f) (p)->lpVtbl->RawDeviceControl(p,a,b,c,d,e,f) -#define IStiDeviceControl_GetLastError(p,a) (p)->lpVtbl->GetLastError(p,a) -#define IStiDeviceControl_GetMyDevicePortName(p,a,b) (p)->lpVtbl->GetMyDevicePortName(p,a,b) -#define IStiDeviceControl_GetMyDeviceHandle(p,a) (p)->lpVtbl->GetMyDeviceHandle(p,a) -#define IStiDeviceControl_GetMyDeviceOpenMode(p,a) (p)->lpVtbl->GetMyDeviceOpenMode(p,a) -#define IStiDeviceControl_WriteToErrorLog(p,a,b,c) (p)->lpVtbl->WriteToErrorLog(p,a,b,c) - -#endif - -/* - * IStiUSD interface - */ -#undef INTERFACE -#define INTERFACE IStiUSD -DECLARE_INTERFACE_(IStiUSD, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; - STDMETHOD_(ULONG, AddRef) (THIS) PURE; - STDMETHOD_(ULONG, Release) (THIS) PURE; - - /*** IStiUSD methods ***/ - STDMETHOD(Initialize) (THIS_ PSTIDEVICECONTROL pHelDcb,DWORD dwStiVersion,HKEY hParametersKey) PURE; - STDMETHOD(GetCapabilities) (THIS_ PSTI_USD_CAPS pDevCaps) PURE; - STDMETHOD(GetStatus) (THIS_ PSTI_DEVICE_STATUS pDevStatus) PURE; - STDMETHOD(DeviceReset)(THIS ) PURE; - STDMETHOD(Diagnostic)(THIS_ LPSTI_DIAG pBuffer) PURE; - STDMETHOD(Escape)(THIS_ STI_RAW_CONTROL_CODE EscapeFunction,LPVOID lpInData,DWORD cbInDataSize,LPVOID pOutData,DWORD dwOutDataSize,LPDWORD pdwActualData) PURE ; - STDMETHOD(GetLastError) (THIS_ LPDWORD pdwLastDeviceError) PURE; - STDMETHOD(LockDevice) (THIS ) PURE; - STDMETHOD(UnLockDevice) (THIS ) PURE; - STDMETHOD(RawReadData)(THIS_ LPVOID lpBuffer,LPDWORD lpdwNumberOfBytes,LPOVERLAPPED lpOverlapped) PURE; - STDMETHOD(RawWriteData)(THIS_ LPVOID lpBuffer,DWORD nNumberOfBytes,LPOVERLAPPED lpOverlapped) PURE; - STDMETHOD(RawReadCommand)(THIS_ LPVOID lpBuffer,LPDWORD lpdwNumberOfBytes,LPOVERLAPPED lpOverlapped) PURE; - STDMETHOD(RawWriteCommand)(THIS_ LPVOID lpBuffer,DWORD nNumberOfBytes,LPOVERLAPPED lpOverlapped) PURE; - STDMETHOD(SetNotificationHandle)(THIS_ HANDLE hEvent) PURE; - STDMETHOD(GetNotificationData)(THIS_ LPSTINOTIFY lpNotify) PURE; - STDMETHOD(GetLastErrorInfo) (THIS_ STI_ERROR_INFO *pLastErrorInfo) PURE; -} ; - -#if !defined(__cplusplus) || defined(CINTERFACE) - -#define IStiUSD_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IStiUSD_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IStiUSD_Release(p) (p)->lpVtbl->Release(p) -#define IStiUSD_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) -#define IStiUSD_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) -#define IStiUSD_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a) -#define IStiUSD_DeviceReset(p) (p)->lpVtbl->DeviceReset(p) -#define IStiUSD_Diagnostic(p,a) (p)->lpVtbl->Diagnostic(p,a) -#define IStiUSD_Escape(p,a,b,c,d,e,f) (p)->lpVtbl->Escape(p,a,b,c,d,e,f) -#define IStiUSD_GetLastError(p,a) (p)->lpVtbl->GetLastError(p,a) -#define IStiUSD_LockDevice(p) (p)->lpVtbl->LockDevice(p) -#define IStiUSD_UnLockDevice(p) (p)->lpVtbl->UnLockDevice(p) -#define IStiUSD_RawReadData(p,a,b,c) (p)->lpVtbl->RawReadData(p,a,b,c) -#define IStiUSD_RawWriteData(p,a,b,c) (p)->lpVtbl->RawWriteData(p,a,b,c) -#define IStiUSD_RawReadCommand(p,a,b,c) (p)->lpVtbl->RawReadCommand(p,a,b,c) -#define IStiUSD_RawWriteCommand(p,a,b,c) (p)->lpVtbl->RawWriteCommand(p,a,b,c) -#define IStiUSD_SetNotificationHandle(p,a) (p)->lpVtbl->SetNotificationHandle(p,a) -#define IStiUSD_GetNotificationData(p,a) (p)->lpVtbl->GetNotificationData(p,a) -#define IStiUSD_GetLastErrorInfo(p,a) (p)->lpVtbl->GetLastErrorInfo(p,a) - -#endif - -#ifdef __cplusplus -}; -#endif - -#endif // _STIUSD_ - - - - diff --git a/pub/ddk/storduid.h b/pub/ddk/storduid.h deleted file mode 100644 index d774c03..0000000 --- a/pub/ddk/storduid.h +++ /dev/null @@ -1,409 +0,0 @@ -/*++ BUILD Version: 0001 // Increment this if a change has global effects - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - storduid.h - -Abstract: - - This is the include file that defines all common constants and types - for accessing storage device unique identification. - -Revision History: - ---*/ - -#ifndef __STORDUID_H__ -#define __STORDUID_H__ - - -// -// Storage device unique identification. -// - -typedef enum _DUID_MATCH_STATUS { - DuidExactMatch = 0, - DuidSubIdMatch, - DuidNoMatch, - DuidErrorGeneral = 100, - DuidErrorMissingDuid, - DuidErrorVersionMismatch, - DuidErrorInvalidDuid, - DuidErrorInvalidDeviceIdDescSize, - DuidErrorInvalidDeviceDescSize, - DuidErrorInvalidLayoutSigSize, - DuidErrorInvalidLayoutSigVersion, - DuidErrorMaximum -} DUID_MATCH_STATUS; - - -// -// Use a version number to help identify the DUID. -// Future versions may not be compatible, and the compare -// routine may need to know the version to accurately -// compare DUIDS. -// - -#define DUID_VERSION_1 1 - -#define DUID_HARDWARE_IDS_ONLY 0 -#define DUID_INCLUDE_SOFTWARE_IDS 1 - -#define DUID_MATCH_ERROR( _duid_status ) ( ( _duid_status ) >= DuidErrorGeneral ? TRUE : FALSE ) -#define DUID_MATCH_SUCCESS( _duid_status ) ( ( _duid_status ) < DuidErrorGeneral ? TRUE : FALSE ) - -typedef struct _STORAGE_DEVICE_UNIQUE_IDENTIFIER { - - // - // DUID version. - // - - ULONG Version; - - // - // Total size of the identifier header including the space - // for all ids. - // - - ULONG Size; - - // - // Byte offset to the STORAGE_DEVICE_ID_DESCRIPTOR. - // - - ULONG StorageDeviceIdOffset; - - // - // Byte offset to the STORAGE_DEVICE_DESCRIPTOR. - // - - ULONG StorageDeviceOffset; - - // - // Byte offset to the STORAGE_DEVICE_LAYOUT_SIGNATURE. - // - // Only included if the first byte of the input STORAGE_PROPERTY_QUERY - // AdditionalParameters is equal to DUID_INCLUDE_SOFTWARE_IDS. - // - - ULONG DriveLayoutSignatureOffset; - -} STORAGE_DEVICE_UNIQUE_IDENTIFIER, *PSTORAGE_DEVICE_UNIQUE_IDENTIFIER; - - -typedef struct _STORAGE_DEVICE_LAYOUT_SIGNATURE { - - // - // DUID version. - // - - ULONG Version; - - // - // Total size of this structure. - // - - ULONG Size; - - // - // Flag indicating whether signature is MBR or GPT format. - // - - BOOLEAN Mbr; - - union { - ULONG MbrSignature; - GUID GptDiskId; - } DeviceSpecific; - -} STORAGE_DEVICE_LAYOUT_SIGNATURE, *PSTORAGE_DEVICE_LAYOUT_SIGNATURE; - -__inline -DUID_MATCH_STATUS -CompareStorageDuids( - __in PSTORAGE_DEVICE_UNIQUE_IDENTIFIER Duid1, - __in PSTORAGE_DEVICE_UNIQUE_IDENTIFIER Duid2 - ); - -__inline -DUID_MATCH_STATUS -CompareStorageDuids( - __in PSTORAGE_DEVICE_UNIQUE_IDENTIFIER Duid1, - __in PSTORAGE_DEVICE_UNIQUE_IDENTIFIER Duid2 - ) -{ - // - // Initial parameter checking. - // - - if ( !Duid1 || !Duid2 ) { - - return DuidErrorMissingDuid; - } - - if ( Duid1->Size < sizeof(STORAGE_DEVICE_UNIQUE_IDENTIFIER) || - Duid2->Size < sizeof(STORAGE_DEVICE_UNIQUE_IDENTIFIER) ) { - - return DuidErrorGeneral; - } - - if ( Duid1->Version != DUID_VERSION_1 || - Duid2->Version != DUID_VERSION_1 ) { - - return DuidErrorVersionMismatch; - } - - // - // Something besides the header must exist. - // - - if ( Duid1->StorageDeviceIdOffset == 0 && - Duid1->StorageDeviceOffset == 0 && - Duid1->DriveLayoutSignatureOffset == 0 ) { - - return DuidErrorInvalidDuid; - } - - if ( Duid2->StorageDeviceIdOffset == 0 && - Duid2->StorageDeviceOffset == 0 && - Duid2->DriveLayoutSignatureOffset == 0 ) { - - return DuidErrorInvalidDuid; - } - - // - // If both DUIDs are the same size and match exactly, we are done. - // - - if ( Duid1->Size == Duid2->Size ) { - - if ( memcmp( Duid1, Duid2, Duid1->Size ) == 0 ) { - - return DuidExactMatch; - } - } - - // - // Check STORAGE_DEVICE_ID_DESCRIPTOR - // - - if ( Duid1->StorageDeviceIdOffset && Duid2->StorageDeviceIdOffset ) { - - PSTORAGE_DEVICE_ID_DESCRIPTOR idDesc1; - PSTORAGE_DEVICE_ID_DESCRIPTOR idDesc2; - - PSTORAGE_IDENTIFIER ident1; - PSTORAGE_IDENTIFIER ident2; - - ULONG idx1; - ULONG idx2; - - idDesc1 = (PSTORAGE_DEVICE_ID_DESCRIPTOR)((PUCHAR)Duid1 + Duid1->StorageDeviceIdOffset); - idDesc2 = (PSTORAGE_DEVICE_ID_DESCRIPTOR)((PUCHAR)Duid2 + Duid2->StorageDeviceIdOffset); - - // - // Insure reasonable size. - // - - if ( idDesc1->Size < sizeof(STORAGE_DEVICE_ID_DESCRIPTOR) || - idDesc2->Size < sizeof(STORAGE_DEVICE_ID_DESCRIPTOR) ) { - - return DuidErrorInvalidDeviceIdDescSize; - } - - // - // If substructures are the same, check for a match. - // - - if ( idDesc1->Size == idDesc2->Size ) { - - if ( memcmp( idDesc1, idDesc2, idDesc1->Size ) == 0 ) { - - return DuidSubIdMatch; - } - } - - // - // Walk through the identifiers and find unique values that match. - // For each unique ID in Duid1, check if it exists in Duid2. If so, - // these are likely the same device. - // - // This search is not optimized. - // - - // - // Loop through identifiers in Duid1. - // - - ident1 = (PSTORAGE_IDENTIFIER)(idDesc1->Identifiers); - - for ( idx1 = 0; idx1 < idDesc1->NumberOfIdentifiers; idx1++ ) { - - // - // Find identifier in Duid1 that is unique. - // - - if ( ( ident1->Type == StorageIdTypeScsiNameString || - ident1->Type == StorageIdTypeFCPHName || - ident1->Type == StorageIdTypeEUI64 || - ident1->Type == StorageIdTypeVendorId ) && - ( ident1->Association == StorageIdAssocPort ) && - ( ident1->CodeSet == StorageIdCodeSetUtf8 || - ident1->CodeSet == StorageIdCodeSetAscii || - ident1->CodeSet == StorageIdCodeSetBinary ) ) { - - // - // Found a unique ID in Duid1. Look for the same identifier in - // Duid2. - // - - ident2 = (PSTORAGE_IDENTIFIER)(idDesc2->Identifiers); - - for ( idx2 = 0; idx2 < idDesc2->NumberOfIdentifiers; idx2++ ) { - - if ( ident1->Type == ident2->Type && - ident1->Association == ident2->Association && - ident1->CodeSet == ident2->CodeSet && - ident1->IdentifierSize == ident2->IdentifierSize && - ( memcmp( ident1->Identifier, - ident2->Identifier, - ident1->IdentifierSize ) == 0 ) ) { - - return DuidSubIdMatch; - } - - ident2 = (PSTORAGE_IDENTIFIER)((PUCHAR)ident2 + ident2->NextOffset); - } - } - - ident1 = (PSTORAGE_IDENTIFIER)((PUCHAR)ident1 + ident1->NextOffset); - } - - } - - // - // Check STORAGE_DEVICE_DESCRIPTOR - // - - if ( Duid1->StorageDeviceOffset && Duid2->StorageDeviceOffset ) { - - PSTORAGE_DEVICE_DESCRIPTOR desc1; - PSTORAGE_DEVICE_DESCRIPTOR desc2; - - desc1 = (PSTORAGE_DEVICE_DESCRIPTOR)((PUCHAR)Duid1 + Duid1->StorageDeviceOffset); - desc2 = (PSTORAGE_DEVICE_DESCRIPTOR)((PUCHAR)Duid2 + Duid2->StorageDeviceOffset); - - // - // Insure reasonable size. - // - - if ( desc1->Size < sizeof(STORAGE_DEVICE_DESCRIPTOR) || - desc2->Size < sizeof(STORAGE_DEVICE_DESCRIPTOR) ) { - - return DuidErrorInvalidDeviceDescSize; - } - - // - // If substructures are the same, check for a match. - // - - if ( desc1->Size == desc2->Size ) { - - if ( memcmp( desc1, desc2, desc1->Size ) == 0 ) { - - return DuidSubIdMatch; - } - } - - // - // Have to have SerialNumber. If SerialNumbers match, then - // VendorId and ProductId must match (if they exist). - // - - if ( desc1->SerialNumberOffset && - desc2->SerialNumberOffset ) { - - const char * string1; - const char * string2; - - // - // All strings are supposed to be NULL terminated. - // - - string1 = (const char *)((PUCHAR)desc1 + desc1->SerialNumberOffset); - string2 = (const char *)((PUCHAR)desc2 + desc2->SerialNumberOffset); - - if ( strcmp( string1, string2 ) == 0 ) { - - if ( desc1->VendorIdOffset && - desc2->VendorIdOffset ) { - - string1 = (const char *)((PUCHAR)desc1 + desc1->VendorIdOffset); - string2 = (const char *)((PUCHAR)desc2 + desc2->VendorIdOffset); - - if ( strcmp( string1, string2 ) != 0 ) { - - return DuidNoMatch; - } - } - - if ( desc1->ProductIdOffset && - desc2->ProductIdOffset ) { - - string1 = (const char *)((PUCHAR)desc1 + desc1->ProductIdOffset); - string2 = (const char *)((PUCHAR)desc2 + desc2->ProductIdOffset); - - if ( strcmp( string1, string2 ) != 0 ) { - - return DuidNoMatch; - } - } - - return DuidSubIdMatch; - } - } - } - - // - // Check STORAGE_DEVICE_LAYOUT_SIGNATURE - // - - if ( Duid1->DriveLayoutSignatureOffset && Duid2->DriveLayoutSignatureOffset ) { - - PSTORAGE_DEVICE_LAYOUT_SIGNATURE sig1; - PSTORAGE_DEVICE_LAYOUT_SIGNATURE sig2; - - sig1 = (PSTORAGE_DEVICE_LAYOUT_SIGNATURE)((PUCHAR)Duid1 + Duid1->DriveLayoutSignatureOffset); - sig2 = (PSTORAGE_DEVICE_LAYOUT_SIGNATURE)((PUCHAR)Duid2 + Duid2->DriveLayoutSignatureOffset); - - if ( sig1->Version != DUID_VERSION_1 && - sig2->Version != DUID_VERSION_1 ) { - - return DuidErrorInvalidLayoutSigVersion; - } - - if ( sig1->Size < sizeof(STORAGE_DEVICE_LAYOUT_SIGNATURE) || - sig2->Size < sizeof(STORAGE_DEVICE_LAYOUT_SIGNATURE) ) { - - return DuidErrorInvalidLayoutSigSize; - } - - if ( memcmp( sig1, sig2, sizeof(STORAGE_DEVICE_LAYOUT_SIGNATURE) ) == 0 ) { - - return DuidSubIdMatch; - } - } - - // - // If we get here, we found no unique IDs that match. - // - - return DuidNoMatch; -} - - -#endif // __STORDUID_H__ - - diff --git a/pub/ddk/storport.h b/pub/ddk/storport.h deleted file mode 100644 index 5f83e68..0000000 --- a/pub/ddk/storport.h +++ /dev/null @@ -1,6540 +0,0 @@ - -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - storport.h - -Abstract: - - These are the structures and defines that are included by STORPORT miniport - drivers. - -Authors: - -Revision History: - ---*/ - -#ifdef _NTSCSI_ -#error "STORPORT.H must be included instead of SCSI.H" -#endif - -#ifdef _NTSRB_ -#error "STORPORT.H must be included instead of SRB.H" -#endif - -#ifndef _NTSTORPORT_ -#define _NTSTORPORT_ - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4200) // array[0] is not a warning for this file -#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union -#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int - -#if DBG -#define DebugPrint(x) StorPortDebugPrint x -#else -#define DebugPrint(x) -#endif - - -// -// Define SCSI maximum configuration parameters. -// - -#define SCSI_MAXIMUM_LOGICAL_UNITS 8 -#define SCSI_MAXIMUM_TARGETS_PER_BUS 128 -#define SCSI_MAXIMUM_LUNS_PER_TARGET 255 -#define SCSI_MAXIMUM_BUSES 8 -#define SCSI_MINIMUM_PHYSICAL_BREAKS 16 -#define SCSI_MAXIMUM_PHYSICAL_BREAKS 255 - -#define SCSI_COMBINE_BUS_TARGET( Bus, Target ) ( \ - ((((UCHAR) (Target)) & ~(0x20 - 1)) << 8) | \ - (((UCHAR) (Bus)) << 5) | \ - (((UCHAR) (Target)) & (0x20 - 1))) - -#define SCSI_DECODE_BUS_TARGET( Value, Bus, Target ) ( \ - Bus = (UCHAR) ((Value) >> 5), \ - Target = (UCHAR) ((((Value) >> 8) & ~(0x20 - 1)) | ((Value) & (0x20 - 1)))) - -// -// This constant is for backward compatibility. -// This use to be the maximum number of targets supported. -// - -#define SCSI_MAXIMUM_TARGETS 8 - - -// -// Uninitialized flag value. -// - -#define SP_UNINITIALIZED_VALUE ((ULONG) ~0) -#define SP_UNTAGGED ((UCHAR) ~0) - -// -// Set asynchronous events. -// - -#define SRBEV_BUS_RESET 0x0001 -#define SRBEV_SCSI_ASYNC_NOTIFICATION 0x0002 - -// begin_ntminitape - -#define MAXIMUM_CDB_SIZE 12 - -// -// SCSI I/O Request Block -// - -typedef struct _SCSI_REQUEST_BLOCK { - USHORT Length; // offset 0 - UCHAR Function; // offset 2 - UCHAR SrbStatus; // offset 3 - UCHAR ScsiStatus; // offset 4 - UCHAR PathId; // offset 5 - UCHAR TargetId; // offset 6 - UCHAR Lun; // offset 7 - UCHAR QueueTag; // offset 8 - UCHAR QueueAction; // offset 9 - UCHAR CdbLength; // offset a - UCHAR SenseInfoBufferLength; // offset b - ULONG SrbFlags; // offset c - ULONG DataTransferLength; // offset 10 - ULONG TimeOutValue; // offset 14 - __field_bcount(DataTransferLength) \ - PVOID DataBuffer; // offset 18 - PVOID SenseInfoBuffer; // offset 1c - struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20 - PVOID OriginalRequest; // offset 24 - PVOID SrbExtension; // offset 28 - union { - ULONG InternalStatus; // offset 2c - ULONG QueueSortKey; // offset 2c - ULONG LinkTimeoutValue; // offset 2c - }; - -#if defined(_WIN64) - - // - // Force PVOID alignment of Cdb - // - - ULONG Reserved; - -#endif - - UCHAR Cdb[16]; // offset 30 -} SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK; - -#define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK) - -// -// SCSI I/O Request Block for WMI Requests -// - -typedef struct _SCSI_WMI_REQUEST_BLOCK { - USHORT Length; - UCHAR Function; // SRB_FUNCTION_WMI - UCHAR SrbStatus; - UCHAR WMISubFunction; - UCHAR PathId; // If SRB_WMI_FLAGS_ADAPTER_REQUEST is set in - UCHAR TargetId; // WMIFlags then PathId, TargetId and Lun are - UCHAR Lun; // reserved fields. - UCHAR Reserved1; - UCHAR WMIFlags; - UCHAR Reserved2[2]; - ULONG SrbFlags; - ULONG DataTransferLength; - ULONG TimeOutValue; - PVOID DataBuffer; - PVOID DataPath; - PVOID Reserved3; - PVOID OriginalRequest; - PVOID SrbExtension; - ULONG Reserved4; - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -#if defined(_WIN64) - - // - // Force PVOID alignment of Cdb - // - - ULONG Reserved6; - -#endif -#endif - - UCHAR Reserved5[16]; -} SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK; - -typedef enum _STOR_DEVICE_POWER_STATE { - StorPowerDeviceUnspecified = 0, - StorPowerDeviceD0, - StorPowerDeviceD1, - StorPowerDeviceD2, - StorPowerDeviceD3, - StorPowerDeviceMaximum -} STOR_DEVICE_POWER_STATE, *PSTOR_DEVICE_POWER_STATE; - -typedef enum { - StorPowerActionNone = 0, - StorPowerActionReserved, - StorPowerActionSleep, - StorPowerActionHibernate, - StorPowerActionShutdown, - StorPowerActionShutdownReset, - StorPowerActionShutdownOff, - StorPowerActionWarmEject -} STOR_POWER_ACTION, *PSTOR_POWER_ACTION; - -typedef struct _SCSI_POWER_REQUEST_BLOCK { - USHORT Length; // offset 0 - UCHAR Function; // offset 2 - UCHAR SrbStatus; // offset 3 - UCHAR SrbPowerFlags; // offset 4 - UCHAR PathId; // offset 5 - UCHAR TargetId; // offset 6 - UCHAR Lun; // offset 7 - STOR_DEVICE_POWER_STATE DevicePowerState; // offset 8 - ULONG SrbFlags; // offset c - ULONG DataTransferLength; // offset 10 - ULONG TimeOutValue; // offset 14 - PVOID DataBuffer; // offset 18 - PVOID SenseInfoBuffer; // offset 1c - struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20 - PVOID OriginalRequest; // offset 24 - PVOID SrbExtension; // offset 28 - STOR_POWER_ACTION PowerAction; // offset 2c - -#if defined(_WIN64) - - // - // Force PVOID alignment of Cdb - // - - ULONG Reserved; - -#endif - - UCHAR Reserved5[16]; // offset 30 -} SCSI_POWER_REQUEST_BLOCK, *PSCSI_POWER_REQUEST_BLOCK; - -// -// PNP minor function codes. -// -typedef enum { - StorStartDevice = 0x0, - StorRemoveDevice = 0x2, - StorStopDevice = 0x4, - StorQueryCapabilities = 0x9, - StorQueryResourceRequirements = 0xB, - StorFilterResourceRequirements = 0xD, - StorSurpriseRemoval = 0x17 -} STOR_PNP_ACTION, *PSTOR_PNP_ACTION; - -typedef struct _STOR_DEVICE_CAPABILITIES { - USHORT Version; - ULONG DeviceD1:1; - ULONG DeviceD2:1; - ULONG LockSupported:1; - ULONG EjectSupported:1; - ULONG Removable:1; - ULONG DockDevice:1; - ULONG UniqueID:1; - ULONG SilentInstall:1; - ULONG SurpriseRemovalOK:1; - ULONG NoDisplayInUI:1; - -} STOR_DEVICE_CAPABILITIES, *PSTOR_DEVICE_CAPABILITIES; - -typedef struct _SCSI_PNP_REQUEST_BLOCK { - USHORT Length; // offset 0 - UCHAR Function; // offset 2 - UCHAR SrbStatus; // offset 3 - UCHAR PnPSubFunction; // offset 4 - UCHAR PathId; // offset 5 - UCHAR TargetId; // offset 6 - UCHAR Lun; // offset 7 - STOR_PNP_ACTION PnPAction; // offset 8 - ULONG SrbFlags; // offset c - ULONG DataTransferLength; // offset 10 - ULONG TimeOutValue; // offset 14 - PVOID DataBuffer; // offset 18 - PVOID SenseInfoBuffer; // offset 1c - struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20 - PVOID OriginalRequest; // offset 24 - PVOID SrbExtension; // offset 28 - ULONG SrbPnPFlags; // offset 2c - -#if defined(_WIN64) - - // - // Force PVOID alignment of Cdb - // - - ULONG Reserved; - -#endif - UCHAR Reserved4[16]; // offset 30 -} SCSI_PNP_REQUEST_BLOCK, *PSCSI_PNP_REQUEST_BLOCK; - - -// -// SRB Functions -// - -#define SRB_FUNCTION_EXECUTE_SCSI 0x00 -#define SRB_FUNCTION_CLAIM_DEVICE 0x01 -#define SRB_FUNCTION_IO_CONTROL 0x02 -#define SRB_FUNCTION_RECEIVE_EVENT 0x03 -#define SRB_FUNCTION_RELEASE_QUEUE 0x04 -#define SRB_FUNCTION_ATTACH_DEVICE 0x05 -#define SRB_FUNCTION_RELEASE_DEVICE 0x06 -#define SRB_FUNCTION_SHUTDOWN 0x07 -#define SRB_FUNCTION_FLUSH 0x08 -#define SRB_FUNCTION_ABORT_COMMAND 0x10 -#define SRB_FUNCTION_RELEASE_RECOVERY 0x11 -#define SRB_FUNCTION_RESET_BUS 0x12 -#define SRB_FUNCTION_RESET_DEVICE 0x13 -#define SRB_FUNCTION_TERMINATE_IO 0x14 -#define SRB_FUNCTION_FLUSH_QUEUE 0x15 -#define SRB_FUNCTION_REMOVE_DEVICE 0x16 -#define SRB_FUNCTION_WMI 0x17 -#define SRB_FUNCTION_LOCK_QUEUE 0x18 -#define SRB_FUNCTION_UNLOCK_QUEUE 0x19 -#define SRB_FUNCTION_RESET_LOGICAL_UNIT 0x20 -#define SRB_FUNCTION_SET_LINK_TIMEOUT 0x21 -#define SRB_FUNCTION_LINK_TIMEOUT_OCCURRED 0x22 -#define SRB_FUNCTION_LINK_TIMEOUT_COMPLETE 0x23 -#define SRB_FUNCTION_POWER 0x24 -#define SRB_FUNCTION_PNP 0x25 -#define SRB_FUNCTION_DUMP_POINTERS 0x26 -// -// SRB Status -// - -#define SRB_STATUS_PENDING 0x00 -#define SRB_STATUS_SUCCESS 0x01 -#define SRB_STATUS_ABORTED 0x02 -#define SRB_STATUS_ABORT_FAILED 0x03 -#define SRB_STATUS_ERROR 0x04 -#define SRB_STATUS_BUSY 0x05 -#define SRB_STATUS_INVALID_REQUEST 0x06 -#define SRB_STATUS_INVALID_PATH_ID 0x07 -#define SRB_STATUS_NO_DEVICE 0x08 -#define SRB_STATUS_TIMEOUT 0x09 -#define SRB_STATUS_SELECTION_TIMEOUT 0x0A -#define SRB_STATUS_COMMAND_TIMEOUT 0x0B -#define SRB_STATUS_MESSAGE_REJECTED 0x0D -#define SRB_STATUS_BUS_RESET 0x0E -#define SRB_STATUS_PARITY_ERROR 0x0F -#define SRB_STATUS_REQUEST_SENSE_FAILED 0x10 -#define SRB_STATUS_NO_HBA 0x11 -#define SRB_STATUS_DATA_OVERRUN 0x12 -#define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13 -#define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14 -#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15 -#define SRB_STATUS_REQUEST_FLUSHED 0x16 -#define SRB_STATUS_INVALID_LUN 0x20 -#define SRB_STATUS_INVALID_TARGET_ID 0x21 -#define SRB_STATUS_BAD_FUNCTION 0x22 -#define SRB_STATUS_ERROR_RECOVERY 0x23 -#define SRB_STATUS_NOT_POWERED 0x24 -#define SRB_STATUS_LINK_DOWN 0x25 - -// -// This value is used by the port driver to indicate that a non-scsi-related -// error occured. Miniports must never return this status. -// - -#define SRB_STATUS_INTERNAL_ERROR 0x30 - -// -// Srb status values 0x38 through 0x3f are reserved for internal port driver -// use. -// - - - -// -// SRB Status Masks -// - -#define SRB_STATUS_QUEUE_FROZEN 0x40 -#define SRB_STATUS_AUTOSENSE_VALID 0x80 - -#define SRB_STATUS(Status) (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN)) - -// -// SRB Flag Bits -// - -#define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002 -#define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004 -#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008 - -#define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010 -#define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020 -#define SRB_FLAGS_DATA_IN 0x00000040 -#define SRB_FLAGS_DATA_OUT 0x00000080 -#define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000 -#define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT) - -#define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100 -#define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200 -#define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400 - -#define SRB_FLAGS_IS_ACTIVE 0x00010000 -#define SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000 -#define SRB_FLAGS_SGLIST_FROM_POOL 0x00040000 -#define SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000 - -#define SRB_FLAGS_NO_KEEP_AWAKE 0x00100000 -#define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000 - -#define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000 -#define SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000 - -#define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000 -#define SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000 - -#if DBG==1 -// -// A signature used to validate the scsi port number -// at the end of a sense buffer. -// -#define SCSI_PORT_SIGNATURE 0x54524f50 -#endif - -// -// Queue Action -// - -#define SRB_SIMPLE_TAG_REQUEST 0x20 -#define SRB_HEAD_OF_QUEUE_TAG_REQUEST 0x21 -#define SRB_ORDERED_QUEUE_TAG_REQUEST 0x22 - -#define SRB_WMI_FLAGS_ADAPTER_REQUEST 0x01 -#define SRB_POWER_FLAGS_ADAPTER_REQUEST 0x01 -#define SRB_PNP_FLAGS_ADAPTER_REQUEST 0x01 - -// end_ntminitape - - -// -// Command Descriptor Block. Passed by SCSI controller chip over the SCSI bus -// - -#pragma pack(push, cdb, 1) -typedef union _CDB { - - // - // Generic 6-Byte CDB - // - - struct _CDB6GENERIC { - UCHAR OperationCode; - UCHAR Immediate : 1; - UCHAR CommandUniqueBits : 4; - UCHAR LogicalUnitNumber : 3; - UCHAR CommandUniqueBytes[3]; - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved : 4; - UCHAR VendorUnique : 2; - } CDB6GENERIC; - - // - // Standard 6-byte CDB - // - - struct _CDB6READWRITE { - UCHAR OperationCode; // 0x08, 0x0A - SCSIOP_READ, SCSIOP_WRITE - UCHAR LogicalBlockMsb1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlockMsb0; - UCHAR LogicalBlockLsb; - UCHAR TransferBlocks; - UCHAR Control; - } CDB6READWRITE; - - // - // SCSI-1 Inquiry CDB - // - - struct _CDB6INQUIRY { - UCHAR OperationCode; // 0x12 - SCSIOP_INQUIRY - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR PageCode; - UCHAR IReserved; - UCHAR AllocationLength; - UCHAR Control; - } CDB6INQUIRY; - - // - // SCSI-3 Inquiry CDB - // - - struct _CDB6INQUIRY3 { - UCHAR OperationCode; // 0x12 - SCSIOP_INQUIRY - UCHAR EnableVitalProductData : 1; - UCHAR CommandSupportData : 1; - UCHAR Reserved1 : 6; - UCHAR PageCode; - UCHAR Reserved2; - UCHAR AllocationLength; - UCHAR Control; - } CDB6INQUIRY3; - - struct _CDB6VERIFY { - UCHAR OperationCode; // 0x13 - SCSIOP_VERIFY - UCHAR Fixed : 1; - UCHAR ByteCompare : 1; - UCHAR Immediate : 1; - UCHAR Reserved : 2; - UCHAR LogicalUnitNumber : 3; - UCHAR VerificationLength[3]; - UCHAR Control; - } CDB6VERIFY; - - // - // SCSI Format CDB - // - - struct _CDB6FORMAT { - UCHAR OperationCode; // 0x04 - SCSIOP_FORMAT_UNIT - UCHAR FormatControl : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR FReserved1; - UCHAR InterleaveMsb; - UCHAR InterleaveLsb; - UCHAR FReserved2; - } CDB6FORMAT; - - // - // Standard 10-byte CDB - - struct _CDB10 { - UCHAR OperationCode; - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 2; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlockByte0; - UCHAR LogicalBlockByte1; - UCHAR LogicalBlockByte2; - UCHAR LogicalBlockByte3; - UCHAR Reserved2; - UCHAR TransferBlocksMsb; - UCHAR TransferBlocksLsb; - UCHAR Control; - } CDB10; - - // - // Standard 12-byte CDB - // - - struct _CDB12 { - UCHAR OperationCode; - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 2; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlock[4]; - UCHAR TransferLength[4]; - UCHAR Reserved2; - UCHAR Control; - } CDB12; - - - - // - // Standard 16-byte CDB - // - - struct _CDB16 { - UCHAR OperationCode; - UCHAR Reserved1 : 3; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR Protection : 3; - UCHAR LogicalBlock[8]; - UCHAR TransferLength[4]; - UCHAR Reserved2; - UCHAR Control; - } CDB16; - - - // - // CD Rom Audio CDBs - // - - struct _PAUSE_RESUME { - UCHAR OperationCode; // 0x4B - SCSIOP_PAUSE_RESUME - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[6]; - UCHAR Action; - UCHAR Control; - } PAUSE_RESUME; - - // - // Read Table of Contents - // - - struct _READ_TOC { - UCHAR OperationCode; // 0x43 - SCSIOP_READ_TOC - UCHAR Reserved0 : 1; - UCHAR Msf : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR Format2 : 4; - UCHAR Reserved2 : 4; - UCHAR Reserved3[3]; - UCHAR StartingTrack; - UCHAR AllocationLength[2]; - UCHAR Control : 6; - UCHAR Format : 2; - } READ_TOC; - - struct _READ_DISK_INFORMATION { - UCHAR OperationCode; // 0x51 - SCSIOP_READ_DISC_INFORMATION - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[5]; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_DISK_INFORMATION, READ_DISC_INFORMATION; - - struct _READ_TRACK_INFORMATION { - UCHAR OperationCode; // 0x52 - SCSIOP_READ_TRACK_INFORMATION - UCHAR Track : 2; - UCHAR Reserved4 : 3; - UCHAR Lun : 3; - UCHAR BlockAddress[4]; // or Track Number - UCHAR Reserved3; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_TRACK_INFORMATION; - - struct _RESERVE_TRACK_RZONE { - UCHAR OperationCode; // 0x53 - SCSIOP_RESERVE_TRACK_RZONE - UCHAR Reserved1[4]; - UCHAR ReservationSize[4]; - UCHAR Control; - } RESERVE_TRACK_RZONE; - - struct _SEND_OPC_INFORMATION { - UCHAR OperationCode; // 0x54 - SCSIOP_SEND_OPC_INFORMATION - UCHAR DoOpc : 1; // perform OPC - UCHAR Reserved1 : 7; - UCHAR Exclude0 : 1; // exclude layer 0 - UCHAR Exclude1 : 1; // exclude layer 1 - UCHAR Reserved2 : 6; - UCHAR Reserved3[4]; - UCHAR ParameterListLength[2]; - UCHAR Reserved4; - } SEND_OPC_INFORMATION; - - struct _REPAIR_TRACK { - UCHAR OperationCode; // 0x58 - SCSIOP_REPAIR_TRACK - UCHAR Immediate : 1; - UCHAR Reserved1 : 7; - UCHAR Reserved2[2]; - UCHAR TrackNumber[2]; - UCHAR Reserved3[3]; - UCHAR Control; - } REPAIR_TRACK; - - struct _CLOSE_TRACK { - UCHAR OperationCode; // 0x5B - SCSIOP_CLOSE_TRACK_SESSION - UCHAR Immediate : 1; - UCHAR Reserved1 : 7; - UCHAR Track : 1; - UCHAR Session : 1; - UCHAR Reserved2 : 6; - UCHAR Reserved3; - UCHAR TrackNumber[2]; - UCHAR Reserved4[3]; - UCHAR Control; - } CLOSE_TRACK; - - struct _READ_BUFFER_CAPACITY { - UCHAR OperationCode; // 0x5C - SCSIOP_READ_BUFFER_CAPACITY - UCHAR BlockInfo : 1; - UCHAR Reserved1 : 7; - UCHAR Reserved2[5]; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_BUFFER_CAPACITY; - - struct _SEND_CUE_SHEET { - UCHAR OperationCode; // 0x5D - SCSIOP_SEND_CUE_SHEET - UCHAR Reserved[5]; - UCHAR CueSheetSize[3]; - UCHAR Control; - } SEND_CUE_SHEET; - - struct _READ_HEADER { - UCHAR OperationCode; // 0x44 - SCSIOP_READ_HEADER - UCHAR Reserved1 : 1; - UCHAR Msf : 1; - UCHAR Reserved2 : 3; - UCHAR Lun : 3; - UCHAR LogicalBlockAddress[4]; - UCHAR Reserved3; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_HEADER; - - struct _PLAY_AUDIO { - UCHAR OperationCode; // 0x45 - SCSIOP_PLAY_AUDIO - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR StartingBlockAddress[4]; - UCHAR Reserved2; - UCHAR PlayLength[2]; - UCHAR Control; - } PLAY_AUDIO; - - struct _PLAY_AUDIO_MSF { - UCHAR OperationCode; // 0x47 - SCSIOP_PLAY_AUDIO_MSF - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2; - UCHAR StartingM; - UCHAR StartingS; - UCHAR StartingF; - UCHAR EndingM; - UCHAR EndingS; - UCHAR EndingF; - UCHAR Control; - } PLAY_AUDIO_MSF; - - struct _BLANK_MEDIA { - UCHAR OperationCode; // 0xA1 - SCSIOP_BLANK - UCHAR BlankType : 3; - UCHAR Reserved1 : 1; - UCHAR Immediate : 1; - UCHAR Reserved2 : 3; - UCHAR AddressOrTrack[4]; - UCHAR Reserved3[5]; - UCHAR Control; - } BLANK_MEDIA; - - struct _PLAY_CD { - UCHAR OperationCode; // 0xBC - SCSIOP_PLAY_CD - UCHAR Reserved1 : 1; - UCHAR CMSF : 1; // LBA = 0, MSF = 1 - UCHAR ExpectedSectorType : 3; - UCHAR Lun : 3; - - union { - struct _LBA { - UCHAR StartingBlockAddress[4]; - UCHAR PlayLength[4]; - } LBA; - - struct _MSF { - UCHAR Reserved1; - UCHAR StartingM; - UCHAR StartingS; - UCHAR StartingF; - UCHAR EndingM; - UCHAR EndingS; - UCHAR EndingF; - UCHAR Reserved2; - } MSF; - }; - - UCHAR Audio : 1; - UCHAR Composite : 1; - UCHAR Port1 : 1; - UCHAR Port2 : 1; - UCHAR Reserved2 : 3; - UCHAR Speed : 1; - UCHAR Control; - } PLAY_CD; - - struct _SCAN_CD { - UCHAR OperationCode; // 0xBA - SCSIOP_SCAN_CD - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 3; - UCHAR Direct : 1; - UCHAR Lun : 3; - UCHAR StartingAddress[4]; - UCHAR Reserved2[3]; - UCHAR Reserved3 : 6; - UCHAR Type : 2; - UCHAR Reserved4; - UCHAR Control; - } SCAN_CD; - - struct _STOP_PLAY_SCAN { - UCHAR OperationCode; // 0x4E - SCSIOP_STOP_PLAY_SCAN - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[7]; - UCHAR Control; - } STOP_PLAY_SCAN; - - - // - // Read SubChannel Data - // - - struct _SUBCHANNEL { - UCHAR OperationCode; // 0x42 - SCSIOP_READ_SUB_CHANNEL - UCHAR Reserved0 : 1; - UCHAR Msf : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2 : 6; - UCHAR SubQ : 1; - UCHAR Reserved3 : 1; - UCHAR Format; - UCHAR Reserved4[2]; - UCHAR TrackNumber; - UCHAR AllocationLength[2]; - UCHAR Control; - } SUBCHANNEL; - - // - // Read CD. Used by Atapi for raw sector reads. - // - - struct _READ_CD { - UCHAR OperationCode; // 0xBE - SCSIOP_READ_CD - UCHAR RelativeAddress : 1; - UCHAR Reserved0 : 1; - UCHAR ExpectedSectorType : 3; - UCHAR Lun : 3; - UCHAR StartingLBA[4]; - UCHAR TransferBlocks[3]; - UCHAR Reserved2 : 1; - UCHAR ErrorFlags : 2; - UCHAR IncludeEDC : 1; - UCHAR IncludeUserData : 1; - UCHAR HeaderCode : 2; - UCHAR IncludeSyncData : 1; - UCHAR SubChannelSelection : 3; - UCHAR Reserved3 : 5; - UCHAR Control; - } READ_CD; - - struct _READ_CD_MSF { - UCHAR OperationCode; // 0xB9 - SCSIOP_READ_CD_MSF - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 1; - UCHAR ExpectedSectorType : 3; - UCHAR Lun : 3; - UCHAR Reserved2; - UCHAR StartingM; - UCHAR StartingS; - UCHAR StartingF; - UCHAR EndingM; - UCHAR EndingS; - UCHAR EndingF; - UCHAR Reserved4 : 1; - UCHAR ErrorFlags : 2; - UCHAR IncludeEDC : 1; - UCHAR IncludeUserData : 1; - UCHAR HeaderCode : 2; - UCHAR IncludeSyncData : 1; - UCHAR SubChannelSelection : 3; - UCHAR Reserved5 : 5; - UCHAR Control; - } READ_CD_MSF; - - // - // Plextor Read CD-DA - // - - struct _PLXTR_READ_CDDA { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR Reserved0 : 5; - UCHAR LogicalUnitNumber :3; - UCHAR LogicalBlockByte0; - UCHAR LogicalBlockByte1; - UCHAR LogicalBlockByte2; - UCHAR LogicalBlockByte3; - UCHAR TransferBlockByte0; - UCHAR TransferBlockByte1; - UCHAR TransferBlockByte2; - UCHAR TransferBlockByte3; - UCHAR SubCode; - UCHAR Control; - } PLXTR_READ_CDDA; - - // - // NEC Read CD-DA - // - - struct _NEC_READ_CDDA { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR Reserved0; - UCHAR LogicalBlockByte0; - UCHAR LogicalBlockByte1; - UCHAR LogicalBlockByte2; - UCHAR LogicalBlockByte3; - UCHAR Reserved1; - UCHAR TransferBlockByte0; - UCHAR TransferBlockByte1; - UCHAR Control; - } NEC_READ_CDDA; - - // - // Mode sense - // - - struct _MODE_SENSE { - UCHAR OperationCode; // 0x1A - SCSIOP_MODE_SENSE - UCHAR Reserved1 : 3; - UCHAR Dbd : 1; - UCHAR Reserved2 : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR PageCode : 6; - UCHAR Pc : 2; - UCHAR Reserved3; - UCHAR AllocationLength; - UCHAR Control; - } MODE_SENSE; - - struct _MODE_SENSE10 { - UCHAR OperationCode; // 0x5A - SCSIOP_MODE_SENSE10 - UCHAR Reserved1 : 3; - UCHAR Dbd : 1; - UCHAR Reserved2 : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR PageCode : 6; - UCHAR Pc : 2; - UCHAR Reserved3[4]; - UCHAR AllocationLength[2]; - UCHAR Control; - } MODE_SENSE10; - - // - // Mode select - // - - struct _MODE_SELECT { - UCHAR OperationCode; // 0x15 - SCSIOP_MODE_SELECT - UCHAR SPBit : 1; - UCHAR Reserved1 : 3; - UCHAR PFBit : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[2]; - UCHAR ParameterListLength; - UCHAR Control; - } MODE_SELECT; - - struct _MODE_SELECT10 { - UCHAR OperationCode; // 0x55 - SCSIOP_MODE_SELECT10 - UCHAR SPBit : 1; - UCHAR Reserved1 : 3; - UCHAR PFBit : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[5]; - UCHAR ParameterListLength[2]; - UCHAR Control; - } MODE_SELECT10; - - struct _LOCATE { - UCHAR OperationCode; // 0x2B - SCSIOP_LOCATE - UCHAR Immediate : 1; - UCHAR CPBit : 1; - UCHAR BTBit : 1; - UCHAR Reserved1 : 2; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved3; - UCHAR LogicalBlockAddress[4]; - UCHAR Reserved4; - UCHAR Partition; - UCHAR Control; - } LOCATE; - - struct _LOGSENSE { - UCHAR OperationCode; // 0x4D - SCSIOP_LOG_SENSE - UCHAR SPBit : 1; - UCHAR PPCBit : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR PageCode : 6; - UCHAR PCBit : 2; - UCHAR Reserved2; - UCHAR Reserved3; - UCHAR ParameterPointer[2]; - UCHAR AllocationLength[2]; - UCHAR Control; - } LOGSENSE; - - struct _LOGSELECT { - UCHAR OperationCode; // 0x4C - SCSIOP_LOG_SELECT - UCHAR SPBit : 1; - UCHAR PCRBit : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved : 6; - UCHAR PCBit : 2; - UCHAR Reserved2[4]; - UCHAR ParameterListLength[2]; - UCHAR Control; - } LOGSELECT; - - struct _PRINT { - UCHAR OperationCode; // 0x0A - SCSIOP_PRINT - UCHAR Reserved : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR TransferLength[3]; - UCHAR Control; - } PRINT; - - struct _SEEK { - UCHAR OperationCode; // 0x2B - SCSIOP_SEEK - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlockAddress[4]; - UCHAR Reserved2[3]; - UCHAR Control; - } SEEK; - - struct _ERASE { - UCHAR OperationCode; // 0x19 - SCSIOP_ERASE - UCHAR Long : 1; - UCHAR Immediate : 1; - UCHAR Reserved1 : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[3]; - UCHAR Control; - } ERASE; - - struct _START_STOP { - UCHAR OperationCode; // 0x1B - SCSIOP_START_STOP_UNIT - UCHAR Immediate: 1; - UCHAR Reserved1 : 4; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[2]; - UCHAR Start : 1; - UCHAR LoadEject : 1; - UCHAR Reserved3 : 6; - UCHAR Control; - } START_STOP; - - struct _MEDIA_REMOVAL { - UCHAR OperationCode; // 0x1E - SCSIOP_MEDIUM_REMOVAL - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR Reserved2[2]; - - UCHAR Prevent : 1; - UCHAR Persistant : 1; - UCHAR Reserved3 : 6; - - UCHAR Control; - } MEDIA_REMOVAL; - - // - // Tape CDBs - // - - struct _SEEK_BLOCK { - UCHAR OperationCode; // 0x0C - SCSIOP_SEEK_BLOCK - UCHAR Immediate : 1; - UCHAR Reserved1 : 7; - UCHAR BlockAddress[3]; - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved2 : 4; - UCHAR VendorUnique : 2; - } SEEK_BLOCK; - - struct _REQUEST_BLOCK_ADDRESS { - UCHAR OperationCode; // 0x02 - SCSIOP_REQUEST_BLOCK_ADDR - UCHAR Reserved1[3]; - UCHAR AllocationLength; - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved2 : 4; - UCHAR VendorUnique : 2; - } REQUEST_BLOCK_ADDRESS; - - struct _PARTITION { - UCHAR OperationCode; // 0x0D - SCSIOP_PARTITION - UCHAR Immediate : 1; - UCHAR Sel: 1; - UCHAR PartitionSelect : 6; - UCHAR Reserved1[3]; - UCHAR Control; - } PARTITION; - - struct _WRITE_TAPE_MARKS { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR Immediate : 1; - UCHAR WriteSetMarks: 1; - UCHAR Reserved : 3; - UCHAR LogicalUnitNumber : 3; - UCHAR TransferLength[3]; - UCHAR Control; - } WRITE_TAPE_MARKS; - - struct _SPACE_TAPE_MARKS { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR Code : 3; - UCHAR Reserved : 2; - UCHAR LogicalUnitNumber : 3; - UCHAR NumMarksMSB ; - UCHAR NumMarks; - UCHAR NumMarksLSB; - union { - UCHAR value; - struct { - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved : 4; - UCHAR VendorUnique : 2; - } Fields; - } Byte6; - } SPACE_TAPE_MARKS; - - // - // Read tape position - // - - struct _READ_POSITION { - UCHAR Operation; // 0x43 - SCSIOP_READ_POSITION - UCHAR BlockType:1; - UCHAR Reserved1:4; - UCHAR Lun:3; - UCHAR Reserved2[7]; - UCHAR Control; - } READ_POSITION; - - // - // ReadWrite for Tape - // - - struct _CDB6READWRITETAPE { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR VendorSpecific : 5; - UCHAR Reserved : 3; - UCHAR TransferLenMSB; - UCHAR TransferLen; - UCHAR TransferLenLSB; - UCHAR Link : 1; - UCHAR Flag : 1; - UCHAR Reserved1 : 4; - UCHAR VendorUnique : 2; - } CDB6READWRITETAPE; - - // - // Medium changer CDB's - // - - struct _INIT_ELEMENT_STATUS { - UCHAR OperationCode; // 0x07 - SCSIOP_INIT_ELEMENT_STATUS - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNubmer : 3; - UCHAR Reserved2[3]; - UCHAR Reserved3 : 7; - UCHAR NoBarCode : 1; - } INIT_ELEMENT_STATUS; - - struct _INITIALIZE_ELEMENT_RANGE { - UCHAR OperationCode; // 0xE7 - SCSIOP_INIT_ELEMENT_RANGE - UCHAR Range : 1; - UCHAR Reserved1 : 4; - UCHAR LogicalUnitNubmer : 3; - UCHAR FirstElementAddress[2]; - UCHAR Reserved2[2]; - UCHAR NumberOfElements[2]; - UCHAR Reserved3; - UCHAR Reserved4 : 7; - UCHAR NoBarCode : 1; - } INITIALIZE_ELEMENT_RANGE; - - struct _POSITION_TO_ELEMENT { - UCHAR OperationCode; // 0x2B - SCSIOP_POSITION_TO_ELEMENT - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR TransportElementAddress[2]; - UCHAR DestinationElementAddress[2]; - UCHAR Reserved2[2]; - UCHAR Flip : 1; - UCHAR Reserved3 : 7; - UCHAR Control; - } POSITION_TO_ELEMENT; - - struct _MOVE_MEDIUM { - UCHAR OperationCode; // 0xA5 - SCSIOP_MOVE_MEDIUM - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR TransportElementAddress[2]; - UCHAR SourceElementAddress[2]; - UCHAR DestinationElementAddress[2]; - UCHAR Reserved2[2]; - UCHAR Flip : 1; - UCHAR Reserved3 : 7; - UCHAR Control; - } MOVE_MEDIUM; - - struct _EXCHANGE_MEDIUM { - UCHAR OperationCode; // 0xA6 - SCSIOP_EXCHANGE_MEDIUM - UCHAR Reserved1 : 5; - UCHAR LogicalUnitNumber : 3; - UCHAR TransportElementAddress[2]; - UCHAR SourceElementAddress[2]; - UCHAR Destination1ElementAddress[2]; - UCHAR Destination2ElementAddress[2]; - UCHAR Flip1 : 1; - UCHAR Flip2 : 1; - UCHAR Reserved3 : 6; - UCHAR Control; - } EXCHANGE_MEDIUM; - - struct _READ_ELEMENT_STATUS { - UCHAR OperationCode; // 0xB8 - SCSIOP_READ_ELEMENT_STATUS - UCHAR ElementType : 4; - UCHAR VolTag : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR StartingElementAddress[2]; - UCHAR NumberOfElements[2]; - UCHAR Reserved1; - UCHAR AllocationLength[3]; - UCHAR Reserved2; - UCHAR Control; - } READ_ELEMENT_STATUS; - - struct _SEND_VOLUME_TAG { - UCHAR OperationCode; // 0xB6 - SCSIOP_SEND_VOLUME_TAG - UCHAR ElementType : 4; - UCHAR Reserved1 : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR StartingElementAddress[2]; - UCHAR Reserved2; - UCHAR ActionCode : 5; - UCHAR Reserved3 : 3; - UCHAR Reserved4[2]; - UCHAR ParameterListLength[2]; - UCHAR Reserved5; - UCHAR Control; - } SEND_VOLUME_TAG; - - struct _REQUEST_VOLUME_ELEMENT_ADDRESS { - UCHAR OperationCode; // Unknown -- vendor-unique? - UCHAR ElementType : 4; - UCHAR VolTag : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR StartingElementAddress[2]; - UCHAR NumberElements[2]; - UCHAR Reserved1; - UCHAR AllocationLength[3]; - UCHAR Reserved2; - UCHAR Control; - } REQUEST_VOLUME_ELEMENT_ADDRESS; - - // - // Atapi 2.5 Changer 12-byte CDBs - // - - struct _LOAD_UNLOAD { - UCHAR OperationCode; // 0xA6 - SCSIOP_LOAD_UNLOAD_SLOT - UCHAR Immediate : 1; - UCHAR Reserved1 : 4; - UCHAR Lun : 3; - UCHAR Reserved2[2]; - UCHAR Start : 1; - UCHAR LoadEject : 1; - UCHAR Reserved3: 6; - UCHAR Reserved4[3]; - UCHAR Slot; - UCHAR Reserved5[3]; - } LOAD_UNLOAD; - - struct _MECH_STATUS { - UCHAR OperationCode; // 0xBD - SCSIOP_MECHANISM_STATUS - UCHAR Reserved : 5; - UCHAR Lun : 3; - UCHAR Reserved1[6]; - UCHAR AllocationLength[2]; - UCHAR Reserved2[1]; - UCHAR Control; - } MECH_STATUS; - - // - // C/DVD 0.9 CDBs - // - - struct _SYNCHRONIZE_CACHE10 { - - UCHAR OperationCode; // 0x35 - SCSIOP_SYNCHRONIZE_CACHE - - UCHAR RelAddr : 1; - UCHAR Immediate : 1; - UCHAR Reserved : 3; - UCHAR Lun : 3; - - UCHAR LogicalBlockAddress[4]; // Unused - set to zero - UCHAR Reserved2; - UCHAR BlockCount[2]; // Unused - set to zero - UCHAR Control; - } SYNCHRONIZE_CACHE10; - - struct _GET_EVENT_STATUS_NOTIFICATION { - UCHAR OperationCode; // 0x4A - SCSIOP_GET_EVENT_STATUS_NOTIFICATION - - UCHAR Immediate : 1; - UCHAR Reserved : 4; - UCHAR Lun : 3; - - UCHAR Reserved2[2]; - UCHAR NotificationClassRequest; - UCHAR Reserved3[2]; - UCHAR EventListLength[2]; - - UCHAR Control; - } GET_EVENT_STATUS_NOTIFICATION; - - struct _GET_PERFORMANCE { - UCHAR OperationCode; // 0xAC - SCSIOP_GET_PERFORMANCE - UCHAR Except : 2; - UCHAR Write : 1; - UCHAR Tolerance : 2; - UCHAR Reserved0 : 3; - UCHAR StartingLBA[4]; - UCHAR Reserved1[2]; - UCHAR MaximumNumberOfDescriptors[2]; - UCHAR Type; - UCHAR Control; - } GET_PERFORMANCE; - - struct _READ_DVD_STRUCTURE { - UCHAR OperationCode; // 0xAD - SCSIOP_READ_DVD_STRUCTURE - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR RMDBlockNumber[4]; - UCHAR LayerNumber; - UCHAR Format; - UCHAR AllocationLength[2]; - UCHAR Reserved3 : 6; - UCHAR AGID : 2; - UCHAR Control; - } READ_DVD_STRUCTURE; - - struct _SET_STREAMING { - UCHAR OperationCode; // 0xB6 - SCSIOP_SET_STREAMING - UCHAR Reserved[8]; - UCHAR ParameterListLength[2]; - UCHAR Control; - } SET_STREAMING; - - struct _SEND_DVD_STRUCTURE { - UCHAR OperationCode; // 0xBF - SCSIOP_SEND_DVD_STRUCTURE - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[5]; - UCHAR Format; - UCHAR ParameterListLength[2]; - UCHAR Reserved3; - UCHAR Control; - } SEND_DVD_STRUCTURE; - - struct _SEND_KEY { - UCHAR OperationCode; // 0xA3 - SCSIOP_SEND_KEY - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[6]; - UCHAR ParameterListLength[2]; - UCHAR KeyFormat : 6; - UCHAR AGID : 2; - UCHAR Control; - } SEND_KEY; - - struct _REPORT_KEY { - UCHAR OperationCode; // 0xA4 - SCSIOP_REPORT_KEY - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR LogicalBlockAddress[4]; // for title key - UCHAR Reserved2[2]; - UCHAR AllocationLength[2]; - UCHAR KeyFormat : 6; - UCHAR AGID : 2; - UCHAR Control; - } REPORT_KEY; - - struct _SET_READ_AHEAD { - UCHAR OperationCode; // 0xA7 - SCSIOP_SET_READ_AHEAD - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR TriggerLBA[4]; - UCHAR ReadAheadLBA[4]; - UCHAR Reserved2; - UCHAR Control; - } SET_READ_AHEAD; - - struct _READ_FORMATTED_CAPACITIES { - UCHAR OperationCode; // 0x23 - SCSIOP_READ_FORMATTED_CAPACITY - UCHAR Reserved1 : 5; - UCHAR Lun : 3; - UCHAR Reserved2[5]; - UCHAR AllocationLength[2]; - UCHAR Control; - } READ_FORMATTED_CAPACITIES; - - // - // SCSI-3 - // - - struct _REPORT_LUNS { - UCHAR OperationCode; // 0xA0 - SCSIOP_REPORT_LUNS - UCHAR Reserved1[5]; - UCHAR AllocationLength[4]; - UCHAR Reserved2[1]; - UCHAR Control; - } REPORT_LUNS; - - struct _PERSISTENT_RESERVE_IN { - UCHAR OperationCode; // 0x5E - SCSIOP_PERSISTENT_RESERVE_IN - UCHAR ServiceAction : 5; - UCHAR Reserved1 : 3; - UCHAR Reserved2[5]; - UCHAR AllocationLength[2]; - UCHAR Control; - } PERSISTENT_RESERVE_IN; - - struct _PERSISTENT_RESERVE_OUT { - UCHAR OperationCode; // 0x5F - SCSIOP_PERSISTENT_RESERVE_OUT - UCHAR ServiceAction : 5; - UCHAR Reserved1 : 3; - UCHAR Type : 4; - UCHAR Scope : 4; - UCHAR Reserved2[4]; - UCHAR ParameterListLength[2]; // 0x18 - UCHAR Control; - } PERSISTENT_RESERVE_OUT; - - // - // MMC / SFF-8090 commands - // - - struct _GET_CONFIGURATION { - UCHAR OperationCode; // 0x46 - SCSIOP_GET_CONFIGURATION - UCHAR RequestType : 2; // SCSI_GET_CONFIGURATION_REQUEST_TYPE_* - UCHAR Reserved1 : 6; // includes obsolete LUN field - UCHAR StartingFeature[2]; - UCHAR Reserved2[3]; - UCHAR AllocationLength[2]; - UCHAR Control; - } GET_CONFIGURATION; - - struct _SET_CD_SPEED { - UCHAR OperationCode; // 0xB8 - SCSIOP_SET_CD_SPEED - union { - UCHAR Reserved1; - struct { - UCHAR RotationControl : 2; - UCHAR Reserved3 : 6; - }; - }; - UCHAR ReadSpeed[2]; // 1x == (75 * 2352) - UCHAR WriteSpeed[2]; // 1x == (75 * 2352) - UCHAR Reserved2[5]; - UCHAR Control; - } SET_CD_SPEED; - - struct _READ12 { - UCHAR OperationCode; // 0xA8 - SCSIOP_READ12 - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 2; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlock[4]; - UCHAR TransferLength[4]; - UCHAR Reserved2 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } READ12; - - struct _WRITE12 { - UCHAR OperationCode; // 0xAA - SCSIOP_WRITE12 - UCHAR RelativeAddress : 1; - UCHAR Reserved1 : 1; - UCHAR EBP : 1; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR LogicalUnitNumber : 3; - UCHAR LogicalBlock[4]; - UCHAR TransferLength[4]; - UCHAR Reserved2 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } WRITE12; - - // - // 16-byte CDBs - // - - struct _READ16 { - UCHAR OperationCode; // 0x88 - SCSIOP_READ16 - UCHAR Reserved1 : 3; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR ReadProtect : 3; - UCHAR LogicalBlock[8]; - UCHAR TransferLength[4]; - UCHAR Reserved2 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } READ16; - - struct _WRITE16 { - UCHAR OperationCode; // 0x8A - SCSIOP_WRITE16 - UCHAR Reserved1 : 3; - UCHAR ForceUnitAccess : 1; - UCHAR DisablePageOut : 1; - UCHAR WriteProtect : 3; - UCHAR LogicalBlock[8]; - UCHAR TransferLength[4]; - UCHAR Reserved2 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } WRITE16; - - struct _VERIFY16 { - UCHAR OperationCode; // 0x8F - SCSIOP_VERIFY16 - UCHAR Reserved1 : 1; - UCHAR ByteCheck : 1; - UCHAR BlockVerify : 1; - UCHAR Reserved2 : 1; - UCHAR DisablePageOut : 1; - UCHAR VerifyProtect : 3; - UCHAR LogicalBlock[8]; - UCHAR VerificationLength[4]; - UCHAR Reserved3 : 7; - UCHAR Streaming : 1; - UCHAR Control; - } VERIFY16; - - struct _SYNCHRONIZE_CACHE16 { - UCHAR OperationCode; // 0x91 - SCSIOP_SYNCHRONIZE_CACHE16 - UCHAR Reserved1 : 1; - UCHAR Immediate : 1; - UCHAR Reserved2 : 6; - UCHAR LogicalBlock[8]; - UCHAR BlockCount[4]; - UCHAR Reserved3; - UCHAR Control; - } SYNCHRONIZE_CACHE16; - - struct _READ_CAPACITY16 { - UCHAR OperationCode; // 0x9E - SCSIOP_READ_CAPACITY16 - UCHAR ServiceAction : 5; - UCHAR Reserved1 : 3; - UCHAR LogicalBlock[8]; - UCHAR BlockCount[4]; - UCHAR PMI : 1; - UCHAR Reserved2 : 7; - UCHAR Control; - } READ_CAPACITY16; - - ULONG AsUlong[4]; - UCHAR AsByte[16]; - -} CDB, *PCDB; -#pragma pack(pop, cdb) - -//////////////////////////////////////////////////////////////////////////////// -// -// GET_EVENT_STATUS_NOTIFICATION -// - - -#define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_MASK 0x02 -#define NOTIFICATION_POWER_MANAGEMENT_CLASS_MASK 0x04 -#define NOTIFICATION_EXTERNAL_REQUEST_CLASS_MASK 0x08 -#define NOTIFICATION_MEDIA_STATUS_CLASS_MASK 0x10 -#define NOTIFICATION_MULTI_HOST_CLASS_MASK 0x20 -#define NOTIFICATION_DEVICE_BUSY_CLASS_MASK 0x40 - - -#define NOTIFICATION_NO_CLASS_EVENTS 0x0 -#define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_EVENTS 0x1 -#define NOTIFICATION_POWER_MANAGEMENT_CLASS_EVENTS 0x2 -#define NOTIFICATION_EXTERNAL_REQUEST_CLASS_EVENTS 0x3 -#define NOTIFICATION_MEDIA_STATUS_CLASS_EVENTS 0x4 -#define NOTIFICATION_MULTI_HOST_CLASS_EVENTS 0x5 -#define NOTIFICATION_DEVICE_BUSY_CLASS_EVENTS 0x6 - -#pragma pack(push, not_header, 1) -typedef struct _NOTIFICATION_EVENT_STATUS_HEADER { - UCHAR EventDataLength[2]; - - UCHAR NotificationClass : 3; - UCHAR Reserved : 4; - UCHAR NEA : 1; - - UCHAR SupportedEventClasses; -#if !defined(__midl) - UCHAR ClassEventData[0]; -#endif -} NOTIFICATION_EVENT_STATUS_HEADER, *PNOTIFICATION_EVENT_STATUS_HEADER; -#pragma pack(pop, not_header) - -#define NOTIFICATION_OPERATIONAL_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_REQUESTED 0x1 -#define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_OCCURRED 0x2 - -#define NOTIFICATION_OPERATIONAL_STATUS_AVAILABLE 0x0 -#define NOTIFICATION_OPERATIONAL_STATUS_TEMPORARY_BUSY 0x1 -#define NOTIFICATION_OPERATIONAL_STATUS_EXTENDED_BUSY 0x2 - -#define NOTIFICATION_OPERATIONAL_OPCODE_NONE 0x0 -#define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_CHANGE 0x1 -#define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_ADDED 0x2 -#define NOTIFICATION_OPERATIONAL_OPCODE_UNIT_RESET 0x3 -#define NOTIFICATION_OPERATIONAL_OPCODE_FIRMWARE_CHANGED 0x4 -#define NOTIFICATION_OPERATIONAL_OPCODE_INQUIRY_CHANGED 0x5 - -// -// Class event data may be one (or none) of the following: -// - -#pragma pack(push, not_op, 1) -typedef struct _NOTIFICATION_OPERATIONAL_STATUS { // event class == 0x1 - UCHAR OperationalEvent : 4; - UCHAR Reserved1 : 4; - UCHAR OperationalStatus : 4; - UCHAR Reserved2 : 3; - UCHAR PersistentPrevented : 1; - UCHAR Operation[2]; -} NOTIFICATION_OPERATIONAL_STATUS, *PNOTIFICATION_OPERATIONAL_STATUS; -#pragma pack(pop, not_op) - - -#define NOTIFICATION_POWER_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_POWER_EVENT_CHANGE_SUCCEEDED 0x1 -#define NOTIFICATION_POWER_EVENT_CHANGE_FAILED 0x2 - -#define NOTIFICATION_POWER_STATUS_ACTIVE 0x1 -#define NOTIFICATION_POWER_STATUS_IDLE 0x2 -#define NOTIFICATION_POWER_STATUS_STANDBY 0x3 -#define NOTIFICATION_POWER_STATUS_SLEEP 0x4 - -#pragma pack(push, not_power, 1) -typedef struct _NOTIFICATION_POWER_STATUS { // event class == 0x2 - UCHAR PowerEvent : 4; - UCHAR Reserved : 4; - UCHAR PowerStatus; - UCHAR Reserved2[2]; -} NOTIFICATION_POWER_STATUS, *PNOTIFICATION_POWER_STATUS; -#pragma pack(pop, not_power) - -#define NOTIFICATION_MEDIA_EVENT_NO_EVENT 0x0 -#define NOTIFICATION_EXTERNAL_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_EXTERNAL_EVENT_BUTTON_DOWN 0x1 -#define NOTIFICATION_EXTERNAL_EVENT_BUTTON_UP 0x2 -#define NOTIFICATION_EXTERNAL_EVENT_EXTERNAL 0x3 // respond with GET_CONFIGURATION? - -#define NOTIFICATION_EXTERNAL_STATUS_READY 0x0 -#define NOTIFICATION_EXTERNAL_STATUS_PREVENT 0x1 - -#define NOTIFICATION_EXTERNAL_REQUEST_NONE 0x0000 -#define NOTIFICATION_EXTERNAL_REQUEST_QUEUE_OVERRUN 0x0001 -#define NOTIFICATION_EXTERNAL_REQUEST_PLAY 0x0101 -#define NOTIFICATION_EXTERNAL_REQUEST_REWIND_BACK 0x0102 -#define NOTIFICATION_EXTERNAL_REQUEST_FAST_FORWARD 0x0103 -#define NOTIFICATION_EXTERNAL_REQUEST_PAUSE 0x0104 -#define NOTIFICATION_EXTERNAL_REQUEST_STOP 0x0106 -#define NOTIFICATION_EXTERNAL_REQUEST_ASCII_LOW 0x0200 -#define NOTIFICATION_EXTERNAL_REQUEST_ASCII_HIGH 0x02ff - -#pragma pack(push, not_extern, 1) -typedef struct _NOTIFICATION_EXTERNAL_STATUS { // event class == 0x3 - UCHAR ExternalEvent : 4; - UCHAR Reserved1 : 4; - UCHAR ExternalStatus : 4; - UCHAR Reserved2 : 3; - UCHAR PersistentPrevented : 1; - UCHAR Request[2]; -} NOTIFICATION_EXTERNAL_STATUS, *PNOTIFICATION_EXTERNAL_STATUS; -#pragma pack(pop, not_extern) - -#define NOTIFICATION_MEDIA_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_MEDIA_EVENT_EJECT_REQUEST 0x1 -#define NOTIFICATION_MEDIA_EVENT_NEW_MEDIA 0x2 -#define NOTIFICATION_MEDIA_EVENT_MEDIA_REMOVAL 0x3 -#define NOTIFICATION_MEDIA_EVENT_MEDIA_CHANGE 0x4 - -#pragma pack(push, not_media, 1) -typedef struct _NOTIFICATION_MEDIA_STATUS { // event class == 0x4 - UCHAR MediaEvent : 4; - UCHAR Reserved : 4; - - union { - UCHAR PowerStatus; // OBSOLETE -- was improperly named in NT5 headers - UCHAR MediaStatus; // Use this for currently reserved fields - struct { - UCHAR DoorTrayOpen : 1; - UCHAR MediaPresent : 1; - UCHAR ReservedX : 6; // do not reference this directly! - }; - }; - UCHAR StartSlot; - UCHAR EndSlot; -} NOTIFICATION_MEDIA_STATUS, *PNOTIFICATION_MEDIA_STATUS; -#pragma pack(pop, not_media) - -#define NOTIFICATION_BUSY_EVENT_NO_EVENT 0x0 -#define NOTIFICATION_MULTI_HOST_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_REQUEST 0x1 -#define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_GRANT 0x2 -#define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_RELEASE 0x3 - -#define NOTIFICATION_MULTI_HOST_STATUS_READY 0x0 -#define NOTIFICATION_MULTI_HOST_STATUS_PREVENT 0x1 - -#define NOTIFICATION_MULTI_HOST_PRIORITY_NO_REQUESTS 0x0 -#define NOTIFICATION_MULTI_HOST_PRIORITY_LOW 0x1 -#define NOTIFICATION_MULTI_HOST_PRIORITY_MEDIUM 0x2 -#define NOTIFICATION_MULTI_HOST_PRIORITY_HIGH 0x3 - -#pragma pack(push, not_multi, 1) -typedef struct _NOTIFICATION_MULTI_HOST_STATUS { // event class == 0x5 - UCHAR MultiHostEvent : 4; - UCHAR Reserved1 : 4; - UCHAR MultiHostStatus : 4; - UCHAR Reserved2 : 3; - UCHAR PersistentPrevented : 1; - UCHAR Priority[2]; -} NOTIFICATION_MULTI_HOST_STATUS, *PNOTIFICATION_MULTI_HOST_STATUS; -#pragma pack(pop, not_multi) - -#define NOTIFICATION_BUSY_EVENT_NO_EVENT 0x0 -#define NOTIFICATION_BUSY_EVENT_NO_CHANGE 0x0 -#define NOTIFICATION_BUSY_EVENT_BUSY 0x1 - -#define NOTIFICATION_BUSY_STATUS_NO_EVENT 0x0 -#define NOTIFICATION_BUSY_STATUS_POWER 0x1 -#define NOTIFICATION_BUSY_STATUS_IMMEDIATE 0x2 -#define NOTIFICATION_BUSY_STATUS_DEFERRED 0x3 - -#pragma pack(push, not_busy, 1) -typedef struct _NOTIFICATION_BUSY_STATUS { // event class == 0x6 - UCHAR DeviceBusyEvent : 4; - UCHAR Reserved : 4; - - UCHAR DeviceBusyStatus; - UCHAR Time[2]; -} NOTIFICATION_BUSY_STATUS, *PNOTIFICATION_BUSY_STATUS; -#pragma pack(pop, not_busy) - -//////////////////////////////////////////////////////////////////////////////// - -// -// Read DVD Structure Definitions and Constants -// - -#define DVD_FORMAT_LEAD_IN 0x00 -#define DVD_FORMAT_COPYRIGHT 0x01 -#define DVD_FORMAT_DISK_KEY 0x02 -#define DVD_FORMAT_BCA 0x03 -#define DVD_FORMAT_MANUFACTURING 0x04 - -#pragma pack(push, dvd_struct_header, 1) -typedef struct _READ_DVD_STRUCTURES_HEADER { - UCHAR Length[2]; - UCHAR Reserved[2]; - -#if !defined(__midl) - UCHAR Data[0]; -#endif -} READ_DVD_STRUCTURES_HEADER, *PREAD_DVD_STRUCTURES_HEADER; -#pragma pack(pop, dvd_struct_header) - -// -// DiskKey, BCA & Manufacturer information will provide byte arrays as their -// data. -// - -// -// CDVD 0.9 Send & Report Key Definitions and Structures -// - -#define DVD_REPORT_AGID 0x00 -#define DVD_CHALLENGE_KEY 0x01 -#define DVD_KEY_1 0x02 -#define DVD_KEY_2 0x03 -#define DVD_TITLE_KEY 0x04 -#define DVD_REPORT_ASF 0x05 -#define DVD_INVALIDATE_AGID 0x3F - -#pragma pack(push, dvdstuff, 1) -typedef struct _CDVD_KEY_HEADER { - UCHAR DataLength[2]; - UCHAR Reserved[2]; -#if !defined(__midl) - UCHAR Data[0]; -#endif -} CDVD_KEY_HEADER, *PCDVD_KEY_HEADER; - -typedef struct _CDVD_REPORT_AGID_DATA { - UCHAR Reserved1[3]; - UCHAR Reserved2 : 6; - UCHAR AGID : 2; -} CDVD_REPORT_AGID_DATA, *PCDVD_REPORT_AGID_DATA; - -typedef struct _CDVD_CHALLENGE_KEY_DATA { - UCHAR ChallengeKeyValue[10]; - UCHAR Reserved[2]; -} CDVD_CHALLENGE_KEY_DATA, *PCDVD_CHALLENGE_KEY_DATA; - -typedef struct _CDVD_KEY_DATA { - UCHAR Key[5]; - UCHAR Reserved[3]; -} CDVD_KEY_DATA, *PCDVD_KEY_DATA; - -typedef struct _CDVD_REPORT_ASF_DATA { - UCHAR Reserved1[3]; - UCHAR Success : 1; - UCHAR Reserved2 : 7; -} CDVD_REPORT_ASF_DATA, *PCDVD_REPORT_ASF_DATA; - -typedef struct _CDVD_TITLE_KEY_HEADER { - UCHAR DataLength[2]; - UCHAR Reserved1[1]; - UCHAR Reserved2 : 3; - UCHAR CGMS : 2; - UCHAR CP_SEC : 1; - UCHAR CPM : 1; - UCHAR Zero : 1; - CDVD_KEY_DATA TitleKey; -} CDVD_TITLE_KEY_HEADER, *PCDVD_TITLE_KEY_HEADER; -#pragma pack(pop, dvdstuff) - - -// -// Format Unit Data definitions and structures -// - -#pragma pack(push, format_unit, 1) -typedef struct _FORMAT_DESCRIPTOR { - UCHAR NumberOfBlocks[4]; - UCHAR FormatSubType : 2; - UCHAR FormatType : 6; - UCHAR BlockLength[3]; -} FORMAT_DESCRIPTOR, *PFORMAT_DESCRIPTOR; - -typedef struct _FORMAT_LIST_HEADER { - UCHAR Reserved; - UCHAR VendorSpecific : 1; - UCHAR Immediate : 1; - UCHAR TryOut : 1; - UCHAR IP : 1; - UCHAR STPF : 1; - UCHAR DCRT : 1; - UCHAR DPRY : 1; - UCHAR FOV : 1; - UCHAR FormatDescriptorLength[2]; -#if !defined(__midl) - FORMAT_DESCRIPTOR Descriptors[0]; -#endif -} FORMAT_LIST_HEADER, *PFORMAT_LIST_HEADER; -#pragma pack(pop, format_unit) - -// -// Read Formatted Capacity Data - returned in Big Endian Format -// - - -#pragma pack(push, formatted_capacity, 1) -typedef struct _FORMATTED_CAPACITY_DESCRIPTOR { - UCHAR NumberOfBlocks[4]; - UCHAR Maximum : 1; - UCHAR Valid : 1; - UCHAR FormatType : 6; - UCHAR BlockLength[3]; -} FORMATTED_CAPACITY_DESCRIPTOR, *PFORMATTED_CAPACITY_DESCRIPTOR; - -typedef struct _FORMATTED_CAPACITY_LIST { - UCHAR Reserved[3]; - UCHAR CapacityListLength; -#if !defined(__midl) - FORMATTED_CAPACITY_DESCRIPTOR Descriptors[0]; -#endif -} FORMATTED_CAPACITY_LIST, *PFORMATTED_CAPACITY_LIST; -#pragma pack(pop, formatted_capacity) - -// -// BLANK command blanking type codes -// - -#define BLANK_FULL 0x0 -#define BLANK_MINIMAL 0x1 -#define BLANK_TRACK 0x2 -#define BLANK_UNRESERVE_TRACK 0x3 -#define BLANK_TAIL 0x4 -#define BLANK_UNCLOSE_SESSION 0x5 -#define BLANK_SESSION 0x6 - -// -// PLAY_CD definitions and constants -// - -#define CD_EXPECTED_SECTOR_ANY 0x0 -#define CD_EXPECTED_SECTOR_CDDA 0x1 -#define CD_EXPECTED_SECTOR_MODE1 0x2 -#define CD_EXPECTED_SECTOR_MODE2 0x3 -#define CD_EXPECTED_SECTOR_MODE2_FORM1 0x4 -#define CD_EXPECTED_SECTOR_MODE2_FORM2 0x5 - -// -// Read Disk Information Definitions and Capabilities -// - -#define DISK_STATUS_EMPTY 0x00 -#define DISK_STATUS_INCOMPLETE 0x01 -#define DISK_STATUS_COMPLETE 0x02 -#define DISK_STATUS_OTHERS 0x03 - -#define LAST_SESSION_EMPTY 0x00 -#define LAST_SESSION_INCOMPLETE 0x01 -#define LAST_SESSION_RESERVED_DAMAGED 0x02 -#define LAST_SESSION_COMPLETE 0x03 - -#define DISK_TYPE_CDDA 0x00 -#define DISK_TYPE_CDI 0x10 -#define DISK_TYPE_XA 0x20 -#define DISK_TYPE_UNDEFINED 0xFF - -// -// Values for MrwStatus field. -// - -#define DISC_BGFORMAT_STATE_NONE 0x0 -#define DISC_BGFORMAT_STATE_INCOMPLETE 0x1 -#define DISC_BGFORMAT_STATE_RUNNING 0x2 -#define DISC_BGFORMAT_STATE_COMPLETE 0x3 - - -#pragma pack(push, discinfo, 1) -typedef struct _OPC_TABLE_ENTRY { - UCHAR Speed[2]; - UCHAR OPCValue[6]; -} OPC_TABLE_ENTRY, *POPC_TABLE_ENTRY; - -typedef struct _DISC_INFORMATION { - - UCHAR Length[2]; - UCHAR DiscStatus : 2; - UCHAR LastSessionStatus : 2; - UCHAR Erasable : 1; - UCHAR Reserved1 : 3; - UCHAR FirstTrackNumber; - - UCHAR NumberOfSessionsLsb; - UCHAR LastSessionFirstTrackLsb; - UCHAR LastSessionLastTrackLsb; - UCHAR MrwStatus : 2; - UCHAR MrwDirtyBit : 1; - UCHAR Reserved2 : 2; - UCHAR URU : 1; - UCHAR DBC_V : 1; - UCHAR DID_V : 1; - - UCHAR DiscType; - UCHAR NumberOfSessionsMsb; - UCHAR LastSessionFirstTrackMsb; - UCHAR LastSessionLastTrackMsb; - - UCHAR DiskIdentification[4]; - UCHAR LastSessionLeadIn[4]; // HMSF - UCHAR LastPossibleLeadOutStartTime[4]; // HMSF - UCHAR DiskBarCode[8]; - - UCHAR Reserved4; - UCHAR NumberOPCEntries; - OPC_TABLE_ENTRY OPCTable[ 1 ]; // can be many of these here.... - -} DISC_INFORMATION, *PDISC_INFORMATION; - -// TODO: Deprecate DISK_INFORMATION -//#if PRAGMA_DEPRECATED_DDK -//#pragma deprecated(_DISK_INFORMATION) // Use DISC_INFORMATION, note size change -//#pragma deprecated( DISK_INFORMATION) // Use DISC_INFORMATION, note size change -//#pragma deprecated(PDISK_INFORMATION) // Use DISC_INFORMATION, note size change -//#endif - -typedef struct _DISK_INFORMATION { - UCHAR Length[2]; - - UCHAR DiskStatus : 2; - UCHAR LastSessionStatus : 2; - UCHAR Erasable : 1; - UCHAR Reserved1 : 3; - - UCHAR FirstTrackNumber; - UCHAR NumberOfSessions; - UCHAR LastSessionFirstTrack; - UCHAR LastSessionLastTrack; - - UCHAR Reserved2 : 5; - UCHAR GEN : 1; - UCHAR DBC_V : 1; - UCHAR DID_V : 1; - - UCHAR DiskType; - UCHAR Reserved3[3]; - - UCHAR DiskIdentification[4]; - UCHAR LastSessionLeadIn[4]; // MSF - UCHAR LastPossibleStartTime[4]; // MSF - UCHAR DiskBarCode[8]; - - UCHAR Reserved4; - UCHAR NumberOPCEntries; -#if !defined(__midl) - OPC_TABLE_ENTRY OPCTable[0]; -#endif -} DISK_INFORMATION, *PDISK_INFORMATION; -#pragma pack(pop, discinfo) - - -// -// Read Header definitions and structures -// -#pragma pack(push, cdheader, 1) -typedef struct _DATA_BLOCK_HEADER { - UCHAR DataMode; - UCHAR Reserved[4]; - union { - UCHAR LogicalBlockAddress[4]; - struct { - UCHAR Reserved; - UCHAR M; - UCHAR S; - UCHAR F; - } MSF; - }; -} DATA_BLOCK_HEADER, *PDATA_BLOCK_HEADER; -#pragma pack(pop, cdheader) - - -#define DATA_BLOCK_MODE0 0x0 -#define DATA_BLOCK_MODE1 0x1 -#define DATA_BLOCK_MODE2 0x2 - -// -// Read TOC Format Codes -// - -#define READ_TOC_FORMAT_TOC 0x00 -#define READ_TOC_FORMAT_SESSION 0x01 -#define READ_TOC_FORMAT_FULL_TOC 0x02 -#define READ_TOC_FORMAT_PMA 0x03 -#define READ_TOC_FORMAT_ATIP 0x04 - -// TODO: Deprecate TRACK_INFORMATION structure, use TRACK_INFORMATION2 instead -#pragma pack(push, track_info, 1) -typedef struct _TRACK_INFORMATION { - UCHAR Length[2]; - UCHAR TrackNumber; - UCHAR SessionNumber; - UCHAR Reserved1; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR Damage : 1; - UCHAR Reserved2 : 2; - UCHAR DataMode : 4; - UCHAR FP : 1; - UCHAR Packet : 1; - UCHAR Blank : 1; - UCHAR RT : 1; - UCHAR NWA_V : 1; - UCHAR Reserved3 : 7; - UCHAR TrackStartAddress[4]; - UCHAR NextWritableAddress[4]; - UCHAR FreeBlocks[4]; - UCHAR FixedPacketSize[4]; -} TRACK_INFORMATION, *PTRACK_INFORMATION; - -// Second Revision Modifies: -// * Longer names for some fields -// * LSB to track/session number fields -// * LRA_V bit -// Second Revision Adds: -// * TrackSize -// * LastRecordedAddress -// * MSB to track/session -// * Two reserved bytes -// Total structure size increased by 12 (0x0C) bytes -typedef struct _TRACK_INFORMATION2 { - - UCHAR Length[2]; - UCHAR TrackNumberLsb; - UCHAR SessionNumberLsb; - - UCHAR Reserved4; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR Damage : 1; - UCHAR Reserved5 : 2; - UCHAR DataMode : 4; - UCHAR FixedPacket : 1; - UCHAR Packet : 1; - UCHAR Blank : 1; - UCHAR ReservedTrack : 1; - UCHAR NWA_V : 1; - UCHAR LRA_V : 1; - UCHAR Reserved6 : 6; - - UCHAR TrackStartAddress[4]; - UCHAR NextWritableAddress[4]; - UCHAR FreeBlocks[4]; - UCHAR FixedPacketSize[4]; // blocking factor - UCHAR TrackSize[4]; - UCHAR LastRecordedAddress[4]; - - UCHAR TrackNumberMsb; - UCHAR SessionNumberMsb; - UCHAR Reserved7[2]; - -} TRACK_INFORMATION2, *PTRACK_INFORMATION2; - -// Third Revision Adds -// * ReadCompatibilityLBA -// Total structure size increased by 4 bytes -typedef struct _TRACK_INFORMATION3 { - - UCHAR Length[2]; - UCHAR TrackNumberLsb; - UCHAR SessionNumberLsb; - - UCHAR Reserved4; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR Damage : 1; - UCHAR Reserved5 : 2; - UCHAR DataMode : 4; - UCHAR FixedPacket : 1; - UCHAR Packet : 1; - UCHAR Blank : 1; - UCHAR ReservedTrack : 1; - UCHAR NWA_V : 1; - UCHAR LRA_V : 1; - UCHAR Reserved6 : 6; - - UCHAR TrackStartAddress[4]; - UCHAR NextWritableAddress[4]; - UCHAR FreeBlocks[4]; - UCHAR FixedPacketSize[4]; // blocking factor - UCHAR TrackSize[4]; - UCHAR LastRecordedAddress[4]; - - UCHAR TrackNumberMsb; - UCHAR SessionNumberMsb; - UCHAR Reserved7[2]; - UCHAR ReadCompatibilityLba[4]; - -} TRACK_INFORMATION3, *PTRACK_INFORMATION3; - -#pragma pack(pop, track_info) - -#pragma pack(push, perf_descriptor, 1) -typedef struct _PERFORMANCE_DESCRIPTOR { - - UCHAR RandomAccess : 1; - UCHAR Exact : 1; - UCHAR RestoreDefaults : 1; - UCHAR WriteRotationControl : 2; - UCHAR Reserved1 : 3; - - UCHAR Reserved[3]; - UCHAR StartLba[4]; - UCHAR EndLba[4]; - UCHAR ReadSize[4]; - UCHAR ReadTime[4]; - UCHAR WriteSize[4]; - UCHAR WriteTime[4]; - -} PERFORMANCE_DESCRIPTOR, *PPERFORMANCE_DESCRIPTOR; -#pragma pack(pop, perf_descriptor) - -// -// Command Descriptor Block constants. -// - -#define CDB6GENERIC_LENGTH 6 -#define CDB10GENERIC_LENGTH 10 -#define CDB12GENERIC_LENGTH 12 - -#define SETBITON 1 -#define SETBITOFF 0 - -// -// Mode Sense/Select page constants. -// - -#define MODE_PAGE_VENDOR_SPECIFIC 0x00 -#define MODE_PAGE_ERROR_RECOVERY 0x01 -#define MODE_PAGE_DISCONNECT 0x02 -#define MODE_PAGE_FORMAT_DEVICE 0x03 // disk -#define MODE_PAGE_MRW 0x03 // cdrom -#define MODE_PAGE_RIGID_GEOMETRY 0x04 -#define MODE_PAGE_FLEXIBILE 0x05 // disk -#define MODE_PAGE_WRITE_PARAMETERS 0x05 // cdrom -#define MODE_PAGE_VERIFY_ERROR 0x07 -#define MODE_PAGE_CACHING 0x08 -#define MODE_PAGE_PERIPHERAL 0x09 -#define MODE_PAGE_CONTROL 0x0A -#define MODE_PAGE_MEDIUM_TYPES 0x0B -#define MODE_PAGE_NOTCH_PARTITION 0x0C -#define MODE_PAGE_CD_AUDIO_CONTROL 0x0E -#define MODE_PAGE_DATA_COMPRESS 0x0F -#define MODE_PAGE_DEVICE_CONFIG 0x10 -#define MODE_PAGE_XOR_CONTROL 0x10 // disk -#define MODE_PAGE_MEDIUM_PARTITION 0x11 -#define MODE_PAGE_ENCLOSURE_SERVICES_MANAGEMENT 0x14 -#define MODE_PAGE_EXTENDED 0x15 -#define MODE_PAGE_EXTENDED_DEVICE_SPECIFIC 0x16 -#define MODE_PAGE_CDVD_FEATURE_SET 0x18 -#define MODE_PAGE_PROTOCOL_SPECIFIC_LUN 0x18 -#define MODE_PAGE_PROTOCOL_SPECIFIC_PORT 0x19 -#define MODE_PAGE_POWER_CONDITION 0x1A -#define MODE_PAGE_LUN_MAPPING 0x1B -#define MODE_PAGE_FAULT_REPORTING 0x1C -#define MODE_PAGE_CDVD_INACTIVITY 0x1D // cdrom -#define MODE_PAGE_ELEMENT_ADDRESS 0x1D -#define MODE_PAGE_TRANSPORT_GEOMETRY 0x1E -#define MODE_PAGE_DEVICE_CAPABILITIES 0x1F -#define MODE_PAGE_CAPABILITIES 0x2A // cdrom - -#define MODE_SENSE_RETURN_ALL 0x3f - -#define MODE_SENSE_CURRENT_VALUES 0x00 -#define MODE_SENSE_CHANGEABLE_VALUES 0x40 -#define MODE_SENSE_DEFAULT_VAULES 0x80 -#define MODE_SENSE_SAVED_VALUES 0xc0 - - -// -// SCSI CDB operation codes -// - -// 6-byte commands: -#define SCSIOP_TEST_UNIT_READY 0x00 -#define SCSIOP_REZERO_UNIT 0x01 -#define SCSIOP_REWIND 0x01 -#define SCSIOP_REQUEST_BLOCK_ADDR 0x02 -#define SCSIOP_REQUEST_SENSE 0x03 -#define SCSIOP_FORMAT_UNIT 0x04 -#define SCSIOP_READ_BLOCK_LIMITS 0x05 -#define SCSIOP_REASSIGN_BLOCKS 0x07 -#define SCSIOP_INIT_ELEMENT_STATUS 0x07 -#define SCSIOP_READ6 0x08 -#define SCSIOP_RECEIVE 0x08 -#define SCSIOP_WRITE6 0x0A -#define SCSIOP_PRINT 0x0A -#define SCSIOP_SEND 0x0A -#define SCSIOP_SEEK6 0x0B -#define SCSIOP_TRACK_SELECT 0x0B -#define SCSIOP_SLEW_PRINT 0x0B -#define SCSIOP_SET_CAPACITY 0x0B // tape -#define SCSIOP_SEEK_BLOCK 0x0C -#define SCSIOP_PARTITION 0x0D -#define SCSIOP_READ_REVERSE 0x0F -#define SCSIOP_WRITE_FILEMARKS 0x10 -#define SCSIOP_FLUSH_BUFFER 0x10 -#define SCSIOP_SPACE 0x11 -#define SCSIOP_INQUIRY 0x12 -#define SCSIOP_VERIFY6 0x13 -#define SCSIOP_RECOVER_BUF_DATA 0x14 -#define SCSIOP_MODE_SELECT 0x15 -#define SCSIOP_RESERVE_UNIT 0x16 -#define SCSIOP_RELEASE_UNIT 0x17 -#define SCSIOP_COPY 0x18 -#define SCSIOP_ERASE 0x19 -#define SCSIOP_MODE_SENSE 0x1A -#define SCSIOP_START_STOP_UNIT 0x1B -#define SCSIOP_STOP_PRINT 0x1B -#define SCSIOP_LOAD_UNLOAD 0x1B -#define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C -#define SCSIOP_SEND_DIAGNOSTIC 0x1D -#define SCSIOP_MEDIUM_REMOVAL 0x1E - -// 10-byte commands -#define SCSIOP_READ_FORMATTED_CAPACITY 0x23 -#define SCSIOP_READ_CAPACITY 0x25 -#define SCSIOP_READ 0x28 -#define SCSIOP_WRITE 0x2A -#define SCSIOP_SEEK 0x2B -#define SCSIOP_LOCATE 0x2B -#define SCSIOP_POSITION_TO_ELEMENT 0x2B -#define SCSIOP_WRITE_VERIFY 0x2E -#define SCSIOP_VERIFY 0x2F -#define SCSIOP_SEARCH_DATA_HIGH 0x30 -#define SCSIOP_SEARCH_DATA_EQUAL 0x31 -#define SCSIOP_SEARCH_DATA_LOW 0x32 -#define SCSIOP_SET_LIMITS 0x33 -#define SCSIOP_READ_POSITION 0x34 -#define SCSIOP_SYNCHRONIZE_CACHE 0x35 -#define SCSIOP_COMPARE 0x39 -#define SCSIOP_COPY_COMPARE 0x3A -#define SCSIOP_WRITE_DATA_BUFF 0x3B -#define SCSIOP_READ_DATA_BUFF 0x3C -#define SCSIOP_WRITE_LONG 0x3F -#define SCSIOP_CHANGE_DEFINITION 0x40 -#define SCSIOP_WRITE_SAME 0x41 -#define SCSIOP_READ_SUB_CHANNEL 0x42 -#define SCSIOP_READ_TOC 0x43 -#define SCSIOP_READ_HEADER 0x44 -#define SCSIOP_REPORT_DENSITY_SUPPORT 0x44 // tape -#define SCSIOP_PLAY_AUDIO 0x45 -#define SCSIOP_GET_CONFIGURATION 0x46 -#define SCSIOP_PLAY_AUDIO_MSF 0x47 -#define SCSIOP_PLAY_TRACK_INDEX 0x48 -#define SCSIOP_PLAY_TRACK_RELATIVE 0x49 -#define SCSIOP_GET_EVENT_STATUS 0x4A -#define SCSIOP_PAUSE_RESUME 0x4B -#define SCSIOP_LOG_SELECT 0x4C -#define SCSIOP_LOG_SENSE 0x4D -#define SCSIOP_STOP_PLAY_SCAN 0x4E -#define SCSIOP_XDWRITE 0x50 -#define SCSIOP_XPWRITE 0x51 -#define SCSIOP_READ_DISK_INFORMATION 0x51 -#define SCSIOP_READ_DISC_INFORMATION 0x51 // proper use of disc over disk -#define SCSIOP_READ_TRACK_INFORMATION 0x52 -#define SCSIOP_XDWRITE_READ 0x53 -#define SCSIOP_RESERVE_TRACK_RZONE 0x53 -#define SCSIOP_SEND_OPC_INFORMATION 0x54 // optimum power calibration -#define SCSIOP_MODE_SELECT10 0x55 -#define SCSIOP_RESERVE_UNIT10 0x56 -#define SCSIOP_RESERVE_ELEMENT 0x56 -#define SCSIOP_RELEASE_UNIT10 0x57 -#define SCSIOP_RELEASE_ELEMENT 0x57 -#define SCSIOP_REPAIR_TRACK 0x58 -#define SCSIOP_MODE_SENSE10 0x5A -#define SCSIOP_CLOSE_TRACK_SESSION 0x5B -#define SCSIOP_READ_BUFFER_CAPACITY 0x5C -#define SCSIOP_SEND_CUE_SHEET 0x5D -#define SCSIOP_PERSISTENT_RESERVE_IN 0x5E -#define SCSIOP_PERSISTENT_RESERVE_OUT 0x5F - -// 12-byte commands -#define SCSIOP_REPORT_LUNS 0xA0 -#define SCSIOP_BLANK 0xA1 -#define SCSIOP_ATA_PASSTHROUGH12 0xA1 -#define SCSIOP_SEND_EVENT 0xA2 -#define SCSIOP_SEND_KEY 0xA3 -#define SCSIOP_MAINTENANCE_IN 0xA3 -#define SCSIOP_REPORT_KEY 0xA4 -#define SCSIOP_MAINTENANCE_OUT 0xA4 -#define SCSIOP_MOVE_MEDIUM 0xA5 -#define SCSIOP_LOAD_UNLOAD_SLOT 0xA6 -#define SCSIOP_EXCHANGE_MEDIUM 0xA6 -#define SCSIOP_SET_READ_AHEAD 0xA7 -#define SCSIOP_MOVE_MEDIUM_ATTACHED 0xA7 -#define SCSIOP_READ12 0xA8 -#define SCSIOP_GET_MESSAGE 0xA8 -#define SCSIOP_SERVICE_ACTION_OUT12 0xA9 -#define SCSIOP_WRITE12 0xAA -#define SCSIOP_SEND_MESSAGE 0xAB -#define SCSIOP_SERVICE_ACTION_IN12 0xAB -#define SCSIOP_GET_PERFORMANCE 0xAC -#define SCSIOP_READ_DVD_STRUCTURE 0xAD -#define SCSIOP_WRITE_VERIFY12 0xAE -#define SCSIOP_VERIFY12 0xAF -#define SCSIOP_SEARCH_DATA_HIGH12 0xB0 -#define SCSIOP_SEARCH_DATA_EQUAL12 0xB1 -#define SCSIOP_SEARCH_DATA_LOW12 0xB2 -#define SCSIOP_SET_LIMITS12 0xB3 -#define SCSIOP_READ_ELEMENT_STATUS_ATTACHED 0xB4 -#define SCSIOP_REQUEST_VOL_ELEMENT 0xB5 -#define SCSIOP_SEND_VOLUME_TAG 0xB6 -#define SCSIOP_SET_STREAMING 0xB6 // C/DVD -#define SCSIOP_READ_DEFECT_DATA 0xB7 -#define SCSIOP_READ_ELEMENT_STATUS 0xB8 -#define SCSIOP_READ_CD_MSF 0xB9 -#define SCSIOP_SCAN_CD 0xBA -#define SCSIOP_REDUNDANCY_GROUP_IN 0xBA -#define SCSIOP_SET_CD_SPEED 0xBB -#define SCSIOP_REDUNDANCY_GROUP_OUT 0xBB -#define SCSIOP_PLAY_CD 0xBC -#define SCSIOP_SPARE_IN 0xBC -#define SCSIOP_MECHANISM_STATUS 0xBD -#define SCSIOP_SPARE_OUT 0xBD -#define SCSIOP_READ_CD 0xBE -#define SCSIOP_VOLUME_SET_IN 0xBE -#define SCSIOP_SEND_DVD_STRUCTURE 0xBF -#define SCSIOP_VOLUME_SET_OUT 0xBF -#define SCSIOP_INIT_ELEMENT_RANGE 0xE7 - -// 16-byte commands -#define SCSIOP_XDWRITE_EXTENDED16 0x80 // disk -#define SCSIOP_WRITE_FILEMARKS16 0x80 // tape -#define SCSIOP_REBUILD16 0x81 // disk -#define SCSIOP_READ_REVERSE16 0x81 // tape -#define SCSIOP_REGENERATE16 0x82 // disk -#define SCSIOP_EXTENDED_COPY 0x83 -#define SCSIOP_RECEIVE_COPY_RESULTS 0x84 -#define SCSIOP_ATA_PASSTHROUGH16 0x85 -#define SCSIOP_ACCESS_CONTROL_IN 0x86 -#define SCSIOP_ACCESS_CONTROL_OUT 0x87 -#define SCSIOP_READ16 0x88 -#define SCSIOP_WRITE16 0x8A -#define SCSIOP_READ_ATTRIBUTES 0x8C -#define SCSIOP_WRITE_ATTRIBUTES 0x8D -#define SCSIOP_WRITE_VERIFY16 0x8E -#define SCSIOP_VERIFY16 0x8F -#define SCSIOP_PREFETCH16 0x90 -#define SCSIOP_SYNCHRONIZE_CACHE16 0x91 -#define SCSIOP_SPACE16 0x91 // tape -#define SCSIOP_LOCK_UNLOCK_CACHE16 0x92 -#define SCSIOP_LOCATE16 0x92 // tape -#define SCSIOP_WRITE_SAME16 0x93 -#define SCSIOP_ERASE16 0x93 // tape -#define SCSIOP_READ_CAPACITY16 0x9E -#define SCSIOP_SERVICE_ACTION_IN16 0x9E -#define SCSIOP_SERVICE_ACTION_OUT16 0x9F - - -// -// If the IMMED bit is 1, status is returned as soon -// as the operation is initiated. If the IMMED bit -// is 0, status is not returned until the operation -// is completed. -// - -#define CDB_RETURN_ON_COMPLETION 0 -#define CDB_RETURN_IMMEDIATE 1 - -// end_ntminitape - -// -// CDB Force media access used in extended read and write commands. -// - -#define CDB_FORCE_MEDIA_ACCESS 0x08 - -// -// Denon CD ROM operation codes -// - -#define SCSIOP_DENON_EJECT_DISC 0xE6 -#define SCSIOP_DENON_STOP_AUDIO 0xE7 -#define SCSIOP_DENON_PLAY_AUDIO 0xE8 -#define SCSIOP_DENON_READ_TOC 0xE9 -#define SCSIOP_DENON_READ_SUBCODE 0xEB - -// -// SCSI Bus Messages -// - -#define SCSIMESS_ABORT 0x06 -#define SCSIMESS_ABORT_WITH_TAG 0x0D -#define SCSIMESS_BUS_DEVICE_RESET 0X0C -#define SCSIMESS_CLEAR_QUEUE 0X0E -#define SCSIMESS_COMMAND_COMPLETE 0X00 -#define SCSIMESS_DISCONNECT 0X04 -#define SCSIMESS_EXTENDED_MESSAGE 0X01 -#define SCSIMESS_IDENTIFY 0X80 -#define SCSIMESS_IDENTIFY_WITH_DISCON 0XC0 -#define SCSIMESS_IGNORE_WIDE_RESIDUE 0X23 -#define SCSIMESS_INITIATE_RECOVERY 0X0F -#define SCSIMESS_INIT_DETECTED_ERROR 0X05 -#define SCSIMESS_LINK_CMD_COMP 0X0A -#define SCSIMESS_LINK_CMD_COMP_W_FLAG 0X0B -#define SCSIMESS_MESS_PARITY_ERROR 0X09 -#define SCSIMESS_MESSAGE_REJECT 0X07 -#define SCSIMESS_NO_OPERATION 0X08 -#define SCSIMESS_HEAD_OF_QUEUE_TAG 0X21 -#define SCSIMESS_ORDERED_QUEUE_TAG 0X22 -#define SCSIMESS_SIMPLE_QUEUE_TAG 0X20 -#define SCSIMESS_RELEASE_RECOVERY 0X10 -#define SCSIMESS_RESTORE_POINTERS 0X03 -#define SCSIMESS_SAVE_DATA_POINTER 0X02 -#define SCSIMESS_TERMINATE_IO_PROCESS 0X11 - -// -// SCSI Extended Message operation codes -// - -#define SCSIMESS_MODIFY_DATA_POINTER 0X00 -#define SCSIMESS_SYNCHRONOUS_DATA_REQ 0X01 -#define SCSIMESS_WIDE_DATA_REQUEST 0X03 - -// -// SCSI Extended Message Lengths -// - -#define SCSIMESS_MODIFY_DATA_LENGTH 5 -#define SCSIMESS_SYNCH_DATA_LENGTH 3 -#define SCSIMESS_WIDE_DATA_LENGTH 2 - -// -// SCSI extended message structure -// - -#pragma pack(push, scsi_mess, 1) -typedef struct _SCSI_EXTENDED_MESSAGE { - UCHAR InitialMessageCode; - UCHAR MessageLength; - UCHAR MessageType; - union _EXTENDED_ARGUMENTS { - - struct { - UCHAR Modifier[4]; - } Modify; - - struct { - UCHAR TransferPeriod; - UCHAR ReqAckOffset; - } Synchronous; - - struct{ - UCHAR Width; - } Wide; - }ExtendedArguments; -}SCSI_EXTENDED_MESSAGE, *PSCSI_EXTENDED_MESSAGE; -#pragma pack(pop, scsi_mess) - -// -// SCSI bus status codes. -// - -#define SCSISTAT_GOOD 0x00 -#define SCSISTAT_CHECK_CONDITION 0x02 -#define SCSISTAT_CONDITION_MET 0x04 -#define SCSISTAT_BUSY 0x08 -#define SCSISTAT_INTERMEDIATE 0x10 -#define SCSISTAT_INTERMEDIATE_COND_MET 0x14 -#define SCSISTAT_RESERVATION_CONFLICT 0x18 -#define SCSISTAT_COMMAND_TERMINATED 0x22 -#define SCSISTAT_QUEUE_FULL 0x28 - -// -// Enable Vital Product Data Flag (EVPD) -// used with INQUIRY command. -// - -#define CDB_INQUIRY_EVPD 0x01 - -// -// Defines for format CDB -// - -#define LUN0_FORMAT_SAVING_DEFECT_LIST 0 -#define USE_DEFAULTMSB 0 -#define USE_DEFAULTLSB 0 - -#define START_UNIT_CODE 0x01 -#define STOP_UNIT_CODE 0x00 - -// begin_ntminitape - -// -// Inquiry buffer structure. This is the data returned from the target -// after it receives an inquiry. -// -// This structure may be extended by the number of bytes specified -// in the field AdditionalLength. The defined size constant only -// includes fields through ProductRevisionLevel. -// -// The NT SCSI drivers are only interested in the first 36 bytes of data. -// - -#define INQUIRYDATABUFFERSIZE 36 - -#if (NTDDI_VERSION < NTDDI_WINXP) -typedef struct _INQUIRYDATA { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR DeviceTypeModifier : 7; - UCHAR RemovableMedia : 1; - UCHAR Versions; - UCHAR ResponseDataFormat : 4; - UCHAR HiSupport : 1; - UCHAR NormACA : 1; - UCHAR ReservedBit : 1; - UCHAR AERC : 1; - UCHAR AdditionalLength; - UCHAR Reserved[2]; - UCHAR SoftReset : 1; - UCHAR CommandQueue : 1; - UCHAR Reserved2 : 1; - UCHAR LinkedCommands : 1; - UCHAR Synchronous : 1; - UCHAR Wide16Bit : 1; - UCHAR Wide32Bit : 1; - UCHAR RelativeAddressing : 1; - UCHAR VendorId[8]; - UCHAR ProductId[16]; - UCHAR ProductRevisionLevel[4]; - UCHAR VendorSpecific[20]; - UCHAR Reserved3[40]; -} INQUIRYDATA, *PINQUIRYDATA; -#else -#pragma pack(push, inquiry, 1) -typedef struct _INQUIRYDATA { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR DeviceTypeModifier : 7; - UCHAR RemovableMedia : 1; - union { - UCHAR Versions; - struct { - UCHAR ANSIVersion : 3; - UCHAR ECMAVersion : 3; - UCHAR ISOVersion : 2; - }; - }; - UCHAR ResponseDataFormat : 4; - UCHAR HiSupport : 1; - UCHAR NormACA : 1; - UCHAR TerminateTask : 1; - UCHAR AERC : 1; - UCHAR AdditionalLength; - UCHAR Reserved; - UCHAR Addr16 : 1; // defined only for SIP devices. - UCHAR Addr32 : 1; // defined only for SIP devices. - UCHAR AckReqQ: 1; // defined only for SIP devices. - UCHAR MediumChanger : 1; - UCHAR MultiPort : 1; - UCHAR ReservedBit2 : 1; - UCHAR EnclosureServices : 1; - UCHAR ReservedBit3 : 1; - UCHAR SoftReset : 1; - UCHAR CommandQueue : 1; - UCHAR TransferDisable : 1; // defined only for SIP devices. - UCHAR LinkedCommands : 1; - UCHAR Synchronous : 1; // defined only for SIP devices. - UCHAR Wide16Bit : 1; // defined only for SIP devices. - UCHAR Wide32Bit : 1; // defined only for SIP devices. - UCHAR RelativeAddressing : 1; - UCHAR VendorId[8]; - UCHAR ProductId[16]; - UCHAR ProductRevisionLevel[4]; - UCHAR VendorSpecific[20]; - UCHAR Reserved3[40]; -} INQUIRYDATA, *PINQUIRYDATA; -#pragma pack(pop, inquiry) -#endif - -// -// Inquiry defines. Used to interpret data returned from target as result -// of inquiry command. -// -// DeviceType field -// - -#define DIRECT_ACCESS_DEVICE 0x00 // disks -#define SEQUENTIAL_ACCESS_DEVICE 0x01 // tapes -#define PRINTER_DEVICE 0x02 // printers -#define PROCESSOR_DEVICE 0x03 // scanners, printers, etc -#define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04 // worms -#define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05 // cdroms -#define SCANNER_DEVICE 0x06 // scanners -#define OPTICAL_DEVICE 0x07 // optical disks -#define MEDIUM_CHANGER 0x08 // jukebox -#define COMMUNICATION_DEVICE 0x09 // network -// 0xA and 0xB are obsolete -#define ARRAY_CONTROLLER_DEVICE 0x0C -#define SCSI_ENCLOSURE_DEVICE 0x0D -#define REDUCED_BLOCK_DEVICE 0x0E // e.g., 1394 disk -#define OPTICAL_CARD_READER_WRITER_DEVICE 0x0F -#define BRIDGE_CONTROLLER_DEVICE 0x10 -#define OBJECT_BASED_STORAGE_DEVICE 0x11 // OSD -#define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F - -#define DEVICE_QUALIFIER_ACTIVE 0x00 -#define DEVICE_QUALIFIER_NOT_ACTIVE 0x01 -#define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03 - -// -// DeviceTypeQualifier field -// - -#define DEVICE_CONNECTED 0x00 - -// -// Vital Product Data Pages -// - -// -// Unit Serial Number Page (page code 0x80) -// -// Provides a product serial number for the target or the logical unit. -// -#pragma pack(push, vpd_media_sn, 1) -typedef struct _VPD_MEDIA_SERIAL_NUMBER_PAGE { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR PageCode; - UCHAR Reserved; - UCHAR PageLength; -#if !defined(__midl) - UCHAR SerialNumber[0]; -#endif -} VPD_MEDIA_SERIAL_NUMBER_PAGE, *PVPD_MEDIA_SERIAL_NUMBER_PAGE; -#pragma pack(pop, vpd_media_sn) - -#pragma pack(push, vpd_sn, 1) -typedef struct _VPD_SERIAL_NUMBER_PAGE { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR PageCode; - UCHAR Reserved; - UCHAR PageLength; -#if !defined(__midl) - UCHAR SerialNumber[0]; -#endif -} VPD_SERIAL_NUMBER_PAGE, *PVPD_SERIAL_NUMBER_PAGE; -#pragma pack(pop, vpd_sn) - -// -// Device Identification Page (page code 0x83) -// Provides the means to retrieve zero or more identification descriptors -// applying to the logical unit. -// - -#pragma pack(push, vpd_stuff, 1) -typedef enum _VPD_CODE_SET { - VpdCodeSetReserved = 0, - VpdCodeSetBinary = 1, - VpdCodeSetAscii = 2, - VpdCodeSetUTF8 = 3 -} VPD_CODE_SET, *PVPD_CODE_SET; - -typedef enum _VPD_ASSOCIATION { - VpdAssocDevice = 0, - VpdAssocPort = 1, - VpdAssocTarget = 2, - VpdAssocReserved1 = 3, - VpdAssocReserved2 = 4 // bogus, only two bits -} VPD_ASSOCIATION, *PVPD_ASSOCIATION; - -typedef enum _VPD_IDENTIFIER_TYPE { - VpdIdentifierTypeVendorSpecific = 0, - VpdIdentifierTypeVendorId = 1, - VpdIdentifierTypeEUI64 = 2, - VpdIdentifierTypeFCPHName = 3, - VpdIdentifierTypePortRelative = 4, - VpdIdentifierTypeTargetPortGroup = 5, - VpdIdentifierTypeLogicalUnitGroup = 6, - VpdIdentifierTypeMD5LogicalUnitId = 7, - VpdIdentifierTypeSCSINameString = 8 -} VPD_IDENTIFIER_TYPE, *PVPD_IDENTIFIER_TYPE; - -typedef struct _VPD_IDENTIFICATION_DESCRIPTOR { - UCHAR CodeSet : 4; // VPD_CODE_SET - UCHAR Reserved : 4; - UCHAR IdentifierType : 4; // VPD_IDENTIFIER_TYPE - UCHAR Association : 2; - UCHAR Reserved2 : 2; - UCHAR Reserved3; - UCHAR IdentifierLength; -#if !defined(__midl) - UCHAR Identifier[0]; -#endif -} VPD_IDENTIFICATION_DESCRIPTOR, *PVPD_IDENTIFICATION_DESCRIPTOR; - -typedef struct _VPD_IDENTIFICATION_PAGE { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR PageCode; - UCHAR Reserved; - UCHAR PageLength; - - - // - // The following field is actually a variable length array of identification - // descriptors. Unfortunately there's no C notation for an array of - // variable length structures so we're forced to just pretend. - // - -#if !defined(__midl) - // VPD_IDENTIFICATION_DESCRIPTOR Descriptors[0]; - UCHAR Descriptors[0]; -#endif -} VPD_IDENTIFICATION_PAGE, *PVPD_IDENTIFICATION_PAGE; - -// -// Supported Vital Product Data Pages Page (page code 0x00) -// Contains a list of the vital product data page cods supported by the target -// or logical unit. -// - -typedef struct _VPD_SUPPORTED_PAGES_PAGE { - UCHAR DeviceType : 5; - UCHAR DeviceTypeQualifier : 3; - UCHAR PageCode; - UCHAR Reserved; - UCHAR PageLength; -#if !defined(__midl) - UCHAR SupportedPageList[0]; -#endif -} VPD_SUPPORTED_PAGES_PAGE, *PVPD_SUPPORTED_PAGES_PAGE; -#pragma pack(pop, vpd_stuff) - - -#define VPD_MAX_BUFFER_SIZE 0xff - -#define VPD_SUPPORTED_PAGES 0x00 -#define VPD_SERIAL_NUMBER 0x80 -#define VPD_DEVICE_IDENTIFIERS 0x83 -#define VPD_MEDIA_SERIAL_NUMBER 0x84 -#define VPD_SOFTWARE_INTERFACE_IDENTIFIERS 0x84 -#define VPD_NETWORK_MANAGEMENT_ADDRESSES 0x85 -#define VPD_EXTENDED_INQUIRY_DATA 0x86 -#define VPD_MODE_PAGE_POLICY 0x87 -#define VPD_SCSI_PORTS 0x88 - - -// -// Persistent Reservation Definitions. -// - -// -// PERSISTENT_RESERVE_* definitions -// - -#define RESERVATION_ACTION_READ_KEYS 0x00 -#define RESERVATION_ACTION_READ_RESERVATIONS 0x01 - -#define RESERVATION_ACTION_REGISTER 0x00 -#define RESERVATION_ACTION_RESERVE 0x01 -#define RESERVATION_ACTION_RELEASE 0x02 -#define RESERVATION_ACTION_CLEAR 0x03 -#define RESERVATION_ACTION_PREEMPT 0x04 -#define RESERVATION_ACTION_PREEMPT_ABORT 0x05 -#define RESERVATION_ACTION_REGISTER_IGNORE_EXISTING 0x06 - -#define RESERVATION_SCOPE_LU 0x00 -#define RESERVATION_SCOPE_ELEMENT 0x02 - -#define RESERVATION_TYPE_WRITE_EXCLUSIVE 0x01 -#define RESERVATION_TYPE_EXCLUSIVE 0x03 -#define RESERVATION_TYPE_WRITE_EXCLUSIVE_REGISTRANTS 0x05 -#define RESERVATION_TYPE_EXCLUSIVE_REGISTRANTS 0x06 - -// -// Structures for reserve in command. -// - -#pragma pack(push, reserve_in_stuff, 1) -typedef struct { - UCHAR Generation[4]; - UCHAR AdditionalLength[4]; -#if !defined(__midl) - UCHAR ReservationKeyList[0][8]; -#endif -} PRI_REGISTRATION_LIST, *PPRI_REGISTRATION_LIST; - -typedef struct { - UCHAR ReservationKey[8]; - UCHAR ScopeSpecificAddress[4]; - UCHAR Reserved; - UCHAR Type : 4; - UCHAR Scope : 4; - UCHAR Obsolete[2]; -} PRI_RESERVATION_DESCRIPTOR, *PPRI_RESERVATION_DESCRIPTOR; - -typedef struct { - UCHAR Generation[4]; - UCHAR AdditionalLength[4]; -#if !defined(__midl) - PRI_RESERVATION_DESCRIPTOR Reservations[0]; -#endif -} PRI_RESERVATION_LIST, *PPRI_RESERVATION_LIST; -#pragma pack(pop, reserve_in_stuff) - -// -// Structures for reserve out command. -// - -#pragma pack(push, reserve_out_stuff, 1) -typedef struct { - UCHAR ReservationKey[8]; - UCHAR ServiceActionReservationKey[8]; - UCHAR ScopeSpecificAddress[4]; - UCHAR ActivatePersistThroughPowerLoss : 1; - UCHAR Reserved1 : 7; - UCHAR Reserved2; - UCHAR Obsolete[2]; -} PRO_PARAMETER_LIST, *PPRO_PARAMETER_LIST; -#pragma pack(pop, reserve_out_stuff) - - -// -// Sense Data Format -// - -#pragma pack(push, sensedata, 1) -typedef struct _SENSE_DATA { - UCHAR ErrorCode:7; - UCHAR Valid:1; - UCHAR SegmentNumber; - UCHAR SenseKey:4; - UCHAR Reserved:1; - UCHAR IncorrectLength:1; - UCHAR EndOfMedia:1; - UCHAR FileMark:1; - UCHAR Information[4]; - UCHAR AdditionalSenseLength; - UCHAR CommandSpecificInformation[4]; - UCHAR AdditionalSenseCode; - UCHAR AdditionalSenseCodeQualifier; - UCHAR FieldReplaceableUnitCode; - UCHAR SenseKeySpecific[3]; -} SENSE_DATA, *PSENSE_DATA; -#pragma pack(pop, sensedata) - -// -// Default request sense buffer size -// - -#define SENSE_BUFFER_SIZE 18 - -// -// Maximum request sense buffer size -// - -#define MAX_SENSE_BUFFER_SIZE 255 - -// -// Maximum number of additional sense bytes. -// - -#define MAX_ADDITIONAL_SENSE_BYTES (MAX_SENSE_BUFFER_SIZE - SENSE_BUFFER_SIZE) - -// -// Sense codes -// - -#define SCSI_SENSE_NO_SENSE 0x00 -#define SCSI_SENSE_RECOVERED_ERROR 0x01 -#define SCSI_SENSE_NOT_READY 0x02 -#define SCSI_SENSE_MEDIUM_ERROR 0x03 -#define SCSI_SENSE_HARDWARE_ERROR 0x04 -#define SCSI_SENSE_ILLEGAL_REQUEST 0x05 -#define SCSI_SENSE_UNIT_ATTENTION 0x06 -#define SCSI_SENSE_DATA_PROTECT 0x07 -#define SCSI_SENSE_BLANK_CHECK 0x08 -#define SCSI_SENSE_UNIQUE 0x09 -#define SCSI_SENSE_COPY_ABORTED 0x0A -#define SCSI_SENSE_ABORTED_COMMAND 0x0B -#define SCSI_SENSE_EQUAL 0x0C -#define SCSI_SENSE_VOL_OVERFLOW 0x0D -#define SCSI_SENSE_MISCOMPARE 0x0E -#define SCSI_SENSE_RESERVED 0x0F - -// -// Additional tape bit -// - -#define SCSI_ILLEGAL_LENGTH 0x20 -#define SCSI_EOM 0x40 -#define SCSI_FILE_MARK 0x80 - -// -// Additional Sense codes -// - -#define SCSI_ADSENSE_NO_SENSE 0x00 -#define SCSI_ADSENSE_NO_SEEK_COMPLETE 0x02 -#define SCSI_ADSENSE_LUN_NOT_READY 0x04 -#define SCSI_ADSENSE_LUN_COMMUNICATION 0x08 -#define SCSI_ADSENSE_WRITE_ERROR 0x0C -#define SCSI_ADSENSE_TRACK_ERROR 0x14 -#define SCSI_ADSENSE_SEEK_ERROR 0x15 -#define SCSI_ADSENSE_REC_DATA_NOECC 0x17 -#define SCSI_ADSENSE_REC_DATA_ECC 0x18 -#define SCSI_ADSENSE_PARAMETER_LIST_LENGTH 0x1A -#define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20 -#define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21 -#define SCSI_ADSENSE_INVALID_CDB 0x24 -#define SCSI_ADSENSE_INVALID_LUN 0x25 -#define SCSI_ADSENSE_INVALID_FIELD_PARAMETER_LIST 0x26 -#define SCSI_ADSENSE_WRITE_PROTECT 0x27 -#define SCSI_ADSENSE_MEDIUM_CHANGED 0x28 -#define SCSI_ADSENSE_BUS_RESET 0x29 -#define SCSI_ADSENSE_PARAMETERS_CHANGED 0x2A -#define SCSI_ADSENSE_INSUFFICIENT_TIME_FOR_OPERATION 0x2E -#define SCSI_ADSENSE_INVALID_MEDIA 0x30 -#define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3a -#define SCSI_ADSENSE_POSITION_ERROR 0x3b -#define SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED 0x3f -#define SCSI_ADSENSE_OPERATOR_REQUEST 0x5a // see below -#define SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x5d -#define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK 0x64 -#define SCSI_ADSENSE_COPY_PROTECTION_FAILURE 0x6f -#define SCSI_ADSENSE_POWER_CALIBRATION_ERROR 0x73 -#define SCSI_ADSENSE_VENDOR_UNIQUE 0x80 // and higher -#define SCSI_ADSENSE_MUSIC_AREA 0xA0 -#define SCSI_ADSENSE_DATA_AREA 0xA1 -#define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7 - -// for legacy apps: -#define SCSI_ADWRITE_PROTECT SCSI_ADSENSE_WRITE_PROTECT -#define SCSI_FAILURE_PREDICTION_THRESHOLD_EXCEEDED SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED - - -// -// SCSI_ADSENSE_LUN_NOT_READY (0x04) qualifiers -// - -#define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00 -#define SCSI_SENSEQ_BECOMING_READY 0x01 -#define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02 -#define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03 -#define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04 -#define SCSI_SENSEQ_REBUILD_IN_PROGRESS 0x05 -#define SCSI_SENSEQ_RECALCULATION_IN_PROGRESS 0x06 -#define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07 -#define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08 - -// -// SCSI_ADSENSE_LUN_COMMUNICATION (0x08) qualifiers -// - -#define SCSI_SENSEQ_COMM_FAILURE 0x00 -#define SCSI_SENSEQ_COMM_TIMEOUT 0x01 -#define SCSI_SENSEQ_COMM_PARITY_ERROR 0x02 -#define SCSI_SESNEQ_COMM_CRC_ERROR 0x03 -#define SCSI_SENSEQ_UNREACHABLE_TARGET 0x04 - -// -// SCSI_ADSENSE_WRITE_ERROR (0x0C) qualifiers -// -#define SCSI_SENSEQ_LOSS_OF_STREAMING 0x09 -#define SCSI_SENSEQ_PADDING_BLOCKS_ADDED 0x0A - - -// -// SCSI_ADSENSE_NO_SENSE (0x00) qualifiers -// - -#define SCSI_SENSEQ_FILEMARK_DETECTED 0x01 -#define SCSI_SENSEQ_END_OF_MEDIA_DETECTED 0x02 -#define SCSI_SENSEQ_SETMARK_DETECTED 0x03 -#define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED 0x04 - -// -// SCSI_ADSENSE_ILLEGAL_BLOCK (0x21) qualifiers -// - -#define SCSI_SENSEQ_ILLEGAL_ELEMENT_ADDR 0x01 - -// -// SCSI_ADSENSE_POSITION_ERROR (0x3b) qualifiers -// - -#define SCSI_SENSEQ_DESTINATION_FULL 0x0d -#define SCSI_SENSEQ_SOURCE_EMPTY 0x0e - -// -// SCSI_ADSENSE_INVALID_MEDIA (0x30) qualifiers -// - -#define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00 -#define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01 -#define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02 -#define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03 - - -// -// SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED (0x3f) qualifiers -// - -#define SCSI_SENSEQ_TARGET_OPERATING_CONDITIONS_CHANGED 0x00 -#define SCSI_SENSEQ_MICROCODE_CHANGED 0x01 -#define SCSI_SENSEQ_OPERATING_DEFINITION_CHANGED 0x02 -#define SCSI_SENSEQ_INQUIRY_DATA_CHANGED 0x03 -#define SCSI_SENSEQ_COMPONENT_DEVICE_ATTACHED 0x04 -#define SCSI_SENSEQ_DEVICE_IDENTIFIER_CHANGED 0x05 -#define SCSI_SENSEQ_REDUNDANCY_GROUP_MODIFIED 0x06 -#define SCSI_SENSEQ_REDUNDANCY_GROUP_DELETED 0x07 -#define SCSI_SENSEQ_SPARE_MODIFIED 0x08 -#define SCSI_SENSEQ_SPARE_DELETED 0x09 -#define SCSI_SENSEQ_VOLUME_SET_MODIFIED 0x0A -#define SCSI_SENSEQ_VOLUME_SET_DELETED 0x0B -#define SCSI_SENSEQ_VOLUME_SET_DEASSIGNED 0x0C -#define SCSI_SENSEQ_VOLUME_SET_REASSIGNED 0x0D -#define SCSI_SENSEQ_REPORTED_LUNS_DATA_CHANGED 0x0E -#define SCSI_SENSEQ_ECHO_BUFFER_OVERWRITTEN 0x0F -#define SCSI_SENSEQ_MEDIUM_LOADABLE 0x10 -#define SCSI_SENSEQ_MEDIUM_AUXILIARY_MEMORY_ACCESSIBLE 0x11 - - -// -// SCSI_ADSENSE_OPERATOR_REQUEST (0x5a) qualifiers -// - -#define SCSI_SENSEQ_STATE_CHANGE_INPUT 0x00 // generic request -#define SCSI_SENSEQ_MEDIUM_REMOVAL 0x01 -#define SCSI_SENSEQ_WRITE_PROTECT_ENABLE 0x02 -#define SCSI_SENSEQ_WRITE_PROTECT_DISABLE 0x03 - -// -// SCSI_ADSENSE_COPY_PROTECTION_FAILURE (0x6f) qualifiers -// -#define SCSI_SENSEQ_AUTHENTICATION_FAILURE 0x00 -#define SCSI_SENSEQ_KEY_NOT_PRESENT 0x01 -#define SCSI_SENSEQ_KEY_NOT_ESTABLISHED 0x02 -#define SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION 0x03 -#define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT 0x04 -#define SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR 0x05 - -// -// SCSI_ADSENSE_POWER_CALIBRATION_ERROR (0x73) qualifiers -// - -#define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ALMOST_FULL 0x01 -#define SCSI_SENSEQ_POWER_CALIBRATION_AREA_FULL 0x02 -#define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ERROR 0x03 -#define SCSI_SENSEQ_PMA_RMA_UPDATE_FAILURE 0x04 -#define SCSI_SENSEQ_PMA_RMA_IS_FULL 0x05 -#define SCSI_SENSEQ_PMA_RMA_ALMOST_FULL 0x06 - - -// end_ntminitape - -// -// SCSI IO Device Control Codes -// - -#define FILE_DEVICE_SCSI 0x0000001b - -#define IOCTL_SCSI_EXECUTE_IN ((FILE_DEVICE_SCSI << 16) + 0x0011) -#define IOCTL_SCSI_EXECUTE_OUT ((FILE_DEVICE_SCSI << 16) + 0x0012) -#define IOCTL_SCSI_EXECUTE_NONE ((FILE_DEVICE_SCSI << 16) + 0x0013) - -// -// SMART support in atapi -// - -#define IOCTL_SCSI_MINIPORT_SMART_VERSION ((FILE_DEVICE_SCSI << 16) + 0x0500) -#define IOCTL_SCSI_MINIPORT_IDENTIFY ((FILE_DEVICE_SCSI << 16) + 0x0501) -#define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS ((FILE_DEVICE_SCSI << 16) + 0x0502) -#define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS ((FILE_DEVICE_SCSI << 16) + 0x0503) -#define IOCTL_SCSI_MINIPORT_ENABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0504) -#define IOCTL_SCSI_MINIPORT_DISABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0505) -#define IOCTL_SCSI_MINIPORT_RETURN_STATUS ((FILE_DEVICE_SCSI << 16) + 0x0506) -#define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE ((FILE_DEVICE_SCSI << 16) + 0x0507) -#define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES ((FILE_DEVICE_SCSI << 16) + 0x0508) -#define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS ((FILE_DEVICE_SCSI << 16) + 0x0509) -#define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTO_OFFLINE ((FILE_DEVICE_SCSI << 16) + 0x050a) -#define IOCTL_SCSI_MINIPORT_READ_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050b) -#define IOCTL_SCSI_MINIPORT_WRITE_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050c) - -// -// CLUSTER support -// deliberately skipped some values to allow for expansion above. -// -#define IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0520) -#define IOCTL_SCSI_MINIPORT_NOT_CLUSTER_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0521) - - -// begin_ntminitape - -// -// Read Capacity Data - returned in Big Endian format -// - -#pragma pack(push, read_capacity, 1) -typedef struct _READ_CAPACITY_DATA { - ULONG LogicalBlockAddress; - ULONG BytesPerBlock; -} READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA; -#pragma pack(pop, read_capacity) - - -#pragma pack(push, read_capacity_ex, 1) -typedef struct _READ_CAPACITY_DATA_EX { - LARGE_INTEGER LogicalBlockAddress; - ULONG BytesPerBlock; -} READ_CAPACITY_DATA_EX, *PREAD_CAPACITY_DATA_EX; -#pragma pack(pop, read_capacity_ex) - - -// -// Read Block Limits Data - returned in Big Endian format -// This structure returns the maximum and minimum block -// size for a TAPE device. -// - -#pragma pack(push, read_block_limits, 1) -typedef struct _READ_BLOCK_LIMITS { - UCHAR Reserved; - UCHAR BlockMaximumSize[3]; - UCHAR BlockMinimumSize[2]; -} READ_BLOCK_LIMITS_DATA, *PREAD_BLOCK_LIMITS_DATA; -#pragma pack(pop, read_block_limits) - -#pragma pack(push, read_buffer_capacity, 1) -typedef struct _READ_BUFFER_CAPACITY_DATA { - UCHAR DataLength[2]; - UCHAR Reserved1; - UCHAR BlockDataReturned : 1; - UCHAR Reserved4 : 7; - UCHAR TotalBufferSize[4]; - UCHAR AvailableBufferSize[4]; -} READ_BUFFER_CAPACITY_DATA, *PREAD_BUFFER_CAPACITY_DATA; -#pragma pack(pop, read_buffer_capacity) - -// -// Mode data structures. -// - -// -// Define Mode parameter header. -// - -#pragma pack(push, mode_params, 1) -typedef struct _MODE_PARAMETER_HEADER { - UCHAR ModeDataLength; - UCHAR MediumType; - UCHAR DeviceSpecificParameter; - UCHAR BlockDescriptorLength; -}MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER; - -typedef struct _MODE_PARAMETER_HEADER10 { - UCHAR ModeDataLength[2]; - UCHAR MediumType; - UCHAR DeviceSpecificParameter; - UCHAR Reserved[2]; - UCHAR BlockDescriptorLength[2]; -}MODE_PARAMETER_HEADER10, *PMODE_PARAMETER_HEADER10; -#pragma pack(pop, mode_params) - -#define MODE_FD_SINGLE_SIDE 0x01 -#define MODE_FD_DOUBLE_SIDE 0x02 -#define MODE_FD_MAXIMUM_TYPE 0x1E -#define MODE_DSP_FUA_SUPPORTED 0x10 -#define MODE_DSP_WRITE_PROTECT 0x80 - -// -// Define the mode parameter block. -// - -#pragma pack(push, mode_params_block, 1) -typedef struct _MODE_PARAMETER_BLOCK { - UCHAR DensityCode; - UCHAR NumberOfBlocks[3]; - UCHAR Reserved; - UCHAR BlockLength[3]; -}MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK; -#pragma pack(pop, mode_params_block) - -// -// Define Disconnect-Reconnect page. -// - - -#pragma pack(push, mode_page_disconnect, 1) -typedef struct _MODE_DISCONNECT_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR BufferFullRatio; - UCHAR BufferEmptyRatio; - UCHAR BusInactivityLimit[2]; - UCHAR BusDisconnectTime[2]; - UCHAR BusConnectTime[2]; - UCHAR MaximumBurstSize[2]; - UCHAR DataTransferDisconnect : 2; - UCHAR Reserved2[3]; -}MODE_DISCONNECT_PAGE, *PMODE_DISCONNECT_PAGE; -#pragma pack(pop, mode_page_disconnect) - -// -// Define mode caching page. -// - -#pragma pack(push, mode_page_caching, 1) -typedef struct _MODE_CACHING_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR ReadDisableCache : 1; - UCHAR MultiplicationFactor : 1; - UCHAR WriteCacheEnable : 1; - UCHAR Reserved2 : 5; - UCHAR WriteRetensionPriority : 4; - UCHAR ReadRetensionPriority : 4; - UCHAR DisablePrefetchTransfer[2]; - UCHAR MinimumPrefetch[2]; - UCHAR MaximumPrefetch[2]; - UCHAR MaximumPrefetchCeiling[2]; -}MODE_CACHING_PAGE, *PMODE_CACHING_PAGE; -#pragma pack(pop, mode_page_caching) - -// -// Define write parameters cdrom page -// -#pragma pack(push, mode_page_wp2, 1) -typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE2 { - UCHAR PageCode : 6; // 0x05 - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; // 0x32 ?? - UCHAR WriteType : 4; - UCHAR TestWrite : 1; - UCHAR LinkSizeValid : 1; - UCHAR BufferUnderrunFreeEnabled : 1; - UCHAR Reserved2 : 1; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR FixedPacket : 1; - UCHAR MultiSession : 2; - UCHAR DataBlockType : 4; - UCHAR Reserved3 : 4; - UCHAR LinkSize; - UCHAR Reserved4; - UCHAR HostApplicationCode : 6; - UCHAR Reserved5 : 2; - UCHAR SessionFormat; - UCHAR Reserved6; - UCHAR PacketSize[4]; - UCHAR AudioPauseLength[2]; - UCHAR MediaCatalogNumber[16]; - UCHAR ISRC[16]; - UCHAR SubHeaderData[4]; -} MODE_CDROM_WRITE_PARAMETERS_PAGE2, *PMODE_CDROM_WRITE_PARAMETERS_PAGE2; -#pragma pack(pop, mode_page_wp2) - -#ifndef DEPRECATE_DDK_FUNCTIONS -// this structure is being retired due to missing fields and overly -// complex data definitions for the MCN and ISRC. -#pragma pack(push, mode_page_wp, 1) -typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE { - UCHAR PageLength; // 0x32 ?? - UCHAR WriteType : 4; - UCHAR TestWrite : 1; - UCHAR LinkSizeValid : 1; - UCHAR BufferUnderrunFreeEnabled : 1; - UCHAR Reserved2 : 1; - UCHAR TrackMode : 4; - UCHAR Copy : 1; - UCHAR FixedPacket : 1; - UCHAR MultiSession : 2; - UCHAR DataBlockType : 4; - UCHAR Reserved3 : 4; - UCHAR LinkSize; - UCHAR Reserved4; - UCHAR HostApplicationCode : 6; - UCHAR Reserved5 : 2; - UCHAR SessionFormat; - UCHAR Reserved6; - UCHAR PacketSize[4]; - UCHAR AudioPauseLength[2]; - UCHAR Reserved7 : 7; - UCHAR MediaCatalogNumberValid : 1; - UCHAR MediaCatalogNumber[13]; - UCHAR MediaCatalogNumberZero; - UCHAR MediaCatalogNumberAFrame; - UCHAR Reserved8 : 7; - UCHAR ISRCValid : 1; - UCHAR ISRCCountry[2]; - UCHAR ISRCOwner[3]; - UCHAR ISRCRecordingYear[2]; - UCHAR ISRCSerialNumber[5]; - UCHAR ISRCZero; - UCHAR ISRCAFrame; - UCHAR ISRCReserved; - UCHAR SubHeaderData[4]; -} MODE_CDROM_WRITE_PARAMETERS_PAGE, *PMODE_CDROM_WRITE_PARAMETERS_PAGE; -#pragma pack(pop, mode_page_wp) -#endif //ifndef DEPRECATE_DDK_FUNCTIONS - -// -// Define the MRW mode page for CDROM device types -// -#pragma pack(push, mode_page_mrw, 1) -typedef struct _MODE_MRW_PAGE { - UCHAR PageCode : 6; // 0x03 - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; //0x06 - UCHAR Reserved1; - UCHAR LbaSpace : 1; - UCHAR Reserved2 : 7; - UCHAR Reserved3[4]; -} MODE_MRW_PAGE, *PMODE_MRW_PAGE; -#pragma pack(pop, mode_page_mrw) - -// -// Define mode flexible disk page. -// - -#pragma pack(push, mode_page_flex, 1) -typedef struct _MODE_FLEXIBLE_DISK_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR TransferRate[2]; - UCHAR NumberOfHeads; - UCHAR SectorsPerTrack; - UCHAR BytesPerSector[2]; - UCHAR NumberOfCylinders[2]; - UCHAR StartWritePrecom[2]; - UCHAR StartReducedCurrent[2]; - UCHAR StepRate[2]; - UCHAR StepPluseWidth; - UCHAR HeadSettleDelay[2]; - UCHAR MotorOnDelay; - UCHAR MotorOffDelay; - UCHAR Reserved2 : 5; - UCHAR MotorOnAsserted : 1; - UCHAR StartSectorNumber : 1; - UCHAR TrueReadySignal : 1; - UCHAR StepPlusePerCyclynder : 4; - UCHAR Reserved3 : 4; - UCHAR WriteCompenstation; - UCHAR HeadLoadDelay; - UCHAR HeadUnloadDelay; - UCHAR Pin2Usage : 4; - UCHAR Pin34Usage : 4; - UCHAR Pin1Usage : 4; - UCHAR Pin4Usage : 4; - UCHAR MediumRotationRate[2]; - UCHAR Reserved4[2]; -} MODE_FLEXIBLE_DISK_PAGE, *PMODE_FLEXIBLE_DISK_PAGE; -#pragma pack(pop, mode_page_flex) - -// -// Define mode format page. -// - -#pragma pack(push, mode_page_format, 1) -typedef struct _MODE_FORMAT_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR TracksPerZone[2]; - UCHAR AlternateSectorsPerZone[2]; - UCHAR AlternateTracksPerZone[2]; - UCHAR AlternateTracksPerLogicalUnit[2]; - UCHAR SectorsPerTrack[2]; - UCHAR BytesPerPhysicalSector[2]; - UCHAR Interleave[2]; - UCHAR TrackSkewFactor[2]; - UCHAR CylinderSkewFactor[2]; - UCHAR Reserved2 : 4; - UCHAR SurfaceFirst : 1; - UCHAR RemovableMedia : 1; - UCHAR HardSectorFormating : 1; - UCHAR SoftSectorFormating : 1; - UCHAR Reserved3[3]; -} MODE_FORMAT_PAGE, *PMODE_FORMAT_PAGE; -#pragma pack(pop, mode_page_format) - -// -// Define rigid disk driver geometry page. -// - -#pragma pack(push, mode_page_geometry, 1) -typedef struct _MODE_RIGID_GEOMETRY_PAGE { - UCHAR PageCode : 6; - UCHAR Reserved : 1; - UCHAR PageSavable : 1; - UCHAR PageLength; - UCHAR NumberOfCylinders[3]; - UCHAR NumberOfHeads; - UCHAR StartWritePrecom[3]; - UCHAR StartReducedCurrent[3]; - UCHAR DriveStepRate[2]; - UCHAR LandZoneCyclinder[3]; - UCHAR RotationalPositionLock : 2; - UCHAR Reserved2 : 6; - UCHAR RotationOffset; - UCHAR Reserved3; - UCHAR RoataionRate[2]; - UCHAR Reserved4[2]; -}MODE_RIGID_GEOMETRY_PAGE, *PMODE_RIGID_GEOMETRY_PAGE; -#pragma pack(pop, mode_page_geometry) - -// -// Define read write recovery page -// - -#pragma pack(push, mode_page_rw_recovery, 1) -typedef struct _MODE_READ_WRITE_RECOVERY_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PSBit : 1; - UCHAR PageLength; - UCHAR DCRBit : 1; - UCHAR DTEBit : 1; - UCHAR PERBit : 1; - UCHAR EERBit : 1; - UCHAR RCBit : 1; - UCHAR TBBit : 1; - UCHAR ARRE : 1; - UCHAR AWRE : 1; - UCHAR ReadRetryCount; - UCHAR Reserved4[4]; - UCHAR WriteRetryCount; - UCHAR Reserved5[3]; - -} MODE_READ_WRITE_RECOVERY_PAGE, *PMODE_READ_WRITE_RECOVERY_PAGE; -#pragma pack(pop, mode_page_rw_recovery) - -// -// Define read recovery page - cdrom -// - -#pragma pack(push, mode_page_r_recovery, 1) -typedef struct _MODE_READ_RECOVERY_PAGE { - - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PSBit : 1; - UCHAR PageLength; - UCHAR DCRBit : 1; - UCHAR DTEBit : 1; - UCHAR PERBit : 1; - UCHAR Reserved2 : 1; - UCHAR RCBit : 1; - UCHAR TBBit : 1; - UCHAR Reserved3 : 2; - UCHAR ReadRetryCount; - UCHAR Reserved4[4]; - -} MODE_READ_RECOVERY_PAGE, *PMODE_READ_RECOVERY_PAGE; -#pragma pack(pop, mode_page_r_recovery) - - -// -// Define Informational Exception Control Page. Used for failure prediction -// - -#pragma pack(push, mode_page_xcpt, 1) -typedef struct _MODE_INFO_EXCEPTIONS -{ - UCHAR PageCode : 6; - UCHAR Reserved1 : 1; - UCHAR PSBit : 1; - - UCHAR PageLength; - - union - { - UCHAR Flags; - struct - { - UCHAR LogErr : 1; - UCHAR Reserved2 : 1; - UCHAR Test : 1; - UCHAR Dexcpt : 1; - UCHAR Reserved3 : 3; - UCHAR Perf : 1; - }; - }; - - UCHAR ReportMethod : 4; - UCHAR Reserved4 : 4; - - UCHAR IntervalTimer[4]; - UCHAR ReportCount[4]; - -} MODE_INFO_EXCEPTIONS, *PMODE_INFO_EXCEPTIONS; -#pragma pack(pop, mode_page_xcpt) - -// -// Begin C/DVD 0.9 definitions -// - -// -// Power Condition Mode Page Format -// - -#pragma pack(push, mode_page_power, 1) -typedef struct _POWER_CONDITION_PAGE { - UCHAR PageCode : 6; // 0x1A - UCHAR Reserved : 1; - UCHAR PSBit : 1; - UCHAR PageLength; // 0x0A - UCHAR Reserved2; - - UCHAR Standby : 1; - UCHAR Idle : 1; - UCHAR Reserved3 : 6; - - UCHAR IdleTimer[4]; - UCHAR StandbyTimer[4]; -} POWER_CONDITION_PAGE, *PPOWER_CONDITION_PAGE; -#pragma pack(pop, mode_page_power) - -// -// CD-Audio Control Mode Page Format -// - -#pragma pack(push, mode_page_cdaudio, 1) -typedef struct _CDDA_OUTPUT_PORT { - UCHAR ChannelSelection : 4; - UCHAR Reserved : 4; - UCHAR Volume; -} CDDA_OUTPUT_PORT, *PCDDA_OUTPUT_PORT; - -typedef struct _CDAUDIO_CONTROL_PAGE { - UCHAR PageCode : 6; // 0x0E - UCHAR Reserved : 1; - UCHAR PSBit : 1; - - UCHAR PageLength; // 0x0E - - UCHAR Reserved2 : 1; - UCHAR StopOnTrackCrossing : 1; // Default 0 - UCHAR Immediate : 1; // Always 1 - UCHAR Reserved3 : 5; - - UCHAR Reserved4[3]; - UCHAR Obsolete[2]; - - CDDA_OUTPUT_PORT CDDAOutputPorts[4]; - -} CDAUDIO_CONTROL_PAGE, *PCDAUDIO_CONTROL_PAGE; -#pragma pack(pop, mode_page_cdaudio) - -#define CDDA_CHANNEL_MUTED 0x0 -#define CDDA_CHANNEL_ZERO 0x1 -#define CDDA_CHANNEL_ONE 0x2 -#define CDDA_CHANNEL_TWO 0x4 -#define CDDA_CHANNEL_THREE 0x8 - -// -// C/DVD Feature Set Support & Version Page -// - -#pragma pack(push, mode_page_features, 1) -typedef struct _CDVD_FEATURE_SET_PAGE { - UCHAR PageCode : 6; // 0x18 - UCHAR Reserved : 1; - UCHAR PSBit : 1; - - UCHAR PageLength; // 0x16 - - UCHAR CDAudio[2]; - UCHAR EmbeddedChanger[2]; - UCHAR PacketSMART[2]; - UCHAR PersistantPrevent[2]; - UCHAR EventStatusNotification[2]; - UCHAR DigitalOutput[2]; - UCHAR CDSequentialRecordable[2]; - UCHAR DVDSequentialRecordable[2]; - UCHAR RandomRecordable[2]; - UCHAR KeyExchange[2]; - UCHAR Reserved2[2]; -} CDVD_FEATURE_SET_PAGE, *PCDVD_FEATURE_SET_PAGE; -#pragma pack(pop, mode_page_features) - -// -// CDVD Inactivity Time-out Page Format -// - -#pragma pack(push, mode_page_timeout, 1) -typedef struct _CDVD_INACTIVITY_TIMEOUT_PAGE { - UCHAR PageCode : 6; // 0x1D - UCHAR Reserved : 1; - UCHAR PSBit : 1; - - UCHAR PageLength; // 0x08 - UCHAR Reserved2[2]; - - UCHAR SWPP : 1; - UCHAR DISP : 1; - UCHAR Reserved3 : 6; - - UCHAR Reserved4; - UCHAR GroupOneMinimumTimeout[2]; - UCHAR GroupTwoMinimumTimeout[2]; -} CDVD_INACTIVITY_TIMEOUT_PAGE, *PCDVD_INACTIVITY_TIMEOUT_PAGE; -#pragma pack(pop, mode_page_timeout) - -// -// CDVD Capabilities & Mechanism Status Page -// - -#define CDVD_LMT_CADDY 0 -#define CDVD_LMT_TRAY 1 -#define CDVD_LMT_POPUP 2 -#define CDVD_LMT_RESERVED1 3 -#define CDVD_LMT_CHANGER_INDIVIDUAL 4 -#define CDVD_LMT_CHANGER_CARTRIDGE 5 -#define CDVD_LMT_RESERVED2 6 -#define CDVD_LMT_RESERVED3 7 - - -#pragma pack(push, mode_page_capabilities, 1) -typedef struct _CDVD_CAPABILITIES_PAGE { - UCHAR PageCode : 6; // 0x2A - UCHAR Reserved : 1; - UCHAR PSBit : 1; // offset 0 - - UCHAR PageLength; // >= 0x18 // offset 1 - - UCHAR CDRRead : 1; - UCHAR CDERead : 1; - UCHAR Method2 : 1; - UCHAR DVDROMRead : 1; - UCHAR DVDRRead : 1; - UCHAR DVDRAMRead : 1; - UCHAR Reserved2 : 2; // offset 2 - - UCHAR CDRWrite : 1; - UCHAR CDEWrite : 1; - UCHAR TestWrite : 1; - UCHAR Reserved3 : 1; - UCHAR DVDRWrite : 1; - UCHAR DVDRAMWrite : 1; - UCHAR Reserved4 : 2; // offset 3 - - UCHAR AudioPlay : 1; - UCHAR Composite : 1; - UCHAR DigitalPortOne : 1; - UCHAR DigitalPortTwo : 1; - UCHAR Mode2Form1 : 1; - UCHAR Mode2Form2 : 1; - UCHAR MultiSession : 1; - UCHAR BufferUnderrunFree : 1; // offset 4 - - UCHAR CDDA : 1; - UCHAR CDDAAccurate : 1; - UCHAR RWSupported : 1; - UCHAR RWDeinterleaved : 1; - UCHAR C2Pointers : 1; - UCHAR ISRC : 1; - UCHAR UPC : 1; - UCHAR ReadBarCodeCapable : 1; // offset 5 - - UCHAR Lock : 1; - UCHAR LockState : 1; - UCHAR PreventJumper : 1; - UCHAR Eject : 1; - UCHAR Reserved6 : 1; - UCHAR LoadingMechanismType : 3; // offset 6 - - UCHAR SeparateVolume : 1; - UCHAR SeperateChannelMute : 1; - UCHAR SupportsDiskPresent : 1; - UCHAR SWSlotSelection : 1; - UCHAR SideChangeCapable : 1; - UCHAR RWInLeadInReadable : 1; - UCHAR Reserved7 : 2; // offset 7 - - union { - UCHAR ReadSpeedMaximum[2]; - UCHAR ObsoleteReserved[2]; // offset 8 - }; - - UCHAR NumberVolumeLevels[2]; // offset 10 - UCHAR BufferSize[2]; // offset 12 - - union { - UCHAR ReadSpeedCurrent[2]; - UCHAR ObsoleteReserved2[2]; // offset 14 - }; - UCHAR ObsoleteReserved3; // offset 16 - - UCHAR Reserved8 : 1; - UCHAR BCK : 1; - UCHAR RCK : 1; - UCHAR LSBF : 1; - UCHAR Length : 2; - UCHAR Reserved9 : 2; // offset 17 - - union { - UCHAR WriteSpeedMaximum[2]; - UCHAR ObsoleteReserved4[2]; // offset 18 - }; - union { - UCHAR WriteSpeedCurrent[2]; - UCHAR ObsoleteReserved11[2]; // offset 20 - }; - - // - // NOTE: This mode page is two bytes too small in the release - // version of the Windows2000 DDK. it also incorrectly - // put the CopyManagementRevision at offset 20 instead - // of offset 22, so fix that with a nameless union (for - // backwards-compatibility with those who "fixed" it on - // their own by looking at Reserved10[]). - // - - union { - UCHAR CopyManagementRevision[2]; // offset 22 - UCHAR Reserved10[2]; - }; - //UCHAR Reserved12[2]; // offset 24 - -} CDVD_CAPABILITIES_PAGE, *PCDVD_CAPABILITIES_PAGE; -#pragma pack(pop, mode_page_capabilities) - -#pragma pack(push, lun_list, 1) -typedef struct _LUN_LIST { - UCHAR LunListLength[4]; // sizeof LunSize * 8 - UCHAR Reserved[4]; -#if !defined(__midl) - UCHAR Lun[0][8]; // 4 level of addressing. 2 bytes each. -#endif -} LUN_LIST, *PLUN_LIST; -#pragma pack(pop, lun_list) - - -#define LOADING_MECHANISM_CADDY 0x00 -#define LOADING_MECHANISM_TRAY 0x01 -#define LOADING_MECHANISM_POPUP 0x02 -#define LOADING_MECHANISM_INDIVIDUAL_CHANGER 0x04 -#define LOADING_MECHANISM_CARTRIDGE_CHANGER 0x05 - -// -// end C/DVD 0.9 mode page definitions - -// -// Mode parameter list block descriptor - -// set the block length for reading/writing -// -// - -#define MODE_BLOCK_DESC_LENGTH 8 -#define MODE_HEADER_LENGTH 4 -#define MODE_HEADER_LENGTH10 8 - -#pragma pack(push, mode_parm_rw, 1) -typedef struct _MODE_PARM_READ_WRITE { - - MODE_PARAMETER_HEADER ParameterListHeader; // List Header Format - MODE_PARAMETER_BLOCK ParameterListBlock; // List Block Descriptor - -} MODE_PARM_READ_WRITE_DATA, *PMODE_PARM_READ_WRITE_DATA; -#pragma pack(pop, mode_parm_rw) - -// end_ntminitape - -// -// CDROM audio control (0x0E) -// - -#define CDB_AUDIO_PAUSE 0 -#define CDB_AUDIO_RESUME 1 - -#define CDB_DEVICE_START 0x11 -#define CDB_DEVICE_STOP 0x10 - -#define CDB_EJECT_MEDIA 0x10 -#define CDB_LOAD_MEDIA 0x01 - -#define CDB_SUBCHANNEL_HEADER 0x00 -#define CDB_SUBCHANNEL_BLOCK 0x01 - -#define CDROM_AUDIO_CONTROL_PAGE 0x0E -#define MODE_SELECT_IMMEDIATE 0x04 -#define MODE_SELECT_PFBIT 0x10 - -#define CDB_USE_MSF 0x01 - -#pragma pack(push, audio_output, 1) -typedef struct _PORT_OUTPUT { - UCHAR ChannelSelection; - UCHAR Volume; -} PORT_OUTPUT, *PPORT_OUTPUT; - -typedef struct _AUDIO_OUTPUT { - UCHAR CodePage; - UCHAR ParameterLength; - UCHAR Immediate; - UCHAR Reserved[2]; - UCHAR LbaFormat; - UCHAR LogicalBlocksPerSecond[2]; - PORT_OUTPUT PortOutput[4]; -} AUDIO_OUTPUT, *PAUDIO_OUTPUT; -#pragma pack(pop, audio_output) - -// -// Multisession CDROM -// - -#define GET_LAST_SESSION 0x01 -#define GET_SESSION_DATA 0x02; - -// -// Atapi 2.5 changer -// - -#pragma pack(push, chgr_stuff, 1) -typedef struct _MECHANICAL_STATUS_INFORMATION_HEADER { - UCHAR CurrentSlot : 5; - UCHAR ChangerState : 2; - UCHAR Fault : 1; - UCHAR Reserved : 5; - UCHAR MechanismState : 3; - UCHAR CurrentLogicalBlockAddress[3]; - UCHAR NumberAvailableSlots; - UCHAR SlotTableLength[2]; -} MECHANICAL_STATUS_INFORMATION_HEADER, *PMECHANICAL_STATUS_INFORMATION_HEADER; - -typedef struct _SLOT_TABLE_INFORMATION { - UCHAR DiscChanged : 1; - UCHAR Reserved : 6; - UCHAR DiscPresent : 1; - UCHAR Reserved2[3]; -} SLOT_TABLE_INFORMATION, *PSLOT_TABLE_INFORMATION; - -typedef struct _MECHANICAL_STATUS { - MECHANICAL_STATUS_INFORMATION_HEADER MechanicalStatusHeader; - SLOT_TABLE_INFORMATION SlotTableInfo[1]; -} MECHANICAL_STATUS, *PMECHANICAL_STATUS; -#pragma pack(pop, chgr_stuff) - - -// begin_ntminitape - -// -// Tape definitions -// - -#pragma pack(push, tape_position, 1) -typedef struct _TAPE_POSITION_DATA { - UCHAR Reserved1:2; - UCHAR BlockPositionUnsupported:1; - UCHAR Reserved2:3; - UCHAR EndOfPartition:1; - UCHAR BeginningOfPartition:1; - UCHAR PartitionNumber; - USHORT Reserved3; - UCHAR FirstBlock[4]; - UCHAR LastBlock[4]; - UCHAR Reserved4; - UCHAR NumberOfBlocks[3]; - UCHAR NumberOfBytes[4]; -} TAPE_POSITION_DATA, *PTAPE_POSITION_DATA; -#pragma pack(pop, tape_position) - -// -// This structure is used to convert little endian -// ULONGs to SCSI CDB big endians values. -// - -#pragma pack(push, byte_stuff, 1) -typedef union _EIGHT_BYTE { - - struct { - UCHAR Byte0; - UCHAR Byte1; - UCHAR Byte2; - UCHAR Byte3; - UCHAR Byte4; - UCHAR Byte5; - UCHAR Byte6; - UCHAR Byte7; - }; - - ULONGLONG AsULongLong; -} EIGHT_BYTE, *PEIGHT_BYTE; - -typedef union _FOUR_BYTE { - - struct { - UCHAR Byte0; - UCHAR Byte1; - UCHAR Byte2; - UCHAR Byte3; - }; - - ULONG AsULong; -} FOUR_BYTE, *PFOUR_BYTE; - -typedef union _TWO_BYTE { - - struct { - UCHAR Byte0; - UCHAR Byte1; - }; - - USHORT AsUShort; -} TWO_BYTE, *PTWO_BYTE; -#pragma pack(pop, byte_stuff) - -// -// Byte reversing macro for converting -// between big- and little-endian formats -// - -#define REVERSE_BYTES_QUAD(Destination, Source) { \ - PEIGHT_BYTE d = (PEIGHT_BYTE)(Destination); \ - PEIGHT_BYTE s = (PEIGHT_BYTE)(Source); \ - d->Byte7 = s->Byte0; \ - d->Byte6 = s->Byte1; \ - d->Byte5 = s->Byte2; \ - d->Byte4 = s->Byte3; \ - d->Byte3 = s->Byte4; \ - d->Byte2 = s->Byte5; \ - d->Byte1 = s->Byte6; \ - d->Byte0 = s->Byte7; \ -} - -#define REVERSE_BYTES(Destination, Source) { \ - PFOUR_BYTE d = (PFOUR_BYTE)(Destination); \ - PFOUR_BYTE s = (PFOUR_BYTE)(Source); \ - d->Byte3 = s->Byte0; \ - d->Byte2 = s->Byte1; \ - d->Byte1 = s->Byte2; \ - d->Byte0 = s->Byte3; \ -} - -#define REVERSE_BYTES_SHORT(Destination, Source) { \ - PTWO_BYTE d = (PTWO_BYTE)(Destination); \ - PTWO_BYTE s = (PTWO_BYTE)(Source); \ - d->Byte1 = s->Byte0; \ - d->Byte0 = s->Byte1; \ -} - -// -// Byte reversing macro for converting -// USHORTS from big to little endian in place -// - -#define REVERSE_SHORT(Short) { \ - UCHAR tmp; \ - PTWO_BYTE w = (PTWO_BYTE)(Short); \ - tmp = w->Byte0; \ - w->Byte0 = w->Byte1; \ - w->Byte1 = tmp; \ - } - -// -// Byte reversing macro for convering -// ULONGS between big & little endian in place -// - -#define REVERSE_LONG(Long) { \ - UCHAR tmp; \ - PFOUR_BYTE l = (PFOUR_BYTE)(Long); \ - tmp = l->Byte3; \ - l->Byte3 = l->Byte0; \ - l->Byte0 = tmp; \ - tmp = l->Byte2; \ - l->Byte2 = l->Byte1; \ - l->Byte1 = tmp; \ - } - -// -// This macro has the effect of Bit = log2(Data) -// - -#define WHICH_BIT(Data, Bit) { \ - UCHAR tmp; \ - for (tmp = 0; tmp < 32; tmp++) { \ - if (((Data) >> tmp) == 1) { \ - break; \ - } \ - } \ - ASSERT(tmp != 32); \ - (Bit) = tmp; \ -} - - -// -// For backwards compatability, use SCSIPORT definitions. -// - -typedef PHYSICAL_ADDRESS STOR_PHYSICAL_ADDRESS, *PSTOR_PHYSICAL_ADDRESS; - -typedef struct _ACCESS_RANGE { - STOR_PHYSICAL_ADDRESS RangeStart; - ULONG RangeLength; - BOOLEAN RangeInMemory; -} ACCESS_RANGE, *PACCESS_RANGE; - -// -// _MEMORY_REGION represents a region of physical contiguous memory. -// Generally, this is used for DMA common buffer regions. -// - -typedef struct _MEMORY_REGION { - - // - // Beginning virtual address of the region. - // - - PUCHAR VirtualBase; - - // - // Beginning physical address of the region. - // - - PHYSICAL_ADDRESS PhysicalBase; - - // - // Length of the region - // - // - - ULONG Length; - -} MEMORY_REGION, *PMEMORY_REGION; - - -typedef enum _STOR_SYNCHRONIZATION_MODEL { - StorSynchronizeHalfDuplex, - StorSynchronizeFullDuplex -} STOR_SYNCHRONIZATION_MODEL; - -typedef enum _INTERRUPT_SYNCHRONIZATION_MODE { - InterruptSupportNone, - InterruptSynchronizeAll, - InterruptSynchronizePerMessage -} INTERRUPT_SYNCHRONIZATION_MODE; - -typedef -BOOLEAN -(*PHW_MESSAGE_SIGNALED_INTERRUPT_ROUTINE) ( - IN PVOID HwDeviceExtension, - IN ULONG MessageId - ); - -// -// Message signalled interrupts support. -// - -typedef struct _MESSAGE_INTERRUPT_INFORMATION { - ULONG MessageId; - ULONG MessageData; - STOR_PHYSICAL_ADDRESS MessageAddress; - ULONG InterruptVector; - ULONG InterruptLevel; - KINTERRUPT_MODE InterruptMode; -} MESSAGE_INTERRUPT_INFORMATION, *PMESSAGE_INTERRUPT_INFORMATION; - - -BOOLEAN -StorPortGetMessageInterruptInformation( - __in PVOID HwDeviceExtension, - __in ULONG MessageId, - __out PMESSAGE_INTERRUPT_INFORMATION InterruptInfo - ); -#define STOR_MAP_NO_BUFFERS (0) -#define STOR_MAP_ALL_BUFFERS (1) -#define STOR_MAP_NON_READ_WRITE_BUFFERS (2) - -// ExtendedFlags1 flags - -#define EXTENDED_FLAG_POWER 0x00000001 -// -// Configuration information structure. Contains the information necessary -// to initialize the adapter. NOTE: This structure must be a multiple of -// quadwords. -// - -typedef struct _PORT_CONFIGURATION_INFORMATION { - - // - // Length of port configuation information strucuture. - // - - ULONG Length; - - // - // IO bus number (0 for machines that have only 1 IO bus - // - - ULONG SystemIoBusNumber; - - // - // EISA, MCA or ISA - // - - INTERFACE_TYPE AdapterInterfaceType; - - // - // Interrupt request level for device - // - - ULONG BusInterruptLevel; - - // - // Bus interrupt vector used with hardware buses which use as vector as - // well as level, such as internal buses. - // - - ULONG BusInterruptVector; - - // - // Interrupt mode (level-sensitive or edge-triggered) - // - - KINTERRUPT_MODE InterruptMode; - - // - // Maximum number of bytes that can be transferred in a single SRB - // - - ULONG MaximumTransferLength; - - // - // Number of contiguous blocks of physical memory - // - - ULONG NumberOfPhysicalBreaks; - - // - // DMA channel for devices using system DMA - // - - ULONG DmaChannel; - ULONG DmaPort; - DMA_WIDTH DmaWidth; - DMA_SPEED DmaSpeed; - - // - // Alignment masked required by the adapter for data transfers. - // - - ULONG AlignmentMask; - - // - // Number of access range elements which have been allocated. - // - - ULONG NumberOfAccessRanges; - - // - // Pointer to array of access range elements. - // - - ACCESS_RANGE (*AccessRanges)[]; - - // - // Reserved field. - // - - PVOID Reserved; - - // - // Number of SCSI buses attached to the adapter. - // - - UCHAR NumberOfBuses; - - // - // SCSI bus ID for adapter - // - - CCHAR InitiatorBusId[8]; - - // - // Indicates that the adapter does scatter/gather - // - - BOOLEAN ScatterGather; - - // - // Indicates that the adapter is a bus master - // - - BOOLEAN Master; - - // - // Host caches data or state. - // - - BOOLEAN CachesData; - - // - // Host adapter scans down for bios devices. - // - - BOOLEAN AdapterScansDown; - - // - // Primary at disk address (0x1F0) claimed. - // - - BOOLEAN AtdiskPrimaryClaimed; - - // - // Secondary at disk address (0x170) claimed. - // - - BOOLEAN AtdiskSecondaryClaimed; - - // - // The master uses 32-bit DMA addresses. - // - - BOOLEAN Dma32BitAddresses; - - // - // Use Demand Mode DMA rather than Single Request. - // - - BOOLEAN DemandMode; - - // - // Data buffers must be mapped into virtual address space. - // - - UCHAR MapBuffers; - - // - // The driver will need to tranlate virtual to physical addresses. - // - - BOOLEAN NeedPhysicalAddresses; - - // - // Supports tagged queuing - // - - BOOLEAN TaggedQueuing; - - // - // Supports auto request sense. - // - - BOOLEAN AutoRequestSense; - - // - // Supports multiple requests per logical unit. - // - - BOOLEAN MultipleRequestPerLu; - - // - // Support receive event function. - // - - BOOLEAN ReceiveEvent; - - // - // Indicates the real-mode driver has initialized the card. - // - - BOOLEAN RealModeInitialized; - - // - // Indicate that the miniport will not touch the data buffers directly. - // - - BOOLEAN BufferAccessScsiPortControlled; - - // - // Indicator for wide scsi. - // - - UCHAR MaximumNumberOfTargets; - - // - // Ensure quadword alignment. - // - - UCHAR ReservedUchars[2]; - - // - // Adapter slot number - // - - ULONG SlotNumber; - - // - // Interrupt information for a second IRQ. - // - - ULONG BusInterruptLevel2; - ULONG BusInterruptVector2; - KINTERRUPT_MODE InterruptMode2; - - // - // DMA information for a second channel. - // - - ULONG DmaChannel2; - ULONG DmaPort2; - DMA_WIDTH DmaWidth2; - DMA_SPEED DmaSpeed2; - - // - // Fields added to allow for the miniport - // to update these sizes based on requirements - // for large transfers ( > 64K); - // - - ULONG DeviceExtensionSize; - ULONG SpecificLuExtensionSize; - ULONG SrbExtensionSize; - - // - // Used to determine whether the system and/or the miniport support - // 64-bit physical addresses. See SCSI_DMA64_* flags below. - // - - UCHAR Dma64BitAddresses; /* New */ - - // - // Indicates that the miniport can accept a SRB_FUNCTION_RESET_DEVICE - // to clear all requests to a particular LUN. - // - - BOOLEAN ResetTargetSupported; /* New */ - - // - // Indicates that the miniport can support more than 8 logical units per - // target (maximum LUN number is one less than this field). - // - - UCHAR MaximumNumberOfLogicalUnits; /* New */ - - // - // Supports WMI? - // - - BOOLEAN WmiDataProvider; - - // - // STORPORT synchronization model, either half or full duplex - // depending on whether the driver supports async-with-interrupt - // model or not. - // - - STOR_SYNCHRONIZATION_MODEL SynchronizationModel; // STORPORT New - - PHW_MESSAGE_SIGNALED_INTERRUPT_ROUTINE HwMSInterruptRoutine; - - INTERRUPT_SYNCHRONIZATION_MODE InterruptSynchronizationMode; - - MEMORY_REGION DumpRegion; - - ULONG RequestedDumpBufferSize; - - BOOLEAN VirtualDevice; - - ULONG ExtendedFlags1; - - ULONG MaxNumberOfIO; - - -} PORT_CONFIGURATION_INFORMATION, *PPORT_CONFIGURATION_INFORMATION; - - -// -// Scatter/gather lists -// - -typedef struct _STOR_SCATTER_GATHER_ELEMENT { - STOR_PHYSICAL_ADDRESS PhysicalAddress; - ULONG Length; - ULONG_PTR Reserved; -} STOR_SCATTER_GATHER_ELEMENT, *PSTOR_SCATTER_GATHER_ELEMENT; - -typedef struct _STOR_SCATTER_GATHER_LIST { - ULONG NumberOfElements; - ULONG_PTR Reserved; - STOR_SCATTER_GATHER_ELEMENT List[]; -} STOR_SCATTER_GATHER_LIST, *PSTOR_SCATTER_GATHER_LIST; - - -typedef enum _GETSGSTATUS{ - SG_ALLOCATED = 0, - SG_BUFFER_TOO_SMALL -} GETSGSTATUS, *PGETSGSTATUS; - -// -// Version control for ConfigInfo structure. -// - -#define CONFIG_INFO_VERSION_2 sizeof(PORT_CONFIGURATION_INFORMATION) - - -// -// Flags for controlling 64-bit DMA use (PORT_CONFIGURATION_INFORMATION field -// Dma64BitAddresses) -// - -// -// Set by scsiport on entering HwFindAdapter if the system can support 64-bit -// physical addresses. The miniport can use this information before calling -// ScsiPortGetUncachedExtension to modify the DeviceExtensionSize, -// SpecificLuExtensionSize & SrbExtensionSize fields to account for the extra -// size of the scatter gather list. -// - -#define SCSI_DMA64_SYSTEM_SUPPORTED 0x80 - -// -// Set by the miniport before returning from HwFindAdapter to tell the port -// driver that we support 64-bit physical addresses on I/O transfers. The -// port driver will still allocate Uncached Extension, SenseInfo and Srb -// Extension below 4GB, but I/O transfers will not be remapped. -// - - -#define SCSI_DMA64_MINIPORT_SUPPORTED 0x01 - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -// -// Set by the miniport before returning from HwFindAdpater to tell the port -// driver that we support full 64-bit addressing. This means I/O requests -// may be handled with > 4GB physical addresses, and uncached extension, -// SenseInof and Srb Extension may all lie above 4GB. -// - -#define SCSI_DMA64_MINIPORT_FULL64BIT_SUPPORTED 0x02 -#endif - -// -// Command type (and parameter) definition(s) for AdapterControl requests. -// - -typedef enum _SCSI_ADAPTER_CONTROL_TYPE { - ScsiQuerySupportedControlTypes = 0, - ScsiStopAdapter, - ScsiRestartAdapter, - ScsiSetBootConfig, - ScsiSetRunningConfig, - ScsiAdapterControlMax, - MakeAdapterControlTypeSizeOfUlong = 0xffffffff -} SCSI_ADAPTER_CONTROL_TYPE, *PSCSI_ADAPTER_CONTROL_TYPE; - -// -// Adapter control status values -// - -typedef enum _SCSI_ADAPTER_CONTROL_STATUS { - ScsiAdapterControlSuccess = 0, - ScsiAdapterControlUnsuccessful -} SCSI_ADAPTER_CONTROL_STATUS, *PSCSI_ADAPTER_CONTROL_STATUS; - -// -// Parameters for Adapter Control Functions: -// - -// -// ScsiQuerySupportedControlTypes: -// - -typedef struct _SCSI_SUPPORTED_CONTROL_TYPE_LIST { - - // - // Specifies the number of entries in the adapter control type list. - // - - ULONG MaxControlType; - - // - // The miniport will set TRUE for each control type it supports. - // The number of entries in this array is defined by MaxAdapterControlType - // - the miniport must not attempt to set any AC types beyond the maximum - // value specified. - // - - BOOLEAN SupportedTypeList[0]; - -} SCSI_SUPPORTED_CONTROL_TYPE_LIST, *PSCSI_SUPPORTED_CONTROL_TYPE_LIST; - -// -// DPC Data Structure -// - -typedef struct _DPC_BUFFER { - CSHORT Type; - UCHAR Number; - UCHAR Importance; - struct { - PVOID F; - PVOID B; - }; - PVOID DeferredRoutine; - PVOID DeferredContext; - PVOID SystemArgument1; - PVOID SystemArgument2; - PVOID DpcData; -} DPC_BUFFER; - -#define STOR_DPC_BUFFER_SIZE (sizeof (DPC_BUFFER)) - -typedef struct _STOR_DPC { - DPC_BUFFER Dpc; - ULONG_PTR Lock; -} STOR_DPC, *PSTOR_DPC; - -typedef enum _STOR_SPINLOCK { - DpcLock = 1, - StartIoLock, - InterruptLock -} STOR_SPINLOCK; - -typedef struct _STOR_LOCK_HANDLE { - STOR_SPINLOCK Lock; - struct { - struct { - PVOID Next; - PVOID Lock; - } LockQueue; - KIRQL OldIrql; - } Context; -} STOR_LOCK_HANDLE, *PSTOR_LOCK_HANDLE; - -#define STOR_PERF_DPC_REDIRECTION 0x00000001 -#define STOR_PERF_CONCURRENT_CHANNELS 0x00000002 -#define STOR_PERF_INTERRUPT_MESSAGE_RANGES 0x00000004 -#define STOR_PERF_ADV_CONFIG_LOCALITY 0x00000008 -#define STOR_PERF_OPTIMIZE_FOR_COMPLETION_DURING_STARTIO 0x00000010 - -#define STOR_PERF_VERSION 0x00000003 - -typedef struct _PERF_CONFIGURATION_DATA { - ULONG Version; - ULONG Size; - ULONG Flags; - ULONG ConcurrentChannels; - ULONG FirstRedirectionMessageNumber, LastRedirectionMessageNumber; - ULONG DeviceNode; - ULONG Reserved; - PGROUP_AFFINITY MessageTargets; -} PERF_CONFIGURATION_DATA, *PPERF_CONFIGURATION_DATA; - -typedef struct _STARTIO_PERFORMANCE_PARAMETERS { - ULONG Version; - ULONG Size; - ULONG MessageNumber; - ULONG ChannelNumber; -} STARTIO_PERFORMANCE_PARAMETERS, *PSTARTIO_PERFORMANCE_PARAMETERS; - -// -// SCSI Adapter Dependent Routines -// - -typedef -BOOLEAN -(*PHW_INITIALIZE) ( - __in PVOID DeviceExtension - ); - -typedef -BOOLEAN -(*PHW_BUILDIO) ( - __in PVOID DeviceExtension, - __in PSCSI_REQUEST_BLOCK Srb - ); - -typedef -BOOLEAN -(*PHW_STARTIO) ( - __in PVOID DeviceExtension, - __in PSCSI_REQUEST_BLOCK Srb - ); - -typedef -BOOLEAN -(*PHW_INTERRUPT) ( - __in PVOID DeviceExtension - ); - -typedef -VOID -(*PHW_TIMER) ( - __in PVOID DeviceExtension - ); - -typedef -VOID -(*PHW_DMA_STARTED) ( - __in PVOID DeviceExtension - ); - -typedef -ULONG -(*PHW_FIND_ADAPTER) ( - __in PVOID DeviceExtension, - __in PVOID HwContext, - __in PVOID BusInformation, - __in PCHAR ArgumentString, - __inout PPORT_CONFIGURATION_INFORMATION ConfigInfo, - __out PBOOLEAN Again - ); - -typedef -BOOLEAN -(*PHW_RESET_BUS) ( - __in PVOID DeviceExtension, - __in ULONG PathId - ); - -typedef -BOOLEAN -(*PHW_ADAPTER_STATE) ( - __in PVOID DeviceExtension, - __in PVOID Context, - __in BOOLEAN SaveState - ); - -typedef -SCSI_ADAPTER_CONTROL_STATUS -(*PHW_ADAPTER_CONTROL) ( - __in PVOID DeviceExtension, - __in SCSI_ADAPTER_CONTROL_TYPE ControlType, - __in PVOID Parameters - ); - -typedef -BOOLEAN -(*PHW_PASSIVE_INITIALIZE_ROUTINE)( - __in PVOID DeviceExtension - ); - -typedef -VOID -(*PHW_DPC_ROUTINE)( - __in PSTOR_DPC Dpc, - __in PVOID HwDeviceExtension, - __in PVOID SystemArgument1, - __in PVOID SystemArgument2 - ); - -typedef -BOOLEAN -(*PStorPortGetMessageInterruptInformation)( - __in PVOID HwDeviceExtension, - __in ULONG MessageId, - __out PMESSAGE_INTERRUPT_INFORMATION InterruptInfo - ); -typedef -VOID -(*PStorPortPutScatterGatherList) ( - __in PVOID HwDeviceExtension, - __in PSTOR_SCATTER_GATHER_LIST ScatterGatherList, - __in BOOLEAN WriteToDevice - ); -typedef -VOID - (*PpostScaterGatherExecute)( - __in PVOID *DeviceObject, - __in PVOID *Irp, - __in PSTOR_SCATTER_GATHER_LIST ScatterGather, - __in PVOID Context - ); - -typedef -GETSGSTATUS -(*PStorPortBuildScatterGatherList) ( - __in PVOID HwDeviceExtension, - __in PVOID Mdl, - __in_bcount(Length) PVOID CurrentVa, - __in ULONG Length, - __in PpostScaterGatherExecute ExecutionRoutine, - __in PVOID Context, - __in BOOLEAN WriteToDevice, - __inout_bcount(ScatterGatherBufferLength) PVOID ScatterGatherBuffer, - __in ULONG ScatterGatherBufferLength - ); -typedef - -VOID -(*PStorPortFreePool)( - __in __drv_freesMem(Mem) PVOID PMemory, - __in PVOID HwDeviceExtension, - __in_opt __drv_freesMem(Mem) PVOID PMdl - ); -typedef - -__drv_allocatesMem(Mem) -__bcount(NumberOfBytes) -PVOID -(*PStorPortAllocatePool)( - __in ULONG NumberOfBytes, - __in ULONG Tag, - __in PVOID HwDeviceExtension, - __out __deref __drv_when(return==0, __drv_valueIs(==0)) - __deref __drv_when(return!=0, __drv_aliasesMem __drv_allocatesMem(Mem) __drv_valueIs(!=0)) - PVOID *PMdl - ); - -typedef -PVOID -(*PStorPortGetSystemAddress)( - __in PSCSI_REQUEST_BLOCK Srb - ); - -typedef -ULONG -(*PStorPortAcquireMSISpinLock)( - __in PVOID HwDeviceExtension, - __in ULONG MessageID - ); -typedef -VOID -(*PStorPortReleaseMSISpinLock)( - __in PVOID HwDeviceExtension, - __in ULONG MessageID, - __in ULONG OldIrql - ); - -typedef -VOID -(*PStorPortCompleteServiceIrp)( - __in PVOID HwDeviceExtension, - __in PVOID Irp - ); -typedef -PVOID -(*PStorPortGetOriginalMdl)( - __in PSCSI_REQUEST_BLOCK Srb - ); - -typedef struct _STORPORT_EXTENDED_FUNCTIONS { - - ULONG Version; - - // Port extended services - PStorPortGetMessageInterruptInformation GetMessageInterruptInformation; - PStorPortPutScatterGatherList PutScatterGatherList; - PStorPortBuildScatterGatherList BuildScatterGatherList; - PStorPortFreePool FreePool; - PStorPortAllocatePool AllocatePool; - PStorPortGetSystemAddress GetSystemAddress; - PStorPortAcquireMSISpinLock AcquireMSISpinLock; - PStorPortReleaseMSISpinLock ReleaseMSISpinLock; - PStorPortCompleteServiceIrp CompleteServiceIrp; - PStorPortGetOriginalMdl GetOriginalMdl; -} STORPORT_EXTENDED_FUNCTIONS, *PSTORPORT_EXTENDED_FUNCTIONS; - - -typedef enum _STORPORT_FUNCTION_CODE { - ExtFunctionAllocatePool, - ExtFunctionFreePool, - ExtFunctionAllocateMdl, - ExtFunctionFreeMdl, - ExtFunctionBuildMdlForNonPagedPool, - ExtFunctionGetSystemAddress, - ExtFunctionGetOriginalMdl, - ExtFunctionCompleteServiceIrp, - ExtFunctionGetDeviceObjects, - ExtFunctionBuildScatterGatherList, - ExtFunctionPutScatterGatherList, - ExtFunctionAcquireMSISpinLock, - ExtFunctionReleaseMSISpinLock, - ExtFunctionGetMessageInterruptInformation, - ExtFunctionInitializePerformanceOptimizations, - ExtFunctionGetStartIoPerformanceParameters, - ExtFunctionLogSystemEvent, - ExtFunctionGetCurrentProcessorNumber, - ExtFunctionGetActiveGroupCount, - ExtFunctionGetGroupAffinity, - ExtFunctionGetActiveNodeCount, - ExtFunctionGetNodeAffinity, - ExtFunctionGetHighestNodeNumber, - ExtFunctionGetLogicalProcessorRelationship, - ExtFunctionAllocateContiguousMemorySpecifyCacheNode, - ExtFunctionFreeContiguousMemorySpecifyCache -} STORPORT_FUNCTION_CODE, *PSTORPORT_FUNCTION_CODE; - - -// -// Storage port driver status codes -// This is the storage equivalent of NTSTATUS -// - -#define STOR_STATUS_SUCCESS (0x00000000L) -#define STOR_STATUS_UNSUCCESSFUL (0xC1000001L) -#define STOR_STATUS_NOT_IMPLEMENTED (0xC1000002L) -#define STOR_STATUS_INSUFFICIENT_RESOURCES (0xC1000003L) -#define STOR_STATUS_BUFFER_TOO_SMALL (0xC1000004L) -#define STOR_STATUS_ACCESS_DENIED (0xC1000005L) -#define STOR_STATUS_INVALID_PARAMETER (0xC1000006L) -#define STOR_STATUS_INVALID_DEVICE_REQUEST (0xC1000007L) -#define STOR_STATUS_INVALID_IRQL (0xC1000008L) -#define STOR_STATUS_INVALID_DEVICE_STATE (0xC1000009L) -#define STOR_STATUS_INVALID_BUFFER_SIZE (0xC100000AL) -#define STOR_STATUS_UNSUPPORTED_VERSION (0xC100000BL) - -// -// Port driver error codes -// - -#define SP_BUS_PARITY_ERROR 0x0001 -#define SP_UNEXPECTED_DISCONNECT 0x0002 -#define SP_INVALID_RESELECTION 0x0003 -#define SP_BUS_TIME_OUT 0x0004 -#define SP_PROTOCOL_ERROR 0x0005 -#define SP_INTERNAL_ADAPTER_ERROR 0x0006 -#define SP_REQUEST_TIMEOUT 0x0007 -#define SP_IRQ_NOT_RESPONDING 0x0008 -#define SP_BAD_FW_WARNING 0x0009 -#define SP_BAD_FW_ERROR 0x000a -#define SP_LOST_WMI_MINIPORT_REQUEST 0x000b - -// -// Port driver version flags -// -#define SP_VER_TRACE_SUPPORT 0x0010 - -// -// Return values for SCSI_HW_FIND_ADAPTER. -// - -#define SP_RETURN_NOT_FOUND 0 -#define SP_RETURN_FOUND 1 -#define SP_RETURN_ERROR 2 -#define SP_RETURN_BAD_CONFIG 3 - -// -// Notification Event Types -// - -typedef enum _SCSI_NOTIFICATION_TYPE { - RequestComplete, - NextRequest, - NextLuRequest, - ResetDetected, - _obsolete1, // STORPORT: CallDisableInterrupts has been removed - _obsolete2, // STORPORT: CallEnableInterrupts has been removed - RequestTimerCall, - BusChangeDetected, - WMIEvent, - WMIReregister, - LinkUp, - LinkDown, - QueryTickCount, - BufferOverrunDetected, - TraceNotification, - GetExtendedFunctionTable, - - EnablePassiveInitialization = 0x1000, - InitializeDpc, - IssueDpc, - AcquireSpinLock, - ReleaseSpinLock - -} SCSI_NOTIFICATION_TYPE, *PSCSI_NOTIFICATION_TYPE; - -// -// Structure passed between miniport initialization -// and SCSI port initialization -// - -typedef struct _HW_INITIALIZATION_DATA { - - ULONG HwInitializationDataSize; - - // - // Adapter interface type: - // - // Internal - // Isa - // Eisa - // MicroChannel - // TurboChannel - // PCIBus - // VMEBus - // NuBus - // PCMCIABus - // CBus - // MPIBus - // MPSABus - // - - INTERFACE_TYPE AdapterInterfaceType; - - // - // Miniport driver routines - // - - PHW_INITIALIZE HwInitialize; - - PHW_STARTIO HwStartIo; - - PHW_INTERRUPT HwInterrupt; - - PHW_FIND_ADAPTER HwFindAdapter; - - PHW_RESET_BUS HwResetBus; - - PHW_DMA_STARTED HwDmaStarted; - - PHW_ADAPTER_STATE HwAdapterState; - - // - // Miniport driver resources - // - - ULONG DeviceExtensionSize; - - ULONG SpecificLuExtensionSize; - - ULONG SrbExtensionSize; - - ULONG NumberOfAccessRanges; - - PVOID Reserved; - - // - // Data buffers must be mapped into virtual address space. - // - - UCHAR MapBuffers; - - // - // The driver will need to tranlate virtual to physical addresses. - // - - BOOLEAN NeedPhysicalAddresses; - - // - // Supports tagged queuing - // - - BOOLEAN TaggedQueuing; - - // - // Supports auto request sense. - // - - BOOLEAN AutoRequestSense; - - // - // Supports multiple requests per logical unit. - // - - BOOLEAN MultipleRequestPerLu; - - // - // Support receive event function. - // - - BOOLEAN ReceiveEvent; - - // - // Vendor identification length - // - - USHORT VendorIdLength; - - // - // Vendor identification - // - - PVOID VendorId; - - // - // Pad for alignment and future use. - // - - union { - - USHORT ReservedUshort; - - // - // Flags to indicate supported features - // - USHORT PortVersionFlags; - }; - - // - // Device identification length - // - - USHORT DeviceIdLength; - - // - // Device identification - // - - PVOID DeviceId; - - // - // Stop adapter routine. - // - - PHW_ADAPTER_CONTROL HwAdapterControl; - - // - // Initialize to the Build IO routine if one is supported, otherwise - // should be NULL. - // - - PHW_BUILDIO HwBuildIo; // STORPORT New - -} HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA; - - -// Virtual driver HW_INIT_DATA -typedef -VOID -(*PHW_FREE_ADAPTER_RESOURCES) ( - __in PVOID DeviceExtension - ); - -typedef -VOID -(*PHW_PROCESS_SERVICE_REQUEST) ( - __in PVOID DeviceExtension, - __in PVOID Irp - ); - -typedef -VOID -(*PHW_COMPLETE_SERVICE_IRP) ( - __in PVOID DeviceExtension - ); - -typedef -VOID -(*PHW_INITIALIZE_TRACING) ( - __in PVOID Arg1, - __in PVOID Arg2 - ); - -typedef -VOID -(*PHW_CLEANUP_TRACING) ( - __in PVOID Arg1 - ); -typedef -ULONG -(*PVIRTUAL_HW_FIND_ADAPTER) ( - __in PVOID DeviceExtension, - __in PVOID HwContext, - __in PVOID BusInformation, - __in PVOID LowerDevice, - __in PCHAR ArgumentString, - __inout PPORT_CONFIGURATION_INFORMATION ConfigInfo, - __out PBOOLEAN Again - ); - -typedef struct _VIRTUAL_HW_INITIALIZATION_DATA { - - ULONG HwInitializationDataSize; - - // - // Adapter interface type: - // - // Internal - // Isa - // Eisa - // MicroChannel - // TurboChannel - // PCIBus - // VMEBus - // NuBus - // PCMCIABus - // CBus - // MPIBus - // MPSABus - // - - INTERFACE_TYPE AdapterInterfaceType; - - // - // Miniport driver routines - // - - PHW_INITIALIZE HwInitialize; - - PHW_STARTIO HwStartIo; - - PHW_INTERRUPT HwInterrupt; - - PVIRTUAL_HW_FIND_ADAPTER HwFindAdapter; - - PHW_RESET_BUS HwResetBus; - - PHW_DMA_STARTED HwDmaStarted; - - PHW_ADAPTER_STATE HwAdapterState; - - // - // Miniport driver resources - // - - ULONG DeviceExtensionSize; - - ULONG SpecificLuExtensionSize; - - ULONG SrbExtensionSize; - - ULONG NumberOfAccessRanges; - - PVOID Reserved; - - // - // Data buffers must be mapped into virtual address space. - // - - UCHAR MapBuffers; - - // - // The driver will need to tranlate virtual to physical addresses. - // - - BOOLEAN NeedPhysicalAddresses; - - // - // Supports tagged queuing - // - - BOOLEAN TaggedQueuing; - - // - // Supports auto request sense. - // - - BOOLEAN AutoRequestSense; - - // - // Supports multiple requests per logical unit. - // - - BOOLEAN MultipleRequestPerLu; - - // - // Support receive event function. - // - - BOOLEAN ReceiveEvent; - - // - // Vendor identification length - // - - USHORT VendorIdLength; - - // - // Vendor identification - // - - PVOID VendorId; - - // - // Pad for alignment and future use. - // - - union { - - USHORT ReservedUshort; - - // - // Flags to indicate supported features - // - USHORT PortVersionFlags; - }; - - // - // Device identification length - // - - USHORT DeviceIdLength; - - // - // Device identification - // - - PVOID DeviceId; - - // - // Stop adapter routine. - // - - PHW_ADAPTER_CONTROL HwAdapterControl; - - // - // Initialize to the Build IO routine if one is supported, otherwise - // should be NULL. - // - - PHW_BUILDIO HwBuildIo; // STORPORT New - - PHW_FREE_ADAPTER_RESOURCES HwFreeAdapterResources; - - PHW_PROCESS_SERVICE_REQUEST HwProcessServiceRequest; - - PHW_COMPLETE_SERVICE_IRP HwCompleteServiceIrp; - - // - // Functions for enabling tracing in miniport - // - PHW_INITIALIZE_TRACING HwInitializeTracing; - PHW_CLEANUP_TRACING HwCleanupTracing; - - - -} VIRTUAL_HW_INITIALIZATION_DATA, *PVIRTUAL_HW_INITIALIZATION_DATA; - -#define DUMP_MINIPORT_VERSION_1 0x0100 -#define DUMP_MINIPORT_VERSION 0x0200 -#define DUMP_MINIPORT_NAME_LENGTH 15 - -typedef struct _MINIPORT_MAPPINGS { - - // - // Structure version - // - USHORT Version; - - // Pointer to iBF Table - // - PVOID IBFTable; - - // - // Pointer to Nic0 memory map. - // - PVOID Nic0Map; - - // - // Pointer to Nic1 memory map. - // - PVOID Nic1Map; - - // - // Number of additional NICs. - // - ULONG NumberOfAdditionalNic; - - // - // Pointer to memory Map for additional NICs bounded by the number in - // NumberOfAdditionalNic; - // - PVOID NicMap[]; - -} MINIPORT_MAPPINGS, *PMINIPORT_MAPPINGS; - - - - -typedef struct _MINIPORT_DUMP_POINTERS { - - // - // Structure version - // - USHORT Version; - - // - // Structure size - // - USHORT Size; - - // - // Dump miniport name - // - WCHAR DriverName[DUMP_MINIPORT_NAME_LENGTH]; - - // - // Pointer to the DMA adapter object - // - - struct _ADAPTER_OBJECT *AdapterObject; - - // - // Register base - // - PVOID MappedRegisterBase; - - // - // Common buffer size, must be <= 64KB - // - ULONG CommonBufferSize; - - // - // Pointer which is passed to dump driver through port configuration. - // - PVOID MiniportPrivateDumpData; - - // - // The following members are part of the - // PORT_CONFIGURATION_INFORMATION structure - // - - ULONG SystemIoBusNumber; - - INTERFACE_TYPE AdapterInterfaceType; - - ULONG MaximumTransferLength; - - ULONG NumberOfPhysicalBreaks; - - ULONG AlignmentMask; - - ULONG NumberOfAccessRanges; - - ACCESS_RANGE (*AccessRanges)[]; - - UCHAR NumberOfBuses; - - BOOLEAN Master; - - BOOLEAN MapBuffers; - - UCHAR MaximumNumberOfTargets; - -} MINIPORT_DUMP_POINTERS, *PMINIPORT_DUMP_POINTERS; - - - -// -// Structure used with StorPortLogSystemEvent -// (and related definitions) -// -// The structure should be zeroed before use to enable future expansion -// and backward compatability. The low byte of the interface revision is used to distinguish -// between minor changes in the interface that are still backward compatible. -// - -#define STOR_CURRENT_LOG_INTERFACE_REVISION 0x0100 - -typedef enum _STOR_EVENT_ASSOCIATION_ENUM { - StorEventAdapterAssociation = 0, // Event is associated with the adapter - StorEventLunAssociation, // Event is associated with the LUN - StorEventTargetAssociation, // Event is associated with the target - StorEventInvalidAssociation // Marks end of valid enumeration range -} STOR_EVENT_ASSOCIATION_ENUM; - -typedef struct _STOR_LOG_EVENT_DETAILS { - ULONG InterfaceRevision; // Revision of this interface (use STOR_CURRENT_LOG_INTERFACE_REVISION) - ULONG Size; // Size of this structure (fill in before passing to Storport) - ULONG Flags; // Special flags to control this interface (none currently defined) - STOR_EVENT_ASSOCIATION_ENUM EventAssociation; // See STOR_EVENT_ASSOCIATION_ENUM enumeration - ULONG PathId; // Path portion of SCSI address - ULONG TargetId; // Target portion of SCSI address - ULONG LunId; // LUN portion of SCSI address - BOOLEAN StorportSpecificErrorCode; // TRUE if error code is specific to Storport (SP_xxx) - ULONG ErrorCode; // Error code, either SP_xxx or standard NTSTATUS code - ULONG UniqueId; // Often used to indicate the location of the error - ULONG DumpDataSize; // Size in bytes of private data block - PVOID DumpData; // Private data block - ULONG StringCount; // Count of NUL-terminated Unicode strings - PWSTR * StringList; // Unicode strings used for substitution within log messages (%2, %3, %4...) -} STOR_LOG_EVENT_DETAILS, *PSTOR_LOG_EVENT_DETAILS; - - - -typedef -BOOLEAN -(*PSTOR_SYNCHRONIZED_ACCESS)( - __in PVOID HwDeviceExtension, - __in PVOID Context - ); - - -#ifndef _NTDDK_ -#define STORPORT_API DECLSPEC_IMPORT -#else -#define STORPORT_API -#endif - -// -// Port driver routines called by miniport driver -// - -STORPORT_API -ULONG -StorPortInitialize( - __in PVOID Argument1, - __in PVOID Argument2, - __in struct _HW_INITIALIZATION_DATA *HwInitializationData, - __in_opt PVOID HwContext - ); - -STORPORT_API -VOID -StorPortFreeDeviceBase( - __in PVOID HwDeviceExtension, - __in PVOID MappedAddress - ); - -STORPORT_API -ULONG -StorPortGetBusData( - __in PVOID DeviceExtension, - __in ULONG BusDataType, - __in ULONG SystemIoBusNumber, - __in ULONG SlotNumber, - __inout __drv_when(Length!=0, __bcount(Length)) - PVOID Buffer, - __in ULONG Length - ); - -STORPORT_API -ULONG -StorPortSetBusDataByOffset( - __in PVOID DeviceExtension, - __in ULONG BusDataType, - __in ULONG SystemIoBusNumber, - __in ULONG SlotNumber, - __in_bcount(Length) PVOID Buffer, - __in ULONG Offset, - __in ULONG Length - ); - -STORPORT_API -PVOID -StorPortGetDeviceBase( - __in PVOID HwDeviceExtension, - __in INTERFACE_TYPE BusType, - __in ULONG SystemIoBusNumber, - __in STOR_PHYSICAL_ADDRESS IoAddress, - __in ULONG NumberOfBytes, - __in BOOLEAN InIoSpace - ); - -STORPORT_API -PVOID -StorPortGetLogicalUnit( - __in PVOID HwDeviceExtension, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun - ); - -STORPORT_API -PSTOR_SCATTER_GATHER_LIST -StorPortGetScatterGatherList( - __in PVOID HwDeviceExtension, - __in PSCSI_REQUEST_BLOCK Srb - ); - -STORPORT_API -STOR_PHYSICAL_ADDRESS -StorPortGetPhysicalAddress( - __in PVOID HwDeviceExtension, - __in_opt PSCSI_REQUEST_BLOCK Srb, - __in PVOID VirtualAddress, - __out ULONG *Length - ); - -STORPORT_API -PVOID -StorPortGetVirtualAddress( - __in PVOID HwDeviceExtension, - __in STOR_PHYSICAL_ADDRESS PhysicalAddress - ); - -STORPORT_API -PVOID -StorPortGetUncachedExtension( - __in PVOID HwDeviceExtension, - __in PPORT_CONFIGURATION_INFORMATION ConfigInfo, - __in ULONG NumberOfBytes - ); - -STORPORT_API -BOOLEAN -StorPortPauseDevice( - __in PVOID HwDeviceExtension, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun, - __in ULONG Timeout - ); - -STORPORT_API -BOOLEAN -StorPortResumeDevice( - __in PVOID HwDeviceExtension, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun - ); - -STORPORT_API -BOOLEAN -StorPortPause( - __in PVOID HwDeviceExtension, - __in ULONG Timeout - ); - -STORPORT_API -BOOLEAN -StorPortResume( - __in PVOID HwDeviceExtension - ); - -STORPORT_API -BOOLEAN -StorPortDeviceBusy( - __in PVOID HwDeviceExtension, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun, - __in ULONG RequestsToComplete - ); - -STORPORT_API -BOOLEAN -StorPortDeviceReady( - __in PVOID HwDeviceExtension, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun - ); - -STORPORT_API -BOOLEAN -StorPortBusy( - __in PVOID HwDeviceExtension, - __in ULONG RequestsToComplete - ); - -STORPORT_API -BOOLEAN -StorPortReady( - __in PVOID HwDeviceExtension - ); - -STORPORT_API -BOOLEAN -StorPortSetDeviceQueueDepth( - __in PVOID HwDeviceExtension, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun, - __in ULONG Depth - ); - -STORPORT_API -VOID -StorPortNotification( - __in SCSI_NOTIFICATION_TYPE NotificationType, - __in PVOID HwDeviceExtension, - ... - ); - -STORPORT_API -VOID -StorPortLogError( - __in PVOID HwDeviceExtension, - __in_opt PSCSI_REQUEST_BLOCK Srb, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun, - __in ULONG ErrorCode, - __in ULONG UniqueId - ); - -STORPORT_API -VOID -StorPortCompleteRequest( - __in PVOID HwDeviceExtension, - __in UCHAR PathId, - __in UCHAR TargetId, - __in UCHAR Lun, - __in UCHAR SrbStatus - ); - -STORPORT_API -VOID -StorPortStallExecution( - __in ULONG Delay - ); - -STORPORT_API -BOOLEAN -StorPortSynchronizeAccess( - __in PVOID HwDeviceExtension, - __in PSTOR_SYNCHRONIZED_ACCESS SynchronizedAccessRoutine, - __in_opt PVOID Context - ); - -#if defined(_M_AMD64) - -#define StorPortReadPortUchar(h, p) READ_PORT_UCHAR(p) -#define StorPortReadPortUshort(h, p) READ_PORT_USHORT(p) -#define StorPortReadPortUlong(h, p) READ_PORT_ULONG(p) - -#define StorPortReadPortBufferUchar(h, p, b, c) READ_PORT_BUFFER_UCHAR(p, b, c) -#define StorPortReadPortBufferUshort(h, p, b, c) READ_PORT_BUFFER_USHORT(p, b, c) -#define StorPortReadPortBufferUlong(h, p, b, c) READ_PORT_BUFFER_ULONG(p, b, c) - -#define StorPortReadRegisterUchar(h, r) READ_REGISTER_UCHAR(r) -#define StorPortReadRegisterUshort(h, r) READ_REGISTER_USHORT(r) -#define StorPortReadRegisterUlong(h, r) READ_REGISTER_ULONG(r) - -#define StorPortReadRegisterBufferUchar(h, r, b, c) READ_REGISTER_BUFFER_UCHAR(r, b, c) -#define StorPortReadRegisterBufferUshort(h, r, b, c) READ_REGISTER_BUFFER_USHORT(r, b, c) -#define StorPortReadRegisterBufferUlong(h, r, b, c) READ_REGISTER_BUFFER_ULONG(r, b, c) - -#define StorPortWritePortUchar(h, p, v) WRITE_PORT_UCHAR(p, v) -#define StorPortWritePortUshort(h, p, v) WRITE_PORT_USHORT(p, v) -#define StorPortWritePortUlong(h, p, v) WRITE_PORT_ULONG(p, v) - -#define StorPortWritePortBufferUchar(h, p, b, c) WRITE_PORT_BUFFER_UCHAR(p, b, c) -#define StorPortWritePortBufferUshort(h, p, b, c) WRITE_PORT_BUFFER_USHORT(p, b, c) -#define StorPortWritePortBufferUlong(h, p, b, c) WRITE_PORT_BUFFER_ULONG(p, b, c) - -#define StorPortWriteRegisterUchar(h, r, v) WRITE_REGISTER_UCHAR(r, v) -#define StorPortWriteRegisterUshort(h, r, v) WRITE_REGISTER_USHORT(r, v) -#define StorPortWriteRegisterUlong(h, r, v) WRITE_REGISTER_ULONG(r, v) - -#define StorPortWriteRegisterBufferUchar(h, r, b, c) WRITE_REGISTER_BUFFER_UCHAR(r, b, c) -#define StorPortWriteRegisterBufferUshort(h, r, b, c) WRITE_REGISTER_BUFFER_USHORT(r, b, c) -#define StorPortWriteRegisterBufferUlong(h, r, b, c) WRITE_REGISTER_BUFFER_ULONG(r, b, c) - -#define StorPortMoveMemory memmove - -#else - -STORPORT_API -UCHAR -StorPortReadPortUchar( - __in PVOID HwDeviceExtension, - __in PUCHAR Port - ); - -STORPORT_API -USHORT -StorPortReadPortUshort( - __in PVOID HwDeviceExtension, - __in PUSHORT Port - ); - -STORPORT_API -ULONG -StorPortReadPortUlong( - __in PVOID HwDeviceExtension, - __in PULONG Port - ); - -STORPORT_API -VOID -StorPortReadPortBufferUchar( - __in PVOID HwDeviceExtension, - __in PUCHAR Port, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ); - -STORPORT_API -VOID -StorPortReadPortBufferUshort( - __in PVOID HwDeviceExtension, - __in PUSHORT Port, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ); - -STORPORT_API -VOID -StorPortReadPortBufferUlong( - __in PVOID HwDeviceExtension, - __in PULONG Port, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ); - -STORPORT_API -UCHAR -StorPortReadRegisterUchar( - __in PVOID HwDeviceExtension, - __in PUCHAR Register - ); - -STORPORT_API -USHORT -StorPortReadRegisterUshort( - __in PVOID HwDeviceExtension, - __in PUSHORT Register - ); - -STORPORT_API -ULONG -StorPortReadRegisterUlong( - __in PVOID HwDeviceExtension, - __in PULONG Register - ); - -STORPORT_API -VOID -StorPortReadRegisterBufferUchar( - __in PVOID HwDeviceExtension, - __in PUCHAR Register, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ); - -STORPORT_API -VOID -StorPortReadRegisterBufferUshort( - __in PVOID HwDeviceExtension, - __in PUSHORT Register, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ); - -STORPORT_API -VOID -StorPortReadRegisterBufferUlong( - __in PVOID HwDeviceExtension, - __in PULONG Register, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ); - -STORPORT_API -VOID -StorPortWritePortUchar( - __in PVOID HwDeviceExtension, - __in PUCHAR Port, - __in UCHAR Value - ); - -STORPORT_API -VOID -StorPortWritePortUshort( - __in PVOID HwDeviceExtension, - __in PUSHORT Port, - __in USHORT Value - ); - -STORPORT_API -VOID -StorPortWritePortUlong( - __in PVOID HwDeviceExtension, - __in PULONG Port, - __in ULONG Value - ); - -STORPORT_API -VOID -StorPortWritePortBufferUchar( - __in PVOID HwDeviceExtension, - __in PUCHAR Port, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ); - -STORPORT_API -VOID -StorPortWritePortBufferUshort( - __in PVOID HwDeviceExtension, - __in PUSHORT Port, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ); - -STORPORT_API -VOID -StorPortWritePortBufferUlong( - __in PVOID HwDeviceExtension, - __in PULONG Port, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ); - -STORPORT_API -VOID -StorPortWriteRegisterUchar( - __in PVOID HwDeviceExtension, - __in PUCHAR Register, - __in UCHAR Value - ); - -STORPORT_API -VOID -StorPortWriteRegisterUshort( - __in PVOID HwDeviceExtension, - __in PUSHORT Register, - __in USHORT Value - ); - -STORPORT_API -VOID -StorPortWriteRegisterUlong( - __in PVOID HwDeviceExtension, - __in PULONG Register, - __in ULONG Value - ); - -STORPORT_API -VOID -StorPortWriteRegisterBufferUchar( - __in PVOID HwDeviceExtension, - __in PUCHAR Register, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ); - -STORPORT_API -VOID -StorPortWriteRegisterBufferUshort( - __in PVOID HwDeviceExtension, - __in PUSHORT Register, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ); - -STORPORT_API -VOID -StorPortWriteRegisterBufferUlong( - __in PVOID HwDeviceExtension, - __in PULONG Register, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ); - -STORPORT_API -VOID -StorPortMoveMemory( - __in_bcount(Length) PVOID WriteBuffer, - __in_bcount(Length) PVOID ReadBuffer, - __in ULONG Length - ); - - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -#pragma intrinsic (memcpy) - -#define StorPortCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length)) -#endif - -STORPORT_API -STOR_PHYSICAL_ADDRESS -StorPortConvertUlongToPhysicalAddress( - __in ULONG_PTR UlongAddress - ); - -STORPORT_API -ULONG -StorPortConvertPhysicalAddressToUlong( - __in STOR_PHYSICAL_ADDRESS Address - ); - -STORPORT_API -VOID -StorPortQuerySystemTime( - __out PLARGE_INTEGER CurrentTime - ); - -#define StorPortConvertPhysicalAddressToUlong(Address) ((Address).LowPart) -#define StorPortConvertPhysicalAddressToULong64(Address) ((Address).QuadPart) - -#define MINIPORT_REG_SZ 1 -#define MINIPORT_REG_BINARY 3 -#define MINIPORT_REG_DWORD 4 - -__drv_allocatesMem(Mem) -__bcount(Length) -STORPORT_API -PUCHAR -StorPortAllocateRegistryBuffer( - __in PVOID HwDeviceExtension, - __in PULONG Length - ); - - -STORPORT_API -VOID -StorPortFreeRegistryBuffer( - __in PVOID HwDeviceExtension, - __in __drv_freesMem(Mem) PUCHAR Buffer - ); - -BOOLEAN -StorPortRegistryRead( - __in PVOID HwDeviceExtension, - __in PUCHAR ValueName, - __in ULONG Global, - __in ULONG Type, - __out PUCHAR Buffer, - __inout PULONG BufferLength - ); - -STORPORT_API -BOOLEAN -StorPortRegistryWrite( - __in PVOID HwDeviceExtension, - __in PUCHAR ValueName, - __in ULONG Global, - __in ULONG Type, - __in_bcount(BufferLength) PUCHAR Buffer, - __in ULONG BufferLength - ); - -__drv_preferredFunction("(see documentation)", "Obsolete") -STORPORT_API -BOOLEAN -StorPortValidateRange( - __in PVOID HwDeviceExtension, - __in INTERFACE_TYPE BusType, - __in ULONG SystemIoBusNumber, - __in STOR_PHYSICAL_ADDRESS IoAddress, - __in ULONG NumberOfBytes, - __in BOOLEAN InIoSpace - ); - -STORPORT_API -VOID -StorPortDebugPrint( - __in ULONG DebugPrintLevel, - __in PCCHAR DebugMessage, - ... - ); - -BOOLEAN -FORCEINLINE -StorPortEnablePassiveInitialization( - __in PVOID DeviceExtension, - __in PHW_PASSIVE_INITIALIZE_ROUTINE HwPassiveInitializeRoutine - ) -{ - LONG Succ; - - Succ = FALSE; - StorPortNotification (EnablePassiveInitialization, - DeviceExtension, - HwPassiveInitializeRoutine, - &Succ); - - return (BOOLEAN)Succ; -} - -VOID -FORCEINLINE -StorPortInitializeDpc( - __in PVOID DeviceExtension, - __out PSTOR_DPC Dpc, - __in PHW_DPC_ROUTINE HwDpcRoutine - ) -{ - StorPortNotification (InitializeDpc, - DeviceExtension, - Dpc, - HwDpcRoutine); -} - -BOOLEAN -FORCEINLINE -StorPortIssueDpc( - __in PVOID DeviceExtension, - __in PSTOR_DPC Dpc, - __in PVOID SystemArgument1, - __in PVOID SystemArgument2 - ) -{ - LONG Succ; - - Succ = FALSE; - StorPortNotification (IssueDpc, - DeviceExtension, - Dpc, - SystemArgument1, - SystemArgument2, - &Succ); - return (BOOLEAN)Succ; -} - -// StorPortNotification is a polymorphic function that handles many different types of requests, -// making it difficult to annotate in a manner that would cover all possible uses. -// Because StorPortNotification returns VOID, the scanning engine should assume the LockHandle was acquired as asked. -// This assumption requires the suppressing the PFD warning generated (28104). -VOID -FORCEINLINE -StorPortAcquireSpinLock( - __in PVOID DeviceExtension, - __in STOR_SPINLOCK SpinLock, - __in PVOID LockContext, - __inout __deref __drv_acquiresExclusiveResource(LockHandle) - PSTOR_LOCK_HANDLE LockHandle - ) -#pragma warning (suppress: 28104) -{ - StorPortNotification (AcquireSpinLock, - DeviceExtension, - SpinLock, - LockContext, - LockHandle); -} - -VOID -FORCEINLINE -StorPortReleaseSpinLock( - __in PVOID DeviceExtension, - __inout __deref __drv_releasesExclusiveResource(LockHandle) - PSTOR_LOCK_HANDLE LockHandle - ) -{ - StorPortNotification (ReleaseSpinLock, - DeviceExtension, - LockHandle); -} - -STORPORT_API -ULONG -StorPortExtendedFunction( - __in STORPORT_FUNCTION_CODE FunctionCode, - __in PVOID HwDeviceExtension, - ... - ); - -ULONG -FORCEINLINE -StorPortAllocatePool( - __in PVOID HwDeviceExtension, - __in ULONG NumberOfBytes, - __in ULONG Tag, - __out __deref __drv_when(return!=0, __drv_valueIs(==0)) - __deref __drv_when(return==0, __drv_aliasesMem __drv_allocatesMem(Mem) __drv_valueIs(!=0) - __bcount(NumberOfBytes)) - PVOID *BufferPointer - ) -{ - return StorPortExtendedFunction(ExtFunctionAllocatePool, - HwDeviceExtension, - NumberOfBytes, - Tag, - BufferPointer); -} - -ULONG -FORCEINLINE -StorPortFreePool( - __in PVOID HwDeviceExtension, - __in __drv_freesMem(Mem) PVOID BufferPointer - ) -{ - return StorPortExtendedFunction(ExtFunctionFreePool, - HwDeviceExtension, - BufferPointer); -} - -ULONG -FORCEINLINE -StorPortAllocateMdl( - __in PVOID HwDeviceExtension, - __in_bcount(NumberOfBytes) PVOID BufferPointer, - __in ULONG NumberOfBytes, - __out __deref __drv_when(return!=0, __drv_valueIs(==0)) - __deref __drv_when(return==0, __drv_aliasesMem __drv_allocatesMem(Mem) __drv_valueIs(!=0)) - PVOID *Mdl - ) -{ - return StorPortExtendedFunction(ExtFunctionAllocateMdl, - HwDeviceExtension, - BufferPointer, - NumberOfBytes, - Mdl); -} - -ULONG -FORCEINLINE -StorPortFreeMdl( - __in PVOID HwDeviceExtension, - __in __drv_freesMem(Mem) PVOID Mdl - ) -{ - return StorPortExtendedFunction(ExtFunctionFreeMdl, - HwDeviceExtension, - Mdl); -} - -ULONG -FORCEINLINE -StorPortBuildMdlForNonPagedPool( - __in PVOID HwDeviceExtension, - __inout PVOID Mdl - ) -{ - return StorPortExtendedFunction(ExtFunctionBuildMdlForNonPagedPool, - HwDeviceExtension, - Mdl); -} - -ULONG -FORCEINLINE -StorPortGetSystemAddress( - __in PVOID HwDeviceExtension, - __in PSCSI_REQUEST_BLOCK Srb, - __deref_out PVOID *SystemAddress - ) -{ - return StorPortExtendedFunction(ExtFunctionGetSystemAddress, - HwDeviceExtension, - Srb, - SystemAddress); -} - -ULONG -FORCEINLINE -StorPortGetOriginalMdl( - __in PVOID HwDeviceExtension, - __in PSCSI_REQUEST_BLOCK Srb, - __deref_out PVOID *Mdl - ) -{ - return StorPortExtendedFunction(ExtFunctionGetOriginalMdl, - HwDeviceExtension, - Srb, - Mdl); -} - -ULONG -FORCEINLINE -StorPortCompleteServiceIrp( - __in PVOID HwDeviceExtension, - __in PVOID Irp - ) -{ - return StorPortExtendedFunction(ExtFunctionCompleteServiceIrp, - HwDeviceExtension, - Irp); -} - -ULONG -FORCEINLINE -StorPortGetDeviceObjects( - __in PVOID HwDeviceExtension, - __deref_out PVOID *AdapterDeviceObject, - __deref_out PVOID *PhysicalDeviceObject, - __deref_out PVOID *LowerDeviceObject - ) -{ - return StorPortExtendedFunction(ExtFunctionGetDeviceObjects, - HwDeviceExtension, - AdapterDeviceObject, - PhysicalDeviceObject, - LowerDeviceObject); -} - -ULONG -FORCEINLINE -StorPortBuildScatterGatherList( - __in PVOID HwDeviceExtension, - __in PVOID Mdl, - __in_bcount(Length) PVOID CurrentVa, - __in ULONG Length, - __in PpostScaterGatherExecute ExecutionRoutine, - __in PVOID Context, - __in BOOLEAN WriteToDevice, - __inout_bcount(ScatterGatherBufferLength) PVOID ScatterGatherBuffer, - __in ULONG ScatterGatherBufferLength - ) -{ - return StorPortExtendedFunction(ExtFunctionBuildScatterGatherList, - HwDeviceExtension, - Mdl, - CurrentVa, - Length, - ExecutionRoutine, - Context, - WriteToDevice, - ScatterGatherBuffer, - ScatterGatherBufferLength); -} - -ULONG -FORCEINLINE -StorPortPutScatterGatherList( - __in PVOID HwDeviceExtension, - __in PSTOR_SCATTER_GATHER_LIST ScatterGatherList, - __in BOOLEAN WriteToDevice - ) -{ - return StorPortExtendedFunction(ExtFunctionPutScatterGatherList, - HwDeviceExtension, - ScatterGatherList, - WriteToDevice); -} - -ULONG -FORCEINLINE -StorPortAcquireMSISpinLock( - __in PVOID HwDeviceExtension, - __in ULONG MessageId, - __in PULONG OldIrql - ) -{ - return StorPortExtendedFunction(ExtFunctionAcquireMSISpinLock, - HwDeviceExtension, - MessageId, - OldIrql); -} - -ULONG -FORCEINLINE -StorPortReleaseMSISpinLock( - __in PVOID HwDeviceExtension, - __in ULONG MessageId, - __in ULONG OldIrql - ) -{ - return StorPortExtendedFunction(ExtFunctionReleaseMSISpinLock, - HwDeviceExtension, - MessageId, - OldIrql); -} - -ULONG -FORCEINLINE -StorPortGetMSIInfo( - __in PVOID HwDeviceExtension, - __in ULONG MessageId, - __out PMESSAGE_INTERRUPT_INFORMATION InterruptInfo - ) -{ - return StorPortExtendedFunction(ExtFunctionGetMessageInterruptInformation, - HwDeviceExtension, - MessageId, - InterruptInfo); -} - -ULONG -FORCEINLINE -StorPortInitializePerfOpts( - __in PVOID HwDeviceExtension, - __in BOOLEAN Query, - __inout PPERF_CONFIGURATION_DATA PerfConfigData - ) -{ - return StorPortExtendedFunction(ExtFunctionInitializePerformanceOptimizations, - HwDeviceExtension, - Query, - PerfConfigData); -} - -ULONG -FORCEINLINE -StorPortGetStartIoPerfParams( - __in PVOID HwDeviceExtension, - __in PSCSI_REQUEST_BLOCK Srb, - __inout PSTARTIO_PERFORMANCE_PARAMETERS StartIoPerfParams - ) -{ - return StorPortExtendedFunction(ExtFunctionGetStartIoPerformanceParameters, - HwDeviceExtension, - Srb, - StartIoPerfParams); -} - -ULONG -FORCEINLINE -StorPortLogSystemEvent( - __in PVOID HwDeviceExtension, - __inout PSTOR_LOG_EVENT_DETAILS LogDetails, - __inout PULONG MaximumSize - ) -{ - return StorPortExtendedFunction(ExtFunctionLogSystemEvent, - HwDeviceExtension, - LogDetails, - MaximumSize); -} - -ULONG -FORCEINLINE -StorPortGetCurrentProcessorNumber ( - __in PVOID HwDeviceExtension, - __out PPROCESSOR_NUMBER ProcNumber - ) -{ - return StorPortExtendedFunction(ExtFunctionGetCurrentProcessorNumber, - HwDeviceExtension, - ProcNumber); -} - -ULONG -FORCEINLINE -StorPortGetGroupAffinity ( - __in PVOID HwDeviceExtension, - __in USHORT GroupNumber, - __out PKAFFINITY GroupAffinityMask - ) -{ - return StorPortExtendedFunction(ExtFunctionGetGroupAffinity, - HwDeviceExtension, - GroupNumber, - GroupAffinityMask); -} - -ULONG -FORCEINLINE -StorPortGetActiveGroupCount ( - __in PVOID HwDeviceExtension, - __out PUSHORT NumberGroups - ) -{ - return StorPortExtendedFunction(ExtFunctionGetActiveGroupCount, - HwDeviceExtension, - NumberGroups); -} - -ULONG -FORCEINLINE -StorPortGetNodeAffinity ( - __in PVOID HwDeviceExtension, - __in ULONG NodeNumber, - __out PGROUP_AFFINITY NodeAffinityMask - ) -{ - return StorPortExtendedFunction(ExtFunctionGetNodeAffinity, - HwDeviceExtension, - NodeNumber, - NodeAffinityMask); -} - -ULONG -FORCEINLINE -StorPortGetActiveNodeCount ( - __in PVOID HwDeviceExtension, - __out PULONG NumberNodes - ) -{ - return StorPortExtendedFunction(ExtFunctionGetActiveNodeCount, - HwDeviceExtension, - NumberNodes); -} - -ULONG -FORCEINLINE -StorPortGetHighestNodeNumber ( - __in PVOID HwDeviceExtension, - __out PULONG HighestNode - ) -{ - return StorPortExtendedFunction(ExtFunctionGetHighestNodeNumber, - HwDeviceExtension, - HighestNode); -} - -__drv_maxIRQL(DISPATCH_LEVEL) -ULONG -FORCEINLINE -StorPortGetLogicalProcessorRelationship ( - __in PVOID HwDeviceExtension, - __in_opt PPROCESSOR_NUMBER ProcessorNumber, - __in LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType, - __out_bcount(*Length) PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Information, - __inout PULONG Length - ) -{ - return StorPortExtendedFunction(ExtFunctionGetLogicalProcessorRelationship, - HwDeviceExtension, - ProcessorNumber, - RelationshipType, - Information, - Length); -} - -__drv_maxIRQL(DISPATCH_LEVEL) -ULONG -FORCEINLINE -StorPortAllocateContiguousMemorySpecifyCacheNode ( - __in PVOID HwDeviceExtension, - __in SIZE_T NumberOfBytes, - __in PHYSICAL_ADDRESS LowestAcceptableAddress, - __in PHYSICAL_ADDRESS HighestAcceptableAddress, - __in_opt PHYSICAL_ADDRESS BoundaryAddressMultiple, - __in MEMORY_CACHING_TYPE CacheType, - __in NODE_REQUIREMENT PreferredNode, - __out PVOID* BufferPointer - ) -{ - return StorPortExtendedFunction(ExtFunctionAllocateContiguousMemorySpecifyCacheNode, - HwDeviceExtension, - NumberOfBytes, - LowestAcceptableAddress, - HighestAcceptableAddress, - BoundaryAddressMultiple, - CacheType, - PreferredNode, - BufferPointer); -} - -ULONG -FORCEINLINE -StorPortFreeContiguousMemorySpecifyCache ( - __in PVOID HwDeviceExtension, - __in_bcount (NumberOfBytes) PVOID BaseAddress, - __in SIZE_T NumberOfBytes, - __in MEMORY_CACHING_TYPE CacheType - ) -{ - return StorPortExtendedFunction(ExtFunctionFreeContiguousMemorySpecifyCache, - HwDeviceExtension, - BaseAddress, - NumberOfBytes, - CacheType); -} - -// -// Include SCSIPORT definitions for backwards compatability. -// - -#if defined (STOR_USE_SCSI_ALIASES) - -#define ScsiPortInitialize StorPortInitialize -#define ScsiPortFreeDeviceBase StorPortFreeDeviceBase -#define ScsiPortGetBusData StorPortGetBusData -#define ScsiPortSetBusDataByOffset StorPortSetBusDataByOffset -#define ScsiPortGetDeviceBase StorPortGetDeviceBase -#define ScsiPortGetLogicalUnit StorPortGetLogicalUnit -#define ScsiPortGetSrb StorPortGetSrb -#define ScsiPortGetPhysicalAddress StorPortGetPhysicalAddress -#define ScsiPortGetVirtualAddress StorPortGetVirtualAddress -#define ScsiPortGetUncachedExtension StorPortGetUncachedExtension -#define ScsiPortFlushDma StorPortFlushDma -#define ScsiPortIoMapTransfer StorPortIoMapTransfer -#define ScsiPortNotification StorPortNotification -#define ScsiPortLogError StorPortLogError -#define ScsiPortCompleteRequest StorPortCompleteRequest -#define ScsiPortMoveMemory StorPortMoveMemory -#define ScsiPortReadPortUchar(Port) StorPortReadPortUchar(NULL, Port) -#define ScsiPortReadPortUshort(Port) StorPortReadPortUshort(NULL, Port) -#define ScsiPortReadPortUlong(Port) StorPortReadPortUlong(NULL, Port) -#define ScsiPortReadPortBufferUchar(Port, Buffer, Count) StorPortReadPortBufferUchar(NULL, Port, Buffer, Count) -#define ScsiPortReadPortBufferUshort(Port, Buffer, Count) StorPortReadPortBufferUshort(NULL, Port, Buffer, Count) -#define ScsiPortReadPortBufferUlong(Port, Buffer, Count) StorPortReadPortBufferUlong(NULL, Port, Buffer, Count) -#define ScsiPortReadRegisterUchar(Register) StorPortReadRegisterUchar(NULL, Register) -#define ScsiPortReadRegisterUshort(Register) StorPortReadRegisterUshort(NULL, Register) -#define ScsiPortReadRegisterUlong(Register) StorPortReadRegisterUlong(NULL, Register) -#define ScsiPortReadRegisterBufferUchar(Register, Buffer, Count) StorPortReadRegisterBufferUchar(NULL, Register, Buffer, Count) -#define ScsiPortReadRegisterBufferUshort(Register, Buffer, Count) StorPortReadRegisterBufferUshort(NULL, Register, Buffer, Count) -#define ScsiPortReadRegisterBufferUlong(Register, Buffer, Count) StorPortReadRegisterBufferUlong(NULL, Register, Buffer, Count) -#define ScsiPortStallExecution StorPortStallExecution -#define ScsiPortWritePortUchar(Port, Value) StorPortWritePortUchar(NULL, Port, Value) -#define ScsiPortWritePortUshort(Port, Value) StorPortWritePortUshort(NULL, Port, Value) -#define ScsiPortWritePortUlong(Port, Value) StorPortWritePortUlong(NULL, Port, Value) -#define ScsiPortWritePortBufferUchar(Port, Buffer, Count) StorPortWritePortBufferUchar(NULL, Port, Buffer, Count) -#define ScsiPortWritePortBufferUshort(Port, Buffer, Count) StorPortWritePortBufferUshort(NULL, Port, Buffer, Count) -#define ScsiPortWritePortBufferUlong(Port, Buffer, Count) StorPortWritePortBufferUlong(NULL, Port, Buffer, Count) -#define ScsiPortWriteRegisterUchar(Register, Value) StorPortWriteRegisterUchar(NULL, Register, Value) -#define ScsiPortWriteRegisterUshort(Register, Value) StorPortWriteRegisterUshort(NULL, Register, Value) -#define ScsiPortWriteRegisterUlong(Register, Value) StorPortWriteRegisterUlong(NULL, Register, Value) -#define ScsiPortWriteRegisterBufferUchar(Register, Buffer, Count) StorPortWriteRegisterBufferUchar(NULL, Register, Buffer, Count) -#define ScsiPortWriteRegisterBufferUshort(Register, Buffer, Count) StorPortWriteRegisterBufferUshort(NULL, Register, Buffer, Count) -#define ScsiPortWriteRegisterBufferUlong(Register, Buffer, Count) StorPortWriteRegisterBufferUlong(NULL, Register, Buffer, Count) -#define ScsiPortConvertUlongToPhysicalAddress StorPortConvertUlongToPhysicalAddress -#define ScsiPortConvertPhysicalAddressToUlong StorPortConvertPhysicalAddressToUlong -#define ScsiPortQuerySystemTime StorPortQuerySystemTime -#define ScsiPortValidateRange StorPortValidateRange -#define ScsiDebugPrint StorPortDebugPrint - -typedef PHYSICAL_ADDRESS SCSI_PHYSICAL_ADDRESS, *PSCSI_PHYSICAL_ADDRESS; - -#endif // STOR_USE_SCSI_ALIASES - - -#if _MSC_VER >= 1200 -#pragma warning(pop) // un-sets any local warning changes -#else -#pragma warning(default:4200) // array[0] is not a warning for this file -#pragma warning(default:4201) // nonstandard extension used : nameless struct/union -#pragma warning(default:4214) // nonstandard extension used : bit field types other than int -#endif - -#endif // !defined _NTSTORPORT_ - diff --git a/pub/ddk/storswtr.h b/pub/ddk/storswtr.h deleted file mode 100644 index 3c1e7d5..0000000 --- a/pub/ddk/storswtr.h +++ /dev/null @@ -1,199 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - - 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. - -Module Name: - - storswtr.h - -Abstract: - - Software Tracing for Storage Drivers - -Environment: - - Kernel mode - - ---*/ - -#ifndef _stortrce_h_ -#define _stortrce_h_ - -#include - -// -// Ensure error level constants are defined correctly -// -#ifdef TRACE_LEVEL_FATAL -#undef TRACE_LEVEL_FATAL -#endif - -#ifdef TRACE_LEVEL_ERROR -#undef TRACE_LEVEL_ERROR -#endif - -#ifdef TRACE_LEVEL_WARNING -#undef TRACE_LEVEL_WARNING -#endif - -#ifdef TRACE_LEVEL_INFORMATION -#undef TRACE_LEVEL_INFORMATION -#endif - -#ifdef TRACE_LEVEL_VERBOSE -#undef TRACE_LEVEL_VERBOSE -#endif - -// -// Error level codes -// -#define TRACE_LEVEL_FATAL 1 -#define TRACE_LEVEL_ERROR 2 -#define TRACE_LEVEL_WARNING 3 -#define TRACE_LEVEL_INFORMATION 4 -#define TRACE_LEVEL_VERBOSE 5 - -// -// DEBUG_USE_KDPRINT: if defined, uses KdPrint instead of WMI tracing -// -#ifndef DEBUG_USE_KDPRINT - -// -// Defines standard flag bits for all storage drivers -// -#define WPP_NORMAL_FLAGS WPP_DEFINE_BIT(TRACE_FLAG_GENERAL) \ - WPP_DEFINE_BIT(TRACE_FLAG_PNP) \ - WPP_DEFINE_BIT(TRACE_FLAG_POWER) \ - WPP_DEFINE_BIT(TRACE_FLAG_RW) \ - WPP_DEFINE_BIT(TRACE_FLAG_IOCTL) \ - WPP_DEFINE_BIT(TRACE_FLAG_QUEUE) \ - WPP_DEFINE_BIT(TRACE_FLAG_WMI) \ - WPP_DEFINE_BIT(TRACE_FLAG_TIMER) \ - WPP_DEFINE_BIT(TRACE_FLAG_INIT) \ - WPP_DEFINE_BIT(TRACE_FLAG_LOCK) \ - WPP_DEFINE_BIT(TRACE_FLAG_DEBUG1) \ - WPP_DEFINE_BIT(TRACE_FLAG_DEBUG2) \ - WPP_DEFINE_BIT(TRACE_FLAG_MCN) \ - WPP_DEFINE_BIT(TRACE_FLAG_ISR) \ - WPP_DEFINE_BIT(TRACE_FLAG_ENUM) \ - WPP_DEFINE_BIT(TRACE_FLAG_LOGOTEST) - -// -// Allows source file to specify only the GUID to enable WMI tracing -// -#define WPP_CONTROL_GUIDS_NORMAL_FLAGS(_GUID) \ - WPP_DEFINE_CONTROL_GUID(wppCtlGuid, _GUID, WPP_NORMAL_FLAGS) - -// -// Overrides of default functions to allow us to specify both flags and error levels with error messages -// -#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl) -#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) WPP_LEVEL_LOGGER(flags) - -// -// Used in the source to selectively include the '.tmh' file as well as define the GUID -// -#define DEBUG_USE_WPP - -// -// Use KdPrint instead of WMI tracing -// -#else - -// -// Used in the source file to ensure the '.tmh' file is not included -// -#ifdef DEBUG_USE_WPP -#undef DEBUG_USE_WPP -#endif - -// -// Ensure both WPP_INIT_TRACING and WPP_CLEANUP are not defined, and replace with NOOPS -// These macros are only used when performing WMI tracing, which we are not -// -#ifdef WPP_INIT_TRACING -#undef WPP_INIT_TRACING -#endif - -#ifdef WPP_CLEANUP -#undef WPP_CLEANUP -#endif - -#define WPP_INIT_TRACING(_DRIVER, _REGISTRY) -#define WPP_CLEANUP(_DRIVER) - -// -// Initialize debug flags enumeration as it is not declared -// -typedef enum _DEBUG_FLAGS { - TRACE_FLAG_GENERAL = 0, - TRACE_FLAG_PNP, - TRACE_FLAG_POWER, - TRACE_FLAG_RW, - TRACE_FLAG_IOCTL, - TRACE_FLAG_QUEUE, - TRACE_FLAG_WMI, - TRACE_FLAG_TIMER, - TRACE_FLAG_INIT, - TRACE_FLAG_LOCK, - TRACE_FLAG_DEBUG1, - TRACE_FLAG_DEBUG2, - TRACE_FLAG_MCN, - TRACE_FLAG_ISR, - TRACE_FLAG_ENUM, - TRACE_FLAG_LOGOTEST -} DEBUG_FLAGS, *PDEBUG_FLAGS; - -// -// Redirect WMI tracing calls to the DbgPrint function. We are forced to drop the flags argument as -// DbgPrintEx does not use it. We only want one function definition when linked togethor, so -// we must define -// -// If we're on pre-XP, vDbgPrintEx doesn't exist, and there is no good replacement. In that situation, -// well ensure that TracePrint is a no-op when set to redirect traces to DbgPrint. -// - - -#if DBG && (NTDDI_VERSION >= NTDDI_WINXP) - -#define TracePrint(x) StorDebugPrint x - -#if DEBUG_MAIN_SOURCE - -void StorDebugPrint(int DebugPrintLevel, DEBUG_FLAGS DebugPrintFlags, PCCHAR DebugMessage, ...) { - va_list ap; - - UNREFERENCED_PARAMETER(DebugPrintFlags); - - va_start(ap, DebugMessage); - - vDbgPrintEx(DEBUG_COMP_ID, DebugPrintLevel, DebugMessage, ap); - - va_end(ap); -} - -#else - -void StorDebugPrint(int DebugPrintLevel, DEBUG_FLAGS DebugPrintFlags, PCCHAR DebugMessage, ...); - -#endif // DEBUG_MAIN_SOURCE - -#else - -#define TracePrint(x) - -#endif // DBG && (NTDDI_VERSION >= NTDDI_WINXP) - -#endif // DEBUG_USE_KDPRINT - -#endif // _stortrce_h_ - - - - diff --git a/pub/ddk/stortrce.h b/pub/ddk/stortrce.h deleted file mode 100644 index b255d0b..0000000 --- a/pub/ddk/stortrce.h +++ /dev/null @@ -1,680 +0,0 @@ -/*++ - -Copyright (c) 2004 Microsoft Corporation - -Module Name: - - stortrce.w - -Abstract: - - These are the structures and definitions used for tracing - in storage miniports. - -Authors: - -Revision History: - ---*/ - -// -// Add a little bit of no-op header versioning so that the header-versioning detection -// tool is happy. We'll add real header versioning later if we eventually need it. -// - -#if NTDDI_VERSION >= NTDDI_WINXP -#endif - -#include - -#ifndef _NTSTORTRCE_ -#define _NTSTORTRCE_ - -#define INLINE __inline - -// -// Determine the right PortNotification call for the miniport -// -#ifndef _PortTraceNotification - -// -// Storport miniport -// -#ifdef _NTSTORPORT_ -#define _PortTraceNotification StorPortNotification -#endif - -// -// Scsi miniport -// -#ifdef _NTSRB_ -#undef _PortTraceNotification -#define _PortTraceNotification ScsiPortNotification -#endif - -// -// Ata miniport -// -#ifdef _NTIRB_ -#undef _PortTraceNotification -#define _PortTraceNotification AtaPortTraceNotification -#endif - -#ifndef _PortTraceNotification -#error "PortNotification not defined. Include scsi.h or storport.h or irb.h" -#endif - -#endif //#ifndef _PortTraceNotification - -#ifndef StorMoveMemory - -#ifdef _NTSTORPORT_ -#define StorMoveMemory StorPortMoveMemory -#endif - -#ifdef _NTSRB_ -#undef StorMoveMemory -#define StorMoveMemory ScsiPortMoveMemory -#endif - -#ifdef _NTIRB_ -#undef StorMoveMemory -#define StorMoveMemory AtaPortMoveMemory -#endif - -#ifndef StorMoveMemory -#error "StorMoveMemory not defined. Include scsi.h or storport.h or irb.h" -#endif - -#endif //#ifndef StorMoveMemory - -typedef PVOID STORAGE_TRACE_CONTEXT; - -// -// Prototype for the cleanup routine -// -typedef -VOID -(*STOR_CLEANUP_TRACING) ( - __in PVOID Arg1 - ); - -// -// This structure is used to initializing the storage tracing library. -// -typedef struct _STORAGE_TRACE_INIT_INFO { - // - // The size, in bytes, of this structure. - // - ULONG Size; - - // - // The number of diagnostic contexts the caller wants pre-allocated for - // diagnostic events. By pre-allocating contexts, the caller will be - // able to generate diagnostic events at any IRQL. - // - ULONG NumDiagEventRecords; - - // - // The size, in bytes, of the user-defined data space to be allocated in - // each pre-allocated diagnostic context. - // - ULONG DiagEventRecordUserDataSize; - - // - // The number of error log records the caller wants pre-allocated. - // - ULONG NumErrorLogRecords; - - // - // The trace GUID of the caller uniquely identifies the component as a - // diagnostic event source. - // - GUID TraceGuid; - - // - // Callback to cleanup tracing - // - STOR_CLEANUP_TRACING TraceCleanupRoutine; - - // - // A pointer to the caller's driver object. - // - PVOID DriverObject; - - // - // OUT : TraceContext to be used for error/diag support - // - PVOID TraceContext; - -} STORAGE_TRACE_INIT_INFO, *PSTORAGE_TRACE_INIT_INFO; - - -// -// This structure is used to hold the user data that is attached to a -// diagnostic event. -// -typedef struct _STORAGE_DIAG_EVENT_RECORD { - - // - // The size, in bytes of this structure. This value includes the - // size of the information. - // - ULONG Size; - - // - // Reserved. - // - ULONG Reserved; - - // - // Additional information to be sent with the diagnostic event. - // - UCHAR Info[1]; -} STORAGE_DIAG_EVENT_RECORD, *PSTORAGE_DIAG_EVENT_RECORD; - - -// -// This structure holds information about a diagnostic trace event. -// -typedef struct _STORAGE_TRACE_DPS_INFO { - // - // The event ID uniquely identifies a diagnostic event. Applications - // can use the value to identify certain and take specific actions - // accordingly. - // - GUID EventId; - - // - // The flags field is used to control how the tracing library sends a - // diagnostic trace event. - // - ULONG Flags; - - // - // The status of the attempt to log the diagnostic event is recorded in - // the status field. - // - ULONG Status; - - // - // This field specifies the number of TRACE_CONTEXT records the caller is - // supplying in the Contexts array. - // - ULONG NumContexts; - - // - // An array of TRACE_CONTEXT structures. To be sent with the diagnostic - // event. - // - PVOID Contexts; - - // - // Specifies the size of the user data area. - // - ULONG UserDataSize; - -} STORAGE_TRACE_DPS_INFO, *PSTORAGE_TRACE_DPS_INFO; - -// -// This structure holds the error log from the miniport -// -typedef struct _STORAGE_ERRORLOG_PACKET { - UCHAR MajorFunctionCode; - UCHAR RetryCount; - USHORT DumpDataSize; - USHORT NumberOfStrings; - USHORT StringOffset; - USHORT EventCategory; - ULONG ErrorCode; - ULONG UniqueErrorValue; - ULONG FinalStatus; - ULONG SequenceNumber; - ULONG IoControlCode; - LARGE_INTEGER DeviceOffset; - ULONG DumpData[1]; -} STORAGE_ERRORLOG_PACKET, *PSTORAGE_ERRORLOG_PACKET; - -// -// Tracing related notification types -// -typedef enum _STORAGE_TRACE_NOTIFY_TYPE { - // - // Initialization and cleanup - // - InitTracing = 1000, // 0x3E8 (1000) - CleanupTracing, // 0x3E9 (1001) - - // - // WPP support - // - TraceMessage = 2000, // 0x7D0 (2000) - InitGlobalLogger, // 0x7D1 (2001) - WMIRegistrationControl, // 0x7E2 (2002) - WmiQueryTraceInfo, // 0x7E3 (2003) - InitUnicodeString, // 0x7E4 (2004) - TraceDebugPrint, // 0x7E5 (2005) - - // - // WDI support - // - AllocDiagEvent = 3000, // 0xBB8 (3000) - FreeDiagEvent, // 0xBB9 (3001) - LogDiagEvent, // 0xBBA (3002) - - // - // Error log support - // - WriteErrorLogRecord = 4000, // 0xFA0 (4000) - AllocErrorLog, - FreeErrorLog - -} STORAGE_TRACE_NOTIFY_TYPE, *PSTORAGE_TRACE_NOTIFY_TYPE; - - -// -// StorDebugPrint -// - -typedef struct _STOR_DEBUGPRINT_ARGS { - PCHAR Message; - va_list ArgList; -} STOR_DEBUGPRINT_ARGS, *PSTOR_DEBUGPRINT_ARGS; - -// -// StorInitTracing -// - -typedef struct _STOR_INIT_TRACING_ARGS { - PVOID InitInfo; - ULONG Result; -} STOR_INIT_TRACING_ARGS, *PSTOR_INIT_TRACING_ARGS; - - -// -// StorCleanupTracing -// - -typedef struct _STOR_CLEANUP_TRACING_ARGS { - PVOID TraceContext; -} STOR_CLEANUP_TRACING_ARGS, *PSTOR_CLEANUP_TRACING_ARGS; - -// -// WriteErrorLogEntry -// - -typedef struct _STOR_WRITE_EL_RECORD_ARGS { - PVOID TraceContext; - PVOID ErrorLogPacket; -} STOR_WRITE_EL_RECORD_ARGS, *PSTOR_WRITE_EL_RECORD_ARGS; - -// -// AllocateErrorLogEntry -// - -typedef struct _STOR_ALLOC_EL_RECORD_ARGS { - PVOID TraceContext; - ULONG Size; - PSTORAGE_ERRORLOG_PACKET Result; -} STOR_ALLOC_EL_RECORD_ARGS, *PSTOR_ALLOC_EL_RECORD_ARGS; - -// -// FreeErrorLogEntry -// - -typedef struct _STOR_FREE_EL_RECORD_ARGS { - PVOID TraceContext; - PSTORAGE_ERRORLOG_PACKET ErrorLogPacket; -} STOR_FREE_EL_RECORD_ARGS, *PSTOR_FREE_EL_RECORD_ARGS; - - -// -// TraceDriverLogEvent -// - -typedef struct _STOR_LOG_DIAG_EVENT_ARGS { - PVOID TraceContext; - PVOID ContextEvent; - ULONG result; -} STOR_LOG_DIAG_EVENT_ARGS, *PSTOR_LOG_DIAG_EVENT_ARGS; - - -// -// TraceDriverAllocEvent -// - -typedef struct _STOR_ALLOC_DIAG_EVENT_ARGS { - PVOID TraceContext; - ULONG UserDataSize; - BOOLEAN Allocate; - PVOID result; -} STOR_ALLOC_DIAG_EVENT_ARGS, *PSTOR_ALLOC_DIAG_EVENT_ARGS; - - -// -// TraceDriverFreeEvent -// - -typedef struct _STOR_FREE_DIAG_EVENT_ARGS { - PVOID TraceContext; - PVOID EventRecord; -} STOR_FREE_DIAG_EVENT_ARGS, *PSTOR_FREE_DIAG_EVENT_ARGS; - - -// -// WmiTraceMessage -// - -typedef struct _STOR_WMI_TRACE_MESSAGE_ARGS { - ULONG64 TraceHandle; - ULONG MessageFlags; - LPCGUID MessageGuid; - USHORT MessageNumber; - va_list Args; - ULONG result; -} STOR_WMI_TRACE_MESSAGE_ARGS, *PSTOR_WMI_TRACE_MESSAGE_ARGS; - -// -// RtlInitUnicodeString -// - -typedef struct _STOR_INIT_UNICODE_STRING_ARGS { - PVOID DestinationString; - PCWSTR SourceString; -} STOR_INIT_UNICODE_STRING_ARGS, *PSTOR_INIT_UNICODE_STRING_ARGS; - - -// -// IoWMIRegistrationControl -// - -typedef struct _STOR_WMI_REGCONTROL_ARGS { - PVOID DeviceObject; - ULONG Action; - ULONG result; -} STOR_WMI_REGCONTROL_ARGS, *PSTOR_WMI_REGCONTROL_ARGS; - - -// -// IoWMIRegistrationControl -// - -typedef struct _STOR_WMI_QUERYTRACEINFO_ARGS { - ULONG TraceInformationClass; - PVOID TraceInformation; - ULONG TraceInformationLength; - PULONG RequiredLength; - PVOID Buffer; - ULONG result; -} STOR_WMI_QUERYTRACEINFO_ARGS, *PSTOR_WMI_QUERYTRACEINFO_ARGS; - - -// -// WppInitGlobalLogger -// - -typedef struct _STOR_INITGLOBALLOGGER_ARGS { - LPCGUID ControlGuid; - PVOID Logger; - PVOID Flags; - PVOID Level; -} STOR_INITGLOBALLOGGER_ARGS, *PSTOR_INITGLOBALLOGGER_ARGS; - -// -// memset -// -#define StorMemSet(dst, val, count) \ -{ \ - ULONG _i = count; \ - while (_i) { \ - *((char *)dst+_i-1) = (char)val; \ - _i--; \ - } \ -} - -// -// StorInitTracing -// - -ULONG -__inline -StorInitTracing( - __in PVOID InitInfo - ) -{ - STOR_INIT_TRACING_ARGS args = {InitInfo, 0xC00000BB}; - _PortTraceNotification(TraceNotification, NULL, InitTracing, &args); - - return args.Result; -} - -// -// StorCleanupTracing -// - -VOID -__inline -StorCleanupTracing( - __in PVOID TraceContext - ) -{ - STOR_CLEANUP_TRACING_ARGS args = {TraceContext}; - _PortTraceNotification(TraceNotification, NULL, CleanupTracing, &args); -} - -// -// TraceDriverLogEvent -// - -ULONG -__inline -StorTraceDiagLogEvent( - __in PVOID DeviceExtension, - __in STORAGE_TRACE_CONTEXT TraceContext, - __in PVOID Event - ) -{ - STOR_LOG_DIAG_EVENT_ARGS args = {TraceContext, Event}; - _PortTraceNotification(TraceNotification, DeviceExtension, LogDiagEvent, &args); - return args.result; -} - -// -// TraceDriverAllocEvent -// - -PVOID -__inline -StorTraceDiagAllocEvent( - __in PVOID DeviceExtension, - __in STORAGE_TRACE_CONTEXT TraceContext, - __in ULONG DataSize, - __in BOOLEAN Allocate - ) -{ - STOR_ALLOC_DIAG_EVENT_ARGS args = {TraceContext, DataSize, Allocate}; - _PortTraceNotification(TraceNotification, DeviceExtension, AllocDiagEvent, &args); - - return args.result; -} - -// -// TraceDriverFreeEvent -// - -VOID -__inline -StorTraceDiagFreeEvent( - __in PVOID DeviceExtension, - __in STORAGE_TRACE_CONTEXT TraceContext, - __in PVOID Event - ) -{ - STOR_FREE_DIAG_EVENT_ARGS args = {TraceContext, Event}; - _PortTraceNotification(TraceNotification, DeviceExtension, FreeDiagEvent, &args); -} - -// -// WriteErrorLogEntry -// - -VOID -__inline -StorTraceErrorWriteRecord( - __in PVOID DeviceExtension, - __in PVOID Arg1, - __in PVOID Arg2 - ) -{ - STOR_WRITE_EL_RECORD_ARGS args = {Arg1, Arg2}; - _PortTraceNotification(TraceNotification, DeviceExtension, WriteErrorLogRecord, &args); -} - -// -// AllocateErrorLogEntry -// - -PSTORAGE_ERRORLOG_PACKET -__inline -StorTraceErrorAllocRecord( - __in PVOID DeviceExtension, - __in STORAGE_TRACE_CONTEXT TraceContext, - __in ULONG Size - ) -{ - STOR_ALLOC_EL_RECORD_ARGS args = {TraceContext, Size}; - _PortTraceNotification(TraceNotification, DeviceExtension, AllocErrorLog, &args); - return args.Result; -} - -// -// FreeErrorLogEntry -// - -VOID -__inline -StorTraceErrorFreeRecord( - __in PVOID DeviceExtension, - __in STORAGE_TRACE_CONTEXT TraceContext, - __in PSTORAGE_ERRORLOG_PACKET ErrorLogPacket - ) -{ - STOR_FREE_EL_RECORD_ARGS args = {TraceContext, ErrorLogPacket}; - _PortTraceNotification(TraceNotification, DeviceExtension, FreeErrorLog, &args); -} - -// -// WmiTraceMessage -// - -ULONG -__inline -StorWmiTraceMessage( - __in ULONG64 Arg1, - __in ULONG Arg2, - __in LPCGUID Arg3, - __in USHORT Arg4, - ... - ) -{ - STOR_WMI_TRACE_MESSAGE_ARGS args = {Arg1, Arg2, Arg3, Arg4, }; - va_list ap; - va_start(ap, Arg4); - args.Args = ap; - - _PortTraceNotification(TraceNotification, NULL, TraceMessage, &args); - return args.result; -} - -// -// RtlInitUnicodeString -// - -VOID -__inline -StorRtlInitUnicodeString( - __inout PVOID Arg1, - __in PCWSTR Arg2 - ) -{ - STOR_INIT_UNICODE_STRING_ARGS args = {Arg1, Arg2}; - _PortTraceNotification(TraceNotification, NULL, InitUnicodeString, &args); -} - -// -// WppInitGlobalLogger -// - -VOID -__inline -StorWppInitGlobalLogger( - __in LPCGUID Arg1, - __in PVOID Arg2, - __in PVOID Arg3, - __in PVOID Arg4 - ) -{ - STOR_INITGLOBALLOGGER_ARGS args = {Arg1, Arg2, Arg3, Arg4}; - _PortTraceNotification(TraceNotification, NULL, InitGlobalLogger, &args); -} - -// -// IoWMIRegistrationControl -// - -ULONG -__inline -StorIoWMIRegistrationControl( - __in PVOID Arg1, - __in ULONG Arg2 - ) -{ - STOR_WMI_REGCONTROL_ARGS args = {Arg1, Arg2}; - _PortTraceNotification(TraceNotification, NULL, WMIRegistrationControl, &args); - return args.result; -} - -// -// WmiQueryTraceInformation -// - -ULONG -__inline -StorWmiQueryTraceInformation( - __in ULONG Arg1, - __out PVOID Arg2, - __in ULONG Arg3, - __out PULONG Arg4, - __in PVOID Arg5 - ) -{ - STOR_WMI_QUERYTRACEINFO_ARGS args = {Arg1, Arg2, Arg3, Arg4, Arg5}; - _PortTraceNotification(TraceNotification, NULL, WmiQueryTraceInfo, &args); - return args.result; -} - - -/* -// -// DebugPrint -// - -VOID -__inline -StorDebugPrint( - __in PCHAR Arg1, - __in va_list Arg2 - ) -{ - STOR_DEBUGPRINT_ARGS args = {Arg1, Arg2}; - _PortTraceNotification(TraceNotification, NULL, TraceDebugPrint, &args); -} - - -#ifdef DO_DBGPRINT -#define WPP_DEBUG(A) StorDebugPrint A -#endif -*/ - -#endif - diff --git a/pub/ddk/strmini.h b/pub/ddk/strmini.h deleted file mode 100644 index 402e9f4..0000000 --- a/pub/ddk/strmini.h +++ /dev/null @@ -1,1381 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - STRMINI.H - -Abstract: - - This file defines streaming minidriver structures and class/minidriver - interfaces. - -Author: - - Bill Parry - -Environment: - - Kernel mode only - -Revision History: - ---*/ - -#ifndef _STREAM_H -#define _STREAM_H - -#include -#include -#include -#include "ks.h" - -#define STREAMAPI __stdcall - -typedef unsigned __int64 STREAM_SYSTEM_TIME, - *PSTREAM_SYSTEM_TIME; -typedef unsigned __int64 STREAM_TIMESTAMP, - *PSTREAM_TIMESTAMP; -#define STREAM_SYSTEM_TIME_MASK ((STREAM_SYSTEM_TIME)0x00000001FFFFFFFF) -// -// debug print level values -// - -typedef enum { // Use the given level to indicate: - DebugLevelFatal = 0, // * imminent nonrecoverable system failure - DebugLevelError, // * serious error, though recoverable - DebugLevelWarning, // * warnings of unusual occurances - DebugLevelInfo, // * status and other information - normal - // though - // perhaps unusual events. System MUST remain - // responsive. - DebugLevelTrace, // * trace information - normal events - // system need not ramain responsive - DebugLevelVerbose, // * verbose trace information - // system need not remain responsive - DebugLevelMaximum -} STREAM_DEBUG_LEVEL; - -#define DebugLevelAlways DebugLevelFatal - -#if DBG - -// -// macro for printing debug information -// -#define DebugPrint(x) StreamClassDebugPrint x - -// -// macro for doing INT 3 (or non-x86 equivalent) -// - -#if WIN95_BUILD - -#define DEBUG_BREAKPOINT() _asm int 3; - -#else - -#define DEBUG_BREAKPOINT() DbgBreakPoint() - -#endif - -// -// macro for asserting (stops if not = TRUE) -// - -#define DEBUG_ASSERT(exp) \ - if ( !(exp) ) { \ - StreamClassDebugAssert( __FILE__, __LINE__, #exp, exp); \ - } - -#else - -#define DebugPrint(x) -#define DEBUG_BREAKPOINT() -#define DEBUG_ASSERT(exp) - -#endif - -// -// Uninitialized flag value. -// - -#define MP_UNINITIALIZED_VALUE ((ULONG) ~0) - -// -// define physical address formats -// - -typedef PHYSICAL_ADDRESS STREAM_PHYSICAL_ADDRESS, - *PSTREAM_PHYSICAL_ADDRESS; - - -// -// functions for the time context structure below -// - -typedef enum { - - TIME_GET_STREAM_TIME, - TIME_READ_ONBOARD_CLOCK, - TIME_SET_ONBOARD_CLOCK -} TIME_FUNCTION; - -// -// define the time context structure -// - -typedef struct _HW_TIME_CONTEXT { - - struct _HW_DEVICE_EXTENSION *HwDeviceExtension; - struct _HW_STREAM_OBJECT *HwStreamObject; - TIME_FUNCTION Function; - ULONGLONG Time; - ULONGLONG SystemTime; -} HW_TIME_CONTEXT, *PHW_TIME_CONTEXT; - -// -// define the event descriptor for enabling/disabling events. -// - -typedef struct _HW_EVENT_DESCRIPTOR { - BOOLEAN Enable; // TRUE means this is an enable, FALSE means disable - PKSEVENT_ENTRY EventEntry; // event structure - PKSEVENTDATA EventData; // data representing this event - union { - struct _HW_STREAM_OBJECT * StreamObject; // stream object for the event - struct _HW_DEVICE_EXTENSION *DeviceExtension; - }; - ULONG EnableEventSetIndex; // gives the index of the event set for ENABLE - // field has no meaning for DISABLE - -#if (NTDDI_VERSION >= NTDDI_WINXP) - PVOID HwInstanceExtension; - ULONG Reserved; -#else - ULONG Reserved[2]; // Reserved for future use -#endif - -} HW_EVENT_DESCRIPTOR, *PHW_EVENT_DESCRIPTOR; - -// -// function prototypes for stream object functions -// - -#pragma warning( disable : 4115) -typedef VOID - (STREAMAPI * PHW_RECEIVE_STREAM_DATA_SRB) ( // HwReceiveDataPacket - IN struct _HW_STREAM_REQUEST_BLOCK * SRB -); - -typedef VOID - (STREAMAPI * PHW_RECEIVE_STREAM_CONTROL_SRB) ( // HwReceiveControlPacket - IN struct _HW_STREAM_REQUEST_BLOCK * SRB -); - -typedef NTSTATUS - (STREAMAPI * PHW_EVENT_ROUTINE) ( // HwEventRoutine - IN PHW_EVENT_DESCRIPTOR EventDescriptor -); -#pragma warning( default : 4115) -typedef VOID - (STREAMAPI * PHW_CLOCK_FUNCTION) ( // HwClockFunction - IN PHW_TIME_CONTEXT HwTimeContext -); - -// -// define the clock object -// - -typedef struct _HW_CLOCK_OBJECT { - - // - // pointer to the minidriver's clock function - // - - PHW_CLOCK_FUNCTION HwClockFunction; - - // - // support flags as defined below - // - - ULONG ClockSupportFlags; - - ULONG Reserved[2]; // Reserved for future use -} HW_CLOCK_OBJECT, *PHW_CLOCK_OBJECT; - -// -// clock object support flags defined as follows -// - -// -// indicates that the minidriver's clock for this stream is tunable -// via TIME_SET_ONBOARD_CLOCK -// - -#define CLOCK_SUPPORT_CAN_SET_ONBOARD_CLOCK 0x00000001 - -// -// indicates that the minidriver's clock for this stream is raw readable -// via TIME_READ_ONBOARD_CLOCK -// - -#define CLOCK_SUPPORT_CAN_READ_ONBOARD_CLOCK 0x00000002 - -// -// indicates that the minidriver can return the current stream time for this -// stream via TIME_GET_STREAM_TIME -// - -#define CLOCK_SUPPORT_CAN_RETURN_STREAM_TIME 0x00000004 - -// -// stream object definition -// - -typedef struct _HW_STREAM_OBJECT { - ULONG SizeOfThisPacket; // size of this structure - ULONG StreamNumber; // number of this stream - PVOID HwStreamExtension; // minidriver's stream extension - PHW_RECEIVE_STREAM_DATA_SRB ReceiveDataPacket; // receive data packet routine - PHW_RECEIVE_STREAM_CONTROL_SRB ReceiveControlPacket; // receive control packet routine - HW_CLOCK_OBJECT HwClockObject; // clock object to be filled in by - // minidriver - BOOLEAN Dma; // device uses busmaster DMA - // for this stream - BOOLEAN Pio; // device uses PIO for this - PVOID HwDeviceExtension; // minidriver's device ext. - - ULONG StreamHeaderMediaSpecific; // Size of media specific per - // stream header expansion. - ULONG StreamHeaderWorkspace; // Size of per-stream header workspace. - BOOLEAN Allocator; // Set to TRUE if allocator is needed for this stream. - - // - // the following routine receives ENABLE and DISABLE notification of - // KS synchronization events for this stream. - // - - PHW_EVENT_ROUTINE HwEventRoutine; - - ULONG Reserved[2]; // Reserved for future use - -} HW_STREAM_OBJECT, *PHW_STREAM_OBJECT; - -// -// the following structures are used to report which stream types and properties -// are supported by the minidriver. the HW_STREAM_HEADER structure is followed -// in memory by one or more HW_STREAM_INFORMATION structures. See the -// HW_STREAM_DESCRIPTOR structure below. -// - -typedef struct _HW_STREAM_HEADER { - - // - // indicates the number of HW_STREAM_INFORMATION structures follow this - // structure. - // - - ULONG NumberOfStreams; - - // - // size of the HW_STREAM_INFORMATION structure below (filled in by the - // minidriver) - // - - ULONG SizeOfHwStreamInformation; - - // - // indicates the number of property sets supported by the device itself. - // - - ULONG NumDevPropArrayEntries; - - // - // pointer to the array of device property sets. - // - - PKSPROPERTY_SET DevicePropertiesArray; - - // - // indicates the number of event sets supported by the device itself. - // - - ULONG NumDevEventArrayEntries; - - // - // pointer to the array of device property sets. - // - - PKSEVENT_SET DeviceEventsArray; - - // - // pointer to the topology structure - // - - PKSTOPOLOGY Topology; - - // - // event routine for processing device events, if any. - // - - PHW_EVENT_ROUTINE DeviceEventRoutine; - -#if (NTDDI_VERSION >= NTDDI_WINXP) - LONG NumDevMethodArrayEntries; - PKSMETHOD_SET DeviceMethodsArray; -#else - ULONG Reserved[2]; // Reserved for future use -#endif - -} HW_STREAM_HEADER, *PHW_STREAM_HEADER; - -// -// the HW_STREAM_INFORMATION structure(s) indicate what streams are supported -// - -typedef struct _HW_STREAM_INFORMATION { - - // - // number of possible instances of this stream that can be opened at once - // - - ULONG NumberOfPossibleInstances; - - // - // Indicates the direction of data flow of this stream - // - - KSPIN_DATAFLOW DataFlow; - - // - // Indicates whether the data is "seen" by the host processor. If the - // data is not visible to the processor (such as an NTSC output port) - // this boolean is set to false. - // - - BOOLEAN DataAccessible; - - // - // Number of formats supported by this stream. Indicates the number of - // elements pointed to by StreamFormatsArray below. - // - - ULONG NumberOfFormatArrayEntries; - - // - // pointer to an array of elements indicating what types of data are - // supported with this stream. - // - - __field_ecount(NumberOfFormatArrayEntries) - PKSDATAFORMAT* StreamFormatsArray; - - // - // reserved for future use. - // - - PVOID ClassReserved[4]; - - // - // number of property sets supported by this stream - // - - ULONG NumStreamPropArrayEntries; - - // - // pointer to an array of property set descriptors for this stream - // - - __field_ecount(NumStreamPropArrayEntries) - PKSPROPERTY_SET StreamPropertiesArray; - - // - // number of event sets supported by this stream - // - - ULONG NumStreamEventArrayEntries; - - // - // pointer to an array of event set descriptors for this stream - // - - __field_ecount(NumStreamEventArrayEntries) - PKSEVENT_SET StreamEventsArray; - - // - // pointer to guid representing catagory of stream. (optional) - // - - GUID* Category; - - // - // pointer to guid representing name of stream. (optional) - // - - GUID* Name; - - // - // count of media supported (optional) - // - - ULONG MediumsCount; - - // - // pointer to array of media (optional) - // - - __field_ecount(MediumsCount) - const KSPIN_MEDIUM* Mediums; - - // - // indicates that this stream is a bridge stream (COMMUNICATIONS BRIDGE) - // this field should be set to FALSE by most minidrivers. - // - - BOOLEAN BridgeStream; - ULONG Reserved[2]; // Reserved for future use - -} HW_STREAM_INFORMATION, *PHW_STREAM_INFORMATION; - - -typedef struct _HW_STREAM_DESCRIPTOR { - - // - // header as defined above - // - - HW_STREAM_HEADER StreamHeader; - - // - // one or more of the following, as indicated by NumberOfStreams in the - // header. - // - - HW_STREAM_INFORMATION StreamInfo; - -} HW_STREAM_DESCRIPTOR, *PHW_STREAM_DESCRIPTOR; - -// -// STREAM Time Reference structure -// - -typedef struct _STREAM_TIME_REFERENCE { - STREAM_TIMESTAMP CurrentOnboardClockValue; // current value of adapter - // clock - LARGE_INTEGER OnboardClockFrequency; // frequency of adapter clock - LARGE_INTEGER CurrentSystemTime; // KeQueryPeformanceCounter time - ULONG Reserved[2]; // Reserved for future use -} STREAM_TIME_REFERENCE, *PSTREAM_TIME_REFERENCE; - -// -// data intersection structure. this structure is point to by the -// Srb->CommandData.IntersectInfo field of the SRB on an -// SRB_GET_DATA_INTERSECTION operation. -// - -typedef struct _STREAM_DATA_INTERSECT_INFO { - - // - // stream number to check - // - - ULONG StreamNumber; - - // - // pointer to the input data range to verify. - // - - PKSDATARANGE DataRange; - - // - // pointer to buffer which receives the format block if successful - // - - __field_bcount(SizeOfDataFormatBuffer) - PVOID DataFormatBuffer; - - // - // size of the above buffer. set to sizeof(ULONG) if the caller just - // wants to know what size is needed. - // - - ULONG SizeOfDataFormatBuffer; - -} STREAM_DATA_INTERSECT_INFO, *PSTREAM_DATA_INTERSECT_INFO; - -// -// stream property descriptor structure. this descriptor is referenced in -// Srb->CommandData.PropertyInfo field of the SRB on an SRB_GET or -// SRB_SET_PROPERTY operation. -// - -typedef struct _STREAM_PROPERTY_DESCRIPTOR { - - // - // pointer to the property GUID and ID - // - - PKSPROPERTY Property; - - // - // zero-based ID of the property, which is an index into the array of - // property sets filled in by the minidriver. - // - - ULONG PropertySetID; - - // - // pointer to the information about the property (or the space to return - // the information) passed in by the client - // - - PVOID PropertyInfo; - - // - // size of the client's input buffer - // - - ULONG PropertyInputSize; - - // - // size of the client's output buffer - // - - ULONG PropertyOutputSize; -} STREAM_PROPERTY_DESCRIPTOR, *PSTREAM_PROPERTY_DESCRIPTOR; - - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -typedef struct _STREAM_METHOD_DESCRIPTOR { - ULONG MethodSetID; - PKSMETHOD Method; - PVOID MethodInfo; - LONG MethodInputSize; - LONG MethodOutputSize; -} STREAM_METHOD_DESCRIPTOR, *PSTREAM_METHOD_DESCRIPTOR; - -#endif - -// -// STREAM I/O Request Block (SRB) structures and functions -// - -#define STREAM_REQUEST_BLOCK_SIZE sizeof(STREAM_REQUEST_BLOCK) - -// -// SRB command codes -// - -typedef enum _SRB_COMMAND { - - // - // stream specific codes follow - // - - SRB_READ_DATA, // read data from hardware - SRB_WRITE_DATA, // write data to the hardware - SRB_GET_STREAM_STATE, // get the state of the stream - SRB_SET_STREAM_STATE, // set the state of the stream - SRB_SET_STREAM_PROPERTY, // set a property of the stream - SRB_GET_STREAM_PROPERTY, // get a property value for the stream - SRB_OPEN_MASTER_CLOCK, // indicates that the master clock is on this - // stream - SRB_INDICATE_MASTER_CLOCK, // supplies the handle to the master clock - SRB_UNKNOWN_STREAM_COMMAND, // IRP function is unknown to class driver - SRB_SET_STREAM_RATE, // set the rate at which the stream should run - SRB_PROPOSE_DATA_FORMAT, // propose a new format, DOES NOT CHANGE IT! - SRB_CLOSE_MASTER_CLOCK, // indicates that the master clock is closed - SRB_PROPOSE_STREAM_RATE, // propose a new rate, DOES NOT CHANGE IT! - SRB_SET_DATA_FORMAT, // sets a new data format - SRB_GET_DATA_FORMAT, // returns the current data format - SRB_BEGIN_FLUSH, // beginning flush state - SRB_END_FLUSH, // ending flush state - - // - // device/instance specific codes follow - // - - SRB_GET_STREAM_INFO = 0x100,// get the stream information structure - SRB_OPEN_STREAM, // open the specified stream - SRB_CLOSE_STREAM, // close the specified stream - SRB_OPEN_DEVICE_INSTANCE, // open an instance of the device - SRB_CLOSE_DEVICE_INSTANCE, // close an instance of the device - SRB_GET_DEVICE_PROPERTY, // get a property of the device - SRB_SET_DEVICE_PROPERTY, // set a property for the device - SRB_INITIALIZE_DEVICE, // initialize the device - SRB_CHANGE_POWER_STATE, // change power state - SRB_UNINITIALIZE_DEVICE, // uninitialize the device - SRB_UNKNOWN_DEVICE_COMMAND, // IRP function is unknown to class driver - SRB_PAGING_OUT_DRIVER, // indicates that the driver is to be paged out - // only sent if enabled in registry. board ints - // should be disabled & STATUS_SUCCESS returned. - SRB_GET_DATA_INTERSECTION, // returns stream data intersection - SRB_INITIALIZATION_COMPLETE,// indicates init sequence has completed - SRB_SURPRISE_REMOVAL // indicates surprise removal of HW has occurred - -#if (NTDDI_VERSION >= NTDDI_WINXP) - - , SRB_DEVICE_METHOD - , SRB_STREAM_METHOD - -#if ( (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WS03) ) || (NTDDI_VERSION >= NTDDI_WS03SP1) - - , SRB_NOTIFY_IDLE_STATE // called on first open and last close - -#endif - -#endif - -} SRB_COMMAND; - -// -// definition for scatter/gather -// - -typedef struct { - PHYSICAL_ADDRESS PhysicalAddress; - ULONG Length; -} KSSCATTER_GATHER, *PKSSCATTER_GATHER; - - -typedef struct _HW_STREAM_REQUEST_BLOCK { - ULONG SizeOfThisPacket; // sizeof STREAM_REQUEST_BLOCK - // (version check) - SRB_COMMAND Command; // SRB command, see SRB_COMMAND enumeration - NTSTATUS Status; // SRB completion status - PHW_STREAM_OBJECT StreamObject; - // minidriver's stream object for this request - PVOID HwDeviceExtension; // minidriver's device ext. - PVOID SRBExtension; // per-request workspace for the - // minidriver - - // - // the following union passes in the information needed for the various - // SRB - // functions. - // - - union _CommandData { - - // - // pointer to the data descriptor for SRB_READ or SRB_WRITE_DATA - // - __field_ecount(NumberOfBuffers) - PKSSTREAM_HEADER DataBufferArray; - - // - // pointer to the stream descriptor for SRB_GET_STREAM_INFO - // - - PHW_STREAM_DESCRIPTOR StreamBuffer; - - // - // pointer to the state for SRB_GET or SRB_SET_DEVICE_STATE - // - - KSSTATE StreamState; - - // - // pointer to the time structure for SRB_GET and - // SRB_SET_ONBOARD_CLOCK - // - - PSTREAM_TIME_REFERENCE TimeReference; - - // - // pointer to the property descriptor for SRB_GET and - // SRB_SET_PROPERTY - // - - PSTREAM_PROPERTY_DESCRIPTOR PropertyInfo; - - // - // pointer to the requested format for SRB_OPEN_STREAM and - // SRB_PROPOSE_DATA_FORMAT - // - - PKSDATAFORMAT OpenFormat; - - // - // pointer to the PORT_CONFIGURATION_INFORMATION struct for - // SRB_INITIALIZE_DEVICE - // - - struct _PORT_CONFIGURATION_INFORMATION *ConfigInfo; - - // - // handle to the master clock. - // - - HANDLE MasterClockHandle; - - // - // power state - // - - DEVICE_POWER_STATE DeviceState; - - // - // data intersection info - // - - PSTREAM_DATA_INTERSECT_INFO IntersectInfo; - -#if (NTDDI_VERSION >= NTDDI_WINXP) - - PVOID MethodInfo; - - // - // Filter type index for OPEN_DEVICE_INSTANCE - // - LONG FilterTypeIndex; - -#if ( (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WS03) ) || (NTDDI_VERSION >= NTDDI_WS03SP1) - - // - // Indicates whether an SRB_NOTIFY_IDLE_STATE is calling to inform - // that the device is idle -- no more handles to the device are - // open (TRUE) -- or to inform that the device is no longer idle -- - // a handle to the device has been opened (FALSE). - // - BOOLEAN Idle; - -#endif - -#endif - - } CommandData;// union for command data - - // - // field for indicating the number of KSSTREM_HEADER elements pointed to - // by the DataBufferArray field above. - // - - ULONG NumberOfBuffers; - - // - // the following fields are used to time the request. The class driver - // will set both of these fields to a nonzero value when the request - // is received by the minidriver, and then begin counting down the - // TimeoutCounter field until it reaches zero. When it reaches zero, - // the minidriver's timeout handler will be called. If the minidriver - // queues a request for a long time, it should set the TimeoutCounter to - // zero to turn off the timer, and once the request is dequeued should - // set the TimeoutCounter field to the value in TimeoutOriginal. - // - - ULONG TimeoutCounter; // timer countdown value in seconds - ULONG TimeoutOriginal; // original timeout value in seconds - struct _HW_STREAM_REQUEST_BLOCK *NextSRB; - // link field available to minidriver for queuing - PIRP Irp; // pointer to original IRP, usually not - // needed. - ULONG Flags; // flags defined below. - - // - // To indicate the filter instance extension - // - PVOID HwInstanceExtension; - - // pointer to the instance extension - // - // the following union is used to indicate to the minidriver the amount - // of data to transfer, and used by the minidriver to report the amount - // of data it was actually able to transfer. - // - - union { - ULONG NumberOfBytesToTransfer; - ULONG ActualBytesTransferred; - }; - - __field_ecount(NumberOfScatterGatherElements) - PKSSCATTER_GATHER ScatterGatherBuffer; // buffer pointing to array - // of s/g elements - ULONG NumberOfPhysicalPages; // # of physical pages in request - - ULONG NumberOfScatterGatherElements; - // # of physical elements pointed - // to by ScatterGatherBuffer - - ULONG Reserved[1]; // Reserved for future use - -} HW_STREAM_REQUEST_BLOCK, *PHW_STREAM_REQUEST_BLOCK; - -// -// flags definitions for CRB -// - -// -// this flag indicates that the request is either an SRB_READ_DATA or -// SRB_WRITE_DATA request, as opposed to a non-data request. -// - -#define SRB_HW_FLAGS_DATA_TRANSFER 0x00000001 - -// -// this flag indicates that the request is for a stream, as opposed to being -// for the device. -// - -#define SRB_HW_FLAGS_STREAM_REQUEST 0x00000002 - -// -// Structure defining the buffer types for StreamClassGetPhysicalAddress. -// - -typedef enum { - PerRequestExtension, // indicates the phys address of the SRB - // extension - DmaBuffer, // indicates the phys address of the DMA - // buffer - SRBDataBuffer // indicates the phys address of a data - // buffer -} STREAM_BUFFER_TYPE; - -// -// Structure for I/O and Memory address ranges -// - -typedef struct _ACCESS_RANGE { - __field_bcount(RangeLength) - STREAM_PHYSICAL_ADDRESS RangeStart; // start of the range - ULONG RangeLength;// length of the range - BOOLEAN RangeInMemory; // FALSE if a port address - ULONG Reserved; // -} ACCESS_RANGE, *PACCESS_RANGE; - - -// -// Configuration information structure. Contains the information necessary -// to initialize the adapter. -// - -typedef struct _PORT_CONFIGURATION_INFORMATION { - ULONG SizeOfThisPacket; // Size of this structure, used as - // version check - PVOID HwDeviceExtension; // minidriver's device extension - - // - // the below field supplies a pointer to the device's functional - // device object, which is created by stream class. - // Most minidrivers will not need to use this. - // - - PDEVICE_OBJECT ClassDeviceObject; // class driver's FDO - - // - // the below field supplies a pointer to the device's "attached" physical - // device object, which is returned from IoAttachDeviceToDeviceStack. - // Most minidrivers will not need to use this. - // This PDO must be used for calls to IoCallDriver. See the note below - // for the RealPhysicalDeviceObject, and also see WDM documentation. - // - - PDEVICE_OBJECT PhysicalDeviceObject; // attached physical device object - - ULONG SystemIoBusNumber; // IO bus number (0 for machines that - // have - // only 1 IO bus) - - INTERFACE_TYPE AdapterInterfaceType; // Adapter interface type - // supported by HBA: - // Internal - // Isa - // Eisa - // MicroChannel - // TurboChannel - // PCIBus - // VMEBus - // NuBus - // PCMCIABus - // CBus - // MPIBus - // MPSABus - - ULONG BusInterruptLevel; // interrupt level - ULONG BusInterruptVector; // interrupt vector - KINTERRUPT_MODE InterruptMode; // interrupt mode (latched, level) - - ULONG DmaChannel; // DMA channel - - // - // Specifies the number of AccessRanges elements in the array, - // described next. The OS-specific class driver always sets this - // member to the value passed in the HW_INITIALIZATION_DATA - // structure when the minidriver driver called CodecXXXInitialize. - // - - ULONG NumberOfAccessRanges; // Number of access ranges - // allocated - - // - // Points to the first element of an array of ACCESS_RANGE-type elements. - // The given NumberOfAccessRanges determines how many elements must be - // configured with bus-relative range values. The AccessRanges - // pointer must be NULL if NumberOfAccessRanges is zero. - // - __field_ecount(NumberOfAccessRanges) - PACCESS_RANGE AccessRanges; // Pointer to array of access range - // elements - - // - // the following field is filled in by the minidriver to indicate the - // size of the buffer needed to build the HW_STREAM_DESCRIPTOR structure - // and all of its substructures. - // - - ULONG StreamDescriptorSize; // size of the stream descriptor - - PIRP Irp; // IRP for PNP start function, normally - // not used by the minidriver. - - // - // the following field indicates the interrupt object for the adapter - // if nonzero. This field is normally not used by the minidriver. - // - - PKINTERRUPT InterruptObject; - - // - // the following field indicates the DMA adapter object for the adapter - // if nonzero. This field is normally not used by the minidriver. - // - - PADAPTER_OBJECT DmaAdapterObject; - - // - // the below field supplies a pointer to the device's "real" physical - // device object, which is supplied on the AddDevice call. Most - // minidrivers will not need to use this. - // This PDO must be used for registry access, etc. See the note above - // for the PhysicalDeviceObject, and also see WDM documentation. - // - - PDEVICE_OBJECT RealPhysicalDeviceObject; // real physical device object - - ULONG Reserved[1]; // Reserved for future use - -} PORT_CONFIGURATION_INFORMATION, *PPORT_CONFIGURATION_INFORMATION; - -// -// Function prototypes for minidriver routines called by the class driver -// - - -typedef VOID - (STREAMAPI * PHW_RECEIVE_DEVICE_SRB) ( // HwReceivePacket - // routine - IN PHW_STREAM_REQUEST_BLOCK SRB -); - -typedef VOID - (STREAMAPI * PHW_CANCEL_SRB) ( // HwCancelPacket routine - IN PHW_STREAM_REQUEST_BLOCK SRB -); - -typedef VOID - (STREAMAPI * PHW_REQUEST_TIMEOUT_HANDLER) ( // HwRequestTimeoutHandle - // - // r routine - IN PHW_STREAM_REQUEST_BLOCK SRB -); - -typedef BOOLEAN - (STREAMAPI * PHW_INTERRUPT) ( // HwInterrupt routine - IN PVOID DeviceExtension -); - -typedef VOID - (STREAMAPI * PHW_TIMER_ROUTINE) ( // timer callback routine - IN PVOID Context -); - -typedef VOID - (STREAMAPI * PHW_PRIORITY_ROUTINE) ( // change priority - // callback routine - IN PVOID Context -); - -typedef VOID - (STREAMAPI * PHW_QUERY_CLOCK_ROUTINE) ( // query clock - // callback routine - IN PHW_TIME_CONTEXT TimeContext -); - - -typedef BOOLEAN - (STREAMAPI * PHW_RESET_ADAPTER) ( // HwResetAdapter routine - IN PVOID DeviceExtension -); - - -// -// Minidriver stream notification types passed in to StreamClassStreamNotification -// follow. -// - -typedef enum _STREAM_MINIDRIVER_STREAM_NOTIFICATION_TYPE { - - // - // indicates that the minidriver is ready for the next stream data - // request - // - - ReadyForNextStreamDataRequest, - - // - // indicates that the minidriver is ready for the next stream control - // request - // - - ReadyForNextStreamControlRequest, - - // - // indicates that the hardware is starved for data - // - - HardwareStarved, - - // - // indicates that the specified STREAM SRB has completed - // - - StreamRequestComplete, - SignalMultipleStreamEvents, - SignalStreamEvent, - DeleteStreamEvent, - StreamNotificationMaximum -} STREAM_MINIDRIVER_STREAM_NOTIFICATION_TYPE, *PSTREAM_MINIDRIVER_STREAM_NOTIFICATION_TYPE; - -// -// Minidriver device notification types passed in to StreamClassDeviceNotification -// follow. -// - -// notes for SignalMultipleDeviceEvents and SignalMultipleDeviceInstanceEvents: -// -// SignalMultipleDeviceEvents: should only be used by single instance legacy drivers -// SignalMultipleDeviceInstanceEvents: this should be used by multiple instance drivers -// These types are used by StreamClassDeviceNotification(). -// -// When SignalMultipleDeviceEvents is used the function should be called -// as StreamClassDeviceNotification( SignalMultipleDeviceEvents, -// pHwDeviceExtension, -// pEventGUID, -// EventItem); -// -// When SignalMultipleDeviceInstanceEvents is used the function should be passed in -// as StreamClassDeviceNotification( SignalMultipleDeviceInstanceEvents, -// pHwDeviceExtension, -// pHwInstanceExtesnion, -// pEventGUID, -// EventItem); -// -typedef enum _STREAM_MINIDRIVER_DEVICE_NOTIFICATION_TYPE { - - // - // indicates that the minidriver is ready for the next device request - // - - ReadyForNextDeviceRequest, - - // - // indicates that the specified DEVICE SRB has completed - // - - DeviceRequestComplete, - SignalMultipleDeviceEvents, - SignalDeviceEvent, - DeleteDeviceEvent, -#if (NTDDI_VERSION >= NTDDI_WINXP) - SignalMultipleDeviceInstanceEvents, -#endif - DeviceNotificationMaximum -} STREAM_MINIDRIVER_DEVICE_NOTIFICATION_TYPE, *PSTREAM_MINIDRIVER_DEVICE_NOTIFICATION_TYPE; - -// -// Structure passed between minidriver initialization -// and STREAM class initialization -// - -typedef struct _HW_INITIALIZATION_DATA { -#if (NTDDI_VERSION >= NTDDI_WINXP) - union { - - // - // This first 4 bytes was used as a field for the size of this structure. - // We split this field into 2 ushorts to contain the size of this packet - // and a version number which stream class driver uses to recognize that - // the last two fields, NumNameExtensions and NameExtensionArray are valid - // information instead of uninitialized ramdom values. We hereby designate - // the StreamClassVersion to be 0x0200. - // - #define STREAM_CLASS_VERSION_20 0x0200 - ULONG HwInitializationDataSize; // Size of this structure, - struct { - USHORT SizeOfThisPacket; // Size of this packet. - USHORT StreamClassVersion; // Must be 0x0200 - }; - }; -#else - ULONG HwInitializationDataSize; // Size of this structure, - // used as version check. -#endif - - // - // minidriver routines follow - // - - PHW_INTERRUPT HwInterrupt;// minidriver's interrupt routine - PHW_RECEIVE_DEVICE_SRB HwReceivePacket; - // minidriver's request routine - PHW_CANCEL_SRB HwCancelPacket; - // minidriver's cancel routine - - PHW_REQUEST_TIMEOUT_HANDLER HwRequestTimeoutHandler; - // minidriver's timeout handler routine - - // - // minidriver resources follow - // - - ULONG DeviceExtensionSize; // size in bytes of the - // minidrivers - // per-adapter device extension data - ULONG PerRequestExtensionSize; // size of per-request - // workspace - ULONG PerStreamExtensionSize; // size of per-stream workspace - ULONG FilterInstanceExtensionSize; // size of the filter - // instance extension - - BOOLEAN BusMasterDMA; // Adapter uses bus master DMA for - // one or more streams - BOOLEAN Dma24BitAddresses; // TRUE indicates 24 bit DMA only - // (ISA) - ULONG BufferAlignment; // buffer alignment mask - - // - // the following BOOLEAN should be set to FALSE unless the minidriver - // can deal with multiprocessor reentrancy issues! - // - - BOOLEAN TurnOffSynchronization; - - // - // size of DMA buffer needed by minidriver. The minidriver may obtain - // its DMA buffer by calling StreamClassGetDmaBuffer while or after - // SRB_INITIALIZE_DEVICE is received. - // - - ULONG DmaBufferSize; - -#if (NTDDI_VERSION >= NTDDI_WINXP) - // - // A version 20 mini driver must specify the following two fields. - // It specifies a name for each type. The names will be used to create - // symbolic links for clients to open them. - // The names can be any wide char strings that the driver chooses. At - // OPEN_DEVICE_INSTANCE, a filter type index and the filter instance extension - // are specified. Consequent Srbs will contain the filter extension for the - // target filter instance. NameExtensionArray is a pointer to a constant array - // of pointers which point to constant wide char strings. - // - ULONG NumNameExtensions; - __field_ecount(NumNameExtensions) - PWCHAR *NameExtensionArray; -#else - ULONG Reserved[2]; // Reserved for future use -#endif - -} HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA; - -// -// Execution Priorities passed in to the StreamClassChangePriority function -// - -typedef enum _STREAM_PRIORITY { - High, // highest priority, IRQL equal to the - // adapter's ISR - Dispatch, // medium priority, IRQL equal to DISPATCH - // level - Low, // lowest priority, IRQL equal to PASSIVE or - // APC level - LowToHigh // go from low priority to high priority -} STREAM_PRIORITY, *PSTREAM_PRIORITY; - - -// -// the following are prototypes for services provided by the class driver -// - -VOID STREAMAPI - StreamClassScheduleTimer( - __in_opt PHW_STREAM_OBJECT StreamObject, - __in PVOID HwDeviceExtension, - __in ULONG NumberOfMicroseconds, - __in PHW_TIMER_ROUTINE TimerRoutine, - __in PVOID Context -); - -VOID STREAMAPI - StreamClassCallAtNewPriority( - __in_opt PHW_STREAM_OBJECT StreamObject, - __in PVOID HwDeviceExtension, - __in STREAM_PRIORITY Priority, - __in PHW_PRIORITY_ROUTINE PriorityRoutine, - __in PVOID Context -); - -VOID __cdecl - StreamClassStreamNotification( - __in STREAM_MINIDRIVER_STREAM_NOTIFICATION_TYPE NotificationType, - __in PHW_STREAM_OBJECT StreamObject, - ... -); - -VOID __cdecl - StreamClassDeviceNotification( - __in STREAM_MINIDRIVER_DEVICE_NOTIFICATION_TYPE NotificationType, - __in PVOID HwDeviceExtension, - ... -); - -STREAM_PHYSICAL_ADDRESS STREAMAPI - StreamClassGetPhysicalAddress( - __in PVOID HwDeviceExtension, - __in_opt PHW_STREAM_REQUEST_BLOCK HwSRB, - __in PVOID VirtualAddress, - __in STREAM_BUFFER_TYPE Type, - __out ULONG * Length -); - - -PVOID STREAMAPI - StreamClassGetDmaBuffer( - __in PVOID HwDeviceExtension -); - - -VOID __cdecl - StreamClassDebugPrint( - __in STREAM_DEBUG_LEVEL DebugPrintLevel, - __in PCCHAR DebugMessage, - ... -); - -VOID STREAMAPI - StreamClassDebugAssert( - __in IN PCHAR File, - __in IN ULONG Line, - __in IN PCHAR AssertText, - __in IN ULONG AssertValue -); -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS STREAMAPI - StreamClassRegisterAdapter( - __in PVOID Argument1, - __in PVOID Argument2, - __in PHW_INITIALIZATION_DATA HwInitializationData -); - -#define StreamClassRegisterMinidriver StreamClassRegisterAdapter - -VOID -StreamClassAbortOutstandingRequests( - __in PVOID HwDeviceExtension, - __in_opt PHW_STREAM_OBJECT HwStreamObject, - __in NTSTATUS Status -); - -VOID -StreamClassQueryMasterClock( - __in PHW_STREAM_OBJECT HwStreamObject, - __in HANDLE MasterClockHandle, - __in TIME_FUNCTION TimeFunction, - __in PHW_QUERY_CLOCK_ROUTINE ClockCallbackRoutine -); - -// -// The 1st parameter was PVOID HwDeviceExtension. It MUST be HwInstanceExtension -// for multi-instance and multi-filter types ( version 20 ) drivers. Legacy -// single instance drivers can continue to specify HwDeviceExtensionin as the -// 1st parameter. It can also specify HwInstanceExtension. -// -PKSEVENT_ENTRY -StreamClassGetNextEvent( - __in_opt PVOID HwInstanceExtension_OR_HwDeviceExtension, - __in_opt PHW_STREAM_OBJECT HwStreamObject, - __in_opt GUID * EventGuid, - __in ULONG EventItem, - __in_opt PKSEVENT_ENTRY CurrentEvent -); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -StreamClassRegisterFilterWithNoKSPins( - __in PDEVICE_OBJECT DeviceObject, - __in const GUID * InterfaceClassGUID, - __in ULONG PinCount, - __in_ecount(PinCount) BOOL * PinDirection, - __in_ecount(PinCount) KSPIN_MEDIUM * MediumList, - __in_ecount_opt(PinCount) GUID * CategoryList -); -__drv_maxIRQL(PASSIVE_LEVEL) -BOOLEAN STREAMAPI -StreamClassReadWriteConfig( - __in PVOID HwDeviceExtension, - __in BOOLEAN Read, - __inout_bcount(Length) PVOID Buffer, - __in ULONG Offset, - __in ULONG Length -); - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID STREAMAPI -StreamClassQueryMasterClockSync( - __in HANDLE MasterClockHandle, - __inout PHW_TIME_CONTEXT TimeContext -); - -VOID STREAMAPI -StreamClassCompleteRequestAndMarkQueueReady( - __in PHW_STREAM_REQUEST_BLOCK Srb -); - -#if (NTDDI_VERSION >= NTDDI_VISTA) -DECLSPEC_DEPRECATED_DDK -#endif -VOID STREAMAPI -StreamClassReenumerateStreams( - __in PVOID HwDeviceExtension, - __in ULONG StreamDescriptorSize -); - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -// -// A version 2.0 stream class mini driver must use this function -// in stead of StreamClassReenumerateStreams() -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -DECLSPEC_DEPRECATED_DDK -#endif -VOID STREAMAPI -StreamClassFilterReenumerateStreams( - __in PVOID HwInstanceExtension, - - __in ULONG StreamDescriptorSize -); - -#endif - -#endif //_STREAM_H - - - - diff --git a/pub/ddk/struchdr.h b/pub/ddk/struchdr.h deleted file mode 100644 index d18c358..0000000 --- a/pub/ddk/struchdr.h +++ /dev/null @@ -1,62 +0,0 @@ -/*++ - -Copyright (c) 1989 Microsoft Corporation - -Module Name: - - StrucHdr.h - -Abstract: - - This module predefines the structures for important data structures so that we can always talk about them.... - even though they're not defined yet. - -Author: -Revision History: - ---*/ - -#ifndef _RDBSSSTRUCHDR_ -#define _RDBSSSTRUCHDR_ - -#define IMPORTANT_STRUCTURE(x) struct _##x; typedef struct _##x *P##x - -typedef struct _NODE_TYPE_CODE_AND_SIZE *PNODE_TYPE_CODE_AND_SIZE; - -typedef struct _RX_PREFIX_ENTRY *PRX_PREFIX_ENTRY; -typedef struct _RX_PREFIX_TABLE *PRX_PREFIX_TABLE; - -typedef struct _RX_FSD_DISPATCH_VECTOR *PRX_FSD_DISPATCH_VECTOR; -typedef struct _RDBSS_DATA *PRDBSS_DATA; -typedef struct _RDBSS_EXPORTS *PRDBSS_EXPORTS; -typedef struct _VCB *PVCB; -typedef struct _RDBSS_DEVICE_OBJECT *PRDBSS_DEVICE_OBJECT; - -typedef struct _FILE_NAME_NODE *PFILE_NAME_NODE; -typedef struct _REPINNED_BCBS *PREPINNED_BCBS; -typedef struct _RDBSS_IO_CONTEXT *PRDBSS_IO_CONTEXT; -typedef struct _IO_RUNS *PIO_RUNS; -typedef struct _DELETE_CONTEXT *PDELETE_CONTEXT; -typedef struct _CLOSE_CONTEXT *PCLOSE_CONTEXT; -typedef struct _CLEAN_AND_DIRTY_VOLUME_PACKET *PCLEAN_AND_DIRTY_VOLUME_PACKET; - -typedef struct _SRV_CALL *PSRV_CALL; -typedef struct _NET_ROOT *PNET_ROOT; -typedef struct _V_NET_ROOT *PV_NET_ROOT; -typedef struct _NON_PAGED_FCB *PNON_PAGED_FCB; -typedef struct _FCB *PFCB; -typedef struct _SRV_OPEN *PSRV_OPEN; -typedef struct _FOBX *PFOBX; -typedef struct _RX_CONTEXT *PRX_CONTEXT; -typedef struct _LOWIO_CONTEXT *PLOWIO_CONTEXT; - -typedef struct _EA_RANGE *PEA_RANGE; - -typedef struct _MINIRDR_DISPATCH *PMINIRDR_DISPATCH; -typedef struct _RDBSS_EXPORTS *PRDBSS_EXPORTS; -typedef struct _MRX_SRVCALL_CALLBACK_CONTEXT *PMRX_SRVCALL_CALLBACK_CONTEXT; -typedef struct _MRX_SRVCALLDOWN_STRUCTURE *PMRX_SRVCALLDOWN_STRUCTURE; -typedef struct _MRX_CREATENETROOT_CONTEXT *PMRX_CREATENETROOT_CONTEXT; - -#endif // _RDBSSSTRUCHDR_ - diff --git a/pub/ddk/swenum.h b/pub/ddk/swenum.h deleted file mode 100644 index 82226e5..0000000 --- a/pub/ddk/swenum.h +++ /dev/null @@ -1,212 +0,0 @@ -/*++ - - Copyright (c) 1997 Microsoft Corporation - -Module Name: - - swenum.h - -Abstract: - Public header file and bus interface definition for the - software device enumerator. - ---*/ - -#if !defined( _SWENUM_ ) - -#define _SWENUM_ - -// Io controls - -#define IOCTL_SWENUM_INSTALL_INTERFACE CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x000, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_SWENUM_REMOVE_INTERFACE CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x001, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_SWENUM_GET_BUS_ID CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x002, METHOD_NEITHER, FILE_READ_ACCESS) - -// -// Io control related structures -// - -typedef struct _SWENUM_INSTALL_INTERFACE { - GUID DeviceId; - GUID InterfaceId; - WCHAR ReferenceString[1]; - -} SWENUM_INSTALL_INTERFACE, *PSWENUM_INSTALL_INTERFACE; - -#if defined( _KS_ ) - -#define STATIC_BUSID_SoftwareDeviceEnumerator STATIC_KSMEDIUMSETID_Standard -#define BUSID_SoftwareDeviceEnumerator KSMEDIUMSETID_Standard - -#else // !_KS_ - -#define STATIC_BUSID_SoftwareDeviceEnumerator \ - 0x4747B320L, 0x62CE, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 -#if defined(__cplusplus) && _MSC_VER >= 1100 -struct __declspec(uuid("4747B320-62CE-11CF-A5D6-28DB04C10000")) BUSID_SoftwareDeviceEnumerator; -#define BUSID_SoftwareDeviceEnumerator __uuidof(struct BUSID_SoftwareDeviceEnumerator) -#else -DEFINE_GUIDEX(BUSID_SoftwareDeviceEnumerator); -#endif // !(defined(__cplusplus) && _MSC_VER >= 1100) - -#endif // !_KS_ - -#if defined( _NTDDK_ ) - -typedef -VOID -(*PFNREFERENCEDEVICEOBJECT)( - __in PVOID Context - ); - -typedef -VOID -(*PFNDEREFERENCEDEVICEOBJECT)( - __in PVOID Context - ); - -typedef -NTSTATUS -(*PFNQUERYREFERENCESTRING)( - __in PVOID Context, - __inout PWCHAR *String - ); - -#define BUS_INTERFACE_SWENUM_VERSION 0x100 - -typedef struct _BUS_INTERFACE_SWENUM { - // - // Standard interface header - // - - INTERFACE Interface; - - // - // SWENUM bus interfaces - // - - PFNREFERENCEDEVICEOBJECT ReferenceDeviceObject; - PFNDEREFERENCEDEVICEOBJECT DereferenceDeviceObject; - PFNQUERYREFERENCESTRING QueryReferenceString; - -} BUS_INTERFACE_SWENUM, *PBUS_INTERFACE_SWENUM; - -#if defined(__cplusplus) -extern "C" { -#endif // defined(__cplusplus) - -#if defined( _KS_ ) - -KSDDKAPI -NTSTATUS -NTAPI -KsQuerySoftwareBusInterface( - __in PDEVICE_OBJECT PnpDeviceObject, - __out PBUS_INTERFACE_SWENUM BusInterface - ); - -KSDDKAPI -NTSTATUS -NTAPI -KsReferenceSoftwareBusObject( - __in KSDEVICE_HEADER Header - ); - -KSDDKAPI -VOID -NTAPI -KsDereferenceSoftwareBusObject( - __in KSDEVICE_HEADER Header - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -KSDDKAPI -NTSTATUS -NTAPI -KsCreateBusEnumObject( - __in PWSTR BusIdentifier, - __in PDEVICE_OBJECT BusDeviceObject, - __in PDEVICE_OBJECT PhysicalDeviceObject, - __in_opt PDEVICE_OBJECT PnpDeviceObject, - __in_opt REFGUID InterfaceGuid, - __in_opt PWSTR ServiceRelativePath - ); - -KSDDKAPI -NTSTATUS -NTAPI -KsGetBusEnumIdentifier( - __inout PIRP Irp - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -KSDDKAPI -NTSTATUS -NTAPI -KsGetBusEnumPnpDeviceObject( - __in PDEVICE_OBJECT DeviceObject, - __out PDEVICE_OBJECT *PnpDeviceObject - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -KSDDKAPI -NTSTATUS -NTAPI -KsInstallBusEnumInterface( - __in PIRP Irp - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -KSDDKAPI -NTSTATUS -NTAPI -KsIsBusEnumChildDevice( - __in PDEVICE_OBJECT DeviceObject, - __out PBOOLEAN ChildDevice - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -KSDDKAPI -NTSTATUS -NTAPI -KsRemoveBusEnumInterface( - __in PIRP Irp - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -KSDDKAPI -NTSTATUS -NTAPI -KsServiceBusEnumPnpRequest( - __in PDEVICE_OBJECT DeviceObject, - __inout PIRP Irp - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -KSDDKAPI -NTSTATUS -NTAPI -KsServiceBusEnumCreateRequest( - __in PDEVICE_OBJECT DeviceObject, - __inout PIRP Irp - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -KSDDKAPI -NTSTATUS -NTAPI -KsGetBusEnumParentFDOFromChildPDO( - __in PDEVICE_OBJECT DeviceObject, - __out PDEVICE_OBJECT *FunctionalDeviceObject - ); - -#endif // _KS_ - -#if defined(__cplusplus) -} -#endif // defined(__cplusplus) - -#endif // _NTDDK_ - -#endif // !_SWENUM_ - diff --git a/pub/ddk/syncdeviceservice.h b/pub/ddk/syncdeviceservice.h deleted file mode 100644 index 89f8f6d..0000000 --- a/pub/ddk/syncdeviceservice.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * SyncDeviceService.h - * - * Contains definitions for the general sync properties and formats - * - * Copyright (c) Microsoft Corporation, All Rights Reserved. - * - */ - -#ifndef _SYNCDEVICESERVICE_H_ -#define _SYNCDEVICESERVICE_H_ - -/*****************************************************************************/ -/* Sync Service Properties */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(NAMESPACE_SyncSvc, - 0x703d392c, 0x532c, 0x4607, 0x91, 0x58, 0x9c, 0xea, 0x74, 0x2f, 0x3a, 0x16); - - -/* PKEY_SyncSvc_SyncFormat - * - * Indicates the format GUID for the object format that is to be used in the - * sync operation. - * - * Type: UInt128 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_SyncSvc_SyncFormat, - 0x703d392c, 0x532c, 0x4607, 0x91, 0x58, 0x9c, 0xea, 0x74, 0x2f, 0x3a, 0x16, - 2); - -#define NAME_SyncSvc_SyncFormat L"SyncFormat" - - -/* PKEY_SyncSvc_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_DEVSVCPROPKEY(PKEY_SyncSvc_LocalOnlyDelete, - 0x703d392c, 0x532c, 0x4607, 0x91, 0x58, 0x9c, 0xea, 0x74, 0x2f, 0x3a, 0x16, - 3); - -#define NAME_SyncSvc_LocalOnlyDelete L"LocalOnlyDelete" - - -/* PKEY_SyncSvc_FilterType - * - * Value describing type of the filter - * - * Type: UInt8 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_SyncSvc_FilterType, - 0x703d392c, 0x532c, 0x4607, 0x91, 0x58, 0x9c, 0xea, 0x74, 0x2f, 0x3a, 0x16, - 4); - -#define NAME_SyncSvc_FilterType L"FilterType" - -#define SYNCSVC_FILTER_NONE 0 -#define SYNCSVC_FILTER_CONTACTS_WITH_PHONE 1 -#define SYNCSVC_FILTER_TASK_ACTIVE 2 -#define SYNCSVC_FILTER_CALENDAR_WINDOW_WITH_RECURRENCE 3 - - -/* PKEY_SyncSvc_SyncObjectReferences - * - * Value describing whether object references should be included as part of - * the sync process or not - * - * Type: UInt8 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_SyncSvc_SyncObjectReferences, - 0x703d392c, 0x532c, 0x4607, 0x91, 0x58, 0x9c, 0xea, 0x74, 0x2f, 0x3a, 0x16, - 5); - -#define NAME_SyncSvc_SyncObjectReferences L"SyncObjectReferences" - -#define ENUM_SyncSvc_SyncObjectReferencesDisabled 0x00 -#define ENUM_SyncSvc_SyncObjectReferencesEnabled 0xff - - -/*****************************************************************************/ -/* Sync Service Object Properties */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(NAMESPACE_SyncObj, - 0x37364f58, 0x2f74, 0x4981, 0x99, 0xa5, 0x7a, 0xe2, 0x8a, 0xee, 0xe3, 0x19); - -/* PKEY_SyncObj_LastAuthorProxyID - * - * Contains a GUID inidcating the proxy ID of the last proxy to author the - * object - * - * Type: UInt128 - * Form: None - */ - -DEFINE_DEVSVCPROPKEY(PKEY_SyncObj_LastAuthorProxyID, - 0x37364f58, 0x2f74, 0x4981, 0x99, 0xa5, 0x7a, 0xe2, 0x8a, 0xee, 0xe3, 0x19, - 2); - -#define NAME_SyncObj_LastAuthorProxyID L"LastAuthorProxyID" - -/*****************************************************************************/ -/* Sync Service Methods */ -/*****************************************************************************/ - -/* METHOD_SyncSvc_BeginSync - */ - -DEFINE_DEVSVCGUID(METHOD_SyncSvc_BeginSync, - 0x63803e07, 0xc713, 0x45d3, 0x81, 0x19, 0x34, 0x79, 0xb3, 0x1d, 0x35, 0x92); - -#define NAME_SyncSvc_BeginSync L"BeginSync" - -/* METHOD_SyncSvc_EndSync - */ - -DEFINE_DEVSVCGUID(METHOD_SyncSvc_EndSync, - 0x40f3f0f7, 0xa539, 0x422e, 0x98, 0xdd, 0xfd, 0x8d, 0x38, 0x5c, 0x88, 0x49); - -#define NAME_SyncSvc_EndSync L"EndSync" - -#endif /* _SYNCDEVICESERVICE_H_ */ - - diff --git a/pub/ddk/taskdeviceservice.h b/pub/ddk/taskdeviceservice.h deleted file mode 100644 index 356533b..0000000 --- a/pub/ddk/taskdeviceservice.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * TaskDeviceService.h - * - * Contains declarations for the Task Device Service - * - * Copyright (c) Microsoft Corporation, All Rights Reserved. - * - */ - -#ifndef _TASKDEVICESERVICE_H_ -#define _TASKDEVICESERVICE_H_ - -#include -#include -#include - - -/*****************************************************************************/ -/* Task Service Info */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(SERVICE_Tasks, - 0xBB340C54, 0xB5C6, 0x491D, 0x88, 0x27, 0x28, 0xD0, 0xE7, 0x63, 0x19, 0x03); - -#define NAME_TasksSvc L"Tasks" -#define TYPE_TasksSvc DEVSVCTYPE_DEFAULT - - -/*****************************************************************************/ -/* Task Service Properties */ -/*****************************************************************************/ - -#define PKEY_TasksSvc_SyncActiveOnly PKEY_SyncSvc_FilterType - - -/*****************************************************************************/ -/* Task Service Object Formats */ -/*****************************************************************************/ - -/* FORMAT_AbstractTask - */ - -DEFINE_DEVSVCGUID(FORMAT_AbstractTask, - 0x522979c0, 0x74cf, 0x44ab, 0x97, 0x54, 0x55, 0xbc, 0x59, 0x6a, 0x67, 0xdf); - -#define NAME_AbstractTask L"AbstractTask" - - -/*****************************************************************************/ -/* Task Service Object Property Keys */ -/*****************************************************************************/ - -DEFINE_DEVSVCGUID(NAMESPACE_TaskObj, - 0xE354E95E, 0xD8A0, 0x4637, 0xA0, 0x3A, 0x0C, 0xB2, 0x68, 0x38, 0xDB, 0xC7); - -/* PKEY_TaskObj_ReminderDateTime - * - * Type: String - * Form: DateTime - */ - -DEFINE_DEVSVCPROPKEY(PKEY_TaskObj_ReminderDateTime, - 0xE354E95E, 0xD8A0, 0x4637, 0xA0, 0x3A, 0x0C, 0xB2, 0x68, 0x38, 0xDB, 0xC7, - 13); - -#define NAME_TaskObj_ReminderDateTime L"ReminderDateTime" - - -/* PKEY_TaskObj_Complete - * - * Type: UInt8 - * Form: Enum - */ - -DEFINE_DEVSVCPROPKEY(PKEY_TaskObj_Complete, - 0xE354E95E, 0xD8A0, 0x4637, 0xA0, 0x3A, 0x0C, 0xB2, 0x68, 0x38, 0xDB, 0xC7, - 14); - -#define NAME_TaskObj_Complete L"Complete" - -#define ENUM_TaskObj_CompleteFalse 0x00 -#define ENUM_TaskObj_CompleteTrue 0xff - - -/* TaskObj.BeginDate - * - * Contains the date that the task should start- the date is assumed to - * be relative to the current device time zone - * - * Type: String - * Form: ISO8601 Date - */ - -DEFINE_DEVSVCPROPKEY(PKEY_TaskObj_BeginDate, - 0xE354E95E, 0xD8A0, 0x4637, 0xA0, 0x3A, 0x0C, 0xB2, 0x68, 0x38, 0xDB, 0xC7, - 15); - -#define NAME_TaskObj_BeginDate L"BeginDate" - - -/* TaskObj.EndDate - * - * Contains the date that the task should end- the date is assumed to be - * relative to the current device time zone - * - * Type: String - * Form: ISO8601 Date - */ - -DEFINE_DEVSVCPROPKEY(PKEY_TaskObj_EndDate, - 0xE354E95E, 0xD8A0, 0x4637, 0xA0, 0x3A, 0x0C, 0xB2, 0x68, 0x38, 0xDB, 0xC7, - 16); - -#define NAME_TaskObj_EndDate L"EndDate" - -#endif /* _TASKDEVICESERVICE_H_ */ - - diff --git a/pub/ddk/tdikrnl.h b/pub/ddk/tdikrnl.h deleted file mode 100644 index a20f980..0000000 --- a/pub/ddk/tdikrnl.h +++ /dev/null @@ -1,1473 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - tdikrnl.h - -Abstract: - - This header file contains interface definitions for NT transport - providers running in kernel mode. This interface is documented in the - NT Transport Driver Interface (TDI) Specification, Version 2. - -Revision History: - ---*/ - -#ifndef _TDI_KRNL_ -#define _TDI_KRNL_ - -#pragma once - -#include // get the user mode includes -#include - -#pragma warning(push) -#pragma warning(disable:4201) // nameless struct/union - -// -// In this TDI, a kernel mode client calls TDI using IoCallDriver with the -// current Irp stack pointer set to 16 bytes of pointers to other structures. -// each of the supported NtDeviceIoControlFile analogs has a somehat different -// structure, laid out below. -// -// The IrpSP information passed by kernel mode clients looks like: -// - -typedef struct _TDI_REQUEST_KERNEL { - ULONG_PTR RequestFlags; - PTDI_CONNECTION_INFORMATION RequestConnectionInformation; - PTDI_CONNECTION_INFORMATION ReturnConnectionInformation; - PVOID RequestSpecific; -} TDI_REQUEST_KERNEL, *PTDI_REQUEST_KERNEL; - -// -// defined request codes for the kernel clients. We make these the same -// as the IOCTL codes mostly for convenience; either can be used with -// the same results. -// - -#define TDI_ASSOCIATE_ADDRESS (0x01) -#define TDI_DISASSOCIATE_ADDRESS (0x02) -#define TDI_CONNECT (0x03) -#define TDI_LISTEN (0x04) -#define TDI_ACCEPT (0x05) -#define TDI_DISCONNECT (0x06) -#define TDI_SEND (0x07) -#define TDI_RECEIVE (0x08) -#define TDI_SEND_DATAGRAM (0x09) -#define TDI_RECEIVE_DATAGRAM (0x0A) -#define TDI_SET_EVENT_HANDLER (0x0B) -#define TDI_QUERY_INFORMATION (0x0C) -#define TDI_SET_INFORMATION (0x0D) -#define TDI_ACTION (0x0E) - -#define TDI_DIRECT_SEND (0x27) -#define TDI_DIRECT_SEND_DATAGRAM (0x29) -#define TDI_DIRECT_ACCEPT (0x2A) - -// -// TdiOpenAddress (Not Used) -// TdiCloseAddress (Not Used) -// TdiOpenConnection (Not Used) -// TdiCloseConnection (Not Used) -// - -// -// some useful constants for comparison when determining the file type; -// not required. -// - -#define TDI_TRANSPORT_ADDRESS_FILE 1 -#define TDI_CONNECTION_FILE 2 -#define TDI_CONTROL_CHANNEL_FILE 3 - -// -// Internal TDI IOCTLS -// - -#define IOCTL_TDI_QUERY_DIRECT_SEND_HANDLER _TDI_CONTROL_CODE( 0x80, METHOD_NEITHER ) -#define IOCTL_TDI_QUERY_DIRECT_SENDDG_HANDLER _TDI_CONTROL_CODE( 0x81, METHOD_NEITHER ) - -// -// TdiAssociateAddress -// - -typedef struct _TDI_REQUEST_KERNEL_ASSOCIATE { - HANDLE AddressHandle; -} TDI_REQUEST_KERNEL_ASSOCIATE, *PTDI_REQUEST_KERNEL_ASSOCIATE; - -// -// TdiDisassociateAddress -- None supplied -// - -typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_DISASSOCIATE, - *PTDI_REQUEST_KERNEL_DISASSOCIATE; - -// -// TdiConnect uses the structure given above (TDI_REQUEST_KERNEL); it's -// defined again below for convenience -// - -typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_CONNECT, - *PTDI_REQUEST_KERNEL_CONNECT; - -// -// TdiDisconnect uses the structure given above (TDI_REQUEST_KERNEL); it's -// defined again below for convenience -// - -typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_DISCONNECT, - *PTDI_REQUEST_KERNEL_DISCONNECT; - -// -// TdiListen uses the structure given above (TDI_REQUEST_KERNEL); it's -// defined again below for convenience -// - -typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_LISTEN, - *PTDI_REQUEST_KERNEL_LISTEN; - -// -// TdiAccept -// - -typedef struct _TDI_REQUEST_KERNEL_ACCEPT { - PTDI_CONNECTION_INFORMATION RequestConnectionInformation; - PTDI_CONNECTION_INFORMATION ReturnConnectionInformation; -} TDI_REQUEST_KERNEL_ACCEPT, *PTDI_REQUEST_KERNEL_ACCEPT; - -// -// TdiSend -// - -typedef struct _TDI_REQUEST_KERNEL_SEND { - ULONG SendLength; - ULONG SendFlags; -} TDI_REQUEST_KERNEL_SEND, *PTDI_REQUEST_KERNEL_SEND; - -// -// TdiReceive -// - -typedef struct _TDI_REQUEST_KERNEL_RECEIVE { - ULONG ReceiveLength; - ULONG ReceiveFlags; -} TDI_REQUEST_KERNEL_RECEIVE, *PTDI_REQUEST_KERNEL_RECEIVE; - -// -// TdiSendDatagram -// - -typedef struct _TDI_REQUEST_KERNEL_SENDDG { - ULONG SendLength; - __field_bcount(SendLength) PTDI_CONNECTION_INFORMATION SendDatagramInformation; -} TDI_REQUEST_KERNEL_SENDDG, *PTDI_REQUEST_KERNEL_SENDDG; - -// -// TdiReceiveDatagram -// - -typedef struct _TDI_REQUEST_KERNEL_RECEIVEDG { - ULONG ReceiveLength; - PTDI_CONNECTION_INFORMATION ReceiveDatagramInformation; - PTDI_CONNECTION_INFORMATION ReturnDatagramInformation; - ULONG ReceiveFlags; -} TDI_REQUEST_KERNEL_RECEIVEDG, *PTDI_REQUEST_KERNEL_RECEIVEDG; - -// -// TdiSetEventHandler -// - -typedef struct _TDI_REQUEST_KERNEL_SET_EVENT { - LONG EventType; - PVOID EventHandler; - PVOID EventContext; -} TDI_REQUEST_KERNEL_SET_EVENT, *PTDI_REQUEST_KERNEL_SET_EVENT; - -// -// TdiQueryInformation -// - -typedef struct _TDI_REQUEST_KERNEL_QUERY_INFO { - LONG QueryType; - PTDI_CONNECTION_INFORMATION RequestConnectionInformation; -} TDI_REQUEST_KERNEL_QUERY_INFORMATION, *PTDI_REQUEST_KERNEL_QUERY_INFORMATION; - -// -// TdiSetInformation -// - -typedef struct _TDI_REQUEST_KERNEL_SET_INFO { - LONG SetType; - PTDI_CONNECTION_INFORMATION RequestConnectionInformation; -} TDI_REQUEST_KERNEL_SET_INFORMATION, *PTDI_REQUEST_KERNEL_SET_INFORMATION; - -// -// Event types that are known -// - -#define TDI_EVENT_CONNECT ((USHORT)0) // TDI_IND_CONNECT event handler. -#define TDI_EVENT_DISCONNECT ((USHORT)1) // TDI_IND_DISCONNECT event handler. -#define TDI_EVENT_ERROR ((USHORT)2) // TDI_IND_ERROR event handler. -#define TDI_EVENT_RECEIVE ((USHORT)3) // TDI_IND_RECEIVE event handler. -#define TDI_EVENT_RECEIVE_DATAGRAM ((USHORT)4) // TDI_IND_RECEIVE_DATAGRAM event handler. -#define TDI_EVENT_RECEIVE_EXPEDITED ((USHORT)5) // TDI_IND_RECEIVE_EXPEDITED event handler. -#define TDI_EVENT_SEND_POSSIBLE ((USHORT)6) // TDI_IND_SEND_POSSIBLE event handler -#define TDI_EVENT_CHAINED_RECEIVE ((USHORT)7) // TDI_IND_CHAINED_RECEIVE event handler. -#define TDI_EVENT_CHAINED_RECEIVE_DATAGRAM ((USHORT)8) // TDI_IND_CHAINED_RECEIVE_DATAGRAM event handler. -#define TDI_EVENT_CHAINED_RECEIVE_EXPEDITED ((USHORT)9) // TDI_IND_CHAINED_RECEIVE_EXPEDITED event handler. -#define TDI_EVENT_ERROR_EX ((USHORT)10) // TDI_IND_UNREACH_ERROR event handler. - - -// -// indicate connection event prototype. This is invoked when a request for -// connection has been received by the provider and the user wishes to either -// accept or reject that request. -// - -typedef -NTSTATUS -(*PTDI_IND_CONNECT)( - __in_opt PVOID TdiEventContext, - __in LONG RemoteAddressLength, - __in_bcount(RemoteAddressLength) PVOID RemoteAddress, - __in LONG UserDataLength, - __in_bcount_opt(UserDataLength) PVOID UserData, - __in LONG OptionsLength, - __in_bcount_opt(OptionsLength) PVOID Options, - __out CONNECTION_CONTEXT *ConnectionContext, - __out PIRP *AcceptIrp - ); - -NTSTATUS -TdiDefaultConnectHandler ( - __in_opt PVOID TdiEventContext, - __in LONG RemoteAddressLength, - __in_bcount(RemoteAddressLength) PVOID RemoteAddress, - __in LONG UserDataLength, - __in_bcount_opt(UserDataLength) PVOID UserData, - __in LONG OptionsLength, - __in_bcount_opt(OptionsLength) PVOID Options, - __out CONNECTION_CONTEXT *ConnectionContext, - __out PIRP *AcceptIrp - ); - -// -// Disconnection indication prototype. This is invoked when a connection is -// being disconnected for a reason other than the user requesting it. Note that -// this is a change from TDI V1, which indicated only when the remote caused -// a disconnection. Any non-directed disconnection will cause this indication. -// - -typedef -NTSTATUS -(*PTDI_IND_DISCONNECT)( - __in_opt PVOID TdiEventContext, - __in_opt CONNECTION_CONTEXT ConnectionContext, - __in LONG DisconnectDataLength, - __in_bcount_opt(DisconnectDataLength) PVOID DisconnectData, - __in LONG DisconnectInformationLength, - __in_bcount_opt(DisconnectInformationLength) PVOID DisconnectInformation, - __in ULONG DisconnectFlags - ); - -NTSTATUS -TdiDefaultDisconnectHandler ( - __in_opt PVOID TdiEventContext, - __in_opt CONNECTION_CONTEXT ConnectionContext, - __in LONG DisconnectDataLength, - __in_bcount_opt(DisconnectDataLength) PVOID DisconnectData, - __in LONG DisconnectInformationLength, - __in_bcount_opt(DisconnectInformationLength) PVOID DisconnectInformation, - __in ULONG DisconnectFlags - ); - -// -// A protocol error has occurred when this indication happens. This indication -// occurs only for errors of the worst type; the address this indication is -// delivered to is no longer usable for protocol-related operations, and -// should not be used for operations henceforth. All connections associated -// it are invalid. -// For NetBIOS-type providers, this indication is also delivered when a name -// in conflict or duplicate name occurs. -// - -typedef -NTSTATUS -(*PTDI_IND_ERROR)( - __in_opt PVOID TdiEventContext, // the endpoint's file object. - __in NTSTATUS Status // status code indicating error type. - ); - - - -typedef -NTSTATUS -(*PTDI_IND_ERROR_EX)( - __in_opt PVOID TdiEventContext, // the endpoint's file object. - __in NTSTATUS Status, // status code indicating error type. - __in PVOID Buffer - ); - - -NTSTATUS -TdiDefaultErrorHandler ( - __in_opt PVOID TdiEventContext, // the endpoint's file object. - __in NTSTATUS Status // status code indicating error type. - ); - -// -// TDI_IND_RECEIVE indication handler definition. This client routine is -// called by the transport provider when a connection-oriented TSDU is received -// that should be presented to the client. -// - -typedef -NTSTATUS -(*PTDI_IND_RECEIVE)( - __in_opt PVOID TdiEventContext, - __in_opt CONNECTION_CONTEXT ConnectionContext, - __in ULONG ReceiveFlags, - __in ULONG BytesIndicated, - __in ULONG BytesAvailable, - __out ULONG *BytesTaken, - __in PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes - __out_opt PIRP *IoRequestPacket // TdiReceive IRP if MORE_PROCESSING_REQUIRED. - ); - -NTSTATUS -TdiDefaultReceiveHandler ( - __in_opt PVOID TdiEventContext, - __in_opt CONNECTION_CONTEXT ConnectionContext, - __in ULONG ReceiveFlags, - __in ULONG BytesIndicated, - __in ULONG BytesAvailable, - __out ULONG *BytesTaken, - __in PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes - __out_opt PIRP *IoRequestPacket // TdiReceive IRP if MORE_PROCESSING_REQUIRED. - ); - -// -// TDI_IND_RECEIVE_DATAGRAM indication handler definition. This client routine -// is called by the transport provider when a connectionless TSDU is received -// that should be presented to the client. -// - -typedef -NTSTATUS -(*PTDI_IND_RECEIVE_DATAGRAM)( - __in_opt PVOID TdiEventContext, // the event context - __in LONG SourceAddressLength, // length of the originator of the datagram - __in_bcount(SourceAddressLength) PVOID SourceAddress, // originator of the datagram - __in LONG OptionsLength, // options for the receive - __in_bcount_opt(OptionsLength) PVOID Options, // - __in ULONG ReceiveDatagramFlags, // - __in ULONG BytesIndicated, // number of bytes this indication - __in ULONG BytesAvailable, // number of bytes in complete Tsdu - __out ULONG *BytesTaken, // number of bytes used - __in PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes - __out_opt PIRP *IoRequestPacket // TdiReceive IRP if MORE_PROCESSING_REQUIRED. - ); - -NTSTATUS -TdiDefaultRcvDatagramHandler ( - __in_opt PVOID TdiEventContext, // the event context - __in LONG SourceAddressLength, // length of the originator of the datagram - __in_bcount(SourceAddressLength) PVOID SourceAddress, // originator of the datagram - __in LONG OptionsLength, // options for the receive - __in_bcount_opt(OptionsLength) PVOID Options, // - __in ULONG ReceiveDatagramFlags, // - __in ULONG BytesIndicated, // number of bytes this indication - __in ULONG BytesAvailable, // number of bytes in complete Tsdu - __out ULONG *BytesTaken, // number of bytes used - __in PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes - __out_opt PIRP *IoRequestPacket // TdiReceive IRP if MORE_PROCESSING_REQUIRED. - ); - -// -// This indication is delivered if expedited data is received on the connection. -// This will only occur in providers that support expedited data. -// - -typedef -NTSTATUS -(*PTDI_IND_RECEIVE_EXPEDITED)( - __in_opt PVOID TdiEventContext, - __in_opt CONNECTION_CONTEXT ConnectionContext, - __in ULONG ReceiveFlags, // - __in ULONG BytesIndicated, // number of bytes in this indication - __in ULONG BytesAvailable, // number of bytes in complete Tsdu - __out ULONG *BytesTaken, // number of bytes used by indication routine - __in PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes - __out_opt PIRP *IoRequestPacket // TdiReceive IRP if MORE_PROCESSING_REQUIRED. - ); - -NTSTATUS -TdiDefaultRcvExpeditedHandler ( - __in_opt PVOID TdiEventContext, - __in_opt CONNECTION_CONTEXT ConnectionContext, - __in ULONG ReceiveFlags, // - __in ULONG BytesIndicated, // number of bytes in this indication - __in ULONG BytesAvailable, // number of bytes in complete Tsdu - __out ULONG *BytesTaken, // number of bytes used by indication routine - __in PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes - __out_opt PIRP *IoRequestPacket // TdiReceive IRP if MORE_PROCESSING_REQUIRED. - ); - -// -// TDI_IND_CHAINED_RECEIVE indication handler definition. This client routine -// is called by the transport provider when a connection-oriented TSDU is -// received that should be presented to the client. The TSDU is stored in an -// MDL chain. The client may take ownership of the TSDU and return it at a -// later time. -// - -typedef -NTSTATUS -(*PTDI_IND_CHAINED_RECEIVE)( - __in_opt PVOID TdiEventContext, - __in_opt CONNECTION_CONTEXT ConnectionContext, - __in ULONG ReceiveFlags, - __in ULONG ReceiveLength, // length of client data in TSDU - __in ULONG StartingOffset, // offset of start of client data in TSDU - __in PMDL Tsdu, // TSDU data chain - __in PVOID TsduDescriptor // for call to TdiReturnChainedReceives - ); - -NTSTATUS -TdiDefaultChainedReceiveHandler ( - __in_opt PVOID TdiEventContext, - __in_opt CONNECTION_CONTEXT ConnectionContext, - __in ULONG ReceiveFlags, - __in ULONG ReceiveLength, // length of client data in TSDU - __in ULONG StartingOffset, // offset of start of client data in TSDU - __in PMDL Tsdu, // TSDU data chain - __in PVOID TsduDescriptor // for call to TdiReturnChainedReceives - ); - -// -// TDI_IND_CHAINED_RECEIVE_DATAGRAM indication handler definition. This client -// routine is called by the transport provider when a connectionless TSDU is -// received that should be presented to the client. The TSDU is stored in an -// MDL chain. The client may take ownership of the TSDU and return it at a -// later time. -// - -typedef -NTSTATUS -(*PTDI_IND_CHAINED_RECEIVE_DATAGRAM)( - __in_opt PVOID TdiEventContext, // the event context - __in LONG SourceAddressLength, // length of the originator of the datagram - __in_bcount(SourceAddressLength) PVOID SourceAddress, // originator of the datagram - __in LONG OptionsLength, // options for the receive - __in_bcount_opt(OptionsLength) PVOID Options, // - __in ULONG ReceiveDatagramFlags, // - __in ULONG ReceiveDatagramLength, // length of client data in TSDU - __in ULONG StartingOffset, // offset of start of client data in TSDU - __in PMDL Tsdu, // TSDU data chain - __in PVOID TsduDescriptor // for call to TdiReturnChainedReceives - ); - -NTSTATUS -TdiDefaultChainedRcvDatagramHandler ( - __in_opt PVOID TdiEventContext, // the event context - __in LONG SourceAddressLength, // length of the originator of the datagram - __in_bcount(SourceAddressLength) PVOID SourceAddress, // originator of the datagram - __in LONG OptionsLength, // options for the receive - __in_bcount_opt(OptionsLength) PVOID Options, // - __in ULONG ReceiveDatagramFlags, // - __in ULONG ReceiveDatagramLength, // length of client data in TSDU - __in ULONG StartingOffset, // offset of start of client data in TSDU - __in PMDL Tsdu, // TSDU data chain - __in PVOID TsduDescriptor // for call to TdiReturnChainedReceives - ); - -// -// This indication is delivered if expedited data is received on the connection. -// This will only occur in providers that support expedited data. The TSDU is -// stored in an MDL chain. The client may take ownership of the TSDU and -// return it at a later time. -// - -typedef -NTSTATUS -(*PTDI_IND_CHAINED_RECEIVE_EXPEDITED)( - __in_opt PVOID TdiEventContext, - __in_opt CONNECTION_CONTEXT ConnectionContext, - __in ULONG ReceiveFlags, - __in ULONG ReceiveLength, // length of client data in TSDU - __in ULONG StartingOffset, // offset of start of client data in TSDU - __in PMDL Tsdu, // TSDU data chain - __in PVOID TsduDescriptor// for call to TdiReturnChainedReceives - ); - -NTSTATUS -TdiDefaultChainedRcvExpeditedHandler ( - __in_opt PVOID TdiEventContext, - __in_opt CONNECTION_CONTEXT ConnectionContext, - __in ULONG ReceiveFlags, - __in ULONG ReceiveLength, // length of client data in TSDU - __in ULONG StartingOffset, // offset of start of client data in TSDU - __in PMDL Tsdu, // TSDU data chain - __in PVOID TsduDescriptor// for call to TdiReturnChainedReceives - ); - -// -// This indication is delivered if there is room for a send in the buffer of -// a buffering protocol. -// - -typedef -NTSTATUS -(*PTDI_IND_SEND_POSSIBLE)( - __in_opt PVOID TdiEventContext, - __in_opt PVOID ConnectionContext, - __in ULONG BytesAvailable); - -NTSTATUS -TdiDefaultSendPossibleHandler ( - __in_opt PVOID TdiEventContext, - __in_opt PVOID ConnectionContext, - __in ULONG BytesAvailable); - -// -// defined MACROS to allow the kernel mode client to easily build an IRP for -// any function. -// - -#define TdiBuildAssociateAddress(Irp, DevObj, FileObj, CompRoutine, Contxt, AddrHandle) \ - { \ - PTDI_REQUEST_KERNEL_ASSOCIATE p; \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_ASSOCIATE_ADDRESS; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL_ASSOCIATE)&_IRPSP->Parameters; \ - p->AddressHandle = (HANDLE)(AddrHandle); \ - } - -#define TdiBuildDisassociateAddress(Irp, DevObj, FileObj, CompRoutine, Contxt) \ - { \ - PTDI_REQUEST_KERNEL_DISASSOCIATE p; \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_DISASSOCIATE_ADDRESS; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL_DISASSOCIATE)&_IRPSP->Parameters; \ - } - -#define TdiBuildConnect(Irp, DevObj, FileObj, CompRoutine, Contxt, Time, RequestConnectionInfo, ReturnConnectionInfo)\ - { \ - PTDI_REQUEST_KERNEL p; \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_CONNECT; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL)&_IRPSP->Parameters; \ - p->RequestConnectionInformation = RequestConnectionInfo; \ - p->ReturnConnectionInformation = ReturnConnectionInfo; \ - p->RequestSpecific = (PVOID)Time; \ - } - -#define TdiBuildListen(Irp, DevObj, FileObj, CompRoutine, Contxt, Flags, RequestConnectionInfo, ReturnConnectionInfo)\ - { \ - PTDI_REQUEST_KERNEL p; \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_LISTEN; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL)&_IRPSP->Parameters; \ - p->RequestFlags = Flags; \ - p->RequestConnectionInformation = RequestConnectionInfo; \ - p->ReturnConnectionInformation = ReturnConnectionInfo; \ - } - -#define TdiBuildAccept(Irp, DevObj, FileObj, CompRoutine, Contxt, RequestConnectionInfo, ReturnConnectionInfo)\ - { \ - PTDI_REQUEST_KERNEL_ACCEPT p; \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_ACCEPT; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL_ACCEPT)&_IRPSP->Parameters; \ - p->RequestConnectionInformation = RequestConnectionInfo; \ - p->ReturnConnectionInformation = ReturnConnectionInfo; \ - } - -#if (NTDDI_VERSION < NTDDI_WINXP) -#define TdiBuildDirectAccept(Irp, DevObj, FileObj, CompRoutine, Contxt, RequestConnectionInfo, ReturnConnectionInfo)\ - { \ - PTDI_REQUEST_KERNEL_ACCEPT p; \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_DIRECT_ACCEPT; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL_ACCEPT)&_IRPSP->Parameters; \ - p->RequestConnectionInformation = RequestConnectionInfo; \ - p->ReturnConnectionInformation = ReturnConnectionInfo; \ - } -#endif - -#define TdiBuildDisconnect(Irp, DevObj, FileObj, CompRoutine, Contxt, Time, Flags, RequestConnectionInfo, ReturnConnectionInfo)\ - { \ - PTDI_REQUEST_KERNEL p; \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_DISCONNECT; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL)&_IRPSP->Parameters; \ - p->RequestFlags = Flags; \ - p->RequestConnectionInformation = RequestConnectionInfo; \ - p->ReturnConnectionInformation = ReturnConnectionInfo; \ - p->RequestSpecific = (PVOID)Time; \ - } - -#define TdiBuildReceive(Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, InFlags, ReceiveLen)\ - { \ - PTDI_REQUEST_KERNEL_RECEIVE p; \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_RECEIVE; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL_RECEIVE)&_IRPSP->Parameters; \ - p->ReceiveFlags = InFlags; \ - p->ReceiveLength = ReceiveLen; \ - Irp->MdlAddress = MdlAddr; \ - } - -#define TdiBuildSend(Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, InFlags, SendLen)\ - { \ - PTDI_REQUEST_KERNEL_SEND p; \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_SEND; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL_SEND)&_IRPSP->Parameters; \ - p->SendFlags = InFlags; \ - p->SendLength = SendLen; \ - Irp->MdlAddress = MdlAddr; \ - } - -#define TdiBuildSendDatagram(Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, SendLen, SendDatagramInfo)\ - { \ - PTDI_REQUEST_KERNEL_SENDDG p; \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_SEND_DATAGRAM; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL_SENDDG)&_IRPSP->Parameters; \ - p->SendLength = SendLen; \ - p->SendDatagramInformation = SendDatagramInfo; \ - Irp->MdlAddress = MdlAddr; \ - } - -#define TdiBuildReceiveDatagram(Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, ReceiveLen, ReceiveDatagramInfo, ReturnInfo, InFlags)\ - { \ - PTDI_REQUEST_KERNEL_RECEIVEDG p; \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_RECEIVE_DATAGRAM; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL_RECEIVEDG)&_IRPSP->Parameters; \ - p->ReceiveLength = ReceiveLen; \ - p->ReceiveDatagramInformation = ReceiveDatagramInfo; \ - p->ReturnDatagramInformation = ReturnInfo; \ - p->ReceiveFlags = InFlags; \ - Irp->MdlAddress = MdlAddr; \ - } - -#define TdiBuildSetEventHandler(Irp, DevObj, FileObj, CompRoutine, Contxt, InEventType, InEventHandler, InEventContext) \ - { \ - PTDI_REQUEST_KERNEL_SET_EVENT p; \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_SET_EVENT_HANDLER; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL_SET_EVENT)&_IRPSP->Parameters; \ - p->EventType = InEventType; \ - p->EventHandler = (PVOID)InEventHandler; \ - p->EventContext = (PVOID)InEventContext; \ - } - -#define TdiBuildQueryInformationEx(Irp, DevObj, FileObj, CompRoutine, Contxt, QType, MdlAddr, ConnInfo)\ - { \ - PTDI_REQUEST_KERNEL_QUERY_INFORMATION p; \ - PIO_STACK_LOCATION _IRPSP; \ - Irp->MdlAddress = MdlAddr; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_QUERY_INFORMATION; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL_QUERY_INFORMATION)&_IRPSP->Parameters; \ - p->QueryType = (ULONG)QType; \ - p->RequestConnectionInformation = ConnInfo; \ - } - - -#define TdiBuildQueryInformation(Irp, DevObj, FileObj, CompRoutine, Contxt, QType, MdlAddr)\ - TdiBuildQueryInformationEx(Irp, DevObj, FileObj, CompRoutine, Contxt, QType, MdlAddr, NULL); - - -#define TdiBuildSetInformation(Irp, DevObj, FileObj, CompRoutine, Contxt, SType, MdlAddr)\ - { \ - PTDI_REQUEST_KERNEL_SET_INFORMATION p; \ - PIO_STACK_LOCATION _IRPSP; \ - Irp->MdlAddress = MdlAddr; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_SET_INFORMATION; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - p = (PTDI_REQUEST_KERNEL_SET_INFORMATION)&_IRPSP->Parameters; \ - p->SetType = (ULONG)SType; \ - p->RequestConnectionInformation = NULL; \ - } - -#define TdiBuildAction(Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr)\ - { \ - PIO_STACK_LOCATION _IRPSP; \ - if ( CompRoutine != NULL) { \ - IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\ - } else { \ - IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \ - } \ - _IRPSP = IoGetNextIrpStackLocation (Irp); \ - _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \ - _IRPSP->MinorFunction = TDI_ACTION; \ - _IRPSP->DeviceObject = DevObj; \ - _IRPSP->FileObject = FileObj; \ - Irp->MdlAddress = MdlAddr; \ - } - -// -// definitions for the helper routines for TDI compliant transports and clients -// -// Note that the IOCTL used here for the Irp Function is not real; it is used -// to avoid this IO routine having to map buffers (which we don't want). -// -//PIRP -//TdiBuildInternalDeviceControlIrp ( -// IN CCHAR IrpSubFunction, -// IN PDEVICE_OBJECT DeviceObject, -// IN PFILE_OBJECT FileObject, -// IN PKEVENT Event, -// IN PIO_STATUS_BLOCK IoStatusBlock -// ); - -#define TdiBuildInternalDeviceControlIrp(IrpSubFunction,DeviceObject,FileObject,Event,IoStatusBlock) \ - IoBuildDeviceIoControlRequest (\ - 0x00000003,\ - DeviceObject, \ - NULL, \ - 0, \ - NULL, \ - 0, \ - TRUE, \ - Event, \ - IoStatusBlock) - - -// -// VOID -// TdiCopyLookaheadData( -// IN PVOID Destination, -// IN PVOID Source, -// IN ULONG Length, -// IN ULONG ReceiveFlags -// ); -// - -#ifdef _M_IX86 -#define TdiCopyLookaheadData(_Destination,_Source,_Length,_ReceiveFlags) \ - RtlCopyMemory(_Destination,_Source,_Length) -#else -#define TdiCopyLookaheadData(_Destination,_Source,_Length,_ReceiveFlags) { \ - if ((_ReceiveFlags) & TDI_RECEIVE_COPY_LOOKAHEAD) { \ - RtlCopyMemory(_Destination,_Source,_Length); \ - } else { \ - PUCHAR _Src = (PUCHAR)(_Source); \ - PUCHAR _Dest = (PUCHAR)(_Destination); \ - PUCHAR _End = _Dest + (_Length); \ - while (_Dest < _End) { \ - *_Dest++ = *_Src++; \ - } \ - } \ -} -#endif - - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -TdiMapUserRequest( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __in PIO_STACK_LOCATION IrpSp - ); - -#if (NTDDI_VERSION < NTDDI_WINXP) -__drv_preferredFunction("(see documentation)", "Obsolete") -VOID -TdiMapBuffer ( - __in PMDL MdlChain - ); - -__drv_preferredFunction("(see documentation)", "Obsolete") -VOID -TdiUnmapBuffer ( - __in PMDL MdlChain - ); -#endif - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -TdiCopyBufferToMdl ( - __in PVOID SourceBuffer, - __in ULONG SourceOffset, - __in ULONG SourceBytesToCopy, - __in PMDL DestinationMdlChain, - __in ULONG DestinationOffset, - __out PULONG BytesCopied - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -TdiCopyMdlToBuffer( - __in PMDL SourceMdlChain, - __in ULONG SourceOffset, - __out_bcount(DestinationBufferSize) PVOID DestinationBuffer, - __in ULONG DestinationOffset, - __in ULONG DestinationBufferSize, - __out PULONG BytesCopied - ); - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(DISPATCH_LEVEL) -NTSTATUS -TdiCopyMdlChainToMdlChain( - __in PMDL SourceMdlChain, - __in ULONG SourceOffset, - __in PMDL DestinationMdlChain, - __in ULONG DestinationOffset, - __out PULONG BytesCopied - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -VOID -TdiCopyBufferToMdlWithReservedMappingAtDpcLevel( - __in PVOID SourceBuffer, - __in PMDL DestinationMdl, - __in ULONG DestinationOffset, - __in ULONG BytesToCopy - ); - -__inline -VOID -TdiCopyBufferToMdlWithReservedMapping( - __in PVOID SourceBuffer, - __in PMDL DestinationMdl, - __in ULONG DestinationOffset, - __in ULONG BytesToCopy - ) -{ - KIRQL OldIrql; - KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); - TdiCopyBufferToMdlWithReservedMappingAtDpcLevel(SourceBuffer, - DestinationMdl, - DestinationOffset, - BytesToCopy); - KeLowerIrql(OldIrql); -} -#endif - -VOID -TdiBuildNetbiosAddress ( - __in PUCHAR NetbiosName, - __in BOOLEAN IsGroupName, - __inout PTA_NETBIOS_ADDRESS NetworkName - ); - -NTSTATUS -TdiBuildNetbiosAddressEa ( - __out PUCHAR Buffer, - __in BOOLEAN IsGroupName, - __in PUCHAR NetbiosName - ); - -//++ -// -// VOID -// TdiCompleteRequest ( -// IN PIRP Irp, -// IN NTSTATUS Status -// ); -// -// Routine Description: -// -// This routine is used to complete an IRP with the indicated -// status. -// -// Arguments: -// -// Irp - Supplies a pointer to the Irp to complete -// -// Status - Supplies the completion status for the Irp -// -// Return Value: -// -// None. -// -//-- - -#define TdiCompleteRequest(IRP,STATUS) { \ - (IRP)->IoStatus.Status = (STATUS); \ - IoCompleteRequest( (IRP), IO_NETWORK_INCREMENT ); \ -} - - -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -TdiReturnChainedReceives( - __in PVOID *TsduDescriptors, - __in ULONG NumberOfTsdus - ); - - -// The type definition for a TDI Bind handler callout. This callout is -// called when a new transport device arrives. - -typedef VOID -(*TDI_BIND_HANDLER)( - __in PUNICODE_STRING DeviceName - ); - -typedef VOID -(*TDI_UNBIND_HANDLER)( - __in PUNICODE_STRING DeviceName - ); - -// The type definition for a TDI address handler callout. -// This is typedefed defined at the end (with the others) - -typedef VOID -(*TDI_ADD_ADDRESS_HANDLER)( - __in PTA_ADDRESS Address - ); - -typedef VOID -(*TDI_DEL_ADDRESS_HANDLER)( - __in PTA_ADDRESS Address - ); - -typedef VOID -(* TDI_NET_READY_HANDLER)( - __in NTSTATUS ProviderStatus - ); - -typedef VOID -(* ProviderPnPPowerComplete)( - __in PNET_PNP_EVENT NetEvent, - __in NTSTATUS ProviderStatus - ); - - -__drv_preferredFunction("TdiRegisterPnPHandlers", "Obsolete") -NTSTATUS -TdiRegisterAddressChangeHandler( - __in TDI_ADD_ADDRESS_HANDLER AddHandler, - __in TDI_DEL_ADDRESS_HANDLER DeleteHandler, - __out HANDLE *BindingHandle - ); - -__drv_preferredFunction("TdiDeregisterPnPHandlers", "Obsolete") -NTSTATUS -TdiDeregisterAddressChangeHandler( - __in HANDLE BindingHandle -); - -__drv_preferredFunction("TdiRegisterPnPHandlers", "Obsolete") -NTSTATUS -TdiRegisterNotificationHandler( - __in TDI_BIND_HANDLER BindHandler, - __in TDI_UNBIND_HANDLER UnbindHandler, - __out HANDLE *BindingHandle -); - -__drv_preferredFunction("TdiDeregisterPnPHandlers", "Obsolete") -NTSTATUS -TdiDeregisterNotificationHandler( - __in HANDLE BindingHandle -); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -TdiRegisterDeviceObject( - __in PUNICODE_STRING DeviceName, - __out HANDLE *RegistrationHandle -); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -TdiDeregisterDeviceObject( - __in HANDLE RegistrationHandle -); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -TdiDeregisterNetAddress( - __in HANDLE RegistrationHandle -); - -__drv_maxIRQL(PASSIVE_LEVEL) -VOID -TdiInitialize( - VOID -); - - -// PnP extensions to TDI. Spec : TdiPnp.doc : MunilS - -typedef enum _TDI_PNP_OPCODE { - TDI_PNP_OP_MIN, - TDI_PNP_OP_ADD, - TDI_PNP_OP_DEL, - TDI_PNP_OP_UPDATE, - TDI_PNP_OP_PROVIDERREADY, - TDI_PNP_OP_NETREADY, - TDI_PNP_OP_ADD_IGNORE_BINDING, - TDI_PNP_OP_DELETE_IGNORE_BINDING, - TDI_PNP_OP_MAX, -} TDI_PNP_OPCODE; - -typedef struct _TDI_PNP_CONTEXT_WIN2K { - USHORT ContextSize; - USHORT ContextType; - UCHAR POINTER_ALIGNMENT ContextData[1]; -} TDI_PNP_CONTEXT_WIN2K, *PTDI_PNP_CONTEXT_WIN2K; - -typedef struct _TDI_PNP_CONTEXT_XP { - USHORT ContextSize; - USHORT ContextType; - UCHAR POINTER_ALIGNMENT ContextData[1]; -} TDI_PNP_CONTEXT_XP, *PTDI_PNP_CONTEXT_XP; - -#if (NTDDI_VERSION >= NTDDI_WINXP) -typedef TDI_PNP_CONTEXT_XP TDI_PNP_CONTEXT; -#else -typedef TDI_PNP_CONTEXT_WIN2K TDI_PNP_CONTEXT; -#endif - -typedef TDI_PNP_CONTEXT* PTDI_PNP_CONTEXT; - -typedef VOID -(*TDI_BINDING_HANDLER)( - __in TDI_PNP_OPCODE PnPOpcode, - __in PUNICODE_STRING DeviceName, - __in PWSTR MultiSZBindList - ); - -typedef VOID -(*TDI_ADD_ADDRESS_HANDLER_V2)( - __in PTA_ADDRESS Address, - __in PUNICODE_STRING DeviceName, - __in PTDI_PNP_CONTEXT Context - ); - -typedef VOID -(*TDI_DEL_ADDRESS_HANDLER_V2)( - __in PTA_ADDRESS Address, - __in PUNICODE_STRING DeviceName, - __in PTDI_PNP_CONTEXT Context - ); - -typedef NTSTATUS -(*TDI_PNP_POWER_HANDLER)( - __in PUNICODE_STRING DeviceName, - __in PNET_PNP_EVENT PowerEvent, - __in PTDI_PNP_CONTEXT Context1, - __in PTDI_PNP_CONTEXT Context2 - ); - -// When the user makes changes using the NCPA, a TdiMakeNCPAChanges request -// is generated through NDIS. The following structure is used to communicate -// these changes. - -typedef struct _TDI_NCPA_BINDING_INFO { - PUNICODE_STRING TdiClientName; - PUNICODE_STRING TdiProviderName; - PUNICODE_STRING BindList; - PVOID ReconfigBuffer; - unsigned int ReconfigBufferSize; - TDI_PNP_OPCODE PnpOpcode; -} TDI_NCPA_BINDING_INFO, *PTDI_NCPA_BINDING_INFO; - -// -// The following structure makes it easy for consistency/integrity checking -// -typedef struct _TDI_VERSION_ { - union { - struct { - UCHAR MajorTdiVersion; - UCHAR MinorTdiVersion; - }; - USHORT TdiVersion; - }; -} TDI_VERSION, *PTDI_VERSION; - -#define TDI20 -typedef struct _TDI20_CLIENT_INTERFACE_INFO { - union { - struct { - UCHAR MajorTdiVersion; - UCHAR MinorTdiVersion; - }; - USHORT TdiVersion; - }; - - //TDI_VERSION TdiVersion; - USHORT Unused; - PUNICODE_STRING ClientName; - TDI_PNP_POWER_HANDLER PnPPowerHandler; - - union { - - TDI_BINDING_HANDLER BindingHandler; - - struct { - // - // Putting these back in for backward compatibility. - // - - TDI_BIND_HANDLER BindHandler; - TDI_UNBIND_HANDLER UnBindHandler; - - }; - }; - - - union { - struct { - - TDI_ADD_ADDRESS_HANDLER_V2 AddAddressHandlerV2; - TDI_DEL_ADDRESS_HANDLER_V2 DelAddressHandlerV2; - - }; - struct { - - // - // Putting these back in for backward compatibility. - // - - TDI_ADD_ADDRESS_HANDLER AddAddressHandler; - TDI_DEL_ADDRESS_HANDLER DelAddressHandler; - - }; - - }; - -// TDI_NET_READY_HANDLER NetReadyHandler; - -} TDI20_CLIENT_INTERFACE_INFO, *PTDI20_CLIENT_INTERFACE_INFO; - - -#ifdef TDI20 - -#define TDI_CURRENT_MAJOR_VERSION (2) -#define TDI_CURRENT_MINOR_VERSION (0) - -typedef TDI20_CLIENT_INTERFACE_INFO TDI_CLIENT_INTERFACE_INFO; - -#define TDI_CURRENT_VERSION ((TDI_CURRENT_MINOR_VERSION) << 8 | \ - (TDI_CURRENT_MAJOR_VERSION)) - -#endif // TDI20 - -#define TDI_VERSION_ONE 0x0001 - -typedef TDI_CLIENT_INTERFACE_INFO *PTDI_CLIENT_INTERFACE_INFO; - - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -TdiRegisterPnPHandlers( - __in_bcount(InterfaceInfoSize) PTDI_CLIENT_INTERFACE_INFO ClientInterfaceInfo, - __in ULONG InterfaceInfoSize, - __out HANDLE *BindingHandle - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -TdiDeregisterPnPHandlers( - __in HANDLE BindingHandle - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -TdiPnPPowerRequest( - __in PUNICODE_STRING DeviceName, - __in PNET_PNP_EVENT PowerEvent, - __in PTDI_PNP_CONTEXT Context1, - __in PTDI_PNP_CONTEXT Context2, - __in ProviderPnPPowerComplete ProtocolCompletionHandler - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -TdiPnPPowerComplete( - __in HANDLE BindingHandle, - __in PNET_PNP_EVENT PowerEvent, - __in NTSTATUS Status - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -TdiRegisterNetAddress( - __in PTA_ADDRESS Address, - __in PUNICODE_STRING DeviceName, - __in PTDI_PNP_CONTEXT Context, - __out HANDLE *RegistrationHandle - ); - -NTSTATUS -TdiMakeNCPAChanges( - __in TDI_NCPA_BINDING_INFO NcpaBindingInfo - ); - -// -// Enumerate all TDI addresses for a client -// -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -TdiEnumerateAddresses( - __in HANDLE BindingHandle - ); - -// -// Introducing the concept of Transport provider. -// - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -TdiRegisterProvider( - __in PUNICODE_STRING ProviderName, - __out HANDLE *ProviderHandle - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -TdiProviderReady( - __in HANDLE ProviderHandle - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -TdiDeregisterProvider( - __in HANDLE ProviderHandle - ); - -BOOLEAN -TdiMatchPdoWithChainedReceiveContext( - __in PVOID TsduDescriptor, - __in PVOID PDO - ); - - - -#define TDI_STATUS_BAD_VERSION 0xC0010004L // same as NDIS, is that OK? -#define TDI_STATUS_BAD_CHARACTERISTICS 0xC0010005L // ,, - - -// -// PNP context types -// -#define TDI_PNP_CONTEXT_TYPE_IF_NAME 0x1 -#define TDI_PNP_CONTEXT_TYPE_IF_ADDR 0x2 -#define TDI_PNP_CONTEXT_TYPE_PDO 0x3 -#define TDI_PNP_CONTEXT_TYPE_FIRST_OR_LAST_IF 0x4 - -// The following structures and macros are for handlers that support returning -// ancillary data via a control structure -// - -// -// Layout of ancillary data objects in the control buffer -// -typedef struct _TDI_CMSGHDR_XP { - SIZE_T cmsg_len; - LONG cmsg_level; - LONG cmsg_type; - /* followed by UCHAR cmsg_data[] */ -} TDI_CMSGHDR_XP, *PTDI_CMSGHDR_XP; - -#if (NTDDI_VERSION >= NTDDI_WINXP) -typedef TDI_CMSGHDR_XP TDI_CMSGHDR; -typedef TDI_CMSGHDR* PTDI_CMSGHDR; -#endif - -// -// Alignment macros for header and data members of -// the control buffer. -// -#define TDI_CMSGHDR_ALIGN(length) \ - ( ((length) + TYPE_ALIGNMENT(TDI_CMSGHDR)-1) & \ - (~(TYPE_ALIGNMENT(TDI_CMSGHDR)-1)) ) \ - -#define TDI_CMSGDATA_ALIGN(length) \ - ( ((length) + MAX_NATURAL_ALIGNMENT-1) & \ - (~(MAX_NATURAL_ALIGNMENT-1)) ) - - - -// Returns a pointer to the first byte of data (what is referred -// to as the cmsg_data member though it is not defined in -// the structure). -// -// UCHAR * -// TDI_CMSG_DATA ( -// PTDI_CMSGHDR pcmsg -// ); -// -#define TDI_CMSG_DATA(cmsg) \ - ( (UCHAR *)(cmsg) + TDI_CMSGDATA_ALIGN(sizeof(TDI_CMSGHDR)) ) - -// -// Returns total size of an ancillary data object given -// the amount of data. Used to allocate the correct amount -// of space. -// -// SIZE_T -// TDI_CMSG_SPACE ( -// SIZE_T length -// ); -// -#define TDI_CMSG_SPACE(length) \ - (TDI_CMSGDATA_ALIGN(sizeof(TDI_CMSGHDR) + TDI_CMSGHDR_ALIGN(length))) - -// Returns the value to store in cmsg_len given the amount of data. -// -// SIZE_T -// TDI_CMSG_LEN ( -// SIZE_T length -// ); -// -#define TDI_CMSG_LEN(length) \ - (TDI_CMSGDATA_ALIGN(sizeof(TDI_CMSGHDR)) + length) - - -// Initializes the members of a TDI_CMSGHDR structure -// -// VOID -// TDI_INIT_CMSGHDR ( -// PTDI_CMSGHDR cmsg, -// INT level, -// INT type, -// SIZE_T length, -// ); -// -#define TDI_INIT_CMSGHDR(cmsg, level, type, length) { \ - ((TDI_CMSGHDR *) cmsg)->cmsg_level = level; \ - ((TDI_CMSGHDR *) cmsg)->cmsg_type = type; \ - ((TDI_CMSGHDR *) cmsg)->cmsg_len = TDI_CMSG_LEN(length); \ - } - -#pragma warning(pop) -#endif // _TDI_KRNL_ - diff --git a/pub/ddk/tdistat.h b/pub/ddk/tdistat.h deleted file mode 100644 index ad04981..0000000 --- a/pub/ddk/tdistat.h +++ /dev/null @@ -1,110 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - tdistat.h - -Abstract: - - This file contains the TDI status code definitions. - -Revision History: - ---*/ - -#pragma once - -#ifndef NT - -#define TDI_SUCCESS 0 // Success -#define TDI_NO_RESOURCES 1 // No resources. -#define TDI_ADDR_IN_USE 2 // Address already in use. -#define TDI_BAD_ADDR 3 // Address given is bad. -#define TDI_NO_FREE_ADDR 4 // No addresses available. -#define TDI_ADDR_INVALID 6 // Address object is invalid. -#define TDI_ADDR_DELETED 7 // Address object was deleted. -#define TDI_BUFFER_OVERFLOW 9 // Buffer overflowed. -#define TDI_BAD_EVENT_TYPE 10 // Bad event type. -#define TDI_BAD_OPTION 11 // Bad option or length. -#define TDI_CONN_REFUSED 14 // Connection was refused. -#define TDI_INVALID_CONNECTION 15 // Invalid connection. -#define TDI_ALREADY_ASSOCIATED 16 // Connection already associated. -#define TDI_NOT_ASSOCIATED 17 // Connection not associated. -#define TDI_CONNECTION_ACTIVE 18 // Connection is still active. -#define TDI_CONNECTION_ABORTED 19 // Connection was aborted. -#define TDI_CONNECTION_RESET 20 // Connection was reset. -#define TDI_TIMED_OUT 21 // Connection timed out. -#define TDI_GRACEFUL_DISC 22 // Received a graceful disconnect. -#define TDI_NOT_ACCEPTED 23 // Data not accepted. -#define TDI_MORE_PROCESSING 24 // More processing required. -#define TDI_INVALID_STATE 25 // TCB in an invalid state. -#define TDI_INVALID_PARAMETER 26 // An invalid parameter. -#define TDI_DEST_NET_UNREACH 27 // Destination net is unreachable. -#define TDI_DEST_HOST_UNREACH 28 // Dest. host is unreachable. -#define TDI_DEST_UNREACHABLE TDI_DEST_HOST_UNREACH -#define TDI_DEST_PROT_UNREACH 29 // Destination protocol is - // unreachable. -#define TDI_DEST_PORT_UNREACH 30 // Dest. port is unreachable. -#define TDI_INVALID_QUERY 31 // Invalid query type specified. -#define TDI_REQ_ABORTED 32 // Request was aborted for some - // reason. -#define TDI_BUFFER_TOO_SMALL 33 // Buffer was too small. -#define TDI_CANCELLED 34 // The request was cancelled. -#define TDI_BUFFER_TOO_BIG 35 // Send buffer was too big. -#define TDI_ITEM_NOT_FOUND 36 // Item not found. -#define TDI_INVALID_REQUEST 0xfe // Invalid request. -#define TDI_PENDING 0xff // Pending - -#else - -// -// Map to NT STATUS codes. -// -#define TDI_SUCCESS STATUS_SUCCESS -#define TDI_NO_RESOURCES STATUS_INSUFFICIENT_RESOURCES -#define TDI_ADDR_IN_USE STATUS_ADDRESS_ALREADY_EXISTS -#define TDI_BAD_ADDR STATUS_INVALID_ADDRESS_COMPONENT -#define TDI_NO_FREE_ADDR STATUS_TOO_MANY_ADDRESSES -#define TDI_ADDR_INVALID STATUS_INVALID_ADDRESS -#define TDI_ADDR_DELETED STATUS_ADDRESS_CLOSED -#define TDI_BUFFER_OVERFLOW STATUS_BUFFER_OVERFLOW -#define TDI_BAD_EVENT_TYPE STATUS_INVALID_PARAMETER -#define TDI_BAD_OPTION STATUS_INVALID_PARAMETER -#define TDI_CONN_REFUSED STATUS_CONNECTION_REFUSED -#define TDI_INVALID_CONNECTION STATUS_CONNECTION_INVALID -#define TDI_ALREADY_ASSOCIATED STATUS_ADDRESS_ALREADY_ASSOCIATED -#define TDI_NOT_ASSOCIATED STATUS_ADDRESS_NOT_ASSOCIATED -#define TDI_CONNECTION_ACTIVE STATUS_CONNECTION_ACTIVE -#define TDI_CONNECTION_ABORTED STATUS_CONNECTION_ABORTED -#define TDI_CONNECTION_RESET STATUS_CONNECTION_RESET -#define TDI_TIMED_OUT STATUS_IO_TIMEOUT -#define TDI_GRACEFUL_DISC STATUS_GRACEFUL_DISCONNECT -#define TDI_NOT_ACCEPTED STATUS_DATA_NOT_ACCEPTED -#define TDI_MORE_PROCESSING STATUS_MORE_PROCESSING_REQUIRED -#define TDI_INVALID_STATE STATUS_INVALID_DEVICE_STATE -#define TDI_INVALID_PARAMETER STATUS_INVALID_PARAMETER -#define TDI_DEST_NET_UNREACH STATUS_NETWORK_UNREACHABLE -#define TDI_DEST_HOST_UNREACH STATUS_HOST_UNREACHABLE -#define TDI_DEST_UNREACHABLE TDI_DEST_HOST_UNREACH -#define TDI_DEST_PROT_UNREACH STATUS_PROTOCOL_UNREACHABLE -#define TDI_DEST_PORT_UNREACH STATUS_PORT_UNREACHABLE -#define TDI_INVALID_QUERY STATUS_INVALID_DEVICE_REQUEST -#define TDI_REQ_ABORTED STATUS_REQUEST_ABORTED -#define TDI_BUFFER_TOO_SMALL STATUS_BUFFER_TOO_SMALL -#define TDI_CANCELLED STATUS_CANCELLED -#define TDI_BUFFER_TOO_BIG STATUS_INVALID_BUFFER_SIZE -#define TDI_INVALID_REQUEST STATUS_INVALID_DEVICE_REQUEST -#define TDI_PENDING STATUS_PENDING -#define TDI_ITEM_NOT_FOUND STATUS_OBJECT_NAME_NOT_FOUND - - -#endif // NT - -#define TDI_OPTION_EOL 0 - -#define TDI_ADDRESS_OPTION_REUSE 1 -#define TDI_ADDRESS_OPTION_DHCP 2 -#define TDI_ADDRESS_OPTION_RAW 3 - diff --git a/pub/ddk/upssvc.h b/pub/ddk/upssvc.h deleted file mode 100644 index e0fd8f0..0000000 --- a/pub/ddk/upssvc.h +++ /dev/null @@ -1,198 +0,0 @@ -/*++ - -Copyright (c) 2000 Microsoft Corporation. All rights reserved. - -Module Name: - - upssvc.h - -Abstract: - - This file defines the interface to the serial UPS service in - Windows 2000. Please see the UPS documentation in the DDK - for more information. - - ---*/ - -#ifndef _INC_UPS_DRIVER_H_ -#define _INC_UPS_DRIVER_H_ - -#if ((NTDDI_VERSION >= NTDDI_WINXP) && (NTDDI_VERSION < NTDDI_VISTA)) - -// -// values that represent the state of the -// UPS system - these values are used in the -// UPSGetState and UPSWaitForStateChange functions -// -#define UPS_ONLINE 1 -#define UPS_ONBATTERY 2 -#define UPS_LOWBATTERY 4 -#define UPS_NOCOMM 8 -#define UPS_CRITICAL 16 - - -// -// possible error codes returned from UPSInit -// -#define UPS_INITUNKNOWNERROR 0 -#define UPS_INITOK 1 -#define UPS_INITNOSUCHDRIVER 2 -#define UPS_INITBADINTERFACE 3 -#define UPS_INITREGISTRYERROR 4 -#define UPS_INITCOMMOPENERROR 5 -#define UPS_INITCOMMSETUPERROR 6 - - -/** -* UPSInit -* -* Description: -* -* The UPSInit function must be called before any -* other function in this file -* -* Parameters: -* None -* -* Returns: -* UPS_INITOK: Initalization was successful -* UPS_INITNOSUCHDRIVER: The configured driver DLL can't be opened -* UPS_INITBADINTERFACE: The configured driver DLL doesn't support -* the UPS driver interface -* UPS_INITREGISTRYERROR: The 'Options' registry value is corrupt -* UPS_INITCOMMOPENERROR: The comm port could not be opened -* UPS_INITCOMMSETUPERROR: The comm port could not be configured -* UPS_INITUNKNOWNERROR: Undefined error has occurred -* -*/ -__checkReturn -DWORD -UPSInit( - void - ); - - -/** -* UPSStop -* -* Description: -* After a call to UPSStop, only the UPSInit -* function is valid. This call will unload the -* UPS driver interface and stop monitoring of the -* UPS system -* -* Parameters: -* None -* -* Returns: -* None -* -*/ -void -UPSStop( - void - ); - - -/** -* UPSWaitForStateChange -* -* Description: -* Blocks until the state of the UPS differs -* from the value passed in via aCurrentState or -* anInterval milliseconds has expired. If -* anInterval has a value of INFINITE this -* function will never timeout -* -* Parameters: -* aState: defines the state to wait for a change from, -* possible values: -* UPS_ONLINE -* UPS_ONBATTERY -* UPS_LOWBATTERY -* UPS_NOCOMM -* -* anInterval: timeout in milliseconds, or INFINITE for -* no timeout interval -* -* Returns: -* None -* -*/ -void -UPSWaitForStateChange( - __in DWORD aCurrentState, - __in DWORD anInterval - ); - - -/** -* UPSGetState -* -* Description: -* returns the current state of the UPS -* -* Parameters: -* None -* -* Returns: -* possible values: -* UPS_ONLINE -* UPS_ONBATTERY -* UPS_LOWBATTERY -* UPS_NOCOMM -* -*/ -DWORD -UPSGetState( - void - ); - - -/** -* UPSCancelWait -* -* Description: -* interrupts pending calls to UPSWaitForStateChange -* without regard to timout or state change -* -* Parameters: -* None -* -* Returns: -* None -* -*/ -void -UPSCancelWait( - void - ); - - -/** -* UPSTurnOff -* -* Description: -* Attempts to turn off the outlets on the UPS -* after the specified delay. This call must -* return immediately. Any work, such as a timer, -* must be performed on a another thread. -* -* Parameters: -* aTurnOffDelay: the minimum amount of time to wait before -* turning off the outlets on the UPS -* -* Returns: -* None -* -*/ -void -UPSTurnOff( - __in DWORD aTurnOffDelay - ); - -#endif // ((NTDDI_VERSION >= NTDDI_WINXP) && (NTDDI_VERSION < NTDDI_VISTA)) - -#endif - diff --git a/pub/ddk/usbbusif.h b/pub/ddk/usbbusif.h deleted file mode 100644 index a097c97..0000000 --- a/pub/ddk/usbbusif.h +++ /dev/null @@ -1,494 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - usbbusif.h - -Abstract: - -Environment: - - Kernel mode - -Revision History: - - 6-20-99 : created - ---*/ - -#ifndef __USBBUSIF_H__ -#define __USBBUSIF_H__ - -/* - Bus interfaces are supported for Windows XP and later only -*/ -#ifndef USB_BUSIFFN -#define USB_BUSIFFN __stdcall -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -typedef PVOID PUSB_DEVICE_HANDLE; - - -/**************************************************************************** - Bus interface for USB FUNCTION DRIVERS -*****************************************************************************/ - - -/* - The following bus interface is defined for USB function drivers - as an alternative to linking directly with USBD.SYS - - It provides irp-less interfaces that may be called at Raised IRQL. -*/ - - -/* - -NTSTATUS -USBPORT_SubmitIsoOutUrb( - IN PVOID BusContext, - IN PURB Urb - ); - -Routine Description: - - Returns STATUS_NOT_SUPPORTED. - -Arguments: - -*/ - -typedef __checkReturn NTSTATUS - (USB_BUSIFFN *PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB) ( - __in PVOID, - __in PURB - ); - - -/* -VOID -USBPORT_GetUSBDIVersion( - IN PVOID BusContext, - IN OUT PUSBD_VERSION_INFORMATION VersionInformation, - IN OUT PULONG HcdCapabilities - ); - -Routine Description: - - Service Returns the Highest USBDI Interface Version supported - by the port driver. - - Released Interface Vesrions are: - - Win98Gold,usbd 0x00000102 - Win98SE,usbd 0x00000200 - Win2K,usbd 0x00000300 - Win98M (Millenium),usbd 0x00000400 - - Usbport 0x00000500 - - IRQL = ANY - -Arguments: - - VersionInformation - Ptr to USBD_VERSION_INFORMATION - HcdCapabilities - Ptr to ULONG that will be filled in with - the Host controller (port) driver capability flags. -*/ - -/* - Host Controller 'Port' driver capabilities flags -*/ - -#define USB_HCD_CAPS_SUPPORTS_RT_THREADS 0x00000001 - - -typedef VOID - (USB_BUSIFFN *PUSB_BUSIFFN_GETUSBDI_VERSION) ( - __in PVOID, - __out_opt PUSBD_VERSION_INFORMATION, - __out_opt PULONG - ); - -/* -NTSTATUS -USBPORT_QueryBusTime( - IN PVOID BusContext, - IN OUT PULONG CurrentUsbFrame - ); - -Routine Description: - - Returns the current 32 bit USB frame number. The function - replaces the USBD_QueryBusTime Service. - - IRQL = ANY - -Arguments: - - -*/ - - -typedef __checkReturn NTSTATUS - (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_TIME) ( - __in PVOID, - __out_opt PULONG - ); - -/* -NTSTATUS -USBPORT_BusEnumLogEntry( - PVOID BusContext, - ULONG DriverTag, - ULONG EnumTag, - ULONG P1, - ULONG P2 - ); - -Routine Description: - - IRQL = ANY - -Arguments: - - -*/ - - -typedef NTSTATUS - (USB_BUSIFFN *PUSB_BUSIFFN_ENUM_LOG_ENTRY) ( - __in PVOID, - __in ULONG, - __in ULONG, - __in ULONG, - __in ULONG - ); - - - -/* -NTSTATUS -USBPORT_QueryBusInformation( - IN PVOID BusContext, - IN ULONG Level, - IN OUT PVOID BusInformationBuffer, - IN OUT PULONG BusInformationBufferLength, - OUT PULONG BusInformationActualLength - ); - -Routine Description: - - IRQL = ANY - -Arguments: - - -*/ - -typedef struct _USB_BUS_INFORMATION_LEVEL_0 { - - /* bandwidth in bits/sec */ - ULONG TotalBandwidth; - /* mean bandwidth consumed in bits/sec */ - ULONG ConsumedBandwidth; - -} USB_BUS_INFORMATION_LEVEL_0, *PUSB_BUS_INFORMATION_LEVEL_0; - - -typedef struct _USB_BUS_INFORMATION_LEVEL_1 { - - /* bandwidth in bits/sec */ - ULONG TotalBandwidth; - /* mean bandwidth consumed in bits/sec */ - ULONG ConsumedBandwidth; - - /* - controller 'unicode' symbolic name - */ - - ULONG ControllerNameLength; - WCHAR ControllerNameUnicodeString[1]; - -} USB_BUS_INFORMATION_LEVEL_1, *PUSB_BUS_INFORMATION_LEVEL_1; - - -typedef __checkReturn NTSTATUS - (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_INFORMATION) ( - __in PVOID, - __in ULONG, - __inout PVOID, - __out PULONG, - __out_opt PULONG - ); - - -/* -BOOLEAN -USBPORT_IsDeviceHighSpeed( - IN PVOID BusContext - ); - -Routine Description: - - Returns true if device is operating at high speed - - IRQL = ANY - -Arguments: - - -*/ - -typedef __checkReturn BOOLEAN - (USB_BUSIFFN *PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED) ( - __in_opt PVOID - ); - -#define USB_BUSIF_USBDI_VERSION_0 0x0000 -#define USB_BUSIF_USBDI_VERSION_1 0x0001 -#define USB_BUSIF_USBDI_VERSION_2 0x0002 -#define USB_BUSIF_USBDI_VERSION_3 0x0003 - -// {B1A96A13-3DE0-4574-9B01-C08FEAB318D6} -DEFINE_GUID(USB_BUS_INTERFACE_USBDI_GUID, -0xb1a96a13, 0x3de0, 0x4574, 0x9b, 0x1, 0xc0, 0x8f, 0xea, 0xb3, 0x18, 0xd6); - - -/* - Note: that this version must remain unchanged, this is the - version that is supported by USBD in Win2k and WinMe -*/ -typedef struct _USB_BUS_INTERFACE_USBDI_V0 { - - USHORT Size; - USHORT Version; - - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - - // the following functions must be callable at high IRQL, - // (ie higher than DISPATCH_LEVEL) - - PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion; - PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime; - PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb; - PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation; - -} USB_BUS_INTERFACE_USBDI_V0, *PUSB_BUS_INTERFACE_USBDI_V0; - -/* - New extensions for Windows XP -*/ -typedef struct _USB_BUS_INTERFACE_USBDI_V1 { - - USHORT Size; - USHORT Version; - - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - - // the following functions must be callable at high IRQL, - // (ie higher than DISPATCH_LEVEL) - - PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion; - PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime; - PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb; - PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation; - PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed; - -} USB_BUS_INTERFACE_USBDI_V1, *PUSB_BUS_INTERFACE_USBDI_V1; - - -/* - New extensions for Windows XP -*/ -typedef struct _USB_BUS_INTERFACE_USBDI_V2 { - - USHORT Size; - USHORT Version; - - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - - // the following functions must be callable at high IRQL, - // (ie higher than DISPATCH_LEVEL) - - PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion; - PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime; - PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb; - PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation; - PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed; - - PUSB_BUSIFFN_ENUM_LOG_ENTRY EnumLogEntry; - -} USB_BUS_INTERFACE_USBDI_V2, *PUSB_BUS_INTERFACE_USBDI_V2; - -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -/* -NTSTATUS -USBPORT_QueryBusTimeEx( - IN PVOID BusContext, - OUT PULONG HighSpeedFrameCounter - ); -*/ - -typedef __checkReturn NTSTATUS - (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_TIME_EX) ( - __in_opt PVOID, - __out_opt PULONG - ); - -/* - - -/* -NTSTATUS -USBPORTBUSIF_UsbdQueryControllerType( - __in_opt PVOID BusContext, - __out_opt PULONG HcdiOptionFlags, - __out_opt PUSHORT PciVendorId, - __out_opt PUSHORT PciDeviceId, - __out_opt PUCHAR PciClass, - __out_opt PUCHAR PciSubClass, - __out_opt PUCHAR PciRevisionId, - __out_opt PUCHAR PciProgIf - ); -*/ - -typedef __checkReturn NTSTATUS - (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_CONTROLLER_TYPE) ( - __in_opt PVOID, - __out_opt PULONG, - __out_opt PUSHORT, - __out_opt PUSHORT, - __out_opt PUCHAR, - __out_opt PUCHAR, - __out_opt PUCHAR, - __out_opt PUCHAR - ); - - -// version 3 Vista and later - -typedef struct _USB_BUS_INTERFACE_USBDI_V3 { - - USHORT Size; - USHORT Version; - - PVOID BusContext; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - // interface specific entries go here - - // the following functions must be callable at high IRQL, - // (ie higher than DISPATCH_LEVEL) - - PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion; - PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime; - PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb; - PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation; - PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed; - PUSB_BUSIFFN_ENUM_LOG_ENTRY EnumLogEntry; - - PUSB_BUSIFFN_QUERY_BUS_TIME_EX QueryBusTimeEx; - PUSB_BUSIFFN_QUERY_CONTROLLER_TYPE QueryControllerType; - -} USB_BUS_INTERFACE_USBDI_V3, *PUSB_BUS_INTERFACE_USBDI_V3; - - -// -// USBCCGP.SYS filter driver bus interfaces supported for Windows Longhorn and later. -// These are callback functions that the usbccgp.sys driver will invoke to allow -// a filter driver to customize the device. The filter driver must export the interface. -// - -// {893B6A96-0B7F-4d4d-BDB4-BBD4CEEBB31C} -DEFINE_GUID(USB_BUS_INTERFACE_USBC_CONFIGURATION_GUID, -0x893b6a96, 0xb7f, 0x4d4d, 0xbd, 0xb4, 0xbb, 0xd4, 0xce, 0xeb, 0xb3, 0x1c); - -#define USBC_FUNCTION_FLAG_APPEND_ID 0x1 - -typedef struct _USBC_FUNCTION_DESCRIPTOR{ - // The 0-based index of the function described - UCHAR FunctionNumber; - - // The number of interfaces contained in this function - UCHAR NumberOfInterfaces; - - // A callee allocated array of pointers into the config desc buffer passed as an input - PUSB_INTERFACE_DESCRIPTOR *InterfaceDescriptorList; - - // Callee allocated PNP IDs for this PDO - UNICODE_STRING HardwareId; - UNICODE_STRING CompatibleId; - UNICODE_STRING FunctionDescription; - - // Custom Flags - ULONG FunctionFlags; - PVOID Reserved; -} USBC_FUNCTION_DESCRIPTOR, *PUSBC_FUNCTION_DESCRIPTOR; - -// -// Callback invoked during START to customize PDO interface groupings and PNP ids. -// - -typedef __checkReturn -NTSTATUS -(USB_BUSIFFN *USBC_START_DEVICE_CALLBACK)( - __in PUSB_DEVICE_DESCRIPTOR DeviceDescriptor, - __in PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, - __deref_out_bcount_opt(*FunctionDescriptorBufferLength) PUSBC_FUNCTION_DESCRIPTOR *FunctionDescriptorBuffer, - __out PULONG FunctionDescriptorBufferLength, - __in PDEVICE_OBJECT FdoDeviceObject, - __in PDEVICE_OBJECT PdoDeviceObject - ); - -typedef __checkReturn -BOOLEAN -(USB_BUSIFFN *USBC_PDO_ENABLE_CALLBACK)( - __in PVOID Context, - __in USHORT FirstInterfaceNumber, - __in USHORT NumberOfInterfaces, - __in UCHAR FunctionClass, - __in UCHAR FunctionSubClass, - __in UCHAR FunctionProtocol - ); - - -#define USBC_DEVICE_CONFIGURATION_INTERFACE_VERSION_1 0x0001 - -typedef struct _USBC_DEVICE_CONFIGURATION_INTERFACE_V1 { - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - USBC_START_DEVICE_CALLBACK StartDeviceCallback; - USBC_PDO_ENABLE_CALLBACK PdoEnableCallback; - - PVOID Reserved[7]; -} USBC_DEVICE_CONFIGURATION_INTERFACE_V1, *PUSBC_DEVICE_CONFIGURATION_INTERFACE_V1; - -#endif - -#endif /* __USBBUSIF_H */ - diff --git a/pub/ddk/usbdlib.h b/pub/ddk/usbdlib.h deleted file mode 100644 index e3aede5..0000000 --- a/pub/ddk/usbdlib.h +++ /dev/null @@ -1,576 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - USBDLIB.H - -Abstract: - - Services exported by USBD. - -Environment: - - Kernel & user mode - -Revision History: - - 06-10-96 : created - ---*/ - -#ifndef __USBDLIB_H__ -#define __USBDLIB_H__ - -#ifdef OSR21_COMPAT -#pragma message("WARNING: OSR21_COMPAT SWITCH NOT SUPPORTED") -#endif - -typedef struct _USBD_INTERFACE_LIST_ENTRY { - PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor; - PUSBD_INTERFACE_INFORMATION Interface; -} USBD_INTERFACE_LIST_ENTRY, *PUSBD_INTERFACE_LIST_ENTRY; - - -// -// Macros for building URB requests -// - -#define UsbBuildInterruptOrBulkTransferRequest(urb, \ - length, \ - pipeHandle, \ - transferBuffer, \ - transferBufferMDL, \ - transferBufferLength, \ - transferFlags, \ - link) { \ - (urb)->UrbHeader.Function = URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER; \ - (urb)->UrbHeader.Length = (length); \ - (urb)->UrbBulkOrInterruptTransfer.PipeHandle = (pipeHandle); \ - (urb)->UrbBulkOrInterruptTransfer.TransferBufferLength = (transferBufferLength); \ - (urb)->UrbBulkOrInterruptTransfer.TransferBufferMDL = (transferBufferMDL); \ - (urb)->UrbBulkOrInterruptTransfer.TransferBuffer = (transferBuffer); \ - (urb)->UrbBulkOrInterruptTransfer.TransferFlags = (transferFlags); \ - (urb)->UrbBulkOrInterruptTransfer.UrbLink = (link); } - - -#define UsbBuildGetDescriptorRequest(urb, \ - length, \ - descriptorType, \ - descriptorIndex, \ - languageId, \ - transferBuffer, \ - transferBufferMDL, \ - transferBufferLength, \ - link) { \ - (urb)->UrbHeader.Function = URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE; \ - (urb)->UrbHeader.Length = (length); \ - (urb)->UrbControlDescriptorRequest.TransferBufferLength = (transferBufferLength); \ - (urb)->UrbControlDescriptorRequest.TransferBufferMDL = (transferBufferMDL); \ - (urb)->UrbControlDescriptorRequest.TransferBuffer = (transferBuffer); \ - (urb)->UrbControlDescriptorRequest.DescriptorType = (descriptorType); \ - (urb)->UrbControlDescriptorRequest.Index = (descriptorIndex); \ - (urb)->UrbControlDescriptorRequest.LanguageId = (languageId); \ - (urb)->UrbControlDescriptorRequest.UrbLink = (link); } - - - -#define UsbBuildGetStatusRequest(urb, \ - op, \ - index, \ - transferBuffer, \ - transferBufferMDL, \ - link) { \ - (urb)->UrbHeader.Function = (op); \ - (urb)->UrbHeader.Length = sizeof(struct _URB_CONTROL_GET_STATUS_REQUEST); \ - (urb)->UrbControlGetStatusRequest.TransferBufferLength = sizeof(USHORT); \ - (urb)->UrbControlGetStatusRequest.TransferBufferMDL = (transferBufferMDL); \ - (urb)->UrbControlGetStatusRequest.TransferBuffer = (transferBuffer); \ - (urb)->UrbControlGetStatusRequest.Index = (index); \ - (urb)->UrbControlGetStatusRequest.UrbLink = (link); } - - -#define UsbBuildFeatureRequest(urb, \ - op, \ - featureSelector, \ - index, \ - link) { \ - (urb)->UrbHeader.Function = (op); \ - (urb)->UrbHeader.Length = sizeof(struct _URB_CONTROL_FEATURE_REQUEST); \ - (urb)->UrbControlFeatureRequest.FeatureSelector = (featureSelector); \ - (urb)->UrbControlFeatureRequest.Index = (index); \ - (urb)->UrbControlFeatureRequest.UrbLink = (link); } - - - -#define UsbBuildSelectConfigurationRequest(urb, \ - length, \ - configurationDescriptor) { \ - (urb)->UrbHeader.Function = URB_FUNCTION_SELECT_CONFIGURATION; \ - (urb)->UrbHeader.Length = (length); \ - (urb)->UrbSelectConfiguration.ConfigurationDescriptor = (configurationDescriptor); } - -#define UsbBuildSelectInterfaceRequest(urb, \ - length, \ - configurationHandle, \ - interfaceNumber, \ - alternateSetting) { \ - (urb)->UrbHeader.Function = URB_FUNCTION_SELECT_INTERFACE; \ - (urb)->UrbHeader.Length = (length); \ - (urb)->UrbSelectInterface.Interface.AlternateSetting = (alternateSetting); \ - (urb)->UrbSelectInterface.Interface.InterfaceNumber = (interfaceNumber); \ - (urb)->UrbSelectInterface.Interface.Length = (length - sizeof(struct _URB_HEADER) - sizeof(USBD_CONFIGURATION_HANDLE)); \ - (urb)->UrbSelectInterface.ConfigurationHandle = (configurationHandle); } - - -#define UsbBuildVendorRequest(urb, \ - cmd, \ - length, \ - transferFlags, \ - reservedbits, \ - request, \ - value, \ - index, \ - transferBuffer, \ - transferBufferMDL, \ - transferBufferLength, \ - link) { \ - (urb)->UrbHeader.Function = cmd; \ - (urb)->UrbHeader.Length = (length); \ - (urb)->UrbControlVendorClassRequest.TransferBufferLength = (transferBufferLength); \ - (urb)->UrbControlVendorClassRequest.TransferBufferMDL = (transferBufferMDL); \ - (urb)->UrbControlVendorClassRequest.TransferBuffer = (transferBuffer); \ - (urb)->UrbControlVendorClassRequest.RequestTypeReservedBits = (reservedbits); \ - (urb)->UrbControlVendorClassRequest.Request = (request); \ - (urb)->UrbControlVendorClassRequest.Value = (value); \ - (urb)->UrbControlVendorClassRequest.Index = (index); \ - (urb)->UrbControlVendorClassRequest.TransferFlags = (transferFlags); \ - (urb)->UrbControlVendorClassRequest.UrbLink = (link); } - - -// This is just a special vendor class request. -// Defined for windows XP and later - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -#define UsbBuildOsFeatureDescriptorRequest(urb, \ - length, \ - interface, \ - index, \ - transferBuffer, \ - transferBufferMDL, \ - transferBufferLength, \ - link) { \ - (urb)->UrbHeader.Function = URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR; \ - (urb)->UrbHeader.Length = (length); \ - (urb)->UrbOSFeatureDescriptorRequest.TransferBufferLength = (transferBufferLength); \ - (urb)->UrbOSFeatureDescriptorRequest.TransferBufferMDL = (transferBufferMDL); \ - (urb)->UrbOSFeatureDescriptorRequest.TransferBuffer = (transferBuffer); \ - (urb)->UrbOSFeatureDescriptorRequest.InterfaceNumber = (interface); \ - (urb)->UrbOSFeatureDescriptorRequest.MS_FeatureDescriptorIndex = (index); \ - (urb)->UrbOSFeatureDescriptorRequest.UrbLink = (link); } - -#endif - -// -// Get the USB status code -// - -#define URB_STATUS(urb) ((urb)->UrbHeader.Status) - -// -// Macros used for select interface and select configuration requests -// - -// -// Calculates the size needed for a SELECT_CONFIGURATION URB request given -// the number of interfaces and the total number of pipes in all interfaces -// selected. -// - - -#define GET_SELECT_CONFIGURATION_REQUEST_SIZE(totalInterfaces, totalPipes) \ - (sizeof(struct _URB_SELECT_CONFIGURATION) + \ - ((totalInterfaces-1) * sizeof(USBD_INTERFACE_INFORMATION)) + \ - ((totalPipes-totalInterfaces)*sizeof(USBD_PIPE_INFORMATION))) - -// -// Calculates the size needed for a SELECT_INTERFACE URB request given -// the number of pipes in the alternate interface selected. -// - -#define GET_SELECT_INTERFACE_REQUEST_SIZE(totalPipes) \ - (sizeof(struct _URB_SELECT_INTERFACE) + \ - ((totalPipes-1)*sizeof(USBD_PIPE_INFORMATION))) - -// -// Calculates the size of the interface information structure needed to describe -// a give interface based on the number of endpoints. -// - - -#define GET_USBD_INTERFACE_SIZE(numEndpoints) (sizeof(USBD_INTERFACE_INFORMATION) + \ - (sizeof(USBD_PIPE_INFORMATION)*(numEndpoints)) \ - - sizeof(USBD_PIPE_INFORMATION)) - -// -// Calculates the size of an iso urb request given the number of packets -// - -#define GET_ISO_URB_SIZE(n) (sizeof(struct _URB_ISOCH_TRANSFER)+\ - sizeof(USBD_ISO_PACKET_DESCRIPTOR)*n) - - -#ifndef _USBD_ - -__drv_maxIRQL(DISPATCH_LEVEL) -DECLSPEC_IMPORT -VOID -USBD_GetUSBDIVersion( - __out PUSBD_VERSION_INFORMATION VersionInformation - ); - - -__drv_preferredFunction("USBD_ParseConfigurationDescriptorEx", "Obsolete") -DECLSPEC_IMPORT -PUSB_INTERFACE_DESCRIPTOR -USBD_ParseConfigurationDescriptor( - __in PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, - __in UCHAR InterfaceNumber, - __in UCHAR AlternateSetting - ); -/*++ - -Routine Description: - - This function is replaced by USBD_ParseConfigurationDescriptorEx - -Arguments: - -Return Value: - - ---*/ - - -__drv_preferredFunction("USBD_CreateConfigurationRequestEx", "Obsolete") -DECLSPEC_IMPORT -PURB -USBD_CreateConfigurationRequest( - __in PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, - __out PUSHORT Siz - ); -/*++ - -Routine Description: - - This function is replaced by USBD_CreateConfigurationRequestEx - -Arguments: - - -Return Value: - - ---*/ - - -// -// These APIS replace USBD_CreateConfigurationRequest, -// USBD_ParseConfigurationDescriptor -// - -__drv_maxIRQL(APC_LEVEL) -DECLSPEC_IMPORT -PUSB_COMMON_DESCRIPTOR -USBD_ParseDescriptors( - __in PVOID DescriptorBuffer, - __in ULONG TotalLength, - __in PVOID StartPosition, - __in LONG DescriptorType - ); -/*++ - -Routine Description: - - Parses a group of standard USB configuration descriptors (returned from a device) for - a specific descriptor type. - -Arguments: - - DescriptorBuffer - pointer to a block of contiguous USB desscriptors - TotalLength - size in bytes of the Descriptor buffer - StartPosition - starting position in the buffer to begin parsing, - this must point to the begining of a USB descriptor. - DescriptorType - USB descritor type to locate. - - -Return Value: - - pointer to a usb descriptor with a DescriptorType field matching the - input parameter or NULL if not found. - ---*/ - - -__drv_maxIRQL(APC_LEVEL) -DECLSPEC_IMPORT -PUSB_INTERFACE_DESCRIPTOR -USBD_ParseConfigurationDescriptorEx( - __in PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, - __in PVOID StartPosition, - __in LONG InterfaceNumber, - __in LONG AlternateSetting, - __in LONG InterfaceClass, - __in LONG InterfaceSubClass, - __in LONG InterfaceProtocol - ); -/*++ - -Routine Description: - - Parses a standard USB configuration descriptor (returned from a device) for - a specific interface, alternate setting class subclass or protocol codes - -Arguments: - - ConfigurationDescriptor - pointer to USB configuration descriptor, returned - from a device (includes all interface and endpoint - descriptors). - StartPosition - pointer to starting position within the configuration - descrptor to begin parsing -- this must be a valid usb - descriptor. - InterfaceNumber - interface number to find, (-1) match any - AlternateSetting - alt setting number to find, (-1) match any - InterfaceClass - class to find, (-1) match any - InterfaceSubClass - subclass to find, (-1) match any - InterfaceProtocol - protocol to find, (-1) match any - -Return Value: - - returns a pointer to the first interface descriptor matching the parameters - passed in (starting from startposition) or NULL if no match is found. - ---*/ - -__drv_maxIRQL(DISPATCH_LEVEL) -DECLSPEC_IMPORT -PURB -USBD_CreateConfigurationRequestEx( - __in PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, - __in PUSBD_INTERFACE_LIST_ENTRY InterfaceList - ); -/*++ - -Routine Description: - - Allocates and initilaizes a urb of sufficient size to configure a device - based on the list of interfaces passed in. - - The interface list is a contiguous array of USBD_INTERFACE_LIST_ENTRIES - each pointing to a specific interface descriptor to be incorporated in - the request, the list is terminated by a list entry with an - InterfaceDescriptor pointer of NULL. - - On return the interface field of each list entry is filled in with a pointer - to the USBD_INTERFACE_INFORMATION structure within the URB corrisponding to - the same interface descriptor. - -Arguments: - - ConfigurationDescriptor - pointer to USB configuration descriptor, returned - from a device (includes all interface and endpoint - descriptors). - - InterfaceList - list of interfaces we are interested in. - -Return Value: - - Pointer to initailized select_configuration urb. - ---*/ - -__drv_maxIRQL(PASSIVE_LEVEL) -__declspec(dllexport) -ULONG -USBD_GetInterfaceLength( - __in PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor, - __in PUCHAR BufferEnd - ); -/*++ - -Routine Description: - - Returns the length (in bytes) of a given interface descriptor - including all endpoint and class descriptors - - -Arguments: - - InterfaceDescriptor - - BufferEnd - Pointer to the end of the buffer containing the descriptors - -Return Value: - - length of descriptors - ---*/ - - -__drv_maxIRQL(PASSIVE_LEVEL) -__declspec(dllexport) -VOID -USBD_RegisterHcFilter( - __in PDEVICE_OBJECT DeviceObject, - __in PDEVICE_OBJECT FilterDeviceObject - ); - -/*++ - -Routine Description: - - Called by an HC filter driver after it attaches to the top - of the host controller driver stack. - -Arguments: - - DeviceObject - current top of stack - - FilterDeviceObject - device object for the filter driver - -Return Value: - - none - ---*/ - -__drv_maxIRQL(APC_LEVEL) -__drv_preferredFunction("(see documentation)", "Obsolete") -__declspec(dllexport) -NTSTATUS -USBD_GetPdoRegistryParameter( - __in PDEVICE_OBJECT PhysicalDeviceObject, - __inout_bcount(ParameterLength) PVOID Parameter, - __in ULONG ParameterLength, - __in_bcount(KeyNameLength) PWSTR KeyName, - __in ULONG KeyNameLength - ); -/*++ - -Routine Description: - -Arguments: - -Return Value: - ---*/ - -__drv_preferredFunction("(see documentation)", "Obsolete") -__declspec(dllexport) -NTSTATUS -USBD_QueryBusTime( - __in PDEVICE_OBJECT RootHubPdo, - __out PULONG CurrentFrame - ); -/*++ - -Routine Description: - - Returns the current frame, callable at any IRQL - -Arguments: - -Return Value: - ---*/ - -/* - Defined for Windows XP and later -*/ - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_preferredFunction("(see documentation)", "Obsolete") -DECLSPEC_IMPORT -ULONG -USBD_CalculateUsbBandwidth( - __in ULONG MaxPacketSize, - __in UCHAR EndpointType, - __in BOOLEAN LowSpeed - ); -/*++ - -Routine Description: - - Returns bus bw consumed based on the endpoint type and - packet size - -Arguments: - -Return Value: - ---*/ -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -__drv_maxIRQL(DISPATCH_LEVEL) -DECLSPEC_IMPORT -USBD_STATUS -USBD_ValidateConfigurationDescriptor( - __in_bcount(BufferLength) PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc, - __in ULONG BufferLength, - __in USHORT Level, - __out PUCHAR *Offset, - __in_opt ULONG Tag); -/*++ - -Routine Description: - - Validates a USB Configuration Descriptor - -Arguments: - - ConfigDesc: Pointer to the USB Configuration descriptor to be validated - - BufferLength: Known size of buffer pointed to by ConfigDesc (NOT NECESSARILY wTotalLength) - - Level: Level of checking desired: - 1: Basic Config Descriptor header check only - - 2: Full pass-through of the config descriptor checking for the following: - - a) Unique endpoint addresses and interface numbers - c) Number of interfaces contained in the descriptor - d) Ensures the bLength values of the USB descriptors do not - exceed the length of the buffer. - c) Basic validation of information in a USB_INTERFACE_ASSOCIATION_DESCRIPTOR - - 3: Includes all of the validation for levels 1-2 plus the following: - - a) Validation of the number of endpoints in each interface - b) Enforcement of the USB spec descriptor bLength sizes. - c) Check to see if all interface numbers are in - sequential(not necessarily consecutive) order. - - - Offset: if the USBD_STATUS returned is not USBD_STATUS_SUCCESS, offet will - be set to the address within the ConfigDesc buffer where the failure occured. - - Tag: Driver-defined heap pool tag to be used by usbdlib. - - Return Value: - - One of the USBD_STATUS codes declared in usb.h - ---*/ - -#endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ - -#endif /* _USBD_ */ - -#endif /* __USBDLIB_H__ */ - diff --git a/pub/ddk/usbdrivr.h b/pub/ddk/usbdrivr.h deleted file mode 100644 index e24410a..0000000 --- a/pub/ddk/usbdrivr.h +++ /dev/null @@ -1,35 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - USBDRIVR.H - -Abstract: - - This file defined USB header files of interest to a driver. - -Environment: - - Kernel mode - -Revision History: - ---*/ - -#ifndef __USBDRIVR_H__ -#define __USBDRIVR_H__ - -#define USB_KERNEL_IOCTL -#include "usbioctl.h" -#undef USB_KERNEL_IOCTL - -#include "usb.h" -#include "usbdlib.h" -#include "usbbusif.h" - - -#endif // __USBDRIVR_H__ - - diff --git a/pub/ddk/usbkern.h b/pub/ddk/usbkern.h deleted file mode 100644 index 0b61e4e..0000000 --- a/pub/ddk/usbkern.h +++ /dev/null @@ -1,35 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - USBKERN.H - -Abstract: - - This file contains KERNEL Mode IOCTLS supported by - the HCD (PORT) drivers ROOT HUB PDO. - - OBSOLETE header file. Use usbioctl.h instead. - -Environment: - - kernel mode - -Revision History: - - 4/2003: Header obsolete - - ---*/ - -#ifndef __USBKERN_H__ -#define __USBKERN_H__ - - -#include "usbioctl.h" - -#endif //__USBKERN_H__ - - diff --git a/pub/ddk/usbprint.h b/pub/ddk/usbprint.h deleted file mode 100644 index bc5d807..0000000 --- a/pub/ddk/usbprint.h +++ /dev/null @@ -1,49 +0,0 @@ -/*++ - -Copyright (c) 1998 - 2000 Microsoft Corporation - -Module Name: - - ioctl.h - -Abstract: - - - -Environment: - - Kernel & user mode - -Revision History: - - ---*/ - -#define USBPRINT_IOCTL_INDEX 0x0000 - - -#define IOCTL_USBPRINT_GET_LPT_STATUS CTL_CODE(FILE_DEVICE_UNKNOWN, \ - USBPRINT_IOCTL_INDEX+12,\ - METHOD_BUFFERED, \ - FILE_ANY_ACCESS) - -#define IOCTL_USBPRINT_GET_1284_ID CTL_CODE(FILE_DEVICE_UNKNOWN, \ - USBPRINT_IOCTL_INDEX+13,\ - METHOD_BUFFERED, \ - FILE_ANY_ACCESS) - -#define IOCTL_USBPRINT_VENDOR_SET_COMMAND CTL_CODE(FILE_DEVICE_UNKNOWN, \ - USBPRINT_IOCTL_INDEX+14,\ - METHOD_BUFFERED, \ - FILE_ANY_ACCESS) - -#define IOCTL_USBPRINT_VENDOR_GET_COMMAND CTL_CODE(FILE_DEVICE_UNKNOWN, \ - USBPRINT_IOCTL_INDEX+15,\ - METHOD_BUFFERED, \ - FILE_ANY_ACCESS) - -#define IOCTL_USBPRINT_SOFT_RESET CTL_CODE(FILE_DEVICE_UNKNOWN, \ - USBPRINT_IOCTL_INDEX+16,\ - METHOD_BUFFERED, \ - FILE_ANY_ACCESS) - diff --git a/pub/ddk/usbscan.h b/pub/ddk/usbscan.h deleted file mode 100644 index 4ebe14d..0000000 --- a/pub/ddk/usbscan.h +++ /dev/null @@ -1,157 +0,0 @@ -/*++ - -Copyright (C) 1997, Logitech Inc. - -Module Name: - UsbScan.h - -Abstract: - Interface with UsbScan kernel driver - -Environment: - User and kernel mode use - -Notes: - Interface definition for USB still image driver. - ---*/ - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -#ifndef _USBSCAN_H_ -#define _USBSCAN_H_ -#pragma pack(push,8) - -#ifndef MAX_NUM_PIPES - #define MAX_NUM_PIPES 8 -#endif - -#define BULKIN_FLAG 0x80 - -typedef struct _DRV_VERSION { - __out unsigned major; - __out unsigned minor; - __out unsigned internal; -} DRV_VERSION, *PDRV_VERSION; - -typedef struct _IO_BLOCK { - __in unsigned uOffset; - __in unsigned uLength; - __inout_bcount(uLength) PUCHAR pbyData; - __in unsigned uIndex; -} IO_BLOCK, *PIO_BLOCK; - -typedef struct _IO_BLOCK_EX { - __in unsigned uOffset; - __in unsigned uLength; - __inout_bcount(uLength) PUCHAR pbyData; - __in unsigned uIndex; - - // - // Following two fields are described in sec. 9.3.1,2 USB specification - // - __in UCHAR bRequest; // Specific request - __in UCHAR bmRequestType; // Bitmap - charateristics of request - __in UCHAR fTransferDirectionIn; // TRUE - Device-->Host; FALSE - Host-->Device - -} IO_BLOCK_EX, *PIO_BLOCK_EX; - - -typedef struct _CHANNEL_INFO { - __out unsigned EventChannelSize; - __out unsigned uReadDataAlignment; - __out unsigned uWriteDataAlignment; -} CHANNEL_INFO, *PCHANNEL_INFO; - -typedef enum { - EVENT_PIPE, - READ_DATA_PIPE, - WRITE_DATA_PIPE, - ALL_PIPE -} PIPE_TYPE; - - -typedef struct _USBSCAN_GET_DESCRIPTOR { - __in UCHAR DescriptorType; // high byte of wValue field in USB spec. - __in UCHAR Index; // low byte of wValue field in USB spec. - __in USHORT LanguageId; // wIndex field in USB spec. -} USBSCAN_GET_DESCRIPTOR, *PUSBSCAN_GET_DESCRIPTOR; - - -// -// The device descriptor structure reports information define in the hardware. -// If there is enough space to copy the strings, it will be done otherwise -// only the three first fields: -// -// USHORT usVendorId; -// USHORT usProductId; -// USHORT usBcdDevice; -// -// will contain valid data. Remember: The strings are UNICODE format. -// - -typedef struct _DEVICE_DESCRIPTOR { - __out USHORT usVendorId; - __out USHORT usProductId; - __out USHORT usBcdDevice; - __out USHORT usLanguageId; -} DEVICE_DESCRIPTOR, *PDEVICE_DESCRIPTOR; - -typedef enum _RAW_PIPE_TYPE { - USBSCAN_PIPE_CONTROL, - USBSCAN_PIPE_ISOCHRONOUS, - USBSCAN_PIPE_BULK, - USBSCAN_PIPE_INTERRUPT -} RAW_PIPE_TYPE; - -typedef struct _USBSCAN_PIPE_INFORMATION { - USHORT MaximumPacketSize; // Maximum packet size for this pipe - UCHAR EndpointAddress; // 8 bit USB endpoint address (includes direction) - UCHAR Interval; // Polling interval in ms if interrupt pipe - RAW_PIPE_TYPE PipeType; // PipeType identifies type of transfer valid for this pipe -} USBSCAN_PIPE_INFORMATION, *PUSBSCAN_PIPE_INFORMATION; - -typedef struct _USBSCAN_PIPE_CONFIGURATION { - __out ULONG NumberOfPipes; - __out_ecount(NumberOfPipes) USBSCAN_PIPE_INFORMATION PipeInfo[MAX_NUM_PIPES]; -} USBSCAN_PIPE_CONFIGURATION, *PUSBSCAN_PIPE_CONFIGURATION; - -#if (NTDDI_VERSION >= NTDDI_WINXP) -typedef struct _USBSCAN_TIMEOUT { - ULONG TimeoutRead; - ULONG TimeoutWrite; - ULONG TimeoutEvent; -} USBSCAN_TIMEOUT, *PUSBSCAN_TIMEOUT; -#endif // (NTDDI_VERSION >= NTDDI_WINXP) - -#define FILE_DEVICE_USB_SCAN 0x8000 -#define IOCTL_INDEX 0x0800 - -#define IOCTL_GET_VERSION CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_CANCEL_IO CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+1, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_WAIT_ON_DEVICE_EVENT CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+2, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_READ_REGISTERS CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+3, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_WRITE_REGISTERS CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+4, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_GET_CHANNEL_ALIGN_RQST CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+5, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_GET_DEVICE_DESCRIPTOR CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+6, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_RESET_PIPE CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+7, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_GET_USB_DESCRIPTOR CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+8, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_SEND_USB_REQUEST CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+9, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_GET_PIPE_CONFIGURATION CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+10,METHOD_BUFFERED,FILE_ANY_ACCESS) - -#if (NTDDI_VERSION >= NTDDI_WINXP) -#define IOCTL_SET_TIMEOUT CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+11,METHOD_BUFFERED,FILE_ANY_ACCESS) -#endif // (NTDDI_VERSION >= NTDDI_WINXP) - -// -// Temporary to avoid breaking LOGISCAN code -// -#define ALL ALL_PIPE -#define IOCTL_ABORT_PIPE IOCTL_CANCEL_IO -// -// -#pragma pack(pop) -#endif // _USBSCAN_H_ - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) - diff --git a/pub/ddk/usbstorioctl.h b/pub/ddk/usbstorioctl.h deleted file mode 100644 index d3ecfe9..0000000 --- a/pub/ddk/usbstorioctl.h +++ /dev/null @@ -1,103 +0,0 @@ -/*++ - -Copyright (c) 1996-2007 Microsoft Corporation - -Module Name: - - USBStorIoctl.h - -Abstract: - - Header file for USBSTOR IOCTLs - -Environment: - - kernel mode - -Revision History: - - 05-01-07 : Created - ---*/ - -#pragma once - -#ifndef MAX_PATH -#define MAX_PATH 260 -#endif - -typedef struct tagACT_AUTHZ_STATE -{ - UCHAR ACT; - BOOLEAN fAuthorized; -} ACT_AUTHZ_STATE, *PACT_AUTHZ_STATE; - -typedef struct tagSILO_COMMAND -{ - UCHAR SiloIndex; - UCHAR Command; - ULONG cbCommandBuffer; - UCHAR rgbCommandBuffer[ANYSIZE_ARRAY]; -} SILO_COMMAND, *PSILO_COMMAND; - -// Enumeration -typedef enum _PDO_TYPE -{ - PDO_TYPE_UNDEFINED = 0, - - // Types either enumerated or provided as filter parameter to IOCTL_EHSTOR_DEVICE_ENUMERATE_PDOS - PDO_TYPE_DISK, - PDO_TYPE_CONTROL, - PDO_TYPE_SILO, - - // This type is never enumerated, only provided as a filter parameter to IOCTL_EHSTOR_DEVICE_ENUMERATE_PDOS - PDO_TYPE_THIS = 256 -} PDO_TYPE; - -// Enumeration -typedef enum _PDO_STATE -{ - PDO_STATE_UNDEFINED = 0, - PDO_STATE_STARTED, - PDO_STATE_NOT_STARTED -} PDO_STATE; - -// Bit-mask -typedef enum _PDO_CAPS -{ - PDO_CAPABILITY_UNDEFINED = 0, - PDO_CAPABILITY_INC512_SET = 1, - PDO_CAPABILITY_INC512_CLEAR = 2 -} PDO_CAPS; - -typedef struct _ENUM_PDO_ENTRY -{ - UCHAR type; - UCHAR state; - UCHAR capabilities; - ULONG ulSTID; - UCHAR bSpecificationMajor; - UCHAR bSpecificationMinor; - UCHAR bImplementationMajor; - UCHAR bImplementationMinor; - WCHAR wszDeviceInstancePath[(2 * MAX_PATH) + 1]; -} ENUM_PDO_ENTRY, *PENUM_PDO_ENTRY; - -typedef struct _ENUM_PDO_RESULTS -{ - ULONG cEntries; - ENUM_PDO_ENTRY rgEntries[ANYSIZE_ARRAY]; - -} ENUM_PDO_RESULTS, *PENUM_PDO_RESULTS; - -#define SIZE_ENUM_PDO_RESULTS_HEADER (sizeof(ENUM_PDO_RESULTS) - sizeof(ENUM_PDO_ENTRY)) - -#define IOCTL_EHSTOR_DEVICE_SET_AUTHZ_STATE CTL_CODE(IOCTL_STORAGE_BASE, 0x501, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_EHSTOR_DEVICE_GET_AUTHZ_STATE CTL_CODE(IOCTL_STORAGE_BASE, 0x502, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_EHSTOR_DEVICE_SILO_COMMAND CTL_CODE(IOCTL_STORAGE_BASE, 0x503, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_EHSTOR_DEVICE_ENUMERATE_PDOS CTL_CODE(IOCTL_STORAGE_BASE, 0x504, METHOD_BUFFERED, FILE_ANY_ACCESS) - -DEFINE_GUID(GUID_USBSTOR_EHSTOR_SILO_INTERFACE, 0x7c2bcf57, 0x2bea, 0x46da, 0xad, 0x26, 0x78, 0xfd, 0xc8, 0x3c, 0xee, 0x46); -DEFINE_GUID(GUID_USBSTOR_EHSTOR_CONTROL_INTERFACE, 0x4f40006f, 0xb933, 0x4550, 0xb5, 0x32, 0x2b, 0x58, 0xce, 0xe6, 0x14, 0xd3); - - diff --git a/pub/ddk/vcclr.h b/pub/ddk/vcclr.h deleted file mode 100644 index f10e642..0000000 --- a/pub/ddk/vcclr.h +++ /dev/null @@ -1,60 +0,0 @@ -// -// vcclr.h - helper code for using the managed extensions to C++ -// -// Copyright (C) Microsoft Corporation -// All rights reserved. -// - -#if _MSC_VER > 1000 -#pragma once -#endif - -#if !defined(_INC_VCCLR) -#define _INC_VCCLR - -#include - -#pragma warning(push) -#pragma warning(disable:4400) - -#ifdef __cplusplus_cli -typedef cli::interior_ptr __const_Char_ptr; -typedef cli::interior_ptr __const_Byte_ptr; -typedef cli::interior_ptr _Byte_ptr; -typedef const System::String^ __const_String_handle; -#define _NULLPTR nullptr -#else -typedef const System::Char* __const_Char_ptr; -typedef const System::Byte* __const_Byte_ptr; -typedef System::Byte* _Byte_ptr; -typedef const System::String* __const_String_handle; -#define _NULLPTR 0 -#endif - - -// -// get an interior gc pointer to the first character contained in a System::String object -// -inline -__const_Char_ptr -#ifdef __cplusplus_cli -__clrcall -#endif -PtrToStringChars( - __const_String_handle s - ) -{ - _Byte_ptr bp = const_cast<_Byte_ptr>(reinterpret_cast<__const_Byte_ptr>(s)); - if( bp != _NULLPTR ) { - unsigned offset = System::Runtime::CompilerServices::RuntimeHelpers::OffsetToStringData; - bp += offset; - } - return reinterpret_cast<__const_Char_ptr>(bp); -} - -#pragma warning(pop) - -#undef _NULLPTR - -#endif //_INC_VCCLR - diff --git a/pub/ddk/vfwext.h b/pub/ddk/vfwext.h deleted file mode 100644 index 080c926..0000000 --- a/pub/ddk/vfwext.h +++ /dev/null @@ -1,73 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - VfWExt.h - -Abstract: - - Constants and function prototypes needed to create IHV's extension DLL - and constants used to programatically open a target capture device. - - ---*/ - -#include - -#define VFW_HIDE_SETTINGS_PAGE 0x00000001 -#define VFW_HIDE_VIDEOSRC_PAGE 0x00000002 -#define VFW_HIDE_CAMERACONTROL_PAGE 0x00000004 -#define VFW_HIDE_ALL_PAGES (VFW_HIDE_SETTINGS_PAGE |\ - VFW_HIDE_VIDEOSRC_PAGE |\ - VFW_HIDE_CAMERACONTROL_PAGE) -#define VFW_OEM_ADD_PAGE 0x80000000 // If OEM has added any page - - -#define VFW_USE_DEVICE_HANDLE 0x00000001 -#define VFW_USE_STREAM_HANDLE 0x00000002 -#define VFW_QUERY_DEV_CHANGED 0x00000100 // if selected_dev == streaming_dev - - -// -// This is the function pointer that vfwwdm mapper calls to add an page -// -typedef -DWORD (CALLBACK FAR * VFWWDMExtensionProc)( - LPVOID pfnDeviceIoControl, - LPFNADDPROPSHEETPAGE pfnAddPropertyPage, - LPARAM lParam); - -// -// This is the function pointer that you can call to make DeviceIoControl() calls. -// -typedef -BOOL (CALLBACK FAR * LPFNEXTDEVIO)( - LPARAM lParam, - DWORD dwFlags, - DWORD dwIoControlCode, - LPVOID lpInBuffer, - DWORD nInBufferSize, - LPVOID lpOutBuffer, - DWORD nOutBufferSize, - LPDWORD lpBytesReturned, - LPOVERLAPPED lpOverlapped); - - -// -// HLM\System\CurrentControlSet\Control\MediaResources\msvideo\MSVideo.VFWWDM -// -// Registry values used to allow a VfW client application to programatically -// open a target capture device. The first is the FriendlyName of the capture -// device; and the 2nd flag if set, vfwwdm mapper will open only; if failed, -// no attempt will be made by VfWWDM mapper to open other WDM capture device. -// -// Both registry value should be clear after capDriverConnect(). VfWWDM mapper -// will not clear them unless video source dialog box is chosen. -// -#define TARGET_DEVICE_FRIENDLY_NAME "TargetDeviceFriendlyName" // REG_SZ -#define TARGET_DEVICE_OPEN_EXCLUSIVELY "TargetDeviceOpenExclusively" // REG_DWORD - - - diff --git a/pub/ddk/video.h b/pub/ddk/video.h deleted file mode 100644 index 1041d94..0000000 --- a/pub/ddk/video.h +++ /dev/null @@ -1,2783 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - video.h - -Abstract: - - Contains all structure and routine definitions common to the video port - driver and the video miniport drivers. - -Notes: - -Revision History: - ---*/ - -#ifndef __VIDEO_H__ -#define __VIDEO_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Define port driver status code. -// The values for these are the Win32 error codes -// - -typedef LONG VP_STATUS; -typedef VP_STATUS *PVP_STATUS; - -// -// Defines for registry information and synchronization. -// - -typedef enum VIDEO_SYNCHRONIZE_PRIORITY { - VpLowPriority, - VpMediumPriority, - VpHighPriority -} VIDEO_SYNCHRONIZE_PRIORITY, *PVIDEO_SYNCHRONIZE_PRIORITY; - -typedef struct _VIDEO_PORT_SPIN_LOCK *PSPIN_LOCK; - -// -// Type of information requested with GetDeviceData -// - -typedef enum _VIDEO_DEVICE_DATA_TYPE { - VpMachineData, - VpCmosData, - VpBusData, - VpControllerData, - VpMonitorData -} VIDEO_DEVICE_DATA_TYPE, *PVIDEO_DEVICE_DATA_TYPE; - -typedef enum _VP_POOL_TYPE { - VpNonPagedPool, - VpPagedPool, - VpNonPagedPoolCacheAligned = 4, - VpPagedPoolCacheAligned -} VP_POOL_TYPE, *PVP_POOL_TYPE; - -// -// Data returned with VpControllerData -// - -typedef struct _VIDEO_HARDWARE_CONFIGURATION_DATA { - INTERFACE_TYPE InterfaceType; - ULONG BusNumber; - USHORT Version; - USHORT Revision; - USHORT Irql; - USHORT Vector; - ULONG ControlBase; - ULONG ControlSize; - ULONG CursorBase; - ULONG CursorSize; - ULONG FrameBase; - ULONG FrameSize; -} VIDEO_HARDWARE_CONFIGURATION_DATA, *PVIDEO_HARDWARE_CONFIGURATION_DATA; - -// -// Define structure used to call the BIOS int 10 function -// - -typedef struct _VIDEO_X86_BIOS_ARGUMENTS { - ULONG Eax; - ULONG Ebx; - ULONG Ecx; - ULONG Edx; - ULONG Esi; - ULONG Edi; - ULONG Ebp; -} VIDEO_X86_BIOS_ARGUMENTS, *PVIDEO_X86_BIOS_ARGUMENTS; - -typedef struct _INT10_BIOS_ARGUMENTS { - ULONG Eax; - ULONG Ebx; - ULONG Ecx; - ULONG Edx; - ULONG Esi; - ULONG Edi; - ULONG Ebp; - USHORT SegDs; - USHORT SegEs; -} INT10_BIOS_ARGUMENTS, *PINT10_BIOS_ARGUMENTS; - -// -// Debugging statements. This will remove all the debug information from the -// "free" version. -// - -#if DBG -#define VideoDebugPrint(arg) VideoPortDebugPrint arg -#else -#define VideoDebugPrint(arg) -#endif - -typedef enum VIDEO_DEBUG_LEVEL { - Error = 0, - Warn, - Trace, - Info -} VIDEO_DEBUG_LEVEL, *PVIDEO_DEBUG_LEVEL; - -// -// Allows us to remove lots of unused code. -// - - -#ifndef _NTOSDEF_ - -//don't pickup ntosp version -#ifdef PAGED_CODE -#undef PAGED_CODE -#endif - -#define ALLOC_PRAGMA 1 -#define VIDEOPORT_API __declspec(dllimport) - -#if DBG -#define PAGED_CODE() \ - if (VideoPortGetCurrentIrql() > 1 /*APC_LEVEL*/) { \ - VideoPortDebugPrint(0, "Video: Pageable code called at IRQL %d\n", VideoPortGetCurrentIrql() ); \ - ASSERT(FALSE); \ - } - -#else -#define PAGED_CODE() -#endif - -ULONG -DriverEntry( - PVOID Context1, - PVOID Context2 - ); - -#else -#define VIDEOPORT_API -#endif - -#ifndef _NTOS_ - -// -// These are the various function prototypes of the routines that are -// provided by the kernel driver to hook out access to io ports. -// - -typedef -VP_STATUS -(*PDRIVER_IO_PORT_UCHAR ) ( - ULONG_PTR Context, - ULONG Port, - UCHAR AccessMode, - PUCHAR Data - ); - -typedef -VP_STATUS -(*PDRIVER_IO_PORT_UCHAR_STRING ) ( - ULONG_PTR Context, - ULONG Port, - UCHAR AccessMode, - PUCHAR Data, - ULONG DataLength - ); - -typedef -VP_STATUS -(*PDRIVER_IO_PORT_USHORT ) ( - ULONG_PTR Context, - ULONG Port, - UCHAR AccessMode, - PUSHORT Data - ); - -typedef -VP_STATUS -(*PDRIVER_IO_PORT_USHORT_STRING ) ( - ULONG_PTR Context, - ULONG Port, - UCHAR AccessMode, - PUSHORT Data, - ULONG DataLength // number of words - ); - -typedef -VP_STATUS -(*PDRIVER_IO_PORT_ULONG ) ( - ULONG_PTR Context, - ULONG Port, - UCHAR AccessMode, - PULONG Data - ); - -typedef -VP_STATUS -(*PDRIVER_IO_PORT_ULONG_STRING ) ( - ULONG_PTR Context, - ULONG Port, - UCHAR AccessMode, - PULONG Data, - ULONG DataLength // number of dwords - ); - -#endif // _NTOS_ - - -// -// Definition of the request packet sent from the port driver to the -// miniport driver. It reflects the parameters passed from the -// DeviceIOControl call made by the windows display driver. -// -// N.B. The definition of the STATUS_BLOCK must be the same as the -// the definition of IO_STATUS_BLOCK defined in ntioapi.h. -// - -typedef struct _STATUS_BLOCK { - - // - // Contains the status code of the operation. - // This value in one of the Win32 error codes that are defined for use - // in the video miniport drivers. - // - - union { - VP_STATUS Status; - PVOID Pointer; - }; - - // - // Information returned to the callee. - // The meaning of the information varies from function to function. It - // is generally used to return the minimum size for the input buffer if - // the function takes an input buffer, or the amount of data transfered - // back to the caller if the operation returns output. - // - - ULONG_PTR Information; - -} STATUS_BLOCK, *PSTATUS_BLOCK; - -typedef struct _VIDEO_REQUEST_PACKET { - - // - // The IO control code passed to the DeviceIoControl function by the - // caller. - // - - ULONG IoControlCode; - - // - // Pointer to a status block provided by the caller. This should be - // filled out by the callee with the appropriate information. - // - - PSTATUS_BLOCK StatusBlock; - - // - // Pointer to an input buffer which contains the information passed in - // by the caller. - // - - PVOID InputBuffer; - - // - // Size of the input buffer - // - - ULONG InputBufferLength; - - // - // Pointer to an output buffer into which the data returned to the caller - // should be stored. - // - - PVOID OutputBuffer; - - // - // Length of the output buffer. This buffer can not be grown by the - // callee. - // - - ULONG OutputBufferLength; - -} VIDEO_REQUEST_PACKET, *PVIDEO_REQUEST_PACKET; - -// -// typedef for scattergather array available via GET_VIDEO_SCATTERGATHER(). -// - -typedef struct __VRB_SG { - __int64 PhysicalAddress; - ULONG Length; - } VRB_SG, *PVRB_SG; - -// -// Opaque type for dma handle -// - -typedef struct __DMA_PARAMETERS * PDMA; - -// -// The following macro returns in Address the 32 bit physical address of -// the VirtualAddress lying within the InputBuffer passed into EngDevIo -// - -#define GET_VIDEO_PHYSICAL_ADDRESS(scatterList, VirtualAddress, InputBuffer, pLength, Address) \ - \ - do { \ - ULONG_PTR byteOffset; \ - \ - byteOffset = (PCHAR) VirtualAddress - (PCHAR)InputBuffer; \ - \ - while (byteOffset >= scatterList->Length) { \ - \ - byteOffset -= scatterList->Length; \ - scatterList++; \ - } \ - \ - *pLength = scatterList->Length - byteOffset; \ - \ - Address = (ULONG_PTR) (scatterList->PhysicalAddress + byteOffset); \ - \ - } while (0) - - -#define GET_VIDEO_SCATTERGATHER(ppDma) (**(PVRB_SG **)ppDma) - -// -// Opaque type for PVP_DMA_ADAPTER -// - -typedef struct __VP_DMA_ADAPTER *PVP_DMA_ADAPTER; - -typedef enum _VP_LOCK_OPERATION { - VpReadAccess, - VpWriteAccess, - VpModifyAccess - } VP_LOCK_OPERATION; - -typedef struct _VP_DEVICE_DESCRIPTION { - BOOLEAN ScatterGather; - BOOLEAN Dma32BitAddresses; - BOOLEAN Dma64BitAddresses; - ULONG MaximumLength; -} VP_DEVICE_DESCRIPTION, *PVP_DEVICE_DESCRIPTION; - -typedef struct _VP_SCATTER_GATHER_ELEMENT { - PHYSICAL_ADDRESS Address; - ULONG Length; - ULONG_PTR Reserved; - } VP_SCATTER_GATHER_ELEMENT, *PVP_SCATTER_GATHER_ELEMENT; - -#pragma warning(disable:4200) -typedef struct _VP_SCATTER_GATHER_LIST { - ULONG NumberOfElements; - ULONG_PTR Reserved; - VP_SCATTER_GATHER_ELEMENT Elements[]; - } VP_SCATTER_GATHER_LIST, *PVP_SCATTER_GATHER_LIST; -#pragma warning(default:4200) - -#define VIDEO_RANGE_PASSIVE_DECODE 0x1 -#define VIDEO_RANGE_10_BIT_DECODE 0x2 - - -// -// The following structure is used to define access ranges. The ranges are -// used to indicate which ports and memory adresses are being used by the -// card. -// - -typedef struct _VIDEO_ACCESS_RANGE { - - // - // Indicates the starting memory address or port number of the range. - // This values should be stored before being transformed by - // VideoPortGetDeviceBase() which returns the logical address that must - // be used by the miniport driver when referencing physical addresses. - // - - PHYSICAL_ADDRESS RangeStart; - - // - // Indicates the length in bytes, or number of ports in the range. This - // value should indicate the range actually decoded by the adapter. For - // example, if the adapter uses 7 registers but responds to eight, the - // RangeLength should be set to 8. - - ULONG RangeLength; - - // - // Indicates if the range is in IO space (TRUE) or in memory space (FALSE). - // - - UCHAR RangeInIoSpace; - - // - // Indicates if the range should be visible by the Windows display driver. - // This is done so that a Windows display driver can access certain - // video ports directly. This will only be allowed if the caller has the - // required privileges (is a trusted subsystem) to access the range. - // - // Synchronization of access to ports or memory in the range must be - // done explicitly by the miniport driver and the user mode process so - // that they both don't try to program the device simultaneously. - // - // Non visible ranges should include video memory, ROM addresses, etc. - // which are not required to program the device for output purposes. - // - // - - UCHAR RangeVisible; - - // - // This field determines if the range can be shared with another device. - // The rule should be applied as follow. - // - // - If the range of memory or IO ports should be "owned" by this driver, - // and that any other driver trying to access this range may cause - // a problem, FALSE should be returned. - // - // - If the range can be shared with another co-operating device driver, - // then the share field should be set to TRUE. - // - // As a guideline, the VGA miniport driver will claim all of its resources - // as shareable so that it can be used as a VGA compatible device with - // any other driver (such as an S3 or XGA. - // - // Super VGA miniport drivers that implement all the VGA functionality - // (declared in the Registry as VGACOMPATIBLE=1) should claim the range - // as non-shareable since they don't want the VGA to run at the same time. - // - // Miniports for cards such as an S3 or XGA that have an XGA on the board - // but do not implement the VGA functionality will run with the VGA - // miniport loaded and should therefore claim all the resources shared - // with the VGA as shareable. - // - // Miniports for cards that work with a pass-through and that can be - // connected to any VGA/SVGA card should not be using any VGA ports or - // memory ranges ! ... but if they do they should not claim those - // resources since they will cause a conflict in the system because the - // SVGA cards will have claimed them as non-shareable ... - // - - UCHAR RangeShareable; - - // - // Indicates that the range is decoded by the hardware, but that the - // driver will never access this port. - // - - UCHAR RangePassive; - -} VIDEO_ACCESS_RANGE, *PVIDEO_ACCESS_RANGE; - - -typedef -PVOID -(*PVIDEO_PORT_GET_PROC_ADDRESS)( - IN PVOID HwDeviceExtension, - IN PUCHAR FunctionName - ); - -// -// This structure contains the specific configuration information about the -// device. The information is initialized by the port driver and it should -// be completed by the miniport driver. -// The information is used to setup the device, as weel as providing -// information to the port driver so it can perform some of the requests on -// behalf of the miniport driver. -// - -typedef struct _VIDEO_PORT_CONFIG_INFO { - - // - // Specifies the length of the PVIDEO_PORT_CONFIG_INFO structure as - // returned by sizeof(). Since this structure may grow in later - // releases, the miniport driver should check that the length of the - // structure is greater than or equal to the length it expects (since - // it is guaranteed that defined fields will not change). - // - // This field is always initialized by the port driver. - // - - ULONG Length; - - // - // Specifies which IO bus is tp be scanned. This field is used as a - // parameter to some VideoPortXXX calls. - // - // This field is always initialized by the port driver. - // - - ULONG SystemIoBusNumber; - - // - // Specifies the type of bus being scanned. This field is equal to the - // value being passed into VideoPortInitialize in the - // VIDEO_HW_INITIALIZATION_DATA structure. - // - // This field is always initialized by the port driver. - // - - INTERFACE_TYPE AdapterInterfaceType; - - // - // Specifies the bus interrupt request level. This level corresponds to - // the IRQL on ISA and MCA buses. - // This value is only used if the device supports interrupts, which is - // determined by the presence of an interrupt service routine in the - // VIDEO_HW_INITIALIZATION_DATA structure. - // - // The preset default value for this field is zero. Otherwise, it is the - // value found in the device configuration information. - // - - ULONG BusInterruptLevel; - - // - // Specifies the bus vector returned by the adapter. This is used for - // systems which have IO buses that use interrupt vectors. For ISA, MCA - // and EISA buses, this field is unused. - // - // The preset default value for this field is zero. - // - - ULONG BusInterruptVector; - - // - // Specifies whether this adapter uses latched or edge-triggered type - // interrupts. - // - // This field is always initialized by the port driver. - // - - KINTERRUPT_MODE InterruptMode; - - // - // Specifies the number of emulator access entries that the adapter - // uses. It indicates the number of array elements in the following field. - // - // This field can be reinitialized with the number of entries in the - // EmulatorAccessEntries structure if the structure is statically - // defined in the miniport driver. The EmulatorAccessEntries fields - // should also be updated. - // - - ULONG NumEmulatorAccessEntries; - - // - // Supplies a pointer to an array of EMULATOR_ACCESS_ENTRY structures. - // The number of elements in the array is indicated by the - // NumEmulatorAccessEntries field. The driver should fill out each entry - // for the adapter. - // - // The uninitialized value for the structure is NULL. - // EmulatorAccessEntries will be NULL if NumEmulatorAccessEntries is - // zero. - // - // A poiner to an array of emulator access entries can be passed back - // if such a structure is defined statically in the miniport driver. The - // NumEmulatorAccessEntries field should also be updated. - // - - PEMULATOR_ACCESS_ENTRY EmulatorAccessEntries; - - // - // This is a context values that is passed with each call to the - // emulator/validator functions defined in the EmulatorAccessEntries - // defined above. - // This parameter should in general be a pointer to the miniports - // device extension or other such storage location. - // - // This pointer will allow the miniport to save some state temporarily - // to allow for the batching of IO requests. - // - - ULONG_PTR EmulatorAccessEntriesContext; - - // - // Physical address of the video memory that must be mapped into a VDM's - // address space for proper BIOS support - // - - PHYSICAL_ADDRESS VdmPhysicalVideoMemoryAddress; - - // - // Length of the video memory that must be mapped into a VDM's addres - // space for proper BIOS support. - // - - ULONG VdmPhysicalVideoMemoryLength; - - // - // Determines the minimum size required to store the hardware state - // information returned by IOCTL_VIDEO_SAVE_HARDWARE_STATE. - // - // The uninitialized value for this field is zero. - // - // If the field is left to zero, SAVE_HARDWARE_STATE will return an - // ERROR_INVALID_FUNCTION status code. - // - - ULONG HardwareStateSize; - - // - // New for version 3.5 - // - - // - // Optional DMA channel, if required by the device. - // 0 for the Channel and Port indicates DMA is not used by the device. - // - - ULONG DmaChannel; - - // - // Optional DMA channel, if required by the device. - // 0 for the Channel and Port indicates DMA is not used by the device. - // - - ULONG DmaPort; - - // - // Set to 1 if the DMA channel can be shared with another device. - // Set to 0 if the DMA channel must be owned exclusively by the driver. - // - - UCHAR DmaShareable; - - // - // Set to 1 if the interrupt can be shared with another device. - // Set to 0 if the interrupt must be owned exclusively by the driver. - // - - UCHAR InterruptShareable; - - // - // Start new dma stuff - // - - // - // Set to TRUE if the DMA device is a busmaster, FALSE otherwise. - // - - BOOLEAN Master; - - // - // Set to number of bits wide. Consistent with DEVICE_DESCRIPTION. - // See ntioapi.h - // - - DMA_WIDTH DmaWidth; - - // - // Set to speed so miniport can set DEVICE_DESCRIPTION field. - // See ntioapi.h - // - - DMA_SPEED DmaSpeed; - - // - // Set to TRUE if the DMA device requires mapped buffers. Also - // a DEVICE_DESCRIPTION field. - // - - BOOLEAN bMapBuffers; - - // - // Set to TRUE if the DMA device requires physical addresses. - // - - BOOLEAN NeedPhysicalAddresses; - - // - // Set to TRUE if the DMA device supports demand mode, FALSE otherwise. - // Also DEVICE_DESCRIPTION support. - // - - BOOLEAN DemandMode; - - // - // Set to max transfer length the DMA device supports. - // - - ULONG MaximumTransferLength; - - // - // Set to max number of Physical breaks the DMA device supports. - // - - ULONG NumberOfPhysicalBreaks; - - // - // Set to TRUE if the DMA device supports scatter gather, FALSE otherwise. - // - - BOOLEAN ScatterGather; - - // - // Maximal Length in PVRB_SG returned measured in bytes. If the device - // has no maximum size, zero should be entered. - // - - ULONG MaximumScatterGatherChunkSize; - - // - // Allow for 4.0/5.0 compatibilty - // - - PVIDEO_PORT_GET_PROC_ADDRESS VideoPortGetProcAddress; - - // - // Provide a pointer to the device's registry path - // - - PWSTR DriverRegistryPath; - - // - // Indicates to a driver the amount of physical memory in the system - // - - ULONGLONG SystemMemorySize; - -} VIDEO_PORT_CONFIG_INFO, *PVIDEO_PORT_CONFIG_INFO; - -#define SIZE_OF_NT4_VIDEO_PORT_CONFIG_INFO FIELD_OFFSET(VIDEO_PORT_CONFIG_INFO, Master) -#define SIZE_OF_WXP_VIDEO_PORT_CONFIG_INFO sizeof(VIDEO_PORT_CONFIG_INFO) - -// -// Video Adapter Dependent Routines. -// - -typedef -VP_STATUS -(*PVIDEO_HW_FIND_ADAPTER) ( - PVOID HwDeviceExtension, - PVOID HwContext, - PWSTR ArgumentString, - PVIDEO_PORT_CONFIG_INFO ConfigInfo, - PUCHAR Again - ); - -typedef -BOOLEAN -(*PVIDEO_HW_INITIALIZE) ( - PVOID HwDeviceExtension - ); - -typedef -BOOLEAN -(*PVIDEO_HW_INTERRUPT) ( - PVOID HwDeviceExtension - ); - -typedef -VOID -(*PVIDEO_HW_LEGACYRESOURCES) ( - IN ULONG VendorId, - IN ULONG DeviceId, - IN OUT PVIDEO_ACCESS_RANGE *LegacyResourceList, - IN OUT PULONG LegacyResourceCount - ); - -// -// type to be returned by HwStartDma(). -// - -typedef enum _HW_DMA_RETURN { - DmaAsyncReturn, - DmaSyncReturn - } HW_DMA_RETURN, *PHW_DMA_RETURN; - - -typedef -HW_DMA_RETURN -(*PVIDEO_HW_START_DMA) ( - PVOID HwDeviceExtension, - PDMA pDma - ); - -typedef -VOID -(*PEXECUTE_DMA)( - PVOID HwDeviceExtension, - PVP_DMA_ADAPTER VpDmaAdapter, - PVP_SCATTER_GATHER_LIST SGList, - PVOID Context - ); - - -// -// Flags to be passed into VideoPortLockPages() or VideoPortDoDma(). -// - -// -// The flag VideoPortUnlockAfterDma tells the video port to unlock the pages -// after the miniport signals that the dma is complete via the -// pDmaCompletionEvent in HwStartDma. Failure to set this event at -// dma completion may cause the memory to be unlocked at randon times. -// This flag is best used when one wants to do one dma transfer which -// occurs infrequently. It allows locking, dmaing and unlocking to be performed -// in the context of 1 IOCTL. -// - -// -// The flag VideoPortKeepPagesLocked tells the video port to leave the pages -// locked if possible. -// - -// -// The flag VideoPortDmaInitOnly tells the Video Port to lock the pages, but don't -// call HwStartDma. Not applicable to VideoPortDoDma(). -// - - -typedef enum { - VideoPortUnlockAfterDma = 1, - VideoPortKeepPagesLocked, - VideoPortDmaInitOnly - } DMA_FLAGS; - -// -// Event flags -// - -typedef ULONG DMA_EVENT_FLAGS; - -#define SET_USER_EVENT 0x01 -#define SET_DISPLAY_EVENT 0x02 - -#define EVENT_TYPE_MASK 1 -#define SYNCHRONIZATION_EVENT 0 -#define NOTIFICATION_EVENT 1 - -#define INITIAL_EVENT_STATE_MASK 2 -#define INITIAL_EVENT_NOT_SIGNALED 0 -#define INITIAL_EVENT_SIGNALED 2 - -// -// Child Enumeration structure passed in to the PVIDEO_HW_GET_CHILD_DESCRIPTOR -// function. -// -// All these parameters are input parameters and must not be modified by the -// callee -// -// Size - Size of the structure. It can be used by the calle for versioning. -// -// ChildDescriptorSize - Size of the pChildDescriptor buffer passed in as the -// third parameter to PVIDEO_HW_GET_CHILD_DESCRIPTOR. -// -// ChildIndex - Index of the device to be enumerated. This field should be -// used to enumerate devices not enumerated by ACPI or other operating -// system components. If this field is set to 0 it indicates the ACPIHwId -// field. -// -// ACPIHwId - ID returned by the ACPI BIOS that represent the device being -// queried. The ACPIHwId returned by the firmware must match the HwIds -// returned by the driver. The System BIOS manufacturer and the graphics -// IHV must synchronize these IDs. -// -// ChildHwDeviceExtension - Pointer to a device extension specific to this -// child device. This field will only be filled in if the miniport driver -// filled the ChildHwDeviceExtensionSize to be non-NULL. -// - -typedef struct _VIDEO_CHILD_ENUM_INFO { - ULONG Size; - ULONG ChildDescriptorSize; - ULONG ChildIndex; - ULONG ACPIHwId; - PVOID ChildHwDeviceExtension; -} VIDEO_CHILD_ENUM_INFO, *PVIDEO_CHILD_ENUM_INFO; - -// -// VIDEO_CHILD_TYPE enum: -// -// 'Monitor' identifies a device which may have a DDC2 compliant EDID data -// structure. If the video miniport detects such a device, it is to extract -// the edid from the monitor and put that in the paged buffer provided by -// videoprt.sys in the callback to PVIDEO_HW_GET_CHILD_DESCRIPTOR and return -// this type in the the OUT PVIDEO_CHILD_TYPE parameter of that call. This -// EDID, if available, will be written to the registry. If the EDID is not -// available, nothing should be put in the buffer. -// -// 'NonPrimaryChip' identifies another VGA chip on the video board which -// is not the primary VGA chip. This type is to be used if and only if the -// miniport detects more than one VGA chip on the board. Such an identifier -// will cause the videoprt to create another DEVICE_EXTENSION and associated -// HW_DEVICE_EXTENSION to be associated with the chip so identified. -// -// 'Other' identifies some other video device attached to the video card. If -// the miniport detects such a device, it is to put a wide char string -// (WSTR) into the paged buffer provided by the videoprt.sys which is the -// PNP hardware identifier of the device. This string will be used to create -// a value of that name in the registry. -// - -typedef enum { - Monitor = 1, - NonPrimaryChip, - VideoChip, - Other -} VIDEO_CHILD_TYPE, *PVIDEO_CHILD_TYPE; - -// -// define a constant that represents the display adapter self query. -// - -#define DISPLAY_ADAPTER_HW_ID 0xFFFFFFFF - -// -// Define invalid child device id (needed for failure return value). -// - -#define VIDEO_INVALID_CHILD_ID 0xFFFFFFFF - -typedef struct _VIDEO_CHILD_STATE { - ULONG Id; - ULONG State; -} VIDEO_CHILD_STATE, *PVIDEO_CHILD_STATE; - -typedef struct _VIDEO_CHILD_STATE_CONFIGURATION { - ULONG Count; - VIDEO_CHILD_STATE ChildStateArray[ANYSIZE_ARRAY]; -} VIDEO_CHILD_STATE_CONFIGURATION, *PVIDEO_CHILD_STATE_CONFIGURATION; - -// -// The following routine should return TRUE if successful. It should: -// 1) put the type of the child device in VideoChildType. -// 2) put the information from the device in Buffer. This -// buffer is of size 256 bytes. If the type returned in -// PVideoChildType is Monitor, this buffer must contain the -// EDID of the monitor if readable. If the type returned in -// PVideoChildType is Other, a wide character string representing -// the PNP Device Id must be put in the buffer. This string will -// be used to create a key for the device if the buffer contains -// an EDID. Otherwise, it is used to obtain a PNP ID for the -// device. -// 3) Put a miniport determined HANDLE in HwId. This value will be -// passed back to the miniport for Power management operations, -// as well as other operations. This allows the miniport to define -// the contract between the system and the miniport which defines a -// particular device. -// -// It should only return FALSE if there are no devices attached to that -// display adapter connector. -// - -typedef -VP_STATUS -(*PVIDEO_HW_GET_CHILD_DESCRIPTOR) ( - IN PVOID HwDeviceExtension, - IN PVIDEO_CHILD_ENUM_INFO ChildEnumInfo, - OUT PVIDEO_CHILD_TYPE VideoChildType, - OUT PUCHAR pChildDescriptor, - OUT PULONG UId, - OUT PULONG pUnused - ); - - -// -// This routine is used to set the power on the graphics devices. -// These include all the Children enumerated by GET_CHILD_DESCRIPTOR callback -// as well as the graphics adapter itself. -// -// The HwDevice extension represent the adapter instance of the device. -// -// The HwId parameter is the unique ID as returned by the enumeration routine. -// The miniport will only be called to set the power on the devices it -// enumerated, as well as the graphics adapter itself. A HwId of 0xFFFFFFFF -// will be passed in to identify the graphics adapter itself. -// The miniport driver should never turn off the power to the graphics adapter -// unless specifically request to. -// -// The VideoPowerControl is the level to which the device shold be set. -// The videoport driver will manage these states. -// - -typedef -VP_STATUS -(*PVIDEO_HW_POWER_SET) ( - PVOID HwDeviceExtension, - ULONG HwId, - PVIDEO_POWER_MANAGEMENT VideoPowerControl - ); - -// -// This routine simply returns whether or not the device can support the -// requested state. -// -// See HW_POWER_SET for a description of the parameters. -// - -typedef -VP_STATUS -(*PVIDEO_HW_POWER_GET) ( - PVOID HwDeviceExtension, - ULONG HwId, - PVIDEO_POWER_MANAGEMENT VideoPowerControl - ); - -// -// This structure should match the QueryInterface struct defined -// in io.h. -// - -typedef struct _QUERY_INTERFACE { - CONST GUID *InterfaceType; - USHORT Size; - USHORT Version; - PINTERFACE Interface; - PVOID InterfaceSpecificData; -} QUERY_INTERFACE, *PQUERY_INTERFACE; - -typedef -VP_STATUS -(*PVIDEO_HW_QUERY_INTERFACE) ( - PVOID HwDeviceExtension, - PQUERY_INTERFACE QueryInterface - ); - -typedef -VP_STATUS -(*PVIDEO_HW_CHILD_CALLBACK) ( - PVOID HwDeviceExtension, - PVOID ChildDeviceExtension - ); - -// -// Entry point for all IOCTL calls made to the miniport driver. -// - -typedef -BOOLEAN -(*PVIDEO_HW_START_IO) ( - PVOID HwDeviceExtension, - PVIDEO_REQUEST_PACKET RequestPacket - ); - -// -// The return value determines if the mode was completely programmed (TRUE) -// or if an int10 should be done by the HAL to complete the modeset (FALSE). -// - -typedef -BOOLEAN -(*PVIDEO_HW_RESET_HW) ( - PVOID HwDeviceExtension, - ULONG Columns, - ULONG Rows - ); - -// -// Timer routine called every second. -// - -typedef -VOID -(*PVIDEO_HW_TIMER) ( - PVOID HwDeviceExtension - ); - -// -// Structure passed by the miniport entry point to the video port -// initialization routine. -// - -typedef struct _VIDEO_HW_INITIALIZATION_DATA { - - // - // Supplies the size of the structure in bytes as determined by sizeof(). - // - - ULONG HwInitDataSize; - - // - // Indicates the bus type the adapter works with, such as Eisa, Isa, MCA. - // - - INTERFACE_TYPE AdapterInterfaceType; - - // - // Supplies a pointer to the miniport driver's find adapter routine. - // - - PVIDEO_HW_FIND_ADAPTER HwFindAdapter; - - // - // Supplies a pointer to the miniport driver's initialization routine. - // - - PVIDEO_HW_INITIALIZE HwInitialize; - - // - // Supplies a pointer to the miniport driver's interrupt service routine. - // - - PVIDEO_HW_INTERRUPT HwInterrupt; - - // - // Supplies a pointer to the miniport driver's start io routine. - // - - PVIDEO_HW_START_IO HwStartIO; - - // - // Supplies the size in bytes required for the miniport driver's private - // device extension. This storage is used by the miniport driver to hold - // per-adapter information. A pointer to this storage is provided with - // every call made to the miniport driver. This data storage is - // initialized to zero by the port driver. - // - - ULONG HwDeviceExtensionSize; - - // - // Supplies the number with which device numbering should be started. - // The device numbering is used to determine which \DeviceX entry under - // the \Parameters section in the registry should be used for parameters - // to the miniport driver. - // The number is *automatically* incremented when the miniport is called - // back in it's FindAdapter routine due to an appropriate _Again_ - // parameter. - // - - ULONG StartingDeviceNumber; - - - // - // New for version 3.5 - // - - // - // Supplies a pointer to the miniport driver's HwResetHw routine. - // - // This function is called when the machine needs to bugchecks (go back - // to the blue screen). - // - // This function should reset the video adapter to a character mode, - // or at least to a state from which an int 10 can reset the card to - // a character mode. - // - // This routine CAN NOT call int10. - // It can only call Read\Write Port\Register functions from the port driver. - // - // The function must also be completely in non-paged pool since the IO\MM - // subsystems may have crashed. - // - - PVIDEO_HW_RESET_HW HwResetHw; - - // - // Pointer to a timer routine to be called every second. - // - - PVIDEO_HW_TIMER HwTimer; - - // - // Start of 5.0 stuff. - // - - // - // Supplies a pointer to the miniport driver's start dma routine. This routine must - // return a HW_DMA_RETURN consistent with it's return behavior. - // - - PVIDEO_HW_START_DMA HwStartDma; - - // - // HW dependent Power management routines. - // - - PVIDEO_HW_POWER_SET HwSetPowerState; - PVIDEO_HW_POWER_GET HwGetPowerState; - - // - // Supplies a pointer to a miniport driver routine which can be called to - // enumerate devices physically attached to the graphics adapter. - // - - PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor; - - // - // Supplies a pointer to a miniport driver routine which can be called to - // query external programming interfaces supported in the miniport - // driver. - // - - PVIDEO_HW_QUERY_INTERFACE HwQueryInterface; - - // - // Obselete. Don't set it. - // - - ULONG HwChildDeviceExtensionSize; - - // - // Allows the device to report legacy resources that should be - // associated with the Plug and Play device. - // - - PVIDEO_ACCESS_RANGE HwLegacyResourceList; - - // - // Number of elements in the legacy resource list. - // - - ULONG HwLegacyResourceCount; - - // - // Call this routine to allow a driver to specify it's - // legacy resources based on its device/vendor id. - // - - PVIDEO_HW_LEGACYRESOURCES HwGetLegacyResources; - - // - // Can HwGetVideoChildDescriptor be called before HwInitialize? - // - - BOOLEAN AllowEarlyEnumeration; - - // - // Start of 5.1 stuff. - // - - ULONG Reserved; - -} VIDEO_HW_INITIALIZATION_DATA, *PVIDEO_HW_INITIALIZATION_DATA; - -#define SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA, HwStartDma) -#define SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA, Reserved) -#define SIZE_OF_WXP_VIDEO_HW_INITIALIZATION_DATA (SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA + sizeof(ULONG)) - -// -// DDC help routines. -// - -typedef -VOID -(*PVIDEO_WRITE_CLOCK_LINE)( - PVOID HwDeviceExtension, - UCHAR Data - ); - -typedef -VOID -(*PVIDEO_WRITE_DATA_LINE)( - PVOID HwDeviceExtension, - UCHAR Data - ); - -typedef -BOOLEAN -(*PVIDEO_READ_CLOCK_LINE)( - PVOID HwDeviceExtension - ); - -typedef -BOOLEAN -(*PVIDEO_READ_DATA_LINE)( - PVOID HwDeviceExtension - ); - -typedef -VOID -(*PVIDEO_WAIT_VSYNC_ACTIVE)( - PVOID HwDeviceExtension - ); - -// -// Data structures used I2C and DDC helper functions. -// - -typedef struct _I2C_FNC_TABLE -{ - IN ULONG Size; - IN PVIDEO_WRITE_CLOCK_LINE WriteClockLine; - IN PVIDEO_WRITE_DATA_LINE WriteDataLine; - IN PVIDEO_READ_CLOCK_LINE ReadClockLine; - IN PVIDEO_READ_DATA_LINE ReadDataLine; - IN PVIDEO_WAIT_VSYNC_ACTIVE WaitVsync; - PVOID Reserved; -} I2C_FNC_TABLE, *PI2C_FNC_TABLE; - -typedef struct _I2C_CALLBACKS -{ - IN PVIDEO_WRITE_CLOCK_LINE WriteClockLine; - IN PVIDEO_WRITE_DATA_LINE WriteDataLine; - IN PVIDEO_READ_CLOCK_LINE ReadClockLine; - IN PVIDEO_READ_DATA_LINE ReadDataLine; -} I2C_CALLBACKS, *PI2C_CALLBACKS; - -typedef struct _DDC_CONTROL -{ - IN ULONG Size; - IN I2C_CALLBACKS I2CCallbacks; - IN UCHAR EdidSegment; -} DDC_CONTROL, *PDDC_CONTROL; - -typedef struct _VIDEO_I2C_CONTROL -{ - IN PVIDEO_WRITE_CLOCK_LINE WriteClockLine; - IN PVIDEO_WRITE_DATA_LINE WriteDataLine; - IN PVIDEO_READ_CLOCK_LINE ReadClockLine; - IN PVIDEO_READ_DATA_LINE ReadDataLine; - IN ULONG I2CDelay; // 100ns units -} VIDEO_I2C_CONTROL, *PVIDEO_I2C_CONTROL; - -// -// Types of services exported by the VideoPortQueryServices(). -// - -typedef enum -{ - VideoPortServicesAGP = 1, - VideoPortServicesI2C, - VideoPortServicesHeadless, - VideoPortServicesInt10, - VideoPortServicesDebugReport, - VideoPortServicesWCMemoryProtection -} VIDEO_PORT_SERVICES; - -// -// AGP services interface. -// - -#define VIDEO_PORT_AGP_INTERFACE_VERSION_1 1 - -typedef struct _VIDEO_PORT_AGP_INTERFACE -{ - IN USHORT Size; - IN USHORT Version; - OUT PVOID Context; - OUT PINTERFACE_REFERENCE InterfaceReference; - OUT PINTERFACE_DEREFERENCE InterfaceDereference; - OUT PAGP_RESERVE_PHYSICAL AgpReservePhysical; - OUT PAGP_RELEASE_PHYSICAL AgpReleasePhysical; - OUT PAGP_COMMIT_PHYSICAL AgpCommitPhysical; - OUT PAGP_FREE_PHYSICAL AgpFreePhysical; - OUT PAGP_RESERVE_VIRTUAL AgpReserveVirtual; - OUT PAGP_RELEASE_VIRTUAL AgpReleaseVirtual; - OUT PAGP_COMMIT_VIRTUAL AgpCommitVirtual; - OUT PAGP_FREE_VIRTUAL AgpFreeVirtual; - OUT ULONGLONG AgpAllocationLimit; -} VIDEO_PORT_AGP_INTERFACE, *PVIDEO_PORT_AGP_INTERFACE; - -#define VIDEO_PORT_AGP_INTERFACE_VERSION_2 2 - -typedef struct _VIDEO_PORT_AGP_INTERFACE_2 -{ - IN USHORT Size; - IN USHORT Version; - OUT PVOID Context; - OUT PINTERFACE_REFERENCE InterfaceReference; - OUT PINTERFACE_DEREFERENCE InterfaceDereference; - OUT PAGP_RESERVE_PHYSICAL AgpReservePhysical; - OUT PAGP_RELEASE_PHYSICAL AgpReleasePhysical; - OUT PAGP_COMMIT_PHYSICAL AgpCommitPhysical; - OUT PAGP_FREE_PHYSICAL AgpFreePhysical; - OUT PAGP_RESERVE_VIRTUAL AgpReserveVirtual; - OUT PAGP_RELEASE_VIRTUAL AgpReleaseVirtual; - OUT PAGP_COMMIT_VIRTUAL AgpCommitVirtual; - OUT PAGP_FREE_VIRTUAL AgpFreeVirtual; - OUT ULONGLONG AgpAllocationLimit; - OUT PAGP_SET_RATE AgpSetRate; -} VIDEO_PORT_AGP_INTERFACE_2, *PVIDEO_PORT_AGP_INTERFACE_2; - -// -// I2C helper routines exported via VideoPortQueryServices(). -// - -typedef -BOOLEAN -(*PI2C_START)( - IN PVOID HwDeviceExtension, - IN PI2C_CALLBACKS I2CCallbacks - ); - -typedef -BOOLEAN -(*PI2C_STOP)( - IN PVOID HwDeviceExtension, - IN PI2C_CALLBACKS I2CCallbacks - ); - -typedef -BOOLEAN -(*PI2C_WRITE)( - IN PVOID HwDeviceExtension, - IN PI2C_CALLBACKS I2CCallbacks, - IN PUCHAR Buffer, - IN ULONG Length - ); - -typedef -BOOLEAN -(*PI2C_READ)( - IN PVOID HwDeviceExtension, - IN PI2C_CALLBACKS I2CCallbacks, - OUT PUCHAR Buffer, - IN ULONG Length - ); - -// -// I2C services interface. -// - -#define VIDEO_PORT_I2C_INTERFACE_VERSION_1 1 - -typedef struct _VIDEO_PORT_I2C_INTERFACE -{ - IN USHORT Size; - IN USHORT Version; - OUT PVOID Context; - OUT PINTERFACE_REFERENCE InterfaceReference; - OUT PINTERFACE_DEREFERENCE InterfaceDereference; - OUT PI2C_START I2CStart; - OUT PI2C_STOP I2CStop; - OUT PI2C_WRITE I2CWrite; - OUT PI2C_READ I2CRead; -} VIDEO_PORT_I2C_INTERFACE, *PVIDEO_PORT_I2C_INTERFACE; - -// -// I2C helper routines exported via VideoPortQueryServices() -// for I2C interface version 2. -// - -typedef -BOOLEAN -(*PI2C_START_2)( - IN PVOID HwDeviceExtension, - IN PVIDEO_I2C_CONTROL I2CControl - ); - -typedef -BOOLEAN -(*PI2C_STOP_2)( - IN PVOID HwDeviceExtension, - IN PVIDEO_I2C_CONTROL I2CControl - ); - -typedef -BOOLEAN -(*PI2C_WRITE_2)( - IN PVOID HwDeviceExtension, - IN PVIDEO_I2C_CONTROL I2CControl, - IN PUCHAR Buffer, - IN ULONG Length - ); - -typedef -BOOLEAN -(*PI2C_READ_2)( - IN PVOID HwDeviceExtension, - IN PVIDEO_I2C_CONTROL I2CControl, - OUT PUCHAR Buffer, - IN ULONG Length, - IN BOOLEAN EndOfRead - ); - -// -// I2C services interface version 2. -// - -#define VIDEO_PORT_I2C_INTERFACE_VERSION_2 2 - -typedef struct _VIDEO_PORT_I2C_INTERFACE_2 -{ - IN USHORT Size; - IN USHORT Version; - OUT PVOID Context; - OUT PINTERFACE_REFERENCE InterfaceReference; - OUT PINTERFACE_DEREFERENCE InterfaceDereference; - OUT PI2C_START_2 I2CStart; - OUT PI2C_STOP_2 I2CStop; - OUT PI2C_WRITE_2 I2CWrite; - OUT PI2C_READ_2 I2CRead; -} VIDEO_PORT_I2C_INTERFACE_2, *PVIDEO_PORT_I2C_INTERFACE_2; - -typedef -VP_STATUS -(*PINT10_ALLOCATE_BUFFER)( - IN PVOID Context, - OUT PUSHORT Seg, - OUT PUSHORT Off, - IN OUT PULONG Length - ); - -typedef -VP_STATUS -(*PINT10_FREE_BUFFER)( - IN PVOID Context, - IN USHORT Seg, - IN USHORT Off - ); - -typedef -VP_STATUS -(*PINT10_READ_MEMORY)( - IN PVOID Context, - IN USHORT Seg, - IN USHORT Off, - OUT PVOID Buffer, - IN ULONG Length - ); - -typedef -VP_STATUS -(*PINT10_WRITE_MEMORY)( - IN PVOID Context, - IN USHORT Seg, - IN USHORT Off, - IN PVOID Buffer, - IN ULONG Length - ); - -typedef -VP_STATUS -(*PINT10_CALL_BIOS)( - PVOID Context, - PINT10_BIOS_ARGUMENTS BiosArguments - ); - -#define VIDEO_PORT_INT10_INTERFACE_VERSION_1 1 - -typedef struct _VIDEO_PORT_INT10_INTERFACE -{ - IN USHORT Size; - IN USHORT Version; - OUT PVOID Context; - OUT PINTERFACE_REFERENCE InterfaceReference; - OUT PINTERFACE_DEREFERENCE InterfaceDereference; - OUT PINT10_ALLOCATE_BUFFER Int10AllocateBuffer; - OUT PINT10_FREE_BUFFER Int10FreeBuffer; - OUT PINT10_READ_MEMORY Int10ReadMemory; - OUT PINT10_WRITE_MEMORY Int10WriteMemory; - OUT PINT10_CALL_BIOS Int10CallBios; -} VIDEO_PORT_INT10_INTERFACE, *PVIDEO_PORT_INT10_INTERFACE; - -// -// WCMemoryProtection services interface. -// - -typedef -VP_STATUS -(*PROTECT_WC_MEMORY)( - IN PVOID Context, - IN PVOID HwDeviceExtension - ); - -typedef -VP_STATUS -(*RESTORE_WC_MEMORY)( - IN PVOID Context, - IN PVOID HwDeviceExtension - ); - -#define VIDEO_PORT_WCMEMORYPROTECTION_INTERFACE_VERSION_1 1 - -typedef struct _VIDEO_PORT_WCMEMORYPROTECTION_INTERFACE -{ - IN USHORT Size; - IN USHORT Version; - OUT PVOID Context; - OUT PINTERFACE_REFERENCE InterfaceReference; - OUT PINTERFACE_DEREFERENCE InterfaceDereference; - OUT PROTECT_WC_MEMORY VideoPortProtectWCMemory; - OUT RESTORE_WC_MEMORY VideoPortRestoreWCMemory; -} VIDEO_PORT_WCMEMORYPROTECTION_INTERFACE, *PVIDEO_PORT_WCMEMORYPROTECTION_INTERFACE; - - -typedef struct _VPOSVERSIONINFO -{ - IN ULONG Size; - OUT ULONG MajorVersion; - OUT ULONG MinorVersion; - OUT ULONG BuildNumber; - OUT USHORT ServicePackMajor; - OUT USHORT ServicePackMinor; -} VPOSVERSIONINFO, *PVPOSVERSIONINFO; - -// -// Flags that can be passed to VideoPortGetDeviceBase or VideoPortMapMemory. -// - -#define VIDEO_MEMORY_SPACE_MEMORY 0x00 // Should not be set by display driver -#define VIDEO_MEMORY_SPACE_IO 0x01 // Should not be set by display driver -#define VIDEO_MEMORY_SPACE_USER_MODE 0x02 // Memory pointer for application use -#define VIDEO_MEMORY_SPACE_DENSE 0x04 // Mapped dense, linearly (ALPHA) -#define VIDEO_MEMORY_SPACE_P6CACHE 0x08 // P6 MTRR caching (kernel and user) - -// -// Define status codes returned by HwGetVideoChildDescriptor() -// miniport enumaration routine. -// -// Note: For backword compatibility reasons these values match -// existing WINERROR codes. -// - -// -// Call again (ACPI and non-ACPI devices will be enumerated). -// - -#define VIDEO_ENUM_MORE_DEVICES ERROR_CONTINUE - -// -// Stop enumeration. -// - -#define VIDEO_ENUM_NO_MORE_DEVICES ERROR_NO_MORE_DEVICES - -// -// Call again, device could not be enumerated. -// - -#define VIDEO_ENUM_INVALID_DEVICE ERROR_INVALID_NAME - -// -// Define the bits in VgaStatus. -// - -#define DEVICE_VGA_ENABLED 1 - -// -// Port driver routines called by miniport driver and callbacks. -// - -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("VideoPortAllocatePool", "Obsolete") -VIDEOPORT_API -VP_STATUS -VideoPortAllocateBuffer( - IN PVOID HwDeviceExtension, - IN ULONG Size, - OUT PVOID *Buffer - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VOID -VideoPortAcquireDeviceLock( - IN PVOID HwDeviceExtension - ); - -VIDEOPORT_API -ULONG -VideoPortCompareMemory( - PVOID Source1, - PVOID Source2, - SIZE_T Length - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -BOOLEAN -VideoPortDDCMonitorHelper( - IN PVOID HwDeviceExtension, - IN PVOID DDCControl, - IN OUT __inout_bcount(EdidBufferSize) PUCHAR EdidBuffer, - IN ULONG EdidBufferSize - ); - -VIDEOPORT_API -VOID -VideoPortDebugPrint( - VIDEO_DEBUG_LEVEL DebugPrintLevel, - __in PSTR DebugMessage, - ... - ); - -VIDEOPORT_API -VP_STATUS -VideoPortDisableInterrupt( - PVOID HwDeviceExtension - ); - -VIDEOPORT_API -VP_STATUS -VideoPortEnableInterrupt( - PVOID HwDeviceExtension - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortEnumerateChildren( - IN PVOID HwDeviceExtension, - IN __reserved PVOID Reserved - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VOID -VideoPortFreeDeviceBase( - PVOID HwDeviceExtension, - PVOID MappedAddress - ); - -typedef -VP_STATUS -(*PMINIPORT_QUERY_DEVICE_ROUTINE)( - PVOID HwDeviceExtension, - PVOID Context, - VIDEO_DEVICE_DATA_TYPE DeviceDataType, - PVOID Identifier, - ULONG IdentiferLength, - PVOID ConfigurationData, - ULONG ConfigurationDataLength, - PVOID ComponentInformation, - ULONG ComponentInformationLength - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortGetAccessRanges( - PVOID HwDeviceExtension, - ULONG NumRequestedResources, - __in_ecount_opt(NumRequestedResources) PIO_RESOURCE_DESCRIPTOR RequestedResources OPTIONAL, - ULONG NumAccessRanges, - __out_ecount(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges, - PVOID VendorId, - PVOID DeviceId, - PULONG Slot - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -PVOID -VideoPortGetAssociatedDeviceExtension( - IN PVOID DeviceObject - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -ULONG -VideoPortGetBusData( - PVOID HwDeviceExtension, - BUS_DATA_TYPE BusDataType, - ULONG SlotNumber, - __out_bcount(Length) PVOID Buffer, - ULONG Offset, - ULONG Length - ); - -VIDEOPORT_API -UCHAR -VideoPortGetCurrentIrql(); - -VIDEOPORT_API -PVOID -VideoPortGetDeviceBase( - PVOID HwDeviceExtension, - PHYSICAL_ADDRESS IoAddress, - ULONG NumberOfUchars, - UCHAR InIoSpace - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortGetDeviceData( - PVOID HwDeviceExtension, - VIDEO_DEVICE_DATA_TYPE DeviceDataType, - PMINIPORT_QUERY_DEVICE_ROUTINE CallbackRoutine, - PVOID Context - ); - -typedef -VP_STATUS -(*PMINIPORT_GET_REGISTRY_ROUTINE)( - PVOID HwDeviceExtension, - PVOID Context, - PWSTR ValueName, - PVOID ValueData, - ULONG ValueLength - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortGetRegistryParameters( - PVOID HwDeviceExtension, - __in PWSTR ParameterName, - UCHAR IsParameterFileName, - PMINIPORT_GET_REGISTRY_ROUTINE GetRegistryRoutine, - PVOID Context - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -__out_bcount_opt(Length) PVOID -VideoPortGetRomImage( - IN PVOID HwDeviceExtension, - IN __reserved PVOID Unused1, - IN __reserved ULONG Unused2, - IN ULONG Length - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortGetVgaStatus( - PVOID HwDeviceExtension, - OUT PULONG VgaStatus - ); - -VIDEOPORT_API -LONG -FASTCALL -VideoPortInterlockedDecrement( - IN PLONG Addend - ); - -VIDEOPORT_API -LONG -FASTCALL -VideoPortInterlockedIncrement( - IN PLONG Addend - ); - -VIDEOPORT_API -LONG -FASTCALL -VideoPortInterlockedExchange( - IN OUT PLONG Target, - IN LONG Value - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -ULONG -VideoPortInitialize( - PVOID Argument1, - PVOID Argument2, - PVIDEO_HW_INITIALIZATION_DATA HwInitializationData, - PVOID HwContext - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortInt10( - PVOID HwDeviceExtension, - PVIDEO_X86_BIOS_ARGUMENTS BiosArguments - ); - -__drv_maxIRQL(HIGH_LEVEL) -VIDEOPORT_API -VOID -VideoPortLogError( - PVOID HwDeviceExtension, - PVIDEO_REQUEST_PACKET Vrp OPTIONAL, - VP_STATUS ErrorCode, - ULONG UniqueId - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("VideoPortMapMemory", "Obsolete") -VIDEOPORT_API -VP_STATUS -VideoPortMapBankedMemory( - PVOID HwDeviceExtension, - PHYSICAL_ADDRESS PhysicalAddress, - PULONG Length, - PULONG InIoSpace, - PVOID *VirtualAddress, - ULONG BankLength, - UCHAR ReadWriteBank, - PBANKED_SECTION_ROUTINE BankRoutine, - PVOID Context - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortMapMemory( - PVOID HwDeviceExtension, - PHYSICAL_ADDRESS PhysicalAddress, - PULONG Length, - PULONG InIoSpace, - PVOID *VirtualAddress - ); - -VIDEOPORT_API -VOID -VideoPortMoveMemory( - __inout_bcount(Length) PVOID Destination, - __inout_bcount(Length) PVOID Source, - ULONG Length - ); - -VIDEOPORT_API -LONGLONG -VideoPortQueryPerformanceCounter( - IN PVOID HwDeviceExtension, - OUT PLONGLONG PerformanceFrequency OPTIONAL - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortQueryServices( - IN PVOID HwDeviceExtension, - IN VIDEO_PORT_SERVICES ServicesType, - IN OUT PINTERFACE Interface - ); - -typedef -VOID -(*PMINIPORT_DPC_ROUTINE)( - IN PVOID HwDeviceExtension, - IN PVOID Context - ); - -__drv_maxIRQL(HIGH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -BOOLEAN -VideoPortQueueDpc( - IN PVOID HwDeviceExtension, - IN PMINIPORT_DPC_ROUTINE CallbackRoutine, - IN PVOID Context - ); - -VIDEOPORT_API -UCHAR -VideoPortReadPortUchar( - PUCHAR Port - ); - -VIDEOPORT_API -USHORT -VideoPortReadPortUshort( - PUSHORT Port - ); - -VIDEOPORT_API -ULONG -VideoPortReadPortUlong( - PULONG Port - ); - -VIDEOPORT_API -VOID -VideoPortReadPortBufferUchar( - PUCHAR Port, - __out_ecount(Count) PUCHAR Buffer, - ULONG Count - ); - -VIDEOPORT_API -VOID -VideoPortReadPortBufferUshort( - PUSHORT Port, - __out_ecount(Count) PUSHORT Buffer, - ULONG Count - ); - -VIDEOPORT_API -VOID -VideoPortReadPortBufferUlong( - PULONG Port, - __out_ecount(Count) PULONG Buffer, - ULONG Count - ); - -VIDEOPORT_API -UCHAR -VideoPortReadRegisterUchar( - PUCHAR Register - ); - -VIDEOPORT_API -USHORT -VideoPortReadRegisterUshort( - PUSHORT Register - ); - -VIDEOPORT_API -ULONG -VideoPortReadRegisterUlong( - PULONG Register - ); - -VIDEOPORT_API -VOID -VideoPortReadRegisterBufferUchar( - PUCHAR Register, - __out_ecount(Count) PUCHAR Buffer, - ULONG Count - ); - -VIDEOPORT_API -VOID -VideoPortReadRegisterBufferUshort( - PUSHORT Register, - __out_ecount(Count) PUSHORT Buffer, - ULONG Count - ); - -VIDEOPORT_API -VOID -VideoPortReadRegisterBufferUlong( - PULONG Register, - __out_ecount(Count) PULONG Buffer, - ULONG Count - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("VideoPortFreePool", "Obsolete") -VIDEOPORT_API -VOID -VideoPortReleaseBuffer( - IN PVOID HwDeviceExtension, - IN PVOID Buffer - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VOID -VideoPortReleaseDeviceLock( - IN PVOID HwDeviceExtension - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("(see documentation)", "Obsolete") -VIDEOPORT_API -BOOLEAN -VideoPortScanRom( - PVOID HwDeviceExtension, - PUCHAR RomBase, - ULONG RomLength, - PUCHAR String - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -ULONG -VideoPortSetBusData( - PVOID HwDeviceExtension, - BUS_DATA_TYPE BusDataType, - ULONG SlotNumber, - __in_bcount(Length) PVOID Buffer, - ULONG Offset, - ULONG Length - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortSetRegistryParameters( - PVOID HwDeviceExtension, - __in PWSTR ValueName, - __in_bcount(ValueLength) PVOID ValueData, - ULONG ValueLength - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortSetTrappedEmulatorPorts( - PVOID HwDeviceExtension, - ULONG NumAccessRanges, - __in_ecount(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRange - ); - -VIDEOPORT_API -VOID -VideoPortStallExecution( - ULONG Microseconds - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VOID -VideoPortStartTimer( - PVOID HwDeviceExtension - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VOID -VideoPortStopTimer( - PVOID HwDeviceExtension - ); - -typedef -BOOLEAN -(*PMINIPORT_SYNCHRONIZE_ROUTINE)( - PVOID Context - ); - -__drv_maxIRQL(HIGH_LEVEL) -BOOLEAN -VIDEOPORT_API -VideoPortSynchronizeExecution( - PVOID HwDeviceExtension, - VIDEO_SYNCHRONIZE_PRIORITY Priority, - PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine, - PVOID Context - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortUnmapMemory( - PVOID HwDeviceExtension, - PVOID VirtualAddress, - HANDLE ProcessHandle - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortVerifyAccessRanges( - PVOID HwDeviceExtension, - ULONG NumAccessRanges, - __in_ecount_opt(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges - ); - -VIDEOPORT_API -VOID -VideoPortWritePortUchar( - PUCHAR Port, - UCHAR Value - ); - -VIDEOPORT_API -VOID -VideoPortWritePortUshort( - PUSHORT Port, - USHORT Value - ); - -VIDEOPORT_API -VOID -VideoPortWritePortUlong( - PULONG Port, - ULONG Value - ); - -VIDEOPORT_API -VOID -VideoPortWritePortBufferUchar( - PUCHAR Port, - __in_ecount(Count) PUCHAR Buffer, - ULONG Count - ); - -VIDEOPORT_API -VOID -VideoPortWritePortBufferUshort( - PUSHORT Port, - __in_ecount(Count) PUSHORT Buffer, - ULONG Count - ); - -VIDEOPORT_API -VOID -VideoPortWritePortBufferUlong( - PULONG Port, - __in_ecount(Count) PULONG Buffer, - ULONG Count - ); - -VIDEOPORT_API -VOID -VideoPortWriteRegisterUchar( - PUCHAR Register, - UCHAR Value - ); - -VIDEOPORT_API -VOID -VideoPortWriteRegisterUshort( - PUSHORT Register, - USHORT Value - ); - -VIDEOPORT_API -VOID -VideoPortWriteRegisterUlong( - PULONG Register, - ULONG Value - ); - -VIDEOPORT_API -VOID -VideoPortWriteRegisterBufferUchar( - PUCHAR Register, - __in_ecount(Count) PUCHAR Buffer, - ULONG Count - ); - -VIDEOPORT_API -VOID -VideoPortWriteRegisterBufferUshort( - PUSHORT Register, - __in_ecount(Count) PUSHORT Buffer, - ULONG Count - ); - -VIDEOPORT_API -VOID -VideoPortWriteRegisterBufferUlong( - PULONG Register, - __in_ecount(Count) PULONG Buffer, - ULONG Count - ); - -VIDEOPORT_API -VOID -VideoPortZeroDeviceMemory( - PVOID Destination, - ULONG Length - ); - -VIDEOPORT_API -VOID -VideoPortZeroMemory( - __out_bcount(Length) PVOID Destination, - ULONG Length - ); - -// -// DMA support. -// TODO: Move to the separate module -- will be obsolete. -// - -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("VideoPortAllocateCommonBuffer", "Obsolete") -VIDEOPORT_API -PVOID -VideoPortAllocateContiguousMemory( - IN PVOID HwDeviceExtension, - IN ULONG NumberOfBytes, - IN PHYSICAL_ADDRESS HighestAcceptableAddress - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("VideoPortAllocateCommonBuffer", "Obsolete") -VIDEOPORT_API -PVOID -VideoPortGetCommonBuffer( - IN PVOID HwDeviceExtension, - IN ULONG DesiredLength, - IN ULONG Alignment, - OUT PPHYSICAL_ADDRESS LogicalAddress, - OUT PULONG pActualLength, - IN BOOLEAN CacheEnabled - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("VideoPortReleaseCommonBuffer", "Obsolete") -VIDEOPORT_API -VOID -VideoPortFreeCommonBuffer( - IN PVOID HwDeviceExtension, - IN ULONG Length, - IN PVOID VirtualAddress, - IN PHYSICAL_ADDRESS LogicalAddress, - IN BOOLEAN CacheEnabled - ); - -__drv_preferredFunction("(see documentation)", "Obsolete") -VIDEOPORT_API -PDMA -VideoPortDoDma( - IN PVOID HwDeviceExtension, - IN PDMA pDma, - IN DMA_FLAGS DmaFlags - ); - -__drv_preferredFunction("VideoPortLockBuffer", "Obsolete") -VIDEOPORT_API -BOOLEAN -VideoPortLockPages( - IN PVOID HwDeviceExtension, - IN OUT PVIDEO_REQUEST_PACKET pVrp, - IN PEVENT pUEvent, - IN PEVENT pDisplayEvent, - IN DMA_FLAGS DmaFlags - ); - -__drv_preferredFunction("VideoPortUnlockBuffer", "Obsolete") -VIDEOPORT_API -BOOLEAN -VideoPortUnlockPages( - PVOID hwDeviceExtension, - PDMA pDma - ); - -__drv_preferredFunction("(see documentation)", "Obsolete") -VIDEOPORT_API -BOOLEAN -VideoPortSignalDmaComplete( - IN PVOID HwDeviceExtension, - IN PDMA pDmaHandle - ); - -__drv_preferredFunction("(see documentation)", "Obsolete") -VIDEOPORT_API -PVOID -VideoPortGetMdl( - IN PVOID HwDeviceExtension, - IN PDMA pDma - ); - -__drv_preferredFunction("(see documentation)", "Obsolete") -VIDEOPORT_API -PVOID -VideoPortGetDmaContext( - IN PVOID HwDeviceExtension, - IN PDMA pDma - ); - -__drv_preferredFunction("(see documentation)", "Obsolete") -VIDEOPORT_API -VOID -VideoPortSetDmaContext( - IN PVOID HwDeviceExtension, - OUT PDMA pDma, - IN PVOID InstanceContext - ); - -__drv_preferredFunction("(see documentation)", "Obsolete") -VIDEOPORT_API -ULONG -VideoPortGetBytesUsed( - IN PVOID HwDeviceExtension, - IN PDMA pDma - ); - -__drv_preferredFunction("(see documentation)", "Obsolete") -VIDEOPORT_API -VOID -VideoPortSetBytesUsed( - IN PVOID HwDeviceExtension, - IN OUT PDMA pDma, - IN ULONG BytesUsed - ); - -__drv_preferredFunction("(see documentation)", "Obsolete") -VIDEOPORT_API -PDMA -VideoPortAssociateEventsWithDmaHandle( - IN PVOID HwDeviceExtension, - IN OUT PVIDEO_REQUEST_PACKET pVrp, - IN PVOID MappedUserEvent, - IN PVOID DisplayDriverEvent - ); - -__drv_preferredFunction("(see documentation)", "Obsolete") -VIDEOPORT_API -PDMA -VideoPortMapDmaMemory( - IN PVOID HwDeviceExtension, - IN PVIDEO_REQUEST_PACKET pVrp, - IN PHYSICAL_ADDRESS BoardAddress, - IN PULONG Length, - IN PULONG InIoSpace, - IN PVOID MappedUserEvent, - IN PVOID DisplayDriverEvent, - IN OUT PVOID * VirtualAddress - ); - -__drv_preferredFunction("(see documentation)", "Obsolete") -VIDEOPORT_API -BOOLEAN -VideoPortUnmapDmaMemory( - PVOID HwDeviceExtension, - PVOID VirtualAddress, - HANDLE ProcessHandle, - PDMA BoardMemoryHandle - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortCreateSecondaryDisplay( - IN PVOID HwDeviceExtension, - IN OUT PVOID *SecondaryDeviceExtension, - IN ULONG ulFlag - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -PVP_DMA_ADAPTER -VideoPortGetDmaAdapter( - IN PVOID HwDeviceExtension, - IN PVP_DEVICE_DESCRIPTION VpDeviceDescription - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VOID -VideoPortPutDmaAdapter( - IN PVOID HwDeviceExtension, - IN PVP_DMA_ADAPTER VpDmaAdapter - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -PVOID -VideoPortAllocateCommonBuffer( - IN PVOID HwDeviceExtension, - IN PVP_DMA_ADAPTER VpDmaAdapter, - IN ULONG DesiredLength, - OUT PPHYSICAL_ADDRESS LogicalAddress, - IN BOOLEAN CacheEnabled, - OUT PVOID Reserved - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VOID -VideoPortReleaseCommonBuffer( - IN PVOID HwDeviceExtension, - IN PVP_DMA_ADAPTER VpDmaAdapter, - IN ULONG Length, - IN PHYSICAL_ADDRESS LogicalAddress, - IN PVOID VirtualAddress, - IN BOOLEAN CacheEnabled - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -PVOID -VideoPortLockBuffer( - IN PVOID HwDeviceExtension, - IN PVOID BaseAddress, - IN ULONG Length, - IN VP_LOCK_OPERATION Operation - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VOID -VideoPortUnlockBuffer( - IN PVOID HwDeviceExtension, - IN PVOID Mdl - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortStartDma( - IN PVOID HwDeviceExtension, - IN PVP_DMA_ADAPTER VpDmaAdapter, - IN PVOID Mdl, - IN ULONG Offset, - IN OUT PULONG pLength, - IN PEXECUTE_DMA ExecuteDmaRoutine, - IN PVOID Context, - IN BOOLEAN WriteToDevice - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortCompleteDma( - IN PVOID HwDeviceExtension, - IN PVP_DMA_ADAPTER VpDmaAdapter, - IN PVP_SCATTER_GATHER_LIST VpScatterGather, - IN BOOLEAN WriteToDevice - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortCreateEvent( - IN PVOID HwDeviceExtension, - IN ULONG EventFlag, - IN PVOID Unused, - OUT PEVENT *ppEvent - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortDeleteEvent( - IN PVOID HwDeviceExtension, - IN PEVENT pEvent - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -LONG -VideoPortSetEvent( - IN PVOID HwDeviceExtension, - IN PEVENT pEvent - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VOID -VideoPortClearEvent( - IN PVOID HwDeviceExtension, - IN PEVENT pEvent -); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -LONG -VideoPortReadStateEvent( - IN PVOID HwDeviceExtension, - IN PEVENT pEvent - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortWaitForSingleObject( - IN PVOID HwDeviceExtension, - IN PVOID Object, - IN PLARGE_INTEGER Timeout - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -PVOID -VideoPortAllocatePool( - IN PVOID HwDeviceExtension, - IN VP_POOL_TYPE PoolType, - IN SIZE_T NumberOfBytes, - IN ULONG Tag - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VOID -VideoPortFreePool( - IN PVOID HwDeviceExtension, - IN PVOID Ptr - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortCreateSpinLock( - IN PVOID HwDeviceExtension, - OUT PSPIN_LOCK *SpinLock - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortDeleteSpinLock( - IN PVOID HwDeviceExtension, - IN PSPIN_LOCK SpinLock - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_setsIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VOID -VideoPortAcquireSpinLock( - __inout __deref __drv_acquiresExclusiveResource(VideoPortSpinLock) - PVOID HwDeviceExtension, - __in PSPIN_LOCK SpinLock, - __out __deref __drv_savesIRQL PUCHAR OldIrql - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VOID -VideoPortAcquireSpinLockAtDpcLevel( - __inout __deref __drv_acquiresExclusiveResource(VideoPortSpinLock) - PVOID HwDeviceExtension, - __in PSPIN_LOCK SpinLock - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VOID -VideoPortReleaseSpinLock( - __in PVOID HwDeviceExtension, - __inout __deref __drv_releasesExclusiveResource(VideoPortSpinLock) - PSPIN_LOCK SpinLock, - __in __drv_restoresIRQL UCHAR NewIrql - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -VIDEOPORT_API -VOID -VideoPortReleaseSpinLockFromDpcLevel( - __in PVOID HwDeviceExtension, - __inout __deref __drv_releasesExclusiveResource(VideoPortSpinLock) - PSPIN_LOCK SpinLock - ); - -VIDEOPORT_API -VOID -VideoPortQuerySystemTime( - OUT PLARGE_INTEGER CurrentTime - ); - -#define CDE_USE_SUBSYSTEM_IDS 0x00000001 -#define CDE_USE_REVISION 0x00000002 - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -BOOLEAN -VideoPortCheckForDeviceExistence( - IN PVOID HwDeviceExtension, - IN USHORT VendorId, - IN USHORT DeviceId, - IN UCHAR RevisionId, - IN USHORT SubVendorId, - IN USHORT SubSystemId, - IN ULONG Flags - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -ULONG -VideoPortGetAssociatedDeviceID( - IN PVOID DeviceObject - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortFlushRegistry( - PVOID HwDeviceExtension - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortGetVersion( - IN PVOID HwDeviceExtension, - IN OUT PVPOSVERSIONINFO pVpOsVersionInfo - ); - -VIDEOPORT_API -BOOLEAN -VideoPortIsNoVesa( - VOID - ); - -// -// TODO: End of move block. -// - -// -// Support for bugcheck reason callbacks -// - -#define BUGCHECK_DATA_SIZE_RESERVED 48 - -typedef -VOID -(*PVIDEO_BUGCHECK_CALLBACK) ( - IN PVOID HwDeviceExtension, - IN ULONG BugcheckCode, - IN PUCHAR Buffer, - IN ULONG BufferSize - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -VIDEOPORT_API -VP_STATUS -VideoPortRegisterBugcheckCallback( - IN PVOID HwDeviceExtension, - IN ULONG BugcheckCode, - IN PVIDEO_BUGCHECK_CALLBACK Callback, - IN ULONG BugcheckDataSize - ); - -// -// Video Debug Report API provides ability for IHV to report non fatal -// failures via Microsoft OCA servers -// - -#define VIDEO_DEBUG_REPORT_MAX_SIZE 0x8000 - -typedef struct _VIDEO_DEBUG_REPORT *PVIDEO_DEBUG_REPORT; - -VIDEOPORT_API -PVIDEO_DEBUG_REPORT -VideoPortDbgReportCreate( - IN PVOID HwDeviceExtension, - IN ULONG ulCode, - IN ULONG_PTR ulpArg1, - IN ULONG_PTR ulpArg2, - IN ULONG_PTR ulpArg3, - IN ULONG_PTR ulpArg4 - ); - -VIDEOPORT_API -BOOLEAN -VideoPortDbgReportSecondaryData( - IN OUT PVIDEO_DEBUG_REPORT pReport, - IN __in_bcount(ulDataSize) PVOID pvData, - IN ULONG ulDataSize - ); - -VIDEOPORT_API -VOID -VideoPortDbgReportComplete( - IN OUT PVIDEO_DEBUG_REPORT pReport - ); - -// -// Debug Report API interface -// - -#define VIDEO_PORT_DEBUG_REPORT_INTERFACE_VERSION_1 1 - -typedef struct _VIDEO_PORT_DEBUG_REPORT_INTERFACE -{ - IN USHORT Size; - IN USHORT Version; - OUT PVOID Context; - OUT PINTERFACE_REFERENCE InterfaceReference; - OUT PINTERFACE_DEREFERENCE InterfaceDereference; - - OUT - PVIDEO_DEBUG_REPORT - (*DbgReportCreate)( - IN PVOID HwDeviceExtension, - IN ULONG ulCode, - IN ULONG_PTR ulpArg1, - IN ULONG_PTR ulpArg2, - IN ULONG_PTR ulpArg3, - IN ULONG_PTR ulpArg4 - ); - - OUT - BOOLEAN - (*DbgReportSecondaryData)( - IN OUT PVIDEO_DEBUG_REPORT pReport, - IN PVOID pvData, - IN ULONG ulDataSize - ); - - OUT - VOID - (*DbgReportComplete)( - IN OUT PVIDEO_DEBUG_REPORT pReport - ); -} VIDEO_PORT_DEBUG_REPORT_INTERFACE, *PVIDEO_PORT_DEBUG_REPORT_INTERFACE; - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // ifndef __VIDEO_H__ - diff --git a/pub/ddk/videoagp.h b/pub/ddk/videoagp.h deleted file mode 100644 index 1070fd5..0000000 --- a/pub/ddk/videoagp.h +++ /dev/null @@ -1,133 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - videoagp.h - -Abstract: - Video miniport AGP support. - -Notes: - -Revision History: - ---*/ - -#ifndef __VIDEOAGP_H__ -#define __VIDEOAGP_H__ - -#define VIDEO_AGP_RATE_1X 1 -#define VIDEO_AGP_RATE_2X 2 -#define VIDEO_AGP_RATE_4X 4 -#define VIDEO_AGP_RATE_8X 8 - -typedef enum -{ - VpNonCached = 0, - VpWriteCombined, - VpCached -} VIDEO_PORT_CACHE_TYPE; - -typedef -PHYSICAL_ADDRESS -(STDAPICALLTYPE *PAGP_RESERVE_PHYSICAL)( - IN PVOID HwDeviceExtension, - IN ULONG Pages, - IN VIDEO_PORT_CACHE_TYPE Caching, - OUT PVOID *PhysicalReserveContext - ); - -typedef -VOID -(STDAPICALLTYPE *PAGP_RELEASE_PHYSICAL)( - IN PVOID HwDeviceExtension, - IN PVOID PhysicalReserveContext - ); - -typedef -BOOLEAN -(STDAPICALLTYPE *PAGP_COMMIT_PHYSICAL)( - IN PVOID HwDeviceExtension, - IN PVOID PhysicalReserveContext, - IN ULONG Pages, - IN ULONG Offset - ); - -typedef -VOID -(STDAPICALLTYPE *PAGP_FREE_PHYSICAL)( - IN PVOID HwDeviceExtension, - IN PVOID PhysicalReserveContext, - IN ULONG Pages, - IN ULONG Offset - ); - -typedef -PVOID -(STDAPICALLTYPE *PAGP_RESERVE_VIRTUAL)( - IN PVOID HwDeviceExtension, - IN HANDLE ProcessHandle, - IN PVOID PhysicalReserveContext, - OUT PVOID *VirtualReserveContext - ); - -typedef -VOID -(STDAPICALLTYPE *PAGP_RELEASE_VIRTUAL)( - IN PVOID HwDeviceExtension, - IN PVOID VirtualReserveContext - ); - -typedef -PVOID -(STDAPICALLTYPE *PAGP_COMMIT_VIRTUAL)( - IN PVOID HwDeviceExtension, - IN PVOID VirtualReserveContext, - IN ULONG Pages, - IN ULONG Offset - ); - -typedef -VOID -(STDAPICALLTYPE *PAGP_FREE_VIRTUAL)( - IN PVOID HwDeviceExtension, - IN PVOID VirtualReserveContext, - IN ULONG Pages, - IN ULONG Offset - ); - -typedef -BOOLEAN -(STDAPICALLTYPE *PAGP_SET_RATE)( - IN PVOID HwDeviceExtension, - IN ULONG AgpRate - ); - -typedef struct _VIDEO_PORT_AGP_SERVICES -{ - PAGP_RESERVE_PHYSICAL AgpReservePhysical; - PAGP_RELEASE_PHYSICAL AgpReleasePhysical; - PAGP_COMMIT_PHYSICAL AgpCommitPhysical; - PAGP_FREE_PHYSICAL AgpFreePhysical; - - PAGP_RESERVE_VIRTUAL AgpReserveVirtual; - PAGP_RELEASE_VIRTUAL AgpReleaseVirtual; - PAGP_COMMIT_VIRTUAL AgpCommitVirtual; - PAGP_FREE_VIRTUAL AgpFreeVirtual; - ULONGLONG AllocationLimit; - -} VIDEO_PORT_AGP_SERVICES, *PVIDEO_PORT_AGP_SERVICES; - -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("VideoPortQueryServices", "Obsolete") -BOOLEAN -STDAPICALLTYPE -VideoPortGetAgpServices( - IN PVOID HwDeviceExtension, - IN PVIDEO_PORT_AGP_SERVICES AgpServices - ); - -#endif // ifndef __VIDEOAGP_H__ - diff --git a/pub/ddk/wdm.h b/pub/ddk/wdm.h deleted file mode 100644 index b9ca41a..0000000 --- a/pub/ddk/wdm.h +++ /dev/null @@ -1,32429 +0,0 @@ -/*++ BUILD Version: 0162 // Increment this if a change has global effects - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - wdm.h - -Abstract: - - This module defines the WDM types, constants, and functions that are - exposed to device drivers. - -Revision History: - ---*/ - -#ifndef _WDMDDK_ -#define _WDMDDK_ - -#ifndef _NTDDK_ -#define _WDM_INCLUDED_ -#define _DDK_DRIVER_ - -// -// Use 9x compat Interlocked functions by default when including wdm.h -// - -#define NO_INTERLOCKED_INTRINSICS - -#endif - -#define _NTDDK_ -#define _STRSAFE_USE_SECURE_CRT 0 - -#ifndef RC_INVOKED -#if _MSC_VER < 1300 -#error Compiler version not supported by Windows DDK -#endif -#endif // RC_INVOKED - -#define NT_INCLUDED -#define _CTYPE_DISABLE_MACROS - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif - -#pragma warning(disable:4115) // named type definition in parentheses -#pragma warning(disable:4201) // nameless struct/union -#pragma warning(disable:4214) // bit field types other than int - -#include -#include -#include -#include -#include - -__internal_kernel_driver -__drv_Mode_impl(WDM_INCLUDED) - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Define types that are not exported. -// - -typedef struct _ACCESS_STATE *PACCESS_STATE; -typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT; -#if defined(_NTHAL_INCLUDED_) -typedef struct _KPROCESS *PEPROCESS; -typedef struct _ETHREAD *PETHREAD; -#elif defined(_NTIFS_INCLUDED_) -typedef struct _KPROCESS *PEPROCESS; -typedef struct _KTHREAD *PETHREAD; -#else -typedef struct _EPROCESS *PEPROCESS; -typedef struct _ETHREAD *PETHREAD; -#endif -typedef struct _IO_TIMER *PIO_TIMER; -typedef struct _KINTERRUPT *PKINTERRUPT; -typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD; -typedef struct _KPROCESS *PKPROCESS, *PRKPROCESS; -typedef struct _OBJECT_TYPE *POBJECT_TYPE; -typedef struct _SECURITY_QUALITY_OF_SERVICE *PSECURITY_QUALITY_OF_SERVICE; - - -// -// Declare empty structure definitions so that they may be referenced by -// routines before they are defined -// -typedef struct _CONTEXT *PCONTEXT; -typedef struct _IO_STACK_LOCATION *PIO_STACK_LOCATION; -typedef struct _VPB *PVPB; -typedef struct _FILE_GET_QUOTA_INFORMATION *PFILE_GET_QUOTA_INFORMATION; - - -#if defined(_M_AMD64) - -ULONG64 -__readgsqword ( - IN ULONG Offset - ); - -#pragma intrinsic(__readgsqword) - -__forceinline -PKTHREAD -KeGetCurrentThread ( - VOID - ) - -{ - return (struct _KTHREAD *)__readgsqword(0x188); -} - -#endif // defined(_M_AMD64) - -#if defined(_M_IX86) || defined(_M_IA64) - -NTSYSAPI -PKTHREAD -NTAPI -KeGetCurrentThread( - VOID - ); - -#endif // defined(_M_IX86) || defined(_M_IA64) - -// -// Define base address for kernel and user space -// - -#ifndef _WIN64 - -#define KADDRESS_BASE 0 - -#define UADDRESS_BASE 0 - -#endif // !_WIN64 - - -#if defined(_M_IA64) && !defined(_NTHAL_) - -// -// Define Address of Processor Control Registers. -// - -#define KIPCR ((ULONG_PTR)(KADDRESS_BASE + 0xFFFF0000)) // kernel address of first PCR - -// -// Define Pointer to Processor Control Registers. -// - -#define PCR ((volatile KPCR * const)KIPCR) - -#endif // defined(_M_IA64) && !defined(_NTHAL_) - -#include - -#ifndef FAR -#define FAR -#endif - -#define PsGetCurrentProcess IoGetCurrentProcess - -#if (NTDDI_VERSION >= NTDDI_VISTA) -extern NTSYSAPI volatile CCHAR KeNumberProcessors; -#elif (NTDDI_VERSION >= NTDDI_WINXP) -extern NTSYSAPI CCHAR KeNumberProcessors; -#else -extern PCCHAR KeNumberProcessors; -#endif -#if defined(_X86_) -// -// Interrupt Request Level definitions -// - -#define PASSIVE_LEVEL 0 // Passive release level -#define LOW_LEVEL 0 // Lowest interrupt level -#define APC_LEVEL 1 // APC interrupt level -#define DISPATCH_LEVEL 2 // Dispatcher level -#define CMCI_LEVEL 5 // CMCI handler level - -#define PROFILE_LEVEL 27 // timer used for profiling. -#define CLOCK1_LEVEL 28 // Interval clock 1 level - Not used on x86 -#define CLOCK2_LEVEL 28 // Interval clock 2 level -#define IPI_LEVEL 29 // Interprocessor interrupt level -#define POWER_LEVEL 30 // Power failure level -#define HIGH_LEVEL 31 // Highest interrupt level - -#define CLOCK_LEVEL (CLOCK2_LEVEL) - -#endif -#if defined(_AMD64_) -// -// Interrupt Request Level definitions -// - -#define PASSIVE_LEVEL 0 // Passive release level -#define LOW_LEVEL 0 // Lowest interrupt level -#define APC_LEVEL 1 // APC interrupt level -#define DISPATCH_LEVEL 2 // Dispatcher level -#define CMCI_LEVEL 5 // CMCI handler level - -#define CLOCK_LEVEL 13 // Interval clock level -#define IPI_LEVEL 14 // Interprocessor interrupt level -#define DRS_LEVEL 14 // Deferred Recovery Service level -#define POWER_LEVEL 14 // Power failure level -#define PROFILE_LEVEL 15 // timer used for profiling. -#define HIGH_LEVEL 15 // Highest interrupt level - -#endif -#if defined(_IA64_) -// -// Define Interrupt Request Levels. -// - -#define PASSIVE_LEVEL 0 // Passive release level -#define LOW_LEVEL 0 // Lowest interrupt level -#define APC_LEVEL 1 // APC interrupt level -#define DISPATCH_LEVEL 2 // Dispatcher level -#define CMC_LEVEL 3 // Correctable machine check level -#define DEVICE_LEVEL_BASE 4 // 4 - 11 - Device IRQLs -#define PC_LEVEL 12 // Performance Counter IRQL -#define IPI_LEVEL 14 // IPI IRQL -#define DRS_LEVEL 14 // Deferred Recovery Service level -#define CLOCK_LEVEL 13 // Clock Timer IRQL -#define POWER_LEVEL 15 // Power failure level -#define PROFILE_LEVEL 15 // Profiling level -#define HIGH_LEVEL 15 // Highest interrupt level - -#endif - -#define LOW_PRIORITY 0 // Lowest thread priority level -#define LOW_REALTIME_PRIORITY 16 // Lowest realtime priority level -#define HIGH_PRIORITY 31 // Highest thread priority level -#define MAXIMUM_PRIORITY 32 // Number of thread priority levels - -#define MAXIMUM_WAIT_OBJECTS 64 // Maximum number of wait objects - -#define MAXIMUM_SUSPEND_COUNT MAXCHAR // Maximum times thread can be suspended - - -// -// Define system time structure. -// - -typedef struct _KSYSTEM_TIME { - ULONG LowPart; - LONG High1Time; - LONG High2Time; -} KSYSTEM_TIME, *PKSYSTEM_TIME; - -// -// Thread priority -// - -typedef LONG KPRIORITY; - -// -// Spin Lock -// - - - -typedef ULONG_PTR KSPIN_LOCK; -typedef KSPIN_LOCK *PKSPIN_LOCK; - - -// -// Define per processor lock queue structure. -// -// N.B. The lock field of the spin lock queue structure contains the address -// of the associated kernel spin lock, an owner bit, and a lock bit. Bit -// 0 of the spin lock address is the wait bit and bit 1 is the owner bit. -// The use of this field is such that the bits can be set and cleared -// noninterlocked, however, the back pointer must be preserved. -// -// The lock wait bit is set when a processor enqueues itself on the lock -// queue and it is not the only entry in the queue. The processor will -// spin on this bit waiting for the lock to be granted. -// -// The owner bit is set when the processor owns the respective lock. -// -// The next field of the spin lock queue structure is used to line the -// queued lock structures together in fifo order. It also can set set and -// cleared noninterlocked. -// - -#define LOCK_QUEUE_WAIT 1 -#define LOCK_QUEUE_WAIT_BIT 0 - -#define LOCK_QUEUE_OWNER 2 -#define LOCK_QUEUE_OWNER_BIT 1 - -#if defined(_AMD64_) - -typedef ULONG64 KSPIN_LOCK_QUEUE_NUMBER; - -#define LockQueueUnusedSpare0 0 -#define LockQueueExpansionLock 1 -#define LockQueueUnusedSpare2 2 -#define LockQueueSystemSpaceLock 3 -#define LockQueueVacbLock 4 -#define LockQueueMasterLock 5 -#define LockQueueNonPagedPoolLock 6 -#define LockQueueIoCancelLock 7 -#define LockQueueWorkQueueLock 8 -#define LockQueueIoVpbLock 9 -#define LockQueueIoDatabaseLock 10 -#define LockQueueIoCompletionLock 11 -#define LockQueueNtfsStructLock 12 -#define LockQueueAfdWorkQueueLock 13 -#define LockQueueBcbLock 14 -#define LockQueueMmNonPagedPoolLock 15 -#define LockQueueUnusedSpare16 16 -#define LockQueueMaximumLock (LockQueueUnusedSpare16 + 1) - -#else - -typedef enum _KSPIN_LOCK_QUEUE_NUMBER { - LockQueueUnusedSpare0, - LockQueueExpansionLock, - LockQueueUnusedSpare2, - LockQueueSystemSpaceLock, - LockQueueVacbLock, - LockQueueMasterLock, - LockQueueNonPagedPoolLock, - LockQueueIoCancelLock, - LockQueueWorkQueueLock, - LockQueueIoVpbLock, - LockQueueIoDatabaseLock, - LockQueueIoCompletionLock, - LockQueueNtfsStructLock, - LockQueueAfdWorkQueueLock, - LockQueueBcbLock, - LockQueueMmNonPagedPoolLock, - LockQueueUnusedSpare16, - LockQueueMaximumLock = LockQueueUnusedSpare16 + 1 -} KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER; - -#endif - -typedef struct _KSPIN_LOCK_QUEUE { - struct _KSPIN_LOCK_QUEUE * volatile Next; - PKSPIN_LOCK volatile Lock; -} KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE; - -typedef struct _KLOCK_QUEUE_HANDLE { - KSPIN_LOCK_QUEUE LockQueue; - KIRQL OldIrql; -} KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE; - - -// -// Interrupt routine (first level dispatch) -// - -typedef -__drv_functionClass(KINTERRUPT_ROUTINE) -__drv_sameIRQL -VOID -KINTERRUPT_ROUTINE ( - VOID - ); - -typedef KINTERRUPT_ROUTINE *PKINTERRUPT_ROUTINE; - -// -// Profile source types -// -typedef enum _KPROFILE_SOURCE { - ProfileTime, - ProfileAlignmentFixup, - ProfileTotalIssues, - ProfilePipelineDry, - ProfileLoadInstructions, - ProfilePipelineFrozen, - ProfileBranchInstructions, - ProfileTotalNonissues, - ProfileDcacheMisses, - ProfileIcacheMisses, - ProfileCacheMisses, - ProfileBranchMispredictions, - ProfileStoreInstructions, - ProfileFpInstructions, - ProfileIntegerInstructions, - Profile2Issue, - Profile3Issue, - Profile4Issue, - ProfileSpecialInstructions, - ProfileTotalCycles, - ProfileIcacheIssues, - ProfileDcacheAccesses, - ProfileMemoryBarrierCycles, - ProfileLoadLinkedIssues, - ProfileMaximum -} KPROFILE_SOURCE; - - -// -// Define 128-bit 16-byte aligned xmm register type. -// - -typedef struct DECLSPEC_ALIGN(16) _M128A { - ULONGLONG Low; - LONGLONG High; -} M128A, *PM128A; - -// -// Format of data for (F)XSAVE/(F)XRSTOR instruction -// - -typedef struct DECLSPEC_ALIGN(16) _XSAVE_FORMAT { - USHORT ControlWord; - USHORT StatusWord; - UCHAR TagWord; - UCHAR Reserved1; - USHORT ErrorOpcode; - ULONG ErrorOffset; - USHORT ErrorSelector; - USHORT Reserved2; - ULONG DataOffset; - USHORT DataSelector; - USHORT Reserved3; - ULONG MxCsr; - ULONG MxCsr_Mask; - M128A FloatRegisters[8]; - -#if defined(_WIN64) - - M128A XmmRegisters[16]; - UCHAR Reserved4[96]; - -#else - - M128A XmmRegisters[8]; - UCHAR Reserved4[192]; - - // - // The fields below are not part of XSAVE/XRSTOR format. - // They are written by the OS which is relying on a fact that - // neither (FX)SAVE nor (F)XSTOR used this area. - // - - ULONG StackControl[7]; // KERNEL_STACK_CONTROL structure actualy - ULONG Cr0NpxState; - -#endif - -} XSAVE_FORMAT, *PXSAVE_FORMAT; - -typedef struct DECLSPEC_ALIGN(8) _XSAVE_AREA_HEADER { - ULONG64 Mask; - ULONG64 Reserved[7]; -} XSAVE_AREA_HEADER, *PXSAVE_AREA_HEADER; - -typedef struct DECLSPEC_ALIGN(16) _XSAVE_AREA { - XSAVE_FORMAT LegacyState; - XSAVE_AREA_HEADER Header; -} XSAVE_AREA, *PXSAVE_AREA; - -typedef struct _XSTATE_CONTEXT { - ULONG64 Mask; - ULONG Length; - ULONG Reserved1; - __field_bcount_opt(Length) PXSAVE_AREA Area; - -#if defined(_X86_) - ULONG Reserved2; -#endif - - PVOID Buffer; - -#if defined(_X86_) - ULONG Reserved3; -#endif - -} XSTATE_CONTEXT, *PXSTATE_CONTEXT; - - -#define XSAVE_ALIGN 64 -#define MINIMAL_XSTATE_AREA_LENGTH sizeof(XSAVE_AREA) - - -// -// This structure specifies an offset (from the beginning of CONTEXT_EX -// structure) and size of a single chunk of an extended context structure. -// -// N.B. Offset may be negative. -// - -typedef struct _CONTEXT_CHUNK { - LONG Offset; - ULONG Length; -} CONTEXT_CHUNK, *PCONTEXT_CHUNK; - -// -// CONTEXT_EX structure is an extension to CONTEXT structure. It defines -// a context record as a set of disjoint variable-sized buffers (chunks) -// each containing a portion of processor state. Currently there are only -// two buffers (chunks) are defined: -// -// - Legacy, that stores traditional CONTEXT structure; -// - XState, that stores XSAVE save area buffer starting from -// XSAVE_AREA_HEADER, i.e. without the first 512 bytes. -// -// There a few assumptions exists that simplify conversion of PCONTEXT -// pointer to PCONTEXT_EX pointer. -// -// 1. APIs that work with PCONTEXT pointers assume that CONTEXT_EX is -// stored right after the CONTEXT structure. It is also assumed that -// CONTEXT_EX is present if and only if corresponding CONTEXT_XXX -// flags are set in CONTEXT.ContextFlags. -// -// 2. CONTEXT_EX.Legacy is always present if CONTEXT_EX structure is -// present. All other chunks are optional. -// -// 3. CONTEXT.ContextFlags unambigiously define which chunks are -// present. I.e. if CONTEXT_XSTATE is set CONTEXT_EX.XState is valid. -// - -typedef struct _CONTEXT_EX { - - // - // The total length of the structure starting from the chunk with - // the smallest offset. N.B. that the offset may be negative. - // - - CONTEXT_CHUNK All; - - // - // Wrapper for the traditional CONTEXT structure. N.B. the size of - // the chunk may be less than sizeof(CONTEXT) is some cases (when - // CONTEXT_EXTENDED_REGISTERS is not set on x86 for instance). - // - - CONTEXT_CHUNK Legacy; - - // - // CONTEXT_XSTATE: Extended processor state chunk. The state is - // stored in the same format XSAVE operation strores it with - // exception of the first 512 bytes, i.e. staring from - // XSAVE_AREA_HEADER. The lower two bits corresponding FP and - // SSE state must be zero. - // - - CONTEXT_CHUNK XState; - -} CONTEXT_EX, *PCONTEXT_EX; - -#define CONTEXT_EX_LENGTH ALIGN_UP_BY(sizeof(CONTEXT_EX), STACK_ALIGN) - -// -// These macros make context chunks manupulations easier. -// - -#define RTL_CONTEXT_EX_OFFSET(ContextEx, Chunk) \ - ((ContextEx)->Chunk.Offset) - -#define RTL_CONTEXT_EX_LENGTH(ContextEx, Chunk) \ - ((ContextEx)->Chunk.Length) - -#define RTL_CONTEXT_EX_CHUNK(Base, Layout, Chunk) \ - ((PVOID)((PCHAR)(Base) + RTL_CONTEXT_EX_OFFSET(Layout, Chunk))) - -#define RTL_CONTEXT_OFFSET(Context, Chunk) \ - RTL_CONTEXT_EX_OFFSET((PCONTEXT_EX)(Context + 1), Chunk) - -#define RTL_CONTEXT_LENGTH(Context, Chunk) \ - RTL_CONTEXT_EX_LENGTH((PCONTEXT_EX)(Context + 1), Chunk) - -#define RTL_CONTEXT_CHUNK(Context, Chunk) \ - RTL_CONTEXT_EX_CHUNK((PCONTEXT_EX)(Context + 1), \ - (PCONTEXT_EX)(Context + 1), \ - Chunk) - - -#if !defined(__midl) && !defined(MIDL_PASS) - -// -// XSAVE/XRSTOR save area should be aligned on 64 byte boundary -// - -C_ASSERT((sizeof(XSAVE_FORMAT) & (XSAVE_ALIGN - 1)) == 0); -C_ASSERT((FIELD_OFFSET(XSAVE_AREA, Header) & (XSAVE_ALIGN - 1)) == 0); - -// XSAVE_AREA structure must be sized uniformly on all architectures -C_ASSERT(MINIMAL_XSTATE_AREA_LENGTH == 512 + 64); - -#endif - - -#ifdef _X86_ - -// -// Disable these two pragmas that evaluate to "sti" "cli" on x86 so that driver -// writers to not leave them inadvertantly in their code. -// - -#if !defined(MIDL_PASS) -#if !defined(RC_INVOKED) - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4164) // disable C4164 warning so that apps that - // build with /Od don't get weird errors ! -#ifdef _M_IX86 -#pragma function(_enable) -#pragma function(_disable) -#endif - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4164) // reenable C4164 warning -#endif - -#endif -#endif - - -#if defined(_M_IX86) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -#ifdef __cplusplus -extern "C" { -#endif - - - -#if (_MSC_FULL_VER >= 14000101) - - -// -// Define bit test intrinsics. -// - -#define BitTest _bittest -#define BitTestAndComplement _bittestandcomplement -#define BitTestAndSet _bittestandset -#define BitTestAndReset _bittestandreset -#define InterlockedBitTestAndSet _interlockedbittestandset -#define InterlockedBitTestAndReset _interlockedbittestandreset - -__checkReturn -BOOLEAN -_bittest ( - __in_bcount((Offset+7)/8) LONG const *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandcomplement ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandreset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_interlockedbittestandset ( - __inout_bcount((Offset+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Offset - ); - -BOOLEAN -_interlockedbittestandreset ( - __inout_bcount((Offset+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Offset - ); - -#pragma intrinsic(_bittest) -#pragma intrinsic(_bittestandcomplement) -#pragma intrinsic(_bittestandset) -#pragma intrinsic(_bittestandreset) -#pragma intrinsic(_interlockedbittestandset) -#pragma intrinsic(_interlockedbittestandreset) - -// -// Define bit scan intrinsics. -// - -#define BitScanForward _BitScanForward -#define BitScanReverse _BitScanReverse - -__success(return != 0) -BOOLEAN -_BitScanForward ( - __out ULONG *Index, - __in ULONG Mask - ); - -__success(return != 0) -BOOLEAN -_BitScanReverse ( - __out ULONG *Index, - __in ULONG Mask - ); - -#pragma intrinsic(_BitScanForward) -#pragma intrinsic(_BitScanReverse) - -#else - -#pragma warning(push) -#pragma warning(disable:4035 4793) - -FORCEINLINE -BOOLEAN -InterlockedBitTestAndSet ( - __inout_bcount((Bit+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - __asm { - mov eax, Bit - mov ecx, Base - lock bts [ecx], eax - setc al - }; -} - -FORCEINLINE -BOOLEAN -InterlockedBitTestAndReset ( - __inout_bcount((Bit+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - __asm { - mov eax, Bit - mov ecx, Base - lock btr [ecx], eax - setc al - }; -} -#pragma warning(pop) - -#endif /* _MSC_FULL_VER >= 14000101 */ - -// -// [pfx_parse] - guard against PREfix intrinsic error -// -#if (_MSC_FULL_VER >= 140040816) || (defined(_PREFAST_) && (_MSC_VER >= 1400)) - -#define InterlockedAnd16 _InterlockedAnd16 -#define InterlockedCompareExchange16 _InterlockedCompareExchange16 -#define InterlockedOr16 _InterlockedOr16 - -SHORT -_InterlockedAnd16 ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -_InterlockedCompareExchange16 ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT ExChange, - __in SHORT Comperand - ); - -SHORT -_InterlockedOr16 ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -#pragma intrinsic(_InterlockedAnd16) -#pragma intrinsic(_InterlockedCompareExchange16) -#pragma intrinsic(_InterlockedOr16) - -#endif /* _MSC_FULL_VER >= 140040816 */ - -#if !defined(_M_CEE_PURE) -#pragma warning(push) -#pragma warning(disable:4035 4793) - -FORCEINLINE -BOOLEAN -InterlockedBitTestAndComplement ( - __inout_bcount((Bit+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - __asm { - mov eax, Bit - mov ecx, Base - lock btc [ecx], eax - setc al - }; -} -#pragma warning(pop) -#endif /* _M_CEE_PURE */ - -// -// [pfx_parse] -// guard against __readfsbyte parsing error -// -#if (_MSC_FULL_VER >= 13012035) || defined(_PREFIX_) || defined(_PREFAST_) - -// -// Define FS referencing intrinsics -// - -UCHAR -__readfsbyte ( - __in ULONG Offset - ); - -USHORT -__readfsword ( - __in ULONG Offset - ); - -ULONG -__readfsdword ( - __in ULONG Offset - ); - -VOID -__writefsbyte ( - __in ULONG Offset, - __in UCHAR Data - ); - -VOID -__writefsword ( - __in ULONG Offset, - __in USHORT Data - ); - -VOID -__writefsdword ( - __in ULONG Offset, - __in ULONG Data - ); - -#pragma intrinsic(__readfsbyte) -#pragma intrinsic(__readfsword) -#pragma intrinsic(__readfsdword) -#pragma intrinsic(__writefsbyte) -#pragma intrinsic(__writefsword) -#pragma intrinsic(__writefsdword) - -#endif /* _MSC_FULL_VER >= 13012035 */ - -#if (_MSC_FULL_VER >= 140050727) || defined(_PREFIX_) || defined(_PREFAST_) - -#if !defined(_MANAGED) - -VOID -__incfsbyte ( - __in ULONG Offset - ); - -VOID -__addfsbyte ( - __in ULONG Offset, - __in UCHAR Value - ); - -VOID -__incfsword ( - __in ULONG Offset - ); - -VOID -__addfsword ( - __in ULONG Offset, - __in USHORT Value - ); - -VOID -__incfsdword ( - __in ULONG Offset - ); - -VOID -__addfsdword ( - __in ULONG Offset, - __in ULONG Value - ); - -#pragma intrinsic(__incfsbyte) -#pragma intrinsic(__addfsbyte) -#pragma intrinsic(__incfsword) -#pragma intrinsic(__addfsword) -#pragma intrinsic(__incfsdword) -#pragma intrinsic(__addfsdword) - -#endif - -#endif /* _MSC_FULL_VER >= 140050727 */ - -#if (_MSC_FULL_VER >= 140041204) || defined(_PREFIX_) || defined(_PREFAST_) - -VOID -_mm_pause ( - VOID - ); - -#pragma intrinsic(_mm_pause) - -#define YieldProcessor _mm_pause - -#else - -#if !defined(_M_CEE_PURE) -#define YieldProcessor() __asm { rep nop } -#endif // !defined(_M_CEE_PURE) - -#endif // (_MSC_FULL_VER >= 140041204) - -#ifdef __cplusplus -} -#endif - -#endif /* !defined(MIDL_PASS) || defined(_M_IX86) */ - - -#if defined(_X86_) && defined(_M_IX86) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -#if _MSC_FULL_VER >= 140030222 - -VOID -__int2c ( - VOID - ); - -#pragma intrinsic(__int2c) - -__analysis_noreturn -FORCEINLINE -VOID -DbgRaiseAssertionFailure ( - VOID - ) - -{ - __int2c(); -} - -#else -#pragma warning( push ) -#pragma warning( disable : 4793 ) - -__analysis_noreturn -FORCEINLINE -VOID -DbgRaiseAssertionFailure ( - VOID - ) - -{ - __asm int 0x2c -} - -#pragma warning( pop ) - -#endif - -#endif - - -#define MAXIMUM_SUPPORTED_EXTENSION 512 - -#if !defined(__midl) && !defined(MIDL_PASS) - -C_ASSERT(sizeof(XSAVE_FORMAT) == MAXIMUM_SUPPORTED_EXTENSION); - -#endif - -#endif // _X86_ - -#ifdef _AMD64_ - - -#if defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -// -// Define bit test intrinsics. -// - -#ifdef __cplusplus -extern "C" { -#endif - -#define BitTest _bittest -#define BitTestAndComplement _bittestandcomplement -#define BitTestAndSet _bittestandset -#define BitTestAndReset _bittestandreset -#define InterlockedBitTestAndSet _interlockedbittestandset -#define InterlockedBitTestAndReset _interlockedbittestandreset - -#define BitTest64 _bittest64 -#define BitTestAndComplement64 _bittestandcomplement64 -#define BitTestAndSet64 _bittestandset64 -#define BitTestAndReset64 _bittestandreset64 -#define InterlockedBitTestAndSet64 _interlockedbittestandset64 -#define InterlockedBitTestAndReset64 _interlockedbittestandreset64 - -__checkReturn -BOOLEAN -_bittest ( - __in_bcount((Offset+7)/8) LONG const *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandcomplement ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandreset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_interlockedbittestandset ( - __inout_bcount((Offset+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Offset - ); - -BOOLEAN -_interlockedbittestandreset ( - __inout_bcount((Offset+7)/8) __drv_interlocked LONG volatile *Base, - __in LONG Offset - ); - -BOOLEAN -_bittest64 ( - __in_bcount((Offset+7)/8) LONG64 const *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandcomplement64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandset64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandreset64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -BOOLEAN -_interlockedbittestandset64 ( - __inout_bcount((Offset+7)/8) __drv_interlocked LONG64 volatile *Base, - __in LONG64 Offset - ); - -BOOLEAN -_interlockedbittestandreset64 ( - __inout_bcount((Offset+7)/8) __drv_interlocked LONG64 volatile *Base, - __in LONG64 Offset - ); - -#pragma intrinsic(_bittest) -#pragma intrinsic(_bittestandcomplement) -#pragma intrinsic(_bittestandset) -#pragma intrinsic(_bittestandreset) -#pragma intrinsic(_interlockedbittestandset) -#pragma intrinsic(_interlockedbittestandreset) - -#pragma intrinsic(_bittest64) -#pragma intrinsic(_bittestandcomplement64) -#pragma intrinsic(_bittestandset64) -#pragma intrinsic(_bittestandreset64) -#pragma intrinsic(_interlockedbittestandset64) -#pragma intrinsic(_interlockedbittestandreset64) - -// -// Define bit scan intrinsics. -// - -#define BitScanForward _BitScanForward -#define BitScanReverse _BitScanReverse -#define BitScanForward64 _BitScanForward64 -#define BitScanReverse64 _BitScanReverse64 - -__success(return!=0) -BOOLEAN -_BitScanForward ( - __out ULONG *Index, - __in ULONG Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanReverse ( - __out ULONG *Index, - __in ULONG Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanForward64 ( - __out ULONG *Index, - __in ULONG64 Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanReverse64 ( - __out ULONG *Index, - __in ULONG64 Mask - ); - -#pragma intrinsic(_BitScanForward) -#pragma intrinsic(_BitScanReverse) -#pragma intrinsic(_BitScanForward64) -#pragma intrinsic(_BitScanReverse64) - -// -// Interlocked intrinsic functions. -// - -#define InterlockedIncrement16 _InterlockedIncrement16 -#define InterlockedDecrement16 _InterlockedDecrement16 -#define InterlockedCompareExchange16 _InterlockedCompareExchange16 - -#define InterlockedAnd _InterlockedAnd -#define InterlockedAndAcquire _InterlockedAnd -#define InterlockedAndRelease _InterlockedAnd -#define InterlockedOr _InterlockedOr -#define InterlockedOrAcquire _InterlockedOr -#define InterlockedOrRelease _InterlockedOr -#define InterlockedXor _InterlockedXor -#define InterlockedIncrement _InterlockedIncrement -#define InterlockedIncrementAcquire InterlockedIncrement -#define InterlockedIncrementRelease InterlockedIncrement -#define InterlockedDecrement _InterlockedDecrement -#define InterlockedDecrementAcquire InterlockedDecrement -#define InterlockedDecrementRelease InterlockedDecrement -#define InterlockedAdd _InterlockedAdd -#define InterlockedExchange _InterlockedExchange -#define InterlockedExchangeAdd _InterlockedExchangeAdd -#define InterlockedCompareExchange _InterlockedCompareExchange -#define InterlockedCompareExchangeAcquire InterlockedCompareExchange -#define InterlockedCompareExchangeRelease InterlockedCompareExchange - -#define InterlockedAnd64 _InterlockedAnd64 -#define InterlockedAnd64Acquire _InterlockedAnd64 -#define InterlockedAnd64Release _InterlockedAnd64 -#define InterlockedAndAffinity InterlockedAnd64 -#define InterlockedOr64 _InterlockedOr64 -#define InterlockedOr64Acquire _InterlockedOr64 -#define InterlockedOr64Release _InterlockedOr64 -#define InterlockedOrAffinity InterlockedOr64 -#define InterlockedXor64 _InterlockedXor64 -#define InterlockedIncrement64 _InterlockedIncrement64 -#define InterlockedDecrement64 _InterlockedDecrement64 -#define InterlockedAdd64 _InterlockedAdd64 -#define InterlockedExchange64 _InterlockedExchange64 -#define InterlockedExchangeAcquire64 InterlockedExchange64 -#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 -#define InterlockedCompareExchange64 _InterlockedCompareExchange64 -#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 -#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 - -#define InterlockedExchangePointer _InterlockedExchangePointer -#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer - -#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONG64 *)a, b) -#define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONG64 *)a) -#define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONG64 *)a) - -SHORT -InterlockedIncrement16 ( - __inout __drv_interlocked SHORT volatile *Addend - ); - -SHORT -InterlockedDecrement16 ( - __inout __drv_interlocked SHORT volatile *Addend - ); - -SHORT -InterlockedCompareExchange16 ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT ExChange, - __in SHORT Comperand - ); - -LONG -InterlockedAnd ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -InterlockedOr ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -InterlockedXor ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG64 -InterlockedAnd64 ( - __inout __drv_interlocked LONG64 volatile *Destination, - __in LONG64 Value - ); - -LONG64 -InterlockedOr64 ( - __inout __drv_interlocked LONG64 volatile *Destination, - __in LONG64 Value - ); - -LONG64 -InterlockedXor64 ( - __inout __drv_interlocked LONG64 volatile *Destination, - __in LONG64 Value - ); - -LONG -InterlockedIncrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -InterlockedDecrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -InterlockedExchange( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Value - ); - -LONG -InterlockedExchangeAdd( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -#if !defined(_X86AMD64_) - -__forceinline -LONG -InterlockedAdd( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ) - -{ - return InterlockedExchangeAdd(Addend, Value) + Value; -} - -#endif - -LONG -InterlockedCompareExchange ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - -LONG64 -InterlockedIncrement64( - __inout __drv_interlocked LONG64 volatile *Addend - ); - -LONG64 -InterlockedDecrement64( - __inout __drv_interlocked LONG64 volatile *Addend - ); - -LONG64 -InterlockedExchange64( - __inout __drv_interlocked LONG64 volatile *Target, - __in LONG64 Value - ); - -LONG64 -InterlockedExchangeAdd64( - __inout __drv_interlocked LONG64 volatile *Addend, - __in LONG64 Value - ); - -#if !defined(_X86AMD64_) - -__forceinline -LONG64 -InterlockedAdd64( - __inout __drv_interlocked LONG64 volatile *Addend, - __in LONG64 Value - ) - -{ - return InterlockedExchangeAdd64(Addend, Value) + Value; -} - -#endif - -LONG64 -InterlockedCompareExchange64 ( - __inout __drv_interlocked LONG64 volatile *Destination, - __in LONG64 ExChange, - __in LONG64 Comperand - ); - -PVOID -InterlockedCompareExchangePointer ( - __inout __drv_interlocked PVOID volatile *Destination, - __in_opt PVOID Exchange, - __in_opt PVOID Comperand - ); - -PVOID -InterlockedExchangePointer( - __inout __drv_interlocked PVOID volatile *Target, - __in_opt PVOID Value - ); - -#pragma intrinsic(_InterlockedIncrement16) -#pragma intrinsic(_InterlockedDecrement16) -#pragma intrinsic(_InterlockedCompareExchange16) -#pragma intrinsic(_InterlockedAnd) -#pragma intrinsic(_InterlockedOr) -#pragma intrinsic(_InterlockedXor) -#pragma intrinsic(_InterlockedIncrement) -#pragma intrinsic(_InterlockedDecrement) -#pragma intrinsic(_InterlockedExchange) -#pragma intrinsic(_InterlockedExchangeAdd) -#pragma intrinsic(_InterlockedCompareExchange) -#pragma intrinsic(_InterlockedAnd64) -#pragma intrinsic(_InterlockedOr64) -#pragma intrinsic(_InterlockedXor64) -#pragma intrinsic(_InterlockedIncrement64) -#pragma intrinsic(_InterlockedDecrement64) -#pragma intrinsic(_InterlockedExchange64) -#pragma intrinsic(_InterlockedExchangeAdd64) -#pragma intrinsic(_InterlockedCompareExchange64) -#pragma intrinsic(_InterlockedExchangePointer) -#pragma intrinsic(_InterlockedCompareExchangePointer) - -#if _MSC_FULL_VER >= 140041204 - -#define InterlockedAnd8 _InterlockedAnd8 -#define InterlockedOr8 _InterlockedOr8 -#define InterlockedXor8 _InterlockedXor8 -#define InterlockedAnd16 _InterlockedAnd16 -#define InterlockedOr16 _InterlockedOr16 -#define InterlockedXor16 _InterlockedXor16 - -char -InterlockedAnd8 ( - __inout __drv_interlocked char volatile *Destination, - __in char Value - ); - -char -InterlockedOr8 ( - __inout __drv_interlocked char volatile *Destination, - __in char Value - ); - -char -InterlockedXor8 ( - __inout __drv_interlocked char volatile *Destination, - __in char Value - ); - -SHORT -InterlockedAnd16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -InterlockedOr16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -InterlockedXor16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -#pragma intrinsic (_InterlockedAnd8) -#pragma intrinsic (_InterlockedOr8) -#pragma intrinsic (_InterlockedXor8) -#pragma intrinsic (_InterlockedAnd16) -#pragma intrinsic (_InterlockedOr16) -#pragma intrinsic (_InterlockedXor16) - -#endif - -// -// Define function to flush a cache line. -// - -#define CacheLineFlush(Address) _mm_clflush(Address) - -VOID -_mm_clflush ( - __in VOID const *Address - ); - -#pragma intrinsic(_mm_clflush) - -VOID -_ReadWriteBarrier ( - VOID - ); - -#pragma intrinsic(_ReadWriteBarrier) - -// -// Define memory fence intrinsics -// - -#define FastFence __faststorefence -#define LoadFence _mm_lfence -#define MemoryFence _mm_mfence -#define StoreFence _mm_sfence - -VOID -__faststorefence ( - VOID - ); - -VOID -_mm_lfence ( - VOID - ); - -VOID -_mm_mfence ( - VOID - ); - -VOID -_mm_sfence ( - VOID - ); - -VOID -_mm_pause ( - VOID - ); - -VOID -_mm_prefetch ( - __in CHAR CONST *a, - __in int sel - ); - -VOID -_m_prefetchw ( - __in volatile CONST VOID *Source - ); - -// -// Define constants for use with _mm_prefetch. -// - -#define _MM_HINT_T0 1 -#define _MM_HINT_T1 2 -#define _MM_HINT_T2 3 -#define _MM_HINT_NTA 0 - -#pragma intrinsic(__faststorefence) -#pragma intrinsic(_mm_pause) -#pragma intrinsic(_mm_prefetch) -#pragma intrinsic(_mm_lfence) -#pragma intrinsic(_mm_mfence) -#pragma intrinsic(_mm_sfence) -#pragma intrinsic(_m_prefetchw) - -#define YieldProcessor _mm_pause -#define MemoryBarrier __faststorefence -#define PreFetchCacheLine(l, a) _mm_prefetch((CHAR CONST *) a, l) -#define PrefetchForWrite(p) _m_prefetchw(p) -#define ReadForWriteAccess(p) (_m_prefetchw(p), *(p)) - -// -// PreFetchCacheLine level defines. -// - -#define PF_TEMPORAL_LEVEL_1 _MM_HINT_T0 -#define PF_TEMPORAL_LEVEL_2 _MM_HINT_T1 -#define PF_TEMPORAL_LEVEL_3 _MM_HINT_T2 -#define PF_NON_TEMPORAL_LEVEL_ALL _MM_HINT_NTA - -// -// Define get/set MXCSR intrinsics. -// - -#define ReadMxCsr _mm_getcsr -#define WriteMxCsr _mm_setcsr - -unsigned int -_mm_getcsr ( - VOID - ); - -VOID -_mm_setcsr ( - __in unsigned int MxCsr - ); - -#pragma intrinsic(_mm_getcsr) -#pragma intrinsic(_mm_setcsr) - -// -// Assert exception. -// - -VOID -__int2c ( - VOID - ); - -#pragma intrinsic(__int2c) - -__analysis_noreturn -FORCEINLINE -VOID -DbgRaiseAssertionFailure ( - VOID - ) - -{ - __int2c(); -} - -// -// Define function to get the caller's EFLAGs value. -// - -#define GetCallersEflags() __getcallerseflags() - -unsigned __int32 -__getcallerseflags ( - VOID - ); - -#pragma intrinsic(__getcallerseflags) - -// -// Define function to get segment limit. -// - -#define GetSegmentLimit __segmentlimit - -ULONG -__segmentlimit ( - __in ULONG Selector - ); - -#pragma intrinsic(__segmentlimit) - -// -// Define function to read the value of a performance counter. -// - -#define ReadPMC __readpmc - -ULONG64 -__readpmc ( - __in ULONG Counter - ); - -#pragma intrinsic(__readpmc) - -// -// Define function to read the value of the time stamp counter -// - -#define ReadTimeStampCounter() __rdtsc() - -ULONG64 -__rdtsc ( - VOID - ); - -#pragma intrinsic(__rdtsc) - -// -// Define functions to move strings as bytes, words, dwords, and qwords. -// - -VOID -__movsb ( - __out_ecount_full(Count) PUCHAR Destination, - __in_ecount(Count) UCHAR const *Source, - __in SIZE_T Count - ); - -VOID -__movsw ( - __out_ecount_full(Count) PUSHORT Destination, - __in_ecount(Count) USHORT const *Source, - __in SIZE_T Count - ); - -VOID -__movsd ( - __out_ecount_full(Count) PULONG Destination, - __in_ecount(Count) ULONG const *Source, - __in SIZE_T Count - ); - -VOID -__movsq ( - __out_ecount_full(Count) PULONG64 Destination, - __in_ecount(Count) ULONG64 const *Source, - __in SIZE_T Count - ); - -#pragma intrinsic(__movsb) -#pragma intrinsic(__movsw) -#pragma intrinsic(__movsd) -#pragma intrinsic(__movsq) - -// -// Define functions to store strings as bytes, words, dwords, and qwords. -// - -VOID -__stosb ( - __out_ecount_full(Count) PUCHAR Destination, - __in UCHAR Value, - __in SIZE_T Count - ); - -VOID -__stosw ( - __out_ecount_full(Count) PUSHORT Destination, - __in USHORT Value, - __in SIZE_T Count - ); - -VOID -__stosd ( - __out_ecount_full(Count) PULONG Destination, - __in ULONG Value, - __in SIZE_T Count - ); - -VOID -__stosq ( - __out_ecount_full(Count) PULONG64 Destination, - __in ULONG64 Value, - __in SIZE_T Count - ); - -#pragma intrinsic(__stosb) -#pragma intrinsic(__stosw) -#pragma intrinsic(__stosd) -#pragma intrinsic(__stosq) - -// -// Define functions to capture the high 64-bits of a 128-bit multiply. -// - -#define MultiplyHigh __mulh -#define UnsignedMultiplyHigh __umulh - -LONGLONG -MultiplyHigh ( - __in LONG64 Multiplier, - __in LONG64 Multiplicand - ); - -ULONGLONG -UnsignedMultiplyHigh ( - __in ULONG64 Multiplier, - __in ULONG64 Multiplicand - ); - -#pragma intrinsic(__mulh) -#pragma intrinsic(__umulh) - -// -// Define functions to perform 128-bit shifts -// - -#define ShiftLeft128 __shiftleft128 -#define ShiftRight128 __shiftright128 - -ULONG64 -ShiftLeft128 ( - __in ULONG64 LowPart, - __in ULONG64 HighPart, - __in UCHAR Shift - ); - -ULONG64 -ShiftRight128 ( - __in ULONG64 LowPart, - __in ULONG64 HighPart, - __in UCHAR Shift - ); - -#pragma intrinsic(__shiftleft128) -#pragma intrinsic(__shiftright128) - -// -// Define functions to perform 128-bit multiplies. -// - -#define Multiply128 _mul128 - -LONG64 -Multiply128 ( - __in LONG64 Multiplier, - __in LONG64 Multiplicand, - __out LONG64 *HighProduct - ); - -#pragma intrinsic(_mul128) - -#ifndef UnsignedMultiply128 - -#define UnsignedMultiply128 _umul128 - -ULONG64 -UnsignedMultiply128 ( - __in ULONG64 Multiplier, - __in ULONG64 Multiplicand, - __out ULONG64 *HighProduct - ); - -#pragma intrinsic(_umul128) - -#endif - -__forceinline -LONG64 -MultiplyExtract128 ( - __in LONG64 Multiplier, - __in LONG64 Multiplicand, - __in UCHAR Shift - ) - -{ - - LONG64 extractedProduct; - LONG64 highProduct; - LONG64 lowProduct; - BOOLEAN negate; - ULONG64 uhighProduct; - ULONG64 ulowProduct; - - lowProduct = Multiply128(Multiplier, Multiplicand, &highProduct); - negate = FALSE; - uhighProduct = (ULONG64)highProduct; - ulowProduct = (ULONG64)lowProduct; - if (highProduct < 0) { - negate = TRUE; - uhighProduct = (ULONG64)(-highProduct); - ulowProduct = (ULONG64)(-lowProduct); - if (ulowProduct != 0) { - uhighProduct -= 1; - } - } - - extractedProduct = (LONG64)ShiftRight128(ulowProduct, uhighProduct, Shift); - if (negate != FALSE) { - extractedProduct = -extractedProduct; - } - - return extractedProduct; -} - -__forceinline -ULONG64 -UnsignedMultiplyExtract128 ( - __in ULONG64 Multiplier, - __in ULONG64 Multiplicand, - __in UCHAR Shift - ) - -{ - - ULONG64 extractedProduct; - ULONG64 highProduct; - ULONG64 lowProduct; - - lowProduct = UnsignedMultiply128(Multiplier, Multiplicand, &highProduct); - extractedProduct = ShiftRight128(lowProduct, highProduct, Shift); - return extractedProduct; -} - -// -// Define functions to read and write the uer TEB and the system PCR/PRCB. -// - -UCHAR -__readgsbyte ( - __in ULONG Offset - ); - -USHORT -__readgsword ( - __in ULONG Offset - ); - -ULONG -__readgsdword ( - __in ULONG Offset - ); - -ULONG64 -__readgsqword ( - __in ULONG Offset - ); - -VOID -__writegsbyte ( - __in ULONG Offset, - __in UCHAR Data - ); - -VOID -__writegsword ( - __in ULONG Offset, - __in USHORT Data - ); - -VOID -__writegsdword ( - __in ULONG Offset, - __in ULONG Data - ); - -VOID -__writegsqword ( - __in ULONG Offset, - __in ULONG64 Data - ); - -#pragma intrinsic(__readgsbyte) -#pragma intrinsic(__readgsword) -#pragma intrinsic(__readgsdword) -#pragma intrinsic(__readgsqword) -#pragma intrinsic(__writegsbyte) -#pragma intrinsic(__writegsword) -#pragma intrinsic(__writegsdword) -#pragma intrinsic(__writegsqword) - -#if !defined(_MANAGED) - -VOID -__incgsbyte ( - __in ULONG Offset - ); - -VOID -__addgsbyte ( - __in ULONG Offset, - __in UCHAR Value - ); - -VOID -__incgsword ( - __in ULONG Offset - ); - -VOID -__addgsword ( - __in ULONG Offset, - __in USHORT Value - ); - -VOID -__incgsdword ( - __in ULONG Offset - ); - -VOID -__addgsdword ( - __in ULONG Offset, - __in ULONG Value - ); - -VOID -__incgsqword ( - __in ULONG Offset - ); - -VOID -__addgsqword ( - __in ULONG Offset, - __in ULONG64 Value - ); - -#if 0 -#pragma intrinsic(__incgsbyte) -#pragma intrinsic(__addgsbyte) -#pragma intrinsic(__incgsword) -#pragma intrinsic(__addgsword) -#pragma intrinsic(__incgsdword) -#pragma intrinsic(__addgsdword) -#pragma intrinsic(__incgsqword) -#pragma intrinsic(__addgsqword) -#endif - -#endif - -#ifdef __cplusplus -} -#endif - -#endif // defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - - -typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32; - - -#endif // _AMD64_ - - -#ifdef _IA64_ - - -#if defined(_M_IA64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Define bit test intrinsics. -// - -#define BitTest _bittest -#define BitTestAndComplement _bittestandcomplement -#define BitTestAndSet _bittestandset -#define BitTestAndReset _bittestandreset - -#define BitTest64 _bittest64 -#define BitTestAndComplement64 _bittestandcomplement64 -#define BitTestAndSet64 _bittestandset64 -#define BitTestAndReset64 _bittestandreset64 - -__checkReturn -BOOLEAN -_bittest ( - __in_bcount((Offset+7)/8) LONG const *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandcomplement ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -BOOLEAN -_bittestandreset ( - __inout_bcount((Offset+7)/8) LONG *Base, - __in LONG Offset - ); - -__checkReturn -BOOLEAN -_bittest64 ( - __in_bcount((Offset+7)/8) LONG64 const *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandcomplement64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandset64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -BOOLEAN -_bittestandreset64 ( - __inout_bcount((Offset+7)/8) LONG64 *Base, - __in LONG64 Offset - ); - -#pragma intrinsic(_bittest) -#pragma intrinsic(_bittestandcomplement) -#pragma intrinsic(_bittestandset) -#pragma intrinsic(_bittestandreset) - -#pragma intrinsic(_bittest64) -#pragma intrinsic(_bittestandcomplement64) -#pragma intrinsic(_bittestandset64) -#pragma intrinsic(_bittestandreset64) - -// -// Define bit scan intrinsics. -// - -#define BitScanForward _BitScanForward -#define BitScanReverse _BitScanReverse -#define BitScanForward64 _BitScanForward64 -#define BitScanReverse64 _BitScanReverse64 - -__success(return!=0) -BOOLEAN -_BitScanForward ( - __out ULONG *Index, - __in ULONG Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanReverse ( - __out ULONG *Index, - __in ULONG Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanForward64 ( - __out ULONG *Index, - __in ULONG64 Mask - ); - -__success(return!=0) -BOOLEAN -_BitScanReverse64 ( - __out ULONG *Index, - __in ULONG64 Mask - ); - -#pragma intrinsic(_BitScanForward) -#pragma intrinsic(_BitScanReverse) -#pragma intrinsic(_BitScanForward64) -#pragma intrinsic(_BitScanReverse64) - -#define InterlockedCompareExchange16 _InterlockedCompareExchange16 - -SHORT -_InterlockedCompareExchange16 ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT ExChange, - __in SHORT Comperand - ); - -#pragma intrinsic(_InterlockedCompareExchange16) - -#ifdef __cplusplus -} -#endif - -#define InterlockedAdd _InterlockedAdd -#define InterlockedAddAcquire _InterlockedAdd_acq -#define InterlockedAddRelease _InterlockedAdd_rel - -#define InterlockedIncrement _InterlockedIncrement -#define InterlockedIncrementAcquire _InterlockedIncrement_acq -#define InterlockedIncrementRelease _InterlockedIncrement_rel - -#define InterlockedDecrement _InterlockedDecrement -#define InterlockedDecrementAcquire _InterlockedDecrement_acq -#define InterlockedDecrementRelease _InterlockedDecrement_rel - -#define InterlockedExchange _InterlockedExchange -#define InterlockedExchangeAcquire _InterlockedExchange_acq - -#define InterlockedExchangeAdd _InterlockedExchangeAdd -#define InterlockedExchangeAddAcquire _InterlockedExchangeAdd_acq -#define InterlockedExchangeAddRelease _InterlockedExchangeAdd_rel - -#define InterlockedAdd64 _InterlockedAdd64 -#define InterlockedAddAcquire64 _InterlockedAdd64_acq -#define InterlockedAddRelease64 _InterlockedAdd64_rel - -#define InterlockedIncrement64 _InterlockedIncrement64 -#define InterlockedIncrementAcquire64 _InterlockedIncrement64_acq -#define InterlockedIncrementRelease64 _InterlockedIncrement64_rel - -#define InterlockedDecrement64 _InterlockedDecrement64 -#define InterlockedDecrementAcquire64 _InterlockedDecrement64_acq -#define InterlockedDecrementRelease64 _InterlockedDecrement64_rel - -#define InterlockedExchange64 _InterlockedExchange64 -#define InterlockedExchangeAcquire64 _InterlockedExchange64_acq - -#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 -#define InterlockedExchangeAddAcquire64 _InterlockedExchangeAdd64_acq -#define InterlockedExchangeAddRelease64 _InterlockedExchangeAdd64_rel - -#define InterlockedCompareExchange64 _InterlockedCompareExchange64 -#define InterlockedCompareExchangeAcquire64 _InterlockedCompareExchange64_acq -#define InterlockedCompareExchangeRelease64 _InterlockedCompareExchange64_rel - -#define InterlockedCompare64Exchange128 _InterlockedCompare64Exchange128 -#define InterlockedCompare64ExchangeAcquire128 _InterlockedCompare64Exchange128_acq -#define InterlockedCompare64ExchangeRelease128 _InterlockedCompare64Exchange128_rel - -#define InterlockedCompareExchange _InterlockedCompareExchange -#define InterlockedCompareExchangeAcquire _InterlockedCompareExchange_acq -#define InterlockedCompareExchangeRelease _InterlockedCompareExchange_rel - -#define InterlockedExchangePointer _InterlockedExchangePointer -#define InterlockedExchangePointerAcquire _InterlockedExchangePointer_acq - -#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer_rel -#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer_acq - - -#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONG64 *)a, b) -#define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONG64 *)a) -#define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONG64 *)a) - -#define InterlockedOr _InterlockedOr -#define InterlockedOrAcquire _InterlockedOr_acq -#define InterlockedOrRelease _InterlockedOr_rel -#define InterlockedOr8 _InterlockedOr8 -#define InterlockedOr8Acquire _InterlockedOr8_acq -#define InterlockedOr8Release _InterlockedOr8_rel -#define InterlockedOr16 _InterlockedOr16 -#define InterlockedOr16Acquire _InterlockedOr16_acq -#define InterlockedOr16Release _InterlockedOr16_rel -#define InterlockedOr64 _InterlockedOr64 -#define InterlockedOr64Acquire _InterlockedOr64_acq -#define InterlockedOr64Release _InterlockedOr64_rel -#define InterlockedXor _InterlockedXor -#define InterlockedXorAcquire _InterlockedXor_acq -#define InterlockedXorRelease _InterlockedXor_rel -#define InterlockedXor8 _InterlockedXor8 -#define InterlockedXor8Acquire _InterlockedXor8_acq -#define InterlockedXor8Release _InterlockedXor8_rel -#define InterlockedXor16 _InterlockedXor16 -#define InterlockedXor16Acquire _InterlockedXor16_acq -#define InterlockedXor16Release _InterlockedXor16_rel -#define InterlockedXor64 _InterlockedXor64 -#define InterlockedXor64Acquire _InterlockedXor64_acq -#define InterlockedXor64Release _InterlockedXor64_rel -#define InterlockedAnd _InterlockedAnd -#define InterlockedAndAcquire _InterlockedAnd_acq -#define InterlockedAndRelease _InterlockedAnd_rel -#define InterlockedAnd8 _InterlockedAnd8 -#define InterlockedAnd8Acquire _InterlockedAnd8_acq -#define InterlockedAnd8Release _InterlockedAnd8_rel -#define InterlockedAnd16 _InterlockedAnd16 -#define InterlockedAnd16Acquire _InterlockedAnd16_acq -#define InterlockedAnd16Release _InterlockedAnd16_rel -#define InterlockedAnd64 _InterlockedAnd64 -#define InterlockedAnd64Acquire _InterlockedAnd64_acq -#define InterlockedAnd64Release _InterlockedAnd64_rel - -#ifdef __cplusplus -extern "C" { -#endif - -LONG -__cdecl -InterlockedAdd ( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedAddAcquire ( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedAddRelease ( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONGLONG -__cdecl -InterlockedAdd64 ( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedAddAcquire64 ( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - - -LONGLONG -__cdecl -InterlockedAddRelease64 ( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONG -__cdecl -InterlockedIncrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedDecrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedIncrementAcquire( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedDecrementAcquire( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedIncrementRelease( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedDecrementRelease( - __inout __drv_interlocked LONG volatile *Addend - ); - -LONG -__cdecl -InterlockedExchange( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Value - ); - -LONG -__cdecl -InterlockedExchangeAcquire( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Value - ); - -LONG -__cdecl -InterlockedExchangeAdd( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedExchangeAddAcquire( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedExchangeAddRelease( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Value - ); - -LONG -__cdecl -InterlockedCompareExchange ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - - -LONG -__cdecl -InterlockedCompareExchangeRelease ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - - -LONG -__cdecl -InterlockedCompareExchangeAcquire ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - - -LONGLONG -__cdecl -InterlockedIncrement64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedIncrementAcquire64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedIncrementRelease64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedDecrement64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedDecrementAcquire64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedDecrementRelease64( - __inout __drv_interlocked LONGLONG volatile *Addend - ); - -LONGLONG -__cdecl -InterlockedExchange64( - __inout __drv_interlocked LONGLONG volatile *Target, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedExchangeAcquire64( - __inout __drv_interlocked LONGLONG volatile *Target, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedExchangeAdd64( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedExchangeAddAcquire64( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedExchangeAddRelease64( - __inout __drv_interlocked LONGLONG volatile *Addend, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedCompareExchange64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG ExChange, - __in LONGLONG Comperand - ); - -LONGLONG -__cdecl -InterlockedCompareExchangeAcquire64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG ExChange, - __in LONGLONG Comperand - ); - -LONGLONG -__cdecl -InterlockedCompareExchangeRelease64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG ExChange, - __in LONGLONG Comperand - ); - -LONG64 -__cdecl -InterlockedCompare64Exchange128( - __inout_bcount(16) __drv_interlocked LONG64 volatile *Destination, - __in LONG64 ExchangeHigh, - __in LONG64 ExchangeLow, - __in LONG64 Comperand - ); - -LONG64 -__cdecl -InterlockedCompare64ExchangeAcquire128( - __inout_bcount(16) __drv_interlocked LONG64 volatile *Destination, - __in LONG64 ExchangeHigh, - __in LONG64 ExchangeLow, - __in LONG64 Comperand - ); - -LONG64 -__cdecl -InterlockedCompare64ExchangeRelease128( - __inout_bcount(16) __drv_interlocked LONG64 volatile *Destination, - __in LONG64 ExchangeHigh, - __in LONG64 ExchangeLow, - __in LONG64 Comperand - ); - -PVOID -__cdecl -InterlockedCompareExchangePointer ( - __inout __drv_interlocked PVOID volatile *Destination, - __in PVOID Exchange, - __in PVOID Comperand - ); - -PVOID -__cdecl -InterlockedCompareExchangePointerAcquire ( - __inout __drv_interlocked PVOID volatile *Destination, - __in PVOID Exchange, - __in PVOID Comperand - ); - -PVOID -__cdecl -InterlockedCompareExchangePointerRelease ( - __inout __drv_interlocked PVOID volatile *Destination, - __in PVOID Exchange, - __in PVOID Comperand - ); - -PVOID -__cdecl -InterlockedExchangePointer( - __inout __drv_interlocked PVOID volatile *Target, - __in PVOID Value - ); - -PVOID -__cdecl -InterlockedExchangePointerAcquire( - __inout __drv_interlocked PVOID volatile *Target, - __in PVOID Value - ); - -LONG -__cdecl -InterlockedOr ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedOrAcquire ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedOrRelease ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -CHAR -__cdecl -InterlockedOr8 ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedOr8Acquire ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedOr8Release ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -SHORT -__cdecl -InterlockedOr16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedOr16Acquire ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedOr16Release ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -LONGLONG -__cdecl -InterlockedOr64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedOr64Acquire ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedOr64Release ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONG -__cdecl -InterlockedXor ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedXorAcquire ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedXorRelease ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -CHAR -__cdecl -InterlockedXor8 ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedXor8Acquire ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedXor8Release ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -SHORT -__cdecl -InterlockedXor16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedXor16Acquire ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedXor16Release ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -LONGLONG -__cdecl -InterlockedXor64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedXor64Acquire ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedXor64Release ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONG -__cdecl -InterlockedAnd ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedAndAcquire ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -LONG -__cdecl -InterlockedAndRelease ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Value - ); - -CHAR -__cdecl -InterlockedAnd8 ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedAnd8Acquire ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -CHAR -__cdecl -InterlockedAnd8Release ( - __inout __drv_interlocked CHAR volatile *Destination, - __in CHAR Value - ); - -SHORT -__cdecl -InterlockedAnd16( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedAnd16Acquire ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -SHORT -__cdecl -InterlockedAnd16Release ( - __inout __drv_interlocked SHORT volatile *Destination, - __in SHORT Value - ); - -LONGLONG -__cdecl -InterlockedAnd64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedAnd64Acquire ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -LONGLONG -__cdecl -InterlockedAnd64Release ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ); - -#pragma intrinsic(_InterlockedAdd) -#pragma intrinsic(_InterlockedIncrement) -#pragma intrinsic(_InterlockedIncrement_acq) -#pragma intrinsic(_InterlockedIncrement_rel) -#pragma intrinsic(_InterlockedDecrement) -#pragma intrinsic(_InterlockedDecrement_acq) -#pragma intrinsic(_InterlockedDecrement_rel) -#pragma intrinsic(_InterlockedExchange) -#pragma intrinsic(_InterlockedCompareExchange) -#pragma intrinsic(_InterlockedCompareExchange_acq) -#pragma intrinsic(_InterlockedCompareExchange_rel) -#pragma intrinsic(_InterlockedExchangeAdd) -#pragma intrinsic(_InterlockedAdd64) -#pragma intrinsic(_InterlockedIncrement64) -#pragma intrinsic(_InterlockedDecrement64) -#pragma intrinsic(_InterlockedExchange64) -#pragma intrinsic(_InterlockedExchange64_acq) -#pragma intrinsic(_InterlockedCompareExchange64) -#pragma intrinsic(_InterlockedCompareExchange64_acq) -#pragma intrinsic(_InterlockedCompareExchange64_rel) -#pragma intrinsic(_InterlockedCompare64Exchange128) -#pragma intrinsic(_InterlockedCompare64Exchange128_acq) -#pragma intrinsic(_InterlockedCompare64Exchange128_rel) -#pragma intrinsic(_InterlockedExchangeAdd64) -#pragma intrinsic(_InterlockedExchangePointer) -#pragma intrinsic(_InterlockedCompareExchangePointer) -#pragma intrinsic(_InterlockedCompareExchangePointer_acq) -#pragma intrinsic(_InterlockedCompareExchangePointer_rel) -#pragma intrinsic(_InterlockedAdd_acq) -#pragma intrinsic(_InterlockedAdd_rel) -#pragma intrinsic(_InterlockedExchange_acq) -#pragma intrinsic(_InterlockedExchangeAdd_acq) -#pragma intrinsic(_InterlockedExchangeAdd_rel) -#pragma intrinsic(_InterlockedAdd64_acq) -#pragma intrinsic(_InterlockedAdd64_rel) -#pragma intrinsic(_InterlockedIncrement64_acq) -#pragma intrinsic(_InterlockedIncrement64_rel) -#pragma intrinsic(_InterlockedDecrement64_acq) -#pragma intrinsic(_InterlockedDecrement64_rel) -#pragma intrinsic(_InterlockedExchangeAdd64_acq) -#pragma intrinsic(_InterlockedExchangeAdd64_rel) -#pragma intrinsic(_InterlockedExchangePointer_acq) -#pragma intrinsic (_InterlockedOr) -#pragma intrinsic (_InterlockedOr_acq) -#pragma intrinsic (_InterlockedOr_rel) -#pragma intrinsic (_InterlockedOr8) -#pragma intrinsic (_InterlockedOr8_acq) -#pragma intrinsic (_InterlockedOr8_rel) -#pragma intrinsic (_InterlockedOr16) -#pragma intrinsic (_InterlockedOr16_acq) -#pragma intrinsic (_InterlockedOr16_rel) -#pragma intrinsic (_InterlockedOr64) -#pragma intrinsic (_InterlockedOr64_acq) -#pragma intrinsic (_InterlockedOr64_rel) -#pragma intrinsic (_InterlockedXor) -#pragma intrinsic (_InterlockedXor_acq) -#pragma intrinsic (_InterlockedXor_rel) -#pragma intrinsic (_InterlockedXor8) -#pragma intrinsic (_InterlockedXor8_acq) -#pragma intrinsic (_InterlockedXor8_rel) -#pragma intrinsic (_InterlockedXor16) -#pragma intrinsic (_InterlockedXor16_acq) -#pragma intrinsic (_InterlockedXor16_rel) -#pragma intrinsic (_InterlockedXor64) -#pragma intrinsic (_InterlockedXor64_acq) -#pragma intrinsic (_InterlockedXor64_rel) -#pragma intrinsic (_InterlockedAnd) -#pragma intrinsic (_InterlockedAnd_acq) -#pragma intrinsic (_InterlockedAnd_rel) -#pragma intrinsic (_InterlockedAnd8) -#pragma intrinsic (_InterlockedAnd8_acq) -#pragma intrinsic (_InterlockedAnd8_rel) -#pragma intrinsic (_InterlockedAnd16) -#pragma intrinsic (_InterlockedAnd16_acq) -#pragma intrinsic (_InterlockedAnd16_rel) -#pragma intrinsic (_InterlockedAnd64) -#pragma intrinsic (_InterlockedAnd64_acq) -#pragma intrinsic (_InterlockedAnd64_rel) - -#if !defined (InterlockedAnd64) - -#define InterlockedAnd64 InterlockedAnd64_Inline - -LONGLONG -FORCEINLINE -InterlockedAnd64_Inline ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Destination; - } while (InterlockedCompareExchange64(Destination, - Old & Value, - Old) != Old); - - return Old; -} - -#endif - -#define InterlockedAndAffinity InterlockedAnd64 - -#if !defined (InterlockedOr64) - -#define InterlockedOr64 InterlockedOr64_Inline - -LONGLONG -FORCEINLINE -InterlockedOr64_Inline ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Destination; - } while (InterlockedCompareExchange64(Destination, - Old | Value, - Old) != Old); - - return Old; -} - -#endif - -#define InterlockedOrAffinity InterlockedOr64 - -#if !defined (InterlockedXor64) - -#define InterlockedXor64 InterlockedXor64_Inline - -LONGLONG -FORCEINLINE -InterlockedXor64_Inline ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG Value - ) -{ - LONGLONG Old; - - do { - Old = *Destination; - } while (InterlockedCompareExchange64(Destination, - Old ^ Value, - Old) != Old); - - return Old; -} - -#endif - -#if !defined (InterlockedBitTestAndSet) - -#define InterlockedBitTestAndSet InterlockedBitTestAndSet_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndSet_Inline ( - __inout __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - LONG tBit; - - tBit = 1<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedOr (&Base[Bit/(sizeof (*Base)*8)], tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndReset) - -#define InterlockedBitTestAndReset InterlockedBitTestAndReset_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndReset_Inline ( - __inout __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - LONG tBit; - - tBit = 1<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedAnd (&Base[Bit/(sizeof (*Base)*8)], ~tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndSet64) - -#define InterlockedBitTestAndSet64 InterlockedBitTestAndSet64_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndSet64_Inline ( - __inout __drv_interlocked LONG64 volatile *Base, - __in LONG64 Bit - ) -{ - LONG64 tBit; - - tBit = 1i64<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedOr64 (&Base[Bit/(sizeof (*Base)*8)], tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndReset64) - -#define InterlockedBitTestAndReset64 InterlockedBitTestAndReset64_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndReset64_Inline ( - __inout __drv_interlocked LONG64 volatile *Base, - __in LONG64 Bit - ) -{ - LONG64 tBit; - - tBit = 1i64<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedAnd64 (&Base[Bit/(sizeof (*Base)*8)], ~tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndComplement) - -#define InterlockedBitTestAndComplement InterlockedBitTestAndComplement_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndComplement_Inline ( - __inout __drv_interlocked LONG volatile *Base, - __in LONG Bit - ) -{ - LONG tBit; - - tBit = 1<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedXor (&Base[Bit/(sizeof (*Base)*8)], tBit)&tBit) != 0); -} - -#endif - -#if !defined (InterlockedBitTestAndComplement64) - -#define InterlockedBitTestAndComplement64 InterlockedBitTestAndComplement64_Inline - -BOOLEAN -FORCEINLINE -InterlockedBitTestAndComplement64_Inline ( - __inout __drv_interlocked LONG64 volatile *Base, - __in LONG64 Bit - ) -{ - LONG64 tBit; - - tBit = 1i64<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN) ((InterlockedXor64 (&Base[Bit/(sizeof (*Base)*8)], tBit)&tBit) != 0); -} - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* defined(_M_IA64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) */ - - -#if defined(_IA64_) && defined(_M_IA64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -void -__break( - __in int StIIM - ); - -#pragma intrinsic (__break) - -#define BREAK_DEBUG_BASE 0x080000 -#define ASSERT_BREAKPOINT (BREAK_DEBUG_BASE+3) // Cause a STATUS_ASSERTION_FAILURE exception to be raised. - -__analysis_noreturn -FORCEINLINE -VOID -DbgRaiseAssertionFailure ( - VOID - ) - -{ - __break(ASSERT_BREAKPOINT); -} - -#endif - -#endif // _IA64_ -// -// Define an access token from a programmer's viewpoint. The structure is -// completely opaque and the programer is only allowed to have pointers -// to tokens. -// - -typedef PVOID PACCESS_TOKEN; - -// -// Pointer to a SECURITY_DESCRIPTOR opaque data type. -// - -typedef PVOID PSECURITY_DESCRIPTOR; - -// -// Define a pointer to the Security ID data type (an opaque data type) -// - -typedef PVOID PSID; - -typedef ULONG ACCESS_MASK; -typedef ACCESS_MASK *PACCESS_MASK; - - -// -// The following are masks for the predefined standard access types -// - -#define DELETE (0x00010000L) -#define READ_CONTROL (0x00020000L) -#define WRITE_DAC (0x00040000L) -#define WRITE_OWNER (0x00080000L) -#define SYNCHRONIZE (0x00100000L) - -#define STANDARD_RIGHTS_REQUIRED (0x000F0000L) - -#define STANDARD_RIGHTS_READ (READ_CONTROL) -#define STANDARD_RIGHTS_WRITE (READ_CONTROL) -#define STANDARD_RIGHTS_EXECUTE (READ_CONTROL) - -#define STANDARD_RIGHTS_ALL (0x001F0000L) - -#define SPECIFIC_RIGHTS_ALL (0x0000FFFFL) - -// -// AccessSystemAcl access type -// - -#define ACCESS_SYSTEM_SECURITY (0x01000000L) - -// -// MaximumAllowed access type -// - -#define MAXIMUM_ALLOWED (0x02000000L) - -// -// These are the generic rights. -// - -#define GENERIC_READ (0x80000000L) -#define GENERIC_WRITE (0x40000000L) -#define GENERIC_EXECUTE (0x20000000L) -#define GENERIC_ALL (0x10000000L) - - -// -// Define the generic mapping array. This is used to denote the -// mapping of each generic access right to a specific access mask. -// - -typedef struct _GENERIC_MAPPING { - ACCESS_MASK GenericRead; - ACCESS_MASK GenericWrite; - ACCESS_MASK GenericExecute; - ACCESS_MASK GenericAll; -} GENERIC_MAPPING; -typedef GENERIC_MAPPING *PGENERIC_MAPPING; - - - -//////////////////////////////////////////////////////////////////////// -// // -// LUID_AND_ATTRIBUTES // -// // -//////////////////////////////////////////////////////////////////////// -// -// - - -#include - -typedef struct _LUID_AND_ATTRIBUTES { - LUID Luid; - ULONG Attributes; - } LUID_AND_ATTRIBUTES, * PLUID_AND_ATTRIBUTES; -typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; -typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY; - -#include - -// This is the *current* ACL revision - -#define ACL_REVISION (2) -#define ACL_REVISION_DS (4) - -// This is the history of ACL revisions. Add a new one whenever -// ACL_REVISION is updated - -#define ACL_REVISION1 (1) -#define MIN_ACL_REVISION ACL_REVISION2 -#define ACL_REVISION2 (2) -#define ACL_REVISION3 (3) -#define ACL_REVISION4 (4) -#define MAX_ACL_REVISION ACL_REVISION4 - -typedef struct _ACL { - UCHAR AclRevision; - UCHAR Sbz1; - USHORT AclSize; - USHORT AceCount; - USHORT Sbz2; -} ACL; -typedef ACL *PACL; - -// -// Current security descriptor revision value -// - -#define SECURITY_DESCRIPTOR_REVISION (1) -#define SECURITY_DESCRIPTOR_REVISION1 (1) - -// -// Privilege attributes -// - -#define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x00000001L) -#define SE_PRIVILEGE_ENABLED (0x00000002L) -#define SE_PRIVILEGE_REMOVED (0X00000004L) -#define SE_PRIVILEGE_USED_FOR_ACCESS (0x80000000L) - -#define SE_PRIVILEGE_VALID_ATTRIBUTES (SE_PRIVILEGE_ENABLED_BY_DEFAULT | \ - SE_PRIVILEGE_ENABLED | \ - SE_PRIVILEGE_REMOVED | \ - SE_PRIVILEGE_USED_FOR_ACCESS) - - -// -// Privilege Set Control flags -// - -#define PRIVILEGE_SET_ALL_NECESSARY (1) - -// -// Privilege Set - This is defined for a privilege set of one. -// If more than one privilege is needed, then this structure -// will need to be allocated with more space. -// -// Note: don't change this structure without fixing the INITIAL_PRIVILEGE_SET -// structure (defined in se.h) -// - -typedef struct _PRIVILEGE_SET { - ULONG PrivilegeCount; - ULONG Control; - LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]; - } PRIVILEGE_SET, * PPRIVILEGE_SET; - - -// -// These must be converted to LUIDs before use. -// - -#define SE_MIN_WELL_KNOWN_PRIVILEGE (2L) -#define SE_CREATE_TOKEN_PRIVILEGE (2L) -#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE (3L) -#define SE_LOCK_MEMORY_PRIVILEGE (4L) -#define SE_INCREASE_QUOTA_PRIVILEGE (5L) - -#define SE_MACHINE_ACCOUNT_PRIVILEGE (6L) -#define SE_TCB_PRIVILEGE (7L) -#define SE_SECURITY_PRIVILEGE (8L) -#define SE_TAKE_OWNERSHIP_PRIVILEGE (9L) -#define SE_LOAD_DRIVER_PRIVILEGE (10L) -#define SE_SYSTEM_PROFILE_PRIVILEGE (11L) -#define SE_SYSTEMTIME_PRIVILEGE (12L) -#define SE_PROF_SINGLE_PROCESS_PRIVILEGE (13L) -#define SE_INC_BASE_PRIORITY_PRIVILEGE (14L) -#define SE_CREATE_PAGEFILE_PRIVILEGE (15L) -#define SE_CREATE_PERMANENT_PRIVILEGE (16L) -#define SE_BACKUP_PRIVILEGE (17L) -#define SE_RESTORE_PRIVILEGE (18L) -#define SE_SHUTDOWN_PRIVILEGE (19L) -#define SE_DEBUG_PRIVILEGE (20L) -#define SE_AUDIT_PRIVILEGE (21L) -#define SE_SYSTEM_ENVIRONMENT_PRIVILEGE (22L) -#define SE_CHANGE_NOTIFY_PRIVILEGE (23L) -#define SE_REMOTE_SHUTDOWN_PRIVILEGE (24L) -#define SE_UNDOCK_PRIVILEGE (25L) -#define SE_SYNC_AGENT_PRIVILEGE (26L) -#define SE_ENABLE_DELEGATION_PRIVILEGE (27L) -#define SE_MANAGE_VOLUME_PRIVILEGE (28L) -#define SE_IMPERSONATE_PRIVILEGE (29L) -#define SE_CREATE_GLOBAL_PRIVILEGE (30L) -#define SE_TRUSTED_CREDMAN_ACCESS_PRIVILEGE (31L) -#define SE_RELABEL_PRIVILEGE (32L) -#define SE_INC_WORKING_SET_PRIVILEGE (33L) -#define SE_TIME_ZONE_PRIVILEGE (34L) -#define SE_CREATE_SYMBOLIC_LINK_PRIVILEGE (35L) -#define SE_MAX_WELL_KNOWN_PRIVILEGE (SE_CREATE_SYMBOLIC_LINK_PRIVILEGE) - -// -// Impersonation Level -// -// Impersonation level is represented by a pair of bits in Windows. -// If a new impersonation level is added or lowest value is changed from -// 0 to something else, fix the Windows CreateFile call. -// - -typedef enum _SECURITY_IMPERSONATION_LEVEL { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } SECURITY_IMPERSONATION_LEVEL, * PSECURITY_IMPERSONATION_LEVEL; - -#define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation -#define SECURITY_MIN_IMPERSONATION_LEVEL SecurityAnonymous -#define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation -#define VALID_IMPERSONATION_LEVEL(L) (((L) >= SECURITY_MIN_IMPERSONATION_LEVEL) && ((L) <= SECURITY_MAX_IMPERSONATION_LEVEL)) -// -// Security Tracking Mode -// - -#define SECURITY_DYNAMIC_TRACKING (TRUE) -#define SECURITY_STATIC_TRACKING (FALSE) - -typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE, - * PSECURITY_CONTEXT_TRACKING_MODE; - - - -// -// Quality Of Service -// - -typedef struct _SECURITY_QUALITY_OF_SERVICE { - ULONG Length; - SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; - SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode; - BOOLEAN EffectiveOnly; - } SECURITY_QUALITY_OF_SERVICE, * PSECURITY_QUALITY_OF_SERVICE; - - -// -// Used to represent information related to a thread impersonation -// - -typedef struct _SE_IMPERSONATION_STATE { - PACCESS_TOKEN Token; - BOOLEAN CopyOnOpen; - BOOLEAN EffectiveOnly; - SECURITY_IMPERSONATION_LEVEL Level; -} SE_IMPERSONATION_STATE, *PSE_IMPERSONATION_STATE; - - -typedef ULONG SECURITY_INFORMATION, *PSECURITY_INFORMATION; - -#define OWNER_SECURITY_INFORMATION (0x00000001L) -#define GROUP_SECURITY_INFORMATION (0x00000002L) -#define DACL_SECURITY_INFORMATION (0x00000004L) -#define SACL_SECURITY_INFORMATION (0x00000008L) -#define LABEL_SECURITY_INFORMATION (0x00000010L) - -#define PROTECTED_DACL_SECURITY_INFORMATION (0x80000000L) -#define PROTECTED_SACL_SECURITY_INFORMATION (0x40000000L) -#define UNPROTECTED_DACL_SECURITY_INFORMATION (0x20000000L) -#define UNPROTECTED_SACL_SECURITY_INFORMATION (0x10000000L) - - -#ifndef _NTLSA_IFS_ - - -// -// All of this stuff (between the Ifndef _NTLSA_AUDIT_ and its endif) were not -// present in NTIFS prior to Windows Server 2003 SP1. All of the definitions however -// exist down to windows 2000 (except for the few exceptions noted in the code). -// - -#ifndef _NTLSA_AUDIT_ -#define _NTLSA_AUDIT_ - -///////////////////////////////////////////////////////////////////////// -// // -// Data types related to Auditing // -// // -///////////////////////////////////////////////////////////////////////// - - -// -// The following enumerated type is used between the reference monitor and -// LSA in the generation of audit messages. It is used to indicate the -// type of data being passed as a parameter from the reference monitor -// to LSA. LSA is responsible for transforming the specified data type -// into a set of unicode strings that are added to the event record in -// the audit log. -// - -typedef enum _SE_ADT_PARAMETER_TYPE { - - SeAdtParmTypeNone = 0, //Produces 1 parameter - //Received value: - // - // None. - // - //Results in: - // - // a unicode string containing "-". - // - //Note: This is typically used to - // indicate that a parameter value - // was not available. - // - - SeAdtParmTypeString, //Produces 1 parameter. - //Received Value: - // - // Unicode String (variable length) - // - //Results in: - // - // No transformation. The string - // entered into the event record as - // received. - // - // The Address value of the audit info - // should be a pointer to a UNICODE_STRING - // structure. - - - - SeAdtParmTypeFileSpec, //Produces 1 parameter. - //Received value: - // - // Unicode string containing a file or - // directory name. - // - //Results in: - // - // Unicode string with the prefix of the - // file's path replaced by a drive letter - // if possible. - // - - - - - SeAdtParmTypeUlong, //Produces 1 parameter - //Received value: - // - // Ulong - // - //Results in: - // - // Unicode string representation of - // unsigned integer value. - - - SeAdtParmTypeSid, //Produces 1 parameter. - //Received value: - // - // SID (variable length) - // - //Results in: - // - // String representation of SID - // - - - - - SeAdtParmTypeLogonId, //Produces 4 parameters. - //Received Value: - // - // LUID (fixed length) - // - //Results in: - // - // param 1: Sid string - // param 2: Username string - // param 3: domain name string - // param 4: Logon ID (Luid) string - - - SeAdtParmTypeNoLogonId, //Produces 3 parameters. - //Received value: - // - // None. - // - //Results in: - // - // param 1: "-" - // param 2: "-" - // param 3: "-" - // param 4: "-" - // - //Note: - // - // This type is used when a logon ID - // is needed, but one is not available - // to pass. For example, if an - // impersonation logon ID is expected - // but the subject is not impersonating - // anyone. - // - - SeAdtParmTypeAccessMask, //Produces 1 parameter with formatting. - //Received value: - // - // ACCESS_MASK followed by - // a Unicode string. The unicode - // string contains the name of the - // type of object the access mask - // applies to. The event's source - // further qualifies the object type. - // - //Results in: - // - // formatted unicode string built to - // take advantage of the specified - // source's parameter message file. - // - //Note: - // - // An access mask containing three - // access types for a Widget object - // type (defined by the Foozle source) - // might end up looking like: - // - // %%1062\n\t\t%1066\n\t\t%%601 - // - // The %%numbers are signals to the - // event viewer to perform parameter - // substitution before display. - // - - - - SeAdtParmTypePrivs, //Produces 1 parameter with formatting. - //Received value: - // - //Results in: - // - // formatted unicode string similar to - // that for access types. Each priv - // will be formatted to be displayed - // on its own line. E.g., - // - // %%642\n\t\t%%651\n\t\t%%655 - // - - SeAdtParmTypeObjectTypes, //Produces 10 parameters with formatting. - //Received value: - // - // Produces a list a stringized GUIDS along - // with information similar to that for - // an access mask. - - SeAdtParmTypeHexUlong, //Produces 1 parameter - //Received value: - // - // Ulong - // - //Results in: - // - // Unicode string representation of - // unsigned integer value in hexadecimal. - -// In W2k this value did not exist, it was ParmTypeLUID - - SeAdtParmTypePtr, //Produces 1 parameter - //Received value: - // - // pointer - // - //Results in: - // - // Unicode string representation of - // unsigned integer value in hexadecimal. - -// -// Everything below exists only in Windows XP and greater -// - - SeAdtParmTypeTime, //Produces 2 parameters - //Received value: - // - // LARGE_INTEGER - // - //Results in: - // - // Unicode string representation of - // date and time. - - // - SeAdtParmTypeGuid, //Produces 1 parameter - //Received value: - // - // GUID pointer - // - //Results in: - // - // Unicode string representation of GUID - // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - // - -// -// Everything below exists only in Windows Server 2003 and Greater -// - - SeAdtParmTypeLuid, // - //Produces 1 parameter - //Received value: - // - // LUID - // - //Results in: - // - // Hex LUID - // - - SeAdtParmTypeHexInt64, //Produces 1 parameter - //Received value: - // - // 64 bit integer - // - //Results in: - // - // Unicode string representation of - // unsigned integer value in hexadecimal. - - SeAdtParmTypeStringList, //Produces 1 parameter - //Received value: - // - // ptr to LSAP_ADT_STRING_LIST - // - //Results in: - // - // Unicode string representation of - // concatenation of the strings in the list - - SeAdtParmTypeSidList, //Produces 1 parameter - //Received value: - // - // ptr to LSAP_ADT_SID_LIST - // - //Results in: - // - // Unicode string representation of - // concatenation of the SIDs in the list - - SeAdtParmTypeDuration, //Produces 1 parameters - //Received value: - // - // LARGE_INTEGER - // - //Results in: - // - // Unicode string representation of - // a duration. - - SeAdtParmTypeUserAccountControl,//Produces 3 parameters - //Received value: - // - // old and new UserAccountControl values - // - //Results in: - // - // Unicode string representations of - // the flags in UserAccountControl. - // 1 - old value in hex - // 2 - new value in hex - // 3 - difference as strings - - SeAdtParmTypeNoUac, //Produces 3 parameters - //Received value: - // - // none - // - //Results in: - // - // Three dashes ('-') as unicode strings. - - SeAdtParmTypeMessage, //Produces 1 Parameter - //Received value: - // - // ULONG (MessageNo from msobjs.mc) - // - //Results in: - // - // Unicode string representation of - // %%MessageNo which the event viewer - // will replace with the message string - // from msobjs.mc - - SeAdtParmTypeDateTime, //Produces 1 Parameter - //Received value: - // - // LARGE_INTEGER - // - //Results in: - // - // Unicode string representation of - // date and time (in _one_ string). - - SeAdtParmTypeSockAddr, // Produces 2 parameters - // - // Received value: - // - // pointer to SOCKADDR_IN/SOCKADDR_IN6 - // structure - // - // Results in: - // - // param 1: IP address string - // param 2: Port number string - // - -// -// Everything below this exists only in Windows Server 2008 and greater -// - - SeAdtParmTypeSD, // Produces 1 parameters - // - // Received value: - // - // pointer to SECURITY_DESCRIPTOR - // structure - // - // Results in: - // - // SDDL string representation of SD - // - - SeAdtParmTypeLogonHours, // Produces 1 parameters - // - // Received value: - // - // pointer to LOGON_HOURS - // structure - // - // Results in: - // - // String representation of allowed logon hours - // - - SeAdtParmTypeLogonIdNoSid, //Produces 3 parameters. - //Received Value: - // - // LUID (fixed length) - // - //Results in: - // - // param 1: Username string - // param 2: domain name string - // param 3: Logon ID (Luid) string - - SeAdtParmTypeUlongNoConv, // Produces 1 parameter. - // Received Value: - // Ulong - // - //Results in: - // Not converted to string - // - - SeAdtParmTypeSockAddrNoPort, // Produces 1 parameter - // - // Received value: - // - // pointer to SOCKADDR_IN/SOCKADDR_IN6 - // structure - // - // Results in: - // - // param 1: IPv4/IPv6 address string - // -// -// Everything below this exists only in Windows Server 2008 and greater -// - - SeAdtParmTypeAccessReason // Produces 1 parameters - // - // Received value: - // - // pointer to SECURITY_DESCRIPTOR - // structure followed by the reason code. - // The reason code could be the index - // of the ACE in the SD or privilege ID or - // other reason codes. - // - // Results in: - // - // String representation of the access reason. - // - -} SE_ADT_PARAMETER_TYPE, *PSE_ADT_PARAMETER_TYPE; - -#ifndef GUID_DEFINED -#include -#endif /* GUID_DEFINED */ - -typedef struct _SE_ADT_OBJECT_TYPE { - GUID ObjectType; - USHORT Flags; -#define SE_ADT_OBJECT_ONLY 0x1 - USHORT Level; - ACCESS_MASK AccessMask; -} SE_ADT_OBJECT_TYPE, *PSE_ADT_OBJECT_TYPE; - -typedef struct _SE_ADT_PARAMETER_ARRAY_ENTRY { - - SE_ADT_PARAMETER_TYPE Type; - ULONG Length; - ULONG_PTR Data[2]; - PVOID Address; - -} SE_ADT_PARAMETER_ARRAY_ENTRY, *PSE_ADT_PARAMETER_ARRAY_ENTRY; - - -typedef struct _SE_ADT_ACCESS_REASON{ - ACCESS_MASK AccessMask; - ULONG AccessReasons[32]; - ULONG ObjectTypeIndex; - ULONG AccessGranted; - PSECURITY_DESCRIPTOR SecurityDescriptor; // multple SDs may be stored here in self-relative way. -} SE_ADT_ACCESS_REASON, *PSE_ADT_ACCESS_REASON; - - - -// -// Structure that will be passed between the Reference Monitor and LSA -// to transmit auditing information. -// - -#define SE_MAX_AUDIT_PARAMETERS 32 -#define SE_MAX_GENERIC_AUDIT_PARAMETERS 28 - -typedef struct _SE_ADT_PARAMETER_ARRAY { - - ULONG CategoryId; - ULONG AuditId; - ULONG ParameterCount; - ULONG Length; - USHORT FlatSubCategoryId; - USHORT Type; - ULONG Flags; - SE_ADT_PARAMETER_ARRAY_ENTRY Parameters[ SE_MAX_AUDIT_PARAMETERS ]; - -} SE_ADT_PARAMETER_ARRAY, *PSE_ADT_PARAMETER_ARRAY; - - -#define SE_ADT_PARAMETERS_SELF_RELATIVE 0x00000001 -#define SE_ADT_PARAMETERS_SEND_TO_LSA 0x00000002 -#define SE_ADT_PARAMETER_EXTENSIBLE_AUDIT 0x00000004 -#define SE_ADT_PARAMETER_GENERIC_AUDIT 0x00000008 -#define SE_ADT_PARAMETER_WRITE_SYNCHRONOUS 0x00000010 - - -// -// This macro only existed in Windows Server 2008 and after -// - -#define LSAP_SE_ADT_PARAMETER_ARRAY_TRUE_SIZE(AuditParameters) \ - ( sizeof(SE_ADT_PARAMETER_ARRAY) - \ - sizeof(SE_ADT_PARAMETER_ARRAY_ENTRY) * \ - (SE_MAX_AUDIT_PARAMETERS - AuditParameters->ParameterCount) ) - -#endif // _NTLSA_AUDIT_ - - -#endif // _NTLSA_IFS_ - -// -// Define the various device type values. Note that values used by Microsoft -// Corporation are in the range 0-32767, and 32768-65535 are reserved for use -// by customers. -// - -#define DEVICE_TYPE ULONG - -#define FILE_DEVICE_BEEP 0x00000001 -#define FILE_DEVICE_CD_ROM 0x00000002 -#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 -#define FILE_DEVICE_CONTROLLER 0x00000004 -#define FILE_DEVICE_DATALINK 0x00000005 -#define FILE_DEVICE_DFS 0x00000006 -#define FILE_DEVICE_DISK 0x00000007 -#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 -#define FILE_DEVICE_FILE_SYSTEM 0x00000009 -#define FILE_DEVICE_INPORT_PORT 0x0000000a -#define FILE_DEVICE_KEYBOARD 0x0000000b -#define FILE_DEVICE_MAILSLOT 0x0000000c -#define FILE_DEVICE_MIDI_IN 0x0000000d -#define FILE_DEVICE_MIDI_OUT 0x0000000e -#define FILE_DEVICE_MOUSE 0x0000000f -#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 -#define FILE_DEVICE_NAMED_PIPE 0x00000011 -#define FILE_DEVICE_NETWORK 0x00000012 -#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 -#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 -#define FILE_DEVICE_NULL 0x00000015 -#define FILE_DEVICE_PARALLEL_PORT 0x00000016 -#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 -#define FILE_DEVICE_PRINTER 0x00000018 -#define FILE_DEVICE_SCANNER 0x00000019 -#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a -#define FILE_DEVICE_SERIAL_PORT 0x0000001b -#define FILE_DEVICE_SCREEN 0x0000001c -#define FILE_DEVICE_SOUND 0x0000001d -#define FILE_DEVICE_STREAMS 0x0000001e -#define FILE_DEVICE_TAPE 0x0000001f -#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 -#define FILE_DEVICE_TRANSPORT 0x00000021 -#define FILE_DEVICE_UNKNOWN 0x00000022 -#define FILE_DEVICE_VIDEO 0x00000023 -#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 -#define FILE_DEVICE_WAVE_IN 0x00000025 -#define FILE_DEVICE_WAVE_OUT 0x00000026 -#define FILE_DEVICE_8042_PORT 0x00000027 -#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 -#define FILE_DEVICE_BATTERY 0x00000029 -#define FILE_DEVICE_BUS_EXTENDER 0x0000002a -#define FILE_DEVICE_MODEM 0x0000002b -#define FILE_DEVICE_VDM 0x0000002c -#define FILE_DEVICE_MASS_STORAGE 0x0000002d -#define FILE_DEVICE_SMB 0x0000002e -#define FILE_DEVICE_KS 0x0000002f -#define FILE_DEVICE_CHANGER 0x00000030 -#define FILE_DEVICE_SMARTCARD 0x00000031 -#define FILE_DEVICE_ACPI 0x00000032 -#define FILE_DEVICE_DVD 0x00000033 -#define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034 -#define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035 -#define FILE_DEVICE_DFS_VOLUME 0x00000036 -#define FILE_DEVICE_SERENUM 0x00000037 -#define FILE_DEVICE_TERMSRV 0x00000038 -#define FILE_DEVICE_KSEC 0x00000039 -#define FILE_DEVICE_FIPS 0x0000003A -#define FILE_DEVICE_INFINIBAND 0x0000003B -#define FILE_DEVICE_VMBUS 0x0000003E -#define FILE_DEVICE_CRYPT_PROVIDER 0x0000003F -#define FILE_DEVICE_WPD 0x00000040 -#define FILE_DEVICE_BLUETOOTH 0x00000041 -#define FILE_DEVICE_MT_COMPOSITE 0x00000042 -#define FILE_DEVICE_MT_TRANSPORT 0x00000043 -#define FILE_DEVICE_BIOMETRIC 0x00000044 -#define FILE_DEVICE_PMI 0x00000045 - -// -// 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) \ -) - -// -// Macro to extract device type out of the device io control code -// -#define DEVICE_TYPE_FROM_CTL_CODE(ctrlCode) (((ULONG)(ctrlCode & 0xffff0000)) >> 16) - -// -// Macro to extract buffering method out of the device io control code -// -#define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3)) - -// -// 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 some easier to comprehend aliases: -// METHOD_DIRECT_TO_HARDWARE (writes, aka METHOD_IN_DIRECT) -// METHOD_DIRECT_FROM_HARDWARE (reads, aka METHOD_OUT_DIRECT) -// - -#define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT -#define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT - -// -// 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. -// -// -// FILE_SPECIAL_ACCESS is checked by the NT I/O system the same as FILE_ANY_ACCESS. -// The file systems, however, may add additional access checks for I/O and FS controls -// that use this value. -// - - -#define FILE_ANY_ACCESS 0 -#define FILE_SPECIAL_ACCESS (FILE_ANY_ACCESS) -#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe -#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe - - - -// -// Define access rights to files and directories -// - -// -// The FILE_READ_DATA and FILE_WRITE_DATA constants are also defined in -// devioctl.h as FILE_READ_ACCESS and FILE_WRITE_ACCESS. The values for these -// constants *MUST* always be in sync. -// The values are redefined in devioctl.h because they must be available to -// both DOS and NT. -// - -#define FILE_READ_DATA ( 0x0001 ) // file & pipe -#define FILE_LIST_DIRECTORY ( 0x0001 ) // directory - -#define FILE_WRITE_DATA ( 0x0002 ) // file & pipe -#define FILE_ADD_FILE ( 0x0002 ) // directory - -#define FILE_APPEND_DATA ( 0x0004 ) // file -#define FILE_ADD_SUBDIRECTORY ( 0x0004 ) // directory -#define FILE_CREATE_PIPE_INSTANCE ( 0x0004 ) // named pipe - - -#define FILE_READ_EA ( 0x0008 ) // file & directory - -#define FILE_WRITE_EA ( 0x0010 ) // file & directory - -#define FILE_EXECUTE ( 0x0020 ) // file -#define FILE_TRAVERSE ( 0x0020 ) // directory - -#define FILE_DELETE_CHILD ( 0x0040 ) // directory - -#define FILE_READ_ATTRIBUTES ( 0x0080 ) // all - -#define FILE_WRITE_ATTRIBUTES ( 0x0100 ) // all - -#define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF) - -#define FILE_GENERIC_READ (STANDARD_RIGHTS_READ |\ - FILE_READ_DATA |\ - FILE_READ_ATTRIBUTES |\ - FILE_READ_EA |\ - SYNCHRONIZE) - - -#define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE |\ - FILE_WRITE_DATA |\ - FILE_WRITE_ATTRIBUTES |\ - FILE_WRITE_EA |\ - FILE_APPEND_DATA |\ - SYNCHRONIZE) - - -#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ - FILE_READ_ATTRIBUTES |\ - FILE_EXECUTE |\ - SYNCHRONIZE) - - - - -// -// Define share access rights to files and directories -// - -#define FILE_SHARE_READ 0x00000001 -#define FILE_SHARE_WRITE 0x00000002 -#define FILE_SHARE_DELETE 0x00000004 -#define FILE_SHARE_VALID_FLAGS 0x00000007 - -// -// Define the file attributes values -// -// Note: 0x00000008 is reserved for use for the old DOS VOLID (volume ID) -// and is therefore not considered valid in NT. -// -// Note: Note also that the order of these flags is set to allow both the -// FAT and the Pinball File Systems to directly set the attributes -// flags in attributes words without having to pick each flag out -// individually. The order of these flags should not be changed! -// - -#define FILE_ATTRIBUTE_READONLY 0x00000001 -#define FILE_ATTRIBUTE_HIDDEN 0x00000002 -#define FILE_ATTRIBUTE_SYSTEM 0x00000004 -//OLD DOS VOLID 0x00000008 - -#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 -#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 -#define FILE_ATTRIBUTE_DEVICE 0x00000040 -#define FILE_ATTRIBUTE_NORMAL 0x00000080 - -#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 -#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 -#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 -#define FILE_ATTRIBUTE_COMPRESSED 0x00000800 - -#define FILE_ATTRIBUTE_OFFLINE 0x00001000 -#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 -#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 - -#define FILE_ATTRIBUTE_VIRTUAL 0x00010000 - -#define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7 -#define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7 - -// -// Define the create disposition values -// - -#define FILE_SUPERSEDE 0x00000000 -#define FILE_OPEN 0x00000001 -#define FILE_CREATE 0x00000002 -#define FILE_OPEN_IF 0x00000003 -#define FILE_OVERWRITE 0x00000004 -#define FILE_OVERWRITE_IF 0x00000005 -#define FILE_MAXIMUM_DISPOSITION 0x00000005 - -// -// Define the create/open option flags -// - -#define FILE_DIRECTORY_FILE 0x00000001 -#define FILE_WRITE_THROUGH 0x00000002 -#define FILE_SEQUENTIAL_ONLY 0x00000004 -#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008 - -#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010 -#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020 -#define FILE_NON_DIRECTORY_FILE 0x00000040 -#define FILE_CREATE_TREE_CONNECTION 0x00000080 - -#define FILE_COMPLETE_IF_OPLOCKED 0x00000100 -#define FILE_NO_EA_KNOWLEDGE 0x00000200 -#define FILE_OPEN_REMOTE_INSTANCE 0x00000400 -#define FILE_RANDOM_ACCESS 0x00000800 - -#define FILE_DELETE_ON_CLOSE 0x00001000 -#define FILE_OPEN_BY_FILE_ID 0x00002000 -#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000 -#define FILE_NO_COMPRESSION 0x00008000 - -#if (NTDDI_VERSION >= NTDDI_WIN7) -#define FILE_OPEN_REQUIRING_OPLOCK 0x00010000 -#define FILE_DISALLOW_EXCLUSIVE 0x00020000 -#endif /* NTDDI_VERSION >= NTDDI_WIN7 */ - -#define FILE_RESERVE_OPFILTER 0x00100000 -#define FILE_OPEN_REPARSE_POINT 0x00200000 -#define FILE_OPEN_NO_RECALL 0x00400000 -#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000 - - -#define FILE_VALID_OPTION_FLAGS 0x00ffffff -#define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032 -#define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032 -#define FILE_VALID_SET_FLAGS 0x00000036 - -// -// Define the I/O status information return values for NtCreateFile/NtOpenFile -// - -#define FILE_SUPERSEDED 0x00000000 -#define FILE_OPENED 0x00000001 -#define FILE_CREATED 0x00000002 -#define FILE_OVERWRITTEN 0x00000003 -#define FILE_EXISTS 0x00000004 -#define FILE_DOES_NOT_EXIST 0x00000005 - -// -// Define special ByteOffset parameters for read and write operations -// - -#define FILE_WRITE_TO_END_OF_FILE 0xffffffff -#define FILE_USE_FILE_POINTER_POSITION 0xfffffffe - -// -// Define alignment requirement values -// - -#define FILE_BYTE_ALIGNMENT 0x00000000 -#define FILE_WORD_ALIGNMENT 0x00000001 -#define FILE_LONG_ALIGNMENT 0x00000003 -#define FILE_QUAD_ALIGNMENT 0x00000007 -#define FILE_OCTA_ALIGNMENT 0x0000000f -#define FILE_32_BYTE_ALIGNMENT 0x0000001f -#define FILE_64_BYTE_ALIGNMENT 0x0000003f -#define FILE_128_BYTE_ALIGNMENT 0x0000007f -#define FILE_256_BYTE_ALIGNMENT 0x000000ff -#define FILE_512_BYTE_ALIGNMENT 0x000001ff - -// -// Define the maximum length of a filename string -// - -#define MAXIMUM_FILENAME_LENGTH 256 - -// -// Define the various device characteristics flags -// - -#define FILE_REMOVABLE_MEDIA 0x00000001 -#define FILE_READ_ONLY_DEVICE 0x00000002 -#define FILE_FLOPPY_DISKETTE 0x00000004 -#define FILE_WRITE_ONCE_MEDIA 0x00000008 -#define FILE_REMOTE_DEVICE 0x00000010 -#define FILE_DEVICE_IS_MOUNTED 0x00000020 -#define FILE_VIRTUAL_VOLUME 0x00000040 -#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080 -#define FILE_DEVICE_SECURE_OPEN 0x00000100 -#define FILE_CHARACTERISTIC_PNP_DEVICE 0x00000800 -#define FILE_CHARACTERISTIC_TS_DEVICE 0x00001000 -#define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000 - -// -// Define the base asynchronous I/O argument types -// - -typedef struct _IO_STATUS_BLOCK { - union { - NTSTATUS Status; - PVOID Pointer; - } DUMMYUNIONNAME; - - ULONG_PTR Information; -} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; - -#if defined(_WIN64) - -typedef struct _IO_STATUS_BLOCK32 { - NTSTATUS Status; - ULONG Information; -} IO_STATUS_BLOCK32, *PIO_STATUS_BLOCK32; - -#endif - -// -// Define an Asynchronous Procedure Call from I/O viewpoint -// - -typedef -VOID -(NTAPI *PIO_APC_ROUTINE) ( - __in PVOID ApcContext, - __in PIO_STATUS_BLOCK IoStatusBlock, - __in ULONG Reserved - ); - -#define PIO_APC_ROUTINE_DEFINED - -// -// Define the session states and events -// -typedef enum _IO_SESSION_EVENT { - IoSessionEventIgnore = 0, - IoSessionEventCreated, // 1 - IoSessionEventTerminated, // 2 - IoSessionEventConnected, // 3 - IoSessionEventDisconnected, // 4 - IoSessionEventLogon, // 5 - IoSessionEventLogoff, // 6 - IoSessionEventMax -} IO_SESSION_EVENT, *PIO_SESSION_EVENT; - -typedef enum _IO_SESSION_STATE { - IoSessionStateCreated = 1, - IoSessionStateInitialized, // 2 - IoSessionStateConnected, // 3 - IoSessionStateDisconnected, // 4 - IoSessionStateDisconnectedLoggedOn, // 5 - IoSessionStateLoggedOn, // 6 - IoSessionStateLoggedOff, // 7 - IoSessionStateTerminated, // 8 - IoSessionStateMax -} IO_SESSION_STATE, *PIO_SESSION_STATE; - -// -// Define masks that determine which events a driver that registers for -// callbacks care about -// - -#define IO_SESSION_STATE_ALL_EVENTS 0xffffffff -#define IO_SESSION_STATE_CREATION_EVENT 0x00000001 -#define IO_SESSION_STATE_TERMINATION_EVENT 0x00000002 -#define IO_SESSION_STATE_CONNECT_EVENT 0x00000004 -#define IO_SESSION_STATE_DISCONNECT_EVENT 0x00000008 -#define IO_SESSION_STATE_LOGON_EVENT 0x00000010 -#define IO_SESSION_STATE_LOGOFF_EVENT 0x00000020 - -#define IO_SESSION_STATE_VALID_EVENT_MASK 0x0000003f - -#define IO_SESSION_MAX_PAYLOAD_SIZE 256L - -// -// Payload structures -// - -// IoSessionEventConnected -typedef struct _IO_SESSION_CONNECT_INFO { - ULONG SessionId; - BOOLEAN LocalSession; -} IO_SESSION_CONNECT_INFO, *PIO_SESSION_CONNECT_INFO; - - -// -// Define the file information class values -// -// WARNING: The order of the following values are assumed by the I/O system. -// Any changes made here should be reflected there as well. -// - -typedef enum _FILE_INFORMATION_CLASS { - FileDirectoryInformation = 1, - FileFullDirectoryInformation, // 2 - FileBothDirectoryInformation, // 3 - FileBasicInformation, // 4 - FileStandardInformation, // 5 - FileInternalInformation, // 6 - FileEaInformation, // 7 - FileAccessInformation, // 8 - FileNameInformation, // 9 - FileRenameInformation, // 10 - FileLinkInformation, // 11 - FileNamesInformation, // 12 - FileDispositionInformation, // 13 - FilePositionInformation, // 14 - FileFullEaInformation, // 15 - FileModeInformation, // 16 - FileAlignmentInformation, // 17 - FileAllInformation, // 18 - FileAllocationInformation, // 19 - FileEndOfFileInformation, // 20 - FileAlternateNameInformation, // 21 - FileStreamInformation, // 22 - FilePipeInformation, // 23 - FilePipeLocalInformation, // 24 - FilePipeRemoteInformation, // 25 - FileMailslotQueryInformation, // 26 - FileMailslotSetInformation, // 27 - FileCompressionInformation, // 28 - FileObjectIdInformation, // 29 - FileCompletionInformation, // 30 - FileMoveClusterInformation, // 31 - FileQuotaInformation, // 32 - FileReparsePointInformation, // 33 - FileNetworkOpenInformation, // 34 - FileAttributeTagInformation, // 35 - FileTrackingInformation, // 36 - FileIdBothDirectoryInformation, // 37 - FileIdFullDirectoryInformation, // 38 - FileValidDataLengthInformation, // 39 - FileShortNameInformation, // 40 - FileIoCompletionNotificationInformation, // 41 - FileIoStatusBlockRangeInformation, // 42 - FileIoPriorityHintInformation, // 43 - FileSfioReserveInformation, // 44 - FileSfioVolumeInformation, // 45 - FileHardLinkInformation, // 46 - FileProcessIdsUsingFileInformation, // 47 - FileNormalizedNameInformation, // 48 - FileNetworkPhysicalNameInformation, // 49 - FileIdGlobalTxDirectoryInformation, // 50 - FileIsRemoteDeviceInformation, // 51 - FileAttributeCacheInformation, // 52 - FileNumaNodeInformation, // 53 - FileStandardLinkInformation, // 54 - FileRemoteProtocolInformation, // 55 - FileMaximumInformation -} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; - -// -// Define the various structures which are returned on query operations -// - -typedef struct _FILE_BASIC_INFORMATION { - LARGE_INTEGER CreationTime; - LARGE_INTEGER LastAccessTime; - LARGE_INTEGER LastWriteTime; - LARGE_INTEGER ChangeTime; - ULONG FileAttributes; -} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION; - -typedef struct _FILE_STANDARD_INFORMATION { - LARGE_INTEGER AllocationSize; - LARGE_INTEGER EndOfFile; - ULONG NumberOfLinks; - BOOLEAN DeletePending; - BOOLEAN Directory; -} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION; - - -typedef struct _FILE_POSITION_INFORMATION { - LARGE_INTEGER CurrentByteOffset; -} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION; - - -typedef struct _FILE_NETWORK_OPEN_INFORMATION { - LARGE_INTEGER CreationTime; - LARGE_INTEGER LastAccessTime; - LARGE_INTEGER LastWriteTime; - LARGE_INTEGER ChangeTime; - LARGE_INTEGER AllocationSize; - LARGE_INTEGER EndOfFile; - ULONG FileAttributes; -} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION; - - - - - -typedef struct _FILE_FULL_EA_INFORMATION { - ULONG NextEntryOffset; - UCHAR Flags; - UCHAR EaNameLength; - USHORT EaValueLength; - CHAR EaName[1]; -} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION; - - -// -// Support to reserve bandwidth for a file handle. -// - -typedef struct _FILE_SFIO_RESERVE_INFORMATION { - ULONG RequestsPerPeriod; - ULONG Period; - BOOLEAN RetryFailures; - BOOLEAN Discardable; - ULONG RequestSize; - ULONG NumOutstandingRequests; -} FILE_SFIO_RESERVE_INFORMATION, *PFILE_SFIO_RESERVE_INFORMATION; - -// -// Support to query bandwidth properties of a volume. -// - -typedef struct _FILE_SFIO_VOLUME_INFORMATION { - ULONG MaximumRequestsPerPeriod; - ULONG MinimumPeriod; - ULONG MinimumTransferSize; -} FILE_SFIO_VOLUME_INFORMATION, *PFILE_SFIO_VOLUME_INFORMATION; - -// -// Support to set priority hints on a filehandle. -// - -typedef enum _IO_PRIORITY_HINT { - IoPriorityVeryLow = 0, // Defragging, content indexing and other background I/Os - IoPriorityLow, // Prefetching for applications. - IoPriorityNormal, // Normal I/Os - IoPriorityHigh, // Used by filesystems for checkpoint I/O - IoPriorityCritical, // Used by memory manager. Not available for applications. - MaxIoPriorityTypes -} IO_PRIORITY_HINT; - -typedef struct _FILE_IO_PRIORITY_HINT_INFORMATION { - IO_PRIORITY_HINT PriorityHint; -} FILE_IO_PRIORITY_HINT_INFORMATION, *PFILE_IO_PRIORITY_HINT_INFORMATION; - -// -// Don't queue an entry to an associated completion port if returning success -// synchronously. -// -#define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1 - -// -// Don't set the file handle event on IO completion. -// -#define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2 - -// -// Don't set user supplied event on successful fast-path IO completion. -// -#define FILE_SKIP_SET_USER_EVENT_ON_FAST_IO 0x4 - -typedef struct _FILE_IO_COMPLETION_NOTIFICATION_INFORMATION { - ULONG Flags; -} FILE_IO_COMPLETION_NOTIFICATION_INFORMATION, *PFILE_IO_COMPLETION_NOTIFICATION_INFORMATION; - -typedef struct _FILE_PROCESS_IDS_USING_FILE_INFORMATION { - ULONG NumberOfProcessIdsInList; - ULONG_PTR ProcessIdList[1]; -} FILE_PROCESS_IDS_USING_FILE_INFORMATION, *PFILE_PROCESS_IDS_USING_FILE_INFORMATION; - -typedef struct _FILE_IS_REMOTE_DEVICE_INFORMATION { - BOOLEAN IsRemote; -} FILE_IS_REMOTE_DEVICE_INFORMATION, *PFILE_IS_REMOTE_DEVICE_INFORMATION; - -typedef struct _FILE_NUMA_NODE_INFORMATION { - USHORT NodeNumber; -} FILE_NUMA_NODE_INFORMATION, *PFILE_NUMA_NODE_INFORMATION; - -// -// Set an range of IOSBs on a file handle. -// - -typedef struct _FILE_IOSTATUSBLOCK_RANGE_INFORMATION { - PUCHAR IoStatusBlockRange; - ULONG Length; -} FILE_IOSTATUSBLOCK_RANGE_INFORMATION, *PFILE_IOSTATUSBLOCK_RANGE_INFORMATION; - -// -// Define the file system information class values -// -// WARNING: The order of the following values are assumed by the I/O system. -// Any changes made here should be reflected there as well. - -typedef enum _FSINFOCLASS { - FileFsVolumeInformation = 1, - FileFsLabelInformation, // 2 - FileFsSizeInformation, // 3 - FileFsDeviceInformation, // 4 - FileFsAttributeInformation, // 5 - FileFsControlInformation, // 6 - FileFsFullSizeInformation, // 7 - FileFsObjectIdInformation, // 8 - FileFsDriverPathInformation, // 9 - FileFsVolumeFlagsInformation,// 10 - FileFsMaximumInformation -} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS; - - -typedef struct _FILE_FS_DEVICE_INFORMATION { - DEVICE_TYPE DeviceType; - ULONG Characteristics; -} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION; - -// -// Define the I/O bus interface types. -// - -typedef enum _INTERFACE_TYPE { - InterfaceTypeUndefined = -1, - Internal, - Isa, - Eisa, - MicroChannel, - TurboChannel, - PCIBus, - VMEBus, - NuBus, - PCMCIABus, - CBus, - MPIBus, - MPSABus, - ProcessorInternal, - InternalPowerBus, - PNPISABus, - PNPBus, - Vmcs, - MaximumInterfaceType -}INTERFACE_TYPE, *PINTERFACE_TYPE; - -// -// Define the DMA transfer widths. -// - -typedef enum _DMA_WIDTH { - Width8Bits, - Width16Bits, - Width32Bits, - MaximumDmaWidth -}DMA_WIDTH, *PDMA_WIDTH; - -// -// Define DMA transfer speeds. -// - -typedef enum _DMA_SPEED { - Compatible, - TypeA, - TypeB, - TypeC, - TypeF, - MaximumDmaSpeed -}DMA_SPEED, *PDMA_SPEED; - -// -// Define Interface reference/dereference routines for -// Interfaces exported by IRP_MN_QUERY_INTERFACE -// - -typedef VOID (*PINTERFACE_REFERENCE)(PVOID Context); -typedef VOID (*PINTERFACE_DEREFERENCE)(PVOID Context); - -// -// Define I/O Driver error log packet structure. This structure is filled in -// by the driver. -// - -typedef struct _IO_ERROR_LOG_PACKET { - UCHAR MajorFunctionCode; - UCHAR RetryCount; - USHORT DumpDataSize; - USHORT NumberOfStrings; - USHORT StringOffset; - USHORT EventCategory; - NTSTATUS ErrorCode; - ULONG UniqueErrorValue; - NTSTATUS FinalStatus; - ULONG SequenceNumber; - ULONG IoControlCode; - LARGE_INTEGER DeviceOffset; - ULONG DumpData[1]; -}IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET; - -// -// Define the I/O error log message. This message is sent by the error log -// thread over the lpc port. -// - -typedef struct _IO_ERROR_LOG_MESSAGE { - USHORT Type; - USHORT Size; - USHORT DriverNameLength; - LARGE_INTEGER TimeStamp; - ULONG DriverNameOffset; - IO_ERROR_LOG_PACKET EntryData; -}IO_ERROR_LOG_MESSAGE, *PIO_ERROR_LOG_MESSAGE; - -// -// Define the maximum message size that will be sent over the LPC to the -// application reading the error log entries. -// - -// -// Regardless of LPC size restrictions, ERROR_LOG_MAXIMUM_SIZE must remain -// a value that can fit in a UCHAR. -// - -#define ERROR_LOG_LIMIT_SIZE (256-16) - -// -// This limit, exclusive of IO_ERROR_LOG_MESSAGE_HEADER_LENGTH, also applies -// to IO_ERROR_LOG_MESSAGE_LENGTH -// - -#define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \ - sizeof(IO_ERROR_LOG_PACKET) + \ - (sizeof(WCHAR) * 40)) - -#define ERROR_LOG_MESSAGE_LIMIT_SIZE \ - (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH) - -// -// IO_ERROR_LOG_MESSAGE_LENGTH is -// min(PORT_MAXIMUM_MESSAGE_LENGTH, ERROR_LOG_MESSAGE_LIMIT_SIZE) -// - -#define IO_ERROR_LOG_MESSAGE_LENGTH \ - ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \ - ERROR_LOG_MESSAGE_LIMIT_SIZE : \ - PORT_MAXIMUM_MESSAGE_LENGTH) - -// -// Define the maximum packet size a driver can allocate. -// - -#define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \ - IO_ERROR_LOG_MESSAGE_HEADER_LENGTH) - - -#ifdef _WIN64 -#define PORT_MAXIMUM_MESSAGE_LENGTH 512 -#else -#define PORT_MAXIMUM_MESSAGE_LENGTH 256 -#endif - -// -// Registry Specific Access Rights. -// - -#define KEY_QUERY_VALUE (0x0001) -#define KEY_SET_VALUE (0x0002) -#define KEY_CREATE_SUB_KEY (0x0004) -#define KEY_ENUMERATE_SUB_KEYS (0x0008) -#define KEY_NOTIFY (0x0010) -#define KEY_CREATE_LINK (0x0020) -#define KEY_WOW64_32KEY (0x0200) -#define KEY_WOW64_64KEY (0x0100) -#define KEY_WOW64_RES (0x0300) - -#define KEY_READ ((STANDARD_RIGHTS_READ |\ - KEY_QUERY_VALUE |\ - KEY_ENUMERATE_SUB_KEYS |\ - KEY_NOTIFY) \ - & \ - (~SYNCHRONIZE)) - - -#define KEY_WRITE ((STANDARD_RIGHTS_WRITE |\ - KEY_SET_VALUE |\ - KEY_CREATE_SUB_KEY) \ - & \ - (~SYNCHRONIZE)) - -#define KEY_EXECUTE ((KEY_READ) \ - & \ - (~SYNCHRONIZE)) - -#define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL |\ - KEY_QUERY_VALUE |\ - KEY_SET_VALUE |\ - KEY_CREATE_SUB_KEY |\ - KEY_ENUMERATE_SUB_KEYS |\ - KEY_NOTIFY |\ - KEY_CREATE_LINK) \ - & \ - (~SYNCHRONIZE)) - -// -// Open/Create Options -// - -#define REG_OPTION_RESERVED (0x00000000L) // Parameter is reserved - -#define REG_OPTION_NON_VOLATILE (0x00000000L) // Key is preserved - // when system is rebooted - -#define REG_OPTION_VOLATILE (0x00000001L) // Key is not preserved - // when system is rebooted - -#define REG_OPTION_CREATE_LINK (0x00000002L) // Created key is a - // symbolic link - -#define REG_OPTION_BACKUP_RESTORE (0x00000004L) // open for backup or restore - // special access rules - // privilege required - -#define REG_OPTION_OPEN_LINK (0x00000008L) // Open symbolic link - -#define REG_LEGAL_OPTION \ - (REG_OPTION_RESERVED |\ - REG_OPTION_NON_VOLATILE |\ - REG_OPTION_VOLATILE |\ - REG_OPTION_CREATE_LINK |\ - REG_OPTION_BACKUP_RESTORE |\ - REG_OPTION_OPEN_LINK) - -#define REG_OPEN_LEGAL_OPTION \ - (REG_OPTION_RESERVED |\ - REG_OPTION_BACKUP_RESTORE |\ - REG_OPTION_OPEN_LINK) - -// -// Key creation/open disposition -// - -#define REG_CREATED_NEW_KEY (0x00000001L) // New Registry Key created -#define REG_OPENED_EXISTING_KEY (0x00000002L) // Existing Key opened - -// -// hive format to be used by Reg(Nt)SaveKeyEx -// -#define REG_STANDARD_FORMAT 1 -#define REG_LATEST_FORMAT 2 -#define REG_NO_COMPRESSION 4 - -// -// Key restore & hive load flags -// - -#define REG_WHOLE_HIVE_VOLATILE (0x00000001L) // Restore whole hive volatile -#define REG_REFRESH_HIVE (0x00000002L) // Unwind changes to last flush -#define REG_NO_LAZY_FLUSH (0x00000004L) // Never lazy flush this hive -#define REG_FORCE_RESTORE (0x00000008L) // Force the restore process even when we have open handles on subkeys -#define REG_APP_HIVE (0x00000010L) // Loads the hive visible to the calling process -#define REG_PROCESS_PRIVATE (0x00000020L) // Hive cannot be mounted by any other process while in use -#define REG_START_JOURNAL (0x00000040L) // Starts Hive Journal -#define REG_HIVE_EXACT_FILE_GROWTH (0x00000080L) // Grow hive file in exact 4k increments -#define REG_HIVE_NO_RM (0x00000100L) // No RM is started for this hive (no transactions) -#define REG_HIVE_SINGLE_LOG (0x00000200L) // Legacy single logging is used for this hive -#define REG_BOOT_HIVE (0x00000400L) // This hive might be used by the OS loader - -// -// Unload Flags -// -#define REG_FORCE_UNLOAD 1 - -// -// Notify filter values -// - -#define REG_NOTIFY_CHANGE_NAME (0x00000001L) // Create or delete (child) -#define REG_NOTIFY_CHANGE_ATTRIBUTES (0x00000002L) -#define REG_NOTIFY_CHANGE_LAST_SET (0x00000004L) // time stamp -#define REG_NOTIFY_CHANGE_SECURITY (0x00000008L) - -#define REG_LEGAL_CHANGE_FILTER \ - (REG_NOTIFY_CHANGE_NAME |\ - REG_NOTIFY_CHANGE_ATTRIBUTES |\ - REG_NOTIFY_CHANGE_LAST_SET |\ - REG_NOTIFY_CHANGE_SECURITY) - -// -// Key query structures -// - -typedef struct _KEY_BASIC_INFORMATION { - LARGE_INTEGER LastWriteTime; - ULONG TitleIndex; - ULONG NameLength; - WCHAR Name[1]; // Variable length string -} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION; - -typedef struct _KEY_NODE_INFORMATION { - LARGE_INTEGER LastWriteTime; - ULONG TitleIndex; - ULONG ClassOffset; - ULONG ClassLength; - ULONG NameLength; - WCHAR Name[1]; // Variable length string -// Class[1]; // Variable length string not declared -} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION; - -typedef struct _KEY_FULL_INFORMATION { - LARGE_INTEGER LastWriteTime; - ULONG TitleIndex; - ULONG ClassOffset; - ULONG ClassLength; - ULONG SubKeys; - ULONG MaxNameLen; - ULONG MaxClassLen; - ULONG Values; - ULONG MaxValueNameLen; - ULONG MaxValueDataLen; - WCHAR Class[1]; // Variable length -} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION; - -typedef enum _KEY_INFORMATION_CLASS { - KeyBasicInformation, - KeyNodeInformation, - KeyFullInformation, - KeyNameInformation, - KeyCachedInformation, - KeyFlagsInformation, - KeyVirtualizationInformation, - KeyHandleTagsInformation, - MaxKeyInfoClass // MaxKeyInfoClass should always be the last enum -} KEY_INFORMATION_CLASS; - -typedef struct _KEY_WRITE_TIME_INFORMATION { - LARGE_INTEGER LastWriteTime; -} KEY_WRITE_TIME_INFORMATION, *PKEY_WRITE_TIME_INFORMATION; - -typedef struct _KEY_WOW64_FLAGS_INFORMATION { - ULONG UserFlags; -} KEY_WOW64_FLAGS_INFORMATION, *PKEY_WOW64_FLAGS_INFORMATION; - -typedef struct _KEY_HANDLE_TAGS_INFORMATION { - ULONG HandleTags; -} KEY_HANDLE_TAGS_INFORMATION, *PKEY_HANDLE_TAGS_INFORMATION; - -typedef struct _KEY_CONTROL_FLAGS_INFORMATION { - ULONG ControlFlags; -} KEY_CONTROL_FLAGS_INFORMATION, *PKEY_CONTROL_FLAGS_INFORMATION; - -typedef struct _KEY_SET_VIRTUALIZATION_INFORMATION { - ULONG VirtualTarget : 1; // Tells if the key is a virtual target key. - ULONG VirtualStore : 1; // Tells if the key is a virtual store key. - ULONG VirtualSource : 1; // Tells if the key has been virtualized at least one (virtual hint) - ULONG Reserved : 29; -} KEY_SET_VIRTUALIZATION_INFORMATION, *PKEY_SET_VIRTUALIZATION_INFORMATION; - -typedef enum _KEY_SET_INFORMATION_CLASS { - KeyWriteTimeInformation, - KeyWow64FlagsInformation, - KeyControlFlagsInformation, - KeySetVirtualizationInformation, - KeySetDebugInformation, - KeySetHandleTagsInformation, - MaxKeySetInfoClass // MaxKeySetInfoClass should always be the last enum -} KEY_SET_INFORMATION_CLASS; - -// -// Value entry query structures -// - -typedef struct _KEY_VALUE_BASIC_INFORMATION { - ULONG TitleIndex; - ULONG Type; - ULONG NameLength; - WCHAR Name[1]; // Variable size -} KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION; - -typedef struct _KEY_VALUE_FULL_INFORMATION { - ULONG TitleIndex; - ULONG Type; - ULONG DataOffset; - ULONG DataLength; - ULONG NameLength; - WCHAR Name[1]; // Variable size -// Data[1]; // Variable size data not declared -} KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION; - -typedef struct _KEY_VALUE_PARTIAL_INFORMATION { - ULONG TitleIndex; - ULONG Type; - ULONG DataLength; - UCHAR Data[1]; // Variable size -} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION; - -typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 { - ULONG Type; - ULONG DataLength; - UCHAR Data[1]; // Variable size -} KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64; - -typedef struct _KEY_VALUE_ENTRY { - PUNICODE_STRING ValueName; - ULONG DataLength; - ULONG DataOffset; - ULONG Type; -} KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY; - -typedef enum _KEY_VALUE_INFORMATION_CLASS { - KeyValueBasicInformation, - KeyValueFullInformation, - KeyValuePartialInformation, - KeyValueFullInformationAlign64, - KeyValuePartialInformationAlign64, - MaxKeyValueInfoClass // MaxKeyValueInfoClass should always be the last enum -} KEY_VALUE_INFORMATION_CLASS; - - - -#define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\') - - -// -// Object Manager Object Type Specific Access Rights. -// - -#define OBJECT_TYPE_CREATE (0x0001) - -#define OBJECT_TYPE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1) - -// -// Object Manager Directory Specific Access Rights. -// - -#define DIRECTORY_QUERY (0x0001) -#define DIRECTORY_TRAVERSE (0x0002) -#define DIRECTORY_CREATE_OBJECT (0x0004) -#define DIRECTORY_CREATE_SUBDIRECTORY (0x0008) - -#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF) - -//begin_winnt - -// -// Object Manager Symbolic Link Specific Access Rights. -// - -//end_winnt - -#define SYMBOLIC_LINK_QUERY (0x0001) - -#define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1) - -typedef struct _OBJECT_NAME_INFORMATION { - UNICODE_STRING Name; -} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION; - -#define DUPLICATE_CLOSE_SOURCE 0x00000001 -#define DUPLICATE_SAME_ACCESS 0x00000002 -#define DUPLICATE_SAME_ATTRIBUTES 0x00000004 - -// -// Section Information Structures. -// - -typedef enum _SECTION_INHERIT { - ViewShare = 1, - ViewUnmap = 2 -} SECTION_INHERIT; - -// -// Section Access Rights. -// - - -#define SECTION_QUERY 0x0001 -#define SECTION_MAP_WRITE 0x0002 -#define SECTION_MAP_READ 0x0004 -#define SECTION_MAP_EXECUTE 0x0008 -#define SECTION_EXTEND_SIZE 0x0010 -#define SECTION_MAP_EXECUTE_EXPLICIT 0x0020 // not included in SECTION_ALL_ACCESS - -#define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY|\ - SECTION_MAP_WRITE | \ - SECTION_MAP_READ | \ - SECTION_MAP_EXECUTE | \ - SECTION_EXTEND_SIZE) - -#define SESSION_QUERY_ACCESS 0x0001 -#define SESSION_MODIFY_ACCESS 0x0002 - -#define SESSION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \ - SESSION_QUERY_ACCESS | \ - SESSION_MODIFY_ACCESS) - - - -#define SEGMENT_ALL_ACCESS SECTION_ALL_ACCESS - -#define PAGE_NOACCESS 0x01 -#define PAGE_READONLY 0x02 -#define PAGE_READWRITE 0x04 -#define PAGE_WRITECOPY 0x08 -#define PAGE_EXECUTE 0x10 -#define PAGE_EXECUTE_READ 0x20 -#define PAGE_EXECUTE_READWRITE 0x40 -#define PAGE_EXECUTE_WRITECOPY 0x80 -#define PAGE_GUARD 0x100 -#define PAGE_NOCACHE 0x200 -#define PAGE_WRITECOMBINE 0x400 - -#define MEM_COMMIT 0x1000 -#define MEM_RESERVE 0x2000 -#define MEM_DECOMMIT 0x4000 -#define MEM_RELEASE 0x8000 -#define MEM_FREE 0x10000 -#define MEM_PRIVATE 0x20000 -#define MEM_MAPPED 0x40000 -#define MEM_RESET 0x80000 -#define MEM_TOP_DOWN 0x100000 -#define MEM_LARGE_PAGES 0x20000000 -#define MEM_4MB_PAGES 0x80000000 -#define SEC_RESERVE 0x4000000 -#define SEC_COMMIT 0x8000000 -#define SEC_LARGE_PAGES 0x80000000 -#define PROCESS_DUP_HANDLE (0x0040) -#if (NTDDI_VERSION >= NTDDI_VISTA) -#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \ - 0xFFFF) -#else -#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \ - 0xFFF) -#endif - -#if defined(_WIN64) - -#define MAXIMUM_PROC_PER_GROUP 64 - -#else - -#define MAXIMUM_PROC_PER_GROUP 32 - -#endif - -#define MAXIMUM_PROCESSORS MAXIMUM_PROC_PER_GROUP - - -// -// Thread Specific Access Rights -// - -#define THREAD_TERMINATE (0x0001) -#define THREAD_SUSPEND_RESUME (0x0002) -#define THREAD_ALERT (0x0004) -#define THREAD_GET_CONTEXT (0x0008) -#define THREAD_SET_CONTEXT (0x0010) -#define THREAD_SET_INFORMATION (0x0020) -#define THREAD_SET_LIMITED_INFORMATION (0x0400) -#define THREAD_QUERY_LIMITED_INFORMATION (0x0800) -#if (NTDDI_VERSION >= NTDDI_VISTA) -#define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \ - 0xFFFF) -#else -#define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \ - 0x3FF) -#endif -// -// ClientId -// - -typedef struct _CLIENT_ID { - HANDLE UniqueProcess; - HANDLE UniqueThread; -} CLIENT_ID; -typedef CLIENT_ID *PCLIENT_ID; - -#define NtCurrentProcess() ( (HANDLE)(LONG_PTR) -1 ) -#define ZwCurrentProcess() NtCurrentProcess() -#define NtCurrentThread() ( (HANDLE)(LONG_PTR) -2 ) -#define ZwCurrentThread() NtCurrentThread() - -// -// ========================================= -// Define GUIDs which represent well-known power schemes -// ========================================= -// - -// -// Maximum Power Savings - indicates that very aggressive power savings measures will be used to help -// stretch battery life. -// -// {a1841308-3541-4fab-bc81-f71556f20b4a} -// -DEFINE_GUID( GUID_MAX_POWER_SAVINGS, 0xA1841308, 0x3541, 0x4FAB, 0xBC, 0x81, 0xF7, 0x15, 0x56, 0xF2, 0x0B, 0x4A ); - -// -// No Power Savings - indicates that almost no power savings measures will be used. -// -// {8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c} -// -DEFINE_GUID( GUID_MIN_POWER_SAVINGS, 0x8C5E7FDA, 0xE8BF, 0x4A96, 0x9A, 0x85, 0xA6, 0xE2, 0x3A, 0x8C, 0x63, 0x5C ); - -// -// Typical Power Savings - indicates that fairly aggressive power savings measures will be used. -// -// {381b4222-f694-41f0-9685-ff5bb260df2e} -// -DEFINE_GUID( GUID_TYPICAL_POWER_SAVINGS, 0x381B4222, 0xF694, 0x41F0, 0x96, 0x85, 0xFF, 0x5B, 0xB2, 0x60, 0xDF, 0x2E ); - -// -// This is a special GUID that represents "no subgroup" of settings. That is, it indicates -// that settings that are in the root of the power policy hierarchy as opposed to settings -// that are buried under a subgroup of settings. This should be used when querying for -// power settings that may not fall into a subgroup. -// -DEFINE_GUID( NO_SUBGROUP_GUID, 0xFEA3413E, 0x7E05, 0x4911, 0x9A, 0x71, 0x70, 0x03, 0x31, 0xF1, 0xC2, 0x94 ); - -// -// This is a special GUID that represents "every power scheme". That is, it indicates -// that any write to this power scheme should be reflected to every scheme present. -// This allows users to write a single setting once and have it apply to all schemes. They -// can then apply custom settings to specific power schemes that they care about. -// -DEFINE_GUID( ALL_POWERSCHEMES_GUID, 0x68A1E95E, 0x13EA, 0x41E1, 0x80, 0x11, 0x0C, 0x49, 0x6C, 0xA4, 0x90, 0xB0 ); - -// -// This is a special GUID that represents a 'personality' that each power scheme will have. -// In other words, each power scheme will have this key indicating "I'm most like *this* base -// power scheme." This individual setting will have one of three settings: -// GUID_MAX_POWER_SAVINGS -// GUID_MIN_POWER_SAVINGS -// GUID_TYPICAL_POWER_SAVINGS -// -// This allows several features: -// 1. Drivers and applications can register for notification of this GUID. So when this power -// scheme is activiated, this GUID's setting will be sent across the system and drivers/applications -// can see "GUID_MAX_POWER_SAVINGS" which will tell them in a generic fashion "get real aggressive -// about conserving power". -// 2. UserB may install a driver or application which creates power settings, and UserB may modify -// those power settings. Now UserA logs in. How does he see those settings? They simply don't -// exist in his private power key. Well they do exist over in the system power key. When we -// enumerate all the power settings in this system power key and don't find a corresponding entry -// in the user's private power key, then we can go look at this "personality" key in the users -// power scheme. We can then go get a default value for the power setting, depending on which -// "personality" power scheme is being operated on. Here's an example: -// A. UserB installs an application that creates a power setting Seetting1 -// B. UserB changes Setting1 to have a value of 50 because that's one of the possible settings -// available for setting1. -// C. UserB logs out -// D. UserA logs in and his active power scheme is some custom scheme that was derived from -// the GUID_TYPICAL_POWER_SAVINGS. But remember that UserA has no setting1 in his -// private power key. -// E. When activating UserA's selected power scheme, all power settings in the system power key will -// be enumerated (including Setting1). -// F. The power manager will see that UserA has no Setting1 power setting in his private power scheme. -// G. The power manager will query UserA's power scheme for its personality and retrieve -// GUID_TYPICAL_POWER_SAVINGS. -// H. The power manager then looks in Setting1 in the system power key and looks in its set of default -// values for the corresponding value for GUID_TYPICAL_POWER_SAVINGS power schemes. -// I. This derived power setting is applied. -DEFINE_GUID( GUID_POWERSCHEME_PERSONALITY, 0x245D8541, 0x3943, 0x4422, 0xB0, 0x25, 0x13, 0xA7, 0x84, 0xF6, 0x79, 0xB7 ); - -// -// Define a special GUID which will be used to define the active power scheme. -// User will register for this power setting GUID, and when the active power -// scheme changes, they'll get a callback where the payload is the GUID -// representing the active powerscheme. -// ( 31F9F286-5084-42FE-B720-2B0264993763 } -// -DEFINE_GUID( GUID_ACTIVE_POWERSCHEME, 0x31F9F286, 0x5084, 0x42FE, 0xB7, 0x20, 0x2B, 0x02, 0x64, 0x99, 0x37, 0x63 ); - -// -// ========================================= -// Define GUIDs which represent well-known power settings -// ========================================= -// - -// Video settings -// -------------- -// -// Specifies the subgroup which will contain all of the video -// settings for a single policy. -// -DEFINE_GUID( GUID_VIDEO_SUBGROUP, 0x7516B95F, 0xF776, 0x4464, 0x8C, 0x53, 0x06, 0x16, 0x7F, 0x40, 0xCC, 0x99 ); - -// -// Specifies (in seconds) how long we wait after the last user input has been -// recieved before we power off the video. -// -DEFINE_GUID( GUID_VIDEO_POWERDOWN_TIMEOUT, 0x3C0BC021, 0xC8A8, 0x4E07, 0xA9, 0x73, 0x6B, 0x14, 0xCB, 0xCB, 0x2B, 0x7E ); - -// -// Specifies whether adaptive display dimming is turned on or off. -// 82DBCF2D-CD67-40C5-BFDC-9F1A5CCD4663 -// -DEFINE_GUID( GUID_VIDEO_ANNOYANCE_TIMEOUT, 0x82DBCF2D, 0xCD67, 0x40C5, 0xBF, 0xDC, 0x9F, 0x1A, 0x5C, 0xCD, 0x46, 0x63 ); - -// -// Specifies how much adaptive dim time out will be increased by. -// EED904DF-B142-4183-B10B-5A1197A37864 -// -DEFINE_GUID( GUID_VIDEO_ADAPTIVE_PERCENT_INCREASE, 0xEED904DF, 0xB142, 0x4183, 0xB1, 0x0B, 0x5A, 0x11, 0x97, 0xA3, 0x78, 0x64 ); - -// -// Specifies (in seconds) how long we wait after the last user input has been -// recieved before we dim the video. -// -DEFINE_GUID( GUID_VIDEO_DIM_TIMEOUT, 0x17aaa29b, 0x8b43, 0x4b94, 0xaa, 0xfe, 0x35, 0xf6, 0x4d, 0xaa, 0xf1, 0xee); - -// -// Specifies if the operating system should use adaptive timers (based on -// previous behavior) to power down the video, -// -DEFINE_GUID( GUID_VIDEO_ADAPTIVE_POWERDOWN, 0x90959D22, 0xD6A1, 0x49B9, 0xAF, 0x93, 0xBC, 0xE8, 0x85, 0xAD, 0x33, 0x5B ); - -// -// Specifies if the monitor is currently being powered or not. -// 02731015-4510-4526-99E6-E5A17EBD1AEA -// -DEFINE_GUID( GUID_MONITOR_POWER_ON, 0x02731015, 0x4510, 0x4526, 0x99, 0xE6, 0xE5, 0xA1, 0x7E, 0xBD, 0x1A, 0xEA ); - -// -// Monitor brightness policy when in normal state -// {aded5e82-b909-4619-9949-f5d71dac0bcb} -DEFINE_GUID(GUID_DEVICE_POWER_POLICY_VIDEO_BRIGHTNESS, 0xaded5e82L, 0xb909, 0x4619, 0x99, 0x49, 0xf5, 0xd7, 0x1d, 0xac, 0x0b, 0xcb); - -// -// -// Monitor brightness policy when in dim state -// {f1fbfde2-a960-4165-9f88-50667911ce96} -DEFINE_GUID(GUID_DEVICE_POWER_POLICY_VIDEO_DIM_BRIGHTNESS, 0xf1fbfde2, 0xa960, 0x4165, 0x9f, 0x88, 0x50, 0x66, 0x79, 0x11, 0xce, 0x96); - -// -// Current Monitor brightness -// {8ffee2c6-2d01-46be-adb9-398addc5b4ff} -DEFINE_GUID(GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS, 0x8ffee2c6, 0x2d01, 0x46be, 0xad, 0xb9, 0x39, 0x8a, 0xdd, 0xc5, 0xb4, 0xff); - - -// -// Specifies if the operating system should use ambient light sensor to change -// disply brightness adatively. -// {FBD9AA66-9553-4097-BA44-ED6E9D65EAB8} -DEFINE_GUID(GUID_VIDEO_ADAPTIVE_DISPLAY_BRIGHTNESS, 0xFBD9AA66, 0x9553, 0x4097, 0xBA, 0x44, 0xED, 0x6E, 0x9D, 0x65, 0xEA, 0xB8); - -// -// Specifies a change in the session's display state. -// 73A5E93A-5BB1-4F93-895B-DBD0DA855967 -// -// N.B. This is a session-specific notification, sent only to interactive -// session registrants. Session 0 and kernel mode consumers do not receive -// this notification. -DEFINE_GUID( GUID_SESSION_DISPLAY_STATE, 0x73A5E93A, 0x5BB1, 0x4F93, 0x89, 0x5B, 0xDB, 0xD0, 0xDA, 0x85, 0x59, 0x67 ); - -// -// Specifies a change in the current monitor's display state. -// 6fe69556-704a-47a0-8f24-c28d936fda47 -// -DEFINE_GUID(GUID_CONSOLE_DISPLAY_STATE, 0x6fe69556, 0x704a, 0x47a0, 0x8f, 0x24, 0xc2, 0x8d, 0x93, 0x6f, 0xda, 0x47); - -// -// Defines a guid for enabling/disabling the ability to create display required -// power requests. -// -// {A9CEB8DA-CD46-44FB-A98B-02AF69DE4623} -// -DEFINE_GUID( GUID_ALLOW_DISPLAY_REQUIRED, 0xA9CEB8DA, 0xCD46, 0x44FB, 0xA9, 0x8B, 0x02, 0xAF, 0x69, 0xDE, 0x46, 0x23 ); - -// Harddisk settings -// ----------------- -// -// Specifies the subgroup which will contain all of the harddisk -// settings for a single policy. -// -DEFINE_GUID( GUID_DISK_SUBGROUP, 0x0012EE47, 0x9041, 0x4B5D, 0x9B, 0x77, 0x53, 0x5F, 0xBA, 0x8B, 0x14, 0x42 ); - -// -// Specifies (in seconds) how long we wait after the last disk access -// before we power off the disk. -// -DEFINE_GUID( GUID_DISK_POWERDOWN_TIMEOUT, 0x6738E2C4, 0xE8A5, 0x4A42, 0xB1, 0x6A, 0xE0, 0x40, 0xE7, 0x69, 0x75, 0x6E ); - -// -// Specifies the amount of contiguous disk activity time to ignore when -// calculating disk idleness. -// -// 80e3c60e-bb94-4ad8-bbe0-0d3195efc663 -// - -DEFINE_GUID( GUID_DISK_BURST_IGNORE_THRESHOLD, 0x80e3c60e, 0xbb94, 0x4ad8, 0xbb, 0xe0, 0x0d, 0x31, 0x95, 0xef, 0xc6, 0x63 ); - -// -// Specifies if the operating system should use adaptive timers (based on -// previous behavior) to power down the disk, -// -DEFINE_GUID( GUID_DISK_ADAPTIVE_POWERDOWN, 0x396A32E1, 0x499A, 0x40B2, 0x91, 0x24, 0xA9, 0x6A, 0xFE, 0x70, 0x76, 0x67 ); - -// System sleep settings -// --------------------- -// -// Specifies the subgroup which will contain all of the sleep -// settings for a single policy. -// { 238C9FA8-0AAD-41ED-83F4-97BE242C8F20 } -// -DEFINE_GUID( GUID_SLEEP_SUBGROUP, 0x238C9FA8, 0x0AAD, 0x41ED, 0x83, 0xF4, 0x97, 0xBE, 0x24, 0x2C, 0x8F, 0x20 ); - -// -// Specifies an idle treshold percentage (0-100). The system must be this idle -// over a period of time in order to idle to sleep. -// -// N.B. DEPRECATED IN WINDOWS 6.1 -// -DEFINE_GUID( GUID_SLEEP_IDLE_THRESHOLD, 0x81cd32e0, 0x7833, 0x44f3, 0x87, 0x37, 0x70, 0x81, 0xf3, 0x8d, 0x1f, 0x70 ); - -// -// Specifies (in seconds) how long we wait after the system is deemed -// "idle" before moving to standby (S1, S2 or S3). -// -DEFINE_GUID( GUID_STANDBY_TIMEOUT, 0x29F6C1DB, 0x86DA, 0x48C5, 0x9F, 0xDB, 0xF2, 0xB6, 0x7B, 0x1F, 0x44, 0xDA ); - -// -// Specifies (in seconds) how long the system should go back to sleep after -// waking unattended. 0 indicates that the standard standby/hibernate idle -// policy should be used instead. -// -// {7bc4a2f9-d8fc-4469-b07b-33eb785aaca0} -// -DEFINE_GUID( GUID_UNATTEND_SLEEP_TIMEOUT, 0x7bc4a2f9, 0xd8fc, 0x4469, 0xb0, 0x7b, 0x33, 0xeb, 0x78, 0x5a, 0xac, 0xa0 ); - -// -// Specifies (in seconds) how long we wait after the system is deemed -// "idle" before moving to hibernate (S4). -// -DEFINE_GUID( GUID_HIBERNATE_TIMEOUT, 0x9D7815A6, 0x7EE4, 0x497E, 0x88, 0x88, 0x51, 0x5A, 0x05, 0xF0, 0x23, 0x64 ); - -// -// Specifies whether or not Fast S4 should be enabled if the system supports it -// 94AC6D29-73CE-41A6-809F-6363BA21B47E -// -DEFINE_GUID( GUID_HIBERNATE_FASTS4_POLICY, 0x94AC6D29, 0x73CE, 0x41A6, 0x80, 0x9F, 0x63, 0x63, 0xBA, 0x21, 0xB4, 0x7E ); - -// -// Define a GUID for controlling the criticality of sleep state transitions. -// Critical sleep transitions do not query applications, services or drivers -// before transitioning the platform to a sleep state. -// -// {B7A27025-E569-46c2-A504-2B96CAD225A1} -// -DEFINE_GUID( GUID_CRITICAL_POWER_TRANSITION, 0xB7A27025, 0xE569, 0x46c2, 0xA5, 0x04, 0x2B, 0x96, 0xCA, 0xD2, 0x25, 0xA1); - -// -// Specifies if the system is entering or exiting 'away mode'. -// 98A7F580-01F7-48AA-9C0F-44352C29E5C0 -// -DEFINE_GUID( GUID_SYSTEM_AWAYMODE, 0x98A7F580, 0x01F7, 0x48AA, 0x9C, 0x0F, 0x44, 0x35, 0x2C, 0x29, 0xE5, 0xC0 ); - -// Specify whether away mode is allowed -// -// {25DFA149-5DD1-4736-B5AB-E8A37B5B8187} -// -DEFINE_GUID( GUID_ALLOW_AWAYMODE, 0x25dfa149, 0x5dd1, 0x4736, 0xb5, 0xab, 0xe8, 0xa3, 0x7b, 0x5b, 0x81, 0x87 ); - -// -// Defines a guid for enabling/disabling standby (S1-S3) states. This does not -// affect hibernation (S4). -// -// {abfc2519-3608-4c2a-94ea-171b0ed546ab} -// -DEFINE_GUID( GUID_ALLOW_STANDBY_STATES, 0xabfc2519, 0x3608, 0x4c2a, 0x94, 0xea, 0x17, 0x1b, 0x0e, 0xd5, 0x46, 0xab ); - -// -// Defines a guid for enabling/disabling the ability to wake via RTC. -// -// {BD3B718A-0680-4D9D-8AB2-E1D2B4AC806D} -// -DEFINE_GUID( GUID_ALLOW_RTC_WAKE, 0xBD3B718A, 0x0680, 0x4D9D, 0x8A, 0xB2, 0xE1, 0xD2, 0xB4, 0xAC, 0x80, 0x6D ); - -// -// Defines a guid for enabling/disabling the ability to create system required -// power requests. -// -// {A4B195F5-8225-47D8-8012-9D41369786E2} -// -DEFINE_GUID( GUID_ALLOW_SYSTEM_REQUIRED, 0xA4B195F5, 0x8225, 0x47D8, 0x80, 0x12, 0x9D, 0x41, 0x36, 0x97, 0x86, 0xE2 ); - -// System button actions -// --------------------- -// -// -// Specifies the subgroup which will contain all of the system button -// settings for a single policy. -// -DEFINE_GUID( GUID_SYSTEM_BUTTON_SUBGROUP, 0x4F971E89, 0xEEBD, 0x4455, 0xA8, 0xDE, 0x9E, 0x59, 0x04, 0x0E, 0x73, 0x47 ); - -// Specifies (in a POWER_ACTION_POLICY structure) the appropriate action to -// take when the system power button is pressed. -// -DEFINE_GUID( GUID_POWERBUTTON_ACTION, 0x7648EFA3, 0xDD9C, 0x4E3E, 0xB5, 0x66, 0x50, 0xF9, 0x29, 0x38, 0x62, 0x80 ); -DEFINE_GUID( GUID_POWERBUTTON_ACTION_FLAGS, 0x857E7FAC, 0x034B, 0x4704, 0xAB, 0xB1, 0xBC, 0xA5, 0x4A, 0xA3, 0x14, 0x78 ); - -// -// Specifies (in a POWER_ACTION_POLICY structure) the appropriate action to -// take when the system sleep button is pressed. -// -DEFINE_GUID( GUID_SLEEPBUTTON_ACTION, 0x96996BC0, 0xAD50, 0x47EC, 0x92, 0x3B, 0x6F, 0x41, 0x87, 0x4D, 0xD9, 0xEB ); -DEFINE_GUID( GUID_SLEEPBUTTON_ACTION_FLAGS, 0x2A160AB1, 0xB69D, 0x4743, 0xB7, 0x18, 0xBF, 0x14, 0x41, 0xD5, 0xE4, 0x93 ); - -// -// Specifies (in a POWER_ACTION_POLICY structure) the appropriate action to -// take when the system sleep button is pressed. -// { A7066653-8D6C-40A8-910E-A1F54B84C7E5 } -// -DEFINE_GUID( GUID_USERINTERFACEBUTTON_ACTION, 0xA7066653, 0x8D6C, 0x40A8, 0x91, 0x0E, 0xA1, 0xF5, 0x4B, 0x84, 0xC7, 0xE5 ); - -// -// Specifies (in a POWER_ACTION_POLICY structure) the appropriate action to -// take when the system lid is closed. -// -DEFINE_GUID( GUID_LIDCLOSE_ACTION, 0x5CA83367, 0x6E45, 0x459F, 0xA2, 0x7B, 0x47, 0x6B, 0x1D, 0x01, 0xC9, 0x36 ); -DEFINE_GUID( GUID_LIDCLOSE_ACTION_FLAGS, 0x97E969AC, 0x0D6C, 0x4D08, 0x92, 0x7C, 0xD7, 0xBD, 0x7A, 0xD7, 0x85, 0x7B ); -DEFINE_GUID( GUID_LIDOPEN_POWERSTATE, 0x99FF10E7, 0x23B1, 0x4C07, 0xA9, 0xD1, 0x5C, 0x32, 0x06, 0xD7, 0x41, 0xB4 ); - - -// Battery Discharge Settings -// -------------------------- -// -// Specifies the subgroup which will contain all of the battery discharge -// settings for a single policy. -// -DEFINE_GUID( GUID_BATTERY_SUBGROUP, 0xE73A048D, 0xBF27, 0x4F12, 0x97, 0x31, 0x8B, 0x20, 0x76, 0xE8, 0x89, 0x1F ); - -// -// 4 battery discharge alarm settings. -// -// GUID_BATTERY_DISCHARGE_ACTION_x - This is the action to take. It is a value -// of type POWER_ACTION -// GUID_BATTERY_DISCHARGE_LEVEL_x - This is the battery level (%) -// GUID_BATTERY_DISCHARGE_FLAGS_x - Flags defined below: -// POWER_ACTION_POLICY->EventCode flags -// BATTERY_DISCHARGE_FLAGS_EVENTCODE_MASK -// BATTERY_DISCHARGE_FLAGS_ENABLE -DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_0, 0x637EA02F, 0xBBCB, 0x4015, 0x8E, 0x2C, 0xA1, 0xC7, 0xB9, 0xC0, 0xB5, 0x46 ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_0, 0x9A66D8D7, 0x4FF7, 0x4EF9, 0xB5, 0xA2, 0x5A, 0x32, 0x6C, 0xA2, 0xA4, 0x69 ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_0, 0x5dbb7c9f, 0x38e9, 0x40d2, 0x97, 0x49, 0x4f, 0x8a, 0x0e, 0x9f, 0x64, 0x0f ); - -DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_1, 0xD8742DCB, 0x3E6A, 0x4B3C, 0xB3, 0xFE, 0x37, 0x46, 0x23, 0xCD, 0xCF, 0x06 ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_1, 0x8183BA9A, 0xE910, 0x48DA, 0x87, 0x69, 0x14, 0xAE, 0x6D, 0xC1, 0x17, 0x0A ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_1, 0xbcded951, 0x187b, 0x4d05, 0xbc, 0xcc, 0xf7, 0xe5, 0x19, 0x60, 0xc2, 0x58 ); - -DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_2, 0x421CBA38, 0x1A8E, 0x4881, 0xAC, 0x89, 0xE3, 0x3A, 0x8B, 0x04, 0xEC, 0xE4 ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_2, 0x07A07CA2, 0xADAF, 0x40D7, 0xB0, 0x77, 0x53, 0x3A, 0xAD, 0xED, 0x1B, 0xFA ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_2, 0x7fd2f0c4, 0xfeb7, 0x4da3, 0x81, 0x17, 0xe3, 0xfb, 0xed, 0xc4, 0x65, 0x82 ); - -DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_3, 0x80472613, 0x9780, 0x455E, 0xB3, 0x08, 0x72, 0xD3, 0x00, 0x3C, 0xF2, 0xF8 ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_3, 0x58AFD5A6, 0xC2DD, 0x47D2, 0x9F, 0xBF, 0xEF, 0x70, 0xCC, 0x5C, 0x59, 0x65 ); -DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_3, 0x73613ccf, 0xdbfa, 0x4279, 0x83, 0x56, 0x49, 0x35, 0xf6, 0xbf, 0x62, 0xf3 ); - -// Processor power settings -// ------------------------ -// - -// Specifies the subgroup which will contain all of the processor -// settings for a single policy. -// -DEFINE_GUID( GUID_PROCESSOR_SETTINGS_SUBGROUP, 0x54533251, 0x82BE, 0x4824, 0x96, 0xC1, 0x47, 0xB6, 0x0B, 0x74, 0x0D, 0x00 ); - -// -// Specifies various attributes that control processor performance/throttle -// states. -// -DEFINE_GUID( GUID_PROCESSOR_THROTTLE_POLICY, 0x57027304, 0x4AF6, 0x4104, 0x92, 0x60, 0xE3, 0xD9, 0x52, 0x48, 0xFC, 0x36 ); - -#define PERFSTATE_POLICY_CHANGE_IDEAL 0 -#define PERFSTATE_POLICY_CHANGE_SINGLE 1 -#define PERFSTATE_POLICY_CHANGE_ROCKET 2 -#define PERFSTATE_POLICY_CHANGE_MAX PERFSTATE_POLICY_CHANGE_ROCKET - -// -// Specifies a percentage (between 0 and 100) that the processor frequency -// should never go above. For example, if this value is set to 80, then -// the processor frequency will never be throttled above 80 percent of its -// maximum frequency by the system. -// -DEFINE_GUID( GUID_PROCESSOR_THROTTLE_MAXIMUM, 0xBC5038F7, 0x23E0, 0x4960, 0x96, 0xDA, 0x33, 0xAB, 0xAF, 0x59, 0x35, 0xEC ); - -// -// Specifies a percentage (between 0 and 100) that the processor frequency -// should not drop below. For example, if this value is set to 50, then the -// processor frequency will never be throttled below 50 percent of its -// maximum frequency by the system. -// -DEFINE_GUID( GUID_PROCESSOR_THROTTLE_MINIMUM, 0x893DEE8E, 0x2BEF, 0x41E0, 0x89, 0xC6, 0xB5, 0x5D, 0x09, 0x29, 0x96, 0x4C ); - -// -// Specifies whether throttle states are allowed to be used even when -// performance states are available. -// -// {3b04d4fd-1cc7-4f23-ab1c-d1337819c4bb} -// -DEFINE_GUID( GUID_PROCESSOR_ALLOW_THROTTLING, 0x3b04d4fd, 0x1cc7, 0x4f23, 0xab, 0x1c, 0xd1, 0x33, 0x78, 0x19, 0xc4, 0xbb ); - -// -// Specifies processor power settings for CState policy data -// {68F262A7-F621-4069-B9A5-4874169BE23C} -// -DEFINE_GUID( GUID_PROCESSOR_IDLESTATE_POLICY, 0x68f262a7, 0xf621, 0x4069, 0xb9, 0xa5, 0x48, 0x74, 0x16, 0x9b, 0xe2, 0x3c); - -// -// Specifies processor power settings for PerfState policy data -// {BBDC3814-18E9-4463-8A55-D197327C45C0} -// -DEFINE_GUID( GUID_PROCESSOR_PERFSTATE_POLICY, 0xBBDC3814, 0x18E9, 0x4463, 0x8A, 0x55, 0xD1, 0x97, 0x32, 0x7C, 0x45, 0xC0); - -// -// Specifies the increase busy percentage threshold that must be met before -// increasing the processor performance state. -// -// {06cadf0e-64ed-448a-8927-ce7bf90eb35d} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_INCREASE_THRESHOLD, 0x06cadf0e, 0x64ed, 0x448a, 0x89, 0x27, 0xce, 0x7b, 0xf9, 0x0e, 0xb3, 0x5d ); - -// -// Specifies the decrease busy percentage threshold that must be met before -// decreasing the processor performance state. -// -// {12a0ab44-fe28-4fa9-b3bd-4b64f44960a6} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_DECREASE_THRESHOLD, 0x12a0ab44, 0xfe28, 0x4fa9, 0xb3, 0xbd, 0x4b, 0x64, 0xf4, 0x49, 0x60, 0xa6 ); - -// -// Specifies, either as ideal, single or rocket, how aggressive performance -// states should be selected when increasing the processor performance state. -// -// {465E1F50-B610-473a-AB58-00D1077DC418} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_INCREASE_POLICY, 0x465e1f50, 0xb610, 0x473a, 0xab, 0x58, 0x0, 0xd1, 0x7, 0x7d, 0xc4, 0x18); - -// -// Specifies, either as ideal, single or rocket, how aggressive performance -// states should be selected when decreasing the processor performance state. -// -// {40FBEFC7-2E9D-4d25-A185-0CFD8574BAC6} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_DECREASE_POLICY, 0x40fbefc7, 0x2e9d, 0x4d25, 0xa1, 0x85, 0xc, 0xfd, 0x85, 0x74, 0xba, 0xc6); - -// -// Specifies, in milliseconds, the minimum amount of time that must elapse after -// the last processor performance state change before increasing the processor -// performance state. -// -// {984CF492-3BED-4488-A8F9-4286C97BF5AA} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_INCREASE_TIME, 0x984cf492, 0x3bed, 0x4488, 0xa8, 0xf9, 0x42, 0x86, 0xc9, 0x7b, 0xf5, 0xaa); - -// -// Specifies, in milliseconds, the minimum amount of time that must elapse after -// the last processor performance state change before increasing the processor -// performance state. -// -// {D8EDEB9B-95CF-4f95-A73C-B061973693C8} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_DECREASE_TIME, 0xd8edeb9b, 0x95cf, 0x4f95, 0xa7, 0x3c, 0xb0, 0x61, 0x97, 0x36, 0x93, 0xc8); - -// -// Specifies the time, in milliseconds, that must expire before considering -// a change in the processor performance states or parked core set. -// -// {4D2B0152-7D5C-498b-88E2-34345392A2C5} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_TIME_CHECK, 0x4d2b0152, 0x7d5c, 0x498b, 0x88, 0xe2, 0x34, 0x34, 0x53, 0x92, 0xa2, 0xc5); - -// -// Specifies whether a processor may opportunistically increase frequency above -// the maximum when operating contitions allow it to do so safely. -// -// {45BCC044-D885-43e2-8605-EE0EC6E96B59} -// -DEFINE_GUID(GUID_PROCESSOR_PERF_BOOST_POLICY, -0x45bcc044, 0xd885, 0x43e2, 0x86, 0x5, 0xee, 0xe, 0xc6, 0xe9, 0x6b, 0x59); - -#define PROCESSOR_PERF_BOOST_POLICY_DISABLED 0 -#define PROCESSOR_PERF_BOOST_POLICY_MAX 100 - -// -// Specifies if idle state promotion and demotion values should be scaled based -// on the current peformance state. -// -// {6C2993B0-8F48-481f-BCC6-00DD2742AA06} -// -DEFINE_GUID( GUID_PROCESSOR_IDLE_ALLOW_SCALING, 0x6c2993b0, 0x8f48, 0x481f, 0xbc, 0xc6, 0x0, 0xdd, 0x27, 0x42, 0xaa, 0x6); - -// -// Specifies if idle states should be disabled. -// -// {5D76A2CA-E8C0-402f-A133-2158492D58AD} -// -DEFINE_GUID( GUID_PROCESSOR_IDLE_DISABLE, 0x5d76a2ca, 0xe8c0, 0x402f, 0xa1, 0x33, 0x21, 0x58, 0x49, 0x2d, 0x58, 0xad); - -// -// Specifies the time that elapsed since the last idle state promotion or -// demotion before idle states may be promoted or demoted again (in -// microseconds). -// -// {C4581C31-89AB-4597-8E2B-9C9CAB440E6B} -// -DEFINE_GUID( GUID_PROCESSOR_IDLE_TIME_CHECK, 0xc4581c31, 0x89ab, 0x4597, 0x8e, 0x2b, 0x9c, 0x9c, 0xab, 0x44, 0xe, 0x6b); - - -// -// Specifies the upper busy threshold that must be met before demoting the -// processor to a lighter idle state (in percentage). -// -// {4B92D758-5A24-4851-A470-815D78AEE119} -// -DEFINE_GUID( GUID_PROCESSOR_IDLE_DEMOTE_THRESHOLD, 0x4b92d758, 0x5a24, 0x4851, 0xa4, 0x70, 0x81, 0x5d, 0x78, 0xae, 0xe1, 0x19); - -// -// Specifies the lower busy threshold that must be met before promoting the -// processor to a deeper idle state (in percentage). -// -// {7B224883-B3CC-4d79-819F-8374152CBE7C} -// -DEFINE_GUID( GUID_PROCESSOR_IDLE_PROMOTE_THRESHOLD, 0x7b224883, 0xb3cc, 0x4d79, 0x81, 0x9f, 0x83, 0x74, 0x15, 0x2c, 0xbe, 0x7c); - -// -// Specifies the utilization threshold in percent that must be crossed in order to un-park cores. -// -// {df142941-20f3-4edf-9a4a-9c83d3d717d1} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_INCREASE_THRESHOLD, 0xdf142941, 0x20f3, 0x4edf, 0x9a, 0x4a, 0x9c, 0x83, 0xd3, 0xd7, 0x17, 0xd1 ); - -// -// Specifies the utilization threshold in percent that must be crossed in order to park cores. -// -// {68dd2f27-a4ce-4e11-8487-3794e4135dfa} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_DECREASE_THRESHOLD, 0x68dd2f27, 0xa4ce, 0x4e11, 0x84, 0x87, 0x37, 0x94, 0xe4, 0x13, 0x5d, 0xfa); - -// -// Specifies, either as ideal, single or rocket, how aggressive core parking is when cores must be unparked. -// -// {c7be0679-2817-4d69-9d02-519a537ed0c6} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_INCREASE_POLICY, 0xc7be0679, 0x2817, 0x4d69, 0x9d, 0x02, 0x51, 0x9a, 0x53, 0x7e, 0xd0, 0xc6); - -#define CORE_PARKING_POLICY_CHANGE_IDEAL 0 -#define CORE_PARKING_POLICY_CHANGE_SINGLE 1 -#define CORE_PARKING_POLICY_CHANGE_ROCKET 2 -#define CORE_PARKING_POLICY_CHANGE_MAX CORE_PARKING_POLICY_CHANGE_ROCKET - -// -// Specifies, either as ideal, single or rocket, how aggressive core parking is when cores must be parked. -// -// {71021b41-c749-4d21-be74-a00f335d582b} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_DECREASE_POLICY, 0x71021b41, 0xc749, 0x4d21, 0xbe, 0x74, 0xa0, 0x0f, 0x33, 0x5d, 0x58, 0x2b); - -// -// Specifies, on a per processor group basis, the maximum number of cores that can be kept unparked. -// -// {ea062031-0e34-4ff1-9b6d-eb1059334028} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_MAX_CORES, 0xea062031, 0x0e34, 0x4ff1, 0x9b, 0x6d, 0xeb, 0x10, 0x59, 0x33, 0x40, 0x28); - -// -// Specifies, on a per processor group basis, the minimum number of cores that must be kept unparked. -// -// {0cc5b647-c1df-4637-891a-dec35c318583} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_MIN_CORES, 0x0cc5b647, 0xc1df, 0x4637, 0x89, 0x1a, 0xde, 0xc3, 0x5c, 0x31, 0x85, 0x83); - -// -// Specifies, in milliseconds, the minimum amount of time a core must be parked before it can be unparked. -// -// {2ddd5a84-5a71-437e-912a-db0b8c788732} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_INCREASE_TIME, 0x2ddd5a84, 0x5a71, 0x437e, 0x91, 0x2a, 0xdb, 0x0b, 0x8c, 0x78, 0x87, 0x32); - -// -// Specifies, in milliseconds, the minimum amount of time a core must be unparked before it can be parked. -// -// {dfd10d17-d5eb-45dd-877a-9a34ddd15c82} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_DECREASE_TIME, 0xdfd10d17, 0xd5eb, 0x45dd, 0x87, 0x7a, 0x9a, 0x34, 0xdd, 0xd1, 0x5c, 0x82); - -// -// Specifies the factor by which to decrease affinity history on each core after each check. -// -// {8f7b45e3-c393-480a-878c-f67ac3d07082} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_AFFINITY_HISTORY_DECREASE_FACTOR, 0x8f7b45e3, 0xc393, 0x480a, 0x87, 0x8c, 0xf6, 0x7a, 0xc3, 0xd0, 0x70, 0x82); - -// -// Specifies the threshold above which a core is considered to have had significant affinitized work scheduled to it while parked. -// -// {5b33697b-e89d-4d38-aa46-9e7dfb7cd2f9} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_AFFINITY_HISTORY_THRESHOLD, 0x5b33697b, 0xe89d, 0x4d38, 0xaa, 0x46, 0x9e, 0x7d, 0xfb, 0x7c, 0xd2, 0xf9); - -// -// Specifies the weighting given to each occurence where affinitized work was scheduled to a parked core. -// -// {e70867f1-fa2f-4f4e-aea1-4d8a0ba23b20} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_AFFINITY_WEIGHTING, 0xe70867f1, 0xfa2f, 0x4f4e, 0xae, 0xa1, 0x4d, 0x8a, 0x0b, 0xa2, 0x3b, 0x20); - -// -// Specifies the factor by which to decrease the over utilization history on each core after the current performance check. -// -// {1299023c-bc28-4f0a-81ec-d3295a8d815d} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_DECREASE_FACTOR, 0x1299023c, 0xbc28, 0x4f0a, 0x81, 0xec, 0xd3, 0x29, 0x5a, 0x8d, 0x81, 0x5d); - -// -// Specifies the threshold above which a core is considered to have been recently over utilized while parked. -// -// {9ac18e92-aa3c-4e27-b307-01ae37307129} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_THRESHOLD, 0x9ac18e92, 0xaa3c, 0x4e27, 0xb3, 0x07, 0x01, 0xae, 0x37, 0x30, 0x71, 0x29); - -// -// Specifies the weighting given to each occurence where a parked core is found to be over utilized. -// -// {8809c2d8-b155-42d4-bcda-0d345651b1db} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_WEIGHTING, 0x8809c2d8, 0xb155, 0x42d4, 0xbc, 0xda, 0x0d, 0x34, 0x56, 0x51, 0xb1, 0xdb); - -// -// Specifies, in percentage, the busy threshold that must be met before a parked core is considered over utilized. -// -// {943c8cb6-6f93-4227-ad87-e9a3feec08d1} -// -DEFINE_GUID( GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_THRESHOLD, 0x943c8cb6, 0x6f93, 0x4227, 0xad, 0x87, 0xe9, 0xa3, 0xfe, 0xec, 0x08, 0xd1); - -// -// Specifies if at least one processor per core should always remain unparked. -// -// {a55612aa-f624-42c6-a443-7397d064c04f} -// - -DEFINE_GUID( GUID_PROCESSOR_PARKING_CORE_OVERRIDE, 0xa55612aa, 0xf624, 0x42c6, 0xa4, 0x43, 0x73, 0x97, 0xd0, 0x64, 0xc0, 0x4f); - -// -// Specifies what performance state a processor should enter when first parked. -// -// {447235c7-6a8d-4cc0-8e24-9eaf70b96e2b} -// - -DEFINE_GUID( GUID_PROCESSOR_PARKING_PERF_STATE, 0x447235c7, 0x6a8d, 0x4cc0, 0x8e, 0x24, 0x9e, 0xaf, 0x70, 0xb9, 0x6e, 0x2b); - -// -// Specifies the number of perf time check intervals to average utility over. -// -// {7d24baa7-0b84-480f-840c-1b0743c00f5f} -// -DEFINE_GUID( GUID_PROCESSOR_PERF_HISTORY, 0x7d24baa7, 0x0b84, 0x480f, 0x84, 0x0c, 0x1b, 0x07, 0x43, 0xc0, 0x0f, 0x5f); - -// -// Specifies active vs passive cooling. Although not directly related to -// processor settings, it is the processor that gets throttled if we're doing -// passive cooling, so it is fairly strongly related. -// {94D3A615-A899-4AC5-AE2B-E4D8F634367F} -// -DEFINE_GUID( GUID_SYSTEM_COOLING_POLICY, 0x94D3A615, 0xA899, 0x4AC5, 0xAE, 0x2B, 0xE4, 0xD8, 0xF6, 0x34, 0x36, 0x7F); - -// Lock Console on Wake -// -------------------- -// - -// Specifies the behavior of the system when we wake from standby or -// hibernate. If this is set, then we will cause the console to lock -// after we resume. -// -DEFINE_GUID( GUID_LOCK_CONSOLE_ON_WAKE, 0x0E796BDB, 0x100D, 0x47D6, 0xA2, 0xD5, 0xF7, 0xD2, 0xDA, 0xA5, 0x1F, 0x51 ); - -// Device idle characteristics -// --------------------------- -// -// Specifies whether to use the "performance" or "conservative" timeouts for -// device idle management. -// -// 4faab71a-92e5-4726-b531-224559672d19 -// -DEFINE_GUID( GUID_DEVICE_IDLE_POLICY, 0x4faab71a, 0x92e5, 0x4726, 0xb5, 0x31, 0x22, 0x45, 0x59, 0x67, 0x2d, 0x19 ); - -#define POWER_DEVICE_IDLE_POLICY_PERFORMANCE 0 -#define POWER_DEVICE_IDLE_POLICY_CONSERVATIVE 1 - -// AC/DC power source -// ------------------ -// - -// Specifies the power source for the system. consumers may register for -// notification when the power source changes and will be notified with -// one of 3 values: -// 0 - Indicates the system is being powered by an AC power source. -// 1 - Indicates the system is being powered by a DC power source. -// 2 - Indicates the system is being powered by a short-term DC power -// source. For example, this would be the case if the system is -// being powed by a short-term battery supply in a backing UPS -// system. When this value is recieved, the consumer should make -// preparations for either a system hibernate or system shutdown. -// -// { 5D3E9A59-E9D5-4B00-A6BD-FF34FF516548 } -DEFINE_GUID( GUID_ACDC_POWER_SOURCE, 0x5D3E9A59, 0xE9D5, 0x4B00, 0xA6, 0xBD, 0xFF, 0x34, 0xFF, 0x51, 0x65, 0x48 ); - -// Lid state changes -// ----------------- -// -// Specifies the current state of the lid (open or closed). The callback won't -// be called at all until a lid device is found and its current state is known. -// -// Values: -// -// 0 - closed -// 1 - opened -// -// { BA3E0F4D-B817-4094-A2D1-D56379E6A0F3 } -// - -DEFINE_GUID( GUID_LIDSWITCH_STATE_CHANGE, 0xBA3E0F4D, 0xB817, 0x4094, 0xA2, 0xD1, 0xD5, 0x63, 0x79, 0xE6, 0xA0, 0xF3 ); - -// Battery life remaining -// ---------------------- -// - -// Specifies the percentage of battery life remaining. The consumer -// may register for notification in order to track battery life in -// a fine-grained manner. -// -// Once registered, the consumer can expect to be notified as the battery -// life percentage changes. -// -// The consumer will recieve a value between 0 and 100 (inclusive) which -// indicates percent battery life remaining. -// -// { A7AD8041-B45A-4CAE-87A3-EECBB468A9E1 } -DEFINE_GUID( GUID_BATTERY_PERCENTAGE_REMAINING, 0xA7AD8041, 0xB45A, 0x4CAE, 0x87, 0xA3, 0xEE, 0xCB, 0xB4, 0x68, 0xA9, 0xE1 ); - - -// Notification to listeners that the system is fairly busy and won't be moving -// into an idle state any time soon. This can be used as a hint to listeners -// that now might be a good time to do background tasks. -// -DEFINE_GUID( GUID_IDLE_BACKGROUND_TASK, 0x515C31D8, 0xF734, 0x163D, 0xA0, 0xFD, 0x11, 0xA0, 0x8C, 0x91, 0xE8, 0xF1 ); - -// Notification to listeners that the system is fairly busy and won't be moving -// into an idle state any time soon. This can be used as a hint to listeners -// that now might be a good time to do background tasks. -// -// { CF23F240-2A54-48D8-B114-DE1518FF052E } -DEFINE_GUID( GUID_BACKGROUND_TASK_NOTIFICATION, 0xCF23F240, 0x2A54, 0x48D8, 0xB1, 0x14, 0xDE, 0x15, 0x18, 0xFF, 0x05, 0x2E ); - -// Define a GUID that will represent the action of a direct experience button -// on the platform. Users will register for this DPPE setting and recieve -// notification when the h/w button is pressed. -// -// { 1A689231-7399-4E9A-8F99-B71F999DB3FA } -// -DEFINE_GUID( GUID_APPLAUNCH_BUTTON, 0x1A689231, 0x7399, 0x4E9A, 0x8F, 0x99, 0xB7, 0x1F, 0x99, 0x9D, 0xB3, 0xFA ); - -// PCI Express power settings -// ------------------------ -// - -// Specifies the subgroup which will contain all of the PCI Express -// settings for a single policy. -// -// {501a4d13-42af-4429-9fd1-a8218c268e20} -// -DEFINE_GUID( GUID_PCIEXPRESS_SETTINGS_SUBGROUP, 0x501a4d13, 0x42af,0x4429, 0x9f, 0xd1, 0xa8, 0x21, 0x8c, 0x26, 0x8e, 0x20 ); - -// Specifies the PCI Express ASPM power policy. -// -// {ee12f906-d277-404b-b6da-e5fa1a576df5} -// -DEFINE_GUID( GUID_PCIEXPRESS_ASPM_POLICY, 0xee12f906, 0xd277, 0x404b, 0xb6, 0xda, 0xe5, 0xfa, 0x1a, 0x57, 0x6d, 0xf5 ); - -// POWER Shutdown settings -// ------------------------ -// - -// Specifies if forced shutdown should be used for all button and lid initiated -// shutdown actions. -// -// {833a6b62-dfa4-46d1-82f8-e09e34d029d6} -// - -DEFINE_GUID( GUID_ENABLE_SWITCH_FORCED_SHUTDOWN, 0x833a6b62, 0xdfa4, 0x46d1, 0x82, 0xf8, 0xe0, 0x9e, 0x34, 0xd0, 0x29, 0xd6 ); - - -#ifndef _PO_DDK_ -#define _PO_DDK_ - - - -typedef enum _SYSTEM_POWER_STATE { - PowerSystemUnspecified = 0, - PowerSystemWorking = 1, - PowerSystemSleeping1 = 2, - PowerSystemSleeping2 = 3, - PowerSystemSleeping3 = 4, - PowerSystemHibernate = 5, - PowerSystemShutdown = 6, - PowerSystemMaximum = 7 -} SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE; - -#define POWER_SYSTEM_MAXIMUM 7 - -typedef enum { - PowerActionNone = 0, - PowerActionReserved, - PowerActionSleep, - PowerActionHibernate, - PowerActionShutdown, - PowerActionShutdownReset, - PowerActionShutdownOff, - PowerActionWarmEject -} POWER_ACTION, *PPOWER_ACTION; - -typedef enum _DEVICE_POWER_STATE { - PowerDeviceUnspecified = 0, - PowerDeviceD0, - PowerDeviceD1, - PowerDeviceD2, - PowerDeviceD3, - PowerDeviceMaximum -} DEVICE_POWER_STATE, *PDEVICE_POWER_STATE; - -typedef enum _MONITOR_DISPLAY_STATE { - PowerMonitorOff = 0, - PowerMonitorOn, - PowerMonitorDim -} MONITOR_DISPLAY_STATE, *PMONITOR_DISPLAY_STATE; - - - -typedef union _POWER_STATE { - SYSTEM_POWER_STATE SystemState; - DEVICE_POWER_STATE DeviceState; -} POWER_STATE, *PPOWER_STATE; - -typedef enum _POWER_STATE_TYPE { - SystemPowerState = 0, - DevicePowerState -} POWER_STATE_TYPE, *PPOWER_STATE_TYPE; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef struct _SYSTEM_POWER_STATE_CONTEXT { - union { - struct { - ULONG Reserved1 : 8; - ULONG TargetSystemState : 4; - ULONG EffectiveSystemState : 4; - ULONG CurrentSystemState : 4; - ULONG IgnoreHibernationPath : 1; - ULONG PseudoTransition : 1; - ULONG Reserved2 : 10; - } DUMMYSTRUCTNAME; - - ULONG ContextAsUlong; - } DUMMYUNIONNAME; -} SYSTEM_POWER_STATE_CONTEXT, *PSYSTEM_POWER_STATE_CONTEXT; -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -typedef struct _COUNTED_REASON_CONTEXT { - ULONG Version; - ULONG Flags; - union { - struct { - UNICODE_STRING ResourceFileName; - USHORT ResourceReasonId; - ULONG StringCount; - PUNICODE_STRING __field_ecount(StringCount) ReasonStrings; - } DUMMYSTRUCTNAME; - - UNICODE_STRING SimpleString; - } DUMMYUNIONNAME; -} COUNTED_REASON_CONTEXT, *PCOUNTED_REASON_CONTEXT; - -#endif // (NTDDI_VERSION >= NTDDI_WIN7) - -// -// Generic power related IOCTLs -// - -#define IOCTL_QUERY_DEVICE_POWER_STATE \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x0, METHOD_BUFFERED, FILE_READ_ACCESS) - -#define IOCTL_SET_DEVICE_WAKE \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x1, METHOD_BUFFERED, FILE_WRITE_ACCESS) - -#define IOCTL_CANCEL_DEVICE_WAKE \ - CTL_CODE(FILE_DEVICE_BATTERY, 0x2, METHOD_BUFFERED, FILE_WRITE_ACCESS) - - -// -// Defines for W32 interfaces -// - - - -#define ES_SYSTEM_REQUIRED ((ULONG)0x00000001) -#define ES_DISPLAY_REQUIRED ((ULONG)0x00000002) -#define ES_USER_PRESENT ((ULONG)0x00000004) -#define ES_AWAYMODE_REQUIRED ((ULONG)0x00000040) -#define ES_CONTINUOUS ((ULONG)0x80000000) - -typedef ULONG EXECUTION_STATE, *PEXECUTION_STATE; - -typedef enum { - LT_DONT_CARE, - LT_LOWEST_LATENCY -} LATENCY_TIME; - -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN7) - -#define DIAGNOSTIC_REASON_VERSION 0 - -#define DIAGNOSTIC_REASON_SIMPLE_STRING 0x00000001 -#define DIAGNOSTIC_REASON_DETAILED_STRING 0x00000002 -#define DIAGNOSTIC_REASON_NOT_SPECIFIED 0x80000000 -#define DIAGNOSTIC_REASON_INVALID_FLAGS (~0x80000003) - -#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN7) - -// -// Defines for power request APIs -// - -#define POWER_REQUEST_CONTEXT_VERSION 0 - -#define POWER_REQUEST_CONTEXT_SIMPLE_STRING 0x00000001 -#define POWER_REQUEST_CONTEXT_DETAILED_STRING 0x00000002 - -// -// N.B. The maximum is a macro (rather than part of enum) for cgen to be able -// to parse power.h correctly. When a new power request type is added, the -// PowerRequestMaximum should be manually incremented. -// - -typedef enum _POWER_REQUEST_TYPE { - PowerRequestDisplayRequired, - PowerRequestSystemRequired, - PowerRequestAwayModeRequired -} POWER_REQUEST_TYPE, *PPOWER_REQUEST_TYPE; - -#define PowerRequestMaximum 3 - - - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -//----------------------------------------------------------------------------- -// Device Power Information -// Accessable via CM_Get_DevInst_Registry_Property_Ex(CM_DRP_DEVICE_POWER_DATA) -//----------------------------------------------------------------------------- - -#define PDCAP_D0_SUPPORTED 0x00000001 -#define PDCAP_D1_SUPPORTED 0x00000002 -#define PDCAP_D2_SUPPORTED 0x00000004 -#define PDCAP_D3_SUPPORTED 0x00000008 -#define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010 -#define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020 -#define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040 -#define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080 -#define PDCAP_WARM_EJECT_SUPPORTED 0x00000100 - -typedef struct CM_Power_Data_s { - ULONG PD_Size; - DEVICE_POWER_STATE PD_MostRecentPowerState; - ULONG PD_Capabilities; - ULONG PD_D1Latency; - ULONG PD_D2Latency; - ULONG PD_D3Latency; - DEVICE_POWER_STATE PD_PowerStateMapping[POWER_SYSTEM_MAXIMUM]; - SYSTEM_POWER_STATE PD_DeepestSystemWake; -} CM_POWER_DATA, *PCM_POWER_DATA; - -#endif // (NTDDI_VERSION >= NTDDI_WINXP) - - - -typedef enum { - SystemPowerPolicyAc, - SystemPowerPolicyDc, - VerifySystemPolicyAc, - VerifySystemPolicyDc, - SystemPowerCapabilities, - SystemBatteryState, - SystemPowerStateHandler, - ProcessorStateHandler, - SystemPowerPolicyCurrent, - AdministratorPowerPolicy, - SystemReserveHiberFile, - ProcessorInformation, - SystemPowerInformation, - ProcessorStateHandler2, - LastWakeTime, // Compare with KeQueryInterruptTime() - LastSleepTime, // Compare with KeQueryInterruptTime() - SystemExecutionState, - SystemPowerStateNotifyHandler, - ProcessorPowerPolicyAc, - ProcessorPowerPolicyDc, - VerifyProcessorPowerPolicyAc, - VerifyProcessorPowerPolicyDc, - ProcessorPowerPolicyCurrent, - SystemPowerStateLogging, - SystemPowerLoggingEntry, - SetPowerSettingValue, - NotifyUserPowerSetting, - PowerInformationLevelUnused0, - PowerInformationLevelUnused1, - SystemVideoState, - TraceApplicationPowerMessage, - TraceApplicationPowerMessageEnd, - ProcessorPerfStates, - ProcessorIdleStates, - ProcessorCap, - SystemWakeSource, - SystemHiberFileInformation, - TraceServicePowerMessage, - ProcessorLoad, - PowerShutdownNotification, - MonitorCapabilities, - SessionPowerInit, - SessionDisplayState, - PowerRequestCreate, - PowerRequestAction, - GetPowerRequestList, - ProcessorInformationEx, - NotifyUserModeLegacyPowerEvent, - GroupPark, - ProcessorIdleDomains, - WakeTimerList, - SystemHiberFileSize, - PowerInformationLevelMaximum -} POWER_INFORMATION_LEVEL; - -// -// Power Setting definitions -// - -typedef enum { - PoAc, - PoDc, - PoHot, - PoConditionMaximum -} SYSTEM_POWER_CONDITION; - -typedef struct { - - // - // Version of this structure. Currently should be set to - // POWER_SETTING_VALUE_VERSION. - // - ULONG Version; - - - // - // GUID representing the power setting being applied. - // - GUID Guid; - - - // - // What power state should this setting be applied to? E.g. - // AC, DC, thermal, ... - // - SYSTEM_POWER_CONDITION PowerCondition; - - // - // Length (in bytes) of the 'Data' member. - // - ULONG DataLength; - - // - // Data which contains the actual setting value. - // - UCHAR Data[ANYSIZE_ARRAY]; -} SET_POWER_SETTING_VALUE, *PSET_POWER_SETTING_VALUE; - -#define POWER_SETTING_VALUE_VERSION (0x1) - -typedef struct { - GUID Guid; -} NOTIFY_USER_POWER_SETTING, *PNOTIFY_USER_POWER_SETTING; - -// -// Package definition for an experience button device notification. When -// someone registers for GUID_EXPERIENCE_BUTTON, this is the definition of -// the setting data they'll get. -// -typedef struct _APPLICATIONLAUNCH_SETTING_VALUE { - - // - // System time when the most recent button press ocurred. Note that this is - // specified in 100ns internvals since January 1, 1601. - // - LARGE_INTEGER ActivationTime; - - // - // Reserved for internal use. - // - ULONG Flags; - - // - // which instance of this device was pressed? - // - ULONG ButtonInstanceID; - - -} APPLICATIONLAUNCH_SETTING_VALUE, *PAPPLICATIONLAUNCH_SETTING_VALUE; - -// -// define platform roles -// - -typedef enum { - PlatformRoleUnspecified = 0, - PlatformRoleDesktop, - PlatformRoleMobile, - PlatformRoleWorkstation, - PlatformRoleEnterpriseServer, - PlatformRoleSOHOServer, - PlatformRoleAppliancePC, - PlatformRolePerformanceServer, - PlatformRoleMaximum -} POWER_PLATFORM_ROLE; - -// -// System power manager capabilities -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) || !defined(_BATCLASS_) -typedef struct { - ULONG Granularity; - ULONG Capacity; -} BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE; -#endif // (NTDDI_VERSION >= NTDDI_WINXP) || !defined(_BATCLASS_) - - -#endif // !_PO_DDK_ - -// -// Predefined Value Types. -// - -#define REG_NONE ( 0 ) // No value type -#define REG_SZ ( 1 ) // Unicode nul terminated string -#define REG_EXPAND_SZ ( 2 ) // Unicode nul terminated string - // (with environment variable references) -#define REG_BINARY ( 3 ) // Free form binary -#define REG_DWORD ( 4 ) // 32-bit number -#define REG_DWORD_LITTLE_ENDIAN ( 4 ) // 32-bit number (same as REG_DWORD) -#define REG_DWORD_BIG_ENDIAN ( 5 ) // 32-bit number -#define REG_LINK ( 6 ) // Symbolic Link (unicode) -#define REG_MULTI_SZ ( 7 ) // Multiple Unicode strings -#define REG_RESOURCE_LIST ( 8 ) // Resource list in the resource map -#define REG_FULL_RESOURCE_DESCRIPTOR ( 9 ) // Resource list in the hardware description -#define REG_RESOURCE_REQUIREMENTS_LIST ( 10 ) -#define REG_QWORD ( 11 ) // 64-bit number -#define REG_QWORD_LITTLE_ENDIAN ( 11 ) // 64-bit number (same as REG_QWORD) - -// -// Service Types (Bit Mask) -// -#define SERVICE_KERNEL_DRIVER 0x00000001 -#define SERVICE_FILE_SYSTEM_DRIVER 0x00000002 -#define SERVICE_ADAPTER 0x00000004 -#define SERVICE_RECOGNIZER_DRIVER 0x00000008 - -#define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER | \ - SERVICE_FILE_SYSTEM_DRIVER | \ - SERVICE_RECOGNIZER_DRIVER) - -#define SERVICE_WIN32_OWN_PROCESS 0x00000010 -#define SERVICE_WIN32_SHARE_PROCESS 0x00000020 -#define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | \ - SERVICE_WIN32_SHARE_PROCESS) - -#define SERVICE_INTERACTIVE_PROCESS 0x00000100 - -#define SERVICE_TYPE_ALL (SERVICE_WIN32 | \ - SERVICE_ADAPTER | \ - SERVICE_DRIVER | \ - SERVICE_INTERACTIVE_PROCESS) - -// -// Start Type -// - -#define SERVICE_BOOT_START 0x00000000 -#define SERVICE_SYSTEM_START 0x00000001 -#define SERVICE_AUTO_START 0x00000002 -#define SERVICE_DEMAND_START 0x00000003 -#define SERVICE_DISABLED 0x00000004 - -// -// Error control type -// -#define SERVICE_ERROR_IGNORE 0x00000000 -#define SERVICE_ERROR_NORMAL 0x00000001 -#define SERVICE_ERROR_SEVERE 0x00000002 -#define SERVICE_ERROR_CRITICAL 0x00000003 - -// -// -// Define the registry driver node enumerations -// - -typedef enum _CM_SERVICE_NODE_TYPE { - DriverType = SERVICE_KERNEL_DRIVER, - FileSystemType = SERVICE_FILE_SYSTEM_DRIVER, - Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS, - Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS, - AdapterType = SERVICE_ADAPTER, - RecognizerType = SERVICE_RECOGNIZER_DRIVER -} SERVICE_NODE_TYPE; - -typedef enum _CM_SERVICE_LOAD_TYPE { - BootLoad = SERVICE_BOOT_START, - SystemLoad = SERVICE_SYSTEM_START, - AutoLoad = SERVICE_AUTO_START, - DemandLoad = SERVICE_DEMAND_START, - DisableLoad = SERVICE_DISABLED -} SERVICE_LOAD_TYPE; - -typedef enum _CM_ERROR_CONTROL_TYPE { - IgnoreError = SERVICE_ERROR_IGNORE, - NormalError = SERVICE_ERROR_NORMAL, - SevereError = SERVICE_ERROR_SEVERE, - CriticalError = SERVICE_ERROR_CRITICAL -} SERVICE_ERROR_TYPE; - -// -// Service node Flags. These flags are used by the OS loader to promote -// a driver's start type to boot start if the system is booting using -// the specified mechanism. The flags should be set in the driver's -// registry configuration. -// -// CM_SERVICE_NETWORK_BOOT_LOAD - Specified if a driver should be -// promoted on network boot. -// -// CM_SERVICE_VIRTUAL_DISK_BOOT_LOAD - Specified if a driver should be -// promoted on booting from a VHD. -// -// CM_SERVICE_USB_DISK_BOOT_LOAD - Specified if a driver should be promoted -// while booting from a USB disk. -// - -#define CM_SERVICE_NETWORK_BOOT_LOAD 0x00000001 -#define CM_SERVICE_VIRTUAL_DISK_BOOT_LOAD 0x00000002 -#define CM_SERVICE_USB_DISK_BOOT_LOAD 0x00000004 - -// -// Mask defining the legal promotion flag values. -// - -#define CM_SERVICE_VALID_PROMOTION_MASK (CM_SERVICE_NETWORK_BOOT_LOAD | \ - CM_SERVICE_VIRTUAL_DISK_BOOT_LOAD | \ - CM_SERVICE_USB_DISK_BOOT_LOAD) - - - -// -// Resource List definitions -// - - - -// -// Defines the Type in the RESOURCE_DESCRIPTOR -// -// NOTE: For all CM_RESOURCE_TYPE values, there must be a -// corresponding ResType value in the 32-bit ConfigMgr headerfile -// (cfgmgr32.h). Values in the range [0x6,0x80) use the same values -// as their ConfigMgr counterparts. CM_RESOURCE_TYPE values with -// the high bit set (i.e., in the range [0x80,0xFF]), are -// non-arbitrated resources. These correspond to the same values -// in cfgmgr32.h that have their high bit set (however, since -// cfgmgr32.h uses 16 bits for ResType values, these values are in -// the range [0x8000,0x807F). Note that ConfigMgr ResType values -// cannot be in the range [0x8080,0xFFFF), because they would not -// be able to map into CM_RESOURCE_TYPE values. (0xFFFF itself is -// a special value, because it maps to CmResourceTypeDeviceSpecific.) -// - -typedef int CM_RESOURCE_TYPE; - -// CmResourceTypeNull is reserved - -#define CmResourceTypeNull 0 // ResType_All or ResType_None (0x0000) -#define CmResourceTypePort 1 // ResType_IO (0x0002) -#define CmResourceTypeInterrupt 2 // ResType_IRQ (0x0004) -#define CmResourceTypeMemory 3 // ResType_Mem (0x0001) -#define CmResourceTypeDma 4 // ResType_DMA (0x0003) -#define CmResourceTypeDeviceSpecific 5 // ResType_ClassSpecific (0xFFFF) -#define CmResourceTypeBusNumber 6 // ResType_BusNumber (0x0006) -#define CmResourceTypeMemoryLarge 7 // ResType_MemLarge (0x0007) -#define CmResourceTypeNonArbitrated 128 // Not arbitrated if 0x80 bit set -#define CmResourceTypeConfigData 128 // ResType_Reserved (0x8000) -#define CmResourceTypeDevicePrivate 129 // ResType_DevicePrivate (0x8001) -#define CmResourceTypePcCardConfig 130 // ResType_PcCardConfig (0x8002) -#define CmResourceTypeMfCardConfig 131 // ResType_MfCardConfig (0x8003) - -// -// Defines the ShareDisposition in the RESOURCE_DESCRIPTOR -// - -typedef enum _CM_SHARE_DISPOSITION { - CmResourceShareUndetermined = 0, // Reserved - CmResourceShareDeviceExclusive, - CmResourceShareDriverExclusive, - CmResourceShareShared -} CM_SHARE_DISPOSITION; - -// -// Define the bit masks for Flags when type is CmResourceTypeInterrupt -// - -#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0 -#define CM_RESOURCE_INTERRUPT_LATCHED 1 -#define CM_RESOURCE_INTERRUPT_MESSAGE 2 -#define CM_RESOURCE_INTERRUPT_POLICY_INCLUDED 4 - -// -// A bitmask defining the bits in a resource or requirements descriptor -// flags field that corresponds to the latch mode or a level triggered -// interrupt. -// - -#define CM_RESOURCE_INTERRUPT_LEVEL_LATCHED_BITS 0x0001 - -// -// Define the token value used for an interrupt vector to mean that the vector -// is message signaled. This value is used in the MaximumVector field. -// - -#define CM_RESOURCE_INTERRUPT_MESSAGE_TOKEN ((ULONG)-2) - -// -// Define the bit masks for Flags when type is CmResourceTypeMemory -// or CmResourceTypeMemoryLarge -// - -#define CM_RESOURCE_MEMORY_READ_WRITE 0x0000 -#define CM_RESOURCE_MEMORY_READ_ONLY 0x0001 -#define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002 -#define CM_RESOURCE_MEMORY_WRITEABILITY_MASK 0x0003 -#define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004 - -#define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008 -#define CM_RESOURCE_MEMORY_24 0x0010 -#define CM_RESOURCE_MEMORY_CACHEABLE 0x0020 -#define CM_RESOURCE_MEMORY_WINDOW_DECODE 0x0040 -#define CM_RESOURCE_MEMORY_BAR 0x0080 - -#define CM_RESOURCE_MEMORY_COMPAT_FOR_INACCESSIBLE_RANGE 0x0100 - -// -// Define the bit masks exclusive to type CmResourceTypeMemoryLarge. -// - -#define CM_RESOURCE_MEMORY_LARGE 0x0E00 -#define CM_RESOURCE_MEMORY_LARGE_40 0x0200 -#define CM_RESOURCE_MEMORY_LARGE_48 0x0400 -#define CM_RESOURCE_MEMORY_LARGE_64 0x0800 - -// -// Define limits for large memory resources -// - -#define CM_RESOURCE_MEMORY_LARGE_40_MAXLEN 0x000000FFFFFFFF00 -#define CM_RESOURCE_MEMORY_LARGE_48_MAXLEN 0x0000FFFFFFFF0000 -#define CM_RESOURCE_MEMORY_LARGE_64_MAXLEN 0xFFFFFFFF00000000 - -// -// Define the bit masks for Flags when type is CmResourceTypePort -// - -#define CM_RESOURCE_PORT_MEMORY 0x0000 -#define CM_RESOURCE_PORT_IO 0x0001 -#define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004 -#define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008 -#define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010 -#define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020 -#define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040 -#define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080 -#define CM_RESOURCE_PORT_BAR 0x0100 - -// -// Define the bit masks for Flags when type is CmResourceTypeDma -// - -#define CM_RESOURCE_DMA_8 0x0000 -#define CM_RESOURCE_DMA_16 0x0001 -#define CM_RESOURCE_DMA_32 0x0002 -#define CM_RESOURCE_DMA_8_AND_16 0x0004 -#define CM_RESOURCE_DMA_BUS_MASTER 0x0008 -#define CM_RESOURCE_DMA_TYPE_A 0x0010 -#define CM_RESOURCE_DMA_TYPE_B 0x0020 -#define CM_RESOURCE_DMA_TYPE_F 0x0040 - - - -// -// This structure defines one type of resource used by a driver. -// -// There can only be *1* DeviceSpecificData block. It must be located at -// the end of all resource descriptors in a full descriptor block. -// - -// -// Make sure alignment is made properly by compiler; otherwise move -// flags back to the top of the structure (common to all members of the -// union). -// - - -#include "pshpack4.h" -typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR { - UCHAR Type; - UCHAR ShareDisposition; - USHORT Flags; - union { - - // - // Range of resources, inclusive. These are physical, bus relative. - // It is known that Port and Memory below have the exact same layout - // as Generic. - // - - struct { - PHYSICAL_ADDRESS Start; - ULONG Length; - } Generic; - - // - // - - struct { - PHYSICAL_ADDRESS Start; - ULONG Length; - } Port; - - // - // - - struct { -#if defined(NT_PROCESSOR_GROUPS) - USHORT Level; - USHORT Group; -#else - ULONG Level; -#endif - ULONG Vector; - KAFFINITY Affinity; - } Interrupt; - - // - // Values for message signaled interrupts are distinct in the - // raw and translated cases. - // - - struct { - union { - struct { -#if defined(NT_PROCESSOR_GROUPS) - USHORT Group; -#else - USHORT Reserved; -#endif - USHORT MessageCount; - ULONG Vector; - KAFFINITY Affinity; - } Raw; - - struct { -#if defined(NT_PROCESSOR_GROUPS) - USHORT Level; - USHORT Group; -#else - ULONG Level; -#endif - ULONG Vector; - KAFFINITY Affinity; - } Translated; - } DUMMYUNIONNAME; - } MessageInterrupt; - - // - // Range of memory addresses, inclusive. These are physical, bus - // relative. The value should be the same as the one passed to - // HalTranslateBusAddress(). - // - - struct { - PHYSICAL_ADDRESS Start; // 64 bit physical addresses. - ULONG Length; - } Memory; - - // - // Physical DMA channel. - // - - struct { - ULONG Channel; - ULONG Port; - ULONG Reserved1; - } Dma; - - // - // Device driver private data, usually used to help it figure - // what the resource assignments decisions that were made. - // - - struct { - ULONG Data[3]; - } DevicePrivate; - - // - // Bus Number information. - // - - struct { - ULONG Start; - ULONG Length; - ULONG Reserved; - } BusNumber; - - // - // Device Specific information defined by the driver. - // The DataSize field indicates the size of the data in bytes. The - // data is located immediately after the DeviceSpecificData field in - // the structure. - // - - struct { - ULONG DataSize; - ULONG Reserved1; - ULONG Reserved2; - } DeviceSpecificData; - - // The following structures provide support for memory-mapped - // IO resources greater than MAXULONG - struct { - PHYSICAL_ADDRESS Start; - ULONG Length40; - } Memory40; - - struct { - PHYSICAL_ADDRESS Start; - ULONG Length48; - } Memory48; - - struct { - PHYSICAL_ADDRESS Start; - ULONG Length64; - } Memory64; - - - } u; -} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR; -#include "poppack.h" - -// -// A Partial Resource List is what can be found in the ARC firmware -// or will be generated by ntdetect.com. -// The configuration manager will transform this structure into a Full -// resource descriptor when it is about to store it in the regsitry. -// -// Note: There must a be a convention to the order of fields of same type, -// (defined on a device by device basis) so that the fields can make sense -// to a driver (i.e. when multiple memory ranges are necessary). -// - -typedef struct _CM_PARTIAL_RESOURCE_LIST { - USHORT Version; - USHORT Revision; - ULONG Count; - CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]; -} CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST; - -// -// A Full Resource Descriptor is what can be found in the registry. -// This is what will be returned to a driver when it queries the registry -// to get device information; it will be stored under a key in the hardware -// description tree. -// -// Note: There must a be a convention to the order of fields of same type, -// (defined on a device by device basis) so that the fields can make sense -// to a driver (i.e. when multiple memory ranges are necessary). -// - -typedef struct _CM_FULL_RESOURCE_DESCRIPTOR { - INTERFACE_TYPE InterfaceType; // unused for WDM - ULONG BusNumber; // unused for WDM - CM_PARTIAL_RESOURCE_LIST PartialResourceList; -} CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR; - -// -// The Resource list is what will be stored by the drivers into the -// resource map via the IO API. -// - -typedef struct _CM_RESOURCE_LIST { - ULONG Count; - CM_FULL_RESOURCE_DESCRIPTOR List[1]; -} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST; - - -// -// Define the structures used to interpret configuration data of -// \\Registry\machine\hardware\description tree. -// Basically, these structures are used to interpret component -// sepcific data. -// - -// -// Define DEVICE_FLAGS -// - -typedef struct _DEVICE_FLAGS { - ULONG Failed : 1; - ULONG ReadOnly : 1; - ULONG Removable : 1; - ULONG ConsoleIn : 1; - ULONG ConsoleOut : 1; - ULONG Input : 1; - ULONG Output : 1; -} DEVICE_FLAGS, *PDEVICE_FLAGS; - -// -// Define Component Information structure -// - -typedef struct _CM_COMPONENT_INFORMATION { - DEVICE_FLAGS Flags; - ULONG Version; - ULONG Key; - KAFFINITY AffinityMask; -} CM_COMPONENT_INFORMATION, *PCM_COMPONENT_INFORMATION; - -// -// The following structures are used to interpret x86 -// DeviceSpecificData of CM_PARTIAL_RESOURCE_DESCRIPTOR. -// (Most of the structures are defined by BIOS. They are -// not aligned on word (or dword) boundary. -// - -// -// Define the Rom Block structure -// - -typedef struct _CM_ROM_BLOCK { - ULONG Address; - ULONG Size; -} CM_ROM_BLOCK, *PCM_ROM_BLOCK; - - - -#include "pshpack1.h" - - - -// -// Define INT13 driver parameter block -// - -typedef struct _CM_INT13_DRIVE_PARAMETER { - USHORT DriveSelect; - ULONG MaxCylinders; - USHORT SectorsPerTrack; - USHORT MaxHeads; - USHORT NumberDrives; -} CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER; - - - -// -// Define Mca POS data block for slot -// - -typedef struct _CM_MCA_POS_DATA { - USHORT AdapterId; - UCHAR PosData1; - UCHAR PosData2; - UCHAR PosData3; - UCHAR PosData4; -} CM_MCA_POS_DATA, *PCM_MCA_POS_DATA; - -// -// Memory configuration of eisa data block structure -// - -typedef struct _EISA_MEMORY_TYPE { - UCHAR ReadWrite: 1; - UCHAR Cached : 1; - UCHAR Reserved0 :1; - UCHAR Type:2; - UCHAR Shared:1; - UCHAR Reserved1 :1; - UCHAR MoreEntries : 1; -} EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE; - -typedef struct _EISA_MEMORY_CONFIGURATION { - EISA_MEMORY_TYPE ConfigurationByte; - UCHAR DataSize; - USHORT AddressLowWord; - UCHAR AddressHighByte; - USHORT MemorySize; -} EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION; - - -// -// Interrupt configurationn of eisa data block structure -// - -typedef struct _EISA_IRQ_DESCRIPTOR { - UCHAR Interrupt : 4; - UCHAR Reserved :1; - UCHAR LevelTriggered :1; - UCHAR Shared : 1; - UCHAR MoreEntries : 1; -} EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR; - -typedef struct _EISA_IRQ_CONFIGURATION { - EISA_IRQ_DESCRIPTOR ConfigurationByte; - UCHAR Reserved; -} EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION; - - -// -// DMA description of eisa data block structure -// - -typedef struct _DMA_CONFIGURATION_BYTE0 { - UCHAR Channel : 3; - UCHAR Reserved : 3; - UCHAR Shared :1; - UCHAR MoreEntries :1; -} DMA_CONFIGURATION_BYTE0; - -typedef struct _DMA_CONFIGURATION_BYTE1 { - UCHAR Reserved0 : 2; - UCHAR TransferSize : 2; - UCHAR Timing : 2; - UCHAR Reserved1 : 2; -} DMA_CONFIGURATION_BYTE1; - -typedef struct _EISA_DMA_CONFIGURATION { - DMA_CONFIGURATION_BYTE0 ConfigurationByte0; - DMA_CONFIGURATION_BYTE1 ConfigurationByte1; -} EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION; - - -// -// Port description of eisa data block structure -// - -typedef struct _EISA_PORT_DESCRIPTOR { - UCHAR NumberPorts : 5; - UCHAR Reserved :1; - UCHAR Shared :1; - UCHAR MoreEntries : 1; -} EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR; - -typedef struct _EISA_PORT_CONFIGURATION { - EISA_PORT_DESCRIPTOR Configuration; - USHORT PortAddress; -} EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION; - - -// -// Eisa slot information definition -// N.B. This structure is different from the one defined -// in ARC eisa addendum. -// - -typedef struct _CM_EISA_SLOT_INFORMATION { - UCHAR ReturnCode; - UCHAR ReturnFlags; - UCHAR MajorRevision; - UCHAR MinorRevision; - USHORT Checksum; - UCHAR NumberFunctions; - UCHAR FunctionInformation; - ULONG CompressedId; -} CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION; - - -// -// Eisa function information definition -// - -typedef struct _CM_EISA_FUNCTION_INFORMATION { - ULONG CompressedId; - UCHAR IdSlotFlags1; - UCHAR IdSlotFlags2; - UCHAR MinorRevision; - UCHAR MajorRevision; - UCHAR Selections[26]; - UCHAR FunctionFlags; - UCHAR TypeString[80]; - EISA_MEMORY_CONFIGURATION EisaMemory[9]; - EISA_IRQ_CONFIGURATION EisaIrq[7]; - EISA_DMA_CONFIGURATION EisaDma[4]; - EISA_PORT_CONFIGURATION EisaPort[20]; - UCHAR InitializationData[60]; -} CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION; - -// -// The following defines the way pnp bios information is stored in -// the registry \\HKEY_LOCAL_MACHINE\HARDWARE\Description\System\MultifunctionAdapter\x -// key, where x is an integer number indicating adapter instance. The -// "Identifier" of the key must equal to "PNP BIOS" and the -// "ConfigurationData" is organized as follow: -// -// CM_PNP_BIOS_INSTALLATION_CHECK + -// CM_PNP_BIOS_DEVICE_NODE for device 1 + -// CM_PNP_BIOS_DEVICE_NODE for device 2 + -// ... -// CM_PNP_BIOS_DEVICE_NODE for device n -// - -// -// Pnp BIOS device node structure -// - -typedef struct _CM_PNP_BIOS_DEVICE_NODE { - USHORT Size; - UCHAR Node; - ULONG ProductId; - UCHAR DeviceType[3]; - USHORT DeviceAttributes; - // followed by AllocatedResourceBlock, PossibleResourceBlock - // and CompatibleDeviceId -} CM_PNP_BIOS_DEVICE_NODE,*PCM_PNP_BIOS_DEVICE_NODE; - -// -// Pnp BIOS Installation check -// - -typedef struct _CM_PNP_BIOS_INSTALLATION_CHECK { - UCHAR Signature[4]; // $PnP (ascii) - UCHAR Revision; - UCHAR Length; - USHORT ControlField; - UCHAR Checksum; - ULONG EventFlagAddress; // Physical address - USHORT RealModeEntryOffset; - USHORT RealModeEntrySegment; - USHORT ProtectedModeEntryOffset; - ULONG ProtectedModeCodeBaseAddress; - ULONG OemDeviceId; - USHORT RealModeDataBaseAddress; - ULONG ProtectedModeDataBaseAddress; -} CM_PNP_BIOS_INSTALLATION_CHECK, *PCM_PNP_BIOS_INSTALLATION_CHECK; - -#include "poppack.h" - -// -// Masks for EISA function information -// - -#define EISA_FUNCTION_ENABLED 0x80 -#define EISA_FREE_FORM_DATA 0x40 -#define EISA_HAS_PORT_INIT_ENTRY 0x20 -#define EISA_HAS_PORT_RANGE 0x10 -#define EISA_HAS_DMA_ENTRY 0x08 -#define EISA_HAS_IRQ_ENTRY 0x04 -#define EISA_HAS_MEMORY_ENTRY 0x02 -#define EISA_HAS_TYPE_ENTRY 0x01 -#define EISA_HAS_INFORMATION EISA_HAS_PORT_RANGE + \ - EISA_HAS_DMA_ENTRY + \ - EISA_HAS_IRQ_ENTRY + \ - EISA_HAS_MEMORY_ENTRY + \ - EISA_HAS_TYPE_ENTRY - -// -// Masks for EISA memory configuration -// - -#define EISA_MORE_ENTRIES 0x80 -#define EISA_SYSTEM_MEMORY 0x00 -#define EISA_MEMORY_TYPE_RAM 0x01 - -// -// Returned error code for EISA bios call -// - -#define EISA_INVALID_SLOT 0x80 -#define EISA_INVALID_FUNCTION 0x81 -#define EISA_INVALID_CONFIGURATION 0x82 -#define EISA_EMPTY_SLOT 0x83 -#define EISA_INVALID_BIOS_CALL 0x86 - - - -// -// The following structures are used to interpret mips -// DeviceSpecificData of CM_PARTIAL_RESOURCE_DESCRIPTOR. -// - -// -// Device data records for adapters. -// - -// -// The device data record for the Emulex SCSI controller. -// - -typedef struct _CM_SCSI_DEVICE_DATA { - USHORT Version; - USHORT Revision; - UCHAR HostIdentifier; -} CM_SCSI_DEVICE_DATA, *PCM_SCSI_DEVICE_DATA; - -// -// Device data records for controllers. -// - -// -// The device data record for the Video controller. -// - -typedef struct _CM_VIDEO_DEVICE_DATA { - USHORT Version; - USHORT Revision; - ULONG VideoClock; -} CM_VIDEO_DEVICE_DATA, *PCM_VIDEO_DEVICE_DATA; - -// -// The device data record for the SONIC network controller. -// - -typedef struct _CM_SONIC_DEVICE_DATA { - USHORT Version; - USHORT Revision; - USHORT DataConfigurationRegister; - UCHAR EthernetAddress[8]; -} CM_SONIC_DEVICE_DATA, *PCM_SONIC_DEVICE_DATA; - -// -// The device data record for the serial controller. -// - -typedef struct _CM_SERIAL_DEVICE_DATA { - USHORT Version; - USHORT Revision; - ULONG BaudClock; -} CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA; - -// -// Device data records for peripherals. -// - -// -// The device data record for the Monitor peripheral. -// - -typedef struct _CM_MONITOR_DEVICE_DATA { - USHORT Version; - USHORT Revision; - USHORT HorizontalScreenSize; - USHORT VerticalScreenSize; - USHORT HorizontalResolution; - USHORT VerticalResolution; - USHORT HorizontalDisplayTimeLow; - USHORT HorizontalDisplayTime; - USHORT HorizontalDisplayTimeHigh; - USHORT HorizontalBackPorchLow; - USHORT HorizontalBackPorch; - USHORT HorizontalBackPorchHigh; - USHORT HorizontalFrontPorchLow; - USHORT HorizontalFrontPorch; - USHORT HorizontalFrontPorchHigh; - USHORT HorizontalSyncLow; - USHORT HorizontalSync; - USHORT HorizontalSyncHigh; - USHORT VerticalBackPorchLow; - USHORT VerticalBackPorch; - USHORT VerticalBackPorchHigh; - USHORT VerticalFrontPorchLow; - USHORT VerticalFrontPorch; - USHORT VerticalFrontPorchHigh; - USHORT VerticalSyncLow; - USHORT VerticalSync; - USHORT VerticalSyncHigh; -} CM_MONITOR_DEVICE_DATA, *PCM_MONITOR_DEVICE_DATA; - -// -// The device data record for the Floppy peripheral. -// - -typedef struct _CM_FLOPPY_DEVICE_DATA { - USHORT Version; - USHORT Revision; - CHAR Size[8]; - ULONG MaxDensity; - ULONG MountDensity; - // - // New data fields for version >= 2.0 - // - UCHAR StepRateHeadUnloadTime; - UCHAR HeadLoadTime; - UCHAR MotorOffTime; - UCHAR SectorLengthCode; - UCHAR SectorPerTrack; - UCHAR ReadWriteGapLength; - UCHAR DataTransferLength; - UCHAR FormatGapLength; - UCHAR FormatFillCharacter; - UCHAR HeadSettleTime; - UCHAR MotorSettleTime; - UCHAR MaximumTrackValue; - UCHAR DataTransferRate; -} CM_FLOPPY_DEVICE_DATA, *PCM_FLOPPY_DEVICE_DATA; - -// -// The device data record for the Keyboard peripheral. -// The KeyboardFlags is defined (by x86 BIOS INT 16h, function 02) as: -// bit 7 : Insert on -// bit 6 : Caps Lock on -// bit 5 : Num Lock on -// bit 4 : Scroll Lock on -// bit 3 : Alt Key is down -// bit 2 : Ctrl Key is down -// bit 1 : Left shift key is down -// bit 0 : Right shift key is down -// - -typedef struct _CM_KEYBOARD_DEVICE_DATA { - USHORT Version; - USHORT Revision; - UCHAR Type; - UCHAR Subtype; - USHORT KeyboardFlags; -} CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA; - -// -// Declaration of the structure for disk geometries -// - -typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA { - ULONG BytesPerSector; - ULONG NumberOfCylinders; - ULONG SectorsPerTrack; - ULONG NumberOfHeads; -} CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA; - - - -// -// Define the bitmasks for resource options -// - -#define IO_RESOURCE_PREFERRED 0x01 -#define IO_RESOURCE_DEFAULT 0x02 -#define IO_RESOURCE_ALTERNATIVE 0x08 - -// -// Define interrupt affinity policy values -// - -#if defined(NT_PROCESSOR_GROUPS) - -typedef USHORT IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY; -typedef enum _IRQ_DEVICE_POLICY_USHORT { - IrqPolicyMachineDefault = 0, - IrqPolicyAllCloseProcessors = 1, - IrqPolicyOneCloseProcessor = 2, - IrqPolicyAllProcessorsInMachine = 3, - IrqPolicyAllProcessorsInGroup = 3, - IrqPolicySpecifiedProcessors = 4, - IrqPolicySpreadMessagesAcrossAllProcessors = 5 -}; - -#else - -typedef enum _IRQ_DEVICE_POLICY { - IrqPolicyMachineDefault = 0, - IrqPolicyAllCloseProcessors, - IrqPolicyOneCloseProcessor, - IrqPolicyAllProcessorsInMachine, - IrqPolicySpecifiedProcessors, - IrqPolicySpreadMessagesAcrossAllProcessors -} IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY; - -#endif - -// -// Define interrupt priority policy values -// - -typedef enum _IRQ_PRIORITY { - IrqPriorityUndefined = 0, - IrqPriorityLow, - IrqPriorityNormal, - IrqPriorityHigh -} IRQ_PRIORITY, *PIRQ_PRIORITY; - -// -// Define interrupt group affinity policy -// - -typedef enum _IRQ_GROUP_POLICY { - GroupAffinityAllGroupZero = 0, - GroupAffinityDontCare -} IRQ_GROUP_POLICY, *PIRQ_GROUP_POLICY; - -// -// This structure defines one type of resource requested by the driver -// - -typedef struct _IO_RESOURCE_DESCRIPTOR { - UCHAR Option; - UCHAR Type; // use CM_RESOURCE_TYPE - UCHAR ShareDisposition; // use CM_SHARE_DISPOSITION - UCHAR Spare1; - USHORT Flags; // use CM resource flag defines - USHORT Spare2; // align - - union { - struct { - ULONG Length; - ULONG Alignment; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Port; - - struct { - ULONG Length; - ULONG Alignment; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Memory; - - struct { - ULONG MinimumVector; - ULONG MaximumVector; -#if defined(NT_PROCESSOR_GROUPS) - IRQ_DEVICE_POLICY AffinityPolicy; - USHORT Group; -#else - IRQ_DEVICE_POLICY AffinityPolicy; -#endif - IRQ_PRIORITY PriorityPolicy; - KAFFINITY TargetedProcessors; - } Interrupt; - - struct { - ULONG MinimumChannel; - ULONG MaximumChannel; - } Dma; - - struct { - ULONG Length; - ULONG Alignment; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Generic; - - struct { - ULONG Data[3]; - } DevicePrivate; - - // - // Bus Number information. - // - - struct { - ULONG Length; - ULONG MinBusNumber; - ULONG MaxBusNumber; - ULONG Reserved; - } BusNumber; - - struct { - ULONG Priority; // use LCPRI_Xxx values in cfg.h - ULONG Reserved1; - ULONG Reserved2; - } ConfigData; - - // - // The following structures provide descriptions - // for memory resource requirement greater than MAXULONG - // - - struct { - ULONG Length40; - ULONG Alignment40; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Memory40; - - struct { - ULONG Length48; - ULONG Alignment48; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Memory48; - - struct { - ULONG Length64; - ULONG Alignment64; - PHYSICAL_ADDRESS MinimumAddress; - PHYSICAL_ADDRESS MaximumAddress; - } Memory64; - - - } u; - -} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR; - - - - -typedef struct _IO_RESOURCE_LIST { - USHORT Version; - USHORT Revision; - - ULONG Count; - IO_RESOURCE_DESCRIPTOR Descriptors[1]; -} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST; - - -typedef struct _IO_RESOURCE_REQUIREMENTS_LIST { - ULONG ListSize; - INTERFACE_TYPE InterfaceType; // unused for WDM - ULONG BusNumber; // unused for WDM - ULONG SlotNumber; - ULONG Reserved[3]; - ULONG AlternativeLists; - IO_RESOURCE_LIST List[1]; -} IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST; - -// -// for move macros -// -#ifdef _MAC -#ifndef _INC_STRING -#include -#endif /* _INC_STRING */ -#else -#include -#endif // _MAC - - -#ifndef _SLIST_HEADER_ -#define _SLIST_HEADER_ - -#if defined(_WIN64) - -// -// The type SINGLE_LIST_ENTRY is not suitable for use with SLISTs. For -// WIN64, an entry on an SLIST is required to be 16-byte aligned, while a -// SINGLE_LIST_ENTRY structure has only 8 byte alignment. -// -// Therefore, all SLIST code should use the SLIST_ENTRY type instead of the -// SINGLE_LIST_ENTRY type. -// - -#pragma warning(push) -#pragma warning(disable:4324) // structure padded due to align() -typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY *PSLIST_ENTRY; -typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY { - PSLIST_ENTRY Next; -} SLIST_ENTRY; -#pragma warning(pop) - -typedef struct _SLIST_ENTRY32 { - ULONG Next; -} SLIST_ENTRY32, *PSLIST_ENTRY32; - -#else - -#define SLIST_ENTRY SINGLE_LIST_ENTRY -#define _SLIST_ENTRY _SINGLE_LIST_ENTRY -#define PSLIST_ENTRY PSINGLE_LIST_ENTRY - -typedef SLIST_ENTRY SLIST_ENTRY32, *PSLIST_ENTRY32; - -#endif // _WIN64 - -#if defined(_WIN64) - -typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER { - struct { // original struct - ULONGLONG Alignment; - ULONGLONG Region; - } DUMMYSTRUCTNAME; - struct { // 8-byte header - ULONGLONG Depth:16; - ULONGLONG Sequence:9; - ULONGLONG NextEntry:39; - ULONGLONG HeaderType:1; // 0: 8-byte; 1: 16-byte - ULONGLONG Init:1; // 0: uninitialized; 1: initialized - ULONGLONG Reserved:59; - ULONGLONG Region:3; - } Header8; - struct { // ia64 16-byte header - ULONGLONG Depth:16; - ULONGLONG Sequence:48; - ULONGLONG HeaderType:1; // 0: 8-byte; 1: 16-byte - ULONGLONG Init:1; // 0: uninitialized; 1: initialized - ULONGLONG Reserved:2; - ULONGLONG NextEntry:60; // last 4 bits are always 0's - } Header16; - struct { // x64 16-byte header - ULONGLONG Depth:16; - ULONGLONG Sequence:48; - ULONGLONG HeaderType:1; // 0: 8-byte; 1: 16-byte - ULONGLONG Reserved:3; - ULONGLONG NextEntry:60; // last 4 bits are always 0's - } HeaderX64; -} SLIST_HEADER, *PSLIST_HEADER; - -typedef union _SLIST_HEADER32{ - ULONGLONG Alignment; - struct { - SLIST_ENTRY32 Next; - USHORT Depth; - USHORT Sequence; - } DUMMYSTRUCTNAME; -} SLIST_HEADER32, *PSLIST_HEADER32; - -#else - -typedef union _SLIST_HEADER { - ULONGLONG Alignment; - struct { - SLIST_ENTRY Next; - USHORT Depth; - USHORT Sequence; - } DUMMYSTRUCTNAME; -} SLIST_HEADER, *PSLIST_HEADER; - -typedef SLIST_HEADER SLIST_HEADER32, *PSLIST_HEADER32; - -#endif // _WIN64 - -#endif // _SLIST_HEADER_ - -// -// If debugging support enabled, define an ASSERT macro that works. Otherwise -// define the ASSERT macro to expand to an empty expression. -// -// The ASSERT macro has been updated to be an expression instead of a statement. -// - -NTSYSAPI -VOID -NTAPI -RtlAssert( - __in PVOID VoidFailedAssertion, - __in PVOID VoidFileName, - __in ULONG LineNumber, - __in_opt PSTR MutableMessage - ); - -#if DBG - -#define ASSERT( exp ) \ - ((!(exp)) ? \ - (RtlAssert( #exp, __FILE__, __LINE__, NULL ),FALSE) : \ - TRUE) - -#define ASSERTMSG( msg, exp ) \ - ((!(exp)) ? \ - (RtlAssert( #exp, __FILE__, __LINE__, msg ),FALSE) : \ - TRUE) - -#define RTL_SOFT_ASSERT(_exp) \ - ((!(_exp)) ? \ - (DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n", __FILE__, __LINE__, #_exp),FALSE) : \ - TRUE) - -#define RTL_SOFT_ASSERTMSG(_msg, _exp) \ - ((!(_exp)) ? \ - (DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n Message: %s\n", __FILE__, __LINE__, #_exp, (_msg)),FALSE) : \ - TRUE) - -#if _MSC_VER >= 1300 - -#define NT_ASSERT(_exp) \ - ((!(_exp)) ? \ - (__annotation(L"Debug", L"AssertFail", L#_exp), \ - DbgRaiseAssertionFailure(), FALSE) : \ - TRUE) - -#define NT_ASSERTMSG(_msg, _exp) \ - ((!(_exp)) ? \ - (__annotation(L"Debug", L"AssertFail", L##_msg), \ - DbgRaiseAssertionFailure(), FALSE) : \ - TRUE) - -#define NT_ASSERTMSGW(_msg, _exp) \ - ((!(_exp)) ? \ - (__annotation(L"Debug", L"AssertFail", _msg), \ - DbgRaiseAssertionFailure(), FALSE) : \ - TRUE) - -#define NT_VERIFY NT_ASSERT -#define NT_VERIFYMSG NT_ASSERTMSG -#define NT_VERIFYMSGW NT_ASSERTMSGW - -#endif // #if _MSC_VER >= 1300 - -#define RTL_VERIFY ASSERT -#define RTL_VERIFYMSG ASSERTMSG - -#define RTL_SOFT_VERIFY RTL_SOFT_ASSERT -#define RTL_SOFT_VERIFYMSG RTL_SOFT_ASSERTMSG - -#else -#define ASSERT( exp ) ((void) 0) -#define ASSERTMSG( msg, exp ) ((void) 0) - -#if _MSC_VER >= 1300 - -#define NT_ASSERT(_exp) ((void) 0) -#define NT_ASSERTMSG(_msg, _exp) ((void) 0) -#define NT_ASSERTMSGW(_msg, _exp) ((void) 0) - -#define NT_VERIFY(_exp) ((_exp) ? TRUE : FALSE) -#define NT_VERIFYMSG(_msg, _exp ) ((_exp) ? TRUE : FALSE) -#define NT_VERIFYMSGW(_msg, _exp) ((_exp) ? TRUE : FALSE) - -#endif // #if _MSC_VER >= 1300 - -#define RTL_SOFT_ASSERT(_exp) ((void) 0) -#define RTL_SOFT_ASSERTMSG(_msg, _exp) ((void) 0) - -#define RTL_VERIFY( exp ) ((exp) ? TRUE : FALSE) -#define RTL_VERIFYMSG( msg, exp ) ((exp) ? TRUE : FALSE) - -#define RTL_SOFT_VERIFY(_exp) ((_exp) ? TRUE : FALSE) -#define RTL_SOFT_VERIFYMSG(msg, _exp) ((_exp) ? TRUE : FALSE) - -#endif // DBG - -// -// Doubly-linked list manipulation routines. -// - - -// -// VOID -// InitializeListHead32( -// PLIST_ENTRY32 ListHead -// ); -// - -#define InitializeListHead32(ListHead) (\ - (ListHead)->Flink = (ListHead)->Blink = PtrToUlong((ListHead))) - -#if !defined(MIDL_PASS) && !defined(SORTPP_PASS) - -#define RTL_STATIC_LIST_HEAD(x) LIST_ENTRY x = { &x, &x } - -FORCEINLINE -VOID -InitializeListHead( - __out PLIST_ENTRY ListHead - ) -{ - ListHead->Flink = ListHead->Blink = ListHead; -} - -__checkReturn -BOOLEAN -FORCEINLINE -IsListEmpty( - __in const LIST_ENTRY * ListHead - ) -{ - return (BOOLEAN)(ListHead->Flink == ListHead); -} - -FORCEINLINE -BOOLEAN -RemoveEntryList( - __in PLIST_ENTRY Entry - ) -{ - PLIST_ENTRY Blink; - PLIST_ENTRY Flink; - - Flink = Entry->Flink; - Blink = Entry->Blink; - Blink->Flink = Flink; - Flink->Blink = Blink; - return (BOOLEAN)(Flink == Blink); -} - -FORCEINLINE -PLIST_ENTRY -RemoveHeadList( - __inout PLIST_ENTRY ListHead - ) -{ - PLIST_ENTRY Flink; - PLIST_ENTRY Entry; - - Entry = ListHead->Flink; - Flink = Entry->Flink; - ListHead->Flink = Flink; - Flink->Blink = ListHead; - return Entry; -} - - - -FORCEINLINE -PLIST_ENTRY -RemoveTailList( - __inout PLIST_ENTRY ListHead - ) -{ - PLIST_ENTRY Blink; - PLIST_ENTRY Entry; - - Entry = ListHead->Blink; - Blink = Entry->Blink; - ListHead->Blink = Blink; - Blink->Flink = ListHead; - return Entry; -} - - -FORCEINLINE -VOID -InsertTailList( - __inout PLIST_ENTRY ListHead, - __inout __drv_aliasesMem PLIST_ENTRY Entry - ) -{ - PLIST_ENTRY Blink; - - Blink = ListHead->Blink; - Entry->Flink = ListHead; - Entry->Blink = Blink; - Blink->Flink = Entry; - ListHead->Blink = Entry; -} - - -FORCEINLINE -VOID -InsertHeadList( - __inout PLIST_ENTRY ListHead, - __inout __drv_aliasesMem PLIST_ENTRY Entry - ) -{ - PLIST_ENTRY Flink; - - Flink = ListHead->Flink; - Entry->Flink = Flink; - Entry->Blink = ListHead; - Flink->Blink = Entry; - ListHead->Flink = Entry; -} - -FORCEINLINE -VOID -AppendTailList( - __inout PLIST_ENTRY ListHead, - __inout PLIST_ENTRY ListToAppend - ) -{ - PLIST_ENTRY ListEnd = ListHead->Blink; - - ListHead->Blink->Flink = ListToAppend; - ListHead->Blink = ListToAppend->Blink; - ListToAppend->Blink->Flink = ListHead; - ListToAppend->Blink = ListEnd; -} - -FORCEINLINE -PSINGLE_LIST_ENTRY -PopEntryList( - __inout PSINGLE_LIST_ENTRY ListHead - ) -{ - PSINGLE_LIST_ENTRY FirstEntry; - FirstEntry = ListHead->Next; - if (FirstEntry != NULL) { - ListHead->Next = FirstEntry->Next; - } - - return FirstEntry; -} - - -FORCEINLINE -VOID -PushEntryList( - __inout PSINGLE_LIST_ENTRY ListHead, - __inout __drv_aliasesMem PSINGLE_LIST_ENTRY Entry - ) -{ - Entry->Next = ListHead->Next; - ListHead->Next = Entry; -} - -#endif // !MIDL_PASS - -// -// Subroutines for dealing with the Registry -// - -typedef -__drv_functionClass(RTL_QUERY_REGISTRY_ROUTINE) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -NTSTATUS -NTAPI -RTL_QUERY_REGISTRY_ROUTINE( - __in_z PWSTR ValueName, - __in ULONG ValueType, - __in_bcount_opt(ValueLength) PVOID ValueData, - __in ULONG ValueLength, - __in_opt PVOID Context, - __in_opt PVOID EntryContext - ); -typedef RTL_QUERY_REGISTRY_ROUTINE *PRTL_QUERY_REGISTRY_ROUTINE; - -typedef struct _RTL_QUERY_REGISTRY_TABLE { - PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine; - ULONG Flags; - PWSTR Name; - PVOID EntryContext; - ULONG DefaultType; - PVOID DefaultData; - ULONG DefaultLength; - -} RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE; - - -// -// The following flags specify how the Name field of a RTL_QUERY_REGISTRY_TABLE -// entry is interpreted. A NULL name indicates the end of the table. -// - -#define RTL_QUERY_REGISTRY_SUBKEY 0x00000001 // Name is a subkey and remainder of - // table or until next subkey are value - // names for that subkey to look at. - -#define RTL_QUERY_REGISTRY_TOPKEY 0x00000002 // Reset current key to original key for - // this and all following table entries. - -#define RTL_QUERY_REGISTRY_REQUIRED 0x00000004 // Fail if no match found for this table - // entry. - -#define RTL_QUERY_REGISTRY_NOVALUE 0x00000008 // Used to mark a table entry that has no - // value name, just wants a call out, not - // an enumeration of all values. - -#define RTL_QUERY_REGISTRY_NOEXPAND 0x00000010 // Used to suppress the expansion of - // REG_MULTI_SZ into multiple callouts or - // to prevent the expansion of environment - // variable values in REG_EXPAND_SZ - -#define RTL_QUERY_REGISTRY_DIRECT 0x00000020 // QueryRoutine field ignored. EntryContext - // field points to location to store value. - // For null terminated strings, EntryContext - // points to UNICODE_STRING structure that - // that describes maximum size of buffer. - // If .Buffer field is NULL then a buffer is - // allocated. - // - -#define RTL_QUERY_REGISTRY_DELETE 0x00000040 // Used to delete value keys after they - // are queried. - -#define RTL_QUERY_REGISTRY_NOSTRING 0x00000080 // Used with RTL_QUERY_REGISTRY_DIRECT in - // cases where the caller expects a - // non-string value. Otherwise, the - // assumption that EntryContext points to - // a UNICODE_STRING structure can overrun - // the caller's buffer. - // - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlQueryRegistryValues( - __in ULONG RelativeTo, - __in PCWSTR Path, - __inout __drv_at(*(*QueryTable).EntryContext, __out) - PRTL_QUERY_REGISTRY_TABLE QueryTable, - __in_opt PVOID Context, - __in_opt PVOID Environment - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlWriteRegistryValue( - __in ULONG RelativeTo, - __in PCWSTR Path, - __in_z PCWSTR ValueName, - __in ULONG ValueType, - __in_bcount_opt(ValueLength) PVOID ValueData, - __in ULONG ValueLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlDeleteRegistryValue( - __in ULONG RelativeTo, - __in PCWSTR Path, - __in_z PCWSTR ValueName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlCreateRegistryKey( - __in ULONG RelativeTo, - __in PWSTR Path - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlCheckRegistryKey( - __in ULONG RelativeTo, - __in PWSTR Path - ); -#endif - -// -// The following values for the RelativeTo parameter determine what the -// Path parameter to RtlQueryRegistryValues is relative to. -// - -#define RTL_REGISTRY_ABSOLUTE 0 // Path is a full path -#define RTL_REGISTRY_SERVICES 1 // \Registry\Machine\System\CurrentControlSet\Services -#define RTL_REGISTRY_CONTROL 2 // \Registry\Machine\System\CurrentControlSet\Control -#define RTL_REGISTRY_WINDOWS_NT 3 // \Registry\Machine\Software\Microsoft\Windows NT\CurrentVersion -#define RTL_REGISTRY_DEVICEMAP 4 // \Registry\Machine\Hardware\DeviceMap -#define RTL_REGISTRY_USER 5 // \Registry\User\CurrentUser -#define RTL_REGISTRY_MAXIMUM 6 -#define RTL_REGISTRY_HANDLE 0x40000000 // Low order bits are registry handle -#define RTL_REGISTRY_OPTIONAL 0x80000000 // Indicates the key node is optional - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlIntegerToUnicodeString ( - __in ULONG Value, - __in_opt ULONG Base, - __inout PUNICODE_STRING String - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlInt64ToUnicodeString ( - __in ULONGLONG Value, - __in_opt ULONG Base, - __inout PUNICODE_STRING String - ); -#endif - -#ifdef _WIN64 -#define RtlIntPtrToUnicodeString(Value, Base, String) RtlInt64ToUnicodeString(Value, Base, String) -#else -#define RtlIntPtrToUnicodeString(Value, Base, String) RtlIntegerToUnicodeString(Value, Base, String) -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlUnicodeStringToInteger ( - __in PCUNICODE_STRING String, - __in_opt ULONG Base, - __out PULONG Value - ); -#endif - -// -// String manipulation routines -// - -#ifdef _NTSYSTEM_ - -#define NLS_MB_CODE_PAGE_TAG NlsMbCodePageTag -#define NLS_MB_OEM_CODE_PAGE_TAG NlsMbOemCodePageTag - -#else - -#define NLS_MB_CODE_PAGE_TAG (*NlsMbCodePageTag) -#define NLS_MB_OEM_CODE_PAGE_TAG (*NlsMbOemCodePageTag) - -#endif // _NTSYSTEM_ - -extern BOOLEAN NLS_MB_CODE_PAGE_TAG; // TRUE -> Multibyte CP, FALSE -> Singlebyte -extern BOOLEAN NLS_MB_OEM_CODE_PAGE_TAG; // TRUE -> Multibyte CP, FALSE -> Singlebyte - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlInitString( - __out PSTRING DestinationString, - __in_z_opt __drv_aliasesMem PCSZ SourceString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlInitAnsiString( - __out PANSI_STRING DestinationString, - __in_z_opt __drv_aliasesMem PCSZ SourceString - ); -#endif - -__drv_maxIRQL(DISPATCH_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlInitUnicodeString( - __out PUNICODE_STRING DestinationString, - __in_z_opt __drv_aliasesMem PCWSTR SourceString - ); - -#if !defined(MIDL_PASS) -FORCEINLINE -VOID -RtlInitEmptyUnicodeString( - __out PUNICODE_STRING UnicodeString, - __bcount_opt(BufferSize) __drv_aliasesMem PWCHAR Buffer, - __in USHORT BufferSize - ) -{ - UnicodeString->Length = 0; - UnicodeString->MaximumLength = BufferSize; - UnicodeString->Buffer = Buffer; -} - -FORCEINLINE -VOID -RtlInitEmptyAnsiString( - __out PANSI_STRING AnsiString, - __bcount_opt(BufferSize) __drv_aliasesMem PCHAR Buffer, - __in USHORT BufferSize - ) -{ - AnsiString->Length = 0; - AnsiString->MaximumLength = BufferSize; - AnsiString->Buffer = Buffer; -} -#endif // !defined(MIDL_PASS) - -// -// NLS String functions -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlAnsiStringToUnicodeString( - __drv_when(AllocateDestinationString, __out __drv_at(DestinationString->Buffer, __drv_allocatesMem(Mem))) - __drv_when(!AllocateDestinationString, __inout) - PUNICODE_STRING DestinationString, - __in PCANSI_STRING SourceString, - __in BOOLEAN AllocateDestinationString - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when(AllocateDestinationString, __checkReturn) -NTSYSAPI -NTSTATUS -NTAPI -RtlUnicodeStringToAnsiString( - __drv_when(AllocateDestinationString, __out __drv_at(DestinationString->Buffer, __drv_allocatesMem(Mem))) - __drv_when(!AllocateDestinationString, __inout) - PANSI_STRING DestinationString, - __in PCUNICODE_STRING SourceString, - __in BOOLEAN AllocateDestinationString - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -LONG -NTAPI -RtlCompareUnicodeStrings( - __in_ecount(String1Length) PCWCH String1, - __in SIZE_T String1Length, - __in_ecount(String2Length) PCWCH String2, - __in SIZE_T String2Length, - __in BOOLEAN CaseInSensitive - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -LONG -NTAPI -RtlCompareUnicodeString( - __in PCUNICODE_STRING String1, - __in PCUNICODE_STRING String2, - __in BOOLEAN CaseInSensitive - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlEqualUnicodeString( - __in PCUNICODE_STRING String1, - __in PCUNICODE_STRING String2, - __in BOOLEAN CaseInSensitive - ); -#endif - -#define HASH_STRING_ALGORITHM_DEFAULT (0) -#define HASH_STRING_ALGORITHM_X65599 (1) -#define HASH_STRING_ALGORITHM_INVALID (0xffffffff) - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlHashUnicodeString( - __in PCUNICODE_STRING String, - __in BOOLEAN CaseInSensitive, - __in ULONG HashAlgorithm, - __out PULONG HashValue - ); - -#endif // NTDDI_VERSION >= NTDDI_WINXP - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlCopyUnicodeString( - __inout PUNICODE_STRING DestinationString, - __in_opt PCUNICODE_STRING SourceString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -NTSTATUS -NTAPI -RtlAppendUnicodeStringToString ( - __inout PUNICODE_STRING Destination, - __in PCUNICODE_STRING Source - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -NTSTATUS -NTAPI -RtlAppendUnicodeToString ( - __inout PUNICODE_STRING Destination, - __in_z_opt PCWSTR Source - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -WCHAR -NTAPI -RtlUpcaseUnicodeChar( - __in WCHAR SourceCharacter - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -WCHAR -NTAPI -RtlDowncaseUnicodeChar( - __in WCHAR SourceCharacter - ); -#endif - -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlFreeUnicodeString( - __inout __drv_at(UnicodeString->Buffer, __drv_freesMem(Mem)) - PUNICODE_STRING UnicodeString - ); - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlFreeAnsiString( - __inout __drv_at(AnsiString->Buffer, __drv_freesMem(Mem)) - PANSI_STRING AnsiString - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -ULONG -NTAPI -RtlxUnicodeStringToAnsiSize( - __in PCUNICODE_STRING UnicodeString - ); -#endif - -// -// NTSYSAPI -// ULONG -// NTAPI -// RtlUnicodeStringToAnsiSize( -// PUNICODE_STRING UnicodeString -// ); -// - -#define RtlUnicodeStringToAnsiSize(STRING) ( \ - NLS_MB_CODE_PAGE_TAG ? \ - RtlxUnicodeStringToAnsiSize(STRING) : \ - ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \ -) - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -ULONG -NTAPI -RtlxAnsiStringToUnicodeSize( - __in PCANSI_STRING AnsiString - ); -#endif - -// -// NTSYSAPI -// ULONG -// NTAPI -// RtlAnsiStringToUnicodeSize( -// PANSI_STRING AnsiString -// ); -// - -#define RtlAnsiStringToUnicodeSize(STRING) ( \ - NLS_MB_CODE_PAGE_TAG ? \ - RtlxAnsiStringToUnicodeSize(STRING) : \ - ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \ -) - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlUnicodeToUTF8N( - __out_bcount_part(UTF8StringMaxByteCount, *UTF8StringActualByteCount) PCHAR UTF8StringDestination, - __in ULONG UTF8StringMaxByteCount, - __out PULONG UTF8StringActualByteCount, - __in_bcount(UnicodeStringByteCount) PCWCH UnicodeStringSource, - __in ULONG UnicodeStringByteCount - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlUTF8ToUnicodeN( - __out_bcount_part(UnicodeStringMaxByteCount, *UnicodeStringActualByteCount) PWSTR UnicodeStringDestination, - __in ULONG UnicodeStringMaxByteCount, - __out PULONG UnicodeStringActualByteCount, - __in_bcount(UTF8StringByteCount) PCCH UTF8StringSource, - __in ULONG UTF8StringByteCount - ); -#endif - - - -#include - - - -#ifndef DEFINE_GUIDEX - #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name -#endif // !defined(DEFINE_GUIDEX) - -#ifndef STATICGUIDOF - #define STATICGUIDOF(guid) STATIC_##guid -#endif // !defined(STATICGUIDOF) - -#ifndef __IID_ALIGNED__ - #define __IID_ALIGNED__ - #ifdef __cplusplus - inline int IsEqualGUIDAligned(REFGUID guid1, REFGUID guid2) - { - return ((*(PLONGLONG)(&guid1) == *(PLONGLONG)(&guid2)) && (*((PLONGLONG)(&guid1) + 1) == *((PLONGLONG)(&guid2) + 1))); - } - #else // !__cplusplus - #define IsEqualGUIDAligned(guid1, guid2) \ - ((*(PLONGLONG)(guid1) == *(PLONGLONG)(guid2)) && (*((PLONGLONG)(guid1) + 1) == *((PLONGLONG)(guid2) + 1))) - #endif // !__cplusplus -#endif // !__IID_ALIGNED__ - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlStringFromGUID( - __in REFGUID Guid, - __out __drv_at(GuidString->Buffer, __drv_allocatesMem(Mem)) - PUNICODE_STRING GuidString - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTSYSAPI -NTSTATUS -NTAPI -RtlGUIDFromString( - __in PCUNICODE_STRING GuidString, - __out GUID* Guid - ); - -// -// Fast primitives to compare, move, and zero memory -// - - - -#if _DBG_MEMCPY_INLINE_ && !defined(MIDL_PASS) && !defined(_MEMCPY_INLINE_) && !defined(_CRTBLD) -#define _MEMCPY_INLINE_ -FORCEINLINE -PVOID -__cdecl -memcpy_inline ( - __out_bcount_full(size) void *dst, - __in_bcount(size) const void *src, - __in size_t size - ) -{ - // - // Make sure the source and destination do not overlap such that the - // move destroys the destination. - // - if (((char *)dst > (char *)src) && - ((char *)dst < ((char *)src + size))) { - __debugbreak(); - } - return memcpy(dst, src, size); -} -#define memcpy memcpy_inline -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -SIZE_T -NTAPI -RtlCompareMemory ( - __in const VOID *Source1, - __in const VOID *Source2, - __in SIZE_T Length - ); - -#endif - -#define RtlEqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length))) -#define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length)) -#define RtlCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length)) -#define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length)) -#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length)) - - -#if !defined(MIDL_PASS) - -FORCEINLINE -PVOID -RtlSecureZeroMemory( - __out_bcount_full(cnt) PVOID ptr, - __in SIZE_T cnt - ) -{ - volatile char *vptr = (volatile char *)ptr; - -#if defined(_M_AMD64) - - __stosb((PUCHAR)((ULONG64)vptr), 0, cnt); - -#else - - while (cnt) { - *vptr = 0; - vptr++; - cnt--; - } - -#endif - - return ptr; -} - -#endif - - - -#define RtlCopyBytes RtlCopyMemory -#define RtlZeroBytes RtlZeroMemory -#define RtlFillBytes RtlFillMemory - -#if defined(_M_AMD64) - -NTSYSAPI -VOID -NTAPI -RtlCopyMemoryNonTemporal ( - __out_bcount_full(Length) VOID UNALIGNED *Destination, - __in_bcount(Length) CONST VOID UNALIGNED *Source, - __in SIZE_T Length - ); - -#else - -#define RtlCopyMemoryNonTemporal RtlCopyMemory - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2KSP3) -NTSYSAPI -VOID -FASTCALL -RtlPrefetchMemoryNonTemporal( - __in PVOID Source, - __in SIZE_T Length - ); - -#endif - -// -// Define kernel debugger print prototypes and macros. -// -// N.B. The following function cannot be directly imported because there are -// a few places in the source tree where this function is redefined. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -#if (_MSC_FULL_VER >= 150030729) && !defined(IMPORT_NATIVE_DBG_BREAK) - -#define DbgBreakPoint __debugbreak - -#else - -__analysis_noreturn -VOID -NTAPI -DbgBreakPoint( - VOID - ); - -#endif - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__analysis_noreturn -NTSYSAPI -VOID -NTAPI -DbgBreakPointWithStatus( - __in ULONG Status - ); -#endif - -#define DBG_STATUS_CONTROL_C 1 -#define DBG_STATUS_SYSRQ 2 -#define DBG_STATUS_BUGCHECK_FIRST 3 -#define DBG_STATUS_BUGCHECK_SECOND 4 -#define DBG_STATUS_FATAL 5 -#define DBG_STATUS_DEBUG_CONTROL 6 -#define DBG_STATUS_WORKER 7 - -#if DBG - -#define KdPrint(_x_) DbgPrint _x_ -#define KdPrintEx(_x_) DbgPrintEx _x_ -#define vKdPrintEx(_x_) vDbgPrintEx _x_ -#define vKdPrintExWithPrefix(_x_) vDbgPrintExWithPrefix _x_ -#define KdBreakPoint() DbgBreakPoint() - -#define KdBreakPointWithStatus(s) DbgBreakPointWithStatus(s) - -#else - -#define KdPrint(_x_) -#define KdPrintEx(_x_) -#define vKdPrintEx(_x_) -#define vKdPrintExWithPrefix(_x_) -#define KdBreakPoint() - -#define KdBreakPointWithStatus(s) - -#endif // DBG - -#ifndef _DBGNT_ - -ULONG -__cdecl -DbgPrint ( - __in_z __drv_formatString(printf) PCSTR Format, - ... - ); - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -ULONG -__cdecl -DbgPrintEx ( - __in ULONG ComponentId, - __in ULONG Level, - __in_z __drv_formatString(printf) PCSTR Format, - ... - ); -#endif - -#ifdef _VA_LIST_DEFINED - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -ULONG -NTAPI -vDbgPrintEx( - __in ULONG ComponentId, - __in ULONG Level, - __in_z PCCH Format, - __in va_list arglist - ); - -NTSYSAPI -ULONG -NTAPI -vDbgPrintExWithPrefix ( - __in_z PCCH Prefix, - __in ULONG ComponentId, - __in ULONG Level, - __in_z PCCH Format, - __in va_list arglist - ); - -#endif - -#endif // _VA_LIST_DEFINED - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONG -__cdecl -DbgPrintReturnControlC ( - __in_z __drv_formatString(printf) PCCH Format, - ... - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -NTSTATUS -NTAPI -DbgQueryDebugFilterState ( - __in ULONG ComponentId, - __in ULONG Level - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -NTSTATUS -NTAPI -DbgSetDebugFilterState ( - __in ULONG ComponentId, - __in ULONG Level, - __in BOOLEAN State - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef -VOID -(*PDEBUG_PRINT_CALLBACK) ( - __in PSTRING Output, - __in ULONG ComponentId, - __in ULONG Level - ); - -NTSYSAPI -NTSTATUS -NTAPI -DbgSetDebugPrintCallback ( - __in PDEBUG_PRINT_CALLBACK DebugPrintCallback, - __in BOOLEAN Enable - ); -#endif - -#endif // _DBGNT_ - -// -// Large integer arithmetic routines. -// - -// -// Large integer add - 64-bits + 64-bits -> 64-bits -// - - -#if !defined(MIDL_PASS) - - -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlLargeIntegerAdd ( - __in LARGE_INTEGER Addend1, - __in LARGE_INTEGER Addend2 - ) -{ - LARGE_INTEGER Sum; - - Sum.QuadPart = Addend1.QuadPart + Addend2.QuadPart; - return Sum; -} - -// -// Enlarged integer multiply - 32-bits * 32-bits -> 64-bits -// - -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlEnlargedIntegerMultiply ( - __in LONG Multiplicand, - __in LONG Multiplier - ) -{ - LARGE_INTEGER Product; - - Product.QuadPart = (LONGLONG)Multiplicand * (ULONGLONG)Multiplier; - return Product; -} - -// -// Unsigned enlarged integer multiply - 32-bits * 32-bits -> 64-bits -// - -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlEnlargedUnsignedMultiply ( - __in ULONG Multiplicand, - __in ULONG Multiplier - ) -{ - LARGE_INTEGER Product; - - Product.QuadPart = (ULONGLONG)Multiplicand * (ULONGLONG)Multiplier; - return Product; -} - -// -// Enlarged integer divide - 64-bits / 32-bits > 32-bits -// - -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -ULONG -NTAPI_INLINE -RtlEnlargedUnsignedDivide ( - __in ULARGE_INTEGER Dividend, - __in ULONG Divisor, - __out_opt PULONG Remainder - ) -{ - ULONG Quotient; - - Quotient = (ULONG)(Dividend.QuadPart / Divisor); - if (ARGUMENT_PRESENT(Remainder)) { - *Remainder = (ULONG)(Dividend.QuadPart % Divisor); - } - - return Quotient; -} - -// -// Large integer negation - -(64-bits) -// - -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlLargeIntegerNegate ( - __in LARGE_INTEGER Subtrahend - ) -{ - LARGE_INTEGER Difference; - - Difference.QuadPart = -Subtrahend.QuadPart; - return Difference; -} - -// -// Large integer subtract - 64-bits - 64-bits -> 64-bits. -// - -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlLargeIntegerSubtract ( - __in LARGE_INTEGER Minuend, - __in LARGE_INTEGER Subtrahend - ) -{ - LARGE_INTEGER Difference; - - Difference.QuadPart = Minuend.QuadPart - Subtrahend.QuadPart; - return Difference; -} - -// -// Extended large integer magic divide - 64-bits / 32-bits -> 64-bits -// - -#if defined(_AMD64_) - -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlExtendedMagicDivide ( - __in LARGE_INTEGER Dividend, - __in LARGE_INTEGER MagicDivisor, - __in CCHAR ShiftCount - ) - -{ - - LARGE_INTEGER Quotient; - - if (Dividend.QuadPart >= 0) { - Quotient.QuadPart = UnsignedMultiplyHigh(Dividend.QuadPart, - (ULONG64)MagicDivisor.QuadPart); - - } else { - Quotient.QuadPart = UnsignedMultiplyHigh(-Dividend.QuadPart, - (ULONG64)MagicDivisor.QuadPart); - } - - Quotient.QuadPart = (ULONG64)Quotient.QuadPart >> ShiftCount; - if (Dividend.QuadPart < 0) { - Quotient.QuadPart = - Quotient.QuadPart; - } - - return Quotient; -} - -#endif // defined(_AMD64_) - -#if defined(_X86_) || defined(_IA64_) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -NTSYSAPI -LARGE_INTEGER -NTAPI -RtlExtendedMagicDivide ( - __in LARGE_INTEGER Dividend, - __in LARGE_INTEGER MagicDivisor, - __in CCHAR ShiftCount - ); -#endif - -#endif // defined(_X86_) || defined(_IA64_) - - -#if defined(_AMD64_) || defined(_IA64_) - - -// -// Large Integer divide - 64-bits / 32-bits -> 64-bits -// - -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlExtendedLargeIntegerDivide ( - __in LARGE_INTEGER Dividend, - __in ULONG Divisor, - __out_opt PULONG Remainder - ) -{ - LARGE_INTEGER Quotient; - - Quotient.QuadPart = (ULONG64)Dividend.QuadPart / Divisor; - if (ARGUMENT_PRESENT(Remainder)) { - *Remainder = (ULONG)(Dividend.QuadPart % Divisor); - } - - return Quotient; -} - -// -// Extended integer multiply - 32-bits * 64-bits -> 64-bits -// - -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlExtendedIntegerMultiply ( - __in LARGE_INTEGER Multiplicand, - __in LONG Multiplier - ) -{ - LARGE_INTEGER Product; - - Product.QuadPart = Multiplicand.QuadPart * Multiplier; - return Product; -} - - -#else - - -// -// Large Integer divide - 64-bits / 32-bits -> 64-bits -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -NTSYSAPI -LARGE_INTEGER -NTAPI -RtlExtendedLargeIntegerDivide ( - __in LARGE_INTEGER Dividend, - __in ULONG Divisor, - __out_opt PULONG Remainder - ); -#endif - -// -// Extended integer multiply - 32-bits * 64-bits -> 64-bits -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -NTSYSAPI -LARGE_INTEGER -NTAPI -RtlExtendedIntegerMultiply ( - __in LARGE_INTEGER Multiplicand, - __in LONG Multiplier - ); -#endif - - -#endif // defined(_AMD64_) || defined(_IA64_) - - -// -// Large integer and - 64-bite & 64-bits -> 64-bits. -// - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(RtlLargeIntegerAnd) // Use native __int64 math -#endif -#define RtlLargeIntegerAnd(Result, Source, Mask) \ - Result.QuadPart = Source.QuadPart & Mask.QuadPart - -// -// Convert signed integer to large integer. -// - -DECLSPEC_DEPRECATED_DDK_WINXP // Use native __int64 math -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlConvertLongToLargeInteger ( - __in LONG SignedInteger - ) -{ - LARGE_INTEGER Result; - - Result.QuadPart = SignedInteger; - return Result; -} - -// -// Convert unsigned integer to large integer. -// - -DECLSPEC_DEPRECATED_DDK_WINXP // Use native __int64 math -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlConvertUlongToLargeInteger ( - __in ULONG UnsignedInteger - ) -{ - LARGE_INTEGER Result; - - Result.QuadPart = UnsignedInteger; - return Result; -} - -// -// Large integer shift routines. -// - -DECLSPEC_DEPRECATED_DDK_WINXP // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlLargeIntegerShiftLeft ( - __in LARGE_INTEGER LargeInteger, - __in CCHAR ShiftCount - ) -{ - LARGE_INTEGER Result; - - Result.QuadPart = LargeInteger.QuadPart << ShiftCount; - return Result; -} - -DECLSPEC_DEPRECATED_DDK_WINXP // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlLargeIntegerShiftRight ( - __in LARGE_INTEGER LargeInteger, - __in CCHAR ShiftCount - ) -{ - LARGE_INTEGER Result; - - Result.QuadPart = (ULONG64)LargeInteger.QuadPart >> ShiftCount; - return Result; -} - -DECLSPEC_DEPRECATED_DDK_WINXP // Use native __int64 math -__drv_preferredFunction("compiler support for 64 bit", "Obsolete") -__inline -LARGE_INTEGER -NTAPI_INLINE -RtlLargeIntegerArithmeticShift ( - __in LARGE_INTEGER LargeInteger, - __in CCHAR ShiftCount - ) -{ - LARGE_INTEGER Result; - - Result.QuadPart = LargeInteger.QuadPart >> ShiftCount; - return Result; -} - - -// -// Large integer comparison routines. -// - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(RtlLargeIntegerGreaterThan) // Use native __int64 math -#pragma deprecated(RtlLargeIntegerGreaterThanOrEqualTo) // Use native __int64 math -#pragma deprecated(RtlLargeIntegerEqualTo) // Use native __int64 math -#pragma deprecated(RtlLargeIntegerNotEqualTo) // Use native __int64 math -#pragma deprecated(RtlLargeIntegerLessThan) // Use native __int64 math -#pragma deprecated(RtlLargeIntegerLessThanOrEqualTo) // Use native __int64 math -#pragma deprecated(RtlLargeIntegerGreaterThanZero) // Use native __int64 math -#pragma deprecated(RtlLargeIntegerGreaterOrEqualToZero) // Use native __int64 math -#pragma deprecated(RtlLargeIntegerEqualToZero) // Use native __int64 math -#pragma deprecated(RtlLargeIntegerNotEqualToZero) // Use native __int64 math -#pragma deprecated(RtlLargeIntegerLessThanZero) // Use native __int64 math -#pragma deprecated(RtlLargeIntegerLessOrEqualToZero) // Use native __int64 math -#endif - -#define RtlLargeIntegerGreaterThan(X,Y) ( \ - (((X).HighPart == (Y).HighPart) && ((X).LowPart > (Y).LowPart)) || \ - ((X).HighPart > (Y).HighPart) \ -) - -#define RtlLargeIntegerGreaterThanOrEqualTo(X,Y) ( \ - (((X).HighPart == (Y).HighPart) && ((X).LowPart >= (Y).LowPart)) || \ - ((X).HighPart > (Y).HighPart) \ -) - -#define RtlLargeIntegerEqualTo(X,Y) ( \ - !(((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart)) \ -) - -#define RtlLargeIntegerNotEqualTo(X,Y) ( \ - (((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart)) \ -) - -#define RtlLargeIntegerLessThan(X,Y) ( \ - (((X).HighPart == (Y).HighPart) && ((X).LowPart < (Y).LowPart)) || \ - ((X).HighPart < (Y).HighPart) \ -) - -#define RtlLargeIntegerLessThanOrEqualTo(X,Y) ( \ - (((X).HighPart == (Y).HighPart) && ((X).LowPart <= (Y).LowPart)) || \ - ((X).HighPart < (Y).HighPart) \ -) - -#define RtlLargeIntegerGreaterThanZero(X) ( \ - (((X).HighPart == 0) && ((X).LowPart > 0)) || \ - ((X).HighPart > 0 ) \ -) - -#define RtlLargeIntegerGreaterOrEqualToZero(X) ( \ - (X).HighPart >= 0 \ -) - -#define RtlLargeIntegerEqualToZero(X) ( \ - !((X).LowPart | (X).HighPart) \ -) - -#define RtlLargeIntegerNotEqualToZero(X) ( \ - ((X).LowPart | (X).HighPart) \ -) - -#define RtlLargeIntegerLessThanZero(X) ( \ - ((X).HighPart < 0) \ -) - -#define RtlLargeIntegerLessOrEqualToZero(X) ( \ - ((X).HighPart < 0) || !((X).LowPart | (X).HighPart) \ -) - - -#endif // !defined(MIDL_PASS) - - -// -// Time conversion routines -// - -typedef struct _TIME_FIELDS { - CSHORT Year; // range [1601...] - CSHORT Month; // range [1..12] - CSHORT Day; // range [1..31] - CSHORT Hour; // range [0..23] - CSHORT Minute; // range [0..59] - CSHORT Second; // range [0..59] - CSHORT Milliseconds;// range [0..999] - CSHORT Weekday; // range [0..6] == [Sunday..Saturday] -} TIME_FIELDS; -typedef TIME_FIELDS *PTIME_FIELDS; - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlTimeToTimeFields ( - __in PLARGE_INTEGER Time, - __out PTIME_FIELDS TimeFields - ); -#endif - -// -// A time field record (Weekday ignored) -> 64 bit Time value -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__success(return != 0) -NTSYSAPI -BOOLEAN -NTAPI -RtlTimeFieldsToTime ( - __in PTIME_FIELDS TimeFields, - __out PLARGE_INTEGER Time - ); -#endif - -// -// The following macros store and retrieve USHORTS and ULONGS from potentially -// unaligned addresses, avoiding alignment faults. they should probably be -// rewritten in assembler -// - -#define SHORT_SIZE (sizeof(USHORT)) -#define SHORT_MASK (SHORT_SIZE - 1) -#define LONG_SIZE (sizeof(LONG)) -#define LONGLONG_SIZE (sizeof(LONGLONG)) -#define LONG_MASK (LONG_SIZE - 1) -#define LONGLONG_MASK (LONGLONG_SIZE - 1) -#define LOWBYTE_MASK 0x00FF - -#define FIRSTBYTE(VALUE) ((VALUE) & LOWBYTE_MASK) -#define SECONDBYTE(VALUE) (((VALUE) >> 8) & LOWBYTE_MASK) -#define THIRDBYTE(VALUE) (((VALUE) >> 16) & LOWBYTE_MASK) -#define FOURTHBYTE(VALUE) (((VALUE) >> 24) & LOWBYTE_MASK) - -// -// if MIPS Big Endian, order of bytes is reversed. -// - -#define SHORT_LEAST_SIGNIFICANT_BIT 0 -#define SHORT_MOST_SIGNIFICANT_BIT 1 - -#define LONG_LEAST_SIGNIFICANT_BIT 0 -#define LONG_3RD_MOST_SIGNIFICANT_BIT 1 -#define LONG_2ND_MOST_SIGNIFICANT_BIT 2 -#define LONG_MOST_SIGNIFICANT_BIT 3 - -//++ -// -// VOID -// RtlStoreUshort ( -// PUSHORT ADDRESS -// USHORT VALUE -// ) -// -// Routine Description: -// -// This macro stores a USHORT value in at a particular address, avoiding -// alignment faults. -// -// Arguments: -// -// ADDRESS - where to store USHORT value -// VALUE - USHORT to store -// -// Return Value: -// -// none. -// -//-- - -#if defined(_AMD64_) - -#define RtlStoreUshort(ADDRESS,VALUE) \ - *(USHORT UNALIGNED *)(ADDRESS) = (VALUE) - -#else - -#define RtlStoreUshort(ADDRESS,VALUE) \ - if ((ULONG_PTR)(ADDRESS) & SHORT_MASK) { \ - ((PUCHAR) (ADDRESS))[SHORT_LEAST_SIGNIFICANT_BIT] = (UCHAR)(FIRSTBYTE(VALUE)); \ - ((PUCHAR) (ADDRESS))[SHORT_MOST_SIGNIFICANT_BIT ] = (UCHAR)(SECONDBYTE(VALUE)); \ - } \ - else { \ - *((PUSHORT) (ADDRESS)) = (USHORT) VALUE; \ - } - -#endif - -//++ -// -// VOID -// RtlStoreUlong ( -// PULONG ADDRESS -// ULONG VALUE -// ) -// -// Routine Description: -// -// This macro stores a ULONG value in at a particular address, avoiding -// alignment faults. -// -// Arguments: -// -// ADDRESS - where to store ULONG value -// VALUE - ULONG to store -// -// Return Value: -// -// none. -// -// Note: -// Depending on the machine, we might want to call storeushort in the -// unaligned case. -// -//-- - - -#if defined(_AMD64_) - -#define RtlStoreUlong(ADDRESS,VALUE) \ - *(ULONG UNALIGNED *)(ADDRESS) = (VALUE) - -#else - -#define RtlStoreUlong(ADDRESS,VALUE) \ - if ((ULONG_PTR)(ADDRESS) & LONG_MASK) { \ - ((PUCHAR) (ADDRESS))[LONG_LEAST_SIGNIFICANT_BIT ] = (UCHAR)(FIRSTBYTE(VALUE)); \ - ((PUCHAR) (ADDRESS))[LONG_3RD_MOST_SIGNIFICANT_BIT ] = (UCHAR)(SECONDBYTE(VALUE)); \ - ((PUCHAR) (ADDRESS))[LONG_2ND_MOST_SIGNIFICANT_BIT ] = (UCHAR)(THIRDBYTE(VALUE)); \ - ((PUCHAR) (ADDRESS))[LONG_MOST_SIGNIFICANT_BIT ] = (UCHAR)(FOURTHBYTE(VALUE)); \ - } \ - else { \ - *((PULONG) (ADDRESS)) = (ULONG) (VALUE); \ - } - -#endif - -//++ -// -// VOID -// RtlStoreUlonglong ( -// PULONGLONG ADDRESS -// ULONG VALUE -// ) -// -// Routine Description: -// -// This macro stores a ULONGLONG value in at a particular address, avoiding -// alignment faults. -// -// Arguments: -// -// ADDRESS - where to store ULONGLONG value -// VALUE - ULONGLONG to store -// -// Return Value: -// -// none. -// -//-- - -#if defined(_AMD64_) - -#define RtlStoreUlonglong(ADDRESS,VALUE) \ - *(ULONGLONG UNALIGNED *)(ADDRESS) = (VALUE) - -#else - -#define RtlStoreUlonglong(ADDRESS,VALUE) \ - if ((ULONG_PTR)(ADDRESS) & LONGLONG_MASK) { \ - RtlStoreUlong((ULONG_PTR)(ADDRESS), \ - (ULONGLONG)(VALUE) & 0xFFFFFFFF); \ - RtlStoreUlong((ULONG_PTR)(ADDRESS)+sizeof(ULONG), \ - (ULONGLONG)(VALUE) >> 32); \ - } else { \ - *((PULONGLONG)(ADDRESS)) = (ULONGLONG)(VALUE); \ - } - -#endif - -//++ -// -// VOID -// RtlStoreUlongPtr ( -// PULONG_PTR ADDRESS -// ULONG_PTR VALUE -// ) -// -// Routine Description: -// -// This macro stores a ULONG_PTR value in at a particular address, avoiding -// alignment faults. -// -// Arguments: -// -// ADDRESS - where to store ULONG_PTR value -// VALUE - ULONG_PTR to store -// -// Return Value: -// -// none. -// -//-- - -#ifdef _WIN64 - -#define RtlStoreUlongPtr(ADDRESS,VALUE) \ - RtlStoreUlonglong(ADDRESS,VALUE) - -#else - -#define RtlStoreUlongPtr(ADDRESS,VALUE) \ - RtlStoreUlong(ADDRESS,VALUE) - -#endif - -//++ -// -// VOID -// RtlRetrieveUshort ( -// PUSHORT DESTINATION_ADDRESS -// PUSHORT SOURCE_ADDRESS -// ) -// -// Routine Description: -// -// This macro retrieves a USHORT value from the SOURCE address, avoiding -// alignment faults. The DESTINATION address is assumed to be aligned. -// -// Arguments: -// -// DESTINATION_ADDRESS - where to store USHORT value -// SOURCE_ADDRESS - where to retrieve USHORT value from -// -// Return Value: -// -// none. -// -//-- - -#if defined(_AMD64_) - -#define RtlRetrieveUshort(DEST_ADDRESS,SRC_ADDRESS) \ - *(USHORT UNALIGNED *)(DEST_ADDRESS) = *(PUSHORT)(SRC_ADDRESS) - -#else - -#define RtlRetrieveUshort(DEST_ADDRESS,SRC_ADDRESS) \ - if ((ULONG_PTR)SRC_ADDRESS & SHORT_MASK) { \ - ((PUCHAR) (DEST_ADDRESS))[0] = ((PUCHAR) (SRC_ADDRESS))[0]; \ - ((PUCHAR) (DEST_ADDRESS))[1] = ((PUCHAR) (SRC_ADDRESS))[1]; \ - } \ - else { \ - *((PUSHORT) DEST_ADDRESS) = *((PUSHORT) SRC_ADDRESS); \ - } \ - -#endif - -//++ -// -// VOID -// RtlRetrieveUlong ( -// PULONG DESTINATION_ADDRESS -// PULONG SOURCE_ADDRESS -// ) -// -// Routine Description: -// -// This macro retrieves a ULONG value from the SOURCE address, avoiding -// alignment faults. The DESTINATION address is assumed to be aligned. -// -// Arguments: -// -// DESTINATION_ADDRESS - where to store ULONG value -// SOURCE_ADDRESS - where to retrieve ULONG value from -// -// Return Value: -// -// none. -// -// Note: -// Depending on the machine, we might want to call retrieveushort in the -// unaligned case. -// -//-- - -#if defined(_AMD64_) - -#define RtlRetrieveUlong(DEST_ADDRESS,SRC_ADDRESS) \ - *(ULONG UNALIGNED *)(DEST_ADDRESS) = *(PULONG)(SRC_ADDRESS) - -#else - -#define RtlRetrieveUlong(DEST_ADDRESS,SRC_ADDRESS) \ - if ((ULONG_PTR)SRC_ADDRESS & LONG_MASK) { \ - ((PUCHAR) (DEST_ADDRESS))[0] = ((PUCHAR) (SRC_ADDRESS))[0]; \ - ((PUCHAR) (DEST_ADDRESS))[1] = ((PUCHAR) (SRC_ADDRESS))[1]; \ - ((PUCHAR) (DEST_ADDRESS))[2] = ((PUCHAR) (SRC_ADDRESS))[2]; \ - ((PUCHAR) (DEST_ADDRESS))[3] = ((PUCHAR) (SRC_ADDRESS))[3]; \ - } \ - else { \ - *((PULONG) DEST_ADDRESS) = *((PULONG) SRC_ADDRESS); \ - } - -#endif - -// -// BitMap routines. The following structure, routines, and macros are -// for manipulating bitmaps. The user is responsible for allocating a bitmap -// structure (which is really a header) and a buffer (which must be longword -// aligned and multiple longwords in size). -// - -typedef struct _RTL_BITMAP { - ULONG SizeOfBitMap; // Number of bits in bit map - PULONG Buffer; // Pointer to the bit map itself -} RTL_BITMAP; -typedef RTL_BITMAP *PRTL_BITMAP; - -// -// The following routine initializes a new bitmap. It does not alter the -// data currently in the bitmap. This routine must be called before -// any other bitmap routine/macro. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -VOID -NTAPI -RtlInitializeBitMap ( - __out PRTL_BITMAP BitMapHeader, - __in __drv_aliasesMem PULONG BitMapBuffer, - __in ULONG SizeOfBitMap - ); -#endif - -// -// The following three routines clear, set, and test the state of a -// single bit in a bitmap. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -VOID -NTAPI -RtlClearBit ( - __in PRTL_BITMAP BitMapHeader, - __in_range(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTSYSAPI -VOID -NTAPI -RtlSetBit ( - __in PRTL_BITMAP BitMapHeader, - __in_range(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlTestBit ( - __in PRTL_BITMAP BitMapHeader, - __in_range(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber - ); -#endif - -// -// The following two routines either clear or set all of the bits -// in a bitmap. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlClearAllBits ( - __in PRTL_BITMAP BitMapHeader - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlSetAllBits ( - __in PRTL_BITMAP BitMapHeader - ); -#endif - -// -// The following two routines locate a contiguous region of either -// clear or set bits within the bitmap. The region will be at least -// as large as the number specified, and the search of the bitmap will -// begin at the specified hint index (which is a bit index within the -// bitmap, zero based). The return value is the bit index of the located -// region (zero based) or -1 (i.e., 0xffffffff) if such a region cannot -// be located -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__success(return != -1) -__checkReturn -NTSYSAPI -ULONG -NTAPI -RtlFindClearBits ( - __in PRTL_BITMAP BitMapHeader, - __in ULONG NumberToFind, - __in ULONG HintIndex - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__success(return != -1) -__checkReturn -NTSYSAPI -ULONG -NTAPI -RtlFindSetBits ( - __in PRTL_BITMAP BitMapHeader, - __in ULONG NumberToFind, - __in ULONG HintIndex - ); -#endif - -// -// The following two routines locate a contiguous region of either -// clear or set bits within the bitmap and either set or clear the bits -// within the located region. The region will be as large as the number -// specified, and the search for the region will begin at the specified -// hint index (which is a bit index within the bitmap, zero based). The -// return value is the bit index of the located region (zero based) or -// -1 (i.e., 0xffffffff) if such a region cannot be located. If a region -// cannot be located then the setting/clearing of the bitmap is not performed. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__success(return != -1) -NTSYSAPI -ULONG -NTAPI -RtlFindClearBitsAndSet ( - __in PRTL_BITMAP BitMapHeader, - __in ULONG NumberToFind, - __in ULONG HintIndex - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__success(return != -1) -NTSYSAPI -ULONG -NTAPI -RtlFindSetBitsAndClear ( - __in PRTL_BITMAP BitMapHeader, - __in ULONG NumberToFind, - __in ULONG HintIndex - ); -#endif - -// -// The following two routines clear or set bits within a specified region -// of the bitmap. The starting index is zero based. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlClearBits ( - __in PRTL_BITMAP BitMapHeader, - __in_range(0, BitMapHeader->SizeOfBitMap - NumberToClear) ULONG StartingIndex, - __in_range(0, BitMapHeader->SizeOfBitMap - StartingIndex) ULONG NumberToClear - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -VOID -NTAPI -RtlSetBits ( - __in PRTL_BITMAP BitMapHeader, - __in_range(0, BitMapHeader->SizeOfBitMap - NumberToSet) ULONG StartingIndex, - __in_range(0, BitMapHeader->SizeOfBitMap - StartingIndex) ULONG NumberToSet - ); -#endif - -// -// The following routine locates a set of contiguous regions of clear -// bits within the bitmap. The caller specifies whether to return the -// longest runs or just the first found lcoated. The following structure is -// used to denote a contiguous run of bits. The two routines return an array -// of this structure, one for each run located. -// - -typedef struct _RTL_BITMAP_RUN { - - ULONG StartingIndex; - ULONG NumberOfBits; - -} RTL_BITMAP_RUN; -typedef RTL_BITMAP_RUN *PRTL_BITMAP_RUN; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONG -NTAPI -RtlFindClearRuns ( - __in PRTL_BITMAP BitMapHeader, - __out_ecount_part(SizeOfRunArray, return) PRTL_BITMAP_RUN RunArray, - __in_range(>, 0) ULONG SizeOfRunArray, - __in BOOLEAN LocateLongestRuns - ); -#endif - -// -// The following routine locates the longest contiguous region of -// clear bits within the bitmap. The returned starting index value -// denotes the first contiguous region located satisfying our requirements -// The return value is the length (in bits) of the longest region found. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONG -NTAPI -RtlFindLongestRunClear ( - __in PRTL_BITMAP BitMapHeader, - __out PULONG StartingIndex - ); -#endif - -// -// The following routine locates the first contiguous region of -// clear bits within the bitmap. The returned starting index value -// denotes the first contiguous region located satisfying our requirements -// The return value is the length (in bits) of the region found. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONG -NTAPI -RtlFindFirstRunClear ( - __in PRTL_BITMAP BitMapHeader, - __out PULONG StartingIndex - ); -#endif - -// -// The following macro returns the value of the bit stored within the -// bitmap at the specified location. If the bit is set a value of 1 is -// returned otherwise a value of 0 is returned. -// -// ULONG -// RtlCheckBit ( -// PRTL_BITMAP BitMapHeader, -// ULONG BitPosition -// ); -// -// -// To implement CheckBit the macro retrieves the longword containing the -// bit in question, shifts the longword to get the bit in question into the -// low order bit position and masks out all other bits. -// - -#if defined(_M_AMD64) && !defined(MIDL_PASS) - -__checkReturn -FORCEINLINE -BOOLEAN -RtlCheckBit ( - __in PRTL_BITMAP BitMapHeader, - __in_range(<, BitMapHeader->SizeOfBitMap) ULONG BitPosition - ) - -{ - return BitTest64((LONG64 const *)BitMapHeader->Buffer, (LONG64)BitPosition); -} - -#else - -#define RtlCheckBit(BMH,BP) (((((PLONG)(BMH)->Buffer)[(BP) / 32]) >> ((BP) % 32)) & 0x1) - -#endif - -// -// The following two procedures return to the caller the total number of -// clear or set bits within the specified bitmap. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONG -NTAPI -RtlNumberOfClearBits ( - __in PRTL_BITMAP BitMapHeader - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONG -NTAPI -RtlNumberOfSetBits ( - __in PRTL_BITMAP BitMapHeader - ); -#endif - -// -// The following two procedures return to the caller a boolean value -// indicating if the specified range of bits are all clear or set. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlAreBitsClear ( - __in PRTL_BITMAP BitMapHeader, - __in ULONG StartingIndex, - __in ULONG Length - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlAreBitsSet ( - __in PRTL_BITMAP BitMapHeader, - __in ULONG StartingIndex, - __in ULONG Length - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONG -NTAPI -RtlFindNextForwardRunClear ( - __in PRTL_BITMAP BitMapHeader, - __in ULONG FromIndex, - __out PULONG StartingRunIndex - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONG -NTAPI -RtlFindLastBackwardRunClear ( - __in PRTL_BITMAP BitMapHeader, - __in ULONG FromIndex, - __out PULONG StartingRunIndex - ); -#endif - -// -// The following two procedures return to the caller a value indicating -// the position within a ULONGLONG of the most or least significant non-zero -// bit. A value of zero results in a return value of -1. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__success(return != -1) -__checkReturn -NTSYSAPI -CCHAR -NTAPI -RtlFindLeastSignificantBit ( - __in ULONGLONG Set - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__success(return != -1) -__checkReturn -NTSYSAPI -CCHAR -NTAPI -RtlFindMostSignificantBit ( - __in ULONGLONG Set - ); -#endif - -// -// The following procedure finds the number of set bits within a ULONG_PTR -// value. -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -ULONG -NTAPI -RtlNumberOfSetBitsUlongPtr ( - __in ULONG_PTR Target - ); -#endif - - -// -// BOOLEAN -// RtlEqualLuid( -// PLUID L1, -// PLUID L2 -// ); - -#define RtlEqualLuid(L1, L2) (((L1)->LowPart == (L2)->LowPart) && \ - ((L1)->HighPart == (L2)->HighPart)) - -// -// BOOLEAN -// RtlIsZeroLuid( -// PLUID L1 -// ); -// -#define RtlIsZeroLuid(L1) ((BOOLEAN) (((L1)->LowPart | (L1)->HighPart) == 0)) - -// -// SecurityDescriptor RTL routine definitions -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlCreateSecurityDescriptor ( - __out PSECURITY_DESCRIPTOR SecurityDescriptor, - __in ULONG Revision - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlValidSecurityDescriptor ( - __in PSECURITY_DESCRIPTOR SecurityDescriptor - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -ULONG -NTAPI -RtlLengthSecurityDescriptor ( - __in PSECURITY_DESCRIPTOR SecurityDescriptor - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -__checkReturn -NTSYSAPI -BOOLEAN -NTAPI -RtlValidRelativeSecurityDescriptor ( - __in_bcount(SecurityDescriptorLength) PSECURITY_DESCRIPTOR SecurityDescriptorInput, - __in ULONG SecurityDescriptorLength, - __in SECURITY_INFORMATION RequiredInformation - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -RtlSetDaclSecurityDescriptor ( - __inout PSECURITY_DESCRIPTOR SecurityDescriptor, - __in BOOLEAN DaclPresent, - __in_opt PACL Dacl, - __in_opt BOOLEAN DaclDefaulted - ); -#endif - - -// -// Byte swap routines. These are used to convert from little-endian to -// big-endian and vice-versa. -// - -#if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || ((defined(_M_AMD64) || defined(_M_IA64)) && (_MSC_FULL_VER > 13009175)) -#ifdef __cplusplus -extern "C" { -#endif -unsigned short __cdecl _byteswap_ushort(unsigned short); -unsigned long __cdecl _byteswap_ulong (unsigned long); -unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64); -#ifdef __cplusplus -} -#endif -#pragma intrinsic(_byteswap_ushort) -#pragma intrinsic(_byteswap_ulong) -#pragma intrinsic(_byteswap_uint64) - -#define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x)) -#define RtlUlongByteSwap(_x) _byteswap_ulong((_x)) -#define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x)) -#else - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -USHORT -FASTCALL -RtlUshortByteSwap( - __in USHORT Source - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONG -FASTCALL -RtlUlongByteSwap( - __in ULONG Source - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -ULONGLONG -FASTCALL -RtlUlonglongByteSwap( - __in ULONGLONG Source - ); -#endif - -#endif - - -#define RTLVERLIB_DDI(x) Wdmlib##x - -typedef BOOLEAN (*PFN_RTL_IS_NTDDI_VERSION_AVAILABLE)( - __in ULONG Version - ); - -typedef BOOLEAN (*PFN_RTL_IS_SERVICE_PACK_VERSION_INSTALLED)( - __in ULONG Version - ); - -BOOLEAN -RTLVERLIB_DDI(RtlIsNtDdiVersionAvailable)( - __in ULONG Version - ); - -BOOLEAN -RTLVERLIB_DDI(RtlIsServicePackVersionInstalled)( - __in ULONG Version - ); - -#ifndef RtlIsNtDdiVersionAvailable -#define RtlIsNtDdiVersionAvailable WdmlibRtlIsNtDdiVersionAvailable -#endif - -#ifndef RtlIsServicePackVersionInstalled -#define RtlIsServicePackVersionInstalled WdmlibRtlIsServicePackVersionInstalled -#endif - -// -// Interlocked bit manipulation interfaces -// - -#define RtlInterlockedSetBits(Flags, Flag) \ - InterlockedOr((PLONG)(Flags), Flag) - -#define RtlInterlockedAndBits(Flags, Flag) \ - InterlockedAnd((PLONG)(Flags), Flag) - -#define RtlInterlockedClearBits(Flags, Flag) \ - RtlInterlockedAndBits(Flags, ~(Flag)) - -#define RtlInterlockedXorBits(Flags, Flag) \ - InterlockedXor(Flags, Flag) - -#define RtlInterlockedSetBitsDiscardReturn(Flags, Flag) \ - (VOID) RtlInterlockedSetBits(Flags, Flag) - -#define RtlInterlockedAndBitsDiscardReturn(Flags, Flag) \ - (VOID) RtlInterlockedAndBits(Flags, Flag) - -#define RtlInterlockedClearBitsDiscardReturn(Flags, Flag) \ - RtlInterlockedAndBitsDiscardReturn(Flags, ~(Flag)) - -#if (NTDDI_VERSION >= NTDDI_WINXP) -#include -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -NTSTATUS -NTAPI -RtlIoEncodeMemIoResource ( - __in PIO_RESOURCE_DESCRIPTOR Descriptor, - __in UCHAR Type, - __in ULONGLONG Length, - __in ULONGLONG Alignment, - __in ULONGLONG MinimumAddress, - __in ULONGLONG MaximumAddress - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -NTSTATUS -NTAPI -RtlCmEncodeMemIoResource ( - __in PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, - __in UCHAR Type, - __in ULONGLONG Length, - __in ULONGLONG Start - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -ULONGLONG -NTAPI -RtlIoDecodeMemIoResource ( - __in PIO_RESOURCE_DESCRIPTOR Descriptor, - __out_opt PULONGLONG Alignment, - __out_opt PULONGLONG MinimumAddress, - __out_opt PULONGLONG MaximumAddress - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -ULONGLONG -NTAPI -RtlCmDecodeMemIoResource ( - __in PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, - __out_opt PULONGLONG Start - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSAPI -NTSTATUS -NTAPI -RtlFindClosestEncodableLength ( - __in ULONGLONG SourceLength, - __out PULONGLONG TargetLength - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -NTSYSAPI -ULONG64 -NTAPI -RtlGetEnabledExtendedFeatures ( - __in ULONG64 FeatureMask - ); - -#endif - -#ifndef _NTTMAPI_ -#define _NTTMAPI_ - - -#ifdef __cplusplus -extern "C" { -#endif - - -#include - -// -// Types for Nt level TM calls -// - -// -// KTM Tm object rights -// -#define TRANSACTIONMANAGER_QUERY_INFORMATION ( 0x0001 ) -#define TRANSACTIONMANAGER_SET_INFORMATION ( 0x0002 ) -#define TRANSACTIONMANAGER_RECOVER ( 0x0004 ) -#define TRANSACTIONMANAGER_RENAME ( 0x0008 ) -#define TRANSACTIONMANAGER_CREATE_RM ( 0x0010 ) - -// The following right is intended for DTC's use only; it will be -// deprecated, and no one else should take a dependency on it. -#define TRANSACTIONMANAGER_BIND_TRANSACTION ( 0x0020 ) - -// -// Generic mappings for transaction manager rights. -// - -#define TRANSACTIONMANAGER_GENERIC_READ (STANDARD_RIGHTS_READ |\ - TRANSACTIONMANAGER_QUERY_INFORMATION) - -#define TRANSACTIONMANAGER_GENERIC_WRITE (STANDARD_RIGHTS_WRITE |\ - TRANSACTIONMANAGER_SET_INFORMATION |\ - TRANSACTIONMANAGER_RECOVER |\ - TRANSACTIONMANAGER_RENAME |\ - TRANSACTIONMANAGER_CREATE_RM) - -#define TRANSACTIONMANAGER_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE) - -#define TRANSACTIONMANAGER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ - TRANSACTIONMANAGER_GENERIC_READ |\ - TRANSACTIONMANAGER_GENERIC_WRITE |\ - TRANSACTIONMANAGER_GENERIC_EXECUTE |\ - TRANSACTIONMANAGER_BIND_TRANSACTION) - - -// -// KTM transaction object rights. -// -#define TRANSACTION_QUERY_INFORMATION ( 0x0001 ) -#define TRANSACTION_SET_INFORMATION ( 0x0002 ) -#define TRANSACTION_ENLIST ( 0x0004 ) -#define TRANSACTION_COMMIT ( 0x0008 ) -#define TRANSACTION_ROLLBACK ( 0x0010 ) -#define TRANSACTION_PROPAGATE ( 0x0020 ) -#define TRANSACTION_RIGHT_RESERVED1 ( 0x0040 ) - -// -// Generic mappings for transaction rights. -// Resource managers, when enlisting, should generally use the macro -// TRANSACTION_RESOURCE_MANAGER_RIGHTS when opening a transaction. -// It's the same as generic read and write except that it does not allow -// a commit decision to be made. -// - -#define TRANSACTION_GENERIC_READ (STANDARD_RIGHTS_READ |\ - TRANSACTION_QUERY_INFORMATION |\ - SYNCHRONIZE) - -#define TRANSACTION_GENERIC_WRITE (STANDARD_RIGHTS_WRITE |\ - TRANSACTION_SET_INFORMATION |\ - TRANSACTION_COMMIT |\ - TRANSACTION_ENLIST |\ - TRANSACTION_ROLLBACK |\ - TRANSACTION_PROPAGATE |\ - SYNCHRONIZE) - -#define TRANSACTION_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ - TRANSACTION_COMMIT |\ - TRANSACTION_ROLLBACK |\ - SYNCHRONIZE) - -#define TRANSACTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ - TRANSACTION_GENERIC_READ |\ - TRANSACTION_GENERIC_WRITE |\ - TRANSACTION_GENERIC_EXECUTE) - -#define TRANSACTION_RESOURCE_MANAGER_RIGHTS (TRANSACTION_GENERIC_READ |\ - STANDARD_RIGHTS_WRITE |\ - TRANSACTION_SET_INFORMATION |\ - TRANSACTION_ENLIST |\ - TRANSACTION_ROLLBACK |\ - TRANSACTION_PROPAGATE |\ - SYNCHRONIZE) - -// -// KTM resource manager object rights. -// -#define RESOURCEMANAGER_QUERY_INFORMATION ( 0x0001 ) -#define RESOURCEMANAGER_SET_INFORMATION ( 0x0002 ) -#define RESOURCEMANAGER_RECOVER ( 0x0004 ) -#define RESOURCEMANAGER_ENLIST ( 0x0008 ) -#define RESOURCEMANAGER_GET_NOTIFICATION ( 0x0010 ) -#define RESOURCEMANAGER_REGISTER_PROTOCOL ( 0x0020 ) -#define RESOURCEMANAGER_COMPLETE_PROPAGATION ( 0x0040 ) - -// -// Generic mappings for resource manager rights. -// -#define RESOURCEMANAGER_GENERIC_READ (STANDARD_RIGHTS_READ |\ - RESOURCEMANAGER_QUERY_INFORMATION |\ - SYNCHRONIZE) - -#define RESOURCEMANAGER_GENERIC_WRITE (STANDARD_RIGHTS_WRITE |\ - RESOURCEMANAGER_SET_INFORMATION |\ - RESOURCEMANAGER_RECOVER |\ - RESOURCEMANAGER_ENLIST |\ - RESOURCEMANAGER_GET_NOTIFICATION |\ - RESOURCEMANAGER_REGISTER_PROTOCOL |\ - RESOURCEMANAGER_COMPLETE_PROPAGATION |\ - SYNCHRONIZE) - -#define RESOURCEMANAGER_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ - RESOURCEMANAGER_RECOVER |\ - RESOURCEMANAGER_ENLIST |\ - RESOURCEMANAGER_GET_NOTIFICATION |\ - RESOURCEMANAGER_COMPLETE_PROPAGATION |\ - SYNCHRONIZE) - -#define RESOURCEMANAGER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ - RESOURCEMANAGER_GENERIC_READ |\ - RESOURCEMANAGER_GENERIC_WRITE |\ - RESOURCEMANAGER_GENERIC_EXECUTE) - - -// -// KTM enlistment object rights. -// -#define ENLISTMENT_QUERY_INFORMATION ( 0x0001 ) -#define ENLISTMENT_SET_INFORMATION ( 0x0002 ) -#define ENLISTMENT_RECOVER ( 0x0004 ) -#define ENLISTMENT_SUBORDINATE_RIGHTS ( 0x0008 ) -#define ENLISTMENT_SUPERIOR_RIGHTS ( 0x0010 ) - -// -// Generic mappings for enlistment rights. -// -#define ENLISTMENT_GENERIC_READ (STANDARD_RIGHTS_READ |\ - ENLISTMENT_QUERY_INFORMATION) - -#define ENLISTMENT_GENERIC_WRITE (STANDARD_RIGHTS_WRITE |\ - ENLISTMENT_SET_INFORMATION |\ - ENLISTMENT_RECOVER |\ - ENLISTMENT_SUBORDINATE_RIGHTS |\ - ENLISTMENT_SUPERIOR_RIGHTS) - -#define ENLISTMENT_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ - ENLISTMENT_RECOVER |\ - ENLISTMENT_SUBORDINATE_RIGHTS |\ - ENLISTMENT_SUPERIOR_RIGHTS) - -#define ENLISTMENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ - ENLISTMENT_GENERIC_READ |\ - ENLISTMENT_GENERIC_WRITE |\ - ENLISTMENT_GENERIC_EXECUTE) - - -// -// Transaction outcomes. -// -// TODO: warning, must match values in KTRANSACTION_OUTCOME duplicated def -// in tm.h. -// - -typedef enum _TRANSACTION_OUTCOME { - TransactionOutcomeUndetermined = 1, - TransactionOutcomeCommitted, - TransactionOutcomeAborted, -} TRANSACTION_OUTCOME; - - -typedef enum _TRANSACTION_STATE { - TransactionStateNormal = 1, - TransactionStateIndoubt, - TransactionStateCommittedNotify, -} TRANSACTION_STATE; - - -typedef struct _TRANSACTION_BASIC_INFORMATION { - GUID TransactionId; - ULONG State; - ULONG Outcome; -} TRANSACTION_BASIC_INFORMATION, *PTRANSACTION_BASIC_INFORMATION; - -typedef struct _TRANSACTIONMANAGER_BASIC_INFORMATION { - GUID TmIdentity; - LARGE_INTEGER VirtualClock; -} TRANSACTIONMANAGER_BASIC_INFORMATION, *PTRANSACTIONMANAGER_BASIC_INFORMATION; - -typedef struct _TRANSACTIONMANAGER_LOG_INFORMATION { - GUID LogIdentity; -} TRANSACTIONMANAGER_LOG_INFORMATION, *PTRANSACTIONMANAGER_LOG_INFORMATION; - -typedef struct _TRANSACTIONMANAGER_LOGPATH_INFORMATION { - ULONG LogPathLength; - __field_ecount(LogPathLength) WCHAR LogPath[1]; // Variable size -// Data[1]; // Variable size data not declared -} TRANSACTIONMANAGER_LOGPATH_INFORMATION, *PTRANSACTIONMANAGER_LOGPATH_INFORMATION; - -typedef struct _TRANSACTIONMANAGER_RECOVERY_INFORMATION { - ULONGLONG LastRecoveredLsn; -} TRANSACTIONMANAGER_RECOVERY_INFORMATION, *PTRANSACTIONMANAGER_RECOVERY_INFORMATION; - - - - -typedef struct _TRANSACTION_PROPERTIES_INFORMATION { - ULONG IsolationLevel; - ULONG IsolationFlags; - LARGE_INTEGER Timeout; - ULONG Outcome; - ULONG DescriptionLength; - WCHAR Description[1]; // Variable size -// Data[1]; // Variable size data not declared -} TRANSACTION_PROPERTIES_INFORMATION, *PTRANSACTION_PROPERTIES_INFORMATION; - -// The following info-class is intended for DTC's use only; it will be -// deprecated, and no one else should take a dependency on it. -typedef struct _TRANSACTION_BIND_INFORMATION { - HANDLE TmHandle; -} TRANSACTION_BIND_INFORMATION, *PTRANSACTION_BIND_INFORMATION; - -typedef struct _TRANSACTION_ENLISTMENT_PAIR { - GUID EnlistmentId; - GUID ResourceManagerId; -} TRANSACTION_ENLISTMENT_PAIR, *PTRANSACTION_ENLISTMENT_PAIR; - -typedef struct _TRANSACTION_ENLISTMENTS_INFORMATION { - ULONG NumberOfEnlistments; - TRANSACTION_ENLISTMENT_PAIR EnlistmentPair[1]; // Variable size -} TRANSACTION_ENLISTMENTS_INFORMATION, *PTRANSACTION_ENLISTMENTS_INFORMATION; - -typedef struct _TRANSACTION_SUPERIOR_ENLISTMENT_INFORMATION { - TRANSACTION_ENLISTMENT_PAIR SuperiorEnlistmentPair; -} TRANSACTION_SUPERIOR_ENLISTMENT_INFORMATION, *PTRANSACTION_SUPERIOR_ENLISTMENT_INFORMATION; - - -typedef struct _RESOURCEMANAGER_BASIC_INFORMATION { - GUID ResourceManagerId; - ULONG DescriptionLength; - WCHAR Description[1]; // Variable size -} RESOURCEMANAGER_BASIC_INFORMATION, *PRESOURCEMANAGER_BASIC_INFORMATION; - -typedef struct _RESOURCEMANAGER_COMPLETION_INFORMATION { - HANDLE IoCompletionPortHandle; - ULONG_PTR CompletionKey; -} RESOURCEMANAGER_COMPLETION_INFORMATION, *PRESOURCEMANAGER_COMPLETION_INFORMATION; - -typedef enum _TRANSACTION_INFORMATION_CLASS { - TransactionBasicInformation, - TransactionPropertiesInformation, - TransactionEnlistmentInformation, - TransactionSuperiorEnlistmentInformation -} TRANSACTION_INFORMATION_CLASS; - - -typedef enum _TRANSACTIONMANAGER_INFORMATION_CLASS { - TransactionManagerBasicInformation, - TransactionManagerLogInformation, - TransactionManagerLogPathInformation, - TransactionManagerRecoveryInformation = 4 - -} TRANSACTIONMANAGER_INFORMATION_CLASS; - - - -typedef enum _RESOURCEMANAGER_INFORMATION_CLASS { - ResourceManagerBasicInformation, - ResourceManagerCompletionInformation, -} RESOURCEMANAGER_INFORMATION_CLASS; - - -typedef struct _ENLISTMENT_BASIC_INFORMATION { - GUID EnlistmentId; - GUID TransactionId; - GUID ResourceManagerId; -} ENLISTMENT_BASIC_INFORMATION, *PENLISTMENT_BASIC_INFORMATION; - -typedef struct _ENLISTMENT_CRM_INFORMATION { - GUID CrmTransactionManagerId; - GUID CrmResourceManagerId; - GUID CrmEnlistmentId; -} ENLISTMENT_CRM_INFORMATION, *PENLISTMENT_CRM_INFORMATION; - - - -typedef enum _ENLISTMENT_INFORMATION_CLASS { - EnlistmentBasicInformation, - EnlistmentRecoveryInformation, - EnlistmentCrmInformation -} ENLISTMENT_INFORMATION_CLASS; - -typedef struct _TRANSACTION_LIST_ENTRY { - UOW UOW; -} TRANSACTION_LIST_ENTRY, *PTRANSACTION_LIST_ENTRY; - -typedef struct _TRANSACTION_LIST_INFORMATION { - ULONG NumberOfTransactions; - TRANSACTION_LIST_ENTRY TransactionInformation[1]; // Var size -} TRANSACTION_LIST_INFORMATION, *PTRANSACTION_LIST_INFORMATION; - - -// -// Types of objects known to the kernel transaction manager. -// - -typedef enum _KTMOBJECT_TYPE { - - KTMOBJECT_TRANSACTION, - KTMOBJECT_TRANSACTION_MANAGER, - KTMOBJECT_RESOURCE_MANAGER, - KTMOBJECT_ENLISTMENT, - KTMOBJECT_INVALID - -} KTMOBJECT_TYPE, *PKTMOBJECT_TYPE; - - -// -// KTMOBJECT_CURSOR -// -// Used by NtEnumerateTransactionObject to enumerate a transaction -// object namespace (e.g. enlistments in a resource manager). -// - -typedef struct _KTMOBJECT_CURSOR { - - // - // The last GUID enumerated; zero if beginning enumeration. - // - - GUID LastQuery; - - // - // A count of GUIDs filled in by this last enumeration. - // - - ULONG ObjectIdCount; - - // - // ObjectIdCount GUIDs from the namespace specified. - // - - GUID ObjectIds[1]; - -} KTMOBJECT_CURSOR, *PKTMOBJECT_CURSOR; - - - -// -// Nt level transaction manager API calls -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtCreateTransactionManager ( - __out PHANDLE TmHandle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt PUNICODE_STRING LogFileName, - __in_opt ULONG CreateOptions, - __in_opt ULONG CommitStrength - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtOpenTransactionManager ( - __out PHANDLE TmHandle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt PUNICODE_STRING LogFileName, - __in_opt LPGUID TmIdentity, - __in_opt ULONG OpenOptions - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtRenameTransactionManager ( - __in PUNICODE_STRING LogFileName, - __in LPGUID ExistingTransactionManagerGuid - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtRollforwardTransactionManager ( - __in HANDLE TransactionManagerHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtRecoverTransactionManager ( - __in HANDLE TransactionManagerHandle - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtQueryInformationTransactionManager ( - __in HANDLE TransactionManagerHandle, - __in TRANSACTIONMANAGER_INFORMATION_CLASS TransactionManagerInformationClass, - __out_bcount(TransactionManagerInformationLength) PVOID TransactionManagerInformation, - __in ULONG TransactionManagerInformationLength, - __out PULONG ReturnLength - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtSetInformationTransactionManager ( - __in_opt HANDLE TmHandle, - __in TRANSACTIONMANAGER_INFORMATION_CLASS TransactionManagerInformationClass, - __in_bcount(TransactionManagerInformationLength) PVOID TransactionManagerInformation, - __in ULONG TransactionManagerInformationLength - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtEnumerateTransactionObject ( - __in_opt HANDLE RootObjectHandle, - __in KTMOBJECT_TYPE QueryType, - __inout_bcount(ObjectCursorLength) PKTMOBJECT_CURSOR ObjectCursor, - __in ULONG ObjectCursorLength, - __out PULONG ReturnLength - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -typedef NTSTATUS (NTAPI * PFN_NT_CREATE_TRANSACTION)( - __out PHANDLE TransactionHandle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt LPGUID Uow, - __in_opt HANDLE TmHandle, - __in_opt ULONG CreateOptions, - __in_opt ULONG IsolationLevel, - __in_opt ULONG IsolationFlags, - __in_opt PLARGE_INTEGER Timeout, - __in_opt PUNICODE_STRING Description - ); - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtCreateTransaction ( - __out PHANDLE TransactionHandle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt LPGUID Uow, - __in_opt HANDLE TmHandle, - __in_opt ULONG CreateOptions, - __in_opt ULONG IsolationLevel, - __in_opt ULONG IsolationFlags, - __in_opt PLARGE_INTEGER Timeout, - __in_opt PUNICODE_STRING Description - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -typedef NTSTATUS (NTAPI *PFN_NT_OPEN_TRANSACTION)( - __out PHANDLE TransactionHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt LPGUID Uow, - __in_opt HANDLE TmHandle - ); - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtOpenTransaction ( - __out PHANDLE TransactionHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in LPGUID Uow, - __in_opt HANDLE TmHandle - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -typedef NTSTATUS (NTAPI * PFN_NT_QUERY_INFORMATION_TRANSACTION)( - __in HANDLE TransactionHandle, - __in TRANSACTION_INFORMATION_CLASS TransactionInformationClass, - __out_bcount(TransactionInformationLength) PVOID TransactionInformation, - __in ULONG TransactionInformationLength, - __out_opt PULONG ReturnLength - ); - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtQueryInformationTransaction ( - __in HANDLE TransactionHandle, - __in TRANSACTION_INFORMATION_CLASS TransactionInformationClass, - __out_bcount(TransactionInformationLength) PVOID TransactionInformation, - __in ULONG TransactionInformationLength, - __out_opt PULONG ReturnLength - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -typedef NTSTATUS (NTAPI * PFN_NT_SET_INFORMATION_TRANSACTION)( - __in HANDLE TransactionHandle, - __in TRANSACTION_INFORMATION_CLASS TransactionInformationClass, - __in PVOID TransactionInformation, - __in ULONG TransactionInformationLength - ); - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtSetInformationTransaction ( - __in HANDLE TransactionHandle, - __in TRANSACTION_INFORMATION_CLASS TransactionInformationClass, - __in_bcount(TransactionInformationLength) PVOID TransactionInformation, - __in ULONG TransactionInformationLength - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -typedef NTSTATUS (NTAPI * PFN_NT_COMMIT_TRANSACTION)( - __in HANDLE TransactionHandle, - __in BOOLEAN Wait - ); - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtCommitTransaction ( - __in HANDLE TransactionHandle, - __in BOOLEAN Wait - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -typedef NTSTATUS (NTAPI * PFN_NT_ROLLBACK_TRANSACTION)( - __in HANDLE TransactionHandle, - __in BOOLEAN Wait - ); - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtRollbackTransaction ( - __in HANDLE TransactionHandle, - __in BOOLEAN Wait - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtCreateEnlistment ( - __out PHANDLE EnlistmentHandle, - __in ACCESS_MASK DesiredAccess, - __in HANDLE ResourceManagerHandle, - __in HANDLE TransactionHandle, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt ULONG CreateOptions, - __in NOTIFICATION_MASK NotificationMask, - __in_opt PVOID EnlistmentKey - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtOpenEnlistment ( - __out PHANDLE EnlistmentHandle, - __in ACCESS_MASK DesiredAccess, - __in HANDLE ResourceManagerHandle, - __in LPGUID EnlistmentGuid, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtQueryInformationEnlistment ( - __in HANDLE EnlistmentHandle, - __in ENLISTMENT_INFORMATION_CLASS EnlistmentInformationClass, - __out_bcount(EnlistmentInformationLength) PVOID EnlistmentInformation, - __in ULONG EnlistmentInformationLength, - __out PULONG ReturnLength - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtSetInformationEnlistment ( - __in_opt HANDLE EnlistmentHandle, - __in ENLISTMENT_INFORMATION_CLASS EnlistmentInformationClass, - __in_bcount(EnlistmentInformationLength) PVOID EnlistmentInformation, - __in ULONG EnlistmentInformationLength - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtRecoverEnlistment ( - __in HANDLE EnlistmentHandle, - __in_opt PVOID EnlistmentKey - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtPrePrepareEnlistment ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtPrepareEnlistment ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtCommitEnlistment ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtRollbackEnlistment ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtPrePrepareComplete ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtPrepareComplete ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtCommitComplete ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtReadOnlyEnlistment ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtRollbackComplete ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtSinglePhaseReject ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtCreateResourceManager ( - __out PHANDLE ResourceManagerHandle, - __in ACCESS_MASK DesiredAccess, - __in HANDLE TmHandle, - __in LPGUID RmGuid, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt ULONG CreateOptions, - __in_opt PUNICODE_STRING Description - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtOpenResourceManager ( - __out PHANDLE ResourceManagerHandle, - __in ACCESS_MASK DesiredAccess, - __in HANDLE TmHandle, - __in_opt LPGUID ResourceManagerGuid, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtRecoverResourceManager ( - __in HANDLE ResourceManagerHandle - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtGetNotificationResourceManager ( - __in HANDLE ResourceManagerHandle, - __out PTRANSACTION_NOTIFICATION TransactionNotification, - __in ULONG NotificationLength, - __in_opt PLARGE_INTEGER Timeout, - __out_opt PULONG ReturnLength, - __in ULONG Asynchronous, - __in_opt ULONG_PTR AsynchronousContext - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtQueryInformationResourceManager ( - __in HANDLE ResourceManagerHandle, - __in RESOURCEMANAGER_INFORMATION_CLASS ResourceManagerInformationClass, - __out_bcount(ResourceManagerInformationLength) PVOID ResourceManagerInformation, - __in ULONG ResourceManagerInformationLength, - __out_opt PULONG ReturnLength - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtSetInformationResourceManager ( - __in HANDLE ResourceManagerHandle, - __in RESOURCEMANAGER_INFORMATION_CLASS ResourceManagerInformationClass, - __in_bcount(ResourceManagerInformationLength) PVOID ResourceManagerInformation, - __in ULONG ResourceManagerInformationLength - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtRegisterProtocolAddressInformation( - __in HANDLE ResourceManager, - __in PCRM_PROTOCOL_ID ProtocolId, - __in ULONG ProtocolInformationSize, - __in PVOID ProtocolInformation, - __in_opt ULONG CreateOptions - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtPropagationComplete( - __in HANDLE ResourceManagerHandle, - __in ULONG RequestCookie, - __in ULONG BufferLength, - __in PVOID Buffer - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL (APC_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -NtPropagationFailed( - __in HANDLE ResourceManagerHandle, - __in ULONG RequestCookie, - __in NTSTATUS PropStatus - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - - -#ifdef __cplusplus -} -#endif - -#endif // _NTTMAPI_ - - -// -// Define alignment macros to align structure sizes and pointers up and down. -// - -#undef ALIGN_DOWN_BY -#undef ALIGN_UP_BY -#undef ALIGN_DOWN_POINTER_BY -#undef ALIGN_UP_POINTER_BY -#undef ALIGN_DOWN -#undef ALIGN_UP -#undef ALIGN_DOWN_POINTER -#undef ALIGN_UP_POINTER - -#define ALIGN_DOWN_BY(length, alignment) \ - ((ULONG_PTR)(length) & ~(alignment - 1)) - -#define ALIGN_UP_BY(length, alignment) \ - (ALIGN_DOWN_BY(((ULONG_PTR)(length) + alignment - 1), alignment)) - -#define ALIGN_DOWN_POINTER_BY(address, alignment) \ - ((PVOID)((ULONG_PTR)(address) & ~((ULONG_PTR)alignment - 1))) - -#define ALIGN_UP_POINTER_BY(address, alignment) \ - (ALIGN_DOWN_POINTER_BY(((ULONG_PTR)(address) + alignment - 1), alignment)) - -#define ALIGN_DOWN(length, type) \ - ALIGN_DOWN_BY(length, sizeof(type)) - -#define ALIGN_UP(length, type) \ - ALIGN_UP_BY(length, sizeof(type)) - -#define ALIGN_DOWN_POINTER(address, type) \ - ALIGN_DOWN_POINTER_BY(address, sizeof(type)) - -#define ALIGN_UP_POINTER(address, type) \ - ALIGN_UP_POINTER_BY(address, sizeof(type)) - -// -// Calculate the byte offset of a field in a structure of type type. -// - -#ifndef FIELD_OFFSET -#define FIELD_OFFSET(type, field) ((ULONG)&(((type *)0)->field)) -#endif - -#ifndef FIELD_SIZE -#define FIELD_SIZE(type, field) (sizeof(((type *)0)->field)) -#endif - -#define POOL_TAGGING 1 - -#if DBG - -#define IF_DEBUG if (TRUE) - -#else - -#define IF_DEBUG if (FALSE) - -#endif - -#if DEVL - - -extern ULONG NtGlobalFlag; - -#define IF_NTOS_DEBUG(FlagName) \ - if (NtGlobalFlag & (FLG_ ## FlagName)) - -#else - -#define IF_NTOS_DEBUG(FlagName) if(FALSE) - -#endif - - - -// -// Define General Lookaside and supporting types here -// - -typedef enum _POOL_TYPE POOL_TYPE; - -typedef -__drv_sameIRQL -__drv_functionClass(ALLOCATE_FUNCTION) -PVOID -ALLOCATE_FUNCTION ( - __in POOL_TYPE PoolType, - __in SIZE_T NumberOfBytes, - __in ULONG Tag - ); -typedef ALLOCATE_FUNCTION *PALLOCATE_FUNCTION; - -typedef -__drv_sameIRQL -__drv_functionClass(FREE_FUNCTION) -VOID -FREE_FUNCTION ( - __in PVOID Buffer - ); -typedef FREE_FUNCTION *PFREE_FUNCTION; - -typedef struct _LOOKASIDE_LIST_EX *PLOOKASIDE_LIST_EX; - -typedef -__drv_sameIRQL -__drv_functionClass(ALLOCATE_FUNCTION_EX) -PVOID -ALLOCATE_FUNCTION_EX ( - __in POOL_TYPE PoolType, - __in SIZE_T NumberOfBytes, - __in ULONG Tag, - __inout PLOOKASIDE_LIST_EX Lookaside - ); -typedef ALLOCATE_FUNCTION_EX *PALLOCATE_FUNCTION_EX; - -typedef -__drv_sameIRQL -__drv_functionClass(FREE_FUNCTION_EX) -VOID -FREE_FUNCTION_EX ( - __in PVOID Buffer, - __inout PLOOKASIDE_LIST_EX Lookaside - ); -typedef FREE_FUNCTION_EX *PFREE_FUNCTION_EX; - -#if !defined(_WIN64) && (defined(_NTDDK_) || defined(_NTIFS_) || defined(_NDIS_)) - -#define LOOKASIDE_ALIGN - -#else - -#define LOOKASIDE_ALIGN DECLSPEC_CACHEALIGN - -#endif - - -// -// The goal here is to end up with two structure types that are identical except -// for the fact that one (GENERAL_LOOKASIDE) is cache aligned, and the other -// (GENERAL_LOOKASIDE_POOL) is merely naturally aligned. -// -// An anonymous structure element would do the trick except that C++ can't handle -// such complex syntax, so we're stuck with this macro technique. -// - -#define GENERAL_LOOKASIDE_LAYOUT \ - union { \ - SLIST_HEADER ListHead; \ - SINGLE_LIST_ENTRY SingleListHead; \ - } DUMMYUNIONNAME; \ - USHORT Depth; \ - USHORT MaximumDepth; \ - ULONG TotalAllocates; \ - union { \ - ULONG AllocateMisses; \ - ULONG AllocateHits; \ - } DUMMYUNIONNAME2; \ - \ - ULONG TotalFrees; \ - union { \ - ULONG FreeMisses; \ - ULONG FreeHits; \ - } DUMMYUNIONNAME3; \ - \ - POOL_TYPE Type; \ - ULONG Tag; \ - ULONG Size; \ - union { \ - PALLOCATE_FUNCTION_EX AllocateEx; \ - PALLOCATE_FUNCTION Allocate; \ - } DUMMYUNIONNAME4; \ - \ - union { \ - PFREE_FUNCTION_EX FreeEx; \ - PFREE_FUNCTION Free; \ - } DUMMYUNIONNAME5; \ - \ - LIST_ENTRY ListEntry; \ - ULONG LastTotalAllocates; \ - union { \ - ULONG LastAllocateMisses; \ - ULONG LastAllocateHits; \ - } DUMMYUNIONNAME6; \ - ULONG Future[2]; - -// -// GENERAL_LOOKASIDE is a cache aligned type, typically shared between -// multiple processors -// - -#if _MSC_VER >= 1200 -#pragma warning(push) -#pragma warning(disable:4324) // structure was padded due to __declspec(align()) -#endif - -typedef struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE { - GENERAL_LOOKASIDE_LAYOUT -} GENERAL_LOOKASIDE; - -typedef GENERAL_LOOKASIDE *PGENERAL_LOOKASIDE; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - - - -// -// GENERAL_LOOKASIDE_POOL is the same layout as GENERAL_LOOKASIDE but is -// not cacheblock aligned, for use in cases where access is limited to a -// single processor -// - -typedef struct _GENERAL_LOOKASIDE_POOL { - GENERAL_LOOKASIDE_LAYOUT -} GENERAL_LOOKASIDE_POOL, *PGENERAL_LOOKASIDE_POOL; - -// -// The above two structures should have identical layouts. A few spot-checks -// just to make sure. -// - -#define LOOKASIDE_CHECK(f) \ - C_ASSERT(FIELD_OFFSET(GENERAL_LOOKASIDE,f)==FIELD_OFFSET(GENERAL_LOOKASIDE_POOL,f)) - -LOOKASIDE_CHECK(TotalFrees); -LOOKASIDE_CHECK(Tag); -LOOKASIDE_CHECK(Future); - -// -// Kernel definitions that need to be here for forward reference purposes -// - - -// -// Processor modes. -// - -typedef CCHAR KPROCESSOR_MODE; - -typedef enum _MODE { - KernelMode, - UserMode, - MaximumMode -} MODE; - - -// -// APC function types -// - -// -// Put in an empty definition for the KAPC so that the -// routines can reference it before it is declared. -// - -struct _KAPC; - -typedef -__drv_functionClass(KNORMAL_ROUTINE) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_requiresIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -VOID -KNORMAL_ROUTINE ( - __in_opt PVOID NormalContext, - __in_opt PVOID SystemArgument1, - __in_opt PVOID SystemArgument2 - ); -typedef KNORMAL_ROUTINE *PKNORMAL_ROUTINE; - -typedef -__drv_functionClass(KKERNEL_ROUTINE) -__drv_maxIRQL(APC_LEVEL) -__drv_minIRQL(APC_LEVEL) -__drv_requiresIRQL(APC_LEVEL) -__drv_sameIRQL -VOID -KKERNEL_ROUTINE ( - __in struct _KAPC *Apc, - __deref_inout_opt PKNORMAL_ROUTINE *NormalRoutine, - __deref_inout_opt PVOID *NormalContext, - __deref_inout_opt PVOID *SystemArgument1, - __deref_inout_opt PVOID *SystemArgument2 - ); -typedef KKERNEL_ROUTINE *PKKERNEL_ROUTINE; - -typedef -__drv_functionClass(KRUNDOWN_ROUTINE) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_requiresIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -VOID -KRUNDOWN_ROUTINE ( - __in struct _KAPC *Apc - ); -typedef KRUNDOWN_ROUTINE *PKRUNDOWN_ROUTINE; - -typedef -__drv_functionClass(KSYNCHRONIZE_ROUTINE) -__drv_sameIRQL -BOOLEAN -KSYNCHRONIZE_ROUTINE ( - __in PVOID SynchronizeContext - ); -typedef KSYNCHRONIZE_ROUTINE *PKSYNCHRONIZE_ROUTINE; - -// -// Asynchronous Procedure Call (APC) object -// -// N.B. The size of this structure cannot change since it has been exported. -// - -#define ASSERT_APC(E) NT_ASSERT((E)->Type == ApcObject) - -typedef struct _KAPC { - UCHAR Type; - UCHAR SpareByte0; - UCHAR Size; - UCHAR SpareByte1; - ULONG SpareLong0; - struct _KTHREAD *Thread; - LIST_ENTRY ApcListEntry; - PKKERNEL_ROUTINE KernelRoutine; - PKRUNDOWN_ROUTINE RundownRoutine; - PKNORMAL_ROUTINE NormalRoutine; - PVOID NormalContext; - - // - // N.B. The following two members MUST be together. - // - - PVOID SystemArgument1; - PVOID SystemArgument2; - CCHAR ApcStateIndex; - KPROCESSOR_MODE ApcMode; - BOOLEAN Inserted; -} KAPC, *PKAPC, *PRKAPC; - -#define KAPC_OFFSET_TO_SPARE_BYTE0 FIELD_OFFSET(KAPC, SpareByte0) -#define KAPC_OFFSET_TO_SPARE_BYTE1 FIELD_OFFSET(KAPC, SpareByte1) -#define KAPC_OFFSET_TO_SPARE_LONG FIELD_OFFSET(KAPC, SpareLong0) -#define KAPC_OFFSET_TO_SYSTEMARGUMENT1 FIELD_OFFSET(KAPC, SystemArgument1) -#define KAPC_OFFSET_TO_SYSTEMARGUMENT2 FIELD_OFFSET(KAPC, SystemArgument2) -#define KAPC_OFFSET_TO_APCSTATEINDEX FIELD_OFFSET(KAPC, ApcStateIndex) -#define KAPC_ACTUAL_LENGTH (FIELD_OFFSET(KAPC, Inserted) + sizeof(BOOLEAN)) - - -// -// DPC routine -// - -struct _KDPC; - -__drv_functionClass(KDEFERRED_ROUTINE) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -__drv_requiresIRQL(DISPATCH_LEVEL) -__drv_sameIRQL -typedef -VOID -KDEFERRED_ROUTINE ( - __in struct _KDPC *Dpc, - __in_opt PVOID DeferredContext, - __in_opt PVOID SystemArgument1, - __in_opt PVOID SystemArgument2 - ); - -typedef KDEFERRED_ROUTINE *PKDEFERRED_ROUTINE; - -// -// Define DPC importance. -// -// LowImportance - Queue DPC at end of target DPC queue. -// MediumImportance - Queue DPC at end of target DPC queue. -// MediumHighImportance - Queue DPC at end of target DPC queue. -// HighImportance - Queue DPC at front of target DPC DPC queue. -// -// If there is currently a DPC active on the target processor, or a DPC -// interrupt has already been requested on the target processor when a -// DPC is queued, then no further action is necessary. The DPC will be -// executed on the target processor when its queue entry is processed. -// -// If there is not a DPC active on the target processor and a DPC interrupt -// has not been requested on the target processor, then the exact treatment -// of the DPC is dependent on whether the host system is a UP system or an -// MP system. -// -// UP system. -// -// If the DPC is not of low importance, the current DPC queue depth -// is greater than the maximum target depth, or current DPC request rate is -// less the minimum target rate, then a DPC interrupt is requested on the -// host processor and the DPC will be processed when the interrupt occurs. -// Otherwise, no DPC interupt is requested and the DPC execution will be -// delayed until the DPC queue depth is greater that the target depth or the -// minimum DPC rate is less than the target rate. -// -// MP system. -// -// If the DPC is being queued to another processor and the depth of the DPC -// queue on the target processor is greater than the maximum target depth or -// the DPC is of medium high or high importance, then a DPC interrupt is -// requested on the target processor and the DPC will be processed when the -// Interrupt occurs. Otherwise, the DPC execution will be delayed on the target -// processor until the DPC queue depth on the target processor is greater that -// the maximum target depth or the minimum DPC rate on the target processor is -// less than the target mimimum rate. -// -// If the DPC is being queued to the current processor and the DPC is not of -// low importance, the current DPC queue depth is greater than the maximum -// target depth, or the minimum DPC rate is less than the minimum target rate, -// then a DPC interrupt is request on the current processor and the DPV will -// be processed when the interrupt occurs. Otherwise, no DPC interupt is -// requested and the DPC execution will be delayed until the DPC queue depth -// is greater that the target depth or the minimum DPC rate is less than the -// target rate. -// - -typedef enum _KDPC_IMPORTANCE { - LowImportance, - MediumImportance, - HighImportance, - MediumHighImportance -} KDPC_IMPORTANCE; - -// -// Define DPC type indicies. -// - -#define DPC_NORMAL 0 -#define DPC_THREADED 1 - -// -// Deferred Procedure Call (DPC) object -// - -#define ASSERT_DPC(Object) \ - ASSERT(((Object)->Type == 0) || \ - ((Object)->Type == DpcObject) || \ - ((Object)->Type == ThreadedDpcObject)) - -typedef struct _KDPC { - UCHAR Type; - UCHAR Importance; - volatile USHORT Number; - LIST_ENTRY DpcListEntry; - PKDEFERRED_ROUTINE DeferredRoutine; - PVOID DeferredContext; - PVOID SystemArgument1; - PVOID SystemArgument2; - __volatile PVOID DpcData; -} KDPC, *PKDPC, *PRKDPC; - -// -// Interprocessor interrupt worker routine function prototype. -// - -typedef PVOID PKIPI_CONTEXT; - -typedef -__drv_functionClass(KIPI_WORKER) -__drv_sameIRQL -VOID -KIPI_WORKER ( - __inout PKIPI_CONTEXT PacketContext, - __in_opt PVOID Parameter1, - __in_opt PVOID Parameter2, - __in_opt PVOID Parameter3 - ); - -typedef KIPI_WORKER *PKIPI_WORKER; - -// -// Define interprocessor interrupt performance counters. -// - -typedef struct _KIPI_COUNTS { - ULONG Freeze; - ULONG Packet; - ULONG DPC; - ULONG APC; - ULONG FlushSingleTb; - ULONG FlushMultipleTb; - ULONG FlushEntireTb; - ULONG GenericCall; - ULONG ChangeColor; - ULONG SweepDcache; - ULONG SweepIcache; - ULONG SweepIcacheRange; - ULONG FlushIoBuffers; - ULONG GratuitousDPC; -} KIPI_COUNTS, *PKIPI_COUNTS; - - -// -// I/O system definitions. -// -// Define a Memory Descriptor List (MDL) -// -// An MDL describes pages in a virtual buffer in terms of physical pages. The -// pages associated with the buffer are described in an array that is allocated -// just after the MDL header structure itself. -// -// One simply calculates the base of the array by adding one to the base -// MDL pointer: -// -// Pages = (PPFN_NUMBER) (Mdl + 1); -// -// Notice that while in the context of the subject thread, the base virtual -// address of a buffer mapped by an MDL may be referenced using the following: -// -// Mdl->StartVa | Mdl->ByteOffset -// - -typedef __struct_bcount(Size) struct _MDL { - struct _MDL *Next; - CSHORT Size; - CSHORT MdlFlags; - struct _EPROCESS *Process; - PVOID MappedSystemVa; - PVOID StartVa; - ULONG ByteCount; - ULONG ByteOffset; -} MDL, *PMDL; - -typedef __inexpressible_readableTo(polymorphism) MDL *PMDLX; - -#define MDL_MAPPED_TO_SYSTEM_VA 0x0001 -#define MDL_PAGES_LOCKED 0x0002 -#define MDL_SOURCE_IS_NONPAGED_POOL 0x0004 -#define MDL_ALLOCATED_FIXED_SIZE 0x0008 -#define MDL_PARTIAL 0x0010 -#define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020 -#define MDL_IO_PAGE_READ 0x0040 -#define MDL_WRITE_OPERATION 0x0080 -#define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100 -#define MDL_FREE_EXTRA_PTES 0x0200 -#define MDL_DESCRIBES_AWE 0x0400 -#define MDL_IO_SPACE 0x0800 -#define MDL_NETWORK_HEADER 0x1000 -#define MDL_MAPPING_CAN_FAIL 0x2000 -#define MDL_ALLOCATED_MUST_SUCCEED 0x4000 -#define MDL_INTERNAL 0x8000 - -#define MDL_MAPPING_FLAGS (MDL_MAPPED_TO_SYSTEM_VA | \ - MDL_PAGES_LOCKED | \ - MDL_SOURCE_IS_NONPAGED_POOL | \ - MDL_PARTIAL_HAS_BEEN_MAPPED | \ - MDL_PARENT_MAPPED_SYSTEM_VA | \ - MDL_SYSTEM_VA | \ - MDL_IO_SPACE ) - - -// -// switch to PREFast or DBG when appropriate -// - -#if defined(_PREFAST_) - -void __PREfastPagedCode(void); -void __PREfastPagedCodeLocked(void); -#define PAGED_CODE() __PREfastPagedCode(); -#define PAGED_CODE_LOCKED() __PREfastPagedCodeLocked(); - -#elif DBG - -#if (NTDDI_VERSION >= NTDDI_VISTA) -#define PAGED_ASSERT( exp ) NT_ASSERT( exp ) -#else -#define PAGED_ASSERT( exp ) ASSERT( exp ) -#endif - -#define PAGED_CODE() { \ - if (KeGetCurrentIrql() > APC_LEVEL) { \ - KdPrint(("EX: Pageable code called at IRQL %d\n", KeGetCurrentIrql())); \ - PAGED_ASSERT(FALSE); \ - } \ -} - -#define PAGED_CODE_LOCKED() NOP_FUNCTION; - -#else - -#define PAGED_CODE() NOP_FUNCTION; -#define PAGED_CODE_LOCKED() NOP_FUNCTION; - -#endif - -#define NTKERNELAPI DECLSPEC_IMPORT - -#if defined(_X86_) && !defined(_NTHAL_) - -#define _DECL_HAL_KE_IMPORT DECLSPEC_IMPORT - -#elif defined(_X86_) - -#define _DECL_HAL_KE_IMPORT - -#else - -#define _DECL_HAL_KE_IMPORT NTKERNELAPI - -#endif - - -#if !defined(_NTHALDLL_) && !defined(_BLDR_) - -#define NTHALAPI DECLSPEC_IMPORT - -#else - -#define NTHALAPI - -#endif - -// -// Common dispatcher object header -// -// N.B. The size field contains the number of dwords in the structure. -// - -#define TIMER_EXPIRED_INDEX_BITS 6 -#define TIMER_PROCESSOR_INDEX_BITS 5 - -typedef struct _DISPATCHER_HEADER { - union { - struct { - UCHAR Type; // All (accessible via KOBJECT_TYPE) - - union { - union { // Timer - UCHAR TimerControlFlags; - struct { - UCHAR Absolute : 1; - UCHAR Coalescable : 1; - UCHAR KeepShifting : 1; // Periodic timer - UCHAR EncodedTolerableDelay : 5; // Periodic timer - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; - - UCHAR Abandoned; // Queue - BOOLEAN Signalling; // Gate/Events - } DUMMYUNIONNAME; - - union { - union { - UCHAR ThreadControlFlags; // Thread - struct { - UCHAR CpuThrottled : 1; - UCHAR CycleProfiling : 1; - UCHAR CounterProfiling : 1; - UCHAR Reserved : 5; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; - UCHAR Hand; // Timer - UCHAR Size; // All other objects - } DUMMYUNIONNAME2; - - union { - union { // Timer - UCHAR TimerMiscFlags; - struct { - -#if !defined(_X86_) - - UCHAR Index : TIMER_EXPIRED_INDEX_BITS; - -#else - - UCHAR Index : 1; - UCHAR Processor : TIMER_PROCESSOR_INDEX_BITS; - -#endif - - UCHAR Inserted : 1; - volatile UCHAR Expired : 1; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; - union { // Thread - BOOLEAN DebugActive; - struct { - BOOLEAN ActiveDR7 : 1; - BOOLEAN Instrumented : 1; - BOOLEAN Reserved2 : 4; - BOOLEAN UmsScheduled : 1; - BOOLEAN UmsPrimary : 1; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; - BOOLEAN DpcActive; // Mutant - } DUMMYUNIONNAME3; - } DUMMYSTRUCTNAME; - - volatile LONG Lock; // Interlocked - } DUMMYUNIONNAME; - - LONG SignalState; // Object lock - LIST_ENTRY WaitListHead; // Object lock -} DISPATCHER_HEADER; - - - -// -// Event object -// - -#define ASSERT_EVENT(E) \ - NT_ASSERT((KOBJECT_TYPE(E) == NotificationEvent) || \ - (KOBJECT_TYPE(E) == SynchronizationEvent)) - -typedef struct _KEVENT { - DISPATCHER_HEADER Header; -} KEVENT, *PKEVENT, *PRKEVENT; - -// -// Gate object -// -// N.B. Gate object services allow the specification of synchronization -// events. This allows fast mutex to be transparently replaced with -// gates. -// - -#define ASSERT_GATE(object) \ - NT_ASSERT((KOBJECT_TYPE(object) == GateObject) || \ - (KOBJECT_TYPE(object) == EventSynchronizationObject)) - -typedef struct _KGATE { - DISPATCHER_HEADER Header; -} KGATE, *PKGATE; - -// -// Timer object -// -// N.B. The period field must be the last member of this structure. -// - -#define ASSERT_TIMER(E) \ - NT_ASSERT((KOBJECT_TYPE(E) == TimerNotificationObject) || \ - (KOBJECT_TYPE(E) == TimerSynchronizationObject)) - -typedef struct _KTIMER { - DISPATCHER_HEADER Header; - ULARGE_INTEGER DueTime; - LIST_ENTRY TimerListEntry; - struct _KDPC *Dpc; - -#if !defined(_X86_) - - ULONG Processor; - -#endif - - ULONG Period; -} KTIMER, *PKTIMER, *PRKTIMER; - -#define KTIMER_ACTUAL_LENGTH \ - (FIELD_OFFSET(KTIMER, Period) + sizeof(LONG)) - -typedef enum _LOCK_OPERATION { - IoReadAccess, - IoWriteAccess, - IoModifyAccess -} LOCK_OPERATION; - - -#if defined(_X86_) - - -// -// Types to use to contain PFNs and their counts. -// - -typedef ULONG PFN_COUNT; - -typedef LONG SPFN_NUMBER, *PSPFN_NUMBER; -typedef ULONG PFN_NUMBER, *PPFN_NUMBER; - -// -// Define maximum size of flush multiple TB request. -// - -#define FLUSH_MULTIPLE_MAXIMUM 32 - -// -// Indicate that the i386 compiler supports the pragma textout construct. -// - -#define ALLOC_PRAGMA 1 -// -// Indicate that the i386 compiler supports the DATA_SEG("INIT") and -// DATA_SEG("PAGE") pragmas -// - -#define ALLOC_DATA_PRAGMA 1 - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(HIGH_LEVEL) -_DECL_HAL_KE_IMPORT -VOID -FASTCALL -KfLowerIrql ( - __in __drv_restoresIRQL __drv_nonConstant KIRQL NewIrql - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(HIGH_LEVEL) -__drv_raisesIRQL(NewIrql) -__drv_savesIRQL -_DECL_HAL_KE_IMPORT -KIRQL -FASTCALL -KfRaiseIrql ( - __in KIRQL NewIrql - ); -#endif - -#define KeLowerIrql(a) KfLowerIrql(a) -#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a) - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_savesIRQL -__drv_setsIRQL(DISPATCH_LEVEL) -_DECL_HAL_KE_IMPORT -KIRQL -KeRaiseIrqlToDpcLevel ( - VOID - ); -#endif - - -// -// I/O space read and write macros. -// -// These have to be actual functions on the 386, because we need -// to use assembler, but cannot return a value if we inline it. -// -// The READ/WRITE_REGISTER_* calls manipulate I/O registers in MEMORY space. -// (Use x86 move instructions, with LOCK prefix to force correct behavior -// w.r.t. caches and write buffers.) -// -// The READ/WRITE_PORT_* calls manipulate I/O registers in PORT space. -// (Use x86 in/out instructions.) -// - -NTKERNELAPI -UCHAR -NTAPI -READ_REGISTER_UCHAR( - __in __drv_nonConstant PUCHAR Register - ); - -NTKERNELAPI -USHORT -NTAPI -READ_REGISTER_USHORT( - __in __drv_nonConstant PUSHORT Register - ); - -NTKERNELAPI -ULONG -NTAPI -READ_REGISTER_ULONG( - __in __drv_nonConstant PULONG Register - ); - -NTKERNELAPI -VOID -NTAPI -READ_REGISTER_BUFFER_UCHAR( - __in __drv_nonConstant PUCHAR Register, - __out_ecount_full(Count) PUCHAR Buffer, - __in ULONG Count - ); - -NTKERNELAPI -VOID -NTAPI -READ_REGISTER_BUFFER_USHORT( - __in __drv_nonConstant PUSHORT Register, - __out_ecount_full(Count) PUSHORT Buffer, - __in ULONG Count - ); - -NTKERNELAPI -VOID -NTAPI -READ_REGISTER_BUFFER_ULONG( - __in __drv_nonConstant PULONG Register, - __out_ecount_full(Count) PULONG Buffer, - __in ULONG Count - ); - - -NTKERNELAPI -VOID -NTAPI -WRITE_REGISTER_UCHAR( - __in __drv_nonConstant PUCHAR Register, - __in UCHAR Value - ); - -NTKERNELAPI -VOID -NTAPI -WRITE_REGISTER_USHORT( - __in __drv_nonConstant PUSHORT Register, - __in USHORT Value - ); - -NTKERNELAPI -VOID -NTAPI -WRITE_REGISTER_ULONG( - __in __drv_nonConstant PULONG Register, - __in ULONG Value - ); - -NTKERNELAPI -VOID -NTAPI -WRITE_REGISTER_BUFFER_UCHAR( - __in __drv_nonConstant PUCHAR Register, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ); - -NTKERNELAPI -VOID -NTAPI -WRITE_REGISTER_BUFFER_USHORT( - __in __drv_nonConstant PUSHORT Register, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ); - -NTKERNELAPI -VOID -NTAPI -WRITE_REGISTER_BUFFER_ULONG( - __in __drv_nonConstant PULONG Register, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ); - -NTHALAPI -UCHAR -NTAPI -READ_PORT_UCHAR( - __in __drv_nonConstant PUCHAR Port - ); - -NTHALAPI -USHORT -NTAPI -READ_PORT_USHORT( - __in __drv_nonConstant PUSHORT Port - ); - -NTHALAPI -ULONG -NTAPI -READ_PORT_ULONG( - __in __drv_nonConstant PULONG Port - ); - -NTHALAPI -VOID -NTAPI -READ_PORT_BUFFER_UCHAR( - __in __drv_nonConstant PUCHAR Port, - __out_ecount_full(Count) PUCHAR Buffer, - __in ULONG Count - ); - -NTHALAPI -VOID -NTAPI -READ_PORT_BUFFER_USHORT( - __in __drv_nonConstant PUSHORT Port, - __out_ecount_full(Count) PUSHORT Buffer, - __in ULONG Count - ); - -NTHALAPI -VOID -NTAPI -READ_PORT_BUFFER_ULONG( - __in __drv_nonConstant PULONG Port, - __out_ecount_full(Count) PULONG Buffer, - __in ULONG Count - ); - -NTHALAPI -VOID -NTAPI -WRITE_PORT_UCHAR( - __in __drv_nonConstant PUCHAR Port, - __in UCHAR Value - ); - -NTHALAPI -VOID -NTAPI -WRITE_PORT_USHORT( - __in __drv_nonConstant PUSHORT Port, - __in USHORT Value - ); - -NTHALAPI -VOID -NTAPI -WRITE_PORT_ULONG( - __in __drv_nonConstant PULONG Port, - __in ULONG Value - ); - -NTHALAPI -VOID -NTAPI -WRITE_PORT_BUFFER_UCHAR( - __in __drv_nonConstant PUCHAR Port, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ); - -NTHALAPI -VOID -NTAPI -WRITE_PORT_BUFFER_USHORT( - __in __drv_nonConstant PUSHORT Port, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ); - -NTHALAPI -VOID -NTAPI -WRITE_PORT_BUFFER_ULONG( - __in __drv_nonConstant PULONG Port, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ); - - -// -// Get data cache fill size. -// - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(KeGetDcacheFillSize) // Use GetDmaAlignment -#endif - -#define KeGetDcacheFillSize() 1L - - -#define KeFlushIoBuffers(Mdl, ReadOperation, DmaOperation) - - -#define ExAcquireSpinLock(Lock, OldIrql) KeAcquireSpinLock((Lock), (OldIrql)) -#define ExReleaseSpinLock(Lock, OldIrql) KeReleaseSpinLock((Lock), (OldIrql)) -#define ExAcquireSpinLockAtDpcLevel(Lock) KeAcquireSpinLockAtDpcLevel(Lock) -#define ExReleaseSpinLockFromDpcLevel(Lock) KeReleaseSpinLockFromDpcLevel(Lock) - - -#define KeQueryTickCount(CurrentCount) { \ - KSYSTEM_TIME volatile *_TickCount = *((PKSYSTEM_TIME *)(&KeTickCount)); \ - for (;;) { \ - (CurrentCount)->HighPart = _TickCount->High1Time; \ - (CurrentCount)->LowPart = _TickCount->LowPart; \ - if ((CurrentCount)->HighPart == _TickCount->High2Time) break; \ - YieldProcessor(); \ - } \ -} - -// -// The non-volatile 387 state -// - -typedef struct _KFLOATING_SAVE { - ULONG ControlWord; - ULONG StatusWord; - ULONG ErrorOffset; - ULONG ErrorSelector; - ULONG DataOffset; // Not used in wdm - ULONG DataSelector; - ULONG Cr0NpxState; - ULONG Spare1; // Not used in wdm -} KFLOATING_SAVE, *PKFLOATING_SAVE; - -// -// Structure of AMD cache information returned by CPUID instruction -// - -typedef union _AMD_L1_CACHE_INFO { - ULONG Ulong; - struct { - UCHAR LineSize; - UCHAR LinesPerTag; - UCHAR Associativity; - UCHAR Size; - }; -} AMD_L1_CACHE_INFO, *PAMD_L1_CACHE_INFO; - -typedef union _AMD_L2_CACHE_INFO { - ULONG Ulong; - struct { - UCHAR LineSize; - UCHAR LinesPerTag : 4; - UCHAR Associativity : 4; - USHORT Size; - }; -} AMD_L2_CACHE_INFO, *PAMD_L2_CACHE_INFO; - -typedef union _AMD_L3_CACHE_INFO { - ULONG Ulong; - struct { - UCHAR LineSize; - UCHAR LinesPerTag : 4; - UCHAR Associativity : 4; - USHORT Reserved : 2; - USHORT Size : 14; - }; -} AMD_L3_CACHE_INFO, *PAMD_L3_CACHE_INFO; - -// -// Structure of Intel deterministic cache information returned by -// CPUID instruction -// - -typedef enum _INTEL_CACHE_TYPE { - IntelCacheNull, - IntelCacheData, - IntelCacheInstruction, - IntelCacheUnified, - IntelCacheRam, - IntelCacheTrace -} INTEL_CACHE_TYPE; - -typedef union INTEL_CACHE_INFO_EAX { - ULONG Ulong; - struct { - INTEL_CACHE_TYPE Type : 5; - ULONG Level : 3; - ULONG SelfInitializing : 1; - ULONG FullyAssociative : 1; - ULONG Reserved : 4; - ULONG ThreadsSharing : 12; - ULONG ProcessorCores : 6; - }; -} INTEL_CACHE_INFO_EAX, *PINTEL_CACHE_INFO_EAX; - -typedef union INTEL_CACHE_INFO_EBX { - ULONG Ulong; - struct { - ULONG LineSize : 12; - ULONG Partitions : 10; - ULONG Associativity : 10; - }; -} INTEL_CACHE_INFO_EBX, *PINTEL_CACHE_INFO_EBX; - -// -// i386 Specific portions of mm component -// - -// -// Define the page size for the Intel 386 as 4096 (0x1000). -// - -#define PAGE_SIZE 0x1000 - -// -// Define the number of trailing zeroes in a page aligned virtual address. -// This is used as the shift count when shifting virtual addresses to -// virtual page numbers. -// - -#define PAGE_SHIFT 12L - - -#define MmGetProcedureAddress(Address) (Address) -#define MmLockPagableCodeSection(Address) MmLockPagableDataSection(Address) - -#define KIP0PCRADDRESS 0xffdff000 - -#define KI_USER_SHARED_DATA 0xffdf0000 -#define SharedUserData ((KUSER_SHARED_DATA * const) KI_USER_SHARED_DATA) - -// -// Result type definition for i386. (Machine specific enumerate type -// which is return type for portable exinterlockedincrement/decrement -// procedures.) In general, you should use the enumerated type defined -// in ex.h instead of directly referencing these constants. -// - -// Flags loaded into AH by LAHF instruction - -#define EFLAG_SIGN 0x8000 -#define EFLAG_ZERO 0x4000 -#define EFLAG_SELECT (EFLAG_SIGN | EFLAG_ZERO) - -#define RESULT_NEGATIVE ((EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT) -#define RESULT_ZERO ((~EFLAG_SIGN & EFLAG_ZERO) & EFLAG_SELECT) -#define RESULT_POSITIVE ((~EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT) - -// -// Convert various portable ExInterlock APIs into their architectural -// equivalents. -// - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(ExInterlockedIncrementLong) // Use InterlockedIncrement -#pragma deprecated(ExInterlockedDecrementLong) // Use InterlockedDecrement -#pragma deprecated(ExInterlockedExchangeUlong) // Use InterlockedExchange -#endif - -#define ExInterlockedIncrementLong(Addend,Lock) \ - Exfi386InterlockedIncrementLong(Addend) - -#define ExInterlockedDecrementLong(Addend,Lock) \ - Exfi386InterlockedDecrementLong(Addend) - -#define ExInterlockedExchangeUlong(Target,Value,Lock) \ - Exfi386InterlockedExchangeUlong(Target,Value) - -#define ExInterlockedAddUlong ExfInterlockedAddUlong -#define ExInterlockedInsertHeadList ExfInterlockedInsertHeadList -#define ExInterlockedInsertTailList ExfInterlockedInsertTailList -#define ExInterlockedRemoveHeadList ExfInterlockedRemoveHeadList -#define ExInterlockedPopEntryList ExfInterlockedPopEntryList -#define ExInterlockedPushEntryList ExfInterlockedPushEntryList - -#if !defined(MIDL_PASS) -#if defined(NO_INTERLOCKED_INTRINSICS) || defined(_CROSS_PLATFORM_) - -NTKERNELAPI -LONG -FASTCALL -InterlockedIncrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -NTKERNELAPI -LONG -FASTCALL -InterlockedDecrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -NTKERNELAPI -LONG -FASTCALL -InterlockedExchange( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Value - ); - -LONG -FASTCALL -InterlockedExchangeAdd( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Increment - ); - -NTKERNELAPI -LONG -FASTCALL -InterlockedCompareExchange ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - -#define InterlockedCompareExchangePointer(Destination, ExChange, Comperand) \ - (PVOID)InterlockedCompareExchange((PLONG)Destination, (LONG)ExChange, (LONG)Comperand) - -NTKERNELAPI -LONGLONG -FASTCALL -ExfInterlockedCompareExchange64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in PLONGLONG ExChange, - __in PLONGLONG Comperand - ); - -FORCEINLINE -LONGLONG -InterlockedCompareExchange64_inline ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG ExChange, - __in LONGLONG Comperand - ) -{ - return ExfInterlockedCompareExchange64(Destination, &ExChange, &Comperand); -} - -#define InterlockedCompareExchange64 InterlockedCompareExchange64_inline - -#else // NO_INTERLOCKED_INTRINSICS || _CROSS_PLATFORM_ - -#if (_MSC_FULL_VER > 13009037) -LONG -__cdecl -_InterlockedExchange( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Value - ); - -#pragma intrinsic(_InterlockedExchange) -#define InterlockedExchange _InterlockedExchange -#else -FORCEINLINE -LONG -FASTCALL -InterlockedExchange( - __inout __drv_interlocked LONG volatile *Target, - __in LONG Value - ) -{ - __asm { - mov eax, Value - mov ecx, Target - xchg [ecx], eax - } -} -#endif - -#if (_MSC_FULL_VER > 13009037) -LONG -__cdecl -_InterlockedIncrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -#pragma intrinsic(_InterlockedIncrement) -#define InterlockedIncrement _InterlockedIncrement -#else -#define InterlockedIncrement(Addend) (InterlockedExchangeAdd (Addend, 1)+1) -#endif - -#if (_MSC_FULL_VER > 13009037) -LONG -__cdecl -_InterlockedDecrement( - __inout __drv_interlocked LONG volatile *Addend - ); - -#pragma intrinsic(_InterlockedDecrement) -#define InterlockedDecrement _InterlockedDecrement -#else -#define InterlockedDecrement(Addend) (InterlockedExchangeAdd (Addend, -1)-1) -#endif - -#if (_MSC_FULL_VER > 13009037) -LONG -__cdecl -_InterlockedExchangeAdd( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Increment - ); - -#pragma intrinsic(_InterlockedExchangeAdd) -#define InterlockedExchangeAdd _InterlockedExchangeAdd -#else - -FORCEINLINE -LONG -FASTCALL -InterlockedExchangeAdd( - __inout __drv_interlocked LONG volatile *Addend, - __in LONG Increment - ) -{ - __asm { - mov eax, Increment - mov ecx, Addend - lock xadd [ecx], eax - } -} - -#endif - -#if (_MSC_FULL_VER > 13009037) -LONG -__cdecl -_InterlockedCompareExchange ( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG ExChange, - __in LONG Comperand - ); - -#pragma intrinsic(_InterlockedCompareExchange) -#define InterlockedCompareExchange (LONG)_InterlockedCompareExchange -#else -FORCEINLINE -LONG -FASTCALL -InterlockedCompareExchange( - __inout __drv_interlocked LONG volatile *Destination, - __in LONG Exchange, - __in LONG Comperand - ) -{ - __asm { - mov eax, Comperand - mov ecx, Destination - mov edx, Exchange - lock cmpxchg [ecx], edx - } -} -#endif - -#define InterlockedCompareExchangePointer(Destination, ExChange, Comperand) \ - (PVOID)InterlockedCompareExchange((PLONG)Destination, (LONG)ExChange, (LONG)Comperand) - -NTKERNELAPI -LONGLONG -FASTCALL -ExfInterlockedCompareExchange64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in PLONGLONG ExChange, - __in PLONGLONG Comperand - ); - -LONGLONG -FORCEINLINE -InterlockedCompareExchange64_inline ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG ExChange, - __in LONGLONG Comperand - ) -{ - return ExfInterlockedCompareExchange64(Destination, &ExChange, &Comperand); -} - -#if (_MSC_FULL_VER >= 140031008) - -LONGLONG -__cdecl -_InterlockedCompareExchange64 ( - __inout __drv_interlocked LONGLONG volatile *Destination, - __in LONGLONG ExChange, - __in LONGLONG Comperand - ); - -#pragma intrinsic(_InterlockedCompareExchange64) -#define InterlockedCompareExchange64 _InterlockedCompareExchange64 - -#else - -#define InterlockedCompareExchange64 InterlockedCompareExchange64_inline - -#endif // _MSC_FULL_VER > 140031008 - -#endif // INTERLOCKED_INTRINSICS || _CROSS_PLATFORM_ - -#define InterlockedExchangePointer(Target, Value) \ - (PVOID)InterlockedExchange((PLONG)Target, (LONG)Value) - -#endif // MIDL_PASS - -#define InterlockedIncrementAcquire InterlockedIncrement -#define InterlockedIncrementRelease InterlockedIncrement -#define InterlockedDecrementAcquire InterlockedDecrement -#define InterlockedDecrementRelease InterlockedDecrement -#define InterlockedExchangeAcquire64 InterlockedExchange64 -#define InterlockedCompareExchangeAcquire InterlockedCompareExchange -#define InterlockedCompareExchangeRelease InterlockedCompareExchange -#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 -#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 -#define InterlockedCompareExchangePointerAcquire InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerRelease InterlockedCompareExchangePointer - -#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd((LONG *)a, b) -#define InterlockedIncrementSizeT(a) InterlockedIncrement((LONG *)a) -#define InterlockedDecrementSizeT(a) InterlockedDecrement((LONG *)a) - - -#if !defined(MIDL_PASS) && defined(_M_IX86) - -// -// i386 function definitions -// - - -// -// Get current IRQL. -// -// On x86 this function resides in the HAL -// - -__drv_maxIRQL(HIGH_LEVEL) -__drv_savesIRQL -NTHALAPI -KIRQL -NTAPI -KeGetCurrentIrql( - VOID - ); - -#endif // !defined(MIDL_PASS) && defined(_M_IX86) - - -//++ -// -// VOID -// KeMemoryBarrier ( -// VOID -// ) -// -// VOID -// KeMemoryBarrierWithoutFence ( -// VOID -// ) -// -// -// Routine Description: -// -// These functions order memory accesses as seen by other processors. -// -// Arguments: -// -// None. -// -// Return Value: -// -// None. -// -//-- - -#ifdef __cplusplus -extern "C" { -#endif - -// -// Define function to flush a cache line. -// - -#define CacheLineFlush(Address) _mm_clflush(Address) - -VOID -_mm_clflush ( - VOID const *Address - ); - -#pragma intrinsic(_mm_clflush) - -VOID -_ReadWriteBarrier( - VOID - ); - -#ifdef __cplusplus -} -#endif - -#pragma intrinsic(_ReadWriteBarrier) - -#pragma warning( push ) -#pragma warning( disable : 4793 ) - -FORCEINLINE -VOID -KeMemoryBarrier ( - VOID - ) -{ - LONG Barrier; - __asm { - xchg Barrier, eax - } -} - -#pragma warning( pop ) - -#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier() - - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_valueIs(<0;==0) -__drv_when(return==0, __drv_floatSaved) -NTKERNELAPI -NTSTATUS -NTAPI -KeSaveFloatingPointState ( - __out __deref __drv_neverHold(FloatState) - __drv_when(return==0, __deref __drv_acquiresResource(FloatState)) - PKFLOATING_SAVE FloatSave - ); - -__drv_valueIs(==0) -__drv_floatRestored -NTKERNELAPI -NTSTATUS -NTAPI -KeRestoreFloatingPointState ( - __in __deref __drv_releasesExclusiveResource(FloatState) - PKFLOATING_SAVE FloatSave - ); - - -#endif // defined(_X86_) - - - -#if defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - -// -// Define intrinsic function to do in's and out's. -// - -#ifdef __cplusplus -extern "C" { -#endif - -UCHAR -__inbyte ( - __in USHORT Port - ); - -USHORT -__inword ( - __in USHORT Port - ); - -ULONG -__indword ( - __in USHORT Port - ); - -VOID -__outbyte ( - __in USHORT Port, - __in UCHAR Data - ); - -VOID -__outword ( - __in USHORT Port, - __in USHORT Data - ); - -VOID -__outdword ( - __in USHORT Port, - __in ULONG Data - ); - -VOID -__inbytestring ( - __in USHORT Port, - __out_ecount_full(Count) PUCHAR Buffer, - __in ULONG Count - ); - -VOID -__inwordstring ( - __in USHORT Port, - __out_ecount_full(Count) PUSHORT Buffer, - __in ULONG Count - ); - -VOID -__indwordstring ( - __in USHORT Port, - __out_ecount_full(Count) PULONG Buffer, - __in ULONG Count - ); - -VOID -__outbytestring ( - __in USHORT Port, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ); - -VOID -__outwordstring ( - __in USHORT Port, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ); - -VOID -__outdwordstring ( - __in USHORT Port, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ); - -#pragma intrinsic(__inbyte) -#pragma intrinsic(__inword) -#pragma intrinsic(__indword) -#pragma intrinsic(__outbyte) -#pragma intrinsic(__outword) -#pragma intrinsic(__outdword) -#pragma intrinsic(__inbytestring) -#pragma intrinsic(__inwordstring) -#pragma intrinsic(__indwordstring) -#pragma intrinsic(__outbytestring) -#pragma intrinsic(__outwordstring) -#pragma intrinsic(__outdwordstring) - -#ifdef __cplusplus -} -#endif - -#endif // defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS) - - -#if defined(_AMD64_) // ntddk nthal irqls -// -// Types to use to contain PFNs and their counts. -// - -typedef ULONG PFN_COUNT; -typedef LONG64 SPFN_NUMBER, *PSPFN_NUMBER; -typedef ULONG64 PFN_NUMBER, *PPFN_NUMBER; - -// -// Define maximum size of flush multiple TB request. -// - -#define FLUSH_MULTIPLE_MAXIMUM 19 - -// -// Indicate that the AMD64 compiler supports the allocate pragmas. -// - -#define ALLOC_PRAGMA 1 -#define ALLOC_DATA_PRAGMA 1 - -// -// Define functions to read and write CR8. -// -// CR8 is the APIC TPR register. -// - -#ifdef __cplusplus -extern "C" { -#endif - -#define ReadCR8() __readcr8() - -__drv_maxIRQL(HIGH_LEVEL) -__drv_savesIRQL -ULONG64 -__readcr8 ( - VOID - ); - -#define WriteCR8(Data) __writecr8(Data) - -__drv_maxIRQL(HIGH_LEVEL) -__drv_setsIRQL(Data) -VOID -__writecr8 ( - __in ULONG64 Data - ); - -#pragma intrinsic(__readcr8) -#pragma intrinsic(__writecr8) - -#ifdef __cplusplus -} -#endif - - - - -#if defined(_AMD64_) && !defined(DSF_DRIVER) - -// -// I/O space read and write macros. -// -// The READ/WRITE_REGISTER_* calls manipulate I/O registers in MEMORY space. -// -// The READ/WRITE_PORT_* calls manipulate I/O registers in PORT space. -// - -#ifdef __cplusplus -extern "C" { -#endif - -__forceinline -UCHAR -READ_REGISTER_UCHAR ( - __in __drv_nonConstant volatile UCHAR *Register - ) -{ - _ReadWriteBarrier(); - return *Register; -} - -__forceinline -USHORT -READ_REGISTER_USHORT ( - __in __drv_nonConstant volatile USHORT *Register - ) -{ - _ReadWriteBarrier(); - return *Register; -} - -__forceinline -ULONG -READ_REGISTER_ULONG ( - __in __drv_nonConstant volatile ULONG *Register - ) -{ - _ReadWriteBarrier(); - return *Register; -} - -__forceinline -ULONG64 -READ_REGISTER_ULONG64 ( - __in __drv_nonConstant volatile ULONG64 *Register - ) -{ - _ReadWriteBarrier(); - return *Register; -} - -__forceinline -VOID -READ_REGISTER_BUFFER_UCHAR ( - __in __drv_nonConstant PUCHAR Register, - __out_ecount_full(Count) PUCHAR Buffer, - __in ULONG Count - ) -{ - _ReadWriteBarrier(); - __movsb(Buffer, Register, Count); - return; -} - -__forceinline -VOID -READ_REGISTER_BUFFER_USHORT ( - __in __drv_nonConstant PUSHORT Register, - __out_ecount_full(Count) PUSHORT Buffer, - __in ULONG Count - ) -{ - _ReadWriteBarrier(); - __movsw(Buffer, Register, Count); - return; -} - -__forceinline -VOID -READ_REGISTER_BUFFER_ULONG ( - __in __drv_nonConstant PULONG Register, - __out_ecount_full(Count) PULONG Buffer, - __in ULONG Count - ) -{ - _ReadWriteBarrier(); - __movsd(Buffer, Register, Count); - return; -} - -__forceinline -VOID -READ_REGISTER_BUFFER_ULONG64 ( - __in __drv_nonConstant PULONG64 Register, - __out_ecount_full(Count) PULONG64 Buffer, - __in ULONG Count - ) -{ - _ReadWriteBarrier(); - __movsq(Buffer, Register, Count); - return; -} - -__forceinline -VOID -WRITE_REGISTER_UCHAR ( - __in __drv_nonConstant volatile UCHAR *Register, - __in UCHAR Value - ) -{ - - *Register = Value; - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_USHORT ( - __in __drv_nonConstant volatile USHORT *Register, - __in USHORT Value - ) -{ - - *Register = Value; - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_ULONG ( - __in __drv_nonConstant volatile ULONG *Register, - __in ULONG Value - ) -{ - - *Register = Value; - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_ULONG64 ( - __in __drv_nonConstant volatile ULONG64 *Register, - __in ULONG64 Value - ) -{ - - *Register = Value; - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_BUFFER_UCHAR ( - __in __drv_nonConstant PUCHAR Register, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ) -{ - - __movsb(Register, Buffer, Count); - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_BUFFER_USHORT ( - __in __drv_nonConstant PUSHORT Register, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ) -{ - - __movsw(Register, Buffer, Count); - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_BUFFER_ULONG ( - __in __drv_nonConstant PULONG Register, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ) -{ - - __movsd(Register, Buffer, Count); - FastFence(); - return; -} - -__forceinline -VOID -WRITE_REGISTER_BUFFER_ULONG64 ( - __in __drv_nonConstant PULONG64 Register, - __in_ecount(Count) PULONG64 Buffer, - __in ULONG Count - ) -{ - - __movsq(Register, Buffer, Count); - FastFence(); - return; -} - -__forceinline -UCHAR -READ_PORT_UCHAR ( - __in __drv_nonConstant PUCHAR Port - ) - -{ - UCHAR Result; - - _ReadWriteBarrier(); - Result = __inbyte((USHORT)((ULONG_PTR)Port)); - _ReadWriteBarrier(); - return Result; -} - -__forceinline -USHORT -READ_PORT_USHORT ( - __in __drv_nonConstant PUSHORT Port - ) - -{ - USHORT Result; - - _ReadWriteBarrier(); - Result = __inword((USHORT)((ULONG_PTR)Port)); - _ReadWriteBarrier(); - return Result; -} - -__forceinline -ULONG -READ_PORT_ULONG ( - __in __drv_nonConstant PULONG Port - ) - -{ - ULONG Result; - - _ReadWriteBarrier(); - Result = __indword((USHORT)((ULONG_PTR)Port)); - _ReadWriteBarrier(); - return Result; -} - - -__forceinline -VOID -READ_PORT_BUFFER_UCHAR ( - __in __drv_nonConstant PUCHAR Port, - __out_ecount_full(Count) PUCHAR Buffer, - __in ULONG Count - ) - -{ - _ReadWriteBarrier(); - __inbytestring((USHORT)((ULONG_PTR)Port), Buffer, Count); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -READ_PORT_BUFFER_USHORT ( - __in __drv_nonConstant PUSHORT Port, - __out_ecount_full(Count) PUSHORT Buffer, - __in ULONG Count - ) - -{ - _ReadWriteBarrier(); - __inwordstring((USHORT)((ULONG_PTR)Port), Buffer, Count); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -READ_PORT_BUFFER_ULONG ( - __in __drv_nonConstant PULONG Port, - __out_ecount_full(Count) PULONG Buffer, - __in ULONG Count - ) - -{ - _ReadWriteBarrier(); - __indwordstring((USHORT)((ULONG_PTR)Port), Buffer, Count); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -WRITE_PORT_UCHAR ( - __in __drv_nonConstant PUCHAR Port, - __in UCHAR Value - ) - -{ - _ReadWriteBarrier(); - __outbyte((USHORT)((ULONG_PTR)Port), Value); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -WRITE_PORT_USHORT ( - __in __drv_nonConstant PUSHORT Port, - __in USHORT Value - ) - -{ - _ReadWriteBarrier(); - __outword((USHORT)((ULONG_PTR)Port), Value); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -WRITE_PORT_ULONG ( - __in __drv_nonConstant PULONG Port, - __in ULONG Value - ) - -{ - _ReadWriteBarrier(); - __outdword((USHORT)((ULONG_PTR)Port), Value); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -WRITE_PORT_BUFFER_UCHAR ( - __in __drv_nonConstant PUCHAR Port, - __in_ecount(Count) PUCHAR Buffer, - __in ULONG Count - ) - -{ - _ReadWriteBarrier(); - __outbytestring((USHORT)((ULONG_PTR)Port), Buffer, Count); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -WRITE_PORT_BUFFER_USHORT ( - __in __drv_nonConstant PUSHORT Port, - __in_ecount(Count) PUSHORT Buffer, - __in ULONG Count - ) - -{ - _ReadWriteBarrier(); - __outwordstring((USHORT)((ULONG_PTR)Port), Buffer, Count); - _ReadWriteBarrier(); - return; -} - -__forceinline -VOID -WRITE_PORT_BUFFER_ULONG ( - __in __drv_nonConstant PULONG Port, - __in_ecount(Count) PULONG Buffer, - __in ULONG Count - ) - -{ - _ReadWriteBarrier(); - __outdwordstring((USHORT)((ULONG_PTR)Port), Buffer, Count); - _ReadWriteBarrier(); - return; -} - -#ifdef __cplusplus -} -#endif - -#elif defined(_AMD64_) && defined(DSF_DRIVER) -#include -#endif - - - - -// -// Get data cache fill size. -// - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(KeGetDcacheFillSize) // Use GetDmaAlignment -#endif - -#define KeGetDcacheFillSize() 1L - - -#define KeFlushIoBuffers(Mdl, ReadOperation, DmaOperation) - - -#define ExAcquireSpinLock(Lock, OldIrql) KeAcquireSpinLock((Lock), (OldIrql)) -#define ExReleaseSpinLock(Lock, OldIrql) KeReleaseSpinLock((Lock), (OldIrql)) -#define ExAcquireSpinLockAtDpcLevel(Lock) KeAcquireSpinLockAtDpcLevel(Lock) -#define ExReleaseSpinLockFromDpcLevel(Lock) KeReleaseSpinLockFromDpcLevel(Lock) - - -#define KI_USER_SHARED_DATA 0xFFFFF78000000000UI64 - -#define SharedUserData ((KUSER_SHARED_DATA * const)KI_USER_SHARED_DATA) - -#define SharedInterruptTime (KI_USER_SHARED_DATA + 0x8) -#define SharedSystemTime (KI_USER_SHARED_DATA + 0x14) -#define SharedTickCount (KI_USER_SHARED_DATA + 0x320) - -#define KeQueryInterruptTime() *((volatile ULONG64 *)(SharedInterruptTime)) - -#define KeQuerySystemTime(CurrentCount) \ - *((PULONG64)(CurrentCount)) = *((volatile ULONG64 *)(SharedSystemTime)) - -#define KeQueryTickCount(CurrentCount) \ - *((PULONG64)(CurrentCount)) = *((volatile ULONG64 *)(SharedTickCount)) - -// -// Dummy nonvolatile floating state structure. -// - -typedef struct _KFLOATING_SAVE { - ULONG Dummy; -} KFLOATING_SAVE, *PKFLOATING_SAVE; - -// -// AMD64 Specific portions of mm component. -// -// Define the page size for the AMD64 as 4096 (0x1000). -// - -#define PAGE_SIZE 0x1000 - -// -// Define the number of trailing zeroes in a page aligned virtual address. -// This is used as the shift count when shifting virtual addresses to -// virtual page numbers. -// - -#define PAGE_SHIFT 12L - - -#define MmGetProcedureAddress(Address) (Address) -#define MmLockPagableCodeSection(Address) MmLockPagableDataSection(Address) - - -// -// Define macro to perform a load fence after a lock acquisition. -// - -#define LFENCE_ACQUIRE() LoadFence() - -#if !defined(_CROSS_PLATFORM_) - -FORCEINLINE -VOID -KeMemoryBarrier ( - VOID - ) - -/*++ - -Routine Description: - - This function orders memory accesses as seen by other processors. - -Arguments: - - None. - -Return Value: - - None. - ---*/ - -{ - - FastFence(); - LFENCE_ACQUIRE(); - return; -} - -//++ -// -// VOID -// KeMemoryBarrierWithoutFence ( -// VOID -// ) -// -// -// Routine Description: -// -// This function instructs the compiler not to reorder loads and stores -// across the function invocation. -// -// Arguments: -// -// None. -// -// Return Value: -// -// None. -// -//-- - -#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier() - -#else - -#define KeMemoryBarrier() -#define KeMemoryBarrierWithoutFence() - -#endif - - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_valueIs(<0;==0) -__drv_when(return==0, __drv_floatSaved) -__forceinline -NTSTATUS -KeSaveFloatingPointState ( - __out __deref __drv_neverHold(FloatState) - __drv_when(return==0, __deref __drv_acquiresResource(FloatState)) - PVOID FloatingState - ) - -#pragma warning (suppress:28104 28161) // PFD can't recognize the implementation -{ - - UNREFERENCED_PARAMETER(FloatingState); - - return STATUS_SUCCESS; -} - -__drv_valueIs(==0) -__drv_floatRestored -__forceinline -NTSTATUS -KeRestoreFloatingPointState ( - __in __deref __drv_releasesExclusiveResource(FloatState) PVOID FloatingState - ) - -#pragma warning (suppress:28103 28162) // PFD can't recognize the implementation -{ - - UNREFERENCED_PARAMETER(FloatingState); - - return STATUS_SUCCESS; -} - - -#endif // defined(_AMD64_) - - -// -// Platform specific kernel fucntions to raise and lower IRQL. -// - - -#if defined(_AMD64_) && !defined(MIDL_PASS) - - -__drv_maxIRQL(HIGH_LEVEL) -__drv_savesIRQL -__forceinline -KIRQL -KeGetCurrentIrql ( - VOID - ) - -/*++ - -Routine Description: - - This function return the current IRQL. - -Arguments: - - None. - -Return Value: - - The current IRQL is returned as the function value. - ---*/ - -{ - - return (KIRQL)ReadCR8(); -} - -__drv_maxIRQL(HIGH_LEVEL) -__forceinline -VOID -KeLowerIrql ( - __in __drv_nonConstant __drv_restoresIRQL KIRQL NewIrql - ) - -/*++ - -Routine Description: - - This function lowers the IRQL to the specified value. - -Arguments: - - NewIrql - Supplies the new IRQL value. - -Return Value: - - None. - ---*/ - -{ - - NT_ASSERT(KeGetCurrentIrql() >= NewIrql); - - WriteCR8(NewIrql); - return; -} - -#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a) - -__drv_maxIRQL(HIGH_LEVEL) -__drv_raisesIRQL(NewIrql) -__drv_savesIRQL -__forceinline -KIRQL -KfRaiseIrql ( - __in KIRQL NewIrql - ) - -/*++ - -Routine Description: - - This function raises the current IRQL to the specified value and returns - the previous IRQL. - -Arguments: - - NewIrql (cl) - Supplies the new IRQL value. - -Return Value: - - The previous IRQL is retured as the function value. - ---*/ - -{ - - KIRQL OldIrql; - - OldIrql = KeGetCurrentIrql(); - - NT_ASSERT(OldIrql <= NewIrql); - - WriteCR8(NewIrql); - return OldIrql; -} - -#endif // defined(_AMD64_) && !defined(MIDL_PASS) - - -#if defined(_IA64_) - -// -// Types to use to contain PFNs and their counts. -// - -typedef ULONG PFN_COUNT; - -typedef LONG_PTR SPFN_NUMBER, *PSPFN_NUMBER; -typedef ULONG_PTR PFN_NUMBER, *PPFN_NUMBER; - -// -// Indicate that the IA64 compiler supports the pragma textout construct. -// - -#define ALLOC_PRAGMA 1 - -// -// Define intrinsic calls and their prototypes -// - -#include "ia64reg.h" - -#ifdef __cplusplus -extern "C" { -#endif - -unsigned __int64 __getReg (int); -void __setReg (int, unsigned __int64); -void __isrlz (void); -void __dsrlz (void); -void __fwb (void); -void __mf (void); -void __mfa (void); -void __synci (void); -__int64 __thash (__int64); -__int64 __ttag (__int64); -void __ptcl (__int64, __int64); -void __ptcg (__int64, __int64); -void __ptcga (__int64, __int64); -void __ptri (__int64, __int64); -void __ptrd (__int64, __int64); -void __invalat (void); -void __break (int); -void __fc (__int64); -void __fci (__int64); -void __sum (int); -void __rsm (int); -void _ReleaseSpinLock( unsigned __int64 *); -void __yield(); -void __lfetch(int, volatile void const *); -void __lfetchfault(int, volatile void const *); -void __lfetch_excl(int, volatile void const *); -void __lfetchfault_excl(int, volatile void const *); -#ifdef _M_IA64 -#pragma intrinsic (__getReg) -#pragma intrinsic (__setReg) -#pragma intrinsic (__isrlz) -#pragma intrinsic (__dsrlz) -#pragma intrinsic (__fwb) -#pragma intrinsic (__mf) -#pragma intrinsic (__mfa) -#pragma intrinsic (__synci) -#pragma intrinsic (__thash) -#pragma intrinsic (__ttag) -#pragma intrinsic (__ptcl) -#pragma intrinsic (__ptcg) -#pragma intrinsic (__ptcga) -#pragma intrinsic (__ptri) -#pragma intrinsic (__ptrd) -#pragma intrinsic (__invalat) -#pragma intrinsic (__break) -#pragma intrinsic (__fc) -#pragma intrinsic (__fci) -#pragma intrinsic (__sum) -#pragma intrinsic (__rsm) -#pragma intrinsic (_ReleaseSpinLock) -#pragma intrinsic (__yield) -#pragma intrinsic (__lfetch) -#pragma intrinsic (__lfetchfault) -#pragma intrinsic (__lfetchfault_excl) -#pragma intrinsic (__lfetch_excl) -#endif // _M_IA64 - -#ifdef __cplusplus -} -#endif - - - -// -// Define length of interrupt vector table. -// - -#define MAXIMUM_VECTOR 256 - -// -// Begin of a block of definitions that must be synchronized with kxia64.h. - -#define KI_USER_SHARED_DATA ((ULONG_PTR)(KADDRESS_BASE + 0xFFFE0000)) -#define SharedUserData ((KUSER_SHARED_DATA * const)KI_USER_SHARED_DATA) - - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_valueIs(<0;==0) -__drv_when(return==0, __drv_floatSaved) -__forceinline -NTSTATUS -KeSaveFloatingPointState ( - __out __deref __drv_neverHold(FloatState) - __drv_when(return==0, __deref __drv_acquiresResource(FloatState)) - PVOID FloatingState - ) -#pragma warning (suppress:28104 28161) // PFD can't recognize the implementation -{ - - UNREFERENCED_PARAMETER(FloatingState); - - return STATUS_SUCCESS; -} - -__drv_valueIs(==0) -__drv_floatRestored -__forceinline -NTSTATUS -KeRestoreFloatingPointState ( - __in __deref __drv_releasesExclusiveResource(FloatState) PVOID FloatingState - ) - -#pragma warning (suppress:28103 28162) // PFD can't recognize the implementation -{ - - UNREFERENCED_PARAMETER(FloatingState); - - return STATUS_SUCCESS; -} - - - -// -// -// VOID -// KeMemoryBarrierWithoutFence ( -// VOID -// ) -// -// -// Routine Description: -// -// This function cases ordering of memory acceses generated by the compiler. -// -// -// Arguments: -// -// None. -// -// Return Value: -// -// None. -//-- - -#ifdef __cplusplus -extern "C" { -#endif - -VOID -_ReadWriteBarrier ( - VOID - ); - -#ifdef __cplusplus -} -#endif - -#pragma intrinsic(_ReadWriteBarrier) - -#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier() - -//++ -// -// -// VOID -// KeMemoryBarrier ( -// VOID -// ) -// -// -// Routine Description: -// -// This function cases ordering of memory acceses as generated by the compiler and -// as seen by other processors. -// -// -// Arguments: -// -// None. -// -// Return Value: -// -// None. -//-- - -#define KE_MEMORY_BARRIER_REQUIRED - -#define KeMemoryBarrier() __mf() - -// -// Define the page size -// - -#define PAGE_SIZE 0x2000 - -// -// Define the number of trailing zeroes in a page aligned virtual address. -// This is used as the shift count when shifting virtual addresses to -// virtual page numbers. -// - -#define PAGE_SHIFT 13L - -// -// Cache and write buffer flush functions. -// - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -KeFlushIoBuffers ( - __in PMDL Mdl, - __in BOOLEAN ReadOperation, - __in BOOLEAN DmaOperation - ); - - -// -// Kernel breakin breakpoint -// - -VOID -KeBreakinBreakpoint ( - VOID - ); - - -#define ExAcquireSpinLock(Lock, OldIrql) KeAcquireSpinLock((Lock), (OldIrql)) -#define ExReleaseSpinLock(Lock, OldIrql) KeReleaseSpinLock((Lock), (OldIrql)) -#define ExAcquireSpinLockAtDpcLevel(Lock) KeAcquireSpinLockAtDpcLevel(Lock) -#define ExReleaseSpinLockFromDpcLevel(Lock) KeReleaseSpinLockFromDpcLevel(Lock) - - -#if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) - -#define KeQueryTickCount(CurrentCount ) \ - *(PULONGLONG)(CurrentCount) = **((volatile ULONGLONG **)(&KeTickCount)); - -#else - -NTKERNELAPI -VOID -KeQueryTickCount ( - __out PLARGE_INTEGER CurrentCount - ); - -#endif // defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) - -// -// I/O space read and write macros. -// - -NTHALAPI -UCHAR -READ_PORT_UCHAR ( - __drv_nonConstant PUCHAR RegisterAddress - ); - -NTHALAPI -USHORT -READ_PORT_USHORT ( - __drv_nonConstant PUSHORT RegisterAddress - ); - -NTHALAPI -ULONG -READ_PORT_ULONG ( - __drv_nonConstant PULONG RegisterAddress - ); - -NTHALAPI -VOID -READ_PORT_BUFFER_UCHAR ( - __drv_nonConstant PUCHAR portAddress, - PUCHAR readBuffer, - ULONG readCount - ); - -NTHALAPI -VOID -READ_PORT_BUFFER_USHORT ( - __drv_nonConstant PUSHORT portAddress, - PUSHORT readBuffer, - ULONG readCount - ); - -NTHALAPI -VOID -READ_PORT_BUFFER_ULONG ( - __drv_nonConstant PULONG portAddress, - PULONG readBuffer, - ULONG readCount - ); - -NTHALAPI -VOID -WRITE_PORT_UCHAR ( - __drv_nonConstant PUCHAR portAddress, - UCHAR Data - ); - -NTHALAPI -VOID -WRITE_PORT_USHORT ( - __drv_nonConstant PUSHORT portAddress, - USHORT Data - ); - -NTHALAPI -VOID -WRITE_PORT_ULONG ( - __drv_nonConstant PULONG portAddress, - ULONG Data - ); - -NTHALAPI -VOID -WRITE_PORT_BUFFER_UCHAR ( - __drv_nonConstant PUCHAR portAddress, - PUCHAR writeBuffer, - ULONG writeCount - ); - -NTHALAPI -VOID -WRITE_PORT_BUFFER_USHORT ( - __drv_nonConstant PUSHORT portAddress, - PUSHORT writeBuffer, - ULONG writeCount - ); - -NTHALAPI -VOID -WRITE_PORT_BUFFER_ULONG ( - __drv_nonConstant PULONG portAddress, - PULONG writeBuffer, - ULONG writeCount - ); - - -#define READ_REGISTER_UCHAR(x) \ - (__mf(), *(volatile UCHAR * const)(x)) - -#define READ_REGISTER_USHORT(x) \ - (__mf(), *(volatile USHORT * const)(x)) - -#define READ_REGISTER_ULONG(x) \ - (__mf(), *(volatile ULONG * const)(x)) - -#define READ_REGISTER_ULONG64(x) \ - (__mf(), *(volatile ULONG64 * const)(x)) - -#define READ_REGISTER_BUFFER_UCHAR(x, y, z) { \ - PUCHAR registerBuffer = x; \ - PUCHAR readBuffer = y; \ - ULONG readCount; \ - __mf(); \ - for (readCount = z; readCount--; readBuffer++, registerBuffer++) { \ - *readBuffer = *(volatile UCHAR * const)(registerBuffer); \ - } \ -} - -#define READ_REGISTER_BUFFER_USHORT(x, y, z) { \ - PUSHORT registerBuffer = x; \ - PUSHORT readBuffer = y; \ - ULONG readCount; \ - __mf(); \ - for (readCount = z; readCount--; readBuffer++, registerBuffer++) { \ - *readBuffer = *(volatile USHORT * const)(registerBuffer); \ - } \ -} - -#define READ_REGISTER_BUFFER_ULONG(x, y, z) { \ - PULONG registerBuffer = x; \ - PULONG readBuffer = y; \ - ULONG readCount; \ - __mf(); \ - for (readCount = z; readCount--; readBuffer++, registerBuffer++) { \ - *readBuffer = *(volatile ULONG * const)(registerBuffer); \ - } \ -} - -#define READ_REGISTER_BUFFER_ULONG64(x, y, z) { \ - PULONG64 registerBuffer = x; \ - PULONG64 readBuffer = y; \ - ULONG readCount; \ - __mf(); \ - for (readCount = z; readCount--; readBuffer++, registerBuffer++) { \ - *readBuffer = *(volatile ULONG64 * const)(registerBuffer); \ - } \ -} - -#define WRITE_REGISTER_UCHAR(x, y) { \ - *(volatile UCHAR * const)(x) = y; \ - KeFlushWriteBuffer(); \ -} - -#define WRITE_REGISTER_USHORT(x, y) { \ - *(volatile USHORT * const)(x) = y; \ - KeFlushWriteBuffer(); \ -} - -#define WRITE_REGISTER_ULONG(x, y) { \ - *(volatile ULONG * const)(x) = y; \ - KeFlushWriteBuffer(); \ -} - -#define WRITE_REGISTER_ULONG64(x, y) { \ - *(volatile ULONG64 * const)(x) = y; \ - KeFlushWriteBuffer(); \ -} - -#define WRITE_REGISTER_BUFFER_UCHAR(x, y, z) { \ - PUCHAR registerBuffer = x; \ - PUCHAR writeBuffer = y; \ - ULONG writeCount; \ - for (writeCount = z; writeCount--; writeBuffer++, registerBuffer++) { \ - *(volatile UCHAR * const)(registerBuffer) = *writeBuffer; \ - } \ - KeFlushWriteBuffer(); \ -} - -#define WRITE_REGISTER_BUFFER_USHORT(x, y, z) { \ - PUSHORT registerBuffer = x; \ - PUSHORT writeBuffer = y; \ - ULONG writeCount; \ - for (writeCount = z; writeCount--; writeBuffer++, registerBuffer++) { \ - *(volatile USHORT * const)(registerBuffer) = *writeBuffer; \ - } \ - KeFlushWriteBuffer(); \ -} - -#define WRITE_REGISTER_BUFFER_ULONG(x, y, z) { \ - PULONG registerBuffer = x; \ - PULONG writeBuffer = y; \ - ULONG writeCount; \ - for (writeCount = z; writeCount--; writeBuffer++, registerBuffer++) { \ - *(volatile ULONG * const)(registerBuffer) = *writeBuffer; \ - } \ - KeFlushWriteBuffer(); \ -} - -#define WRITE_REGISTER_BUFFER_ULONG64(x, y, z) { \ - PULONG64 registerBuffer = x; \ - PULONG64 writeBuffer = y; \ - ULONG writeCount; \ - for (writeCount = z; writeCount--; writeBuffer++, registerBuffer++) { \ - *(volatile ULONG64 * const)(registerBuffer) = *writeBuffer; \ - } \ - KeFlushWriteBuffer(); \ -} - - -// -// Non-volatile floating point state -// - -typedef struct _KFLOATING_SAVE { - ULONG Reserved; -} KFLOATING_SAVE, *PKFLOATING_SAVE; - - -__drv_maxIRQL(HIGH_LEVEL) -__drv_savesIRQL -NTKERNELAPI -KIRQL -KeGetCurrentIrql( - VOID - ); - -__drv_maxIRQL(HIGH_LEVEL) -NTKERNELAPI -VOID -KeLowerIrql ( - __in __drv_nonConstant __drv_restoresIRQL KIRQL NewIrql - ); - -__drv_maxIRQL(HIGH_LEVEL) -__drv_raisesIRQL(NewIrql) -NTKERNELAPI -VOID -KeRaiseIrql ( - __in KIRQL NewIrql, - __out __deref __drv_savesIRQL PKIRQL OldIrql - ); - - -#define MmGetProcedureAddress(Address) (Address) -#define MmLockPagableCodeSection(PLabelAddress) \ - MmLockPagableDataSection((PVOID)(*((PULONGLONG)PLabelAddress))) - -#define VRN_MASK 0xE000000000000000UI64 // Virtual Region Number mask - -// -// The lowest address for system space. -// - -#define MM_LOWEST_SYSTEM_ADDRESS ((PVOID)((ULONG_PTR)(KADDRESS_BASE + 0xC0C00000))) -#endif // defined(_IA64_) - -// -// Event Specific Access Rights. -// - -#define EVENT_QUERY_STATE 0x0001 -#define EVENT_MODIFY_STATE 0x0002 -#define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) - - -// -// Semaphore Specific Access Rights. -// - -#define SEMAPHORE_QUERY_STATE 0x0001 -#define SEMAPHORE_MODIFY_STATE 0x0002 - -#define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) - - -typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP { - RelationProcessorCore, - RelationNumaNode, - RelationCache, - RelationProcessorPackage, - RelationGroup, - RelationAll = 0xffff -} LOGICAL_PROCESSOR_RELATIONSHIP; - -#define LTP_PC_SMT 0x1 - -typedef enum _PROCESSOR_CACHE_TYPE { - CacheUnified, - CacheInstruction, - CacheData, - CacheTrace -} PROCESSOR_CACHE_TYPE; - -#define CACHE_FULLY_ASSOCIATIVE 0xFF - -typedef struct _CACHE_DESCRIPTOR { - UCHAR Level; - UCHAR Associativity; - USHORT LineSize; - ULONG Size; - PROCESSOR_CACHE_TYPE Type; -} CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR; - -typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION { - ULONG_PTR ProcessorMask; - LOGICAL_PROCESSOR_RELATIONSHIP Relationship; - union { - struct { - UCHAR Flags; - } ProcessorCore; - struct { - ULONG NodeNumber; - } NumaNode; - CACHE_DESCRIPTOR Cache; - ULONGLONG Reserved[2]; - } DUMMYUNIONNAME; -} SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION; - -typedef struct _PROCESSOR_RELATIONSHIP { - UCHAR Flags; - UCHAR Reserved[21]; - USHORT GroupCount; - __field_ecount(GroupCount) GROUP_AFFINITY GroupMask[ANYSIZE_ARRAY]; -} PROCESSOR_RELATIONSHIP, *PPROCESSOR_RELATIONSHIP; - -typedef struct _NUMA_NODE_RELATIONSHIP { - ULONG NodeNumber; - UCHAR Reserved[20]; - GROUP_AFFINITY GroupMask; -} NUMA_NODE_RELATIONSHIP, *PNUMA_NODE_RELATIONSHIP; - -typedef struct _CACHE_RELATIONSHIP { - UCHAR Level; - UCHAR Associativity; - USHORT LineSize; - ULONG CacheSize; - PROCESSOR_CACHE_TYPE Type; - UCHAR Reserved[20]; - GROUP_AFFINITY GroupMask; -} CACHE_RELATIONSHIP, *PCACHE_RELATIONSHIP; - -typedef struct _PROCESSOR_GROUP_INFO { - UCHAR MaximumProcessorCount; - UCHAR ActiveProcessorCount; - UCHAR Reserved[38]; - KAFFINITY ActiveProcessorMask; -} PROCESSOR_GROUP_INFO, *PPROCESSOR_GROUP_INFO; - -typedef struct _GROUP_RELATIONSHIP { - USHORT MaximumGroupCount; - USHORT ActiveGroupCount; - UCHAR Reserved[20]; - PROCESSOR_GROUP_INFO GroupInfo[ANYSIZE_ARRAY]; -} GROUP_RELATIONSHIP, *PGROUP_RELATIONSHIP; - -__struct_bcount(Size) struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX { - LOGICAL_PROCESSOR_RELATIONSHIP Relationship; - ULONG Size; - union { - PROCESSOR_RELATIONSHIP Processor; - NUMA_NODE_RELATIONSHIP NumaNode; - CACHE_RELATIONSHIP Cache; - GROUP_RELATIONSHIP Group; - } DUMMYUNIONNAME; -}; - -typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX; - - -// -// Defined processor features -// - -#define PF_FLOATING_POINT_PRECISION_ERRATA 0 -#define PF_FLOATING_POINT_EMULATED 1 -#define PF_COMPARE_EXCHANGE_DOUBLE 2 -#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 -#define PF_PPC_MOVEMEM_64BIT_OK 4 -#define PF_ALPHA_BYTE_INSTRUCTIONS 5 -#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 -#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 -#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 -#define PF_PAE_ENABLED 9 -#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 -#define PF_SSE_DAZ_MODE_AVAILABLE 11 -#define PF_NX_ENABLED 12 -#define PF_SSE3_INSTRUCTIONS_AVAILABLE 13 -#define PF_COMPARE_EXCHANGE128 14 -#define PF_COMPARE64_EXCHANGE128 15 -#define PF_CHANNELS_ENABLED 16 -#define PF_XSAVE_ENABLED 17 - -typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE { - StandardDesign, // None == 0 == standard design - NEC98x86, // NEC PC98xx series on X86 - EndAlternatives // past end of known alternatives -} ALTERNATIVE_ARCHITECTURE_TYPE; - -// correctly define these run-time definitions for non X86 machines - -#ifndef _X86_ - -#ifndef IsNEC_98 -#define IsNEC_98 (FALSE) -#endif - -#ifndef IsNotNEC_98 -#define IsNotNEC_98 (TRUE) -#endif - -#ifndef SetNEC_98 -#define SetNEC_98 -#endif - -#ifndef SetNotNEC_98 -#define SetNotNEC_98 -#endif - -#endif // _X86_ - -#define PROCESSOR_FEATURE_MAX 64 - -// -// Exception flag definitions. -// - - -#define EXCEPTION_NONCONTINUABLE 0x1 // Noncontinuable exception - - -// -// Define maximum number of exception parameters. -// - - -#define EXCEPTION_MAXIMUM_PARAMETERS 15 // maximum number of exception parameters - -// -// Exception record definition. -// - -typedef struct _EXCEPTION_RECORD { - NTSTATUS ExceptionCode; - ULONG ExceptionFlags; - struct _EXCEPTION_RECORD *ExceptionRecord; - PVOID ExceptionAddress; - ULONG NumberParameters; - ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; - } EXCEPTION_RECORD; - -typedef EXCEPTION_RECORD *PEXCEPTION_RECORD; - -typedef struct _EXCEPTION_RECORD32 { - NTSTATUS ExceptionCode; - ULONG ExceptionFlags; - ULONG ExceptionRecord; - ULONG ExceptionAddress; - ULONG NumberParameters; - ULONG ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; -} EXCEPTION_RECORD32, *PEXCEPTION_RECORD32; - -typedef struct _EXCEPTION_RECORD64 { - NTSTATUS ExceptionCode; - ULONG ExceptionFlags; - ULONG64 ExceptionRecord; - ULONG64 ExceptionAddress; - ULONG NumberParameters; - ULONG __unusedAlignment; - ULONG64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; -} EXCEPTION_RECORD64, *PEXCEPTION_RECORD64; - -// -// Typedef for pointer returned by exception_info() -// - -typedef struct _EXCEPTION_POINTERS { - PEXCEPTION_RECORD ExceptionRecord; - PCONTEXT ContextRecord; -} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS; - - -#define THREAD_WAIT_OBJECTS 3 // Builtin usable wait blocks - - - -// -// Several routines have an architecture specific implementation. Generate -// an error if a supported target is not defined. -// - -#if !(defined(_X86_) || defined(_AMD64_) || defined(_IA64_)) - -#error "No target architecture defined" - -#endif - -#if (NTDDI_VERSION < NTDDI_WIN7) || defined(_X86_) || !defined(NT_PROCESSOR_GROUPS) - -#define SINGLE_GROUP_LEGACY_API 1 - -#endif - - - - -// -// Interrupt modes. -// - -typedef enum _KINTERRUPT_MODE { - LevelSensitive, - Latched -} KINTERRUPT_MODE; - -typedef enum _KINTERRUPT_POLARITY { - InterruptPolarityUnknown, - InterruptActiveHigh, - InterruptActiveLow -} KINTERRUPT_POLARITY, *PKINTERRUPT_POLARITY; - - -// -// Wait reasons -// - -typedef enum _KWAIT_REASON { - Executive, - FreePage, - PageIn, - PoolAllocation, - DelayExecution, - Suspended, - UserRequest, - WrExecutive, - WrFreePage, - WrPageIn, - WrPoolAllocation, - WrDelayExecution, - WrSuspended, - WrUserRequest, - WrEventPair, - WrQueue, - WrLpcReceive, - WrLpcReply, - WrVirtualMemory, - WrPageOut, - WrRendezvous, - WrKeyedEvent, - WrTerminated, - WrProcessInSwap, - WrCpuRateControl, - WrCalloutStack, - WrKernel, - WrResource, - WrPushLock, - WrMutex, - WrQuantumEnd, - WrDispatchInt, - WrPreempted, - WrYieldExecution, - WrFastMutex, - WrGuardedMutex, - WrRundown, - MaximumWaitReason -} KWAIT_REASON; - - -typedef struct _KWAIT_BLOCK { - LIST_ENTRY WaitListEntry; - struct _KTHREAD *Thread; - PVOID Object; - struct _KWAIT_BLOCK *NextWaitBlock; - USHORT WaitKey; - UCHAR WaitType; - volatile UCHAR BlockState; - -#if defined(_WIN64) - - LONG SpareLong; - -#endif - -} KWAIT_BLOCK, *PKWAIT_BLOCK, *PRKWAIT_BLOCK; - -// -// Thread start function -// - -typedef -__drv_sameIRQL -__drv_functionClass(KSTART_ROUTINE) -VOID -KSTART_ROUTINE ( - __in PVOID StartContext - ); -typedef KSTART_ROUTINE *PKSTART_ROUTINE; - -// -// Kernel object structure definitions -// - -// -// Device Queue object and entry -// - -#define ASSERT_DEVICE_QUEUE(E) NT_ASSERT((E)->Type == DeviceQueueObject) - -typedef struct _KDEVICE_QUEUE { - CSHORT Type; - CSHORT Size; - LIST_ENTRY DeviceListHead; - KSPIN_LOCK Lock; - -#if defined(_AMD64_) - - union { - BOOLEAN Busy; - struct { - LONG64 Reserved : 8; - LONG64 Hint : 56; - }; - }; - -#else - - BOOLEAN Busy; - -#endif - -} KDEVICE_QUEUE, *PKDEVICE_QUEUE, *PRKDEVICE_QUEUE; - -typedef struct _KDEVICE_QUEUE_ENTRY { - LIST_ENTRY DeviceListEntry; - ULONG SortKey; - BOOLEAN Inserted; -} KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY, *PRKDEVICE_QUEUE_ENTRY; - -// -// Define the interrupt service function type and the empty struct -// type. -// - -__drv_functionClass(KSERVICE_ROUTINE) -__drv_requiresIRQL(HIGH_LEVEL) -__drv_sameIRQL -typedef -BOOLEAN -KSERVICE_ROUTINE ( - __in struct _KINTERRUPT *Interrupt, - __in PVOID ServiceContext - ); - -typedef KSERVICE_ROUTINE *PKSERVICE_ROUTINE; - -__drv_functionClass(KMESSAGE_SERVICE_ROUTINE) -__drv_sameIRQL -typedef -BOOLEAN -KMESSAGE_SERVICE_ROUTINE ( - __in struct _KINTERRUPT *Interrupt, - __in PVOID ServiceContext, - __in ULONG MessageID - ); - -typedef KMESSAGE_SERVICE_ROUTINE *PKMESSAGE_SERVICE_ROUTINE; - -// -// Mutant object -// - -#define ASSERT_MUTANT(E) NT_ASSERT(KOBJECT_TYPE(E) == MutantObject) - -typedef struct _KMUTANT { - DISPATCHER_HEADER Header; - LIST_ENTRY MutantListEntry; - struct _KTHREAD *OwnerThread; - BOOLEAN Abandoned; - UCHAR ApcDisable; -} KMUTANT, *PKMUTANT, *PRKMUTANT, KMUTEX, *PKMUTEX, *PRKMUTEX; - -// -// -// Semaphore object -// -// N.B. The limit field must be the last member of this structure. -// - -#define ASSERT_SEMAPHORE(E) NT_ASSERT(KOBJECT_TYPE(E) == SemaphoreObject) - -typedef struct _KSEMAPHORE { - DISPATCHER_HEADER Header; - LONG Limit; -} KSEMAPHORE, *PKSEMAPHORE, *PRKSEMAPHORE; - -#define KSEMAPHORE_ACTUAL_LENGTH \ - (FIELD_OFFSET(KSEMAPHORE, Limit) + sizeof(LONG)) - -// -// DPC object -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -KeInitializeDpc ( - __out __drv_aliasesMem PRKDPC Dpc, - __in PKDEFERRED_ROUTINE DeferredRoutine, - __in_opt __drv_aliasesMem PVOID DeferredContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -NTKERNELAPI -VOID -KeInitializeThreadedDpc ( - __out PRKDPC Dpc, - __in PKDEFERRED_ROUTINE DeferredRoutine, - __in_opt PVOID DeferredContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -BOOLEAN -KeInsertQueueDpc ( - __inout PRKDPC Dpc, - __in_opt PVOID SystemArgument1, - __in_opt PVOID SystemArgument2 - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(HIGH_LEVEL) -NTKERNELAPI -BOOLEAN -KeRemoveQueueDpc ( - __inout PRKDPC Dpc - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -KeSetImportanceDpc ( - __inout PRKDPC Dpc, - __in KDPC_IMPORTANCE Importance - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) && defined(SINGLE_GROUP_LEGACY_API) -NTKERNELAPI -VOID -KeSetTargetProcessorDpc ( - __inout PRKDPC Dpc, - __in CCHAR Number - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WINXPSP2) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeFlushQueuedDpcs ( - VOID - ); -#endif - -// -// Device queue object -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -KeInitializeDeviceQueue ( - __out PKDEVICE_QUEUE DeviceQueue - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_requiresIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -KeInsertDeviceQueue ( - __inout PKDEVICE_QUEUE DeviceQueue, - __inout PKDEVICE_QUEUE_ENTRY DeviceQueueEntry - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_requiresIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -KeInsertByKeyDeviceQueue ( - __inout PKDEVICE_QUEUE DeviceQueue, - __inout PKDEVICE_QUEUE_ENTRY DeviceQueueEntry, - __in ULONG SortKey - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_requiresIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PKDEVICE_QUEUE_ENTRY -KeRemoveDeviceQueue ( - __inout PKDEVICE_QUEUE DeviceQueue - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_requiresIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PKDEVICE_QUEUE_ENTRY -KeRemoveByKeyDeviceQueue ( - __inout PKDEVICE_QUEUE DeviceQueue, - __in ULONG SortKey - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_requiresIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PKDEVICE_QUEUE_ENTRY -KeRemoveByKeyDeviceQueueIfBusy ( - __inout PKDEVICE_QUEUE DeviceQueue, - __in ULONG SortKey - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -KeRemoveEntryDeviceQueue ( - __inout PKDEVICE_QUEUE DeviceQueue, - __inout PKDEVICE_QUEUE_ENTRY DeviceQueueEntry - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(HIGH_LEVEL) -NTKERNELAPI -BOOLEAN -KeSynchronizeExecution ( - __inout PKINTERRUPT Interrupt, - __in PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, - __in_opt __drv_aliasesMem PVOID SynchronizeContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(HIGH_LEVEL) -__drv_savesIRQL -__drv_setsIRQL(HIGH_LEVEL) -NTKERNELAPI -KIRQL -KeAcquireInterruptSpinLock ( - __inout __deref __drv_acquiresExclusiveResource(InterruptSpinLock) - PKINTERRUPT Interrupt - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_requiresIRQL(HIGH_LEVEL) -NTKERNELAPI -VOID -KeReleaseInterruptSpinLock ( - __inout __deref __drv_releasesExclusiveResource(InterruptSpinLock) - PKINTERRUPT Interrupt, - __in __drv_restoresIRQL KIRQL OldIrql - ); -#endif - -// -// Kernel dispatcher object functions -// -// Event Object -// - -NTKERNELAPI -VOID -KeInitializeEvent ( - __out PRKEVENT Event, - __in EVENT_TYPE Type, - __in BOOLEAN State - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -KeClearEvent ( - __inout PRKEVENT Event - ); - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG -KeReadStateEvent ( - __in PRKEVENT Event - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG -KeResetEvent ( - __inout PRKEVENT Event - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_when(Wait==0, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(Wait==1, __drv_maxIRQL(APC_LEVEL)) -__drv_when(Wait==1, __drv_reportError("Caution: 'Wait' argument does not provide" - " any synchronization guarantees, only a hint" - " to the system that the thread will immediately" - " issue a wait operation")) -NTKERNELAPI -LONG -KeSetEvent ( - __inout PRKEVENT Event, - __in KPRIORITY Increment, - __in __drv_constant BOOLEAN Wait - ); -#endif - -// -// Mutex object -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -KeInitializeMutex ( - __out PRKMUTEX Mutex, - __in ULONG Level - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG -KeReadStateMutex ( - __in PRKMUTEX Mutex - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_when(Wait==0, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(Wait==1, __drv_maxIRQL(APC_LEVEL)) -__drv_when(Wait==1, __drv_reportError("Caution: 'Wait' argument does not provide" - " any synchronization guarantees, only a hint" - " to the system that the thread will immediately" - " issue a wait operation")) -NTKERNELAPI -LONG -KeReleaseMutex ( - __inout PRKMUTEX Mutex, - __in BOOLEAN Wait - ); -#endif - -// -// Semaphore object -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -KeInitializeSemaphore ( - __out PRKSEMAPHORE Semaphore, - __in LONG Count, - __in LONG Limit - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG -KeReadStateSemaphore ( - __in PRKSEMAPHORE Semaphore - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_when(Wait==0, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(Wait==1, __drv_maxIRQL(APC_LEVEL)) -__drv_when(Wait==1, __drv_reportError("Caution: 'Wait' argument does not provide" - " any synchronization guarantees, only a hint" - " to the system that the thread will immediately" - " issue a wait operation")) -NTKERNELAPI -LONG -KeReleaseSemaphore ( - __inout PRKSEMAPHORE Semaphore, - __in KPRIORITY Increment, - __in LONG Adjustment, - __in __drv_constant BOOLEAN Wait - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -ULONG64 -KeQueryTotalCycleTimeProcess ( - __inout PKPROCESS Process, - __out PULONG64 CycleTimeStamp - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -KeDelayExecutionThread ( - __in KPROCESSOR_MODE WaitMode, - __in BOOLEAN Alertable, - __in PLARGE_INTEGER Interval - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -KPRIORITY -KeQueryPriorityThread ( - __in PKTHREAD Thread - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -ULONG -KeQueryRuntimeThread ( - __in PKTHREAD Thread, - __out PULONG UserTime - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -ULONG64 -KeQueryTotalCycleTimeThread ( - __inout PKTHREAD Thread, - __out PULONG64 CycleTimeStamp - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__checkReturn -NTKERNELAPI -NTSTATUS -KeSetTargetProcessorDpcEx ( - __inout PKDPC Dpc, - __in PPROCESSOR_NUMBER ProcNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) && defined(SINGLE_GROUP_LEGACY_API) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeRevertToUserAffinityThread ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) && defined(SINGLE_GROUP_LEGACY_API) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeSetSystemAffinityThread ( - __in KAFFINITY Affinity - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) && defined(SINGLE_GROUP_LEGACY_API) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeRevertToUserAffinityThreadEx ( - __in KAFFINITY Affinity - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeSetSystemGroupAffinityThread ( - __in PGROUP_AFFINITY Affinity, - __out_opt PGROUP_AFFINITY PreviousAffinity - ); - -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeRevertToUserGroupAffinityThread ( - __in PGROUP_AFFINITY PreviousAffinity - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_LONGHORN) && defined(SINGLE_GROUP_LEGACY_API) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -KAFFINITY -KeSetSystemAffinityThreadEx ( - __in KAFFINITY Affinity - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -KPRIORITY -KeSetPriorityThread ( - __inout PKTHREAD Thread, - __in KPRIORITY Priority - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_neverHoldCriticalRegion -__drv_acquiresCriticalRegion -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeEnterCriticalRegion ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_mustHoldCriticalRegion -__drv_releasesCriticalRegion -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeLeaveCriticalRegion ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_neverHoldCriticalRegion -__drv_acquiresCriticalRegion -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeEnterGuardedRegion ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_mustHoldCriticalRegion -__drv_releasesCriticalRegion -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -KeLeaveGuardedRegion ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -BOOLEAN -KeAreApcsDisabled ( - VOID - ); -#endif - - - -// -// Timer object -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -KeInitializeTimer ( - __out PKTIMER Timer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -KeInitializeTimerEx ( - __out PKTIMER Timer, - __in TIMER_TYPE Type - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -KeCancelTimer ( - __inout PKTIMER - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -KeReadStateTimer ( - __in PKTIMER Timer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -KeSetTimer ( - __inout PKTIMER Timer, - __in LARGE_INTEGER DueTime, - __in_opt PKDPC Dpc - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -KeSetTimerEx ( - __inout PKTIMER Timer, - __in LARGE_INTEGER DueTime, - __in LONG Period, - __in_opt PKDPC Dpc - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -KeSetCoalescableTimer ( - __inout PKTIMER Timer, - __in LARGE_INTEGER DueTime, - __in ULONG Period, - __in ULONG TolerableDelay, - __in_opt PKDPC Dpc - ); -#endif - - -#define KeWaitForMutexObject KeWaitForSingleObject - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_when((Timeout==NULL || *Timeout!=0), __drv_maxIRQL(APC_LEVEL)) -__drv_when((Timeout!=NULL && *Timeout==0), __drv_maxIRQL(DISPATCH_LEVEL)) -NTKERNELAPI -NTSTATUS -KeWaitForMultipleObjects ( - __in ULONG Count, - __in_ecount(Count) PVOID Object[], - __in __drv_strictTypeMatch(__drv_typeConst) WAIT_TYPE WaitType, - __in __drv_strictTypeMatch(__drv_typeCond) KWAIT_REASON WaitReason, - __in __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst) - KPROCESSOR_MODE WaitMode, - __in BOOLEAN Alertable, - __in_opt PLARGE_INTEGER Timeout, - __out_opt PKWAIT_BLOCK WaitBlockArray - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_when((Timeout==NULL || *Timeout!=0), __drv_maxIRQL(APC_LEVEL)) -__drv_when((Timeout!=NULL && *Timeout==0), __drv_maxIRQL(DISPATCH_LEVEL)) -NTKERNELAPI -NTSTATUS -KeWaitForSingleObject ( - __in __deref __drv_notPointer PVOID Object, - __in __drv_strictTypeMatch(__drv_typeCond) KWAIT_REASON WaitReason, - __in __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst) - KPROCESSOR_MODE WaitMode, - __in BOOLEAN Alertable, - __in_opt PLARGE_INTEGER Timeout - ); -#endif - -// -// Define interprocess interrupt generic call types. -// - -typedef -__drv_sameIRQL -__drv_functionClass(KIPI_BROADCAST_WORKER) -__drv_requiresIRQL(IPI_LEVEL) -ULONG_PTR -KIPI_BROADCAST_WORKER ( - __in ULONG_PTR Argument - ); - -typedef KIPI_BROADCAST_WORKER *PKIPI_BROADCAST_WORKER; - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_minIRQL(PASSIVE_LEVEL) -__drv_maxIRQL(IPI_LEVEL-1) -NTKERNELAPI -ULONG_PTR -KeIpiGenericCall ( - __in PKIPI_BROADCAST_WORKER BroadcastFunction, - __in ULONG_PTR Context - ); -#endif - -// -// spin lock functions -// - -#if defined(_X86_) && (defined(_WDM_INCLUDED_) || defined(WIN9X_COMPAT_SPINLOCK)) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -NTKERNELAPI -VOID -NTAPI -KeInitializeSpinLock ( - __out PKSPIN_LOCK SpinLock - ); - -#endif - -#else - -FORCEINLINE -VOID -NTAPI -KeInitializeSpinLock ( - __out PKSPIN_LOCK SpinLock - ) - -/*++ - -Routine Description: - - This function initializes a spinlock. - -Arguments: - - SpinLock - Supplies a pointer to a spinlock. - -Return Value: - - None. - ---*/ - -{ - - *SpinLock = 0; - return; -} - -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WS03) -__checkReturn -NTKERNELAPI -BOOLEAN -FASTCALL -KeTestSpinLock ( - __in PKSPIN_LOCK SpinLock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__checkReturn -__drv_minIRQL(DISPATCH_LEVEL) -__drv_valueIs(==1;==0) -NTKERNELAPI -BOOLEAN -FASTCALL -KeTryToAcquireSpinLockAtDpcLevel ( - __inout __deref __drv_neverHold(KeSpinLockType) - __drv_when(return!=0, __deref __drv_acquiresResource(KeSpinLockType)) - PKSPIN_LOCK SpinLock - ); -#endif - -#if defined(_X86_) // ntifs - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -FASTCALL -KefAcquireSpinLockAtDpcLevel ( - __inout __deref __drv_acquiresExclusiveResource(KeSpinLockType) - PKSPIN_LOCK SpinLock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -FASTCALL -KefReleaseSpinLockFromDpcLevel ( - __inout __deref __drv_releasesExclusiveResource(KeSpinLockType) - PKSPIN_LOCK SpinLock - ); -#endif - -#define KeAcquireSpinLockAtDpcLevel(a) KefAcquireSpinLockAtDpcLevel(a) -#define KeReleaseSpinLockFromDpcLevel(a) KefReleaseSpinLockFromDpcLevel(a) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_savesIRQL -__drv_setsIRQL(DISPATCH_LEVEL) -_DECL_HAL_KE_IMPORT -KIRQL -FASTCALL -KfAcquireSpinLock ( - __inout __deref __drv_acquiresExclusiveResource(KeSpinLockType) - PKSPIN_LOCK SpinLock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_requiresIRQL(DISPATCH_LEVEL) -_DECL_HAL_KE_IMPORT -VOID -FASTCALL -KfReleaseSpinLock ( - __inout __deref __drv_releasesExclusiveResource(KeSpinLockType) - PKSPIN_LOCK SpinLock, - __in __drv_restoresIRQL KIRQL NewIrql - ); -#endif - - -#define KeAcquireSpinLock(a,b) *(b) = KfAcquireSpinLock(a) -#define KeReleaseSpinLock(a,b) KfReleaseSpinLock(a,b) - -#else // ntifs - -// -// These functions are imported for IA64, ntddk, ntifs, nthal, ntosp, and wdm. -// They can be inlined for the system on AMD64. -// - -#define KeAcquireSpinLock(SpinLock, OldIrql) \ - *(OldIrql) = KeAcquireSpinLockRaiseToDpc(SpinLock) - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -KeAcquireSpinLockAtDpcLevel ( - __inout __deref __drv_acquiresExclusiveResource(KeSpinLockType) - PKSPIN_LOCK SpinLock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_savesIRQL -__drv_setsIRQL(DISPATCH_LEVEL) -NTKERNELAPI -KIRQL -KeAcquireSpinLockRaiseToDpc ( - __inout __deref __drv_acquiresExclusiveResource(KeSpinLockType) - PKSPIN_LOCK SpinLock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_requiresIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -KeReleaseSpinLock ( - __inout __deref __drv_releasesExclusiveResource(KeSpinLockType) - PKSPIN_LOCK SpinLock, - __in __drv_restoresIRQL KIRQL NewIrql - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_minIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -KeReleaseSpinLockFromDpcLevel ( - __inout __deref __drv_releasesExclusiveResource(KeSpinLockType) - PKSPIN_LOCK SpinLock - ); -#endif - -#endif // ntifs - - - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_savesIRQL -NTKERNELAPI -KIRQL -FASTCALL -KeAcquireSpinLockForDpc ( - __inout __deref __drv_acquiresExclusiveResource(KeSpinLockType) - PKSPIN_LOCK SpinLock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_requiresIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -FASTCALL -KeReleaseSpinLockForDpc ( - __inout __deref __drv_releasesExclusiveResource(KeSpinLockType) - PKSPIN_LOCK SpinLock, - __in __drv_restoresIRQL KIRQL OldIrql - ); -#endif - - - -// -// Queued spin lock functions for "in stack" lock handles. -// -// The following three functions RAISE and LOWER IRQL when a queued -// in stack spin lock is acquired or released using these routines. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_savesIRQLGlobal(QueuedSpinLock,LockHandle) -__drv_setsIRQL(DISPATCH_LEVEL) -_DECL_HAL_KE_IMPORT -VOID -FASTCALL -KeAcquireInStackQueuedSpinLock ( - __inout PKSPIN_LOCK SpinLock, - __out __deref __drv_acquiresExclusiveResource(KeQueuedSpinLockType) - PKLOCK_QUEUE_HANDLE LockHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_requiresIRQL(DISPATCH_LEVEL) -__drv_restoresIRQLGlobal(QueuedSpinLock,LockHandle) -_DECL_HAL_KE_IMPORT -VOID -FASTCALL -KeReleaseInStackQueuedSpinLock ( - __in __deref __drv_releasesExclusiveResource(KeQueuedSpinLockType) - PKLOCK_QUEUE_HANDLE LockHandle - ); -#endif - -// -// The following two functions do NOT raise or lower IRQL when a queued -// in stack spin lock is acquired or released using these functions. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_minIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -FASTCALL -KeAcquireInStackQueuedSpinLockAtDpcLevel ( - __inout PKSPIN_LOCK SpinLock, - __out __deref __drv_acquiresExclusiveResource(KeQueuedSpinLockType) - PKLOCK_QUEUE_HANDLE LockHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_requiresIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -FASTCALL -KeReleaseInStackQueuedSpinLockFromDpcLevel ( - __in __deref __drv_releasesExclusiveResource(KeQueuedSpinLockType) - PKLOCK_QUEUE_HANDLE LockHandle - ); -#endif - -// -// The following two functions conditionally raise or lower IRQL when a -// queued in-stack spin lock is acquired or released using these functions. -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_savesIRQLGlobal(QueuedSpinLock,LockHandle) -NTKERNELAPI -VOID -FASTCALL -KeAcquireInStackQueuedSpinLockForDpc ( - __inout PKSPIN_LOCK SpinLock, - __out __deref __drv_acquiresExclusiveResource(KeQueuedSpinLockType) - PKLOCK_QUEUE_HANDLE LockHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_requiresIRQL(DISPATCH_LEVEL) -__drv_restoresIRQLGlobal(QueuedSpinLock,LockHandle) -NTKERNELAPI -VOID -FASTCALL -KeReleaseInStackQueuedSpinLockForDpc ( - __in __deref __drv_releasesExclusiveResource(KeQueuedSpinLockType) - PKLOCK_QUEUE_HANDLE LockHandle - ); -#endif - -// -// Miscellaneous kernel functions -// - -typedef struct _KDPC_WATCHDOG_INFORMATION { - ULONG DpcTimeLimit; - ULONG DpcTimeCount; - ULONG DpcWatchdogLimit; - ULONG DpcWatchdogCount; - ULONG Reserved; -} KDPC_WATCHDOG_INFORMATION, *PKDPC_WATCHDOG_INFORMATION; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_requiresIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -KeQueryDpcWatchdogInformation ( - __out PKDPC_WATCHDOG_INFORMATION WatchdogInformation - ); -#endif - -typedef enum _KBUGCHECK_BUFFER_DUMP_STATE { - BufferEmpty, - BufferInserted, - BufferStarted, - BufferFinished, - BufferIncomplete -} KBUGCHECK_BUFFER_DUMP_STATE; - -typedef -__drv_functionClass(KBUGCHECK_CALLBACK_ROUTINE) -__drv_sameIRQL -VOID -KBUGCHECK_CALLBACK_ROUTINE ( - IN PVOID Buffer, - IN ULONG Length - ); -typedef KBUGCHECK_CALLBACK_ROUTINE *PKBUGCHECK_CALLBACK_ROUTINE; - -typedef struct _KBUGCHECK_CALLBACK_RECORD { - LIST_ENTRY Entry; - PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine; - __field_bcount_opt(Length) PVOID Buffer; - ULONG Length; - PUCHAR Component; - ULONG_PTR Checksum; - UCHAR State; -} KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD; - -#define KeInitializeCallbackRecord(CallbackRecord) \ - (CallbackRecord)->State = BufferEmpty - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTKERNELAPI -BOOLEAN -KeDeregisterBugCheckCallback ( - __inout PKBUGCHECK_CALLBACK_RECORD CallbackRecord - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -NTKERNELAPI -BOOLEAN -KeRegisterBugCheckCallback ( - __out PKBUGCHECK_CALLBACK_RECORD CallbackRecord, - __in PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine, - __in_bcount_opt(Length) PVOID Buffer, - __in ULONG Length, - __in PUCHAR Component - ); -#endif - -typedef enum _KBUGCHECK_CALLBACK_REASON { - KbCallbackInvalid, - KbCallbackReserved1, - KbCallbackSecondaryDumpData, - KbCallbackDumpIo, - KbCallbackAddPages -} KBUGCHECK_CALLBACK_REASON; - -typedef -__drv_functionClass(KBUGCHECK_REASON_CALLBACK_ROUTINE) -__drv_sameIRQL -VOID -KBUGCHECK_REASON_CALLBACK_ROUTINE ( - __in KBUGCHECK_CALLBACK_REASON Reason, - __in struct _KBUGCHECK_REASON_CALLBACK_RECORD* Record, - __inout PVOID ReasonSpecificData, - __in ULONG ReasonSpecificDataLength - ); -typedef KBUGCHECK_REASON_CALLBACK_ROUTINE *PKBUGCHECK_REASON_CALLBACK_ROUTINE; - -typedef struct _KBUGCHECK_REASON_CALLBACK_RECORD { - LIST_ENTRY Entry; - PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine; - PUCHAR Component; - ULONG_PTR Checksum; - KBUGCHECK_CALLBACK_REASON Reason; - UCHAR State; -} KBUGCHECK_REASON_CALLBACK_RECORD, *PKBUGCHECK_REASON_CALLBACK_RECORD; - -typedef struct _KBUGCHECK_SECONDARY_DUMP_DATA { - IN PVOID InBuffer; - IN ULONG InBufferLength; - IN ULONG MaximumAllowed; - OUT GUID Guid; - OUT PVOID OutBuffer; - OUT ULONG OutBufferLength; -} KBUGCHECK_SECONDARY_DUMP_DATA, *PKBUGCHECK_SECONDARY_DUMP_DATA; - -typedef enum _KBUGCHECK_DUMP_IO_TYPE { - KbDumpIoInvalid, - KbDumpIoHeader, - KbDumpIoBody, - KbDumpIoSecondaryData, - KbDumpIoComplete -} KBUGCHECK_DUMP_IO_TYPE; - -typedef struct _KBUGCHECK_DUMP_IO { - IN ULONG64 Offset; - IN PVOID Buffer; - IN ULONG BufferLength; - IN KBUGCHECK_DUMP_IO_TYPE Type; -} KBUGCHECK_DUMP_IO, *PKBUGCHECK_DUMP_IO; - -#define KB_ADD_PAGES_FLAG_VIRTUAL_ADDRESS 0x00000001UL -#define KB_ADD_PAGES_FLAG_PHYSICAL_ADDRESS 0x00000002UL -#define KB_ADD_PAGES_FLAG_ADDITIONAL_RANGES_EXIST 0x80000000UL - -typedef struct _KBUGCHECK_ADD_PAGES { - __inout PVOID Context; // Private context for callback use - __inout ULONG Flags; // Zero initialized on input - __in ULONG BugCheckCode; - __out ULONG_PTR Address; - __out ULONG_PTR Count; -} KBUGCHECK_ADD_PAGES, *PKBUGCHECK_ADD_PAGES; - -// -// Equates for exceptions which cause system fatal error -// - -#define EXCEPTION_DIVIDED_BY_ZERO 0 -#define EXCEPTION_DEBUG 1 -#define EXCEPTION_NMI 2 -#define EXCEPTION_INT3 3 -#define EXCEPTION_BOUND_CHECK 5 -#define EXCEPTION_INVALID_OPCODE 6 -#define EXCEPTION_NPX_NOT_AVAILABLE 7 -#define EXCEPTION_DOUBLE_FAULT 8 -#define EXCEPTION_NPX_OVERRUN 9 -#define EXCEPTION_INVALID_TSS 0x0A -#define EXCEPTION_SEGMENT_NOT_PRESENT 0x0B -#define EXCEPTION_STACK_FAULT 0x0C -#define EXCEPTION_GP_FAULT 0x0D -#define EXCEPTION_RESERVED_TRAP 0x0F -#define EXCEPTION_NPX_ERROR 0x010 -#define EXCEPTION_ALIGNMENT_CHECK 0x011 - -#if (NTDDI_VERSION >= NTDDI_WINXPSP1) -__checkReturn -NTKERNELAPI -BOOLEAN -KeDeregisterBugCheckReasonCallback ( - __inout PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecord - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXPSP1) -__checkReturn -NTKERNELAPI -BOOLEAN -KeRegisterBugCheckReasonCallback ( - __out PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecord, - __in PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine, - __in KBUGCHECK_CALLBACK_REASON Reason, - __in PUCHAR Component - ); -#endif - -typedef -__drv_functionClass(NMI_CALLBACK) -__drv_sameIRQL -BOOLEAN -NMI_CALLBACK( - __in_opt PVOID Context, - __in BOOLEAN Handled - ); -typedef NMI_CALLBACK *PNMI_CALLBACK; - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PVOID -KeRegisterNmiCallback ( - __in PNMI_CALLBACK CallbackRoutine, - __in_opt PVOID Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -KeDeregisterNmiCallback ( - __in PVOID Handle - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_preferredFunction("error logging or driver shutdown", - "Whenever possible, all kernel-mode components should log an error and " - "continue to run, rather than calling KeBugCheckEx") -NTKERNELAPI -DECLSPEC_NORETURN -VOID -NTAPI -KeBugCheckEx( - __in ULONG BugCheckCode, - __in ULONG_PTR BugCheckParameter1, - __in ULONG_PTR BugCheckParameter2, - __in ULONG_PTR BugCheckParameter3, - __in ULONG_PTR BugCheckParameter4 - ); -#endif - -#if !defined(_AMD64_) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -ULONGLONG -KeQueryInterruptTime ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -KeQuerySystemTime ( - __out PLARGE_INTEGER CurrentTime - ); -#endif - -#endif // !_AMD64_ - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -ULONG -KeQueryTimeIncrement ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -ULONGLONG -KeQueryUnbiasedInterruptTime ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -ULONG -KeGetRecommendedSharedDataAlignment ( - VOID - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) && defined(SINGLE_GROUP_LEGACY_API) -NTKERNELAPI -KAFFINITY -KeQueryActiveProcessors ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) && defined(SINGLE_GROUP_LEGACY_API) -NTKERNELAPI -ULONG -KeQueryActiveProcessorCount ( - __out_opt PKAFFINITY ActiveProcessors - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -ULONG -KeQueryActiveProcessorCountEx ( - __in USHORT GroupNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_LONGHORN) && defined(SINGLE_GROUP_LEGACY_API) -NTKERNELAPI -ULONG -KeQueryMaximumProcessorCount ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -ULONG -KeQueryMaximumProcessorCountEx ( - __in USHORT GroupNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -USHORT -KeQueryActiveGroupCount ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -USHORT -KeQueryMaximumGroupCount ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -KAFFINITY -KeQueryGroupAffinity ( - __in USHORT GroupNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -ULONG -KeGetCurrentProcessorNumberEx ( - __out_opt PPROCESSOR_NUMBER ProcNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -VOID -KeQueryNodeActiveAffinity ( - __in USHORT NodeNumber, - __out_opt PGROUP_AFFINITY Affinity, - __out_opt PUSHORT Count - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -USHORT -KeQueryNodeMaximumProcessorCount ( - __in USHORT NodeNumber - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -USHORT -KeQueryHighestNodeNumber ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -USHORT -KeGetCurrentNodeNumber ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -KeQueryLogicalProcessorRelationship ( - __in_opt PPROCESSOR_NUMBER ProcessorNumber, - __in LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType, - __out_bcount_opt(*Length) PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Information, - __inout PULONG Length - ); -#endif - - -#if defined(_IA64_) - -extern volatile LARGE_INTEGER KeTickCount; - -#elif defined(_X86_) - -extern volatile KSYSTEM_TIME KeTickCount; - -#endif - - - -typedef enum _MEMORY_CACHING_TYPE_ORIG { - MmFrameBufferCached = 2 -} MEMORY_CACHING_TYPE_ORIG; - -typedef enum _MEMORY_CACHING_TYPE { - MmNonCached = FALSE, - MmCached = TRUE, - MmWriteCombined = MmFrameBufferCached, - MmHardwareCoherentCached, - MmNonCachedUnordered, // IA64 - MmUSWCCached, - MmMaximumCacheType -} MEMORY_CACHING_TYPE; - - - -#define GM_LOCK_BIT 0x1 // Actual lock bit, 0 = Unlocked, 1 = Locked -#define GM_LOCK_BIT_V 0x0 // Lock bit as a bit number -#define GM_LOCK_WAITER_WOKEN 0x2 // A single waiter has been woken to acquire this lock -#define GM_LOCK_WAITER_INC 0x4 // Increment value to change the waiters count - -typedef struct _KGUARDED_MUTEX { - volatile LONG Count; - PKTHREAD Owner; - ULONG Contention; - KGATE Gate; - union { - struct { - SHORT KernelApcDisable; - SHORT SpecialApcDisable; - }; - - ULONG CombinedApcDisable; - }; - -} KGUARDED_MUTEX, *PKGUARDED_MUTEX; - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_maxIRQL(APC_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -NTKERNELAPI -BOOLEAN -KeAreAllApcsDisabled ( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_maxIRQL(APC_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -FASTCALL -KeInitializeGuardedMutex ( - __out PKGUARDED_MUTEX Mutex - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_neverHoldCriticalRegion -__drv_acquiresCriticalRegion -__drv_maxIRQL(APC_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -FASTCALL -KeAcquireGuardedMutex ( - __inout __deref __drv_neverHold(GuardedMutex) __deref __drv_acquiresResource(GuardedMutex) - PKGUARDED_MUTEX Mutex - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_mustHoldCriticalRegion -__drv_releasesCriticalRegion -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FASTCALL -KeReleaseGuardedMutex ( - __inout __deref __drv_releasesExclusiveResource(GuardedMutex) - PKGUARDED_MUTEX Mutex - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -__drv_valueIs(==1;==0) -NTKERNELAPI -BOOLEAN -FASTCALL -KeTryToAcquireGuardedMutex ( - __inout __deref __drv_neverHold(GuardedMutex) - __deref __drv_when(return==1, __drv_acquiresResource(GuardedMutex)) - PKGUARDED_MUTEX Mutex - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_maxIRQL(APC_LEVEL) -__drv_minIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -FASTCALL -KeAcquireGuardedMutexUnsafe ( - __inout __deref __drv_neverHold(KeFastMutex) __deref __drv_acquiresResource(KeFastMutex) - PKGUARDED_MUTEX FastMutex - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -FASTCALL -KeReleaseGuardedMutexUnsafe ( - __inout __deref __drv_releasesExclusiveResource(KeFastMutex) - __inout PKGUARDED_MUTEX FastMutex - ); -#endif - - -// -// Define dynamic processor add types. -// - -typedef enum { - KeProcessorAddStartNotify = 0, - KeProcessorAddCompleteNotify, - KeProcessorAddFailureNotify -} KE_PROCESSOR_CHANGE_NOTIFY_STATE; - -typedef struct _KE_PROCESSOR_CHANGE_NOTIFY_CONTEXT { - KE_PROCESSOR_CHANGE_NOTIFY_STATE State; - ULONG NtNumber; - NTSTATUS Status; - -#if (NTDDI_VERSION >= NTDDI_WIN7) - - PROCESSOR_NUMBER ProcNumber; - -#endif - - -} KE_PROCESSOR_CHANGE_NOTIFY_CONTEXT, *PKE_PROCESSOR_CHANGE_NOTIFY_CONTEXT; - -typedef -__drv_sameIRQL -__drv_functionClass(PROCESSOR_CALLBACK_FUNCTION) -VOID -PROCESSOR_CALLBACK_FUNCTION ( - __in PVOID CallbackContext, - __in PKE_PROCESSOR_CHANGE_NOTIFY_CONTEXT ChangeContext, - __inout PNTSTATUS OperationStatus - ); - -typedef PROCESSOR_CALLBACK_FUNCTION *PPROCESSOR_CALLBACK_FUNCTION; - -#define KE_PROCESSOR_CHANGE_ADD_EXISTING 1 - -#if (NTDDI_VERSION >= NTDDI_WS08) -__drv_maxIRQL(APC_LEVEL) -PVOID -KeRegisterProcessorChangeCallback ( - __in PPROCESSOR_CALLBACK_FUNCTION CallbackFunction, - __in_opt PVOID CallbackContext, - __in ULONG Flags - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS08) -__drv_maxIRQL(APC_LEVEL) -VOID -KeDeregisterProcessorChangeCallback ( - __in PVOID CallbackHandle - ); -#endif - - -#define INVALID_PROCESSOR_INDEX 0xffffffff - -NTSTATUS -KeGetProcessorNumberFromIndex ( - __in ULONG ProcIndex, - __out PPROCESSOR_NUMBER ProcNumber - ); - -ULONG -KeGetProcessorIndexFromNumber ( - __in PPROCESSOR_NUMBER ProcNumber - ); - - -typedef struct _XSTATE_SAVE { - -#if defined(_AMD64_) - - struct _XSTATE_SAVE* Prev; - struct _KTHREAD* Thread; - UCHAR Level; - XSTATE_CONTEXT XStateContext; - -#elif defined(_IA64_) - - ULONG Dummy; - -#elif defined(_X86_) - - union { - struct { - LONG64 Reserved1; - ULONG Reserved2; - - struct _XSTATE_SAVE* Prev; - - PXSAVE_AREA Reserved3; - - struct _KTHREAD* Thread; - - PVOID Reserved4; - - UCHAR Level; - }; - - XSTATE_CONTEXT XStateContext; - }; - -#endif -} XSTATE_SAVE, *PXSTATE_SAVE; - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_valueIs(<0;==0) -__drv_when(return==0, __drv_floatSaved) -NTKERNELAPI -NTSTATUS -NTAPI -KeSaveExtendedProcessorState ( - __in ULONG64 Mask, - __out __deref __drv_neverHold(XStateSave) - __drv_when(return==0, __deref __drv_acquiresResource(XStateSave)) - PXSTATE_SAVE XStateSave - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_floatRestored -NTKERNELAPI -VOID -NTAPI -KeRestoreExtendedProcessorState ( - __in __deref __drv_releasesExclusiveResource(XStateSave) - PXSTATE_SAVE XStateSave - ); -#endif - -// -// Define external data. -// - -#if defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_) || defined(_WDMDDK_) || defined(_NTOSP_) - -extern PBOOLEAN KdDebuggerNotPresent; -extern PBOOLEAN KdDebuggerEnabled; -#define KD_DEBUGGER_ENABLED *KdDebuggerEnabled -#define KD_DEBUGGER_NOT_PRESENT *KdDebuggerNotPresent - -#else - -extern BOOLEAN KdDebuggerNotPresent; -extern BOOLEAN KdDebuggerEnabled; -#define KD_DEBUGGER_ENABLED KdDebuggerEnabled -#define KD_DEBUGGER_NOT_PRESENT KdDebuggerNotPresent - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -KdDisableDebugger( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -KdEnableDebugger( - VOID - ); -#endif - -// -// KdRefreshDebuggerPresent attempts to communicate with -// the debugger host machine to refresh the state of -// KdDebuggerNotPresent. It returns the state of -// KdDebuggerNotPresent while the kd locks are held. -// KdDebuggerNotPresent may immediately change state -// after the kd locks are released so it may not -// match the return value. -// - -#if (NTDDI_VERSION >= NTDDI_WS03) -NTKERNELAPI -BOOLEAN -KdRefreshDebuggerNotPresent( - VOID - ); -#endif - -typedef enum _KD_OPTION { - KD_OPTION_SET_BLOCK_ENABLE, -} KD_OPTION; - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -NTSTATUS -KdChangeOption( - __in KD_OPTION Option, - __in ULONG InBufferBytes OPTIONAL, - __in PVOID InBuffer, - __in ULONG OutBufferBytes OPTIONAL, - __out PVOID OutBuffer, - __out PULONG OutBufferNeeded OPTIONAL - ); -#endif - - -// -// Pool Allocation routines (in pool.c) -// - -typedef enum _POOL_TYPE { - NonPagedPool, - PagedPool, - NonPagedPoolMustSucceed, - DontUseThisType, - NonPagedPoolCacheAligned, - PagedPoolCacheAligned, - NonPagedPoolCacheAlignedMustS, - MaxPoolType, - - // - // Note these per session types are carefully chosen so that the appropriate - // masking still applies as well as MaxPoolType above. - // - - NonPagedPoolSession = 32, - PagedPoolSession = NonPagedPoolSession + 1, - NonPagedPoolMustSucceedSession = PagedPoolSession + 1, - DontUseThisTypeSession = NonPagedPoolMustSucceedSession + 1, - NonPagedPoolCacheAlignedSession = DontUseThisTypeSession + 1, - PagedPoolCacheAlignedSession = NonPagedPoolCacheAlignedSession + 1, - NonPagedPoolCacheAlignedMustSSession = PagedPoolCacheAlignedSession + 1, -} POOL_TYPE; - -#define POOL_COLD_ALLOCATION 256 // Note this cannot encode into the header. - - -#define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE 8 -#define POOL_RAISE_IF_ALLOCATION_FAILURE 16 - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DECLSPEC_DEPRECATED_DDK // Use ExAllocatePoolWithTag -__drv_preferredFunction("ExAllocatePoolWithTag", - "No tag interferes with debugging.") -__drv_allocatesMem(Mem) -__drv_when(((PoolType&0x1))!=0, __drv_maxIRQL(APC_LEVEL)) -__drv_when(((PoolType&0x1))==0, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(((PoolType&0x2))!=0, - __drv_reportError("Must succeed pool allocations are forbidden. " - "Allocation failures cause a system crash")) -__drv_when(((PoolType&(0x2|POOL_RAISE_IF_ALLOCATION_FAILURE)))==0, - __post __maybenull __checkReturn) -__drv_when(((PoolType&(0x2|POOL_RAISE_IF_ALLOCATION_FAILURE)))!=0, - __post __notnull) -__bcount(NumberOfBytes) -NTKERNELAPI -PVOID -ExAllocatePool( - __drv_strictTypeMatch(__drv_typeExpr) __in POOL_TYPE PoolType, - __in SIZE_T NumberOfBytes - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DECLSPEC_DEPRECATED_DDK // Use ExAllocatePoolWithQuotaTag -__drv_preferredFunction("ExAllocatePoolWithQuotaTag", - "No tag interferes with debugging.") -__drv_allocatesMem(Mem) -__drv_when(((PoolType&0x1))!=0, __drv_maxIRQL(APC_LEVEL)) -__drv_when(((PoolType&0x1))==0, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(((PoolType&0x2))!=0, - __drv_reportError("Must succeed pool allocations are forbidden. " - "Allocation failures cause a system crash")) -__drv_when(((PoolType&POOL_QUOTA_FAIL_INSTEAD_OF_RAISE))!=0, - __post __maybenull __checkReturn) -__drv_when(((PoolType&POOL_QUOTA_FAIL_INSTEAD_OF_RAISE))==0, - __post __notnull) -__bcount(NumberOfBytes) -NTKERNELAPI -PVOID -ExAllocatePoolWithQuota( - __drv_strictTypeMatch(__drv_typeExpr) __in POOL_TYPE PoolType, - __in SIZE_T NumberOfBytes - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_allocatesMem(Mem) -__drv_when(((PoolType&0x1))!=0, __drv_maxIRQL(APC_LEVEL)) -__drv_when(((PoolType&0x1))==0, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(((PoolType&0x2))!=0, - __drv_reportError("Must succeed pool allocations are forbidden. " - "Allocation failures cause a system crash")) -__drv_when(((PoolType&(0x2|POOL_RAISE_IF_ALLOCATION_FAILURE)))==0, - __post __maybenull __checkReturn) -__drv_when(((PoolType&(0x2|POOL_RAISE_IF_ALLOCATION_FAILURE)))!=0, - __post __notnull) -__bcount(NumberOfBytes) -NTKERNELAPI -PVOID -NTAPI -ExAllocatePoolWithTag( - __in __drv_strictTypeMatch(__drv_typeExpr) POOL_TYPE PoolType, - __in SIZE_T NumberOfBytes, - __in ULONG Tag - ); - -#endif - -// -// _EX_POOL_PRIORITY_ provides a method for the system to handle requests -// intelligently in low resource conditions. -// -// LowPoolPriority should be used when it is acceptable to the driver for the -// mapping request to fail if the system is low on resources. An example of -// this could be for a non-critical network connection where the driver can -// handle the failure case when system resources are close to being depleted. -// -// NormalPoolPriority should be used when it is acceptable to the driver for the -// mapping request to fail if the system is very low on resources. An example -// of this could be for a non-critical local filesystem request. -// -// HighPoolPriority should be used when it is unacceptable to the driver for the -// mapping request to fail unless the system is completely out of resources. -// An example of this would be the paging file path in a driver. -// -// SpecialPool can be specified to bound the allocation at a page end (or -// beginning). This should only be done on systems being debugged as the -// memory cost is expensive. -// -// N.B. These values are very carefully chosen so that the pool allocation -// code can quickly crack the priority request. -// - -typedef enum _EX_POOL_PRIORITY { - LowPoolPriority, - LowPoolPrioritySpecialPoolOverrun = 8, - LowPoolPrioritySpecialPoolUnderrun = 9, - NormalPoolPriority = 16, - NormalPoolPrioritySpecialPoolOverrun = 24, - NormalPoolPrioritySpecialPoolUnderrun = 25, - HighPoolPriority = 32, - HighPoolPrioritySpecialPoolOverrun = 40, - HighPoolPrioritySpecialPoolUnderrun = 41 -} EX_POOL_PRIORITY; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_allocatesMem(Mem) -__drv_when(((PoolType&0x1))!=0, __drv_maxIRQL(APC_LEVEL)) -__drv_when(((PoolType&0x1))==0, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(((PoolType&0x2))!=0, - __drv_reportError("Must succeed pool allocations are forbidden. " - "Allocation failures cause a system crash")) -__drv_when(((PoolType&(0x2|POOL_RAISE_IF_ALLOCATION_FAILURE)))==0, - __post __maybenull __checkReturn) -__drv_when(((PoolType&(0x2|POOL_RAISE_IF_ALLOCATION_FAILURE)))!=0, - __post __notnull) -__bcount(NumberOfBytes) -NTKERNELAPI -PVOID -NTAPI -ExAllocatePoolWithTagPriority( - __in __drv_strictTypeMatch(__drv_typeCond) POOL_TYPE PoolType, - __in SIZE_T NumberOfBytes, - __in ULONG Tag, - __in __drv_strictTypeMatch(__drv_typeExpr) EX_POOL_PRIORITY Priority - ); - -#endif - -#ifndef POOL_TAGGING -#define ExAllocatePoolWithTag(a,b,c) ExAllocatePool(a,b) -#endif //POOL_TAGGING - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_allocatesMem(Mem) -__drv_when(((PoolType&0x1))!=0, __drv_maxIRQL(APC_LEVEL)) -__drv_when(((PoolType&0x1))==0, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(((PoolType&0x2))!=0, - __drv_reportError("Must succeed pool allocations are forbidden. " - "Allocation failures cause a system crash")) -__drv_when(((PoolType&POOL_QUOTA_FAIL_INSTEAD_OF_RAISE))!=0, - __post __maybenull __checkReturn) -__drv_when(((PoolType&POOL_QUOTA_FAIL_INSTEAD_OF_RAISE))==0, - __post __notnull) -__bcount(NumberOfBytes) -NTKERNELAPI -PVOID -ExAllocatePoolWithQuotaTag( - __in __drv_strictTypeMatch(__drv_typeExpr) POOL_TYPE PoolType, - __in SIZE_T NumberOfBytes, - __in ULONG Tag - ); - -#endif - -#ifndef POOL_TAGGING -#define ExAllocatePoolWithQuotaTag(a,b,c) ExAllocatePoolWithQuota(a,b) -#endif //POOL_TAGGING - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -NTAPI -ExFreePool( - __in __drv_freesMem(Mem) PVOID P - ); - -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -ExFreePoolWithTag( - __in __drv_freesMem(Mem) PVOID P, - __in ULONG Tag - ); - -#endif - - -// -// Routines to support fast mutexes. -// - -typedef struct _FAST_MUTEX { - -#define FM_LOCK_BIT 0x1 // Actual lock bit, 1 = Unlocked, 0 = Locked -#define FM_LOCK_BIT_V 0x0 // Lock bit as a bit number -#define FM_LOCK_WAITER_WOKEN 0x2 // A single waiter has been woken to acquire this lock -#define FM_LOCK_WAITER_INC 0x4 // Increment value to change the waiters count - - volatile LONG Count; - PKTHREAD Owner; - ULONG Contention; - KEVENT Event; - ULONG OldIrql; -} FAST_MUTEX, *PFAST_MUTEX; - -FORCEINLINE -VOID -ExInitializeFastMutex( - __out PFAST_MUTEX FastMutex - ) - -/*++ - -Routine Description: - - This function initializes a fast mutex object. - -Arguments: - - FastMutex - Supplies a pointer to a fast mutex object. - -Return Value: - - None. - ---*/ - -{ - - FastMutex->Count = FM_LOCK_BIT; - FastMutex->Owner = NULL; - FastMutex->Contention = 0; - KeInitializeEvent(&FastMutex->Event, SynchronizationEvent, FALSE); - return; -} - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -__drv_mustHoldCriticalRegion -NTKERNELAPI -VOID -FASTCALL -ExAcquireFastMutexUnsafe( - __inout __deref __drv_acquiresExclusiveResource(FastMutexType) - PFAST_MUTEX FastMutex - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -__drv_mustHoldCriticalRegion -NTKERNELAPI -VOID -FASTCALL -ExReleaseFastMutexUnsafe( - __inout __deref __drv_releasesExclusiveResource(FastMutexType) - PFAST_MUTEX FastMutex - ); - -#endif - - -#if defined(_NTHAL_) && defined(_X86_) - -__drv_raisesIRQL(APC_LEVEL) -__drv_savesIRQLGlobal(OldIrql, FastMutex) -NTKERNELAPI -VOID -FASTCALL -ExiAcquireFastMutex( - __inout __deref __drv_acquiresExclusiveResource(FastMutexType) - PFAST_MUTEX FastMutex - ); - -__drv_requiresIRQL(APC_LEVEL) -__drv_restoresIRQLGlobal(OldIrql, FastMutex) -NTKERNELAPI -VOID -FASTCALL -ExiReleaseFastMutex( - __inout __deref __drv_releasesExclusiveResource(FastMutexType) - __inout PFAST_MUTEX FastMutex - ); - -__checkReturn -__success(return!=FALSE) -__drv_raisesIRQL(APC_LEVEL) -__drv_savesIRQLGlobal(OldIrql, FastMutex) -NTKERNELAPI -BOOLEAN -FASTCALL -ExiTryToAcquireFastMutex( - __inout __deref __drv_acquiresExclusiveResource(FastMutexType) - PFAST_MUTEX FastMutex - ); - -#define ExAcquireFastMutex(FastMutex) ExiAcquireFastMutex(FastMutex) -#define ExReleaseFastMutex(FastMutex) ExiReleaseFastMutex(FastMutex) -#define ExTryToAcquireFastMutex(FastMutex) ExiTryToAcquireFastMutex(FastMutex) - -#else - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_raisesIRQL(APC_LEVEL) -__drv_savesIRQLGlobal(OldIrql, FastMutex) -NTKERNELAPI -VOID -FASTCALL -ExAcquireFastMutex ( - __inout __deref __drv_acquiresExclusiveResource(FastMutexType) - PFAST_MUTEX FastMutex - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_requiresIRQL(APC_LEVEL) -__drv_restoresIRQLGlobal(OldIrql, FastMutex) -NTKERNELAPI -VOID -FASTCALL -ExReleaseFastMutex ( - __inout __deref __drv_releasesExclusiveResource(FastMutexType) - PFAST_MUTEX FastMutex - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__checkReturn -__success(return!=FALSE) -__drv_raisesIRQL(APC_LEVEL) -__drv_savesIRQLGlobal(OldIrql, FastMutex) -NTKERNELAPI -BOOLEAN -FASTCALL -ExTryToAcquireFastMutex ( - __inout __deref __drv_acquiresExclusiveResource(FastMutexType) - PFAST_MUTEX FastMutex - ); - -#endif - -#endif // _NTHAL_ && _X86_ - - -// - -#if defined(_WIN64) - -#define ExInterlockedAddLargeStatistic(Addend, Increment) \ - (VOID)InterlockedAdd64(&(Addend)->QuadPart, Increment) - -#else - -#ifdef __cplusplus -extern "C" { -#endif - -LONG -__cdecl -_InterlockedAddLargeStatistic ( - __inout LONGLONG volatile *Addend, - __in ULONG Increment - ); - -#ifdef __cplusplus -} -#endif - -#pragma intrinsic(_InterlockedAddLargeStatistic) - -#define ExInterlockedAddLargeStatistic(Addend, Increment) \ - (VOID)_InterlockedAddLargeStatistic((PLONGLONG)&(Addend)->QuadPart, Increment) - -#endif // defined(_WIN64) - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -NTKERNELAPI -LARGE_INTEGER -ExInterlockedAddLargeInteger ( - __inout PLARGE_INTEGER Addend, - __in LARGE_INTEGER Increment, - __inout __deref __drv_neverHold(KeSpinLockType) PKSPIN_LOCK Lock - ); - -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -NTKERNELAPI -ULONG -FASTCALL -ExInterlockedAddUlong ( - __inout PULONG Addend, - __in ULONG Increment, - __inout __deref __drv_neverHold(KeSpinLockType) PKSPIN_LOCK Lock - ); - -#endif // NTDDI_VERSION >= NTDDI_WIN2K - - -#if defined(_AMD64_) || defined(_IA64_) - -#define ExInterlockedCompareExchange64(Destination, Exchange, Comperand, Lock) \ - InterlockedCompareExchange64(Destination, *(Exchange), *(Comperand)) - -#else - -#define ExInterlockedCompareExchange64(Destination, Exchange, Comperand, Lock) \ - ExfInterlockedCompareExchange64(Destination, Exchange, Comperand) - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -NTKERNELAPI -PLIST_ENTRY -FASTCALL -ExInterlockedInsertHeadList ( - __inout PLIST_ENTRY ListHead, - __inout __drv_aliasesMem PLIST_ENTRY ListEntry, - __inout __deref __drv_neverHold(KeSpinLockType) PKSPIN_LOCK Lock - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -NTKERNELAPI -PLIST_ENTRY -FASTCALL -ExInterlockedInsertTailList ( - __inout PLIST_ENTRY ListHead, - __inout __drv_aliasesMem PLIST_ENTRY ListEntry, - __inout __deref __drv_neverHold(KeSpinLockType) PKSPIN_LOCK Lock - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -NTKERNELAPI -PLIST_ENTRY -FASTCALL -ExInterlockedRemoveHeadList ( - __inout PLIST_ENTRY ListHead, - __inout __deref __drv_neverHold(KeSpinLockType) PKSPIN_LOCK Lock - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -NTKERNELAPI -PSINGLE_LIST_ENTRY -FASTCALL -ExInterlockedPopEntryList ( - __inout PSINGLE_LIST_ENTRY ListHead, - __inout __deref __drv_neverHold(KeSpinLockType) PKSPIN_LOCK Lock - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -NTKERNELAPI -PSINGLE_LIST_ENTRY -FASTCALL -ExInterlockedPushEntryList ( - __inout PSINGLE_LIST_ENTRY ListHead, - __inout __drv_aliasesMem PSINGLE_LIST_ENTRY ListEntry, - __inout __deref __drv_neverHold(KeSpinLockType) PKSPIN_LOCK Lock - ); - -#endif - - -// -// Define interlocked sequenced listhead functions. -// -// A sequenced interlocked list is a singly linked list with a header that -// contains the current depth and a sequence number. Each time an entry is -// inserted or removed from the list the depth is updated and the sequence -// number is incremented. This enables AMD64, IA64, and Pentium and later -// machines to insert and remove from the list without the use of spinlocks. -// - -#if !defined(_WINBASE_) - -#if defined(_WIN64) && (defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_) || defined(_NTOSP_)) - -NTKERNELAPI -VOID -InitializeSListHead ( - __out PSLIST_HEADER SListHead - ); - -#else - -// -// Since the following function will be compiled inline for user code, the -// initialization changes for IA64 will only take effect if the user code -// is recompiled with this new header. For those binaries that are recompiled -// with this new code, it will not have to go through an extra step of header -// initialization on its first push or pop operation. Note that the SLIST code -// will still work perfectly even without the changes in this initialization -// function. -// - -__inline -VOID -InitializeSListHead ( - __out PSLIST_HEADER SListHead - ) - -/*++ - -Routine Description: - - This function initializes a sequenced singly linked listhead. - -Arguments: - - SListHead - Supplies a pointer to a sequenced singly linked listhead. - -Return Value: - - None. - ---*/ - -{ - -#if defined(_IA64_) - - ULONG64 FeatureBits; - -#endif - - // - // Slist headers must be 16 byte aligned. - // - -#if defined(_WIN64) - - if (((ULONG_PTR)SListHead & 0xf) != 0) { - RtlRaiseStatus(STATUS_DATATYPE_MISALIGNMENT); - } - -#endif - - RtlZeroMemory(SListHead, sizeof(SLIST_HEADER)); - - // - // Check feature bits to determine if 16-byte atomic operations are - // supported. - // - -#if defined(_IA64_) - - FeatureBits = __getReg(CV_IA64_CPUID4); - if ((FeatureBits & KF_16BYTE_INSTR) != 0) { - - // - // Initialize 16-byte header. - // - // NB: For the 8-byte header, all elements in the list must reside in - // the same Region, but not necessarily the same as the Header. At this - // point there is no information to where will the items reside, so - // defer the actual initialization of 8-byte header to the first Push - // operation. - // - - SListHead->Header16.HeaderType = 1; - SListHead->Header16.Init = 1; - } - -#endif - - return; -} - -#endif - -#endif // !defined(_WINBASE_) - -#define ExInitializeSListHead InitializeSListHead - -PSLIST_ENTRY -FirstEntrySList ( - __in PSLIST_HEADER SListHead - ); - -#if defined(_WIN64) - -#if (defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_) || defined(_NTOSP_)) - -NTKERNELAPI -USHORT -ExQueryDepthSList ( - __in PSLIST_HEADER SListHead - ); - -#else - -__inline -USHORT -ExQueryDepthSList ( - __in PSLIST_HEADER SListHead - ) - -/*++ - -Routine Description: - - This function queries the current number of entries contained in a - sequenced single linked list. - -Arguments: - - SListHead - Supplies a pointer to the sequenced listhead which is - be queried. - -Return Value: - - The current number of entries in the sequenced singly linked list is - returned as the function value. - ---*/ - -{ - - return (USHORT)(SListHead->Alignment & 0xffff); -} - -#endif - -#else - -#define ExQueryDepthSList(_listhead_) (_listhead_)->Depth - -#endif - -#if defined(_WIN64) - -#define ExInterlockedPopEntrySList(Head, Lock) \ - ExpInterlockedPopEntrySList(Head) - -#define ExInterlockedPushEntrySList(Head, Entry, Lock) \ - ExpInterlockedPushEntrySList(Head, Entry) - -#define ExInterlockedFlushSList(Head) \ - ExpInterlockedFlushSList(Head) - -#if !defined(_WINBASE_) - -#define InterlockedPopEntrySList(Head) \ - ExpInterlockedPopEntrySList(Head) - -#define InterlockedPushEntrySList(Head, Entry) \ - ExpInterlockedPushEntrySList(Head, Entry) - -#define InterlockedFlushSList(Head) \ - ExpInterlockedFlushSList(Head) - -#define QueryDepthSList(Head) \ - ExQueryDepthSList(Head) - -#endif // !defined(_WINBASE_) - -NTKERNELAPI -PSLIST_ENTRY -ExpInterlockedPopEntrySList ( - __inout PSLIST_HEADER ListHead - ); - -NTKERNELAPI -PSLIST_ENTRY -ExpInterlockedPushEntrySList ( - __inout PSLIST_HEADER ListHead, - __inout __drv_aliasesMem PSLIST_ENTRY ListEntry - ); - -NTKERNELAPI -PSLIST_ENTRY -ExpInterlockedFlushSList ( - __inout PSLIST_HEADER ListHead - ); - -#else - -#if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) - -NTKERNELAPI -PSLIST_ENTRY -FASTCALL -ExInterlockedPopEntrySList ( - __inout PSLIST_HEADER ListHead, - __inout __deref __drv_neverHold(KeSpinLockType) PKSPIN_LOCK Lock - ); - -NTKERNELAPI -PSLIST_ENTRY -FASTCALL -ExInterlockedPushEntrySList ( - __inout PSLIST_HEADER ListHead, - __inout __drv_aliasesMem PSLIST_ENTRY ListEntry, - __inout __deref __drv_neverHold(KeSpinLockType) PKSPIN_LOCK Lock - ); - -#else - -#define ExInterlockedPopEntrySList(ListHead, Lock) \ - InterlockedPopEntrySList(ListHead) - -#define ExInterlockedPushEntrySList(ListHead, ListEntry, Lock) \ - InterlockedPushEntrySList(ListHead, ListEntry) - -#endif - -NTKERNELAPI -PSLIST_ENTRY -FASTCALL -ExInterlockedFlushSList ( - __inout PSLIST_HEADER ListHead - ); - -#if !defined(_WINBASE_) - -NTKERNELAPI -PSLIST_ENTRY -FASTCALL -InterlockedPopEntrySList ( - __inout PSLIST_HEADER ListHead - ); - -NTKERNELAPI -PSLIST_ENTRY -FASTCALL -InterlockedPushEntrySList ( - __inout PSLIST_HEADER ListHead, - __inout __drv_aliasesMem PSLIST_ENTRY ListEntry - ); - -#define InterlockedFlushSList(Head) \ - ExInterlockedFlushSList(Head) - -#define QueryDepthSList(Head) \ - ExQueryDepthSList(Head) - -#endif // !defined(_WINBASE_) - -#endif // defined(_WIN64) - - -#define LOOKASIDE_MINIMUM_BLOCK_SIZE (RTL_SIZEOF_THROUGH_FIELD (SLIST_ENTRY, Next)) - -// -// N.B. Note that this structure is not cache aligned to enable its use -// in a larger containing structure. -// - -typedef struct _LOOKASIDE_LIST_EX { - GENERAL_LOOKASIDE_POOL L; -} LOOKASIDE_LIST_EX, *PLOOKASIDE_LIST_EX; - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -#define EX_LOOKASIDE_LIST_EX_FLAGS_RAISE_ON_FAIL 0x00000001UL -#define EX_LOOKASIDE_LIST_EX_FLAGS_FAIL_NO_RAISE 0x00000002UL - -#define EX_MAXIMUM_LOOKASIDE_DEPTH_BASE 256 // Base maximum depth -#define EX_MAXIMUM_LOOKASIDE_DEPTH_LIMIT 1024 // Upper limit maximum depth - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -ExInitializeLookasideListEx ( - __out PLOOKASIDE_LIST_EX Lookaside, - __in_opt PALLOCATE_FUNCTION_EX Allocate, - __in_opt PFREE_FUNCTION_EX Free, - __in POOL_TYPE PoolType, - __in ULONG Flags, - __in SIZE_T Size, - __in ULONG Tag, - __in USHORT Depth - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -ExDeleteLookasideListEx ( - __inout PLOOKASIDE_LIST_EX Lookaside - ); - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -ExFlushLookasideListEx ( - __inout PLOOKASIDE_LIST_EX Lookaside - ); - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -FORCEINLINE -PVOID -ExAllocateFromLookasideListEx ( - __inout PLOOKASIDE_LIST_EX Lookaside - ) - -/*++ - -Routine Description: - - This function removes (pops) the first entry from the specified - lookaside list. - -Arguments: - - Lookaside - Supplies a pointer to a LOOKASIDE_LIST_EX structure. - -Return Value: - - If an entry is removed from the specified lookaside list, then the - address of the entry is returned as the function value. Otherwise, - NULL is returned. - ---*/ - -{ - - PVOID Entry; - - Lookaside->L.TotalAllocates += 1; - Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead); - if (Entry == NULL) { - Lookaside->L.AllocateMisses += 1; - Entry = (Lookaside->L.AllocateEx)(Lookaside->L.Type, - Lookaside->L.Size, - Lookaside->L.Tag, - Lookaside); - } - - return Entry; -} - -__drv_maxIRQL(DISPATCH_LEVEL) -FORCEINLINE -VOID -ExFreeToLookasideListEx ( - __inout PLOOKASIDE_LIST_EX Lookaside, - __in PVOID Entry - ) - -/*++ - -Routine Description: - - This function inserts (pushes) the specified entry into the specified - lookaside list. - -Arguments: - - Lookaside - Supplies a pointer to a LOOKASIDE_LIST_EX structure. - - Entry - Supples a pointer to the entry that is inserted in the - lookaside list. - -Return Value: - - None. - ---*/ - -{ - - Lookaside->L.TotalFrees += 1; - if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) { - Lookaside->L.FreeMisses += 1; - (Lookaside->L.FreeEx)(Entry, Lookaside); - - } else { - InterlockedPushEntrySList(&Lookaside->L.ListHead, (PSLIST_ENTRY)Entry); - } - - return; -} - -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - -typedef struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST { - - GENERAL_LOOKASIDE L; - -#if !defined(_AMD64_) && !defined(_IA64_) - - KSPIN_LOCK Lock__ObsoleteButDoNotDelete; - -#endif - -} NPAGED_LOOKASIDE_LIST, *PNPAGED_LOOKASIDE_LIST; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -ExInitializeNPagedLookasideList ( - __out PNPAGED_LOOKASIDE_LIST Lookaside, - __in_opt PALLOCATE_FUNCTION Allocate, - __in_opt PFREE_FUNCTION Free, - __in ULONG Flags, - __in SIZE_T Size, - __in ULONG Tag, - __in USHORT Depth - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -ExDeleteNPagedLookasideList ( - __inout PNPAGED_LOOKASIDE_LIST Lookaside - ); - -#endif - -__drv_maxIRQL(DISPATCH_LEVEL) -__inline -PVOID -ExAllocateFromNPagedLookasideList ( - __inout PNPAGED_LOOKASIDE_LIST Lookaside - ) - -/*++ - -Routine Description: - - This function removes (pops) the first entry from the specified - nonpaged lookaside list. - -Arguments: - - Lookaside - Supplies a pointer to a nonpaged lookaside list structure. - -Return Value: - - If an entry is removed from the specified lookaside list, then the - address of the entry is returned as the function value. Otherwise, - NULL is returned. - ---*/ - -{ - - PVOID Entry; - - Lookaside->L.TotalAllocates += 1; - -#if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) - - Entry = ExInterlockedPopEntrySList(&Lookaside->L.ListHead, - &Lookaside->Lock__ObsoleteButDoNotDelete); - -#else - - Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead); - -#endif - - if (Entry == NULL) { - Lookaside->L.AllocateMisses += 1; - Entry = (Lookaside->L.Allocate)(Lookaside->L.Type, - Lookaside->L.Size, - Lookaside->L.Tag); - } - - return Entry; -} - -__drv_maxIRQL(DISPATCH_LEVEL) -__inline -VOID -ExFreeToNPagedLookasideList ( - __inout PNPAGED_LOOKASIDE_LIST Lookaside, - __in PVOID Entry - ) - -/*++ - -Routine Description: - - This function inserts (pushes) the specified entry into the specified - nonpaged lookaside list. - -Arguments: - - Lookaside - Supplies a pointer to a nonpaged lookaside list structure. - - Entry - Supples a pointer to the entry that is inserted in the - lookaside list. - -Return Value: - - None. - ---*/ - -{ - - Lookaside->L.TotalFrees += 1; - if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) { - Lookaside->L.FreeMisses += 1; - (Lookaside->L.Free)(Entry); - - } else { - -#if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) - - ExInterlockedPushEntrySList(&Lookaside->L.ListHead, - (PSLIST_ENTRY)Entry, - &Lookaside->Lock__ObsoleteButDoNotDelete); - -#else - - InterlockedPushEntrySList(&Lookaside->L.ListHead, (PSLIST_ENTRY)Entry); - -#endif - - } - - return; -} - - - -typedef struct LOOKASIDE_ALIGN _PAGED_LOOKASIDE_LIST { - - GENERAL_LOOKASIDE L; - -#if !defined(_AMD64_) && !defined(_IA64_) - - FAST_MUTEX Lock__ObsoleteButDoNotDelete; - -#endif - -} PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST; - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -ExInitializePagedLookasideList ( - __out PPAGED_LOOKASIDE_LIST Lookaside, - __in_opt PALLOCATE_FUNCTION Allocate, - __in_opt PFREE_FUNCTION Free, - __in ULONG Flags, - __in SIZE_T Size, - __in ULONG Tag, - __in USHORT Depth - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -ExDeletePagedLookasideList ( - __inout PPAGED_LOOKASIDE_LIST Lookaside - ); - -#endif - -#if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PVOID -ExAllocateFromPagedLookasideList ( - __inout PPAGED_LOOKASIDE_LIST Lookaside - ); - -#else - -__drv_maxIRQL(APC_LEVEL) -__inline -PVOID -ExAllocateFromPagedLookasideList ( - __inout PPAGED_LOOKASIDE_LIST Lookaside - ) - -/*++ - -Routine Description: - - This function removes (pops) the first entry from the specified - paged lookaside list. - -Arguments: - - Lookaside - Supplies a pointer to a paged lookaside list structure. - -Return Value: - - If an entry is removed from the specified lookaside list, then the - address of the entry is returned as the function value. Otherwise, - NULL is returned. - ---*/ - -{ - - PVOID Entry; - - Lookaside->L.TotalAllocates += 1; - Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead); - if (Entry == NULL) { - Lookaside->L.AllocateMisses += 1; - Entry = (Lookaside->L.Allocate)(Lookaside->L.Type, - Lookaside->L.Size, - Lookaside->L.Tag); - } - - return Entry; -} - -#endif - -#if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -ExFreeToPagedLookasideList ( - __inout PPAGED_LOOKASIDE_LIST Lookaside, - __in PVOID Entry - ); - -#else - -__drv_maxIRQL(APC_LEVEL) -__inline -VOID -ExFreeToPagedLookasideList ( - __inout PPAGED_LOOKASIDE_LIST Lookaside, - __in PVOID Entry - ) - -/*++ - -Routine Description: - - This function inserts (pushes) the specified entry into the specified - paged lookaside list. - -Arguments: - - Lookaside - Supplies a pointer to a nonpaged lookaside list structure. - - Entry - Supples a pointer to the entry that is inserted in the - lookaside list. - -Return Value: - - None. - ---*/ - -{ - - Lookaside->L.TotalFrees += 1; - if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) { - Lookaside->L.FreeMisses += 1; - (Lookaside->L.Free)(Entry); - - } else { - InterlockedPushEntrySList(&Lookaside->L.ListHead, - (PSLIST_ENTRY)Entry); - } - - return; -} - -#endif - - -#if defined(_NTDDK_) || defined(_NTIFS_) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_inTry -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -NTAPI -ProbeForRead ( - __in_data_source(USER_MODE) __out_validated(MEMORY) __in_bcount(Length) - PVOID Address, - __in SIZE_T Length, - __in ULONG Alignment - ); - -#endif - -#endif - -// -// Raise status from kernel mode. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -DECLSPEC_NORETURN -VOID -NTAPI -ExRaiseStatus ( - __in NTSTATUS Status - ); - -#endif - - - -// -// Common probe for write functions. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_inTry -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -NTAPI -ProbeForWrite ( - __in_data_source(USER_MODE) __out_validated(MEMORY) __inout_bcount(Length) - PVOID Address, - __in SIZE_T Length, - __in ULONG Alignment - ); - -#endif - -// -// Worker Thread -// - -typedef enum _WORK_QUEUE_TYPE { - CriticalWorkQueue, - DelayedWorkQueue, - HyperCriticalWorkQueue, - MaximumWorkQueue -} WORK_QUEUE_TYPE; - -typedef -__drv_sameIRQL -__drv_functionClass(WORKER_THREAD_ROUTINE) -VOID -WORKER_THREAD_ROUTINE ( - __in PVOID Parameter - ); - -typedef WORKER_THREAD_ROUTINE *PWORKER_THREAD_ROUTINE; - -typedef struct _WORK_QUEUE_ITEM { - LIST_ENTRY List; - PWORKER_THREAD_ROUTINE WorkerRoutine; - __volatile PVOID Parameter; -} WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM; - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(ExInitializeWorkItem) // Use IoAllocateWorkItem -#endif - -#define ExInitializeWorkItem(Item, Routine, Context) \ - (Item)->WorkerRoutine = (Routine); \ - (Item)->Parameter = (Context); \ - (Item)->List.Flink = NULL; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -#ifdef _NTDDK_ - -__drv_when( (!__drv_defined(_DRIVER_TYPE_FILESYSTEM) - && !__drv_defined(_DRIVER_TYPE_FILESYSTEM_FILTER)) - || NTDDI_VERSION >= NTDDI_VISTA, - __drv_preferredFunction("IoQueueWorkItem[Ex]", - "Obsolete in all drivers for Vista. Obsolete downlevel except for limited " - "use in IFS. See the documentation")) - -#endif - -__drv_maxIRQL(DISPATCH_LEVEL) -DECLSPEC_DEPRECATED_DDK // Use IoQueueWorkItem -NTKERNELAPI -VOID -ExQueueWorkItem( - __inout __drv_aliasesMem PWORK_QUEUE_ITEM WorkItem, - __drv_strictTypeMatch(__drv_typeExpr) __in WORK_QUEUE_TYPE QueueType - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("nothing", - "Drivers should not be dependent on processor features") -NTKERNELAPI -BOOLEAN -ExIsProcessorFeaturePresent( - __in ULONG ProcessorFeature - ); - -#endif - - -// -// Define executive resource data structures. -// - -typedef ULONG_PTR ERESOURCE_THREAD; -typedef ERESOURCE_THREAD *PERESOURCE_THREAD; - -typedef struct _OWNER_ENTRY { - ERESOURCE_THREAD OwnerThread; - union { - struct { - ULONG IoPriorityBoosted : 1; - ULONG OwnerReferenced : 1; - ULONG OwnerCount : 30; - }; - ULONG TableSize; - }; - -} OWNER_ENTRY, *POWNER_ENTRY; - -typedef struct _ERESOURCE { - LIST_ENTRY SystemResourcesList; - POWNER_ENTRY OwnerTable; - - // - // ActiveEntries is the true, 32-bit count. Existing code - // checks for ActiveCount == 0, so this toggles between - // 0 and 1 and back as ActiveEntries goes from 0 to - // non-zero and back. - // - - SHORT ActiveCount; - USHORT Flag; - __volatile PKSEMAPHORE SharedWaiters; - __volatile PKEVENT ExclusiveWaiters; - - // - // If the resource is owned exclusive, OwnerEntry contains the - // resource owner. - // - // If the resource is owned shared, OwnerEntry may contain one - // of the shared owners. - // - - OWNER_ENTRY OwnerEntry; - ULONG ActiveEntries; - ULONG ContentionCount; - ULONG NumberOfSharedWaiters; - ULONG NumberOfExclusiveWaiters; - -#if defined(_WIN64) - - PVOID Reserved2; - -#endif - - union { - PVOID Address; - ULONG_PTR CreatorBackTraceIndex; - }; - - KSPIN_LOCK SpinLock; -} ERESOURCE, *PERESOURCE; -// -// Values for ERESOURCE.Flag -// - -#define ResourceNeverExclusive 0x10 -#define ResourceReleaseByOtherThread 0x20 -#define ResourceOwnedExclusive 0x80 - -#define RESOURCE_HASH_TABLE_SIZE 64 - -typedef struct _RESOURCE_HASH_ENTRY { - LIST_ENTRY ListEntry; - PVOID Address; - ULONG ContentionCount; - ULONG Number; -} RESOURCE_HASH_ENTRY, *PRESOURCE_HASH_ENTRY; - -typedef struct _RESOURCE_PERFORMANCE_DATA { - ULONG ActiveResourceCount; - ULONG TotalResourceCount; - ULONG ExclusiveAcquire; - ULONG SharedFirstLevel; - ULONG SharedSecondLevel; - ULONG StarveFirstLevel; - ULONG StarveSecondLevel; - ULONG WaitForExclusive; - ULONG OwnerTableExpands; - ULONG MaximumTableExpand; - LIST_ENTRY HashTable[RESOURCE_HASH_TABLE_SIZE]; -} RESOURCE_PERFORMANCE_DATA, *PRESOURCE_PERFORMANCE_DATA; - -// -// Define executive resource function prototypes. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -ExInitializeResourceLite ( - __out PERESOURCE Resource - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -ExReinitializeResourceLite ( - __inout PERESOURCE Resource - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -__drv_mustHoldCriticalRegion -__drv_when(Wait!=0, __drv_valueIs(==1)) -__drv_when(Wait==0, __drv_valueIs(==0;==1) __checkReturn) -NTKERNELAPI -BOOLEAN -ExAcquireResourceSharedLite ( - __inout __deref __drv_neverHold(ExResourceType) - __deref __drv_when(return==1, __drv_acquiresResource(ExResourceType)) - PERESOURCE Resource, - __in BOOLEAN Wait - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA || NTDDI_VERSION >= NTDDI_WS03SP1) - -__drv_maxIRQL(APC_LEVEL) -__drv_acquiresCriticalRegion -NTKERNELAPI -PVOID -ExEnterCriticalRegionAndAcquireResourceShared ( - __inout __deref __drv_acquiresExclusiveResource(ExResourceType) - PERESOURCE Resource - ); - -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -__drv_mustHoldCriticalRegion -__drv_when(Wait!=0, __drv_valueIs(==1)) -__drv_when(Wait==0, __drv_valueIs(==0;==1) __checkReturn) -NTKERNELAPI -BOOLEAN -ExAcquireResourceExclusiveLite ( - __inout __deref __drv_neverHold(ExResourceType) - __deref __drv_when(return==1, __drv_acquiresResource(ExResourceType)) - PERESOURCE Resource, - __in __drv_constant BOOLEAN Wait - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA || NTDDI_VERSION >= NTDDI_WS03SP1) - -__drv_maxIRQL(APC_LEVEL) -__drv_acquiresCriticalRegion -NTKERNELAPI -PVOID -ExEnterCriticalRegionAndAcquireResourceExclusive ( - __inout __deref __drv_acquiresExclusiveResource(ExResourceType) - PERESOURCE Resource - ); - -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -__drv_mustHoldCriticalRegion -__drv_when(Wait!=0, __drv_valueIs(==1)) -__drv_when(Wait==0, __drv_valueIs(==0;==1) __checkReturn) -NTKERNELAPI -BOOLEAN -ExAcquireSharedStarveExclusive( - __inout __deref __drv_neverHold(ExResourceType) - __deref __drv_when(return!=0, __drv_acquiresResource(ExResourceType)) - PERESOURCE Resource, - __in BOOLEAN Wait - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -__drv_mustHoldCriticalRegion -__drv_when(Wait!=0, __drv_valueIs(==1)) -__drv_when(Wait==0, __drv_valueIs(==0;==1) __checkReturn) -NTKERNELAPI -BOOLEAN -ExAcquireSharedWaitForExclusive( - __inout __deref __drv_neverHold(ExResourceType) - __deref __drv_when(return!=0, __drv_acquiresResource(ExResourceType)) - PERESOURCE Resource, - __in BOOLEAN Wait - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA || NTDDI_VERSION >= NTDDI_WS03SP1) - -__drv_maxIRQL(APC_LEVEL) -__drv_acquiresCriticalRegion -NTKERNELAPI -PVOID -ExEnterCriticalRegionAndAcquireSharedWaitForExclusive ( - __inout __deref __drv_acquiresExclusiveResource(ExResourceType) - PERESOURCE Resource - ); - -#endif - -// -// VOID -// ExReleaseResource( -// IN PERESOURCE Resource -// ); -// - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(ExReleaseResource) // Use ExReleaseResourceLite -#endif - -#define ExReleaseResource(R) (ExReleaseResourceLite(R)) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_mustHoldCriticalRegion -NTKERNELAPI -VOID -FASTCALL -ExReleaseResourceLite( - __inout __deref __drv_releasesExclusiveResource(ExResourceType) - PERESOURCE Resource - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA || NTDDI_VERSION >= NTDDI_WS03SP1) - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_releasesCriticalRegion -NTKERNELAPI -VOID -FASTCALL -ExReleaseResourceAndLeaveCriticalRegion( - __inout __deref __drv_releasesExclusiveResource(ExResourceType) - PERESOURCE Resource - ); - -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_mustHoldCriticalRegion -NTKERNELAPI -VOID -ExReleaseResourceForThreadLite( - __inout __deref __drv_releasesExclusiveResource(ExResourceType) - PERESOURCE Resource, - __in ERESOURCE_THREAD ResourceThreadId - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -ExSetResourceOwnerPointer( - __inout PERESOURCE Resource, - __in PVOID OwnerPointer - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -ExSetResourceOwnerPointerEx( - __inout PERESOURCE Resource, - __in PVOID OwnerPointer, - __in ULONG Flags - ); - -#define FLAG_OWNER_POINTER_IS_THREAD 0x1 - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -ExConvertExclusiveToSharedLite( - __inout __deref __drv_mustHold(ExResourceType) PERESOURCE Resource - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -ExDeleteResourceLite ( - __inout PERESOURCE Resource - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -ULONG -ExGetExclusiveWaiterCount ( - __in PERESOURCE Resource - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -ULONG -ExGetSharedWaiterCount ( - __in PERESOURCE Resource - ); - -#endif - - -// -// ERESOURCE_THREAD -// ExGetCurrentResourceThread( -// VOID -// ); -// - -#define ExGetCurrentResourceThread() ((ULONG_PTR)PsGetCurrentThread()) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -ExIsResourceAcquiredExclusiveLite ( - __in PERESOURCE Resource - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -ULONG -ExIsResourceAcquiredSharedLite ( - __in PERESOURCE Resource - ); - -#endif - -// -// An acquired resource is always owned shared, as shared ownership is a subset -// of exclusive ownership. -// - -#define ExIsResourceAcquiredLite ExIsResourceAcquiredSharedLite - - -// -// Rundown protection structure -// - -typedef struct _EX_RUNDOWN_REF { - -#define EX_RUNDOWN_ACTIVE 0x1 -#define EX_RUNDOWN_COUNT_SHIFT 0x1 -#define EX_RUNDOWN_COUNT_INC (1<= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -KPROCESSOR_MODE -ExGetPreviousMode( - VOID - ); - -#endif - - -// -// Set timer resolution. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -ULONG -ExSetTimerResolution ( - __in ULONG DesiredTime, - __in BOOLEAN SetResolution - ); - -#endif - -// -// Subtract time zone bias from system time to get local time. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -NTKERNELAPI -VOID -ExSystemTimeToLocalTime ( - __in PLARGE_INTEGER SystemTime, - __out PLARGE_INTEGER LocalTime - ); - -#endif - -// -// Add time zone bias to local time to get system time. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -NTKERNELAPI -VOID -ExLocalTimeToSystemTime ( - __in PLARGE_INTEGER LocalTime, - __out PLARGE_INTEGER SystemTime - ); - -#endif - - -// -// Define the type for Callback function. -// - -typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT; - -typedef -__drv_sameIRQL -__drv_functionClass(CALLBACK_FUNCTION) -VOID -CALLBACK_FUNCTION ( - __in_opt PVOID CallbackContext, - __in_opt PVOID Argument1, - __in_opt PVOID Argument2 - ); - -typedef CALLBACK_FUNCTION *PCALLBACK_FUNCTION; - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -ExCreateCallback ( - __deref_out PCALLBACK_OBJECT *CallbackObject, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in BOOLEAN Create, - __in BOOLEAN AllowMultipleCallbacks - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PVOID -ExRegisterCallback ( - __inout PCALLBACK_OBJECT CallbackObject, - __in PCALLBACK_FUNCTION CallbackFunction, - __in_opt PVOID CallbackContext - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -ExUnregisterCallback ( - __inout PVOID CallbackRegistration - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -ExNotifyCallback ( - __in PVOID CallbackObject, - __in_opt PVOID Argument1, - __in_opt PVOID Argument2 - ); - -#endif - - -// -// suite support -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -NTKERNELAPI -BOOLEAN -ExVerifySuite( - __drv_strictTypeMatch(__drv_typeExpr) __in SUITE_TYPE SuiteType - ); - -#endif - - -// -// Rundown Locks -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -NTKERNELAPI -VOID -FASTCALL -ExInitializeRundownProtection ( - __out PEX_RUNDOWN_REF RunRef - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -NTKERNELAPI -VOID -FASTCALL -ExReInitializeRundownProtection ( - __inout PEX_RUNDOWN_REF RunRef - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -__checkReturn -__drv_valueIs(==0;==1) -NTKERNELAPI -BOOLEAN -FASTCALL -ExAcquireRundownProtection ( - __inout PEX_RUNDOWN_REF RunRef - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXPSP2 || NTDDI_VERSION >= NTDDI_WS03) - -__checkReturn -__drv_valueIs(==0;==1) -NTKERNELAPI -BOOLEAN -FASTCALL -ExAcquireRundownProtectionEx ( - __inout PEX_RUNDOWN_REF RunRef, - __in ULONG Count - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -NTKERNELAPI -VOID -FASTCALL -ExReleaseRundownProtection ( - __inout PEX_RUNDOWN_REF RunRef - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXPSP2 || NTDDI_VERSION >= NTDDI_WS03) - -NTKERNELAPI -VOID -FASTCALL -ExReleaseRundownProtectionEx ( - __inout PEX_RUNDOWN_REF RunRef, - __in ULONG Count - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -NTKERNELAPI -VOID -FASTCALL -ExRundownCompleted ( - __out PEX_RUNDOWN_REF RunRef - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -NTKERNELAPI -VOID -FASTCALL -ExWaitForRundownProtectionRelease ( - __inout PEX_RUNDOWN_REF RunRef - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) - -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PEX_RUNDOWN_REF_CACHE_AWARE -ExAllocateCacheAwareRundownProtection( - __drv_strictTypeMatch(__drv_typeExpr) __in POOL_TYPE PoolType, - __in ULONG PoolTag - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -SIZE_T -ExSizeOfRundownProtectionCacheAware( - VOID - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -ExInitializeRundownProtectionCacheAware( - __out PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware, - __in SIZE_T RunRefSize - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -ExFreeCacheAwareRundownProtection( - __inout PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) - -__checkReturn -__drv_valueIs(==0;==1) -NTKERNELAPI -BOOLEAN -FASTCALL -ExAcquireRundownProtectionCacheAware ( - __inout PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) - -NTKERNELAPI -VOID -FASTCALL -ExReleaseRundownProtectionCacheAware ( - __inout PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) - -__checkReturn -__drv_valueIs(==0;==1) -NTKERNELAPI -BOOLEAN -FASTCALL -ExAcquireRundownProtectionCacheAwareEx ( - __inout PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware, - __in ULONG Count - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) - -NTKERNELAPI -VOID -FASTCALL -ExReleaseRundownProtectionCacheAwareEx ( - __inout PEX_RUNDOWN_REF_CACHE_AWARE RunRef, - __in ULONG Count - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) - -NTKERNELAPI -VOID -FASTCALL -ExWaitForRundownProtectionReleaseCacheAware ( - __inout PEX_RUNDOWN_REF_CACHE_AWARE RunRef - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) - -NTKERNELAPI -VOID -FASTCALL -ExReInitializeRundownProtectionCacheAware ( - __inout PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware - ); - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) - -NTKERNELAPI -VOID -FASTCALL -ExRundownCompletedCacheAware ( - __inout PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware - ); - -#endif - - -// -// Define a block to hold the actual routine registration. -// - -typedef -__drv_sameIRQL -__drv_functionClass(EX_CALLBACK_FUNCTION) -NTSTATUS -EX_CALLBACK_FUNCTION ( - __in PVOID CallbackContext, - __in_opt PVOID Argument1, - __in_opt PVOID Argument2 - ); - -typedef EX_CALLBACK_FUNCTION *PEX_CALLBACK_FUNCTION; - - - -// -// Registry kernel mode callbacks -// - -// -// Hook selector -// -typedef enum _REG_NOTIFY_CLASS { - RegNtDeleteKey, - RegNtPreDeleteKey = RegNtDeleteKey, - RegNtSetValueKey, - RegNtPreSetValueKey = RegNtSetValueKey, - RegNtDeleteValueKey, - RegNtPreDeleteValueKey = RegNtDeleteValueKey, - RegNtSetInformationKey, - RegNtPreSetInformationKey = RegNtSetInformationKey, - RegNtRenameKey, - RegNtPreRenameKey = RegNtRenameKey, - RegNtEnumerateKey, - RegNtPreEnumerateKey = RegNtEnumerateKey, - RegNtEnumerateValueKey, - RegNtPreEnumerateValueKey = RegNtEnumerateValueKey, - RegNtQueryKey, - RegNtPreQueryKey = RegNtQueryKey, - RegNtQueryValueKey, - RegNtPreQueryValueKey = RegNtQueryValueKey, - RegNtQueryMultipleValueKey, - RegNtPreQueryMultipleValueKey = RegNtQueryMultipleValueKey, - RegNtPreCreateKey, - RegNtPostCreateKey, - RegNtPreOpenKey, - RegNtPostOpenKey, - RegNtKeyHandleClose, - RegNtPreKeyHandleClose = RegNtKeyHandleClose, - // - // .Net only - // - RegNtPostDeleteKey, - RegNtPostSetValueKey, - RegNtPostDeleteValueKey, - RegNtPostSetInformationKey, - RegNtPostRenameKey, - RegNtPostEnumerateKey, - RegNtPostEnumerateValueKey, - RegNtPostQueryKey, - RegNtPostQueryValueKey, - RegNtPostQueryMultipleValueKey, - RegNtPostKeyHandleClose, - RegNtPreCreateKeyEx, - RegNtPostCreateKeyEx, - RegNtPreOpenKeyEx, - RegNtPostOpenKeyEx, - // - // new to Windows Vista - // - RegNtPreFlushKey, - RegNtPostFlushKey, - RegNtPreLoadKey, - RegNtPostLoadKey, - RegNtPreUnLoadKey, - RegNtPostUnLoadKey, - RegNtPreQueryKeySecurity, - RegNtPostQueryKeySecurity, - RegNtPreSetKeySecurity, - RegNtPostSetKeySecurity, - // - // per-object context cleanup - // - RegNtCallbackObjectContextCleanup, - // - // new in Vista SP2 - // - RegNtPreRestoreKey, - RegNtPostRestoreKey, - RegNtPreSaveKey, - RegNtPostSaveKey, - RegNtPreReplaceKey, - RegNtPostReplaceKey, - - MaxRegNtNotifyClass //should always be the last enum -} REG_NOTIFY_CLASS; - -// -// Parameter description for each notify class -// -typedef struct _REG_DELETE_KEY_INFORMATION { - PVOID Object; // IN - PVOID CallContext; // new to Windows Vista - PVOID ObjectContext;// new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_DELETE_KEY_INFORMATION, *PREG_DELETE_KEY_INFORMATION -#if (NTDDI_VERSION >= NTDDI_VISTA) -, REG_FLUSH_KEY_INFORMATION, *PREG_FLUSH_KEY_INFORMATION -#endif // NTDDI_VERSION >= NTDDI_VISTA -; - -typedef struct _REG_SET_VALUE_KEY_INFORMATION { - PVOID Object; // IN - PUNICODE_STRING ValueName; // IN - ULONG TitleIndex; // IN - ULONG Type; // IN - PVOID Data; // IN - ULONG DataSize; // IN - PVOID CallContext; // new to Windows Vista - PVOID ObjectContext;// new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_SET_VALUE_KEY_INFORMATION, *PREG_SET_VALUE_KEY_INFORMATION; - -typedef struct _REG_DELETE_VALUE_KEY_INFORMATION { - PVOID Object; // IN - PUNICODE_STRING ValueName; // IN - PVOID CallContext; // new to Windows Vista - PVOID ObjectContext;// new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_DELETE_VALUE_KEY_INFORMATION, *PREG_DELETE_VALUE_KEY_INFORMATION; - -typedef struct _REG_SET_INFORMATION_KEY_INFORMATION { - PVOID Object; // IN - KEY_SET_INFORMATION_CLASS KeySetInformationClass; // IN - PVOID KeySetInformation; // IN - ULONG KeySetInformationLength;// IN - PVOID CallContext; // new to Windows Vista - PVOID ObjectContext;// new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_SET_INFORMATION_KEY_INFORMATION, *PREG_SET_INFORMATION_KEY_INFORMATION; - -typedef struct _REG_ENUMERATE_KEY_INFORMATION { - PVOID Object; // IN - ULONG Index; // IN - KEY_INFORMATION_CLASS KeyInformationClass; // IN - PVOID KeyInformation; // IN - ULONG Length; // IN - PULONG ResultLength; // OUT - PVOID CallContext; // new to Windows Vista - PVOID ObjectContext;// new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_ENUMERATE_KEY_INFORMATION, *PREG_ENUMERATE_KEY_INFORMATION; - -typedef struct _REG_ENUMERATE_VALUE_KEY_INFORMATION { - PVOID Object; // IN - ULONG Index; // IN - KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass; // IN - PVOID KeyValueInformation; // IN - ULONG Length; // IN - PULONG ResultLength; // OUT - PVOID CallContext; // new to Windows Vista - PVOID ObjectContext;// new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_ENUMERATE_VALUE_KEY_INFORMATION, *PREG_ENUMERATE_VALUE_KEY_INFORMATION; - -typedef struct _REG_QUERY_KEY_INFORMATION { - PVOID Object; // IN - KEY_INFORMATION_CLASS KeyInformationClass; // IN - PVOID KeyInformation; // IN - ULONG Length; // IN - PULONG ResultLength; // OUT - PVOID CallContext; // new to Windows Vista - PVOID ObjectContext;// new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_QUERY_KEY_INFORMATION, *PREG_QUERY_KEY_INFORMATION; - -typedef struct _REG_QUERY_VALUE_KEY_INFORMATION { - PVOID Object; // IN - PUNICODE_STRING ValueName; // IN - KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass; // IN - PVOID KeyValueInformation; // IN - ULONG Length; // IN - PULONG ResultLength; // OUT - PVOID CallContext; // new to Windows Vista - PVOID ObjectContext;// new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_QUERY_VALUE_KEY_INFORMATION, *PREG_QUERY_VALUE_KEY_INFORMATION; - -typedef struct _REG_QUERY_MULTIPLE_VALUE_KEY_INFORMATION { - PVOID Object; // IN - PKEY_VALUE_ENTRY ValueEntries; // IN - ULONG EntryCount; // IN - PVOID ValueBuffer; // IN - PULONG BufferLength; // IN OUT - PULONG RequiredBufferLength; // OUT - PVOID CallContext; // new to Windows Vista - PVOID ObjectContext;// new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_QUERY_MULTIPLE_VALUE_KEY_INFORMATION, *PREG_QUERY_MULTIPLE_VALUE_KEY_INFORMATION; - -typedef struct _REG_RENAME_KEY_INFORMATION { - PVOID Object; // IN - PUNICODE_STRING NewName; // IN - PVOID CallContext; // new to Windows Vista - PVOID ObjectContext;// new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_RENAME_KEY_INFORMATION, *PREG_RENAME_KEY_INFORMATION; - - -typedef struct _REG_KEY_HANDLE_CLOSE_INFORMATION { - PVOID Object; // IN - PVOID CallContext; // new to Windows Vista - PVOID ObjectContext;// new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_KEY_HANDLE_CLOSE_INFORMATION, *PREG_KEY_HANDLE_CLOSE_INFORMATION; - -/* .Net Only */ -typedef struct _REG_CREATE_KEY_INFORMATION { - PUNICODE_STRING CompleteName; // IN - PVOID RootObject; // IN - PVOID ObjectType; // new to Windows Vista - ULONG CreateOptions;// new to Windows Vista - PUNICODE_STRING Class; // new to Windows Vista - PVOID SecurityDescriptor;// new to Windows Vista - PVOID SecurityQualityOfService;// new to Windows Vista - ACCESS_MASK DesiredAccess;// new to Windows Vista - ACCESS_MASK GrantedAccess;// new to Windows Vista - // to be filled in by callbacks - // when bypassing native code - PULONG Disposition; // new to Windows Vista - // on pass through, callback should fill - // in disposition - PVOID *ResultObject;// new to Windows Vista - // on pass through, callback should return - // object to be used for the return handle - PVOID CallContext; // new to Windows Vista - PVOID RootObjectContext; // new to Windows Vista - PVOID Transaction; // new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_CREATE_KEY_INFORMATION, REG_OPEN_KEY_INFORMATION,*PREG_CREATE_KEY_INFORMATION, *PREG_OPEN_KEY_INFORMATION; - -typedef struct _REG_CREATE_KEY_INFORMATION_V1 { - PUNICODE_STRING CompleteName; // IN - PVOID RootObject; // IN - PVOID ObjectType; // new to Windows Vista - ULONG Options; // new to Windows Vista - PUNICODE_STRING Class; // new to Windows Vista - PVOID SecurityDescriptor;// new to Windows Vista - PVOID SecurityQualityOfService;// new to Windows Vista - ACCESS_MASK DesiredAccess;// new to Windows Vista - ACCESS_MASK GrantedAccess;// new to Windows Vista - // to be filled in by callbacks - // when bypassing native code - PULONG Disposition; // new to Windows Vista - // on pass through, callback should fill - // in disposition - PVOID *ResultObject;// new to Windows Vista - // on pass through, callback should return - // object to be used for the return handle - PVOID CallContext; // new to Windows Vista - PVOID RootObjectContext; // new to Windows Vista - PVOID Transaction; // new to Windows Vista - - ULONG_PTR Version; // following is new to Windows 7 - PUNICODE_STRING RemainingName;// the true path left to parse - ULONG Wow64Flags; // Wow64 specific flags gotten from DesiredAccess input - ULONG Attributes; // ObjectAttributes->Attributes - KPROCESSOR_MODE CheckAccessMode; // mode used for the securiry checks -} REG_CREATE_KEY_INFORMATION_V1, REG_OPEN_KEY_INFORMATION_V1,*PREG_CREATE_KEY_INFORMATION_V1, *PREG_OPEN_KEY_INFORMATION_V1; - - - -typedef struct _REG_POST_OPERATION_INFORMATION { - PVOID Object; // IN - NTSTATUS Status; // IN - PVOID PreInformation; // new to Windows Vista; identical with the pre information that was sent - // in the pre notification - NTSTATUS ReturnStatus; // new to Windows Vista; callback can now change the outcome of the operation - // during post by returning the new staus here - PVOID CallContext; // new to Windows Vista - PVOID ObjectContext; // new to Windows Vista - PVOID Reserved; // new to Windows Vista -} REG_POST_OPERATION_INFORMATION,*PREG_POST_OPERATION_INFORMATION; -/* end .Net Only */ - -/* XP only */ -typedef struct _REG_PRE_CREATE_KEY_INFORMATION { - PUNICODE_STRING CompleteName; // IN -} REG_PRE_CREATE_KEY_INFORMATION, REG_PRE_OPEN_KEY_INFORMATION,*PREG_PRE_CREATE_KEY_INFORMATION, *PREG_PRE_OPEN_KEY_INFORMATION;; - -typedef struct _REG_POST_CREATE_KEY_INFORMATION { - PUNICODE_STRING CompleteName; // IN - PVOID Object; // IN - NTSTATUS Status; // IN -} REG_POST_CREATE_KEY_INFORMATION,REG_POST_OPEN_KEY_INFORMATION, *PREG_POST_CREATE_KEY_INFORMATION, *PREG_POST_OPEN_KEY_INFORMATION; -/* end XP only */ - -/* new to Windows Vista */ -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef struct _REG_LOAD_KEY_INFORMATION { - PVOID Object; - PUNICODE_STRING KeyName; - PUNICODE_STRING SourceFile; - ULONG Flags; - PVOID TrustClassObject; - PVOID UserEvent; - ACCESS_MASK DesiredAccess; - PHANDLE RootHandle; - PVOID CallContext; - PVOID ObjectContext; - PVOID Reserved; -} REG_LOAD_KEY_INFORMATION, *PREG_LOAD_KEY_INFORMATION; - -typedef struct _REG_UNLOAD_KEY_INFORMATION { - PVOID Object; - PVOID UserEvent; - PVOID CallContext; - PVOID ObjectContext; - PVOID Reserved; -} REG_UNLOAD_KEY_INFORMATION, *PREG_UNLOAD_KEY_INFORMATION; - -typedef struct _REG_CALLBACK_CONTEXT_CLEANUP_INFORMATION { - PVOID Object; - PVOID ObjectContext; - PVOID Reserved; -} REG_CALLBACK_CONTEXT_CLEANUP_INFORMATION, *PREG_CALLBACK_CONTEXT_CLEANUP_INFORMATION; - -typedef struct _REG_QUERY_KEY_SECURITY_INFORMATION { - PVOID Object; - PSECURITY_INFORMATION SecurityInformation; // IN - PSECURITY_DESCRIPTOR SecurityDescriptor; // INOUT - PULONG Length; // INOUT - PVOID CallContext; - PVOID ObjectContext; - PVOID Reserved; -} REG_QUERY_KEY_SECURITY_INFORMATION, *PREG_QUERY_KEY_SECURITY_INFORMATION; - -typedef struct _REG_SET_KEY_SECURITY_INFORMATION { - PVOID Object; - PSECURITY_INFORMATION SecurityInformation; // IN - PSECURITY_DESCRIPTOR SecurityDescriptor; // IN - PVOID CallContext; - PVOID ObjectContext; - PVOID Reserved; -} REG_SET_KEY_SECURITY_INFORMATION, *PREG_SET_KEY_SECURITY_INFORMATION; - -/* new in Vista SP2 - Restore, Save, Replace */ -typedef struct _REG_RESTORE_KEY_INFORMATION { - PVOID Object; - HANDLE FileHandle; - ULONG Flags; - PVOID CallContext; - PVOID ObjectContext; - PVOID Reserved; -} REG_RESTORE_KEY_INFORMATION, *PREG_RESTORE_KEY_INFORMATION; - -typedef struct _REG_SAVE_KEY_INFORMATION { - PVOID Object; - HANDLE FileHandle; - ULONG Format; - PVOID CallContext; - PVOID ObjectContext; - PVOID Reserved; -} REG_SAVE_KEY_INFORMATION, *PREG_SAVE_KEY_INFORMATION; - -typedef struct _REG_REPLACE_KEY_INFORMATION { - PVOID Object; - PUNICODE_STRING OldFileName; - PUNICODE_STRING NewFileName; - PVOID CallContext; - PVOID ObjectContext; - PVOID Reserved; -} REG_REPLACE_KEY_INFORMATION, *PREG_REPLACE_KEY_INFORMATION; -#endif // NTDDI_VERSION >= NTDDI_VISTA - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -CmRegisterCallback(__in PEX_CALLBACK_FUNCTION Function, - __in_opt PVOID Context, - __out PLARGE_INTEGER Cookie - ); -NTKERNELAPI -NTSTATUS -__drv_maxIRQL(APC_LEVEL) -CmUnRegisterCallback(__in LARGE_INTEGER Cookie); - -#endif // NTDDI_VERSION >= NTDDI_WINXP - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -CmRegisterCallbackEx ( __in PEX_CALLBACK_FUNCTION Function, - __in PCUNICODE_STRING Altitude, - __in PVOID Driver, //PDRIVER_OBJECT - __in_opt PVOID Context, - __out PLARGE_INTEGER Cookie, - __reserved PVOID Reserved - ); - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -CmGetCallbackVersion ( __out_opt PULONG Major, - __out_opt PULONG Minor - ); - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -CmSetCallbackObjectContext (__inout PVOID Object, - __in PLARGE_INTEGER Cookie, - __in PVOID NewContext, - __out_opt PVOID *OldContext - ); - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -CmCallbackGetKeyObjectID ( __in PLARGE_INTEGER Cookie, - __in PVOID Object, - __out_opt PULONG_PTR ObjectID, - __deref_opt_out PCUNICODE_STRING *ObjectName - ); - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PVOID -CmGetBoundTransaction(__in PLARGE_INTEGER Cookie, - __in PVOID Object ); - -#endif // NTDDI_VERSION >= NTDDI_VISTA - -// -// Priority increment definitions. The comment for each definition gives -// the names of the system services that use the definition when satisfying -// a wait. -// - -// -// Priority increment used when satisfying a wait on an executive event -// (NtPulseEvent and NtSetEvent) -// - -#define EVENT_INCREMENT 1 - -// -// Priority increment when no I/O has been done. This is used by device -// and file system drivers when completing an IRP (IoCompleteRequest). -// - -#define IO_NO_INCREMENT 0 - - -// -// Priority increment for completing CD-ROM I/O. This is used by CD-ROM device -// and file system drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_CD_ROM_INCREMENT 1 - -// -// Priority increment for completing disk I/O. This is used by disk device -// and file system drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_DISK_INCREMENT 1 - - - -// -// Priority increment for completing keyboard I/O. This is used by keyboard -// device drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_KEYBOARD_INCREMENT 6 - - -// -// Priority increment for completing mailslot I/O. This is used by the mail- -// slot file system driver when completing an IRP (IoCompleteRequest). -// - -#define IO_MAILSLOT_INCREMENT 2 - - -// -// Priority increment for completing mouse I/O. This is used by mouse device -// drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_MOUSE_INCREMENT 6 - - -// -// Priority increment for completing named pipe I/O. This is used by the -// named pipe file system driver when completing an IRP (IoCompleteRequest). -// - -#define IO_NAMED_PIPE_INCREMENT 2 - -// -// Priority increment for completing network I/O. This is used by network -// device and network file system drivers when completing an IRP -// (IoCompleteRequest). -// - -#define IO_NETWORK_INCREMENT 2 - - -// -// Priority increment for completing parallel I/O. This is used by parallel -// device drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_PARALLEL_INCREMENT 1 - -// -// Priority increment for completing serial I/O. This is used by serial device -// drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_SERIAL_INCREMENT 2 - -// -// Priority increment for completing sound I/O. This is used by sound device -// drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_SOUND_INCREMENT 8 - -// -// Priority increment for completing video I/O. This is used by video device -// drivers when completing an IRP (IoCompleteRequest) -// - -#define IO_VIDEO_INCREMENT 1 - -// -// Priority increment used when satisfying a wait on an executive semaphore -// (NtReleaseSemaphore) -// - -#define SEMAPHORE_INCREMENT 1 - -// -// Indicates the system may do I/O to physical addresses above 4 GB. -// - -extern PBOOLEAN Mm64BitPhysicalAddress; - - -// -// Provides a known bad pointer address which always bugchecks if -// acccessed. This gives drivers a way to find pointer bugs by -// initializing invalid pointers to this value. -// - -extern PVOID MmBadPointer; - -// -// Define the old maximum disk transfer size to be used by MM and Cache -// Manager. Current transfer sizes can typically be much larger. -// - -#define MM_MAXIMUM_DISK_IO_SIZE (0x10000) - -//++ -// -// ULONG_PTR -// ROUND_TO_PAGES ( -// __in ULONG_PTR Size -// ) -// -// Routine Description: -// -// The ROUND_TO_PAGES macro takes a size in bytes and rounds it up to a -// multiple of the page size. -// -// NOTE: This macro fails for values 0xFFFFFFFF - (PAGE_SIZE - 1). -// -// Arguments: -// -// Size - Size in bytes to round up to a page multiple. -// -// Return Value: -// -// Returns the size rounded up to a multiple of the page size. -// -//-- - -#define ROUND_TO_PAGES(Size) (((ULONG_PTR)(Size) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) - -//++ -// -// ULONG -// BYTES_TO_PAGES ( -// __in ULONG Size -// ) -// -// Routine Description: -// -// The BYTES_TO_PAGES macro takes the size in bytes and calculates the -// number of pages required to contain the bytes. -// -// Arguments: -// -// Size - Size in bytes. -// -// Return Value: -// -// Returns the number of pages required to contain the specified size. -// -//-- - -#define BYTES_TO_PAGES(Size) (((Size) >> PAGE_SHIFT) + \ - (((Size) & (PAGE_SIZE - 1)) != 0)) - -//++ -// -// ULONG -// BYTE_OFFSET ( -// __in PVOID Va -// ) -// -// Routine Description: -// -// The BYTE_OFFSET macro takes a virtual address and returns the byte offset -// of that address within the page. -// -// Arguments: -// -// Va - Virtual address. -// -// Return Value: -// -// Returns the byte offset portion of the virtual address. -// -//-- - -#define BYTE_OFFSET(Va) ((ULONG)((LONG_PTR)(Va) & (PAGE_SIZE - 1))) - -//++ -// -// PVOID -// PAGE_ALIGN ( -// __in PVOID Va -// ) -// -// Routine Description: -// -// The PAGE_ALIGN macro takes a virtual address and returns a page-aligned -// virtual address for that page. -// -// Arguments: -// -// Va - Virtual address. -// -// Return Value: -// -// Returns the page aligned virtual address. -// -//-- - -#define PAGE_ALIGN(Va) ((PVOID)((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1))) - -//++ -// -// ULONG -// ADDRESS_AND_SIZE_TO_SPAN_PAGES ( -// __in PVOID Va, -// __in ULONG Size -// ) -// -// Routine Description: -// -// The ADDRESS_AND_SIZE_TO_SPAN_PAGES macro takes a virtual address and -// size and returns the number of pages spanned by the size. -// -// Arguments: -// -// Va - Virtual address. -// -// Size - Size in bytes. -// -// Return Value: -// -// Returns the number of pages spanned by the size. -// -//-- - -#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(Va,Size) \ - ((ULONG)((((ULONG_PTR)(Size)) >> PAGE_SHIFT) + ((BYTE_OFFSET (Va) + BYTE_OFFSET (Size) + PAGE_SIZE - 1) >> PAGE_SHIFT))) - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(COMPUTE_PAGES_SPANNED) // Use ADDRESS_AND_SIZE_TO_SPAN_PAGES -#endif - -#define COMPUTE_PAGES_SPANNED(Va, Size) ADDRESS_AND_SIZE_TO_SPAN_PAGES(Va,Size) - - -//++ -// PPFN_NUMBER -// MmGetMdlPfnArray ( -// __in PMDL Mdl -// ) -// -// Routine Description: -// -// The MmGetMdlPfnArray routine returns the virtual address of the -// first element of the array of physical page numbers associated with -// the MDL. -// -// Arguments: -// -// Mdl - Pointer to an MDL. -// -// Return Value: -// -// Returns the virtual address of the first element of the array of -// physical page numbers associated with the MDL. -// -//-- - -#define MmGetMdlPfnArray(Mdl) ((PPFN_NUMBER)(Mdl + 1)) - -//++ -// -// PVOID -// MmGetMdlVirtualAddress ( -// __in PMDL Mdl -// ) -// -// Routine Description: -// -// The MmGetMdlVirtualAddress returns the virtual address of the buffer -// described by the Mdl. -// -// Arguments: -// -// Mdl - Pointer to an MDL. -// -// Return Value: -// -// Returns the virtual address of the buffer described by the Mdl -// -//-- - -#define MmGetMdlVirtualAddress(Mdl) \ - ((PVOID) ((PCHAR) ((Mdl)->StartVa) + (Mdl)->ByteOffset)) - -//++ -// -// ULONG -// MmGetMdlByteCount ( -// __in PMDL Mdl -// ) -// -// Routine Description: -// -// The MmGetMdlByteCount returns the length in bytes of the buffer -// described by the Mdl. -// -// Arguments: -// -// Mdl - Pointer to an MDL. -// -// Return Value: -// -// Returns the byte count of the buffer described by the Mdl -// -//-- - -#define MmGetMdlByteCount(Mdl) ((Mdl)->ByteCount) - -//++ -// -// ULONG -// MmGetMdlByteOffset ( -// __in PMDL Mdl -// ) -// -// Routine Description: -// -// The MmGetMdlByteOffset returns the byte offset within the page -// of the buffer described by the Mdl. -// -// Arguments: -// -// Mdl - Pointer to an MDL. -// -// Return Value: -// -// Returns the byte offset within the page of the buffer described by the Mdl -// -//-- - -#define MmGetMdlByteOffset(Mdl) ((Mdl)->ByteOffset) - -//++ -// -// PVOID -// MmGetMdlStartVa ( -// __in PMDL Mdl -// ) -// -// Routine Description: -// -// The MmGetMdlBaseVa returns the virtual address of the buffer -// described by the Mdl rounded down to the nearest page. -// -// Arguments: -// -// Mdl - Pointer to an MDL. -// -// Return Value: -// -// Returns the returns the starting virtual address of the MDL. -// -// -//-- - -#define MmGetMdlBaseVa(Mdl) ((Mdl)->StartVa) - -typedef enum _MM_SYSTEM_SIZE { - MmSmallSystem, - MmMediumSystem, - MmLargeSystem -} MM_SYSTEMSIZE; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -MM_SYSTEMSIZE -MmQuerySystemSize ( - VOID - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -MmIsVerifierEnabled ( - __out PULONG VerifierFlags - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -MmAddVerifierThunks ( - __in_bcount (ThunkBufferSize) PVOID ThunkBuffer, - __in ULONG ThunkBufferSize - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -VOID -MmProbeAndLockProcessPages ( - __inout PMDL MemoryDescriptorList, - __in PEPROCESS Process, - __in KPROCESSOR_MODE AccessMode, - __in LOCK_OPERATION Operation - ); -#endif - -// -// I/O support routines. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -MmProbeAndLockPages ( - __inout PMDLX MemoryDescriptorList, - __in KPROCESSOR_MODE AccessMode, - __in LOCK_OPERATION Operation - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -MmUnlockPages ( - __inout PMDLX MemoryDescriptorList - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -MmBuildMdlForNonPagedPool ( - __inout PMDLX MemoryDescriptorList - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_preferredFunction("MmMapLockedPagesSpecifyCache", - "Obsolete except on Windows 98. Use MmGetSystemAddressForMdlSafe if this " - "is a call to MmGetSystemAddressForMdl.") -__drv_when(AccessMode==0, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(AccessMode==1, __drv_inTry __drv_maxIRQL(APC_LEVEL)) -DECLSPEC_DEPRECATED_DDK -NTKERNELAPI -PVOID -MmMapLockedPages ( - __in PMDL MemoryDescriptorList, - __in __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst) - KPROCESSOR_MODE AccessMode - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -__drv_maxIRQL (DISPATCH_LEVEL) -NTKERNELAPI -LOGICAL -MmIsIoSpaceActive ( - __in PHYSICAL_ADDRESS StartAddress, - __in SIZE_T NumberOfBytes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -PVOID -MmGetSystemRoutineAddress ( - __in PUNICODE_STRING SystemRoutineName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -MmAdvanceMdl ( - __inout PMDLX Mdl, - __in ULONG NumberOfBytes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -MmProtectMdlSystemAddress ( - __in PMDLX MemoryDescriptorList, - __in ULONG NewProtect - ); -#endif - -// -// _MM_PAGE_PRIORITY_ provides a method for the system to handle requests -// intelligently in low resource conditions. -// -// LowPagePriority should be used when it is acceptable to the driver for the -// mapping request to fail if the system is low on resources. An example of -// this could be for a non-critical network connection where the driver can -// handle the failure case when system resources are close to being depleted. -// -// NormalPagePriority should be used when it is acceptable to the driver for the -// mapping request to fail if the system is very low on resources. An example -// of this could be for a non-critical local filesystem request. -// -// HighPagePriority should be used when it is unacceptable to the driver for the -// mapping request to fail unless the system is completely out of resources. -// An example of this would be the paging file path in a driver. -// - - - -typedef enum _MM_PAGE_PRIORITY { - LowPagePriority, - NormalPagePriority = 16, - HighPagePriority = 32 -} MM_PAGE_PRIORITY; - - - -// -// Note: This function is not available in WDM 1.0 -// -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_when(AccessMode==0, __drv_maxIRQL(DISPATCH_LEVEL)) -__drv_when(AccessMode==1, __drv_inTry __drv_maxIRQL(APC_LEVEL)) -NTKERNELAPI -PVOID -MmMapLockedPagesSpecifyCache ( - __in PMDLX MemoryDescriptorList, - __in __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst) - KPROCESSOR_MODE AccessMode, - __in __drv_strictTypeMatch(__drv_typeCond) MEMORY_CACHING_TYPE CacheType, - __in_opt PVOID BaseAddress, - __in ULONG BugCheckOnFailure, - __in __drv_strictTypeMatch(__drv_typeCond) MM_PAGE_PRIORITY Priority - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -MmUnmapLockedPages ( - __in PVOID BaseAddress, - __in PMDL MemoryDescriptorList - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -__out_bcount_opt (NumberOfBytes) PVOID -MmAllocateMappingAddress ( - __in SIZE_T NumberOfBytes, - __in ULONG PoolTag - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -MmFreeMappingAddress ( - __in PVOID BaseAddress, - __in ULONG PoolTag - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PVOID -MmMapLockedPagesWithReservedMapping ( - __in PVOID MappingAddress, - __in ULONG PoolTag, - __in PMDLX MemoryDescriptorList, - __in __drv_strictTypeMatch(__drv_typeCond) MEMORY_CACHING_TYPE CacheType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -MmUnmapReservedMapping ( - __in PVOID BaseAddress, - __in ULONG PoolTag, - __in PMDLX MemoryDescriptorList - ); -#endif - - -#define MM_DONT_ZERO_ALLOCATION 0x00000001 -#define MM_ALLOCATE_FROM_LOCAL_NODE_ONLY 0x00000002 -#define MM_ALLOCATE_FULLY_REQUIRED 0x00000004 -#define MM_ALLOCATE_NO_WAIT 0x00000008 -#define MM_ALLOCATE_PREFER_CONTIGUOUS 0x00000010 -#define MM_ALLOCATE_REQUIRE_CONTIGUOUS_CHUNKS 0x00000020 - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -__checkReturn -__drv_maxIRQL (DISPATCH_LEVEL) -NTKERNELAPI -PMDL -MmAllocatePagesForMdlEx ( - __in PHYSICAL_ADDRESS LowAddress, - __in PHYSICAL_ADDRESS HighAddress, - __in PHYSICAL_ADDRESS SkipBytes, - __in SIZE_T TotalBytes, - __in MEMORY_CACHING_TYPE CacheType, - __in ULONG Flags - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PMDL -MmAllocatePagesForMdl ( - __in PHYSICAL_ADDRESS LowAddress, - __in PHYSICAL_ADDRESS HighAddress, - __in PHYSICAL_ADDRESS SkipBytes, - __in SIZE_T TotalBytes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -MmFreePagesFromMdl ( - __in PMDLX MemoryDescriptorList - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -__out_bcount_opt (NumberOfBytes) -PVOID -MmMapIoSpace ( - __in PHYSICAL_ADDRESS PhysicalAddress, - __in SIZE_T NumberOfBytes, - __in MEMORY_CACHING_TYPE CacheType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -MmUnmapIoSpace ( - __in_bcount (NumberOfBytes) PVOID BaseAddress, - __in SIZE_T NumberOfBytes - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -__bcount (NumberOfBytes) PVOID -MmAllocateContiguousMemory ( - __in SIZE_T NumberOfBytes, - __in PHYSICAL_ADDRESS HighestAcceptableAddress - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -__out_bcount_opt (NumberOfBytes) PVOID -MmAllocateContiguousMemorySpecifyCache ( - __in SIZE_T NumberOfBytes, - __in PHYSICAL_ADDRESS LowestAcceptableAddress, - __in PHYSICAL_ADDRESS HighestAcceptableAddress, - __in_opt PHYSICAL_ADDRESS BoundaryAddressMultiple, - __in MEMORY_CACHING_TYPE CacheType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - - - -typedef ULONG NODE_REQUIREMENT; - -#define MM_ANY_NODE_OK 0x80000000 - - - -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -__out_bcount_opt (NumberOfBytes) PVOID -MmAllocateContiguousMemorySpecifyCacheNode ( - __in SIZE_T NumberOfBytes, - __in PHYSICAL_ADDRESS LowestAcceptableAddress, - __in PHYSICAL_ADDRESS HighestAcceptableAddress, - __in_opt PHYSICAL_ADDRESS BoundaryAddressMultiple, - __in MEMORY_CACHING_TYPE CacheType, - __in NODE_REQUIREMENT PreferredNode - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -MmFreeContiguousMemory ( - __in PVOID BaseAddress - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL (DISPATCH_LEVEL) -NTKERNELAPI -VOID -MmFreeContiguousMemorySpecifyCache ( - __in_bcount (NumberOfBytes) PVOID BaseAddress, - __in SIZE_T NumberOfBytes, - __in MEMORY_CACHING_TYPE CacheType - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -SIZE_T -MmSizeOfMdl ( - __in_bcount_opt (Length) PVOID Base, - __in SIZE_T Length - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DECLSPEC_DEPRECATED_DDK // Use IoAllocateMdl -__drv_preferredFunction("IoAllocateMdl","Obsolete") -NTKERNELAPI -PMDL -MmCreateMdl ( - __in_opt PMDL MemoryDescriptorList, - __in_bcount_opt (Length) PVOID Base, - __in SIZE_T Length - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PVOID -MmLockPagableDataSection ( - __in PVOID AddressWithinSection - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -MmResetDriverPaging ( - __in PVOID AddressWithinSection - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PVOID -MmPageEntireDriver ( - __in PVOID AddressWithinSection - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -MmUnlockPagableImageSection ( - __in PVOID ImageSectionHandle - ); -#endif - - -//++ -// -// VOID -// MmInitializeMdl ( -// __in PMDL MemoryDescriptorList, -// __in PVOID BaseVa, -// __in SIZE_T Length -// ) -// -// Routine Description: -// -// This routine initializes the header of a Memory Descriptor List (MDL). -// -// Arguments: -// -// MemoryDescriptorList - Pointer to the MDL to initialize. -// -// BaseVa - Base virtual address mapped by the MDL. -// -// Length - Length, in bytes, of the buffer mapped by the MDL. -// -// Return Value: -// -// None. -// -//-- - -#define MmInitializeMdl(MemoryDescriptorList, BaseVa, Length) { \ - (MemoryDescriptorList)->Next = (PMDL) NULL; \ - (MemoryDescriptorList)->Size = (CSHORT)(sizeof(MDL) + \ - (sizeof(PFN_NUMBER) * ADDRESS_AND_SIZE_TO_SPAN_PAGES((BaseVa), (Length)))); \ - (MemoryDescriptorList)->MdlFlags = 0; \ - (MemoryDescriptorList)->StartVa = (PVOID) PAGE_ALIGN((BaseVa)); \ - (MemoryDescriptorList)->ByteOffset = BYTE_OFFSET((BaseVa)); \ - (MemoryDescriptorList)->ByteCount = (ULONG)(Length); \ - } - -//++ -// -// PVOID -// MmGetSystemAddressForMdlSafe ( -// __in PMDL MDL, -// __in MM_PAGE_PRIORITY PRIORITY -// ) -// -// Routine Description: -// -// This routine returns the mapped address of an MDL. If the -// Mdl is not already mapped or a system address, it is mapped. -// -// Arguments: -// -// MemoryDescriptorList - Pointer to the MDL to map. -// -// Priority - Supplies an indication as to how important it is that this -// request succeed under low available PTE conditions. -// -// Return Value: -// -// Returns the base address where the pages are mapped. The base address -// has the same offset as the virtual address in the MDL. -// -// Unlike MmGetSystemAddressForMdl, Safe guarantees that it will always -// return NULL on failure instead of bugchecking the system. -// -// This macro is not usable by WDM 1.0 drivers as 1.0 did not include -// MmMapLockedPagesSpecifyCache. The solution for WDM 1.0 drivers is to -// provide synchronization and set/reset the MDL_MAPPING_CAN_FAIL bit. -// -//-- - -#define MmGetSystemAddressForMdlSafe(MDL, PRIORITY) \ - (((MDL)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | \ - MDL_SOURCE_IS_NONPAGED_POOL)) ? \ - ((MDL)->MappedSystemVa) : \ - (MmMapLockedPagesSpecifyCache((MDL), \ - KernelMode, \ - MmCached, \ - NULL, \ - FALSE, \ - (PRIORITY)))) - -//++ -// -// PVOID -// MmGetSystemAddressForMdl ( -// __in PMDL MDL -// ) -// -// Routine Description: -// -// This routine returns the mapped address of an MDL, if the -// Mdl is not already mapped or a system address, it is mapped. -// -// Arguments: -// -// MemoryDescriptorList - Pointer to the MDL to map. -// -// Return Value: -// -// Returns the base address where the pages are mapped. The base address -// has the same offset as the virtual address in the MDL. -// -//-- - -//#define MmGetSystemAddressForMdl(MDL) -// (((MDL)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA)) ? -// ((MDL)->MappedSystemVa) : -// ((((MDL)->MdlFlags & (MDL_SOURCE_IS_NONPAGED_POOL)) ? -// ((PVOID)((ULONG)(MDL)->StartVa | (MDL)->ByteOffset)) : -// (MmMapLockedPages((MDL),KernelMode))))) - -#if PRAGMA_DEPRECATED_DDK -#pragma deprecated(MmGetSystemAddressForMdl) // Use MmGetSystemAddressForMdlSafe -#endif - -#define MmGetSystemAddressForMdl(MDL) \ - (((MDL)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | \ - MDL_SOURCE_IS_NONPAGED_POOL)) ? \ - ((MDL)->MappedSystemVa) : \ - (MmMapLockedPages((MDL),KernelMode))) - -//++ -// -// VOID -// MmPrepareMdlForReuse ( -// __in PMDL MDL -// ) -// -// Routine Description: -// -// This routine will take all of the steps necessary to allow an MDL to be -// re-used. -// -// Arguments: -// -// MemoryDescriptorList - Pointer to the MDL that will be re-used. -// -// Return Value: -// -// None. -// -//-- - -#define MmPrepareMdlForReuse(MDL) \ - if (((MDL)->MdlFlags & MDL_PARTIAL_HAS_BEEN_MAPPED) != 0) { \ - ASSERT(((MDL)->MdlFlags & MDL_PARTIAL) != 0); \ - MmUnmapLockedPages( (MDL)->MappedSystemVa, (MDL) ); \ - } else if (((MDL)->MdlFlags & MDL_PARTIAL) == 0) { \ - ASSERT(((MDL)->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) == 0); \ - } - -typedef NTSTATUS (*PMM_DLL_INITIALIZE) ( - __in PUNICODE_STRING RegistryPath - ); - -typedef NTSTATUS (*PMM_DLL_UNLOAD) ( - VOID - ); - - - -// -// Define an empty typedef for the _DRIVER_OBJECT structure so it may be -// referenced by function types before it is actually defined. -// -struct _DRIVER_OBJECT; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -LOGICAL -MmIsDriverVerifying ( - __in struct _DRIVER_OBJECT *DriverObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -LOGICAL -MmIsDriverVerifyingByAddress ( - __in PVOID AddressWithinSection - ); -#endif - -// -// Security operation codes -// - -typedef enum _SECURITY_OPERATION_CODE { - SetSecurityDescriptor, - QuerySecurityDescriptor, - DeleteSecurityDescriptor, - AssignSecurityDescriptor - } SECURITY_OPERATION_CODE, *PSECURITY_OPERATION_CODE; - -// -// Data structure used to capture subject security context -// for access validations and auditing. -// -// THE FIELDS OF THIS DATA STRUCTURE SHOULD BE CONSIDERED OPAQUE -// BY ALL EXCEPT THE SECURITY ROUTINES. -// - -typedef struct _SECURITY_SUBJECT_CONTEXT { - PACCESS_TOKEN ClientToken; - SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; - PACCESS_TOKEN PrimaryToken; - PVOID ProcessAuditId; - } SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT; - -/////////////////////////////////////////////////////////////////////////////// -// // -// ACCESS_STATE and related structures // -// // -/////////////////////////////////////////////////////////////////////////////// - -// -// Initial Privilege Set - Room for three privileges, which should -// be enough for most applications. This structure exists so that -// it can be imbedded in an ACCESS_STATE structure. Use PRIVILEGE_SET -// for all other references to Privilege sets. -// - -#define INITIAL_PRIVILEGE_COUNT 3 - -typedef struct _INITIAL_PRIVILEGE_SET { - ULONG PrivilegeCount; - ULONG Control; - LUID_AND_ATTRIBUTES Privilege[INITIAL_PRIVILEGE_COUNT]; - } INITIAL_PRIVILEGE_SET, * PINITIAL_PRIVILEGE_SET; - - - -// -// Combine the information that describes the state -// of an access-in-progress into a single structure -// - - -typedef struct _ACCESS_STATE { - LUID OperationID; // Currently unused, replaced by TransactionId in AUX_ACCESS_DATA - BOOLEAN SecurityEvaluated; - BOOLEAN GenerateAudit; - BOOLEAN GenerateOnClose; - BOOLEAN PrivilegesAllocated; - ULONG Flags; - ACCESS_MASK RemainingDesiredAccess; - ACCESS_MASK PreviouslyGrantedAccess; - ACCESS_MASK OriginalDesiredAccess; - SECURITY_SUBJECT_CONTEXT SubjectSecurityContext; - PSECURITY_DESCRIPTOR SecurityDescriptor; // it stores SD supplied by caller when creating a new object. - PVOID AuxData; - union { - INITIAL_PRIVILEGE_SET InitialPrivilegeSet; - PRIVILEGE_SET PrivilegeSet; - } Privileges; - - BOOLEAN AuditPrivileges; - UNICODE_STRING ObjectName; - UNICODE_STRING ObjectTypeName; - - } ACCESS_STATE, *PACCESS_STATE; - - -typedef VOID -(*PNTFS_DEREF_EXPORTED_SECURITY_DESCRIPTOR)( - __in PVOID Vcb, - __in PSECURITY_DESCRIPTOR SecurityDescriptor); - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeCaptureSubjectContext ( - __out PSECURITY_SUBJECT_CONTEXT SubjectContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeLockSubjectContext( - __in PSECURITY_SUBJECT_CONTEXT SubjectContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeUnlockSubjectContext( - __in PSECURITY_SUBJECT_CONTEXT SubjectContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -SeReleaseSubjectContext ( - __inout PSECURITY_SUBJECT_CONTEXT SubjectContext - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -SeAssignSecurity ( - __in_opt PSECURITY_DESCRIPTOR ParentDescriptor, - __in_opt PSECURITY_DESCRIPTOR ExplicitDescriptor, - __out PSECURITY_DESCRIPTOR *NewDescriptor, - __in BOOLEAN IsDirectoryObject, - __in PSECURITY_SUBJECT_CONTEXT SubjectContext, - __in PGENERIC_MAPPING GenericMapping, - __in POOL_TYPE PoolType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -ULONG -SeComputeAutoInheritByObjectType( - __in PVOID ObjectType, - __in_opt PSECURITY_DESCRIPTOR SecurityDescriptor, - __in_opt PSECURITY_DESCRIPTOR ParentSecurityDescriptor - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -SeAssignSecurityEx ( - __in_opt PSECURITY_DESCRIPTOR ParentDescriptor, - __in_opt PSECURITY_DESCRIPTOR ExplicitDescriptor, - __out PSECURITY_DESCRIPTOR *NewDescriptor, - __in_opt GUID *ObjectType, - __in BOOLEAN IsDirectoryObject, - __in ULONG AutoInheritFlags, - __in PSECURITY_SUBJECT_CONTEXT SubjectContext, - __in PGENERIC_MAPPING GenericMapping, - __in POOL_TYPE PoolType - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -SeDeassignSecurity ( - __deref_inout PSECURITY_DESCRIPTOR *SecurityDescriptor - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -ULONG -SeObjectCreateSaclAccessBits( - __in PSECURITY_DESCRIPTOR SecurityDescriptor - ); - -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -BOOLEAN -SeAccessCheck ( - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext, - __in BOOLEAN SubjectContextLocked, - __in ACCESS_MASK DesiredAccess, - __in ACCESS_MASK PreviouslyGrantedAccess, - __deref_opt_out PPRIVILEGE_SET *Privileges, - __in PGENERIC_MAPPING GenericMapping, - __in KPROCESSOR_MODE AccessMode, - __out PACCESS_MASK GrantedAccess, - __out PNTSTATUS AccessStatus - ); -#endif - - -#ifdef SE_NTFS_WORLD_CACHE - -#if (NTDDI_VERSION >= NTDDI_VISTA) -VOID -SeGetWorldRights ( - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in PGENERIC_MAPPING GenericMapping, - __out PACCESS_MASK GrantedAccess - ); -#endif - -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -NTSTATUS -SeSetAuditParameter( - __inout PSE_ADT_PARAMETER_ARRAY AuditParameters, - __in SE_ADT_PARAMETER_TYPE Type, - __in ULONG Index, - __in PVOID Data - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -NTSTATUS -SeReportSecurityEvent( - __in ULONG Flags, - __in PUNICODE_STRING SourceName, - __in_opt PSID UserSid, - __in PSE_ADT_PARAMETER_ARRAY AuditParameters - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -BOOLEAN -SeValidSecurityDescriptor( - __in ULONG Length, - __in_bcount(Length) PSECURITY_DESCRIPTOR SecurityDescriptor - ); -#endif - - -#if !defined(_PSGETCURRENTTHREAD_) - -#define _PSGETCURRENTTHREAD_ - -__drv_maxIRQL(DISPATCH_LEVEL) -FORCEINLINE -PETHREAD -PsGetCurrentThread ( - VOID - ) - -/*++ - -Routine Description: - - This function returns a pointer to the current executive thread object. - -Arguments: - - None. - -Return Value: - - A pointer to the current executive thread object. - ---*/ - -{ - - return (PETHREAD)KeGetCurrentThread(); -} - -#endif - -// -// System Thread and Process Creation and Termination -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -__drv_valueIs(==0;<0) -NTKERNELAPI -__checkReturn -NTSTATUS -PsCreateSystemThread( - __out PHANDLE ThreadHandle, - __in ULONG DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt HANDLE ProcessHandle, - __out_opt PCLIENT_ID ClientId, - __in PKSTART_ROUTINE StartRoutine, - __in_opt __drv_when(return==0, __drv_aliasesMem) PVOID StartContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -PsTerminateSystemThread( - __in NTSTATUS ExitStatus - ); -#endif - -NTKERNELAPI -NTSTATUS -PsWrapApcWow64Thread ( - __inout PVOID *ApcContext, - __inout PVOID *ApcRoutine); - - -// -// Define I/O system data structure type codes. Each major data structure in -// the I/O system has a type code The type field in each structure is at the -// same offset. The following values can be used to determine which type of -// data structure a pointer refers to. -// - -#define IO_TYPE_ADAPTER 0x00000001 -#define IO_TYPE_CONTROLLER 0x00000002 -#define IO_TYPE_DEVICE 0x00000003 -#define IO_TYPE_DRIVER 0x00000004 -#define IO_TYPE_FILE 0x00000005 -#define IO_TYPE_IRP 0x00000006 -#define IO_TYPE_MASTER_ADAPTER 0x00000007 -#define IO_TYPE_OPEN_PACKET 0x00000008 -#define IO_TYPE_TIMER 0x00000009 -#define IO_TYPE_VPB 0x0000000a -#define IO_TYPE_ERROR_LOG 0x0000000b -#define IO_TYPE_ERROR_MESSAGE 0x0000000c -#define IO_TYPE_DEVICE_OBJECT_EXTENSION 0x0000000d - - -// -// Define the major function codes for IRPs. -// - - -#define IRP_MJ_CREATE 0x00 -#define IRP_MJ_CREATE_NAMED_PIPE 0x01 -#define IRP_MJ_CLOSE 0x02 -#define IRP_MJ_READ 0x03 -#define IRP_MJ_WRITE 0x04 -#define IRP_MJ_QUERY_INFORMATION 0x05 -#define IRP_MJ_SET_INFORMATION 0x06 -#define IRP_MJ_QUERY_EA 0x07 -#define IRP_MJ_SET_EA 0x08 -#define IRP_MJ_FLUSH_BUFFERS 0x09 -#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a -#define IRP_MJ_SET_VOLUME_INFORMATION 0x0b -#define IRP_MJ_DIRECTORY_CONTROL 0x0c -#define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d -#define IRP_MJ_DEVICE_CONTROL 0x0e -#define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f -#define IRP_MJ_SHUTDOWN 0x10 -#define IRP_MJ_LOCK_CONTROL 0x11 -#define IRP_MJ_CLEANUP 0x12 -#define IRP_MJ_CREATE_MAILSLOT 0x13 -#define IRP_MJ_QUERY_SECURITY 0x14 -#define IRP_MJ_SET_SECURITY 0x15 -#define IRP_MJ_POWER 0x16 -#define IRP_MJ_SYSTEM_CONTROL 0x17 -#define IRP_MJ_DEVICE_CHANGE 0x18 -#define IRP_MJ_QUERY_QUOTA 0x19 -#define IRP_MJ_SET_QUOTA 0x1a -#define IRP_MJ_PNP 0x1b -#define IRP_MJ_PNP_POWER IRP_MJ_PNP // Obsolete.... -#define IRP_MJ_MAXIMUM_FUNCTION 0x1b - -// -// Make the Scsi major code the same as internal device control. -// - -#define IRP_MJ_SCSI IRP_MJ_INTERNAL_DEVICE_CONTROL - -// -// Define the minor function codes for IRPs. The lower 128 codes, from 0x00 to -// 0x7f are reserved to Microsoft. The upper 128 codes, from 0x80 to 0xff, are -// reserved to customers of Microsoft. -// - -// -// Device Control Request minor function codes for SCSI support. Note that -// user requests are assumed to be zero. -// - -#define IRP_MN_SCSI_CLASS 0x01 - -// -// PNP minor function codes. -// - -#define IRP_MN_START_DEVICE 0x00 -#define IRP_MN_QUERY_REMOVE_DEVICE 0x01 -#define IRP_MN_REMOVE_DEVICE 0x02 -#define IRP_MN_CANCEL_REMOVE_DEVICE 0x03 -#define IRP_MN_STOP_DEVICE 0x04 -#define IRP_MN_QUERY_STOP_DEVICE 0x05 -#define IRP_MN_CANCEL_STOP_DEVICE 0x06 - -#define IRP_MN_QUERY_DEVICE_RELATIONS 0x07 -#define IRP_MN_QUERY_INTERFACE 0x08 -#define IRP_MN_QUERY_CAPABILITIES 0x09 -#define IRP_MN_QUERY_RESOURCES 0x0A -#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B -#define IRP_MN_QUERY_DEVICE_TEXT 0x0C -#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D - -#define IRP_MN_READ_CONFIG 0x0F -#define IRP_MN_WRITE_CONFIG 0x10 -#define IRP_MN_EJECT 0x11 -#define IRP_MN_SET_LOCK 0x12 -#define IRP_MN_QUERY_ID 0x13 -#define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14 -#define IRP_MN_QUERY_BUS_INFORMATION 0x15 -#define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16 -#define IRP_MN_SURPRISE_REMOVAL 0x17 - -#if (NTDDI_VERSION >= NTDDI_WIN7) -#define IRP_MN_DEVICE_ENUMERATED 0x19 -#endif - - -// -// POWER minor function codes -// -#define IRP_MN_WAIT_WAKE 0x00 -#define IRP_MN_POWER_SEQUENCE 0x01 -#define IRP_MN_SET_POWER 0x02 -#define IRP_MN_QUERY_POWER 0x03 - - -// -// WMI minor function codes under IRP_MJ_SYSTEM_CONTROL -// - -#define IRP_MN_QUERY_ALL_DATA 0x00 -#define IRP_MN_QUERY_SINGLE_INSTANCE 0x01 -#define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02 -#define IRP_MN_CHANGE_SINGLE_ITEM 0x03 -#define IRP_MN_ENABLE_EVENTS 0x04 -#define IRP_MN_DISABLE_EVENTS 0x05 -#define IRP_MN_ENABLE_COLLECTION 0x06 -#define IRP_MN_DISABLE_COLLECTION 0x07 -#define IRP_MN_REGINFO 0x08 -#define IRP_MN_EXECUTE_METHOD 0x09 -// Minor code 0x0a is reserved -#define IRP_MN_REGINFO_EX 0x0b -// Minor code 0x0c is reserved - - - -// -// Define option flags for IoCreateFile. Note that these values must be -// exactly the same as the SL_... flags for a create function. Note also -// that there are flags that may be passed to IoCreateFile that are not -// placed in the stack location for the create IRP. These flags start in -// the next byte. -// - -#define IO_FORCE_ACCESS_CHECK 0x0001 -#define IO_NO_PARAMETER_CHECKING 0x0100 - -// -// Define Information fields for whether or not a REPARSE or a REMOUNT has -// occurred in the file system. -// - -#define IO_REPARSE 0x0 -#define IO_REMOUNT 0x1 - -// -// Define the objects that can be created by IoCreateFile. -// - -typedef enum _CREATE_FILE_TYPE { - CreateFileTypeNone, - CreateFileTypeNamedPipe, - CreateFileTypeMailslot -} CREATE_FILE_TYPE; - -// -// Define the structures used by the I/O system -// - -// -// Define empty typedefs for the _IRP, _DEVICE_OBJECT, and _DRIVER_OBJECT -// structures so they may be referenced by function types before they are -// actually defined. -// -struct _DEVICE_DESCRIPTION; -struct _DEVICE_OBJECT; -struct _DMA_ADAPTER; -struct _DRIVER_OBJECT; -struct _DRIVE_LAYOUT_INFORMATION; -struct _DISK_PARTITION; - -struct _FILE_OBJECT; - -#if defined(_WIN64) -#define POINTER_ALIGNMENT DECLSPEC_ALIGN(8) -#else -#define POINTER_ALIGNMENT -#endif - -struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _IRP; -struct _SCSI_REQUEST_BLOCK; -struct _SCATTER_GATHER_LIST; - -// -// Define the I/O version of a DPC routine. -// - -__drv_functionClass(IO_DPC_ROUTINE) -__drv_minFunctionIRQL(DISPATCH_LEVEL) -__drv_requiresIRQL(DISPATCH_LEVEL) -__drv_sameIRQL -typedef -VOID -IO_DPC_ROUTINE ( - __in PKDPC Dpc, - __in struct _DEVICE_OBJECT *DeviceObject, - __inout struct _IRP *Irp, - __in_opt PVOID Context - ); - -typedef IO_DPC_ROUTINE *PIO_DPC_ROUTINE; - -// -// Define driver timer routine type. -// - -__drv_functionClass(IO_TIMER_ROUTINE) -__drv_sameIRQL -typedef -VOID -IO_TIMER_ROUTINE ( - __in struct _DEVICE_OBJECT *DeviceObject, - __in_opt PVOID Context - ); - -typedef IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE; - -// -// Define driver initialization routine type. -// -__drv_functionClass(DRIVER_INITIALIZE) -__drv_sameIRQL -typedef -NTSTATUS -DRIVER_INITIALIZE ( - __in struct _DRIVER_OBJECT *DriverObject, - __in PUNICODE_STRING RegistryPath - ); - -typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE; - -// -// Define driver cancel routine type. -// - -__drv_functionClass(DRIVER_CANCEL) -__drv_mustHoldCancelSpinLock -__drv_releasesCancelSpinLock -__drv_minFunctionIRQL(DISPATCH_LEVEL) -__drv_requiresIRQL(DISPATCH_LEVEL) -typedef -VOID -DRIVER_CANCEL ( - __inout struct _DEVICE_OBJECT *DeviceObject, - __inout __drv_useCancelIRQL struct _IRP *Irp - ); - -typedef DRIVER_CANCEL *PDRIVER_CANCEL; - -// -// Define driver dispatch routine type. -// - -__drv_functionClass(DRIVER_DISPATCH) -__drv_requiresIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef -NTSTATUS -DRIVER_DISPATCH ( - __in struct _DEVICE_OBJECT *DeviceObject, - __inout struct _IRP *Irp - ); - -typedef DRIVER_DISPATCH *PDRIVER_DISPATCH; - -// -// Define driver start I/O routine type. -// - -__drv_functionClass(DRIVER_STARTIO) -__drv_minFunctionIRQL(DISPATCH_LEVEL) -__drv_requiresIRQL(DISPATCH_LEVEL) -__drv_sameIRQL -typedef -VOID -DRIVER_STARTIO ( - __inout struct _DEVICE_OBJECT *DeviceObject, - __inout struct _IRP *Irp - ); - -typedef DRIVER_STARTIO *PDRIVER_STARTIO; - -// -// Define driver unload routine type. -// -__drv_functionClass(DRIVER_UNLOAD) -__drv_requiresIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef -VOID -DRIVER_UNLOAD ( - __in struct _DRIVER_OBJECT *DriverObject - ); - -typedef DRIVER_UNLOAD *PDRIVER_UNLOAD; - -// -// Define driver AddDevice routine type. -// - -__drv_functionClass(DRIVER_ADD_DEVICE) -__drv_requiresIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -__drv_when(return>=0, __drv_clearDoInit(yes)) -typedef -NTSTATUS -DRIVER_ADD_DEVICE ( - __in struct _DRIVER_OBJECT *DriverObject, - __in struct _DEVICE_OBJECT *PhysicalDeviceObject - ); - -typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE; - - -// -// Define fast I/O procedure prototypes. -// -// Fast I/O read and write procedures. -// - -__drv_functionClass(FAST_IO_CHECK_IF_POSSIBLE) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_CHECK_IF_POSSIBLE ( - __in struct _FILE_OBJECT *FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in BOOLEAN Wait, - __in ULONG LockKey, - __in BOOLEAN CheckForReadOperation, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_CHECK_IF_POSSIBLE *PFAST_IO_CHECK_IF_POSSIBLE; - -__drv_functionClass(FAST_IO_READ) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_READ ( - __in struct _FILE_OBJECT *FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in BOOLEAN Wait, - __in ULONG LockKey, - __out PVOID Buffer, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_READ *PFAST_IO_READ; - -__drv_functionClass(FAST_IO_WRITE) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_WRITE ( - __in struct _FILE_OBJECT *FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in BOOLEAN Wait, - __in ULONG LockKey, - __in PVOID Buffer, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_WRITE *PFAST_IO_WRITE; - -// -// Fast I/O query basic and standard information procedures. -// - -__drv_functionClass(FAST_IO_QUERY_BASIC_INFO) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_QUERY_BASIC_INFO ( - __in struct _FILE_OBJECT *FileObject, - __in BOOLEAN Wait, - __out PFILE_BASIC_INFORMATION Buffer, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_QUERY_BASIC_INFO *PFAST_IO_QUERY_BASIC_INFO; - -__drv_functionClass(FAST_IO_QUERY_STANDARD_INFO) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_QUERY_STANDARD_INFO ( - __in struct _FILE_OBJECT *FileObject, - __in BOOLEAN Wait, - __out PFILE_STANDARD_INFORMATION Buffer, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_QUERY_STANDARD_INFO *PFAST_IO_QUERY_STANDARD_INFO; - -// -// Fast I/O lock and unlock procedures. -// - -__drv_functionClass(FAST_IO_LOCK) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_LOCK ( - __in struct _FILE_OBJECT *FileObject, - __in PLARGE_INTEGER FileOffset, - __in PLARGE_INTEGER Length, - __in PEPROCESS ProcessId, - __in ULONG Key, - __in BOOLEAN FailImmediately, - __in BOOLEAN ExclusiveLock, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_LOCK *PFAST_IO_LOCK; - -__drv_functionClass(FAST_IO_UNLOCK_SINGLE) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_UNLOCK_SINGLE ( - __in struct _FILE_OBJECT *FileObject, - __in PLARGE_INTEGER FileOffset, - __in PLARGE_INTEGER Length, - __in PEPROCESS ProcessId, - __in ULONG Key, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_UNLOCK_SINGLE *PFAST_IO_UNLOCK_SINGLE; - -__drv_functionClass(FAST_IO_UNLOCK_ALL) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_UNLOCK_ALL ( - __in struct _FILE_OBJECT *FileObject, - __in PEPROCESS ProcessId, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_UNLOCK_ALL *PFAST_IO_UNLOCK_ALL; - -__drv_functionClass(FAST_IO_UNLOCK_ALL_BY_KEY) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_UNLOCK_ALL_BY_KEY ( - __in struct _FILE_OBJECT *FileObject, - __in PVOID ProcessId, - __in ULONG Key, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_UNLOCK_ALL_BY_KEY *PFAST_IO_UNLOCK_ALL_BY_KEY; - -// -// Fast I/O device control procedure. -// - -__drv_functionClass(FAST_IO_DEVICE_CONTROL) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_DEVICE_CONTROL ( - __in struct _FILE_OBJECT *FileObject, - __in BOOLEAN Wait, - __in_opt PVOID InputBuffer, - __in ULONG InputBufferLength, - __out_opt PVOID OutputBuffer, - __in ULONG OutputBufferLength, - __in ULONG IoControlCode, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_DEVICE_CONTROL *PFAST_IO_DEVICE_CONTROL; - -// -// Define callbacks for NtCreateSection to synchronize correctly with -// the file system. It pre-acquires the resources that will be needed -// when calling to query and set file/allocation size in the file system. -// - -__drv_functionClass(FAST_IO_ACQUIRE_FILE) -__drv_sameIRQL -typedef -VOID -FAST_IO_ACQUIRE_FILE ( - __in struct _FILE_OBJECT *FileObject - ); - -typedef FAST_IO_ACQUIRE_FILE *PFAST_IO_ACQUIRE_FILE; - -__drv_functionClass(FAST_IO_RELEASE_FILE) -__drv_sameIRQL -typedef -VOID -FAST_IO_RELEASE_FILE ( - __in struct _FILE_OBJECT *FileObject - ); - -typedef FAST_IO_RELEASE_FILE *PFAST_IO_RELEASE_FILE; - -// -// Define callback for drivers that have device objects attached to lower- -// level drivers' device objects. This callback is made when the lower-level -// driver is deleting its device object. -// - -__drv_functionClass(FAST_IO_DETACH_DEVICE) -__drv_sameIRQL -typedef -VOID -FAST_IO_DETACH_DEVICE ( - __in struct _DEVICE_OBJECT *SourceDevice, - __in struct _DEVICE_OBJECT *TargetDevice - ); - -typedef FAST_IO_DETACH_DEVICE *PFAST_IO_DETACH_DEVICE; - -// -// This structure is used by the server to quickly get the information needed -// to service a server open call. It is takes what would be two fast io calls -// one for basic information and the other for standard information and makes -// it into one call. -// - -__drv_functionClass(FAST_IO_QUERY_NETWORK_OPEN_INFO) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_QUERY_NETWORK_OPEN_INFO ( - __in struct _FILE_OBJECT *FileObject, - __in BOOLEAN Wait, - __out struct _FILE_NETWORK_OPEN_INFORMATION *Buffer, - __out struct _IO_STATUS_BLOCK *IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_QUERY_NETWORK_OPEN_INFO *PFAST_IO_QUERY_NETWORK_OPEN_INFO; - -// -// Define Mdl-based routines for the server to call -// - -__drv_functionClass(FAST_IO_MDL_READ) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_MDL_READ ( - __in struct _FILE_OBJECT *FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in ULONG LockKey, - __out PMDL *MdlChain, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_MDL_READ *PFAST_IO_MDL_READ; - -__drv_functionClass(FAST_IO_MDL_READ_COMPLETE) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_MDL_READ_COMPLETE ( - __in struct _FILE_OBJECT *FileObject, - __in PMDL MdlChain, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_MDL_READ_COMPLETE *PFAST_IO_MDL_READ_COMPLETE; - -__drv_functionClass(FAST_IO_PREPARE_MDL_WRITE) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_PREPARE_MDL_WRITE ( - __in struct _FILE_OBJECT *FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in ULONG LockKey, - __out PMDL *MdlChain, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_PREPARE_MDL_WRITE *PFAST_IO_PREPARE_MDL_WRITE; - -__drv_functionClass(FAST_IO_MDL_WRITE_COMPLETE) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_MDL_WRITE_COMPLETE ( - __in struct _FILE_OBJECT *FileObject, - __in PLARGE_INTEGER FileOffset, - __in PMDL MdlChain, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_MDL_WRITE_COMPLETE *PFAST_IO_MDL_WRITE_COMPLETE; - -// -// If this routine is present, it will be called by FsRtl -// to acquire the file for the mapped page writer. -// - -__drv_functionClass(FAST_IO_ACQUIRE_FOR_MOD_WRITE) -__drv_sameIRQL -typedef -NTSTATUS -FAST_IO_ACQUIRE_FOR_MOD_WRITE ( - __in struct _FILE_OBJECT *FileObject, - __in PLARGE_INTEGER EndingOffset, - __out struct _ERESOURCE **ResourceToRelease, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_ACQUIRE_FOR_MOD_WRITE *PFAST_IO_ACQUIRE_FOR_MOD_WRITE; - -__drv_functionClass(FAST_IO_RELEASE_FOR_MOD_WRITE) -__drv_sameIRQL -typedef -NTSTATUS -FAST_IO_RELEASE_FOR_MOD_WRITE ( - __in struct _FILE_OBJECT *FileObject, - __in struct _ERESOURCE *ResourceToRelease, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_RELEASE_FOR_MOD_WRITE *PFAST_IO_RELEASE_FOR_MOD_WRITE; - -// -// If this routine is present, it will be called by FsRtl -// to acquire the file for the mapped page writer. -// - -__drv_functionClass(FAST_IO_ACQUIRE_FOR_CCFLUSH) -__drv_sameIRQL -typedef -NTSTATUS -FAST_IO_ACQUIRE_FOR_CCFLUSH ( - __in struct _FILE_OBJECT *FileObject, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_ACQUIRE_FOR_CCFLUSH *PFAST_IO_ACQUIRE_FOR_CCFLUSH; - -__drv_functionClass(FAST_IO_RELEASE_FOR_CCFLUSH) -__drv_sameIRQL -typedef -NTSTATUS -FAST_IO_RELEASE_FOR_CCFLUSH ( - __in struct _FILE_OBJECT *FileObject, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_RELEASE_FOR_CCFLUSH *PFAST_IO_RELEASE_FOR_CCFLUSH; - -__drv_functionClass(FAST_IO_READ_COMPRESSED) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_READ_COMPRESSED ( - __in struct _FILE_OBJECT *FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in ULONG LockKey, - __out PVOID Buffer, - __out PMDL *MdlChain, - __out PIO_STATUS_BLOCK IoStatus, - __out struct _COMPRESSED_DATA_INFO *CompressedDataInfo, - __in ULONG CompressedDataInfoLength, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_READ_COMPRESSED *PFAST_IO_READ_COMPRESSED; - -__drv_functionClass(FAST_IO_WRITE_COMPRESSED) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_WRITE_COMPRESSED ( - __in struct _FILE_OBJECT *FileObject, - __in PLARGE_INTEGER FileOffset, - __in ULONG Length, - __in ULONG LockKey, - __in PVOID Buffer, - __out PMDL *MdlChain, - __out PIO_STATUS_BLOCK IoStatus, - __in struct _COMPRESSED_DATA_INFO *CompressedDataInfo, - __in ULONG CompressedDataInfoLength, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_WRITE_COMPRESSED *PFAST_IO_WRITE_COMPRESSED; - -__drv_functionClass(FAST_IO_MDL_READ_COMPLETE_COMPRESSED) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_MDL_READ_COMPLETE_COMPRESSED ( - __in struct _FILE_OBJECT *FileObject, - __in PMDL MdlChain, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_MDL_READ_COMPLETE_COMPRESSED *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED; - -__drv_functionClass(FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED ( - __in struct _FILE_OBJECT *FileObject, - __in PLARGE_INTEGER FileOffset, - __in PMDL MdlChain, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED; - -__drv_functionClass(FAST_IO_QUERY_OPEN) -__drv_sameIRQL -typedef -BOOLEAN -FAST_IO_QUERY_OPEN ( - __inout struct _IRP *Irp, - __out PFILE_NETWORK_OPEN_INFORMATION NetworkInformation, - __in struct _DEVICE_OBJECT *DeviceObject - ); - -typedef FAST_IO_QUERY_OPEN *PFAST_IO_QUERY_OPEN; - -// -// Define the structure to describe the Fast I/O dispatch routines. Any -// additions made to this structure MUST be added monotonically to the end -// of the structure, and fields CANNOT be removed from the middle. -// - -typedef struct _FAST_IO_DISPATCH { - ULONG SizeOfFastIoDispatch; - PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible; - PFAST_IO_READ FastIoRead; - PFAST_IO_WRITE FastIoWrite; - PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo; - PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo; - PFAST_IO_LOCK FastIoLock; - PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle; - PFAST_IO_UNLOCK_ALL FastIoUnlockAll; - PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey; - PFAST_IO_DEVICE_CONTROL FastIoDeviceControl; - PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection; - PFAST_IO_RELEASE_FILE ReleaseFileForNtCreateSection; - PFAST_IO_DETACH_DEVICE FastIoDetachDevice; - PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo; - PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite; - PFAST_IO_MDL_READ MdlRead; - PFAST_IO_MDL_READ_COMPLETE MdlReadComplete; - PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite; - PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete; - PFAST_IO_READ_COMPRESSED FastIoReadCompressed; - PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed; - PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed; - PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed; - PFAST_IO_QUERY_OPEN FastIoQueryOpen; - PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite; - PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush; - PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush; -} FAST_IO_DISPATCH, *PFAST_IO_DISPATCH; - -// -// Define the actions that a driver execution routine may request of the -// adapter/controller allocation routines upon return. -// - -typedef enum _IO_ALLOCATION_ACTION { - KeepObject = 1, - DeallocateObject, - DeallocateObjectKeepRegisters -} IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION; - -// -// Define device driver adapter/controller execution routine. -// - -typedef -__drv_functionClass(DRIVER_CONTROL) -__drv_sameIRQL -IO_ALLOCATION_ACTION -DRIVER_CONTROL ( - __in struct _DEVICE_OBJECT *DeviceObject, - __inout struct _IRP *Irp, - __in PVOID MapRegisterBase, - __in PVOID Context - ); -typedef DRIVER_CONTROL *PDRIVER_CONTROL; - -// -// Define the I/O system's security context type for use by file system's -// when checking access to volumes, files, and directories. -// - -typedef struct _IO_SECURITY_CONTEXT { - PSECURITY_QUALITY_OF_SERVICE SecurityQos; - PACCESS_STATE AccessState; - ACCESS_MASK DesiredAccess; - ULONG FullCreateOptions; -} IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT; - -// -// Define Volume Parameter Block (VPB) flags. -// - -#define VPB_MOUNTED 0x00000001 -#define VPB_LOCKED 0x00000002 -#define VPB_PERSISTENT 0x00000004 -#define VPB_REMOVE_PENDING 0x00000008 -#define VPB_RAW_MOUNT 0x00000010 -#define VPB_DIRECT_WRITES_ALLOWED 0x00000020 - - -// -// Volume Parameter Block (VPB) -// - -#define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR)) // 32 characters - -typedef struct _VPB { - CSHORT Type; - CSHORT Size; - USHORT Flags; - USHORT VolumeLabelLength; // in bytes - struct _DEVICE_OBJECT *DeviceObject; - struct _DEVICE_OBJECT *RealDevice; - ULONG SerialNumber; - ULONG ReferenceCount; - WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)]; -} VPB, *PVPB; - - -#if defined(_WIN64) - -// -// Use __inline DMA macros (hal.h) -// -#ifndef USE_DMA_MACROS -#define USE_DMA_MACROS -#endif - -// -// Only PnP drivers! -// -#ifndef NO_LEGACY_DRIVERS -#define NO_LEGACY_DRIVERS -#endif - -#endif // _WIN64 - - -#if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && ( defined(_NTDDK_) || defined(_NTDRIVER_) || defined(_NTOSP_)) - -// -// Define object type specific fields of various objects used by the I/O system -// - -typedef struct _DMA_ADAPTER *PADAPTER_OBJECT; - -#elif defined(_WDM_INCLUDED_) - -typedef struct _DMA_ADAPTER *PADAPTER_OBJECT; - -#else - -// -// Define object type specific fields of various objects used by the I/O system -// - -typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT; - -#endif // USE_DMA_MACROS && (_NTDDK_ || _NTDRIVER_ || _NTOSP_) - -// -// Define Wait Context Block (WCB) -// - -typedef struct _WAIT_CONTEXT_BLOCK { - KDEVICE_QUEUE_ENTRY WaitQueueEntry; - PDRIVER_CONTROL DeviceRoutine; - PVOID DeviceContext; - ULONG NumberOfMapRegisters; - PVOID DeviceObject; - PVOID CurrentIrp; - PKDPC BufferChainingDpc; -} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK; - -// -// Define Device Object (DO) flags -// -#define DO_VERIFY_VOLUME 0x00000002 -#define DO_BUFFERED_IO 0x00000004 -#define DO_EXCLUSIVE 0x00000008 -#define DO_DIRECT_IO 0x00000010 -#define DO_MAP_IO_BUFFER 0x00000020 -#define DO_DEVICE_INITIALIZING 0x00000080 -#define DO_SHUTDOWN_REGISTERED 0x00000800 -#define DO_BUS_ENUMERATED_DEVICE 0x00001000 -#define DO_POWER_PAGABLE 0x00002000 -#define DO_POWER_INRUSH 0x00004000 -// -// Device Object structure definition -// - -#if _MSC_VER >= 1200 -#pragma warning(push) -#pragma warning(disable:4324) // structure was padded due to __declspec(align()) -#endif - -typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _DEVICE_OBJECT { - CSHORT Type; - USHORT Size; - LONG ReferenceCount; - struct _DRIVER_OBJECT *DriverObject; - struct _DEVICE_OBJECT *NextDevice; - struct _DEVICE_OBJECT *AttachedDevice; - struct _IRP *CurrentIrp; - PIO_TIMER Timer; - ULONG Flags; // See above: DO_... - ULONG Characteristics; // See ntioapi: FILE_... - __volatile PVPB Vpb; - PVOID DeviceExtension; - DEVICE_TYPE DeviceType; - CCHAR StackSize; - union { - LIST_ENTRY ListEntry; - WAIT_CONTEXT_BLOCK Wcb; - } Queue; - ULONG AlignmentRequirement; - KDEVICE_QUEUE DeviceQueue; - KDPC Dpc; - - // - // The following field is for exclusive use by the filesystem to keep - // track of the number of Fsp threads currently using the device - // - - ULONG ActiveThreadCount; - PSECURITY_DESCRIPTOR SecurityDescriptor; - KEVENT DeviceLock; - - USHORT SectorSize; - USHORT Spare1; - - struct _DEVOBJ_EXTENSION *DeviceObjectExtension; - PVOID Reserved; - -} DEVICE_OBJECT; - -typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - - -struct _DEVICE_OBJECT_POWER_EXTENSION; - -typedef struct _DEVOBJ_EXTENSION { - - CSHORT Type; - USHORT Size; - - // - // Public part of the DeviceObjectExtension structure - // - - PDEVICE_OBJECT DeviceObject; // owning device object - - -} DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION; - -// -// Define Driver Object (DRVO) flags -// - -#define DRVO_UNLOAD_INVOKED 0x00000001 -#define DRVO_LEGACY_DRIVER 0x00000002 -#define DRVO_BUILTIN_DRIVER 0x00000004 // Driver objects for Hal, PnP Mgr - -typedef struct _DRIVER_EXTENSION { - - // - // Back pointer to Driver Object - // - - struct _DRIVER_OBJECT *DriverObject; - - // - // The AddDevice entry point is called by the Plug & Play manager - // to inform the driver when a new device instance arrives that this - // driver must control. - // - - PDRIVER_ADD_DEVICE AddDevice; - - // - // The count field is used to count the number of times the driver has - // had its registered reinitialization routine invoked. - // - - ULONG Count; - - // - // The service name field is used by the pnp manager to determine - // where the driver related info is stored in the registry. - // - - UNICODE_STRING ServiceKeyName; - - // - // Note: any new shared fields get added here. - // - - -} DRIVER_EXTENSION, *PDRIVER_EXTENSION; - -typedef struct _DRIVER_OBJECT { - CSHORT Type; - CSHORT Size; - - // - // The following links all of the devices created by a single driver - // together on a list, and the Flags word provides an extensible flag - // location for driver objects. - // - - PDEVICE_OBJECT DeviceObject; - ULONG Flags; - - // - // The following section describes where the driver is loaded. The count - // field is used to count the number of times the driver has had its - // registered reinitialization routine invoked. - // - - PVOID DriverStart; - ULONG DriverSize; - PVOID DriverSection; - PDRIVER_EXTENSION DriverExtension; - - // - // The driver name field is used by the error log thread - // determine the name of the driver that an I/O request is/was bound. - // - - UNICODE_STRING DriverName; - - // - // The following section is for registry support. Thise is a pointer - // to the path to the hardware information in the registry - // - - PUNICODE_STRING HardwareDatabase; - - // - // The following section contains the optional pointer to an array of - // alternate entry points to a driver for "fast I/O" support. Fast I/O - // is performed by invoking the driver routine directly with separate - // parameters, rather than using the standard IRP call mechanism. Note - // that these functions may only be used for synchronous I/O, and when - // the file is cached. - // - - PFAST_IO_DISPATCH FastIoDispatch; - - // - // The following section describes the entry points to this particular - // driver. Note that the major function dispatch table must be the last - // field in the object so that it remains extensible. - // - - PDRIVER_INITIALIZE DriverInit; - PDRIVER_STARTIO DriverStartIo; - PDRIVER_UNLOAD DriverUnload; - PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1]; - -} DRIVER_OBJECT; -typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT; - - - -// -// The following structure is pointed to by the SectionObject pointer field -// of a file object, and is allocated by the various NT file systems. -// - -typedef struct _SECTION_OBJECT_POINTERS { - PVOID DataSectionObject; - PVOID SharedCacheMap; - PVOID ImageSectionObject; -} SECTION_OBJECT_POINTERS; -typedef SECTION_OBJECT_POINTERS *PSECTION_OBJECT_POINTERS; - -// -// Define the format of a completion message. -// - -typedef struct _IO_COMPLETION_CONTEXT { - PVOID Port; - PVOID Key; -} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT; - -// -// Define File Object (FO) flags -// - -#define FO_FILE_OPEN 0x00000001 -#define FO_SYNCHRONOUS_IO 0x00000002 -#define FO_ALERTABLE_IO 0x00000004 -#define FO_NO_INTERMEDIATE_BUFFERING 0x00000008 -#define FO_WRITE_THROUGH 0x00000010 -#define FO_SEQUENTIAL_ONLY 0x00000020 -#define FO_CACHE_SUPPORTED 0x00000040 -#define FO_NAMED_PIPE 0x00000080 -#define FO_STREAM_FILE 0x00000100 -#define FO_MAILSLOT 0x00000200 -#define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400 -#define FO_QUEUE_IRP_TO_THREAD FO_GENERATE_AUDIT_ON_CLOSE -#define FO_DIRECT_DEVICE_OPEN 0x00000800 -#define FO_FILE_MODIFIED 0x00001000 -#define FO_FILE_SIZE_CHANGED 0x00002000 -#define FO_CLEANUP_COMPLETE 0x00004000 -#define FO_TEMPORARY_FILE 0x00008000 -#define FO_DELETE_ON_CLOSE 0x00010000 -#define FO_OPENED_CASE_SENSITIVE 0x00020000 -#define FO_HANDLE_CREATED 0x00040000 -#define FO_FILE_FAST_IO_READ 0x00080000 -#define FO_RANDOM_ACCESS 0x00100000 -#define FO_FILE_OPEN_CANCELLED 0x00200000 -#define FO_VOLUME_OPEN 0x00400000 -#define FO_REMOTE_ORIGIN 0x01000000 -#define FO_DISALLOW_EXCLUSIVE 0x02000000 -#define FO_SKIP_COMPLETION_PORT FO_DISALLOW_EXCLUSIVE -#define FO_SKIP_SET_EVENT 0x04000000 -#define FO_SKIP_SET_FAST_IO 0x08000000 - -// -// This mask allows us to re-use flags that are not present during a create -// operation for uses that are only valid for the duration of the create. -// -#define FO_FLAGS_VALID_ONLY_DURING_CREATE FO_DISALLOW_EXCLUSIVE - -typedef struct _FILE_OBJECT { - CSHORT Type; - CSHORT Size; - PDEVICE_OBJECT DeviceObject; - PVPB Vpb; - PVOID FsContext; - PVOID FsContext2; - PSECTION_OBJECT_POINTERS SectionObjectPointer; - PVOID PrivateCacheMap; - NTSTATUS FinalStatus; - struct _FILE_OBJECT *RelatedFileObject; - BOOLEAN LockOperation; - BOOLEAN DeletePending; - BOOLEAN ReadAccess; - BOOLEAN WriteAccess; - BOOLEAN DeleteAccess; - BOOLEAN SharedRead; - BOOLEAN SharedWrite; - BOOLEAN SharedDelete; - ULONG Flags; - UNICODE_STRING FileName; - LARGE_INTEGER CurrentByteOffset; - __volatile ULONG Waiters; - __volatile ULONG Busy; - PVOID LastLock; - KEVENT Lock; - KEVENT Event; - __volatile PIO_COMPLETION_CONTEXT CompletionContext; - KSPIN_LOCK IrpListLock; - LIST_ENTRY IrpList; - __volatile PVOID FileObjectExtension; -} FILE_OBJECT; -typedef struct _FILE_OBJECT *PFILE_OBJECT; - -// -// Define I/O Request Packet (IRP) flags -// - -#define IRP_NOCACHE 0x00000001 -#define IRP_PAGING_IO 0x00000002 -#define IRP_MOUNT_COMPLETION 0x00000002 -#define IRP_SYNCHRONOUS_API 0x00000004 -#define IRP_ASSOCIATED_IRP 0x00000008 -#define IRP_BUFFERED_IO 0x00000010 -#define IRP_DEALLOCATE_BUFFER 0x00000020 -#define IRP_INPUT_OPERATION 0x00000040 -#define IRP_SYNCHRONOUS_PAGING_IO 0x00000040 -#define IRP_CREATE_OPERATION 0x00000080 -#define IRP_READ_OPERATION 0x00000100 -#define IRP_WRITE_OPERATION 0x00000200 -#define IRP_CLOSE_OPERATION 0x00000400 -#define IRP_DEFER_IO_COMPLETION 0x00000800 -#define IRP_OB_QUERY_NAME 0x00001000 -#define IRP_HOLD_DEVICE_QUEUE 0x00002000 - -// -// Define I/O request packet (IRP) alternate flags for allocation control. -// - -#define IRP_QUOTA_CHARGED 0x01 -#define IRP_ALLOCATED_MUST_SUCCEED 0x02 -#define IRP_ALLOCATED_FIXED_SIZE 0x04 -#define IRP_LOOKASIDE_ALLOCATION 0x08 - - - -// -// I/O Request Packet (IRP) definition -// - -typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _IRP { - CSHORT Type; - USHORT Size; - - // - // Define the common fields used to control the IRP. - // - - // - // Define a pointer to the Memory Descriptor List (MDL) for this I/O - // request. This field is only used if the I/O is "direct I/O". - // - - PMDL MdlAddress; - - // - // Flags word - used to remember various flags. - // - - ULONG Flags; - - // - // The following union is used for one of three purposes: - // - // 1. This IRP is an associated IRP. The field is a pointer to a master - // IRP. - // - // 2. This is the master IRP. The field is the count of the number of - // IRPs which must complete (associated IRPs) before the master can - // complete. - // - // 3. This operation is being buffered and the field is the address of - // the system space buffer. - // - - union { - struct _IRP *MasterIrp; - __volatile LONG IrpCount; - PVOID SystemBuffer; - } AssociatedIrp; - - // - // Thread list entry - allows queueing the IRP to the thread pending I/O - // request packet list. - // - - LIST_ENTRY ThreadListEntry; - - // - // I/O status - final status of operation. - // - - IO_STATUS_BLOCK IoStatus; - - // - // Requestor mode - mode of the original requestor of this operation. - // - - KPROCESSOR_MODE RequestorMode; - - // - // Pending returned - TRUE if pending was initially returned as the - // status for this packet. - // - - BOOLEAN PendingReturned; - - // - // Stack state information. - // - - CHAR StackCount; - CHAR CurrentLocation; - - // - // Cancel - packet has been canceled. - // - - BOOLEAN Cancel; - - // - // Cancel Irql - Irql at which the cancel spinlock was acquired. - // - - KIRQL CancelIrql; - - // - // ApcEnvironment - Used to save the APC environment at the time that the - // packet was initialized. - // - - CCHAR ApcEnvironment; - - // - // Allocation control flags. - // - - UCHAR AllocationFlags; - - // - // User parameters. - // - - PIO_STATUS_BLOCK UserIosb; - PKEVENT UserEvent; - union { - struct { - union { - PIO_APC_ROUTINE UserApcRoutine; - PVOID IssuingProcess; - }; - PVOID UserApcContext; - } AsynchronousParameters; - LARGE_INTEGER AllocationSize; - } Overlay; - - // - // CancelRoutine - Used to contain the address of a cancel routine supplied - // by a device driver when the IRP is in a cancelable state. - // - - __volatile PDRIVER_CANCEL CancelRoutine; - - // - // Note that the UserBuffer parameter is outside of the stack so that I/O - // completion can copy data back into the user's address space without - // having to know exactly which service was being invoked. The length - // of the copy is stored in the second half of the I/O status block. If - // the UserBuffer field is NULL, then no copy is performed. - // - - PVOID UserBuffer; - - // - // Kernel structures - // - // The following section contains kernel structures which the IRP needs - // in order to place various work information in kernel controller system - // queues. Because the size and alignment cannot be controlled, they are - // placed here at the end so they just hang off and do not affect the - // alignment of other fields in the IRP. - // - - union { - - struct { - - union { - - // - // DeviceQueueEntry - The device queue entry field is used to - // queue the IRP to the device driver device queue. - // - - KDEVICE_QUEUE_ENTRY DeviceQueueEntry; - - struct { - - // - // The following are available to the driver to use in - // whatever manner is desired, while the driver owns the - // packet. - // - - PVOID DriverContext[4]; - - } ; - - } ; - - // - // Thread - pointer to caller's Thread Control Block. - // - - PETHREAD Thread; - - // - // Auxiliary buffer - pointer to any auxiliary buffer that is - // required to pass information to a driver that is not contained - // in a normal buffer. - // - - PCHAR AuxiliaryBuffer; - - // - // The following unnamed structure must be exactly identical - // to the unnamed structure used in the minipacket header used - // for completion queue entries. - // - - struct { - - // - // List entry - used to queue the packet to completion queue, among - // others. - // - - LIST_ENTRY ListEntry; - - union { - - // - // Current stack location - contains a pointer to the current - // IO_STACK_LOCATION structure in the IRP stack. This field - // should never be directly accessed by drivers. They should - // use the standard functions. - // - - struct _IO_STACK_LOCATION *CurrentStackLocation; - - // - // Minipacket type. - // - - ULONG PacketType; - }; - }; - - // - // Original file object - pointer to the original file object - // that was used to open the file. This field is owned by the - // I/O system and should not be used by any other drivers. - // - - PFILE_OBJECT OriginalFileObject; - - } Overlay; - - // - // APC - This APC control block is used for the special kernel APC as - // well as for the caller's APC, if one was specified in the original - // argument list. If so, then the APC is reused for the normal APC for - // whatever mode the caller was in and the "special" routine that is - // invoked before the APC gets control simply deallocates the IRP. - // - - KAPC Apc; - - // - // CompletionKey - This is the key that is used to distinguish - // individual I/O operations initiated on a single file handle. - // - - PVOID CompletionKey; - - } Tail; - -} IRP; - -typedef IRP *PIRP; - -// -// Define completion routine types for use in stack locations in an IRP -// - -__drv_functionClass(IO_COMPLETION_ROUTINE) -__drv_sameIRQL -typedef -NTSTATUS -IO_COMPLETION_ROUTINE ( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __in_xcount_opt("varies") PVOID Context - ); - -typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE; - -// -// Define stack location control flags -// - -#define SL_PENDING_RETURNED 0x01 -#define SL_ERROR_RETURNED 0x02 -#define SL_INVOKE_ON_CANCEL 0x20 -#define SL_INVOKE_ON_SUCCESS 0x40 -#define SL_INVOKE_ON_ERROR 0x80 - -// -// Define flags for various functions -// - -// -// Create / Create Named Pipe -// -// The following flags must exactly match those in the IoCreateFile call's -// options. The case sensitive flag is added in later, by the parse routine, -// and is not an actual option to open. Rather, it is part of the object -// manager's attributes structure. -// - -#define SL_FORCE_ACCESS_CHECK 0x01 -#define SL_OPEN_PAGING_FILE 0x02 -#define SL_OPEN_TARGET_DIRECTORY 0x04 -#define SL_STOP_ON_SYMLINK 0x08 - - -#define SL_CASE_SENSITIVE 0x80 - -// -// Read / Write -// - -#define SL_KEY_SPECIFIED 0x01 -#define SL_OVERRIDE_VERIFY_VOLUME 0x02 -#define SL_WRITE_THROUGH 0x04 -#define SL_FT_SEQUENTIAL_WRITE 0x08 -#define SL_FORCE_DIRECT_WRITE 0x10 -#define SL_REALTIME_STREAM 0x20 - -// -// Device I/O Control -// -// -// Same SL_OVERRIDE_VERIFY_VOLUME as for read/write above. -// - -#define SL_READ_ACCESS_GRANTED 0x01 -#define SL_WRITE_ACCESS_GRANTED 0x04 // Gap for SL_OVERRIDE_VERIFY_VOLUME - -// -// Lock -// - -#define SL_FAIL_IMMEDIATELY 0x01 -#define SL_EXCLUSIVE_LOCK 0x02 - -// -// QueryDirectory / QueryEa / QueryQuota -// - -#define SL_RESTART_SCAN 0x01 -#define SL_RETURN_SINGLE_ENTRY 0x02 -#define SL_INDEX_SPECIFIED 0x04 - -// -// NotifyDirectory -// - -#define SL_WATCH_TREE 0x01 - -// -// FileSystemControl -// -// minor: mount/verify volume -// - -#define SL_ALLOW_RAW_MOUNT 0x01 - -// -// Define PNP/POWER types required by IRP_MJ_PNP/IRP_MJ_POWER. -// - -typedef enum _DEVICE_RELATION_TYPE { - BusRelations, - EjectionRelations, - PowerRelations, - RemovalRelations, - TargetDeviceRelation, - SingleBusRelations, - TransportRelations -} DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE; - -typedef struct _DEVICE_RELATIONS { - ULONG Count; - PDEVICE_OBJECT Objects[1]; // variable length -} DEVICE_RELATIONS, *PDEVICE_RELATIONS; - -typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE { - DeviceUsageTypeUndefined, - DeviceUsageTypePaging, - DeviceUsageTypeHibernation, - DeviceUsageTypeDumpFile -} DEVICE_USAGE_NOTIFICATION_TYPE; - - - -// workaround overloaded definition (rpc generated headers all define INTERFACE -// to match the class name). -#undef INTERFACE - -typedef struct _INTERFACE { - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - // interface specific entries go here -} INTERFACE, *PINTERFACE; - - - -typedef __struct_bcount(Size) struct _DEVICE_CAPABILITIES { - USHORT Size; - USHORT Version; // the version documented here is version 1 - ULONG DeviceD1:1; - ULONG DeviceD2:1; - ULONG LockSupported:1; - ULONG EjectSupported:1; // Ejectable in S0 - ULONG Removable:1; - ULONG DockDevice:1; - ULONG UniqueID:1; - ULONG SilentInstall:1; - ULONG RawDeviceOK:1; - ULONG SurpriseRemovalOK:1; - ULONG WakeFromD0:1; - ULONG WakeFromD1:1; - ULONG WakeFromD2:1; - ULONG WakeFromD3:1; - ULONG HardwareDisabled:1; - ULONG NonDynamic:1; - ULONG WarmEjectSupported:1; - ULONG NoDisplayInUI:1; - ULONG Reserved1:1; - ULONG Reserved:13; - - ULONG Address; - ULONG UINumber; - - DEVICE_POWER_STATE DeviceState[POWER_SYSTEM_MAXIMUM]; - SYSTEM_POWER_STATE SystemWake; - DEVICE_POWER_STATE DeviceWake; - ULONG D1Latency; - ULONG D2Latency; - ULONG D3Latency; -} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES; - -typedef struct _POWER_SEQUENCE { - ULONG SequenceD1; - ULONG SequenceD2; - ULONG SequenceD3; -} POWER_SEQUENCE, *PPOWER_SEQUENCE; - -typedef enum { - BusQueryDeviceID = 0, // \ - BusQueryHardwareIDs = 1, // Hardware ids - BusQueryCompatibleIDs = 2, // compatible device ids - BusQueryInstanceID = 3, // persistent id for this instance of the device - BusQueryDeviceSerialNumber = 4, // serial number for this device - BusQueryContainerID = 5 // unique id of the device's physical container -} BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE; - -typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE; - -#define PNP_DEVICE_DISABLED 0x00000001 -#define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002 -#define PNP_DEVICE_FAILED 0x00000004 -#define PNP_DEVICE_REMOVED 0x00000008 -#define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010 -#define PNP_DEVICE_NOT_DISABLEABLE 0x00000020 - -typedef enum { - DeviceTextDescription = 0, // DeviceDesc property - DeviceTextLocationInformation = 1 // DeviceLocation property -} DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE; - -// -// Define I/O Request Packet (IRP) stack locations -// - -#if !defined(_AMD64_) && !defined(_IA64_) -#include "pshpack4.h" -#endif - - - -#if defined(_WIN64) -#define POINTER_ALIGNMENT DECLSPEC_ALIGN(8) -#else -#define POINTER_ALIGNMENT -#endif - - - -#if _MSC_VER >= 1200 -#pragma warning(push) -#pragma warning(disable:4324) // structure was padded due to __declspec(align()) -#endif - -typedef struct _IO_STACK_LOCATION { - UCHAR MajorFunction; - UCHAR MinorFunction; - UCHAR Flags; - UCHAR Control; - - // - // The following user parameters are based on the service that is being - // invoked. Drivers and file systems can determine which set to use based - // on the above major and minor function codes. - // - - union { - - // - // System service parameters for: NtCreateFile - // - - struct { - PIO_SECURITY_CONTEXT SecurityContext; - ULONG Options; - USHORT POINTER_ALIGNMENT FileAttributes; - USHORT ShareAccess; - ULONG POINTER_ALIGNMENT EaLength; - } Create; - - - // - // System service parameters for: NtReadFile - // - - struct { - ULONG Length; - ULONG POINTER_ALIGNMENT Key; - LARGE_INTEGER ByteOffset; - } Read; - - // - // System service parameters for: NtWriteFile - // - - struct { - ULONG Length; - ULONG POINTER_ALIGNMENT Key; - LARGE_INTEGER ByteOffset; - } Write; - - // - // System service parameters for: NtQueryDirectoryFile - // - - struct { - ULONG Length; - PUNICODE_STRING FileName; - FILE_INFORMATION_CLASS FileInformationClass; - ULONG POINTER_ALIGNMENT FileIndex; - } QueryDirectory; - - // - // System service parameters for: NtNotifyChangeDirectoryFile - // - - struct { - ULONG Length; - ULONG POINTER_ALIGNMENT CompletionFilter; - } NotifyDirectory; - - // - // System service parameters for: NtQueryInformationFile - // - - struct { - ULONG Length; - FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass; - } QueryFile; - - // - // System service parameters for: NtSetInformationFile - // - - struct { - ULONG Length; - FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass; - PFILE_OBJECT FileObject; - union { - struct { - BOOLEAN ReplaceIfExists; - BOOLEAN AdvanceOnly; - }; - ULONG ClusterCount; - HANDLE DeleteHandle; - }; - } SetFile; - - - - // - // System service parameters for: NtQueryEaFile - // - - struct { - ULONG Length; - PVOID EaList; - ULONG EaListLength; - ULONG POINTER_ALIGNMENT EaIndex; - } QueryEa; - - // - // System service parameters for: NtSetEaFile - // - - struct { - ULONG Length; - } SetEa; - - - - // - // System service parameters for: NtQueryVolumeInformationFile - // - - struct { - ULONG Length; - FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass; - } QueryVolume; - - - - // - // System service parameters for: NtSetVolumeInformationFile - // - - struct { - ULONG Length; - FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass; - } SetVolume; - - // - // System service parameters for: NtFsControlFile - // - // Note that the user's output buffer is stored in the UserBuffer field - // and the user's input buffer is stored in the SystemBuffer field. - // - - struct { - ULONG OutputBufferLength; - ULONG POINTER_ALIGNMENT InputBufferLength; - ULONG POINTER_ALIGNMENT FsControlCode; - PVOID Type3InputBuffer; - } FileSystemControl; - // - // System service parameters for: NtLockFile/NtUnlockFile - // - - struct { - PLARGE_INTEGER Length; - ULONG POINTER_ALIGNMENT Key; - LARGE_INTEGER ByteOffset; - } LockControl; - - // - // System service parameters for: NtFlushBuffersFile - // - // No extra user-supplied parameters. - // - - - - // - // System service parameters for: NtCancelIoFile - // - // No extra user-supplied parameters. - // - - - - // - // System service parameters for: NtDeviceIoControlFile - // - // Note that the user's output buffer is stored in the UserBuffer field - // and the user's input buffer is stored in the SystemBuffer field. - // - - struct { - ULONG OutputBufferLength; - ULONG POINTER_ALIGNMENT InputBufferLength; - ULONG POINTER_ALIGNMENT IoControlCode; - PVOID Type3InputBuffer; - } DeviceIoControl; - - // - // System service parameters for: NtQuerySecurityObject - // - - struct { - SECURITY_INFORMATION SecurityInformation; - ULONG POINTER_ALIGNMENT Length; - } QuerySecurity; - - // - // System service parameters for: NtSetSecurityObject - // - - struct { - SECURITY_INFORMATION SecurityInformation; - PSECURITY_DESCRIPTOR SecurityDescriptor; - } SetSecurity; - - // - // Non-system service parameters. - // - // Parameters for MountVolume - // - - struct { - PVPB Vpb; - PDEVICE_OBJECT DeviceObject; - } MountVolume; - - // - // Parameters for VerifyVolume - // - - struct { - PVPB Vpb; - PDEVICE_OBJECT DeviceObject; - } VerifyVolume; - - // - // Parameters for Scsi with internal device contorl. - // - - struct { - struct _SCSI_REQUEST_BLOCK *Srb; - } Scsi; - - - - // - // System service parameters for: NtQueryQuotaInformationFile - // - - struct { - ULONG Length; - PSID StartSid; - PFILE_GET_QUOTA_INFORMATION SidList; - ULONG SidListLength; - } QueryQuota; - - // - // System service parameters for: NtSetQuotaInformationFile - // - - struct { - ULONG Length; - } SetQuota; - - - - // - // Parameters for IRP_MN_QUERY_DEVICE_RELATIONS - // - - struct { - DEVICE_RELATION_TYPE Type; - } QueryDeviceRelations; - - // - // Parameters for IRP_MN_QUERY_INTERFACE - // - - struct { - CONST GUID *InterfaceType; - USHORT Size; - USHORT Version; - PINTERFACE Interface; - PVOID InterfaceSpecificData; - } QueryInterface; - - // - // Parameters for IRP_MN_QUERY_CAPABILITIES - // - - struct { - PDEVICE_CAPABILITIES Capabilities; - } DeviceCapabilities; - - // - // Parameters for IRP_MN_FILTER_RESOURCE_REQUIREMENTS - // - - struct { - PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList; - } FilterResourceRequirements; - - // - // Parameters for IRP_MN_READ_CONFIG and IRP_MN_WRITE_CONFIG - // - - struct { - ULONG WhichSpace; - PVOID Buffer; - ULONG Offset; - ULONG POINTER_ALIGNMENT Length; - } ReadWriteConfig; - - // - // Parameters for IRP_MN_SET_LOCK - // - - struct { - BOOLEAN Lock; - } SetLock; - - // - // Parameters for IRP_MN_QUERY_ID - // - - struct { - BUS_QUERY_ID_TYPE IdType; - } QueryId; - - // - // Parameters for IRP_MN_QUERY_DEVICE_TEXT - // - - struct { - DEVICE_TEXT_TYPE DeviceTextType; - LCID POINTER_ALIGNMENT LocaleId; - } QueryDeviceText; - - // - // Parameters for IRP_MN_DEVICE_USAGE_NOTIFICATION - // - - struct { - BOOLEAN InPath; - BOOLEAN Reserved[3]; - DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type; - } UsageNotification; - - // - // Parameters for IRP_MN_WAIT_WAKE - // - - struct { - SYSTEM_POWER_STATE PowerState; - } WaitWake; - - // - // Parameter for IRP_MN_POWER_SEQUENCE - // - - struct { - PPOWER_SEQUENCE PowerSequence; - } PowerSequence; - - // - // Parameters for IRP_MN_SET_POWER and IRP_MN_QUERY_POWER - // - -#if (NTDDI_VERSION >= NTDDI_VISTA) - struct { - union { - ULONG SystemContext; - SYSTEM_POWER_STATE_CONTEXT SystemPowerStateContext; - }; - POWER_STATE_TYPE POINTER_ALIGNMENT Type; - POWER_STATE POINTER_ALIGNMENT State; - POWER_ACTION POINTER_ALIGNMENT ShutdownType; - } Power; -#else - struct { - ULONG SystemContext; - POWER_STATE_TYPE POINTER_ALIGNMENT Type; - POWER_STATE POINTER_ALIGNMENT State; - POWER_ACTION POINTER_ALIGNMENT ShutdownType; - } Power; -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - - // - // Parameters for StartDevice - // - - struct { - PCM_RESOURCE_LIST AllocatedResources; - PCM_RESOURCE_LIST AllocatedResourcesTranslated; - } StartDevice; - - // - // Parameters for Cleanup - // - // No extra parameters supplied - // - - // - // WMI Irps - // - - struct { - ULONG_PTR ProviderId; - PVOID DataPath; - ULONG BufferSize; - PVOID Buffer; - } WMI; - - // - // Others - driver-specific - // - - struct { - PVOID Argument1; - PVOID Argument2; - PVOID Argument3; - PVOID Argument4; - } Others; - - } Parameters; - - // - // Save a pointer to this device driver's device object for this request - // so it can be passed to the completion routine if needed. - // - - PDEVICE_OBJECT DeviceObject; - - // - // The following location contains a pointer to the file object for this - // request. - // - - PFILE_OBJECT FileObject; - - // - // The following routine is invoked depending on the flags in the above - // flags field. - // - - PIO_COMPLETION_ROUTINE CompletionRoutine; - - // - // The following is used to store the address of the context parameter - // that should be passed to the CompletionRoutine. - // - - PVOID Context; - -} IO_STACK_LOCATION, *PIO_STACK_LOCATION; - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#endif - -#if !defined(_AMD64_) && !defined(_IA64_) -#include "poppack.h" -#endif - -// -// Define the share access structure used by file systems to determine -// whether or not another accessor may open the file. -// - -typedef struct _SHARE_ACCESS { - ULONG OpenCount; - ULONG Readers; - ULONG Writers; - ULONG Deleters; - ULONG SharedRead; - ULONG SharedWrite; - ULONG SharedDelete; -} SHARE_ACCESS, *PSHARE_ACCESS; - -// -// Public I/O routine definitions -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_acquiresCancelSpinLock -__drv_neverHoldCancelSpinLock -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_setsIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoAcquireCancelSpinLock( - __out __deref __drv_savesIRQL PKIRQL Irql - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_valueIs(<0;==0) -NTKERNELAPI -NTSTATUS -IoAllocateDriverObjectExtension( - __in PDRIVER_OBJECT DriverObject, - __in PVOID ClientIdentificationAddress, - __in ULONG DriverObjectExtensionSize, - // When successful, this always allocates already-aliased memory. - __post __deref __drv_when(return==0, - __out __drv_aliasesMem __drv_allocatesMem(Mem) __drv_valueIs(!=0)) - PVOID *DriverObjectExtension - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PVOID -IoAllocateErrorLogEntry( - __in PVOID IoObject, - __in UCHAR EntrySize - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PIRP -IoAllocateIrp( - __in CCHAR StackSize, - __in BOOLEAN ChargeQuota - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PMDL -IoAllocateMdl( - __in_opt __drv_aliasesMem PVOID VirtualAddress, - __in ULONG Length, - __in BOOLEAN SecondaryBuffer, - __in BOOLEAN ChargeQuota, - __inout_opt PIRP Irp - ); -#endif - -typedef enum _IO_PAGING_PRIORITY { - IoPagingPriorityInvalid, // Returned if a non-paging IO IRP is passed. - IoPagingPriorityNormal, // For regular paging IO - IoPagingPriorityHigh, // For high priority paging IO - IoPagingPriorityReserved1, // Reserved for future use. - IoPagingPriorityReserved2 // Reserved for future use. -} IO_PAGING_PRIORITY; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -__drv_valueIs(==0;<0) -NTKERNELAPI -NTSTATUS -IoAttachDevice( - __in __drv_mustHold(Memory) __drv_when(return==0, __drv_aliasesMem) - PDEVICE_OBJECT SourceDevice, - __in PUNICODE_STRING TargetDevice, - __out PDEVICE_OBJECT *AttachedDevice - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_valueIs(!=0;==0) -NTKERNELAPI -PDEVICE_OBJECT -IoAttachDeviceToDeviceStack( - __in __drv_mustHold(Memory) __drv_when(return!=0, __drv_aliasesMem) - PDEVICE_OBJECT SourceDevice, - __in PDEVICE_OBJECT TargetDevice - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_aliasesMem -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PIRP -IoBuildAsynchronousFsdRequest( - __in ULONG MajorFunction, - __in PDEVICE_OBJECT DeviceObject, - __inout_opt PVOID Buffer, - __in_opt ULONG Length, - __in_opt PLARGE_INTEGER StartingOffset, - __in_opt PIO_STATUS_BLOCK IoStatusBlock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_aliasesMem -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -PIRP -IoBuildDeviceIoControlRequest( - __in ULONG IoControlCode, - __in PDEVICE_OBJECT DeviceObject, - __in_opt PVOID InputBuffer, - __in ULONG InputBufferLength, - __out_opt PVOID OutputBuffer, - __in ULONG OutputBufferLength, - __in BOOLEAN InternalDeviceIoControl, - __in PKEVENT Event, - __out PIO_STATUS_BLOCK IoStatusBlock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoBuildPartialMdl( - __in PMDL SourceMdl, - __inout PMDL TargetMdl, - __in PVOID VirtualAddress, - __in ULONG Length - ); -#endif - -typedef struct _BOOTDISK_INFORMATION { - LONGLONG BootPartitionOffset; - LONGLONG SystemPartitionOffset; - ULONG BootDeviceSignature; - ULONG SystemDeviceSignature; -} BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION; - -// -// This structure should follow the previous structure field for field. -// -typedef struct _BOOTDISK_INFORMATION_EX { - LONGLONG BootPartitionOffset; - LONGLONG SystemPartitionOffset; - ULONG BootDeviceSignature; - ULONG SystemDeviceSignature; - GUID BootDeviceGuid; - GUID SystemDeviceGuid; - BOOLEAN BootDeviceIsGpt; - BOOLEAN SystemDeviceIsGpt; -} BOOTDISK_INFORMATION_EX, *PBOOTDISK_INFORMATION_EX; - -#if (NTDDI_VERSION >= NTDDI_WIN7) -typedef struct _LOADER_PARTITION_INFORMATION_EX { - ULONG PartitionStyle; - ULONG PartitionNumber; - union { - ULONG Signature; - GUID DeviceId; - }; - ULONG Flags; -} LOADER_PARTITION_INFORMATION_EX, *PLOADER_PARTITION_INFORMATION_EX; - -typedef struct _BOOTDISK_INFORMATION_LITE { - ULONG NumberEntries; - LOADER_PARTITION_INFORMATION_EX Entries[1]; -} BOOTDISK_INFORMATION_LITE, *PBOOTDISK_INFORMATION_LITE; -#else - -#if (NTDDI_VERSION >= NTDDI_VISTA) -typedef struct _BOOTDISK_INFORMATION_LITE { - ULONG BootDeviceSignature; - ULONG SystemDeviceSignature; - GUID BootDeviceGuid; - GUID SystemDeviceGuid; - BOOLEAN BootDeviceIsGpt; - BOOLEAN SystemDeviceIsGpt; -} BOOTDISK_INFORMATION_LITE, *PBOOTDISK_INFORMATION_LITE; -#endif // NTDDI_VERSION >= NTDDI_VISTA - -#endif // NTDDI_VERSION >= NTDDI_VISTA - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoGetBootDiskInformation( - __inout PBOOTDISK_INFORMATION BootDiskInformation, - __in ULONG Size - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -NTSTATUS -IoGetBootDiskInformationLite( - __deref_out PBOOTDISK_INFORMATION_LITE *BootDiskInformation - ); - -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_aliasesMem -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -PIRP -IoBuildSynchronousFsdRequest( - __in ULONG MajorFunction, - __in PDEVICE_OBJECT DeviceObject, - __inout_opt PVOID Buffer, - __in_opt ULONG Length, - __in_opt PLARGE_INTEGER StartingOffset, - __in PKEVENT Event, - __out PIO_STATUS_BLOCK IoStatusBlock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -__success(TRUE) -NTKERNELAPI -NTSTATUS -FASTCALL -IofCallDriver( - __in PDEVICE_OBJECT DeviceObject, - __inout __drv_aliasesMem PIRP Irp - ); -#endif - -#define IoCallDriver(a,b) \ - IofCallDriver(a,b) - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -IoCancelIrp( - __in PIRP Irp - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoCheckShareAccess( - __in ACCESS_MASK DesiredAccess, - __in ULONG DesiredShareAccess, - __inout PFILE_OBJECT FileObject, - __inout PSHARE_ACCESS ShareAccess, - __in BOOLEAN Update - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -NTSTATUS -IoCheckShareAccessEx( - __in ACCESS_MASK DesiredAccess, - __in ULONG DesiredShareAccess, - __inout PFILE_OBJECT FileObject, - __inout PSHARE_ACCESS ShareAccess, - __in BOOLEAN Update, - __in PBOOLEAN WritePermission - ); -#endif - -// -// This value should be returned from completion routines to continue -// completing the IRP upwards. Otherwise, STATUS_MORE_PROCESSING_REQUIRED -// should be returned. -// -#define STATUS_CONTINUE_COMPLETION STATUS_SUCCESS - -// -// Completion routines can also use this enumeration in place of status codes. -// -typedef enum _IO_COMPLETION_ROUTINE_RESULT { - - ContinueCompletion = STATUS_CONTINUE_COMPLETION, - StopCompletion = STATUS_MORE_PROCESSING_REQUIRED - -} IO_COMPLETION_ROUTINE_RESULT, *PIO_COMPLETION_ROUTINE_RESULT; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_neverHold(KeSpinLockType) -NTKERNELAPI -VOID -FASTCALL -IofCompleteRequest( - __in PIRP Irp, - __in CCHAR PriorityBoost - ); -#endif - -#define IoCompleteRequest(a,b) \ - IofCompleteRequest(a,b) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoConnectInterrupt( - __out PKINTERRUPT *InterruptObject, - __in PKSERVICE_ROUTINE ServiceRoutine, - __in_opt PVOID ServiceContext, - __in_opt PKSPIN_LOCK SpinLock, - __in ULONG Vector, - __in KIRQL Irql, - __in KIRQL SynchronizeIrql, - __in KINTERRUPT_MODE InterruptMode, - __in BOOLEAN ShareVector, - __in KAFFINITY ProcessorEnableMask, - __in BOOLEAN FloatingSave - ); -#endif - -// -// Interrupt message information table entry definition -// - -typedef struct _IO_INTERRUPT_MESSAGE_INFO_ENTRY { - - // - // Message address - indicates the address the device should use to - // generate this message signaled interrupt. - // - - PHYSICAL_ADDRESS MessageAddress; - - // - // Target processor set - indicates the set of processors that this - // message in allowed to interrupt. - // - - KAFFINITY TargetProcessorSet; - - // - // Interrupt object - holds a pointer to the interrupt object associated - // with this interrupt message. This structure is opaque to drivers. - // - - PKINTERRUPT InterruptObject; - - // - // Message data - supplies the value that the device should write to the - // message address in order to generate this interrupt message. - // - - ULONG MessageData; - - // - // The remaining fields indicate the system interrupt vector, IRQL, - // trigger mode, and interrupt polarity associated with this interrupt - // message. These first three values are suitable for use in a fully - // specified connection parameter structure in a call to - // IoConnectInterruptEx. - // - - ULONG Vector; - KIRQL Irql; - KINTERRUPT_MODE Mode; - KINTERRUPT_POLARITY Polarity; - -} IO_INTERRUPT_MESSAGE_INFO_ENTRY, *PIO_INTERRUPT_MESSAGE_INFO_ENTRY; - -// -// Interrupt message information table definition -// - -typedef struct _IO_INTERRUPT_MESSAGE_INFO { - - // - // Unified IRQL - indicates the IRQL that will be used when calling a - // message service routine associated with any of the interrupt messages - // in this table. Such a unified IRQL will only exist in cases where 1) a - // driver provides a spinlock to IoConnectInterruptEx with the intent of - // serializing delivery of all of the messages listed in this table or 2) - // the driver provides a synchronization IRQL, and no spinlock, with the - // intent of blocking any message service routine associated with this - // table from directly preempting another one. If neither of these cases - // applies, then the different messages in this table are allowed to be - // delivered in parallel and at different IRQLs. In this case this field - // will be set to zero. - // - - KIRQL UnifiedIrql; - - // - // Message count - indicates the number of entries contained in this - // message information table. - // - - ULONG MessageCount; - - // - // Message info - lies at the start of a variable size array of - // information table entries, with the size of the array dictated by the - // message count associated with this table. Each entry describes a - // different interrupt message that has been allocated to this device. - // - - IO_INTERRUPT_MESSAGE_INFO_ENTRY MessageInfo[1]; - -} IO_INTERRUPT_MESSAGE_INFO, *PIO_INTERRUPT_MESSAGE_INFO; - -// -// Define the connection parameters associated with a fully specified -// interrupt connection request. -// - -typedef struct _IO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS { - - // - // PhysicalDeviceObject - Supplies the physical device object associated - // with the interrupt being connected. This is normally the physical - // device object associated with the device that generates the given - // interrupt. - // - - __in PDEVICE_OBJECT PhysicalDeviceObject; - - // - // InterruptObject - Supplies a pointer to the location that will be used - // to return a pointer to the interrupt object allocated in - // association with the interrupt being connected. - // - - __out PKINTERRUPT *InterruptObject; - - // - // ServiceRoutine - Supplies the address of the interrupt service routine - // (ISR) that should be executed when the interrupt occurs. - // - - __in PKSERVICE_ROUTINE ServiceRoutine; - - // - // ServiceContext - Supplies an opaque pointer to the driver context - // information that should be passed to the ISR. - // - - __in PVOID ServiceContext; - - // - // SpinLock - Supplies an optional pointer to a spin lock that will be - // acquired before every call to the ISR. After providing a spin - // lock, the driver can synchronize with the ISR by acquiring the spin - // lock at the synchronization IRQL associated with the interrupt. If - // this parameter is not provided, then an internal spin lock will be - // acquired before each call to the ISR. The driver can use - // KeSynchronizeExecution to acquire this internal spin lock at the - // appropriate IRQL and thus synchronize with the ISR. - // - - __in_opt PKSPIN_LOCK SpinLock; - - // - // SynchronizeIrql - Supplies the IRQL at which the interrupt spin lock - // should be acquired and at which the ISR should be executed. This - // parameter must be greater than or equal to the IRQL associated with - // the interrupt. This parameter is most often used in conjunction - // with a caller provided spin lock to serialize ISR execution across - // multiple interrupts, however it can also be used without a spin - // lock to block this ISR from directly preempting or being directly - // preempted by some other ISR. - // - - __in KIRQL SynchronizeIrql; - - // - // FloatingSave - Supplies an indication of whether or not the machine's - // floating point state should be saved before invoking the ISR. - // - - __in BOOLEAN FloatingSave; - - // - // ShareVector - Supplies an indication of whether this interrupt vector - // can be shared with other interrupt objects. This value is usually - // passed to a driver as part of the translated resources sent along - // with IRP_MN_START_DEVICE. - // - - __in BOOLEAN ShareVector; - - // - // Vector - Supplies the system interrupt vector associated with the - // interrupt being connected. This value is usually passed to a - // driver as part of the translated resources sent along with - // IRP_MN_START_DEVICE. - // - - __in ULONG Vector; - - // - // Irql - Supplies the IRQL associated with the interrupt being connected. - // This value is usually passed to a driver as part of its translated - // resources sent along with IRP_MN_START_DEVICE. - // - - __in KIRQL Irql; - - // - // InterruptMode - Supplies the trigger mode of the interrupt being - // connected. This parameter must be LevelSensitive for level - // triggered interrupts and Latched for edge triggered interrupts. - // This value is usually passed to a driver as part of its translated - // resources sent along with IRP_MN_START_DEVICE. - // - - __in KINTERRUPT_MODE InterruptMode; - - // - // ProcessorEnableMask - Supplies an affinity mask indicating the set of - // processors on which delivery of the interrupt should be allowed. - // This value is usually passed to a driver as part of its translated - // resources sent along with IRP_MN_START_DEVICE. - // - - __in KAFFINITY ProcessorEnableMask; - - // - // Group - Supplies a group number indicating the group of the processors - // on which delivery of the interrupt should be allowed. This value - // is usually passed to a driver as part of its translated resources - // sent along with IRP_MN_START_DEVICE. This value is ignored if the - // the version CONNECT_FULLY_SPECIFIED is used, in which case the - // group number is always 0. - // - - __in USHORT Group; - -} IO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS, - *PIO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS; - -// -// Define the connection parameters associated with a line based interrupt -// connection request. -// - -typedef struct _IO_CONNECT_INTERRUPT_LINE_BASED_PARAMETERS { - - // - // PhysicalDeviceObject - Supplies the physical device object associated - // with the line based interrupt being connected. In order to - // correctly determine the interrupt to connect, this is generally - // required to be the physical device object associated with the - // device that generates the interrupt of interest. - // - - __in PDEVICE_OBJECT PhysicalDeviceObject; - - // - // InterruptObject - Supplies a pointer to the location that will be used - // to return a pointer to the interrupt object allocated in - // association with the interrupt being connected. - // - - __out PKINTERRUPT *InterruptObject; - - // - // ServiceRoutine - Supplies the address of the interrupt service routine - // (ISR) that should be executed when the interrupt occurs. - // - - __in PKSERVICE_ROUTINE ServiceRoutine; - - // - // ServiceContext - Supplies an opaque pointer to the driver context - // information that should be passed to the ISR. - // - - __in PVOID ServiceContext; - - // - // SpinLock - Supplies an optional pointer to a spin lock that will be - // acquired before every call to the ISR. After providing a spin - // lock, the driver can synchronize with the ISR by acquiring the spin - // lock at the synchronization IRQL associated with the interrupt. If - // this parameter is not provided, then an internal spin lock will be - // acquired before each call to the ISR. The driver can use - // KeSynchronizeExecution to acquire this internal spin lock at the - // appropriate IRQL and thus synchronize with the ISR. - // - - __in_opt PKSPIN_LOCK SpinLock; - - // - // SynchronizeIrql - Supplies an optional IRQL at which the interrupt spin - // lock should be acquired and at which the ISR should be executed. - // If a nonzero value is provided for this parameter, it must be - // greater than or equal to the IRQL associated with the interrupt. - // This parameter is most often used in conjunction with a caller - // provided spin lock to serialize ISR execution across multiple - // interrupts, however it can also be used without a spin lock to - // block this ISR from directly preempting or being directly preempted - // by some other ISR. If this parameter is omitted then the IRQL of - // the interrupt being connected is used as the sychronization IRQL, - // both in the case where the caller provides a spin lock and in the - // case where the spin lock is omitted. - // - - __in_opt KIRQL SynchronizeIrql; - - // - // FloatingSave - Supplies an indication of whether or not the machine's - // floating point state should be saved before invoking the ISR. - // - - __in BOOLEAN FloatingSave; - -} IO_CONNECT_INTERRUPT_LINE_BASED_PARAMETERS, - *PIO_CONNECT_INTERRUPT_LINE_BASED_PARAMETERS; - -// -// Define the connection parameters associated with a message signaled -// interrupt connection request. -// - -typedef struct _IO_CONNECT_INTERRUPT_MESSAGE_BASED_PARAMETERS { - - // - // PhysicalDeviceObject - Supplies the physical device object associated - // with the interrupt messages being connected. In order to correctly - // determine the set of messages to connect, this is generally - // required to be the physical device object associated with the - // device that generates the interrupt messages of interest. - // - - __in PDEVICE_OBJECT PhysicalDeviceObject; - - // - // ConnectionContext - Supplies a union containing a pointer to the - // location that will be used to return the interrupt connection - // context to the caller. If message based interrupt connection is - // successful, then the connection context is a pointer to the - // associated interrupt message information table. If connection - // succeeds only after falling back on the associated line based - // interrupt, then the connection context is a pointer to the - // associated interrupt object. - // - - union { - __out PVOID *Generic; - __out PIO_INTERRUPT_MESSAGE_INFO *InterruptMessageTable; - __out PKINTERRUPT *InterruptObject; - } ConnectionContext; - - // - // MessageServiceRoutine - Supplies the interrupt message service routine - // (IMSR) that should be executed every time any one of the interrupt - // messages being connected is signaled. - // - - __in PKMESSAGE_SERVICE_ROUTINE MessageServiceRoutine; - - // - // ServiceContext - Supplies an opaque pointer to the driver context - // information that should be passed to the IMSR. - // - - __in PVOID ServiceContext; - - // - // SpinLock - Supplies an optional pointer to a spin lock that will be - // acquired before every call to the IMSR. After providing a spin - // lock, the driver can synchronize with the IMSR by acquiring the - // spin lock at the synchronization IRQL associated with the IMSR. - // Note that providing a spin lock will serialize processing of all of - // the interrupt messages being connected. In other words, providing - // a spin lock implies that no two interrupt messages out of the set - // being connected can ever be serviced in parallel by the IMSR. - // - // If this parameter is not provided, then an internal spin lock will - // be acquired before each call to the IMSR. This internal spin lock - // is associated with the interrupt object corresponding to the actual - // message that caused us to execute the IMSR, meaning that the IMSR - // can run on multiple processors and potentially at multiple IRQLs in - // this case. KeSynchronizeExecution can be used to acquire this - // internal spin lock at the appropriate IRQL, thus synchronizing with - // IMSR execution associated with a specific interrupt message while - // still allowing all other messages to be serviced as they are - // signaled. - // - - __in_opt PKSPIN_LOCK SpinLock; - - // - // SynchronizeIrql - Supplies an optional IRQL at which the interrupt spin - // lock should be acquired and at which the IMSR should be executed. - // If a nonzero value is provided for this parameter, it must be - // greater than or equal to the maximum IRQL associated with any of - // the interrupt messages being connected. - // - // This parameter is most often used in conjunction with a caller - // provided spin lock to serialize IMSR execution across multiple - // messages. If a spin lock is provided and this parameter is - // omitted, then the synchronization IRQL will be set to the maximum - // IRQL associated with any of the interrupt messages. - // - // This parameter can be used without a spin lock to block this IMSR - // from directly preempting or being directly preempted by itself, - // some other IMSR, or some other line based interrupt service - // routine. If this parameter is omitted and the spin lock is also - // omitted, then the IMSR will be executed at the IRQL associated with - // the individual message being serviced. In this case it is possible - // for the IMSR to preempt itself if it is connected to multiple - // messages with different associated IRQLs. - // - - __in_opt KIRQL SynchronizeIrql; - - // - // FloatingSave - Supplies an indication of whether or not the machine's - // floating point state should be saved before invoking the IMSR. - // - - __in BOOLEAN FloatingSave; - - // - // FallBackServiceRoutine - Supplies an optional address of an interrupt - // service routine (ISR) that should be executed when the line based - // interrupt associated with this device is signaled. This parameter - // will only be used when connection to this device's interrupt - // messages fails, which most commonly occurs when no interrupt - // messages are available for this device. - // - // Connection to the fall back service routine is functionally - // identical to a normal line based interrupt connection operation, - // the only difference being that in this case the service context, - // spin lock, synchronization IRQL, and floating save parameters given - // for the IMSR are reused when connecting the ISR. - // - - __in_opt PKSERVICE_ROUTINE FallBackServiceRoutine; - -} IO_CONNECT_INTERRUPT_MESSAGE_BASED_PARAMETERS, - *PIO_CONNECT_INTERRUPT_MESSAGE_BASED_PARAMETERS; - -// -// Define the different interrupt connection types that can be requested -// through IoConnectInterruptEx -// - -#define CONNECT_FULLY_SPECIFIED 0x1 -#define CONNECT_LINE_BASED 0x2 -#define CONNECT_MESSAGE_BASED 0x3 -#define CONNECT_FULLY_SPECIFIED_GROUP 0x4 -#define CONNECT_CURRENT_VERSION 0x4 - -// -// Interrupt connection parameter structure definition -// - -typedef struct _IO_CONNECT_INTERRUPT_PARAMETERS { - - // - // Version - Supplies the type of interrupt connection requested by this - // structure. This field must hold one of the following values. - // - // CONNECT_FULLY_SPECIFIED - Indicates that an attempt should be - // made to connect to the precise interrupt described by this - // structure. This vector can be either line based or message - // signaled. - // - // CONNECT_LINE_BASED - Indicates that an attempt should be made - // to connect to the line based interrupt associated with this - // device. - // - // CONNECT_MESSAGE_BASED - Indicates that an attempt should be - // made to connect to the interrupt messages that have been - // allocated for this device, optionally falling back on the - // device's line based interrupt if interrupt messages aren't - // available. - // - // CONNECT_FULLY_SPECIFIED_GROUP - Same as CONNECT_FULLY_SPECIFIED, - // except that a group number is also specified to indicate - // the group of processors on which the interrupt is allowed to - // be delivered. - // - // After successfully connecting an interrupt, this field is filled on - // output with the type of connection that was performed. This will - // always be the connection type given by the caller except in the - // case of a message based connection attempt that falls back to - // connection to the associated line based interrupt. - // - // If the caller passes an unsupported connection type, this field is - // filled on output with the maximum connection type supported by the - // interrupt connection routine. - // - - __inout ULONG Version; - - // - // Define a union to overlay the connection parameter structures - // associated with the different connection types on top of one another. - // - - union { - IO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS FullySpecified; - IO_CONNECT_INTERRUPT_LINE_BASED_PARAMETERS LineBased; - IO_CONNECT_INTERRUPT_MESSAGE_BASED_PARAMETERS MessageBased; - }; - -} IO_CONNECT_INTERRUPT_PARAMETERS, *PIO_CONNECT_INTERRUPT_PARAMETERS; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -NTSTATUS -IoConnectInterruptEx ( - __inout PIO_CONNECT_INTERRUPT_PARAMETERS Parameters - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -__drv_valueIs(==0;<0) -NTKERNELAPI -NTSTATUS -IoCreateDevice( - __in PDRIVER_OBJECT DriverObject, - __in ULONG DeviceExtensionSize, - __in_opt PUNICODE_STRING DeviceName, - __in DEVICE_TYPE DeviceType, - __in ULONG DeviceCharacteristics, - __in BOOLEAN Exclusive, - __out - __drv_out_deref( - __drv_allocatesMem(Mem) - __drv_when((((inFunctionClass$("DRIVER_INITIALIZE")) - ||(inFunctionClass$("DRIVER_DISPATCH")))), - __drv_aliasesMem) - __on_failure(__null)) - PDEVICE_OBJECT *DeviceObject - ); -#endif - -#define WDM_MAJORVERSION 0x06 -#define WDM_MINORVERSION 0x00 - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_preferredFunction("RtlIsNtDdiVersionAvailable","Preferred") -NTKERNELAPI -BOOLEAN -IoIsWdmVersionAvailable( - __drv_when(MajorVersion!=1&&MajorVersion!=6, - __in __drv_reportError("MajorVersion must be 1 or 6")) UCHAR MajorVersion, - __in __drv_when(MinorVersion!=0 && MinorVersion!=5 && MinorVersion!=16 - && MinorVersion!=32 && MinorVersion!=48, - __drv_reportError("MinorVersion must be 0, 0x5, 0x10, 0x20, or 0x30")) - UCHAR MinorVersion - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoCreateFile( - __out PHANDLE FileHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_opt PLARGE_INTEGER AllocationSize, - __in ULONG FileAttributes, - __in ULONG ShareAccess, - __in ULONG Disposition, - __in ULONG CreateOptions, - __in_opt PVOID EaBuffer, - __in ULONG EaLength, - __in CREATE_FILE_TYPE CreateFileType, - __in_opt PVOID InternalParameters, - __in ULONG Options - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -PKEVENT -IoCreateNotificationEvent( - __in PUNICODE_STRING EventName, - __out PHANDLE EventHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoCreateSymbolicLink( - __in PUNICODE_STRING SymbolicLinkName, - __in PUNICODE_STRING DeviceName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -PKEVENT -IoCreateSynchronizationEvent( - __in PUNICODE_STRING EventName, - __out PHANDLE EventHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoCreateUnprotectedSymbolicLink( - __in PUNICODE_STRING SymbolicLinkName, - __in PUNICODE_STRING DeviceName - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -__drv_clearDoInit(__yes) -NTKERNELAPI -VOID -IoDeleteDevice( - __in __drv_mustHold(Memory) __drv_freesMem(Mem) PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoDeleteSymbolicLink( - __in PUNICODE_STRING SymbolicLinkName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -IoDetachDevice( - __inout PDEVICE_OBJECT TargetDevice - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -IoDisconnectInterrupt( - __in PKINTERRUPT InterruptObject - ); -#endif - -// -// Interrupt disconnection parameter structure definition -// - -typedef struct _IO_DISCONNECT_INTERRUPT_PARAMETERS { - - // - // Version - Supplies the type of interrupt disconnection operation - // requested by this structure. This field must match the connection - // type returned by a corresponding successful call to - // IoConnectInterruptEx. - // - - __in ULONG Version; - - // - // ConnectionContext - Supplies a union containing the connection context - // associated with the interrupt being disconnected. When - // disconnecting fully specified or line based interrupts, this - // parameter supplies the interrupt object pointer that was returned - // when the interrupt was initially connected. When disconnecting a - // set of interrupt messages, this parameter supplies the interrupt - // message information table pointer that was returned when the - // interrupt messages were initially connected. - // - - union { - __in PVOID Generic; - __in PKINTERRUPT InterruptObject; - __in PIO_INTERRUPT_MESSAGE_INFO InterruptMessageTable; - } ConnectionContext; - -} IO_DISCONNECT_INTERRUPT_PARAMETERS, *PIO_DISCONNECT_INTERRUPT_PARAMETERS; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -VOID -IoDisconnectInterruptEx ( - __in PIO_DISCONNECT_INTERRUPT_PARAMETERS Parameters - ); -#endif // NTDDI_VERSION >= NTDDI_VISTA - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -NTSTATUS -IoGetAffinityInterrupt ( - __in PKINTERRUPT InterruptObject, - __out PGROUP_AFFINITY GroupAffinity - ); -#endif // NTDDI_VERSION >= NTDDI_WIN7 - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_freesMem(Mem) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoFreeIrp( - __in PIRP Irp - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoFreeMdl( - PMDL Mdl - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PDEVICE_OBJECT -__drv_maxIRQL(DISPATCH_LEVEL) -IoGetAttachedDeviceReference( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - - -FORCEINLINE -__drv_aliasesMem -PIO_STACK_LOCATION -IoGetCurrentIrpStackLocation( - __in PIRP Irp -) -/*-- - -Routine Description: - - This routine is invoked to return a pointer to the current stack location - in an I/O Request Packet (IRP). - -Arguments: - - Irp - Pointer to the I/O Request Packet. - -Return Value: - - The function value is a pointer to the current stack location in the - packet. - ---*/ -{ - ASSERT(Irp->CurrentLocation <= Irp->StackCount + 1); - return Irp->Tail.Overlay.CurrentStackLocation; -} - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_aliasesMem -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PVOID -IoGetDriverObjectExtension( - __in PDRIVER_OBJECT DriverObject, - __in PVOID ClientIdentificationAddress - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PEPROCESS -IoGetCurrentProcess( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoGetDeviceObjectPointer( - __in PUNICODE_STRING ObjectName, - __in ACCESS_MASK DesiredAccess, - __out PFILE_OBJECT *FileObject, - __out PDEVICE_OBJECT *DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_valueIs(!=0;==0) -NTKERNELAPI -struct _DMA_ADAPTER * -IoGetDmaAdapter( - __in_opt PDEVICE_OBJECT PhysicalDeviceObject, // required for PnP drivers - __in struct _DEVICE_DESCRIPTION *DeviceDescription, - __out __drv_when(return!=0, __drv_IoGetDmaAdapter __deref __checkReturn) - PULONG NumberOfMapRegisters - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -BOOLEAN -IoForwardIrpSynchronously( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp - ); - -#define IoForwardAndCatchIrp IoForwardIrpSynchronously - -#endif - - -//++ -// -// ULONG -// IoGetFunctionCodeFromCtlCode( -// __in ULONG ControlCode -// ) -// -// Routine Description: -// -// This routine extracts the function code from IOCTL and FSCTL function -// control codes. -// This routine should only be used by kernel mode code. -// -// Arguments: -// -// ControlCode - A function control code (IOCTL or FSCTL) from which the -// function code must be extracted. -// -// Return Value: -// -// The extracted function code. -// -// Note: -// -// The CTL_CODE macro, used to create IOCTL and FSCTL function control -// codes, is defined in ntioapi.h -// -//-- - -#define IoGetFunctionCodeFromCtlCode( ControlCode ) (\ - ( ControlCode >> 2) & 0x00000FFF ) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PVOID -IoGetInitialStack( - VOID - ); -#endif - -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -IoGetStackLimits ( - __out PULONG_PTR LowLimit, - __out PULONG_PTR HighLimit - ); - -#if (NTDDI_VERSION >= NTDDI_VISTA) -LOGICAL -IoWithinStackLimits( - __in ULONG_PTR RegionStart, - __in SIZE_T RegionSize - ); -#endif - - -#define IoCallDriverStackSafeDefault(a, b) IoCallDriver(a, b) - -// -// The following function is used to tell the caller how much stack is available -// - -__drv_maxIRQL(APC_LEVEL) -FORCEINLINE -ULONG_PTR -IoGetRemainingStackSize ( - VOID - ) -{ - ULONG_PTR Top; - ULONG_PTR Bottom; - - IoGetStackLimits( &Bottom, &Top ); - return((ULONG_PTR)(&Top) - Bottom ); -} - -FORCEINLINE -__drv_aliasesMem -PIO_STACK_LOCATION -IoGetNextIrpStackLocation( - __in PIRP Irp - ) -/*++ -Routine Description: - - This routine is invoked to return a pointer to the next stack location - in an I/O Request Packet (IRP). - -Arguments: - - Irp - Pointer to the I/O Request Packet. - -Return Value: - - The function value is a pointer to the next stack location in the packet. - ---*/ -{ - ASSERT(Irp->CurrentLocation > 0); - - return ((Irp)->Tail.Overlay.CurrentStackLocation - 1 ); -} - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PDEVICE_OBJECT -IoGetRelatedDeviceObject( - __in PFILE_OBJECT FileObject - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -PIRP -IoGetTopLevelIrp( - VOID - ); -#endif - - - -VOID -FORCEINLINE -IoInitializeDpcRequest( - __in PDEVICE_OBJECT DeviceObject, - __in PIO_DPC_ROUTINE DpcRoutine - ) -/*++ - -Routine Description: - - This routine is invoked to initialize the DPC in a device object for a - device driver during its initialization routine. The DPC is used later - when the driver interrupt service routine requests that a DPC routine - be queued for later execution. - -Arguments: - - DeviceObject - Pointer to the device object that the request is for. - - DpcRoutine - Address of the driver's DPC routine to be executed when - the DPC is dequeued for processing. - -Return Value: - - None. - ---*/ -{ - KeInitializeDpc( &DeviceObject->Dpc, -#pragma warning (suppress: 28165) // implementation of the required way - (PKDEFERRED_ROUTINE) DpcRoutine, - DeviceObject ); -} - -#if (NTDDI_VERSION >= NTDDI_WS03) -VOID -FORCEINLINE -IoInitializeThreadedDpcRequest( - __in PDEVICE_OBJECT DeviceObject, - __in PIO_DPC_ROUTINE DpcRoutine - ) -/*++ - -Routine Description: - - This routine is invoked to initialize the DPC in a device object for a - device driver during its initialization routine. The DPC is used later - when the driver interrupt service routine requests that a DPC routine - be queued for later execution. - - This initializes the DPC as a threaded DPC. - -Arguments: - - DeviceObject - Pointer to the device object that the request is for. - - DpcRoutine - Address of the driver's DPC routine to be executed when - the DPC is dequeued for processing. - -Return Value: - - None. - ---*/ -{ -#pragma warning (suppress: 28128) // implementation of the required way - KeInitializeThreadedDpc( &DeviceObject->Dpc, -#pragma warning (suppress: 28165) // implementation of the required way - (PKDEFERRED_ROUTINE) DpcRoutine, - DeviceObject ); -} -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoInitializeIrp( - __inout PIRP Irp, - __in USHORT PacketSize, - __in CCHAR StackSize - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoInitializeTimer( - __in PDEVICE_OBJECT DeviceObject, - __in PIO_TIMER_ROUTINE TimerRoutine, - __in_opt __drv_aliasesMem PVOID Context - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoReuseIrp( - __inout PIRP Irp, - __in NTSTATUS Iostatus - ); -#endif - - -//++ -// -// BOOLEAN -// IoIsErrorUserInduced( -// __in NTSTATUS Status -// ) -// -// Routine Description: -// -// This routine is invoked to determine if an error was as a -// result of user actions. Typically these error are related -// to removable media and will result in a pop-up. -// -// Arguments: -// -// Status - The status value to check. -// -// Return Value: -// The function value is TRUE if the user induced the error, -// otherwise FALSE is returned. -// -//-- -#define IoIsErrorUserInduced( Status ) ((BOOLEAN) \ - (((Status) == STATUS_DEVICE_NOT_READY) || \ - ((Status) == STATUS_IO_TIMEOUT) || \ - ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \ - ((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \ - ((Status) == STATUS_VERIFY_REQUIRED) || \ - ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \ - ((Status) == STATUS_WRONG_VOLUME))) - - - - -FORCEINLINE -VOID -IoMarkIrpPending( - __inout PIRP Irp -) -/*++ -Routine Description: - - This routine marks the specified I/O Request Packet (IRP) to indicate - that an initial status of STATUS_PENDING was returned to the caller. - This is used so that I/O completion can determine whether or not to - fully complete the I/O operation requested by the packet. - -Arguments: - - Irp - Pointer to the I/O Request Packet to be marked pending. - -Return Value: - - None. - ---*/ -{ - IoGetCurrentIrpStackLocation( (Irp) )->Control |= SL_PENDING_RETURNED; -} - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoRegisterShutdownNotification( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoRegisterLastChanceShutdownNotification( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_mustHoldCancelSpinLock -__drv_releasesCancelSpinLock -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoReleaseCancelSpinLock( - __in __drv_restoresIRQL __drv_useCancelIRQL KIRQL Irql - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -IoRemoveShareAccess( - __in PFILE_OBJECT FileObject, - __inout PSHARE_ACCESS ShareAccess - ); -#endif - - -//++ -// -// VOID -// IoRequestDpc( -// __in PDEVICE_OBJECT DeviceObject, -// __in PIRP Irp, -// __in PVOID Context -// ) -// -// Routine Description: -// -// This routine is invoked by the device driver's interrupt service routine -// to request that a DPC routine be queued for later execution at a lower -// IRQL. -// -// Arguments: -// -// DeviceObject - Device object for which the request is being processed. -// -// Irp - Pointer to the current I/O Request Packet (IRP) for the specified -// device. -// -// Context - Provides a general context parameter to be passed to the -// DPC routine. -// -// Return Value: -// -// None. -// -//-- - -#define IoRequestDpc( DeviceObject, Irp, Context ) ( \ - KeInsertQueueDpc( &(DeviceObject)->Dpc, (Irp), (Context) ) ) - -//++ -// -// PDRIVER_CANCEL -// IoSetCancelRoutine( -// __in PIRP Irp, -// __in PDRIVER_CANCEL CancelRoutine -// ) -// -// Routine Description: -// -// This routine is invoked to set the address of a cancel routine which -// is to be invoked when an I/O packet has been canceled. -// -// Arguments: -// -// Irp - Pointer to the I/O Request Packet itself. -// -// CancelRoutine - Address of the cancel routine that is to be invoked -// if the IRP is cancelled. -// -// Return Value: -// -// Previous value of CancelRoutine field in the IRP. -// -//-- - -#define IoSetCancelRoutine( Irp, NewCancelRoutine ) ( \ - (PDRIVER_CANCEL) (ULONG_PTR) InterlockedExchangePointer( (PVOID *) &(Irp)->CancelRoutine, (PVOID) (ULONG_PTR)(NewCancelRoutine) ) ) - -__drv_maxIRQL(DISPATCH_LEVEL) -FORCEINLINE -VOID -IoSetCompletionRoutine( - __in PIRP Irp, - __in_opt PIO_COMPLETION_ROUTINE CompletionRoutine, - __in_opt __drv_aliasesMem PVOID Context, - __in BOOLEAN InvokeOnSuccess, - __in BOOLEAN InvokeOnError, - __in BOOLEAN InvokeOnCancel - ) -//++ -// -// Routine Description: -// -// This routine is invoked to set the address of a completion routine which -// is to be invoked when an I/O packet has been completed by a lower-level -// driver. -// -// Arguments: -// -// Irp - Pointer to the I/O Request Packet itself. -// -// CompletionRoutine - Address of the completion routine that is to be -// invoked once the next level driver completes the packet. -// -// Context - Specifies a context parameter to be passed to the completion -// routine. -// -// InvokeOnSuccess - Specifies that the completion routine is invoked when the -// operation is successfully completed. -// -// InvokeOnError - Specifies that the completion routine is invoked when the -// operation completes with an error status. -// -// InvokeOnCancel - Specifies that the completion routine is invoked when the -// operation is being canceled. -// -// Return Value: -// -// None. -// -//-- -{ - PIO_STACK_LOCATION irpSp; - ASSERT( (InvokeOnSuccess || InvokeOnError || InvokeOnCancel) ? (CompletionRoutine != NULL) : TRUE ); - irpSp = IoGetNextIrpStackLocation(Irp); - irpSp->CompletionRoutine = CompletionRoutine; - irpSp->Context = Context; - irpSp->Control = 0; - - if (InvokeOnSuccess) { - irpSp->Control = SL_INVOKE_ON_SUCCESS; - } - - if (InvokeOnError) { - irpSp->Control |= SL_INVOKE_ON_ERROR; - } - - if (InvokeOnCancel) { - irpSp->Control |= SL_INVOKE_ON_CANCEL; - } -} - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -__checkReturn -NTSTATUS -IoSetCompletionRoutineEx( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __in PIO_COMPLETION_ROUTINE CompletionRoutine, - __in_opt PVOID Context, - __in BOOLEAN InvokeOnSuccess, - __in BOOLEAN InvokeOnError, - __in BOOLEAN InvokeOnCancel - ); -#endif - - -FORCEINLINE -VOID -IoSetNextIrpStackLocation ( - __inout PIRP Irp - ) -/*-- - -Routine Description: - - This routine is invoked to set the current IRP stack location to - the next stack location, i.e. it "pushes" the stack. - -Arguments: - - Irp - Pointer to the I/O Request Packet (IRP). - -Return Value: - - None. - ---*/ -{ - ASSERT(Irp->CurrentLocation > 0); - Irp->CurrentLocation--; - Irp->Tail.Overlay.CurrentStackLocation--; -} - -FORCEINLINE -VOID -IoCopyCurrentIrpStackLocationToNext( - __inout PIRP Irp -) -/*-- - -Routine Description: - - This routine is invoked to copy the IRP stack arguments and file - pointer from the current IrpStackLocation to the next - in an I/O Request Packet (IRP). - - If the caller wants to call IoCallDriver with a completion routine - but does not wish to change the arguments otherwise, - the caller first calls IoCopyCurrentIrpStackLocationToNext, - then IoSetCompletionRoutine, then IoCallDriver. - -Arguments: - - Irp - Pointer to the I/O Request Packet. - -Return Value: - - None. - ---*/ -{ - PIO_STACK_LOCATION irpSp; - PIO_STACK_LOCATION nextIrpSp; - irpSp = IoGetCurrentIrpStackLocation(Irp); - nextIrpSp = IoGetNextIrpStackLocation(Irp); - RtlCopyMemory( nextIrpSp, irpSp, FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); - nextIrpSp->Control = 0; -} - -FORCEINLINE -VOID -IoSkipCurrentIrpStackLocation ( - __inout PIRP Irp -) -/*-- -Routine Description: - - This routine is invoked to increment the current stack location of - a given IRP. - - If the caller wishes to call the next driver in a stack, and does not - wish to change the arguments, nor does he wish to set a completion - routine, then the caller first calls IoSkipCurrentIrpStackLocation - and the calls IoCallDriver. - -Arguments: - - Irp - Pointer to the I/O Request Packet. - -Return Value: - - None ---*/ -{ - ASSERT(Irp->CurrentLocation <= Irp->StackCount); - Irp->CurrentLocation++; - Irp->Tail.Overlay.CurrentStackLocation++; -} - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -IoSetShareAccess( - __in ACCESS_MASK DesiredAccess, - __in ULONG DesiredShareAccess, - __inout PFILE_OBJECT FileObject, - __out PSHARE_ACCESS ShareAccess - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -VOID -IoSetShareAccessEx( - __in ACCESS_MASK DesiredAccess, - __in ULONG DesiredShareAccess, - __inout PFILE_OBJECT FileObject, - __out PSHARE_ACCESS ShareAccess, - __in PBOOLEAN WritePermission - ); -#endif - - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -IoSetTopLevelIrp( - __in_opt PIRP Irp - ); -#endif - - - - - -typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK * PIO_REMOVE_LOCK_TRACKING_BLOCK; - -typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK { - BOOLEAN Removed; - BOOLEAN Reserved [3]; - __volatile LONG IoCount; - KEVENT RemoveEvent; - -} IO_REMOVE_LOCK_COMMON_BLOCK; - -typedef struct _IO_REMOVE_LOCK_DBG_BLOCK { - LONG Signature; - ULONG HighWatermark; - LONGLONG MaxLockedTicks; - LONG AllocateTag; - LIST_ENTRY LockList; - KSPIN_LOCK Spin; - __volatile LONG LowMemoryCount; - ULONG Reserved1[4]; - PVOID Reserved2; - PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks; -} IO_REMOVE_LOCK_DBG_BLOCK; - -typedef struct _IO_REMOVE_LOCK { - IO_REMOVE_LOCK_COMMON_BLOCK Common; -#if DBG - IO_REMOVE_LOCK_DBG_BLOCK Dbg; -#endif -} IO_REMOVE_LOCK, *PIO_REMOVE_LOCK; - -#define IoInitializeRemoveLock(Lock, Tag, Maxmin, HighWater) \ - IoInitializeRemoveLockEx (Lock, Tag, Maxmin, HighWater, sizeof (IO_REMOVE_LOCK)) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -NTAPI -IoInitializeRemoveLockEx( - __in PIO_REMOVE_LOCK Lock, - __in ULONG AllocateTag, // Used only on checked kernels - __in ULONG MaxLockedMinutes, // Used only on checked kernels - __in ULONG HighWatermark, // Used only on checked kernels - __in ULONG RemlockSize // are we checked or free - ); -#endif - -// -// Initialize a remove lock. -// -// Note: Allocation for remove locks needs to be within the device extension, -// so that the memory for this structure stays allocated until such time as the -// device object itself is deallocated. -// - -#if DBG -#define IoAcquireRemoveLock(RemoveLock, Tag) \ - IoAcquireRemoveLockEx(RemoveLock, Tag, __FILE__, __LINE__, sizeof (IO_REMOVE_LOCK)) -#else -#define IoAcquireRemoveLock(RemoveLock, Tag) \ - IoAcquireRemoveLockEx(RemoveLock, Tag, "", 1, sizeof (IO_REMOVE_LOCK)) -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -IoAcquireRemoveLockEx ( - __in PIO_REMOVE_LOCK RemoveLock, - __in_opt PVOID Tag, // Optional - __in PCSTR File, - __in ULONG Line, - __in ULONG RemlockSize // are we checked or free - ); -#endif - -// -// Routine Description: -// -// This routine is called to acquire the remove lock for a device object. -// While the lock is held, the caller can assume that no pending pnp REMOVE -// requests will be completed. -// -// The lock should be acquired immediately upon entering a dispatch routine. -// It should also be acquired before creating any new reference to the -// device object if there's a chance of releasing the reference before the -// new one is done, in addition to references to the driver code itself, -// which is removed from memory when the last device object goes. -// -// Arguments: -// -// RemoveLock - A pointer to an initialized REMOVE_LOCK structure. -// -// Tag - Used for tracking lock allocation and release. The same tag -// specified when acquiring the lock must be used to release the lock. -// Tags are only checked in checked versions of the driver. -// -// File - set to __FILE__ as the location in the code where the lock was taken. -// -// Line - set to __LINE__. -// -// Return Value: -// -// Returns whether or not the remove lock was obtained. -// If successful the caller should continue with work calling -// IoReleaseRemoveLock when finished. -// -// If not successful the lock was not obtained. The caller should abort the -// work but not call IoReleaseRemoveLock. -// - -#define IoReleaseRemoveLock(RemoveLock, Tag) \ - IoReleaseRemoveLockEx(RemoveLock, Tag, sizeof (IO_REMOVE_LOCK)) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -NTAPI -IoReleaseRemoveLockEx( - __in PIO_REMOVE_LOCK RemoveLock, - __in_opt PVOID Tag, // Optional - __in ULONG RemlockSize // are we checked or free - ); -#endif - -// -// -// Routine Description: -// -// This routine is called to release the remove lock on the device object. It -// must be called when finished using a previously locked reference to the -// device object. If an Tag was specified when acquiring the lock then the -// same Tag must be specified when releasing the lock. -// -// When the lock count reduces to zero, this routine will signal the waiting -// event to release the waiting thread deleting the device object protected -// by this lock. -// -// Arguments: -// -// DeviceObject - the device object to lock -// -// Tag - The TAG (if any) specified when acquiring the lock. This is used -// for lock tracking purposes -// -// Return Value: -// -// none -// - -#define IoReleaseRemoveLockAndWait(RemoveLock, Tag) \ - IoReleaseRemoveLockAndWaitEx(RemoveLock, Tag, sizeof (IO_REMOVE_LOCK)) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -NTAPI -IoReleaseRemoveLockAndWaitEx( - __in PIO_REMOVE_LOCK RemoveLock, - __in_opt PVOID Tag, - __in ULONG RemlockSize // are we checked or free - ); -#endif - -// -// -// Routine Description: -// -// This routine is called when the client would like to delete the -// remove-locked resource. This routine will block until all the remove -// locks have released. -// -// This routine MUST be called after acquiring the lock. -// -// Arguments: -// -// RemoveLock -// -// Return Value: -// -// none -// - - -//++ -// -// USHORT -// IoSizeOfIrp( -// __in CCHAR StackSize -// ) -// -// Routine Description: -// -// Determines the size of an IRP given the number of stack locations -// the IRP will have. -// -// Arguments: -// -// StackSize - Number of stack locations for the IRP. -// -// Return Value: -// -// Size in bytes of the IRP. -// -//-- - -#define IoSizeOfIrp( StackSize ) \ - ((USHORT) (sizeof( IRP ) + ((StackSize) * (sizeof( IO_STACK_LOCATION ))))) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) __drv_minIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoStartNextPacket( - __in PDEVICE_OBJECT DeviceObject, - __in BOOLEAN Cancelable - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoStartNextPacketByKey( - __in PDEVICE_OBJECT DeviceObject, - __in BOOLEAN Cancelable, - __in ULONG Key - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoStartPacket( - __in PDEVICE_OBJECT DeviceObject, - __in PIRP Irp, - __in_opt PULONG Key, - __in_opt PDRIVER_CANCEL CancelFunction - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -VOID -IoSetStartIoAttributes( - __in PDEVICE_OBJECT DeviceObject, - __in BOOLEAN DeferredStartIo, - __in BOOLEAN NonCancelable - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoStartTimer( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoStopTimer( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -IoUnregisterShutdownNotification( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -VOID -IoUpdateShareAccess( - __in PFILE_OBJECT FileObject, - __inout PSHARE_ACCESS ShareAccess - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -__drv_maxIRQL(DISPATCH_LEVEL) -IoWriteErrorLogEntry( - __in PVOID ElEntry - ); -#endif - -typedef struct _IO_WORKITEM *PIO_WORKITEM; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -ULONG -IoSizeofWorkItem( - VOID - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -VOID -IoInitializeWorkItem( - __in PVOID IoObject, - __in PIO_WORKITEM IoWorkItem - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -VOID -IoUninitializeWorkItem( - __in PIO_WORKITEM IoWorkItem - ); -#endif - -__drv_functionClass(IO_WORKITEM_ROUTINE) -__drv_requiresIRQL(PASSIVE_LEVEL) -__drv_sameIRQL -typedef -VOID -IO_WORKITEM_ROUTINE ( - __in PDEVICE_OBJECT DeviceObject, - __in_opt PVOID Context - ); - -typedef IO_WORKITEM_ROUTINE *PIO_WORKITEM_ROUTINE; - -typedef -VOID -IO_WORKITEM_ROUTINE_EX ( - __in PVOID IoObject, - __in_opt PVOID Context, - __in PIO_WORKITEM IoWorkItem - ); - -typedef IO_WORKITEM_ROUTINE_EX *PIO_WORKITEM_ROUTINE_EX; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -PIO_WORKITEM -IoAllocateWorkItem( - __in PDEVICE_OBJECT DeviceObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -VOID -IoFreeWorkItem( - __in PIO_WORKITEM IoWorkItem - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoQueueWorkItem( - __in PIO_WORKITEM IoWorkItem, - __in PIO_WORKITEM_ROUTINE WorkerRoutine, - __in WORK_QUEUE_TYPE QueueType, - __in_opt __drv_aliasesMem PVOID Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -IoQueueWorkItemEx( - __in PIO_WORKITEM IoWorkItem, - __in PIO_WORKITEM_ROUTINE_EX WorkerRoutine, - __in WORK_QUEUE_TYPE QueueType, - __in_opt __drv_aliasesMem PVOID Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoWMIRegistrationControl( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG Action -); -#endif - -// -// Action code for IoWMIRegistrationControl api -// - -#define WMIREG_ACTION_REGISTER 1 -#define WMIREG_ACTION_DEREGISTER 2 -#define WMIREG_ACTION_REREGISTER 3 -#define WMIREG_ACTION_UPDATE_GUIDS 4 -#define WMIREG_ACTION_BLOCK_IRPS 5 - -// -// Code passed in IRP_MN_REGINFO WMI irp -// - -#define WMIREGISTER 0 -#define WMIUPDATE 1 - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoWMIAllocateInstanceIds( - __in GUID *Guid, - __in ULONG InstanceCount, - __out ULONG *FirstInstanceId - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoWMISuggestInstanceName( - __in_opt PDEVICE_OBJECT PhysicalDeviceObject, - __in_opt PUNICODE_STRING SymbolicLinkName, - __in BOOLEAN CombineNames, - __out PUNICODE_STRING SuggestedInstanceName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__checkReturn -__drv_maxIRQL(APC_LEVEL) -__drv_valueIs(==0;<0) -NTKERNELAPI -NTSTATUS -IoWMIWriteEvent( - __inout __drv_when(return==0, __drv_aliasesMem) PVOID WnodeEventItem - ); -#endif - -#if defined(_WIN64) -NTKERNELAPI -ULONG -IoWMIDeviceObjectToProviderId( - __in PDEVICE_OBJECT DeviceObject - ); -#else -#define IoWMIDeviceObjectToProviderId(DeviceObject) ((ULONG)(DeviceObject)) -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoWMIOpenBlock( - __in GUID *DataBlockGuid, - __in ULONG DesiredAccess, - __out PVOID *DataBlockObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoWMIQueryAllData( - __in PVOID DataBlockObject, - __inout ULONG *InOutBufferSize, - __out_bcount_opt(*InOutBufferSize) /* non paged */ PVOID OutBuffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoWMIQueryAllDataMultiple( - __in_ecount(ObjectCount) PVOID *DataBlockObjectList, - __in ULONG ObjectCount, - __inout ULONG *InOutBufferSize, - __out_bcount_opt(*InOutBufferSize) /* non paged */ PVOID OutBuffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoWMIQuerySingleInstance( - __in PVOID DataBlockObject, - __in PUNICODE_STRING InstanceName, - __inout ULONG *InOutBufferSize, - __out_bcount_opt(*InOutBufferSize) /* non paged */ PVOID OutBuffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTKERNELAPI -NTSTATUS -IoWMIQuerySingleInstanceMultiple( - __in_ecount(ObjectCount) PVOID *DataBlockObjectList, - __in_ecount(ObjectCount) PUNICODE_STRING InstanceNames, - __in ULONG ObjectCount, - __inout ULONG *InOutBufferSize, - __out_bcount_opt(*InOutBufferSize) /* non paged */ PVOID OutBuffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoWMISetSingleInstance( - __in PVOID DataBlockObject, - __in PUNICODE_STRING InstanceName, - __in ULONG Version, - __in ULONG ValueBufferSize, - __in_bcount(ValueBufferSize) PVOID ValueBuffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoWMISetSingleItem( - __in PVOID DataBlockObject, - __in PUNICODE_STRING InstanceName, - __in ULONG DataItemId, - __in ULONG Version, - __in ULONG ValueBufferSize, - __in_bcount(ValueBufferSize) PVOID ValueBuffer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoWMIExecuteMethod( - __in PVOID DataBlockObject, - __in PUNICODE_STRING InstanceName, - __in ULONG MethodId, - __in ULONG InBufferSize, - __inout PULONG OutBufferSize, - __inout_bcount_part_opt(*OutBufferSize, InBufferSize) PUCHAR InOutBuffer - ); -#endif - -typedef -__drv_functionClass(WMI_NOTIFICATION_CALLBACK) -__drv_sameIRQL -VOID FWMI_NOTIFICATION_CALLBACK ( - PVOID Wnode, - PVOID Context - ); -typedef FWMI_NOTIFICATION_CALLBACK *WMI_NOTIFICATION_CALLBACK; - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoWMISetNotificationCallback( - __inout PVOID Object, - __in WMI_NOTIFICATION_CALLBACK Callback, - __in_opt PVOID Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoWMIHandleToInstanceName( - __in PVOID DataBlockObject, - __in HANDLE FileHandle, - __out PUNICODE_STRING InstanceName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -IoWMIDeviceObjectToInstanceName( - __in PVOID DataBlockObject, - __in PDEVICE_OBJECT DeviceObject, - __out PUNICODE_STRING InstanceName - ); -#endif - - -#if defined(_WIN64) - -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -IoIs32bitProcess( - __in_opt PIRP Irp - ); - -#endif - - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -VOID -IoFreeErrorLogEntry( - __in PVOID ElEntry - ); -#endif - -// Cancel SAFE API set start -// -// The following APIs are to help ease the pain of writing queue packages that -// handle the cancellation race well. The idea of this set of APIs 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 API 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 API 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 API set assumes that the field DriverContext[3] is -// always available for use and that the driver does not use it. -// - - -// -// 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 -#define IO_TYPE_CSQ_EX 3 - -// -// 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 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; - -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; - -// -// Initializes the cancel queue structure. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -NTSTATUS -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 - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -NTKERNELAPI -NTSTATUS -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 - ); -#endif - -// -// The caller calls this routine to insert the IRP and return STATUS_PENDING. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -VOID -IoCsqInsertIrp( - __in PIO_CSQ Csq, - __in PIRP Irp, - __in_opt PIO_CSQ_IRP_CONTEXT Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03) -NTKERNELAPI -NTSTATUS -IoCsqInsertIrpEx( - __in PIO_CSQ Csq, - __in PIRP Irp, - __in_opt PIO_CSQ_IRP_CONTEXT Context, - __in_opt PVOID InsertContext - ); -#endif - -// -// Returns an IRP if one can be found. NULL otherwise. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -PIRP -IoCsqRemoveNextIrp( - __in PIO_CSQ Csq, - __in_opt PVOID PeekContext - ); -#endif - -// -// 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. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -NTKERNELAPI -PIRP -IoCsqRemoveIrp( - __in PIO_CSQ Csq, - __in PIO_CSQ_IRP_CONTEXT Context - ); -#endif - -// Cancel SAFE API set end - - -#if (NTDDI_VERSION >= NTDDI_WINXPSP1) -NTKERNELAPI -NTSTATUS -IoValidateDeviceIoControlAccess( - __in PIRP Irp, - __in ULONG RequiredAccess - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -IO_PRIORITY_HINT -IoGetIoPriorityHint( - __in PIRP Irp - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSTATUS -IoSetIoPriorityHint( - __in PIRP Irp, - __in IO_PRIORITY_HINT PriorityHint - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSTATUS -IoAllocateSfioStreamIdentifier( - __in PFILE_OBJECT FileObject, - __in ULONG Length, - __in PVOID Signature, - __out PVOID *StreamIdentifier - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -PVOID -IoGetSfioStreamIdentifier( - __in PFILE_OBJECT FileObject, - __in PVOID Signature - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSTATUS -IoFreeSfioStreamIdentifier( - __in PFILE_OBJECT FileObject, - __in PVOID Signature - ); -#endif - -typedef enum _IO_ACCESS_TYPE { - - // - // Indicates that the Io will - // be comprised solely of reads - // - ReadAccess, - - // - // Indicates that the Io will - // be comprised solely of writes - // - WriteAccess, - - // - // Indicates that the Io will be - // comprised of reads and writes - // - ModifyAccess - -} IO_ACCESS_TYPE; - -typedef enum _IO_ACCESS_MODE { - - // - // Indicates that the Io will be - // sent down in a sequential order - // - SequentialAccess, - - // - // Indicates that the Io might - // not be in a predictable order - // - RandomAccess - -} IO_ACCESS_MODE; - -typedef enum _IO_CONTAINER_NOTIFICATION_CLASS { - IoSessionStateNotification, // 0 - Session State Notifications - IoMaxContainerNotificationClass -} IO_CONTAINER_NOTIFICATION_CLASS; - -typedef struct _IO_SESSION_STATE_NOTIFICATION { - ULONG Size; - ULONG Flags; - PVOID IoObject; - ULONG EventMask; - PVOID Context; -} IO_SESSION_STATE_NOTIFICATION, *PIO_SESSION_STATE_NOTIFICATION; - -typedef enum _IO_CONTAINER_INFORMATION_CLASS { - IoSessionStateInformation, // 0 - Session State Information - IoMaxContainerInformationClass -} IO_CONTAINER_INFORMATION_CLASS; - -typedef struct _IO_SESSION_STATE_INFORMATION { - ULONG SessionId; - IO_SESSION_STATE SessionState; - BOOLEAN LocalSession; -} IO_SESSION_STATE_INFORMATION, *PIO_SESSION_STATE_INFORMATION; - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTSTATUS -IoGetContainerInformation ( - __in IO_CONTAINER_INFORMATION_CLASS InformationClass, - __in_opt PVOID ContainerObject, - __inout_bcount_opt(BufferLength) PVOID Buffer, - __in ULONG BufferLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -typedef NTSTATUS (*PIO_CONTAINER_NOTIFICATION_FUNCTION)(); - -typedef -NTSTATUS -IO_SESSION_NOTIFICATION_FUNCTION ( - __in PVOID SessionObject, - __in PVOID IoObject, - __in ULONG Event, - __in PVOID Context, - __in_bcount_opt(PayloadLength) PVOID NotificationPayload, - __in ULONG PayloadLength - ); - -typedef IO_SESSION_NOTIFICATION_FUNCTION *PIO_SESSION_NOTIFICATION_FUNCTION; -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTSTATUS -IoRegisterContainerNotification( - __in IO_CONTAINER_NOTIFICATION_CLASS NotificationClass, - __in PIO_CONTAINER_NOTIFICATION_FUNCTION CallbackFunction, - __in_bcount_opt(NotificationInformationLength) PVOID NotificationInformation, - __in ULONG NotificationInformationLength, - __out PVOID CallbackRegistration - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -VOID -IoUnregisterContainerNotification( - __in PVOID CallbackRegistration - ); -#endif - - -#ifdef RUN_WPP - -#include -#include - -#endif // #ifdef RUN_WPP - - - -#ifndef _TRACEHANDLE_DEFINED -#define _TRACEHANDLE_DEFINED -typedef ULONG64 TRACEHANDLE, *PTRACEHANDLE; -#endif - -// -// Trace Provider APIs -// - -#ifdef RUN_WPP - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(HIGH_LEVEL) -NTKERNELAPI -NTSTATUS -WmiTraceMessage( - __in TRACEHANDLE LoggerHandle, - __in ULONG MessageFlags, - __in LPCGUID MessageGuid, - __in USHORT MessageNumber, - ... - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(HIGH_LEVEL) -NTKERNELAPI -NTSTATUS -WmiTraceMessageVa( - __in TRACEHANDLE LoggerHandle, - __in ULONG MessageFlags, - __in LPCGUID MessageGuid, - __in USHORT MessageNumber, - __in va_list MessageArgList - ); -#endif - -#endif // #ifdef RUN_WPP - -#ifndef TRACE_INFORMATION_CLASS_DEFINE - -typedef struct _ETW_TRACE_SESSION_SETTINGS { - ULONG Version; - ULONG BufferSize; - ULONG MinimumBuffers; - ULONG MaximumBuffers; - ULONG LoggerMode; - ULONG FlushTimer; - ULONG FlushThreshold; - ULONG ClockType; -} ETW_TRACE_SESSION_SETTINGS, *PETW_TRACE_SESSION_SETTINGS; - -typedef enum _TRACE_INFORMATION_CLASS { - TraceIdClass, - TraceHandleClass, - TraceEnableFlagsClass, - TraceEnableLevelClass, - GlobalLoggerHandleClass, - EventLoggerHandleClass, - AllLoggerHandlesClass, - TraceHandleByNameClass, - LoggerEventsLostClass, - TraceSessionSettingsClass, - LoggerEventsLoggedClass, - MaxTraceInformationClass -} TRACE_INFORMATION_CLASS; - -#if (NTDDI_VERSION >= NTDDI_WINXP) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -WmiQueryTraceInformation( - __in TRACE_INFORMATION_CLASS TraceInformationClass, - __out_bcount(TraceInformationLength) PVOID TraceInformation, - __in ULONG TraceInformationLength, - __out_opt PULONG RequiredLength, - __in_opt PVOID Buffer - ); -#endif - -#define TRACE_INFORMATION_CLASS_DEFINE -#endif // TRACE_INFOPRMATION_CLASS_DEFINE - - -#ifndef _ETW_KM_ -#define _ETW_KM_ -#endif - -#include - - -// -// Optional callback function that users provide. -// - -__drv_sameIRQL -typedef -VOID -(NTAPI *PETWENABLECALLBACK) ( - __in LPCGUID SourceId, - __in ULONG ControlCode, - __in UCHAR Level, - __in ULONGLONG MatchAnyKeyword, - __in ULONGLONG MatchAllKeyword, - __in_opt PEVENT_FILTER_DESCRIPTOR FilterData, - __inout_opt PVOID CallbackContext - ); - -// -// Kernel Mode Registration APIs. -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -NTKERNELAPI -EtwRegister( - __in LPCGUID ProviderId, - __in_opt PETWENABLECALLBACK EnableCallback, - __in_opt PVOID CallbackContext, - __out PREGHANDLE RegHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -NTKERNELAPI -EtwUnregister( - __in REGHANDLE RegHandle - ); -#endif - -// -// Kernel Mode Control (Is Enabled) APIs -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(HIGH_LEVEL) -BOOLEAN -NTKERNELAPI -EtwEventEnabled( - __in REGHANDLE RegHandle, - __in PCEVENT_DESCRIPTOR EventDescriptor - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(HIGH_LEVEL) -BOOLEAN -NTKERNELAPI -EtwProviderEnabled( - __in REGHANDLE RegHandle, - __in UCHAR Level, - __in ULONGLONG Keyword - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_when(ControlCode==EVENT_ACTIVITY_CTRL_CREATE_ID, __drv_maxIRQL(HIGH_LEVEL)) -__drv_when(ControlCode!=EVENT_ACTIVITY_CTRL_CREATE_ID, __drv_maxIRQL(APC_LEVEL)) -NTSTATUS -NTKERNELAPI -EtwActivityIdControl( - __in ULONG ControlCode, - __inout_bcount(sizeof(GUID))LPGUID ActivityId - ); -#endif - -// -// Kernel Mode Writing (Publishing/Logging) APIs -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(HIGH_LEVEL) -NTSTATUS -NTKERNELAPI -EtwWrite( - __in REGHANDLE RegHandle, - __in PCEVENT_DESCRIPTOR EventDescriptor, - __in_opt LPCGUID ActivityId, - __in ULONG UserDataCount, - __in_ecount_opt(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(HIGH_LEVEL) -NTSTATUS -NTKERNELAPI -EtwWriteTransfer( - __in REGHANDLE RegHandle, - __in PCEVENT_DESCRIPTOR EventDescriptor, - __in_opt LPCGUID ActivityId, - __in_opt LPCGUID RelatedActivityId, - __in ULONG UserDataCount, - __in_ecount_opt(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(HIGH_LEVEL) -NTSTATUS -NTKERNELAPI -EtwWriteString( - __in REGHANDLE RegHandle, - __in UCHAR Level, - __in ULONGLONG Keyword, - __in_opt LPCGUID ActivityId, - __in PCWSTR String - ); -#endif - -#define EVENT_WRITE_FLAG_NO_FAULTING 0x00000001 - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(HIGH_LEVEL) -NTSTATUS -NTKERNELAPI -EtwWriteEx( - __in REGHANDLE RegHandle, - __in PCEVENT_DESCRIPTOR EventDescriptor, - __in ULONG64 Filter, - __in ULONG Flags, - __in_opt LPCGUID ActivityId, - __in_opt LPCGUID RelatedActivityId, - __in ULONG UserDataCount, - __in_ecount_opt(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData - ); -#endif - - -// -// Define PnP Device Property for IoGetDeviceProperty -// - -#ifdef _PREFAST_ -#define __string_type 0x1000 -#define __guid_type 0x2000 -#define __multiString_type 0x4000 -#else -#define __string_type 0 -#define __guid_type 0 -#define __multiString_type 0 -#endif - -typedef enum { - DevicePropertyDeviceDescription = 0x0 | __string_type, - DevicePropertyHardwareID = 0x1 | __multiString_type, - DevicePropertyCompatibleIDs = 0x2 | __multiString_type, - DevicePropertyBootConfiguration = 0x3, - DevicePropertyBootConfigurationTranslated = 0x4, - DevicePropertyClassName = 0x5 | __string_type, - DevicePropertyClassGuid = 0x6 | __string_type, - DevicePropertyDriverKeyName = 0x7 | __string_type, - DevicePropertyManufacturer = 0x8 | __string_type, - DevicePropertyFriendlyName = 0x9 | __string_type, - DevicePropertyLocationInformation = 0xa | __string_type, - DevicePropertyPhysicalDeviceObjectName = 0xb | __string_type, - DevicePropertyBusTypeGuid = 0xc | __guid_type, - DevicePropertyLegacyBusType = 0xd, - DevicePropertyBusNumber = 0xe, - DevicePropertyEnumeratorName = 0xf | __string_type, - DevicePropertyAddress = 0x10, - DevicePropertyUINumber = 0x11, - DevicePropertyInstallState = 0x12, - DevicePropertyRemovalPolicy = 0x13, - DevicePropertyResourceRequirements = 0x14, - DevicePropertyAllocatedResources = 0x15, - DevicePropertyContainerID = 0x16 | __string_type -} DEVICE_REGISTRY_PROPERTY; - -typedef -__drv_functionClass(TRANSLATE_BUS_ADDRESS) -__drv_sameIRQL -BOOLEAN TRANSLATE_BUS_ADDRESS( - __inout_opt PVOID Context, - __in PHYSICAL_ADDRESS BusAddress, - __in ULONG Length, - __out PULONG AddressSpace, - __out PPHYSICAL_ADDRESS TranslatedAddress - ); -typedef TRANSLATE_BUS_ADDRESS *PTRANSLATE_BUS_ADDRESS; - -typedef -__drv_functionClass(GET_DMA_ADAPTER) -__drv_sameIRQL -struct _DMA_ADAPTER *GET_DMA_ADAPTER( - __inout_opt PVOID Context, - __in struct _DEVICE_DESCRIPTION *DeviceDescriptor, - __out PULONG NumberOfMapRegisters - ); -typedef GET_DMA_ADAPTER *PGET_DMA_ADAPTER; - -typedef -__drv_functionClass(GET_SET_DEVICE_DATA) -__drv_sameIRQL -ULONG GET_SET_DEVICE_DATA ( - __inout_opt PVOID Context, - __in ULONG DataType, - __inout_bcount(Length) PVOID Buffer, - __in ULONG Offset, - __in ULONG Length - ); -typedef GET_SET_DEVICE_DATA *PGET_SET_DEVICE_DATA; - -typedef enum _DEVICE_INSTALL_STATE { - InstallStateInstalled, - InstallStateNeedsReinstall, - InstallStateFailedInstall, - InstallStateFinishInstall -} DEVICE_INSTALL_STATE, *PDEVICE_INSTALL_STATE; - -// -// Define structure returned in response to IRP_MN_QUERY_BUS_INFORMATION by a -// PDO indicating the type of bus the device exists on. -// - -typedef struct _PNP_BUS_INFORMATION { - GUID BusTypeGuid; - INTERFACE_TYPE LegacyBusType; - ULONG BusNumber; -} PNP_BUS_INFORMATION, *PPNP_BUS_INFORMATION; - -// -// Define structure returned in response to IRP_MN_QUERY_LEGACY_BUS_INFORMATION -// by an FDO indicating the type of bus it is. This is normally the same bus -// type as the device's children (i.e., as retrieved from the child PDO's via -// IRP_MN_QUERY_BUS_INFORMATION) except for cases like CardBus, which can -// support both 16-bit (PCMCIABus) and 32-bit (PCIBus) cards. -// - -typedef struct _LEGACY_BUS_INFORMATION { - GUID BusTypeGuid; - INTERFACE_TYPE LegacyBusType; - ULONG BusNumber; -} LEGACY_BUS_INFORMATION, *PLEGACY_BUS_INFORMATION; - -// -// Defines for IoGetDeviceProperty(DevicePropertyRemovalPolicy). -// -typedef enum _DEVICE_REMOVAL_POLICY { - - RemovalPolicyExpectNoRemoval = 1, - RemovalPolicyExpectOrderlyRemoval = 2, - RemovalPolicyExpectSurpriseRemoval = 3 - -} DEVICE_REMOVAL_POLICY, *PDEVICE_REMOVAL_POLICY; - - - -typedef struct _BUS_INTERFACE_STANDARD { - // - // generic interface header - // - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - // - // standard bus interfaces - // - PTRANSLATE_BUS_ADDRESS TranslateBusAddress; - PGET_DMA_ADAPTER GetDmaAdapter; - PGET_SET_DEVICE_DATA SetBusData; - PGET_SET_DEVICE_DATA GetBusData; - -} BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD; - -typedef -VOID -(*PREENUMERATE_SELF)( - __in PVOID Context - ); - -typedef struct _REENUMERATE_SELF_INTERFACE_STANDARD { - // - // generic interface header - // - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - // - // Self-reenumeration interface - // - PREENUMERATE_SELF SurpriseRemoveAndReenumerateSelf; -} REENUMERATE_SELF_INTERFACE_STANDARD, *PREENUMERATE_SELF_INTERFACE_STANDARD; - - -// -// The following definitions are used in ACPI QueryInterface -// -typedef BOOLEAN (* PGPE_SERVICE_ROUTINE) ( - PVOID, - PVOID); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS (* PGPE_CONNECT_VECTOR) ( - PDEVICE_OBJECT, - ULONG, - KINTERRUPT_MODE, - BOOLEAN, - PGPE_SERVICE_ROUTINE, - PVOID, - PVOID); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS (* PGPE_DISCONNECT_VECTOR) ( - PVOID); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS (* PGPE_ENABLE_EVENT) ( - PDEVICE_OBJECT, - PVOID); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS (* PGPE_DISABLE_EVENT) ( - PDEVICE_OBJECT, - PVOID); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS (* PGPE_CLEAR_STATUS) ( - PDEVICE_OBJECT, - PVOID); - -typedef -VOID (* PDEVICE_NOTIFY_CALLBACK) ( - PVOID, - ULONG); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS (* PREGISTER_FOR_DEVICE_NOTIFICATIONS) ( - PDEVICE_OBJECT, - PDEVICE_NOTIFY_CALLBACK, - PVOID); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -void (* PUNREGISTER_FOR_DEVICE_NOTIFICATIONS) ( - PDEVICE_OBJECT, - PDEVICE_NOTIFY_CALLBACK); - -typedef struct _ACPI_INTERFACE_STANDARD { - // - // Generic interface header - // - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - // - // ACPI interfaces - // - PGPE_CONNECT_VECTOR GpeConnectVector; - PGPE_DISCONNECT_VECTOR GpeDisconnectVector; - PGPE_ENABLE_EVENT GpeEnableEvent; - PGPE_DISABLE_EVENT GpeDisableEvent; - PGPE_CLEAR_STATUS GpeClearStatus; - PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications; - PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications; - -} ACPI_INTERFACE_STANDARD, *PACPI_INTERFACE_STANDARD; - -// -// The following definitions are used in GUID_ACPI_INTERFACE_STANDARD2, -// The first version (above) passes in DEVICE_OBJECs, where this one -// is based on Contexts. -// - -typedef -BOOLEAN -(*PGPE_SERVICE_ROUTINE2) ( - PVOID ObjectContext, - PVOID ServiceContext - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS -(*PGPE_CONNECT_VECTOR2) ( - PVOID Context, - ULONG GpeNumber, - KINTERRUPT_MODE Mode, - BOOLEAN Shareable, - PGPE_SERVICE_ROUTINE ServiceRoutine, - PVOID ServiceContext, - PVOID *ObjectContext - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS -(*PGPE_DISCONNECT_VECTOR2) ( - PVOID Context, - PVOID ObjectContext - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS -(*PGPE_ENABLE_EVENT2) ( - PVOID Context, - PVOID ObjectContext - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS -(*PGPE_DISABLE_EVENT2) ( - PVOID Context, - PVOID ObjectContext - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS -(*PGPE_CLEAR_STATUS2) ( - PVOID Context, - PVOID ObjectContext - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(*PDEVICE_NOTIFY_CALLBACK2) ( - PVOID NotificationContext, - ULONG NotifyCode - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS -(*PREGISTER_FOR_DEVICE_NOTIFICATIONS2) ( - PVOID Context, - PDEVICE_NOTIFY_CALLBACK2 NotificationHandler, - PVOID NotificationContext - ); - -typedef -__drv_maxIRQL(DISPATCH_LEVEL) -VOID -(*PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2) ( - PVOID Context - ); - -typedef struct { - // - // Generic interface header - // - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - // - // ACPI interfaces - // - PGPE_CONNECT_VECTOR2 GpeConnectVector; - PGPE_DISCONNECT_VECTOR2 GpeDisconnectVector; - PGPE_ENABLE_EVENT2 GpeEnableEvent; - PGPE_DISABLE_EVENT2 GpeDisableEvent; - PGPE_CLEAR_STATUS2 GpeClearStatus; - PREGISTER_FOR_DEVICE_NOTIFICATIONS2 RegisterForDeviceNotifications; - PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2 UnregisterForDeviceNotifications; - -} ACPI_INTERFACE_STANDARD2, *PACPI_INTERFACE_STANDARD2; - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoInvalidateDeviceRelations( - __in PDEVICE_OBJECT DeviceObject, - __in DEVICE_RELATION_TYPE Type - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoRequestDeviceEject( - __in PDEVICE_OBJECT PhysicalDeviceObject - ); -#endif - -typedef VOID (*PIO_DEVICE_EJECT_CALLBACK)( - __in NTSTATUS Status, - __inout_opt PVOID Context - ); - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTKERNELAPI -NTSTATUS -IoRequestDeviceEjectEx( - __in PDEVICE_OBJECT PhysicalDeviceObject, - __in_opt PIO_DEVICE_EJECT_CALLBACK Callback, - __in_opt PVOID Context, - __in_opt PDRIVER_OBJECT DriverObject - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when((DeviceProperty & __string_type), - __drv_at(PropertyBuffer, - __post __nullterminated) - ) -__drv_when((DeviceProperty & __multiString_type), - __drv_at(PropertyBuffer, - __post __nullnullterminated) - ) -NTKERNELAPI -NTSTATUS -IoGetDeviceProperty( - __in PDEVICE_OBJECT DeviceObject, - __in DEVICE_REGISTRY_PROPERTY DeviceProperty, - __in ULONG BufferLength, - __out_bcount_opt(BufferLength) PVOID PropertyBuffer, - __out PULONG ResultLength - ); -#endif - -// -// The following definitions are used in IoOpenDeviceRegistryKey -// - -#define PLUGPLAY_REGKEY_DEVICE 1 -#define PLUGPLAY_REGKEY_DRIVER 2 -#define PLUGPLAY_REGKEY_CURRENT_HWPROFILE 4 - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTKERNELAPI -NTSTATUS -IoOpenDeviceRegistryKey( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG DevInstKeyType, - __in ACCESS_MASK DesiredAccess, - __out PHANDLE DevInstRegKey - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTKERNELAPI -NTSTATUS -NTAPI -IoRegisterDeviceInterface( - __in PDEVICE_OBJECT PhysicalDeviceObject, - __in CONST GUID *InterfaceClassGuid, - __in_opt PUNICODE_STRING ReferenceString, - __out __drv_when(return==0, - __drv_at(SymbolicLinkName->Buffer, __drv_allocatesMem(Mem))) - PUNICODE_STRING SymbolicLinkName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTKERNELAPI -NTSTATUS -IoOpenDeviceInterfaceRegistryKey( - __in PUNICODE_STRING SymbolicLinkName, - __in ACCESS_MASK DesiredAccess, - __out PHANDLE DeviceInterfaceKey - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) __drv_valueIs(>=0;<0) -__checkReturn -NTKERNELAPI -NTSTATUS -IoSetDeviceInterfaceState( - __in PUNICODE_STRING SymbolicLinkName, - __in BOOLEAN Enable - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTKERNELAPI -NTSTATUS -NTAPI -IoGetDeviceInterfaces( - __in CONST GUID *InterfaceClassGuid, - __in_opt PDEVICE_OBJECT PhysicalDeviceObject, - __in ULONG Flags, - __deref_out - __drv_deref( - __drv_when(return==0, __drv_allocatesMem(Mem) __drv_valueIs(!=0)) - __drv_when(return<0, __drv_valueIs(==0))) - PWSTR *SymbolicLinkList - ); -#endif - -#define DEVICE_INTERFACE_INCLUDE_NONACTIVE 0x00000001 - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTKERNELAPI -NTSTATUS -NTAPI -IoGetDeviceInterfaceAlias( - __in PUNICODE_STRING SymbolicLinkName, - __in CONST GUID *AliasInterfaceClassGuid, - __out - __drv_when(return==0, - __drv_at(AliasSymbolicLinkName->Buffer, __drv_allocatesMem(Mem))) - PUNICODE_STRING AliasSymbolicLinkName - ); -#endif - -// -// Define PnP notification event categories -// - -typedef enum _IO_NOTIFICATION_EVENT_CATEGORY { - EventCategoryReserved, - EventCategoryHardwareProfileChange, - EventCategoryDeviceInterfaceChange, - EventCategoryTargetDeviceChange -} IO_NOTIFICATION_EVENT_CATEGORY; - -// -// Define flags that modify the behavior of IoRegisterPlugPlayNotification -// for the various event categories... -// - -#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001 - -typedef -__drv_functionClass(DRIVER_NOTIFICATION_CALLBACK_ROUTINE) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSTATUS -DRIVER_NOTIFICATION_CALLBACK_ROUTINE ( - __in PVOID NotificationStructure, - __inout_opt PVOID Context -); -typedef DRIVER_NOTIFICATION_CALLBACK_ROUTINE - *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE; - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTKERNELAPI -NTSTATUS -IoRegisterPlugPlayNotification( - __in IO_NOTIFICATION_EVENT_CATEGORY EventCategory, - __in ULONG EventCategoryFlags, - __in_opt PVOID EventCategoryData, - __in PDRIVER_OBJECT DriverObject, - __in PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, - __inout_opt __drv_aliasesMem PVOID Context, - __deref_out - __drv_deref( - __drv_when(return==0, __drv_allocatesMem(Mem) __drv_valueIs(!=0)) - __drv_when(return<0, __drv_valueIs(==0))) - PVOID *NotificationEntry - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_freesMem(Pool) -NTKERNELAPI -NTSTATUS -IoUnregisterPlugPlayNotification( - __in PVOID NotificationEntry - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_freesMem(Pool) -NTKERNELAPI -NTSTATUS -IoUnregisterPlugPlayNotificationEx( - __in PVOID NotificationEntry - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTKERNELAPI -NTSTATUS -IoReportTargetDeviceChange( - __in PDEVICE_OBJECT PhysicalDeviceObject, - __in PVOID NotificationStructure // always begins with a PLUGPLAY_NOTIFICATION_HEADER - ); -#endif - -typedef -__drv_functionClass(DEVICE_CHANGE_COMPLETE_CALLBACK) -__drv_sameIRQL -VOID -DEVICE_CHANGE_COMPLETE_CALLBACK( - __inout_opt PVOID Context - ); -typedef DEVICE_CHANGE_COMPLETE_CALLBACK *PDEVICE_CHANGE_COMPLETE_CALLBACK; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -IoInvalidateDeviceState( - __in PDEVICE_OBJECT PhysicalDeviceObject - ); -#endif - -#define IoAdjustPagingPathCount(_count_,_paging_) { \ - if (_paging_) { \ - InterlockedIncrement(_count_); \ - } else { \ - InterlockedDecrement(_count_); \ - } \ -} - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -IoReportTargetDeviceChangeAsynchronous( - __in PDEVICE_OBJECT PhysicalDeviceObject, - __in PVOID NotificationStructure, // always begins with a PLUGPLAY_NOTIFICATION_HEADER - __in_opt PDEVICE_CHANGE_COMPLETE_CALLBACK Callback, - __inout_opt PVOID Context - ); -#endif - - -// -// Header structure for all Plug&Play notification events... -// - -typedef struct _PLUGPLAY_NOTIFICATION_HEADER { - USHORT Version; // presently at version 1. - USHORT Size; // size (in bytes) of header + event-specific data. - GUID Event; - // - // Event-specific stuff starts here. - // -} PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER; - -// -// Notification structure for all EventCategoryHardwareProfileChange events... -// - -typedef struct _HWPROFILE_CHANGE_NOTIFICATION { - USHORT Version; - USHORT Size; - GUID Event; - // - // (No event-specific data) - // -} HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION; - - -// -// Notification structure for all EventCategoryDeviceInterfaceChange events... -// - -typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION { - USHORT Version; - USHORT Size; - GUID Event; - // - // Event-specific data - // - GUID InterfaceClassGuid; - PUNICODE_STRING SymbolicLinkName; -} DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION; - - -// -// Notification structures for EventCategoryTargetDeviceChange... -// - -// -// The following structure is used for TargetDeviceQueryRemove, -// TargetDeviceRemoveCancelled, and TargetDeviceRemoveComplete: -// -typedef struct _TARGET_DEVICE_REMOVAL_NOTIFICATION { - USHORT Version; - USHORT Size; - GUID Event; - // - // Event-specific data - // - PFILE_OBJECT FileObject; -} TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION; - -// -// The following structure header is used for all other (i.e., 3rd-party) -// target device change events. The structure accommodates both a -// variable-length binary data buffer, and a variable-length unicode text -// buffer. The header must indicate where the text buffer begins, so that -// the data can be delivered in the appropriate format (ANSI or Unicode) -// to user-mode recipients (i.e., that have registered for handle-based -// notification via RegisterDeviceNotification). -// - -typedef struct _TARGET_DEVICE_CUSTOM_NOTIFICATION { - USHORT Version; - USHORT Size; - GUID Event; - // - // Event-specific data - // - PFILE_OBJECT FileObject; // This field must be set to NULL by callers of - // IoReportTargetDeviceChange. Clients that - // have registered for target device change - // notification on the affected PDO will be - // called with this field set to the file object - // they specified during registration. - // - LONG NameBufferOffset; // offset (in bytes) from beginning of - // CustomDataBuffer where text begins (-1 if none) - // - UCHAR CustomDataBuffer[1]; // variable-length buffer, containing (optionally) - // a binary data at the start of the buffer, - // followed by an optional unicode text buffer - // (word-aligned). - // -} TARGET_DEVICE_CUSTOM_NOTIFICATION, *PTARGET_DEVICE_CUSTOM_NOTIFICATION; - -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// -// Custom device properties... -// - -#include - -// -// Definitions of property flags. -// - -#define PLUGPLAY_PROPERTY_PERSISTENT 0x00000001 - -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTKERNELAPI -NTSTATUS -IoSetDevicePropertyData ( - __in PDEVICE_OBJECT Pdo, - __in CONST DEVPROPKEY *PropertyKey, - __in LCID Lcid, - __in ULONG Flags, - __in DEVPROPTYPE Type, - __in ULONG Size, - __in_opt PVOID Data - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTKERNELAPI -NTSTATUS -IoGetDevicePropertyData ( - __in PDEVICE_OBJECT Pdo, - __in CONST DEVPROPKEY *PropertyKey, - __in LCID Lcid, - __reserved ULONG Flags, - __in ULONG Size, - __out PVOID Data, - __out PULONG RequiredSize, - __out PDEVPROPTYPE Type - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTKERNELAPI -NTSTATUS -IoGetDeviceNumaNode ( - __in PDEVICE_OBJECT Pdo, - __out PUSHORT NodeNumber - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WS08) -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -NTKERNELAPI -NTSTATUS -NTAPI -IoReplacePartitionUnit ( - __in PDEVICE_OBJECT TargetPdo, - __in PDEVICE_OBJECT SparePdo, - __in ULONG Flags - ); -#endif - - -// -// Define replace driver entrypoint. -// - -typedef struct _PNP_REPLACE_DRIVER_INTERFACE *PPNP_REPLACE_DRIVER_INTERFACE; - -typedef -__checkReturn -NTSTATUS -(*PREPLACE_DRIVER_INIT) ( - __inout PPNP_REPLACE_DRIVER_INTERFACE Interface, - __in PVOID Unused - ); - -// -// Define parameters to replace driver. -// - -#define PNP_REPLACE_NO_MAP MAXLONGLONG - -typedef -__checkReturn -NTSTATUS -(*PREPLACE_MAP_MEMORY) ( - __in PHYSICAL_ADDRESS TargetPhysicalAddress, - __in PHYSICAL_ADDRESS SparePhysicalAddress, - __inout PLARGE_INTEGER NumberOfBytes, - __deref_out PVOID *TargetAddress, - __deref_out PVOID *SpareAddress - ); - -typedef struct _PNP_REPLACE_MEMORY_LIST { - - ULONG AllocatedCount; - ULONG Count; - ULONGLONG TotalLength; - struct { - PHYSICAL_ADDRESS Address; - ULONGLONG Length; - } Ranges[ANYSIZE_ARRAY]; - -} PNP_REPLACE_MEMORY_LIST, *PPNP_REPLACE_MEMORY_LIST; - -typedef struct _PNP_REPLACE_PROCESSOR_LIST { - - PKAFFINITY Affinity; - ULONG GroupCount; - ULONG AllocatedCount; - ULONG Count; - ULONG ApicIds[ANYSIZE_ARRAY]; - -} PNP_REPLACE_PROCESSOR_LIST, *PPNP_REPLACE_PROCESSOR_LIST; - -typedef struct _PNP_REPLACE_PROCESSOR_LIST_V1 { - - KAFFINITY AffinityMask; - ULONG AllocatedCount; - ULONG Count; - ULONG ApicIds[ANYSIZE_ARRAY]; - -} PNP_REPLACE_PROCESSOR_LIST_V1, *PPNP_REPLACE_PROCESSOR_LIST_V1; - -#define PNP_REPLACE_PARAMETERS_VERSION 2 - -typedef struct _PNP_REPLACE_PARAMETERS { - - ULONG Size; - ULONG Version; - - ULONG64 Target; - ULONG64 Spare; - PPNP_REPLACE_PROCESSOR_LIST TargetProcessors; - PPNP_REPLACE_PROCESSOR_LIST SpareProcessors; - PPNP_REPLACE_MEMORY_LIST TargetMemory; - PPNP_REPLACE_MEMORY_LIST SpareMemory; - - PREPLACE_MAP_MEMORY MapMemory; - -} PNP_REPLACE_PARAMETERS, *PPNP_REPLACE_PARAMETERS; - -// -// Define replace driver interface. -// - -typedef -VOID -(*PREPLACE_UNLOAD) ( - VOID - ); - -typedef -__checkReturn -NTSTATUS -(*PREPLACE_BEGIN) ( - __in PPNP_REPLACE_PARAMETERS Parameters, - __deref_out PVOID *Context -); - -typedef -__checkReturn -NTSTATUS -(*PREPLACE_END) ( - __in PVOID Context - ); - -typedef -__checkReturn -NTSTATUS -(*PREPLACE_MIRROR_PHYSICAL_MEMORY) ( - __in PVOID Context, - __in PHYSICAL_ADDRESS PhysicalAddress, - __in LARGE_INTEGER ByteCount - ); - -typedef -__checkReturn -NTSTATUS -(*PREPLACE_SET_PROCESSOR_ID) ( - __in PVOID Context, - __in ULONG ApicId, - __in BOOLEAN Target - ); - -typedef -__checkReturn -NTSTATUS -(*PREPLACE_SWAP) ( - __in PVOID Context - ); - -typedef -__checkReturn -NTSTATUS -(*PREPLACE_INITIATE_HARDWARE_MIRROR) ( - __in PVOID Context - ); - -typedef -__checkReturn -NTSTATUS -(*PREPLACE_MIRROR_PLATFORM_MEMORY) ( - __in PVOID Context - ); - -typedef -__checkReturn -NTSTATUS -(*PREPLACE_GET_MEMORY_DESTINATION) ( - __in PVOID Context, - __in PHYSICAL_ADDRESS SourceAddress, - __out PPHYSICAL_ADDRESS DestinationAddress - ); - -typedef -__checkReturn NTSTATUS -(*PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE) ( - __in PVOID Context, - __in BOOLEAN Enable - ); - -#define PNP_REPLACE_DRIVER_INTERFACE_VERSION 1 -#define PNP_REPLACE_DRIVER_INTERFACE_MINIMUM_SIZE \ - FIELD_OFFSET(PNP_REPLACE_DRIVER_INTERFACE, InitiateHardwareMirror) - -#define PNP_REPLACE_MEMORY_SUPPORTED 0x0001 -#define PNP_REPLACE_PROCESSOR_SUPPORTED 0x0002 -#define PNP_REPLACE_HARDWARE_MEMORY_MIRRORING 0x0004 -#define PNP_REPLACE_HARDWARE_PAGE_COPY 0x0008 -#define PNP_REPLACE_HARDWARE_QUIESCE 0x0010 - -// -// Define interface structure. -// - -typedef struct _PNP_REPLACE_DRIVER_INTERFACE { - - ULONG Size; - ULONG Version; - - ULONG Flags; - PREPLACE_UNLOAD Unload; - PREPLACE_BEGIN BeginReplace; - PREPLACE_END EndReplace; - PREPLACE_MIRROR_PHYSICAL_MEMORY MirrorPhysicalMemory; - PREPLACE_SET_PROCESSOR_ID SetProcessorId; - PREPLACE_SWAP Swap; - PREPLACE_INITIATE_HARDWARE_MIRROR InitiateHardwareMirror; - PREPLACE_MIRROR_PLATFORM_MEMORY MirrorPlatformMemory; - PREPLACE_GET_MEMORY_DESTINATION GetMemoryDestination; - PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE EnableDisableHardwareQuiesce; - -} PNP_REPLACE_DRIVER_INTERFACE, *PPNP_REPLACE_DRIVER_INTERFACE; - -// -// Define the device description structure. -// - -typedef struct _DEVICE_DESCRIPTION { - ULONG Version; - BOOLEAN Master; - BOOLEAN ScatterGather; - BOOLEAN DemandMode; - BOOLEAN AutoInitialize; - BOOLEAN Dma32BitAddresses; - BOOLEAN IgnoreCount; - BOOLEAN Reserved1; // must be false - BOOLEAN Dma64BitAddresses; - ULONG BusNumber; // unused for WDM - ULONG DmaChannel; - INTERFACE_TYPE InterfaceType; - DMA_WIDTH DmaWidth; - DMA_SPEED DmaSpeed; - ULONG MaximumLength; - ULONG DmaPort; -} DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION; - -// -// Define the supported version numbers for the device description structure. -// - -#define DEVICE_DESCRIPTION_VERSION 0 -#define DEVICE_DESCRIPTION_VERSION1 1 -#define DEVICE_DESCRIPTION_VERSION2 2 - - - -#if defined(_IA64_) -FORCEINLINE -VOID -KeFlushWriteBuffer ( - VOID - ) -{ - __mf (); - return; -} - -#else -NTHALAPI -VOID -KeFlushWriteBuffer ( - VOID - ); - -#endif - -// -// Performance counter function. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTHALAPI -LARGE_INTEGER -KeQueryPerformanceCounter ( - __out_opt PLARGE_INTEGER PerformanceFrequency - ); -#endif - - -// -// Stall processor execution function. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTHALAPI -VOID -KeStallExecutionProcessor ( - __in ULONG MicroSeconds - ); -#endif - - -typedef struct _SCATTER_GATHER_ELEMENT { - PHYSICAL_ADDRESS Address; - ULONG Length; - ULONG_PTR Reserved; -} SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT; - -#if defined(_MSC_EXTENSIONS) - -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4200) -typedef struct _SCATTER_GATHER_LIST { - ULONG NumberOfElements; - ULONG_PTR Reserved; - SCATTER_GATHER_ELEMENT Elements[]; -} SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST; -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4200) -#endif - -#else - -struct _SCATTER_GATHER_LIST; -typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST; - -#endif - - - -typedef struct _DMA_OPERATIONS *PDMA_OPERATIONS; - -typedef struct _DMA_ADAPTER { - USHORT Version; - USHORT Size; - PDMA_OPERATIONS DmaOperations; - // Private Bus Device Driver data follows, -} DMA_ADAPTER, *PDMA_ADAPTER; - - - -typedef VOID (*PPUT_DMA_ADAPTER)( - PDMA_ADAPTER DmaAdapter - ); - -typedef PVOID (*PALLOCATE_COMMON_BUFFER)( - __in PDMA_ADAPTER DmaAdapter, - __in ULONG Length, - __out PPHYSICAL_ADDRESS LogicalAddress, - __in BOOLEAN CacheEnabled - ); - -typedef VOID (*PFREE_COMMON_BUFFER)( - __in PDMA_ADAPTER DmaAdapter, - __in ULONG Length, - __in PHYSICAL_ADDRESS LogicalAddress, - __in PVOID VirtualAddress, - __in BOOLEAN CacheEnabled - ); - -typedef NTSTATUS (*PALLOCATE_ADAPTER_CHANNEL)( - __in PDMA_ADAPTER DmaAdapter, - __in PDEVICE_OBJECT DeviceObject, - __in ULONG NumberOfMapRegisters, - __in PDRIVER_CONTROL ExecutionRoutine, - __in PVOID Context - ); - -typedef BOOLEAN (*PFLUSH_ADAPTER_BUFFERS)( - __in PDMA_ADAPTER DmaAdapter, - __in PMDL Mdl, - __in PVOID MapRegisterBase, - __in PVOID CurrentVa, - __in ULONG Length, - __in BOOLEAN WriteToDevice - ); - -typedef VOID (*PFREE_ADAPTER_CHANNEL)( - __in PDMA_ADAPTER DmaAdapter - ); - -typedef VOID (*PFREE_MAP_REGISTERS)( - __in PDMA_ADAPTER DmaAdapter, - PVOID MapRegisterBase, - ULONG NumberOfMapRegisters - ); - -typedef PHYSICAL_ADDRESS (*PMAP_TRANSFER)( - __in PDMA_ADAPTER DmaAdapter, - __in PMDL Mdl, - __in PVOID MapRegisterBase, - __in PVOID CurrentVa, - __inout PULONG Length, - __in BOOLEAN WriteToDevice - ); - -typedef ULONG (*PGET_DMA_ALIGNMENT)( - __in PDMA_ADAPTER DmaAdapter - ); - -typedef ULONG (*PREAD_DMA_COUNTER)( - __in PDMA_ADAPTER DmaAdapter - ); - -typedef -__drv_functionClass(DRIVER_LIST_CONTROL) -__drv_sameIRQL -VOID -DRIVER_LIST_CONTROL( - __in struct _DEVICE_OBJECT *DeviceObject, - __in struct _IRP *Irp, - __in PSCATTER_GATHER_LIST ScatterGather, - __in PVOID Context - ); -typedef DRIVER_LIST_CONTROL *PDRIVER_LIST_CONTROL; - -typedef NTSTATUS -(*PGET_SCATTER_GATHER_LIST)( - __in PDMA_ADAPTER DmaAdapter, - __in PDEVICE_OBJECT DeviceObject, - __in PMDL Mdl, - __in PVOID CurrentVa, - __in ULONG Length, - __in PDRIVER_LIST_CONTROL ExecutionRoutine, - __in PVOID Context, - __in BOOLEAN WriteToDevice - ); - -typedef VOID -(*PPUT_SCATTER_GATHER_LIST)( - __in PDMA_ADAPTER DmaAdapter, - __in PSCATTER_GATHER_LIST ScatterGather, - __in BOOLEAN WriteToDevice - ); - -typedef NTSTATUS -(*PCALCULATE_SCATTER_GATHER_LIST_SIZE)( - __in PDMA_ADAPTER DmaAdapter, - __in OPTIONAL PMDL Mdl, - __in PVOID CurrentVa, - __in ULONG Length, - __out PULONG ScatterGatherListSize, - __out OPTIONAL PULONG pNumberOfMapRegisters - ); - -typedef NTSTATUS -(*PBUILD_SCATTER_GATHER_LIST)( - __in PDMA_ADAPTER DmaAdapter, - __in PDEVICE_OBJECT DeviceObject, - __in PMDL Mdl, - __in PVOID CurrentVa, - __in ULONG Length, - __in PDRIVER_LIST_CONTROL ExecutionRoutine, - __in PVOID Context, - __in BOOLEAN WriteToDevice, - __in PVOID ScatterGatherBuffer, - __in ULONG ScatterGatherLength - ); - -typedef NTSTATUS -(*PBUILD_MDL_FROM_SCATTER_GATHER_LIST)( - __in PDMA_ADAPTER DmaAdapter, - __in PSCATTER_GATHER_LIST ScatterGather, - __in PMDL OriginalMdl, - __out PMDL *TargetMdl - ); - - -typedef struct _DMA_OPERATIONS { - ULONG Size; - PPUT_DMA_ADAPTER PutDmaAdapter; - PALLOCATE_COMMON_BUFFER AllocateCommonBuffer; - PFREE_COMMON_BUFFER FreeCommonBuffer; - PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel; - PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers; - PFREE_ADAPTER_CHANNEL FreeAdapterChannel; - PFREE_MAP_REGISTERS FreeMapRegisters; - PMAP_TRANSFER MapTransfer; - PGET_DMA_ALIGNMENT GetDmaAlignment; - PREAD_DMA_COUNTER ReadDmaCounter; - PGET_SCATTER_GATHER_LIST GetScatterGatherList; - PPUT_SCATTER_GATHER_LIST PutScatterGatherList; - PCALCULATE_SCATTER_GATHER_LIST_SIZE CalculateScatterGatherList; - PBUILD_SCATTER_GATHER_LIST BuildScatterGatherList; - PBUILD_MDL_FROM_SCATTER_GATHER_LIST BuildMdlFromScatterGatherList; -} DMA_OPERATIONS; - - - -#if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_) // ntddk - -DECLSPEC_DEPRECATED_DDK // Use AllocateCommonBuffer -__drv_preferredFunction("AllocateCommonBuffer","Obsolete") -FORCEINLINE -PVOID -HalAllocateCommonBuffer( - __in PDMA_ADAPTER DmaAdapter, - __in ULONG Length, - __out PPHYSICAL_ADDRESS LogicalAddress, - __in BOOLEAN CacheEnabled - ){ - - PALLOCATE_COMMON_BUFFER allocateCommonBuffer; - PVOID commonBuffer; - - allocateCommonBuffer = *(DmaAdapter)->DmaOperations->AllocateCommonBuffer; - ASSERT( allocateCommonBuffer != NULL ); - - commonBuffer = allocateCommonBuffer( DmaAdapter, - Length, - LogicalAddress, - CacheEnabled ); - - return commonBuffer; -} - -DECLSPEC_DEPRECATED_DDK // Use FreeCommonBuffer -__drv_preferredFunction("FreeCommonBuffer","Obsolete") -FORCEINLINE -VOID -HalFreeCommonBuffer( - __in PDMA_ADAPTER DmaAdapter, - __in ULONG Length, - __in PHYSICAL_ADDRESS LogicalAddress, - __in PVOID VirtualAddress, - __in BOOLEAN CacheEnabled - ){ - - PFREE_COMMON_BUFFER freeCommonBuffer; - - freeCommonBuffer = *(DmaAdapter)->DmaOperations->FreeCommonBuffer; - ASSERT( freeCommonBuffer != NULL ); - - freeCommonBuffer( DmaAdapter, - Length, - LogicalAddress, - VirtualAddress, - CacheEnabled ); -} - -DECLSPEC_DEPRECATED_DDK // Use AllocateAdapterChannel -__drv_maxIRQL(DISPATCH_LEVEL) -__drv_minIRQL(DISPATCH_LEVEL) -__drv_preferredFunction("AllocateAdapterChannel","obsolete") -FORCEINLINE -NTSTATUS -IoAllocateAdapterChannel( - __in PDMA_ADAPTER DmaAdapter, - __in PDEVICE_OBJECT DeviceObject, - __in ULONG NumberOfMapRegisters, - __in PDRIVER_CONTROL ExecutionRoutine, - __in PVOID Context - ){ - - PALLOCATE_ADAPTER_CHANNEL allocateAdapterChannel; - NTSTATUS status; - - allocateAdapterChannel = - *(DmaAdapter)->DmaOperations->AllocateAdapterChannel; - - ASSERT( allocateAdapterChannel != NULL ); - - status = allocateAdapterChannel( DmaAdapter, - DeviceObject, - NumberOfMapRegisters, - ExecutionRoutine, - Context ); - - return status; -} - -DECLSPEC_DEPRECATED_DDK // Use FlushAdapterBuffers -__drv_preferredFunction("FlushAdapterBuffers","Obsolete") -FORCEINLINE -BOOLEAN -IoFlushAdapterBuffers( - __in PDMA_ADAPTER DmaAdapter, - __in PMDL Mdl, - __in PVOID MapRegisterBase, - __in PVOID CurrentVa, - __in ULONG Length, - __in BOOLEAN WriteToDevice - ){ - - PFLUSH_ADAPTER_BUFFERS flushAdapterBuffers; - BOOLEAN result; - - flushAdapterBuffers = *(DmaAdapter)->DmaOperations->FlushAdapterBuffers; - ASSERT( flushAdapterBuffers != NULL ); - - result = flushAdapterBuffers( DmaAdapter, - Mdl, - MapRegisterBase, - CurrentVa, - Length, - WriteToDevice ); - return result; -} - -DECLSPEC_DEPRECATED_DDK // Use FreeAdapterChannel -__drv_preferredFunction("FreeAdapterChannel","Obsolete") -FORCEINLINE -VOID -IoFreeAdapterChannel( - __in PDMA_ADAPTER DmaAdapter - ){ - - PFREE_ADAPTER_CHANNEL freeAdapterChannel; - - freeAdapterChannel = *(DmaAdapter)->DmaOperations->FreeAdapterChannel; - ASSERT( freeAdapterChannel != NULL ); - - freeAdapterChannel( DmaAdapter ); -} - -DECLSPEC_DEPRECATED_DDK // Use FreeMapRegisters -__drv_preferredFunction("FreeMapRegisters","Obsolete") -FORCEINLINE -VOID -IoFreeMapRegisters( - __in PDMA_ADAPTER DmaAdapter, - __in PVOID MapRegisterBase, - __in ULONG NumberOfMapRegisters - ){ - - PFREE_MAP_REGISTERS freeMapRegisters; - - freeMapRegisters = *(DmaAdapter)->DmaOperations->FreeMapRegisters; - ASSERT( freeMapRegisters != NULL ); - - freeMapRegisters( DmaAdapter, - MapRegisterBase, - NumberOfMapRegisters ); -} - - -DECLSPEC_DEPRECATED_DDK // Use MapTransfer -__drv_preferredFunction("MapTransfer","Obsolete") -FORCEINLINE -PHYSICAL_ADDRESS -IoMapTransfer( - __in PDMA_ADAPTER DmaAdapter, - __in PMDL Mdl, - __in PVOID MapRegisterBase, - __in PVOID CurrentVa, - __inout PULONG Length, - __in BOOLEAN WriteToDevice - ){ - - PHYSICAL_ADDRESS physicalAddress; - PMAP_TRANSFER mapTransfer; - - mapTransfer = *(DmaAdapter)->DmaOperations->MapTransfer; - ASSERT( mapTransfer != NULL ); - - physicalAddress = mapTransfer( DmaAdapter, - Mdl, - MapRegisterBase, - CurrentVa, - Length, - WriteToDevice ); - - return physicalAddress; -} - -DECLSPEC_DEPRECATED_DDK // Use GetDmaAlignment -FORCEINLINE -ULONG -HalGetDmaAlignment( - __in PDMA_ADAPTER DmaAdapter - ) -{ - PGET_DMA_ALIGNMENT getDmaAlignment; - ULONG alignment; - - getDmaAlignment = *(DmaAdapter)->DmaOperations->GetDmaAlignment; - ASSERT( getDmaAlignment != NULL ); - - alignment = getDmaAlignment( DmaAdapter ); - return alignment; -} - -DECLSPEC_DEPRECATED_DDK // Use ReadDmaCounter -__drv_preferredFunction("ReadDmaCounter","Obsolete") -FORCEINLINE -ULONG -HalReadDmaCounter( - __in PDMA_ADAPTER DmaAdapter - ) -{ - PREAD_DMA_COUNTER readDmaCounter; - ULONG counter; - - readDmaCounter = *(DmaAdapter)->DmaOperations->ReadDmaCounter; - ASSERT( readDmaCounter != NULL ); - - counter = readDmaCounter( DmaAdapter ); - return counter; -} - -#endif // USE_DMA_MACROS && (_NTDDK_ || _NTDRIVER_) - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -PoSetSystemState ( - __in EXECUTION_STATE Flags - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PVOID -PoRegisterSystemState ( - __inout_opt PVOID StateHandle, - __in EXECUTION_STATE Flags - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -PoCreatePowerRequest ( - __deref_out PVOID *PowerRequest, - __in PDEVICE_OBJECT DeviceObject, - __in PCOUNTED_REASON_CONTEXT Context - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -PoSetPowerRequest ( - __inout PVOID PowerRequest, - __in POWER_REQUEST_TYPE Type - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -PoClearPowerRequest ( - __inout PVOID PowerRequest, - __in POWER_REQUEST_TYPE Type - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -PoDeletePowerRequest ( - __inout PVOID PowerRequest - ); -#endif - - -typedef -__drv_functionClass(REQUEST_POWER_COMPLETE) -__drv_sameIRQL -VOID -REQUEST_POWER_COMPLETE ( - __in PDEVICE_OBJECT DeviceObject, - __in UCHAR MinorFunction, - __in POWER_STATE PowerState, - __in_opt PVOID Context, - __in PIO_STATUS_BLOCK IoStatus - ); - -typedef REQUEST_POWER_COMPLETE *PREQUEST_POWER_COMPLETE; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -PoRequestPowerIrp ( - __in PDEVICE_OBJECT DeviceObject, - __in UCHAR MinorFunction, - __in POWER_STATE PowerState, - __in_opt PREQUEST_POWER_COMPLETE CompletionFunction, - __in_opt __drv_aliasesMem PVOID Context, - __deref_opt_out PIRP *Irp - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -PoSetSystemWake ( - __inout PIRP Irp - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -PoGetSystemWake ( - __in PIRP Irp - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -PoUnregisterSystemState ( - __inout PVOID StateHandle - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -POWER_STATE -PoSetPowerState ( - __in PDEVICE_OBJECT DeviceObject, - __in POWER_STATE_TYPE Type, - __in POWER_STATE State - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -PoCallDriver ( - __in PDEVICE_OBJECT DeviceObject, - __inout __drv_aliasesMem PIRP Irp - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -VOID -PoStartNextPowerIrp( - __inout PIRP Irp - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -PULONG -PoRegisterDeviceForIdleDetection ( - __in PDEVICE_OBJECT DeviceObject, - __in ULONG ConservationIdleTime, - __in ULONG PerformanceIdleTime, - __in DEVICE_POWER_STATE State - ); -#endif - -#define PoSetDeviceBusy(IdlePointer) \ - *IdlePointer = 0 - -#if (NTDDI_VERSION >= NTDDI_WIN6SP1) -NTKERNELAPI -VOID -PoSetDeviceBusyEx ( - __inout PULONG IdlePointer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -VOID -PoStartDeviceBusy ( - __inout PULONG IdlePointer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -VOID -PoEndDeviceBusy ( - __inout PULONG IdlePointer - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -BOOLEAN -PoQueryWatchdogTime ( - __in PDEVICE_OBJECT Pdo, - __out PULONG SecondsRemaining - ); -#endif - -typedef -__drv_functionClass(POWER_SETTING_CALLBACK) -__drv_sameIRQL -NTSTATUS -POWER_SETTING_CALLBACK ( - __in LPCGUID SettingGuid, - __in_bcount(ValueLength) PVOID Value, - __in ULONG ValueLength, - __inout_opt PVOID Context -); - -typedef POWER_SETTING_CALLBACK *PPOWER_SETTING_CALLBACK; - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -PoRegisterPowerSettingCallback ( - __in_opt PDEVICE_OBJECT DeviceObject, - __in LPCGUID SettingGuid, - __in PPOWER_SETTING_CALLBACK Callback, - __in_opt PVOID Context, - __deref_opt_out PVOID *Handle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -PoUnregisterPowerSettingCallback ( - __inout PVOID Handle - ); -#endif - -// -// \Callback\PowerState values -// - -#define PO_CB_SYSTEM_POWER_POLICY 0 -#define PO_CB_AC_STATUS 1 -#define PO_CB_BUTTON_COLLISION 2 // deprecated -#define PO_CB_SYSTEM_STATE_LOCK 3 -#define PO_CB_LID_SWITCH_STATE 4 -#define PO_CB_PROCESSOR_POWER_POLICY 5 // deprecated - -// -// Object Manager types -// - -typedef struct _OBJECT_HANDLE_INFORMATION { - ULONG HandleAttributes; - ACCESS_MASK GrantedAccess; -} OBJECT_HANDLE_INFORMATION, *POBJECT_HANDLE_INFORMATION; - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -ObReferenceObjectByHandle( - __in HANDLE Handle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_TYPE ObjectType, - __in KPROCESSOR_MODE AccessMode, - __out PVOID *Object, - __out_opt POBJECT_HANDLE_INFORMATION HandleInformation - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -ObReferenceObjectByHandleWithTag( - __in HANDLE Handle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_TYPE ObjectType, - __in KPROCESSOR_MODE AccessMode, - __in ULONG Tag, - __out PVOID *Object, - __out_opt POBJECT_HANDLE_INFORMATION HandleInformation - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -#define ObDereferenceObject(a) \ - ObfDereferenceObject(a) - -#define ObReferenceObject(Object) ObfReferenceObject(Object) - -#define ObDereferenceObjectWithTag(a, t) \ - ObfDereferenceObjectWithTag(a, t) - -#define ObReferenceObjectWithTag(Object, Tag) ObfReferenceObjectWithTag(Object, Tag) - -#else - -#define ObDereferenceObject(a) \ - ObfDereferenceObject(a) - -#define ObReferenceObject(Object) ObfReferenceObject(Object) - -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG_PTR -FASTCALL -ObfReferenceObject( - __in PVOID Object - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG_PTR -FASTCALL -ObfReferenceObjectWithTag( - __in PVOID Object, - __in ULONG Tag - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -ObReferenceObjectByPointer( - __in PVOID Object, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_TYPE ObjectType, - __in KPROCESSOR_MODE AccessMode - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -NTSTATUS -ObReferenceObjectByPointerWithTag( - __in PVOID Object, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_TYPE ObjectType, - __in KPROCESSOR_MODE AccessMode, - __in ULONG Tag - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG_PTR -FASTCALL -ObfDereferenceObject( - __in PVOID Object - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(DISPATCH_LEVEL) -NTKERNELAPI -LONG_PTR -FASTCALL -ObfDereferenceObjectWithTag( - __in PVOID Object, - __in ULONG Tag - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTKERNELAPI -VOID -ObDereferenceObjectDeferDelete( - __in PVOID Object - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -NTKERNELAPI -VOID -ObDereferenceObjectDeferDeleteWithTag( - __in PVOID Object, - __in ULONG Tag - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -NTSTATUS -ObGetObjectSecurity( - __in PVOID Object, - __out PSECURITY_DESCRIPTOR *SecurityDescriptor, - __out PBOOLEAN MemoryAllocated - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTKERNELAPI -VOID -ObReleaseObjectSecurity( - __in PSECURITY_DESCRIPTOR SecurityDescriptor, - __in BOOLEAN MemoryAllocated - ); -#endif - - -// -// Registration version for Vista SP1 and Windows Server 2007 -// -#define OB_FLT_REGISTRATION_VERSION_0100 0x0100 - -// -// This value should be used by filters for registration -// -#define OB_FLT_REGISTRATION_VERSION OB_FLT_REGISTRATION_VERSION_0100 - -typedef ULONG OB_OPERATION; - -#define OB_OPERATION_HANDLE_CREATE 0x00000001 -#define OB_OPERATION_HANDLE_DUPLICATE 0x00000002 - -typedef struct _OB_PRE_CREATE_HANDLE_INFORMATION { - __inout ACCESS_MASK DesiredAccess; - __in ACCESS_MASK OriginalDesiredAccess; -} OB_PRE_CREATE_HANDLE_INFORMATION, *POB_PRE_CREATE_HANDLE_INFORMATION; - -typedef struct _OB_PRE_DUPLICATE_HANDLE_INFORMATION { - __inout ACCESS_MASK DesiredAccess; - __in ACCESS_MASK OriginalDesiredAccess; - __in PVOID SourceProcess; - __in PVOID TargetProcess; -} OB_PRE_DUPLICATE_HANDLE_INFORMATION, * POB_PRE_DUPLICATE_HANDLE_INFORMATION; - -typedef union _OB_PRE_OPERATION_PARAMETERS { - __inout OB_PRE_CREATE_HANDLE_INFORMATION CreateHandleInformation; - __inout OB_PRE_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation; -} OB_PRE_OPERATION_PARAMETERS, *POB_PRE_OPERATION_PARAMETERS; - -typedef struct _OB_PRE_OPERATION_INFORMATION { - __in OB_OPERATION Operation; - union { - __in ULONG Flags; - struct { - __in ULONG KernelHandle:1; - __in ULONG Reserved:31; - }; - }; - __in PVOID Object; - __in POBJECT_TYPE ObjectType; - __out PVOID CallContext; - __in POB_PRE_OPERATION_PARAMETERS Parameters; -} OB_PRE_OPERATION_INFORMATION, *POB_PRE_OPERATION_INFORMATION; - -typedef struct _OB_POST_CREATE_HANDLE_INFORMATION { - __in ACCESS_MASK GrantedAccess; -} OB_POST_CREATE_HANDLE_INFORMATION, *POB_POST_CREATE_HANDLE_INFORMATION; - -typedef struct _OB_POST_DUPLICATE_HANDLE_INFORMATION { - __in ACCESS_MASK GrantedAccess; -} OB_POST_DUPLICATE_HANDLE_INFORMATION, * POB_POST_DUPLICATE_HANDLE_INFORMATION; - -typedef union _OB_POST_OPERATION_PARAMETERS { - __in OB_POST_CREATE_HANDLE_INFORMATION CreateHandleInformation; - __in OB_POST_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation; -} OB_POST_OPERATION_PARAMETERS, *POB_POST_OPERATION_PARAMETERS; - -typedef struct _OB_POST_OPERATION_INFORMATION { - __in OB_OPERATION Operation; - union { - __in ULONG Flags; - struct { - __in ULONG KernelHandle:1; - __in ULONG Reserved:31; - }; - }; - __in PVOID Object; - __in POBJECT_TYPE ObjectType; - __in PVOID CallContext; - __in NTSTATUS ReturnStatus; - __in POB_POST_OPERATION_PARAMETERS Parameters; -} OB_POST_OPERATION_INFORMATION,*POB_POST_OPERATION_INFORMATION; - -typedef enum _OB_PREOP_CALLBACK_STATUS { - OB_PREOP_SUCCESS -} OB_PREOP_CALLBACK_STATUS, *POB_PREOP_CALLBACK_STATUS; - -typedef OB_PREOP_CALLBACK_STATUS -(*POB_PRE_OPERATION_CALLBACK) ( - __in PVOID RegistrationContext, - __inout POB_PRE_OPERATION_INFORMATION OperationInformation - ); - -typedef VOID -(*POB_POST_OPERATION_CALLBACK) ( - __in PVOID RegistrationContext, - __in POB_POST_OPERATION_INFORMATION OperationInformation - ); - -typedef struct _OB_OPERATION_REGISTRATION { - __in POBJECT_TYPE *ObjectType; - __in OB_OPERATION Operations; - __in POB_PRE_OPERATION_CALLBACK PreOperation; - __in POB_POST_OPERATION_CALLBACK PostOperation; -} OB_OPERATION_REGISTRATION, *POB_OPERATION_REGISTRATION; - -typedef struct _OB_CALLBACK_REGISTRATION { - __in USHORT Version; - __in USHORT OperationRegistrationCount; - __in UNICODE_STRING Altitude; - __in PVOID RegistrationContext; - __in OB_OPERATION_REGISTRATION *OperationRegistration; -} OB_CALLBACK_REGISTRATION, *POB_CALLBACK_REGISTRATION; - -#if (NTDDI_VERSION >= NTDDI_VISTASP1) -NTKERNELAPI -NTSTATUS -ObRegisterCallbacks ( - __in POB_CALLBACK_REGISTRATION CallbackRegistration, - __deref_out PVOID *RegistrationHandle - ); - -NTKERNELAPI -VOID -ObUnRegisterCallbacks ( - __in PVOID RegistrationHandle - ); - -NTKERNELAPI -USHORT -ObGetFilterVersion (); -#endif - -#ifndef _PCI_X_ -#define _PCI_X_ - -// -// A PCI driver can read the complete 256 bytes of configuration -// information for any PCI device by calling: -// -// ULONG -// HalGetBusData ( -// __in BUS_DATA_TYPE PCIConfiguration, -// __in ULONG PciBusNumber, -// __in PCI_SLOT_NUMBER VirtualSlotNumber, -// __in PPCI_COMMON_CONFIG &PCIDeviceConfig, -// __in ULONG sizeof (PCIDeviceConfig) -// ); -// -// A return value of 0 means that the specified PCI bus does not exist. -// -// A return value of 2, with a VendorID of PCI_INVALID_VENDORID means -// that the PCI bus does exist, but there is no device at the specified -// VirtualSlotNumber (PCI Device/Function number). -// -// - - - -typedef struct _PCI_SLOT_NUMBER { - union { - struct { - ULONG DeviceNumber:5; - ULONG FunctionNumber:3; - ULONG Reserved:24; - } bits; - ULONG AsULONG; - } u; -} PCI_SLOT_NUMBER, *PPCI_SLOT_NUMBER; - - -#define PCI_TYPE0_ADDRESSES 6 -#define PCI_TYPE1_ADDRESSES 2 -#define PCI_TYPE2_ADDRESSES 5 - -typedef struct _PCI_COMMON_HEADER { - USHORT VendorID; // (ro) - USHORT DeviceID; // (ro) - USHORT Command; // Device control - USHORT Status; - UCHAR RevisionID; // (ro) - UCHAR ProgIf; // (ro) - UCHAR SubClass; // (ro) - UCHAR BaseClass; // (ro) - UCHAR CacheLineSize; // (ro+) - UCHAR LatencyTimer; // (ro+) - UCHAR HeaderType; // (ro) - UCHAR BIST; // Built in self test - - union { - struct _PCI_HEADER_TYPE_0 { - ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; - ULONG CIS; - USHORT SubVendorID; - USHORT SubSystemID; - ULONG ROMBaseAddress; - UCHAR CapabilitiesPtr; - UCHAR Reserved1[3]; - ULONG Reserved2; - UCHAR InterruptLine; // - UCHAR InterruptPin; // (ro) - UCHAR MinimumGrant; // (ro) - UCHAR MaximumLatency; // (ro) - } type0; - - - - // - // PCI to PCI Bridge - // - - struct _PCI_HEADER_TYPE_1 { - ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; - UCHAR PrimaryBus; - UCHAR SecondaryBus; - UCHAR SubordinateBus; - UCHAR SecondaryLatency; - UCHAR IOBase; - UCHAR IOLimit; - USHORT SecondaryStatus; - USHORT MemoryBase; - USHORT MemoryLimit; - USHORT PrefetchBase; - USHORT PrefetchLimit; - ULONG PrefetchBaseUpper32; - ULONG PrefetchLimitUpper32; - USHORT IOBaseUpper16; - USHORT IOLimitUpper16; - UCHAR CapabilitiesPtr; - UCHAR Reserved1[3]; - ULONG ROMBaseAddress; - UCHAR InterruptLine; - UCHAR InterruptPin; - USHORT BridgeControl; - } type1; - - // - // PCI to CARDBUS Bridge - // - - struct _PCI_HEADER_TYPE_2 { - ULONG SocketRegistersBaseAddress; - UCHAR CapabilitiesPtr; - UCHAR Reserved; - USHORT SecondaryStatus; - UCHAR PrimaryBus; - UCHAR SecondaryBus; - UCHAR SubordinateBus; - UCHAR SecondaryLatency; - struct { - ULONG Base; - ULONG Limit; - } Range[PCI_TYPE2_ADDRESSES-1]; - UCHAR InterruptLine; - UCHAR InterruptPin; - USHORT BridgeControl; - } type2; - - - - } u; - -} PCI_COMMON_HEADER, *PPCI_COMMON_HEADER; - -#ifdef __cplusplus - -typedef struct _PCI_COMMON_CONFIG : PCI_COMMON_HEADER { - UCHAR DeviceSpecific[192]; -} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; - -#else - -typedef struct _PCI_COMMON_CONFIG { - PCI_COMMON_HEADER DUMMYSTRUCTNAME; - UCHAR DeviceSpecific[192]; -} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; - -#endif - -#define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET (PCI_COMMON_CONFIG, DeviceSpecific)) -#define PCI_EXTENDED_CONFIG_LENGTH 0x1000 - -#define PCI_MAX_DEVICES 32 -#define PCI_MAX_FUNCTION 8 -#define PCI_MAX_BRIDGE_NUMBER 0xFF - -#define PCI_INVALID_VENDORID 0xFFFF - -// -// Bit encodings for PCI_COMMON_CONFIG.HeaderType -// - -#define PCI_MULTIFUNCTION 0x80 -#define PCI_DEVICE_TYPE 0x00 -#define PCI_BRIDGE_TYPE 0x01 -#define PCI_CARDBUS_BRIDGE_TYPE 0x02 - -#define PCI_CONFIGURATION_TYPE(PciData) \ - (((PPCI_COMMON_CONFIG)(PciData))->HeaderType & ~PCI_MULTIFUNCTION) - -#define PCI_MULTIFUNCTION_DEVICE(PciData) \ - ((((PPCI_COMMON_CONFIG)(PciData))->HeaderType & PCI_MULTIFUNCTION) != 0) - -// -// Bit encodings for PCI_COMMON_CONFIG.Command -// - -#define PCI_ENABLE_IO_SPACE 0x0001 -#define PCI_ENABLE_MEMORY_SPACE 0x0002 -#define PCI_ENABLE_BUS_MASTER 0x0004 -#define PCI_ENABLE_SPECIAL_CYCLES 0x0008 -#define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010 -#define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020 -#define PCI_ENABLE_PARITY 0x0040 // (ro+) -#define PCI_ENABLE_WAIT_CYCLE 0x0080 // (ro+) -#define PCI_ENABLE_SERR 0x0100 // (ro+) -#define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200 // (ro) -#define PCI_DISABLE_LEVEL_INTERRUPT 0x0400 - -// -// Bit encodings for PCI_COMMON_CONFIG.Status -// - -#define PCI_STATUS_INTERRUPT_PENDING 0x0008 -#define PCI_STATUS_CAPABILITIES_LIST 0x0010 // (ro) -#define PCI_STATUS_66MHZ_CAPABLE 0x0020 // (ro) -#define PCI_STATUS_UDF_SUPPORTED 0x0040 // (ro) -#define PCI_STATUS_FAST_BACK_TO_BACK 0x0080 // (ro) -#define PCI_STATUS_DATA_PARITY_DETECTED 0x0100 -#define PCI_STATUS_DEVSEL 0x0600 // 2 bits wide -#define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800 -#define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000 -#define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000 -#define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000 -#define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000 - -// -// The NT PCI Driver uses a WhichSpace parameter on its CONFIG_READ/WRITE -// routines. The following values are defined- -// - -#define PCI_WHICHSPACE_CONFIG 0x0 -#define PCI_WHICHSPACE_ROM 0x52696350 - -// -// PCI Capability IDs -// - -#define PCI_CAPABILITY_ID_POWER_MANAGEMENT 0x01 -#define PCI_CAPABILITY_ID_AGP 0x02 -#define PCI_CAPABILITY_ID_VPD 0x03 -#define PCI_CAPABILITY_ID_SLOT_ID 0x04 -#define PCI_CAPABILITY_ID_MSI 0x05 -#define PCI_CAPABILITY_ID_CPCI_HOTSWAP 0x06 -#define PCI_CAPABILITY_ID_PCIX 0x07 -#define PCI_CAPABILITY_ID_HYPERTRANSPORT 0x08 -#define PCI_CAPABILITY_ID_VENDOR_SPECIFIC 0x09 -#define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A -#define PCI_CAPABILITY_ID_CPCI_RES_CTRL 0x0B -#define PCI_CAPABILITY_ID_SHPC 0x0C -#define PCI_CAPABILITY_ID_P2P_SSID 0x0D -#define PCI_CAPABILITY_ID_AGP_TARGET 0x0E -#define PCI_CAPABILITY_ID_SECURE 0x0F -#define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10 -#define PCI_CAPABILITY_ID_MSIX 0x11 - -// -// All PCI Capability structures have the following header. -// -// CapabilityID is used to identify the type of the structure (is -// one of the PCI_CAPABILITY_ID values above. -// -// Next is the offset in PCI Configuration space (0x40 - 0xfc) of the -// next capability structure in the list, or 0x00 if there are no more -// entries. -// -typedef struct _PCI_CAPABILITIES_HEADER { - UCHAR CapabilityID; - UCHAR Next; -} PCI_CAPABILITIES_HEADER, *PPCI_CAPABILITIES_HEADER; - -// -// Power Management Capability -// - -typedef struct _PCI_PMC { - UCHAR Version:3; - UCHAR PMEClock:1; - UCHAR Rsvd1:1; - UCHAR DeviceSpecificInitialization:1; - UCHAR Rsvd2:2; - struct _PM_SUPPORT { - UCHAR Rsvd2:1; - UCHAR D1:1; - UCHAR D2:1; - UCHAR PMED0:1; - UCHAR PMED1:1; - UCHAR PMED2:1; - UCHAR PMED3Hot:1; - UCHAR PMED3Cold:1; - } Support; -} PCI_PMC, *PPCI_PMC; - -typedef struct _PCI_PMCSR { - USHORT PowerState:2; - USHORT Rsvd1:6; - USHORT PMEEnable:1; - USHORT DataSelect:4; - USHORT DataScale:2; - USHORT PMEStatus:1; -} PCI_PMCSR, *PPCI_PMCSR; - - -typedef struct _PCI_PMCSR_BSE { - UCHAR Rsvd1:6; - UCHAR D3HotSupportsStopClock:1; // B2_B3# - UCHAR BusPowerClockControlEnabled:1; // BPCC_EN -} PCI_PMCSR_BSE, *PPCI_PMCSR_BSE; - - -typedef struct _PCI_PM_CAPABILITY { - - PCI_CAPABILITIES_HEADER Header; - - // - // Power Management Capabilities (Offset = 2) - // - - union { - PCI_PMC Capabilities; - USHORT AsUSHORT; - } PMC; - - // - // Power Management Control/Status (Offset = 4) - // - - union { - PCI_PMCSR ControlStatus; - USHORT AsUSHORT; - } PMCSR; - - // - // PMCSR PCI-PCI Bridge Support Extensions - // - - union { - PCI_PMCSR_BSE BridgeSupport; - UCHAR AsUCHAR; - } PMCSR_BSE; - - // - // Optional read only 8 bit Data register. Contents controlled by - // DataSelect and DataScale in ControlStatus. - // - - UCHAR Data; - -} PCI_PM_CAPABILITY, *PPCI_PM_CAPABILITY; - - -// -// PCI-X Capability -// - -typedef struct { - - PCI_CAPABILITIES_HEADER Header; - - union { - struct { - USHORT DataParityErrorRecoveryEnable:1; - USHORT EnableRelaxedOrdering:1; - USHORT MaxMemoryReadByteCount:2; - USHORT MaxOutstandingSplitTransactions:3; - USHORT Reserved:9; - } bits; - USHORT AsUSHORT; - } Command; - - union { - struct { - ULONG FunctionNumber:3; - ULONG DeviceNumber:5; - ULONG BusNumber:8; - ULONG Device64Bit:1; - ULONG Capable133MHz:1; - ULONG SplitCompletionDiscarded:1; - ULONG UnexpectedSplitCompletion:1; - ULONG DeviceComplexity:1; - ULONG DesignedMaxMemoryReadByteCount:2; - ULONG DesignedMaxOutstandingSplitTransactions:3; - ULONG DesignedMaxCumulativeReadSize:3; - ULONG ReceivedSplitCompletionErrorMessage:1; - ULONG CapablePCIX266:1; - ULONG CapablePCIX533:1; - } bits; - ULONG AsULONG; - } Status; -} PCI_X_CAPABILITY, *PPCI_X_CAPABILITY; - - -// -// PCI Express Extended Capabilities. -// - -#define PCI_EXPRESS_ADVANCED_ERROR_REPORTING_CAP_ID 0x0001 -#define PCI_EXPRESS_VIRTUAL_CHANNEL_CAP_ID 0x0002 -#define PCI_EXPRESS_DEVICE_SERIAL_NUMBER_CAP_ID 0x0003 -#define PCI_EXPRESS_POWER_BUDGETING_CAP_ID 0x0004 -#define PCI_EXPRESS_RC_LINK_DECLARATION_CAP_ID 0x0005 -#define PCI_EXPRESS_RC_INTERNAL_LINK_CONTROL_CAP_ID 0x0006 -#define PCI_EXPRESS_RC_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_CAP_ID 0x0007 -#define PCI_EXPRESS_MFVC_CAP_ID 0x0008 -#define PCI_EXPRESS_VC_AND_MFVC_CAP_ID 0x0009 -#define PCI_EXPRESS_RCRB_HEADER_CAP_ID 0x000A -#define PCI_EXPRESS_SINGLE_ROOT_IO_VIRTUALIZATION_CAP_ID 0x0010 - -// -// All Enhanced capabilities have the following header. -// - -typedef struct _PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER { - - USHORT CapabilityID; - USHORT Version:4; - USHORT Next:12; - -} PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER, *PPCI_EXPRESS_ENHANCED_CAPABILITY_HEADER; - -// -// Serial Number Capability. -// - -typedef struct _PCI_EXPRESS_SERIAL_NUMBER_CAPABILITY { - - PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; - - ULONG LowSerialNumber; - ULONG HighSerialNumber; - -} PCI_EXPRESS_SERIAL_NUMBER_CAPABILITY, *PPCI_EXPRESS_SERIAL_NUMBER_CAPABILITY; - -// -// PCI Express Advanced Error Reporting structures. -// - -typedef union _PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS { - - struct { - ULONG Undefined:1; - ULONG Reserved1:3; - ULONG DataLinkProtocolError:1; - ULONG SurpriseDownError:1; - ULONG Reserved2:6; - ULONG PoisonedTLP:1; - ULONG FlowControlProtocolError:1; - ULONG CompletionTimeout:1; - ULONG CompleterAbort:1; - ULONG UnexpectedCompletion:1; - ULONG ReceiverOverflow:1; - ULONG MalformedTLP:1; - ULONG ECRCError:1; - ULONG UnsupportedRequestError:1; - ULONG Reserved3:11; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS, *PPCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS; - -typedef union _PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK { - - struct { - ULONG Undefined:1; - ULONG Reserved1:3; - ULONG DataLinkProtocolError:1; - ULONG SurpriseDownError:1; - ULONG Reserved2:6; - ULONG PoisonedTLP:1; - ULONG FlowControlProtocolError:1; - ULONG CompletionTimeout:1; - ULONG CompleterAbort:1; - ULONG UnexpectedCompletion:1; - ULONG ReceiverOverflow:1; - ULONG MalformedTLP:1; - ULONG ECRCError:1; - ULONG UnsupportedRequestError:1; - ULONG Reserved3:11; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK, *PPCI_EXPRESS_UNCORRECTABLE_ERROR_MASK; - -typedef union _PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY { - - struct { - ULONG Undefined:1; - ULONG Reserved1:3; - ULONG DataLinkProtocolError:1; - ULONG SurpriseDownError:1; - ULONG Reserved2:6; - ULONG PoisonedTLP:1; - ULONG FlowControlProtocolError:1; - ULONG CompletionTimeout:1; - ULONG CompleterAbort:1; - ULONG UnexpectedCompletion:1; - ULONG ReceiverOverflow:1; - ULONG MalformedTLP:1; - ULONG ECRCError:1; - ULONG UnsupportedRequestError:1; - ULONG Reserved3:11; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY, *PPCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY; - -typedef union _PCI_EXPRESS_CORRECTABLE_ERROR_STATUS { - - struct { - ULONG ReceiverError:1; - ULONG Reserved1:5; - ULONG BadTLP:1; - ULONG BadDLLP:1; - ULONG ReplayNumRollover:1; - ULONG Reserved2:3; - ULONG ReplayTimerTimeout:1; - ULONG AdvisoryNonFatalError:1; - ULONG Reserved3:18; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_CORRECTABLE_ERROR_STATUS, *PPCI_CORRECTABLE_ERROR_STATUS; - -typedef union _PCI_EXPRESS_CORRECTABLE_ERROR_MASK { - - struct { - ULONG ReceiverError:1; - ULONG Reserved1:5; - ULONG BadTLP:1; - ULONG BadDLLP:1; - ULONG ReplayNumRollover:1; - ULONG Reserved2:3; - ULONG ReplayTimerTimeout:1; - ULONG AdvisoryNonFatalError:1; - ULONG Reserved3:18; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_CORRECTABLE_ERROR_MASK, *PPCI_CORRECTABLE_ERROR_MASK; - -typedef union _PCI_EXPRESS_AER_CAPABILITIES { - - struct { - ULONG FirstErrorPointer:5; - ULONG ECRCGenerationCapable:1; - ULONG ECRCGenerationEnable:1; - ULONG ECRCCheckCapable:1; - ULONG ECRCCheckEnable:1; - ULONG Reserved:23; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_AER_CAPABILITIES, *PPCI_EXPRESS_AER_CAPABILITIES; - -typedef union _PCI_EXPRESS_ROOT_ERROR_COMMAND { - - struct { - ULONG CorrectableErrorReportingEnable:1; - ULONG NonFatalErrorReportingEnable:1; - ULONG FatalErrorReportingEnable:1; - ULONG Reserved:29; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_ROOT_ERROR_COMMAND, *PPCI_EXPRESS_ROOT_ERROR_COMMAND; - -typedef union _PCI_EXPRESS_ROOT_ERROR_STATUS { - - struct { - ULONG CorrectableErrorReceived:1; - ULONG MultipleCorrectableErrorsReceived:1; - ULONG UncorrectableErrorReceived:1; - ULONG MultipleUncorrectableErrorsReceived:1; - ULONG FirstUncorrectableFatal:1; - ULONG NonFatalErrorMessagesReceived:1; - ULONG FatalErrorMessagesReceived:1; - ULONG Reserved:20; - ULONG AdvancedErrorInterruptMessageNumber:5; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_ROOT_ERROR_STATUS, *PPCI_EXPRESS_ROOT_ERROR_STATUS; - -typedef union _PCI_EXPRESS_ERROR_SOURCE_ID { - - struct { - USHORT CorrectableSourceIdFun:3; - USHORT CorrectableSourceIdDev:5; - USHORT CorrectableSourceIdBus:8; - USHORT UncorrectableSourceIdFun:3; - USHORT UncorrectableSourceIdDev:5; - USHORT UncorrectableSourceIdBus:8; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_ERROR_SOURCE_ID, *PPCI_EXPRESS_ERROR_SOURCE_ID; - -typedef union _PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS { - - struct { - ULONG TargetAbortOnSplitCompletion:1; - ULONG MasterAbortOnSplitCompletion:1; - ULONG ReceivedTargetAbort:1; - ULONG ReceivedMasterAbort:1; - ULONG RsvdZ:1; - ULONG UnexpectedSplitCompletionError:1; - ULONG UncorrectableSplitCompletion:1; - ULONG UncorrectableDataError:1; - ULONG UncorrectableAttributeError:1; - ULONG UncorrectableAddressError:1; - ULONG DelayedTransactionDiscardTimerExpired:1; - ULONG PERRAsserted:1; - ULONG SERRAsserted:1; - ULONG InternalBridgeError:1; - ULONG Reserved:18; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS, - *PPCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS; - -typedef union _PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK { - - struct { - ULONG TargetAbortOnSplitCompletion:1; - ULONG MasterAbortOnSplitCompletion:1; - ULONG ReceivedTargetAbort:1; - ULONG ReceivedMasterAbort:1; - ULONG RsvdZ:1; - ULONG UnexpectedSplitCompletionError:1; - ULONG UncorrectableSplitCompletion:1; - ULONG UncorrectableDataError:1; - ULONG UncorrectableAttributeError:1; - ULONG UncorrectableAddressError:1; - ULONG DelayedTransactionDiscardTimerExpired:1; - ULONG PERRAsserted:1; - ULONG SERRAsserted:1; - ULONG InternalBridgeError:1; - ULONG Reserved:18; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK, - *PPCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK; - -typedef union _PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY { - - struct { - ULONG TargetAbortOnSplitCompletion:1; - ULONG MasterAbortOnSplitCompletion:1; - ULONG ReceivedTargetAbort:1; - ULONG ReceivedMasterAbort:1; - ULONG RsvdZ:1; - ULONG UnexpectedSplitCompletionError:1; - ULONG UncorrectableSplitCompletion:1; - ULONG UncorrectableDataError:1; - ULONG UncorrectableAttributeError:1; - ULONG UncorrectableAddressError:1; - ULONG DelayedTransactionDiscardTimerExpired:1; - ULONG PERRAsserted:1; - ULONG SERRAsserted:1; - ULONG InternalBridgeError:1; - ULONG Reserved:18; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY, - *PPCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY; - -typedef union _PCI_EXPRESS_SEC_AER_CAPABILITIES { - - struct { - ULONG SecondaryUncorrectableFirstErrorPtr:5; - ULONG Reserved:27; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SEC_AER_CAPABILITIES, *PPCI_EXPRESS_SEC_AER_CAPABILITIES; - -#define ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING 0x00000001 -#define ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING 0x00000002 -#define ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING 0x00000004 - -#define ROOT_CMD_ERROR_REPORTING_ENABLE_MASK \ - (ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING | \ - ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING | \ - ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING) - -// -// Advanced Error Reporting Capability structure. -// - -typedef struct _PCI_EXPRESS_AER_CAPABILITY { - - PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; - - PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS UncorrectableErrorStatus; - PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK UncorrectableErrorMask; - PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY UncorrectableErrorSeverity; - PCI_EXPRESS_CORRECTABLE_ERROR_STATUS CorrectableErrorStatus; - PCI_EXPRESS_CORRECTABLE_ERROR_MASK CorrectableErrorMask; - PCI_EXPRESS_AER_CAPABILITIES CapabilitiesAndControl; - ULONG HeaderLog[4]; - PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS SecUncorrectableErrorStatus; - PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK SecUncorrectableErrorMask; - PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY SecUncorrectableErrorSeverity; - PCI_EXPRESS_SEC_AER_CAPABILITIES SecCapabilitiesAndControl; - ULONG SecHeaderLog[4]; - -} PCI_EXPRESS_AER_CAPABILITY, *PPCI_EXPRESS_AER_CAPABILITY; - -// -// Advanced Error Reporting Capability structure for root port. -// - -typedef struct _PCI_EXPRESS_ROOTPORT_AER_CAPABILITY { - - PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; - - PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS UncorrectableErrorStatus; - PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK UncorrectableErrorMask; - PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY UncorrectableErrorSeverity; - PCI_EXPRESS_CORRECTABLE_ERROR_STATUS CorrectableErrorStatus; - PCI_EXPRESS_CORRECTABLE_ERROR_MASK CorrectableErrorMask; - PCI_EXPRESS_AER_CAPABILITIES CapabilitiesAndControl; - ULONG HeaderLog[4]; - PCI_EXPRESS_ROOT_ERROR_COMMAND RootErrorCommand; - PCI_EXPRESS_ROOT_ERROR_STATUS RootErrorStatus; - PCI_EXPRESS_ERROR_SOURCE_ID ErrorSourceId; - -} PCI_EXPRESS_ROOTPORT_AER_CAPABILITY, *PPCI_EXPRESS_ROOTPORT_AER_CAPABILITY; - -// -// Advanced Error Reporting Capability structure for root port. -// - -typedef struct _PCI_EXPRESS_BRIDGE_AER_CAPABILITY { - - PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; - - PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS UncorrectableErrorStatus; - PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK UncorrectableErrorMask; - PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY UncorrectableErrorSeverity; - PCI_EXPRESS_CORRECTABLE_ERROR_STATUS CorrectableErrorStatus; - PCI_EXPRESS_CORRECTABLE_ERROR_MASK CorrectableErrorMask; - PCI_EXPRESS_AER_CAPABILITIES CapabilitiesAndControl; - ULONG HeaderLog[4]; - PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS SecUncorrectableErrorStatus; - PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK SecUncorrectableErrorMask; - PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY SecUncorrectableErrorSeverity; - PCI_EXPRESS_SEC_AER_CAPABILITIES SecCapabilitiesAndControl; - ULONG SecHeaderLog[4]; - -} PCI_EXPRESS_BRIDGE_AER_CAPABILITY, *PPCI_EXPRESS_BRIDGE_AER_CAPABILITY; - -// -// Single-Root I/O Virtualization Capability structure for endpoints -// - -typedef union _PCI_EXPRESS_SRIOV_CAPS { - - struct { - ULONG VFMigrationCapable:1; - ULONG Reserved1:20; - ULONG VFMigrationInterruptNumber:11; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SRIOV_CAPS, *PPCI_EXPRESS_SRIOV_CAPS; - -typedef union _PCI_EXPRESS_SRIOV_CONTROL { - - struct { - USHORT VFEnable:1; - USHORT VFMigrationEnable:1; - USHORT VFMigrationInterruptEnable:1; - USHORT VFMemorySpaceEnable:1; - USHORT ARICapableHierarchy:1; - USHORT Reserved1:11; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_SRIOV_CONTROL, *PPCI_EXPRESS_SRIOV_CONTROL; - -typedef union _PCI_EXPRESS_SRIOV_STATUS { - - struct { - USHORT VFMigrationStatus:1; - USHORT Reserved1:15; - } DUMMYSTRUCTNAME; - - USHORT AsUSHORT; - -} PCI_EXPRESS_SRIOV_STATUS, *PPCI_EXPRESS_SRIOV_STATUS; - -typedef union _PCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY { - - struct { - ULONG VFMigrationStateBIR:3; - ULONG VFMigrationStateOffset:29; - } DUMMYSTRUCTNAME; - - ULONG AsULONG; - -} PCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY, *PPCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY; - -typedef struct _PCI_EXPRESS_SRIOV_CAPABILITY { - - PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header; - - PCI_EXPRESS_SRIOV_CAPS SRIOVCapabilities; - PCI_EXPRESS_SRIOV_CONTROL SRIOVControl; - PCI_EXPRESS_SRIOV_STATUS SRIOVStatus; - USHORT InitialVFs; - USHORT TotalVFs; - USHORT NumVFs; - UCHAR FunctionDependencyLink; - UCHAR RsvdP1; - USHORT FirstVFOffset; - USHORT VFStride; - USHORT RsvdP2; - USHORT VFDeviceId; - ULONG SupportedPageSizes; - ULONG SystemPageSize; - ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; - PCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY VFMigrationStateArrayOffset; - -} PCI_EXPRESS_SRIOV_CAPABILITY, *PPCI_EXPRESS_SRIOV_CAPABILITY; - -// -// Base Class Code encodings for Base Class (from PCI spec rev 2.1). -// - -#define PCI_CLASS_PRE_20 0x00 -#define PCI_CLASS_MASS_STORAGE_CTLR 0x01 -#define PCI_CLASS_NETWORK_CTLR 0x02 -#define PCI_CLASS_DISPLAY_CTLR 0x03 -#define PCI_CLASS_MULTIMEDIA_DEV 0x04 -#define PCI_CLASS_MEMORY_CTLR 0x05 -#define PCI_CLASS_BRIDGE_DEV 0x06 -#define PCI_CLASS_SIMPLE_COMMS_CTLR 0x07 -#define PCI_CLASS_BASE_SYSTEM_DEV 0x08 -#define PCI_CLASS_INPUT_DEV 0x09 -#define PCI_CLASS_DOCKING_STATION 0x0a -#define PCI_CLASS_PROCESSOR 0x0b -#define PCI_CLASS_SERIAL_BUS_CTLR 0x0c -#define PCI_CLASS_WIRELESS_CTLR 0x0d -#define PCI_CLASS_INTELLIGENT_IO_CTLR 0x0e -#define PCI_CLASS_SATELLITE_COMMS_CTLR 0x0f -#define PCI_CLASS_ENCRYPTION_DECRYPTION 0x10 -#define PCI_CLASS_DATA_ACQ_SIGNAL_PROC 0x11 - -// 0d thru fe reserved - -#define PCI_CLASS_NOT_DEFINED 0xff - -// -// Sub Class Code encodings (PCI rev 2.1). -// - -// Class 00 - PCI_CLASS_PRE_20 - -#define PCI_SUBCLASS_PRE_20_NON_VGA 0x00 -#define PCI_SUBCLASS_PRE_20_VGA 0x01 - -// Class 01 - PCI_CLASS_MASS_STORAGE_CTLR - -#define PCI_SUBCLASS_MSC_SCSI_BUS_CTLR 0x00 -#define PCI_SUBCLASS_MSC_IDE_CTLR 0x01 -#define PCI_SUBCLASS_MSC_FLOPPY_CTLR 0x02 -#define PCI_SUBCLASS_MSC_IPI_CTLR 0x03 -#define PCI_SUBCLASS_MSC_RAID_CTLR 0x04 -#define PCI_SUBCLASS_MSC_OTHER 0x80 - -// Class 02 - PCI_CLASS_NETWORK_CTLR - -#define PCI_SUBCLASS_NET_ETHERNET_CTLR 0x00 -#define PCI_SUBCLASS_NET_TOKEN_RING_CTLR 0x01 -#define PCI_SUBCLASS_NET_FDDI_CTLR 0x02 -#define PCI_SUBCLASS_NET_ATM_CTLR 0x03 -#define PCI_SUBCLASS_NET_ISDN_CTLR 0x04 -#define PCI_SUBCLASS_NET_OTHER 0x80 - -// Class 03 - PCI_CLASS_DISPLAY_CTLR - -// N.B. Sub Class 00 could be VGA or 8514 depending on Interface byte - -#define PCI_SUBCLASS_VID_VGA_CTLR 0x00 -#define PCI_SUBCLASS_VID_XGA_CTLR 0x01 -#define PCI_SUBLCASS_VID_3D_CTLR 0x02 -#define PCI_SUBCLASS_VID_OTHER 0x80 - -// Class 04 - PCI_CLASS_MULTIMEDIA_DEV - -#define PCI_SUBCLASS_MM_VIDEO_DEV 0x00 -#define PCI_SUBCLASS_MM_AUDIO_DEV 0x01 -#define PCI_SUBCLASS_MM_TELEPHONY_DEV 0x02 -#define PCI_SUBCLASS_MM_OTHER 0x80 - -// Class 05 - PCI_CLASS_MEMORY_CTLR - -#define PCI_SUBCLASS_MEM_RAM 0x00 -#define PCI_SUBCLASS_MEM_FLASH 0x01 -#define PCI_SUBCLASS_MEM_OTHER 0x80 - -// Class 06 - PCI_CLASS_BRIDGE_DEV - -#define PCI_SUBCLASS_BR_HOST 0x00 -#define PCI_SUBCLASS_BR_ISA 0x01 -#define PCI_SUBCLASS_BR_EISA 0x02 -#define PCI_SUBCLASS_BR_MCA 0x03 -#define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04 -#define PCI_SUBCLASS_BR_PCMCIA 0x05 -#define PCI_SUBCLASS_BR_NUBUS 0x06 -#define PCI_SUBCLASS_BR_CARDBUS 0x07 -#define PCI_SUBCLASS_BR_RACEWAY 0x08 -#define PCI_SUBCLASS_BR_OTHER 0x80 - -// Class 07 - PCI_CLASS_SIMPLE_COMMS_CTLR - -// N.B. Sub Class 00 and 01 additional info in Interface byte - -#define PCI_SUBCLASS_COM_SERIAL 0x00 -#define PCI_SUBCLASS_COM_PARALLEL 0x01 -#define PCI_SUBCLASS_COM_MULTIPORT 0x02 -#define PCI_SUBCLASS_COM_MODEM 0x03 -#define PCI_SUBCLASS_COM_OTHER 0x80 - -// Class 08 - PCI_CLASS_BASE_SYSTEM_DEV - -// N.B. See Interface byte for additional info. - -#define PCI_SUBCLASS_SYS_INTERRUPT_CTLR 0x00 -#define PCI_SUBCLASS_SYS_DMA_CTLR 0x01 -#define PCI_SUBCLASS_SYS_SYSTEM_TIMER 0x02 -#define PCI_SUBCLASS_SYS_REAL_TIME_CLOCK 0x03 -#define PCI_SUBCLASS_SYS_GEN_HOTPLUG_CTLR 0x04 -#define PCI_SUBCLASS_SYS_SDIO_CTRL 0x05 -#define PCI_SUBCLASS_SYS_OTHER 0x80 - -// Class 09 - PCI_CLASS_INPUT_DEV - -#define PCI_SUBCLASS_INP_KEYBOARD 0x00 -#define PCI_SUBCLASS_INP_DIGITIZER 0x01 -#define PCI_SUBCLASS_INP_MOUSE 0x02 -#define PCI_SUBCLASS_INP_SCANNER 0x03 -#define PCI_SUBCLASS_INP_GAMEPORT 0x04 -#define PCI_SUBCLASS_INP_OTHER 0x80 - -// Class 0a - PCI_CLASS_DOCKING_STATION - -#define PCI_SUBCLASS_DOC_GENERIC 0x00 -#define PCI_SUBCLASS_DOC_OTHER 0x80 - -// Class 0b - PCI_CLASS_PROCESSOR - -#define PCI_SUBCLASS_PROC_386 0x00 -#define PCI_SUBCLASS_PROC_486 0x01 -#define PCI_SUBCLASS_PROC_PENTIUM 0x02 -#define PCI_SUBCLASS_PROC_ALPHA 0x10 -#define PCI_SUBCLASS_PROC_POWERPC 0x20 -#define PCI_SUBCLASS_PROC_COPROCESSOR 0x40 - -// Class 0c - PCI_CLASS_SERIAL_BUS_CTLR - -#define PCI_SUBCLASS_SB_IEEE1394 0x00 -#define PCI_SUBCLASS_SB_ACCESS 0x01 -#define PCI_SUBCLASS_SB_SSA 0x02 -#define PCI_SUBCLASS_SB_USB 0x03 -#define PCI_SUBCLASS_SB_FIBRE_CHANNEL 0x04 -#define PCI_SUBCLASS_SB_SMBUS 0x05 - -// Class 0d - PCI_CLASS_WIRELESS_CTLR - -#define PCI_SUBCLASS_WIRELESS_IRDA 0x00 -#define PCI_SUBCLASS_WIRELESS_CON_IR 0x01 -#define PCI_SUBCLASS_WIRELESS_RF 0x10 -#define PCI_SUBCLASS_WIRELESS_OTHER 0x80 - -// Class 0e - PCI_CLASS_INTELLIGENT_IO_CTLR - -#define PCI_SUBCLASS_INTIO_I2O 0x00 - -// Class 0f - PCI_CLASS_SATELLITE_CTLR - -#define PCI_SUBCLASS_SAT_TV 0x01 -#define PCI_SUBCLASS_SAT_AUDIO 0x02 -#define PCI_SUBCLASS_SAT_VOICE 0x03 -#define PCI_SUBCLASS_SAT_DATA 0x04 - -// Class 10 - PCI_CLASS_ENCRYPTION_DECRYPTION - -#define PCI_SUBCLASS_CRYPTO_NET_COMP 0x00 -#define PCI_SUBCLASS_CRYPTO_ENTERTAINMENT 0x10 -#define PCI_SUBCLASS_CRYPTO_OTHER 0x80 - -// Class 11 - PCI_CLASS_DATA_ACQ_SIGNAL_PROC - -#define PCI_SUBCLASS_DASP_DPIO 0x00 -#define PCI_SUBCLASS_DASP_OTHER 0x80 - - - -// -// Bit encodes for PCI_COMMON_CONFIG.u.type0.BaseAddresses -// - -#define PCI_ADDRESS_IO_SPACE 0x00000001 // (ro) -#define PCI_ADDRESS_MEMORY_TYPE_MASK 0x00000006 // (ro) -#define PCI_ADDRESS_MEMORY_PREFETCHABLE 0x00000008 // (ro) - -#define PCI_ADDRESS_IO_ADDRESS_MASK 0xfffffffc -#define PCI_ADDRESS_MEMORY_ADDRESS_MASK 0xfffffff0 -#define PCI_ADDRESS_ROM_ADDRESS_MASK 0xfffff800 - -#define PCI_TYPE_32BIT 0 -#define PCI_TYPE_20BIT 2 -#define PCI_TYPE_64BIT 4 - -// -// Bit encodes for PCI_COMMON_CONFIG.u.type0.ROMBaseAddresses -// - -#define PCI_ROMADDRESS_ENABLED 0x00000001 - - -// -// Reference notes for PCI configuration fields: -// -// ro these field are read only. changes to these fields are ignored -// -// ro+ these field are intended to be read only and should be initialized -// by the system to their proper values. However, driver may change -// these settings. -// -// --- -// -// All resources comsumed by a PCI device start as unitialized -// under NT. An uninitialized memory or I/O base address can be -// determined by checking it's corrisponding enabled bit in the -// PCI_COMMON_CONFIG.Command value. An InterruptLine is unitialized -// if it contains the value of -1. -// - - -#endif // _PCI_X_ - - -// -// Device Presence interface -// -#define PCI_DEVICE_PRESENT_INTERFACE_VERSION 1 - -// -// Flags for PCI_DEVICE_PRESENCE_PARAMETERS -// -#define PCI_USE_SUBSYSTEM_IDS 0x00000001 -#define PCI_USE_REVISION 0x00000002 -// The following flags are only valid for IsDevicePresentEx -#define PCI_USE_VENDEV_IDS 0x00000004 -#define PCI_USE_CLASS_SUBCLASS 0x00000008 -#define PCI_USE_PROGIF 0x00000010 -#define PCI_USE_LOCAL_BUS 0x00000020 -#define PCI_USE_LOCAL_DEVICE 0x00000040 - -// -// Search parameters structure for IsDevicePresentEx -// -typedef struct _PCI_DEVICE_PRESENCE_PARAMETERS { - - ULONG Size; - ULONG Flags; - - USHORT VendorID; - USHORT DeviceID; - UCHAR RevisionID; - USHORT SubVendorID; - USHORT SubSystemID; - UCHAR BaseClass; - UCHAR SubClass; - UCHAR ProgIf; - -} PCI_DEVICE_PRESENCE_PARAMETERS, *PPCI_DEVICE_PRESENCE_PARAMETERS; - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -typedef -BOOLEAN -PCI_IS_DEVICE_PRESENT ( - __in USHORT VendorID, - __in USHORT DeviceID, - __in UCHAR RevisionID, - __in USHORT SubVendorID, - __in USHORT SubSystemID, - __in ULONG Flags -); - -typedef PCI_IS_DEVICE_PRESENT *PPCI_IS_DEVICE_PRESENT; - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -typedef -BOOLEAN -PCI_IS_DEVICE_PRESENT_EX ( - __in PVOID Context, - __in PPCI_DEVICE_PRESENCE_PARAMETERS Parameters - ); - -typedef PCI_IS_DEVICE_PRESENT_EX *PPCI_IS_DEVICE_PRESENT_EX; - -typedef struct _PCI_DEVICE_PRESENT_INTERFACE { - // - // generic interface header - // - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - // - // pci device info - // - PPCI_IS_DEVICE_PRESENT IsDevicePresent; - - PPCI_IS_DEVICE_PRESENT_EX IsDevicePresentEx; - -} PCI_DEVICE_PRESENT_INTERFACE, *PPCI_DEVICE_PRESENT_INTERFACE; - -// -// Pci Express Link Quiesce Interface -// - -#define PCI_EXPRESS_LINK_QUIESCENT_INTERFACE_VERSION 1 - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -typedef -NTSTATUS -PCI_EXPRESS_ENTER_LINK_QUIESCENT_MODE ( - __inout PVOID Context - ); - -typedef PCI_EXPRESS_ENTER_LINK_QUIESCENT_MODE *PPCI_EXPRESS_ENTER_LINK_QUIESCENT_MODE; - -__drv_maxIRQL(PASSIVE_LEVEL) -__checkReturn -typedef -NTSTATUS -PCI_EXPRESS_EXIT_LINK_QUIESCENT_MODE ( - __inout PVOID Context - ); - -typedef PCI_EXPRESS_EXIT_LINK_QUIESCENT_MODE *PPCI_EXPRESS_EXIT_LINK_QUIESCENT_MODE; - -typedef struct _PCI_EXPRESS_LINK_QUIESCENT_INTERFACE { - - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - PPCI_EXPRESS_ENTER_LINK_QUIESCENT_MODE PciExpressEnterLinkQuiescentMode; - PPCI_EXPRESS_EXIT_LINK_QUIESCENT_MODE PciExpressExitLinkQuiescentMode; - -} PCI_EXPRESS_LINK_QUIESCENT_INTERFACE, *PPCI_EXPRESS_LINK_QUIESCENT_INTERFACE; - -// -// Pci Express Root Port Access Interface -// - -#define PCI_EXPRESS_ROOT_PORT_INTERFACE_VERSION 1 - -typedef -ULONG -(*PPCI_EXPRESS_ROOT_PORT_READ_CONFIG_SPACE) ( - __in PVOID Context, - __out_bcount(Length) PVOID Buffer, - __in ULONG Offset, - __in ULONG Length - ); - -typedef -ULONG -(*PPCI_EXPRESS_ROOT_PORT_WRITE_CONFIG_SPACE) ( - __in PVOID Context, - __in_bcount(Length) PVOID Buffer, - __in ULONG Offset, - __in ULONG Length - ); - -typedef struct _PCI_EXPRESS_ROOT_PORT_INTERFACE { - - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - PPCI_EXPRESS_ROOT_PORT_READ_CONFIG_SPACE ReadConfigSpace; - PPCI_EXPRESS_ROOT_PORT_WRITE_CONFIG_SPACE WriteConfigSpace; - -} PCI_EXPRESS_ROOT_PORT_INTERFACE, *PPCI_EXPRESS_ROOT_PORT_INTERFACE; - -// -// MSI-X interrupt table configuration interface -// - -#define PCI_MSIX_TABLE_CONFIG_INTERFACE_VERSION 1 - -__checkReturn -typedef -NTSTATUS -PCI_MSIX_SET_ENTRY ( - __in PVOID Context, - __in ULONG TableEntry, - __in ULONG MessageNumber - ); - -typedef PCI_MSIX_SET_ENTRY *PPCI_MSIX_SET_ENTRY; - -__checkReturn -typedef -NTSTATUS -PCI_MSIX_MASKUNMASK_ENTRY ( - __in PVOID Context, - __in ULONG TableEntry - ); - -typedef PCI_MSIX_MASKUNMASK_ENTRY *PPCI_MSIX_MASKUNMASK_ENTRY; - -__checkReturn -typedef -NTSTATUS -PCI_MSIX_GET_ENTRY ( - __in PVOID Context, - __in ULONG TableEntry, - __out PULONG MessageNumber, - __out PBOOLEAN Masked - ); - -typedef PCI_MSIX_GET_ENTRY *PPCI_MSIX_GET_ENTRY; - -__checkReturn -typedef -NTSTATUS -PCI_MSIX_GET_TABLE_SIZE ( - __in PVOID Context, - __out PULONG TableSize - ); - -typedef PCI_MSIX_GET_TABLE_SIZE *PPCI_MSIX_GET_TABLE_SIZE; - -typedef struct _PCI_MSIX_TABLE_CONFIG_INTERFACE { - USHORT Size; - USHORT Version; - PVOID Context; - PINTERFACE_REFERENCE InterfaceReference; - PINTERFACE_DEREFERENCE InterfaceDereference; - - PPCI_MSIX_SET_ENTRY SetTableEntry; - PPCI_MSIX_MASKUNMASK_ENTRY MaskTableEntry; - PPCI_MSIX_MASKUNMASK_ENTRY UnmaskTableEntry; - PPCI_MSIX_GET_ENTRY GetTableEntry; - PPCI_MSIX_GET_TABLE_SIZE GetTableSize; -} PCI_MSIX_TABLE_CONFIG_INTERFACE, *PPCI_MSIX_TABLE_CONFIG_INTERFACE; - -#define PCI_MSIX_TABLE_CONFIG_MINIMUM_SIZE \ - RTL_SIZEOF_THROUGH_FIELD(PCI_MSIX_TABLE_CONFIG_INTERFACE, UnmaskTableEntry) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwCreateFile( - __out PHANDLE FileHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_opt PLARGE_INTEGER AllocationSize, - __in ULONG FileAttributes, - __in ULONG ShareAccess, - __in ULONG CreateDisposition, - __in ULONG CreateOptions, - __in_bcount_opt(EaLength) PVOID EaBuffer, - __in ULONG EaLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwOpenFile( - __out PHANDLE FileHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in ULONG ShareAccess, - __in ULONG OpenOptions - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwLoadDriver( - __in PUNICODE_STRING DriverServiceName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwUnloadDriver( - __in PUNICODE_STRING DriverServiceName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwQueryInformationFile( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __out_bcount(Length) PVOID FileInformation, - __in ULONG Length, - __in FILE_INFORMATION_CLASS FileInformationClass - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwSetInformationFile( - __in HANDLE FileHandle, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_bcount(Length) PVOID FileInformation, - __in ULONG Length, - __in FILE_INFORMATION_CLASS FileInformationClass - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwReadFile( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __out_bcount(Length) PVOID Buffer, - __in ULONG Length, - __in_opt PLARGE_INTEGER ByteOffset, - __in_opt PULONG Key - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwWriteFile( - __in HANDLE FileHandle, - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in_bcount(Length) PVOID Buffer, - __in ULONG Length, - __in_opt PLARGE_INTEGER ByteOffset, - __in_opt PULONG Key - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwClose( - __in HANDLE Handle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwCreateDirectoryObject( - __out PHANDLE DirectoryHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwMakeTemporaryObject( - __in HANDLE Handle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(APC_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwCreateSection ( - __out PHANDLE SectionHandle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt PLARGE_INTEGER MaximumSize, - __in ULONG SectionPageProtection, - __in ULONG AllocationAttributes, - __in_opt HANDLE FileHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwOpenSection( - __out PHANDLE SectionHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwMapViewOfSection( - __in HANDLE SectionHandle, - __in HANDLE ProcessHandle, - __inout PVOID *BaseAddress, - __in ULONG_PTR ZeroBits, - __in SIZE_T CommitSize, - __inout_opt PLARGE_INTEGER SectionOffset, - __inout PSIZE_T ViewSize, - __in SECTION_INHERIT InheritDisposition, - __in ULONG AllocationType, - __in ULONG Win32Protect - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwUnmapViewOfSection( - __in HANDLE ProcessHandle, - __in_opt PVOID BaseAddress - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwCreateKey( - __out PHANDLE KeyHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __reserved ULONG TitleIndex, - __in_opt PUNICODE_STRING Class, - __in ULONG CreateOptions, - __out_opt PULONG Disposition - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -ZwCreateKeyTransacted( - __out PHANDLE KeyHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __reserved ULONG TitleIndex, - __in_opt PUNICODE_STRING Class, - __in ULONG CreateOptions, - __in HANDLE TransactionHandle, - __out_opt PULONG Disposition - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwOpenKey( - __out PHANDLE KeyHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwOpenKeyEx( - __out PHANDLE KeyHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in ULONG OpenOptions - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwOpenKeyTransacted( - __out PHANDLE KeyHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in HANDLE TransactionHandle - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwOpenKeyTransactedEx( - __out PHANDLE KeyHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in ULONG OpenOptions, - __in HANDLE TransactionHandle - ); -#endif - - - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwDeleteKey( - __in HANDLE KeyHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwDeleteValueKey( - __in HANDLE KeyHandle, - __in PUNICODE_STRING ValueName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when(Length==0, __drv_valueIs(<0)) -__drv_when(Length>0, __drv_valueIs(<0;==0)) -NTSYSAPI -NTSTATUS -NTAPI -ZwEnumerateKey( - __in HANDLE KeyHandle, - __in ULONG Index, - __in KEY_INFORMATION_CLASS KeyInformationClass, - __out_bcount_opt(Length) PVOID KeyInformation, - __in ULONG Length, - __out PULONG ResultLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when(Length==0, __drv_valueIs(<0)) -__drv_when(Length>0, __drv_valueIs(<0;==0)) -NTSYSAPI -NTSTATUS -NTAPI -ZwEnumerateValueKey( - __in HANDLE KeyHandle, - __in ULONG Index, - __in KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, - __out_bcount_opt(Length) PVOID KeyValueInformation, - __in ULONG Length, - __out PULONG ResultLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwFlushKey( - __in HANDLE KeyHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwNotifyChangeMultipleKeys( - __in HANDLE MasterKeyHandle, - __in_opt ULONG Count, - __in_ecount_opt(Count) OBJECT_ATTRIBUTES SubordinateObjects[], - __in_opt HANDLE Event, - __in_opt PIO_APC_ROUTINE ApcRoutine, - __in_opt PVOID ApcContext, - __out PIO_STATUS_BLOCK IoStatusBlock, - __in ULONG CompletionFilter, - __in BOOLEAN WatchTree, - __out_bcount_opt(BufferSize) PVOID Buffer, - __in ULONG BufferSize, - __in BOOLEAN Asynchronous - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwQueryMultipleValueKey( - __in HANDLE KeyHandle, - __inout_ecount(EntryCount) PKEY_VALUE_ENTRY ValueEntries, - __in ULONG EntryCount, - __out_bcount(*BufferLength) PVOID ValueBuffer, - __inout PULONG BufferLength, - __out_opt PULONG RequiredBufferLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when(Length==0, __drv_valueIs(<0)) -__drv_when(Length>0, __drv_valueIs(<0;==0)) -NTSYSAPI -NTSTATUS -NTAPI -ZwQueryKey( - __in HANDLE KeyHandle, - __in KEY_INFORMATION_CLASS KeyInformationClass, - __out_bcount_opt(Length) PVOID KeyInformation, - __in ULONG Length, - __out PULONG ResultLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_when(Length==0, __drv_valueIs(<0)) -__drv_when(Length>0, __drv_valueIs(<0;==0)) -NTSYSAPI -NTSTATUS -NTAPI -ZwQueryValueKey( - __in HANDLE KeyHandle, - __in PUNICODE_STRING ValueName, - __in KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, - __out_bcount_opt(Length) PVOID KeyValueInformation, - __in ULONG Length, - __out PULONG ResultLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwRenameKey( - __in HANDLE KeyHandle, - __in PUNICODE_STRING NewName - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwSetInformationKey( - __in HANDLE KeyHandle, - __in KEY_SET_INFORMATION_CLASS KeySetInformationClass, - __in_bcount(KeySetInformationLength) PVOID KeySetInformation, - __in ULONG KeySetInformationLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwSetValueKey( - __in HANDLE KeyHandle, - __in PUNICODE_STRING ValueName, - __in_opt ULONG TitleIndex, - __in ULONG Type, - __in_bcount_opt(DataSize) PVOID Data, - __in ULONG DataSize - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwOpenSymbolicLinkObject( - __out PHANDLE LinkHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwQuerySymbolicLinkObject( - __in HANDLE LinkHandle, - __inout PUNICODE_STRING LinkTarget, - __out_opt PULONG ReturnedLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwCreateTransactionManager ( - __out PHANDLE TmHandle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt PUNICODE_STRING LogFileName, - __in_opt ULONG CreateOptions, - __in_opt ULONG CommitStrength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwOpenTransactionManager ( - __out PHANDLE TmHandle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt PUNICODE_STRING LogFileName, - __in_opt LPGUID TmIdentity, - __in_opt ULONG OpenOptions - ); -#endif - - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwRollforwardTransactionManager ( - __in HANDLE TransactionManagerHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwRecoverTransactionManager ( - __in HANDLE TransactionManagerHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwQueryInformationTransactionManager ( - __in HANDLE TransactionManagerHandle, - __in TRANSACTIONMANAGER_INFORMATION_CLASS TransactionManagerInformationClass, - __out_bcount(TransactionManagerInformationLength) PVOID TransactionManagerInformation, - __in ULONG TransactionManagerInformationLength, - __out_opt PULONG ReturnLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwSetInformationTransactionManager ( - __in HANDLE TmHandle, - __in TRANSACTIONMANAGER_INFORMATION_CLASS TransactionManagerInformationClass, - __in PVOID TransactionManagerInformation, - __in ULONG TransactionManagerInformationLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwEnumerateTransactionObject ( - __in_opt HANDLE RootObjectHandle, - __in KTMOBJECT_TYPE QueryType, - __inout_bcount(ObjectCursorLength) PKTMOBJECT_CURSOR ObjectCursor, - __in ULONG ObjectCursorLength, - __out PULONG ReturnLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwCreateTransaction ( - __out PHANDLE TransactionHandle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt LPGUID Uow, - __in_opt HANDLE TmHandle, - __in_opt ULONG CreateOptions, - __in_opt ULONG IsolationLevel, - __in_opt ULONG IsolationFlags, - __in_opt PLARGE_INTEGER Timeout, - __in_opt PUNICODE_STRING Description - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwOpenTransaction ( - __out PHANDLE TransactionHandle, - __in ACCESS_MASK DesiredAccess, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in LPGUID Uow, - __in_opt HANDLE TmHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwQueryInformationTransaction ( - __in HANDLE TransactionHandle, - __in TRANSACTION_INFORMATION_CLASS TransactionInformationClass, - __out_bcount(TransactionInformationLength) PVOID TransactionInformation, - __in ULONG TransactionInformationLength, - __out_opt PULONG ReturnLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwSetInformationTransaction ( - __in HANDLE TransactionHandle, - __in TRANSACTION_INFORMATION_CLASS TransactionInformationClass, - __in PVOID TransactionInformation, - __in ULONG TransactionInformationLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwCommitTransaction ( - __in HANDLE TransactionHandle, - __in BOOLEAN Wait - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwRollbackTransaction ( - __in HANDLE TransactionHandle, - __in BOOLEAN Wait - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwCreateResourceManager ( - __out PHANDLE ResourceManagerHandle, - __in ACCESS_MASK DesiredAccess, - __in HANDLE TmHandle, - __in_opt LPGUID ResourceManagerGuid, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt ULONG CreateOptions, - __in_opt PUNICODE_STRING Description - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwOpenResourceManager ( - __out PHANDLE ResourceManagerHandle, - __in ACCESS_MASK DesiredAccess, - __in HANDLE TmHandle, - __in LPGUID ResourceManagerGuid, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwRecoverResourceManager ( - __in HANDLE ResourceManagerHandle - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwGetNotificationResourceManager ( - __in HANDLE ResourceManagerHandle, - __out PTRANSACTION_NOTIFICATION TransactionNotification, - __in ULONG NotificationLength, - __in PLARGE_INTEGER Timeout, - __out_opt PULONG ReturnLength, - __in ULONG Asynchronous, - __in_opt ULONG_PTR AsynchronousContext - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwQueryInformationResourceManager ( - __in HANDLE ResourceManagerHandle, - __in RESOURCEMANAGER_INFORMATION_CLASS ResourceManagerInformationClass, - __out_bcount(ResourceManagerInformationLength) PVOID ResourceManagerInformation, - __in ULONG ResourceManagerInformationLength, - __out_opt PULONG ReturnLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwSetInformationResourceManager ( - __in HANDLE ResourceManagerHandle, - __in RESOURCEMANAGER_INFORMATION_CLASS ResourceManagerInformationClass, - __in_bcount(ResourceManagerInformationLength) PVOID ResourceManagerInformation, - __in ULONG ResourceManagerInformationLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwCreateEnlistment ( - __out PHANDLE EnlistmentHandle, - __in ACCESS_MASK DesiredAccess, - __in HANDLE ResourceManagerHandle, - __in HANDLE TransactionHandle, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes, - __in_opt ULONG CreateOptions, - __in NOTIFICATION_MASK NotificationMask, - __in_opt PVOID EnlistmentKey - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwOpenEnlistment ( - __out PHANDLE EnlistmentHandle, - __in ACCESS_MASK DesiredAccess, - __in HANDLE RmHandle, - __in LPGUID EnlistmentGuid, - __in_opt POBJECT_ATTRIBUTES ObjectAttributes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwQueryInformationEnlistment ( - __in HANDLE EnlistmentHandle, - __in ENLISTMENT_INFORMATION_CLASS EnlistmentInformationClass, - __out_bcount(EnlistmentInformationLength) PVOID EnlistmentInformation, - __in ULONG EnlistmentInformationLength, - __out_opt PULONG ReturnLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwSetInformationEnlistment ( - __in HANDLE EnlistmentHandle, - __in ENLISTMENT_INFORMATION_CLASS EnlistmentInformationClass, - __in_bcount(EnlistmentInformationLength) PVOID EnlistmentInformation, - __in ULONG EnlistmentInformationLength - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwRecoverEnlistment ( - __in HANDLE EnlistmentHandle, - __in_opt PVOID EnlistmentKey - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwPrePrepareEnlistment ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwPrepareEnlistment ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwCommitEnlistment ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwRollbackEnlistment ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwPrePrepareComplete ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwPrepareComplete ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwCommitComplete ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwReadOnlyEnlistment ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwRollbackComplete ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwSinglePhaseReject ( - __in HANDLE EnlistmentHandle, - __in_opt PLARGE_INTEGER TmVirtualClock - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2003) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSCALLAPI -NTSTATUS -NTAPI -ZwOpenEvent ( - __out PHANDLE EventHandle, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -NTSYSAPI -NTSTATUS -NTAPI -ZwQueryFullAttributesFile( - __in POBJECT_ATTRIBUTES ObjectAttributes, - __out PFILE_NETWORK_OPEN_INFORMATION FileInformation - ); -#endif - - - -// -// Enum for state of a EM rule -// -typedef -enum { - STATE_FALSE, - STATE_UNKNOWN, - STATE_TRUE -} EM_RULE_STATE, *PEM_RULE_STATE; - -// -// Define the entry data structure -// - -typedef struct _EM_ENTRY_DATA { - PVOID Data; - ULONG DataLength; -} EM_ENTRY_DATA, *PEM_ENTRY_DATA; - -// -// Define the Callback function pointer declaration -// - -__drv_functionClass(EM_CALLBACK_ROUTINE) -__drv_maxIRQL(APC_LEVEL) -__drv_sameIRQL -typedef -EM_RULE_STATE -(EM_CALLBACK_ROUTINE) ( - __in_ecount_opt(NumberofEntries) EM_ENTRY_DATA **InputEntries, - __in ULONG NumberofEntries, - __in_ecount_opt(NumberofStrings) LPCSTR *InputStrings, - __in ULONG NumberofStrings, - __in_ecount_opt(NumberofNumerics) PULONG InputNumerics, - __in ULONG NumberofNumerics, - __in_opt PVOID Context - ); - -typedef EM_CALLBACK_ROUTINE *PEM_CALLBACK_ROUTINE; -typedef PEM_CALLBACK_ROUTINE EM_CALLBACK_FUNC; - -// -// Define the lazy entry registration callback function -// - -__drv_functionClass(EM_LAZYENTRY_CALLBACK_ROUTINE) -__drv_maxIRQL(APC_LEVEL) -__drv_sameIRQL -typedef -VOID -(EM_LAZYENTRY_CALLBACK_ROUTINE) ( - __in LPCGUID EntryGuid, - __in_opt PVOID Context - ); - -typedef EM_LAZYENTRY_CALLBACK_ROUTINE *PEM_LAZYENTRY_CALLBACK_ROUTINE; -typedef PEM_LAZYENTRY_CALLBACK_ROUTINE EM_LAZYENTRY_CALLBACK; - - -// -// Define the Lazy Registration Structure -// - -typedef struct _EM_ENTRY_REGISTRATION { - LPCGUID EntryGuid; - - // - // If LazyEntryCallback is provided, the Entry will be considered lazy - // - - EM_LAZYENTRY_CALLBACK LazyEntryCallback; - PVOID LazyCallbackContext; -} EM_ENTRY_REGISTRATION, *PEM_ENTRY_REGISTRATION; - -// -// Define the Callback registration structure -// - -typedef struct _EM_CALLBACK_REGISTRATION { - LPCGUID CallbackGuid; - EM_CALLBACK_FUNC CallbackFunction; - PVOID Context; -} EM_CALLBACK_REGISTRATION, *PEM_CALLBACK_REGISTRATION; - - -// -// Define client rule notification function -// - -__drv_functionClass(EM_RULE_STATE_NOTIFY_ROUTINE) -__drv_maxIRQL(APC_LEVEL) -__drv_sameIRQL -typedef -VOID -(EM_RULE_STATE_NOTIFY_ROUTINE) ( - __in EM_RULE_STATE State, - __in LPCGUID RuleId, - __in_opt PVOID Context - ); - -typedef EM_RULE_STATE_NOTIFY_ROUTINE *PEM_RULE_STATE_NOTIFY_ROUTINE; -typedef PEM_RULE_STATE_NOTIFY_ROUTINE EM_RULE_STATE_NOTIFY; - - - - -// -// Define client rule notification registration structure -// - -typedef struct _EM_CLIENT_NOTIFICATION_REGISTRATION { - LPCGUID RuleId; - EM_RULE_STATE_NOTIFY RuleNotifyCallback; - PVOID Context; -} EM_CLIENT_NOTIFICATION_REGISTRATION, *PEM_CLIENT_NOTIFICATION_REGISTRATION; - -// -// Em Provider APIs -// - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -EmProviderRegister( - __in PDRIVER_OBJECT DriverObject, - __in_ecount_opt(NumberOfEntry) PEM_ENTRY_REGISTRATION EntryRegistration, - __in ULONG NumberOfEntry, - __in_ecount_opt(NumberOfCallback) PEM_CALLBACK_REGISTRATION CallbackRegistration, - __in ULONG NumberOfCallback, - __out PVOID *ProviderHandle - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -EmProviderDeregister( - __in PVOID ProviderHandle - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -EmProviderRegisterEntry( - __in PVOID ProviderHandle, - __in LPCGUID EntryId, - __in PEM_ENTRY_DATA EntryData, - __out PVOID *EntryHandle - ); - - -__drv_maxIRQL(APC_LEVEL) -VOID -EmProviderDeregisterEntry( - __in PVOID EntryHandle - ); - -// -// Em Client APIs -// - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -EmClientRuleEvaluate( - __in LPCGUID RuleId, - __in_ecount(NumberOfEntries) EM_ENTRY_DATA **InputEntries, - __in ULONG NumberOfEntries, - __out PEM_RULE_STATE State - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -EmClientRuleRegisterNotification( - __in PDRIVER_OBJECT DriverObject, - __in_ecount(NumberOfNotificatoinRegistration) PEM_CLIENT_NOTIFICATION_REGISTRATION RuleNotificationsRegistration, - __in ULONG NumberOfNotificatoinRegistration, - __out PVOID *NotificationHandle - ); - -__drv_maxIRQL(APC_LEVEL) -VOID -EmClientRuleDeregisterNotification( - __in PVOID NotificationHandle - ); - -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -EmClientQueryRuleState( - __in LPCGUID RuleId, - __out PEM_RULE_STATE State - ); - -#ifndef _CLFS_PUBLIC_H_ -#define _CLFS_PUBLIC_H_ -#define CLFSUSER_API - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) - -// -// FILE_ATTRIBUTE_DEDICATED is defined as FILE_ATTRIBUTE_TEMPORARY. -// - -#define FILE_ATTRIBUTE_DEDICATED FILE_ATTRIBUTE_TEMPORARY - -// -// Container name and container size extended attribute entry names. -// - -#define EA_CONTAINER_NAME "ContainerName" -#define EA_CONTAINER_SIZE "ContainerSize" - -// -// Base log file name 3-letter extension. -// - -#define CLFS_BASELOG_EXTENSION L".blf" - -// -// Common log file system public flags and constants. -// - -#define CLFS_FLAG_NO_FLAGS 0x00000000 // No flags. -#define CLFS_FLAG_FORCE_APPEND 0x00000001 // Flag to force an append to log queue -#define CLFS_FLAG_FORCE_FLUSH 0x00000002 // Flag to force a log flush -#define CLFS_FLAG_USE_RESERVATION 0x00000004 // Flag to charge a data append to reservation -#define CLFS_FLAG_REENTRANT_FILE_SYSTEM 0x00000008 // Kernel mode create flag indicating a re-entrant file system. -#define CLFS_FLAG_NON_REENTRANT_FILTER 0x00000010 // Kernel mode create flag indicating non-reentrant filter. -#define CLFS_FLAG_REENTRANT_FILTER 0x00000020 // Kernel mode create flag indicating reentrant filter. -#define CLFS_FLAG_IGNORE_SHARE_ACCESS 0x00000040 // Kernel mode create flag indicating IO_IGNORE_SHARE_ACCESS_CHECK semantics. -#define CLFS_FLAG_READ_IN_PROGRESS 0x00000080 // Flag indicating read in progress and not completed. -#define CLFS_FLAG_MINIFILTER_LEVEL 0x00000100 // Kernel mode create flag indicating mini-filter target. -#define CLFS_FLAG_HIDDEN_SYSTEM_LOG 0x00000200 // Kernel mode create flag indicating the log and containers should be marked hidden & system. - - -// -// Flag indicating all CLFS I/O will be targeted to an intermediate level of the I/O stack -// - -#define CLFS_FLAG_FILTER_INTERMEDIATE_LEVEL CLFS_FLAG_NON_REENTRANT_FILTER - -// -// Flag indicating all CLFS I/O will be targeted to the top level of the I/O stack -// - -#define CLFS_FLAG_FILTER_TOP_LEVEL CLFS_FLAG_REENTRANT_FILTER - -// -// CLFS_CONTAINER_INDEX -// -// Index into the container table. -// - -typedef ULONG CLFS_CONTAINER_ID; -typedef CLFS_CONTAINER_ID *PCLFS_CONTAINER_ID; -typedef CLFS_CONTAINER_ID **PPCLFS_CONTAINER_ID; - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#ifdef __CLFS_PRIVATE_LSN__ - -#include - -#else - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) - -// -// CLS_LSN -// - -typedef struct _CLS_LSN -{ - - ULONGLONG Internal; - -} CLS_LSN, *PCLS_LSN, **PPCLS_LSN; - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#endif /* __CLFS_PRIVATE_LSN__ */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) - -// -// Alias CLS prefixed types with CLFS prefixes. -// - -typedef CLS_LSN CLFS_LSN; -typedef CLFS_LSN *PCLFS_LSN, **PPCLFS_LSN; - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -extern __declspec(dllimport) const CLFS_LSN CLFS_LSN_INVALID; -extern __declspec(dllimport) const CLFS_LSN CLFS_LSN_NULL; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) - -// -// CLS_RECORD_TYPE -// -// Definition of record types. -// - -#ifdef __cplusplus - -const UCHAR ClfsNullRecord = 0x00; // Null record type. -const UCHAR ClfsDataRecord = 0x01; // Client data record. -const UCHAR ClfsRestartRecord = 0x02; // Restart record. - - -// Valid client records are restart and data records. - -const UCHAR ClfsClientRecord = 0x03; - -#else - -#define ClfsNullRecord 0x00 // Null record type. -#define ClfsDataRecord 0x01 // Client data record. -#define ClfsRestartRecord 0x02 // Restart record. - - -// Valid client records are restart and data records. - -#define ClfsClientRecord (ClfsDataRecord|ClfsRestartRecord) - -#endif /* _cplusplus */ - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Log container path prefix indicating the log container's location is -// actually a stream inside of the BLF. -// - -#ifdef _cplusplus - -const LPCWSTR CLFS_CONTAINER_STREAM_PREFIX = L"%BLF%:" - -#else - -#define CLFS_CONTAINER_STREAM_PREFIX L"%BLF%:" - -#endif /* _cplusplus */ - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Log container path prefix indicating the log container's location is -// relative to the base log file (BLF) and not an absolute path. -// Paths which do not being with said prefix are absolute paths. -// - -#ifdef _cplusplus - -const LPCWSTR CLFS_CONTAINER_RELATIVE_PREFIX = L"%BLF%\\" - -#else - -#define CLFS_CONTAINER_RELATIVE_PREFIX L"%BLF%\\" - -#endif /* _cplusplus */ - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Alias CLS prefix with CLFS prefixes. -// - -typedef UCHAR CLS_RECORD_TYPE, *PCLS_RECORD_TYPE, **PPCLS_RECORD_TYPE; -typedef CLS_RECORD_TYPE CLFS_RECORD_TYPE, *PCLFS_RECORD_TYPE, **PPCLFS_RECORD_TYPE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLS_CONTEXT_MODE -// -// The context mode specifies the dirction and access methods used to scan the -// log file. -// - -typedef enum _CLS_CONTEXT_MODE -{ - ClsContextNone = 0x00, - ClsContextUndoNext, - ClsContextPrevious, - ClsContextForward - -} CLS_CONTEXT_MODE, *PCLS_CONTEXT_MODE, **PPCLS_CONTEXT_MODE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef enum _CLFS_CONTEXT_MODE -{ - ClfsContextNone = 0x00, - ClfsContextUndoNext, - ClfsContextPrevious, - ClfsContextForward - -} CLFS_CONTEXT_MODE, *PCLFS_CONTEXT_MODE, **PPCLFS_CONTEXT_MODE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFSD_NODE_ID -// -// Common log file system node identifier. Every CLFS file system -// structure has a node identity and type. The node type is a signature -// field while the size is used in for consistency checking. -// - -typedef struct _CLFS_NODE_ID -{ - ULONG cType; // CLFS node type. - ULONG cbNode; // CLFS node size. - -} CLFS_NODE_ID, *PCLFS_NODE_ID; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLS_WRITE_ENTRY -// -// Write entry specifying the contents of a user buffer and length that are -// marshalled in the space reservation and append interface of the CLS API. -// - -typedef struct _CLS_WRITE_ENTRY -{ - PVOID Buffer; - ULONG ByteLength; -} CLS_WRITE_ENTRY, *PCLS_WRITE_ENTRY, **PPCLS_WRITE_ENTRY; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef CLS_WRITE_ENTRY CLFS_WRITE_ENTRY; -typedef CLFS_WRITE_ENTRY *PCLFS_WRITE_ENTRY, **PPCLFS_WRITE_ENTRY; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_LOG_ID -// -// A log identifier is a GUID that describes uniquely a physical log file. -// - -typedef GUID CLFS_LOG_ID; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_INFORMATION -// -// Logical log file information structure describing either virtual or physical log -// file data, depending on the type of information queried. -// - -typedef struct _CLS_INFORMATION -{ - LONGLONG TotalAvailable; // Total log data space available. - LONGLONG CurrentAvailable; // Useable space in the log file. - LONGLONG TotalReservation; // Space reserved for UNDO's (aggregate for physical log) - ULONGLONG BaseFileSize; // Size of the base log file. - ULONGLONG ContainerSize; // Uniform size of log containers. - ULONG TotalContainers; // Total number of containers. - ULONG FreeContainers; // Number of containers not in active log. - ULONG TotalClients; // Total number of clients. - ULONG Attributes; // Log file attributes. - ULONG FlushThreshold; // Log file flush threshold. - ULONG SectorSize; // Underlying container sector size. - CLS_LSN MinArchiveTailLsn; // Marks the global archive tail. - CLS_LSN BaseLsn; // Start of the active log region. - CLS_LSN LastFlushedLsn; // Last flushed LSN in active log. - CLS_LSN LastLsn; // End of active log region. - CLS_LSN RestartLsn; // Location of restart record. - GUID Identity; // Unique identifier for the log. -} CLS_INFORMATION, *PCLS_INFORMATION, *PPCLS_INFORMATION; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Alias CLS prefixes with CLS prefixes. -// - -typedef CLS_INFORMATION CLFS_INFORMATION; -typedef CLFS_INFORMATION *PCLFS_INFORMATION, *PPCLFS_INFORMATION; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ -/* -// -// CLFS_CLIENT_INFORMATION -// -// The client information structure maintains client-based log metadata. -// - -typedef struct _CLS_CLIENT_INFORMATION -{ - CLS_INFORMATION ClfsInfo; // Contains base log file information. - ULONG ClientAttributes; // Virtual log file attributes. - LONGLONG ClientUndoCommitment; // Max. undo commitment for client. - CLS_LSN ClientArchiveTailLsn; // Marks the client archive tail. - CLS_LSN ClientBaseLsn; // Min. client LSN in active log region. - CLS_LSN ClientLastLsn; // Max. client LSN in active log region. - CLS_LSN ClientRestartLsn; // Location of restart record. - -} CLS_CLIENT_INFORMATION, *PCLS_CLIENT_INFORMATION, **PPCLS_CLIENT_INFORMATION; - -// -// Alias CLS prefixes with CLS prefixes. -// - -typedef CLS_CLIENT_INFORMATION CLFS_CLIENT_INFORMATION; -typedef CLFS_CLIENT_INFORMATION *PCLFS_CLIENT_INFORMATION, *PPCLFS_CLIENT_INFORMATION; -*/ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_LOG_NAME_INFORMATION -// -// The client information structure stores the name of a log. It is used -// to communicate ClfsLogNameInformation and ClfsLogPhysicalNameInformation. -// - -typedef struct _CLFS_LOG_NAME_INFORMATION -{ - - USHORT NameLengthInBytes; - WCHAR Name[1]; - -} CLFS_LOG_NAME_INFORMATION, *PCLFS_LOG_NAME_INFORMATION, **PPCLFS_LOG_NAME_INFORMATION; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_STREAM_ID_INFORMATION -// -// The client information structure provides a permanent identifier unique -// to the log for the stream in question. -// - -typedef struct _CLFS_STREAM_ID_INFORMATION -{ - - UCHAR StreamIdentifier; - -} CLFS_STREAM_ID_INFORMATION, *PCLFS_STREAM_ID_INFORMATION, **PPCLFS_STREAM_ID_INFORMATION; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_VISTA) || (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN) -// -// CLFS_PHYSICAL_LSN_INFORMATION -// -// An information structure that describes a virtual:physical LSN pairing -// for the stream identified in the structure. -// -#pragma pack(push,8) -typedef struct _CLFS_PHYSICAL_LSN_INFORMATION -{ - UCHAR StreamIdentifier; - CLFS_LSN VirtualLsn; - CLFS_LSN PhysicalLsn; - -} CLFS_PHYSICAL_LSN_INFORMATION, *PCLFS_PHYSICAL_LSN_INFORMATION; -#pragma pack(pop) -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLS_CONTAINER_STATE -// -// At any point in time a container could be inactive or unitialized, active, -// pending deletion from the list of free containers, pending archival, or -// pending deletion while waiting to be archived. -// - -typedef UINT32 CLS_CONTAINER_STATE, *PCLS_CONTAINER_STATE, *PPCLS_CONTAINER_STATE; -typedef CLS_CONTAINER_STATE CLFS_CONTAINER_STATE, *PCLFS_CONTAINER_STATE, *PPCLFS_CONTAINER_STATE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#ifdef __cplusplus - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -const CLFS_CONTAINER_STATE ClsContainerInitializing = 0x01; -const CLFS_CONTAINER_STATE ClsContainerInactive = 0x02; -const CLFS_CONTAINER_STATE ClsContainerActive = 0x04; -const CLFS_CONTAINER_STATE ClsContainerActivePendingDelete = 0x08; -const CLFS_CONTAINER_STATE ClsContainerPendingArchive = 0x10; -const CLFS_CONTAINER_STATE ClsContainerPendingArchiveAndDelete = 0x20; - -const CLFS_CONTAINER_STATE ClfsContainerInitializing = 0x01; -const CLFS_CONTAINER_STATE ClfsContainerInactive = 0x02; -const CLFS_CONTAINER_STATE ClfsContainerActive = 0x04; -const CLFS_CONTAINER_STATE ClfsContainerActivePendingDelete = 0x08; -const CLFS_CONTAINER_STATE ClfsContainerPendingArchive = 0x10; -const CLFS_CONTAINER_STATE ClfsContainerPendingArchiveAndDelete= 0x20; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#else - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -#define ClsContainerInitializing 0x01 -#define ClsContainerInactive 0x02 -#define ClsContainerActive 0x04 -#define ClsContainerActivePendingDelete 0x08 -#define ClsContainerPendingArchive 0x10 -#define ClsContainerPendingArchiveAndDelete 0x20 - -#define ClfsContainerInitializing 0x01 -#define ClfsContainerInactive 0x02 -#define ClfsContainerActive 0x04 -#define ClfsContainerActivePendingDelete 0x08 -#define ClfsContainerPendingArchive 0x10 -#define ClfsContainerPendingArchiveAndDelete 0x20 -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#endif /* __cplusplus */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_MAX_CONTAINER_INFO -// -// The maximum length, in bytes, of the FileName field in the CLFS -// container information structure. -// - -#ifdef __cplusplus - -const ULONG CLFS_MAX_CONTAINER_INFO = (256); - -#else - -#define CLFS_MAX_CONTAINER_INFO (256) - -#endif /* __cplusplus */ - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLS_CONTAINER_INFORMATION -// -// This structure defines a container descriptor. The descriptor specifies the -// container's creation and access times, size, file system name, file system -// attributes, state, minimum, and maximum LSNs. -// - -typedef struct _CLS_CONTAINER_INFORMATION -{ - ULONG FileAttributes; // File system attribute flag. - ULONGLONG CreationTime; // File creation time. - ULONGLONG LastAccessTime; // Last time container was read/written. - ULONGLONG LastWriteTime; // Last time container was written. - LONGLONG ContainerSize; // Size of container in bytes. - ULONG FileNameActualLength; // Length of the actual file name. - ULONG FileNameLength; // Length of file name in buffer - WCHAR FileName [CLFS_MAX_CONTAINER_INFO];// File system name for container. - CLFS_CONTAINER_STATE State; // Current state of the container. - CLFS_CONTAINER_ID PhysicalContainerId; // Physical container identifier. - CLFS_CONTAINER_ID LogicalContainerId; // Logical container identifier. - -} CLS_CONTAINER_INFORMATION, *PCLS_CONTAINER_INFORMATION, **PPCLS_CONTAINER_INFORMATION; - -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef CLS_CONTAINER_INFORMATION CLFS_CONTAINER_INFORMATION; -typedef CLFS_CONTAINER_INFORMATION *PCLFS_CONTAINER_INFORMATION, **PPCLFS_CONTAINER_INFORMATION; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_LOG_INFORMATION_CLASS -// -// The information class specifies the kind of information a caller -// wishes to query or set on a log file. -// - -typedef enum _CLS_LOG_INFORMATION_CLASS -{ - - ClfsLogBasicInformation = 0x00, // For virtual or physical logs, indicates the respective basic information. - ClfsLogBasicInformationPhysical, // Always indicates physical log basic information. - ClfsLogPhysicalNameInformation, // Always indicates physical name information. - ClfsLogStreamIdentifierInformation, // Virtual/physical log agnostic. -#if (NTDDI_VERSION >= NTDDI_VISTA) || (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN) - ClfsLogSystemMarkingInformation, // Count of system marking references. - ClfsLogPhysicalLsnInformation // Maps virtual LSNs to physical LSNs; only valid for physical logs. -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -} CLS_LOG_INFORMATION_CLASS, *PCLS_LOG_INFORMATION_CLASS, **PPCLS_LOG_INFORMATION_CLASS; - -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef CLS_LOG_INFORMATION_CLASS CLFS_LOG_INFORMATION_CLASS; -typedef CLFS_LOG_INFORMATION_CLASS *PCLFS_LOG_INFORMATION_CLASS, **PPCLFS_LOG_INFORMATION_CLASS; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLS_IOSTATS_CLASS -// -// Enumerated type defining the class of I/O statistics. -// - -typedef enum _CLS_IOSTATS_CLASS -{ - ClsIoStatsDefault = 0x0000, - ClsIoStatsMax = 0xFFFF - -} CLS_IOSTATS_CLASS, *PCLS_IOSTATS_CLASS, **PPCLS_IOSTATS_CLASS; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_IOSTATS_CLASS -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef enum _CLFS_IOSTATS_CLASS -{ - ClfsIoStatsDefault = 0x0000, - ClfsIoStatsMax = 0xFFFF - -} CLFS_IOSTATS_CLASS, *PCLFS_IOSTATS_CLASS, **PPCLFS_IOSTATS_CLASS; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLS_IO_STATISTICS -// -// This structure defines I/O performance counters particular to a log file. It consists -// of a header followed by the I/O statistics counters. The header is being ignored for -// now. -// - -typedef struct _CLS_IO_STATISTICS_HEADER -{ - UCHAR ubMajorVersion; // Major version of the statistics buffer. - UCHAR ubMinorVersion; // Minor version of the statistics buffer. - CLFS_IOSTATS_CLASS eStatsClass; // I/O statistics class. - USHORT cbLength; // Length of the statistics buffer. - ULONG coffData; // Offset of statistics counters. - -} CLS_IO_STATISTICS_HEADER, *PCLS_IO_STATISTICS_HEADER, **PPCLS_IO_STATISTICS_HEADER; - -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef CLS_IO_STATISTICS_HEADER CLFS_IO_STATISTICS_HEADER; -typedef CLFS_IO_STATISTICS_HEADER *PCLFS_IO_STATISTICS_HEADER, **PPCLFS_IO_STATISTICS_HEADER; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -typedef struct _CLS_IO_STATISTICS -{ - CLS_IO_STATISTICS_HEADER hdrIoStats; // Statistics buffer header. - ULONGLONG cFlush; // Flush count. - ULONGLONG cbFlush; // Cumulative number of bytes flushed. - ULONGLONG cMetaFlush; // Metadata flush count. - ULONGLONG cbMetaFlush; // Cumulative number of metadata bytes flushed. - -} CLS_IO_STATISTICS, *PCLS_IO_STATISTICS, **PPCLS_IO_STATISTICS; - -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef CLS_IO_STATISTICS CLFS_IO_STATISTICS; -typedef CLFS_IO_STATISTICS *PCLFS_IO_STATISTICS, **PPCLFS_IO_STATISTICS; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_SCAN_MODE -// -// Container scan mode flags. -// - -#ifdef __cplusplus - -const UCHAR CLFS_SCAN_INIT = 0x01; -const UCHAR CLFS_SCAN_FORWARD = 0x02; -const UCHAR CLFS_SCAN_BACKWARD = 0x04; -const UCHAR CLFS_SCAN_CLOSE = 0x08; -const UCHAR CLFS_SCAN_INITIALIZED = 0x10; -const UCHAR CLFS_SCAN_BUFFERED = 0x20; - -#else - -#define CLFS_SCAN_INIT 0x01 -#define CLFS_SCAN_FORWARD 0x02 -#define CLFS_SCAN_BACKWARD 0x04 -#define CLFS_SCAN_CLOSE 0x08 -#define CLFS_SCAN_INITIALIZED 0x10 -#define CLFS_SCAN_BUFFERED 0x20 - -#endif - -typedef UCHAR CLFS_SCAN_MODE, *PCLFS_SCAN_MODE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) - -// -// CLFS_SCAN_CONTEXT -// -// Container scan context for scanning all containers in a given physical log -// file. -// - -// -// The log file object wraps an NT file object and the size of the structure. -// The log file object may be modified in the near future and there should be no -// dependencies on the size of the structure itself. -// - -typedef FILE_OBJECT LOG_FILE_OBJECT, *PLOG_FILE_OBJECT, **PPLOG_FILE_OBJECT; - -#if defined(_MSC_VER) -#if (_MSC_VER >= 1200) -#pragma warning(push) -#pragma warning(disable:4324) // structure padded due to __declspec(align()) -#endif -#endif - -typedef struct _CLS_SCAN_CONTEXT -{ - CLFS_NODE_ID cidNode; - PLOG_FILE_OBJECT plfoLog; - __declspec(align(8)) ULONG cIndex; - __declspec(align(8)) ULONG cContainers; - __declspec(align(8)) ULONG cContainersReturned; - __declspec(align(8)) CLFS_SCAN_MODE eScanMode; - __declspec(align(8)) PCLS_CONTAINER_INFORMATION pinfoContainer; - -} CLS_SCAN_CONTEXT, *PCLS_SCAN_CONTEXT, **PPCLS_SCAN_CONTEXT; - -#if defined(_MSC_VER) -#if (_MSC_VER >= 1200) -#pragma warning(pop) -#endif -#endif - -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Alias all CLS prefixes with CLFS prefixes. -// - -typedef CLS_SCAN_CONTEXT CLFS_SCAN_CONTEXT; -typedef CLFS_SCAN_CONTEXT *PCLFS_SCAN_CONTEXT, **PPCLFS_SCAN_CONTEXT; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_ARCHIVE_DESCRIPTOR -// -// Log archive descriptors describe the set of discrete but logically -// contiguous disk extents comprising a snapshot of the active log when -// preparing for archival. Log archive descriptors specify enough information -// for log archive clients directly access the relevant contents of containers -// for archiving and restoring a snapshot of the log. -// - -typedef struct _CLS_ARCHIVE_DESCRIPTOR -{ - ULONGLONG coffLow; - ULONGLONG coffHigh; - CLS_CONTAINER_INFORMATION infoContainer; - -} CLS_ARCHIVE_DESCRIPTOR, *PCLS_ARCHIVE_DESCRIPTOR, **PPCLS_ARCHIVE_DESCRIPTOR; - -// -// Alias CLS prefixes with CLFS prefixes. -// - -typedef CLS_ARCHIVE_DESCRIPTOR CLFS_ARCHIVE_DESCRIPTOR; -typedef CLFS_ARCHIVE_DESCRIPTOR *PCLFS_ARCHIVE_DESCRIPTOR, **PPCLFS_ARCHIVE_DESCRIPTOR; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_ALLOCATION_ROUTINE -// -// Allocate a blocks for marshalled reads or writes -// - -typedef PVOID (* CLFS_BLOCK_ALLOCATION) (ULONG cbBufferLength, PVOID pvUserContext); - -// -// CLFS_DEALLOCATION_ROUTINE -// -// Deallocate buffers allocated by the CLFS_ALLOCATION_ROUTINE. -// - -typedef void (* CLFS_BLOCK_DEALLOCATION) (PVOID pvBuffer, PVOID pvUserContext); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_LOG_ARCHIVE_MODE -// -// Describes the archive support behavior for the log. -// - -typedef enum _CLFS_LOG_ARCHIVE_MODE -{ - - ClfsLogArchiveEnabled = 0x01, - ClfsLogArchiveDisabled = 0x02 - -} CLFS_LOG_ARCHIVE_MODE, *PCLFS_LOG_ARCHIVE_MODE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -//----------------------------------------------------------------------------- -// LSN OPERATORS -//----------------------------------------------------------------------------- - -#ifdef __cplusplus -extern "C" -{ -#endif - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnEqual -// -// Method Description: -// -// Check for the equivalence of LSNs. -// -// Arguments: -// -// plsn1 -- first LSN comparator -// plsn2 -- second LSN comparator -// -// -// Return Value: -// -// TRUE if LSN values are equivalent and FALSE otherwise. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API BOOLEAN NTAPI -ClfsLsnEqual -( - __in const CLFS_LSN* plsn1, - __in const CLFS_LSN* plsn2 -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnLess -// -// Method Description: -// -// Check if LSN1 is less than LSN2. -// -// Arguments: -// -// plsn1 -- first LSN comparator -// plsn2 -- second LSN comparator -// -// -// Return Value: -// -// TRUE if LSN1 is less than LSN2 and FALSE otherwise. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API BOOLEAN NTAPI -ClfsLsnLess -( - __in const CLFS_LSN* plsn1, - __in const CLFS_LSN* plsn2 -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnGreater -// -// Method Description: -// -// Check if LSN1 is greater than LSN2. -// -// Arguments: -// -// plsn1 -- first LSN comparator -// plsn2 -- second LSN comparator -// -// -// Return Value: -// -// TRUE if LSN1 is greater than LSN2 and FALSE otherwise. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API BOOLEAN NTAPI -ClfsLsnGreater -( - __in const CLFS_LSN* plsn1, - __in const CLFS_LSN* plsn2 -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnNull (Inline) -// -// Method Description: -// -// Check whether or not an LSN is CLFS_LSN_NULL. -// -// Arguments: -// -// plsn -- reference to LSN tested against the NULL value. -// -// -// Return Value: -// -// TRUE if and only if an LSN is equivalent to CLFS_LSN_NULL. -// LSNs with the value CLFS_LSN_INVALID will return FALSE. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API BOOLEAN NTAPI -ClfsLsnNull -( - __in const CLFS_LSN* plsn -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnContainer (Inline) -// -// Routine Description: -// -// Extract the container identifier from the LSN. -// -// Arguments: -// -// plsn -- get block offset from this LSN -// -// Return Value: -// -// Returns the container identifier for the LSN. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API CLFS_CONTAINER_ID NTAPI -ClfsLsnContainer -( - __in const CLFS_LSN* plsn -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnCreate (Inline) -// -// Routine Description: -// -// Create an LSN given a log identifier, a container identifier, a block -// offset and a bucket identifier. Caller must test for invalid LSN after -// making this call. -// -// Arguments: -// -// cidContainer -- container identifier -// offBlock -- block offset -// cRecord -- ordinal number of the record in block -// -// Return Value: -// -// Returns a valid LSN if successful, otherwise it returns -// CLFS_LSN_INVALID -// -//----------------------------------------------------------------------------- - -CLFSUSER_API CLFS_LSN NTAPI -ClfsLsnCreate -( - __in CLFS_CONTAINER_ID cidContainer, - __in ULONG offBlock, - __in ULONG cRecord -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnBlockOffset (Inline) -// -// Routine Description: -// -// Extract the block offset from the LSN. -// -// Arguments: -// -// plsn -- get block offset from this LSN -// -// Return Value: -// -// Returns the block offset for the LSN. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API ULONG NTAPI -ClfsLsnBlockOffset -( - __in const CLFS_LSN* plsn -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnRecordSequence (Inline) -// -// Routine Description: -// -// Extract the bucket identifier from the LSN. -// -// Arguments: -// -// plsn -- get block offset from this LSN -// -// Return Value: -// -// Returns the bucket identifier for the LSN. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API ULONG NTAPI -ClfsLsnRecordSequence -( - __in const CLFS_LSN* plsn -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnInvalid -// -// Method Description: -// -// Check whether or not an LSN is CLFS_LSN_INVALID. -// -// Arguments: -// -// plsn -- reference to LSN tested against CLFS_LSN_INVALID. -// -// -// Return Value: -// -// TRUE if and only if an LSN is equivalent to CLFS_LSN_INVALID. -// LSNs with the value CLFS_LSN_NULL will return FALSE. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API BOOLEAN NTAPI -ClfsLsnInvalid -( - __in const CLFS_LSN* plsn -); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -//----------------------------------------------------------------------------- -// ClfsLsnIncrement -// -// Method Description: -// -// Increment and LSN by 1 -// -// Arguments: -// -// plsn -- LSN to be incremented. -// -// -// Return Value: -// -// A valid LSN next in sequence to the input LSN, if successful. -// Otherwise, this function returns CLFS_LSN_INVALID. -// -//----------------------------------------------------------------------------- - -CLFSUSER_API CLFS_LSN NTAPI -ClfsLsnIncrement (__in PCLFS_LSN plsn); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus - -#ifdef CLFS_OPERATORS - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// LSN arithmetic increment operator. -// - -inline CLFS_LSN -operator++ -( - __inout CLFS_LSN& refLsn -) -{ - // - // Prefix increment operator. - // - - refLsn = ClfsLsnIncrement (&refLsn); - return refLsn; -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// BOOLEAN LSN operators. -// - -inline BOOLEAN -operator< -( - __in const CLFS_LSN& refLsn1, - __in const CLFS_LSN& refLsn2 -) -{ - return (ClfsLsnLess ((PCLFS_LSN) &refLsn1, (PCLFS_LSN) &refLsn2)); -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -inline BOOLEAN -operator> -( - __in const CLFS_LSN& refLsn1, - __in const CLFS_LSN& refLsn2 -) -{ - return (ClfsLsnGreater ((PCLFS_LSN) &refLsn1, (PCLFS_LSN) &refLsn2)); -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -inline BOOLEAN -operator== -( - __in const CLFS_LSN& refLsn1, - __in const CLFS_LSN& refLsn2 -) -{ - return (ClfsLsnEqual ((PCLFS_LSN) &refLsn1, (PCLFS_LSN) &refLsn2)); -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -inline BOOLEAN -operator!= -( - __in const CLFS_LSN& refLsn1, - __in const CLFS_LSN& refLsn2 -) -{ - return (!ClfsLsnEqual ((PCLFS_LSN) &refLsn1, (PCLFS_LSN) &refLsn2)); -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -inline BOOLEAN -operator<= -( - __in const CLFS_LSN& refLsn1, - __in const CLFS_LSN& refLsn2 -) -{ - return (!ClfsLsnGreater ((PCLFS_LSN) &refLsn1, (PCLFS_LSN) &refLsn2)); -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -inline BOOLEAN -operator>= -( - __in const CLFS_LSN& refLsn1, - __in const CLFS_LSN& refLsn2 -) -{ - return (!ClfsLsnLess ((PCLFS_LSN) &refLsn1, (PCLFS_LSN) &refLsn2)); -} -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#endif /* CLFS_OPERATORS */ - -#endif /* __cplusplus */ - -#endif /* _CLFS_PUBLIC_H_ */ - -#ifdef __cplusplus -extern "C" { -#endif - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// We start with the information that is shared -// between user and kernel mode. -// - -typedef enum _CLFS_MGMT_POLICY_TYPE { - - ClfsMgmtPolicyMaximumSize = 0x0, - ClfsMgmtPolicyMinimumSize, - ClfsMgmtPolicyNewContainerSize, - ClfsMgmtPolicyGrowthRate, - ClfsMgmtPolicyLogTail, - ClfsMgmtPolicyAutoShrink, - ClfsMgmtPolicyAutoGrow, - ClfsMgmtPolicyNewContainerPrefix, - ClfsMgmtPolicyNewContainerSuffix, - ClfsMgmtPolicyNewContainerExtension, - - ClfsMgmtPolicyInvalid - -} CLFS_MGMT_POLICY_TYPE, *PCLFS_MGMT_POLICY_TYPE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -#define CLFS_MGMT_NUM_POLICIES ((ULONG)ClfsMgmtPolicyInvalid) -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Relative sizes used when explicitly setting log size. -// -#define CLFS_LOG_SIZE_MINIMUM ((ULONGLONG)(0)) -#define CLFS_LOG_SIZE_MAXIMUM ((ULONGLONG)(-1)) -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// The version of a given policy structure. See CLFS_MGMT_POLICY. -// -#define CLFS_MGMT_POLICY_VERSION (0x01) -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// Log policy flags. -// -// LOG_POLICY_OVERWRITE: If set when adding a log policy, the previous -// policy of given type will be replaced. -// -// LOG_POLICY_PERSIST: If set when adding a log policy, the policy -// will be persisted with the log metadata. -// -#define LOG_POLICY_OVERWRITE (0x01) -#define LOG_POLICY_PERSIST (0x02) -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_MGMT_POLICY -// -// This structure describes one particular policy that -// may be present on a log file. These are installed -// via InstallLogPolicy (Win32) or ClfsMgmtInstallPolicy (kernel). -// -typedef struct _CLFS_MGMT_POLICY { - - // - // Version of the structure. Should be CLFS_MGMT_POLICY_VERSION. - // - ULONG Version; - - // - // The entire length of the structure. - // - ULONG LengthInBytes; - - // - // Flags which apply to all policies, such as LOG_POLICY_OVERWRITE - // and LOG_POLICY_PERSIST. - // - ULONG PolicyFlags; - - // - // Determines how PolicyParameters union is interpreted. - // - CLFS_MGMT_POLICY_TYPE PolicyType; - - // - // The way to interpret the PolicyParameters union is - // determined by the value of PolicyType -- if it is - // ClfsMgmtPolicyMaximumSize, for instance, then the - // MaximumSize structure is the relevant one. - // - - union { - - struct { - ULONG Containers; - } MaximumSize; - - struct { - ULONG Containers; - } MinimumSize; - - struct { - ULONG SizeInBytes; - } NewContainerSize; - - struct { - ULONG AbsoluteGrowthInContainers; - ULONG RelativeGrowthPercentage; - } GrowthRate; - - struct { - ULONG MinimumAvailablePercentage; - ULONG MinimumAvailableContainers; - } LogTail; - - struct { - ULONG Percentage; - } AutoShrink; - - struct { - ULONG Enabled; - } AutoGrow; - - struct { - USHORT PrefixLengthInBytes; - WCHAR PrefixString[1]; // dynamic in length depending on PrefixLength - } NewContainerPrefix; - - struct { - ULONGLONG NextContainerSuffix; - } NewContainerSuffix; - - struct { - USHORT ExtensionLengthInBytes; - WCHAR ExtensionString[1]; // dynamic in length depending on ExtensionLengthInBytes - } NewContainerExtension; - - } PolicyParameters; - - // - // Nothing will be added down here since the structure above - // can be of dynamic length. - // - -} CLFS_MGMT_POLICY, *PCLFS_MGMT_POLICY; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_MGMT_NOTIFICATION_TYPE -// -// The types of notifications given to either the callback proxy -// or to readers of notifications. -// - -typedef enum _CLFS_MGMT_NOTIFICATION_TYPE -{ - - // - // Notification to advance base LSN. - // - - ClfsMgmtAdvanceTailNotification = 0, - - // - // Notification that a request to handle log full condition - // has completed. - // - - ClfsMgmtLogFullHandlerNotification, - - // - // Notification that a previously pinned log is now considered - // unpinned. - // - - ClfsMgmtLogUnpinnedNotification, - - // - // Notification that a non-zero number of bytes has been written - // to the log. - // - - ClfsMgmtLogWriteNotification - -} CLFS_MGMT_NOTIFICATION_TYPE, *PCLFS_MGMT_NOTIFICATION_TYPE; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_MGMT_NOTIFICATION -// -// A notification and associated parameters. -// - -typedef struct _CLFS_MGMT_NOTIFICATION -{ - - // - // Nature of the notification. - // - - CLFS_MGMT_NOTIFICATION_TYPE Notification; - - // - // Target LSN for base LSN advancement if the - // notification type is ClfsMgmtAdvanceTailNotification. - // - - CLFS_LSN Lsn; - - // - // TRUE if the log is pinned, FALSE otherwise. - // Especially meaningful when receiving an error - // status for ClfsMgmtLogFullHandlerNotification. - // - - USHORT LogIsPinned; - -} CLFS_MGMT_NOTIFICATION, *PCLFS_MGMT_NOTIFICATION; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -// -// Kernel interface described below. -// - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// The advance tail callback is required when log clients -// register for management. It is invoked whenever the -// management library decides that this client needs to -// advance the tail of its log. Only minimal processing is -// allowed. -// -typedef -NTSTATUS -(*PCLFS_CLIENT_ADVANCE_TAIL_CALLBACK) ( - __in PLOG_FILE_OBJECT LogFile, - __in PCLFS_LSN TargetLsn, - __in PVOID ClientData - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// The log file full handler complete callback is invoked upon -// completion of a log growth request (that is, via a call -// to ClfsMgmtHandleLogFileFull). -// -typedef -VOID -(*PCLFS_CLIENT_LFF_HANDLER_COMPLETE_CALLBACK) ( - __in PLOG_FILE_OBJECT LogFile, - __in NTSTATUS OperationStatus, - __in BOOLEAN LogIsPinned, - __in PVOID ClientData - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// The log pinned callback is invoked when log space is freed up -// after a log file full handler completion callback indicates an -// NT_ERROR status code and LogIsPinned = TRUE. -// - -typedef -VOID -(*PCLFS_CLIENT_LOG_UNPINNED_CALLBACK) ( - __in PLOG_FILE_OBJECT LogFile, - __in PVOID ClientData - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// The log size complete callback is invoked whenever -// ClfsMgmtSetLogFileSize operation which returned -// STATUS_PENDING is completed. -// - -typedef -VOID -(*PCLFS_SET_LOG_SIZE_COMPLETE_CALLBACK) ( - __in PLOG_FILE_OBJECT LogFile, - __in NTSTATUS OperationStatus, - __in PVOID ClientData - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_MGMT_CLIENT_REGISTRATION -// -// This structure is given to the CLFS management infrastructure -// by clients who wish to be managed (via ClfsMgmtRegisterManagedClient). -// The CLFS_MGMT_CLIENT_REGISTRATION_VERSION value must be stored -// in the 'Version' field of the structure. -// - -#define CLFS_MGMT_CLIENT_REGISTRATION_VERSION (0x1) - -typedef struct _CLFS_MGMT_CLIENT_REGISTRATION { - - // - // Initialize Version to CLFS_MGMT_CLIENT_REGISTRATION_VERSION. - // - - ULONG Version; - - PCLFS_CLIENT_ADVANCE_TAIL_CALLBACK AdvanceTailCallback; - PVOID AdvanceTailCallbackData; - - PCLFS_CLIENT_LFF_HANDLER_COMPLETE_CALLBACK LogGrowthCompleteCallback; - PVOID LogGrowthCompleteCallbackData; - - PCLFS_CLIENT_LOG_UNPINNED_CALLBACK LogUnpinnedCallback; - PVOID LogUnpinnedCallbackData; - -} CLFS_MGMT_CLIENT_REGISTRATION, *PCLFS_MGMT_CLIENT_REGISTRATION; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -// -// CLFS_MGMT_CLIENT -// -// This is the cookie that clients are given when registering and -// must give back to the management infrastructure whenever -// performing an operation. -// -typedef PVOID CLFS_MGMT_CLIENT, *PCLFS_MGMT_CLIENT; -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -NTSTATUS -ClfsMgmtRegisterManagedClient( - __in PLOG_FILE_OBJECT LogFile, - __in PCLFS_MGMT_CLIENT_REGISTRATION RegistrationData, - __out PCLFS_MGMT_CLIENT ClientCookie - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -NTSTATUS -ClfsMgmtDeregisterManagedClient( - __in CLFS_MGMT_CLIENT ClientCookie - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -NTSTATUS -ClfsMgmtTailAdvanceFailure( - __in CLFS_MGMT_CLIENT Client, - __in NTSTATUS Reason - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -NTSTATUS -ClfsMgmtHandleLogFileFull( - __in CLFS_MGMT_CLIENT Client - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -NTSTATUS -ClfsMgmtInstallPolicy( - __in PLOG_FILE_OBJECT LogFile, - __in_bcount(PolicyLength) PCLFS_MGMT_POLICY Policy, - __in ULONG PolicyLength - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -NTSTATUS -ClfsMgmtQueryPolicy( - __in PLOG_FILE_OBJECT LogFile, - __in CLFS_MGMT_POLICY_TYPE PolicyType, - __out_bcount(*PolicyLength) PCLFS_MGMT_POLICY Policy, - __out PULONG PolicyLength - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -NTSTATUS -ClfsMgmtRemovePolicy( - __in PLOG_FILE_OBJECT LogFile, - __in CLFS_MGMT_POLICY_TYPE PolicyType - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03) -NTSTATUS -ClfsMgmtSetLogFileSize( - __in PLOG_FILE_OBJECT LogFile, - __in PULONGLONG NewSizeInContainers, - __out_opt PULONGLONG ResultingSizeInContainers, - __in_opt PCLFS_SET_LOG_SIZE_COMPLETE_CALLBACK CompletionRoutine, - __in_opt PVOID CompletionRoutineData - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#if (NTDDI_VERSION >= NTDDI_VISTA) || (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN) -NTSTATUS -ClfsMgmtSetLogFileSizeAsClient( - __in PLOG_FILE_OBJECT LogFile, - __in_opt PCLFS_MGMT_CLIENT ClientCookie, - __in PULONGLONG NewSizeInContainers, - __out_opt PULONGLONG ResultingSizeInContainers, - __in_opt PCLFS_SET_LOG_SIZE_COMPLETE_CALLBACK CompletionRoutine, - __in_opt PVOID CompletionRoutineData - ); -#endif /* NTDDI_VERSION || _WIN32_WINNT */ - - -#ifdef __cplusplus -} // extern "C" -#endif - -#ifndef __CLFSPROC_H__ -#define __CLFSPROC_H__ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsInitialize -// -// Utility to initialize CLFS global resources, lookaside lists, and memory. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsInitialize (void); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsFinalize -// -// Utility to cleanup CLFS global resources, lookaside lists, and memory. -//------------------------------------------------------------------------------ - -void ClfsFinalize (void); -#endif /* NTDDI_VERSION */ - - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsCreateLogFile -// -// Entry point to create a physical log file consisting of uniformly sized -// containers lying in a given directory path. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsCreateLogFile ( - __out PPLOG_FILE_OBJECT pplfoLog, - __in PUNICODE_STRING puszLogFileName, - __in ACCESS_MASK fDesiredAccess, - __in ULONG dwShareMode, - __in_opt PSECURITY_DESCRIPTOR psdLogFile, - __in ULONG fCreateDisposition, - __in ULONG fCreateOptions, - __in ULONG fFlagsAndAttributes, - __in ULONG fLogOptionFlag, - __in_bcount_opt(cbContext) PVOID pvContext, - __in ULONG cbContext - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsDeleteLogByPointer -// -// Entry point to delete a physical log file and its underlying container -// storage referencing a log file object. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsDeleteLogByPointer (__in PLOG_FILE_OBJECT plfoLog); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsDeleteLogFile -// -// Entry point to delete a physical log file and its underlying container -// storage by name. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsDeleteLogFile ( - __in PUNICODE_STRING puszLogFileName, - __in_opt PVOID pvReserved, - __in ULONG fLogOptionFlag, - __in_bcount_opt(cbContext) PVOID pvContext, - __in ULONG cbContext - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsAddLogContainer -// -// Adds a log container to a given physical file identified by the log -// file object pointer. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsAddLogContainer ( - __in PLOG_FILE_OBJECT plfoLog, - __in PULONGLONG pcbContainer, - __in PUNICODE_STRING puszContainerPath - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsAddLogContainerSet -// -// Adds a set of log containers to a given physical file identified by the log -// file object pointer. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsAddLogContainerSet ( - __in PLOG_FILE_OBJECT plfoLog, - __in USHORT cContainers, - __in_opt PULONGLONG pcbContainer, - __in_ecount(cContainers) PUNICODE_STRING rguszContainerPath - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsRemoveLogContainer -// -// Removes a log container from a physical log file identified by -// the log file object pointer. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsRemoveLogContainer ( - __in PLOG_FILE_OBJECT plfoLog, - __in PUNICODE_STRING puszContainerPath, - __in BOOLEAN fForce - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsRemoveLogContainerSet -// -// Removes a set of log containers from a physical log file identified by -// the log file object pointer. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsRemoveLogContainerSet ( - __in PLOG_FILE_OBJECT plfoLog, - __in USHORT cContainers, - __in_ecount(cContainers) PUNICODE_STRING rgwszContainerPath, - __in BOOLEAN fForce - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsSetArchiveTail -// -// Sets the archive tail for either a client or physical log file -// depending on the type of the log handle. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsSetArchiveTail ( - __in PLOG_FILE_OBJECT plfoLog, - __in PCLFS_LSN plsnArchiveTail - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsSetEndOfLog -// -// Sets the end of log for either a client or physical log file -// depending on the type of the log handle. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsSetEndOfLog ( - __in PLOG_FILE_OBJECT plfoLog, - __in PCLFS_LSN plsnEnd - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsCreateScanContext -// -// Create a scan context to enumerate scan descriptors for storage containers -// that back the physical log file object. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsCreateScanContext ( - __in PLOG_FILE_OBJECT plfoLog, - __in ULONG cFromContainer, - __in ULONG cContainers, - __in CLFS_SCAN_MODE eScanMode, - __inout PCLFS_SCAN_CONTEXT pcxScan - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsScanLogContainers -// -// Scan descriptors for storage containers backing the physical -// log file stream. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsScanLogContainers ( - __inout PCLFS_SCAN_CONTEXT pcxScan, - __in CLFS_SCAN_MODE eScanMode - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsGetContainerName -// -// ClfsGetContainerName gets the full path name of a container given its logical -// container identifier. -// -//------------------------------------------------------------------------------ - -NTSTATUS ClfsGetContainerName ( - __in PLOG_FILE_OBJECT plfoLog, - __in CLFS_CONTAINER_ID cidLogicalContainer, - __out PUNICODE_STRING puszContainerName, - __out_opt PULONG pcActualLenContainerName - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsGetLogFileInformation -// -// Get log file information for a physical log and client stream -// specific to the log file object pointer. -// -// Deprecated. Use ClfsQueryLogFileInformation instead (it is equivalent -// to this call if ClfsLogBasicInformation is used as information class). -// -//------------------------------------------------------------------------------ - -NTSTATUS ClfsGetLogFileInformation ( - __in PLOG_FILE_OBJECT plfoLog, - __out_bcount_part(*pcbInfoBuffer, *pcbInfoBuffer) PCLFS_INFORMATION pinfoBuffer, - __inout PULONG pcbInfoBuffer - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_VISTA) -//------------------------------------------------------------------------------ -// ClfsQueryLogFileInformation -// -// Get log file information for a physical log and client stream -// specific to the log file object pointer. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsQueryLogFileInformation ( - __in PLOG_FILE_OBJECT plfoLog, - __in CLFS_LOG_INFORMATION_CLASS eInformationClass, - __in_bcount_opt(cbinfoInputBuffer) PVOID pinfoInputBuffer, - __in_opt ULONG cbinfoInputBuffer, - __out_bcount(*pcbInfoBuffer) PVOID pinfoBuffer, - __inout PULONG pcbInfoBuffer - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsSetLogFileInformation -// -// Sets log file information for a physical log and client stream -// specific to the log file object pointer. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsSetLogFileInformation ( - __in PLOG_FILE_OBJECT plfoLog, - __in CLFS_LOG_INFORMATION_CLASS eInformationClass, - __in_bcount(cbBuffer) PVOID pinfoBuffer, - __in ULONG cbBuffer - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsReadRestartArea -// -// Read the last restart area successfully written to a physical or -// client log stream given a marshalling context. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsReadRestartArea ( - __inout PVOID pvMarshalContext, - __deref_out_bcount(*pcbRestartBuffer) PVOID *ppvRestartBuffer, - __out PULONG pcbRestartBuffer, - __out PCLFS_LSN plsn, - __deref_out PVOID *ppvReadContext - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsReadPreviousRestartArea -// -// Read the previous restart area successfully written to a physical or -// client log stream given the read context created by the a call to -// ClfsReadRestartArea. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsReadPreviousRestartArea ( - __in PVOID pvReadContext, - __deref_out_bcount(*pcbRestartBuffer) PVOID *ppvRestartBuffer, - __out PULONG pcbRestartBuffer, - __out PCLFS_LSN plsnRestart - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsWriteRestartArea -// -// Write a new restart area to a physical or client log stream given a -// a marshalling context. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsWriteRestartArea ( - __inout PVOID pvMarshalContext, - __in_bcount(cbRestartBuffer) PVOID pvRestartBuffer, - __in ULONG cbRestartBuffer, - __in_opt PCLFS_LSN plsnBase, - __in ULONG fFlags, - __out_opt PULONG pcbWritten, - __out_opt PCLFS_LSN plsnNext - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsAdvanceLogBase -// -// Set a new log base LSN without writing a restart record. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsAdvanceLogBase ( - __inout PVOID pvMarshalContext, - __in PCLFS_LSN plsnBase, - __in ULONG fFlags - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsCloseAndResetLogFile -// -// Orderly shutdown of a physical or client log file stream given the log file -// object pointer. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsCloseAndResetLogFile (__in PLOG_FILE_OBJECT plfoLog); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsCloseLogFileObject -// -// Close a log file object without the orderly shutdown of the log. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsCloseLogFileObject (__in PLOG_FILE_OBJECT plfoLog); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsCreateMarshallingArea -// -// Initalize a marshalling area for a physical or client log -// file stream given log file object pointer. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsCreateMarshallingArea ( - __in PLOG_FILE_OBJECT plfoLog, - __in POOL_TYPE ePoolType, - __in_opt PALLOCATE_FUNCTION pfnAllocBuffer, - __in_opt PFREE_FUNCTION pfnFreeBuffer, - __in ULONG cbMarshallingBuffer, - __in ULONG cMaxWriteBuffers, - __in ULONG cMaxReadBuffers, - __deref_out PVOID *ppvMarshalContext - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsDeleteMarshallingArea -// -// Delete a marshalling area for a physical or client log -// file stream. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsDeleteMarshallingArea (__in PVOID pvMarshalContext); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsReserveAndAppendLog -// -// Reserve space and append log buffers to a physical or client -// log stream. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsReserveAndAppendLog ( - __in PVOID pvMarshalContext, - __in_ecount_opt(cWriteEntries) PCLFS_WRITE_ENTRY rgWriteEntries, - __in ULONG cWriteEntries, - __in_opt PCLFS_LSN plsnUndoNext, - __in_opt PCLFS_LSN plsnPrevious, - __in ULONG cReserveRecords, - __inout_ecount_opt(cReserveRecords) PLONGLONG rgcbReservation, - __in ULONG fFlags, - __out_opt PCLFS_LSN plsn - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsReserveAndAppendLogAligned -// -// Reserve space and append log buffers to a physical or client -// log stream, aligning each of the write entries according to -// the alignment specified. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsReserveAndAppendLogAligned ( - __in PVOID pvMarshalContext, - __in_ecount_opt(cWriteEntries) PCLFS_WRITE_ENTRY rgWriteEntries, - __in ULONG cWriteEntries, - __in ULONG cbEntryAlignment, - __in_opt PCLFS_LSN plsnUndoNext, - __in_opt PCLFS_LSN plsnPrevious, - __in ULONG cReserveRecords, - __inout_ecount_opt(cReserveRecords) PLONGLONG rgcbReservation, - __in ULONG fFlags, - __out_opt PCLFS_LSN plsn - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsAlignReservedLog -// -// Given a valid marshalling context, allocate an aggregate number of reserved -// records and bytes. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsAlignReservedLog ( - __in PVOID pvMarshalContext, - __in ULONG cRecords, - __in_ecount(cRecords) LONGLONG rgcbReservation [], - __out PLONGLONG pcbAlignReservation - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsAllocReservedLog -// -// Given a valid marshalling context, allocate an aggregate number of reserved -// records and bytes. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsAllocReservedLog ( - __in PVOID pvMarshalContext, - __in ULONG cRecords, - __in_ecount(cRecords) PLONGLONG pcbAdjustment - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsFreeReservedLog -// -// Set the reserved log space to a new size or specify a delta -// for the reserved space given log file. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsFreeReservedLog ( - __in PVOID pvMarshalContext, - __in ULONG cRecords, - __in_ecount(cRecords) PLONGLONG pcbAdjustment - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsFlushBuffers -// -// Append all buffers in the marshalling area up to the flush queue and flush -// all buffers up to the disk. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsFlushBuffers (__in PVOID pvMarshalContext); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsFlushToLsn -// -// Flush all buffers in the marshalling area up to a target LSN to the flush -// queue and flush all buffers up to the target LSN to the disk. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsFlushToLsn ( - __in PVOID pvMarshalContext, - __in PCLFS_LSN plsnFlush, - __out_opt PCLFS_LSN plsnLastFlushed - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsReadLogRecord -// -// Read a log record from a physical or client log stream given -// a starting LSN. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsReadLogRecord ( - __in PVOID pvMarshalContext, - __inout PCLFS_LSN plsnFirst, - __in CLFS_CONTEXT_MODE peContextMode, - __deref_out_bcount(*pcbReadBuffer) PVOID *ppvReadBuffer, - __out PULONG pcbReadBuffer, - __out PCLFS_RECORD_TYPE peRecordType, - __out PCLFS_LSN plsnUndoNext, - __out PCLFS_LSN plsnPrevious, - __deref_out PVOID* ppvReadContext - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsReadNextLogRecord -// -// Read the next log record from a given marshalling context. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsReadNextLogRecord ( - __inout PVOID pvReadContext, - __deref_out_bcount(*pcbBuffer) PVOID *ppvBuffer, - __out PULONG pcbBuffer, - __inout PCLFS_RECORD_TYPE peRecordType, - __in_opt PCLFS_LSN plsnUser, - __out PCLFS_LSN plsnUndoNext, - __out PCLFS_LSN plsnPrevious, - __out PCLFS_LSN plsnRecord - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsTerminateReadLog -// -// Terminate the read context. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsTerminateReadLog (__in PVOID pvCursorContext); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsGetLastLsn -// -// Get the last used LSN. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsGetLastLsn ( - __in PLOG_FILE_OBJECT plfoLog, - __out PCLFS_LSN plsnLast - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//------------------------------------------------------------------------------ -// ClfsGetIoStatistics -// -// Get I/O statistics on the CLFS log file. -//------------------------------------------------------------------------------ - -NTSTATUS ClfsGetIoStatistics ( - __in PLOG_FILE_OBJECT plfoLog, - __inout_bcount(cbStatsBuffer) PVOID pvStatsBuffer, - __in ULONG cbStatsBuffer, - __in CLFS_IOSTATS_CLASS eStatsClass, - __out_opt PULONG pcbStatsWritten - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//----------------------------------------------------------------------------- -// ClfsLaterLsn -// -// Method Description: -// -// Increment an LSN by 1 -// -// Arguments: -// -// plsn -- LSN to be incremented. -// -// -// Return Value: -// -// A valid LSN next in sequence to the input LSN, if successful. -// Otherwise, this function returns CLFS_LSN_INVALID. -// -//----------------------------------------------------------------------------- - -CLFS_LSN -ClfsLaterLsn (__in PCLFS_LSN plsn); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//----------------------------------------------------------------------------- -// ClfsEarlierLsn -// -// Method Description: -// -// Decrement an LSN by 1 -// -// Arguments: -// -// plsn -- LSN to be decremented. -// -// -// Return Value: -// -// A valid LSN next in sequence to the input LSN, if successful. -// Otherwise, this function returns CLFS_LSN_INVALID. -// -//----------------------------------------------------------------------------- - -CLFS_LSN -ClfsEarlierLsn (__in PCLFS_LSN plsn); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_WS03SP1) -//---------------------------------------------------------------------------- -// ClfsLsnDifference -// -// Method Description: -// -// Find the approximate number of bytes between two LSNs. -// -// Arguments: -// -// plsnStart -- LSN start of the log file range -// plsnFinish -- LSN finish of the log file range -// cbContainer -- size of a container -// cbMaxBlock -- maximum size of an I/O block -// pcbDifference -- approximate number of bytes between two LSNs. -// -// -// -// Return Value: -// -// STATUS_SUCCESS if difference is succeeds and an error status -// otherwise. -// -//----------------------------------------------------------------------------- - -NTSTATUS -ClfsLsnDifference ( - __in PCLFS_LSN plsnStart, - __in PCLFS_LSN plsnFinish, - __in ULONG cbContainer, - __in ULONG cbMaxBlock, - __out PLONGLONG pcbDifference - ); -#endif /* NTDDI_VERSION */ - -#if (NTDDI_VERSION >= NTDDI_VISTA) -//---------------------------------------------------------------------------- -// ClfsValidTopLevelContext -// -// Method Description: -// -// Check that the current top level context is a common log (CLFS) -// context. -// -// Arguments: -// -// pirp -- reference to top of top-level context stack -// -// Return Value: -// -// TRUE if this is a valid CLFS top-level context and FALSE otherwise. -// -//----------------------------------------------------------------------------- - -BOOLEAN -ClfsValidTopLevelContext (__in PIRP pirpTopLevelContext); -#endif /* NTDDI_VERSION */ - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __CLFSPROC_H__ */ - -typedef struct _KTRANSACTION KTRANSACTION, *PKTRANSACTION, *RESTRICTED_POINTER PRKTRANSACTION; -typedef struct _KENLISTMENT KENLISTMENT, *PKENLISTMENT, *RESTRICTED_POINTER PRKENLISTMENT; -typedef struct _KRESOURCEMANAGER KRESOURCEMANAGER, *PKRESOURCEMANAGER, *RESTRICTED_POINTER PRKRESOURCEMANAGER; -typedef struct _KTM KTM, *PKTM, *RESTRICTED_POINTER PRKTM; - -typedef GUID UOW, *PUOW; -typedef GUID *PGUID; - -// -// Define ResourceManager Notification routine type. -// - -typedef -NTSTATUS -(NTAPI *PTM_RM_NOTIFICATION) ( - __in PKENLISTMENT EnlistmentObject, - __in PVOID RMContext, - __in PVOID TransactionContext, - __in ULONG TransactionNotification, - __inout PLARGE_INTEGER TmVirtualClock, - __in ULONG ArgumentLength, - __in PVOID Argument - ); - -// -// CRM Protocol object -// - -typedef GUID KCRM_PROTOCOL_ID, *PKCRM_PROTOCOL_ID; - -typedef -NTSTATUS -(NTAPI *PTM_PROPAGATE_ROUTINE) ( - __in PVOID PropagationCookie, - __in PVOID CallbackData, - __in NTSTATUS PropagationStatus, - __in GUID TransactionGuid - ); - -// -// Tm-level Transaction APIs -// - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmInitializeTransactionManager ( - __in PRKTM TransactionManager, - __in PCUNICODE_STRING LogFileName, - __in PGUID TmId, - __in_opt ULONG CreateOptions - ); - - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmRenameTransactionManager ( - __in PUNICODE_STRING LogFileName, - __in LPGUID ExistingTransactionManagerGuid - ); - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmRecoverTransactionManager ( - __in PKTM Tm, - __in PLARGE_INTEGER TargetVirtualClock - ); - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmCommitTransaction ( - __in PKTRANSACTION Transaction, - __in BOOLEAN Wait - ); - - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmRollbackTransaction ( - __in PKTRANSACTION Transaction, - __in BOOLEAN Wait - ); - - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmCreateEnlistment ( - __out PHANDLE EnlistmentHandle, - __in KPROCESSOR_MODE PreviousMode, - __in ACCESS_MASK DesiredAccess, - __in POBJECT_ATTRIBUTES ObjectAttributes, - __in PRKRESOURCEMANAGER ResourceManager, - __in PKTRANSACTION Transaction, - __in_opt ULONG CreateOptions, - __in NOTIFICATION_MASK NotificationMask, - __in_opt PVOID EnlistmentKey - ); - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmRecoverEnlistment ( - __in PKENLISTMENT Enlistment, - __in PVOID EnlistmentKey - ); - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmPrePrepareEnlistment ( - __in PKENLISTMENT Enlistment, - __in PLARGE_INTEGER TmVirtualClock - ); - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmPrepareEnlistment ( - __in PKENLISTMENT Enlistment, - __in PLARGE_INTEGER TmVirtualClock - ); - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmCommitEnlistment ( - __in PKENLISTMENT Enlistment, - __in PLARGE_INTEGER TmVirtualClock - ); - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmRollbackEnlistment ( - __in PKENLISTMENT Enlistment, - __in PLARGE_INTEGER TmVirtualClock - ); - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmPrePrepareComplete ( - __in PKENLISTMENT Enlistment, - __in PLARGE_INTEGER TmVirtualClock - ); - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmPrepareComplete ( - __in PKENLISTMENT Enlistment, - __in PLARGE_INTEGER TmVirtualClock - ); - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmReadOnlyEnlistment ( - __in PKENLISTMENT Enlistment, - __in PLARGE_INTEGER TmVirtualClock - ); - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmCommitComplete ( - __in PKENLISTMENT Enlistment, - __in PLARGE_INTEGER TmVirtualClock - ); - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmRollbackComplete ( - __in PKENLISTMENT Enlistment, - __in PLARGE_INTEGER TmVirtualClock - ); - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmReferenceEnlistmentKey ( - __in PKENLISTMENT Enlistment, - __out PVOID *Key - ); - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmDereferenceEnlistmentKey ( - __in PKENLISTMENT Enlistment, - __out_opt PBOOLEAN LastReference - ); - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmSinglePhaseReject ( - __in PKENLISTMENT Enlistment, - __in PLARGE_INTEGER TmVirtualClock - ); - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmRequestOutcomeEnlistment ( - __in PKENLISTMENT Enlistment, - __in PLARGE_INTEGER TmVirtualClock - ); - - -// -// ResourceManager APIs -// - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmEnableCallbacks ( - __in PKRESOURCEMANAGER ResourceManager, - __in PTM_RM_NOTIFICATION CallbackRoutine, - __in_opt PVOID RMKey - ); - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmRecoverResourceManager ( - __in PKRESOURCEMANAGER ResourceManager - ); - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmRegisterProtocolAddressInformation( - __in PKRESOURCEMANAGER ResourceManager, - __in PKCRM_PROTOCOL_ID ProtocolId, - __in ULONG ProtocolInformationSize, - __in PVOID ProtocolInformation - ); - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmPropagationComplete( - __in PKRESOURCEMANAGER ResourceManager, - __in ULONG RequestCookie, - __in ULONG BufferLength, - __in PVOID Buffer - ); - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -NTSTATUS -NTAPI -TmPropagationFailed( - __in PKRESOURCEMANAGER ResourceManager, - __in ULONG RequestCookie, - __in NTSTATUS Status - ); - -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -VOID -NTAPI -TmGetTransactionId( - __in PKTRANSACTION Transaction, - __out PUOW TransactionId - ); - -__checkReturn -__drv_maxIRQL (APC_LEVEL) -NTKERNELAPI -BOOLEAN -NTAPI -TmIsTransactionActive ( - __in PKTRANSACTION Transaction - ); - - -#define PCW_VERSION_1 0x0100 -#define PCW_CURRENT_VERSION PCW_VERSION_1 - -typedef struct _PCW_INSTANCE *PPCW_INSTANCE; -typedef struct _PCW_REGISTRATION *PPCW_REGISTRATION; -typedef struct _PCW_BUFFER *PPCW_BUFFER; - -typedef struct _PCW_COUNTER_DESCRIPTOR { - USHORT Id; - USHORT StructIndex; - USHORT Offset; - USHORT Size; -} PCW_COUNTER_DESCRIPTOR, *PPCW_COUNTER_DESCRIPTOR; - -typedef struct _PCW_DATA { - __in_bcount(Size) const VOID *Data; - __in ULONG Size; -} PCW_DATA, *PPCW_DATA; - -typedef struct _PCW_COUNTER_INFORMATION { - ULONG64 CounterMask; - PCUNICODE_STRING InstanceMask; -} PCW_COUNTER_INFORMATION, *PPCW_COUNTER_INFORMATION; - -typedef struct _PCW_MASK_INFORMATION { - ULONG64 CounterMask; - PCUNICODE_STRING InstanceMask; - ULONG InstanceId; - BOOLEAN CollectMultiple; - PPCW_BUFFER Buffer; - PKEVENT CancelEvent; -} PCW_MASK_INFORMATION, *PPCW_MASK_INFORMATION; - -typedef union _PCW_CALLBACK_INFORMATION { - PCW_COUNTER_INFORMATION AddCounter; - PCW_COUNTER_INFORMATION RemoveCounter; - PCW_MASK_INFORMATION EnumerateInstances; - PCW_MASK_INFORMATION CollectData; -} PCW_CALLBACK_INFORMATION, *PPCW_CALLBACK_INFORMATION; - -typedef enum _PCW_CALLBACK_TYPE { - PcwCallbackAddCounter = 0, - PcwCallbackRemoveCounter, - PcwCallbackEnumerateInstances, - PcwCallbackCollectData, -} PCW_CALLBACK_TYPE, *PPCW_CALLBACK_TYPE; - -typedef -NTSTATUS NTAPI -PCW_CALLBACK( - __in PCW_CALLBACK_TYPE Type, - __in PPCW_CALLBACK_INFORMATION Info, - __in_opt PVOID Context - ); - -typedef PCW_CALLBACK *PPCW_CALLBACK; - -typedef struct _PCW_REGISTRATION_INFORMATION { - __in ULONG Version; - __in PCUNICODE_STRING Name; - __in ULONG CounterCount; - __in_ecount(CounterCount) PPCW_COUNTER_DESCRIPTOR Counters; - __in_opt PPCW_CALLBACK Callback; - __in_opt PVOID CallbackContext; -} PCW_REGISTRATION_INFORMATION, *PPCW_REGISTRATION_INFORMATION; - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -NTAPI -PcwRegister( - __deref_out PPCW_REGISTRATION *Registration, - __in PPCW_REGISTRATION_INFORMATION Info - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -VOID -NTAPI -PcwUnregister( - __in PPCW_REGISTRATION Registration - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -NTAPI -PcwCreateInstance( - __deref_out PPCW_INSTANCE *Instance, - __in PPCW_REGISTRATION Registration, - __in PCUNICODE_STRING Name, - __in ULONG Count, - __in_ecount(Count) PPCW_DATA Data - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -VOID -NTAPI -PcwCloseInstance( - __in PPCW_INSTANCE Instance - ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -__drv_maxIRQL(APC_LEVEL) -NTSTATUS -NTAPI -PcwAddInstance( - __in PPCW_BUFFER Buffer, - __in PCUNICODE_STRING Name, - __in ULONG Id, - __in ULONG Count, - __in_ecount(Count) PPCW_DATA Data - ); -#endif - - - -extern POBJECT_TYPE *CmKeyObjectType; -extern POBJECT_TYPE *IoFileObjectType; -extern POBJECT_TYPE *ExEventObjectType; -extern POBJECT_TYPE *ExSemaphoreObjectType; -extern POBJECT_TYPE *TmTransactionManagerObjectType; -extern POBJECT_TYPE *TmResourceManagerObjectType; -extern POBJECT_TYPE *TmEnlistmentObjectType; -extern POBJECT_TYPE *TmTransactionObjectType; -extern POBJECT_TYPE *PsProcessType; -extern POBJECT_TYPE *PsThreadType; -extern POBJECT_TYPE *SeTokenObjectType; - -#ifdef __cplusplus -} -#endif - -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4115) -#pragma warning(default:4201) -#pragma warning(default:4214) -#endif - -#endif // _WDMDDK_ - diff --git a/pub/ddk/wdmguid.h b/pub/ddk/wdmguid.h deleted file mode 100644 index d06c511..0000000 --- a/pub/ddk/wdmguid.h +++ /dev/null @@ -1,136 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - wdmguid.h - -Abstract: - - Defines GUIDs for function device classes and device events used in - Plug & Play. - -Revision History: - ---*/ - -#ifndef FAR -#define FAR -#endif - -// -// Device events that can be broadcasted to drivers and user-mode apps. -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DEFINE_GUID( GUID_HWPROFILE_QUERY_CHANGE, 0xcb3a4001L, 0x46f0, 0x11d0, 0xb0, 0x8f, 0x00, 0x60, 0x97, 0x13, 0x05, 0x3f ); -DEFINE_GUID( GUID_HWPROFILE_CHANGE_CANCELLED, 0xcb3a4002L, 0x46f0, 0x11d0, 0xb0, 0x8f, 0x00, 0x60, 0x97, 0x13, 0x05, 0x3f ); -DEFINE_GUID( GUID_HWPROFILE_CHANGE_COMPLETE, 0xcb3a4003L, 0x46f0, 0x11d0, 0xb0, 0x8f, 0x00, 0x60, 0x97, 0x13, 0x05, 0x3f ); -DEFINE_GUID( GUID_DEVICE_INTERFACE_ARRIVAL, 0xcb3a4004L, 0x46f0, 0x11d0, 0xb0, 0x8f, 0x00, 0x60, 0x97, 0x13, 0x05, 0x3f ); -DEFINE_GUID( GUID_DEVICE_INTERFACE_REMOVAL, 0xcb3a4005L, 0x46f0, 0x11d0, 0xb0, 0x8f, 0x00, 0x60, 0x97, 0x13, 0x05, 0x3f ); -DEFINE_GUID( GUID_TARGET_DEVICE_QUERY_REMOVE, 0xcb3a4006L, 0x46f0, 0x11d0, 0xb0, 0x8f, 0x00, 0x60, 0x97, 0x13, 0x05, 0x3f ); -DEFINE_GUID( GUID_TARGET_DEVICE_REMOVE_CANCELLED, 0xcb3a4007L, 0x46f0, 0x11d0, 0xb0, 0x8f, 0x00, 0x60, 0x97, 0x13, 0x05, 0x3f ); -DEFINE_GUID( GUID_TARGET_DEVICE_REMOVE_COMPLETE, 0xcb3a4008L, 0x46f0, 0x11d0, 0xb0, 0x8f, 0x00, 0x60, 0x97, 0x13, 0x05, 0x3f ); -DEFINE_GUID( GUID_PNP_CUSTOM_NOTIFICATION, 0xACA73F8EL, 0x8D23, 0x11D1, 0xAC, 0x7D, 0x00, 0x00, 0xF8, 0x75, 0x71, 0xD0 ); -DEFINE_GUID( GUID_PNP_POWER_NOTIFICATION, 0xC2CF0660L, 0xEB7A, 0x11D1, 0xBD, 0x7F, 0x00, 0x00, 0xF8, 0x75, 0x71, 0xD0 ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -DEFINE_GUID( GUID_PNP_POWER_SETTING_CHANGE, 0x29C69B3EL, 0xC79A, 0x43BF, 0xBB, 0xDE, 0xA9, 0x32, 0xFA, 0x1B, 0xEA, 0x7E ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -DEFINE_GUID( GUID_TARGET_DEVICE_TRANSPORT_RELATIONS_CHANGED, 0xfcf528f6, 0xa82f, 0x47b1, 0xad, 0x3a, 0x80, 0x50, 0x59, 0x4c, 0xad, 0x28 ); -#endif - -// -// Interface GUIDs used for IRP_MN_QUERY_INTERFACE -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DEFINE_GUID( GUID_BUS_INTERFACE_STANDARD, 0x496B8280L, 0x6F25, 0x11D0, 0xBE, 0xAF, 0x08, 0x00, 0x2B, 0xE2, 0x09, 0x2F ); -DEFINE_GUID( GUID_PCI_BUS_INTERFACE_STANDARD, 0x496B8281L, 0x6F25, 0x11D0, 0xBE, 0xAF, 0x08, 0x00, 0x2B, 0xE2, 0x09, 0x2F ); -DEFINE_GUID( GUID_ARBITER_INTERFACE_STANDARD, 0xe644f185L, 0x8c0e, 0x11d0, 0xbe, 0xcf, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f ); -DEFINE_GUID( GUID_TRANSLATOR_INTERFACE_STANDARD, 0x6c154a92L, 0xaacf, 0x11d0, 0x8d, 0x2a, 0x00, 0xa0, 0xc9, 0x06, 0xb2, 0x44 ); -DEFINE_GUID( GUID_ACPI_INTERFACE_STANDARD, 0xb091a08aL, 0xba97, 0x11d0, 0xbd, 0x14, 0x00, 0xaa, 0x00, 0xb7, 0xb3, 0x2a ); -DEFINE_GUID( GUID_INT_ROUTE_INTERFACE_STANDARD, 0x70941bf4L, 0x0073, 0x11d1, 0xa0, 0x9e, 0x00, 0xc0, 0x4f, 0xc3, 0x40, 0xb1 ); -DEFINE_GUID( GUID_PCMCIA_BUS_INTERFACE_STANDARD, 0x76173af0L, 0xc504, 0x11d1, 0x94, 0x7f, 0x00, 0xc0, 0x4f, 0xb9, 0x60, 0xee ); -DEFINE_GUID( GUID_ACPI_REGS_INTERFACE_STANDARD, 0x06141966L, 0x7245, 0x6369, 0x46, 0x2e, 0x4e, 0x65, 0x6c, 0x73, 0x6f, 0x6e ); -DEFINE_GUID( GUID_LEGACY_DEVICE_DETECTION_STANDARD, 0x50feb0deL, 0x596a, 0x11d2, 0xa5, 0xb8, 0x00, 0x00, 0xf8, 0x1a, 0x46, 0x19 ); -DEFINE_GUID( GUID_PCI_DEVICE_PRESENT_INTERFACE, 0xd1b82c26L, 0xbf49, 0x45ef, 0xb2, 0x16, 0x71, 0xcb, 0xd7, 0x88, 0x9b, 0x57 ); -DEFINE_GUID( GUID_MF_ENUMERATION_INTERFACE, 0xaeb895f0L, 0x5586, 0x11d1, 0x8d, 0x84, 0x00, 0xa0, 0xc9, 0x06, 0xb2, 0x44 ); -DEFINE_GUID( GUID_REENUMERATE_SELF_INTERFACE_STANDARD, 0x2aeb0243, 0x6a6e, 0x486b, 0x82, 0xfc, 0xd8, 0x15, 0xf6, 0xb9, 0x70, 0x06 ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -DEFINE_GUID( GUID_AGP_TARGET_BUS_INTERFACE_STANDARD, 0xB15CFCE8L, 0x06D1, 0x4D37, 0x9D, 0x4C, 0xBE, 0xDD, 0xE0, 0xC2, 0xA6, 0xFF ); -DEFINE_GUID( GUID_ACPI_CMOS_INTERFACE_STANDARD, 0x3a8d0384L, 0x6505, 0x40ca, 0xbc, 0x39, 0x56, 0xc1, 0x5f, 0x8c, 0x5f, 0xed ); -DEFINE_GUID( GUID_ACPI_PORT_RANGES_INTERFACE_STANDARD, 0xf14f609bL, 0xcbbd, 0x4957, 0xa6, 0x74, 0xbc, 0x0, 0x21, 0x3f, 0x1c, 0x97 ); -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -DEFINE_GUID( GUID_ACPI_INTERFACE_STANDARD2, 0xe8695f63L, 0x1831, 0x4870, 0xa8, 0xcf, 0x9c, 0x2f, 0x03, 0xf9, 0xdc, 0xb5 ); -DEFINE_GUID( GUID_PNP_LOCATION_INTERFACE, 0x70211b0e, 0x0afb, 0x47db, 0xaf, 0xc1, 0x41, 0x0b, 0xf8, 0x42, 0x49, 0x7a ); -DEFINE_GUID( GUID_PCI_EXPRESS_LINK_QUIESCENT_INTERFACE, 0x146cd41cL, 0xdae3, 0x4437, 0x8a, 0xff, 0x2a, 0xf3, 0xf0, 0x38, 0x09, 0x9b ); -DEFINE_GUID( GUID_PCI_EXPRESS_ROOT_PORT_INTERFACE, 0x83a7734aL, 0x84c7, 0x4161, 0x9a, 0x98, 0x60, 0x00, 0xed, 0x0c, 0x4a, 0x33 ); -DEFINE_GUID( GUID_MSIX_TABLE_CONFIG_INTERFACE, 0x1a6a460b, 0x194f, 0x455d, 0xb3, 0x4b, 0xb8, 0x4c, 0x5b, 0x05, 0x71, 0x2b ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WIN7) -DEFINE_GUID( GUID_PROCESSOR_PCC_INTERFACE_STANDARD, 0x37b17e9a, 0xc21c, 0x4296, 0x97, 0x2d, 0x11, 0xc4, 0xb3, 0x2b, 0x28, 0xf0); -#endif - -// -// Bus type GUIDs -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DEFINE_GUID( GUID_BUS_TYPE_INTERNAL, 0x1530ea73L, 0x086b, 0x11d1, 0xa0, 0x9f, 0x00, 0xc0, 0x4f, 0xc3, 0x40, 0xb1 ); -DEFINE_GUID( GUID_BUS_TYPE_PCMCIA, 0x09343630L, 0xaf9f, 0x11d0, 0x92, 0xE9, 0x00, 0x00, 0xf8, 0x1e, 0x1b, 0x30 ); -DEFINE_GUID( GUID_BUS_TYPE_PCI, 0xc8ebdfb0L, 0xb510, 0x11d0, 0x80, 0xe5, 0x00, 0xa0, 0xc9, 0x25, 0x42, 0xe3 ); -DEFINE_GUID( GUID_BUS_TYPE_ISAPNP, 0xe676f854L, 0xd87d, 0x11d0, 0x92, 0xb2, 0x00, 0xa0, 0xc9, 0x05, 0x5f, 0xc5 ); -DEFINE_GUID( GUID_BUS_TYPE_EISA, 0xddc35509L, 0xf3fc, 0x11d0, 0xa5, 0x37, 0x00, 0x00, 0xf8, 0x75, 0x3e, 0xd1 ); -DEFINE_GUID( GUID_BUS_TYPE_MCA, 0x1c75997aL, 0xdc33, 0x11d0, 0x92, 0xb2, 0x00, 0xa0, 0xc9, 0x05, 0x5f, 0xc5 ); -DEFINE_GUID( GUID_BUS_TYPE_SERENUM, 0x77114a87L, 0x8944, 0x11d1, 0xbd, 0x90, 0x00, 0xa0, 0xc9, 0x06, 0xbe, 0x2d ); -DEFINE_GUID( GUID_BUS_TYPE_USB, 0x9d7debbcL, 0xc85d, 0x11d1, 0x9e, 0xb4, 0x00, 0x60, 0x08, 0xc3, 0xa1, 0x9a ); -#endif - -#if (NTDDI_VERSION >= NTDDI_WINXP) -DEFINE_GUID( GUID_BUS_TYPE_LPTENUM, 0xc4ca1000L, 0x2ddc, 0x11d5, 0xa1, 0x7a, 0x00, 0xc0, 0x4f, 0x60, 0x52, 0x4d ); -DEFINE_GUID( GUID_BUS_TYPE_USBPRINT, 0x441ee000L, 0x4342, 0x11d5, 0xa1, 0x84, 0x00, 0xc0, 0x4f, 0x60, 0x52, 0x4d ); -DEFINE_GUID( GUID_BUS_TYPE_DOT4PRT, 0x441ee001L, 0x4342, 0x11d5, 0xa1, 0x84, 0x00, 0xc0, 0x4f, 0x60, 0x52, 0x4d ); -DEFINE_GUID( GUID_BUS_TYPE_1394, 0xf74e73ebL, 0x9ac5, 0x45eb, 0xbe, 0x4d, 0x77, 0x2c, 0xc7, 0x1d, 0xdf, 0xb3 ); -DEFINE_GUID( GUID_BUS_TYPE_HID, 0xeeaf37d0L, 0x1963, 0x47c4, 0xaa, 0x48, 0x72, 0x47, 0x6d, 0xb7, 0xcf, 0x49 ); -DEFINE_GUID( GUID_BUS_TYPE_AVC, 0xc06ff265L, 0xae09, 0x48f0, 0x81, 0x2c, 0x16, 0x75, 0x3d, 0x7c, 0xba, 0x83 ); -DEFINE_GUID( GUID_BUS_TYPE_IRDA, 0x7ae17dc1L, 0xc944, 0x44d6, 0x88, 0x1f, 0x4c, 0x2e, 0x61, 0x05, 0x3b, 0xc1 ); -DEFINE_GUID( GUID_BUS_TYPE_SD, 0xe700cc04L, 0x4036, 0x4e89, 0x95, 0x79, 0x89, 0xeb, 0xf4, 0x5f, 0x00, 0xcd ); -#endif - -// -// Power management WMI guids for device control -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -DEFINE_GUID( GUID_POWER_DEVICE_ENABLE, 0x827c0a6fL, 0xfeb0, 0x11d0, 0xbd, 0x26, 0x00, 0xaa, 0x00, 0xb7, 0xb3, 0x2a ); -DEFINE_GUID( GUID_POWER_DEVICE_TIMEOUTS, 0xa45da735L, 0xfeb0, 0x11d0, 0xbd, 0x26, 0x00, 0xaa, 0x00, 0xb7, 0xb3, 0x2a ); -DEFINE_GUID( GUID_POWER_DEVICE_WAKE_ENABLE, 0xa9546a82L, 0xfeb0, 0x11d0, 0xbd, 0x26, 0x00, 0xaa, 0x00, 0xb7, 0xb3, 0x2a ); -#endif - -// -// User-Mode Driver Framework device events for detecting driver host crashes. -// - -#if (NTDDI_VERSION >= NTDDI_WINXP) -DEFINE_GUID( GUID_WUDF_DEVICE_HOST_PROBLEM, 0xc43d25bdL, 0x9346, 0x40ee, 0xa2, 0xd2, 0xd7, 0x0c, 0x15, 0xf8, 0xb7, 0x5b ); -#endif - -// -// Dynamic partitioning replace interface. -// - -#if (NTDDI_VERSION >= NTDDI_VISTA) -DEFINE_GUID(GUID_PARTITION_UNIT_INTERFACE_STANDARD, 0x52363f5bL, 0xd891, 0x429b, 0x81, 0x95, 0xae, 0xc5, 0xfe, 0xf6, 0x85, 0x3c); -#endif - - diff --git a/pub/ddk/wdmsec.h b/pub/ddk/wdmsec.h deleted file mode 100644 index 51e9307..0000000 --- a/pub/ddk/wdmsec.h +++ /dev/null @@ -1,446 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - wdmsec.h - -Abstract: - - This header exposes secuity routines to drivers that need them. - -Revision History: - ---*/ - -#ifndef _WDMSEC_H_ -#define _WDMSEC_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -// -// SDDL_DEVOBJ_KERNEL_ONLY is an "empty" ACL. User mode code (including -// processes running as system) cannot open the device. -// -// This could be used by a driver creating a raw WDM PDO. The INF would specify -// lighter security settings. Until the INF was processed, the device would -// be nonopenable by user mode code. -// -// Similarly, a legacy driver might use this ACL, and let its install app open -// the device up at runtime to individual users. The install app would update -// the class key with a very target ACL and reload the driver. The empty ACL -// would only kick in only if the driver was loaded without the appropriate -// security applied by the install app. -// -// In all of these cases, the default is strong security, lightened as -// necessary (just like chemistry, where the rule is "add acid to water, -// never water to acid"). -// -// Example usage: -// IoCreateDeviceSecure(..., &SDDL_DEVOBJ_KERNEL_ONLY, &Guid, ...); -// - -/* -DECLARE_CONST_UNICODE_STRING(SDDL_DEVOBJ_KERNEL_ONLY, L"D:P"); -*/ -extern const UNICODE_STRING SDDL_DEVOBJ_KERNEL_ONLY; - -// -// IoCreateDeviceSecure can be used to create a WDM PDO that initially can be -// opened only by kernel mode, at least until an INF is supplied. Note that -// IoCreateDeviceSecure should *never* be used for an FDO!!! -// -#define SDDL_DEVOBJ_INF_SUPPLIED SDDL_DEVOBJ_KERNEL_ONLY - -// -// SDDL_DEVOBJ_SYS_ALL is similar to SDDL_DEVOBJ_KERNEL_ONLY, except that in -// addition to kernel code, user mode code running as *SYSTEM* is also allowed -// to open the device for any access. -// -// A legacy driver might use this ACL to start with tight security settings, -// and let its service open the device up at runtime to individual users via -// SetFileSecurity API. In this case, the service would have to be running as -// system. -// -// (Note that the DEVOBJ SDDL strings in this file don't specify any -// inheritance. This is because inheritance isn't a valid concept for things -// behind a device object, like a file. As such, these SDDL strings would have -// to be modified with inheritance tokens like "OICI" to be used for things -// like registry keys or file. See the SDK's documentation on SDDL strings for -// more information.) -// - -/* -DECLARE_CONST_UNICODE_STRING(SDDL_DEVOBJ_SYS_ALL, L"D:P(A;;GA;;;SY)"); -*/ -extern const UNICODE_STRING SDDL_DEVOBJ_SYS_ALL; - - -// -// SDDL_DEVOBJ_SYS_ALL_ADM_ALL allows the kernel, system, and admin complete -// control over the device. No other users may access the device -// - -/* -DECLARE_CONST_UNICODE_STRING( - SDDL_DEVOBJ_SYS_ALL_ADM_ALL, - L"D:P(A;;GA;;;SY)(A;;GA;;;BA)" - ); -*/ -extern const UNICODE_STRING SDDL_DEVOBJ_SYS_ALL_ADM_ALL; - - -// -// SDDL_DEVOBJ_SYS_ALL_ADM_RX allows the kernel and system complete control -// over the device. By default the admin can only read from the device (the -// admin can of course override this manually). -// -// The X refers to traversal, meaning the access to the namespace *beneath* a -// device object. This only has an effect on storage stacks today. To lock down -// the namespace behind a device (for example, if the device doesn't _have_ a -// namespace), see the documentation on FILE_DEVICE_SECURE_OPEN flag to -// IoCreateDevice{Secure}. -// - -/* -DECLARE_CONST_UNICODE_STRING( - SDDL_DEVOBJ_SYS_ALL_ADM_RX, - L"D:P(A;;GA;;;SY)(A;;GRGX;;;BA)" - ); -*/ -extern const UNICODE_STRING SDDL_DEVOBJ_SYS_ALL_ADM_RX; - - -// -// SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_R allows the kernel and system complete -// control over the device. By default the admin can access the entire device, -// but cannot change the ACL (the admin must take control of the device first) -// -// Everyone (the WORLD SID) is given read access. "Untrusted" code *cannot* -// access the device (untrusted code might be code launched via the Run-As -// option in Explorer. By default, World does not cover Restricted code.) -// -// Also note that traversal access is not granted to normal users. As such, -// this might not be an appropriate descriptor for a storage device with a -// namespace. -// - -/* -DECLARE_CONST_UNICODE_STRING( - SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_R, - L"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;GR;;;WD)" - ); -*/ -extern const UNICODE_STRING SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_R; - - -// -// SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_R_RES_R allows the kernel and system -// complete control over the device. By default the admin can access the entire -// device, but cannot change the ACL (the admin must take control of the device -// first) -// -// Everyone (the WORLD SID) is given read access. In addition, "restricted" or -// "untrusted" code (the RES SID) is also allowed to access code. Untrusted -// code might be code launched via the Run-As option in Explorer. By default, -// World does not cover Restricted code. -// -// (Odd implementation detail: Due to the mechanics of restricting SIDs, the -// RES SID in an ACL should never exist outside the World SID). -// -// Also note that traversal access is not granted to normal users. As such, -// this might not be an appropriate descriptor for a storage device with a -// namespace. -// - -/* -DECLARE_CONST_UNICODE_STRING( - SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_R_RES_R, - L"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;GR;;;WD)(A;;GR;;;RC)" - ); -*/ -extern const UNICODE_STRING SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_R_RES_R; - - -// -// SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_RW_RES_R allows the kernel and system -// complete control over the device. By default the admin can access the entire -// device, but cannot change the ACL (the admin must take control of the device -// first) -// -// Everyone (the WORLD SID) can read or write to the device. However, -// "restricted" or "untrusted" code (the RES SID) can only read from the device. -// -// Also note that normal users are not given traversal accesss. It is probably -// unnecessary anyway, as most devices don't manage a seperate namespace -// (ie, they set FILE_DEVICE_SECURE_OPEN). -// - -/* -DECLARE_CONST_UNICODE_STRING( - SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_RW_RES_R, - L"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;GRGW;;;WD)(A;;GR;;;RC)" - ); -*/ -extern const UNICODE_STRING SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_RW_RES_R; - - -// -// SDDL_DEVOBJ_SYS_ALL_WORLD_RWX_RES_RWX allows the kernel and system complete -// control over the device. By default the admin can access the entire device, -// but cannot change the ACL (the admin must take control of the device first) -// -// Everyone else, including "restricted" or "untrusted" code can read or write -// to the device. Traversal beneath the device is also granted (removing it -// would only effect storage devices, except if the "bypass-traversal" -// privilege was revoked). -// - -/* -DECLARE_CONST_UNICODE_STRING( - SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_RWX_RES_RWX, - L"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;GRGWGX;;;WD)(A;;GRGWGX;;;RC)" - ); -*/ -extern const UNICODE_STRING SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_RWX_RES_RWX; - - -// -// SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_A is listed for completeness. This allows the -// kernel and system complete control over the device. By default the admin -// can access the entire device, but cannot change the ACL (the admin must take -// control of the device first) -// -// Everyone (the WORLD SID) can *append* data to the device. "Restricted" or -// "untrusted" code (the RES SID) cannot access the device. See ntioapi.h for -// the individual bit definitions of device rights. -// -// Note also that normal users can send neither read nor write IOCTLs (The read -// device data right is bit 0, the write device data right is bit 1 - neither -// bits are set below). -// - -/* -DECLARE_CONST_UNICODE_STRING( - SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_A, - L"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;0x0004;;;WD)" - ); - -extern const UNICODE_STRING SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_A; -*/ - - -// -// SDDL_DEVOBJ_SYS_ALL_ADM_ALL_WORLD_ALL_RES_ALL is listed for completeness. -// This ACL would give *any* user *total* access to the device, including the -// ability to change the ACL, locking out other users!!!!! -// -// As this ACL is really a *very* bad idea, it isn't exported by this library. -// Don't make an ACL like this! -// - -/* -DECLARE_CONST_UNICODE_STING( - SDDL_DEVOBJ_SYS_ALL_ADM_ALL_WORLD_ALL_RES_ALL, - "D:P(A;;GA;;;SY)(A;;GA;;;BA)(A;;GA;;;WD)(A;;GA;;;RC)" - ); - -extern const UNICODE_STRING SDDL_DEVOBJ_SYS_ALL_ADM_ALL_WORLD_ALL_RES_ALL; -*/ - -/* - - The following SIDs represent *accounts* on the local machine: - ------------------------------------------------------------- - - System ("SY", S-1-5-18, SECURITY_NT_AUTHORITY:SECURITY_LOCAL_SYSTEM_RID) - The OS itself (including its user mode components.) - - Local Service ("LS", S-1-5-19, SECURITY_NT_AUTHORITY:SECURITY_LOCAL_SERVICE_RID) - A predefined account for services that presents user credentials for local - resources and annonymous credentials for network access. - Available on XP and later. - - Network Service ("NS", S-1-5-20, SECURITY_NT_AUTHORITY:SECURITY_NETWORK_SERVICE_RID) - A predefined account for services that presents user credentials for local - resources and the machine ID for network access. - Available on XP and later. - - (A local *account* for a guest and a default administrator also exist, but - the corresponding SDDL abbreviations are not supported by this library. - Use the corresponding group SIDs instead.) - - - - The following SIDs represent *groups* on the local machine: - ----------------------------------------------------------- - - Administrators ("BA", S-1-5-32-544, SECURITY_NT_AUTHORITY:SECURITY_BUILTIN_DOMAIN_RID:DOMAIN_ALIAS_RID_ADMINS) - The builtin administrators group on the machine. This is not the same - as the builtin Administrator *account*. - - Builtin users group ("BU", S-1-5-32-545, SECURITY_NT_AUTHORITY:SECURITY_BUILTIN_DOMAIN_RID:DOMAIN_ALIAS_RID_USERS) - Group covering all local user accounts, and users on the domain. - - Builtin guests group ("BG", S-1-5-32-546, SECURITY_NT_AUTHORITY:SECURITY_BUILTIN_DOMAIN_RID:DOMAIN_ALIAS_RID_GUESTS) - Group covering users logging in using the local or domain guest account. - This is not the same as the builtin Guest *account*. - - - - The below SIDs describe the authenticity of the user's identity: - ---------------------------------------------------------------- - - Authenticated Users ("AU", S-1-5-11, SECURITY_NT_AUTHORITY:SECURITY_AUTHENTICATED_USER_RID) - Any user recognized by the local machine or by a domain. Note that - users logged in using the Builtin Guest account are not authenticated. - However, members of the Guests group with individual accounts on the - machine or domain are authenticated. - - Anonymous Logged-on User ("AN", S-1-5-7, SECURITY_NT_AUTHORITY:SECURITY_ANONYMOUS_LOGON_RID) - Any user logged on without an identity, for instance via an anonymous - network session. Note that users logged in using the Builtin Guest - account are neither authenticated nor anonymous. Available on XP and - later. - - World ("WD", S-1-1-0, SECURITY_WORLD_SID_AUTHORITY:SECURITY_WORLD_RID) - Prior to Windows XP, this SID covers every session: authenticated, - anonymous, and the Builtin Guest account. - - For Windows XP and later, this SID does not cover anonymous logon - sessions - only authenticated and the Builtin Guest account. - - Note that untrusted or "restricted" code is also not covered by the - World SID. See the Restricted Code SID description for more - information. - - - - The below SIDs describe how the user logged into the machine: - ------------------------------------------------------------- - - Interactive Users ("IU", S-1-5-4, SECURITY_NT_AUTHORITY:SECURITY_INTERACTIVE_RID) - Users who initally logged onto the machine "interactively", such as - local logons and Remote Desktops logons. - - Network Logon User ("NU", S-1-5-2, SECURITY_NT_AUTHORITY:SECURITY_NETWORK_RID) - Users accessing the machine remotely, without interactive desktop - access (ie, file sharing or RPC calls). - - Terminal Server Users (---, S-1-5-14, SECURITY_NT_AUTHORITY:SECURITY_TERMINAL_SERVER_RID) - Interactive Users who *initially* logged onto the machine specifically - via Terminal Services or Remote Desktop. - (NOTE: There is currently no SDDL token for this SID. Furthermore, the - presence of the SID doesn't take into account fast user switching - either.) - - - - The below SID deserves special mention: - --------------------------------------- - - Restricted Code ("RC", S-1-5-12, SECURITY_NT_AUTHORITY:SECURITY_RESTRICTED_CODE_RID) - This SID is used to control access by untrusted code. - - ACL validation against tokens with RC go through *two* checks, one - against the token's normal list of SIDs (containing WD for instance), - and one against a second list (typically containing RC and a subset of - the original token SIDs). Only if both tests pass is access granted. - As such, RC actually works in *combination* with other SIDs. - - When RC is paired with WD in an ACL, a *superset* of Everyone - _including_ untrusted code is described. RC is thus rarely seen in - ACL's without the WD token. - -*/ - - - - -// -// Supply overrideable library implementation of IoCreateDeviceSecure. -// This function is similar to IoCreateDevice, except that it only creates -// named device objects. This function would be used to create raw PnP PDOs and -// legacy device objects. The DefaultSDDLString specifies security while the -// ClassGuid allows the administrator to override the defaults. Every driver -// should pass in a ClassGuid (if no relevant Guid exists, just invent a new -// one with guidgen.exe). The classguid parameter is crucial as it allows the -// admin to tighten security (for instance, the admin might deny access to a -// specific user). -// -// Note: This function should *not* be used to create a WDM FDO or Filter. The -// only type of device object in a WDM stack that can be created using -// IoCreateDeviceSecure is a PDO! -// -// See DDK documentation for more details. -// -#undef IoCreateDeviceSecure -#define IoCreateDeviceSecure WdmlibIoCreateDeviceSecure - -__drv_maxIRQL(PASSIVE_LEVEL) -__drv_valueIs(==0;<0) -NTSTATUS -WdmlibIoCreateDeviceSecure( - __in PDRIVER_OBJECT DriverObject, - __in ULONG DeviceExtensionSize, - __in_opt PUNICODE_STRING DeviceName, - __in DEVICE_TYPE DeviceType, - __in ULONG DeviceCharacteristics, - __in BOOLEAN Exclusive, - __in PCUNICODE_STRING DefaultSDDLString, - __in_opt LPCGUID DeviceClassGuid, - __out - __drv_out_deref( - __drv_allocatesMem(Mem) - __drv_when((((inFunctionClass$("DRIVER_INITIALIZE")) - ||(inFunctionClass$("DRIVER_DISPATCH")))), - __drv_aliasesMem) - __on_failure(__null)) - PDEVICE_OBJECT *DeviceObject - ); - -// -// Supply library internal implementation of RtlInitUnicodeStringEx -// This function is similar to RtlInitUnicodeString, except that it handles the -// case where a string exceeds UNICODE_STRING_MAX_CHARS (it does not probe or -// check alignments though). -// -// See DDK documentation for more details. -// -#undef RtlInitUnicodeStringEx -#define RtlInitUnicodeStringEx WdmlibRtlInitUnicodeStringEx - -NTSTATUS -WdmlibRtlInitUnicodeStringEx( - __out PUNICODE_STRING DestinationString, - __in_opt PCWSTR SourceString - ); - -// -// Supply overrideable library implementation of IoValidateDeviceIoControlAccess -// This function allows a driver running on Server 2003 to process -// FILE_ANY_ACCESS IOCTLs as if they were FILE_READ_ACCESS, FILE_WRITE_ACCESS, -// or both. -// -// See DDK documentation for more details. -// -#undef IoValidateDeviceIoControlAccess -#define IoValidateDeviceIoControlAccess WdmlibIoValidateDeviceIoControlAccess - -NTSTATUS -WdmlibIoValidateDeviceIoControlAccess( - __in PIRP Irp, - __in ULONG RequiredAccess - ); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _WDMSEC_H_ - - diff --git a/pub/ddk/wdmwarn4.h b/pub/ddk/wdmwarn4.h deleted file mode 100644 index b0f0ad5..0000000 --- a/pub/ddk/wdmwarn4.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -Include before wdm.h to be able to compile at warning level 4 -*/ - -/* -4214 nonstandard extension used : bit field types other than int -4201 nonstandard extension using nameless struct/union -4115 nonstandard extension used : named type definition in parens -4200 nonstandard extension used : zero-sized array in struct/union -4514 unreferenced inline function -**4100 unreferenced formal parameter -4057 -4127 condition expression is constant -*/ - -#pragma warning(disable:4214 4201 4115 4200 4100 4514 4057 4127) - diff --git a/pub/ddk/wheaevents.h b/pub/ddk/wheaevents.h deleted file mode 100644 index e103bfe..0000000 --- a/pub/ddk/wheaevents.h +++ /dev/null @@ -1,61 +0,0 @@ -//**********************************************************************` -//* This is an include file generated by Message Compiler. *` -//* *` -//* Copyright (c) Microsoft Corporation. All Rights Reserved. *` -//**********************************************************************` -#pragma once -//+ -// Provider Microsoft-Windows-Kernel-WHEA Event Count 21 -//+ -EXTERN_C __declspec(selectany) const GUID WHEA_ETW_PROVIDER = {0x7b563579, 0x53c8, 0x44e7, {0x82, 0x36, 0x0f, 0x87, 0xb9, 0xfe, 0x65, 0x94}}; - -// -// Channel -// -#define WHEA_ETW_PROVIDER_CHANNEL_systemChannel 0x8 -#define WHEA_CHANNEL 0x10 -#define WHEA_INIT_CHANNEL 0x11 -// -// Keyword -// -#define WHEA_ERROR_KEYWORD 0x800 - -// -// Event Descriptors -// -EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR EVENT_WHEA_INIT_OP = {0x5, 0x0, 0x11, 0x4, 0x0, 0x0, 0x2000000000000000}; -#define EVENT_WHEA_INIT_OP_value 0x5 -EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR EVENT_WHEA_ERROR = {0x14, 0x0, 0x10, 0x4, 0x0, 0x0, 0x4000000000000800}; -#define EVENT_WHEA_ERROR_value 0x14 -EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR EVENT_WHEA_MEMORY_OFFLINE = {0x1f, 0x0, 0x10, 0x4, 0x0, 0x0, 0x4000000000000800}; -#define EVENT_WHEA_MEMORY_OFFLINE_value 0x1f -#define MSG_CorrectedError_EventMessage 0x00000001L -#define MSG_UncorrectedError_EventMessage 0x00000002L -#define MSG_MCAMemHierarchyErr_EventMessage 0x00000006L -#define MSG_MCATLBErr_EventMessage 0x00000008L -#define MSG_MCABusErr_EventMessage 0x0000000AL -#define MSG_MCABusTOErr_EventMessage 0x0000000CL -#define MSG_MCAWDTOErr_EventMessage 0x0000000EL -#define MSG_MCAExternalErr_EventMessage 0x00000010L -#define MSG_MCAFRCErr_EventMessage 0x00000011L -#define MSG_PCIeErr_EventMessage 0x00000012L -#define MSG_WHEA_ERROR_KEYWORD_KeywordMessage 0x1000000CL -#define MSG_eventProviderName 0x90000001L -#define MSG_Init_EventMessage 0xB0000005L -#define MSG_MCAMemHierarchyWrn_EventMessage 0xB0000007L -#define MSG_MCATLBWrn_EventMessage 0xB0000009L -#define MSG_MCABusWrn_EventMessage 0xB000000BL -#define MSG_MCABusTOWrn_EventMessage 0xB000000DL -#define MSG_MCAROMParityErr_EventMessage 0xB000000FL -#define MSG_PCIeWrn_EventMessage 0xB0000013L -#define MSG_WHEA_EventMessage 0xB0000014L -#define MSG_MemoryOffline_EventMessage 0xB000001FL -#define MSG_mapWHEAPending_No 0xD0000001L -#define MSG_mapWHEAPending_Yes 0xD0000002L -#define MSG_mapWHEAPlatformDirected_No 0xD0000003L -#define MSG_mapWHEAPlatformDirected_Yes 0xD0000004L -#define MSG_mapWHEAUncorrected_No 0xD0000005L -#define MSG_mapWHEAUncorrected_Yes 0xD0000006L -#define MSG_mapWHEAPersisted_No 0xD0000007L -#define MSG_mapWHEAPersisted_Yes 0xD0000008L - diff --git a/pub/ddk/wia_lh.h b/pub/ddk/wia_lh.h deleted file mode 100644 index fc7fb19..0000000 --- a/pub/ddk/wia_lh.h +++ /dev/null @@ -1,4755 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for wia_lh.idl, wia_lh.acf: - 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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __wia_lh_h__ -#define __wia_lh_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IWiaDevMgr_FWD_DEFINED__ -#define __IWiaDevMgr_FWD_DEFINED__ -typedef interface IWiaDevMgr IWiaDevMgr; -#endif /* __IWiaDevMgr_FWD_DEFINED__ */ - - -#ifndef __IEnumWIA_DEV_INFO_FWD_DEFINED__ -#define __IEnumWIA_DEV_INFO_FWD_DEFINED__ -typedef interface IEnumWIA_DEV_INFO IEnumWIA_DEV_INFO; -#endif /* __IEnumWIA_DEV_INFO_FWD_DEFINED__ */ - - -#ifndef __IWiaEventCallback_FWD_DEFINED__ -#define __IWiaEventCallback_FWD_DEFINED__ -typedef interface IWiaEventCallback IWiaEventCallback; -#endif /* __IWiaEventCallback_FWD_DEFINED__ */ - - -#ifndef __IWiaDataCallback_FWD_DEFINED__ -#define __IWiaDataCallback_FWD_DEFINED__ -typedef interface IWiaDataCallback IWiaDataCallback; -#endif /* __IWiaDataCallback_FWD_DEFINED__ */ - - -#ifndef __IWiaDataTransfer_FWD_DEFINED__ -#define __IWiaDataTransfer_FWD_DEFINED__ -typedef interface IWiaDataTransfer IWiaDataTransfer; -#endif /* __IWiaDataTransfer_FWD_DEFINED__ */ - - -#ifndef __IWiaItem_FWD_DEFINED__ -#define __IWiaItem_FWD_DEFINED__ -typedef interface IWiaItem IWiaItem; -#endif /* __IWiaItem_FWD_DEFINED__ */ - - -#ifndef __IWiaPropertyStorage_FWD_DEFINED__ -#define __IWiaPropertyStorage_FWD_DEFINED__ -typedef interface IWiaPropertyStorage IWiaPropertyStorage; -#endif /* __IWiaPropertyStorage_FWD_DEFINED__ */ - - -#ifndef __IEnumWiaItem_FWD_DEFINED__ -#define __IEnumWiaItem_FWD_DEFINED__ -typedef interface IEnumWiaItem IEnumWiaItem; -#endif /* __IEnumWiaItem_FWD_DEFINED__ */ - - -#ifndef __IEnumWIA_DEV_CAPS_FWD_DEFINED__ -#define __IEnumWIA_DEV_CAPS_FWD_DEFINED__ -typedef interface IEnumWIA_DEV_CAPS IEnumWIA_DEV_CAPS; -#endif /* __IEnumWIA_DEV_CAPS_FWD_DEFINED__ */ - - -#ifndef __IEnumWIA_FORMAT_INFO_FWD_DEFINED__ -#define __IEnumWIA_FORMAT_INFO_FWD_DEFINED__ -typedef interface IEnumWIA_FORMAT_INFO IEnumWIA_FORMAT_INFO; -#endif /* __IEnumWIA_FORMAT_INFO_FWD_DEFINED__ */ - - -#ifndef __IWiaLog_FWD_DEFINED__ -#define __IWiaLog_FWD_DEFINED__ -typedef interface IWiaLog IWiaLog; -#endif /* __IWiaLog_FWD_DEFINED__ */ - - -#ifndef __IWiaLogEx_FWD_DEFINED__ -#define __IWiaLogEx_FWD_DEFINED__ -typedef interface IWiaLogEx IWiaLogEx; -#endif /* __IWiaLogEx_FWD_DEFINED__ */ - - -#ifndef __IWiaNotifyDevMgr_FWD_DEFINED__ -#define __IWiaNotifyDevMgr_FWD_DEFINED__ -typedef interface IWiaNotifyDevMgr IWiaNotifyDevMgr; -#endif /* __IWiaNotifyDevMgr_FWD_DEFINED__ */ - - -#ifndef __IWiaItemExtras_FWD_DEFINED__ -#define __IWiaItemExtras_FWD_DEFINED__ -typedef interface IWiaItemExtras IWiaItemExtras; -#endif /* __IWiaItemExtras_FWD_DEFINED__ */ - - -#ifndef __IWiaAppErrorHandler_FWD_DEFINED__ -#define __IWiaAppErrorHandler_FWD_DEFINED__ -typedef interface IWiaAppErrorHandler IWiaAppErrorHandler; -#endif /* __IWiaAppErrorHandler_FWD_DEFINED__ */ - - -#ifndef __IWiaErrorHandler_FWD_DEFINED__ -#define __IWiaErrorHandler_FWD_DEFINED__ -typedef interface IWiaErrorHandler IWiaErrorHandler; -#endif /* __IWiaErrorHandler_FWD_DEFINED__ */ - - -#ifndef __IWiaTransfer_FWD_DEFINED__ -#define __IWiaTransfer_FWD_DEFINED__ -typedef interface IWiaTransfer IWiaTransfer; -#endif /* __IWiaTransfer_FWD_DEFINED__ */ - - -#ifndef __IWiaTransferCallback_FWD_DEFINED__ -#define __IWiaTransferCallback_FWD_DEFINED__ -typedef interface IWiaTransferCallback IWiaTransferCallback; -#endif /* __IWiaTransferCallback_FWD_DEFINED__ */ - - -#ifndef __IWiaSegmentationFilter_FWD_DEFINED__ -#define __IWiaSegmentationFilter_FWD_DEFINED__ -typedef interface IWiaSegmentationFilter IWiaSegmentationFilter; -#endif /* __IWiaSegmentationFilter_FWD_DEFINED__ */ - - -#ifndef __IWiaImageFilter_FWD_DEFINED__ -#define __IWiaImageFilter_FWD_DEFINED__ -typedef interface IWiaImageFilter IWiaImageFilter; -#endif /* __IWiaImageFilter_FWD_DEFINED__ */ - - -#ifndef __IWiaPreview_FWD_DEFINED__ -#define __IWiaPreview_FWD_DEFINED__ -typedef interface IWiaPreview IWiaPreview; -#endif /* __IWiaPreview_FWD_DEFINED__ */ - - -#ifndef __IEnumWiaItem2_FWD_DEFINED__ -#define __IEnumWiaItem2_FWD_DEFINED__ -typedef interface IEnumWiaItem2 IEnumWiaItem2; -#endif /* __IEnumWiaItem2_FWD_DEFINED__ */ - - -#ifndef __IWiaItem2_FWD_DEFINED__ -#define __IWiaItem2_FWD_DEFINED__ -typedef interface IWiaItem2 IWiaItem2; -#endif /* __IWiaItem2_FWD_DEFINED__ */ - - -#ifndef __IWiaDevMgr2_FWD_DEFINED__ -#define __IWiaDevMgr2_FWD_DEFINED__ -typedef interface IWiaDevMgr2 IWiaDevMgr2; -#endif /* __IWiaDevMgr2_FWD_DEFINED__ */ - - -#ifndef __WiaDevMgr_FWD_DEFINED__ -#define __WiaDevMgr_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class WiaDevMgr WiaDevMgr; -#else -typedef struct WiaDevMgr WiaDevMgr; -#endif /* __cplusplus */ - -#endif /* __WiaDevMgr_FWD_DEFINED__ */ - - -#ifndef __WiaDevMgr2_FWD_DEFINED__ -#define __WiaDevMgr2_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class WiaDevMgr2 WiaDevMgr2; -#else -typedef struct WiaDevMgr2 WiaDevMgr2; -#endif /* __cplusplus */ - -#endif /* __WiaDevMgr2_FWD_DEFINED__ */ - - -#ifndef __WiaLog_FWD_DEFINED__ -#define __WiaLog_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class WiaLog WiaLog; -#else -typedef struct WiaLog WiaLog; -#endif /* __cplusplus */ - -#endif /* __WiaLog_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "unknwn.h" -#include "oaidl.h" -#include "propidl.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_wia_lh_0000_0000 */ -/* [local] */ - - - - - - - - - - - - - - - - - - -typedef struct _WIA_DITHER_PATTERN_DATA - { - LONG lSize; - BSTR bstrPatternName; - LONG lPatternWidth; - LONG lPatternLength; - LONG cbPattern; - BYTE *pbPattern; - } WIA_DITHER_PATTERN_DATA; - -typedef struct _WIA_DITHER_PATTERN_DATA *PWIA_DITHER_PATTERN_DATA; - -typedef struct _WIA_PROPID_TO_NAME - { - PROPID propid; - LPOLESTR pszName; - } WIA_PROPID_TO_NAME; - -typedef struct _WIA_PROPID_TO_NAME *PWIA_PROPID_TO_NAME; - -typedef struct _WIA_FORMAT_INFO - { - GUID guidFormatID; - LONG lTymed; - } WIA_FORMAT_INFO; - -typedef struct _WIA_FORMAT_INFO *PWIA_FORMAT_INFO; - -#include "wiadef.h" - - -extern RPC_IF_HANDLE __MIDL_itf_wia_lh_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wia_lh_0000_0000_v0_0_s_ifspec; - -#ifndef __IWiaDevMgr_INTERFACE_DEFINED__ -#define __IWiaDevMgr_INTERFACE_DEFINED__ - -/* interface IWiaDevMgr */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaDevMgr; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("5eb2502a-8cf1-11d1-bf92-0060081ed811") - IWiaDevMgr : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumDeviceInfo( - /* [in] */ LONG lFlag, - /* [retval][out] */ __RPC__deref_out_opt IEnumWIA_DEV_INFO **ppIEnum) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE CreateDevice( - /* [in] */ BSTR bstrDeviceID, - /* [out] */ IWiaItem **ppWiaItemRoot) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE SelectDeviceDlg( - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ BSTR *pbstrDeviceID, - /* [retval][out] */ IWiaItem **ppItemRoot) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE SelectDeviceDlgID( - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ BSTR *pbstrDeviceID) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetImageDlg( - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [in] */ IWiaItem *pItemRoot, - /* [in] */ BSTR bstrFilename, - /* [out][in] */ GUID *pguidFormat) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE RegisterEventCallbackProgram( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [in] */ BSTR bstrCommandline, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE RegisterEventCallbackInterface( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ IWiaEventCallback *pIWiaEventCallback, - /* [out] */ IUnknown **pEventObject) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE RegisterEventCallbackCLSID( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ const GUID *pClsID, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AddDeviceDlg( - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lFlags) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaDevMgrVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaDevMgr * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaDevMgr * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumDeviceInfo )( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlag, - /* [retval][out] */ __RPC__deref_out_opt IEnumWIA_DEV_INFO **ppIEnum); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *CreateDevice )( - IWiaDevMgr * This, - /* [in] */ BSTR bstrDeviceID, - /* [out] */ IWiaItem **ppWiaItemRoot); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *SelectDeviceDlg )( - IWiaDevMgr * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ BSTR *pbstrDeviceID, - /* [retval][out] */ IWiaItem **ppItemRoot); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *SelectDeviceDlgID )( - IWiaDevMgr * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ BSTR *pbstrDeviceID); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetImageDlg )( - IWiaDevMgr * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [in] */ IWiaItem *pItemRoot, - /* [in] */ BSTR bstrFilename, - /* [out][in] */ GUID *pguidFormat); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *RegisterEventCallbackProgram )( - IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [in] */ BSTR bstrCommandline, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *RegisterEventCallbackInterface )( - IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ IWiaEventCallback *pIWiaEventCallback, - /* [out] */ IUnknown **pEventObject); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *RegisterEventCallbackCLSID )( - IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ const GUID *pClsID, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddDeviceDlg )( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lFlags); - - END_INTERFACE - } IWiaDevMgrVtbl; - - interface IWiaDevMgr - { - CONST_VTBL struct IWiaDevMgrVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaDevMgr_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaDevMgr_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaDevMgr_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaDevMgr_EnumDeviceInfo(This,lFlag,ppIEnum) \ - ( (This)->lpVtbl -> EnumDeviceInfo(This,lFlag,ppIEnum) ) - -#define IWiaDevMgr_CreateDevice(This,bstrDeviceID,ppWiaItemRoot) \ - ( (This)->lpVtbl -> CreateDevice(This,bstrDeviceID,ppWiaItemRoot) ) - -#define IWiaDevMgr_SelectDeviceDlg(This,hwndParent,lDeviceType,lFlags,pbstrDeviceID,ppItemRoot) \ - ( (This)->lpVtbl -> SelectDeviceDlg(This,hwndParent,lDeviceType,lFlags,pbstrDeviceID,ppItemRoot) ) - -#define IWiaDevMgr_SelectDeviceDlgID(This,hwndParent,lDeviceType,lFlags,pbstrDeviceID) \ - ( (This)->lpVtbl -> SelectDeviceDlgID(This,hwndParent,lDeviceType,lFlags,pbstrDeviceID) ) - -#define IWiaDevMgr_GetImageDlg(This,hwndParent,lDeviceType,lFlags,lIntent,pItemRoot,bstrFilename,pguidFormat) \ - ( (This)->lpVtbl -> GetImageDlg(This,hwndParent,lDeviceType,lFlags,lIntent,pItemRoot,bstrFilename,pguidFormat) ) - -#define IWiaDevMgr_RegisterEventCallbackProgram(This,lFlags,bstrDeviceID,pEventGUID,bstrCommandline,bstrName,bstrDescription,bstrIcon) \ - ( (This)->lpVtbl -> RegisterEventCallbackProgram(This,lFlags,bstrDeviceID,pEventGUID,bstrCommandline,bstrName,bstrDescription,bstrIcon) ) - -#define IWiaDevMgr_RegisterEventCallbackInterface(This,lFlags,bstrDeviceID,pEventGUID,pIWiaEventCallback,pEventObject) \ - ( (This)->lpVtbl -> RegisterEventCallbackInterface(This,lFlags,bstrDeviceID,pEventGUID,pIWiaEventCallback,pEventObject) ) - -#define IWiaDevMgr_RegisterEventCallbackCLSID(This,lFlags,bstrDeviceID,pEventGUID,pClsID,bstrName,bstrDescription,bstrIcon) \ - ( (This)->lpVtbl -> RegisterEventCallbackCLSID(This,lFlags,bstrDeviceID,pEventGUID,pClsID,bstrName,bstrDescription,bstrIcon) ) - -#define IWiaDevMgr_AddDeviceDlg(This,hwndParent,lFlags) \ - ( (This)->lpVtbl -> AddDeviceDlg(This,hwndParent,lFlags) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalCreateDevice_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppWiaItemRoot); - - -void __RPC_STUB IWiaDevMgr_LocalCreateDevice_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalSelectDeviceDlg_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ __RPC__deref_inout_opt BSTR *pbstrDeviceID, - /* [retval][out] */ __RPC__deref_out_opt IWiaItem **ppItemRoot); - - -void __RPC_STUB IWiaDevMgr_LocalSelectDeviceDlg_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalSelectDeviceDlgID_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrDeviceID); - - -void __RPC_STUB IWiaDevMgr_LocalSelectDeviceDlgID_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalGetImageDlg_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [in] */ __RPC__in_opt IWiaItem *pItemRoot, - /* [in] */ __RPC__in BSTR bstrFilename, - /* [out][in] */ __RPC__inout GUID *pguidFormat); - - -void __RPC_STUB IWiaDevMgr_LocalGetImageDlg_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalRegisterEventCallbackProgram_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrCommandline, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in BSTR bstrDescription, - /* [in] */ __RPC__in BSTR bstrIcon); - - -void __RPC_STUB IWiaDevMgr_LocalRegisterEventCallbackProgram_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalRegisterEventCallbackInterface_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [unique][in] */ __RPC__in_opt IWiaEventCallback *pIWiaEventCallback, - /* [out] */ __RPC__deref_out_opt IUnknown **pEventObject); - - -void __RPC_STUB IWiaDevMgr_LocalRegisterEventCallbackInterface_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalRegisterEventCallbackCLSID_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [unique][in] */ __RPC__in_opt const GUID *pClsID, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in BSTR bstrDescription, - /* [in] */ __RPC__in BSTR bstrIcon); - - -void __RPC_STUB IWiaDevMgr_LocalRegisterEventCallbackCLSID_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaDevMgr_INTERFACE_DEFINED__ */ - - -#ifndef __IEnumWIA_DEV_INFO_INTERFACE_DEFINED__ -#define __IEnumWIA_DEV_INFO_INTERFACE_DEFINED__ - -/* interface IEnumWIA_DEV_INFO */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IEnumWIA_DEV_INFO; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("5e38b83c-8cf1-11d1-bf92-0060081ed811") - IEnumWIA_DEV_INFO : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next( - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ IWiaPropertyStorage **rgelt, - /* [unique][out][in] */ ULONG *pceltFetched) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Skip( - /* [in] */ ULONG celt) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Clone( - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_INFO **ppIEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out ULONG *celt) = 0; - - }; - -#else /* C style interface */ - - typedef struct IEnumWIA_DEV_INFOVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IEnumWIA_DEV_INFO * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IEnumWIA_DEV_INFO * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IEnumWIA_DEV_INFO * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Next )( - IEnumWIA_DEV_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ IWiaPropertyStorage **rgelt, - /* [unique][out][in] */ ULONG *pceltFetched); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Skip )( - __RPC__in IEnumWIA_DEV_INFO * This, - /* [in] */ ULONG celt); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Reset )( - __RPC__in IEnumWIA_DEV_INFO * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Clone )( - __RPC__in IEnumWIA_DEV_INFO * This, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_INFO **ppIEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IEnumWIA_DEV_INFO * This, - /* [out] */ __RPC__out ULONG *celt); - - END_INTERFACE - } IEnumWIA_DEV_INFOVtbl; - - interface IEnumWIA_DEV_INFO - { - CONST_VTBL struct IEnumWIA_DEV_INFOVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IEnumWIA_DEV_INFO_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IEnumWIA_DEV_INFO_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IEnumWIA_DEV_INFO_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IEnumWIA_DEV_INFO_Next(This,celt,rgelt,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) - -#define IEnumWIA_DEV_INFO_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define IEnumWIA_DEV_INFO_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IEnumWIA_DEV_INFO_Clone(This,ppIEnum) \ - ( (This)->lpVtbl -> Clone(This,ppIEnum) ) - -#define IEnumWIA_DEV_INFO_GetCount(This,celt) \ - ( (This)->lpVtbl -> GetCount(This,celt) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWIA_DEV_INFO_RemoteNext_Proxy( - __RPC__in IEnumWIA_DEV_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) IWiaPropertyStorage **rgelt, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - - -void __RPC_STUB IEnumWIA_DEV_INFO_RemoteNext_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IEnumWIA_DEV_INFO_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaEventCallback_INTERFACE_DEFINED__ -#define __IWiaEventCallback_INTERFACE_DEFINED__ - -/* interface IWiaEventCallback */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaEventCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("ae6287b0-0084-11d2-973b-00a0c9068f2e") - IWiaEventCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ImageEventCallback( - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrEventDescription, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in BSTR bstrDeviceDescription, - /* [in] */ DWORD dwDeviceType, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out][in] */ __RPC__inout ULONG *pulEventType, - /* [in] */ ULONG ulReserved) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaEventCallbackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaEventCallback * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaEventCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaEventCallback * This); - - HRESULT ( STDMETHODCALLTYPE *ImageEventCallback )( - __RPC__in IWiaEventCallback * This, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrEventDescription, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in BSTR bstrDeviceDescription, - /* [in] */ DWORD dwDeviceType, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out][in] */ __RPC__inout ULONG *pulEventType, - /* [in] */ ULONG ulReserved); - - END_INTERFACE - } IWiaEventCallbackVtbl; - - interface IWiaEventCallback - { - CONST_VTBL struct IWiaEventCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaEventCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaEventCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaEventCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaEventCallback_ImageEventCallback(This,pEventGUID,bstrEventDescription,bstrDeviceID,bstrDeviceDescription,dwDeviceType,bstrFullItemName,pulEventType,ulReserved) \ - ( (This)->lpVtbl -> ImageEventCallback(This,pEventGUID,bstrEventDescription,bstrDeviceID,bstrDeviceDescription,dwDeviceType,bstrFullItemName,pulEventType,ulReserved) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaEventCallback_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_wia_lh_0000_0003 */ -/* [local] */ - -typedef struct _WIA_DATA_CALLBACK_HEADER - { - LONG lSize; - GUID guidFormatID; - LONG lBufferSize; - LONG lPageCount; - } WIA_DATA_CALLBACK_HEADER; - -typedef struct _WIA_DATA_CALLBACK_HEADER *PWIA_DATA_CALLBACK_HEADER; - - - -extern RPC_IF_HANDLE __MIDL_itf_wia_lh_0000_0003_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wia_lh_0000_0003_v0_0_s_ifspec; - -#ifndef __IWiaDataCallback_INTERFACE_DEFINED__ -#define __IWiaDataCallback_INTERFACE_DEFINED__ - -/* interface IWiaDataCallback */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaDataCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("a558a866-a5b0-11d2-a08f-00c04f72dc3c") - IWiaDataCallback : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE BandedDataCallback( - /* [in] */ LONG lMessage, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ LONG lReserved, - /* [in] */ LONG lResLength, - /* [size_is][in] */ BYTE *pbBuffer) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaDataCallbackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaDataCallback * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaDataCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaDataCallback * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *BandedDataCallback )( - IWiaDataCallback * This, - /* [in] */ LONG lMessage, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ LONG lReserved, - /* [in] */ LONG lResLength, - /* [size_is][in] */ BYTE *pbBuffer); - - END_INTERFACE - } IWiaDataCallbackVtbl; - - interface IWiaDataCallback - { - CONST_VTBL struct IWiaDataCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaDataCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaDataCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaDataCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaDataCallback_BandedDataCallback(This,lMessage,lStatus,lPercentComplete,lOffset,lLength,lReserved,lResLength,pbBuffer) \ - ( (This)->lpVtbl -> BandedDataCallback(This,lMessage,lStatus,lPercentComplete,lOffset,lLength,lReserved,lResLength,pbBuffer) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDataCallback_RemoteBandedDataCallback_Proxy( - __RPC__in IWiaDataCallback * This, - /* [in] */ LONG lMessage, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ LONG lReserved, - /* [in] */ LONG lResLength, - /* [unique][size_is][in] */ __RPC__in_ecount_full_opt(lResLength) BYTE *pbBuffer); - - -void __RPC_STUB IWiaDataCallback_RemoteBandedDataCallback_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaDataCallback_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_wia_lh_0000_0004 */ -/* [local] */ - -typedef struct _WIA_DATA_TRANSFER_INFO - { - ULONG ulSize; - ULONG ulSection; - ULONG ulBufferSize; - BOOL bDoubleBuffer; - ULONG ulReserved1; - ULONG ulReserved2; - ULONG ulReserved3; - } WIA_DATA_TRANSFER_INFO; - -typedef struct _WIA_DATA_TRANSFER_INFO *PWIA_DATA_TRANSFER_INFO; - -typedef struct _WIA_EXTENDED_TRANSFER_INFO - { - ULONG ulSize; - ULONG ulMinBufferSize; - ULONG ulOptimalBufferSize; - ULONG ulMaxBufferSize; - ULONG ulNumBuffers; - } WIA_EXTENDED_TRANSFER_INFO; - -typedef struct _WIA_EXTENDED_TRANSFER_INFO *PWIA_EXTENDED_TRANSFER_INFO; - - - -extern RPC_IF_HANDLE __MIDL_itf_wia_lh_0000_0004_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wia_lh_0000_0004_v0_0_s_ifspec; - -#ifndef __IWiaDataTransfer_INTERFACE_DEFINED__ -#define __IWiaDataTransfer_INTERFACE_DEFINED__ - -/* interface IWiaDataTransfer */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaDataTransfer; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("a6cef998-a5b0-11d2-a08f-00c04f72dc3c") - IWiaDataTransfer : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE idtGetData( - /* [out][in] */ LPSTGMEDIUM pMedium, - /* [unique][in] */ IWiaDataCallback *pIWiaDataCallback) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE idtGetBandedData( - /* [unique][in] */ PWIA_DATA_TRANSFER_INFO pWiaDataTransInfo, - /* [unique][in] */ IWiaDataCallback *pIWiaDataCallback) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE idtQueryGetData( - /* [unique][in] */ __RPC__in_opt WIA_FORMAT_INFO *pfe) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE idtEnumWIA_FORMAT_INFO( - /* [out] */ __RPC__deref_out_opt IEnumWIA_FORMAT_INFO **ppEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE idtGetExtendedTransferInfo( - /* [out] */ __RPC__out PWIA_EXTENDED_TRANSFER_INFO pExtendedTransferInfo) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaDataTransferVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaDataTransfer * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaDataTransfer * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaDataTransfer * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *idtGetData )( - IWiaDataTransfer * This, - /* [out][in] */ LPSTGMEDIUM pMedium, - /* [unique][in] */ IWiaDataCallback *pIWiaDataCallback); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *idtGetBandedData )( - IWiaDataTransfer * This, - /* [unique][in] */ PWIA_DATA_TRANSFER_INFO pWiaDataTransInfo, - /* [unique][in] */ IWiaDataCallback *pIWiaDataCallback); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *idtQueryGetData )( - __RPC__in IWiaDataTransfer * This, - /* [unique][in] */ __RPC__in_opt WIA_FORMAT_INFO *pfe); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *idtEnumWIA_FORMAT_INFO )( - __RPC__in IWiaDataTransfer * This, - /* [out] */ __RPC__deref_out_opt IEnumWIA_FORMAT_INFO **ppEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *idtGetExtendedTransferInfo )( - __RPC__in IWiaDataTransfer * This, - /* [out] */ __RPC__out PWIA_EXTENDED_TRANSFER_INFO pExtendedTransferInfo); - - END_INTERFACE - } IWiaDataTransferVtbl; - - interface IWiaDataTransfer - { - CONST_VTBL struct IWiaDataTransferVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaDataTransfer_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaDataTransfer_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaDataTransfer_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaDataTransfer_idtGetData(This,pMedium,pIWiaDataCallback) \ - ( (This)->lpVtbl -> idtGetData(This,pMedium,pIWiaDataCallback) ) - -#define IWiaDataTransfer_idtGetBandedData(This,pWiaDataTransInfo,pIWiaDataCallback) \ - ( (This)->lpVtbl -> idtGetBandedData(This,pWiaDataTransInfo,pIWiaDataCallback) ) - -#define IWiaDataTransfer_idtQueryGetData(This,pfe) \ - ( (This)->lpVtbl -> idtQueryGetData(This,pfe) ) - -#define IWiaDataTransfer_idtEnumWIA_FORMAT_INFO(This,ppEnum) \ - ( (This)->lpVtbl -> idtEnumWIA_FORMAT_INFO(This,ppEnum) ) - -#define IWiaDataTransfer_idtGetExtendedTransferInfo(This,pExtendedTransferInfo) \ - ( (This)->lpVtbl -> idtGetExtendedTransferInfo(This,pExtendedTransferInfo) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDataTransfer_idtGetDataEx_Proxy( - __RPC__in IWiaDataTransfer * This, - /* [out][in] */ __RPC__inout LPSTGMEDIUM pMedium, - /* [unique][in] */ __RPC__in_opt IWiaDataCallback *pIWiaDataCallback); - - -void __RPC_STUB IWiaDataTransfer_idtGetDataEx_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDataTransfer_idtGetBandedDataEx_Proxy( - __RPC__in IWiaDataTransfer * This, - /* [unique][in] */ __RPC__in_opt PWIA_DATA_TRANSFER_INFO pWiaDataTransInfo, - /* [unique][in] */ __RPC__in_opt IWiaDataCallback *pIWiaDataCallback); - - -void __RPC_STUB IWiaDataTransfer_idtGetBandedDataEx_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaDataTransfer_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaItem_INTERFACE_DEFINED__ -#define __IWiaItem_INTERFACE_DEFINED__ - -/* interface IWiaItem */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaItem; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4db1ad10-3391-11d2-9a33-00c04fa36145") - IWiaItem : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetItemType( - /* [out] */ __RPC__out LONG *pItemType) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AnalyzeItem( - /* [in] */ LONG lFlags) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumChildItems( - /* [out] */ __RPC__deref_out_opt IEnumWiaItem **ppIEnumWiaItem) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DeleteItem( - /* [in] */ LONG lFlags) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CreateChildItem( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrItemName, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppIWiaItem) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumRegisterEventInfo( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE FindItemByName( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppIWiaItem) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE DeviceDlg( - /* [in] */ HWND hwndParent, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [out] */ LONG *plItemCount, - /* [out] */ IWiaItem ***ppIWiaItem) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DeviceCommand( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in const GUID *pCmdGUID, - /* [out][in] */ __RPC__deref_inout_opt IWiaItem **pIWiaItem) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetRootItem( - /* [out] */ __RPC__deref_out_opt IWiaItem **ppIWiaItem) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumDeviceCapabilities( - /* [in] */ LONG lFlags, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnumWIA_DEV_CAPS) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DumpItemData( - /* [out] */ __RPC__deref_out_opt BSTR *bstrData) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DumpDrvItemData( - /* [out] */ __RPC__deref_out_opt BSTR *bstrData) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DumpTreeItemData( - /* [out] */ __RPC__deref_out_opt BSTR *bstrData) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Diagnostic( - /* [in] */ ULONG ulSize, - /* [size_is][in] */ __RPC__in_ecount_full(ulSize) BYTE *pBuffer) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaItemVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaItem * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaItem * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaItem * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetItemType )( - __RPC__in IWiaItem * This, - /* [out] */ __RPC__out LONG *pItemType); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *AnalyzeItem )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumChildItems )( - __RPC__in IWiaItem * This, - /* [out] */ __RPC__deref_out_opt IEnumWiaItem **ppIEnumWiaItem); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DeleteItem )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateChildItem )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrItemName, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppIWiaItem); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumRegisterEventInfo )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *FindItemByName )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppIWiaItem); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *DeviceDlg )( - IWiaItem * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [out] */ LONG *plItemCount, - /* [out] */ IWiaItem ***ppIWiaItem); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DeviceCommand )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in const GUID *pCmdGUID, - /* [out][in] */ __RPC__deref_inout_opt IWiaItem **pIWiaItem); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetRootItem )( - __RPC__in IWiaItem * This, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppIWiaItem); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumDeviceCapabilities )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnumWIA_DEV_CAPS); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpItemData )( - __RPC__in IWiaItem * This, - /* [out] */ __RPC__deref_out_opt BSTR *bstrData); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpDrvItemData )( - __RPC__in IWiaItem * This, - /* [out] */ __RPC__deref_out_opt BSTR *bstrData); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpTreeItemData )( - __RPC__in IWiaItem * This, - /* [out] */ __RPC__deref_out_opt BSTR *bstrData); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Diagnostic )( - __RPC__in IWiaItem * This, - /* [in] */ ULONG ulSize, - /* [size_is][in] */ __RPC__in_ecount_full(ulSize) BYTE *pBuffer); - - END_INTERFACE - } IWiaItemVtbl; - - interface IWiaItem - { - CONST_VTBL struct IWiaItemVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaItem_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaItem_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaItem_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaItem_GetItemType(This,pItemType) \ - ( (This)->lpVtbl -> GetItemType(This,pItemType) ) - -#define IWiaItem_AnalyzeItem(This,lFlags) \ - ( (This)->lpVtbl -> AnalyzeItem(This,lFlags) ) - -#define IWiaItem_EnumChildItems(This,ppIEnumWiaItem) \ - ( (This)->lpVtbl -> EnumChildItems(This,ppIEnumWiaItem) ) - -#define IWiaItem_DeleteItem(This,lFlags) \ - ( (This)->lpVtbl -> DeleteItem(This,lFlags) ) - -#define IWiaItem_CreateChildItem(This,lFlags,bstrItemName,bstrFullItemName,ppIWiaItem) \ - ( (This)->lpVtbl -> CreateChildItem(This,lFlags,bstrItemName,bstrFullItemName,ppIWiaItem) ) - -#define IWiaItem_EnumRegisterEventInfo(This,lFlags,pEventGUID,ppIEnum) \ - ( (This)->lpVtbl -> EnumRegisterEventInfo(This,lFlags,pEventGUID,ppIEnum) ) - -#define IWiaItem_FindItemByName(This,lFlags,bstrFullItemName,ppIWiaItem) \ - ( (This)->lpVtbl -> FindItemByName(This,lFlags,bstrFullItemName,ppIWiaItem) ) - -#define IWiaItem_DeviceDlg(This,hwndParent,lFlags,lIntent,plItemCount,ppIWiaItem) \ - ( (This)->lpVtbl -> DeviceDlg(This,hwndParent,lFlags,lIntent,plItemCount,ppIWiaItem) ) - -#define IWiaItem_DeviceCommand(This,lFlags,pCmdGUID,pIWiaItem) \ - ( (This)->lpVtbl -> DeviceCommand(This,lFlags,pCmdGUID,pIWiaItem) ) - -#define IWiaItem_GetRootItem(This,ppIWiaItem) \ - ( (This)->lpVtbl -> GetRootItem(This,ppIWiaItem) ) - -#define IWiaItem_EnumDeviceCapabilities(This,lFlags,ppIEnumWIA_DEV_CAPS) \ - ( (This)->lpVtbl -> EnumDeviceCapabilities(This,lFlags,ppIEnumWIA_DEV_CAPS) ) - -#define IWiaItem_DumpItemData(This,bstrData) \ - ( (This)->lpVtbl -> DumpItemData(This,bstrData) ) - -#define IWiaItem_DumpDrvItemData(This,bstrData) \ - ( (This)->lpVtbl -> DumpDrvItemData(This,bstrData) ) - -#define IWiaItem_DumpTreeItemData(This,bstrData) \ - ( (This)->lpVtbl -> DumpTreeItemData(This,bstrData) ) - -#define IWiaItem_Diagnostic(This,ulSize,pBuffer) \ - ( (This)->lpVtbl -> Diagnostic(This,ulSize,pBuffer) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaItem_LocalDeviceDlg_Proxy( - __RPC__in IWiaItem * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [out] */ __RPC__out LONG *plItemCount, - /* [out] */ __RPC__deref_out_opt IWiaItem ***pIWiaItem); - - -void __RPC_STUB IWiaItem_LocalDeviceDlg_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaItem_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaPropertyStorage_INTERFACE_DEFINED__ -#define __IWiaPropertyStorage_INTERFACE_DEFINED__ - -/* interface IWiaPropertyStorage */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaPropertyStorage; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("98B5E8A0-29CC-491a-AAC0-E6DB4FDCCEB6") - IWiaPropertyStorage : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ReadMultiple( - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpspec) PROPVARIANT rgpropvar[ ]) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE WriteMultiple( - /* [in] */ ULONG cpspec, - /* [size_is][in] */ const PROPSPEC rgpspec[ ], - /* [size_is][in] */ const PROPVARIANT rgpropvar[ ], - /* [in] */ PROPID propidNameFirst) = 0; - - virtual HRESULT STDMETHODCALLTYPE DeleteMultiple( - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE ReadPropertyNames( - /* [in] */ ULONG cpropid, - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpropid) LPOLESTR rglpwstrName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE WritePropertyNames( - /* [in] */ ULONG cpropid, - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[ ], - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const LPOLESTR rglpwstrName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE DeletePropertyNames( - /* [in] */ ULONG cpropid, - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE Commit( - /* [in] */ DWORD grfCommitFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE Revert( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Enum( - /* [out] */ __RPC__deref_out_opt IEnumSTATPROPSTG **ppenum) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetTimes( - /* [in] */ __RPC__in const FILETIME *pctime, - /* [in] */ __RPC__in const FILETIME *patime, - /* [in] */ __RPC__in const FILETIME *pmtime) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetClass( - /* [in] */ __RPC__in REFCLSID clsid) = 0; - - virtual HRESULT STDMETHODCALLTYPE Stat( - /* [out] */ __RPC__out STATPROPSETSTG *pstatpsstg) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetPropertyAttributes( - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) PROPSPEC rgpspec[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpspec) ULONG rgflags[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpspec) PROPVARIANT rgpropvar[ ]) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out ULONG *pulNumProps) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetPropertyStream( - /* [out] */ __RPC__out GUID *pCompatibilityId, - /* [out] */ __RPC__deref_out_opt IStream **ppIStream) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetPropertyStream( - /* [in] */ GUID *pCompatibilityId, - /* [unique][in] */ IStream *pIStream) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaPropertyStorageVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaPropertyStorage * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaPropertyStorage * This); - - HRESULT ( STDMETHODCALLTYPE *ReadMultiple )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpspec) PROPVARIANT rgpropvar[ ]); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *WriteMultiple )( - IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ const PROPSPEC rgpspec[ ], - /* [size_is][in] */ const PROPVARIANT rgpropvar[ ], - /* [in] */ PROPID propidNameFirst); - - HRESULT ( STDMETHODCALLTYPE *DeleteMultiple )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[ ]); - - HRESULT ( STDMETHODCALLTYPE *ReadPropertyNames )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpropid, - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpropid) LPOLESTR rglpwstrName[ ]); - - HRESULT ( STDMETHODCALLTYPE *WritePropertyNames )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpropid, - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[ ], - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const LPOLESTR rglpwstrName[ ]); - - HRESULT ( STDMETHODCALLTYPE *DeletePropertyNames )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpropid, - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[ ]); - - HRESULT ( STDMETHODCALLTYPE *Commit )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ DWORD grfCommitFlags); - - HRESULT ( STDMETHODCALLTYPE *Revert )( - __RPC__in IWiaPropertyStorage * This); - - HRESULT ( STDMETHODCALLTYPE *Enum )( - __RPC__in IWiaPropertyStorage * This, - /* [out] */ __RPC__deref_out_opt IEnumSTATPROPSTG **ppenum); - - HRESULT ( STDMETHODCALLTYPE *SetTimes )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ __RPC__in const FILETIME *pctime, - /* [in] */ __RPC__in const FILETIME *patime, - /* [in] */ __RPC__in const FILETIME *pmtime); - - HRESULT ( STDMETHODCALLTYPE *SetClass )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ __RPC__in REFCLSID clsid); - - HRESULT ( STDMETHODCALLTYPE *Stat )( - __RPC__in IWiaPropertyStorage * This, - /* [out] */ __RPC__out STATPROPSETSTG *pstatpsstg); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPropertyAttributes )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) PROPSPEC rgpspec[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpspec) ULONG rgflags[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpspec) PROPVARIANT rgpropvar[ ]); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IWiaPropertyStorage * This, - /* [out] */ __RPC__out ULONG *pulNumProps); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPropertyStream )( - __RPC__in IWiaPropertyStorage * This, - /* [out] */ __RPC__out GUID *pCompatibilityId, - /* [out] */ __RPC__deref_out_opt IStream **ppIStream); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetPropertyStream )( - IWiaPropertyStorage * This, - /* [in] */ GUID *pCompatibilityId, - /* [unique][in] */ IStream *pIStream); - - END_INTERFACE - } IWiaPropertyStorageVtbl; - - interface IWiaPropertyStorage - { - CONST_VTBL struct IWiaPropertyStorageVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaPropertyStorage_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaPropertyStorage_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaPropertyStorage_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaPropertyStorage_ReadMultiple(This,cpspec,rgpspec,rgpropvar) \ - ( (This)->lpVtbl -> ReadMultiple(This,cpspec,rgpspec,rgpropvar) ) - -#define IWiaPropertyStorage_WriteMultiple(This,cpspec,rgpspec,rgpropvar,propidNameFirst) \ - ( (This)->lpVtbl -> WriteMultiple(This,cpspec,rgpspec,rgpropvar,propidNameFirst) ) - -#define IWiaPropertyStorage_DeleteMultiple(This,cpspec,rgpspec) \ - ( (This)->lpVtbl -> DeleteMultiple(This,cpspec,rgpspec) ) - -#define IWiaPropertyStorage_ReadPropertyNames(This,cpropid,rgpropid,rglpwstrName) \ - ( (This)->lpVtbl -> ReadPropertyNames(This,cpropid,rgpropid,rglpwstrName) ) - -#define IWiaPropertyStorage_WritePropertyNames(This,cpropid,rgpropid,rglpwstrName) \ - ( (This)->lpVtbl -> WritePropertyNames(This,cpropid,rgpropid,rglpwstrName) ) - -#define IWiaPropertyStorage_DeletePropertyNames(This,cpropid,rgpropid) \ - ( (This)->lpVtbl -> DeletePropertyNames(This,cpropid,rgpropid) ) - -#define IWiaPropertyStorage_Commit(This,grfCommitFlags) \ - ( (This)->lpVtbl -> Commit(This,grfCommitFlags) ) - -#define IWiaPropertyStorage_Revert(This) \ - ( (This)->lpVtbl -> Revert(This) ) - -#define IWiaPropertyStorage_Enum(This,ppenum) \ - ( (This)->lpVtbl -> Enum(This,ppenum) ) - -#define IWiaPropertyStorage_SetTimes(This,pctime,patime,pmtime) \ - ( (This)->lpVtbl -> SetTimes(This,pctime,patime,pmtime) ) - -#define IWiaPropertyStorage_SetClass(This,clsid) \ - ( (This)->lpVtbl -> SetClass(This,clsid) ) - -#define IWiaPropertyStorage_Stat(This,pstatpsstg) \ - ( (This)->lpVtbl -> Stat(This,pstatpsstg) ) - -#define IWiaPropertyStorage_GetPropertyAttributes(This,cpspec,rgpspec,rgflags,rgpropvar) \ - ( (This)->lpVtbl -> GetPropertyAttributes(This,cpspec,rgpspec,rgflags,rgpropvar) ) - -#define IWiaPropertyStorage_GetCount(This,pulNumProps) \ - ( (This)->lpVtbl -> GetCount(This,pulNumProps) ) - -#define IWiaPropertyStorage_GetPropertyStream(This,pCompatibilityId,ppIStream) \ - ( (This)->lpVtbl -> GetPropertyStream(This,pCompatibilityId,ppIStream) ) - -#define IWiaPropertyStorage_SetPropertyStream(This,pCompatibilityId,pIStream) \ - ( (This)->lpVtbl -> SetPropertyStream(This,pCompatibilityId,pIStream) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [call_as] */ HRESULT STDMETHODCALLTYPE IWiaPropertyStorage_RemoteWriteMultiple_Proxy( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC *rgpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPVARIANT *rgpropvar, - /* [in] */ PROPID propidNameFirst); - - -void __RPC_STUB IWiaPropertyStorage_RemoteWriteMultiple_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaPropertyStorage_RemoteSetPropertyStream_Proxy( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ __RPC__in GUID *pCompatibilityId, - /* [unique][in] */ __RPC__in_opt IStream *pIStream); - - -void __RPC_STUB IWiaPropertyStorage_RemoteSetPropertyStream_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaPropertyStorage_INTERFACE_DEFINED__ */ - - -#ifndef __IEnumWiaItem_INTERFACE_DEFINED__ -#define __IEnumWiaItem_INTERFACE_DEFINED__ - -/* interface IEnumWiaItem */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IEnumWiaItem; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("5e8383fc-3391-11d2-9a33-00c04fa36145") - IEnumWiaItem : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next( - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ IWiaItem **ppIWiaItem, - /* [unique][out][in] */ ULONG *pceltFetched) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Skip( - /* [in] */ ULONG celt) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Clone( - /* [out] */ __RPC__deref_out_opt IEnumWiaItem **ppIEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out ULONG *celt) = 0; - - }; - -#else /* C style interface */ - - typedef struct IEnumWiaItemVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IEnumWiaItem * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IEnumWiaItem * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IEnumWiaItem * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Next )( - IEnumWiaItem * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ IWiaItem **ppIWiaItem, - /* [unique][out][in] */ ULONG *pceltFetched); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Skip )( - __RPC__in IEnumWiaItem * This, - /* [in] */ ULONG celt); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Reset )( - __RPC__in IEnumWiaItem * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Clone )( - __RPC__in IEnumWiaItem * This, - /* [out] */ __RPC__deref_out_opt IEnumWiaItem **ppIEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IEnumWiaItem * This, - /* [out] */ __RPC__out ULONG *celt); - - END_INTERFACE - } IEnumWiaItemVtbl; - - interface IEnumWiaItem - { - CONST_VTBL struct IEnumWiaItemVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IEnumWiaItem_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IEnumWiaItem_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IEnumWiaItem_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IEnumWiaItem_Next(This,celt,ppIWiaItem,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,ppIWiaItem,pceltFetched) ) - -#define IEnumWiaItem_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define IEnumWiaItem_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IEnumWiaItem_Clone(This,ppIEnum) \ - ( (This)->lpVtbl -> Clone(This,ppIEnum) ) - -#define IEnumWiaItem_GetCount(This,celt) \ - ( (This)->lpVtbl -> GetCount(This,celt) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWiaItem_RemoteNext_Proxy( - __RPC__in IEnumWiaItem * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) IWiaItem **ppIWiaItem, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - - -void __RPC_STUB IEnumWiaItem_RemoteNext_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IEnumWiaItem_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_wia_lh_0000_0008 */ -/* [local] */ - -typedef struct _WIA_DEV_CAP - { - GUID guid; - ULONG ulFlags; - BSTR bstrName; - BSTR bstrDescription; - BSTR bstrIcon; - BSTR bstrCommandline; - } WIA_DEV_CAP; - -typedef struct _WIA_DEV_CAP *PWIA_DEV_CAP; - -typedef struct _WIA_DEV_CAP WIA_EVENT_HANDLER; - -typedef struct _WIA_DEV_CAP *PWIA_EVENT_HANDLER; - - - -extern RPC_IF_HANDLE __MIDL_itf_wia_lh_0000_0008_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wia_lh_0000_0008_v0_0_s_ifspec; - -#ifndef __IEnumWIA_DEV_CAPS_INTERFACE_DEFINED__ -#define __IEnumWIA_DEV_CAPS_INTERFACE_DEFINED__ - -/* interface IEnumWIA_DEV_CAPS */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IEnumWIA_DEV_CAPS; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1fcc4287-aca6-11d2-a093-00c04f72dc3c") - IEnumWIA_DEV_CAPS : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next( - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ WIA_DEV_CAP *rgelt, - /* [unique][out][in] */ ULONG *pceltFetched) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Skip( - /* [in] */ ULONG celt) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Clone( - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out ULONG *pcelt) = 0; - - }; - -#else /* C style interface */ - - typedef struct IEnumWIA_DEV_CAPSVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IEnumWIA_DEV_CAPS * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IEnumWIA_DEV_CAPS * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IEnumWIA_DEV_CAPS * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Next )( - IEnumWIA_DEV_CAPS * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ WIA_DEV_CAP *rgelt, - /* [unique][out][in] */ ULONG *pceltFetched); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Skip )( - __RPC__in IEnumWIA_DEV_CAPS * This, - /* [in] */ ULONG celt); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Reset )( - __RPC__in IEnumWIA_DEV_CAPS * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Clone )( - __RPC__in IEnumWIA_DEV_CAPS * This, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IEnumWIA_DEV_CAPS * This, - /* [out] */ __RPC__out ULONG *pcelt); - - END_INTERFACE - } IEnumWIA_DEV_CAPSVtbl; - - interface IEnumWIA_DEV_CAPS - { - CONST_VTBL struct IEnumWIA_DEV_CAPSVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IEnumWIA_DEV_CAPS_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IEnumWIA_DEV_CAPS_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IEnumWIA_DEV_CAPS_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IEnumWIA_DEV_CAPS_Next(This,celt,rgelt,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) - -#define IEnumWIA_DEV_CAPS_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define IEnumWIA_DEV_CAPS_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IEnumWIA_DEV_CAPS_Clone(This,ppIEnum) \ - ( (This)->lpVtbl -> Clone(This,ppIEnum) ) - -#define IEnumWIA_DEV_CAPS_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWIA_DEV_CAPS_RemoteNext_Proxy( - __RPC__in IEnumWIA_DEV_CAPS * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) WIA_DEV_CAP *rgelt, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - - -void __RPC_STUB IEnumWIA_DEV_CAPS_RemoteNext_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IEnumWIA_DEV_CAPS_INTERFACE_DEFINED__ */ - - -#ifndef __IEnumWIA_FORMAT_INFO_INTERFACE_DEFINED__ -#define __IEnumWIA_FORMAT_INFO_INTERFACE_DEFINED__ - -/* interface IEnumWIA_FORMAT_INFO */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IEnumWIA_FORMAT_INFO; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("81BEFC5B-656D-44f1-B24C-D41D51B4DC81") - IEnumWIA_FORMAT_INFO : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next( - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ WIA_FORMAT_INFO *rgelt, - /* [unique][out][in] */ ULONG *pceltFetched) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Skip( - /* [in] */ ULONG celt) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Clone( - /* [out] */ __RPC__deref_out_opt IEnumWIA_FORMAT_INFO **ppIEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out ULONG *pcelt) = 0; - - }; - -#else /* C style interface */ - - typedef struct IEnumWIA_FORMAT_INFOVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IEnumWIA_FORMAT_INFO * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IEnumWIA_FORMAT_INFO * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IEnumWIA_FORMAT_INFO * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Next )( - IEnumWIA_FORMAT_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ WIA_FORMAT_INFO *rgelt, - /* [unique][out][in] */ ULONG *pceltFetched); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Skip )( - __RPC__in IEnumWIA_FORMAT_INFO * This, - /* [in] */ ULONG celt); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Reset )( - __RPC__in IEnumWIA_FORMAT_INFO * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Clone )( - __RPC__in IEnumWIA_FORMAT_INFO * This, - /* [out] */ __RPC__deref_out_opt IEnumWIA_FORMAT_INFO **ppIEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IEnumWIA_FORMAT_INFO * This, - /* [out] */ __RPC__out ULONG *pcelt); - - END_INTERFACE - } IEnumWIA_FORMAT_INFOVtbl; - - interface IEnumWIA_FORMAT_INFO - { - CONST_VTBL struct IEnumWIA_FORMAT_INFOVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IEnumWIA_FORMAT_INFO_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IEnumWIA_FORMAT_INFO_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IEnumWIA_FORMAT_INFO_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IEnumWIA_FORMAT_INFO_Next(This,celt,rgelt,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) - -#define IEnumWIA_FORMAT_INFO_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define IEnumWIA_FORMAT_INFO_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IEnumWIA_FORMAT_INFO_Clone(This,ppIEnum) \ - ( (This)->lpVtbl -> Clone(This,ppIEnum) ) - -#define IEnumWIA_FORMAT_INFO_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWIA_FORMAT_INFO_RemoteNext_Proxy( - __RPC__in IEnumWIA_FORMAT_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) WIA_FORMAT_INFO *rgelt, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - - -void __RPC_STUB IEnumWIA_FORMAT_INFO_RemoteNext_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IEnumWIA_FORMAT_INFO_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaLog_INTERFACE_DEFINED__ -#define __IWiaLog_INTERFACE_DEFINED__ - -/* interface IWiaLog */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaLog; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("A00C10B6-82A1-452f-8B6C-86062AAD6890") - IWiaLog : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE InitializeLog( - /* [in] */ LONG hInstance) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE hResult( - /* [in] */ HRESULT hResult) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Log( - /* [in] */ LONG lFlags, - /* [in] */ LONG lResID, - /* [in] */ LONG lDetail, - /* [in] */ __RPC__in BSTR bstrText) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaLogVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaLog * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaLog * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaLog * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *InitializeLog )( - __RPC__in IWiaLog * This, - /* [in] */ LONG hInstance); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *hResult )( - __RPC__in IWiaLog * This, - /* [in] */ HRESULT hResult); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Log )( - __RPC__in IWiaLog * This, - /* [in] */ LONG lFlags, - /* [in] */ LONG lResID, - /* [in] */ LONG lDetail, - /* [in] */ __RPC__in BSTR bstrText); - - END_INTERFACE - } IWiaLogVtbl; - - interface IWiaLog - { - CONST_VTBL struct IWiaLogVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaLog_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaLog_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaLog_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaLog_InitializeLog(This,hInstance) \ - ( (This)->lpVtbl -> InitializeLog(This,hInstance) ) - -#define IWiaLog_hResult(This,hResult) \ - ( (This)->lpVtbl -> hResult(This,hResult) ) - -#define IWiaLog_Log(This,lFlags,lResID,lDetail,bstrText) \ - ( (This)->lpVtbl -> Log(This,lFlags,lResID,lDetail,bstrText) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaLog_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaLogEx_INTERFACE_DEFINED__ -#define __IWiaLogEx_INTERFACE_DEFINED__ - -/* interface IWiaLogEx */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaLogEx; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("AF1F22AC-7A40-4787-B421-AEb47A1FBD0B") - IWiaLogEx : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE InitializeLogEx( - /* [in] */ __RPC__in BYTE *hInstance) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE hResult( - /* [in] */ HRESULT hResult) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Log( - /* [in] */ LONG lFlags, - /* [in] */ LONG lResID, - /* [in] */ LONG lDetail, - /* [in] */ __RPC__in BSTR bstrText) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE hResultEx( - /* [in] */ LONG lMethodId, - /* [in] */ HRESULT hResult) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE LogEx( - /* [in] */ LONG lMethodId, - /* [in] */ LONG lFlags, - /* [in] */ LONG lResID, - /* [in] */ LONG lDetail, - /* [in] */ __RPC__in BSTR bstrText) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaLogExVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaLogEx * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaLogEx * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaLogEx * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *InitializeLogEx )( - __RPC__in IWiaLogEx * This, - /* [in] */ __RPC__in BYTE *hInstance); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *hResult )( - __RPC__in IWiaLogEx * This, - /* [in] */ HRESULT hResult); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Log )( - __RPC__in IWiaLogEx * This, - /* [in] */ LONG lFlags, - /* [in] */ LONG lResID, - /* [in] */ LONG lDetail, - /* [in] */ __RPC__in BSTR bstrText); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *hResultEx )( - __RPC__in IWiaLogEx * This, - /* [in] */ LONG lMethodId, - /* [in] */ HRESULT hResult); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *LogEx )( - __RPC__in IWiaLogEx * This, - /* [in] */ LONG lMethodId, - /* [in] */ LONG lFlags, - /* [in] */ LONG lResID, - /* [in] */ LONG lDetail, - /* [in] */ __RPC__in BSTR bstrText); - - END_INTERFACE - } IWiaLogExVtbl; - - interface IWiaLogEx - { - CONST_VTBL struct IWiaLogExVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaLogEx_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaLogEx_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaLogEx_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaLogEx_InitializeLogEx(This,hInstance) \ - ( (This)->lpVtbl -> InitializeLogEx(This,hInstance) ) - -#define IWiaLogEx_hResult(This,hResult) \ - ( (This)->lpVtbl -> hResult(This,hResult) ) - -#define IWiaLogEx_Log(This,lFlags,lResID,lDetail,bstrText) \ - ( (This)->lpVtbl -> Log(This,lFlags,lResID,lDetail,bstrText) ) - -#define IWiaLogEx_hResultEx(This,lMethodId,hResult) \ - ( (This)->lpVtbl -> hResultEx(This,lMethodId,hResult) ) - -#define IWiaLogEx_LogEx(This,lMethodId,lFlags,lResID,lDetail,bstrText) \ - ( (This)->lpVtbl -> LogEx(This,lMethodId,lFlags,lResID,lDetail,bstrText) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaLogEx_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaNotifyDevMgr_INTERFACE_DEFINED__ -#define __IWiaNotifyDevMgr_INTERFACE_DEFINED__ - -/* interface IWiaNotifyDevMgr */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaNotifyDevMgr; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("70681EA0-E7BF-4291-9FB1-4E8813A3F78E") - IWiaNotifyDevMgr : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE NewDeviceArrival( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaNotifyDevMgrVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaNotifyDevMgr * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaNotifyDevMgr * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaNotifyDevMgr * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *NewDeviceArrival )( - __RPC__in IWiaNotifyDevMgr * This); - - END_INTERFACE - } IWiaNotifyDevMgrVtbl; - - interface IWiaNotifyDevMgr - { - CONST_VTBL struct IWiaNotifyDevMgrVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaNotifyDevMgr_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaNotifyDevMgr_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaNotifyDevMgr_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaNotifyDevMgr_NewDeviceArrival(This) \ - ( (This)->lpVtbl -> NewDeviceArrival(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaNotifyDevMgr_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaItemExtras_INTERFACE_DEFINED__ -#define __IWiaItemExtras_INTERFACE_DEFINED__ - -/* interface IWiaItemExtras */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaItemExtras; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6291ef2c-36ef-4532-876a-8e132593778d") - IWiaItemExtras : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetExtendedErrorInfo( - /* [out] */ __RPC__deref_out_opt BSTR *bstrErrorText) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Escape( - /* [in] */ DWORD dwEscapeCode, - /* [size_is][in] */ __RPC__in_ecount_full(cbInDataSize) BYTE *lpInData, - /* [in] */ DWORD cbInDataSize, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(dwOutDataSize, pdwActualDataSize ? *pdwActualDataSize : dwOutDataSize) BYTE *pOutData, - /* [in] */ DWORD dwOutDataSize, - /* [out] */ __RPC__out DWORD *pdwActualDataSize) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CancelPendingIO( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaItemExtrasVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaItemExtras * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaItemExtras * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaItemExtras * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetExtendedErrorInfo )( - __RPC__in IWiaItemExtras * This, - /* [out] */ __RPC__deref_out_opt BSTR *bstrErrorText); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Escape )( - __RPC__in IWiaItemExtras * This, - /* [in] */ DWORD dwEscapeCode, - /* [size_is][in] */ __RPC__in_ecount_full(cbInDataSize) BYTE *lpInData, - /* [in] */ DWORD cbInDataSize, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(dwOutDataSize, pdwActualDataSize ? *pdwActualDataSize : dwOutDataSize) BYTE *pOutData, - /* [in] */ DWORD dwOutDataSize, - /* [out] */ __RPC__out DWORD *pdwActualDataSize); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *CancelPendingIO )( - __RPC__in IWiaItemExtras * This); - - END_INTERFACE - } IWiaItemExtrasVtbl; - - interface IWiaItemExtras - { - CONST_VTBL struct IWiaItemExtrasVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaItemExtras_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaItemExtras_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaItemExtras_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaItemExtras_GetExtendedErrorInfo(This,bstrErrorText) \ - ( (This)->lpVtbl -> GetExtendedErrorInfo(This,bstrErrorText) ) - -#define IWiaItemExtras_Escape(This,dwEscapeCode,lpInData,cbInDataSize,pOutData,dwOutDataSize,pdwActualDataSize) \ - ( (This)->lpVtbl -> Escape(This,dwEscapeCode,lpInData,cbInDataSize,pOutData,dwOutDataSize,pdwActualDataSize) ) - -#define IWiaItemExtras_CancelPendingIO(This) \ - ( (This)->lpVtbl -> CancelPendingIO(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaItemExtras_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaAppErrorHandler_INTERFACE_DEFINED__ -#define __IWiaAppErrorHandler_INTERFACE_DEFINED__ - -/* interface IWiaAppErrorHandler */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaAppErrorHandler; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6C16186C-D0A6-400c-80F4-D26986A0E734") - IWiaAppErrorHandler : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetWindow( - /* [out] */ __RPC__deref_out_opt HWND *phwnd) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ReportStatus( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaItem2, - /* [in] */ HRESULT hrStatus, - /* [in] */ LONG lPercentComplete) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaAppErrorHandlerVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaAppErrorHandler * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaAppErrorHandler * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaAppErrorHandler * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetWindow )( - __RPC__in IWiaAppErrorHandler * This, - /* [out] */ __RPC__deref_out_opt HWND *phwnd); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ReportStatus )( - __RPC__in IWiaAppErrorHandler * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaItem2, - /* [in] */ HRESULT hrStatus, - /* [in] */ LONG lPercentComplete); - - END_INTERFACE - } IWiaAppErrorHandlerVtbl; - - interface IWiaAppErrorHandler - { - CONST_VTBL struct IWiaAppErrorHandlerVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaAppErrorHandler_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaAppErrorHandler_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaAppErrorHandler_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaAppErrorHandler_GetWindow(This,phwnd) \ - ( (This)->lpVtbl -> GetWindow(This,phwnd) ) - -#define IWiaAppErrorHandler_ReportStatus(This,lFlags,pWiaItem2,hrStatus,lPercentComplete) \ - ( (This)->lpVtbl -> ReportStatus(This,lFlags,pWiaItem2,hrStatus,lPercentComplete) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaAppErrorHandler_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaErrorHandler_INTERFACE_DEFINED__ -#define __IWiaErrorHandler_INTERFACE_DEFINED__ - -/* interface IWiaErrorHandler */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaErrorHandler; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("0e4a51b1-bc1f-443d-a835-72e890759ef3") - IWiaErrorHandler : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ReportStatus( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaItem2, - /* [in] */ HRESULT hrStatus, - /* [in] */ LONG lPercentComplete) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetStatusDescription( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaItem2, - /* [in] */ HRESULT hrStatus, - /* [out] */ __RPC__deref_out_opt BSTR *pbstrDescription) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaErrorHandlerVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaErrorHandler * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaErrorHandler * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaErrorHandler * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ReportStatus )( - __RPC__in IWiaErrorHandler * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaItem2, - /* [in] */ HRESULT hrStatus, - /* [in] */ LONG lPercentComplete); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetStatusDescription )( - __RPC__in IWiaErrorHandler * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaItem2, - /* [in] */ HRESULT hrStatus, - /* [out] */ __RPC__deref_out_opt BSTR *pbstrDescription); - - END_INTERFACE - } IWiaErrorHandlerVtbl; - - interface IWiaErrorHandler - { - CONST_VTBL struct IWiaErrorHandlerVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaErrorHandler_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaErrorHandler_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaErrorHandler_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaErrorHandler_ReportStatus(This,lFlags,hwndParent,pWiaItem2,hrStatus,lPercentComplete) \ - ( (This)->lpVtbl -> ReportStatus(This,lFlags,hwndParent,pWiaItem2,hrStatus,lPercentComplete) ) - -#define IWiaErrorHandler_GetStatusDescription(This,lFlags,pWiaItem2,hrStatus,pbstrDescription) \ - ( (This)->lpVtbl -> GetStatusDescription(This,lFlags,pWiaItem2,hrStatus,pbstrDescription) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaErrorHandler_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaTransfer_INTERFACE_DEFINED__ -#define __IWiaTransfer_INTERFACE_DEFINED__ - -/* interface IWiaTransfer */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaTransfer; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("c39d6942-2f4e-4d04-92fe-4ef4d3a1de5a") - IWiaTransfer : public IUnknown - { - public: - virtual /* [helpstring][local] */ HRESULT STDMETHODCALLTYPE Download( - /* [in] */ LONG lFlags, - /* [in] */ IWiaTransferCallback *pIWiaTransferCallback) = 0; - - virtual /* [helpstring][local] */ HRESULT STDMETHODCALLTYPE Upload( - /* [in] */ LONG lFlags, - /* [in] */ IStream *pSource, - /* [in] */ IWiaTransferCallback *pIWiaTransferCallback) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Cancel( void) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumWIA_FORMAT_INFO( - /* [out] */ __RPC__deref_out_opt IEnumWIA_FORMAT_INFO **ppEnum) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaTransferVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaTransfer * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaTransfer * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaTransfer * This); - - /* [helpstring][local] */ HRESULT ( STDMETHODCALLTYPE *Download )( - IWiaTransfer * This, - /* [in] */ LONG lFlags, - /* [in] */ IWiaTransferCallback *pIWiaTransferCallback); - - /* [helpstring][local] */ HRESULT ( STDMETHODCALLTYPE *Upload )( - IWiaTransfer * This, - /* [in] */ LONG lFlags, - /* [in] */ IStream *pSource, - /* [in] */ IWiaTransferCallback *pIWiaTransferCallback); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Cancel )( - __RPC__in IWiaTransfer * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumWIA_FORMAT_INFO )( - __RPC__in IWiaTransfer * This, - /* [out] */ __RPC__deref_out_opt IEnumWIA_FORMAT_INFO **ppEnum); - - END_INTERFACE - } IWiaTransferVtbl; - - interface IWiaTransfer - { - CONST_VTBL struct IWiaTransferVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaTransfer_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaTransfer_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaTransfer_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaTransfer_Download(This,lFlags,pIWiaTransferCallback) \ - ( (This)->lpVtbl -> Download(This,lFlags,pIWiaTransferCallback) ) - -#define IWiaTransfer_Upload(This,lFlags,pSource,pIWiaTransferCallback) \ - ( (This)->lpVtbl -> Upload(This,lFlags,pSource,pIWiaTransferCallback) ) - -#define IWiaTransfer_Cancel(This) \ - ( (This)->lpVtbl -> Cancel(This) ) - -#define IWiaTransfer_EnumWIA_FORMAT_INFO(This,ppEnum) \ - ( (This)->lpVtbl -> EnumWIA_FORMAT_INFO(This,ppEnum) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [call_as] */ HRESULT STDMETHODCALLTYPE IWiaTransfer_RemoteDownload_Proxy( - __RPC__in IWiaTransfer * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IWiaTransferCallback *pIWiaTransferCallback); - - -void __RPC_STUB IWiaTransfer_RemoteDownload_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [call_as] */ HRESULT STDMETHODCALLTYPE IWiaTransfer_RemoteUpload_Proxy( - __RPC__in IWiaTransfer * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IStream *pSource, - /* [in] */ __RPC__in_opt IWiaTransferCallback *pIWiaTransferCallback); - - -void __RPC_STUB IWiaTransfer_RemoteUpload_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaTransfer_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_wia_lh_0000_0017 */ -/* [local] */ - -typedef struct _WiaTransferParams - { - LONG lMessage; - LONG lPercentComplete; - ULONG64 ulTransferredBytes; - HRESULT hrErrorStatus; - } WiaTransferParams; - - - -extern RPC_IF_HANDLE __MIDL_itf_wia_lh_0000_0017_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wia_lh_0000_0017_v0_0_s_ifspec; - -#ifndef __IWiaTransferCallback_INTERFACE_DEFINED__ -#define __IWiaTransferCallback_INTERFACE_DEFINED__ - -/* interface IWiaTransferCallback */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaTransferCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("27d4eaaf-28a6-4ca5-9aab-e678168b9527") - IWiaTransferCallback : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE TransferCallback( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in WiaTransferParams *pWiaTransferParams) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetNextStream( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrItemName, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IStream **ppDestination) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaTransferCallbackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaTransferCallback * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaTransferCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaTransferCallback * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *TransferCallback )( - __RPC__in IWiaTransferCallback * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in WiaTransferParams *pWiaTransferParams); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetNextStream )( - __RPC__in IWiaTransferCallback * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrItemName, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IStream **ppDestination); - - END_INTERFACE - } IWiaTransferCallbackVtbl; - - interface IWiaTransferCallback - { - CONST_VTBL struct IWiaTransferCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaTransferCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaTransferCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaTransferCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaTransferCallback_TransferCallback(This,lFlags,pWiaTransferParams) \ - ( (This)->lpVtbl -> TransferCallback(This,lFlags,pWiaTransferParams) ) - -#define IWiaTransferCallback_GetNextStream(This,lFlags,bstrItemName,bstrFullItemName,ppDestination) \ - ( (This)->lpVtbl -> GetNextStream(This,lFlags,bstrItemName,bstrFullItemName,ppDestination) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaTransferCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaSegmentationFilter_INTERFACE_DEFINED__ -#define __IWiaSegmentationFilter_INTERFACE_DEFINED__ - -/* interface IWiaSegmentationFilter */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaSegmentationFilter; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("EC46A697-AC04-4447-8F65-FF63D5154B21") - IWiaSegmentationFilter : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DetectRegions( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IStream *pInputStream, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaItem2) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaSegmentationFilterVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaSegmentationFilter * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaSegmentationFilter * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaSegmentationFilter * This); - - HRESULT ( STDMETHODCALLTYPE *DetectRegions )( - __RPC__in IWiaSegmentationFilter * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IStream *pInputStream, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaItem2); - - END_INTERFACE - } IWiaSegmentationFilterVtbl; - - interface IWiaSegmentationFilter - { - CONST_VTBL struct IWiaSegmentationFilterVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaSegmentationFilter_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaSegmentationFilter_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaSegmentationFilter_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaSegmentationFilter_DetectRegions(This,lFlags,pInputStream,pWiaItem2) \ - ( (This)->lpVtbl -> DetectRegions(This,lFlags,pInputStream,pWiaItem2) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaSegmentationFilter_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaImageFilter_INTERFACE_DEFINED__ -#define __IWiaImageFilter_INTERFACE_DEFINED__ - -/* interface IWiaImageFilter */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaImageFilter; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("A8A79FFA-450B-41f1-8F87-849CCD94EBF6") - IWiaImageFilter : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE InitializeFilter( - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaItem2, - /* [in] */ __RPC__in_opt IWiaTransferCallback *pWiaTransferCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetNewCallback( - /* [in] */ __RPC__in_opt IWiaTransferCallback *pWiaTransferCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE FilterPreviewImage( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaChildItem2, - /* [in] */ RECT InputImageExtents, - /* [in] */ __RPC__in_opt IStream *pInputStream) = 0; - - virtual HRESULT STDMETHODCALLTYPE ApplyProperties( - /* [in] */ __RPC__in_opt IWiaPropertyStorage *pWiaPropertyStorage) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaImageFilterVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaImageFilter * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaImageFilter * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaImageFilter * This); - - HRESULT ( STDMETHODCALLTYPE *InitializeFilter )( - __RPC__in IWiaImageFilter * This, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaItem2, - /* [in] */ __RPC__in_opt IWiaTransferCallback *pWiaTransferCallback); - - HRESULT ( STDMETHODCALLTYPE *SetNewCallback )( - __RPC__in IWiaImageFilter * This, - /* [in] */ __RPC__in_opt IWiaTransferCallback *pWiaTransferCallback); - - HRESULT ( STDMETHODCALLTYPE *FilterPreviewImage )( - __RPC__in IWiaImageFilter * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaChildItem2, - /* [in] */ RECT InputImageExtents, - /* [in] */ __RPC__in_opt IStream *pInputStream); - - HRESULT ( STDMETHODCALLTYPE *ApplyProperties )( - __RPC__in IWiaImageFilter * This, - /* [in] */ __RPC__in_opt IWiaPropertyStorage *pWiaPropertyStorage); - - END_INTERFACE - } IWiaImageFilterVtbl; - - interface IWiaImageFilter - { - CONST_VTBL struct IWiaImageFilterVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaImageFilter_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaImageFilter_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaImageFilter_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaImageFilter_InitializeFilter(This,pWiaItem2,pWiaTransferCallback) \ - ( (This)->lpVtbl -> InitializeFilter(This,pWiaItem2,pWiaTransferCallback) ) - -#define IWiaImageFilter_SetNewCallback(This,pWiaTransferCallback) \ - ( (This)->lpVtbl -> SetNewCallback(This,pWiaTransferCallback) ) - -#define IWiaImageFilter_FilterPreviewImage(This,lFlags,pWiaChildItem2,InputImageExtents,pInputStream) \ - ( (This)->lpVtbl -> FilterPreviewImage(This,lFlags,pWiaChildItem2,InputImageExtents,pInputStream) ) - -#define IWiaImageFilter_ApplyProperties(This,pWiaPropertyStorage) \ - ( (This)->lpVtbl -> ApplyProperties(This,pWiaPropertyStorage) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaImageFilter_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaPreview_INTERFACE_DEFINED__ -#define __IWiaPreview_INTERFACE_DEFINED__ - -/* interface IWiaPreview */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaPreview; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("95C2B4FD-33F2-4d86-AD40-9431F0DF08F7") - IWiaPreview : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetNewPreview( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaItem2, - /* [in] */ __RPC__in_opt IWiaTransferCallback *pWiaTransferCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE UpdatePreview( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IWiaItem2 *pChildWiaItem2, - /* [in] */ __RPC__in_opt IWiaTransferCallback *pWiaTransferCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE DetectRegions( - /* [in] */ LONG lFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaPreviewVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaPreview * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaPreview * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaPreview * This); - - HRESULT ( STDMETHODCALLTYPE *GetNewPreview )( - __RPC__in IWiaPreview * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IWiaItem2 *pWiaItem2, - /* [in] */ __RPC__in_opt IWiaTransferCallback *pWiaTransferCallback); - - HRESULT ( STDMETHODCALLTYPE *UpdatePreview )( - __RPC__in IWiaPreview * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IWiaItem2 *pChildWiaItem2, - /* [in] */ __RPC__in_opt IWiaTransferCallback *pWiaTransferCallback); - - HRESULT ( STDMETHODCALLTYPE *DetectRegions )( - __RPC__in IWiaPreview * This, - /* [in] */ LONG lFlags); - - HRESULT ( STDMETHODCALLTYPE *Clear )( - __RPC__in IWiaPreview * This); - - END_INTERFACE - } IWiaPreviewVtbl; - - interface IWiaPreview - { - CONST_VTBL struct IWiaPreviewVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaPreview_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaPreview_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaPreview_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaPreview_GetNewPreview(This,lFlags,pWiaItem2,pWiaTransferCallback) \ - ( (This)->lpVtbl -> GetNewPreview(This,lFlags,pWiaItem2,pWiaTransferCallback) ) - -#define IWiaPreview_UpdatePreview(This,lFlags,pChildWiaItem2,pWiaTransferCallback) \ - ( (This)->lpVtbl -> UpdatePreview(This,lFlags,pChildWiaItem2,pWiaTransferCallback) ) - -#define IWiaPreview_DetectRegions(This,lFlags) \ - ( (This)->lpVtbl -> DetectRegions(This,lFlags) ) - -#define IWiaPreview_Clear(This) \ - ( (This)->lpVtbl -> Clear(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaPreview_INTERFACE_DEFINED__ */ - - -#ifndef __IEnumWiaItem2_INTERFACE_DEFINED__ -#define __IEnumWiaItem2_INTERFACE_DEFINED__ - -/* interface IEnumWiaItem2 */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IEnumWiaItem2; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("59970AF4-CD0D-44d9-AB24-52295630E582") - IEnumWiaItem2 : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next( - /* [in] */ ULONG cElt, - /* [length_is][size_is][out] */ IWiaItem2 **ppIWiaItem2, - /* [unique][out][in] */ ULONG *pcEltFetched) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Skip( - /* [in] */ ULONG cElt) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Clone( - /* [out] */ __RPC__deref_out_opt IEnumWiaItem2 **ppIEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out ULONG *cElt) = 0; - - }; - -#else /* C style interface */ - - typedef struct IEnumWiaItem2Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IEnumWiaItem2 * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IEnumWiaItem2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IEnumWiaItem2 * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Next )( - IEnumWiaItem2 * This, - /* [in] */ ULONG cElt, - /* [length_is][size_is][out] */ IWiaItem2 **ppIWiaItem2, - /* [unique][out][in] */ ULONG *pcEltFetched); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Skip )( - __RPC__in IEnumWiaItem2 * This, - /* [in] */ ULONG cElt); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Reset )( - __RPC__in IEnumWiaItem2 * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Clone )( - __RPC__in IEnumWiaItem2 * This, - /* [out] */ __RPC__deref_out_opt IEnumWiaItem2 **ppIEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IEnumWiaItem2 * This, - /* [out] */ __RPC__out ULONG *cElt); - - END_INTERFACE - } IEnumWiaItem2Vtbl; - - interface IEnumWiaItem2 - { - CONST_VTBL struct IEnumWiaItem2Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IEnumWiaItem2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IEnumWiaItem2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IEnumWiaItem2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IEnumWiaItem2_Next(This,cElt,ppIWiaItem2,pcEltFetched) \ - ( (This)->lpVtbl -> Next(This,cElt,ppIWiaItem2,pcEltFetched) ) - -#define IEnumWiaItem2_Skip(This,cElt) \ - ( (This)->lpVtbl -> Skip(This,cElt) ) - -#define IEnumWiaItem2_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IEnumWiaItem2_Clone(This,ppIEnum) \ - ( (This)->lpVtbl -> Clone(This,ppIEnum) ) - -#define IEnumWiaItem2_GetCount(This,cElt) \ - ( (This)->lpVtbl -> GetCount(This,cElt) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWiaItem2_RemoteNext_Proxy( - __RPC__in IEnumWiaItem2 * This, - /* [in] */ ULONG cElt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(cElt, *pcEltFetched) IWiaItem2 **ppIWiaItem2, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pcEltFetched); - - -void __RPC_STUB IEnumWiaItem2_RemoteNext_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IEnumWiaItem2_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaItem2_INTERFACE_DEFINED__ -#define __IWiaItem2_INTERFACE_DEFINED__ - -/* interface IWiaItem2 */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaItem2; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6CBA0075-1287-407d-9B77-CF0E030435CC") - IWiaItem2 : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CreateChildItem( - /* [in] */ LONG lItemFlags, - /* [in] */ LONG lCreationFlags, - /* [in] */ __RPC__in BSTR bstrItemName, - /* [out] */ __RPC__deref_out_opt IWiaItem2 **ppIWiaItem2) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DeleteItem( - /* [in] */ LONG lFlags) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumChildItems( - /* [unique][in] */ __RPC__in_opt const GUID *pCategoryGUID, - /* [out] */ __RPC__deref_out_opt IEnumWiaItem2 **ppIEnumWiaItem2) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE FindItemByName( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IWiaItem2 **ppIWiaItem2) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetItemCategory( - /* [out] */ __RPC__out GUID *pItemCategoryGUID) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetItemType( - /* [out] */ __RPC__out LONG *pItemType) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE DeviceDlg( - /* [annotation][in] */ - __in LONG lFlags, - /* [annotation][in] */ - __in HWND hwndParent, - /* [annotation][in] */ - __in BSTR bstrFolderName, - /* [annotation][in] */ - __in BSTR bstrFilename, - /* [annotation][out] */ - __out LONG *plNumFiles, - /* [annotation][size_is][size_is][out] */ - __deref_out_ecount(*plNumFiles) BSTR **ppbstrFilePaths, - /* [annotation][out][in] */ - __out_opt IWiaItem2 **ppItem) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DeviceCommand( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in const GUID *pCmdGUID, - /* [out][in] */ __RPC__deref_inout_opt IWiaItem2 **ppIWiaItem2) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumDeviceCapabilities( - /* [in] */ LONG lFlags, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnumWIA_DEV_CAPS) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE CheckExtension( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrName, - /* [in] */ REFIID riidExtensionInterface, - /* [out] */ BOOL *pbExtensionExists) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetExtension( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrName, - /* [in] */ REFIID riidExtensionInterface, - /* [iid_is][out] */ void **ppOut) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetParentItem( - /* [out] */ __RPC__deref_out_opt IWiaItem2 **ppIWiaItem2) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetRootItem( - /* [out] */ __RPC__deref_out_opt IWiaItem2 **ppIWiaItem2) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetPreviewComponent( - /* [in] */ LONG lFlags, - /* [out] */ IWiaPreview **ppWiaPreview) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumRegisterEventInfo( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Diagnostic( - /* [in] */ ULONG ulSize, - /* [size_is][in] */ __RPC__in_ecount_full(ulSize) BYTE *pBuffer) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaItem2Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaItem2 * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaItem2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaItem2 * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateChildItem )( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lItemFlags, - /* [in] */ LONG lCreationFlags, - /* [in] */ __RPC__in BSTR bstrItemName, - /* [out] */ __RPC__deref_out_opt IWiaItem2 **ppIWiaItem2); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DeleteItem )( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumChildItems )( - __RPC__in IWiaItem2 * This, - /* [unique][in] */ __RPC__in_opt const GUID *pCategoryGUID, - /* [out] */ __RPC__deref_out_opt IEnumWiaItem2 **ppIEnumWiaItem2); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *FindItemByName )( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IWiaItem2 **ppIWiaItem2); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetItemCategory )( - __RPC__in IWiaItem2 * This, - /* [out] */ __RPC__out GUID *pItemCategoryGUID); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetItemType )( - __RPC__in IWiaItem2 * This, - /* [out] */ __RPC__out LONG *pItemType); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *DeviceDlg )( - IWiaItem2 * This, - /* [annotation][in] */ - __in LONG lFlags, - /* [annotation][in] */ - __in HWND hwndParent, - /* [annotation][in] */ - __in BSTR bstrFolderName, - /* [annotation][in] */ - __in BSTR bstrFilename, - /* [annotation][out] */ - __out LONG *plNumFiles, - /* [annotation][size_is][size_is][out] */ - __deref_out_ecount(*plNumFiles) BSTR **ppbstrFilePaths, - /* [annotation][out][in] */ - __out_opt IWiaItem2 **ppItem); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DeviceCommand )( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in const GUID *pCmdGUID, - /* [out][in] */ __RPC__deref_inout_opt IWiaItem2 **ppIWiaItem2); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumDeviceCapabilities )( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnumWIA_DEV_CAPS); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *CheckExtension )( - IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrName, - /* [in] */ REFIID riidExtensionInterface, - /* [out] */ BOOL *pbExtensionExists); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetExtension )( - IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrName, - /* [in] */ REFIID riidExtensionInterface, - /* [iid_is][out] */ void **ppOut); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetParentItem )( - __RPC__in IWiaItem2 * This, - /* [out] */ __RPC__deref_out_opt IWiaItem2 **ppIWiaItem2); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetRootItem )( - __RPC__in IWiaItem2 * This, - /* [out] */ __RPC__deref_out_opt IWiaItem2 **ppIWiaItem2); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetPreviewComponent )( - IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [out] */ IWiaPreview **ppWiaPreview); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumRegisterEventInfo )( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Diagnostic )( - __RPC__in IWiaItem2 * This, - /* [in] */ ULONG ulSize, - /* [size_is][in] */ __RPC__in_ecount_full(ulSize) BYTE *pBuffer); - - END_INTERFACE - } IWiaItem2Vtbl; - - interface IWiaItem2 - { - CONST_VTBL struct IWiaItem2Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaItem2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaItem2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaItem2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaItem2_CreateChildItem(This,lItemFlags,lCreationFlags,bstrItemName,ppIWiaItem2) \ - ( (This)->lpVtbl -> CreateChildItem(This,lItemFlags,lCreationFlags,bstrItemName,ppIWiaItem2) ) - -#define IWiaItem2_DeleteItem(This,lFlags) \ - ( (This)->lpVtbl -> DeleteItem(This,lFlags) ) - -#define IWiaItem2_EnumChildItems(This,pCategoryGUID,ppIEnumWiaItem2) \ - ( (This)->lpVtbl -> EnumChildItems(This,pCategoryGUID,ppIEnumWiaItem2) ) - -#define IWiaItem2_FindItemByName(This,lFlags,bstrFullItemName,ppIWiaItem2) \ - ( (This)->lpVtbl -> FindItemByName(This,lFlags,bstrFullItemName,ppIWiaItem2) ) - -#define IWiaItem2_GetItemCategory(This,pItemCategoryGUID) \ - ( (This)->lpVtbl -> GetItemCategory(This,pItemCategoryGUID) ) - -#define IWiaItem2_GetItemType(This,pItemType) \ - ( (This)->lpVtbl -> GetItemType(This,pItemType) ) - -#define IWiaItem2_DeviceDlg(This,lFlags,hwndParent,bstrFolderName,bstrFilename,plNumFiles,ppbstrFilePaths,ppItem) \ - ( (This)->lpVtbl -> DeviceDlg(This,lFlags,hwndParent,bstrFolderName,bstrFilename,plNumFiles,ppbstrFilePaths,ppItem) ) - -#define IWiaItem2_DeviceCommand(This,lFlags,pCmdGUID,ppIWiaItem2) \ - ( (This)->lpVtbl -> DeviceCommand(This,lFlags,pCmdGUID,ppIWiaItem2) ) - -#define IWiaItem2_EnumDeviceCapabilities(This,lFlags,ppIEnumWIA_DEV_CAPS) \ - ( (This)->lpVtbl -> EnumDeviceCapabilities(This,lFlags,ppIEnumWIA_DEV_CAPS) ) - -#define IWiaItem2_CheckExtension(This,lFlags,bstrName,riidExtensionInterface,pbExtensionExists) \ - ( (This)->lpVtbl -> CheckExtension(This,lFlags,bstrName,riidExtensionInterface,pbExtensionExists) ) - -#define IWiaItem2_GetExtension(This,lFlags,bstrName,riidExtensionInterface,ppOut) \ - ( (This)->lpVtbl -> GetExtension(This,lFlags,bstrName,riidExtensionInterface,ppOut) ) - -#define IWiaItem2_GetParentItem(This,ppIWiaItem2) \ - ( (This)->lpVtbl -> GetParentItem(This,ppIWiaItem2) ) - -#define IWiaItem2_GetRootItem(This,ppIWiaItem2) \ - ( (This)->lpVtbl -> GetRootItem(This,ppIWiaItem2) ) - -#define IWiaItem2_GetPreviewComponent(This,lFlags,ppWiaPreview) \ - ( (This)->lpVtbl -> GetPreviewComponent(This,lFlags,ppWiaPreview) ) - -#define IWiaItem2_EnumRegisterEventInfo(This,lFlags,pEventGUID,ppIEnum) \ - ( (This)->lpVtbl -> EnumRegisterEventInfo(This,lFlags,pEventGUID,ppIEnum) ) - -#define IWiaItem2_Diagnostic(This,ulSize,pBuffer) \ - ( (This)->lpVtbl -> Diagnostic(This,ulSize,pBuffer) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaItem2_LocalDeviceDlg_Proxy( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ __RPC__in BSTR bstrFolderName, - /* [in] */ __RPC__in BSTR bstrFilename, - /* [out] */ __RPC__out LONG *plNumFiles, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*plNumFiles) BSTR **ppbstrFilePaths, - /* [out][in] */ __RPC__deref_inout_opt IWiaItem2 **ppItem); - - -void __RPC_STUB IWiaItem2_LocalDeviceDlg_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaItem2_RemoteCheckExtension_Proxy( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in REFIID riidExtensionInterface, - /* [out] */ __RPC__out BOOL *pbExtensionExists); - - -void __RPC_STUB IWiaItem2_RemoteCheckExtension_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaItem2_RemoteGetExtension_Proxy( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in REFIID riidExtensionInterface, - /* [iid_is][out] */ __RPC__deref_out_opt void **ppOut); - - -void __RPC_STUB IWiaItem2_RemoteGetExtension_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaItem2_RemoteGetPreviewComponent_Proxy( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [out] */ __RPC__deref_out_opt IWiaPreview **ppWiaPreview); - - -void __RPC_STUB IWiaItem2_RemoteGetPreviewComponent_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaItem2_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaDevMgr2_INTERFACE_DEFINED__ -#define __IWiaDevMgr2_INTERFACE_DEFINED__ - -/* interface IWiaDevMgr2 */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaDevMgr2; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("79C07CF1-CBDD-41ee-8EC3-F00080CADA7A") - IWiaDevMgr2 : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumDeviceInfo( - /* [in] */ LONG lFlags, - /* [retval][out] */ __RPC__deref_out_opt IEnumWIA_DEV_INFO **ppIEnum) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE CreateDevice( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [out] */ IWiaItem2 **ppWiaItem2Root) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE SelectDeviceDlg( - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ BSTR *pbstrDeviceID, - /* [retval][out] */ IWiaItem2 **ppItemRoot) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE SelectDeviceDlgID( - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ BSTR *pbstrDeviceID) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE RegisterEventCallbackInterface( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ IWiaEventCallback *pIWiaEventCallback, - /* [out] */ IUnknown **pEventObject) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE RegisterEventCallbackProgram( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [in] */ BSTR bstrFullAppName, - /* [in] */ BSTR bstrCommandLineArg, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE RegisterEventCallbackCLSID( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ const GUID *pClsID, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetImageDlg( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ HWND hwndParent, - /* [in] */ BSTR bstrFolderName, - /* [in] */ BSTR bstrFilename, - /* [out] */ LONG *plNumFiles, - /* [size_is][size_is][out] */ BSTR **ppbstrFilePaths, - /* [out][in] */ IWiaItem2 **ppItem) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaDevMgr2Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaDevMgr2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaDevMgr2 * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumDeviceInfo )( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [retval][out] */ __RPC__deref_out_opt IEnumWIA_DEV_INFO **ppIEnum); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *CreateDevice )( - IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [out] */ IWiaItem2 **ppWiaItem2Root); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *SelectDeviceDlg )( - IWiaDevMgr2 * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ BSTR *pbstrDeviceID, - /* [retval][out] */ IWiaItem2 **ppItemRoot); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *SelectDeviceDlgID )( - IWiaDevMgr2 * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ BSTR *pbstrDeviceID); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *RegisterEventCallbackInterface )( - IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ IWiaEventCallback *pIWiaEventCallback, - /* [out] */ IUnknown **pEventObject); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *RegisterEventCallbackProgram )( - IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [in] */ BSTR bstrFullAppName, - /* [in] */ BSTR bstrCommandLineArg, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *RegisterEventCallbackCLSID )( - IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ const GUID *pClsID, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetImageDlg )( - IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ HWND hwndParent, - /* [in] */ BSTR bstrFolderName, - /* [in] */ BSTR bstrFilename, - /* [out] */ LONG *plNumFiles, - /* [size_is][size_is][out] */ BSTR **ppbstrFilePaths, - /* [out][in] */ IWiaItem2 **ppItem); - - END_INTERFACE - } IWiaDevMgr2Vtbl; - - interface IWiaDevMgr2 - { - CONST_VTBL struct IWiaDevMgr2Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaDevMgr2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaDevMgr2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaDevMgr2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaDevMgr2_EnumDeviceInfo(This,lFlags,ppIEnum) \ - ( (This)->lpVtbl -> EnumDeviceInfo(This,lFlags,ppIEnum) ) - -#define IWiaDevMgr2_CreateDevice(This,lFlags,bstrDeviceID,ppWiaItem2Root) \ - ( (This)->lpVtbl -> CreateDevice(This,lFlags,bstrDeviceID,ppWiaItem2Root) ) - -#define IWiaDevMgr2_SelectDeviceDlg(This,hwndParent,lDeviceType,lFlags,pbstrDeviceID,ppItemRoot) \ - ( (This)->lpVtbl -> SelectDeviceDlg(This,hwndParent,lDeviceType,lFlags,pbstrDeviceID,ppItemRoot) ) - -#define IWiaDevMgr2_SelectDeviceDlgID(This,hwndParent,lDeviceType,lFlags,pbstrDeviceID) \ - ( (This)->lpVtbl -> SelectDeviceDlgID(This,hwndParent,lDeviceType,lFlags,pbstrDeviceID) ) - -#define IWiaDevMgr2_RegisterEventCallbackInterface(This,lFlags,bstrDeviceID,pEventGUID,pIWiaEventCallback,pEventObject) \ - ( (This)->lpVtbl -> RegisterEventCallbackInterface(This,lFlags,bstrDeviceID,pEventGUID,pIWiaEventCallback,pEventObject) ) - -#define IWiaDevMgr2_RegisterEventCallbackProgram(This,lFlags,bstrDeviceID,pEventGUID,bstrFullAppName,bstrCommandLineArg,bstrName,bstrDescription,bstrIcon) \ - ( (This)->lpVtbl -> RegisterEventCallbackProgram(This,lFlags,bstrDeviceID,pEventGUID,bstrFullAppName,bstrCommandLineArg,bstrName,bstrDescription,bstrIcon) ) - -#define IWiaDevMgr2_RegisterEventCallbackCLSID(This,lFlags,bstrDeviceID,pEventGUID,pClsID,bstrName,bstrDescription,bstrIcon) \ - ( (This)->lpVtbl -> RegisterEventCallbackCLSID(This,lFlags,bstrDeviceID,pEventGUID,pClsID,bstrName,bstrDescription,bstrIcon) ) - -#define IWiaDevMgr2_GetImageDlg(This,lFlags,bstrDeviceID,hwndParent,bstrFolderName,bstrFilename,plNumFiles,ppbstrFilePaths,ppItem) \ - ( (This)->lpVtbl -> GetImageDlg(This,lFlags,bstrDeviceID,hwndParent,bstrFolderName,bstrFilename,plNumFiles,ppbstrFilePaths,ppItem) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_LocalCreateDevice_Proxy( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [out] */ __RPC__deref_out_opt IWiaItem2 **ppWiaItem2Root); - - -void __RPC_STUB IWiaDevMgr2_LocalCreateDevice_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_LocalSelectDeviceDlg_Proxy( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ __RPC__deref_inout_opt BSTR *pbstrDeviceID, - /* [retval][out] */ __RPC__deref_out_opt IWiaItem2 **ppItemRoot); - - -void __RPC_STUB IWiaDevMgr2_LocalSelectDeviceDlg_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_LocalSelectDeviceDlgID_Proxy( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrDeviceID); - - -void __RPC_STUB IWiaDevMgr2_LocalSelectDeviceDlgID_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_LocalRegisterEventCallbackInterface_Proxy( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [unique][in] */ __RPC__in_opt IWiaEventCallback *pIWiaEventCallback, - /* [out] */ __RPC__deref_out_opt IUnknown **pEventObject); - - -void __RPC_STUB IWiaDevMgr2_LocalRegisterEventCallbackInterface_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_LocalRegisterEventCallbackProgram_Proxy( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrFullAppName, - /* [in] */ __RPC__in BSTR bstrCommandLineArg, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in BSTR bstrDescription, - /* [in] */ __RPC__in BSTR bstrIcon); - - -void __RPC_STUB IWiaDevMgr2_LocalRegisterEventCallbackProgram_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_LocalRegisterEventCallbackCLSID_Proxy( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [unique][in] */ __RPC__in_opt const GUID *pClsID, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in BSTR bstrDescription, - /* [in] */ __RPC__in BSTR bstrIcon); - - -void __RPC_STUB IWiaDevMgr2_LocalRegisterEventCallbackCLSID_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_LocalGetImageDlg_Proxy( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ __RPC__in BSTR bstrFolderName, - /* [in] */ __RPC__in BSTR bstrFilename, - /* [out] */ __RPC__out LONG *plNumFiles, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*plNumFiles) BSTR **ppbstrFilePaths, - /* [out][in] */ __RPC__deref_inout_opt IWiaItem2 **ppItem); - - -void __RPC_STUB IWiaDevMgr2_LocalGetImageDlg_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaDevMgr2_INTERFACE_DEFINED__ */ - - - -#ifndef __WiaDevMgr_LIBRARY_DEFINED__ -#define __WiaDevMgr_LIBRARY_DEFINED__ - -/* library WiaDevMgr */ -/* [helpstring][version][uuid] */ - - -EXTERN_C const IID LIBID_WiaDevMgr; - -EXTERN_C const CLSID CLSID_WiaDevMgr; - -#ifdef __cplusplus - -class DECLSPEC_UUID("a1f4e726-8cf1-11d1-bf92-0060081ed811") -WiaDevMgr; -#endif - -EXTERN_C const CLSID CLSID_WiaDevMgr2; - -#ifdef __cplusplus - -class DECLSPEC_UUID("B6C292BC-7C88-41ee-8B54-8EC92617E599") -WiaDevMgr2; -#endif - -EXTERN_C const CLSID CLSID_WiaLog; - -#ifdef __cplusplus - -class DECLSPEC_UUID("A1E75357-881A-419e-83E2-BB16DB197C68") -WiaLog; -#endif -#endif /* __WiaDevMgr_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -unsigned long __RPC_USER BSTR_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); -void __RPC_USER BSTR_UserFree( __RPC__in unsigned long *, __RPC__in BSTR * ); - -unsigned long __RPC_USER HWND_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in HWND * ); -unsigned char * __RPC_USER HWND_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in HWND * ); -unsigned char * __RPC_USER HWND_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out HWND * ); -void __RPC_USER HWND_UserFree( __RPC__in unsigned long *, __RPC__in HWND * ); - -unsigned long __RPC_USER LPSAFEARRAY_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * ); -void __RPC_USER LPSAFEARRAY_UserFree( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * ); - -unsigned long __RPC_USER STGMEDIUM_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in STGMEDIUM * ); -unsigned char * __RPC_USER STGMEDIUM_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in STGMEDIUM * ); -unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out STGMEDIUM * ); -void __RPC_USER STGMEDIUM_UserFree( __RPC__in unsigned long *, __RPC__in STGMEDIUM * ); - -unsigned long __RPC_USER BSTR_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); -void __RPC_USER BSTR_UserFree64( __RPC__in unsigned long *, __RPC__in BSTR * ); - -unsigned long __RPC_USER HWND_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in HWND * ); -unsigned char * __RPC_USER HWND_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in HWND * ); -unsigned char * __RPC_USER HWND_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out HWND * ); -void __RPC_USER HWND_UserFree64( __RPC__in unsigned long *, __RPC__in HWND * ); - -unsigned long __RPC_USER LPSAFEARRAY_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * ); -void __RPC_USER LPSAFEARRAY_UserFree64( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * ); - -unsigned long __RPC_USER STGMEDIUM_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in STGMEDIUM * ); -unsigned char * __RPC_USER STGMEDIUM_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in STGMEDIUM * ); -unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out STGMEDIUM * ); -void __RPC_USER STGMEDIUM_UserFree64( __RPC__in unsigned long *, __RPC__in STGMEDIUM * ); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_CreateDevice_Proxy( - IWiaDevMgr * This, - /* [in] */ BSTR bstrDeviceID, - /* [out] */ IWiaItem **ppWiaItemRoot); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_CreateDevice_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppWiaItemRoot); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_SelectDeviceDlg_Proxy( - IWiaDevMgr * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ BSTR *pbstrDeviceID, - /* [retval][out] */ IWiaItem **ppItemRoot); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_SelectDeviceDlg_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ __RPC__deref_inout_opt BSTR *pbstrDeviceID, - /* [retval][out] */ __RPC__deref_out_opt IWiaItem **ppItemRoot); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_SelectDeviceDlgID_Proxy( - IWiaDevMgr * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ BSTR *pbstrDeviceID); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_SelectDeviceDlgID_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrDeviceID); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_GetImageDlg_Proxy( - IWiaDevMgr * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [in] */ IWiaItem *pItemRoot, - /* [in] */ BSTR bstrFilename, - /* [out][in] */ GUID *pguidFormat); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_GetImageDlg_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [in] */ __RPC__in_opt IWiaItem *pItemRoot, - /* [in] */ __RPC__in BSTR bstrFilename, - /* [out][in] */ __RPC__inout GUID *pguidFormat); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_RegisterEventCallbackProgram_Proxy( - IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [in] */ BSTR bstrCommandline, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_RegisterEventCallbackProgram_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrCommandline, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in BSTR bstrDescription, - /* [in] */ __RPC__in BSTR bstrIcon); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_RegisterEventCallbackInterface_Proxy( - IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ IWiaEventCallback *pIWiaEventCallback, - /* [out] */ IUnknown **pEventObject); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_RegisterEventCallbackInterface_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [unique][in] */ __RPC__in_opt IWiaEventCallback *pIWiaEventCallback, - /* [out] */ __RPC__deref_out_opt IUnknown **pEventObject); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_RegisterEventCallbackCLSID_Proxy( - IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ const GUID *pClsID, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_RegisterEventCallbackCLSID_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [unique][in] */ __RPC__in_opt const GUID *pClsID, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in BSTR bstrDescription, - /* [in] */ __RPC__in BSTR bstrIcon); - -/* [local] */ HRESULT STDMETHODCALLTYPE IEnumWIA_DEV_INFO_Next_Proxy( - IEnumWIA_DEV_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ IWiaPropertyStorage **rgelt, - /* [unique][out][in] */ ULONG *pceltFetched); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWIA_DEV_INFO_Next_Stub( - __RPC__in IEnumWIA_DEV_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) IWiaPropertyStorage **rgelt, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDataCallback_BandedDataCallback_Proxy( - IWiaDataCallback * This, - /* [in] */ LONG lMessage, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ LONG lReserved, - /* [in] */ LONG lResLength, - /* [size_is][in] */ BYTE *pbBuffer); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDataCallback_BandedDataCallback_Stub( - __RPC__in IWiaDataCallback * This, - /* [in] */ LONG lMessage, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ LONG lReserved, - /* [in] */ LONG lResLength, - /* [unique][size_is][in] */ __RPC__in_ecount_full_opt(lResLength) BYTE *pbBuffer); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDataTransfer_idtGetData_Proxy( - IWiaDataTransfer * This, - /* [out][in] */ LPSTGMEDIUM pMedium, - /* [unique][in] */ IWiaDataCallback *pIWiaDataCallback); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDataTransfer_idtGetData_Stub( - __RPC__in IWiaDataTransfer * This, - /* [out][in] */ __RPC__inout LPSTGMEDIUM pMedium, - /* [unique][in] */ __RPC__in_opt IWiaDataCallback *pIWiaDataCallback); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDataTransfer_idtGetBandedData_Proxy( - IWiaDataTransfer * This, - /* [unique][in] */ PWIA_DATA_TRANSFER_INFO pWiaDataTransInfo, - /* [unique][in] */ IWiaDataCallback *pIWiaDataCallback); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDataTransfer_idtGetBandedData_Stub( - __RPC__in IWiaDataTransfer * This, - /* [unique][in] */ __RPC__in_opt PWIA_DATA_TRANSFER_INFO pWiaDataTransInfo, - /* [unique][in] */ __RPC__in_opt IWiaDataCallback *pIWiaDataCallback); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaItem_DeviceDlg_Proxy( - IWiaItem * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [out] */ LONG *plItemCount, - /* [out] */ IWiaItem ***ppIWiaItem); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaItem_DeviceDlg_Stub( - __RPC__in IWiaItem * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [out] */ __RPC__out LONG *plItemCount, - /* [out] */ __RPC__deref_out_opt IWiaItem ***pIWiaItem); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaPropertyStorage_WriteMultiple_Proxy( - IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ const PROPSPEC rgpspec[ ], - /* [size_is][in] */ const PROPVARIANT rgpropvar[ ], - /* [in] */ PROPID propidNameFirst); - - -/* [call_as] */ HRESULT STDMETHODCALLTYPE IWiaPropertyStorage_WriteMultiple_Stub( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC *rgpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPVARIANT *rgpropvar, - /* [in] */ PROPID propidNameFirst); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaPropertyStorage_SetPropertyStream_Proxy( - IWiaPropertyStorage * This, - /* [in] */ GUID *pCompatibilityId, - /* [unique][in] */ IStream *pIStream); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaPropertyStorage_SetPropertyStream_Stub( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ __RPC__in GUID *pCompatibilityId, - /* [unique][in] */ __RPC__in_opt IStream *pIStream); - -/* [local] */ HRESULT STDMETHODCALLTYPE IEnumWiaItem_Next_Proxy( - IEnumWiaItem * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ IWiaItem **ppIWiaItem, - /* [unique][out][in] */ ULONG *pceltFetched); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWiaItem_Next_Stub( - __RPC__in IEnumWiaItem * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) IWiaItem **ppIWiaItem, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - -/* [local] */ HRESULT STDMETHODCALLTYPE IEnumWIA_DEV_CAPS_Next_Proxy( - IEnumWIA_DEV_CAPS * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ WIA_DEV_CAP *rgelt, - /* [unique][out][in] */ ULONG *pceltFetched); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWIA_DEV_CAPS_Next_Stub( - __RPC__in IEnumWIA_DEV_CAPS * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) WIA_DEV_CAP *rgelt, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - -/* [local] */ HRESULT STDMETHODCALLTYPE IEnumWIA_FORMAT_INFO_Next_Proxy( - IEnumWIA_FORMAT_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ WIA_FORMAT_INFO *rgelt, - /* [unique][out][in] */ ULONG *pceltFetched); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWIA_FORMAT_INFO_Next_Stub( - __RPC__in IEnumWIA_FORMAT_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) WIA_FORMAT_INFO *rgelt, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - -/* [helpstring][local] */ HRESULT STDMETHODCALLTYPE IWiaTransfer_Download_Proxy( - IWiaTransfer * This, - /* [in] */ LONG lFlags, - /* [in] */ IWiaTransferCallback *pIWiaTransferCallback); - - -/* [call_as] */ HRESULT STDMETHODCALLTYPE IWiaTransfer_Download_Stub( - __RPC__in IWiaTransfer * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IWiaTransferCallback *pIWiaTransferCallback); - -/* [helpstring][local] */ HRESULT STDMETHODCALLTYPE IWiaTransfer_Upload_Proxy( - IWiaTransfer * This, - /* [in] */ LONG lFlags, - /* [in] */ IStream *pSource, - /* [in] */ IWiaTransferCallback *pIWiaTransferCallback); - - -/* [call_as] */ HRESULT STDMETHODCALLTYPE IWiaTransfer_Upload_Stub( - __RPC__in IWiaTransfer * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in_opt IStream *pSource, - /* [in] */ __RPC__in_opt IWiaTransferCallback *pIWiaTransferCallback); - -/* [local] */ HRESULT STDMETHODCALLTYPE IEnumWiaItem2_Next_Proxy( - IEnumWiaItem2 * This, - /* [in] */ ULONG cElt, - /* [length_is][size_is][out] */ IWiaItem2 **ppIWiaItem2, - /* [unique][out][in] */ ULONG *pcEltFetched); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWiaItem2_Next_Stub( - __RPC__in IEnumWiaItem2 * This, - /* [in] */ ULONG cElt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(cElt, *pcEltFetched) IWiaItem2 **ppIWiaItem2, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pcEltFetched); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaItem2_DeviceDlg_Proxy( - IWiaItem2 * This, - /* [annotation][in] */ - __in LONG lFlags, - /* [annotation][in] */ - __in HWND hwndParent, - /* [annotation][in] */ - __in BSTR bstrFolderName, - /* [annotation][in] */ - __in BSTR bstrFilename, - /* [annotation][out] */ - __out LONG *plNumFiles, - /* [annotation][size_is][size_is][out] */ - __deref_out_ecount(*plNumFiles) BSTR **ppbstrFilePaths, - /* [annotation][out][in] */ - __out_opt IWiaItem2 **ppItem); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaItem2_DeviceDlg_Stub( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ __RPC__in BSTR bstrFolderName, - /* [in] */ __RPC__in BSTR bstrFilename, - /* [out] */ __RPC__out LONG *plNumFiles, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*plNumFiles) BSTR **ppbstrFilePaths, - /* [out][in] */ __RPC__deref_inout_opt IWiaItem2 **ppItem); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaItem2_CheckExtension_Proxy( - IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrName, - /* [in] */ REFIID riidExtensionInterface, - /* [out] */ BOOL *pbExtensionExists); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaItem2_CheckExtension_Stub( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in REFIID riidExtensionInterface, - /* [out] */ __RPC__out BOOL *pbExtensionExists); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaItem2_GetExtension_Proxy( - IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrName, - /* [in] */ REFIID riidExtensionInterface, - /* [iid_is][out] */ void **ppOut); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaItem2_GetExtension_Stub( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in REFIID riidExtensionInterface, - /* [iid_is][out] */ __RPC__deref_out_opt void **ppOut); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaItem2_GetPreviewComponent_Proxy( - IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [out] */ IWiaPreview **ppWiaPreview); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaItem2_GetPreviewComponent_Stub( - __RPC__in IWiaItem2 * This, - /* [in] */ LONG lFlags, - /* [out] */ __RPC__deref_out_opt IWiaPreview **ppWiaPreview); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_CreateDevice_Proxy( - IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [out] */ IWiaItem2 **ppWiaItem2Root); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_CreateDevice_Stub( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [out] */ __RPC__deref_out_opt IWiaItem2 **ppWiaItem2Root); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_SelectDeviceDlg_Proxy( - IWiaDevMgr2 * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ BSTR *pbstrDeviceID, - /* [retval][out] */ IWiaItem2 **ppItemRoot); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_SelectDeviceDlg_Stub( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ __RPC__deref_inout_opt BSTR *pbstrDeviceID, - /* [retval][out] */ __RPC__deref_out_opt IWiaItem2 **ppItemRoot); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_SelectDeviceDlgID_Proxy( - IWiaDevMgr2 * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ BSTR *pbstrDeviceID); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_SelectDeviceDlgID_Stub( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrDeviceID); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_RegisterEventCallbackInterface_Proxy( - IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ IWiaEventCallback *pIWiaEventCallback, - /* [out] */ IUnknown **pEventObject); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_RegisterEventCallbackInterface_Stub( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [unique][in] */ __RPC__in_opt IWiaEventCallback *pIWiaEventCallback, - /* [out] */ __RPC__deref_out_opt IUnknown **pEventObject); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_RegisterEventCallbackProgram_Proxy( - IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [in] */ BSTR bstrFullAppName, - /* [in] */ BSTR bstrCommandLineArg, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_RegisterEventCallbackProgram_Stub( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrFullAppName, - /* [in] */ __RPC__in BSTR bstrCommandLineArg, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in BSTR bstrDescription, - /* [in] */ __RPC__in BSTR bstrIcon); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_RegisterEventCallbackCLSID_Proxy( - IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ const GUID *pClsID, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_RegisterEventCallbackCLSID_Stub( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [unique][in] */ __RPC__in_opt const GUID *pClsID, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in BSTR bstrDescription, - /* [in] */ __RPC__in BSTR bstrIcon); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_GetImageDlg_Proxy( - IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ HWND hwndParent, - /* [in] */ BSTR bstrFolderName, - /* [in] */ BSTR bstrFilename, - /* [out] */ LONG *plNumFiles, - /* [size_is][size_is][out] */ BSTR **ppbstrFilePaths, - /* [out][in] */ IWiaItem2 **ppItem); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr2_GetImageDlg_Stub( - __RPC__in IWiaDevMgr2 * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ __RPC__in BSTR bstrFolderName, - /* [in] */ __RPC__in BSTR bstrFilename, - /* [out] */ __RPC__out LONG *plNumFiles, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*plNumFiles) BSTR **ppbstrFilePaths, - /* [out][in] */ __RPC__deref_inout_opt IWiaItem2 **ppItem); - - - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/wia_xp.h b/pub/ddk/wia_xp.h deleted file mode 100644 index 54a786e..0000000 --- a/pub/ddk/wia_xp.h +++ /dev/null @@ -1,2844 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for wia_xp.idl, wia_xp.acf: - 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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __wia_xp_h__ -#define __wia_xp_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IWiaDevMgr_FWD_DEFINED__ -#define __IWiaDevMgr_FWD_DEFINED__ -typedef interface IWiaDevMgr IWiaDevMgr; -#endif /* __IWiaDevMgr_FWD_DEFINED__ */ - - -#ifndef __IEnumWIA_DEV_INFO_FWD_DEFINED__ -#define __IEnumWIA_DEV_INFO_FWD_DEFINED__ -typedef interface IEnumWIA_DEV_INFO IEnumWIA_DEV_INFO; -#endif /* __IEnumWIA_DEV_INFO_FWD_DEFINED__ */ - - -#ifndef __IWiaEventCallback_FWD_DEFINED__ -#define __IWiaEventCallback_FWD_DEFINED__ -typedef interface IWiaEventCallback IWiaEventCallback; -#endif /* __IWiaEventCallback_FWD_DEFINED__ */ - - -#ifndef __IWiaDataCallback_FWD_DEFINED__ -#define __IWiaDataCallback_FWD_DEFINED__ -typedef interface IWiaDataCallback IWiaDataCallback; -#endif /* __IWiaDataCallback_FWD_DEFINED__ */ - - -#ifndef __IWiaDataTransfer_FWD_DEFINED__ -#define __IWiaDataTransfer_FWD_DEFINED__ -typedef interface IWiaDataTransfer IWiaDataTransfer; -#endif /* __IWiaDataTransfer_FWD_DEFINED__ */ - - -#ifndef __IWiaItem_FWD_DEFINED__ -#define __IWiaItem_FWD_DEFINED__ -typedef interface IWiaItem IWiaItem; -#endif /* __IWiaItem_FWD_DEFINED__ */ - - -#ifndef __IWiaPropertyStorage_FWD_DEFINED__ -#define __IWiaPropertyStorage_FWD_DEFINED__ -typedef interface IWiaPropertyStorage IWiaPropertyStorage; -#endif /* __IWiaPropertyStorage_FWD_DEFINED__ */ - - -#ifndef __IEnumWiaItem_FWD_DEFINED__ -#define __IEnumWiaItem_FWD_DEFINED__ -typedef interface IEnumWiaItem IEnumWiaItem; -#endif /* __IEnumWiaItem_FWD_DEFINED__ */ - - -#ifndef __IEnumWIA_DEV_CAPS_FWD_DEFINED__ -#define __IEnumWIA_DEV_CAPS_FWD_DEFINED__ -typedef interface IEnumWIA_DEV_CAPS IEnumWIA_DEV_CAPS; -#endif /* __IEnumWIA_DEV_CAPS_FWD_DEFINED__ */ - - -#ifndef __IEnumWIA_FORMAT_INFO_FWD_DEFINED__ -#define __IEnumWIA_FORMAT_INFO_FWD_DEFINED__ -typedef interface IEnumWIA_FORMAT_INFO IEnumWIA_FORMAT_INFO; -#endif /* __IEnumWIA_FORMAT_INFO_FWD_DEFINED__ */ - - -#ifndef __IWiaLog_FWD_DEFINED__ -#define __IWiaLog_FWD_DEFINED__ -typedef interface IWiaLog IWiaLog; -#endif /* __IWiaLog_FWD_DEFINED__ */ - - -#ifndef __IWiaLogEx_FWD_DEFINED__ -#define __IWiaLogEx_FWD_DEFINED__ -typedef interface IWiaLogEx IWiaLogEx; -#endif /* __IWiaLogEx_FWD_DEFINED__ */ - - -#ifndef __IWiaNotifyDevMgr_FWD_DEFINED__ -#define __IWiaNotifyDevMgr_FWD_DEFINED__ -typedef interface IWiaNotifyDevMgr IWiaNotifyDevMgr; -#endif /* __IWiaNotifyDevMgr_FWD_DEFINED__ */ - - -#ifndef __IWiaItemExtras_FWD_DEFINED__ -#define __IWiaItemExtras_FWD_DEFINED__ -typedef interface IWiaItemExtras IWiaItemExtras; -#endif /* __IWiaItemExtras_FWD_DEFINED__ */ - - -#ifndef __WiaDevMgr_FWD_DEFINED__ -#define __WiaDevMgr_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class WiaDevMgr WiaDevMgr; -#else -typedef struct WiaDevMgr WiaDevMgr; -#endif /* __cplusplus */ - -#endif /* __WiaDevMgr_FWD_DEFINED__ */ - - -#ifndef __WiaLog_FWD_DEFINED__ -#define __WiaLog_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class WiaLog WiaLog; -#else -typedef struct WiaLog WiaLog; -#endif /* __cplusplus */ - -#endif /* __WiaLog_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "unknwn.h" -#include "oaidl.h" -#include "propidl.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_wia_xp_0000_0000 */ -/* [local] */ - - - - - - - - - - - -typedef struct _WIA_DITHER_PATTERN_DATA - { - LONG lSize; - BSTR bstrPatternName; - LONG lPatternWidth; - LONG lPatternLength; - LONG cbPattern; - BYTE *pbPattern; - } WIA_DITHER_PATTERN_DATA; - -typedef struct _WIA_DITHER_PATTERN_DATA *PWIA_DITHER_PATTERN_DATA; - -typedef struct _WIA_PROPID_TO_NAME - { - PROPID propid; - LPOLESTR pszName; - } WIA_PROPID_TO_NAME; - -typedef struct _WIA_PROPID_TO_NAME *PWIA_PROPID_TO_NAME; - -typedef struct _WIA_FORMAT_INFO - { - GUID guidFormatID; - LONG lTymed; - } WIA_FORMAT_INFO; - -typedef struct _WIA_FORMAT_INFO *PWIA_FORMAT_INFO; - -#include "wiadef.h" - - -extern RPC_IF_HANDLE __MIDL_itf_wia_xp_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wia_xp_0000_0000_v0_0_s_ifspec; - -#ifndef __IWiaDevMgr_INTERFACE_DEFINED__ -#define __IWiaDevMgr_INTERFACE_DEFINED__ - -/* interface IWiaDevMgr */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaDevMgr; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("5eb2502a-8cf1-11d1-bf92-0060081ed811") - IWiaDevMgr : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumDeviceInfo( - /* [in] */ LONG lFlag, - /* [retval][out] */ __RPC__deref_out_opt IEnumWIA_DEV_INFO **ppIEnum) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE CreateDevice( - /* [in] */ BSTR bstrDeviceID, - /* [out] */ IWiaItem **ppWiaItemRoot) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE SelectDeviceDlg( - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ BSTR *pbstrDeviceID, - /* [retval][out] */ IWiaItem **ppItemRoot) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE SelectDeviceDlgID( - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ BSTR *pbstrDeviceID) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetImageDlg( - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [in] */ IWiaItem *pItemRoot, - /* [in] */ BSTR bstrFilename, - /* [out][in] */ GUID *pguidFormat) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE RegisterEventCallbackProgram( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [in] */ BSTR bstrCommandline, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE RegisterEventCallbackInterface( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ IWiaEventCallback *pIWiaEventCallback, - /* [out] */ IUnknown **pEventObject) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE RegisterEventCallbackCLSID( - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ const GUID *pClsID, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AddDeviceDlg( - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lFlags) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaDevMgrVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaDevMgr * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaDevMgr * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumDeviceInfo )( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlag, - /* [retval][out] */ __RPC__deref_out_opt IEnumWIA_DEV_INFO **ppIEnum); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *CreateDevice )( - IWiaDevMgr * This, - /* [in] */ BSTR bstrDeviceID, - /* [out] */ IWiaItem **ppWiaItemRoot); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *SelectDeviceDlg )( - IWiaDevMgr * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ BSTR *pbstrDeviceID, - /* [retval][out] */ IWiaItem **ppItemRoot); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *SelectDeviceDlgID )( - IWiaDevMgr * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ BSTR *pbstrDeviceID); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetImageDlg )( - IWiaDevMgr * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [in] */ IWiaItem *pItemRoot, - /* [in] */ BSTR bstrFilename, - /* [out][in] */ GUID *pguidFormat); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *RegisterEventCallbackProgram )( - IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [in] */ BSTR bstrCommandline, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *RegisterEventCallbackInterface )( - IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ IWiaEventCallback *pIWiaEventCallback, - /* [out] */ IUnknown **pEventObject); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *RegisterEventCallbackCLSID )( - IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ const GUID *pClsID, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddDeviceDlg )( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lFlags); - - END_INTERFACE - } IWiaDevMgrVtbl; - - interface IWiaDevMgr - { - CONST_VTBL struct IWiaDevMgrVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaDevMgr_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaDevMgr_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaDevMgr_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaDevMgr_EnumDeviceInfo(This,lFlag,ppIEnum) \ - ( (This)->lpVtbl -> EnumDeviceInfo(This,lFlag,ppIEnum) ) - -#define IWiaDevMgr_CreateDevice(This,bstrDeviceID,ppWiaItemRoot) \ - ( (This)->lpVtbl -> CreateDevice(This,bstrDeviceID,ppWiaItemRoot) ) - -#define IWiaDevMgr_SelectDeviceDlg(This,hwndParent,lDeviceType,lFlags,pbstrDeviceID,ppItemRoot) \ - ( (This)->lpVtbl -> SelectDeviceDlg(This,hwndParent,lDeviceType,lFlags,pbstrDeviceID,ppItemRoot) ) - -#define IWiaDevMgr_SelectDeviceDlgID(This,hwndParent,lDeviceType,lFlags,pbstrDeviceID) \ - ( (This)->lpVtbl -> SelectDeviceDlgID(This,hwndParent,lDeviceType,lFlags,pbstrDeviceID) ) - -#define IWiaDevMgr_GetImageDlg(This,hwndParent,lDeviceType,lFlags,lIntent,pItemRoot,bstrFilename,pguidFormat) \ - ( (This)->lpVtbl -> GetImageDlg(This,hwndParent,lDeviceType,lFlags,lIntent,pItemRoot,bstrFilename,pguidFormat) ) - -#define IWiaDevMgr_RegisterEventCallbackProgram(This,lFlags,bstrDeviceID,pEventGUID,bstrCommandline,bstrName,bstrDescription,bstrIcon) \ - ( (This)->lpVtbl -> RegisterEventCallbackProgram(This,lFlags,bstrDeviceID,pEventGUID,bstrCommandline,bstrName,bstrDescription,bstrIcon) ) - -#define IWiaDevMgr_RegisterEventCallbackInterface(This,lFlags,bstrDeviceID,pEventGUID,pIWiaEventCallback,pEventObject) \ - ( (This)->lpVtbl -> RegisterEventCallbackInterface(This,lFlags,bstrDeviceID,pEventGUID,pIWiaEventCallback,pEventObject) ) - -#define IWiaDevMgr_RegisterEventCallbackCLSID(This,lFlags,bstrDeviceID,pEventGUID,pClsID,bstrName,bstrDescription,bstrIcon) \ - ( (This)->lpVtbl -> RegisterEventCallbackCLSID(This,lFlags,bstrDeviceID,pEventGUID,pClsID,bstrName,bstrDescription,bstrIcon) ) - -#define IWiaDevMgr_AddDeviceDlg(This,hwndParent,lFlags) \ - ( (This)->lpVtbl -> AddDeviceDlg(This,hwndParent,lFlags) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalCreateDevice_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppWiaItemRoot); - - -void __RPC_STUB IWiaDevMgr_LocalCreateDevice_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalSelectDeviceDlg_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ __RPC__deref_inout_opt BSTR *pbstrDeviceID, - /* [retval][out] */ __RPC__deref_out_opt IWiaItem **ppItemRoot); - - -void __RPC_STUB IWiaDevMgr_LocalSelectDeviceDlg_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalSelectDeviceDlgID_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrDeviceID); - - -void __RPC_STUB IWiaDevMgr_LocalSelectDeviceDlgID_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalGetImageDlg_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [in] */ __RPC__in_opt IWiaItem *pItemRoot, - /* [in] */ __RPC__in BSTR bstrFilename, - /* [out][in] */ __RPC__inout GUID *pguidFormat); - - -void __RPC_STUB IWiaDevMgr_LocalGetImageDlg_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalRegisterEventCallbackProgram_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrCommandline, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in BSTR bstrDescription, - /* [in] */ __RPC__in BSTR bstrIcon); - - -void __RPC_STUB IWiaDevMgr_LocalRegisterEventCallbackProgram_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalRegisterEventCallbackInterface_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [unique][in] */ __RPC__in_opt IWiaEventCallback *pIWiaEventCallback, - /* [out] */ __RPC__deref_out_opt IUnknown **pEventObject); - - -void __RPC_STUB IWiaDevMgr_LocalRegisterEventCallbackInterface_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_LocalRegisterEventCallbackCLSID_Proxy( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [unique][in] */ __RPC__in_opt const GUID *pClsID, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in BSTR bstrDescription, - /* [in] */ __RPC__in BSTR bstrIcon); - - -void __RPC_STUB IWiaDevMgr_LocalRegisterEventCallbackCLSID_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaDevMgr_INTERFACE_DEFINED__ */ - - -#ifndef __IEnumWIA_DEV_INFO_INTERFACE_DEFINED__ -#define __IEnumWIA_DEV_INFO_INTERFACE_DEFINED__ - -/* interface IEnumWIA_DEV_INFO */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IEnumWIA_DEV_INFO; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("5e38b83c-8cf1-11d1-bf92-0060081ed811") - IEnumWIA_DEV_INFO : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next( - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ IWiaPropertyStorage **rgelt, - /* [unique][out][in] */ ULONG *pceltFetched) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Skip( - /* [in] */ ULONG celt) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Clone( - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_INFO **ppIEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out ULONG *celt) = 0; - - }; - -#else /* C style interface */ - - typedef struct IEnumWIA_DEV_INFOVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IEnumWIA_DEV_INFO * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IEnumWIA_DEV_INFO * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IEnumWIA_DEV_INFO * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Next )( - IEnumWIA_DEV_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ IWiaPropertyStorage **rgelt, - /* [unique][out][in] */ ULONG *pceltFetched); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Skip )( - __RPC__in IEnumWIA_DEV_INFO * This, - /* [in] */ ULONG celt); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Reset )( - __RPC__in IEnumWIA_DEV_INFO * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Clone )( - __RPC__in IEnumWIA_DEV_INFO * This, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_INFO **ppIEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IEnumWIA_DEV_INFO * This, - /* [out] */ __RPC__out ULONG *celt); - - END_INTERFACE - } IEnumWIA_DEV_INFOVtbl; - - interface IEnumWIA_DEV_INFO - { - CONST_VTBL struct IEnumWIA_DEV_INFOVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IEnumWIA_DEV_INFO_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IEnumWIA_DEV_INFO_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IEnumWIA_DEV_INFO_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IEnumWIA_DEV_INFO_Next(This,celt,rgelt,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) - -#define IEnumWIA_DEV_INFO_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define IEnumWIA_DEV_INFO_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IEnumWIA_DEV_INFO_Clone(This,ppIEnum) \ - ( (This)->lpVtbl -> Clone(This,ppIEnum) ) - -#define IEnumWIA_DEV_INFO_GetCount(This,celt) \ - ( (This)->lpVtbl -> GetCount(This,celt) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWIA_DEV_INFO_RemoteNext_Proxy( - __RPC__in IEnumWIA_DEV_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) IWiaPropertyStorage **rgelt, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - - -void __RPC_STUB IEnumWIA_DEV_INFO_RemoteNext_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IEnumWIA_DEV_INFO_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaEventCallback_INTERFACE_DEFINED__ -#define __IWiaEventCallback_INTERFACE_DEFINED__ - -/* interface IWiaEventCallback */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaEventCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("ae6287b0-0084-11d2-973b-00a0c9068f2e") - IWiaEventCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ImageEventCallback( - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrEventDescription, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in BSTR bstrDeviceDescription, - /* [in] */ DWORD dwDeviceType, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out][in] */ __RPC__inout ULONG *pulEventType, - /* [in] */ ULONG ulReserved) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaEventCallbackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaEventCallback * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaEventCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaEventCallback * This); - - HRESULT ( STDMETHODCALLTYPE *ImageEventCallback )( - __RPC__in IWiaEventCallback * This, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrEventDescription, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in BSTR bstrDeviceDescription, - /* [in] */ DWORD dwDeviceType, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out][in] */ __RPC__inout ULONG *pulEventType, - /* [in] */ ULONG ulReserved); - - END_INTERFACE - } IWiaEventCallbackVtbl; - - interface IWiaEventCallback - { - CONST_VTBL struct IWiaEventCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaEventCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaEventCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaEventCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaEventCallback_ImageEventCallback(This,pEventGUID,bstrEventDescription,bstrDeviceID,bstrDeviceDescription,dwDeviceType,bstrFullItemName,pulEventType,ulReserved) \ - ( (This)->lpVtbl -> ImageEventCallback(This,pEventGUID,bstrEventDescription,bstrDeviceID,bstrDeviceDescription,dwDeviceType,bstrFullItemName,pulEventType,ulReserved) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaEventCallback_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_wia_xp_0000_0003 */ -/* [local] */ - -typedef struct _WIA_DATA_CALLBACK_HEADER - { - LONG lSize; - GUID guidFormatID; - LONG lBufferSize; - LONG lPageCount; - } WIA_DATA_CALLBACK_HEADER; - -typedef struct _WIA_DATA_CALLBACK_HEADER *PWIA_DATA_CALLBACK_HEADER; - - - -extern RPC_IF_HANDLE __MIDL_itf_wia_xp_0000_0003_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wia_xp_0000_0003_v0_0_s_ifspec; - -#ifndef __IWiaDataCallback_INTERFACE_DEFINED__ -#define __IWiaDataCallback_INTERFACE_DEFINED__ - -/* interface IWiaDataCallback */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaDataCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("a558a866-a5b0-11d2-a08f-00c04f72dc3c") - IWiaDataCallback : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE BandedDataCallback( - /* [in] */ LONG lMessage, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ LONG lReserved, - /* [in] */ LONG lResLength, - /* [size_is][in] */ BYTE *pbBuffer) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaDataCallbackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaDataCallback * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaDataCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaDataCallback * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *BandedDataCallback )( - IWiaDataCallback * This, - /* [in] */ LONG lMessage, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ LONG lReserved, - /* [in] */ LONG lResLength, - /* [size_is][in] */ BYTE *pbBuffer); - - END_INTERFACE - } IWiaDataCallbackVtbl; - - interface IWiaDataCallback - { - CONST_VTBL struct IWiaDataCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaDataCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaDataCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaDataCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaDataCallback_BandedDataCallback(This,lMessage,lStatus,lPercentComplete,lOffset,lLength,lReserved,lResLength,pbBuffer) \ - ( (This)->lpVtbl -> BandedDataCallback(This,lMessage,lStatus,lPercentComplete,lOffset,lLength,lReserved,lResLength,pbBuffer) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDataCallback_RemoteBandedDataCallback_Proxy( - __RPC__in IWiaDataCallback * This, - /* [in] */ LONG lMessage, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ LONG lReserved, - /* [in] */ LONG lResLength, - /* [unique][size_is][in] */ __RPC__in_ecount_full_opt(lResLength) BYTE *pbBuffer); - - -void __RPC_STUB IWiaDataCallback_RemoteBandedDataCallback_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaDataCallback_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_wia_xp_0000_0004 */ -/* [local] */ - -typedef struct _WIA_DATA_TRANSFER_INFO - { - ULONG ulSize; - ULONG ulSection; - ULONG ulBufferSize; - BOOL bDoubleBuffer; - ULONG ulReserved1; - ULONG ulReserved2; - ULONG ulReserved3; - } WIA_DATA_TRANSFER_INFO; - -typedef struct _WIA_DATA_TRANSFER_INFO *PWIA_DATA_TRANSFER_INFO; - -typedef struct _WIA_EXTENDED_TRANSFER_INFO - { - ULONG ulSize; - ULONG ulMinBufferSize; - ULONG ulOptimalBufferSize; - ULONG ulMaxBufferSize; - ULONG ulNumBuffers; - } WIA_EXTENDED_TRANSFER_INFO; - -typedef struct _WIA_EXTENDED_TRANSFER_INFO *PWIA_EXTENDED_TRANSFER_INFO; - - - -extern RPC_IF_HANDLE __MIDL_itf_wia_xp_0000_0004_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wia_xp_0000_0004_v0_0_s_ifspec; - -#ifndef __IWiaDataTransfer_INTERFACE_DEFINED__ -#define __IWiaDataTransfer_INTERFACE_DEFINED__ - -/* interface IWiaDataTransfer */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaDataTransfer; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("a6cef998-a5b0-11d2-a08f-00c04f72dc3c") - IWiaDataTransfer : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE idtGetData( - /* [out][in] */ LPSTGMEDIUM pMedium, - /* [unique][in] */ IWiaDataCallback *pIWiaDataCallback) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE idtGetBandedData( - /* [unique][in] */ PWIA_DATA_TRANSFER_INFO pWiaDataTransInfo, - /* [unique][in] */ IWiaDataCallback *pIWiaDataCallback) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE idtQueryGetData( - /* [unique][in] */ __RPC__in_opt WIA_FORMAT_INFO *pfe) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE idtEnumWIA_FORMAT_INFO( - /* [out] */ __RPC__deref_out_opt IEnumWIA_FORMAT_INFO **ppEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE idtGetExtendedTransferInfo( - /* [out] */ __RPC__out PWIA_EXTENDED_TRANSFER_INFO pExtendedTransferInfo) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaDataTransferVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaDataTransfer * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaDataTransfer * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaDataTransfer * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *idtGetData )( - IWiaDataTransfer * This, - /* [out][in] */ LPSTGMEDIUM pMedium, - /* [unique][in] */ IWiaDataCallback *pIWiaDataCallback); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *idtGetBandedData )( - IWiaDataTransfer * This, - /* [unique][in] */ PWIA_DATA_TRANSFER_INFO pWiaDataTransInfo, - /* [unique][in] */ IWiaDataCallback *pIWiaDataCallback); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *idtQueryGetData )( - __RPC__in IWiaDataTransfer * This, - /* [unique][in] */ __RPC__in_opt WIA_FORMAT_INFO *pfe); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *idtEnumWIA_FORMAT_INFO )( - __RPC__in IWiaDataTransfer * This, - /* [out] */ __RPC__deref_out_opt IEnumWIA_FORMAT_INFO **ppEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *idtGetExtendedTransferInfo )( - __RPC__in IWiaDataTransfer * This, - /* [out] */ __RPC__out PWIA_EXTENDED_TRANSFER_INFO pExtendedTransferInfo); - - END_INTERFACE - } IWiaDataTransferVtbl; - - interface IWiaDataTransfer - { - CONST_VTBL struct IWiaDataTransferVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaDataTransfer_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaDataTransfer_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaDataTransfer_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaDataTransfer_idtGetData(This,pMedium,pIWiaDataCallback) \ - ( (This)->lpVtbl -> idtGetData(This,pMedium,pIWiaDataCallback) ) - -#define IWiaDataTransfer_idtGetBandedData(This,pWiaDataTransInfo,pIWiaDataCallback) \ - ( (This)->lpVtbl -> idtGetBandedData(This,pWiaDataTransInfo,pIWiaDataCallback) ) - -#define IWiaDataTransfer_idtQueryGetData(This,pfe) \ - ( (This)->lpVtbl -> idtQueryGetData(This,pfe) ) - -#define IWiaDataTransfer_idtEnumWIA_FORMAT_INFO(This,ppEnum) \ - ( (This)->lpVtbl -> idtEnumWIA_FORMAT_INFO(This,ppEnum) ) - -#define IWiaDataTransfer_idtGetExtendedTransferInfo(This,pExtendedTransferInfo) \ - ( (This)->lpVtbl -> idtGetExtendedTransferInfo(This,pExtendedTransferInfo) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDataTransfer_idtGetDataEx_Proxy( - __RPC__in IWiaDataTransfer * This, - /* [out][in] */ __RPC__inout LPSTGMEDIUM pMedium, - /* [unique][in] */ __RPC__in_opt IWiaDataCallback *pIWiaDataCallback); - - -void __RPC_STUB IWiaDataTransfer_idtGetDataEx_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDataTransfer_idtGetBandedDataEx_Proxy( - __RPC__in IWiaDataTransfer * This, - /* [unique][in] */ __RPC__in_opt PWIA_DATA_TRANSFER_INFO pWiaDataTransInfo, - /* [unique][in] */ __RPC__in_opt IWiaDataCallback *pIWiaDataCallback); - - -void __RPC_STUB IWiaDataTransfer_idtGetBandedDataEx_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaDataTransfer_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaItem_INTERFACE_DEFINED__ -#define __IWiaItem_INTERFACE_DEFINED__ - -/* interface IWiaItem */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaItem; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4db1ad10-3391-11d2-9a33-00c04fa36145") - IWiaItem : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetItemType( - /* [out] */ __RPC__out LONG *pItemType) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AnalyzeItem( - /* [in] */ LONG lFlags) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumChildItems( - /* [out] */ __RPC__deref_out_opt IEnumWiaItem **ppIEnumWiaItem) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DeleteItem( - /* [in] */ LONG lFlags) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CreateChildItem( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrItemName, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppIWiaItem) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumRegisterEventInfo( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE FindItemByName( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppIWiaItem) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE DeviceDlg( - /* [in] */ HWND hwndParent, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [out] */ LONG *plItemCount, - /* [out] */ IWiaItem ***ppIWiaItem) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DeviceCommand( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in const GUID *pCmdGUID, - /* [out][in] */ __RPC__deref_inout_opt IWiaItem **pIWiaItem) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetRootItem( - /* [out] */ __RPC__deref_out_opt IWiaItem **ppIWiaItem) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnumDeviceCapabilities( - /* [in] */ LONG lFlags, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnumWIA_DEV_CAPS) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DumpItemData( - /* [out] */ __RPC__deref_out_opt BSTR *bstrData) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DumpDrvItemData( - /* [out] */ __RPC__deref_out_opt BSTR *bstrData) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DumpTreeItemData( - /* [out] */ __RPC__deref_out_opt BSTR *bstrData) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Diagnostic( - /* [in] */ ULONG ulSize, - /* [size_is][in] */ __RPC__in_ecount_full(ulSize) BYTE *pBuffer) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaItemVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaItem * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaItem * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaItem * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetItemType )( - __RPC__in IWiaItem * This, - /* [out] */ __RPC__out LONG *pItemType); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *AnalyzeItem )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumChildItems )( - __RPC__in IWiaItem * This, - /* [out] */ __RPC__deref_out_opt IEnumWiaItem **ppIEnumWiaItem); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DeleteItem )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateChildItem )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrItemName, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppIWiaItem); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumRegisterEventInfo )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *FindItemByName )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppIWiaItem); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *DeviceDlg )( - IWiaItem * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [out] */ LONG *plItemCount, - /* [out] */ IWiaItem ***ppIWiaItem); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DeviceCommand )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in const GUID *pCmdGUID, - /* [out][in] */ __RPC__deref_inout_opt IWiaItem **pIWiaItem); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetRootItem )( - __RPC__in IWiaItem * This, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppIWiaItem); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumDeviceCapabilities )( - __RPC__in IWiaItem * This, - /* [in] */ LONG lFlags, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnumWIA_DEV_CAPS); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpItemData )( - __RPC__in IWiaItem * This, - /* [out] */ __RPC__deref_out_opt BSTR *bstrData); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpDrvItemData )( - __RPC__in IWiaItem * This, - /* [out] */ __RPC__deref_out_opt BSTR *bstrData); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpTreeItemData )( - __RPC__in IWiaItem * This, - /* [out] */ __RPC__deref_out_opt BSTR *bstrData); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Diagnostic )( - __RPC__in IWiaItem * This, - /* [in] */ ULONG ulSize, - /* [size_is][in] */ __RPC__in_ecount_full(ulSize) BYTE *pBuffer); - - END_INTERFACE - } IWiaItemVtbl; - - interface IWiaItem - { - CONST_VTBL struct IWiaItemVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaItem_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaItem_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaItem_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaItem_GetItemType(This,pItemType) \ - ( (This)->lpVtbl -> GetItemType(This,pItemType) ) - -#define IWiaItem_AnalyzeItem(This,lFlags) \ - ( (This)->lpVtbl -> AnalyzeItem(This,lFlags) ) - -#define IWiaItem_EnumChildItems(This,ppIEnumWiaItem) \ - ( (This)->lpVtbl -> EnumChildItems(This,ppIEnumWiaItem) ) - -#define IWiaItem_DeleteItem(This,lFlags) \ - ( (This)->lpVtbl -> DeleteItem(This,lFlags) ) - -#define IWiaItem_CreateChildItem(This,lFlags,bstrItemName,bstrFullItemName,ppIWiaItem) \ - ( (This)->lpVtbl -> CreateChildItem(This,lFlags,bstrItemName,bstrFullItemName,ppIWiaItem) ) - -#define IWiaItem_EnumRegisterEventInfo(This,lFlags,pEventGUID,ppIEnum) \ - ( (This)->lpVtbl -> EnumRegisterEventInfo(This,lFlags,pEventGUID,ppIEnum) ) - -#define IWiaItem_FindItemByName(This,lFlags,bstrFullItemName,ppIWiaItem) \ - ( (This)->lpVtbl -> FindItemByName(This,lFlags,bstrFullItemName,ppIWiaItem) ) - -#define IWiaItem_DeviceDlg(This,hwndParent,lFlags,lIntent,plItemCount,ppIWiaItem) \ - ( (This)->lpVtbl -> DeviceDlg(This,hwndParent,lFlags,lIntent,plItemCount,ppIWiaItem) ) - -#define IWiaItem_DeviceCommand(This,lFlags,pCmdGUID,pIWiaItem) \ - ( (This)->lpVtbl -> DeviceCommand(This,lFlags,pCmdGUID,pIWiaItem) ) - -#define IWiaItem_GetRootItem(This,ppIWiaItem) \ - ( (This)->lpVtbl -> GetRootItem(This,ppIWiaItem) ) - -#define IWiaItem_EnumDeviceCapabilities(This,lFlags,ppIEnumWIA_DEV_CAPS) \ - ( (This)->lpVtbl -> EnumDeviceCapabilities(This,lFlags,ppIEnumWIA_DEV_CAPS) ) - -#define IWiaItem_DumpItemData(This,bstrData) \ - ( (This)->lpVtbl -> DumpItemData(This,bstrData) ) - -#define IWiaItem_DumpDrvItemData(This,bstrData) \ - ( (This)->lpVtbl -> DumpDrvItemData(This,bstrData) ) - -#define IWiaItem_DumpTreeItemData(This,bstrData) \ - ( (This)->lpVtbl -> DumpTreeItemData(This,bstrData) ) - -#define IWiaItem_Diagnostic(This,ulSize,pBuffer) \ - ( (This)->lpVtbl -> Diagnostic(This,ulSize,pBuffer) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaItem_LocalDeviceDlg_Proxy( - __RPC__in IWiaItem * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [out] */ __RPC__out LONG *plItemCount, - /* [out] */ __RPC__deref_out_opt IWiaItem ***pIWiaItem); - - -void __RPC_STUB IWiaItem_LocalDeviceDlg_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaItem_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaPropertyStorage_INTERFACE_DEFINED__ -#define __IWiaPropertyStorage_INTERFACE_DEFINED__ - -/* interface IWiaPropertyStorage */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaPropertyStorage; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("98B5E8A0-29CC-491a-AAC0-E6DB4FDCCEB6") - IWiaPropertyStorage : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ReadMultiple( - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpspec) PROPVARIANT rgpropvar[ ]) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE WriteMultiple( - /* [in] */ ULONG cpspec, - /* [size_is][in] */ const PROPSPEC rgpspec[ ], - /* [size_is][in] */ const PROPVARIANT rgpropvar[ ], - /* [in] */ PROPID propidNameFirst) = 0; - - virtual HRESULT STDMETHODCALLTYPE DeleteMultiple( - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE ReadPropertyNames( - /* [in] */ ULONG cpropid, - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpropid) LPOLESTR rglpwstrName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE WritePropertyNames( - /* [in] */ ULONG cpropid, - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[ ], - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const LPOLESTR rglpwstrName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE DeletePropertyNames( - /* [in] */ ULONG cpropid, - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE Commit( - /* [in] */ DWORD grfCommitFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE Revert( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Enum( - /* [out] */ __RPC__deref_out_opt IEnumSTATPROPSTG **ppenum) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetTimes( - /* [in] */ __RPC__in const FILETIME *pctime, - /* [in] */ __RPC__in const FILETIME *patime, - /* [in] */ __RPC__in const FILETIME *pmtime) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetClass( - /* [in] */ __RPC__in REFCLSID clsid) = 0; - - virtual HRESULT STDMETHODCALLTYPE Stat( - /* [out] */ __RPC__out STATPROPSETSTG *pstatpsstg) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetPropertyAttributes( - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) PROPSPEC rgpspec[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpspec) ULONG rgflags[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpspec) PROPVARIANT rgpropvar[ ]) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out ULONG *pulNumProps) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetPropertyStream( - /* [out] */ __RPC__out GUID *pCompatibilityId, - /* [out] */ __RPC__deref_out_opt IStream **ppIStream) = 0; - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetPropertyStream( - /* [in] */ GUID *pCompatibilityId, - /* [unique][in] */ IStream *pIStream) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaPropertyStorageVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaPropertyStorage * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaPropertyStorage * This); - - HRESULT ( STDMETHODCALLTYPE *ReadMultiple )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpspec) PROPVARIANT rgpropvar[ ]); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *WriteMultiple )( - IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ const PROPSPEC rgpspec[ ], - /* [size_is][in] */ const PROPVARIANT rgpropvar[ ], - /* [in] */ PROPID propidNameFirst); - - HRESULT ( STDMETHODCALLTYPE *DeleteMultiple )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[ ]); - - HRESULT ( STDMETHODCALLTYPE *ReadPropertyNames )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpropid, - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpropid) LPOLESTR rglpwstrName[ ]); - - HRESULT ( STDMETHODCALLTYPE *WritePropertyNames )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpropid, - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[ ], - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const LPOLESTR rglpwstrName[ ]); - - HRESULT ( STDMETHODCALLTYPE *DeletePropertyNames )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpropid, - /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[ ]); - - HRESULT ( STDMETHODCALLTYPE *Commit )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ DWORD grfCommitFlags); - - HRESULT ( STDMETHODCALLTYPE *Revert )( - __RPC__in IWiaPropertyStorage * This); - - HRESULT ( STDMETHODCALLTYPE *Enum )( - __RPC__in IWiaPropertyStorage * This, - /* [out] */ __RPC__deref_out_opt IEnumSTATPROPSTG **ppenum); - - HRESULT ( STDMETHODCALLTYPE *SetTimes )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ __RPC__in const FILETIME *pctime, - /* [in] */ __RPC__in const FILETIME *patime, - /* [in] */ __RPC__in const FILETIME *pmtime); - - HRESULT ( STDMETHODCALLTYPE *SetClass )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ __RPC__in REFCLSID clsid); - - HRESULT ( STDMETHODCALLTYPE *Stat )( - __RPC__in IWiaPropertyStorage * This, - /* [out] */ __RPC__out STATPROPSETSTG *pstatpsstg); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPropertyAttributes )( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) PROPSPEC rgpspec[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpspec) ULONG rgflags[ ], - /* [size_is][out] */ __RPC__out_ecount_full(cpspec) PROPVARIANT rgpropvar[ ]); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IWiaPropertyStorage * This, - /* [out] */ __RPC__out ULONG *pulNumProps); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPropertyStream )( - __RPC__in IWiaPropertyStorage * This, - /* [out] */ __RPC__out GUID *pCompatibilityId, - /* [out] */ __RPC__deref_out_opt IStream **ppIStream); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetPropertyStream )( - IWiaPropertyStorage * This, - /* [in] */ GUID *pCompatibilityId, - /* [unique][in] */ IStream *pIStream); - - END_INTERFACE - } IWiaPropertyStorageVtbl; - - interface IWiaPropertyStorage - { - CONST_VTBL struct IWiaPropertyStorageVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaPropertyStorage_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaPropertyStorage_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaPropertyStorage_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaPropertyStorage_ReadMultiple(This,cpspec,rgpspec,rgpropvar) \ - ( (This)->lpVtbl -> ReadMultiple(This,cpspec,rgpspec,rgpropvar) ) - -#define IWiaPropertyStorage_WriteMultiple(This,cpspec,rgpspec,rgpropvar,propidNameFirst) \ - ( (This)->lpVtbl -> WriteMultiple(This,cpspec,rgpspec,rgpropvar,propidNameFirst) ) - -#define IWiaPropertyStorage_DeleteMultiple(This,cpspec,rgpspec) \ - ( (This)->lpVtbl -> DeleteMultiple(This,cpspec,rgpspec) ) - -#define IWiaPropertyStorage_ReadPropertyNames(This,cpropid,rgpropid,rglpwstrName) \ - ( (This)->lpVtbl -> ReadPropertyNames(This,cpropid,rgpropid,rglpwstrName) ) - -#define IWiaPropertyStorage_WritePropertyNames(This,cpropid,rgpropid,rglpwstrName) \ - ( (This)->lpVtbl -> WritePropertyNames(This,cpropid,rgpropid,rglpwstrName) ) - -#define IWiaPropertyStorage_DeletePropertyNames(This,cpropid,rgpropid) \ - ( (This)->lpVtbl -> DeletePropertyNames(This,cpropid,rgpropid) ) - -#define IWiaPropertyStorage_Commit(This,grfCommitFlags) \ - ( (This)->lpVtbl -> Commit(This,grfCommitFlags) ) - -#define IWiaPropertyStorage_Revert(This) \ - ( (This)->lpVtbl -> Revert(This) ) - -#define IWiaPropertyStorage_Enum(This,ppenum) \ - ( (This)->lpVtbl -> Enum(This,ppenum) ) - -#define IWiaPropertyStorage_SetTimes(This,pctime,patime,pmtime) \ - ( (This)->lpVtbl -> SetTimes(This,pctime,patime,pmtime) ) - -#define IWiaPropertyStorage_SetClass(This,clsid) \ - ( (This)->lpVtbl -> SetClass(This,clsid) ) - -#define IWiaPropertyStorage_Stat(This,pstatpsstg) \ - ( (This)->lpVtbl -> Stat(This,pstatpsstg) ) - -#define IWiaPropertyStorage_GetPropertyAttributes(This,cpspec,rgpspec,rgflags,rgpropvar) \ - ( (This)->lpVtbl -> GetPropertyAttributes(This,cpspec,rgpspec,rgflags,rgpropvar) ) - -#define IWiaPropertyStorage_GetCount(This,pulNumProps) \ - ( (This)->lpVtbl -> GetCount(This,pulNumProps) ) - -#define IWiaPropertyStorage_GetPropertyStream(This,pCompatibilityId,ppIStream) \ - ( (This)->lpVtbl -> GetPropertyStream(This,pCompatibilityId,ppIStream) ) - -#define IWiaPropertyStorage_SetPropertyStream(This,pCompatibilityId,pIStream) \ - ( (This)->lpVtbl -> SetPropertyStream(This,pCompatibilityId,pIStream) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [call_as] */ HRESULT STDMETHODCALLTYPE IWiaPropertyStorage_RemoteWriteMultiple_Proxy( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC *rgpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPVARIANT *rgpropvar, - /* [in] */ PROPID propidNameFirst); - - -void __RPC_STUB IWiaPropertyStorage_RemoteWriteMultiple_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaPropertyStorage_RemoteSetPropertyStream_Proxy( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ __RPC__in GUID *pCompatibilityId, - /* [unique][in] */ __RPC__in_opt IStream *pIStream); - - -void __RPC_STUB IWiaPropertyStorage_RemoteSetPropertyStream_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IWiaPropertyStorage_INTERFACE_DEFINED__ */ - - -#ifndef __IEnumWiaItem_INTERFACE_DEFINED__ -#define __IEnumWiaItem_INTERFACE_DEFINED__ - -/* interface IEnumWiaItem */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IEnumWiaItem; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("5e8383fc-3391-11d2-9a33-00c04fa36145") - IEnumWiaItem : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next( - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ IWiaItem **ppIWiaItem, - /* [unique][out][in] */ ULONG *pceltFetched) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Skip( - /* [in] */ ULONG celt) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Clone( - /* [out] */ __RPC__deref_out_opt IEnumWiaItem **ppIEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out ULONG *celt) = 0; - - }; - -#else /* C style interface */ - - typedef struct IEnumWiaItemVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IEnumWiaItem * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IEnumWiaItem * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IEnumWiaItem * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Next )( - IEnumWiaItem * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ IWiaItem **ppIWiaItem, - /* [unique][out][in] */ ULONG *pceltFetched); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Skip )( - __RPC__in IEnumWiaItem * This, - /* [in] */ ULONG celt); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Reset )( - __RPC__in IEnumWiaItem * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Clone )( - __RPC__in IEnumWiaItem * This, - /* [out] */ __RPC__deref_out_opt IEnumWiaItem **ppIEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IEnumWiaItem * This, - /* [out] */ __RPC__out ULONG *celt); - - END_INTERFACE - } IEnumWiaItemVtbl; - - interface IEnumWiaItem - { - CONST_VTBL struct IEnumWiaItemVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IEnumWiaItem_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IEnumWiaItem_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IEnumWiaItem_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IEnumWiaItem_Next(This,celt,ppIWiaItem,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,ppIWiaItem,pceltFetched) ) - -#define IEnumWiaItem_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define IEnumWiaItem_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IEnumWiaItem_Clone(This,ppIEnum) \ - ( (This)->lpVtbl -> Clone(This,ppIEnum) ) - -#define IEnumWiaItem_GetCount(This,celt) \ - ( (This)->lpVtbl -> GetCount(This,celt) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWiaItem_RemoteNext_Proxy( - __RPC__in IEnumWiaItem * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) IWiaItem **ppIWiaItem, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - - -void __RPC_STUB IEnumWiaItem_RemoteNext_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IEnumWiaItem_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_wia_xp_0000_0008 */ -/* [local] */ - -typedef struct _WIA_DEV_CAP - { - GUID guid; - ULONG ulFlags; - BSTR bstrName; - BSTR bstrDescription; - BSTR bstrIcon; - BSTR bstrCommandline; - } WIA_DEV_CAP; - -typedef struct _WIA_DEV_CAP *PWIA_DEV_CAP; - -typedef struct _WIA_DEV_CAP WIA_EVENT_HANDLER; - -typedef struct _WIA_DEV_CAP *PWIA_EVENT_HANDLER; - - - -extern RPC_IF_HANDLE __MIDL_itf_wia_xp_0000_0008_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wia_xp_0000_0008_v0_0_s_ifspec; - -#ifndef __IEnumWIA_DEV_CAPS_INTERFACE_DEFINED__ -#define __IEnumWIA_DEV_CAPS_INTERFACE_DEFINED__ - -/* interface IEnumWIA_DEV_CAPS */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IEnumWIA_DEV_CAPS; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1fcc4287-aca6-11d2-a093-00c04f72dc3c") - IEnumWIA_DEV_CAPS : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next( - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ WIA_DEV_CAP *rgelt, - /* [unique][out][in] */ ULONG *pceltFetched) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Skip( - /* [in] */ ULONG celt) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Clone( - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out ULONG *pcelt) = 0; - - }; - -#else /* C style interface */ - - typedef struct IEnumWIA_DEV_CAPSVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IEnumWIA_DEV_CAPS * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IEnumWIA_DEV_CAPS * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IEnumWIA_DEV_CAPS * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Next )( - IEnumWIA_DEV_CAPS * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ WIA_DEV_CAP *rgelt, - /* [unique][out][in] */ ULONG *pceltFetched); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Skip )( - __RPC__in IEnumWIA_DEV_CAPS * This, - /* [in] */ ULONG celt); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Reset )( - __RPC__in IEnumWIA_DEV_CAPS * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Clone )( - __RPC__in IEnumWIA_DEV_CAPS * This, - /* [out] */ __RPC__deref_out_opt IEnumWIA_DEV_CAPS **ppIEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IEnumWIA_DEV_CAPS * This, - /* [out] */ __RPC__out ULONG *pcelt); - - END_INTERFACE - } IEnumWIA_DEV_CAPSVtbl; - - interface IEnumWIA_DEV_CAPS - { - CONST_VTBL struct IEnumWIA_DEV_CAPSVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IEnumWIA_DEV_CAPS_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IEnumWIA_DEV_CAPS_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IEnumWIA_DEV_CAPS_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IEnumWIA_DEV_CAPS_Next(This,celt,rgelt,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) - -#define IEnumWIA_DEV_CAPS_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define IEnumWIA_DEV_CAPS_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IEnumWIA_DEV_CAPS_Clone(This,ppIEnum) \ - ( (This)->lpVtbl -> Clone(This,ppIEnum) ) - -#define IEnumWIA_DEV_CAPS_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWIA_DEV_CAPS_RemoteNext_Proxy( - __RPC__in IEnumWIA_DEV_CAPS * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) WIA_DEV_CAP *rgelt, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - - -void __RPC_STUB IEnumWIA_DEV_CAPS_RemoteNext_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IEnumWIA_DEV_CAPS_INTERFACE_DEFINED__ */ - - -#ifndef __IEnumWIA_FORMAT_INFO_INTERFACE_DEFINED__ -#define __IEnumWIA_FORMAT_INFO_INTERFACE_DEFINED__ - -/* interface IEnumWIA_FORMAT_INFO */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IEnumWIA_FORMAT_INFO; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("81BEFC5B-656D-44f1-B24C-D41D51B4DC81") - IEnumWIA_FORMAT_INFO : public IUnknown - { - public: - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next( - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ WIA_FORMAT_INFO *rgelt, - /* [unique][out][in] */ ULONG *pceltFetched) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Skip( - /* [in] */ ULONG celt) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Clone( - /* [out] */ __RPC__deref_out_opt IEnumWIA_FORMAT_INFO **ppIEnum) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out ULONG *pcelt) = 0; - - }; - -#else /* C style interface */ - - typedef struct IEnumWIA_FORMAT_INFOVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IEnumWIA_FORMAT_INFO * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IEnumWIA_FORMAT_INFO * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IEnumWIA_FORMAT_INFO * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Next )( - IEnumWIA_FORMAT_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ WIA_FORMAT_INFO *rgelt, - /* [unique][out][in] */ ULONG *pceltFetched); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Skip )( - __RPC__in IEnumWIA_FORMAT_INFO * This, - /* [in] */ ULONG celt); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Reset )( - __RPC__in IEnumWIA_FORMAT_INFO * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Clone )( - __RPC__in IEnumWIA_FORMAT_INFO * This, - /* [out] */ __RPC__deref_out_opt IEnumWIA_FORMAT_INFO **ppIEnum); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( - __RPC__in IEnumWIA_FORMAT_INFO * This, - /* [out] */ __RPC__out ULONG *pcelt); - - END_INTERFACE - } IEnumWIA_FORMAT_INFOVtbl; - - interface IEnumWIA_FORMAT_INFO - { - CONST_VTBL struct IEnumWIA_FORMAT_INFOVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IEnumWIA_FORMAT_INFO_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IEnumWIA_FORMAT_INFO_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IEnumWIA_FORMAT_INFO_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IEnumWIA_FORMAT_INFO_Next(This,celt,rgelt,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) - -#define IEnumWIA_FORMAT_INFO_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define IEnumWIA_FORMAT_INFO_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IEnumWIA_FORMAT_INFO_Clone(This,ppIEnum) \ - ( (This)->lpVtbl -> Clone(This,ppIEnum) ) - -#define IEnumWIA_FORMAT_INFO_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWIA_FORMAT_INFO_RemoteNext_Proxy( - __RPC__in IEnumWIA_FORMAT_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) WIA_FORMAT_INFO *rgelt, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - - -void __RPC_STUB IEnumWIA_FORMAT_INFO_RemoteNext_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IEnumWIA_FORMAT_INFO_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaLog_INTERFACE_DEFINED__ -#define __IWiaLog_INTERFACE_DEFINED__ - -/* interface IWiaLog */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaLog; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("A00C10B6-82A1-452f-8B6C-86062AAD6890") - IWiaLog : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE InitializeLog( - /* [in] */ LONG hInstance) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE hResult( - /* [in] */ HRESULT hResult) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Log( - /* [in] */ LONG lFlags, - /* [in] */ LONG lResID, - /* [in] */ LONG lDetail, - /* [in] */ __RPC__in BSTR bstrText) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaLogVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaLog * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaLog * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaLog * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *InitializeLog )( - __RPC__in IWiaLog * This, - /* [in] */ LONG hInstance); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *hResult )( - __RPC__in IWiaLog * This, - /* [in] */ HRESULT hResult); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Log )( - __RPC__in IWiaLog * This, - /* [in] */ LONG lFlags, - /* [in] */ LONG lResID, - /* [in] */ LONG lDetail, - /* [in] */ __RPC__in BSTR bstrText); - - END_INTERFACE - } IWiaLogVtbl; - - interface IWiaLog - { - CONST_VTBL struct IWiaLogVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaLog_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaLog_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaLog_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaLog_InitializeLog(This,hInstance) \ - ( (This)->lpVtbl -> InitializeLog(This,hInstance) ) - -#define IWiaLog_hResult(This,hResult) \ - ( (This)->lpVtbl -> hResult(This,hResult) ) - -#define IWiaLog_Log(This,lFlags,lResID,lDetail,bstrText) \ - ( (This)->lpVtbl -> Log(This,lFlags,lResID,lDetail,bstrText) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaLog_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaLogEx_INTERFACE_DEFINED__ -#define __IWiaLogEx_INTERFACE_DEFINED__ - -/* interface IWiaLogEx */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaLogEx; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("AF1F22AC-7A40-4787-B421-AEb47A1FBD0B") - IWiaLogEx : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE InitializeLogEx( - /* [in] */ __RPC__in BYTE *hInstance) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE hResult( - /* [in] */ HRESULT hResult) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Log( - /* [in] */ LONG lFlags, - /* [in] */ LONG lResID, - /* [in] */ LONG lDetail, - /* [in] */ __RPC__in BSTR bstrText) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE hResultEx( - /* [in] */ LONG lMethodId, - /* [in] */ HRESULT hResult) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE LogEx( - /* [in] */ LONG lMethodId, - /* [in] */ LONG lFlags, - /* [in] */ LONG lResID, - /* [in] */ LONG lDetail, - /* [in] */ __RPC__in BSTR bstrText) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaLogExVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaLogEx * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaLogEx * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaLogEx * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *InitializeLogEx )( - __RPC__in IWiaLogEx * This, - /* [in] */ __RPC__in BYTE *hInstance); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *hResult )( - __RPC__in IWiaLogEx * This, - /* [in] */ HRESULT hResult); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Log )( - __RPC__in IWiaLogEx * This, - /* [in] */ LONG lFlags, - /* [in] */ LONG lResID, - /* [in] */ LONG lDetail, - /* [in] */ __RPC__in BSTR bstrText); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *hResultEx )( - __RPC__in IWiaLogEx * This, - /* [in] */ LONG lMethodId, - /* [in] */ HRESULT hResult); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *LogEx )( - __RPC__in IWiaLogEx * This, - /* [in] */ LONG lMethodId, - /* [in] */ LONG lFlags, - /* [in] */ LONG lResID, - /* [in] */ LONG lDetail, - /* [in] */ __RPC__in BSTR bstrText); - - END_INTERFACE - } IWiaLogExVtbl; - - interface IWiaLogEx - { - CONST_VTBL struct IWiaLogExVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaLogEx_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaLogEx_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaLogEx_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaLogEx_InitializeLogEx(This,hInstance) \ - ( (This)->lpVtbl -> InitializeLogEx(This,hInstance) ) - -#define IWiaLogEx_hResult(This,hResult) \ - ( (This)->lpVtbl -> hResult(This,hResult) ) - -#define IWiaLogEx_Log(This,lFlags,lResID,lDetail,bstrText) \ - ( (This)->lpVtbl -> Log(This,lFlags,lResID,lDetail,bstrText) ) - -#define IWiaLogEx_hResultEx(This,lMethodId,hResult) \ - ( (This)->lpVtbl -> hResultEx(This,lMethodId,hResult) ) - -#define IWiaLogEx_LogEx(This,lMethodId,lFlags,lResID,lDetail,bstrText) \ - ( (This)->lpVtbl -> LogEx(This,lMethodId,lFlags,lResID,lDetail,bstrText) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaLogEx_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaNotifyDevMgr_INTERFACE_DEFINED__ -#define __IWiaNotifyDevMgr_INTERFACE_DEFINED__ - -/* interface IWiaNotifyDevMgr */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaNotifyDevMgr; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("70681EA0-E7BF-4291-9FB1-4E8813A3F78E") - IWiaNotifyDevMgr : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE NewDeviceArrival( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaNotifyDevMgrVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaNotifyDevMgr * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaNotifyDevMgr * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaNotifyDevMgr * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *NewDeviceArrival )( - __RPC__in IWiaNotifyDevMgr * This); - - END_INTERFACE - } IWiaNotifyDevMgrVtbl; - - interface IWiaNotifyDevMgr - { - CONST_VTBL struct IWiaNotifyDevMgrVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaNotifyDevMgr_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaNotifyDevMgr_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaNotifyDevMgr_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaNotifyDevMgr_NewDeviceArrival(This) \ - ( (This)->lpVtbl -> NewDeviceArrival(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaNotifyDevMgr_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaItemExtras_INTERFACE_DEFINED__ -#define __IWiaItemExtras_INTERFACE_DEFINED__ - -/* interface IWiaItemExtras */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaItemExtras; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6291ef2c-36ef-4532-876a-8e132593778d") - IWiaItemExtras : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetExtendedErrorInfo( - /* [out] */ __RPC__deref_out_opt BSTR *bstrErrorText) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Escape( - /* [in] */ DWORD dwEscapeCode, - /* [size_is][in] */ __RPC__in_ecount_full(cbInDataSize) BYTE *lpInData, - /* [in] */ DWORD cbInDataSize, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(dwOutDataSize, pdwActualDataSize ? *pdwActualDataSize : dwOutDataSize) BYTE *pOutData, - /* [in] */ DWORD dwOutDataSize, - /* [out] */ __RPC__out DWORD *pdwActualDataSize) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CancelPendingIO( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaItemExtrasVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaItemExtras * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaItemExtras * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaItemExtras * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetExtendedErrorInfo )( - __RPC__in IWiaItemExtras * This, - /* [out] */ __RPC__deref_out_opt BSTR *bstrErrorText); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Escape )( - __RPC__in IWiaItemExtras * This, - /* [in] */ DWORD dwEscapeCode, - /* [size_is][in] */ __RPC__in_ecount_full(cbInDataSize) BYTE *lpInData, - /* [in] */ DWORD cbInDataSize, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(dwOutDataSize, pdwActualDataSize ? *pdwActualDataSize : dwOutDataSize) BYTE *pOutData, - /* [in] */ DWORD dwOutDataSize, - /* [out] */ __RPC__out DWORD *pdwActualDataSize); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *CancelPendingIO )( - __RPC__in IWiaItemExtras * This); - - END_INTERFACE - } IWiaItemExtrasVtbl; - - interface IWiaItemExtras - { - CONST_VTBL struct IWiaItemExtrasVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaItemExtras_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaItemExtras_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaItemExtras_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaItemExtras_GetExtendedErrorInfo(This,bstrErrorText) \ - ( (This)->lpVtbl -> GetExtendedErrorInfo(This,bstrErrorText) ) - -#define IWiaItemExtras_Escape(This,dwEscapeCode,lpInData,cbInDataSize,pOutData,dwOutDataSize,pdwActualDataSize) \ - ( (This)->lpVtbl -> Escape(This,dwEscapeCode,lpInData,cbInDataSize,pOutData,dwOutDataSize,pdwActualDataSize) ) - -#define IWiaItemExtras_CancelPendingIO(This) \ - ( (This)->lpVtbl -> CancelPendingIO(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaItemExtras_INTERFACE_DEFINED__ */ - - - -#ifndef __WiaDevMgr_LIBRARY_DEFINED__ -#define __WiaDevMgr_LIBRARY_DEFINED__ - -/* library WiaDevMgr */ -/* [helpstring][version][uuid] */ - - -EXTERN_C const IID LIBID_WiaDevMgr; - -EXTERN_C const CLSID CLSID_WiaDevMgr; - -#ifdef __cplusplus - -class DECLSPEC_UUID("a1f4e726-8cf1-11d1-bf92-0060081ed811") -WiaDevMgr; -#endif - -EXTERN_C const CLSID CLSID_WiaLog; - -#ifdef __cplusplus - -class DECLSPEC_UUID("A1E75357-881A-419e-83E2-BB16DB197C68") -WiaLog; -#endif -#endif /* __WiaDevMgr_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -unsigned long __RPC_USER BSTR_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); -void __RPC_USER BSTR_UserFree( __RPC__in unsigned long *, __RPC__in BSTR * ); - -unsigned long __RPC_USER HWND_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in HWND * ); -unsigned char * __RPC_USER HWND_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in HWND * ); -unsigned char * __RPC_USER HWND_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out HWND * ); -void __RPC_USER HWND_UserFree( __RPC__in unsigned long *, __RPC__in HWND * ); - -unsigned long __RPC_USER LPSAFEARRAY_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * ); -void __RPC_USER LPSAFEARRAY_UserFree( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * ); - -unsigned long __RPC_USER STGMEDIUM_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in STGMEDIUM * ); -unsigned char * __RPC_USER STGMEDIUM_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in STGMEDIUM * ); -unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out STGMEDIUM * ); -void __RPC_USER STGMEDIUM_UserFree( __RPC__in unsigned long *, __RPC__in STGMEDIUM * ); - -unsigned long __RPC_USER BSTR_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); -void __RPC_USER BSTR_UserFree64( __RPC__in unsigned long *, __RPC__in BSTR * ); - -unsigned long __RPC_USER HWND_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in HWND * ); -unsigned char * __RPC_USER HWND_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in HWND * ); -unsigned char * __RPC_USER HWND_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out HWND * ); -void __RPC_USER HWND_UserFree64( __RPC__in unsigned long *, __RPC__in HWND * ); - -unsigned long __RPC_USER LPSAFEARRAY_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * ); -void __RPC_USER LPSAFEARRAY_UserFree64( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * ); - -unsigned long __RPC_USER STGMEDIUM_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in STGMEDIUM * ); -unsigned char * __RPC_USER STGMEDIUM_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in STGMEDIUM * ); -unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out STGMEDIUM * ); -void __RPC_USER STGMEDIUM_UserFree64( __RPC__in unsigned long *, __RPC__in STGMEDIUM * ); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_CreateDevice_Proxy( - IWiaDevMgr * This, - /* [in] */ BSTR bstrDeviceID, - /* [out] */ IWiaItem **ppWiaItemRoot); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_CreateDevice_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [out] */ __RPC__deref_out_opt IWiaItem **ppWiaItemRoot); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_SelectDeviceDlg_Proxy( - IWiaDevMgr * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ BSTR *pbstrDeviceID, - /* [retval][out] */ IWiaItem **ppItemRoot); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_SelectDeviceDlg_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [out][in] */ __RPC__deref_inout_opt BSTR *pbstrDeviceID, - /* [retval][out] */ __RPC__deref_out_opt IWiaItem **ppItemRoot); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_SelectDeviceDlgID_Proxy( - IWiaDevMgr * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ BSTR *pbstrDeviceID); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_SelectDeviceDlgID_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [retval][out] */ __RPC__deref_out_opt BSTR *pbstrDeviceID); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_GetImageDlg_Proxy( - IWiaDevMgr * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [in] */ IWiaItem *pItemRoot, - /* [in] */ BSTR bstrFilename, - /* [out][in] */ GUID *pguidFormat); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_GetImageDlg_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lDeviceType, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [in] */ __RPC__in_opt IWiaItem *pItemRoot, - /* [in] */ __RPC__in BSTR bstrFilename, - /* [out][in] */ __RPC__inout GUID *pguidFormat); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_RegisterEventCallbackProgram_Proxy( - IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [in] */ BSTR bstrCommandline, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_RegisterEventCallbackProgram_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrCommandline, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in BSTR bstrDescription, - /* [in] */ __RPC__in BSTR bstrIcon); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_RegisterEventCallbackInterface_Proxy( - IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ IWiaEventCallback *pIWiaEventCallback, - /* [out] */ IUnknown **pEventObject); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_RegisterEventCallbackInterface_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [unique][in] */ __RPC__in_opt IWiaEventCallback *pIWiaEventCallback, - /* [out] */ __RPC__deref_out_opt IUnknown **pEventObject); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_RegisterEventCallbackCLSID_Proxy( - IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ BSTR bstrDeviceID, - /* [in] */ const GUID *pEventGUID, - /* [unique][in] */ const GUID *pClsID, - /* [in] */ BSTR bstrName, - /* [in] */ BSTR bstrDescription, - /* [in] */ BSTR bstrIcon); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDevMgr_RegisterEventCallbackCLSID_Stub( - __RPC__in IWiaDevMgr * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [unique][in] */ __RPC__in_opt const GUID *pClsID, - /* [in] */ __RPC__in BSTR bstrName, - /* [in] */ __RPC__in BSTR bstrDescription, - /* [in] */ __RPC__in BSTR bstrIcon); - -/* [local] */ HRESULT STDMETHODCALLTYPE IEnumWIA_DEV_INFO_Next_Proxy( - IEnumWIA_DEV_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ IWiaPropertyStorage **rgelt, - /* [unique][out][in] */ ULONG *pceltFetched); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWIA_DEV_INFO_Next_Stub( - __RPC__in IEnumWIA_DEV_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) IWiaPropertyStorage **rgelt, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDataCallback_BandedDataCallback_Proxy( - IWiaDataCallback * This, - /* [in] */ LONG lMessage, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ LONG lReserved, - /* [in] */ LONG lResLength, - /* [size_is][in] */ BYTE *pbBuffer); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDataCallback_BandedDataCallback_Stub( - __RPC__in IWiaDataCallback * This, - /* [in] */ LONG lMessage, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ LONG lReserved, - /* [in] */ LONG lResLength, - /* [unique][size_is][in] */ __RPC__in_ecount_full_opt(lResLength) BYTE *pbBuffer); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDataTransfer_idtGetData_Proxy( - IWiaDataTransfer * This, - /* [out][in] */ LPSTGMEDIUM pMedium, - /* [unique][in] */ IWiaDataCallback *pIWiaDataCallback); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDataTransfer_idtGetData_Stub( - __RPC__in IWiaDataTransfer * This, - /* [out][in] */ __RPC__inout LPSTGMEDIUM pMedium, - /* [unique][in] */ __RPC__in_opt IWiaDataCallback *pIWiaDataCallback); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaDataTransfer_idtGetBandedData_Proxy( - IWiaDataTransfer * This, - /* [unique][in] */ PWIA_DATA_TRANSFER_INFO pWiaDataTransInfo, - /* [unique][in] */ IWiaDataCallback *pIWiaDataCallback); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaDataTransfer_idtGetBandedData_Stub( - __RPC__in IWiaDataTransfer * This, - /* [unique][in] */ __RPC__in_opt PWIA_DATA_TRANSFER_INFO pWiaDataTransInfo, - /* [unique][in] */ __RPC__in_opt IWiaDataCallback *pIWiaDataCallback); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaItem_DeviceDlg_Proxy( - IWiaItem * This, - /* [in] */ HWND hwndParent, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [out] */ LONG *plItemCount, - /* [out] */ IWiaItem ***ppIWiaItem); - - -/* [nocode][helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaItem_DeviceDlg_Stub( - __RPC__in IWiaItem * This, - /* [in] */ __RPC__in HWND hwndParent, - /* [in] */ LONG lFlags, - /* [in] */ LONG lIntent, - /* [out] */ __RPC__out LONG *plItemCount, - /* [out] */ __RPC__deref_out_opt IWiaItem ***pIWiaItem); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaPropertyStorage_WriteMultiple_Proxy( - IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ const PROPSPEC rgpspec[ ], - /* [size_is][in] */ const PROPVARIANT rgpropvar[ ], - /* [in] */ PROPID propidNameFirst); - - -/* [call_as] */ HRESULT STDMETHODCALLTYPE IWiaPropertyStorage_WriteMultiple_Stub( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ ULONG cpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC *rgpspec, - /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPVARIANT *rgpropvar, - /* [in] */ PROPID propidNameFirst); - -/* [local] */ HRESULT STDMETHODCALLTYPE IWiaPropertyStorage_SetPropertyStream_Proxy( - IWiaPropertyStorage * This, - /* [in] */ GUID *pCompatibilityId, - /* [unique][in] */ IStream *pIStream); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IWiaPropertyStorage_SetPropertyStream_Stub( - __RPC__in IWiaPropertyStorage * This, - /* [in] */ __RPC__in GUID *pCompatibilityId, - /* [unique][in] */ __RPC__in_opt IStream *pIStream); - -/* [local] */ HRESULT STDMETHODCALLTYPE IEnumWiaItem_Next_Proxy( - IEnumWiaItem * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ IWiaItem **ppIWiaItem, - /* [unique][out][in] */ ULONG *pceltFetched); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWiaItem_Next_Stub( - __RPC__in IEnumWiaItem * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) IWiaItem **ppIWiaItem, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - -/* [local] */ HRESULT STDMETHODCALLTYPE IEnumWIA_DEV_CAPS_Next_Proxy( - IEnumWIA_DEV_CAPS * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ WIA_DEV_CAP *rgelt, - /* [unique][out][in] */ ULONG *pceltFetched); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWIA_DEV_CAPS_Next_Stub( - __RPC__in IEnumWIA_DEV_CAPS * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) WIA_DEV_CAP *rgelt, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - -/* [local] */ HRESULT STDMETHODCALLTYPE IEnumWIA_FORMAT_INFO_Next_Proxy( - IEnumWIA_FORMAT_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ WIA_FORMAT_INFO *rgelt, - /* [unique][out][in] */ ULONG *pceltFetched); - - -/* [helpstring][call_as] */ HRESULT STDMETHODCALLTYPE IEnumWIA_FORMAT_INFO_Next_Stub( - __RPC__in IEnumWIA_FORMAT_INFO * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) WIA_FORMAT_INFO *rgelt, - /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); - - - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/wiaintfc.h b/pub/ddk/wiaintfc.h deleted file mode 100644 index aa2a8c4..0000000 --- a/pub/ddk/wiaintfc.h +++ /dev/null @@ -1,39 +0,0 @@ -/*++ - -Copyright (c) 1986-2003 Microsoft Corporation - -Module Name: - - wiaintfc.h - -Abstract: - - This module contains interface class GUID for WIA. - -Revision History: - - ---*/ - -#if (_WIN32_WINNT >= 0x0501) // Windows XP and later - -#ifndef _WIAINTFC_H_ -#define _WIAINTFC_H_ - -// -// Set packing -// - -#include -#include - -// -// GUID for Image class device interface. -// - -DEFINE_GUID(GUID_DEVINTERFACE_IMAGE, 0x6bdd1fc6L, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f); - -#endif // _WIAINTFC_H_ - -#endif //#if (_WIN32_WINNT >= 0x0501) - diff --git a/pub/ddk/wiamdef.h b/pub/ddk/wiamdef.h deleted file mode 100644 index 05f3424..0000000 --- a/pub/ddk/wiamdef.h +++ /dev/null @@ -1,326 +0,0 @@ -/****************************************************************************** -* -* (C) COPYRIGHT MICROSOFT CORP., 1998-1999 -* -* TITLE: wiamdef.h -* -* VERSION: 2.0 -* -* DATE: 28 July, 1999 -* -* DESCRIPTION: -* Header file used to define WIA constants and globals. -* Note: This header was introduced first in Windows XP -* -******************************************************************************/ - -#ifndef _WIAMDEF_H_ -#define _WIAMDEF_H_ - -#if (NTDDI_VERSION >= NTDDI_WINXP) -#pragma once - -#define STRSAFE_NO_DEPRECATE -#include - -// -// The following array of PROPIDs identifies properties that are ALWAYS -// present in a WIA_PROPERTY_CONTEXT. Drivers can specify additional -// properties when creating a property context with wiasCreatePropContext. -// - -#ifdef STD_PROPS_IN_CONTEXT - -#define NUM_STD_PROPS_IN_CONTEXT 13 -PROPID WIA_StdPropsInContext[NUM_STD_PROPS_IN_CONTEXT] = { - WIA_IPA_DATATYPE, - WIA_IPA_DEPTH, - WIA_IPS_XRES, - WIA_IPS_XPOS, - WIA_IPS_XEXTENT, - WIA_IPA_PIXELS_PER_LINE, - WIA_IPS_YRES, - WIA_IPS_YPOS, - WIA_IPS_YEXTENT, - WIA_IPA_NUMBER_OF_LINES, - WIA_IPS_CUR_INTENT, - WIA_IPA_TYMED, - WIA_IPA_FORMAT, - }; -#endif - -#if (NTDDI_VERSION >= NTDDI_VISTA) -// -// drvAcquireItemData flags -// -#define WIA_MINIDRV_TRANSFER_ACQUIRE_CHILDREN 0x00000001 -#define WIA_MINIDRV_TRANSFER_DOWNLOAD 0x00000002 -#define WIA_MINIDRV_TRANSFER_UPLOAD 0x00000004 -#endif //#if (NTDDI_VERSION >= NTDDI_VISTA) - -//************************************************************************** -// -// WIA Service prototypes -// -// -// History: -// -// 4/27/1999 - Initial Version -// -//************************************************************************** - -// Flag used by wiasGetImageInformation. - -#define WIAS_INIT_CONTEXT 1 - -// Flag used by wiasDownSampleBuffer - -#define WIAS_GET_DOWNSAMPLED_SIZE_ONLY 0x1 - -// -// IWiaMiniDrvService methods -// - -#ifdef __cplusplus -extern "C" { -#endif - -HRESULT _stdcall wiasCreateDrvItem(LONG lObjectFlags, BSTR bstrItemName, BSTR bstrFullItemName, - __inout IWiaMiniDrv *pIMiniDrv, LONG cbDevSpecContext, - __deref_out_bcount_opt(cbDevSpecContext) BYTE **ppDevSpecContext, __out IWiaDrvItem **ppIWiaDrvItem); - -HRESULT _stdcall wiasReadMultiple(__in BYTE *pWiasContext, ULONG ulCount, - __in_ecount(ulCount) const PROPSPEC *ps, __out_ecount(ulCount) PROPVARIANT *pv, - __out_ecount_opt(ulCount) PROPVARIANT *pvOld); - -HRESULT _stdcall wiasWriteMultiple(__in BYTE *pWiasContext, ULONG ulCount, - __in_ecount(ulCount) const PROPSPEC *ps, const PROPVARIANT *pv); - -HRESULT _stdcall wiasWritePropBin(__in BYTE *pWiasContext, PROPID propid, LONG cbVal, - __in_bcount(cbVal) BYTE *pbVal); - -HRESULT _stdcall wiasGetPropertyAttributes(__in BYTE *pWiasContext, LONG cPropSpec, - __in_ecount(cPropSpec) PROPSPEC *pPropSpec, ULONG *pulAccessFlags, - __out_ecount(cPropSpec) PROPVARIANT *pPropVar); - -HRESULT _stdcall wiasSetPropertyAttributes(__in BYTE *pWiasContext, LONG cPropSpec, - __in_ecount(cPropSpec) PROPSPEC *pPropSpec, __in ULONG *pulAccessFlags, - __out_ecount(cPropSpec) PROPVARIANT *pPropVar); - -HRESULT _stdcall wiasValidateItemProperties(__in BYTE *pWiasContext, ULONG nPropSpec, - __in_ecount(nPropSpec) const PROPSPEC *pPropSpec); - -HRESULT _stdcall wiasCreatePropContext(ULONG cPropSpec, __in_ecount(cPropSpec) PROPSPEC *pPropSpec, - ULONG cProps, __in_ecount_opt(cProps) PROPID *pProps, __in WIA_PROPERTY_CONTEXT *pContext); - -HRESULT _stdcall wiasGetImageInformation(__in BYTE *pWiasContext, LONG lFlags, - __inout PMINIDRV_TRANSFER_CONTEXT pmdtc); - -HRESULT _stdcall wiasWritePageBufToFile(__in PMINIDRV_TRANSFER_CONTEXT pmdtc); -HRESULT _stdcall wiasWritePageBufToStream(__in PMINIDRV_TRANSFER_CONTEXT pmdtc, __in IStream * pstream); -HRESULT _stdcall wiasWriteBufToFile(LONG lFlags, __in PMINIDRV_TRANSFER_CONTEXT pmdtc); - -HRESULT _stdcall wiasReadPropStr(__in BYTE *pWiasContext, PROPID propid, - __out BSTR *pbstr, __out_opt BSTR *pbstrOld, BOOL bMustExist); -HRESULT _stdcall wiasReadPropLong(__in BYTE *pWiasContext, PROPID propid, - __out LONG *plVal, __out_opt LONG *plValOld, BOOL bMustExist); -HRESULT _stdcall wiasReadPropFloat(__in BYTE *pWiasContext, PROPID propid, - __out FLOAT *pfVal, __out_opt FLOAT *pfValOld, BOOL bMustExist); -HRESULT _stdcall wiasReadPropGuid(__in BYTE *pWiasContext, PROPID propid, - __out GUID *pguidVal, __out_opt GUID *pguidValOld, BOOL bMustExist); -HRESULT _stdcall wiasReadPropBin(__in BYTE *pWiasContext, PROPID propid, - __out BYTE **ppbVal, __out_opt BYTE **ppbValOld, BOOL bMustExist); - -HRESULT _stdcall wiasWritePropStr(__in BYTE *pWiasContext, PROPID propid, __in_opt BSTR bstr); -HRESULT _stdcall wiasWritePropLong(__in BYTE *pWiasContext, PROPID propid, LONG lVal); -HRESULT _stdcall wiasWritePropFloat(__in BYTE *pWiasContext, PROPID propid, float fVal); -HRESULT _stdcall wiasWritePropGuid(__in BYTE *pWiasContext, PROPID propid, GUID guidVal); - -HRESULT _stdcall wiasSetItemPropNames(__in BYTE *pWiasContext, LONG cItemProps, - __inout_ecount(cItemProps) PROPID *ppId, __inout_ecount(cItemProps) LPOLESTR *ppszNames); -HRESULT _stdcall wiasSetItemPropAttribs(__in BYTE *pWiasContext, LONG cPropSpec, - __in_ecount(cPropSpec) PROPSPEC *pPropSpec, __in_ecount(cPropSpec) PWIA_PROPERTY_INFO pwpi); - -HRESULT _stdcall wiasSendEndOfPage(__in BYTE *pWiasContext, - LONG lPageCount, __inout PMINIDRV_TRANSFER_CONTEXT pmdtc); - -HRESULT _stdcall wiasGetItemType(__in BYTE *pWiasContext, __out LONG *plType); - -HRESULT _stdcall wiasGetDrvItem(__in BYTE *pWiasContext, __out IWiaDrvItem **ppIWiaDrvItem); -HRESULT _stdcall wiasGetRootItem(__in BYTE *pWiasContext, __out BYTE **ppWiasContext); - -HRESULT _stdcall wiasSetValidFlag(__in BYTE* pWiasContext, PROPID propid, ULONG ulNom, ULONG ulValidBits); -HRESULT _stdcall wiasSetValidRangeLong(__in BYTE* pWiasContext, PROPID propid, LONG lMin, LONG lNom, LONG lMax, LONG lStep); -HRESULT _stdcall wiasSetValidRangeFloat(__in BYTE* pWiasContext, PROPID propid, FLOAT fMin, FLOAT fNom, FLOAT fMax, FLOAT fStep); -HRESULT _stdcall wiasSetValidListLong(__in BYTE *pWiasContext, PROPID propid, ULONG ulCount, LONG lNom, LONG *plValues); -HRESULT _stdcall wiasSetValidListFloat(__in BYTE *pWiasContext, PROPID propid, ULONG ulCount, FLOAT fNom, __in_ecount(ulCount) FLOAT *pfValues); -HRESULT _stdcall wiasSetValidListGuid(__in BYTE *pWiasContext, PROPID propid, ULONG ulCount, GUID guidNom, __in_ecount(ulCount) GUID *pguidValues); -HRESULT _stdcall wiasSetValidListStr(__in BYTE *pWiasContext, PROPID propid, ULONG ulCount, BSTR bstrNom, __in_ecount(ulCount) BSTR *bstrValues); - -HRESULT _stdcall wiasFreePropContext(__inout WIA_PROPERTY_CONTEXT *pContext); -HRESULT _stdcall wiasIsPropChanged(PROPID propid, __in WIA_PROPERTY_CONTEXT *pContext, __out BOOL *pbChanged); -HRESULT _stdcall wiasSetPropChanged(PROPID propid, __in WIA_PROPERTY_CONTEXT *pContext, BOOL bChanged); -HRESULT _stdcall wiasGetChangedValueLong(__in BYTE *pWiasContext, __in WIA_PROPERTY_CONTEXT *pContext, - BOOL bNoValidation, PROPID propID, __out WIAS_CHANGED_VALUE_INFO *pInfo); -HRESULT _stdcall wiasGetChangedValueFloat(__in BYTE *pWiasContext, __in WIA_PROPERTY_CONTEXT *pContext, - BOOL bNoValidation, PROPID propID, __out WIAS_CHANGED_VALUE_INFO *pInfo); -HRESULT _stdcall wiasGetChangedValueGuid(__in BYTE *pWiasContext, __in WIA_PROPERTY_CONTEXT *pContext, - BOOL bNoValidation, PROPID propID, __out WIAS_CHANGED_VALUE_INFO *pInfo); -HRESULT _stdcall wiasGetChangedValueStr(__in BYTE *pWiasContext, __in WIA_PROPERTY_CONTEXT *pContext, - BOOL bNoValidation, PROPID propID, __out WIAS_CHANGED_VALUE_INFO *pInfo); - -HRESULT _stdcall wiasGetContextFromName(__in BYTE *pWiasContext, LONG lFlags, __in BSTR bstrName, __out BYTE **ppWiasContext); - -HRESULT _stdcall wiasUpdateScanRect(__in BYTE *pWiasContext, __in WIA_PROPERTY_CONTEXT *pContext, LONG lWidth, LONG lHeight); -HRESULT _stdcall wiasUpdateValidFormat(__in BYTE *pWiasContext, __in WIA_PROPERTY_CONTEXT *pContext, __in IWiaMiniDrv *pIMiniDrv); - -HRESULT _stdcall wiasGetChildrenContexts(__in BYTE *pParentContext, __out ULONG *pulNumChildren, - __out_ecount(*pulNumChildren) BYTE ***pppChildren); - -HRESULT _stdcall wiasQueueEvent(__in BSTR bstrDeviceId, __in const GUID *pEventGUID, __in_opt BSTR bstrFullItemName); - -VOID __cdecl wiasDebugTrace(__in HINSTANCE hInstance, __in LPCSTR pszFormat, ... ); -VOID __cdecl wiasDebugError(__in HINSTANCE hInstance, __in LPCSTR pszFormat, ... ); -VOID __stdcall wiasPrintDebugHResult(__in HINSTANCE hInstance, HRESULT hr ); - -BSTR __cdecl wiasFormatArgs(__in LPCSTR lpszFormat, ...); - -HRESULT _stdcall wiasCreateChildAppItem(__in BYTE *pParentWiasContext, LONG lFlags, - __in BSTR bstrItemName, __in BSTR bstrFullItemName, __out BYTE **ppWiasChildContext); - -HRESULT _stdcall wiasCreateLogInstance(__in BYTE *pModuleHandle, __out IWiaLogEx **ppIWiaLogEx); -HRESULT _stdcall wiasDownSampleBuffer(LONG lFlags, __inout WIAS_DOWN_SAMPLE_INFO *pInfo); -HRESULT _stdcall wiasParseEndorserString(__in BYTE *pWiasContext, LONG lFlags, - __out_opt WIAS_ENDORSER_INFO *pInfo, __out BSTR *pOutputString); - -#ifndef WIA_MAP_OLD_DEBUG - -#if defined(_DEBUG) || defined(DBG) || defined(WIA_DEBUG) - -#define WIAS_TRACE(x) wiasDebugTrace x -#define WIAS_ERROR(x) wiasDebugError x -#define WIAS_HRESULT(x) wiasPrintDebugHResult x -#define WIAS_ASSERT(x, y) \ - if (!(y)) { \ - WIAS_ERROR((x, (char*) TEXT("ASSERTION FAILED: %hs(%d): %hs"), __FILE__,__LINE__,#x)); \ - DebugBreak(); \ - } - -#else - -#define WIAS_TRACE(x) -#define WIAS_ERROR(x) -#define WIAS_HRESULT(x) -#define WIAS_ASSERT(x, y) - -#endif - -#define WIAS_LTRACE(pILog,ResID,Detail,Args) \ - { if ( pILog ) \ - pILog->Log(WIALOG_TRACE, ResID, Detail, wiasFormatArgs Args);\ - }; -#define WIAS_LERROR(pILog,ResID,Args) \ - {if ( pILog )\ - pILog->Log(WIALOG_ERROR, ResID, WIALOG_NO_LEVEL, wiasFormatArgs Args);\ - }; -#define WIAS_LWARNING(pILog,ResID,Args) \ - {if ( pILog )\ - pILog->Log(WIALOG_WARNING, ResID, WIALOG_NO_LEVEL, wiasFormatArgs Args);\ - }; -#define WIAS_LHRESULT(pILog,hr) \ - {if ( pILog )\ - pILog->hResult(hr);\ - }; - -// -// IWiaLog Defines -// - -// Type of logging -#define WIALOG_TRACE 0x00000001 -#define WIALOG_WARNING 0x00000002 -#define WIALOG_ERROR 0x00000004 - -// level of detail for TRACE logging -#define WIALOG_LEVEL1 1 // Entry and Exit point of each function/method -#define WIALOG_LEVEL2 2 // LEVEL 1, + traces within the function/method -#define WIALOG_LEVEL3 3 // LEVEL 1, LEVEL 2, and any extra debugging information -#define WIALOG_LEVEL4 4 // USER DEFINED data + all LEVELS of tracing - -#define WIALOG_NO_RESOURCE_ID 0 -#define WIALOG_NO_LEVEL 0 - -// -// Entering / Leaving class -// - -class CWiaLogProc { -private: - CHAR m_szMessage[MAX_PATH]; - IWiaLog *m_pIWiaLog; - INT m_DetailLevel; - INT m_ResourceID; - -public: - inline CWiaLogProc(IWiaLog *pIWiaLog, INT ResourceID, INT DetailLevel, __in __nullterminated CHAR *pszMsg) { - ZeroMemory(m_szMessage, sizeof(m_szMessage)); - StringCchCopyA(m_szMessage, ARRAYSIZE(m_szMessage), pszMsg); - m_pIWiaLog = pIWiaLog; - m_DetailLevel = DetailLevel; - m_ResourceID = ResourceID; - WIAS_LTRACE(pIWiaLog, - ResourceID, - DetailLevel, - ("%s, entering",m_szMessage)); - } - - inline ~CWiaLogProc() { - WIAS_LTRACE(m_pIWiaLog, - m_ResourceID, - m_DetailLevel, - ("%s, leaving",m_szMessage)); - } -}; - -class CWiaLogProcEx { -private: - CHAR m_szMessage[MAX_PATH]; - IWiaLogEx *m_pIWiaLog; - INT m_DetailLevel; - INT m_ResourceID; - -public: - inline CWiaLogProcEx(IWiaLogEx *pIWiaLog, INT ResourceID, INT DetailLevel, __in __nullterminated CHAR *pszMsg, LONG lMethodId = 0) { - UNREFERENCED_PARAMETER(lMethodId); - - ZeroMemory(m_szMessage, sizeof(m_szMessage)); - StringCchCopyA(m_szMessage, ARRAYSIZE(m_szMessage), pszMsg); - m_pIWiaLog = pIWiaLog; - m_DetailLevel = DetailLevel; - m_ResourceID = ResourceID; - WIAS_LTRACE(pIWiaLog, - ResourceID, - DetailLevel, - ("%s, entering",m_szMessage)); - } - - inline ~CWiaLogProcEx() { - WIAS_LTRACE(m_pIWiaLog, - m_ResourceID, - m_DetailLevel, - ("%s, leaving",m_szMessage)); - } -}; - -#endif // WIA_MAP_OLD_DEBUG - - -#ifdef __cplusplus -} - -#endif -#endif //#ifdef (NTDDI_VERSION >= NTDDI_WINXP) - -#endif // _WIAMDEF_H_ - - diff --git a/pub/ddk/wiamicro.h b/pub/ddk/wiamicro.h deleted file mode 100644 index 03db54e..0000000 --- a/pub/ddk/wiamicro.h +++ /dev/null @@ -1,221 +0,0 @@ -/**************************************************************************** -* -* (C) COPYRIGHT 1999-2000, MICROSOFT CORP. -* -* FILE: wiamicro.h -* -* VERSION: 3.0 -* -* DESCRIPTION: -* Definitions to support WIA scanner and camera microdrivers. -* -*****************************************************************************/ - -#if (_WIN32_WINNT >= 0x0501) // Windows XP and later - -#pragma once - -#include - -#define WIAMICRO_API __declspec(dllexport) - -#include - -/****************************************************************************\ -* Scanner microdriver definitions -\****************************************************************************/ - -// -// Private #defines -// - -#define MAX_IO_HANDLES 16 -#define MAX_RESERVED 4 -#define MAX_ANSI_CHAR 255 - -// -// Common BUS types -// - -#define BUS_TYPE_SCSI 200 -#define BUS_TYPE_USB 201 -#define BUS_TYPE_PARALLEL 202 -#define BUS_TYPE_FIREWIRE 203 - -// -// command list -// - -#define SCAN_FIRST 10 -#define SCAN_NEXT 20 -#define SCAN_FINISHED 30 - -#define SCANMODE_FINALSCAN 0 -#define SCANMODE_PREVIEWSCAN 1 - -#define CMD_INITIALIZE 100 -#define CMD_UNINITIALIZE 101 -#define CMD_SETXRESOLUTION 102 -#define CMD_SETYRESOLUTION 103 -#define CMD_SETCONTRAST 104 -#define CMD_SETINTENSITY 105 -#define CMD_SETDATATYPE 106 -#define CMD_SETDITHER 107 -#define CMD_SETMIRROR 108 -#define CMD_SETNEGATIVE 109 -#define CMD_SETTONEMAP 110 -#define CMD_SETCOLORDITHER 111 -#define CMD_SETMATRIX 112 -#define CMD_SETSPEED 113 -#define CMD_SETFILTER 114 -#define CMD_LOAD_ADF 115 -#define CMD_UNLOAD_ADF 116 -#define CMD_GETADFAVAILABLE 117 -#define CMD_GETADFOPEN 118 -#define CMD_GETADFREADY 119 -#define CMD_GETADFHASPAPER 120 -#define CMD_GETADFSTATUS 121 -#define CMD_GETADFUNLOADREADY 122 -#define CMD_GETTPAAVAILABLE 123 -#define CMD_GETTPAOPENED 124 -#define CMD_TPAREADY 125 -#define CMD_SETLAMP 126 -#define CMD_SENDSCSICOMMAND 127 -#define CMD_STI_DEVICERESET 128 -#define CMD_STI_GETSTATUS 129 -#define CMD_STI_DIAGNOSTIC 130 -#define CMD_RESETSCANNER 131 -#define CMD_GETCAPABILITIES 132 -#define CMD_GET_INTERRUPT_EVENT 133 -#define CMD_SETGSDNAME 134 -#define CMD_SETSCANMODE 135 -#define CMD_SETSTIDEVICEHKEY 136 -#define CMD_GETSUPPORTEDFILEFORMATS 138 -#define CMD_GETSUPPORTEDMEMORYFORMATS 139 -#define CMD_SETFORMAT 140 - -#define SUPPORT_COLOR 0x00000001 -#define SUPPORT_BW 0x00000002 -#define SUPPORT_GRAYSCALE 0x00000004 - -// -// Error Codes -// - -#define MCRO_ERROR_GENERAL_ERROR 0 // All lVal values are initialized to '0' -#define MCRO_STATUS_OK 1 // General success status return -#define MCRO_ERROR_PAPER_JAM 2 // ADF has a paper Jam -#define MCRO_ERROR_PAPER_PROBLEM 3 // ADF has a paper problem -#define MCRO_ERROR_PAPER_EMPTY 4 // ADF has no paper -#define MCRO_ERROR_OFFLINE 5 // ADF or Device is offline -#define MCRO_ERROR_USER_INTERVENTION 6 // User needs to interact with the physical device - -// -// WIA compatible #defines -// - -#define WIA_PACKED_PIXEL 0 -#define WIA_PLANAR 1 - -#define WIA_ORDER_RGB 0 -#define WIA_ORDER_BGR 1 - -#define WIA_DATA_THRESHOLD 0 -#define WIA_DATA_DITHER 1 -#define WIA_DATA_GRAYSCALE 2 -#define WIA_DATA_COLOR 3 -#define WIA_DATA_COLOR_THRESHOLD 4 -#define WIA_DATA_COLOR_DITHER 5 - -// -// structure definitions -// - -typedef struct _RANGEVALUE { - LONG lMin; // minimum value - LONG lMax; // maximum value - LONG lStep; // increment/step value -} RANGEVALUE, *PRANGEVALUE; - -typedef struct _SCANWINDOW { - LONG xPos; // X position (left) - LONG yPos; // Y position (top) - LONG xExtent; // X extent (right) - LONG yExtent; // Y extent (bottom) -} SCANWINDOW, *PSCANWINDOW; - -typedef struct _SCANINFO { - // Common Scanner specs - LONG ADF; // (0 - no support, 1 - supported, 2 - supported and It can duplex) - LONG TPA; // (0 - no support, 1 - supported) - LONG Endorser; // (0 - no endorser, 1 - supported) - LONG OpticalXResolution; // (dpi setting of optics) - LONG OpticalYResolution; // (dpi setting of optics) - LONG BedWidth; // (bed width in 1000's of an inch) - LONG BedHeight; // (bed height in 1000's of an inch) - RANGEVALUE IntensityRange; // (Intensity/Brightness ranges) - RANGEVALUE ContrastRange; // (Contrast ranges) - LONG SupportedCompressionType; // (mask of supported compression types, 0 - None) - LONG SupportedDataTypes; // (mask of supported types, (ie. SUPPORT_COLOR|SUPPORT_BW...)) - // Current Image Info - LONG WidthPixels; // (width of image, using current scanner settings in pixels) - LONG WidthBytes; // (width of image, using current scanner settings in bytes) - LONG Lines; // (height of image, using current scanner settings in pixles) - LONG DataType; // (current data type set) - LONG PixelBits; // (current bit depth setting) - // Current Scanner settings - LONG Intensity; // (current Intensity/Brightness setting) - LONG Contrast; // (current contrast setting) - LONG Xresolution; // (current X Resolution) - LONG Yresolution; // (current Y Resolution - SCANWINDOW Window; // (current scanner window settings) - // Scanner options - LONG DitherPattern; - LONG Negative; // (0 - off, 1 - Negative is on) - LONG Mirror; // (0 - off, 1 - Mirror is on) - LONG AutoBack; // (0 - off, 1 - AutoBack is on) - LONG ColorDitherPattern; // (dither pattern??) - LONG ToneMap; // (tone map ??) - LONG Compression; // (0 - off, 1 - Compression is on) - LONG RawDataFormat; // (0 - Packed data 1 - Planar data) - LONG RawPixelOrder; // (0 - RGB, 1 - BGR) - LONG bNeedDataAlignment; // (0 - FALSE, 1 - TRUE) - LONG DelayBetweenRead; // delay between WIA Scan() calls requesting data (milliseconds) - LONG MaxBufferSize; // maximum buffer size in scanner - HANDLE DeviceIOHandles[MAX_IO_HANDLES]; // Device IO handles needed for device communication - LONG lReserved[MAX_RESERVED]; // (silly reserved bits) - VOID *pMicroDriverContext; // private data for Micro driver's only. - // The Micro Driver is responsible for allocating and freeing. - // CMD_INITIALIZE - allocate, CMD_UNINITIALIZE - free -}SCANINFO, *PSCANINFO; - -typedef struct VAL { - LONG lVal; // long value - double dblVal; // float/double value - GUID *pGuid; // GUID pointer - PSCANINFO pScanInfo; // pointer to the shared ScanInfo struct - HGLOBAL handle; // handle value - WCHAR **ppButtonNames; // pointer to button names array - HANDLE *pHandle; // pointer to a Handle value - LONG lReserved; // lone value - CHAR szVal[MAX_ANSI_CHAR]; // ANSI string -}VAL, *PVAL; - -// -// Micro driver entry points -// - -WIAMICRO_API HRESULT MicroEntry(LONG lCommand, __inout PVAL pValue); -WIAMICRO_API HRESULT Scan(__inout PSCANINFO pScanInfo, LONG lPhase, __out_bcount(lLength) PBYTE pBuffer, LONG lLength, __out LONG *plReceived); -WIAMICRO_API HRESULT SetPixelWindow(__inout PSCANINFO pScanInfo, LONG x, LONG y, LONG xExtent, LONG yExtent); - -// -// optional debug trace -// - -VOID Trace(__in LPCTSTR Format, ...); - -#include - -#endif //#if (_WIN32_WINNT >= 0x0501) - diff --git a/pub/ddk/wiamindr.h b/pub/ddk/wiamindr.h deleted file mode 100644 index ee2aeac..0000000 --- a/pub/ddk/wiamindr.h +++ /dev/null @@ -1,6 +0,0 @@ -#if (NTDDI_VERSION >= NTDDI_VISTA) -#include -#elif (NTDDI_VERSION >= NTDDI_WINXP) -#include -#endif - diff --git a/pub/ddk/wiamindr_lh.h b/pub/ddk/wiamindr_lh.h deleted file mode 100644 index c73c4d0..0000000 --- a/pub/ddk/wiamindr_lh.h +++ /dev/null @@ -1,1032 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for wiamindr_lh.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __wiamindr_lh_h__ -#define __wiamindr_lh_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IWiaMiniDrv_FWD_DEFINED__ -#define __IWiaMiniDrv_FWD_DEFINED__ -typedef interface IWiaMiniDrv IWiaMiniDrv; -#endif /* __IWiaMiniDrv_FWD_DEFINED__ */ - - -#ifndef __IWiaMiniDrvCallBack_FWD_DEFINED__ -#define __IWiaMiniDrvCallBack_FWD_DEFINED__ -typedef interface IWiaMiniDrvCallBack IWiaMiniDrvCallBack; -#endif /* __IWiaMiniDrvCallBack_FWD_DEFINED__ */ - - -#ifndef __IWiaMiniDrvTransferCallback_FWD_DEFINED__ -#define __IWiaMiniDrvTransferCallback_FWD_DEFINED__ -typedef interface IWiaMiniDrvTransferCallback IWiaMiniDrvTransferCallback; -#endif /* __IWiaMiniDrvTransferCallback_FWD_DEFINED__ */ - - -#ifndef __IWiaDrvItem_FWD_DEFINED__ -#define __IWiaDrvItem_FWD_DEFINED__ -typedef interface IWiaDrvItem IWiaDrvItem; -#endif /* __IWiaDrvItem_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "unknwn.h" -#include "oaidl.h" -#include "propidl.h" -#include "wia_lh.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_wiamindr_lh_0000_0000 */ -/* [local] */ - - - - - - - -typedef struct _MINIDRV_TRANSFER_CONTEXT - { - LONG lSize; - LONG lWidthInPixels; - LONG lLines; - LONG lDepth; - LONG lXRes; - LONG lYRes; - LONG lCompression; - GUID guidFormatID; - LONG tymed; - LONG_PTR hFile; - LONG cbOffset; - LONG lBufferSize; - LONG lActiveBuffer; - LONG lNumBuffers; - BYTE *pBaseBuffer; - BYTE *pTransferBuffer; - BOOL bTransferDataCB; - BOOL bClassDrvAllocBuf; - LONG_PTR lClientAddress; - IWiaMiniDrvCallBack *pIWiaMiniDrvCallBack; - LONG lImageSize; - LONG lHeaderSize; - LONG lItemSize; - LONG cbWidthInBytes; - LONG lPage; - LONG lCurIfdOffset; - LONG lPrevIfdOffset; - } MINIDRV_TRANSFER_CONTEXT; - -typedef struct _MINIDRV_TRANSFER_CONTEXT *PMINIDRV_TRANSFER_CONTEXT; - -typedef struct _WIA_DEV_CAP_DRV - { - GUID *guid; - ULONG ulFlags; - LPOLESTR wszName; - LPOLESTR wszDescription; - LPOLESTR wszIcon; - } WIA_DEV_CAP_DRV; - -typedef struct _WIA_DEV_CAP_DRV *PWIA_DEV_CAP_DRV; - - - -extern RPC_IF_HANDLE __MIDL_itf_wiamindr_lh_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wiamindr_lh_0000_0000_v0_0_s_ifspec; - -#ifndef __IWiaMiniDrv_INTERFACE_DEFINED__ -#define __IWiaMiniDrv_INTERFACE_DEFINED__ - -/* interface IWiaMiniDrv */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaMiniDrv; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("d8cdee14-3c6c-11d2-9a35-00c04fa36145") - IWiaMiniDrv : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvInitializeWia( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0000, - /* [in] */ LONG __MIDL__IWiaMiniDrv0001, - /* [in] */ __RPC__in BSTR __MIDL__IWiaMiniDrv0002, - /* [in] */ __RPC__in BSTR __MIDL__IWiaMiniDrv0003, - /* [in] */ __RPC__in_opt IUnknown *__MIDL__IWiaMiniDrv0004, - /* [in] */ __RPC__in_opt IUnknown *__MIDL__IWiaMiniDrv0005, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaMiniDrv0006, - /* [out] */ __RPC__deref_out_opt IUnknown **__MIDL__IWiaMiniDrv0007, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0008) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvAcquireItemData( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0009, - /* [in] */ LONG __MIDL__IWiaMiniDrv0010, - /* [out][in] */ __RPC__inout PMINIDRV_TRANSFER_CONTEXT __MIDL__IWiaMiniDrv0011, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0012) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvInitItemProperties( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0013, - /* [in] */ LONG __MIDL__IWiaMiniDrv0014, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0015) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvValidateItemProperties( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0016, - /* [in] */ LONG __MIDL__IWiaMiniDrv0017, - /* [in] */ ULONG __MIDL__IWiaMiniDrv0018, - /* [in] */ __RPC__in const PROPSPEC *__MIDL__IWiaMiniDrv0019, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0020) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvWriteItemProperties( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0021, - /* [in] */ LONG __MIDL__IWiaMiniDrv0022, - /* [in] */ __RPC__in PMINIDRV_TRANSFER_CONTEXT __MIDL__IWiaMiniDrv0023, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0024) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvReadItemProperties( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0025, - /* [in] */ LONG __MIDL__IWiaMiniDrv0026, - /* [in] */ ULONG __MIDL__IWiaMiniDrv0027, - /* [in] */ __RPC__in const PROPSPEC *__MIDL__IWiaMiniDrv0028, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0029) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvLockWiaDevice( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0030, - /* [in] */ LONG __MIDL__IWiaMiniDrv0031, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0032) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvUnLockWiaDevice( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0033, - /* [in] */ LONG __MIDL__IWiaMiniDrv0034, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0035) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvAnalyzeItem( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0036, - /* [in] */ LONG __MIDL__IWiaMiniDrv0037, - /* [in] */ __RPC__in LONG *__MIDL__IWiaMiniDrv0038) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvGetDeviceErrorStr( - /* [in] */ LONG __MIDL__IWiaMiniDrv0039, - /* [in] */ LONG __MIDL__IWiaMiniDrv0040, - /* [string][out] */ __RPC__deref_out_opt_string LPOLESTR *__MIDL__IWiaMiniDrv0041, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0042) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvDeviceCommand( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0043, - /* [in] */ LONG __MIDL__IWiaMiniDrv0044, - /* [in] */ __RPC__in const GUID *__MIDL__IWiaMiniDrv0045, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaMiniDrv0046, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0047) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvGetCapabilities( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0048, - /* [in] */ LONG __MIDL__IWiaMiniDrv0049, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0050, - /* [out] */ __RPC__deref_out_opt WIA_DEV_CAP_DRV **__MIDL__IWiaMiniDrv0051, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0052) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvDeleteItem( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0053, - /* [in] */ LONG __MIDL__IWiaMiniDrv0054, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0055) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvFreeDrvItemContext( - /* [in] */ LONG __MIDL__IWiaMiniDrv0056, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0057, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0058) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvGetWiaFormatInfo( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0059, - /* [in] */ LONG __MIDL__IWiaMiniDrv0060, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0061, - /* [out] */ __RPC__deref_out_opt WIA_FORMAT_INFO **__MIDL__IWiaMiniDrv0062, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0063) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvNotifyPnpEvent( - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ ULONG ulReserved) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvUnInitializeWia( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0064) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaMiniDrvVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaMiniDrv * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaMiniDrv * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvInitializeWia )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0000, - /* [in] */ LONG __MIDL__IWiaMiniDrv0001, - /* [in] */ __RPC__in BSTR __MIDL__IWiaMiniDrv0002, - /* [in] */ __RPC__in BSTR __MIDL__IWiaMiniDrv0003, - /* [in] */ __RPC__in_opt IUnknown *__MIDL__IWiaMiniDrv0004, - /* [in] */ __RPC__in_opt IUnknown *__MIDL__IWiaMiniDrv0005, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaMiniDrv0006, - /* [out] */ __RPC__deref_out_opt IUnknown **__MIDL__IWiaMiniDrv0007, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0008); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvAcquireItemData )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0009, - /* [in] */ LONG __MIDL__IWiaMiniDrv0010, - /* [out][in] */ __RPC__inout PMINIDRV_TRANSFER_CONTEXT __MIDL__IWiaMiniDrv0011, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0012); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvInitItemProperties )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0013, - /* [in] */ LONG __MIDL__IWiaMiniDrv0014, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0015); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvValidateItemProperties )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0016, - /* [in] */ LONG __MIDL__IWiaMiniDrv0017, - /* [in] */ ULONG __MIDL__IWiaMiniDrv0018, - /* [in] */ __RPC__in const PROPSPEC *__MIDL__IWiaMiniDrv0019, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0020); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvWriteItemProperties )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0021, - /* [in] */ LONG __MIDL__IWiaMiniDrv0022, - /* [in] */ __RPC__in PMINIDRV_TRANSFER_CONTEXT __MIDL__IWiaMiniDrv0023, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0024); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvReadItemProperties )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0025, - /* [in] */ LONG __MIDL__IWiaMiniDrv0026, - /* [in] */ ULONG __MIDL__IWiaMiniDrv0027, - /* [in] */ __RPC__in const PROPSPEC *__MIDL__IWiaMiniDrv0028, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0029); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvLockWiaDevice )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0030, - /* [in] */ LONG __MIDL__IWiaMiniDrv0031, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0032); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvUnLockWiaDevice )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0033, - /* [in] */ LONG __MIDL__IWiaMiniDrv0034, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0035); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvAnalyzeItem )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0036, - /* [in] */ LONG __MIDL__IWiaMiniDrv0037, - /* [in] */ __RPC__in LONG *__MIDL__IWiaMiniDrv0038); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvGetDeviceErrorStr )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ LONG __MIDL__IWiaMiniDrv0039, - /* [in] */ LONG __MIDL__IWiaMiniDrv0040, - /* [string][out] */ __RPC__deref_out_opt_string LPOLESTR *__MIDL__IWiaMiniDrv0041, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0042); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvDeviceCommand )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0043, - /* [in] */ LONG __MIDL__IWiaMiniDrv0044, - /* [in] */ __RPC__in const GUID *__MIDL__IWiaMiniDrv0045, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaMiniDrv0046, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0047); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvGetCapabilities )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0048, - /* [in] */ LONG __MIDL__IWiaMiniDrv0049, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0050, - /* [out] */ __RPC__deref_out_opt WIA_DEV_CAP_DRV **__MIDL__IWiaMiniDrv0051, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0052); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvDeleteItem )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0053, - /* [in] */ LONG __MIDL__IWiaMiniDrv0054, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0055); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvFreeDrvItemContext )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ LONG __MIDL__IWiaMiniDrv0056, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0057, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0058); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvGetWiaFormatInfo )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0059, - /* [in] */ LONG __MIDL__IWiaMiniDrv0060, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0061, - /* [out] */ __RPC__deref_out_opt WIA_FORMAT_INFO **__MIDL__IWiaMiniDrv0062, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0063); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvNotifyPnpEvent )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ ULONG ulReserved); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvUnInitializeWia )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0064); - - END_INTERFACE - } IWiaMiniDrvVtbl; - - interface IWiaMiniDrv - { - CONST_VTBL struct IWiaMiniDrvVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaMiniDrv_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaMiniDrv_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaMiniDrv_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaMiniDrv_drvInitializeWia(This,__MIDL__IWiaMiniDrv0000,__MIDL__IWiaMiniDrv0001,__MIDL__IWiaMiniDrv0002,__MIDL__IWiaMiniDrv0003,__MIDL__IWiaMiniDrv0004,__MIDL__IWiaMiniDrv0005,__MIDL__IWiaMiniDrv0006,__MIDL__IWiaMiniDrv0007,__MIDL__IWiaMiniDrv0008) \ - ( (This)->lpVtbl -> drvInitializeWia(This,__MIDL__IWiaMiniDrv0000,__MIDL__IWiaMiniDrv0001,__MIDL__IWiaMiniDrv0002,__MIDL__IWiaMiniDrv0003,__MIDL__IWiaMiniDrv0004,__MIDL__IWiaMiniDrv0005,__MIDL__IWiaMiniDrv0006,__MIDL__IWiaMiniDrv0007,__MIDL__IWiaMiniDrv0008) ) - -#define IWiaMiniDrv_drvAcquireItemData(This,__MIDL__IWiaMiniDrv0009,__MIDL__IWiaMiniDrv0010,__MIDL__IWiaMiniDrv0011,__MIDL__IWiaMiniDrv0012) \ - ( (This)->lpVtbl -> drvAcquireItemData(This,__MIDL__IWiaMiniDrv0009,__MIDL__IWiaMiniDrv0010,__MIDL__IWiaMiniDrv0011,__MIDL__IWiaMiniDrv0012) ) - -#define IWiaMiniDrv_drvInitItemProperties(This,__MIDL__IWiaMiniDrv0013,__MIDL__IWiaMiniDrv0014,__MIDL__IWiaMiniDrv0015) \ - ( (This)->lpVtbl -> drvInitItemProperties(This,__MIDL__IWiaMiniDrv0013,__MIDL__IWiaMiniDrv0014,__MIDL__IWiaMiniDrv0015) ) - -#define IWiaMiniDrv_drvValidateItemProperties(This,__MIDL__IWiaMiniDrv0016,__MIDL__IWiaMiniDrv0017,__MIDL__IWiaMiniDrv0018,__MIDL__IWiaMiniDrv0019,__MIDL__IWiaMiniDrv0020) \ - ( (This)->lpVtbl -> drvValidateItemProperties(This,__MIDL__IWiaMiniDrv0016,__MIDL__IWiaMiniDrv0017,__MIDL__IWiaMiniDrv0018,__MIDL__IWiaMiniDrv0019,__MIDL__IWiaMiniDrv0020) ) - -#define IWiaMiniDrv_drvWriteItemProperties(This,__MIDL__IWiaMiniDrv0021,__MIDL__IWiaMiniDrv0022,__MIDL__IWiaMiniDrv0023,__MIDL__IWiaMiniDrv0024) \ - ( (This)->lpVtbl -> drvWriteItemProperties(This,__MIDL__IWiaMiniDrv0021,__MIDL__IWiaMiniDrv0022,__MIDL__IWiaMiniDrv0023,__MIDL__IWiaMiniDrv0024) ) - -#define IWiaMiniDrv_drvReadItemProperties(This,__MIDL__IWiaMiniDrv0025,__MIDL__IWiaMiniDrv0026,__MIDL__IWiaMiniDrv0027,__MIDL__IWiaMiniDrv0028,__MIDL__IWiaMiniDrv0029) \ - ( (This)->lpVtbl -> drvReadItemProperties(This,__MIDL__IWiaMiniDrv0025,__MIDL__IWiaMiniDrv0026,__MIDL__IWiaMiniDrv0027,__MIDL__IWiaMiniDrv0028,__MIDL__IWiaMiniDrv0029) ) - -#define IWiaMiniDrv_drvLockWiaDevice(This,__MIDL__IWiaMiniDrv0030,__MIDL__IWiaMiniDrv0031,__MIDL__IWiaMiniDrv0032) \ - ( (This)->lpVtbl -> drvLockWiaDevice(This,__MIDL__IWiaMiniDrv0030,__MIDL__IWiaMiniDrv0031,__MIDL__IWiaMiniDrv0032) ) - -#define IWiaMiniDrv_drvUnLockWiaDevice(This,__MIDL__IWiaMiniDrv0033,__MIDL__IWiaMiniDrv0034,__MIDL__IWiaMiniDrv0035) \ - ( (This)->lpVtbl -> drvUnLockWiaDevice(This,__MIDL__IWiaMiniDrv0033,__MIDL__IWiaMiniDrv0034,__MIDL__IWiaMiniDrv0035) ) - -#define IWiaMiniDrv_drvAnalyzeItem(This,__MIDL__IWiaMiniDrv0036,__MIDL__IWiaMiniDrv0037,__MIDL__IWiaMiniDrv0038) \ - ( (This)->lpVtbl -> drvAnalyzeItem(This,__MIDL__IWiaMiniDrv0036,__MIDL__IWiaMiniDrv0037,__MIDL__IWiaMiniDrv0038) ) - -#define IWiaMiniDrv_drvGetDeviceErrorStr(This,__MIDL__IWiaMiniDrv0039,__MIDL__IWiaMiniDrv0040,__MIDL__IWiaMiniDrv0041,__MIDL__IWiaMiniDrv0042) \ - ( (This)->lpVtbl -> drvGetDeviceErrorStr(This,__MIDL__IWiaMiniDrv0039,__MIDL__IWiaMiniDrv0040,__MIDL__IWiaMiniDrv0041,__MIDL__IWiaMiniDrv0042) ) - -#define IWiaMiniDrv_drvDeviceCommand(This,__MIDL__IWiaMiniDrv0043,__MIDL__IWiaMiniDrv0044,__MIDL__IWiaMiniDrv0045,__MIDL__IWiaMiniDrv0046,__MIDL__IWiaMiniDrv0047) \ - ( (This)->lpVtbl -> drvDeviceCommand(This,__MIDL__IWiaMiniDrv0043,__MIDL__IWiaMiniDrv0044,__MIDL__IWiaMiniDrv0045,__MIDL__IWiaMiniDrv0046,__MIDL__IWiaMiniDrv0047) ) - -#define IWiaMiniDrv_drvGetCapabilities(This,__MIDL__IWiaMiniDrv0048,__MIDL__IWiaMiniDrv0049,__MIDL__IWiaMiniDrv0050,__MIDL__IWiaMiniDrv0051,__MIDL__IWiaMiniDrv0052) \ - ( (This)->lpVtbl -> drvGetCapabilities(This,__MIDL__IWiaMiniDrv0048,__MIDL__IWiaMiniDrv0049,__MIDL__IWiaMiniDrv0050,__MIDL__IWiaMiniDrv0051,__MIDL__IWiaMiniDrv0052) ) - -#define IWiaMiniDrv_drvDeleteItem(This,__MIDL__IWiaMiniDrv0053,__MIDL__IWiaMiniDrv0054,__MIDL__IWiaMiniDrv0055) \ - ( (This)->lpVtbl -> drvDeleteItem(This,__MIDL__IWiaMiniDrv0053,__MIDL__IWiaMiniDrv0054,__MIDL__IWiaMiniDrv0055) ) - -#define IWiaMiniDrv_drvFreeDrvItemContext(This,__MIDL__IWiaMiniDrv0056,__MIDL__IWiaMiniDrv0057,__MIDL__IWiaMiniDrv0058) \ - ( (This)->lpVtbl -> drvFreeDrvItemContext(This,__MIDL__IWiaMiniDrv0056,__MIDL__IWiaMiniDrv0057,__MIDL__IWiaMiniDrv0058) ) - -#define IWiaMiniDrv_drvGetWiaFormatInfo(This,__MIDL__IWiaMiniDrv0059,__MIDL__IWiaMiniDrv0060,__MIDL__IWiaMiniDrv0061,__MIDL__IWiaMiniDrv0062,__MIDL__IWiaMiniDrv0063) \ - ( (This)->lpVtbl -> drvGetWiaFormatInfo(This,__MIDL__IWiaMiniDrv0059,__MIDL__IWiaMiniDrv0060,__MIDL__IWiaMiniDrv0061,__MIDL__IWiaMiniDrv0062,__MIDL__IWiaMiniDrv0063) ) - -#define IWiaMiniDrv_drvNotifyPnpEvent(This,pEventGUID,bstrDeviceID,ulReserved) \ - ( (This)->lpVtbl -> drvNotifyPnpEvent(This,pEventGUID,bstrDeviceID,ulReserved) ) - -#define IWiaMiniDrv_drvUnInitializeWia(This,__MIDL__IWiaMiniDrv0064) \ - ( (This)->lpVtbl -> drvUnInitializeWia(This,__MIDL__IWiaMiniDrv0064) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaMiniDrv_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaMiniDrvCallBack_INTERFACE_DEFINED__ -#define __IWiaMiniDrvCallBack_INTERFACE_DEFINED__ - -/* interface IWiaMiniDrvCallBack */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaMiniDrvCallBack; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("33a57d5a-3de8-11d2-9a36-00c04fa36145") - IWiaMiniDrvCallBack : public IUnknown - { - public: - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE MiniDrvCallback( - /* [in] */ LONG lReason, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ __RPC__in PMINIDRV_TRANSFER_CONTEXT pTranCtx, - /* [in] */ LONG lReserved) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaMiniDrvCallBackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaMiniDrvCallBack * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaMiniDrvCallBack * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaMiniDrvCallBack * This); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *MiniDrvCallback )( - __RPC__in IWiaMiniDrvCallBack * This, - /* [in] */ LONG lReason, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ __RPC__in PMINIDRV_TRANSFER_CONTEXT pTranCtx, - /* [in] */ LONG lReserved); - - END_INTERFACE - } IWiaMiniDrvCallBackVtbl; - - interface IWiaMiniDrvCallBack - { - CONST_VTBL struct IWiaMiniDrvCallBackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaMiniDrvCallBack_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaMiniDrvCallBack_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaMiniDrvCallBack_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaMiniDrvCallBack_MiniDrvCallback(This,lReason,lStatus,lPercentComplete,lOffset,lLength,pTranCtx,lReserved) \ - ( (This)->lpVtbl -> MiniDrvCallback(This,lReason,lStatus,lPercentComplete,lOffset,lLength,pTranCtx,lReserved) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaMiniDrvCallBack_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaMiniDrvTransferCallback_INTERFACE_DEFINED__ -#define __IWiaMiniDrvTransferCallback_INTERFACE_DEFINED__ - -/* interface IWiaMiniDrvTransferCallback */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaMiniDrvTransferCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("a9d2ee89-2ce5-4ff0-8adb-c961d1d774ca") - IWiaMiniDrvTransferCallback : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetNextStream( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrItemName, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IStream **ppIStream) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SendMessage( - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in WiaTransferParams *pWiaTransferParams) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaMiniDrvTransferCallbackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaMiniDrvTransferCallback * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaMiniDrvTransferCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaMiniDrvTransferCallback * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetNextStream )( - __RPC__in IWiaMiniDrvTransferCallback * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in BSTR bstrItemName, - /* [in] */ __RPC__in BSTR bstrFullItemName, - /* [out] */ __RPC__deref_out_opt IStream **ppIStream); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SendMessage )( - __RPC__in IWiaMiniDrvTransferCallback * This, - /* [in] */ LONG lFlags, - /* [in] */ __RPC__in WiaTransferParams *pWiaTransferParams); - - END_INTERFACE - } IWiaMiniDrvTransferCallbackVtbl; - - interface IWiaMiniDrvTransferCallback - { - CONST_VTBL struct IWiaMiniDrvTransferCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaMiniDrvTransferCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaMiniDrvTransferCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaMiniDrvTransferCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaMiniDrvTransferCallback_GetNextStream(This,lFlags,bstrItemName,bstrFullItemName,ppIStream) \ - ( (This)->lpVtbl -> GetNextStream(This,lFlags,bstrItemName,bstrFullItemName,ppIStream) ) - -#define IWiaMiniDrvTransferCallback_SendMessage(This,lFlags,pWiaTransferParams) \ - ( (This)->lpVtbl -> SendMessage(This,lFlags,pWiaTransferParams) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaMiniDrvTransferCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaDrvItem_INTERFACE_DEFINED__ -#define __IWiaDrvItem_INTERFACE_DEFINED__ - -/* interface IWiaDrvItem */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaDrvItem; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1f02b5c5-b00c-11d2-a094-00c04f72dc3c") - IWiaDrvItem : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetItemFlags( - /* [out] */ __RPC__out LONG *__MIDL__IWiaDrvItem0000) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDeviceSpecContext( - /* [out] */ __RPC__deref_out_opt BYTE **__MIDL__IWiaDrvItem0001) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFullItemName( - /* [out] */ __RPC__deref_out_opt BSTR *__MIDL__IWiaDrvItem0002) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetItemName( - /* [out] */ __RPC__deref_out_opt BSTR *__MIDL__IWiaDrvItem0003) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddItemToFolder( - /* [in] */ __RPC__in_opt IWiaDrvItem *__MIDL__IWiaDrvItem0004) = 0; - - virtual HRESULT STDMETHODCALLTYPE UnlinkItemTree( - /* [in] */ LONG __MIDL__IWiaDrvItem0005) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemoveItemFromFolder( - /* [in] */ LONG __MIDL__IWiaDrvItem0006) = 0; - - virtual HRESULT STDMETHODCALLTYPE FindItemByName( - /* [in] */ LONG __MIDL__IWiaDrvItem0007, - /* [in] */ __RPC__in BSTR __MIDL__IWiaDrvItem0008, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0009) = 0; - - virtual HRESULT STDMETHODCALLTYPE FindChildItemByName( - /* [in] */ __RPC__in BSTR __MIDL__IWiaDrvItem0010, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0011) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetParentItem( - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0012) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFirstChildItem( - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0013) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNextSiblingItem( - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0014) = 0; - - virtual HRESULT STDMETHODCALLTYPE DumpItemData( - /* [out] */ __RPC__deref_out_opt BSTR *__MIDL__IWiaDrvItem0015) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaDrvItemVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaDrvItem * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaDrvItem * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaDrvItem * This); - - HRESULT ( STDMETHODCALLTYPE *GetItemFlags )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__out LONG *__MIDL__IWiaDrvItem0000); - - HRESULT ( STDMETHODCALLTYPE *GetDeviceSpecContext )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt BYTE **__MIDL__IWiaDrvItem0001); - - HRESULT ( STDMETHODCALLTYPE *GetFullItemName )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt BSTR *__MIDL__IWiaDrvItem0002); - - HRESULT ( STDMETHODCALLTYPE *GetItemName )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt BSTR *__MIDL__IWiaDrvItem0003); - - HRESULT ( STDMETHODCALLTYPE *AddItemToFolder )( - __RPC__in IWiaDrvItem * This, - /* [in] */ __RPC__in_opt IWiaDrvItem *__MIDL__IWiaDrvItem0004); - - HRESULT ( STDMETHODCALLTYPE *UnlinkItemTree )( - __RPC__in IWiaDrvItem * This, - /* [in] */ LONG __MIDL__IWiaDrvItem0005); - - HRESULT ( STDMETHODCALLTYPE *RemoveItemFromFolder )( - __RPC__in IWiaDrvItem * This, - /* [in] */ LONG __MIDL__IWiaDrvItem0006); - - HRESULT ( STDMETHODCALLTYPE *FindItemByName )( - __RPC__in IWiaDrvItem * This, - /* [in] */ LONG __MIDL__IWiaDrvItem0007, - /* [in] */ __RPC__in BSTR __MIDL__IWiaDrvItem0008, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0009); - - HRESULT ( STDMETHODCALLTYPE *FindChildItemByName )( - __RPC__in IWiaDrvItem * This, - /* [in] */ __RPC__in BSTR __MIDL__IWiaDrvItem0010, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0011); - - HRESULT ( STDMETHODCALLTYPE *GetParentItem )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0012); - - HRESULT ( STDMETHODCALLTYPE *GetFirstChildItem )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0013); - - HRESULT ( STDMETHODCALLTYPE *GetNextSiblingItem )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0014); - - HRESULT ( STDMETHODCALLTYPE *DumpItemData )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt BSTR *__MIDL__IWiaDrvItem0015); - - END_INTERFACE - } IWiaDrvItemVtbl; - - interface IWiaDrvItem - { - CONST_VTBL struct IWiaDrvItemVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaDrvItem_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaDrvItem_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaDrvItem_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaDrvItem_GetItemFlags(This,__MIDL__IWiaDrvItem0000) \ - ( (This)->lpVtbl -> GetItemFlags(This,__MIDL__IWiaDrvItem0000) ) - -#define IWiaDrvItem_GetDeviceSpecContext(This,__MIDL__IWiaDrvItem0001) \ - ( (This)->lpVtbl -> GetDeviceSpecContext(This,__MIDL__IWiaDrvItem0001) ) - -#define IWiaDrvItem_GetFullItemName(This,__MIDL__IWiaDrvItem0002) \ - ( (This)->lpVtbl -> GetFullItemName(This,__MIDL__IWiaDrvItem0002) ) - -#define IWiaDrvItem_GetItemName(This,__MIDL__IWiaDrvItem0003) \ - ( (This)->lpVtbl -> GetItemName(This,__MIDL__IWiaDrvItem0003) ) - -#define IWiaDrvItem_AddItemToFolder(This,__MIDL__IWiaDrvItem0004) \ - ( (This)->lpVtbl -> AddItemToFolder(This,__MIDL__IWiaDrvItem0004) ) - -#define IWiaDrvItem_UnlinkItemTree(This,__MIDL__IWiaDrvItem0005) \ - ( (This)->lpVtbl -> UnlinkItemTree(This,__MIDL__IWiaDrvItem0005) ) - -#define IWiaDrvItem_RemoveItemFromFolder(This,__MIDL__IWiaDrvItem0006) \ - ( (This)->lpVtbl -> RemoveItemFromFolder(This,__MIDL__IWiaDrvItem0006) ) - -#define IWiaDrvItem_FindItemByName(This,__MIDL__IWiaDrvItem0007,__MIDL__IWiaDrvItem0008,__MIDL__IWiaDrvItem0009) \ - ( (This)->lpVtbl -> FindItemByName(This,__MIDL__IWiaDrvItem0007,__MIDL__IWiaDrvItem0008,__MIDL__IWiaDrvItem0009) ) - -#define IWiaDrvItem_FindChildItemByName(This,__MIDL__IWiaDrvItem0010,__MIDL__IWiaDrvItem0011) \ - ( (This)->lpVtbl -> FindChildItemByName(This,__MIDL__IWiaDrvItem0010,__MIDL__IWiaDrvItem0011) ) - -#define IWiaDrvItem_GetParentItem(This,__MIDL__IWiaDrvItem0012) \ - ( (This)->lpVtbl -> GetParentItem(This,__MIDL__IWiaDrvItem0012) ) - -#define IWiaDrvItem_GetFirstChildItem(This,__MIDL__IWiaDrvItem0013) \ - ( (This)->lpVtbl -> GetFirstChildItem(This,__MIDL__IWiaDrvItem0013) ) - -#define IWiaDrvItem_GetNextSiblingItem(This,__MIDL__IWiaDrvItem0014) \ - ( (This)->lpVtbl -> GetNextSiblingItem(This,__MIDL__IWiaDrvItem0014) ) - -#define IWiaDrvItem_DumpItemData(This,__MIDL__IWiaDrvItem0015) \ - ( (This)->lpVtbl -> DumpItemData(This,__MIDL__IWiaDrvItem0015) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaDrvItem_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_wiamindr_lh_0000_0004 */ -/* [local] */ - -typedef struct _WIA_PROPERTY_INFO - { - ULONG lAccessFlags; - VARTYPE vt; - union - { - struct - { - LONG Min; - LONG Nom; - LONG Max; - LONG Inc; - } Range; - struct - { - DOUBLE Min; - DOUBLE Nom; - DOUBLE Max; - DOUBLE Inc; - } RangeFloat; - struct - { - LONG cNumList; - LONG Nom; - BYTE *pList; - } List; - struct - { - LONG cNumList; - DOUBLE Nom; - BYTE *pList; - } ListFloat; - struct - { - LONG cNumList; - GUID Nom; - GUID *pList; - } ListGuid; - struct - { - LONG cNumList; - BSTR Nom; - BSTR *pList; - } ListBStr; - struct - { - LONG Nom; - LONG ValidBits; - } Flag; - struct - { - LONG Dummy; - } None; - } ValidVal; - } WIA_PROPERTY_INFO; - -typedef struct _WIA_PROPERTY_INFO *PWIA_PROPERTY_INFO; - -typedef struct _WIA_PROPERTY_CONTEXT - { - ULONG cProps; - PROPID *pProps; - BOOL *pChanged; - } WIA_PROPERTY_CONTEXT; - -typedef struct _WIA_PROPERTY_CONTEXT *PWIA_PROPERTY_CONTEXT; - -typedef struct _WIAS_CHANGED_VALUE_INFO - { - BOOL bChanged; - LONG vt; - union - { - LONG lVal; - FLOAT fltVal; - BSTR bstrVal; - GUID guidVal; - } Old; - union - { - LONG lVal; - FLOAT fltVal; - BSTR bstrVal; - GUID guidVal; - } Current; - } WIAS_CHANGED_VALUE_INFO; - -typedef struct _WIAS_CHANGED_VALUE_INFO *PWIAS_CHANGED_VALUE_INFO; - -typedef struct _WIAS_DOWN_SAMPLE_INFO - { - ULONG ulOriginalWidth; - ULONG ulOriginalHeight; - ULONG ulBitsPerPixel; - ULONG ulXRes; - ULONG ulYRes; - ULONG ulDownSampledWidth; - ULONG ulDownSampledHeight; - ULONG ulActualSize; - ULONG ulDestBufSize; - ULONG ulSrcBufSize; - BYTE *pSrcBuffer; - BYTE *pDestBuffer; - } WIAS_DOWN_SAMPLE_INFO; - -typedef struct _WIAS_DOWN_SAMPLE_INFO *PWIAS_DOWN_SAMPLE_INFO; - -typedef struct _WIAS_ENDORSER_VALUE - { - LPWSTR wszTokenName; - LPWSTR wszValue; - } WIAS_ENDORSER_VALUE; - -typedef struct _WIAS_ENDORSER_VALUE *PWIAS_ENDORSER_VALUE; - -typedef struct _WIAS_ENDORSER_INFO - { - ULONG ulPageCount; - ULONG ulNumEndorserValues; - WIAS_ENDORSER_VALUE *pEndorserValues; - } WIAS_ENDORSER_INFO; - -typedef struct _WIAS_ENDORSER_INFO *PWIAS_ENDORSER_INFO; - -#include "wiamdef.h" - - -extern RPC_IF_HANDLE __MIDL_itf_wiamindr_lh_0000_0004_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wiamindr_lh_0000_0004_v0_0_s_ifspec; - -/* Additional Prototypes for ALL interfaces */ - -unsigned long __RPC_USER BSTR_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); -void __RPC_USER BSTR_UserFree( __RPC__in unsigned long *, __RPC__in BSTR * ); - -unsigned long __RPC_USER BSTR_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); -void __RPC_USER BSTR_UserFree64( __RPC__in unsigned long *, __RPC__in BSTR * ); - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/wiamindr_xp.h b/pub/ddk/wiamindr_xp.h deleted file mode 100644 index f84b33c..0000000 --- a/pub/ddk/wiamindr_xp.h +++ /dev/null @@ -1,928 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for wiamindr_xp.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __wiamindr_xp_h__ -#define __wiamindr_xp_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IWiaMiniDrv_FWD_DEFINED__ -#define __IWiaMiniDrv_FWD_DEFINED__ -typedef interface IWiaMiniDrv IWiaMiniDrv; -#endif /* __IWiaMiniDrv_FWD_DEFINED__ */ - - -#ifndef __IWiaMiniDrvCallBack_FWD_DEFINED__ -#define __IWiaMiniDrvCallBack_FWD_DEFINED__ -typedef interface IWiaMiniDrvCallBack IWiaMiniDrvCallBack; -#endif /* __IWiaMiniDrvCallBack_FWD_DEFINED__ */ - - -#ifndef __IWiaDrvItem_FWD_DEFINED__ -#define __IWiaDrvItem_FWD_DEFINED__ -typedef interface IWiaDrvItem IWiaDrvItem; -#endif /* __IWiaDrvItem_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "unknwn.h" -#include "oaidl.h" -#include "propidl.h" -#include "wia_xp.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_wiamindr_xp_0000_0000 */ -/* [local] */ - - - - - - -typedef struct _MINIDRV_TRANSFER_CONTEXT - { - LONG lSize; - LONG lWidthInPixels; - LONG lLines; - LONG lDepth; - LONG lXRes; - LONG lYRes; - LONG lCompression; - GUID guidFormatID; - LONG tymed; - LONG_PTR hFile; - LONG cbOffset; - LONG lBufferSize; - LONG lActiveBuffer; - LONG lNumBuffers; - BYTE *pBaseBuffer; - BYTE *pTransferBuffer; - BOOL bTransferDataCB; - BOOL bClassDrvAllocBuf; - LONG_PTR lClientAddress; - IWiaMiniDrvCallBack *pIWiaMiniDrvCallBack; - LONG lImageSize; - LONG lHeaderSize; - LONG lItemSize; - LONG cbWidthInBytes; - LONG lPage; - LONG lCurIfdOffset; - LONG lPrevIfdOffset; - } MINIDRV_TRANSFER_CONTEXT; - -typedef struct _MINIDRV_TRANSFER_CONTEXT *PMINIDRV_TRANSFER_CONTEXT; - -typedef struct _WIA_DEV_CAP_DRV - { - GUID *guid; - ULONG ulFlags; - LPOLESTR wszName; - LPOLESTR wszDescription; - LPOLESTR wszIcon; - } WIA_DEV_CAP_DRV; - -typedef struct _WIA_DEV_CAP_DRV *PWIA_DEV_CAP_DRV; - - - -extern RPC_IF_HANDLE __MIDL_itf_wiamindr_xp_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wiamindr_xp_0000_0000_v0_0_s_ifspec; - -#ifndef __IWiaMiniDrv_INTERFACE_DEFINED__ -#define __IWiaMiniDrv_INTERFACE_DEFINED__ - -/* interface IWiaMiniDrv */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaMiniDrv; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("d8cdee14-3c6c-11d2-9a35-00c04fa36145") - IWiaMiniDrv : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvInitializeWia( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0000, - /* [in] */ LONG __MIDL__IWiaMiniDrv0001, - /* [in] */ __RPC__in BSTR __MIDL__IWiaMiniDrv0002, - /* [in] */ __RPC__in BSTR __MIDL__IWiaMiniDrv0003, - /* [in] */ __RPC__in_opt IUnknown *__MIDL__IWiaMiniDrv0004, - /* [in] */ __RPC__in_opt IUnknown *__MIDL__IWiaMiniDrv0005, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaMiniDrv0006, - /* [out] */ __RPC__deref_out_opt IUnknown **__MIDL__IWiaMiniDrv0007, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0008) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvAcquireItemData( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0009, - /* [in] */ LONG __MIDL__IWiaMiniDrv0010, - /* [out][in] */ __RPC__inout PMINIDRV_TRANSFER_CONTEXT __MIDL__IWiaMiniDrv0011, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0012) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvInitItemProperties( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0013, - /* [in] */ LONG __MIDL__IWiaMiniDrv0014, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0015) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvValidateItemProperties( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0016, - /* [in] */ LONG __MIDL__IWiaMiniDrv0017, - /* [in] */ ULONG __MIDL__IWiaMiniDrv0018, - /* [in] */ __RPC__in const PROPSPEC *__MIDL__IWiaMiniDrv0019, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0020) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvWriteItemProperties( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0021, - /* [in] */ LONG __MIDL__IWiaMiniDrv0022, - /* [in] */ __RPC__in PMINIDRV_TRANSFER_CONTEXT __MIDL__IWiaMiniDrv0023, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0024) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvReadItemProperties( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0025, - /* [in] */ LONG __MIDL__IWiaMiniDrv0026, - /* [in] */ ULONG __MIDL__IWiaMiniDrv0027, - /* [in] */ __RPC__in const PROPSPEC *__MIDL__IWiaMiniDrv0028, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0029) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvLockWiaDevice( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0030, - /* [in] */ LONG __MIDL__IWiaMiniDrv0031, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0032) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvUnLockWiaDevice( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0033, - /* [in] */ LONG __MIDL__IWiaMiniDrv0034, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0035) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvAnalyzeItem( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0036, - /* [in] */ LONG __MIDL__IWiaMiniDrv0037, - /* [in] */ __RPC__in LONG *__MIDL__IWiaMiniDrv0038) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvGetDeviceErrorStr( - /* [in] */ LONG __MIDL__IWiaMiniDrv0039, - /* [in] */ LONG __MIDL__IWiaMiniDrv0040, - /* [out] */ __RPC__deref_out_opt LPOLESTR *__MIDL__IWiaMiniDrv0041, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0042) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvDeviceCommand( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0043, - /* [in] */ LONG __MIDL__IWiaMiniDrv0044, - /* [in] */ __RPC__in const GUID *__MIDL__IWiaMiniDrv0045, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaMiniDrv0046, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0047) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvGetCapabilities( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0048, - /* [in] */ LONG __MIDL__IWiaMiniDrv0049, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0050, - /* [out] */ __RPC__deref_out_opt WIA_DEV_CAP_DRV **__MIDL__IWiaMiniDrv0051, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0052) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvDeleteItem( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0053, - /* [in] */ LONG __MIDL__IWiaMiniDrv0054, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0055) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvFreeDrvItemContext( - /* [in] */ LONG __MIDL__IWiaMiniDrv0056, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0057, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0058) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvGetWiaFormatInfo( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0059, - /* [in] */ LONG __MIDL__IWiaMiniDrv0060, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0061, - /* [out] */ __RPC__deref_out_opt WIA_FORMAT_INFO **__MIDL__IWiaMiniDrv0062, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0063) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvNotifyPnpEvent( - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ ULONG ulReserved) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE drvUnInitializeWia( - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0064) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaMiniDrvVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaMiniDrv * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaMiniDrv * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvInitializeWia )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0000, - /* [in] */ LONG __MIDL__IWiaMiniDrv0001, - /* [in] */ __RPC__in BSTR __MIDL__IWiaMiniDrv0002, - /* [in] */ __RPC__in BSTR __MIDL__IWiaMiniDrv0003, - /* [in] */ __RPC__in_opt IUnknown *__MIDL__IWiaMiniDrv0004, - /* [in] */ __RPC__in_opt IUnknown *__MIDL__IWiaMiniDrv0005, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaMiniDrv0006, - /* [out] */ __RPC__deref_out_opt IUnknown **__MIDL__IWiaMiniDrv0007, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0008); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvAcquireItemData )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0009, - /* [in] */ LONG __MIDL__IWiaMiniDrv0010, - /* [out][in] */ __RPC__inout PMINIDRV_TRANSFER_CONTEXT __MIDL__IWiaMiniDrv0011, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0012); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvInitItemProperties )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0013, - /* [in] */ LONG __MIDL__IWiaMiniDrv0014, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0015); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvValidateItemProperties )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0016, - /* [in] */ LONG __MIDL__IWiaMiniDrv0017, - /* [in] */ ULONG __MIDL__IWiaMiniDrv0018, - /* [in] */ __RPC__in const PROPSPEC *__MIDL__IWiaMiniDrv0019, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0020); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvWriteItemProperties )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0021, - /* [in] */ LONG __MIDL__IWiaMiniDrv0022, - /* [in] */ __RPC__in PMINIDRV_TRANSFER_CONTEXT __MIDL__IWiaMiniDrv0023, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0024); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvReadItemProperties )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0025, - /* [in] */ LONG __MIDL__IWiaMiniDrv0026, - /* [in] */ ULONG __MIDL__IWiaMiniDrv0027, - /* [in] */ __RPC__in const PROPSPEC *__MIDL__IWiaMiniDrv0028, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0029); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvLockWiaDevice )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0030, - /* [in] */ LONG __MIDL__IWiaMiniDrv0031, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0032); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvUnLockWiaDevice )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0033, - /* [in] */ LONG __MIDL__IWiaMiniDrv0034, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0035); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvAnalyzeItem )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0036, - /* [in] */ LONG __MIDL__IWiaMiniDrv0037, - /* [in] */ __RPC__in LONG *__MIDL__IWiaMiniDrv0038); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvGetDeviceErrorStr )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ LONG __MIDL__IWiaMiniDrv0039, - /* [in] */ LONG __MIDL__IWiaMiniDrv0040, - /* [out] */ __RPC__deref_out_opt LPOLESTR *__MIDL__IWiaMiniDrv0041, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0042); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvDeviceCommand )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0043, - /* [in] */ LONG __MIDL__IWiaMiniDrv0044, - /* [in] */ __RPC__in const GUID *__MIDL__IWiaMiniDrv0045, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaMiniDrv0046, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0047); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvGetCapabilities )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0048, - /* [in] */ LONG __MIDL__IWiaMiniDrv0049, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0050, - /* [out] */ __RPC__deref_out_opt WIA_DEV_CAP_DRV **__MIDL__IWiaMiniDrv0051, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0052); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvDeleteItem )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0053, - /* [in] */ LONG __MIDL__IWiaMiniDrv0054, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0055); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvFreeDrvItemContext )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ LONG __MIDL__IWiaMiniDrv0056, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0057, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0058); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvGetWiaFormatInfo )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0059, - /* [in] */ LONG __MIDL__IWiaMiniDrv0060, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0061, - /* [out] */ __RPC__deref_out_opt WIA_FORMAT_INFO **__MIDL__IWiaMiniDrv0062, - /* [out] */ __RPC__out LONG *__MIDL__IWiaMiniDrv0063); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvNotifyPnpEvent )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in const GUID *pEventGUID, - /* [in] */ __RPC__in BSTR bstrDeviceID, - /* [in] */ ULONG ulReserved); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *drvUnInitializeWia )( - __RPC__in IWiaMiniDrv * This, - /* [in] */ __RPC__in BYTE *__MIDL__IWiaMiniDrv0064); - - END_INTERFACE - } IWiaMiniDrvVtbl; - - interface IWiaMiniDrv - { - CONST_VTBL struct IWiaMiniDrvVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaMiniDrv_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaMiniDrv_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaMiniDrv_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaMiniDrv_drvInitializeWia(This,__MIDL__IWiaMiniDrv0000,__MIDL__IWiaMiniDrv0001,__MIDL__IWiaMiniDrv0002,__MIDL__IWiaMiniDrv0003,__MIDL__IWiaMiniDrv0004,__MIDL__IWiaMiniDrv0005,__MIDL__IWiaMiniDrv0006,__MIDL__IWiaMiniDrv0007,__MIDL__IWiaMiniDrv0008) \ - ( (This)->lpVtbl -> drvInitializeWia(This,__MIDL__IWiaMiniDrv0000,__MIDL__IWiaMiniDrv0001,__MIDL__IWiaMiniDrv0002,__MIDL__IWiaMiniDrv0003,__MIDL__IWiaMiniDrv0004,__MIDL__IWiaMiniDrv0005,__MIDL__IWiaMiniDrv0006,__MIDL__IWiaMiniDrv0007,__MIDL__IWiaMiniDrv0008) ) - -#define IWiaMiniDrv_drvAcquireItemData(This,__MIDL__IWiaMiniDrv0009,__MIDL__IWiaMiniDrv0010,__MIDL__IWiaMiniDrv0011,__MIDL__IWiaMiniDrv0012) \ - ( (This)->lpVtbl -> drvAcquireItemData(This,__MIDL__IWiaMiniDrv0009,__MIDL__IWiaMiniDrv0010,__MIDL__IWiaMiniDrv0011,__MIDL__IWiaMiniDrv0012) ) - -#define IWiaMiniDrv_drvInitItemProperties(This,__MIDL__IWiaMiniDrv0013,__MIDL__IWiaMiniDrv0014,__MIDL__IWiaMiniDrv0015) \ - ( (This)->lpVtbl -> drvInitItemProperties(This,__MIDL__IWiaMiniDrv0013,__MIDL__IWiaMiniDrv0014,__MIDL__IWiaMiniDrv0015) ) - -#define IWiaMiniDrv_drvValidateItemProperties(This,__MIDL__IWiaMiniDrv0016,__MIDL__IWiaMiniDrv0017,__MIDL__IWiaMiniDrv0018,__MIDL__IWiaMiniDrv0019,__MIDL__IWiaMiniDrv0020) \ - ( (This)->lpVtbl -> drvValidateItemProperties(This,__MIDL__IWiaMiniDrv0016,__MIDL__IWiaMiniDrv0017,__MIDL__IWiaMiniDrv0018,__MIDL__IWiaMiniDrv0019,__MIDL__IWiaMiniDrv0020) ) - -#define IWiaMiniDrv_drvWriteItemProperties(This,__MIDL__IWiaMiniDrv0021,__MIDL__IWiaMiniDrv0022,__MIDL__IWiaMiniDrv0023,__MIDL__IWiaMiniDrv0024) \ - ( (This)->lpVtbl -> drvWriteItemProperties(This,__MIDL__IWiaMiniDrv0021,__MIDL__IWiaMiniDrv0022,__MIDL__IWiaMiniDrv0023,__MIDL__IWiaMiniDrv0024) ) - -#define IWiaMiniDrv_drvReadItemProperties(This,__MIDL__IWiaMiniDrv0025,__MIDL__IWiaMiniDrv0026,__MIDL__IWiaMiniDrv0027,__MIDL__IWiaMiniDrv0028,__MIDL__IWiaMiniDrv0029) \ - ( (This)->lpVtbl -> drvReadItemProperties(This,__MIDL__IWiaMiniDrv0025,__MIDL__IWiaMiniDrv0026,__MIDL__IWiaMiniDrv0027,__MIDL__IWiaMiniDrv0028,__MIDL__IWiaMiniDrv0029) ) - -#define IWiaMiniDrv_drvLockWiaDevice(This,__MIDL__IWiaMiniDrv0030,__MIDL__IWiaMiniDrv0031,__MIDL__IWiaMiniDrv0032) \ - ( (This)->lpVtbl -> drvLockWiaDevice(This,__MIDL__IWiaMiniDrv0030,__MIDL__IWiaMiniDrv0031,__MIDL__IWiaMiniDrv0032) ) - -#define IWiaMiniDrv_drvUnLockWiaDevice(This,__MIDL__IWiaMiniDrv0033,__MIDL__IWiaMiniDrv0034,__MIDL__IWiaMiniDrv0035) \ - ( (This)->lpVtbl -> drvUnLockWiaDevice(This,__MIDL__IWiaMiniDrv0033,__MIDL__IWiaMiniDrv0034,__MIDL__IWiaMiniDrv0035) ) - -#define IWiaMiniDrv_drvAnalyzeItem(This,__MIDL__IWiaMiniDrv0036,__MIDL__IWiaMiniDrv0037,__MIDL__IWiaMiniDrv0038) \ - ( (This)->lpVtbl -> drvAnalyzeItem(This,__MIDL__IWiaMiniDrv0036,__MIDL__IWiaMiniDrv0037,__MIDL__IWiaMiniDrv0038) ) - -#define IWiaMiniDrv_drvGetDeviceErrorStr(This,__MIDL__IWiaMiniDrv0039,__MIDL__IWiaMiniDrv0040,__MIDL__IWiaMiniDrv0041,__MIDL__IWiaMiniDrv0042) \ - ( (This)->lpVtbl -> drvGetDeviceErrorStr(This,__MIDL__IWiaMiniDrv0039,__MIDL__IWiaMiniDrv0040,__MIDL__IWiaMiniDrv0041,__MIDL__IWiaMiniDrv0042) ) - -#define IWiaMiniDrv_drvDeviceCommand(This,__MIDL__IWiaMiniDrv0043,__MIDL__IWiaMiniDrv0044,__MIDL__IWiaMiniDrv0045,__MIDL__IWiaMiniDrv0046,__MIDL__IWiaMiniDrv0047) \ - ( (This)->lpVtbl -> drvDeviceCommand(This,__MIDL__IWiaMiniDrv0043,__MIDL__IWiaMiniDrv0044,__MIDL__IWiaMiniDrv0045,__MIDL__IWiaMiniDrv0046,__MIDL__IWiaMiniDrv0047) ) - -#define IWiaMiniDrv_drvGetCapabilities(This,__MIDL__IWiaMiniDrv0048,__MIDL__IWiaMiniDrv0049,__MIDL__IWiaMiniDrv0050,__MIDL__IWiaMiniDrv0051,__MIDL__IWiaMiniDrv0052) \ - ( (This)->lpVtbl -> drvGetCapabilities(This,__MIDL__IWiaMiniDrv0048,__MIDL__IWiaMiniDrv0049,__MIDL__IWiaMiniDrv0050,__MIDL__IWiaMiniDrv0051,__MIDL__IWiaMiniDrv0052) ) - -#define IWiaMiniDrv_drvDeleteItem(This,__MIDL__IWiaMiniDrv0053,__MIDL__IWiaMiniDrv0054,__MIDL__IWiaMiniDrv0055) \ - ( (This)->lpVtbl -> drvDeleteItem(This,__MIDL__IWiaMiniDrv0053,__MIDL__IWiaMiniDrv0054,__MIDL__IWiaMiniDrv0055) ) - -#define IWiaMiniDrv_drvFreeDrvItemContext(This,__MIDL__IWiaMiniDrv0056,__MIDL__IWiaMiniDrv0057,__MIDL__IWiaMiniDrv0058) \ - ( (This)->lpVtbl -> drvFreeDrvItemContext(This,__MIDL__IWiaMiniDrv0056,__MIDL__IWiaMiniDrv0057,__MIDL__IWiaMiniDrv0058) ) - -#define IWiaMiniDrv_drvGetWiaFormatInfo(This,__MIDL__IWiaMiniDrv0059,__MIDL__IWiaMiniDrv0060,__MIDL__IWiaMiniDrv0061,__MIDL__IWiaMiniDrv0062,__MIDL__IWiaMiniDrv0063) \ - ( (This)->lpVtbl -> drvGetWiaFormatInfo(This,__MIDL__IWiaMiniDrv0059,__MIDL__IWiaMiniDrv0060,__MIDL__IWiaMiniDrv0061,__MIDL__IWiaMiniDrv0062,__MIDL__IWiaMiniDrv0063) ) - -#define IWiaMiniDrv_drvNotifyPnpEvent(This,pEventGUID,bstrDeviceID,ulReserved) \ - ( (This)->lpVtbl -> drvNotifyPnpEvent(This,pEventGUID,bstrDeviceID,ulReserved) ) - -#define IWiaMiniDrv_drvUnInitializeWia(This,__MIDL__IWiaMiniDrv0064) \ - ( (This)->lpVtbl -> drvUnInitializeWia(This,__MIDL__IWiaMiniDrv0064) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaMiniDrv_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaMiniDrvCallBack_INTERFACE_DEFINED__ -#define __IWiaMiniDrvCallBack_INTERFACE_DEFINED__ - -/* interface IWiaMiniDrvCallBack */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaMiniDrvCallBack; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("33a57d5a-3de8-11d2-9a36-00c04fa36145") - IWiaMiniDrvCallBack : public IUnknown - { - public: - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE MiniDrvCallback( - /* [in] */ LONG lReason, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ __RPC__in PMINIDRV_TRANSFER_CONTEXT pTranCtx, - /* [in] */ LONG lReserved) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaMiniDrvCallBackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaMiniDrvCallBack * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaMiniDrvCallBack * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaMiniDrvCallBack * This); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *MiniDrvCallback )( - __RPC__in IWiaMiniDrvCallBack * This, - /* [in] */ LONG lReason, - /* [in] */ LONG lStatus, - /* [in] */ LONG lPercentComplete, - /* [in] */ LONG lOffset, - /* [in] */ LONG lLength, - /* [in] */ __RPC__in PMINIDRV_TRANSFER_CONTEXT pTranCtx, - /* [in] */ LONG lReserved); - - END_INTERFACE - } IWiaMiniDrvCallBackVtbl; - - interface IWiaMiniDrvCallBack - { - CONST_VTBL struct IWiaMiniDrvCallBackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaMiniDrvCallBack_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaMiniDrvCallBack_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaMiniDrvCallBack_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaMiniDrvCallBack_MiniDrvCallback(This,lReason,lStatus,lPercentComplete,lOffset,lLength,pTranCtx,lReserved) \ - ( (This)->lpVtbl -> MiniDrvCallback(This,lReason,lStatus,lPercentComplete,lOffset,lLength,pTranCtx,lReserved) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaMiniDrvCallBack_INTERFACE_DEFINED__ */ - - -#ifndef __IWiaDrvItem_INTERFACE_DEFINED__ -#define __IWiaDrvItem_INTERFACE_DEFINED__ - -/* interface IWiaDrvItem */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IWiaDrvItem; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1f02b5c5-b00c-11d2-a094-00c04f72dc3c") - IWiaDrvItem : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetItemFlags( - /* [out] */ __RPC__out LONG *__MIDL__IWiaDrvItem0000) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDeviceSpecContext( - /* [out] */ __RPC__deref_out_opt BYTE **__MIDL__IWiaDrvItem0001) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFullItemName( - /* [out] */ __RPC__deref_out_opt BSTR *__MIDL__IWiaDrvItem0002) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetItemName( - /* [out] */ __RPC__deref_out_opt BSTR *__MIDL__IWiaDrvItem0003) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddItemToFolder( - /* [in] */ __RPC__in_opt IWiaDrvItem *__MIDL__IWiaDrvItem0004) = 0; - - virtual HRESULT STDMETHODCALLTYPE UnlinkItemTree( - /* [in] */ LONG __MIDL__IWiaDrvItem0005) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemoveItemFromFolder( - /* [in] */ LONG __MIDL__IWiaDrvItem0006) = 0; - - virtual HRESULT STDMETHODCALLTYPE FindItemByName( - /* [in] */ LONG __MIDL__IWiaDrvItem0007, - /* [in] */ __RPC__in BSTR __MIDL__IWiaDrvItem0008, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0009) = 0; - - virtual HRESULT STDMETHODCALLTYPE FindChildItemByName( - /* [in] */ __RPC__in BSTR __MIDL__IWiaDrvItem0010, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0011) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetParentItem( - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0012) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFirstChildItem( - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0013) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNextSiblingItem( - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0014) = 0; - - virtual HRESULT STDMETHODCALLTYPE DumpItemData( - /* [out] */ __RPC__deref_out_opt BSTR *__MIDL__IWiaDrvItem0015) = 0; - - }; - -#else /* C style interface */ - - typedef struct IWiaDrvItemVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IWiaDrvItem * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IWiaDrvItem * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IWiaDrvItem * This); - - HRESULT ( STDMETHODCALLTYPE *GetItemFlags )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__out LONG *__MIDL__IWiaDrvItem0000); - - HRESULT ( STDMETHODCALLTYPE *GetDeviceSpecContext )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt BYTE **__MIDL__IWiaDrvItem0001); - - HRESULT ( STDMETHODCALLTYPE *GetFullItemName )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt BSTR *__MIDL__IWiaDrvItem0002); - - HRESULT ( STDMETHODCALLTYPE *GetItemName )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt BSTR *__MIDL__IWiaDrvItem0003); - - HRESULT ( STDMETHODCALLTYPE *AddItemToFolder )( - __RPC__in IWiaDrvItem * This, - /* [in] */ __RPC__in_opt IWiaDrvItem *__MIDL__IWiaDrvItem0004); - - HRESULT ( STDMETHODCALLTYPE *UnlinkItemTree )( - __RPC__in IWiaDrvItem * This, - /* [in] */ LONG __MIDL__IWiaDrvItem0005); - - HRESULT ( STDMETHODCALLTYPE *RemoveItemFromFolder )( - __RPC__in IWiaDrvItem * This, - /* [in] */ LONG __MIDL__IWiaDrvItem0006); - - HRESULT ( STDMETHODCALLTYPE *FindItemByName )( - __RPC__in IWiaDrvItem * This, - /* [in] */ LONG __MIDL__IWiaDrvItem0007, - /* [in] */ __RPC__in BSTR __MIDL__IWiaDrvItem0008, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0009); - - HRESULT ( STDMETHODCALLTYPE *FindChildItemByName )( - __RPC__in IWiaDrvItem * This, - /* [in] */ __RPC__in BSTR __MIDL__IWiaDrvItem0010, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0011); - - HRESULT ( STDMETHODCALLTYPE *GetParentItem )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0012); - - HRESULT ( STDMETHODCALLTYPE *GetFirstChildItem )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0013); - - HRESULT ( STDMETHODCALLTYPE *GetNextSiblingItem )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt IWiaDrvItem **__MIDL__IWiaDrvItem0014); - - HRESULT ( STDMETHODCALLTYPE *DumpItemData )( - __RPC__in IWiaDrvItem * This, - /* [out] */ __RPC__deref_out_opt BSTR *__MIDL__IWiaDrvItem0015); - - END_INTERFACE - } IWiaDrvItemVtbl; - - interface IWiaDrvItem - { - CONST_VTBL struct IWiaDrvItemVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IWiaDrvItem_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IWiaDrvItem_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IWiaDrvItem_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IWiaDrvItem_GetItemFlags(This,__MIDL__IWiaDrvItem0000) \ - ( (This)->lpVtbl -> GetItemFlags(This,__MIDL__IWiaDrvItem0000) ) - -#define IWiaDrvItem_GetDeviceSpecContext(This,__MIDL__IWiaDrvItem0001) \ - ( (This)->lpVtbl -> GetDeviceSpecContext(This,__MIDL__IWiaDrvItem0001) ) - -#define IWiaDrvItem_GetFullItemName(This,__MIDL__IWiaDrvItem0002) \ - ( (This)->lpVtbl -> GetFullItemName(This,__MIDL__IWiaDrvItem0002) ) - -#define IWiaDrvItem_GetItemName(This,__MIDL__IWiaDrvItem0003) \ - ( (This)->lpVtbl -> GetItemName(This,__MIDL__IWiaDrvItem0003) ) - -#define IWiaDrvItem_AddItemToFolder(This,__MIDL__IWiaDrvItem0004) \ - ( (This)->lpVtbl -> AddItemToFolder(This,__MIDL__IWiaDrvItem0004) ) - -#define IWiaDrvItem_UnlinkItemTree(This,__MIDL__IWiaDrvItem0005) \ - ( (This)->lpVtbl -> UnlinkItemTree(This,__MIDL__IWiaDrvItem0005) ) - -#define IWiaDrvItem_RemoveItemFromFolder(This,__MIDL__IWiaDrvItem0006) \ - ( (This)->lpVtbl -> RemoveItemFromFolder(This,__MIDL__IWiaDrvItem0006) ) - -#define IWiaDrvItem_FindItemByName(This,__MIDL__IWiaDrvItem0007,__MIDL__IWiaDrvItem0008,__MIDL__IWiaDrvItem0009) \ - ( (This)->lpVtbl -> FindItemByName(This,__MIDL__IWiaDrvItem0007,__MIDL__IWiaDrvItem0008,__MIDL__IWiaDrvItem0009) ) - -#define IWiaDrvItem_FindChildItemByName(This,__MIDL__IWiaDrvItem0010,__MIDL__IWiaDrvItem0011) \ - ( (This)->lpVtbl -> FindChildItemByName(This,__MIDL__IWiaDrvItem0010,__MIDL__IWiaDrvItem0011) ) - -#define IWiaDrvItem_GetParentItem(This,__MIDL__IWiaDrvItem0012) \ - ( (This)->lpVtbl -> GetParentItem(This,__MIDL__IWiaDrvItem0012) ) - -#define IWiaDrvItem_GetFirstChildItem(This,__MIDL__IWiaDrvItem0013) \ - ( (This)->lpVtbl -> GetFirstChildItem(This,__MIDL__IWiaDrvItem0013) ) - -#define IWiaDrvItem_GetNextSiblingItem(This,__MIDL__IWiaDrvItem0014) \ - ( (This)->lpVtbl -> GetNextSiblingItem(This,__MIDL__IWiaDrvItem0014) ) - -#define IWiaDrvItem_DumpItemData(This,__MIDL__IWiaDrvItem0015) \ - ( (This)->lpVtbl -> DumpItemData(This,__MIDL__IWiaDrvItem0015) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IWiaDrvItem_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_wiamindr_xp_0000_0003 */ -/* [local] */ - -typedef struct _WIA_PROPERTY_INFO - { - ULONG lAccessFlags; - VARTYPE vt; - union - { - struct - { - LONG Min; - LONG Nom; - LONG Max; - LONG Inc; - } Range; - struct - { - DOUBLE Min; - DOUBLE Nom; - DOUBLE Max; - DOUBLE Inc; - } RangeFloat; - struct - { - LONG cNumList; - LONG Nom; - BYTE *pList; - } List; - struct - { - LONG cNumList; - DOUBLE Nom; - BYTE *pList; - } ListFloat; - struct - { - LONG cNumList; - GUID Nom; - GUID *pList; - } ListGuid; - struct - { - LONG cNumList; - BSTR Nom; - BSTR *pList; - } ListBStr; - struct - { - LONG Nom; - LONG ValidBits; - } Flag; - struct - { - LONG Dummy; - } None; - } ValidVal; - } WIA_PROPERTY_INFO; - -typedef struct _WIA_PROPERTY_INFO *PWIA_PROPERTY_INFO; - -typedef struct _WIA_PROPERTY_CONTEXT - { - ULONG cProps; - PROPID *pProps; - BOOL *pChanged; - } WIA_PROPERTY_CONTEXT; - -typedef struct _WIA_PROPERTY_CONTEXT *PWIA_PROPERTY_CONTEXT; - -typedef struct _WIAS_CHANGED_VALUE_INFO - { - BOOL bChanged; - LONG vt; - union - { - LONG lVal; - FLOAT fltVal; - BSTR bstrVal; - GUID guidVal; - } Old; - union - { - LONG lVal; - FLOAT fltVal; - BSTR bstrVal; - GUID guidVal; - } Current; - } WIAS_CHANGED_VALUE_INFO; - -typedef struct _WIAS_CHANGED_VALUE_INFO *PWIAS_CHANGED_VALUE_INFO; - -typedef struct _WIAS_DOWN_SAMPLE_INFO - { - ULONG ulOriginalWidth; - ULONG ulOriginalHeight; - ULONG ulBitsPerPixel; - ULONG ulXRes; - ULONG ulYRes; - ULONG ulDownSampledWidth; - ULONG ulDownSampledHeight; - ULONG ulActualSize; - ULONG ulDestBufSize; - ULONG ulSrcBufSize; - BYTE *pSrcBuffer; - BYTE *pDestBuffer; - } WIAS_DOWN_SAMPLE_INFO; - -typedef struct _WIAS_DOWN_SAMPLE_INFO *PWIAS_DOWN_SAMPLE_INFO; - -typedef struct _WIAS_ENDORSER_VALUE - { - LPWSTR wszTokenName; - LPWSTR wszValue; - } WIAS_ENDORSER_VALUE; - -typedef struct _WIAS_ENDORSER_VALUE *PWIAS_ENDORSER_VALUE; - -typedef struct _WIAS_ENDORSER_INFO - { - ULONG ulPageCount; - ULONG ulNumEndorserValues; - WIAS_ENDORSER_VALUE *pEndorserValues; - } WIAS_ENDORSER_INFO; - -typedef struct _WIAS_ENDORSER_INFO *PWIAS_ENDORSER_INFO; - -#include "wiamdef.h" - - -extern RPC_IF_HANDLE __MIDL_itf_wiamindr_xp_0000_0003_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_wiamindr_xp_0000_0003_v0_0_s_ifspec; - -/* Additional Prototypes for ALL interfaces */ - -unsigned long __RPC_USER BSTR_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); -void __RPC_USER BSTR_UserFree( __RPC__in unsigned long *, __RPC__in BSTR * ); - -unsigned long __RPC_USER BSTR_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); -void __RPC_USER BSTR_UserFree64( __RPC__in unsigned long *, __RPC__in BSTR * ); - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/wiatwcmp.h b/pub/ddk/wiatwcmp.h deleted file mode 100644 index 349fb2a..0000000 --- a/pub/ddk/wiatwcmp.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -* -* (C) COPYRIGHT 1998-2001, MICROSOFT CORP. -* -* FILE: wiatwcmp.h -* -* VERSION: 1.0 -* -* DATE: 6/01/2001 -* -* DESCRIPTION: -* Defines TWAIN Compatibility Layer - Capability pass-through constants. -* To support existing TWAIN applications that have private capabilities, -* WIA drivers can utilize the Pass-through functionality. -* -*****************************************************************************/ - -#if (_WIN32_WINNT >= 0x0501) // Windows XP and later - -#ifndef _WIATWCMP_H_ -#define _WIATWCMP_H_ - -#define WiaItemTypeTwainCapabilityPassThrough 0x00020000 - -//************************************************************************** -// -// TWAIN capability pass-through -// -//************************************************************************** - -// -// Escape code ranges 2001 - 3000 are reserved for future ESC_ commands -// - -#define ESC_TWAIN_CAPABILITY 2001 // private TWAIN capability negotiation -#define ESC_TWAIN_PRIVATE_SUPPORTED_CAPS 2002 // query for supported private capabilities - -typedef struct _TWAIN_CAPABILITY { - LONG lSize; // size of TWAIN_CAPABILITY structure - LONG lMSG; // TWAIN Message, MSG_GET, MSG_GETCURRENT, MSG_SET, etc.. - LONG lCapID; // id of capability to set or get - LONG lConType; // container type of capability - LONG lRC; // TWAIN return code, TWRC_SUCCESS, TWRC_FAILURE, etc.. - LONG lCC; // TWAIN condition code, TWCC_SUCCESS, TWCC_BUMMER, etc.. - LONG lDataSize;// data size - BYTE Data[1]; // first BYTE of data -}TWAIN_CAPABILITY,*PTWAIN_CAPABILITY; - -#endif - -#endif //#if (_WIN32_WINNT >= 0x0501) - diff --git a/pub/ddk/wiautil.h b/pub/ddk/wiautil.h deleted file mode 100644 index 67b2bee..0000000 --- a/pub/ddk/wiautil.h +++ /dev/null @@ -1,1394 +0,0 @@ -/**************************************************************************** -* -* (C) COPYRIGHT 2000, MICROSOFT CORP. -* -* FILE: wiautil.h -* -* VERSION: 1.0 -* -* DATE: 11/17/2000 -* -* DESCRIPTION: -* Definitions for WIA driver helper classes and functions. -* NOTE: This header requires wiamindr.h to be included. -* -*****************************************************************************/ - -#if (_WIN32_WINNT >= 0x0501) // Windows XP and later - -#pragma once - -#define STRSAFE_NO_DEPRECATE -#include - -/**************************************************************************\ -* CWiauFormatConverter -* -* Helper class for converting images to BMP format. -* -\**************************************************************************/ - -typedef struct _BMP_IMAGE_INFO -{ - INT Width; // Width of the image in pixels - INT Height; // Height of the image in lines - INT ByteWidth; // Width of the image in bytes - INT Size; // Total size of the image, including headers -} BMP_IMAGE_INFO, *PBMP_IMAGE_INFO; - -typedef enum -{ - SKIP_OFF, - SKIP_FILEHDR, - SKIP_BOTHHDR - -} SKIP_AMOUNT; - -class CWiauFormatConverter -{ -public: - CWiauFormatConverter(); - ~CWiauFormatConverter(); - - /**************************************************************************\ - * Init - * - * Intializes this class and GDI+ for converting images. This method - * should be called just once. - * - \**************************************************************************/ - - __checkReturn HRESULT Init(); - - - /**************************************************************************\ - * IsFormatSupported - * - * This method will verify that GDI+ supports the image format - * that is to be converted. - * - * Arguments: - * - * pguidFormat - pointer to GUID format from gdiplusimaging.h - * - \**************************************************************************/ - - __checkReturn BOOL IsFormatSupported(__in const GUID *pguidFormat); - - - /**************************************************************************\ - * ConvertToBmp - * - * This method will convert an image to BMP format. The caller can pass - * a result buffer in ppDest and the size in piDestSize. Alternatively - * the caller can set *ppDest to NULL and *piDestSize to zero to - * indicate that this method should allocate the memory. The caller is - * responsible for freeing the memory with "delete []". - * - * Arguments: - * - * pSource - pointer to memory location of source image - * iSourceSize - size of source image - * ppDest - location to receive memory location of result image - * piDestSize - location to receive size of result image - * pBmpImageInfo - location to receive stats about the BMP - * iSkipAmt - Indicates how much of the BMP header to skip: - * SKIP_OFF = skip neither header - * SKIP_FILEHDR = skip the file header - * SKIP_BOTHHDR = skip the file and info headers - * - \**************************************************************************/ - - __checkReturn HRESULT ConvertToBmp(__in BYTE *pSource, INT iSourceSize, - __deref_out_ecount(*piDestSize) BYTE **ppDest, - __inout INT *piDestSize, __out BMP_IMAGE_INFO *pBmpImageInfo, - SKIP_AMOUNT iSkipAmt = SKIP_OFF); - -private: - ULONG_PTR m_Token; - UINT m_EncoderCount; - BYTE *m_pEncoderInfo; - GUID m_guidCodecBmp; -}; - - -/**************************************************************************\ -* CWiauPropertyList -* -* Helper class for definining and initializing WIA properties -* -\**************************************************************************/ - -class CWiauPropertyList -{ -private: - - int m_NumAlloc; // number of slots allocated - int m_NumProps; // number of properties defined - PROPID *m_pId; // property ids - LPOLESTR *m_pNames; // property names - PROPVARIANT *m_pCurrent; // current value - PROPSPEC *m_pPropSpec; // property spec (used for WriteMultiple) - WIA_PROPERTY_INFO *m_pAttrib; // property attributes - -public: - - CWiauPropertyList(); - ~CWiauPropertyList(); - - /**************************************************************************\ - * Init - * - * Initializes the property info object. - * - * Arguments: - * NumProps - number of properties to reserve space for. This number can - * be larger than the actual number used, but cannot be smaller. - * - \**************************************************************************/ - - __checkReturn HRESULT Init(INT NumProps); - - - /**************************************************************************\ - * DefineProperty - * - * Adds a property definition to the object. - * - * Arguments: - * index - pointer to an int that will be set to the property index - * within the object, useful for passing to other property - * info methods - * PropId - property ID constant - * PropName - property name string - * Access - determines access to the property, usually either - * WIA_PROP_READ or WIA_PROP_RW - * SubType - indicates subtype of the property, usually either - * WIA_PROP_NONE, WIA_PROP_FLAG, WIA_PROP_RANGE, or WIA_PROP_LIST - * - \**************************************************************************/ - - __checkReturn HRESULT DefineProperty(__inout int *pIdx, PROPID PropId, - __in LPOLESTR PropName, ULONG Access, - ULONG SubType); - - - /**************************************************************************\ - * SendToWia - * - * Calls the WIA service to define all of the properties currently - * contained in the object. Should be called once after all properties - * are defined and set. - * - * Arguments: - * pWiasContext - pointer to the context passed into drvInitItemProperties - * - \**************************************************************************/ - - __checkReturn HRESULT SendToWia(__in BYTE *pWiasContext); - - - /**************************************************************************\ - * SetAccessSubType - * - * Used to reset the access and subtype of a property. - * - * Arguments: - * index - the property index, from DefineProperty - * Access - determines access to the property, usually either - * WIA_PROP_READ or WIA_PROP_RW - * SubType - indicates subtype of the property, usually either - * WIA_PROP_NONE, WIA_PROP_FLAG, WIA_PROP_RANGE, or WIA_PROP_LIST - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetAccessSubType(INT index, ULONG Access, ULONG SubType); -#else - HRESULT SetAccessSubType(INT index, ULONG Access, ULONG SubType); -#endif - - - /**************************************************************************\ - * SetValidValues (flag) - * - * Sets the type and current, default, and valid values of a property. - * Also sets property type to VT_I4 and subtype to WIA_PROP_FLAG. - * - * Arguments: - * index - the property index, from DefineProperty - * defaultValue - default setting of this property on the device - * currentValue - current setting of this property on the device - * validFlags - combination of all valid flags - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetValidValues(INT index, LONG defaultValue, LONG currentValue, LONG validFlags); -#else - HRESULT SetValidValues(INT index, LONG defaultValue, LONG currentValue, LONG validFlags); -#endif - - - /**************************************************************************\ - * SetValidValues (signed long, range) - * - * Sets the type and current, default, and valid values of a property. - * Also sets property type to VT_I4 and subtype to WIA_PROP_RANGE. - * - * Arguments: - * index - the property index, from DefineProperty - * defaultValue - default setting of this property on the device - * currentValue - current setting of this property on the device - * minValue - minimum value for the range - * maxValue - maximum value for the range - * stepValue - step value for the range - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetValidValues(INT index, LONG defaultValue, LONG currentValue, - LONG minValue, LONG maxValue, LONG stepValue); -#else - HRESULT SetValidValues(INT index, LONG defaultValue, LONG currentValue, - LONG minValue, LONG maxValue, LONG stepValue); -#endif - - - /**************************************************************************\ - * SetValidValues (signed long, list) - * - * Sets the type and current, default, and valid values of a property. - * Also sets property type to VT_I4 and subtype to WIA_PROP_LIST. - * - * Arguments: - * index - the property index, from DefineProperty - * defaultValue - default setting of this property on the device - * currentValue - current setting of this property on the device - * numValues - number of values in the list - * pValues - pointer to the value list (must be valid until SendToWia - * is called) - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetValidValues(INT index, LONG defaultValue, LONG currentValue, - INT numValues, __in_ecount(numValues) PLONG pValues); -#else - HRESULT SetValidValues(INT index, LONG defaultValue, LONG currentValue, - INT numValues, __in_ecount(numValues) PLONG pValues); -#endif - - - /**************************************************************************\ - * SetValidValues (BSTR, list) - * - * Sets the type and current, default, and valid values of a property. - * Also sets property type to VT_BSTR and subtype to WIA_PROP_LIST. - * - * Arguments: - * index - the property index, from DefineProperty - * defaultValue - default setting of this property on the device - * currentValue - current setting of this property on the device - * numValues - number of values in the list - * pValues - pointer to the value list (must be valid until SendToWia - * is called) - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetValidValues(INT index, __in BSTR defaultValue, __in BSTR currentValue, - INT numValues, __in_ecount(numValues) BSTR *pValues); -#else - HRESULT SetValidValues(INT index, __in BSTR defaultValue, __in BSTR currentValue, - INT numValues, __in_ecount(numValues) BSTR *pValues); -#endif - - - /**************************************************************************\ - * SetValidValues (float, range) - * - * Sets the type and current, default, and valid values of a property. - * Also sets property type to VT_R4 and subtype to WIA_PROP_RANGE. - * - * Arguments: - * index - the property index, from DefineProperty - * defaultValue - default setting of this property on the device - * currentValue - current setting of this property on the device - * minValue - minimum value for the range - * maxValue - maximum value for the range - * stepValue - step value for the range - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetValidValues(INT index, FLOAT defaultValue, FLOAT currentValue, - FLOAT minValue, FLOAT maxValue, FLOAT stepValue); -#else - HRESULT SetValidValues(INT index, FLOAT defaultValue, FLOAT currentValue, - FLOAT minValue, FLOAT maxValue, FLOAT stepValue); -#endif - - - /**************************************************************************\ - * SetValidValues (float, list) - * - * Sets the type and current, default, and valid values of a property. - * Also sets property type to VT_R4 and subtype to WIA_PROP_LIST. - * - * Arguments: - * index - the property index, from DefineProperty - * defaultValue - default setting of this property on the device - * currentValue - current setting of this property on the device - * numValues - number of values in the list - * pValues - pointer to the value list (must be valid until SendToWia - * is called) - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetValidValues(INT index, FLOAT defaultValue, FLOAT currentValue, - INT numValues, __in_ecount(numValues) PFLOAT pValues); -#else - HRESULT SetValidValues(INT index, FLOAT defaultValue, FLOAT currentValue, - INT numValues, __in_ecount(numValues) PFLOAT pValues); -#endif - - - /**************************************************************************\ - * SetValidValues (CLSID, list) - * - * Sets the type and current, default, and valid values of a property. - * Also sets property type to VT_CLSID and subtype to WIA_PROP_LIST. - * - * Arguments: - * index - the property index, from DefineProperty - * defaultValue - default setting of this property on the device - * currentValue - current setting of this property on the device - * numValues - number of values in the list - * pValues - pointer to the value list (must be valid until SendToWia - * is called) - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetValidValues(INT index, __in CLSID *defaultValue, __in CLSID *currentValue, - INT numValues, __in_ecount(numValues) CLSID **pValues); -#else - HRESULT SetValidValues(INT index, __in CLSID *defaultValue, __in CLSID *currentValue, - INT numValues, __in_ecount(numValues) CLSID **pValues); -#endif - - - /**************************************************************************\ - * SetCurrentValue (signed long) - * - * Sets the current value for a property. Also sets the type to VT_I4. - * - * Arguments: - * index - the property index, from DefineProperty - * value - current setting of this property on the device - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetCurrentValue(INT index, LONG value); -#else - HRESULT SetCurrentValue(INT index, LONG value); -#endif - - - /**************************************************************************\ - * SetCurrentValue (BSTR) - * - * Sets the current value for a property. Also sets the type to VT_BSTR. - * - * Arguments: - * index - the property index, from DefineProperty - * value - current setting of this property on the device - * (must be valid until SendToWia is called) - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetCurrentValue(INT index, __in BSTR value); -#else - HRESULT SetCurrentValue(INT index, __in BSTR value); -#endif - - - /**************************************************************************\ - * SetCurrentValue (float) - * - * Sets the current value for a property. Also sets the type to VT_R4. - * - * Arguments: - * index - the property index, from DefineProperty - * value - current setting of this property on the device - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetCurrentValue(INT index, FLOAT value); -#else - HRESULT SetCurrentValue(INT index, FLOAT value); -#endif - - - /**************************************************************************\ - * SetCurrentValue (CLSID) - * - * Sets the current value for a property. Also sets the type to VT_CLSID. - * - * Arguments: - * index - the property index, from DefineProperty - * value - current setting of this property on the device - * (must be valid until SendToWia is called) - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetCurrentValue(INT index, __in CLSID *pValue); -#else - HRESULT SetCurrentValue(INT index, __in CLSID *pValue); -#endif - - - /**************************************************************************\ - * SetCurrentValue (SYSTEMTIME) - * - * Sets the current value for a property. Also sets the type to - * VT_UI2 | VT_VECTOR. - * - * Arguments: - * index - the property index, from DefineProperty - * value - current setting of this property on the device - * (must be valid until SendToWia is called) - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetCurrentValue(INT index, __in PSYSTEMTIME value); -#else - HRESULT SetCurrentValue(INT index, __in PSYSTEMTIME value); -#endif - - - /**************************************************************************\ - * SetCurrentValue (byte array) - * - * Sets the current value for a property. Also sets the type to - * VT_UI1 | VT_VECTOR. - * - * Arguments: - * index - the property index, from DefineProperty - * value - pointer to current setting of this property on the device - * (must be valid until SendToWia is called) - * - \**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - void SetCurrentValue(INT index, __in BYTE *value, INT size); -#else - HRESULT SetCurrentValue(INT index, __in BYTE *value, INT size); -#endif - - - /**************************************************************************\ - * GetPropId - * - * Returns the property id given a property index. - * - \**************************************************************************/ - - __checkReturn PROPID GetPropId(INT index) { return m_pId[index]; } - - - /**************************************************************************\ - * LookupPropId - * - * Finds the property index given a property ID. - * - \**************************************************************************/ - - __checkReturn INT LookupPropId(PROPID PropId); -}; - - -/**************************************************************************\ -* wiauGetDrvItemContext -* -* This helper function gets the driver item context, and optionally -* return the driver item -* -* Arguments: -* -* pWiasContext - pointer to the item context -* ppItemCtx - location to store pointer to driver item context -* ppDrvItem - location to store pointer to driver item (can be NULL) -* -\**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauGetDrvItemContext(__in BYTE *pWiasContext, __inout VOID **ppItemCtx, - __inout_opt IWiaDrvItem **ppDrvItem = NULL); -#else - __checkReturn HRESULT _stdcall wiauGetDrvItemContext(__in BYTE *pWiasContext, __inout VOID **ppItemCtx, - __inout_opt IWiaDrvItem **ppDrvItem = NULL); -#endif - - -/**************************************************************************\ -* wiauSetImageItemSize -* -* Calulates the size and width in bytes for an image based on the current -* WIA_IPA_FORMAT setting, and writes the new values to the appropriate -* properties. If the format is not BMP, this function assumes that the -* value passed in lSize is correct for the current format. -* -* Arguments: -* -* pWiasContext - pointer to item context -* lWidth - width of the image in pixels -* lHeight - height of the image in lines -* lDepth - depth of the image in bits -* lSize - size of the image as stored on the device -* pwszExt - optional pointer to the 3 letter extension for the -* item's native format (if this is NULL, the extension -* property won't be updated) -* -\**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauSetImageItemSize(__in BYTE *pWiasContext, LONG lWidth, - LONG lHeight, LONG lDepth, LONG lSize, __in_opt PWSTR pwszExt = NULL); -#else - __checkReturn HRESULT _stdcall wiauSetImageItemSize(__in BYTE *pWiasContext, LONG lWidth, - LONG lHeight, LONG lDepth, LONG lSize, __in_opt PWSTR pwszExt = NULL); -#endif - - -/**************************************************************************\ -* wiauPropsInPropSpec -* -* Returns true if one or more of the property ids in pProps are -* contained in pPropSpecs. -* -* Arguments: -* -* NumPropSpecs - number of property specs in the array -* pPropSpecs - the property specs array -* NumProps - number of property ids to search for -* pProps - pointer to the array of property ids to search for -* -\**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - __checkReturn BOOL wiauPropsInPropSpec(LONG NumPropSpecs, - __in_ecount(NumPropSpecs) const PROPSPEC *pPropSpecs, - int NumProps, __in_ecount(NumProps) PROPID *pProps); -#else - __checkReturn BOOL _stdcall wiauPropsInPropSpec(LONG NumPropSpecs, - __in_ecount(NumPropSpecs) const PROPSPEC *pPropSpecs, - int NumProps, __in_ecount(NumProps) PROPID *pProps); -#endif - - -/**************************************************************************\ -* wiauPropInPropSpec -* -* Returns true if the PropId property ID is in the passed pPropSpecs -* array. Optionally will return the index of where the ID was found. -* -* Arguments: -* -* NumPropSpecs - number of property specs in the array -* pPropSpecs - the property specs array -* PropId - property id to search for -* pIdx - optional pointer to the location to store the index -* -\**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - __checkReturn BOOL wiauPropInPropSpec(LONG NumPropSpecs, - __in_ecount(NumPropSpecs) const PROPSPEC *pPropSpecs, - PROPID PropId, __out_opt int *pIdx = NULL); -#else - __checkReturn BOOL _stdcall wiauPropInPropSpec(LONG NumPropSpecs, - __in_ecount(NumPropSpecs) const PROPSPEC *pPropSpecs, - PROPID PropId, __out_opt int *pIdx = NULL); -#endif - - -/**************************************************************************\ -* wiauGetValidFormats -* -* Calls drvGetWiaFormatInfo and makes a list of valid formats given -* a tymed value. Caller is responsible for freeing the format array -* with []delete. -* -* Arguments: -* -* pDrv - Pointer to WIA minidriver object (use "this") -* pWiasContext - WIA service context -* TymedValue - tymed value to search for -* pNumFormats - pointer to value to receive number of formats -* ppFormatArray - pointer to a location to receive array address -* -\**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauGetValidFormats(__in IWiaMiniDrv *pDrv, __in BYTE *pWiasContext, - LONG TymedValue, __out int *pNumFormats, __out_ecount(*pNumFormats) GUID **ppFormatArray); -#else - __checkReturn HRESULT _stdcall wiauGetValidFormats(__in IWiaMiniDrv *pDrv, __in BYTE *pWiasContext, - LONG TymedValue, __out int *pNumFormats, __out_ecount(*pNumFormats)GUID **ppFormatArray); -#endif - - -/**************************************************************************\ -* wiauGetResourceString -* -* This helper gets a resource string and returns it as a BSTR -* -* Arguments: -* -* hInst - Handle to module instance -* lResourceID - Resource ID of the target BSTR value -* pbstrStr - Location to store the retrieved string (caller must -* free this string with SysFreeString()) -* -\**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauGetResourceString(HINSTANCE hInst, LONG lResourceID, __out BSTR *pbstrStr); -#else - __checkReturn HRESULT _stdcall wiauGetResourceString(HINSTANCE hInst, LONG lResourceID, __out BSTR *pbstrStr); -#endif - - -/**************************************************************************\ -* wiauRegOpenDataW -* -* Opens the DeviceData key. Call this function only in the STI Initialize -* function. Call RegCloseKey when finished. -* -* Arguments: -* -* hkeyAncestor - HKey of parent (use hkey passed into Initialize) -* phkeyDeviceData - Location to store opened hkey -* -\**************************************************************************/ -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauRegOpenDataW(__in HKEY hkeyAncestor, __inout HKEY *phkeyDeviceData); -#else - __checkReturn HRESULT _stdcall wiauRegOpenDataW(__in HKEY hkeyAncestor, __inout HKEY *phkeyDeviceData); -#endif - - -/**************************************************************************\ -* wiauRegOpenDataA -* -* Opens the DeviceData key. Call this function only in the STI Initialize -* function. Call RegCloseKey when finished. -* -* Arguments: -* -* hkeyAncestor - HKey of parent (use hkey passed into Initialize) -* phkeyDeviceData - Location to store opened hkey -* -\**************************************************************************/ -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauRegOpenDataA(__in HKEY hkeyAncestor, __inout HKEY *phkeyDeviceData); -#else - __checkReturn HRESULT _stdcall wiauRegOpenDataA(__in HKEY hkeyAncestor, __inout HKEY *phkeyDeviceData); -#endif - - -/**************************************************************************\ -* wiauRegGetStrW -* -* Use to get string value from the DeviceData section of the registry. -* -* Arguments: -* -* hkey - Use hkey returned from wiauRegOpenData -* pwszValueName - Name of registry entry -* pwszValue - Location to store returned string -* pdwLength - Size of location in bytes -* -\**************************************************************************/ -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauRegGetStrW(__in HKEY hkKey, __in PCWSTR pwszValueName, - __out_bcount(*pdwLength) PWSTR pwszValue, __inout WORD *pdwLength); -#else - __checkReturn HRESULT _stdcall wiauRegGetStrW(__in HKEY hkKey, __in PCWSTR pwszValueName, - __out_bcount(*pdwLength) PWSTR pwszValue, __inout DWORD *pdwLength); -#endif - - -/**************************************************************************\ -* wiauRegGetStrA -* -* Use to get string value from the DeviceData section of the registry. -* -* Arguments: -* -* hkey - Use hkey returned from wiauRegOpenData -* pszValueName - Name of registry entry -* pszValue - Location to store returned string -* pdwLength - Size of location in bytes -* -\**************************************************************************/ -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauRegGetStrA(__in HKEY hkKey, __in PCSTR pszValueName, - __out_bcount(*pdwLength) PSTR pszValue, __inout DWORD *pdwLength); -#else - __checkReturn HRESULT _stdcall wiauRegGetStrA(__in HKEY hkKey, __in PCSTR pszValueName, - __out_bcount(*pdwLength) PSTR pszValue, __inout DWORD *pdwLength); -#endif - - -/**************************************************************************\ -* wiauRegGetDwordW -* -* Use to get DWORD value from the DeviceData section of the registry. -* -* Arguments: -* -* hkey - Use hkey returned from wiauRegOpenData -* pwszValueName - Name of registry entry -* pdwValue - Location to store returned DWORD -* -\**************************************************************************/ -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauRegGetDwordW(__in HKEY hkKey, __in PCWSTR pwszValueName, __out DWORD *pdwValue); -#else - __checkReturn HRESULT _stdcall wiauRegGetDwordW(__in HKEY hkKey, __in PCWSTR pwszValueName, __out DWORD *pdwValue); -#endif - - -/**************************************************************************\ -* wiauRegGetDwordA -* -* Use to get DWORD value from the DeviceData section of the registry. -* -* Arguments: -* -* hkey - Use hkey returned from wiauRegOpenData -* pszValueName - Name of registry entry -* pdwValue - Location to store returned DWORD -* -\**************************************************************************/ -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauRegGetDwordA(__in HKEY hkKey, __in PCSTR pszValueName, __out DWORD *pdwValue); -#else - __checkReturn HRESULT _stdcall wiauRegGetDwordA(__in HKEY hkKey, __in PCSTR pszValueName, __out DWORD *pdwValue); -#endif - - -/**************************************************************************\ -* WiauStrW2C -* -* Converts a wide character string to an ANSI character string -* -* Arguments: -* pwszSrc - wide character string to be converted -* pszDst - location to store the ANSI conversion -* iSize - size of the buffer pointed to by pszDst, in bytes -* -\**************************************************************************/ -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauStrW2C(__in_bcount(iSize) __nullterminated WCHAR *pwszSrc, - __out_ecount(iSize) CHAR *pszDst, INT iSize); -#else - __checkReturn HRESULT _stdcall wiauStrW2C(__in_bcount(iSize) __nullterminated WCHAR *pwszSrc, - __out_ecount(iSize) CHAR *pszDst, INT iSize); -#endif - -/**************************************************************************\ -* WiauStrC2W -* -* Converts an ANSI character string to a wide character string -* -* Arguments: -* pszSrc - ANSI string to convert -* wpszDst - location to store the wide string -* iSize - size of the buffer pointed to by wpszDst, in bytes -* -\**************************************************************************/ -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauStrC2W(__in_bcount(iSize) __nullterminated CHAR *pszSrc, - __out_bcount(iSize) WCHAR *pwszDst, INT iSize); -#else - __checkReturn HRESULT _stdcall wiauStrC2W(__in_bcount(iSize) __nullterminated CHAR *pszSrc, - __out_bcount(iSize) WCHAR *pwszDst, INT iSize); -#endif - - -/**************************************************************************\ -* WiauStrW2W -* -* Copies a wide character string to another wide character string -* -* Arguments: -* pwszSrc - wide character string to be copied -* pwszDst - location to copy to -* iSize - size of the buffer pointed to by pwszDst, in bytes -* -\**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauStrW2W(__in_bcount(iSize) __nullterminated WCHAR *pwszSrc, - __out_bcount(iSize) WCHAR *pwszDst, INT iSize); -#else - __checkReturn HRESULT _stdcall wiauStrW2W(__in_bcount(iSize) __nullterminated WCHAR *pwszSrc, - __out_bcount(iSize) WCHAR *pwszDst, INT iSize); -#endif - - -/**************************************************************************\ -* WiauStrC2C -* -* Copies an ANSI character string to another ANSI character string -* -* Arguments: -* pszSrc - ANSI string to be copied -* pszDst - location to copy to -* iSize - size of the buffer pointed to by pszDst, in bytes -* -\**************************************************************************/ - -#if (_WIN32_WINNT == 0x0501) - __checkReturn HRESULT wiauStrC2C(__in_ecount(iSize) __nullterminated CHAR *pszSrc, - __out_bcount(iSize) CHAR *pszDst, INT iSize); -#else - __checkReturn HRESULT _stdcall wiauStrC2C(__in_ecount(iSize) __nullterminated CHAR *pszSrc, - __out_bcount(iSize) CHAR *pszDst, INT iSize); -#endif - - -#ifdef UNICODE - -#define wiauRegOpenData wiauRegOpenDataW -#define wiauRegGetStr wiauRegGetStrW -#define wiauRegGetDword wiauRegGetDwordW - -#define wiauStrT2C wiauStrW2C -#define wiauStrC2T wiauStrC2W -#define wiauStrT2W wiauStrW2W -#define wiauStrW2T wiauStrW2W -#define WIAU_DEBUG_TSTR "S" - -#else - -#define wiauRegOpenData wiauRegOpenDataA -#define wiauRegGetStr wiauRegGetStrA -#define wiauRegGetDword wiauRegGetDwordA - -#define wiauStrT2C wiauStrC2C -#define wiauStrC2T wiauStrC2C -#define wiauStrT2W wiauStrC2W -#define wiauStrW2T wiauStrW2C -#define WIAU_DEBUG_TSTR "s" - -#endif // UNICODE - - -/**************************************************************************\ -* WIA Debugging -* -* Definitions for debug messages. To use WIA debugging: -* 1. Set registry HKLM\System\CurrentControlSet\Control\StillImage\Debug\, -* DWORD value "DebugFlags" to the combination of the WIAUDBG_* flags -* desired. The application and possibly the WIA service will need to be -* restarted to pick up the new settings. The key is auto created the -* first time the module is executed. (Note: above is the -* name of the DLL or EXE, e.g. wiavusd.dll has a registry key of -* "HKLM\System\CurrentControlSet\Control\StillImage\Debug\wiavusd.dll".) -* 2. Or in the debugger, set g_dwDebugFlags to the combination of the -* WIAUDBG_* flags desired. This can be done anytime during the debug -* session. -* 3. From the module, call wiauDbgSetFlags(), where is the -* combination of the WIAUDBG_* flags desired. -* -* Messages will be logged to the debugger and the file -* %systemroot%\\wiadebug.log, unless the WIAUDBG_DONT_LOG_* flags are set. -* Setting both flags will turn off all messages. -* -* All strings should be ASCII. Use %S in the format string to print a -* Unicode string. -* -\**************************************************************************/ - -#define _STIDEBUG_H_ // WIA debugging is incompatible with stidebug.h, so don't include it - -// -// Predefined debug flags -// - -const DWORD WIAUDBG_ERRORS = 0x00000001; -const DWORD WIAUDBG_WARNINGS = 0x00000002; -const DWORD WIAUDBG_TRACES = 0x00000004; -const DWORD WIAUDBG_FNS = 0x00000008; // Function entry and exit -const DWORD WIAUDBG_DUMP = 0x00000010; // Dump data -const DWORD WIAUDBG_PRINT_TIME = 0x08000000; // Prints time for each message -const DWORD WIAUDBG_PRINT_INFO = 0x10000000; // Turns on thread, file, line info -const DWORD WIAUDBG_DONT_LOG_TO_DEBUGGER = 0x20000000; -const DWORD WIAUDBG_DONT_LOG_TO_FILE = 0x40000000; -const DWORD WIAUDBG_BREAK_ON_ERRORS = 0x80000000; // Do DebugBreak on errors - -// -// Don't log at all -// -const DWORD WIAUDBG_DONT_LOG = WIAUDBG_DONT_LOG_TO_FILE | WIAUDBG_DONT_LOG_TO_DEBUGGER; - -// -// Set default flags -// -#ifdef DEBUG -const DWORD WIAUDBG_DEFAULT_FLAGS = WIAUDBG_ERRORS; -#else -const DWORD WIAUDBG_DEFAULT_FLAGS = WIAUDBG_DONT_LOG; -#endif - -// -// FormatMessage flags -// -const DWORD WIAUDBG_MFMT_FLAGS = FORMAT_MESSAGE_IGNORE_INSERTS | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_MAX_WIDTH_MASK; - -#ifdef __cplusplus -extern "C" { -#endif - -// -// WIA Debugging has very little overhead and should be put into retail -// code for drivers. If it's really desired to remove it, define NO_WIA_DEBUG. -// - -#ifdef NO_WIA_DEBUG - -#define g_dwDebugFlags 0 -#define wiauDbgInit(a) -#define wiauDbgHelper(a,b,c,d) -#define wiauDbgHelper2 wiauNull3 -#define wiauDbgFlags wiauNull4 -#define wiauDbgError wiauNull2 -#define wiauDbgErrorHr wiauNull3hr -#define wiauDbgWarning wiauNull2 -#define wiauDbgTrace wiauNull2 -#define wiauDbgDump wiauNull2 -#define wiauDbgSetFlags(a) 0 -#define wiauDbgLegacyError wiauNull1 -#define wiauDbgLegacyWarning wiauNull1 -#define wiauDbgLegacyTrace wiauNull1 -#define wiauDbgLegacyError2 wiauNull2h -#define wiauDbgLegacyTrace2 wiauNull2h -#define wiauDbgLegacyHresult2 wiauNullHHr - -inline void wiauNull1(LPCSTR a, ...) {} -inline void wiauNull2(LPCSTR a, LPCSTR b,...) {} -inline void wiauNull2h(HINSTANCE hInstance, LPCSTR b,...) {} -inline void wiauNull3(LPCSTR a, LPCSTR b, LPCSTR c, ...) {} -inline void wiauNull3hr(HRESULT a, LPCSTR b, LPCSTR c, ...) {} -inline void wiauNull4(DWORD a, LPCSTR b, LPCSTR c, LPCSTR d, ...) {} -inline void wiauNullHHr(HINSTANCE hInstance, HRESULT hr) {} - - -#else // NO_WIA_DEBUG - -extern DWORD g_dwDebugFlags; -extern HANDLE g_hDebugFile; -extern DWORD g_dwDebugFileSizeLimit; -extern BOOL g_bDebugInited; - - -/**************************************************************************\ -* wiauDbgInit -* -* Call to initialize WIA debugging. If it's not called, all DLLs will -* inherit the debug flags of the process that creates them. -* -* Arguments: -* -* hInstance - DLL instance handle -* -\**************************************************************************/ - -void __stdcall wiauDbgInit(__in_opt HINSTANCE hInstance); -void __stdcall wiauDbgHelper(__in LPCSTR prefix, __in LPCSTR fname, __in LPCSTR fmt, va_list marker); -void __stdcall wiauDbgHelper2(__in LPCSTR prefix, __in LPCSTR fname, __in LPCSTR fmt, ...); - -inline void __stdcall wiauDbgFlags(DWORD flags, __in LPCSTR prefix, - __in LPCSTR fname, __in LPCSTR fmt, ...) -{ - va_list marker; - - // - // See if log messages are enabled and the flag is enabled - // - if (((g_dwDebugFlags & WIAUDBG_DONT_LOG) ^ WIAUDBG_DONT_LOG) && - (g_dwDebugFlags & flags)) { - - va_start(marker, fmt); - wiauDbgHelper(prefix, fname, fmt, marker); - va_end(marker); - } -} - -inline void __stdcall wiauDbgError(__in LPCSTR fname, __in LPCSTR fmt, ...) -{ - va_list marker; - - // - // See if log messages are enabled and error messages are turned on - // - if (((g_dwDebugFlags & WIAUDBG_DONT_LOG) ^ WIAUDBG_DONT_LOG) && - (g_dwDebugFlags & WIAUDBG_ERRORS)) { - - va_start(marker, fmt); - wiauDbgHelper("ERROR ", fname, fmt, marker); - va_end(marker); - } - - if (g_dwDebugFlags & WIAUDBG_BREAK_ON_ERRORS) { - DebugBreak(); - } -} - -inline void __stdcall wiauDbgErrorHr(HRESULT hr, __in LPCSTR fname, __in LPCSTR fmt, ...) -{ - va_list marker; - - // - // See if log messages are enabled and error messages are turned on - // - if (((g_dwDebugFlags & WIAUDBG_DONT_LOG) ^ WIAUDBG_DONT_LOG) && - (g_dwDebugFlags & WIAUDBG_ERRORS)) { - - va_start(marker, fmt); - wiauDbgHelper("ERROR ", fname, fmt, marker); - va_end(marker); - - CHAR szError[MAX_PATH]; \ - if(!FormatMessageA(WIAUDBG_MFMT_FLAGS, NULL, hr, 0, szError, MAX_PATH, NULL)) - { - StringCchCopyA(szError, ARRAYSIZE(szError), "Unknown HRESULT"); - } - wiauDbgHelper2("ERROR ", fname, "HRESULT = 0x%08x, %s", hr, szError); - } - - if (g_dwDebugFlags & WIAUDBG_BREAK_ON_ERRORS) { - DebugBreak(); - } -} - -inline void __stdcall wiauDbgWarning(__in LPCSTR fname, __in LPCSTR fmt, ...) -{ - va_list marker; - - // - // See if log messages are enabled and warning messages are turned on - // - if (((g_dwDebugFlags & WIAUDBG_DONT_LOG) ^ WIAUDBG_DONT_LOG) && - (g_dwDebugFlags & WIAUDBG_WARNINGS)) { - - va_start(marker, fmt); - wiauDbgHelper("WARN ", fname, fmt, marker); - va_end(marker); - } -} - -inline void __stdcall wiauDbgTrace(__in LPCSTR fname, __in LPCSTR fmt, ...) -{ - va_list marker; - - // - // See if log messages are enabled and trace messages are turned on - // - if (((g_dwDebugFlags & WIAUDBG_DONT_LOG) ^ WIAUDBG_DONT_LOG) && - (g_dwDebugFlags & WIAUDBG_TRACES)) { - - va_start(marker, fmt); - wiauDbgHelper(" ", fname, fmt, marker); - va_end(marker); - } -} - -inline void __stdcall wiauDbgDump(__in LPCSTR fname, __in LPCSTR fmt, ...) -{ - va_list marker; - - // - // See if log messages are enabled and trace messages are turned on - // - if (((g_dwDebugFlags & WIAUDBG_DONT_LOG) ^ WIAUDBG_DONT_LOG) && - (g_dwDebugFlags & WIAUDBG_DUMP)) { - - va_start(marker, fmt); - wiauDbgHelper(" ", fname, fmt, marker); - va_end(marker); - } -} - -inline DWORD __stdcall wiauDbgSetFlags(DWORD flags) -{ - DWORD dwOld = g_dwDebugFlags; - g_dwDebugFlags = flags; - return dwOld; -} - - -inline void __stdcall wiauDbgLegacyError(__in LPCSTR fmt, ...) -{ - va_list marker; - - // - // See if log messages are enabled and error messages are turned on - // - if (((g_dwDebugFlags & WIAUDBG_DONT_LOG) ^ WIAUDBG_DONT_LOG) && - (g_dwDebugFlags & WIAUDBG_ERRORS)) { - - va_start(marker, fmt); - wiauDbgHelper("ERROR ", "", fmt, marker); - va_end(marker); - } - - if (g_dwDebugFlags & WIAUDBG_BREAK_ON_ERRORS) { - DebugBreak(); - } -} - -inline void __stdcall wiauDbgLegacyWarning(__in LPCSTR fmt, ...) -{ - va_list marker; - - // - // See if log messages are enabled and warning messages are turned on - // - if (((g_dwDebugFlags & WIAUDBG_DONT_LOG) ^ WIAUDBG_DONT_LOG) && - (g_dwDebugFlags & WIAUDBG_WARNINGS)) { - - va_start(marker, fmt); - wiauDbgHelper("WARN ", "", fmt, marker); - va_end(marker); - } -} - -inline void __stdcall wiauDbgLegacyTrace(__in LPCSTR fmt, ...) -{ - va_list marker; - - // - // See if log messages are enabled and trace messages are turned on - // - if (((g_dwDebugFlags & WIAUDBG_DONT_LOG) ^ WIAUDBG_DONT_LOG) && - (g_dwDebugFlags & WIAUDBG_TRACES)) { - - va_start(marker, fmt); - wiauDbgHelper(" ", "", fmt, marker); - va_end(marker); - } -} - -inline void __stdcall wiauDbgLegacyError2(__in HINSTANCE hInstance, __in LPCSTR fmt, ...) -{ - UNREFERENCED_PARAMETER(hInstance); - va_list marker; - - // - // See if log messages are enabled and error messages are turned on - // - if (((g_dwDebugFlags & WIAUDBG_DONT_LOG) ^ WIAUDBG_DONT_LOG) && - (g_dwDebugFlags & WIAUDBG_ERRORS)) { - - va_start(marker, fmt); - wiauDbgHelper("ERROR ", "", fmt, marker); - va_end(marker); - } - - if (g_dwDebugFlags & WIAUDBG_BREAK_ON_ERRORS) { - DebugBreak(); - } -} - -inline void __stdcall wiauDbgLegacyTrace2(__in HINSTANCE hInstance, __in LPCSTR fmt, ...) -{ - UNREFERENCED_PARAMETER(hInstance); - va_list marker; - - // - // See if log messages are enabled and trace messages are turned on - // - if (((g_dwDebugFlags & WIAUDBG_DONT_LOG) ^ WIAUDBG_DONT_LOG) && - (g_dwDebugFlags & WIAUDBG_TRACES)) { - - va_start(marker, fmt); - wiauDbgHelper(" ", "", fmt, marker); - va_end(marker); - } -} - -inline void __stdcall wiauDbgLegacyHresult2(__in HINSTANCE hInstance, HRESULT hr) -{ - UNREFERENCED_PARAMETER(hInstance); - wiauDbgErrorHr(hr, "", ""); -} - -#endif // NO_WIA_DEBUG - - -// -// Macros for mapping the old WIA logging to the new system -// -#ifdef WIA_MAP_OLD_DEBUG - -#define CWiaLogProc -#define WIAS_LOGPROC(x, y, z, fname) CWiauDbgFn __CWiauDbgFnObject(fname) -#define WIAS_LERROR(x,y,params) wiauDbgLegacyError ## params -#define WIAS_LWARNING(x,y,params) wiauDbgLegacyWarning ## params -#define WIAS_LTRACE(x,y,z,params) wiauDbgLegacyTrace ## params -#define WIAS_LHRESULT(x,y) wiauDbgErrorHr(y, "", "") - -#define WIAS_TRACE(x) wiauDbgLegacyTrace2 ## x -#define WIAS_ERROR(x) wiauDbgLegacyError2 ## x -#define WIAS_HRESULT(x) wiauDbgLegacyHresult2 ## x -#define WIAS_ASSERT(x, y) \ - if (!(y)) { \ - WIAS_ERROR((x, (char*) TEXT("ASSERTION FAILED: %hs(%d): %hs"), __FILE__,__LINE__,#x)); \ - DebugBreak(); \ - } - -#endif // WIA_MAP_OLD_DEBUG - - -// -// Macros for checking return values and common error conditions -// - -#define REQUIRE_SUCCESS(hr, fname, msg) \ - if (FAILED(hr)) { \ - if (g_dwDebugFlags & WIAUDBG_PRINT_INFO) { \ - DWORD threadId = GetCurrentThreadId(); \ - wiauDbgError(fname, "[%s(%d): Thread 0x%X (%d)]", __FILE__, __LINE__, threadId, threadId); \ - } \ - wiauDbgErrorHr(hr, fname, msg); \ - goto Cleanup; \ - } - -#define REQUIRE_OK(hr, fname, msg) \ - if ((hr) != S_OK) { \ - if (g_dwDebugFlags & WIAUDBG_PRINT_INFO) { \ - DWORD threadId = GetCurrentThreadId(); \ - wiauDbgError(fname, "[%s(%d): Thread 0x%X (%d)]", __FILE__, __LINE__, threadId, threadId); \ - } \ - wiauDbgErrorHr(hr, fname, msg); \ - goto Cleanup; \ - } - -#define REQUIRE_ARGS(args, hr, fname) \ - if (args) { \ - if (g_dwDebugFlags & WIAUDBG_PRINT_INFO) { \ - DWORD threadId = GetCurrentThreadId(); \ - wiauDbgError(fname, "[%s(%d): Thread 0x%X (%d)]", __FILE__, __LINE__, threadId, threadId); \ - } \ - wiauDbgError(fname, "Invalid arg"); \ - hr = E_INVALIDARG; \ - goto Cleanup; \ - } - -#define REQUIRE_ALLOC(var, hr, fname) \ - if (!(var)) { \ - if (g_dwDebugFlags & WIAUDBG_PRINT_INFO) { \ - DWORD threadId = GetCurrentThreadId(); \ - wiauDbgError(fname, "[%s(%d): Thread 0x%X (%d)]", __FILE__, __LINE__, threadId, threadId); \ - } \ - wiauDbgError(fname, "Memory allocation failed on " #var); \ - hr = E_OUTOFMEMORY; \ - goto Cleanup; \ - } - -#define REQUIRE_FILEHANDLE(handle, hr, fname, msg) \ - if ((handle) == NULL || (handle) == INVALID_HANDLE_VALUE) { \ - hr = HRESULT_FROM_WIN32(::GetLastError()); \ - if (g_dwDebugFlags & WIAUDBG_PRINT_INFO) { \ - DWORD threadId = GetCurrentThreadId(); \ - wiauDbgError(fname, "[%s(%d): Thread 0x%X (%d)]", __FILE__, __LINE__, threadId, threadId); \ - } \ - wiauDbgErrorHr(hr, fname, msg); \ - goto Cleanup; \ - } - -#define REQUIRE_FILEIO(ret, hr, fname, msg) \ - if (!(ret)) { \ - hr = HRESULT_FROM_WIN32(::GetLastError()); \ - if (g_dwDebugFlags & WIAUDBG_PRINT_INFO) { \ - DWORD threadId = GetCurrentThreadId(); \ - wiauDbgError(fname, "[%s(%d): Thread 0x%X (%d)]", __FILE__, __LINE__, threadId, threadId); \ - } \ - wiauDbgErrorHr(hr, fname, msg); \ - goto Cleanup; \ - } - -#define REQUIRE_WIN32(err, hr, fname, msg) \ - if ((err) != ERROR_SUCCESS) { \ - hr = HRESULT_FROM_WIN32(err); \ - if (g_dwDebugFlags & WIAUDBG_PRINT_INFO) { \ - DWORD threadId = GetCurrentThreadId(); \ - wiauDbgError(fname, "[%s(%d): Thread 0x%X (%d)]", __FILE__, __LINE__, threadId, threadId); \ - } \ - wiauDbgErrorHr(hr, fname, msg); \ - goto Cleanup; \ - } - - -// -// Macro and class for entry/exit point tracing -// - -#ifdef __cplusplus - -#ifdef NO_WIA_DEBUG - -#define DBG_FN(fname) - -#else // NO_WIA_DEBUG - -#define DBG_FN(fname) CWiauDbgFn __CWiauDbgFnObject(fname) - -class CWiauDbgFn { -public: - - CWiauDbgFn(__in LPCSTR fname) - { - m_fname = fname; - m_threadId = GetCurrentThreadId(); - wiauDbgFlags(WIAUDBG_FNS, " ", m_fname, "Entering, thread 0x%x (%d)", - m_threadId, m_threadId); - - } - - ~CWiauDbgFn() - { - wiauDbgFlags(WIAUDBG_FNS, " ", m_fname, "Exiting, thread 0x%x (%d)", - m_threadId, m_threadId); - } - -private: - LPCSTR m_fname; - DWORD m_threadId; -}; -#endif // NO_WIA_DEBUG - -} - -#else // __cplusplus - -#define DBG_FN(fname) wiauDbgFlags(WIAUDBG_FNS, " ", fname, "Entering"); -#endif // __cplusplus - -#endif //#if (_WIN32_WINNT >= 0x0501) - - diff --git a/pub/ddk/windowssideshow.h b/pub/ddk/windowssideshow.h deleted file mode 100644 index d563acb..0000000 --- a/pub/ddk/windowssideshow.h +++ /dev/null @@ -1,151 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (c) 2004-2005 Microsoft Corporation. All rights -// reserved. -// -// -// Module: -// WindowsSideShow.h -// -// Description: -// This file defines supporting structures and values used in -// the Windows SideShow platform. -// -//----------------------------------------------------------------------- - -#pragma once -#if (_WIN32_WINNT >= 0x0600) // Windows Vista and later -#include "propkeydef.h" -/**************************************************************************** - * This section defines platform constants - ****************************************************************************/ - -const CONTENT_ID CONTENT_ID_GLANCE = 0; - -// Event IDs for ApplicationEvents fired by the device when the user enters/exits -// an application on the device. -const DWORD SIDESHOW_EVENTID_APPLICATION_ENTER = 0xFFFF0000; -const DWORD SIDESHOW_EVENTID_APPLICATION_EXIT = 0xFFFF0001; - - -/**************************************************************************** - * This section defines well-known device endpoints - ****************************************************************************/ - -// {A9A5353F-2D4B-47ce-93EE-759F3A7DDA4F} -DEFINE_GUID(SIDESHOW_ENDPOINT_SIMPLE_CONTENT_FORMAT, 0xa9a5353f, 0x2d4b, 0x47ce, 0x93, 0xee, 0x75, 0x9f, 0x3a, 0x7d, 0xda, 0x4f); - -// {4DFF36B5-9DDE-4F76-9A2A-96435047063D} -DEFINE_GUID(SIDESHOW_ENDPOINT_ICAL, 0x4dff36b5, 0x9dde, 0x4f76, 0x9a, 0x2a, 0x96, 0x43, 0x50, 0x47, 0x06, 0x3d); - - -/**************************************************************************** - * This section defines well-known device capabilities - ****************************************************************************/ - -// {8ABC88A8-857B-4ad7-A35A-B5942F492B99} -DEFINE_GUID(SIDESHOW_CAPABILITY_DEVICE_PROPERTIES, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99); - -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_DEVICE_ID, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 1); // [ VT_LPWSTR ] -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_SCREEN_TYPE, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 2); // [ VT_I4 ] -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_SCREEN_WIDTH, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 3); // [ VT_UI2 ] -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_SCREEN_HEIGHT, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 4); // [ VT_UI2 ] -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_COLOR_DEPTH, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 5); // [ VT_UI2 ] -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_COLOR_TYPE, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 6); // [ VT_I4 ] -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_DATA_CACHE, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 7); // [ VT_BOOL ] -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_SUPPORTED_LANGUAGES, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 8); // [ VT_LPWSTR ] -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_CURRENT_LANGUAGE, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 9); // [ VT_LPWSTR ] -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_SUPPORTED_THEMES, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 10);// [ VT_LPWSTR ] -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_SUPPORTED_IMAGE_FORMATS, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 14);// [ VT_LPWSTR ] -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_CLIENT_AREA_WIDTH, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 15);// [ VT_UI2 ] -DEFINE_PROPERTYKEY(SIDESHOW_CAPABILITY_CLIENT_AREA_HEIGHT, 0x8abc88a8, 0x857b, 0x4ad7, 0xa3, 0x5a, 0xb5, 0x94, 0x2f, 0x49, 0x2b, 0x99, 16);// [ VT_UI2 ] - -/**************************************************************************** - * This section defines enumerations used by the device capabilities - ****************************************************************************/ - -// Used with SIDESHOW_CAPABILITY_SCREEN_TYPE -typedef enum tagSIDESHOW_SCREEN_TYPE -{ - SIDESHOW_SCREEN_TYPE_BITMAP = 0, - SIDESHOW_SCREEN_TYPE_TEXT = 1, -} SIDESHOW_SCREEN_TYPE; - -// Used with SIDESHOW_CAPABILITY_COLOR_TYPE -typedef enum tagSIDESHOW_COLOR_TYPE -{ - SIDESHOW_COLOR_TYPE_COLOR = 0, - SIDESHOW_COLOR_TYPE_GREYSCALE = 1, - SIDESHOW_COLOR_TYPE_BLACK_AND_WHITE = 2, -} SIDESHOW_COLOR_TYPE; - - -/**************************************************************************** - * This section defines constants, structures and enumerations relating to - * the Simple Content Format - ****************************************************************************/ - -// The content id of the home page for a Simple Content Format application -const CONTENT_ID CONTENT_ID_HOME = 1; - -// The ApplicationEvent event ids from the Simple Content Format device application -typedef enum tagSCF_EVENT_IDS -{ - SCF_EVENT_NAVIGATION = 1, - SCF_EVENT_MENUACTION = 2, - SCF_EVENT_CONTEXTMENU = 3, -} SCF_EVENT_IDS; - -// The button ids used in the Simple Content Format events -typedef enum tagSCF_BUTTON_IDS -{ - SCF_BUTTON_MENU = 1, - SCF_BUTTON_SELECT = 2, - SCF_BUTTON_UP = 3, - SCF_BUTTON_DOWN = 4, - SCF_BUTTON_LEFT = 5, - SCF_BUTTON_RIGHT = 6, - SCF_BUTTON_PLAY = 7, - SCF_BUTTON_PAUSE = 8, - SCF_BUTTON_FASTFORWARD = 9, - SCF_BUTTON_REWIND = 10, - SCF_BUTTON_STOP = 11, - SCF_BUTTON_BACK = 65280, // 0xFF00 -} SCF_BUTTON_IDS; - -// A header structure that is common amongst all Simple Content Format event structures -typedef struct tagSCF_EVENT_HEADER -{ - CONTENT_ID PreviousPage; - CONTENT_ID TargetPage; -} SCF_EVENT_HEADER, *PSCF_EVENT_HEADER; - -// The data passed with an SCF_EVENT_NAVIGATION ApplicationEvent -typedef struct tagSCF_NAVIGATION_EVENT -{ - CONTENT_ID PreviousPage; - CONTENT_ID TargetPage; - UINT32 Button; -} SCF_NAVIGATION_EVENT, *PSCF_NAVIGATION_EVENT; - -// The data passed with an SCF_EVENT_MENUACTION ApplicationEvent -typedef struct tagSCF_MENUACTION_EVENT -{ - CONTENT_ID PreviousPage; - CONTENT_ID TargetPage; - UINT32 Button; - UINT32 ItemId; -} SCF_MENUACTION_EVENT, *PSCF_MENUACTION_EVENT; - -// The data passed with an SCF_EVENT_CONTEXTMENU ApplicationEvent -typedef struct tagSCF_CONTEXTMENU_EVENT -{ - CONTENT_ID PreviousPage; - CONTENT_ID TargetPage; - UINT32 PreviousItemId; - CONTENT_ID MenuPage; - UINT32 MenuItemId; -} SCF_CONTEXTMENU_EVENT, *PSCF_CONTEXTMENU_EVENT; - -#endif // (_WIN32_WINNT >= 0x0600) - diff --git a/pub/ddk/windowssideshowclassextension.h b/pub/ddk/windowssideshowclassextension.h deleted file mode 100644 index 6064c1c..0000000 --- a/pub/ddk/windowssideshowclassextension.h +++ /dev/null @@ -1,896 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for windowssideshowclassextension.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __windowssideshowclassextension_h__ -#define __windowssideshowclassextension_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __ISideShowDriver_FWD_DEFINED__ -#define __ISideShowDriver_FWD_DEFINED__ -typedef interface ISideShowDriver ISideShowDriver; -#endif /* __ISideShowDriver_FWD_DEFINED__ */ - - -#ifndef __ISideShowClassExtension_FWD_DEFINED__ -#define __ISideShowClassExtension_FWD_DEFINED__ -typedef interface ISideShowClassExtension ISideShowClassExtension; -#endif /* __ISideShowClassExtension_FWD_DEFINED__ */ - - -#ifndef __ISideShowClassExtension2_FWD_DEFINED__ -#define __ISideShowClassExtension2_FWD_DEFINED__ -typedef interface ISideShowClassExtension2 ISideShowClassExtension2; -#endif /* __ISideShowClassExtension2_FWD_DEFINED__ */ - - -#ifndef __SideShowClassExtension_FWD_DEFINED__ -#define __SideShowClassExtension_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class SideShowClassExtension SideShowClassExtension; -#else -typedef struct SideShowClassExtension SideShowClassExtension; -#endif /* __cplusplus */ - -#endif /* __SideShowClassExtension_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "propidl.h" -#include "wudfddi.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_windowssideshowclassextension_0000_0000 */ -/* [local] */ - -#if (_WIN32_WINNT >= 0x0600) // Windows Vista and later -typedef struct _SIDESHOW_TIME_ZONE_INFORMATION - { - LONG Bias; - WCHAR StandardName[ 32 ]; - SYSTEMTIME StandardDate; - LONG StandardBias; - WCHAR DaylightName[ 32 ]; - SYSTEMTIME DaylightDate; - LONG DaylightBias; - } SIDESHOW_TIME_ZONE_INFORMATION; - -typedef -enum tagUSER_STATE - { AVAILABLE = 0, - UNAVAILABLE = 1 - } USER_STATE; - -typedef GUID APPLICATION_ID; - -typedef GUID ENDPOINT_ID; - -typedef LPWSTR DEVICE_ID; - -typedef REFGUID REFAPPLICATION_ID; - -typedef REFGUID REFENDPOINT_ID; - -typedef ENDPOINT_ID *PENDPOINT_ID; - -typedef APPLICATION_ID *PAPPLICATION_ID; - -typedef DEVICE_ID *PDEVICE_ID; - -typedef unsigned long CONTENT_ID; - -typedef CONTENT_ID *PCONTENT_ID; - -typedef unsigned long NOTIFICATION_ID; - -typedef NOTIFICATION_ID *PNOTIFICATION_ID; - - - -extern RPC_IF_HANDLE __MIDL_itf_windowssideshowclassextension_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_windowssideshowclassextension_0000_0000_v0_0_s_ifspec; - -#ifndef __ISideShowDriver_INTERFACE_DEFINED__ -#define __ISideShowDriver_INTERFACE_DEFINED__ - -/* interface ISideShowDriver */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_ISideShowDriver; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("2082260d-0e28-4c57-b5c2-67fa091daa91") - ISideShowDriver : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE OnGetDeviceName( - /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppwszName) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnGetDeviceManufacturer( - /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppwszManufacturer) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnGetDeviceFirmwareVersion( - /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppwszVersion) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnSetTime( - /* [in] */ const FILETIME FileTime) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnSetTimeZone( - /* [in] */ __RPC__in const SIDESHOW_TIME_ZONE_INFORMATION *pTimeZoneInformation) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnSetCurrentUser( - /* [in] */ __RPC__in const SID *pUserSid) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnGetCurrentUser( - /* [out] */ __RPC__deref_out_opt SID **ppUserSid) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnSetUserState( - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ const USER_STATE state) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnSetShortDateFormat( - /* [in] */ __RPC__in const SID *pUserSid, - /* [string][in] */ __RPC__in_string LPCWSTR pwszDateFormat) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnSetLongDateFormat( - /* [in] */ __RPC__in const SID *pUserSid, - /* [string][in] */ __RPC__in_string LPCWSTR pwszDateFormat) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnSetShortTimeFormat( - /* [in] */ __RPC__in const SID *pUserSid, - /* [string][in] */ __RPC__in_string LPCWSTR pwszTimeFormat) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnSetLongTimeFormat( - /* [in] */ __RPC__in const SID *pUserSid, - /* [string][in] */ __RPC__in_string LPCWSTR pwszTimeFormat) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnSetLanguage( - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in LPCWSTR pwszLanguage) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnGetDeviceEndpoints( - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pcEndpoints) ENDPOINT_ID **rgEndpoints, - /* [out] */ __RPC__out DWORD *pcEndpoints) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnGetDeviceCapabilities( - /* [in] */ __RPC__in const PROPERTYKEY *pKey, - /* [out] */ __RPC__out PROPVARIANT *pvValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnGetPreEnabledApplications( - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pcApplications) APPLICATION_ID **ppApplicationIds, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pcApplications) ENDPOINT_ID **ppEndpointIds, - /* [out] */ __RPC__out DWORD *pcApplications) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnSetApplicationOrder( - /* [size_is][in] */ __RPC__in_ecount_full(cApplicationIds) const APPLICATION_ID *pApplicationIds, - /* [in] */ const DWORD cApplicationIds) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnGetApplicationOrder( - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pcApplicationIds) APPLICATION_ID **ppApplicationIds, - /* [out] */ __RPC__out DWORD *pcApplicationIds) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnAddApplication( - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId, - /* [in] */ __RPC__in REFENDPOINT_ID EndPointId, - /* [string][in] */ __RPC__in_string LPCWSTR pcwszName, - /* [in] */ const DWORD dwCachePolicy, - /* [in] */ const DWORD dwOnlineOnly, - /* [size_is][in] */ __RPC__in_ecount_full(cbLargeIcon) const unsigned char *pbLargeIcon, - /* [in] */ const DWORD cbLargeIcon, - /* [size_is][in] */ __RPC__in_ecount_full(cbMediumIcon) const unsigned char *pbMediumIcon, - /* [in] */ const DWORD cbMediumIcon, - /* [size_is][in] */ __RPC__in_ecount_full(cbSmallIcon) const unsigned char *pbSmallIcon, - /* [in] */ const DWORD cbSmallIcon) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnRemoveApplication( - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnRemoveAllApplications( - /* [in] */ __RPC__in const SID *pUserSid) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnAddContent( - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId, - /* [in] */ __RPC__in REFENDPOINT_ID EndpointId, - /* [in] */ const CONTENT_ID ContentId, - /* [size_is][in] */ __RPC__in_ecount_full(cbData) const unsigned char *pData, - /* [in] */ const DWORD cbData) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnRemoveContent( - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId, - /* [in] */ __RPC__in REFENDPOINT_ID EndpointId, - /* [in] */ const CONTENT_ID ContentId) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnRemoveAllContent( - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId, - /* [in] */ __RPC__in REFENDPOINT_ID EndpointId) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnAddNotification( - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId, - /* [in] */ const NOTIFICATION_ID NotificationId, - /* [in] */ const FILETIME ftExpiration, - /* [string][in] */ __RPC__in_string LPCWSTR pcwszTitle, - /* [string][in] */ __RPC__in_string LPCWSTR pcwszMessage, - /* [size_is][in] */ __RPC__in_ecount_full(cbImage) const unsigned char *pbImage, - /* [in] */ const DWORD cbImage) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnRemoveNotification( - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId, - /* [in] */ const NOTIFICATION_ID NotificationId) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnRemoveAllNotifications( - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnSetNotificationsEnabled( - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ const BOOL fIsEnabled) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnProcessWpdMessage( - /* [in] */ __RPC__in_opt IUnknown *pPortableDeviceValuesParams, - /* [in] */ __RPC__in_opt IUnknown *pPortableDeviceValuesResults) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISideShowDriverVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISideShowDriver * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISideShowDriver * This); - - HRESULT ( STDMETHODCALLTYPE *OnGetDeviceName )( - __RPC__in ISideShowDriver * This, - /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppwszName); - - HRESULT ( STDMETHODCALLTYPE *OnGetDeviceManufacturer )( - __RPC__in ISideShowDriver * This, - /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppwszManufacturer); - - HRESULT ( STDMETHODCALLTYPE *OnGetDeviceFirmwareVersion )( - __RPC__in ISideShowDriver * This, - /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppwszVersion); - - HRESULT ( STDMETHODCALLTYPE *OnSetTime )( - __RPC__in ISideShowDriver * This, - /* [in] */ const FILETIME FileTime); - - HRESULT ( STDMETHODCALLTYPE *OnSetTimeZone )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SIDESHOW_TIME_ZONE_INFORMATION *pTimeZoneInformation); - - HRESULT ( STDMETHODCALLTYPE *OnSetCurrentUser )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid); - - HRESULT ( STDMETHODCALLTYPE *OnGetCurrentUser )( - __RPC__in ISideShowDriver * This, - /* [out] */ __RPC__deref_out_opt SID **ppUserSid); - - HRESULT ( STDMETHODCALLTYPE *OnSetUserState )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ const USER_STATE state); - - HRESULT ( STDMETHODCALLTYPE *OnSetShortDateFormat )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [string][in] */ __RPC__in_string LPCWSTR pwszDateFormat); - - HRESULT ( STDMETHODCALLTYPE *OnSetLongDateFormat )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [string][in] */ __RPC__in_string LPCWSTR pwszDateFormat); - - HRESULT ( STDMETHODCALLTYPE *OnSetShortTimeFormat )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [string][in] */ __RPC__in_string LPCWSTR pwszTimeFormat); - - HRESULT ( STDMETHODCALLTYPE *OnSetLongTimeFormat )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [string][in] */ __RPC__in_string LPCWSTR pwszTimeFormat); - - HRESULT ( STDMETHODCALLTYPE *OnSetLanguage )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in LPCWSTR pwszLanguage); - - HRESULT ( STDMETHODCALLTYPE *OnGetDeviceEndpoints )( - __RPC__in ISideShowDriver * This, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pcEndpoints) ENDPOINT_ID **rgEndpoints, - /* [out] */ __RPC__out DWORD *pcEndpoints); - - HRESULT ( STDMETHODCALLTYPE *OnGetDeviceCapabilities )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const PROPERTYKEY *pKey, - /* [out] */ __RPC__out PROPVARIANT *pvValue); - - HRESULT ( STDMETHODCALLTYPE *OnGetPreEnabledApplications )( - __RPC__in ISideShowDriver * This, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pcApplications) APPLICATION_ID **ppApplicationIds, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pcApplications) ENDPOINT_ID **ppEndpointIds, - /* [out] */ __RPC__out DWORD *pcApplications); - - HRESULT ( STDMETHODCALLTYPE *OnSetApplicationOrder )( - __RPC__in ISideShowDriver * This, - /* [size_is][in] */ __RPC__in_ecount_full(cApplicationIds) const APPLICATION_ID *pApplicationIds, - /* [in] */ const DWORD cApplicationIds); - - HRESULT ( STDMETHODCALLTYPE *OnGetApplicationOrder )( - __RPC__in ISideShowDriver * This, - /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*pcApplicationIds) APPLICATION_ID **ppApplicationIds, - /* [out] */ __RPC__out DWORD *pcApplicationIds); - - HRESULT ( STDMETHODCALLTYPE *OnAddApplication )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId, - /* [in] */ __RPC__in REFENDPOINT_ID EndPointId, - /* [string][in] */ __RPC__in_string LPCWSTR pcwszName, - /* [in] */ const DWORD dwCachePolicy, - /* [in] */ const DWORD dwOnlineOnly, - /* [size_is][in] */ __RPC__in_ecount_full(cbLargeIcon) const unsigned char *pbLargeIcon, - /* [in] */ const DWORD cbLargeIcon, - /* [size_is][in] */ __RPC__in_ecount_full(cbMediumIcon) const unsigned char *pbMediumIcon, - /* [in] */ const DWORD cbMediumIcon, - /* [size_is][in] */ __RPC__in_ecount_full(cbSmallIcon) const unsigned char *pbSmallIcon, - /* [in] */ const DWORD cbSmallIcon); - - HRESULT ( STDMETHODCALLTYPE *OnRemoveApplication )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId); - - HRESULT ( STDMETHODCALLTYPE *OnRemoveAllApplications )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid); - - HRESULT ( STDMETHODCALLTYPE *OnAddContent )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId, - /* [in] */ __RPC__in REFENDPOINT_ID EndpointId, - /* [in] */ const CONTENT_ID ContentId, - /* [size_is][in] */ __RPC__in_ecount_full(cbData) const unsigned char *pData, - /* [in] */ const DWORD cbData); - - HRESULT ( STDMETHODCALLTYPE *OnRemoveContent )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId, - /* [in] */ __RPC__in REFENDPOINT_ID EndpointId, - /* [in] */ const CONTENT_ID ContentId); - - HRESULT ( STDMETHODCALLTYPE *OnRemoveAllContent )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId, - /* [in] */ __RPC__in REFENDPOINT_ID EndpointId); - - HRESULT ( STDMETHODCALLTYPE *OnAddNotification )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId, - /* [in] */ const NOTIFICATION_ID NotificationId, - /* [in] */ const FILETIME ftExpiration, - /* [string][in] */ __RPC__in_string LPCWSTR pcwszTitle, - /* [string][in] */ __RPC__in_string LPCWSTR pcwszMessage, - /* [size_is][in] */ __RPC__in_ecount_full(cbImage) const unsigned char *pbImage, - /* [in] */ const DWORD cbImage); - - HRESULT ( STDMETHODCALLTYPE *OnRemoveNotification )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId, - /* [in] */ const NOTIFICATION_ID NotificationId); - - HRESULT ( STDMETHODCALLTYPE *OnRemoveAllNotifications )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ __RPC__in REFAPPLICATION_ID ApplicationId); - - HRESULT ( STDMETHODCALLTYPE *OnSetNotificationsEnabled )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in const SID *pUserSid, - /* [in] */ const BOOL fIsEnabled); - - HRESULT ( STDMETHODCALLTYPE *OnProcessWpdMessage )( - __RPC__in ISideShowDriver * This, - /* [in] */ __RPC__in_opt IUnknown *pPortableDeviceValuesParams, - /* [in] */ __RPC__in_opt IUnknown *pPortableDeviceValuesResults); - - END_INTERFACE - } ISideShowDriverVtbl; - - interface ISideShowDriver - { - CONST_VTBL struct ISideShowDriverVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISideShowDriver_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISideShowDriver_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISideShowDriver_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISideShowDriver_OnGetDeviceName(This,ppwszName) \ - ( (This)->lpVtbl -> OnGetDeviceName(This,ppwszName) ) - -#define ISideShowDriver_OnGetDeviceManufacturer(This,ppwszManufacturer) \ - ( (This)->lpVtbl -> OnGetDeviceManufacturer(This,ppwszManufacturer) ) - -#define ISideShowDriver_OnGetDeviceFirmwareVersion(This,ppwszVersion) \ - ( (This)->lpVtbl -> OnGetDeviceFirmwareVersion(This,ppwszVersion) ) - -#define ISideShowDriver_OnSetTime(This,FileTime) \ - ( (This)->lpVtbl -> OnSetTime(This,FileTime) ) - -#define ISideShowDriver_OnSetTimeZone(This,pTimeZoneInformation) \ - ( (This)->lpVtbl -> OnSetTimeZone(This,pTimeZoneInformation) ) - -#define ISideShowDriver_OnSetCurrentUser(This,pUserSid) \ - ( (This)->lpVtbl -> OnSetCurrentUser(This,pUserSid) ) - -#define ISideShowDriver_OnGetCurrentUser(This,ppUserSid) \ - ( (This)->lpVtbl -> OnGetCurrentUser(This,ppUserSid) ) - -#define ISideShowDriver_OnSetUserState(This,pUserSid,state) \ - ( (This)->lpVtbl -> OnSetUserState(This,pUserSid,state) ) - -#define ISideShowDriver_OnSetShortDateFormat(This,pUserSid,pwszDateFormat) \ - ( (This)->lpVtbl -> OnSetShortDateFormat(This,pUserSid,pwszDateFormat) ) - -#define ISideShowDriver_OnSetLongDateFormat(This,pUserSid,pwszDateFormat) \ - ( (This)->lpVtbl -> OnSetLongDateFormat(This,pUserSid,pwszDateFormat) ) - -#define ISideShowDriver_OnSetShortTimeFormat(This,pUserSid,pwszTimeFormat) \ - ( (This)->lpVtbl -> OnSetShortTimeFormat(This,pUserSid,pwszTimeFormat) ) - -#define ISideShowDriver_OnSetLongTimeFormat(This,pUserSid,pwszTimeFormat) \ - ( (This)->lpVtbl -> OnSetLongTimeFormat(This,pUserSid,pwszTimeFormat) ) - -#define ISideShowDriver_OnSetLanguage(This,pUserSid,pwszLanguage) \ - ( (This)->lpVtbl -> OnSetLanguage(This,pUserSid,pwszLanguage) ) - -#define ISideShowDriver_OnGetDeviceEndpoints(This,rgEndpoints,pcEndpoints) \ - ( (This)->lpVtbl -> OnGetDeviceEndpoints(This,rgEndpoints,pcEndpoints) ) - -#define ISideShowDriver_OnGetDeviceCapabilities(This,pKey,pvValue) \ - ( (This)->lpVtbl -> OnGetDeviceCapabilities(This,pKey,pvValue) ) - -#define ISideShowDriver_OnGetPreEnabledApplications(This,ppApplicationIds,ppEndpointIds,pcApplications) \ - ( (This)->lpVtbl -> OnGetPreEnabledApplications(This,ppApplicationIds,ppEndpointIds,pcApplications) ) - -#define ISideShowDriver_OnSetApplicationOrder(This,pApplicationIds,cApplicationIds) \ - ( (This)->lpVtbl -> OnSetApplicationOrder(This,pApplicationIds,cApplicationIds) ) - -#define ISideShowDriver_OnGetApplicationOrder(This,ppApplicationIds,pcApplicationIds) \ - ( (This)->lpVtbl -> OnGetApplicationOrder(This,ppApplicationIds,pcApplicationIds) ) - -#define ISideShowDriver_OnAddApplication(This,pUserSid,ApplicationId,EndPointId,pcwszName,dwCachePolicy,dwOnlineOnly,pbLargeIcon,cbLargeIcon,pbMediumIcon,cbMediumIcon,pbSmallIcon,cbSmallIcon) \ - ( (This)->lpVtbl -> OnAddApplication(This,pUserSid,ApplicationId,EndPointId,pcwszName,dwCachePolicy,dwOnlineOnly,pbLargeIcon,cbLargeIcon,pbMediumIcon,cbMediumIcon,pbSmallIcon,cbSmallIcon) ) - -#define ISideShowDriver_OnRemoveApplication(This,pUserSid,ApplicationId) \ - ( (This)->lpVtbl -> OnRemoveApplication(This,pUserSid,ApplicationId) ) - -#define ISideShowDriver_OnRemoveAllApplications(This,pUserSid) \ - ( (This)->lpVtbl -> OnRemoveAllApplications(This,pUserSid) ) - -#define ISideShowDriver_OnAddContent(This,pUserSid,ApplicationId,EndpointId,ContentId,pData,cbData) \ - ( (This)->lpVtbl -> OnAddContent(This,pUserSid,ApplicationId,EndpointId,ContentId,pData,cbData) ) - -#define ISideShowDriver_OnRemoveContent(This,pUserSid,ApplicationId,EndpointId,ContentId) \ - ( (This)->lpVtbl -> OnRemoveContent(This,pUserSid,ApplicationId,EndpointId,ContentId) ) - -#define ISideShowDriver_OnRemoveAllContent(This,pUserSid,ApplicationId,EndpointId) \ - ( (This)->lpVtbl -> OnRemoveAllContent(This,pUserSid,ApplicationId,EndpointId) ) - -#define ISideShowDriver_OnAddNotification(This,pUserSid,ApplicationId,NotificationId,ftExpiration,pcwszTitle,pcwszMessage,pbImage,cbImage) \ - ( (This)->lpVtbl -> OnAddNotification(This,pUserSid,ApplicationId,NotificationId,ftExpiration,pcwszTitle,pcwszMessage,pbImage,cbImage) ) - -#define ISideShowDriver_OnRemoveNotification(This,pUserSid,ApplicationId,NotificationId) \ - ( (This)->lpVtbl -> OnRemoveNotification(This,pUserSid,ApplicationId,NotificationId) ) - -#define ISideShowDriver_OnRemoveAllNotifications(This,pUserSid,ApplicationId) \ - ( (This)->lpVtbl -> OnRemoveAllNotifications(This,pUserSid,ApplicationId) ) - -#define ISideShowDriver_OnSetNotificationsEnabled(This,pUserSid,fIsEnabled) \ - ( (This)->lpVtbl -> OnSetNotificationsEnabled(This,pUserSid,fIsEnabled) ) - -#define ISideShowDriver_OnProcessWpdMessage(This,pPortableDeviceValuesParams,pPortableDeviceValuesResults) \ - ( (This)->lpVtbl -> OnProcessWpdMessage(This,pPortableDeviceValuesParams,pPortableDeviceValuesResults) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISideShowDriver_INTERFACE_DEFINED__ */ - - -#ifndef __ISideShowClassExtension_INTERFACE_DEFINED__ -#define __ISideShowClassExtension_INTERFACE_DEFINED__ - -/* interface ISideShowClassExtension */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_ISideShowClassExtension; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("27E78451-41C1-47fd-A50D-4D3E97D35B30") - ISideShowClassExtension : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Initialize( - /* [in] */ __RPC__in_opt IUnknown *pWdfDeviceUnknown, - /* [in] */ __RPC__in_opt IUnknown *pSideShowDriverUnknown) = 0; - - virtual HRESULT STDMETHODCALLTYPE Uninitialize( - /* [in] */ __RPC__in_opt IUnknown *pWdfDeviceUnknown) = 0; - - virtual HRESULT STDMETHODCALLTYPE OnProcessIoControl( - /* [in] */ __RPC__in_opt IWDFIoQueue *pWdfQueue, - /* [in] */ __RPC__in_opt IWDFIoRequest *pWdfRequest, - /* [in] */ ULONG ControlCode, - /* [in] */ SIZE_T InputBufferSizeInBytes, - /* [in] */ SIZE_T OutputBufferSizeInBytes, - /* [out] */ __RPC__out DWORD *pcbWritten) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISideShowClassExtensionVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISideShowClassExtension * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISideShowClassExtension * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISideShowClassExtension * This); - - HRESULT ( STDMETHODCALLTYPE *Initialize )( - __RPC__in ISideShowClassExtension * This, - /* [in] */ __RPC__in_opt IUnknown *pWdfDeviceUnknown, - /* [in] */ __RPC__in_opt IUnknown *pSideShowDriverUnknown); - - HRESULT ( STDMETHODCALLTYPE *Uninitialize )( - __RPC__in ISideShowClassExtension * This, - /* [in] */ __RPC__in_opt IUnknown *pWdfDeviceUnknown); - - HRESULT ( STDMETHODCALLTYPE *OnProcessIoControl )( - __RPC__in ISideShowClassExtension * This, - /* [in] */ __RPC__in_opt IWDFIoQueue *pWdfQueue, - /* [in] */ __RPC__in_opt IWDFIoRequest *pWdfRequest, - /* [in] */ ULONG ControlCode, - /* [in] */ SIZE_T InputBufferSizeInBytes, - /* [in] */ SIZE_T OutputBufferSizeInBytes, - /* [out] */ __RPC__out DWORD *pcbWritten); - - END_INTERFACE - } ISideShowClassExtensionVtbl; - - interface ISideShowClassExtension - { - CONST_VTBL struct ISideShowClassExtensionVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISideShowClassExtension_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISideShowClassExtension_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISideShowClassExtension_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISideShowClassExtension_Initialize(This,pWdfDeviceUnknown,pSideShowDriverUnknown) \ - ( (This)->lpVtbl -> Initialize(This,pWdfDeviceUnknown,pSideShowDriverUnknown) ) - -#define ISideShowClassExtension_Uninitialize(This,pWdfDeviceUnknown) \ - ( (This)->lpVtbl -> Uninitialize(This,pWdfDeviceUnknown) ) - -#define ISideShowClassExtension_OnProcessIoControl(This,pWdfQueue,pWdfRequest,ControlCode,InputBufferSizeInBytes,OutputBufferSizeInBytes,pcbWritten) \ - ( (This)->lpVtbl -> OnProcessIoControl(This,pWdfQueue,pWdfRequest,ControlCode,InputBufferSizeInBytes,OutputBufferSizeInBytes,pcbWritten) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISideShowClassExtension_INTERFACE_DEFINED__ */ - - -#ifndef __ISideShowClassExtension2_INTERFACE_DEFINED__ -#define __ISideShowClassExtension2_INTERFACE_DEFINED__ - -/* interface ISideShowClassExtension2 */ -/* [unique][helpstring][uuid][object] */ - - -EXTERN_C const IID IID_ISideShowClassExtension2; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1A6C8124-03E3-4A9A-AFD3-CEDD39E426B5") - ISideShowClassExtension2 : public ISideShowClassExtension - { - public: - virtual HRESULT STDMETHODCALLTYPE InitializeAsync( - /* [in] */ __RPC__in_opt IUnknown *pWdfDeviceUnknown, - /* [in] */ __RPC__in_opt IUnknown *pSideShowDriverUnknown) = 0; - - virtual HRESULT STDMETHODCALLTYPE PostEvent( - /* [in] */ __RPC__in REFGUID in_EventGuid, - /* [full][in] */ __RPC__in_opt SID *const in_pSid, - /* [full][in] */ __RPC__in_opt BYTE *const in_pbEventData, - /* [in] */ const DWORD in_cbEventData) = 0; - - virtual HRESULT STDMETHODCALLTYPE CleanupFile( - /* [in] */ __RPC__in_opt IWDFFile *pWdfFile) = 0; - - }; - -#else /* C style interface */ - - typedef struct ISideShowClassExtension2Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in ISideShowClassExtension2 * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in ISideShowClassExtension2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in ISideShowClassExtension2 * This); - - HRESULT ( STDMETHODCALLTYPE *Initialize )( - __RPC__in ISideShowClassExtension2 * This, - /* [in] */ __RPC__in_opt IUnknown *pWdfDeviceUnknown, - /* [in] */ __RPC__in_opt IUnknown *pSideShowDriverUnknown); - - HRESULT ( STDMETHODCALLTYPE *Uninitialize )( - __RPC__in ISideShowClassExtension2 * This, - /* [in] */ __RPC__in_opt IUnknown *pWdfDeviceUnknown); - - HRESULT ( STDMETHODCALLTYPE *OnProcessIoControl )( - __RPC__in ISideShowClassExtension2 * This, - /* [in] */ __RPC__in_opt IWDFIoQueue *pWdfQueue, - /* [in] */ __RPC__in_opt IWDFIoRequest *pWdfRequest, - /* [in] */ ULONG ControlCode, - /* [in] */ SIZE_T InputBufferSizeInBytes, - /* [in] */ SIZE_T OutputBufferSizeInBytes, - /* [out] */ __RPC__out DWORD *pcbWritten); - - HRESULT ( STDMETHODCALLTYPE *InitializeAsync )( - __RPC__in ISideShowClassExtension2 * This, - /* [in] */ __RPC__in_opt IUnknown *pWdfDeviceUnknown, - /* [in] */ __RPC__in_opt IUnknown *pSideShowDriverUnknown); - - HRESULT ( STDMETHODCALLTYPE *PostEvent )( - __RPC__in ISideShowClassExtension2 * This, - /* [in] */ __RPC__in REFGUID in_EventGuid, - /* [full][in] */ __RPC__in_opt SID *const in_pSid, - /* [full][in] */ __RPC__in_opt BYTE *const in_pbEventData, - /* [in] */ const DWORD in_cbEventData); - - HRESULT ( STDMETHODCALLTYPE *CleanupFile )( - __RPC__in ISideShowClassExtension2 * This, - /* [in] */ __RPC__in_opt IWDFFile *pWdfFile); - - END_INTERFACE - } ISideShowClassExtension2Vtbl; - - interface ISideShowClassExtension2 - { - CONST_VTBL struct ISideShowClassExtension2Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ISideShowClassExtension2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ISideShowClassExtension2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ISideShowClassExtension2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ISideShowClassExtension2_Initialize(This,pWdfDeviceUnknown,pSideShowDriverUnknown) \ - ( (This)->lpVtbl -> Initialize(This,pWdfDeviceUnknown,pSideShowDriverUnknown) ) - -#define ISideShowClassExtension2_Uninitialize(This,pWdfDeviceUnknown) \ - ( (This)->lpVtbl -> Uninitialize(This,pWdfDeviceUnknown) ) - -#define ISideShowClassExtension2_OnProcessIoControl(This,pWdfQueue,pWdfRequest,ControlCode,InputBufferSizeInBytes,OutputBufferSizeInBytes,pcbWritten) \ - ( (This)->lpVtbl -> OnProcessIoControl(This,pWdfQueue,pWdfRequest,ControlCode,InputBufferSizeInBytes,OutputBufferSizeInBytes,pcbWritten) ) - - -#define ISideShowClassExtension2_InitializeAsync(This,pWdfDeviceUnknown,pSideShowDriverUnknown) \ - ( (This)->lpVtbl -> InitializeAsync(This,pWdfDeviceUnknown,pSideShowDriverUnknown) ) - -#define ISideShowClassExtension2_PostEvent(This,in_EventGuid,in_pSid,in_pbEventData,in_cbEventData) \ - ( (This)->lpVtbl -> PostEvent(This,in_EventGuid,in_pSid,in_pbEventData,in_cbEventData) ) - -#define ISideShowClassExtension2_CleanupFile(This,pWdfFile) \ - ( (This)->lpVtbl -> CleanupFile(This,pWdfFile) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ISideShowClassExtension2_INTERFACE_DEFINED__ */ - - - -#ifndef __WindowsSideShowDriverLibrary_LIBRARY_DEFINED__ -#define __WindowsSideShowDriverLibrary_LIBRARY_DEFINED__ - -/* library WindowsSideShowDriverLibrary */ -/* [helpstring][version][uuid] */ - - -EXTERN_C const IID LIBID_WindowsSideShowDriverLibrary; - -EXTERN_C const CLSID CLSID_SideShowClassExtension; - -#ifdef __cplusplus - -class DECLSPEC_UUID("76EFD608-E0CE-4887-98E2-F931363C4BC5") -SideShowClassExtension; -#endif -#endif /* __WindowsSideShowDriverLibrary_LIBRARY_DEFINED__ */ - -/* interface __MIDL_itf_windowssideshowclassextension_0000_0003 */ -/* [local] */ - -#endif // (_WIN32_WINNT >= 0x0600) - - -extern RPC_IF_HANDLE __MIDL_itf_windowssideshowclassextension_0000_0003_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_windowssideshowclassextension_0000_0003_v0_0_s_ifspec; - -/* Additional Prototypes for ALL interfaces */ - -unsigned long __RPC_USER BSTR_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); -void __RPC_USER BSTR_UserFree( __RPC__in unsigned long *, __RPC__in BSTR * ); - -unsigned long __RPC_USER LPSAFEARRAY_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * ); -void __RPC_USER LPSAFEARRAY_UserFree( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * ); - -unsigned long __RPC_USER BSTR_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); -void __RPC_USER BSTR_UserFree64( __RPC__in unsigned long *, __RPC__in BSTR * ); - -unsigned long __RPC_USER LPSAFEARRAY_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * ); -unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * ); -void __RPC_USER LPSAFEARRAY_UserFree64( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * ); - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/ddk/windowssideshowdriverevents.h b/pub/ddk/windowssideshowdriverevents.h deleted file mode 100644 index 5f9b9ab..0000000 --- a/pub/ddk/windowssideshowdriverevents.h +++ /dev/null @@ -1,159 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (c) 2005 Microsoft Corporation. All rights -// reserved. -// -// -// Module: -// WindowsSideShowDriverEvents.h -// -// Description: -// This header contains structures and values related to events -// that can be sent by Windows SideShow drivers. -// -// Comments: -// They are currently intended to be used by the UMDF PnP eventing -// mechanism. -// -//----------------------------------------------------------------------- - -#pragma once -#if (_WIN32_WINNT >= 0x0600) // Windows Vista and later - - -// Version number used in new Windows 7 structs -const DWORD VERSION_1_WINDOWS_7 = 0; - - -////////////////////////////////////////////////////////////////////////////// -// -// This section defines the device functional interface GUIDs for -// Windows SideShow-compatible devices. -// -////////////////////////////////////////////////////////////////////////////// - -// {152E5811-FEB9-4B00-90F4-D32947AE1681} -DEFINE_GUID(GUID_DEVINTERFACE_SIDESHOW, 0x152e5811, 0xfeb9, 0x4b00, 0x90, 0xf4, 0xd3, 0x29, 0x47, 0xae, 0x16, 0x81); - -////////////////////////////////////////////////////////////////////////////// -// -// This section defines the GUIDs associated with the various event types. -// -////////////////////////////////////////////////////////////////////////////// - -// {5007FBA8-D313-439f-BEA2-A50201D3E9A8} -DEFINE_GUID(SIDESHOW_CONTENT_MISSING_EVENT, 0x5007fba8, 0xd313, 0x439f, 0xbe, 0xa2, 0xa5, 0x02, 0x01, 0xd3, 0xe9, 0xa8); - -// {4CB572FA-1D3B-49b3-A17A-2E6BFF052854} -DEFINE_GUID(SIDESHOW_APPLICATION_EVENT, 0x4cb572fa, 0x1d3b, 0x49b3, 0xa1, 0x7a, 0x2e, 0x6b, 0xff, 0x05, 0x28, 0x54); - -// {5009673c-3f7d-4c7e-9971-eaa2e91f1575} -DEFINE_GUID(SIDESHOW_USER_CHANGE_REQUEST_EVENT, 0x5009673c, 0x3f7d, 0x4c7e, 0x99, 0x71, 0xea, 0xa2, 0xe9, 0x1f, 0x15, 0x75); - -// {57813854-2FC1-411C-A59F-F24927608804} -DEFINE_GUID(SIDESHOW_NEW_EVENT_DATA_AVAILABLE, 0x57813854, 0x2FC1, 0x411C, 0xA5, 0x9F, 0xF2, 0x49, 0x27, 0x60, 0x88, 0x04); - - -////////////////////////////////////////////////////////////////////////////// -// -// This section defines the data associated with each event. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma pack(push, WindowsSideShowEvents, 1) - -////////////////////////////////////////////////////////////////////////////// -// -// This event is posted in response to Content Missing Event on the device. The -// struct contains the parameters that identify which device the event came -// from, which application/endpoint it is for, and the content id of the -// requested content. -// -//////////////////////////////////////////////////////////////////////////////// -typedef struct _CONTENT_MISSING_EVENT_DATA -{ - DWORD cbContentMissingEventData; - APPLICATION_ID ApplicationId; - ENDPOINT_ID EndpointId; - CONTENT_ID ContentId; -} CONTENT_MISSING_EVENT_DATA, *PCONTENT_MISSING_EVENT_DATA; - -////////////////////////////////////////////////////////////////////////////// -// -// This struct contains an event sent by an application on the device. -// The data is determined by the application and the event id. Since -// the data can be variable size, we store the size of the data and then -// the first byte of it. This struct should always be allocated as -// offsetof(APPLICATION_EVENT_DATA, bEventData) + , and this -// size should be set in cbApplicationEventData. The cbEventData -// member should contain just . -// -////////////////////////////////////////////////////////////////////////////// -typedef struct _APPLICATION_EVENT_DATA -{ - DWORD cbApplicationEventData; - APPLICATION_ID ApplicationId; - ENDPOINT_ID EndpointId; - DWORD dwEventId; - DWORD cbEventData; - BYTE bEventData[1]; -} APPLICATION_EVENT_DATA, *PAPPLICATION_EVENT_DATA; - - -////////////////////////////////////////////////////////////////////////////// -// -// This struct contains an event sent by the driver to the platform. Shared -// devices can use this event in their driver to signal to the platform that a -// a request for a new user to take ownership of the device has been made. The -// platform will set the current user on the device in response to the message, -// and upon success, will notify gadgets as if a device add had taken place. -// When posting this event to request that the active user of the device be -// changed, drivers should set wszUser to the SID of the user that is the new -// requested owner of the device. -// -////////////////////////////////////////////////////////////////////////////// -typedef struct _DEVICE_USER_CHANGE_EVENT_DATA -{ - DWORD cbDeviceUserChangeEventData; - WCHAR wszUser; // First character of user name (sid) string. -} DEVICE_USER_CHANGE_EVENT_DATA, *PDEVICE_USER_CHANGE_EVENT_DATA; - - -////////////////////////////////////////////////////////////////////////////// -// -// This struct contains an event sent by the driver to the platform. It tells the -// API that the device has new event data available to be retrieved -// It does not describe the type of events, nor the quantity of events available -// -////////////////////////////////////////////////////////////////////////////// -typedef struct _NEW_EVENT_DATA_AVAILABLE -{ - DWORD cbNewEventDataAvailable; // Size of this structure - DWORD dwVersion; // Always set to VERSION_1_WINDOWS_7 in Windows 7 -} NEW_EVENT_DATA_AVAILABLE, *PNEW_EVENT_DATA_AVAILABLE; - - -////////////////////////////////////////////////////////////////////////////// -// -// This is the header for all event data sent from a driver to the client API -// via Authorized Eventing -// This will usually be followed by another struct that is specific to the guidEventType. -// For Application Event GUID, the subsequent struct will be of type APPLICATION_EVENT_DATA -// For Content Missing GUID, the subsequent struct will be of type CONTENT_MISSING_EVENT_DATA -// Immediately following this struct is a buffer of cbEventDataSid bytes (can -// be 0). This buffer contains a SID (used for All User devices). -// -////////////////////////////////////////////////////////////////////////////// -typedef struct _EVENT_DATA_HEADER -{ - DWORD cbEventDataHeader; // Size of this structure - GUID guidEventType; // The GUID of the event type. This could be {"Application Event", "Content Missing", "Device Added", "Device Removed"} - DWORD dwVersion; // Always set to VERSION_1_WINDOWS_7 in Windows 7 - DWORD cbEventDataSid; -} EVENT_DATA_HEADER, *PEVENT_DATA_HEADER; - - -#pragma pack(pop, WindowsSideShowEvents) - -#endif // (_WIN32_WINNT >= 0x0600) - diff --git a/pub/ddk/winusb.h b/pub/ddk/winusb.h deleted file mode 100644 index c2ae859..0000000 --- a/pub/ddk/winusb.h +++ /dev/null @@ -1,253 +0,0 @@ -/*++ - -Copyright (c) 2002 Microsoft Corporation - -Module Name: - - wusb.h - -Abstract: - - Public interface to winusb.dll - -Environment: - - Kernel Mode Only - -Notes: - - 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) 2001 Microsoft Corporation. All Rights Reserved. - - -Revision History: - - 11/19/2002 : created - -Authors: - ---*/ - -#ifndef __WUSB_H__ -#define __WUSB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#if(NTDDI_VERSION >= NTDDI_WINXP) - -#include - - -typedef PVOID WINUSB_INTERFACE_HANDLE, *PWINUSB_INTERFACE_HANDLE; - - -#pragma pack(1) - -typedef struct _WINUSB_SETUP_PACKET { - UCHAR RequestType; - UCHAR Request; - USHORT Value; - USHORT Index; - USHORT Length; -} WINUSB_SETUP_PACKET, *PWINUSB_SETUP_PACKET; - -#pragma pack() - - - -BOOL __stdcall -WinUsb_Initialize( - __in HANDLE DeviceHandle, - __out PWINUSB_INTERFACE_HANDLE InterfaceHandle - ); - - -BOOL __stdcall -WinUsb_Free( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle - ); - - -BOOL __stdcall -WinUsb_GetAssociatedInterface( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in UCHAR AssociatedInterfaceIndex, - __out PWINUSB_INTERFACE_HANDLE AssociatedInterfaceHandle - ); - - - -BOOL __stdcall -WinUsb_GetDescriptor( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in UCHAR DescriptorType, - __in UCHAR Index, - __in USHORT LanguageID, - __out_bcount_part_opt(BufferLength, *LengthTransferred) PUCHAR Buffer, - __in ULONG BufferLength, - __out PULONG LengthTransferred - ); - -BOOL __stdcall -WinUsb_QueryInterfaceSettings( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in UCHAR AlternateInterfaceNumber, - __out PUSB_INTERFACE_DESCRIPTOR UsbAltInterfaceDescriptor - ); - -BOOL __stdcall -WinUsb_QueryDeviceInformation( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in ULONG InformationType, - __inout PULONG BufferLength, - __out_bcount(*BufferLength) PVOID Buffer - ); - -BOOL __stdcall -WinUsb_SetCurrentAlternateSetting( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in UCHAR SettingNumber - ); - -BOOL __stdcall -WinUsb_GetCurrentAlternateSetting( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __out PUCHAR SettingNumber - ); - - -BOOL __stdcall -WinUsb_QueryPipe( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in UCHAR AlternateInterfaceNumber, - __in UCHAR PipeIndex, - __out PWINUSB_PIPE_INFORMATION PipeInformation - ); - - -BOOL __stdcall -WinUsb_SetPipePolicy( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in UCHAR PipeID, - __in ULONG PolicyType, - __in ULONG ValueLength, - __in_bcount(ValueLength) PVOID Value - ); - -BOOL __stdcall -WinUsb_GetPipePolicy( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in UCHAR PipeID, - __in ULONG PolicyType, - __inout PULONG ValueLength, - __out_bcount(*ValueLength) PVOID Value - ); - -BOOL __stdcall -WinUsb_ReadPipe( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in UCHAR PipeID, - __out_bcount_part_opt(BufferLength,*LengthTransferred) PUCHAR Buffer, - __in ULONG BufferLength, - __out_opt PULONG LengthTransferred, - __in_opt LPOVERLAPPED Overlapped - ); - -BOOL __stdcall -WinUsb_WritePipe( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in UCHAR PipeID, - __in_bcount(BufferLength) PUCHAR Buffer, - __in ULONG BufferLength, - __out_opt PULONG LengthTransferred, - __in_opt LPOVERLAPPED Overlapped - ); - -BOOL __stdcall -WinUsb_ControlTransfer( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in WINUSB_SETUP_PACKET SetupPacket, - __out_bcount_part_opt(BufferLength, *LengthTransferred) PUCHAR Buffer, - __in ULONG BufferLength, - __out_opt PULONG LengthTransferred, - __in_opt LPOVERLAPPED Overlapped - ); - -BOOL __stdcall -WinUsb_ResetPipe( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in UCHAR PipeID - ); - -BOOL __stdcall -WinUsb_AbortPipe( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in UCHAR PipeID - ); - -BOOL __stdcall -WinUsb_FlushPipe( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in UCHAR PipeID - ); - -BOOL __stdcall -WinUsb_SetPowerPolicy( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in ULONG PolicyType, - __in ULONG ValueLength, - __in_bcount(ValueLength) PVOID Value - ); - -BOOL __stdcall -WinUsb_GetPowerPolicy( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in ULONG PolicyType, - __inout PULONG ValueLength, - __out_bcount(*ValueLength) PVOID Value - ); - -BOOL __stdcall -WinUsb_GetOverlappedResult( - __in WINUSB_INTERFACE_HANDLE InterfaceHandle, - __in LPOVERLAPPED lpOverlapped, - __out LPDWORD lpNumberOfBytesTransferred, - __in BOOL bWait - ); - - -PUSB_INTERFACE_DESCRIPTOR __stdcall -WinUsb_ParseConfigurationDescriptor( - __in PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, - __in PVOID StartPosition, - __in LONG InterfaceNumber, - __in LONG AlternateSetting, - __in LONG InterfaceClass, - __in LONG InterfaceSubClass, - __in LONG InterfaceProtocol - ); - -PUSB_COMMON_DESCRIPTOR __stdcall -WinUsb_ParseDescriptors( - __in_bcount(TotalLength) PVOID DescriptorBuffer, - __in ULONG TotalLength, - __in PVOID StartPosition, - __in LONG DescriptorType - ); - - -#endif // (NTDDI_VERSION >= NTDDI_WINXP) - -#ifdef __cplusplus -} -#endif - - -#endif //__WUSB_H__ - diff --git a/pub/ddk/winusbio.h b/pub/ddk/winusbio.h deleted file mode 100644 index 7fe771f..0000000 --- a/pub/ddk/winusbio.h +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - -Copyright (c) 2002 Microsoft Corporation - -Module Name: - - wusbio.h - -Abstract: - - Public header for WINUSB - -Environment: - - User and Kernel Mode - -Notes: - - 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) 2001 Microsoft Corporation. All Rights Reserved. - - -Revision History: - - 11/12/2002 : created - - -****************************************************************************/ - -#ifndef __WUSBIO_H__ -#define __WUSBIO_H__ - -#if(NTDDI_VERSION >= NTDDI_WINXP) - -#include - -// Pipe policy types -#define SHORT_PACKET_TERMINATE 0x01 -#define AUTO_CLEAR_STALL 0x02 -#define PIPE_TRANSFER_TIMEOUT 0x03 -#define IGNORE_SHORT_PACKETS 0x04 -#define ALLOW_PARTIAL_READS 0x05 -#define AUTO_FLUSH 0x06 -#define RAW_IO 0x07 -#define MAXIMUM_TRANSFER_SIZE 0x08 -#define RESET_PIPE_ON_RESUME 0x09 - -// Power policy types -// -// Add 0x80 for Power policy types in order to prevent overlap with -// Pipe policy types to prevent "accidentally" setting the wrong value for the -// wrong type. -// -#define AUTO_SUSPEND 0x81 -#define SUSPEND_DELAY 0x83 - -// Device Information types -#define DEVICE_SPEED 0x01 - -// Device Speeds -#define LowSpeed 0x01 -#define FullSpeed 0x02 -#define HighSpeed 0x03 - -// {DA812BFF-12C3-46a2-8E2B-DBD3B7834C43} -#include -DEFINE_GUID(WinUSB_TestGuid, 0xda812bff, 0x12c3, 0x46a2, 0x8e, 0x2b, 0xdb, 0xd3, 0xb7, 0x83, 0x4c, 0x43); - - -typedef struct _WINUSB_PIPE_INFORMATION { - USBD_PIPE_TYPE PipeType; - UCHAR PipeId; - USHORT MaximumPacketSize; - UCHAR Interval; -} WINUSB_PIPE_INFORMATION, *PWINUSB_PIPE_INFORMATION; - -#endif // (NTDDI_VERSION >= NTDDI_WINXP) - -#endif // __WUSBIO_H__ - - diff --git a/pub/ddk/wmicore.mof b/pub/ddk/wmicore.mof deleted file mode 100644 index 0437a9b..0000000 --- a/pub/ddk/wmicore.mof +++ /dev/null @@ -1,18173 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - wmicore.mof - -Abstract: - - This file defines all of the MOF classes "built in" to WMI. Typically - this will be for all data providers that are shipped by MS. The list - includes: - - WMI specific internal classes - Power Management - Processor Power Management - NDIS - SMBIOS Data - Keyboard - Mouse - Disk - IDE - Serial - Temperature via ACPI - Monitor - -Revision History: - ---*/ - -#pragma namespace("\\\\.\\root\\wmi") -#pragma classflags("forceupdate") -#pragma autorecover - -// -// Wmi internal classes - - -class WMIEvent : __ExtrinsicEvent -{ -}; - - - -[abstract] -class MS_WmiInternal -{ -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("This class supplies the binary mof information") : amended, - guid("{05901221-D566-11d1-B2F0-00A0C9062910}") -] -class MSWmi_MofData : MS_WmiInternal -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read - ] uint32 Unused1; - - [WmiDataId(2), - read - ] uint32 Unused2; - - - - [WmiDataId(3), - read - ] uint32 Size; - - [WmiDataId(4), - read - ] uint32 Unused4; - - - [WmiDataId(5), - WmiSizeIs("Size"), - read - ] uint8 BinaryMofData[]; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("This class supplies additional information about a data provider. Querying this class with an instance name returned from another class query will return additional information about the instance") : amended, - guid("{C7BF35D0-AADB-11d1-BF4A-00A0C9062910}") -] -class MSWmi_ProviderInfo : MS_WmiInternal -{ - [key, read] - string InstanceName; - [read] boolean Active; - - // CM_DRP_FRIENDLY_NAME - [WmiDataId(1), - read, - DisplayName("Friendly Name") : amended - ] string FriendlyName; - - // CM_DRP_DEVICEDESC - [WmiDataId(2), - read, - DisplayName("Description") : amended - ] string Description; - - // CM_DRP_LOCATION_INFORMATION - [WmiDataId(3), - read, - DisplayName("Location") : amended - ] string Location; - - // CM_DRP_MFG - [WmiDataId(4), - read, - DisplayName("Manufacturer") : amended - ] string Manufacturer; - - // CM_DRP_SERVICE - [WmiDataId(5), - read, - DisplayName("Service") : amended - ] string Service; - - // CONSIDER: adding device capabilities -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("This class supplies the PnPDeviceId for a specific device") : amended, - guid("{C7BF35D2-AADB-11d1-BF4A-00A0C9062910}"), - GuidName1("DATA_PROVIDER_PNPID_GUID") - ] -class MSWmi_PnPDeviceId : MS_WmiInternal -{ -// -// Note to driver developers: -// -// Support for this guid is required if properties in the wmi namespace -// are to be mapped into another namespace via the view provider. -// -// This guid is automatically supported by WMI if the following conditions -// are met: -// -// 1. The device registers with PDO instance names for all guids -// (ie, WMIREG_FLAG_PDO_INSTANCE_NAMES) -// -// If the driver cannot follow the rules above and WMI cannot support -// the guid automatically, then the driver can support it in its own -// driver code. - - - [key, read] - string InstanceName; - [read] boolean Active; - - // Pnp device id - [WmiDataId(1), - Description("PnP Device Id for the device. This property is useful for mapping from the wmi namespace to the cimv2 namespace classes using the view provider") : amended, - read, - DisplayName("PnP Device Id") : amended - ] string PnPDeviceId; -}; - - -[Dynamic, Provider("WMIProv"), - WMI, - Description("This class supplies the Instance names associated with a PnP Device Instance Id") : amended, - guid("{C7BF35D3-AADB-11d1-BF4A-00A0C9062910}"), - GuidName1("DATA_PROVIDER_PNPID_INSTANCE_NAMES_GUID") - ] -class MSWmi_PnPInstanceNames : MS_WmiInternal -{ -// -// Note to driver developers: -// -// Support for this guid is required if properties in the wmi namespace -// are to be mapped into another namespace via the view provider. -// -// This guid is automatically supported by WMI if the following conditions -// are met: -// -// 1. The device registers with PDO instance names for all guids -// (ie, WMIREG_FLAG_PDO_INSTANCE_NAMES) -// -// If the driver cannot follow the rules above and WMI cannot support -// the guid automatically, then the driver can support it in its own -// driver code. - - - [key, read] - string InstanceName; - [read] boolean Active; - - // Pnp device id - [WmiDataId(1), - Description("Count of instance names associated with this PnPId") : amended, - read, - DisplayName("Count") : amended - ] uint32 Count; - - // Instance names - [WmiDataId(2), - WmiSizeIs("Count"), - Description("Wmi Instance Names for the device. This property is useful for mapping from the wmi namespace to the cimv2 namespace classes using the view provider") : amended, - read, - DisplayName("Instance Name List") : amended - ] string InstanceNameList[]; -}; - -[WMI, - guid("{F8C60AED-EF8D-4f95-9EA8-F04318A00F30}") -] -class MSWmi_Guid -{ - [WmiDataId(1)] - uint8 Guid[16]; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - guid("{B48D49A1-E777-11d0-A50C-00A0C9062910}"), - description("This event reports whenever a guid is registered or unregistered") : amended -] -class MSWmi_GuidRegistrationInfo : WMIEvent -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - Description("Type of operation") : amended, - Values{"Registration Add", "Registration Remove", "Registration Update"} : amended, - ValueMap{"1", "2", "4"} - ] - uint32 Operation; - - [WmiDataId(2), - Description("Count of guids being registered, unregistered, or updated") : amended - ] - uint32 GuidCount; - - [WmiDataId(3), - WmiSizeIs("GuidCount"), - Description("List of guids") : amended - ] - MSWmi_Guid GuidList[]; -}; - - -// -// ACPI info classes -// -[Dynamic, Provider("WMIProv"), - WMI, - Description("ACPI Table data") : amended, - guid("{5DAF38AE-F6F8-4d90-8199-EBDE6800EC3B}") -] -class MSAcpiInfo -{ - [key, read] - string InstanceName; - [read] boolean Active; - - - [WmiDataId(1), - Description("Boot Architecture") : amended, - Values{"LEGACY_DEVICES", "I8042" } : amended, - ValueMap{"1", "2"} - ] - uint32 BootArchitecture; - - [WmiDataId(2), - Description("Systems Preferred Power Profile") : amended - ] - uint32 PreferredProfile; - - [WmiDataId(3), - BitValues{"this one bit flag indicates whether or not the WBINVD instruction works properly,if this bit is not set we can not use S2, S3 states, or C3 on MP machines", - "this flag indicates if wbinvd works EXCEPT that it does not invalidate the cache", - "this flag indicates that the C1 state is supported on all processors.", - "this one bit flag indicates whether support for the C2 state is restricted to uniprocessor machines", - "this bit indicates whether the PWR button is treated as a fix feature (0) or a generic feature (1)", - "SLEEP_BUTTON_GENERIC", - "this bit indicates whether the RTC wakeup status is reported in fix register space (0) or not (1)", - "RTC_WAKE_FROM_S4", - "This bit indicates whether the machine implements a 24 or 32 bit timer.", - "This bit indicates whether the machine supports docking", - "This bit indicates whether the machine supports reset", - "This bit indicates whether the machine case can be opened", - "This bit indicates whether the machine has no video" - } : amended, - BitMap{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}, - Description("Capabilities") : amended - ] - uint32 Capabilities; -}; - -// -// WHEA Management Interface Classes -// - -[abstract] -class WHEA -{ -}; - -[WMI, - Dynamic, - Provider("WMIProv"), - Locale("MS\\0x409"), - Description("WHEA Error Injection Interface") : amended, - guid("{e808ff73-2093-472a-a5cc-df24f031b035}") -] -class WHEAErrorInjectionMethods : WHEA -{ - [key, read] - string InstanceName; - - [read] boolean Active; - - [WmiMethodId(1), - Implemented, - DisplayName("Get Error Injection Capabilities") : amended, - HeaderName("GET_INJECTION_CAPABILITIES"), - Description("Returns information describing the platform's hardware error injection capabilities") : amended - ] - void GetErrorInjectionCapabilitiesRtn( - [out] uint32 Status, - [out] uint32 Capabilities - ); - - [WmiMethodId(2), - Implemented, - DisplayName("Inject Hardware Error") : amended, - HeaderName("INJECT_HARDWARE_ERROR"), - Description("Injects hardware Error") : amended - ] - void InjectErrorRtn( - [in] uint32 ErrorType, - [in] uint64 Parameter1, - [in] uint64 Parameter2, - [in] uint64 Parameter3, - [in] uint64 Parameter4, - [out] uint32 Status - ); -}; - -[WMI, - Dynamic, - Provider("WMIProv"), - Locale("MS\\0x409"), - Description("WHEA Error Source Interface") : amended, - guid("{91c3c007-185d-4d78-a751-bfcb31c2c64d}")] -class WHEAErrorSourceMethods : WHEA -{ - [key, read] string InstanceName; - [read] boolean Active; - - [WmiMethodId(1), - Implemented, - DisplayName("Get Error Sources") : amended, - HeaderName("GET_ALL_ERROR_SOURCES"), - Description("Returns an array of all hardware error sources") : amended - ] - void GetAllErrorSourcesRtn( - [out] uint32 Status, - [out] uint32 Count, - [out] uint32 Length, - [out, WmiSizeIs("Length")] uint8 ErrorSourceArray[] - ); - - [WmiMethodId(2), - Implemented, - DisplayName("Get Error Source Information") : amended, - HeaderName("GET_ERROR_SOURCE_INFO"), - Description("Returns information describing the specified hardware error source") : amended - ] - void GetErrorSourceInfoRtn( - [out] uint32 Status, - [in] uint32 ErrorSourceId, - [out] uint32 Length, - [out, WmiSizeIs("Length")] uint8 ErrorSourceInfo[] - ); - - [WmiMethodId(3), - Implemented, - DisplayName("Set Error Source Info") : amended, - HeaderName("SET_ERROR_SOURCE_INFO"), - Description("Updates the specified error source using the supplied information") : amended - ] - void SetErrorSourceInfoRtn( - [out] uint32 Status, - [in] uint32 Length, - [in, WmiSizeIs("Length")] uint8 ErrorSourceInfo[] - ); - - [WmiMethodId(4), - Implemented, - DisplayName("Enable Error Source") : amended, - HeaderName("ENABLE_ERROR_SOURCE"), - Description("Enables the specified error source") : amended - ] - void EnableErrorSourceRtn( - [out] uint32 Status, - [in] uint32 ErrorSourceId - ); - - [WmiMethodId(5), - Implemented, - DisplayName("Disable Error Source") : amended, - HeaderName("DISABLE_ERROR_SOURCE"), - Description("Disables the specified error source") : amended - ] - void DisableErrorSourceRtn( - [out] uint32 Status, - [in] uint32 ErrorSourceId - ); -}; - -// -// SMBIOS data classes -// -[abstract] -class MS_SmBios -{ -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Raw SMBIOS Tables") : amended, - guid("{8F680850-A584-11d1-BF38-00A0C9062910}") -] -class MSSmBios_RawSMBiosTables : MS_SmBios -{ - [key, read] - string InstanceName; - - [read] boolean Active; - - [WmiDataId(1), - read, - DisplayName("Used 20 Calling Method") : amended - ] boolean Used20CallingMethod; - - [WmiDataId(2), - read, - DisplayName("Smbios Major Version") : amended - ] uint8 SmbiosMajorVersion; - - [WmiDataId(3), - read, - DisplayName("Smbios Minor Version") : amended - ] uint8 SmbiosMinorVersion; - - [WmiDataId(4), - read, - DisplayName("Dmi Revision") : amended - ] uint8 DmiRevision; - - - [WmiDataId(5), - read, - DisplayName("Size") : amended - ] uint32 Size; - - [WmiDataId(6), - WmiSizeIs("Size"), - read, - DisplayName("SMBios Data") : amended - ] uint8 SMBiosData[]; - -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Raw SMBIOS Eventlog") : amended, - guid("{8F680851-A584-11d1-BF38-00A0C9062910}") -] -class MSSmBios_SMBiosEventlog : MS_SmBios -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read - ] uint16 LogTypeDescLength; - - [WmiDataId(2), - read - ] boolean LogHeaderDescExists; - - [WmiDataId(3), - read - ] uint8 Reserved; - - [WmiDataId(4), - read - ] uint16 LogAreaLength; - - [WmiDataId(5), - read - ] uint16 LogHeaderStart; - - [WmiDataId(6), - read - ] uint16 LogDataStart; - - [WmiDataId(7), - read - ] uint8 AccessMethod; - - - [WmiDataId(8), - read - ] uint8 LogStatus; - - - [WmiDataId(9), - read - ] uint32 LogChangeToken; - - [WmiDataId(10), - read - ] uint32 AccessMethodAddress; - - // - // LogHeaderFormat, NumberLogTypeDesc, LengthEachLogTypeDesc and - // ListLogTypeDesc are only valid if LogHeaderDescExists is TRUE. - // This means that SMBIOS is revision 2.1 - // - [WmiDataId(11), - read - ] uint8 LogHeaderFormat; - - [WmiDataId(12), - read - ] uint8 NumberLogTypeDesc; - - [WmiDataId(13), - read - ] uint8 LengthEachLogTypeDesc; - - [WmiDataId(14), - WmiSizeIs("LogTypeDescLength"), - read - ] uint8 ListLogTypeDesc[]; - - [WmiDataId(15), - WmiSizeIs("LogAreaLength"), - read - ] uint8 LogArea[]; - -}; - -[WMI, - guid("{8F680852-A584-11d1-BF38-00A0C9062910}"), - Description("SYSID UUID") : amended, - HeaderName("SYSID_UUID") -] -class MSSmBios_SysidUUID : MS_SmBios -{ - [WmiDataId(1)] - uint8 Uuid[16]; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("List of UUID SYSIDS") : amended, - guid("{8F680853-A584-11d1-BF38-00A0C9062910}"), - GuidName1("SYSID_UUID_DATA_GUID") -] -class MSSmBios_SysidUUIDList : MS_SmBios -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read - ] uint32 Count; - - [WmiDataId(2), - WmiSizeIs("Count"), - read - ] MSSmBios_SysidUUID List; - -}; - -[WMI, - guid("{8F680854-A584-11d1-BF38-00A0C9062910}"), - Description("SYSID 1394") : amended, - HeaderName("SYSID_1394") -] -class MSSmBios_Sysid1394 : MS_SmBios -{ - [WmiDataId(1) - ] - uint8 x1394[8]; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("List of 1394 SYSIDS") : amended, - guid("{8F680855-A584-11d1-BF38-00A0C9062910}"), - GuidName1("SYSID_1394_DATA_GUID") -] -class MSSmBios_Sysid1394List : MS_SmBios -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read - ] uint32 Count; - - [WmiDataId(2), - WmiSizeIs("Count"), - read - ] MSSmBios_Sysid1394 List; - -}; - -[abstract] -class MSMCAInfo -{ -}; - - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{39C14290-F036-4999-B8A1-B6F871FB329E}"), - Description("CMC handling switched from interrupt driver to polling") : amended -] -class MSMCAEvent_SwitchToCMCPolling : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - -}; - - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{D5C870CE-4ED0-4fdc-BB54-8B452C18797E}"), - Description("CPE handling switched from interrupt driver to polling") : amended -] -class MSMCAEvent_SwitchToCPEPolling : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; -}; - - -// -// Define the qualifiers used for the Type property of the MSMCAEvent classes -// The value of the property corresponds to the eventlog type as specified -// in iologmsg.h -// -#define EVENTLOG_MESSAGE_QUALIFIERS \ - Values{ \ - "MCA_WARNING_CACHE", \ - "MCA_ERROR_CACHE", \ - "MCA_WARNING_TLB", \ - "MCA_ERROR_TLB", \ - "MCA_WARNING_CPU_BUS", \ - "MCA_ERROR_CPU_BUS", \ - "MCA_WARNING_REGISTER_FILE", \ - "MCA_ERROR_REGISTER_FILE", \ - "MCA_WARNING_MAS", \ - "MCA_ERROR_MAS", \ - "MCA_WARNING_MEM_UNKNOWN", \ - "MCA_ERROR_MEM_UNKNOWN", \ - "MCA_WARNING_MEM_1_2", \ - "MCA_ERROR_MEM_1_2", \ - "MCA_WARNING_MEM_1_2_5", \ - "MCA_ERROR_MEM_1_2_5", \ - "MCA_WARNING_MEM_1_2_5_4", \ - "MCA_ERROR_MEM_1_2_5_4", \ - "MCA_WARNING_SYSTEM_EVENT", \ - "MCA_ERROR_SYSTEM_EVENT", \ - "MCA_WARNING_PCI_BUS_PARITY", \ - "MCA_ERROR_PCI_BUS_PARITY", \ - "MCA_WARNING_PCI_BUS_PARITY_NO_INFO", \ - "MCA_ERROR_PCI_BUS_PARITY_NO_INFO", \ - "MCA_WARNING_PCI_BUS_SERR", \ - "MCA_ERROR_PCI_BUS_SERR", \ - "MCA_WARNING_PCI_BUS_SERR_NO_INFO", \ - "MCA_ERROR_PCI_BUS_SERR_NO_INFO", \ - "MCA_WARNING_PCI_BUS_MASTER_ABORT", \ - "MCA_ERROR_PCI_BUS_MASTER_ABORT", \ - "MCA_WARNING_PCI_BUS_MASTER_ABORT_NO_INFO", \ - "MCA_ERROR_PCI_BUS_MASTER_ABORT_NO_INFO", \ - "MCA_WARNING_PCI_BUS_TIMEOUT", \ - "MCA_ERROR_PCI_BUS_TIMEOUT", \ - "MCA_WARNING_PCI_BUS_TIMEOUT_NO_INFO", \ - "MCA_ERROR_PCI_BUS_TIMEOUT_NO_INFO", \ - "MCA_WARNING_PCI_BUS_UNKNOWN", \ - "MCA_ERROR_PCI_BUS_UNKNOWN", \ - "MCA_WARNING_PCI_DEVICE", \ - "MCA_ERROR_PCI_DEVICE", \ - "MCA_WARNING_SMBIOS", \ - "MCA_ERROR_SMBIOS", \ - "MCA_WARNING_PLATFORM_SPECIFIC", \ - "MCA_ERROR_PLATFORM_SPECIFIC", \ - "MCA_WARNING_UNKNOWN", \ - "MCA_ERROR_UNKNOWN", \ - "MCA_WARNING_UNKNOWN_NO_CPU", \ - "MCA_ERROR_UNKNOWN_NO_CPU", \ - "MCA_WARNING_CMC_THRESHOLD_EXCEEDED", \ - "MCA_WARNING_CPE_THRESHOLD_EXCEEDED", \ - "MCA_WARNING_CPU_THERMAL_THROTTLED", \ - "MCA_INFO_CPU_THERMAL_THROTTLING_REMOVED", \ - "MCA_WARNING_CPU", \ - "MCA_ERROR_CPU", \ - "MCA_MEMORYHIERARCHY_ERROR", \ - "MCA_TLB_ERROR", \ - "MCA_BUS_ERROR", \ - "MCA_BUS_TIMEOUT_ERROR", \ - "MCA_INTERNALTIMER_ERROR", \ - "MCA_MICROCODE_ROM_PARITY_ERROR", \ - "MCA_EXTERNAL_ERROR", \ - "MCA_FRC_ERROR" \ - }, \ - ValueMap{ \ - "0x8005003C", \ - "0xC005003D", \ - "0x8005003E", \ - "0xC005003F", \ - "0x80050040", \ - "0xC0050041", \ - "0x80050042", \ - "0xC0050043", \ - "0x80050044", \ - "0xC0050045", \ - "0x80050046", \ - "0xC0050047", \ - "0x80050048", \ - "0xC0050049", \ - "0x8005004A", \ - "0xC005004B", \ - "0x8005004C", \ - "0xC005004D", \ - "0x8005004E", \ - "0xC005004F", \ - "0x80050050", \ - "0xC0050051", \ - "0x80050052", \ - "0xC0050053", \ - "0x80050054", \ - "0xC0050055", \ - "0x80050056", \ - "0xC0050057", \ - "0x80050058", \ - "0xC0050059", \ - "0x8005005A", \ - "0xC005005B", \ - "0x8005005C", \ - "0xC005005D", \ - "0x8005005E", \ - "0xC005005F", \ - "0x80050060", \ - "0xC0050061", \ - "0x80050062", \ - "0xC0050063", \ - "0x80050064", \ - "0xC0050065", \ - "0x80050066", \ - "0xC0050067", \ - "0x80050068", \ - "0xC0050069", \ - "0x8005006A", \ - "0xC005006B", \ - "0x8005006D", \ - "0x8005006E", \ - "0x8005006F", \ - "0x40050070", \ - "0x80050071", \ - "0xC0050072", \ - "0xC0050078", \ - "0xC0050079", \ - "0xC005007A", \ - "0xC005007B", \ - "0xC005007C", \ - "0xC005007D", \ - "0xC005007E", \ - "0xC005007F" \ - }, \ - Description("Type of eventlog message") : amended - -#define ERROR_SEVERITY_QUALIFIERS \ - Values{"Recoverable", "Fatal", "Correctable"}, \ - ValueMap{ "0", "1", "2" }, \ - Description("Severity of the error record") : amended - -#define TRANSACTION_TYPES \ - ValueMap { "0", "1", "2" }, \ - Values { "Instruction Cache", "Data Cache", "Generic" }, \ - Description("MCA transaction type") : amended - -#define MEMORY_HIERARCHY_LEVELS \ - ValueMap { "0", "1", "2", "3" }, \ - Values { "Level 0", \ - "Level 1", \ - "Level 2", \ - "Generic" }, \ - Description("MCA memory hierarchy level") : amended - -#define REQUEST_TYPES \ - ValueMap { "0", "1", "2", "3", "4", "5", "6", "7", "8" }, \ - Values { "Generic Error", \ - "Generic Read", \ - "Generic Write", \ - "Data Read", \ - "Data Write", \ - "Instruction Fetch", \ - "Prefetch", \ - "Injection", \ - "Snoop" }, \ - Description("MCA request type") : amended - -#define PARTICIPATION_VALUES \ - ValueMap { "0", "1", "2", "3" }, \ - Values { "Local Processor Originated Request", \ - "Local Processor Responded To Request", \ - "Local Processor Observed Error As Third Party", \ - "Generic" }, \ - Description("MCA processor participation description") : amended - -#define MEMORY_OR_IO \ - ValueMap { "0", "1", "2", "3" }, \ - Values { "Memory Access", "Reserved", "I/O", "Other transaction" }, \ - Description("Identifies the type of access that caused the error") : amended - -// -// NOTE: For all MCA events the first data items must be identical and -// match whay is in MSMCAEvent_Header. -// - -[WMI, - guid("{6381C27F-C8FA-4da7-8953-B86833736E15}"), - description("Header for all MSMCA events") : amended -] -class MSMCAEvent_Header -{ - [WmiDataId(1), - Description("Unique Id for the error record containing this error") : amended - ] - uint64 RecordId; - - [WmiDataId(2), - ERROR_SEVERITY_QUALIFIERS - ] - uint8 ErrorSeverity; - - [WmiDataId(3), - EVENTLOG_MESSAGE_QUALIFIERS - ] - uint32 Type; - - [WmiDataId(4), - Description("CPU that reported the error") : amended - ] - uint32 Cpu; - - [WmiDataId(5), - Description("Number of additional errors in the record") : amended - ] - uint32 AdditionalErrors; - - [WmiDataId(6), - Description("If zero then this event is not logged to system eventlog") : amended - ] - uint32 LogToEventlog; - -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{1ee17050-0039-40f7-9ead-14ad51612cb2}"), - Description("MCA Bus Error Event") : amended -] -class MSMCAEvent_BusError : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - - [WmiDataId(1), - Description("Unique Id for the error record containing this error") : amended - ] - uint64 RecordId; - - [WmiDataId(2), - ERROR_SEVERITY_QUALIFIERS - ] - uint8 ErrorSeverity; - - [WmiDataId(3), - EVENTLOG_MESSAGE_QUALIFIERS - ] - uint32 Type; - - [WmiDataId(4), - Description("CPU that reported the error") : amended - ] - uint32 Cpu; - - [WmiDataId(5), - Description("Number of additional errors in the record") : amended - ] - uint32 AdditionalErrors; - - [WmiDataId(6), - Description("If zero then this event is not logged to system eventlog") : amended - ] - uint32 LogToEventlog; - - [WmiDataId(7), - PARTICIPATION_VALUES - ] - uint32 Participation; - - [WmiDataId(8), - MEMORY_HIERARCHY_LEVELS - ] - uint32 MemoryHierarchyLevel; - - [WmiDataId(9), - REQUEST_TYPES - ] - uint32 RequestType; - - [WmiDataId(10), - MEMORY_OR_IO - ] - uint32 MemOrIo; - - [WmiDataId(11), - Description("The address at which the error occurred.") - ] - uint64 Address; - - [WmiDataId(12), - Description("Size of Raw Error Record") : amended - ] - uint32 Size; - - [WmiDataId(13), - WmiSizeIs("Size"), - Description("Raw Error Record") : amended - ] - uint8 RawRecord[]; -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{b161eeab-ac03-4c2b-ae7a-5a3768f70e85}"), - Description("MCA TLB Error Event") : amended -] -class MSMCAEvent_TLBError : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - - [WmiDataId(1), - Description("Unique Id for the error record containing this error") : amended - ] - uint64 RecordId; - - [WmiDataId(2), - ERROR_SEVERITY_QUALIFIERS - ] - uint8 ErrorSeverity; - - [WmiDataId(3), - EVENTLOG_MESSAGE_QUALIFIERS - ] - uint32 Type; - - [WmiDataId(4), - Description("CPU that reported the error") : amended - ] - uint32 Cpu; - - [WmiDataId(5), - Description("Number of additional errors in the record") : amended - ] - uint32 AdditionalErrors; - - [WmiDataId(6), - Description("If zero then this event is not logged to system eventlog") : amended - ] - uint32 LogToEventlog; - - [WmiDataId(7), - TRASACTION_TYPES - ] - uint32 TransactionType; - - [WmiDataId(8), - MEMORY_HIERARCHY_LEVELS - ] - uint32 MemoryHierarchyLevel; - - [WmiDataId(9), - Description("The address at which the error occurred.") - ] - uint64 Address; - - [WmiDataId(10), - Description("Size of Raw Error Record") : amended - ] - uint32 Size; - - [WmiDataId(11), - WmiSizeIs("Size"), - Description("Raw Error Record") : amended - ] - uint8 RawRecord[]; -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{cede75a0-a77f-452b-8f2f-541f926db0f9}"), - Description("MCA Memory Hierarchy Error Event") : amended -] -class MSMCAEvent_MemoryHierarchyError : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - - [WmiDataId(1), - Description("Unique Id for the error record containing this error") : amended - ] - uint64 RecordId; - - [WmiDataId(2), - ERROR_SEVERITY_QUALIFIERS - ] - uint8 ErrorSeverity; - - [WmiDataId(3), - EVENTLOG_MESSAGE_QUALIFIERS - ] - uint32 Type; - - [WmiDataId(4), - Description("CPU that reported the error") : amended - ] - uint32 Cpu; - - [WmiDataId(5), - Description("Number of additional errors in the record") : amended - ] - uint32 AdditionalErrors; - - [WmiDataId(6), - Description("If zero then this event is not logged to system eventlog") : amended - ] - uint32 LogToEventlog; - - [WmiDataId(7), - TRASACTION_TYPES - ] - uint32 TransactionType; - - [WmiDataId(8), - MEMORY_HIERARCHY_LEVELS - ] - uint32 MemoryHierarchyLevel; - - [WmiDataId(9), - REQUEST_TYPES - ] - uint32 RequestType; - - [WmiDataId(10), - Description("The address at which the error occurred.") - ] - uint64 Address; - - [WmiDataId(11), - Description("Size of Raw Error Record") : amended - ] - uint32 Size; - - [WmiDataId(12), - WmiSizeIs("Size"), - Description("Raw Error Record") : amended - ] - uint8 RawRecord[]; -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{5CE27CDE-D179-4c68-937F-A07B8CC2EA39}"), - Description("MCA CPU Error Event") : amended -] -class MSMCAEvent_CPUError : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - - [WmiDataId(1), - Description("Unique Id for the error record containing this error") : amended - ] - uint64 RecordId; - - [WmiDataId(2), - ERROR_SEVERITY_QUALIFIERS - ] - uint8 ErrorSeverity; - - [WmiDataId(3), - EVENTLOG_MESSAGE_QUALIFIERS - ] - uint32 Type; - - [WmiDataId(4), - Description("CPU that reported the error") : amended - ] - uint32 Cpu; - - [WmiDataId(5), - Description("Number of additional errors in the record") : amended - ] - uint32 AdditionalErrors; - - [WmiDataId(6), - Description("If zero then this event is not logged to system eventlog") : amended - ] - uint32 LogToEventlog; - - [WmiDataId(7), - Description("Error type of the major error in the section") : amended, - Values {"Cache", "TLB", "Bus", "Register File", "Microarchitecture"}, - ValueMap { "0", "1", "2", "3", "4"}, - DefineValues {"MCACpuCacheError", - "MCACpuTlbError", - "MCACpuBusError", - "MCACpuRegFileError", - "MCACpuMSError" } - ] - uint32 MajorErrorType; - - // - // This is valid for cache, tlb and microarchitectural structure errors - // - [WmiDataId(8), - Description("Level of cache, TLB or microarchitectural structure where error occurred (0 indicates first level)") : amended, - WmiMissingData(-1) - ] - uint32 Level; - - // - // This is valid for cache errors - // - [WmiDataId(9), - Values{ "Unknown or internal error", - "load", - "store", - "instruction fetch or instruction prefetch", - "data prefetch (both hardware and software)", - "snoop (coherency check)", - "cast out (explicit or implicit write-back of a cache line)", - "move in (cache line fill)" - } : amended, - ValueMap{"0", "1", "2", "3", "4", "5", "6", "7"}, - Description("Type of cache operation that caused the machine check") : amended, - WmiMissingData(-1) - ] - uint32 CacheOp; - - // - // This is valid for cache errors - // - [WmiDataId(10), - Description("Status of the cache line") : amended, - Values{"cache line is invalid", - "cache line is held shares", - "cache line is held exclusive", - "cache line is modified" - } : amended, - ValueMap{ "0", "1", "2", "3" }, - WmiMissingData(-1) - ] - uint32 CacheMesi; - - // - // This is valid for TLB errors - // - [WmiDataId(11), - Values{ "unknown", - "TLB access due to load instruction", - "TLB access due to store instruction", - "TLB access due to instruction fetch or instruction prefetch", - "TLB access due to data prefetch (both hardware and software)", - "TLB shoot down access", - "TLB probe instruction (probe, tpa)", - "move in (VHPT fill)" - } : amended, - ValueMap{"0", "1", "2", "3", "4", "5", "6", "7"}, - Description("Type of cache operation that caused the machine check") : amended, - WmiMissingData(-1) - ] - uint32 TLBOp; - - // - // This is valid for Bus errors - // - [WmiDataId(12), - Values{ "unknown", - "partial read", - "partial write", - "full line read", - "full line write", - "implicit or explicit write-back operation", - "snoop probe", - "incoming ptc.g", - "WC transactions" - } : amended, - ValueMap{"0", "1", "2", "3", "4", "5", "6", "7", "8"}, - Description("Type of Bus transaction that caused the machine check abort") : amended, - WmiMissingData(-1) - ] - uint32 BusType; - - // - // This is valid for Bus errors - // - [WmiDataId(13), - Description("Bus error severity. The encodings of error severity are platform specific") : amended, - WmiMissingData(-1) - ] - uint32 BusSev; - - // - // This is valid for RegFile errors - // - [WmiDataId(14), - Values{ "unknown/unclassified", - "General register (bank 1)", - "General register (bank 2)", - "Floating point register", - "Branch register", - "Predicate register", - "Application register", - "Control register", - "Region register", - "Protection key register", - "Data breakpoint register", - "Instruction breakpoint register", - "Performance monitor control register", - "Performance monitor data register" - } : amended, - ValueMap{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", - "10", "11", "12", "13"}, - Description("Register file identifier") : amended, - WmiMissingData(-1) - ] - uint32 RegFileId; - - // - // This is valid for RegFile errors - // - [WmiDataId(15), - Values{ "unknown", - "read", - "write" - } : amended, - ValueMap{"0", "1", "2" }, - Description("Identifies the operation that caused the machine check") : amended, - WmiMissingData(-1) - ] - uint32 RegFileOp; - - // - // This is valid for Microarchitectural structure errors - // - [WmiDataId(16), - Description("Structure identification. These bits identify the microarchitectural structure where the error occurred.") : amended, - WmiMissingData(-1) - ] - uint32 MSSid; - - [WmiDataId(17), - Values{ "unknown", - "read or load", - "write or store" - } : amended, - ValueMap{"0", "1", "2"}, - Description("Type of operation that caused the error") : amended, - WmiMissingData(-1) - ] - uint32 MSOp; - - // - // This is valid for Microarchitectural structure errors - // - [WmiDataId(18), - Values{ "unknown/unclassified" - } : amended, - ValueMap{"0"}, - Description("Identification of the array in the micro architectural structure where the error was generated") : amended, - WmiMissingData(-1) - ] - uint32 MSArrayId; - - // - // This is valid for Microarchitectural structure errors - // - [WmiDataId(19), - Description("Index ort set of the micro architectural structure where the error was located.") : amended, - WmiMissingData(-1) - ] - uint32 MSIndex; - - [WmiDataId(20), - Description("Size of Raw Error Record") : amended - ] - uint32 Size; - - [WmiDataId(21), - WmiSizeIs("Size"), - Description("Raw Error Record") : amended - ] - uint8 RawRecord[]; - -}; - - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{433EEA38-C1A7-48f1-884F-B6875F176CC7}"), - Description("MCA Memory Error Event") : amended -] -class MSMCAEvent_MemoryError : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - - [WmiDataId(1), - Description("Unique Id for the error record containing this error") : amended - ] - uint64 RecordId; - - [WmiDataId(2), - ERROR_SEVERITY_QUALIFIERS - ] - uint8 ErrorSeverity; - - [WmiDataId(3), - EVENTLOG_MESSAGE_QUALIFIERS - ] - uint32 Type; - - [WmiDataId(4), - Description("CPU that reported the error") : amended - ] - uint32 Cpu; - - [WmiDataId(5), - Description("Number of additional errors in the record") : amended - ] - uint32 AdditionalErrors; - - [WmiDataId(6), - Description("If zero then this event is not logged to system eventlog") : amended - ] - uint32 LogToEventlog; - - [WmiDataId(7), - Description("Validation bits to indicate the validity of the subsequent fields") : amended, - BitMap{"0", "1", "2", "3", "4", "5", "6", "7", - "8", "9", "10", "11", "12", "13", "14", "15", "16"}, - BitValues{"MEM_ERROR_STATUS is valid", - "MEM_PHYSICAL_ADDR is valid", - "MEM_ADDR_MASK is valid", - "MEM_NODE is valid", - "MEM_CARD is valid", - "MEM_MODULE is valid", - "MEM_BANK is valid", - "MEM_DEVICE is valid", - "MEM_ROW is valid", - "MEM_COLUMN is valid", - "MEM_BIT_POSITION is valid", - "MEM_PLATFORM_REQUESTOR_ID is valid", - "MEM_PLATFORM_RESPONDER_ID is valid", - "MEM_PLATFORM_TARGET is valid", - "MEM_PLATFORM_BUS_SPECIFIC_DATA is valid", - "MEM_PLATFORM_OEM_ID is valid", - "MEM_PLATFORM_OEM_DATA_STRUCT is valid"} : amended - ] - uint64 VALIDATION_BITS; - - [WmiDataId(8), - Description("Memory Error Status") : amended - ] - uint64 MEM_ERROR_STATUS; - - [WmiDataId(9), - Description("64bit physical address of the memory error") : amended - ] - uint64 MEM_PHYSICAL_ADDR; - - [WmiDataId(10), - Description("Defines the valid address bits in the 64-Bit physical address of the memory error. The mask specifies the granularity of the physical address which is dependent on the hardware implementation factors such as interleaving.") : amended - ] - uint64 MEM_PHYSICAL_MASK; - - [WmiDataId(11), - Description("Hardware address of the responder to the transaction") : amended - ] - uint64 RESPONDER_ID; - - [WmiDataId(12), - Description("Hardware address of intended target of transaction") : amended - ] - uint64 TARGET_ID; - - [WmiDataId(13), - Description("Hardware address of the device or component initiating transaction") : amended - ] - uint64 REQUESTOR_ID; - - [WmiDataId(14), - Description("OEM specific bus dependent data") : amended - ] - uint64 BUS_SPECIFIC_DATA; - - [WmiDataId(15), - Description("In a multi-node system, this value identifies the node containing the memory in error") : amended - ] - uint16 MEM_NODE; - - [WmiDataId(16), - Description("The Card number of the memory error location") : amended - ] - uint16 MEM_CARD; - - [WmiDataId(17), - Description("The Module or RANK number of the memory error location") : amended - ] - uint16 MEM_BANK; - - [WmiDataId(18), - Description("The Device number of the memory error location") : amended - ] - uint16 xMEM_DEVICE; - - [WmiDataId(19), - Description("The module or rank number of the memory error location") : amended - ] - uint16 MEM_MODULE; - - [WmiDataId(20), - Description("The Row number of the memory error location") : amended - ] - uint16 MEM_ROW; - - [WmiDataId(21), - Description("The Column number of the memory error location") : amended - ] - uint16 MEM_COLUMN; - - [WmiDataId(22), - Description("Bit position specifies the bit within the memory word that is in error") : amended - ] - uint16 MEM_BIT_POSITION; - - [WmiDataId(23), - Description("Size of Raw Error Record") : amended - ] - uint32 Size; - - [WmiDataId(24), - WmiSizeIs("Size"), - Description("Raw Error Record") : amended - ] - uint8 RawRecord[]; -}; - - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{A14A5594-25DE-410e-9B92-80F0801AEC07}"), - Description("MCA PCI Bus Error Event") : amended -] -class MSMCAEvent_PCIBusError : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - - [WmiDataId(1), - Description("Unique Id for the error record containing this error") : amended - ] - uint64 RecordId; - - [WmiDataId(2), - ERROR_SEVERITY_QUALIFIERS - ] - uint8 ErrorSeverity; - - [WmiDataId(3), - EVENTLOG_MESSAGE_QUALIFIERS - ] - uint32 Type; - - [WmiDataId(4), - Description("CPU that reported the error") : amended - ] - uint32 Cpu; - - [WmiDataId(5), - Description("Number of additional errors in the record") : amended - ] - uint32 AdditionalErrors; - - [WmiDataId(6), - Description("If zero then this event is not logged to system eventlog") : amended - ] - uint32 LogToEventlog; - - [WmiDataId(7), - Description("Validation bits to indicate the validity of the subsequent fields") : amended, - BitMap{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, - BitValues{"PCI_BUS_ERROR_STATUS is valid", - "PCI_BUS_ERROR_TYPE is valid", - "PCI_BUS_ID is valid", - "PCI_BUS_ADDRESS is valid", - "PCI_BUS_DATA is valid", - "PCI_BUS_CMD is valid", - "PCI_BUS_REQUESTOR_ID is valid", - "PCI_BUS_RESPONDER_ID is valid", - "PCI_BUS_TARGET_ID is valid", - "PCI_BUS_OEM_ID is valid", - "PCI_BUS_OEM_DATA_STRUCT is valid"} : amended - ] - uint64 VALIDATION_BITS; - - [WmiDataId(8), - Description("Bus Error Type") : amended - ] - uint64 PCI_BUS_ERROR_STATUS; - - [WmiDataId(9), - Description("Memory or IO address on the PCI bus at the time of the event") : amended - ] - uint64 PCI_BUS_ADDRESS; - - [WmiDataId(10), - Description("Data on the PCI bus at the time of the event") : amended - ] - uint64 PCI_BUS_DATA; - - [WmiDataId(11), - Description("Bus command or operation at the time of the event") : amended - ] - uint64 PCI_BUS_CMD; - - [WmiDataId(12), - Description("PCI Bus Requestor ID at the time of the event") : amended - ] - uint64 PCI_BUS_REQUESTOR_ID; - - [WmiDataId(13), - Description("PCI Bus Responder ID at the time of the event") : amended - ] - uint64 PCI_BUS_RESPONDER_ID; - - [WmiDataId(14), - Description("PCI Bus Intended Target ID at the time of the event") : amended - ] - uint64 PCI_BUS_TARGET_ID; - - [WmiDataId(15), - Description("PCI Bus Error Types") : amended, - ValueMap{"0", "1", "2", "3", "4", "5", "6", "7"}, - Values{"Unknown or OEM System Specific Error", - "Data Parity Error", - "System Error", - "Master Abort", - "Bus Time Out or No Device Present (No DEVSEL#)", - "Master Data Parity Error", - "Address Parity Error", - "Command Parity Error" } : amended - ] - uint16 PCI_BUS_ERROR_TYPE; - - [WmiDataId(16), - Description("Designated PCI Bus Identifier encountering error") : amended - ] - uint8 PCI_BUS_ID_BusNumber; - - [WmiDataId(17), - Description("Designated PCI Bus Identifier encountering error") : amended - ] - uint8 PCI_BUS_ID_SegmentNumber; - - [WmiDataId(18), - Description("Size of Raw Error Record") : amended - ] - uint32 Size; - - [WmiDataId(19), - WmiSizeIs("Size"), - Description("Raw Error Record") : amended - ] - uint8 RawRecord[]; -}; - - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{805CAF4E-336C-4eb2-8C0C-02F351CBF13C}"), - Description("MCA PCI Platform Component Error Event") : amended -] -class MSMCAEvent_PCIComponentError : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - - [WmiDataId(1), - Description("Unique Id for the error record containing this error") : amended - ] - uint64 RecordId; - - [WmiDataId(2), - ERROR_SEVERITY_QUALIFIERS - ] - uint8 ErrorSeverity; - - [WmiDataId(3), - EVENTLOG_MESSAGE_QUALIFIERS - ] - uint32 Type; - - [WmiDataId(4), - Description("CPU that reported the error") : amended - ] - uint32 Cpu; - - [WmiDataId(5), - Description("Number of additional errors in the record") : amended - ] - uint32 AdditionalErrors; - - [WmiDataId(6), - Description("If zero then this event is not logged to system eventlog") : amended - ] - uint32 LogToEventlog; - - [WmiDataId(7), - Description("Validation bits to indicate the validity of the subsequent fields") : amended, - BitMap{"0", "1", "2", "3", "4"}, - BitValues{"PCI_COMP_ERROR_STATUS is valid", - "PCI_COMP_INFO is valid", - "PCI_COMP_MEM_NUM is valid", - "PCI_COMP_IO_NUM is valid", - "PCI_COMP_REGS_DATA_PAIR is valid"} : amended - ] - uint64 VALIDATION_BITS; - - [WmiDataId(8), - Description("Internal Error Code") : amended - ] - uint64 PCI_COMP_ERROR_STATUS; - - [WmiDataId(9), - Description("PCI Component Information - VendorId") : amended - ] - uint16 PCI_COMP_INFO_VendorId; - - [WmiDataId(10), - Description("PCI Component Information - DeviceId") : amended - ] - uint16 PCI_COMP_INFO_DeviceId; - - [WmiDataId(11), - Description("PCI Component Information - Class Code Interface") : amended - ] - uint8 PCI_COMP_INFO_ClassCodeInterface; - - [WmiDataId(12), - Description("PCI Component Information - Class Code SubClass") : amended - ] - uint8 PCI_COMP_INFO_ClassCodeSubClass; - - [WmiDataId(13), - Description("PCI Component Information - Class Code Base Class") : amended - ] - uint8 PCI_COMP_INFO_ClassCodeBaseClass; - - [WmiDataId(14), - Description("PCI Component Information - Function Number") : amended - ] - uint8 PCI_COMP_INFO_FunctionNumber; - - [WmiDataId(15), - Description("PCI Component Information - Device Number") : amended - ] - uint8 PCI_COMP_INFO_DeviceNumber; - - [WmiDataId(16), - Description("PCI Component Information - Bus Number") : amended - ] - uint8 PCI_COMP_INFO_BusNumber; - - [WmiDataId(17), - Description("PCI Component Information - Segment Number") : amended - ] - uint8 PCI_COMP_INFO_SegmentNumber; - - [WmiDataId(18), - Description("Size of Raw Error Record") : amended - ] - uint32 Size; - - [WmiDataId(19), - WmiSizeIs("Size"), - Description("Raw Error Record") : amended - ] - uint8 RawRecord[]; -}; - - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{BDBA4B12-8D00-4570-B9B2-3FDECF1D5661}"), - Description("MCA Platform IPMI System Eventlog Error Event") : amended -] -class MSMCAEvent_SystemEventError : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - - [WmiDataId(1), - Description("Unique Id for the error record containing this error") : amended - ] - uint64 RecordId; - - [WmiDataId(2), - ERROR_SEVERITY_QUALIFIERS - ] - uint8 ErrorSeverity; - - [WmiDataId(3), - EVENTLOG_MESSAGE_QUALIFIERS - ] - uint32 Type; - - [WmiDataId(4), - Description("CPU that reported the error") : amended - ] - uint32 Cpu; - - [WmiDataId(5), - Description("Number of additional errors in the record") : amended - ] - uint32 AdditionalErrors; - - [WmiDataId(6), - Description("If zero then this event is not logged to system eventlog") : amended - ] - uint32 LogToEventlog; - - [WmiDataId(7), - Description("Validation bits to indicate the validity of the subsequent fields") : amended, - BitMap{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}, - BitValues{"SEL_RECORD_ID is valid", - "SEL_RECORD_TYPE is valid", - "SEL_GENERATOR_ID is valid", - "SEL_EVM_REV is valid", - "SEL_SENSOR_TYPE is valid", - "SEL_SENSOR_NUM is valid", - "SEL_EVENT_DIR is valid", - "SEL_EVENT_DATA1 is valid", - "SEL_EVENT_DATA2 is valid", - "SEL_EVENT_DATA3 is valid"} : amended - ] - uint64 VALIDATION_BITS; - - [WmiDataId(8), - Description("Timestamp of the event log") : amended - ] - uint64 SEL_TIME_STAMP; - - [WmiDataId(9), - Description("Record ID used for System Event Log access") : amended - ] - uint16 SEL_RECORD_ID; - - [WmiDataId(10), - Description("Software ID if event was generated by software") : amended - ] - uint16 SEL_GENERATOR_ID; - - [WmiDataId(11), - Description("Indicates the record type") : amended - ] - uint8 SEL_RECORD_TYPE; - - [WmiDataId(12), - Description("The error message format version") : amended - ] - uint8 SEL_EVM_REV; - - [WmiDataId(13), - Description("Sensor type code of the sensor that generated the event") : amended - ] - uint8 SEL_SENSOR_TYPE; - - [WmiDataId(14), - Description("Number of the sensor that generated the event") : amended - ] - uint8 SEL_SENSOR_NUM; - - [WmiDataId(15), - Description("Event Dir") : amended - ] - uint8 SEL_EVENT_DIR_TYPE; - - [WmiDataId(16), - Description("Event Data Field 1") : amended - ] - uint8 SEL_DATA1; - - [WmiDataId(17), - Description("Event Data Field 2") : amended - ] - uint8 SEL_DATA2; - - [WmiDataId(18), - Description("Event Data Field 3") : amended - ] - uint8 SEL_DATA3; - - [WmiDataId(19), - Description("Size of Raw Error Record") : amended - ] - uint32 Size; - - [WmiDataId(20), - WmiSizeIs("Size"), - Description("Raw Error Record") : amended - ] - uint8 RawRecord[]; -}; - - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{4184DF1B-EDFE-406b-B172-54C91FBD9BAF}"), - Description("MCA SMBIOS Error Event") : amended -] -class MSMCAEvent_SMBIOSError : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - - [WmiDataId(1), - Description("Unique Id for the error record containing this error") : amended - ] - uint64 RecordId; - - [WmiDataId(2), - ERROR_SEVERITY_QUALIFIERS - ] - uint8 ErrorSeverity; - - [WmiDataId(3), - EVENTLOG_MESSAGE_QUALIFIERS - ] - uint32 Type; - - [WmiDataId(4), - Description("CPU that reported the error") : amended - ] - uint32 Cpu; - - [WmiDataId(5), - Description("Number of additional errors in the record") : amended - ] - uint32 AdditionalErrors; - - [WmiDataId(6), - Description("If zero then this event is not logged to system eventlog") : amended - ] - uint32 LogToEventlog; - - [WmiDataId(7), - Description("Validation bits to indicate the validity of the subsequent fields") : amended, - BitMap{"0"}, - BitValues{"SMBIOS_EVENT_TYPE is valid"} : amended - ] - uint64 VALIDATION_BITS; - - [WmiDataId(8), - Description("Event Type") : amended, - ValueMap{"0", "1", "2", "3", "4", "5", "6", "7", - "8", "9", "10", "11", "12", "13", "14", "15", - "16", "17", "18", "19", "20", "21", "22", "23"}, - Values{"Reserved", - "Single bit ECC memory error", - "Multiple bit ECC memory error", - "Parity Memory error", - "Bus time-out", - "I/O Channel Check", - "Software NMI", - "POST Memory Resize", - "POST Error", - "PCI Parity Error", - "PCI System Error", - "CPU Failure", - "EISA FailSafe Timer timeout", - "Correctable memory log disabled", - "Logging disabled for a specific event type. Too many errors of the same type received in a short amount of time", - "Reserved", - "System limit exceeded (e.g. voltage or temperature threshold exceeded", - "Asynchronous hardware timer expired and issued a system reset", - "System configuration information", - "Hard disk information", - "System reconfigured", - "Uncorrectable CPU-complex error", - "Log Area Reset/Cleared", - "System boot. If implemented this log entry is guaranteed to be the first one written on any system boot" - } : amended - ] - uint8 SMBIOS_EVENT_TYPE; - - [WmiDataId(9), - Description("Size of Raw Error Record") : amended - ] - uint32 Size; - - [WmiDataId(10), - WmiSizeIs("Size"), - Description("Raw Error Record") : amended - ] - uint8 RawRecord[]; -}; - - - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{2D2434AA-EF83-4200-BA24-DE366C415F7B}"), - Description("MCA Platform Specific Error Event") : amended -] -class MSMCAEvent_PlatformSpecificError : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - - [WmiDataId(1), - Description("Unique Id for the error record containing this error") : amended - ] - uint64 RecordId; - - [WmiDataId(2), - ERROR_SEVERITY_QUALIFIERS - ] - uint8 ErrorSeverity; - - [WmiDataId(3), - EVENTLOG_MESSAGE_QUALIFIERS - ] - uint32 Type; - - [WmiDataId(4), - Description("CPU that reported the error") : amended - ] - uint32 Cpu; - - [WmiDataId(5), - Description("Number of additional errors in the record") : amended - ] - uint32 AdditionalErrors; - - [WmiDataId(6), - Description("If zero then this event is not logged to system eventlog") : amended - ] - uint32 LogToEventlog; - - [WmiDataId(7), - Description("Validation bits to indicate the validity of the subsequent fields") : amended, - BitMap{"0", "1", "2", "3", "4", "5", "6", "7"}, - BitValues{"PLATFORM_ERROR_STATUS is valid", - "PLATFORM_ERROR_REQUESTOR_ID is valid", - "PLATFORM_ERROR_RESPONDER_ID is valid", - "PLATFORM_ERROR_TARGET_ID is valid", - "PLATFORM_ERROR_SPECIFIC_DATA is valid", - "PLATFORM_ERROR_OEM_ID is valid", - "PLATFORM_ERROR_OEM_DATA_STRUCT is valid", - "PLATFORM_ERROR_OEM_DEVICE_PATH is valid" - } : amended - ] - uint64 VALIDATION_BITS; - - [WmiDataId(8), - Description("Platform generic error status") : amended - ] - uint64 PLATFORM_ERROR_STATUS; - - [WmiDataId(9), - Description("Requestor ID at time of the event") : amended - ] - uint64 PLATFORM_REQUESTOR_ID; - - [WmiDataId(10), - Description("Responder ID at time of the event") : amended - ] - uint64 PLATFORM_RESPONDER_ID; - - [WmiDataId(11), - Description("Target ID at the time of the event") : amended - ] - uint64 PLATFORM_TARGET_ID; - - [WmiDataId(12), - Description("OEM specific bus dependent data") : amended - ] - uint64 PLATFORM_BUS_SPECIFIC_DATA; - - [WmiDataId(13), - Description("A unique ID of the component reporting the error") : amended - ] - uint8 OEM_COMPONENT_ID[16]; - - [WmiDataId(14), - Description("Size of Raw Error Record") : amended - ] - uint32 Size; - - [WmiDataId(15), - WmiSizeIs("Size"), - Description("Raw Error Record") : amended - ] - uint8 RawRecord[]; -}; - - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{477B769B-785C-48dd-A02E-57E051BE7B85}"), - Description("MCA Non Compliant Error Event") : amended -] -class MSMCAEvent_InvalidError : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - - [WmiDataId(1), - Description("Unique Id for the error record containing this error") : amended - ] - uint64 RecordId; - - [WmiDataId(2), - ERROR_SEVERITY_QUALIFIERS - ] - uint8 ErrorSeverity; - - [WmiDataId(3), - EVENTLOG_MESSAGE_QUALIFIERS - ] - uint32 Type; - - [WmiDataId(4), - Description("CPU that reported the error") : amended - ] - uint32 Cpu; - - [WmiDataId(5), - Description("Number of additional errors in the record") : amended - ] - uint32 AdditionalErrors; - - [WmiDataId(6), - Description("If zero then this event is not logged to system eventlog") : amended - ] - uint32 LogToEventlog; - - [WmiDataId(7), - Description("Size of Raw Error Record") : amended - ] - uint32 Size; - - [WmiDataId(8), - WmiSizeIs("Size"), - Description("Raw Error Record") : amended - ] - uint8 RawRecord[]; -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - guid("{84E9DDB6-E233-4dfc-988C-7412C8754FEC}"), - Description("Memory page has been removed") : amended -] -class MSMCAEvent_MemoryPageRemoved : WMIEvent -{ - [key, read] - string InstanceName; - boolean Active; - - [WmiDataId(1), - description("Physical Address of memory paged removed from use by OS") : amended, - read] - uint64 PhysicalAddress; -}; - -[WMI, - Description("An MCA/CMC/CPE event") : amended, - guid("{9E77A308-6B82-4fc1-AB41-0A55867C35C2}") -] -class MSMCAInfo_Entry : MSMCAInfo -{ - [WmiDataId(1), - description("Number of bytes in error record") : amended, - read] - uint32 Length; - - [WmiDataId(2), - read, - description("Error record contents") : amended, - WmiSizeIs("Length")] - uint8 Data[]; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("This contains the raw MCA logs") : amended, - guid("{23602A8A-DADD-462f-9AE5-30FA2C37DD5B}") - ] -class MSMCAInfo_RawMCAData : MSMCAInfo -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - description("Number of error records") : amended, - read] - uint32 Count; - - [WmiDataId(2), - read, - description("Error records") : amended, - WmiSizeIs("Count")] - MSMCAInfo_Entry Records[]; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("This contains a CMC event") : amended, - guid("{2F1A8A9D-7988-457f-A17A-8979E82043C5}") - ] -class MSMCAInfo_RawCMCEvent : WmiEvent -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - description("Number of error records") : amended, - read] - uint32 Count; - - [WmiDataId(2), - read, - description("Error records") : amended, - WmiSizeIs("Count")] - MSMCAInfo_Entry Records[]; - -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("This contains a MCA event") : amended, - guid("{2F1A8A9F-7988-457f-A17A-8979E82043C5}") - ] -class MSMCAInfo_RawMCAEvent : WmiEvent -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - description("Number of error records") : amended, - read] - uint32 Count; - - [WmiDataId(2), - read, - description("Error records") : amended, - WmiSizeIs("Count")] - MSMCAInfo_Entry Records[]; - -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("This contains a Corrected Platform event") : amended, - guid("{6B629D5E-E63C-48a3-9EBB-974227075265}") - ] -class MSMCAInfo_RawCorrectedPlatformEvent : WmiEvent -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - description("Number of error records") : amended, - read] - uint32 Count; - - [WmiDataId(2), - read, - description("Error records") : amended, - WmiSizeIs("Count")] - MSMCAInfo_Entry Records[]; -}; - -// -// Power management classes - -[abstract] -class MSPower -{ -}; -[Dynamic, Provider("WMIProv"), - WMI, - Description("The control sets whether the device should dynamically power on and off while the system is working.") : amended, - guid("827c0a6f-feb0-11d0-bd26-00aa00b7b32a") - ] -class MSPower_DeviceEnable : MSPower -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - write] boolean Enable; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("This control indicates whether the device should be configured to wake a sleeping system.") : amended, - guid("a9546a82-feb0-11d0-bd26-00aa00b7b32a") - ] -class MSPower_DeviceWakeEnable : MSPower -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - write] boolean Enable; -}; - - -// -// NDIS classes - -[abstract] -class MSNdis -{ -}; - -[WMI, - guid("{B5BD98B7-0201-11d1-A50E-00A0C9062910}")] -class MSNdis_NetworkAddress : MSNdis -{ - [read, WmiDataId(1), - DisplayName("Address") : amended - ] - uint8 Address[6]; -}; - -[WMI, - guid("{B5BD98B8-0201-11d1-A50E-00A0C9062910}")] -class MSNdis_NetworkShortAddress : MSNdis -{ - [read, WmiDataId(1) - ] - uint8 Address[2]; -}; - -[WMI, - guid("{60fc6b57-0f66-11d1-96a7-00c04fc3358c}")] -class MSNdis_NetworkLinkSpeed : MSNdis -{ - [read, WmiDataId(1)] uint32 Outbound; - [ - read, WmiDataId(2)] uint32 Inbound; -}; - -/// -/// GUIDs that do not translate to OIDs -/// -/// - -[WMI, Dynamic, Provider("WMIProv"), - guid("{981f2d7f-b1f3-11d0-8dd7-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Enumerate Adapter") : amended] -class MSNdis_EnumerateAdapter : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Device name.") : amended, - WmiDataId(1)] string DeviceName; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{981f2d80-b1f3-11d0-8dd7-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Notify Adapter Removal") : amended] -class MSNdis_NotifyAdapterRemoval : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Device name.") : amended, - WmiDataId(1)] string DeviceName; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{981f2d81-b1f3-11d0-8dd7-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Notify Adapter Arrival") : amended] -class MSNdis_NotifyAdapterArrival : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Device name.") : amended, - WmiDataId(1)] string DeviceName; -}; - - -[WMI, Dynamic, Provider("WMIProv"), - guid("{981f2d82-b1f3-11d0-8dd7-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Enumerate VC") : amended] -class MSNdis_NdisEnumerateVc : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{981f2d79-b1f3-11d0-8dd7-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Notify VC Removal") : amended] -class MSNdis_NotifyVcRemoval : WmiEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{182f9e0c-b1f3-11d0-8dd7-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Notify VC Arrival") : amended] -class MSNdis_NotifyVcArrival : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{1f177cd9-5955-4721-9f6a-78ebdfaef889}"), - WmiExpense(1), - Description("NDIS Notify Filter Removal") : amended] -class MSNdis_NotifyFilterRemoval : WmiEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{0b6d3c89-5917-43ca-b578-d01a7967c41c}"), - WmiExpense(1), - Description("NDIS Notify Filter Arrival") : amended] -class MSNdis_NotifyFilterArrival : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{a14f1c97-8839-4f8a-9996-a28996ebbf1d}"), - WmiExpense(1), - Description("This control decides whether the network device should wake up the system only on receiving a Magic packet") : amended] -class MSNdis_DeviceWakeOnMagicPacketOnly : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [read, write, - WmiDataId(1)] boolean EnableWakeOnMagicPacketOnly; -}; - - -[WMI, Dynamic, Provider("WMIProv"), - guid("{9565cd55-3402-4e32-a5b6-2f143f2f2c30}"), - WmiExpense(1), - Description("RSS Enabled on this adapter") : amended] -class MSNdis_RSSEnabled : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [read, - WmiDataId(1)] boolean RSSEnabled; -}; - - -/// -/// -/// General GUIDs -/// -/// -[WMI, Dynamic, Provider("WMIProv"), - guid("{5ec10354-a61a-11d0-8dd4-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Hardware Status") : amended] -class MSNdis_HardwareStatus : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [read, - Description("Current hardware status of the underlying NIC.") : amended, - Values{"NdisHardwareStatusReady", - "NdisHardwareStatusInitializing", - "NdisHardwareStatusReset", - "NdisHardwareStatusClosing", - "NdisHardwarestatusNotReady"} : amended, - ValueMap{"0", - "1", - "2", - "3", - "4"}, - WmiDataId(1)] uint32 NdisHardwareStatus; - -// -// This is of the type: -// typedef enum _NDIS_HARDWARE_STATUS -// { -// NdisHardwareStatusReady, -// NdisHardwareStatusInitializing, -// NdisHardwareStatusReset, -// NdisHardwareStatusClosing, -// NdisHardwarestatusNotReady -// } NDIS_HARDWARE_STATUS, *PNDIS_HARDWARE_STATUS; -// -}; - -[WMI,Dynamic, Provider("WMIProv"), - guid("{5ec10355-a61a-11d0-8dd4-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Media Types Supported") : amended] -class MSNdis_MediaSupported : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of media types supported.") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("List of media types the NIC supports.") : amended, - WmiDataId(2), - WmiSizeIs("NumberElements")] uint32 NdisMediaSupported[]; -}; - -[WMI,Dynamic, Provider("WMIProv"), - guid("{5ec10356-a61a-11d0-8dd4-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Media Types In Use") : amended] -class MSNdis_MediaInUse : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of media types in use.") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("List of media types the NIC is currently supporting.") : amended, - WmiDataId(2), - WmiSizeIs("NumberElements")] uint32 NdisMediaInUse[]; -}; - -[WMI, Dynamic, Provider("WMIProv"),guid("{5ec10357-a61a-11d0-8dd4-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Maximum Lookahead Supported") : amended] -class MSNdis_MaximumLookahead : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The maximum number of bytes the NIC can always provide as lookahead data.") : amended, - WmiDataId(1)] uint32 NdisMaximumLookahead; -}; - - - -[WMI, Dynamic, Provider("WMIProv"),guid("{5ec10358-a61a-11d0-8dd4-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Maximum Frame Size") : amended] -class MSNdis_MaximumFrameSize : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The maximum network packet size in bytes the NIC supports, not including a header.") : amended, - WmiDataId(1)] uint32 NdisMaximumFrameSize; -}; - -[WMI, Dynamic, Provider("WMIProv"),guid("{5ec10359-a61a-11d0-8dd4-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Link Speed") : amended] -class MSNdis_LinkSpeed : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The maximum speed of the NIC (kbps).") : amended, - WmiDataId(1)] uint32 NdisLinkSpeed; -}; - -[WMI, Dynamic, Provider("WMIProv"),guid("{5ec1035a-a61a-11d0-8dd4-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Transmit Buffer Space") : amended] - -class MSNdis_TransmitBufferSpace : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The amount of memory, in bytes, on the NIC available for buffering transmit data.") : amended, - WmiDataId(1)] uint32 NdisTransmitBufferSpace; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{5ec1035b-a61a-11d0-8dd4-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Receive Buffer Space") : amended] -class MSNdis_ReceiveBufferSpace : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The amount of memory on the NIC available for buffering receive data.") : amended, - WmiDataId(1)] uint32 NdisReceiveBufferSpace; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{5ec1035c-a61a-11d0-8dd4-00c04fc3358c}"), - WmiExpense(1), - Description("NDIS Transmit Block Size") : amended] -class MSNdis_TransmitBlockSize : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The minimum number of bytes that a single net packet occupies in the transmit buffer space of the NIC.") : amended, - WmiDataId(1)] uint32 NdisTransmitBlockSize; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{5ec1035d-a61a-11d0-8dd4-00c04fc3358c}"), - Description("NDIS Receive Block Size") : amended] -class MSNdis_ReceiveBlockSize : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ read, - Description("The amount of storage, in bytes, that a single packet occupies in the receive buffer space of the NIC.") : amended, - WmiDataId(1)] uint32 NdisReceiveBlockSize; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{5ec1035e-a61a-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Vendor ID") : amended] -class MSNdis_VendorID : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("A three-byte IEEE-registered vendor code, followed by a single byte the vendor assigns to identify a particular NIC.") : amended, - WmiDataId(1)] uint32 NdisVendorID; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{5ec1035f-a61a-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Vendor Description") : amended - ] -class MSNdis_VendorDescription : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Zero-terminated string describing the NIC.") : amended, - WmiDataId(1)] string NdisVendorDescription; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{5ec10360-a61a-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Current Packet Filter") : amended] -class MSNdis_CurrentPacketFilter : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Current packet types that will be received and indicated by the NIC.") : amended, - WmiDataId(1)] uint32 NdisCurrentPacketFilter; - -// -// This is an inclusive OR of the following types: -// -// NDIS_PACKET_TYPE_DIRECTED 0x00000001 -// NDIS_PACKET_TYPE_MULTICAST 0x00000002 -// NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 -// NDIS_PACKET_TYPE_BROADCAST 0x00000008 -// NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 -// NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 -// NDIS_PACKET_TYPE_SMT 0x00000040 -// NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 -// NDIS_PACKET_TYPE_GROUP 0x00001000 -// NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000 -// NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000 -// NDIS_PACKET_TYPE_MAC_FRAME 0x00008000 -// -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{5ec10361-a61a-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Current Lookahead") : amended] -class MSNdis_CurrentLookahead : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of bytes of received packet data, excluding the header, that will be indicated to the protocol driver.") : amended, - WmiDataId(1)] uint32 NdisCurrentLookahead; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{5ec10362-a61a-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Driver Version") : amended] -class MSNdis_DriverVersion : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The NDIS version in use by the NIC driver.") : amended, - WmiDataId(1)] uint16 NdisDriverVersion; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{5ec10363-a61a-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Maximum Packet Total Size") : amended] - -class MSNdis_MaximumTotalSize : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The maximum total packet length, in bytes, the NIC supports, including the header.") : amended, - WmiDataId(1)] uint32 NdisMaximumTotalSize; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{5ec10365-a61a-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS MAC Options") : amended] -class MSNdis_MacOptions : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("A bitmask that defines optional properties of the underlying driver or its NIC.") : amended, - WmiDataId(1)] uint32 NdisMacOptions; - -// -// This is an inclusive OR of the following types: -// -// NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 -// NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 -// NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 -// NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 -// NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 -// NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 -// NDIS_MAC_OPTION_RESERVED 0x80000000 -// -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{5ec10366-a61a-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Media Connect Status") : amended] -class MSNdis_MediaConnectStatus : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The connection status of the NIC on the network.") : amended, - Values{"NdisMediaStateConnected", - "NdisMediaStateDisconnected"} : amended, - ValueMap{"0", - "1"}, - WmiDataId(1)] uint32 NdisMediaConnectStatus; - -// -// -// -// Defines the state of the LAN media -// -// typedef enum _NDIS_MEDIA_STATE -// { -// NdisMediaStateConnected, -// NdisMediaStateDisconnected -// } NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE; -// -// -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{5ec10367-a61a-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Maximum Send Packets") : amended] -class MSNdis_MaximumSendPackets : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The maximum number of send packets the MiniportSendPackets function can accept.") : amended, - WmiDataId(1)] uint32 NdisMaximumSendPackets; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{447956f9-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Vendor's Driver Version") : amended] -class MSNdis_VendorDriverVersion : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The vendor-assigned version number of the NIC driver.") : amended, - WmiDataId(1)] uint32 NdisVendorDriverVersion; -}; - -/// -/// OID_GEN_VLAN_ID: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{765dc702-c5e8-4b67-843b-3f5a4ff2648b}"), - - WmiExpense(1), - Description("NDIS VLAN Identifier") : amended] -class MSNdis_VlanIdentifier : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, write, - Description("The IEEE 802.1Q VLAN ID assigned to this NIC.") : amended, - WmiDataId(1)] uint32 NdisVlanId; -}; - - -// -// OID_GEN_PHYSICAL_MEDIUM: -// - -[WMI, Dynamic, Provider("WMIProv"), guid("{418ca16d-3937-4208-940a-ec6196278085}"), - - WmiExpense(1), - Description("NDIS Physical Medium Type") : amended] -class MSNdis_PhysicalMediumType : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The physical medium type of the NIC.") : amended, - WmiDataId(1)] uint32 NdisPhysicalMediumType; -// Defines the physical medium type of the NIC -// -// typedef enum _NDIS_PHYSICAL_MEDIUM -// { -// -// NdisPhysicalMediumUnspecified, -// NdisPhysicalMediumWirelessLan, -// NdisPhysicalMediumCableModem, -// NdisPhysicalMediumPhoneLine, -// NdisPhysicalMediumPowerLine, -// NdisPhysicalMediumDSL, // includes ADSL and UADSL (G.Lite) -// NdisPhysicalMediumFibreChannel, -// NdisPhysicalMedium1394, -// NdisPhysicalMediumWirelessWan, -// NdisPhysicalMediumMax // Not a real physical type, defined as an upper-bound -// } NDIS_PHYSICAL_MEDIUM, *PNDIS_PHYSICAL_MEDIUM; -// -}; - - - -[WMI, Dynamic, Provider("WMIProv"), guid("{447956fa-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Transmits OK") : amended] -class MSNdis_TransmitsOk : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of frames transmitted without errors.") : amended, - WmiDataId(1)] uint64 NdisTransmitsOk; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{447956fb-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Receives OK") : amended] -class MSNdis_ReceivesOk : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of frames the NIC receives without errors and indicates to bound protocols.") : amended, - WmiDataId(1)] uint64 NdisReceivesOk; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{447956fc-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Transmit Errors") : amended] -class MSNdis_TransmitsError : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of frames a NIC fails to transmit.") : amended, - WmiDataId(1)] uint32 NdisTransmitsError; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{447956fd-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Receive Errors") : amended] -class MSNdis_ReceiveError : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of frames a NIC receives but does not indicate to the protocols due to errors.") : amended, - WmiDataId(1)] uint32 NdisReceiveError; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{447956fe-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Receive No Buffer") : amended] -class MSNdis_ReceiveNoBuffer : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ read, - Description("The number of frames the NIC cannot receive due to lack of NIC receive buffer space.") : amended, - WmiDataId(1)] uint32 NdisReceiveNoBuffer; -}; - -/// -/// -/// CoNDIS general GUIDs -/// -/// - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad192-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Hardware Status") : amended] -class MSNdis_CoHardwareStatus : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Current hardware status of the underlying NIC.") : amended, - WmiDataId(1)] uint32 NdisCoHardwareStatus; -}; - - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad193-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Media Types Supported") : amended] -class MSNdis_CoMediaSupported : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of media types supported.") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("List of media types the NIC supports.") : amended, - WmiDataId(2), - WmiSizeIs("NumberElements")] uint32 NdisCoMediaSupported[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad194-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Media Types In Use") : amended] -class MSNdis_CoMediaInUse : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of media types in use.") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("List of media types the NIC is currently supporting.") : amended, - WmiDataId(2), - WmiSizeIs("NumberElements")] uint32 NdisCoMediaInUse[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad195-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Link Speed") : amended] -class MSNdis_CoLinkSpeed : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [DisplayName("NdisCoLinkSpeed") : amended, - read, - Description("The maximum inbound and outbound speeds of the NIC (kbps).") : amended, - WmiDataId(1)] MSNdis_NetworkLinkSpeed NdisCoLinkSpeed; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad196-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Vendor ID") : amended] -class MSNdis_CoVendorId : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("A three-byte IEEE-registered vendor code, followed by a single byte the vendor assigns to identify a particular NIC.") : amended, - WmiDataId(1)] uint32 NdisCoVendorID; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad197-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Vendor Description") : amended] -class MSNdis_CoVendorDescription : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Zero-terminated string describing the NIC.") : amended, - WmiDataId(1)] string NdisCoVendorDescription; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad198-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Driver Version") : amended] -class MSNdis_CoDriverVersion : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The NDIS version in use by the NIC driver.") : amended, - WmiDataId(1)] uint16 NdisCoDriverVersion; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad19a-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS MAC Options") : amended] -class MSNdis_CoMacOptions : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("A bitmask that defines optional properties of the underlying driver or its NIC.") : amended, - WmiDataId(1)] uint32 NdisCoMacOptions; -// -// -// NDIS MAC option bits for OID_GEN_CO_MAC_OPTIONS. -// -// #define NDIS_CO_MAC_OPTION_DYNAMIC_LINK_SPEED 0x00000001 -// -// -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad19b-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Media Connect Status") : amended] - -class MSNdis_CoMediaConnectStatus : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The connection status of the NIC on the network.") : amended, - Values{"NdisMediaStateConnected", - "NdisMediaStateDisconnected"} : amended, - ValueMap{"0", - "1"}, - WmiDataId(1)] uint32 NdisCoMediaConnectStatus; -// -// -// -// Defines the state of the LAN media -// -// typedef enum _NDIS_MEDIA_STATE -// { -// NdisMediaStateConnected, -// NdisMediaStateDisconnected -// } NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE; -// -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad19c-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Vendor's Driver Version") : amended] -class MSNdis_CoVendorDriverVersion : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [DisplayName("NdisCoVendorDriverVersion") : amended, - read, - Description("The vendor-assigned version number of the NIC driver.") : amended, - WmiDataId(1)] uint32 NdisCoVendorDriverVersion; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad19d-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Minimum Link Speed") : amended] -class MSNdis_CoMinimumLinkSpeed : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The maximum inbound and outbound speeds of the NIC (kbps).") : amended, - WmiDataId(1)] MSNdis_NetworkLinkSpeed NdisCoMinimumLinkSpeed; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{0a214805-e35f-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Transmits PDUs OK") : amended] -class MSNdis_CoTransmitPdusOk : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of PDUs transmitted without errors") : amended, - WmiDataId(1)] uint64 NdisCoTransmitPdusOk; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{0a214806-e35f-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Receive PDUs OK") : amended] -class MSNdis_CoReceivePdusOk : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of PDUs the NIC receives without errors and indicates to bound protocols.") : amended, - WmiDataId(1)] uint64 NdisCoReceivePdusOk; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{0a214807-e35f-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Transmit PDU Errors") : amended] -class MSNdis_CoTransmitPduErrors : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of PDUs a NIC fails to transmit.") : amended, - WmiDataId(1)] uint32 NdisCoTransmitPduErrors; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{0a214808-e35f-11d0-9692-00c04fc3358c}"), -WmiExpense(1), - Description("CoNDIS Receive PDU Errors") : amended] -class MSNdis_CoReceivePduErrors : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of PDUs a NIC receives but does not indicate to the protocols due to errors.") : amended, - WmiDataId(1)] uint32 NdisCoReceivePduErrors; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{0a214809-e35f-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("CoNDIS Receive PDUs No Buffer") : amended] -class MSNdis_CoReceivePdusNoBuffer : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of PDUs the NIC cannot receive due to lack of NIC receive buffer space.") : amended, - WmiDataId(1)] uint32 NdisCoReceivePdusNoBuffer; -}; - -/// -/// -/// ATM media specific GUIDs -/// -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad19e-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Supported VC Rates") : amended] -class MSNdis_AtmSupportedVcRates : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Minimum cell rate supported.") : amended, - WmiDataId(1)] uint32 MinCellRate; - - [ - read, - Description("Maximum cell rate supported.") : amended, - WmiDataId(2)] uint32 MaxCellRate; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad19f-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Supported Service Category") : amended] -class MSNdis_AtmSupportedServiceCategory : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Bit mask defining the service categories supported by the hardware.") : amended, - WmiDataId(1)] uint32 NdisAtmSupportedServiceCategory; - -// -// This can be a combination of following defines: -// -// #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 -// -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad1a0-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Supported AAL Types") : amended] -class MSNdis_AtmSupportedAalTypes : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Bit mask defining the AAL types supported by the hardware.") : amended, - WmiDataId(1)] uint32 NdisAtmSupportedAalTypes; -// -// This can be a combination of the following defines: -// -// #define AAL_TYPE_AAL0 1 -// #define AAL_TYPE_AAL1 2 -// #define AAL_TYPE_AAL34 4 -// #define AAL_TYPE_AAL5 8 -// -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad1a1-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Hardware Current Address") : amended] -class MSNdis_AtmHardwareCurrentAddress : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The address of the NIC encoded in the hardware.") : amended, - WmiDataId(1)] MSNdis_NetworkAddress NdisAtmHardwareCurrentAddress; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad1a2-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Maximum Active VCs") : amended] -class MSNdis_AtmMaxActiveVcs : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Maximum number of active VCs the adapter can support.") : amended, - WmiDataId(1)] uint32 NdisAtmMaxActiveVcs; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad1a3-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Maximum Active VCI Bits") : amended] -class MSNdis_AtmMaxActiveVciBits : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of bits controllable in the VCI field of the cell header.") : amended, - WmiDataId(1)] uint32 NdisAtmMaxActiveVciBits; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad1a4-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Maximum Active VPI Bits") : amended] -class MSNdis_AtmMaxActiveVpiBits : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of bits controllable in the VPI field of the cell header.") : amended, - WmiDataId(1)] uint32 NdisAtmMaxActiveVpiBits; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad1a5-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Maximum AAL0 Packet Size") : amended] -class MSNdis_AtmMaxAal0PacketSize : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Maximum supported size for AAL0 packets.") : amended, - WmiDataId(1)] uint32 NdisAtmMaxAal0PacketSize; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad1a6-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Maximum AAL1 Packet Size") : amended] -class MSNdis_AtmMaxAal1PacketSize : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ read, - Description("Maximum supported size for AAL1 packets.") : amended, - WmiDataId(1)] uint32 NdisAtmMaxAal1PacketSize; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad1a7-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Maximum AAL3/4 Packet Size") : amended] -class MSNdis_AtmMaxAal34PacketSize : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ read, - Description("Maximum supported size for AAL3/4 packets.") : amended, - WmiDataId(1)] uint32 NdisAtmMaxAal34PacketSize; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{791ad191-e35c-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Maximum AAL5 Packet Size") : amended] -class MSNdis_AtmMaxAal5PacketSize : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Maximum supported size for AAL5 packets.") : amended, - WmiDataId(1)] uint32 NdisAtmMaxAal5PacketSize; -}; - - -[WMI, Dynamic, Provider("WMIProv"), guid("{0a21480a-e35f-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Receive Cells OK") : amended] -class MSNdis_AtmReceiveCellsOk : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of cells the NIC has received without errors.") : amended, - WmiDataId(1)] uint64 NdisAtmReceiveCellsOk; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{0a21480b-e35f-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Transmit Cells OK") : amended] -class MSNdis_AtmTransmitCellsOk : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of cells the NIC has transmitted without errors.") : amended, - WmiDataId(1)] uint64 NdisAtmTransmitCellsOk; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{0a21480c-e35f-11d0-9692-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS ATM Receive Cells Dropped") : amended] -class MSNdis_AtmReceiveCellsDropped : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of receive cells the NIC has dropped.") : amended, - WmiDataId(1)] uint64 NdisAtmReceiveCellsDropped; -}; - -/// -/// -/// Ethernet specific GUIDs -/// -/// - -[WMI, Dynamic, Provider("WMIProv"), guid("{447956ff-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Ethernet Permanent Address") : amended] -class MSNdis_EthernetPermanentAddress : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ read, - Description("The address of the NIC encoded in the hardware.") : amended, - WmiDataId(1)] MSNdis_NetworkAddress NdisPermanentAddress; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{44795700-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Ethernet Current Address") : amended] -class MSNdis_EthernetCurrentAddress : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ read, - Description("The address the NIC is currently using.") : amended, - WmiDataId(1)] MSNdis_NetworkAddress NdisCurrentAddress; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{44795701-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Ethernet Multicast List") : amended] -class MSNdis_EthernetMulticastList : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ read, - Description("Number of multicast addresses enabled on the NIC.") : amended, - WmiDataId(1)] uint32 NumberElements; - - [read, - Description("The multicast address list on the NIC enabled for packet reception.") : amended, - WmiDataId(2), - WmiSizeIs("NumberElements")] MSNdis_NetworkAddress NdisMulticastList[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{44795702-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("Adapter Ethernet Maximum Multicast List Size") : amended] -class MSNdis_EthernetMaximumMulticastListSize : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The maximum number of multicast addresses the NIC driver can manage.") : amended, - WmiDataId(1)] uint32 NdisEthernetMaximumMulticastListSize; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{44795703-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Ethernet MAC Options") : amended] -class MSNdis_EthernetMacOptions : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Features supported by the underlying driver, which could be emulating Ethernet.") : amended, - WmiDataId(1)] uint32 NdisEthernetMacOptions; - -// -// Supported values: -// -// NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 -// -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{44795704-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Ethernet Receive Error Alignment") : amended] -class MSNdis_EthernetReceiveErrorAlignment : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of frames received with alignment errors.") : amended, - WmiDataId(1)] uint32 NdisEthernetReceiveErrorAlignment; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{44795705-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Ethernet One Transmit collision") : amended] -class MSNdis_EthernetOneTransmitCollision : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of frames successfully transmitted after exactly one collision.") : amended, - WmiDataId(1)] uint32 NdisEthernetOneTransmitCollision; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{44795706-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Ethernet More Transmit collisions") : amended] -class MSNdis_EthernetMoreTransmitCollisions : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of frames successfully transmitted after more than one collision.") : amended, - WmiDataId(1)] uint32 NdisEthernetMoreTransmitCollisions; -}; - -/// -/// -/// Token Ring specific GUIDs -/// -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{44795707-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Token Ring Permanent Address") : amended] -class MSNdis_TokenRingPermanentAddress : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The address of the NIC encoded in the hardware.") : amended, - WmiDataId(1)] MSNdis_NetworkAddress NdisPermanentAddress; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{44795708-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Token Ring Current Address") : amended] -class MSNdis_TokenRingCurrentAddress : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The address the NIC is currently using.") : amended, - WmiDataId(1)] MSNdis_NetworkAddress NdisCurrentAddress; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{44795709-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Token Ring Current Functional Address") : amended] -class MSNdis_TokenRingCurrentFunctional : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The functional address enabled on the NIC for packet reception.") : amended, - WmiDataId(1)] uint32 NdisTokenRingCurrentFunctional; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{4479570a-a61b-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Token Ring Current Group Address") : amended] -class MSNdis_TokenRingCurrentGroup : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The group address enabled on the NIC for packet reception.") : amended, - WmiDataId(1)] uint32 NdisTokenRingCurrentGroup; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{4479570b-a61b-11d0-8dd4-00c04fc3358c}"), -WmiExpense(1), - Description("NDIS Token Ring Last Open Status") : amended] -class MSNdis_TokenRingLastOpenStatus : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The last open error status returned for a protocol's call to NdisOpenAdapter.") : amended, - WmiDataId(1)] uint32 NdisTokenRingLastOpenStatus; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{890a36ec-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Token Ring Current Ring Status") : amended] -class MSNdis_TokenRingCurrentRingStatus : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The last ring status indicated with an NDIS_RING_XXX status code.") : amended, - WmiDataId(1)] uint32 NdisTokenRingCurrentRingStatus; - -// -// This can be one of the following values: -// -// NDIS_RING_SIGNAL_LOSS 0x00008000 -// NDIS_RING_HARD_ERROR 0x00004000 -// NDIS_RING_SOFT_ERROR 0x00002000 -// NDIS_RING_TRANSMIT_BEACON 0x00001000 -// NDIS_RING_LOBE_WIRE_FAULT 0x00000800 -// NDIS_RING_AUTO_REMOVAL_ERROR 0x00000400 -// NDIS_RING_REMOVE_RECEIVED 0x00000200 -// NDIS_RING_COUNTER_OVERFLOW 0x00000100 -// NDIS_RING_SINGLE_STATION 0x00000080 -// NDIS_RING_RING_RECOVERY 0x00000040 -// -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14032-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Token Ring Current Ring State.") : amended] -class MSNdis_TokenRingCurrentRingState : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The state of the NIC driver with respect to entering the ring.") : amended, - Values{"NdisRingStateOpened", - "NdisRingStateClosed", - "NdisRingStateOpening", - "NdisRingStateClosing", - "NdisRingStateOpenFailure", - "NdisRingStateRingFailure"} : amended, - ValueMap{"1", - "2", - "3", - "4", - "5", - "6"}, - WmiDataId(1)] uint32 NdisTokenRingCurrentRingState; - -// -// This is defined as follows: -// -// typedef enum _NDIS_802_5_RING_STATE -// { -// NdisRingStateOpened = 1, -// NdisRingStateClosed, -// NdisRingStateOpening, -// NdisRingStateClosing, -// NdisRingStateOpenFailure, -// NdisRingStateRingFailure -// } NDIS_802_5_RING_STATE, *PNDIS_802_5_RING_STATE; -// -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14033-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Token Ring Line Errors") : amended] -class MSNdis_TokenRingLineErrors : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of frames with an invalid FCS or a code violation.") : amended, - WmiDataId(1)] uint32 NdisTokenRingLineErrors; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14034-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Token Ring Lost Frames") : amended] -class MSNdis_TokenRingLostFrames : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of frames transmitted that have not circled the ring within the maximum ring latency.") : amended, - WmiDataId(1)] uint32 NdisTokenRingLostFrames; -}; - -/// -/// -/// FDDI specific GUIDs -/// -/// - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14035-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Long Permanent Address") : amended] -class MSNdis_FddiLongPermanentAddress : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The long address of the NIC encoded in the hardware.") : amended, - WmiDataId(1)] MSNdis_NetworkAddress NdisPermanentAddress; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14036-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Long Current Address") : amended] -class MSNdis_FddiLongCurrentAddress : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The long address the NIC is currently using.") : amended, - WmiDataId(1)] MSNdis_NetworkAddress NdisCurrentAddress; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14037-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Long Multicast List") : amended] -class MSNdis_FddiLongMulticastList : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of multicast addresses enabled on the NIC.") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("The multicast long address list on the NIC enabled for packet reception.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] - MSNdis_NetworkAddress NdisMulticastList[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14038-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Long Maximum List Size") : amended] -class MSNdis_FddiLongMaximumListSize : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The maximum number of multicast long addresses the NIC driver can manage.") : amended, - WmiDataId(1)] uint32 NdisFddiLongMaximumListSize; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14039-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Short Permanent Address") : amended] -class MSNdis_FddiShortPermanentAddress : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The short address of the NIC encoded in the hardware.") : amended, - WmiDataId(1)] MSNdis_NetworkShortAddress NdisPermanentAddress; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf1403a-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Short Current Address") : amended] -class MSNdis_FddiShortCurrentAddress : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The short address the NIC is currently using.") : amended, - WmiDataId(1)] MSNdis_NetworkShortAddress NdisCurrentAddress; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf1403b-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Short Multicast List") : amended] -class MSNdis_FddiShortMulticastList : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of multicast short addresses enabled on the NIC.") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("The multicast short address list on the NIC enabled for packet reception.") : amended, - WmiDataId(2), - WmiSizeIs("NumberElements")] MSNdis_NetworkShortAddress NdisMulticastList[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf1403c-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Short Maximum List Size") : amended] -class MSNdis_FddiShortMaximumListSize : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The maximum number of multicast short addresses the NIC driver can manage.") : amended, - WmiDataId(1)] uint32 NdisFddiShortMaximumListSize; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf1403d-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Attachment Type") : amended] -class MSNdis_FddiAttachmentType : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Defines the attachment of the NIC to the network.") : amended, - Values{"NdisFddiTypeIsolated", - "NdisFddiTypeLocalA", - "NdisFddiTypeLocalB", - "NdisFddiTypeLocalAB", - "NdisFddiTypeLocalS", - "NdisFddiTypeWrapA", - "NdisFddiTypeWrapB", - "NdisFddiTypeWrapAB", - "NdisFddiTypeWrapS", - "NdisFddiTypeCWrapA", - "NdisFddiTypeCWrapB", - "NdisFddiTypeCWrapS", - "NdisFddiTypeThrough"} : amended, - ValueMap{"1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "10", - "11", - "12", - "13"}, - WmiDataId(1)] uint32 NdisFddiAttachmentType; - -// -// This can be of the following type: -// -// typedef enum _NDIS_FDDI_ATTACHMENT_TYPE -// { -// NdisFddiTypeIsolated = 1, -// NdisFddiTypeLocalA, -// NdisFddiTypeLocalB, -// NdisFddiTypeLocalAB, -// NdisFddiTypeLocalS, -// NdisFddiTypeWrapA, -// NdisFddiTypeWrapB, -// NdisFddiTypeWrapAB, -// NdisFddiTypeWrapS, -// NdisFddiTypeCWrapA, -// NdisFddiTypeCWrapB, -// NdisFddiTypeCWrapS, -// NdisFddiTypeThrough -// } NDIS_FDDI_ATTACHMENT_TYPE, *PNDIS_FDDI_ATTACHMENT_TYPE; -// -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf1403e-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Upstream Node Long") : amended] -class MSNdis_FddiUpstreamNodeLong : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The long address of the station above this NIC on the ring or zero if the address is unknown.") : amended, - WmiDataId(1)] MSNdis_NetworkAddress NdisFddiUpstreamNodeLong; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf1403f-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Downstream Node Long") : amended] -class MSNdis_FddiDownstreamNodeLong : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The long address of the station below this NIC on the ring or zero if the address is unknown.") : amended, - WmiDataId(1)] MSNdis_NetworkAddress NdisFddiDownstreamNodeLong; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14040-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Frame Errors") : amended] -class MSNdis_FddiFrameErrors : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of frames detected in error by this NIC that have not been detected in error by another device on the ring.") : amended, - WmiDataId(1)] uint32 NdisFddiFrameErrors; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14041-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Frames Lost") : amended] -class MSNdis_FddiFramesLost : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of times this NIC detected a format error during frame reception such that the frame was stripped.") : amended, - WmiDataId(1)] uint32 NdisFddiFramesLost; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14042-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI Ring Management State") : amended] -class MSNdis_FddiRingManagmentState : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Defines the current state of the Ring Management state machine.") : amended, - Values{"NdisFddiRingIsolated", - "NdisFddiRingNonOperational", - "NdisFddiRingOperational", - "NdisFddiRingDetect", - "NdisFddiRingNonOperationalDup", - "NdisFddiRingOperationalDup", - "NdisFddiRingDirected", - "NdisFddiRingTrace"} : amended, - ValueMap{"1", - "2", - "3", - "4", - "5", - "6", - "7", - "8"}, - WmiDataId(1)] uint32 NdisFddiRingManagmentState; - -// -// This can be of the following type: -// -// typedef enum _NDIS_FDDI_RING_MGT_STATE -// { -// NdisFddiRingIsolated = 1, -// NdisFddiRingNonOperational, -// NdisFddiRingOperational, -// NdisFddiRingDetect, -// NdisFddiRingNonOperationalDup, -// NdisFddiRingOperationalDup, -// NdisFddiRingDirected, -// NdisFddiRingTrace -// } NDIS_FDDI_RING_MGT_STATE, *PNDIS_FDDI_RING_MGT_STATE; -// -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14043-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI LCT Failures") : amended] -class MSNdis_FddiLctFailures : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The count of the consecutive times the link confidence test (LCT) has failed during connection management.") : amended, - WmiDataId(1)] uint32 NdisFddiLctFailures; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14044-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI LEM Rejects") : amended] -class MSNdis_FddiLemRejects : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The link error monitor (LEM) count of times that a link was rejected.") : amended, - WmiDataId(1)] uint32 NdisFddiLemRejects; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{acf14045-a61c-11d0-8dd4-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS FDDI LConnect State") : amended] -class MSNdis_FddiLConnectionState : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Defines the state of this port's Physical Connection Management (PCM) state machine.") : amended, - Values{"NdisFddiStateOff", - "NdisFddiStateBreak", - "NdisFddiStateTrace", - "NdisFddiStateConnect", - "NdisFddiStateNext", - "NdisFddiStateSignal", - "NdisFddiStateJoin", - "NdisFddiStateVerify", - "NdisFddiStateActive", - "NdisFddiStateMaintenance"} : amended, - ValueMap{"1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "10"}, - WmiDataId(1)] uint32 NdisFddiLConnectionState; -// -// This can be of the following type: -// -// typedef enum _NDIS_FDDI_LCONNECTION_STATE -// { -// NdisFddiStateOff = 1, -// NdisFddiStateBreak, -// NdisFddiStateTrace, -// NdisFddiStateConnect, -// NdisFddiStateNext, -// NdisFddiStateSignal, -// NdisFddiStateJoin, -// NdisFddiStateVerify, -// NdisFddiStateActive, -// NdisFddiStateMaintenance -// } NDIS_FDDI_LCONNECTION_STATE, *PNDIS_FDDI_LCONNECTION_STATE; -// - -}; - - -/// -/// NDIS 6 specific GUIDs -/// - -[WMI, - guid("{2b1831b2-2216-4ede-a469-9fe3dd6d5a7e}")] -class MSNdis_ObjectHeader : MSNdis -{ - [read, WmiDataId(1)] uint8 Type; - [ - read, WmiDataId(2)] uint8 Revision; - [ - read, WmiDataId(3)] uint16 Size; -}; - -[WMI, - guid("{e3eac9dd-2fd3-4963-bffd-b4692888c0d4}")] -class MSNdis_WmiMethodHeader : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 PortNumber; - [ - read, WmiDataId(3)] uint64 NetLuid; - [ - read, WmiDataId(4)] uint64 RequestId; - [ - read, WmiDataId(5)] uint32 Timeout; - [ - read, WmiDataId(6)] uint32 Padding; - -}; - -[WMI, - guid("{3b5605d8-1aaf-4ff6-85b9-bc5fb973dc54}")] -class MSNdis_WmiSetHeader : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 PortNumber; - [ - read, WmiDataId(3)] uint64 NetLuid; - [ - read, WmiDataId(4)] uint64 RequestId; - [ - read, WmiDataId(5)] uint32 Timeout; - [ - read, WmiDataId(6)] uint32 Padding; -}; - -[WMI, - guid("{7510bb9d-df70-4f7e-ba07-e29d330b3cc5}")] -class MSNdis_WmiOutputInfo : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 Flags; - [ - read, WmiDataId(3)] uint8 SupportedRevision; - [ - read, WmiDataId(4)] uint8 Padding1; - [ - read, WmiDataId(5)] uint16 Padding2; - [ - read, WmiDataId(6)] uint32 DataOffset; -}; - -[WMI, - guid("{e7001b59-c3d6-4537-b40e-a163d516e4a3}")] -class MSNdis_WmiEnumAdapter : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 IfIndex; - [ - read, WmiDataId(3)] uint64 NetLuid; - [ - read, WmiDataId(4)] string DeviceName; -}; - - -[WMI, - guid("{5b26b94f-0272-4d4c-8744-bd84be421f3b}")] -class MSNdis_LinkStateData : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 MediaConnectState; - [ - read, WmiDataId(3)] uint32 MediaDuplexState; - [ - read, WmiDataId(4)] uint64 XmitLinkSpeed; - [ - read, WmiDataId(5)] uint64 RcvLinkSpeed; - [ - read, WmiDataId(6)] uint32 PauseFunctions; - [ - read, WmiDataId(7)] uint32 AutoNegotiationFlags; -}; - -[WMI, - guid("{29380131-a312-4400-be0c-53877a41c465}")] -class MSNdis_LinkParameters : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 MediaDuplexState; - [ - read, WmiDataId(3)] uint64 XmitLinkSpeed; - [ - read, WmiDataId(4)] uint64 RcvLinkSpeed; - [ - read, WmiDataId(5)] uint32 PauseFunctions; - [ - read, WmiDataId(6)] uint32 AutoNegotiationFlags; -}; - - -[WMI, - guid("{09f58643-31fb-45b5-852b-09b4d3ff3765}")] -class MSNdis_InterruptModerationParameters : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 Flags; - [ - read, WmiDataId(3)] uint32 InterruptModeration; - -}; - -[WMI, - guid("{8ecc74e1-ba85-482e-afaf-b4f8b087c06b}")] -class MSNdis_StatisticsInfo : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 SupportedStatistics; - [ - read, WmiDataId(3)] uint64 ifInDiscards; - [ - read, WmiDataId(4)] uint64 ifInErrors; - [ - read, WmiDataId(5)] uint64 ifHCInOctets; - [ - read, WmiDataId(6)] uint64 ifHCInUcastPkts; - [ - read, WmiDataId(7)] uint64 ifHCInMulticastPkts; - [ - read, WmiDataId(8)] uint64 ifHCInBroadcastPkts; - [ - read, WmiDataId(9)] uint64 ifHCOutOctets; - [ - read, WmiDataId(10)] uint64 ifHCOutUcastPkts; - [ - read, WmiDataId(11)] uint64 ifHCOutMulticastPkts; - [ - read, WmiDataId(12)] uint64 ifHCOutBroadcastPkts; - [ - read, WmiDataId(13)] uint64 ifOutErrors; - [ - read, WmiDataId(14)] uint64 ifOutDiscards; - [ - read, WmiDataId(15)] uint64 ifHCInUcastOctets; - [ - read, WmiDataId(16)] uint64 ifHCInMulticastOctets; - [ - read, WmiDataId(17)] uint64 ifHCInBroadcastOctets; - [ - read, WmiDataId(18)] uint64 ifHCOutUcastOctets; - [ - read, WmiDataId(19)] uint64 ifHCOutMulticastOctets; - [ - read, WmiDataId(20)] uint64 ifHCOutBroadcastOctets; -}; - -[WMI, - guid("{8feae2c6-ee28-469f-8b5d-9f743bab21aa}")] -class MSNdis_PortStateData : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 MediaConnectState; - [ - read, WmiDataId(3)] uint64 XmitLinkSpeed; - [ - read, WmiDataId(4)] uint64 RcvLinkSpeed; - [ - read, WmiDataId(5)] uint32 Direction; - [ - read, WmiDataId(6)] uint32 SendControlState; - [ - read, WmiDataId(7)] uint32 RcvControlState; - [ - read, WmiDataId(8)] uint32 SendAuthorizationState; - [ - read, WmiDataId(9)] uint32 RcvAuthorizationState; - [ - read, WmiDataId(10)] uint32 Flags; -}; - - -[WMI, - guid("{5c3bda24-8b64-4829-a587-8ce719152fe2}")] -class MSNdis_PortAuthParameters : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 SendControlState; - [ - read, WmiDataId(3)] uint32 RcvControlState; - [ - read, WmiDataId(4)] uint32 SendAuthorizationState; - [ - read, WmiDataId(5)] uint32 RcvAuthorizationState; -}; - -[WMI, - guid("{f5b7d202-e594-4aa3-be43-4976833c7840}")] -class MSNdis_PortChar : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 PortNumber; - [ - read, WmiDataId(3)] uint32 Flags; - [ - read, WmiDataId(4)] uint32 Type; - [ - read, WmiDataId(5)] uint32 MediaConnectState; - [ - read, WmiDataId(6)] uint64 XmitLinkSpeed; - [ - read, WmiDataId(7)] uint64 RcvLinkSpeed; - [ - read, WmiDataId(8)] uint32 Direction; - [ - read, WmiDataId(9)] uint32 SendControlState; - [ - read, WmiDataId(10)] uint32 RcvControlState; - [ - read, WmiDataId(11)] uint32 SendAuthorizationState; - [ - read, WmiDataId(12)] uint32 RcvAuthorizationState; -}; - -[WMI, - guid("{0fee8708-df65-456e-b4ca-fa623266a12a}")] -class MSNdis_PortArray : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 NumberOfPorts; - [ - read, WmiDataId(3)] uint32 OffsetFirstPort; - [ - read, WmiDataId(4)] uint32 ElementSize; - [ - read, WmiDataId(5), WmiSizeIs("NumberOfPorts")] MSNdis_PortChar Port[]; - -}; - -[WMI, - guid("{0573f70f-ded8-401c-8b56-a62bb528c0e2}")] -class MSNdis_PciDeviceProperty : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 DeviceType; - [ - read, WmiDataId(3)] uint32 CurrentSpeedAndMode; - [ - read, WmiDataId(4)] uint32 CurrentPayloadSize; - [ - read, WmiDataId(5)] uint32 MaxPayloadSize; - [ - read, WmiDataId(6)] uint32 MaxReadRequestSize; - [ - read, WmiDataId(7)] uint32 CurrentLinkSpeed; - [ - read, WmiDataId(8)] uint32 CurrentLinkWidth; - [ - read, WmiDataId(9)] uint32 MaxLinkSpeed; - [ - read, WmiDataId(10)] uint32 MaxLinkWidth; -}; - -[WMI, - guid("{d7673b11-e892-4a9d-8bd8-761ff256edd9}")] -class MSNdis_WmiTcpLargeSendOffloadV1_IPv4 : MSNdis -{ - [read, WmiDataId(1)] uint32 Encapsulation; - [ - read, WmiDataId(2)] uint32 MaxOffLoadSize; - [ - read, WmiDataId(3)] uint32 MinSegmentCount; - [ - read, WmiDataId(4)] uint32 TcpOptions; - [ - read, WmiDataId(5)] uint32 IpOptions; -}; - -[WMI, - guid("{b9e4e2f9-ee89-4756-b057-38f9d9b59a92}")] -class MSNdis_WmiTcpLargeSendOffloadV1 : MSNdis -{ - [read, WmiDataId(1)] MSNdis_WmiTcpLargeSendOffloadV1_IPv4 WmiIPv4; -}; - -[WMI, - guid("{d63d537a-59c1-4fae-8f9b-cd9fbbecb85a}")] -class MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive : MSNdis -{ - [read, WmiDataId(1)] uint32 Encapsulation; - [ - read, WmiDataId(2)] uint32 IpOptionsSupported; - [ - read, WmiDataId(3)] uint32 TcpOptionsSupported; - [ - read, WmiDataId(4)] uint32 TcpChecksum; - [ - read, WmiDataId(5)] uint32 UdpChecksum; - [ - read, WmiDataId(6)] uint32 IpChecksum; -}; - -[WMI, - guid("{b9760e75-6662-49e4-aa6c-f028befec8ee}")] -class MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive : MSNdis -{ - [read, WmiDataId(1)] uint32 Encapsulation; - [ - read, WmiDataId(2)] uint32 IpExtensionHeadersSupported; - [ - read, WmiDataId(3)] uint32 TcpOptionsSupported; - [ - read, WmiDataId(4)] uint32 TcpChecksum; - [ - read, WmiDataId(5)] uint32 UdpChecksum; -}; - -[WMI, - guid("{189d4015-1b25-4d8e-a4a9-f9eba82197c7}")] -class MSNdis_WmiTcpIpChecksumOffload : MSNdis -{ - [read, WmiDataId(1)] MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive IPv4Transmit; - [ - read, WmiDataId(2)] MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive IPv4Receive; - [ - read, WmiDataId(3)] MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive IPv6Transmit; - [ - read, WmiDataId(4)] MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive IPv6Receive; -}; - -[WMI, - guid("{f86676b9-d9fa-4d26-95ce-bfbc77d80596}")] -class MSNdis_WmiIPSecOffloadV1_Supported : MSNdis -{ - [read, WmiDataId(1)] uint32 Encapsulation; - [ - read, WmiDataId(2)] uint32 AhEspCombined; - [ - read, WmiDataId(3)] uint32 TransportTunnelCombined; - [ - read, WmiDataId(4)] uint32 IPv4Options; - [ - read, WmiDataId(5)] uint32 Flags; -}; - -[WMI, - guid("{29bacfdd-f063-48d8-952c-d3dc93300f15}")] -class MSNdis_WmiIPSecOffloadV1_IPv4AH : MSNdis -{ - [read, WmiDataId(1)] uint32 Md5; - [ - read, WmiDataId(2)] uint32 Sha_1; - [ - read, WmiDataId(3)] uint32 Transport; - [ - read, WmiDataId(4)] uint32 Tunnel; - [ - read, WmiDataId(5)] uint32 Send; - [ - read, WmiDataId(6)] uint32 Receive; -}; - -[WMI, - guid("{86522023-4536-4b58-a1f4-2538941ace43}")] -class MSNdis_WmiIPSecOffloadV1_IPv4ESP : MSNdis -{ - [read, WmiDataId(1)] uint32 Des; - [ - read, WmiDataId(2)] uint32 Reserved; - [ - read, WmiDataId(3)] uint32 TripleDes; - [ - read, WmiDataId(4)] uint32 NullEsp; - [ - read, WmiDataId(5)] uint32 Transport; - [ - read, WmiDataId(6)] uint32 Tunnel; - [ - read, WmiDataId(7)] uint32 Send; - [ - read, WmiDataId(8)] uint32 Receive; -}; - - -[WMI, - guid("{4ec63447-2238-43a7-ac33-11c7cc7d8665}")] -class MSNdis_WmiIPSecOffloadV1 : MSNdis -{ - [read, WmiDataId(1)] MSNdis_WmiIPSecOffloadV1_Supported WmiSupported; - [ - read, WmiDataId(2)] MSNdis_WmiIPSecOffloadV1_IPv4AH WmiIPv4AH; - [ - read, WmiDataId(3)] MSNdis_WmiIPSecOffloadV1_IPv4ESP WmiIPv4ESP; -}; - -[WMI, - guid("{8823d030-fa30-4b73-b339-db19207f0d81}")] -class MSNdis_WmiTcpLargeSendOffloadV2_IPv4 : MSNdis -{ - [read, WmiDataId(1)] uint32 Encapsulation; - [ - read, WmiDataId(2)] uint32 MaxOffLoadSize; - [ - read, WmiDataId(3)] uint32 MinSegmentCount; -}; - -[WMI, - guid("{a7a9597c-2f8e-410b-9bb3-5c3a50792bfc}")] -class MSNdis_WmiTcpLargeSendOffloadV2_IPv6 : MSNdis -{ - [read, WmiDataId(1)] uint32 Encapsulation; - [ - read, WmiDataId(2)] uint32 MaxOffLoadSize; - [ - read, WmiDataId(3)] uint32 MinSegmentCount; - [ - read, WmiDataId(4)] uint32 IpExtensionHeadersSupported; - [ - read, WmiDataId(5)] uint32 TcpOptionsSupported; -}; - -[WMI, - guid("{592977c2-cfbe-462c-b5cf-1a7679fe1cba}")] -class MSNdis_WmiTcpLargeSendOffloadV2 : MSNdis -{ - [read, WmiDataId(1)] MSNdis_WmiTcpLargeSendOffloadV2_IPv4 WmiIPv4; - [ - read, WmiDataId(2)] MSNdis_WmiTcpLargeSendOffloadV2_IPv6 WmiIPv6; -}; - -[WMI, - guid("{7a877086-2204-4a8a-92a4-e3e8ab626629}")] -class MSNdis_WmiOffload : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] MSNdis_WmiTcpIpChecksumOffload Checksum; - [ - read, WmiDataId(3)] MSNdis_WmiTcpLargeSendOffloadV1 LsoV1; - [ - read, WmiDataId(4)] MSNdis_WmiIPSecOffloadV1 IPsecV1; - [ - read, WmiDataId(5)] MSNdis_WmiTcpLargeSendOffloadV2 LsoV2; - [ - read, WmiDataId(6)] uint32 Flags; -}; - -[WMI, - guid("{43fe82d8-3468-497e-9dcf-f8ffc0133744}")] -class MSNdis_TcpOffloadParameters : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint8 IPv4Checksum; - [ - read, WmiDataId(3)] uint8 TCPIPv4Checksum; - [ - read, WmiDataId(4)] uint8 UDPIPv4Checksum; - [ - read, WmiDataId(5)] uint8 TCPIPv6Checksum; - [ - read, WmiDataId(6)] uint8 UDPIPv6Checksum; - [ - read, WmiDataId(7)] uint8 LsoV1; - [ - read, WmiDataId(8)] uint8 IPsec; - [ - read, WmiDataId(9)] uint8 LsoV2IPv4; - [ - read, WmiDataId(10)] uint8 LsoV2IPv6; - [ - read, WmiDataId(11)] uint8 TcpConnectionIPv4; - [ - read, WmiDataId(12)] uint8 TcpConnectionIPv6; - [ - read, WmiDataId(13)] uint32 Flags; -}; - -[WMI, - guid("{93cfcd3f-6228-455c-905e-3ab80a2ff090}")] -class MSNdis_WmiTcpConnectionOffload : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 Encapsulation; - [ - read, WmiDataId(3)] uint32 SupportIp4; - [ - read, WmiDataId(4)] uint32 SupportIp6; - [ - read, WmiDataId(5)] uint32 SupportIp6ExtensionHeaders; - [ - read, WmiDataId(6)] uint32 SupportSack; - [ - read, WmiDataId(7)] uint32 TcpConnectionOffloadCapacity; - [ - read, WmiDataId(8)] uint32 Flags; -}; - -[WMI, - guid("{34ff16bf-30ca-4a2a-a46d-c7ee74bc3582}")] -class MSNdis_WmiHDSplitCurrentConfig : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 HardwareCapabilities; - [ - read, WmiDataId(3)] uint32 CurrentCapabilities; - [ - read, WmiDataId(4)] uint32 HDSplitFlags; - [ - read, WmiDataId(5)] uint32 HDSplitCombineFlags; - [ - read, WmiDataId(6)] uint32 BackfillSize; - [ - read, WmiDataId(7)] uint32 MaxHeaderSize; -}; - -[WMI, - guid("{1131c56a-0a5a-4d79-8dde-1e6f178005ee}")] -class MSNdis_HDSplitParameters : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 HDSplitCombineFlags; -}; - -[WMI, - guid("{f7a4960a-ace3-44dc-b51e-72e05c5eafa8}")] -class MSNdis_WmiReceiveScaleCapabilities : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 CapabilitiesFlags; - [ - read, WmiDataId(3)] uint32 NumberOfInterruptMessages; - [ - read, WmiDataId(4)] uint32 NumberOfReceiveQueues; -}; - -[WMI, - guid("{146360a3-88dd-11dd-94b8-001d09162bc3}")] -class MSNdis_ReceiveFilterCapabilities : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 Flags; - [ - read, WmiDataId(3)] uint32 EnabledFilterTypes; - [ - read, WmiDataId(4)] uint32 EnabledQueueTypes; - [ - read, WmiDataId(5)] uint32 NumQueues; - [ - read, WmiDataId(6)] uint32 SupportedQueueProperties; - [ - read, WmiDataId(7)] uint32 SupportedFilterTests; - [ - read, WmiDataId(8)] uint32 SupportedHeaders; - [ - read, WmiDataId(9)] uint32 SupportedMacHeaderFields; - [ - read, WmiDataId(10)] uint32 MaxMacHeaderFilters; - [ - read, WmiDataId(11)] uint32 MaxQueueGroups; - [ - read, WmiDataId(12)] uint32 MaxQueuesPerQueueGroup; - [ - read, WmiDataId(13)] uint32 MinLookaheadSplitSize; - [ - read, WmiDataId(14)] uint32 MaxLookaheadSplitSize; -}; - -[WMI, - guid("{146360a4-88dd-11dd-94b8-001d09162bc3}")] -class MSNdis_ReceiveFilterGlobalParameters : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 Flags; - [ - read, WmiDataId(3)] uint32 EnabledFilterTypes; - [ - read, WmiDataId(4)] uint32 EnabledQueueTypes; -}; - -[WMI, - guid("{146360a5-88dd-11dd-94b8-001d09162bc3}")] -class MSNdis_CountedString : MSNdis -{ - [read, WmiDataId(1)] uint16 Length; - [ - read, WmiDataId(2)] char16 String[257]; -}; - -[WMI, - guid("{146360a9-88dd-11dd-94b8-001d09162bc3}")] -class MSNdis_ReceiveFilterInfo : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 Flags; - [ - read, WmiDataId(3)] uint32 FilterType; - [ - read, WmiDataId(4)] uint32 FilterId; -}; - -[WMI, Dynamic, Provider("WMIProv"), -guid("{146360aa-88dd-11dd-94b8-001d09162bc3}")] -class MSNdis_ReceiveFilterInfoArray : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, write, WmiDataId(2)] uint32 QueueId; - [ - read, WmiDataId(3)] uint32 FirstElementOffset; - [ - read, WmiDataId(4)] uint32 NumElements; - [ - read, WmiDataId(5)] uint32 ElementSize; - [ - read, WmiDataId(6), WmiSizeIs("NumElements")] MSNdis_ReceiveFilterInfo Filter[]; -}; - -[WMI, - guid("{146360ab-88dd-11dd-94b8-001d09162bc3}")] -class MSNdis_ReceiveFilterFieldParameters : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 Flags; - [ - read, WmiDataId(3)] uint32 FrameHeader; - [ - read, WmiDataId(4)] uint32 ReceiveFilterTest; - [ - read, WmiDataId(5)] uint32 MacHeaderField; - [ - read, WmiDataId(6)] uint8 FieldByteArrayValue[16]; - [ - read, WmiDataId(7)] uint8 ResultByteArrayValue[16]; -}; - -[WMI, Dynamic, Provider("WMIProv"), -guid("{146360ac-88dd-11dd-94b8-001d09162bc3}")] -class MSNdis_ReceiveFilterParameters : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 Flags; - [ - read, WmiDataId(3)] uint32 FilterType; - [ - read, WmiDataId(4)] uint32 QueueId; - [ - read, write, WmiDataId(5)] uint32 FilterId; - [ - read, WmiDataId(6)] uint32 FieldParametersArrayOffset; - [ - read, WmiDataId(7)] uint32 FieldParametersArrayNumElements; - [ - read, WmiDataId(8)] uint32 FieldParametersArrayElementSize; - [ - read, WmiDataId(9)] uint32 RequestedFilterIdBitCount; - [ - read, WmiDataId(10), WmiSizeIs("FieldParametersArrayNumElements")] MSNdis_ReceiveFilterFieldParameters FieldParameters[]; - -}; - -[WMI, - guid("{db80dd1c-59ae-48e7-b7ec-f9be2c4b8cb0}")] -class MSNdis_NicSwitchCapabilities : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 Flags; - [ - read, WmiDataId(3)] uint32 NdisReserved1; - [ - read, WmiDataId(4)] uint32 NumTotalMacAddresses; - [ - read, WmiDataId(5)] uint32 NumMacAddressesPerPort; - [ - read, WmiDataId(6)] uint32 NumVlansPerPort; - [ - read, WmiDataId(7)] uint32 NdisReserved2; - [ - read, WmiDataId(8)] uint32 NdisReserved3; -}; - -[WMI, - guid("{f786fbd5-c049-11dd-b885-001d09162bc3}")] -class MSNdis_GroupAffinity : MSNdis -{ - [read, WmiDataId(1)] uint64 Mask; - [ - read, WmiDataId(2)] uint16 Group; - [ - read, WmiDataId(3)] uint16 Reserved[3]; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{f786fbd6-c049-11dd-b885-001d09162bc3}")] -class MSNdis_ReceiveQueueParameters : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 Flags; - [ - read, WmiDataId(3)] uint32 QueueType; - [ - read, write, WmiDataId(4)] uint32 QueueId; - [ - read, WmiDataId(5)] uint32 QueueGroupId; - [ - read, WmiDataId(6)] MSNdis_GroupAffinity ProcessorAffinity; - [ - read, WmiDataId(7)] uint32 NumSuggestedReceiveBuffers; - [ - read, WmiDataId(8)] uint32 MSIXTableEntry; - [ - read, WmiDataId(9)] uint32 LookaheadSize; - [ - read, WmiDataId(10)] MSNdis_CountedString VmName; - [ - read, WmiDataId(11)] MSNdis_CountedString QueueName; -}; - -[WMI, - guid("{f786fbd7-c049-11dd-b885-001d09162bc3}")] -class MSNdis_ReceiveQueueInfo : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 Flags; - [ - read, WmiDataId(3)] uint32 QueueType; - [ - read, WmiDataId(4)] uint32 QueueId; - [ - read, WmiDataId(5)] uint32 QueueGroupId; - [ - read, WmiDataId(6)] uint32 QueueState; - [ - read, WmiDataId(7)] MSNdis_GroupAffinity ProcessorAffinity; - [ - read, WmiDataId(8)] uint32 NumSuggestedReceiveBuffers; - [ - read, WmiDataId(9)] uint32 MSIXTableEntry; - [ - read, WmiDataId(10)] uint32 LookaheadSize; - [ - read, WmiDataId(11)] MSNdis_CountedString VmName; - [ - read, WmiDataId(12)] MSNdis_CountedString QueueName; -}; - -[WMI, - guid("{f786fbd8-c049-11dd-b885-001d09162bc3}")] -class MSNdis_ReceiveQueueInfoArray : MSNdis -{ - [read, WmiDataId(1)] MSNdis_ObjectHeader Header; - [ - read, WmiDataId(2)] uint32 FirstElementOffset; - [ - read, WmiDataId(3)] uint32 NumElements; - [ - read, WmiDataId(4)] uint32 ElementSize; - [ - read, WmiDataId(5), WmiSizeIs("NumElements")] MSNdis_ReceiveQueueInfo Queue[]; -}; - - -[WMI, Dynamic, Provider("WMIProv"), guid("{ba1f4c14-a945-4762-b916-0b5515b6f43a}"), - - WmiExpense(1), - Description("NDIS Query Link State") : amended] -class MSNdis_LinkState : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Link State"):amended - ] void WmiQueryLinkState([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("Link State of the adapter"):amended - ] MSNdis_LinkStateData LinkState); - -}; - - -[WMI, Dynamic, Provider("WMIProv"), guid("{d9c8eea5-f16e-467c-84d5-6345a22ce213}"), - - WmiExpense(1), - Description("NDIS Query Interrupt Moderation") : amended] -class MSNdis_QueryInterruptModeration : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Interrupt Moderation"):amended - ] void WmiQueryInterruptModeration([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("Interrupt Moderation of the adapter"):amended - ] MSNdis_InterruptModerationParameters InterruptModeration); - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{d789adfa-9c56-433b-ad01-7574f3cedbe9}"), - - WmiExpense(1), - Description("NDIS Set Interrupt Moderation") : amended] -class MSNdis_SetInterruptModeration : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Set Interrupt Moderation"):amended - ] void WmiSetInterruptModeration([in, Description("NDIS WMI Common Method Header"):amended - ] MSNdis_WmiMethodHeader MethodHeader, - [in, Description("Interrupt Moderation Parameters to set"):amended - ] MSNdis_InterruptModerationParameters InterruptModeration, - [out, Description("Output from Setting Interrupt Moderation of the adapter"):amended - ] MSNdis_WmiOutputInfo OutputInfo); -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{8c7d3579-252b-4614-82c5-a650daa15049}"), - - WmiExpense(1), - Description("NDIS Set Link Parameters") : amended] -class MSNdis_SetLinkParameters : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Set Link Parameters"):amended - ] void WmiSetLinkParameters([in, Description("NDIS WMI Common Method Header"):amended - ] MSNdis_WmiMethodHeader MethodHeader, - [in, Description("Link Parameters to set"):amended - ] MSNdis_LinkParameters LinkParameters, - [out, Description("Output from Setting Link Parameters of the adapter"):amended - ] MSNdis_WmiOutputInfo OutputInfo); -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{368c45b5-c129-43c1-939e-7edc2d7fe621}"), - - WmiExpense(1), - Description("NDIS Query Statistics Info") : amended] -class MSNdis_QueryStatisticsInfo : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Statistics Info"):amended - ] void WmiQueryStatisticsInfo([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("Statistics Info of the adapter"):amended - ] MSNdis_StatisticsInfo StatisticsInfo); - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{6fbf2a5f-8b8f-4920-8143-e6c460f52524}"), - - WmiExpense(1), - Description("NDIS Query Port State") : amended] -class MSNdis_QueryPortState : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Port State"):amended - ] void WmiQueryPortState([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("Port State of a sub-Interface of the adapter"):amended - ] MSNdis_PortStateData PortState); - -}; - - -[WMI, Dynamic, Provider("WMIProv"), guid("{f1d6abe8-15e4-4407-81b7-6b830c777cd9}"), - - WmiExpense(1), - Description("NDIS Query Ports on an Adapter") : amended] -class MSNdis_EnumeratePorts : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Ports on an Adapter"):amended - ] void WmiEnumeratePorts([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("Ports activated on the adapter"):amended - ] MSNdis_PortArray Ports); - -}; - - -[WMI, Dynamic, Provider("WMIProv"), guid("{aab6ac31-86fb-48fb-8b48-63db235ace16}"), - - WmiExpense(1), - Description("NDIS Set Port Auth Parameters on a Port") : amended] -class MSNdis_SetPortParameters : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Set Port Auth Parameters on a Port"):amended - ] void WmiSetPortParameters([in, Description("NDIS WMI Common Method Header"):amended - ] MSNdis_WmiMethodHeader MethodHeader, - [in, Description("Set Port Auth Parameters on a Port"):amended - ] MSNdis_PortAuthParameters PortParameters, - [out, Description("Result from Setting Port Auth Parameters"):amended - ] MSNdis_WmiOutputInfo OutputInfo); - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{aa39f5ab-e260-4d01-82b0-b737c880ea05}"), - - WmiExpense(1), - Description("NDIS Query PCI Device Custom Property") : amended] -class MSNdis_QueryPciDeviceCustomProperty : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query PCI Device Custom Property"):amended - ] void WmiQueryPciDeviceCustomProperty([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("PCI Device Custom Property of the adapter"):amended - ] MSNdis_PciDeviceProperty PciDeviceProperty); - -}; - - -[WMI, Dynamic, Provider("WMIProv"), guid("{16716917-4306-4be4-9b5a-3809ae44b125}"), - - WmiExpense(1), - Description("NDIS Enumerate Adapter EX.") : amended] -class MSNdis_EnumerateAdapterEx : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The Information about the Adapter.") : amended, - WmiDataId(1)] MSNdis_WmiEnumAdapter EnumerateAdapter; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{68542fed-5c74-461e-8934-91c6f9c60960}"), - - WmiExpense(1), - Description("NDIS Query TCP Offload Current Config") : amended] -class MSNdis_TcpOffloadCurrentConfig : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Current Offload Configuration"):amended - ] void WmiQueryCurrentOffloadConfig([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("Current Offload Configuration of the adapter"):amended - ] MSNdis_WmiOffload Offload); -}; - - -[WMI, Dynamic, Provider("WMIProv"), guid("{cd5f1102-590f-4ada-ab65-5b31b1dc0172}"), - - WmiExpense(1), - Description("NDIS Query TCP Offload Hardware Config") : amended] -class MSNdis_TcpOffloadHardwareConfig : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Hardware Offload Configuration"):amended - ] void WmiQueryHardwareOffloadConfig([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("Headware Offload Configuration of the adapter"):amended - ] MSNdis_WmiOffload Offload); -}; - - -[WMI, Dynamic, Provider("WMIProv"), guid("{8ead9a22-7f69-4bc6-949a-c8187b074e61}"), - - WmiExpense(1), - Description("NDIS Set TCP Offload Parameters") : amended] -class MSNdis_SetTcpOffloadParameters : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Set TCP Offload Parameters"):amended - ] void WmiSetTcpOffloadParameters([in, Description("NDIS WMI Common Method Header"):amended - ] MSNdis_WmiMethodHeader MethodHeader, - [in, Description("Set TCP Offload Parameters"):amended - ] MSNdis_TcpOffloadParameters TcpOffloadParameters, - [out, Description("Result from Setting TCP Offload Parameters"):amended - ] MSNdis_WmiOutputInfo OutputInfo); - -}; - - -[WMI, Dynamic, Provider("WMIProv"), guid("{2ee6aef1-0851-458b-bf0d-792343d1cde1}"), - - WmiExpense(1), - Description("NDIS Query TCP Connection Offload Current Config") : amended] -class MSNdis_TcpConnectionOffloadCurrentConfig : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query TCP Connection Offload Current Configuration"):amended - ] void WmiQueryTcpConnectionOffloadCurrentConfig( - [in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("TCP Connection Offload Current Configuration of the adapter"):amended - ] MSNdis_WmiTcpConnectionOffload Offload); -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{8ce71f2c-d63a-4390-a487-18fa47262ceb}"), - - WmiExpense(1), - Description("NDIS Query TCP Connection Offload Hardware Config") : amended] -class MSNdis_TcpConnectionOffloadHardwareConfig : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query TCP Connection Offload Hardware Configuration"):amended - ] void WmiQueryTcpConnectionOffloadHardwareConfig( - [in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("TCP Connection Offload Hardware Configuration of the adapter"):amended - ] MSNdis_WmiTcpConnectionOffload Offload); -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{26c28774-4252-48fe-a610-a58a398c0eb1}"), - - WmiExpense(1), - Description("NDIS Query RSS Capabilities") : amended] -class MSNdis_ReceiveScaleCapabilities : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query RSS Capabilities"):amended - ] void WmiQueryReceiveScaleCapabilities( - [in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("RSS capabilities of the adapter"):amended - ] MSNdis_WmiReceiveScaleCapabilities RssCaps); -}; - -// -// GUID_NDIS_HD_SPLIT_CURRENT_CONFIG -// - -[WMI, Dynamic, Provider("WMIProv"), guid("{81d1303c-ab00-4e49-80b1-5e6e0bf9be53}"), - - WmiExpense(1), - Description("NDIS Query Header/Data Split Current Config") : amended] -class MSNdis_HDSplitCurrentConfig : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Header/Data split Current Config"):amended - ] void WmiQueryHDSplitCurrentConfig( - [in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("Header/Data split Current Config of the adapter"):amended - ] MSNdis_WmiHDSplitCurrentConfig HdSplitCurrentConfig); -}; - -// -// GUID_NDIS_HD_SPLIT_PARAMETERS -// - -[WMI, Dynamic, Provider("WMIProv"), guid("{8c048bea-2913-4458-b68e-17f6c1e5c60e}"), - - WmiExpense(1), - Description("NDIS Set Header/Data Split Parameters") : amended] -class MSNdis_SetHDSplitParameters : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Set Header/Data split Parameters"):amended - ] void WmiSetHDSplitParameters([in, Description("NDIS WMI Common Method Header"):amended - ] MSNdis_WmiMethodHeader MethodHeader, - [in, Description("Set Header/Data Split Parameters"):amended - ] MSNdis_HDSplitParameters HDSplitParameters, - [out, Description("Result from Setting Header/ Split Parameters"):amended - ] MSNdis_WmiOutputInfo OutputInfo); - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{899e7782-035b-43f9-8bb6-2b58971612e5}"), - - WmiExpense(1), - Description("NDIS Query Physical Medium Type Ex") : amended] -class MSNdis_QueryPhysicalMediumTypeEx : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query NDIS Physical Medium Type (Ex) of the NIC"):amended - ] void WmiQueryPhysicalMediumTypeEx([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("Physical Medium type (Ex) of the adapter"):amended - ] uint32 NdisPhysicalMediumTypeEx); - -}; - -// -// Guids for NDIS Receive Filters -// -[WMI, Dynamic, Provider("WMIProv"), guid("{3f2c1419-83bc-11dd-94b8-001d09162bc3}"), - - WmiExpense(1), - Description("NDIS Query Receive Filter Hardware Capabilities") : amended] -class MSNdis_QueryReceiveFilterHardwareCapabilities : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Receive Filter Hardware capabilities"):amended - ] void WmiQueryReceiveFilterHardwareCapabilities([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("Receive filter hardware capabilities of the adapter"):amended - ] MSNdis_ReceiveFilterCapabilities ReceiveFilterHardwareCapabilities); - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{3f2c141a-83bc-11dd-94b8-001d09162bc3}"), - - WmiExpense(1), - Description("NDIS Query Receive Filter Global Parameters") : amended] -class MSNdis_QueryReceiveFilterGlobalParameters : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Receive Filter Global Parameters"):amended - ] void WmiQueryReceiveFilterGlobalParameters([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("Receive filter global parameters of the adapter"):amended - ] MSNdis_ReceiveFilterGlobalParameters ReceiveFilterGlobalParameters); - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{3f2c141d-83bc-11dd-94b8-001d09162bc3}"), - - WmiExpense(1), - Description("NDIS Enumerate Receive Filters") : amended] -class MSNdis_EnumerateReceiveFilters : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Enumerate Receive Filters"):amended - ] void WmiEnumReceiveFilters([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [in, out, Description("Enumeration of Receive Filters on a queue"):amended - ] MSNdis_ReceiveFilterInfoArray ReceiveFilterInfoArray); - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{3f2c141e-83bc-11dd-94b8-001d09162bc3}"), - - WmiExpense(1), - Description("NDIS Receive Filter Parameters") : amended] -class MSNdis_QueryReceiveFilterParameters : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Receive Filter Parameters"):amended - ] void WmiQueryReceiveFilterParameters([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [in, out, Description("Receive Filter Parameters"):amended - ] MSNdis_ReceiveFilterParameters ReceiveFilterParameters); - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{4054e80f-2bc1-4ccc-b033-4abc0c4a1e8c}"), - - WmiExpense(1), - Description("NDIS Query Receive Filter Current Capabilities") : amended] -class MSNdis_QueryReceiveFilterCurrentCapabilities : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Receive Filter Current capabilities"):amended - ] void WmiQueryReceiveFilterCurrentCapabilities([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("Receive filter current capabilities of the adapter"):amended - ] MSNdis_ReceiveFilterCapabilities ReceiveFilterCurrentCapabilities); - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{37cab40c-d1e8-4301-8c1d-58465e0c4c0f}"), - - WmiExpense(1), - Description("NDIS Query NIC Switch Hardware Capabilities") : amended] -class MSNdis_QueryNicSwitchHardwareCapabilities : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query NIC Switch Hardware Capabilities"):amended - ] void WmiQueryNICSwitchHardwareCapabilities([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("NIC Switch hardware capabilities of the adapter"):amended - ] MSNdis_NicSwitchCapabilities NicSwitchHardwareCapabilities); - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{e76fdaf3-0be7-4d95-87e9-5aead4b590e9}"), - - WmiExpense(1), - Description("NDIS Query NIC Switch Current Capabilities") : amended] -class MSNdis_QueryNicSwitchCurrentCapabilities : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query NIC Switch Current Capabilities"):amended - ] void WmiQueryNICSwitchCurrentCapabilities([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [out, Description("NIC Switch Current capabilities of the adapter"):amended - ] MSNdis_NicSwitchCapabilities NicSwitchCurrentCapabilities); - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{3f2c141c-83bc-11dd-94b8-001d09162bc3}"), - - WmiExpense(1), - Description("NDIS Receive Queue Parameters") : amended] -class MSNdis_QueryReceiveQueueParameters : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Query Receive Queue Parameters"):amended - ] void WmiQueryReceiveQueueParameters([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [in, out, Description("Receive Queue Parameters"):amended - ] MSNdis_ReceiveQueueParameters ReceiveQueueParameters); - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{3f2c141b-83bc-11dd-94b8-001d09162bc3}"), - - WmiExpense(1), - Description("NDIS Enumerate Receive Queues") : amended] -class MSNdis_EnumerateReceiveQueues : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [WmiMethodId(1), - Implemented, - Description("Enumerate Receive Queues"):amended - ] void WmiEnumReceiveQueues([in, Description("NDIS WMI Method Common Header"):amended - ] MSNdis_WmiMethodHeader Header, - [in, out, Description("Enumeration of Receive queues on a miniport"):amended - ] MSNdis_ReceiveQueueInfoArray ReceiveQueueInfoArray); - -}; - - - -/// -/// -/// Wireless (802.11) specific GUIDs -/// - -/// -/// OID_802_11_BSSID: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{2504b6c2-1fa5-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 Base Service Set Identifier: the MAC address of the associated access point. Writing this is useful when doing a site survey.") : amended] -class MSNdis_80211_BaseServiceSetIdentifier : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The 802.11 access point MAC address.") : amended, - WmiDataId(1)] uint8 Ndis80211MacAddress[6]; -}; - - -/// -/// OID_802_11_SSID: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{7d2a90ea-2041-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 Service Set Identifier string that identifies a set of interconnected basic service sets. This is a NULL terminated ANSI string up to 32 characters long.") : amended] -class MSNdis_80211_ServiceSetIdentifier : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("SSID string") : amended, - WmiDataId(1)] uint8 Ndis80211SsId[33]; -}; - - -/// -/// Embedded class definition for _NDIS_802_11_NETWORK_TYPE. -/// -[WMI, guid("{e779ab61-b9ab-11d4-b675-002048570337}")] -class MSNdis_80211_NetworkType : MSNdis -{ - [ - Description("NDIS 802.11 network type") : amended, - Values{"Ndis802_11FH", - "Ndis802_11DS"} : amended, - ValueMap{"0", - "1"}, - WmiDataId(1)] uint32 Ndis80211NetworkType; -}; - -/// -/// OID_802_11_NETWORK_TYPES_SUPPORTED: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{8531d6e6-2041-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 supported network types") : amended] -class MSNdis_80211_NetworkTypesSupported : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of items in list of 802.11 network types") : amended, - WmiDataId(1)] uint32 NumberOfItems; - [ - read, - Description("List of NDIS 802.11 network types") : amended, - WmiDataId(2), - WmiSizeIs("NumberOfItems")] - MSNdis_80211_NetworkType Ndis80211NetworkTypes[]; -}; - - -/// -/// OID_802_11_NETWORK_TYPE_IN_USE: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{857e2326-2041-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 network type in use determines whether the station uses Frequency Hopping Spread Spectrum or Direct Sequence Spread Spectrum.") : amended] -class MSNdis_80211_NetworkTypeInUse : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The 802.11 network type") : amended, - WmiDataId(1)] - MSNdis_80211_NetworkType Ndis80211NetworkTypeInUse; -}; - - -/// -/// OID_802_11_POWER_MODE: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{85be837c-2041-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 Power Mode") : amended] -class MSNdis_80211_PowerMode : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The current 802.11 power mode") : amended, - Values{"Ndis802_11PowerModeCAM", - "Ndis802_11PowerModeMAX_PSP", - "Ndis802_11PowerModeFast_PSP"} : amended, - ValueMap{"0", - "1", - "2"}, - WmiDataId(1)] uint32 Ndis80211PowerMode; -}; - - -/// -/// OID_802_11_TX_POWER_LEVEL: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{11e6ba76-2053-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 Transmit power level") : amended] -class MSNdis_80211_TransmitPowerLevel : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The 802.11 transmit power level in mW") : amended, - WmiDataId(1)] uint32 Ndis80211TransmitPowerLevel; -}; - - -/// -/// OID_802_11_RSSI: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{1507db16-2053-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 Received Signal Strength Indication") : amended] -class MSNdis_80211_ReceivedSignalStrength : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The 802.11 received signal strength in dBm") : amended, - WmiDataId(1)] sint32 Ndis80211ReceivedSignalStrength; -}; - - -/// -/// OID_802_11_RSSI_TRIGGER: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{155689b8-2053-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 Received Signal Strength Indication event trigger. An event of class MSNdis_80211_ReceivedSignalStrengthEvent is generated when the current RSSI goes past the trigger value.") : amended] -class MSNdis_80211_ReceivedSignalStrengthEventTrigger : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The 802.11 RSSI trigger value in dBm") : amended, - WmiDataId(1)] sint32 Ndis80211ReceivedSignalStrengthTrigger; -}; - - -/// -/// Embedded class definition for _NDIS_802_11_NETWORK_INFRASTRUCTURE. -/// -[WMI, guid("{34e1fa48-b9b6-11d4-b675-002048570337}")] -class MSNdis_80211_NetworkInfrastructure : MSNdis -{ - [ - Description("The 802.11 infrastructure mode") : amended, - Values{"Ndis802_11IBSS", - "Ndis802_11Infrastructure", - "Ndis802_11AutoUnknown"}, - ValueMap{"0", - "1", - "2"}, - WmiDataId(1)] uint32 Ndis80211NetworkInfrastructure; -}; - - -/// -/// -/// Embedded class definition for _NDIS_802_11_CONFIGURATION_FH. -/// This is used with MSNdis_80211_Configuration (below). -/// -/// -[WMI, guid("{4a800b8c-2068-11d4-97eb-00c04f79c403}")] -class MSNdis_80211_ConfigurationFH : MSNdis -{ - [ - WmiDataId(1)] uint32 FHLength; - [ - WmiDataId(2)] uint32 HopPattern; - [ - WmiDataId(3)] uint32 HopSet; - [ - WmiDataId(4)] uint32 DwellTime; -}; - - -/// -/// -/// Embedded class definition for _NDIS_802_11_CONFIGURATION. This -/// is used with OID_802_11_CONFIGURATION and OID_802_11_BSSID_LIST. -/// -/// -[WMI, guid("{220c16fc-b9a8-11d4-b675-002048570337}")] -class MSNdis_80211_ConfigurationInfo : MSNdis -{ - [ - Description("Length of configuration structure") : amended, - WmiDataId(1)] uint32 ConfigLength; - [ - Description("Beacon period in Kusec") : amended, - WmiDataId(2)] uint32 BeaconPeriod; - [ - Description("Announcement Traffic Indication Message (ATIM) Window in Kusec") : amended, - WmiDataId(3)] uint32 ATIMWindow; - [ - Description("Frequency in kHz") : amended, - WmiDataId(4)] uint32 DSConfig; - [ - Description("Radio configuration parameters") : amended, - WmiDataId(5)] MSNdis_80211_ConfigurationFH FHConfig; -}; - - -/// -/// -/// Embedded class definition for _NDIS_WLAN_BSSID. This is used in -/// OID_802_11_BSSID_LIST (below). -/// -/// -[WMI, guid("{6929e718-2062-11d4-97eb-00c04f79c403}")] -class MSNdis_80211_WLanBssId : MSNdis -{ - [ - WmiDataId(1)] uint32 Ndis80211WLanBssIdLength; - [ - WmiDataId(2)] uint8 Ndis80211MacAddress[6]; - [ - WmiDataId(3)] uint16 Reserved; - [ - WmiDataId(4)] uint32 Ndis80211SsIdLength; - [ - WmiDataId(5)] uint8 Ndis80211SsId[32]; - [ - WmiDataId(6)] uint32 Ndis80211Privacy; - [ - WmiDataId(7)] uint32 Ndis80211Rssi; - [ - WmiDataId(8)] MSNdis_80211_NetworkType Ndis80211NetworkTypeInUse; - [ - WmiDataId(9)] MSNdis_80211_ConfigurationInfo Ndis80211Configuration; - [ - WmiDataId(10)] MSNdis_80211_NetworkInfrastructure Ndis80211InfrastructureMode; - [ - WmiDataId(11)] uint8 Ndis80211SupportedRate[8]; -}; - - -/// -/// OID_802_11_BSSID_LIST: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{69526f9a-2062-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 Base Service Set Identifier list. This is a list of all BSSID in range, their SSID and RSSI.") : amended] -class MSNdis_80211_BSSIList : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of items in list of 802.11 BSSI") : amended, - WmiDataId(1)] uint32 NumberOfItems; - [ - read, - Description("The list of in-range BSSIDs and their properties") : amended, - WmiDataId(2), - WmiSizeIs("NumberOfItems")] - MSNdis_80211_WLanBssId Ndis80211BSSIList[]; -}; - - -/// -/// OID_802_11_INFRASTRUCTURE_MODE: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{697d5a7e-2062-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 Infrastructure mode - defines how the device connects to the network.") : amended] -class MSNdis_80211_InfrastructureMode : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - WmiDataId(1)] MSNdis_80211_NetworkInfrastructure Ndis80211InfrastructureMode; -}; - - -/// -/// OID_802_11_FRAGMENTATION_THRESHOLD: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{69aaa7c4-2062-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("The size beyond which the 802.11 device should fragment packets") : amended] -class MSNdis_80211_FragmentationThreshold : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The 802.11 fragmentation threshold in bytes") : amended, - WmiDataId(1)] uint32 Ndis80211FragmentationThreshold; -}; - - - -/// -/// OID_802_11_RTS_THRESHOLD: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{0134d07e-2064-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("The size beyond which the 802.11 device should invoke the RTS/CTS mechanism") : amended] -class MSNdis_80211_RTSThreshold : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The 802.11 RTS threshold, in bytes") : amended, - WmiDataId(1)] uint32 Ndis80211RTSThreshold; -}; - - -/// -/// OID_802_11_NUMBER_OF_ANTENNAS: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{01779336-2064-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("The number of antennas on the 802.11 radio.") : amended] -class MSNdis_80211_NumberOfAntennas : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The number of antennas") : amended, - WmiDataId(1)] uint32 Ndis80211NumberOfAntennas; -}; - - -/// -/// OID_802_11_RX_ANTENNA_SELECTED: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{01ac07a2-2064-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("The antenna selected for receiving on the radio of the 802.11 device") : amended] -class MSNdis_80211_ReceiveAntennaSelected : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The receive antenna number") : amended, - WmiDataId(1)] uint32 Ndis80211ReceiveAntennaSelected; -}; - - - -/// -/// OID_802_11_TX_ANTENNA_SELECTED: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{01dbb74a-2064-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("The antenna selected for transmitting on the radio of the 802.11 device") : amended] -class MSNdis_80211_TransmitAntennaSelected : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("The transmit antenna number") : amended, - WmiDataId(1)] uint32 Ndis80211TransmitAntennaSelected; -}; - - -/// -/// OID_802_11_SUPPORTED_RATES -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{49db8722-2068-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("A set of supported NDIS 802.11 data rates in the operational rate set that the radio is capable of running at.") : amended] -class MSNdis_80211_DataRates : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - [ - read, - Description("The list of data rates, in units of 0.5 Mbps") : amended, - WmiDataId(1)] uint8 Ndis80211DataRate[8]; -}; - - -/// -/// OID_802_11_DESIRED_RATES: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{452ee08e-2536-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 data rates that are desirable for the radio to operate in.") : amended] -class MSNdis_80211_DesiredDataRates : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - [ - read, - Description("The list of desired data rates, in units of 0.5 Mbps") : amended, - WmiDataId(1)] uint8 Ndis80211DesiredRate[8]; -}; - -/// -/// OID_802_11_CONFIGURATION: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{4a4df982-2068-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 device radio configuration parameters") : amended] -class MSNdis_80211_Configuration : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - WmiDataId(1)] MSNdis_80211_ConfigurationInfo Ndis80211Config; -}; - - -/// -/// OID_802_11_STATISTICS: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{42bb73b0-2129-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 device statistics") : amended] -class MSNdis_80211_Statistics : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Length of the statistics structure") : amended, - WmiDataId(1)] uint32 StatisticsLength; - [ - read, - Description("Number of transmitted fragments") : amended, - WmiDataId(2)] uint64 TransmittedFragmentCount; - [ - read, - Description("Number of transmitted multicast frames") : amended, - WmiDataId(3)] uint64 MulticastTransmittedFrameCount; - [ - read, - Description("Number of failures") : amended, - WmiDataId(4)] uint64 FailedCount; - [ - read, - Description("Number of retries") : amended, - WmiDataId(5)] uint64 RetryCount; - [ - read, - Description("Number of multiple retries") : amended, - WmiDataId(6)] uint64 MultipleRetryCount; - [ - read, - Description("Number of Request To Send success") : amended, - WmiDataId(7)] uint64 RTSSuccessCount; - [ - read, - Description("Number of Request To Send failures") : amended, - WmiDataId(8)] uint64 RTSFailureCount; - [ - read, - Description("Number of Acknowledgement failures") : amended, - WmiDataId(9)] uint64 ACKFailureCount; - [ - read, - Description("Number of duplicate frames") : amended, - WmiDataId(10)] uint64 FrameDuplicateCount; - [ - read, - Description("Number of received fragments") : amended, - WmiDataId(11)] uint64 ReceivedFragmentCount; - [ - read, - Description("Number of received multicast frames") : amended, - WmiDataId(12)] uint64 MulticastReceivedFrameCount; - [ - read, - Description("Number of frame checksum errors") : amended, - WmiDataId(13)] uint64 FCSErrorCount; -}; - - -/// -/// OID_802_11_ADD_WEP: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{4307bff0-2129-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("Set a WEP key to the NDIS 802.11 device") : amended] -class MSNdis_80211_AddWEP : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - write, - Description("Length of 802.11 WEP structure") : amended, - WmiDataId(1)] uint32 Length; - [ - write, - Description("WEP key index") : amended, - WmiDataId(2)] uint32 KeyIndex; - [ - write, - Description("WEP key length in bytes") : amended, - WmiDataId(3)] uint32 KeyLength; - [ - write, - Description("WEP key index") : amended, - WmiDataId(4), WmiSizeIs("KeyLength")] - uint8 KeyMaterial[]; -}; - - -/// -/// OID_802_11_REMOVE_WEP: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{433c345c-2129-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("Remove a WEP key on the NDIS 802.11 device") : amended] -class MSNdis_80211_RemoveWEP : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - write, - Description("The NDIS 802.11 WEP key index") : amended, - WmiDataId(1)] uint32 Ndis80211KeyIndex; -}; - - -/// -/// OID_802_11_DISASSOCIATE: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{43671f40-2129-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("Disassociate the NDIS 802.11 device with the current SSID") : amended] -class MSNdis_80211_Disassociate : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - [ - write, - Description("Unused parameter") : amended, - WmiDataId(1)] uint32 UnusedParameter; -}; - - -/// -/// OID_802_11_BSSID_LIST_SCAN: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{0d9e01e1-ba70-11d4-b675-002048570337}"), - - WmiExpense(1), - Description("Perform a survey to refresh the NDIS 802.11 BSS list") : amended] -class MSNdis_80211_BssIdListScan : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - [ - write, - Description("Unused parameter") : amended, - WmiDataId(1)] uint32 UnusedParameter; -}; - - - -/// -/// OID_802_11_AUTHENTICATION_MODE: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{43920a24-2129-11d4-97eb-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 Authentication Mode") : amended] -class MSNdis_80211_AuthenticationMode : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("NDIS 802.11 authentication mode setting") : amended, - Values{"Ndis802_11AuthModeOpen", - "Ndis802_11AuthModeShared", - "Ndis802_11AuthModeAutoSwitch"}, - ValueMap{"0", - "1", - "2"}, - WmiDataId(1)] uint32 Ndis80211AuthenticationMode; -}; - - -/// -/// OID_802_11_PRIVACY_FILTER: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{6733c4e9-4792-11d4-97f1-00c04f79c403}"), - - WmiExpense(1), - Description("NDIS 802.11 Privacy Filter") : amended] -class MSNdis_80211_PrivacyFilter : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("NDIS 802.11 privacy filter setting") : amended, - Values{"Ndis802_11PrivFilterAcceptAll", - "Ndis802_11PrivFilter8021xWEP"}, - ValueMap{"0", - "1"}, - WmiDataId(1)] uint32 Ndis80211PrivacyFilter; -}; - - - -/// -/// OID_802_11_WEP_STATUS: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{b027a21f-3cfa-4125-800b-3f7a18fddcdc}"), - - WmiExpense(1), - Description("NDIS 802.11 WEP Status") : amended] -class MSNdis_80211_WEPStatus : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("NDIS 802.11 WEP Status setting") : amended, - Values{"Ndis802_11WEPEnabled", - "Ndis802_11WEPDisabled", - "Ndis802_11WEPKeyAbsent", - "Ndis802_11WEPNotSupported"}, - ValueMap{"0", - "1", - "2", - "3"}, - WmiDataId(1)] uint32 Ndis80211WEPStatus; -}; - - -/// -/// OID_802_11_RELOAD_DEFAULTS: -/// -[WMI, Dynamic, Provider("WMIProv"), guid("{748b14e8-32ee-4425-b91b-c9848c58b55a}"), - - WmiExpense(1), - Description("NDIS 802.11 Reload Default Settings") : amended] -class MSNdis_80211_ReloadDefaults : MSNdis -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - write, - Description("The parameter(s) to be reloaded to default settings") : amended, - Values{"Ndis802_11ReloadWEPKeys"} : amended, - ValueMap{"0"}, - WmiDataId(1)] uint32 Ndis80211ReloadDefaults; -}; - - -/// -/// Embedded class definition for NDIS_PM_ADMIN_CONFIG_STATE -/// -[WMI, guid("{0cffd0fc-8333-4000-9a3b-200735d698f9}")] -class MSNdis_PMAdminConfigState : MSNdis -{ - [Values{"NdisPMAdminConfigStateUnspecified", - "NdisPMAdminConfigStateDisabled", - "NdisPMAdminConfigStateEnabled"}, - ValueMap{"0", - "1", - "2"}, - WmiDataId(1)] - uint32 NdisPMAdminConfigState; -}; - -/// -/// Embedded class definition for NDIS_WMI_PM_ADMIN_CONFIG -/// -[WMI, guid("{492dc449-13d9-4bd6-89d4-96e3534e6a05}")] -class MSNdis_PMAdminConfigParam : MSNdis -{ - [WmiDataId(1)] - MSNdis_ObjectHeader Header; - [WmiDataId(2)] - MSNdis_PMAdminConfigState WakeOnPattern; - [WmiDataId(3)] - MSNdis_PMAdminConfigState WakeOnMagicPacket; - [WmiDataId(4)] - MSNdis_PMAdminConfigState DeviceSleepOnDisconnect; - [WmiDataId(5)] - MSNdis_PMAdminConfigState PMARPOffload; - [WmiDataId(6)] - MSNdis_PMAdminConfigState PMNDOffload; - [WmiDataId(7)] - MSNdis_PMAdminConfigState PMWiFiRekeyOffload; -}; - -/// -/// GUID_NDIS_PM_ADMIN_CONFIG -/// -[WMI, Dynamic, Provider("WMIProv"), - guid("{1528D111-708A-4ca4-9215-C05771161CDA}"), - Description("Control power management related standardized keywords")] -class MSNdis_PMAdminConfig : MSNdis -{ - [key, read] - string InstanceName; - [read] - boolean Active; - - [read, write, WmiDataId(1)] - MSNdis_PMAdminConfigParam PMAdminConfigParam; -}; - -/// -/// Embedded class definition for NDIS_PM_CAPABILITY_STATE -/// -[WMI, guid("{C1CC6857-1A26-4f6d-AB98-291F0C3BBD4C}")] -class MSNdis_PMCapabilityState : MSNdis -{ - [Values{"NdisPMAdminConfigUnsupported", - "NdisPMAdminConfigInactive", - "NdisPMAdminConfigActive"}, - ValueMap{"0", - "1", - "2"}, - WmiDataId(1)] - uint32 NdisPMCapabilityState; -}; - -/// -/// Embedded class definition for NDIS_WMI_PM_ACTIVE_CAPABILITIES -/// -[WMI, guid("{CCCB122D-D5C4-4ee1-8001-B8AD6D3CE876}")] -class MSNdis_PMCapabilitiesParam : MSNdis -{ - [WmiDataId(1)] - MSNdis_ObjectHeader Header; - [WmiDataId(2)] - MSNdis_PMCapabilityState WakeOnPattern; - [WmiDataId(3)] - MSNdis_PMCapabilityState WakeOnMagicPacket; - [WmiDataId(4)] - MSNdis_PMCapabilityState DeviceSleepOnDisconnect; - [WmiDataId(5)] - MSNdis_PMCapabilityState PMARPOffload; - [WmiDataId(6)] - MSNdis_PMCapabilityState PMNDOffload; - [WmiDataId(7)] - MSNdis_PMCapabilityState PMWiFiRekeyOffload; -}; - -/// -/// GUID_NDIS_PM_ACTIVE_CAPABILITIES -/// -[WMI, Dynamic, Provider("WMIProv"), - guid("{B2CF76E3-B3AE-4394-A01F-338C9870E939}"), - Description("Query power management active capabilities")] -class MSNdis_PMCapabilities : MSNdis -{ - [key, read] - string InstanceName; - [read] - boolean Active; - - [read, WmiDataId(1)] - MSNdis_PMCapabilitiesParam PMCapabilitiesParam; -}; - - -/// -/// -/// NDIS status specific GUIDs -/// -/// - - -[WMI, Dynamic, Provider("WMIProv"), guid("{981f2d76-b1f3-11d0-8dd7-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Status Reset Start") : amended] -class MSNdis_StatusResetStart : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{981f2d77-b1f3-11d0-8dd7-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Status Reset End") : amended] -class MSNdis_StatusResetEnd : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{981f2d7d-b1f3-11d0-8dd7-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Status Media Connect") : amended] -class MSNdis_StatusMediaConnect : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{981f2d7e-b1f3-11d0-8dd7-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Status Media Disconnect") : amended] -class MSNdis_StatusMediaDisconnect : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{981f2d84-b1f3-11d0-8dd7-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Status Media Specific Indication") : amended] -class MSNdis_StatusMediaSpecificIndication : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for media specific status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Media specific status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusMediaSpecificIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{981f2d85-b1f3-11d0-8dd7-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Status Link Speed Change") : amended] -class MSNdis_StatusLinkSpeedChange : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("New inbound and outbound link speeds for the adapter.") : amended, - WmiDataId(1)] MSNdis_NetworkLinkSpeed NdisStatusLinkSpeedChange; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{5413531c-b1f3-11d0-d78d-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Protocol Bind Notification") : amended] -class MSNdis_StatusProtocolBind : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Name of transport bound") : amended, - WmiDataId(1)] string Transport; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{6e3ce1ec-b1f3-11d0-d78d-00c04fc3358c}"), - - WmiExpense(1), - Description("NDIS Protocol Unbind Notification") : amended] -class MSNdis_StatusProtocolUnbind : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Name of transport unbound") : amended, - WmiDataId(1)] string Transport; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{5f81cfd0-f046-4342-61af-895acedaefd9}"), - - WmiExpense(1), - Description("NDIS Device Power On Notification") : amended] -class MSNdis_StatusDevicePowerOn : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Name of device powered on") : amended, - WmiDataId(1)] string Device; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{81bc8189-b026-46ab-64b9-f182e342934e}"), - - WmiExpense(1), - Description("NDIS Device Power Off Notification") : amended] -class MSNdis_StatusDevicePowerOff : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Name of device powered off") : amended, - WmiDataId(1)] string Device; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{2b440188-92ac-4f60-9b2d-20a30cbb6bbe}"), - - WmiExpense(1), - Description("NDIS Device Power On Ex Notification") : amended] -class MSNdis_StatusDevicePowerOnEx : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Name of device powered on") : amended, - WmiDataId(1)] string Device; -}; - -[WMI, Dynamic, Provider("WMIProv"), - guid("{4159353c-5cd7-42ce-8fe4-a45a2380cc4f}"), - - WmiExpense(1), - Description("NDIS Device Power Off Ex Notification") : amended] -class MSNdis_StatusDevicePowerOffEx : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Name of device powered off") : amended, - WmiDataId(1)] string Device; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{45049fc6-54d8-40c8-9c3d-b011c4e715bc}"), - - WmiExpense(1), - Description("NDIS Status Task Offload Change") : amended] -class MSNdis_StatusTaskOffloadChange : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for task offload change indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("New Task Offload Capabilities.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 TaskOffloadCapabilities[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{d47c5407-2e75-46dd-8146-1d7ed2d6ab1d}"), - - WmiExpense(1), - Description("NDIS Status Packet Filter Change") : amended] -class MSNdis_StatusPacketFilterChange : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - - [ - read, - Description("Number of bytes for packet filter status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Packet Filter status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisPacketFilterStatusIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{ca8a56f9-ce81-40e6-a70f-a067a476e9e9}"), - - WmiExpense(1), - Description("NDIS Status Network Change") : amended] -class MSNdis_StatusNetworkChange : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - [ - read, - Description("Number of bytes for network change status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Network Change status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisNetworkChangeStatusIndication[]; - -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{f917b663-845e-4d3d-b6d4-15eb27af81c5}"), - - WmiExpense(1), - Description("NDIS Status Operational Status") : amended] -class MSNdis_StatusOperationalStatus : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for operational status status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Operational Status status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisOperationalStatusStatusIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{64c6f797-878c-4311-9246-65dba89c3a61}"), - - WmiExpense(1), - Description("NDIS Status Link State Change") : amended] -class MSNdis_StatusLinkState : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for link state status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Link State status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisLinkStateStatusIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{1dac0dfe-43e5-44b7-b759-7bf46de32e81}"), - - WmiExpense(1), - Description("NDIS Status Port State Change") : amended] -class MSNdis_StatusPortState : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for port state status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Port State status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisPortStateStatusIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{aaacfca7-954a-4632-a16e-a8a63793a9e5}"), - - WmiExpense(1), - Description("NDIS 6 Status Media Specific Status Indication") : amended] -class MSNdis_StatusMediaSpecificIndicationEx : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for media specific status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Media Specific status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusMediaSpecificIndication[]; -}; - -// -// GUID_NDIS_STATUS_HD_SPLIT_CURRENT_CONFIG -// - -[WMI, Dynamic, Provider("WMIProv"), guid("{6c744b0e-ee9c-4205-90a2-015f6d65f403}"), - - WmiExpense(1), - Description("NDIS Status Header/Data Split Current Config") : amended] -class MSNdis_StatusHDSplitCurrentConfig : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for header/data split current config change indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("New Header/Data split configuration.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 HDSplitCurrentConfig[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{8500591e-a0c7-4efb-9342-b674b002cbe6}"), - WmiExpense(1), - Description("NDIS Dot11 Scan Confirm Status Indication") : amended] -class MSNdis_StatusDot11ScanConfirm : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 scan confirm status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 Scan Confirm status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11ScanConfirmIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{1d6560ec-8e48-4a3e-9fd5-a01b698db6c5}"), - WmiExpense(1), - Description("NDIS Dot11 MPDU Max Length Change Status Indication") : amended] -class MSNdis_StatusDot11MPDUMaxLengthChange : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 MPDU max length change status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 MPDU Max Length Change status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11MPDUMaxLengthChangeIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{3927843b-6980-4b48-b15b-4de50977ac40}"), - WmiExpense(1), - Description("NDIS Dot11 Association Start Status Indication") : amended] -class MSNdis_StatusDot11AssociationStart : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 association start status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 Association Start status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11AssociationStartIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{458bbea7-45a4-4ae2-b176-e51f96fc0568}"), - WmiExpense(1), - Description("NDIS Dot11 Association Completion Status Indication") : amended] -class MSNdis_StatusDot11AssociationCompletion : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 association completion status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 Association Completion status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11AssociationCompletionIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{7b74299d-998f-4454-ad08-c5af28576d1b}"), - WmiExpense(1), - Description("NDIS Dot11 Connection Start Status Indication") : amended] -class MSNdis_StatusDot11ConnectionStart : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 connection start status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 Connection Start status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11ConnectionStartIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{96efd9c9-7f1b-4a89-bc04-3e9e271765f1}"), - WmiExpense(1), - Description("NDIS Dot11 Connection Completion Status Indication") : amended] -class MSNdis_StatusDot11ConnectionCompletion : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 connection completion status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 Connection Completion status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11ConnectionCompletionIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{b2412d0d-26c8-4f4e-93df-f7b705a0b433}"), - WmiExpense(1), - Description("NDIS Dot11 Roaming Start Status Indication") : amended] -class MSNdis_StatusDot11RoamingStart : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 roaming start status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 Roaming Start status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11RoamingStartIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{dd9d47d1-282b-41e4-b924-66368817fcd3}"), - WmiExpense(1), - Description("NDIS Dot11 Roaming Completion Status Indication") : amended] -class MSNdis_StatusDot11RoamingCompletion : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 roaming completion status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 Roaming Completion status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11RoamingCompletionIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{3fbeb6fc-0fe2-43fd-b2ad-bd99b5f93e13}"), - WmiExpense(1), - Description("NDIS Dot11 Disassociation Status Indication") : amended] -class MSNdis_StatusDot11Disassociation : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 disassociation status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 Disassociation status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11DisassociationIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{442c2ae4-9bc5-4b90-a889-455ef220f4ee}"), - WmiExpense(1), - Description("NDIS Dot11 TKIPMIC Failure Status Indication") : amended] -class MSNdis_StatusDot11TkipmicFailure : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 TKIPMIC Failure status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 TKIPMIC Failure status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11TkipmicFailureIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{26d8b8f6-db82-49eb-8bf3-4c130ef06950}"), - WmiExpense(1), - Description("NDIS Dot11 PMKID Candidate List Status Indication") : amended] -class MSNdis_StatusDot11PmkidCandidateList : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 PMKID candidate list status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 PMKID Candidate List status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11PmkidCandidateListIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{deb45316-71b5-4736-bdef-0a9e9f4e62dc}"), - WmiExpense(1), - Description("NDIS Dot11 Phy State Change Status Indication") : amended] -class MSNdis_StatusDot11PhyStateChange : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 Phy State change status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 Phy State Change status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11PhyStateChangeIndication[]; -}; - -[WMI, Dynamic, Provider("WMIProv"), guid("{a3285184-ea99-48ed-825e-a426b11c2754}"), - WmiExpense(1), - Description("NDIS Dot11 Link Quality Status Indication") : amended] -class MSNdis_StatusDot11LinkQuality : WMIEvent -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [ - read, - Description("Number of bytes for dot11 link quality status indication") : amended, - WmiDataId(1)] uint32 NumberElements; - [read, - Description("Dot11 Link Quality status information.") : amended, - WmiDataId(2), WmiSizeIs("NumberElements")] uint8 NdisStatusDot11LinkQualityIndication[]; -}; - - -// -// Keyboard and Mouse - -[abstract] -class MSKeyboard -{ -}; - -class MSMouse -{ -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Keyboard port driver information") : amended, - guid("{4731F89A-71CB-11d1-A52C-00A0C9062910}"), - GuidName1("KEYBOARD_PORT_WMI_STD_DATA_GUID"), - HeaderName("KEYBOARD_PORT_WMI_STD_DATA"), - DisplayName("Keyboard Port Information") : amended - ] -class MSKeyboard_PortInformation : MSKeyboard -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Connector Type") : amended, - WmiDataId(1), - read, - Values{"I8042 Connector" - "Serial Connector", - "USB Connector" } : amended, - ValueMap{"0", - "1", - "2" }, - DefineValues{"KEYBOARD_PORT_WMI_STD_I8042", - "KEYBOARD_PORT_WMI_STD_SERIAL", - "KEYBOARD_PORT_WMI_STD_USB"}, - Description("How the keyboard is connected to the computer") : amended] - uint32 ConnectorType; - - [DisplayName("Data Queue Size") : amended, - WmiDataId(2), - read, - Description("The DataQueueSize property indicates the size of the data queue.") : amended] - uint32 DataQueueSize; - - [DisplayName("Error Count") : amended, - WmiDataId(3), - read, - Description("Number of errors that occurred on this device") : amended] - uint32 ErrorCount; - - [DisplayName("Number of Function Keys") : amended, - WmiDataId(4), - read, - Description("The NumberOfFunctionKeys property indicates the number of function keys on the keyboard.") : amended] - uint32 FunctionKeys; - - [DisplayName("Number of Indicators") : amended, - WmiDataId(5), - read, - Description("The NumberOfIndicators property indicates the number of indicator leds on the keyboard.") : amended] - uint32 Indicators; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Keyboard port extended ID") : amended, - guid("{6ac4e23d-a950-4518-8b2b-aa4dcd5fe14a}"), - GuidName1("KEYBOARD_PORT_WMI_EXTENDED_ID"), - HeaderName("KEYBOARD_ID_EX"), - DisplayName("Keyboard Extended ID Information") : amended - ] -class MSKeyboard_ExtendedID : MSKeyboard -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Extended Type") : amended, - WmiDataId(1), - read, - Description("The Extended Type property indicates a 32 bit type identifier for the keyboard.") : amended] - uint32 Type; - - [DisplayName("Extended Subtype") : amended, - WmiDataId(2), - read, - Description("The Extended Type property indicates a 32 bit subtype identifier for the keyboard.") : amended] - uint32 Subtype; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Mouse port driver information") : amended, - guid("{4731F89C-71CB-11d1-A52C-00A0C9062910}"), - GuidName1("POINTER_PORT_WMI_STD_DATA_GUID"), - HeaderName("POINTER_PORT_WMI_STD_DATA"), - DisplayName("Mouse Port Information") : amended - ] -class MSMouse_PortInformation : MSMouse -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Connector Type") : amended, - WmiDataId(1), - read, - Values{"I8042 Connector" - "Serial Connector", - "USB Connector" } : amended, - ValueMap{"0", - "1", - "2" }, - DefineValues{"POINTER_PORT_WMI_STD_I8042", - "POINTER_PORT_WMI_STD_SERIAL", - "POINTER_PORT_WMI_STD_USB"}, - Description("How the mouse is connected to the computer") : amended] - uint32 ConnectorType; - - [DisplayName("Data Queue Size") : amended, - WmiDataId(2), - read, - Description("The DataQueueSize property indicates the size of the data queue.") : amended] - uint32 DataQueueSize; - - [DisplayName("Error Count") : amended, - WmiDataId(3), - read, - Description("Number of errors that occurred on this device") : amended] - uint32 ErrorCount; - - [DisplayName("Number of Buttons") : amended, - WmiDataId(4), - read, - Description("The NumberOfButtons property indicates the number of buttons on the pointing device.") : amended] - uint32 Buttons; - - [DisplayName("Hardware Type") : amended, - WmiDataId(5), - read, - Values{"Standard Mouse", - "Standard Pointer", - "Standard Absolute Pointer", - "Tablet", - "Touch Screen", - "Pen", - "Track Ball", - "Other"} : amended, - ValueMap{"0", - "1", - "2", - "3", - "4", - "5", - "6", - "256"}, - DefineValues{"POINTER_PORT_WMI_STD_MOUSE", - "POINTER_PORT_WMI_STD_POINTER", - "POINTER_PORT_WMI_ABSOLUTE_POINTER", - "POINTER_PORT_WMI_TABLET", - "POINTER_PORT_WMI_TOUCH_SCRENE", - "POINTER_PORT_WMI_PEN", - "POINTER_PORT_WMI_TRACK_BALL", - "POINTER_PORT_WMI_OTHER"}, - Description("The HardwareType property indicates the hardware type of the pointing device.") : amended] - uint32 HardwareType; - -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Mouse class driver information") : amended, - guid("{4731F89B-71CB-11d1-A52C-00A0C9062910}") - ] -class MSMouse_ClassInformation : MSMouse -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [ - WmiDataId(1), - read, - Description("An identification number for the device") : amended] - uint64 DeviceId; -}; - - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Keyboard class driver information") : amended, - guid("{4731F899-71CB-11d1-A52C-00A0C9062910}") - ] -class MSKeyboard_ClassInformation : MSKeyboard -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [ - WmiDataId(1), - read, - Description("An identification number for the device") : amended] - uint64 DeviceId; -}; - -// -// AGP information -// -[abstract] -class MSAgp -{ -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("AGP Information") : amended, - HeaderName("AGP_STD_DATA"), - guid("{8C27FBED-1C7B-47E4-A649-0E389D3ADA4F}"), - GuidName1("AGP_WMI_STD_DATA_GUID") -] -class MSAgp_Information : MSAgp -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [ - WmiDataId(1), - Description("Aperture base") : amended, - read] - uint64 ApertureBase; - - [ - WmiDataId(2), - Description("Aperture length") : amended, - read] - uint32 ApertureLength; - - [ - WmiDataId(3), - BitValues{"AGP_RATE_1X", "AGP_RATE_2X", "AGP_RATE_4X", - "FAST_WRITE", "FOUR_GB", "SBA_ENABLE"} : amended, - BitMap{"0", "1", "2", "4", "5", "9"}, - Description("AGP Status") : amended, - read] - uint32 AgpStatus; - - [ - WmiDataId(4), - BitValues{"AGP_RATE_1X", "AGP_RATE_2X", "AGP_RATE_4X", - "FAST_WRITE", "FOUR_GB", "AGP_ENABLE", "SBA_ENABLE"} : amended, - BitMap{"0", "1", "2", "4", "5", "8", "9"}, - Description("AGP Command") : amended, - read] - uint32 AgpCommand; -}; - -// -// Thermal information via ACPI -[abstract] -class MSAcpi -{ -}; - - -[Dynamic, Provider("WMIProv"), - WMI, - Description("ThermalZone temperature information") : amended, - guid("{A1BC18C0-A7C8-11d1-BF3C-00A0C9062910}"), - DisplayName("Thermal Zone Information") : amended - ] -class MSAcpi_ThermalZoneTemperature : MSAcpi -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Thermal Stamp") : amended, - WmiDataId(1), - Description("Thermal information change stamp") : amended, - read] - uint32 ThermalStamp; - - [DisplayName("Thermal Constant 1") : amended, - WmiDataId(2), - Description("First thermal constant") : amended, - read] - uint32 ThermalConstant1; - - [DisplayName("Thermal Constant 2") : amended, - WmiDataId(3), - Description("Second thermal constant") : amended, - read] - uint32 ThermalConstant2; - - [DisplayName("Reserved") : amended, - WmiDataId(4), - Description("Reserved") : amended, - read] - uint32 Reserved; - - [DisplayName("Sampling Period") : amended, - WmiDataId(5), - Description("Sampling period") : amended, - read] - uint32 SamplingPeriod; - - [DisplayName("Current Temperature") : amended, - WmiDataId(6), - Description("Temperature at thermal zone in tenths of degrees Kelvin") : amended, - read] - uint32 CurrentTemperature; - - [DisplayName("Passive Trippoint") : amended, - WmiDataId(7), - Description("Temperature (in tenths of degrees Kelvin) at which the OS must activate CPU throttling (ie, enable passive cooling)") : amended, - read] - uint32 PassiveTripPoint; - - [DisplayName("Critical Trippoint") : amended, - WmiDataId(8), - Description("Temperature (in tenths of degrees Kelvin) at which the OS must shutdown the system (ie, critical temperature)") : amended, - read] - uint32 CriticalTripPoint; - - [DisplayName("Active Trippoint Count") : amended, - WmiDataId(9), - Description("Count of active trip points") : amended, - read] - uint32 ActiveTripPointCount; - - [WmiDataId(10), - Description("Temperature levels (in tenths of degrees Kelvin) at which the OS must activate active cooling") : amended, - DisplayName("Active Trippoint") : amended, - MissingValue(0), - read] - uint32 ActiveTripPoint[10]; - -}; - -// -// Disk -[abstract] -class MSDiskDriver -{ -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Disk Geometry") : amended, - guid("{25007F51-57C2-11d1-A528-00A0C9062910}"), - HeaderName("WMI_DISK_GEOMETRY"), - DisplayName("Disk Geometry") : amended - ] -class MSDiskDriver_Geometry : MSDiskDriver -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Cylinders") : amended, - WmiDataId(1), - read] - sint64 Cylinders; - - [DisplayName("Media Type") : amended, - WmiDataId(2), - Values{"Format is unknown", - "5.25, 1.2MB, 512 bytes/sector", - "3.5, 1.44MB, 512 bytes/sector", - "3.5, 2.88MB, 512 bytes/sector", - "3.5, 20.8MB, 512 bytes/sector", - "3.5, 720KB, 512 bytes/sector", - "5.25, 360KB, 512 bytes/sector", - "5.25, 320KB, 512 bytes/sector", - "5.25, 320KB, 1024 bytes/sector", - "5.25, 180KB, 512 bytes/sector", - "5.25, 160KB, 512 bytes/sector", - "Removable media other than floppy", - "Fixed hard disk media", - "3.5, 120M Floppy", - "3.5 , 640KB, 512 bytes/sector", - "5.25, 640KB, 512 bytes/sector", - "5.25, 720KB, 512 bytes/sector", - "3.5 , 1.2Mb, 512 bytes/sector", - "3.5 , 1.23Mb, 1024 bytes/sector", - "5.25, 1.23MB, 1024 bytes/sector", - "3.5 MO 128Mb 512 bytes/sector", - "3.5 MO 230Mb 512 bytes/sector", - "8, 256KB, 128 bytes/sector"} : amended, - ValueMap{"0", - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "10", - "11", - "12", - "13", - "14", - "15", - "16", - "17", - "18", - "19", - "20", - "21", - "22"}, - read] - uint32 MediaType; - - [DisplayName("Tracks Per Cylinder") : amended, - WmiDataId(3), - read] - uint32 TracksPerCylinder; - - [DisplayName("Sectors Per Track") : amended, - WmiDataId(4), - read] - uint32 SectorsPerTrack; - - [DisplayName("Bytes Per Sector") : amended, - WmiDataId(5), - read] - uint32 BytesPerSector; - -}; - -[ - WMI, - Description("Disk performance statistics") : amended, - guid("BDD865D2-D7C1-11d0-A501-00A0C9062910"), - HeaderName("WMI_DISK_PERFORMANCE"), - DisplayName("Disk Performance Information") : amended - ] -class MSDiskDriver_PerformanceData : MSDiskDriver -{ - [DisplayName("Bytes Read") : amended, - WmiDataId(1), - Description("Number of bytes read on disk") : amended, - read] - sint64 BytesRead; - - [DisplayName("Bytes Written") : amended, - WmiDataId(2), - Description("Number of bytes written on disk") : amended, - read] - sint64 BytesWritten; - - [DisplayName("Read Time") : amended, - WmiDataId(3), - Description("Amount off time spent reading from disk") : amended, - read] - sint64 ReadTime; - - [DisplayName("Write Time") : amended, - WmiDataId(4), - Description("Amount off time spent writing to disk") : amended, - read] - sint64 WriteTime; - - [DisplayName("Idle Time") : amended, - WmiDataId(5), - Description("Amount off disk idle time") : amended, - read] - sint64 IdleTime; - - [DisplayName("Read Count") : amended, - WmiDataId(6), - Description("Number of read operations from disk") : amended, - read] - uint32 ReadCount; - - [DisplayName("Write Count") : amended, - WmiDataId(7), - Description("Number of write operations to disk") : amended, - read] - uint32 WriteCount; - - [DisplayName("Queue Depth") : amended, - WmiDataId(8), - Description("Number of requests waiting in the disk queue") : amended, - read] - uint32 QueueDepth; - - [DisplayName("Split Count") : amended, - WmiDataId(9), - Description("Number of split IO operations") : amended, - read] - uint32 SplitCount; - - [DisplayName("Query Time") : amended, - WmiDataId(10), - Description("") : amended, - read] - sint64 QueryTime; - - [DisplayName("Storage Device Number") : amended, - WmiDataId(11), - Description("") : amended, - read] - uint32 StorageDeviceNumber; - - [WmiDataId(12), - DisplayName("Storage Manager Name") : amended, - Description("") : amended, - read] - uint16 StorageManagerName[8]; - -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Disk performance statistics") : amended, - guid("BDD865D1-D7C1-11d0-A501-00A0C9062910"), - DisplayName("Disk Performance Information") : amended - ] -class MSDiskDriver_Performance : MSDiskDriver -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Performance Data") : amended, - WmiDataId(1), - Description("Performance Data Information") : amended, - read] - MSDiskDriver_PerformanceData PerfData; - - [DisplayName("Device Name") : amended, - WmiDataId(2), - Description("Internal device name") : amended, - read] - string DeviceName; -}; - - - -// -// General storage -[abstract] -class MSStorageDriver -{ -}; - - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Storage Device Failure Prediction Status") : amended, - guid("{78ebc102-4cf9-11d2-ba4a-00a0c9062910}"), - HeaderName("STORAGE_FAILURE_PREDICT_STATUS"), - GuidName1("WMI_STORAGE_FAILURE_PREDICT_STATUS_GUID"), - DisplayName("Failure Predict Status") : amended - ] -class MSStorageDriver_FailurePredictStatus : MSStorageDriver -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Reason") : amended, - WmiDataId(1), - ValueMap{"0", "255"}, - Values{"Unknown", "Test - Not a failure"} : amended, - read] - uint32 Reason; - - [DisplayName("Predict Failure") : amended, - WmiDataId(2), - Description("TRUE if drive is predicting failure. In this case it is critical that the disk is backed up immediately") : amended, - read] - boolean PredictFailure; - -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Storage Device Failure Prediction Data") : amended, - guid("{78ebc103-4cf9-11d2-ba4a-00a0c9062910}"), - HeaderName("STORAGE_FAILURE_PREDICT_DATA"), - GuidName1("WMI_STORAGE_FAILURE_PREDICT_DATA_GUID"), - DisplayName("Failure Predict Data") : amended - ] -class MSStorageDriver_FailurePredictData : MSStorageDriver -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Length") : amended, - WmiDataId(1), - read] - uint32 Length; - - - [DisplayName("Vendor Specific") : amended, - WmiDataId(2), - Description("Vendor specific failure prediction data") : amended, - read] - uint8 VendorSpecific[512]; - -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("ATAPI SMART Data") : amended, - guid("{78ebc103-4cf9-11d2-ba4a-00a0c9062910}"), - HeaderName("ATAPI_FAILURE_PREDICT_DATA"), - GuidName1("WMI_ATAPI_FAILURE_PREDICT_DATA_GUID"), - read, - DisplayName("ATAPI Failure Predict Data") : amended - ] -class MSStorageDriver_ATAPISmartData : MSStorageDriver -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Length") : amended, - WmiDataId(1), - read] - uint32 Length; - - - [DisplayName("Vendor Specific") : amended, - WmiDataId(2), - Description("Vendor specific failure prediction data") : amended, - read] - uint8 VendorSpecific[362]; - - [WmiDataId(3), - Description("Off-line data collection status") : amended, - read, - Values{"0", "2", "4", "5", "6", "128", "130", "132", "133", "134"}, - ValueMap{"Off-line data collection activity was never started", - "Off-line data collection activity was completed without error", - "Off-line data collection activity was suspended by an interrupting command from host", - "Off-line data collection activity was aborted by an interrupting command from host", - "Off-line data collection activity was aborted by the device with a fatal error", - "Off-line data collection activity was never started", - "Off-line data collection activity was completed without error", - "Off-line data collection activity was suspended by an interrupting command from host", - "Off-line data collection activity was aborted by an interrupting command from host", - "Off-line data collection activity was aborted by the device with a fatal error" - } : amended - ] - uint8 OfflineCollectionStatus; - - [WmiDataId(4), - Description("Self-test execution status byte") : amended, - read, - Values{"0", "1", "2", "3", "4", "5", "6", "7", "15"}, - ValueMap{ - "The previous self-test routine completed without error or no self-test has ever been run" - "The self-test routine was aborted by the host", - "The self-test routine was interrupted by the host with a hardware or software reset", - "A fatal error or unknown test error occurred while the device was executing its self-test routineand the device was unable to complete the self-test routine.", - "The previous self-test completed having a test element that failed and the test element that failed is not known.", - "The previous self-test completed having the electrical element of the test failed.", - "The previous self-test completed having the servo (and/or seek) test element of the test failed.", - "The previous self-test completed having the read element of the test failed.", - "Self-test routine in progress." - } : amended - ] - uint8 SelfTestStatus; - - [WmiDataId(5), - Description("Total time in seconds to complete off-line data collection activity") : amended, - read - ] - uint16 TotalTime; - - [WmiDataId(6), - Description("Vendor Specific") : amended, - read - ] - uint8 VendorSpecific2; - - [WmiDataId(7), - Description("Off-line data collection capability") : amended, - BitMap{"0", "1", "2", "3", "4"}, - BitValues{ - "(EXECUTE OFF-LINE IMMEDIATE implemented bit) - If this bit is set to one, then the SMART EXECUTE OFF-LINE IMMEDIATE command is implemented by this device. If this bit is cleared to zero, then the SMART EXECUTE OFF-LINE IMMEDIATE command is not implemented by this device.", - "(vendor specific)", - "(abort/restart off-line by host bit) - If this bit is set to one, then the device shall abort all off-line data collection activity initiated by an SMART EXECUTE OFF-LINE IMMEDIATE command upon receipt of a new command within 2 seconds of receiving the new command. If this bit is cleared to zero, the device shall suspend off-line data collection activity after an interrupting command and resume off-line data collection activity after some vendor-specified event.", - "(off-line read scanning implemented bit) - If this bit is cleared to zero, the device does not support off-line read scanning. If this bit is set to one, the device supports off-line read scanning.", - "(self-test implemented bit) - If this bit is cleared to zero, the device does not implement the Short and Extended self-test routines. If this bit is set to one, the device implements the Short and Extended self-test routines." - } : amended, - read - ] - uint8 OfflineCollectCapability; - - [WmiDataId(8), - Description("SMART capability") : amended, - read, - BitMap{"0", "1"}, - BitValues{ - "(power mode SMART data saving capability bit) - If this bit is set to one, the device saves SMART data prior to going into a power saving mode (Idle, Standby, or Sleep) or immediately upon return to Active or Idle mode from a Standby mode. If this bit is cleared to zero, the device does not save SMART data prior to going into a power saving mode (Idle, Standby, or Sleep) or immediately upon return to Active or Idle mode from a Standby mode.", - "(SMART data autosave after event capability bit) - This bit is set to one for devices complying with this standard." - } : amended - ] - uint16 SmartCapability; - - [WmiDataId(9), - Description("Error logging capability") : amended, - read, - BitMap{"0"}, - BitValues{"Device error logging supported"} : amended - ] - uint8 ErrorLogCapability; - - [WmiDataId(10), - Description("Vendor Specific") : amended, - read - ] - uint8 VendorSpecific3; - - [WmiDataId(11), - Description("Short self-test routine recommended polling time (in minutes)") : amended, - read - ] - uint8 ShortPollTimeInMinutes; - - [WmiDataId(12), - Description("Extended self-test routine recommended polling time (in minutes)") : amended, - read - ] - uint8 ExtendedPollTimeInMinutes; - - [WmiDataId(13), - Description("Reserved"), - read - ] - uint8 Reserved[12]; - - [WmiDataId(14), - Description("Vendor Specific") : amended, - read - ] - uint8 VendorSpecific4[125]; - - [WmiDataId(15), - Description("Data structure checksum") : amended, - read - ] - uint8 Checksum; - -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Storage Device Failure Prediction Thresholds") : amended, - guid("{DAE10783-CC31-4d2a-8A0F-861C04077A95}"), - HeaderName("STORAGE_FAILURE_PREDICT_THRESHOLDS"), - GuidName1("WMI_STORAGE_FAILURE_PREDICT_THRESHOLDS_GUID"), - DisplayName("Failure Predict Thresholds") : amended - ] -class MSStorageDriver_FailurePredictThresholds : MSStorageDriver -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Vendor Specific") : amended, - WmiDataId(1), - Description("Vendor specific failure prediction thresholds") : amended, - read] - uint8 VendorSpecific[512]; - -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Storage Device Failure Prediction Event") : amended, - guid("{78ebc104-4cf9-11d2-ba4a-00a0c9062910}"), - HeaderName("STORAGE_FAILURE_PREDICT_EVENT"), - GuidName1("WMI_STORAGE_PREDICT_FAILURE_EVENT_GUID"), - DisplayName("Failure Predict Event") : amended - ] -class MSStorageDriver_FailurePredictEvent : WmiEvent -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Length") : amended, - WmiDataId(1), - read] - uint32 Length; - - - [DisplayName("Vendor Specific") : amended, - WmiDataId(2), - Description("Vendor specific failure prediction data") : amended, - WmiSizeIs("Length"), - read] - uint8 VendorSpecific[]; - -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Storage Device Failure Prediction Functions") : amended, - guid("{78ebc105-4cf9-11d2-ba4a-00a0c9062910}"), - HeaderName("STORAGE_FAILURE_PREDICT_FUNCTION"), - GuidName1("WMI_STORAGE_FAILURE_PREDICT_FUNCTION_GUID"), - DisplayName("Failure Predict Functions") : amended - ] -class MSStorageDriver_FailurePredictFunction : MSStorageDriver -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiMethodId(1), - Implemented, - DisplayName("Allow Performance Degredation") : amended, - HeaderName("ALLOW_PERFORMANCE_HIT"), - Description("Configures setting that specifies if additional failure prediction checking can cause a loss of performance") : amended] - void AllowPerformanceHit([in, DisplayName("Allow") : amended] boolean Allow); - - [WmiMethodId(2), - Implemented, - DisplayName("Enable Or Disable Hardware Failure Prediction") : amended, - HeaderName("ENABLE_DISABLE_FP"), - Description("Enables or disables failure prediction checking at the hardware level") : amended] - void EnableDisableHardwareFailurePrediction([in, DisplayName("Enable") : amended] boolean Enable); - - [WmiMethodId(3), - Implemented, - DisplayName("Enable Or Disable Failure Prediction Polling") : amended, - HeaderName("ENABLE_DISABLE_FP_POLLING"), - Description("Enables or disables polling for failure prediction status") : amended] - void EnableDisableFailurePredictionPolling( - [in, - DisplayName("Period") : amended, - Description("Period in seconds to poll for failure prediction status") : amended] - uint32 Period, - [in] boolean Enable); - [WmiMethodId(4), - Implemented, - DisplayName("Get Failure Prediction Capability") : amended, - HeaderName("GET_FP_CAPABILITY"), - Description("Returns mechanism used to read failure prediction status ") : amended] - void GetFailurePredictionCapability([out, ValueMap{"0", "1", "2", "3"}, - Value{"Not Supported", - "Ioctl Based", - "IDE SMART", - "SCSI SMART"} : amended, - DisplayName("Capability") : amended - ] uint32 Capability); - - [WmiMethodId(5), - HeaderName("ENABLE_OFFLINE_DIAGS"), - Implemented, - DisplayName("Enable Offline Diags") : amended, - Description("Enables execution of offline diagnostics") : amended] - void EnableOfflineDiags([out, DisplayName("Success") : amended] boolean Success); - - - [WmiMethodId(6), - Implemented, - DisplayName("Read Log Sectors") : amended, - HeaderName("READ_LOG_SECTORS"), - Description("Read log sectors") : amended - ] - void ReadLogSectors([in, DisplayName("Log Address") : amended] uint8 LogAddress, - [in, DisplayName("Sector Count") : amended] uint8 SectorCount, - [out, DisplayName("Length") : amended] uint32 Length, - [out, WmiSizeIs("Length"), DisplayName("Log Sectors") : amended] uint8 LogSectors[] - ); - - [WmiMethodId(7), - Implemented, - HeaderName("WRITE_LOG_SECTORS"), - DisplayName("WriteLogSectors") : amended, - Description("Write log sectors") : amended - ] - void WriteLogSectors([in, DisplayName("LogAddress") : amended] uint8 LogAddress, - [in, DisplayName("SectorCount") : amended] uint8 SectorCount, - [in, DisplayName("Length") : amended] uint32 Length, - [in, WmiSizeIs("Length"), DisplayName("LogSectors") : amended] uint8 LogSectors[], - [out, DisplayName("Success") : amended] boolean Success - ); - - [WmiMethodId(8), - Implemented, - HeaderName("EXECUTE_SELF_TEST"), - DisplayName("Execute Self Test") : amended, - Description("Execute Self Test") : amended - ] - void ExecuteSelfTest([in, DisplayName("Sub Command") : amended] uint8 Subcommand, - [out, - DisplayName("Return Code") : amended, - ValueMap{"0", "1", "2"}, - Value{"Successful Completion", - "Captive Mode Required", - "Unsuccessful Completion"} : amended - ] - uint32 ReturnCode); -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Data for Scsi Info Exceptions Mode Page") : amended, - guid("{1101D829-167B-4ebf-ACAE-28CAB7C34802}"), - HeaderName("STORAGE_SCSI_INFO_EXCEPTIONS"), - GuidName1("WMI_STORAGE_SCSI_INFO_EXCEPTIONS_GUID"), - DisplayName("Scsi Info Exceptions") : amended - ] -class MSStorageDriver_ScsiInfoExceptions : MSStorageDriver -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Page Savable") : amended, - WmiDataId(1), - Description("The returned Parameter Savable bit of 1 indicates that page parameter data is savable.") : amended, - read, write] - boolean PageSavable; - - [DisplayName("Flags") : amended, - WmiDataId(2), - Description("Bit flags: " - "Perf set to zero indicates that informational exception operations that are the cause of delays are acceptable. " - "DExcpt set to zero indicates information exception operations shall be enabled. " - "Test of one instructs the drive to create false drive failures. " - "LogErr bit of zero indicates that logging of informational exception conditions are vendor specific.") : amended, - BitValues{"Perf", "DExcpt", "Test", "LogErr"} : amended, - BitMap{"7", "3", "2", "0"}, - read, write] - uint8 Flags; - - [DisplayName("Reporting Method") : amended, - WmiDataId(3), - Description("The Method of Reporting Informational Exceptions (MRIE) indicates the methods that shall be used by the target to report information exception conditions.") : amended, - ValueMap{"0", "1", "2", "3", "4", "5", "6"}, - Values{"No Reporting", "Asynchronous Event Reporting", "Generate Unit Attention", "Conditionally Generate Recovered Error", "Unconditionally Generate Recovered Error", "Generate No Sense", "Report On Request"} : amended, - read, write] - uint8 MRIE; - - [ - WmiDataId(4), - Description("Buffer padding to 32 bits, do not use") : amended, - read] - uint8 Padding; - - [DisplayName("Interval Timer") : amended, - WmiDataId(5), - Description("Period in 100ms increments for reporting that an information exception condition has occurred.") : amended, - read, write] - uint32 IntervalTimer; - - [DisplayName("Report Count") : amended, - WmiDataId(6), - Description("Indicates the number of times to report an informational exception condition to the application client. A value of zero indications there is no limit.") : amended, - read, write] - uint32 ReportCount; -}; - - -[abstract] -class MSIde -{ -}; - -[Dynamic, Provider("WMIProv"), WMI, - Description("Scsi Address") : amended, - guid("{53f5630f-b6bf-11d0-94f2-00a0c91efb8b}"), - DisplayName("Ide Port Information") : amended - ] -class MSIde_PortDeviceInfo : MSIde -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Bus") : amended, - WmiDataId(1), - Description("Scsi Bus Number") : amended, - read] - uint8 Bus; - - [DisplayName("Target") : amended, - WmiDataId(2), - Description("Scsi Target ID") : amended, - read] - uint8 Target; - - [DisplayName("Lun") : amended, - WmiDataId(3), - Description("Scsi Lun") : amended, - read] - uint8 Lun; -}; - - - -// Serial -[abstract] -class MSSerial -{ -}; - - -[WMI, Dynamic, Provider ("WMIProv"), - guid("{A0EC11A8-B16C-11D1-BD98-00A0C906BE2D}"), - GuidName1("SERIAL_PORT_WMI_NAME_GUID"), - Description("Serial Port Name" ) : amended, - DisplayName("Serial Port Name") : amended -] -class MSSerial_PortName : MSSerial -{ - boolean Active; - [key] - string InstanceName; - - [DisplayName("Port Name") : amended, - WmiDataId(1), - Description("Serial Port Name") : amended, - read] - string PortName; -}; - - -[WMI, Dynamic, Provider ("WMIProv"), - guid("{EDB16A62-B16C-11D1-BD98-00A0C906BE2D}"), - GuidName1("SERIAL_PORT_WMI_COMM_GUID"), - HeaderName("SERIAL_WMI_COMM_DATA"), - Description("Serial Communications Information") : amended, - DisplayName("Serial Comm Information") : amended -] -class MSSerial_CommInfo : MSSerial -{ - boolean Active; - [key] - string InstanceName; - - [DisplayName("Baud Rate") : amended, - WmiDataId(1), - Description("The BaudRate property indicates the baud rate for this serial port") : amended, - read] - uint32 BaudRate; - - [WmiDataId(2), - DisplayName("Bits Per Byte") : amended, - Description("The BitsPerByte property indicates the number of bits per byte for the serial port") : amended, - read] - uint32 BitsPerByte; - - [DisplayName("Parity") : amended, - WmiDataId(3), - read, - Description("The Parity property indicates the type of parity used") : amended, - Values{"None", - "Odd", - "Even", - "Space", - "Mark"} : amended, - ValueMap{"0", - "1", - "2", - "3", - "4"}, - DefineValues{"SERIAL_WMI_PARITY_NONE", - "SERIAL_WMI_PARITY_ODD", - "SERIAL_WMI_PARITY_EVEN", - "SERIAL_WMI_PARITY_SPACE", - "SERIAL_WMI_PARITY_MARK"} - ] - uint32 Parity; - - [DisplayName("Parity Check Enable") : amended, - WmiDataId(4), - Description("The ParityCheckEnabled property determines whether parity checking is enabled") : amended, - read] - boolean ParityCheckEnable; - - [DisplayName("Stop Bits") : amended, - WmiDataId(5), - read, - Description("The StopBits property indicates the number of stop bits for the serial port") : amended, - Values{"1", - "1.5", - "2"} : amended, - ValueMap{"0", - "1", - "2"}, - DefineValues{"SERIAL_WMI_STOP_1", - "SERIAL_WMI_STOP_1_5", - "SERIAL_WMI_STOP_2"}] - uint32 StopBits; - - [DisplayName("Xoff Character") : amended, - WmiDataId(6), - Description("The XOffCharacter property indicates the XOff character for the serial port") : amended, - read] - uint32 XoffCharacter; - - [DisplayName("Xoff Xmit Threshold") : amended, - WmiDataId(7), - Description("The XOffXmitThreshold property indicates the XOff transmit threshold for the serial port") : amended, - read] - uint32 XoffXmitThreshold; - - [DisplayName("Xon Character") : amended, - WmiDataId(8), - Description("The XOnCharacter property indicates the XOn character") : amended, - read] - uint32 XonCharacter; - - [DisplayName("Xon Xmit Threshold") : amended, - WmiDataId(9), - Description("The XOnXMitThreshold property indicates the XOn transmit threshold") : amended, - read] - uint32 XonXmitThreshold; - - [DisplayName("Maximum Baud Rate") : amended, - WmiDataId(10), - Description("The MaximumBaudRate property indicates the maximum baud rate of the serial port") : amended, - read] - uint32 MaximumBaudRate; - - [DisplayName("Maximum Output Buffer Size") : amended, - WmiDataId(11), - Description("The MaximumOutputBufferSize property indicates the maximum output buffer size (in bytes)") : amended, - read] - uint32 MaximumOutputBufferSize; - - [DisplayName("Maximum Input Buffer Size") : amended, - WmiDataId(12), - Description("The MaximumInputBufferSize property indicates the maximum input buffer size (in bytes)") : amended, - read] - uint32 MaximumInputBufferSize; - - [DisplayName("Support 16Bit Mode") : amended, - WmiDataId(13), - Description("The Support16BitMode property determines whether 16-bit mode is supported on the Win32 serial port") : amended, - read] - boolean Support16BitMode; - - [DisplayName("Support DTRDSR") : amended, - WmiDataId(14), - Description("The SupportDTRDSR property determines whether Data Terminal Ready (DTR) and Data Set Ready (DSR) signals are supported on the Win32 serial port.") : amended, - read] - boolean SupportDTRDSR; - - [DisplayName("Support Interval Timeouts") : amended, - WmiDataId(15), - Description("The SupportIntervalTimeouts property determines whether interval timeouts are supported on the serial port") : amended, - read] - boolean SupportIntervalTimeouts; - - [DisplayName("Support Parity Check") : amended, - WmiDataId(16), - Description("The SupportParityCheck property determines whether parity checking is supported on the Win32 serial port") : amended, - read] - boolean SupportParityCheck; - - [DisplayName("Support RTSCTS") : amended, - WmiDataId(17), - Description("The SupportRTSCTS property determines whether Ready To Send (RTS) and Clear To Send (CTS) signals are supported on the serial port") : amended, - read] - boolean SupportRTSCTS; - - [DisplayName("Support Xon Xoff") : amended, - WmiDataId(18), - Description("The SupportXOnXOff property determines whether software flow control is supported on the serial port") : amended, - read] - boolean SupportXonXoff; - - [DisplayName("Settable Baud Rate") : amended, - WmiDataId(19), - Description("The SettableBaudRate property determines whether the baud rate can be set on the serial port") : amended, - read] - boolean SettableBaudRate; - - [DisplayName("Settable Data Bits") : amended, - WmiDataId(20), - Description("The SettableDataBits property determines whether the number of data bits can be set on the Win32 serial port") : amended, - read] - boolean SettableDataBits; - - [DisplayName("Settable Flow Control") : amended, - WmiDataId(21), - Description("The SettableFlowControl property determines whether the flow control can be set on the serial port") : amended, - read] - boolean SettableFlowControl; - - [DisplayName("Settable Parity") : amended, - WmiDataId(22), - Description("The SettableParity property determines whether the parity can be set on the serial port") : amended, - read] - boolean SettableParity; - - [DisplayName("Settable Parity Check") : amended, - WmiDataId(23), - Description("The SettableParityCheck property determines whether parity checking can be set on the serial port") : amended, - read] - boolean SettableParityCheck; - - [DisplayName("Settable Stop Bits") : amended, - WmiDataId(24), - Description("The SettableStopBits property determines whether the number of stop bits can be set on the serial port") : amended, - read] - boolean SettableStopBits; - - [DisplayName("Is Busy") : amended, - WmiDataId(25), - Description("The IsBusy property determines whether the serial port is busy") : amended, - read] - boolean IsBusy; -}; - -[WMI, Dynamic, Provider ("WMIProv"), - guid("{270B9B86-B16D-11D1-BD98-00A0C906BE2D}"), - GuidName1("SERIAL_PORT_WMI_HW_GUID"), - HeaderName("SERIAL_WMI_HW_DATA"), - Description("Hardware configuration for serial port") : amended, - DisplayName("Serial Hardware Configuration") : amended -] -class MSSerial_HardwareConfiguration : MSSerial -{ - boolean Active; - [key] - string InstanceName; - - [DisplayName("Irq Number") : amended, - WmiDataId(1), - Description("The IRQNumber property indicates the number of the IRQ resource") : amended, - read] - uint32 IrqNumber; - - [DisplayName("Irq Vector") : amended, - WmiDataId(2), - Description("The Vector property indicates the vector of the IRQ resource") : amended, - read] - uint32 IrqVector; - - [DisplayName("Irq Level") : amended, - WmiDataId(3), - Description("The IRQLevel property indicates the level of the IRQ resource") : amended, - read] - uint32 IrqLevel; - - [DisplayName("Irq Affinity Mask") : amended, - WmiDataId(4), - Description("The AffinityMask property indicates the affinity mask of the IRQ resource") : amended, - read] - uint64 IrqAffinityMask; - - [DisplayName("Interrupt Type") : amended, - WmiDataId(5), - Description("The InterruptType property indicates the interrupt type of the IRQ resource") : amended, - Values{"Latched", - "Level"} : amended, - ValueMap{"0", - "1"}, - DefineValues{"SERIAL_WMI_INTTYPE_LATCHED", - "SERIAL_WMI_INTTYPE_LEVEL"}, - read] - uint32 InterruptType; - - [DisplayName("Base IO Address") : amended, - WmiDataId(6), - Description("The BaseIOAddress is the base IO address for the serial port") : amended, - read] - uint64 BaseIOAddress; -}; - -[WMI, Dynamic, Provider ("WMIProv"), - guid("{56415ACC-B16D-11D1-BD98-00A0C906BE2D}"), - GuidName1("SERIAL_PORT_WMI_PERF_GUID"), - HeaderName("SERIAL_WMI_PERF_DATA"), - Description("Performance information for serial port") : amended, - DisplayName("Serial Performance Data") : amended -] -class MSSerial_PerformanceInformation : MSSerial -{ - boolean Active; - [key] - string InstanceName; - - [DisplayName("Received Count") : amended, - WmiDataId(1), - Description("The ReceivedCount property indicates the number of bytes received in the current session") : amended, - read] - uint32 ReceivedCount; - - [DisplayName("Transmitted Count") : amended, - WmiDataId(2), - Description("The TransmittedCount property indicates the number of bytes transmitted in the current session") : amended, - read] - uint32 TransmittedCount; - - [DisplayName("Frame Error Count") : amended, - WmiDataId(3), - Description("The FrameErrorCount property indicates the number of framing errors that occurred in the current session") : amended, - read] - uint32 FrameErrorCount; - - [DisplayName("Serial Overrun Error Count") : amended, - WmiDataId(4), - Description("The SerialOverrunCount property indicates the number of serial overrun errors that occurred in the current session") : amended, - read] - uint32 SerialOverrunErrorCount; - - [DisplayName("Buffer Overrun Error Count") : amended, - WmiDataId(5), - Description("The BufferOverrunCount property indicates the number of buffer overrun errors that occurred in the current session") : amended, - read] - uint32 BufferOverrunErrorCount; - - [DisplayName("Parity Error Count") : amended, - WmiDataId(6), - Description("The ParityErrorCount property indicates the number of parity errors that occurred in the current session") : amended, - read] - uint32 ParityErrorCount; -}; - -[WMI, Dynamic, Provider ("WMIProv"), - guid("{8209EC2A-2D6B-11d2-BA49-00A0C9062910}"), - GuidName1("SERIAL_PORT_WMI_PROPERTIES_GUID"), - HeaderName("SERIAL_WMI_COMMPROP"), - Description("Communication properties for serial port") : amended -] -class MSSerial_CommProperties : MSSerial -{ - boolean Active; - [key] - string InstanceName; - - [ - read, WmiDataId(1), - Description("Specifies the size, in bytes, of the entire data packet, regardless of the amount of data requested") : amended] - uint16 wPacketLength; // packet size, in bytes - - [ - read, WmiDataId(2), - Description("Specifies the version of the structure") : amended] - uint16 wPacketVersion; // packet version - - [read, WmiDataId(3), - BitValues{"SP_SERIALCOMM"} : amended, - BitMap{"0"}, - Description("Specifies a bitmask indicating which services are implemented by this provider. The SP_SERIALCOMM value is always specified for communications providers, including modem providers.") : amended] - uint32 dwServiceMask; // services implemented - - [read, WmiDataId(4), - Description("Reserved; do not use.") : amended] - uint32 dwReserved1; // reserved - - [read, WmiDataId(5), - Description("Specifies the maximum size, in bytes, of the driver's internal output buffer. A value of zero indicates that no maximum value is imposed by the serial provider") : amended] - uint32 dwMaxTxQueue; // max Tx bufsize, in bytes - - [read, WmiDataId(6), - Description("Specifies the maximum size, in bytes, of the driver's internal input buffer. A value of zero indicates that no maximum value is imposed by the serial provider") : amended] - uint32 dwMaxRxQueue; // max Rx bufsize, in bytes - - [read, WmiDataId(7), - BitValues{"BAUD_075", "BAUD_110", "BAUD_134_5", "BAUD_150", "BAUD_300", - "BAUD_600", "BAUD_1200", "BAUD_1800", "BAUD_2400", "BAUD_4800", - "BAUD_7200", "BAUD_9600", "BAUD_14400", "BAUD_19200", "BAUD_38400", - "BAUD_56K", "BAUD_128K", "BAUD_115200", "BAUD_57600", "BAUD_USER"} : amended, - - BitMap{"0", "1", "2", "3", "4", - "5", "6", "7", "8", "9", - "10", "11", "12", "13", "14", - "15", "16", "17", "18", "28" }, - Description("Specifies the maximum allowable baud rate, in bits per second (bps). This member can be one of the following values: Value Meaning") : amended] - uint32 dwMaxBaud; // max baud rate, in bps - - [read, WmiDataId(8), - ValueMap{"0x00000000", "0x00000001", "0x00000002", - "0x00000003", "0x00000004", "0x00000005", "0x00000006", - "0x00000021", "0x00000022", "0x00000100", - "0x00000101", "0x00000102", "0x00000103"}, - - Values{ "Unspecified", "RS-232 serial port", "Parallel port", - "RS-422 port", "RS-423 port","RS-449 port", "Modem device", - "FAX device", "Scanner device", "Unspecified network bridge", - "LAT protocol", "TCP/IP Telnet protocol", "X.25 standards"} : amended, - - Description("Specifies the specific communications provider type") : amended] - uint32 dwProvSubType; // specific provider type - - [read, WmiDataId(9), - BitValues{ "(data-terminal-ready)/DSR (data-set-ready) supported", - "(request-to-send)/CTS (clear-to-send) supported", - "(receive-line-signal-detect) supported", - "Parity checking supported", - "XON/XOFF flow control supported", - "Settable XON/XOFF supported", - "Total (elapsed) time-outs supported", - "Interval time-outs supported", - "Special character support provided", - "Special 16-bit mode supported"} : amended, - BitMap{"0", "1", "2", "3", "4", - "5", "6", "7", "8", "9"}, - Description("Specifies a bitmask indicating the capabilities offered by the provider. This member can be one of the following values") : amended] - uint32 dwProvCapabilities; // capabilities supported - - [read, WmiDataId(10), - BitValues{"Parity checking", - "Baud rate", - "Data bits", - "Stop bits", - "Handshaking (flow control)", - "Parity checking", - "(receive-line-signal-detect)"} : amended, - BitMap{"0", "1", "2", "3", "4", - "5", "6"}, - Description("Specifies a bitmask indicating the communications parameter that can be changed") : amended] - uint32 dwSettableParams; // changable parameters - - [read, WmiDataId(11), - BitValues{"BAUD_075", "BAUD_110", "BAUD_134_5", "BAUD_150", "BAUD_300", - "BAUD_600", "BAUD_1200", "BAUD_1800", "BAUD_2400", "BAUD_4800", - "BAUD_7200", "BAUD_9600", "BAUD_14400", "BAUD_19200", "BAUD_38400", - "BAUD_56K", "BAUD_128K", "BAUD_115200", "BAUD_57600", "BAUD_USER"} : amended, - - BitMap{"0", "1", "2", "3", "4", - "5", "6", "7", "8", "9", - "10", "11", "12", "13", "14", - "15", "16", "17", "18", "28" }, - Description("Specifies a bitmask indicating the baud rates that can be used") : amended] - uint32 dwSettableBaud; // allowable baud rates - - [read, WmiDataId(12), - BitValues{"5 data bits", - "6 data bits", - "7 data bits", - "8 data bits", - "16 data bits", - "Special wide path through serial hardware lines"} : amended, - - BitMap{"0", "1", "2", "3", "4", "5"}, - Description("Specifies a bitmask indicating the number of data bits that can be set") : amended] - uint16 wSettableData; // allowable byte sizes - - [read, WmiDataId(13), - BitValues{"1 stop bit", - "1.5 stop bits", - "2 stop bits", - "No parity", - "Odd parity", - "Even parity", - "Mark parity", - "Space parity"} : amended, - - BitMap{"0", "1", "2", "8", "9", "10", "11", "12"}, - Description("Specifies a bitmask indicating the stop bit and parity settings that can be selected.") : amended] - uint16 wSettableStopParity; // stop bits/parity allowed - - [read, WmiDataId(14), - Description("Specifies the size, in bytes, of the driver's internal output buffer. A value of zero indicates that the value is unavailable.") : amended] - uint32 dwCurrentTxQueue; // Tx buffer size, in bytes - - [read, WmiDataId(15), - Description("Specifies the size, in bytes, of the driver's internal input buffer. A value of zero indicates that the value is unavailable.") : amended] - uint32 dwCurrentRxQueue; // Rx buffer size, in bytes - - [read, WmiDataId(16), - Description("Specifies provider-specific data.") : amended] - uint32 dwProvSpec1; // provider-specific data - - [read, WmiDataId(17), - Description("Specifies provider-specific data.") : amended] - uint32 dwProvSpec2; // provider-specific data - - [ - read, WmiDataId(18), - Description("Number of bytes of provider specific data") : amended] - uint32 dwProvCharSize; - - [ - read, WmiDataId(19), - WmiSizeIs("dwProvCharSize"), - Description("Specifies provider-specific data. Applications should ignore this member unless they have detailed information about the format of the data required by the provider.") : amended] - uint8 wcProvChar[]; // provider-specific data - - -}; - -[abstract] -class MSParallel -{ -}; - -[Dynamic, Provider("WMIProv"), WMI, - Description("The allocate and free counts track the port sharing of the parallel port. If the allocate count equals the free count then the port is idle. If the allocate count is greater than the free count (free count + 1) then some other driver in the system has acquired exclusive access to that port. If the allocate count stays constant at freecount+1 for an arbitrarily long period of time, then some driver may have illegally locked the port preventing other drivers from accessing the port.") : amended -, - guid("{4BBB69EA-6853-11d2-8ECE-00C04F8EF481}"), - HeaderName("PARPORT_WMI_ALLOC_FREE_COUNTS"), - GuidName1("PARPORT_WMI_ALLOCATE_FREE_COUNTS_GUID"), - DisplayName("Parallel Port Alloc Free Counts") : amended - ] -class MSParallel_AllocFreeCounts : MSParallel -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Port Allocates") : amended, - WmiDataId(1), - Description("Port allocation count") : amended, - read] - uint32 PortAllocates; - - [DisplayName("Port Frees") : amended, - WmiDataId(2), - Description("Port free count") : amended, - read] - uint32 PortFrees; - -}; - -[Dynamic, Provider("WMIProv"), WMI, - Description("Bytes transferred for each mode for the device") : amended, - guid("{89FEF2D6-654B-11d2-9E15-00C04F8EF481}"), - GuidName1("PARALLEL_WMI_BYTES_TRANSFERRED_GUID"), - HeaderName("PARALLEL_WMI_LOG_INFO"), - DisplayName("Parallel Device Bytes Transferred") : amended - ] -class MSParallel_DeviceBytesTransferred : MSParallel -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Flags 1") : amended, - WmiDataId(1), - Description("Reserved") : amended, - read] - uint32 Flags1; - - [DisplayName("Flags 2") : amended, - WmiDataId(2), - Description("Reserved") : amended, - read] - uint32 Flags2; - - [DisplayName("spare") : amended, - WmiDataId(3), - Description("Reserved") : amended, - read] - uint32 spare[2]; - - [DisplayName("Spp Write Count") : amended, - WmiDataId(4), - Description("Bytes written using SPP mode") : amended, - read] - sint64 SppWriteCount; - - [DisplayName("Nibble Read Count") : amended, - WmiDataId(5), - Description("Bytes written using nibble mode") : amended, - read] - sint64 NibbleReadCount; - - [DisplayName("Bounded Ecp Write Count") : amended, - WmiDataId(6), - Description("Bytes written using bounded Ecp mode") : amended, - read] - sint64 BoundedEcpWriteCount; - [DisplayName("BoundedEcpReadCount") : amended, - WmiDataId(7), - Description("Bytes read using bounded Ecp mode") : amended, - read] - sint64 BoundedEcpReadCount; - - [DisplayName("Hw Ecp Write Count") : amended, - WmiDataId(8), - Description("Bytes written using hardware Ecp mode") : amended, - read] - sint64 HwEcpWriteCount; - [DisplayName("Hw Ecp Read Count") : amended, - WmiDataId(9), - Description("Bytes read using hardware Ecp mode") : amended, - read] - sint64 HwEcpReadCount; - - [DisplayName("Sw Ecp Write Count") : amended, - WmiDataId(10), - Description("Bytes written using software Ecp mode") : amended, - read] - sint64 SwEcpWriteCount; - [DisplayName("Sw Ecp Read Count") : amended, - WmiDataId(11), - Description("Bytes read using software Ecp mode") : amended, - read] - sint64 SwEcpReadCount; - - [DisplayName("Hw Epp Write Count") : amended, - WmiDataId(12), - Description("Bytes written using hardware Epp mode") : amended, - read] - sint64 HwEppWriteCount; - [DisplayName("Hw Epp Read Count") : amended, - WmiDataId(13), - Description("Bytes read using hardware Epp mode") : amended, - read] - sint64 HwEppReadCount; - - [DisplayName("Sw Epp Write Count") : amended, - WmiDataId(14), - Description("Bytes written using software Epp mode") : amended, - read] - sint64 SwEppWriteCount; - [DisplayName("Sw Epp Read Count") : amended, - WmiDataId(15), - Description("Bytes read using software Epp mode") : amended, - read] - sint64 SwEppReadCount; - - [DisplayName("Byte Read Count") : amended, - WmiDataId(16), - Description("Bytes read using byte (bidirectional / PS/2) mode") : amended, - read] - sint64 ByteReadCount; - [DisplayName("Channel Nibble Read Count") : amended, - WmiDataId(17), - Description("Bytes read using channelized Nibble mode (IEEE 1284.3)") : amended, - read] - sint64 ChannelNibbleReadCount; - -}; - - -[abstract] -class MSRedbook -{ -}; - - -[Dynamic, - Provider("WMIProv"), - WMI, - Description("Digital Audio Filter Driver Information (redbook)") : amended, - GuidName1("GUID_REDBOOK_WMI_STD_DATA"), - GuidName2("MSRedbook_DriverInformationGuid"), - HeaderName("REDBOOK_WMI_STD_DATA"), - guid("{b90550e7-ae0a-11d1-a571-00c04fa34730}"), - DisplayName("Redbook Driver Information") : amended -] - -class MSRedbook_DriverInformation -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [WmiDataId(1), - DefineDataId("REDBOOK_WMI_NUMBER_OF_BUFFERS"), - read, - write, - Description("NumberOfBuffers*SectorsPerRead*2352 is the amount of memory used to reduce skipping." ) : amended, - DisplayName("Number Of Buffers") : amended - ] - uint32 NumberOfBuffers; - - [WmiDataId(2), - DefineDataId("REDBOOK_WMI_SECTORS_PER_READ"), - read, - write, - Description("Sectors (2352 bytes each) per read.") : amended, - DisplayName("Sectors Per Read") : amended - ] - uint32 SectorsPerRead; - - [WmiDataId(3), - DefineDataId("REDBOOK_WMI_SECTORS_PER_READ_MASK"), - read, - write, - Description("Bitwise mask of supported sectors per read for this drive. The lowest bit is one sector reads. If all bits are set, there are no restrictions.") : amended, - DisplayName("Sectors Per Read Mask") : amended - ] - uint32 SectorsPerReadMask; - - [WmiDataId(4), - DefineDataId("REDBOOK_WMI_MAX_SECTORS_PER_READ"), - read, - write, - Description("Maximum sectors per read (depends on both adapter and drive).") : amended, - DisplayName("Maximum Sectors Per Read") : amended - ] - uint32 MaximumSectorsPerRead; - - [WmiDataId(5), - DefineDataId("REDBOOK_WMI_PLAY_ENABLED"), - read, - write, - Description("PlayEnabled indicates the drive is currently using the RedBook filter.") : amended, - DisplayName("Play Enabled") : amended - ] - boolean PlayEnabled; - - [WmiDataId(6), - DefineDataId("REDBOOK_WMI_CDDA_SUPPORTED"), - read, - write, - Description("CDDASupported indicates the drive supports digital audio for some sector sizes.") : amended, - DisplayName("CDDA Supported") : amended - ] - boolean CDDASupported; - - [WmiDataId(7), - DefineDataId("REDBOOK_WMI_CDDA_ACCURATE"), - read, - write, - Description("CDDAAccurate indicates the drive accurately reads digital audio. This ensures the highest quality audio") : amended, - DisplayName("CDDA Accurate") : amended - ] - boolean CDDAAccurate; - - [WmiDataId(8), - read, - Description("Reserved for future use") : amended, - DisplayName("Reserved 1") : amended - ] - boolean Reserved1; - -}; - - -[Dynamic, - Provider("WMIProv"), - WMI, - Description("Digital Audio Filter Driver Performance Data (redbook)") : amended, - GuidName1("GUID_REDBOOK_WMI_PERF_DATA"), - GuidName2("MSRedbook_PerformanceGuid"), - HeaderName("REDBOOK_WMI_PERF_DATA"), - guid("{b90550e8-ae0a-11d1-a571-00c04fa34730}"), - DisplayName("Redbook Performance Information") : amended -] - -class MSRedbook_Performance -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [WmiDataId(1), - DefineDataId("REDBOOK_WMI_PERF_TIME_READING_DELAY"), - read, - Description("Seconds spent ready to read, but unused. (*1E-7)" ) : amended, - DisplayName("Time Read Delay") : amended - ] - sint64 TimeReadDelay; - - [WmiDataId(2), - DefineDataId("REDBOOK_WMI_PERF_TIME_READING"), - read, - Description("Seconds spent reading data from source. (*1E-7)") : amended, - DisplayName("Time Reading") : amended - ] - sint64 TimeReading; - - [WmiDataId(3), - DefineDataId("REDBOOK_WMI_PERF_TIME_STREAMING_DELAY"), - read, - Description("Seconds spent ready to stream, but unused. (*1E-7)") : amended, - DisplayName("Time Stream Delay") : amended - ] - sint64 TimeStreamDelay; - - [WmiDataId(4), - DefineDataId("REDBOOK_WMI_PERF_TIME_STREAMING"), - read, - Description("Seconds spent streaming data. (*1E-7)") : amended, - DisplayName("Time Streaming") : amended - ] - sint64 TimeStreaming; - - [WmiDataId(5), - DefineDataId("REDBOOK_WMI_PERF_DATA_PROCESSED"), - read, - Description("Number of bytes of data read and streamed.") : amended, - DisplayName("Data Processed") : amended - ] - sint64 DataProcessed; - - [WmiDataId(6), - DefineDataId("REDBOOK_WMI_PERF_STREAM_PAUSED_COUNT"), - read, - Description("Number of times the stream has paused due to insufficient stream buffers.") : amended, - DisplayName("Stream Paused Count") : amended - ] - uint32 StreamPausedCount; - -}; - - -[WMI, Dynamic, Provider("WMIProv"), - guid("{e3dff7bd-3915-11d2-9103-00c04fb998a2}"), - - WmiExpense(1), - Description("Enumerates Guids registered with WMI. The InstanceName is the Guid.") : amended] -class RegisteredGuids -{ - [key, read] - string InstanceName; - - [read] - boolean Active; - - [DisplayName("GuidType") : amended, - read, - Description("Type of guid") : amended, - ValueMap{0, 1, 2, 3}, - Value{"Trace Control Guid", "Trace Guid", "Data Guid", "Event Guid"} : amended, - WmiDataId(1)] uint32 GuidType; - - [DisplayName("LoggerId") : amended, - read, - Description("If Trace guid and enabled, indicates the LoggerId to which this Guid is currently logging data") : amended, - WmiDataId(2)] uint32 LoggerId; - - [DisplayName("EnableLevel") : amended, - read, - Description("If trace guid and If enabled, indicates the level of logging") : amended, - WmiDataId(3)] uint32 EnableLevel; - - [DisplayName("EnableFlags") : amended, - read, - Description("If trace guid and enabled, indicates the flags currently used in logging") : amended, - WmiDataId(4)] uint32 EnableFlags; - - [DisplayName("IsEnabled") : amended, - read, - Description("Indicates whether this Guid is enabled currently. For data guids this means if collection is enabled, For event guids this means if events are enabled. For Trace control guids this means the trace logging is enabled.") : amended, - WmiDataId(5)] boolean IsEnabled; - -}; - - -//************************************************************* -//*** Creates namespace for TRACE under \root\wmi -//*** EventTrace - is the root for all Trace Guids -//*** All Provider Control Guids will derive from EventTrace -//*** All Trace Data Guids will derive from their ControlGuid -//************************************************************* - -[abstract] -class EventTrace -{ -}; - -[Dynamic, - Description("Windows Kernel Trace") : amended, - Guid("{9e814aad-3204-11d2-9a82-006008a86939}") -] -class MSNT_SystemTrace:EventTrace -{ - [Description ("Enable Flags") : amended, - ValueDescriptions{ - "Process creations/deletions", - "Thread creations/deletions", - "Image load", - "Process counters", - "Context switches", - "Deferred procedure calls", - "Interrupts", - "System calls", - "Disk IO", - "File details", - "Disk IO entry", - "Dispatcher operations", - "Page faults", - "Hard page faults", - "Virtual memory allocations", - "Network TCP/IP", - "Registry details", - "ALPC", - "Split IO", - "Driver delays", - "Sample based profiling", - "File IO completion", - "File IO" - } : amended, - DefineValues{ - "EVENT_TRACE_FLAG_PROCESS", - "EVENT_TRACE_FLAG_THREAD", - "EVENT_TRACE_FLAG_IMAGE_LOAD", - "EVENT_TRACE_FLAG_PROCESS_COUNTERS", - "EVENT_TRACE_FLAG_CSWITCH", - "EVENT_TRACE_FLAG_DPC", - "EVENT_TRACE_FLAG_INTERRUPT", - "EVENT_TRACE_FLAG_SYSTEMCALL", - "EVENT_TRACE_FLAG_DISK_IO", - "EVENT_TRACE_FLAG_DISK_FILE_IO", - "EVENT_TRACE_FLAG_DISK_IO_INIT", - "EVENT_TRACE_FLAG_DISPATCHER", - "EVENT_TRACE_FLAG_MEMORY_PAGE_FAULTS", - "EVENT_TRACE_FLAG_MEMORY_HARD_FAULTS", - "EVENT_TRACE_FLAG_VIRTUAL_ALLOC", - "EVENT_TRACE_FLAG_NETWORK_TCPIP", - "EVENT_TRACE_FLAG_REGISTRY", - "EVENT_TRACE_FLAG_ALPC", - "EVENT_TRACE_FLAG_SPLIT_IO", - "EVENT_TRACE_FLAG_DRIVER", - "EVENT_TRACE_FLAG_PROFILE", - "EVENT_TRACE_FLAG_FILE_IO", - "EVENT_TRACE_FLAG_FILE_IO_INIT" - }, - Values{ - "process", - "thread", - "img", - "proccntr", - "cswitch", - "dpc", - "isr", - "syscall", - "disk", - "file", - "diskinit", - "dispatcher", - "pf", - "hf", - "virtalloc", - "net", - "registry", - "alpc", - "splitio", - "driver", - "profile", - "fileiocompletion", - "fileio" - }, - ValueMap{ - "0x00000001", - "0x00000002", - "0x00000004", - "0x00000008", - "0x00000010", - "0x00000020", - "0x00000040", - "0x00000080", - "0x00000100", - "0x00000200", - "0x00000400", - "0x00000800", - "0x00001000", - "0x00002000", - "0x00004000", - "0x00010000", - "0x00020000", - "0x00100000", - "0x00200000", - "0x00800000", - "0x01000000", - "0x02000000", - "0x04000000" - - } - ] - uint32 Flags; - -}; - -[Dynamic, - Description("Circular Kernel Session Provider") : amended, - Guid("{54dea73a-ed1f-42a4-af71-3e63d056f174}") -] -class MSNT_CKCLTraceProvider:EventTrace -{ - [Description ("Enable Flags") : amended, - ValueDescriptions{ - "Process creations/deletions", - "Thread creations/deletions", - "Image load", - "Process counters", - "Context switches", - "Deferred procedure calls", - "Interrupts", - "System calls", - "Disk IO", - "File details", - "Disk IO entry", - "Dispatcher operations", - "Page faults", - "Hard page faults", - "Virtual memory allocations", - "Network TCP/IP", - "Registry details", - "ALPC", - "Split IO", - "Driver delays", - "Sample based profiling", - "File IO completion", - "File IO" - } : amended, - DefineValues{ - "EVENT_TRACE_FLAG_PROCESS", - "EVENT_TRACE_FLAG_THREAD", - "EVENT_TRACE_FLAG_IMAGE_LOAD", - "EVENT_TRACE_FLAG_PROCESS_COUNTERS", - "EVENT_TRACE_FLAG_CSWITCH", - "EVENT_TRACE_FLAG_DPC", - "EVENT_TRACE_FLAG_INTERRUPT", - "EVENT_TRACE_FLAG_SYSTEMCALL", - "EVENT_TRACE_FLAG_DISK_IO", - "EVENT_TRACE_FLAG_DISK_FILE_IO", - "EVENT_TRACE_FLAG_DISK_IO_INIT", - "EVENT_TRACE_FLAG_DISPATCHER", - "EVENT_TRACE_FLAG_MEMORY_PAGE_FAULTS", - "EVENT_TRACE_FLAG_MEMORY_HARD_FAULTS", - "EVENT_TRACE_FLAG_VIRTUAL_ALLOC", - "EVENT_TRACE_FLAG_NETWORK_TCPIP", - "EVENT_TRACE_FLAG_REGISTRY", - "EVENT_TRACE_FLAG_ALPC", - "EVENT_TRACE_FLAG_SPLIT_IO", - "EVENT_TRACE_FLAG_DRIVER", - "EVENT_TRACE_FLAG_PROFILE", - "EVENT_TRACE_FLAG_FILE_IO", - "EVENT_TRACE_FLAG_FILE_IO_INIT" - }, - Values{ - "process", - "thread", - "img", - "proccntr", - "cswitch", - "dpc", - "isr", - "syscall", - "disk", - "file", - "diskinit", - "dispatcher", - "pf", - "hf", - "virtalloc", - "net", - "registry", - "alpc", - "splitio", - "driver", - "profile", - "fileiocompletion", - "fileio" - }, - ValueMap{ - "0x00000001", - "0x00000002", - "0x00000004", - "0x00000008", - "0x00000010", - "0x00000020", - "0x00000040", - "0x00000080", - "0x00000100", - "0x00000200", - "0x00000400", - "0x00000800", - "0x00001000", - "0x00002000", - "0x00004000", - "0x00010000", - "0x00020000", - "0x00100000", - "0x00200000", - "0x00800000", - "0x01000000", - "0x02000000", - "0x04000000" - - } - ] - uint32 Flags; -}; - -[Dynamic, - Description("Event Trace Event") : amended, - Guid("{68fdd900-4a3e-11d1-84f4-0000f80464e3}"), - DisplayName("EventTrace") : amended -] -class EventTraceEvent:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Event Trace Event") : amended, - EventType(0), - EventTypeName("Header") :amended -] -class EventTrace_Header:EventTraceEvent -{ - [WmiDataId(1), - Description("Buffer Size in Bytes") : amended, - read] - uint32 BufferSize; - [WmiDataId(2), - Description("Event Trace Version") : amended, - read] - uint32 Version; - [WmiDataId(3), - Description("Windows Build Number") : amended, - read] - uint32 ProviderVersion; - [WmiDataId(4), - Description("Number Of Processors") : amended, - read] - uint32 NumberOfProcessors; - [WmiDataId(5), - Description("Collection End Time") : amended, - read] - uint64 EndTime; - [WmiDataId(6), - Description("Timer Resolution") : amended, - read] - uint32 TimerResolution; - [WmiDataId(7), - Description("Maximum File Size in MBytes") : amended, - read] - uint32 MaxFileSize; - [WmiDataId(8), - Description("LogFileMode") : amended, - format("x"), - read] - uint32 LogFileMode; - [WmiDataId(9), - Description("Number of Buffers Written") : amended, - read] - uint32 BuffersWritten; - [WmiDataId(10), - Description("Buffer Number with earliest TimeStamp for a Circular LogFile") : amended, - read] - uint32 StartBuffers; - [WmiDataId(11), - Description("Pointer Size in Bytes") : amended, - read] - uint32 PointerSize; - [WmiDataId(12), - Description("Number of Events Lost during collection") : amended, - read] - uint32 EventsLost; - [WmiDataId(13), - Description("CPU Speed in MHz") : amended, - read] - uint32 CPUSpeed; - [WmiDataId(14), - Description("Logger Name") : amended, - pointer, - read] - uint32 LoggerName; - [WmiDataId(15), - Description("LogFile Name") : amended, - pointer, - read] - uint32 LogFileName; - [WmiDataId(16), - Description("TimeZoneInformation") : amended, - extension("NoPrint"), - read] - uint8 TimeZoneInformation[176]; - [WmiDataId(17), - Description("BootTime") : amended, - read] - uint64 BootTime; - [WmiDataId(18), - Description("Performance counter frequency in counts per second") : amended, - read] - uint64 PerfFreq; - [WmiDataId(19), - Description("StartTime") : amended, - read] - uint64 StartTime; - [WmiDataId(20), - Description("ReservedFlags") : amended, - format("x"), - read] - uint32 ReservedFlags; - [WmiDataId(21), - Description("Number of Buffers Lost during collection") : amended, - read] - uint32 BuffersLost; - [WmiDataId(22), - Description("SessionNameString") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string SessionNameString; - [WmiDataId(23), - Description("LogFileNameString") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string LogFileNameString; -}; - -[Dynamic, - Description("Event Trace Header Extension") : amended, - EventType{5, 32}, - EventTypeName{"Extension", "EndExtension"} :amended -] -class Header_Extension_TypeGroup:EventTraceEvent -{ - [WmiDataId(1), - Description("GroupMask1") : amended, - format("x"), - read] - uint32 GroupMask1; - [WmiDataId(2), - Description("GroupMask2") : amended, - format("x"), - read] - uint32 GroupMask2; - [WmiDataId(3), - Description("GroupMask3") : amended, - format("x"), - read] - uint32 GroupMask3; - [WmiDataId(4), - Description("GroupMask4") : amended, - format("x"), - read] - uint32 GroupMask4; - [WmiDataId(5), - Description("GroupMask5") : amended, - format("x"), - read] - uint32 GroupMask5; - [WmiDataId(6), - Description("GroupMask6") : amended, - format("x"), - read] - uint32 GroupMask6; - [WmiDataId(7), - Description("GroupMask7") : amended, - format("x"), - read] - uint32 GroupMask7; - [WmiDataId(8), - Description("GroupMask8") : amended, - format("x"), - read] - uint32 GroupMask8; - [WmiDataId(9), - Description("KernelEventVersion") : amended, - format("x"), - read] - uint32 KernelEventVersion; -}; - -[Dynamic, - Description("Event Trace Rundown Complete") : amended, - EventType(8), - EventTypeName("RDComplete") :amended -] -class RDComplete:EventTraceEvent -{ - -}; - -[Dynamic, - Description("Process Create/Exit Event") : amended, - Guid("{3d6fa8d0-fe05-11d0-9dda-00c04fd7ba7c}"), - EventVersion(0), - DisplayName("Process") : amended -] -class Process_V0:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Process Create/Exit Event") : amended, - EventType{1, 2, 3, 4}, - EventTypeName{"Start", "End", "DCStart", "DCEnd"} : amended -] -class Process_V0_TypeGroup1:Process_V0 -{ - [WmiDataId(1), - Description("Process ID") : amended, - pointer, - read] - uint32 ProcessId; - [WmiDataId(2), - Description("Parent Process ID") : amended, - pointer, - read] - uint32 ParentId; - [WmiDataId(3), - Description("User SID") : amended, - extension("Sid"), - read] - object UserSID; - [WmiDataId(4), - Description("ImageFileName") : amended, - StringTermination("NullTerminated"), - read] - string ImageFileName; -}; - -[Dynamic, - Description("Process Create/Exit Event") : amended, - Guid("{3d6fa8d0-fe05-11d0-9dda-00c04fd7ba7c}"), - EventVersion(1), - DisplayName("Process") : amended -] -class Process_V1:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Process Create/Exit Event") : amended, - EventType{1, 2, 3, 4}, - EventTypeName{"Start", "End", "DCStart", "DCEnd"} : amended -] -class Process_V1_TypeGroup1:Process_V1 -{ - [WmiDataId(1), - Description("PageDirectoryBase") : amended, - pointer, - read] - uint32 PageDirectoryBase; - [WmiDataId(2), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(3), - Description("ParentId") : amended, - format("x"), - read] - uint32 ParentId; - [WmiDataId(4), - Description("SessionId") : amended, - read] - uint32 SessionId; - [WmiDataId(5), - Description("ExitStatus") : amended, - read] - sint32 ExitStatus; - [WmiDataId(6), - Description("UserSID") : amended, - extension("Sid"), - read] - object UserSID; - [WmiDataId(7), - Description("ImageFileName") : amended, - StringTermination("NullTerminated"), - read] - string ImageFileName; -}; - -[Dynamic, - Description("Process Create/Exit Event") : amended, - Guid("{3d6fa8d0-fe05-11d0-9dda-00c04fd7ba7c}"), - EventVersion(2), - DisplayName("Process") : amended -] -class Process_V2:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Process Create/Exit Event") : amended, - EventType{1, 2, 3, 4, 39}, - EventTypeName{"Start", "End", "DCStart", "DCEnd", "Defunct"} : amended -] -class Process_V2_TypeGroup1:Process_V2 -{ - [WmiDataId(1), - Description("UniqueProcessKey") : amended, - pointer, - read] - uint32 UniqueProcessKey; - [WmiDataId(2), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(3), - Description("ParentId") : amended, - format("x"), - read] - uint32 ParentId; - [WmiDataId(4), - Description("SessionId") : amended, - read] - uint32 SessionId; - [WmiDataId(5), - Description("ExitStatus") : amended, - read] - sint32 ExitStatus; - [WmiDataId(6), - Description("UserSID") : amended, - extension("Sid"), - read] - object UserSID; - [WmiDataId(7), - Description("ImageFileName") : amended, - StringTermination("NullTerminated"), - read] - string ImageFileName; - [WmiDataId(8), - Description("CommandLine") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string CommandLine; -}; - -[Dynamic, - Description("Process Performance Counters") : amended, - EventType{32, 33}, - EventTypeName{"PerfCtr", "PerfCtrRundown"} : amended -] -class Process_V2_TypeGroup2:Process_V2 -{ - [WmiDataId(1), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(2), - Description("PageFaultCount") : amended, - read] - uint32 PageFaultCount; - [WmiDataId(3), - Description("HandleCount") : amended, - read] - uint32 HandleCount; - [WmiDataId(4), - Description("Reserved") : amended, - read] - uint32 Reserved; - [WmiDataId(5), - Description("PeakVirtualSize") : amended, - extension("SizeT"), - read] - object PeakVirtualSize; - [WmiDataId(6), - Description("PeakWorkingSetSize") : amended, - extension("SizeT"), - read] - object PeakWorkingSetSize; - [WmiDataId(7), - Description("PeakPagefileUsage") : amended, - extension("SizeT"), - read] - object PeakPagefileUsage; - [WmiDataId(8), - Description("QuotaPeakPagedPoolUsage") : amended, - extension("SizeT"), - read] - object QuotaPeakPagedPoolUsage; - [WmiDataId(9), - Description("QuotaPeakNonPagedPoolUsage") : amended, - extension("SizeT"), - read] - object QuotaPeakNonPagedPoolUsage; - [WmiDataId(10), - Description("VirtualSize") : amended, - extension("SizeT"), - read] - object VirtualSize; - [WmiDataId(11), - Description("WorkingSetSize") : amended, - extension("SizeT"), - read] - object WorkingSetSize; - [WmiDataId(12), - Description("PagefileUsage") : amended, - extension("SizeT"), - read] - object PagefileUsage; - [WmiDataId(13), - Description("QuotaPagedPoolUsage") : amended, - extension("SizeT"), - read] - object QuotaPagedPoolUsage; - [WmiDataId(14), - Description("QuotaNonPagedPoolUsage") : amended, - extension("SizeT"), - read] - object QuotaNonPagedPoolUsage; - [WmiDataId(15), - Description("PrivatePageCount") : amended, - extension("SizeT"), - read] - object PrivatePageCount; -}; - -[Dynamic, - Description("Process In Swap Event") : amended, - EventType(35), - EventTypeName("InSwap") : amended -] -class Process_V2_TypeGroup3:Process_V2 -{ - [WmiDataId(1), - Description("DirectoryTableBase") : amended, - pointer, - read] - uint32 DirectoryTableBase; - [WmiDataId(2), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; -}; - -[Dynamic, - Description("Process Create/Exit Event") : amended, - Guid("{3d6fa8d0-fe05-11d0-9dda-00c04fd7ba7c}"), - EventVersion(3), - DisplayName("Process") : amended -] -class Process:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Process Create/Exit Event") : amended, - EventType{1, 2, 3, 4, 39}, - EventTypeName{"Start", "End", "DCStart", "DCEnd", "Defunct"} : amended -] -class Process_TypeGroup1:Process -{ - [WmiDataId(1), - Description("UniqueProcessKey") : amended, - pointer, - read] - uint32 UniqueProcessKey; - [WmiDataId(2), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(3), - Description("ParentId") : amended, - format("x"), - read] - uint32 ParentId; - [WmiDataId(4), - Description("SessionId") : amended, - read] - uint32 SessionId; - [WmiDataId(5), - Description("ExitStatus") : amended, - read] - sint32 ExitStatus; - [WmiDataId(6), - Description("DirectoryTableBase") : amended, - pointer, - read] - uint32 DirectoryTableBase; - [WmiDataId(7), - Description("UserSID") : amended, - extension("Sid"), - read] - object UserSID; - [WmiDataId(8), - Description("ImageFileName") : amended, - StringTermination("NullTerminated"), - read] - string ImageFileName; - [WmiDataId(9), - Description("CommandLine") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string CommandLine; -}; - -[Dynamic, - Description("Thread Create/Exit Event") : amended, - Guid("{3d6fa8d1-fe05-11d0-9dda-00c04fd7ba7c}"), - EventVersion(0), - DisplayName("Thread") : amended -] -class Thread_V0:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Thread Create/Exit Event") : amended, - EventType{1, 2, 3, 4}, - EventTypeName{"Start", "End", "DCStart", "DCEnd"} : amended -] -class Thread_V0_TypeGroup1:Thread_V0 -{ - [WmiDataId(1), - Description("ThreadId") : amended, - format("x"), - read] - uint32 TThreadId; - [WmiDataId(2), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; -}; - -[Dynamic, - Description("Thread Create/Exit Event") : amended, - Guid("{3d6fa8d1-fe05-11d0-9dda-00c04fd7ba7c}"), - EventVersion(1), - DisplayName("Thread") : amended -] -class Thread_V1:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Thread Create/Exit Event") : amended, - EventType{1, 3}, - EventTypeName{"Start", "DCStart"} : amended -] -class Thread_V1_TypeGroup1:Thread_V1 -{ - [WmiDataId(1), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(2), - Description("ThreadId") : amended, - format("x"), - read] - uint32 TThreadId; - [WmiDataId(3), - Description("StackBase") : amended, - pointer, - read] - uint32 StackBase; - [WmiDataId(4), - Description("StackLimit") : amended, - pointer, - read] - uint32 StackLimit; - [WmiDataId(5), - Description("UserStackBase") : amended, - pointer, - read] - uint32 UserStackBase; - [WmiDataId(6), - Description("UserStackLimit") : amended, - pointer, - read] - uint32 UserStackLimit; - [WmiDataId(7), - Description("StartAddr") : amended, - pointer, - read] - uint32 StartAddr; - [WmiDataId(8), - Description("Win32StartAddr") : amended, - pointer, - read] - uint32 Win32StartAddr; - [WmiDataId(9), - Description("WaitMode") : amended, - read] - sint8 WaitMode; -}; - -[Dynamic, - Description("Thread Create/Exit Event") : amended, - EventType{2, 4}, - EventTypeName{"End", "DCEnd"} : amended -] -class Thread_V1_TypeGroup2:Thread_V1 -{ - [WmiDataId(1), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(2), - Description("ThreadId") : amended, - format("x"), - read] - uint32 TThreadId; -}; - - -[Dynamic, - Description("Context Switch Event") : amended, - EventType(36), - EventTypeName("CSwitch") : amended -] -class CSwitch_V1:Thread_V1 -{ - [WmiDataId(1), - Description("NewThreadId") : amended, - format("x"), - read] - uint32 NewThreadId; - [WmiDataId(2), - Description("OldThreadId") : amended, - format("x"), - read] - uint32 OldThreadId; - [WmiDataId(3), - Description("NewThreadPriority") : amended, - read] - sint8 NewThreadPriority; - [WmiDataId(4), - Description("OldThreadPriority") : amended, - read] - sint8 OldThreadPriority; - [WmiDataId(5), - Description("NewThreadQuantum") : amended, - read] - sint8 NewThreadQuantum; - [WmiDataId(6), - Description("OldThreadQuantum") : amended, - read] - sint8 OldThreadQuantum; - [WmiDataId(7), - Description("OldThreadWaitReason") : amended, - read] - sint8 OldThreadWaitReason; - [WmiDataId(8), - Description("OldThreadWaitMode") : amended, - read] - sint8 OldThreadWaitMode; - [WmiDataId(9), - Description("OldThreadState") : amended, - read] - sint8 OldThreadState; - [WmiDataId(10), - Description("OldThreadWaitIdealProcessor") : amended, - read] - sint8 OldThreadWaitIdealProcessor; - [WmiDataId(11), - Description("NewThreadWaitTime") : amended, - format("x"), - read] - uint32 NewThreadWaitTime; -}; - -[Dynamic, - Description("Worker Thread Event") : amended, - EventType(57), - EventTypeName("WorkerThread") : amended -] -class WorkerThread_V1:Thread_V1 -{ - [WmiDataId(1), - Description("ThreadId") : amended, - format("x"), - read] - uint32 TThreadId; - [WmiDataId(2), - Description("StartTime") : amended, - read] - uint64 StartTime; - [WmiDataId(3), - Description("ThreadRoutine") : amended, - pointer, - read] - uint32 ThreadRoutine; -}; - -[Dynamic, - Description("Thread Create/Exit Event") : amended, - Guid("{3d6fa8d1-fe05-11d0-9dda-00c04fd7ba7c}"), - EventVersion(2), - DisplayName("Thread") : amended -] -class Thread_V2:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Thread Create/Exit Event") : amended, - EventType{1, 2, 3, 4}, - EventTypeName{"Start", "End", "DCStart", "DCEnd"} : amended -] -class Thread_V2_TypeGroup1:Thread_V2 -{ - [WmiDataId(1), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(2), - Description("ThreadId") : amended, - format("x"), - read] - uint32 TThreadId; - [WmiDataId(3), - Description("StackBase") : amended, - pointer, - read] - uint32 StackBase; - [WmiDataId(4), - Description("StackLimit") : amended, - pointer, - read] - uint32 StackLimit; - [WmiDataId(5), - Description("UserStackBase") : amended, - pointer, - read] - uint32 UserStackBase; - [WmiDataId(6), - Description("UserStackLimit") : amended, - pointer, - read] - uint32 UserStackLimit; - [WmiDataId(7), - Description("StartAddr") : amended, - pointer, - read] - uint32 StartAddr; - [WmiDataId(8), - Description("Win32StartAddr") : amended, - pointer, - read] - uint32 Win32StartAddr; - [WmiDataId(9), - Description("TebBase") : amended, - pointer, - read] - uint32 TebBase; - [WmiDataId(10), - Description("SubProcessTag") : amended, - format("x"), - read] - uint32 SubProcessTag; -}; - -[Dynamic, - Description("Context Switch Event") : amended, - EventType(36), - EventTypeName("CSwitch") : amended -] -class CSwitch:Thread_V2 -{ - [WmiDataId(1), - Description("NewThreadId") : amended, - format("x"), - read] - uint32 NewThreadId; - [WmiDataId(2), - Description("OldThreadId") : amended, - format("x"), - read] - uint32 OldThreadId; - [WmiDataId(3), - Description("NewThreadPriority") : amended, - read] - sint8 NewThreadPriority; - [WmiDataId(4), - Description("OldThreadPriority") : amended, - read] - sint8 OldThreadPriority; - [WmiDataId(5), - Description("PreviousCState") : amended, - read] - uint8 PreviousCState; - [WmiDataId(6), - Description("SpareByte") : amended, - read] - sint8 SpareByte; - [WmiDataId(7), - Description("OldThreadWaitReason") : amended, - read] - sint8 OldThreadWaitReason; - [WmiDataId(8), - Description("OldThreadWaitMode") : amended, - read] - sint8 OldThreadWaitMode; - [WmiDataId(9), - Description("OldThreadState") : amended, - read] - sint8 OldThreadState; - [WmiDataId(10), - Description("OldThreadWaitIdealProcessor") : amended, - read] - sint8 OldThreadWaitIdealProcessor; - [WmiDataId(11), - Description("NewThreadWaitTime") : amended, - format("x"), - read] - uint32 NewThreadWaitTime; - [WmiDataId(12), - Description("Reserved") : amended, - read] - uint32 Reserved; -}; - -[Dynamic, - Description("Compressed CS Event") : amended, - EventType(37), - EventTypeName("CompCS") : amended -] -class CompCS:Thread_V2 -{ -}; - -[Dynamic, - Description("Worker Thread Event") : amended, - EventType(57), - EventTypeName("WorkerThread") : amended -] -class WorkerThread:Thread_V2 -{ - [WmiDataId(1), - Description("ThreadId") : amended, - format("x"), - read] - uint32 TThreadId; - [WmiDataId(2), - Description("StartTime") : amended, - read] - uint64 StartTime; - [WmiDataId(3), - Description("ThreadRoutine") : amended, - pointer, - read] - uint32 ThreadRoutine; -}; - -[Dynamic, - Description("Ready Thread Event") : amended, - EventType(50), - EventTypeName("ReadyThread") : amended -] -class ReadyThread:Thread_V2 -{ - [WmiDataId(1), - Description("ThreadId") : amended, - format("x"), - read] - uint32 TThreadId; - [WmiDataId(2), - Description("AdjustReason") : amended, - read] - sint8 AdjustReason; - [WmiDataId(3), - Description("AdjustIncrement") : amended, - read] - sint8 AdjustIncrement; - [WmiDataId(4), - Description("Flags") : amended, - read] - sint8 Flag; - [WmiDataId(5), - Description("Reserved") : amended, - read] - sint8 Reserved; -}; - - -[Dynamic, - Description("Thread Affinity Event") : amended, - EventType(53), - EventTypeName("ThreadAffinity") : amended -] -class ThreadAffinity:Thread_V2 -{ - [WmiDataId(1), - Description("Affinity") : amended, - pointer, - read] - uint32 Affinity; - [WmiDataId(2), - Description("ThreadId") : amended, - format("x"), - read] - uint32 ThreadId; - [WmiDataId(3), - Description("Group") : amended, - read] - uint16 Group; - [WmiDataId(4), - Description("Reserved") : amended, - read] - uint16 Reserved; -}; - -[Dynamic, - Description("Thread Create/Exit Event") : amended, - Guid("{3d6fa8d1-fe05-11d0-9dda-00c04fd7ba7c}"), - EventVersion(3), - DisplayName("Thread") : amended -] -class Thread:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Thread Create/Exit Event") : amended, - EventType{1, 2, 3, 4}, - EventTypeName{"Start", "End", "DCStart", "DCEnd"} : amended -] -class Thread_TypeGroup1:Thread -{ - [WmiDataId(1), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(2), - Description("ThreadId") : amended, - format("x"), - read] - uint32 TThreadId; - [WmiDataId(3), - Description("StackBase") : amended, - pointer, - read] - uint32 StackBase; - [WmiDataId(4), - Description("StackLimit") : amended, - pointer, - read] - uint32 StackLimit; - [WmiDataId(5), - Description("UserStackBase") : amended, - pointer, - read] - uint32 UserStackBase; - [WmiDataId(6), - Description("UserStackLimit") : amended, - pointer, - read] - uint32 UserStackLimit; - [WmiDataId(7), - Description("Affinity") : amended, - pointer, - read] - uint32 Affinity; - [WmiDataId(8), - Description("Win32StartAddr") : amended, - pointer, - read] - uint32 Win32StartAddr; - [WmiDataId(9), - Description("TebBase") : amended, - pointer, - read] - uint32 TebBase; - [WmiDataId(10), - Description("SubProcessTag") : amended, - format("x"), - read] - uint32 SubProcessTag; - [WmiDataId(11), - Description("BasePriority") : amended, - read] - uint8 BasePriority; - [WmiDataId(12), - Description("PagePriority") : amended, - read] - uint8 PagePriority; - [WmiDataId(13), - Description("IoPriority") : amended, - read] - uint8 IoPriority; - [WmiDataId(14), - Description("Flags") : amended, - read] - uint8 ThreadFlags; -}; - -[Dynamic, - Description("Priority Change Event") : amended, - EventType{48, 49, 51, 52}, - EventTypeName{"SetPriority", "SetBasePriority", "SetPagePriority", "SetIoPriority"} : amended -] -class ThreadPriority:Thread -{ - [WmiDataId(1), - Description("ThreadId") : amended, - format("x"), - read] - uint32 ThreadId; - [WmiDataId(2), - Description("OldPriority") : amended, - read] - uint8 OldPriority; - [WmiDataId(3), - Description("NewPriority") : amended, - read] - uint8 NewPriority; - [WmiDataId(4), - Description("Reserved") : amended, - read] - uint16 Reserved; -}; - -[Dynamic, - Description("I/O Read/Write Event") : amended, - Guid("{3d6fa8d4-fe05-11d0-9dda-00c04fd7ba7c}"), - DisplayName("DiskIo") : amended -] -class DiskIo:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("I/O Read/Write Event") : amended, - EventType{10, 11}, - EventTypeName{"Read", "Write"} : amended -] -class DiskIo_TypeGroup1:DiskIo -{ - [WmiDataId(1), - Description("DiskNumber") : amended, - read] - uint32 DiskNumber; - [WmiDataId(2), - Description("IrpFlags") : amended, - format("x"), - read] - uint32 IrpFlags; - [WmiDataId(3), - Description("TransferSize") : amended, - read] - uint32 TransferSize; - [WmiDataId(4), - Description("Reserved") : amended, - read] - uint32 Reserved; - [WmiDataId(5), - Description("ByteOffset") : amended, - read] - uint64 ByteOffset; - [WmiDataId(6), - Description("FileObject") : amended, - pointer, - read] - uint32 FileObject; - [WmiDataId(7), - Description("IORequestPacket") : amended, - pointer, - read] - uint32 Irp; - [WmiDataId(8), - Description("HighResResponseTime") : amended, - read] - uint64 HighResResponseTime; -}; - -[Dynamic, - Description("I/O Read/Write/Flush Start Event") : amended, - EventType{12, 13, 15}, - EventTypeName{"ReadInit", "WriteInit", "FlushInit"} : amended -] -class DiskIo_TypeGroup2:DiskIo -{ - [WmiDataId(1), - Description("IORequestPacket") : amended, - pointer, - read] - uint32 Irp; -}; - -[Dynamic, - Description("I/O Flush Buffers Event") : amended, - EventType(14), - EventTypeName("FlushBuffers") : amended -] -class DiskIo_TypeGroup3:DiskIo -{ - [WmiDataId(1), - Description("DiskNumber") : amended, - read] - uint32 DiskNumber; - [WmiDataId(2), - Description("IrpFlags") : amended, - format("x"), - read] - uint32 IrpFlags; - [WmiDataId(3), - Description("HighResResponseTime") : amended, - read] - uint64 HighResResponseTime; - [WmiDataId(4), - Description("IORequestPacket") : amended, - pointer, - read] - uint32 Irp; -}; - -[Dynamic, - Description("Driver Major Function Call") : amended, - EventType(34), - EventTypeName("DrvMjFnCall") : amended -] -class DriverMajorFunctionCall:DiskIo -{ - [WmiDataId(1), - Description("MajorFunction") : amended, - read] - uint32 MajorFunction; - [WmiDataId(2), - Description("MinorFunction") : amended, - read] - uint32 MinorFunction; - [WmiDataId(3), - Description("RoutineAddr") : amended, - pointer, - read] - uint32 RoutineAddr; - [WmiDataId(4), - Description("FileObject") : amended, - pointer, - read] - uint32 FileObject; - [WmiDataId(5), - Description("Irp") : amended, - pointer, - read] - uint32 Irp; - [WmiDataId(6), - Description("UniqMatchId") : amended, - read] - uint32 UniqMatchId; -}; - -[Dynamic, - Description("Driver Major Function Return") : amended, - EventType(35), - EventTypeName("DrvMjFnRet") : amended -] -class DriverMajorFunctionReturn:DiskIo -{ - [WmiDataId(1), - Description("Irp") : amended, - pointer, - read] - uint32 Irp; - [WmiDataId(2), - Description("UniqMatchId") : amended, - read] - uint32 UniqMatchId; -}; - -[Dynamic, - Description("Driver Completion Routine") : amended, - EventType(37), - EventTypeName("DrvComplRout") : amended -] -class DriverCompletionRoutine:DiskIo -{ - [WmiDataId(1), - Description("Routine") : amended, - pointer, - read] - uint32 Routine; - [WmiDataId(2), - Description("IrpPtr") : amended, - pointer, - read] - uint32 IrpPtr; - [WmiDataId(3), - Description("UniqMatchId") : amended, - read] - uint32 UniqMatchId; -}; - -[Dynamic, - Description("Driver Complete Request") : amended, - EventType(52), - EventTypeName("DrvComplReq") : amended -] -class DriverCompleteRequest:DiskIo -{ - [WmiDataId(1), - Description("RoutineAddr") : amended, - pointer, - read] - uint32 RoutineAddr; - [WmiDataId(2), - Description("Irp") : amended, - pointer, - read] - uint32 Irp; - [WmiDataId(3), - Description("UniqMatchId") : amended, - read] - uint32 UniqMatchId; -}; - -[Dynamic, - Description("Driver Delay Complete Request Return") : amended, - EventType(53), - EventTypeName("DrvComplReqRet") : amended -] -class DriverCompleteRequestReturn:DiskIo -{ - [WmiDataId(1), - Description("Irp") : amended, - pointer, - read] - uint32 Irp; - [WmiDataId(2), - Description("UniqMatchId") : amended, - read] - uint32 UniqMatchId; -}; - -[Dynamic, - Description("Registry") : amended, - Guid("{ae53722e-c863-11d2-8659-00c04fa321a1}"), - EventVersion(0), - DisplayName("Registry") : amended -] -class Registry_V0:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Registry") : amended, - EventType{10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}, - EventTypeName{"Create", "Open", "Delete", "Query", "SetValue", "DeleteValue", "QueryValue", "EnumerateKey", "EnumerateValueKey", "QueryMultipleValue", "SetInformation", "Flush"} : amended -] -class Registry_V0_TypeGroup1:Registry_V0 -{ - [WmiDataId(1), - Description("Status") : amended, - pointer, - read] - uint32 Status; - [WmiDataId(2), - Description("KeyHandle") : amended, - pointer, - read] - uint32 KeyHandle; - [WmiDataId(3), - Description("ElapsedTime") : amended, - read] - sint64 ElapsedTime; - [WmiDataId(4), - Description("KeyName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string KeyName; -}; - -[Dynamic, - Description("Registry") : amended, - Guid("{ae53722e-c863-11d2-8659-00c04fa321a1}"), - EventVersion(1), - DisplayName("Registry") : amended -] -class Registry_V1:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Registry") : amended, - EventType{10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22}, - EventTypeName{"Create", "Open", "Delete", "Query", "SetValue", "DeleteValue", "QueryValue", "EnumerateKey", "EnumerateValueKey", "QueryMultipleValue", "SetInformation", "Flush", "RunDown"} : amended -] -class Registry_V1_TypeGroup1:Registry_V1 -{ - [WmiDataId(1), - Description("Status") : amended, - pointer, - read] - uint32 Status; - [WmiDataId(2), - Description("KeyHandle") : amended, - pointer, - read] - uint32 KeyHandle; - [WmiDataId(3), - Description("ElapsedTime") : amended, - read] - sint64 ElapsedTime; - [WmiDataId(4), - Description("Index") : amended, - read] - uint32 Index; - [WmiDataId(5), - Description("KeyName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string KeyName; -}; - -[Dynamic, - Description("Registry") : amended, - Guid("{ae53722e-c863-11d2-8659-00c04fa321a1}"), - EventVersion(2), - DisplayName("Registry") : amended -] -class Registry:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Registry") : amended, - EventType{10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29}, - EventTypeName{"Create", "Open", "Delete", "Query", "SetValue", "DeleteValue", "QueryValue", "EnumerateKey", "EnumerateValueKey", "QueryMultipleValue", "SetInformation", "Flush", "KCBCreate", "KCBDelete", "KCBRundownBegin", "KCBRundownEnd", "Virtualize", "Close", "SetSecurity", "QuerySecurity"} : amended -] -class Registry_TypeGroup1:Registry -{ - [WmiDataId(1), - Description("Initial Time") : amended, - read] - sint64 InitialTime; - - [WmiDataId(2), - Description("Status") : amended, - read] - uint32 Status; - - [WmiDataId(3), - Description("Index") : amended, - read] - uint32 Index; - - [WmiDataId(4), - Description("KeyHandle") : amended, - pointer, - read] - uint32 KeyHandle; - - [WmiDataId(5), - Description("KeyName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string KeyName; -}; - -[Dynamic, - Description("Registry") : amended, - EventType{30, 31,32}, - EventTypeName{"TxRCommit", "TxRPrepare", "TxRRollback"} : amended -] -class Registry_TxR:Registry -{ - - [WmiDataId(1), - Description("TxRGUID") : amended, - extension("GUID"), - read] - uint8 TxrGUID[16]; - - - [WmiDataId(2), - Description("Status") : amended, - read] - uint32 Status; - - [WmiDataId(3), - Description("UOW Count") : amended, - read] - uint32 UowCount; - - [WmiDataId(4), - Description("Operation Time") : amended, - read] - uint64 OperationTime; - - [WmiDataId(5), - Description("Hive") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string Hive; - -}; - -[Dynamic, - Description("Registry") : amended, - EventType(34), - EventTypeName("Counters") : amended -] -class Registry_Counters:Registry -{ - [WmiDataId(1), - Description("Counter") : amended, - read] - uint64 Counter1; - [WmiDataId(2), - Description("Counter") : amended, - read] - uint64 Counter2; - [WmiDataId(3), - Description("Counter") : amended, - read] - uint64 Counter3; - [WmiDataId(4), - Description("Counter") : amended, - read] - uint64 Counter4; - [WmiDataId(5), - Description("Counter") : amended, - read] - uint64 Counter5; - [WmiDataId(6), - Description("Counter") : amended, - read] - uint64 Counter6; - [WmiDataId(7), - Description("Counter") : amended, - read] - uint64 Counter7; - [WmiDataId(8), - Description("Counter") : amended, - read] - uint64 Counter8; - [WmiDataId(9), - Description("Counter") : amended, - read] - uint64 Counter9; - [WmiDataId(10), - Description("Counter") : amended, - read] - uint64 Counter10; - [WmiDataId(11), - Description("Counter") : amended, - read] - uint64 Counter11; -}; - - -[Dynamic, - Description("Registry") : amended, - EventType(35), - EventTypeName("Config") : amended -] -class Registry_Config:Registry -{ - [WmiDataId(1), - Description("Current Control Set") : amended, - read] - uint32 CurrentControlSet; -}; - - -[Dynamic, - Description("Split IO Event") : amended, - Guid("{d837ca92-12b9-44a5-ad6a-3a65b3578aa8}"), - DisplayName("SplitIo") : amended, - locale("MS\\0x409") -] -class SplitIo:MSNT_SystemTrace -{ -}; - -[Dynamic, - Description("Split IO") : amended, - EventType(32), - EventTypeName("VolMgr") : amended, - locale("MS\\0x409") -] -class SplitIo_Info:SplitIo -{ - [WmiDataId(1), - Description("ParentIrp") : amended, - pointer, - read] - uint32 ParentIrp; - [WmiDataId(2), - Description("ChildIrp") : amended, - pointer, - read] - uint32 ChildIrp; -}; - -[Dynamic, - Description("File Name") : amended, - Guid("{90cbdc39-4a3e-11d1-84f4-0000f80464e3}"), - EventVersion(0), - DisplayName("FileIo") : amended -] -class FileIo_V0:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("File Name") : amended, - EventType(0), - EventTypeName("Name") : amended -] -class FileIo_V0_Name:FileIo_V0 -{ - [WmiDataId(1), - Description("FileObject") : amended, - pointer, - read] - uint32 FileObject; - [WmiDataId(2), - Description("FileName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string FileName; -}; - -[Dynamic, - Description("File Name") : amended, - Guid("{90cbdc39-4a3e-11d1-84f4-0000f80464e3}"), - EventVersion(1), - DisplayName("FileIo") : amended -] -class FileIo_V1:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("File Name") : amended, - EventType{0, 32}, - EventTypeName{"Name", "FileCreate"} : amended -] -class FileIo_V1_Name:FileIo_V1 -{ - [WmiDataId(1), - Description("FileObject") : amended, - pointer, - read] - uint32 FileObject; - [WmiDataId(2), - Description("FileName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string FileName; -}; - -[Dynamic, - Description("File Name") : amended, - Guid("{90cbdc39-4a3e-11d1-84f4-0000f80464e3}"), - EventVersion(2), - DisplayName("FileIo") : amended -] -class FileIo:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("File Name") : amended, - EventType{0, 32, 35, 36}, - EventTypeName{"Name", "FileCreate", "FileDelete", "FileRundown"} : amended -] -class FileIo_Name:FileIo -{ - [WmiDataId(1), - Description("FileObject") : amended, - pointer, - read] - uint32 FileObject; - [WmiDataId(2), - Description("FileName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string FileName; -}; - -[Dynamic, - Description("File Create") : amended, - EventType(64), - EventTypeName("Create") : amended -] -class FileIo_Create:FileIo -{ - [WmiDataId(1), - Description("IrpPtr") : amended, - pointer, - read] - uint32 IrpPtr; - [WmiDataId(2), - Description("TTID") : amended, - pointer, - read] - uint32 TTID; - [WmiDataId(3), - Description("FileObject") : amended, - pointer, - read] - uint32 FileObject; - [WmiDataId(4), - Description("CreateOptions") : amended, - read] - uint32 CreateOptions; - [WmiDataId(5), - Description("FileAttributes") : amended, - read] - uint32 FileAttributes; - [WmiDataId(6), - Description("ShareAccess") : amended, - read] - uint32 ShareAccess; - [WmiDataId(7), - Description("OpenPath") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string OpenPath; -}; - -[Dynamic, - Description("File Simple Operation") : amended, - EventType{65, 66, 73}, - EventTypeName{"Cleanup", "Close", "Flush"} : amended -] -class FileIo_SimpleOp:FileIo -{ - [WmiDataId(1), - Description("IrpPtr") : amended, - pointer, - read] - uint32 IrpPtr; - [WmiDataId(2), - Description("TTID") : amended, - pointer, - read] - uint32 TTID; - [WmiDataId(3), - Description("FileObject") : amended, - pointer, - read] - uint32 FileObject; - [WmiDataId(4), - Description("FileKey") : amended, - pointer, - read] - uint32 FileKey; -}; - -[Dynamic, - Description("File Read Write") : amended, - EventType{67, 68}, - EventTypeName{"Read", "Write"} : amended -] -class FileIo_ReadWrite:FileIo -{ - [WmiDataId(1), - Description("Offset") : amended, - read] - uint64 Offset; - [WmiDataId(2), - Description("IrpPtr") : amended, - pointer, - read] - uint32 IrpPtr; - [WmiDataId(3), - Description("TTID") : amended, - pointer, - read] - uint32 TTID; - [WmiDataId(4), - Description("FileObject") : amended, - pointer, - read] - uint32 FileObject; - [WmiDataId(5), - Description("FileKey") : amended, - pointer, - read] - uint32 FileKey; - [WmiDataId(6), - Description("IoSize") : amended, - read] - uint32 IoSize; - [WmiDataId(7), - Description("IoFlags") : amended, - read] - uint32 IoFlags; -}; - - -[Dynamic, - Description("File Information") : amended, - EventType{69, 70, 71, 74, 75}, - EventTypeName{"SetInfo", "Delete", "Rename", "QueryInfo", "FSControl"} : amended -] -class FileIo_Info:FileIo -{ - [WmiDataId(1), - Description("IrpPtr") : amended, - pointer, - read] - uint32 IrpPtr; - [WmiDataId(2), - Description("TTID") : amended, - pointer, - read] - uint32 TTID; - [WmiDataId(3), - Description("FileObject") : amended, - pointer, - read] - uint32 FileObject; - [WmiDataId(4), - Description("FileKey") : amended, - pointer, - read] - uint32 FileKey; - [WmiDataId(5), - Description("ExtraInfo") : amended, - pointer, - read] - uint32 ExtraInfo; - [WmiDataId(6), - Description("InfoClass") : amended, - read] - uint32 InfoClass; -}; - -[Dynamic, - Description("File Dir Enum") : amended, - EventType{72, 77}, - EventTypeName{"DirEnum", "DirNotify"} : amended -] -class FileIo_DirEnum:FileIo -{ - [WmiDataId(1), - Description("IrpPtr") : amended, - pointer, - read] - uint32 IrpPtr; - [WmiDataId(2), - Description("TTID") : amended, - pointer, - read] - uint32 TTID; - [WmiDataId(3), - Description("FileObject") : amended, - pointer, - read] - uint32 FileObject; - [WmiDataId(4), - Description("FileKey") : amended, - pointer, - read] - uint32 FileKey; - [WmiDataId(5), - Description("Length") : amended, - read] - uint32 Length; - [WmiDataId(6), - Description("InfoClass") : amended, - read] - uint32 InfoClass; - [WmiDataId(7), - Description("FileIndex") : amended, - read] - uint32 FileIndex; - [WmiDataId(8), - Description("FileName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string FileName; -}; - - -[Dynamic, - Description("File Operation End") : amended, - EventType(76), - EventTypeName("OperationEnd") : amended -] -class FileIo_OpEnd:FileIo -{ - [WmiDataId(1), - Description("IrpPtr") : amended, - pointer, - read] - uint32 IrpPtr; - [WmiDataId(2), - Description("ExtraInfo") : amended, - pointer, - read] - uint32 ExtraInfo; - [WmiDataId(3), - Description("NtStatus") : amended, - read] - uint32 NtStatus; -}; - -[Dynamic, - Description("TcpIp Send/Receive") : amended, - Guid("{9a280ac0-c8e0-11d1-84e2-00c04fb998a2}"), - EventVersion(0), - DisplayName("TcpIp") : amended -] -class TcpIp_V0:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("TcpIp Send/Receive") : amended, - EventType{10, 11, 12, 13, 14, 15}, - EventTypeName{"Send", "Recv", "Connect", "Disconnect", "Retransmit", "Accept"} : amended -] -class TcpIp_V0_TypeGroup1:TcpIp_V0 -{ - [WmiDataId(1), - Description("Remote IP Address") : amended, - extension("IPAddr"), - read] - object daddr; - [WmiDataId(2), - Description("Local IP Address") : amended, - extension("IPAddr"), - read] - object saddr; - [WmiDataId(3), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(4), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(5), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(6), - Description("Process ID") : amended, - read] - uint32 PID; -}; - -[Dynamic, - Description("TcpIp Send/Receive") : amended, - Guid("{9a280ac0-c8e0-11d1-84e2-00c04fb998a2}"), - EventVersion(1), - DisplayName("TcpIp") : amended -] -class TcpIp_V1:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("TcpIp Receive") : amended, - EventType(11), - EventTypeName("Recv") : amended -] -class TcpIp_V1_Receive:TcpIp_V1 -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddr"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddr"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; - [WmiDataId(8), - Description("Sequence Number") : amended, - read] - uint32 seqnum; -}; - -[Dynamic, - Description("TcpIp Disconnect") : amended, - EventType{13, 14, 16}, - EventTypeName{"Disconnect", "Retransmit", "Reconnect"} : amended -] -class TcpIp_V1_TypeGroup1:TcpIp_V1 -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddr"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddr"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; - [WmiDataId(8), - Description("Sequence Number") : amended, - read] - uint32 seqnum; -}; - -[Dynamic, - Description("TcpIp Connect/Accept") : amended, - EventType{12, 15}, - EventTypeName{"Connect", "Accept"} : amended -] -class TcpIp_V1_TypeGroup2:TcpIp_V1 -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddr"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddr"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("MSS") : amended, - read] - uint16 mss; - [WmiDataId(8), - Description("SACK Option") : amended, - read] - uint16 sackopt; - [WmiDataId(9), - Description("TimeStamp Option") : amended, - read] - uint16 tsopt; - [WmiDataId(10), - Description("WindowScale Option") : amended, - read] - uint16 wsopt; - [WmiDataId(11), - Description("TCP Window Size") : amended, - read] - uint32 rcvwin; - [WmiDataId(12), - Description("Receive Window Scale") : amended, - read] - sint16 rcvwinscale; - [WmiDataId(13), - Description("Send Window Scale") : amended, - read] - sint16 sndwinscale; - [WmiDataId(14), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; - [WmiDataId(15), - Description("Sequence Number") : amended, - read] - uint32 seqnum; -}; - -[Dynamic, - Description("TcpIp Fail") : amended, - EventType(17), - EventTypeName("Fail") : amended -] -class TcpIp_V1_Fail:TcpIp_V1 -{ - [WmiDataId(1), - Description("Protocol") : amended, - read] - uint32 Proto; -}; - -[Dynamic, - Description("TcpIp Send") : amended, - EventType(10), - EventTypeName("Send") : amended -] -class TcpIp_V1_Send:TcpIp_V1 -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddr"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddr"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("Start SendReq Time") : amended, - read] - uint32 startime; - [WmiDataId(8), - Description("End SendReq Time") : amended, - read] - uint32 endtime; - [WmiDataId(9), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; - [WmiDataId(10), - Description("Sequence Number") : amended, - read] - uint32 seqnum; -}; - -[Dynamic, - Description("TcpIp Copy/ACK") : amended, - EventType{18, 19, 20, 21, 22}, - EventTypeName{"TCPCopy", "ARPCopy", "FullACK", "PartACK", "DupACK"} : amended -] -class TcpIp_V1_TypeGroup3:TcpIp_V1 -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddr"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddr"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; - [WmiDataId(8), - Description("Sequence Number") : amended, - read] - uint32 seqnum; -}; - -[Dynamic, - Description("TcpIp Send/Receive") : amended, - Guid("{9a280ac0-c8e0-11d1-84e2-00c04fb998a2}"), - EventVersion(2), - DisplayName("TcpIp") : amended -] -class TcpIp:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("TcpIp IPV4 Send") : amended, - EventType(10), - EventTypeName("SendIPV4") : amended -] -class TcpIp_SendIPV4:TcpIp -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddrV4"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddrV4"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("Start SendReq Time") : amended, - read] - uint32 startime; - [WmiDataId(8), - Description("End SendReq Time") : amended, - read] - uint32 endtime; - [WmiDataId(9), - Description("Sequence Number") : amended, - read] - uint32 seqnum; - [WmiDataId(10), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; -}; - -[Dynamic, - Description("TcpIp IPV4 Generic") : amended, - EventType{11, 13, 14, 16, 18}, - EventTypeName{"RecvIPV4", "DisconnectIPV4", "RetransmitIPV4", "ReconnectIPV4", "TCPCopyIPV4"} : amended -] -class TcpIp_TypeGroup1:TcpIp -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddrV4"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddrV4"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("Sequence Number") : amended, - read] - uint32 seqnum; - [WmiDataId(8), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; -}; - -[Dynamic, - Description("TcpIp IPV4 Connect/Accept") : amended, - EventType{12, 15}, - EventTypeName{"ConnectIPV4", "AcceptIPV4"} : amended -] -class TcpIp_TypeGroup2:TcpIp -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddrV4"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddrV4"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("MSS") : amended, - read] - uint16 mss; - [WmiDataId(8), - Description("SACK Option") : amended, - read] - uint16 sackopt; - [WmiDataId(9), - Description("TimeStamp Option") : amended, - read] - uint16 tsopt; - [WmiDataId(10), - Description("WindowScale Option") : amended, - read] - uint16 wsopt; - [WmiDataId(11), - Description("TCP Window Size") : amended, - read] - uint32 rcvwin; - [WmiDataId(12), - Description("Receive Window Scale") : amended, - read] - sint16 rcvwinscale; - [WmiDataId(13), - Description("Send Window Scale") : amended, - read] - sint16 sndwinscale; - [WmiDataId(14), - Description("Sequence Number") : amended, - read] - uint32 seqnum; - [WmiDataId(15), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; -}; - -[Dynamic, - Description("TcpIp Fail") : amended, - EventType(17), - EventTypeName("Fail") : amended -] -class TcpIp_Fail:TcpIp -{ - [WmiDataId(1), - Description("Protocol") : amended, - read] - uint16 Proto; - [WmiDataId(2), - Description("FailureCode") : amended, - read] - uint16 FailureCode; -}; - -[Dynamic, - Description("TcpIp IPV6 Send") : amended, - EventType(26), - EventTypeName("SendIPV6") : amended -] -class TcpIp_SendIPV6:TcpIp -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddrV6"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddrV6"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("Start SendReq Time") : amended, - read] - uint32 startime; - [WmiDataId(8), - Description("End SendReq Time") : amended, - read] - uint32 endtime; - [WmiDataId(9), - Description("Sequence Number") : amended, - read] - uint32 seqnum; - [WmiDataId(10), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; -}; - -[Dynamic, - Description("TcpIp IPV6 Generic") : amended, - EventType{27, 29, 30, 32, 34}, - EventTypeName{"RecvIPV6", "DisconnectIPV6", "RetransmitIPV6", "ReconnectIPV6", "TCPCopyIPV6"} : amended -] -class TcpIp_TypeGroup3:TcpIp -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddrV6"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddrV6"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("Sequence Number") : amended, - read] - uint32 seqnum; - [WmiDataId(8), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; -}; - -[Dynamic, - Description("TcpIp IPV6 Connect/Accept") : amended, - EventType{28, 31}, - EventTypeName{"ConnectIPV6", "AcceptIPV6"} : amended -] -class TcpIp_TypeGroup4:TcpIp -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddrV6"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddrV6"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("MSS") : amended, - read] - uint16 mss; - [WmiDataId(8), - Description("SACK Option") : amended, - read] - uint16 sackopt; - [WmiDataId(9), - Description("TimeStamp Option") : amended, - read] - uint16 tsopt; - [WmiDataId(10), - Description("WindowScale Option") : amended, - read] - uint16 wsopt; - [WmiDataId(11), - Description("TCP Window Size") : amended, - read] - uint32 rcvwin; - [WmiDataId(12), - Description("Receive Window Scale") : amended, - read] - sint16 rcvwinscale; - [WmiDataId(13), - Description("Send Window Scale") : amended, - read] - sint16 sndwinscale; - [WmiDataId(14), - Description("Sequence Number") : amended, - read] - uint32 seqnum; - [WmiDataId(15), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; -}; - -[Dynamic, - Description("UdpIp Send/Receive") : amended, - Guid("{bf3a50c5-a9c9-4988-a005-2df0b7c80f80}"), - EventVersion(0), - DisplayName("UdpIp") : amended -] -class UdpIp_V0:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("UdpIp Send/Receive") : amended, - EventType{10, 11}, - EventTypeName{"Send", "Recv"} : amended -] -class UdpIp_V0_TypeGroup1:UdpIp_V0 -{ - [WmiDataId(1), - Description("Process ID") : amended, - pointer, - read] - uint32 context; - [WmiDataId(2), - Description("Local IP Address") : amended, - extension("IPAddr"), - read] - object saddr; - [WmiDataId(3), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(4), - Description("Transfer Size in Bytes") : amended, - read] - uint16 size; - [WmiDataId(5), - Description("Remote IP Address") : amended, - extension("IPAddr"), - read] - object daddr; - [WmiDataId(6), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(7), - Description("Number of Bytes successfully sent") : amended, - read] - uint16 dsize; -}; - -[Dynamic, - Description("UdpIp Send/Receive") : amended, - Guid("{bf3a50c5-a9c9-4988-a005-2df0b7c80f80}"), - EventVersion(1), - DisplayName("UdpIp") : amended -] -class UdpIp_V1:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("UdpIp Send/Receive") : amended, - EventType{10, 11}, - EventTypeName{"Send", "Recv"} : amended -] -class UdpIp_V1_TypeGroup1:UdpIp_V1 -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddr"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddr"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; -}; - -[Dynamic, - Description("UdpIp Send/Receive") : amended, - Guid("{bf3a50c5-a9c9-4988-a005-2df0b7c80f80}"), - EventVersion(2), - DisplayName("UdpIp") : amended -] -class UdpIp:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("UdpIp IPV4 Send/Receive") : amended, - EventType{10, 11}, - EventTypeName{"SendIPV4", "RecvIPV4"} : amended -] -class UdpIp_TypeGroup1:UdpIp -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddrV4"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddrV4"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("Sequence Number") : amended, - read] - uint32 seqnum; - [WmiDataId(8), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; -}; - -[Dynamic, - Description("UdpIp Fail") : amended, - EventType(17), - EventTypeName("Fail") : amended -] -class UdpIp_Fail:UdpIp -{ - [WmiDataId(1), - Description("Protocol") : amended, - read] - uint16 Proto; - [WmiDataId(2), - Description("FailureCode") : amended, - read] - uint16 FailureCode; -}; - -[Dynamic, - Description("UdpIp IPV6 Send/Receive") : amended, - EventType{26, 27}, - EventTypeName{"SendIPV6", "RecvIPV6"} : amended -] -class UdpIp_TypeGroup2:UdpIp -{ - [WmiDataId(1), - Description("Process ID") : amended, - read] - uint32 PID; - [WmiDataId(2), - Description("Transfer Size in Bytes") : amended, - read] - uint32 size; - [WmiDataId(3), - Description("Remote IP Address") : amended, - extension("IPAddrV6"), - read] - object daddr; - [WmiDataId(4), - Description("Local IP Address") : amended, - extension("IPAddrV6"), - read] - object saddr; - [WmiDataId(5), - Description("Remote Port") : amended, - extension("Port"), - read] - object dport; - [WmiDataId(6), - Description("Local Port") : amended, - extension("Port"), - read] - object sport; - [WmiDataId(7), - Description("Sequence Number") : amended, - read] - uint32 seqnum; - [WmiDataId(8), - Description("ConnID") : amended, - PointerType, - read] - uint32 connid; -}; - -[Dynamic, - Description("Image Load") : amended, - Guid("{2cb15d1d-5fc1-11d2-abe1-00a0c911f518}"), - EventVersion(0), - DisplayName("Image") : amended -] -class Image_V0:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Image Load") : amended, - EventType(10), - EventTypeName("Load") : amended -] -class Image_V0_Load:Image_V0 -{ - [WmiDataId(1), - Description("BaseAddress") : amended, - pointer, - read] - uint32 BaseAddress; - [WmiDataId(2), - Description("ModuleSize") : amended, - read] - uint32 ModuleSize; - [WmiDataId(3), - Description("ImageFileName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string ImageFileName; -}; - -[Dynamic, - Description("Image Load") : amended, - Guid("{2cb15d1d-5fc1-11d2-abe1-00a0c911f518}"), - EventVersion(1), - DisplayName("Image") : amended -] -class Image_V1:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Image Load") : amended, - EventType(10), - EventTypeName("Load") : amended -] -class Image_V1_Load:Image_V1 -{ - [WmiDataId(1), - Description("ImageBase") : amended, - pointer, - read] - uint32 ImageBase; - [WmiDataId(2), - Description("ImageSize") : amended, - pointer, - read] - uint32 ImageSize; - [WmiDataId(3), - Description("ProcessId") : amended, - read] - uint32 ProcessId; - [WmiDataId(4), - Description("FileName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string FileName; - -}; - -[Dynamic, - Description("Image Load") : amended, - Guid("{2cb15d1d-5fc1-11d2-abe1-00a0c911f518}"), - EventVersion(2), - DisplayName("Image") : amended -] -class Image:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Image Load") : amended, - EventType{10, 2, 3, 4}, - EventTypeName{"Load", "UnLoad", "DCStart", "DCEnd"} : amended -] -class Image_Load:Image -{ - [WmiDataId(1), - Description("ImageBase") : amended, - pointer, - read] - uint32 ImageBase; - [WmiDataId(2), - Description("ImageSize") : amended, - pointer, - read] - uint32 ImageSize; - [WmiDataId(3), - Description("ProcessId") : amended, - read] - uint32 ProcessId; - [WmiDataId(4), - Description("ImageChecksum") : amended, - read] - uint32 ImageChecksum; - [WmiDataId(5), - Description("TimeDateStamp") : amended, - read] - uint32 TimeDateStamp; - [WmiDataId(6), - Description("Reserved0") : amended, - read] - uint32 Reserved0; - [WmiDataId(7), - Description("DefaultBase") : amended, - pointer, - read] - uint32 DefaultBase; - [WmiDataId(8), - Description("Reserved1") : amended, - read] - uint32 Reserved1; - [WmiDataId(9), - Description("Reserved2") : amended, - read] - uint32 Reserved2; - [WmiDataId(10), - Description("Reserved3") : amended, - read] - uint32 Reserved3; - [WmiDataId(11), - Description("Reserved4") : amended, - read] - uint32 Reserved4; - [WmiDataId(12), - Description("FileName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string FileName; - -}; - -[Dynamic, - Description("Kernel Image Base") : amended, - EventType(33), - EventTypeName("KernelBase") : amended -] -class KernelImageBase:Image -{ - [WmiDataId(1), - Description("ImageBase") : amended, - pointer, - read] - uint32 ImageBase; -}; - -[Dynamic, - Description("Page Fault Event") : amended, - Guid("{3d6fa8d3-fe05-11d0-9dda-00c04fd7ba7c}"), - EventVersion(2), - DisplayName("PageFault") : amended -] -class PageFault_V2:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Page Fault Event") : amended, - EventType{10, 11, 12, 13, 14, 15}, - EventTypeName{"TransitionFault", "DemandZeroFault", "CopyOnWrite", "GuardPageFault", "HardPageFault", "AccessViolation"} : amended -] -class PageFault_TypeGroup1:PageFault_V2 -{ - [WmiDataId(1), - Description("VirtualAddress") : amended, - pointer, - read] - uint32 VirtualAddress; - [WmiDataId(2), - Description("ProgramCounter") : amended, - pointer, - read] - uint32 ProgramCounter; -}; - -[Dynamic, - Description("Hard Page Fault Event") : amended, - EventType(32), - EventTypeName("HardFault") : amended -] -class PageFault_HardFault:PageFault_V2 -{ - [WmiDataId(1), - Description("Initial Time") : amended, - extension("WmiTime"), - read] - object InitialTime; - [WmiDataId(2), - Description("ReadOffset") : amended, - format("x"), - read] - uint64 ReadOffset; - [WmiDataId(3), - Description("VirtualAddress") : amended, - pointer, - read] - uint32 VirtualAddress; - [WmiDataId(4), - Description("FileObject") : amended, - pointer, - read] - uint32 FileObject; - [WmiDataId(5), - Description("ThreadId") : amended, - format("x"), - read] - uint32 TThreadId; - [WmiDataId(6), - Description("ByteCount") : amended, - read] - uint32 ByteCount; -}; - -[Dynamic, - Description("Heap Range Rundown Event") : amended, - EventType(100), - EventTypeName("HRRundown") : amended -] -class PageFault_HeapRangeRundown_V2:PageFault_V2 -{ - [WmiDataId(1), - Description("HeapHandle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("HRFlags") : amended, - format("x"), - read] - uint32 HRFlags; - [WmiDataId(3), - Description("HRPid") : amended, - format("x"), - read] - uint32 HRPid; - [WmiDataId(4), - Description("HRRangeCount") : amended, - read] - uint32 HRRangeCount; -}; - -[Dynamic, - Description("Heap Range Create Event") : amended, - EventType(101), - EventTypeName("HRCreate") : amended -] -class PageFault_HeapRangeCreate:PageFault_V2 -{ - [WmiDataId(1), - Description("HeapHandle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("FirstRangeSize") : amended, - extension("SizeT"), - read] - object FirstRangeSize; - [WmiDataId(3), - Description("HRCreateFlags") : amended, - format("x"), - read] - uint32 HRCreateFlags; -}; - -[Dynamic, - Description("Heap Range Event") : amended, - EventType{102, 103}, - EventTypeName{"HRReserve", "HRRelease"} : amended -] -class PageFault_HeapRangeTypeGroup:PageFault_V2 -{ - [WmiDataId(1), - Description("HeapHandle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("HRAddress") : amended, - pointer, - read] - uint32 HRAddress; - [WmiDataId(3), - Description("HRSize") : amended, - extension("SizeT"), - read] - object HRSize; -}; - -[Dynamic, - Description("Heap Range Destroy Event") : amended, - EventType(104), - EventTypeName("HRDestroy") : amended -] -class PageFault_HeapRangeDestroy:PageFault_V2 -{ - [WmiDataId(1), - Description("HeapHandle") : amended, - pointer, - read] - uint32 HeapHandle; -}; - -[Dynamic, - Description("Image Load in PageFile Event") : amended, - EventType(105), - EventTypeName("ImageLoadBacked") : amended -] -class PageFault_ImageLoadBacked:PageFault_V2 -{ - [WmiDataId(1), - Description("FileObject") : amended, - pointer, - read] - uint32 FileObject; - [WmiDataId(2), - Description("DeviceChar") : amended, - format("x"), - read] - uint32 DeviceChar; - [WmiDataId(3), - Description("FileChar") : amended, - format("x"), - read] - uint16 FileChar; - [WmiDataId(4), - Description("LoadFlags") : amended, - format("x"), - read] - uint16 LoadFlags; -}; - -[Dynamic, - Description("Virtual Allocations") : amended, - EventType{98, 99}, - EventTypeName{"VirtualAlloc", "VirtualFree"} : amended -] -class PageFault_VirtualAlloc:PageFault_V2 -{ - [WmiDataId(1), - Description("BaseAddress") : amended, - pointer, - read] - uint32 BaseAddress; - [WmiDataId(2), - Description("RegionSize") : amended, - extension("SizeT"), - read] - object RegionSize; - [WmiDataId(3), - Description("ProcessId") : amended, - read] - uint32 ProcessId; - [WmiDataId(4), - Description("Flags") : amended, - format("x"), - read] - uint32 Flags; -}; - -[Dynamic, - Description("Page Fault Event") : amended, - Guid("{3d6fa8d3-fe05-11d0-9dda-00c04fd7ba7c}"), - EventVersion(3), - DisplayName("PageFault") : amended -] -class PageFault:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Heap Range Rundown Event") : amended, - EventType(100), - EventTypeName("HRRundown") : amended -] -class PageFault_HeapRangeRundown:PageFault -{ - [WmiDataId(1), - Description("HeapHandle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("HRFlags") : amended, - format("x"), - read] - uint32 HRFlags; - [WmiDataId(3), - Description("HRPid") : amended, - format("x"), - read] - uint32 HRPid; - [WmiDataId(4), - Description("HRRangeCount") : amended, - read] - uint32 HRRangeCount; - [WmiDataId(5), - Description("Reserved") : amended, - read] - uint32 Reserved; -}; - - -[Dynamic, - Description("PerfInfo Event") : amended, - Guid("{ce1dbfb4-137e-4da6-87b0-3f59aa102cbc}"), - EventVersion(1), - DisplayName("PerfInfo") : amended -] -class PerfInfo_V1:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("ISR") : amended, - EventType(67), - EventTypeName("ISR") : amended -] -class ISR_V1:PerfInfo_V1 -{ - [WmiDataId(1), - Description("Initial Time") : amended, - extension("WmiTime"), - read] - object InitialTime; - [WmiDataId(2), - Description("Routine") : amended, - pointer, - read] - uint32 Routine; - [WmiDataId(3), - Description("Return Value") : amended, - read] - uint32 ReturnValue; -}; - - -[Dynamic, - Description("DPC") : amended, - EventType{68, 69}, - EventTypeName{"DPC", "TimerDPC"} : amended -] -class DPC_V1:PerfInfo_V1 -{ - [WmiDataId(1), - Description("Initial Time") : amended, - extension("WmiTime"), - read] - object InitialTime; - [WmiDataId(2), - Description("Routine") : amended, - pointer, - read] - uint32 Routine; -}; - -[Dynamic, - Description("PerfInfo Event") : amended, - Guid("{ce1dbfb4-137e-4da6-87b0-3f59aa102cbc}"), - EventVersion(2), - DisplayName("PerfInfo") : amended -] -class PerfInfo:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Sampled Profile") : amended, - EventType(46), - EventTypeName("SampleProf") : amended -] -class SampledProfile:PerfInfo -{ - [WmiDataId(1), - Description("InstructionPointer") : amended, - pointer, - read] - uint32 InstructionPointer; - [WmiDataId(2), - Description("ThreadId") : amended, - read] - uint32 ThreadId; - [WmiDataId(3), - Description("Count") : amended, - read] - uint16 Count; - [WmiDataId(4), - Description("Reserved") : amended, - read] - uint16 Reserved; -}; - -[Dynamic, - Description("Sampled Profile Interval") : amended, - EventType{72, 73, 74}, - EventTypeName{"SetInterval", "CollectionStart", "CollectionEnd"} : amended -] -class SampledProfileInterval:PerfInfo -{ - [WmiDataId(1), - Description("Profile Source") : amended, - read] - uint32 Source; - [WmiDataId(2), - Description("New Interval") : amended, - read] - uint32 NewInterval; - [WmiDataId(3), - Description("Old Interval") : amended, - read] - uint32 OldInterval; -}; - - - -[Dynamic, - Description("System Call Enter") : amended, - EventType(51), - EventTypeName("SysClEnter") : amended -] -class SysCallEnter:PerfInfo -{ - [WmiDataId(1), - Description("SysCallAddress") : amended, - pointer, - read] - uint32 SysCallAddress; -}; - -[Dynamic, - Description("System Call Exit") : amended, - EventType(52), - EventTypeName("SysClExit") : amended -] -class SysCallExit:PerfInfo -{ - [WmiDataId(1), - Description("SysCallNtStatus") : amended, - format("x"), - read] - uint32 SysCallNtStatus; -}; - -[Dynamic, - Description("ISR") : amended, - EventType(67), - EventTypeName("ISR") : amended -] -class ISR:PerfInfo -{ - [WmiDataId(1), - Description("Initial Time") : amended, - extension("WmiTime"), - read] - object InitialTime; - [WmiDataId(2), - Description("Routine") : amended, - pointer, - read] - uint32 Routine; - [WmiDataId(3), - Description("Return Value") : amended, - read] - uint8 ReturnValue; - [WmiDataId(4), - Description("Interrupt Vector") : amended, - read] - uint8 Vector; - [WmiDataId(5), - Description("Reserved") : amended, - read] - uint16 Reserved; -}; - -[Dynamic, - Description("Message Signaled ISR") : amended, - EventType(50), - EventTypeName("ISR-MSI") : amended -] -class ISR_MSI:PerfInfo -{ - [WmiDataId(1), - Description("Initial Time") : amended, - extension("WmiTime"), - read] - object InitialTime; - [WmiDataId(2), - Description("Routine") : amended, - pointer, - read] - uint32 Routine; - [WmiDataId(3), - Description("Return Value") : amended, - read] - uint8 ReturnValue; - [WmiDataId(4), - Description("Interrupt Vector") : amended, - read] - uint8 Vector; - [WmiDataId(5), - Description("Reserved") : amended, - read] - uint16 Reserved; - [WmiDataId(6), - Description("Message Number") : amended, - read] - uint32 MessageNumber; -}; - - -[Dynamic, - Description("DPC") : amended, - EventType{66, 68, 69}, - EventTypeName{"ThreadedDPC", "DPC", "TimerDPC"} : amended -] -class DPC:PerfInfo -{ - [WmiDataId(1), - Description("Initial Time") : amended, - extension("WmiTime"), - read] - object InitialTime; - [WmiDataId(2), - Description("Routine") : amended, - pointer, - read] - uint32 Routine; -}; - -[Dynamic, - Description("Debugger Enabled") : amended, - EventType{58}, - EventTypeName{"DebuggerEnabled"} : amended -] -class DebuggerEnabled:PerfInfo -{ -}; - -[Dynamic, - Description("StackWalk Event") : amended, - Guid("{def2fe46-7bd6-4b80-bd94-f57fe20d0ce3}"), - DisplayName("StackWalk") : amended -] -class StackWalk:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("StackWalk Event") : amended, - EventType(32), - EventTypeName("Stack") : amended -] -class StackWalk_Event:StackWalk -{ - [WmiDataId(1), - Description("TimeStamp") : amended, - read] - uint64 EventTimeStamp; - [WmiDataId(2), - Description("ProcessId") : amended, - format("x"), - read] - uint32 StackProcess; - [WmiDataId(3), - Description("ThreadId") : amended, - read] - uint32 StackThread; - [WmiDataId(4), - Description("Stack1") : amended, - pointer, - read] - uint32 Stack1; - [WmiDataId(5), - Description("Stack2") : amended, - pointer, - read] - uint32 Stack2; - [WmiDataId(6), - Description("Stack3") : amended, - pointer, - read] - uint32 Stack3; - [WmiDataId(7), - Description("Stack4") : amended, - pointer, - read] - uint32 Stack4; - [WmiDataId(8), - Description("Stack5") : amended, - pointer, - read] - uint32 Stack5; - [WmiDataId(9), - Description("Stack6") : amended, - pointer, - read] - uint32 Stack6; - [WmiDataId(10), - Description("Stack7") : amended, - pointer, - read] - uint32 Stack7; - [WmiDataId(11), - Description("Stack8") : amended, - pointer, - read] - uint32 Stack8; - [WmiDataId(12), - Description("Stack9") : amended, - pointer, - read] - uint32 Stack9; - [WmiDataId(13), - Description("Stack10") : amended, - pointer, - read] - uint32 Stack10; - [WmiDataId(14), - Description("Stack11") : amended, - pointer, - read] - uint32 Stack11; - [WmiDataId(15), - Description("Stack12") : amended, - pointer, - read] - uint32 Stack12; - [WmiDataId(16), - Description("Stack13") : amended, - pointer, - read] - uint32 Stack13; - [WmiDataId(17), - Description("Stack14") : amended, - pointer, - read] - uint32 Stack14; - [WmiDataId(18), - Description("Stack15") : amended, - pointer, - read] - uint32 Stack15; - [WmiDataId(19), - Description("Stack16") : amended, - pointer, - read] - uint32 Stack16; - [WmiDataId(20), - Description("Stack17") : amended, - pointer, - read] - uint32 Stack17; - [WmiDataId(21), - Description("Stack18") : amended, - pointer, - read] - uint32 Stack18; - [WmiDataId(22), - Description("Stack19") : amended, - pointer, - read] - uint32 Stack19; - [WmiDataId(23), - Description("Stack20") : amended, - pointer, - read] - uint32 Stack20; - [WmiDataId(24), - Description("Stack21") : amended, - pointer, - read] - uint32 Stack21; - [WmiDataId(25), - Description("Stack22") : amended, - pointer, - read] - uint32 Stack22; - [WmiDataId(26), - Description("Stack23") : amended, - pointer, - read] - uint32 Stack23; - [WmiDataId(27), - Description("Stack24") : amended, - pointer, - read] - uint32 Stack24; - [WmiDataId(28), - Description("Stack25") : amended, - pointer, - read] - uint32 Stack25; - [WmiDataId(29), - Description("Stack26") : amended, - pointer, - read] - uint32 Stack26; - [WmiDataId(30), - Description("Stack27") : amended, - pointer, - read] - uint32 Stack27; - [WmiDataId(31), - Description("Stack28") : amended, - pointer, - read] - uint32 Stack28; - [WmiDataId(32), - Description("Stack29") : amended, - pointer, - read] - uint32 Stack29; - [WmiDataId(33), - Description("Stack30") : amended, - pointer, - read] - uint32 Stack30; - [WmiDataId(34), - Description("Stack31") : amended, - pointer, - read] - uint32 Stack31; - [WmiDataId(35), - Description("Stack32") : amended, - pointer, - read] - uint32 Stack32; - -}; - - -[Dynamic, - Description("ALPC Event") : amended, - Guid("{45d8cccd-539f-4b72-a8b7-5c683142609a}"), - DisplayName("ALPC") : amended -] -class ALPC:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("ALPC Send Message") : amended, - EventType(33), - EventTypeName("ALPC-Send-Message") : amended -] -class ALPC_Send_Message:ALPC -{ - [WmiDataId(1), - Description("MessageID") : amended, - read] - uint32 MessageID; -}; - -[Dynamic, - Description("ALPC Receive Message") : amended, - EventType(34), - EventTypeName("ALPC-Receive-Message") : amended -] -class ALPC_Receive_Message:ALPC -{ - [WmiDataId(1), - Description("MessageID") : amended, - read] - uint32 MessageID; -}; - -[Dynamic, - Description("ALPC Wait For Reply") : amended, - EventType(35), - EventTypeName("ALPC-Wait-For-Reply") : amended -] -class ALPC_Wait_For_Reply:ALPC -{ - [WmiDataId(1), - Description("MessageID") : amended, - read] - uint32 MessageID; -}; - -[Dynamic, - Description("ALPC Wait For New Message") : amended, - EventType(36), - EventTypeName("ALPC-Wait-For-New-Message") : amended -] -class ALPC_Wait_For_New_Message:ALPC -{ - [WmiDataId(1), - Description("IsServerPort") : amended, - read] - uint32 IsServerPort; - [WmiDataId(2), - Description("PortName") : amended, - read] - string PortName; -}; - -[Dynamic, - Description("ALPC Unwait") : amended, - EventType(37), - EventTypeName("ALPC-Unwait") : amended -] -class ALPC_Unwait:ALPC -{ - [WmiDataId(1), - Description("Status") : amended, - read] - uint32 Status; -}; - -[Dynamic, - Description("Heap Trace Provider"): amended, - Guid("{222962ab-6180-4b88-a825-346b75f2a24a}") -] -class HeapTraceProvider:EventTrace -{ - -}; - -[Dynamic, - Description("Heap Event") : amended, - Guid("{222962ab-6180-4b88-a825-346b75f2a24a}"), - EventVersion(2), - DisplayName("Heap") : amended -] -class HeapTrace_V2:HeapTraceProvider -{ - -}; - -[Dynamic, - Description("Heap Create") : amended, - EventType(32), - EventTypeName("Create") : amended -] -class HeapCreate_V2:HeapTrace_V2 -{ - [WmiDataId(1), - Description("Heap Handle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("Heap Flags") : amended, - read] - uint32 HeapFlags; -}; - -[Dynamic, - Description("Heap Allocate") : amended, - EventType(33), - EventTypeName("Alloc") : amended -] -class HeapAlloc:HeapTrace_V2 -{ - [WmiDataId(1), - Description("Heap Handle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("Allocation Size") : amended, - extension("SizeT"), - read] - object AllocSize; - [WmiDataId(3), - Description("Allocation Address") : amended, - pointer, - read] - uint32 AllocAddress; - [WmiDataId(4), - Description("Source ID") : amended, - read] - uint32 SourceId; -}; - -[Dynamic, - Description("Heap ReAllocate") : amended, - EventType(34), - EventTypeName("ReAlloc") : amended -] -class HeapRealloc:HeapTrace_V2 -{ - [WmiDataId(1), - Description("Heap Handle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("New Allocation Address") : amended, - pointer, - read] - uint32 NewAllocAddress; - [WmiDataId(3), - Description("Old Allocation Address") : amended, - pointer, - read] - uint32 OldAllocAddress; - [WmiDataId(4), - Description("New Allocation Size") : amended, - extension("SizeT"), - read] - object NewAllocSize; - [WmiDataId(5), - Description("Old Allocation Size") : amended, - extension("SizeT"), - read] - object OldAllocSize; - [WmiDataId(6), - Description("Source ID") : amended, - read] - uint32 SourceId; -}; - -[Dynamic, - Description("Heap Free") : amended, - EventType(36), - EventTypeName("Free") : amended -] -class HeapFree:HeapTrace_V2 -{ - [WmiDataId(1), - Description("Heap Handle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("Free Address") : amended, - pointer, - read] - uint32 FreeAddress; - [WmiDataId(3), - Description("Source ID") : amended, - read] - uint32 SourceId; -}; - -[Dynamic, - Description("Heap SnapShot") : amended, - EventType(38), - EventTypeName("SnapShot") : amended -] -class HeapSnapShot_V2:HeapTrace_V2 -{ - [WmiDataId(1), - Description("Heap Handle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("Free Space") : amended, - extension("SizeT"), - read] - object FreeSpace; - [WmiDataId(3), - Description("Committed Space") : amended, - extension("SizeT"), - read] - object CommittedSpace; - [WmiDataId(4), - Description("Reserved Space") : amended, - extension("SizeT"), - read] - object ReservedSpace; - [WmiDataId(5), - Description("Heap Flags") : amended, - read] - uint32 HeapFlags; - [WmiDataId(6), - Description("Process ID") : amended, - read] - uint32 ProcessId; - [WmiDataId(7), - Description("Large UCR Space") : amended, - extension("SizeT"), - read] - object LargeUCRSpace; - [WmiDataId(8), - Description("Free List Length") : amended, - read] - uint32 FreeListLength; - [WmiDataId(9), - Description("UCR Length") : amended, - read] - uint32 UCRLength; -}; - -[Dynamic, - Description("Heap Events") : amended, - EventType{35, 43, 44, 45, 46}, - EventTypeName{"Destroy", "Lock", "Unlock", "Validate", "Walk"} : amended -] -class Heap_TypeGroup1:HeapTrace_V2 -{ - [WmiDataId(1), - Description("Heap Handle") : amended, - pointer, - read] - uint32 HeapHandle; -}; - -[Dynamic, - Description("Heap Subsegment Events") : amended, - EventType{47, 48, 49, 50}, - EventTypeName{"SubsegmentAlloc", "SubsegmentFree", "SubsegmentAllocCached", "SubsegmentFreeCached"} : amended -] -class Heap_SubsegmentGroup:HeapTrace_V2 -{ - [WmiDataId(1), - Description("Heap Handle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("Subsegment") : amended, - pointer, - read] - uint32 SubSegment; - [WmiDataId(3), - Description("Subsegment Size") : amended, - extension("SizeT"), - read] - object SubSegmentSize; - [WmiDataId(4), - Description("Block Size") : amended, - extension("SizeT"), - read] - object BlockSize; -}; - -[Dynamic, - Description("Heap Commit and Decommit") : amended, - EventType{51, 52}, - EventTypeName{"Commit", "Decommit"} : amended -] -class HeapCommitDecommit:HeapTrace_V2 -{ - [WmiDataId(1), - Description("Heap Handle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("Block Address") : amended, - pointer, - read] - uint32 Block; - [WmiDataId(3), - Description("Block Size") : amended, - extension("SizeT"), - read] - object Size; - [WmiDataId(4), - Description("Caller") : amended, - read] - uint32 Caller; -}; - -[Dynamic, - Description("Heap Event") : amended, - Guid("{222962ab-6180-4b88-a825-346b75f2a24a}"), - EventVersion(3), - DisplayName("Heap") : amended -] -class HeapTrace:HeapTraceProvider -{ - -}; - -[Dynamic, - Description("Heap Create") : amended, - EventType(32), - EventTypeName("Create") : amended -] -class HeapCreate:HeapTrace -{ - [WmiDataId(1), - Description("Heap Handle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("Heap Flags") : amended, - read] - uint32 HeapFlags; - [WmiDataId(3), - Description("Reserved Space") : amended, - extension("SizeT"), - read] - object ReservedSpace; - [WmiDataId(4), - Description("Committed Space") : amended, - extension("SizeT"), - read] - object CommittedSpace; - [WmiDataId(5), - Description("Allocated Size") : amended, - extension("SizeT"), - read] - object AllocatedSpace; -}; - -[Dynamic, - Description("Heap Expand") : amended, - EventType(37), - EventTypeName("Expand") : amended -] -class HeapExpand:HeapTrace -{ - [WmiDataId(1), - Description("Heap Handle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("Committed Size") : amended, - extension("SizeT"), - read] - object CommittedSize; - [WmiDataId(3), - Description("Committed Address") : amended, - pointer, - read] - uint32 CommitAddress; - [WmiDataId(4), - Description("Free Space") : amended, - extension("SizeT"), - read] - object FreeSpace; - [WmiDataId(5), - Description("Committed Space") : amended, - extension("SizeT"), - read] - object CommittedSpace; - [WmiDataId(6), - Description("Reserved Space") : amended, - extension("SizeT"), - read] - object ReservedSpace; - [WmiDataId(7), - Description("Number Of UCRs") : amended, - read] - uint32 NoOfUCRs; - [WmiDataId(8), - Description("Allocated Space") : amended, - extension("SizeT"), - read] - object AllocatedSpace; -}; - -[Dynamic, - Description("Heap SnapShot") : amended, - EventType(38), - EventTypeName("SnapShot") : amended -] -class HeapSnapShot:HeapTrace -{ - [WmiDataId(1), - Description("Heap Handle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("Free Space") : amended, - extension("SizeT"), - read] - object FreeSpace; - [WmiDataId(3), - Description("Committed Space") : amended, - extension("SizeT"), - read] - object CommittedSpace; - [WmiDataId(4), - Description("Reserved Space") : amended, - extension("SizeT"), - read] - object ReservedSpace; - [WmiDataId(5), - Description("Heap Flags") : amended, - read] - uint32 HeapFlags; - [WmiDataId(6), - Description("ProcessId") : amended, - read] - uint32 ProcessId; - [WmiDataId(7), - Description("Large UCR Space") : amended, - extension("SizeT"), - read] - object LargeUCRSpace; - [WmiDataId(8), - Description("Free List Length") : amended, - read] - uint32 FreeListLength; - [WmiDataId(9), - Description("UCR Length") : amended, - read] - uint32 UCRLength; - [WmiDataId(10), - Description("Allocated Space") : amended, - extension("SizeT"), - read] - object AllocatedSpace; -}; - -[Dynamic, - Description("Heap Contract") : amended, - EventType(42), - EventTypeName("Contract") : amended -] -class HeapContract:HeapTrace -{ - [WmiDataId(1), - Description("Heap Handle") : amended, - pointer, - read] - uint32 HeapHandle; - [WmiDataId(2), - Description("DeCommitted Size") : amended, - extension("SizeT"), - read] - object DeCommittedSize; - [WmiDataId(3), - Description("DeCommitted Address") : amended, - pointer, - read] - uint32 DeCommitAddress; - [WmiDataId(4), - Description("Free Space") : amended, - extension("SizeT"), - read] - object FreeSpace; - [WmiDataId(5), - Description("Committed Space") : amended, - extension("SizeT"), - read] - object CommittedSpace; - [WmiDataId(6), - Description("Reserved Space") : amended, - extension("SizeT"), - read] - object ReservedSpace; - [WmiDataId(7), - Description("Number Of UCRs") : amended, - read] - uint32 NoOfUCRs; - [WmiDataId(8), - Description("Allocated Space") : amended, - extension("SizeT"), - read] - object AllocatedSpace; -}; - - -[Dynamic, - Description("Critical Section Trace Provider") : amended, - Guid("{3AC66736-CC59-4cff-8115-8DF50E39816B}") -] -class CritSecTraceProvider:EventTrace -{ - -}; - -[Dynamic, - Description("Critical Section Event") : amended, - Guid("{3AC66736-CC59-4cff-8115-8DF50E39816B}"), - DisplayName("CritSec") : amended -] -class CritSecTrace:CritSecTraceProvider -{ - -}; - -[Dynamic, - Description("Critical Section Collision") : amended, - EventType(34), - EventTypeName("Collision") : amended -] -class CritSecCollision:CritSecTrace -{ - [WmiDataId(1), - Description("Lock Count") : amended, - read] - uint32 LockCount; - [WmiDataId(2), - Description("Spin Count") : amended, - read] - uint32 SpinCount; - [WmiDataId(3), - Description("Owning Thread") : amended, - pointer, - read] - uint32 OwningThread; - [WmiDataId(4), - Description("Critical Section Address") : amended, - pointer, - read] - uint32 CritSecAddr; -}; - -[Dynamic, - Description("Critical Section Initialize") : amended, - EventType(35), - EventTypeName("Initialize") : amended -] -class CritSecInit:CritSecTrace -{ - [WmiDataId(1), - Description("Spin Count") : amended, - pointer, - read] - uint32 SpinCount; - [WmiDataId(2), - Description("Critical Section Address") : amended, - pointer, - read] - uint32 CritSecAddr; -}; - -[Dynamic, - Description("Lost Event Event") : amended, - Guid("{6a399ae0-4bc6-4de9-870b-3657f8947e7e}"), - DisplayName("LostEvent") : amended -] -class Lost_Event:MSNT_SystemTrace -{ -}; - -[Dynamic, - Description("RT Lost Event") : amended, - EventType{32, 33, 34}, - EventTypeName{"RTLostEvent", "RTLostBuffer", "RTLostFile"} : amended -] -class RT_LostEvent:Lost_Event -{ -}; - - -[Dynamic, - Description("System Configuration") : amended, - Guid("{01853a65-418f-4f36-aefc-dc0f1d2fd235}"), - EventVersion(0), - DisplayName("SystemConfig") : amended -] -class SystemConfig_V0:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(10), - EventTypeName("CPU") : amended -] -class SystemConfig_V0_CPU:SystemConfig_V0 -{ - [WmiDataId(1), - Description("MHz") : amended, - read] - uint32 MHz; - [WmiDataId(2), - Description("NumberOfProcessors") : amended, - read] - uint32 NumberOfProcessors; - [WmiDataId(3), - Description("MemSize") : amended, - read] - uint32 MemSize; - [WmiDataId(4), - Description("PageSize") : amended, - read] - uint32 PageSize; - [WmiDataId(5), - Description("AllocationGranularity") : amended, - read] - uint32 AllocationGranularity; - [WmiDataId(6), - Description("ComputerName") : amended, - read] - char16 ComputerName[256]; - [WmiDataId(7), - Description("DomainName") : amended, - read] - char16 DomainName[132]; - [WmiDataId(8), - Description("HyperThreadingFlag") : amended, - pointer, - read] - uint32 HyperThreadingFlag; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(11), - EventTypeName("PhyDisk") : amended -] -class SystemConfig_V0_PhyDisk:SystemConfig_V0 -{ - [WmiDataId(1), - Description("DiskNumber") : amended, - read] - uint32 DiskNumber; - [WmiDataId(2), - Description("BytesPerSector") : amended, - read] - uint32 BytesPerSector; - [WmiDataId(3), - Description("SectorsPerTrack") : amended, - read] - uint32 SectorsPerTrack; - [WmiDataId(4), - Description("TracksPerCylinder") : amended, - read] - uint32 TracksPerCylinder; - [WmiDataId(5), - Description("Cylinders") : amended, - read] - uint64 Cylinders; - [WmiDataId(6), - Description("SCSIPort") : amended, - read] - uint32 SCSIPort; - [WmiDataId(7), - Description("SCSIPath") : amended, - read] - uint32 SCSIPath; - [WmiDataId(8), - Description("SCSITarget") : amended, - read] - uint32 SCSITarget; - [WmiDataId(9), - Description("SCSILun") : amended, - read] - uint32 SCSILun; - [WmiDataId(10), - Description("Manufacturer") : amended, - read] - char16 Manufacturer[256]; - [WmiDataId(11), - Description("PartitionCount") : amended, - read] - uint32 PartitionCount; - [WmiDataId(12), - Description("WriteCacheEnabled") : amended, - read] - uint8 WriteCacheEnabled; - [WmiDataId(13), - Description("Pad: not used") : amended, - read] - uint8 Pad; - [WmiDataId(14), - Description("BootDriveLetter") : amended, - read] - char16 BootDriveLetter[3]; - [WmiDataId(15), - Description("Spare") : amended, - read] - char16 Spare[2]; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(12), - EventTypeName("LogDisk") : amended -] -class SystemConfig_V0_LogDisk:SystemConfig_V0 -{ - [WmiDataId(1), - Description("StartOffset") : amended, - read] - uint64 StartOffset; - [WmiDataId(2), - Description("PartitionSize") : amended, - read] - uint64 PartitionSize; - [WmiDataId(3), - Description("DiskNumber") : amended, - read] - uint32 DiskNumber; - [WmiDataId(4), - Description("Size") : amended, - read] - uint32 Size; - [WmiDataId(5), - Description("DriveType") : amended, - read] - uint32 DriveType; - [WmiDataId(6), - Description("DriveLetter") : amended, - read] - char16 DriveLetterString[4]; - [WmiDataId(7), - Description("Pad1") : amended, - read] - uint32 Pad1; - [WmiDataId(8), - Description("PartitionNumber") : amended, - read] - uint32 PartitionNumber; - [WmiDataId(9), - Description("SectorsPerCluster") : amended, - read] - uint32 SectorsPerCluster; - [WmiDataId(10), - Description("BytesPerSector") : amended, - read] - uint32 BytesPerSector; - [WmiDataId(11), - Description("Pad2") : amended, - read] - uint32 Pad2; - [WmiDataId(12), - Description("NumberOfFreeClusters") : amended, - read] - sint64 NumberOfFreeClusters; - [WmiDataId(13), - Description("TotalNumberOfClusters") : amended, - read] - sint64 TotalNumberOfClusters; - [WmiDataId(14), - Description("FileSystem") : amended, - read] - char16 FileSystem[16]; - [WmiDataId(15), - Description("VolumeExtent") : amended, - read] - uint32 VolumeExt; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(13), - EventTypeName("NIC") : amended -] -class SystemConfig_V0_NIC:SystemConfig_V0 -{ - [WmiDataId(1), - Description("NICName") : amended, - read] - char16 NICName[256]; - [WmiDataId(2), - Description("Index") : amended, - read] - uint32 Index; - [WmiDataId(3), - Description("PhysicalAddressLen") : amended, - read] - uint32 PhysicalAddrLen; - [WmiDataId(4), - Description("PhysicalAddress") : amended, - read] - char16 PhysicalAddr[8]; - [WmiDataId(5), - Description("Size") : amended, - read] - uint32 Size; - [WmiDataId(6), - Description("IpAddress") : amended, - read] - sint32 IpAddress; - [WmiDataId(7), - Description("SubnetMask") : amended, - read] - sint32 SubnetMask; - [WmiDataId(8), - Description("DhcpServer") : amended, - read] - sint32 DhcpServer; - [WmiDataId(9), - Description("Gateway") : amended, - read] - sint32 Gateway; - [WmiDataId(10), - Description("PrimaryWinsServer") : amended, - read] - sint32 PrimaryWinsServer; - [WmiDataId(11), - Description("SecondaryWinsServer") : amended, - read] - sint32 SecondaryWinsServer; - [WmiDataId(12), - Description("DnsServer1") : amended, - read] - sint32 DnsServer1; - [WmiDataId(13), - Description("DnsServer2") : amended, - read] - sint32 DnsServer2; - [WmiDataId(14), - Description("DnsServer3") : amended, - read] - sint32 DnsServer3; - [WmiDataId(15), - Description("DnsServer4") : amended, - read] - sint32 DnsServer4; - [WmiDataId(16), - Description("Reserved; do not use.") : amended, - read] - uint32 Data; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(14), - EventTypeName("Video") : amended -] -class SystemConfig_V0_Video:SystemConfig_V0 -{ - [WmiDataId(1), - Description("MemorySize") : amended, - read] - uint32 MemorySize; - [WmiDataId(2), - Description("XResolution") : amended, - read] - uint32 XResolution; - [WmiDataId(3), - Description("YResolution") : amended, - read] - uint32 YResolution; - [WmiDataId(4), - Description("BitsPerPixel") : amended, - read] - uint32 BitsPerPixel; - [WmiDataId(5), - Description("VRefresh") : amended, - read] - uint32 VRefresh; - [WmiDataId(6), - Description("ChipType") : amended, - read] - char16 ChipType[256]; - [WmiDataId(7), - Description("DACType") : amended, - read] - char16 DACType[256]; - [WmiDataId(8), - Description("AdapterString") : amended, - read] - char16 AdapterString[256]; - [WmiDataId(9), - Description("BiosString") : amended, - read] - char16 BiosString[256]; - [WmiDataId(10), - Description("Device Name") : amended, - read] - char16 DeviceId[256]; - [WmiDataId(11), - Description("StateFlags") : amended, - format("x"), - read] - uint32 StateFlags; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(15), - EventTypeName("Services") : amended -] -class SystemConfig_V0_Services:SystemConfig_V0 -{ - [WmiDataId(1), - Description("ServiceName") : amended, - read] - char16 ServiceName[34]; - [WmiDataId(2), - Description("DisplayName") : amended, - read] - char16 DisplayName[256]; - [WmiDataId(3), - Description("ProcessName") : amended, - read] - char16 ProcessName[34]; - [WmiDataId(4), - Description("ProcessId") : amended, - read] - uint32 ProcessId; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(16), - EventTypeName("Power") : amended -] -class SystemConfig_V0_Power:SystemConfig_V0 -{ - [WmiDataId(1), - Description("S1") : amended, - read] - uint8 S1; - [WmiDataId(2), - Description("S2") : amended, - read] - uint8 S2; - [WmiDataId(3), - Description("S3") : amended, - read] - uint8 S3; - [WmiDataId(4), - Description("S4") : amended, - read] - uint8 S4; - [WmiDataId(5), - Description("S5") : amended, - read] - uint8 S5; - [WmiDataId(6), - Description("Reserved; do not use.") : amended, - read] - uint8 Pad1; - [WmiDataId(7), - Description("Reserved; do not use.") : amended, - read] - uint8 Pad2; - [WmiDataId(8), - Description("Reserved; do not use.") : amended, - read] - uint8 Pad3; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(21), - EventTypeName("IRQ") : amended -] -class SystemConfig_V0_IRQ:SystemConfig_V0 -{ - [WmiDataId(1), - Description("IRQAffinity") : amended, - format("x"), - read] - uint64 IRQAffinity; - [WmiDataId(2), - Description("IRQNum") : amended, - read] - uint32 IRQNum; - [WmiDataId(3), - Description("DeviceDescriptionLen") : amended, - read] - uint32 DeviceDescriptionLen; - [WmiDataId(4), - Description("DeviceDescription") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DeviceDescription; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(22), - EventTypeName("PnP") : amended -] -class SystemConfig_V0_PnP:SystemConfig_V0 -{ - [WmiDataId(1), - Description("IDLength") : amended, - read] - uint32 IDLength; - [WmiDataId(2), - Description("DescriptionLength") : amended, - read] - uint32 DescriptionLength; - [WmiDataId(3), - Description("FriendlyNameLength") : amended, - read] - uint32 FriendlyNameLength; - [WmiDataId(4), - Description("DeviceID") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DeviceID; - [WmiDataId(5), - Description("DeviceDescription") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DeviceDescription; - [WmiDataId(6), - Description("FriendlyName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string FriendlyName; -}; - -[Dynamic, - Description("System Configuration") : amended, - Guid("{01853a65-418f-4f36-aefc-dc0f1d2fd235}"), - EventVersion(1), - DisplayName("SystemConfig") : amended -] -class SystemConfig_V1:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(10), - EventTypeName("CPU") : amended -] -class SystemConfig_V1_CPU:SystemConfig_V1 -{ - [WmiDataId(1), - Description("MHz") : amended, - read] - uint32 MHz; - [WmiDataId(2), - Description("NumberOfProcessors") : amended, - read] - uint32 NumberOfProcessors; - [WmiDataId(3), - Description("MemSize") : amended, - read] - uint32 MemSize; - [WmiDataId(4), - Description("PageSize") : amended, - read] - uint32 PageSize; - [WmiDataId(5), - Description("AllocationGranularity") : amended, - read] - uint32 AllocationGranularity; - [WmiDataId(6), - Description("ComputerName") : amended, - read] - char16 ComputerName[256]; - [WmiDataId(7), - Description("DomainName") : amended, - read] - char16 DomainName[132]; - [WmiDataId(8), - Description("HyperThreadingFlag") : amended, - pointer, - read] - uint32 HyperThreadingFlag; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(11), - EventTypeName("PhyDisk") : amended -] -class SystemConfig_V1_PhyDisk:SystemConfig_V1 -{ - [WmiDataId(1), - Description("DiskNumber") : amended, - read] - uint32 DiskNumber; - [WmiDataId(2), - Description("BytesPerSector") : amended, - read] - uint32 BytesPerSector; - [WmiDataId(3), - Description("SectorsPerTrack") : amended, - read] - uint32 SectorsPerTrack; - [WmiDataId(4), - Description("TracksPerCylinder") : amended, - read] - uint32 TracksPerCylinder; - [WmiDataId(5), - Description("Cylinders") : amended, - read] - uint64 Cylinders; - [WmiDataId(6), - Description("SCSIPort") : amended, - read] - uint32 SCSIPort; - [WmiDataId(7), - Description("SCSIPath") : amended, - read] - uint32 SCSIPath; - [WmiDataId(8), - Description("SCSITarget") : amended, - read] - uint32 SCSITarget; - [WmiDataId(9), - Description("SCSILun") : amended, - read] - uint32 SCSILun; - [WmiDataId(10), - Description("Manufacturer") : amended, - read] - char16 Manufacturer[256]; - [WmiDataId(11), - Description("PartitionCount") : amended, - read] - uint32 PartitionCount; - [WmiDataId(12), - Description("WriteCacheEnabled") : amended, - read] - uint8 WriteCacheEnabled; - [WmiDataId(13), - Description("Pad: not used") : amended, - read] - uint8 Pad; - [WmiDataId(14), - Description("BootDriveLetter") : amended, - read] - char16 BootDriveLetter[3]; - [WmiDataId(15), - Description("Spare") : amended, - read] - char16 Spare[2]; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(12), - EventTypeName("LogDisk") : amended -] -class SystemConfig_V1_LogDisk:SystemConfig_V1 -{ - [WmiDataId(1), - Description("StartOffset") : amended, - read] - uint64 StartOffset; - [WmiDataId(2), - Description("PartitionSize") : amended, - read] - uint64 PartitionSize; - [WmiDataId(3), - Description("DiskNumber") : amended, - read] - uint32 DiskNumber; - [WmiDataId(4), - Description("Size") : amended, - read] - uint32 Size; - [WmiDataId(5), - Description("DriveType") : amended, - read] - uint32 DriveType; - [WmiDataId(6), - Description("DriveLetter") : amended, - read] - char16 DriveLetterString[4]; - [WmiDataId(7), - Description("Pad1") : amended, - read] - uint32 Pad1; - [WmiDataId(8), - Description("PartitionNumber") : amended, - read] - uint32 PartitionNumber; - [WmiDataId(9), - Description("SectorsPerCluster") : amended, - read] - uint32 SectorsPerCluster; - [WmiDataId(10), - Description("BytesPerSector") : amended, - read] - uint32 BytesPerSector; - [WmiDataId(11), - Description("Pad2") : amended, - read] - uint32 Pad2; - [WmiDataId(12), - Description("NumberOfFreeClusters") : amended, - read] - sint64 NumberOfFreeClusters; - [WmiDataId(13), - Description("TotalNumberOfClusters") : amended, - read] - sint64 TotalNumberOfClusters; - [WmiDataId(14), - Description("FileSystem") : amended, - read] - char16 FileSystem[16]; - [WmiDataId(15), - Description("VolumeExtent") : amended, - read] - uint32 VolumeExt; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(13), - EventTypeName("NIC") : amended -] -class SystemConfig_V1_NIC:SystemConfig_V1 -{ - [WmiDataId(1), - Description("NICName") : amended, - read] - char16 NICName[256]; - [WmiDataId(2), - Description("Index") : amended, - read] - uint32 Index; - [WmiDataId(3), - Description("PhysicalAddressLen") : amended, - read] - uint32 PhysicalAddrLen; - [WmiDataId(4), - Description("PhysicalAddress") : amended, - read] - char16 PhysicalAddr[8]; - [WmiDataId(5), - Description("Size") : amended, - read] - uint32 Size; - [WmiDataId(6), - Description("IpAddress") : amended, - read] - sint32 IpAddress; - [WmiDataId(7), - Description("SubnetMask") : amended, - read] - sint32 SubnetMask; - [WmiDataId(8), - Description("DhcpServer") : amended, - read] - sint32 DhcpServer; - [WmiDataId(9), - Description("Gateway") : amended, - read] - sint32 Gateway; - [WmiDataId(10), - Description("PrimaryWinsServer") : amended, - read] - sint32 PrimaryWinsServer; - [WmiDataId(11), - Description("SecondaryWinsServer") : amended, - read] - sint32 SecondaryWinsServer; - [WmiDataId(12), - Description("DnsServer1") : amended, - read] - sint32 DnsServer1; - [WmiDataId(13), - Description("DnsServer2") : amended, - read] - sint32 DnsServer2; - [WmiDataId(14), - Description("DnsServer3") : amended, - read] - sint32 DnsServer3; - [WmiDataId(15), - Description("DnsServer4") : amended, - read] - sint32 DnsServer4; - [WmiDataId(16), - Description("Reserved; do not use.") : amended, - read] - uint32 Data; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(14), - EventTypeName("Video") : amended -] -class SystemConfig_V1_Video:SystemConfig_V1 -{ - [WmiDataId(1), - Description("MemorySize") : amended, - read] - uint32 MemorySize; - [WmiDataId(2), - Description("XResolution") : amended, - read] - uint32 XResolution; - [WmiDataId(3), - Description("YResolution") : amended, - read] - uint32 YResolution; - [WmiDataId(4), - Description("BitsPerPixel") : amended, - read] - uint32 BitsPerPixel; - [WmiDataId(5), - Description("VRefresh") : amended, - read] - uint32 VRefresh; - [WmiDataId(6), - Description("ChipType") : amended, - read] - char16 ChipType[256]; - [WmiDataId(7), - Description("DACType") : amended, - read] - char16 DACType[256]; - [WmiDataId(8), - Description("AdapterString") : amended, - read] - char16 AdapterString[256]; - [WmiDataId(9), - Description("BiosString") : amended, - read] - char16 BiosString[256]; - [WmiDataId(10), - Description("Device Name") : amended, - read] - char16 DeviceId[256]; - [WmiDataId(11), - Description("StateFlags") : amended, - format("x"), - read] - uint32 StateFlags; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(15), - EventTypeName("Services") : amended -] -class SystemConfig_V1_Services:SystemConfig_V1 -{ - [WmiDataId(1), - Description("ServiceName") : amended, - read] - char16 ServiceName[34]; - [WmiDataId(2), - Description("DisplayName") : amended, - read] - char16 DisplayName[256]; - [WmiDataId(3), - Description("ProcessName") : amended, - read] - char16 ProcessName[34]; - [WmiDataId(4), - Description("ProcessId") : amended, - read] - uint32 ProcessId; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(16), - EventTypeName("Power") : amended -] -class SystemConfig_V1_Power:SystemConfig_V1 -{ - [WmiDataId(1), - Description("S1") : amended, - read] - uint8 S1; - [WmiDataId(2), - Description("S2") : amended, - read] - uint8 S2; - [WmiDataId(3), - Description("S3") : amended, - read] - uint8 S3; - [WmiDataId(4), - Description("S4") : amended, - read] - uint8 S4; - [WmiDataId(5), - Description("S5") : amended, - read] - uint8 S5; - [WmiDataId(6), - Description("Reserved; do not use.") : amended, - read] - uint8 Pad1; - [WmiDataId(7), - Description("Reserved; do not use.") : amended, - read] - uint8 Pad2; - [WmiDataId(8), - Description("Reserved; do not use.") : amended, - read] - uint8 Pad3; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(21), - EventTypeName("IRQ") : amended -] -class SystemConfig_V1_IRQ:SystemConfig_V1 -{ - [WmiDataId(1), - Description("IRQAffinity") : amended, - format("x"), - read] - uint64 IRQAffinity; - [WmiDataId(2), - Description("IRQNum") : amended, - read] - uint32 IRQNum; - [WmiDataId(3), - Description("DeviceDescriptionLen") : amended, - read] - uint32 DeviceDescriptionLen; - [WmiDataId(4), - Description("DeviceDescription") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DeviceDescription; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(22), - EventTypeName("PnP") : amended -] -class SystemConfig_V1_PnP:SystemConfig_V1 -{ - [WmiDataId(1), - Description("IDLength") : amended, - read] - uint32 IDLength; - [WmiDataId(2), - Description("DescriptionLength") : amended, - read] - uint32 DescriptionLength; - [WmiDataId(3), - Description("FriendlyNameLength") : amended, - read] - uint32 FriendlyNameLength; - [WmiDataId(4), - Description("DeviceID") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DeviceID; - [WmiDataId(5), - Description("DeviceDescription") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DeviceDescription; - [WmiDataId(6), - Description("FriendlyName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string FriendlyName; -}; - -[Dynamic, - Description("System Configuration") : amended, - Guid("{01853a65-418f-4f36-aefc-dc0f1d2fd235}"), - EventVersion(2), - DisplayName("SystemConfig") : amended -] -class SystemConfig_V2:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(10), - EventTypeName("CPU") : amended -] -class SystemConfig_V2_CPU:SystemConfig_V2 -{ - [WmiDataId(1), - Description("MHz") : amended, - read] - uint32 MHz; - [WmiDataId(2), - Description("NumberOfProcessors") : amended, - read] - uint32 NumberOfProcessors; - [WmiDataId(3), - Description("MemSize") : amended, - read] - uint32 MemSize; - [WmiDataId(4), - Description("PageSize") : amended, - read] - uint32 PageSize; - [WmiDataId(5), - Description("AllocationGranularity") : amended, - read] - uint32 AllocationGranularity; - [WmiDataId(6), - Description("ComputerName") : amended, - format("s"), - read] - char16 ComputerName[256]; - [WmiDataId(7), - Description("DomainName") : amended, - format("s"), - read] - char16 DomainName[134]; - [WmiDataId(8), - Description("HyperThreadingFlag") : amended, - pointer, - read] - uint32 HyperThreadingFlag; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(11), - EventTypeName("PhyDisk") : amended -] -class SystemConfig_V2_PhyDisk:SystemConfig_V2 -{ - [WmiDataId(1), - Description("DiskNumber") : amended, - read] - uint32 DiskNumber; - [WmiDataId(2), - Description("BytesPerSector") : amended, - read] - uint32 BytesPerSector; - [WmiDataId(3), - Description("SectorsPerTrack") : amended, - read] - uint32 SectorsPerTrack; - [WmiDataId(4), - Description("TracksPerCylinder") : amended, - read] - uint32 TracksPerCylinder; - [WmiDataId(5), - Description("Cylinders") : amended, - read] - uint64 Cylinders; - [WmiDataId(6), - Description("SCSIPort") : amended, - read] - uint32 SCSIPort; - [WmiDataId(7), - Description("SCSIPath") : amended, - read] - uint32 SCSIPath; - [WmiDataId(8), - Description("SCSITarget") : amended, - read] - uint32 SCSITarget; - [WmiDataId(9), - Description("SCSILun") : amended, - read] - uint32 SCSILun; - [WmiDataId(10), - Description("Manufacturer") : amended, - format("s"), - read] - char16 Manufacturer[256]; - [WmiDataId(11), - Description("PartitionCount") : amended, - read] - uint32 PartitionCount; - [WmiDataId(12), - Description("WriteCacheEnabled") : amended, - read] - uint8 WriteCacheEnabled; - [WmiDataId(13), - Description("Pad: not used") : amended, - read] - uint8 Pad; - [WmiDataId(14), - Description("BootDriveLetter") : amended, - format("s"), - read] - char16 BootDriveLetter[3]; - [WmiDataId(15), - Description("Spare") : amended, - read] - char16 Spare[2]; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(12), - EventTypeName("LogDisk") : amended -] -class SystemConfig_V2_LogDisk:SystemConfig_V2 -{ - [WmiDataId(1), - Description("StartOffset") : amended, - read] - uint64 StartOffset; - [WmiDataId(2), - Description("PartitionSize") : amended, - read] - uint64 PartitionSize; - [WmiDataId(3), - Description("DiskNumber") : amended, - read] - uint32 DiskNumber; - [WmiDataId(4), - Description("Size") : amended, - read] - uint32 Size; - [WmiDataId(5), - Description("DriveType") : amended, - read] - uint32 DriveType; - [WmiDataId(6), - Description("DriveLetter") : amended, - format("s"), - read] - char16 DriveLetterString[4]; - [WmiDataId(7), - Description("Pad1") : amended, - read] - uint32 Pad1; - [WmiDataId(8), - Description("PartitionNumber") : amended, - read] - uint32 PartitionNumber; - [WmiDataId(9), - Description("SectorsPerCluster") : amended, - read] - uint32 SectorsPerCluster; - [WmiDataId(10), - Description("BytesPerSector") : amended, - read] - uint32 BytesPerSector; - [WmiDataId(11), - Description("Pad2") : amended, - read] - uint32 Pad2; - [WmiDataId(12), - Description("NumberOfFreeClusters") : amended, - read] - sint64 NumberOfFreeClusters; - [WmiDataId(13), - Description("TotalNumberOfClusters") : amended, - read] - sint64 TotalNumberOfClusters; - [WmiDataId(14), - Description("FileSystem") : amended, - format("s"), - read] - char16 FileSystem[16]; - [WmiDataId(15), - Description("VolumeExtent") : amended, - read] - uint32 VolumeExt; - [WmiDataId(16), - Description("Pad3") : amended, - read] - uint32 Pad3; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(13), - EventTypeName("NIC") : amended -] -class SystemConfig_V2_NIC:SystemConfig_V2 -{ - [WmiDataId(1), - Description("PhysicalAddress") : amended, - format("x"), - read] - uint64 PhysicalAddr; - [WmiDataId(2), - Description("PhysicalAddressLen") : amended, - read] - uint32 PhysicalAddrLen; - [WmiDataId(3), - Description("Ipv4Index") : amended, - read] - uint32 Ipv4Index; - [WmiDataId(4), - Description("Ipv6Index") : amended, - read] - uint32 Ipv6Index; - [WmiDataId(5), - Description("NIC Description") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string NICDescription; - [WmiDataId(6), - Description("IpAddresses") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string IpAddresses; - [WmiDataId(7), - Description("DnsServerAddresses") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DnsServerAddresses; - -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(14), - EventTypeName("Video") : amended -] -class SystemConfig_V2_Video:SystemConfig_V2 -{ - [WmiDataId(1), - Description("MemorySize") : amended, - read] - uint32 MemorySize; - [WmiDataId(2), - Description("XResolution") : amended, - read] - uint32 XResolution; - [WmiDataId(3), - Description("YResolution") : amended, - read] - uint32 YResolution; - [WmiDataId(4), - Description("BitsPerPixel") : amended, - read] - uint32 BitsPerPixel; - [WmiDataId(5), - Description("VRefresh") : amended, - read] - uint32 VRefresh; - [WmiDataId(6), - Description("ChipType") : amended, - format("s"), - read] - char16 ChipType[256]; - [WmiDataId(7), - Description("DACType") : amended, - format("s"), - read] - char16 DACType[256]; - [WmiDataId(8), - Description("AdapterString") : amended, - format("s"), - read] - char16 AdapterString[256]; - [WmiDataId(9), - Description("BiosString") : amended, - format("s"), - read] - char16 BiosString[256]; - [WmiDataId(10), - Description("Device Name") : amended, - format("s"), - read] - char16 DeviceId[256]; - [WmiDataId(11), - Description("StateFlags") : amended, - format("x"), - read] - uint32 StateFlags; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(15), - EventTypeName("Services") : amended -] -class SystemConfig_V2_Services:SystemConfig_V2 -{ - [WmiDataId(1), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(2), - Description("ServiceState") : amended, - format("x"), - read] - uint32 ServiceState; - [WmiDataId(3), - Description("SubProcessTag") : amended, - format("x"), - read] - uint32 SubProcessTag; - [WmiDataId(4), - Description("ServiceName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string ServiceName; - [WmiDataId(5), - Description("DisplayName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DisplayName; - [WmiDataId(6), - Description("ProcessName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string ProcessName; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(16), - EventTypeName("Power") : amended -] -class SystemConfig_V2_Power:SystemConfig_V2 -{ - [WmiDataId(1), - Description("S1") : amended, - read] - uint8 S1; - [WmiDataId(2), - Description("S2") : amended, - read] - uint8 S2; - [WmiDataId(3), - Description("S3") : amended, - read] - uint8 S3; - [WmiDataId(4), - Description("S4") : amended, - read] - uint8 S4; - [WmiDataId(5), - Description("S5") : amended, - read] - uint8 S5; - [WmiDataId(6), - Description("Reserved; do not use.") : amended, - read] - uint8 Pad1; - [WmiDataId(7), - Description("Reserved; do not use.") : amended, - read] - uint8 Pad2; - [WmiDataId(8), - Description("Reserved; do not use.") : amended, - read] - uint8 Pad3; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(17), - EventTypeName("Network") : amended -] -class SystemConfig_V2_Network:SystemConfig_V2 -{ - [WmiDataId(1), - Description("TcbTablePartitions") : amended, - read] - uint32 TcbTablePartitions; - [WmiDataId(2), - Description("MaxHashTableSize") : amended, - read] - uint32 MaxHashTableSize; - [WmiDataId(3), - Description("MaxUserPort") : amended, - read] - uint32 MaxUserPort; - [WmiDataId(4), - Description("TcpTimedWaitDelay") : amended, - read] - uint32 TcpTimedWaitDelay; - -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(21), - EventTypeName("IRQ") : amended -] -class SystemConfig_V2_IRQ:SystemConfig_V2 -{ - [WmiDataId(1), - Description("IRQAffinity") : amended, - format("x"), - read] - uint64 IRQAffinity; - [WmiDataId(2), - Description("IRQNum") : amended, - read] - uint32 IRQNum; - [WmiDataId(3), - Description("DeviceDescriptionLen") : amended, - read] - uint32 DeviceDescriptionLen; - [WmiDataId(4), - Description("DeviceDescription") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DeviceDescription; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(22), - EventTypeName("PnP") : amended -] -class SystemConfig_V2_PnP:SystemConfig_V2 -{ - [WmiDataId(1), - Description("IDLength") : amended, - read] - uint32 IDLength; - [WmiDataId(2), - Description("DescriptionLength") : amended, - read] - uint32 DescriptionLength; - [WmiDataId(3), - Description("FriendlyNameLength") : amended, - read] - uint32 FriendlyNameLength; - [WmiDataId(4), - Description("DeviceID") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DeviceID; - [WmiDataId(5), - Description("DeviceDescription") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DeviceDescription; - [WmiDataId(6), - Description("FriendlyName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string FriendlyName; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(23), - EventTypeName("IDEChannel") : amended -] -class SystemConfig_V2_IDEChannel:SystemConfig_V2 -{ - [WmiDataId(1), - Description("TargetId") : amended, - read] - uint32 TargetId; - [WmiDataId(2), - Description("DeviceType") : amended, - format("x"), - read] - uint32 DeviceType; - [WmiDataId(3), - Description("DeviceTimingMode") : amended, - format("x"), - read] - uint32 DeviceTimingMode; - [WmiDataId(4), - Description("LocationInformationLen") : amended, - read] - uint32 LocationInformationLen; - [WmiDataId(5), - Description("LocationInformation") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string LocationInformation; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(25), - EventTypeName("Platform") : amended -] -class SystemConfig_V2_Platform:SystemConfig_V2 -{ - [WmiDataId(1), - Description("SystemManufacturer") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string SystemManufacturer; - [WmiDataId(2), - Description("SystemProductName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string SystemProductName; - [WmiDataId(3), - Description("BiosDate") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string BiosDate; - [WmiDataId(4), - Description("BiosVersion") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string BiosVersion; -}; - -[Dynamic, - Description("System Configuration") : amended, - Guid("{01853a65-418f-4f36-aefc-dc0f1d2fd235}"), - EventVersion(3), - DisplayName("SystemConfig") : amended -] -class SystemConfig:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(21), - EventTypeName("IRQ") : amended -] -class SystemConfig_IRQ:SystemConfig -{ - [WmiDataId(1), - Description("IRQAffinity") : amended, - format("x"), - read] - uint64 IRQAffinity; - [WmiDataId(2), - Description("IRQGroup") : amended, - read] - uint16 IRQGroup; - [WmiDataId(3), - Description("Reserved") : amended, - read] - uint16 Reserved; - [WmiDataId(4), - Description("IRQNum") : amended, - read] - uint32 IRQNum; - [WmiDataId(5), - Description("DeviceDescriptionLen") : amended, - read] - uint32 DeviceDescriptionLen; - [WmiDataId(6), - Description("DeviceDescription") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DeviceDescription; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(15), - EventTypeName("Services") : amended -] -class SystemConfig_Services:SystemConfig -{ - [WmiDataId(1), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(2), - Description("ServiceState") : amended, - format("x"), - read] - uint32 ServiceState; - [WmiDataId(3), - Description("SubProcessTag") : amended, - format("x"), - read] - uint32 SubProcessTag; - [WmiDataId(4), - Description("ServiceName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string ServiceName; - [WmiDataId(5), - Description("DisplayName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DisplayName; - [WmiDataId(6), - Description("ProcessName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string ProcessName; - [WmiDataId(7), - Description("LoadOrderGroup") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string LoadOrderGroup; - [WmiDataId(8), - Description("SvchostGroup") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string SvchostGroup; -}; - -[Dynamic, - Description("System Configuration") : amended, - EventType(22), - EventTypeName("PnP") : amended -] -class SystemConfig_PnP:SystemConfig -{ - [WmiDataId(1), - Description("IDLength") : amended, - read] - uint32 IDLength; - [WmiDataId(2), - Description("DescriptionLength") : amended, - read] - uint32 DescriptionLength; - [WmiDataId(3), - Description("FriendlyNameLength") : amended, - read] - uint32 FriendlyNameLength; - [WmiDataId(4), - Description("DeviceID") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DeviceID; - [WmiDataId(5), - Description("DeviceDescription") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string DeviceDescription; - [WmiDataId(6), - Description("FriendlyName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string FriendlyName; - [WmiDataId(7), - Description("PdoName") : amended, - StringTermination("NullTerminated"), - format("w"), - read] - string PdoName; -}; - -[Dynamic, - Description("Pool Event") : amended, - Guid("{0268a8b6-74fd-4302-9dd0-6e8f1795c0cf}"), - EventVersion(2), - DisplayName("Pool") : amended -] -class PoolTrace:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("Pool Allocation/Free Event") : amended, - EventType{32, 34}, - EventTypeName{"PoolAllocation", "PoolFree"} : amended -] -class PoolAllocFree:PoolTrace -{ - [WmiDataId(1), - Description("PoolType"): amended, - read] - uint32 Type; - [WmiDataId(2), - Description("PoolTag"): amended, - format("x"), - read] - uint32 Tag; - [WmiDataId(3), - Description("NumberOfBytes"): amended, - extension("SizeT"), - read] - object NumberOfBytes; - [WmiDataId(4), - Description("Entry"): amended, - pointer, - read] - uint32 Entry; -}; - -[Dynamic, - Description("Session Pool Allocation/Free Event") : amended, - EventType{33, 35}, - EventTypeName{"SessionPoolAllocation", "SessionPoolFree"} : amended -] -class SessionPoolAllocFree:PoolTrace -{ - [WmiDataId(1), - Description("PoolType"): amended, - read] - uint32 Type; - [WmiDataId(2), - Description("PoolTag"): amended, - format("x"), - read] - uint32 Tag; - [WmiDataId(3), - Description("NumberOfBytes"): amended, - extension("SizeT"), - read] - object NumberOfBytes; - [WmiDataId(4), - Description("Entry"): amended, - pointer, - read] - uint32 Entry; - [WmiDataId(5), - Description("SessionId") : amended, - read] - uint32 SessionId; -}; - - -[Dynamic, - Description("Pool Snapshot Event") : amended, - EventType{40, 41, 42, 43, 44, 45}, - EventTypeName{"PoolSnapDCStart", "PoolSnapDCEnd", "BigPoolSnapDCStart", "BigPoolSnapDCEnd", "SessionPoolSnapDCStart", "SessionPoolSnapDCEnd"} : amended -] -class PoolSnapshot:PoolTrace -{ -}; - -[Dynamic, - Description("Thread Pool") : amended, - Guid("{c861d0e2-a2c1-4d36-9f9c-970bab943a12}") -] -class ThreadPool:EventTrace -{ - -}; - -[Dynamic, - Description("Thread Pool Event") : amended, - Guid("{c861d0e2-a2c1-4d36-9f9c-970bab943a12}"), - EventVersion(2), - DisplayName("ThreadPool") : amended -] -class ThreadPoolTrace_V2:ThreadPool -{ - -}; - -[Dynamic, - Description("Thread Pool Callback Enqueue Start") : amended, - EventType{32, 34}, - EventTypeName{"CBEnqueue", "CBStart"} : amended -] -class TP_V2_CBEnqueue:ThreadPoolTrace_V2 -{ - [WmiDataId(1), - Description("PoolId") : amended, - pointer, - read] - uint32 PoolId; - [WmiDataId(2), - Description("TaskId") : amended, - pointer, - read] - uint32 TaskId; - [WmiDataId(3), - Description("CallbackFunction") : amended, - pointer, - read] - uint32 CallbackFunction; - [WmiDataId(4), - Description("CallbackContext") : amended, - pointer, - read] - uint32 CallbackContext; - [WmiDataId(5), - Description("SubProcessTag") : amended, - pointer, - read] - uint32 SubProcessTag; -}; - -[Dynamic, - Description("Thread Pool Callback Dequeue Stop") : amended, - EventType{33, 35}, - EventTypeName{"CBDequeue", "CBStop"} : amended -] -class TP_V2_CBDequeue:ThreadPoolTrace_V2 -{ - [WmiDataId(1), - Description("TaskId") : amended, - pointer, - read] - uint32 TaskId; -}; - -[Dynamic, - Description("Thread Pool Callback Cancel") : amended, - EventType(36), - EventTypeName("CBCancel") : amended -] -class TP_V2_CBCancel:ThreadPoolTrace_V2 -{ - [WmiDataId(1), - Description("TaskId") : amended, - pointer, - read] - uint32 TaskId; - [WmiDataId(2), - Description("CancelCount") : amended, - read] - uint32 CancelCount; -}; - -[Dynamic, - Description("Thread Pool Pool Create Close") : amended, - EventType{37, 38}, - EventTypeName{"PoolCreate", "PoolClose"} : amended -] -class TP_V2_PoolCreateClose:ThreadPoolTrace_V2 -{ - [WmiDataId(1), - Description("PoolId") : amended, - pointer, - read] - uint32 PoolId; -}; - -[Dynamic, - Description("Thread Pool Thread Set") : amended, - EventType{39, 40}, - EventTypeName{"ThreadMinSet", "ThreadMaxSet"} : amended -] -class TP_V2_ThreadSet:ThreadPoolTrace_V2 -{ - [WmiDataId(1), - Description("PoolId") : amended, - pointer, - read] - uint32 PoolId; - [WmiDataId(2), - Description("ThreadNum") : amended, - read] - uint32 ThreadNum; -}; - -[Dynamic, - Description("Thread Pool Worker Thread NUMA Node Switch") : amended, - EventType(41), - EventTypeName("WTNodeSwitch") : amended -] -class TP_V2_WTNodeSwitch:ThreadPoolTrace_V2 -{ - [WmiDataId(1), - Description("PoolId") : amended, - pointer, - read] - uint32 PoolId; - [WmiDataId(2), - Description("CurrentNode") : amended, - read] - uint32 CurrentNode; - [WmiDataId(3), - Description("NextNode") : amended, - read] - uint32 NextNode; - [WmiDataId(4), - Description("CurrentGroup") : amended, - read] - uint16 CurrentGroup; - [WmiDataId(5), - Description("NextGroup") : amended, - read] - uint16 NextGroup; - [WmiDataId(6), - Description("CurrentWorkerCount") : amended, - read] - uint32 CurrentWorkerCount; - [WmiDataId(7), - Description("NextWorkerCount") : amended, - read] - uint32 NextWorkerCount; -}; - -[Dynamic, - Description("Thread Pool Event") : amended, - Guid("{c861d0e2-a2c1-4d36-9f9c-970bab943a12}"), - EventVersion(3), - DisplayName("ThreadPool") : amended -] -class ThreadPoolTrace:ThreadPool -{ - -}; - -[Dynamic, - Description("Thread Pool Callback Dequeue Stop") : amended, - EventType{33, 35}, - EventTypeName{"CBDequeue", "CBStop"} : amended -] -class TPCBDequeue:ThreadPoolTrace -{ - [WmiDataId(1), - Description("PoolId") : amended, - pointer, - read] - uint32 PoolId; - [WmiDataId(2), - Description("TaskId") : amended, - pointer, - read] - uint32 TaskId; - [WmiDataId(3), - Description("CallbackFunction") : amended, - pointer, - read] - uint32 CallbackFunction; - [WmiDataId(4), - Description("CallbackContext") : amended, - pointer, - read] - uint32 CallbackContext; - [WmiDataId(5), - Description("SubProcessTag") : amended, - pointer, - read] - uint32 SubProcessTag; -}; - -[Dynamic, - Description("Thread Pool Callback Cancel") : amended, - EventType(36), - EventTypeName("CBCancel") : amended -] -class TPCBCancel:ThreadPoolTrace -{ - [WmiDataId(1), - Description("PoolId") : amended, - pointer, - read] - uint32 PoolId; - [WmiDataId(2), - Description("TaskId") : amended, - pointer, - read] - uint32 TaskId; - [WmiDataId(3), - Description("CallbackFunction") : amended, - pointer, - read] - uint32 CallbackFunction; - [WmiDataId(4), - Description("CallbackContext") : amended, - pointer, - read] - uint32 CallbackContext; - [WmiDataId(5), - Description("SubProcessTag") : amended, - pointer, - read] - uint32 SubProcessTag; - [WmiDataId(6), - Description("CancelCount") : amended, - read] - uint32 CancelCount; -}; - -[Dynamic, - Description("MMCSS") : amended, - Guid("{f8f10121-b617-4a56-868b-9df1b27fe32c}"), - DisplayName("MMCSS") : amended -] -class MMCSSTrace:MSNT_SystemTrace -{ - -}; - -[Dynamic, - Description("MMCSS Events") : amended, - EventType{32, 33, 36, 37}, - EventTypeName{"Start", "Stop", "Sleep", "SleepResp"} : amended -] -class MMCSS_TypeGroup:MMCSSTrace -{ - -}; - -[Dynamic, - Description("MMCSS Events") : amended, - EventType(34), - EventTypeName("Scheduler") : amended -] -class MMCSSEvent:MMCSSTrace -{ - [WmiDataId(1), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ScheduledPID; - [WmiDataId(2), - Description("ThreadId") : amended, - format("x"), - read] - uint32 ScheduledTID; - [WmiDataId(3), - Description("SchedulingPriority") : amended, - read] - uint32 SchedulingPriority; - [WmiDataId(4), - Description("TaskIndex") : amended, - read] - uint32 TaskIndex; -}; - -[Dynamic, - Description("MMCSS Events") : amended, - EventType(35), - EventTypeName("Wakeup") : amended -] -class MMCSSWakeup:MMCSSTrace -{ - [WmiDataId(1), - Description("Reason") : amended, - format("x"), - read] - uint32 Reason; -}; - -// -// MUI load tracing from ntdll.dll -// -[Dynamic, - Description("MUI Resource Trace") : amended, - Guid("{d3de60b2-a663-45d5-9826-a0a5949d2cb0}"), - locale("MS\\0x409") -] -class MuiTrace:EventTrace -{ -}; - -[Dynamic, - Description("MUI Resource Trace") : amended, - Guid("{d3de60b2-a663-45d5-9826-a0a5949d2cb0}"), - DisplayName("MUIResource") : amended, - locale("MS\\0x409") -] -class MuiTraceData:MuiTrace -{ -}; - - -[Dynamic, - Description("MUI Resource Access") : amended, - EventType(0), - EventTypeName("Access") : amended, - locale("MS\\0x409") -] -class MuiTraceData_String:MuiTraceData -{ - [WmiDataId(1), - Description("MuiAccess") : amended, - format("w"), - StringTermination("NullTerminated"), - read] - string MuiLoadString; -}; - -// -// UMS events. -// - -[Dynamic, - Description("UMS Events") : amended, - Guid("{9aec974b-5b8e-4118-9b92-3186d8002ce5}"), - EventVersion(2), - DisplayName("UMS") : amended -] -class UmsEvent:MSNT_SystemTrace -{ -}; - -[Dynamic, - Description("UMS Directed Switch - Start") : amended, - EventType(32), - EventTypeName("DSwitchStart") : amended -] -class UmsDirectedSwitchStart:UmsEvent -{ - [WmiDataId(1), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(2), - Description("ScheduledThreadId") : amended, - format("x"), - read] - uint32 ScheduledThreadId; - [WmiDataId(3), - Description("PrimaryThreadId") : amended, - format("x"), - read] - uint32 PrimaryThreadId; - [WmiDataId(4), - Description("SwitchFlags") : amended, - format("x"), - read] - uint32 SwitchFlags; -}; - -[Dynamic, - Description("UMS Directed Switch - End") : amended, - EventType(33), - EventTypeName("DSwitchEnd") : amended -] -class UmsDirectedSwitchEnd:UmsEvent -{ - [WmiDataId(1), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(2), - Description("ScheduledThreadId") : amended, - format("x"), - read] - uint32 ScheduledThreadId; - [WmiDataId(3), - Description("PrimaryThreadId") : amended, - format("x"), - read] - uint32 PrimaryThreadId; - [WmiDataId(4), - Description("SwitchFlags") : amended, - format("x"), - read] - uint32 SwitchFlags; -}; - -[Dynamic, - Description("UMS Scheduled Thread Park") : amended, - EventType(34), - EventTypeName("ScheduledPark") : amended -] -class UmsScheduledPark:UmsEvent -{ - [WmiDataId(1), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(2), - Description("ScheduledThreadId") : amended, - format("x"), - read] - uint32 ScheduledThreadId; - [WmiDataId(3), - Description("ParkFlags") : amended, - format("x"), - read] - uint32 ParkFlags; -}; - -[Dynamic, - Description("UMS Disassociate From Primary") : amended, - EventType(35), - EventTypeName("Disassociate") : amended -] -class UmsDisassociate:UmsEvent -{ - [WmiDataId(1), - Description("ProcessId") : amended, - format("x"), - read] - uint32 ProcessId; - [WmiDataId(2), - Description("ScheduledThreadId") : amended, - format("x"), - read] - uint32 ScheduledThreadId; - [WmiDataId(3), - Description("PrimaryThreadId") : amended, - format("x"), - read] - uint32 PrimaryThreadId; - [WmiDataId(4), - Description("UmsApcControlFlags") : amended, - format("x"), - read] - uint32 UmsApcControlFlags; - [WmiDataId(5), - Description("Status") : amended, - format("x"), - read] - uint32 Status; -}; - -[Dynamic, - Description("UMS Context Switch") : amended, - EventType(36), - EventTypeName("CSwitch") : amended -] -class UmsContextSwitch:UmsEvent -{ - [WmiDataId(1), - Description("ScheduledThreadId") : amended, - format("x"), - read] - uint32 ScheduledThreadId; - [WmiDataId(2), - Description("SwitchCount") : amended, - read] - uint32 SwitchCount; - [WmiDataId(3), - Description("KernelYieldCount") : amended, - read] - uint32 KernelYieldCount; - [WmiDataId(4), - Description("MixedYieldCount") : amended, - read] - uint32 MixedYieldCount; - [WmiDataId(5), - Description("YieldCount") : amended, - read] - uint32 YieldCount; -}; - -// -// Tape -[abstract] -class MSTapeDriver -{ -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Tape Drive Parameters") : amended, - guid("{B9A8CFD5-8D72-47a4-AC0E-284A3200F4FB}"), - HeaderName("WMI_TAPE_DRIVE_PARAMETERS"), - GuidName1("WMI_TAPE_DRIVE_PARAMETERS_GUID"), - DisplayName("Tape Drive Parameters") : amended - ] -class MSTapeDriveParam : MSTapeDriver -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Maximum Block Size") : amended, - WmiDataId(1), - Description("Maximum block size supported") : amended, - read] - uint32 MaximumBlockSize; - - [DisplayName("Minimum Block Size") : amended, - WmiDataId(2), - Description("Minimum block size supported") : amended, - read] - uint32 MinimumBlockSize; - - [DisplayName("Default Block Size") : amended, - WmiDataId(3), - Description("Default block size supported") : amended, - read] - uint32 DefaultBlockSize; - - [DisplayName("Maximum Partition Count") : amended, - WmiDataId(4), - Description("Maximum number of partitions allowed.") : amended, - read] - uint32 MaximumPartitionCount; - - [DisplayName("Compression Capable") : amended, - WmiDataId(5), - Description("TRUE if drive supports compression.") : amended, - read] - boolean CompressionCapable; - - [WmiDataId(6), - DisplayName("Compression Enabled") : amended, - Description("TRUE if compression is enabled.") : amended, - read] - boolean CompressionEnabled; - - [WmiDataId(7), - DisplayName("Report Setmarks") : amended, - Description("TRUE if drive reports setmarks") : amended, - read] - boolean ReportSetmarks; - - [WmiDataId(8), - DisplayName("Hardware Error Correction") : amended, - Description("TRUE if drive supports hardware error correction") : amended, - read] - boolean HardwareErrorCorrection; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Tape Media Capacity") : amended, - guid("{8C2147A4-FF29-4336-B8A4-227B54CC0966}"), - HeaderName("WMI_TAPE_MEDIA_PARAMETERS"), - GuidName1("WMI_TAPE_MEDIA_PARAMETERS_GUID"), - DisplayName("Tape Media Capacity") : amended - ] -class MSTapeMediaCapacity : MSTapeDriver -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Maximum Capacity") : amended, - WmiDataId(1), - Description("Maximum capacity of the media") : amended, - read] - uint64 MaximumCapacity; - - [DisplayName("Available Capacity") : amended, - WmiDataId(2), - Description("Available capacity of the media") : amended, - read] - uint64 AvailableCapacity; - - [DisplayName("Block Size") : amended, - WmiDataId(3), - Description("Current blocksize") : amended, - read] - uint32 BlockSize; - - [DisplayName("Partition Count") : amended, - WmiDataId(4), - Description("Current number of partitions") : amended, - read] - uint32 PartitionCount; - - [DisplayName("Media Write Protected") : amended, - WmiDataId(5), - Description("TRUE if media is write protected") : amended, - read] - boolean MediaWriteProtected; -}; - - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Tape Symbolic Name") : amended, - guid("{3FB828F7-F119-4066-B1E6-DB407CE9DE91}"), - HeaderName("WMI_TAPE_SYMBOLIC_NAME"), - GuidName1("WMI_TAPE_SYMBOLIC_NAME_GUID"), - DisplayName("Tape Symbolic Name") : amended - ] -class MSTapeSymbolicName : MSTapeDriver -{ - [key, read] - string InstanceName; - [read] boolean Active; - - - [DisplayName("Tape symbolic name") : amended, - WmiDataId(1), - Description("Symbolic name such as Tape0") : amended, - read] - string TapeSymbolicName; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Tape Drive Problem Warning") : amended, - guid("{BC4DD36C-FA66-4080-87A0-0C5922EB7887}"), - HeaderName("WMI_TAPE_PROBLEM_WARNING"), - GuidName1("WMI_TAPE_PROBLEM_WARNING_GUID"), - DisplayName("Tape Problem Event") : amended - ] -class MSTapeDriveProblemEvent : WmiEvent -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Drive Problem Type") : amended, - WmiDataId(1), - Description("Tape drive problem warning event") : amended, - read] - uint32 DriveProblemType; - - [WmiDataId(2), - DisplayName("Tape Data") : amended, - Description("Tape drive problem data") : amended, - read] - uint8 TapeData[512]; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("IO Read Write Errors") : amended, - guid("{58FD29F9-B516-40fd-871A-7EE76D5BB53E}"), - HeaderName("WMI_TAPE_PROBLEM_IO_ERROR"), - GuidName1("WMI_TAPE_PROBLEM_IO_ERROR_GUID"), - DisplayName("Tape Io Error") : amended - ] -class MSTapeProblemIoError : MSTapeDriver -{ - - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Read Corrected Without Delay") : amended, - WmiDataId(1), - Description("Read errors corrected without much delay") : amended, - read] - uint32 ReadCorrectedWithoutDelay; - - [DisplayName("Read Corrected With Delay") : amended, - WmiDataId(2), - Description("Read errors corrected with substantial delay") : amended, - read] - uint32 ReadCorrectedWithDelay; - - [DisplayName("Read Total Errors") : amended, - WmiDataId(3), - Description("Total number of Read errors") : amended, - read] - uint32 ReadTotalErrors; - - [DisplayName("Read Total Corrected Errors") : amended, - WmiDataId(4), - Description("Total number of read errors that were corrected") : amended, - read] - uint32 ReadTotalCorrectedErrors; - - [DisplayName("Read Total Uncorrected Errors") : amended, - WmiDataId(5), - Description("Total number of uncorrected read errors") : amended, - read] - uint32 ReadTotalUncorrectedErrors; - - [DisplayName("Read Correction Algorithm Processed") : amended, - WmiDataId(6), - Description("Number of times correction algorithm was processed for read") : amended, - read] - uint32 ReadCorrectionAlgorithmProcessed; - - [DisplayName("Write Corrected Without Delay") : amended, - WmiDataId(7), - Description("Write errors corrected without much delay") : amended, - read] - uint32 WriteCorrectedWithoutDelay; - - [DisplayName("Write Corrected With Delay") : amended, - WmiDataId(8), - Description("Write errors corrected with substantial delay") : amended, - read] - uint32 WriteCorrectedWithDelay; - - [DisplayName("Write Total Errors") : amended, - WmiDataId(9), - Description("Total number of Read errors") : amended, - read] - uint32 WriteTotalErrors; - - [DisplayName("Write Total Corrected Errors") : amended, - WmiDataId(10), - Description("Total number of write errors that were corrected") : amended, - read] - uint32 WriteTotalCorrectedErrors; - - [DisplayName("Write Total Uncorrected Errors") : amended, - WmiDataId(11), - Description("Total number of uncorrected write errors") : amended, - read] - uint32 WriteTotalUncorrectedErrors; - - [DisplayName("Write Correction Algorithm Processed") : amended, - WmiDataId(12), - Description("Number of times correction algorithm was processed for write") : amended, - read] - uint32 WriteCorrectionAlgorithmProcessed; - - [DisplayName("Non Medium Errors") : amended, - WmiDataId(13), - Description("Errors not related to medium") : amended, - read] - uint32 NonMediumErrors; - -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Device Errors") : amended, - guid("{43EC6B13-10BB-4bf6-B716-1C1E2F10BB5F}"), - HeaderName("WMI_TAPE_PROBLEM_DEVICE_ERROR"), - GuidName1("WMI_TAPE_PROBLEM_DEVICE_ERROR_GUID"), - DisplayName("Tape Device Error") : amended - ] -class MSTapeProblemDeviceError : MSTapeDriver -{ - - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Read Warning") : amended, - WmiDataId(1), - Description("WARNING : Drive is experiencing read problem.") : amended, - read] - boolean ReadWarning; - - [DisplayName("Write Warning") : amended, - WmiDataId(2), - Description("WARNING : Drive is experiencing write problem.") : amended, - read] - boolean WriteWarning; - - [DisplayName("Hard Error") : amended, - WmiDataId(3), - Description("Drive hardware problem") : amended, - read] - boolean HardError; - - [DisplayName("Read Failure") : amended, - WmiDataId(4), - Description("Critical Error : Too many read errors.") : amended, - read] - boolean ReadFailure; - - [DisplayName("Write Failure") : amended, - WmiDataId(5), - Description("Critical Error : Too many write errors.") : amended, - read] - boolean WriteFailure; - - [DisplayName("Unsupported Format") : amended, - WmiDataId(6), - Description("Tape format not supported") : amended, - read] - boolean UnsupportedFormat; - - [DisplayName("Tape Snapped") : amended, - WmiDataId(7), - Description("Tape is snapped. Replace media") : amended, - read] - boolean TapeSnapped; - - [DisplayName("Drive Requires Cleaning") : amended, - WmiDataId(8), - Description("Drive Requires Cleaning") : amended, - read] - boolean DriveRequiresCleaning; - - [DisplayName("Time To Clean Drive") : amended, - WmiDataId(9), - Description("It's time to clean the drive") : amended, - read] - boolean TimetoCleanDrive; - - [DisplayName("Drive Hardware Error") : amended, - WmiDataId(10), - Description("Hardware error. Check drive") : amended, - read] - boolean DriveHardwareError; - - [DisplayName("Scsi Interface Error") : amended, - WmiDataId(11), - Description("Some error in cabling, or connection.") : amended, - read] - boolean ScsiInterfaceError; - - [DisplayName("Media Life") : amended, - WmiDataId(12), - Description("Critical error: Media life expired.") : amended, - read] - boolean MediaLife; -}; - -// -// Medium Changer Libraries -[abstract] -class MSChangerDriver -{ -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Changer Parameters") : amended, - guid("{24EB52AC-7C77-438b-AB61-D024DAB0C03A}"), - HeaderName("WMI_CHANGER_PARAMETERS"), - GuidName1("WMI_CHANGER_PARAMETERS_GUID"), - DisplayName("Changer Parameters") : amended - ] -class MSChangerParameters : MSChangerDriver -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Number Of Slots") : amended, - WmiDataId(1), - Description("Number of slots in the changer") : amended, - read] - uint32 NumberOfSlots; - - [DisplayName("Number Of Drives") : amended, - WmiDataId(2), - Description("Number of drives in the changer") : amended, - read] - uint32 NumberOfDrives; - - [DisplayName("Number Of IE Ports") : amended, - WmiDataId(3), - Description("Number of IEPorts in the changer") : amended, - read] - uint32 NumberOfIEPorts; - - [DisplayName("Number Of Transports") : amended, - WmiDataId(4), - Description("Number of transport in the changer") : amended, - read] - uint32 NumberOfTransports; - - [DisplayName("Number Of Doors") : amended, - WmiDataId(5), - Description("Number of doors in the changer") : amended, - read] - uint32 NumberOfDoors; - - [DisplayName("Number Of Cleaner Slots") : amended, - WmiDataId(6), - Description("Number of slots for cleaner cartridge in the changer") : amended, - read] - uint32 NumberOfCleanerSlots; - - [ - DisplayName("Magazine Size") : amended, - WmiDataId(7), - Description("Magazine size if one exists") : amended, - read] - uint32 MagazineSize; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Changer Problem Warning") : amended, - guid("{45DB06A5-20D5-4de3-A36C-3AB974600A4C}"), - HeaderName("WMI_CHANGER_PROBLEM_WARNING"), - GuidName1("WMI_CHANGER_PROBLEM_WARNING_GUID"), - DisplayName("Changer Problem Event") : amended - ] -class MSChangerProblemEvent : WmiEvent -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Changer Problem Type") : amended, - WmiDataId(1), - Description("Changer library problem warning type") : amended, - read] - uint32 ChangerProblemType; - - [DisplayName("Changer Data") : amended, - WmiDataId(2), - Description("Changer problem data") : amended, - read] - uint8 ChangerData[512]; -}; - -[Dynamic, Provider("WMIProv"), - WMI, - Description("Changer Errors") : amended, - guid("{56B396A8-0B95-42fe-BBCE-D36FDA904F8E}"), - HeaderName("WMI_CHANGER_PROBLEM_DEVICE_ERROR"), - GuidName1("WMI_CHANGER_PROBLEM_DEVICE_ERROR_GUID"), - DisplayName("Changer Device Error") : amended - ] -class MSChangerProblemDeviceError : MSChangerDriver -{ - - [key, read] - string InstanceName; - [read] boolean Active; - - [DisplayName("Changer Problem Type") : amended, - WmiDataId(1), - Description("Changer library problem warning type") : amended, - read] - uint32 ChangerProblemType; - -}; - -[abstract] -class MSDeviceUI -{ -}; - -[WMI, Dynamic, Provider ("WMIProv"), - guid("{4504B1D4-C5EE-4df6-951F-16180E3DD815}"), - HeaderName("DEVICE_UI_FIRMWARE_REVISION"), - GuidName1("DEVICE_UI_FIRMWARE_REVISION_GUID"), - Description("Firmware Revision" ) : amended, - DisplayName("Device Firmware Revision") : amended -] -class MSDeviceUI_FirmwareRevision : MSDeviceUI -{ - boolean Active; - [key] - string InstanceName; - - [DisplayName("Firmware Revision") : amended, - WmiDataId(1), - Description("Firmware Revision") : amended, - read] - string FirmwareRevision; -}; - -[WMI, - guid("{45068237-595D-4C7D-BD80-F84ADC0257F8}") -] -class MSVerifierIrpLogEntry -{ - [WmiDataId(1), - read, - DisplayInHex, - Description("Count")] - uint32 Count; - - [WmiDataId(2), - read, - DisplayInHex, - Description("Major Function")] - uint8 Major; - - [WmiDataId(3), - read, - DisplayInHex, - Description("Minor Function")] - uint8 Minor; - - [WmiDataId(4), - read, - DisplayInHex, - Description("Flags")] - uint8 Flags; - - [WmiDataId(5), - read, - DisplayInHex, - Description("Control")] - uint8 Control; - - [WmiDataId(6), - read, - DisplayInHex, - Description("Arg1")] - uint64 Arg1; - - [WmiDataId(7), - read, - DisplayInHex, - Description("Arg2")] - uint64 Arg2; - - [WmiDataId(8), - read, - DisplayInHex, - Description("Arg3")] - uint64 Arg3; - - [WmiDataId(9), - read, - DisplayInHex, - Description("Arg4")] - uint64 Arg4; -}; - -[WMI,Dynamic, Provider("WMIProv"), - Description("Verifier kernel information"), - guid("{1E2C2980-F7DB-46AA-820E-8734FCC21F4C}"), - locale("MS\\0x409") -] -class MSVerifierIrpLogInformation -{ - [key, read] - string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - Description("DeviceType") - ] uint32 DeviceType; - - [WmiDataId(2), - read - ] uint32 EntryCount; - - [WmiDataId(3), - WmiSizeIs("EntryCount"), - read - ] MSVerifierIrpLogEntry Entries[]; -}; - - -[abstract] -class MSMonitorClass -{ -}; - -[WMI, - Dynamic, - Provider("WMIProv"), - Description("Monitor brightness parameters"):amended, - localeid("MS\\0x409"), - guid("{d43412ac-67f9-4fbb-a081-1752a2c33e84}")] -class WmiMonitorBrightness : MSMonitorClass -{ - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - Description("Current brightness (in percentage of total)"):amended - ] uint8 CurrentBrightness; - - [WmiDataId(2), - read, - Description("Supported brightness levels"):amended - ] uint32 Levels; - - [WmiDataId(3), - read, - Description("Brightness Level - in terms of percentage"):amended, - WmiSizeIs("Levels") - ] uint8 Level[]; - -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - Locale("MS\\0x409"), - Description("Monitor brightness control API"):amended, - guid("{479b20b4-5559-46fe-be97-7d222154421f}")] -class WmiMonitorBrightnessMethods : MSMonitorClass -{ - [key, read] string InstanceName; - [read] boolean Active; - - [WmiMethodId(1), - Implemented, - Description("Set current brightness setting"):amended - ] void WmiSetBrightness([in, - Description("Timeout - in seconds"):amended - ] uint32 Timeout, - [in, - Description("Brightness - percentage"):amended - ] uint8 Brightness); - - [WmiMethodId(2), - Implemented, - Description("Sets the brightness back to the policy setting"):amended - ] void WmiRevertToPolicyBrightness(); - - [WmiMethodId(3), - Implemented, - Description("Controls the ambient light sensor brightness state"):amended - ] void WmiSetALSBrightnessState([in, - Description("ALS brightness state"):amended - ] boolean State); - - [WmiMethodId(4), - Implemented, - Description("Sets the ambient light sensor brightness value"):amended - ] void WmiSetALSBrightness([in, - Description("Brightness - percentage"):amended - ] uint8 Brightness); -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - Locale("MS\\0x409"), - Description("Monitor brightness change event"), - guid("{123c80d2-937f-4cfe-80f4-c40d596e48b7}")] -class WmiMonitorBrightnessEvent : WmiEvent -{ - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - Description("Current Monitor Brightness - percentage"):amended - ] uint8 Brightness; - -}; - -/**********************************/ -/* Monitor descriptor data blocks */ -/**********************************/ - - -// Deprecated EDID v.1.x standard 128-byte base data block -[WMI, - Dynamic, - Provider("WMIProv"), - Description("Monitor's raw EDID v.1.x data block") : amended, - localeid("MS\\0x409"), - guid("{FAEE1471-5149-4a68-AC2C-BF96EC09F004}") -] -class WmiMonitorRawEEdidV1Block : MSMonitorClass -{ - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), read, Description("Block ID") : amended] - uint8 Id; - - [ - WmiDataId(2), read, Description("Block type") : amended, - Values{ - "Uninitialized", - "Other", - "EDID base block", - "EDID map block" - } : amended - ] - uint8 Type; - - [WmiDataId(3), read, Description("Block content") : amended] - uint8 Content[128]; -}; - - -// Exposes the raw content of VESA E-EDID v.1.x standard 128-byte data block. -[WMI, - Dynamic, - Provider("WmiProv"), - Locale("MS\\0x409"), - Description("Monitor's raw EDID v.1.x data block accessor"):amended, - guid("{5341576e-75c4-4aeb-a82b-873cd3c6b384}")] -class WmiMonitorDescriptorMethods : MSMonitorClass -{ - [key, read] string InstanceName; - [read] boolean Active; - - [WmiMethodId(1), - Implemented, - DisplayName("Read EDID v.1.x descriptor block") : amended, - HeaderName("WmiGetMonitorRawEEdidV1Block"), - Description("Reads specified EDID v.1.x descriptor block") : amended - ] - void WmiGetMonitorRawEEdidV1Block([in, DisplayName("Block ID") : amended] uint8 BlockId, - [out, DisplayName("Block Type") : amended, - Values{ - "Uninitialized", - "Other", - "EDID base block", - "EDID map block" - } : amended - ] - uint8 BlockType, - [out, DisplayName("Block content") : amended] uint8 BlockContent[128] - ); -}; - - -// Corresponds to data in the Vendor/Product Identification block of VESA E-EDID standard (section 3.4 of E-EDID v.1.3). -[ - WMI, - Dynamic, - Provider("WMIProv"), - Description("Monitor ID") : amended, - localeid("MS\\0x409"), - guid("{671A8285-4EDB-4cae-99FE-69A15C48C0BC}") -] -class WmiMonitorID : MSMonitorClass -{ - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), read, Description("Vendor assigned product code ID") : amended] - // TODO:[mmilirud] Make this variable length. - uint16 ProductCodeID[16]; - - [WmiDataId(2), read, Description("Serial number ID") : amended] - uint16 SerialNumberID[16]; - - [WmiDataId(3), read, Description("Manufacturer name") : amended] - uint16 ManufacturerName[16]; - - [WmiDataId(4), read, Description("Week of manufacture (1..53, 0 = undefined)") : amended] - uint8 WeekOfManufacture; - - // NOTE: EDID contains (YearOfManufacture-1990). Monitor function driver corrects for that returning a proper year. - [WmiDataId(5), read, Description("Year of manufacture") : amended] - uint16 YearOfManufacture; - - [WmiDataId(6), read, Description("Length of user-friendly name") : amended] - uint16 UserFriendlyNameLength; - - [WmiDataId(7), read, Description("User-friendly name") : amended, WmiSizeIs("UserFriendlyNameLength")] - uint16 UserFriendlyName[]; - -}; - - -// Corresponds to data in the Video Input Definition of VESA E-EDID standard (Table 3.11 in section 3.6 of E-EDID v.1.3). -[ - WMI, - Description("Monitor's supported display features") : amended, - localeid("MS\\0x409"), - guid("{9FA9C28B-5E5C-4035-A5F8-67D4554F8D04}") -] -class WmiMonitorSupportedDisplayFeatures -{ - - [WmiDataId(1), read, Description("VESA DPMS Standby support") : amended] - boolean StandbySupported; - - [WmiDataId(2), read, Description("VESA DPMS Suspend support") : amended] - boolean SuspendSupported; - - // The display consumes much less power when it receives a timing signal that is outside its declared active operating range. - // The display will revert to normal operation if the timing signal returns to the normal operating range. - // No sync signals is one example of a timing signal outside normal operating range. No DE signal is another example. - [WmiDataId(3), read, Description("Active Off/Very Low Power Support") : amended] - boolean ActiveOffSupported; - - [ - WmiDataId(4), read, Description("Display type") : amended, - Values{ - "Monochrome/grayscale display", - "RGB color display", - "Non-RGB multicolor display" - } : amended - ] - uint8 DisplayType; - - [WmiDataId(5), read, Description("sRGB support") : amended] - boolean sRGBSupported; - - // If this is set, first detailed timing block contains the preferred timing mode of the monitor - // Note: Use of preferred timing mode is required by EDID v.1.3 and higher. - [WmiDataId(6), read, Description("Has a preferred timing mode") : amended] - boolean HasPreferredTimingMode; - - // If this bit is set to 1, the display supports timings based on the GTF standard using default GTF parameter values. - [WmiDataId(7), read, Description("GTF support") : amended] - boolean GTFSupported; - -}; - - -// Corresponds to data in the Basic Display Parameters/Features block of VESA E-EDID standard (section 3.6 of E-EDID v.1.3). -[ - WMI, - Dynamic, - Provider("WMIProv"), - Description("Monitor's basic display parameters/features") : amended, - localeid("MS\\0x409"), - guid("{9831B7E6-09AC-491f-8D07-3C3D649D8240}") -] -class WmiMonitorBasicDisplayParams : MSMonitorClass -{ - - [key, read] string InstanceName; - [read] boolean Active; - - [ - WmiDataId(1), read, Description("Video input type") : amended, - Values{ - "Analog", - "Digital" - } : amended - ] - uint8 VideoInputType; - - // Maximum image dimensions that can be correctly displayed, as defined by VESA Video Image Area Definition (VIAD) Standard, - // rounded to the nearest centimeter (cm). These values are intended to be the maximum image size that can be properly displayed - // over the entire set of supported timing/format combinations. The host system is expected to use this data to get a rough idea - // of the image size and aspect ratio to allow properly scaled text to be selected. - // Note: If either (or both) of these fields are zero, then the system shall make no assumption regarding the display size - // (e.g. a projection display may be of indeterminate size). - [WmiDataId(2), read, Description("Max horizontal image size (in cm)") : amended] - uint8 MaxHorizontalImageSize; - - [WmiDataId(3), read, Description("Max vertical image size (in cm)") : amended] - uint8 MaxVerticalImageSize; - - // TODO:[mmilirud] See if WmiScale(-2) is legal. If so, report gamma rather than 100*Gamma-100. - [WmiDataId(4), read, WmiScale(-2), Description("Display transfer characteristic (100*Gamma-100)") : amended] - uint8 DisplayTransferCharacteristic; - - [WmiDataId(5), read, Description("Supported display features") : amended] - WmiMonitorSupportedDisplayFeatures SupportedDisplayFeatures; - -}; - -// Returns information regarding how the monitor is connected. -[ - WMI, - Dynamic, - Provider("WMIProv"), - Description("Monitor's basic connection parameters") : amended, - localeid("MS\\0x409"), - guid("{2E2D2463-B537-4da7-8EEE-51306F1F482F}") -] -class WmiMonitorConnectionParams : MSMonitorClass -{ - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), read, Description("Video output technology type") : amended] - uint32 VideoOutputTechnology; -}; - - -// Corresponds to data in the Video Input Definition of VESA E-EDID standard (Table 3.9 in section 3.6 of E-EDID v.1.3) -// Only available when WmiMonitorBasicDisplayParams.VideoInputType == "Analog". -[ - WMI, - Dynamic, - Provider("WMIProv"), - Description("Monitor's analog video input parameters") : amended, - localeid("MS\\0x409"), - guid("{A56DBCF9-C4F0-44a8-9C1B-BB3B3F774B4D}") -] -class WmiMonitorAnalogVideoInputParams : MSMonitorClass -{ - [key, read] string InstanceName; - [read] boolean Active; - - [ - WmiDataId(1), read, Description("EVC signal level standard") : amended, - Values{ - "(0.7,0.3)[V]", - "(0.714,0.286)[V]", - "(1.0,0.4)[V]", - "(0.7,0.0)[V]" - } : amended - ] - uint8 SignalLevelStandard; - - [ - WmiDataId(2), read, - Description("Is setup expected") : amended, - Values{ - "Monitor expects a blank-to-blank setup or pedestal per appropriate Signal Level Standard", - "Monitor does NOT expect a blank-to-blank setup or pedestal per appropriate Signal Level Standard" - } : amended - ] - uint8 SetupExpected; - - [ - WmiDataId(3), read, - Description("Are separate syncs supported") : amended, - Values{ - "Separate syncs are supported", - "Separate syncs are NOT supported" - } : amended - ] - uint8 SeparateSyncsSupported; - - [ - WmiDataId(4), read, Description("Is composite sync supported") : amended, - Values{ - "Composite sync (on Hsync line) is supported", - "Composite sync (on Hsync line) is NOT supported" - } : amended - ] - uint8 CompositeSyncSupported; - - [ - WmiDataId(5), read, Description("Is sync on green supported") : amended, - Values{ - "Sync on green video is supported", - "Sync on green video is NOT supported" - } : amended - ] - uint8 SyncOnGreenVideoSupported; - - [ - WmiDataId(6), read, - Description("Is Vsync pulse serration required") : amended, - Values{ - "Serration of the Vsync pulse is required when composite sync or sync-on-green video is used", - "Serration of the Vsync pulse is NOT required when composite sync or sync-on-green video is used" - } : amended - ] - uint8 SerrationOfVsyncRequired; -}; - - -// Corresponds to data in the Video Input Definition of VESA E-EDID standard (Table 3.9 in section 3.6 of E-EDID v.1.3) -// Only available when WmiMonitorBasicDisplayParams.VideoInputType == "Digital". -[ - WMI, - Dynamic, - Provider("WMIProv"), - Description("Monitor's digital video input parameters") : amended, - localeid("MS\\0x409"), - guid("{51565945-498A-4a77-ACC6-151BECC805CA}") -] -class WmiMonitorDigitalVideoInputParams : MSMonitorClass -{ - - [key, read] string InstanceName; - [read] boolean Active; - - // If set, interface is signal compatible with VESA DFP 1.x TMDS CRGB, 1 pixel/clock, up to 8 bits/color MSB aligned, DE active high. - [WmiDataId(1), read, Description("VESA DFP 1.x (or compatible)") : amended] - boolean IsDFP1xCompatible; - -}; - - - -// The chromaticity and white point values are expressed as fractional numbers using encoding format, accurate to the thousandth place, -// which is 10 bits in length, with the MSB representing 2^-1 and LSB representing 2^-10 coefficients, respectively. -// Precision of the stored values should in the EDID v1.x should be accurate to +/- 0.005 of the actual value. -[ - WMI, - Description("XYZ CIE coordinates") : amended, - localeid("MS\\0x409"), - guid("{01FAF041-842C-4230-A31E-1335428CD8F0}") -] -class WmiMonitorColorXYZinCIE -{ - - [WmiDataId(1), WmiScale(-3), read, Description("X") : amended] - uint16 X; - - [WmiDataId(2), WmiScale(-3), read, Description("Y") : amended] - uint16 Y; - - // Z can be calculated based on the X and Y values, using the relation ||(X,Y,Z)|| = 1. - -}; - -// Corresponds to data in the Color Characteristics block of VESA E-EDID Standard (see section 3.7 of E-EDID v.1.3) -// Based on CIE publication 15.2 on colorimetry space. -[ - WMI, - Dynamic, - Provider("WMIProv"), - Description("Monitor color characteristics") : amended, - localeid("MS\\0x409"), - guid("{EA324793-51BB-486a-AA9D-0F5552353413}") -] -class WmiMonitorColorCharacteristics : MSMonitorClass -{ - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), read, Description("Red CIE coordinates") : amended] - WmiMonitorColorXYZinCIE Red; - - [WmiDataId(2), read, Description("Blue CIE coordinates") : amended] - WmiMonitorColorXYZinCIE Blue; - - [WmiDataId(3), read, Description("Green CIE coordinates") : amended] - WmiMonitorColorXYZinCIE Green; - - // The white point value shall be the default white point (i.e the white point set at power on or on a reset of the display to its default setting). - // If available, WmiMonitorColorPoint data block can be used to obtain more detailed color characteristics of the monitor. - [WmiDataId(4), read, Description("Default White CIE coordinates") : amended] - WmiMonitorColorXYZinCIE DefaultWhite; - -}; - - -// Element of the array in WmiMonitorLisetedSupportedSourceModes, used to expose supported video mode's information. -// Contains information that is a superset of the data available from established, standard, and detailed timing blocks. -[ - WMI, - Description("Video mode descriptor") : amended, - localeid("MS\\0x409"), - guid("{4A97ED30-BFAA-491a-9DFD-B43ADEDBF8E3}") -] -class VideoModeDescriptor -{ - - [WmiDataId(1), read, Description("Pixel clock rate (Hz)") : amended] - uint32 PixelClockRate; - - [WmiDataId(2), read, Description("Vertical refresh rate numerator (Hz)") : amended] - uint32 VerticalRefreshRateNumerator; - - [WmiDataId(3), read, Description("Vertical refresh rate denominator") : amended] - uint32 VerticalRefreshRateDenominator; - - [WmiDataId(4), read, Description("Horizontal refresh rate numerator (Hz)") : amended] - uint32 HorizontalRefreshRateNumerator; - - [WmiDataId(5), read, Description("Horizontal refresh rate denominator") : amended] - uint32 HorizontalRefreshRateDenominator; - - [WmiDataId(6), read, Description("Number of horizontally active pixels") : amended] - uint16 HorizontalActivePixels; - - [WmiDataId(7), read, Description("Number of vertically active pixels") : amended] - uint16 VerticalActivePixels; - - [WmiDataId(8), read, Description("Number of horizontally blanking pixels") : amended] - uint16 HorizontalBlankingPixels; - - [WmiDataId(9), read, Description("Number of vertically blanking pixels") : amended] - uint16 VerticalBlankingPixels; - - [WmiDataId(10), read, Description("Horizontal sync offset") : amended] - uint16 HorizontalSyncOffset; - - [WmiDataId(11), read, Description("Vertical sync offset") : amended] - uint16 VerticalSyncOffset; - - [WmiDataId(12), read, Description("Horizontal sync pulse width") : amended] - uint16 HorizontalSyncPulseWidth; - - [WmiDataId(13), read, Description("Vertical sync pulse width") : amended] - uint16 VerticalSyncPulseWidth; - - [WmiDataId(14), read, Description("Horizontal image size (mm)") : amended] - uint16 HorizontalImageSize; - - [WmiDataId(15), read, Description("Vertical image size (mm)") : amended] - uint16 VerticalImageSize; - - [WmiDataId(16), read, Description("Horizontal border") : amended] - uint16 HorizontalBorder; - - [WmiDataId(17), read, Description("Vertical border") : amended] - uint16 VerticalBorder; - - [WmiDataId(18), read, Description("Is interlaced") : amended] - boolean IsInterlaced; - - [ - WmiDataId(19), read, Description("Stereo mode type") : amended, - Values{ - "No stereo", - "Field Sequential Stereo with Right Image on Stereo Sync = 1", - "Field Sequential Stereo with Left Image on Stereo Sync = 1", - "2-way Interleaved Stereo with Right Image on Even Lines", - "2-way Interleaved Stereo with Left Image on Even Lines", - "4-way Interleaved Stereo", - "Side-by-Side Interleaved Stereo" - } : amended - ] - uint8 StereoModeType; - - [ - WmiDataId(20), read, Description("Signal sync type") : amended, - Values{ - "Analog Composite", - "Bipolar Analog Composite", - "Digital Composite", - "Digital Separate" - } : amended - ] - uint8 SyncSignalType; - - [ - WmiDataId(21), read, Description("Is serration required") : amended, - Values{ - "Controller shall supply Hsync during Vsync", - "Controller shall NOT supply Hsync during Vsync", - "Not applicable (signal sync type must be [bipolar] analog composite or digital composite)" - } : amended - ] - uint8 IsSerrationRequired; - - [ - WmiDataId(22), read, Description("Is sync on RGB") : amended, - Values{ - "Sync pulse should appear on all 3 video signal lines", - "Sync pulse should only appear on the green video signal line", - "Not applicable (signal sync type must be [bipolar] analog composite)" - } : amended - ] - uint8 IsSyncOnRGB; - - [ - WmiDataId(23), read, Description("Composite polarity type (this is polarity of Hsync pulses outside of Vsync)") : amended, - Values{ - "Composite polarity is positive", - "Composite polarity is negative", - "Not applicable (signal sync type must be digital composite)" - } : amended - ] - uint8 CompositePolarityType; - - [ - WmiDataId(24), read, Description("Vertical polarity type") : amended, - Values{ - "Vertical polarity is positive", - "Vertical polarity is negative", - "Not applicable (signal sync type must be digital separate)" - } : amended - ] - uint8 VerticalPolarityType; - - [ - WmiDataId(25), read, Description("Horizontal polarity type") : amended, - Values{ - "Horizontal polarity is positive", - "Horizontal polarity is negative", - "Not applicable (signal sync type must be digital separate)" - } : amended - ] - uint8 HorizontalPolarityType; - - [ - WmiDataId(26), read, Description("Video standard type") : amended, - Values{ - "Other", - "VESA DMT", - "VESA GTF", - "VESA CVT", - "IBM", - "APPLE", - "NTSC M", - "NTSC J", - "NTSC 433", - "PAL B", - "PAL B1", - "PAL G", - "PAL H", - "PAL I", - "PAL D", - "PAL N", - "PAL NC", - "SECAM B", - "SECAM D", - "SECAM G", - "SECAM H", - "SECAM K", - "SECAM K1", - "SECAM L", - "SECAM L1", - "EIA861", - "EIA861A", - "EIA861B" - } : amended - ] - uint8 VideoStandardType; - - [ - WmiDataId(27), read, Description("Origin") : amended, - Values{ - "Uninitialized", - "Default monitor profile", - "Monitor's descriptor", - "Registry override of the monitor descriptor", - "Registry override of a specific capability" - } : amended - ] - uint8 Origin; - - [ - WmiDataId(28), read, Description("Timing type") : amended, - Values{ - "Uninitialized", - "Established", - "Standard", - "Extra Standard", - "Detailed" - } : amended - ] - uint8 TimingType; - -}; - - -// Exposes a list of monitor source modes claimed to be supported by the monitor in its monitor descriptor, if any. -// For descriptorless monitors this list of modes is generated based on monitor's type, as specified by the monitor bus driver. -[ - WMI, - Dynamic, - Provider("WMIProv"), - Description("Monitor's listed supported source modes") : amended, - localeid("MS\\0x409"), - guid("{6DC76655-063C-4524-A862-B8410C26281B}") -] -class WmiMonitorListedSupportedSourceModes : MSMonitorClass -{ - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), read, Description("Number of listed supported monitor source modes") : amended] - uint16 NumOfMonitorSourceModes; - - [WmiDataId(2), read, Description("Preferred monitor source mode index") : amended] - uint16 PreferredMonitorSourceModeIndex; - - [ - WmiDataId(3), read, Description("Listed supported monitor source modes") : amended, - WmiSizeIs("NumOfMonitorSourceModes") - ] - VideoModeDescriptor MonitorSourceModes[]; - -}; - -// Element of the array in WmiMonitorListedFrequencyRanges, used to expose supported frequency ranges information. -[ - WMI, - Description("Frequency range descriptor") : amended, - localeid("MS\\0x409"), - guid("{F4546078-F3B2-417E-94CD-47EA306C5751}") -] -class FrequencyRangeDescriptor -{ - [ - WmiDataId(1), read, Description("Origin") : amended, - Values{ - "Uninitialized", - "Default monitor profile", - "Monitor's descriptor", - "Registry override of the monitor descriptor", - "Registry override of a specific capability" - } : amended - ] - uint8 Origin; - - [WmiDataId(2), read, Description("Minimum VSync numerator (in Hz)") : amended] - uint32 MinVSyncNumerator; - - [WmiDataId(3), read, Description("Minimum VSync denominator") : amended] - uint32 MinVSyncDenominator; - - [WmiDataId(4), read, Description("Maximum VSync numerator (in Hz)") : amended] - uint32 MaxVSyncNumerator; - - [WmiDataId(5), read, Description("Maximum VSync denominator") : amended] - uint32 MaxVSyncDenominator; - - [WmiDataId(6), read, Description("Minimum HSync numerator (in Hz)") : amended] - uint32 MinHSyncNumerator; - - [WmiDataId(7), read, Description("Minimum HSync denominator") : amended] - uint32 MinHSyncDenominator; - - [WmiDataId(8), read, Description("Maximum HSync numerator (in Hz)") : amended] - uint32 MaxHSyncNumerator; - - [WmiDataId(9), read, Description("Maximum HSync denominator") : amended] - uint32 MaxHSyncDenominator; - - [WmiDataId(10), read, Description("Constraint type") : amended, - Values{ - "Uninitialized", - "Active size", - "Maximum pixel rate" - } : amended - ] - uint32 ConstraintType; - - [WmiDataId(11), read, Description("Active width (in pixels)") : amended] - uint32 ActiveWidth; - - [WmiDataId(12), read, Description("Active height (in pixels)") : amended] - uint32 ActiveHeight; - - [WmiDataId(13), read, Description("Maximum pixel rate (in Hz)") : amended] - uint32 MaxPixelRate; - -}; - - -// Exposes a list of monitor supported frequency ranges claimed to be supported by the monitor in INF and/or EDID, if any. -[ - WMI, - Dynamic, - Provider("WMIProv"), - Description("Monitor's listed supported frequency ranges") : amended, - localeid("MS\\0x409"), - guid("{E86E9525-65B6-4B85-95C5-00BEACC975ED}") -] -class WmiMonitorListedFrequencyRanges : MSMonitorClass -{ - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), read, Description("Number of listed supported monitor frequency ranges") : amended] - uint16 NumOfMonitorFreqRanges; - - [ - WmiDataId(2), read, Description("Listed monitor frequency ranges") : amended, - WmiSizeIs("NumOfMonitorFreqRanges") - ] - FrequencyRangeDescriptor MonitorFreqRanges[]; -}; - -// -// Definitions for Processor Power Management. -// - -[abstract] -class MSKernelPpmClass { -}; - -// -// Data. -// - -[WMI, - Description("Kernel Processor Performance State"):amended, - localeid("MS\\0x409"), - guid("{8c7980e1-f62b-419e-aa82-276c8d064a1f}")] -class KernelPerfState { - - [WmiDataId(1), - read, - DisplayName("Processor Speed"):amended, - Description("Processor Frequency in Megahertz"):amended - ] uint32 Frequency; - - [WmiDataId(2), - read, - DisplayName("Power"):amended, - Description("Power in milliwatts"):amended - ] uint32 Power; - - [WmiDataId(3), - read, - DisplayName("Performance Percentage"):amended, - Description("Percentage of Highest Frequency"):amended - ] uint8 PercentFrequency; - - [WmiDataId(4), - read, - DisplayName("IncreaseLevel"):amended, - Description("IncreaseLevel"):amended - ] uint8 IncreaseLevel; - - [WmiDataId(5), - read, - DisplayName("DecreaseLevel"):amended, - Description("DecreaseLevel"):amended - ] uint8 DecreaseLevel; - - [WmiDataId(6), - read, - DisplayName("Type"):amended, - Description("State type: 1 = performance, 2 = throttle"):amended - ] uint8 Type; - - [WmiDataId(7), - read, - DisplayName("IncreaseTime"):amended, - Description("IncreaseTime"):amended - ] uint32 IncreaseTime; - - [WmiDataId(8), - read, - DisplayName("DecreaseTime"):amended, - Description("DecreaseTime"):amended - ] uint32 DecreaseTime; - - [WmiDataId(9), - read, - DisplayName("Control"):amended, - Description("Control value"):amended - ] uint64 Control; - - [WmiDataId(10), - read, - DisplayName("Status"):amended, - Description("Status value"):amended - ] uint64 Status; - - [WmiDataId(11), - read, - DisplayName("HitCount"):amended, - Description("Number of times this state has been entered"):amended - ] uint32 HitCount; - - [WmiDataId(12), - read, - DisplayName("Reserved1"):amended, - Description("Reserved"):amended - ] uint32 Reserved1; - - [WmiDataId(13), - read, - DisplayName("Reserved2"):amended, - Description("Reserved"):amended - ] uint64 Reserved2; - - [WmiDataId(14), - read, - DisplayName("Reserved3"):amended, - Description("Reserved"):amended - ] uint64 Reserved3; -}; - - -[WMI, - Dynamic, - Provider("WmiProv"), - Description("Kernel Processor Performance States"):amended, - localeid("MS\\0x409"), - guid("{5708cc20-7d40-4bf4-b4aa-2b01338d0126}")] -class KernelPerfStates:MSKernelPpmClass { - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - DisplayName("Number of Kernel Performance States"):amended, - Description("Total number of Kernel Performance States"):amended - ] uint32 Count; - - [WmiDataId(2), - read, - DisplayName("MaxFrequency"):amended, - Description("MaxFrequency"):amended - ] uint32 MaxFrequency; - - [WmiDataId(3), - read, - DisplayName("CurrentState"):amended, - Description("CurrentState"):amended - ] uint32 CurrentState; - - [WmiDataId(4), - read, - DisplayName("MaxPerfState"):amended, - Description("Fastest state considering policy restrictions"):amended - ] uint32 MaxPerfState; - - [WmiDataId(5), - read, - DisplayName("MinPerfState"):amended, - Description("Slowest state considering policy restrictions"):amended - ] uint32 MinPerfState; - - [WmiDataId(6), - read, - DisplayName("LowestPerfState"):amended, - Description("Slowest performance state disregarding policy restrictions"):amended - ] uint32 LowestPerfState; - - [WmiDataId(7), - read, - DisplayName("ThermalConstraint"):amended, - Description("Thermal constraint as a percentage"):amended - ] uint32 ThermalConstraint; - - [WmiDataId(8), - read, - DisplayName("BusyAdjThreshold"):amended, - Description("BusyAdjThreshold"):amended - ] uint8 BusyAdjThreshold; - - [WmiDataId(9), - read, - DisplayName("PolicyType"):amended, - Description("Processor domain coordination"):amended - ] uint8 PolicyType; - - [WmiDataId(10), - read, - DisplayName("Type"):amended, - Description("Type"):amended - ] uint8 Type; - - [WmiDataId(11), - read, - DisplayName("Reserved"):amended, - Description("Reserved"):amended - ] uint8 Reserved; - - [WmiDataId(12), - read, - DisplayName("TimerInterval"):amended, - Description("Timer interval in milliseconds"):amended - ] uint32 TimerInterval; - - [WmiDataId(13), - read, - DisplayName("TargetProcessors"):amended, - Description("Processor domain affinity"):amended - ] uint64 TargetProcessors; - - [WmiDataId(14), - read, - DisplayName("PState Handler"):amended, - Description("PState Handler"):amended - ] uint32 PStateHandler; - - [WmiDataId(15), - read, - DisplayName("PState Context"):amended, - Description("PState Context"):amended - ] uint32 PStateContext; - - [WmiDataId(16), - read, - DisplayName("TState Handler"):amended, - Description("TState Handler"):amended - ] uint32 TStateHandler; - - [WmiDataId(17), - read, - DisplayName("TState Context"):amended, - Description("TState Context"):amended - ] uint32 TStateContext; - - [WmiDataId(18), - read, - DisplayName("FeedbackHandler"):amended, - Description("FeedbackHandler"):amended - ] uint32 FeedbackHandler; - - [WmiDataId(19), - read, - DisplayName("Reserved1"):amended, - Description("Reserved"):amended - ] uint32 Reserved1; - - [WmiDataId(20), - read, - DisplayName("Reserved2"):amended, - Description("Reserved"):amended - ] uint64 Reserved2; - - [WmiDataId(21), - read, - DisplayName("Performance States"):amended, - Description("Array of Performance States"):amended, - WmiSizeIs("Count") - ] KernelPerfState State[]; -}; - -[WMI, - Description("Kernel Idle State"):amended, - localeid("MS\\0x409"), - guid("{46bdcf4a-e076-4550-82b2-9f32eded3e7f}")] -class KernelIdleState { - - [WmiDataId(1), - read, - DisplayName("Latency"):amended, - Description("Worst case transition latency to enter and exit the idle state [QueryPerformanceCounter units]"):amended - ] uint32 Latency; - - [WmiDataId(2), - read, - DisplayName("Power"):amended, - Description("Average power consumption in the idle state [milliwatts]"):amended - ] uint32 Power; - - [WmiDataId(3), - read, - DisplayName("TimeCheck"):amended, - Description("TimeCheck policy [QueryPerformanceCounter units]"):amended - ] uint32 TimeCheck; - - [WmiDataId(4), - read, - DisplayName("PromotePercent"):amended, - Description("PromotePercent policy"):amended - ] uint8 PromotePercent; - - [WmiDataId(5), - read, - DisplayName("DemotePercent"):amended, - Description("DemotePercent policy"):amended - ] uint8 DemotePercent; - - [WmiDataId(6), - read, - DisplayName("StateType"):amended, - Description("Idle state type per ACPI {1=C1, 2=C2, 3=C3, 4=C4, ...}"):amended - ] uint8 StateType; - - [WmiDataId(7), - read, - DisplayName("Reserved"):amended, - Description("Reserved"):amended - ] uint8 Reserved; - - [WmiDataId(8), - read, - DisplayName("StateFlags"):amended, - Description("StateFlags"):amended // IDLE_STATE_FLAGS_* - ] uint32 StateFlags; - - [WmiDataId(9), - read, - DisplayName("Context"):amended, - Description("IdleHandler context present"):amended - ] uint32 Context; - - [WmiDataId(10), - read, - DisplayName("IdleHandler"):amended, - Description("IdleHandler present"):amended - ] uint32 IdleHandler; - - [WmiDataId(11), - read, - DisplayName("Reserved1"):amended, - Description("Reserved"):amended - ] uint32 Reserved1; -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - Description("Kernel Idle States"):amended, - localeid("MS\\0x409"), - guid("{ba138e10-e250-4ad7-8616-cf1a7ad410e7}")] -class KernelIdleStates:MSKernelPpmClass { - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - DisplayName("Type"):amended, - Description("Type"):amended // IDLE_STATES_LINEAR, etc - ] uint32 Type; - - [WmiDataId(2), - read, - DisplayName("Number of Kernel Idle States"):amended, - Description("Total number of Kernel Idle States"):amended - ] uint32 Count; - - [WmiDataId(3), - read, - DisplayName("TargetState"):amended, - Description("Current target idle state"):amended - ] uint32 TargetState; - - [WmiDataId(4), - read, - DisplayName("TargetState"):amended, - Description("Previous target idle state"):amended - ] uint32 OldState; - - [WmiDataId(5), - read, - DisplayName("TargetProcessors"):amended, - Description("TargetProcessors"):amended - ] uint64 TargetProcessors; - - [WmiDataId(6), - read, - DisplayName("Idle States"):amended, - Description("Array of Idle States"):amended, - WmiSizeIs("Count") - ] KernelIdleState State[]; -}; - -// -// Events. -// - -[WMI, - Dynamic, - Provider("WmiProv"), - Locale("MS\\0x409"), - Description("Kernel Perf State Transition Event"), - guid("{A5B32DDD-7F39-4abc-B892-900E43B59EBB}")] -class KernelPerfStateChange:WmiEvent { - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - DisplayName("State"):amended, - Description("State"):amended - ] uint32 State; - - [WmiDataId(2), - read, - DisplayName("Status"):amended, - Description("Status"):amended - ] uint32 Status; - - [WmiDataId(3), - read, - DisplayName("Latency"):amended, - Description("Latency"):amended - ] uint32 Latency; - - [WmiDataId(4), - read, - DisplayName("Cpu Speed"):amended, - Description("Cpu Speed"):amended - ] uint32 Speed; - - [WmiDataId(5), - read, - DisplayName("Processor"):amended, - Description("Processor"):amended - ] uint32 Processor; -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - Locale("MS\\0x409"), - Description("Kernel Perf State Domain Transition Event"), - guid("{995e6b7f-d653-497a-b978-36a30c29bf01}")] -class KernelPerfStateDomainChange:WmiEvent { - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - DisplayName("State"):amended, - Description("State"):amended - ] uint32 State; - - [WmiDataId(2), - read, - DisplayName("Latency"):amended, - Description("Latency"):amended - ] uint32 Latency; - - [WmiDataId(3), - read, - DisplayName("Cpu Speed"):amended, - Description("Cpu Speed"):amended - ] uint32 Speed; - - [WmiDataId(4), - read, - DisplayName("Processors"):amended, - Description("Mask of processors in the same domain"):amended - ] uint64 Processors; -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - Locale("MS\\0x409"), - Description("Kernel Idle State Change Event"), - guid("{4838fe4f-f71c-4e51-9ecc-8430a7ac4c6c}")] -class KernelIdleStateChange:WmiEvent { - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - DisplayName("NewState"):amended, - Description("New Target Idle State"):amended - ] uint32 NewState; - - [WmiDataId(2), - read, - DisplayName("OldState"):amended, - Description("Old Target Idle State"):amended - ] uint32 OldState; - - [WmiDataId(3), - read, - DisplayName("TargetProcessors"):amended, - Description("TargetProcessors"):amended - ] uint64 Processors; -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - Locale("MS\\0x409"), - Description("Kernel Thermal Event"), - guid("{a852c2c8-1a4c-423b-8c2c-f30d82931a88}")] -class KernelThermalConstraintChange:WmiEvent { - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - DisplayName("ThermalConstraint"):amended, - Description("ThermalConstraint"):amended - ] uint32 ThermalConstraint; - - [WmiDataId(2), - read, - DisplayName("TargetProcessors"):amended, - Description("TargetProcessors"):amended - ] uint64 Processors; -}; - -[WMI, - localeid("MS\\0x409"), - Description("Kernel Idle State Accounting"):amended, - guid("{5280028a-c24f-43ec-b27d-a960a70e319a}")] -class IdleStateAccounting { - - [WmiDataId(1), - read, - DisplayName("IdleTransitions"):amended, - Description("IdleTransitions"):amended - ] uint32 IdleTransitions; - - [WmiDataId(2), - read, - DisplayName("FailedTransitions"):amended, - Description("FailedTransitions"):amended - ] uint32 FailedTransitions; - - [WmiDataId(3), - read, - DisplayName("InvalidBucketIndex"):amended, - Description("InvalidBucketIndex"):amended - ] uint32 InvalidBucketIndex; - - [WmiDataId(4), - read, - DisplayName("TotalTime"):amended, - Description("TotalTime"):amended - ] uint64 TotalTime; - - [WmiDataId(5), - read, - DisplayName("IdleTimeBuckets"):amended, - Description("IdleTimeBuckets"):amended - ] uint32 IdleTimeBuckets[6]; -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - Locale("MS\\0x409"), - Description("Kernel Idle Accounting"):amended, - guid("{e2a26f78-ae07-4ee0-a30f-ce354f5a94cd}")] -class IdleAccounting:WmiEvent { - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - DisplayName("Number of Idle States"):amended, - Description("Total number of Kernel Idle States"):amended - ] uint32 StateCount; - - [WmiDataId(2), - read, - DisplayName("TotalTransitions"):amended, - Description("TotalTransitions"):amended - ] uint32 TotalTransitions; - - [WmiDataId(3), - read, - DisplayName("ResetCount"):amended, - Description("ResetCount"):amended - ] uint32 ResetCount; - - [WmiDataId(4), - read, - DisplayName("StartTime"):amended, - Description("StartTime"):amended - ] uint64 StartTime; - - [WmiDataId(5), - read, - DisplayName("Idle States Accounting"):amended, - Description("Accounting Data for Kernel Idle States"):amended, - WmiSizeIs("StateCount") - ] IdleStateAccounting State[]; -}; - -[WMI, - localeid("MS\\0x409"), - Description("Kernel Idle State Bucket Extended"):amended, - guid("{e53e0a7d-36f0-4a77-879e-9c6b5e4a8554}")] -class IdleStateBucketEx { - - [WmiDataId(1), - read, - DisplayName("TotalTimeUs"):amended, - Description("TotalTimeUs"):amended - ] uint64 TotalTimeUs; - - [WmiDataId(2), - read, - DisplayName("MinTimeUs"):amended, - Description("MinTimeUs"):amended - ] uint32 MinTimeUs; - - [WmiDataId(3), - read, - DisplayName("MaxTimeUs"):amended, - Description("MaxTimeUs"):amended - ] uint32 MaxTimeUs; - - [WmiDataId(4), - read, - DisplayName("Count"):amended, - Description("Count"):amended - ] uint32 Count; -}; - -[WMI, - localeid("MS\\0x409"), - Description("Kernel Idle State Accounting"):amended, - guid("{3e0d7b2c-401b-480f-8303-d0c20ea1a7d8}")] -class IdleStateAccountingEx { - - [WmiDataId(1), - read, - DisplayName("TotalTime"):amended, - Description("TotalTime"):amended - ] uint64 TotalTime; - - [WmiDataId(2), - read, - DisplayName("IdleTransitions"):amended, - Description("IdleTransitions"):amended - ] uint32 IdleTransitions; - - [WmiDataId(3), - read, - DisplayName("FailedTransitions"):amended, - Description("FailedTransitions"):amended - ] uint32 FailedTransitions; - - [WmiDataId(4), - read, - DisplayName("InvalidBucketIndex"):amended, - Description("InvalidBucketIndex"):amended - ] uint32 InvalidBucketIndex; - - [WmiDataId(5), - read, - DisplayName("MinTimeUs"):amended, - Description("MinTimeUs"):amended - ] uint32 MinTimeUs; - - [WmiDataId(6), - read, - DisplayName("MaxTimeUs"):amended, - Description("MaxTimeUs"):amended - ] uint32 MaxTimeUs; - - [WmiDataId(7), - read, - DisplayName("IdleTimeBuckets"):amended, - Description("IdleTimeBuckets"):amended - ] IdleStateBucketEx IdleTimeBuckets[16]; -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - Locale("MS\\0x409"), - Description("Kernel Idle Accounting"):amended, - guid("{d67abd39-81f8-4a5e-8152-72e31ec912ee}")] -class IdleAccountingEx:WmiEvent { - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - DisplayName("Number of Idle States"):amended, - Description("Total number of Kernel Idle States"):amended - ] uint32 StateCount; - - [WmiDataId(2), - read, - DisplayName("TotalTransitions"):amended, - Description("TotalTransitions"):amended - ] uint32 TotalTransitions; - - [WmiDataId(3), - read, - DisplayName("ResetCount"):amended, - Description("ResetCount"):amended - ] uint32 ResetCount; - - [WmiDataId(4), - read, - DisplayName("StartTime"):amended, - Description("StartTime"):amended - ] uint64 StartTime; - - [WmiDataId(5), - read, - DisplayName("Idle States Accounting"):amended, - Description("Accounting Data for Kernel Idle States"):amended, - WmiSizeIs("StateCount") - ] IdleStateAccountingEx State[]; -}; - -[WMI, - Dynamic, - Provider("WmiProv"), - Locale("MS\\0x409"), - Description("Kernel Thermal Policy Event"), - guid("{aca5a8f7-96ca-4397-bade-43be2f577d51}")] -class KernelThermalPolicyChange:WmiEvent { - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - DisplayName("Cooling Policy"):amended, - Description("Current ACPI Cooling Mode"):amended - ] uint8 CoolingMode; - - [WmiDataId(2), - read, - DisplayName("Processors"):amended, - Description("Processors"):amended - ] uint64 Processors; -}; - -// -// Define schema for performance counters to be displayed by perfmon -// -// All perf counter classes must derived from Win32_PerfRawData and -// have the hiperf qualifier. -// -// Each property within the class must have the following qualifiers: -// -// CounterType - This defines the type of counter. See winperf.h -// for more information on what values to place in this -// qualifier. -// -// PerfDetail - The amount of detail supplied by the counter. -// PERF_DETAIL_NOVICE 100 // The uninformed can understand it -// PERF_DETAIL_ADVANCED 200 // For the advanced user -// PERF_DETAIL_EXPERT 300 // For the expert user -// PERF_DETAIL_WIZARD 400 // For the system designer -// -// DefaultScale - Power if 10 by which to scale chart line if -// vertical axis is 100. 0 ==> 1, 1 ==> 10, -// -1 ==> 1/10. Used for purposes display only. -// -// Also property may have the following optional qualifiers -// -// PerfDefault - Denotes the property that is the default counter -// as displayed by the Sysmon list box. Only one -// property may have this qualifier. -// -// Costly - Indicates that the value for the property may -// be costly to obtain -// -// -// Only int32, uint32, int64 and uint64 properties will be displayed in sysmon -// -// All performance counter classes should be localizable, which means that -// they should include ammended DisplayName and Description class and property -// qualifiers. -// - -[WMI, - Dynamic, - Provider("WMIProv"), - Description("Processor Performance Information"):amended, - DisplayName("Processor Performance"):amended, - localeid("MS\\0x409"), - guid("{7FD18652-0CFE-40d2-B0A1-0B066A87759E}"), - PerfDetail(100), - HiPerf] -class ProcessorPerformance:Win32_PerfRawData { - - [key, read] string InstanceName; - [read] boolean Active; - - [WmiDataId(1), - read, - DisplayName("Processor Frequency"):amended, - Description("Current Processor Frequency in megahertz"):amended, - PerfDefault, - CounterType(0x00010000), - DefaultScale(0), - PerfDetail(100) - ] uint32 frequency; - - [WmiDataId(2), - read, - DisplayName("Processor State Flags"):amended, - Description("Processor State Flags"):amended, - CounterType(0x00000000), - DefaultScale(0), - PerfDetail(100) - ] uint32 power; - - [WmiDataId(3), - read, - DisplayName("% of Maximum Frequency"):amended, - Description("Percentage of maximum processor frequency"):amended, - CounterType(0x00010000), - DefaultScale(0), - PerfDetail(100) - ] uint32 percentage; -}; - - diff --git a/pub/ddk/wmidata.h b/pub/ddk/wmidata.h deleted file mode 100644 index 7e6ff1e..0000000 --- a/pub/ddk/wmidata.h +++ /dev/null @@ -1,12202 +0,0 @@ -#ifndef _wmidata_h_ -#define _wmidata_h_ - -// MSWmi_MofData - MSWmi_MofData -#define MSWmi_MofDataGuid \ - { 0x05901221,0xd566,0x11d1, { 0xb2,0xf0,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSWmi_MofData_GUID, \ - 0x05901221,0xd566,0x11d1,0xb2,0xf0,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSWmi_MofData -{ - // - ULONG Unused1; - #define MSWmi_MofData_Unused1_SIZE sizeof(ULONG) - #define MSWmi_MofData_Unused1_ID 1 - - // - ULONG Unused2; - #define MSWmi_MofData_Unused2_SIZE sizeof(ULONG) - #define MSWmi_MofData_Unused2_ID 2 - - // - ULONG Size; - #define MSWmi_MofData_Size_SIZE sizeof(ULONG) - #define MSWmi_MofData_Size_ID 3 - - // - ULONG Unused4; - #define MSWmi_MofData_Unused4_SIZE sizeof(ULONG) - #define MSWmi_MofData_Unused4_ID 4 - - // - UCHAR BinaryMofData[1]; - #define MSWmi_MofData_BinaryMofData_ID 5 - -} MSWmi_MofData, *PMSWmi_MofData; - -// MSWmi_ProviderInfo - MSWmi_ProviderInfo -#define MSWmi_ProviderInfoGuid \ - { 0xc7bf35d0,0xaadb,0x11d1, { 0xbf,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSWmi_ProviderInfo_GUID, \ - 0xc7bf35d0,0xaadb,0x11d1,0xbf,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -// Warning: Header for class MSWmi_ProviderInfo cannot be created -typedef struct _MSWmi_ProviderInfo -{ - char VariableData[1]; - -} MSWmi_ProviderInfo, *PMSWmi_ProviderInfo; - -// MSWmi_PnPDeviceId - MSWmi_PnPDeviceId -#define DATA_PROVIDER_PNPID_GUID \ - { 0xc7bf35d2,0xaadb,0x11d1, { 0xbf,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSWmi_PnPDeviceId_GUID, \ - 0xc7bf35d2,0xaadb,0x11d1,0xbf,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSWmi_PnPDeviceId -{ - // - CHAR VariableData[1]; - #define MSWmi_PnPDeviceId_PnPDeviceId_ID 1 - -} MSWmi_PnPDeviceId, *PMSWmi_PnPDeviceId; - -// MSWmi_PnPInstanceNames - MSWmi_PnPInstanceNames -#define DATA_PROVIDER_PNPID_INSTANCE_NAMES_GUID \ - { 0xc7bf35d3,0xaadb,0x11d1, { 0xbf,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSWmi_PnPInstanceNames_GUID, \ - 0xc7bf35d3,0xaadb,0x11d1,0xbf,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSWmi_PnPInstanceNames -{ - // - ULONG Count; - #define MSWmi_PnPInstanceNames_Count_SIZE sizeof(ULONG) - #define MSWmi_PnPInstanceNames_Count_ID 1 - - // - WCHAR InstanceNameList[1]; - #define MSWmi_PnPInstanceNames_InstanceNameList_ID 2 - -} MSWmi_PnPInstanceNames, *PMSWmi_PnPInstanceNames; - -// MSWmi_Guid - MSWmi_Guid -#define MSWmi_GuidGuid \ - { 0xf8c60aed,0xef8d,0x4f95, { 0x9e,0xa8,0xf0,0x43,0x18,0xa0,0x0f,0x30 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSWmi_Guid_GUID, \ - 0xf8c60aed,0xef8d,0x4f95,0x9e,0xa8,0xf0,0x43,0x18,0xa0,0x0f,0x30); -#endif - - -typedef struct _MSWmi_Guid -{ - // - UCHAR Guid[16]; - #define MSWmi_Guid_Guid_SIZE sizeof(UCHAR[16]) - #define MSWmi_Guid_Guid_ID 1 - -} MSWmi_Guid, *PMSWmi_Guid; - -#define MSWmi_Guid_SIZE (FIELD_OFFSET(MSWmi_Guid, Guid) + MSWmi_Guid_Guid_SIZE) - -// MSWmi_GuidRegistrationInfo - MSWmi_GuidRegistrationInfo -#define MSWmi_GuidRegistrationInfoGuid \ - { 0xb48d49a1,0xe777,0x11d0, { 0xa5,0x0c,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSWmi_GuidRegistrationInfo_GUID, \ - 0xb48d49a1,0xe777,0x11d0,0xa5,0x0c,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSWmi_GuidRegistrationInfo -{ - // - ULONG Operation; - #define MSWmi_GuidRegistrationInfo_Operation_SIZE sizeof(ULONG) - #define MSWmi_GuidRegistrationInfo_Operation_ID 1 - - // - ULONG GuidCount; - #define MSWmi_GuidRegistrationInfo_GuidCount_SIZE sizeof(ULONG) - #define MSWmi_GuidRegistrationInfo_GuidCount_ID 2 - - // - MSWmi_Guid GuidList[1]; - #define MSWmi_GuidRegistrationInfo_GuidList_ID 3 - -} MSWmi_GuidRegistrationInfo, *PMSWmi_GuidRegistrationInfo; - -// MSAcpiInfo - MSAcpiInfo -#define MSAcpiInfoGuid \ - { 0x5daf38ae,0xf6f8,0x4d90, { 0x81,0x99,0xeb,0xde,0x68,0x00,0xec,0x3b } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSAcpiInfo_GUID, \ - 0x5daf38ae,0xf6f8,0x4d90,0x81,0x99,0xeb,0xde,0x68,0x00,0xec,0x3b); -#endif - - -typedef struct _MSAcpiInfo -{ - // - ULONG BootArchitecture; - #define MSAcpiInfo_BootArchitecture_SIZE sizeof(ULONG) - #define MSAcpiInfo_BootArchitecture_ID 1 - - // - ULONG PreferredProfile; - #define MSAcpiInfo_PreferredProfile_SIZE sizeof(ULONG) - #define MSAcpiInfo_PreferredProfile_ID 2 - - // - ULONG Capabilities; - #define MSAcpiInfo_Capabilities_SIZE sizeof(ULONG) - #define MSAcpiInfo_Capabilities_ID 3 - -} MSAcpiInfo, *PMSAcpiInfo; - -#define MSAcpiInfo_SIZE (FIELD_OFFSET(MSAcpiInfo, Capabilities) + MSAcpiInfo_Capabilities_SIZE) - -// WHEAErrorInjectionMethods - WHEAErrorInjectionMethods -#define WHEAErrorInjectionMethodsGuid \ - { 0xe808ff73,0x2093,0x472a, { 0xa5,0xcc,0xdf,0x24,0xf0,0x31,0xb0,0x35 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WHEAErrorInjectionMethods_GUID, \ - 0xe808ff73,0x2093,0x472a,0xa5,0xcc,0xdf,0x24,0xf0,0x31,0xb0,0x35); -#endif - -// -// Method id definitions for WHEAErrorInjectionMethods -#define GetErrorInjectionCapabilitiesRtn 1 -typedef struct _GET_INJECTION_CAPABILITIES_OUT -{ - // - ULONG Status; - #define GET_INJECTION_CAPABILITIES_OUT_Status_SIZE sizeof(ULONG) - #define GET_INJECTION_CAPABILITIES_OUT_Status_ID 1 - - // - ULONG Capabilities; - #define GET_INJECTION_CAPABILITIES_OUT_Capabilities_SIZE sizeof(ULONG) - #define GET_INJECTION_CAPABILITIES_OUT_Capabilities_ID 2 - -} GET_INJECTION_CAPABILITIES_OUT, *PGET_INJECTION_CAPABILITIES_OUT; - -#define GET_INJECTION_CAPABILITIES_OUT_SIZE (FIELD_OFFSET(GET_INJECTION_CAPABILITIES_OUT, Capabilities) + GET_INJECTION_CAPABILITIES_OUT_Capabilities_SIZE) - -#define InjectErrorRtn 2 -typedef struct _INJECT_HARDWARE_ERROR_IN -{ - // - ULONG ErrorType; - #define INJECT_HARDWARE_ERROR_IN_ErrorType_SIZE sizeof(ULONG) - #define INJECT_HARDWARE_ERROR_IN_ErrorType_ID 1 - - // - ULONGLONG Parameter1; - #define INJECT_HARDWARE_ERROR_IN_Parameter1_SIZE sizeof(ULONGLONG) - #define INJECT_HARDWARE_ERROR_IN_Parameter1_ID 2 - - // - ULONGLONG Parameter2; - #define INJECT_HARDWARE_ERROR_IN_Parameter2_SIZE sizeof(ULONGLONG) - #define INJECT_HARDWARE_ERROR_IN_Parameter2_ID 3 - - // - ULONGLONG Parameter3; - #define INJECT_HARDWARE_ERROR_IN_Parameter3_SIZE sizeof(ULONGLONG) - #define INJECT_HARDWARE_ERROR_IN_Parameter3_ID 4 - - // - ULONGLONG Parameter4; - #define INJECT_HARDWARE_ERROR_IN_Parameter4_SIZE sizeof(ULONGLONG) - #define INJECT_HARDWARE_ERROR_IN_Parameter4_ID 5 - -} INJECT_HARDWARE_ERROR_IN, *PINJECT_HARDWARE_ERROR_IN; - -#define INJECT_HARDWARE_ERROR_IN_SIZE (FIELD_OFFSET(INJECT_HARDWARE_ERROR_IN, Parameter4) + INJECT_HARDWARE_ERROR_IN_Parameter4_SIZE) - -typedef struct _INJECT_HARDWARE_ERROR_OUT -{ - // - ULONG Status; - #define INJECT_HARDWARE_ERROR_OUT_Status_SIZE sizeof(ULONG) - #define INJECT_HARDWARE_ERROR_OUT_Status_ID 6 - -} INJECT_HARDWARE_ERROR_OUT, *PINJECT_HARDWARE_ERROR_OUT; - -#define INJECT_HARDWARE_ERROR_OUT_SIZE (FIELD_OFFSET(INJECT_HARDWARE_ERROR_OUT, Status) + INJECT_HARDWARE_ERROR_OUT_Status_SIZE) - - -// WHEAErrorSourceMethods - WHEAErrorSourceMethods -#define WHEAErrorSourceMethodsGuid \ - { 0x91c3c007,0x185d,0x4d78, { 0xa7,0x51,0xbf,0xcb,0x31,0xc2,0xc6,0x4d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WHEAErrorSourceMethods_GUID, \ - 0x91c3c007,0x185d,0x4d78,0xa7,0x51,0xbf,0xcb,0x31,0xc2,0xc6,0x4d); -#endif - -// -// Method id definitions for WHEAErrorSourceMethods -#define GetAllErrorSourcesRtn 1 -typedef struct _GET_ALL_ERROR_SOURCES_OUT -{ - // - ULONG Status; - #define GET_ALL_ERROR_SOURCES_OUT_Status_SIZE sizeof(ULONG) - #define GET_ALL_ERROR_SOURCES_OUT_Status_ID 1 - - // - ULONG Count; - #define GET_ALL_ERROR_SOURCES_OUT_Count_SIZE sizeof(ULONG) - #define GET_ALL_ERROR_SOURCES_OUT_Count_ID 2 - - // - ULONG Length; - #define GET_ALL_ERROR_SOURCES_OUT_Length_SIZE sizeof(ULONG) - #define GET_ALL_ERROR_SOURCES_OUT_Length_ID 3 - - // - UCHAR ErrorSourceArray[1]; - #define GET_ALL_ERROR_SOURCES_OUT_ErrorSourceArray_ID 4 - -} GET_ALL_ERROR_SOURCES_OUT, *PGET_ALL_ERROR_SOURCES_OUT; - -#define GetErrorSourceInfoRtn 2 -typedef struct _GET_ERROR_SOURCE_INFO_IN -{ - // - ULONG ErrorSourceId; - #define GET_ERROR_SOURCE_INFO_IN_ErrorSourceId_SIZE sizeof(ULONG) - #define GET_ERROR_SOURCE_INFO_IN_ErrorSourceId_ID 2 - -} GET_ERROR_SOURCE_INFO_IN, *PGET_ERROR_SOURCE_INFO_IN; - -#define GET_ERROR_SOURCE_INFO_IN_SIZE (FIELD_OFFSET(GET_ERROR_SOURCE_INFO_IN, ErrorSourceId) + GET_ERROR_SOURCE_INFO_IN_ErrorSourceId_SIZE) - -typedef struct _GET_ERROR_SOURCE_INFO_OUT -{ - // - ULONG Status; - #define GET_ERROR_SOURCE_INFO_OUT_Status_SIZE sizeof(ULONG) - #define GET_ERROR_SOURCE_INFO_OUT_Status_ID 1 - - // - ULONG Length; - #define GET_ERROR_SOURCE_INFO_OUT_Length_SIZE sizeof(ULONG) - #define GET_ERROR_SOURCE_INFO_OUT_Length_ID 3 - - // - UCHAR ErrorSourceInfo[1]; - #define GET_ERROR_SOURCE_INFO_OUT_ErrorSourceInfo_ID 4 - -} GET_ERROR_SOURCE_INFO_OUT, *PGET_ERROR_SOURCE_INFO_OUT; - -#define SetErrorSourceInfoRtn 3 -typedef struct _SET_ERROR_SOURCE_INFO_IN -{ - // - ULONG Length; - #define SET_ERROR_SOURCE_INFO_IN_Length_SIZE sizeof(ULONG) - #define SET_ERROR_SOURCE_INFO_IN_Length_ID 2 - - // - UCHAR ErrorSourceInfo[1]; - #define SET_ERROR_SOURCE_INFO_IN_ErrorSourceInfo_ID 3 - -} SET_ERROR_SOURCE_INFO_IN, *PSET_ERROR_SOURCE_INFO_IN; - -typedef struct _SET_ERROR_SOURCE_INFO_OUT -{ - // - ULONG Status; - #define SET_ERROR_SOURCE_INFO_OUT_Status_SIZE sizeof(ULONG) - #define SET_ERROR_SOURCE_INFO_OUT_Status_ID 1 - -} SET_ERROR_SOURCE_INFO_OUT, *PSET_ERROR_SOURCE_INFO_OUT; - -#define SET_ERROR_SOURCE_INFO_OUT_SIZE (FIELD_OFFSET(SET_ERROR_SOURCE_INFO_OUT, Status) + SET_ERROR_SOURCE_INFO_OUT_Status_SIZE) - -#define EnableErrorSourceRtn 4 -typedef struct _ENABLE_ERROR_SOURCE_IN -{ - // - ULONG ErrorSourceId; - #define ENABLE_ERROR_SOURCE_IN_ErrorSourceId_SIZE sizeof(ULONG) - #define ENABLE_ERROR_SOURCE_IN_ErrorSourceId_ID 2 - -} ENABLE_ERROR_SOURCE_IN, *PENABLE_ERROR_SOURCE_IN; - -#define ENABLE_ERROR_SOURCE_IN_SIZE (FIELD_OFFSET(ENABLE_ERROR_SOURCE_IN, ErrorSourceId) + ENABLE_ERROR_SOURCE_IN_ErrorSourceId_SIZE) - -typedef struct _ENABLE_ERROR_SOURCE_OUT -{ - // - ULONG Status; - #define ENABLE_ERROR_SOURCE_OUT_Status_SIZE sizeof(ULONG) - #define ENABLE_ERROR_SOURCE_OUT_Status_ID 1 - -} ENABLE_ERROR_SOURCE_OUT, *PENABLE_ERROR_SOURCE_OUT; - -#define ENABLE_ERROR_SOURCE_OUT_SIZE (FIELD_OFFSET(ENABLE_ERROR_SOURCE_OUT, Status) + ENABLE_ERROR_SOURCE_OUT_Status_SIZE) - -#define DisableErrorSourceRtn 5 -typedef struct _DISABLE_ERROR_SOURCE_IN -{ - // - ULONG ErrorSourceId; - #define DISABLE_ERROR_SOURCE_IN_ErrorSourceId_SIZE sizeof(ULONG) - #define DISABLE_ERROR_SOURCE_IN_ErrorSourceId_ID 2 - -} DISABLE_ERROR_SOURCE_IN, *PDISABLE_ERROR_SOURCE_IN; - -#define DISABLE_ERROR_SOURCE_IN_SIZE (FIELD_OFFSET(DISABLE_ERROR_SOURCE_IN, ErrorSourceId) + DISABLE_ERROR_SOURCE_IN_ErrorSourceId_SIZE) - -typedef struct _DISABLE_ERROR_SOURCE_OUT -{ - // - ULONG Status; - #define DISABLE_ERROR_SOURCE_OUT_Status_SIZE sizeof(ULONG) - #define DISABLE_ERROR_SOURCE_OUT_Status_ID 1 - -} DISABLE_ERROR_SOURCE_OUT, *PDISABLE_ERROR_SOURCE_OUT; - -#define DISABLE_ERROR_SOURCE_OUT_SIZE (FIELD_OFFSET(DISABLE_ERROR_SOURCE_OUT, Status) + DISABLE_ERROR_SOURCE_OUT_Status_SIZE) - - -// MSSmBios_RawSMBiosTables - MSSmBios_RawSMBiosTables -#define MSSmBios_RawSMBiosTablesGuid \ - { 0x8f680850,0xa584,0x11d1, { 0xbf,0x38,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSSmBios_RawSMBiosTables_GUID, \ - 0x8f680850,0xa584,0x11d1,0xbf,0x38,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSSmBios_RawSMBiosTables -{ - // - BOOLEAN Used20CallingMethod; - #define MSSmBios_RawSMBiosTables_Used20CallingMethod_SIZE sizeof(BOOLEAN) - #define MSSmBios_RawSMBiosTables_Used20CallingMethod_ID 1 - - // - UCHAR SmbiosMajorVersion; - #define MSSmBios_RawSMBiosTables_SmbiosMajorVersion_SIZE sizeof(UCHAR) - #define MSSmBios_RawSMBiosTables_SmbiosMajorVersion_ID 2 - - // - UCHAR SmbiosMinorVersion; - #define MSSmBios_RawSMBiosTables_SmbiosMinorVersion_SIZE sizeof(UCHAR) - #define MSSmBios_RawSMBiosTables_SmbiosMinorVersion_ID 3 - - // - UCHAR DmiRevision; - #define MSSmBios_RawSMBiosTables_DmiRevision_SIZE sizeof(UCHAR) - #define MSSmBios_RawSMBiosTables_DmiRevision_ID 4 - - // - ULONG Size; - #define MSSmBios_RawSMBiosTables_Size_SIZE sizeof(ULONG) - #define MSSmBios_RawSMBiosTables_Size_ID 5 - - // - UCHAR SMBiosData[1]; - #define MSSmBios_RawSMBiosTables_SMBiosData_ID 6 - -} MSSmBios_RawSMBiosTables, *PMSSmBios_RawSMBiosTables; - -// MSSmBios_SMBiosEventlog - MSSmBios_SMBiosEventlog -#define MSSmBios_SMBiosEventlogGuid \ - { 0x8f680851,0xa584,0x11d1, { 0xbf,0x38,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSSmBios_SMBiosEventlog_GUID, \ - 0x8f680851,0xa584,0x11d1,0xbf,0x38,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -// Warning: Header for class MSSmBios_SMBiosEventlog cannot be created -typedef struct _MSSmBios_SMBiosEventlog -{ - char VariableData[1]; - -} MSSmBios_SMBiosEventlog, *PMSSmBios_SMBiosEventlog; - -// MSSmBios_SysidUUID - SYSID_UUID -#define MSSmBios_SysidUUIDGuid \ - { 0x8f680852,0xa584,0x11d1, { 0xbf,0x38,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSSmBios_SysidUUID_GUID, \ - 0x8f680852,0xa584,0x11d1,0xbf,0x38,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _SYSID_UUID -{ - // - UCHAR Uuid[16]; - #define SYSID_UUID_Uuid_SIZE sizeof(UCHAR[16]) - #define SYSID_UUID_Uuid_ID 1 - -} SYSID_UUID, *PSYSID_UUID; - -#define SYSID_UUID_SIZE (FIELD_OFFSET(SYSID_UUID, Uuid) + SYSID_UUID_Uuid_SIZE) - -// MSSmBios_SysidUUIDList - MSSmBios_SysidUUIDList -#define SYSID_UUID_DATA_GUID \ - { 0x8f680853,0xa584,0x11d1, { 0xbf,0x38,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSSmBios_SysidUUIDList_GUID, \ - 0x8f680853,0xa584,0x11d1,0xbf,0x38,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSSmBios_SysidUUIDList -{ - // - ULONG Count; - #define MSSmBios_SysidUUIDList_Count_SIZE sizeof(ULONG) - #define MSSmBios_SysidUUIDList_Count_ID 1 - - // - SYSID_UUID List[1]; - #define MSSmBios_SysidUUIDList_List_ID 2 - -} MSSmBios_SysidUUIDList, *PMSSmBios_SysidUUIDList; - -// MSSmBios_Sysid1394 - SYSID_1394 -#define MSSmBios_Sysid1394Guid \ - { 0x8f680854,0xa584,0x11d1, { 0xbf,0x38,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSSmBios_Sysid1394_GUID, \ - 0x8f680854,0xa584,0x11d1,0xbf,0x38,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _SYSID_1394 -{ - // - UCHAR x1394[8]; - #define SYSID_1394_x1394_SIZE sizeof(UCHAR[8]) - #define SYSID_1394_x1394_ID 1 - -} SYSID_1394, *PSYSID_1394; - -#define SYSID_1394_SIZE (FIELD_OFFSET(SYSID_1394, x1394) + SYSID_1394_x1394_SIZE) - -// MSSmBios_Sysid1394List - MSSmBios_Sysid1394List -#define SYSID_1394_DATA_GUID \ - { 0x8f680855,0xa584,0x11d1, { 0xbf,0x38,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSSmBios_Sysid1394List_GUID, \ - 0x8f680855,0xa584,0x11d1,0xbf,0x38,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSSmBios_Sysid1394List -{ - // - ULONG Count; - #define MSSmBios_Sysid1394List_Count_SIZE sizeof(ULONG) - #define MSSmBios_Sysid1394List_Count_ID 1 - - // - SYSID_1394 List[1]; - #define MSSmBios_Sysid1394List_List_ID 2 - -} MSSmBios_Sysid1394List, *PMSSmBios_Sysid1394List; - -// MSMCAEvent_SwitchToCMCPolling - MSMCAEvent_SwitchToCMCPolling -#define MSMCAEvent_SwitchToCMCPollingGuid \ - { 0x39c14290,0xf036,0x4999, { 0xb8,0xa1,0xb6,0xf8,0x71,0xfb,0x32,0x9e } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_SwitchToCMCPolling_GUID, \ - 0x39c14290,0xf036,0x4999,0xb8,0xa1,0xb6,0xf8,0x71,0xfb,0x32,0x9e); -#endif - - -// MSMCAEvent_SwitchToCPEPolling - MSMCAEvent_SwitchToCPEPolling -#define MSMCAEvent_SwitchToCPEPollingGuid \ - { 0xd5c870ce,0x4ed0,0x4fdc, { 0xbb,0x54,0x8b,0x45,0x2c,0x18,0x79,0x7e } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_SwitchToCPEPolling_GUID, \ - 0xd5c870ce,0x4ed0,0x4fdc,0xbb,0x54,0x8b,0x45,0x2c,0x18,0x79,0x7e); -#endif - - -// MSMCAEvent_Header - MSMCAEvent_Header -#define MSMCAEvent_HeaderGuid \ - { 0x6381c27f,0xc8fa,0x4da7, { 0x89,0x53,0xb8,0x68,0x33,0x73,0x6e,0x15 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_Header_GUID, \ - 0x6381c27f,0xc8fa,0x4da7,0x89,0x53,0xb8,0x68,0x33,0x73,0x6e,0x15); -#endif - - -typedef struct _MSMCAEvent_Header -{ - // - ULONGLONG RecordId; - #define MSMCAEvent_Header_RecordId_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_Header_RecordId_ID 1 - - // - UCHAR ErrorSeverity; - #define MSMCAEvent_Header_ErrorSeverity_SIZE sizeof(UCHAR) - #define MSMCAEvent_Header_ErrorSeverity_ID 2 - - // - ULONG Type; - #define MSMCAEvent_Header_Type_SIZE sizeof(ULONG) - #define MSMCAEvent_Header_Type_ID 3 - - // - ULONG Cpu; - #define MSMCAEvent_Header_Cpu_SIZE sizeof(ULONG) - #define MSMCAEvent_Header_Cpu_ID 4 - - // - ULONG AdditionalErrors; - #define MSMCAEvent_Header_AdditionalErrors_SIZE sizeof(ULONG) - #define MSMCAEvent_Header_AdditionalErrors_ID 5 - - // - ULONG LogToEventlog; - #define MSMCAEvent_Header_LogToEventlog_SIZE sizeof(ULONG) - #define MSMCAEvent_Header_LogToEventlog_ID 6 - -} MSMCAEvent_Header, *PMSMCAEvent_Header; - -#define MSMCAEvent_Header_SIZE (FIELD_OFFSET(MSMCAEvent_Header, LogToEventlog) + MSMCAEvent_Header_LogToEventlog_SIZE) - -// MSMCAEvent_BusError - MSMCAEvent_BusError -#define MSMCAEvent_BusErrorGuid \ - { 0x1ee17050,0x0039,0x40f7, { 0x9e,0xad,0x14,0xad,0x51,0x61,0x2c,0xb2 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_BusError_GUID, \ - 0x1ee17050,0x0039,0x40f7,0x9e,0xad,0x14,0xad,0x51,0x61,0x2c,0xb2); -#endif - - -typedef struct _MSMCAEvent_BusError -{ - // - ULONGLONG RecordId; - #define MSMCAEvent_BusError_RecordId_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_BusError_RecordId_ID 1 - - // - UCHAR ErrorSeverity; - #define MSMCAEvent_BusError_ErrorSeverity_SIZE sizeof(UCHAR) - #define MSMCAEvent_BusError_ErrorSeverity_ID 2 - - // - ULONG Type; - #define MSMCAEvent_BusError_Type_SIZE sizeof(ULONG) - #define MSMCAEvent_BusError_Type_ID 3 - - // - ULONG Cpu; - #define MSMCAEvent_BusError_Cpu_SIZE sizeof(ULONG) - #define MSMCAEvent_BusError_Cpu_ID 4 - - // - ULONG AdditionalErrors; - #define MSMCAEvent_BusError_AdditionalErrors_SIZE sizeof(ULONG) - #define MSMCAEvent_BusError_AdditionalErrors_ID 5 - - // - ULONG LogToEventlog; - #define MSMCAEvent_BusError_LogToEventlog_SIZE sizeof(ULONG) - #define MSMCAEvent_BusError_LogToEventlog_ID 6 - - // - ULONG Participation; - #define MSMCAEvent_BusError_Participation_SIZE sizeof(ULONG) - #define MSMCAEvent_BusError_Participation_ID 7 - - // - ULONG MemoryHierarchyLevel; - #define MSMCAEvent_BusError_MemoryHierarchyLevel_SIZE sizeof(ULONG) - #define MSMCAEvent_BusError_MemoryHierarchyLevel_ID 8 - - // - ULONG RequestType; - #define MSMCAEvent_BusError_RequestType_SIZE sizeof(ULONG) - #define MSMCAEvent_BusError_RequestType_ID 9 - - // - ULONG MemOrIo; - #define MSMCAEvent_BusError_MemOrIo_SIZE sizeof(ULONG) - #define MSMCAEvent_BusError_MemOrIo_ID 10 - - // The address at which the error occurred. - ULONGLONG Address; - #define MSMCAEvent_BusError_Address_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_BusError_Address_ID 11 - - // - ULONG Size; - #define MSMCAEvent_BusError_Size_SIZE sizeof(ULONG) - #define MSMCAEvent_BusError_Size_ID 12 - - // - UCHAR RawRecord[1]; - #define MSMCAEvent_BusError_RawRecord_ID 13 - -} MSMCAEvent_BusError, *PMSMCAEvent_BusError; - -// MSMCAEvent_TLBError - MSMCAEvent_TLBError -#define MSMCAEvent_TLBErrorGuid \ - { 0xb161eeab,0xac03,0x4c2b, { 0xae,0x7a,0x5a,0x37,0x68,0xf7,0x0e,0x85 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_TLBError_GUID, \ - 0xb161eeab,0xac03,0x4c2b,0xae,0x7a,0x5a,0x37,0x68,0xf7,0x0e,0x85); -#endif - - -typedef struct _MSMCAEvent_TLBError -{ - // - ULONGLONG RecordId; - #define MSMCAEvent_TLBError_RecordId_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_TLBError_RecordId_ID 1 - - // - UCHAR ErrorSeverity; - #define MSMCAEvent_TLBError_ErrorSeverity_SIZE sizeof(UCHAR) - #define MSMCAEvent_TLBError_ErrorSeverity_ID 2 - - // - ULONG Type; - #define MSMCAEvent_TLBError_Type_SIZE sizeof(ULONG) - #define MSMCAEvent_TLBError_Type_ID 3 - - // - ULONG Cpu; - #define MSMCAEvent_TLBError_Cpu_SIZE sizeof(ULONG) - #define MSMCAEvent_TLBError_Cpu_ID 4 - - // - ULONG AdditionalErrors; - #define MSMCAEvent_TLBError_AdditionalErrors_SIZE sizeof(ULONG) - #define MSMCAEvent_TLBError_AdditionalErrors_ID 5 - - // - ULONG LogToEventlog; - #define MSMCAEvent_TLBError_LogToEventlog_SIZE sizeof(ULONG) - #define MSMCAEvent_TLBError_LogToEventlog_ID 6 - - // - ULONG TransactionType; - #define MSMCAEvent_TLBError_TransactionType_SIZE sizeof(ULONG) - #define MSMCAEvent_TLBError_TransactionType_ID 7 - - // - ULONG MemoryHierarchyLevel; - #define MSMCAEvent_TLBError_MemoryHierarchyLevel_SIZE sizeof(ULONG) - #define MSMCAEvent_TLBError_MemoryHierarchyLevel_ID 8 - - // The address at which the error occurred. - ULONGLONG Address; - #define MSMCAEvent_TLBError_Address_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_TLBError_Address_ID 9 - - // - ULONG Size; - #define MSMCAEvent_TLBError_Size_SIZE sizeof(ULONG) - #define MSMCAEvent_TLBError_Size_ID 10 - - // - UCHAR RawRecord[1]; - #define MSMCAEvent_TLBError_RawRecord_ID 11 - -} MSMCAEvent_TLBError, *PMSMCAEvent_TLBError; - -// MSMCAEvent_MemoryHierarchyError - MSMCAEvent_MemoryHierarchyError -#define MSMCAEvent_MemoryHierarchyErrorGuid \ - { 0xcede75a0,0xa77f,0x452b, { 0x8f,0x2f,0x54,0x1f,0x92,0x6d,0xb0,0xf9 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_MemoryHierarchyError_GUID, \ - 0xcede75a0,0xa77f,0x452b,0x8f,0x2f,0x54,0x1f,0x92,0x6d,0xb0,0xf9); -#endif - - -typedef struct _MSMCAEvent_MemoryHierarchyError -{ - // - ULONGLONG RecordId; - #define MSMCAEvent_MemoryHierarchyError_RecordId_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_MemoryHierarchyError_RecordId_ID 1 - - // - UCHAR ErrorSeverity; - #define MSMCAEvent_MemoryHierarchyError_ErrorSeverity_SIZE sizeof(UCHAR) - #define MSMCAEvent_MemoryHierarchyError_ErrorSeverity_ID 2 - - // - ULONG Type; - #define MSMCAEvent_MemoryHierarchyError_Type_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryHierarchyError_Type_ID 3 - - // - ULONG Cpu; - #define MSMCAEvent_MemoryHierarchyError_Cpu_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryHierarchyError_Cpu_ID 4 - - // - ULONG AdditionalErrors; - #define MSMCAEvent_MemoryHierarchyError_AdditionalErrors_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryHierarchyError_AdditionalErrors_ID 5 - - // - ULONG LogToEventlog; - #define MSMCAEvent_MemoryHierarchyError_LogToEventlog_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryHierarchyError_LogToEventlog_ID 6 - - // - ULONG TransactionType; - #define MSMCAEvent_MemoryHierarchyError_TransactionType_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryHierarchyError_TransactionType_ID 7 - - // - ULONG MemoryHierarchyLevel; - #define MSMCAEvent_MemoryHierarchyError_MemoryHierarchyLevel_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryHierarchyError_MemoryHierarchyLevel_ID 8 - - // - ULONG RequestType; - #define MSMCAEvent_MemoryHierarchyError_RequestType_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryHierarchyError_RequestType_ID 9 - - // The address at which the error occurred. - ULONGLONG Address; - #define MSMCAEvent_MemoryHierarchyError_Address_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_MemoryHierarchyError_Address_ID 10 - - // - ULONG Size; - #define MSMCAEvent_MemoryHierarchyError_Size_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryHierarchyError_Size_ID 11 - - // - UCHAR RawRecord[1]; - #define MSMCAEvent_MemoryHierarchyError_RawRecord_ID 12 - -} MSMCAEvent_MemoryHierarchyError, *PMSMCAEvent_MemoryHierarchyError; - -// MSMCAEvent_CPUError - MSMCAEvent_CPUError -#define MSMCAEvent_CPUErrorGuid \ - { 0x5ce27cde,0xd179,0x4c68, { 0x93,0x7f,0xa0,0x7b,0x8c,0xc2,0xea,0x39 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_CPUError_GUID, \ - 0x5ce27cde,0xd179,0x4c68,0x93,0x7f,0xa0,0x7b,0x8c,0xc2,0xea,0x39); -#endif - - -typedef struct _MSMCAEvent_CPUError -{ - // - ULONGLONG RecordId; - #define MSMCAEvent_CPUError_RecordId_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_CPUError_RecordId_ID 1 - - // - UCHAR ErrorSeverity; - #define MSMCAEvent_CPUError_ErrorSeverity_SIZE sizeof(UCHAR) - #define MSMCAEvent_CPUError_ErrorSeverity_ID 2 - - // - ULONG Type; - #define MSMCAEvent_CPUError_Type_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_Type_ID 3 - - // - ULONG Cpu; - #define MSMCAEvent_CPUError_Cpu_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_Cpu_ID 4 - - // - ULONG AdditionalErrors; - #define MSMCAEvent_CPUError_AdditionalErrors_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_AdditionalErrors_ID 5 - - // - ULONG LogToEventlog; - #define MSMCAEvent_CPUError_LogToEventlog_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_LogToEventlog_ID 6 - - -// Cache -#define MCACpuCacheError 0 -// TLB -#define MCACpuTlbError 1 -// Bus -#define MCACpuBusError 2 -// Register File -#define MCACpuRegFileError 3 -// Microarchitecture -#define MCACpuMSError 4 - - // - ULONG MajorErrorType; - #define MSMCAEvent_CPUError_MajorErrorType_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_MajorErrorType_ID 7 - - // - ULONG Level; - #define MSMCAEvent_CPUError_Level_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_Level_ID 8 - - // - ULONG CacheOp; - #define MSMCAEvent_CPUError_CacheOp_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_CacheOp_ID 9 - - // - ULONG CacheMesi; - #define MSMCAEvent_CPUError_CacheMesi_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_CacheMesi_ID 10 - - // - ULONG TLBOp; - #define MSMCAEvent_CPUError_TLBOp_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_TLBOp_ID 11 - - // - ULONG BusType; - #define MSMCAEvent_CPUError_BusType_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_BusType_ID 12 - - // - ULONG BusSev; - #define MSMCAEvent_CPUError_BusSev_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_BusSev_ID 13 - - // - ULONG RegFileId; - #define MSMCAEvent_CPUError_RegFileId_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_RegFileId_ID 14 - - // - ULONG RegFileOp; - #define MSMCAEvent_CPUError_RegFileOp_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_RegFileOp_ID 15 - - // - ULONG MSSid; - #define MSMCAEvent_CPUError_MSSid_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_MSSid_ID 16 - - // - ULONG MSOp; - #define MSMCAEvent_CPUError_MSOp_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_MSOp_ID 17 - - // - ULONG MSArrayId; - #define MSMCAEvent_CPUError_MSArrayId_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_MSArrayId_ID 18 - - // - ULONG MSIndex; - #define MSMCAEvent_CPUError_MSIndex_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_MSIndex_ID 19 - - // - ULONG Size; - #define MSMCAEvent_CPUError_Size_SIZE sizeof(ULONG) - #define MSMCAEvent_CPUError_Size_ID 20 - - // - UCHAR RawRecord[1]; - #define MSMCAEvent_CPUError_RawRecord_ID 21 - -} MSMCAEvent_CPUError, *PMSMCAEvent_CPUError; - -// MSMCAEvent_MemoryError - MSMCAEvent_MemoryError -#define MSMCAEvent_MemoryErrorGuid \ - { 0x433eea38,0xc1a7,0x48f1, { 0x88,0x4f,0xb6,0x87,0x5f,0x17,0x6c,0xc7 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_MemoryError_GUID, \ - 0x433eea38,0xc1a7,0x48f1,0x88,0x4f,0xb6,0x87,0x5f,0x17,0x6c,0xc7); -#endif - - -typedef struct _MSMCAEvent_MemoryError -{ - // - ULONGLONG RecordId; - #define MSMCAEvent_MemoryError_RecordId_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_MemoryError_RecordId_ID 1 - - // - UCHAR ErrorSeverity; - #define MSMCAEvent_MemoryError_ErrorSeverity_SIZE sizeof(UCHAR) - #define MSMCAEvent_MemoryError_ErrorSeverity_ID 2 - - // - ULONG Type; - #define MSMCAEvent_MemoryError_Type_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryError_Type_ID 3 - - // - ULONG Cpu; - #define MSMCAEvent_MemoryError_Cpu_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryError_Cpu_ID 4 - - // - ULONG AdditionalErrors; - #define MSMCAEvent_MemoryError_AdditionalErrors_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryError_AdditionalErrors_ID 5 - - // - ULONG LogToEventlog; - #define MSMCAEvent_MemoryError_LogToEventlog_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryError_LogToEventlog_ID 6 - - // - ULONGLONG VALIDATION_BITS; - #define MSMCAEvent_MemoryError_VALIDATION_BITS_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_MemoryError_VALIDATION_BITS_ID 7 - - // - ULONGLONG MEM_ERROR_STATUS; - #define MSMCAEvent_MemoryError_MEM_ERROR_STATUS_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_MemoryError_MEM_ERROR_STATUS_ID 8 - - // - ULONGLONG MEM_PHYSICAL_ADDR; - #define MSMCAEvent_MemoryError_MEM_PHYSICAL_ADDR_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_MemoryError_MEM_PHYSICAL_ADDR_ID 9 - - // - ULONGLONG MEM_PHYSICAL_MASK; - #define MSMCAEvent_MemoryError_MEM_PHYSICAL_MASK_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_MemoryError_MEM_PHYSICAL_MASK_ID 10 - - // - ULONGLONG RESPONDER_ID; - #define MSMCAEvent_MemoryError_RESPONDER_ID_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_MemoryError_RESPONDER_ID_ID 11 - - // - ULONGLONG TARGET_ID; - #define MSMCAEvent_MemoryError_TARGET_ID_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_MemoryError_TARGET_ID_ID 12 - - // - ULONGLONG REQUESTOR_ID; - #define MSMCAEvent_MemoryError_REQUESTOR_ID_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_MemoryError_REQUESTOR_ID_ID 13 - - // - ULONGLONG BUS_SPECIFIC_DATA; - #define MSMCAEvent_MemoryError_BUS_SPECIFIC_DATA_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_MemoryError_BUS_SPECIFIC_DATA_ID 14 - - // - USHORT MEM_NODE; - #define MSMCAEvent_MemoryError_MEM_NODE_SIZE sizeof(USHORT) - #define MSMCAEvent_MemoryError_MEM_NODE_ID 15 - - // - USHORT MEM_CARD; - #define MSMCAEvent_MemoryError_MEM_CARD_SIZE sizeof(USHORT) - #define MSMCAEvent_MemoryError_MEM_CARD_ID 16 - - // - USHORT MEM_BANK; - #define MSMCAEvent_MemoryError_MEM_BANK_SIZE sizeof(USHORT) - #define MSMCAEvent_MemoryError_MEM_BANK_ID 17 - - // - USHORT xMEM_DEVICE; - #define MSMCAEvent_MemoryError_xMEM_DEVICE_SIZE sizeof(USHORT) - #define MSMCAEvent_MemoryError_xMEM_DEVICE_ID 18 - - // - USHORT MEM_MODULE; - #define MSMCAEvent_MemoryError_MEM_MODULE_SIZE sizeof(USHORT) - #define MSMCAEvent_MemoryError_MEM_MODULE_ID 19 - - // - USHORT MEM_ROW; - #define MSMCAEvent_MemoryError_MEM_ROW_SIZE sizeof(USHORT) - #define MSMCAEvent_MemoryError_MEM_ROW_ID 20 - - // - USHORT MEM_COLUMN; - #define MSMCAEvent_MemoryError_MEM_COLUMN_SIZE sizeof(USHORT) - #define MSMCAEvent_MemoryError_MEM_COLUMN_ID 21 - - // - USHORT MEM_BIT_POSITION; - #define MSMCAEvent_MemoryError_MEM_BIT_POSITION_SIZE sizeof(USHORT) - #define MSMCAEvent_MemoryError_MEM_BIT_POSITION_ID 22 - - // - ULONG Size; - #define MSMCAEvent_MemoryError_Size_SIZE sizeof(ULONG) - #define MSMCAEvent_MemoryError_Size_ID 23 - - // - UCHAR RawRecord[1]; - #define MSMCAEvent_MemoryError_RawRecord_ID 24 - -} MSMCAEvent_MemoryError, *PMSMCAEvent_MemoryError; - -// MSMCAEvent_PCIBusError - MSMCAEvent_PCIBusError -#define MSMCAEvent_PCIBusErrorGuid \ - { 0xa14a5594,0x25de,0x410e, { 0x9b,0x92,0x80,0xf0,0x80,0x1a,0xec,0x07 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_PCIBusError_GUID, \ - 0xa14a5594,0x25de,0x410e,0x9b,0x92,0x80,0xf0,0x80,0x1a,0xec,0x07); -#endif - - -typedef struct _MSMCAEvent_PCIBusError -{ - // - ULONGLONG RecordId; - #define MSMCAEvent_PCIBusError_RecordId_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PCIBusError_RecordId_ID 1 - - // - UCHAR ErrorSeverity; - #define MSMCAEvent_PCIBusError_ErrorSeverity_SIZE sizeof(UCHAR) - #define MSMCAEvent_PCIBusError_ErrorSeverity_ID 2 - - // - ULONG Type; - #define MSMCAEvent_PCIBusError_Type_SIZE sizeof(ULONG) - #define MSMCAEvent_PCIBusError_Type_ID 3 - - // - ULONG Cpu; - #define MSMCAEvent_PCIBusError_Cpu_SIZE sizeof(ULONG) - #define MSMCAEvent_PCIBusError_Cpu_ID 4 - - // - ULONG AdditionalErrors; - #define MSMCAEvent_PCIBusError_AdditionalErrors_SIZE sizeof(ULONG) - #define MSMCAEvent_PCIBusError_AdditionalErrors_ID 5 - - // - ULONG LogToEventlog; - #define MSMCAEvent_PCIBusError_LogToEventlog_SIZE sizeof(ULONG) - #define MSMCAEvent_PCIBusError_LogToEventlog_ID 6 - - // - ULONGLONG VALIDATION_BITS; - #define MSMCAEvent_PCIBusError_VALIDATION_BITS_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PCIBusError_VALIDATION_BITS_ID 7 - - // - ULONGLONG PCI_BUS_ERROR_STATUS; - #define MSMCAEvent_PCIBusError_PCI_BUS_ERROR_STATUS_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PCIBusError_PCI_BUS_ERROR_STATUS_ID 8 - - // - ULONGLONG PCI_BUS_ADDRESS; - #define MSMCAEvent_PCIBusError_PCI_BUS_ADDRESS_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PCIBusError_PCI_BUS_ADDRESS_ID 9 - - // - ULONGLONG PCI_BUS_DATA; - #define MSMCAEvent_PCIBusError_PCI_BUS_DATA_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PCIBusError_PCI_BUS_DATA_ID 10 - - // - ULONGLONG PCI_BUS_CMD; - #define MSMCAEvent_PCIBusError_PCI_BUS_CMD_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PCIBusError_PCI_BUS_CMD_ID 11 - - // - ULONGLONG PCI_BUS_REQUESTOR_ID; - #define MSMCAEvent_PCIBusError_PCI_BUS_REQUESTOR_ID_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PCIBusError_PCI_BUS_REQUESTOR_ID_ID 12 - - // - ULONGLONG PCI_BUS_RESPONDER_ID; - #define MSMCAEvent_PCIBusError_PCI_BUS_RESPONDER_ID_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PCIBusError_PCI_BUS_RESPONDER_ID_ID 13 - - // - ULONGLONG PCI_BUS_TARGET_ID; - #define MSMCAEvent_PCIBusError_PCI_BUS_TARGET_ID_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PCIBusError_PCI_BUS_TARGET_ID_ID 14 - - // - USHORT PCI_BUS_ERROR_TYPE; - #define MSMCAEvent_PCIBusError_PCI_BUS_ERROR_TYPE_SIZE sizeof(USHORT) - #define MSMCAEvent_PCIBusError_PCI_BUS_ERROR_TYPE_ID 15 - - // - UCHAR PCI_BUS_ID_BusNumber; - #define MSMCAEvent_PCIBusError_PCI_BUS_ID_BusNumber_SIZE sizeof(UCHAR) - #define MSMCAEvent_PCIBusError_PCI_BUS_ID_BusNumber_ID 16 - - // - UCHAR PCI_BUS_ID_SegmentNumber; - #define MSMCAEvent_PCIBusError_PCI_BUS_ID_SegmentNumber_SIZE sizeof(UCHAR) - #define MSMCAEvent_PCIBusError_PCI_BUS_ID_SegmentNumber_ID 17 - - // - ULONG Size; - #define MSMCAEvent_PCIBusError_Size_SIZE sizeof(ULONG) - #define MSMCAEvent_PCIBusError_Size_ID 18 - - // - UCHAR RawRecord[1]; - #define MSMCAEvent_PCIBusError_RawRecord_ID 19 - -} MSMCAEvent_PCIBusError, *PMSMCAEvent_PCIBusError; - -// MSMCAEvent_PCIComponentError - MSMCAEvent_PCIComponentError -#define MSMCAEvent_PCIComponentErrorGuid \ - { 0x805caf4e,0x336c,0x4eb2, { 0x8c,0x0c,0x02,0xf3,0x51,0xcb,0xf1,0x3c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_PCIComponentError_GUID, \ - 0x805caf4e,0x336c,0x4eb2,0x8c,0x0c,0x02,0xf3,0x51,0xcb,0xf1,0x3c); -#endif - - -typedef struct _MSMCAEvent_PCIComponentError -{ - // - ULONGLONG RecordId; - #define MSMCAEvent_PCIComponentError_RecordId_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PCIComponentError_RecordId_ID 1 - - // - UCHAR ErrorSeverity; - #define MSMCAEvent_PCIComponentError_ErrorSeverity_SIZE sizeof(UCHAR) - #define MSMCAEvent_PCIComponentError_ErrorSeverity_ID 2 - - // - ULONG Type; - #define MSMCAEvent_PCIComponentError_Type_SIZE sizeof(ULONG) - #define MSMCAEvent_PCIComponentError_Type_ID 3 - - // - ULONG Cpu; - #define MSMCAEvent_PCIComponentError_Cpu_SIZE sizeof(ULONG) - #define MSMCAEvent_PCIComponentError_Cpu_ID 4 - - // - ULONG AdditionalErrors; - #define MSMCAEvent_PCIComponentError_AdditionalErrors_SIZE sizeof(ULONG) - #define MSMCAEvent_PCIComponentError_AdditionalErrors_ID 5 - - // - ULONG LogToEventlog; - #define MSMCAEvent_PCIComponentError_LogToEventlog_SIZE sizeof(ULONG) - #define MSMCAEvent_PCIComponentError_LogToEventlog_ID 6 - - // - ULONGLONG VALIDATION_BITS; - #define MSMCAEvent_PCIComponentError_VALIDATION_BITS_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PCIComponentError_VALIDATION_BITS_ID 7 - - // - ULONGLONG PCI_COMP_ERROR_STATUS; - #define MSMCAEvent_PCIComponentError_PCI_COMP_ERROR_STATUS_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PCIComponentError_PCI_COMP_ERROR_STATUS_ID 8 - - // - USHORT PCI_COMP_INFO_VendorId; - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_VendorId_SIZE sizeof(USHORT) - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_VendorId_ID 9 - - // - USHORT PCI_COMP_INFO_DeviceId; - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_DeviceId_SIZE sizeof(USHORT) - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_DeviceId_ID 10 - - // - UCHAR PCI_COMP_INFO_ClassCodeInterface; - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_ClassCodeInterface_SIZE sizeof(UCHAR) - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_ClassCodeInterface_ID 11 - - // - UCHAR PCI_COMP_INFO_ClassCodeSubClass; - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_ClassCodeSubClass_SIZE sizeof(UCHAR) - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_ClassCodeSubClass_ID 12 - - // - UCHAR PCI_COMP_INFO_ClassCodeBaseClass; - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_ClassCodeBaseClass_SIZE sizeof(UCHAR) - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_ClassCodeBaseClass_ID 13 - - // - UCHAR PCI_COMP_INFO_FunctionNumber; - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_FunctionNumber_SIZE sizeof(UCHAR) - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_FunctionNumber_ID 14 - - // - UCHAR PCI_COMP_INFO_DeviceNumber; - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_DeviceNumber_SIZE sizeof(UCHAR) - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_DeviceNumber_ID 15 - - // - UCHAR PCI_COMP_INFO_BusNumber; - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_BusNumber_SIZE sizeof(UCHAR) - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_BusNumber_ID 16 - - // - UCHAR PCI_COMP_INFO_SegmentNumber; - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_SegmentNumber_SIZE sizeof(UCHAR) - #define MSMCAEvent_PCIComponentError_PCI_COMP_INFO_SegmentNumber_ID 17 - - // - ULONG Size; - #define MSMCAEvent_PCIComponentError_Size_SIZE sizeof(ULONG) - #define MSMCAEvent_PCIComponentError_Size_ID 18 - - // - UCHAR RawRecord[1]; - #define MSMCAEvent_PCIComponentError_RawRecord_ID 19 - -} MSMCAEvent_PCIComponentError, *PMSMCAEvent_PCIComponentError; - -// MSMCAEvent_SystemEventError - MSMCAEvent_SystemEventError -#define MSMCAEvent_SystemEventErrorGuid \ - { 0xbdba4b12,0x8d00,0x4570, { 0xb9,0xb2,0x3f,0xde,0xcf,0x1d,0x56,0x61 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_SystemEventError_GUID, \ - 0xbdba4b12,0x8d00,0x4570,0xb9,0xb2,0x3f,0xde,0xcf,0x1d,0x56,0x61); -#endif - - -typedef struct _MSMCAEvent_SystemEventError -{ - // - ULONGLONG RecordId; - #define MSMCAEvent_SystemEventError_RecordId_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_SystemEventError_RecordId_ID 1 - - // - UCHAR ErrorSeverity; - #define MSMCAEvent_SystemEventError_ErrorSeverity_SIZE sizeof(UCHAR) - #define MSMCAEvent_SystemEventError_ErrorSeverity_ID 2 - - // - ULONG Type; - #define MSMCAEvent_SystemEventError_Type_SIZE sizeof(ULONG) - #define MSMCAEvent_SystemEventError_Type_ID 3 - - // - ULONG Cpu; - #define MSMCAEvent_SystemEventError_Cpu_SIZE sizeof(ULONG) - #define MSMCAEvent_SystemEventError_Cpu_ID 4 - - // - ULONG AdditionalErrors; - #define MSMCAEvent_SystemEventError_AdditionalErrors_SIZE sizeof(ULONG) - #define MSMCAEvent_SystemEventError_AdditionalErrors_ID 5 - - // - ULONG LogToEventlog; - #define MSMCAEvent_SystemEventError_LogToEventlog_SIZE sizeof(ULONG) - #define MSMCAEvent_SystemEventError_LogToEventlog_ID 6 - - // - ULONGLONG VALIDATION_BITS; - #define MSMCAEvent_SystemEventError_VALIDATION_BITS_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_SystemEventError_VALIDATION_BITS_ID 7 - - // - ULONGLONG SEL_TIME_STAMP; - #define MSMCAEvent_SystemEventError_SEL_TIME_STAMP_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_SystemEventError_SEL_TIME_STAMP_ID 8 - - // - USHORT SEL_RECORD_ID; - #define MSMCAEvent_SystemEventError_SEL_RECORD_ID_SIZE sizeof(USHORT) - #define MSMCAEvent_SystemEventError_SEL_RECORD_ID_ID 9 - - // - USHORT SEL_GENERATOR_ID; - #define MSMCAEvent_SystemEventError_SEL_GENERATOR_ID_SIZE sizeof(USHORT) - #define MSMCAEvent_SystemEventError_SEL_GENERATOR_ID_ID 10 - - // - UCHAR SEL_RECORD_TYPE; - #define MSMCAEvent_SystemEventError_SEL_RECORD_TYPE_SIZE sizeof(UCHAR) - #define MSMCAEvent_SystemEventError_SEL_RECORD_TYPE_ID 11 - - // - UCHAR SEL_EVM_REV; - #define MSMCAEvent_SystemEventError_SEL_EVM_REV_SIZE sizeof(UCHAR) - #define MSMCAEvent_SystemEventError_SEL_EVM_REV_ID 12 - - // - UCHAR SEL_SENSOR_TYPE; - #define MSMCAEvent_SystemEventError_SEL_SENSOR_TYPE_SIZE sizeof(UCHAR) - #define MSMCAEvent_SystemEventError_SEL_SENSOR_TYPE_ID 13 - - // - UCHAR SEL_SENSOR_NUM; - #define MSMCAEvent_SystemEventError_SEL_SENSOR_NUM_SIZE sizeof(UCHAR) - #define MSMCAEvent_SystemEventError_SEL_SENSOR_NUM_ID 14 - - // - UCHAR SEL_EVENT_DIR_TYPE; - #define MSMCAEvent_SystemEventError_SEL_EVENT_DIR_TYPE_SIZE sizeof(UCHAR) - #define MSMCAEvent_SystemEventError_SEL_EVENT_DIR_TYPE_ID 15 - - // - UCHAR SEL_DATA1; - #define MSMCAEvent_SystemEventError_SEL_DATA1_SIZE sizeof(UCHAR) - #define MSMCAEvent_SystemEventError_SEL_DATA1_ID 16 - - // - UCHAR SEL_DATA2; - #define MSMCAEvent_SystemEventError_SEL_DATA2_SIZE sizeof(UCHAR) - #define MSMCAEvent_SystemEventError_SEL_DATA2_ID 17 - - // - UCHAR SEL_DATA3; - #define MSMCAEvent_SystemEventError_SEL_DATA3_SIZE sizeof(UCHAR) - #define MSMCAEvent_SystemEventError_SEL_DATA3_ID 18 - - // - ULONG Size; - #define MSMCAEvent_SystemEventError_Size_SIZE sizeof(ULONG) - #define MSMCAEvent_SystemEventError_Size_ID 19 - - // - UCHAR RawRecord[1]; - #define MSMCAEvent_SystemEventError_RawRecord_ID 20 - -} MSMCAEvent_SystemEventError, *PMSMCAEvent_SystemEventError; - -// MSMCAEvent_SMBIOSError - MSMCAEvent_SMBIOSError -#define MSMCAEvent_SMBIOSErrorGuid \ - { 0x4184df1b,0xedfe,0x406b, { 0xb1,0x72,0x54,0xc9,0x1f,0xbd,0x9b,0xaf } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_SMBIOSError_GUID, \ - 0x4184df1b,0xedfe,0x406b,0xb1,0x72,0x54,0xc9,0x1f,0xbd,0x9b,0xaf); -#endif - - -typedef struct _MSMCAEvent_SMBIOSError -{ - // - ULONGLONG RecordId; - #define MSMCAEvent_SMBIOSError_RecordId_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_SMBIOSError_RecordId_ID 1 - - // - UCHAR ErrorSeverity; - #define MSMCAEvent_SMBIOSError_ErrorSeverity_SIZE sizeof(UCHAR) - #define MSMCAEvent_SMBIOSError_ErrorSeverity_ID 2 - - // - ULONG Type; - #define MSMCAEvent_SMBIOSError_Type_SIZE sizeof(ULONG) - #define MSMCAEvent_SMBIOSError_Type_ID 3 - - // - ULONG Cpu; - #define MSMCAEvent_SMBIOSError_Cpu_SIZE sizeof(ULONG) - #define MSMCAEvent_SMBIOSError_Cpu_ID 4 - - // - ULONG AdditionalErrors; - #define MSMCAEvent_SMBIOSError_AdditionalErrors_SIZE sizeof(ULONG) - #define MSMCAEvent_SMBIOSError_AdditionalErrors_ID 5 - - // - ULONG LogToEventlog; - #define MSMCAEvent_SMBIOSError_LogToEventlog_SIZE sizeof(ULONG) - #define MSMCAEvent_SMBIOSError_LogToEventlog_ID 6 - - // - ULONGLONG VALIDATION_BITS; - #define MSMCAEvent_SMBIOSError_VALIDATION_BITS_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_SMBIOSError_VALIDATION_BITS_ID 7 - - // - UCHAR SMBIOS_EVENT_TYPE; - #define MSMCAEvent_SMBIOSError_SMBIOS_EVENT_TYPE_SIZE sizeof(UCHAR) - #define MSMCAEvent_SMBIOSError_SMBIOS_EVENT_TYPE_ID 8 - - // - ULONG Size; - #define MSMCAEvent_SMBIOSError_Size_SIZE sizeof(ULONG) - #define MSMCAEvent_SMBIOSError_Size_ID 9 - - // - UCHAR RawRecord[1]; - #define MSMCAEvent_SMBIOSError_RawRecord_ID 10 - -} MSMCAEvent_SMBIOSError, *PMSMCAEvent_SMBIOSError; - -// MSMCAEvent_PlatformSpecificError - MSMCAEvent_PlatformSpecificError -#define MSMCAEvent_PlatformSpecificErrorGuid \ - { 0x2d2434aa,0xef83,0x4200, { 0xba,0x24,0xde,0x36,0x6c,0x41,0x5f,0x7b } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_PlatformSpecificError_GUID, \ - 0x2d2434aa,0xef83,0x4200,0xba,0x24,0xde,0x36,0x6c,0x41,0x5f,0x7b); -#endif - - -typedef struct _MSMCAEvent_PlatformSpecificError -{ - // - ULONGLONG RecordId; - #define MSMCAEvent_PlatformSpecificError_RecordId_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PlatformSpecificError_RecordId_ID 1 - - // - UCHAR ErrorSeverity; - #define MSMCAEvent_PlatformSpecificError_ErrorSeverity_SIZE sizeof(UCHAR) - #define MSMCAEvent_PlatformSpecificError_ErrorSeverity_ID 2 - - // - ULONG Type; - #define MSMCAEvent_PlatformSpecificError_Type_SIZE sizeof(ULONG) - #define MSMCAEvent_PlatformSpecificError_Type_ID 3 - - // - ULONG Cpu; - #define MSMCAEvent_PlatformSpecificError_Cpu_SIZE sizeof(ULONG) - #define MSMCAEvent_PlatformSpecificError_Cpu_ID 4 - - // - ULONG AdditionalErrors; - #define MSMCAEvent_PlatformSpecificError_AdditionalErrors_SIZE sizeof(ULONG) - #define MSMCAEvent_PlatformSpecificError_AdditionalErrors_ID 5 - - // - ULONG LogToEventlog; - #define MSMCAEvent_PlatformSpecificError_LogToEventlog_SIZE sizeof(ULONG) - #define MSMCAEvent_PlatformSpecificError_LogToEventlog_ID 6 - - // - ULONGLONG VALIDATION_BITS; - #define MSMCAEvent_PlatformSpecificError_VALIDATION_BITS_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PlatformSpecificError_VALIDATION_BITS_ID 7 - - // - ULONGLONG PLATFORM_ERROR_STATUS; - #define MSMCAEvent_PlatformSpecificError_PLATFORM_ERROR_STATUS_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PlatformSpecificError_PLATFORM_ERROR_STATUS_ID 8 - - // - ULONGLONG PLATFORM_REQUESTOR_ID; - #define MSMCAEvent_PlatformSpecificError_PLATFORM_REQUESTOR_ID_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PlatformSpecificError_PLATFORM_REQUESTOR_ID_ID 9 - - // - ULONGLONG PLATFORM_RESPONDER_ID; - #define MSMCAEvent_PlatformSpecificError_PLATFORM_RESPONDER_ID_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PlatformSpecificError_PLATFORM_RESPONDER_ID_ID 10 - - // - ULONGLONG PLATFORM_TARGET_ID; - #define MSMCAEvent_PlatformSpecificError_PLATFORM_TARGET_ID_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PlatformSpecificError_PLATFORM_TARGET_ID_ID 11 - - // - ULONGLONG PLATFORM_BUS_SPECIFIC_DATA; - #define MSMCAEvent_PlatformSpecificError_PLATFORM_BUS_SPECIFIC_DATA_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_PlatformSpecificError_PLATFORM_BUS_SPECIFIC_DATA_ID 12 - - // - UCHAR OEM_COMPONENT_ID[16]; - #define MSMCAEvent_PlatformSpecificError_OEM_COMPONENT_ID_SIZE sizeof(UCHAR[16]) - #define MSMCAEvent_PlatformSpecificError_OEM_COMPONENT_ID_ID 13 - - // - ULONG Size; - #define MSMCAEvent_PlatformSpecificError_Size_SIZE sizeof(ULONG) - #define MSMCAEvent_PlatformSpecificError_Size_ID 14 - - // - UCHAR RawRecord[1]; - #define MSMCAEvent_PlatformSpecificError_RawRecord_ID 15 - -} MSMCAEvent_PlatformSpecificError, *PMSMCAEvent_PlatformSpecificError; - -// MSMCAEvent_InvalidError - MSMCAEvent_InvalidError -#define MSMCAEvent_InvalidErrorGuid \ - { 0x477b769b,0x785c,0x48dd, { 0xa0,0x2e,0x57,0xe0,0x51,0xbe,0x7b,0x85 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_InvalidError_GUID, \ - 0x477b769b,0x785c,0x48dd,0xa0,0x2e,0x57,0xe0,0x51,0xbe,0x7b,0x85); -#endif - - -typedef struct _MSMCAEvent_InvalidError -{ - // - ULONGLONG RecordId; - #define MSMCAEvent_InvalidError_RecordId_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_InvalidError_RecordId_ID 1 - - // - UCHAR ErrorSeverity; - #define MSMCAEvent_InvalidError_ErrorSeverity_SIZE sizeof(UCHAR) - #define MSMCAEvent_InvalidError_ErrorSeverity_ID 2 - - // - ULONG Type; - #define MSMCAEvent_InvalidError_Type_SIZE sizeof(ULONG) - #define MSMCAEvent_InvalidError_Type_ID 3 - - // - ULONG Cpu; - #define MSMCAEvent_InvalidError_Cpu_SIZE sizeof(ULONG) - #define MSMCAEvent_InvalidError_Cpu_ID 4 - - // - ULONG AdditionalErrors; - #define MSMCAEvent_InvalidError_AdditionalErrors_SIZE sizeof(ULONG) - #define MSMCAEvent_InvalidError_AdditionalErrors_ID 5 - - // - ULONG LogToEventlog; - #define MSMCAEvent_InvalidError_LogToEventlog_SIZE sizeof(ULONG) - #define MSMCAEvent_InvalidError_LogToEventlog_ID 6 - - // - ULONG Size; - #define MSMCAEvent_InvalidError_Size_SIZE sizeof(ULONG) - #define MSMCAEvent_InvalidError_Size_ID 7 - - // - UCHAR RawRecord[1]; - #define MSMCAEvent_InvalidError_RawRecord_ID 8 - -} MSMCAEvent_InvalidError, *PMSMCAEvent_InvalidError; - -// MSMCAEvent_MemoryPageRemoved - MSMCAEvent_MemoryPageRemoved -#define MSMCAEvent_MemoryPageRemovedGuid \ - { 0x84e9ddb6,0xe233,0x4dfc, { 0x98,0x8c,0x74,0x12,0xc8,0x75,0x4f,0xec } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAEvent_MemoryPageRemoved_GUID, \ - 0x84e9ddb6,0xe233,0x4dfc,0x98,0x8c,0x74,0x12,0xc8,0x75,0x4f,0xec); -#endif - - -typedef struct _MSMCAEvent_MemoryPageRemoved -{ - // - ULONGLONG PhysicalAddress; - #define MSMCAEvent_MemoryPageRemoved_PhysicalAddress_SIZE sizeof(ULONGLONG) - #define MSMCAEvent_MemoryPageRemoved_PhysicalAddress_ID 1 - -} MSMCAEvent_MemoryPageRemoved, *PMSMCAEvent_MemoryPageRemoved; - -#define MSMCAEvent_MemoryPageRemoved_SIZE (FIELD_OFFSET(MSMCAEvent_MemoryPageRemoved, PhysicalAddress) + MSMCAEvent_MemoryPageRemoved_PhysicalAddress_SIZE) - -// MSMCAInfo_Entry - MSMCAInfo_Entry -#define MSMCAInfo_EntryGuid \ - { 0x9e77a308,0x6b82,0x4fc1, { 0xab,0x41,0x0a,0x55,0x86,0x7c,0x35,0xc2 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAInfo_Entry_GUID, \ - 0x9e77a308,0x6b82,0x4fc1,0xab,0x41,0x0a,0x55,0x86,0x7c,0x35,0xc2); -#endif - - -typedef struct _MSMCAInfo_Entry -{ - // - ULONG Length; - #define MSMCAInfo_Entry_Length_SIZE sizeof(ULONG) - #define MSMCAInfo_Entry_Length_ID 1 - - // - UCHAR Data[1]; - #define MSMCAInfo_Entry_Data_ID 2 - -} MSMCAInfo_Entry, *PMSMCAInfo_Entry; - -// MSMCAInfo_RawMCAData - MSMCAInfo_RawMCAData -#define MSMCAInfo_RawMCADataGuid \ - { 0x23602a8a,0xdadd,0x462f, { 0x9a,0xe5,0x30,0xfa,0x2c,0x37,0xdd,0x5b } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAInfo_RawMCAData_GUID, \ - 0x23602a8a,0xdadd,0x462f,0x9a,0xe5,0x30,0xfa,0x2c,0x37,0xdd,0x5b); -#endif - - -typedef struct _MSMCAInfo_RawMCAData -{ - // - ULONG Count; - #define MSMCAInfo_RawMCAData_Count_SIZE sizeof(ULONG) - #define MSMCAInfo_RawMCAData_Count_ID 1 - - // - MSMCAInfo_Entry Records[1]; - #define MSMCAInfo_RawMCAData_Records_ID 2 - -} MSMCAInfo_RawMCAData, *PMSMCAInfo_RawMCAData; - -// MSMCAInfo_RawCMCEvent - MSMCAInfo_RawCMCEvent -#define MSMCAInfo_RawCMCEventGuid \ - { 0x2f1a8a9d,0x7988,0x457f, { 0xa1,0x7a,0x89,0x79,0xe8,0x20,0x43,0xc5 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAInfo_RawCMCEvent_GUID, \ - 0x2f1a8a9d,0x7988,0x457f,0xa1,0x7a,0x89,0x79,0xe8,0x20,0x43,0xc5); -#endif - - -typedef struct _MSMCAInfo_RawCMCEvent -{ - // - ULONG Count; - #define MSMCAInfo_RawCMCEvent_Count_SIZE sizeof(ULONG) - #define MSMCAInfo_RawCMCEvent_Count_ID 1 - - // - MSMCAInfo_Entry Records[1]; - #define MSMCAInfo_RawCMCEvent_Records_ID 2 - -} MSMCAInfo_RawCMCEvent, *PMSMCAInfo_RawCMCEvent; - -// MSMCAInfo_RawMCAEvent - MSMCAInfo_RawMCAEvent -#define MSMCAInfo_RawMCAEventGuid \ - { 0x2f1a8a9f,0x7988,0x457f, { 0xa1,0x7a,0x89,0x79,0xe8,0x20,0x43,0xc5 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAInfo_RawMCAEvent_GUID, \ - 0x2f1a8a9f,0x7988,0x457f,0xa1,0x7a,0x89,0x79,0xe8,0x20,0x43,0xc5); -#endif - - -typedef struct _MSMCAInfo_RawMCAEvent -{ - // - ULONG Count; - #define MSMCAInfo_RawMCAEvent_Count_SIZE sizeof(ULONG) - #define MSMCAInfo_RawMCAEvent_Count_ID 1 - - // - MSMCAInfo_Entry Records[1]; - #define MSMCAInfo_RawMCAEvent_Records_ID 2 - -} MSMCAInfo_RawMCAEvent, *PMSMCAInfo_RawMCAEvent; - -// MSMCAInfo_RawCorrectedPlatformEvent - MSMCAInfo_RawCorrectedPlatformEvent -#define MSMCAInfo_RawCorrectedPlatformEventGuid \ - { 0x6b629d5e,0xe63c,0x48a3, { 0x9e,0xbb,0x97,0x42,0x27,0x07,0x52,0x65 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMCAInfo_RawCorrectedPlatformEvent_GUID, \ - 0x6b629d5e,0xe63c,0x48a3,0x9e,0xbb,0x97,0x42,0x27,0x07,0x52,0x65); -#endif - - -typedef struct _MSMCAInfo_RawCorrectedPlatformEvent -{ - // - ULONG Count; - #define MSMCAInfo_RawCorrectedPlatformEvent_Count_SIZE sizeof(ULONG) - #define MSMCAInfo_RawCorrectedPlatformEvent_Count_ID 1 - - // - MSMCAInfo_Entry Records[1]; - #define MSMCAInfo_RawCorrectedPlatformEvent_Records_ID 2 - -} MSMCAInfo_RawCorrectedPlatformEvent, *PMSMCAInfo_RawCorrectedPlatformEvent; - -// MSPower_DeviceEnable - MSPower_DeviceEnable -#define MSPower_DeviceEnableGuid \ - { 0x827c0a6f,0xfeb0,0x11d0, { 0xbd,0x26,0x00,0xaa,0x00,0xb7,0xb3,0x2a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSPower_DeviceEnable_GUID, \ - 0x827c0a6f,0xfeb0,0x11d0,0xbd,0x26,0x00,0xaa,0x00,0xb7,0xb3,0x2a); -#endif - - -typedef struct _MSPower_DeviceEnable -{ - // - BOOLEAN Enable; - #define MSPower_DeviceEnable_Enable_SIZE sizeof(BOOLEAN) - #define MSPower_DeviceEnable_Enable_ID 1 - -} MSPower_DeviceEnable, *PMSPower_DeviceEnable; - -#define MSPower_DeviceEnable_SIZE (FIELD_OFFSET(MSPower_DeviceEnable, Enable) + MSPower_DeviceEnable_Enable_SIZE) - -// MSPower_DeviceWakeEnable - MSPower_DeviceWakeEnable -#define MSPower_DeviceWakeEnableGuid \ - { 0xa9546a82,0xfeb0,0x11d0, { 0xbd,0x26,0x00,0xaa,0x00,0xb7,0xb3,0x2a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSPower_DeviceWakeEnable_GUID, \ - 0xa9546a82,0xfeb0,0x11d0,0xbd,0x26,0x00,0xaa,0x00,0xb7,0xb3,0x2a); -#endif - - -typedef struct _MSPower_DeviceWakeEnable -{ - // - BOOLEAN Enable; - #define MSPower_DeviceWakeEnable_Enable_SIZE sizeof(BOOLEAN) - #define MSPower_DeviceWakeEnable_Enable_ID 1 - -} MSPower_DeviceWakeEnable, *PMSPower_DeviceWakeEnable; - -#define MSPower_DeviceWakeEnable_SIZE (FIELD_OFFSET(MSPower_DeviceWakeEnable, Enable) + MSPower_DeviceWakeEnable_Enable_SIZE) - -// MSNdis_NetworkAddress - MSNdis_NetworkAddress -#define MSNdis_NetworkAddressGuid \ - { 0xb5bd98b7,0x0201,0x11d1, { 0xa5,0x0e,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_NetworkAddress_GUID, \ - 0xb5bd98b7,0x0201,0x11d1,0xa5,0x0e,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSNdis_NetworkAddress -{ - // - UCHAR Address[6]; - #define MSNdis_NetworkAddress_Address_SIZE sizeof(UCHAR[6]) - #define MSNdis_NetworkAddress_Address_ID 1 - -} MSNdis_NetworkAddress, *PMSNdis_NetworkAddress; - -#define MSNdis_NetworkAddress_SIZE (FIELD_OFFSET(MSNdis_NetworkAddress, Address) + MSNdis_NetworkAddress_Address_SIZE) - -// MSNdis_NetworkShortAddress - MSNdis_NetworkShortAddress -#define MSNdis_NetworkShortAddressGuid \ - { 0xb5bd98b8,0x0201,0x11d1, { 0xa5,0x0e,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_NetworkShortAddress_GUID, \ - 0xb5bd98b8,0x0201,0x11d1,0xa5,0x0e,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSNdis_NetworkShortAddress -{ - // - UCHAR Address[2]; - #define MSNdis_NetworkShortAddress_Address_SIZE sizeof(UCHAR[2]) - #define MSNdis_NetworkShortAddress_Address_ID 1 - -} MSNdis_NetworkShortAddress, *PMSNdis_NetworkShortAddress; - -#define MSNdis_NetworkShortAddress_SIZE (FIELD_OFFSET(MSNdis_NetworkShortAddress, Address) + MSNdis_NetworkShortAddress_Address_SIZE) - -// MSNdis_NetworkLinkSpeed - MSNdis_NetworkLinkSpeed -#define MSNdis_NetworkLinkSpeedGuid \ - { 0x60fc6b57,0x0f66,0x11d1, { 0x96,0xa7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_NetworkLinkSpeed_GUID, \ - 0x60fc6b57,0x0f66,0x11d1,0x96,0xa7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_NetworkLinkSpeed -{ - // - ULONG Outbound; - #define MSNdis_NetworkLinkSpeed_Outbound_SIZE sizeof(ULONG) - #define MSNdis_NetworkLinkSpeed_Outbound_ID 1 - - // - ULONG Inbound; - #define MSNdis_NetworkLinkSpeed_Inbound_SIZE sizeof(ULONG) - #define MSNdis_NetworkLinkSpeed_Inbound_ID 2 - -} MSNdis_NetworkLinkSpeed, *PMSNdis_NetworkLinkSpeed; - -#define MSNdis_NetworkLinkSpeed_SIZE (FIELD_OFFSET(MSNdis_NetworkLinkSpeed, Inbound) + MSNdis_NetworkLinkSpeed_Inbound_SIZE) - -// MSNdis_EnumerateAdapter - MSNdis_EnumerateAdapter -#define MSNdis_EnumerateAdapterGuid \ - { 0x981f2d7f,0xb1f3,0x11d0, { 0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EnumerateAdapter_GUID, \ - 0x981f2d7f,0xb1f3,0x11d0,0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_EnumerateAdapter -{ - // - CHAR VariableData[1]; - #define MSNdis_EnumerateAdapter_DeviceName_ID 1 - -} MSNdis_EnumerateAdapter, *PMSNdis_EnumerateAdapter; - -// MSNdis_NotifyAdapterRemoval - MSNdis_NotifyAdapterRemoval -#define MSNdis_NotifyAdapterRemovalGuid \ - { 0x981f2d80,0xb1f3,0x11d0, { 0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_NotifyAdapterRemoval_GUID, \ - 0x981f2d80,0xb1f3,0x11d0,0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_NotifyAdapterRemoval -{ - // - CHAR VariableData[1]; - #define MSNdis_NotifyAdapterRemoval_DeviceName_ID 1 - -} MSNdis_NotifyAdapterRemoval, *PMSNdis_NotifyAdapterRemoval; - -// MSNdis_NotifyAdapterArrival - MSNdis_NotifyAdapterArrival -#define MSNdis_NotifyAdapterArrivalGuid \ - { 0x981f2d81,0xb1f3,0x11d0, { 0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_NotifyAdapterArrival_GUID, \ - 0x981f2d81,0xb1f3,0x11d0,0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_NotifyAdapterArrival -{ - // - CHAR VariableData[1]; - #define MSNdis_NotifyAdapterArrival_DeviceName_ID 1 - -} MSNdis_NotifyAdapterArrival, *PMSNdis_NotifyAdapterArrival; - -// MSNdis_NdisEnumerateVc - MSNdis_NdisEnumerateVc -#define MSNdis_NdisEnumerateVcGuid \ - { 0x981f2d82,0xb1f3,0x11d0, { 0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_NdisEnumerateVc_GUID, \ - 0x981f2d82,0xb1f3,0x11d0,0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -// MSNdis_NotifyVcRemoval - MSNdis_NotifyVcRemoval -#define MSNdis_NotifyVcRemovalGuid \ - { 0x981f2d79,0xb1f3,0x11d0, { 0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_NotifyVcRemoval_GUID, \ - 0x981f2d79,0xb1f3,0x11d0,0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -// MSNdis_NotifyVcArrival - MSNdis_NotifyVcArrival -#define MSNdis_NotifyVcArrivalGuid \ - { 0x182f9e0c,0xb1f3,0x11d0, { 0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_NotifyVcArrival_GUID, \ - 0x182f9e0c,0xb1f3,0x11d0,0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -// MSNdis_NotifyFilterRemoval - MSNdis_NotifyFilterRemoval -#define MSNdis_NotifyFilterRemovalGuid \ - { 0x1f177cd9,0x5955,0x4721, { 0x9f,0x6a,0x78,0xeb,0xdf,0xae,0xf8,0x89 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_NotifyFilterRemoval_GUID, \ - 0x1f177cd9,0x5955,0x4721,0x9f,0x6a,0x78,0xeb,0xdf,0xae,0xf8,0x89); -#endif - - -// MSNdis_NotifyFilterArrival - MSNdis_NotifyFilterArrival -#define MSNdis_NotifyFilterArrivalGuid \ - { 0x0b6d3c89,0x5917,0x43ca, { 0xb5,0x78,0xd0,0x1a,0x79,0x67,0xc4,0x1c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_NotifyFilterArrival_GUID, \ - 0x0b6d3c89,0x5917,0x43ca,0xb5,0x78,0xd0,0x1a,0x79,0x67,0xc4,0x1c); -#endif - - -// MSNdis_DeviceWakeOnMagicPacketOnly - MSNdis_DeviceWakeOnMagicPacketOnly -#define MSNdis_DeviceWakeOnMagicPacketOnlyGuid \ - { 0xa14f1c97,0x8839,0x4f8a, { 0x99,0x96,0xa2,0x89,0x96,0xeb,0xbf,0x1d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_DeviceWakeOnMagicPacketOnly_GUID, \ - 0xa14f1c97,0x8839,0x4f8a,0x99,0x96,0xa2,0x89,0x96,0xeb,0xbf,0x1d); -#endif - - -typedef struct _MSNdis_DeviceWakeOnMagicPacketOnly -{ - // - BOOLEAN EnableWakeOnMagicPacketOnly; - #define MSNdis_DeviceWakeOnMagicPacketOnly_EnableWakeOnMagicPacketOnly_SIZE sizeof(BOOLEAN) - #define MSNdis_DeviceWakeOnMagicPacketOnly_EnableWakeOnMagicPacketOnly_ID 1 - -} MSNdis_DeviceWakeOnMagicPacketOnly, *PMSNdis_DeviceWakeOnMagicPacketOnly; - -#define MSNdis_DeviceWakeOnMagicPacketOnly_SIZE (FIELD_OFFSET(MSNdis_DeviceWakeOnMagicPacketOnly, EnableWakeOnMagicPacketOnly) + MSNdis_DeviceWakeOnMagicPacketOnly_EnableWakeOnMagicPacketOnly_SIZE) - -// MSNdis_RSSEnabled - MSNdis_RSSEnabled -#define MSNdis_RSSEnabledGuid \ - { 0x9565cd55,0x3402,0x4e32, { 0xa5,0xb6,0x2f,0x14,0x3f,0x2f,0x2c,0x30 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_RSSEnabled_GUID, \ - 0x9565cd55,0x3402,0x4e32,0xa5,0xb6,0x2f,0x14,0x3f,0x2f,0x2c,0x30); -#endif - - -typedef struct _MSNdis_RSSEnabled -{ - // - BOOLEAN RSSEnabled; - #define MSNdis_RSSEnabled_RSSEnabled_SIZE sizeof(BOOLEAN) - #define MSNdis_RSSEnabled_RSSEnabled_ID 1 - -} MSNdis_RSSEnabled, *PMSNdis_RSSEnabled; - -#define MSNdis_RSSEnabled_SIZE (FIELD_OFFSET(MSNdis_RSSEnabled, RSSEnabled) + MSNdis_RSSEnabled_RSSEnabled_SIZE) - -// MSNdis_HardwareStatus - MSNdis_HardwareStatus -#define MSNdis_HardwareStatusGuid \ - { 0x5ec10354,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_HardwareStatus_GUID, \ - 0x5ec10354,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_HardwareStatus -{ - // - ULONG NdisHardwareStatus; - #define MSNdis_HardwareStatus_NdisHardwareStatus_SIZE sizeof(ULONG) - #define MSNdis_HardwareStatus_NdisHardwareStatus_ID 1 - -} MSNdis_HardwareStatus, *PMSNdis_HardwareStatus; - -#define MSNdis_HardwareStatus_SIZE (FIELD_OFFSET(MSNdis_HardwareStatus, NdisHardwareStatus) + MSNdis_HardwareStatus_NdisHardwareStatus_SIZE) - -// MSNdis_MediaSupported - MSNdis_MediaSupported -#define MSNdis_MediaSupportedGuid \ - { 0x5ec10355,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_MediaSupported_GUID, \ - 0x5ec10355,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_MediaSupported -{ - // - ULONG NumberElements; - #define MSNdis_MediaSupported_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_MediaSupported_NumberElements_ID 1 - - // - ULONG NdisMediaSupported[1]; - #define MSNdis_MediaSupported_NdisMediaSupported_ID 2 - -} MSNdis_MediaSupported, *PMSNdis_MediaSupported; - -// MSNdis_MediaInUse - MSNdis_MediaInUse -#define MSNdis_MediaInUseGuid \ - { 0x5ec10356,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_MediaInUse_GUID, \ - 0x5ec10356,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_MediaInUse -{ - // - ULONG NumberElements; - #define MSNdis_MediaInUse_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_MediaInUse_NumberElements_ID 1 - - // - ULONG NdisMediaInUse[1]; - #define MSNdis_MediaInUse_NdisMediaInUse_ID 2 - -} MSNdis_MediaInUse, *PMSNdis_MediaInUse; - -// MSNdis_MaximumLookahead - MSNdis_MaximumLookahead -#define MSNdis_MaximumLookaheadGuid \ - { 0x5ec10357,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_MaximumLookahead_GUID, \ - 0x5ec10357,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_MaximumLookahead -{ - // - ULONG NdisMaximumLookahead; - #define MSNdis_MaximumLookahead_NdisMaximumLookahead_SIZE sizeof(ULONG) - #define MSNdis_MaximumLookahead_NdisMaximumLookahead_ID 1 - -} MSNdis_MaximumLookahead, *PMSNdis_MaximumLookahead; - -#define MSNdis_MaximumLookahead_SIZE (FIELD_OFFSET(MSNdis_MaximumLookahead, NdisMaximumLookahead) + MSNdis_MaximumLookahead_NdisMaximumLookahead_SIZE) - -// MSNdis_MaximumFrameSize - MSNdis_MaximumFrameSize -#define MSNdis_MaximumFrameSizeGuid \ - { 0x5ec10358,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_MaximumFrameSize_GUID, \ - 0x5ec10358,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_MaximumFrameSize -{ - // - ULONG NdisMaximumFrameSize; - #define MSNdis_MaximumFrameSize_NdisMaximumFrameSize_SIZE sizeof(ULONG) - #define MSNdis_MaximumFrameSize_NdisMaximumFrameSize_ID 1 - -} MSNdis_MaximumFrameSize, *PMSNdis_MaximumFrameSize; - -#define MSNdis_MaximumFrameSize_SIZE (FIELD_OFFSET(MSNdis_MaximumFrameSize, NdisMaximumFrameSize) + MSNdis_MaximumFrameSize_NdisMaximumFrameSize_SIZE) - -// MSNdis_LinkSpeed - MSNdis_LinkSpeed -#define MSNdis_LinkSpeedGuid \ - { 0x5ec10359,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_LinkSpeed_GUID, \ - 0x5ec10359,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_LinkSpeed -{ - // - ULONG NdisLinkSpeed; - #define MSNdis_LinkSpeed_NdisLinkSpeed_SIZE sizeof(ULONG) - #define MSNdis_LinkSpeed_NdisLinkSpeed_ID 1 - -} MSNdis_LinkSpeed, *PMSNdis_LinkSpeed; - -#define MSNdis_LinkSpeed_SIZE (FIELD_OFFSET(MSNdis_LinkSpeed, NdisLinkSpeed) + MSNdis_LinkSpeed_NdisLinkSpeed_SIZE) - -// MSNdis_TransmitBufferSpace - MSNdis_TransmitBufferSpace -#define MSNdis_TransmitBufferSpaceGuid \ - { 0x5ec1035a,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TransmitBufferSpace_GUID, \ - 0x5ec1035a,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TransmitBufferSpace -{ - // - ULONG NdisTransmitBufferSpace; - #define MSNdis_TransmitBufferSpace_NdisTransmitBufferSpace_SIZE sizeof(ULONG) - #define MSNdis_TransmitBufferSpace_NdisTransmitBufferSpace_ID 1 - -} MSNdis_TransmitBufferSpace, *PMSNdis_TransmitBufferSpace; - -#define MSNdis_TransmitBufferSpace_SIZE (FIELD_OFFSET(MSNdis_TransmitBufferSpace, NdisTransmitBufferSpace) + MSNdis_TransmitBufferSpace_NdisTransmitBufferSpace_SIZE) - -// MSNdis_ReceiveBufferSpace - MSNdis_ReceiveBufferSpace -#define MSNdis_ReceiveBufferSpaceGuid \ - { 0x5ec1035b,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveBufferSpace_GUID, \ - 0x5ec1035b,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_ReceiveBufferSpace -{ - // - ULONG NdisReceiveBufferSpace; - #define MSNdis_ReceiveBufferSpace_NdisReceiveBufferSpace_SIZE sizeof(ULONG) - #define MSNdis_ReceiveBufferSpace_NdisReceiveBufferSpace_ID 1 - -} MSNdis_ReceiveBufferSpace, *PMSNdis_ReceiveBufferSpace; - -#define MSNdis_ReceiveBufferSpace_SIZE (FIELD_OFFSET(MSNdis_ReceiveBufferSpace, NdisReceiveBufferSpace) + MSNdis_ReceiveBufferSpace_NdisReceiveBufferSpace_SIZE) - -// MSNdis_TransmitBlockSize - MSNdis_TransmitBlockSize -#define MSNdis_TransmitBlockSizeGuid \ - { 0x5ec1035c,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TransmitBlockSize_GUID, \ - 0x5ec1035c,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TransmitBlockSize -{ - // - ULONG NdisTransmitBlockSize; - #define MSNdis_TransmitBlockSize_NdisTransmitBlockSize_SIZE sizeof(ULONG) - #define MSNdis_TransmitBlockSize_NdisTransmitBlockSize_ID 1 - -} MSNdis_TransmitBlockSize, *PMSNdis_TransmitBlockSize; - -#define MSNdis_TransmitBlockSize_SIZE (FIELD_OFFSET(MSNdis_TransmitBlockSize, NdisTransmitBlockSize) + MSNdis_TransmitBlockSize_NdisTransmitBlockSize_SIZE) - -// MSNdis_ReceiveBlockSize - MSNdis_ReceiveBlockSize -#define MSNdis_ReceiveBlockSizeGuid \ - { 0x5ec1035d,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveBlockSize_GUID, \ - 0x5ec1035d,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_ReceiveBlockSize -{ - // - ULONG NdisReceiveBlockSize; - #define MSNdis_ReceiveBlockSize_NdisReceiveBlockSize_SIZE sizeof(ULONG) - #define MSNdis_ReceiveBlockSize_NdisReceiveBlockSize_ID 1 - -} MSNdis_ReceiveBlockSize, *PMSNdis_ReceiveBlockSize; - -#define MSNdis_ReceiveBlockSize_SIZE (FIELD_OFFSET(MSNdis_ReceiveBlockSize, NdisReceiveBlockSize) + MSNdis_ReceiveBlockSize_NdisReceiveBlockSize_SIZE) - -// MSNdis_VendorID - MSNdis_VendorID -#define MSNdis_VendorIDGuid \ - { 0x5ec1035e,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_VendorID_GUID, \ - 0x5ec1035e,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_VendorID -{ - // - ULONG NdisVendorID; - #define MSNdis_VendorID_NdisVendorID_SIZE sizeof(ULONG) - #define MSNdis_VendorID_NdisVendorID_ID 1 - -} MSNdis_VendorID, *PMSNdis_VendorID; - -#define MSNdis_VendorID_SIZE (FIELD_OFFSET(MSNdis_VendorID, NdisVendorID) + MSNdis_VendorID_NdisVendorID_SIZE) - -// MSNdis_VendorDescription - MSNdis_VendorDescription -#define MSNdis_VendorDescriptionGuid \ - { 0x5ec1035f,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_VendorDescription_GUID, \ - 0x5ec1035f,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_VendorDescription -{ - // - CHAR VariableData[1]; - #define MSNdis_VendorDescription_NdisVendorDescription_ID 1 - -} MSNdis_VendorDescription, *PMSNdis_VendorDescription; - -// MSNdis_CurrentPacketFilter - MSNdis_CurrentPacketFilter -#define MSNdis_CurrentPacketFilterGuid \ - { 0x5ec10360,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CurrentPacketFilter_GUID, \ - 0x5ec10360,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CurrentPacketFilter -{ - // - ULONG NdisCurrentPacketFilter; - #define MSNdis_CurrentPacketFilter_NdisCurrentPacketFilter_SIZE sizeof(ULONG) - #define MSNdis_CurrentPacketFilter_NdisCurrentPacketFilter_ID 1 - -} MSNdis_CurrentPacketFilter, *PMSNdis_CurrentPacketFilter; - -#define MSNdis_CurrentPacketFilter_SIZE (FIELD_OFFSET(MSNdis_CurrentPacketFilter, NdisCurrentPacketFilter) + MSNdis_CurrentPacketFilter_NdisCurrentPacketFilter_SIZE) - -// MSNdis_CurrentLookahead - MSNdis_CurrentLookahead -#define MSNdis_CurrentLookaheadGuid \ - { 0x5ec10361,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CurrentLookahead_GUID, \ - 0x5ec10361,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CurrentLookahead -{ - // - ULONG NdisCurrentLookahead; - #define MSNdis_CurrentLookahead_NdisCurrentLookahead_SIZE sizeof(ULONG) - #define MSNdis_CurrentLookahead_NdisCurrentLookahead_ID 1 - -} MSNdis_CurrentLookahead, *PMSNdis_CurrentLookahead; - -#define MSNdis_CurrentLookahead_SIZE (FIELD_OFFSET(MSNdis_CurrentLookahead, NdisCurrentLookahead) + MSNdis_CurrentLookahead_NdisCurrentLookahead_SIZE) - -// MSNdis_DriverVersion - MSNdis_DriverVersion -#define MSNdis_DriverVersionGuid \ - { 0x5ec10362,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_DriverVersion_GUID, \ - 0x5ec10362,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_DriverVersion -{ - // - USHORT NdisDriverVersion; - #define MSNdis_DriverVersion_NdisDriverVersion_SIZE sizeof(USHORT) - #define MSNdis_DriverVersion_NdisDriverVersion_ID 1 - -} MSNdis_DriverVersion, *PMSNdis_DriverVersion; - -#define MSNdis_DriverVersion_SIZE (FIELD_OFFSET(MSNdis_DriverVersion, NdisDriverVersion) + MSNdis_DriverVersion_NdisDriverVersion_SIZE) - -// MSNdis_MaximumTotalSize - MSNdis_MaximumTotalSize -#define MSNdis_MaximumTotalSizeGuid \ - { 0x5ec10363,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_MaximumTotalSize_GUID, \ - 0x5ec10363,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_MaximumTotalSize -{ - // - ULONG NdisMaximumTotalSize; - #define MSNdis_MaximumTotalSize_NdisMaximumTotalSize_SIZE sizeof(ULONG) - #define MSNdis_MaximumTotalSize_NdisMaximumTotalSize_ID 1 - -} MSNdis_MaximumTotalSize, *PMSNdis_MaximumTotalSize; - -#define MSNdis_MaximumTotalSize_SIZE (FIELD_OFFSET(MSNdis_MaximumTotalSize, NdisMaximumTotalSize) + MSNdis_MaximumTotalSize_NdisMaximumTotalSize_SIZE) - -// MSNdis_MacOptions - MSNdis_MacOptions -#define MSNdis_MacOptionsGuid \ - { 0x5ec10365,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_MacOptions_GUID, \ - 0x5ec10365,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_MacOptions -{ - // - ULONG NdisMacOptions; - #define MSNdis_MacOptions_NdisMacOptions_SIZE sizeof(ULONG) - #define MSNdis_MacOptions_NdisMacOptions_ID 1 - -} MSNdis_MacOptions, *PMSNdis_MacOptions; - -#define MSNdis_MacOptions_SIZE (FIELD_OFFSET(MSNdis_MacOptions, NdisMacOptions) + MSNdis_MacOptions_NdisMacOptions_SIZE) - -// MSNdis_MediaConnectStatus - MSNdis_MediaConnectStatus -#define MSNdis_MediaConnectStatusGuid \ - { 0x5ec10366,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_MediaConnectStatus_GUID, \ - 0x5ec10366,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_MediaConnectStatus -{ - // - ULONG NdisMediaConnectStatus; - #define MSNdis_MediaConnectStatus_NdisMediaConnectStatus_SIZE sizeof(ULONG) - #define MSNdis_MediaConnectStatus_NdisMediaConnectStatus_ID 1 - -} MSNdis_MediaConnectStatus, *PMSNdis_MediaConnectStatus; - -#define MSNdis_MediaConnectStatus_SIZE (FIELD_OFFSET(MSNdis_MediaConnectStatus, NdisMediaConnectStatus) + MSNdis_MediaConnectStatus_NdisMediaConnectStatus_SIZE) - -// MSNdis_MaximumSendPackets - MSNdis_MaximumSendPackets -#define MSNdis_MaximumSendPacketsGuid \ - { 0x5ec10367,0xa61a,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_MaximumSendPackets_GUID, \ - 0x5ec10367,0xa61a,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_MaximumSendPackets -{ - // - ULONG NdisMaximumSendPackets; - #define MSNdis_MaximumSendPackets_NdisMaximumSendPackets_SIZE sizeof(ULONG) - #define MSNdis_MaximumSendPackets_NdisMaximumSendPackets_ID 1 - -} MSNdis_MaximumSendPackets, *PMSNdis_MaximumSendPackets; - -#define MSNdis_MaximumSendPackets_SIZE (FIELD_OFFSET(MSNdis_MaximumSendPackets, NdisMaximumSendPackets) + MSNdis_MaximumSendPackets_NdisMaximumSendPackets_SIZE) - -// MSNdis_VendorDriverVersion - MSNdis_VendorDriverVersion -#define MSNdis_VendorDriverVersionGuid \ - { 0x447956f9,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_VendorDriverVersion_GUID, \ - 0x447956f9,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_VendorDriverVersion -{ - // - ULONG NdisVendorDriverVersion; - #define MSNdis_VendorDriverVersion_NdisVendorDriverVersion_SIZE sizeof(ULONG) - #define MSNdis_VendorDriverVersion_NdisVendorDriverVersion_ID 1 - -} MSNdis_VendorDriverVersion, *PMSNdis_VendorDriverVersion; - -#define MSNdis_VendorDriverVersion_SIZE (FIELD_OFFSET(MSNdis_VendorDriverVersion, NdisVendorDriverVersion) + MSNdis_VendorDriverVersion_NdisVendorDriverVersion_SIZE) - -// MSNdis_VlanIdentifier - MSNdis_VlanIdentifier -#define MSNdis_VlanIdentifierGuid \ - { 0x765dc702,0xc5e8,0x4b67, { 0x84,0x3b,0x3f,0x5a,0x4f,0xf2,0x64,0x8b } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_VlanIdentifier_GUID, \ - 0x765dc702,0xc5e8,0x4b67,0x84,0x3b,0x3f,0x5a,0x4f,0xf2,0x64,0x8b); -#endif - - -typedef struct _MSNdis_VlanIdentifier -{ - // - ULONG NdisVlanId; - #define MSNdis_VlanIdentifier_NdisVlanId_SIZE sizeof(ULONG) - #define MSNdis_VlanIdentifier_NdisVlanId_ID 1 - -} MSNdis_VlanIdentifier, *PMSNdis_VlanIdentifier; - -#define MSNdis_VlanIdentifier_SIZE (FIELD_OFFSET(MSNdis_VlanIdentifier, NdisVlanId) + MSNdis_VlanIdentifier_NdisVlanId_SIZE) - -// MSNdis_PhysicalMediumType - MSNdis_PhysicalMediumType -#define MSNdis_PhysicalMediumTypeGuid \ - { 0x418ca16d,0x3937,0x4208, { 0x94,0x0a,0xec,0x61,0x96,0x27,0x80,0x85 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_PhysicalMediumType_GUID, \ - 0x418ca16d,0x3937,0x4208,0x94,0x0a,0xec,0x61,0x96,0x27,0x80,0x85); -#endif - - -typedef struct _MSNdis_PhysicalMediumType -{ - // - ULONG NdisPhysicalMediumType; - #define MSNdis_PhysicalMediumType_NdisPhysicalMediumType_SIZE sizeof(ULONG) - #define MSNdis_PhysicalMediumType_NdisPhysicalMediumType_ID 1 - -} MSNdis_PhysicalMediumType, *PMSNdis_PhysicalMediumType; - -#define MSNdis_PhysicalMediumType_SIZE (FIELD_OFFSET(MSNdis_PhysicalMediumType, NdisPhysicalMediumType) + MSNdis_PhysicalMediumType_NdisPhysicalMediumType_SIZE) - -// MSNdis_TransmitsOk - MSNdis_TransmitsOk -#define MSNdis_TransmitsOkGuid \ - { 0x447956fa,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TransmitsOk_GUID, \ - 0x447956fa,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TransmitsOk -{ - // - ULONGLONG NdisTransmitsOk; - #define MSNdis_TransmitsOk_NdisTransmitsOk_SIZE sizeof(ULONGLONG) - #define MSNdis_TransmitsOk_NdisTransmitsOk_ID 1 - -} MSNdis_TransmitsOk, *PMSNdis_TransmitsOk; - -#define MSNdis_TransmitsOk_SIZE (FIELD_OFFSET(MSNdis_TransmitsOk, NdisTransmitsOk) + MSNdis_TransmitsOk_NdisTransmitsOk_SIZE) - -// MSNdis_ReceivesOk - MSNdis_ReceivesOk -#define MSNdis_ReceivesOkGuid \ - { 0x447956fb,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceivesOk_GUID, \ - 0x447956fb,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_ReceivesOk -{ - // - ULONGLONG NdisReceivesOk; - #define MSNdis_ReceivesOk_NdisReceivesOk_SIZE sizeof(ULONGLONG) - #define MSNdis_ReceivesOk_NdisReceivesOk_ID 1 - -} MSNdis_ReceivesOk, *PMSNdis_ReceivesOk; - -#define MSNdis_ReceivesOk_SIZE (FIELD_OFFSET(MSNdis_ReceivesOk, NdisReceivesOk) + MSNdis_ReceivesOk_NdisReceivesOk_SIZE) - -// MSNdis_TransmitsError - MSNdis_TransmitsError -#define MSNdis_TransmitsErrorGuid \ - { 0x447956fc,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TransmitsError_GUID, \ - 0x447956fc,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TransmitsError -{ - // - ULONG NdisTransmitsError; - #define MSNdis_TransmitsError_NdisTransmitsError_SIZE sizeof(ULONG) - #define MSNdis_TransmitsError_NdisTransmitsError_ID 1 - -} MSNdis_TransmitsError, *PMSNdis_TransmitsError; - -#define MSNdis_TransmitsError_SIZE (FIELD_OFFSET(MSNdis_TransmitsError, NdisTransmitsError) + MSNdis_TransmitsError_NdisTransmitsError_SIZE) - -// MSNdis_ReceiveError - MSNdis_ReceiveError -#define MSNdis_ReceiveErrorGuid \ - { 0x447956fd,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveError_GUID, \ - 0x447956fd,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_ReceiveError -{ - // - ULONG NdisReceiveError; - #define MSNdis_ReceiveError_NdisReceiveError_SIZE sizeof(ULONG) - #define MSNdis_ReceiveError_NdisReceiveError_ID 1 - -} MSNdis_ReceiveError, *PMSNdis_ReceiveError; - -#define MSNdis_ReceiveError_SIZE (FIELD_OFFSET(MSNdis_ReceiveError, NdisReceiveError) + MSNdis_ReceiveError_NdisReceiveError_SIZE) - -// MSNdis_ReceiveNoBuffer - MSNdis_ReceiveNoBuffer -#define MSNdis_ReceiveNoBufferGuid \ - { 0x447956fe,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveNoBuffer_GUID, \ - 0x447956fe,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_ReceiveNoBuffer -{ - // - ULONG NdisReceiveNoBuffer; - #define MSNdis_ReceiveNoBuffer_NdisReceiveNoBuffer_SIZE sizeof(ULONG) - #define MSNdis_ReceiveNoBuffer_NdisReceiveNoBuffer_ID 1 - -} MSNdis_ReceiveNoBuffer, *PMSNdis_ReceiveNoBuffer; - -#define MSNdis_ReceiveNoBuffer_SIZE (FIELD_OFFSET(MSNdis_ReceiveNoBuffer, NdisReceiveNoBuffer) + MSNdis_ReceiveNoBuffer_NdisReceiveNoBuffer_SIZE) - -// MSNdis_CoHardwareStatus - MSNdis_CoHardwareStatus -#define MSNdis_CoHardwareStatusGuid \ - { 0x791ad192,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoHardwareStatus_GUID, \ - 0x791ad192,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoHardwareStatus -{ - // - ULONG NdisCoHardwareStatus; - #define MSNdis_CoHardwareStatus_NdisCoHardwareStatus_SIZE sizeof(ULONG) - #define MSNdis_CoHardwareStatus_NdisCoHardwareStatus_ID 1 - -} MSNdis_CoHardwareStatus, *PMSNdis_CoHardwareStatus; - -#define MSNdis_CoHardwareStatus_SIZE (FIELD_OFFSET(MSNdis_CoHardwareStatus, NdisCoHardwareStatus) + MSNdis_CoHardwareStatus_NdisCoHardwareStatus_SIZE) - -// MSNdis_CoMediaSupported - MSNdis_CoMediaSupported -#define MSNdis_CoMediaSupportedGuid \ - { 0x791ad193,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoMediaSupported_GUID, \ - 0x791ad193,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoMediaSupported -{ - // - ULONG NumberElements; - #define MSNdis_CoMediaSupported_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_CoMediaSupported_NumberElements_ID 1 - - // - ULONG NdisCoMediaSupported[1]; - #define MSNdis_CoMediaSupported_NdisCoMediaSupported_ID 2 - -} MSNdis_CoMediaSupported, *PMSNdis_CoMediaSupported; - -// MSNdis_CoMediaInUse - MSNdis_CoMediaInUse -#define MSNdis_CoMediaInUseGuid \ - { 0x791ad194,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoMediaInUse_GUID, \ - 0x791ad194,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoMediaInUse -{ - // - ULONG NumberElements; - #define MSNdis_CoMediaInUse_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_CoMediaInUse_NumberElements_ID 1 - - // - ULONG NdisCoMediaInUse[1]; - #define MSNdis_CoMediaInUse_NdisCoMediaInUse_ID 2 - -} MSNdis_CoMediaInUse, *PMSNdis_CoMediaInUse; - -// MSNdis_CoLinkSpeed - MSNdis_CoLinkSpeed -#define MSNdis_CoLinkSpeedGuid \ - { 0x791ad195,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoLinkSpeed_GUID, \ - 0x791ad195,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoLinkSpeed -{ - // - MSNdis_NetworkLinkSpeed NdisCoLinkSpeed; - #define MSNdis_CoLinkSpeed_NdisCoLinkSpeed_SIZE sizeof(MSNdis_NetworkLinkSpeed) - #define MSNdis_CoLinkSpeed_NdisCoLinkSpeed_ID 1 - -} MSNdis_CoLinkSpeed, *PMSNdis_CoLinkSpeed; - -#define MSNdis_CoLinkSpeed_SIZE (FIELD_OFFSET(MSNdis_CoLinkSpeed, NdisCoLinkSpeed) + MSNdis_CoLinkSpeed_NdisCoLinkSpeed_SIZE) - -// MSNdis_CoVendorId - MSNdis_CoVendorId -#define MSNdis_CoVendorIdGuid \ - { 0x791ad196,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoVendorId_GUID, \ - 0x791ad196,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoVendorId -{ - // - ULONG NdisCoVendorID; - #define MSNdis_CoVendorId_NdisCoVendorID_SIZE sizeof(ULONG) - #define MSNdis_CoVendorId_NdisCoVendorID_ID 1 - -} MSNdis_CoVendorId, *PMSNdis_CoVendorId; - -#define MSNdis_CoVendorId_SIZE (FIELD_OFFSET(MSNdis_CoVendorId, NdisCoVendorID) + MSNdis_CoVendorId_NdisCoVendorID_SIZE) - -// MSNdis_CoVendorDescription - MSNdis_CoVendorDescription -#define MSNdis_CoVendorDescriptionGuid \ - { 0x791ad197,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoVendorDescription_GUID, \ - 0x791ad197,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoVendorDescription -{ - // - CHAR VariableData[1]; - #define MSNdis_CoVendorDescription_NdisCoVendorDescription_ID 1 - -} MSNdis_CoVendorDescription, *PMSNdis_CoVendorDescription; - -// MSNdis_CoDriverVersion - MSNdis_CoDriverVersion -#define MSNdis_CoDriverVersionGuid \ - { 0x791ad198,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoDriverVersion_GUID, \ - 0x791ad198,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoDriverVersion -{ - // - USHORT NdisCoDriverVersion; - #define MSNdis_CoDriverVersion_NdisCoDriverVersion_SIZE sizeof(USHORT) - #define MSNdis_CoDriverVersion_NdisCoDriverVersion_ID 1 - -} MSNdis_CoDriverVersion, *PMSNdis_CoDriverVersion; - -#define MSNdis_CoDriverVersion_SIZE (FIELD_OFFSET(MSNdis_CoDriverVersion, NdisCoDriverVersion) + MSNdis_CoDriverVersion_NdisCoDriverVersion_SIZE) - -// MSNdis_CoMacOptions - MSNdis_CoMacOptions -#define MSNdis_CoMacOptionsGuid \ - { 0x791ad19a,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoMacOptions_GUID, \ - 0x791ad19a,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoMacOptions -{ - // - ULONG NdisCoMacOptions; - #define MSNdis_CoMacOptions_NdisCoMacOptions_SIZE sizeof(ULONG) - #define MSNdis_CoMacOptions_NdisCoMacOptions_ID 1 - -} MSNdis_CoMacOptions, *PMSNdis_CoMacOptions; - -#define MSNdis_CoMacOptions_SIZE (FIELD_OFFSET(MSNdis_CoMacOptions, NdisCoMacOptions) + MSNdis_CoMacOptions_NdisCoMacOptions_SIZE) - -// MSNdis_CoMediaConnectStatus - MSNdis_CoMediaConnectStatus -#define MSNdis_CoMediaConnectStatusGuid \ - { 0x791ad19b,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoMediaConnectStatus_GUID, \ - 0x791ad19b,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoMediaConnectStatus -{ - // - ULONG NdisCoMediaConnectStatus; - #define MSNdis_CoMediaConnectStatus_NdisCoMediaConnectStatus_SIZE sizeof(ULONG) - #define MSNdis_CoMediaConnectStatus_NdisCoMediaConnectStatus_ID 1 - -} MSNdis_CoMediaConnectStatus, *PMSNdis_CoMediaConnectStatus; - -#define MSNdis_CoMediaConnectStatus_SIZE (FIELD_OFFSET(MSNdis_CoMediaConnectStatus, NdisCoMediaConnectStatus) + MSNdis_CoMediaConnectStatus_NdisCoMediaConnectStatus_SIZE) - -// MSNdis_CoVendorDriverVersion - MSNdis_CoVendorDriverVersion -#define MSNdis_CoVendorDriverVersionGuid \ - { 0x791ad19c,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoVendorDriverVersion_GUID, \ - 0x791ad19c,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoVendorDriverVersion -{ - // - ULONG NdisCoVendorDriverVersion; - #define MSNdis_CoVendorDriverVersion_NdisCoVendorDriverVersion_SIZE sizeof(ULONG) - #define MSNdis_CoVendorDriverVersion_NdisCoVendorDriverVersion_ID 1 - -} MSNdis_CoVendorDriverVersion, *PMSNdis_CoVendorDriverVersion; - -#define MSNdis_CoVendorDriverVersion_SIZE (FIELD_OFFSET(MSNdis_CoVendorDriverVersion, NdisCoVendorDriverVersion) + MSNdis_CoVendorDriverVersion_NdisCoVendorDriverVersion_SIZE) - -// MSNdis_CoMinimumLinkSpeed - MSNdis_CoMinimumLinkSpeed -#define MSNdis_CoMinimumLinkSpeedGuid \ - { 0x791ad19d,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoMinimumLinkSpeed_GUID, \ - 0x791ad19d,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoMinimumLinkSpeed -{ - // - MSNdis_NetworkLinkSpeed NdisCoMinimumLinkSpeed; - #define MSNdis_CoMinimumLinkSpeed_NdisCoMinimumLinkSpeed_SIZE sizeof(MSNdis_NetworkLinkSpeed) - #define MSNdis_CoMinimumLinkSpeed_NdisCoMinimumLinkSpeed_ID 1 - -} MSNdis_CoMinimumLinkSpeed, *PMSNdis_CoMinimumLinkSpeed; - -#define MSNdis_CoMinimumLinkSpeed_SIZE (FIELD_OFFSET(MSNdis_CoMinimumLinkSpeed, NdisCoMinimumLinkSpeed) + MSNdis_CoMinimumLinkSpeed_NdisCoMinimumLinkSpeed_SIZE) - -// MSNdis_CoTransmitPdusOk - MSNdis_CoTransmitPdusOk -#define MSNdis_CoTransmitPdusOkGuid \ - { 0x0a214805,0xe35f,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoTransmitPdusOk_GUID, \ - 0x0a214805,0xe35f,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoTransmitPdusOk -{ - // - ULONGLONG NdisCoTransmitPdusOk; - #define MSNdis_CoTransmitPdusOk_NdisCoTransmitPdusOk_SIZE sizeof(ULONGLONG) - #define MSNdis_CoTransmitPdusOk_NdisCoTransmitPdusOk_ID 1 - -} MSNdis_CoTransmitPdusOk, *PMSNdis_CoTransmitPdusOk; - -#define MSNdis_CoTransmitPdusOk_SIZE (FIELD_OFFSET(MSNdis_CoTransmitPdusOk, NdisCoTransmitPdusOk) + MSNdis_CoTransmitPdusOk_NdisCoTransmitPdusOk_SIZE) - -// MSNdis_CoReceivePdusOk - MSNdis_CoReceivePdusOk -#define MSNdis_CoReceivePdusOkGuid \ - { 0x0a214806,0xe35f,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoReceivePdusOk_GUID, \ - 0x0a214806,0xe35f,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoReceivePdusOk -{ - // - ULONGLONG NdisCoReceivePdusOk; - #define MSNdis_CoReceivePdusOk_NdisCoReceivePdusOk_SIZE sizeof(ULONGLONG) - #define MSNdis_CoReceivePdusOk_NdisCoReceivePdusOk_ID 1 - -} MSNdis_CoReceivePdusOk, *PMSNdis_CoReceivePdusOk; - -#define MSNdis_CoReceivePdusOk_SIZE (FIELD_OFFSET(MSNdis_CoReceivePdusOk, NdisCoReceivePdusOk) + MSNdis_CoReceivePdusOk_NdisCoReceivePdusOk_SIZE) - -// MSNdis_CoTransmitPduErrors - MSNdis_CoTransmitPduErrors -#define MSNdis_CoTransmitPduErrorsGuid \ - { 0x0a214807,0xe35f,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoTransmitPduErrors_GUID, \ - 0x0a214807,0xe35f,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoTransmitPduErrors -{ - // - ULONG NdisCoTransmitPduErrors; - #define MSNdis_CoTransmitPduErrors_NdisCoTransmitPduErrors_SIZE sizeof(ULONG) - #define MSNdis_CoTransmitPduErrors_NdisCoTransmitPduErrors_ID 1 - -} MSNdis_CoTransmitPduErrors, *PMSNdis_CoTransmitPduErrors; - -#define MSNdis_CoTransmitPduErrors_SIZE (FIELD_OFFSET(MSNdis_CoTransmitPduErrors, NdisCoTransmitPduErrors) + MSNdis_CoTransmitPduErrors_NdisCoTransmitPduErrors_SIZE) - -// MSNdis_CoReceivePduErrors - MSNdis_CoReceivePduErrors -#define MSNdis_CoReceivePduErrorsGuid \ - { 0x0a214808,0xe35f,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoReceivePduErrors_GUID, \ - 0x0a214808,0xe35f,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoReceivePduErrors -{ - // - ULONG NdisCoReceivePduErrors; - #define MSNdis_CoReceivePduErrors_NdisCoReceivePduErrors_SIZE sizeof(ULONG) - #define MSNdis_CoReceivePduErrors_NdisCoReceivePduErrors_ID 1 - -} MSNdis_CoReceivePduErrors, *PMSNdis_CoReceivePduErrors; - -#define MSNdis_CoReceivePduErrors_SIZE (FIELD_OFFSET(MSNdis_CoReceivePduErrors, NdisCoReceivePduErrors) + MSNdis_CoReceivePduErrors_NdisCoReceivePduErrors_SIZE) - -// MSNdis_CoReceivePdusNoBuffer - MSNdis_CoReceivePdusNoBuffer -#define MSNdis_CoReceivePdusNoBufferGuid \ - { 0x0a214809,0xe35f,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CoReceivePdusNoBuffer_GUID, \ - 0x0a214809,0xe35f,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_CoReceivePdusNoBuffer -{ - // - ULONG NdisCoReceivePdusNoBuffer; - #define MSNdis_CoReceivePdusNoBuffer_NdisCoReceivePdusNoBuffer_SIZE sizeof(ULONG) - #define MSNdis_CoReceivePdusNoBuffer_NdisCoReceivePdusNoBuffer_ID 1 - -} MSNdis_CoReceivePdusNoBuffer, *PMSNdis_CoReceivePdusNoBuffer; - -#define MSNdis_CoReceivePdusNoBuffer_SIZE (FIELD_OFFSET(MSNdis_CoReceivePdusNoBuffer, NdisCoReceivePdusNoBuffer) + MSNdis_CoReceivePdusNoBuffer_NdisCoReceivePdusNoBuffer_SIZE) - -// MSNdis_AtmSupportedVcRates - MSNdis_AtmSupportedVcRates -#define MSNdis_AtmSupportedVcRatesGuid \ - { 0x791ad19e,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmSupportedVcRates_GUID, \ - 0x791ad19e,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmSupportedVcRates -{ - // - ULONG MinCellRate; - #define MSNdis_AtmSupportedVcRates_MinCellRate_SIZE sizeof(ULONG) - #define MSNdis_AtmSupportedVcRates_MinCellRate_ID 1 - - // - ULONG MaxCellRate; - #define MSNdis_AtmSupportedVcRates_MaxCellRate_SIZE sizeof(ULONG) - #define MSNdis_AtmSupportedVcRates_MaxCellRate_ID 2 - -} MSNdis_AtmSupportedVcRates, *PMSNdis_AtmSupportedVcRates; - -#define MSNdis_AtmSupportedVcRates_SIZE (FIELD_OFFSET(MSNdis_AtmSupportedVcRates, MaxCellRate) + MSNdis_AtmSupportedVcRates_MaxCellRate_SIZE) - -// MSNdis_AtmSupportedServiceCategory - MSNdis_AtmSupportedServiceCategory -#define MSNdis_AtmSupportedServiceCategoryGuid \ - { 0x791ad19f,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmSupportedServiceCategory_GUID, \ - 0x791ad19f,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmSupportedServiceCategory -{ - // - ULONG NdisAtmSupportedServiceCategory; - #define MSNdis_AtmSupportedServiceCategory_NdisAtmSupportedServiceCategory_SIZE sizeof(ULONG) - #define MSNdis_AtmSupportedServiceCategory_NdisAtmSupportedServiceCategory_ID 1 - -} MSNdis_AtmSupportedServiceCategory, *PMSNdis_AtmSupportedServiceCategory; - -#define MSNdis_AtmSupportedServiceCategory_SIZE (FIELD_OFFSET(MSNdis_AtmSupportedServiceCategory, NdisAtmSupportedServiceCategory) + MSNdis_AtmSupportedServiceCategory_NdisAtmSupportedServiceCategory_SIZE) - -// MSNdis_AtmSupportedAalTypes - MSNdis_AtmSupportedAalTypes -#define MSNdis_AtmSupportedAalTypesGuid \ - { 0x791ad1a0,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmSupportedAalTypes_GUID, \ - 0x791ad1a0,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmSupportedAalTypes -{ - // - ULONG NdisAtmSupportedAalTypes; - #define MSNdis_AtmSupportedAalTypes_NdisAtmSupportedAalTypes_SIZE sizeof(ULONG) - #define MSNdis_AtmSupportedAalTypes_NdisAtmSupportedAalTypes_ID 1 - -} MSNdis_AtmSupportedAalTypes, *PMSNdis_AtmSupportedAalTypes; - -#define MSNdis_AtmSupportedAalTypes_SIZE (FIELD_OFFSET(MSNdis_AtmSupportedAalTypes, NdisAtmSupportedAalTypes) + MSNdis_AtmSupportedAalTypes_NdisAtmSupportedAalTypes_SIZE) - -// MSNdis_AtmHardwareCurrentAddress - MSNdis_AtmHardwareCurrentAddress -#define MSNdis_AtmHardwareCurrentAddressGuid \ - { 0x791ad1a1,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmHardwareCurrentAddress_GUID, \ - 0x791ad1a1,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmHardwareCurrentAddress -{ - // - MSNdis_NetworkAddress NdisAtmHardwareCurrentAddress; - #define MSNdis_AtmHardwareCurrentAddress_NdisAtmHardwareCurrentAddress_SIZE sizeof(MSNdis_NetworkAddress) - #define MSNdis_AtmHardwareCurrentAddress_NdisAtmHardwareCurrentAddress_ID 1 - -} MSNdis_AtmHardwareCurrentAddress, *PMSNdis_AtmHardwareCurrentAddress; - -#define MSNdis_AtmHardwareCurrentAddress_SIZE (FIELD_OFFSET(MSNdis_AtmHardwareCurrentAddress, NdisAtmHardwareCurrentAddress) + MSNdis_AtmHardwareCurrentAddress_NdisAtmHardwareCurrentAddress_SIZE) - -// MSNdis_AtmMaxActiveVcs - MSNdis_AtmMaxActiveVcs -#define MSNdis_AtmMaxActiveVcsGuid \ - { 0x791ad1a2,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmMaxActiveVcs_GUID, \ - 0x791ad1a2,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmMaxActiveVcs -{ - // - ULONG NdisAtmMaxActiveVcs; - #define MSNdis_AtmMaxActiveVcs_NdisAtmMaxActiveVcs_SIZE sizeof(ULONG) - #define MSNdis_AtmMaxActiveVcs_NdisAtmMaxActiveVcs_ID 1 - -} MSNdis_AtmMaxActiveVcs, *PMSNdis_AtmMaxActiveVcs; - -#define MSNdis_AtmMaxActiveVcs_SIZE (FIELD_OFFSET(MSNdis_AtmMaxActiveVcs, NdisAtmMaxActiveVcs) + MSNdis_AtmMaxActiveVcs_NdisAtmMaxActiveVcs_SIZE) - -// MSNdis_AtmMaxActiveVciBits - MSNdis_AtmMaxActiveVciBits -#define MSNdis_AtmMaxActiveVciBitsGuid \ - { 0x791ad1a3,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmMaxActiveVciBits_GUID, \ - 0x791ad1a3,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmMaxActiveVciBits -{ - // - ULONG NdisAtmMaxActiveVciBits; - #define MSNdis_AtmMaxActiveVciBits_NdisAtmMaxActiveVciBits_SIZE sizeof(ULONG) - #define MSNdis_AtmMaxActiveVciBits_NdisAtmMaxActiveVciBits_ID 1 - -} MSNdis_AtmMaxActiveVciBits, *PMSNdis_AtmMaxActiveVciBits; - -#define MSNdis_AtmMaxActiveVciBits_SIZE (FIELD_OFFSET(MSNdis_AtmMaxActiveVciBits, NdisAtmMaxActiveVciBits) + MSNdis_AtmMaxActiveVciBits_NdisAtmMaxActiveVciBits_SIZE) - -// MSNdis_AtmMaxActiveVpiBits - MSNdis_AtmMaxActiveVpiBits -#define MSNdis_AtmMaxActiveVpiBitsGuid \ - { 0x791ad1a4,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmMaxActiveVpiBits_GUID, \ - 0x791ad1a4,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmMaxActiveVpiBits -{ - // - ULONG NdisAtmMaxActiveVpiBits; - #define MSNdis_AtmMaxActiveVpiBits_NdisAtmMaxActiveVpiBits_SIZE sizeof(ULONG) - #define MSNdis_AtmMaxActiveVpiBits_NdisAtmMaxActiveVpiBits_ID 1 - -} MSNdis_AtmMaxActiveVpiBits, *PMSNdis_AtmMaxActiveVpiBits; - -#define MSNdis_AtmMaxActiveVpiBits_SIZE (FIELD_OFFSET(MSNdis_AtmMaxActiveVpiBits, NdisAtmMaxActiveVpiBits) + MSNdis_AtmMaxActiveVpiBits_NdisAtmMaxActiveVpiBits_SIZE) - -// MSNdis_AtmMaxAal0PacketSize - MSNdis_AtmMaxAal0PacketSize -#define MSNdis_AtmMaxAal0PacketSizeGuid \ - { 0x791ad1a5,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmMaxAal0PacketSize_GUID, \ - 0x791ad1a5,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmMaxAal0PacketSize -{ - // - ULONG NdisAtmMaxAal0PacketSize; - #define MSNdis_AtmMaxAal0PacketSize_NdisAtmMaxAal0PacketSize_SIZE sizeof(ULONG) - #define MSNdis_AtmMaxAal0PacketSize_NdisAtmMaxAal0PacketSize_ID 1 - -} MSNdis_AtmMaxAal0PacketSize, *PMSNdis_AtmMaxAal0PacketSize; - -#define MSNdis_AtmMaxAal0PacketSize_SIZE (FIELD_OFFSET(MSNdis_AtmMaxAal0PacketSize, NdisAtmMaxAal0PacketSize) + MSNdis_AtmMaxAal0PacketSize_NdisAtmMaxAal0PacketSize_SIZE) - -// MSNdis_AtmMaxAal1PacketSize - MSNdis_AtmMaxAal1PacketSize -#define MSNdis_AtmMaxAal1PacketSizeGuid \ - { 0x791ad1a6,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmMaxAal1PacketSize_GUID, \ - 0x791ad1a6,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmMaxAal1PacketSize -{ - // - ULONG NdisAtmMaxAal1PacketSize; - #define MSNdis_AtmMaxAal1PacketSize_NdisAtmMaxAal1PacketSize_SIZE sizeof(ULONG) - #define MSNdis_AtmMaxAal1PacketSize_NdisAtmMaxAal1PacketSize_ID 1 - -} MSNdis_AtmMaxAal1PacketSize, *PMSNdis_AtmMaxAal1PacketSize; - -#define MSNdis_AtmMaxAal1PacketSize_SIZE (FIELD_OFFSET(MSNdis_AtmMaxAal1PacketSize, NdisAtmMaxAal1PacketSize) + MSNdis_AtmMaxAal1PacketSize_NdisAtmMaxAal1PacketSize_SIZE) - -// MSNdis_AtmMaxAal34PacketSize - MSNdis_AtmMaxAal34PacketSize -#define MSNdis_AtmMaxAal34PacketSizeGuid \ - { 0x791ad1a7,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmMaxAal34PacketSize_GUID, \ - 0x791ad1a7,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmMaxAal34PacketSize -{ - // - ULONG NdisAtmMaxAal34PacketSize; - #define MSNdis_AtmMaxAal34PacketSize_NdisAtmMaxAal34PacketSize_SIZE sizeof(ULONG) - #define MSNdis_AtmMaxAal34PacketSize_NdisAtmMaxAal34PacketSize_ID 1 - -} MSNdis_AtmMaxAal34PacketSize, *PMSNdis_AtmMaxAal34PacketSize; - -#define MSNdis_AtmMaxAal34PacketSize_SIZE (FIELD_OFFSET(MSNdis_AtmMaxAal34PacketSize, NdisAtmMaxAal34PacketSize) + MSNdis_AtmMaxAal34PacketSize_NdisAtmMaxAal34PacketSize_SIZE) - -// MSNdis_AtmMaxAal5PacketSize - MSNdis_AtmMaxAal5PacketSize -#define MSNdis_AtmMaxAal5PacketSizeGuid \ - { 0x791ad191,0xe35c,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmMaxAal5PacketSize_GUID, \ - 0x791ad191,0xe35c,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmMaxAal5PacketSize -{ - // - ULONG NdisAtmMaxAal5PacketSize; - #define MSNdis_AtmMaxAal5PacketSize_NdisAtmMaxAal5PacketSize_SIZE sizeof(ULONG) - #define MSNdis_AtmMaxAal5PacketSize_NdisAtmMaxAal5PacketSize_ID 1 - -} MSNdis_AtmMaxAal5PacketSize, *PMSNdis_AtmMaxAal5PacketSize; - -#define MSNdis_AtmMaxAal5PacketSize_SIZE (FIELD_OFFSET(MSNdis_AtmMaxAal5PacketSize, NdisAtmMaxAal5PacketSize) + MSNdis_AtmMaxAal5PacketSize_NdisAtmMaxAal5PacketSize_SIZE) - -// MSNdis_AtmReceiveCellsOk - MSNdis_AtmReceiveCellsOk -#define MSNdis_AtmReceiveCellsOkGuid \ - { 0x0a21480a,0xe35f,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmReceiveCellsOk_GUID, \ - 0x0a21480a,0xe35f,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmReceiveCellsOk -{ - // - ULONGLONG NdisAtmReceiveCellsOk; - #define MSNdis_AtmReceiveCellsOk_NdisAtmReceiveCellsOk_SIZE sizeof(ULONGLONG) - #define MSNdis_AtmReceiveCellsOk_NdisAtmReceiveCellsOk_ID 1 - -} MSNdis_AtmReceiveCellsOk, *PMSNdis_AtmReceiveCellsOk; - -#define MSNdis_AtmReceiveCellsOk_SIZE (FIELD_OFFSET(MSNdis_AtmReceiveCellsOk, NdisAtmReceiveCellsOk) + MSNdis_AtmReceiveCellsOk_NdisAtmReceiveCellsOk_SIZE) - -// MSNdis_AtmTransmitCellsOk - MSNdis_AtmTransmitCellsOk -#define MSNdis_AtmTransmitCellsOkGuid \ - { 0x0a21480b,0xe35f,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmTransmitCellsOk_GUID, \ - 0x0a21480b,0xe35f,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmTransmitCellsOk -{ - // - ULONGLONG NdisAtmTransmitCellsOk; - #define MSNdis_AtmTransmitCellsOk_NdisAtmTransmitCellsOk_SIZE sizeof(ULONGLONG) - #define MSNdis_AtmTransmitCellsOk_NdisAtmTransmitCellsOk_ID 1 - -} MSNdis_AtmTransmitCellsOk, *PMSNdis_AtmTransmitCellsOk; - -#define MSNdis_AtmTransmitCellsOk_SIZE (FIELD_OFFSET(MSNdis_AtmTransmitCellsOk, NdisAtmTransmitCellsOk) + MSNdis_AtmTransmitCellsOk_NdisAtmTransmitCellsOk_SIZE) - -// MSNdis_AtmReceiveCellsDropped - MSNdis_AtmReceiveCellsDropped -#define MSNdis_AtmReceiveCellsDroppedGuid \ - { 0x0a21480c,0xe35f,0x11d0, { 0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_AtmReceiveCellsDropped_GUID, \ - 0x0a21480c,0xe35f,0x11d0,0x96,0x92,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_AtmReceiveCellsDropped -{ - // - ULONGLONG NdisAtmReceiveCellsDropped; - #define MSNdis_AtmReceiveCellsDropped_NdisAtmReceiveCellsDropped_SIZE sizeof(ULONGLONG) - #define MSNdis_AtmReceiveCellsDropped_NdisAtmReceiveCellsDropped_ID 1 - -} MSNdis_AtmReceiveCellsDropped, *PMSNdis_AtmReceiveCellsDropped; - -#define MSNdis_AtmReceiveCellsDropped_SIZE (FIELD_OFFSET(MSNdis_AtmReceiveCellsDropped, NdisAtmReceiveCellsDropped) + MSNdis_AtmReceiveCellsDropped_NdisAtmReceiveCellsDropped_SIZE) - -// MSNdis_EthernetPermanentAddress - MSNdis_EthernetPermanentAddress -#define MSNdis_EthernetPermanentAddressGuid \ - { 0x447956ff,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EthernetPermanentAddress_GUID, \ - 0x447956ff,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_EthernetPermanentAddress -{ - // - MSNdis_NetworkAddress NdisPermanentAddress; - #define MSNdis_EthernetPermanentAddress_NdisPermanentAddress_SIZE sizeof(MSNdis_NetworkAddress) - #define MSNdis_EthernetPermanentAddress_NdisPermanentAddress_ID 1 - -} MSNdis_EthernetPermanentAddress, *PMSNdis_EthernetPermanentAddress; - -#define MSNdis_EthernetPermanentAddress_SIZE (FIELD_OFFSET(MSNdis_EthernetPermanentAddress, NdisPermanentAddress) + MSNdis_EthernetPermanentAddress_NdisPermanentAddress_SIZE) - -// MSNdis_EthernetCurrentAddress - MSNdis_EthernetCurrentAddress -#define MSNdis_EthernetCurrentAddressGuid \ - { 0x44795700,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EthernetCurrentAddress_GUID, \ - 0x44795700,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_EthernetCurrentAddress -{ - // - MSNdis_NetworkAddress NdisCurrentAddress; - #define MSNdis_EthernetCurrentAddress_NdisCurrentAddress_SIZE sizeof(MSNdis_NetworkAddress) - #define MSNdis_EthernetCurrentAddress_NdisCurrentAddress_ID 1 - -} MSNdis_EthernetCurrentAddress, *PMSNdis_EthernetCurrentAddress; - -#define MSNdis_EthernetCurrentAddress_SIZE (FIELD_OFFSET(MSNdis_EthernetCurrentAddress, NdisCurrentAddress) + MSNdis_EthernetCurrentAddress_NdisCurrentAddress_SIZE) - -// MSNdis_EthernetMulticastList - MSNdis_EthernetMulticastList -#define MSNdis_EthernetMulticastListGuid \ - { 0x44795701,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EthernetMulticastList_GUID, \ - 0x44795701,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_EthernetMulticastList -{ - // - ULONG NumberElements; - #define MSNdis_EthernetMulticastList_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_EthernetMulticastList_NumberElements_ID 1 - - // - MSNdis_NetworkAddress NdisMulticastList[1]; - #define MSNdis_EthernetMulticastList_NdisMulticastList_ID 2 - -} MSNdis_EthernetMulticastList, *PMSNdis_EthernetMulticastList; - -// MSNdis_EthernetMaximumMulticastListSize - MSNdis_EthernetMaximumMulticastListSize -#define MSNdis_EthernetMaximumMulticastListSizeGuid \ - { 0x44795702,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EthernetMaximumMulticastListSize_GUID, \ - 0x44795702,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_EthernetMaximumMulticastListSize -{ - // - ULONG NdisEthernetMaximumMulticastListSize; - #define MSNdis_EthernetMaximumMulticastListSize_NdisEthernetMaximumMulticastListSize_SIZE sizeof(ULONG) - #define MSNdis_EthernetMaximumMulticastListSize_NdisEthernetMaximumMulticastListSize_ID 1 - -} MSNdis_EthernetMaximumMulticastListSize, *PMSNdis_EthernetMaximumMulticastListSize; - -#define MSNdis_EthernetMaximumMulticastListSize_SIZE (FIELD_OFFSET(MSNdis_EthernetMaximumMulticastListSize, NdisEthernetMaximumMulticastListSize) + MSNdis_EthernetMaximumMulticastListSize_NdisEthernetMaximumMulticastListSize_SIZE) - -// MSNdis_EthernetMacOptions - MSNdis_EthernetMacOptions -#define MSNdis_EthernetMacOptionsGuid \ - { 0x44795703,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EthernetMacOptions_GUID, \ - 0x44795703,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_EthernetMacOptions -{ - // - ULONG NdisEthernetMacOptions; - #define MSNdis_EthernetMacOptions_NdisEthernetMacOptions_SIZE sizeof(ULONG) - #define MSNdis_EthernetMacOptions_NdisEthernetMacOptions_ID 1 - -} MSNdis_EthernetMacOptions, *PMSNdis_EthernetMacOptions; - -#define MSNdis_EthernetMacOptions_SIZE (FIELD_OFFSET(MSNdis_EthernetMacOptions, NdisEthernetMacOptions) + MSNdis_EthernetMacOptions_NdisEthernetMacOptions_SIZE) - -// MSNdis_EthernetReceiveErrorAlignment - MSNdis_EthernetReceiveErrorAlignment -#define MSNdis_EthernetReceiveErrorAlignmentGuid \ - { 0x44795704,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EthernetReceiveErrorAlignment_GUID, \ - 0x44795704,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_EthernetReceiveErrorAlignment -{ - // - ULONG NdisEthernetReceiveErrorAlignment; - #define MSNdis_EthernetReceiveErrorAlignment_NdisEthernetReceiveErrorAlignment_SIZE sizeof(ULONG) - #define MSNdis_EthernetReceiveErrorAlignment_NdisEthernetReceiveErrorAlignment_ID 1 - -} MSNdis_EthernetReceiveErrorAlignment, *PMSNdis_EthernetReceiveErrorAlignment; - -#define MSNdis_EthernetReceiveErrorAlignment_SIZE (FIELD_OFFSET(MSNdis_EthernetReceiveErrorAlignment, NdisEthernetReceiveErrorAlignment) + MSNdis_EthernetReceiveErrorAlignment_NdisEthernetReceiveErrorAlignment_SIZE) - -// MSNdis_EthernetOneTransmitCollision - MSNdis_EthernetOneTransmitCollision -#define MSNdis_EthernetOneTransmitCollisionGuid \ - { 0x44795705,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EthernetOneTransmitCollision_GUID, \ - 0x44795705,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_EthernetOneTransmitCollision -{ - // - ULONG NdisEthernetOneTransmitCollision; - #define MSNdis_EthernetOneTransmitCollision_NdisEthernetOneTransmitCollision_SIZE sizeof(ULONG) - #define MSNdis_EthernetOneTransmitCollision_NdisEthernetOneTransmitCollision_ID 1 - -} MSNdis_EthernetOneTransmitCollision, *PMSNdis_EthernetOneTransmitCollision; - -#define MSNdis_EthernetOneTransmitCollision_SIZE (FIELD_OFFSET(MSNdis_EthernetOneTransmitCollision, NdisEthernetOneTransmitCollision) + MSNdis_EthernetOneTransmitCollision_NdisEthernetOneTransmitCollision_SIZE) - -// MSNdis_EthernetMoreTransmitCollisions - MSNdis_EthernetMoreTransmitCollisions -#define MSNdis_EthernetMoreTransmitCollisionsGuid \ - { 0x44795706,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EthernetMoreTransmitCollisions_GUID, \ - 0x44795706,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_EthernetMoreTransmitCollisions -{ - // - ULONG NdisEthernetMoreTransmitCollisions; - #define MSNdis_EthernetMoreTransmitCollisions_NdisEthernetMoreTransmitCollisions_SIZE sizeof(ULONG) - #define MSNdis_EthernetMoreTransmitCollisions_NdisEthernetMoreTransmitCollisions_ID 1 - -} MSNdis_EthernetMoreTransmitCollisions, *PMSNdis_EthernetMoreTransmitCollisions; - -#define MSNdis_EthernetMoreTransmitCollisions_SIZE (FIELD_OFFSET(MSNdis_EthernetMoreTransmitCollisions, NdisEthernetMoreTransmitCollisions) + MSNdis_EthernetMoreTransmitCollisions_NdisEthernetMoreTransmitCollisions_SIZE) - -// MSNdis_TokenRingPermanentAddress - MSNdis_TokenRingPermanentAddress -#define MSNdis_TokenRingPermanentAddressGuid \ - { 0x44795707,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TokenRingPermanentAddress_GUID, \ - 0x44795707,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TokenRingPermanentAddress -{ - // - MSNdis_NetworkAddress NdisPermanentAddress; - #define MSNdis_TokenRingPermanentAddress_NdisPermanentAddress_SIZE sizeof(MSNdis_NetworkAddress) - #define MSNdis_TokenRingPermanentAddress_NdisPermanentAddress_ID 1 - -} MSNdis_TokenRingPermanentAddress, *PMSNdis_TokenRingPermanentAddress; - -#define MSNdis_TokenRingPermanentAddress_SIZE (FIELD_OFFSET(MSNdis_TokenRingPermanentAddress, NdisPermanentAddress) + MSNdis_TokenRingPermanentAddress_NdisPermanentAddress_SIZE) - -// MSNdis_TokenRingCurrentAddress - MSNdis_TokenRingCurrentAddress -#define MSNdis_TokenRingCurrentAddressGuid \ - { 0x44795708,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TokenRingCurrentAddress_GUID, \ - 0x44795708,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TokenRingCurrentAddress -{ - // - MSNdis_NetworkAddress NdisCurrentAddress; - #define MSNdis_TokenRingCurrentAddress_NdisCurrentAddress_SIZE sizeof(MSNdis_NetworkAddress) - #define MSNdis_TokenRingCurrentAddress_NdisCurrentAddress_ID 1 - -} MSNdis_TokenRingCurrentAddress, *PMSNdis_TokenRingCurrentAddress; - -#define MSNdis_TokenRingCurrentAddress_SIZE (FIELD_OFFSET(MSNdis_TokenRingCurrentAddress, NdisCurrentAddress) + MSNdis_TokenRingCurrentAddress_NdisCurrentAddress_SIZE) - -// MSNdis_TokenRingCurrentFunctional - MSNdis_TokenRingCurrentFunctional -#define MSNdis_TokenRingCurrentFunctionalGuid \ - { 0x44795709,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TokenRingCurrentFunctional_GUID, \ - 0x44795709,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TokenRingCurrentFunctional -{ - // - ULONG NdisTokenRingCurrentFunctional; - #define MSNdis_TokenRingCurrentFunctional_NdisTokenRingCurrentFunctional_SIZE sizeof(ULONG) - #define MSNdis_TokenRingCurrentFunctional_NdisTokenRingCurrentFunctional_ID 1 - -} MSNdis_TokenRingCurrentFunctional, *PMSNdis_TokenRingCurrentFunctional; - -#define MSNdis_TokenRingCurrentFunctional_SIZE (FIELD_OFFSET(MSNdis_TokenRingCurrentFunctional, NdisTokenRingCurrentFunctional) + MSNdis_TokenRingCurrentFunctional_NdisTokenRingCurrentFunctional_SIZE) - -// MSNdis_TokenRingCurrentGroup - MSNdis_TokenRingCurrentGroup -#define MSNdis_TokenRingCurrentGroupGuid \ - { 0x4479570a,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TokenRingCurrentGroup_GUID, \ - 0x4479570a,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TokenRingCurrentGroup -{ - // - ULONG NdisTokenRingCurrentGroup; - #define MSNdis_TokenRingCurrentGroup_NdisTokenRingCurrentGroup_SIZE sizeof(ULONG) - #define MSNdis_TokenRingCurrentGroup_NdisTokenRingCurrentGroup_ID 1 - -} MSNdis_TokenRingCurrentGroup, *PMSNdis_TokenRingCurrentGroup; - -#define MSNdis_TokenRingCurrentGroup_SIZE (FIELD_OFFSET(MSNdis_TokenRingCurrentGroup, NdisTokenRingCurrentGroup) + MSNdis_TokenRingCurrentGroup_NdisTokenRingCurrentGroup_SIZE) - -// MSNdis_TokenRingLastOpenStatus - MSNdis_TokenRingLastOpenStatus -#define MSNdis_TokenRingLastOpenStatusGuid \ - { 0x4479570b,0xa61b,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TokenRingLastOpenStatus_GUID, \ - 0x4479570b,0xa61b,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TokenRingLastOpenStatus -{ - // - ULONG NdisTokenRingLastOpenStatus; - #define MSNdis_TokenRingLastOpenStatus_NdisTokenRingLastOpenStatus_SIZE sizeof(ULONG) - #define MSNdis_TokenRingLastOpenStatus_NdisTokenRingLastOpenStatus_ID 1 - -} MSNdis_TokenRingLastOpenStatus, *PMSNdis_TokenRingLastOpenStatus; - -#define MSNdis_TokenRingLastOpenStatus_SIZE (FIELD_OFFSET(MSNdis_TokenRingLastOpenStatus, NdisTokenRingLastOpenStatus) + MSNdis_TokenRingLastOpenStatus_NdisTokenRingLastOpenStatus_SIZE) - -// MSNdis_TokenRingCurrentRingStatus - MSNdis_TokenRingCurrentRingStatus -#define MSNdis_TokenRingCurrentRingStatusGuid \ - { 0x890a36ec,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TokenRingCurrentRingStatus_GUID, \ - 0x890a36ec,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TokenRingCurrentRingStatus -{ - // - ULONG NdisTokenRingCurrentRingStatus; - #define MSNdis_TokenRingCurrentRingStatus_NdisTokenRingCurrentRingStatus_SIZE sizeof(ULONG) - #define MSNdis_TokenRingCurrentRingStatus_NdisTokenRingCurrentRingStatus_ID 1 - -} MSNdis_TokenRingCurrentRingStatus, *PMSNdis_TokenRingCurrentRingStatus; - -#define MSNdis_TokenRingCurrentRingStatus_SIZE (FIELD_OFFSET(MSNdis_TokenRingCurrentRingStatus, NdisTokenRingCurrentRingStatus) + MSNdis_TokenRingCurrentRingStatus_NdisTokenRingCurrentRingStatus_SIZE) - -// MSNdis_TokenRingCurrentRingState - MSNdis_TokenRingCurrentRingState -#define MSNdis_TokenRingCurrentRingStateGuid \ - { 0xacf14032,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TokenRingCurrentRingState_GUID, \ - 0xacf14032,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TokenRingCurrentRingState -{ - // - ULONG NdisTokenRingCurrentRingState; - #define MSNdis_TokenRingCurrentRingState_NdisTokenRingCurrentRingState_SIZE sizeof(ULONG) - #define MSNdis_TokenRingCurrentRingState_NdisTokenRingCurrentRingState_ID 1 - -} MSNdis_TokenRingCurrentRingState, *PMSNdis_TokenRingCurrentRingState; - -#define MSNdis_TokenRingCurrentRingState_SIZE (FIELD_OFFSET(MSNdis_TokenRingCurrentRingState, NdisTokenRingCurrentRingState) + MSNdis_TokenRingCurrentRingState_NdisTokenRingCurrentRingState_SIZE) - -// MSNdis_TokenRingLineErrors - MSNdis_TokenRingLineErrors -#define MSNdis_TokenRingLineErrorsGuid \ - { 0xacf14033,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TokenRingLineErrors_GUID, \ - 0xacf14033,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TokenRingLineErrors -{ - // - ULONG NdisTokenRingLineErrors; - #define MSNdis_TokenRingLineErrors_NdisTokenRingLineErrors_SIZE sizeof(ULONG) - #define MSNdis_TokenRingLineErrors_NdisTokenRingLineErrors_ID 1 - -} MSNdis_TokenRingLineErrors, *PMSNdis_TokenRingLineErrors; - -#define MSNdis_TokenRingLineErrors_SIZE (FIELD_OFFSET(MSNdis_TokenRingLineErrors, NdisTokenRingLineErrors) + MSNdis_TokenRingLineErrors_NdisTokenRingLineErrors_SIZE) - -// MSNdis_TokenRingLostFrames - MSNdis_TokenRingLostFrames -#define MSNdis_TokenRingLostFramesGuid \ - { 0xacf14034,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TokenRingLostFrames_GUID, \ - 0xacf14034,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_TokenRingLostFrames -{ - // - ULONG NdisTokenRingLostFrames; - #define MSNdis_TokenRingLostFrames_NdisTokenRingLostFrames_SIZE sizeof(ULONG) - #define MSNdis_TokenRingLostFrames_NdisTokenRingLostFrames_ID 1 - -} MSNdis_TokenRingLostFrames, *PMSNdis_TokenRingLostFrames; - -#define MSNdis_TokenRingLostFrames_SIZE (FIELD_OFFSET(MSNdis_TokenRingLostFrames, NdisTokenRingLostFrames) + MSNdis_TokenRingLostFrames_NdisTokenRingLostFrames_SIZE) - -// MSNdis_FddiLongPermanentAddress - MSNdis_FddiLongPermanentAddress -#define MSNdis_FddiLongPermanentAddressGuid \ - { 0xacf14035,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiLongPermanentAddress_GUID, \ - 0xacf14035,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiLongPermanentAddress -{ - // - MSNdis_NetworkAddress NdisPermanentAddress; - #define MSNdis_FddiLongPermanentAddress_NdisPermanentAddress_SIZE sizeof(MSNdis_NetworkAddress) - #define MSNdis_FddiLongPermanentAddress_NdisPermanentAddress_ID 1 - -} MSNdis_FddiLongPermanentAddress, *PMSNdis_FddiLongPermanentAddress; - -#define MSNdis_FddiLongPermanentAddress_SIZE (FIELD_OFFSET(MSNdis_FddiLongPermanentAddress, NdisPermanentAddress) + MSNdis_FddiLongPermanentAddress_NdisPermanentAddress_SIZE) - -// MSNdis_FddiLongCurrentAddress - MSNdis_FddiLongCurrentAddress -#define MSNdis_FddiLongCurrentAddressGuid \ - { 0xacf14036,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiLongCurrentAddress_GUID, \ - 0xacf14036,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiLongCurrentAddress -{ - // - MSNdis_NetworkAddress NdisCurrentAddress; - #define MSNdis_FddiLongCurrentAddress_NdisCurrentAddress_SIZE sizeof(MSNdis_NetworkAddress) - #define MSNdis_FddiLongCurrentAddress_NdisCurrentAddress_ID 1 - -} MSNdis_FddiLongCurrentAddress, *PMSNdis_FddiLongCurrentAddress; - -#define MSNdis_FddiLongCurrentAddress_SIZE (FIELD_OFFSET(MSNdis_FddiLongCurrentAddress, NdisCurrentAddress) + MSNdis_FddiLongCurrentAddress_NdisCurrentAddress_SIZE) - -// MSNdis_FddiLongMulticastList - MSNdis_FddiLongMulticastList -#define MSNdis_FddiLongMulticastListGuid \ - { 0xacf14037,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiLongMulticastList_GUID, \ - 0xacf14037,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiLongMulticastList -{ - // - ULONG NumberElements; - #define MSNdis_FddiLongMulticastList_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_FddiLongMulticastList_NumberElements_ID 1 - - // - MSNdis_NetworkAddress NdisMulticastList[1]; - #define MSNdis_FddiLongMulticastList_NdisMulticastList_ID 2 - -} MSNdis_FddiLongMulticastList, *PMSNdis_FddiLongMulticastList; - -// MSNdis_FddiLongMaximumListSize - MSNdis_FddiLongMaximumListSize -#define MSNdis_FddiLongMaximumListSizeGuid \ - { 0xacf14038,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiLongMaximumListSize_GUID, \ - 0xacf14038,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiLongMaximumListSize -{ - // - ULONG NdisFddiLongMaximumListSize; - #define MSNdis_FddiLongMaximumListSize_NdisFddiLongMaximumListSize_SIZE sizeof(ULONG) - #define MSNdis_FddiLongMaximumListSize_NdisFddiLongMaximumListSize_ID 1 - -} MSNdis_FddiLongMaximumListSize, *PMSNdis_FddiLongMaximumListSize; - -#define MSNdis_FddiLongMaximumListSize_SIZE (FIELD_OFFSET(MSNdis_FddiLongMaximumListSize, NdisFddiLongMaximumListSize) + MSNdis_FddiLongMaximumListSize_NdisFddiLongMaximumListSize_SIZE) - -// MSNdis_FddiShortPermanentAddress - MSNdis_FddiShortPermanentAddress -#define MSNdis_FddiShortPermanentAddressGuid \ - { 0xacf14039,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiShortPermanentAddress_GUID, \ - 0xacf14039,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiShortPermanentAddress -{ - // - MSNdis_NetworkShortAddress NdisPermanentAddress; - #define MSNdis_FddiShortPermanentAddress_NdisPermanentAddress_SIZE sizeof(MSNdis_NetworkShortAddress) - #define MSNdis_FddiShortPermanentAddress_NdisPermanentAddress_ID 1 - -} MSNdis_FddiShortPermanentAddress, *PMSNdis_FddiShortPermanentAddress; - -#define MSNdis_FddiShortPermanentAddress_SIZE (FIELD_OFFSET(MSNdis_FddiShortPermanentAddress, NdisPermanentAddress) + MSNdis_FddiShortPermanentAddress_NdisPermanentAddress_SIZE) - -// MSNdis_FddiShortCurrentAddress - MSNdis_FddiShortCurrentAddress -#define MSNdis_FddiShortCurrentAddressGuid \ - { 0xacf1403a,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiShortCurrentAddress_GUID, \ - 0xacf1403a,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiShortCurrentAddress -{ - // - MSNdis_NetworkShortAddress NdisCurrentAddress; - #define MSNdis_FddiShortCurrentAddress_NdisCurrentAddress_SIZE sizeof(MSNdis_NetworkShortAddress) - #define MSNdis_FddiShortCurrentAddress_NdisCurrentAddress_ID 1 - -} MSNdis_FddiShortCurrentAddress, *PMSNdis_FddiShortCurrentAddress; - -#define MSNdis_FddiShortCurrentAddress_SIZE (FIELD_OFFSET(MSNdis_FddiShortCurrentAddress, NdisCurrentAddress) + MSNdis_FddiShortCurrentAddress_NdisCurrentAddress_SIZE) - -// MSNdis_FddiShortMulticastList - MSNdis_FddiShortMulticastList -#define MSNdis_FddiShortMulticastListGuid \ - { 0xacf1403b,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiShortMulticastList_GUID, \ - 0xacf1403b,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiShortMulticastList -{ - // - ULONG NumberElements; - #define MSNdis_FddiShortMulticastList_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_FddiShortMulticastList_NumberElements_ID 1 - - // - MSNdis_NetworkShortAddress NdisMulticastList[1]; - #define MSNdis_FddiShortMulticastList_NdisMulticastList_ID 2 - -} MSNdis_FddiShortMulticastList, *PMSNdis_FddiShortMulticastList; - -// MSNdis_FddiShortMaximumListSize - MSNdis_FddiShortMaximumListSize -#define MSNdis_FddiShortMaximumListSizeGuid \ - { 0xacf1403c,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiShortMaximumListSize_GUID, \ - 0xacf1403c,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiShortMaximumListSize -{ - // - ULONG NdisFddiShortMaximumListSize; - #define MSNdis_FddiShortMaximumListSize_NdisFddiShortMaximumListSize_SIZE sizeof(ULONG) - #define MSNdis_FddiShortMaximumListSize_NdisFddiShortMaximumListSize_ID 1 - -} MSNdis_FddiShortMaximumListSize, *PMSNdis_FddiShortMaximumListSize; - -#define MSNdis_FddiShortMaximumListSize_SIZE (FIELD_OFFSET(MSNdis_FddiShortMaximumListSize, NdisFddiShortMaximumListSize) + MSNdis_FddiShortMaximumListSize_NdisFddiShortMaximumListSize_SIZE) - -// MSNdis_FddiAttachmentType - MSNdis_FddiAttachmentType -#define MSNdis_FddiAttachmentTypeGuid \ - { 0xacf1403d,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiAttachmentType_GUID, \ - 0xacf1403d,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiAttachmentType -{ - // - ULONG NdisFddiAttachmentType; - #define MSNdis_FddiAttachmentType_NdisFddiAttachmentType_SIZE sizeof(ULONG) - #define MSNdis_FddiAttachmentType_NdisFddiAttachmentType_ID 1 - -} MSNdis_FddiAttachmentType, *PMSNdis_FddiAttachmentType; - -#define MSNdis_FddiAttachmentType_SIZE (FIELD_OFFSET(MSNdis_FddiAttachmentType, NdisFddiAttachmentType) + MSNdis_FddiAttachmentType_NdisFddiAttachmentType_SIZE) - -// MSNdis_FddiUpstreamNodeLong - MSNdis_FddiUpstreamNodeLong -#define MSNdis_FddiUpstreamNodeLongGuid \ - { 0xacf1403e,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiUpstreamNodeLong_GUID, \ - 0xacf1403e,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiUpstreamNodeLong -{ - // - MSNdis_NetworkAddress NdisFddiUpstreamNodeLong; - #define MSNdis_FddiUpstreamNodeLong_NdisFddiUpstreamNodeLong_SIZE sizeof(MSNdis_NetworkAddress) - #define MSNdis_FddiUpstreamNodeLong_NdisFddiUpstreamNodeLong_ID 1 - -} MSNdis_FddiUpstreamNodeLong, *PMSNdis_FddiUpstreamNodeLong; - -#define MSNdis_FddiUpstreamNodeLong_SIZE (FIELD_OFFSET(MSNdis_FddiUpstreamNodeLong, NdisFddiUpstreamNodeLong) + MSNdis_FddiUpstreamNodeLong_NdisFddiUpstreamNodeLong_SIZE) - -// MSNdis_FddiDownstreamNodeLong - MSNdis_FddiDownstreamNodeLong -#define MSNdis_FddiDownstreamNodeLongGuid \ - { 0xacf1403f,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiDownstreamNodeLong_GUID, \ - 0xacf1403f,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiDownstreamNodeLong -{ - // - MSNdis_NetworkAddress NdisFddiDownstreamNodeLong; - #define MSNdis_FddiDownstreamNodeLong_NdisFddiDownstreamNodeLong_SIZE sizeof(MSNdis_NetworkAddress) - #define MSNdis_FddiDownstreamNodeLong_NdisFddiDownstreamNodeLong_ID 1 - -} MSNdis_FddiDownstreamNodeLong, *PMSNdis_FddiDownstreamNodeLong; - -#define MSNdis_FddiDownstreamNodeLong_SIZE (FIELD_OFFSET(MSNdis_FddiDownstreamNodeLong, NdisFddiDownstreamNodeLong) + MSNdis_FddiDownstreamNodeLong_NdisFddiDownstreamNodeLong_SIZE) - -// MSNdis_FddiFrameErrors - MSNdis_FddiFrameErrors -#define MSNdis_FddiFrameErrorsGuid \ - { 0xacf14040,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiFrameErrors_GUID, \ - 0xacf14040,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiFrameErrors -{ - // - ULONG NdisFddiFrameErrors; - #define MSNdis_FddiFrameErrors_NdisFddiFrameErrors_SIZE sizeof(ULONG) - #define MSNdis_FddiFrameErrors_NdisFddiFrameErrors_ID 1 - -} MSNdis_FddiFrameErrors, *PMSNdis_FddiFrameErrors; - -#define MSNdis_FddiFrameErrors_SIZE (FIELD_OFFSET(MSNdis_FddiFrameErrors, NdisFddiFrameErrors) + MSNdis_FddiFrameErrors_NdisFddiFrameErrors_SIZE) - -// MSNdis_FddiFramesLost - MSNdis_FddiFramesLost -#define MSNdis_FddiFramesLostGuid \ - { 0xacf14041,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiFramesLost_GUID, \ - 0xacf14041,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiFramesLost -{ - // - ULONG NdisFddiFramesLost; - #define MSNdis_FddiFramesLost_NdisFddiFramesLost_SIZE sizeof(ULONG) - #define MSNdis_FddiFramesLost_NdisFddiFramesLost_ID 1 - -} MSNdis_FddiFramesLost, *PMSNdis_FddiFramesLost; - -#define MSNdis_FddiFramesLost_SIZE (FIELD_OFFSET(MSNdis_FddiFramesLost, NdisFddiFramesLost) + MSNdis_FddiFramesLost_NdisFddiFramesLost_SIZE) - -// MSNdis_FddiRingManagmentState - MSNdis_FddiRingManagmentState -#define MSNdis_FddiRingManagmentStateGuid \ - { 0xacf14042,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiRingManagmentState_GUID, \ - 0xacf14042,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiRingManagmentState -{ - // - ULONG NdisFddiRingManagmentState; - #define MSNdis_FddiRingManagmentState_NdisFddiRingManagmentState_SIZE sizeof(ULONG) - #define MSNdis_FddiRingManagmentState_NdisFddiRingManagmentState_ID 1 - -} MSNdis_FddiRingManagmentState, *PMSNdis_FddiRingManagmentState; - -#define MSNdis_FddiRingManagmentState_SIZE (FIELD_OFFSET(MSNdis_FddiRingManagmentState, NdisFddiRingManagmentState) + MSNdis_FddiRingManagmentState_NdisFddiRingManagmentState_SIZE) - -// MSNdis_FddiLctFailures - MSNdis_FddiLctFailures -#define MSNdis_FddiLctFailuresGuid \ - { 0xacf14043,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiLctFailures_GUID, \ - 0xacf14043,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiLctFailures -{ - // - ULONG NdisFddiLctFailures; - #define MSNdis_FddiLctFailures_NdisFddiLctFailures_SIZE sizeof(ULONG) - #define MSNdis_FddiLctFailures_NdisFddiLctFailures_ID 1 - -} MSNdis_FddiLctFailures, *PMSNdis_FddiLctFailures; - -#define MSNdis_FddiLctFailures_SIZE (FIELD_OFFSET(MSNdis_FddiLctFailures, NdisFddiLctFailures) + MSNdis_FddiLctFailures_NdisFddiLctFailures_SIZE) - -// MSNdis_FddiLemRejects - MSNdis_FddiLemRejects -#define MSNdis_FddiLemRejectsGuid \ - { 0xacf14044,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiLemRejects_GUID, \ - 0xacf14044,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiLemRejects -{ - // - ULONG NdisFddiLemRejects; - #define MSNdis_FddiLemRejects_NdisFddiLemRejects_SIZE sizeof(ULONG) - #define MSNdis_FddiLemRejects_NdisFddiLemRejects_ID 1 - -} MSNdis_FddiLemRejects, *PMSNdis_FddiLemRejects; - -#define MSNdis_FddiLemRejects_SIZE (FIELD_OFFSET(MSNdis_FddiLemRejects, NdisFddiLemRejects) + MSNdis_FddiLemRejects_NdisFddiLemRejects_SIZE) - -// MSNdis_FddiLConnectionState - MSNdis_FddiLConnectionState -#define MSNdis_FddiLConnectionStateGuid \ - { 0xacf14045,0xa61c,0x11d0, { 0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_FddiLConnectionState_GUID, \ - 0xacf14045,0xa61c,0x11d0,0x8d,0xd4,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_FddiLConnectionState -{ - // - ULONG NdisFddiLConnectionState; - #define MSNdis_FddiLConnectionState_NdisFddiLConnectionState_SIZE sizeof(ULONG) - #define MSNdis_FddiLConnectionState_NdisFddiLConnectionState_ID 1 - -} MSNdis_FddiLConnectionState, *PMSNdis_FddiLConnectionState; - -#define MSNdis_FddiLConnectionState_SIZE (FIELD_OFFSET(MSNdis_FddiLConnectionState, NdisFddiLConnectionState) + MSNdis_FddiLConnectionState_NdisFddiLConnectionState_SIZE) - -// MSNdis_ObjectHeader - MSNdis_ObjectHeader -#define MSNdis_ObjectHeaderGuid \ - { 0x2b1831b2,0x2216,0x4ede, { 0xa4,0x69,0x9f,0xe3,0xdd,0x6d,0x5a,0x7e } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ObjectHeader_GUID, \ - 0x2b1831b2,0x2216,0x4ede,0xa4,0x69,0x9f,0xe3,0xdd,0x6d,0x5a,0x7e); -#endif - - -typedef struct _MSNdis_ObjectHeader -{ - // - UCHAR Type; - #define MSNdis_ObjectHeader_Type_SIZE sizeof(UCHAR) - #define MSNdis_ObjectHeader_Type_ID 1 - - // - UCHAR Revision; - #define MSNdis_ObjectHeader_Revision_SIZE sizeof(UCHAR) - #define MSNdis_ObjectHeader_Revision_ID 2 - - // - USHORT Size; - #define MSNdis_ObjectHeader_Size_SIZE sizeof(USHORT) - #define MSNdis_ObjectHeader_Size_ID 3 - -} MSNdis_ObjectHeader, *PMSNdis_ObjectHeader; - -#define MSNdis_ObjectHeader_SIZE (FIELD_OFFSET(MSNdis_ObjectHeader, Size) + MSNdis_ObjectHeader_Size_SIZE) - -// MSNdis_WmiMethodHeader - MSNdis_WmiMethodHeader -#define MSNdis_WmiMethodHeaderGuid \ - { 0xe3eac9dd,0x2fd3,0x4963, { 0xbf,0xfd,0xb4,0x69,0x28,0x88,0xc0,0xd4 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiMethodHeader_GUID, \ - 0xe3eac9dd,0x2fd3,0x4963,0xbf,0xfd,0xb4,0x69,0x28,0x88,0xc0,0xd4); -#endif - - -typedef struct _MSNdis_WmiMethodHeader -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_WmiMethodHeader_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_WmiMethodHeader_Header_ID 1 - - // - ULONG PortNumber; - #define MSNdis_WmiMethodHeader_PortNumber_SIZE sizeof(ULONG) - #define MSNdis_WmiMethodHeader_PortNumber_ID 2 - - // - ULONGLONG NetLuid; - #define MSNdis_WmiMethodHeader_NetLuid_SIZE sizeof(ULONGLONG) - #define MSNdis_WmiMethodHeader_NetLuid_ID 3 - - // - ULONGLONG RequestId; - #define MSNdis_WmiMethodHeader_RequestId_SIZE sizeof(ULONGLONG) - #define MSNdis_WmiMethodHeader_RequestId_ID 4 - - // - ULONG Timeout; - #define MSNdis_WmiMethodHeader_Timeout_SIZE sizeof(ULONG) - #define MSNdis_WmiMethodHeader_Timeout_ID 5 - - // - ULONG Padding; - #define MSNdis_WmiMethodHeader_Padding_SIZE sizeof(ULONG) - #define MSNdis_WmiMethodHeader_Padding_ID 6 - -} MSNdis_WmiMethodHeader, *PMSNdis_WmiMethodHeader; - -#define MSNdis_WmiMethodHeader_SIZE (FIELD_OFFSET(MSNdis_WmiMethodHeader, Padding) + MSNdis_WmiMethodHeader_Padding_SIZE) - -// MSNdis_WmiSetHeader - MSNdis_WmiSetHeader -#define MSNdis_WmiSetHeaderGuid \ - { 0x3b5605d8,0x1aaf,0x4ff6, { 0x85,0xb9,0xbc,0x5f,0xb9,0x73,0xdc,0x54 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiSetHeader_GUID, \ - 0x3b5605d8,0x1aaf,0x4ff6,0x85,0xb9,0xbc,0x5f,0xb9,0x73,0xdc,0x54); -#endif - - -typedef struct _MSNdis_WmiSetHeader -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_WmiSetHeader_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_WmiSetHeader_Header_ID 1 - - // - ULONG PortNumber; - #define MSNdis_WmiSetHeader_PortNumber_SIZE sizeof(ULONG) - #define MSNdis_WmiSetHeader_PortNumber_ID 2 - - // - ULONGLONG NetLuid; - #define MSNdis_WmiSetHeader_NetLuid_SIZE sizeof(ULONGLONG) - #define MSNdis_WmiSetHeader_NetLuid_ID 3 - - // - ULONGLONG RequestId; - #define MSNdis_WmiSetHeader_RequestId_SIZE sizeof(ULONGLONG) - #define MSNdis_WmiSetHeader_RequestId_ID 4 - - // - ULONG Timeout; - #define MSNdis_WmiSetHeader_Timeout_SIZE sizeof(ULONG) - #define MSNdis_WmiSetHeader_Timeout_ID 5 - - // - ULONG Padding; - #define MSNdis_WmiSetHeader_Padding_SIZE sizeof(ULONG) - #define MSNdis_WmiSetHeader_Padding_ID 6 - -} MSNdis_WmiSetHeader, *PMSNdis_WmiSetHeader; - -#define MSNdis_WmiSetHeader_SIZE (FIELD_OFFSET(MSNdis_WmiSetHeader, Padding) + MSNdis_WmiSetHeader_Padding_SIZE) - -// MSNdis_WmiOutputInfo - MSNdis_WmiOutputInfo -#define MSNdis_WmiOutputInfoGuid \ - { 0x7510bb9d,0xdf70,0x4f7e, { 0xba,0x07,0xe2,0x9d,0x33,0x0b,0x3c,0xc5 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiOutputInfo_GUID, \ - 0x7510bb9d,0xdf70,0x4f7e,0xba,0x07,0xe2,0x9d,0x33,0x0b,0x3c,0xc5); -#endif - - -typedef struct _MSNdis_WmiOutputInfo -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_WmiOutputInfo_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_WmiOutputInfo_Header_ID 1 - - // - ULONG Flags; - #define MSNdis_WmiOutputInfo_Flags_SIZE sizeof(ULONG) - #define MSNdis_WmiOutputInfo_Flags_ID 2 - - // - UCHAR SupportedRevision; - #define MSNdis_WmiOutputInfo_SupportedRevision_SIZE sizeof(UCHAR) - #define MSNdis_WmiOutputInfo_SupportedRevision_ID 3 - - // - UCHAR Padding1; - #define MSNdis_WmiOutputInfo_Padding1_SIZE sizeof(UCHAR) - #define MSNdis_WmiOutputInfo_Padding1_ID 4 - - // - USHORT Padding2; - #define MSNdis_WmiOutputInfo_Padding2_SIZE sizeof(USHORT) - #define MSNdis_WmiOutputInfo_Padding2_ID 5 - - // - ULONG DataOffset; - #define MSNdis_WmiOutputInfo_DataOffset_SIZE sizeof(ULONG) - #define MSNdis_WmiOutputInfo_DataOffset_ID 6 - -} MSNdis_WmiOutputInfo, *PMSNdis_WmiOutputInfo; - -#define MSNdis_WmiOutputInfo_SIZE (FIELD_OFFSET(MSNdis_WmiOutputInfo, DataOffset) + MSNdis_WmiOutputInfo_DataOffset_SIZE) - -// MSNdis_WmiEnumAdapter - MSNdis_WmiEnumAdapter -#define MSNdis_WmiEnumAdapterGuid \ - { 0xe7001b59,0xc3d6,0x4537, { 0xb4,0x0e,0xa1,0x63,0xd5,0x16,0xe4,0xa3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiEnumAdapter_GUID, \ - 0xe7001b59,0xc3d6,0x4537,0xb4,0x0e,0xa1,0x63,0xd5,0x16,0xe4,0xa3); -#endif - - -typedef struct _MSNdis_WmiEnumAdapter -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_WmiEnumAdapter_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_WmiEnumAdapter_Header_ID 1 - - // - ULONG IfIndex; - #define MSNdis_WmiEnumAdapter_IfIndex_SIZE sizeof(ULONG) - #define MSNdis_WmiEnumAdapter_IfIndex_ID 2 - - // - ULONGLONG NetLuid; - #define MSNdis_WmiEnumAdapter_NetLuid_SIZE sizeof(ULONGLONG) - #define MSNdis_WmiEnumAdapter_NetLuid_ID 3 - - // - CHAR VariableData[1]; - #define MSNdis_WmiEnumAdapter_DeviceName_ID 4 - -} MSNdis_WmiEnumAdapter, *PMSNdis_WmiEnumAdapter; - -// MSNdis_LinkStateData - MSNdis_LinkStateData -#define MSNdis_LinkStateDataGuid \ - { 0x5b26b94f,0x0272,0x4d4c, { 0x87,0x44,0xbd,0x84,0xbe,0x42,0x1f,0x3b } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_LinkStateData_GUID, \ - 0x5b26b94f,0x0272,0x4d4c,0x87,0x44,0xbd,0x84,0xbe,0x42,0x1f,0x3b); -#endif - - -typedef struct _MSNdis_LinkStateData -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_LinkStateData_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_LinkStateData_Header_ID 1 - - // - ULONG MediaConnectState; - #define MSNdis_LinkStateData_MediaConnectState_SIZE sizeof(ULONG) - #define MSNdis_LinkStateData_MediaConnectState_ID 2 - - // - ULONG MediaDuplexState; - #define MSNdis_LinkStateData_MediaDuplexState_SIZE sizeof(ULONG) - #define MSNdis_LinkStateData_MediaDuplexState_ID 3 - - // - ULONGLONG XmitLinkSpeed; - #define MSNdis_LinkStateData_XmitLinkSpeed_SIZE sizeof(ULONGLONG) - #define MSNdis_LinkStateData_XmitLinkSpeed_ID 4 - - // - ULONGLONG RcvLinkSpeed; - #define MSNdis_LinkStateData_RcvLinkSpeed_SIZE sizeof(ULONGLONG) - #define MSNdis_LinkStateData_RcvLinkSpeed_ID 5 - - // - ULONG PauseFunctions; - #define MSNdis_LinkStateData_PauseFunctions_SIZE sizeof(ULONG) - #define MSNdis_LinkStateData_PauseFunctions_ID 6 - - // - ULONG AutoNegotiationFlags; - #define MSNdis_LinkStateData_AutoNegotiationFlags_SIZE sizeof(ULONG) - #define MSNdis_LinkStateData_AutoNegotiationFlags_ID 7 - -} MSNdis_LinkStateData, *PMSNdis_LinkStateData; - -#define MSNdis_LinkStateData_SIZE (FIELD_OFFSET(MSNdis_LinkStateData, AutoNegotiationFlags) + MSNdis_LinkStateData_AutoNegotiationFlags_SIZE) - -// MSNdis_LinkParameters - MSNdis_LinkParameters -#define MSNdis_LinkParametersGuid \ - { 0x29380131,0xa312,0x4400, { 0xbe,0x0c,0x53,0x87,0x7a,0x41,0xc4,0x65 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_LinkParameters_GUID, \ - 0x29380131,0xa312,0x4400,0xbe,0x0c,0x53,0x87,0x7a,0x41,0xc4,0x65); -#endif - - -typedef struct _MSNdis_LinkParameters -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_LinkParameters_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_LinkParameters_Header_ID 1 - - // - ULONG MediaDuplexState; - #define MSNdis_LinkParameters_MediaDuplexState_SIZE sizeof(ULONG) - #define MSNdis_LinkParameters_MediaDuplexState_ID 2 - - // - ULONGLONG XmitLinkSpeed; - #define MSNdis_LinkParameters_XmitLinkSpeed_SIZE sizeof(ULONGLONG) - #define MSNdis_LinkParameters_XmitLinkSpeed_ID 3 - - // - ULONGLONG RcvLinkSpeed; - #define MSNdis_LinkParameters_RcvLinkSpeed_SIZE sizeof(ULONGLONG) - #define MSNdis_LinkParameters_RcvLinkSpeed_ID 4 - - // - ULONG PauseFunctions; - #define MSNdis_LinkParameters_PauseFunctions_SIZE sizeof(ULONG) - #define MSNdis_LinkParameters_PauseFunctions_ID 5 - - // - ULONG AutoNegotiationFlags; - #define MSNdis_LinkParameters_AutoNegotiationFlags_SIZE sizeof(ULONG) - #define MSNdis_LinkParameters_AutoNegotiationFlags_ID 6 - -} MSNdis_LinkParameters, *PMSNdis_LinkParameters; - -#define MSNdis_LinkParameters_SIZE (FIELD_OFFSET(MSNdis_LinkParameters, AutoNegotiationFlags) + MSNdis_LinkParameters_AutoNegotiationFlags_SIZE) - -// MSNdis_InterruptModerationParameters - MSNdis_InterruptModerationParameters -#define MSNdis_InterruptModerationParametersGuid \ - { 0x09f58643,0x31fb,0x45b5, { 0x85,0x2b,0x09,0xb4,0xd3,0xff,0x37,0x65 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_InterruptModerationParameters_GUID, \ - 0x09f58643,0x31fb,0x45b5,0x85,0x2b,0x09,0xb4,0xd3,0xff,0x37,0x65); -#endif - - -typedef struct _MSNdis_InterruptModerationParameters -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_InterruptModerationParameters_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_InterruptModerationParameters_Header_ID 1 - - // - ULONG Flags; - #define MSNdis_InterruptModerationParameters_Flags_SIZE sizeof(ULONG) - #define MSNdis_InterruptModerationParameters_Flags_ID 2 - - // - ULONG InterruptModeration; - #define MSNdis_InterruptModerationParameters_InterruptModeration_SIZE sizeof(ULONG) - #define MSNdis_InterruptModerationParameters_InterruptModeration_ID 3 - -} MSNdis_InterruptModerationParameters, *PMSNdis_InterruptModerationParameters; - -#define MSNdis_InterruptModerationParameters_SIZE (FIELD_OFFSET(MSNdis_InterruptModerationParameters, InterruptModeration) + MSNdis_InterruptModerationParameters_InterruptModeration_SIZE) - -// MSNdis_StatisticsInfo - MSNdis_StatisticsInfo -#define MSNdis_StatisticsInfoGuid \ - { 0x8ecc74e1,0xba85,0x482e, { 0xaf,0xaf,0xb4,0xf8,0xb0,0x87,0xc0,0x6b } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatisticsInfo_GUID, \ - 0x8ecc74e1,0xba85,0x482e,0xaf,0xaf,0xb4,0xf8,0xb0,0x87,0xc0,0x6b); -#endif - - -typedef struct _MSNdis_StatisticsInfo -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_StatisticsInfo_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_StatisticsInfo_Header_ID 1 - - // - ULONG SupportedStatistics; - #define MSNdis_StatisticsInfo_SupportedStatistics_SIZE sizeof(ULONG) - #define MSNdis_StatisticsInfo_SupportedStatistics_ID 2 - - // - ULONGLONG ifInDiscards; - #define MSNdis_StatisticsInfo_ifInDiscards_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifInDiscards_ID 3 - - // - ULONGLONG ifInErrors; - #define MSNdis_StatisticsInfo_ifInErrors_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifInErrors_ID 4 - - // - ULONGLONG ifHCInOctets; - #define MSNdis_StatisticsInfo_ifHCInOctets_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCInOctets_ID 5 - - // - ULONGLONG ifHCInUcastPkts; - #define MSNdis_StatisticsInfo_ifHCInUcastPkts_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCInUcastPkts_ID 6 - - // - ULONGLONG ifHCInMulticastPkts; - #define MSNdis_StatisticsInfo_ifHCInMulticastPkts_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCInMulticastPkts_ID 7 - - // - ULONGLONG ifHCInBroadcastPkts; - #define MSNdis_StatisticsInfo_ifHCInBroadcastPkts_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCInBroadcastPkts_ID 8 - - // - ULONGLONG ifHCOutOctets; - #define MSNdis_StatisticsInfo_ifHCOutOctets_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCOutOctets_ID 9 - - // - ULONGLONG ifHCOutUcastPkts; - #define MSNdis_StatisticsInfo_ifHCOutUcastPkts_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCOutUcastPkts_ID 10 - - // - ULONGLONG ifHCOutMulticastPkts; - #define MSNdis_StatisticsInfo_ifHCOutMulticastPkts_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCOutMulticastPkts_ID 11 - - // - ULONGLONG ifHCOutBroadcastPkts; - #define MSNdis_StatisticsInfo_ifHCOutBroadcastPkts_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCOutBroadcastPkts_ID 12 - - // - ULONGLONG ifOutErrors; - #define MSNdis_StatisticsInfo_ifOutErrors_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifOutErrors_ID 13 - - // - ULONGLONG ifOutDiscards; - #define MSNdis_StatisticsInfo_ifOutDiscards_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifOutDiscards_ID 14 - - // - ULONGLONG ifHCInUcastOctets; - #define MSNdis_StatisticsInfo_ifHCInUcastOctets_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCInUcastOctets_ID 15 - - // - ULONGLONG ifHCInMulticastOctets; - #define MSNdis_StatisticsInfo_ifHCInMulticastOctets_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCInMulticastOctets_ID 16 - - // - ULONGLONG ifHCInBroadcastOctets; - #define MSNdis_StatisticsInfo_ifHCInBroadcastOctets_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCInBroadcastOctets_ID 17 - - // - ULONGLONG ifHCOutUcastOctets; - #define MSNdis_StatisticsInfo_ifHCOutUcastOctets_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCOutUcastOctets_ID 18 - - // - ULONGLONG ifHCOutMulticastOctets; - #define MSNdis_StatisticsInfo_ifHCOutMulticastOctets_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCOutMulticastOctets_ID 19 - - // - ULONGLONG ifHCOutBroadcastOctets; - #define MSNdis_StatisticsInfo_ifHCOutBroadcastOctets_SIZE sizeof(ULONGLONG) - #define MSNdis_StatisticsInfo_ifHCOutBroadcastOctets_ID 20 - -} MSNdis_StatisticsInfo, *PMSNdis_StatisticsInfo; - -#define MSNdis_StatisticsInfo_SIZE (FIELD_OFFSET(MSNdis_StatisticsInfo, ifHCOutBroadcastOctets) + MSNdis_StatisticsInfo_ifHCOutBroadcastOctets_SIZE) - -// MSNdis_PortStateData - MSNdis_PortStateData -#define MSNdis_PortStateDataGuid \ - { 0x8feae2c6,0xee28,0x469f, { 0x8b,0x5d,0x9f,0x74,0x3b,0xab,0x21,0xaa } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_PortStateData_GUID, \ - 0x8feae2c6,0xee28,0x469f,0x8b,0x5d,0x9f,0x74,0x3b,0xab,0x21,0xaa); -#endif - - -typedef struct _MSNdis_PortStateData -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_PortStateData_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_PortStateData_Header_ID 1 - - // - ULONG MediaConnectState; - #define MSNdis_PortStateData_MediaConnectState_SIZE sizeof(ULONG) - #define MSNdis_PortStateData_MediaConnectState_ID 2 - - // - ULONGLONG XmitLinkSpeed; - #define MSNdis_PortStateData_XmitLinkSpeed_SIZE sizeof(ULONGLONG) - #define MSNdis_PortStateData_XmitLinkSpeed_ID 3 - - // - ULONGLONG RcvLinkSpeed; - #define MSNdis_PortStateData_RcvLinkSpeed_SIZE sizeof(ULONGLONG) - #define MSNdis_PortStateData_RcvLinkSpeed_ID 4 - - // - ULONG Direction; - #define MSNdis_PortStateData_Direction_SIZE sizeof(ULONG) - #define MSNdis_PortStateData_Direction_ID 5 - - // - ULONG SendControlState; - #define MSNdis_PortStateData_SendControlState_SIZE sizeof(ULONG) - #define MSNdis_PortStateData_SendControlState_ID 6 - - // - ULONG RcvControlState; - #define MSNdis_PortStateData_RcvControlState_SIZE sizeof(ULONG) - #define MSNdis_PortStateData_RcvControlState_ID 7 - - // - ULONG SendAuthorizationState; - #define MSNdis_PortStateData_SendAuthorizationState_SIZE sizeof(ULONG) - #define MSNdis_PortStateData_SendAuthorizationState_ID 8 - - // - ULONG RcvAuthorizationState; - #define MSNdis_PortStateData_RcvAuthorizationState_SIZE sizeof(ULONG) - #define MSNdis_PortStateData_RcvAuthorizationState_ID 9 - - // - ULONG Flags; - #define MSNdis_PortStateData_Flags_SIZE sizeof(ULONG) - #define MSNdis_PortStateData_Flags_ID 10 - -} MSNdis_PortStateData, *PMSNdis_PortStateData; - -#define MSNdis_PortStateData_SIZE (FIELD_OFFSET(MSNdis_PortStateData, Flags) + MSNdis_PortStateData_Flags_SIZE) - -// MSNdis_PortAuthParameters - MSNdis_PortAuthParameters -#define MSNdis_PortAuthParametersGuid \ - { 0x5c3bda24,0x8b64,0x4829, { 0xa5,0x87,0x8c,0xe7,0x19,0x15,0x2f,0xe2 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_PortAuthParameters_GUID, \ - 0x5c3bda24,0x8b64,0x4829,0xa5,0x87,0x8c,0xe7,0x19,0x15,0x2f,0xe2); -#endif - - -typedef struct _MSNdis_PortAuthParameters -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_PortAuthParameters_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_PortAuthParameters_Header_ID 1 - - // - ULONG SendControlState; - #define MSNdis_PortAuthParameters_SendControlState_SIZE sizeof(ULONG) - #define MSNdis_PortAuthParameters_SendControlState_ID 2 - - // - ULONG RcvControlState; - #define MSNdis_PortAuthParameters_RcvControlState_SIZE sizeof(ULONG) - #define MSNdis_PortAuthParameters_RcvControlState_ID 3 - - // - ULONG SendAuthorizationState; - #define MSNdis_PortAuthParameters_SendAuthorizationState_SIZE sizeof(ULONG) - #define MSNdis_PortAuthParameters_SendAuthorizationState_ID 4 - - // - ULONG RcvAuthorizationState; - #define MSNdis_PortAuthParameters_RcvAuthorizationState_SIZE sizeof(ULONG) - #define MSNdis_PortAuthParameters_RcvAuthorizationState_ID 5 - -} MSNdis_PortAuthParameters, *PMSNdis_PortAuthParameters; - -#define MSNdis_PortAuthParameters_SIZE (FIELD_OFFSET(MSNdis_PortAuthParameters, RcvAuthorizationState) + MSNdis_PortAuthParameters_RcvAuthorizationState_SIZE) - -// MSNdis_PortChar - MSNdis_PortChar -#define MSNdis_PortCharGuid \ - { 0xf5b7d202,0xe594,0x4aa3, { 0xbe,0x43,0x49,0x76,0x83,0x3c,0x78,0x40 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_PortChar_GUID, \ - 0xf5b7d202,0xe594,0x4aa3,0xbe,0x43,0x49,0x76,0x83,0x3c,0x78,0x40); -#endif - - -typedef struct _MSNdis_PortChar -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_PortChar_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_PortChar_Header_ID 1 - - // - ULONG PortNumber; - #define MSNdis_PortChar_PortNumber_SIZE sizeof(ULONG) - #define MSNdis_PortChar_PortNumber_ID 2 - - // - ULONG Flags; - #define MSNdis_PortChar_Flags_SIZE sizeof(ULONG) - #define MSNdis_PortChar_Flags_ID 3 - - // - ULONG Type; - #define MSNdis_PortChar_Type_SIZE sizeof(ULONG) - #define MSNdis_PortChar_Type_ID 4 - - // - ULONG MediaConnectState; - #define MSNdis_PortChar_MediaConnectState_SIZE sizeof(ULONG) - #define MSNdis_PortChar_MediaConnectState_ID 5 - - // - ULONGLONG XmitLinkSpeed; - #define MSNdis_PortChar_XmitLinkSpeed_SIZE sizeof(ULONGLONG) - #define MSNdis_PortChar_XmitLinkSpeed_ID 6 - - // - ULONGLONG RcvLinkSpeed; - #define MSNdis_PortChar_RcvLinkSpeed_SIZE sizeof(ULONGLONG) - #define MSNdis_PortChar_RcvLinkSpeed_ID 7 - - // - ULONG Direction; - #define MSNdis_PortChar_Direction_SIZE sizeof(ULONG) - #define MSNdis_PortChar_Direction_ID 8 - - // - ULONG SendControlState; - #define MSNdis_PortChar_SendControlState_SIZE sizeof(ULONG) - #define MSNdis_PortChar_SendControlState_ID 9 - - // - ULONG RcvControlState; - #define MSNdis_PortChar_RcvControlState_SIZE sizeof(ULONG) - #define MSNdis_PortChar_RcvControlState_ID 10 - - // - ULONG SendAuthorizationState; - #define MSNdis_PortChar_SendAuthorizationState_SIZE sizeof(ULONG) - #define MSNdis_PortChar_SendAuthorizationState_ID 11 - - // - ULONG RcvAuthorizationState; - #define MSNdis_PortChar_RcvAuthorizationState_SIZE sizeof(ULONG) - #define MSNdis_PortChar_RcvAuthorizationState_ID 12 - -} MSNdis_PortChar, *PMSNdis_PortChar; - -#define MSNdis_PortChar_SIZE (FIELD_OFFSET(MSNdis_PortChar, RcvAuthorizationState) + MSNdis_PortChar_RcvAuthorizationState_SIZE) - -// MSNdis_PortArray - MSNdis_PortArray -#define MSNdis_PortArrayGuid \ - { 0x0fee8708,0xdf65,0x456e, { 0xb4,0xca,0xfa,0x62,0x32,0x66,0xa1,0x2a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_PortArray_GUID, \ - 0x0fee8708,0xdf65,0x456e,0xb4,0xca,0xfa,0x62,0x32,0x66,0xa1,0x2a); -#endif - - -typedef struct _MSNdis_PortArray -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_PortArray_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_PortArray_Header_ID 1 - - // - ULONG NumberOfPorts; - #define MSNdis_PortArray_NumberOfPorts_SIZE sizeof(ULONG) - #define MSNdis_PortArray_NumberOfPorts_ID 2 - - // - ULONG OffsetFirstPort; - #define MSNdis_PortArray_OffsetFirstPort_SIZE sizeof(ULONG) - #define MSNdis_PortArray_OffsetFirstPort_ID 3 - - // - ULONG ElementSize; - #define MSNdis_PortArray_ElementSize_SIZE sizeof(ULONG) - #define MSNdis_PortArray_ElementSize_ID 4 - - // - MSNdis_PortChar Port[1]; - #define MSNdis_PortArray_Port_ID 5 - -} MSNdis_PortArray, *PMSNdis_PortArray; - -// MSNdis_PciDeviceProperty - MSNdis_PciDeviceProperty -#define MSNdis_PciDevicePropertyGuid \ - { 0x0573f70f,0xded8,0x401c, { 0x8b,0x56,0xa6,0x2b,0xb5,0x28,0xc0,0xe2 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_PciDeviceProperty_GUID, \ - 0x0573f70f,0xded8,0x401c,0x8b,0x56,0xa6,0x2b,0xb5,0x28,0xc0,0xe2); -#endif - - -typedef struct _MSNdis_PciDeviceProperty -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_PciDeviceProperty_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_PciDeviceProperty_Header_ID 1 - - // - ULONG DeviceType; - #define MSNdis_PciDeviceProperty_DeviceType_SIZE sizeof(ULONG) - #define MSNdis_PciDeviceProperty_DeviceType_ID 2 - - // - ULONG CurrentSpeedAndMode; - #define MSNdis_PciDeviceProperty_CurrentSpeedAndMode_SIZE sizeof(ULONG) - #define MSNdis_PciDeviceProperty_CurrentSpeedAndMode_ID 3 - - // - ULONG CurrentPayloadSize; - #define MSNdis_PciDeviceProperty_CurrentPayloadSize_SIZE sizeof(ULONG) - #define MSNdis_PciDeviceProperty_CurrentPayloadSize_ID 4 - - // - ULONG MaxPayloadSize; - #define MSNdis_PciDeviceProperty_MaxPayloadSize_SIZE sizeof(ULONG) - #define MSNdis_PciDeviceProperty_MaxPayloadSize_ID 5 - - // - ULONG MaxReadRequestSize; - #define MSNdis_PciDeviceProperty_MaxReadRequestSize_SIZE sizeof(ULONG) - #define MSNdis_PciDeviceProperty_MaxReadRequestSize_ID 6 - - // - ULONG CurrentLinkSpeed; - #define MSNdis_PciDeviceProperty_CurrentLinkSpeed_SIZE sizeof(ULONG) - #define MSNdis_PciDeviceProperty_CurrentLinkSpeed_ID 7 - - // - ULONG CurrentLinkWidth; - #define MSNdis_PciDeviceProperty_CurrentLinkWidth_SIZE sizeof(ULONG) - #define MSNdis_PciDeviceProperty_CurrentLinkWidth_ID 8 - - // - ULONG MaxLinkSpeed; - #define MSNdis_PciDeviceProperty_MaxLinkSpeed_SIZE sizeof(ULONG) - #define MSNdis_PciDeviceProperty_MaxLinkSpeed_ID 9 - - // - ULONG MaxLinkWidth; - #define MSNdis_PciDeviceProperty_MaxLinkWidth_SIZE sizeof(ULONG) - #define MSNdis_PciDeviceProperty_MaxLinkWidth_ID 10 - -} MSNdis_PciDeviceProperty, *PMSNdis_PciDeviceProperty; - -#define MSNdis_PciDeviceProperty_SIZE (FIELD_OFFSET(MSNdis_PciDeviceProperty, MaxLinkWidth) + MSNdis_PciDeviceProperty_MaxLinkWidth_SIZE) - -// MSNdis_WmiTcpLargeSendOffloadV1_IPv4 - MSNdis_WmiTcpLargeSendOffloadV1_IPv4 -#define MSNdis_WmiTcpLargeSendOffloadV1_IPv4Guid \ - { 0xd7673b11,0xe892,0x4a9d, { 0x8b,0xd8,0x76,0x1f,0xf2,0x56,0xed,0xd9 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiTcpLargeSendOffloadV1_IPv4_GUID, \ - 0xd7673b11,0xe892,0x4a9d,0x8b,0xd8,0x76,0x1f,0xf2,0x56,0xed,0xd9); -#endif - - -typedef struct _MSNdis_WmiTcpLargeSendOffloadV1_IPv4 -{ - // - ULONG Encapsulation; - #define MSNdis_WmiTcpLargeSendOffloadV1_IPv4_Encapsulation_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV1_IPv4_Encapsulation_ID 1 - - // - ULONG MaxOffLoadSize; - #define MSNdis_WmiTcpLargeSendOffloadV1_IPv4_MaxOffLoadSize_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV1_IPv4_MaxOffLoadSize_ID 2 - - // - ULONG MinSegmentCount; - #define MSNdis_WmiTcpLargeSendOffloadV1_IPv4_MinSegmentCount_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV1_IPv4_MinSegmentCount_ID 3 - - // - ULONG TcpOptions; - #define MSNdis_WmiTcpLargeSendOffloadV1_IPv4_TcpOptions_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV1_IPv4_TcpOptions_ID 4 - - // - ULONG IpOptions; - #define MSNdis_WmiTcpLargeSendOffloadV1_IPv4_IpOptions_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV1_IPv4_IpOptions_ID 5 - -} MSNdis_WmiTcpLargeSendOffloadV1_IPv4, *PMSNdis_WmiTcpLargeSendOffloadV1_IPv4; - -#define MSNdis_WmiTcpLargeSendOffloadV1_IPv4_SIZE (FIELD_OFFSET(MSNdis_WmiTcpLargeSendOffloadV1_IPv4, IpOptions) + MSNdis_WmiTcpLargeSendOffloadV1_IPv4_IpOptions_SIZE) - -// MSNdis_WmiTcpLargeSendOffloadV1 - MSNdis_WmiTcpLargeSendOffloadV1 -#define MSNdis_WmiTcpLargeSendOffloadV1Guid \ - { 0xb9e4e2f9,0xee89,0x4756, { 0xb0,0x57,0x38,0xf9,0xd9,0xb5,0x9a,0x92 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiTcpLargeSendOffloadV1_GUID, \ - 0xb9e4e2f9,0xee89,0x4756,0xb0,0x57,0x38,0xf9,0xd9,0xb5,0x9a,0x92); -#endif - - -typedef struct _MSNdis_WmiTcpLargeSendOffloadV1 -{ - // - MSNdis_WmiTcpLargeSendOffloadV1_IPv4 WmiIPv4; - #define MSNdis_WmiTcpLargeSendOffloadV1_WmiIPv4_SIZE sizeof(MSNdis_WmiTcpLargeSendOffloadV1_IPv4) - #define MSNdis_WmiTcpLargeSendOffloadV1_WmiIPv4_ID 1 - -} MSNdis_WmiTcpLargeSendOffloadV1, *PMSNdis_WmiTcpLargeSendOffloadV1; - -#define MSNdis_WmiTcpLargeSendOffloadV1_SIZE (FIELD_OFFSET(MSNdis_WmiTcpLargeSendOffloadV1, WmiIPv4) + MSNdis_WmiTcpLargeSendOffloadV1_WmiIPv4_SIZE) - -// MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive - MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive -#define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceiveGuid \ - { 0xd63d537a,0x59c1,0x4fae, { 0x8f,0x9b,0xcd,0x9f,0xbb,0xec,0xb8,0x5a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_GUID, \ - 0xd63d537a,0x59c1,0x4fae,0x8f,0x9b,0xcd,0x9f,0xbb,0xec,0xb8,0x5a); -#endif - - -typedef struct _MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive -{ - // - ULONG Encapsulation; - #define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_Encapsulation_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_Encapsulation_ID 1 - - // - ULONG IpOptionsSupported; - #define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_IpOptionsSupported_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_IpOptionsSupported_ID 2 - - // - ULONG TcpOptionsSupported; - #define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_TcpOptionsSupported_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_TcpOptionsSupported_ID 3 - - // - ULONG TcpChecksum; - #define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_TcpChecksum_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_TcpChecksum_ID 4 - - // - ULONG UdpChecksum; - #define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_UdpChecksum_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_UdpChecksum_ID 5 - - // - ULONG IpChecksum; - #define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_IpChecksum_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_IpChecksum_ID 6 - -} MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive, *PMSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive; - -#define MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_SIZE (FIELD_OFFSET(MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive, IpChecksum) + MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive_IpChecksum_SIZE) - -// MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive - MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive -#define MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceiveGuid \ - { 0xb9760e75,0x6662,0x49e4, { 0xaa,0x6c,0xf0,0x28,0xbe,0xfe,0xc8,0xee } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_GUID, \ - 0xb9760e75,0x6662,0x49e4,0xaa,0x6c,0xf0,0x28,0xbe,0xfe,0xc8,0xee); -#endif - - -typedef struct _MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive -{ - // - ULONG Encapsulation; - #define MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_Encapsulation_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_Encapsulation_ID 1 - - // - ULONG IpExtensionHeadersSupported; - #define MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_IpExtensionHeadersSupported_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_IpExtensionHeadersSupported_ID 2 - - // - ULONG TcpOptionsSupported; - #define MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_TcpOptionsSupported_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_TcpOptionsSupported_ID 3 - - // - ULONG TcpChecksum; - #define MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_TcpChecksum_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_TcpChecksum_ID 4 - - // - ULONG UdpChecksum; - #define MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_UdpChecksum_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_UdpChecksum_ID 5 - -} MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive, *PMSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive; - -#define MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_SIZE (FIELD_OFFSET(MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive, UdpChecksum) + MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive_UdpChecksum_SIZE) - -// MSNdis_WmiTcpIpChecksumOffload - MSNdis_WmiTcpIpChecksumOffload -#define MSNdis_WmiTcpIpChecksumOffloadGuid \ - { 0x189d4015,0x1b25,0x4d8e, { 0xa4,0xa9,0xf9,0xeb,0xa8,0x21,0x97,0xc7 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiTcpIpChecksumOffload_GUID, \ - 0x189d4015,0x1b25,0x4d8e,0xa4,0xa9,0xf9,0xeb,0xa8,0x21,0x97,0xc7); -#endif - - -typedef struct _MSNdis_WmiTcpIpChecksumOffload -{ - // - MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive IPv4Transmit; - #define MSNdis_WmiTcpIpChecksumOffload_IPv4Transmit_SIZE sizeof(MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive) - #define MSNdis_WmiTcpIpChecksumOffload_IPv4Transmit_ID 1 - - // - MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive IPv4Receive; - #define MSNdis_WmiTcpIpChecksumOffload_IPv4Receive_SIZE sizeof(MSNdis_WmiTcpIpChecksumOffload_IPv4TransmitReceive) - #define MSNdis_WmiTcpIpChecksumOffload_IPv4Receive_ID 2 - - // - MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive IPv6Transmit; - #define MSNdis_WmiTcpIpChecksumOffload_IPv6Transmit_SIZE sizeof(MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive) - #define MSNdis_WmiTcpIpChecksumOffload_IPv6Transmit_ID 3 - - // - MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive IPv6Receive; - #define MSNdis_WmiTcpIpChecksumOffload_IPv6Receive_SIZE sizeof(MSNdis_WmiTcpIpChecksumOffload_IPv6TransmitReceive) - #define MSNdis_WmiTcpIpChecksumOffload_IPv6Receive_ID 4 - -} MSNdis_WmiTcpIpChecksumOffload, *PMSNdis_WmiTcpIpChecksumOffload; - -#define MSNdis_WmiTcpIpChecksumOffload_SIZE (FIELD_OFFSET(MSNdis_WmiTcpIpChecksumOffload, IPv6Receive) + MSNdis_WmiTcpIpChecksumOffload_IPv6Receive_SIZE) - -// MSNdis_WmiIPSecOffloadV1_Supported - MSNdis_WmiIPSecOffloadV1_Supported -#define MSNdis_WmiIPSecOffloadV1_SupportedGuid \ - { 0xf86676b9,0xd9fa,0x4d26, { 0x95,0xce,0xbf,0xbc,0x77,0xd8,0x05,0x96 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiIPSecOffloadV1_Supported_GUID, \ - 0xf86676b9,0xd9fa,0x4d26,0x95,0xce,0xbf,0xbc,0x77,0xd8,0x05,0x96); -#endif - - -typedef struct _MSNdis_WmiIPSecOffloadV1_Supported -{ - // - ULONG Encapsulation; - #define MSNdis_WmiIPSecOffloadV1_Supported_Encapsulation_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_Supported_Encapsulation_ID 1 - - // - ULONG AhEspCombined; - #define MSNdis_WmiIPSecOffloadV1_Supported_AhEspCombined_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_Supported_AhEspCombined_ID 2 - - // - ULONG TransportTunnelCombined; - #define MSNdis_WmiIPSecOffloadV1_Supported_TransportTunnelCombined_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_Supported_TransportTunnelCombined_ID 3 - - // - ULONG IPv4Options; - #define MSNdis_WmiIPSecOffloadV1_Supported_IPv4Options_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_Supported_IPv4Options_ID 4 - - // - ULONG Flags; - #define MSNdis_WmiIPSecOffloadV1_Supported_Flags_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_Supported_Flags_ID 5 - -} MSNdis_WmiIPSecOffloadV1_Supported, *PMSNdis_WmiIPSecOffloadV1_Supported; - -#define MSNdis_WmiIPSecOffloadV1_Supported_SIZE (FIELD_OFFSET(MSNdis_WmiIPSecOffloadV1_Supported, Flags) + MSNdis_WmiIPSecOffloadV1_Supported_Flags_SIZE) - -// MSNdis_WmiIPSecOffloadV1_IPv4AH - MSNdis_WmiIPSecOffloadV1_IPv4AH -#define MSNdis_WmiIPSecOffloadV1_IPv4AHGuid \ - { 0x29bacfdd,0xf063,0x48d8, { 0x95,0x2c,0xd3,0xdc,0x93,0x30,0x0f,0x15 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiIPSecOffloadV1_IPv4AH_GUID, \ - 0x29bacfdd,0xf063,0x48d8,0x95,0x2c,0xd3,0xdc,0x93,0x30,0x0f,0x15); -#endif - - -typedef struct _MSNdis_WmiIPSecOffloadV1_IPv4AH -{ - // - ULONG Md5; - #define MSNdis_WmiIPSecOffloadV1_IPv4AH_Md5_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4AH_Md5_ID 1 - - // - ULONG Sha_1; - #define MSNdis_WmiIPSecOffloadV1_IPv4AH_Sha_1_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4AH_Sha_1_ID 2 - - // - ULONG Transport; - #define MSNdis_WmiIPSecOffloadV1_IPv4AH_Transport_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4AH_Transport_ID 3 - - // - ULONG Tunnel; - #define MSNdis_WmiIPSecOffloadV1_IPv4AH_Tunnel_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4AH_Tunnel_ID 4 - - // - ULONG Send; - #define MSNdis_WmiIPSecOffloadV1_IPv4AH_Send_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4AH_Send_ID 5 - - // - ULONG Receive; - #define MSNdis_WmiIPSecOffloadV1_IPv4AH_Receive_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4AH_Receive_ID 6 - -} MSNdis_WmiIPSecOffloadV1_IPv4AH, *PMSNdis_WmiIPSecOffloadV1_IPv4AH; - -#define MSNdis_WmiIPSecOffloadV1_IPv4AH_SIZE (FIELD_OFFSET(MSNdis_WmiIPSecOffloadV1_IPv4AH, Receive) + MSNdis_WmiIPSecOffloadV1_IPv4AH_Receive_SIZE) - -// MSNdis_WmiIPSecOffloadV1_IPv4ESP - MSNdis_WmiIPSecOffloadV1_IPv4ESP -#define MSNdis_WmiIPSecOffloadV1_IPv4ESPGuid \ - { 0x86522023,0x4536,0x4b58, { 0xa1,0xf4,0x25,0x38,0x94,0x1a,0xce,0x43 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiIPSecOffloadV1_IPv4ESP_GUID, \ - 0x86522023,0x4536,0x4b58,0xa1,0xf4,0x25,0x38,0x94,0x1a,0xce,0x43); -#endif - - -typedef struct _MSNdis_WmiIPSecOffloadV1_IPv4ESP -{ - // - ULONG Des; - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_Des_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_Des_ID 1 - - // - ULONG Reserved; - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_Reserved_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_Reserved_ID 2 - - // - ULONG TripleDes; - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_TripleDes_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_TripleDes_ID 3 - - // - ULONG NullEsp; - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_NullEsp_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_NullEsp_ID 4 - - // - ULONG Transport; - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_Transport_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_Transport_ID 5 - - // - ULONG Tunnel; - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_Tunnel_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_Tunnel_ID 6 - - // - ULONG Send; - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_Send_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_Send_ID 7 - - // - ULONG Receive; - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_Receive_SIZE sizeof(ULONG) - #define MSNdis_WmiIPSecOffloadV1_IPv4ESP_Receive_ID 8 - -} MSNdis_WmiIPSecOffloadV1_IPv4ESP, *PMSNdis_WmiIPSecOffloadV1_IPv4ESP; - -#define MSNdis_WmiIPSecOffloadV1_IPv4ESP_SIZE (FIELD_OFFSET(MSNdis_WmiIPSecOffloadV1_IPv4ESP, Receive) + MSNdis_WmiIPSecOffloadV1_IPv4ESP_Receive_SIZE) - -// MSNdis_WmiIPSecOffloadV1 - MSNdis_WmiIPSecOffloadV1 -#define MSNdis_WmiIPSecOffloadV1Guid \ - { 0x4ec63447,0x2238,0x43a7, { 0xac,0x33,0x11,0xc7,0xcc,0x7d,0x86,0x65 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiIPSecOffloadV1_GUID, \ - 0x4ec63447,0x2238,0x43a7,0xac,0x33,0x11,0xc7,0xcc,0x7d,0x86,0x65); -#endif - - -typedef struct _MSNdis_WmiIPSecOffloadV1 -{ - // - MSNdis_WmiIPSecOffloadV1_Supported WmiSupported; - #define MSNdis_WmiIPSecOffloadV1_WmiSupported_SIZE sizeof(MSNdis_WmiIPSecOffloadV1_Supported) - #define MSNdis_WmiIPSecOffloadV1_WmiSupported_ID 1 - - // - MSNdis_WmiIPSecOffloadV1_IPv4AH WmiIPv4AH; - #define MSNdis_WmiIPSecOffloadV1_WmiIPv4AH_SIZE sizeof(MSNdis_WmiIPSecOffloadV1_IPv4AH) - #define MSNdis_WmiIPSecOffloadV1_WmiIPv4AH_ID 2 - - // - MSNdis_WmiIPSecOffloadV1_IPv4ESP WmiIPv4ESP; - #define MSNdis_WmiIPSecOffloadV1_WmiIPv4ESP_SIZE sizeof(MSNdis_WmiIPSecOffloadV1_IPv4ESP) - #define MSNdis_WmiIPSecOffloadV1_WmiIPv4ESP_ID 3 - -} MSNdis_WmiIPSecOffloadV1, *PMSNdis_WmiIPSecOffloadV1; - -#define MSNdis_WmiIPSecOffloadV1_SIZE (FIELD_OFFSET(MSNdis_WmiIPSecOffloadV1, WmiIPv4ESP) + MSNdis_WmiIPSecOffloadV1_WmiIPv4ESP_SIZE) - -// MSNdis_WmiTcpLargeSendOffloadV2_IPv4 - MSNdis_WmiTcpLargeSendOffloadV2_IPv4 -#define MSNdis_WmiTcpLargeSendOffloadV2_IPv4Guid \ - { 0x8823d030,0xfa30,0x4b73, { 0xb3,0x39,0xdb,0x19,0x20,0x7f,0x0d,0x81 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiTcpLargeSendOffloadV2_IPv4_GUID, \ - 0x8823d030,0xfa30,0x4b73,0xb3,0x39,0xdb,0x19,0x20,0x7f,0x0d,0x81); -#endif - - -typedef struct _MSNdis_WmiTcpLargeSendOffloadV2_IPv4 -{ - // - ULONG Encapsulation; - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv4_Encapsulation_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv4_Encapsulation_ID 1 - - // - ULONG MaxOffLoadSize; - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv4_MaxOffLoadSize_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv4_MaxOffLoadSize_ID 2 - - // - ULONG MinSegmentCount; - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv4_MinSegmentCount_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv4_MinSegmentCount_ID 3 - -} MSNdis_WmiTcpLargeSendOffloadV2_IPv4, *PMSNdis_WmiTcpLargeSendOffloadV2_IPv4; - -#define MSNdis_WmiTcpLargeSendOffloadV2_IPv4_SIZE (FIELD_OFFSET(MSNdis_WmiTcpLargeSendOffloadV2_IPv4, MinSegmentCount) + MSNdis_WmiTcpLargeSendOffloadV2_IPv4_MinSegmentCount_SIZE) - -// MSNdis_WmiTcpLargeSendOffloadV2_IPv6 - MSNdis_WmiTcpLargeSendOffloadV2_IPv6 -#define MSNdis_WmiTcpLargeSendOffloadV2_IPv6Guid \ - { 0xa7a9597c,0x2f8e,0x410b, { 0x9b,0xb3,0x5c,0x3a,0x50,0x79,0x2b,0xfc } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiTcpLargeSendOffloadV2_IPv6_GUID, \ - 0xa7a9597c,0x2f8e,0x410b,0x9b,0xb3,0x5c,0x3a,0x50,0x79,0x2b,0xfc); -#endif - - -typedef struct _MSNdis_WmiTcpLargeSendOffloadV2_IPv6 -{ - // - ULONG Encapsulation; - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv6_Encapsulation_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv6_Encapsulation_ID 1 - - // - ULONG MaxOffLoadSize; - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv6_MaxOffLoadSize_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv6_MaxOffLoadSize_ID 2 - - // - ULONG MinSegmentCount; - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv6_MinSegmentCount_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv6_MinSegmentCount_ID 3 - - // - ULONG IpExtensionHeadersSupported; - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv6_IpExtensionHeadersSupported_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv6_IpExtensionHeadersSupported_ID 4 - - // - ULONG TcpOptionsSupported; - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv6_TcpOptionsSupported_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpLargeSendOffloadV2_IPv6_TcpOptionsSupported_ID 5 - -} MSNdis_WmiTcpLargeSendOffloadV2_IPv6, *PMSNdis_WmiTcpLargeSendOffloadV2_IPv6; - -#define MSNdis_WmiTcpLargeSendOffloadV2_IPv6_SIZE (FIELD_OFFSET(MSNdis_WmiTcpLargeSendOffloadV2_IPv6, TcpOptionsSupported) + MSNdis_WmiTcpLargeSendOffloadV2_IPv6_TcpOptionsSupported_SIZE) - -// MSNdis_WmiTcpLargeSendOffloadV2 - MSNdis_WmiTcpLargeSendOffloadV2 -#define MSNdis_WmiTcpLargeSendOffloadV2Guid \ - { 0x592977c2,0xcfbe,0x462c, { 0xb5,0xcf,0x1a,0x76,0x79,0xfe,0x1c,0xba } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiTcpLargeSendOffloadV2_GUID, \ - 0x592977c2,0xcfbe,0x462c,0xb5,0xcf,0x1a,0x76,0x79,0xfe,0x1c,0xba); -#endif - - -typedef struct _MSNdis_WmiTcpLargeSendOffloadV2 -{ - // - MSNdis_WmiTcpLargeSendOffloadV2_IPv4 WmiIPv4; - #define MSNdis_WmiTcpLargeSendOffloadV2_WmiIPv4_SIZE sizeof(MSNdis_WmiTcpLargeSendOffloadV2_IPv4) - #define MSNdis_WmiTcpLargeSendOffloadV2_WmiIPv4_ID 1 - - // - MSNdis_WmiTcpLargeSendOffloadV2_IPv6 WmiIPv6; - #define MSNdis_WmiTcpLargeSendOffloadV2_WmiIPv6_SIZE sizeof(MSNdis_WmiTcpLargeSendOffloadV2_IPv6) - #define MSNdis_WmiTcpLargeSendOffloadV2_WmiIPv6_ID 2 - -} MSNdis_WmiTcpLargeSendOffloadV2, *PMSNdis_WmiTcpLargeSendOffloadV2; - -#define MSNdis_WmiTcpLargeSendOffloadV2_SIZE (FIELD_OFFSET(MSNdis_WmiTcpLargeSendOffloadV2, WmiIPv6) + MSNdis_WmiTcpLargeSendOffloadV2_WmiIPv6_SIZE) - -// MSNdis_WmiOffload - MSNdis_WmiOffload -#define MSNdis_WmiOffloadGuid \ - { 0x7a877086,0x2204,0x4a8a, { 0x92,0xa4,0xe3,0xe8,0xab,0x62,0x66,0x29 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiOffload_GUID, \ - 0x7a877086,0x2204,0x4a8a,0x92,0xa4,0xe3,0xe8,0xab,0x62,0x66,0x29); -#endif - - -typedef struct _MSNdis_WmiOffload -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_WmiOffload_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_WmiOffload_Header_ID 1 - - // - MSNdis_WmiTcpIpChecksumOffload Checksum; - #define MSNdis_WmiOffload_Checksum_SIZE sizeof(MSNdis_WmiTcpIpChecksumOffload) - #define MSNdis_WmiOffload_Checksum_ID 2 - - // - MSNdis_WmiTcpLargeSendOffloadV1 LsoV1; - #define MSNdis_WmiOffload_LsoV1_SIZE sizeof(MSNdis_WmiTcpLargeSendOffloadV1) - #define MSNdis_WmiOffload_LsoV1_ID 3 - - // - MSNdis_WmiIPSecOffloadV1 IPsecV1; - #define MSNdis_WmiOffload_IPsecV1_SIZE sizeof(MSNdis_WmiIPSecOffloadV1) - #define MSNdis_WmiOffload_IPsecV1_ID 4 - - // - MSNdis_WmiTcpLargeSendOffloadV2 LsoV2; - #define MSNdis_WmiOffload_LsoV2_SIZE sizeof(MSNdis_WmiTcpLargeSendOffloadV2) - #define MSNdis_WmiOffload_LsoV2_ID 5 - - // - ULONG Flags; - #define MSNdis_WmiOffload_Flags_SIZE sizeof(ULONG) - #define MSNdis_WmiOffload_Flags_ID 6 - -} MSNdis_WmiOffload, *PMSNdis_WmiOffload; - -#define MSNdis_WmiOffload_SIZE (FIELD_OFFSET(MSNdis_WmiOffload, Flags) + MSNdis_WmiOffload_Flags_SIZE) - -// MSNdis_TcpOffloadParameters - MSNdis_TcpOffloadParameters -#define MSNdis_TcpOffloadParametersGuid \ - { 0x43fe82d8,0x3468,0x497e, { 0x9d,0xcf,0xf8,0xff,0xc0,0x13,0x37,0x44 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TcpOffloadParameters_GUID, \ - 0x43fe82d8,0x3468,0x497e,0x9d,0xcf,0xf8,0xff,0xc0,0x13,0x37,0x44); -#endif - - -typedef struct _MSNdis_TcpOffloadParameters -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_TcpOffloadParameters_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_TcpOffloadParameters_Header_ID 1 - - // - UCHAR IPv4Checksum; - #define MSNdis_TcpOffloadParameters_IPv4Checksum_SIZE sizeof(UCHAR) - #define MSNdis_TcpOffloadParameters_IPv4Checksum_ID 2 - - // - UCHAR TCPIPv4Checksum; - #define MSNdis_TcpOffloadParameters_TCPIPv4Checksum_SIZE sizeof(UCHAR) - #define MSNdis_TcpOffloadParameters_TCPIPv4Checksum_ID 3 - - // - UCHAR UDPIPv4Checksum; - #define MSNdis_TcpOffloadParameters_UDPIPv4Checksum_SIZE sizeof(UCHAR) - #define MSNdis_TcpOffloadParameters_UDPIPv4Checksum_ID 4 - - // - UCHAR TCPIPv6Checksum; - #define MSNdis_TcpOffloadParameters_TCPIPv6Checksum_SIZE sizeof(UCHAR) - #define MSNdis_TcpOffloadParameters_TCPIPv6Checksum_ID 5 - - // - UCHAR UDPIPv6Checksum; - #define MSNdis_TcpOffloadParameters_UDPIPv6Checksum_SIZE sizeof(UCHAR) - #define MSNdis_TcpOffloadParameters_UDPIPv6Checksum_ID 6 - - // - UCHAR LsoV1; - #define MSNdis_TcpOffloadParameters_LsoV1_SIZE sizeof(UCHAR) - #define MSNdis_TcpOffloadParameters_LsoV1_ID 7 - - // - UCHAR IPsec; - #define MSNdis_TcpOffloadParameters_IPsec_SIZE sizeof(UCHAR) - #define MSNdis_TcpOffloadParameters_IPsec_ID 8 - - // - UCHAR LsoV2IPv4; - #define MSNdis_TcpOffloadParameters_LsoV2IPv4_SIZE sizeof(UCHAR) - #define MSNdis_TcpOffloadParameters_LsoV2IPv4_ID 9 - - // - UCHAR LsoV2IPv6; - #define MSNdis_TcpOffloadParameters_LsoV2IPv6_SIZE sizeof(UCHAR) - #define MSNdis_TcpOffloadParameters_LsoV2IPv6_ID 10 - - // - UCHAR TcpConnectionIPv4; - #define MSNdis_TcpOffloadParameters_TcpConnectionIPv4_SIZE sizeof(UCHAR) - #define MSNdis_TcpOffloadParameters_TcpConnectionIPv4_ID 11 - - // - UCHAR TcpConnectionIPv6; - #define MSNdis_TcpOffloadParameters_TcpConnectionIPv6_SIZE sizeof(UCHAR) - #define MSNdis_TcpOffloadParameters_TcpConnectionIPv6_ID 12 - - // - ULONG Flags; - #define MSNdis_TcpOffloadParameters_Flags_SIZE sizeof(ULONG) - #define MSNdis_TcpOffloadParameters_Flags_ID 13 - -} MSNdis_TcpOffloadParameters, *PMSNdis_TcpOffloadParameters; - -#define MSNdis_TcpOffloadParameters_SIZE (FIELD_OFFSET(MSNdis_TcpOffloadParameters, Flags) + MSNdis_TcpOffloadParameters_Flags_SIZE) - -// MSNdis_WmiTcpConnectionOffload - MSNdis_WmiTcpConnectionOffload -#define MSNdis_WmiTcpConnectionOffloadGuid \ - { 0x93cfcd3f,0x6228,0x455c, { 0x90,0x5e,0x3a,0xb8,0x0a,0x2f,0xf0,0x90 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiTcpConnectionOffload_GUID, \ - 0x93cfcd3f,0x6228,0x455c,0x90,0x5e,0x3a,0xb8,0x0a,0x2f,0xf0,0x90); -#endif - - -typedef struct _MSNdis_WmiTcpConnectionOffload -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_WmiTcpConnectionOffload_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_WmiTcpConnectionOffload_Header_ID 1 - - // - ULONG Encapsulation; - #define MSNdis_WmiTcpConnectionOffload_Encapsulation_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpConnectionOffload_Encapsulation_ID 2 - - // - ULONG SupportIp4; - #define MSNdis_WmiTcpConnectionOffload_SupportIp4_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpConnectionOffload_SupportIp4_ID 3 - - // - ULONG SupportIp6; - #define MSNdis_WmiTcpConnectionOffload_SupportIp6_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpConnectionOffload_SupportIp6_ID 4 - - // - ULONG SupportIp6ExtensionHeaders; - #define MSNdis_WmiTcpConnectionOffload_SupportIp6ExtensionHeaders_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpConnectionOffload_SupportIp6ExtensionHeaders_ID 5 - - // - ULONG SupportSack; - #define MSNdis_WmiTcpConnectionOffload_SupportSack_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpConnectionOffload_SupportSack_ID 6 - - // - ULONG TcpConnectionOffloadCapacity; - #define MSNdis_WmiTcpConnectionOffload_TcpConnectionOffloadCapacity_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpConnectionOffload_TcpConnectionOffloadCapacity_ID 7 - - // - ULONG Flags; - #define MSNdis_WmiTcpConnectionOffload_Flags_SIZE sizeof(ULONG) - #define MSNdis_WmiTcpConnectionOffload_Flags_ID 8 - -} MSNdis_WmiTcpConnectionOffload, *PMSNdis_WmiTcpConnectionOffload; - -#define MSNdis_WmiTcpConnectionOffload_SIZE (FIELD_OFFSET(MSNdis_WmiTcpConnectionOffload, Flags) + MSNdis_WmiTcpConnectionOffload_Flags_SIZE) - -// MSNdis_WmiHDSplitCurrentConfig - MSNdis_WmiHDSplitCurrentConfig -#define MSNdis_WmiHDSplitCurrentConfigGuid \ - { 0x34ff16bf,0x30ca,0x4a2a, { 0xa4,0x6d,0xc7,0xee,0x74,0xbc,0x35,0x82 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiHDSplitCurrentConfig_GUID, \ - 0x34ff16bf,0x30ca,0x4a2a,0xa4,0x6d,0xc7,0xee,0x74,0xbc,0x35,0x82); -#endif - - -typedef struct _MSNdis_WmiHDSplitCurrentConfig -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_WmiHDSplitCurrentConfig_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_WmiHDSplitCurrentConfig_Header_ID 1 - - // - ULONG HardwareCapabilities; - #define MSNdis_WmiHDSplitCurrentConfig_HardwareCapabilities_SIZE sizeof(ULONG) - #define MSNdis_WmiHDSplitCurrentConfig_HardwareCapabilities_ID 2 - - // - ULONG CurrentCapabilities; - #define MSNdis_WmiHDSplitCurrentConfig_CurrentCapabilities_SIZE sizeof(ULONG) - #define MSNdis_WmiHDSplitCurrentConfig_CurrentCapabilities_ID 3 - - // - ULONG HDSplitFlags; - #define MSNdis_WmiHDSplitCurrentConfig_HDSplitFlags_SIZE sizeof(ULONG) - #define MSNdis_WmiHDSplitCurrentConfig_HDSplitFlags_ID 4 - - // - ULONG HDSplitCombineFlags; - #define MSNdis_WmiHDSplitCurrentConfig_HDSplitCombineFlags_SIZE sizeof(ULONG) - #define MSNdis_WmiHDSplitCurrentConfig_HDSplitCombineFlags_ID 5 - - // - ULONG BackfillSize; - #define MSNdis_WmiHDSplitCurrentConfig_BackfillSize_SIZE sizeof(ULONG) - #define MSNdis_WmiHDSplitCurrentConfig_BackfillSize_ID 6 - - // - ULONG MaxHeaderSize; - #define MSNdis_WmiHDSplitCurrentConfig_MaxHeaderSize_SIZE sizeof(ULONG) - #define MSNdis_WmiHDSplitCurrentConfig_MaxHeaderSize_ID 7 - -} MSNdis_WmiHDSplitCurrentConfig, *PMSNdis_WmiHDSplitCurrentConfig; - -#define MSNdis_WmiHDSplitCurrentConfig_SIZE (FIELD_OFFSET(MSNdis_WmiHDSplitCurrentConfig, MaxHeaderSize) + MSNdis_WmiHDSplitCurrentConfig_MaxHeaderSize_SIZE) - -// MSNdis_HDSplitParameters - MSNdis_HDSplitParameters -#define MSNdis_HDSplitParametersGuid \ - { 0x1131c56a,0x0a5a,0x4d79, { 0x8d,0xde,0x1e,0x6f,0x17,0x80,0x05,0xee } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_HDSplitParameters_GUID, \ - 0x1131c56a,0x0a5a,0x4d79,0x8d,0xde,0x1e,0x6f,0x17,0x80,0x05,0xee); -#endif - - -typedef struct _MSNdis_HDSplitParameters -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_HDSplitParameters_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_HDSplitParameters_Header_ID 1 - - // - ULONG HDSplitCombineFlags; - #define MSNdis_HDSplitParameters_HDSplitCombineFlags_SIZE sizeof(ULONG) - #define MSNdis_HDSplitParameters_HDSplitCombineFlags_ID 2 - -} MSNdis_HDSplitParameters, *PMSNdis_HDSplitParameters; - -#define MSNdis_HDSplitParameters_SIZE (FIELD_OFFSET(MSNdis_HDSplitParameters, HDSplitCombineFlags) + MSNdis_HDSplitParameters_HDSplitCombineFlags_SIZE) - -// MSNdis_WmiReceiveScaleCapabilities - MSNdis_WmiReceiveScaleCapabilities -#define MSNdis_WmiReceiveScaleCapabilitiesGuid \ - { 0xf7a4960a,0xace3,0x44dc, { 0xb5,0x1e,0x72,0xe0,0x5c,0x5e,0xaf,0xa8 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_WmiReceiveScaleCapabilities_GUID, \ - 0xf7a4960a,0xace3,0x44dc,0xb5,0x1e,0x72,0xe0,0x5c,0x5e,0xaf,0xa8); -#endif - - -typedef struct _MSNdis_WmiReceiveScaleCapabilities -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_WmiReceiveScaleCapabilities_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_WmiReceiveScaleCapabilities_Header_ID 1 - - // - ULONG CapabilitiesFlags; - #define MSNdis_WmiReceiveScaleCapabilities_CapabilitiesFlags_SIZE sizeof(ULONG) - #define MSNdis_WmiReceiveScaleCapabilities_CapabilitiesFlags_ID 2 - - // - ULONG NumberOfInterruptMessages; - #define MSNdis_WmiReceiveScaleCapabilities_NumberOfInterruptMessages_SIZE sizeof(ULONG) - #define MSNdis_WmiReceiveScaleCapabilities_NumberOfInterruptMessages_ID 3 - - // - ULONG NumberOfReceiveQueues; - #define MSNdis_WmiReceiveScaleCapabilities_NumberOfReceiveQueues_SIZE sizeof(ULONG) - #define MSNdis_WmiReceiveScaleCapabilities_NumberOfReceiveQueues_ID 4 - -} MSNdis_WmiReceiveScaleCapabilities, *PMSNdis_WmiReceiveScaleCapabilities; - -#define MSNdis_WmiReceiveScaleCapabilities_SIZE (FIELD_OFFSET(MSNdis_WmiReceiveScaleCapabilities, NumberOfReceiveQueues) + MSNdis_WmiReceiveScaleCapabilities_NumberOfReceiveQueues_SIZE) - -// MSNdis_ReceiveFilterCapabilities - MSNdis_ReceiveFilterCapabilities -#define MSNdis_ReceiveFilterCapabilitiesGuid \ - { 0x146360a3,0x88dd,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveFilterCapabilities_GUID, \ - 0x146360a3,0x88dd,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - - -typedef struct _MSNdis_ReceiveFilterCapabilities -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_ReceiveFilterCapabilities_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_ReceiveFilterCapabilities_Header_ID 1 - - // - ULONG Flags; - #define MSNdis_ReceiveFilterCapabilities_Flags_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_Flags_ID 2 - - // - ULONG EnabledFilterTypes; - #define MSNdis_ReceiveFilterCapabilities_EnabledFilterTypes_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_EnabledFilterTypes_ID 3 - - // - ULONG EnabledQueueTypes; - #define MSNdis_ReceiveFilterCapabilities_EnabledQueueTypes_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_EnabledQueueTypes_ID 4 - - // - ULONG NumQueues; - #define MSNdis_ReceiveFilterCapabilities_NumQueues_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_NumQueues_ID 5 - - // - ULONG SupportedQueueProperties; - #define MSNdis_ReceiveFilterCapabilities_SupportedQueueProperties_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_SupportedQueueProperties_ID 6 - - // - ULONG SupportedFilterTests; - #define MSNdis_ReceiveFilterCapabilities_SupportedFilterTests_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_SupportedFilterTests_ID 7 - - // - ULONG SupportedHeaders; - #define MSNdis_ReceiveFilterCapabilities_SupportedHeaders_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_SupportedHeaders_ID 8 - - // - ULONG SupportedMacHeaderFields; - #define MSNdis_ReceiveFilterCapabilities_SupportedMacHeaderFields_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_SupportedMacHeaderFields_ID 9 - - // - ULONG MaxMacHeaderFilters; - #define MSNdis_ReceiveFilterCapabilities_MaxMacHeaderFilters_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_MaxMacHeaderFilters_ID 10 - - // - ULONG MaxQueueGroups; - #define MSNdis_ReceiveFilterCapabilities_MaxQueueGroups_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_MaxQueueGroups_ID 11 - - // - ULONG MaxQueuesPerQueueGroup; - #define MSNdis_ReceiveFilterCapabilities_MaxQueuesPerQueueGroup_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_MaxQueuesPerQueueGroup_ID 12 - - // - ULONG MinLookaheadSplitSize; - #define MSNdis_ReceiveFilterCapabilities_MinLookaheadSplitSize_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_MinLookaheadSplitSize_ID 13 - - // - ULONG MaxLookaheadSplitSize; - #define MSNdis_ReceiveFilterCapabilities_MaxLookaheadSplitSize_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterCapabilities_MaxLookaheadSplitSize_ID 14 - -} MSNdis_ReceiveFilterCapabilities, *PMSNdis_ReceiveFilterCapabilities; - -#define MSNdis_ReceiveFilterCapabilities_SIZE (FIELD_OFFSET(MSNdis_ReceiveFilterCapabilities, MaxLookaheadSplitSize) + MSNdis_ReceiveFilterCapabilities_MaxLookaheadSplitSize_SIZE) - -// MSNdis_ReceiveFilterGlobalParameters - MSNdis_ReceiveFilterGlobalParameters -#define MSNdis_ReceiveFilterGlobalParametersGuid \ - { 0x146360a4,0x88dd,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveFilterGlobalParameters_GUID, \ - 0x146360a4,0x88dd,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - - -typedef struct _MSNdis_ReceiveFilterGlobalParameters -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_ReceiveFilterGlobalParameters_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_ReceiveFilterGlobalParameters_Header_ID 1 - - // - ULONG Flags; - #define MSNdis_ReceiveFilterGlobalParameters_Flags_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterGlobalParameters_Flags_ID 2 - - // - ULONG EnabledFilterTypes; - #define MSNdis_ReceiveFilterGlobalParameters_EnabledFilterTypes_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterGlobalParameters_EnabledFilterTypes_ID 3 - - // - ULONG EnabledQueueTypes; - #define MSNdis_ReceiveFilterGlobalParameters_EnabledQueueTypes_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterGlobalParameters_EnabledQueueTypes_ID 4 - -} MSNdis_ReceiveFilterGlobalParameters, *PMSNdis_ReceiveFilterGlobalParameters; - -#define MSNdis_ReceiveFilterGlobalParameters_SIZE (FIELD_OFFSET(MSNdis_ReceiveFilterGlobalParameters, EnabledQueueTypes) + MSNdis_ReceiveFilterGlobalParameters_EnabledQueueTypes_SIZE) - -// MSNdis_CountedString - MSNdis_CountedString -#define MSNdis_CountedStringGuid \ - { 0x146360a5,0x88dd,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_CountedString_GUID, \ - 0x146360a5,0x88dd,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - - -typedef struct _MSNdis_CountedString -{ - // - USHORT Length; - #define MSNdis_CountedString_Length_SIZE sizeof(USHORT) - #define MSNdis_CountedString_Length_ID 1 - - // - SHORT String[257]; - #define MSNdis_CountedString_String_SIZE sizeof(SHORT[257]) - #define MSNdis_CountedString_String_ID 2 - -} MSNdis_CountedString, *PMSNdis_CountedString; - -#define MSNdis_CountedString_SIZE (FIELD_OFFSET(MSNdis_CountedString, String) + MSNdis_CountedString_String_SIZE) - -// MSNdis_ReceiveFilterInfo - MSNdis_ReceiveFilterInfo -#define MSNdis_ReceiveFilterInfoGuid \ - { 0x146360a9,0x88dd,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveFilterInfo_GUID, \ - 0x146360a9,0x88dd,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - - -typedef struct _MSNdis_ReceiveFilterInfo -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_ReceiveFilterInfo_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_ReceiveFilterInfo_Header_ID 1 - - // - ULONG Flags; - #define MSNdis_ReceiveFilterInfo_Flags_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterInfo_Flags_ID 2 - - // - ULONG FilterType; - #define MSNdis_ReceiveFilterInfo_FilterType_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterInfo_FilterType_ID 3 - - // - ULONG FilterId; - #define MSNdis_ReceiveFilterInfo_FilterId_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterInfo_FilterId_ID 4 - -} MSNdis_ReceiveFilterInfo, *PMSNdis_ReceiveFilterInfo; - -#define MSNdis_ReceiveFilterInfo_SIZE (FIELD_OFFSET(MSNdis_ReceiveFilterInfo, FilterId) + MSNdis_ReceiveFilterInfo_FilterId_SIZE) - -// MSNdis_ReceiveFilterInfoArray - MSNdis_ReceiveFilterInfoArray -#define MSNdis_ReceiveFilterInfoArrayGuid \ - { 0x146360aa,0x88dd,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveFilterInfoArray_GUID, \ - 0x146360aa,0x88dd,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - - -typedef struct _MSNdis_ReceiveFilterInfoArray -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_ReceiveFilterInfoArray_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_ReceiveFilterInfoArray_Header_ID 1 - - // - ULONG QueueId; - #define MSNdis_ReceiveFilterInfoArray_QueueId_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterInfoArray_QueueId_ID 2 - - // - ULONG FirstElementOffset; - #define MSNdis_ReceiveFilterInfoArray_FirstElementOffset_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterInfoArray_FirstElementOffset_ID 3 - - // - ULONG NumElements; - #define MSNdis_ReceiveFilterInfoArray_NumElements_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterInfoArray_NumElements_ID 4 - - // - ULONG ElementSize; - #define MSNdis_ReceiveFilterInfoArray_ElementSize_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterInfoArray_ElementSize_ID 5 - - // - MSNdis_ReceiveFilterInfo Filter[1]; - #define MSNdis_ReceiveFilterInfoArray_Filter_ID 6 - -} MSNdis_ReceiveFilterInfoArray, *PMSNdis_ReceiveFilterInfoArray; - -// MSNdis_ReceiveFilterFieldParameters - MSNdis_ReceiveFilterFieldParameters -#define MSNdis_ReceiveFilterFieldParametersGuid \ - { 0x146360ab,0x88dd,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveFilterFieldParameters_GUID, \ - 0x146360ab,0x88dd,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - - -typedef struct _MSNdis_ReceiveFilterFieldParameters -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_ReceiveFilterFieldParameters_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_ReceiveFilterFieldParameters_Header_ID 1 - - // - ULONG Flags; - #define MSNdis_ReceiveFilterFieldParameters_Flags_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterFieldParameters_Flags_ID 2 - - // - ULONG FrameHeader; - #define MSNdis_ReceiveFilterFieldParameters_FrameHeader_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterFieldParameters_FrameHeader_ID 3 - - // - ULONG ReceiveFilterTest; - #define MSNdis_ReceiveFilterFieldParameters_ReceiveFilterTest_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterFieldParameters_ReceiveFilterTest_ID 4 - - // - ULONG MacHeaderField; - #define MSNdis_ReceiveFilterFieldParameters_MacHeaderField_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterFieldParameters_MacHeaderField_ID 5 - - // - UCHAR FieldByteArrayValue[16]; - #define MSNdis_ReceiveFilterFieldParameters_FieldByteArrayValue_SIZE sizeof(UCHAR[16]) - #define MSNdis_ReceiveFilterFieldParameters_FieldByteArrayValue_ID 6 - - // - UCHAR ResultByteArrayValue[16]; - #define MSNdis_ReceiveFilterFieldParameters_ResultByteArrayValue_SIZE sizeof(UCHAR[16]) - #define MSNdis_ReceiveFilterFieldParameters_ResultByteArrayValue_ID 7 - -} MSNdis_ReceiveFilterFieldParameters, *PMSNdis_ReceiveFilterFieldParameters; - -#define MSNdis_ReceiveFilterFieldParameters_SIZE (FIELD_OFFSET(MSNdis_ReceiveFilterFieldParameters, ResultByteArrayValue) + MSNdis_ReceiveFilterFieldParameters_ResultByteArrayValue_SIZE) - -// MSNdis_ReceiveFilterParameters - MSNdis_ReceiveFilterParameters -#define MSNdis_ReceiveFilterParametersGuid \ - { 0x146360ac,0x88dd,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveFilterParameters_GUID, \ - 0x146360ac,0x88dd,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - - -typedef struct _MSNdis_ReceiveFilterParameters -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_ReceiveFilterParameters_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_ReceiveFilterParameters_Header_ID 1 - - // - ULONG Flags; - #define MSNdis_ReceiveFilterParameters_Flags_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterParameters_Flags_ID 2 - - // - ULONG FilterType; - #define MSNdis_ReceiveFilterParameters_FilterType_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterParameters_FilterType_ID 3 - - // - ULONG QueueId; - #define MSNdis_ReceiveFilterParameters_QueueId_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterParameters_QueueId_ID 4 - - // - ULONG FilterId; - #define MSNdis_ReceiveFilterParameters_FilterId_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterParameters_FilterId_ID 5 - - // - ULONG FieldParametersArrayOffset; - #define MSNdis_ReceiveFilterParameters_FieldParametersArrayOffset_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterParameters_FieldParametersArrayOffset_ID 6 - - // - ULONG FieldParametersArrayNumElements; - #define MSNdis_ReceiveFilterParameters_FieldParametersArrayNumElements_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterParameters_FieldParametersArrayNumElements_ID 7 - - // - ULONG FieldParametersArrayElementSize; - #define MSNdis_ReceiveFilterParameters_FieldParametersArrayElementSize_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterParameters_FieldParametersArrayElementSize_ID 8 - - // - ULONG RequestedFilterIdBitCount; - #define MSNdis_ReceiveFilterParameters_RequestedFilterIdBitCount_SIZE sizeof(ULONG) - #define MSNdis_ReceiveFilterParameters_RequestedFilterIdBitCount_ID 9 - - // - MSNdis_ReceiveFilterFieldParameters FieldParameters[1]; - #define MSNdis_ReceiveFilterParameters_FieldParameters_ID 10 - -} MSNdis_ReceiveFilterParameters, *PMSNdis_ReceiveFilterParameters; - -// MSNdis_NicSwitchCapabilities - MSNdis_NicSwitchCapabilities -#define MSNdis_NicSwitchCapabilitiesGuid \ - { 0xdb80dd1c,0x59ae,0x48e7, { 0xb7,0xec,0xf9,0xbe,0x2c,0x4b,0x8c,0xb0 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_NicSwitchCapabilities_GUID, \ - 0xdb80dd1c,0x59ae,0x48e7,0xb7,0xec,0xf9,0xbe,0x2c,0x4b,0x8c,0xb0); -#endif - - -typedef struct _MSNdis_NicSwitchCapabilities -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_NicSwitchCapabilities_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_NicSwitchCapabilities_Header_ID 1 - - // - ULONG Flags; - #define MSNdis_NicSwitchCapabilities_Flags_SIZE sizeof(ULONG) - #define MSNdis_NicSwitchCapabilities_Flags_ID 2 - - // - ULONG NdisReserved1; - #define MSNdis_NicSwitchCapabilities_NdisReserved1_SIZE sizeof(ULONG) - #define MSNdis_NicSwitchCapabilities_NdisReserved1_ID 3 - - // - ULONG NumTotalMacAddresses; - #define MSNdis_NicSwitchCapabilities_NumTotalMacAddresses_SIZE sizeof(ULONG) - #define MSNdis_NicSwitchCapabilities_NumTotalMacAddresses_ID 4 - - // - ULONG NumMacAddressesPerPort; - #define MSNdis_NicSwitchCapabilities_NumMacAddressesPerPort_SIZE sizeof(ULONG) - #define MSNdis_NicSwitchCapabilities_NumMacAddressesPerPort_ID 5 - - // - ULONG NumVlansPerPort; - #define MSNdis_NicSwitchCapabilities_NumVlansPerPort_SIZE sizeof(ULONG) - #define MSNdis_NicSwitchCapabilities_NumVlansPerPort_ID 6 - - // - ULONG NdisReserved2; - #define MSNdis_NicSwitchCapabilities_NdisReserved2_SIZE sizeof(ULONG) - #define MSNdis_NicSwitchCapabilities_NdisReserved2_ID 7 - - // - ULONG NdisReserved3; - #define MSNdis_NicSwitchCapabilities_NdisReserved3_SIZE sizeof(ULONG) - #define MSNdis_NicSwitchCapabilities_NdisReserved3_ID 8 - -} MSNdis_NicSwitchCapabilities, *PMSNdis_NicSwitchCapabilities; - -#define MSNdis_NicSwitchCapabilities_SIZE (FIELD_OFFSET(MSNdis_NicSwitchCapabilities, NdisReserved3) + MSNdis_NicSwitchCapabilities_NdisReserved3_SIZE) - -// MSNdis_GroupAffinity - MSNdis_GroupAffinity -#define MSNdis_GroupAffinityGuid \ - { 0xf786fbd5,0xc049,0x11dd, { 0xb8,0x85,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_GroupAffinity_GUID, \ - 0xf786fbd5,0xc049,0x11dd,0xb8,0x85,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - - -typedef struct _MSNdis_GroupAffinity -{ - // - ULONGLONG Mask; - #define MSNdis_GroupAffinity_Mask_SIZE sizeof(ULONGLONG) - #define MSNdis_GroupAffinity_Mask_ID 1 - - // - USHORT Group; - #define MSNdis_GroupAffinity_Group_SIZE sizeof(USHORT) - #define MSNdis_GroupAffinity_Group_ID 2 - - // - USHORT Reserved[3]; - #define MSNdis_GroupAffinity_Reserved_SIZE sizeof(USHORT[3]) - #define MSNdis_GroupAffinity_Reserved_ID 3 - -} MSNdis_GroupAffinity, *PMSNdis_GroupAffinity; - -#define MSNdis_GroupAffinity_SIZE (FIELD_OFFSET(MSNdis_GroupAffinity, Reserved) + MSNdis_GroupAffinity_Reserved_SIZE) - -// MSNdis_ReceiveQueueParameters - MSNdis_ReceiveQueueParameters -#define MSNdis_ReceiveQueueParametersGuid \ - { 0xf786fbd6,0xc049,0x11dd, { 0xb8,0x85,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveQueueParameters_GUID, \ - 0xf786fbd6,0xc049,0x11dd,0xb8,0x85,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - - -typedef struct _MSNdis_ReceiveQueueParameters -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_ReceiveQueueParameters_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_ReceiveQueueParameters_Header_ID 1 - - // - ULONG Flags; - #define MSNdis_ReceiveQueueParameters_Flags_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueParameters_Flags_ID 2 - - // - ULONG QueueType; - #define MSNdis_ReceiveQueueParameters_QueueType_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueParameters_QueueType_ID 3 - - // - ULONG QueueId; - #define MSNdis_ReceiveQueueParameters_QueueId_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueParameters_QueueId_ID 4 - - // - ULONG QueueGroupId; - #define MSNdis_ReceiveQueueParameters_QueueGroupId_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueParameters_QueueGroupId_ID 5 - - // - MSNdis_GroupAffinity ProcessorAffinity; - #define MSNdis_ReceiveQueueParameters_ProcessorAffinity_SIZE sizeof(MSNdis_GroupAffinity) - #define MSNdis_ReceiveQueueParameters_ProcessorAffinity_ID 6 - - // - ULONG NumSuggestedReceiveBuffers; - #define MSNdis_ReceiveQueueParameters_NumSuggestedReceiveBuffers_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueParameters_NumSuggestedReceiveBuffers_ID 7 - - // - ULONG MSIXTableEntry; - #define MSNdis_ReceiveQueueParameters_MSIXTableEntry_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueParameters_MSIXTableEntry_ID 8 - - // - ULONG LookaheadSize; - #define MSNdis_ReceiveQueueParameters_LookaheadSize_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueParameters_LookaheadSize_ID 9 - - // - MSNdis_CountedString VmName; - #define MSNdis_ReceiveQueueParameters_VmName_SIZE sizeof(MSNdis_CountedString) - #define MSNdis_ReceiveQueueParameters_VmName_ID 10 - - // - MSNdis_CountedString QueueName; - #define MSNdis_ReceiveQueueParameters_QueueName_SIZE sizeof(MSNdis_CountedString) - #define MSNdis_ReceiveQueueParameters_QueueName_ID 11 - -} MSNdis_ReceiveQueueParameters, *PMSNdis_ReceiveQueueParameters; - -#define MSNdis_ReceiveQueueParameters_SIZE (FIELD_OFFSET(MSNdis_ReceiveQueueParameters, QueueName) + MSNdis_ReceiveQueueParameters_QueueName_SIZE) - -// MSNdis_ReceiveQueueInfo - MSNdis_ReceiveQueueInfo -#define MSNdis_ReceiveQueueInfoGuid \ - { 0xf786fbd7,0xc049,0x11dd, { 0xb8,0x85,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveQueueInfo_GUID, \ - 0xf786fbd7,0xc049,0x11dd,0xb8,0x85,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - - -typedef struct _MSNdis_ReceiveQueueInfo -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_ReceiveQueueInfo_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_ReceiveQueueInfo_Header_ID 1 - - // - ULONG Flags; - #define MSNdis_ReceiveQueueInfo_Flags_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueInfo_Flags_ID 2 - - // - ULONG QueueType; - #define MSNdis_ReceiveQueueInfo_QueueType_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueInfo_QueueType_ID 3 - - // - ULONG QueueId; - #define MSNdis_ReceiveQueueInfo_QueueId_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueInfo_QueueId_ID 4 - - // - ULONG QueueGroupId; - #define MSNdis_ReceiveQueueInfo_QueueGroupId_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueInfo_QueueGroupId_ID 5 - - // - ULONG QueueState; - #define MSNdis_ReceiveQueueInfo_QueueState_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueInfo_QueueState_ID 6 - - // - MSNdis_GroupAffinity ProcessorAffinity; - #define MSNdis_ReceiveQueueInfo_ProcessorAffinity_SIZE sizeof(MSNdis_GroupAffinity) - #define MSNdis_ReceiveQueueInfo_ProcessorAffinity_ID 7 - - // - ULONG NumSuggestedReceiveBuffers; - #define MSNdis_ReceiveQueueInfo_NumSuggestedReceiveBuffers_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueInfo_NumSuggestedReceiveBuffers_ID 8 - - // - ULONG MSIXTableEntry; - #define MSNdis_ReceiveQueueInfo_MSIXTableEntry_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueInfo_MSIXTableEntry_ID 9 - - // - ULONG LookaheadSize; - #define MSNdis_ReceiveQueueInfo_LookaheadSize_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueInfo_LookaheadSize_ID 10 - - // - MSNdis_CountedString VmName; - #define MSNdis_ReceiveQueueInfo_VmName_SIZE sizeof(MSNdis_CountedString) - #define MSNdis_ReceiveQueueInfo_VmName_ID 11 - - // - MSNdis_CountedString QueueName; - #define MSNdis_ReceiveQueueInfo_QueueName_SIZE sizeof(MSNdis_CountedString) - #define MSNdis_ReceiveQueueInfo_QueueName_ID 12 - -} MSNdis_ReceiveQueueInfo, *PMSNdis_ReceiveQueueInfo; - -#define MSNdis_ReceiveQueueInfo_SIZE (FIELD_OFFSET(MSNdis_ReceiveQueueInfo, QueueName) + MSNdis_ReceiveQueueInfo_QueueName_SIZE) - -// MSNdis_ReceiveQueueInfoArray - MSNdis_ReceiveQueueInfoArray -#define MSNdis_ReceiveQueueInfoArrayGuid \ - { 0xf786fbd8,0xc049,0x11dd, { 0xb8,0x85,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveQueueInfoArray_GUID, \ - 0xf786fbd8,0xc049,0x11dd,0xb8,0x85,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - - -typedef struct _MSNdis_ReceiveQueueInfoArray -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_ReceiveQueueInfoArray_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_ReceiveQueueInfoArray_Header_ID 1 - - // - ULONG FirstElementOffset; - #define MSNdis_ReceiveQueueInfoArray_FirstElementOffset_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueInfoArray_FirstElementOffset_ID 2 - - // - ULONG NumElements; - #define MSNdis_ReceiveQueueInfoArray_NumElements_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueInfoArray_NumElements_ID 3 - - // - ULONG ElementSize; - #define MSNdis_ReceiveQueueInfoArray_ElementSize_SIZE sizeof(ULONG) - #define MSNdis_ReceiveQueueInfoArray_ElementSize_ID 4 - - // - MSNdis_ReceiveQueueInfo Queue[1]; - #define MSNdis_ReceiveQueueInfoArray_Queue_ID 5 - -} MSNdis_ReceiveQueueInfoArray, *PMSNdis_ReceiveQueueInfoArray; - -// MSNdis_LinkState - MSNdis_LinkState -#define MSNdis_LinkStateGuid \ - { 0xba1f4c14,0xa945,0x4762, { 0xb9,0x16,0x0b,0x55,0x15,0xb6,0xf4,0x3a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_LinkState_GUID, \ - 0xba1f4c14,0xa945,0x4762,0xb9,0x16,0x0b,0x55,0x15,0xb6,0xf4,0x3a); -#endif - -// -// Method id definitions for MSNdis_LinkState -#define WmiQueryLinkState 1 -typedef struct _WmiQueryLinkState_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryLinkState_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryLinkState_IN_Header_ID 1 - -} WmiQueryLinkState_IN, *PWmiQueryLinkState_IN; - -#define WmiQueryLinkState_IN_SIZE (FIELD_OFFSET(WmiQueryLinkState_IN, Header) + WmiQueryLinkState_IN_Header_SIZE) - -typedef struct _WmiQueryLinkState_OUT -{ - // - MSNdis_LinkStateData LinkState; - #define WmiQueryLinkState_OUT_LinkState_SIZE sizeof(MSNdis_LinkStateData) - #define WmiQueryLinkState_OUT_LinkState_ID 2 - -} WmiQueryLinkState_OUT, *PWmiQueryLinkState_OUT; - -#define WmiQueryLinkState_OUT_SIZE (FIELD_OFFSET(WmiQueryLinkState_OUT, LinkState) + WmiQueryLinkState_OUT_LinkState_SIZE) - - -// MSNdis_QueryInterruptModeration - MSNdis_QueryInterruptModeration -#define MSNdis_QueryInterruptModerationGuid \ - { 0xd9c8eea5,0xf16e,0x467c, { 0x84,0xd5,0x63,0x45,0xa2,0x2c,0xe2,0x13 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_QueryInterruptModeration_GUID, \ - 0xd9c8eea5,0xf16e,0x467c,0x84,0xd5,0x63,0x45,0xa2,0x2c,0xe2,0x13); -#endif - -// -// Method id definitions for MSNdis_QueryInterruptModeration -#define WmiQueryInterruptModeration 1 -typedef struct _WmiQueryInterruptModeration_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryInterruptModeration_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryInterruptModeration_IN_Header_ID 1 - -} WmiQueryInterruptModeration_IN, *PWmiQueryInterruptModeration_IN; - -#define WmiQueryInterruptModeration_IN_SIZE (FIELD_OFFSET(WmiQueryInterruptModeration_IN, Header) + WmiQueryInterruptModeration_IN_Header_SIZE) - -typedef struct _WmiQueryInterruptModeration_OUT -{ - // - MSNdis_InterruptModerationParameters InterruptModeration; - #define WmiQueryInterruptModeration_OUT_InterruptModeration_SIZE sizeof(MSNdis_InterruptModerationParameters) - #define WmiQueryInterruptModeration_OUT_InterruptModeration_ID 2 - -} WmiQueryInterruptModeration_OUT, *PWmiQueryInterruptModeration_OUT; - -#define WmiQueryInterruptModeration_OUT_SIZE (FIELD_OFFSET(WmiQueryInterruptModeration_OUT, InterruptModeration) + WmiQueryInterruptModeration_OUT_InterruptModeration_SIZE) - - -// MSNdis_SetInterruptModeration - MSNdis_SetInterruptModeration -#define MSNdis_SetInterruptModerationGuid \ - { 0xd789adfa,0x9c56,0x433b, { 0xad,0x01,0x75,0x74,0xf3,0xce,0xdb,0xe9 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_SetInterruptModeration_GUID, \ - 0xd789adfa,0x9c56,0x433b,0xad,0x01,0x75,0x74,0xf3,0xce,0xdb,0xe9); -#endif - -// -// Method id definitions for MSNdis_SetInterruptModeration -#define WmiSetInterruptModeration 1 -typedef struct _WmiSetInterruptModeration_IN -{ - // - MSNdis_WmiMethodHeader MethodHeader; - #define WmiSetInterruptModeration_IN_MethodHeader_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiSetInterruptModeration_IN_MethodHeader_ID 1 - - // - MSNdis_InterruptModerationParameters InterruptModeration; - #define WmiSetInterruptModeration_IN_InterruptModeration_SIZE sizeof(MSNdis_InterruptModerationParameters) - #define WmiSetInterruptModeration_IN_InterruptModeration_ID 2 - -} WmiSetInterruptModeration_IN, *PWmiSetInterruptModeration_IN; - -#define WmiSetInterruptModeration_IN_SIZE (FIELD_OFFSET(WmiSetInterruptModeration_IN, InterruptModeration) + WmiSetInterruptModeration_IN_InterruptModeration_SIZE) - -typedef struct _WmiSetInterruptModeration_OUT -{ - // - MSNdis_WmiOutputInfo OutputInfo; - #define WmiSetInterruptModeration_OUT_OutputInfo_SIZE sizeof(MSNdis_WmiOutputInfo) - #define WmiSetInterruptModeration_OUT_OutputInfo_ID 3 - -} WmiSetInterruptModeration_OUT, *PWmiSetInterruptModeration_OUT; - -#define WmiSetInterruptModeration_OUT_SIZE (FIELD_OFFSET(WmiSetInterruptModeration_OUT, OutputInfo) + WmiSetInterruptModeration_OUT_OutputInfo_SIZE) - - -// MSNdis_SetLinkParameters - MSNdis_SetLinkParameters -#define MSNdis_SetLinkParametersGuid \ - { 0x8c7d3579,0x252b,0x4614, { 0x82,0xc5,0xa6,0x50,0xda,0xa1,0x50,0x49 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_SetLinkParameters_GUID, \ - 0x8c7d3579,0x252b,0x4614,0x82,0xc5,0xa6,0x50,0xda,0xa1,0x50,0x49); -#endif - -// -// Method id definitions for MSNdis_SetLinkParameters -#define WmiSetLinkParameters 1 -typedef struct _WmiSetLinkParameters_IN -{ - // - MSNdis_WmiMethodHeader MethodHeader; - #define WmiSetLinkParameters_IN_MethodHeader_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiSetLinkParameters_IN_MethodHeader_ID 1 - - // - MSNdis_LinkParameters LinkParameters; - #define WmiSetLinkParameters_IN_LinkParameters_SIZE sizeof(MSNdis_LinkParameters) - #define WmiSetLinkParameters_IN_LinkParameters_ID 2 - -} WmiSetLinkParameters_IN, *PWmiSetLinkParameters_IN; - -#define WmiSetLinkParameters_IN_SIZE (FIELD_OFFSET(WmiSetLinkParameters_IN, LinkParameters) + WmiSetLinkParameters_IN_LinkParameters_SIZE) - -typedef struct _WmiSetLinkParameters_OUT -{ - // - MSNdis_WmiOutputInfo OutputInfo; - #define WmiSetLinkParameters_OUT_OutputInfo_SIZE sizeof(MSNdis_WmiOutputInfo) - #define WmiSetLinkParameters_OUT_OutputInfo_ID 3 - -} WmiSetLinkParameters_OUT, *PWmiSetLinkParameters_OUT; - -#define WmiSetLinkParameters_OUT_SIZE (FIELD_OFFSET(WmiSetLinkParameters_OUT, OutputInfo) + WmiSetLinkParameters_OUT_OutputInfo_SIZE) - - -// MSNdis_QueryStatisticsInfo - MSNdis_QueryStatisticsInfo -#define MSNdis_QueryStatisticsInfoGuid \ - { 0x368c45b5,0xc129,0x43c1, { 0x93,0x9e,0x7e,0xdc,0x2d,0x7f,0xe6,0x21 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_QueryStatisticsInfo_GUID, \ - 0x368c45b5,0xc129,0x43c1,0x93,0x9e,0x7e,0xdc,0x2d,0x7f,0xe6,0x21); -#endif - -// -// Method id definitions for MSNdis_QueryStatisticsInfo -#define WmiQueryStatisticsInfo 1 -typedef struct _WmiQueryStatisticsInfo_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryStatisticsInfo_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryStatisticsInfo_IN_Header_ID 1 - -} WmiQueryStatisticsInfo_IN, *PWmiQueryStatisticsInfo_IN; - -#define WmiQueryStatisticsInfo_IN_SIZE (FIELD_OFFSET(WmiQueryStatisticsInfo_IN, Header) + WmiQueryStatisticsInfo_IN_Header_SIZE) - -typedef struct _WmiQueryStatisticsInfo_OUT -{ - // - MSNdis_StatisticsInfo StatisticsInfo; - #define WmiQueryStatisticsInfo_OUT_StatisticsInfo_SIZE sizeof(MSNdis_StatisticsInfo) - #define WmiQueryStatisticsInfo_OUT_StatisticsInfo_ID 2 - -} WmiQueryStatisticsInfo_OUT, *PWmiQueryStatisticsInfo_OUT; - -#define WmiQueryStatisticsInfo_OUT_SIZE (FIELD_OFFSET(WmiQueryStatisticsInfo_OUT, StatisticsInfo) + WmiQueryStatisticsInfo_OUT_StatisticsInfo_SIZE) - - -// MSNdis_QueryPortState - MSNdis_QueryPortState -#define MSNdis_QueryPortStateGuid \ - { 0x6fbf2a5f,0x8b8f,0x4920, { 0x81,0x43,0xe6,0xc4,0x60,0xf5,0x25,0x24 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_QueryPortState_GUID, \ - 0x6fbf2a5f,0x8b8f,0x4920,0x81,0x43,0xe6,0xc4,0x60,0xf5,0x25,0x24); -#endif - -// -// Method id definitions for MSNdis_QueryPortState -#define WmiQueryPortState 1 -typedef struct _WmiQueryPortState_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryPortState_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryPortState_IN_Header_ID 1 - -} WmiQueryPortState_IN, *PWmiQueryPortState_IN; - -#define WmiQueryPortState_IN_SIZE (FIELD_OFFSET(WmiQueryPortState_IN, Header) + WmiQueryPortState_IN_Header_SIZE) - -typedef struct _WmiQueryPortState_OUT -{ - // - MSNdis_PortStateData PortState; - #define WmiQueryPortState_OUT_PortState_SIZE sizeof(MSNdis_PortStateData) - #define WmiQueryPortState_OUT_PortState_ID 2 - -} WmiQueryPortState_OUT, *PWmiQueryPortState_OUT; - -#define WmiQueryPortState_OUT_SIZE (FIELD_OFFSET(WmiQueryPortState_OUT, PortState) + WmiQueryPortState_OUT_PortState_SIZE) - - -// MSNdis_EnumeratePorts - MSNdis_EnumeratePorts -#define MSNdis_EnumeratePortsGuid \ - { 0xf1d6abe8,0x15e4,0x4407, { 0x81,0xb7,0x6b,0x83,0x0c,0x77,0x7c,0xd9 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EnumeratePorts_GUID, \ - 0xf1d6abe8,0x15e4,0x4407,0x81,0xb7,0x6b,0x83,0x0c,0x77,0x7c,0xd9); -#endif - -// -// Method id definitions for MSNdis_EnumeratePorts -#define WmiEnumeratePorts 1 -typedef struct _WmiEnumeratePorts_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiEnumeratePorts_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiEnumeratePorts_IN_Header_ID 1 - -} WmiEnumeratePorts_IN, *PWmiEnumeratePorts_IN; - -#define WmiEnumeratePorts_IN_SIZE (FIELD_OFFSET(WmiEnumeratePorts_IN, Header) + WmiEnumeratePorts_IN_Header_SIZE) - -typedef struct _WmiEnumeratePorts_OUT -{ - // - MSNdis_PortArray Ports; - #define WmiEnumeratePorts_OUT_Ports_SIZE sizeof(MSNdis_PortArray) - #define WmiEnumeratePorts_OUT_Ports_ID 2 - -} WmiEnumeratePorts_OUT, *PWmiEnumeratePorts_OUT; - -#define WmiEnumeratePorts_OUT_SIZE (FIELD_OFFSET(WmiEnumeratePorts_OUT, Ports) + WmiEnumeratePorts_OUT_Ports_SIZE) - - -// MSNdis_SetPortParameters - MSNdis_SetPortParameters -#define MSNdis_SetPortParametersGuid \ - { 0xaab6ac31,0x86fb,0x48fb, { 0x8b,0x48,0x63,0xdb,0x23,0x5a,0xce,0x16 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_SetPortParameters_GUID, \ - 0xaab6ac31,0x86fb,0x48fb,0x8b,0x48,0x63,0xdb,0x23,0x5a,0xce,0x16); -#endif - -// -// Method id definitions for MSNdis_SetPortParameters -#define WmiSetPortParameters 1 -typedef struct _WmiSetPortParameters_IN -{ - // - MSNdis_WmiMethodHeader MethodHeader; - #define WmiSetPortParameters_IN_MethodHeader_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiSetPortParameters_IN_MethodHeader_ID 1 - - // - MSNdis_PortAuthParameters PortParameters; - #define WmiSetPortParameters_IN_PortParameters_SIZE sizeof(MSNdis_PortAuthParameters) - #define WmiSetPortParameters_IN_PortParameters_ID 2 - -} WmiSetPortParameters_IN, *PWmiSetPortParameters_IN; - -#define WmiSetPortParameters_IN_SIZE (FIELD_OFFSET(WmiSetPortParameters_IN, PortParameters) + WmiSetPortParameters_IN_PortParameters_SIZE) - -typedef struct _WmiSetPortParameters_OUT -{ - // - MSNdis_WmiOutputInfo OutputInfo; - #define WmiSetPortParameters_OUT_OutputInfo_SIZE sizeof(MSNdis_WmiOutputInfo) - #define WmiSetPortParameters_OUT_OutputInfo_ID 3 - -} WmiSetPortParameters_OUT, *PWmiSetPortParameters_OUT; - -#define WmiSetPortParameters_OUT_SIZE (FIELD_OFFSET(WmiSetPortParameters_OUT, OutputInfo) + WmiSetPortParameters_OUT_OutputInfo_SIZE) - - -// MSNdis_QueryPciDeviceCustomProperty - MSNdis_QueryPciDeviceCustomProperty -#define MSNdis_QueryPciDeviceCustomPropertyGuid \ - { 0xaa39f5ab,0xe260,0x4d01, { 0x82,0xb0,0xb7,0x37,0xc8,0x80,0xea,0x05 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_QueryPciDeviceCustomProperty_GUID, \ - 0xaa39f5ab,0xe260,0x4d01,0x82,0xb0,0xb7,0x37,0xc8,0x80,0xea,0x05); -#endif - -// -// Method id definitions for MSNdis_QueryPciDeviceCustomProperty -#define WmiQueryPciDeviceCustomProperty 1 -typedef struct _WmiQueryPciDeviceCustomProperty_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryPciDeviceCustomProperty_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryPciDeviceCustomProperty_IN_Header_ID 1 - -} WmiQueryPciDeviceCustomProperty_IN, *PWmiQueryPciDeviceCustomProperty_IN; - -#define WmiQueryPciDeviceCustomProperty_IN_SIZE (FIELD_OFFSET(WmiQueryPciDeviceCustomProperty_IN, Header) + WmiQueryPciDeviceCustomProperty_IN_Header_SIZE) - -typedef struct _WmiQueryPciDeviceCustomProperty_OUT -{ - // - MSNdis_PciDeviceProperty PciDeviceProperty; - #define WmiQueryPciDeviceCustomProperty_OUT_PciDeviceProperty_SIZE sizeof(MSNdis_PciDeviceProperty) - #define WmiQueryPciDeviceCustomProperty_OUT_PciDeviceProperty_ID 2 - -} WmiQueryPciDeviceCustomProperty_OUT, *PWmiQueryPciDeviceCustomProperty_OUT; - -#define WmiQueryPciDeviceCustomProperty_OUT_SIZE (FIELD_OFFSET(WmiQueryPciDeviceCustomProperty_OUT, PciDeviceProperty) + WmiQueryPciDeviceCustomProperty_OUT_PciDeviceProperty_SIZE) - - -// MSNdis_EnumerateAdapterEx - MSNdis_EnumerateAdapterEx -#define MSNdis_EnumerateAdapterExGuid \ - { 0x16716917,0x4306,0x4be4, { 0x9b,0x5a,0x38,0x09,0xae,0x44,0xb1,0x25 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EnumerateAdapterEx_GUID, \ - 0x16716917,0x4306,0x4be4,0x9b,0x5a,0x38,0x09,0xae,0x44,0xb1,0x25); -#endif - - -typedef struct _MSNdis_EnumerateAdapterEx -{ - // - MSNdis_WmiEnumAdapter EnumerateAdapter; - #define MSNdis_EnumerateAdapterEx_EnumerateAdapter_SIZE sizeof(MSNdis_WmiEnumAdapter) - #define MSNdis_EnumerateAdapterEx_EnumerateAdapter_ID 1 - -} MSNdis_EnumerateAdapterEx, *PMSNdis_EnumerateAdapterEx; - -#define MSNdis_EnumerateAdapterEx_SIZE (FIELD_OFFSET(MSNdis_EnumerateAdapterEx, EnumerateAdapter) + MSNdis_EnumerateAdapterEx_EnumerateAdapter_SIZE) - -// MSNdis_TcpOffloadCurrentConfig - MSNdis_TcpOffloadCurrentConfig -#define MSNdis_TcpOffloadCurrentConfigGuid \ - { 0x68542fed,0x5c74,0x461e, { 0x89,0x34,0x91,0xc6,0xf9,0xc6,0x09,0x60 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TcpOffloadCurrentConfig_GUID, \ - 0x68542fed,0x5c74,0x461e,0x89,0x34,0x91,0xc6,0xf9,0xc6,0x09,0x60); -#endif - -// -// Method id definitions for MSNdis_TcpOffloadCurrentConfig -#define WmiQueryCurrentOffloadConfig 1 -typedef struct _WmiQueryCurrentOffloadConfig_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryCurrentOffloadConfig_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryCurrentOffloadConfig_IN_Header_ID 1 - -} WmiQueryCurrentOffloadConfig_IN, *PWmiQueryCurrentOffloadConfig_IN; - -#define WmiQueryCurrentOffloadConfig_IN_SIZE (FIELD_OFFSET(WmiQueryCurrentOffloadConfig_IN, Header) + WmiQueryCurrentOffloadConfig_IN_Header_SIZE) - -typedef struct _WmiQueryCurrentOffloadConfig_OUT -{ - // - MSNdis_WmiOffload Offload; - #define WmiQueryCurrentOffloadConfig_OUT_Offload_SIZE sizeof(MSNdis_WmiOffload) - #define WmiQueryCurrentOffloadConfig_OUT_Offload_ID 2 - -} WmiQueryCurrentOffloadConfig_OUT, *PWmiQueryCurrentOffloadConfig_OUT; - -#define WmiQueryCurrentOffloadConfig_OUT_SIZE (FIELD_OFFSET(WmiQueryCurrentOffloadConfig_OUT, Offload) + WmiQueryCurrentOffloadConfig_OUT_Offload_SIZE) - - -// MSNdis_TcpOffloadHardwareConfig - MSNdis_TcpOffloadHardwareConfig -#define MSNdis_TcpOffloadHardwareConfigGuid \ - { 0xcd5f1102,0x590f,0x4ada, { 0xab,0x65,0x5b,0x31,0xb1,0xdc,0x01,0x72 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TcpOffloadHardwareConfig_GUID, \ - 0xcd5f1102,0x590f,0x4ada,0xab,0x65,0x5b,0x31,0xb1,0xdc,0x01,0x72); -#endif - -// -// Method id definitions for MSNdis_TcpOffloadHardwareConfig -#define WmiQueryHardwareOffloadConfig 1 -typedef struct _WmiQueryHardwareOffloadConfig_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryHardwareOffloadConfig_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryHardwareOffloadConfig_IN_Header_ID 1 - -} WmiQueryHardwareOffloadConfig_IN, *PWmiQueryHardwareOffloadConfig_IN; - -#define WmiQueryHardwareOffloadConfig_IN_SIZE (FIELD_OFFSET(WmiQueryHardwareOffloadConfig_IN, Header) + WmiQueryHardwareOffloadConfig_IN_Header_SIZE) - -typedef struct _WmiQueryHardwareOffloadConfig_OUT -{ - // - MSNdis_WmiOffload Offload; - #define WmiQueryHardwareOffloadConfig_OUT_Offload_SIZE sizeof(MSNdis_WmiOffload) - #define WmiQueryHardwareOffloadConfig_OUT_Offload_ID 2 - -} WmiQueryHardwareOffloadConfig_OUT, *PWmiQueryHardwareOffloadConfig_OUT; - -#define WmiQueryHardwareOffloadConfig_OUT_SIZE (FIELD_OFFSET(WmiQueryHardwareOffloadConfig_OUT, Offload) + WmiQueryHardwareOffloadConfig_OUT_Offload_SIZE) - - -// MSNdis_SetTcpOffloadParameters - MSNdis_SetTcpOffloadParameters -#define MSNdis_SetTcpOffloadParametersGuid \ - { 0x8ead9a22,0x7f69,0x4bc6, { 0x94,0x9a,0xc8,0x18,0x7b,0x07,0x4e,0x61 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_SetTcpOffloadParameters_GUID, \ - 0x8ead9a22,0x7f69,0x4bc6,0x94,0x9a,0xc8,0x18,0x7b,0x07,0x4e,0x61); -#endif - -// -// Method id definitions for MSNdis_SetTcpOffloadParameters -#define WmiSetTcpOffloadParameters 1 -typedef struct _WmiSetTcpOffloadParameters_IN -{ - // - MSNdis_WmiMethodHeader MethodHeader; - #define WmiSetTcpOffloadParameters_IN_MethodHeader_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiSetTcpOffloadParameters_IN_MethodHeader_ID 1 - - // - MSNdis_TcpOffloadParameters TcpOffloadParameters; - #define WmiSetTcpOffloadParameters_IN_TcpOffloadParameters_SIZE sizeof(MSNdis_TcpOffloadParameters) - #define WmiSetTcpOffloadParameters_IN_TcpOffloadParameters_ID 2 - -} WmiSetTcpOffloadParameters_IN, *PWmiSetTcpOffloadParameters_IN; - -#define WmiSetTcpOffloadParameters_IN_SIZE (FIELD_OFFSET(WmiSetTcpOffloadParameters_IN, TcpOffloadParameters) + WmiSetTcpOffloadParameters_IN_TcpOffloadParameters_SIZE) - -typedef struct _WmiSetTcpOffloadParameters_OUT -{ - // - MSNdis_WmiOutputInfo OutputInfo; - #define WmiSetTcpOffloadParameters_OUT_OutputInfo_SIZE sizeof(MSNdis_WmiOutputInfo) - #define WmiSetTcpOffloadParameters_OUT_OutputInfo_ID 3 - -} WmiSetTcpOffloadParameters_OUT, *PWmiSetTcpOffloadParameters_OUT; - -#define WmiSetTcpOffloadParameters_OUT_SIZE (FIELD_OFFSET(WmiSetTcpOffloadParameters_OUT, OutputInfo) + WmiSetTcpOffloadParameters_OUT_OutputInfo_SIZE) - - -// MSNdis_TcpConnectionOffloadCurrentConfig - MSNdis_TcpConnectionOffloadCurrentConfig -#define MSNdis_TcpConnectionOffloadCurrentConfigGuid \ - { 0x2ee6aef1,0x0851,0x458b, { 0xbf,0x0d,0x79,0x23,0x43,0xd1,0xcd,0xe1 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TcpConnectionOffloadCurrentConfig_GUID, \ - 0x2ee6aef1,0x0851,0x458b,0xbf,0x0d,0x79,0x23,0x43,0xd1,0xcd,0xe1); -#endif - -// -// Method id definitions for MSNdis_TcpConnectionOffloadCurrentConfig -#define WmiQueryTcpConnectionOffloadCurrentConfig 1 -typedef struct _WmiQueryTcpConnectionOffloadCurrentConfig_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryTcpConnectionOffloadCurrentConfig_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryTcpConnectionOffloadCurrentConfig_IN_Header_ID 1 - -} WmiQueryTcpConnectionOffloadCurrentConfig_IN, *PWmiQueryTcpConnectionOffloadCurrentConfig_IN; - -#define WmiQueryTcpConnectionOffloadCurrentConfig_IN_SIZE (FIELD_OFFSET(WmiQueryTcpConnectionOffloadCurrentConfig_IN, Header) + WmiQueryTcpConnectionOffloadCurrentConfig_IN_Header_SIZE) - -typedef struct _WmiQueryTcpConnectionOffloadCurrentConfig_OUT -{ - // - MSNdis_WmiTcpConnectionOffload Offload; - #define WmiQueryTcpConnectionOffloadCurrentConfig_OUT_Offload_SIZE sizeof(MSNdis_WmiTcpConnectionOffload) - #define WmiQueryTcpConnectionOffloadCurrentConfig_OUT_Offload_ID 2 - -} WmiQueryTcpConnectionOffloadCurrentConfig_OUT, *PWmiQueryTcpConnectionOffloadCurrentConfig_OUT; - -#define WmiQueryTcpConnectionOffloadCurrentConfig_OUT_SIZE (FIELD_OFFSET(WmiQueryTcpConnectionOffloadCurrentConfig_OUT, Offload) + WmiQueryTcpConnectionOffloadCurrentConfig_OUT_Offload_SIZE) - - -// MSNdis_TcpConnectionOffloadHardwareConfig - MSNdis_TcpConnectionOffloadHardwareConfig -#define MSNdis_TcpConnectionOffloadHardwareConfigGuid \ - { 0x8ce71f2c,0xd63a,0x4390, { 0xa4,0x87,0x18,0xfa,0x47,0x26,0x2c,0xeb } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_TcpConnectionOffloadHardwareConfig_GUID, \ - 0x8ce71f2c,0xd63a,0x4390,0xa4,0x87,0x18,0xfa,0x47,0x26,0x2c,0xeb); -#endif - -// -// Method id definitions for MSNdis_TcpConnectionOffloadHardwareConfig -#define WmiQueryTcpConnectionOffloadHardwareConfig 1 -typedef struct _WmiQueryTcpConnectionOffloadHardwareConfig_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryTcpConnectionOffloadHardwareConfig_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryTcpConnectionOffloadHardwareConfig_IN_Header_ID 1 - -} WmiQueryTcpConnectionOffloadHardwareConfig_IN, *PWmiQueryTcpConnectionOffloadHardwareConfig_IN; - -#define WmiQueryTcpConnectionOffloadHardwareConfig_IN_SIZE (FIELD_OFFSET(WmiQueryTcpConnectionOffloadHardwareConfig_IN, Header) + WmiQueryTcpConnectionOffloadHardwareConfig_IN_Header_SIZE) - -typedef struct _WmiQueryTcpConnectionOffloadHardwareConfig_OUT -{ - // - MSNdis_WmiTcpConnectionOffload Offload; - #define WmiQueryTcpConnectionOffloadHardwareConfig_OUT_Offload_SIZE sizeof(MSNdis_WmiTcpConnectionOffload) - #define WmiQueryTcpConnectionOffloadHardwareConfig_OUT_Offload_ID 2 - -} WmiQueryTcpConnectionOffloadHardwareConfig_OUT, *PWmiQueryTcpConnectionOffloadHardwareConfig_OUT; - -#define WmiQueryTcpConnectionOffloadHardwareConfig_OUT_SIZE (FIELD_OFFSET(WmiQueryTcpConnectionOffloadHardwareConfig_OUT, Offload) + WmiQueryTcpConnectionOffloadHardwareConfig_OUT_Offload_SIZE) - - -// MSNdis_ReceiveScaleCapabilities - MSNdis_ReceiveScaleCapabilities -#define MSNdis_ReceiveScaleCapabilitiesGuid \ - { 0x26c28774,0x4252,0x48fe, { 0xa6,0x10,0xa5,0x8a,0x39,0x8c,0x0e,0xb1 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_ReceiveScaleCapabilities_GUID, \ - 0x26c28774,0x4252,0x48fe,0xa6,0x10,0xa5,0x8a,0x39,0x8c,0x0e,0xb1); -#endif - -// -// Method id definitions for MSNdis_ReceiveScaleCapabilities -#define WmiQueryReceiveScaleCapabilities 1 -typedef struct _WmiQueryReceiveScaleCapabilities_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryReceiveScaleCapabilities_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryReceiveScaleCapabilities_IN_Header_ID 1 - -} WmiQueryReceiveScaleCapabilities_IN, *PWmiQueryReceiveScaleCapabilities_IN; - -#define WmiQueryReceiveScaleCapabilities_IN_SIZE (FIELD_OFFSET(WmiQueryReceiveScaleCapabilities_IN, Header) + WmiQueryReceiveScaleCapabilities_IN_Header_SIZE) - -typedef struct _WmiQueryReceiveScaleCapabilities_OUT -{ - // - MSNdis_WmiReceiveScaleCapabilities RssCaps; - #define WmiQueryReceiveScaleCapabilities_OUT_RssCaps_SIZE sizeof(MSNdis_WmiReceiveScaleCapabilities) - #define WmiQueryReceiveScaleCapabilities_OUT_RssCaps_ID 2 - -} WmiQueryReceiveScaleCapabilities_OUT, *PWmiQueryReceiveScaleCapabilities_OUT; - -#define WmiQueryReceiveScaleCapabilities_OUT_SIZE (FIELD_OFFSET(WmiQueryReceiveScaleCapabilities_OUT, RssCaps) + WmiQueryReceiveScaleCapabilities_OUT_RssCaps_SIZE) - - -// MSNdis_HDSplitCurrentConfig - MSNdis_HDSplitCurrentConfig -#define MSNdis_HDSplitCurrentConfigGuid \ - { 0x81d1303c,0xab00,0x4e49, { 0x80,0xb1,0x5e,0x6e,0x0b,0xf9,0xbe,0x53 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_HDSplitCurrentConfig_GUID, \ - 0x81d1303c,0xab00,0x4e49,0x80,0xb1,0x5e,0x6e,0x0b,0xf9,0xbe,0x53); -#endif - -// -// Method id definitions for MSNdis_HDSplitCurrentConfig -#define WmiQueryHDSplitCurrentConfig 1 -typedef struct _WmiQueryHDSplitCurrentConfig_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryHDSplitCurrentConfig_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryHDSplitCurrentConfig_IN_Header_ID 1 - -} WmiQueryHDSplitCurrentConfig_IN, *PWmiQueryHDSplitCurrentConfig_IN; - -#define WmiQueryHDSplitCurrentConfig_IN_SIZE (FIELD_OFFSET(WmiQueryHDSplitCurrentConfig_IN, Header) + WmiQueryHDSplitCurrentConfig_IN_Header_SIZE) - -typedef struct _WmiQueryHDSplitCurrentConfig_OUT -{ - // - MSNdis_WmiHDSplitCurrentConfig HdSplitCurrentConfig; - #define WmiQueryHDSplitCurrentConfig_OUT_HdSplitCurrentConfig_SIZE sizeof(MSNdis_WmiHDSplitCurrentConfig) - #define WmiQueryHDSplitCurrentConfig_OUT_HdSplitCurrentConfig_ID 2 - -} WmiQueryHDSplitCurrentConfig_OUT, *PWmiQueryHDSplitCurrentConfig_OUT; - -#define WmiQueryHDSplitCurrentConfig_OUT_SIZE (FIELD_OFFSET(WmiQueryHDSplitCurrentConfig_OUT, HdSplitCurrentConfig) + WmiQueryHDSplitCurrentConfig_OUT_HdSplitCurrentConfig_SIZE) - - -// MSNdis_SetHDSplitParameters - MSNdis_SetHDSplitParameters -#define MSNdis_SetHDSplitParametersGuid \ - { 0x8c048bea,0x2913,0x4458, { 0xb6,0x8e,0x17,0xf6,0xc1,0xe5,0xc6,0x0e } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_SetHDSplitParameters_GUID, \ - 0x8c048bea,0x2913,0x4458,0xb6,0x8e,0x17,0xf6,0xc1,0xe5,0xc6,0x0e); -#endif - -// -// Method id definitions for MSNdis_SetHDSplitParameters -#define WmiSetHDSplitParameters 1 -typedef struct _WmiSetHDSplitParameters_IN -{ - // - MSNdis_WmiMethodHeader MethodHeader; - #define WmiSetHDSplitParameters_IN_MethodHeader_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiSetHDSplitParameters_IN_MethodHeader_ID 1 - - // - MSNdis_HDSplitParameters HDSplitParameters; - #define WmiSetHDSplitParameters_IN_HDSplitParameters_SIZE sizeof(MSNdis_HDSplitParameters) - #define WmiSetHDSplitParameters_IN_HDSplitParameters_ID 2 - -} WmiSetHDSplitParameters_IN, *PWmiSetHDSplitParameters_IN; - -#define WmiSetHDSplitParameters_IN_SIZE (FIELD_OFFSET(WmiSetHDSplitParameters_IN, HDSplitParameters) + WmiSetHDSplitParameters_IN_HDSplitParameters_SIZE) - -typedef struct _WmiSetHDSplitParameters_OUT -{ - // - MSNdis_WmiOutputInfo OutputInfo; - #define WmiSetHDSplitParameters_OUT_OutputInfo_SIZE sizeof(MSNdis_WmiOutputInfo) - #define WmiSetHDSplitParameters_OUT_OutputInfo_ID 3 - -} WmiSetHDSplitParameters_OUT, *PWmiSetHDSplitParameters_OUT; - -#define WmiSetHDSplitParameters_OUT_SIZE (FIELD_OFFSET(WmiSetHDSplitParameters_OUT, OutputInfo) + WmiSetHDSplitParameters_OUT_OutputInfo_SIZE) - - -// MSNdis_QueryPhysicalMediumTypeEx - MSNdis_QueryPhysicalMediumTypeEx -#define MSNdis_QueryPhysicalMediumTypeExGuid \ - { 0x899e7782,0x035b,0x43f9, { 0x8b,0xb6,0x2b,0x58,0x97,0x16,0x12,0xe5 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_QueryPhysicalMediumTypeEx_GUID, \ - 0x899e7782,0x035b,0x43f9,0x8b,0xb6,0x2b,0x58,0x97,0x16,0x12,0xe5); -#endif - -// -// Method id definitions for MSNdis_QueryPhysicalMediumTypeEx -#define WmiQueryPhysicalMediumTypeEx 1 -typedef struct _WmiQueryPhysicalMediumTypeEx_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryPhysicalMediumTypeEx_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryPhysicalMediumTypeEx_IN_Header_ID 1 - -} WmiQueryPhysicalMediumTypeEx_IN, *PWmiQueryPhysicalMediumTypeEx_IN; - -#define WmiQueryPhysicalMediumTypeEx_IN_SIZE (FIELD_OFFSET(WmiQueryPhysicalMediumTypeEx_IN, Header) + WmiQueryPhysicalMediumTypeEx_IN_Header_SIZE) - -typedef struct _WmiQueryPhysicalMediumTypeEx_OUT -{ - // - ULONG NdisPhysicalMediumTypeEx; - #define WmiQueryPhysicalMediumTypeEx_OUT_NdisPhysicalMediumTypeEx_SIZE sizeof(ULONG) - #define WmiQueryPhysicalMediumTypeEx_OUT_NdisPhysicalMediumTypeEx_ID 2 - -} WmiQueryPhysicalMediumTypeEx_OUT, *PWmiQueryPhysicalMediumTypeEx_OUT; - -#define WmiQueryPhysicalMediumTypeEx_OUT_SIZE (FIELD_OFFSET(WmiQueryPhysicalMediumTypeEx_OUT, NdisPhysicalMediumTypeEx) + WmiQueryPhysicalMediumTypeEx_OUT_NdisPhysicalMediumTypeEx_SIZE) - - -// MSNdis_QueryReceiveFilterHardwareCapabilities - MSNdis_QueryReceiveFilterHardwareCapabilities -#define MSNdis_QueryReceiveFilterHardwareCapabilitiesGuid \ - { 0x3f2c1419,0x83bc,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_QueryReceiveFilterHardwareCapabilities_GUID, \ - 0x3f2c1419,0x83bc,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - -// -// Method id definitions for MSNdis_QueryReceiveFilterHardwareCapabilities -#define WmiQueryReceiveFilterHardwareCapabilities 1 -typedef struct _WmiQueryReceiveFilterHardwareCapabilities_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryReceiveFilterHardwareCapabilities_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryReceiveFilterHardwareCapabilities_IN_Header_ID 1 - -} WmiQueryReceiveFilterHardwareCapabilities_IN, *PWmiQueryReceiveFilterHardwareCapabilities_IN; - -#define WmiQueryReceiveFilterHardwareCapabilities_IN_SIZE (FIELD_OFFSET(WmiQueryReceiveFilterHardwareCapabilities_IN, Header) + WmiQueryReceiveFilterHardwareCapabilities_IN_Header_SIZE) - -typedef struct _WmiQueryReceiveFilterHardwareCapabilities_OUT -{ - // - MSNdis_ReceiveFilterCapabilities ReceiveFilterHardwareCapabilities; - #define WmiQueryReceiveFilterHardwareCapabilities_OUT_ReceiveFilterHardwareCapabilities_SIZE sizeof(MSNdis_ReceiveFilterCapabilities) - #define WmiQueryReceiveFilterHardwareCapabilities_OUT_ReceiveFilterHardwareCapabilities_ID 2 - -} WmiQueryReceiveFilterHardwareCapabilities_OUT, *PWmiQueryReceiveFilterHardwareCapabilities_OUT; - -#define WmiQueryReceiveFilterHardwareCapabilities_OUT_SIZE (FIELD_OFFSET(WmiQueryReceiveFilterHardwareCapabilities_OUT, ReceiveFilterHardwareCapabilities) + WmiQueryReceiveFilterHardwareCapabilities_OUT_ReceiveFilterHardwareCapabilities_SIZE) - - -// MSNdis_QueryReceiveFilterGlobalParameters - MSNdis_QueryReceiveFilterGlobalParameters -#define MSNdis_QueryReceiveFilterGlobalParametersGuid \ - { 0x3f2c141a,0x83bc,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_QueryReceiveFilterGlobalParameters_GUID, \ - 0x3f2c141a,0x83bc,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - -// -// Method id definitions for MSNdis_QueryReceiveFilterGlobalParameters -#define WmiQueryReceiveFilterGlobalParameters 1 -typedef struct _WmiQueryReceiveFilterGlobalParameters_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryReceiveFilterGlobalParameters_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryReceiveFilterGlobalParameters_IN_Header_ID 1 - -} WmiQueryReceiveFilterGlobalParameters_IN, *PWmiQueryReceiveFilterGlobalParameters_IN; - -#define WmiQueryReceiveFilterGlobalParameters_IN_SIZE (FIELD_OFFSET(WmiQueryReceiveFilterGlobalParameters_IN, Header) + WmiQueryReceiveFilterGlobalParameters_IN_Header_SIZE) - -typedef struct _WmiQueryReceiveFilterGlobalParameters_OUT -{ - // - MSNdis_ReceiveFilterGlobalParameters ReceiveFilterGlobalParameters; - #define WmiQueryReceiveFilterGlobalParameters_OUT_ReceiveFilterGlobalParameters_SIZE sizeof(MSNdis_ReceiveFilterGlobalParameters) - #define WmiQueryReceiveFilterGlobalParameters_OUT_ReceiveFilterGlobalParameters_ID 2 - -} WmiQueryReceiveFilterGlobalParameters_OUT, *PWmiQueryReceiveFilterGlobalParameters_OUT; - -#define WmiQueryReceiveFilterGlobalParameters_OUT_SIZE (FIELD_OFFSET(WmiQueryReceiveFilterGlobalParameters_OUT, ReceiveFilterGlobalParameters) + WmiQueryReceiveFilterGlobalParameters_OUT_ReceiveFilterGlobalParameters_SIZE) - - -// MSNdis_EnumerateReceiveFilters - MSNdis_EnumerateReceiveFilters -#define MSNdis_EnumerateReceiveFiltersGuid \ - { 0x3f2c141d,0x83bc,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EnumerateReceiveFilters_GUID, \ - 0x3f2c141d,0x83bc,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - -// -// Method id definitions for MSNdis_EnumerateReceiveFilters -#define WmiEnumReceiveFilters 1 -typedef struct _WmiEnumReceiveFilters_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiEnumReceiveFilters_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiEnumReceiveFilters_IN_Header_ID 1 - - // - MSNdis_ReceiveFilterInfoArray ReceiveFilterInfoArray; - #define WmiEnumReceiveFilters_IN_ReceiveFilterInfoArray_SIZE sizeof(MSNdis_ReceiveFilterInfoArray) - #define WmiEnumReceiveFilters_IN_ReceiveFilterInfoArray_ID 2 - -} WmiEnumReceiveFilters_IN, *PWmiEnumReceiveFilters_IN; - -#define WmiEnumReceiveFilters_IN_SIZE (FIELD_OFFSET(WmiEnumReceiveFilters_IN, ReceiveFilterInfoArray) + WmiEnumReceiveFilters_IN_ReceiveFilterInfoArray_SIZE) - -typedef struct _WmiEnumReceiveFilters_OUT -{ - // - MSNdis_ReceiveFilterInfoArray ReceiveFilterInfoArray; - #define WmiEnumReceiveFilters_OUT_ReceiveFilterInfoArray_SIZE sizeof(MSNdis_ReceiveFilterInfoArray) - #define WmiEnumReceiveFilters_OUT_ReceiveFilterInfoArray_ID 2 - -} WmiEnumReceiveFilters_OUT, *PWmiEnumReceiveFilters_OUT; - -#define WmiEnumReceiveFilters_OUT_SIZE (FIELD_OFFSET(WmiEnumReceiveFilters_OUT, ReceiveFilterInfoArray) + WmiEnumReceiveFilters_OUT_ReceiveFilterInfoArray_SIZE) - - -// MSNdis_QueryReceiveFilterParameters - MSNdis_QueryReceiveFilterParameters -#define MSNdis_QueryReceiveFilterParametersGuid \ - { 0x3f2c141e,0x83bc,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_QueryReceiveFilterParameters_GUID, \ - 0x3f2c141e,0x83bc,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - -// -// Method id definitions for MSNdis_QueryReceiveFilterParameters -#define WmiQueryReceiveFilterParameters 1 -typedef struct _WmiQueryReceiveFilterParameters_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryReceiveFilterParameters_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryReceiveFilterParameters_IN_Header_ID 1 - - // - MSNdis_ReceiveFilterParameters ReceiveFilterParameters; - #define WmiQueryReceiveFilterParameters_IN_ReceiveFilterParameters_SIZE sizeof(MSNdis_ReceiveFilterParameters) - #define WmiQueryReceiveFilterParameters_IN_ReceiveFilterParameters_ID 2 - -} WmiQueryReceiveFilterParameters_IN, *PWmiQueryReceiveFilterParameters_IN; - -#define WmiQueryReceiveFilterParameters_IN_SIZE (FIELD_OFFSET(WmiQueryReceiveFilterParameters_IN, ReceiveFilterParameters) + WmiQueryReceiveFilterParameters_IN_ReceiveFilterParameters_SIZE) - -typedef struct _WmiQueryReceiveFilterParameters_OUT -{ - // - MSNdis_ReceiveFilterParameters ReceiveFilterParameters; - #define WmiQueryReceiveFilterParameters_OUT_ReceiveFilterParameters_SIZE sizeof(MSNdis_ReceiveFilterParameters) - #define WmiQueryReceiveFilterParameters_OUT_ReceiveFilterParameters_ID 2 - -} WmiQueryReceiveFilterParameters_OUT, *PWmiQueryReceiveFilterParameters_OUT; - -#define WmiQueryReceiveFilterParameters_OUT_SIZE (FIELD_OFFSET(WmiQueryReceiveFilterParameters_OUT, ReceiveFilterParameters) + WmiQueryReceiveFilterParameters_OUT_ReceiveFilterParameters_SIZE) - - -// MSNdis_QueryReceiveFilterCurrentCapabilities - MSNdis_QueryReceiveFilterCurrentCapabilities -#define MSNdis_QueryReceiveFilterCurrentCapabilitiesGuid \ - { 0x4054e80f,0x2bc1,0x4ccc, { 0xb0,0x33,0x4a,0xbc,0x0c,0x4a,0x1e,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_QueryReceiveFilterCurrentCapabilities_GUID, \ - 0x4054e80f,0x2bc1,0x4ccc,0xb0,0x33,0x4a,0xbc,0x0c,0x4a,0x1e,0x8c); -#endif - -// -// Method id definitions for MSNdis_QueryReceiveFilterCurrentCapabilities -#define WmiQueryReceiveFilterCurrentCapabilities 1 -typedef struct _WmiQueryReceiveFilterCurrentCapabilities_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryReceiveFilterCurrentCapabilities_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryReceiveFilterCurrentCapabilities_IN_Header_ID 1 - -} WmiQueryReceiveFilterCurrentCapabilities_IN, *PWmiQueryReceiveFilterCurrentCapabilities_IN; - -#define WmiQueryReceiveFilterCurrentCapabilities_IN_SIZE (FIELD_OFFSET(WmiQueryReceiveFilterCurrentCapabilities_IN, Header) + WmiQueryReceiveFilterCurrentCapabilities_IN_Header_SIZE) - -typedef struct _WmiQueryReceiveFilterCurrentCapabilities_OUT -{ - // - MSNdis_ReceiveFilterCapabilities ReceiveFilterCurrentCapabilities; - #define WmiQueryReceiveFilterCurrentCapabilities_OUT_ReceiveFilterCurrentCapabilities_SIZE sizeof(MSNdis_ReceiveFilterCapabilities) - #define WmiQueryReceiveFilterCurrentCapabilities_OUT_ReceiveFilterCurrentCapabilities_ID 2 - -} WmiQueryReceiveFilterCurrentCapabilities_OUT, *PWmiQueryReceiveFilterCurrentCapabilities_OUT; - -#define WmiQueryReceiveFilterCurrentCapabilities_OUT_SIZE (FIELD_OFFSET(WmiQueryReceiveFilterCurrentCapabilities_OUT, ReceiveFilterCurrentCapabilities) + WmiQueryReceiveFilterCurrentCapabilities_OUT_ReceiveFilterCurrentCapabilities_SIZE) - - -// MSNdis_QueryNicSwitchHardwareCapabilities - MSNdis_QueryNicSwitchHardwareCapabilities -#define MSNdis_QueryNicSwitchHardwareCapabilitiesGuid \ - { 0x37cab40c,0xd1e8,0x4301, { 0x8c,0x1d,0x58,0x46,0x5e,0x0c,0x4c,0x0f } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_QueryNicSwitchHardwareCapabilities_GUID, \ - 0x37cab40c,0xd1e8,0x4301,0x8c,0x1d,0x58,0x46,0x5e,0x0c,0x4c,0x0f); -#endif - -// -// Method id definitions for MSNdis_QueryNicSwitchHardwareCapabilities -#define WmiQueryNICSwitchHardwareCapabilities 1 -typedef struct _WmiQueryNICSwitchHardwareCapabilities_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryNICSwitchHardwareCapabilities_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryNICSwitchHardwareCapabilities_IN_Header_ID 1 - -} WmiQueryNICSwitchHardwareCapabilities_IN, *PWmiQueryNICSwitchHardwareCapabilities_IN; - -#define WmiQueryNICSwitchHardwareCapabilities_IN_SIZE (FIELD_OFFSET(WmiQueryNICSwitchHardwareCapabilities_IN, Header) + WmiQueryNICSwitchHardwareCapabilities_IN_Header_SIZE) - -typedef struct _WmiQueryNICSwitchHardwareCapabilities_OUT -{ - // - MSNdis_NicSwitchCapabilities NicSwitchHardwareCapabilities; - #define WmiQueryNICSwitchHardwareCapabilities_OUT_NicSwitchHardwareCapabilities_SIZE sizeof(MSNdis_NicSwitchCapabilities) - #define WmiQueryNICSwitchHardwareCapabilities_OUT_NicSwitchHardwareCapabilities_ID 2 - -} WmiQueryNICSwitchHardwareCapabilities_OUT, *PWmiQueryNICSwitchHardwareCapabilities_OUT; - -#define WmiQueryNICSwitchHardwareCapabilities_OUT_SIZE (FIELD_OFFSET(WmiQueryNICSwitchHardwareCapabilities_OUT, NicSwitchHardwareCapabilities) + WmiQueryNICSwitchHardwareCapabilities_OUT_NicSwitchHardwareCapabilities_SIZE) - - -// MSNdis_QueryNicSwitchCurrentCapabilities - MSNdis_QueryNicSwitchCurrentCapabilities -#define MSNdis_QueryNicSwitchCurrentCapabilitiesGuid \ - { 0xe76fdaf3,0x0be7,0x4d95, { 0x87,0xe9,0x5a,0xea,0xd4,0xb5,0x90,0xe9 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_QueryNicSwitchCurrentCapabilities_GUID, \ - 0xe76fdaf3,0x0be7,0x4d95,0x87,0xe9,0x5a,0xea,0xd4,0xb5,0x90,0xe9); -#endif - -// -// Method id definitions for MSNdis_QueryNicSwitchCurrentCapabilities -#define WmiQueryNICSwitchCurrentCapabilities 1 -typedef struct _WmiQueryNICSwitchCurrentCapabilities_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryNICSwitchCurrentCapabilities_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryNICSwitchCurrentCapabilities_IN_Header_ID 1 - -} WmiQueryNICSwitchCurrentCapabilities_IN, *PWmiQueryNICSwitchCurrentCapabilities_IN; - -#define WmiQueryNICSwitchCurrentCapabilities_IN_SIZE (FIELD_OFFSET(WmiQueryNICSwitchCurrentCapabilities_IN, Header) + WmiQueryNICSwitchCurrentCapabilities_IN_Header_SIZE) - -typedef struct _WmiQueryNICSwitchCurrentCapabilities_OUT -{ - // - MSNdis_NicSwitchCapabilities NicSwitchCurrentCapabilities; - #define WmiQueryNICSwitchCurrentCapabilities_OUT_NicSwitchCurrentCapabilities_SIZE sizeof(MSNdis_NicSwitchCapabilities) - #define WmiQueryNICSwitchCurrentCapabilities_OUT_NicSwitchCurrentCapabilities_ID 2 - -} WmiQueryNICSwitchCurrentCapabilities_OUT, *PWmiQueryNICSwitchCurrentCapabilities_OUT; - -#define WmiQueryNICSwitchCurrentCapabilities_OUT_SIZE (FIELD_OFFSET(WmiQueryNICSwitchCurrentCapabilities_OUT, NicSwitchCurrentCapabilities) + WmiQueryNICSwitchCurrentCapabilities_OUT_NicSwitchCurrentCapabilities_SIZE) - - -// MSNdis_QueryReceiveQueueParameters - MSNdis_QueryReceiveQueueParameters -#define MSNdis_QueryReceiveQueueParametersGuid \ - { 0x3f2c141c,0x83bc,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_QueryReceiveQueueParameters_GUID, \ - 0x3f2c141c,0x83bc,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - -// -// Method id definitions for MSNdis_QueryReceiveQueueParameters -#define WmiQueryReceiveQueueParameters 1 -typedef struct _WmiQueryReceiveQueueParameters_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiQueryReceiveQueueParameters_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiQueryReceiveQueueParameters_IN_Header_ID 1 - - // - MSNdis_ReceiveQueueParameters ReceiveQueueParameters; - #define WmiQueryReceiveQueueParameters_IN_ReceiveQueueParameters_SIZE sizeof(MSNdis_ReceiveQueueParameters) - #define WmiQueryReceiveQueueParameters_IN_ReceiveQueueParameters_ID 2 - -} WmiQueryReceiveQueueParameters_IN, *PWmiQueryReceiveQueueParameters_IN; - -#define WmiQueryReceiveQueueParameters_IN_SIZE (FIELD_OFFSET(WmiQueryReceiveQueueParameters_IN, ReceiveQueueParameters) + WmiQueryReceiveQueueParameters_IN_ReceiveQueueParameters_SIZE) - -typedef struct _WmiQueryReceiveQueueParameters_OUT -{ - // - MSNdis_ReceiveQueueParameters ReceiveQueueParameters; - #define WmiQueryReceiveQueueParameters_OUT_ReceiveQueueParameters_SIZE sizeof(MSNdis_ReceiveQueueParameters) - #define WmiQueryReceiveQueueParameters_OUT_ReceiveQueueParameters_ID 2 - -} WmiQueryReceiveQueueParameters_OUT, *PWmiQueryReceiveQueueParameters_OUT; - -#define WmiQueryReceiveQueueParameters_OUT_SIZE (FIELD_OFFSET(WmiQueryReceiveQueueParameters_OUT, ReceiveQueueParameters) + WmiQueryReceiveQueueParameters_OUT_ReceiveQueueParameters_SIZE) - - -// MSNdis_EnumerateReceiveQueues - MSNdis_EnumerateReceiveQueues -#define MSNdis_EnumerateReceiveQueuesGuid \ - { 0x3f2c141b,0x83bc,0x11dd, { 0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_EnumerateReceiveQueues_GUID, \ - 0x3f2c141b,0x83bc,0x11dd,0x94,0xb8,0x00,0x1d,0x09,0x16,0x2b,0xc3); -#endif - -// -// Method id definitions for MSNdis_EnumerateReceiveQueues -#define WmiEnumReceiveQueues 1 -typedef struct _WmiEnumReceiveQueues_IN -{ - // - MSNdis_WmiMethodHeader Header; - #define WmiEnumReceiveQueues_IN_Header_SIZE sizeof(MSNdis_WmiMethodHeader) - #define WmiEnumReceiveQueues_IN_Header_ID 1 - - // - MSNdis_ReceiveQueueInfoArray ReceiveQueueInfoArray; - #define WmiEnumReceiveQueues_IN_ReceiveQueueInfoArray_SIZE sizeof(MSNdis_ReceiveQueueInfoArray) - #define WmiEnumReceiveQueues_IN_ReceiveQueueInfoArray_ID 2 - -} WmiEnumReceiveQueues_IN, *PWmiEnumReceiveQueues_IN; - -#define WmiEnumReceiveQueues_IN_SIZE (FIELD_OFFSET(WmiEnumReceiveQueues_IN, ReceiveQueueInfoArray) + WmiEnumReceiveQueues_IN_ReceiveQueueInfoArray_SIZE) - -typedef struct _WmiEnumReceiveQueues_OUT -{ - // - MSNdis_ReceiveQueueInfoArray ReceiveQueueInfoArray; - #define WmiEnumReceiveQueues_OUT_ReceiveQueueInfoArray_SIZE sizeof(MSNdis_ReceiveQueueInfoArray) - #define WmiEnumReceiveQueues_OUT_ReceiveQueueInfoArray_ID 2 - -} WmiEnumReceiveQueues_OUT, *PWmiEnumReceiveQueues_OUT; - -#define WmiEnumReceiveQueues_OUT_SIZE (FIELD_OFFSET(WmiEnumReceiveQueues_OUT, ReceiveQueueInfoArray) + WmiEnumReceiveQueues_OUT_ReceiveQueueInfoArray_SIZE) - - -// MSNdis_80211_BaseServiceSetIdentifier - MSNdis_80211_BaseServiceSetIdentifier -#define MSNdis_80211_BaseServiceSetIdentifierGuid \ - { 0x2504b6c2,0x1fa5,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_BaseServiceSetIdentifier_GUID, \ - 0x2504b6c2,0x1fa5,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_BaseServiceSetIdentifier -{ - // - UCHAR Ndis80211MacAddress[6]; - #define MSNdis_80211_BaseServiceSetIdentifier_Ndis80211MacAddress_SIZE sizeof(UCHAR[6]) - #define MSNdis_80211_BaseServiceSetIdentifier_Ndis80211MacAddress_ID 1 - -} MSNdis_80211_BaseServiceSetIdentifier, *PMSNdis_80211_BaseServiceSetIdentifier; - -#define MSNdis_80211_BaseServiceSetIdentifier_SIZE (FIELD_OFFSET(MSNdis_80211_BaseServiceSetIdentifier, Ndis80211MacAddress) + MSNdis_80211_BaseServiceSetIdentifier_Ndis80211MacAddress_SIZE) - -// MSNdis_80211_ServiceSetIdentifier - MSNdis_80211_ServiceSetIdentifier -#define MSNdis_80211_ServiceSetIdentifierGuid \ - { 0x7d2a90ea,0x2041,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_ServiceSetIdentifier_GUID, \ - 0x7d2a90ea,0x2041,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_ServiceSetIdentifier -{ - // - UCHAR Ndis80211SsId[33]; - #define MSNdis_80211_ServiceSetIdentifier_Ndis80211SsId_SIZE sizeof(UCHAR[33]) - #define MSNdis_80211_ServiceSetIdentifier_Ndis80211SsId_ID 1 - -} MSNdis_80211_ServiceSetIdentifier, *PMSNdis_80211_ServiceSetIdentifier; - -#define MSNdis_80211_ServiceSetIdentifier_SIZE (FIELD_OFFSET(MSNdis_80211_ServiceSetIdentifier, Ndis80211SsId) + MSNdis_80211_ServiceSetIdentifier_Ndis80211SsId_SIZE) - -// MSNdis_80211_NetworkType - MSNdis_80211_NetworkType -#define MSNdis_80211_NetworkTypeGuid \ - { 0xe779ab61,0xb9ab,0x11d4, { 0xb6,0x75,0x00,0x20,0x48,0x57,0x03,0x37 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_NetworkType_GUID, \ - 0xe779ab61,0xb9ab,0x11d4,0xb6,0x75,0x00,0x20,0x48,0x57,0x03,0x37); -#endif - - -typedef struct _MSNdis_80211_NetworkType -{ - // - ULONG Ndis80211NetworkType; - #define MSNdis_80211_NetworkType_Ndis80211NetworkType_SIZE sizeof(ULONG) - #define MSNdis_80211_NetworkType_Ndis80211NetworkType_ID 1 - -} MSNdis_80211_NetworkType, *PMSNdis_80211_NetworkType; - -#define MSNdis_80211_NetworkType_SIZE (FIELD_OFFSET(MSNdis_80211_NetworkType, Ndis80211NetworkType) + MSNdis_80211_NetworkType_Ndis80211NetworkType_SIZE) - -// MSNdis_80211_NetworkTypesSupported - MSNdis_80211_NetworkTypesSupported -#define MSNdis_80211_NetworkTypesSupportedGuid \ - { 0x8531d6e6,0x2041,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_NetworkTypesSupported_GUID, \ - 0x8531d6e6,0x2041,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_NetworkTypesSupported -{ - // - ULONG NumberOfItems; - #define MSNdis_80211_NetworkTypesSupported_NumberOfItems_SIZE sizeof(ULONG) - #define MSNdis_80211_NetworkTypesSupported_NumberOfItems_ID 1 - - // - MSNdis_80211_NetworkType Ndis80211NetworkTypes[1]; - #define MSNdis_80211_NetworkTypesSupported_Ndis80211NetworkTypes_ID 2 - -} MSNdis_80211_NetworkTypesSupported, *PMSNdis_80211_NetworkTypesSupported; - -// MSNdis_80211_NetworkTypeInUse - MSNdis_80211_NetworkTypeInUse -#define MSNdis_80211_NetworkTypeInUseGuid \ - { 0x857e2326,0x2041,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_NetworkTypeInUse_GUID, \ - 0x857e2326,0x2041,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_NetworkTypeInUse -{ - // - MSNdis_80211_NetworkType Ndis80211NetworkTypeInUse; - #define MSNdis_80211_NetworkTypeInUse_Ndis80211NetworkTypeInUse_SIZE sizeof(MSNdis_80211_NetworkType) - #define MSNdis_80211_NetworkTypeInUse_Ndis80211NetworkTypeInUse_ID 1 - -} MSNdis_80211_NetworkTypeInUse, *PMSNdis_80211_NetworkTypeInUse; - -#define MSNdis_80211_NetworkTypeInUse_SIZE (FIELD_OFFSET(MSNdis_80211_NetworkTypeInUse, Ndis80211NetworkTypeInUse) + MSNdis_80211_NetworkTypeInUse_Ndis80211NetworkTypeInUse_SIZE) - -// MSNdis_80211_PowerMode - MSNdis_80211_PowerMode -#define MSNdis_80211_PowerModeGuid \ - { 0x85be837c,0x2041,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_PowerMode_GUID, \ - 0x85be837c,0x2041,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_PowerMode -{ - // - ULONG Ndis80211PowerMode; - #define MSNdis_80211_PowerMode_Ndis80211PowerMode_SIZE sizeof(ULONG) - #define MSNdis_80211_PowerMode_Ndis80211PowerMode_ID 1 - -} MSNdis_80211_PowerMode, *PMSNdis_80211_PowerMode; - -#define MSNdis_80211_PowerMode_SIZE (FIELD_OFFSET(MSNdis_80211_PowerMode, Ndis80211PowerMode) + MSNdis_80211_PowerMode_Ndis80211PowerMode_SIZE) - -// MSNdis_80211_TransmitPowerLevel - MSNdis_80211_TransmitPowerLevel -#define MSNdis_80211_TransmitPowerLevelGuid \ - { 0x11e6ba76,0x2053,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_TransmitPowerLevel_GUID, \ - 0x11e6ba76,0x2053,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_TransmitPowerLevel -{ - // - ULONG Ndis80211TransmitPowerLevel; - #define MSNdis_80211_TransmitPowerLevel_Ndis80211TransmitPowerLevel_SIZE sizeof(ULONG) - #define MSNdis_80211_TransmitPowerLevel_Ndis80211TransmitPowerLevel_ID 1 - -} MSNdis_80211_TransmitPowerLevel, *PMSNdis_80211_TransmitPowerLevel; - -#define MSNdis_80211_TransmitPowerLevel_SIZE (FIELD_OFFSET(MSNdis_80211_TransmitPowerLevel, Ndis80211TransmitPowerLevel) + MSNdis_80211_TransmitPowerLevel_Ndis80211TransmitPowerLevel_SIZE) - -// MSNdis_80211_ReceivedSignalStrength - MSNdis_80211_ReceivedSignalStrength -#define MSNdis_80211_ReceivedSignalStrengthGuid \ - { 0x1507db16,0x2053,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_ReceivedSignalStrength_GUID, \ - 0x1507db16,0x2053,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_ReceivedSignalStrength -{ - // - LONG Ndis80211ReceivedSignalStrength; - #define MSNdis_80211_ReceivedSignalStrength_Ndis80211ReceivedSignalStrength_SIZE sizeof(LONG) - #define MSNdis_80211_ReceivedSignalStrength_Ndis80211ReceivedSignalStrength_ID 1 - -} MSNdis_80211_ReceivedSignalStrength, *PMSNdis_80211_ReceivedSignalStrength; - -#define MSNdis_80211_ReceivedSignalStrength_SIZE (FIELD_OFFSET(MSNdis_80211_ReceivedSignalStrength, Ndis80211ReceivedSignalStrength) + MSNdis_80211_ReceivedSignalStrength_Ndis80211ReceivedSignalStrength_SIZE) - -// MSNdis_80211_ReceivedSignalStrengthEventTrigger - MSNdis_80211_ReceivedSignalStrengthEventTrigger -#define MSNdis_80211_ReceivedSignalStrengthEventTriggerGuid \ - { 0x155689b8,0x2053,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_ReceivedSignalStrengthEventTrigger_GUID, \ - 0x155689b8,0x2053,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_ReceivedSignalStrengthEventTrigger -{ - // - LONG Ndis80211ReceivedSignalStrengthTrigger; - #define MSNdis_80211_ReceivedSignalStrengthEventTrigger_Ndis80211ReceivedSignalStrengthTrigger_SIZE sizeof(LONG) - #define MSNdis_80211_ReceivedSignalStrengthEventTrigger_Ndis80211ReceivedSignalStrengthTrigger_ID 1 - -} MSNdis_80211_ReceivedSignalStrengthEventTrigger, *PMSNdis_80211_ReceivedSignalStrengthEventTrigger; - -#define MSNdis_80211_ReceivedSignalStrengthEventTrigger_SIZE (FIELD_OFFSET(MSNdis_80211_ReceivedSignalStrengthEventTrigger, Ndis80211ReceivedSignalStrengthTrigger) + MSNdis_80211_ReceivedSignalStrengthEventTrigger_Ndis80211ReceivedSignalStrengthTrigger_SIZE) - -// MSNdis_80211_NetworkInfrastructure - MSNdis_80211_NetworkInfrastructure -#define MSNdis_80211_NetworkInfrastructureGuid \ - { 0x34e1fa48,0xb9b6,0x11d4, { 0xb6,0x75,0x00,0x20,0x48,0x57,0x03,0x37 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_NetworkInfrastructure_GUID, \ - 0x34e1fa48,0xb9b6,0x11d4,0xb6,0x75,0x00,0x20,0x48,0x57,0x03,0x37); -#endif - - -typedef struct _MSNdis_80211_NetworkInfrastructure -{ - // - ULONG Ndis80211NetworkInfrastructure; - #define MSNdis_80211_NetworkInfrastructure_Ndis80211NetworkInfrastructure_SIZE sizeof(ULONG) - #define MSNdis_80211_NetworkInfrastructure_Ndis80211NetworkInfrastructure_ID 1 - -} MSNdis_80211_NetworkInfrastructure, *PMSNdis_80211_NetworkInfrastructure; - -#define MSNdis_80211_NetworkInfrastructure_SIZE (FIELD_OFFSET(MSNdis_80211_NetworkInfrastructure, Ndis80211NetworkInfrastructure) + MSNdis_80211_NetworkInfrastructure_Ndis80211NetworkInfrastructure_SIZE) - -// MSNdis_80211_ConfigurationFH - MSNdis_80211_ConfigurationFH -#define MSNdis_80211_ConfigurationFHGuid \ - { 0x4a800b8c,0x2068,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_ConfigurationFH_GUID, \ - 0x4a800b8c,0x2068,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_ConfigurationFH -{ - // - ULONG FHLength; - #define MSNdis_80211_ConfigurationFH_FHLength_SIZE sizeof(ULONG) - #define MSNdis_80211_ConfigurationFH_FHLength_ID 1 - - // - ULONG HopPattern; - #define MSNdis_80211_ConfigurationFH_HopPattern_SIZE sizeof(ULONG) - #define MSNdis_80211_ConfigurationFH_HopPattern_ID 2 - - // - ULONG HopSet; - #define MSNdis_80211_ConfigurationFH_HopSet_SIZE sizeof(ULONG) - #define MSNdis_80211_ConfigurationFH_HopSet_ID 3 - - // - ULONG DwellTime; - #define MSNdis_80211_ConfigurationFH_DwellTime_SIZE sizeof(ULONG) - #define MSNdis_80211_ConfigurationFH_DwellTime_ID 4 - -} MSNdis_80211_ConfigurationFH, *PMSNdis_80211_ConfigurationFH; - -#define MSNdis_80211_ConfigurationFH_SIZE (FIELD_OFFSET(MSNdis_80211_ConfigurationFH, DwellTime) + MSNdis_80211_ConfigurationFH_DwellTime_SIZE) - -// MSNdis_80211_ConfigurationInfo - MSNdis_80211_ConfigurationInfo -#define MSNdis_80211_ConfigurationInfoGuid \ - { 0x220c16fc,0xb9a8,0x11d4, { 0xb6,0x75,0x00,0x20,0x48,0x57,0x03,0x37 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_ConfigurationInfo_GUID, \ - 0x220c16fc,0xb9a8,0x11d4,0xb6,0x75,0x00,0x20,0x48,0x57,0x03,0x37); -#endif - - -typedef struct _MSNdis_80211_ConfigurationInfo -{ - // - ULONG ConfigLength; - #define MSNdis_80211_ConfigurationInfo_ConfigLength_SIZE sizeof(ULONG) - #define MSNdis_80211_ConfigurationInfo_ConfigLength_ID 1 - - // - ULONG BeaconPeriod; - #define MSNdis_80211_ConfigurationInfo_BeaconPeriod_SIZE sizeof(ULONG) - #define MSNdis_80211_ConfigurationInfo_BeaconPeriod_ID 2 - - // - ULONG ATIMWindow; - #define MSNdis_80211_ConfigurationInfo_ATIMWindow_SIZE sizeof(ULONG) - #define MSNdis_80211_ConfigurationInfo_ATIMWindow_ID 3 - - // - ULONG DSConfig; - #define MSNdis_80211_ConfigurationInfo_DSConfig_SIZE sizeof(ULONG) - #define MSNdis_80211_ConfigurationInfo_DSConfig_ID 4 - - // - MSNdis_80211_ConfigurationFH FHConfig; - #define MSNdis_80211_ConfigurationInfo_FHConfig_SIZE sizeof(MSNdis_80211_ConfigurationFH) - #define MSNdis_80211_ConfigurationInfo_FHConfig_ID 5 - -} MSNdis_80211_ConfigurationInfo, *PMSNdis_80211_ConfigurationInfo; - -#define MSNdis_80211_ConfigurationInfo_SIZE (FIELD_OFFSET(MSNdis_80211_ConfigurationInfo, FHConfig) + MSNdis_80211_ConfigurationInfo_FHConfig_SIZE) - -// MSNdis_80211_WLanBssId - MSNdis_80211_WLanBssId -#define MSNdis_80211_WLanBssIdGuid \ - { 0x6929e718,0x2062,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_WLanBssId_GUID, \ - 0x6929e718,0x2062,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_WLanBssId -{ - // - ULONG Ndis80211WLanBssIdLength; - #define MSNdis_80211_WLanBssId_Ndis80211WLanBssIdLength_SIZE sizeof(ULONG) - #define MSNdis_80211_WLanBssId_Ndis80211WLanBssIdLength_ID 1 - - // - UCHAR Ndis80211MacAddress[6]; - #define MSNdis_80211_WLanBssId_Ndis80211MacAddress_SIZE sizeof(UCHAR[6]) - #define MSNdis_80211_WLanBssId_Ndis80211MacAddress_ID 2 - - // - USHORT Reserved; - #define MSNdis_80211_WLanBssId_Reserved_SIZE sizeof(USHORT) - #define MSNdis_80211_WLanBssId_Reserved_ID 3 - - // - ULONG Ndis80211SsIdLength; - #define MSNdis_80211_WLanBssId_Ndis80211SsIdLength_SIZE sizeof(ULONG) - #define MSNdis_80211_WLanBssId_Ndis80211SsIdLength_ID 4 - - // - UCHAR Ndis80211SsId[32]; - #define MSNdis_80211_WLanBssId_Ndis80211SsId_SIZE sizeof(UCHAR[32]) - #define MSNdis_80211_WLanBssId_Ndis80211SsId_ID 5 - - // - ULONG Ndis80211Privacy; - #define MSNdis_80211_WLanBssId_Ndis80211Privacy_SIZE sizeof(ULONG) - #define MSNdis_80211_WLanBssId_Ndis80211Privacy_ID 6 - - // - ULONG Ndis80211Rssi; - #define MSNdis_80211_WLanBssId_Ndis80211Rssi_SIZE sizeof(ULONG) - #define MSNdis_80211_WLanBssId_Ndis80211Rssi_ID 7 - - // - MSNdis_80211_NetworkType Ndis80211NetworkTypeInUse; - #define MSNdis_80211_WLanBssId_Ndis80211NetworkTypeInUse_SIZE sizeof(MSNdis_80211_NetworkType) - #define MSNdis_80211_WLanBssId_Ndis80211NetworkTypeInUse_ID 8 - - // - MSNdis_80211_ConfigurationInfo Ndis80211Configuration; - #define MSNdis_80211_WLanBssId_Ndis80211Configuration_SIZE sizeof(MSNdis_80211_ConfigurationInfo) - #define MSNdis_80211_WLanBssId_Ndis80211Configuration_ID 9 - - // - MSNdis_80211_NetworkInfrastructure Ndis80211InfrastructureMode; - #define MSNdis_80211_WLanBssId_Ndis80211InfrastructureMode_SIZE sizeof(MSNdis_80211_NetworkInfrastructure) - #define MSNdis_80211_WLanBssId_Ndis80211InfrastructureMode_ID 10 - - // - UCHAR Ndis80211SupportedRate[8]; - #define MSNdis_80211_WLanBssId_Ndis80211SupportedRate_SIZE sizeof(UCHAR[8]) - #define MSNdis_80211_WLanBssId_Ndis80211SupportedRate_ID 11 - -} MSNdis_80211_WLanBssId, *PMSNdis_80211_WLanBssId; - -#define MSNdis_80211_WLanBssId_SIZE (FIELD_OFFSET(MSNdis_80211_WLanBssId, Ndis80211SupportedRate) + MSNdis_80211_WLanBssId_Ndis80211SupportedRate_SIZE) - -// MSNdis_80211_BSSIList - MSNdis_80211_BSSIList -#define MSNdis_80211_BSSIListGuid \ - { 0x69526f9a,0x2062,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_BSSIList_GUID, \ - 0x69526f9a,0x2062,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_BSSIList -{ - // - ULONG NumberOfItems; - #define MSNdis_80211_BSSIList_NumberOfItems_SIZE sizeof(ULONG) - #define MSNdis_80211_BSSIList_NumberOfItems_ID 1 - - // - MSNdis_80211_WLanBssId Ndis80211BSSIList[1]; - #define MSNdis_80211_BSSIList_Ndis80211BSSIList_ID 2 - -} MSNdis_80211_BSSIList, *PMSNdis_80211_BSSIList; - -// MSNdis_80211_InfrastructureMode - MSNdis_80211_InfrastructureMode -#define MSNdis_80211_InfrastructureModeGuid \ - { 0x697d5a7e,0x2062,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_InfrastructureMode_GUID, \ - 0x697d5a7e,0x2062,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_InfrastructureMode -{ - // - MSNdis_80211_NetworkInfrastructure Ndis80211InfrastructureMode; - #define MSNdis_80211_InfrastructureMode_Ndis80211InfrastructureMode_SIZE sizeof(MSNdis_80211_NetworkInfrastructure) - #define MSNdis_80211_InfrastructureMode_Ndis80211InfrastructureMode_ID 1 - -} MSNdis_80211_InfrastructureMode, *PMSNdis_80211_InfrastructureMode; - -#define MSNdis_80211_InfrastructureMode_SIZE (FIELD_OFFSET(MSNdis_80211_InfrastructureMode, Ndis80211InfrastructureMode) + MSNdis_80211_InfrastructureMode_Ndis80211InfrastructureMode_SIZE) - -// MSNdis_80211_FragmentationThreshold - MSNdis_80211_FragmentationThreshold -#define MSNdis_80211_FragmentationThresholdGuid \ - { 0x69aaa7c4,0x2062,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_FragmentationThreshold_GUID, \ - 0x69aaa7c4,0x2062,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_FragmentationThreshold -{ - // - ULONG Ndis80211FragmentationThreshold; - #define MSNdis_80211_FragmentationThreshold_Ndis80211FragmentationThreshold_SIZE sizeof(ULONG) - #define MSNdis_80211_FragmentationThreshold_Ndis80211FragmentationThreshold_ID 1 - -} MSNdis_80211_FragmentationThreshold, *PMSNdis_80211_FragmentationThreshold; - -#define MSNdis_80211_FragmentationThreshold_SIZE (FIELD_OFFSET(MSNdis_80211_FragmentationThreshold, Ndis80211FragmentationThreshold) + MSNdis_80211_FragmentationThreshold_Ndis80211FragmentationThreshold_SIZE) - -// MSNdis_80211_RTSThreshold - MSNdis_80211_RTSThreshold -#define MSNdis_80211_RTSThresholdGuid \ - { 0x0134d07e,0x2064,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_RTSThreshold_GUID, \ - 0x0134d07e,0x2064,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_RTSThreshold -{ - // - ULONG Ndis80211RTSThreshold; - #define MSNdis_80211_RTSThreshold_Ndis80211RTSThreshold_SIZE sizeof(ULONG) - #define MSNdis_80211_RTSThreshold_Ndis80211RTSThreshold_ID 1 - -} MSNdis_80211_RTSThreshold, *PMSNdis_80211_RTSThreshold; - -#define MSNdis_80211_RTSThreshold_SIZE (FIELD_OFFSET(MSNdis_80211_RTSThreshold, Ndis80211RTSThreshold) + MSNdis_80211_RTSThreshold_Ndis80211RTSThreshold_SIZE) - -// MSNdis_80211_NumberOfAntennas - MSNdis_80211_NumberOfAntennas -#define MSNdis_80211_NumberOfAntennasGuid \ - { 0x01779336,0x2064,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_NumberOfAntennas_GUID, \ - 0x01779336,0x2064,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_NumberOfAntennas -{ - // - ULONG Ndis80211NumberOfAntennas; - #define MSNdis_80211_NumberOfAntennas_Ndis80211NumberOfAntennas_SIZE sizeof(ULONG) - #define MSNdis_80211_NumberOfAntennas_Ndis80211NumberOfAntennas_ID 1 - -} MSNdis_80211_NumberOfAntennas, *PMSNdis_80211_NumberOfAntennas; - -#define MSNdis_80211_NumberOfAntennas_SIZE (FIELD_OFFSET(MSNdis_80211_NumberOfAntennas, Ndis80211NumberOfAntennas) + MSNdis_80211_NumberOfAntennas_Ndis80211NumberOfAntennas_SIZE) - -// MSNdis_80211_ReceiveAntennaSelected - MSNdis_80211_ReceiveAntennaSelected -#define MSNdis_80211_ReceiveAntennaSelectedGuid \ - { 0x01ac07a2,0x2064,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_ReceiveAntennaSelected_GUID, \ - 0x01ac07a2,0x2064,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_ReceiveAntennaSelected -{ - // - ULONG Ndis80211ReceiveAntennaSelected; - #define MSNdis_80211_ReceiveAntennaSelected_Ndis80211ReceiveAntennaSelected_SIZE sizeof(ULONG) - #define MSNdis_80211_ReceiveAntennaSelected_Ndis80211ReceiveAntennaSelected_ID 1 - -} MSNdis_80211_ReceiveAntennaSelected, *PMSNdis_80211_ReceiveAntennaSelected; - -#define MSNdis_80211_ReceiveAntennaSelected_SIZE (FIELD_OFFSET(MSNdis_80211_ReceiveAntennaSelected, Ndis80211ReceiveAntennaSelected) + MSNdis_80211_ReceiveAntennaSelected_Ndis80211ReceiveAntennaSelected_SIZE) - -// MSNdis_80211_TransmitAntennaSelected - MSNdis_80211_TransmitAntennaSelected -#define MSNdis_80211_TransmitAntennaSelectedGuid \ - { 0x01dbb74a,0x2064,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_TransmitAntennaSelected_GUID, \ - 0x01dbb74a,0x2064,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_TransmitAntennaSelected -{ - // - ULONG Ndis80211TransmitAntennaSelected; - #define MSNdis_80211_TransmitAntennaSelected_Ndis80211TransmitAntennaSelected_SIZE sizeof(ULONG) - #define MSNdis_80211_TransmitAntennaSelected_Ndis80211TransmitAntennaSelected_ID 1 - -} MSNdis_80211_TransmitAntennaSelected, *PMSNdis_80211_TransmitAntennaSelected; - -#define MSNdis_80211_TransmitAntennaSelected_SIZE (FIELD_OFFSET(MSNdis_80211_TransmitAntennaSelected, Ndis80211TransmitAntennaSelected) + MSNdis_80211_TransmitAntennaSelected_Ndis80211TransmitAntennaSelected_SIZE) - -// MSNdis_80211_DataRates - MSNdis_80211_DataRates -#define MSNdis_80211_DataRatesGuid \ - { 0x49db8722,0x2068,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_DataRates_GUID, \ - 0x49db8722,0x2068,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_DataRates -{ - // - UCHAR Ndis80211DataRate[8]; - #define MSNdis_80211_DataRates_Ndis80211DataRate_SIZE sizeof(UCHAR[8]) - #define MSNdis_80211_DataRates_Ndis80211DataRate_ID 1 - -} MSNdis_80211_DataRates, *PMSNdis_80211_DataRates; - -#define MSNdis_80211_DataRates_SIZE (FIELD_OFFSET(MSNdis_80211_DataRates, Ndis80211DataRate) + MSNdis_80211_DataRates_Ndis80211DataRate_SIZE) - -// MSNdis_80211_DesiredDataRates - MSNdis_80211_DesiredDataRates -#define MSNdis_80211_DesiredDataRatesGuid \ - { 0x452ee08e,0x2536,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_DesiredDataRates_GUID, \ - 0x452ee08e,0x2536,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_DesiredDataRates -{ - // - UCHAR Ndis80211DesiredRate[8]; - #define MSNdis_80211_DesiredDataRates_Ndis80211DesiredRate_SIZE sizeof(UCHAR[8]) - #define MSNdis_80211_DesiredDataRates_Ndis80211DesiredRate_ID 1 - -} MSNdis_80211_DesiredDataRates, *PMSNdis_80211_DesiredDataRates; - -#define MSNdis_80211_DesiredDataRates_SIZE (FIELD_OFFSET(MSNdis_80211_DesiredDataRates, Ndis80211DesiredRate) + MSNdis_80211_DesiredDataRates_Ndis80211DesiredRate_SIZE) - -// MSNdis_80211_Configuration - MSNdis_80211_Configuration -#define MSNdis_80211_ConfigurationGuid \ - { 0x4a4df982,0x2068,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_Configuration_GUID, \ - 0x4a4df982,0x2068,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_Configuration -{ - // - MSNdis_80211_ConfigurationInfo Ndis80211Config; - #define MSNdis_80211_Configuration_Ndis80211Config_SIZE sizeof(MSNdis_80211_ConfigurationInfo) - #define MSNdis_80211_Configuration_Ndis80211Config_ID 1 - -} MSNdis_80211_Configuration, *PMSNdis_80211_Configuration; - -#define MSNdis_80211_Configuration_SIZE (FIELD_OFFSET(MSNdis_80211_Configuration, Ndis80211Config) + MSNdis_80211_Configuration_Ndis80211Config_SIZE) - -// MSNdis_80211_Statistics - MSNdis_80211_Statistics -#define MSNdis_80211_StatisticsGuid \ - { 0x42bb73b0,0x2129,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_Statistics_GUID, \ - 0x42bb73b0,0x2129,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_Statistics -{ - // - ULONG StatisticsLength; - #define MSNdis_80211_Statistics_StatisticsLength_SIZE sizeof(ULONG) - #define MSNdis_80211_Statistics_StatisticsLength_ID 1 - - // - ULONGLONG TransmittedFragmentCount; - #define MSNdis_80211_Statistics_TransmittedFragmentCount_SIZE sizeof(ULONGLONG) - #define MSNdis_80211_Statistics_TransmittedFragmentCount_ID 2 - - // - ULONGLONG MulticastTransmittedFrameCount; - #define MSNdis_80211_Statistics_MulticastTransmittedFrameCount_SIZE sizeof(ULONGLONG) - #define MSNdis_80211_Statistics_MulticastTransmittedFrameCount_ID 3 - - // - ULONGLONG FailedCount; - #define MSNdis_80211_Statistics_FailedCount_SIZE sizeof(ULONGLONG) - #define MSNdis_80211_Statistics_FailedCount_ID 4 - - // - ULONGLONG RetryCount; - #define MSNdis_80211_Statistics_RetryCount_SIZE sizeof(ULONGLONG) - #define MSNdis_80211_Statistics_RetryCount_ID 5 - - // - ULONGLONG MultipleRetryCount; - #define MSNdis_80211_Statistics_MultipleRetryCount_SIZE sizeof(ULONGLONG) - #define MSNdis_80211_Statistics_MultipleRetryCount_ID 6 - - // - ULONGLONG RTSSuccessCount; - #define MSNdis_80211_Statistics_RTSSuccessCount_SIZE sizeof(ULONGLONG) - #define MSNdis_80211_Statistics_RTSSuccessCount_ID 7 - - // - ULONGLONG RTSFailureCount; - #define MSNdis_80211_Statistics_RTSFailureCount_SIZE sizeof(ULONGLONG) - #define MSNdis_80211_Statistics_RTSFailureCount_ID 8 - - // - ULONGLONG ACKFailureCount; - #define MSNdis_80211_Statistics_ACKFailureCount_SIZE sizeof(ULONGLONG) - #define MSNdis_80211_Statistics_ACKFailureCount_ID 9 - - // - ULONGLONG FrameDuplicateCount; - #define MSNdis_80211_Statistics_FrameDuplicateCount_SIZE sizeof(ULONGLONG) - #define MSNdis_80211_Statistics_FrameDuplicateCount_ID 10 - - // - ULONGLONG ReceivedFragmentCount; - #define MSNdis_80211_Statistics_ReceivedFragmentCount_SIZE sizeof(ULONGLONG) - #define MSNdis_80211_Statistics_ReceivedFragmentCount_ID 11 - - // - ULONGLONG MulticastReceivedFrameCount; - #define MSNdis_80211_Statistics_MulticastReceivedFrameCount_SIZE sizeof(ULONGLONG) - #define MSNdis_80211_Statistics_MulticastReceivedFrameCount_ID 12 - - // - ULONGLONG FCSErrorCount; - #define MSNdis_80211_Statistics_FCSErrorCount_SIZE sizeof(ULONGLONG) - #define MSNdis_80211_Statistics_FCSErrorCount_ID 13 - -} MSNdis_80211_Statistics, *PMSNdis_80211_Statistics; - -#define MSNdis_80211_Statistics_SIZE (FIELD_OFFSET(MSNdis_80211_Statistics, FCSErrorCount) + MSNdis_80211_Statistics_FCSErrorCount_SIZE) - -// MSNdis_80211_AddWEP - MSNdis_80211_AddWEP -#define MSNdis_80211_AddWEPGuid \ - { 0x4307bff0,0x2129,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_AddWEP_GUID, \ - 0x4307bff0,0x2129,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_AddWEP -{ - // - ULONG Length; - #define MSNdis_80211_AddWEP_Length_SIZE sizeof(ULONG) - #define MSNdis_80211_AddWEP_Length_ID 1 - - // - ULONG KeyIndex; - #define MSNdis_80211_AddWEP_KeyIndex_SIZE sizeof(ULONG) - #define MSNdis_80211_AddWEP_KeyIndex_ID 2 - - // - ULONG KeyLength; - #define MSNdis_80211_AddWEP_KeyLength_SIZE sizeof(ULONG) - #define MSNdis_80211_AddWEP_KeyLength_ID 3 - - // - UCHAR KeyMaterial[1]; - #define MSNdis_80211_AddWEP_KeyMaterial_ID 4 - -} MSNdis_80211_AddWEP, *PMSNdis_80211_AddWEP; - -// MSNdis_80211_RemoveWEP - MSNdis_80211_RemoveWEP -#define MSNdis_80211_RemoveWEPGuid \ - { 0x433c345c,0x2129,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_RemoveWEP_GUID, \ - 0x433c345c,0x2129,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_RemoveWEP -{ - // - ULONG Ndis80211KeyIndex; - #define MSNdis_80211_RemoveWEP_Ndis80211KeyIndex_SIZE sizeof(ULONG) - #define MSNdis_80211_RemoveWEP_Ndis80211KeyIndex_ID 1 - -} MSNdis_80211_RemoveWEP, *PMSNdis_80211_RemoveWEP; - -#define MSNdis_80211_RemoveWEP_SIZE (FIELD_OFFSET(MSNdis_80211_RemoveWEP, Ndis80211KeyIndex) + MSNdis_80211_RemoveWEP_Ndis80211KeyIndex_SIZE) - -// MSNdis_80211_Disassociate - MSNdis_80211_Disassociate -#define MSNdis_80211_DisassociateGuid \ - { 0x43671f40,0x2129,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_Disassociate_GUID, \ - 0x43671f40,0x2129,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_Disassociate -{ - // - ULONG UnusedParameter; - #define MSNdis_80211_Disassociate_UnusedParameter_SIZE sizeof(ULONG) - #define MSNdis_80211_Disassociate_UnusedParameter_ID 1 - -} MSNdis_80211_Disassociate, *PMSNdis_80211_Disassociate; - -#define MSNdis_80211_Disassociate_SIZE (FIELD_OFFSET(MSNdis_80211_Disassociate, UnusedParameter) + MSNdis_80211_Disassociate_UnusedParameter_SIZE) - -// MSNdis_80211_BssIdListScan - MSNdis_80211_BssIdListScan -#define MSNdis_80211_BssIdListScanGuid \ - { 0x0d9e01e1,0xba70,0x11d4, { 0xb6,0x75,0x00,0x20,0x48,0x57,0x03,0x37 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_BssIdListScan_GUID, \ - 0x0d9e01e1,0xba70,0x11d4,0xb6,0x75,0x00,0x20,0x48,0x57,0x03,0x37); -#endif - - -typedef struct _MSNdis_80211_BssIdListScan -{ - // - ULONG UnusedParameter; - #define MSNdis_80211_BssIdListScan_UnusedParameter_SIZE sizeof(ULONG) - #define MSNdis_80211_BssIdListScan_UnusedParameter_ID 1 - -} MSNdis_80211_BssIdListScan, *PMSNdis_80211_BssIdListScan; - -#define MSNdis_80211_BssIdListScan_SIZE (FIELD_OFFSET(MSNdis_80211_BssIdListScan, UnusedParameter) + MSNdis_80211_BssIdListScan_UnusedParameter_SIZE) - -// MSNdis_80211_AuthenticationMode - MSNdis_80211_AuthenticationMode -#define MSNdis_80211_AuthenticationModeGuid \ - { 0x43920a24,0x2129,0x11d4, { 0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_AuthenticationMode_GUID, \ - 0x43920a24,0x2129,0x11d4,0x97,0xeb,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_AuthenticationMode -{ - // - ULONG Ndis80211AuthenticationMode; - #define MSNdis_80211_AuthenticationMode_Ndis80211AuthenticationMode_SIZE sizeof(ULONG) - #define MSNdis_80211_AuthenticationMode_Ndis80211AuthenticationMode_ID 1 - -} MSNdis_80211_AuthenticationMode, *PMSNdis_80211_AuthenticationMode; - -#define MSNdis_80211_AuthenticationMode_SIZE (FIELD_OFFSET(MSNdis_80211_AuthenticationMode, Ndis80211AuthenticationMode) + MSNdis_80211_AuthenticationMode_Ndis80211AuthenticationMode_SIZE) - -// MSNdis_80211_PrivacyFilter - MSNdis_80211_PrivacyFilter -#define MSNdis_80211_PrivacyFilterGuid \ - { 0x6733c4e9,0x4792,0x11d4, { 0x97,0xf1,0x00,0xc0,0x4f,0x79,0xc4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_PrivacyFilter_GUID, \ - 0x6733c4e9,0x4792,0x11d4,0x97,0xf1,0x00,0xc0,0x4f,0x79,0xc4,0x03); -#endif - - -typedef struct _MSNdis_80211_PrivacyFilter -{ - // - ULONG Ndis80211PrivacyFilter; - #define MSNdis_80211_PrivacyFilter_Ndis80211PrivacyFilter_SIZE sizeof(ULONG) - #define MSNdis_80211_PrivacyFilter_Ndis80211PrivacyFilter_ID 1 - -} MSNdis_80211_PrivacyFilter, *PMSNdis_80211_PrivacyFilter; - -#define MSNdis_80211_PrivacyFilter_SIZE (FIELD_OFFSET(MSNdis_80211_PrivacyFilter, Ndis80211PrivacyFilter) + MSNdis_80211_PrivacyFilter_Ndis80211PrivacyFilter_SIZE) - -// MSNdis_80211_WEPStatus - MSNdis_80211_WEPStatus -#define MSNdis_80211_WEPStatusGuid \ - { 0xb027a21f,0x3cfa,0x4125, { 0x80,0x0b,0x3f,0x7a,0x18,0xfd,0xdc,0xdc } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_WEPStatus_GUID, \ - 0xb027a21f,0x3cfa,0x4125,0x80,0x0b,0x3f,0x7a,0x18,0xfd,0xdc,0xdc); -#endif - - -typedef struct _MSNdis_80211_WEPStatus -{ - // - ULONG Ndis80211WEPStatus; - #define MSNdis_80211_WEPStatus_Ndis80211WEPStatus_SIZE sizeof(ULONG) - #define MSNdis_80211_WEPStatus_Ndis80211WEPStatus_ID 1 - -} MSNdis_80211_WEPStatus, *PMSNdis_80211_WEPStatus; - -#define MSNdis_80211_WEPStatus_SIZE (FIELD_OFFSET(MSNdis_80211_WEPStatus, Ndis80211WEPStatus) + MSNdis_80211_WEPStatus_Ndis80211WEPStatus_SIZE) - -// MSNdis_80211_ReloadDefaults - MSNdis_80211_ReloadDefaults -#define MSNdis_80211_ReloadDefaultsGuid \ - { 0x748b14e8,0x32ee,0x4425, { 0xb9,0x1b,0xc9,0x84,0x8c,0x58,0xb5,0x5a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_80211_ReloadDefaults_GUID, \ - 0x748b14e8,0x32ee,0x4425,0xb9,0x1b,0xc9,0x84,0x8c,0x58,0xb5,0x5a); -#endif - - -typedef struct _MSNdis_80211_ReloadDefaults -{ - // - ULONG Ndis80211ReloadDefaults; - #define MSNdis_80211_ReloadDefaults_Ndis80211ReloadDefaults_SIZE sizeof(ULONG) - #define MSNdis_80211_ReloadDefaults_Ndis80211ReloadDefaults_ID 1 - -} MSNdis_80211_ReloadDefaults, *PMSNdis_80211_ReloadDefaults; - -#define MSNdis_80211_ReloadDefaults_SIZE (FIELD_OFFSET(MSNdis_80211_ReloadDefaults, Ndis80211ReloadDefaults) + MSNdis_80211_ReloadDefaults_Ndis80211ReloadDefaults_SIZE) - -// MSNdis_PMAdminConfigState - MSNdis_PMAdminConfigState -#define MSNdis_PMAdminConfigStateGuid \ - { 0x0cffd0fc,0x8333,0x4000, { 0x9a,0x3b,0x20,0x07,0x35,0xd6,0x98,0xf9 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_PMAdminConfigState_GUID, \ - 0x0cffd0fc,0x8333,0x4000,0x9a,0x3b,0x20,0x07,0x35,0xd6,0x98,0xf9); -#endif - - -typedef struct _MSNdis_PMAdminConfigState -{ - // - ULONG NdisPMAdminConfigState; - #define MSNdis_PMAdminConfigState_NdisPMAdminConfigState_SIZE sizeof(ULONG) - #define MSNdis_PMAdminConfigState_NdisPMAdminConfigState_ID 1 - -} MSNdis_PMAdminConfigState, *PMSNdis_PMAdminConfigState; - -#define MSNdis_PMAdminConfigState_SIZE (FIELD_OFFSET(MSNdis_PMAdminConfigState, NdisPMAdminConfigState) + MSNdis_PMAdminConfigState_NdisPMAdminConfigState_SIZE) - -// MSNdis_PMAdminConfigParam - MSNdis_PMAdminConfigParam -#define MSNdis_PMAdminConfigParamGuid \ - { 0x492dc449,0x13d9,0x4bd6, { 0x89,0xd4,0x96,0xe3,0x53,0x4e,0x6a,0x05 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_PMAdminConfigParam_GUID, \ - 0x492dc449,0x13d9,0x4bd6,0x89,0xd4,0x96,0xe3,0x53,0x4e,0x6a,0x05); -#endif - - -typedef struct _MSNdis_PMAdminConfigParam -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_PMAdminConfigParam_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_PMAdminConfigParam_Header_ID 1 - - // - MSNdis_PMAdminConfigState WakeOnPattern; - #define MSNdis_PMAdminConfigParam_WakeOnPattern_SIZE sizeof(MSNdis_PMAdminConfigState) - #define MSNdis_PMAdminConfigParam_WakeOnPattern_ID 2 - - // - MSNdis_PMAdminConfigState WakeOnMagicPacket; - #define MSNdis_PMAdminConfigParam_WakeOnMagicPacket_SIZE sizeof(MSNdis_PMAdminConfigState) - #define MSNdis_PMAdminConfigParam_WakeOnMagicPacket_ID 3 - - // - MSNdis_PMAdminConfigState DeviceSleepOnDisconnect; - #define MSNdis_PMAdminConfigParam_DeviceSleepOnDisconnect_SIZE sizeof(MSNdis_PMAdminConfigState) - #define MSNdis_PMAdminConfigParam_DeviceSleepOnDisconnect_ID 4 - - // - MSNdis_PMAdminConfigState PMARPOffload; - #define MSNdis_PMAdminConfigParam_PMARPOffload_SIZE sizeof(MSNdis_PMAdminConfigState) - #define MSNdis_PMAdminConfigParam_PMARPOffload_ID 5 - - // - MSNdis_PMAdminConfigState PMNDOffload; - #define MSNdis_PMAdminConfigParam_PMNDOffload_SIZE sizeof(MSNdis_PMAdminConfigState) - #define MSNdis_PMAdminConfigParam_PMNDOffload_ID 6 - - // - MSNdis_PMAdminConfigState PMWiFiRekeyOffload; - #define MSNdis_PMAdminConfigParam_PMWiFiRekeyOffload_SIZE sizeof(MSNdis_PMAdminConfigState) - #define MSNdis_PMAdminConfigParam_PMWiFiRekeyOffload_ID 7 - -} MSNdis_PMAdminConfigParam, *PMSNdis_PMAdminConfigParam; - -#define MSNdis_PMAdminConfigParam_SIZE (FIELD_OFFSET(MSNdis_PMAdminConfigParam, PMWiFiRekeyOffload) + MSNdis_PMAdminConfigParam_PMWiFiRekeyOffload_SIZE) - -// MSNdis_PMAdminConfig - MSNdis_PMAdminConfig -// Control power management related standardized keywords -#define MSNdis_PMAdminConfigGuid \ - { 0x1528d111,0x708a,0x4ca4, { 0x92,0x15,0xc0,0x57,0x71,0x16,0x1c,0xda } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_PMAdminConfig_GUID, \ - 0x1528d111,0x708a,0x4ca4,0x92,0x15,0xc0,0x57,0x71,0x16,0x1c,0xda); -#endif - - -typedef struct _MSNdis_PMAdminConfig -{ - // - MSNdis_PMAdminConfigParam PMAdminConfigParam; - #define MSNdis_PMAdminConfig_PMAdminConfigParam_SIZE sizeof(MSNdis_PMAdminConfigParam) - #define MSNdis_PMAdminConfig_PMAdminConfigParam_ID 1 - -} MSNdis_PMAdminConfig, *PMSNdis_PMAdminConfig; - -#define MSNdis_PMAdminConfig_SIZE (FIELD_OFFSET(MSNdis_PMAdminConfig, PMAdminConfigParam) + MSNdis_PMAdminConfig_PMAdminConfigParam_SIZE) - -// MSNdis_PMCapabilityState - MSNdis_PMCapabilityState -#define MSNdis_PMCapabilityStateGuid \ - { 0xc1cc6857,0x1a26,0x4f6d, { 0xab,0x98,0x29,0x1f,0x0c,0x3b,0xbd,0x4c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_PMCapabilityState_GUID, \ - 0xc1cc6857,0x1a26,0x4f6d,0xab,0x98,0x29,0x1f,0x0c,0x3b,0xbd,0x4c); -#endif - - -typedef struct _MSNdis_PMCapabilityState -{ - // - ULONG NdisPMCapabilityState; - #define MSNdis_PMCapabilityState_NdisPMCapabilityState_SIZE sizeof(ULONG) - #define MSNdis_PMCapabilityState_NdisPMCapabilityState_ID 1 - -} MSNdis_PMCapabilityState, *PMSNdis_PMCapabilityState; - -#define MSNdis_PMCapabilityState_SIZE (FIELD_OFFSET(MSNdis_PMCapabilityState, NdisPMCapabilityState) + MSNdis_PMCapabilityState_NdisPMCapabilityState_SIZE) - -// MSNdis_PMCapabilitiesParam - MSNdis_PMCapabilitiesParam -#define MSNdis_PMCapabilitiesParamGuid \ - { 0xcccb122d,0xd5c4,0x4ee1, { 0x80,0x01,0xb8,0xad,0x6d,0x3c,0xe8,0x76 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_PMCapabilitiesParam_GUID, \ - 0xcccb122d,0xd5c4,0x4ee1,0x80,0x01,0xb8,0xad,0x6d,0x3c,0xe8,0x76); -#endif - - -typedef struct _MSNdis_PMCapabilitiesParam -{ - // - MSNdis_ObjectHeader Header; - #define MSNdis_PMCapabilitiesParam_Header_SIZE sizeof(MSNdis_ObjectHeader) - #define MSNdis_PMCapabilitiesParam_Header_ID 1 - - // - MSNdis_PMCapabilityState WakeOnPattern; - #define MSNdis_PMCapabilitiesParam_WakeOnPattern_SIZE sizeof(MSNdis_PMCapabilityState) - #define MSNdis_PMCapabilitiesParam_WakeOnPattern_ID 2 - - // - MSNdis_PMCapabilityState WakeOnMagicPacket; - #define MSNdis_PMCapabilitiesParam_WakeOnMagicPacket_SIZE sizeof(MSNdis_PMCapabilityState) - #define MSNdis_PMCapabilitiesParam_WakeOnMagicPacket_ID 3 - - // - MSNdis_PMCapabilityState DeviceSleepOnDisconnect; - #define MSNdis_PMCapabilitiesParam_DeviceSleepOnDisconnect_SIZE sizeof(MSNdis_PMCapabilityState) - #define MSNdis_PMCapabilitiesParam_DeviceSleepOnDisconnect_ID 4 - - // - MSNdis_PMCapabilityState PMARPOffload; - #define MSNdis_PMCapabilitiesParam_PMARPOffload_SIZE sizeof(MSNdis_PMCapabilityState) - #define MSNdis_PMCapabilitiesParam_PMARPOffload_ID 5 - - // - MSNdis_PMCapabilityState PMNDOffload; - #define MSNdis_PMCapabilitiesParam_PMNDOffload_SIZE sizeof(MSNdis_PMCapabilityState) - #define MSNdis_PMCapabilitiesParam_PMNDOffload_ID 6 - - // - MSNdis_PMCapabilityState PMWiFiRekeyOffload; - #define MSNdis_PMCapabilitiesParam_PMWiFiRekeyOffload_SIZE sizeof(MSNdis_PMCapabilityState) - #define MSNdis_PMCapabilitiesParam_PMWiFiRekeyOffload_ID 7 - -} MSNdis_PMCapabilitiesParam, *PMSNdis_PMCapabilitiesParam; - -#define MSNdis_PMCapabilitiesParam_SIZE (FIELD_OFFSET(MSNdis_PMCapabilitiesParam, PMWiFiRekeyOffload) + MSNdis_PMCapabilitiesParam_PMWiFiRekeyOffload_SIZE) - -// MSNdis_PMCapabilities - MSNdis_PMCapabilities -// Query power management active capabilities -#define MSNdis_PMCapabilitiesGuid \ - { 0xb2cf76e3,0xb3ae,0x4394, { 0xa0,0x1f,0x33,0x8c,0x98,0x70,0xe9,0x39 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_PMCapabilities_GUID, \ - 0xb2cf76e3,0xb3ae,0x4394,0xa0,0x1f,0x33,0x8c,0x98,0x70,0xe9,0x39); -#endif - - -typedef struct _MSNdis_PMCapabilities -{ - // - MSNdis_PMCapabilitiesParam PMCapabilitiesParam; - #define MSNdis_PMCapabilities_PMCapabilitiesParam_SIZE sizeof(MSNdis_PMCapabilitiesParam) - #define MSNdis_PMCapabilities_PMCapabilitiesParam_ID 1 - -} MSNdis_PMCapabilities, *PMSNdis_PMCapabilities; - -#define MSNdis_PMCapabilities_SIZE (FIELD_OFFSET(MSNdis_PMCapabilities, PMCapabilitiesParam) + MSNdis_PMCapabilities_PMCapabilitiesParam_SIZE) - -// MSNdis_StatusResetStart - MSNdis_StatusResetStart -#define MSNdis_StatusResetStartGuid \ - { 0x981f2d76,0xb1f3,0x11d0, { 0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusResetStart_GUID, \ - 0x981f2d76,0xb1f3,0x11d0,0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -// MSNdis_StatusResetEnd - MSNdis_StatusResetEnd -#define MSNdis_StatusResetEndGuid \ - { 0x981f2d77,0xb1f3,0x11d0, { 0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusResetEnd_GUID, \ - 0x981f2d77,0xb1f3,0x11d0,0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -// MSNdis_StatusMediaConnect - MSNdis_StatusMediaConnect -#define MSNdis_StatusMediaConnectGuid \ - { 0x981f2d7d,0xb1f3,0x11d0, { 0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusMediaConnect_GUID, \ - 0x981f2d7d,0xb1f3,0x11d0,0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -// MSNdis_StatusMediaDisconnect - MSNdis_StatusMediaDisconnect -#define MSNdis_StatusMediaDisconnectGuid \ - { 0x981f2d7e,0xb1f3,0x11d0, { 0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusMediaDisconnect_GUID, \ - 0x981f2d7e,0xb1f3,0x11d0,0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -// MSNdis_StatusMediaSpecificIndication - MSNdis_StatusMediaSpecificIndication -#define MSNdis_StatusMediaSpecificIndicationGuid \ - { 0x981f2d84,0xb1f3,0x11d0, { 0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusMediaSpecificIndication_GUID, \ - 0x981f2d84,0xb1f3,0x11d0,0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_StatusMediaSpecificIndication -{ - // - ULONG NumberElements; - #define MSNdis_StatusMediaSpecificIndication_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusMediaSpecificIndication_NumberElements_ID 1 - - // - UCHAR NdisStatusMediaSpecificIndication[1]; - #define MSNdis_StatusMediaSpecificIndication_NdisStatusMediaSpecificIndication_ID 2 - -} MSNdis_StatusMediaSpecificIndication, *PMSNdis_StatusMediaSpecificIndication; - -// MSNdis_StatusLinkSpeedChange - MSNdis_StatusLinkSpeedChange -#define MSNdis_StatusLinkSpeedChangeGuid \ - { 0x981f2d85,0xb1f3,0x11d0, { 0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusLinkSpeedChange_GUID, \ - 0x981f2d85,0xb1f3,0x11d0,0x8d,0xd7,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_StatusLinkSpeedChange -{ - // - MSNdis_NetworkLinkSpeed NdisStatusLinkSpeedChange; - #define MSNdis_StatusLinkSpeedChange_NdisStatusLinkSpeedChange_SIZE sizeof(MSNdis_NetworkLinkSpeed) - #define MSNdis_StatusLinkSpeedChange_NdisStatusLinkSpeedChange_ID 1 - -} MSNdis_StatusLinkSpeedChange, *PMSNdis_StatusLinkSpeedChange; - -#define MSNdis_StatusLinkSpeedChange_SIZE (FIELD_OFFSET(MSNdis_StatusLinkSpeedChange, NdisStatusLinkSpeedChange) + MSNdis_StatusLinkSpeedChange_NdisStatusLinkSpeedChange_SIZE) - -// MSNdis_StatusProtocolBind - MSNdis_StatusProtocolBind -#define MSNdis_StatusProtocolBindGuid \ - { 0x5413531c,0xb1f3,0x11d0, { 0xd7,0x8d,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusProtocolBind_GUID, \ - 0x5413531c,0xb1f3,0x11d0,0xd7,0x8d,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_StatusProtocolBind -{ - // - CHAR VariableData[1]; - #define MSNdis_StatusProtocolBind_Transport_ID 1 - -} MSNdis_StatusProtocolBind, *PMSNdis_StatusProtocolBind; - -// MSNdis_StatusProtocolUnbind - MSNdis_StatusProtocolUnbind -#define MSNdis_StatusProtocolUnbindGuid \ - { 0x6e3ce1ec,0xb1f3,0x11d0, { 0xd7,0x8d,0x00,0xc0,0x4f,0xc3,0x35,0x8c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusProtocolUnbind_GUID, \ - 0x6e3ce1ec,0xb1f3,0x11d0,0xd7,0x8d,0x00,0xc0,0x4f,0xc3,0x35,0x8c); -#endif - - -typedef struct _MSNdis_StatusProtocolUnbind -{ - // - CHAR VariableData[1]; - #define MSNdis_StatusProtocolUnbind_Transport_ID 1 - -} MSNdis_StatusProtocolUnbind, *PMSNdis_StatusProtocolUnbind; - -// MSNdis_StatusDevicePowerOn - MSNdis_StatusDevicePowerOn -#define MSNdis_StatusDevicePowerOnGuid \ - { 0x5f81cfd0,0xf046,0x4342, { 0x61,0xaf,0x89,0x5a,0xce,0xda,0xef,0xd9 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDevicePowerOn_GUID, \ - 0x5f81cfd0,0xf046,0x4342,0x61,0xaf,0x89,0x5a,0xce,0xda,0xef,0xd9); -#endif - - -typedef struct _MSNdis_StatusDevicePowerOn -{ - // - CHAR VariableData[1]; - #define MSNdis_StatusDevicePowerOn_Device_ID 1 - -} MSNdis_StatusDevicePowerOn, *PMSNdis_StatusDevicePowerOn; - -// MSNdis_StatusDevicePowerOff - MSNdis_StatusDevicePowerOff -#define MSNdis_StatusDevicePowerOffGuid \ - { 0x81bc8189,0xb026,0x46ab, { 0x64,0xb9,0xf1,0x82,0xe3,0x42,0x93,0x4e } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDevicePowerOff_GUID, \ - 0x81bc8189,0xb026,0x46ab,0x64,0xb9,0xf1,0x82,0xe3,0x42,0x93,0x4e); -#endif - - -typedef struct _MSNdis_StatusDevicePowerOff -{ - // - CHAR VariableData[1]; - #define MSNdis_StatusDevicePowerOff_Device_ID 1 - -} MSNdis_StatusDevicePowerOff, *PMSNdis_StatusDevicePowerOff; - -// MSNdis_StatusDevicePowerOnEx - MSNdis_StatusDevicePowerOnEx -#define MSNdis_StatusDevicePowerOnExGuid \ - { 0x2b440188,0x92ac,0x4f60, { 0x9b,0x2d,0x20,0xa3,0x0c,0xbb,0x6b,0xbe } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDevicePowerOnEx_GUID, \ - 0x2b440188,0x92ac,0x4f60,0x9b,0x2d,0x20,0xa3,0x0c,0xbb,0x6b,0xbe); -#endif - - -typedef struct _MSNdis_StatusDevicePowerOnEx -{ - // - CHAR VariableData[1]; - #define MSNdis_StatusDevicePowerOnEx_Device_ID 1 - -} MSNdis_StatusDevicePowerOnEx, *PMSNdis_StatusDevicePowerOnEx; - -// MSNdis_StatusDevicePowerOffEx - MSNdis_StatusDevicePowerOffEx -#define MSNdis_StatusDevicePowerOffExGuid \ - { 0x4159353c,0x5cd7,0x42ce, { 0x8f,0xe4,0xa4,0x5a,0x23,0x80,0xcc,0x4f } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDevicePowerOffEx_GUID, \ - 0x4159353c,0x5cd7,0x42ce,0x8f,0xe4,0xa4,0x5a,0x23,0x80,0xcc,0x4f); -#endif - - -typedef struct _MSNdis_StatusDevicePowerOffEx -{ - // - CHAR VariableData[1]; - #define MSNdis_StatusDevicePowerOffEx_Device_ID 1 - -} MSNdis_StatusDevicePowerOffEx, *PMSNdis_StatusDevicePowerOffEx; - -// MSNdis_StatusTaskOffloadChange - MSNdis_StatusTaskOffloadChange -#define MSNdis_StatusTaskOffloadChangeGuid \ - { 0x45049fc6,0x54d8,0x40c8, { 0x9c,0x3d,0xb0,0x11,0xc4,0xe7,0x15,0xbc } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusTaskOffloadChange_GUID, \ - 0x45049fc6,0x54d8,0x40c8,0x9c,0x3d,0xb0,0x11,0xc4,0xe7,0x15,0xbc); -#endif - - -typedef struct _MSNdis_StatusTaskOffloadChange -{ - // - ULONG NumberElements; - #define MSNdis_StatusTaskOffloadChange_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusTaskOffloadChange_NumberElements_ID 1 - - // - UCHAR TaskOffloadCapabilities[1]; - #define MSNdis_StatusTaskOffloadChange_TaskOffloadCapabilities_ID 2 - -} MSNdis_StatusTaskOffloadChange, *PMSNdis_StatusTaskOffloadChange; - -// MSNdis_StatusPacketFilterChange - MSNdis_StatusPacketFilterChange -#define MSNdis_StatusPacketFilterChangeGuid \ - { 0xd47c5407,0x2e75,0x46dd, { 0x81,0x46,0x1d,0x7e,0xd2,0xd6,0xab,0x1d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusPacketFilterChange_GUID, \ - 0xd47c5407,0x2e75,0x46dd,0x81,0x46,0x1d,0x7e,0xd2,0xd6,0xab,0x1d); -#endif - - -typedef struct _MSNdis_StatusPacketFilterChange -{ - // - ULONG NumberElements; - #define MSNdis_StatusPacketFilterChange_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusPacketFilterChange_NumberElements_ID 1 - - // - UCHAR NdisPacketFilterStatusIndication[1]; - #define MSNdis_StatusPacketFilterChange_NdisPacketFilterStatusIndication_ID 2 - -} MSNdis_StatusPacketFilterChange, *PMSNdis_StatusPacketFilterChange; - -// MSNdis_StatusNetworkChange - MSNdis_StatusNetworkChange -#define MSNdis_StatusNetworkChangeGuid \ - { 0xca8a56f9,0xce81,0x40e6, { 0xa7,0x0f,0xa0,0x67,0xa4,0x76,0xe9,0xe9 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusNetworkChange_GUID, \ - 0xca8a56f9,0xce81,0x40e6,0xa7,0x0f,0xa0,0x67,0xa4,0x76,0xe9,0xe9); -#endif - - -typedef struct _MSNdis_StatusNetworkChange -{ - // - ULONG NumberElements; - #define MSNdis_StatusNetworkChange_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusNetworkChange_NumberElements_ID 1 - - // - UCHAR NdisNetworkChangeStatusIndication[1]; - #define MSNdis_StatusNetworkChange_NdisNetworkChangeStatusIndication_ID 2 - -} MSNdis_StatusNetworkChange, *PMSNdis_StatusNetworkChange; - -// MSNdis_StatusOperationalStatus - MSNdis_StatusOperationalStatus -#define MSNdis_StatusOperationalStatusGuid \ - { 0xf917b663,0x845e,0x4d3d, { 0xb6,0xd4,0x15,0xeb,0x27,0xaf,0x81,0xc5 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusOperationalStatus_GUID, \ - 0xf917b663,0x845e,0x4d3d,0xb6,0xd4,0x15,0xeb,0x27,0xaf,0x81,0xc5); -#endif - - -typedef struct _MSNdis_StatusOperationalStatus -{ - // - ULONG NumberElements; - #define MSNdis_StatusOperationalStatus_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusOperationalStatus_NumberElements_ID 1 - - // - UCHAR NdisOperationalStatusStatusIndication[1]; - #define MSNdis_StatusOperationalStatus_NdisOperationalStatusStatusIndication_ID 2 - -} MSNdis_StatusOperationalStatus, *PMSNdis_StatusOperationalStatus; - -// MSNdis_StatusLinkState - MSNdis_StatusLinkState -#define MSNdis_StatusLinkStateGuid \ - { 0x64c6f797,0x878c,0x4311, { 0x92,0x46,0x65,0xdb,0xa8,0x9c,0x3a,0x61 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusLinkState_GUID, \ - 0x64c6f797,0x878c,0x4311,0x92,0x46,0x65,0xdb,0xa8,0x9c,0x3a,0x61); -#endif - - -typedef struct _MSNdis_StatusLinkState -{ - // - ULONG NumberElements; - #define MSNdis_StatusLinkState_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusLinkState_NumberElements_ID 1 - - // - UCHAR NdisLinkStateStatusIndication[1]; - #define MSNdis_StatusLinkState_NdisLinkStateStatusIndication_ID 2 - -} MSNdis_StatusLinkState, *PMSNdis_StatusLinkState; - -// MSNdis_StatusPortState - MSNdis_StatusPortState -#define MSNdis_StatusPortStateGuid \ - { 0x1dac0dfe,0x43e5,0x44b7, { 0xb7,0x59,0x7b,0xf4,0x6d,0xe3,0x2e,0x81 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusPortState_GUID, \ - 0x1dac0dfe,0x43e5,0x44b7,0xb7,0x59,0x7b,0xf4,0x6d,0xe3,0x2e,0x81); -#endif - - -typedef struct _MSNdis_StatusPortState -{ - // - ULONG NumberElements; - #define MSNdis_StatusPortState_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusPortState_NumberElements_ID 1 - - // - UCHAR NdisPortStateStatusIndication[1]; - #define MSNdis_StatusPortState_NdisPortStateStatusIndication_ID 2 - -} MSNdis_StatusPortState, *PMSNdis_StatusPortState; - -// MSNdis_StatusMediaSpecificIndicationEx - MSNdis_StatusMediaSpecificIndicationEx -#define MSNdis_StatusMediaSpecificIndicationExGuid \ - { 0xaaacfca7,0x954a,0x4632, { 0xa1,0x6e,0xa8,0xa6,0x37,0x93,0xa9,0xe5 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusMediaSpecificIndicationEx_GUID, \ - 0xaaacfca7,0x954a,0x4632,0xa1,0x6e,0xa8,0xa6,0x37,0x93,0xa9,0xe5); -#endif - - -typedef struct _MSNdis_StatusMediaSpecificIndicationEx -{ - // - ULONG NumberElements; - #define MSNdis_StatusMediaSpecificIndicationEx_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusMediaSpecificIndicationEx_NumberElements_ID 1 - - // - UCHAR NdisStatusMediaSpecificIndication[1]; - #define MSNdis_StatusMediaSpecificIndicationEx_NdisStatusMediaSpecificIndication_ID 2 - -} MSNdis_StatusMediaSpecificIndicationEx, *PMSNdis_StatusMediaSpecificIndicationEx; - -// MSNdis_StatusHDSplitCurrentConfig - MSNdis_StatusHDSplitCurrentConfig -#define MSNdis_StatusHDSplitCurrentConfigGuid \ - { 0x6c744b0e,0xee9c,0x4205, { 0x90,0xa2,0x01,0x5f,0x6d,0x65,0xf4,0x03 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusHDSplitCurrentConfig_GUID, \ - 0x6c744b0e,0xee9c,0x4205,0x90,0xa2,0x01,0x5f,0x6d,0x65,0xf4,0x03); -#endif - - -typedef struct _MSNdis_StatusHDSplitCurrentConfig -{ - // - ULONG NumberElements; - #define MSNdis_StatusHDSplitCurrentConfig_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusHDSplitCurrentConfig_NumberElements_ID 1 - - // - UCHAR HDSplitCurrentConfig[1]; - #define MSNdis_StatusHDSplitCurrentConfig_HDSplitCurrentConfig_ID 2 - -} MSNdis_StatusHDSplitCurrentConfig, *PMSNdis_StatusHDSplitCurrentConfig; - -// MSNdis_StatusDot11ScanConfirm - MSNdis_StatusDot11ScanConfirm -#define MSNdis_StatusDot11ScanConfirmGuid \ - { 0x8500591e,0xa0c7,0x4efb, { 0x93,0x42,0xb6,0x74,0xb0,0x02,0xcb,0xe6 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11ScanConfirm_GUID, \ - 0x8500591e,0xa0c7,0x4efb,0x93,0x42,0xb6,0x74,0xb0,0x02,0xcb,0xe6); -#endif - - -typedef struct _MSNdis_StatusDot11ScanConfirm -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11ScanConfirm_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11ScanConfirm_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11ScanConfirmIndication[1]; - #define MSNdis_StatusDot11ScanConfirm_NdisStatusDot11ScanConfirmIndication_ID 2 - -} MSNdis_StatusDot11ScanConfirm, *PMSNdis_StatusDot11ScanConfirm; - -// MSNdis_StatusDot11MPDUMaxLengthChange - MSNdis_StatusDot11MPDUMaxLengthChange -#define MSNdis_StatusDot11MPDUMaxLengthChangeGuid \ - { 0x1d6560ec,0x8e48,0x4a3e, { 0x9f,0xd5,0xa0,0x1b,0x69,0x8d,0xb6,0xc5 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11MPDUMaxLengthChange_GUID, \ - 0x1d6560ec,0x8e48,0x4a3e,0x9f,0xd5,0xa0,0x1b,0x69,0x8d,0xb6,0xc5); -#endif - - -typedef struct _MSNdis_StatusDot11MPDUMaxLengthChange -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11MPDUMaxLengthChange_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11MPDUMaxLengthChange_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11MPDUMaxLengthChangeIndication[1]; - #define MSNdis_StatusDot11MPDUMaxLengthChange_NdisStatusDot11MPDUMaxLengthChangeIndication_ID 2 - -} MSNdis_StatusDot11MPDUMaxLengthChange, *PMSNdis_StatusDot11MPDUMaxLengthChange; - -// MSNdis_StatusDot11AssociationStart - MSNdis_StatusDot11AssociationStart -#define MSNdis_StatusDot11AssociationStartGuid \ - { 0x3927843b,0x6980,0x4b48, { 0xb1,0x5b,0x4d,0xe5,0x09,0x77,0xac,0x40 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11AssociationStart_GUID, \ - 0x3927843b,0x6980,0x4b48,0xb1,0x5b,0x4d,0xe5,0x09,0x77,0xac,0x40); -#endif - - -typedef struct _MSNdis_StatusDot11AssociationStart -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11AssociationStart_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11AssociationStart_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11AssociationStartIndication[1]; - #define MSNdis_StatusDot11AssociationStart_NdisStatusDot11AssociationStartIndication_ID 2 - -} MSNdis_StatusDot11AssociationStart, *PMSNdis_StatusDot11AssociationStart; - -// MSNdis_StatusDot11AssociationCompletion - MSNdis_StatusDot11AssociationCompletion -#define MSNdis_StatusDot11AssociationCompletionGuid \ - { 0x458bbea7,0x45a4,0x4ae2, { 0xb1,0x76,0xe5,0x1f,0x96,0xfc,0x05,0x68 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11AssociationCompletion_GUID, \ - 0x458bbea7,0x45a4,0x4ae2,0xb1,0x76,0xe5,0x1f,0x96,0xfc,0x05,0x68); -#endif - - -typedef struct _MSNdis_StatusDot11AssociationCompletion -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11AssociationCompletion_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11AssociationCompletion_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11AssociationCompletionIndication[1]; - #define MSNdis_StatusDot11AssociationCompletion_NdisStatusDot11AssociationCompletionIndication_ID 2 - -} MSNdis_StatusDot11AssociationCompletion, *PMSNdis_StatusDot11AssociationCompletion; - -// MSNdis_StatusDot11ConnectionStart - MSNdis_StatusDot11ConnectionStart -#define MSNdis_StatusDot11ConnectionStartGuid \ - { 0x7b74299d,0x998f,0x4454, { 0xad,0x08,0xc5,0xaf,0x28,0x57,0x6d,0x1b } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11ConnectionStart_GUID, \ - 0x7b74299d,0x998f,0x4454,0xad,0x08,0xc5,0xaf,0x28,0x57,0x6d,0x1b); -#endif - - -typedef struct _MSNdis_StatusDot11ConnectionStart -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11ConnectionStart_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11ConnectionStart_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11ConnectionStartIndication[1]; - #define MSNdis_StatusDot11ConnectionStart_NdisStatusDot11ConnectionStartIndication_ID 2 - -} MSNdis_StatusDot11ConnectionStart, *PMSNdis_StatusDot11ConnectionStart; - -// MSNdis_StatusDot11ConnectionCompletion - MSNdis_StatusDot11ConnectionCompletion -#define MSNdis_StatusDot11ConnectionCompletionGuid \ - { 0x96efd9c9,0x7f1b,0x4a89, { 0xbc,0x04,0x3e,0x9e,0x27,0x17,0x65,0xf1 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11ConnectionCompletion_GUID, \ - 0x96efd9c9,0x7f1b,0x4a89,0xbc,0x04,0x3e,0x9e,0x27,0x17,0x65,0xf1); -#endif - - -typedef struct _MSNdis_StatusDot11ConnectionCompletion -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11ConnectionCompletion_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11ConnectionCompletion_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11ConnectionCompletionIndication[1]; - #define MSNdis_StatusDot11ConnectionCompletion_NdisStatusDot11ConnectionCompletionIndication_ID 2 - -} MSNdis_StatusDot11ConnectionCompletion, *PMSNdis_StatusDot11ConnectionCompletion; - -// MSNdis_StatusDot11RoamingStart - MSNdis_StatusDot11RoamingStart -#define MSNdis_StatusDot11RoamingStartGuid \ - { 0xb2412d0d,0x26c8,0x4f4e, { 0x93,0xdf,0xf7,0xb7,0x05,0xa0,0xb4,0x33 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11RoamingStart_GUID, \ - 0xb2412d0d,0x26c8,0x4f4e,0x93,0xdf,0xf7,0xb7,0x05,0xa0,0xb4,0x33); -#endif - - -typedef struct _MSNdis_StatusDot11RoamingStart -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11RoamingStart_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11RoamingStart_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11RoamingStartIndication[1]; - #define MSNdis_StatusDot11RoamingStart_NdisStatusDot11RoamingStartIndication_ID 2 - -} MSNdis_StatusDot11RoamingStart, *PMSNdis_StatusDot11RoamingStart; - -// MSNdis_StatusDot11RoamingCompletion - MSNdis_StatusDot11RoamingCompletion -#define MSNdis_StatusDot11RoamingCompletionGuid \ - { 0xdd9d47d1,0x282b,0x41e4, { 0xb9,0x24,0x66,0x36,0x88,0x17,0xfc,0xd3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11RoamingCompletion_GUID, \ - 0xdd9d47d1,0x282b,0x41e4,0xb9,0x24,0x66,0x36,0x88,0x17,0xfc,0xd3); -#endif - - -typedef struct _MSNdis_StatusDot11RoamingCompletion -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11RoamingCompletion_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11RoamingCompletion_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11RoamingCompletionIndication[1]; - #define MSNdis_StatusDot11RoamingCompletion_NdisStatusDot11RoamingCompletionIndication_ID 2 - -} MSNdis_StatusDot11RoamingCompletion, *PMSNdis_StatusDot11RoamingCompletion; - -// MSNdis_StatusDot11Disassociation - MSNdis_StatusDot11Disassociation -#define MSNdis_StatusDot11DisassociationGuid \ - { 0x3fbeb6fc,0x0fe2,0x43fd, { 0xb2,0xad,0xbd,0x99,0xb5,0xf9,0x3e,0x13 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11Disassociation_GUID, \ - 0x3fbeb6fc,0x0fe2,0x43fd,0xb2,0xad,0xbd,0x99,0xb5,0xf9,0x3e,0x13); -#endif - - -typedef struct _MSNdis_StatusDot11Disassociation -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11Disassociation_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11Disassociation_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11DisassociationIndication[1]; - #define MSNdis_StatusDot11Disassociation_NdisStatusDot11DisassociationIndication_ID 2 - -} MSNdis_StatusDot11Disassociation, *PMSNdis_StatusDot11Disassociation; - -// MSNdis_StatusDot11TkipmicFailure - MSNdis_StatusDot11TkipmicFailure -#define MSNdis_StatusDot11TkipmicFailureGuid \ - { 0x442c2ae4,0x9bc5,0x4b90, { 0xa8,0x89,0x45,0x5e,0xf2,0x20,0xf4,0xee } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11TkipmicFailure_GUID, \ - 0x442c2ae4,0x9bc5,0x4b90,0xa8,0x89,0x45,0x5e,0xf2,0x20,0xf4,0xee); -#endif - - -typedef struct _MSNdis_StatusDot11TkipmicFailure -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11TkipmicFailure_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11TkipmicFailure_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11TkipmicFailureIndication[1]; - #define MSNdis_StatusDot11TkipmicFailure_NdisStatusDot11TkipmicFailureIndication_ID 2 - -} MSNdis_StatusDot11TkipmicFailure, *PMSNdis_StatusDot11TkipmicFailure; - -// MSNdis_StatusDot11PmkidCandidateList - MSNdis_StatusDot11PmkidCandidateList -#define MSNdis_StatusDot11PmkidCandidateListGuid \ - { 0x26d8b8f6,0xdb82,0x49eb, { 0x8b,0xf3,0x4c,0x13,0x0e,0xf0,0x69,0x50 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11PmkidCandidateList_GUID, \ - 0x26d8b8f6,0xdb82,0x49eb,0x8b,0xf3,0x4c,0x13,0x0e,0xf0,0x69,0x50); -#endif - - -typedef struct _MSNdis_StatusDot11PmkidCandidateList -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11PmkidCandidateList_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11PmkidCandidateList_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11PmkidCandidateListIndication[1]; - #define MSNdis_StatusDot11PmkidCandidateList_NdisStatusDot11PmkidCandidateListIndication_ID 2 - -} MSNdis_StatusDot11PmkidCandidateList, *PMSNdis_StatusDot11PmkidCandidateList; - -// MSNdis_StatusDot11PhyStateChange - MSNdis_StatusDot11PhyStateChange -#define MSNdis_StatusDot11PhyStateChangeGuid \ - { 0xdeb45316,0x71b5,0x4736, { 0xbd,0xef,0x0a,0x9e,0x9f,0x4e,0x62,0xdc } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11PhyStateChange_GUID, \ - 0xdeb45316,0x71b5,0x4736,0xbd,0xef,0x0a,0x9e,0x9f,0x4e,0x62,0xdc); -#endif - - -typedef struct _MSNdis_StatusDot11PhyStateChange -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11PhyStateChange_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11PhyStateChange_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11PhyStateChangeIndication[1]; - #define MSNdis_StatusDot11PhyStateChange_NdisStatusDot11PhyStateChangeIndication_ID 2 - -} MSNdis_StatusDot11PhyStateChange, *PMSNdis_StatusDot11PhyStateChange; - -// MSNdis_StatusDot11LinkQuality - MSNdis_StatusDot11LinkQuality -#define MSNdis_StatusDot11LinkQualityGuid \ - { 0xa3285184,0xea99,0x48ed, { 0x82,0x5e,0xa4,0x26,0xb1,0x1c,0x27,0x54 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSNdis_StatusDot11LinkQuality_GUID, \ - 0xa3285184,0xea99,0x48ed,0x82,0x5e,0xa4,0x26,0xb1,0x1c,0x27,0x54); -#endif - - -typedef struct _MSNdis_StatusDot11LinkQuality -{ - // - ULONG NumberElements; - #define MSNdis_StatusDot11LinkQuality_NumberElements_SIZE sizeof(ULONG) - #define MSNdis_StatusDot11LinkQuality_NumberElements_ID 1 - - // - UCHAR NdisStatusDot11LinkQualityIndication[1]; - #define MSNdis_StatusDot11LinkQuality_NdisStatusDot11LinkQualityIndication_ID 2 - -} MSNdis_StatusDot11LinkQuality, *PMSNdis_StatusDot11LinkQuality; - -// MSKeyboard_PortInformation - KEYBOARD_PORT_WMI_STD_DATA -#define KEYBOARD_PORT_WMI_STD_DATA_GUID \ - { 0x4731f89a,0x71cb,0x11d1, { 0xa5,0x2c,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSKeyboard_PortInformation_GUID, \ - 0x4731f89a,0x71cb,0x11d1,0xa5,0x2c,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _KEYBOARD_PORT_WMI_STD_DATA -{ - -#define KEYBOARD_PORT_WMI_STD_I8042 0 -#define KEYBOARD_PORT_WMI_STD_SERIAL 1 -#define KEYBOARD_PORT_WMI_STD_USB 2 - - // - ULONG ConnectorType; - #define KEYBOARD_PORT_WMI_STD_DATA_ConnectorType_SIZE sizeof(ULONG) - #define KEYBOARD_PORT_WMI_STD_DATA_ConnectorType_ID 1 - - // - ULONG DataQueueSize; - #define KEYBOARD_PORT_WMI_STD_DATA_DataQueueSize_SIZE sizeof(ULONG) - #define KEYBOARD_PORT_WMI_STD_DATA_DataQueueSize_ID 2 - - // - ULONG ErrorCount; - #define KEYBOARD_PORT_WMI_STD_DATA_ErrorCount_SIZE sizeof(ULONG) - #define KEYBOARD_PORT_WMI_STD_DATA_ErrorCount_ID 3 - - // - ULONG FunctionKeys; - #define KEYBOARD_PORT_WMI_STD_DATA_FunctionKeys_SIZE sizeof(ULONG) - #define KEYBOARD_PORT_WMI_STD_DATA_FunctionKeys_ID 4 - - // - ULONG Indicators; - #define KEYBOARD_PORT_WMI_STD_DATA_Indicators_SIZE sizeof(ULONG) - #define KEYBOARD_PORT_WMI_STD_DATA_Indicators_ID 5 - -} KEYBOARD_PORT_WMI_STD_DATA, *PKEYBOARD_PORT_WMI_STD_DATA; - -#define KEYBOARD_PORT_WMI_STD_DATA_SIZE (FIELD_OFFSET(KEYBOARD_PORT_WMI_STD_DATA, Indicators) + KEYBOARD_PORT_WMI_STD_DATA_Indicators_SIZE) - -// MSKeyboard_ExtendedID - KEYBOARD_ID_EX -#define KEYBOARD_PORT_WMI_EXTENDED_ID \ - { 0x6ac4e23d,0xa950,0x4518, { 0x8b,0x2b,0xaa,0x4d,0xcd,0x5f,0xe1,0x4a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSKeyboard_ExtendedID_GUID, \ - 0x6ac4e23d,0xa950,0x4518,0x8b,0x2b,0xaa,0x4d,0xcd,0x5f,0xe1,0x4a); -#endif - - -typedef struct _KEYBOARD_ID_EX -{ - // - ULONG Type; - #define KEYBOARD_ID_EX_Type_SIZE sizeof(ULONG) - #define KEYBOARD_ID_EX_Type_ID 1 - - // - ULONG Subtype; - #define KEYBOARD_ID_EX_Subtype_SIZE sizeof(ULONG) - #define KEYBOARD_ID_EX_Subtype_ID 2 - -} KEYBOARD_ID_EX, *PKEYBOARD_ID_EX; - -#define KEYBOARD_ID_EX_SIZE (FIELD_OFFSET(KEYBOARD_ID_EX, Subtype) + KEYBOARD_ID_EX_Subtype_SIZE) - -// MSMouse_PortInformation - POINTER_PORT_WMI_STD_DATA -#define POINTER_PORT_WMI_STD_DATA_GUID \ - { 0x4731f89c,0x71cb,0x11d1, { 0xa5,0x2c,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMouse_PortInformation_GUID, \ - 0x4731f89c,0x71cb,0x11d1,0xa5,0x2c,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _POINTER_PORT_WMI_STD_DATA -{ - -#define POINTER_PORT_WMI_STD_I8042 0 -#define POINTER_PORT_WMI_STD_SERIAL 1 -#define POINTER_PORT_WMI_STD_USB 2 - - // - ULONG ConnectorType; - #define POINTER_PORT_WMI_STD_DATA_ConnectorType_SIZE sizeof(ULONG) - #define POINTER_PORT_WMI_STD_DATA_ConnectorType_ID 1 - - // - ULONG DataQueueSize; - #define POINTER_PORT_WMI_STD_DATA_DataQueueSize_SIZE sizeof(ULONG) - #define POINTER_PORT_WMI_STD_DATA_DataQueueSize_ID 2 - - // - ULONG ErrorCount; - #define POINTER_PORT_WMI_STD_DATA_ErrorCount_SIZE sizeof(ULONG) - #define POINTER_PORT_WMI_STD_DATA_ErrorCount_ID 3 - - // - ULONG Buttons; - #define POINTER_PORT_WMI_STD_DATA_Buttons_SIZE sizeof(ULONG) - #define POINTER_PORT_WMI_STD_DATA_Buttons_ID 4 - - -#define POINTER_PORT_WMI_STD_MOUSE 0 -#define POINTER_PORT_WMI_STD_POINTER 1 -#define POINTER_PORT_WMI_ABSOLUTE_POINTER 2 -#define POINTER_PORT_WMI_TABLET 3 -#define POINTER_PORT_WMI_TOUCH_SCRENE 4 -#define POINTER_PORT_WMI_PEN 5 -#define POINTER_PORT_WMI_TRACK_BALL 6 -#define POINTER_PORT_WMI_OTHER 256 - - // - ULONG HardwareType; - #define POINTER_PORT_WMI_STD_DATA_HardwareType_SIZE sizeof(ULONG) - #define POINTER_PORT_WMI_STD_DATA_HardwareType_ID 5 - -} POINTER_PORT_WMI_STD_DATA, *PPOINTER_PORT_WMI_STD_DATA; - -#define POINTER_PORT_WMI_STD_DATA_SIZE (FIELD_OFFSET(POINTER_PORT_WMI_STD_DATA, HardwareType) + POINTER_PORT_WMI_STD_DATA_HardwareType_SIZE) - -// MSMouse_ClassInformation - MSMouse_ClassInformation -#define MSMouse_ClassInformationGuid \ - { 0x4731f89b,0x71cb,0x11d1, { 0xa5,0x2c,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSMouse_ClassInformation_GUID, \ - 0x4731f89b,0x71cb,0x11d1,0xa5,0x2c,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSMouse_ClassInformation -{ - // - ULONGLONG DeviceId; - #define MSMouse_ClassInformation_DeviceId_SIZE sizeof(ULONGLONG) - #define MSMouse_ClassInformation_DeviceId_ID 1 - -} MSMouse_ClassInformation, *PMSMouse_ClassInformation; - -#define MSMouse_ClassInformation_SIZE (FIELD_OFFSET(MSMouse_ClassInformation, DeviceId) + MSMouse_ClassInformation_DeviceId_SIZE) - -// MSKeyboard_ClassInformation - MSKeyboard_ClassInformation -#define MSKeyboard_ClassInformationGuid \ - { 0x4731f899,0x71cb,0x11d1, { 0xa5,0x2c,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSKeyboard_ClassInformation_GUID, \ - 0x4731f899,0x71cb,0x11d1,0xa5,0x2c,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSKeyboard_ClassInformation -{ - // - ULONGLONG DeviceId; - #define MSKeyboard_ClassInformation_DeviceId_SIZE sizeof(ULONGLONG) - #define MSKeyboard_ClassInformation_DeviceId_ID 1 - -} MSKeyboard_ClassInformation, *PMSKeyboard_ClassInformation; - -#define MSKeyboard_ClassInformation_SIZE (FIELD_OFFSET(MSKeyboard_ClassInformation, DeviceId) + MSKeyboard_ClassInformation_DeviceId_SIZE) - -// MSAgp_Information - AGP_STD_DATA -#define AGP_WMI_STD_DATA_GUID \ - { 0x8c27fbed,0x1c7b,0x47e4, { 0xa6,0x49,0x0e,0x38,0x9d,0x3a,0xda,0x4f } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSAgp_Information_GUID, \ - 0x8c27fbed,0x1c7b,0x47e4,0xa6,0x49,0x0e,0x38,0x9d,0x3a,0xda,0x4f); -#endif - - -typedef struct _AGP_STD_DATA -{ - // - ULONGLONG ApertureBase; - #define AGP_STD_DATA_ApertureBase_SIZE sizeof(ULONGLONG) - #define AGP_STD_DATA_ApertureBase_ID 1 - - // - ULONG ApertureLength; - #define AGP_STD_DATA_ApertureLength_SIZE sizeof(ULONG) - #define AGP_STD_DATA_ApertureLength_ID 2 - - // - ULONG AgpStatus; - #define AGP_STD_DATA_AgpStatus_SIZE sizeof(ULONG) - #define AGP_STD_DATA_AgpStatus_ID 3 - - // - ULONG AgpCommand; - #define AGP_STD_DATA_AgpCommand_SIZE sizeof(ULONG) - #define AGP_STD_DATA_AgpCommand_ID 4 - -} AGP_STD_DATA, *PAGP_STD_DATA; - -#define AGP_STD_DATA_SIZE (FIELD_OFFSET(AGP_STD_DATA, AgpCommand) + AGP_STD_DATA_AgpCommand_SIZE) - -// MSAcpi_ThermalZoneTemperature - MSAcpi_ThermalZoneTemperature -#define MSAcpi_ThermalZoneTemperatureGuid \ - { 0xa1bc18c0,0xa7c8,0x11d1, { 0xbf,0x3c,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSAcpi_ThermalZoneTemperature_GUID, \ - 0xa1bc18c0,0xa7c8,0x11d1,0xbf,0x3c,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSAcpi_ThermalZoneTemperature -{ - // - ULONG ThermalStamp; - #define MSAcpi_ThermalZoneTemperature_ThermalStamp_SIZE sizeof(ULONG) - #define MSAcpi_ThermalZoneTemperature_ThermalStamp_ID 1 - - // - ULONG ThermalConstant1; - #define MSAcpi_ThermalZoneTemperature_ThermalConstant1_SIZE sizeof(ULONG) - #define MSAcpi_ThermalZoneTemperature_ThermalConstant1_ID 2 - - // - ULONG ThermalConstant2; - #define MSAcpi_ThermalZoneTemperature_ThermalConstant2_SIZE sizeof(ULONG) - #define MSAcpi_ThermalZoneTemperature_ThermalConstant2_ID 3 - - // - ULONG Reserved; - #define MSAcpi_ThermalZoneTemperature_Reserved_SIZE sizeof(ULONG) - #define MSAcpi_ThermalZoneTemperature_Reserved_ID 4 - - // - ULONG SamplingPeriod; - #define MSAcpi_ThermalZoneTemperature_SamplingPeriod_SIZE sizeof(ULONG) - #define MSAcpi_ThermalZoneTemperature_SamplingPeriod_ID 5 - - // - ULONG CurrentTemperature; - #define MSAcpi_ThermalZoneTemperature_CurrentTemperature_SIZE sizeof(ULONG) - #define MSAcpi_ThermalZoneTemperature_CurrentTemperature_ID 6 - - // - ULONG PassiveTripPoint; - #define MSAcpi_ThermalZoneTemperature_PassiveTripPoint_SIZE sizeof(ULONG) - #define MSAcpi_ThermalZoneTemperature_PassiveTripPoint_ID 7 - - // - ULONG CriticalTripPoint; - #define MSAcpi_ThermalZoneTemperature_CriticalTripPoint_SIZE sizeof(ULONG) - #define MSAcpi_ThermalZoneTemperature_CriticalTripPoint_ID 8 - - // - ULONG ActiveTripPointCount; - #define MSAcpi_ThermalZoneTemperature_ActiveTripPointCount_SIZE sizeof(ULONG) - #define MSAcpi_ThermalZoneTemperature_ActiveTripPointCount_ID 9 - - // - ULONG ActiveTripPoint[10]; - #define MSAcpi_ThermalZoneTemperature_ActiveTripPoint_SIZE sizeof(ULONG[10]) - #define MSAcpi_ThermalZoneTemperature_ActiveTripPoint_ID 10 - -} MSAcpi_ThermalZoneTemperature, *PMSAcpi_ThermalZoneTemperature; - -#define MSAcpi_ThermalZoneTemperature_SIZE (FIELD_OFFSET(MSAcpi_ThermalZoneTemperature, ActiveTripPoint) + MSAcpi_ThermalZoneTemperature_ActiveTripPoint_SIZE) - -// MSDiskDriver_Geometry - WMI_DISK_GEOMETRY -#define MSDiskDriver_GeometryGuid \ - { 0x25007f51,0x57c2,0x11d1, { 0xa5,0x28,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSDiskDriver_Geometry_GUID, \ - 0x25007f51,0x57c2,0x11d1,0xa5,0x28,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _WMI_DISK_GEOMETRY -{ - // - LONGLONG Cylinders; - #define WMI_DISK_GEOMETRY_Cylinders_SIZE sizeof(LONGLONG) - #define WMI_DISK_GEOMETRY_Cylinders_ID 1 - - // - ULONG MediaType; - #define WMI_DISK_GEOMETRY_MediaType_SIZE sizeof(ULONG) - #define WMI_DISK_GEOMETRY_MediaType_ID 2 - - // - ULONG TracksPerCylinder; - #define WMI_DISK_GEOMETRY_TracksPerCylinder_SIZE sizeof(ULONG) - #define WMI_DISK_GEOMETRY_TracksPerCylinder_ID 3 - - // - ULONG SectorsPerTrack; - #define WMI_DISK_GEOMETRY_SectorsPerTrack_SIZE sizeof(ULONG) - #define WMI_DISK_GEOMETRY_SectorsPerTrack_ID 4 - - // - ULONG BytesPerSector; - #define WMI_DISK_GEOMETRY_BytesPerSector_SIZE sizeof(ULONG) - #define WMI_DISK_GEOMETRY_BytesPerSector_ID 5 - -} WMI_DISK_GEOMETRY, *PWMI_DISK_GEOMETRY; - -#define WMI_DISK_GEOMETRY_SIZE (FIELD_OFFSET(WMI_DISK_GEOMETRY, BytesPerSector) + WMI_DISK_GEOMETRY_BytesPerSector_SIZE) - -// MSDiskDriver_PerformanceData - WMI_DISK_PERFORMANCE -#define MSDiskDriver_PerformanceDataGuid \ - { 0xbdd865d2,0xd7c1,0x11d0, { 0xa5,0x01,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSDiskDriver_PerformanceData_GUID, \ - 0xbdd865d2,0xd7c1,0x11d0,0xa5,0x01,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _WMI_DISK_PERFORMANCE -{ - // - LONGLONG BytesRead; - #define WMI_DISK_PERFORMANCE_BytesRead_SIZE sizeof(LONGLONG) - #define WMI_DISK_PERFORMANCE_BytesRead_ID 1 - - // - LONGLONG BytesWritten; - #define WMI_DISK_PERFORMANCE_BytesWritten_SIZE sizeof(LONGLONG) - #define WMI_DISK_PERFORMANCE_BytesWritten_ID 2 - - // - LONGLONG ReadTime; - #define WMI_DISK_PERFORMANCE_ReadTime_SIZE sizeof(LONGLONG) - #define WMI_DISK_PERFORMANCE_ReadTime_ID 3 - - // - LONGLONG WriteTime; - #define WMI_DISK_PERFORMANCE_WriteTime_SIZE sizeof(LONGLONG) - #define WMI_DISK_PERFORMANCE_WriteTime_ID 4 - - // - LONGLONG IdleTime; - #define WMI_DISK_PERFORMANCE_IdleTime_SIZE sizeof(LONGLONG) - #define WMI_DISK_PERFORMANCE_IdleTime_ID 5 - - // - ULONG ReadCount; - #define WMI_DISK_PERFORMANCE_ReadCount_SIZE sizeof(ULONG) - #define WMI_DISK_PERFORMANCE_ReadCount_ID 6 - - // - ULONG WriteCount; - #define WMI_DISK_PERFORMANCE_WriteCount_SIZE sizeof(ULONG) - #define WMI_DISK_PERFORMANCE_WriteCount_ID 7 - - // - ULONG QueueDepth; - #define WMI_DISK_PERFORMANCE_QueueDepth_SIZE sizeof(ULONG) - #define WMI_DISK_PERFORMANCE_QueueDepth_ID 8 - - // - ULONG SplitCount; - #define WMI_DISK_PERFORMANCE_SplitCount_SIZE sizeof(ULONG) - #define WMI_DISK_PERFORMANCE_SplitCount_ID 9 - - // - LONGLONG QueryTime; - #define WMI_DISK_PERFORMANCE_QueryTime_SIZE sizeof(LONGLONG) - #define WMI_DISK_PERFORMANCE_QueryTime_ID 10 - - // - ULONG StorageDeviceNumber; - #define WMI_DISK_PERFORMANCE_StorageDeviceNumber_SIZE sizeof(ULONG) - #define WMI_DISK_PERFORMANCE_StorageDeviceNumber_ID 11 - - // - USHORT StorageManagerName[8]; - #define WMI_DISK_PERFORMANCE_StorageManagerName_SIZE sizeof(USHORT[8]) - #define WMI_DISK_PERFORMANCE_StorageManagerName_ID 12 - -} WMI_DISK_PERFORMANCE, *PWMI_DISK_PERFORMANCE; - -#define WMI_DISK_PERFORMANCE_SIZE (FIELD_OFFSET(WMI_DISK_PERFORMANCE, StorageManagerName) + WMI_DISK_PERFORMANCE_StorageManagerName_SIZE) - -// MSDiskDriver_Performance - MSDiskDriver_Performance -#define MSDiskDriver_PerformanceGuid \ - { 0xbdd865d1,0xd7c1,0x11d0, { 0xa5,0x01,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSDiskDriver_Performance_GUID, \ - 0xbdd865d1,0xd7c1,0x11d0,0xa5,0x01,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _MSDiskDriver_Performance -{ - // - WMI_DISK_PERFORMANCE PerfData; - #define MSDiskDriver_Performance_PerfData_SIZE sizeof(WMI_DISK_PERFORMANCE) - #define MSDiskDriver_Performance_PerfData_ID 1 - - // - CHAR VariableData[1]; - #define MSDiskDriver_Performance_DeviceName_ID 2 - -} MSDiskDriver_Performance, *PMSDiskDriver_Performance; - -// MSStorageDriver_FailurePredictStatus - STORAGE_FAILURE_PREDICT_STATUS -#define WMI_STORAGE_FAILURE_PREDICT_STATUS_GUID \ - { 0x78ebc102,0x4cf9,0x11d2, { 0xba,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSStorageDriver_FailurePredictStatus_GUID, \ - 0x78ebc102,0x4cf9,0x11d2,0xba,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _STORAGE_FAILURE_PREDICT_STATUS -{ - // - ULONG Reason; - #define STORAGE_FAILURE_PREDICT_STATUS_Reason_SIZE sizeof(ULONG) - #define STORAGE_FAILURE_PREDICT_STATUS_Reason_ID 1 - - // - BOOLEAN PredictFailure; - #define STORAGE_FAILURE_PREDICT_STATUS_PredictFailure_SIZE sizeof(BOOLEAN) - #define STORAGE_FAILURE_PREDICT_STATUS_PredictFailure_ID 2 - -} STORAGE_FAILURE_PREDICT_STATUS, *PSTORAGE_FAILURE_PREDICT_STATUS; - -#define STORAGE_FAILURE_PREDICT_STATUS_SIZE (FIELD_OFFSET(STORAGE_FAILURE_PREDICT_STATUS, PredictFailure) + STORAGE_FAILURE_PREDICT_STATUS_PredictFailure_SIZE) - -// MSStorageDriver_FailurePredictData - STORAGE_FAILURE_PREDICT_DATA -#define WMI_STORAGE_FAILURE_PREDICT_DATA_GUID \ - { 0x78ebc103,0x4cf9,0x11d2, { 0xba,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSStorageDriver_FailurePredictData_GUID, \ - 0x78ebc103,0x4cf9,0x11d2,0xba,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _STORAGE_FAILURE_PREDICT_DATA -{ - // - ULONG Length; - #define STORAGE_FAILURE_PREDICT_DATA_Length_SIZE sizeof(ULONG) - #define STORAGE_FAILURE_PREDICT_DATA_Length_ID 1 - - // - UCHAR VendorSpecific[512]; - #define STORAGE_FAILURE_PREDICT_DATA_VendorSpecific_SIZE sizeof(UCHAR[512]) - #define STORAGE_FAILURE_PREDICT_DATA_VendorSpecific_ID 2 - -} STORAGE_FAILURE_PREDICT_DATA, *PSTORAGE_FAILURE_PREDICT_DATA; - -#define STORAGE_FAILURE_PREDICT_DATA_SIZE (FIELD_OFFSET(STORAGE_FAILURE_PREDICT_DATA, VendorSpecific) + STORAGE_FAILURE_PREDICT_DATA_VendorSpecific_SIZE) - -// MSStorageDriver_ATAPISmartData - ATAPI_FAILURE_PREDICT_DATA -#define WMI_ATAPI_FAILURE_PREDICT_DATA_GUID \ - { 0x78ebc103,0x4cf9,0x11d2, { 0xba,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSStorageDriver_ATAPISmartData_GUID, \ - 0x78ebc103,0x4cf9,0x11d2,0xba,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _ATAPI_FAILURE_PREDICT_DATA -{ - // - ULONG Length; - #define ATAPI_FAILURE_PREDICT_DATA_Length_SIZE sizeof(ULONG) - #define ATAPI_FAILURE_PREDICT_DATA_Length_ID 1 - - // - UCHAR VendorSpecific[362]; - #define ATAPI_FAILURE_PREDICT_DATA_VendorSpecific_SIZE sizeof(UCHAR[362]) - #define ATAPI_FAILURE_PREDICT_DATA_VendorSpecific_ID 2 - - // - UCHAR OfflineCollectionStatus; - #define ATAPI_FAILURE_PREDICT_DATA_OfflineCollectionStatus_SIZE sizeof(UCHAR) - #define ATAPI_FAILURE_PREDICT_DATA_OfflineCollectionStatus_ID 3 - - // - UCHAR SelfTestStatus; - #define ATAPI_FAILURE_PREDICT_DATA_SelfTestStatus_SIZE sizeof(UCHAR) - #define ATAPI_FAILURE_PREDICT_DATA_SelfTestStatus_ID 4 - - // - USHORT TotalTime; - #define ATAPI_FAILURE_PREDICT_DATA_TotalTime_SIZE sizeof(USHORT) - #define ATAPI_FAILURE_PREDICT_DATA_TotalTime_ID 5 - - // - UCHAR VendorSpecific2; - #define ATAPI_FAILURE_PREDICT_DATA_VendorSpecific2_SIZE sizeof(UCHAR) - #define ATAPI_FAILURE_PREDICT_DATA_VendorSpecific2_ID 6 - - // - UCHAR OfflineCollectCapability; - #define ATAPI_FAILURE_PREDICT_DATA_OfflineCollectCapability_SIZE sizeof(UCHAR) - #define ATAPI_FAILURE_PREDICT_DATA_OfflineCollectCapability_ID 7 - - // - USHORT SmartCapability; - #define ATAPI_FAILURE_PREDICT_DATA_SmartCapability_SIZE sizeof(USHORT) - #define ATAPI_FAILURE_PREDICT_DATA_SmartCapability_ID 8 - - // - UCHAR ErrorLogCapability; - #define ATAPI_FAILURE_PREDICT_DATA_ErrorLogCapability_SIZE sizeof(UCHAR) - #define ATAPI_FAILURE_PREDICT_DATA_ErrorLogCapability_ID 9 - - // - UCHAR VendorSpecific3; - #define ATAPI_FAILURE_PREDICT_DATA_VendorSpecific3_SIZE sizeof(UCHAR) - #define ATAPI_FAILURE_PREDICT_DATA_VendorSpecific3_ID 10 - - // - UCHAR ShortPollTimeInMinutes; - #define ATAPI_FAILURE_PREDICT_DATA_ShortPollTimeInMinutes_SIZE sizeof(UCHAR) - #define ATAPI_FAILURE_PREDICT_DATA_ShortPollTimeInMinutes_ID 11 - - // - UCHAR ExtendedPollTimeInMinutes; - #define ATAPI_FAILURE_PREDICT_DATA_ExtendedPollTimeInMinutes_SIZE sizeof(UCHAR) - #define ATAPI_FAILURE_PREDICT_DATA_ExtendedPollTimeInMinutes_ID 12 - - // Reserved - UCHAR Reserved[12]; - #define ATAPI_FAILURE_PREDICT_DATA_Reserved_SIZE sizeof(UCHAR[12]) - #define ATAPI_FAILURE_PREDICT_DATA_Reserved_ID 13 - - // - UCHAR VendorSpecific4[125]; - #define ATAPI_FAILURE_PREDICT_DATA_VendorSpecific4_SIZE sizeof(UCHAR[125]) - #define ATAPI_FAILURE_PREDICT_DATA_VendorSpecific4_ID 14 - - // - UCHAR Checksum; - #define ATAPI_FAILURE_PREDICT_DATA_Checksum_SIZE sizeof(UCHAR) - #define ATAPI_FAILURE_PREDICT_DATA_Checksum_ID 15 - -} ATAPI_FAILURE_PREDICT_DATA, *PATAPI_FAILURE_PREDICT_DATA; - -#define ATAPI_FAILURE_PREDICT_DATA_SIZE (FIELD_OFFSET(ATAPI_FAILURE_PREDICT_DATA, Checksum) + ATAPI_FAILURE_PREDICT_DATA_Checksum_SIZE) - -// MSStorageDriver_FailurePredictThresholds - STORAGE_FAILURE_PREDICT_THRESHOLDS -#define WMI_STORAGE_FAILURE_PREDICT_THRESHOLDS_GUID \ - { 0xdae10783,0xcc31,0x4d2a, { 0x8a,0x0f,0x86,0x1c,0x04,0x07,0x7a,0x95 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSStorageDriver_FailurePredictThresholds_GUID, \ - 0xdae10783,0xcc31,0x4d2a,0x8a,0x0f,0x86,0x1c,0x04,0x07,0x7a,0x95); -#endif - - -typedef struct _STORAGE_FAILURE_PREDICT_THRESHOLDS -{ - // - UCHAR VendorSpecific[512]; - #define STORAGE_FAILURE_PREDICT_THRESHOLDS_VendorSpecific_SIZE sizeof(UCHAR[512]) - #define STORAGE_FAILURE_PREDICT_THRESHOLDS_VendorSpecific_ID 1 - -} STORAGE_FAILURE_PREDICT_THRESHOLDS, *PSTORAGE_FAILURE_PREDICT_THRESHOLDS; - -#define STORAGE_FAILURE_PREDICT_THRESHOLDS_SIZE (FIELD_OFFSET(STORAGE_FAILURE_PREDICT_THRESHOLDS, VendorSpecific) + STORAGE_FAILURE_PREDICT_THRESHOLDS_VendorSpecific_SIZE) - -// MSStorageDriver_FailurePredictEvent - STORAGE_FAILURE_PREDICT_EVENT -#define WMI_STORAGE_PREDICT_FAILURE_EVENT_GUID \ - { 0x78ebc104,0x4cf9,0x11d2, { 0xba,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSStorageDriver_FailurePredictEvent_GUID, \ - 0x78ebc104,0x4cf9,0x11d2,0xba,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _STORAGE_FAILURE_PREDICT_EVENT -{ - // - ULONG Length; - #define STORAGE_FAILURE_PREDICT_EVENT_Length_SIZE sizeof(ULONG) - #define STORAGE_FAILURE_PREDICT_EVENT_Length_ID 1 - - // - UCHAR VendorSpecific[1]; - #define STORAGE_FAILURE_PREDICT_EVENT_VendorSpecific_ID 2 - -} STORAGE_FAILURE_PREDICT_EVENT, *PSTORAGE_FAILURE_PREDICT_EVENT; - -// MSStorageDriver_FailurePredictFunction - STORAGE_FAILURE_PREDICT_FUNCTION -#define WMI_STORAGE_FAILURE_PREDICT_FUNCTION_GUID \ - { 0x78ebc105,0x4cf9,0x11d2, { 0xba,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSStorageDriver_FailurePredictFunction_GUID, \ - 0x78ebc105,0x4cf9,0x11d2,0xba,0x4a,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - -// -// Method id definitions for MSStorageDriver_FailurePredictFunction -#define AllowPerformanceHit 1 -typedef struct _ALLOW_PERFORMANCE_HIT_IN -{ - // - BOOLEAN Allow; - #define ALLOW_PERFORMANCE_HIT_IN_Allow_SIZE sizeof(BOOLEAN) - #define ALLOW_PERFORMANCE_HIT_IN_Allow_ID 1 - -} ALLOW_PERFORMANCE_HIT_IN, *PALLOW_PERFORMANCE_HIT_IN; - -#define ALLOW_PERFORMANCE_HIT_IN_SIZE (FIELD_OFFSET(ALLOW_PERFORMANCE_HIT_IN, Allow) + ALLOW_PERFORMANCE_HIT_IN_Allow_SIZE) - -#define EnableDisableHardwareFailurePrediction 2 -typedef struct _ENABLE_DISABLE_FP_IN -{ - // - BOOLEAN Enable; - #define ENABLE_DISABLE_FP_IN_Enable_SIZE sizeof(BOOLEAN) - #define ENABLE_DISABLE_FP_IN_Enable_ID 1 - -} ENABLE_DISABLE_FP_IN, *PENABLE_DISABLE_FP_IN; - -#define ENABLE_DISABLE_FP_IN_SIZE (FIELD_OFFSET(ENABLE_DISABLE_FP_IN, Enable) + ENABLE_DISABLE_FP_IN_Enable_SIZE) - -#define EnableDisableFailurePredictionPolling 3 -typedef struct _ENABLE_DISABLE_FP_POLLING_IN -{ - // - ULONG Period; - #define ENABLE_DISABLE_FP_POLLING_IN_Period_SIZE sizeof(ULONG) - #define ENABLE_DISABLE_FP_POLLING_IN_Period_ID 1 - - // - BOOLEAN Enable; - #define ENABLE_DISABLE_FP_POLLING_IN_Enable_SIZE sizeof(BOOLEAN) - #define ENABLE_DISABLE_FP_POLLING_IN_Enable_ID 2 - -} ENABLE_DISABLE_FP_POLLING_IN, *PENABLE_DISABLE_FP_POLLING_IN; - -#define ENABLE_DISABLE_FP_POLLING_IN_SIZE (FIELD_OFFSET(ENABLE_DISABLE_FP_POLLING_IN, Enable) + ENABLE_DISABLE_FP_POLLING_IN_Enable_SIZE) - -#define GetFailurePredictionCapability 4 -typedef struct _GET_FP_CAPABILITY_OUT -{ - // - ULONG Capability; - #define GET_FP_CAPABILITY_OUT_Capability_SIZE sizeof(ULONG) - #define GET_FP_CAPABILITY_OUT_Capability_ID 1 - -} GET_FP_CAPABILITY_OUT, *PGET_FP_CAPABILITY_OUT; - -#define GET_FP_CAPABILITY_OUT_SIZE (FIELD_OFFSET(GET_FP_CAPABILITY_OUT, Capability) + GET_FP_CAPABILITY_OUT_Capability_SIZE) - -#define EnableOfflineDiags 5 -typedef struct _ENABLE_OFFLINE_DIAGS_OUT -{ - // - BOOLEAN Success; - #define ENABLE_OFFLINE_DIAGS_OUT_Success_SIZE sizeof(BOOLEAN) - #define ENABLE_OFFLINE_DIAGS_OUT_Success_ID 1 - -} ENABLE_OFFLINE_DIAGS_OUT, *PENABLE_OFFLINE_DIAGS_OUT; - -#define ENABLE_OFFLINE_DIAGS_OUT_SIZE (FIELD_OFFSET(ENABLE_OFFLINE_DIAGS_OUT, Success) + ENABLE_OFFLINE_DIAGS_OUT_Success_SIZE) - -#define ReadLogSectors 6 -typedef struct _READ_LOG_SECTORS_IN -{ - // - UCHAR LogAddress; - #define READ_LOG_SECTORS_IN_LogAddress_SIZE sizeof(UCHAR) - #define READ_LOG_SECTORS_IN_LogAddress_ID 1 - - // - UCHAR SectorCount; - #define READ_LOG_SECTORS_IN_SectorCount_SIZE sizeof(UCHAR) - #define READ_LOG_SECTORS_IN_SectorCount_ID 2 - -} READ_LOG_SECTORS_IN, *PREAD_LOG_SECTORS_IN; - -#define READ_LOG_SECTORS_IN_SIZE (FIELD_OFFSET(READ_LOG_SECTORS_IN, SectorCount) + READ_LOG_SECTORS_IN_SectorCount_SIZE) - -typedef struct _READ_LOG_SECTORS_OUT -{ - // - ULONG Length; - #define READ_LOG_SECTORS_OUT_Length_SIZE sizeof(ULONG) - #define READ_LOG_SECTORS_OUT_Length_ID 3 - - // - UCHAR LogSectors[1]; - #define READ_LOG_SECTORS_OUT_LogSectors_ID 4 - -} READ_LOG_SECTORS_OUT, *PREAD_LOG_SECTORS_OUT; - -#define WriteLogSectors 7 -typedef struct _WRITE_LOG_SECTORS_IN -{ - // - UCHAR LogAddress; - #define WRITE_LOG_SECTORS_IN_LogAddress_SIZE sizeof(UCHAR) - #define WRITE_LOG_SECTORS_IN_LogAddress_ID 1 - - // - UCHAR SectorCount; - #define WRITE_LOG_SECTORS_IN_SectorCount_SIZE sizeof(UCHAR) - #define WRITE_LOG_SECTORS_IN_SectorCount_ID 2 - - // - ULONG Length; - #define WRITE_LOG_SECTORS_IN_Length_SIZE sizeof(ULONG) - #define WRITE_LOG_SECTORS_IN_Length_ID 3 - - // - UCHAR LogSectors[1]; - #define WRITE_LOG_SECTORS_IN_LogSectors_ID 4 - -} WRITE_LOG_SECTORS_IN, *PWRITE_LOG_SECTORS_IN; - -typedef struct _WRITE_LOG_SECTORS_OUT -{ - // - BOOLEAN Success; - #define WRITE_LOG_SECTORS_OUT_Success_SIZE sizeof(BOOLEAN) - #define WRITE_LOG_SECTORS_OUT_Success_ID 5 - -} WRITE_LOG_SECTORS_OUT, *PWRITE_LOG_SECTORS_OUT; - -#define WRITE_LOG_SECTORS_OUT_SIZE (FIELD_OFFSET(WRITE_LOG_SECTORS_OUT, Success) + WRITE_LOG_SECTORS_OUT_Success_SIZE) - -#define ExecuteSelfTest 8 -typedef struct _EXECUTE_SELF_TEST_IN -{ - // - UCHAR Subcommand; - #define EXECUTE_SELF_TEST_IN_Subcommand_SIZE sizeof(UCHAR) - #define EXECUTE_SELF_TEST_IN_Subcommand_ID 1 - -} EXECUTE_SELF_TEST_IN, *PEXECUTE_SELF_TEST_IN; - -#define EXECUTE_SELF_TEST_IN_SIZE (FIELD_OFFSET(EXECUTE_SELF_TEST_IN, Subcommand) + EXECUTE_SELF_TEST_IN_Subcommand_SIZE) - -typedef struct _EXECUTE_SELF_TEST_OUT -{ - // - ULONG ReturnCode; - #define EXECUTE_SELF_TEST_OUT_ReturnCode_SIZE sizeof(ULONG) - #define EXECUTE_SELF_TEST_OUT_ReturnCode_ID 2 - -} EXECUTE_SELF_TEST_OUT, *PEXECUTE_SELF_TEST_OUT; - -#define EXECUTE_SELF_TEST_OUT_SIZE (FIELD_OFFSET(EXECUTE_SELF_TEST_OUT, ReturnCode) + EXECUTE_SELF_TEST_OUT_ReturnCode_SIZE) - - -// MSStorageDriver_ScsiInfoExceptions - STORAGE_SCSI_INFO_EXCEPTIONS -#define WMI_STORAGE_SCSI_INFO_EXCEPTIONS_GUID \ - { 0x1101d829,0x167b,0x4ebf, { 0xac,0xae,0x28,0xca,0xb7,0xc3,0x48,0x02 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSStorageDriver_ScsiInfoExceptions_GUID, \ - 0x1101d829,0x167b,0x4ebf,0xac,0xae,0x28,0xca,0xb7,0xc3,0x48,0x02); -#endif - - -typedef struct _STORAGE_SCSI_INFO_EXCEPTIONS -{ - // - BOOLEAN PageSavable; - #define STORAGE_SCSI_INFO_EXCEPTIONS_PageSavable_SIZE sizeof(BOOLEAN) - #define STORAGE_SCSI_INFO_EXCEPTIONS_PageSavable_ID 1 - - // - UCHAR Flags; - #define STORAGE_SCSI_INFO_EXCEPTIONS_Flags_SIZE sizeof(UCHAR) - #define STORAGE_SCSI_INFO_EXCEPTIONS_Flags_ID 2 - - // - UCHAR MRIE; - #define STORAGE_SCSI_INFO_EXCEPTIONS_MRIE_SIZE sizeof(UCHAR) - #define STORAGE_SCSI_INFO_EXCEPTIONS_MRIE_ID 3 - - // - UCHAR Padding; - #define STORAGE_SCSI_INFO_EXCEPTIONS_Padding_SIZE sizeof(UCHAR) - #define STORAGE_SCSI_INFO_EXCEPTIONS_Padding_ID 4 - - // - ULONG IntervalTimer; - #define STORAGE_SCSI_INFO_EXCEPTIONS_IntervalTimer_SIZE sizeof(ULONG) - #define STORAGE_SCSI_INFO_EXCEPTIONS_IntervalTimer_ID 5 - - // - ULONG ReportCount; - #define STORAGE_SCSI_INFO_EXCEPTIONS_ReportCount_SIZE sizeof(ULONG) - #define STORAGE_SCSI_INFO_EXCEPTIONS_ReportCount_ID 6 - -} STORAGE_SCSI_INFO_EXCEPTIONS, *PSTORAGE_SCSI_INFO_EXCEPTIONS; - -#define STORAGE_SCSI_INFO_EXCEPTIONS_SIZE (FIELD_OFFSET(STORAGE_SCSI_INFO_EXCEPTIONS, ReportCount) + STORAGE_SCSI_INFO_EXCEPTIONS_ReportCount_SIZE) - -// MSIde_PortDeviceInfo - MSIde_PortDeviceInfo -#define MSIde_PortDeviceInfoGuid \ - { 0x53f5630f,0xb6bf,0x11d0, { 0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSIde_PortDeviceInfo_GUID, \ - 0x53f5630f,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b); -#endif - - -typedef struct _MSIde_PortDeviceInfo -{ - // - UCHAR Bus; - #define MSIde_PortDeviceInfo_Bus_SIZE sizeof(UCHAR) - #define MSIde_PortDeviceInfo_Bus_ID 1 - - // - UCHAR Target; - #define MSIde_PortDeviceInfo_Target_SIZE sizeof(UCHAR) - #define MSIde_PortDeviceInfo_Target_ID 2 - - // - UCHAR Lun; - #define MSIde_PortDeviceInfo_Lun_SIZE sizeof(UCHAR) - #define MSIde_PortDeviceInfo_Lun_ID 3 - -} MSIde_PortDeviceInfo, *PMSIde_PortDeviceInfo; - -#define MSIde_PortDeviceInfo_SIZE (FIELD_OFFSET(MSIde_PortDeviceInfo, Lun) + MSIde_PortDeviceInfo_Lun_SIZE) - -// MSSerial_PortName - MSSerial_PortName -#define SERIAL_PORT_WMI_NAME_GUID \ - { 0xa0ec11a8,0xb16c,0x11d1, { 0xbd,0x98,0x00,0xa0,0xc9,0x06,0xbe,0x2d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSSerial_PortName_GUID, \ - 0xa0ec11a8,0xb16c,0x11d1,0xbd,0x98,0x00,0xa0,0xc9,0x06,0xbe,0x2d); -#endif - - -typedef struct _MSSerial_PortName -{ - // - CHAR VariableData[1]; - #define MSSerial_PortName_PortName_ID 1 - -} MSSerial_PortName, *PMSSerial_PortName; - -// MSSerial_CommInfo - SERIAL_WMI_COMM_DATA -#define SERIAL_PORT_WMI_COMM_GUID \ - { 0xedb16a62,0xb16c,0x11d1, { 0xbd,0x98,0x00,0xa0,0xc9,0x06,0xbe,0x2d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSSerial_CommInfo_GUID, \ - 0xedb16a62,0xb16c,0x11d1,0xbd,0x98,0x00,0xa0,0xc9,0x06,0xbe,0x2d); -#endif - - -typedef struct _SERIAL_WMI_COMM_DATA -{ - // - ULONG BaudRate; - #define SERIAL_WMI_COMM_DATA_BaudRate_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMM_DATA_BaudRate_ID 1 - - // - ULONG BitsPerByte; - #define SERIAL_WMI_COMM_DATA_BitsPerByte_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMM_DATA_BitsPerByte_ID 2 - - -#define SERIAL_WMI_PARITY_NONE 0 -#define SERIAL_WMI_PARITY_ODD 1 -#define SERIAL_WMI_PARITY_EVEN 2 -#define SERIAL_WMI_PARITY_SPACE 3 -#define SERIAL_WMI_PARITY_MARK 4 - - // - ULONG Parity; - #define SERIAL_WMI_COMM_DATA_Parity_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMM_DATA_Parity_ID 3 - - // - BOOLEAN ParityCheckEnable; - #define SERIAL_WMI_COMM_DATA_ParityCheckEnable_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_ParityCheckEnable_ID 4 - - -#define SERIAL_WMI_STOP_1 0 -#define SERIAL_WMI_STOP_1_5 1 -#define SERIAL_WMI_STOP_2 2 - - // - ULONG StopBits; - #define SERIAL_WMI_COMM_DATA_StopBits_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMM_DATA_StopBits_ID 5 - - // - ULONG XoffCharacter; - #define SERIAL_WMI_COMM_DATA_XoffCharacter_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMM_DATA_XoffCharacter_ID 6 - - // - ULONG XoffXmitThreshold; - #define SERIAL_WMI_COMM_DATA_XoffXmitThreshold_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMM_DATA_XoffXmitThreshold_ID 7 - - // - ULONG XonCharacter; - #define SERIAL_WMI_COMM_DATA_XonCharacter_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMM_DATA_XonCharacter_ID 8 - - // - ULONG XonXmitThreshold; - #define SERIAL_WMI_COMM_DATA_XonXmitThreshold_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMM_DATA_XonXmitThreshold_ID 9 - - // - ULONG MaximumBaudRate; - #define SERIAL_WMI_COMM_DATA_MaximumBaudRate_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMM_DATA_MaximumBaudRate_ID 10 - - // - ULONG MaximumOutputBufferSize; - #define SERIAL_WMI_COMM_DATA_MaximumOutputBufferSize_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMM_DATA_MaximumOutputBufferSize_ID 11 - - // - ULONG MaximumInputBufferSize; - #define SERIAL_WMI_COMM_DATA_MaximumInputBufferSize_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMM_DATA_MaximumInputBufferSize_ID 12 - - // - BOOLEAN Support16BitMode; - #define SERIAL_WMI_COMM_DATA_Support16BitMode_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_Support16BitMode_ID 13 - - // - BOOLEAN SupportDTRDSR; - #define SERIAL_WMI_COMM_DATA_SupportDTRDSR_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_SupportDTRDSR_ID 14 - - // - BOOLEAN SupportIntervalTimeouts; - #define SERIAL_WMI_COMM_DATA_SupportIntervalTimeouts_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_SupportIntervalTimeouts_ID 15 - - // - BOOLEAN SupportParityCheck; - #define SERIAL_WMI_COMM_DATA_SupportParityCheck_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_SupportParityCheck_ID 16 - - // - BOOLEAN SupportRTSCTS; - #define SERIAL_WMI_COMM_DATA_SupportRTSCTS_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_SupportRTSCTS_ID 17 - - // - BOOLEAN SupportXonXoff; - #define SERIAL_WMI_COMM_DATA_SupportXonXoff_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_SupportXonXoff_ID 18 - - // - BOOLEAN SettableBaudRate; - #define SERIAL_WMI_COMM_DATA_SettableBaudRate_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_SettableBaudRate_ID 19 - - // - BOOLEAN SettableDataBits; - #define SERIAL_WMI_COMM_DATA_SettableDataBits_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_SettableDataBits_ID 20 - - // - BOOLEAN SettableFlowControl; - #define SERIAL_WMI_COMM_DATA_SettableFlowControl_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_SettableFlowControl_ID 21 - - // - BOOLEAN SettableParity; - #define SERIAL_WMI_COMM_DATA_SettableParity_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_SettableParity_ID 22 - - // - BOOLEAN SettableParityCheck; - #define SERIAL_WMI_COMM_DATA_SettableParityCheck_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_SettableParityCheck_ID 23 - - // - BOOLEAN SettableStopBits; - #define SERIAL_WMI_COMM_DATA_SettableStopBits_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_SettableStopBits_ID 24 - - // - BOOLEAN IsBusy; - #define SERIAL_WMI_COMM_DATA_IsBusy_SIZE sizeof(BOOLEAN) - #define SERIAL_WMI_COMM_DATA_IsBusy_ID 25 - -} SERIAL_WMI_COMM_DATA, *PSERIAL_WMI_COMM_DATA; - -#define SERIAL_WMI_COMM_DATA_SIZE (FIELD_OFFSET(SERIAL_WMI_COMM_DATA, IsBusy) + SERIAL_WMI_COMM_DATA_IsBusy_SIZE) - -// MSSerial_HardwareConfiguration - SERIAL_WMI_HW_DATA -#define SERIAL_PORT_WMI_HW_GUID \ - { 0x270b9b86,0xb16d,0x11d1, { 0xbd,0x98,0x00,0xa0,0xc9,0x06,0xbe,0x2d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSSerial_HardwareConfiguration_GUID, \ - 0x270b9b86,0xb16d,0x11d1,0xbd,0x98,0x00,0xa0,0xc9,0x06,0xbe,0x2d); -#endif - - -typedef struct _SERIAL_WMI_HW_DATA -{ - // - ULONG IrqNumber; - #define SERIAL_WMI_HW_DATA_IrqNumber_SIZE sizeof(ULONG) - #define SERIAL_WMI_HW_DATA_IrqNumber_ID 1 - - // - ULONG IrqVector; - #define SERIAL_WMI_HW_DATA_IrqVector_SIZE sizeof(ULONG) - #define SERIAL_WMI_HW_DATA_IrqVector_ID 2 - - // - ULONG IrqLevel; - #define SERIAL_WMI_HW_DATA_IrqLevel_SIZE sizeof(ULONG) - #define SERIAL_WMI_HW_DATA_IrqLevel_ID 3 - - // - ULONGLONG IrqAffinityMask; - #define SERIAL_WMI_HW_DATA_IrqAffinityMask_SIZE sizeof(ULONGLONG) - #define SERIAL_WMI_HW_DATA_IrqAffinityMask_ID 4 - - -#define SERIAL_WMI_INTTYPE_LATCHED 0 -#define SERIAL_WMI_INTTYPE_LEVEL 1 - - // - ULONG InterruptType; - #define SERIAL_WMI_HW_DATA_InterruptType_SIZE sizeof(ULONG) - #define SERIAL_WMI_HW_DATA_InterruptType_ID 5 - - // - ULONGLONG BaseIOAddress; - #define SERIAL_WMI_HW_DATA_BaseIOAddress_SIZE sizeof(ULONGLONG) - #define SERIAL_WMI_HW_DATA_BaseIOAddress_ID 6 - -} SERIAL_WMI_HW_DATA, *PSERIAL_WMI_HW_DATA; - -#define SERIAL_WMI_HW_DATA_SIZE (FIELD_OFFSET(SERIAL_WMI_HW_DATA, BaseIOAddress) + SERIAL_WMI_HW_DATA_BaseIOAddress_SIZE) - -// MSSerial_PerformanceInformation - SERIAL_WMI_PERF_DATA -#define SERIAL_PORT_WMI_PERF_GUID \ - { 0x56415acc,0xb16d,0x11d1, { 0xbd,0x98,0x00,0xa0,0xc9,0x06,0xbe,0x2d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSSerial_PerformanceInformation_GUID, \ - 0x56415acc,0xb16d,0x11d1,0xbd,0x98,0x00,0xa0,0xc9,0x06,0xbe,0x2d); -#endif - - -typedef struct _SERIAL_WMI_PERF_DATA -{ - // - ULONG ReceivedCount; - #define SERIAL_WMI_PERF_DATA_ReceivedCount_SIZE sizeof(ULONG) - #define SERIAL_WMI_PERF_DATA_ReceivedCount_ID 1 - - // - ULONG TransmittedCount; - #define SERIAL_WMI_PERF_DATA_TransmittedCount_SIZE sizeof(ULONG) - #define SERIAL_WMI_PERF_DATA_TransmittedCount_ID 2 - - // - ULONG FrameErrorCount; - #define SERIAL_WMI_PERF_DATA_FrameErrorCount_SIZE sizeof(ULONG) - #define SERIAL_WMI_PERF_DATA_FrameErrorCount_ID 3 - - // - ULONG SerialOverrunErrorCount; - #define SERIAL_WMI_PERF_DATA_SerialOverrunErrorCount_SIZE sizeof(ULONG) - #define SERIAL_WMI_PERF_DATA_SerialOverrunErrorCount_ID 4 - - // - ULONG BufferOverrunErrorCount; - #define SERIAL_WMI_PERF_DATA_BufferOverrunErrorCount_SIZE sizeof(ULONG) - #define SERIAL_WMI_PERF_DATA_BufferOverrunErrorCount_ID 5 - - // - ULONG ParityErrorCount; - #define SERIAL_WMI_PERF_DATA_ParityErrorCount_SIZE sizeof(ULONG) - #define SERIAL_WMI_PERF_DATA_ParityErrorCount_ID 6 - -} SERIAL_WMI_PERF_DATA, *PSERIAL_WMI_PERF_DATA; - -#define SERIAL_WMI_PERF_DATA_SIZE (FIELD_OFFSET(SERIAL_WMI_PERF_DATA, ParityErrorCount) + SERIAL_WMI_PERF_DATA_ParityErrorCount_SIZE) - -// MSSerial_CommProperties - SERIAL_WMI_COMMPROP -#define SERIAL_PORT_WMI_PROPERTIES_GUID \ - { 0x8209ec2a,0x2d6b,0x11d2, { 0xba,0x49,0x00,0xa0,0xc9,0x06,0x29,0x10 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSSerial_CommProperties_GUID, \ - 0x8209ec2a,0x2d6b,0x11d2,0xba,0x49,0x00,0xa0,0xc9,0x06,0x29,0x10); -#endif - - -typedef struct _SERIAL_WMI_COMMPROP -{ - // - USHORT wPacketLength; - #define SERIAL_WMI_COMMPROP_wPacketLength_SIZE sizeof(USHORT) - #define SERIAL_WMI_COMMPROP_wPacketLength_ID 1 - - // - USHORT wPacketVersion; - #define SERIAL_WMI_COMMPROP_wPacketVersion_SIZE sizeof(USHORT) - #define SERIAL_WMI_COMMPROP_wPacketVersion_ID 2 - - // - ULONG dwServiceMask; - #define SERIAL_WMI_COMMPROP_dwServiceMask_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwServiceMask_ID 3 - - // - ULONG dwReserved1; - #define SERIAL_WMI_COMMPROP_dwReserved1_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwReserved1_ID 4 - - // - ULONG dwMaxTxQueue; - #define SERIAL_WMI_COMMPROP_dwMaxTxQueue_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwMaxTxQueue_ID 5 - - // - ULONG dwMaxRxQueue; - #define SERIAL_WMI_COMMPROP_dwMaxRxQueue_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwMaxRxQueue_ID 6 - - // - ULONG dwMaxBaud; - #define SERIAL_WMI_COMMPROP_dwMaxBaud_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwMaxBaud_ID 7 - - // - ULONG dwProvSubType; - #define SERIAL_WMI_COMMPROP_dwProvSubType_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwProvSubType_ID 8 - - // - ULONG dwProvCapabilities; - #define SERIAL_WMI_COMMPROP_dwProvCapabilities_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwProvCapabilities_ID 9 - - // - ULONG dwSettableParams; - #define SERIAL_WMI_COMMPROP_dwSettableParams_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwSettableParams_ID 10 - - // - ULONG dwSettableBaud; - #define SERIAL_WMI_COMMPROP_dwSettableBaud_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwSettableBaud_ID 11 - - // - USHORT wSettableData; - #define SERIAL_WMI_COMMPROP_wSettableData_SIZE sizeof(USHORT) - #define SERIAL_WMI_COMMPROP_wSettableData_ID 12 - - // - USHORT wSettableStopParity; - #define SERIAL_WMI_COMMPROP_wSettableStopParity_SIZE sizeof(USHORT) - #define SERIAL_WMI_COMMPROP_wSettableStopParity_ID 13 - - // - ULONG dwCurrentTxQueue; - #define SERIAL_WMI_COMMPROP_dwCurrentTxQueue_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwCurrentTxQueue_ID 14 - - // - ULONG dwCurrentRxQueue; - #define SERIAL_WMI_COMMPROP_dwCurrentRxQueue_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwCurrentRxQueue_ID 15 - - // - ULONG dwProvSpec1; - #define SERIAL_WMI_COMMPROP_dwProvSpec1_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwProvSpec1_ID 16 - - // - ULONG dwProvSpec2; - #define SERIAL_WMI_COMMPROP_dwProvSpec2_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwProvSpec2_ID 17 - - // - ULONG dwProvCharSize; - #define SERIAL_WMI_COMMPROP_dwProvCharSize_SIZE sizeof(ULONG) - #define SERIAL_WMI_COMMPROP_dwProvCharSize_ID 18 - - // - UCHAR wcProvChar[1]; - #define SERIAL_WMI_COMMPROP_wcProvChar_ID 19 - -} SERIAL_WMI_COMMPROP, *PSERIAL_WMI_COMMPROP; - -// MSParallel_AllocFreeCounts - PARPORT_WMI_ALLOC_FREE_COUNTS -#define PARPORT_WMI_ALLOCATE_FREE_COUNTS_GUID \ - { 0x4bbb69ea,0x6853,0x11d2, { 0x8e,0xce,0x00,0xc0,0x4f,0x8e,0xf4,0x81 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSParallel_AllocFreeCounts_GUID, \ - 0x4bbb69ea,0x6853,0x11d2,0x8e,0xce,0x00,0xc0,0x4f,0x8e,0xf4,0x81); -#endif - - -typedef struct _PARPORT_WMI_ALLOC_FREE_COUNTS -{ - // - ULONG PortAllocates; - #define PARPORT_WMI_ALLOC_FREE_COUNTS_PortAllocates_SIZE sizeof(ULONG) - #define PARPORT_WMI_ALLOC_FREE_COUNTS_PortAllocates_ID 1 - - // - ULONG PortFrees; - #define PARPORT_WMI_ALLOC_FREE_COUNTS_PortFrees_SIZE sizeof(ULONG) - #define PARPORT_WMI_ALLOC_FREE_COUNTS_PortFrees_ID 2 - -} PARPORT_WMI_ALLOC_FREE_COUNTS, *PPARPORT_WMI_ALLOC_FREE_COUNTS; - -#define PARPORT_WMI_ALLOC_FREE_COUNTS_SIZE (FIELD_OFFSET(PARPORT_WMI_ALLOC_FREE_COUNTS, PortFrees) + PARPORT_WMI_ALLOC_FREE_COUNTS_PortFrees_SIZE) - -// MSParallel_DeviceBytesTransferred - PARALLEL_WMI_LOG_INFO -#define PARALLEL_WMI_BYTES_TRANSFERRED_GUID \ - { 0x89fef2d6,0x654b,0x11d2, { 0x9e,0x15,0x00,0xc0,0x4f,0x8e,0xf4,0x81 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSParallel_DeviceBytesTransferred_GUID, \ - 0x89fef2d6,0x654b,0x11d2,0x9e,0x15,0x00,0xc0,0x4f,0x8e,0xf4,0x81); -#endif - - -typedef struct _PARALLEL_WMI_LOG_INFO -{ - // - ULONG Flags1; - #define PARALLEL_WMI_LOG_INFO_Flags1_SIZE sizeof(ULONG) - #define PARALLEL_WMI_LOG_INFO_Flags1_ID 1 - - // - ULONG Flags2; - #define PARALLEL_WMI_LOG_INFO_Flags2_SIZE sizeof(ULONG) - #define PARALLEL_WMI_LOG_INFO_Flags2_ID 2 - - // - ULONG spare[2]; - #define PARALLEL_WMI_LOG_INFO_spare_SIZE sizeof(ULONG[2]) - #define PARALLEL_WMI_LOG_INFO_spare_ID 3 - - // - LONGLONG SppWriteCount; - #define PARALLEL_WMI_LOG_INFO_SppWriteCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_SppWriteCount_ID 4 - - // - LONGLONG NibbleReadCount; - #define PARALLEL_WMI_LOG_INFO_NibbleReadCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_NibbleReadCount_ID 5 - - // - LONGLONG BoundedEcpWriteCount; - #define PARALLEL_WMI_LOG_INFO_BoundedEcpWriteCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_BoundedEcpWriteCount_ID 6 - - // - LONGLONG BoundedEcpReadCount; - #define PARALLEL_WMI_LOG_INFO_BoundedEcpReadCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_BoundedEcpReadCount_ID 7 - - // - LONGLONG HwEcpWriteCount; - #define PARALLEL_WMI_LOG_INFO_HwEcpWriteCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_HwEcpWriteCount_ID 8 - - // - LONGLONG HwEcpReadCount; - #define PARALLEL_WMI_LOG_INFO_HwEcpReadCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_HwEcpReadCount_ID 9 - - // - LONGLONG SwEcpWriteCount; - #define PARALLEL_WMI_LOG_INFO_SwEcpWriteCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_SwEcpWriteCount_ID 10 - - // - LONGLONG SwEcpReadCount; - #define PARALLEL_WMI_LOG_INFO_SwEcpReadCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_SwEcpReadCount_ID 11 - - // - LONGLONG HwEppWriteCount; - #define PARALLEL_WMI_LOG_INFO_HwEppWriteCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_HwEppWriteCount_ID 12 - - // - LONGLONG HwEppReadCount; - #define PARALLEL_WMI_LOG_INFO_HwEppReadCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_HwEppReadCount_ID 13 - - // - LONGLONG SwEppWriteCount; - #define PARALLEL_WMI_LOG_INFO_SwEppWriteCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_SwEppWriteCount_ID 14 - - // - LONGLONG SwEppReadCount; - #define PARALLEL_WMI_LOG_INFO_SwEppReadCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_SwEppReadCount_ID 15 - - // - LONGLONG ByteReadCount; - #define PARALLEL_WMI_LOG_INFO_ByteReadCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_ByteReadCount_ID 16 - - // - LONGLONG ChannelNibbleReadCount; - #define PARALLEL_WMI_LOG_INFO_ChannelNibbleReadCount_SIZE sizeof(LONGLONG) - #define PARALLEL_WMI_LOG_INFO_ChannelNibbleReadCount_ID 17 - -} PARALLEL_WMI_LOG_INFO, *PPARALLEL_WMI_LOG_INFO; - -#define PARALLEL_WMI_LOG_INFO_SIZE (FIELD_OFFSET(PARALLEL_WMI_LOG_INFO, ChannelNibbleReadCount) + PARALLEL_WMI_LOG_INFO_ChannelNibbleReadCount_SIZE) - -// MSRedbook_DriverInformation - REDBOOK_WMI_STD_DATA -#define GUID_REDBOOK_WMI_STD_DATA \ - { 0xb90550e7,0xae0a,0x11d1, { 0xa5,0x71,0x00,0xc0,0x4f,0xa3,0x47,0x30 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSRedbook_DriverInformationGuid, \ - 0xb90550e7,0xae0a,0x11d1,0xa5,0x71,0x00,0xc0,0x4f,0xa3,0x47,0x30); -#endif - - -typedef struct _REDBOOK_WMI_STD_DATA -{ - // - ULONG NumberOfBuffers; - #define REDBOOK_WMI_NUMBER_OF_BUFFERS_SIZE sizeof(ULONG) - #define REDBOOK_WMI_NUMBER_OF_BUFFERS_ID 1 - - // - ULONG SectorsPerRead; - #define REDBOOK_WMI_SECTORS_PER_READ_SIZE sizeof(ULONG) - #define REDBOOK_WMI_SECTORS_PER_READ_ID 2 - - // - ULONG SectorsPerReadMask; - #define REDBOOK_WMI_SECTORS_PER_READ_MASK_SIZE sizeof(ULONG) - #define REDBOOK_WMI_SECTORS_PER_READ_MASK_ID 3 - - // - ULONG MaximumSectorsPerRead; - #define REDBOOK_WMI_MAX_SECTORS_PER_READ_SIZE sizeof(ULONG) - #define REDBOOK_WMI_MAX_SECTORS_PER_READ_ID 4 - - // - BOOLEAN PlayEnabled; - #define REDBOOK_WMI_PLAY_ENABLED_SIZE sizeof(BOOLEAN) - #define REDBOOK_WMI_PLAY_ENABLED_ID 5 - - // - BOOLEAN CDDASupported; - #define REDBOOK_WMI_CDDA_SUPPORTED_SIZE sizeof(BOOLEAN) - #define REDBOOK_WMI_CDDA_SUPPORTED_ID 6 - - // - BOOLEAN CDDAAccurate; - #define REDBOOK_WMI_CDDA_ACCURATE_SIZE sizeof(BOOLEAN) - #define REDBOOK_WMI_CDDA_ACCURATE_ID 7 - - // - BOOLEAN Reserved1; - #define REDBOOK_WMI_STD_DATA_Reserved1_SIZE sizeof(BOOLEAN) - #define REDBOOK_WMI_STD_DATA_Reserved1_ID 8 - -} REDBOOK_WMI_STD_DATA, *PREDBOOK_WMI_STD_DATA; - -#define REDBOOK_WMI_STD_DATA_SIZE (FIELD_OFFSET(REDBOOK_WMI_STD_DATA, Reserved1) + REDBOOK_WMI_STD_DATA_Reserved1_SIZE) - -// MSRedbook_Performance - REDBOOK_WMI_PERF_DATA -#define GUID_REDBOOK_WMI_PERF_DATA \ - { 0xb90550e8,0xae0a,0x11d1, { 0xa5,0x71,0x00,0xc0,0x4f,0xa3,0x47,0x30 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSRedbook_PerformanceGuid, \ - 0xb90550e8,0xae0a,0x11d1,0xa5,0x71,0x00,0xc0,0x4f,0xa3,0x47,0x30); -#endif - - -typedef struct _REDBOOK_WMI_PERF_DATA -{ - // - LONGLONG TimeReadDelay; - #define REDBOOK_WMI_PERF_TIME_READING_DELAY_SIZE sizeof(LONGLONG) - #define REDBOOK_WMI_PERF_TIME_READING_DELAY_ID 1 - - // - LONGLONG TimeReading; - #define REDBOOK_WMI_PERF_TIME_READING_SIZE sizeof(LONGLONG) - #define REDBOOK_WMI_PERF_TIME_READING_ID 2 - - // - LONGLONG TimeStreamDelay; - #define REDBOOK_WMI_PERF_TIME_STREAMING_DELAY_SIZE sizeof(LONGLONG) - #define REDBOOK_WMI_PERF_TIME_STREAMING_DELAY_ID 3 - - // - LONGLONG TimeStreaming; - #define REDBOOK_WMI_PERF_TIME_STREAMING_SIZE sizeof(LONGLONG) - #define REDBOOK_WMI_PERF_TIME_STREAMING_ID 4 - - // - LONGLONG DataProcessed; - #define REDBOOK_WMI_PERF_DATA_PROCESSED_SIZE sizeof(LONGLONG) - #define REDBOOK_WMI_PERF_DATA_PROCESSED_ID 5 - - // - ULONG StreamPausedCount; - #define REDBOOK_WMI_PERF_STREAM_PAUSED_COUNT_SIZE sizeof(ULONG) - #define REDBOOK_WMI_PERF_STREAM_PAUSED_COUNT_ID 6 - -} REDBOOK_WMI_PERF_DATA, *PREDBOOK_WMI_PERF_DATA; - -#define REDBOOK_WMI_PERF_DATA_SIZE (FIELD_OFFSET(REDBOOK_WMI_PERF_DATA, StreamPausedCount) + REDBOOK_WMI_PERF_DATA_StreamPausedCount_SIZE) - -// RegisteredGuids - RegisteredGuids -#define RegisteredGuidsGuid \ - { 0xe3dff7bd,0x3915,0x11d2, { 0x91,0x03,0x00,0xc0,0x4f,0xb9,0x98,0xa2 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(RegisteredGuids_GUID, \ - 0xe3dff7bd,0x3915,0x11d2,0x91,0x03,0x00,0xc0,0x4f,0xb9,0x98,0xa2); -#endif - - -typedef struct _RegisteredGuids -{ - // - ULONG GuidType; - #define RegisteredGuids_GuidType_SIZE sizeof(ULONG) - #define RegisteredGuids_GuidType_ID 1 - - // - ULONG LoggerId; - #define RegisteredGuids_LoggerId_SIZE sizeof(ULONG) - #define RegisteredGuids_LoggerId_ID 2 - - // - ULONG EnableLevel; - #define RegisteredGuids_EnableLevel_SIZE sizeof(ULONG) - #define RegisteredGuids_EnableLevel_ID 3 - - // - ULONG EnableFlags; - #define RegisteredGuids_EnableFlags_SIZE sizeof(ULONG) - #define RegisteredGuids_EnableFlags_ID 4 - - // - BOOLEAN IsEnabled; - #define RegisteredGuids_IsEnabled_SIZE sizeof(BOOLEAN) - #define RegisteredGuids_IsEnabled_ID 5 - -} RegisteredGuids, *PRegisteredGuids; - -#define RegisteredGuids_SIZE (FIELD_OFFSET(RegisteredGuids, IsEnabled) + RegisteredGuids_IsEnabled_SIZE) - -// MSTapeDriveParam - WMI_TAPE_DRIVE_PARAMETERS -#define WMI_TAPE_DRIVE_PARAMETERS_GUID \ - { 0xb9a8cfd5,0x8d72,0x47a4, { 0xac,0x0e,0x28,0x4a,0x32,0x00,0xf4,0xfb } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSTapeDriveParam_GUID, \ - 0xb9a8cfd5,0x8d72,0x47a4,0xac,0x0e,0x28,0x4a,0x32,0x00,0xf4,0xfb); -#endif - - -typedef struct _WMI_TAPE_DRIVE_PARAMETERS -{ - // - ULONG MaximumBlockSize; - #define WMI_TAPE_DRIVE_PARAMETERS_MaximumBlockSize_SIZE sizeof(ULONG) - #define WMI_TAPE_DRIVE_PARAMETERS_MaximumBlockSize_ID 1 - - // - ULONG MinimumBlockSize; - #define WMI_TAPE_DRIVE_PARAMETERS_MinimumBlockSize_SIZE sizeof(ULONG) - #define WMI_TAPE_DRIVE_PARAMETERS_MinimumBlockSize_ID 2 - - // - ULONG DefaultBlockSize; - #define WMI_TAPE_DRIVE_PARAMETERS_DefaultBlockSize_SIZE sizeof(ULONG) - #define WMI_TAPE_DRIVE_PARAMETERS_DefaultBlockSize_ID 3 - - // - ULONG MaximumPartitionCount; - #define WMI_TAPE_DRIVE_PARAMETERS_MaximumPartitionCount_SIZE sizeof(ULONG) - #define WMI_TAPE_DRIVE_PARAMETERS_MaximumPartitionCount_ID 4 - - // - BOOLEAN CompressionCapable; - #define WMI_TAPE_DRIVE_PARAMETERS_CompressionCapable_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_DRIVE_PARAMETERS_CompressionCapable_ID 5 - - // - BOOLEAN CompressionEnabled; - #define WMI_TAPE_DRIVE_PARAMETERS_CompressionEnabled_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_DRIVE_PARAMETERS_CompressionEnabled_ID 6 - - // - BOOLEAN ReportSetmarks; - #define WMI_TAPE_DRIVE_PARAMETERS_ReportSetmarks_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_DRIVE_PARAMETERS_ReportSetmarks_ID 7 - - // - BOOLEAN HardwareErrorCorrection; - #define WMI_TAPE_DRIVE_PARAMETERS_HardwareErrorCorrection_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_DRIVE_PARAMETERS_HardwareErrorCorrection_ID 8 - -} WMI_TAPE_DRIVE_PARAMETERS, *PWMI_TAPE_DRIVE_PARAMETERS; - -#define WMI_TAPE_DRIVE_PARAMETERS_SIZE (FIELD_OFFSET(WMI_TAPE_DRIVE_PARAMETERS, HardwareErrorCorrection) + WMI_TAPE_DRIVE_PARAMETERS_HardwareErrorCorrection_SIZE) - -// MSTapeMediaCapacity - WMI_TAPE_MEDIA_PARAMETERS -#define WMI_TAPE_MEDIA_PARAMETERS_GUID \ - { 0x8c2147a4,0xff29,0x4336, { 0xb8,0xa4,0x22,0x7b,0x54,0xcc,0x09,0x66 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSTapeMediaCapacity_GUID, \ - 0x8c2147a4,0xff29,0x4336,0xb8,0xa4,0x22,0x7b,0x54,0xcc,0x09,0x66); -#endif - - -typedef struct _WMI_TAPE_MEDIA_PARAMETERS -{ - // - ULONGLONG MaximumCapacity; - #define WMI_TAPE_MEDIA_PARAMETERS_MaximumCapacity_SIZE sizeof(ULONGLONG) - #define WMI_TAPE_MEDIA_PARAMETERS_MaximumCapacity_ID 1 - - // - ULONGLONG AvailableCapacity; - #define WMI_TAPE_MEDIA_PARAMETERS_AvailableCapacity_SIZE sizeof(ULONGLONG) - #define WMI_TAPE_MEDIA_PARAMETERS_AvailableCapacity_ID 2 - - // - ULONG BlockSize; - #define WMI_TAPE_MEDIA_PARAMETERS_BlockSize_SIZE sizeof(ULONG) - #define WMI_TAPE_MEDIA_PARAMETERS_BlockSize_ID 3 - - // - ULONG PartitionCount; - #define WMI_TAPE_MEDIA_PARAMETERS_PartitionCount_SIZE sizeof(ULONG) - #define WMI_TAPE_MEDIA_PARAMETERS_PartitionCount_ID 4 - - // - BOOLEAN MediaWriteProtected; - #define WMI_TAPE_MEDIA_PARAMETERS_MediaWriteProtected_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_MEDIA_PARAMETERS_MediaWriteProtected_ID 5 - -} WMI_TAPE_MEDIA_PARAMETERS, *PWMI_TAPE_MEDIA_PARAMETERS; - -#define WMI_TAPE_MEDIA_PARAMETERS_SIZE (FIELD_OFFSET(WMI_TAPE_MEDIA_PARAMETERS, MediaWriteProtected) + WMI_TAPE_MEDIA_PARAMETERS_MediaWriteProtected_SIZE) - -// MSTapeSymbolicName - WMI_TAPE_SYMBOLIC_NAME -#define WMI_TAPE_SYMBOLIC_NAME_GUID \ - { 0x3fb828f7,0xf119,0x4066, { 0xb1,0xe6,0xdb,0x40,0x7c,0xe9,0xde,0x91 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSTapeSymbolicName_GUID, \ - 0x3fb828f7,0xf119,0x4066,0xb1,0xe6,0xdb,0x40,0x7c,0xe9,0xde,0x91); -#endif - - -typedef struct _WMI_TAPE_SYMBOLIC_NAME -{ - // - CHAR VariableData[1]; - #define WMI_TAPE_SYMBOLIC_NAME_TapeSymbolicName_ID 1 - -} WMI_TAPE_SYMBOLIC_NAME, *PWMI_TAPE_SYMBOLIC_NAME; - -// MSTapeDriveProblemEvent - WMI_TAPE_PROBLEM_WARNING -#define WMI_TAPE_PROBLEM_WARNING_GUID \ - { 0xbc4dd36c,0xfa66,0x4080, { 0x87,0xa0,0x0c,0x59,0x22,0xeb,0x78,0x87 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSTapeDriveProblemEvent_GUID, \ - 0xbc4dd36c,0xfa66,0x4080,0x87,0xa0,0x0c,0x59,0x22,0xeb,0x78,0x87); -#endif - - -typedef struct _WMI_TAPE_PROBLEM_WARNING -{ - // - ULONG DriveProblemType; - #define WMI_TAPE_PROBLEM_WARNING_DriveProblemType_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_WARNING_DriveProblemType_ID 1 - - // - UCHAR TapeData[512]; - #define WMI_TAPE_PROBLEM_WARNING_TapeData_SIZE sizeof(UCHAR[512]) - #define WMI_TAPE_PROBLEM_WARNING_TapeData_ID 2 - -} WMI_TAPE_PROBLEM_WARNING, *PWMI_TAPE_PROBLEM_WARNING; - -#define WMI_TAPE_PROBLEM_WARNING_SIZE (FIELD_OFFSET(WMI_TAPE_PROBLEM_WARNING, TapeData) + WMI_TAPE_PROBLEM_WARNING_TapeData_SIZE) - -// MSTapeProblemIoError - WMI_TAPE_PROBLEM_IO_ERROR -#define WMI_TAPE_PROBLEM_IO_ERROR_GUID \ - { 0x58fd29f9,0xb516,0x40fd, { 0x87,0x1a,0x7e,0xe7,0x6d,0x5b,0xb5,0x3e } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSTapeProblemIoError_GUID, \ - 0x58fd29f9,0xb516,0x40fd,0x87,0x1a,0x7e,0xe7,0x6d,0x5b,0xb5,0x3e); -#endif - - -typedef struct _WMI_TAPE_PROBLEM_IO_ERROR -{ - // - ULONG ReadCorrectedWithoutDelay; - #define WMI_TAPE_PROBLEM_IO_ERROR_ReadCorrectedWithoutDelay_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_ReadCorrectedWithoutDelay_ID 1 - - // - ULONG ReadCorrectedWithDelay; - #define WMI_TAPE_PROBLEM_IO_ERROR_ReadCorrectedWithDelay_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_ReadCorrectedWithDelay_ID 2 - - // - ULONG ReadTotalErrors; - #define WMI_TAPE_PROBLEM_IO_ERROR_ReadTotalErrors_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_ReadTotalErrors_ID 3 - - // - ULONG ReadTotalCorrectedErrors; - #define WMI_TAPE_PROBLEM_IO_ERROR_ReadTotalCorrectedErrors_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_ReadTotalCorrectedErrors_ID 4 - - // - ULONG ReadTotalUncorrectedErrors; - #define WMI_TAPE_PROBLEM_IO_ERROR_ReadTotalUncorrectedErrors_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_ReadTotalUncorrectedErrors_ID 5 - - // - ULONG ReadCorrectionAlgorithmProcessed; - #define WMI_TAPE_PROBLEM_IO_ERROR_ReadCorrectionAlgorithmProcessed_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_ReadCorrectionAlgorithmProcessed_ID 6 - - // - ULONG WriteCorrectedWithoutDelay; - #define WMI_TAPE_PROBLEM_IO_ERROR_WriteCorrectedWithoutDelay_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_WriteCorrectedWithoutDelay_ID 7 - - // - ULONG WriteCorrectedWithDelay; - #define WMI_TAPE_PROBLEM_IO_ERROR_WriteCorrectedWithDelay_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_WriteCorrectedWithDelay_ID 8 - - // - ULONG WriteTotalErrors; - #define WMI_TAPE_PROBLEM_IO_ERROR_WriteTotalErrors_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_WriteTotalErrors_ID 9 - - // - ULONG WriteTotalCorrectedErrors; - #define WMI_TAPE_PROBLEM_IO_ERROR_WriteTotalCorrectedErrors_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_WriteTotalCorrectedErrors_ID 10 - - // - ULONG WriteTotalUncorrectedErrors; - #define WMI_TAPE_PROBLEM_IO_ERROR_WriteTotalUncorrectedErrors_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_WriteTotalUncorrectedErrors_ID 11 - - // - ULONG WriteCorrectionAlgorithmProcessed; - #define WMI_TAPE_PROBLEM_IO_ERROR_WriteCorrectionAlgorithmProcessed_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_WriteCorrectionAlgorithmProcessed_ID 12 - - // - ULONG NonMediumErrors; - #define WMI_TAPE_PROBLEM_IO_ERROR_NonMediumErrors_SIZE sizeof(ULONG) - #define WMI_TAPE_PROBLEM_IO_ERROR_NonMediumErrors_ID 13 - -} WMI_TAPE_PROBLEM_IO_ERROR, *PWMI_TAPE_PROBLEM_IO_ERROR; - -#define WMI_TAPE_PROBLEM_IO_ERROR_SIZE (FIELD_OFFSET(WMI_TAPE_PROBLEM_IO_ERROR, NonMediumErrors) + WMI_TAPE_PROBLEM_IO_ERROR_NonMediumErrors_SIZE) - -// MSTapeProblemDeviceError - WMI_TAPE_PROBLEM_DEVICE_ERROR -#define WMI_TAPE_PROBLEM_DEVICE_ERROR_GUID \ - { 0x43ec6b13,0x10bb,0x4bf6, { 0xb7,0x16,0x1c,0x1e,0x2f,0x10,0xbb,0x5f } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSTapeProblemDeviceError_GUID, \ - 0x43ec6b13,0x10bb,0x4bf6,0xb7,0x16,0x1c,0x1e,0x2f,0x10,0xbb,0x5f); -#endif - - -typedef struct _WMI_TAPE_PROBLEM_DEVICE_ERROR -{ - // - BOOLEAN ReadWarning; - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_ReadWarning_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_ReadWarning_ID 1 - - // - BOOLEAN WriteWarning; - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_WriteWarning_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_WriteWarning_ID 2 - - // - BOOLEAN HardError; - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_HardError_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_HardError_ID 3 - - // - BOOLEAN ReadFailure; - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_ReadFailure_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_ReadFailure_ID 4 - - // - BOOLEAN WriteFailure; - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_WriteFailure_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_WriteFailure_ID 5 - - // - BOOLEAN UnsupportedFormat; - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_UnsupportedFormat_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_UnsupportedFormat_ID 6 - - // - BOOLEAN TapeSnapped; - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_TapeSnapped_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_TapeSnapped_ID 7 - - // - BOOLEAN DriveRequiresCleaning; - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_DriveRequiresCleaning_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_DriveRequiresCleaning_ID 8 - - // - BOOLEAN TimetoCleanDrive; - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_TimetoCleanDrive_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_TimetoCleanDrive_ID 9 - - // - BOOLEAN DriveHardwareError; - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_DriveHardwareError_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_DriveHardwareError_ID 10 - - // - BOOLEAN ScsiInterfaceError; - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_ScsiInterfaceError_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_ScsiInterfaceError_ID 11 - - // - BOOLEAN MediaLife; - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_MediaLife_SIZE sizeof(BOOLEAN) - #define WMI_TAPE_PROBLEM_DEVICE_ERROR_MediaLife_ID 12 - -} WMI_TAPE_PROBLEM_DEVICE_ERROR, *PWMI_TAPE_PROBLEM_DEVICE_ERROR; - -#define WMI_TAPE_PROBLEM_DEVICE_ERROR_SIZE (FIELD_OFFSET(WMI_TAPE_PROBLEM_DEVICE_ERROR, MediaLife) + WMI_TAPE_PROBLEM_DEVICE_ERROR_MediaLife_SIZE) - -// MSChangerParameters - WMI_CHANGER_PARAMETERS -#define WMI_CHANGER_PARAMETERS_GUID \ - { 0x24eb52ac,0x7c77,0x438b, { 0xab,0x61,0xd0,0x24,0xda,0xb0,0xc0,0x3a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSChangerParameters_GUID, \ - 0x24eb52ac,0x7c77,0x438b,0xab,0x61,0xd0,0x24,0xda,0xb0,0xc0,0x3a); -#endif - - -typedef struct _WMI_CHANGER_PARAMETERS -{ - // - ULONG NumberOfSlots; - #define WMI_CHANGER_PARAMETERS_NumberOfSlots_SIZE sizeof(ULONG) - #define WMI_CHANGER_PARAMETERS_NumberOfSlots_ID 1 - - // - ULONG NumberOfDrives; - #define WMI_CHANGER_PARAMETERS_NumberOfDrives_SIZE sizeof(ULONG) - #define WMI_CHANGER_PARAMETERS_NumberOfDrives_ID 2 - - // - ULONG NumberOfIEPorts; - #define WMI_CHANGER_PARAMETERS_NumberOfIEPorts_SIZE sizeof(ULONG) - #define WMI_CHANGER_PARAMETERS_NumberOfIEPorts_ID 3 - - // - ULONG NumberOfTransports; - #define WMI_CHANGER_PARAMETERS_NumberOfTransports_SIZE sizeof(ULONG) - #define WMI_CHANGER_PARAMETERS_NumberOfTransports_ID 4 - - // - ULONG NumberOfDoors; - #define WMI_CHANGER_PARAMETERS_NumberOfDoors_SIZE sizeof(ULONG) - #define WMI_CHANGER_PARAMETERS_NumberOfDoors_ID 5 - - // - ULONG NumberOfCleanerSlots; - #define WMI_CHANGER_PARAMETERS_NumberOfCleanerSlots_SIZE sizeof(ULONG) - #define WMI_CHANGER_PARAMETERS_NumberOfCleanerSlots_ID 6 - - // - ULONG MagazineSize; - #define WMI_CHANGER_PARAMETERS_MagazineSize_SIZE sizeof(ULONG) - #define WMI_CHANGER_PARAMETERS_MagazineSize_ID 7 - -} WMI_CHANGER_PARAMETERS, *PWMI_CHANGER_PARAMETERS; - -#define WMI_CHANGER_PARAMETERS_SIZE (FIELD_OFFSET(WMI_CHANGER_PARAMETERS, MagazineSize) + WMI_CHANGER_PARAMETERS_MagazineSize_SIZE) - -// MSChangerProblemEvent - WMI_CHANGER_PROBLEM_WARNING -#define WMI_CHANGER_PROBLEM_WARNING_GUID \ - { 0x45db06a5,0x20d5,0x4de3, { 0xa3,0x6c,0x3a,0xb9,0x74,0x60,0x0a,0x4c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSChangerProblemEvent_GUID, \ - 0x45db06a5,0x20d5,0x4de3,0xa3,0x6c,0x3a,0xb9,0x74,0x60,0x0a,0x4c); -#endif - - -typedef struct _WMI_CHANGER_PROBLEM_WARNING -{ - // - ULONG ChangerProblemType; - #define WMI_CHANGER_PROBLEM_WARNING_ChangerProblemType_SIZE sizeof(ULONG) - #define WMI_CHANGER_PROBLEM_WARNING_ChangerProblemType_ID 1 - - // - UCHAR ChangerData[512]; - #define WMI_CHANGER_PROBLEM_WARNING_ChangerData_SIZE sizeof(UCHAR[512]) - #define WMI_CHANGER_PROBLEM_WARNING_ChangerData_ID 2 - -} WMI_CHANGER_PROBLEM_WARNING, *PWMI_CHANGER_PROBLEM_WARNING; - -#define WMI_CHANGER_PROBLEM_WARNING_SIZE (FIELD_OFFSET(WMI_CHANGER_PROBLEM_WARNING, ChangerData) + WMI_CHANGER_PROBLEM_WARNING_ChangerData_SIZE) - -// MSChangerProblemDeviceError - WMI_CHANGER_PROBLEM_DEVICE_ERROR -#define WMI_CHANGER_PROBLEM_DEVICE_ERROR_GUID \ - { 0x56b396a8,0x0b95,0x42fe, { 0xbb,0xce,0xd3,0x6f,0xda,0x90,0x4f,0x8e } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSChangerProblemDeviceError_GUID, \ - 0x56b396a8,0x0b95,0x42fe,0xbb,0xce,0xd3,0x6f,0xda,0x90,0x4f,0x8e); -#endif - - -typedef struct _WMI_CHANGER_PROBLEM_DEVICE_ERROR -{ - // - ULONG ChangerProblemType; - #define WMI_CHANGER_PROBLEM_DEVICE_ERROR_ChangerProblemType_SIZE sizeof(ULONG) - #define WMI_CHANGER_PROBLEM_DEVICE_ERROR_ChangerProblemType_ID 1 - -} WMI_CHANGER_PROBLEM_DEVICE_ERROR, *PWMI_CHANGER_PROBLEM_DEVICE_ERROR; - -#define WMI_CHANGER_PROBLEM_DEVICE_ERROR_SIZE (FIELD_OFFSET(WMI_CHANGER_PROBLEM_DEVICE_ERROR, ChangerProblemType) + WMI_CHANGER_PROBLEM_DEVICE_ERROR_ChangerProblemType_SIZE) - -// MSDeviceUI_FirmwareRevision - DEVICE_UI_FIRMWARE_REVISION -#define DEVICE_UI_FIRMWARE_REVISION_GUID \ - { 0x4504b1d4,0xc5ee,0x4df6, { 0x95,0x1f,0x16,0x18,0x0e,0x3d,0xd8,0x15 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSDeviceUI_FirmwareRevision_GUID, \ - 0x4504b1d4,0xc5ee,0x4df6,0x95,0x1f,0x16,0x18,0x0e,0x3d,0xd8,0x15); -#endif - - -typedef struct _DEVICE_UI_FIRMWARE_REVISION -{ - // - CHAR VariableData[1]; - #define DEVICE_UI_FIRMWARE_REVISION_FirmwareRevision_ID 1 - -} DEVICE_UI_FIRMWARE_REVISION, *PDEVICE_UI_FIRMWARE_REVISION; - -// MSVerifierIrpLogEntry - MSVerifierIrpLogEntry -#define MSVerifierIrpLogEntryGuid \ - { 0x45068237,0x595d,0x4c7d, { 0xbd,0x80,0xf8,0x4a,0xdc,0x02,0x57,0xf8 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSVerifierIrpLogEntry_GUID, \ - 0x45068237,0x595d,0x4c7d,0xbd,0x80,0xf8,0x4a,0xdc,0x02,0x57,0xf8); -#endif - - -typedef struct _MSVerifierIrpLogEntry -{ - // Count - ULONG Count; - #define MSVerifierIrpLogEntry_Count_SIZE sizeof(ULONG) - #define MSVerifierIrpLogEntry_Count_ID 1 - - // Major Function - UCHAR Major; - #define MSVerifierIrpLogEntry_Major_SIZE sizeof(UCHAR) - #define MSVerifierIrpLogEntry_Major_ID 2 - - // Minor Function - UCHAR Minor; - #define MSVerifierIrpLogEntry_Minor_SIZE sizeof(UCHAR) - #define MSVerifierIrpLogEntry_Minor_ID 3 - - // Flags - UCHAR Flags; - #define MSVerifierIrpLogEntry_Flags_SIZE sizeof(UCHAR) - #define MSVerifierIrpLogEntry_Flags_ID 4 - - // Control - UCHAR Control; - #define MSVerifierIrpLogEntry_Control_SIZE sizeof(UCHAR) - #define MSVerifierIrpLogEntry_Control_ID 5 - - // Arg1 - ULONGLONG Arg1; - #define MSVerifierIrpLogEntry_Arg1_SIZE sizeof(ULONGLONG) - #define MSVerifierIrpLogEntry_Arg1_ID 6 - - // Arg2 - ULONGLONG Arg2; - #define MSVerifierIrpLogEntry_Arg2_SIZE sizeof(ULONGLONG) - #define MSVerifierIrpLogEntry_Arg2_ID 7 - - // Arg3 - ULONGLONG Arg3; - #define MSVerifierIrpLogEntry_Arg3_SIZE sizeof(ULONGLONG) - #define MSVerifierIrpLogEntry_Arg3_ID 8 - - // Arg4 - ULONGLONG Arg4; - #define MSVerifierIrpLogEntry_Arg4_SIZE sizeof(ULONGLONG) - #define MSVerifierIrpLogEntry_Arg4_ID 9 - -} MSVerifierIrpLogEntry, *PMSVerifierIrpLogEntry; - -#define MSVerifierIrpLogEntry_SIZE (FIELD_OFFSET(MSVerifierIrpLogEntry, Arg4) + MSVerifierIrpLogEntry_Arg4_SIZE) - -// MSVerifierIrpLogInformation - MSVerifierIrpLogInformation -// Verifier kernel information -#define MSVerifierIrpLogInformationGuid \ - { 0x1e2c2980,0xf7db,0x46aa, { 0x82,0x0e,0x87,0x34,0xfc,0xc2,0x1f,0x4c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(MSVerifierIrpLogInformation_GUID, \ - 0x1e2c2980,0xf7db,0x46aa,0x82,0x0e,0x87,0x34,0xfc,0xc2,0x1f,0x4c); -#endif - - -typedef struct _MSVerifierIrpLogInformation -{ - // DeviceType - ULONG DeviceType; - #define MSVerifierIrpLogInformation_DeviceType_SIZE sizeof(ULONG) - #define MSVerifierIrpLogInformation_DeviceType_ID 1 - - // - ULONG EntryCount; - #define MSVerifierIrpLogInformation_EntryCount_SIZE sizeof(ULONG) - #define MSVerifierIrpLogInformation_EntryCount_ID 2 - - // - MSVerifierIrpLogEntry Entries[1]; - #define MSVerifierIrpLogInformation_Entries_ID 3 - -} MSVerifierIrpLogInformation, *PMSVerifierIrpLogInformation; - -// WmiMonitorBrightness - WmiMonitorBrightness -#define WmiMonitorBrightnessGuid \ - { 0xd43412ac,0x67f9,0x4fbb, { 0xa0,0x81,0x17,0x52,0xa2,0xc3,0x3e,0x84 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorBrightness_GUID, \ - 0xd43412ac,0x67f9,0x4fbb,0xa0,0x81,0x17,0x52,0xa2,0xc3,0x3e,0x84); -#endif - - -typedef struct _WmiMonitorBrightness -{ - // - UCHAR CurrentBrightness; - #define WmiMonitorBrightness_CurrentBrightness_SIZE sizeof(UCHAR) - #define WmiMonitorBrightness_CurrentBrightness_ID 1 - - // - ULONG Levels; - #define WmiMonitorBrightness_Levels_SIZE sizeof(ULONG) - #define WmiMonitorBrightness_Levels_ID 2 - - // - UCHAR Level[1]; - #define WmiMonitorBrightness_Level_ID 3 - -} WmiMonitorBrightness, *PWmiMonitorBrightness; - -// WmiMonitorBrightnessMethods - WmiMonitorBrightnessMethods -#define WmiMonitorBrightnessMethodsGuid \ - { 0x479b20b4,0x5559,0x46fe, { 0xbe,0x97,0x7d,0x22,0x21,0x54,0x42,0x1f } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorBrightnessMethods_GUID, \ - 0x479b20b4,0x5559,0x46fe,0xbe,0x97,0x7d,0x22,0x21,0x54,0x42,0x1f); -#endif - -// -// Method id definitions for WmiMonitorBrightnessMethods -#define WmiSetBrightness 1 -typedef struct _WmiSetBrightness_IN -{ - // - ULONG Timeout; - #define WmiSetBrightness_IN_Timeout_SIZE sizeof(ULONG) - #define WmiSetBrightness_IN_Timeout_ID 1 - - // - UCHAR Brightness; - #define WmiSetBrightness_IN_Brightness_SIZE sizeof(UCHAR) - #define WmiSetBrightness_IN_Brightness_ID 2 - -} WmiSetBrightness_IN, *PWmiSetBrightness_IN; - -#define WmiSetBrightness_IN_SIZE (FIELD_OFFSET(WmiSetBrightness_IN, Brightness) + WmiSetBrightness_IN_Brightness_SIZE) - -#define WmiRevertToPolicyBrightness 2 -#define WmiSetALSBrightnessState 3 -typedef struct _WmiSetALSBrightnessState_IN -{ - // - BOOLEAN State; - #define WmiSetALSBrightnessState_IN_State_SIZE sizeof(BOOLEAN) - #define WmiSetALSBrightnessState_IN_State_ID 1 - -} WmiSetALSBrightnessState_IN, *PWmiSetALSBrightnessState_IN; - -#define WmiSetALSBrightnessState_IN_SIZE (FIELD_OFFSET(WmiSetALSBrightnessState_IN, State) + WmiSetALSBrightnessState_IN_State_SIZE) - -#define WmiSetALSBrightness 4 -typedef struct _WmiSetALSBrightness_IN -{ - // - UCHAR Brightness; - #define WmiSetALSBrightness_IN_Brightness_SIZE sizeof(UCHAR) - #define WmiSetALSBrightness_IN_Brightness_ID 1 - -} WmiSetALSBrightness_IN, *PWmiSetALSBrightness_IN; - -#define WmiSetALSBrightness_IN_SIZE (FIELD_OFFSET(WmiSetALSBrightness_IN, Brightness) + WmiSetALSBrightness_IN_Brightness_SIZE) - - -// WmiMonitorBrightnessEvent - WmiMonitorBrightnessEvent -// Monitor brightness change event -#define WmiMonitorBrightnessEventGuid \ - { 0x123c80d2,0x937f,0x4cfe, { 0x80,0xf4,0xc4,0x0d,0x59,0x6e,0x48,0xb7 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorBrightnessEvent_GUID, \ - 0x123c80d2,0x937f,0x4cfe,0x80,0xf4,0xc4,0x0d,0x59,0x6e,0x48,0xb7); -#endif - - -typedef struct _WmiMonitorBrightnessEvent -{ - // - UCHAR Brightness; - #define WmiMonitorBrightnessEvent_Brightness_SIZE sizeof(UCHAR) - #define WmiMonitorBrightnessEvent_Brightness_ID 1 - -} WmiMonitorBrightnessEvent, *PWmiMonitorBrightnessEvent; - -#define WmiMonitorBrightnessEvent_SIZE (FIELD_OFFSET(WmiMonitorBrightnessEvent, Brightness) + WmiMonitorBrightnessEvent_Brightness_SIZE) - -// WmiMonitorRawEEdidV1Block - WmiMonitorRawEEdidV1Block -#define WmiMonitorRawEEdidV1BlockGuid \ - { 0xfaee1471,0x5149,0x4a68, { 0xac,0x2c,0xbf,0x96,0xec,0x09,0xf0,0x04 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorRawEEdidV1Block_GUID, \ - 0xfaee1471,0x5149,0x4a68,0xac,0x2c,0xbf,0x96,0xec,0x09,0xf0,0x04); -#endif - - -typedef struct _WmiMonitorRawEEdidV1Block -{ - // - UCHAR Id; - #define WmiMonitorRawEEdidV1Block_Id_SIZE sizeof(UCHAR) - #define WmiMonitorRawEEdidV1Block_Id_ID 1 - - // - UCHAR Type; - #define WmiMonitorRawEEdidV1Block_Type_SIZE sizeof(UCHAR) - #define WmiMonitorRawEEdidV1Block_Type_ID 2 - - // - UCHAR Content[128]; - #define WmiMonitorRawEEdidV1Block_Content_SIZE sizeof(UCHAR[128]) - #define WmiMonitorRawEEdidV1Block_Content_ID 3 - -} WmiMonitorRawEEdidV1Block, *PWmiMonitorRawEEdidV1Block; - -#define WmiMonitorRawEEdidV1Block_SIZE (FIELD_OFFSET(WmiMonitorRawEEdidV1Block, Content) + WmiMonitorRawEEdidV1Block_Content_SIZE) - -// WmiMonitorDescriptorMethods - WmiMonitorDescriptorMethods -#define WmiMonitorDescriptorMethodsGuid \ - { 0x5341576e,0x75c4,0x4aeb, { 0xa8,0x2b,0x87,0x3c,0xd3,0xc6,0xb3,0x84 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorDescriptorMethods_GUID, \ - 0x5341576e,0x75c4,0x4aeb,0xa8,0x2b,0x87,0x3c,0xd3,0xc6,0xb3,0x84); -#endif - -// -// Method id definitions for WmiMonitorDescriptorMethods -#define WmiGetMonitorRawEEdidV1Block 1 -typedef struct _WmiGetMonitorRawEEdidV1Block_IN -{ - // - UCHAR BlockId; - #define WmiGetMonitorRawEEdidV1Block_IN_BlockId_SIZE sizeof(UCHAR) - #define WmiGetMonitorRawEEdidV1Block_IN_BlockId_ID 1 - -} WmiGetMonitorRawEEdidV1Block_IN, *PWmiGetMonitorRawEEdidV1Block_IN; - -#define WmiGetMonitorRawEEdidV1Block_IN_SIZE (FIELD_OFFSET(WmiGetMonitorRawEEdidV1Block_IN, BlockId) + WmiGetMonitorRawEEdidV1Block_IN_BlockId_SIZE) - -typedef struct _WmiGetMonitorRawEEdidV1Block_OUT -{ - // - UCHAR BlockType; - #define WmiGetMonitorRawEEdidV1Block_OUT_BlockType_SIZE sizeof(UCHAR) - #define WmiGetMonitorRawEEdidV1Block_OUT_BlockType_ID 2 - - // - UCHAR BlockContent[128]; - #define WmiGetMonitorRawEEdidV1Block_OUT_BlockContent_SIZE sizeof(UCHAR[128]) - #define WmiGetMonitorRawEEdidV1Block_OUT_BlockContent_ID 3 - -} WmiGetMonitorRawEEdidV1Block_OUT, *PWmiGetMonitorRawEEdidV1Block_OUT; - -#define WmiGetMonitorRawEEdidV1Block_OUT_SIZE (FIELD_OFFSET(WmiGetMonitorRawEEdidV1Block_OUT, BlockContent) + WmiGetMonitorRawEEdidV1Block_OUT_BlockContent_SIZE) - - -// WmiMonitorID - WmiMonitorID -#define WmiMonitorIDGuid \ - { 0x671a8285,0x4edb,0x4cae, { 0x99,0xfe,0x69,0xa1,0x5c,0x48,0xc0,0xbc } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorID_GUID, \ - 0x671a8285,0x4edb,0x4cae,0x99,0xfe,0x69,0xa1,0x5c,0x48,0xc0,0xbc); -#endif - - -typedef struct _WmiMonitorID -{ - // - USHORT ProductCodeID[16]; - #define WmiMonitorID_ProductCodeID_SIZE sizeof(USHORT[16]) - #define WmiMonitorID_ProductCodeID_ID 1 - - // - USHORT SerialNumberID[16]; - #define WmiMonitorID_SerialNumberID_SIZE sizeof(USHORT[16]) - #define WmiMonitorID_SerialNumberID_ID 2 - - // - USHORT ManufacturerName[16]; - #define WmiMonitorID_ManufacturerName_SIZE sizeof(USHORT[16]) - #define WmiMonitorID_ManufacturerName_ID 3 - - // - UCHAR WeekOfManufacture; - #define WmiMonitorID_WeekOfManufacture_SIZE sizeof(UCHAR) - #define WmiMonitorID_WeekOfManufacture_ID 4 - - // - USHORT YearOfManufacture; - #define WmiMonitorID_YearOfManufacture_SIZE sizeof(USHORT) - #define WmiMonitorID_YearOfManufacture_ID 5 - - // - USHORT UserFriendlyNameLength; - #define WmiMonitorID_UserFriendlyNameLength_SIZE sizeof(USHORT) - #define WmiMonitorID_UserFriendlyNameLength_ID 6 - - // - USHORT UserFriendlyName[1]; - #define WmiMonitorID_UserFriendlyName_ID 7 - -} WmiMonitorID, *PWmiMonitorID; - -// WmiMonitorSupportedDisplayFeatures - WmiMonitorSupportedDisplayFeatures -#define WmiMonitorSupportedDisplayFeaturesGuid \ - { 0x9fa9c28b,0x5e5c,0x4035, { 0xa5,0xf8,0x67,0xd4,0x55,0x4f,0x8d,0x04 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorSupportedDisplayFeatures_GUID, \ - 0x9fa9c28b,0x5e5c,0x4035,0xa5,0xf8,0x67,0xd4,0x55,0x4f,0x8d,0x04); -#endif - - -typedef struct _WmiMonitorSupportedDisplayFeatures -{ - // - BOOLEAN StandbySupported; - #define WmiMonitorSupportedDisplayFeatures_StandbySupported_SIZE sizeof(BOOLEAN) - #define WmiMonitorSupportedDisplayFeatures_StandbySupported_ID 1 - - // - BOOLEAN SuspendSupported; - #define WmiMonitorSupportedDisplayFeatures_SuspendSupported_SIZE sizeof(BOOLEAN) - #define WmiMonitorSupportedDisplayFeatures_SuspendSupported_ID 2 - - // - BOOLEAN ActiveOffSupported; - #define WmiMonitorSupportedDisplayFeatures_ActiveOffSupported_SIZE sizeof(BOOLEAN) - #define WmiMonitorSupportedDisplayFeatures_ActiveOffSupported_ID 3 - - // - UCHAR DisplayType; - #define WmiMonitorSupportedDisplayFeatures_DisplayType_SIZE sizeof(UCHAR) - #define WmiMonitorSupportedDisplayFeatures_DisplayType_ID 4 - - // - BOOLEAN sRGBSupported; - #define WmiMonitorSupportedDisplayFeatures_sRGBSupported_SIZE sizeof(BOOLEAN) - #define WmiMonitorSupportedDisplayFeatures_sRGBSupported_ID 5 - - // - BOOLEAN HasPreferredTimingMode; - #define WmiMonitorSupportedDisplayFeatures_HasPreferredTimingMode_SIZE sizeof(BOOLEAN) - #define WmiMonitorSupportedDisplayFeatures_HasPreferredTimingMode_ID 6 - - // - BOOLEAN GTFSupported; - #define WmiMonitorSupportedDisplayFeatures_GTFSupported_SIZE sizeof(BOOLEAN) - #define WmiMonitorSupportedDisplayFeatures_GTFSupported_ID 7 - -} WmiMonitorSupportedDisplayFeatures, *PWmiMonitorSupportedDisplayFeatures; - -#define WmiMonitorSupportedDisplayFeatures_SIZE (FIELD_OFFSET(WmiMonitorSupportedDisplayFeatures, GTFSupported) + WmiMonitorSupportedDisplayFeatures_GTFSupported_SIZE) - -// WmiMonitorBasicDisplayParams - WmiMonitorBasicDisplayParams -#define WmiMonitorBasicDisplayParamsGuid \ - { 0x9831b7e6,0x09ac,0x491f, { 0x8d,0x07,0x3c,0x3d,0x64,0x9d,0x82,0x40 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorBasicDisplayParams_GUID, \ - 0x9831b7e6,0x09ac,0x491f,0x8d,0x07,0x3c,0x3d,0x64,0x9d,0x82,0x40); -#endif - - -typedef struct _WmiMonitorBasicDisplayParams -{ - // - UCHAR VideoInputType; - #define WmiMonitorBasicDisplayParams_VideoInputType_SIZE sizeof(UCHAR) - #define WmiMonitorBasicDisplayParams_VideoInputType_ID 1 - - // - UCHAR MaxHorizontalImageSize; - #define WmiMonitorBasicDisplayParams_MaxHorizontalImageSize_SIZE sizeof(UCHAR) - #define WmiMonitorBasicDisplayParams_MaxHorizontalImageSize_ID 2 - - // - UCHAR MaxVerticalImageSize; - #define WmiMonitorBasicDisplayParams_MaxVerticalImageSize_SIZE sizeof(UCHAR) - #define WmiMonitorBasicDisplayParams_MaxVerticalImageSize_ID 3 - - // - UCHAR DisplayTransferCharacteristic; - #define WmiMonitorBasicDisplayParams_DisplayTransferCharacteristic_SIZE sizeof(UCHAR) - #define WmiMonitorBasicDisplayParams_DisplayTransferCharacteristic_ID 4 - - // - WmiMonitorSupportedDisplayFeatures SupportedDisplayFeatures; - #define WmiMonitorBasicDisplayParams_SupportedDisplayFeatures_SIZE sizeof(WmiMonitorSupportedDisplayFeatures) - #define WmiMonitorBasicDisplayParams_SupportedDisplayFeatures_ID 5 - -} WmiMonitorBasicDisplayParams, *PWmiMonitorBasicDisplayParams; - -#define WmiMonitorBasicDisplayParams_SIZE (FIELD_OFFSET(WmiMonitorBasicDisplayParams, SupportedDisplayFeatures) + WmiMonitorBasicDisplayParams_SupportedDisplayFeatures_SIZE) - -// WmiMonitorConnectionParams - WmiMonitorConnectionParams -#define WmiMonitorConnectionParamsGuid \ - { 0x2e2d2463,0xb537,0x4da7, { 0x8e,0xee,0x51,0x30,0x6f,0x1f,0x48,0x2f } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorConnectionParams_GUID, \ - 0x2e2d2463,0xb537,0x4da7,0x8e,0xee,0x51,0x30,0x6f,0x1f,0x48,0x2f); -#endif - - -typedef struct _WmiMonitorConnectionParams -{ - // - ULONG VideoOutputTechnology; - #define WmiMonitorConnectionParams_VideoOutputTechnology_SIZE sizeof(ULONG) - #define WmiMonitorConnectionParams_VideoOutputTechnology_ID 1 - -} WmiMonitorConnectionParams, *PWmiMonitorConnectionParams; - -#define WmiMonitorConnectionParams_SIZE (FIELD_OFFSET(WmiMonitorConnectionParams, VideoOutputTechnology) + WmiMonitorConnectionParams_VideoOutputTechnology_SIZE) - -// WmiMonitorAnalogVideoInputParams - WmiMonitorAnalogVideoInputParams -#define WmiMonitorAnalogVideoInputParamsGuid \ - { 0xa56dbcf9,0xc4f0,0x44a8, { 0x9c,0x1b,0xbb,0x3b,0x3f,0x77,0x4b,0x4d } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorAnalogVideoInputParams_GUID, \ - 0xa56dbcf9,0xc4f0,0x44a8,0x9c,0x1b,0xbb,0x3b,0x3f,0x77,0x4b,0x4d); -#endif - - -typedef struct _WmiMonitorAnalogVideoInputParams -{ - // - UCHAR SignalLevelStandard; - #define WmiMonitorAnalogVideoInputParams_SignalLevelStandard_SIZE sizeof(UCHAR) - #define WmiMonitorAnalogVideoInputParams_SignalLevelStandard_ID 1 - - // - UCHAR SetupExpected; - #define WmiMonitorAnalogVideoInputParams_SetupExpected_SIZE sizeof(UCHAR) - #define WmiMonitorAnalogVideoInputParams_SetupExpected_ID 2 - - // - UCHAR SeparateSyncsSupported; - #define WmiMonitorAnalogVideoInputParams_SeparateSyncsSupported_SIZE sizeof(UCHAR) - #define WmiMonitorAnalogVideoInputParams_SeparateSyncsSupported_ID 3 - - // - UCHAR CompositeSyncSupported; - #define WmiMonitorAnalogVideoInputParams_CompositeSyncSupported_SIZE sizeof(UCHAR) - #define WmiMonitorAnalogVideoInputParams_CompositeSyncSupported_ID 4 - - // - UCHAR SyncOnGreenVideoSupported; - #define WmiMonitorAnalogVideoInputParams_SyncOnGreenVideoSupported_SIZE sizeof(UCHAR) - #define WmiMonitorAnalogVideoInputParams_SyncOnGreenVideoSupported_ID 5 - - // - UCHAR SerrationOfVsyncRequired; - #define WmiMonitorAnalogVideoInputParams_SerrationOfVsyncRequired_SIZE sizeof(UCHAR) - #define WmiMonitorAnalogVideoInputParams_SerrationOfVsyncRequired_ID 6 - -} WmiMonitorAnalogVideoInputParams, *PWmiMonitorAnalogVideoInputParams; - -#define WmiMonitorAnalogVideoInputParams_SIZE (FIELD_OFFSET(WmiMonitorAnalogVideoInputParams, SerrationOfVsyncRequired) + WmiMonitorAnalogVideoInputParams_SerrationOfVsyncRequired_SIZE) - -// WmiMonitorDigitalVideoInputParams - WmiMonitorDigitalVideoInputParams -#define WmiMonitorDigitalVideoInputParamsGuid \ - { 0x51565945,0x498a,0x4a77, { 0xac,0xc6,0x15,0x1b,0xec,0xc8,0x05,0xca } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorDigitalVideoInputParams_GUID, \ - 0x51565945,0x498a,0x4a77,0xac,0xc6,0x15,0x1b,0xec,0xc8,0x05,0xca); -#endif - - -typedef struct _WmiMonitorDigitalVideoInputParams -{ - // - BOOLEAN IsDFP1xCompatible; - #define WmiMonitorDigitalVideoInputParams_IsDFP1xCompatible_SIZE sizeof(BOOLEAN) - #define WmiMonitorDigitalVideoInputParams_IsDFP1xCompatible_ID 1 - -} WmiMonitorDigitalVideoInputParams, *PWmiMonitorDigitalVideoInputParams; - -#define WmiMonitorDigitalVideoInputParams_SIZE (FIELD_OFFSET(WmiMonitorDigitalVideoInputParams, IsDFP1xCompatible) + WmiMonitorDigitalVideoInputParams_IsDFP1xCompatible_SIZE) - -// WmiMonitorColorXYZinCIE - WmiMonitorColorXYZinCIE -#define WmiMonitorColorXYZinCIEGuid \ - { 0x01faf041,0x842c,0x4230, { 0xa3,0x1e,0x13,0x35,0x42,0x8c,0xd8,0xf0 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorColorXYZinCIE_GUID, \ - 0x01faf041,0x842c,0x4230,0xa3,0x1e,0x13,0x35,0x42,0x8c,0xd8,0xf0); -#endif - - -typedef struct _WmiMonitorColorXYZinCIE -{ - // - USHORT X; - #define WmiMonitorColorXYZinCIE_X_SIZE sizeof(USHORT) - #define WmiMonitorColorXYZinCIE_X_ID 1 - - // - USHORT Y; - #define WmiMonitorColorXYZinCIE_Y_SIZE sizeof(USHORT) - #define WmiMonitorColorXYZinCIE_Y_ID 2 - -} WmiMonitorColorXYZinCIE, *PWmiMonitorColorXYZinCIE; - -#define WmiMonitorColorXYZinCIE_SIZE (FIELD_OFFSET(WmiMonitorColorXYZinCIE, Y) + WmiMonitorColorXYZinCIE_Y_SIZE) - -// WmiMonitorColorCharacteristics - WmiMonitorColorCharacteristics -#define WmiMonitorColorCharacteristicsGuid \ - { 0xea324793,0x51bb,0x486a, { 0xaa,0x9d,0x0f,0x55,0x52,0x35,0x34,0x13 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorColorCharacteristics_GUID, \ - 0xea324793,0x51bb,0x486a,0xaa,0x9d,0x0f,0x55,0x52,0x35,0x34,0x13); -#endif - - -typedef struct _WmiMonitorColorCharacteristics -{ - // - WmiMonitorColorXYZinCIE Red; - #define WmiMonitorColorCharacteristics_Red_SIZE sizeof(WmiMonitorColorXYZinCIE) - #define WmiMonitorColorCharacteristics_Red_ID 1 - - // - WmiMonitorColorXYZinCIE Blue; - #define WmiMonitorColorCharacteristics_Blue_SIZE sizeof(WmiMonitorColorXYZinCIE) - #define WmiMonitorColorCharacteristics_Blue_ID 2 - - // - WmiMonitorColorXYZinCIE Green; - #define WmiMonitorColorCharacteristics_Green_SIZE sizeof(WmiMonitorColorXYZinCIE) - #define WmiMonitorColorCharacteristics_Green_ID 3 - - // - WmiMonitorColorXYZinCIE DefaultWhite; - #define WmiMonitorColorCharacteristics_DefaultWhite_SIZE sizeof(WmiMonitorColorXYZinCIE) - #define WmiMonitorColorCharacteristics_DefaultWhite_ID 4 - -} WmiMonitorColorCharacteristics, *PWmiMonitorColorCharacteristics; - -#define WmiMonitorColorCharacteristics_SIZE (FIELD_OFFSET(WmiMonitorColorCharacteristics, DefaultWhite) + WmiMonitorColorCharacteristics_DefaultWhite_SIZE) - -// VideoModeDescriptor - VideoModeDescriptor -#define VideoModeDescriptorGuid \ - { 0x4a97ed30,0xbfaa,0x491a, { 0x9d,0xfd,0xb4,0x3a,0xde,0xdb,0xf8,0xe3 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(VideoModeDescriptor_GUID, \ - 0x4a97ed30,0xbfaa,0x491a,0x9d,0xfd,0xb4,0x3a,0xde,0xdb,0xf8,0xe3); -#endif - - -typedef struct _VideoModeDescriptor -{ - // - ULONG PixelClockRate; - #define VideoModeDescriptor_PixelClockRate_SIZE sizeof(ULONG) - #define VideoModeDescriptor_PixelClockRate_ID 1 - - // - ULONG VerticalRefreshRateNumerator; - #define VideoModeDescriptor_VerticalRefreshRateNumerator_SIZE sizeof(ULONG) - #define VideoModeDescriptor_VerticalRefreshRateNumerator_ID 2 - - // - ULONG VerticalRefreshRateDenominator; - #define VideoModeDescriptor_VerticalRefreshRateDenominator_SIZE sizeof(ULONG) - #define VideoModeDescriptor_VerticalRefreshRateDenominator_ID 3 - - // - ULONG HorizontalRefreshRateNumerator; - #define VideoModeDescriptor_HorizontalRefreshRateNumerator_SIZE sizeof(ULONG) - #define VideoModeDescriptor_HorizontalRefreshRateNumerator_ID 4 - - // - ULONG HorizontalRefreshRateDenominator; - #define VideoModeDescriptor_HorizontalRefreshRateDenominator_SIZE sizeof(ULONG) - #define VideoModeDescriptor_HorizontalRefreshRateDenominator_ID 5 - - // - USHORT HorizontalActivePixels; - #define VideoModeDescriptor_HorizontalActivePixels_SIZE sizeof(USHORT) - #define VideoModeDescriptor_HorizontalActivePixels_ID 6 - - // - USHORT VerticalActivePixels; - #define VideoModeDescriptor_VerticalActivePixels_SIZE sizeof(USHORT) - #define VideoModeDescriptor_VerticalActivePixels_ID 7 - - // - USHORT HorizontalBlankingPixels; - #define VideoModeDescriptor_HorizontalBlankingPixels_SIZE sizeof(USHORT) - #define VideoModeDescriptor_HorizontalBlankingPixels_ID 8 - - // - USHORT VerticalBlankingPixels; - #define VideoModeDescriptor_VerticalBlankingPixels_SIZE sizeof(USHORT) - #define VideoModeDescriptor_VerticalBlankingPixels_ID 9 - - // - USHORT HorizontalSyncOffset; - #define VideoModeDescriptor_HorizontalSyncOffset_SIZE sizeof(USHORT) - #define VideoModeDescriptor_HorizontalSyncOffset_ID 10 - - // - USHORT VerticalSyncOffset; - #define VideoModeDescriptor_VerticalSyncOffset_SIZE sizeof(USHORT) - #define VideoModeDescriptor_VerticalSyncOffset_ID 11 - - // - USHORT HorizontalSyncPulseWidth; - #define VideoModeDescriptor_HorizontalSyncPulseWidth_SIZE sizeof(USHORT) - #define VideoModeDescriptor_HorizontalSyncPulseWidth_ID 12 - - // - USHORT VerticalSyncPulseWidth; - #define VideoModeDescriptor_VerticalSyncPulseWidth_SIZE sizeof(USHORT) - #define VideoModeDescriptor_VerticalSyncPulseWidth_ID 13 - - // - USHORT HorizontalImageSize; - #define VideoModeDescriptor_HorizontalImageSize_SIZE sizeof(USHORT) - #define VideoModeDescriptor_HorizontalImageSize_ID 14 - - // - USHORT VerticalImageSize; - #define VideoModeDescriptor_VerticalImageSize_SIZE sizeof(USHORT) - #define VideoModeDescriptor_VerticalImageSize_ID 15 - - // - USHORT HorizontalBorder; - #define VideoModeDescriptor_HorizontalBorder_SIZE sizeof(USHORT) - #define VideoModeDescriptor_HorizontalBorder_ID 16 - - // - USHORT VerticalBorder; - #define VideoModeDescriptor_VerticalBorder_SIZE sizeof(USHORT) - #define VideoModeDescriptor_VerticalBorder_ID 17 - - // - BOOLEAN IsInterlaced; - #define VideoModeDescriptor_IsInterlaced_SIZE sizeof(BOOLEAN) - #define VideoModeDescriptor_IsInterlaced_ID 18 - - // - UCHAR StereoModeType; - #define VideoModeDescriptor_StereoModeType_SIZE sizeof(UCHAR) - #define VideoModeDescriptor_StereoModeType_ID 19 - - // - UCHAR SyncSignalType; - #define VideoModeDescriptor_SyncSignalType_SIZE sizeof(UCHAR) - #define VideoModeDescriptor_SyncSignalType_ID 20 - - // - UCHAR IsSerrationRequired; - #define VideoModeDescriptor_IsSerrationRequired_SIZE sizeof(UCHAR) - #define VideoModeDescriptor_IsSerrationRequired_ID 21 - - // - UCHAR IsSyncOnRGB; - #define VideoModeDescriptor_IsSyncOnRGB_SIZE sizeof(UCHAR) - #define VideoModeDescriptor_IsSyncOnRGB_ID 22 - - // - UCHAR CompositePolarityType; - #define VideoModeDescriptor_CompositePolarityType_SIZE sizeof(UCHAR) - #define VideoModeDescriptor_CompositePolarityType_ID 23 - - // - UCHAR VerticalPolarityType; - #define VideoModeDescriptor_VerticalPolarityType_SIZE sizeof(UCHAR) - #define VideoModeDescriptor_VerticalPolarityType_ID 24 - - // - UCHAR HorizontalPolarityType; - #define VideoModeDescriptor_HorizontalPolarityType_SIZE sizeof(UCHAR) - #define VideoModeDescriptor_HorizontalPolarityType_ID 25 - - // - UCHAR VideoStandardType; - #define VideoModeDescriptor_VideoStandardType_SIZE sizeof(UCHAR) - #define VideoModeDescriptor_VideoStandardType_ID 26 - - // - UCHAR Origin; - #define VideoModeDescriptor_Origin_SIZE sizeof(UCHAR) - #define VideoModeDescriptor_Origin_ID 27 - - // - UCHAR TimingType; - #define VideoModeDescriptor_TimingType_SIZE sizeof(UCHAR) - #define VideoModeDescriptor_TimingType_ID 28 - -} VideoModeDescriptor, *PVideoModeDescriptor; - -#define VideoModeDescriptor_SIZE (FIELD_OFFSET(VideoModeDescriptor, TimingType) + VideoModeDescriptor_TimingType_SIZE) - -// WmiMonitorListedSupportedSourceModes - WmiMonitorListedSupportedSourceModes -#define WmiMonitorListedSupportedSourceModesGuid \ - { 0x6dc76655,0x063c,0x4524, { 0xa8,0x62,0xb8,0x41,0x0c,0x26,0x28,0x1b } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorListedSupportedSourceModes_GUID, \ - 0x6dc76655,0x063c,0x4524,0xa8,0x62,0xb8,0x41,0x0c,0x26,0x28,0x1b); -#endif - - -typedef struct _WmiMonitorListedSupportedSourceModes -{ - // - USHORT NumOfMonitorSourceModes; - #define WmiMonitorListedSupportedSourceModes_NumOfMonitorSourceModes_SIZE sizeof(USHORT) - #define WmiMonitorListedSupportedSourceModes_NumOfMonitorSourceModes_ID 1 - - // - USHORT PreferredMonitorSourceModeIndex; - #define WmiMonitorListedSupportedSourceModes_PreferredMonitorSourceModeIndex_SIZE sizeof(USHORT) - #define WmiMonitorListedSupportedSourceModes_PreferredMonitorSourceModeIndex_ID 2 - - // - VideoModeDescriptor MonitorSourceModes[1]; - #define WmiMonitorListedSupportedSourceModes_MonitorSourceModes_ID 3 - -} WmiMonitorListedSupportedSourceModes, *PWmiMonitorListedSupportedSourceModes; - -// FrequencyRangeDescriptor - FrequencyRangeDescriptor -#define FrequencyRangeDescriptorGuid \ - { 0xf4546078,0xf3b2,0x417e, { 0x94,0xcd,0x47,0xea,0x30,0x6c,0x57,0x51 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(FrequencyRangeDescriptor_GUID, \ - 0xf4546078,0xf3b2,0x417e,0x94,0xcd,0x47,0xea,0x30,0x6c,0x57,0x51); -#endif - - -typedef struct _FrequencyRangeDescriptor -{ - // - UCHAR Origin; - #define FrequencyRangeDescriptor_Origin_SIZE sizeof(UCHAR) - #define FrequencyRangeDescriptor_Origin_ID 1 - - // - ULONG MinVSyncNumerator; - #define FrequencyRangeDescriptor_MinVSyncNumerator_SIZE sizeof(ULONG) - #define FrequencyRangeDescriptor_MinVSyncNumerator_ID 2 - - // - ULONG MinVSyncDenominator; - #define FrequencyRangeDescriptor_MinVSyncDenominator_SIZE sizeof(ULONG) - #define FrequencyRangeDescriptor_MinVSyncDenominator_ID 3 - - // - ULONG MaxVSyncNumerator; - #define FrequencyRangeDescriptor_MaxVSyncNumerator_SIZE sizeof(ULONG) - #define FrequencyRangeDescriptor_MaxVSyncNumerator_ID 4 - - // - ULONG MaxVSyncDenominator; - #define FrequencyRangeDescriptor_MaxVSyncDenominator_SIZE sizeof(ULONG) - #define FrequencyRangeDescriptor_MaxVSyncDenominator_ID 5 - - // - ULONG MinHSyncNumerator; - #define FrequencyRangeDescriptor_MinHSyncNumerator_SIZE sizeof(ULONG) - #define FrequencyRangeDescriptor_MinHSyncNumerator_ID 6 - - // - ULONG MinHSyncDenominator; - #define FrequencyRangeDescriptor_MinHSyncDenominator_SIZE sizeof(ULONG) - #define FrequencyRangeDescriptor_MinHSyncDenominator_ID 7 - - // - ULONG MaxHSyncNumerator; - #define FrequencyRangeDescriptor_MaxHSyncNumerator_SIZE sizeof(ULONG) - #define FrequencyRangeDescriptor_MaxHSyncNumerator_ID 8 - - // - ULONG MaxHSyncDenominator; - #define FrequencyRangeDescriptor_MaxHSyncDenominator_SIZE sizeof(ULONG) - #define FrequencyRangeDescriptor_MaxHSyncDenominator_ID 9 - - // - ULONG ConstraintType; - #define FrequencyRangeDescriptor_ConstraintType_SIZE sizeof(ULONG) - #define FrequencyRangeDescriptor_ConstraintType_ID 10 - - // - ULONG ActiveWidth; - #define FrequencyRangeDescriptor_ActiveWidth_SIZE sizeof(ULONG) - #define FrequencyRangeDescriptor_ActiveWidth_ID 11 - - // - ULONG ActiveHeight; - #define FrequencyRangeDescriptor_ActiveHeight_SIZE sizeof(ULONG) - #define FrequencyRangeDescriptor_ActiveHeight_ID 12 - - // - ULONG MaxPixelRate; - #define FrequencyRangeDescriptor_MaxPixelRate_SIZE sizeof(ULONG) - #define FrequencyRangeDescriptor_MaxPixelRate_ID 13 - -} FrequencyRangeDescriptor, *PFrequencyRangeDescriptor; - -#define FrequencyRangeDescriptor_SIZE (FIELD_OFFSET(FrequencyRangeDescriptor, MaxPixelRate) + FrequencyRangeDescriptor_MaxPixelRate_SIZE) - -// WmiMonitorListedFrequencyRanges - WmiMonitorListedFrequencyRanges -#define WmiMonitorListedFrequencyRangesGuid \ - { 0xe86e9525,0x65b6,0x4b85, { 0x95,0xc5,0x00,0xbe,0xac,0xc9,0x75,0xed } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(WmiMonitorListedFrequencyRanges_GUID, \ - 0xe86e9525,0x65b6,0x4b85,0x95,0xc5,0x00,0xbe,0xac,0xc9,0x75,0xed); -#endif - - -typedef struct _WmiMonitorListedFrequencyRanges -{ - // - USHORT NumOfMonitorFreqRanges; - #define WmiMonitorListedFrequencyRanges_NumOfMonitorFreqRanges_SIZE sizeof(USHORT) - #define WmiMonitorListedFrequencyRanges_NumOfMonitorFreqRanges_ID 1 - - // - FrequencyRangeDescriptor MonitorFreqRanges[1]; - #define WmiMonitorListedFrequencyRanges_MonitorFreqRanges_ID 2 - -} WmiMonitorListedFrequencyRanges, *PWmiMonitorListedFrequencyRanges; - -// KernelPerfState - KernelPerfState -#define KernelPerfStateGuid \ - { 0x8c7980e1,0xf62b,0x419e, { 0xaa,0x82,0x27,0x6c,0x8d,0x06,0x4a,0x1f } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(KernelPerfState_GUID, \ - 0x8c7980e1,0xf62b,0x419e,0xaa,0x82,0x27,0x6c,0x8d,0x06,0x4a,0x1f); -#endif - - -typedef struct _KernelPerfState -{ - // - ULONG Frequency; - #define KernelPerfState_Frequency_SIZE sizeof(ULONG) - #define KernelPerfState_Frequency_ID 1 - - // - ULONG Power; - #define KernelPerfState_Power_SIZE sizeof(ULONG) - #define KernelPerfState_Power_ID 2 - - // - UCHAR PercentFrequency; - #define KernelPerfState_PercentFrequency_SIZE sizeof(UCHAR) - #define KernelPerfState_PercentFrequency_ID 3 - - // - UCHAR IncreaseLevel; - #define KernelPerfState_IncreaseLevel_SIZE sizeof(UCHAR) - #define KernelPerfState_IncreaseLevel_ID 4 - - // - UCHAR DecreaseLevel; - #define KernelPerfState_DecreaseLevel_SIZE sizeof(UCHAR) - #define KernelPerfState_DecreaseLevel_ID 5 - - // - UCHAR Type; - #define KernelPerfState_Type_SIZE sizeof(UCHAR) - #define KernelPerfState_Type_ID 6 - - // - ULONG IncreaseTime; - #define KernelPerfState_IncreaseTime_SIZE sizeof(ULONG) - #define KernelPerfState_IncreaseTime_ID 7 - - // - ULONG DecreaseTime; - #define KernelPerfState_DecreaseTime_SIZE sizeof(ULONG) - #define KernelPerfState_DecreaseTime_ID 8 - - // - ULONGLONG Control; - #define KernelPerfState_Control_SIZE sizeof(ULONGLONG) - #define KernelPerfState_Control_ID 9 - - // - ULONGLONG Status; - #define KernelPerfState_Status_SIZE sizeof(ULONGLONG) - #define KernelPerfState_Status_ID 10 - - // - ULONG HitCount; - #define KernelPerfState_HitCount_SIZE sizeof(ULONG) - #define KernelPerfState_HitCount_ID 11 - - // - ULONG Reserved1; - #define KernelPerfState_Reserved1_SIZE sizeof(ULONG) - #define KernelPerfState_Reserved1_ID 12 - - // - ULONGLONG Reserved2; - #define KernelPerfState_Reserved2_SIZE sizeof(ULONGLONG) - #define KernelPerfState_Reserved2_ID 13 - - // - ULONGLONG Reserved3; - #define KernelPerfState_Reserved3_SIZE sizeof(ULONGLONG) - #define KernelPerfState_Reserved3_ID 14 - -} KernelPerfState, *PKernelPerfState; - -#define KernelPerfState_SIZE (FIELD_OFFSET(KernelPerfState, Reserved3) + KernelPerfState_Reserved3_SIZE) - -// KernelPerfStates - KernelPerfStates -#define KernelPerfStatesGuid \ - { 0x5708cc20,0x7d40,0x4bf4, { 0xb4,0xaa,0x2b,0x01,0x33,0x8d,0x01,0x26 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(KernelPerfStates_GUID, \ - 0x5708cc20,0x7d40,0x4bf4,0xb4,0xaa,0x2b,0x01,0x33,0x8d,0x01,0x26); -#endif - - -typedef struct _KernelPerfStates -{ - // - ULONG Count; - #define KernelPerfStates_Count_SIZE sizeof(ULONG) - #define KernelPerfStates_Count_ID 1 - - // - ULONG MaxFrequency; - #define KernelPerfStates_MaxFrequency_SIZE sizeof(ULONG) - #define KernelPerfStates_MaxFrequency_ID 2 - - // - ULONG CurrentState; - #define KernelPerfStates_CurrentState_SIZE sizeof(ULONG) - #define KernelPerfStates_CurrentState_ID 3 - - // - ULONG MaxPerfState; - #define KernelPerfStates_MaxPerfState_SIZE sizeof(ULONG) - #define KernelPerfStates_MaxPerfState_ID 4 - - // - ULONG MinPerfState; - #define KernelPerfStates_MinPerfState_SIZE sizeof(ULONG) - #define KernelPerfStates_MinPerfState_ID 5 - - // - ULONG LowestPerfState; - #define KernelPerfStates_LowestPerfState_SIZE sizeof(ULONG) - #define KernelPerfStates_LowestPerfState_ID 6 - - // - ULONG ThermalConstraint; - #define KernelPerfStates_ThermalConstraint_SIZE sizeof(ULONG) - #define KernelPerfStates_ThermalConstraint_ID 7 - - // - UCHAR BusyAdjThreshold; - #define KernelPerfStates_BusyAdjThreshold_SIZE sizeof(UCHAR) - #define KernelPerfStates_BusyAdjThreshold_ID 8 - - // - UCHAR PolicyType; - #define KernelPerfStates_PolicyType_SIZE sizeof(UCHAR) - #define KernelPerfStates_PolicyType_ID 9 - - // - UCHAR Type; - #define KernelPerfStates_Type_SIZE sizeof(UCHAR) - #define KernelPerfStates_Type_ID 10 - - // - UCHAR Reserved; - #define KernelPerfStates_Reserved_SIZE sizeof(UCHAR) - #define KernelPerfStates_Reserved_ID 11 - - // - ULONG TimerInterval; - #define KernelPerfStates_TimerInterval_SIZE sizeof(ULONG) - #define KernelPerfStates_TimerInterval_ID 12 - - // - ULONGLONG TargetProcessors; - #define KernelPerfStates_TargetProcessors_SIZE sizeof(ULONGLONG) - #define KernelPerfStates_TargetProcessors_ID 13 - - // - ULONG PStateHandler; - #define KernelPerfStates_PStateHandler_SIZE sizeof(ULONG) - #define KernelPerfStates_PStateHandler_ID 14 - - // - ULONG PStateContext; - #define KernelPerfStates_PStateContext_SIZE sizeof(ULONG) - #define KernelPerfStates_PStateContext_ID 15 - - // - ULONG TStateHandler; - #define KernelPerfStates_TStateHandler_SIZE sizeof(ULONG) - #define KernelPerfStates_TStateHandler_ID 16 - - // - ULONG TStateContext; - #define KernelPerfStates_TStateContext_SIZE sizeof(ULONG) - #define KernelPerfStates_TStateContext_ID 17 - - // - ULONG FeedbackHandler; - #define KernelPerfStates_FeedbackHandler_SIZE sizeof(ULONG) - #define KernelPerfStates_FeedbackHandler_ID 18 - - // - ULONG Reserved1; - #define KernelPerfStates_Reserved1_SIZE sizeof(ULONG) - #define KernelPerfStates_Reserved1_ID 19 - - // - ULONGLONG Reserved2; - #define KernelPerfStates_Reserved2_SIZE sizeof(ULONGLONG) - #define KernelPerfStates_Reserved2_ID 20 - - // - KernelPerfState State[1]; - #define KernelPerfStates_State_ID 21 - -} KernelPerfStates, *PKernelPerfStates; - -// KernelIdleState - KernelIdleState -#define KernelIdleStateGuid \ - { 0x46bdcf4a,0xe076,0x4550, { 0x82,0xb2,0x9f,0x32,0xed,0xed,0x3e,0x7f } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(KernelIdleState_GUID, \ - 0x46bdcf4a,0xe076,0x4550,0x82,0xb2,0x9f,0x32,0xed,0xed,0x3e,0x7f); -#endif - - -typedef struct _KernelIdleState -{ - // - ULONG Latency; - #define KernelIdleState_Latency_SIZE sizeof(ULONG) - #define KernelIdleState_Latency_ID 1 - - // - ULONG Power; - #define KernelIdleState_Power_SIZE sizeof(ULONG) - #define KernelIdleState_Power_ID 2 - - // - ULONG TimeCheck; - #define KernelIdleState_TimeCheck_SIZE sizeof(ULONG) - #define KernelIdleState_TimeCheck_ID 3 - - // - UCHAR PromotePercent; - #define KernelIdleState_PromotePercent_SIZE sizeof(UCHAR) - #define KernelIdleState_PromotePercent_ID 4 - - // - UCHAR DemotePercent; - #define KernelIdleState_DemotePercent_SIZE sizeof(UCHAR) - #define KernelIdleState_DemotePercent_ID 5 - - // - UCHAR StateType; - #define KernelIdleState_StateType_SIZE sizeof(UCHAR) - #define KernelIdleState_StateType_ID 6 - - // - UCHAR Reserved; - #define KernelIdleState_Reserved_SIZE sizeof(UCHAR) - #define KernelIdleState_Reserved_ID 7 - - // - ULONG StateFlags; - #define KernelIdleState_StateFlags_SIZE sizeof(ULONG) - #define KernelIdleState_StateFlags_ID 8 - - // - ULONG Context; - #define KernelIdleState_Context_SIZE sizeof(ULONG) - #define KernelIdleState_Context_ID 9 - - // - ULONG IdleHandler; - #define KernelIdleState_IdleHandler_SIZE sizeof(ULONG) - #define KernelIdleState_IdleHandler_ID 10 - - // - ULONG Reserved1; - #define KernelIdleState_Reserved1_SIZE sizeof(ULONG) - #define KernelIdleState_Reserved1_ID 11 - -} KernelIdleState, *PKernelIdleState; - -#define KernelIdleState_SIZE (FIELD_OFFSET(KernelIdleState, Reserved1) + KernelIdleState_Reserved1_SIZE) - -// KernelIdleStates - KernelIdleStates -#define KernelIdleStatesGuid \ - { 0xba138e10,0xe250,0x4ad7, { 0x86,0x16,0xcf,0x1a,0x7a,0xd4,0x10,0xe7 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(KernelIdleStates_GUID, \ - 0xba138e10,0xe250,0x4ad7,0x86,0x16,0xcf,0x1a,0x7a,0xd4,0x10,0xe7); -#endif - - -typedef struct _KernelIdleStates -{ - // - ULONG Type; - #define KernelIdleStates_Type_SIZE sizeof(ULONG) - #define KernelIdleStates_Type_ID 1 - - // - ULONG Count; - #define KernelIdleStates_Count_SIZE sizeof(ULONG) - #define KernelIdleStates_Count_ID 2 - - // - ULONG TargetState; - #define KernelIdleStates_TargetState_SIZE sizeof(ULONG) - #define KernelIdleStates_TargetState_ID 3 - - // - ULONG OldState; - #define KernelIdleStates_OldState_SIZE sizeof(ULONG) - #define KernelIdleStates_OldState_ID 4 - - // - ULONGLONG TargetProcessors; - #define KernelIdleStates_TargetProcessors_SIZE sizeof(ULONGLONG) - #define KernelIdleStates_TargetProcessors_ID 5 - - // - KernelIdleState State[1]; - #define KernelIdleStates_State_ID 6 - -} KernelIdleStates, *PKernelIdleStates; - -// KernelPerfStateChange - KernelPerfStateChange -// Kernel Perf State Transition Event -#define KernelPerfStateChangeGuid \ - { 0xa5b32ddd,0x7f39,0x4abc, { 0xb8,0x92,0x90,0x0e,0x43,0xb5,0x9e,0xbb } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(KernelPerfStateChange_GUID, \ - 0xa5b32ddd,0x7f39,0x4abc,0xb8,0x92,0x90,0x0e,0x43,0xb5,0x9e,0xbb); -#endif - - -typedef struct _KernelPerfStateChange -{ - // - ULONG State; - #define KernelPerfStateChange_State_SIZE sizeof(ULONG) - #define KernelPerfStateChange_State_ID 1 - - // - ULONG Status; - #define KernelPerfStateChange_Status_SIZE sizeof(ULONG) - #define KernelPerfStateChange_Status_ID 2 - - // - ULONG Latency; - #define KernelPerfStateChange_Latency_SIZE sizeof(ULONG) - #define KernelPerfStateChange_Latency_ID 3 - - // - ULONG Speed; - #define KernelPerfStateChange_Speed_SIZE sizeof(ULONG) - #define KernelPerfStateChange_Speed_ID 4 - - // - ULONG Processor; - #define KernelPerfStateChange_Processor_SIZE sizeof(ULONG) - #define KernelPerfStateChange_Processor_ID 5 - -} KernelPerfStateChange, *PKernelPerfStateChange; - -#define KernelPerfStateChange_SIZE (FIELD_OFFSET(KernelPerfStateChange, Processor) + KernelPerfStateChange_Processor_SIZE) - -// KernelPerfStateDomainChange - KernelPerfStateDomainChange -// Kernel Perf State Domain Transition Event -#define KernelPerfStateDomainChangeGuid \ - { 0x995e6b7f,0xd653,0x497a, { 0xb9,0x78,0x36,0xa3,0x0c,0x29,0xbf,0x01 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(KernelPerfStateDomainChange_GUID, \ - 0x995e6b7f,0xd653,0x497a,0xb9,0x78,0x36,0xa3,0x0c,0x29,0xbf,0x01); -#endif - - -typedef struct _KernelPerfStateDomainChange -{ - // - ULONG State; - #define KernelPerfStateDomainChange_State_SIZE sizeof(ULONG) - #define KernelPerfStateDomainChange_State_ID 1 - - // - ULONG Latency; - #define KernelPerfStateDomainChange_Latency_SIZE sizeof(ULONG) - #define KernelPerfStateDomainChange_Latency_ID 2 - - // - ULONG Speed; - #define KernelPerfStateDomainChange_Speed_SIZE sizeof(ULONG) - #define KernelPerfStateDomainChange_Speed_ID 3 - - // - ULONGLONG Processors; - #define KernelPerfStateDomainChange_Processors_SIZE sizeof(ULONGLONG) - #define KernelPerfStateDomainChange_Processors_ID 4 - -} KernelPerfStateDomainChange, *PKernelPerfStateDomainChange; - -#define KernelPerfStateDomainChange_SIZE (FIELD_OFFSET(KernelPerfStateDomainChange, Processors) + KernelPerfStateDomainChange_Processors_SIZE) - -// KernelIdleStateChange - KernelIdleStateChange -// Kernel Idle State Change Event -#define KernelIdleStateChangeGuid \ - { 0x4838fe4f,0xf71c,0x4e51, { 0x9e,0xcc,0x84,0x30,0xa7,0xac,0x4c,0x6c } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(KernelIdleStateChange_GUID, \ - 0x4838fe4f,0xf71c,0x4e51,0x9e,0xcc,0x84,0x30,0xa7,0xac,0x4c,0x6c); -#endif - - -typedef struct _KernelIdleStateChange -{ - // - ULONG NewState; - #define KernelIdleStateChange_NewState_SIZE sizeof(ULONG) - #define KernelIdleStateChange_NewState_ID 1 - - // - ULONG OldState; - #define KernelIdleStateChange_OldState_SIZE sizeof(ULONG) - #define KernelIdleStateChange_OldState_ID 2 - - // - ULONGLONG Processors; - #define KernelIdleStateChange_Processors_SIZE sizeof(ULONGLONG) - #define KernelIdleStateChange_Processors_ID 3 - -} KernelIdleStateChange, *PKernelIdleStateChange; - -#define KernelIdleStateChange_SIZE (FIELD_OFFSET(KernelIdleStateChange, Processors) + KernelIdleStateChange_Processors_SIZE) - -// KernelThermalConstraintChange - KernelThermalConstraintChange -// Kernel Thermal Event -#define KernelThermalConstraintChangeGuid \ - { 0xa852c2c8,0x1a4c,0x423b, { 0x8c,0x2c,0xf3,0x0d,0x82,0x93,0x1a,0x88 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(KernelThermalConstraintChange_GUID, \ - 0xa852c2c8,0x1a4c,0x423b,0x8c,0x2c,0xf3,0x0d,0x82,0x93,0x1a,0x88); -#endif - - -typedef struct _KernelThermalConstraintChange -{ - // - ULONG ThermalConstraint; - #define KernelThermalConstraintChange_ThermalConstraint_SIZE sizeof(ULONG) - #define KernelThermalConstraintChange_ThermalConstraint_ID 1 - - // - ULONGLONG Processors; - #define KernelThermalConstraintChange_Processors_SIZE sizeof(ULONGLONG) - #define KernelThermalConstraintChange_Processors_ID 2 - -} KernelThermalConstraintChange, *PKernelThermalConstraintChange; - -#define KernelThermalConstraintChange_SIZE (FIELD_OFFSET(KernelThermalConstraintChange, Processors) + KernelThermalConstraintChange_Processors_SIZE) - -// IdleStateAccounting - IdleStateAccounting -#define IdleStateAccountingGuid \ - { 0x5280028a,0xc24f,0x43ec, { 0xb2,0x7d,0xa9,0x60,0xa7,0x0e,0x31,0x9a } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(IdleStateAccounting_GUID, \ - 0x5280028a,0xc24f,0x43ec,0xb2,0x7d,0xa9,0x60,0xa7,0x0e,0x31,0x9a); -#endif - - -typedef struct _IdleStateAccounting -{ - // - ULONG IdleTransitions; - #define IdleStateAccounting_IdleTransitions_SIZE sizeof(ULONG) - #define IdleStateAccounting_IdleTransitions_ID 1 - - // - ULONG FailedTransitions; - #define IdleStateAccounting_FailedTransitions_SIZE sizeof(ULONG) - #define IdleStateAccounting_FailedTransitions_ID 2 - - // - ULONG InvalidBucketIndex; - #define IdleStateAccounting_InvalidBucketIndex_SIZE sizeof(ULONG) - #define IdleStateAccounting_InvalidBucketIndex_ID 3 - - // - ULONGLONG TotalTime; - #define IdleStateAccounting_TotalTime_SIZE sizeof(ULONGLONG) - #define IdleStateAccounting_TotalTime_ID 4 - - // - ULONG IdleTimeBuckets[6]; - #define IdleStateAccounting_IdleTimeBuckets_SIZE sizeof(ULONG[6]) - #define IdleStateAccounting_IdleTimeBuckets_ID 5 - -} IdleStateAccounting, *PIdleStateAccounting; - -#define IdleStateAccounting_SIZE (FIELD_OFFSET(IdleStateAccounting, IdleTimeBuckets) + IdleStateAccounting_IdleTimeBuckets_SIZE) - -// IdleAccounting - IdleAccounting -#define IdleAccountingGuid \ - { 0xe2a26f78,0xae07,0x4ee0, { 0xa3,0x0f,0xce,0x35,0x4f,0x5a,0x94,0xcd } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(IdleAccounting_GUID, \ - 0xe2a26f78,0xae07,0x4ee0,0xa3,0x0f,0xce,0x35,0x4f,0x5a,0x94,0xcd); -#endif - - -typedef struct _IdleAccounting -{ - // - ULONG StateCount; - #define IdleAccounting_StateCount_SIZE sizeof(ULONG) - #define IdleAccounting_StateCount_ID 1 - - // - ULONG TotalTransitions; - #define IdleAccounting_TotalTransitions_SIZE sizeof(ULONG) - #define IdleAccounting_TotalTransitions_ID 2 - - // - ULONG ResetCount; - #define IdleAccounting_ResetCount_SIZE sizeof(ULONG) - #define IdleAccounting_ResetCount_ID 3 - - // - ULONGLONG StartTime; - #define IdleAccounting_StartTime_SIZE sizeof(ULONGLONG) - #define IdleAccounting_StartTime_ID 4 - - // - IdleStateAccounting State[1]; - #define IdleAccounting_State_ID 5 - -} IdleAccounting, *PIdleAccounting; - -// IdleStateBucketEx - IdleStateBucketEx -#define IdleStateBucketExGuid \ - { 0xe53e0a7d,0x36f0,0x4a77, { 0x87,0x9e,0x9c,0x6b,0x5e,0x4a,0x85,0x54 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(IdleStateBucketEx_GUID, \ - 0xe53e0a7d,0x36f0,0x4a77,0x87,0x9e,0x9c,0x6b,0x5e,0x4a,0x85,0x54); -#endif - - -typedef struct _IdleStateBucketEx -{ - // - ULONGLONG TotalTimeUs; - #define IdleStateBucketEx_TotalTimeUs_SIZE sizeof(ULONGLONG) - #define IdleStateBucketEx_TotalTimeUs_ID 1 - - // - ULONG MinTimeUs; - #define IdleStateBucketEx_MinTimeUs_SIZE sizeof(ULONG) - #define IdleStateBucketEx_MinTimeUs_ID 2 - - // - ULONG MaxTimeUs; - #define IdleStateBucketEx_MaxTimeUs_SIZE sizeof(ULONG) - #define IdleStateBucketEx_MaxTimeUs_ID 3 - - // - ULONG Count; - #define IdleStateBucketEx_Count_SIZE sizeof(ULONG) - #define IdleStateBucketEx_Count_ID 4 - -} IdleStateBucketEx, *PIdleStateBucketEx; - -#define IdleStateBucketEx_SIZE (FIELD_OFFSET(IdleStateBucketEx, Count) + IdleStateBucketEx_Count_SIZE) - -// IdleStateAccountingEx - IdleStateAccountingEx -#define IdleStateAccountingExGuid \ - { 0x3e0d7b2c,0x401b,0x480f, { 0x83,0x03,0xd0,0xc2,0x0e,0xa1,0xa7,0xd8 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(IdleStateAccountingEx_GUID, \ - 0x3e0d7b2c,0x401b,0x480f,0x83,0x03,0xd0,0xc2,0x0e,0xa1,0xa7,0xd8); -#endif - - -typedef struct _IdleStateAccountingEx -{ - // - ULONGLONG TotalTime; - #define IdleStateAccountingEx_TotalTime_SIZE sizeof(ULONGLONG) - #define IdleStateAccountingEx_TotalTime_ID 1 - - // - ULONG IdleTransitions; - #define IdleStateAccountingEx_IdleTransitions_SIZE sizeof(ULONG) - #define IdleStateAccountingEx_IdleTransitions_ID 2 - - // - ULONG FailedTransitions; - #define IdleStateAccountingEx_FailedTransitions_SIZE sizeof(ULONG) - #define IdleStateAccountingEx_FailedTransitions_ID 3 - - // - ULONG InvalidBucketIndex; - #define IdleStateAccountingEx_InvalidBucketIndex_SIZE sizeof(ULONG) - #define IdleStateAccountingEx_InvalidBucketIndex_ID 4 - - // - ULONG MinTimeUs; - #define IdleStateAccountingEx_MinTimeUs_SIZE sizeof(ULONG) - #define IdleStateAccountingEx_MinTimeUs_ID 5 - - // - ULONG MaxTimeUs; - #define IdleStateAccountingEx_MaxTimeUs_SIZE sizeof(ULONG) - #define IdleStateAccountingEx_MaxTimeUs_ID 6 - - // - IdleStateBucketEx IdleTimeBuckets[16]; - #define IdleStateAccountingEx_IdleTimeBuckets_SIZE sizeof(IdleStateBucketEx[16]) - #define IdleStateAccountingEx_IdleTimeBuckets_ID 7 - -} IdleStateAccountingEx, *PIdleStateAccountingEx; - -#define IdleStateAccountingEx_SIZE (FIELD_OFFSET(IdleStateAccountingEx, IdleTimeBuckets) + IdleStateAccountingEx_IdleTimeBuckets_SIZE) - -// IdleAccountingEx - IdleAccountingEx -#define IdleAccountingExGuid \ - { 0xd67abd39,0x81f8,0x4a5e, { 0x81,0x52,0x72,0xe3,0x1e,0xc9,0x12,0xee } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(IdleAccountingEx_GUID, \ - 0xd67abd39,0x81f8,0x4a5e,0x81,0x52,0x72,0xe3,0x1e,0xc9,0x12,0xee); -#endif - - -typedef struct _IdleAccountingEx -{ - // - ULONG StateCount; - #define IdleAccountingEx_StateCount_SIZE sizeof(ULONG) - #define IdleAccountingEx_StateCount_ID 1 - - // - ULONG TotalTransitions; - #define IdleAccountingEx_TotalTransitions_SIZE sizeof(ULONG) - #define IdleAccountingEx_TotalTransitions_ID 2 - - // - ULONG ResetCount; - #define IdleAccountingEx_ResetCount_SIZE sizeof(ULONG) - #define IdleAccountingEx_ResetCount_ID 3 - - // - ULONGLONG StartTime; - #define IdleAccountingEx_StartTime_SIZE sizeof(ULONGLONG) - #define IdleAccountingEx_StartTime_ID 4 - - // - IdleStateAccountingEx State[1]; - #define IdleAccountingEx_State_ID 5 - -} IdleAccountingEx, *PIdleAccountingEx; - -// KernelThermalPolicyChange - KernelThermalPolicyChange -// Kernel Thermal Policy Event -#define KernelThermalPolicyChangeGuid \ - { 0xaca5a8f7,0x96ca,0x4397, { 0xba,0xde,0x43,0xbe,0x2f,0x57,0x7d,0x51 } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(KernelThermalPolicyChange_GUID, \ - 0xaca5a8f7,0x96ca,0x4397,0xba,0xde,0x43,0xbe,0x2f,0x57,0x7d,0x51); -#endif - - -typedef struct _KernelThermalPolicyChange -{ - // - UCHAR CoolingMode; - #define KernelThermalPolicyChange_CoolingMode_SIZE sizeof(UCHAR) - #define KernelThermalPolicyChange_CoolingMode_ID 1 - - // - ULONGLONG Processors; - #define KernelThermalPolicyChange_Processors_SIZE sizeof(ULONGLONG) - #define KernelThermalPolicyChange_Processors_ID 2 - -} KernelThermalPolicyChange, *PKernelThermalPolicyChange; - -#define KernelThermalPolicyChange_SIZE (FIELD_OFFSET(KernelThermalPolicyChange, Processors) + KernelThermalPolicyChange_Processors_SIZE) - -// ProcessorPerformance - ProcessorPerformance -#define ProcessorPerformanceGuid \ - { 0x7fd18652,0x0cfe,0x40d2, { 0xb0,0xa1,0x0b,0x06,0x6a,0x87,0x75,0x9e } } - -#if ! (defined(MIDL_PASS)) -DEFINE_GUID(ProcessorPerformance_GUID, \ - 0x7fd18652,0x0cfe,0x40d2,0xb0,0xa1,0x0b,0x06,0x6a,0x87,0x75,0x9e); -#endif - - -typedef struct _ProcessorPerformance -{ - // - ULONG frequency; - #define ProcessorPerformance_frequency_SIZE sizeof(ULONG) - #define ProcessorPerformance_frequency_ID 1 - - // - ULONG power; - #define ProcessorPerformance_power_SIZE sizeof(ULONG) - #define ProcessorPerformance_power_ID 2 - - // - ULONG percentage; - #define ProcessorPerformance_percentage_SIZE sizeof(ULONG) - #define ProcessorPerformance_percentage_ID 3 - -} ProcessorPerformance, *PProcessorPerformance; - -#define ProcessorPerformance_SIZE (FIELD_OFFSET(ProcessorPerformance, percentage) + ProcessorPerformance_percentage_SIZE) - -#endif - diff --git a/pub/ddk/wmiguid.h b/pub/ddk/wmiguid.h deleted file mode 100644 index e1da417..0000000 --- a/pub/ddk/wmiguid.h +++ /dev/null @@ -1,312 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - wmiguid.h - -Abstract: - - Defines GUIDs that represent data blocks that can be retrieved via WMI - ---*/ - -#include - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -// -// This is WMI guid used to return disk performance information from -// diskperf.sys (see DISK_PERFORMANCE data structure) - -DEFINE_GUID (DiskPerfGuid, 0xBDD865D1,0xD7C1,0x11d0,0xA5,0x01,0x00,0xA0,0xC9,0x06,0x29,0x10); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -// -// This guid will return additional information about a data provider -// {5494DFDC-A98A-11d1-BF43-00A0C9062910} -#define DATA_PROVIDER_INFO_GUID \ - {0x5494dfdc, 0xa98a, 0x11d1, 0xbf, 0x43, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0x10} - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -// -// This wmi guid is used to return the entire SMBIOS data table -// {8F680850-A584-11d1-BF38-00A0C9062910} -#define SMBIOS_DATA_GUID \ - {0x8f680850, 0xa584, 0x11d1, 0xbf, 0x38, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0x10} - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -// -// This wmi guid is used to return thermal information -// {A1BC18C0-A7C8-11d1-BF3C-00A0C9062910} -DEFINE_GUID(THERMAL_ZONE_GUID, \ - 0xa1bc18c0, 0xa7c8, 0x11d1, 0xbf, 0x3c, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0x10); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -// -// This wmi guid is used to return additional information about the provider -// of an instance name. Note that only QuerySingleInstance is supported. -// {C7BF35D0-AADB-11d1-BF4A-00A0C9062910} -#define INSTANCE_INFO_GUID \ - {0xc7bf35d0, 0xaadb, 0x11d1, 0xbf, 0x4a, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0x10} - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -#define BINARY_MOF_GUID \ - {0x05901221, 0xD566, 0x11d1, 0xB2, 0xF0, 0x00, 0xA0, 0xC9, 0x06, 0x29, 0x10} - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -#define ENUMERATE_GUIDS_GUID \ - {0xe3dff7bd, 0x3915, 0x11d2, 0x91, 0x03, 0x00, 0xc0, 0x4f, 0xb9, 0x98, 0xa2} - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -// -// Global WMI Logger GUID -// - -DEFINE_GUID ( /* e8908abc-aa84-11d2-9a93-00805f85d7c6 */ - GlobalLoggerGuid, - 0xe8908abc, - 0xaa84, - 0x11d2, - 0x9a, 0x93, 0x00, 0x80, 0x5f, 0x85, 0xd7, 0xc6 - ); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DEFINE_GUID ( /* 8d40301f-ab4a-11d2-9a93-00805f85d7c6 */ - GenericMessageGuid, - 0x8d40301f, - 0xab4a, - 0x11d2, - 0x9a, 0x93, 0x00, 0x80, 0x5f, 0x85, 0xd7, 0xc6 - ); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) - -// -// Event Trace GUIDs -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DEFINE_GUID ( /* 3d6fa8d0-fe05-11d0-9dda-00c04fd7ba7c */ - ProcessGuid, - 0x3d6fa8d0, - 0xfe05, - 0x11d0, - 0x9d, 0xda, 0x00, 0xc0, 0x4f, 0xd7, 0xba, 0x7c - ); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DEFINE_GUID ( /* 3d6fa8d1-fe05-11d0-9dda-00c04fd7ba7c */ - ThreadGuid, - 0x3d6fa8d1, - 0xfe05, - 0x11d0, - 0x9d, 0xda, 0x00, 0xc0, 0x4f, 0xd7, 0xba, 0x7c - ); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DEFINE_GUID ( /* 3d6fa8d3-fe05-11d0-9dda-00c04fd7ba7c */ - PageFaultGuid, - 0x3d6fa8d3, - 0xfe05, - 0x11d0, - 0x9d, 0xda, 0x00, 0xc0, 0x4f, 0xd7, 0xba, 0x7c - ); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DEFINE_GUID ( /* 3d6fa8d4-fe05-11d0-9dda-00c04fd7ba7c */ - DiskIoGuid, - 0x3d6fa8d4, - 0xfe05, - 0x11d0, - 0x9d, 0xda, 0x00, 0xc0, 0x4f, 0xd7, 0xba, 0x7c - ); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DEFINE_GUID ( /* 90cbdc39-4a3e-11d1-84f4-0000f80464e3 */ - FileIoGuid, - 0x90cbdc39, - 0x4a3e, - 0x11d1, - 0x84, 0xf4, 0x00, 0x00, 0xf8, 0x04, 0x64, 0xe3 - ); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DEFINE_GUID ( /* 9a280ac0-c8e0-11d1-84e2-00c04fb998a2 */ - TcpIpGuid, - 0x9a280ac0, - 0xc8e0, - 0x11d1, - 0x84, 0xe2, 0x00, 0xc0, 0x4f, 0xb9, 0x98, 0xa2 - ); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DEFINE_GUID ( /* bf3a50c5-a9c9-4988-a005-2df0b7c80f80 */ - UdpIpGuid, - 0xbf3a50c5, - 0xa9c9, - 0x4988, - 0xa0, 0x05, 0x2d, 0xf0, 0xb7, 0xc8, 0x0f, 0x80 - ); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DEFINE_GUID ( /* 2cb15d1d-5fc1-11d2-abe1-00a0c911f518 */ - ImageLoadGuid, - 0x2cb15d1d, - 0x5fc1, - 0x11d2, - 0xab, 0xe1, 0x00, 0xa0, 0xc9, 0x11, 0xf5, 0x18 - ); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DEFINE_GUID ( /* AE53722E-C863-11d2-8659-00C04FA321A1 */ - RegistryGuid, - 0xae53722e, - 0xc863, - 0x11d2, - 0x86, 0x59, 0x0, 0xc0, 0x4f, 0xa3, 0x21, 0xa1 -); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) - -// -// Special WMI events -// - -#if (NTDDI_VERSION >= NTDDI_WIN2K) - -DEFINE_GUID ( /* 398191dc-2da7-11d3-8b98-00805f85d7c6 */ - TraceErrorGuid, - 0x398191dc, - 0x2da7, - 0x11d3, - 0x8b, 0x98, 0x00, 0x80, 0x5f, 0x85, 0xd7, 0xc6 - ); - -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) -#if ((NTDDI_VERSION >= NTDDI_WIN2K) && (NTDDI_VERSION < NTDDI_VISTA)) - -DEFINE_GUID ( /* 3d6fa8d2-fe05-11d0-9dda-00c04fd7ba7c */ /* Not used */ - HardFaultGuid, - 0x3d6fa8d2, - 0xfe05, - 0x11d0, - 0x9d, 0xda, 0x00, 0xc0, 0x4f, 0xd7, 0xba, 0x7c - ); - -#endif // ((NTDDI_VERSION >= NTDDI_WIN2K) && (NTDDI_VERSION < NTDDI_VISTA)) -#if (NTDDI_VERSION >= NTDDI_WINXP) - -DEFINE_GUID ( /* 44608a51-1851-4456-98b2-b300e931ee41 */ - WmiEventLoggerGuid, - 0x44608a51, - 0x1851, - 0x4456, - 0x98, 0xb2, 0xb3, 0x00, 0xe9, 0x31, 0xee, 0x41 - ); - -#endif // (NTDDI_VERSION >= NTDDI_WINXP) -#if (NTDDI_VERSION >= NTDDI_WINXP) - -// -// This wmi guid is used to return the SMBIOS Identifer data -// {98A2B9D7-94DD-496a-847E-67A5557A59F2} -// -// MS_SystemInformation - MS_SystemInformation -#define MS_SYSTEM_INFORMATIONGUID \ - { 0x98a2b9d7,0x94dd,0x496a, { 0x84,0x7e,0x67,0xa5,0x55,0x7a,0x59,0xf2 } } - -DEFINE_GUID(MS_SYSTEM_INFORMATION_GUID, \ - 0x98a2b9d7,0x94dd,0x496a,0x84,0x7e,0x67,0xa5,0x55,0x7a,0x59,0xf2); - -#endif // (NTDDI_VERSION >= NTDDI_WINXP) -#if (NTDDI_VERSION >= NTDDI_WINXP) - -DEFINE_GUID( /* 13976D09-A327-438c-950B-7F03192815C7 */ - DbgPrintGuid, - 0x13976d09, - 0xa327, - 0x438c, - 0x95, 0xb, 0x7f, 0x3, 0x19, 0x28, 0x15, 0xc7 - ); - -#endif // (NTDDI_VERSION >= NTDDI_WINXP) -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// -// Event Log Logger GUID -// -DEFINE_GUID( /* b16f9f5e-bcda-4027-9318-adf2b79df73b */ - EventLogGuid, - 0xb16f9f5e, - 0xb3da, - 0x4027, - 0x93, 0x18, 0xad, 0xf2, 0xb7, 0x9d, 0xf7, 0x3b - ); - -#endif // (NTDDI_VERSION >= NTDDI_VISTA) -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// -// Driver Verifier Events -// - -DEFINE_GUID ( /* D56CA431-61BF-4904-A621-00E0381E4DDE */ - DriverVerifierGuid, - 0xd56ca431, - 0x61bf, - 0x4904, - 0xa6, 0x21, 0x0, 0xe0, 0x38, 0x1e, 0x4d, 0xde - ); - -#endif // (NTDDI_VERSION >= NTDDI_VISTA) -#if (NTDDI_VERSION >= NTDDI_VISTA) - -// -// Application Verifier Events -// - -DEFINE_GUID( /* 78d14f17-0105-46d7-bfff-6fbea2f3f358 */ - ApplicationVerifierGuid, - 0x78d14f17, - 0x0105, - 0x46d7, - 0xbf, 0xff, 0x6f, 0xbe, 0xa2, 0xf3, 0xf3, 0x58 - ); - -#endif // (NTDDI_VERSION >= NTDDI_VISTA) - diff --git a/pub/ddk/wmilib.h b/pub/ddk/wmilib.h deleted file mode 100644 index 1c24413..0000000 --- a/pub/ddk/wmilib.h +++ /dev/null @@ -1,543 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation - -Module Name: - - wmilib.h - -Abstract: - - This module contains the internal structure definitions and APIs used by - the WMILIB helper functions - -Revision History: - ---*/ - -#ifndef _WMILIB_ -#define _WMILIB_ - -#if defined (_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// -// This defines a guid to be registered with WMI. Memory for this structure -// may be Paged. -// - -typedef struct _WMIGUIDREGINFO { - LPCGUID Guid; // Guid to registered - ULONG InstanceCount; // Count of Instances of Datablock - ULONG Flags; // Additional flags (see WMIREGINFO in wmistr.h) -} WMIGUIDREGINFO, *PWMIGUIDREGINFO; - -typedef enum _WMIENABLEDISABLECONTROL { - WmiEventControl, // Enable or disable an event - WmiDataBlockControl // Enable or disable data block collection -} WMIENABLEDISABLECONTROL, *PWMIENABLEDISABLECONTROL; - -typedef enum _SYSCTL_IRP_DISPOSITION { - IrpProcessed, // Irp was processed and possibly completed - IrpNotCompleted, // Irp was process and NOT completed - IrpNotWmi, // Irp is not a WMI irp - IrpForward // Irp is wmi irp, but targeted at another device object -} SYSCTL_IRP_DISPOSITION, *PSYSCTL_IRP_DISPOSITION; - -__drv_functionClass(WMI_QUERY_REGINFO_CALLBACK) -__drv_sameIRQL -__checkReturn -typedef -NTSTATUS -WMI_QUERY_REGINFO_CALLBACK ( - __inout PDEVICE_OBJECT DeviceObject, - __inout PULONG RegFlags, - __inout PUNICODE_STRING InstanceName, - __deref_out_opt PUNICODE_STRING *RegistryPath, - __inout PUNICODE_STRING MofResourceName, - __deref_out_opt PDEVICE_OBJECT *Pdo - ); - -typedef WMI_QUERY_REGINFO_CALLBACK *PWMI_QUERY_REGINFO; - -/*++ - -Routine Description: - - This routine is a callback into the driver to retrieve information about - the guids being registered. - - Implementations of this routine may be in paged memory - -Arguments: - - DeviceObject is the device whose registration information is needed - - *RegFlags returns with a set of flags that describe all of the guids being - registered for this device. If the device wants enable and disable - collection callbacks before receiving queries for the registered - guids then it should return the WMIREG_FLAG_EXPENSIVE flag. Also the - returned flags may specify WMIREG_FLAG_INSTANCE_PDO in which case - the instance name is determined from the PDO associated with the - device object. Note that the PDO must have an associated devnode. If - WMIREG_FLAG_INSTANCE_PDO is not set then Name must return a unique - name for the device. These flags are ORed into the flags specified - by the GUIDREGINFO for each guid. - - InstanceName returns with the instance name for the guids if - WMIREG_FLAG_INSTANCE_PDO is not set in the returned *RegFlags. The - caller will call ExFreePool with the buffer returned. - - *RegistryPath returns with the registry path of the driver. This is - required - - MofResourceName returns with the name of the MOF resource attached to - the binary file. If the driver does not have a mof resource attached - then this can be returned unmodified. If a value is returned then - it is NOT freed. - - *Pdo returns with the device object for the PDO associated with this - device if the WMIREG_FLAG_INSTANCE_PDO flag is retured in - *RegFlags. - -Return Value: - - status - ---*/ - -__drv_functionClass(WMI_QUERY_DATABLOCK_CALLBACK) -__drv_sameIRQL -__checkReturn -typedef -NTSTATUS -WMI_QUERY_DATABLOCK_CALLBACK ( - __inout PDEVICE_OBJECT DeviceObject, - __inout PIRP Irp, - __in ULONG GuidIndex, - __in ULONG InstanceIndex, - __in ULONG InstanceCount, - __out_ecount_opt(InstanceCount) PULONG InstanceLengthArray, - __in ULONG BufferAvail, - __out_bcount_opt(BufferAvail) PUCHAR Buffer - ); - -typedef WMI_QUERY_DATABLOCK_CALLBACK *PWMI_QUERY_DATABLOCK; - -/*++ - -Routine Description: - - This routine is a callback into the driver to query for the contents of - one or more instances of a data block. When the driver has finished - filling the - data block it must call WmiCompleteRequest to complete the irp. The - driver can return STATUS_PENDING if the irp cannot be completed - immediately. - - Implementations of this routine may be in paged memory - -Arguments: - - DeviceObject is the device whose data block is being queried - - Irp is the Irp that makes this request - - GuidIndex is the index into the list of guids provided when the - device registered - - InstanceIndex is the index that denotes which instance of the data block - is being queried. - - InstanceCount is the number of instances expected to be returned for - the data block. - - InstanceLengthArray is a pointer to an array of ULONG that returns the - lengths of each instance of the data block. If this is NULL then - there was not enough space in the output buffer to fufill the request - so the irp should be completed with the buffer needed. - - BufferAvail on entry has the maximum size available to write the data - blocks. - - Buffer on return is filled with the returned data blocks. Note that each - instance of the data block must be aligned on a 8 byte boundry. If - this is NULL then there was not enough space in the output buffer - to fufill the request so the irp should be completed with the buffer - needed. - - -Return Value: - - status - ---*/ - -__drv_functionClass(WMI_SET_DATABLOCK_CALLBACK) -__drv_sameIRQL -__checkReturn -typedef -NTSTATUS -WMI_SET_DATABLOCK_CALLBACK ( - __inout PDEVICE_OBJECT DeviceObject, - __inout PIRP Irp, - __in ULONG GuidIndex, - __in ULONG InstanceIndex, - __in ULONG BufferSize, - __in_bcount(BufferSize) PUCHAR Buffer - ); - -typedef WMI_SET_DATABLOCK_CALLBACK *PWMI_SET_DATABLOCK; - -/*++ - -Routine Description: - - This routine is a callback into the driver to query for the contents of - a data block. When the driver has finished filling the data block it - must call WmiCompleteRequest to complete the irp. The driver can - return STATUS_PENDING if the irp cannot be completed immediately. - - Implementations of this routine may be in paged memory - -Arguments: - - DeviceObject is the device whose data block is being queried - - Irp is the Irp that makes this request - - GuidIndex is the index into the list of guids provided when the - device registered - - InstanceIndex is the index that denotes which instance of the data block - is being set. - - BufferSize has the size of the data block passed - - Buffer has the new values for the data block - - -Return Value: - - status - ---*/ - -__drv_functionClass(WMI_SET_DATAITEM_CALLBACK) -__drv_sameIRQL -__checkReturn -typedef -NTSTATUS -WMI_SET_DATAITEM_CALLBACK ( - __inout PDEVICE_OBJECT DeviceObject, - __inout PIRP Irp, - __in ULONG GuidIndex, - __in ULONG InstanceIndex, - __in ULONG DataItemId, - __in ULONG BufferSize, - __in_bcount(BufferSize) PUCHAR Buffer - ); - -typedef WMI_SET_DATAITEM_CALLBACK *PWMI_SET_DATAITEM; - -/*++ - -Routine Description: - - This routine is a callback into the driver to query for the contents of - a data block. When the driver has finished filling the data block it - must call WmiCompleteRequest to complete the irp. The driver can - return STATUS_PENDING if the irp cannot be completed immediately. - - Implementations of this routine may be in paged memory - -Arguments: - - DeviceObject is the device whose data block is being queried - - Irp is the Irp that makes this request - - GuidIndex is the index into the list of guids provided when the - device registered - - InstanceIndex is the index that denotes which instance of the data block - is being set. - - DataItemId has the id of the data item being set - - BufferSize has the size of the data item passed - - Buffer has the new values for the data item - - -Return Value: - - status - ---*/ - -__drv_functionClass(WMI_EXECUTE_METHOD_CALLBACK) -__drv_sameIRQL -__checkReturn -typedef -NTSTATUS -WMI_EXECUTE_METHOD_CALLBACK ( - __inout PDEVICE_OBJECT DeviceObject, - __inout PIRP Irp, - __in ULONG GuidIndex, - __in ULONG InstanceIndex, - __in ULONG MethodId, - __in ULONG InBufferSize, - __in ULONG OutBufferSize, - __inout_bcount(OutBufferSize) PUCHAR Buffer - ); - -typedef WMI_EXECUTE_METHOD_CALLBACK *PWMI_EXECUTE_METHOD; - -/*++ - -Routine Description: - - This routine is a callback into the driver to execute a method. When the - driver has finished filling the data block it must call - WmiCompleteRequest to complete the irp. The driver can - return STATUS_PENDING if the irp cannot be completed immediately. - - Implementations of this routine may be in paged memory - -Arguments: - - DeviceObject is the device whose data block is being queried - - Irp is the Irp that makes this request - - GuidIndex is the index into the list of guids provided when the - device registered - - InstanceIndex is the index that denotes which instance of the data block - is being called. - - MethodId has the id of the method being called - - InBufferSize has the size of the data block passed in as the input to - the method. - - OutBufferSize on entry has the maximum size available to write the - returned data block. - - Buffer on entry has the input data block and on return has the output - output data block. - - -Return Value: - - status - ---*/ - -__drv_functionClass(WMI_FUNCTION_CONTROL_CALLBACK) -__drv_sameIRQL -__checkReturn -typedef -NTSTATUS -WMI_FUNCTION_CONTROL_CALLBACK ( - __inout PDEVICE_OBJECT DeviceObject, - __inout PIRP Irp, - __in ULONG GuidIndex, - __in WMIENABLEDISABLECONTROL Function, - __in BOOLEAN Enable - ); - -typedef WMI_FUNCTION_CONTROL_CALLBACK *PWMI_FUNCTION_CONTROL; - -/*++ - -Routine Description: - - This routine is a callback into the driver to enabled or disable event - generation or data block collection. A device should only expect a - single enable when the first event or data consumer enables events or - data collection and a single disable when the last event or data - consumer disables events or data collection. Data blocks will only - receive collection enable/disable if they were registered as requiring - it. - - Implementations of this routine may be in paged memory - -Arguments: - - DeviceObject is the device whose data block is being queried - - GuidIndex is the index into the list of guids provided when the - device registered - - Function specifies which functionality is being enabled or disabled - - Enable is TRUE then the function is being enabled else disabled - -Return Value: - - status - ---*/ - -// -// This structure supplies context information for WMILIB to process the -// WMI irps. Memory for this structure may be paged. -// - -typedef struct _WMILIB_CONTEXT { - - // - // WMI data block guid registration info - // - - ULONG GuidCount; - __field_ecount(GuidCount) PWMIGUIDREGINFO GuidList; - - // - // WMI functionality callbacks - // - - PWMI_QUERY_REGINFO QueryWmiRegInfo; - PWMI_QUERY_DATABLOCK QueryWmiDataBlock; - PWMI_SET_DATABLOCK SetWmiDataBlock; - PWMI_SET_DATAITEM SetWmiDataItem; - PWMI_EXECUTE_METHOD ExecuteWmiMethod; - PWMI_FUNCTION_CONTROL WmiFunctionControl; -} WMILIB_CONTEXT, *PWMILIB_CONTEXT; - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -__checkReturn -NTSTATUS -WmiCompleteRequest ( - __in PDEVICE_OBJECT DeviceObject, - __inout PIRP Irp, - __in NTSTATUS Status, - __in ULONG BufferUsed, - __in CCHAR PriorityBoost - ); - -/*++ - -Routine Description: - - - This routine will do the work of completing a WMI irp. Depending upon the - the WMI request this routine will fixup the returned WNODE appropriately. - - This may be called at DPC level -Arguments: - - DeviceObject - Supplies a pointer to the device object for this request. - - Irp - Supplies the Irp making the request. - - Status has the return status code for the IRP - - BufferUsed has the number of bytes needed by the device to return the - data requested in any query. In the case that the buffer passed to - the device is too small this has the number of bytes needed for the - return data. If the buffer passed is large enough then this has the - number of bytes actually used by the device. - - PriorityBoost is the value used for the IoCompleteRequest call. - -Return Value: - - status - ---*/ -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(PASSIVE_LEVEL) -__success(TRUE) -NTSTATUS -WmiSystemControl ( - __in PWMILIB_CONTEXT WmiLibInfo, - __in PDEVICE_OBJECT DeviceObject, - __inout PIRP Irp, - __out __deref __checkReturn PSYSCTL_IRP_DISPOSITION IrpDisposition - ); - -/*++ - -Routine Description: - - Dispatch helper routine for IRP_MJ_SYSTEM_CONTROL. This routine will - determine if the irp passed contains a WMI request and if so process it - by invoking the appropriate callback in the WMILIB structure. - - This routine may only be called at passive level - -Arguments: - - WmiLibInfo has the WMI information control block - - DeviceObject - Supplies a pointer to the device object for this request. - - Irp - Supplies the Irp making the request. - - IrpDisposition - Returns a value that specifies how the irp was handled. - -Return Value: - - status - ---*/ -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -__drv_maxIRQL(DISPATCH_LEVEL) -__success(TRUE) -NTSTATUS -WmiFireEvent ( - __in PDEVICE_OBJECT DeviceObject, - __in LPCGUID Guid, - __in ULONG InstanceIndex, - __in ULONG EventDataSize, - __in_bcount_opt(EventDataSize) __drv_in(__drv_freesMem(Mem)) PVOID EventData - ); - -/*++ - -Routine Description: - - This routine will fire a WMI event using the data buffer passed. This - routine may be called at or below DPC level - -Arguments: - - DeviceObject - Supplies a pointer to the device object for this event - - Guid is pointer to the GUID that represents the event - - InstanceIndex is the index of the instance of the event - - EventDataSize is the number of bytes of data that is being fired with - with the event - - EventData is the data that is fired with the events. This may be NULL - if there is no data associated with the event - -Return Value: - - status - ---*/ -#endif // (NTDDI_VERSION >= NTDDI_WIN2K) - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/pub/ddk/ws2san.h b/pub/ddk/ws2san.h deleted file mode 100644 index afa0c3a..0000000 --- a/pub/ddk/ws2san.h +++ /dev/null @@ -1,303 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - ws2san.h - -Abstract: - - This module contains the Microsoft-specific extensions to the Windows - Sockets SPI for WinSock Direct (SAN) support. - -Revision History: - ---*/ - -#ifndef _WS2SAN_H_ -#define _WS2SAN_H_ - -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Option for getting maximum RDMA transfer size supported by provider - */ -#define SO_MAX_RDMA_SIZE 0x700D - -/* - * Option for getting minimum RDMA transfer size feasible (performance-wise) - * for the provider - */ -#define SO_RDMA_THRESHOLD_SIZE 0x700E - -/* - * The upcall table. This structure is passed by value to the service - * provider's WSPStartup() entrypoint. - */ - -typedef struct _WSPUPCALLTABLEEX { - - LPWPUCLOSEEVENT lpWPUCloseEvent; - LPWPUCLOSESOCKETHANDLE lpWPUCloseSocketHandle; - LPWPUCREATEEVENT lpWPUCreateEvent; - LPWPUCREATESOCKETHANDLE lpWPUCreateSocketHandle; - LPWPUFDISSET lpWPUFDIsSet; - LPWPUGETPROVIDERPATH lpWPUGetProviderPath; - LPWPUMODIFYIFSHANDLE lpWPUModifyIFSHandle; - LPWPUPOSTMESSAGE lpWPUPostMessage; - LPWPUQUERYBLOCKINGCALLBACK lpWPUQueryBlockingCallback; - LPWPUQUERYSOCKETHANDLECONTEXT lpWPUQuerySocketHandleContext; - LPWPUQUEUEAPC lpWPUQueueApc; - LPWPURESETEVENT lpWPUResetEvent; - LPWPUSETEVENT lpWPUSetEvent; - LPWPUOPENCURRENTTHREAD lpWPUOpenCurrentThread; - LPWPUCLOSETHREAD lpWPUCloseThread; - LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest; - -} WSPUPCALLTABLEEX, FAR * LPWSPUPCALLTABLEEX; - -/* - * An extended WSABUF, that includes a registration handle - */ - -typedef struct _WSABUFEX { - u_long len; /* the length of the buffer */ - __field_bcount(len) char FAR * buf; /* the pointer to the buffer */ - HANDLE handle; /* The handle returned by WSPRegisterMemory */ -} WSABUFEX, FAR * LPWSABUFEX; - - -/* - * WinSock 2 SPI socket function prototypes - */ - -__checkReturn -int -WSPAPI -WSPStartupEx( - __in WORD wVersionRequested, - __out LPWSPDATA lpWSPData, - __in LPWSAPROTOCOL_INFOW lpProtocolInfo, - __in LPWSPUPCALLTABLEEX lpUpcallTable, - __out LPWSPPROC_TABLE lpProcTable - ); - -typedef -__checkReturn -int -(WSPAPI * LPWSPSTARTUPEX)( - __in WORD wVersionRequested, - __out LPWSPDATA lpWSPData, - __in LPWSAPROTOCOL_INFOW lpProtocolInfo, - __in LPWSPUPCALLTABLEEX lpUpcallTable, - __out LPWSPPROC_TABLE lpProcTable - ); - -#define WSAID_REGISTERMEMORY \ - {0xC0B422F5,0xF58C,0x11d1,{0xAD,0x6C,0x00,0xC0,0x4F,0xA3,0x4A,0x2D}} - -#define WSAID_DEREGISTERMEMORY \ - {0xC0B422F6,0xF58C,0x11d1,{0xAD,0x6C,0x00,0xC0,0x4F,0xA3,0x4A,0x2D}} - -#define WSAID_REGISTERRDMAMEMORY \ - {0xC0B422F7,0xF58C,0x11d1,{0xAD,0x6C,0x00,0xC0,0x4F,0xA3,0x4A,0x2D}} - -#define WSAID_DEREGISTERRDMAMEMORY \ - {0xC0B422F8,0xF58C,0x11d1,{0xAD,0x6C,0x00,0xC0,0x4F,0xA3,0x4A,0x2D}} - -#define WSAID_RDMAWRITE \ - {0xC0B422F9,0xF58C,0x11d1,{0xAD,0x6C,0x00,0xC0,0x4F,0xA3,0x4A,0x2D}} - -#define WSAID_RDMAREAD \ - {0xC0B422FA,0xF58C,0x11d1,{0xAD,0x6C,0x00,0xC0,0x4F,0xA3,0x4A,0x2D}} - -#if(_WIN32_WINNT >= 0x0501) -#define WSAID_MEMORYREGISTRATIONCACHECALLBACK \ - {0xE5DA4AF8,0xD824,0x48CD,{0xA7,0x99,0x63,0x37,0xA9,0x8E,0xD2,0xAF}} -#endif //(_WIN32_WINNT >= 0x0501) - -#define MEM_READ 1 -#define MEM_WRITE 2 -#define MEM_READWRITE 3 - - -__checkReturn -HANDLE WSPAPI -WSPRegisterMemory( - __in SOCKET s, - __in_bcount(dwBufferLength) PVOID lpBuffer, - __in DWORD dwBufferLength, - __in DWORD dwFlags, - __out LPINT lpErrno - ); - -int WSPAPI -WSPDeregisterMemory( - __in SOCKET s, - __in HANDLE handle, - __out LPINT lpErrno - ); - -__checkReturn -int WSPAPI -WSPRegisterRdmaMemory( - __in SOCKET s, - __in_bcount(dwBufferLength) PVOID lpBuffer, - __in DWORD dwBufferLength, - __in DWORD dwFlags, - __out_bcount(*lpdwDescriptorLength) LPVOID lpRdmaBufferDescriptor, - __inout LPDWORD lpdwDescriptorLength, - __out LPINT lpErrno - ); - -int WSPAPI -WSPDeregisterRdmaMemory( - __in SOCKET s, - __in_bcount(dwDescriptorLength) LPVOID lpRdmaBufferDescriptor, - __in DWORD dwDescriptorLength, - __out LPINT lpErrno - ); - -int WSPAPI -WSPRdmaWrite( - __in SOCKET s, - __in_ecount(dwBufferCount) LPWSABUFEX lpBuffers, - __in DWORD dwBufferCount, - __in_bcount(dwTargetDescriptorLength) LPVOID lpTargetBufferDescriptor, - __in DWORD dwTargetDescriptorLength, - __in DWORD dwTargetBufferOffset, - __out LPDWORD lpdwNumberOfBytesWritten, - __in DWORD dwFlags, - __in_opt LPWSAOVERLAPPED lpOverlapped, - __in_opt LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, - __in LPWSATHREADID lpThreadId, - __out LPINT lpErrno - ); - -int WSPAPI -WSPRdmaRead( - __in SOCKET s, - __in_ecount(dwBufferCount) LPWSABUFEX lpBuffers, - __in DWORD dwBufferCount, - __in_bcount(dwTargetDescriptorLength) LPVOID lpTargetBufferDescriptor, - __in DWORD dwTargetDescriptorLength, - __in DWORD dwTargetBufferOffset, - __out LPDWORD lpdwNumberOfBytesRead, - __in DWORD dwFlags, - __in_opt LPWSAOVERLAPPED lpOverlapped, - __in_opt LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, - __in LPWSATHREADID lpThreadId, - __out LPINT lpErrno - ); - -#if(_WIN32_WINNT >= 0x0501) -__checkReturn -int WSPAPI -WSPMemoryRegistrationCacheCallback( - __in_bcount(Size) LPVOID lpvAddress, - __in SIZE_T Size, - __out LPINT lpErrno - ); -#endif //(_WIN32_WINNT >= 0x0501) - -/* - * "QueryInterface" versions of the above APIs. - */ - -typedef -__checkReturn -HANDLE -(WSPAPI * LPFN_WSPREGISTERMEMORY)( - __in SOCKET s, - __in_bcount(dwBufferLength) PVOID lpBuffer, - __in DWORD dwBufferLength, - __in DWORD dwFlags, - __out LPINT lpErrno - ); - -typedef -int -(WSPAPI * LPFN_WSPDEREGISTERMEMORY)( - __in SOCKET s, - __in HANDLE handle, - __out LPINT lpErrno - ); - -typedef -__checkReturn -BOOL -(WSPAPI * LPFN_WSPREGISTERRDMAMEMORY)( - __in SOCKET s, - __in_bcount(dwBufferLength) PVOID lpBuffer, - __in DWORD dwBufferLength, - __in DWORD dwFlags, - __out_bcount(*lpdwDescriptorLength) LPVOID lpRdmaBufferDescriptor, - __inout LPDWORD lpdwDescriptorLength, - __out LPINT lpErrno - ); - -typedef -int -(WSPAPI * LPFN_WSPDEREGISTERRDMAMEMORY)( - __in SOCKET s, - __in_bcount(dwDescriptorLength) LPVOID lpRdmaBufferDescriptor, - __in DWORD dwDescriptorLength, - __out LPINT lpErrno - ); - -typedef -int -(WSPAPI * LPFN_WSPRDMAWRITE)( - __in SOCKET s, - __in_ecount(dwBufferCount) LPWSABUFEX lpBuffers, - __in DWORD dwBufferCount, - __in_bcount(dwTargetDescriptorLength) LPVOID lpTargetBufferDescriptor, - __in DWORD dwTargetDescriptorLength, - __in DWORD dwTargetBufferOffset, - __out LPDWORD lpdwNumberOfBytesWritten, - __in DWORD dwFlags, - __in_opt LPWSAOVERLAPPED lpOverlapped, - __in_opt LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, - __in LPWSATHREADID lpThreadId, - __out LPINT lpErrno - ); - -typedef -int -(WSPAPI * LPFN_WSPRDMAREAD)( - __in SOCKET s, - __in_ecount(dwBufferCount) LPWSABUFEX lpBuffers, - __in DWORD dwBufferCount, - __in_bcount(dwTargetDescriptorLength) LPVOID lpTargetBufferDescriptor, - __in DWORD dwTargetDescriptorLength, - __in DWORD dwTargetBufferOffset, - __out LPDWORD lpdwNumberOfBytesRead, - __in DWORD dwFlags, - __in_opt LPWSAOVERLAPPED lpOverlapped, - __in_opt LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, - __in LPWSATHREADID lpThreadId, - __out LPINT lpErrno - ); - -#if(_WIN32_WINNT >= 0x0501) -typedef -__checkReturn -int -(WSPAPI * LPFN_WSPMEMORYREGISTRATIONCACHECALLBACK)( - __in_bcount(Size) LPVOID lpvAddress, - __in SIZE_T Size, - __out LPINT lpErrno - ); -#endif //(_WIN32_WINNT >= 0x0501) - -#ifdef __cplusplus -} -#endif - -#endif // _WS2SAN_H_ - diff --git a/pub/ddk/wsk.h b/pub/ddk/wsk.h deleted file mode 100644 index d6fd9be..0000000 --- a/pub/ddk/wsk.h +++ /dev/null @@ -1,1589 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - wsk.h - -Abstract: - - This module contains the definitions and structures for - the Windows Sockets Kernel-Mode Interface. - -Environment: - - Kernel-Mode only - ---*/ - -#ifndef _WSK_ -#define _WSK_ - -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -// -// Socket object. -// -// 'Dispatch' can be one of 4 types depending on the socket type: -// PWSK_PROVIDER_BASIC_DISPATCH, PWSK_PROVIDER_LISTEN_DISPATCH, -// PWSK_PROVIDER_DATAGRAM_DISPATCH, PWSK_PROVIDER_CONNECTION_DISPATCH -// - -typedef struct _WSK_SOCKET { - CONST VOID *Dispatch; -} WSK_SOCKET, *PWSK_SOCKET; - -// -// Client object -// -typedef PVOID PWSK_CLIENT; - -// -// WSK API calling convention -// -#define WSKAPI NTAPI - -// -// WSK Interface ID -// -extern CONST NPIID NPI_WSK_INTERFACE_ID; - -// -// WSK client must use the following macro to initialize the Version field -// in its WSK_CLIENT_DISPATCH structure. -// -#define MAKE_WSK_VERSION(Mj, Mn) ((USHORT)((Mj) << 8) | (USHORT)((Mn) & 0xff)) - -// -// WSK client must use the following macros to extract the Major and Minor -// version numbers from the HighestVersion and LowestVersion fields of the -// WSK_PROVIDER_CHARACTERISTICS structure, and the Version field of the -// WSK_PROVIDER_DISPATCH structure. -// -#define WSK_MAJOR_VERSION(V) ((UCHAR)((V) >> 8)) -#define WSK_MINOR_VERSION(V) ((UCHAR)(V)) - -// -// WSK Provider characteristics determine the range of versions of the WSK -// interface supported by the WSK provider -// - -typedef struct _WSK_PROVIDER_CHARACTERISTICS { - USHORT HighestVersion; - USHORT LowestVersion; -} WSK_PROVIDER_CHARACTERISTICS, *PWSK_PROVIDER_CHARACTERISTICS; - -// -// Transport information structure -// - -typedef struct _WSK_TRANSPORT { - USHORT Version; // Version of the transport - USHORT SocketType; - ULONG Protocol; - ADDRESS_FAMILY AddressFamily; - GUID ProviderId; -} WSK_TRANSPORT, *PWSK_TRANSPORT; - -// -// Buffer structure used for sending/receiving data. -// Mdl points to a chain of memory descriptors (scatter/gather list). -// The data described begin at 'Offset' and extend for 'Length' bytes. -// N.B. 'Offset' is required to lie entirely within the first MDL in -// the chain. -// - -typedef struct _WSK_BUF { - PMDL Mdl; // Locked MDL chain - ULONG Offset; // Offset into the "first" Mdl in the chain - SIZE_T Length; // Length of data starting from Offset -} WSK_BUF, *PWSK_BUF; - -// -// Data Indication structure used for indicating incoming data buffers -// on connection-oriented sockets. -// - -typedef struct _WSK_DATA_INDICATION { - struct _WSK_DATA_INDICATION *Next; - WSK_BUF Buffer; -} WSK_DATA_INDICATION, *PWSK_DATA_INDICATION; - -// -// Datagram Indication structure used for indicating incoming datagrams -// on datagram sockets. -// - -typedef struct _WSK_DATAGRAM_INDICATION { - struct _WSK_DATAGRAM_INDICATION *Next; - WSK_BUF Buffer; - __field_bcount(ControlInfoLength) PCMSGHDR ControlInfo; - ULONG ControlInfoLength; - PSOCKADDR RemoteAddress; -} WSK_DATAGRAM_INDICATION, *PWSK_DATAGRAM_INDICATION; - -// -// Identification structure used for conditional-accept. -// - -typedef struct _WSK_INSPECT_ID { - ULONG_PTR Key; - ULONG SerialNumber; -} WSK_INSPECT_ID, *PWSK_INSPECT_ID; - -// -// Actions that can be taken for connect request inspection -// on a conditional-accept listening socket. -// - -typedef enum { - WskInspectReject, // reject the connection request - WskInspectAccept, // proceed with accept - WskInspectPend, // delay the decision (use WskInspectComplete later) - WskInspectMax -} WSK_INSPECT_ACTION, *PWSK_INSPECT_ACTION; - -// -// Flag used by some callback routines to indicate that the callback was -// invoked at DISPATCH_LEVEL IRQL. -// - -#define WSK_FLAG_AT_DISPATCH_LEVEL 0x00000008 - -// -// Event indication callbacks -// -// Event indications are delivered in arbitrary thread context. -// - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_CLIENT_EVENT) ( - __in_opt PVOID ClientContext, - __in ULONG EventType, - __in_bcount_opt(InformationLength) PVOID Information, - __in SIZE_T InformationLength - ); -/* - * Indicates client-specific control event. - * - * Parameters: - * ClientContext - ClientContext value that was passed to WskRegister - * EventType - No event types are currently defined. - * Information - Optional event specific information. - * InformationLength - Length of information. - * Returns: - * STATUS_SUCCESS unless otherwise is specified by specific EventTypes. - */ - -typedef -__checkReturn -NTSTATUS -(WSKAPI * PFN_WSK_RECEIVE_FROM_EVENT) ( - __in_opt PVOID SocketContext, - __in ULONG Flags, - __in_opt PWSK_DATAGRAM_INDICATION DataIndication - ); -/* - * Indicates that one or more datagrams have arrived on one of the datagram - * socket objects created by the client - * - * Parameters: - * SocketContext - Context value associated with the socket on which - * datagram(s) were received. - * Flags - MSG_BCAST, MSG_MCAST, WSK_FLAG_AT_DISPATCH_LEVEL - * DataIndication - List of one or more datagrams. - * NULL denotes that socket needs to be closed. - * Returns: - * STATUS_SUCCESS - Datagram(s) were consumed and further indication should be - * made when new datagrams arrive. - * STATUS_PENDING - Datagram(s) were retained by the client and the data must - * remain valid until released by the client. Further indication should be - * made when new datagrams arrive. - * STATUS_DATA_NOT_ACCEPTED - Datagram(s) could not be processed and should be - * buffered by the transport if possible or required by the - * protocol. No further indication should be made until - * message indication callbacks are specifically re-enabled. - */ - -// -// Forward declaration for connected socket callback table -// -typedef struct _WSK_CLIENT_CONNECTION_DISPATCH - WSK_CLIENT_CONNECTION_DISPATCH, *PWSK_CLIENT_CONNECTION_DISPATCH; - -typedef -__checkReturn -__drv_arg(AcceptSocket, __drv_aliasesMem) -NTSTATUS -(WSKAPI * PFN_WSK_ACCEPT_EVENT) ( - __in_opt PVOID SocketContext, - __in ULONG Flags, - __in PSOCKADDR LocalAddress, - __in PSOCKADDR RemoteAddress, - __in_opt PWSK_SOCKET AcceptSocket, - __deref_out_opt PVOID *AcceptSocketContext, - __deref_out_opt CONST WSK_CLIENT_CONNECTION_DISPATCH **AcceptSocketDispatch - ); -/* - * Indicates that a connection request has arrived on one of the listening - * sockets created by the client. Note that when this callback is made, - * connection setup handshake with the remote party have already taken place. - * - * Parameters: - * SocketContext - Context value associated with the listening socket - * on which connection request has been received. - * Flags - WSK_FLAG_AT_DISPATCH_LEVEL - * LocalAddress - Local transport address this connection request arrived on. - * Useful if the listening socket is bound to the wildcard address. - * RemoteAddress - Transport address of the remote party. - * AcceptSocket - New connected socket object that represent the connection. - * NULL denotes that listening socket must be closed. - * AcceptSocketContext - OUT parameter through which the client passes the - * SocketContext for the new socket to WSK. WSK client must initialize - * this parameter before enabling event callbacks via - * SO_WSK_EVENT_CALLBACK option. - * AcceptSocketDispatch - OUT parameter through which the client passes the - * callback routines for the new socket to WSK. WSK client must - * initialize this parameter before enabling callbacks via - * SO_WSK_EVENT_CALLBACK option. - * Returns: - * STATUS_SUCCESS - Client accepted the connection. - * STATUS_REQUEST_NOT_ACCEPTED - Client rejected the connection. WSK provider - * will close the socket. Client should not touch the socket any more. - */ - -typedef -__checkReturn -WSK_INSPECT_ACTION -(WSKAPI * PFN_WSK_INSPECT_EVENT) ( - __in_opt PVOID SocketContext, - __in PSOCKADDR LocalAddress, - __in PSOCKADDR RemoteAddress, - __in_opt PWSK_INSPECT_ID InspectID - ); -/* - * Indicates that a connection request has arrived on a conditional-accept - * listening socket. This callback is used only for conditional-accept sockets. - * This indication allows the client to decide if it wants to proceed with - * regular connection acceptance before any actual connection setup handshake - * with the remote party takes place. If the client decides to proceed with - * regular acceptance than the WskAcceptEvent callback will be invoked later - * if/when the connectin setup handshake with the remote party is performed - * successfully. - * - * Parameters: - * SocketContext - Context value associated with the listening socket - * on which connection request has been received. - * LocalAddress - Local transport address this connection request arrived on. - * Useful if the listening socket is bound to the wildcard address. - * RemoteAddress - Transport address of the remote party. - * InspectID - Pointer to the inspect ID structure. The connection request - * is identified via the contents of this structure (NOT via the - * pointer to the structure) until the WskAcceptEvent callback - * happens. If the client wants to preserve the inspect ID then it - * needs to copy this structure to its own memory before returning - * from this callback. - * NULL InspectID denotes that listening socket is to be closed. - * Returns: - * WskInspectReject - Reject the connection request immediately. Neither - * WskAcceptEvent nor WskAbortEvent will be invoked. - * WskInspectAccept - Proceed with regular acceptance. WskAcceptEvent - * or WskAbortEvent may be invoked. - * WskInspectPend - Delay the decision. Client may invoke WskInspectComplete later to - * convey its decision. WskAbortEvent may be invoked in - * the meantime. - */ - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_ABORT_EVENT) ( - __in_opt PVOID SocketContext, - __in PWSK_INSPECT_ID InspectID - ); -/* - * Indicates that a previous connection request indicated by WskInspectEvent - * callback is dropped. This callback is used only for conditional-accept - * sockets. - * - * Parameters: - * SocketContext - Context value associated with the listening socket - * on which connection request was received. - * InspectID - Pointer to the inspect ID structure. The connection request - * is identified via the contents of this structure (NOT via the - * pointer to the structure.) If the client wants to preserve the - * inspect ID then it needs to copy this sturcture to its own - * memory before returning from this callback. - * Returns: - * STATUS_SUCCESS - This is the only allowed return value. - */ - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_SEND_BACKLOG_EVENT) ( - __in_opt PVOID SocketContext, - __in SIZE_T IdealBacklogSize - ); -/* - * Indicates that the ideal send backlog size has changed for the connection. - * The ideal send backlog size denotes the optimal amount of send data that - * needs to be kept outstanding (passed to the WSK provider, but not completed - * by the WSK provider yet) in order to keep the data pipe full at all times. - * - * Parameters: - * SocketContext - Context value associated with the socket object. - * IdealBacklogSize - Ideal send backlog size - * Returns: - * STATUS_SUCCESS - This is the only allowed return value. - */ - -// -// Flag that denotes that the indicated buffers should NOT be -// retained by the client indefinitely. The client should -// avoid retaining such buffers, but if it does retain, then -// it has to release them ASAP. -// - -#define WSK_FLAG_RELEASE_ASAP 0x00000002 - -#define WSK_FLAG_ENTIRE_MESSAGE 0x00000004 - -typedef -__checkReturn -NTSTATUS -(WSKAPI * PFN_WSK_RECEIVE_EVENT) ( - __in_opt PVOID SocketContext, - __in ULONG Flags, - __in_opt PWSK_DATA_INDICATION DataIndication, - __in SIZE_T BytesIndicated, - __inout SIZE_T *BytesAccepted - ); -/* - * Indicates that data has arrived on one of the connected socket objects - * created by the client - * - * Parameters: - * SocketContext - Context value associated with the socket object on which - * data was received. - * Flags - WSK_FLAG_RELEASE_ASAP, WSK_FLAG_ENTIRE_MESSAGE, - * WSK_FLAG_AT_DISPATCH_LEVEL - * DataIndication - List of one or more data buffers - * NULL denotes that socket needs to be closed. - * BytesIndicated - Total number of bytes being indicated. - * BytesAccepted - Number of bytes client accepted. Client needs to set this - * OUT parameter only if it wishes to accept a data indication partially. - * This OUT parameter is ignored if client returns STATUS_DATA_NOT_ACCEPTED - * or STATUS_PENDING. The parameter is meaningful only when client returns - * STATUS_SUCCESS. If the client wants to fully accept the indicated buffers - * then it does NOT have to set this parameter, i.e. returning STATUS_SUCCESS - * without touching this parameter means full acceptance. - * Returns: - * STATUS_SUCCESS - Data buffer(s) were fully or partially consumed. If - * indication was fully consumed, further indication should be made when - * more data arrives. If indication was partially consumed, i.e. client - * sets the BytesAccepted parameter to a number smaller than BytesIndicated, - * then no further indications will be made until the client posts a - * WskReceive request and it gets completed. - * STATUS_PENDING - Data buffer(s) were retained by the client and the data - * must remain valid until released. Further indications should be made - * when more data arrives. - * STATUS_DATA_NOT_ACCEPTED - Data buffer(s) could not be processed and should - * be buffered by the transport if possible or required by the protocol. - * No further indications will be made until the client posts a WskReceive - * request and it gets completed. - */ - -// -// Flags for indicating abortive/graceful connection teardown -// - -#define WSK_FLAG_ABORTIVE 0x00000001 - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_DISCONNECT_EVENT) ( - __in_opt PVOID SocketContext, - __in ULONG Flags - ); -/* - * Indicates that peer of the connection has initiated disconnect sequence. - * - * Parameters: - * SocketContext - Context associated with the connected socket object. - * Flags - indicates whether disconnect is graceful or abortive (if the - * WSK_FLAG_ABORTIVE flag is set, it's abortive, otherwise it's graceful.) - * WSK_FLAG_AT_DISPATCH_LEVEL - * Returns: - * STATUS_SUCCESS - This is the only allowed return value. - */ - -// -// Flags denoting WSK socket types -// - -#define WSK_FLAG_BASIC_SOCKET 0x00000000 -#define WSK_FLAG_LISTEN_SOCKET 0x00000001 -#define WSK_FLAG_CONNECTION_SOCKET 0x00000002 -#define WSK_FLAG_DATAGRAM_SOCKET 0x00000004 - -typedef -__drv_arg(Irp->IoStatus.Information, __drv_allocatesMem(Mem)) -NTSTATUS -(WSKAPI * PFN_WSK_SOCKET) ( - __in PWSK_CLIENT Client, - __in ADDRESS_FAMILY AddressFamily, - __in USHORT SocketType, - __in ULONG Protocol, - __in ULONG Flags, - __in_opt PVOID SocketContext, - __in_opt CONST VOID *Dispatch, - __in_opt PEPROCESS OwningProcess, - __in_opt PETHREAD OwningThread, - __in_opt PSECURITY_DESCRIPTOR SecurityDescriptor, - __inout PIRP Irp - ); -/* - * Creates socket object - * - * Parameters: - * - * Client - Pointer to the Client object returned by WskCaptureProviderNPI - * AddressFamily - address family, e.g. AF_INET, AF_INET6 - * SocketType - socket type, e.g. SOCK_STREAM, SOCK_DGRAM - * Protocol - protocol, e.g. IPPROTO_TCP, IPPROTO_UDP - * Flags - WSK_FLAG_LISTEN_SOCKET - This socket will be used for listening for - * incoming connection requests. - * WSK_FLAG_CONNECTION_SOCKET - This socket will be for connecting - * to a remote party. - * WSK_FLAG_DATAGRAM_SOCKET - This socket will be used for sending and - * receiving datagrams. - * WSK_FLAG_BASIC_SOCKET - This socket will be used for basic control - * operations. - * SocketContext - Context value to pass in event callbacks - * Dispatch - pointer to a constant structure that contains pointers to - * callback routines. OPTIONAL if client won't be enabling callbacks. - * Client must provide the right callback table based on socket type: - * WSK_CLIENT_LISTEN_DISPATCH for WSK_FLAG_LISTEN_SOCKET, - * WSK_CLIENT_CONNECTION_DISPATCH for WSK_FLAG_CONNECTION_SOCKET, - * WSK_CLIENT_DATAGRAM_DISPATCH for WSK_FLAG_DATAGRAM_SOCKET, - * NULL for WSK_FLAG_BASIC_SOCKET. - * OwningProcess - The process to retrieve the security context from. If this - * is set to NULL then the current process is assumed. This is - * used for implementing transport address security during bind. - * OwningThread - The thread to retrieve the security context from. This is - * useful only if an impersonation token is in effect and used - * for implementing transport address security during bind. - * SecurityDescriptor - Optional security descriptor to protect the transport - * address that this socket will be bound to. Only the - * security descriptors obtained from the NT object - * manager's security descriptor cache can be specified. - * Irp - IRP for async completion of the request - * - * Returns: - * - * If the request is completed succesfully, the Irp.IoStatus.Information - * field will be holding a pointer to the new socket (PWSK_SOCKET) - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - -typedef -__drv_arg(Irp->IoStatus.Information, __drv_allocatesMem(Mem)) -NTSTATUS -(WSKAPI * PFN_WSK_SOCKET_CONNECT) ( - __in PWSK_CLIENT Client, - __in USHORT SocketType, - __in ULONG Protocol, - __in PSOCKADDR LocalAddress, - __in PSOCKADDR RemoteAddress, - __reserved ULONG Flags, - __in_opt PVOID SocketContext, - __in_opt CONST WSK_CLIENT_CONNECTION_DISPATCH *Dispatch, - __in_opt PEPROCESS OwningProcess, - __in_opt PETHREAD OwningThread, - __in_opt PSECURITY_DESCRIPTOR SecurityDescriptor, - __inout PIRP Irp - ); -/* - * Creates, binds, and connects a socket object. - * - * Parameters: - * Client - Pointer to the Client object returned by WskCaptureProviderNPI - * SocketType - socket type, e.g. SOCK_STREAM - * Protocol - protocol, e.g. IPPROTO_TCP - * LocalAddress - Local address to bind the socket to. - * RemoteAddress - Remote address to connect to. - * Flags - Reserved. (Must be 0) - * SocketContext - Context value to pass in event callbacks - * Dispatch - pointer to a constant structure that contains pointers to - * callback routines. OPTIONAL if client won't be enabling callbacks. - * OwningProcess - The process to retrieve the security context from. If this - * is set to NULL then the current process is assumed. This is - * used for implementing transport address security during bind. - * OwningThread - The thread to retrieve the security context from. This is - * useful only if an impersonation token is in effect and used - * for implementing transport address security during bind. - * SecurityDescriptor - Optional security descriptor to protect the transport - * address that this socket will be bound to. Only the - * security descriptors obtained from the NT object - * manager's security descriptor cache can be specified. - * Irp - IRP for async completion of the request - * - * Returns: - * - * If the request is completed succesfully, the Irp.IoStatus.Information - * field will be holding a pointer to the new socket (PWSK_SOCKET) - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - -// -// Client Level Control Codes -// - -#define WSK_TRANSPORT_LIST_QUERY 2 -#define WSK_TRANSPORT_LIST_CHANGE 3 -#define WSK_CACHE_SD 4 -#define WSK_RELEASE_SD 5 -#define WSK_TDI_DEVICENAME_MAPPING 6 -#define WSK_SET_STATIC_EVENT_CALLBACKS 7 -#define WSK_TDI_BEHAVIOR 8 - -// -// Structures used with WSK_TDI_DEVICENAME_MAPPING control request -// - -typedef struct _WSK_TDI_MAP { - USHORT SocketType; - ADDRESS_FAMILY AddressFamily; - ULONG Protocol; - PCWSTR TdiDeviceName; -} WSK_TDI_MAP, *PWSK_TDI_MAP; - -typedef struct _WSK_TDI_MAP_INFO { - CONST ULONG ElementCount; - __field_ecount(ElementCount) CONST WSK_TDI_MAP *Map; -} WSK_TDI_MAP_INFO, *PWSK_TDI_MAP_INFO; - -// -// Flag used with WSK_TDI_BEHAVIOR control request -// -#define WSK_TDI_BEHAVIOR_BYPASS_TDI 0x00000001 - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_CONTROL_CLIENT) ( - __in PWSK_CLIENT Client, - __in ULONG ControlCode, - __in SIZE_T InputSize, - __in_bcount_opt(InputSize) PVOID InputBuffer, - __in SIZE_T OutputSize, - __out_bcount_opt(OutputSize) PVOID OutputBuffer, - __out_opt SIZE_T *OutputSizeReturned, - __inout_opt PIRP Irp - ); -/* - * Issues control request to WSK subsystem, e.g., registration for protocol - * change notifications, etc. - * - * Parameters: - * Client - Pointer to the Client object returned by WskCaptureProviderNPI - * ControlCode - request code. currently defined codes are: - * WSK_TRANSPORT_LIST_QUERY - Retrieves the array of transports - * into the OutputBuffer. InputSize and InputBuffer parameters - * are ignored. Irp must be NULL and pOutputSize must be Non-NULL. - * WSK_TRANSPORT_LIST_CHANGE - Notifies the client when a - * transport is added or removed. InputSize/InputBuffer, - * OutputSize/OutputBuffer, and pOutputSize parameters are - * ignored. Irp must be specified. - * InputSize - size of the input data residing in InputBuffer - * InputBuffer - buffer that holds input data - * OutputSize - size of the OutputBuffer - * OutputBuffer - buffer that will hold output data - * OutputSizeReturned - address of a variable that will contain the actual size - * of data copied into the OutputBuffer. This parameter is - * ignored if the Irp parameter is specified. - * Irp - IRP for the asynchronous completion of the request. Upon completion, - * Irp->Iostatus.Information will hold the actual size of data copied - * into the OutputBuffer. - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later (Irp was specified.) - * FAILURES - request failed - */ - -#if (NTDDI_VERSION >= NTDDI_WIN7) - -typedef -__drv_arg(*Result, __drv_allocatesMem(Mem)) -NTSTATUS -(WSKAPI * PFN_WSK_GET_ADDRESS_INFO) ( - __in PWSK_CLIENT Client, - __in_opt PUNICODE_STRING NodeName, - __in_opt PUNICODE_STRING ServiceName, - __in_opt ULONG NameSpace, - __in_opt GUID *Provider, - __in_opt PADDRINFOEXW Hints, - __deref_out PADDRINFOEXW *Result, - __in_opt PEPROCESS OwningProcess, - __in_opt PETHREAD OwningThread, - __inout PIRP Irp - ); -/* - * Provides protocol independent translation from host name to address. - * - * Parameters: - * Client - Pointer to the Client object returned by WskCaptureProviderNPI - * NodeName - Pointer to a UNICODE_STRING that contains a host (node) name. The - * host name must be a NULL-terminated unicode string. Either NodeName or - * ServiceName must point to a non-emptry string. - * ServiceName - Pointer to a UNICODE_STRING that contains either a service name - * or port number represented as a string. The service name or port number - * must be a NULL-terminated unicode string. Either NodeName or - * ServiceName must point to a non-emptry string. - * NameSpace - a namespace identifier that determines which namespace providers - * are queried. Passing a specific namespace identifier will result in - * only namespace providers that support the specified namepsace being - * queried. - * Provider - Pointer to a GUID of a specific namespace provider to query. Passing - * the GUID of specific namespace provider will result in only the specified - * namespace provider being queried. - * Hints - Pointer to an ADDRINFOEXW structure that provides hints about the type - * of socket the caller supports. - * Result - Pointer to a linked list of one or more ADDRINFOEXW structures that - * contains response information about the host. The caller must call - * WskFreeAddressInfo to free it. - * OwningProcess - The process to retrieve the security context from. If this is - * set to NULL then the current process is assumed. - * OwningThread - The thread to retrieve the security context from. This is - * valid only if an impersonation token is in effect. This can be NULL - * only if the OwningProcess is NULL too. - * Irp - IRP for async completion of the request. Upon completion, - * Irp->Iostatus.Information will hold the returned status code. - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later (Irp was specified.) - * FAILURES - request failed - */ - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_GET_NAME_INFO) ( - __in PWSK_CLIENT Client, - __in PSOCKADDR SockAddr, - __in ULONG SockAddrLength, - __out_opt PUNICODE_STRING NodeName, - __out_opt PUNICODE_STRING ServiceName, - __in ULONG Flags, - __in_opt PEPROCESS OwningProcess, - __in_opt PETHREAD OwningThread, - __inout PIRP Irp - ); -/* - * Provides protocol independent translation from address to host name. - * - * Parameters: - * Client - Pointer to the Client object returned by WskCaptureProviderNPI - * SockAddr - Pointer to a socket address structure containing the IP address - * and port number of the socket. - * SockAddrLength - The length, in bytes, of the structure pointed to by the - * SockAddr parameter. The size should not exceed size of - * SOCKADDR_STORAGE. - * NodeName - Pointer to a UNICODE_STRING to hold the host name. On success, - * the Unicode host name is written into the buffer as a Fully Qualified - * Domain Name (FQDN) by default. The caller must provide a buffer large - * enough to hold the Unicode host name, including the terminating NULL - * character. If the NodeBuffer parameter is NULL, this indicates the - * caller does not want to receive a host name string. Either NodeBuffer - * or ServiceBuffer MUST be not NULL. - * ServiceName - Pointer to a UNICODE_STRING to hold the service name. On success, - * a Unicode string representing the service name associated with the port - * number is written into the buffer. The caller must provide a buffer large - * enough to hold the Unicode host name, including the terminating NULL - * character. If the ServiceBuffer parameter is NULL, this indicates the - * caller does not want to receive a service name string. Either NodeBuffer - * or ServiceBuffer MUST be not NULL. - * Flags - A value used to customize processing of the function. - * OwningProcess - The process to retrieve the security context from. If this is - * set to NULL then the current process is assumed. - * OwningThread - The thread to retrieve the security context from. This is - * valid only if an impersonation token is in effect. This can be NULL - * only if the OwningProcess is NULL too. - * Irp - IRP for async completion of the request. Upon completion, - * Irp->Iostatus.Information will hold the returned status code. - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later (Irp was specified.) - * FAILURES - request failed - */ - -typedef -__drv_arg(AddrInfo, __drv_freesMem(Mem)) -VOID -(WSKAPI * PFN_WSK_FREE_ADDRESS_INFO) ( - __in PWSK_CLIENT Client, - __in PADDRINFOEXW AddrInfo - ); -/* - * Free ADDRINFOEXW returned by WskGetAddressInfo to WSK subsystem. - * - * Parameters: - * Client - Pointer to the Client object returned by WskCaptureProviderNPI - * AddrInfo - ADDRINFOEXW structure returned by WskGetAddressInfo. - * - * Returns: - * - * None. - * - */ - -#endif // if (NTDDI_VERSION >= NTDDI_WIN7) - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_BIND) ( - __in PWSK_SOCKET Socket, - __in PSOCKADDR LocalAddress, - __reserved ULONG Flags, - __inout PIRP Irp - ); -/* - * Bind local (unicast or multicast) tranport address to a socket - * - * Parameters: - * Socket - socket object to bind address to - * LocalAddress - transport address specification - * Flags - Reserved. (Must be 0) - * Irp - IRP for async completion - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_CONNECT) ( - __in PWSK_SOCKET Socket, - __in PSOCKADDR RemoteAddress, - __reserved ULONG Flags, - __inout PIRP Irp - ); -/* - * Establish comunication with the entity or group specified by the transport - * address by means appropriate for the protocol (e.g. run protocol to - * establish a VC and/or make sure the address is reachable and/or - * cache the routing entry, etc) - * - * Parameters: - * Socket - socket object to establish connection for - * RemoteAddress - transport address specification - * Flags - Reserved. (Must be 0) - * Irp - IRP for async completion - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - -// -// Option/IOCTL Levels -// - -// -// Socket Level Options specific to WSK -// (Standard socket level options are defined in ws2def.h) -// - -#define SO_WSK_SECURITY (WSK_SO_BASE+1) -#define SO_WSK_EVENT_CALLBACK (WSK_SO_BASE+2) - -// -// Flags for enabling event callbacks via WskControlSocket call with -// SO_WSK_EVENT_CALLBACK option. -// - -#define WSK_EVENT_RECEIVE_FROM 0x00000100 // Datagram sockets -#define WSK_EVENT_ACCEPT 0x00000200 // Listen sockets -#define WSK_EVENT_SEND_BACKLOG 0x00000010 // Connection and Listen sockets -#define WSK_EVENT_RECEIVE 0x00000040 // Connection and Listen sockets -#define WSK_EVENT_DISCONNECT 0x00000080 // Connection and Listen sockets - -// -// Flag for disabling a given event callback via WskControlSocket call with -// SO_WSK_EVENT_CALLBACK option. -// -#define WSK_EVENT_DISABLE 0x80000000 - -// -// Structure used with SO_WSK_EVENT_CALLBACK to enable/disable event callbacks -// -typedef struct _WSK_EVENT_CALLBACK_CONTROL { - PNPIID NpiId; - ULONG EventMask; -} WSK_EVENT_CALLBACK_CONTROL, *PWSK_EVENT_CALLBACK_CONTROL; - -// -// IOCTL codes specific to WSK -// - -#define SIO_WSK_SET_REMOTE_ADDRESS _WSAIOW(IOC_WSK,0x1) -#define SIO_WSK_REGISTER_EXTENSION _WSAIORW(IOC_WSK,0x2) -#define SIO_WSK_QUERY_IDEAL_SEND_BACKLOG _WSAIOR(IOC_WSK,0x3) -#define SIO_WSK_QUERY_RECEIVE_BACKLOG _WSAIOR(IOC_WSK,0x4) -#define SIO_WSK_QUERY_INSPECT_ID _WSAIOR(IOC_WSK,0x5) -#define SIO_WSK_SET_SENDTO_ADDRESS _WSAIOW(IOC_WSK,0x6) - -// -// Input structure used with SIO_WSK_REGISTER_EXTENSION -// -typedef struct _WSK_EXTENSION_CONTROL_IN { - PNPIID NpiId; - PVOID ClientContext; - CONST VOID* ClientDispatch; -} WSK_EXTENSION_CONTROL_IN, *PWSK_EXTENSION_CONTROL_IN; - -// -// Output structure used with SIO_WSK_REGISTER_EXTENSION -// -typedef struct _WSK_EXTENSION_CONTROL_OUT { - PVOID ProviderContext; - CONST VOID* ProviderDispatch; -} WSK_EXTENSION_CONTROL_OUT, *PWSK_EXTENSION_CONTROL_OUT; - - -typedef enum { - WskSetOption, // set socket option - WskGetOption, // get socket option - WskIoctl, // socket IOCTL - WskControlMax -} WSK_CONTROL_SOCKET_TYPE, *PWSK_CONTROL_SOCKET_TYPE; - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_CONTROL_SOCKET) ( - __in PWSK_SOCKET Socket, - __in WSK_CONTROL_SOCKET_TYPE RequestType, - __in ULONG ControlCode, - __in ULONG Level, - __in SIZE_T InputSize, - __in_bcount_opt(InputSize) PVOID InputBuffer, - __in SIZE_T OutputSize, - __out_bcount_opt(OutputSize) PVOID OutputBuffer, - __out_opt SIZE_T *OutputSizeReturned, - __inout_opt PIRP Irp - ); -/* - * - * Parameters: - * Socket - socket object - * RequestType - WskSetOption, WskGetOption, or WskIoctl - * ControlCode - what kind of the request - * Level - SOL_SOCKET for socket-level options, - * Protocol number for transport/network specific options - * InputSize - size of the input data residing in InputBuffer - * InputBuffer - buffer that holds input data - * OutputSize - size of the OutputBuffer - * OutputBuffer - buffer that will hold output data - * OutputSizeReturned - if Irp is NULL for a ControlCode than this parameter - * must be specified to store the number of bytes written - * into OutputBuffer upon in-line completion of the request. - * Irp - IRP for the asynchronous completion of the request. Upon completion, - * Irp->Iostatus.Information will hold the actual size of data copied - * into the OutputBuffer. This will be either a required parameter or - * ignored (and must be NULL), or optional based on the ControlCode. - * - * Returns: - * - * SUCCESS - request succeeded - * STATUS_REQUEST_NOT_ACCEPTED - Inline completion is not possible. - * PENDING - request will be completed later (Irp was specified.) - * FAILURES - request failed - */ - -typedef -__drv_arg(Socket, __drv_freesMem(Mem)) -NTSTATUS -(WSKAPI * PFN_WSK_CLOSE_SOCKET) ( - __in PWSK_SOCKET Socket, - __inout PIRP Irp - ); -/* - * Invalidates socket object, initiates cancellation of - * all outstanding requests. Once WskCloseSocket is invoked on a socket, - * it is illegal to issue any further calls on that socket. It's also illegal - * to call WskCloseSocket when there are one or more WSK calls on the socket - * that have not yet returned control to the client. - * - * Parameters: - * Socket - Socket to be closed. - * Irp - notification method to trigger when operation completes. - * This is a required parameter. - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - -typedef -__drv_arg(Irp->IoStatus.Information, __drv_allocatesMem(Mem)) -NTSTATUS -(WSKAPI * PFN_WSK_ACCEPT) ( - __in PWSK_SOCKET ListenSocket, - __reserved ULONG Flags, - __in_opt PVOID AcceptSocketContext, - __in_opt CONST WSK_CLIENT_CONNECTION_DISPATCH *AcceptSocketDispatch, - __out_opt PSOCKADDR LocalAddress, - __out_opt PSOCKADDR RemoteAddress, - __inout PIRP Irp - ); -/* - * Dequeue (pend if it is not there) and return incoming connection request - * on the specified listening socket. - * - * Parameters: - * ListenSocket - listening socket to dequeue request from - * Flags - Reserved. (Must be 0) - * AcceptSocketContext - context to be associated with the accepted socket - * object. This is passed as a parameter in event callbacks. - * AcceptSocketDispatch - pointer to a constant structure containining pointers - * to callback routines. OPTIONAL if client won't be enabling callbacks. - * LocalAddress - Optional buffer to return the local address on which - * this connection request arrived. Useful if listening socket is - * bound to the wildcard address. - * RemoteAddress - Optional buffer to return the remote party's address. - * Irp - IRP for async completion of the request - * - * Returns: - * - * If the request is completed succesfully, the Irp.IoStatus.Information - * field will be holding a pointer to the accepted socket (PWSK_SOCKET) - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_INSPECT_COMPLETE) ( - __in PWSK_SOCKET ListenSocket, - __in PWSK_INSPECT_ID InspectID, - __in WSK_INSPECT_ACTION Action, - __inout PIRP Irp - ); -/* - * Resume a previously pended inspect operation. This routine is valid only - * for conditional-accept sockets. - * - * Parameters: - * ListenSocket - listening socket on which the inspect action was pended for - * the connection request identified by the structure pointed - * by pInspectID. - * InspectID - Pointer to the inspect ID structure that identified the pended - * connection request. - * Action - Only one of the following two actions is allowed: - * - * WskInspectReject - Reject the connection request. WskAcceptEvent won't - * be invoked. WskAbortEvent may be invoked if the - * connection request is dropped during WskInspectComplete call. - * - * WskInspectAccept - Proceed with regular acceptance. WskAcceptEvent - * or WskAbortEvent may be invoked. - * - * Irp - IRP for asynchronous completion of this operation. This is a - * required parameter. - * - * Returns: - * - * STATUS_SUCCESS - request succeeded - */ - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_SEND_TO) ( - __in PWSK_SOCKET Socket, - __in PWSK_BUF Buffer, - __reserved ULONG Flags, - __in_opt PSOCKADDR RemoteAddress, - __in ULONG ControlInfoLength, - __in_bcount_opt(ControlInfoLength) PCMSGHDR ControlInfo, - __inout PIRP Irp - ); -/* - * Send to the specified remote entity or group from the specified - * datagram socket. Socket must have been bound to a local address. - * - * Parameters: - * Socket - datagram socket object to send from - * Buffer - data to send - * Flags - Reserved. (Must be 0) - * RemoteAddress - remote transport address - * ControlInfo - additional information to pass to the remote party. - * Might not be supported by all transports. - * ControlInfoLength - length of control info - * Irp - notification method to trigger when operation completes - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_RECEIVE_FROM) ( - __in PWSK_SOCKET Socket, - __in PWSK_BUF Buffer, - __reserved ULONG Flags, - __out_opt PSOCKADDR RemoteAddress, - __inout PULONG ControlLength, - __out_bcount_opt(*ControlLength) PCMSGHDR ControlInfo, - __out_opt PULONG ControlFlags, - __inout PIRP Irp - ); -/* - * Dequeue (pend if it is not there) and return incoming data packet on the - * specified datagram socket. - * - * Parameters: - * Socket - socket to dequeue packet from - * Buffer - place to put incoming data into - * Flags - Reserved. (Must be 0) - * RemoteAddress - OUT parameter to return the transport address of the remote - * party that sent the packet - * ControlLength - Pointer to a ULONG that specifies the length of buffer - * pointed by ControlInfo on input, and the length of actual control data - * copied into ControlInfo buffer on output. If ControlLength is NULL - * then ControlInfo and ControlFlags parameters are ignored. - * If ControlLength is non-NULL then ControlLength should be pointing to - * valid memory until the request completes. - * ControlInfo - Pointer to a buffer into which WSK copies the control data - * received with the datagram. This parameter is ignored if - * ControlLength parameter is NULL. Otherwise, if ControlInfo should - * be pointing to valid memory until the request completes. - * ControlFlags - Pointer to a ULONG through which WSK may pass the following - * flags when the request completes: MSG_MCAST, MSG_BCAST, MSG_TRUNC, - * MSG_CTRUNC. This parameter is ignored if it is NULL. - * Otherwise, ControlFlags should be pointing to valid memory until the - * request completes. - * Irp - notification method to trigger when operation completes - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_GET_LOCAL_ADDRESS) ( - __in PWSK_SOCKET Socket, - __out PSOCKADDR LocalAddress, - __inout PIRP Irp - ); -/* - * Retrieve the transport address associated with this Socket object. This is - * useful for retrieveing the specific transport address chosen by the transport - * when a socket is bound to the wildcard transport address by the client. - * - * Parameters: - * Socket - Socket whose local address is being queried - * LocalAddress - local transport address - * Irp - Irp for async completion. - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_GET_REMOTE_ADDRESS) ( - __in PWSK_SOCKET Socket, - __out PSOCKADDR RemoteAddress, - __inout PIRP Irp - ); -/* - * Retrieve the transport address of the peer to which the socket is connected. - * Clients are always informed -- upon connection setup -- of the peer's - * address, so this call is useful if a socket is being shared between multiple - * components of the client application. If one component set up the connection - * and another component wishes to determine the peer address, it can do so via - * this call. - * - * Parameters: - * Socket - Socket whose local address is being queried - * RemoteAddress - remote party's transport address - * Irp - Irp for async completion. - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_RELEASE_DATA_INDICATION_LIST) ( - __in PWSK_SOCKET Socket, - __in PWSK_DATA_INDICATION DataIndication - ); -/* - * Release data indications that were previously retained by returning - * STATUS_PENDING from the receive event callback on connection-oriented - * socket. - * - * Parameters: - * Socket - Socket on which buffers were received - * DataIndication - list of data indication elements - * - * Returns: - * SUCCESS - request succeeded - * FAILURES - request failed - */ - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_RELEASE_DATAGRAM_INDICATION_LIST) ( - __in PWSK_SOCKET Socket, - __in PWSK_DATAGRAM_INDICATION DatagramIndication - ); -/* - * Release datagram indications that were previously retained by returning - * STATUS_PENDING from the receive-from event callback on datagram socket. - * - * Parameters: - * Socket - Socket on which datagrams was received - * DatagramIndication - list of datagram indication elements - * - * Returns: - * SUCCESS - request succeeded - * FAILURES - request failed - */ - -// -// Flag used for denoting that the send request (along with any previously -// queued send requests, if any) should be sent out without further delay. -// - -#define WSK_FLAG_NODELAY 0x00000002 - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_SEND) ( - __in PWSK_SOCKET Socket, - __in PWSK_BUF Buffer, - __in ULONG Flags, - __inout PIRP Irp - ); -/* - * Send on the specified connected socket - * - * Parameters: - * Socket - Socket to send on. Must have been connected or accepted - * Buffer - data to send - * Flags - WSK_FLAG_NODELAY: Must send without delaying - * Irp - notification method to trigger when operation completes - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - -#define WSK_FLAG_WAITALL 0x00000002 -#define WSK_FLAG_DRAIN 0x00000004 - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_RECEIVE) ( - __in PWSK_SOCKET Socket, - __in PWSK_BUF Buffer, - __in ULONG Flags, - __inout PIRP Irp - ); -/* - * Dequeue (wait if it is not there) and return incoming data packet on the - * specified connected socket - * - * Parameters: - * Socket - Socket to dequeue data from. Must have been connected or accepted - * Buffer - place to put incoming data into - * Flags - WSK_FLAG_WAITALL: Wait until the receive buffer is filled up - * WSK_FLAG_DRAIN: Discard any existing and future incoming data - * Irp - notification method to trigger when operation completes - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - -typedef -NTSTATUS -(WSKAPI * PFN_WSK_DISCONNECT) ( - __in PWSK_SOCKET Socket, - __in_opt PWSK_BUF Buffer, - __in ULONG Flags, - __inout PIRP Irp - ); -/* - * Send disconnect notification on specified connected socket - * with optional data. - * - * Parameters: - * Socket - Socket to disconnect. Must have been connected or accepted. - * Buffer - Optional data to send along with graceful disconnect. - * Flags - If WSK_FLAG_ABORTIVE is specified then perform abortive disconnect. - * Otherwise, perform graceful disconnect. - * Irp - notification method to trigger when operation completes. (Required) - * - * Returns: - * - * SUCCESS - request succeeded - * PENDING - request will be completed later - * FAILURES - request failed - */ - - - - -// -// WSK Dispatch tables. -// WSK interface consists of routines implemented by both -// the client and the provider. These routines operate -// at either client/provider level or socket level. -// Client/provider level function pointers are exchanged -// during WSK registration. -// Socket level function pointers are exchanged during -// socket creation. -// - -// -// Client level callback table -// - -typedef struct _WSK_CLIENT_DISPATCH { - USHORT Version; - USHORT Reserved; - PFN_WSK_CLIENT_EVENT WskClientEvent; -} WSK_CLIENT_DISPATCH, *PWSK_CLIENT_DISPATCH; - -// -// Socket level callbacks for listening sockets -// - -typedef struct _WSK_CLIENT_LISTEN_DISPATCH { - PFN_WSK_ACCEPT_EVENT WskAcceptEvent; - PFN_WSK_INSPECT_EVENT WskInspectEvent; - PFN_WSK_ABORT_EVENT WskAbortEvent; -} WSK_CLIENT_LISTEN_DISPATCH, *PWSK_CLIENT_LISTEN_DISPATCH; - -// -// Socket level callbacks for datagram sockets -// - -typedef struct _WSK_CLIENT_DATAGRAM_DISPATCH { - PFN_WSK_RECEIVE_FROM_EVENT WskReceiveFromEvent; -} WSK_CLIENT_DATAGRAM_DISPATCH, *PWSK_CLIENT_DATAGRAM_DISPATCH; - -// -// Socket level callbacks for connected sockets -// - -typedef struct _WSK_CLIENT_CONNECTION_DISPATCH { - PFN_WSK_RECEIVE_EVENT WskReceiveEvent; - PFN_WSK_DISCONNECT_EVENT WskDisconnectEvent; - PFN_WSK_SEND_BACKLOG_EVENT WskSendBacklogEvent; -} WSK_CLIENT_CONNECTION_DISPATCH, *PWSK_CLIENT_CONNECTION_DISPATCH; - - -// -// Provider level downcall table -// - -typedef struct _WSK_PROVIDER_DISPATCH { - USHORT Version; - USHORT Reserved; - PFN_WSK_SOCKET WskSocket; - PFN_WSK_SOCKET_CONNECT WskSocketConnect; - PFN_WSK_CONTROL_CLIENT WskControlClient; -#if (NTDDI_VERSION >= NTDDI_WIN7) - PFN_WSK_GET_ADDRESS_INFO WskGetAddressInfo; - PFN_WSK_FREE_ADDRESS_INFO WskFreeAddressInfo; - PFN_WSK_GET_NAME_INFO WskGetNameInfo; -#endif // if (NTDDI_VERSION >= NTDDI_WIN7) -} WSK_PROVIDER_DISPATCH, *PWSK_PROVIDER_DISPATCH; - -// -// Basic socket downcalls -// These routines are supported for all socket types. -// - -typedef struct _WSK_PROVIDER_BASIC_DISPATCH { - PFN_WSK_CONTROL_SOCKET WskControlSocket; - PFN_WSK_CLOSE_SOCKET WskCloseSocket; -} WSK_PROVIDER_BASIC_DISPATCH, *PWSK_PROVIDER_BASIC_DISPATCH; - -// -// Listening socket downcalls -// - -typedef struct _WSK_PROVIDER_LISTEN_DISPATCH { -#ifdef __cplusplus - WSK_PROVIDER_BASIC_DISPATCH Basic; -#else - WSK_PROVIDER_BASIC_DISPATCH; -#endif - PFN_WSK_BIND WskBind; - PFN_WSK_ACCEPT WskAccept; - PFN_WSK_INSPECT_COMPLETE WskInspectComplete; - PFN_WSK_GET_LOCAL_ADDRESS WskGetLocalAddress; -} WSK_PROVIDER_LISTEN_DISPATCH, *PWSK_PROVIDER_LISTEN_DISPATCH; - -// -// Datagram socket downcalls -// - -typedef struct _WSK_PROVIDER_DATAGRAM_DISPATCH { -#ifdef __cplusplus - WSK_PROVIDER_BASIC_DISPATCH Basic; -#else - WSK_PROVIDER_BASIC_DISPATCH; -#endif - PFN_WSK_BIND WskBind; - PFN_WSK_SEND_TO WskSendTo; - PFN_WSK_RECEIVE_FROM WskReceiveFrom; - PFN_WSK_RELEASE_DATAGRAM_INDICATION_LIST WskRelease; - PFN_WSK_GET_LOCAL_ADDRESS WskGetLocalAddress; -} WSK_PROVIDER_DATAGRAM_DISPATCH, *PWSK_PROVIDER_DATAGRAM_DISPATCH; - - -// -// Connected socket downcalls -// - -typedef struct _WSK_PROVIDER_CONNECTION_DISPATCH { -#ifdef __cplusplus - WSK_PROVIDER_BASIC_DISPATCH Basic; -#else - WSK_PROVIDER_BASIC_DISPATCH; -#endif - PFN_WSK_BIND WskBind; - PFN_WSK_CONNECT WskConnect; - PFN_WSK_GET_LOCAL_ADDRESS WskGetLocalAddress; - PFN_WSK_GET_REMOTE_ADDRESS WskGetRemoteAddress; - PFN_WSK_SEND WskSend; - PFN_WSK_RECEIVE WskReceive; - PFN_WSK_DISCONNECT WskDisconnect; - PFN_WSK_RELEASE_DATA_INDICATION_LIST WskRelease; -} WSK_PROVIDER_CONNECTION_DISPATCH, *PWSK_PROVIDER_CONNECTION_DISPATCH; - - -// -// Structures and routines used for WSK registration and deregistration -// - -// -// WSK Client NPI -// -typedef struct _WSK_CLIENT_NPI { - PVOID ClientContext; - CONST WSK_CLIENT_DISPATCH *Dispatch; -} WSK_CLIENT_NPI, *PWSK_CLIENT_NPI; - -// -// WSK Provider NPI -// -typedef struct _WSK_PROVIDER_NPI { - PWSK_CLIENT Client; - CONST WSK_PROVIDER_DISPATCH *Dispatch; -} WSK_PROVIDER_NPI, *PWSK_PROVIDER_NPI; - -// -// WSK Registration block that needs to be provided by the WSK client and -// initialized by the WSK subsystem via WskRegister. WSK client should not -// manipulate any of the fields of the registration block directly. -// -typedef struct _WSK_REGISTRATION { - ULONGLONG ReservedRegistrationState; - PVOID ReservedRegistrationContext; - KSPIN_LOCK ReservedRegistrationLock; -} WSK_REGISTRATION, *PWSK_REGISTRATION; - -__checkReturn -NTSTATUS -WskRegister( - __in PWSK_CLIENT_NPI WskClientNpi, - __out PWSK_REGISTRATION WskRegistration - ); -/* - * Register as a WSK client. WSK clients may invoke this routine multiple times - * with a seperate WskRegistation block for each call in order to have multiple - * WSK registration instances. For each successful WskRegister call, there must - * be exactly one corresponding WskDeregister call with the same WskRegistration - * block that was passed to WskRegister. - * - * Required IRQL == PASSIVE_LEVEL - * - * Parameters: - * WskClientNpi - Pointer to the client NPI implemented by the WSK client. - * WskRegistration - Registration block used to identify this instance of - * the WSK registration. This block of memory must be kept - * allocated (not freed or gone out of scope) as long as - * there are outstanding calls to the functions below. - * - * Returns: - * - * STATUS_SUCCESS - request succeeded - * FAILURES - request failed - */ - -#define WSK_NO_WAIT 0 -#define WSK_INFINITE_WAIT 0xffffffff - -__checkReturn -NTSTATUS -WskCaptureProviderNPI( - __in PWSK_REGISTRATION WskRegistration, - __in ULONG WaitTimeout, - __out PWSK_PROVIDER_NPI WskProviderNpi - ); -/* - * Capture the provider NPI implemented by the WSK provider when the WSK - * provider becomes available. This routine may be called multiple times. - * For each call to WskCaptureProviderNPI that returns successfully, there must - * be exactly one corresponding call to WskReleaseProviderNPI. - * It's OK to call WskCaptureProviderNPI after WskDeregister is called as long - * as the WskRegistration block is not freed or overwritten. After WskDeregister - * is called, any further calls to WskCaptureProviderNPI will fail with - * STATUS_DEVICE_NOT_READY, and any exisiting WskCaptureProviderNPI calls that - * are blocked in other threads waiting for WSK provider to become available - * will also return immediately with the STATUS_DEVICE_NOT_READY status code. - * - * Required IRQL == PASSIVE_LEVEL if WaitTimeout != WSK_NO_WAIT - * IRQL <= DISPATCH_LEVEL if WaitTimeout == WSK_NO_WAIT - * - * Parameters: - * WskRegistration - Registration block initialized by WskRegister. - * WaitTimeout - Time in milliseconds for how long to wait for the WSK provider - * to become available. - * WSK_NO_WAIT : return immediately if provider not available - * WSK_INFINITE_WAIT : wait until provider becomes available - * WskProviderNpi - Provider NPI returned by the WSK provider. WSK clients can - * invoke functions in WSK_PROVIDER_DISPATCH until the provider - * NPI is released via WskReleaseProviderNPI. - * Returns: - * - * STATUS_SUCCESS - request succeeded - * STATUS_DEVICE_NOT_READY - WSK provider was not available yet. - * STATUS_NOINTERFACE - Client's requested version is not supported. - * FAILURES - request failed - */ - -VOID -WskReleaseProviderNPI( - __in PWSK_REGISTRATION WskRegistration - ); -/* - * Release the provider NPI instance that was captured via WskCaptureProviderNPI. - * There must be exactly one call to WskReleaseProviderNPI for each call to - * WskCaptureProviderNPI that returns successfully. - * - * Required IRQL <= DISPATCH_LEVEL - * - * Parameters: - * WskRegistration - Registration block initialized by WskRegister. - * - * Returns: - * - * None. - */ - -__checkReturn -NTSTATUS -WskQueryProviderCharacteristics( - __in PWSK_REGISTRATION WskRegistration, - __out PWSK_PROVIDER_CHARACTERISTICS WskProviderCharacteristics - ); -/* - * Query the characterisitics of the WSK provider. This routine should be called - * after WskCaptureProviderNPI returns STATUS_NOINTERFACE or STATUS_SUCCESS. - * WSK clients may use this routine to find out the versions supported by the - * WSK provider. - * - * Required IRQL <= DISPATCH_LEVEL - * - * Parameters: - * WskRegistration - Registration block initialized by WskRegister. - * WskProviderCharacteristics - Provider characterisitics returned by the WSK - * provider - * Returns: - * - * STATUS_SUCCESS - request succeeded - * STATUS_DEVICE_NOT_READY - WSK provider was not available yet. - * FAILURES - request failed - */ - -VOID -WskDeregister( - __in PWSK_REGISTRATION WskRegistration - ); -/* - * Deregister as a WSK client. For each successful WskRegister call, there must - * be exactly one corresponding WskDeregister call with the same WskRegistration - * block that was passed to WskRegister. - * WskDeregister will wait until all captured instances of the provider NPI are - * released, any outstanding calls to functions in WSK_PROVIDER_DISPATCH have - * returned, and all sockets are closed. - * - * Required IRQL == PASSIVE_LEVEL - * - * Parameters: - * WskRegistration - Registration block initialized by WskRegister. - * - * Returns: - * - * None. - */ - -#ifdef __cplusplus -} -#endif - -#endif // _WSK_ - - diff --git a/pub/ddk/wwan.h b/pub/ddk/wwan.h deleted file mode 100644 index 30132c7..0000000 --- a/pub/ddk/wwan.h +++ /dev/null @@ -1,718 +0,0 @@ -/*++ -Copyright (c) 2007 Microsoft Corporation - -Module Name: - wwan.h - -Abstract: - Header file for WWAN structures - -Revision History: - DATE DESCRIPTION - ------------ ----------- - 23-FEB-2007 V0.40 Driver Model Compliant - 23-MAY-2007 V0.50 Driver Model Compliant - 01-AUG-2007 V0.60 Driver Model Compliant - 02-APR-2008 V1.00 Driver Model Compliant - ---*/ - -#ifndef __WWAN_DECL__ -#define __WWAN_DECL__ - -#define WWAN_ERROR_UNSUPPORTED_FIRMWARE 0xf0f0f000 -#define WWAN_ERROR_COM_PORT_CONFLICT 0xf0f0f001 -#define WWAN_ERROR_RESOURCE_CONFLICT_OTHER 0xf0f0ffff - -typedef ULONG WWAN_STATUS; - -#define WWAN_STATUS_SUCCESS STATUS_SUCCESS -#define WWAN_STATUS_BUSY 0xC0040002 -#define WWAN_STATUS_FAILURE 0xC0040003 -#define WWAN_STATUS_SIM_NOT_INSERTED 0xC0040004 -#define WWAN_STATUS_BAD_SIM 0xC0040005 -#define WWAN_STATUS_PIN_REQUIRED 0xC0040006 -#define WWAN_STATUS_PIN_DISABLED 0x40040007 -#define WWAN_STATUS_NOT_REGISTERED 0x40040008 -#define WWAN_STATUS_PROVIDERS_NOT_FOUND 0x40040009 -#define WWAN_STATUS_NO_DEVICE_SUPPORT 0xC004000a -#define WWAN_STATUS_PROVIDER_NOT_VISIBLE 0x4004000b -#define WWAN_STATUS_DATA_CLASS_NOT_AVAILABLE 0x4004000c -#define WWAN_STATUS_PACKET_SVC_DETACHED 0xC004000d -#define WWAN_STATUS_MAX_ACTIVATED_CONTEXTS 0xC004000e -#define WWAN_STATUS_NOT_INITIALIZED 0xC004000f -#define WWAN_STATUS_VOICE_CALL_IN_PROGRESS 0x40040010 -#define WWAN_STATUS_CONTEXT_NOT_ACTIVATED 0xC0040011 -#define WWAN_STATUS_SERVICE_NOT_ACTIVATED 0xC0040012 -#define WWAN_STATUS_INVALID_ACCESS_STRING 0xC0040013 -#define WWAN_STATUS_INVALID_USER_NAME_PWD 0xC0040014 -#define WWAN_STATUS_RADIO_POWER_OFF 0xC0040015 -#define WWAN_STATUS_INVALID_PARAMETERS 0xC0040016 -#define WWAN_STATUS_READ_FAILURE 0xC0040017 -#define WWAN_STATUS_WRITE_FAILURE 0xC0040018 - -//SMS specific error codes -#define WWAN_STATUS_SMS_OPERATION_NOT_ALLOWED 0xC0040100 -#define WWAN_STATUS_SMS_MEMORY_FAILURE 0xC0040101 -#define WWAN_STATUS_SMS_INVALID_MEMORY_INDEX 0xC0040102 -#define WWAN_STATUS_SMS_UNKNOWN_SMSC_ADDRESS 0xC0040103 -#define WWAN_STATUS_SMS_NETWORK_TIMEOUT 0xC0040104 -#define WWAN_STATUS_SMS_MEMORY_FULL 0xC0040105 -#define WWAN_STATUS_SMS_UNKNOWN_ERROR 0xC0040106 -#define WWAN_STATUS_SMS_FILTER_NOT_SUPPORTED 0xC0040107 -#define WWAN_STATUS_SMS_MORE_DATA 0x40040108 -#define WWAN_STATUS_SMS_LANG_NOT_SUPPORTED 0xC0040109 -#define WWAN_STATUS_SMS_ENCODING_NOT_SUPPORTED 0xC004010A -#define WWAN_STATUS_SMS_FORMAT_NOT_SUPPORTED 0xC004010B - -typedef enum _WWAN_STRUCT_TYPE { - WwanStructTN = 0, - WwanStructContext, - WwanStructProvider, - WwanStructSmsPdu, - WwanStructReserved0, - WwanStructReserved1, - WwanStructReserved2, - WwanStructSmsCdma, - WwanStructReserved3, - WwanStructMax -} WWAN_STRUCT_TYPE, *PWWAN_STRUCT_TYPE; - -typedef struct _WWAN_LIST_HEADER { - WWAN_STRUCT_TYPE ElementType; - ULONG ElementCount; -} WWAN_LIST_HEADER, *PWWAN_LIST_HEADER; - -#define WWAN_MANUFACTURER_LEN 32 -#define WWAN_MODEL_LEN 32 -#define WWAN_FIRMWARE_LEN 32 -#define WWAN_DEVICEID_LEN 18 -#define WWAN_CUSTOM_DATA_CLASS_LEN 12 -#define WWAN_CUSTOM_BAND_CLASS_LEN 20 -#define WWAN_PIN_LEN 12 -#define WWAN_PROVIDERID_LEN 7 -#define WWAN_PROVIDERNAME_LEN 21 -#define WWAN_ROAMTEXT_LEN 64 -#define WWAN_ACCESSSTRING_LEN 101 -#define WWAN_USERNAME_LEN 256 -#define WWAN_PASSWORD_LEN 256 -#define WWAN_SUBSCRIBERID_LEN 16 -#define WWAN_SIMICCID_LEN 21 -#define WWAN_TN_LEN 16 -#define WWAN_SCA_MAX_LEN 14 -#define WWAN_SMS_ADDRESS_MAX_LEN 16 -#define WWAN_SC_TIME_STAMP_MAX_LEN 20 -#define WWAN_SMS_CDMA_ADDR_MAX_LEN 50 -#define WWAN_SMS_CDMA_TIMESTAMP_MAX_LEN 20 -#define WWAN_SMS_MSG_PDU_LEN 183 -#define WWAN_SMS_RAW_PDU_LEN (WWAN_SMS_MSG_PDU_LEN - 12) -#define WWAN_SMS_PDU_HEX_BUF_LEN (WWAN_SMS_MSG_PDU_LEN * 2) -#define WWAN_CDMA_SHORT_MSG_SIZE_UNKNOWN 0 -#define WWAN_CDMA_SHORT_MSG_SIZE_MAX 160 -#define WWAN_SMS_CDMA_MAX_BUF_LEN 160 -#define WWAN_SMS_CDMA_MAX_MSG_LEN WWAN_CDMA_SHORT_MSG_SIZE_MAX - -#define WWAN_CDMA_DEFAULT_PROVIDER_ID (0) - -typedef enum _WWAN_ASYNC_GETSET_TYPE { - WwanAsyncGetDeviceCaps = 0, - WwanAsyncGetReadyInfo, - WwanAsyncGetRadioState, - WwanAsyncSetRadioState, - WwanAsyncGetPin, - WwanAsyncSetPin, - WwanAsyncGetPinList, - WwanAsyncGetHomeProvider, - WwanAsyncGetPreferredProviders, - WwanAsyncSetPreferredProviders, - WwanAsyncGetVisibleProviders, - WwanAsyncGetRegisterState, - WwanAsyncSetRegisterState, - WwanAsyncGetPacketService, - WwanAsyncSetPacketService, - WwanAsyncGetSignalState, - WwanAsyncSetSignalState, - WwanAsyncGetConnect, - WwanAsyncSetConnect, - WwanAsyncGetProvisionedContexts, - WwanAsyncSetProvisionedContext, - WwanAsyncSetServiceActivation, - WwanAsyncGetSmsConfiguration, - WwanAsyncSetSmsConfiguration, - WwanAsyncSmsRead, - WwanAsyncSmsSend, - WwanAsyncSmsDelete, - WwanAsyncSmsStatus, - WwanAsyncSetVendorSpecific, - WWAN_ASYNC_GETSET_TYPE_MAX -} WWAN_ASYNC_GETSET_TYPE, *PWWAN_ASYNC_GETSET_TYPE; - -#ifndef WWAN_MAJOR_VERSION -#define WWAN_MAJOR_VERSION 1 -#endif - -#ifndef WWAN_MINOR_VERSION -#define WWAN_MINOR_VERSION 0 -#endif - -#ifndef WWAN_CURRENT_VERSION -#define WWAN_CURRENT_VERSION \ - ((WWAN_MAJOR_VERSION << 16) | WWAN_MINOR_VERSION) -#endif - -typedef ULONG WWAN_VERSION; /* A value specifies the version. */ - /* bit[16:31]: major version */ - /* bit[0:15]: minor version */ - -#define WWAN_DRIVER_CAPS_NONE 0x00000000 - -typedef struct _WWAN_DRIVER_CAPS { - ULONG ulMajorVersion; - ULONG ulMinorVersion; - ULONG ulDriverCaps; -} WWAN_DRIVER_CAPS, *PWWAN_DRIVER_CAPS; - -typedef enum _WWAN_DEVICE_TYPE { - WwanDeviceTypeUnknown = 0, - WwanDeviceTypeEmbedded, - WwanDeviceTypeRemovable, - WwanDeviceTypeRemote, - WwanDeviceTypeMax -} WWAN_DEVICE_TYPE, *PWWAN_DEVICE_TYPE; - -typedef enum _WWAN_CELLULAR_CLASS { - WwanCellularClassUnknown = 0, - WwanCellularClassGsm, - WwanCellularClassCdma, - WwanCellularClassMax -} WWAN_CELLULAR_CLASS, *PWWAN_CELLULAR_CLASS; - -typedef enum _WWAN_VOICE_CLASS { - WwanVoiceClassUnknown = 0, - WwanVoiceClassNoVoice, - WwanVoiceClassSeparateVoiceData, - WwanVoiceClassSimultaneousVoiceData, - WwanVoiceClassMax -} WWAN_VOICE_CLASS, *PWWAN_VOICE_CLASS; - -typedef enum _WWAN_SIM_CLASS { - WwanSimClassUnknown = 0, - WwanSimClassSimLogical, - WwanSimClassSimRemovable, - WwanSimClassSimRemote, - WwanSimClassMax -} WWAN_SIM_CLASS, *PWWAN_SIM_CLASS; - -#define WWAN_DATA_CLASS_NONE 0x00000000 -#define WWAN_DATA_CLASS_GPRS 0x00000001 -#define WWAN_DATA_CLASS_EDGE 0x00000002 /* EGPRS */ -#define WWAN_DATA_CLASS_UMTS 0x00000004 -#define WWAN_DATA_CLASS_HSDPA 0x00000008 -#define WWAN_DATA_CLASS_HSUPA 0x00000010 -#define WWAN_DATA_CLASS_LTE 0x00000020 -#define WWAN_DATA_CLASS_1XRTT 0x00010000 -#define WWAN_DATA_CLASS_1XEVDO 0x00020000 -#define WWAN_DATA_CLASS_1XEVDO_REVA 0x00040000 -#define WWAN_DATA_CLASS_1XEVDV 0x00080000 -#define WWAN_DATA_CLASS_3XRTT 0x00100000 -#define WWAN_DATA_CLASS_1XEVDO_REVB 0x00200000 /* for future use */ -#define WWAN_DATA_CLASS_UMB 0x00400000 -#define WWAN_DATA_CLASS_CUSTOM 0x80000000 - -#define WWAN_BAND_CLASS_UNKNOWN 0x00000000 -#define WWAN_BAND_CLASS_0 0x00000001 -#define WWAN_BAND_CLASS_I 0x00000002 -#define WWAN_BAND_CLASS_II 0x00000004 -#define WWAN_BAND_CLASS_III 0x00000008 -#define WWAN_BAND_CLASS_IV 0x00000010 -#define WWAN_BAND_CLASS_V 0x00000020 -#define WWAN_BAND_CLASS_VI 0x00000040 -#define WWAN_BAND_CLASS_VII 0x00000080 -#define WWAN_BAND_CLASS_VIII 0x00000100 -#define WWAN_BAND_CLASS_IX 0x00000200 -#define WWAN_BAND_CLASS_X 0x00000400 -#define WWAN_BAND_CLASS_XI 0x00000800 -#define WWAN_BAND_CLASS_XII 0x00001000 -#define WWAN_BAND_CLASS_XIII 0x00002000 -#define WWAN_BAND_CLASS_XIV 0x00004000 -#define WWAN_BAND_CLASS_XV 0x00008000 -#define WWAN_BAND_CLASS_XVI 0x00010000 -#define WWAN_BAND_CLASS_XVII 0x00020000 -#define WWAN_BAND_CLASS_CUSTOM 0x80000000 - -#define WWAN_CTRL_CAPS_NONE 0x00000000 -#define WWAN_CTRL_CAPS_REG_MANUAL 0x00000001 -#define WWAN_CTRL_CAPS_HW_RADIO_SWITCH 0x00000002 -#define WWAN_CTRL_CAPS_CDMA_MOBILE_IP 0x00000004 -#define WWAN_CTRL_CAPS_CDMA_SIMPLE_IP 0x00000008 -#define WWAN_CTRL_CAPS_PROTECT_UNIQUEID 0x00000010 - -#define WWAN_SMS_CAPS_NONE 0x00000000 -#define WWAN_SMS_CAPS_PDU_RECEIVE 0x00000001 -#define WWAN_SMS_CAPS_PDU_SEND 0x00000002 -#define WWAN_SMS_CAPS_TEXT_RECEIVE 0x00000004 -#define WWAN_SMS_CAPS_TEXT_SEND 0x00000008 - -typedef struct _WWAN_DEVICE_CAPS { - WWAN_DEVICE_TYPE WwanDeviceType; - WWAN_CELLULAR_CLASS WwanCellularClass; - WWAN_VOICE_CLASS WwanVoiceClass; - WWAN_SIM_CLASS WwanSimClass; - ULONG WwanDataClass; - WCHAR CustomDataClass[WWAN_CUSTOM_DATA_CLASS_LEN]; - ULONG WwanGsmBandClass; - ULONG WwanCdmaBandClass; - WCHAR CustomBandClass[WWAN_CUSTOM_BAND_CLASS_LEN]; - ULONG WwanSmsCaps; - ULONG WwanControlCaps; - WCHAR DeviceId [WWAN_DEVICEID_LEN]; - WCHAR Manufacturer [WWAN_MANUFACTURER_LEN]; - WCHAR Model [WWAN_MODEL_LEN]; - WCHAR FirmwareInfo [WWAN_FIRMWARE_LEN]; - ULONG MaxActivatedContexts; -} WWAN_DEVICE_CAPS, *PWWAN_DEVICE_CAPS; - -typedef enum _WWAN_READY_STATE { - WwanReadyStateOff = 0, /* stack is off */ - WwanReadyStateInitialized, /* ready to power up and register */ - WwanReadyStateSimNotInserted, /* SIM not inserted */ - WwanReadyStateBadSim, /* SIM is invalid */ - WwanReadyStateFailure, /* Device failure */ - WwanReadyStateNotActivated, /* Device not activated (CDMA) */ - WwanReadyStateDeviceLocked /* Device is locked */ -} WWAN_READY_STATE, *PWWAN_READY_STATE; - -typedef enum _WWAN_EMERGENCY_MODE -{ - WwanEmergencyModeOff = 0, - WwanEmergencyModeOn, - WwanEmergencyModeMax -}WWAN_EMERGENCY_MODE, *PWWAN_EMERGENCY_MODE; - -typedef struct _WWAN_READY_INFO { - WWAN_READY_STATE ReadyState; - WWAN_EMERGENCY_MODE EmergencyMode; - WCHAR SubscriberId [WWAN_SUBSCRIBERID_LEN]; - WCHAR SimIccId [WWAN_SIMICCID_LEN]; - BYTE CdmaShortMsgSize; - WWAN_LIST_HEADER TNListHeader; -} WWAN_READY_INFO, *PWWAN_READY_INFO; - -typedef struct _WWAN_SERVICE_ACTIVATION { - ULONG uVendorSpecificBufferSize; -} WWAN_SERVICE_ACTIVATION, *PWWAN_SERVICE_ACTIVATION; - -typedef enum _WWAN_RADIO { - WwanRadioOff = 0, - WwanRadioOn -} WWAN_RADIO, *PWWAN_RADIO; - -typedef struct _WWAN_RADIO_STATE { - WWAN_RADIO HwRadioState; - WWAN_RADIO SwRadioState; -} WWAN_RADIO_STATE, *PWWAN_RADIO_STATE; - -typedef enum _WWAN_PIN_TYPE { - WwanPinTypeNone = 0, - WwanPinTypeCustom, - WwanPinTypePin1, - WwanPinTypePin2, - WwanPinTypeDeviceSimPin, - WwanPinTypeDeviceFirstSimPin, - WwanPinTypeNetworkPin, - WwanPinTypeNetworkSubsetPin, - WwanPinTypeSvcProviderPin, - WwanPinTypeCorporatePin, - WwanPinTypeSubsidyLock, - WwanPinTypePuk1, - WwanPinTypePuk2, - WwanPinTypeDeviceFirstSimPuk, - WwanPinTypeNetworkPuk, - WwanPinTypeNetworkSubsetPuk, - WwanPinTypeSvcProviderPuk, - WwanPinTypeCorporatePuk, - WwanPinTypeMax -} WWAN_PIN_TYPE, *PWWAN_PIN_TYPE; - -typedef enum _WWAN_PIN_STATE { - WwanPinStateNone = 0, - WwanPinStateEnter, - WwanPinStateMax -} WWAN_PIN_STATE, *PWWAN_PIN_STATE; - -#define WWAN_ATTEMPTS_REMAINING_UNKNOWN ~0 - -typedef struct _WWAN_PIN_INFO { - WWAN_PIN_TYPE PinType; - WWAN_PIN_STATE PinState; - ULONG AttemptsRemaining; -} WWAN_PIN_INFO, *PWWAN_PIN_INFO; - -typedef enum _WWAN_PIN_OPERATION { - WwanPinOperationEnter = 0, - WwanPinOperationEnable, - WwanPinOperationDisable, - WwanPinOperationChange, - WwanPinOperationMax -} WWAN_PIN_OPERATION, *PWWAN_PIN_OPERATION; - -typedef struct _WWAN_PIN_ACTION { - WWAN_PIN_TYPE PinType; - WWAN_PIN_OPERATION PinOperation; - WCHAR Pin [WWAN_PIN_LEN]; - WCHAR NewPin [WWAN_PIN_LEN]; -} WWAN_PIN_ACTION, *PWWAN_PIN_ACTION; - -typedef enum _WWAN_PIN_FORMAT { - WwanPinFormatUnknown = 0, - WwanPinFormatNumeric, - WwanPinFormatAlphaNumeric, - WwanPinFormatMax -} WWAN_PIN_FORMAT, *PWWAN_PIN_FORMAT; - -typedef enum _WWAN_PIN_MODE { - WwanPinModeNotSupported = 0, - WwanPinModeEnabled, - WwanPinModeDisabled, - WwanPinModeMax -} WWAN_PIN_MODE, *PWWAN_PIN_MODE; - -#define WWAN_PIN_LENGTH_UNKNOWN ~0 - -typedef struct _WWAN_PIN_DESC { - WWAN_PIN_MODE PinMode; - WWAN_PIN_FORMAT PinFormat; - ULONG PinLengthMin; - ULONG PinLengthMax; -} WWAN_PIN_DESC, *PWWAN_PIN_DESC; - -typedef struct _WWAN_PIN_LIST { - WWAN_PIN_DESC WwanPinDescPin1; - WWAN_PIN_DESC WwanPinDescPin2; - WWAN_PIN_DESC WwanPinDescDeviceSimPin; - WWAN_PIN_DESC WwanPinDescDeviceFirstSimPin; - WWAN_PIN_DESC WwanPinDescNetworkPin; - WWAN_PIN_DESC WwanPinDescNetworkSubsetPin; - WWAN_PIN_DESC WwanPinDescSvcProviderPin; - WWAN_PIN_DESC WwanPinDescCorporatePin; - WWAN_PIN_DESC WwanPinDescSubsidyLock; - WWAN_PIN_DESC WwanPinDescCustom; -} WWAN_PIN_LIST, *PWWAN_PIN_LIST; - -#define WWAN_PROVIDER_STATE_UNKNOWN 0x00000000 -#define WWAN_PROVIDER_STATE_HOME 0x00000001 -#define WWAN_PROVIDER_STATE_FORBIDDEN 0x00000002 -#define WWAN_PROVIDER_STATE_PREFERRED 0x00000004 -#define WWAN_PROVIDER_STATE_VISIBLE 0x00000008 -#define WWAN_PROVIDER_STATE_REGISTERED 0x00000010 - -typedef struct _WWAN_PROVIDER { - WCHAR ProviderId [WWAN_PROVIDERID_LEN]; - ULONG ProviderState; - WCHAR ProviderName [WWAN_PROVIDERNAME_LEN]; - ULONG WwanDataClass; -} WWAN_PROVIDER, *PWWAN_PROVIDER; - -typedef enum _WWAN_REGISTER_ACTION { - WwanRegisterActionAutomatic = 0, - WwanRegisterActionManual, - WwanRegisterActionMax -} WWAN_REGISTER_ACTION, *PWWAN_REGISTER_ACTION; - -typedef struct _WWAN_SET_REGISTER_STATE { - WCHAR ProviderId [WWAN_PROVIDERID_LEN]; - WWAN_REGISTER_ACTION RegisterAction; - ULONG WwanDataClass; -} WWAN_SET_REGISTER_STATE, *PWWAN_SET_REGISTER_STATE; - -typedef enum _WWAN_REGISTER_STATE { - WwanRegisterStateUnknown = 0, - WwanRegisterStateDeregistered, - WwanRegisterStateSearching, - WwanRegisterStateHome, - WwanRegisterStateRoaming, - WwanRegisterStatePartner, - WwanRegisterStateDenied, - WwanRegisterStateMax -} WWAN_REGISTER_STATE, *PWWAN_REGISTER_STATE; - -typedef enum _WWAN_REGISTER_MODE { - WwanRegisterModeUnknown = 0, - WwanRegisterModeAutomatic, - WwanRegisterModeManual, - WwanRegisterModeMax -} WWAN_REGISTER_MODE, *PWWAN_REGISTER_MODE; - -typedef struct _WWAN_REGISTRATION_STATE { - ULONG uNwError; - WWAN_REGISTER_STATE RegisterState; - WWAN_REGISTER_MODE RegisterMode; - WCHAR ProviderId [WWAN_PROVIDERID_LEN]; - WCHAR ProviderName [WWAN_PROVIDERNAME_LEN]; - WCHAR RoamingText [WWAN_ROAMTEXT_LEN]; -} WWAN_REGISTRATION_STATE, *PWWAN_REGISTRATION_STATE; - -typedef enum _WWAN_PACKET_SERVICE_ACTION { - WwanPacketServiceActionAttach = 0, - WwanPacketServiceActionDetach -} WWAN_PACKET_SERVICE_ACTION, *PWWAN_PACKET_SERVICE_ACTION; - -typedef enum _WWAN_PACKET_SERVICE_STATE { - WwanPacketServiceStateUnknown = 0, - WwanPacketServiceStateAttaching, - WwanPacketServiceStateAttached, - WwanPacketServiceStateDetaching, - WwanPacketServiceStateDetached -} WWAN_PACKET_SERVICE_STATE, *PWWAN_PACKET_SERVICE_STATE; - -typedef struct _WWAN_PACKET_SERVICE { - ULONG uNwError; - WWAN_PACKET_SERVICE_STATE PacketServiceState; - ULONG AvailableDataClass; - ULONG CurrentDataClass; -} WWAN_PACKET_SERVICE, *PWWAN_PACKET_SERVICE; - -#define WWAN_RSSI_UNKNOWN 99 -#define WWAN_ERROR_RATE_UNKNOWN 99 - -typedef struct _WWAN_SIGNAL_STATE { - ULONG Rssi; - ULONG ErrorRate; - ULONG RssiInterval; - ULONG RssiThreshold; -} WWAN_SIGNAL_STATE, *PWWAN_SIGNAL_STATE; - -#define WWAN_RSSI_DEFAULT 0xffffffff -#define WWAN_RSSI_DISABLE 0 - -typedef struct _WWAN_SET_SIGNAL_INDICATION { - ULONG RssiInterval; - ULONG RssiThreshold; -} WWAN_SET_SIGNAL_INDICATION, *PWWAN_SET_SIGNAL_INDICATION; - -typedef enum _WWAN_ACTIVATION_COMMAND { - WwanActivationCommandDeactivate = 0, - WwanActivationCommandActivate, - WwanActivationCommandMax -} WWAN_ACTIVATION_COMMAND, *PWWAN_ACTIVATION_COMMAND; - -typedef enum _WWAN_COMPRESSION { - WwanCompressionNone = 0, - WwanCompressionEnable, - WwanCompressionMax -} WWAN_COMPRESSION, *PWWAN_COMPRESSION; - -typedef enum _WWAN_AUTH_PROTOCOL { - WwanAuthProtocolNone = 0, - WwanAuthProtocolPap, - WwanAuthProtocolChap, - WwanAuthProtocolMsChapV2, - WwanAuthProtocolMax -} WWAN_AUTH_PROTOCOL, *PWWAN_AUTH_PROTOCOL; - -typedef struct _WWAN_SET_CONTEXT_STATE { - ULONG ConnectionId; - WWAN_ACTIVATION_COMMAND ActivationCommand; - WCHAR AccessString [WWAN_ACCESSSTRING_LEN]; - WCHAR UserName [WWAN_USERNAME_LEN]; - WCHAR Password [WWAN_PASSWORD_LEN]; - WWAN_COMPRESSION Compression; - WWAN_AUTH_PROTOCOL AuthType; -} WWAN_SET_CONTEXT_STATE, *PWWAN_SET_CONTEXT_STATE; - -typedef enum _WWAN_ACTIVATION_STATE { - WwanActivationStateUnknown = 0, - WwanActivationStateActivated, - WwanActivationStateActivating, - WwanActivationStateDeactivated, - WwanActivationStateDeactivating, - WwanActivationStateMax -} WWAN_ACTIVATION_STATE, *PWWAN_ACTIVATION_STATE; - -typedef enum _WWAN_VOICE_CALL_STATE -{ - WwanVoiceCallStateNone = 0, - WwanVoiceCallStateInProgress, - WwanVoiceCallStateHangUp, - WwanVoiceCallStateMaximum -} WWAN_VOICE_CALL_STATE, *PWWAN_VOICE_CALL_STATE; - -typedef struct _WWAN_CONTEXT_STATE { - ULONG uNwError; - ULONG ConnectionId; - WWAN_ACTIVATION_STATE ActivationState; - WWAN_VOICE_CALL_STATE VoiceCallState; -} WWAN_CONTEXT_STATE, *PWWAN_CONTEXT_STATE; - -typedef enum _WWAN_CONTEXT_TYPE { - WwanContextTypeNone = 0, - WwanContextTypeInternet, - WwanContextTypeVpn, - WwanContextTypeVoice, - WwanContextTypeVideoShare, - WwanContextTypeCustom, - WwanContextTypeMax -} WWAN_CONTEXT_TYPE, *PWWAN_CONTEXT_TYPE; - -#define WWAN_CONTEXT_ID_APPEND 0xffffffff - -typedef struct _WWAN_CONTEXT { - ULONG ContextId; - WWAN_CONTEXT_TYPE ContextType; - WCHAR AccessString [WWAN_ACCESSSTRING_LEN]; - WCHAR UserName [WWAN_USERNAME_LEN]; - WCHAR Password [WWAN_PASSWORD_LEN]; - WWAN_COMPRESSION Compression; - WWAN_AUTH_PROTOCOL AuthType; -} WWAN_CONTEXT, *PWWAN_CONTEXT; - -typedef struct _WWAN_SET_CONTEXT -{ - ULONG ContextId; - WWAN_CONTEXT_TYPE ContextType; - WCHAR AccessString[WWAN_ACCESSSTRING_LEN]; - WCHAR UserName[WWAN_USERNAME_LEN]; - WCHAR Password[WWAN_PASSWORD_LEN]; - WWAN_COMPRESSION Compression; - WWAN_AUTH_PROTOCOL AuthType; - WCHAR ProviderId[WWAN_PROVIDERID_LEN]; -} WWAN_SET_CONTEXT, *PWWAN_SET_CONTEXT; - -typedef enum _WWAN_SMS_FORMAT { - WwanSmsFormatPdu = 0, - WwanSmsFormatReserved0, - WwanSmsFormatReserved1, - WwanSmsFormatReserved2, - WwanSmsFormatCdma, - WwanSmsFormatMax -} WWAN_SMS_FORMAT, *PWWAN_SMS_FORMAT; - -typedef struct _WWAN_SET_SMS_CONFIGURATION { - CHAR ScAddress [WWAN_SMS_ADDRESS_MAX_LEN]; - WWAN_SMS_FORMAT SmsFormat; -} WWAN_SET_SMS_CONFIGURATION, *PWWAN_SET_SMS_CONFIGURATION; - -typedef struct _WWAN_SMS_CONFIGURATION { - CHAR ScAddress [WWAN_SMS_ADDRESS_MAX_LEN]; - WWAN_SMS_FORMAT SmsFormat; - ULONG ulMaxMessageIndex; -} WWAN_SMS_CONFIGURATION, *PWWAN_SMS_CONFIGURATION; - -typedef enum _WWAN_SMS_FLAG { - WwanSmsFlagAll = 0, - WwanSmsFlagIndex, - WwanSmsFlagNew, - WwanSmsFlagOld, - WwanSmsFlagSent, - WwanSmsFlagDraft, - WwanSmsFlagMax -} WWAN_SMS_FLAG, *PWWAN_SMS_FLAG; - -#define WWAN_MESSAGE_INDEX_NONE 0 - -typedef struct _WWAN_SMS_FILTER { - WWAN_SMS_FLAG Flag; - ULONG MessageIndex; -} WWAN_SMS_FILTER, *PWWAN_SMS_FILTER; - -typedef struct _WWAN_SMS_READ { - WWAN_SMS_FORMAT SmsFormat; - WWAN_SMS_FILTER ReadFilter; -} WWAN_SMS_READ, *PWWAN_SMS_READ; - -typedef enum _WWAN_MSG_STATUS { - WwanMsgStatusNew = 0, - WwanMsgStatusOld, - WwanMsgStatusDraft, - WwanMsgStatusSent, - WwanMsgStatusMax -} WWAN_MSG_STATUS, *PWWAN_MSG_STATUS; - -typedef enum _WWAN_SMS_CDMA_LANG { - WwanSmsCdmaLangUnknown = 0, - WwanSmsCdmaLangEnglish, - WwanSmsCdmaLangFrench, - WwanSmsCdmaLangSpanish, - WwanSmsCdmaLangJapanese, - WwanSmsCdmaLangKorean, - WwanSmsCdmaLangChinese, - WwanSmsCdmaLangHebrew, - WwanSmsCdmaLangMax -} WWAN_SMS_CDMA_LANG, *PWWAN_SMS_CDMA_LANG; - -typedef enum _WWAN_SMS_CDMA_ENCODING { - WwanSmsCdmaEncodingOctet = 0, - WwanSmsCdmaEncodingEpm, - WwanSmsCdmaEncoding7BitAscii, - WwanSmsCdmaEncodingIa5, - WwanSmsCdmaEncodingUnicode, - WwanSmsCdmaEncodingShiftJis, - WwanSmsCdmaEncodingKorean, - WwanSmsCdmaEncodingLatinHebrew, - WwanSmsCdmaEncodingLatin, - WwanSmsCdmaEncodingGsm7Bit, - WwanSmsCdmaEncodingMax -} WWAN_SMS_CDMA_ENCODING, *PWWAN_SMS_CDMA_ENCODING; - -typedef struct _WWAN_SMS_CDMA_RECORD { - ULONG MessageIndex; - WWAN_MSG_STATUS MsgStatus; - CHAR Address[WWAN_SMS_CDMA_ADDR_MAX_LEN]; - CHAR ScTimeStamp[WWAN_SMS_CDMA_TIMESTAMP_MAX_LEN]; - WWAN_SMS_CDMA_ENCODING EncodingId; - WWAN_SMS_CDMA_LANG LanguageId; - USHORT SizeInBytes; - BYTE SizeInCharacters; - BYTE EncodedMsg [WWAN_SMS_CDMA_MAX_BUF_LEN]; -} WWAN_SMS_CDMA_RECORD, *PWWAN_SMS_CDMA_RECORD; - -typedef struct _WWAN_SMS_PDU_RECORD { - ULONG MessageIndex; - WWAN_MSG_STATUS MsgStatus; - BYTE Size; - CHAR PduData [WWAN_SMS_PDU_HEX_BUF_LEN]; -} WWAN_SMS_PDU_RECORD, *PWWAN_SMS_PDU_RECORD; - -typedef struct _WWAN_SMS_SEND_CDMA { - WWAN_SMS_CDMA_ENCODING EncodingId; - WWAN_SMS_CDMA_LANG LanguageId; - CHAR Address [WWAN_SMS_CDMA_ADDR_MAX_LEN]; - USHORT SizeInBytes; - BYTE SizeInCharacters; - BYTE EncodedMsg [WWAN_SMS_CDMA_MAX_BUF_LEN]; -} WWAN_SMS_SEND_CDMA, *PWWAN_SMS_SEND_CDMA; - -typedef struct _WWAN_SMS_SEND_PDU { - BYTE Size; - CHAR PduData [WWAN_SMS_PDU_HEX_BUF_LEN]; -} WWAN_SMS_SEND_PDU, *PWWAN_SMS_SEND_PDU; - -typedef struct _WWAN_SMS_SEND { - WWAN_SMS_FORMAT SmsFormat; - - union { - WWAN_SMS_SEND_PDU Pdu; - WWAN_SMS_SEND_CDMA Cdma; - } u; -} WWAN_SMS_SEND, *PWWAN_SMS_SEND; - -#define WWAN_SMS_FLAG_NONE 0x00000000 -#define WWAN_SMS_FLAG_MESSAGE_STORE_FULL 0x00000001 -#define WWAN_SMS_FLAG_NEW_MESSAGE 0x00000002 - -typedef struct _WWAN_SMS_STATUS { - ULONG uFlag; - ULONG MessageIndex; -} WWAN_SMS_STATUS, *PWWAN_SMS_STATUS; - -typedef struct _WWAN_SERVICE_ACTIVATION_STATUS { - ULONG uNwError; - ULONG uVendorSpecificBufferSize; -} WWAN_SERVICE_ACTIVATION_STATUS,*PWWAN_SERVICE_ACTIVATION_STATUS; - -typedef struct _WWAN_VENDOR_SPECIFIC { - ULONG uVendorSpecificBufferSize; -} WWAN_VENDOR_SPECIFIC, *PWWAN_VENDOR_SPECIFIC; - -#endif - diff --git a/pub/ddk/xfilter.h b/pub/ddk/xfilter.h deleted file mode 100644 index dc25086..0000000 --- a/pub/ddk/xfilter.h +++ /dev/null @@ -1,269 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - xfilter.h - -Abstract: - - Header file for the address filtering library for NDIS MAC's. - -Author: - -Environment: - -Notes: - - None. - -Revision History: - ---*/ - -#ifndef _X_FILTER_DEFS_ -#define _X_FILTER_DEFS_ - -#pragma once - -#define ETH_LENGTH_OF_ADDRESS 6 - - -// -// ZZZ This is a little-endian specific check. -// -#define ETH_IS_MULTICAST(Address) \ - (BOOLEAN)(((PUCHAR)(Address))[0] & ((UCHAR)0x01)) - - -// -// Check whether an address is broadcast. -// -#define ETH_IS_BROADCAST(Address) \ - ((((PUCHAR)(Address))[0] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[1] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[2] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[3] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[4] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[5] == ((UCHAR)0xff))) - - -// -// This macro will compare network addresses. -// -// A - Is a network address. -// -// B - Is a network address. -// -// Result - The result of comparing two network address. -// -// Result < 0 Implies the B address is greater. -// Result > 0 Implies the A element is greater. -// Result = 0 Implies equality. -// -// Note that this is an arbitrary ordering. There is not -// defined relation on network addresses. This is ad-hoc! -// -// -#define ETH_COMPARE_NETWORK_ADDRESSES(_A, _B, _Result) \ -{ \ - if (*(ULONG UNALIGNED *)&(_A)[2] > \ - *(ULONG UNALIGNED *)&(_B)[2]) \ - { \ - *(_Result) = 1; \ - } \ - else if (*(ULONG UNALIGNED *)&(_A)[2] < \ - *(ULONG UNALIGNED *)&(_B)[2]) \ - { \ - *(_Result) = (UINT)-1; \ - } \ - else if (*(USHORT UNALIGNED *)(_A) > \ - *(USHORT UNALIGNED *)(_B)) \ - { \ - *(_Result) = 1; \ - } \ - else if (*(USHORT UNALIGNED *)(_A) < \ - *(USHORT UNALIGNED *)(_B)) \ - { \ - *(_Result) = (UINT)-1; \ - } \ - else \ - { \ - *(_Result) = 0; \ - } \ -} - -// -// This macro will compare network addresses. -// -// A - Is a network address. -// -// B - Is a network address. -// -// Result - The result of comparing two network address. -// -// Result != 0 Implies inequality. -// Result == 0 Implies equality. -// -// -#define ETH_COMPARE_NETWORK_ADDRESSES_EQ(_A,_B, _Result) \ -{ \ - if ((*(ULONG UNALIGNED *)&(_A)[2] == \ - *(ULONG UNALIGNED *)&(_B)[2]) && \ - (*(USHORT UNALIGNED *)(_A) == \ - *(USHORT UNALIGNED *)(_B))) \ - { \ - *(_Result) = 0; \ - } \ - else \ - { \ - *(_Result) = 1; \ - } \ -} - - -// -// This macro is used to copy from one network address to -// another. -// -#define ETH_COPY_NETWORK_ADDRESS(_D, _S) \ -{ \ - *((ULONG UNALIGNED *)(_D)) = *((ULONG UNALIGNED *)(_S)); \ - *((USHORT UNALIGNED *)((UCHAR *)(_D)+4)) = *((USHORT UNALIGNED *)((UCHAR *)(_S)+4)); \ -} - -#define TR_LENGTH_OF_FUNCTIONAL 4 -#define TR_LENGTH_OF_ADDRESS 6 - - -// -// Only the low 32 bits of the functional/group address -// are needed since the upper 16 bits is always c0-00. -// -typedef ULONG TR_FUNCTIONAL_ADDRESS; -typedef ULONG TR_GROUP_ADDRESS; - - -#define TR_IS_NOT_DIRECTED(_Address, _Result) \ -{ \ - *(_Result) = (BOOLEAN)((_Address)[0] & 0x80); \ -} - -#define TR_IS_FUNCTIONAL(_Address, _Result) \ -{ \ - *(_Result) = (BOOLEAN)(((_Address)[0] & 0x80) && \ - !((_Address)[2] & 0x80)); \ -} - -// -// -#define TR_IS_GROUP(_Address, _Result) \ -{ \ - *(_Result) = (BOOLEAN)((_Address)[0] & (_Address)[2] & 0x80); \ -} - -// -// -#define TR_IS_SOURCE_ROUTING(_Address, _Result) \ -{ \ - *(_Result) = (BOOLEAN)((_Address)[0] & 0x80); \ -} - -// -// Check for NDIS_PACKET_TYPE_MAC_FRAME -// -#define TR_IS_MAC_FRAME(_PacketHeader) ((((PUCHAR)_PacketHeader)[1] & 0xFC) == 0) - - -// -// Check whether an address is broadcast. This is a little-endian check. -// -#define TR_IS_BROADCAST(_Address, _Result) \ -{ \ - *(_Result) = (BOOLEAN)(((*(UNALIGNED USHORT *)&(_Address)[0] == 0xFFFF) || \ - (*(UNALIGNED USHORT *)&(_Address)[0] == 0x00C0)) && \ - (*(UNALIGNED ULONG *)&(_Address)[2] == 0xFFFFFFFF));\ -} - - -// -// This macro will compare network addresses. -// -// A - Is a network address. -// -// B - Is a network address. -// -// Result - The result of comparing two network address. -// -// Result < 0 Implies the B address is greater. -// Result > 0 Implies the A element is greater. -// Result = 0 Implies equality. -// -// Note that this is an arbitrary ordering. There is not -// defined relation on network addresses. This is ad-hoc! -// -// -#define TR_COMPARE_NETWORK_ADDRESSES(_A, _B, _Result) \ -{ \ - if (*(ULONG UNALIGNED *)&(_A)[2] > \ - *(ULONG UNALIGNED *)&(_B)[2]) \ - { \ - *(_Result) = 1; \ - } \ - else if (*(ULONG UNALIGNED *)&(_A)[2] < \ - *(ULONG UNALIGNED *)&(_B)[2]) \ - { \ - *(_Result) = (UINT)-1; \ - } \ - else if (*(USHORT UNALIGNED *)(_A) > \ - *(USHORT UNALIGNED *)(_B)) \ - { \ - *(_Result) = 1; \ - } \ - else if (*(USHORT UNALIGNED *)(_A) < \ - *(USHORT UNALIGNED *)(_B)) \ - { \ - *(_Result) = (UINT)-1; \ - } \ - else \ - { \ - *(_Result) = 0; \ - } \ -} - -// -// This macro will compare network addresses. -// -// A - Is a network address. -// -// B - Is a network address. -// -// Result - The result of comparing two network address. -// -// Result != 0 Implies inequality. -// Result == 0 Implies equality. -// -// -#define TR_COMPARE_NETWORK_ADDRESSES_EQ(_A, _B, _Result) \ -{ \ - if ((*(ULONG UNALIGNED *)&(_A)[2] == *(ULONG UNALIGNED *)&(_B)[2]) && \ - (*(USHORT UNALIGNED *)&(_A)[0] == *(USHORT UNALIGNED *)&(_B)[0])) \ - { \ - *(_Result) = 0; \ - } \ - else \ - { \ - *(_Result) = 1; \ - } \ -} - - -// -// This macro is used to copy from one network address to -// another. -// -#define TR_COPY_NETWORK_ADDRESS(_D, _S) \ -{ \ - *((ULONG UNALIGNED *)(_D)) = *((ULONG UNALIGNED *)(_S)); \ - *((USHORT UNALIGNED *)((UCHAR *)(_D)+4)) = \ - *((USHORT UNALIGNED *)((UCHAR *)(_S)+4)); \ -} - -#endif // _X_FILTER_DEFS_ - diff --git a/pub/ddk/xpsrassvc.h b/pub/ddk/xpsrassvc.h deleted file mode 100644 index 85fabdd..0000000 --- a/pub/ddk/xpsrassvc.h +++ /dev/null @@ -1,379 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for xpsrassvc.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 version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the 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 -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __xpsrassvc_h__ -#define __xpsrassvc_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IXpsRasterizerNotificationCallback_FWD_DEFINED__ -#define __IXpsRasterizerNotificationCallback_FWD_DEFINED__ -typedef interface IXpsRasterizerNotificationCallback IXpsRasterizerNotificationCallback; -#endif /* __IXpsRasterizerNotificationCallback_FWD_DEFINED__ */ - - -#ifndef __IXpsRasterizer_FWD_DEFINED__ -#define __IXpsRasterizer_FWD_DEFINED__ -typedef interface IXpsRasterizer IXpsRasterizer; -#endif /* __IXpsRasterizer_FWD_DEFINED__ */ - - -#ifndef __IXpsRasterizationFactory_FWD_DEFINED__ -#define __IXpsRasterizationFactory_FWD_DEFINED__ -typedef interface IXpsRasterizationFactory IXpsRasterizationFactory; -#endif /* __IXpsRasterizationFactory_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "wincodec.h" -#include "XpsObjectModel.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_xpsrassvc_0000_0000 */ -/* [local] */ - -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------------------- - - -extern RPC_IF_HANDLE __MIDL_itf_xpsrassvc_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_xpsrassvc_0000_0000_v0_0_s_ifspec; - -#ifndef __IXpsRasterizerNotificationCallback_INTERFACE_DEFINED__ -#define __IXpsRasterizerNotificationCallback_INTERFACE_DEFINED__ - -/* interface IXpsRasterizerNotificationCallback */ -/* [ref][helpstring][nonextensible][uuid][object] */ - - -EXTERN_C const IID IID_IXpsRasterizerNotificationCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9AB8FD0D-CB94-49c2-9CB0-97EC1D5469D2") - IXpsRasterizerNotificationCallback : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Continue( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IXpsRasterizerNotificationCallbackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IXpsRasterizerNotificationCallback * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IXpsRasterizerNotificationCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IXpsRasterizerNotificationCallback * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Continue )( - __RPC__in IXpsRasterizerNotificationCallback * This); - - END_INTERFACE - } IXpsRasterizerNotificationCallbackVtbl; - - interface IXpsRasterizerNotificationCallback - { - CONST_VTBL struct IXpsRasterizerNotificationCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IXpsRasterizerNotificationCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IXpsRasterizerNotificationCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IXpsRasterizerNotificationCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IXpsRasterizerNotificationCallback_Continue(This) \ - ( (This)->lpVtbl -> Continue(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IXpsRasterizerNotificationCallback_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_xpsrassvc_0000_0001 */ -/* [local] */ - -typedef /* [public][public][public] */ -enum __MIDL___MIDL_itf_xpsrassvc_0000_0001_0001 - { XPSRAS_RENDERING_MODE_ANTIALIASED = 0, - XPSRAS_RENDERING_MODE_ALIASED = 1 - } XPSRAS_RENDERING_MODE; - - - -extern RPC_IF_HANDLE __MIDL_itf_xpsrassvc_0000_0001_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_xpsrassvc_0000_0001_v0_0_s_ifspec; - -#ifndef __IXpsRasterizer_INTERFACE_DEFINED__ -#define __IXpsRasterizer_INTERFACE_DEFINED__ - -/* interface IXpsRasterizer */ -/* [ref][helpstring][nonextensible][uuid][object] */ - - -EXTERN_C const IID IID_IXpsRasterizer; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("7567CFC8-C156-47a8-9DAC-11A2AE5BDD6B") - IXpsRasterizer : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE RasterizeRect( - /* [in] */ INT x, - /* [in] */ INT y, - /* [in] */ INT width, - /* [in] */ INT height, - /* [in] */ __RPC__in_opt IXpsRasterizerNotificationCallback *notificationCallback, - /* [out] */ __RPC__deref_out_opt IWICBitmap **bitmap) = 0; - - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMinimalLineWidth( - /* [in] */ INT width) = 0; - - }; - -#else /* C style interface */ - - typedef struct IXpsRasterizerVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IXpsRasterizer * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IXpsRasterizer * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IXpsRasterizer * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *RasterizeRect )( - __RPC__in IXpsRasterizer * This, - /* [in] */ INT x, - /* [in] */ INT y, - /* [in] */ INT width, - /* [in] */ INT height, - /* [in] */ __RPC__in_opt IXpsRasterizerNotificationCallback *notificationCallback, - /* [out] */ __RPC__deref_out_opt IWICBitmap **bitmap); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMinimalLineWidth )( - __RPC__in IXpsRasterizer * This, - /* [in] */ INT width); - - END_INTERFACE - } IXpsRasterizerVtbl; - - interface IXpsRasterizer - { - CONST_VTBL struct IXpsRasterizerVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IXpsRasterizer_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IXpsRasterizer_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IXpsRasterizer_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IXpsRasterizer_RasterizeRect(This,x,y,width,height,notificationCallback,bitmap) \ - ( (This)->lpVtbl -> RasterizeRect(This,x,y,width,height,notificationCallback,bitmap) ) - -#define IXpsRasterizer_SetMinimalLineWidth(This,width) \ - ( (This)->lpVtbl -> SetMinimalLineWidth(This,width) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IXpsRasterizer_INTERFACE_DEFINED__ */ - - -#ifndef __IXpsRasterizationFactory_INTERFACE_DEFINED__ -#define __IXpsRasterizationFactory_INTERFACE_DEFINED__ - -/* interface IXpsRasterizationFactory */ -/* [ref][helpstring][nonextensible][uuid][object] */ - - -EXTERN_C const IID IID_IXpsRasterizationFactory; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E094808A-24C6-482b-A3A7-C21AC9B55F17") - IXpsRasterizationFactory : public IUnknown - { - public: - virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CreateRasterizer( - /* [in] */ __RPC__in_opt IXpsOMPage *xpsPage, - /* [in] */ FLOAT DPI, - /* [in] */ XPSRAS_RENDERING_MODE nonTextRenderingMode, - /* [in] */ XPSRAS_RENDERING_MODE textRenderingMode, - /* [out] */ __RPC__deref_out_opt IXpsRasterizer **ppIXPSRasterizer) = 0; - - }; - -#else /* C style interface */ - - typedef struct IXpsRasterizationFactoryVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in IXpsRasterizationFactory * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in IXpsRasterizationFactory * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in IXpsRasterizationFactory * This); - - /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateRasterizer )( - __RPC__in IXpsRasterizationFactory * This, - /* [in] */ __RPC__in_opt IXpsOMPage *xpsPage, - /* [in] */ FLOAT DPI, - /* [in] */ XPSRAS_RENDERING_MODE nonTextRenderingMode, - /* [in] */ XPSRAS_RENDERING_MODE textRenderingMode, - /* [out] */ __RPC__deref_out_opt IXpsRasterizer **ppIXPSRasterizer); - - END_INTERFACE - } IXpsRasterizationFactoryVtbl; - - interface IXpsRasterizationFactory - { - CONST_VTBL struct IXpsRasterizationFactoryVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IXpsRasterizationFactory_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IXpsRasterizationFactory_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IXpsRasterizationFactory_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IXpsRasterizationFactory_CreateRasterizer(This,xpsPage,DPI,nonTextRenderingMode,textRenderingMode,ppIXPSRasterizer) \ - ( (This)->lpVtbl -> CreateRasterizer(This,xpsPage,DPI,nonTextRenderingMode,textRenderingMode,ppIXPSRasterizer) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IXpsRasterizationFactory_INTERFACE_DEFINED__ */ - - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - diff --git a/pub/external/bin/FreeImage.dll b/pub/external/bin/FreeImage.dll deleted file mode 100644 index 8040f50..0000000 Binary files a/pub/external/bin/FreeImage.dll and /dev/null differ diff --git a/pub/external/bin/FreeImagedx64.dll b/pub/external/bin/FreeImagedx64.dll deleted file mode 100644 index 6d6d274..0000000 Binary files a/pub/external/bin/FreeImagedx64.dll and /dev/null differ diff --git a/pub/external/bin/FreeImagex64.dll b/pub/external/bin/FreeImagex64.dll deleted file mode 100644 index 0764f48..0000000 Binary files a/pub/external/bin/FreeImagex64.dll and /dev/null differ diff --git a/pub/external/bin/jsonObjectD.dll b/pub/external/bin/jsonObjectD.dll deleted file mode 100644 index 3f6dfcc..0000000 Binary files a/pub/external/bin/jsonObjectD.dll and /dev/null differ diff --git a/pub/external/bin/libfreeimage-3.13.1.dylib b/pub/external/bin/libfreeimage-3.13.1.dylib deleted file mode 100644 index c0138b6..0000000 Binary files a/pub/external/bin/libfreeimage-3.13.1.dylib and /dev/null differ diff --git a/pub/external/bin/turbojpeg.dll b/pub/external/bin/turbojpeg.dll deleted file mode 100644 index fe5a1c8..0000000 Binary files a/pub/external/bin/turbojpeg.dll and /dev/null differ diff --git a/pub/external/include/CJsonObject.hpp b/pub/external/include/CJsonObject.hpp deleted file mode 100644 index 0b53913..0000000 --- a/pub/external/include/CJsonObject.hpp +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Project: neb - * @file CJsonObject.hpp - * @brief Json - * @author bwarliao - * @date: 2014-7-16 - * @note - * Modify history: - ******************************************************************************/ - -#ifndef CJSONOBJECT_HPP_ -#define CJSONOBJECT_HPP_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" -{ -#endif -typedef struct cJSON cJSON; - -#ifdef __cplusplus -} -#endif - - -#ifdef JSONOBJECT_EXPORTS -#define DLL_EXPORT_IMPORT __declspec(dllexport) -#else -#define DLL_EXPORT_IMPORT __declspec(dllimport) -#endif - -namespace neb -{ -typedef int int32; -typedef unsigned int uint32; -typedef long long int64; -typedef unsigned long long uint64; - -class DLL_EXPORT_IMPORT CJsonObject -{ -public: // method of ordinary json object or json array - CJsonObject(); - CJsonObject(const std::string& strJson); - CJsonObject(const CJsonObject* pJsonObject); - CJsonObject(const CJsonObject& oJsonObject); - virtual ~CJsonObject(); - - CJsonObject& operator=(const CJsonObject& oJsonObject); - bool operator==(const CJsonObject& oJsonObject) const; - bool Parse(const std::string& strJson); - void Clear(); - bool IsEmpty() const; - bool IsArray() const; - std::string ToString() const; - std::string ToFormattedString() const; - const std::string& GetErrMsg() const - { - return(m_strErrMsg); - } - -public: // method of ordinary json object - bool AddEmptySubObject(const std::string& strKey); - bool AddEmptySubArray(const std::string& strKey); - CJsonObject& operator[](const std::string& strKey); - std::string operator()(const std::string& strKey) const; - bool Get(const std::string& strKey, CJsonObject& oJsonObject) const; - bool Get(const std::string& strKey, std::string& strValue) const; - bool Get(const std::string& strKey, int32& iValue) const; - bool Get(const std::string& strKey, uint32& uiValue) const; - bool Get(const std::string& strKey, int64& llValue) const; - bool Get(const std::string& strKey, uint64& ullValue) const; - bool Get(const std::string& strKey, bool& bValue) const; - bool Get(const std::string& strKey, float& fValue) const; - bool Get(const std::string& strKey, double& dValue) const; - bool Add(const std::string& strKey, const CJsonObject& oJsonObject); - bool Add(const std::string& strKey, const std::string& strValue); - bool Add(const std::string& strKey, int32 iValue); - bool Add(const std::string& strKey, uint32 uiValue); - bool Add(const std::string& strKey, int64 llValue); - bool Add(const std::string& strKey, uint64 ullValue); - bool Add(const std::string& strKey, bool bValue, bool bValueAgain); - bool Add(const std::string& strKey, float fValue); - bool Add(const std::string& strKey, double dValue); - bool Delete(const std::string& strKey); - bool Replace(const std::string& strKey, const CJsonObject& oJsonObject); - bool Replace(const std::string& strKey, const std::string& strValue); - bool Replace(const std::string& strKey, int32 iValue); - bool Replace(const std::string& strKey, uint32 uiValue); - bool Replace(const std::string& strKey, int64 llValue); - bool Replace(const std::string& strKey, uint64 ullValue); - bool Replace(const std::string& strKey, bool bValue, bool bValueAgain); - bool Replace(const std::string& strKey, float fValue); - bool Replace(const std::string& strKey, double dValue); - -public: // method of json array - int GetArraySize(); - CJsonObject& operator[](unsigned int uiWhich); - std::string operator()(unsigned int uiWhich) const; - bool Get(int iWhich, CJsonObject& oJsonObject) const; - bool Get(int iWhich, std::string& strValue) const; - bool Get(int iWhich, int32& iValue) const; - bool Get(int iWhich, uint32& uiValue) const; - bool Get(int iWhich, int64& llValue) const; - bool Get(int iWhich, uint64& ullValue) const; - bool Get(int iWhich, bool& bValue) const; - bool Get(int iWhich, float& fValue) const; - bool Get(int iWhich, double& dValue) const; - bool Add(const CJsonObject& oJsonObject); - bool Add(const std::string& strValue); - bool Add(int32 iValue); - bool Add(uint32 uiValue); - bool Add(int64 llValue); - bool Add(uint64 ullValue); - bool Add(int iAnywhere, bool bValue); - bool Add(float fValue); - bool Add(double dValue); - bool AddAsFirst(const CJsonObject& oJsonObject); - bool AddAsFirst(const std::string& strValue); - bool AddAsFirst(int32 iValue); - bool AddAsFirst(uint32 uiValue); - bool AddAsFirst(int64 llValue); - bool AddAsFirst(uint64 ullValue); - bool AddAsFirst(int iAnywhere, bool bValue); - bool AddAsFirst(float fValue); - bool AddAsFirst(double dValue); - bool Delete(int iWhich); - bool Replace(int iWhich, const CJsonObject& oJsonObject); - bool Replace(int iWhich, const std::string& strValue); - bool Replace(int iWhich, int32 iValue); - bool Replace(int iWhich, uint32 uiValue); - bool Replace(int iWhich, int64 llValue); - bool Replace(int iWhich, uint64 ullValue); - bool Replace(int iWhich, bool bValue, bool bValueAgain); - bool Replace(int iWhich, float fValue); - bool Replace(int iWhich, double dValue); - -private: - CJsonObject(cJSON* pJsonData); - -private: - cJSON* m_pJsonData; - cJSON* m_pExternJsonDataRef; - std::string m_strErrMsg; - std::map m_mapJsonArrayRef; - std::map m_mapJsonObjectRef; -}; - -} - -#endif /* CJSONHELPER_HPP_ */ diff --git a/pub/external/include/FreeImage.h b/pub/external/include/FreeImage.h deleted file mode 100644 index f10aea6..0000000 --- a/pub/external/include/FreeImage.h +++ /dev/null @@ -1,1090 +0,0 @@ -// ========================================================== -// FreeImage 3 -// -// Design and implementation by -// - Floris van den Berg (flvdberg@wxs.nl) -// - Herv?Drolon (drolon@infonie.fr) -// -// Contributors: -// - Adam Gates (radad@xoasis.com) -// - Alex Kwak -// - Alexander Dymerets (sashad@te.net.ua) -// - Detlev Vendt (detlev.vendt@brillit.de) -// - Jan L. Nauta (jln@magentammt.com) -// - Jani Kajala (janik@remedy.fi) -// - Juergen Riecker (j.riecker@gmx.de) -// - Karl-Heinz Bussian (khbussian@moss.de) -// - Laurent Rocher (rocherl@club-internet.fr) -// - Luca Piergentili (l.pierge@terra.es) -// - Machiel ten Brinke (brinkem@uni-one.nl) -// - Markus Loibl (markus.loibl@epost.de) -// - Martin Weber (martweb@gmx.net) -// - Matthias Wandel (mwandel@rim.net) -// - Michal Novotny (michal@etc.cz) -// - Petr Pytelka (pyta@lightcomp.com) -// - Riley McNiff (rmcniff@marexgroup.com) -// - Ryan Rubley (ryan@lostreality.org) -// - Volker G鋜tner (volkerg@gmx.at) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifndef FREEIMAGE_H -#define FREEIMAGE_H - -// Version information ------------------------------------------------------ - -#define FREEIMAGE_MAJOR_VERSION 3 -#define FREEIMAGE_MINOR_VERSION 13 -#define FREEIMAGE_RELEASE_SERIAL 1 - -// Compiler options --------------------------------------------------------- - -#include // needed for UNICODE functions - -#if defined(FREEIMAGE_LIB) - #define DLL_API - #define DLL_CALLCONV -#else - #if defined(_WIN32) || defined(__WIN32__) - #define DLL_CALLCONV __stdcall - // The following ifdef block is the standard way of creating macros which make exporting - // from a DLL simpler. All files within this DLL are compiled with the FREEIMAGE_EXPORTS - // symbol defined on the command line. this symbol should not be defined on any project - // that uses this DLL. This way any other project whose source files include this file see - // DLL_API functions as being imported from a DLL, wheras this DLL sees symbols - // defined with this macro as being exported. - #ifdef FREEIMAGE_EXPORTS - #define DLL_API __declspec(dllexport) - #else - #define DLL_API __declspec(dllimport) - #endif // FREEIMAGE_EXPORTS - #else - // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility) - #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - #ifndef GCC_HASCLASSVISIBILITY - #define GCC_HASCLASSVISIBILITY - #endif - #endif // __GNUC__ - #define DLL_CALLCONV - #if defined(GCC_HASCLASSVISIBILITY) - #define DLL_API __attribute__ ((visibility("default"))) - #else - #define DLL_API - #endif - #endif // WIN32 / !WIN32 -#endif // FREEIMAGE_LIB - -// Some versions of gcc may have BYTE_ORDER or __BYTE_ORDER defined -// If your big endian system isn't being detected, add an OS specific check -#if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || \ - (defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || \ - defined(__BIG_ENDIAN__) -#define FREEIMAGE_BIGENDIAN -#endif // BYTE_ORDER - -// This really only affects 24 and 32 bit formats, the rest are always RGB order. -#define FREEIMAGE_COLORORDER_BGR 0 -#define FREEIMAGE_COLORORDER_RGB 1 -#if defined(FREEIMAGE_BIGENDIAN) -#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB -#else -#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR -#endif - -// Ensure 4-byte enums if we're using Borland C++ compilers -#if defined(__BORLANDC__) -#pragma option push -b -#endif - -// For C compatibility -------------------------------------------------------- - -#ifdef __cplusplus -#define FI_DEFAULT(x) = x -#define FI_ENUM(x) enum x -#define FI_STRUCT(x) struct x -#else -#define FI_DEFAULT(x) -#define FI_ENUM(x) typedef int x; enum x -#define FI_STRUCT(x) typedef struct x x; struct x -#endif - -// Bitmap types ------------------------------------------------------------- - -FI_STRUCT (FIBITMAP) { void *data; }; -FI_STRUCT (FIMULTIBITMAP) { void *data; }; - -// Types used in the library (directly copied from Windows) ----------------- - -#if defined(__MINGW32__) && defined(_WINDOWS_H) -#define _WINDOWS_ // prevent a bug in MinGW32 -#endif // __MINGW32__ - -#ifndef _WINDOWS_ -#define _WINDOWS_ - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef NULL -#define NULL 0 -#endif - -#ifndef SEEK_SET -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 -#endif - -#ifndef _MSC_VER -// define portable types for 32-bit / 64-bit OS -#include -typedef int32_t BOOL; -typedef uint8_t BYTE; -typedef uint16_t WORD; -typedef uint32_t DWORD; -typedef int32_t LONG; -#else -// MS is not C99 ISO compliant -typedef long BOOL; -typedef unsigned char BYTE; -typedef unsigned short WORD; -typedef unsigned long DWORD; -typedef long LONG; -#endif // _MSC_VER - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(push, 1) -#else -#pragma pack(1) -#endif // WIN32 - -typedef struct tagRGBQUAD { -#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR - BYTE rgbBlue; - BYTE rgbGreen; - BYTE rgbRed; -#else - BYTE rgbRed; - BYTE rgbGreen; - BYTE rgbBlue; -#endif // FREEIMAGE_COLORORDER - BYTE rgbReserved; -} RGBQUAD; - -typedef struct tagRGBTRIPLE { -#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR - BYTE rgbtBlue; - BYTE rgbtGreen; - BYTE rgbtRed; -#else - BYTE rgbtRed; - BYTE rgbtGreen; - BYTE rgbtBlue; -#endif // FREEIMAGE_COLORORDER -} RGBTRIPLE; - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(pop) -#else -#pragma pack() -#endif // WIN32 - -typedef struct tagBITMAPINFOHEADER{ - DWORD biSize; - LONG biWidth; - LONG biHeight; - WORD biPlanes; - WORD biBitCount; - DWORD biCompression; - DWORD biSizeImage; - LONG biXPelsPerMeter; - LONG biYPelsPerMeter; - DWORD biClrUsed; - DWORD biClrImportant; -} BITMAPINFOHEADER, *PBITMAPINFOHEADER; - -typedef struct tagBITMAPINFO { - BITMAPINFOHEADER bmiHeader; - RGBQUAD bmiColors[1]; -} BITMAPINFO, *PBITMAPINFO; - -#endif // _WINDOWS_ - -// Types used in the library (specific to FreeImage) ------------------------ - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(push, 1) -#else -#pragma pack(1) -#endif // WIN32 - -/** 48-bit RGB -*/ -typedef struct tagFIRGB16 { - WORD red; - WORD green; - WORD blue; -} FIRGB16; - -/** 64-bit RGBA -*/ -typedef struct tagFIRGBA16 { - WORD red; - WORD green; - WORD blue; - WORD alpha; -} FIRGBA16; - -/** 96-bit RGB Float -*/ -typedef struct tagFIRGBF { - float red; - float green; - float blue; -} FIRGBF; - -/** 128-bit RGBA Float -*/ -typedef struct tagFIRGBAF { - float red; - float green; - float blue; - float alpha; -} FIRGBAF; - -/** Data structure for COMPLEX type (complex number) -*/ -typedef struct tagFICOMPLEX { - /// real part - double r; - /// imaginary part - double i; -} FICOMPLEX; - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(pop) -#else -#pragma pack() -#endif // WIN32 - -// Indexes for byte arrays, masks and shifts for treating pixels as words --- -// These coincide with the order of RGBQUAD and RGBTRIPLE ------------------- - -#ifndef FREEIMAGE_BIGENDIAN -#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR -// Little Endian (x86 / MS Windows, Linux) : BGR(A) order -#define FI_RGBA_RED 2 -#define FI_RGBA_GREEN 1 -#define FI_RGBA_BLUE 0 -#define FI_RGBA_ALPHA 3 -#define FI_RGBA_RED_MASK 0x00FF0000 -#define FI_RGBA_GREEN_MASK 0x0000FF00 -#define FI_RGBA_BLUE_MASK 0x000000FF -#define FI_RGBA_ALPHA_MASK 0xFF000000 -#define FI_RGBA_RED_SHIFT 16 -#define FI_RGBA_GREEN_SHIFT 8 -#define FI_RGBA_BLUE_SHIFT 0 -#define FI_RGBA_ALPHA_SHIFT 24 -#else -// Little Endian (x86 / MaxOSX) : RGB(A) order -#define FI_RGBA_RED 0 -#define FI_RGBA_GREEN 1 -#define FI_RGBA_BLUE 2 -#define FI_RGBA_ALPHA 3 -#define FI_RGBA_RED_MASK 0x000000FF -#define FI_RGBA_GREEN_MASK 0x0000FF00 -#define FI_RGBA_BLUE_MASK 0x00FF0000 -#define FI_RGBA_ALPHA_MASK 0xFF000000 -#define FI_RGBA_RED_SHIFT 0 -#define FI_RGBA_GREEN_SHIFT 8 -#define FI_RGBA_BLUE_SHIFT 16 -#define FI_RGBA_ALPHA_SHIFT 24 -#endif // FREEIMAGE_COLORORDER -#else -#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR -// Big Endian (PPC / none) : BGR(A) order -#define FI_RGBA_RED 2 -#define FI_RGBA_GREEN 1 -#define FI_RGBA_BLUE 0 -#define FI_RGBA_ALPHA 3 -#define FI_RGBA_RED_MASK 0x0000FF00 -#define FI_RGBA_GREEN_MASK 0x00FF0000 -#define FI_RGBA_BLUE_MASK 0xFF000000 -#define FI_RGBA_ALPHA_MASK 0x000000FF -#define FI_RGBA_RED_SHIFT 8 -#define FI_RGBA_GREEN_SHIFT 16 -#define FI_RGBA_BLUE_SHIFT 24 -#define FI_RGBA_ALPHA_SHIFT 0 -#else -// Big Endian (PPC / Linux, MaxOSX) : RGB(A) order -#define FI_RGBA_RED 0 -#define FI_RGBA_GREEN 1 -#define FI_RGBA_BLUE 2 -#define FI_RGBA_ALPHA 3 -#define FI_RGBA_RED_MASK 0xFF000000 -#define FI_RGBA_GREEN_MASK 0x00FF0000 -#define FI_RGBA_BLUE_MASK 0x0000FF00 -#define FI_RGBA_ALPHA_MASK 0x000000FF -#define FI_RGBA_RED_SHIFT 24 -#define FI_RGBA_GREEN_SHIFT 16 -#define FI_RGBA_BLUE_SHIFT 8 -#define FI_RGBA_ALPHA_SHIFT 0 -#endif // FREEIMAGE_COLORORDER -#endif // FREEIMAGE_BIGENDIAN - -#define FI_RGBA_RGB_MASK (FI_RGBA_RED_MASK|FI_RGBA_GREEN_MASK|FI_RGBA_BLUE_MASK) - -// The 16bit macros only include masks and shifts, since each color element is not byte aligned - -#define FI16_555_RED_MASK 0x7C00 -#define FI16_555_GREEN_MASK 0x03E0 -#define FI16_555_BLUE_MASK 0x001F -#define FI16_555_RED_SHIFT 10 -#define FI16_555_GREEN_SHIFT 5 -#define FI16_555_BLUE_SHIFT 0 -#define FI16_565_RED_MASK 0xF800 -#define FI16_565_GREEN_MASK 0x07E0 -#define FI16_565_BLUE_MASK 0x001F -#define FI16_565_RED_SHIFT 11 -#define FI16_565_GREEN_SHIFT 5 -#define FI16_565_BLUE_SHIFT 0 - -// ICC profile support ------------------------------------------------------ - -#define FIICC_DEFAULT 0x00 -#define FIICC_COLOR_IS_CMYK 0x01 - -FI_STRUCT (FIICCPROFILE) { - WORD flags; // info flag - DWORD size; // profile's size measured in bytes - void *data; // points to a block of contiguous memory containing the profile -}; - -// Important enums ---------------------------------------------------------- - -/** I/O image format identifiers. -*/ -FI_ENUM(FREE_IMAGE_FORMAT) { - FIF_UNKNOWN = -1, - FIF_BMP = 0, - FIF_ICO = 1, - FIF_JPEG = 2, - FIF_JNG = 3, - FIF_KOALA = 4, - FIF_LBM = 5, - FIF_IFF = FIF_LBM, - FIF_MNG = 6, - FIF_PBM = 7, - FIF_PBMRAW = 8, - FIF_PCD = 9, - FIF_PCX = 10, - FIF_PGM = 11, - FIF_PGMRAW = 12, - FIF_PNG = 13, - FIF_PPM = 14, - FIF_PPMRAW = 15, - FIF_RAS = 16, - FIF_TARGA = 17, - FIF_TIFF = 18, - FIF_WBMP = 19, - FIF_PSD = 20, - FIF_CUT = 21, - FIF_XBM = 22, - FIF_XPM = 23, - FIF_DDS = 24, - FIF_GIF = 25, - FIF_HDR = 26, - FIF_FAXG3 = 27, - FIF_SGI = 28, - FIF_EXR = 29, - FIF_J2K = 30, - FIF_JP2 = 31, - FIF_PFM = 32, - FIF_PICT = 33, - FIF_RAW = 34 -}; - -/** Image type used in FreeImage. -*/ -FI_ENUM(FREE_IMAGE_TYPE) { - FIT_UNKNOWN = 0, // unknown type - FIT_BITMAP = 1, // standard image : 1-, 4-, 8-, 16-, 24-, 32-bit - FIT_UINT16 = 2, // array of unsigned short : unsigned 16-bit - FIT_INT16 = 3, // array of short : signed 16-bit - FIT_UINT32 = 4, // array of unsigned long : unsigned 32-bit - FIT_INT32 = 5, // array of long : signed 32-bit - FIT_FLOAT = 6, // array of float : 32-bit IEEE floating point - FIT_DOUBLE = 7, // array of double : 64-bit IEEE floating point - FIT_COMPLEX = 8, // array of FICOMPLEX : 2 x 64-bit IEEE floating point - FIT_RGB16 = 9, // 48-bit RGB image : 3 x 16-bit - FIT_RGBA16 = 10, // 64-bit RGBA image : 4 x 16-bit - FIT_RGBF = 11, // 96-bit RGB float image : 3 x 32-bit IEEE floating point - FIT_RGBAF = 12 // 128-bit RGBA float image : 4 x 32-bit IEEE floating point -}; - -/** Image color type used in FreeImage. -*/ -FI_ENUM(FREE_IMAGE_COLOR_TYPE) { - FIC_MINISWHITE = 0, // min value is white - FIC_MINISBLACK = 1, // min value is black - FIC_RGB = 2, // RGB color model - FIC_PALETTE = 3, // color map indexed - FIC_RGBALPHA = 4, // RGB color model with alpha channel - FIC_CMYK = 5 // CMYK color model -}; - -/** Color quantization algorithms. -Constants used in FreeImage_ColorQuantize. -*/ -FI_ENUM(FREE_IMAGE_QUANTIZE) { - FIQ_WUQUANT = 0, // Xiaolin Wu color quantization algorithm - FIQ_NNQUANT = 1 // NeuQuant neural-net quantization algorithm by Anthony Dekker -}; - -/** Dithering algorithms. -Constants used in FreeImage_Dither. -*/ -FI_ENUM(FREE_IMAGE_DITHER) { - FID_FS = 0, // Floyd & Steinberg error diffusion - FID_BAYER4x4 = 1, // Bayer ordered dispersed dot dithering (order 2 dithering matrix) - FID_BAYER8x8 = 2, // Bayer ordered dispersed dot dithering (order 3 dithering matrix) - FID_CLUSTER6x6 = 3, // Ordered clustered dot dithering (order 3 - 6x6 matrix) - FID_CLUSTER8x8 = 4, // Ordered clustered dot dithering (order 4 - 8x8 matrix) - FID_CLUSTER16x16= 5, // Ordered clustered dot dithering (order 8 - 16x16 matrix) - FID_BAYER16x16 = 6 // Bayer ordered dispersed dot dithering (order 4 dithering matrix) -}; - -/** Lossless JPEG transformations -Constants used in FreeImage_JPEGTransform -*/ -FI_ENUM(FREE_IMAGE_JPEG_OPERATION) { - FIJPEG_OP_NONE = 0, // no transformation - FIJPEG_OP_FLIP_H = 1, // horizontal flip - FIJPEG_OP_FLIP_V = 2, // vertical flip - FIJPEG_OP_TRANSPOSE = 3, // transpose across UL-to-LR axis - FIJPEG_OP_TRANSVERSE = 4, // transpose across UR-to-LL axis - FIJPEG_OP_ROTATE_90 = 5, // 90-degree clockwise rotation - FIJPEG_OP_ROTATE_180 = 6, // 180-degree rotation - FIJPEG_OP_ROTATE_270 = 7 // 270-degree clockwise (or 90 ccw) -}; - -/** Tone mapping operators. -Constants used in FreeImage_ToneMapping. -*/ -FI_ENUM(FREE_IMAGE_TMO) { - FITMO_DRAGO03 = 0, // Adaptive logarithmic mapping (F. Drago, 2003) - FITMO_REINHARD05 = 1, // Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) - FITMO_FATTAL02 = 2 // Gradient domain high dynamic range compression (R. Fattal, 2002) -}; - -/** Upsampling / downsampling filters. -Constants used in FreeImage_Rescale. -*/ -FI_ENUM(FREE_IMAGE_FILTER) { - FILTER_BOX = 0, // Box, pulse, Fourier window, 1st order (constant) b-spline - FILTER_BICUBIC = 1, // Mitchell & Netravali's two-param cubic filter - FILTER_BILINEAR = 2, // Bilinear filter - FILTER_BSPLINE = 3, // 4th order (cubic) b-spline - FILTER_CATMULLROM = 4, // Catmull-Rom spline, Overhauser spline - FILTER_LANCZOS3 = 5 // Lanczos3 filter -}; - -/** Color channels. -Constants used in color manipulation routines. -*/ -FI_ENUM(FREE_IMAGE_COLOR_CHANNEL) { - FICC_RGB = 0, // Use red, green and blue channels - FICC_RED = 1, // Use red channel - FICC_GREEN = 2, // Use green channel - FICC_BLUE = 3, // Use blue channel - FICC_ALPHA = 4, // Use alpha channel - FICC_BLACK = 5, // Use black channel - FICC_REAL = 6, // Complex images: use real part - FICC_IMAG = 7, // Complex images: use imaginary part - FICC_MAG = 8, // Complex images: use magnitude - FICC_PHASE = 9 // Complex images: use phase -}; - -// Metadata support --------------------------------------------------------- - -/** - Tag data type information (based on TIFF specifications) - - Note: RATIONALs are the ratio of two 32-bit integer values. -*/ -FI_ENUM(FREE_IMAGE_MDTYPE) { - FIDT_NOTYPE = 0, // placeholder - FIDT_BYTE = 1, // 8-bit unsigned integer - FIDT_ASCII = 2, // 8-bit bytes w/ last byte null - FIDT_SHORT = 3, // 16-bit unsigned integer - FIDT_LONG = 4, // 32-bit unsigned integer - FIDT_RATIONAL = 5, // 64-bit unsigned fraction - FIDT_SBYTE = 6, // 8-bit signed integer - FIDT_UNDEFINED = 7, // 8-bit untyped data - FIDT_SSHORT = 8, // 16-bit signed integer - FIDT_SLONG = 9, // 32-bit signed integer - FIDT_SRATIONAL = 10, // 64-bit signed fraction - FIDT_FLOAT = 11, // 32-bit IEEE floating point - FIDT_DOUBLE = 12, // 64-bit IEEE floating point - FIDT_IFD = 13, // 32-bit unsigned integer (offset) - FIDT_PALETTE = 14 // 32-bit RGBQUAD -}; - -/** - Metadata models supported by FreeImage -*/ -FI_ENUM(FREE_IMAGE_MDMODEL) { - FIMD_NODATA = -1, - FIMD_COMMENTS = 0, // single comment or keywords - FIMD_EXIF_MAIN = 1, // Exif-TIFF metadata - FIMD_EXIF_EXIF = 2, // Exif-specific metadata - FIMD_EXIF_GPS = 3, // Exif GPS metadata - FIMD_EXIF_MAKERNOTE = 4, // Exif maker note metadata - FIMD_EXIF_INTEROP = 5, // Exif interoperability metadata - FIMD_IPTC = 6, // IPTC/NAA metadata - FIMD_XMP = 7, // Abobe XMP metadata - FIMD_GEOTIFF = 8, // GeoTIFF metadata - FIMD_ANIMATION = 9, // Animation metadata - FIMD_CUSTOM = 10 // Used to attach other metadata types to a dib -}; - -/** - Handle to a metadata model -*/ -FI_STRUCT (FIMETADATA) { void *data; }; - -/** - Handle to a FreeImage tag -*/ -FI_STRUCT (FITAG) { void *data; }; - -// File IO routines --------------------------------------------------------- - -#ifndef FREEIMAGE_IO -#define FREEIMAGE_IO - -typedef void* fi_handle; -typedef unsigned (DLL_CALLCONV *FI_ReadProc) (void *buffer, unsigned size, unsigned count, fi_handle handle); -typedef unsigned (DLL_CALLCONV *FI_WriteProc) (void *buffer, unsigned size, unsigned count, fi_handle handle); -typedef int (DLL_CALLCONV *FI_SeekProc) (fi_handle handle, long offset, int origin); -typedef long (DLL_CALLCONV *FI_TellProc) (fi_handle handle); - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(push, 1) -#else -#pragma pack(1) -#endif // WIN32 - -FI_STRUCT(FreeImageIO) { - FI_ReadProc read_proc; // pointer to the function used to read data - FI_WriteProc write_proc; // pointer to the function used to write data - FI_SeekProc seek_proc; // pointer to the function used to seek - FI_TellProc tell_proc; // pointer to the function used to aquire the current position -}; - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(pop) -#else -#pragma pack() -#endif // WIN32 - -/** -Handle to a memory I/O stream -*/ -FI_STRUCT (FIMEMORY) { void *data; }; - -#endif // FREEIMAGE_IO - -// Plugin routines ---------------------------------------------------------- - -#ifndef PLUGINS -#define PLUGINS - -typedef const char *(DLL_CALLCONV *FI_FormatProc)(void); -typedef const char *(DLL_CALLCONV *FI_DescriptionProc)(void); -typedef const char *(DLL_CALLCONV *FI_ExtensionListProc)(void); -typedef const char *(DLL_CALLCONV *FI_RegExprProc)(void); -typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read); -typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data); -typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data); -typedef int (DLL_CALLCONV *FI_PageCapabilityProc)(FreeImageIO *io, fi_handle handle, void *data); -typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data); -typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data); -typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle); -typedef const char *(DLL_CALLCONV *FI_MimeProc)(void); -typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp); -typedef BOOL (DLL_CALLCONV *FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE type); -typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)(void); - -FI_STRUCT (Plugin) { - FI_FormatProc format_proc; - FI_DescriptionProc description_proc; - FI_ExtensionListProc extension_proc; - FI_RegExprProc regexpr_proc; - FI_OpenProc open_proc; - FI_CloseProc close_proc; - FI_PageCountProc pagecount_proc; - FI_PageCapabilityProc pagecapability_proc; - FI_LoadProc load_proc; - FI_SaveProc save_proc; - FI_ValidateProc validate_proc; - FI_MimeProc mime_proc; - FI_SupportsExportBPPProc supports_export_bpp_proc; - FI_SupportsExportTypeProc supports_export_type_proc; - FI_SupportsICCProfilesProc supports_icc_profiles_proc; -}; - -typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id); - -#endif // PLUGINS - - -// Load / Save flag constants ----------------------------------------------- - -#define BMP_DEFAULT 0 -#define BMP_SAVE_RLE 1 -#define CUT_DEFAULT 0 -#define DDS_DEFAULT 0 -#define EXR_DEFAULT 0 // save data as half with piz-based wavelet compression -#define EXR_FLOAT 0x0001 // save data as float instead of as half (not recommended) -#define EXR_NONE 0x0002 // save with no compression -#define EXR_ZIP 0x0004 // save with zlib compression, in blocks of 16 scan lines -#define EXR_PIZ 0x0008 // save with piz-based wavelet compression -#define EXR_PXR24 0x0010 // save with lossy 24-bit float compression -#define EXR_B44 0x0020 // save with lossy 44% float compression - goes to 22% when combined with EXR_LC -#define EXR_LC 0x0040 // save images with one luminance and two chroma channels, rather than as RGB (lossy compression) -#define FAXG3_DEFAULT 0 -#define GIF_DEFAULT 0 -#define GIF_LOAD256 1 // Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color -#define GIF_PLAYBACK 2 // 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading -#define HDR_DEFAULT 0 -#define ICO_DEFAULT 0 -#define ICO_MAKEALPHA 1 // convert to 32bpp and create an alpha channel from the AND-mask when loading -#define IFF_DEFAULT 0 -#define J2K_DEFAULT 0 // save with a 16:1 rate -#define JP2_DEFAULT 0 // save with a 16:1 rate -#define JPEG_DEFAULT 0 // loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420) -#define JPEG_FAST 0x0001 // load the file as fast as possible, sacrificing some quality -#define JPEG_ACCURATE 0x0002 // load the file with the best quality, sacrificing some speed -#define JPEG_CMYK 0x0004 // load separated CMYK "as is" (use | to combine with other load flags) -#define JPEG_EXIFROTATE 0x0008 // load and rotate according to Exif 'Orientation' tag if available -#define JPEG_QUALITYSUPERB 0x80 // save with superb quality (100:1) -#define JPEG_QUALITYGOOD 0x0100 // save with good quality (75:1) -#define JPEG_QUALITYNORMAL 0x0200 // save with normal quality (50:1) -#define JPEG_QUALITYAVERAGE 0x0400 // save with average quality (25:1) -#define JPEG_QUALITYBAD 0x0800 // save with bad quality (10:1) -#define JPEG_PROGRESSIVE 0x2000 // save as a progressive-JPEG (use | to combine with other save flags) -#define JPEG_SUBSAMPLING_411 0x1000 // save with high 4x1 chroma subsampling (4:1:1) -#define JPEG_SUBSAMPLING_420 0x4000 // save with medium 2x2 medium chroma subsampling (4:2:0) - default value -#define JPEG_SUBSAMPLING_422 0x8000 // save with low 2x1 chroma subsampling (4:2:2) -#define JPEG_SUBSAMPLING_444 0x10000 // save with no chroma subsampling (4:4:4) -#define KOALA_DEFAULT 0 -#define LBM_DEFAULT 0 -#define MNG_DEFAULT 0 -#define PCD_DEFAULT 0 -#define PCD_BASE 1 // load the bitmap sized 768 x 512 -#define PCD_BASEDIV4 2 // load the bitmap sized 384 x 256 -#define PCD_BASEDIV16 3 // load the bitmap sized 192 x 128 -#define PCX_DEFAULT 0 -#define PFM_DEFAULT 0 -#define PICT_DEFAULT 0 -#define PNG_DEFAULT 0 -#define PNG_IGNOREGAMMA 1 // loading: avoid gamma correction -#define PNG_Z_BEST_SPEED 0x0001 // save using ZLib level 1 compression flag (default value is 6) -#define PNG_Z_DEFAULT_COMPRESSION 0x0006 // save using ZLib level 6 compression flag (default recommended value) -#define PNG_Z_BEST_COMPRESSION 0x0009 // save using ZLib level 9 compression flag (default value is 6) -#define PNG_Z_NO_COMPRESSION 0x0100 // save without ZLib compression -#define PNG_INTERLACED 0x0200 // save using Adam7 interlacing (use | to combine with other save flags) -#define PNM_DEFAULT 0 -#define PNM_SAVE_RAW 0 // If set the writer saves in RAW format (i.e. P4, P5 or P6) -#define PNM_SAVE_ASCII 1 // If set the writer saves in ASCII format (i.e. P1, P2 or P3) -#define PSD_DEFAULT 0 -#define RAS_DEFAULT 0 -#define RAW_DEFAULT 0 // load the file as linear RGB 48-bit -#define RAW_PREVIEW 1 // try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit -#define RAW_DISPLAY 2 // load the file as RGB 24-bit -#define SGI_DEFAULT 0 -#define TARGA_DEFAULT 0 -#define TARGA_LOAD_RGB888 1 // If set the loader converts RGB555 and ARGB8888 -> RGB888. -#define TIFF_DEFAULT 0 -#define TIFF_CMYK 0x0001 // reads/stores tags for separated CMYK (use | to combine with compression flags) -#define TIFF_PACKBITS 0x0100 // save using PACKBITS compression -#define TIFF_DEFLATE 0x0200 // save using DEFLATE compression (a.k.a. ZLIB compression) -#define TIFF_ADOBE_DEFLATE 0x0400 // save using ADOBE DEFLATE compression -#define TIFF_NONE 0x0800 // save without any compression -#define TIFF_CCITTFAX3 0x1000 // save using CCITT Group 3 fax encoding -#define TIFF_CCITTFAX4 0x2000 // save using CCITT Group 4 fax encoding -#define TIFF_LZW 0x4000 // save using LZW compression -#define TIFF_JPEG 0x8000 // save using JPEG compression -#define WBMP_DEFAULT 0 -#define XBM_DEFAULT 0 -#define XPM_DEFAULT 0 - -// Background filling options --------------------------------------------------------- -// Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas - -#define FI_COLOR_IS_RGB_COLOR 0x00 // RGBQUAD color is a RGB color (contains no valid alpha channel) -#define FI_COLOR_IS_RGBA_COLOR 0x01 // RGBQUAD color is a RGBA color (contains a valid alpha channel) -#define FI_COLOR_FIND_EQUAL_COLOR 0x02 // For palettized images: lookup equal RGB color from palette -#define FI_COLOR_ALPHA_IS_INDEX 0x04 // The color's rgbReserved member (alpha) contains the palette index to be used -#define FI_COLOR_PALETTE_SEARCH_MASK (FI_COLOR_FIND_EQUAL_COLOR | FI_COLOR_ALPHA_IS_INDEX) // No color lookup is performed - - -#ifdef __cplusplus -extern "C" { -#endif - -// Init / Error routines ---------------------------------------------------- - -DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE)); -DLL_API void DLL_CALLCONV FreeImage_DeInitialise(void); - -// Version routines --------------------------------------------------------- - -DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(void); -DLL_API const char *DLL_CALLCONV FreeImage_GetCopyrightMessage(void); - -// Message output functions ------------------------------------------------- - -typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT fif, const char *msg); -typedef void (DLL_CALLCONV *FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT fif, const char *msg); - -DLL_API void DLL_CALLCONV FreeImage_SetOutputMessageStdCall(FreeImage_OutputMessageFunctionStdCall omf); -DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf); -DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...); - -// Allocate / Clone / Unload routines --------------------------------------- - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Allocate(int width, int height, int bpp, unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp FI_DEFAULT(8), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); -DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib); -DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib); - -// Load / Save routines ----------------------------------------------------- - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadU(FREE_IMAGE_FORMAT fif, const wchar_t *filename, int flags FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const wchar_t *filename, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); - -// Memory I/O stream routines ----------------------------------------------- - -DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0)); -DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags FI_DEFAULT(0)); -DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream); -DLL_API BOOL DLL_CALLCONV FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin); -DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes); -DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream); -DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream); -DLL_API FIMULTIBITMAP *DLL_CALLCONV FreeImage_LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0)); - -// Plugin Interface --------------------------------------------------------- - -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterLocalPlugin(FI_InitProc proc_address, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0)); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterExternalPlugin(const char *path, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0)); -DLL_API int DLL_CALLCONV FreeImage_GetFIFCount(void); -DLL_API int DLL_CALLCONV FreeImage_SetPluginEnabled(FREE_IMAGE_FORMAT fif, BOOL enable); -DLL_API int DLL_CALLCONV FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFormat(const char *format); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromMime(const char *mime); -DLL_API const char *DLL_CALLCONV FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif); -DLL_API const char *DLL_CALLCONV FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif); -DLL_API const char *DLL_CALLCONV FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif); -DLL_API const char *DLL_CALLCONV FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif); -DLL_API const char *DLL_CALLCONV FreeImage_GetFIFMimeType(FREE_IMAGE_FORMAT fif); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilename(const char *filename); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilenameU(const wchar_t *filename); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsWriting(FREE_IMAGE_FORMAT fif); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportType(FREE_IMAGE_FORMAT fif, FREE_IMAGE_TYPE type); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif); - -// Multipaging interface ---------------------------------------------------- - -DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmap(FREE_IMAGE_FORMAT fif, const char *filename, BOOL create_new, BOOL read_only, BOOL keep_cache_in_memory FI_DEFAULT(FALSE), int flags FI_DEFAULT(0)); -DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0)); -DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap); -DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data); -DLL_API void DLL_CALLCONV FreeImage_InsertPage(FIMULTIBITMAP *bitmap, int page, FIBITMAP *data); -DLL_API void DLL_CALLCONV FreeImage_DeletePage(FIMULTIBITMAP *bitmap, int page); -DLL_API FIBITMAP * DLL_CALLCONV FreeImage_LockPage(FIMULTIBITMAP *bitmap, int page); -DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *data, BOOL changed); -DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source); -DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count); - -// Filetype request routines ------------------------------------------------ - -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0)); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0)); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0)); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0)); - -// Image type request routine ----------------------------------------------- - -DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib); - -// FreeImage helper routines ------------------------------------------------ - -DLL_API BOOL DLL_CALLCONV FreeImage_IsLittleEndian(void); -DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue); -DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue); - -// Pixel access routines ---------------------------------------------------- - -DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib); -DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline); - -DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); -DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); -DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); -DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); - -// DIB info routines -------------------------------------------------------- - -DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib); -DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib); - -DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib); -DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res); -DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res); - -DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib); -DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(FIBITMAP *dib); -DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(FIBITMAP *dib); - -DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib); - -DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib); -DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib); -DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled); -DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count); -DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib); -DLL_API void DLL_CALLCONV FreeImage_SetTransparentIndex(FIBITMAP *dib, int index); -DLL_API int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib); - -DLL_API BOOL DLL_CALLCONV FreeImage_HasBackgroundColor(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor); -DLL_API BOOL DLL_CALLCONV FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor); - - -// ICC profile routines ----------------------------------------------------- - -DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib); -DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size); -DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib); - -// Line conversion routines ------------------------------------------------- - -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels); - -// Smart conversion routines ------------------------------------------------ - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo4Bits(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo8Bits(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToGreyscale(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits555(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits565(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo24Bits(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo32Bits(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize FI_DEFAULT(FIQ_WUQUANT), int PaletteSize FI_DEFAULT(256), int ReserveSize FI_DEFAULT(0), RGBQUAD *ReservePalette FI_DEFAULT(NULL)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, BYTE T); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm); - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBits(BYTE *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE)); -DLL_API void DLL_CALLCONV FreeImage_ConvertToRawBits(BYTE *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE)); - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBF(FIBITMAP *dib); - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToStandardType(FIBITMAP *src, BOOL scale_linear FI_DEFAULT(TRUE)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToType(FIBITMAP *src, FREE_IMAGE_TYPE dst_type, BOOL scale_linear FI_DEFAULT(TRUE)); - -// tone mapping operators -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ToneMapping(FIBITMAP *dib, FREE_IMAGE_TMO tmo, double first_param FI_DEFAULT(0), double second_param FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoDrago03(FIBITMAP *src, double gamma FI_DEFAULT(2.2), double exposure FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05Ex(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0), double adaptation FI_DEFAULT(1), double color_correction FI_DEFAULT(0)); - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoFattal02(FIBITMAP *src, double color_saturation FI_DEFAULT(0.5), double attenuation FI_DEFAULT(0.85)); - -// ZLib interface ----------------------------------------------------------- - -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size); - -// -------------------------------------------------------------------------- -// Metadata routines -------------------------------------------------------- -// -------------------------------------------------------------------------- - -// tag creation / destruction -DLL_API FITAG *DLL_CALLCONV FreeImage_CreateTag(void); -DLL_API void DLL_CALLCONV FreeImage_DeleteTag(FITAG *tag); -DLL_API FITAG *DLL_CALLCONV FreeImage_CloneTag(FITAG *tag); - -// tag getters and setters -DLL_API const char *DLL_CALLCONV FreeImage_GetTagKey(FITAG *tag); -DLL_API const char *DLL_CALLCONV FreeImage_GetTagDescription(FITAG *tag); -DLL_API WORD DLL_CALLCONV FreeImage_GetTagID(FITAG *tag); -DLL_API FREE_IMAGE_MDTYPE DLL_CALLCONV FreeImage_GetTagType(FITAG *tag); -DLL_API DWORD DLL_CALLCONV FreeImage_GetTagCount(FITAG *tag); -DLL_API DWORD DLL_CALLCONV FreeImage_GetTagLength(FITAG *tag); -DLL_API const void *DLL_CALLCONV FreeImage_GetTagValue(FITAG *tag); - -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagKey(FITAG *tag, const char *key); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagDescription(FITAG *tag, const char *description); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagID(FITAG *tag, WORD id); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagType(FITAG *tag, FREE_IMAGE_MDTYPE type); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagCount(FITAG *tag, DWORD count); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagLength(FITAG *tag, DWORD length); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagValue(FITAG *tag, const void *value); - -// iterator -DLL_API FIMETADATA *DLL_CALLCONV FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag); -DLL_API BOOL DLL_CALLCONV FreeImage_FindNextMetadata(FIMETADATA *mdhandle, FITAG **tag); -DLL_API void DLL_CALLCONV FreeImage_FindCloseMetadata(FIMETADATA *mdhandle); - -// metadata setter and getter -DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag); -DLL_API BOOL DLL_CALLCONV FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag); - -// helpers -DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src); - -// tag to C string conversion -DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, FITAG *tag, char *Make FI_DEFAULT(NULL)); - -// -------------------------------------------------------------------------- -// Image manipulation toolkit ----------------------------------------------- -// -------------------------------------------------------------------------- - -// rotation and flipping -/// @deprecated see FreeImage_Rotate -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor FI_DEFAULT(NULL)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask); -DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE)); -DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE)); - -// upsampling / downsampling -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pixel_size, BOOL convert FI_DEFAULT(TRUE)); - -// color manipulation routines (point operations) -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel); -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *dib, double gamma); -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *dib, double percentage); -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *dib, double percentage); -DLL_API BOOL DLL_CALLCONV FreeImage_Invert(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *dib, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel FI_DEFAULT(FICC_BLACK)); -DLL_API int DLL_CALLCONV FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contrast, double gamma, BOOL invert); -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustColors(FIBITMAP *dib, double brightness, double contrast, double gamma, BOOL invert FI_DEFAULT(FALSE)); -DLL_API unsigned DLL_CALLCONV FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolors, unsigned count, BOOL ignore_alpha, BOOL swap); -DLL_API unsigned DLL_CALLCONV FreeImage_SwapColors(FIBITMAP *dib, RGBQUAD *color_a, RGBQUAD *color_b, BOOL ignore_alpha); -DLL_API unsigned DLL_CALLCONV FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices, BYTE *dstindices, unsigned count, BOOL swap); -DLL_API unsigned DLL_CALLCONV FreeImage_SwapPaletteIndices(FIBITMAP *dib, BYTE *index_a, BYTE *index_b); - -// channel processing routines -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetChannel(FIBITMAP *dib, FREE_IMAGE_COLOR_CHANNEL channel); -DLL_API BOOL DLL_CALLCONV FreeImage_SetChannel(FIBITMAP *dib, FIBITMAP *dib8, FREE_IMAGE_COLOR_CHANNEL channel); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetComplexChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel); -DLL_API BOOL DLL_CALLCONV FreeImage_SetComplexChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel); - -// copy / paste / composite routines -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Copy(FIBITMAP *dib, int left, int top, int right, int bottom); -DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL)); -DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom); -DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCropU(const wchar_t *src_file, const wchar_t *dst_file, int left, int top, int right, int bottom); -DLL_API BOOL DLL_CALLCONV FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib); - -// background filling routines -DLL_API BOOL DLL_CALLCONV FreeImage_FillBackground(FIBITMAP *dib, const void *color, int options FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_EnlargeCanvas(FIBITMAP *src, int left, int top, int right, int bottom, const void *color, int options FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateEx(int width, int height, int bpp, const RGBQUAD *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, const void *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); - -// miscellaneous algorithms -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle FI_DEFAULT(3)); - -// restore the borland-specific enum size option -#if defined(__BORLANDC__) -#pragma option pop -#endif - -#ifdef __cplusplus -} -#endif - -#endif // FREEIMAGE_H diff --git a/pub/external/include/turbojpeg.h b/pub/external/include/turbojpeg.h deleted file mode 100644 index 9c0a371..0000000 --- a/pub/external/include/turbojpeg.h +++ /dev/null @@ -1,1744 +0,0 @@ -/* - * Copyright (C)2009-2015, 2017 D. R. Commander. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - Neither the name of the libjpeg-turbo Project nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __TURBOJPEG_H__ -#define __TURBOJPEG_H__ - -#if defined(_WIN32) && defined(DLLDEFINE) -#define DLLEXPORT __declspec(dllexport) -#else -#define DLLEXPORT -#endif -#define DLLCALL - - -/** - * @addtogroup TurboJPEG - * TurboJPEG API. This API provides an interface for generating, decoding, and - * transforming planar YUV and JPEG images in memory. - * - * @anchor YUVnotes - * YUV Image Format Notes - * ---------------------- - * Technically, the JPEG format uses the YCbCr colorspace (which is technically - * not a colorspace but a color transform), but per the convention of the - * digital video community, the TurboJPEG API uses "YUV" to refer to an image - * format consisting of Y, Cb, and Cr image planes. - * - * Each plane is simply a 2D array of bytes, each byte representing the value - * of one of the components (Y, Cb, or Cr) at a particular location in the - * image. The width and height of each plane are determined by the image - * width, height, and level of chrominance subsampling. The luminance plane - * width is the image width padded to the nearest multiple of the horizontal - * subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of - * 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane - * height is the image height padded to the nearest multiple of the vertical - * subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 - * or grayscale.) This is irrespective of any additional padding that may be - * specified as an argument to the various YUV functions. The chrominance - * plane width is equal to the luminance plane width divided by the horizontal - * subsampling factor, and the chrominance plane height is equal to the - * luminance plane height divided by the vertical subsampling factor. - * - * For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is - * used, then the luminance plane would be 36 x 35 bytes, and each of the - * chrominance planes would be 18 x 35 bytes. If you specify a line padding of - * 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and - * each of the chrominance planes would be 20 x 35 bytes. - * - * @{ - */ - - -/** - * The number of chrominance subsampling options - */ -#define TJ_NUMSAMP 6 - -/** - * Chrominance subsampling options. - * When pixels are converted from RGB to YCbCr (see #TJCS_YCbCr) or from CMYK - * to YCCK (see #TJCS_YCCK) as part of the JPEG compression process, some of - * the Cb and Cr (chrominance) components can be discarded or averaged together - * to produce a smaller image with little perceptible loss of image clarity - * (the human eye is more sensitive to small changes in brightness than to - * small changes in color.) This is called "chrominance subsampling". - */ -enum TJSAMP { - /** - * 4:4:4 chrominance subsampling (no chrominance subsampling). The JPEG or - * YUV image will contain one chrominance component for every pixel in the - * source image. - */ - TJSAMP_444 = 0, - /** - * 4:2:2 chrominance subsampling. The JPEG or YUV image will contain one - * chrominance component for every 2x1 block of pixels in the source image. - */ - TJSAMP_422, - /** - * 4:2:0 chrominance subsampling. The JPEG or YUV image will contain one - * chrominance component for every 2x2 block of pixels in the source image. - */ - TJSAMP_420, - /** - * Grayscale. The JPEG or YUV image will contain no chrominance components. - */ - TJSAMP_GRAY, - /** - * 4:4:0 chrominance subsampling. The JPEG or YUV image will contain one - * chrominance component for every 1x2 block of pixels in the source image. - * - * @note 4:4:0 subsampling is not fully accelerated in libjpeg-turbo. - */ - TJSAMP_440, - /** - * 4:1:1 chrominance subsampling. The JPEG or YUV image will contain one - * chrominance component for every 4x1 block of pixels in the source image. - * JPEG images compressed with 4:1:1 subsampling will be almost exactly the - * same size as those compressed with 4:2:0 subsampling, and in the - * aggregate, both subsampling methods produce approximately the same - * perceptual quality. However, 4:1:1 is better able to reproduce sharp - * horizontal features. - * - * @note 4:1:1 subsampling is not fully accelerated in libjpeg-turbo. - */ - TJSAMP_411 -}; - -/** - * MCU block width (in pixels) for a given level of chrominance subsampling. - * MCU block sizes: - * - 8x8 for no subsampling or grayscale - * - 16x8 for 4:2:2 - * - 8x16 for 4:4:0 - * - 16x16 for 4:2:0 - * - 32x8 for 4:1:1 - */ -static const int tjMCUWidth[TJ_NUMSAMP] = { 8, 16, 16, 8, 8, 32 }; - -/** - * MCU block height (in pixels) for a given level of chrominance subsampling. - * MCU block sizes: - * - 8x8 for no subsampling or grayscale - * - 16x8 for 4:2:2 - * - 8x16 for 4:4:0 - * - 16x16 for 4:2:0 - * - 32x8 for 4:1:1 - */ -static const int tjMCUHeight[TJ_NUMSAMP] = { 8, 8, 16, 8, 16, 8 }; - - -/** - * The number of pixel formats - */ -#define TJ_NUMPF 12 - -/** - * Pixel formats - */ -enum TJPF { - /** - * RGB pixel format. The red, green, and blue components in the image are - * stored in 3-byte pixels in the order R, G, B from lowest to highest byte - * address within each pixel. - */ - TJPF_RGB = 0, - /** - * BGR pixel format. The red, green, and blue components in the image are - * stored in 3-byte pixels in the order B, G, R from lowest to highest byte - * address within each pixel. - */ - TJPF_BGR, - /** - * RGBX pixel format. The red, green, and blue components in the image are - * stored in 4-byte pixels in the order R, G, B from lowest to highest byte - * address within each pixel. The X component is ignored when compressing - * and undefined when decompressing. - */ - TJPF_RGBX, - /** - * BGRX pixel format. The red, green, and blue components in the image are - * stored in 4-byte pixels in the order B, G, R from lowest to highest byte - * address within each pixel. The X component is ignored when compressing - * and undefined when decompressing. - */ - TJPF_BGRX, - /** - * XBGR pixel format. The red, green, and blue components in the image are - * stored in 4-byte pixels in the order R, G, B from highest to lowest byte - * address within each pixel. The X component is ignored when compressing - * and undefined when decompressing. - */ - TJPF_XBGR, - /** - * XRGB pixel format. The red, green, and blue components in the image are - * stored in 4-byte pixels in the order B, G, R from highest to lowest byte - * address within each pixel. The X component is ignored when compressing - * and undefined when decompressing. - */ - TJPF_XRGB, - /** - * Grayscale pixel format. Each 1-byte pixel represents a luminance - * (brightness) level from 0 to 255. - */ - TJPF_GRAY, - /** - * RGBA pixel format. This is the same as @ref TJPF_RGBX, except that when - * decompressing, the X component is guaranteed to be 0xFF, which can be - * interpreted as an opaque alpha channel. - */ - TJPF_RGBA, - /** - * BGRA pixel format. This is the same as @ref TJPF_BGRX, except that when - * decompressing, the X component is guaranteed to be 0xFF, which can be - * interpreted as an opaque alpha channel. - */ - TJPF_BGRA, - /** - * ABGR pixel format. This is the same as @ref TJPF_XBGR, except that when - * decompressing, the X component is guaranteed to be 0xFF, which can be - * interpreted as an opaque alpha channel. - */ - TJPF_ABGR, - /** - * ARGB pixel format. This is the same as @ref TJPF_XRGB, except that when - * decompressing, the X component is guaranteed to be 0xFF, which can be - * interpreted as an opaque alpha channel. - */ - TJPF_ARGB, - /** - * CMYK pixel format. Unlike RGB, which is an additive color model used - * primarily for display, CMYK (Cyan/Magenta/Yellow/Key) is a subtractive - * color model used primarily for printing. In the CMYK color model, the - * value of each color component typically corresponds to an amount of cyan, - * magenta, yellow, or black ink that is applied to a white background. In - * order to convert between CMYK and RGB, it is necessary to use a color - * management system (CMS.) A CMS will attempt to map colors within the - * printer's gamut to perceptually similar colors in the display's gamut and - * vice versa, but the mapping is typically not 1:1 or reversible, nor can it - * be defined with a simple formula. Thus, such a conversion is out of scope - * for a codec library. However, the TurboJPEG API allows for compressing - * CMYK pixels into a YCCK JPEG image (see #TJCS_YCCK) and decompressing YCCK - * JPEG images into CMYK pixels. - */ - TJPF_CMYK, - /** - * Unknown pixel format. Currently this is only used by #tjLoadImage(). - */ - TJPF_UNKNOWN = -1 -}; - -/** - * Red offset (in bytes) for a given pixel format. This specifies the number - * of bytes that the red component is offset from the start of the pixel. For - * instance, if a pixel of format TJ_BGRX is stored in char pixel[], - * then the red component will be pixel[tjRedOffset[TJ_BGRX]]. This - * will be -1 if the pixel format does not have a red component. - */ -static const int tjRedOffset[TJ_NUMPF] = { - 0, 2, 0, 2, 3, 1, -1, 0, 2, 3, 1, -1 -}; -/** - * Green offset (in bytes) for a given pixel format. This specifies the number - * of bytes that the green component is offset from the start of the pixel. - * For instance, if a pixel of format TJ_BGRX is stored in - * char pixel[], then the green component will be - * pixel[tjGreenOffset[TJ_BGRX]]. This will be -1 if the pixel format - * does not have a green component. - */ -static const int tjGreenOffset[TJ_NUMPF] = { - 1, 1, 1, 1, 2, 2, -1, 1, 1, 2, 2, -1 -}; -/** - * Blue offset (in bytes) for a given pixel format. This specifies the number - * of bytes that the Blue component is offset from the start of the pixel. For - * instance, if a pixel of format TJ_BGRX is stored in char pixel[], - * then the blue component will be pixel[tjBlueOffset[TJ_BGRX]]. This - * will be -1 if the pixel format does not have a blue component. - */ -static const int tjBlueOffset[TJ_NUMPF] = { - 2, 0, 2, 0, 1, 3, -1, 2, 0, 1, 3, -1 -}; -/** - * Alpha offset (in bytes) for a given pixel format. This specifies the number - * of bytes that the Alpha component is offset from the start of the pixel. - * For instance, if a pixel of format TJ_BGRA is stored in - * char pixel[], then the alpha component will be - * pixel[tjAlphaOffset[TJ_BGRA]]. This will be -1 if the pixel format - * does not have an alpha component. - */ -static const int tjAlphaOffset[TJ_NUMPF] = { - -1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1 -}; -/** - * Pixel size (in bytes) for a given pixel format - */ -static const int tjPixelSize[TJ_NUMPF] = { - 3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4 -}; - - -/** - * The number of JPEG colorspaces - */ -#define TJ_NUMCS 5 - -/** - * JPEG colorspaces - */ -enum TJCS { - /** - * RGB colorspace. When compressing the JPEG image, the R, G, and B - * components in the source image are reordered into image planes, but no - * colorspace conversion or subsampling is performed. RGB JPEG images can be - * decompressed to any of the extended RGB pixel formats or grayscale, but - * they cannot be decompressed to YUV images. - */ - TJCS_RGB = 0, - /** - * YCbCr colorspace. YCbCr is not an absolute colorspace but rather a - * mathematical transformation of RGB designed solely for storage and - * transmission. YCbCr images must be converted to RGB before they can - * actually be displayed. In the YCbCr colorspace, the Y (luminance) - * component represents the black & white portion of the original image, and - * the Cb and Cr (chrominance) components represent the color portion of the - * original image. Originally, the analog equivalent of this transformation - * allowed the same signal to drive both black & white and color televisions, - * but JPEG images use YCbCr primarily because it allows the color data to be - * optionally subsampled for the purposes of reducing bandwidth or disk - * space. YCbCr is the most common JPEG colorspace, and YCbCr JPEG images - * can be compressed from and decompressed to any of the extended RGB pixel - * formats or grayscale, or they can be decompressed to YUV planar images. - */ - TJCS_YCbCr, - /** - * Grayscale colorspace. The JPEG image retains only the luminance data (Y - * component), and any color data from the source image is discarded. - * Grayscale JPEG images can be compressed from and decompressed to any of - * the extended RGB pixel formats or grayscale, or they can be decompressed - * to YUV planar images. - */ - TJCS_GRAY, - /** - * CMYK colorspace. When compressing the JPEG image, the C, M, Y, and K - * components in the source image are reordered into image planes, but no - * colorspace conversion or subsampling is performed. CMYK JPEG images can - * only be decompressed to CMYK pixels. - */ - TJCS_CMYK, - /** - * YCCK colorspace. YCCK (AKA "YCbCrK") is not an absolute colorspace but - * rather a mathematical transformation of CMYK designed solely for storage - * and transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be - * reversibly transformed into YCCK, and as with YCbCr, the chrominance - * components in the YCCK pixels can be subsampled without incurring major - * perceptual loss. YCCK JPEG images can only be compressed from and - * decompressed to CMYK pixels. - */ - TJCS_YCCK -}; - - -/** - * The uncompressed source/destination image is stored in bottom-up (Windows, - * OpenGL) order, not top-down (X11) order. - */ -#define TJFLAG_BOTTOMUP 2 -/** - * When decompressing an image that was compressed using chrominance - * subsampling, use the fastest chrominance upsampling algorithm available in - * the underlying codec. The default is to use smooth upsampling, which - * creates a smooth transition between neighboring chrominance components in - * order to reduce upsampling artifacts in the decompressed image. - */ -#define TJFLAG_FASTUPSAMPLE 256 -/** - * Disable buffer (re)allocation. If passed to one of the JPEG compression or - * transform functions, this flag will cause those functions to generate an - * error if the JPEG image buffer is invalid or too small rather than - * attempting to allocate or reallocate that buffer. This reproduces the - * behavior of earlier versions of TurboJPEG. - */ -#define TJFLAG_NOREALLOC 1024 -/** - * Use the fastest DCT/IDCT algorithm available in the underlying codec. The - * default if this flag is not specified is implementation-specific. For - * example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast - * algorithm by default when compressing, because this has been shown to have - * only a very slight effect on accuracy, but it uses the accurate algorithm - * when decompressing, because this has been shown to have a larger effect. - */ -#define TJFLAG_FASTDCT 2048 -/** - * Use the most accurate DCT/IDCT algorithm available in the underlying codec. - * The default if this flag is not specified is implementation-specific. For - * example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast - * algorithm by default when compressing, because this has been shown to have - * only a very slight effect on accuracy, but it uses the accurate algorithm - * when decompressing, because this has been shown to have a larger effect. - */ -#define TJFLAG_ACCURATEDCT 4096 -/** - * Immediately discontinue the current compression/decompression/transform - * operation if the underlying codec throws a warning (non-fatal error). The - * default behavior is to allow the operation to complete unless a fatal error - * is encountered. - */ -#define TJFLAG_STOPONWARNING 8192 -/** - * Use progressive entropy coding in JPEG images generated by the compression - * and transform functions. Progressive entropy coding will generally improve - * compression relative to baseline entropy coding (the default), but it will - * reduce compression and decompression performance considerably. - */ -#define TJFLAG_PROGRESSIVE 16384 - - -/** - * The number of error codes - */ -#define TJ_NUMERR 2 - -/** - * Error codes - */ -enum TJERR { - /** - * The error was non-fatal and recoverable, but the image may still be - * corrupt. - */ - TJERR_WARNING = 0, - /** - * The error was fatal and non-recoverable. - */ - TJERR_FATAL -}; - - -/** - * The number of transform operations - */ -#define TJ_NUMXOP 8 - -/** - * Transform operations for #tjTransform() - */ -enum TJXOP { - /** - * Do not transform the position of the image pixels - */ - TJXOP_NONE = 0, - /** - * Flip (mirror) image horizontally. This transform is imperfect if there - * are any partial MCU blocks on the right edge (see #TJXOPT_PERFECT.) - */ - TJXOP_HFLIP, - /** - * Flip (mirror) image vertically. This transform is imperfect if there are - * any partial MCU blocks on the bottom edge (see #TJXOPT_PERFECT.) - */ - TJXOP_VFLIP, - /** - * Transpose image (flip/mirror along upper left to lower right axis.) This - * transform is always perfect. - */ - TJXOP_TRANSPOSE, - /** - * Transverse transpose image (flip/mirror along upper right to lower left - * axis.) This transform is imperfect if there are any partial MCU blocks in - * the image (see #TJXOPT_PERFECT.) - */ - TJXOP_TRANSVERSE, - /** - * Rotate image clockwise by 90 degrees. This transform is imperfect if - * there are any partial MCU blocks on the bottom edge (see - * #TJXOPT_PERFECT.) - */ - TJXOP_ROT90, - /** - * Rotate image 180 degrees. This transform is imperfect if there are any - * partial MCU blocks in the image (see #TJXOPT_PERFECT.) - */ - TJXOP_ROT180, - /** - * Rotate image counter-clockwise by 90 degrees. This transform is imperfect - * if there are any partial MCU blocks on the right edge (see - * #TJXOPT_PERFECT.) - */ - TJXOP_ROT270 -}; - - -/** - * This option will cause #tjTransform() to return an error if the transform is - * not perfect. Lossless transforms operate on MCU blocks, whose size depends - * on the level of chrominance subsampling used (see #tjMCUWidth - * and #tjMCUHeight.) If the image's width or height is not evenly divisible - * by the MCU block size, then there will be partial MCU blocks on the right - * and/or bottom edges. It is not possible to move these partial MCU blocks to - * the top or left of the image, so any transform that would require that is - * "imperfect." If this option is not specified, then any partial MCU blocks - * that cannot be transformed will be left in place, which will create - * odd-looking strips on the right or bottom edge of the image. - */ -#define TJXOPT_PERFECT 1 -/** - * This option will cause #tjTransform() to discard any partial MCU blocks that - * cannot be transformed. - */ -#define TJXOPT_TRIM 2 -/** - * This option will enable lossless cropping. See #tjTransform() for more - * information. - */ -#define TJXOPT_CROP 4 -/** - * This option will discard the color data in the input image and produce - * a grayscale output image. - */ -#define TJXOPT_GRAY 8 -/** - * This option will prevent #tjTransform() from outputting a JPEG image for - * this particular transform (this can be used in conjunction with a custom - * filter to capture the transformed DCT coefficients without transcoding - * them.) - */ -#define TJXOPT_NOOUTPUT 16 -/** - * This option will enable progressive entropy coding in the output image - * generated by this particular transform. Progressive entropy coding will - * generally improve compression relative to baseline entropy coding (the - * default), but it will reduce compression and decompression performance - * considerably. - */ -#define TJXOPT_PROGRESSIVE 32 -/** - * This option will prevent #tjTransform() from copying any extra markers - * (including EXIF and ICC profile data) from the source image to the output - * image. - */ -#define TJXOPT_COPYNONE 64 - - -/** - * Scaling factor - */ -typedef struct { - /** - * Numerator - */ - int num; - /** - * Denominator - */ - int denom; -} tjscalingfactor; - -/** - * Cropping region - */ -typedef struct { - /** - * The left boundary of the cropping region. This must be evenly divisible - * by the MCU block width (see #tjMCUWidth.) - */ - int x; - /** - * The upper boundary of the cropping region. This must be evenly divisible - * by the MCU block height (see #tjMCUHeight.) - */ - int y; - /** - * The width of the cropping region. Setting this to 0 is the equivalent of - * setting it to the width of the source JPEG image - x. - */ - int w; - /** - * The height of the cropping region. Setting this to 0 is the equivalent of - * setting it to the height of the source JPEG image - y. - */ - int h; -} tjregion; - -/** - * Lossless transform - */ -typedef struct tjtransform { - /** - * Cropping region - */ - tjregion r; - /** - * One of the @ref TJXOP "transform operations" - */ - int op; - /** - * The bitwise OR of one of more of the @ref TJXOPT_CROP "transform options" - */ - int options; - /** - * Arbitrary data that can be accessed within the body of the callback - * function - */ - void *data; - /** - * A callback function that can be used to modify the DCT coefficients - * after they are losslessly transformed but before they are transcoded to a - * new JPEG image. This allows for custom filters or other transformations - * to be applied in the frequency domain. - * - * @param coeffs pointer to an array of transformed DCT coefficients. (NOTE: - * this pointer is not guaranteed to be valid once the callback returns, so - * applications wishing to hand off the DCT coefficients to another function - * or library should make a copy of them within the body of the callback.) - * - * @param arrayRegion #tjregion structure containing the width and height of - * the array pointed to by coeffs as well as its offset relative to - * the component plane. TurboJPEG implementations may choose to split each - * component plane into multiple DCT coefficient arrays and call the callback - * function once for each array. - * - * @param planeRegion #tjregion structure containing the width and height of - * the component plane to which coeffs belongs - * - * @param componentID ID number of the component plane to which - * coeffs belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, - * and 2 in typical JPEG images.) - * - * @param transformID ID number of the transformed image to which - * coeffs belongs. This is the same as the index of the transform - * in the transforms array that was passed to #tjTransform(). - * - * @param transform a pointer to a #tjtransform structure that specifies the - * parameters and/or cropping region for this transform - * - * @return 0 if the callback was successful, or -1 if an error occurred. - */ - int (*customFilter) (short *coeffs, tjregion arrayRegion, - tjregion planeRegion, int componentIndex, - int transformIndex, struct tjtransform *transform); -} tjtransform; - -/** - * TurboJPEG instance handle - */ -typedef void *tjhandle; - - -/** - * Pad the given width to the nearest 32-bit boundary - */ -#define TJPAD(width) (((width) + 3) & (~3)) - -/** - * Compute the scaled value of dimension using the given scaling - * factor. This macro performs the integer equivalent of ceil(dimension * - * scalingFactor). - */ -#define TJSCALED(dimension, scalingFactor) \ - ((dimension * scalingFactor.num + scalingFactor.denom - 1) / \ - scalingFactor.denom) - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Create a TurboJPEG compressor instance. - * - * @return a handle to the newly-created instance, or NULL if an error - * occurred (see #tjGetErrorStr2().) - */ -DLLEXPORT tjhandle tjInitCompress(void); - - -/** - * Compress an RGB, grayscale, or CMYK image into a JPEG image. - * - * @param handle a handle to a TurboJPEG compressor or transformer instance - * - * @param srcBuf pointer to an image buffer containing RGB, grayscale, or - * CMYK pixels to be compressed - * - * @param width width (in pixels) of the source image - * - * @param pitch bytes per line in the source image. Normally, this should be - * width * #tjPixelSize[pixelFormat] if the image is unpadded, or - * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image - * is padded to the nearest 32-bit boundary, as is the case for Windows - * bitmaps. You can also be clever and use this parameter to skip lines, etc. - * Setting this parameter to 0 is the equivalent of setting it to - * width * #tjPixelSize[pixelFormat]. - * - * @param height height (in pixels) of the source image - * - * @param pixelFormat pixel format of the source image (see @ref TJPF - * "Pixel formats".) - * - * @param jpegBuf address of a pointer to an image buffer that will receive the - * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer - * to accommodate the size of the JPEG image. Thus, you can choose to: - * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and - * let TurboJPEG grow the buffer as needed, - * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer - * for you, or - * -# pre-allocate the buffer to a "worst case" size determined by calling - * #tjBufSize(). This should ensure that the buffer never has to be - * re-allocated (setting #TJFLAG_NOREALLOC guarantees that it won't be.) - * . - * If you choose option 1, *jpegSize should be set to the size of your - * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, - * you should always check *jpegBuf upon return from this function, as - * it may have changed. - * - * @param jpegSize pointer to an unsigned long variable that holds the size of - * the JPEG image buffer. If *jpegBuf points to a pre-allocated - * buffer, then *jpegSize should be set to the size of the buffer. - * Upon return, *jpegSize will contain the size of the JPEG image (in - * bytes.) If *jpegBuf points to a JPEG image buffer that is being - * reused from a previous call to one of the JPEG compression functions, then - * *jpegSize is ignored. - * - * @param jpegSubsamp the level of chrominance subsampling to be used when - * generating the JPEG image (see @ref TJSAMP - * "Chrominance subsampling options".) - * - * @param jpegQual the image quality of the generated JPEG image (1 = worst, - * 100 = best) - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT - * "flags" - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() - * and #tjGetErrorCode().) -*/ -DLLEXPORT int tjCompress2(tjhandle handle, const unsigned char *srcBuf, - int width, int pitch, int height, int pixelFormat, - unsigned char **jpegBuf, unsigned long *jpegSize, - int jpegSubsamp, int jpegQual, int flags); - - -/** - * Compress a YUV planar image into a JPEG image. - * - * @param handle a handle to a TurboJPEG compressor or transformer instance - * - * @param srcBuf pointer to an image buffer containing a YUV planar image to be - * compressed. The size of this buffer should match the value returned by - * #tjBufSizeYUV2() for the given image width, height, padding, and level of - * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be - * stored sequentially in the source buffer (refer to @ref YUVnotes - * "YUV Image Format Notes".) - * - * @param width width (in pixels) of the source image. If the width is not an - * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate - * buffer copy will be performed within TurboJPEG. - * - * @param pad the line padding used in the source image. For instance, if each - * line in each plane of the YUV image is padded to the nearest multiple of 4 - * bytes, then pad should be set to 4. - * - * @param height height (in pixels) of the source image. If the height is not - * an even multiple of the MCU block height (see #tjMCUHeight), then an - * intermediate buffer copy will be performed within TurboJPEG. - * - * @param subsamp the level of chrominance subsampling used in the source - * image (see @ref TJSAMP "Chrominance subsampling options".) - * - * @param jpegBuf address of a pointer to an image buffer that will receive the - * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to - * accommodate the size of the JPEG image. Thus, you can choose to: - * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and - * let TurboJPEG grow the buffer as needed, - * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer - * for you, or - * -# pre-allocate the buffer to a "worst case" size determined by calling - * #tjBufSize(). This should ensure that the buffer never has to be - * re-allocated (setting #TJFLAG_NOREALLOC guarantees that it won't be.) - * . - * If you choose option 1, *jpegSize should be set to the size of your - * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, - * you should always check *jpegBuf upon return from this function, as - * it may have changed. - * - * @param jpegSize pointer to an unsigned long variable that holds the size of - * the JPEG image buffer. If *jpegBuf points to a pre-allocated - * buffer, then *jpegSize should be set to the size of the buffer. - * Upon return, *jpegSize will contain the size of the JPEG image (in - * bytes.) If *jpegBuf points to a JPEG image buffer that is being - * reused from a previous call to one of the JPEG compression functions, then - * *jpegSize is ignored. - * - * @param jpegQual the image quality of the generated JPEG image (1 = worst, - * 100 = best) - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT - * "flags" - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() - * and #tjGetErrorCode().) -*/ -DLLEXPORT int tjCompressFromYUV(tjhandle handle, const unsigned char *srcBuf, - int width, int pad, int height, int subsamp, - unsigned char **jpegBuf, - unsigned long *jpegSize, int jpegQual, - int flags); - - -/** - * Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. - * - * @param handle a handle to a TurboJPEG compressor or transformer instance - * - * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes - * (or just a Y plane, if compressing a grayscale image) that contain a YUV - * image to be compressed. These planes can be contiguous or non-contiguous in - * memory. The size of each plane should match the value returned by - * #tjPlaneSizeYUV() for the given image width, height, strides, and level of - * chrominance subsampling. Refer to @ref YUVnotes "YUV Image Format Notes" - * for more details. - * - * @param width width (in pixels) of the source image. If the width is not an - * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate - * buffer copy will be performed within TurboJPEG. - * - * @param strides an array of integers, each specifying the number of bytes per - * line in the corresponding plane of the YUV source image. Setting the stride - * for any plane to 0 is the same as setting it to the plane width (see - * @ref YUVnotes "YUV Image Format Notes".) If strides is NULL, then - * the strides for all planes will be set to their respective plane widths. - * You can adjust the strides in order to specify an arbitrary amount of line - * padding in each plane or to create a JPEG image from a subregion of a larger - * YUV planar image. - * - * @param height height (in pixels) of the source image. If the height is not - * an even multiple of the MCU block height (see #tjMCUHeight), then an - * intermediate buffer copy will be performed within TurboJPEG. - * - * @param subsamp the level of chrominance subsampling used in the source - * image (see @ref TJSAMP "Chrominance subsampling options".) - * - * @param jpegBuf address of a pointer to an image buffer that will receive the - * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to - * accommodate the size of the JPEG image. Thus, you can choose to: - * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and - * let TurboJPEG grow the buffer as needed, - * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer - * for you, or - * -# pre-allocate the buffer to a "worst case" size determined by calling - * #tjBufSize(). This should ensure that the buffer never has to be - * re-allocated (setting #TJFLAG_NOREALLOC guarantees that it won't be.) - * . - * If you choose option 1, *jpegSize should be set to the size of your - * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, - * you should always check *jpegBuf upon return from this function, as - * it may have changed. - * - * @param jpegSize pointer to an unsigned long variable that holds the size of - * the JPEG image buffer. If *jpegBuf points to a pre-allocated - * buffer, then *jpegSize should be set to the size of the buffer. - * Upon return, *jpegSize will contain the size of the JPEG image (in - * bytes.) If *jpegBuf points to a JPEG image buffer that is being - * reused from a previous call to one of the JPEG compression functions, then - * *jpegSize is ignored. - * - * @param jpegQual the image quality of the generated JPEG image (1 = worst, - * 100 = best) - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT - * "flags" - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() - * and #tjGetErrorCode().) -*/ -DLLEXPORT int tjCompressFromYUVPlanes(tjhandle handle, - const unsigned char **srcPlanes, - int width, const int *strides, - int height, int subsamp, - unsigned char **jpegBuf, - unsigned long *jpegSize, int jpegQual, - int flags); - - -/** - * The maximum size of the buffer (in bytes) required to hold a JPEG image with - * the given parameters. The number of bytes returned by this function is - * larger than the size of the uncompressed source image. The reason for this - * is that the JPEG format uses 16-bit coefficients, and it is thus possible - * for a very high-quality JPEG image with very high-frequency content to - * expand rather than compress when converted to the JPEG format. Such images - * represent a very rare corner case, but since there is no way to predict the - * size of a JPEG image prior to compression, the corner case has to be - * handled. - * - * @param width width (in pixels) of the image - * - * @param height height (in pixels) of the image - * - * @param jpegSubsamp the level of chrominance subsampling to be used when - * generating the JPEG image (see @ref TJSAMP - * "Chrominance subsampling options".) - * - * @return the maximum size of the buffer (in bytes) required to hold the - * image, or -1 if the arguments are out of bounds. - */ -DLLEXPORT unsigned long tjBufSize(int width, int height, int jpegSubsamp); - - -/** - * The size of the buffer (in bytes) required to hold a YUV planar image with - * the given parameters. - * - * @param width width (in pixels) of the image - * - * @param pad the width of each line in each plane of the image is padded to - * the nearest multiple of this number of bytes (must be a power of 2.) - * - * @param height height (in pixels) of the image - * - * @param subsamp level of chrominance subsampling in the image (see - * @ref TJSAMP "Chrominance subsampling options".) - * - * @return the size of the buffer (in bytes) required to hold the image, or - * -1 if the arguments are out of bounds. - */ -DLLEXPORT unsigned long tjBufSizeYUV2(int width, int pad, int height, - int subsamp); - - -/** - * The size of the buffer (in bytes) required to hold a YUV image plane with - * the given parameters. - * - * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) - * - * @param width width (in pixels) of the YUV image. NOTE: this is the width of - * the whole image, not the plane width. - * - * @param stride bytes per line in the image plane. Setting this to 0 is the - * equivalent of setting it to the plane width. - * - * @param height height (in pixels) of the YUV image. NOTE: this is the height - * of the whole image, not the plane height. - * - * @param subsamp level of chrominance subsampling in the image (see - * @ref TJSAMP "Chrominance subsampling options".) - * - * @return the size of the buffer (in bytes) required to hold the YUV image - * plane, or -1 if the arguments are out of bounds. - */ -DLLEXPORT unsigned long tjPlaneSizeYUV(int componentID, int width, int stride, - int height, int subsamp); - - -/** - * The plane width of a YUV image plane with the given parameters. Refer to - * @ref YUVnotes "YUV Image Format Notes" for a description of plane width. - * - * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) - * - * @param width width (in pixels) of the YUV image - * - * @param subsamp level of chrominance subsampling in the image (see - * @ref TJSAMP "Chrominance subsampling options".) - * - * @return the plane width of a YUV image plane with the given parameters, or - * -1 if the arguments are out of bounds. - */ -DLLEXPORT int tjPlaneWidth(int componentID, int width, int subsamp); - - -/** - * The plane height of a YUV image plane with the given parameters. Refer to - * @ref YUVnotes "YUV Image Format Notes" for a description of plane height. - * - * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) - * - * @param height height (in pixels) of the YUV image - * - * @param subsamp level of chrominance subsampling in the image (see - * @ref TJSAMP "Chrominance subsampling options".) - * - * @return the plane height of a YUV image plane with the given parameters, or - * -1 if the arguments are out of bounds. - */ -DLLEXPORT int tjPlaneHeight(int componentID, int height, int subsamp); - - -/** - * Encode an RGB or grayscale image into a YUV planar image. This function - * uses the accelerated color conversion routines in the underlying - * codec but does not execute any of the other steps in the JPEG compression - * process. - * - * @param handle a handle to a TurboJPEG compressor or transformer instance - * - * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels - * to be encoded - * - * @param width width (in pixels) of the source image - * - * @param pitch bytes per line in the source image. Normally, this should be - * width * #tjPixelSize[pixelFormat] if the image is unpadded, or - * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image - * is padded to the nearest 32-bit boundary, as is the case for Windows - * bitmaps. You can also be clever and use this parameter to skip lines, etc. - * Setting this parameter to 0 is the equivalent of setting it to - * width * #tjPixelSize[pixelFormat]. - * - * @param height height (in pixels) of the source image - * - * @param pixelFormat pixel format of the source image (see @ref TJPF - * "Pixel formats".) - * - * @param dstBuf pointer to an image buffer that will receive the YUV image. - * Use #tjBufSizeYUV2() to determine the appropriate size for this buffer based - * on the image width, height, padding, and level of chrominance subsampling. - * The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the - * buffer (refer to @ref YUVnotes "YUV Image Format Notes".) - * - * @param pad the width of each line in each plane of the YUV image will be - * padded to the nearest multiple of this number of bytes (must be a power of - * 2.) To generate images suitable for X Video, pad should be set to - * 4. - * - * @param subsamp the level of chrominance subsampling to be used when - * generating the YUV image (see @ref TJSAMP - * "Chrominance subsampling options".) To generate images suitable for X - * Video, subsamp should be set to @ref TJSAMP_420. This produces an - * image compatible with the I420 (AKA "YUV420P") format. - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT - * "flags" - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() - * and #tjGetErrorCode().) -*/ -DLLEXPORT int tjEncodeYUV3(tjhandle handle, const unsigned char *srcBuf, - int width, int pitch, int height, int pixelFormat, - unsigned char *dstBuf, int pad, int subsamp, - int flags); - - -/** - * Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image - * planes. This function uses the accelerated color conversion routines in the - * underlying codec but does not execute any of the other steps in the JPEG - * compression process. - * - * @param handle a handle to a TurboJPEG compressor or transformer instance - * - * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels - * to be encoded - * - * @param width width (in pixels) of the source image - * - * @param pitch bytes per line in the source image. Normally, this should be - * width * #tjPixelSize[pixelFormat] if the image is unpadded, or - * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image - * is padded to the nearest 32-bit boundary, as is the case for Windows - * bitmaps. You can also be clever and use this parameter to skip lines, etc. - * Setting this parameter to 0 is the equivalent of setting it to - * width * #tjPixelSize[pixelFormat]. - * - * @param height height (in pixels) of the source image - * - * @param pixelFormat pixel format of the source image (see @ref TJPF - * "Pixel formats".) - * - * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes - * (or just a Y plane, if generating a grayscale image) that will receive the - * encoded image. These planes can be contiguous or non-contiguous in memory. - * Use #tjPlaneSizeYUV() to determine the appropriate size for each plane based - * on the image width, height, strides, and level of chrominance subsampling. - * Refer to @ref YUVnotes "YUV Image Format Notes" for more details. - * - * @param strides an array of integers, each specifying the number of bytes per - * line in the corresponding plane of the output image. Setting the stride for - * any plane to 0 is the same as setting it to the plane width (see - * @ref YUVnotes "YUV Image Format Notes".) If strides is NULL, then - * the strides for all planes will be set to their respective plane widths. - * You can adjust the strides in order to add an arbitrary amount of line - * padding to each plane or to encode an RGB or grayscale image into a - * subregion of a larger YUV planar image. - * - * @param subsamp the level of chrominance subsampling to be used when - * generating the YUV image (see @ref TJSAMP - * "Chrominance subsampling options".) To generate images suitable for X - * Video, subsamp should be set to @ref TJSAMP_420. This produces an - * image compatible with the I420 (AKA "YUV420P") format. - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT - * "flags" - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() - * and #tjGetErrorCode().) -*/ -DLLEXPORT int tjEncodeYUVPlanes(tjhandle handle, const unsigned char *srcBuf, - int width, int pitch, int height, - int pixelFormat, unsigned char **dstPlanes, - int *strides, int subsamp, int flags); - - -/** - * Create a TurboJPEG decompressor instance. - * - * @return a handle to the newly-created instance, or NULL if an error - * occurred (see #tjGetErrorStr2().) -*/ -DLLEXPORT tjhandle tjInitDecompress(void); - - -/** - * Retrieve information about a JPEG image without decompressing it. - * - * @param handle a handle to a TurboJPEG decompressor or transformer instance - * - * @param jpegBuf pointer to a buffer containing a JPEG image - * - * @param jpegSize size of the JPEG image (in bytes) - * - * @param width pointer to an integer variable that will receive the width (in - * pixels) of the JPEG image - * - * @param height pointer to an integer variable that will receive the height - * (in pixels) of the JPEG image - * - * @param jpegSubsamp pointer to an integer variable that will receive the - * level of chrominance subsampling used when the JPEG image was compressed - * (see @ref TJSAMP "Chrominance subsampling options".) - * - * @param jpegColorspace pointer to an integer variable that will receive one - * of the JPEG colorspace constants, indicating the colorspace of the JPEG - * image (see @ref TJCS "JPEG colorspaces".) - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() - * and #tjGetErrorCode().) -*/ -DLLEXPORT int tjDecompressHeader3(tjhandle handle, - const unsigned char *jpegBuf, - unsigned long jpegSize, int *width, - int *height, int *jpegSubsamp, - int *jpegColorspace); - - -/** - * Returns a list of fractional scaling factors that the JPEG decompressor in - * this implementation of TurboJPEG supports. - * - * @param numscalingfactors pointer to an integer variable that will receive - * the number of elements in the list - * - * @return a pointer to a list of fractional scaling factors, or NULL if an - * error is encountered (see #tjGetErrorStr2().) -*/ -DLLEXPORT tjscalingfactor *tjGetScalingFactors(int *numscalingfactors); - - -/** - * Decompress a JPEG image to an RGB, grayscale, or CMYK image. - * - * @param handle a handle to a TurboJPEG decompressor or transformer instance - * - * @param jpegBuf pointer to a buffer containing the JPEG image to decompress - * - * @param jpegSize size of the JPEG image (in bytes) - * - * @param dstBuf pointer to an image buffer that will receive the decompressed - * image. This buffer should normally be pitch * scaledHeight bytes - * in size, where scaledHeight can be determined by calling - * #TJSCALED() with the JPEG image height and one of the scaling factors - * returned by #tjGetScalingFactors(). The dstBuf pointer may also be - * used to decompress into a specific region of a larger buffer. - * - * @param width desired width (in pixels) of the destination image. If this is - * different than the width of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the largest - * possible image that will fit within the desired width. If width is - * set to 0, then only the height will be considered when determining the - * scaled image size. - * - * @param pitch bytes per line in the destination image. Normally, this is - * scaledWidth * #tjPixelSize[pixelFormat] if the decompressed image - * is unpadded, else #TJPAD(scaledWidth * #tjPixelSize[pixelFormat]) - * if each line of the decompressed image is padded to the nearest 32-bit - * boundary, as is the case for Windows bitmaps. (NOTE: scaledWidth - * can be determined by calling #TJSCALED() with the JPEG image width and one - * of the scaling factors returned by #tjGetScalingFactors().) You can also be - * clever and use the pitch parameter to skip lines, etc. Setting this - * parameter to 0 is the equivalent of setting it to - * scaledWidth * #tjPixelSize[pixelFormat]. - * - * @param height desired height (in pixels) of the destination image. If this - * is different than the height of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the largest - * possible image that will fit within the desired height. If height - * is set to 0, then only the width will be considered when determining the - * scaled image size. - * - * @param pixelFormat pixel format of the destination image (see @ref - * TJPF "Pixel formats".) - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT - * "flags" - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() - * and #tjGetErrorCode().) - */ -DLLEXPORT int tjDecompress2(tjhandle handle, const unsigned char *jpegBuf, - unsigned long jpegSize, unsigned char *dstBuf, - int width, int pitch, int height, int pixelFormat, - int flags); - - -/** - * Decompress a JPEG image to a YUV planar image. This function performs JPEG - * decompression but leaves out the color conversion step, so a planar YUV - * image is generated instead of an RGB image. - * - * @param handle a handle to a TurboJPEG decompressor or transformer instance - * - * @param jpegBuf pointer to a buffer containing the JPEG image to decompress - * - * @param jpegSize size of the JPEG image (in bytes) - * - * @param dstBuf pointer to an image buffer that will receive the YUV image. - * Use #tjBufSizeYUV2() to determine the appropriate size for this buffer based - * on the image width, height, padding, and level of subsampling. The Y, - * U (Cb), and V (Cr) image planes will be stored sequentially in the buffer - * (refer to @ref YUVnotes "YUV Image Format Notes".) - * - * @param width desired width (in pixels) of the YUV image. If this is - * different than the width of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the largest - * possible image that will fit within the desired width. If width is - * set to 0, then only the height will be considered when determining the - * scaled image size. If the scaled width is not an even multiple of the MCU - * block width (see #tjMCUWidth), then an intermediate buffer copy will be - * performed within TurboJPEG. - * - * @param pad the width of each line in each plane of the YUV image will be - * padded to the nearest multiple of this number of bytes (must be a power of - * 2.) To generate images suitable for X Video, pad should be set to - * 4. - * - * @param height desired height (in pixels) of the YUV image. If this is - * different than the height of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the largest - * possible image that will fit within the desired height. If height - * is set to 0, then only the width will be considered when determining the - * scaled image size. If the scaled height is not an even multiple of the MCU - * block height (see #tjMCUHeight), then an intermediate buffer copy will be - * performed within TurboJPEG. - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT - * "flags" - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() - * and #tjGetErrorCode().) - */ -DLLEXPORT int tjDecompressToYUV2(tjhandle handle, const unsigned char *jpegBuf, - unsigned long jpegSize, unsigned char *dstBuf, - int width, int pad, int height, int flags); - - -/** - * Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image - * planes. This function performs JPEG decompression but leaves out the color - * conversion step, so a planar YUV image is generated instead of an RGB image. - * - * @param handle a handle to a TurboJPEG decompressor or transformer instance - * - * @param jpegBuf pointer to a buffer containing the JPEG image to decompress - * - * @param jpegSize size of the JPEG image (in bytes) - * - * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes - * (or just a Y plane, if decompressing a grayscale image) that will receive - * the YUV image. These planes can be contiguous or non-contiguous in memory. - * Use #tjPlaneSizeYUV() to determine the appropriate size for each plane based - * on the scaled image width, scaled image height, strides, and level of - * chrominance subsampling. Refer to @ref YUVnotes "YUV Image Format Notes" - * for more details. - * - * @param width desired width (in pixels) of the YUV image. If this is - * different than the width of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the largest - * possible image that will fit within the desired width. If width is - * set to 0, then only the height will be considered when determining the - * scaled image size. If the scaled width is not an even multiple of the MCU - * block width (see #tjMCUWidth), then an intermediate buffer copy will be - * performed within TurboJPEG. - * - * @param strides an array of integers, each specifying the number of bytes per - * line in the corresponding plane of the output image. Setting the stride for - * any plane to 0 is the same as setting it to the scaled plane width (see - * @ref YUVnotes "YUV Image Format Notes".) If strides is NULL, then - * the strides for all planes will be set to their respective scaled plane - * widths. You can adjust the strides in order to add an arbitrary amount of - * line padding to each plane or to decompress the JPEG image into a subregion - * of a larger YUV planar image. - * - * @param height desired height (in pixels) of the YUV image. If this is - * different than the height of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the largest - * possible image that will fit within the desired height. If height - * is set to 0, then only the width will be considered when determining the - * scaled image size. If the scaled height is not an even multiple of the MCU - * block height (see #tjMCUHeight), then an intermediate buffer copy will be - * performed within TurboJPEG. - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT - * "flags" - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() - * and #tjGetErrorCode().) - */ -DLLEXPORT int tjDecompressToYUVPlanes(tjhandle handle, - const unsigned char *jpegBuf, - unsigned long jpegSize, - unsigned char **dstPlanes, int width, - int *strides, int height, int flags); - - -/** - * Decode a YUV planar image into an RGB or grayscale image. This function - * uses the accelerated color conversion routines in the underlying - * codec but does not execute any of the other steps in the JPEG decompression - * process. - * - * @param handle a handle to a TurboJPEG decompressor or transformer instance - * - * @param srcBuf pointer to an image buffer containing a YUV planar image to be - * decoded. The size of this buffer should match the value returned by - * #tjBufSizeYUV2() for the given image width, height, padding, and level of - * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be - * stored sequentially in the source buffer (refer to @ref YUVnotes - * "YUV Image Format Notes".) - * - * @param pad Use this parameter to specify that the width of each line in each - * plane of the YUV source image is padded to the nearest multiple of this - * number of bytes (must be a power of 2.) - * - * @param subsamp the level of chrominance subsampling used in the YUV source - * image (see @ref TJSAMP "Chrominance subsampling options".) - * - * @param dstBuf pointer to an image buffer that will receive the decoded - * image. This buffer should normally be pitch * height bytes in - * size, but the dstBuf pointer can also be used to decode into a - * specific region of a larger buffer. - * - * @param width width (in pixels) of the source and destination images - * - * @param pitch bytes per line in the destination image. Normally, this should - * be width * #tjPixelSize[pixelFormat] if the destination image is - * unpadded, or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line - * of the destination image should be padded to the nearest 32-bit boundary, as - * is the case for Windows bitmaps. You can also be clever and use the pitch - * parameter to skip lines, etc. Setting this parameter to 0 is the equivalent - * of setting it to width * #tjPixelSize[pixelFormat]. - * - * @param height height (in pixels) of the source and destination images - * - * @param pixelFormat pixel format of the destination image (see @ref TJPF - * "Pixel formats".) - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT - * "flags" - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() - * and #tjGetErrorCode().) - */ -DLLEXPORT int tjDecodeYUV(tjhandle handle, const unsigned char *srcBuf, - int pad, int subsamp, unsigned char *dstBuf, - int width, int pitch, int height, int pixelFormat, - int flags); - - -/** - * Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale - * image. This function uses the accelerated color conversion routines in the - * underlying codec but does not execute any of the other steps in the JPEG - * decompression process. - * - * @param handle a handle to a TurboJPEG decompressor or transformer instance - * - * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes - * (or just a Y plane, if decoding a grayscale image) that contain a YUV image - * to be decoded. These planes can be contiguous or non-contiguous in memory. - * The size of each plane should match the value returned by #tjPlaneSizeYUV() - * for the given image width, height, strides, and level of chrominance - * subsampling. Refer to @ref YUVnotes "YUV Image Format Notes" for more - * details. - * - * @param strides an array of integers, each specifying the number of bytes per - * line in the corresponding plane of the YUV source image. Setting the stride - * for any plane to 0 is the same as setting it to the plane width (see - * @ref YUVnotes "YUV Image Format Notes".) If strides is NULL, then - * the strides for all planes will be set to their respective plane widths. - * You can adjust the strides in order to specify an arbitrary amount of line - * padding in each plane or to decode a subregion of a larger YUV planar image. - * - * @param subsamp the level of chrominance subsampling used in the YUV source - * image (see @ref TJSAMP "Chrominance subsampling options".) - * - * @param dstBuf pointer to an image buffer that will receive the decoded - * image. This buffer should normally be pitch * height bytes in - * size, but the dstBuf pointer can also be used to decode into a - * specific region of a larger buffer. - * - * @param width width (in pixels) of the source and destination images - * - * @param pitch bytes per line in the destination image. Normally, this should - * be width * #tjPixelSize[pixelFormat] if the destination image is - * unpadded, or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line - * of the destination image should be padded to the nearest 32-bit boundary, as - * is the case for Windows bitmaps. You can also be clever and use the pitch - * parameter to skip lines, etc. Setting this parameter to 0 is the equivalent - * of setting it to width * #tjPixelSize[pixelFormat]. - * - * @param height height (in pixels) of the source and destination images - * - * @param pixelFormat pixel format of the destination image (see @ref TJPF - * "Pixel formats".) - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT - * "flags" - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() - * and #tjGetErrorCode().) - */ -DLLEXPORT int tjDecodeYUVPlanes(tjhandle handle, - const unsigned char **srcPlanes, - const int *strides, int subsamp, - unsigned char *dstBuf, int width, int pitch, - int height, int pixelFormat, int flags); - - -/** - * Create a new TurboJPEG transformer instance. - * - * @return a handle to the newly-created instance, or NULL if an error - * occurred (see #tjGetErrorStr2().) - */ -DLLEXPORT tjhandle tjInitTransform(void); - - -/** - * Losslessly transform a JPEG image into another JPEG image. Lossless - * transforms work by moving the raw DCT coefficients from one JPEG image - * structure to another without altering the values of the coefficients. While - * this is typically faster than decompressing the image, transforming it, and - * re-compressing it, lossless transforms are not free. Each lossless - * transform requires reading and performing Huffman decoding on all of the - * coefficients in the source image, regardless of the size of the destination - * image. Thus, this function provides a means of generating multiple - * transformed images from the same source or applying multiple - * transformations simultaneously, in order to eliminate the need to read the - * source coefficients multiple times. - * - * @param handle a handle to a TurboJPEG transformer instance - * - * @param jpegBuf pointer to a buffer containing the JPEG source image to - * transform - * - * @param jpegSize size of the JPEG source image (in bytes) - * - * @param n the number of transformed JPEG images to generate - * - * @param dstBufs pointer to an array of n image buffers. dstBufs[i] - * will receive a JPEG image that has been transformed using the parameters in - * transforms[i]. TurboJPEG has the ability to reallocate the JPEG - * buffer to accommodate the size of the JPEG image. Thus, you can choose to: - * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and - * let TurboJPEG grow the buffer as needed, - * -# set dstBufs[i] to NULL to tell TurboJPEG to allocate the buffer - * for you, or - * -# pre-allocate the buffer to a "worst case" size determined by calling - * #tjBufSize() with the transformed or cropped width and height. Under normal - * circumstances, this should ensure that the buffer never has to be - * re-allocated (setting #TJFLAG_NOREALLOC guarantees that it won't be.) Note, - * however, that there are some rare cases (such as transforming images with a - * large amount of embedded EXIF or ICC profile data) in which the output image - * will be larger than the worst-case size, and #TJFLAG_NOREALLOC cannot be - * used in those cases. - * . - * If you choose option 1, dstSizes[i] should be set to the size of - * your pre-allocated buffer. In any case, unless you have set - * #TJFLAG_NOREALLOC, you should always check dstBufs[i] upon return - * from this function, as it may have changed. - * - * @param dstSizes pointer to an array of n unsigned long variables that will - * receive the actual sizes (in bytes) of each transformed JPEG image. If - * dstBufs[i] points to a pre-allocated buffer, then - * dstSizes[i] should be set to the size of the buffer. Upon return, - * dstSizes[i] will contain the size of the JPEG image (in bytes.) - * - * @param transforms pointer to an array of n #tjtransform structures, each of - * which specifies the transform parameters and/or cropping region for the - * corresponding transformed output image. - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT - * "flags" - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() - * and #tjGetErrorCode().) - */ -DLLEXPORT int tjTransform(tjhandle handle, const unsigned char *jpegBuf, - unsigned long jpegSize, int n, - unsigned char **dstBufs, unsigned long *dstSizes, - tjtransform *transforms, int flags); - - -/** - * Destroy a TurboJPEG compressor, decompressor, or transformer instance. - * - * @param handle a handle to a TurboJPEG compressor, decompressor or - * transformer instance - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2().) - */ -DLLEXPORT int tjDestroy(tjhandle handle); - - -/** - * Allocate an image buffer for use with TurboJPEG. You should always use - * this function to allocate the JPEG destination buffer(s) for the compression - * and transform functions unless you are disabling automatic buffer - * (re)allocation (by setting #TJFLAG_NOREALLOC.) - * - * @param bytes the number of bytes to allocate - * - * @return a pointer to a newly-allocated buffer with the specified number of - * bytes. - * - * @sa tjFree() - */ -DLLEXPORT unsigned char *tjAlloc(int bytes); - - -/** - * Load an uncompressed image from disk into memory. - * - * @param filename name of a file containing an uncompressed image in Windows - * BMP or PBMPLUS (PPM/PGM) format - * - * @param width pointer to an integer variable that will receive the width (in - * pixels) of the uncompressed image - * - * @param align row alignment of the image buffer to be returned (must be a - * power of 2.) For instance, setting this parameter to 4 will cause all rows - * in the image buffer to be padded to the nearest 32-bit boundary, and setting - * this parameter to 1 will cause all rows in the image buffer to be unpadded. - * - * @param height pointer to an integer variable that will receive the height - * (in pixels) of the uncompressed image - * - * @param pixelFormat pointer to an integer variable that specifies or will - * receive the pixel format of the uncompressed image buffer. The behavior of - * #tjLoadImage() will vary depending on the value of *pixelFormat - * passed to the function: - * - @ref TJPF_UNKNOWN : The uncompressed image buffer returned by the function - * will use the most optimal pixel format for the file type, and - * *pixelFormat will contain the ID of this pixel format upon - * successful return from the function. - * - @ref TJPF_GRAY : Only PGM files and 8-bit BMP files with a grayscale - * colormap can be loaded. - * - @ref TJPF_CMYK : The RGB or grayscale pixels stored in the file will be - * converted using a quick & dirty algorithm that is suitable only for testing - * purposes (proper conversion between CMYK and other formats requires a color - * management system.) - * - Other @ref TJPF "pixel formats" : The uncompressed image buffer will use - * the specified pixel format, and pixel format conversion will be performed if - * necessary. - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". - * - * @return a pointer to a newly-allocated buffer containing the uncompressed - * image, converted to the chosen pixel format and with the chosen row - * alignment, or NULL if an error occurred (see #tjGetErrorStr2().) This - * buffer should be freed using #tjFree(). - */ -DLLEXPORT unsigned char *tjLoadImage(const char *filename, int *width, - int align, int *height, int *pixelFormat, - int flags); - - -/** - * Save an uncompressed image from memory to disk. - * - * @param filename name of a file to which to save the uncompressed image. - * The image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, - * depending on the file extension. - * - * @param buffer pointer to an image buffer containing RGB, grayscale, or - * CMYK pixels to be saved - * - * @param width width (in pixels) of the uncompressed image - * - * @param pitch bytes per line in the image buffer. Setting this parameter to - * 0 is the equivalent of setting it to - * width * #tjPixelSize[pixelFormat]. - * - * @param height height (in pixels) of the uncompressed image - * - * @param pixelFormat pixel format of the image buffer (see @ref TJPF - * "Pixel formats".) If this parameter is set to @ref TJPF_GRAY, then the - * image will be stored in PGM or 8-bit (indexed color) BMP format. Otherwise, - * the image will be stored in PPM or 24-bit BMP format. If this parameter - * is set to @ref TJPF_CMYK, then the CMYK pixels will be converted to RGB - * using a quick & dirty algorithm that is suitable only for testing (proper - * conversion between CMYK and other formats requires a color management - * system.) - * - * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". - * - * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2().) - */ -DLLEXPORT int tjSaveImage(const char *filename, unsigned char *buffer, - int width, int pitch, int height, int pixelFormat, - int flags); - - -/** - * Free an image buffer previously allocated by TurboJPEG. You should always - * use this function to free JPEG destination buffer(s) that were automatically - * (re)allocated by the compression and transform functions or that were - * manually allocated using #tjAlloc(). - * - * @param buffer address of the buffer to free - * - * @sa tjAlloc() - */ -DLLEXPORT void tjFree(unsigned char *buffer); - - -/** - * Returns a descriptive error message explaining why the last command failed. - * - * @param handle a handle to a TurboJPEG compressor, decompressor, or - * transformer instance, or NULL if the error was generated by a global - * function (but note that retrieving the error message for a global function - * is not thread-safe.) - * - * @return a descriptive error message explaining why the last command failed. - */ -DLLEXPORT char *tjGetErrorStr2(tjhandle handle); - - -/** - * Returns a code indicating the severity of the last error. See - * @ref TJERR "Error codes". - * - * @param handle a handle to a TurboJPEG compressor, decompressor or - * transformer instance - * - * @return a code indicating the severity of the last error. See - * @ref TJERR "Error codes". - */ -DLLEXPORT int tjGetErrorCode(tjhandle handle); - - -/* Deprecated functions and macros */ -#define TJFLAG_FORCEMMX 8 -#define TJFLAG_FORCESSE 16 -#define TJFLAG_FORCESSE2 32 -#define TJFLAG_FORCESSE3 128 - - -/* Backward compatibility functions and macros (nothing to see here) */ -#define NUMSUBOPT TJ_NUMSAMP -#define TJ_444 TJSAMP_444 -#define TJ_422 TJSAMP_422 -#define TJ_420 TJSAMP_420 -#define TJ_411 TJSAMP_420 -#define TJ_GRAYSCALE TJSAMP_GRAY - -#define TJ_BGR 1 -#define TJ_BOTTOMUP TJFLAG_BOTTOMUP -#define TJ_FORCEMMX TJFLAG_FORCEMMX -#define TJ_FORCESSE TJFLAG_FORCESSE -#define TJ_FORCESSE2 TJFLAG_FORCESSE2 -#define TJ_ALPHAFIRST 64 -#define TJ_FORCESSE3 TJFLAG_FORCESSE3 -#define TJ_FASTUPSAMPLE TJFLAG_FASTUPSAMPLE -#define TJ_YUV 512 - -DLLEXPORT unsigned long TJBUFSIZE(int width, int height); - -DLLEXPORT unsigned long TJBUFSIZEYUV(int width, int height, int jpegSubsamp); - -DLLEXPORT unsigned long tjBufSizeYUV(int width, int height, int subsamp); - -DLLEXPORT int tjCompress(tjhandle handle, unsigned char *srcBuf, int width, - int pitch, int height, int pixelSize, - unsigned char *dstBuf, unsigned long *compressedSize, - int jpegSubsamp, int jpegQual, int flags); - -DLLEXPORT int tjEncodeYUV(tjhandle handle, unsigned char *srcBuf, int width, - int pitch, int height, int pixelSize, - unsigned char *dstBuf, int subsamp, int flags); - -DLLEXPORT int tjEncodeYUV2(tjhandle handle, unsigned char *srcBuf, int width, - int pitch, int height, int pixelFormat, - unsigned char *dstBuf, int subsamp, int flags); - -DLLEXPORT int tjDecompressHeader(tjhandle handle, unsigned char *jpegBuf, - unsigned long jpegSize, int *width, - int *height); - -DLLEXPORT int tjDecompressHeader2(tjhandle handle, unsigned char *jpegBuf, - unsigned long jpegSize, int *width, - int *height, int *jpegSubsamp); - -DLLEXPORT int tjDecompress(tjhandle handle, unsigned char *jpegBuf, - unsigned long jpegSize, unsigned char *dstBuf, - int width, int pitch, int height, int pixelSize, - int flags); - -DLLEXPORT int tjDecompressToYUV(tjhandle handle, unsigned char *jpegBuf, - unsigned long jpegSize, unsigned char *dstBuf, - int flags); - -DLLEXPORT char *tjGetErrorStr(void); - - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/pub/external/include/twain.h b/pub/external/include/twain.h deleted file mode 100644 index 365c79e..0000000 --- a/pub/external/include/twain.h +++ /dev/null @@ -1,2238 +0,0 @@ -/* ======================================================================== *\ - - Copyright (C) 2007 TWAIN Working Group: Adobe Systems Incorporated, - AnyDoc Software Inc., Eastman Kodak Company, Fujitsu Computer Products - of America, JFL Peripheral Solutions Inc., Ricoh Corporation, and - Xerox Corporation. All rights reserved. - - Copyright (C) 1991, 1992 TWAIN Working Group: Aldus, Caere, Eastman-Kodak, - Hewlett-Packard and Logitech Corporations. All rights reserved. - - Copyright (C) 1997 TWAIN Working Group: Bell+Howell, Canon, DocuMagix, - Fujitsu, Genoa Technology, Hewlett-Packard, Kofax Imaging Products, and - Ricoh Corporation. All rights reserved. - - Copyright (C) 1998 TWAIN Working Group: Adobe Systems Incorporated, - Canon Information Systems, Eastman Kodak Company, - Fujitsu Computer Products of America, Genoa Technology, - Hewlett-Packard Company, Intel Corporation, Kofax Image Products, - JFL Peripheral Solutions Inc., Ricoh Corporation, and Xerox Corporation. - All rights reserved. - - Copyright (C) 2000 TWAIN Working Group: Adobe Systems Incorporated, - Canon Information Systems, Digimarc Corporation, Eastman Kodak Company, - Fujitsu Computer Products of America, Hewlett-Packard Company, - JFL Peripheral Solutions Inc., Ricoh Corporation, and Xerox Corporation. - All rights reserved. - - - TWAIN.h - This is the definitive include file for applications and - data sources written to the TWAIN specification. - It defines constants, data structures, messages etc. - for the public interface to TWAIN. - - Revision History: - version 1.0, March 6, 1992. TWAIN 1.0. - version 1.1, January 1993. Tech Notes 1.1 - version 1.5, June 1993. Specification Update 1.5 - Change DC to TW - Change filename from DC.H to TWAIN.H - version 1.5, July 1993. Remove spaces from country identifiers - - version 1.7, July 1997 Added Capabilities and data structure for - document imaging and digital cameras. - KHL. - version 1.7, July 1997 Inserted Borland compatibile structure packing - directives provided by Mentor. JMH - version 1.7, Aug 1997 Expanded file tabs to spaces. - NOTE: future authors should be sure to have - their editors set to automatically expand tabs - to spaces (original tab setting was 4 spaces). - version 1.7, Sept 1997 Added job control values - Added return codes - version 1.7, Sept 1997 changed definition of pRGBRESPONSE to - pTW_RGBRESPONSE - version 1.7 Aug 1998 Added missing TWEI_BARCODEROTATION values - TWBCOR_ types JMH - version 1.8 August 1998 Added new types and definitions required - for 1.8 Specification JMH - version 1.8 January 1999 Changed search mode from SRCH_ to TWBD_ as - in 1.8 Specification, added TWBT_MAXICODE JMH - version 1.8 January 1999 Removed undocumented duplicate AUTO JMH - version 1.8 March 1999 Removed undocumented 1.8 caps: - CAP_FILESYSTEM - CAP_PAPERBINDING - CAP_PASSTHRU - CAP_POWERDOWNTIME - ICAP_AUTODISCARDBLANKPAGES - * CAP_PAGEMULTIPLEACQUIRE - is CAP_REACQUIREALLOWED, - requires spec change. JMH - Added Mac structure packing modifications JMH - version 1.9 March 2000 Added new types and definations required - for 1.9 Specification MLM - version 1.9 March 2000 Added ICAP_JPEGQUALITY, TWJQ_ values, - updated TWON_PROTOCOLMINOR for Release v1.9 MN - version 1.91 August 2007 Added new types and definitions required - for 1.91 Specification MLM - version 2.0 Sept 2007 Added new types and definitions required - for 2.0 Specification FHH - version 2.0 Mar 2008 Depreciated ICAP_PIXELTYPEs TWPT_SRGB64, TWPT_BGR, - TWPT_CIELAB, TWPT_CIELUV, and TWPT_YCBCR JMW - version 2.0 Mar 2008 Added missing new 2.0 CAP_ definitions JMW - version 2.0 Dec 2008 Updated TW_INFO structure for 64bit JMW - version 2.1 Mar 2009 Added new types and definitions required - for 2.1 Specification JMW - version 2.2 Nov 2010 Added new types and definitions required - for 2.2 Specification MSM - version 2.3 Feb 2013 Added new types and definitions required - for 2.3 Specification MLM -\* ======================================================================== */ - -#ifndef TWAIN -#define TWAIN - -/**************************************************************************** - * TWAIN Version * - ****************************************************************************/ -#define TWON_PROTOCOLMINOR 3 /* Changed for Version 2.3 */ -#define TWON_PROTOCOLMAJOR 2 - -/**************************************************************************** - * Platform Dependent Definitions and Typedefs * - ****************************************************************************/ - -/* Microsoft C/C++ Compiler */ -#if defined(WIN32) || defined(WIN64) || defined (_WINDOWS) - #define TWH_CMP_MSC - #if defined(_WIN64) || defined(WIN64) - #define TWH_64BIT - #elif defined(WIN32) || defined(_WIN32) - #define TWH_32BIT - #endif - -/* GNU C/C++ Compiler */ -#elif defined(__GNUC__) - #define TWH_CMP_GNU - #if defined(__alpha__)\ - ||defined(__ia64__)\ - ||defined(__ppc64__)\ - ||defined(__s390x__)\ - ||defined(__x86_64__) - #define TWH_64BIT - #else - #define TWH_32BIT - #endif - - -/* Borland C/C++ Compiler */ -#elif defined(__BORLAND__) - #define TWH_CMP_BORLAND - #define TWH_32BIT -/* Unrecognized */ -#else - #error Unrecognized compiler -#endif - -/* Apple Compiler (which is GNU now) */ -#if defined(__APPLE__) - #define TWH_CMP_XCODE - #ifdef __MWERKS__ - #include - #else - #include - #endif -#endif - -/* Win32 and Win64 systems */ -#if defined(TWH_CMP_MSC) | defined(TWH_CMP_BORLAND) - typedef HANDLE TW_HANDLE; - typedef LPVOID TW_MEMREF; - typedef UINT_PTR TW_UINTPTR; - -/* MacOS/X... */ -#elif defined(TWH_CMP_XCODE) - #define PASCAL pascal - #define FAR - typedef Handle TW_HANDLE; - typedef char *TW_MEMREF; - typedef unsigned char BYTE; - - #ifdef TWH_32BIT - //32 bit GNU - typedef unsigned long TW_UINTPTR; - #else - //64 bit GNU - typedef unsigned long long TW_UINTPTR; - #endif - -/* Everything else... */ -#else - #define PASCAL - #define FAR - typedef void* TW_HANDLE; - typedef void* TW_MEMREF; - typedef unsigned char BYTE; - - #ifdef TWH_32BIT - //32 bit GNU - typedef unsigned long TW_UINTPTR; - #else - //64 bit GNU - typedef unsigned long long TW_UINTPTR; - #endif -#endif - - -/* Set the packing: this occurs before any structures are defined */ -#ifdef TWH_CMP_MSC - #pragma pack (push, before_twain) - #pragma pack (2) -#elif defined(TWH_CMP_GNU) - #if defined(__APPLE__) /* cf: Mac version of TWAIN.h */ - #pragma options align = power - #else - #pragma pack (push, before_twain) - #pragma pack (2) - #endif -#elif defined(TWH_CMP_BORLAND) - #pragma option -a2 -#endif - - -/**************************************************************************** - * Type Definitions * - ****************************************************************************/ - -/* String types. These include room for the strings and a NULL char, * - * or, on the Mac, a length byte followed by the string. * - * TW_STR255 must hold less than 256 chars so length fits in first byte. */ -#if defined(__APPLE__)/* cf: Mac version of TWAIN.h */ - typedef unsigned char TW_STR32[34], FAR *pTW_STR32; - typedef unsigned char TW_STR64[66], FAR *pTW_STR64; - typedef unsigned char TW_STR128[130], FAR *pTW_STR128; - typedef unsigned char TW_STR255[256], FAR *pTW_STR255; -#else - typedef char TW_STR32[34], FAR *pTW_STR32; - typedef char TW_STR64[66], FAR *pTW_STR64; - typedef char TW_STR128[130], FAR *pTW_STR128; - typedef char TW_STR255[256], FAR *pTW_STR255; -#endif - -/* Numeric types. */ -typedef char TW_INT8, FAR *pTW_INT8; -typedef short TW_INT16, FAR *pTW_INT16; -#if defined(__APPLE__) /* cf: Mac version of TWAIN.h */ - typedef int TW_INT32, FAR *pTW_INT32; -#else - typedef long TW_INT32, FAR *pTW_INT32; -#endif -typedef unsigned char TW_UINT8, FAR *pTW_UINT8; -typedef unsigned short TW_UINT16, FAR *pTW_UINT16; -#if defined(__APPLE__) /* cf: Mac version of TWAIN.h */ - typedef unsigned int TW_UINT32, FAR *pTW_UINT32; -#else - typedef unsigned long TW_UINT32, FAR *pTW_UINT32; -#endif -typedef unsigned short TW_BOOL, FAR *pTW_BOOL; - - -/**************************************************************************** - * Structure Definitions * - ****************************************************************************/ - -/* Fixed point structure type. */ -typedef struct { - TW_INT16 Whole; - TW_UINT16 Frac; -} TW_FIX32, FAR *pTW_FIX32; - -/* Defines a frame rectangle in ICAP_UNITS coordinates. */ -typedef struct { - TW_FIX32 Left; - TW_FIX32 Top; - TW_FIX32 Right; - TW_FIX32 Bottom; -} TW_FRAME, FAR * pTW_FRAME; - -/* Defines the parameters used for channel-specific transformation. */ -typedef struct { - TW_FIX32 StartIn; - TW_FIX32 BreakIn; - TW_FIX32 EndIn; - TW_FIX32 StartOut; - TW_FIX32 BreakOut; - TW_FIX32 EndOut; - TW_FIX32 Gamma; - TW_FIX32 SampleCount; -} TW_DECODEFUNCTION, FAR * pTW_DECODEFUNCTION; - -/* Stores a Fixed point number in two parts, a whole and a fractional part. */ -typedef struct { - TW_DECODEFUNCTION Decode[3]; - TW_FIX32 Mix[3][3]; -} TW_TRANSFORMSTAGE, FAR * pTW_TRANSFORMSTAGE; - -/* Container for array of values */ -typedef struct { - TW_UINT16 ItemType; - TW_UINT32 NumItems; - TW_UINT8 ItemList[1]; -} TW_ARRAY, FAR * pTW_ARRAY; - -/* Information about audio data */ -typedef struct { - TW_STR255 Name; - TW_UINT32 Reserved; -} TW_AUDIOINFO, FAR * pTW_AUDIOINFO; - -/* Used to register callbacks. */ -typedef struct { - TW_MEMREF CallBackProc; - #if defined(__APPLE__) /* cf: Mac version of TWAIN.h */ - TW_MEMREF RefCon; - #else - TW_UINT32 RefCon; - #endif - TW_INT16 Message; -} TW_CALLBACK, FAR * pTW_CALLBACK; - -/* Used to register callbacks. */ -typedef struct { - TW_MEMREF CallBackProc; - TW_UINTPTR RefCon; - TW_INT16 Message; -} TW_CALLBACK2, FAR * pTW_CALLBACK2; - -/* Used by application to get/set capability from/in a data source. */ -typedef struct { - TW_UINT16 Cap; - TW_UINT16 ConType; - TW_HANDLE hContainer; -} TW_CAPABILITY, FAR * pTW_CAPABILITY; - -/* Defines a CIE XYZ space tri-stimulus value. */ -typedef struct { - TW_FIX32 X; - TW_FIX32 Y; - TW_FIX32 Z; -} TW_CIEPOINT, FAR * pTW_CIEPOINT; - -/* Defines the mapping from an RGB color space device into CIE 1931 (XYZ) color space. */ -typedef struct { - TW_UINT16 ColorSpace; - TW_INT16 LowEndian; - TW_INT16 DeviceDependent; - TW_INT32 VersionNumber; - TW_TRANSFORMSTAGE StageABC; - TW_TRANSFORMSTAGE StageLMN; - TW_CIEPOINT WhitePoint; - TW_CIEPOINT BlackPoint; - TW_CIEPOINT WhitePaper; - TW_CIEPOINT BlackInk; - TW_FIX32 Samples[1]; -} TW_CIECOLOR, FAR * pTW_CIECOLOR; - -/* Allows for a data source and application to pass custom data to each other. */ -typedef struct { - TW_UINT32 InfoLength; - TW_HANDLE hData; -}TW_CUSTOMDSDATA, FAR *pTW_CUSTOMDSDATA; - -/* Provides information about the Event that was raised by the Source */ -typedef struct { - TW_UINT32 Event; - TW_STR255 DeviceName; - TW_UINT32 BatteryMinutes; - TW_INT16 BatteryPercentage; - TW_INT32 PowerSupply; - TW_FIX32 XResolution; - TW_FIX32 YResolution; - TW_UINT32 FlashUsed2; - TW_UINT32 AutomaticCapture; - TW_UINT32 TimeBeforeFirstCapture; - TW_UINT32 TimeBetweenCaptures; -} TW_DEVICEEVENT, FAR * pTW_DEVICEEVENT; - -/* This structure holds the tri-stimulus color palette information for TW_PALETTE8 structures.*/ -typedef struct { - TW_UINT8 Index; - TW_UINT8 Channel1; - TW_UINT8 Channel2; - TW_UINT8 Channel3; -} TW_ELEMENT8, FAR * pTW_ELEMENT8; - -/* Stores a group of individual values describing a capability. */ -typedef struct { - TW_UINT16 ItemType; - TW_UINT32 NumItems; - TW_UINT32 CurrentIndex; - TW_UINT32 DefaultIndex; - TW_UINT8 ItemList[1]; -} TW_ENUMERATION, FAR * pTW_ENUMERATION; - -/* Used to pass application events/messages from the application to the Source. */ -typedef struct { - TW_MEMREF pEvent; - TW_UINT16 TWMessage; -} TW_EVENT, FAR * pTW_EVENT; - -/* This structure is used to pass specific information between the data source and the application. */ -typedef struct { - TW_UINT16 InfoID; - TW_UINT16 ItemType; - TW_UINT16 NumItems; - union { - TW_UINT16 ReturnCode; - TW_UINT16 CondCode; // Deprecated, do not use - }; - TW_UINTPTR Item; -}TW_INFO, FAR* pTW_INFO; - -typedef struct { - TW_UINT32 NumInfos; - TW_INFO Info[1]; -}TW_EXTIMAGEINFO, FAR* pTW_EXTIMAGEINFO; - -/* Provides information about the currently selected device */ -typedef struct { - TW_STR255 InputName; - TW_STR255 OutputName; - TW_MEMREF Context; - union { - int Recursive; - TW_BOOL Subdirectories; - }; - union { - TW_INT32 FileType; - TW_UINT32 FileSystemType; - }; - TW_UINT32 Size; - TW_STR32 CreateTimeDate; - TW_STR32 ModifiedTimeDate; - TW_UINT32 FreeSpace; - TW_INT32 NewImageSize; - TW_UINT32 NumberOfFiles; - TW_UINT32 NumberOfSnippets; - TW_UINT32 DeviceGroupMask; - TW_INT8 Reserved[508]; -} TW_FILESYSTEM, FAR * pTW_FILESYSTEM; - -/* This structure is used by the application to specify a set of mapping values to be applied to grayscale data. */ -typedef struct { - TW_ELEMENT8 Response[1]; -} TW_GRAYRESPONSE, FAR * pTW_GRAYRESPONSE; - -/* A general way to describe the version of software that is running. */ -typedef struct { - TW_UINT16 MajorNum; - TW_UINT16 MinorNum; - TW_UINT16 Language; - TW_UINT16 Country; - TW_STR32 Info; -} TW_VERSION, FAR * pTW_VERSION; - -/* Provides identification information about a TWAIN entity.*/ -typedef struct { - #if defined(__APPLE__) /* cf: Mac version of TWAIN.h */ - TW_MEMREF Id; - #else - TW_UINT32 Id; - #endif - TW_VERSION Version; - TW_UINT16 ProtocolMajor; - TW_UINT16 ProtocolMinor; - TW_UINT32 SupportedGroups; - TW_STR32 Manufacturer; - TW_STR32 ProductFamily; - TW_STR32 ProductName; -} TW_IDENTITY, FAR * pTW_IDENTITY; - -/* Describes the "real" image data, that is, the complete image being transferred between the Source and application. */ -typedef struct { - TW_FIX32 XResolution; - TW_FIX32 YResolution; - TW_INT32 ImageWidth; - TW_INT32 ImageLength; - TW_INT16 SamplesPerPixel; - TW_INT16 BitsPerSample[8]; - TW_INT16 BitsPerPixel; - TW_BOOL Planar; - TW_INT16 PixelType; - TW_UINT16 Compression; -} TW_IMAGEINFO, FAR * pTW_IMAGEINFO; - -/* Involves information about the original size of the acquired image. */ -typedef struct { - TW_FRAME Frame; - TW_UINT32 DocumentNumber; - TW_UINT32 PageNumber; - TW_UINT32 FrameNumber; -} TW_IMAGELAYOUT, FAR * pTW_IMAGELAYOUT; - -/* Provides information for managing memory buffers. */ -typedef struct { - TW_UINT32 Flags; - TW_UINT32 Length; - TW_MEMREF TheMem; -} TW_MEMORY, FAR * pTW_MEMORY; - -/* Describes the form of the acquired data being passed from the Source to the application.*/ -typedef struct { - TW_UINT16 Compression; - TW_UINT32 BytesPerRow; - TW_UINT32 Columns; - TW_UINT32 Rows; - TW_UINT32 XOffset; - TW_UINT32 YOffset; - TW_UINT32 BytesWritten; - TW_MEMORY Memory; -} TW_IMAGEMEMXFER, FAR * pTW_IMAGEMEMXFER; - -/* Describes the information necessary to transfer a JPEG-compressed image. */ -typedef struct { - TW_UINT16 ColorSpace; - TW_UINT32 SubSampling; - TW_UINT16 NumComponents; - TW_UINT16 RestartFrequency; - TW_UINT16 QuantMap[4]; - TW_MEMORY QuantTable[4]; - TW_UINT16 HuffmanMap[4]; - TW_MEMORY HuffmanDC[2]; - TW_MEMORY HuffmanAC[2]; -} TW_JPEGCOMPRESSION, FAR * pTW_JPEGCOMPRESSION; - -/* Stores a single value (item) which describes a capability. */ -typedef struct { - TW_UINT16 ItemType; - TW_UINT32 Item; -} TW_ONEVALUE, FAR * pTW_ONEVALUE; - -/* This structure holds the color palette information. */ -typedef struct { - TW_UINT16 NumColors; - TW_UINT16 PaletteType; - TW_ELEMENT8 Colors[256]; -} TW_PALETTE8, FAR * pTW_PALETTE8; - -/* Used to bypass the TWAIN protocol when communicating with a device */ -typedef struct { - TW_MEMREF pCommand; - TW_UINT32 CommandBytes; - TW_INT32 Direction; - TW_MEMREF pData; - TW_UINT32 DataBytes; - TW_UINT32 DataBytesXfered; -} TW_PASSTHRU, FAR * pTW_PASSTHRU; - -/* This structure tells the application how many more complete transfers the Source currently has available. */ -typedef struct { - TW_UINT16 Count; - union { - TW_UINT32 EOJ; - TW_UINT32 Reserved; - #if defined(__APPLE__) /* cf: Mac version of TWAIN.h */ - union { - TW_UINT32 EOJ; - TW_UINT32 Reserved; - } TW_JOBCONTROL; - #endif - }; -} TW_PENDINGXFERS, FAR *pTW_PENDINGXFERS; - -/* Stores a range of individual values describing a capability. */ -typedef struct { - TW_UINT16 ItemType; - TW_UINT32 MinValue; - TW_UINT32 MaxValue; - TW_UINT32 StepSize; - TW_UINT32 DefaultValue; - TW_UINT32 CurrentValue; -} TW_RANGE, FAR * pTW_RANGE; - -/* This structure is used by the application to specify a set of mapping values to be applied to RGB color data. */ -typedef struct { - TW_ELEMENT8 Response[1]; -} TW_RGBRESPONSE, FAR * pTW_RGBRESPONSE; - -/* Describes the file format and file specification information for a transfer through a disk file. */ -typedef struct { - TW_STR255 FileName; - TW_UINT16 Format; - TW_INT16 VRefNum; -} TW_SETUPFILEXFER, FAR * pTW_SETUPFILEXFER; - -/* Provides the application information about the Source's requirements and preferences regarding allocation of transfer buffer(s). */ -typedef struct { - TW_UINT32 MinBufSize; - TW_UINT32 MaxBufSize; - TW_UINT32 Preferred; -} TW_SETUPMEMXFER, FAR * pTW_SETUPMEMXFER; - -/* Describes the status of a source. */ -typedef struct { - TW_UINT16 ConditionCode; - union { - TW_UINT16 Data; - TW_UINT16 Reserved; - }; -} TW_STATUS, FAR * pTW_STATUS; - -/* Translates the contents of Status into a localized UTF8string. */ -typedef struct { - TW_STATUS Status; - TW_UINT32 Size; - TW_HANDLE UTF8string; -} TW_STATUSUTF8, FAR * pTW_STATUSUTF8; - -/* This structure is used to handle the user interface coordination between an application and a Source. */ -typedef struct { - TW_BOOL ShowUI; - TW_BOOL ModalUI; - TW_HANDLE hParent; -} TW_USERINTERFACE, FAR * pTW_USERINTERFACE; - - -/**************************************************************************** - * Generic Constants * - ****************************************************************************/ - -#define TWON_ARRAY 3 -#define TWON_ENUMERATION 4 -#define TWON_ONEVALUE 5 -#define TWON_RANGE 6 - -#define TWON_ICONID 962 -#define TWON_DSMID 461 -#define TWON_DSMCODEID 63 - -#define TWON_DONTCARE8 0xff -#define TWON_DONTCARE16 0xffff -#define TWON_DONTCARE32 0xffffffff - -/* Flags used in TW_MEMORY structure. */ -#define TWMF_APPOWNS 0x0001 -#define TWMF_DSMOWNS 0x0002 -#define TWMF_DSOWNS 0x0004 -#define TWMF_POINTER 0x0008 -#define TWMF_HANDLE 0x0010 - -#define TWTY_INT8 0x0000 -#define TWTY_INT16 0x0001 -#define TWTY_INT32 0x0002 - -#define TWTY_UINT8 0x0003 -#define TWTY_UINT16 0x0004 -#define TWTY_UINT32 0x0005 - -#define TWTY_BOOL 0x0006 - -#define TWTY_FIX32 0x0007 - -#define TWTY_FRAME 0x0008 - -#define TWTY_STR32 0x0009 -#define TWTY_STR64 0x000a -#define TWTY_STR128 0x000b -#define TWTY_STR255 0x000c -#define TWTY_HANDLE 0x000f - - -/**************************************************************************** - * Capability Constants * - ****************************************************************************/ - -/* CAP_ALARMS values */ -#define TWAL_ALARM 0 -#define TWAL_FEEDERERROR 1 -#define TWAL_FEEDERWARNING 2 -#define TWAL_BARCODE 3 -#define TWAL_DOUBLEFEED 4 -#define TWAL_JAM 5 -#define TWAL_PATCHCODE 6 -#define TWAL_POWER 7 -#define TWAL_SKEW 8 - -/* ICAP_AUTOSIZE values */ -#define TWAS_NONE 0 -#define TWAS_AUTO 1 -#define TWAS_CURRENT 2 - -/* TWEI_BARCODEROTATION values */ -#define TWBCOR_ROT0 0 -#define TWBCOR_ROT90 1 -#define TWBCOR_ROT180 2 -#define TWBCOR_ROT270 3 -#define TWBCOR_ROTX 4 - -/* ICAP_BARCODESEARCHMODE values */ -#define TWBD_HORZ 0 -#define TWBD_VERT 1 -#define TWBD_HORZVERT 2 -#define TWBD_VERTHORZ 3 - -/* ICAP_BITORDER values */ -#define TWBO_LSBFIRST 0 -#define TWBO_MSBFIRST 1 - -/* ICAP_AUTODISCARDBLANKPAGES values */ -#define TWBP_DISABLE -2 -#define TWBP_AUTO -1 - -/* ICAP_BITDEPTHREDUCTION values */ -#define TWBR_THRESHOLD 0 -#define TWBR_HALFTONE 1 -#define TWBR_CUSTHALFTONE 2 -#define TWBR_DIFFUSION 3 -#define TWBR_DYNAMICTHRESHOLD 4 - -/* ICAP_SUPPORTEDBARCODETYPES and TWEI_BARCODETYPE values*/ -#define TWBT_3OF9 0 -#define TWBT_2OF5INTERLEAVED 1 -#define TWBT_2OF5NONINTERLEAVED 2 -#define TWBT_CODE93 3 -#define TWBT_CODE128 4 -#define TWBT_UCC128 5 -#define TWBT_CODABAR 6 -#define TWBT_UPCA 7 -#define TWBT_UPCE 8 -#define TWBT_EAN8 9 -#define TWBT_EAN13 10 -#define TWBT_POSTNET 11 -#define TWBT_PDF417 12 -#define TWBT_2OF5INDUSTRIAL 13 -#define TWBT_2OF5MATRIX 14 -#define TWBT_2OF5DATALOGIC 15 -#define TWBT_2OF5IATA 16 -#define TWBT_3OF9FULLASCII 17 -#define TWBT_CODABARWITHSTARTSTOP 18 -#define TWBT_MAXICODE 19 -#define TWBT_QRCODE 20 - -/* ICAP_COMPRESSION values*/ -#define TWCP_NONE 0 -#define TWCP_PACKBITS 1 -#define TWCP_GROUP31D 2 -#define TWCP_GROUP31DEOL 3 -#define TWCP_GROUP32D 4 -#define TWCP_GROUP4 5 -#define TWCP_JPEG 6 -#define TWCP_LZW 7 -#define TWCP_JBIG 8 -#define TWCP_PNG 9 -#define TWCP_RLE4 10 -#define TWCP_RLE8 11 -#define TWCP_BITFIELDS 12 -#define TWCP_ZIP 13 -#define TWCP_JPEG2000 14 - -/* CAP_CAMERASIDE and TWEI_PAGESIDE values */ -#define TWCS_BOTH 0 -#define TWCS_TOP 1 -#define TWCS_BOTTOM 2 - -/* CAP_CLEARBUFFERS values */ -#define TWCB_AUTO 0 -#define TWCB_CLEAR 1 -#define TWCB_NOCLEAR 2 - -/* CAP_DEVICEEVENT values */ -#define TWDE_CUSTOMEVENTS 0x8000 -#define TWDE_CHECKAUTOMATICCAPTURE 0 -#define TWDE_CHECKBATTERY 1 -#define TWDE_CHECKDEVICEONLINE 2 -#define TWDE_CHECKFLASH 3 -#define TWDE_CHECKPOWERSUPPLY 4 -#define TWDE_CHECKRESOLUTION 5 -#define TWDE_DEVICEADDED 6 -#define TWDE_DEVICEOFFLINE 7 -#define TWDE_DEVICEREADY 8 -#define TWDE_DEVICEREMOVED 9 -#define TWDE_IMAGECAPTURED 10 -#define TWDE_IMAGEDELETED 11 -#define TWDE_PAPERDOUBLEFEED 12 -#define TWDE_PAPERJAM 13 -#define TWDE_LAMPFAILURE 14 -#define TWDE_POWERSAVE 15 -#define TWDE_POWERSAVENOTIFY 16 - -/* TW_PASSTHRU.Direction values. */ -#define TWDR_GET 1 -#define TWDR_SET 2 - -/* TWEI_DESKEWSTATUS values. */ -#define TWDSK_SUCCESS 0 -#define TWDSK_REPORTONLY 1 -#define TWDSK_FAIL 2 -#define TWDSK_DISABLED 3 - -/* CAP_DUPLEX values */ -#define TWDX_NONE 0 -#define TWDX_1PASSDUPLEX 1 -#define TWDX_2PASSDUPLEX 2 - -/* CAP_FEEDERALIGNMENT values */ -#define TWFA_NONE 0 -#define TWFA_LEFT 1 -#define TWFA_CENTER 2 -#define TWFA_RIGHT 3 - -/* ICAP_FEEDERTYPE values*/ -#define TWFE_GENERAL 0 -#define TWFE_PHOTO 1 - -/* ICAP_IMAGEFILEFORMAT values */ -#define TWFF_TIFF 0 -#define TWFF_PICT 1 -#define TWFF_BMP 2 -#define TWFF_XBM 3 -#define TWFF_JFIF 4 -#define TWFF_FPX 5 -#define TWFF_TIFFMULTI 6 -#define TWFF_PNG 7 -#define TWFF_SPIFF 8 -#define TWFF_EXIF 9 -#define TWFF_PDF 10 -#define TWFF_JP2 11 -#define TWFF_JPX 13 -#define TWFF_DEJAVU 14 -#define TWFF_PDFA 15 -#define TWFF_PDFA2 16 - -/* ICAP_FLASHUSED2 values */ -#define TWFL_NONE 0 -#define TWFL_OFF 1 -#define TWFL_ON 2 -#define TWFL_AUTO 3 -#define TWFL_REDEYE 4 - -/* CAP_FEEDERORDER values */ -#define TWFO_FIRSTPAGEFIRST 0 -#define TWFO_LASTPAGEFIRST 1 - -/* CAP_FEEDERPOCKET values*/ -#define TWFP_POCKETERROR 0 -#define TWFP_POCKET1 1 -#define TWFP_POCKET2 2 -#define TWFP_POCKET3 3 -#define TWFP_POCKET4 4 -#define TWFP_POCKET5 5 -#define TWFP_POCKET6 6 -#define TWFP_POCKET7 7 -#define TWFP_POCKET8 8 -#define TWFP_POCKET9 9 -#define TWFP_POCKET10 10 -#define TWFP_POCKET11 11 -#define TWFP_POCKET12 12 -#define TWFP_POCKET13 13 -#define TWFP_POCKET14 14 -#define TWFP_POCKET15 15 -#define TWFP_POCKET16 16 - -/* ICAP_FLIPROTATION values */ -#define TWFR_BOOK 0 -#define TWFR_FANFOLD 1 - -/* ICAP_FILTER values */ -#define TWFT_RED 0 -#define TWFT_GREEN 1 -#define TWFT_BLUE 2 -#define TWFT_NONE 3 -#define TWFT_WHITE 4 -#define TWFT_CYAN 5 -#define TWFT_MAGENTA 6 -#define TWFT_YELLOW 7 -#define TWFT_BLACK 8 - -/* TW_FILESYSTEM.FileType values */ -#define TWFY_CAMERA 0 -#define TWFY_CAMERATOP 1 -#define TWFY_CAMERABOTTOM 2 -#define TWFY_CAMERAPREVIEW 3 -#define TWFY_DOMAIN 4 -#define TWFY_HOST 5 -#define TWFY_DIRECTORY 6 -#define TWFY_IMAGE 7 -#define TWFY_UNKNOWN 8 - -/* ICAP_ICCPROFILE values */ -#define TWIC_NONE 0 -#define TWIC_LINK 1 -#define TWIC_EMBED 2 - -/* ICAP_IMAGEFILTER values */ -#define TWIF_NONE 0 -#define TWIF_AUTO 1 -#define TWIF_LOWPASS 2 -#define TWIF_BANDPASS 3 -#define TWIF_HIGHPASS 4 -#define TWIF_TEXT TWIF_BANDPASS -#define TWIF_FINELINE TWIF_HIGHPASS - -/* ICAP_IMAGEMERGE values */ -#define TWIM_NONE 0 -#define TWIM_FRONTONTOP 1 -#define TWIM_FRONTONBOTTOM 2 -#define TWIM_FRONTONLEFT 3 -#define TWIM_FRONTONRIGHT 4 - -/* CAP_JOBCONTROL values */ -#define TWJC_NONE 0 -#define TWJC_JSIC 1 -#define TWJC_JSIS 2 -#define TWJC_JSXC 3 -#define TWJC_JSXS 4 - -/* ICAP_JPEGQUALITY values */ -#define TWJQ_UNKNOWN -4 -#define TWJQ_LOW -3 -#define TWJQ_MEDIUM -2 -#define TWJQ_HIGH -1 - -/* ICAP_LIGHTPATH values */ -#define TWLP_REFLECTIVE 0 -#define TWLP_TRANSMISSIVE 1 - -/* ICAP_LIGHTSOURCE values */ -#define TWLS_RED 0 -#define TWLS_GREEN 1 -#define TWLS_BLUE 2 -#define TWLS_NONE 3 -#define TWLS_WHITE 4 -#define TWLS_UV 5 -#define TWLS_IR 6 - -/* TWEI_MAGTYPE values */ -#define TWMD_MICR 0 -#define TWMD_RAW 1 -#define TWMD_INVALID 2 - -/* ICAP_NOISEFILTER values */ -#define TWNF_NONE 0 -#define TWNF_AUTO 1 -#define TWNF_LONEPIXEL 2 -#define TWNF_MAJORITYRULE 3 - -/* ICAP_ORIENTATION values */ -#define TWOR_ROT0 0 -#define TWOR_ROT90 1 -#define TWOR_ROT180 2 -#define TWOR_ROT270 3 -#define TWOR_PORTRAIT TWOR_ROT0 -#define TWOR_LANDSCAPE TWOR_ROT270 -#define TWOR_AUTO 4 -#define TWOR_AUTOTEXT 5 -#define TWOR_AUTOPICTURE 6 - -/* ICAP_OVERSCAN values */ -#define TWOV_NONE 0 -#define TWOV_AUTO 1 -#define TWOV_TOPBOTTOM 2 -#define TWOV_LEFTRIGHT 3 -#define TWOV_ALL 4 - -/* Palette types for TW_PALETTE8 */ -#define TWPA_RGB 0 -#define TWPA_GRAY 1 -#define TWPA_CMY 2 - -/* ICAP_PLANARCHUNKY values */ -#define TWPC_CHUNKY 0 -#define TWPC_PLANAR 1 - -/* TWEI_PATCHCODE values*/ -#define TWPCH_PATCH1 0 -#define TWPCH_PATCH2 1 -#define TWPCH_PATCH3 2 -#define TWPCH_PATCH4 3 -#define TWPCH_PATCH6 4 -#define TWPCH_PATCHT 5 - -/* ICAP_PIXELFLAVOR values */ -#define TWPF_CHOCOLATE 0 -#define TWPF_VANILLA 1 - -/* CAP_PRINTERMODE values */ -#define TWPM_SINGLESTRING 0 -#define TWPM_MULTISTRING 1 -#define TWPM_COMPOUNDSTRING 2 - -/* CAP_PRINTER values */ -#define TWPR_IMPRINTERTOPBEFORE 0 -#define TWPR_IMPRINTERTOPAFTER 1 -#define TWPR_IMPRINTERBOTTOMBEFORE 2 -#define TWPR_IMPRINTERBOTTOMAFTER 3 -#define TWPR_ENDORSERTOPBEFORE 4 -#define TWPR_ENDORSERTOPAFTER 5 -#define TWPR_ENDORSERBOTTOMBEFORE 6 -#define TWPR_ENDORSERBOTTOMAFTER 7 - -/* CAP_PRINTERFONTSTYLE Added 2.3 */ -#define TWPF_NORMAL 0 -#define TWPF_BOLD 1 -#define TWPF_ITALIC 2 -#define TWPF_LARGESIZE 3 -#define TWPF_SMALLSIZE 4 - -/* CAP_PRINTERINDEXTRIGGER Added 2.3 */ -#define TWCT_PAGE 0 -#define TWCT_PATCH1 1 -#define TWCT_PATCH2 2 -#define TWCT_PATCH3 3 -#define TWCT_PATCH4 4 -#define TWCT_PATCHT 5 -#define TWCT_PATCH6 6 - -/* CAP_POWERSUPPLY values */ -#define TWPS_EXTERNAL 0 -#define TWPS_BATTERY 1 - -/* ICAP_PIXELTYPE values (PT_ means Pixel Type) */ -#define TWPT_BW 0 -#define TWPT_GRAY 1 -#define TWPT_RGB 2 -#define TWPT_PALETTE 3 -#define TWPT_CMY 4 -#define TWPT_CMYK 5 -#define TWPT_YUV 6 -#define TWPT_YUVK 7 -#define TWPT_CIEXYZ 8 -#define TWPT_LAB 9 -#define TWPT_SRGB 10 -#define TWPT_SCRGB 11 -#define TWPT_INFRARED 16 - -/* CAP_SEGMENTED values */ -#define TWSG_NONE 0 -#define TWSG_AUTO 1 -#define TWSG_MANUAL 2 - -/* ICAP_FILMTYPE values */ -#define TWFM_POSITIVE 0 -#define TWFM_NEGATIVE 1 - -/* CAP_DOUBLEFEEDDETECTION */ -#define TWDF_ULTRASONIC 0 -#define TWDF_BYLENGTH 1 -#define TWDF_INFRARED 2 - -/* CAP_DOUBLEFEEDDETECTIONSENSITIVITY */ -#define TWUS_LOW 0 -#define TWUS_MEDIUM 1 -#define TWUS_HIGH 2 - -/* CAP_DOUBLEFEEDDETECTIONRESPONSE */ -#define TWDP_STOP 0 -#define TWDP_STOPANDWAIT 1 -#define TWDP_SOUND 2 -#define TWDP_DONOTIMPRINT 3 - -/* ICAP_MIRROR values */ -#define TWMR_NONE 0 -#define TWMR_VERTICAL 1 -#define TWMR_HORIZONTAL 2 - -/* ICAP_JPEGSUBSAMPLING values */ -#define TWJS_444YCBCR 0 -#define TWJS_444RGB 1 -#define TWJS_422 2 -#define TWJS_421 3 -#define TWJS_411 4 -#define TWJS_420 5 -#define TWJS_410 6 -#define TWJS_311 7 - -/* CAP_PAPERHANDLING values */ -#define TWPH_NORMAL 0 -#define TWPH_FRAGILE 1 -#define TWPH_THICK 2 -#define TWPH_TRIFOLD 3 -#define TWPH_PHOTOGRAPH 4 - -/* CAP_INDICATORSMODE values */ -#define TWCI_INFO 0 -#define TWCI_WARNING 1 -#define TWCI_ERROR 2 -#define TWCI_WARMUP 3 - -/* ICAP_SUPPORTEDSIZES values (SS_ means Supported Sizes) */ -#define TWSS_NONE 0 -#define TWSS_A4 1 -#define TWSS_JISB5 2 -#define TWSS_USLETTER 3 -#define TWSS_USLEGAL 4 -#define TWSS_A5 5 -#define TWSS_ISOB4 6 -#define TWSS_ISOB6 7 -#define TWSS_USLEDGER 9 -#define TWSS_USEXECUTIVE 10 -#define TWSS_A3 11 -#define TWSS_ISOB3 12 -#define TWSS_A6 13 -#define TWSS_C4 14 -#define TWSS_C5 15 -#define TWSS_C6 16 -#define TWSS_4A0 17 -#define TWSS_2A0 18 -#define TWSS_A0 19 -#define TWSS_A1 20 -#define TWSS_A2 21 -#define TWSS_A7 22 -#define TWSS_A8 23 -#define TWSS_A9 24 -#define TWSS_A10 25 -#define TWSS_ISOB0 26 -#define TWSS_ISOB1 27 -#define TWSS_ISOB2 28 -#define TWSS_ISOB5 29 -#define TWSS_ISOB7 30 -#define TWSS_ISOB8 31 -#define TWSS_ISOB9 32 -#define TWSS_ISOB10 33 -#define TWSS_JISB0 34 -#define TWSS_JISB1 35 -#define TWSS_JISB2 36 -#define TWSS_JISB3 37 -#define TWSS_JISB4 38 -#define TWSS_JISB6 39 -#define TWSS_JISB7 40 -#define TWSS_JISB8 41 -#define TWSS_JISB9 42 -#define TWSS_JISB10 43 -#define TWSS_C0 44 -#define TWSS_C1 45 -#define TWSS_C2 46 -#define TWSS_C3 47 -#define TWSS_C7 48 -#define TWSS_C8 49 -#define TWSS_C9 50 -#define TWSS_C10 51 -#define TWSS_USSTATEMENT 52 -#define TWSS_BUSINESSCARD 53 -#define TWSS_MAXSIZE 54 - -/* ICAP_XFERMECH values (SX_ means Setup XFer) */ -#define TWSX_NATIVE 0 -#define TWSX_FILE 1 -#define TWSX_MEMORY 2 -#define TWSX_MEMFILE 4 - -/* ICAP_UNITS values (UN_ means UNits) */ -#define TWUN_INCHES 0 -#define TWUN_CENTIMETERS 1 -#define TWUN_PICAS 2 -#define TWUN_POINTS 3 -#define TWUN_TWIPS 4 -#define TWUN_PIXELS 5 -#define TWUN_MILLIMETERS 6 - - -/**************************************************************************** - * Country Constants * - ****************************************************************************/ - -#define TWCY_AFGHANISTAN 1001 -#define TWCY_ALGERIA 213 -#define TWCY_AMERICANSAMOA 684 -#define TWCY_ANDORRA 033 -#define TWCY_ANGOLA 1002 -#define TWCY_ANGUILLA 8090 -#define TWCY_ANTIGUA 8091 -#define TWCY_ARGENTINA 54 -#define TWCY_ARUBA 297 -#define TWCY_ASCENSIONI 247 -#define TWCY_AUSTRALIA 61 -#define TWCY_AUSTRIA 43 -#define TWCY_BAHAMAS 8092 -#define TWCY_BAHRAIN 973 -#define TWCY_BANGLADESH 880 -#define TWCY_BARBADOS 8093 -#define TWCY_BELGIUM 32 -#define TWCY_BELIZE 501 -#define TWCY_BENIN 229 -#define TWCY_BERMUDA 8094 -#define TWCY_BHUTAN 1003 -#define TWCY_BOLIVIA 591 -#define TWCY_BOTSWANA 267 -#define TWCY_BRITAIN 6 -#define TWCY_BRITVIRGINIS 8095 -#define TWCY_BRAZIL 55 -#define TWCY_BRUNEI 673 -#define TWCY_BULGARIA 359 -#define TWCY_BURKINAFASO 1004 -#define TWCY_BURMA 1005 -#define TWCY_BURUNDI 1006 -#define TWCY_CAMAROON 237 -#define TWCY_CANADA 2 -#define TWCY_CAPEVERDEIS 238 -#define TWCY_CAYMANIS 8096 -#define TWCY_CENTRALAFREP 1007 -#define TWCY_CHAD 1008 -#define TWCY_CHILE 56 -#define TWCY_CHINA 86 -#define TWCY_CHRISTMASIS 1009 -#define TWCY_COCOSIS 1009 -#define TWCY_COLOMBIA 57 -#define TWCY_COMOROS 1010 -#define TWCY_CONGO 1011 -#define TWCY_COOKIS 1012 -#define TWCY_COSTARICA 506 -#define TWCY_CUBA 005 -#define TWCY_CYPRUS 357 -#define TWCY_CZECHOSLOVAKIA 42 -#define TWCY_DENMARK 45 -#define TWCY_DJIBOUTI 1013 -#define TWCY_DOMINICA 8097 -#define TWCY_DOMINCANREP 8098 -#define TWCY_EASTERIS 1014 -#define TWCY_ECUADOR 593 -#define TWCY_EGYPT 20 -#define TWCY_ELSALVADOR 503 -#define TWCY_EQGUINEA 1015 -#define TWCY_ETHIOPIA 251 -#define TWCY_FALKLANDIS 1016 -#define TWCY_FAEROEIS 298 -#define TWCY_FIJIISLANDS 679 -#define TWCY_FINLAND 358 -#define TWCY_FRANCE 33 -#define TWCY_FRANTILLES 596 -#define TWCY_FRGUIANA 594 -#define TWCY_FRPOLYNEISA 689 -#define TWCY_FUTANAIS 1043 -#define TWCY_GABON 241 -#define TWCY_GAMBIA 220 -#define TWCY_GERMANY 49 -#define TWCY_GHANA 233 -#define TWCY_GIBRALTER 350 -#define TWCY_GREECE 30 -#define TWCY_GREENLAND 299 -#define TWCY_GRENADA 8099 -#define TWCY_GRENEDINES 8015 -#define TWCY_GUADELOUPE 590 -#define TWCY_GUAM 671 -#define TWCY_GUANTANAMOBAY 5399 -#define TWCY_GUATEMALA 502 -#define TWCY_GUINEA 224 -#define TWCY_GUINEABISSAU 1017 -#define TWCY_GUYANA 592 -#define TWCY_HAITI 509 -#define TWCY_HONDURAS 504 -#define TWCY_HONGKONG 852 -#define TWCY_HUNGARY 36 -#define TWCY_ICELAND 354 -#define TWCY_INDIA 91 -#define TWCY_INDONESIA 62 -#define TWCY_IRAN 98 -#define TWCY_IRAQ 964 -#define TWCY_IRELAND 353 -#define TWCY_ISRAEL 972 -#define TWCY_ITALY 39 -#define TWCY_IVORYCOAST 225 -#define TWCY_JAMAICA 8010 -#define TWCY_JAPAN 81 -#define TWCY_JORDAN 962 -#define TWCY_KENYA 254 -#define TWCY_KIRIBATI 1018 -#define TWCY_KOREA 82 -#define TWCY_KUWAIT 965 -#define TWCY_LAOS 1019 -#define TWCY_LEBANON 1020 -#define TWCY_LIBERIA 231 -#define TWCY_LIBYA 218 -#define TWCY_LIECHTENSTEIN 41 -#define TWCY_LUXENBOURG 352 -#define TWCY_MACAO 853 -#define TWCY_MADAGASCAR 1021 -#define TWCY_MALAWI 265 -#define TWCY_MALAYSIA 60 -#define TWCY_MALDIVES 960 -#define TWCY_MALI 1022 -#define TWCY_MALTA 356 -#define TWCY_MARSHALLIS 692 -#define TWCY_MAURITANIA 1023 -#define TWCY_MAURITIUS 230 -#define TWCY_MEXICO 3 -#define TWCY_MICRONESIA 691 -#define TWCY_MIQUELON 508 -#define TWCY_MONACO 33 -#define TWCY_MONGOLIA 1024 -#define TWCY_MONTSERRAT 8011 -#define TWCY_MOROCCO 212 -#define TWCY_MOZAMBIQUE 1025 -#define TWCY_NAMIBIA 264 -#define TWCY_NAURU 1026 -#define TWCY_NEPAL 977 -#define TWCY_NETHERLANDS 31 -#define TWCY_NETHANTILLES 599 -#define TWCY_NEVIS 8012 -#define TWCY_NEWCALEDONIA 687 -#define TWCY_NEWZEALAND 64 -#define TWCY_NICARAGUA 505 -#define TWCY_NIGER 227 -#define TWCY_NIGERIA 234 -#define TWCY_NIUE 1027 -#define TWCY_NORFOLKI 1028 -#define TWCY_NORWAY 47 -#define TWCY_OMAN 968 -#define TWCY_PAKISTAN 92 -#define TWCY_PALAU 1029 -#define TWCY_PANAMA 507 -#define TWCY_PARAGUAY 595 -#define TWCY_PERU 51 -#define TWCY_PHILLIPPINES 63 -#define TWCY_PITCAIRNIS 1030 -#define TWCY_PNEWGUINEA 675 -#define TWCY_POLAND 48 -#define TWCY_PORTUGAL 351 -#define TWCY_QATAR 974 -#define TWCY_REUNIONI 1031 -#define TWCY_ROMANIA 40 -#define TWCY_RWANDA 250 -#define TWCY_SAIPAN 670 -#define TWCY_SANMARINO 39 -#define TWCY_SAOTOME 1033 -#define TWCY_SAUDIARABIA 966 -#define TWCY_SENEGAL 221 -#define TWCY_SEYCHELLESIS 1034 -#define TWCY_SIERRALEONE 1035 -#define TWCY_SINGAPORE 65 -#define TWCY_SOLOMONIS 1036 -#define TWCY_SOMALI 1037 -#define TWCY_SOUTHAFRICA 27 -#define TWCY_SPAIN 34 -#define TWCY_SRILANKA 94 -#define TWCY_STHELENA 1032 -#define TWCY_STKITTS 8013 -#define TWCY_STLUCIA 8014 -#define TWCY_STPIERRE 508 -#define TWCY_STVINCENT 8015 -#define TWCY_SUDAN 1038 -#define TWCY_SURINAME 597 -#define TWCY_SWAZILAND 268 -#define TWCY_SWEDEN 46 -#define TWCY_SWITZERLAND 41 -#define TWCY_SYRIA 1039 -#define TWCY_TAIWAN 886 -#define TWCY_TANZANIA 255 -#define TWCY_THAILAND 66 -#define TWCY_TOBAGO 8016 -#define TWCY_TOGO 228 -#define TWCY_TONGAIS 676 -#define TWCY_TRINIDAD 8016 -#define TWCY_TUNISIA 216 -#define TWCY_TURKEY 90 -#define TWCY_TURKSCAICOS 8017 -#define TWCY_TUVALU 1040 -#define TWCY_UGANDA 256 -#define TWCY_USSR 7 -#define TWCY_UAEMIRATES 971 -#define TWCY_UNITEDKINGDOM 44 -#define TWCY_USA 1 -#define TWCY_URUGUAY 598 -#define TWCY_VANUATU 1041 -#define TWCY_VATICANCITY 39 -#define TWCY_VENEZUELA 58 -#define TWCY_WAKE 1042 -#define TWCY_WALLISIS 1043 -#define TWCY_WESTERNSAHARA 1044 -#define TWCY_WESTERNSAMOA 1045 -#define TWCY_YEMEN 1046 -#define TWCY_YUGOSLAVIA 38 -#define TWCY_ZAIRE 243 -#define TWCY_ZAMBIA 260 -#define TWCY_ZIMBABWE 263 -#define TWCY_ALBANIA 355 -#define TWCY_ARMENIA 374 -#define TWCY_AZERBAIJAN 994 -#define TWCY_BELARUS 375 -#define TWCY_BOSNIAHERZGO 387 -#define TWCY_CAMBODIA 855 -#define TWCY_CROATIA 385 -#define TWCY_CZECHREPUBLIC 420 -#define TWCY_DIEGOGARCIA 246 -#define TWCY_ERITREA 291 -#define TWCY_ESTONIA 372 -#define TWCY_GEORGIA 995 -#define TWCY_LATVIA 371 -#define TWCY_LESOTHO 266 -#define TWCY_LITHUANIA 370 -#define TWCY_MACEDONIA 389 -#define TWCY_MAYOTTEIS 269 -#define TWCY_MOLDOVA 373 -#define TWCY_MYANMAR 95 -#define TWCY_NORTHKOREA 850 -#define TWCY_PUERTORICO 787 -#define TWCY_RUSSIA 7 -#define TWCY_SERBIA 381 -#define TWCY_SLOVAKIA 421 -#define TWCY_SLOVENIA 386 -#define TWCY_SOUTHKOREA 82 -#define TWCY_UKRAINE 380 -#define TWCY_USVIRGINIS 340 -#define TWCY_VIETNAM 84 - -/**************************************************************************** - * Language Constants * - ****************************************************************************/ -#define TWLG_USERLOCALE -1 -#define TWLG_DAN 0 -#define TWLG_DUT 1 -#define TWLG_ENG 2 -#define TWLG_FCF 3 -#define TWLG_FIN 4 -#define TWLG_FRN 5 -#define TWLG_GER 6 -#define TWLG_ICE 7 -#define TWLG_ITN 8 -#define TWLG_NOR 9 -#define TWLG_POR 10 -#define TWLG_SPA 11 -#define TWLG_SWE 12 -#define TWLG_USA 13 -#define TWLG_AFRIKAANS 14 -#define TWLG_ALBANIA 15 -#define TWLG_ARABIC 16 -#define TWLG_ARABIC_ALGERIA 17 -#define TWLG_ARABIC_BAHRAIN 18 -#define TWLG_ARABIC_EGYPT 19 -#define TWLG_ARABIC_IRAQ 20 -#define TWLG_ARABIC_JORDAN 21 -#define TWLG_ARABIC_KUWAIT 22 -#define TWLG_ARABIC_LEBANON 23 -#define TWLG_ARABIC_LIBYA 24 -#define TWLG_ARABIC_MOROCCO 25 -#define TWLG_ARABIC_OMAN 26 -#define TWLG_ARABIC_QATAR 27 -#define TWLG_ARABIC_SAUDIARABIA 28 -#define TWLG_ARABIC_SYRIA 29 -#define TWLG_ARABIC_TUNISIA 30 -#define TWLG_ARABIC_UAE 31 -#define TWLG_ARABIC_YEMEN 32 -#define TWLG_BASQUE 33 -#define TWLG_BYELORUSSIAN 34 -#define TWLG_BULGARIAN 35 -#define TWLG_CATALAN 36 -#define TWLG_CHINESE 37 -#define TWLG_CHINESE_HONGKONG 38 -#define TWLG_CHINESE_PRC 39 -#define TWLG_CHINESE_SINGAPORE 40 -#define TWLG_CHINESE_SIMPLIFIED 41 -#define TWLG_CHINESE_TAIWAN 42 -#define TWLG_CHINESE_TRADITIONAL 43 -#define TWLG_CROATIA 44 -#define TWLG_CZECH 45 -#define TWLG_DANISH TWLG_DAN -#define TWLG_DUTCH TWLG_DUT -#define TWLG_DUTCH_BELGIAN 46 -#define TWLG_ENGLISH TWLG_ENG -#define TWLG_ENGLISH_AUSTRALIAN 47 -#define TWLG_ENGLISH_CANADIAN 48 -#define TWLG_ENGLISH_IRELAND 49 -#define TWLG_ENGLISH_NEWZEALAND 50 -#define TWLG_ENGLISH_SOUTHAFRICA 51 -#define TWLG_ENGLISH_UK 52 -#define TWLG_ENGLISH_USA TWLG_USA -#define TWLG_ESTONIAN 53 -#define TWLG_FAEROESE 54 -#define TWLG_FARSI 55 -#define TWLG_FINNISH TWLG_FIN -#define TWLG_FRENCH TWLG_FRN -#define TWLG_FRENCH_BELGIAN 56 -#define TWLG_FRENCH_CANADIAN TWLG_FCF -#define TWLG_FRENCH_LUXEMBOURG 57 -#define TWLG_FRENCH_SWISS 58 -#define TWLG_GERMAN TWLG_GER -#define TWLG_GERMAN_AUSTRIAN 59 -#define TWLG_GERMAN_LUXEMBOURG 60 -#define TWLG_GERMAN_LIECHTENSTEIN 61 -#define TWLG_GERMAN_SWISS 62 -#define TWLG_GREEK 63 -#define TWLG_HEBREW 64 -#define TWLG_HUNGARIAN 65 -#define TWLG_ICELANDIC TWLG_ICE -#define TWLG_INDONESIAN 66 -#define TWLG_ITALIAN TWLG_ITN -#define TWLG_ITALIAN_SWISS 67 -#define TWLG_JAPANESE 68 -#define TWLG_KOREAN 69 -#define TWLG_KOREAN_JOHAB 70 -#define TWLG_LATVIAN 71 -#define TWLG_LITHUANIAN 72 -#define TWLG_NORWEGIAN TWLG_NOR -#define TWLG_NORWEGIAN_BOKMAL 73 -#define TWLG_NORWEGIAN_NYNORSK 74 -#define TWLG_POLISH 75 -#define TWLG_PORTUGUESE TWLG_POR -#define TWLG_PORTUGUESE_BRAZIL 76 -#define TWLG_ROMANIAN 77 -#define TWLG_RUSSIAN 78 -#define TWLG_SERBIAN_LATIN 79 -#define TWLG_SLOVAK 80 -#define TWLG_SLOVENIAN 81 -#define TWLG_SPANISH TWLG_SPA -#define TWLG_SPANISH_MEXICAN 82 -#define TWLG_SPANISH_MODERN 83 -#define TWLG_SWEDISH TWLG_SWE -#define TWLG_THAI 84 -#define TWLG_TURKISH 85 -#define TWLG_UKRANIAN 86 -#define TWLG_ASSAMESE 87 -#define TWLG_BENGALI 88 -#define TWLG_BIHARI 89 -#define TWLG_BODO 90 -#define TWLG_DOGRI 91 -#define TWLG_GUJARATI 92 -#define TWLG_HARYANVI 93 -#define TWLG_HINDI 94 -#define TWLG_KANNADA 95 -#define TWLG_KASHMIRI 96 -#define TWLG_MALAYALAM 97 -#define TWLG_MARATHI 98 -#define TWLG_MARWARI 99 -#define TWLG_MEGHALAYAN 100 -#define TWLG_MIZO 101 -#define TWLG_NAGA 102 -#define TWLG_ORISSI 103 -#define TWLG_PUNJABI 104 -#define TWLG_PUSHTU 105 -#define TWLG_SERBIAN_CYRILLIC 106 -#define TWLG_SIKKIMI 107 -#define TWLG_SWEDISH_FINLAND 108 -#define TWLG_TAMIL 109 -#define TWLG_TELUGU 110 -#define TWLG_TRIPURI 111 -#define TWLG_URDU 112 -#define TWLG_VIETNAMESE 113 - - -/**************************************************************************** - * Data Groups * - ****************************************************************************/ -#define DG_CONTROL 0x0001L -#define DG_IMAGE 0x0002L -#define DG_AUDIO 0x0004L - -/* More Data Functionality may be added in the future. - * These are for items that need to be determined before DS is opened. - * NOTE: Supported Functionality constants must be powers of 2 as they are - * used as bitflags when Application asks DSM to present a list of DSs. - * to support backward capability the App and DS will not use the fields - */ -#define DF_DSM2 0x10000000L -#define DF_APP2 0x20000000L - -#define DF_DS2 0x40000000L - -#define DG_MASK 0xFFFFL - -/**************************************************************************** - * * - ****************************************************************************/ -#define DAT_NULL 0x0000 -#define DAT_CUSTOMBASE 0x8000 - -/* Data Argument Types for the DG_CONTROL Data Group. */ -#define DAT_CAPABILITY 0x0001 -#define DAT_EVENT 0x0002 -#define DAT_IDENTITY 0x0003 -#define DAT_PARENT 0x0004 -#define DAT_PENDINGXFERS 0x0005 -#define DAT_SETUPMEMXFER 0x0006 -#define DAT_SETUPFILEXFER 0x0007 -#define DAT_STATUS 0x0008 -#define DAT_USERINTERFACE 0x0009 -#define DAT_XFERGROUP 0x000a -#define DAT_CUSTOMDSDATA 0x000c -#define DAT_DEVICEEVENT 0x000d -#define DAT_FILESYSTEM 0x000e -#define DAT_PASSTHRU 0x000f -#define DAT_CALLBACK 0x0010 -#define DAT_STATUSUTF8 0x0011 -#define DAT_CALLBACK2 0x0012 - -/* Data Argument Types for the DG_IMAGE Data Group. */ -#define DAT_IMAGEINFO 0x0101 -#define DAT_IMAGELAYOUT 0x0102 -#define DAT_IMAGEMEMXFER 0x0103 -#define DAT_IMAGENATIVEXFER 0x0104 -#define DAT_IMAGEFILEXFER 0x0105 -#define DAT_CIECOLOR 0x0106 -#define DAT_GRAYRESPONSE 0x0107 -#define DAT_RGBRESPONSE 0x0108 -#define DAT_JPEGCOMPRESSION 0x0109 -#define DAT_PALETTE8 0x010a -#define DAT_EXTIMAGEINFO 0x010b -#define DAT_FILTER 0x010c - -/* Data Argument Types for the DG_AUDIO Data Group. */ -#define DAT_AUDIOFILEXFER 0x0201 -#define DAT_AUDIOINFO 0x0202 -#define DAT_AUDIONATIVEXFER 0x0203 - -/* misplaced */ -#define DAT_ICCPROFILE 0x0401 -#define DAT_IMAGEMEMFILEXFER 0x0402 -#define DAT_ENTRYPOINT 0x0403 - - -/**************************************************************************** - * Messages * - ****************************************************************************/ - -/* All message constants are unique. - * Messages are grouped according to which DATs they are used with.*/ - -#define MSG_NULL 0x0000 -#define MSG_CUSTOMBASE 0x8000 - -/* Generic messages may be used with any of several DATs. */ -#define MSG_GET 0x0001 -#define MSG_GETCURRENT 0x0002 -#define MSG_GETDEFAULT 0x0003 -#define MSG_GETFIRST 0x0004 -#define MSG_GETNEXT 0x0005 -#define MSG_SET 0x0006 -#define MSG_RESET 0x0007 -#define MSG_QUERYSUPPORT 0x0008 -#define MSG_GETHELP 0x0009 -#define MSG_GETLABEL 0x000a -#define MSG_GETLABELENUM 0x000b -#define MSG_SETCONSTRAINT 0x000c - -/* Messages used with DAT_NULL */ -#define MSG_XFERREADY 0x0101 -#define MSG_CLOSEDSREQ 0x0102 -#define MSG_CLOSEDSOK 0x0103 -#define MSG_DEVICEEVENT 0X0104 - -/* Messages used with a pointer to DAT_PARENT data */ -#define MSG_OPENDSM 0x0301 -#define MSG_CLOSEDSM 0x0302 - -/* Messages used with a pointer to a DAT_IDENTITY structure */ -#define MSG_OPENDS 0x0401 -#define MSG_CLOSEDS 0x0402 -#define MSG_USERSELECT 0x0403 - -/* Messages used with a pointer to a DAT_USERINTERFACE structure */ -#define MSG_DISABLEDS 0x0501 -#define MSG_ENABLEDS 0x0502 -#define MSG_ENABLEDSUIONLY 0x0503 - -/* Messages used with a pointer to a DAT_EVENT structure */ -#define MSG_PROCESSEVENT 0x0601 - -/* Messages used with a pointer to a DAT_PENDINGXFERS structure */ -#define MSG_ENDXFER 0x0701 -#define MSG_STOPFEEDER 0x0702 - -/* Messages used with a pointer to a DAT_FILESYSTEM structure */ -#define MSG_CHANGEDIRECTORY 0x0801 -#define MSG_CREATEDIRECTORY 0x0802 -#define MSG_DELETE 0x0803 -#define MSG_FORMATMEDIA 0x0804 -#define MSG_GETCLOSE 0x0805 -#define MSG_GETFIRSTFILE 0x0806 -#define MSG_GETINFO 0x0807 -#define MSG_GETNEXTFILE 0x0808 -#define MSG_RENAME 0x0809 -#define MSG_COPY 0x080A -#define MSG_AUTOMATICCAPTUREDIRECTORY 0x080B - -/* Messages used with a pointer to a DAT_PASSTHRU structure */ -#define MSG_PASSTHRU 0x0901 - -/* used with DAT_CALLBACK */ -#define MSG_REGISTER_CALLBACK 0x0902 - -/* used with DAT_CAPABILITY */ -#define MSG_RESETALL 0x0A01 - -/**************************************************************************** - * Capabilities * - ****************************************************************************/ - -#define CAP_CUSTOMBASE 0x8000 /* Base of custom capabilities */ - -/* all data sources are REQUIRED to support these caps */ -#define CAP_XFERCOUNT 0x0001 - -/* image data sources are REQUIRED to support these caps */ -#define ICAP_COMPRESSION 0x0100 -#define ICAP_PIXELTYPE 0x0101 -#define ICAP_UNITS 0x0102 -#define ICAP_XFERMECH 0x0103 - -/* all data sources MAY support these caps */ -#define CAP_AUTHOR 0x1000 -#define CAP_CAPTION 0x1001 -#define CAP_FEEDERENABLED 0x1002 -#define CAP_FEEDERLOADED 0x1003 -#define CAP_TIMEDATE 0x1004 -#define CAP_SUPPORTEDCAPS 0x1005 -#define CAP_EXTENDEDCAPS 0x1006 -#define CAP_AUTOFEED 0x1007 -#define CAP_CLEARPAGE 0x1008 -#define CAP_FEEDPAGE 0x1009 -#define CAP_REWINDPAGE 0x100a -#define CAP_INDICATORS 0x100b -#define CAP_PAPERDETECTABLE 0x100d -#define CAP_UICONTROLLABLE 0x100e -#define CAP_DEVICEONLINE 0x100f -#define CAP_AUTOSCAN 0x1010 -#define CAP_THUMBNAILSENABLED 0x1011 -#define CAP_DUPLEX 0x1012 -#define CAP_DUPLEXENABLED 0x1013 -#define CAP_ENABLEDSUIONLY 0x1014 -#define CAP_CUSTOMDSDATA 0x1015 -#define CAP_ENDORSER 0x1016 -#define CAP_JOBCONTROL 0x1017 -#define CAP_ALARMS 0x1018 -#define CAP_ALARMVOLUME 0x1019 -#define CAP_AUTOMATICCAPTURE 0x101a -#define CAP_TIMEBEFOREFIRSTCAPTURE 0x101b -#define CAP_TIMEBETWEENCAPTURES 0x101c -#define CAP_CLEARBUFFERS 0x101d -#define CAP_MAXBATCHBUFFERS 0x101e -#define CAP_DEVICETIMEDATE 0x101f -#define CAP_POWERSUPPLY 0x1020 -#define CAP_CAMERAPREVIEWUI 0x1021 -#define CAP_DEVICEEVENT 0x1022 -#define CAP_SERIALNUMBER 0x1024 -#define CAP_PRINTER 0x1026 -#define CAP_PRINTERENABLED 0x1027 -#define CAP_PRINTERINDEX 0x1028 -#define CAP_PRINTERMODE 0x1029 -#define CAP_PRINTERSTRING 0x102a -#define CAP_PRINTERSUFFIX 0x102b -#define CAP_LANGUAGE 0x102c -#define CAP_FEEDERALIGNMENT 0x102d -#define CAP_FEEDERORDER 0x102e -#define CAP_REACQUIREALLOWED 0x1030 -#define CAP_BATTERYMINUTES 0x1032 -#define CAP_BATTERYPERCENTAGE 0x1033 -#define CAP_CAMERASIDE 0x1034 -#define CAP_SEGMENTED 0x1035 -#define CAP_CAMERAENABLED 0x1036 -#define CAP_CAMERAORDER 0x1037 -#define CAP_MICRENABLED 0x1038 -#define CAP_FEEDERPREP 0x1039 -#define CAP_FEEDERPOCKET 0x103a -#define CAP_AUTOMATICSENSEMEDIUM 0x103b -#define CAP_CUSTOMINTERFACEGUID 0x103c -#define CAP_SUPPORTEDCAPSSEGMENTUNIQUE 0x103d -#define CAP_SUPPORTEDDATS 0x103e -#define CAP_DOUBLEFEEDDETECTION 0x103f -#define CAP_DOUBLEFEEDDETECTIONLENGTH 0x1040 -#define CAP_DOUBLEFEEDDETECTIONSENSITIVITY 0x1041 -#define CAP_DOUBLEFEEDDETECTIONRESPONSE 0x1042 -#define CAP_PAPERHANDLING 0x1043 -#define CAP_INDICATORSMODE 0x1044 -#define CAP_PRINTERVERTICALOFFSET 0x1045 -#define CAP_POWERSAVETIME 0x1046 -#define CAP_PRINTERCHARROTATION 0x1047 -#define CAP_PRINTERFONTSTYLE 0x1048 -#define CAP_PRINTERINDEXLEADCHAR 0x1049 -#define CAP_PRINTERINDEXMAXVALUE 0x104A -#define CAP_PRINTERINDEXNUMDIGITS 0x104B -#define CAP_PRINTERINDEXSTEP 0x104C -#define CAP_PRINTERINDEXTRIGGER 0x104D -#define CAP_PRINTERSTRINGPREVIEW 0x104E - - - -/* image data sources MAY support these caps */ -#define ICAP_AUTOBRIGHT 0x1100 -#define ICAP_BRIGHTNESS 0x1101 -#define ICAP_CONTRAST 0x1103 -#define ICAP_CUSTHALFTONE 0x1104 -#define ICAP_EXPOSURETIME 0x1105 -#define ICAP_FILTER 0x1106 -#define ICAP_FLASHUSED 0x1107 -#define ICAP_GAMMA 0x1108 -#define ICAP_HALFTONES 0x1109 -#define ICAP_HIGHLIGHT 0x110a -#define ICAP_IMAGEFILEFORMAT 0x110c -#define ICAP_LAMPSTATE 0x110d -#define ICAP_LIGHTSOURCE 0x110e -#define ICAP_ORIENTATION 0x1110 -#define ICAP_PHYSICALWIDTH 0x1111 -#define ICAP_PHYSICALHEIGHT 0x1112 -#define ICAP_SHADOW 0x1113 -#define ICAP_FRAMES 0x1114 -#define ICAP_XNATIVERESOLUTION 0x1116 -#define ICAP_YNATIVERESOLUTION 0x1117 -#define ICAP_XRESOLUTION 0x1118 -#define ICAP_YRESOLUTION 0x1119 -#define ICAP_MAXFRAMES 0x111a -#define ICAP_TILES 0x111b -#define ICAP_BITORDER 0x111c -#define ICAP_CCITTKFACTOR 0x111d -#define ICAP_LIGHTPATH 0x111e -#define ICAP_PIXELFLAVOR 0x111f -#define ICAP_PLANARCHUNKY 0x1120 -#define ICAP_ROTATION 0x1121 -#define ICAP_SUPPORTEDSIZES 0x1122 -#define ICAP_THRESHOLD 0x1123 -#define ICAP_XSCALING 0x1124 -#define ICAP_YSCALING 0x1125 -#define ICAP_BITORDERCODES 0x1126 -#define ICAP_PIXELFLAVORCODES 0x1127 -#define ICAP_JPEGPIXELTYPE 0x1128 -#define ICAP_TIMEFILL 0x112a -#define ICAP_BITDEPTH 0x112b -#define ICAP_BITDEPTHREDUCTION 0x112c -#define ICAP_UNDEFINEDIMAGESIZE 0x112d -#define ICAP_IMAGEDATASET 0x112e -#define ICAP_EXTIMAGEINFO 0x112f -#define ICAP_MINIMUMHEIGHT 0x1130 -#define ICAP_MINIMUMWIDTH 0x1131 -#define ICAP_AUTODISCARDBLANKPAGES 0x1134 -#define ICAP_FLIPROTATION 0x1136 -#define ICAP_BARCODEDETECTIONENABLED 0x1137 -#define ICAP_SUPPORTEDBARCODETYPES 0x1138 -#define ICAP_BARCODEMAXSEARCHPRIORITIES 0x1139 -#define ICAP_BARCODESEARCHPRIORITIES 0x113a -#define ICAP_BARCODESEARCHMODE 0x113b -#define ICAP_BARCODEMAXRETRIES 0x113c -#define ICAP_BARCODETIMEOUT 0x113d -#define ICAP_ZOOMFACTOR 0x113e -#define ICAP_PATCHCODEDETECTIONENABLED 0x113f -#define ICAP_SUPPORTEDPATCHCODETYPES 0x1140 -#define ICAP_PATCHCODEMAXSEARCHPRIORITIES 0x1141 -#define ICAP_PATCHCODESEARCHPRIORITIES 0x1142 -#define ICAP_PATCHCODESEARCHMODE 0x1143 -#define ICAP_PATCHCODEMAXRETRIES 0x1144 -#define ICAP_PATCHCODETIMEOUT 0x1145 -#define ICAP_FLASHUSED2 0x1146 -#define ICAP_IMAGEFILTER 0x1147 -#define ICAP_NOISEFILTER 0x1148 -#define ICAP_OVERSCAN 0x1149 -#define ICAP_AUTOMATICBORDERDETECTION 0x1150 -#define ICAP_AUTOMATICDESKEW 0x1151 -#define ICAP_AUTOMATICROTATE 0x1152 -#define ICAP_JPEGQUALITY 0x1153 -#define ICAP_FEEDERTYPE 0x1154 -#define ICAP_ICCPROFILE 0x1155 -#define ICAP_AUTOSIZE 0x1156 -#define ICAP_AUTOMATICCROPUSESFRAME 0x1157 -#define ICAP_AUTOMATICLENGTHDETECTION 0x1158 -#define ICAP_AUTOMATICCOLORENABLED 0x1159 -#define ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE 0x115a -#define ICAP_COLORMANAGEMENTENABLED 0x115b -#define ICAP_IMAGEMERGE 0x115c -#define ICAP_IMAGEMERGEHEIGHTTHRESHOLD 0x115d -#define ICAP_SUPPORTEDEXTIMAGEINFO 0x115e -#define ICAP_FILMTYPE 0x115f -#define ICAP_MIRROR 0x1160 -#define ICAP_JPEGSUBSAMPLING 0x1161 - -/* image data sources MAY support these audio caps */ -#define ACAP_XFERMECH 0x1202 - - -/*************************************************************************** - * Extended Image Info Attributes section Added 1.7 * - ***************************************************************************/ - -#define TWEI_BARCODEX 0x1200 -#define TWEI_BARCODEY 0x1201 -#define TWEI_BARCODETEXT 0x1202 -#define TWEI_BARCODETYPE 0x1203 -#define TWEI_DESHADETOP 0x1204 -#define TWEI_DESHADELEFT 0x1205 -#define TWEI_DESHADEHEIGHT 0x1206 -#define TWEI_DESHADEWIDTH 0x1207 -#define TWEI_DESHADESIZE 0x1208 -#define TWEI_SPECKLESREMOVED 0x1209 -#define TWEI_HORZLINEXCOORD 0x120A -#define TWEI_HORZLINEYCOORD 0x120B -#define TWEI_HORZLINELENGTH 0x120C -#define TWEI_HORZLINETHICKNESS 0x120D -#define TWEI_VERTLINEXCOORD 0x120E -#define TWEI_VERTLINEYCOORD 0x120F -#define TWEI_VERTLINELENGTH 0x1210 -#define TWEI_VERTLINETHICKNESS 0x1211 -#define TWEI_PATCHCODE 0x1212 -#define TWEI_ENDORSEDTEXT 0x1213 -#define TWEI_FORMCONFIDENCE 0x1214 -#define TWEI_FORMTEMPLATEMATCH 0x1215 -#define TWEI_FORMTEMPLATEPAGEMATCH 0x1216 -#define TWEI_FORMHORZDOCOFFSET 0x1217 -#define TWEI_FORMVERTDOCOFFSET 0x1218 -#define TWEI_BARCODECOUNT 0x1219 -#define TWEI_BARCODECONFIDENCE 0x121A -#define TWEI_BARCODEROTATION 0x121B -#define TWEI_BARCODETEXTLENGTH 0x121C -#define TWEI_DESHADECOUNT 0x121D -#define TWEI_DESHADEBLACKCOUNTOLD 0x121E -#define TWEI_DESHADEBLACKCOUNTNEW 0x121F -#define TWEI_DESHADEBLACKRLMIN 0x1220 -#define TWEI_DESHADEBLACKRLMAX 0x1221 -#define TWEI_DESHADEWHITECOUNTOLD 0x1222 -#define TWEI_DESHADEWHITECOUNTNEW 0x1223 -#define TWEI_DESHADEWHITERLMIN 0x1224 -#define TWEI_DESHADEWHITERLAVE 0x1225 -#define TWEI_DESHADEWHITERLMAX 0x1226 -#define TWEI_BLACKSPECKLESREMOVED 0x1227 -#define TWEI_WHITESPECKLESREMOVED 0x1228 -#define TWEI_HORZLINECOUNT 0x1229 -#define TWEI_VERTLINECOUNT 0x122A -#define TWEI_DESKEWSTATUS 0x122B -#define TWEI_SKEWORIGINALANGLE 0x122C -#define TWEI_SKEWFINALANGLE 0x122D -#define TWEI_SKEWCONFIDENCE 0x122E -#define TWEI_SKEWWINDOWX1 0x122F -#define TWEI_SKEWWINDOWY1 0x1230 -#define TWEI_SKEWWINDOWX2 0x1231 -#define TWEI_SKEWWINDOWY2 0x1232 -#define TWEI_SKEWWINDOWX3 0x1233 -#define TWEI_SKEWWINDOWY3 0x1234 -#define TWEI_SKEWWINDOWX4 0x1235 -#define TWEI_SKEWWINDOWY4 0x1236 -#define TWEI_BOOKNAME 0x1238 -#define TWEI_CHAPTERNUMBER 0x1239 -#define TWEI_DOCUMENTNUMBER 0x123A -#define TWEI_PAGENUMBER 0x123B -#define TWEI_CAMERA 0x123C -#define TWEI_FRAMENUMBER 0x123D -#define TWEI_FRAME 0x123E -#define TWEI_PIXELFLAVOR 0x123F -#define TWEI_ICCPROFILE 0x1240 -#define TWEI_LASTSEGMENT 0x1241 -#define TWEI_SEGMENTNUMBER 0x1242 -#define TWEI_MAGDATA 0x1243 -#define TWEI_MAGTYPE 0x1244 -#define TWEI_PAGESIDE 0x1245 -#define TWEI_FILESYSTEMSOURCE 0x1246 -#define TWEI_IMAGEMERGED 0x1247 -#define TWEI_MAGDATALENGTH 0x1248 -#define TWEI_PAPERCOUNT 0x1249 -#define TWEI_PRINTERTEXT 0x124A - -#define TWEJ_NONE 0x0000 -#define TWEJ_MIDSEPARATOR 0x0001 -#define TWEJ_PATCH1 0x0002 -#define TWEJ_PATCH2 0x0003 -#define TWEJ_PATCH3 0x0004 -#define TWEJ_PATCH4 0x0005 -#define TWEJ_PATCH6 0x0006 -#define TWEJ_PATCHT 0x0007 - - -/*************************************************************************** - * Return Codes and Condition Codes section * - ***************************************************************************/ - -#define TWRC_CUSTOMBASE 0x8000 - -#define TWRC_SUCCESS 0 -#define TWRC_FAILURE 1 -#define TWRC_CHECKSTATUS 2 -#define TWRC_CANCEL 3 -#define TWRC_DSEVENT 4 -#define TWRC_NOTDSEVENT 5 -#define TWRC_XFERDONE 6 -#define TWRC_ENDOFLIST 7 -#define TWRC_INFONOTSUPPORTED 8 -#define TWRC_DATANOTAVAILABLE 9 -#define TWRC_BUSY 10 -#define TWRC_SCANNERLOCKED 11 - -/* Condition Codes: Application gets these by doing DG_CONTROL DAT_STATUS MSG_GET. */ -#define TWCC_CUSTOMBASE 0x8000 - -#define TWCC_SUCCESS 0 -#define TWCC_BUMMER 1 -#define TWCC_LOWMEMORY 2 -#define TWCC_NODS 3 -#define TWCC_MAXCONNECTIONS 4 -#define TWCC_OPERATIONERROR 5 -#define TWCC_BADCAP 6 -#define TWCC_BADPROTOCOL 9 -#define TWCC_BADVALUE 10 -#define TWCC_SEQERROR 11 -#define TWCC_BADDEST 12 -#define TWCC_CAPUNSUPPORTED 13 -#define TWCC_CAPBADOPERATION 14 -#define TWCC_CAPSEQERROR 15 -#define TWCC_DENIED 16 -#define TWCC_FILEEXISTS 17 -#define TWCC_FILENOTFOUND 18 -#define TWCC_NOTEMPTY 19 -#define TWCC_PAPERJAM 20 -#define TWCC_PAPERDOUBLEFEED 21 -#define TWCC_FILEWRITEERROR 22 -#define TWCC_CHECKDEVICEONLINE 23 -#define TWCC_INTERLOCK 24 -#define TWCC_DAMAGEDCORNER 25 -#define TWCC_FOCUSERROR 26 -#define TWCC_DOCTOOLIGHT 27 -#define TWCC_DOCTOODARK 28 -#define TWCC_NOMEDIA 29 - -/* bit patterns: for query the operation that are supported by the data source on a capability */ -/* Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT */ -#define TWQC_GET 0x0001 -#define TWQC_SET 0x0002 -#define TWQC_GETDEFAULT 0x0004 -#define TWQC_GETCURRENT 0x0008 -#define TWQC_RESET 0x0010 -#define TWQC_SETCONSTRAINT 0x0020 -#define TWQC_CONSTRAINABLE 0x0040 -#define TWQC_GETHELP 0x0100 -#define TWQC_GETLABEL 0x0200 -#define TWQC_GETLABELENUM 0x0400 - -/**************************************************************************** - * Depreciated Items * - ****************************************************************************/ -#if defined(WIN32) || defined(WIN64) - #define TW_HUGE -#elif !defined(TWH_CMP_GNU) - #define TW_HUGE huge -#else - #define TW_HUGE -#endif - - -typedef BYTE TW_HUGE * HPBYTE; -typedef void TW_HUGE * HPVOID; - -typedef unsigned char TW_STR1024[1026], FAR *pTW_STR1026, FAR *pTW_STR1024; -typedef wchar_t TW_UNI512[512], FAR *pTW_UNI512; - -#define TWTY_STR1024 0x000d -#define TWTY_UNI512 0x000e - -#define TWFF_JPN 12 - -#define DAT_TWUNKIDENTITY 0x000b -#define DAT_SETUPFILEXFER2 0x0301 - -#define CAP_SUPPORTEDCAPSEXT 0x100c -#define CAP_FILESYSTEM //0x???? -#define CAP_PAGEMULTIPLEACQUIRE 0x1023 -#define CAP_PAPERBINDING 0x102f -#define CAP_PASSTHRU 0x1031 -#define CAP_POWERDOWNTIME 0x1034 -#define ACAP_AUDIOFILEFORMAT 0x1201 - -#define MSG_CHECKSTATUS 0x0201 - -#define MSG_INVOKE_CALLBACK 0x0903 /* Mac Only, deprecated - use DAT_NULL and MSG_xxx instead */ - -#define TWSX_FILE2 3 - -/* CAP_FILESYSTEM values (FS_ means file system) */ -#define TWFS_FILESYSTEM 0 -#define TWFS_RECURSIVEDELETE 1 - -/* ICAP_PIXELTYPE values (PT_ means Pixel Type) */ -#define TWPT_SRGB64 11 -#define TWPT_BGR 12 -#define TWPT_CIELAB 13 -#define TWPT_CIELUV 14 -#define TWPT_YCBCR 15 - -/* ICAP_SUPPORTEDSIZES values (SS_ means Supported Sizes) */ -#define TWSS_B 8 -#define TWSS_A4LETTER TWSS_A4 -#define TWSS_B3 TWSS_ISOB3 -#define TWSS_B4 TWSS_ISOB4 -#define TWSS_B6 TWSS_ISOB6 -#define TWSS_B5LETTER TWSS_JISB5 - - -/* ACAP_AUDIOFILEFORMAT values (AF_ means audio format). Added 1.8 */ -#define TWAF_WAV 0 -#define TWAF_AIFF 1 -#define TWAF_AU 3 -#define TWAF_SND 4 - - -/* DAT_SETUPFILEXFER2. Sets up DS to application data transfer via a file. Added 1.9 */ -typedef struct { - TW_MEMREF FileName; - TW_UINT16 FileNameType; - TW_UINT16 Format; - TW_INT16 VRefNum; - TW_UINT32 parID; -} TW_SETUPFILEXFER2, FAR * pTW_SETUPFILEXFER2; - -/* DAT_TWUNKIDENTITY. Provides DS identity and 'other' information necessary */ -/* across thunk link. */ -typedef struct { - TW_IDENTITY identity; - TW_STR255 dsPath; -} TW_TWUNKIDENTITY, FAR * pTW_TWUNKIDENTITY; - -/* Provides DS_Entry parameters over thunk link. */ -typedef struct -{ - TW_INT8 destFlag; - TW_IDENTITY dest; - TW_INT32 dataGroup; - TW_INT16 dataArgType; - TW_INT16 message; - TW_INT32 pDataSize; - // TW_MEMREF pData; -} TW_TWUNKDSENTRYPARAMS, FAR * pTW_TWUNKDSENTRYPARAMS; - -/* Provides DS_Entry results over thunk link. */ -typedef struct -{ - TW_UINT16 returnCode; - TW_UINT16 conditionCode; - TW_INT32 pDataSize; - // TW_MEMREF pData; - - - -} TW_TWUNKDSENTRYRETURN, FAR * pTW_TWUNKDSENTRYRETURN; - -typedef struct -{ - TW_UINT16 Cap; - TW_UINT16 Properties; -} TW_CAPEXT, FAR * pTW_CAPEXT; - -/* DAT_SETUPAUDIOFILEXFER, information required to setup an audio file transfer */ -typedef struct { - TW_STR255 FileName; /* full path target file */ - TW_UINT16 Format; /* one of TWAF_xxxx */ - TW_INT16 VRefNum; -} TW_SETUPAUDIOFILEXFER, FAR * pTW_SETUPAUDIOFILEXFER; - - -/**************************************************************************** - * Entry Points * - ****************************************************************************/ - -/********************************************************************** - * Function: DSM_Entry, the only entry point into the Data Source Manager. - ********************************************************************/ -#ifdef TWH_CMP_MSC - #define TW_CALLINGSTYLE PASCAL -#else - #define TW_CALLINGSTYLE -#endif - -/* Don't mangle the name "DSM_Entry" if we're compiling in C++! */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -TW_UINT16 TW_CALLINGSTYLE DSM_Entry( pTW_IDENTITY pOrigin, - pTW_IDENTITY pDest, - TW_UINT32 DG, - TW_UINT16 DAT, - TW_UINT16 MSG, - TW_MEMREF pData); - -typedef TW_UINT16 (TW_CALLINGSTYLE *DSMENTRYPROC)(pTW_IDENTITY pOrigin, - pTW_IDENTITY pDest, - TW_UINT32 DG, - TW_UINT16 DAT, - TW_UINT16 MSG, - TW_MEMREF pData); -#ifdef __cplusplus -} -#endif /* cplusplus */ - - -/********************************************************************** - * Function: DS_Entry, the entry point provided by a Data Source. - ********************************************************************/ -/* Don't mangle the name "DS_Entry" if we're compiling in C++! */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -TW_UINT16 TW_CALLINGSTYLE DS_Entry(pTW_IDENTITY pOrigin, - TW_UINT32 DG, - TW_UINT16 DAT, - TW_UINT16 MSG, - TW_MEMREF pData); - -typedef TW_UINT16 (FAR PASCAL *DSENTRYPROC)(pTW_IDENTITY pOrigin, - TW_UINT32 DG, - TW_UINT16 DAT, - TW_UINT16 MSG, - TW_MEMREF pData); - -TW_UINT16 TW_CALLINGSTYLE TWAIN_Callback( pTW_IDENTITY pOrigin, - pTW_IDENTITY pDest, - TW_UINT32 DG, - TW_UINT16 DAT, - TW_UINT16 MSG, - TW_MEMREF pData); -typedef TW_UINT16 (TW_CALLINGSTYLE *TWAINCALLBACKPROC)(pTW_IDENTITY pOrigin, - pTW_IDENTITY pDest, - TW_UINT32 DG, - TW_UINT16 DAT, - TW_UINT16 MSG, - TW_MEMREF pData); - -TW_HANDLE TW_CALLINGSTYLE DSM_MemAllocate (TW_UINT32); -typedef TW_HANDLE (TW_CALLINGSTYLE *DSM_MEMALLOCATE)(TW_UINT32 _size); - -void TW_CALLINGSTYLE DSM_MemFree (TW_HANDLE); -typedef void (TW_CALLINGSTYLE *DSM_MEMFREE)(TW_HANDLE _handle); - -TW_MEMREF TW_CALLINGSTYLE DSM_MemLock (TW_HANDLE); -typedef TW_MEMREF (TW_CALLINGSTYLE *DSM_MEMLOCK)(TW_HANDLE _handle); - -void TW_CALLINGSTYLE DSM_MemUnlock (TW_HANDLE); -typedef void (TW_CALLINGSTYLE *DSM_MEMUNLOCK)(TW_HANDLE _handle); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/* DAT_ENTRYPOINT. returns essential entry points. */ -typedef struct { - TW_UINT32 Size; - DSMENTRYPROC DSM_Entry; - DSM_MEMALLOCATE DSM_MemAllocate; - DSM_MEMFREE DSM_MemFree; - DSM_MEMLOCK DSM_MemLock; - DSM_MEMUNLOCK DSM_MemUnlock; -} TW_ENTRYPOINT, FAR * pTW_ENTRYPOINT; - -/* DAT_FILTER*/ -typedef struct { - TW_UINT32 Size; - TW_UINT32 HueStart; - TW_UINT32 HueEnd; - TW_UINT32 SaturationStart; - TW_UINT32 SaturationEnd; - TW_UINT32 ValueStart; - TW_UINT32 ValueEnd; - TW_UINT32 Replacement; -} TW_FILTER_DESCRIPTOR, *pTW_FILTER_DESCRIPTOR; - -/* DAT_FILTER */ -typedef struct { - TW_UINT32 Size; - TW_UINT32 DescriptorCount; - TW_UINT32 MaxDescriptorCount; - TW_UINT32 Condition; - TW_HANDLE hDescriptors; -} TW_FILTER, *pTW_FILTER; - - -/* Restore the previous packing alignment: this occurs after all structures are defined */ -#ifdef TWH_CMP_MSC - #pragma pack (pop, before_twain) -#elif defined(TWH_CMP_GNU) - #if defined(__APPLE__) /* cf: Mac version of TWAIN.h */ - #pragma options align = reset - #else - #pragma pack (pop, before_twain) - #endif -#elif defined(TWH_CMP_BORLAND) - #pragma option 朼. -#endif - -#endif /* TWAIN */ diff --git a/pub/external/lib/FreeImage.lib b/pub/external/lib/FreeImage.lib deleted file mode 100644 index 70937f0..0000000 Binary files a/pub/external/lib/FreeImage.lib and /dev/null differ diff --git a/pub/external/lib/FreeImagedx64.lib b/pub/external/lib/FreeImagedx64.lib deleted file mode 100644 index e90e53f..0000000 Binary files a/pub/external/lib/FreeImagedx64.lib and /dev/null differ diff --git a/pub/external/lib/FreeImagex64.lib b/pub/external/lib/FreeImagex64.lib deleted file mode 100644 index 130ee65..0000000 Binary files a/pub/external/lib/FreeImagex64.lib and /dev/null differ diff --git a/pub/external/lib/jsonObject.lib b/pub/external/lib/jsonObject.lib deleted file mode 100644 index 1af81e4..0000000 Binary files a/pub/external/lib/jsonObject.lib and /dev/null differ diff --git a/pub/external/lib/jsonObjectD.lib b/pub/external/lib/jsonObjectD.lib deleted file mode 100644 index cb618da..0000000 Binary files a/pub/external/lib/jsonObjectD.lib and /dev/null differ diff --git a/pub/external/lib/json_vc71_libmt.lib b/pub/external/lib/json_vc71_libmt.lib deleted file mode 100644 index 2200143..0000000 Binary files a/pub/external/lib/json_vc71_libmt.lib and /dev/null differ diff --git a/pub/external/lib/json_vc71_libmtd.lib b/pub/external/lib/json_vc71_libmtd.lib deleted file mode 100644 index ba01d36..0000000 Binary files a/pub/external/lib/json_vc71_libmtd.lib and /dev/null differ diff --git a/pub/external/lib/turbojpeg.lib b/pub/external/lib/turbojpeg.lib deleted file mode 100644 index 3eca189..0000000 Binary files a/pub/external/lib/turbojpeg.lib and /dev/null differ diff --git a/pub/hwocr/bin/x64/cnocr.dll b/pub/hwocr/bin/x64/cnocr.dll deleted file mode 100644 index fc9a568..0000000 Binary files a/pub/hwocr/bin/x64/cnocr.dll and /dev/null differ diff --git a/pub/hwocr/bin/x64/hwocr.dll b/pub/hwocr/bin/x64/hwocr.dll deleted file mode 100644 index b6450e7..0000000 Binary files a/pub/hwocr/bin/x64/hwocr.dll and /dev/null differ diff --git a/pub/hwocr/bin/x86/cnocr.dll b/pub/hwocr/bin/x86/cnocr.dll deleted file mode 100644 index e7448a1..0000000 Binary files a/pub/hwocr/bin/x86/cnocr.dll and /dev/null differ diff --git a/pub/hwocr/bin/x86/hwocr.dll b/pub/hwocr/bin/x86/hwocr.dll deleted file mode 100644 index 31385ec..0000000 Binary files a/pub/hwocr/bin/x86/hwocr.dll and /dev/null differ diff --git a/pub/hwocr/include/hwadv.h b/pub/hwocr/include/hwadv.h deleted file mode 100644 index edfb52a..0000000 --- a/pub/hwocr/include/hwadv.h +++ /dev/null @@ -1,110 +0,0 @@ -// HWOCR库头文件 -// hhoking 2017 -// -#pragma once -#include "hwocr.h" - -#if SDK_TABLE - -typedef struct tagHWCell -{ - int rowStart; // 行起始逻辑号(0起始) - int rowEnd; // 行结束逻辑号 - int colStart; // 列起始逻辑号(0起始) - int colEnd; // 列结束逻辑号 - RECT rect; // 单元格待识别块区域 - HWBlock* block; // 识别信息 -#ifdef HWOCR_LIBSRC - tagHWCell() { memset(this, 0, sizeof(tagHWCell)); } - ~tagHWCell() - { - if (block) - delete block; - } -#endif -} -HWCell; - -typedef struct tagHWTable -{ - int rowCount; // 逻辑行数 - int colCount; // 逻辑列数 - int cellCount; // 单元格数 - HWCell* cells; // 单元格 -#ifdef HWOCR_LIBSRC - tagHWTable() { memset(this, 0, sizeof(tagHWTable)); } - ~tagHWTable() - { - if (cells) - delete [] cells; - } -#endif -} -HWTable; - -typedef struct tagHWRegion -{ - RECT rect; // 块区域 - BLKTYPE type; // 块类型(BT_TEXT、BT_IMAGE、BT_TABLE) - void* block; // 块指针 -#ifdef HWOCR_LIBSRC - tagHWRegion() { memset(this, 0, sizeof(tagHWRegion)); } - ~tagHWRegion() - { - if (block) - { - if (type == BT_TABLE) - delete (HWTable *)block; - else - delete (HWBlock *)block; - } - } -#endif -} -HWRegion; - -typedef struct tagHWResult2 -{ - HWRegion* blocks; // 块信息结构指针 - int blockCount; // 块个数 -#ifdef HWOCR_LIBSRC - tagHWResult2() { memset(this, 0, sizeof(tagHWResult2)); } - ~tagHWResult2() - { - if (blocks) - delete [] blocks; - } -#endif -} -HWResult2; - -HWOCR_ADV_API HWResult2* socrTabRecognize(szpath filename, szpath dbpath = NULL); - -HWOCR_ADV_API HWResult2* socrTabRecognize2(HWIMAGE img, szpath dbpath = NULL); - -HWOCR_ADV_API void socrTabFreeResult(HWResult2* ptr); - -#endif - -#if SDK_DIRECTION - -// 获取方向 -// thres - 阈值[(质量好的图)30 - 50(质量不好的图)] -// 返回值:0 - 正向;90 - 左旋90;180 - 旋转180;270 - 右旋90 -HWOCR_ADV_API int socrGetDirection(szpath filename, int thres = 40); - -// 获取方向新方法 -HWOCR_ADV_API int socrGetDirectionEx(szpath filename); -// scan0 - 图像光栅数据,要求8位灰度,正向,行单字节对齐 -HWOCR_ADV_API int socrGetDirectionEx2(puchar scan0, int w, int h); - -#endif - -#if SDK_STAMP - -HWOCR_ADV_API bool socrRemoveSeal(HWIMAGE img); - -// 识别带印章的文本 -HWOCR_API pwchar socrRecognizeWithSeal(szpath filename, szpath dbpath = NULL); - -#endif \ No newline at end of file diff --git a/pub/hwocr/lib/x64/hwocr.lib b/pub/hwocr/lib/x64/hwocr.lib deleted file mode 100644 index 313d362..0000000 Binary files a/pub/hwocr/lib/x64/hwocr.lib and /dev/null differ diff --git a/pub/hwocr/lib/x86/hwocr.lib b/pub/hwocr/lib/x86/hwocr.lib deleted file mode 100644 index 6493af9..0000000 Binary files a/pub/hwocr/lib/x86/hwocr.lib and /dev/null differ diff --git a/res/hugaotwainds.rc2 b/res/hugaotwainds.rc2 deleted file mode 100644 index 4374471..0000000 Binary files a/res/hugaotwainds.rc2 and /dev/null differ diff --git a/resource.h b/resource.h deleted file mode 100644 index 5c3a8b7..0000000 Binary files a/resource.h and /dev/null differ diff --git a/scn_config.cpp b/scn_config.cpp deleted file mode 100644 index 1ebf17a..0000000 --- a/scn_config.cpp +++ /dev/null @@ -1,191 +0,0 @@ -#include "stdafx.h" -#include "scn_config.h" -#include "math.h" -#include "twain.h" - - -hgConfigClass::hgConfigClass() -{ - initpaperTypes(); - initPixType(); - initResolution(); -} - -hgConfigClass::hgConfigClass(SFreeImage param) -{ - initpaperTypes(); - initPixType(); - initResolution(); - settwSS(param.m_HardWareParams.PaperType); - setTwPixelType(param.m_HardWareParams.PixType); - setResolution(200.0f);//param.m_HardWareParams.Resolution 暂时硬件只支持真实200dpi - setDoubleFeedEnable(param.m_HardWareParams.DoubleFeederOn); - setStapleEnable(param.m_HardWareParams.StapleDetectOn); - setSkewDelection(param.m_HardWareParams.SkrewDetectOn); - switch (param.m_HardWareParams.SkrewDetectLevel) - { - case 1: - setBit(12, false); - setBit(13, false); - setBit(14, false); - break; - case 2: - setBit(12, true); - setBit(13, false); - setBit(14, false); - break; - case 3: - setBit(12, false); - setBit(13, true); - setBit(14, false); - break; - case 4: - setBit(12, true); - setBit(13, true); - setBit(14, false); - break; - case 5: - setBit(12, false); - setBit(13, false); - setBit(14, true); - break; - default: - break; - } -} - - -hgConfigClass::~hgConfigClass() -{ -} - -void hgConfigClass::settwSS(UINT32 value) -{ - UINT32 uval; - if (ContainspaperTypesKey(value)) - { - uval = paperTypes[value]; - } - else - { - uval = 2; - } - - for (size_t i = 1; i < 6; i++) - { - setBit(i, ((uval >> i - 1) & 0x1) == 0x01); - } - //printf("settwSS: %d\n", Data); -} - -void hgConfigClass::setTwPixelType(UINT32 value) -{ - UINT32 uval; - if (ContainsPixTypeKey(value)) - uval = pixType[value]; - else - uval = 2; - setBit(6, uval == 0x01); -} - -void hgConfigClass::setResolution(UINT32 value) -{ - UINT32 uval; - if (ContainsResolutionKey(value)) - uval = resolutions[value]; - else - uval = 1; - - for (size_t i = 7; i < 9; i++) - { - setBit(i, ((uval << (i - 7)) & 0x1) == 0x01); - } -} - -void hgConfigClass::setDoubleFeedEnable(bool value) -{ - setBit(9, value); -} - -void hgConfigClass::setStapleEnable(bool value) -{ - setBit(10, value); -} - -void hgConfigClass::setSkewDelection(bool value) -{ - setBit(11, value); -} - -unsigned int hgConfigClass::GetData() -{ - return m_data.to_ulong(); -} - -void hgConfigClass::initpaperTypes() -{ - paperTypes.insert(std::pair(11, 0));//A3 - paperTypes.insert(std::pair(1, 1));//A4 - paperTypes.insert(std::pair(60, 2));//A4R - paperTypes.insert(std::pair(5, 2));//A5 - paperTypes.insert(std::pair(61, 2));//A5R - paperTypes.insert(std::pair(13, 2));//A6 - paperTypes.insert(std::pair(62, 2));//A6R - paperTypes.insert(std::pair(6, 0));//B4 - paperTypes.insert(std::pair(2, 0));//B5 - paperTypes.insert(std::pair(70, 1));//B5R - paperTypes.insert(std::pair(7, 2));//B6 - paperTypes.insert(std::pair(71, 2));//B6R - paperTypes.insert(std::pair(3, 1));//LETTER - paperTypes.insert(std::pair(80, 2));//LETTERR - paperTypes.insert(std::pair(81, 0));//DOUBLE LETTER - paperTypes.insert(std::pair(4, 0));//LEGAL - paperTypes.insert(std::pair(90, 0));//Auto 按照A3进行扫描 - paperTypes.insert(std::pair(91, 16));//长文稿 -} - -void hgConfigClass::initPixType() -{ - pixType.insert(std::pair(0, 0));//BW - pixType.insert(std::pair(1, 0));//Gray - pixType.insert(std::pair(2,1));//RGB -} - -void hgConfigClass::initResolution() -{ - resolutions.insert(std::pair(300, 0));//300 - resolutions.insert(std::pair(200, 1));//200 - resolutions.insert(std::pair(600, 2));//600 -} - -bool hgConfigClass::ContainspaperTypesKey(uint16_t key) -{ - if (paperTypes.count(key) > 0) - { - return true; - } - return false; -} - -bool hgConfigClass::ContainsPixTypeKey(uint16_t key) -{ - if (pixType.count(key)>0) - { - return true; - } - return false; -} - -bool hgConfigClass::ContainsResolutionKey(float key) -{ - if (resolutions.count(key)>0) - { - return true; - } - return false; -} - -void hgConfigClass::setBit(int i, bool flag) -{ - m_data.set(i -1, flag); -} \ No newline at end of file diff --git a/scn_config.h b/scn_config.h deleted file mode 100644 index e7156b0..0000000 --- a/scn_config.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include "PublicFunc.h" -#include "IConfig.h" - -typedef unsigned short uint16_t; - -class hgConfigClass:public IConfig -{ -public: - hgConfigClass(); - hgConfigClass(SFreeImage param); - virtual ~hgConfigClass(); - - virtual unsigned int GetData() override; -private: - enum Config_Scanner - { - cfStaple, - cfSkewDelection, - SkewLevel0, - SkewLevel1, - SkewLevel2 - }; - - void settwSS(UINT32 value); - void setTwPixelType(UINT32 value); - void setResolution(UINT32 value); - void setDoubleFeedEnable(bool value); - void setStapleEnable(bool value); - void setSkewDelection(bool value); - - std::map paperTypes; - std::map pixType; - std::map resolutions; - void initpaperTypes(); - void initPixType(); - void initResolution(); - bool ContainspaperTypesKey(uint16_t key); - bool ContainsPixTypeKey(uint16_t key); - bool ContainsResolutionKey(float key); - void setBit(int i, bool flag); - - - std::bitset<32> m_data; -}; - diff --git a/stdafx.cpp b/stdafx.cpp deleted file mode 100644 index cc3e78f..0000000 Binary files a/stdafx.cpp and /dev/null differ diff --git a/stdafx.h b/stdafx.h deleted file mode 100644 index 983a849..0000000 Binary files a/stdafx.h and /dev/null differ diff --git a/targetver.h b/targetver.h deleted file mode 100644 index e2da66c..0000000 Binary files a/targetver.h and /dev/null differ diff --git a/twainEx.h b/twainEx.h deleted file mode 100644 index dc36ed9..0000000 --- a/twainEx.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once -#include "twain.h" - -enum TWSS_EX -{ - TWSS_A4R = TWSS_MAXSIZE + 1, - TWSS_A5R, - TWSS_A6R, - TWSS_B5R, - TWSS_B6R, - LETTERR, - DOUBLELETTER, - TWSS_AUTOCROP, - TWSS_LONGDOCMENT, - TWSS_B5 -};